From: Andrea Amorese Date: Tue, 9 Nov 2021 10:30:52 +0000 (+0100) Subject: Built motion from commit 529ebfd3.|2.5.37 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22thisimagedoesnotexist.png/%22javascript:;//%22%7B%7Blicense.fax?a=commitdiff_plain;h=45a838cf9328ce539ebaf1d4d8c7628fe11c0e73;p=motion2.git Built motion from commit 529ebfd3.|2.5.37 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 2a03b58..39f7f5d 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-09T09:50:24.084Z", + "time": "2021-11-09T10:13:26.680Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 0009905..84a4955 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-09T09:50:24.084Z", + "time": "2021-11-09T10:13:26.680Z", "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 364deb5..e4d67f5 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 _0x598d=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','contactManager','motionbar','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x87d4df,_0xa67ee3){var _0x2cea8d=function(_0x5be174){while(--_0x5be174){_0x87d4df['push'](_0x87d4df['shift']());}};_0x2cea8d(++_0xa67ee3);}(_0x598d,0x190));var _0xd598=function(_0x14b622,_0xbf2f5){_0x14b622=_0x14b622-0x0;var _0x17b23b=_0x598d[_0x14b622];return _0x17b23b;};'use strict';var Sequelize=require(_0xd598('0x0'));module[_0xd598('0x1')]={'name':{'type':Sequelize[_0xd598('0x2')],'get':function(_0x58f591){return this[_0xd598('0x3')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xd598('0x4'),'integration',_0xd598('0x5'),'jscripty',_0xd598('0x6'),'browser',_0xd598('0x7'),_0xd598('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xd598('0x9')},'data1':{'type':Sequelize[_0xd598('0xa')](0x1000),'comment':_0xd598('0xb')},'data2':{'type':Sequelize[_0xd598('0xa')](0x1000),'comment':_0xd598('0xc')},'data3':{'type':Sequelize[_0xd598('0xa')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xd598('0xa')](0x1000),'comments':_0xd598('0xd')},'data5':{'type':Sequelize[_0xd598('0xa')](0x1000),'comments':_0xd598('0xe')},'data6':{'type':Sequelize[_0xd598('0xa')],'comments':_0xd598('0xf')},'data7':{'type':Sequelize[_0xd598('0x10')],'comments':_0xd598('0x11')}}; \ No newline at end of file +var _0x61fb=['integration','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','exports','VIRTUAL','action','contactManager'];(function(_0x2829b3,_0x306490){var _0xe61d82=function(_0x277068){while(--_0x277068){_0x2829b3['push'](_0x2829b3['shift']());}};_0xe61d82(++_0x306490);}(_0x61fb,0x1ac));var _0xb61f=function(_0x59ec7a,_0x1eb345){_0x59ec7a=_0x59ec7a-0x0;var _0x8535ed=_0x61fb[_0x59ec7a];return _0x8535ed;};'use strict';var Sequelize=require('sequelize');module[_0xb61f('0x0')]={'name':{'type':Sequelize[_0xb61f('0x1')],'get':function(_0x14bd78){return this['getDataValue'](_0xb61f('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xb61f('0x3'),_0xb61f('0x4'),_0xb61f('0x5'),_0xb61f('0x6'),'urlForward',_0xb61f('0x7'),'bot',_0xb61f('0x8')]],'msg':_0xb61f('0x9')}},'comment':_0xb61f('0x9')},'data1':{'type':Sequelize[_0xb61f('0xa')](0x1000),'comment':_0xb61f('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xb61f('0xc')},'data3':{'type':Sequelize[_0xb61f('0xa')](0x1000),'comment':_0xb61f('0xd')},'data4':{'type':Sequelize[_0xb61f('0xa')](0x1000),'comments':_0xb61f('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xb61f('0xa')],'comments':_0xb61f('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b0d4193..35c2ca7 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 _0x5860=['save','update','destroy','then','stack','name','send','body','Action','find','catch','params','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/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','reject'];(function(_0xd9dd5e,_0x45b072){var _0x1e4351=function(_0x46e230){while(--_0x46e230){_0xd9dd5e['push'](_0xd9dd5e['shift']());}};_0x1e4351(++_0x45b072);}(_0x5860,0x155));var _0x0586=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5860[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0586('0x0'));var jsonpatch=require(_0x0586('0x1'));var rp=require(_0x0586('0x2'));var moment=require(_0x0586('0x3'));var BPromise=require(_0x0586('0x4'));var Mustache=require(_0x0586('0x5'));var util=require(_0x0586('0x6'));var path=require(_0x0586('0x7'));var sox=require(_0x0586('0x8'));var csv=require(_0x0586('0x9'));var ejs=require(_0x0586('0xa'));var fs=require('fs');var fs_extra=require(_0x0586('0xb'));var _=require('lodash');var squel=require(_0x0586('0xc'));var crypto=require(_0x0586('0xd'));var jsforce=require(_0x0586('0xe'));var deskjs=require(_0x0586('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0586('0x10'));var Papa=require(_0x0586('0x11'));var Redis=require(_0x0586('0x12'));var authService=require(_0x0586('0x13'));var qs=require(_0x0586('0x14'));var as=require(_0x0586('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0586('0x16'))(_0x0586('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0586('0x18'));var db=require(_0x0586('0x19'))['db'];function respondWithStatusCode(_0x3e27ce,_0x572479){_0x572479=_0x572479||0xcc;return function(_0x5d10fd){if(_0x5d10fd){return _0x3e27ce[_0x0586('0x1a')](_0x572479);}return _0x3e27ce[_0x0586('0x1b')](_0x572479)[_0x0586('0x1c')]();};}function respondWithResult(_0x459690,_0x518100){_0x518100=_0x518100||0xc8;return function(_0x5eb87e){if(_0x5eb87e){return _0x459690['status'](_0x518100)['json'](_0x5eb87e);}};}function respondWithFilteredResult(_0x2c2403,_0x24cba9){return function(_0x190584){if(_0x190584){var _0x21e4df=typeof _0x24cba9[_0x0586('0x1d')]===_0x0586('0x1e')&&typeof _0x24cba9[_0x0586('0x1f')]==='undefined';var _0x2a3866=_0x190584['count'];var _0x24274d=_0x21e4df?0x0:_0x24cba9['offset'];var _0x4ee561=_0x21e4df?_0x190584['count']:_0x24cba9[_0x0586('0x1d')]+_0x24cba9[_0x0586('0x1f')];var _0x1604a7;if(_0x4ee561>=_0x2a3866){_0x4ee561=_0x2a3866;_0x1604a7=0xc8;}else{_0x1604a7=0xce;}_0x2c2403[_0x0586('0x1b')](_0x1604a7);return _0x2c2403[_0x0586('0x20')](_0x0586('0x21'),_0x24274d+'-'+_0x4ee561+'/'+_0x2a3866)['json'](_0x190584);}return null;};}function patchUpdates(_0x4bc04b){return function(_0x436279){try{jsonpatch['apply'](_0x436279,_0x4bc04b,!![]);}catch(_0x253acd){return BPromise[_0x0586('0x22')](_0x253acd);}return _0x436279[_0x0586('0x23')]();};}function saveUpdates(_0xf70706,_0x3f64b8){return function(_0x48b227){if(_0x48b227){return _0x48b227[_0x0586('0x24')](_0xf70706)['then'](function(_0x415108){return _0x415108;});}return null;};}function removeEntity(_0x41746e,_0x3560cd){return function(_0x89caaa){if(_0x89caaa){return _0x89caaa[_0x0586('0x25')]()[_0x0586('0x26')](function(){_0x41746e[_0x0586('0x1b')](0xcc)[_0x0586('0x1c')]();});}};}function handleEntityNotFound(_0x40cc7d,_0x5305a5){return function(_0x421ed5){if(!_0x421ed5){_0x40cc7d[_0x0586('0x1a')](0x194);}return _0x421ed5;};}function handleError(_0x27c51b,_0x350af0){_0x350af0=_0x350af0||0x1f4;return function(_0x3e7fe7){logger['error'](_0x3e7fe7[_0x0586('0x27')]);if(_0x3e7fe7[_0x0586('0x28')]){delete _0x3e7fe7[_0x0586('0x28')];}_0x27c51b[_0x0586('0x1b')](_0x350af0)[_0x0586('0x29')](_0x3e7fe7);};}exports[_0x0586('0x24')]=function(_0x42d61e,_0x42dc96){if(_0x42d61e['body']['id']){delete _0x42d61e[_0x0586('0x2a')]['id'];}return db[_0x0586('0x2b')][_0x0586('0x2c')]({'where':{'id':_0x42d61e['params']['id']}})[_0x0586('0x26')](handleEntityNotFound(_0x42dc96,null))[_0x0586('0x26')](saveUpdates(_0x42d61e[_0x0586('0x2a')],null))[_0x0586('0x26')](respondWithResult(_0x42dc96,null))[_0x0586('0x2d')](handleError(_0x42dc96,null));};exports[_0x0586('0x25')]=function(_0x197994,_0x69029c){return db[_0x0586('0x2b')][_0x0586('0x2c')]({'where':{'id':_0x197994[_0x0586('0x2e')]['id']}})[_0x0586('0x26')](handleEntityNotFound(_0x69029c,null))['then'](removeEntity(_0x69029c,null))[_0x0586('0x2d')](handleError(_0x69029c,null));}; \ No newline at end of file +var _0x07e6=['zip-dir','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','body','Action','find','params','catch','eml-format','rimraf'];(function(_0x410680,_0x450b2d){var _0x49dc01=function(_0x34cd93){while(--_0x34cd93){_0x410680['push'](_0x410680['shift']());}};_0x49dc01(++_0x450b2d);}(_0x07e6,0xf8));var _0x607e=function(_0x235d09,_0x1d207a){_0x235d09=_0x235d09-0x0;var _0x4c10f0=_0x07e6[_0x235d09];return _0x4c10f0;};'use strict';var emlformat=require(_0x607e('0x0'));var rimraf=require(_0x607e('0x1'));var zipdir=require(_0x607e('0x2'));var jsonpatch=require(_0x607e('0x3'));var rp=require(_0x607e('0x4'));var moment=require(_0x607e('0x5'));var BPromise=require(_0x607e('0x6'));var Mustache=require(_0x607e('0x7'));var util=require(_0x607e('0x8'));var path=require('path');var sox=require(_0x607e('0x9'));var csv=require(_0x607e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x607e('0xb'));var _=require(_0x607e('0xc'));var squel=require(_0x607e('0xd'));var crypto=require(_0x607e('0xe'));var jsforce=require(_0x607e('0xf'));var deskjs=require(_0x607e('0x10'));var toCsv=require(_0x607e('0xa'));var querystring=require(_0x607e('0x11'));var Papa=require(_0x607e('0x12'));var Redis=require(_0x607e('0x13'));var authService=require(_0x607e('0x14'));var qs=require(_0x607e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x607e('0x16'));var logger=require(_0x607e('0x17'))(_0x607e('0x18'));var utils=require(_0x607e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x607e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf1d2d3,_0x49584e){_0x49584e=_0x49584e||0xcc;return function(_0x55922a){if(_0x55922a){return _0xf1d2d3[_0x607e('0x1b')](_0x49584e);}return _0xf1d2d3[_0x607e('0x1c')](_0x49584e)[_0x607e('0x1d')]();};}function respondWithResult(_0x582407,_0x3654e1){_0x3654e1=_0x3654e1||0xc8;return function(_0x29610b){if(_0x29610b){return _0x582407[_0x607e('0x1c')](_0x3654e1)[_0x607e('0x1e')](_0x29610b);}};}function respondWithFilteredResult(_0x4bf4cb,_0x2af881){return function(_0x1fdf58){if(_0x1fdf58){var _0x4cdf7d=typeof _0x2af881[_0x607e('0x1f')]===_0x607e('0x20')&&typeof _0x2af881[_0x607e('0x21')]===_0x607e('0x20');var _0x23f332=_0x1fdf58[_0x607e('0x22')];var _0x37a9cf=_0x4cdf7d?0x0:_0x2af881[_0x607e('0x1f')];var _0x48b67c=_0x4cdf7d?_0x1fdf58[_0x607e('0x22')]:_0x2af881['offset']+_0x2af881[_0x607e('0x21')];var _0xf42247;if(_0x48b67c>=_0x23f332){_0x48b67c=_0x23f332;_0xf42247=0xc8;}else{_0xf42247=0xce;}_0x4bf4cb['status'](_0xf42247);return _0x4bf4cb['set'](_0x607e('0x23'),_0x37a9cf+'-'+_0x48b67c+'/'+_0x23f332)['json'](_0x1fdf58);}return null;};}function patchUpdates(_0x41cc48){return function(_0x42d574){try{jsonpatch[_0x607e('0x24')](_0x42d574,_0x41cc48,!![]);}catch(_0x2340f7){return BPromise[_0x607e('0x25')](_0x2340f7);}return _0x42d574[_0x607e('0x26')]();};}function saveUpdates(_0xa648a,_0x1d9a99){return function(_0x34bce1){if(_0x34bce1){return _0x34bce1[_0x607e('0x27')](_0xa648a)[_0x607e('0x28')](function(_0x5a0783){return _0x5a0783;});}return null;};}function removeEntity(_0x149dd8,_0x43b80c){return function(_0x5462b4){if(_0x5462b4){return _0x5462b4[_0x607e('0x29')]()[_0x607e('0x28')](function(){_0x149dd8['status'](0xcc)[_0x607e('0x1d')]();});}};}function handleEntityNotFound(_0x16ad0d,_0x5f0b5f){return function(_0x5e12c3){if(!_0x5e12c3){_0x16ad0d['sendStatus'](0x194);}return _0x5e12c3;};}function handleError(_0x63a70c,_0x26e752){_0x26e752=_0x26e752||0x1f4;return function(_0x19dc94){logger[_0x607e('0x2a')](_0x19dc94[_0x607e('0x2b')]);if(_0x19dc94[_0x607e('0x2c')]){delete _0x19dc94[_0x607e('0x2c')];}_0x63a70c[_0x607e('0x1c')](_0x26e752)['send'](_0x19dc94);};}exports[_0x607e('0x27')]=function(_0x1d25f8,_0x37d2ac){if(_0x1d25f8[_0x607e('0x2d')]['id']){delete _0x1d25f8[_0x607e('0x2d')]['id'];}return db[_0x607e('0x2e')][_0x607e('0x2f')]({'where':{'id':_0x1d25f8[_0x607e('0x30')]['id']}})['then'](handleEntityNotFound(_0x37d2ac,null))[_0x607e('0x28')](saveUpdates(_0x1d25f8[_0x607e('0x2d')],null))[_0x607e('0x28')](respondWithResult(_0x37d2ac,null))[_0x607e('0x31')](handleError(_0x37d2ac,null));};exports[_0x607e('0x29')]=function(_0x4422ff,_0x5c7828){return db[_0x607e('0x2e')][_0x607e('0x2f')]({'where':{'id':_0x4422ff[_0x607e('0x30')]['id']}})[_0x607e('0x28')](handleEntityNotFound(_0x5c7828,null))[_0x607e('0x28')](removeEntity(_0x5c7828,null))[_0x607e('0x31')](handleError(_0x5c7828,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index cc31554..dd5de37 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 _0x41d0=['../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x41d0,0x191));var _0x041d=function(_0x2158a8,_0x335f85){_0x2158a8=_0x2158a8-0x0;var _0x4b1071=_0x41d0[_0x2158a8];return _0x4b1071;};'use strict';var _=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var logger=require(_0x041d('0x2'))('api');var moment=require(_0x041d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x041d('0x4'));var rimraf=require(_0x041d('0x5'));var config=require(_0x041d('0x6'));var attributes=require(_0x041d('0x7'));module[_0x041d('0x8')]=function(_0x16ce18,_0x566423){return _0x16ce18['define'](_0x041d('0x9'),attributes,{'tableName':_0x041d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64c2=['../../config/environment','./action.attributes','exports','tools_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x41726c,_0x4cf7a4){var _0x1c9577=function(_0x17abc6){while(--_0x17abc6){_0x41726c['push'](_0x41726c['shift']());}};_0x1c9577(++_0x4cf7a4);}(_0x64c2,0x178));var _0x264c=function(_0x46f849,_0x19974d){_0x46f849=_0x46f849-0x0;var _0x29200e=_0x64c2[_0x46f849];return _0x29200e;};'use strict';var _=require(_0x264c('0x0'));var util=require('util');var logger=require(_0x264c('0x1'))(_0x264c('0x2'));var moment=require(_0x264c('0x3'));var BPromise=require(_0x264c('0x4'));var rp=require(_0x264c('0x5'));var fs=require('fs');var path=require(_0x264c('0x6'));var rimraf=require(_0x264c('0x7'));var config=require(_0x264c('0x8'));var attributes=require(_0x264c('0x9'));module[_0x264c('0xa')]=function(_0x464a51,_0x5149a2){return _0x464a51['define']('Action',attributes,{'tableName':_0x264c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 4f01f96..5744f1c 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 _0x326f=['info','Action,\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(_0x35753d,_0x5588a6){var _0x762e5c=function(_0x5648b6){while(--_0x5648b6){_0x35753d['push'](_0x35753d['shift']());}};_0x762e5c(++_0x5588a6);}(_0x326f,0xd1));var _0xf326=function(_0x376e68,_0x100437){_0x376e68=_0x376e68-0x0;var _0x37709b=_0x326f[_0x376e68];return _0x37709b;};'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')]('Action,\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')]('Action,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x4975,0x86));var _0x5497=function(_0x4daf75,_0x30fe8b){_0x4daf75=_0x4daf75-0x0;var _0x5d18c3=_0x4975[_0x4daf75];return _0x5d18c3;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6987b1c..9d97369 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 _0xbd9e=['../../config/environment','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1ed735,_0x427bc1){var _0x465b2d=function(_0xf24129){while(--_0xf24129){_0x1ed735['push'](_0x1ed735['shift']());}};_0x465b2d(++_0x427bc1);}(_0xbd9e,0x165));var _0xebd9=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xbd9e[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0xebd9('0x0'));var util=require(_0xebd9('0x1'));var path=require(_0xebd9('0x2'));var timeout=require(_0xebd9('0x3'));var express=require(_0xebd9('0x4'));var router=express[_0xebd9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xebd9('0x6'));var config=require(_0xebd9('0x7'));var controller=require('./action.controller');router[_0xebd9('0x8')]('/:id',auth[_0xebd9('0x9')](),controller[_0xebd9('0xa')]);router[_0xebd9('0xb')]('/:id',auth[_0xebd9('0x9')](),controller[_0xebd9('0xc')]);module['exports']=router; \ No newline at end of file +var _0x8347=['delete','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update'];(function(_0x136810,_0x4baf0e){var _0x316a0e=function(_0x44e92b){while(--_0x44e92b){_0x136810['push'](_0x136810['shift']());}};_0x316a0e(++_0x4baf0e);}(_0x8347,0x198));var _0x7834=function(_0x27438b,_0x4f865c){_0x27438b=_0x27438b-0x0;var _0x17f7b7=_0x8347[_0x27438b];return _0x17f7b7;};'use strict';var multer=require(_0x7834('0x0'));var util=require(_0x7834('0x1'));var path=require(_0x7834('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7834('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7834('0x4'));var config=require(_0x7834('0x5'));var controller=require('./action.controller');router[_0x7834('0x6')](_0x7834('0x7'),auth[_0x7834('0x8')](),controller[_0x7834('0x9')]);router[_0x7834('0xa')]('/:id',auth[_0x7834('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 748551b..68e7ecc 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x43a9d2,_0x293d10){var _0x2b443e=function(_0xa5426f){while(--_0xa5426f){_0x43a9d2['push'](_0x43a9d2['shift']());}};_0x2b443e(++_0x293d10);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x4451da,_0x5ead4e){_0x4451da=_0x4451da-0x0;var _0x39d1ed=_0x3eea[_0x4451da];return _0x39d1ed;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file +var _0xeec6=['STRING','TEXT','sequelize','exports'];(function(_0x2afd92,_0x44ffb7){var _0x5210eb=function(_0x45493e){while(--_0x45493e){_0x2afd92['push'](_0x2afd92['shift']());}};_0x5210eb(++_0x44ffb7);}(_0xeec6,0x1c2));var _0x6eec=function(_0xae9024,_0x17f58e){_0xae9024=_0xae9024-0x0;var _0x23e7d3=_0xeec6[_0xae9024];return _0x23e7d3;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'name':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6eec('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6eec('0x2')]},'conditions':{'type':Sequelize[_0x6eec('0x3')]},'joins':{'type':Sequelize[_0x6eec('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0d6eb75..31147ee 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 _0xe137=['info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','alias','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','CustomReports','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','catch','show','AnalyticCustomReport','includeAll','find','create','body','user','get','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','left_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','DESC','joins','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','parse','clone','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','right_join','cross_join','MAX(%s)','DATE(%s)','ROUND(%s)','IS\x20EMPTY','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate'];(function(_0x4b75b9,_0x4cbbb9){var _0xd88b6=function(_0x4b4352){while(--_0x4b4352){_0x4b75b9['push'](_0x4b75b9['shift']());}};_0xd88b6(++_0x4cbbb9);}(_0xe137,0xb3));var _0x7e13=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xe137[_0x4a3898];return _0x25ceb0;};'use strict';var emlformat=require(_0x7e13('0x0'));var rimraf=require(_0x7e13('0x1'));var zipdir=require(_0x7e13('0x2'));var jsonpatch=require(_0x7e13('0x3'));var rp=require(_0x7e13('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e13('0x5'));var util=require('util');var path=require(_0x7e13('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e13('0x7'));var _=require(_0x7e13('0x8'));var squel=require(_0x7e13('0x9'));var crypto=require(_0x7e13('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e13('0xb'));var querystring=require(_0x7e13('0xc'));var Papa=require(_0x7e13('0xd'));var Redis=require(_0x7e13('0xe'));var authService=require(_0x7e13('0xf'));var qs=require(_0x7e13('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e13('0x11'));var logger=require(_0x7e13('0x12'))(_0x7e13('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7e13('0x14'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7e13('0x15'))[_0x7e13('0x16')];function respondWithStatusCode(_0x214395,_0x3800c8){_0x3800c8=_0x3800c8||0xcc;return function(_0x6bcbe0){if(_0x6bcbe0){return _0x214395[_0x7e13('0x17')](_0x3800c8);}return _0x214395[_0x7e13('0x18')](_0x3800c8)[_0x7e13('0x19')]();};}function respondWithResult(_0x1d2c07,_0x4853d7){_0x4853d7=_0x4853d7||0xc8;return function(_0x2bc3d1){if(_0x2bc3d1){return _0x1d2c07[_0x7e13('0x18')](_0x4853d7)[_0x7e13('0x1a')](_0x2bc3d1);}};}function respondWithFilteredResult(_0x266a5b,_0x51447a){return function(_0x419dbf){if(_0x419dbf){var _0x5e8896=typeof _0x51447a[_0x7e13('0x1b')]===_0x7e13('0x1c')&&typeof _0x51447a[_0x7e13('0x1d')]===_0x7e13('0x1c');var _0x483c3b=_0x419dbf[_0x7e13('0x1e')];var _0x3ea219=_0x5e8896?0x0:_0x51447a['offset'];var _0x283a5a=_0x5e8896?_0x419dbf[_0x7e13('0x1e')]:_0x51447a[_0x7e13('0x1b')]+_0x51447a[_0x7e13('0x1d')];var _0x1a6641;if(_0x283a5a>=_0x483c3b){_0x283a5a=_0x483c3b;_0x1a6641=0xc8;}else{_0x1a6641=0xce;}_0x266a5b[_0x7e13('0x18')](_0x1a6641);return _0x266a5b[_0x7e13('0x1f')](_0x7e13('0x20'),_0x3ea219+'-'+_0x283a5a+'/'+_0x483c3b)[_0x7e13('0x1a')](_0x419dbf);}return null;};}function patchUpdates(_0x76c2bd){return function(_0x20d8e4){try{jsonpatch['apply'](_0x20d8e4,_0x76c2bd,!![]);}catch(_0x1be9a8){return BPromise[_0x7e13('0x21')](_0x1be9a8);}return _0x20d8e4['save']();};}function saveUpdates(_0x58df4d,_0x2a1921){return function(_0x760bcc){if(_0x760bcc){return _0x760bcc['update'](_0x58df4d)['then'](function(_0x5835c8){return _0x5835c8;});}return null;};}function removeEntity(_0x580745,_0x432ab0){return function(_0x156e4c){if(_0x156e4c){return _0x156e4c[_0x7e13('0x22')]()[_0x7e13('0x23')](function(){var _0x1f56e9=_0x156e4c['get']({'plain':!![]});var _0xa54815=_0x7e13('0x24');return db[_0x7e13('0x25')]['destroy']({'where':{'type':_0xa54815,'resourceId':_0x1f56e9['id']}})['then'](function(){return _0x156e4c;});})[_0x7e13('0x23')](function(){_0x580745['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f3769,_0x2357b8){return function(_0x312af8){if(!_0x312af8){_0x3f3769[_0x7e13('0x17')](0x194);}return _0x312af8;};}function handleError(_0x19925a,_0x434bed){_0x434bed=_0x434bed||0x1f4;return function(_0x5d939c){logger['error'](_0x5d939c['stack']);if(_0x5d939c['name']){delete _0x5d939c[_0x7e13('0x26')];}_0x19925a['status'](_0x434bed)[_0x7e13('0x27')](_0x5d939c);};}exports[_0x7e13('0x28')]=function(_0x46c73d,_0x2e31b4){var _0x59c660={},_0x4366e1={},_0x30b68f={'count':0x0,'rows':[]};var _0x1be521=_['map'](db['AnalyticCustomReport'][_0x7e13('0x29')],function(_0xeb8809){return{'name':_0xeb8809[_0x7e13('0x2a')],'type':_0xeb8809[_0x7e13('0x2b')][_0x7e13('0x2c')]};});_0x4366e1['model']=_[_0x7e13('0x2d')](_0x1be521,_0x7e13('0x26'));_0x4366e1[_0x7e13('0x2e')]=_[_0x7e13('0x2f')](_0x46c73d['query']);_0x4366e1[_0x7e13('0x30')]=_[_0x7e13('0x31')](_0x4366e1[_0x7e13('0x32')],_0x4366e1['query']);_0x59c660[_0x7e13('0x33')]=_[_0x7e13('0x31')](_0x4366e1['model'],qs[_0x7e13('0x34')](_0x46c73d[_0x7e13('0x2e')]['fields']));_0x59c660['attributes']=_0x59c660[_0x7e13('0x33')][_0x7e13('0x35')]?_0x59c660['attributes']:_0x4366e1[_0x7e13('0x32')];if(!_0x46c73d[_0x7e13('0x2e')][_0x7e13('0x36')]('nolimit')){_0x59c660['limit']=qs[_0x7e13('0x1d')](_0x46c73d['query'][_0x7e13('0x1d')]);_0x59c660[_0x7e13('0x1b')]=qs[_0x7e13('0x1b')](_0x46c73d[_0x7e13('0x2e')][_0x7e13('0x1b')]);}_0x59c660[_0x7e13('0x37')]=qs['sort'](_0x46c73d[_0x7e13('0x2e')][_0x7e13('0x38')]);_0x59c660['where']=qs[_0x7e13('0x30')](_[_0x7e13('0x39')](_0x46c73d[_0x7e13('0x2e')],_0x4366e1[_0x7e13('0x30')]),_0x1be521);if(_0x46c73d['query'][_0x7e13('0x3a')]){_0x59c660[_0x7e13('0x3b')]=_[_0x7e13('0x3c')](_0x59c660['where'],{'$or':_[_0x7e13('0x2d')](_0x1be521,function(_0x2d70db){if(_0x2d70db['type']!=='VIRTUAL'){var _0x20bf3f={};_0x20bf3f[_0x2d70db[_0x7e13('0x26')]]={'$like':'%'+_0x46c73d['query']['filter']+'%'};return _0x20bf3f;}})});}_0x59c660=_['merge']({},_0x59c660,_0x46c73d[_0x7e13('0x3d')]);var _0x5a363f={'where':_0x59c660[_0x7e13('0x3b')]};return db['AnalyticCustomReport'][_0x7e13('0x1e')](_0x5a363f)[_0x7e13('0x23')](function(_0x147f7a){_0x30b68f['count']=_0x147f7a;if(_0x46c73d[_0x7e13('0x2e')]['includeAll']){_0x59c660[_0x7e13('0x3e')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x59c660);})['then'](function(_0x14ea52){_0x30b68f['rows']=_0x14ea52;return _0x30b68f;})[_0x7e13('0x23')](respondWithFilteredResult(_0x2e31b4,_0x59c660))[_0x7e13('0x3f')](handleError(_0x2e31b4,null));};exports[_0x7e13('0x40')]=function(_0x331475,_0x4c1b2f){var _0x588ab1={'raw':![],'where':{'id':_0x331475['params']['id']}},_0xa68fb0={};_0xa68fb0[_0x7e13('0x32')]=_[_0x7e13('0x2f')](db[_0x7e13('0x41')][_0x7e13('0x29')]);_0xa68fb0[_0x7e13('0x2e')]=_[_0x7e13('0x2f')](_0x331475['query']);_0xa68fb0[_0x7e13('0x30')]=_['intersection'](_0xa68fb0[_0x7e13('0x32')],_0xa68fb0[_0x7e13('0x2e')]);_0x588ab1[_0x7e13('0x33')]=_['intersection'](_0xa68fb0[_0x7e13('0x32')],qs[_0x7e13('0x34')](_0x331475[_0x7e13('0x2e')][_0x7e13('0x34')]));_0x588ab1[_0x7e13('0x33')]=_0x588ab1[_0x7e13('0x33')][_0x7e13('0x35')]?_0x588ab1[_0x7e13('0x33')]:_0xa68fb0[_0x7e13('0x32')];if(_0x331475[_0x7e13('0x2e')][_0x7e13('0x42')]){_0x588ab1[_0x7e13('0x3e')]=[{'all':!![]}];}_0x588ab1=_[_0x7e13('0x3c')]({},_0x588ab1,_0x331475[_0x7e13('0x3d')]);return db[_0x7e13('0x41')][_0x7e13('0x43')](_0x588ab1)['then'](handleEntityNotFound(_0x4c1b2f,null))[_0x7e13('0x23')](respondWithResult(_0x4c1b2f,null))[_0x7e13('0x3f')](handleError(_0x4c1b2f,null));};exports[_0x7e13('0x44')]=function(_0x469af3,_0x4ffd3a){return db[_0x7e13('0x41')][_0x7e13('0x44')](_0x469af3[_0x7e13('0x45')],{})[_0x7e13('0x23')](function(_0xe5ef2e){var _0xb4ad27=_0x469af3[_0x7e13('0x46')][_0x7e13('0x47')]({'plain':!![]});if(!_0xb4ad27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb4ad27[_0x7e13('0x48')]===_0x7e13('0x46')){var _0xa75a18=_0xe5ef2e[_0x7e13('0x47')]({'plain':!![]});var _0x1fdbcb=_0x7e13('0x49');return db[_0x7e13('0x4a')][_0x7e13('0x43')]({'where':{'name':_0x1fdbcb,'userProfileId':_0xb4ad27[_0x7e13('0x4b')]},'raw':!![]})['then'](function(_0x1a143b){if(_0x1a143b&&_0x1a143b[_0x7e13('0x4c')]===0x0){return db[_0x7e13('0x25')][_0x7e13('0x44')]({'name':_0xa75a18[_0x7e13('0x26')],'resourceId':_0xa75a18['id'],'type':_0x7e13('0x24'),'sectionId':_0x1a143b['id']},{})[_0x7e13('0x23')](function(){return _0xe5ef2e;});}else{return _0xe5ef2e;}})[_0x7e13('0x3f')](function(_0x379501){logger[_0x7e13('0x4d')](_0x7e13('0x4e'),_0x379501);throw _0x379501;});}return _0xe5ef2e;})[_0x7e13('0x23')](respondWithResult(_0x4ffd3a,0xc9))[_0x7e13('0x3f')](handleError(_0x4ffd3a,null));};exports[_0x7e13('0x4f')]=function(_0x5569ef,_0x2dd377){if(_0x5569ef[_0x7e13('0x45')]['id']){delete _0x5569ef['body']['id'];}return db[_0x7e13('0x41')][_0x7e13('0x43')]({'where':{'id':_0x5569ef[_0x7e13('0x50')]['id']}})[_0x7e13('0x23')](handleEntityNotFound(_0x2dd377,null))[_0x7e13('0x23')](saveUpdates(_0x5569ef[_0x7e13('0x45')],null))['then'](respondWithResult(_0x2dd377,null))[_0x7e13('0x3f')](handleError(_0x2dd377,null));};exports[_0x7e13('0x22')]=function(_0x37dca5,_0x326b68){return db['AnalyticCustomReport'][_0x7e13('0x43')]({'where':{'id':_0x37dca5['params']['id']}})[_0x7e13('0x23')](handleEntityNotFound(_0x326b68,null))[_0x7e13('0x23')](removeEntity(_0x326b68,null))['catch'](handleError(_0x326b68,null));};exports[_0x7e13('0x51')]=function(_0x3dea33,_0x483fb6){var _0x436bb4=0xa;var _0x40aca1=['join',_0x7e13('0x52'),'right_join','cross_join'];var _0x54f9ea={'SUM':_0x7e13('0x53'),'COUNT':_0x7e13('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x7e13('0x55'),'AVG':_0x7e13('0x56'),'GROUP_CONCAT':_0x7e13('0x57'),'GROUP_CONCAT ASC':_0x7e13('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x56e310={'SEC_TO_TIME':_0x7e13('0x59'),'DATE':'DATE(%s)','HOUR':_0x7e13('0x5a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7e13('0x5b')};var _0x2b72ed=function(_0x42fcf7){return!_[_0x7e13('0x5c')]([_0x7e13('0x5d'),_0x7e13('0x5e'),'IS\x20EMPTY',_0x7e13('0x5f')],_0x42fcf7);};var _0x564f1d=function(_0x56dfbc){if(!_0x56dfbc||!_0x56dfbc['rules']['length']){return'';}for(var _0x3eed26='(',_0x194b43=0x0;_0x194b43<_0x56dfbc[_0x7e13('0x60')][_0x7e13('0x35')];_0x194b43+=0x1){_0x194b43>0x0&&(_0x3eed26+='\x20'+_0x56dfbc[_0x7e13('0x61')]+'\x20');_0x3eed26+=_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x62')]?_0x564f1d(_0x56dfbc['rules'][_0x194b43]['group']):_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x63')]+'\x20'+_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x64')]+(_0x2b72ed(_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x64')])?'\x20'+_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x65')]:'');}return _0x3eed26+')';};var _0x2b4766={'where':{'id':_0x3dea33['params']['id']}},_0x689851,_0x553474,_0x4f1a31,_0x5333f8,_0x5737ad;_0x2b4766=_[_0x7e13('0x3c')]({},_0x2b4766,_0x3dea33[_0x7e13('0x3d')]);return db[_0x7e13('0x41')][_0x7e13('0x43')](_0x2b4766)[_0x7e13('0x23')](function(_0xfad94b){if(_0xfad94b){_0x689851=_0xfad94b;return _0xfad94b[_0x7e13('0x66')]();}return null;})[_0x7e13('0x23')](function(_0x3e782c){if(_0x3e782c){if(!_0x3e782c['length']){throw new db[(_0x7e13('0x67'))][(_0x7e13('0x68'))](_0x7e13('0x69'),0x193);}_0x553474=_0x3e782c;return db[_0x7e13('0x6a')][_0x7e13('0x6b')]({'raw':!![]});}return null;})[_0x7e13('0x23')](function(_0x2187cf){if(_0x2187cf){_0x4f1a31=_[_0x7e13('0x6c')](_0x2187cf,'id');var _0x4dbb07;var _0x5b9a40=squel[_0x7e13('0x6d')]();_0x5b9a40[_0x7e13('0x6e')](_0x689851['table']);for(var _0x539434=0x0;_0x539434<_0x553474[_0x7e13('0x35')];_0x539434+=0x1){_0x4dbb07=_0x553474[_0x539434][_0x7e13('0x6f')]?_0x4f1a31[_0x553474[_0x539434]['MetricId']][_0x7e13('0x70')]:_0x553474[_0x539434]['field'];_0x4dbb07=_0x553474[_0x539434][_0x7e13('0x71')]?_[_0x7e13('0x72')](_0x54f9ea[_0x553474[_0x539434][_0x7e13('0x71')]],'%s',_0x4dbb07):_0x4dbb07;_0x4dbb07=_0x553474[_0x539434]['format']?_['replace'](_0x56e310[_0x553474[_0x539434]['format']],'%s',_0x4dbb07):_0x4dbb07;if(_0x553474[_0x539434][_0x7e13('0x73')]){_0x5b9a40[_0x7e13('0x62')](_0x4dbb07);}_0x553474[_0x539434][_0x7e13('0x74')]&&_0x5b9a40[_0x7e13('0x37')](_0x4dbb07,_0x553474[_0x539434][_0x7e13('0x74')]===_0x7e13('0x75')?![]:!![]);_0x5b9a40[_0x7e13('0x63')](_0x4dbb07,_0x553474[_0x539434]['alias']||_0x4dbb07);}if(_0x689851['joins']){_0x689851['joins']=JSON['parse'](_0x689851[_0x7e13('0x76')]);for(var _0x2f447d=0x0;_0x2f447d<_0x689851['joins'][_0x7e13('0x35')];_0x2f447d+=0x1){if(_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x2b')]&&_[_0x7e13('0x5c')](_0x40aca1,_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x2b')])&&_0x689851[_0x7e13('0x76')][_0x2f447d]['parentKey']&&_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x77')]&&_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x78')]){_0x5b9a40[_0x689851[_0x7e13('0x76')][_0x2f447d]['type']](_0x689851['joins'][_0x2f447d][_0x7e13('0x77')],null,util[_0x7e13('0x79')](_0x7e13('0x7a'),_0x689851[_0x7e13('0x7b')],_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x7c')],_0x689851['joins'][_0x2f447d][_0x7e13('0x77')],_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x78')]));}}}if(_0x689851[_0x7e13('0x7d')]){_0x689851['conditions']=JSON[_0x7e13('0x7e')](_0x689851[_0x7e13('0x7d')]);_0x5b9a40[_0x7e13('0x3b')](_0x564f1d(_0x689851[_0x7e13('0x7d')]['group']));}_0x5737ad=_0x5b9a40[_0x7e13('0x7f')]();_0x5b9a40[_0x7e13('0x1d')](_0x436bb4);_0x5b9a40['offset'](0x0);logger['debug'](_0x7e13('0x80'),_0x5b9a40['toString']());return dbH[_0x7e13('0x81')][_0x7e13('0x2e')](_0x5b9a40[_0x7e13('0x82')](),{'type':dbH[_0x7e13('0x81')][_0x7e13('0x83')][_0x7e13('0x84')]});}})[_0x7e13('0x23')](respondWithResult(_0x483fb6,null))[_0x7e13('0x3f')](handleError(_0x483fb6,null));};function runReport(_0x3dd0e0,_0x5d04b1,_0x2c729a){var _0x2f8b3b=_0x5d04b1[_0x7e13('0x26')];var _0x506924=0xa;var _0x5e5d9d=[_0x7e13('0x85'),'left_join',_0x7e13('0x86'),_0x7e13('0x87')];var _0x1b1f25={'SUM':_0x7e13('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7e13('0x88'),'MIN':_0x7e13('0x55'),'AVG':_0x7e13('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7e13('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x56b846={'SEC_TO_TIME':_0x7e13('0x59'),'DATE':_0x7e13('0x89'),'HOUR':_0x7e13('0x5a'),'ROUND':_0x7e13('0x8a'),'UNIX_TIMESTAMP':_0x7e13('0x5b')};var _0x411872=function(_0x41c38d){return!_['includes']([_0x7e13('0x5d'),'IS\x20NOT\x20NULL',_0x7e13('0x8b'),_0x7e13('0x5f')],_0x41c38d);};var _0x37dda8=function(_0x508018){if(!_0x508018||!_0x508018[_0x7e13('0x60')]['length']){return'';}for(var _0x36e35c='(',_0x496d7e=0x0;_0x496d7e<_0x508018[_0x7e13('0x60')][_0x7e13('0x35')];_0x496d7e+=0x1){_0x496d7e>0x0&&(_0x36e35c+='\x20'+_0x508018[_0x7e13('0x61')]+'\x20');_0x36e35c+=_0x508018['rules'][_0x496d7e][_0x7e13('0x62')]?_0x37dda8(_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x62')]):_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x63')]+'\x20'+_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x64')]+(_0x411872(_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x64')])?'\x20'+_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x65')]:'');}return _0x36e35c+')';};var _0x596ade={'where':{'id':_0x3dd0e0['id']}},_0x33f460,_0x1951dd,_0x52df71,_0x4a3c53,_0x40dcd1;_0x596ade=_[_0x7e13('0x3c')]({},_0x596ade,_0x2c729a);return db[_0x7e13('0x41')]['find'](_0x596ade)['then'](function(_0x103842){if(_0x103842){_0x33f460=_0x103842;return _0x103842[_0x7e13('0x66')]();}return null;})[_0x7e13('0x23')](function(_0x4dd897){if(_0x4dd897){if(!_0x4dd897[_0x7e13('0x35')]){throw new db['Sequelize'][(_0x7e13('0x68'))](_0x7e13('0x69'),0x193);}_0x1951dd=_0x4dd897;return db[_0x7e13('0x6a')][_0x7e13('0x6b')]({'raw':!![]});}return null;})[_0x7e13('0x23')](function(_0x514c1c){if(_0x514c1c){_0x52df71=_['keyBy'](_0x514c1c,'id');var _0x3779c0;var _0x2546ff=squel[_0x7e13('0x6d')]();_0x2546ff[_0x7e13('0x6e')](_0x33f460[_0x7e13('0x7b')]);for(var _0x1f3d4d=0x0;_0x1f3d4d<_0x1951dd[_0x7e13('0x35')];_0x1f3d4d+=0x1){_0x3779c0=_0x1951dd[_0x1f3d4d][_0x7e13('0x6f')]?_0x52df71[_0x1951dd[_0x1f3d4d][_0x7e13('0x6f')]][_0x7e13('0x70')]:_0x1951dd[_0x1f3d4d][_0x7e13('0x63')];_0x3779c0=_0x1951dd[_0x1f3d4d][_0x7e13('0x71')]?_[_0x7e13('0x72')](_0x1b1f25[_0x1951dd[_0x1f3d4d]['function']],'%s',_0x3779c0):_0x3779c0;_0x3779c0=_0x1951dd[_0x1f3d4d][_0x7e13('0x79')]?_[_0x7e13('0x72')](_0x56b846[_0x1951dd[_0x1f3d4d]['format']],'%s',_0x3779c0):_0x3779c0;if(_0x1951dd[_0x1f3d4d][_0x7e13('0x73')]){_0x2546ff[_0x7e13('0x62')](_0x3779c0);}_0x1951dd[_0x1f3d4d][_0x7e13('0x74')]&&_0x2546ff['order'](_0x3779c0,_0x1951dd[_0x1f3d4d]['orderBy']===_0x7e13('0x75')?![]:!![]);_0x2546ff[_0x7e13('0x63')](_0x3779c0,_0x1951dd[_0x1f3d4d]['alias']||_0x3779c0);}if(_0x33f460[_0x7e13('0x76')]){_0x33f460[_0x7e13('0x76')]=JSON[_0x7e13('0x7e')](_0x33f460[_0x7e13('0x76')]);for(var _0x51d9be=0x0;_0x51d9be<_0x33f460[_0x7e13('0x76')][_0x7e13('0x35')];_0x51d9be+=0x1){if(_0x33f460[_0x7e13('0x76')][_0x51d9be][_0x7e13('0x2b')]&&_['includes'](_0x5e5d9d,_0x33f460[_0x7e13('0x76')][_0x51d9be][_0x7e13('0x2b')])&&_0x33f460[_0x7e13('0x76')][_0x51d9be]['parentKey']&&_0x33f460[_0x7e13('0x76')][_0x51d9be][_0x7e13('0x77')]&&_0x33f460[_0x7e13('0x76')][_0x51d9be][_0x7e13('0x78')]){_0x2546ff[_0x33f460['joins'][_0x51d9be][_0x7e13('0x2b')]](_0x33f460[_0x7e13('0x76')][_0x51d9be]['foreignTable'],null,util['format'](_0x7e13('0x7a'),_0x33f460['table'],_0x33f460['joins'][_0x51d9be][_0x7e13('0x7c')],_0x33f460['joins'][_0x51d9be][_0x7e13('0x77')],_0x33f460[_0x7e13('0x76')][_0x51d9be]['foreignKey']));}}}if(_0x33f460[_0x7e13('0x7d')]){_0x33f460[_0x7e13('0x7d')]=JSON[_0x7e13('0x7e')](_0x33f460[_0x7e13('0x7d')]);_0x2546ff[_0x7e13('0x3b')](_0x37dda8(_0x33f460[_0x7e13('0x7d')][_0x7e13('0x62')]));}_0x40dcd1=_0x2546ff[_0x7e13('0x7f')]();_0x2546ff[_0x7e13('0x1d')](_0x506924);_0x2546ff[_0x7e13('0x1b')](0x0);return;}})[_0x7e13('0x23')](function(){if(_0x5d04b1[_0x7e13('0x8c')]===_0x7e13('0x8d')){return null;}var _0x4511c4=_[_0x7e13('0x3c')](_0x5d04b1,{'name':_0x5d04b1[_0x7e13('0x8e')]||_0x5d04b1['name']||_0x33f460[_0x7e13('0x26')],'basename':_0x2f8b3b,'savename':util[_0x7e13('0x79')](_0x7e13('0x8f'),_0x5d04b1[_0x7e13('0x26')]||_0x33f460['name'],require(_0x7e13('0x90'))[_0x7e13('0x91')](0x4),_0x5d04b1['output']||'csv'),'reportId':_0x33f460['id'],'reportType':_0x7e13('0x92')});return db['AnalyticExtractedReport'][_0x7e13('0x44')](_0x4511c4,{'raw':!![]});})['then'](function(_0x12e510){if(_0x33f460[_0x7e13('0x7b')]==='cdr'){_0x40dcd1['where'](_0x33f460['table']+_0x7e13('0x93'),_0x5d04b1[_0x7e13('0x94')],_0x5d04b1['endDate']);}else{_0x40dcd1['where'](_0x33f460[_0x7e13('0x7b')]+_0x7e13('0x95'),_0x5d04b1['startDate'],_0x5d04b1[_0x7e13('0x96')]);}if(_0x12e510){logger[_0x7e13('0x97')](_0x7e13('0x98'),_0x40dcd1[_0x7e13('0x82')]());require(_0x7e13('0x99'))[_0x7e13('0x9a')](path[_0x7e13('0x85')](__dirname,_0x7e13('0x9b'),_0x12e510[_0x7e13('0x8c')]),[_0x12e510['id'],_0x40dcd1[_0x7e13('0x82')](),path['join'](__dirname,_0x7e13('0x9c'),_0x12e510[_0x7e13('0x9d')]),_0x2f8b3b]);return _0x12e510;}else{var _0xd93f33=squel[_0x7e13('0x6d')]();_0xd93f33[_0x7e13('0x6e')]('('+_0x40dcd1[_0x7e13('0x82')]()+')',_0x7e13('0x9e'));_0xd93f33[_0x7e13('0x63')]('COUNT(*)','count');_0x40dcd1[_0x7e13('0x1d')](_0x5d04b1[_0x7e13('0x1d')]||_0x506924);_0x40dcd1['offset'](_0x5d04b1[_0x7e13('0x1b')]||0x0);return dbH[_0x7e13('0x81')][_0x7e13('0x2e')](_0xd93f33['toString'](),{'type':dbH['sequelize'][_0x7e13('0x83')][_0x7e13('0x84')]})[_0x7e13('0x23')](function(_0x4ffb0f){if(!_0x4ffb0f[_0x7e13('0x35')]){_0x4a3c53=0x0;}else{_0x4a3c53=_0x4ffb0f[0x0][_0x7e13('0x1e')]||0x0;}return dbH[_0x7e13('0x81')]['query'](_0x40dcd1[_0x7e13('0x82')](),{'type':dbH[_0x7e13('0x81')]['QueryTypes'][_0x7e13('0x84')]});})['then'](function(_0x43254c){return{'rows':_0x43254c||[],'count':_0x4a3c53};});}});}exports[_0x7e13('0x9f')]=function(_0x40d3dc,_0x366b11){return runReport(_0x40d3dc[_0x7e13('0x50')],_0x40d3dc[_0x7e13('0x2e')],_0x40d3dc[_0x7e13('0x3d')])[_0x7e13('0x23')](respondWithResult(_0x366b11,null))['catch'](handleError(_0x366b11,null));};exports[_0x7e13('0xa0')]=runReport;exports[_0x7e13('0x2e')]=function(_0x759c7f,_0x2e78a2){var _0x5e0562=0xa;var _0x3befe7=[_0x7e13('0x85'),_0x7e13('0x52'),_0x7e13('0x86'),_0x7e13('0x87')];var _0x497ebb={'SUM':_0x7e13('0x53'),'COUNT':_0x7e13('0x54'),'COUNT DISTINCT':_0x7e13('0xa1'),'MAX':_0x7e13('0x88'),'MIN':'MIN(%s)','AVG':_0x7e13('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7e13('0xa2')};var _0x3ca270={'SEC_TO_TIME':_0x7e13('0x59'),'DATE':_0x7e13('0x89'),'HOUR':_0x7e13('0x5a'),'ROUND':_0x7e13('0x8a'),'UNIX_TIMESTAMP':_0x7e13('0x5b')};var _0x3881b0=function(_0x53dacd){return!_['includes']([_0x7e13('0x5d'),_0x7e13('0x5e'),_0x7e13('0x8b'),_0x7e13('0x5f')],_0x53dacd);};var _0x206e99=function(_0x505435){if(!_0x505435||!_0x505435[_0x7e13('0x60')][_0x7e13('0x35')]){return'';}for(var _0x2fdd8c='(',_0x3e9170=0x0;_0x3e9170<_0x505435[_0x7e13('0x60')][_0x7e13('0x35')];_0x3e9170+=0x1){_0x3e9170>0x0&&(_0x2fdd8c+='\x20'+_0x505435['operator']+'\x20');_0x2fdd8c+=_0x505435[_0x7e13('0x60')][_0x3e9170][_0x7e13('0x62')]?_0x206e99(_0x505435[_0x7e13('0x60')][_0x3e9170][_0x7e13('0x62')]):_0x505435[_0x7e13('0x60')][_0x3e9170][_0x7e13('0x63')]+'\x20'+_0x505435[_0x7e13('0x60')][_0x3e9170]['condition']+(_0x3881b0(_0x505435[_0x7e13('0x60')][_0x3e9170][_0x7e13('0x64')])?'\x20'+_0x505435[_0x7e13('0x60')][_0x3e9170]['value']:'');}return _0x2fdd8c+')';};var _0x17d543={'where':{'id':_0x759c7f[_0x7e13('0x50')]['id']}},_0x490d8e,_0x4d560c,_0x2c3e27,_0x4bb07c,_0x3294e8;_0x17d543=_[_0x7e13('0x3c')]({},_0x17d543,_0x759c7f[_0x7e13('0x3d')]);return db['AnalyticCustomReport'][_0x7e13('0x43')](_0x17d543)[_0x7e13('0x23')](function(_0xee1c3d){if(_0xee1c3d){_0x490d8e=_0xee1c3d;return _0xee1c3d[_0x7e13('0x66')]();}return null;})['then'](function(_0x394cad){if(_0x394cad){if(!_0x394cad['length']){throw new db['Sequelize'][(_0x7e13('0x68'))](_0x7e13('0x69'),0x193);}_0x4d560c=_0x394cad;return db['AnalyticMetric'][_0x7e13('0x6b')]({'raw':!![]});}return null;})[_0x7e13('0x23')](function(_0xe88572){if(_0xe88572){_0x2c3e27=_['keyBy'](_0xe88572,'id');var _0x4eb17d;var _0x50d51f=squel['select']();_0x50d51f[_0x7e13('0x6e')](_0x490d8e[_0x7e13('0x7b')]);for(var _0x142652=0x0;_0x142652<_0x4d560c[_0x7e13('0x35')];_0x142652+=0x1){_0x4eb17d=_0x4d560c[_0x142652]['MetricId']?_0x2c3e27[_0x4d560c[_0x142652][_0x7e13('0x6f')]]['metric']:_0x4d560c[_0x142652][_0x7e13('0x63')];_0x4eb17d=_0x4d560c[_0x142652][_0x7e13('0x71')]?_[_0x7e13('0x72')](_0x497ebb[_0x4d560c[_0x142652][_0x7e13('0x71')]],'%s',_0x4eb17d):_0x4eb17d;_0x4eb17d=_0x4d560c[_0x142652][_0x7e13('0x79')]?_['replace'](_0x3ca270[_0x4d560c[_0x142652]['format']],'%s',_0x4eb17d):_0x4eb17d;if(_0x4d560c[_0x142652][_0x7e13('0x73')]){_0x50d51f[_0x7e13('0x62')](_0x4eb17d);}_0x4d560c[_0x142652][_0x7e13('0x74')]&&_0x50d51f[_0x7e13('0x37')](_0x4eb17d,_0x4d560c[_0x142652]['orderBy']==='DESC'?![]:!![]);_0x50d51f[_0x7e13('0x63')](_0x4eb17d,_0x4d560c[_0x142652][_0x7e13('0xa3')]||_0x4eb17d);}if(_0x490d8e['joins']){_0x490d8e[_0x7e13('0x76')]=JSON[_0x7e13('0x7e')](_0x490d8e['joins']);for(var _0x5ceba9=0x0;_0x5ceba9<_0x490d8e[_0x7e13('0x76')]['length'];_0x5ceba9+=0x1){if(_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x2b')]&&_['includes'](_0x3befe7,_0x490d8e['joins'][_0x5ceba9][_0x7e13('0x2b')])&&_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x7c')]&&_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x77')]&&_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x78')]){_0x50d51f[_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x2b')]](_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x77')],null,util[_0x7e13('0x79')]('%s.%s\x20=\x20%s.%s',_0x490d8e[_0x7e13('0x7b')],_0x490d8e[_0x7e13('0x76')][_0x5ceba9]['parentKey'],_0x490d8e['joins'][_0x5ceba9][_0x7e13('0x77')],_0x490d8e[_0x7e13('0x76')][_0x5ceba9]['foreignKey']));}}}if(_0x490d8e[_0x7e13('0x7d')]){_0x490d8e[_0x7e13('0x7d')]=JSON[_0x7e13('0x7e')](_0x490d8e[_0x7e13('0x7d')]);_0x50d51f[_0x7e13('0x3b')](_0x206e99(_0x490d8e[_0x7e13('0x7d')][_0x7e13('0x62')]));}_0x3294e8=_0x50d51f[_0x7e13('0x7f')]();_0x50d51f[_0x7e13('0x1d')](_0x5e0562);_0x50d51f[_0x7e13('0x1b')](0x0);logger[_0x7e13('0xa4')](_0x7e13('0x80'),_0x50d51f[_0x7e13('0x82')]());return dbH[_0x7e13('0x81')][_0x7e13('0x2e')](_0x50d51f[_0x7e13('0x82')](),{'type':dbH[_0x7e13('0x81')][_0x7e13('0x83')][_0x7e13('0x84')]});}})[_0x7e13('0x23')](function(){return{'sql':_0x3294e8[_0x7e13('0x82')]()};})[_0x7e13('0x23')](respondWithResult(_0x2e78a2,null))['catch'](handleError(_0x2e78a2,null));}; \ No newline at end of file +var _0x0b3a=['from','MetricId','metric','function','format','replace','groupBy','orderBy','alias','joins','parse','type','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','MIN(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','table','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','run','runReport','IS\x20NOT\x20EMPTY','select','rimraf','zip-dir','moment','bluebird','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','stack','name','send','index','map','AnalyticCustomReport','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','create','body','user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0b3a,0x178));var _0xa0b3=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x0b3a[_0x310d10];return _0x1fb8af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0b3('0x0'));var zipdir=require(_0xa0b3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa0b3('0x2'));var BPromise=require(_0xa0b3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa0b3('0x4'));var sox=require('sox');var csv=require(_0xa0b3('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0b3('0x6'));var squel=require(_0xa0b3('0x7'));var crypto=require('crypto');var jsforce=require(_0xa0b3('0x8'));var deskjs=require(_0xa0b3('0x9'));var toCsv=require(_0xa0b3('0x5'));var querystring=require(_0xa0b3('0xa'));var Papa=require(_0xa0b3('0xb'));var Redis=require(_0xa0b3('0xc'));var authService=require(_0xa0b3('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa0b3('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0b3('0xf'))(_0xa0b3('0x10'));var utils=require('../../config/utils');var config=require(_0xa0b3('0x11'));var licenseUtil=require(_0xa0b3('0x12'));var db=require(_0xa0b3('0x13'))['db'];var dbH=require(_0xa0b3('0x13'))['dbH'];function respondWithStatusCode(_0x1f12b1,_0x7a6074){_0x7a6074=_0x7a6074||0xcc;return function(_0x44482f){if(_0x44482f){return _0x1f12b1[_0xa0b3('0x14')](_0x7a6074);}return _0x1f12b1[_0xa0b3('0x15')](_0x7a6074)[_0xa0b3('0x16')]();};}function respondWithResult(_0x1fcfa5,_0x3e863f){_0x3e863f=_0x3e863f||0xc8;return function(_0x2f3c37){if(_0x2f3c37){return _0x1fcfa5[_0xa0b3('0x15')](_0x3e863f)[_0xa0b3('0x17')](_0x2f3c37);}};}function respondWithFilteredResult(_0x4da203,_0x4a3827){return function(_0x33ed17){if(_0x33ed17){var _0x4d4173=typeof _0x4a3827[_0xa0b3('0x18')]===_0xa0b3('0x19')&&typeof _0x4a3827['limit']===_0xa0b3('0x19');var _0x4381ec=_0x33ed17['count'];var _0x1bc27d=_0x4d4173?0x0:_0x4a3827[_0xa0b3('0x18')];var _0x571562=_0x4d4173?_0x33ed17['count']:_0x4a3827[_0xa0b3('0x18')]+_0x4a3827[_0xa0b3('0x1a')];var _0x55bdf4;if(_0x571562>=_0x4381ec){_0x571562=_0x4381ec;_0x55bdf4=0xc8;}else{_0x55bdf4=0xce;}_0x4da203[_0xa0b3('0x15')](_0x55bdf4);return _0x4da203[_0xa0b3('0x1b')](_0xa0b3('0x1c'),_0x1bc27d+'-'+_0x571562+'/'+_0x4381ec)[_0xa0b3('0x17')](_0x33ed17);}return null;};}function patchUpdates(_0x1fa502){return function(_0x4064c3){try{jsonpatch[_0xa0b3('0x1d')](_0x4064c3,_0x1fa502,!![]);}catch(_0x181296){return BPromise[_0xa0b3('0x1e')](_0x181296);}return _0x4064c3[_0xa0b3('0x1f')]();};}function saveUpdates(_0x5a668a,_0x54c261){return function(_0x4de10e){if(_0x4de10e){return _0x4de10e[_0xa0b3('0x20')](_0x5a668a)[_0xa0b3('0x21')](function(_0x7e95a6){return _0x7e95a6;});}return null;};}function removeEntity(_0x1e2ae0,_0x534665){return function(_0x34b754){if(_0x34b754){return _0x34b754['destroy']()[_0xa0b3('0x21')](function(){var _0x511651=_0x34b754[_0xa0b3('0x22')]({'plain':!![]});var _0xa0d17f=_0xa0b3('0x23');return db[_0xa0b3('0x24')][_0xa0b3('0x25')]({'where':{'type':_0xa0d17f,'resourceId':_0x511651['id']}})[_0xa0b3('0x21')](function(){return _0x34b754;});})[_0xa0b3('0x21')](function(){_0x1e2ae0[_0xa0b3('0x15')](0xcc)[_0xa0b3('0x16')]();});}};}function handleEntityNotFound(_0x1016eb,_0x34f94d){return function(_0x5e8038){if(!_0x5e8038){_0x1016eb[_0xa0b3('0x14')](0x194);}return _0x5e8038;};}function handleError(_0x46a61b,_0x7db370){_0x7db370=_0x7db370||0x1f4;return function(_0x2ef0eb){logger['error'](_0x2ef0eb[_0xa0b3('0x26')]);if(_0x2ef0eb[_0xa0b3('0x27')]){delete _0x2ef0eb[_0xa0b3('0x27')];}_0x46a61b['status'](_0x7db370)[_0xa0b3('0x28')](_0x2ef0eb);};}exports[_0xa0b3('0x29')]=function(_0x510ee9,_0x32c5ad){var _0x4e13d5={},_0x22fbc7={},_0x23934b={'count':0x0,'rows':[]};var _0x1853b7=_[_0xa0b3('0x2a')](db[_0xa0b3('0x2b')]['rawAttributes'],function(_0x11417b){return{'name':_0x11417b['fieldName'],'type':_0x11417b['type']['key']};});_0x22fbc7[_0xa0b3('0x2c')]=_[_0xa0b3('0x2a')](_0x1853b7,'name');_0x22fbc7[_0xa0b3('0x2d')]=_['keys'](_0x510ee9[_0xa0b3('0x2d')]);_0x22fbc7['filters']=_['intersection'](_0x22fbc7[_0xa0b3('0x2c')],_0x22fbc7[_0xa0b3('0x2d')]);_0x4e13d5[_0xa0b3('0x2e')]=_[_0xa0b3('0x2f')](_0x22fbc7['model'],qs['fields'](_0x510ee9['query'][_0xa0b3('0x30')]));_0x4e13d5[_0xa0b3('0x2e')]=_0x4e13d5[_0xa0b3('0x2e')][_0xa0b3('0x31')]?_0x4e13d5[_0xa0b3('0x2e')]:_0x22fbc7['model'];if(!_0x510ee9['query'][_0xa0b3('0x32')](_0xa0b3('0x33'))){_0x4e13d5[_0xa0b3('0x1a')]=qs['limit'](_0x510ee9[_0xa0b3('0x2d')][_0xa0b3('0x1a')]);_0x4e13d5[_0xa0b3('0x18')]=qs[_0xa0b3('0x18')](_0x510ee9[_0xa0b3('0x2d')]['offset']);}_0x4e13d5[_0xa0b3('0x34')]=qs[_0xa0b3('0x35')](_0x510ee9[_0xa0b3('0x2d')]['sort']);_0x4e13d5[_0xa0b3('0x36')]=qs['filters'](_['pick'](_0x510ee9[_0xa0b3('0x2d')],_0x22fbc7[_0xa0b3('0x37')]),_0x1853b7);if(_0x510ee9['query'][_0xa0b3('0x38')]){_0x4e13d5[_0xa0b3('0x36')]=_[_0xa0b3('0x39')](_0x4e13d5[_0xa0b3('0x36')],{'$or':_['map'](_0x1853b7,function(_0x4b6eec){if(_0x4b6eec['type']!==_0xa0b3('0x3a')){var _0x619c04={};_0x619c04[_0x4b6eec['name']]={'$like':'%'+_0x510ee9[_0xa0b3('0x2d')]['filter']+'%'};return _0x619c04;}})});}_0x4e13d5=_['merge']({},_0x4e13d5,_0x510ee9['options']);var _0x2e1ec0={'where':_0x4e13d5[_0xa0b3('0x36')]};return db[_0xa0b3('0x2b')][_0xa0b3('0x3b')](_0x2e1ec0)['then'](function(_0xe29494){_0x23934b[_0xa0b3('0x3b')]=_0xe29494;if(_0x510ee9[_0xa0b3('0x2d')][_0xa0b3('0x3c')]){_0x4e13d5[_0xa0b3('0x3d')]=[{'all':!![]}];}return db[_0xa0b3('0x2b')][_0xa0b3('0x3e')](_0x4e13d5);})[_0xa0b3('0x21')](function(_0x403cf1){_0x23934b[_0xa0b3('0x3f')]=_0x403cf1;return _0x23934b;})[_0xa0b3('0x21')](respondWithFilteredResult(_0x32c5ad,_0x4e13d5))[_0xa0b3('0x40')](handleError(_0x32c5ad,null));};exports[_0xa0b3('0x41')]=function(_0x37ff72,_0x260031){var _0x206ddc={'raw':![],'where':{'id':_0x37ff72[_0xa0b3('0x42')]['id']}},_0xf8a94c={};_0xf8a94c[_0xa0b3('0x2c')]=_[_0xa0b3('0x43')](db[_0xa0b3('0x2b')][_0xa0b3('0x44')]);_0xf8a94c[_0xa0b3('0x2d')]=_[_0xa0b3('0x43')](_0x37ff72[_0xa0b3('0x2d')]);_0xf8a94c['filters']=_['intersection'](_0xf8a94c[_0xa0b3('0x2c')],_0xf8a94c[_0xa0b3('0x2d')]);_0x206ddc[_0xa0b3('0x2e')]=_['intersection'](_0xf8a94c['model'],qs[_0xa0b3('0x30')](_0x37ff72[_0xa0b3('0x2d')]['fields']));_0x206ddc[_0xa0b3('0x2e')]=_0x206ddc[_0xa0b3('0x2e')][_0xa0b3('0x31')]?_0x206ddc[_0xa0b3('0x2e')]:_0xf8a94c['model'];if(_0x37ff72[_0xa0b3('0x2d')]['includeAll']){_0x206ddc[_0xa0b3('0x3d')]=[{'all':!![]}];}_0x206ddc=_['merge']({},_0x206ddc,_0x37ff72[_0xa0b3('0x45')]);return db['AnalyticCustomReport']['find'](_0x206ddc)['then'](handleEntityNotFound(_0x260031,null))['then'](respondWithResult(_0x260031,null))[_0xa0b3('0x40')](handleError(_0x260031,null));};exports[_0xa0b3('0x46')]=function(_0x64e3ab,_0x4b3b16){return db['AnalyticCustomReport'][_0xa0b3('0x46')](_0x64e3ab[_0xa0b3('0x47')],{})['then'](function(_0x290b1d){var _0x133e0c=_0x64e3ab[_0xa0b3('0x48')][_0xa0b3('0x22')]({'plain':!![]});if(!_0x133e0c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x133e0c[_0xa0b3('0x49')]===_0xa0b3('0x48')){var _0x4e2250=_0x290b1d[_0xa0b3('0x22')]({'plain':!![]});var _0x2409f4=_0xa0b3('0x4a');return db[_0xa0b3('0x4b')][_0xa0b3('0x4c')]({'where':{'name':_0x2409f4,'userProfileId':_0x133e0c[_0xa0b3('0x4d')]},'raw':!![]})['then'](function(_0x1e40dd){if(_0x1e40dd&&_0x1e40dd[_0xa0b3('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x4e2250[_0xa0b3('0x27')],'resourceId':_0x4e2250['id'],'type':'CustomReports','sectionId':_0x1e40dd['id']},{})['then'](function(){return _0x290b1d;});}else{return _0x290b1d;}})['catch'](function(_0x345885){logger['error'](_0xa0b3('0x4f'),_0x345885);throw _0x345885;});}return _0x290b1d;})[_0xa0b3('0x21')](respondWithResult(_0x4b3b16,0xc9))[_0xa0b3('0x40')](handleError(_0x4b3b16,null));};exports[_0xa0b3('0x20')]=function(_0x26721d,_0x215b4b){if(_0x26721d['body']['id']){delete _0x26721d[_0xa0b3('0x47')]['id'];}return db[_0xa0b3('0x2b')][_0xa0b3('0x4c')]({'where':{'id':_0x26721d[_0xa0b3('0x42')]['id']}})[_0xa0b3('0x21')](handleEntityNotFound(_0x215b4b,null))[_0xa0b3('0x21')](saveUpdates(_0x26721d[_0xa0b3('0x47')],null))[_0xa0b3('0x21')](respondWithResult(_0x215b4b,null))[_0xa0b3('0x40')](handleError(_0x215b4b,null));};exports['destroy']=function(_0x25c780,_0x238422){return db['AnalyticCustomReport'][_0xa0b3('0x4c')]({'where':{'id':_0x25c780['params']['id']}})[_0xa0b3('0x21')](handleEntityNotFound(_0x238422,null))['then'](removeEntity(_0x238422,null))[_0xa0b3('0x40')](handleError(_0x238422,null));};exports['preview']=function(_0x39344c,_0x1064b3){var _0xd93a5a=0xa;var _0x233511=[_0xa0b3('0x50'),_0xa0b3('0x51'),_0xa0b3('0x52'),_0xa0b3('0x53')];var _0x582e8a={'SUM':_0xa0b3('0x54'),'COUNT':_0xa0b3('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa0b3('0x56'),'MIN':'MIN(%s)','AVG':_0xa0b3('0x57'),'GROUP_CONCAT':_0xa0b3('0x58'),'GROUP_CONCAT ASC':_0xa0b3('0x59'),'GROUP_CONCAT DESC':_0xa0b3('0x5a')};var _0x53efcb={'SEC_TO_TIME':_0xa0b3('0x5b'),'DATE':_0xa0b3('0x5c'),'HOUR':_0xa0b3('0x5d'),'ROUND':_0xa0b3('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c8869=function(_0x2cdf5c){return!_[_0xa0b3('0x5f')]([_0xa0b3('0x60'),'IS\x20NOT\x20NULL',_0xa0b3('0x61'),'IS\x20NOT\x20EMPTY'],_0x2cdf5c);};var _0x3532a5=function(_0x4ee020){if(!_0x4ee020||!_0x4ee020[_0xa0b3('0x62')][_0xa0b3('0x31')]){return'';}for(var _0x4a846b='(',_0x17fec7=0x0;_0x17fec7<_0x4ee020[_0xa0b3('0x62')][_0xa0b3('0x31')];_0x17fec7+=0x1){_0x17fec7>0x0&&(_0x4a846b+='\x20'+_0x4ee020[_0xa0b3('0x63')]+'\x20');_0x4a846b+=_0x4ee020[_0xa0b3('0x62')][_0x17fec7]['group']?_0x3532a5(_0x4ee020[_0xa0b3('0x62')][_0x17fec7][_0xa0b3('0x64')]):_0x4ee020[_0xa0b3('0x62')][_0x17fec7][_0xa0b3('0x65')]+'\x20'+_0x4ee020['rules'][_0x17fec7]['condition']+(_0x1c8869(_0x4ee020[_0xa0b3('0x62')][_0x17fec7][_0xa0b3('0x66')])?'\x20'+_0x4ee020['rules'][_0x17fec7][_0xa0b3('0x67')]:'');}return _0x4a846b+')';};var _0xf7a438={'where':{'id':_0x39344c[_0xa0b3('0x42')]['id']}},_0x25e521,_0x485dad,_0x5d3ef7,_0x2f451b,_0x33bfb3;_0xf7a438=_['merge']({},_0xf7a438,_0x39344c[_0xa0b3('0x45')]);return db[_0xa0b3('0x2b')]['find'](_0xf7a438)[_0xa0b3('0x21')](function(_0x66b8cf){if(_0x66b8cf){_0x25e521=_0x66b8cf;return _0x66b8cf[_0xa0b3('0x68')]();}return null;})[_0xa0b3('0x21')](function(_0x923395){if(_0x923395){if(!_0x923395[_0xa0b3('0x31')]){throw new db[(_0xa0b3('0x69'))][(_0xa0b3('0x6a'))](_0xa0b3('0x6b'),0x193);}_0x485dad=_0x923395;return db[_0xa0b3('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xa0b3('0x21')](function(_0x327ada){if(_0x327ada){_0x5d3ef7=_[_0xa0b3('0x6d')](_0x327ada,'id');var _0x1e73b7;var _0x5c908c=squel['select']();_0x5c908c[_0xa0b3('0x6e')](_0x25e521['table']);for(var _0x5a95f6=0x0;_0x5a95f6<_0x485dad[_0xa0b3('0x31')];_0x5a95f6+=0x1){_0x1e73b7=_0x485dad[_0x5a95f6][_0xa0b3('0x6f')]?_0x5d3ef7[_0x485dad[_0x5a95f6]['MetricId']][_0xa0b3('0x70')]:_0x485dad[_0x5a95f6]['field'];_0x1e73b7=_0x485dad[_0x5a95f6]['function']?_['replace'](_0x582e8a[_0x485dad[_0x5a95f6][_0xa0b3('0x71')]],'%s',_0x1e73b7):_0x1e73b7;_0x1e73b7=_0x485dad[_0x5a95f6][_0xa0b3('0x72')]?_[_0xa0b3('0x73')](_0x53efcb[_0x485dad[_0x5a95f6][_0xa0b3('0x72')]],'%s',_0x1e73b7):_0x1e73b7;if(_0x485dad[_0x5a95f6][_0xa0b3('0x74')]){_0x5c908c[_0xa0b3('0x64')](_0x1e73b7);}_0x485dad[_0x5a95f6][_0xa0b3('0x75')]&&_0x5c908c[_0xa0b3('0x34')](_0x1e73b7,_0x485dad[_0x5a95f6]['orderBy']==='DESC'?![]:!![]);_0x5c908c[_0xa0b3('0x65')](_0x1e73b7,_0x485dad[_0x5a95f6][_0xa0b3('0x76')]||_0x1e73b7);}if(_0x25e521['joins']){_0x25e521[_0xa0b3('0x77')]=JSON[_0xa0b3('0x78')](_0x25e521[_0xa0b3('0x77')]);for(var _0xa00031=0x0;_0xa00031<_0x25e521['joins'][_0xa0b3('0x31')];_0xa00031+=0x1){if(_0x25e521[_0xa0b3('0x77')][_0xa00031][_0xa0b3('0x79')]&&_['includes'](_0x233511,_0x25e521['joins'][_0xa00031]['type'])&&_0x25e521[_0xa0b3('0x77')][_0xa00031][_0xa0b3('0x7a')]&&_0x25e521[_0xa0b3('0x77')][_0xa00031][_0xa0b3('0x7b')]&&_0x25e521['joins'][_0xa00031][_0xa0b3('0x7c')]){_0x5c908c[_0x25e521[_0xa0b3('0x77')][_0xa00031][_0xa0b3('0x79')]](_0x25e521[_0xa0b3('0x77')][_0xa00031][_0xa0b3('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x25e521['table'],_0x25e521['joins'][_0xa00031]['parentKey'],_0x25e521['joins'][_0xa00031][_0xa0b3('0x7b')],_0x25e521['joins'][_0xa00031][_0xa0b3('0x7c')]));}}}if(_0x25e521[_0xa0b3('0x7d')]){_0x25e521[_0xa0b3('0x7d')]=JSON[_0xa0b3('0x78')](_0x25e521[_0xa0b3('0x7d')]);_0x5c908c[_0xa0b3('0x36')](_0x3532a5(_0x25e521[_0xa0b3('0x7d')][_0xa0b3('0x64')]));}_0x33bfb3=_0x5c908c[_0xa0b3('0x7e')]();_0x5c908c[_0xa0b3('0x1a')](_0xd93a5a);_0x5c908c[_0xa0b3('0x18')](0x0);logger[_0xa0b3('0x7f')](_0xa0b3('0x80'),_0x5c908c['toString']());return dbH[_0xa0b3('0x81')]['query'](_0x5c908c[_0xa0b3('0x82')](),{'type':dbH[_0xa0b3('0x81')][_0xa0b3('0x83')][_0xa0b3('0x84')]});}})[_0xa0b3('0x21')](respondWithResult(_0x1064b3,null))[_0xa0b3('0x40')](handleError(_0x1064b3,null));};function runReport(_0x5ecf43,_0x3cdcb5,_0x383d1c){var _0x41641c=_0x3cdcb5[_0xa0b3('0x27')];var _0x392dd6=0xa;var _0x29bf59=[_0xa0b3('0x50'),_0xa0b3('0x51'),_0xa0b3('0x52'),_0xa0b3('0x53')];var _0xc0b5cb={'SUM':_0xa0b3('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa0b3('0x85'),'MAX':_0xa0b3('0x56'),'MIN':_0xa0b3('0x86'),'AVG':_0xa0b3('0x57'),'GROUP_CONCAT':_0xa0b3('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x9f57c8={'SEC_TO_TIME':_0xa0b3('0x5b'),'DATE':_0xa0b3('0x5c'),'HOUR':_0xa0b3('0x5d'),'ROUND':_0xa0b3('0x5e'),'UNIX_TIMESTAMP':_0xa0b3('0x87')};var _0x3a0036=function(_0x391544){return!_[_0xa0b3('0x5f')]([_0xa0b3('0x60'),_0xa0b3('0x88'),_0xa0b3('0x61'),'IS\x20NOT\x20EMPTY'],_0x391544);};var _0x5305c7=function(_0xe87014){if(!_0xe87014||!_0xe87014[_0xa0b3('0x62')][_0xa0b3('0x31')]){return'';}for(var _0x406147='(',_0x331e42=0x0;_0x331e42<_0xe87014[_0xa0b3('0x62')][_0xa0b3('0x31')];_0x331e42+=0x1){_0x331e42>0x0&&(_0x406147+='\x20'+_0xe87014[_0xa0b3('0x63')]+'\x20');_0x406147+=_0xe87014[_0xa0b3('0x62')][_0x331e42][_0xa0b3('0x64')]?_0x5305c7(_0xe87014[_0xa0b3('0x62')][_0x331e42][_0xa0b3('0x64')]):_0xe87014[_0xa0b3('0x62')][_0x331e42][_0xa0b3('0x65')]+'\x20'+_0xe87014[_0xa0b3('0x62')][_0x331e42][_0xa0b3('0x66')]+(_0x3a0036(_0xe87014['rules'][_0x331e42][_0xa0b3('0x66')])?'\x20'+_0xe87014[_0xa0b3('0x62')][_0x331e42][_0xa0b3('0x67')]:'');}return _0x406147+')';};var _0x27b71b={'where':{'id':_0x5ecf43['id']}},_0x4736c1,_0x357e83,_0x3996d4,_0x294fa9,_0x88c5bc;_0x27b71b=_['merge']({},_0x27b71b,_0x383d1c);return db[_0xa0b3('0x2b')][_0xa0b3('0x4c')](_0x27b71b)['then'](function(_0x51c082){if(_0x51c082){_0x4736c1=_0x51c082;return _0x51c082[_0xa0b3('0x68')]();}return null;})[_0xa0b3('0x21')](function(_0xe9a67c){if(_0xe9a67c){if(!_0xe9a67c[_0xa0b3('0x31')]){throw new db['Sequelize'][(_0xa0b3('0x6a'))](_0xa0b3('0x6b'),0x193);}_0x357e83=_0xe9a67c;return db[_0xa0b3('0x6c')][_0xa0b3('0x3e')]({'raw':!![]});}return null;})[_0xa0b3('0x21')](function(_0x2b78c3){if(_0x2b78c3){_0x3996d4=_[_0xa0b3('0x6d')](_0x2b78c3,'id');var _0x572a69;var _0x2d7164=squel['select']();_0x2d7164[_0xa0b3('0x6e')](_0x4736c1[_0xa0b3('0x89')]);for(var _0x25f7fd=0x0;_0x25f7fd<_0x357e83[_0xa0b3('0x31')];_0x25f7fd+=0x1){_0x572a69=_0x357e83[_0x25f7fd][_0xa0b3('0x6f')]?_0x3996d4[_0x357e83[_0x25f7fd][_0xa0b3('0x6f')]][_0xa0b3('0x70')]:_0x357e83[_0x25f7fd][_0xa0b3('0x65')];_0x572a69=_0x357e83[_0x25f7fd][_0xa0b3('0x71')]?_[_0xa0b3('0x73')](_0xc0b5cb[_0x357e83[_0x25f7fd][_0xa0b3('0x71')]],'%s',_0x572a69):_0x572a69;_0x572a69=_0x357e83[_0x25f7fd][_0xa0b3('0x72')]?_[_0xa0b3('0x73')](_0x9f57c8[_0x357e83[_0x25f7fd][_0xa0b3('0x72')]],'%s',_0x572a69):_0x572a69;if(_0x357e83[_0x25f7fd][_0xa0b3('0x74')]){_0x2d7164['group'](_0x572a69);}_0x357e83[_0x25f7fd][_0xa0b3('0x75')]&&_0x2d7164[_0xa0b3('0x34')](_0x572a69,_0x357e83[_0x25f7fd][_0xa0b3('0x75')]===_0xa0b3('0x8a')?![]:!![]);_0x2d7164['field'](_0x572a69,_0x357e83[_0x25f7fd]['alias']||_0x572a69);}if(_0x4736c1[_0xa0b3('0x77')]){_0x4736c1[_0xa0b3('0x77')]=JSON['parse'](_0x4736c1[_0xa0b3('0x77')]);for(var _0x58a103=0x0;_0x58a103<_0x4736c1[_0xa0b3('0x77')][_0xa0b3('0x31')];_0x58a103+=0x1){if(_0x4736c1[_0xa0b3('0x77')][_0x58a103][_0xa0b3('0x79')]&&_[_0xa0b3('0x5f')](_0x29bf59,_0x4736c1['joins'][_0x58a103][_0xa0b3('0x79')])&&_0x4736c1[_0xa0b3('0x77')][_0x58a103][_0xa0b3('0x7a')]&&_0x4736c1[_0xa0b3('0x77')][_0x58a103][_0xa0b3('0x7b')]&&_0x4736c1[_0xa0b3('0x77')][_0x58a103][_0xa0b3('0x7c')]){_0x2d7164[_0x4736c1[_0xa0b3('0x77')][_0x58a103]['type']](_0x4736c1['joins'][_0x58a103][_0xa0b3('0x7b')],null,util[_0xa0b3('0x72')](_0xa0b3('0x8b'),_0x4736c1[_0xa0b3('0x89')],_0x4736c1[_0xa0b3('0x77')][_0x58a103][_0xa0b3('0x7a')],_0x4736c1[_0xa0b3('0x77')][_0x58a103][_0xa0b3('0x7b')],_0x4736c1[_0xa0b3('0x77')][_0x58a103][_0xa0b3('0x7c')]));}}}if(_0x4736c1['conditions']){_0x4736c1[_0xa0b3('0x7d')]=JSON[_0xa0b3('0x78')](_0x4736c1[_0xa0b3('0x7d')]);_0x2d7164[_0xa0b3('0x36')](_0x5305c7(_0x4736c1[_0xa0b3('0x7d')][_0xa0b3('0x64')]));}_0x88c5bc=_0x2d7164[_0xa0b3('0x7e')]();_0x2d7164[_0xa0b3('0x1a')](_0x392dd6);_0x2d7164[_0xa0b3('0x18')](0x0);return;}})[_0xa0b3('0x21')](function(){if(_0x3cdcb5[_0xa0b3('0x8c')]===_0xa0b3('0x8d')){return null;}var _0x3dfb53=_['merge'](_0x3cdcb5,{'name':_0x3cdcb5[_0xa0b3('0x8e')]||_0x3cdcb5[_0xa0b3('0x27')]||_0x4736c1[_0xa0b3('0x27')],'basename':_0x41641c,'savename':util[_0xa0b3('0x72')](_0xa0b3('0x8f'),_0x3cdcb5[_0xa0b3('0x27')]||_0x4736c1[_0xa0b3('0x27')],require(_0xa0b3('0x90'))[_0xa0b3('0x91')](0x4),_0x3cdcb5[_0xa0b3('0x8c')]||'csv'),'reportId':_0x4736c1['id'],'reportType':_0xa0b3('0x92')});return db[_0xa0b3('0x93')][_0xa0b3('0x46')](_0x3dfb53,{'raw':!![]});})[_0xa0b3('0x21')](function(_0x532c77){if(_0x4736c1['table']===_0xa0b3('0x94')){_0x88c5bc['where'](_0x4736c1[_0xa0b3('0x89')]+_0xa0b3('0x95'),_0x3cdcb5[_0xa0b3('0x96')],_0x3cdcb5[_0xa0b3('0x97')]);}else{_0x88c5bc[_0xa0b3('0x36')](_0x4736c1[_0xa0b3('0x89')]+_0xa0b3('0x98'),_0x3cdcb5[_0xa0b3('0x96')],_0x3cdcb5[_0xa0b3('0x97')]);}if(_0x532c77){logger[_0xa0b3('0x99')](_0xa0b3('0x9a'),_0x88c5bc[_0xa0b3('0x82')]());require(_0xa0b3('0x9b'))[_0xa0b3('0x9c')](path['join'](__dirname,'../../components/export/',_0x532c77['output']),[_0x532c77['id'],_0x88c5bc['toString'](),path[_0xa0b3('0x50')](__dirname,_0xa0b3('0x9d'),_0x532c77['savename']),_0x41641c]);return _0x532c77;}else{var _0x1b2ad8=squel['select']();_0x1b2ad8[_0xa0b3('0x6e')]('('+_0x88c5bc[_0xa0b3('0x82')]()+')','countTable');_0x1b2ad8[_0xa0b3('0x65')]('COUNT(*)','count');_0x88c5bc[_0xa0b3('0x1a')](_0x3cdcb5['limit']||_0x392dd6);_0x88c5bc[_0xa0b3('0x18')](_0x3cdcb5[_0xa0b3('0x18')]||0x0);return dbH[_0xa0b3('0x81')][_0xa0b3('0x2d')](_0x1b2ad8[_0xa0b3('0x82')](),{'type':dbH[_0xa0b3('0x81')][_0xa0b3('0x83')][_0xa0b3('0x84')]})[_0xa0b3('0x21')](function(_0x4f71d1){if(!_0x4f71d1['length']){_0x294fa9=0x0;}else{_0x294fa9=_0x4f71d1[0x0][_0xa0b3('0x3b')]||0x0;}return dbH['sequelize'][_0xa0b3('0x2d')](_0x88c5bc[_0xa0b3('0x82')](),{'type':dbH[_0xa0b3('0x81')][_0xa0b3('0x83')]['SELECT']});})[_0xa0b3('0x21')](function(_0x4a7e90){return{'rows':_0x4a7e90||[],'count':_0x294fa9};});}});}exports[_0xa0b3('0x9e')]=function(_0xaa97e0,_0x29c969){return runReport(_0xaa97e0[_0xa0b3('0x42')],_0xaa97e0[_0xa0b3('0x2d')],_0xaa97e0[_0xa0b3('0x45')])[_0xa0b3('0x21')](respondWithResult(_0x29c969,null))[_0xa0b3('0x40')](handleError(_0x29c969,null));};exports[_0xa0b3('0x9f')]=runReport;exports[_0xa0b3('0x2d')]=function(_0x5ca176,_0x4cc944){var _0x2867a0=0xa;var _0x29684f=['join',_0xa0b3('0x51'),_0xa0b3('0x52'),_0xa0b3('0x53')];var _0x46b036={'SUM':'SUM(%s)','COUNT':_0xa0b3('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa0b3('0x56'),'MIN':_0xa0b3('0x86'),'AVG':_0xa0b3('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa0b3('0x59'),'GROUP_CONCAT DESC':_0xa0b3('0x5a')};var _0x13e1d6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xa0b3('0x5d'),'ROUND':_0xa0b3('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4b6364=function(_0x4d13ce){return!_['includes']([_0xa0b3('0x60'),'IS\x20NOT\x20NULL',_0xa0b3('0x61'),_0xa0b3('0xa0')],_0x4d13ce);};var _0x542e0e=function(_0x3d66c1){if(!_0x3d66c1||!_0x3d66c1['rules'][_0xa0b3('0x31')]){return'';}for(var _0x4cd395='(',_0x1ce51b=0x0;_0x1ce51b<_0x3d66c1['rules'][_0xa0b3('0x31')];_0x1ce51b+=0x1){_0x1ce51b>0x0&&(_0x4cd395+='\x20'+_0x3d66c1[_0xa0b3('0x63')]+'\x20');_0x4cd395+=_0x3d66c1[_0xa0b3('0x62')][_0x1ce51b][_0xa0b3('0x64')]?_0x542e0e(_0x3d66c1[_0xa0b3('0x62')][_0x1ce51b]['group']):_0x3d66c1[_0xa0b3('0x62')][_0x1ce51b][_0xa0b3('0x65')]+'\x20'+_0x3d66c1[_0xa0b3('0x62')][_0x1ce51b][_0xa0b3('0x66')]+(_0x4b6364(_0x3d66c1[_0xa0b3('0x62')][_0x1ce51b]['condition'])?'\x20'+_0x3d66c1[_0xa0b3('0x62')][_0x1ce51b]['value']:'');}return _0x4cd395+')';};var _0xf7acae={'where':{'id':_0x5ca176['params']['id']}},_0x77fec1,_0x4dd6ec,_0x49f8df,_0x5a565e,_0x25eb2d;_0xf7acae=_[_0xa0b3('0x39')]({},_0xf7acae,_0x5ca176[_0xa0b3('0x45')]);return db['AnalyticCustomReport'][_0xa0b3('0x4c')](_0xf7acae)[_0xa0b3('0x21')](function(_0x5d609d){if(_0x5d609d){_0x77fec1=_0x5d609d;return _0x5d609d[_0xa0b3('0x68')]();}return null;})[_0xa0b3('0x21')](function(_0x56ed83){if(_0x56ed83){if(!_0x56ed83[_0xa0b3('0x31')]){throw new db[(_0xa0b3('0x69'))][(_0xa0b3('0x6a'))](_0xa0b3('0x6b'),0x193);}_0x4dd6ec=_0x56ed83;return db[_0xa0b3('0x6c')][_0xa0b3('0x3e')]({'raw':!![]});}return null;})[_0xa0b3('0x21')](function(_0x41c45f){if(_0x41c45f){_0x49f8df=_[_0xa0b3('0x6d')](_0x41c45f,'id');var _0x37bacf;var _0x1072ce=squel[_0xa0b3('0xa1')]();_0x1072ce[_0xa0b3('0x6e')](_0x77fec1['table']);for(var _0x25b337=0x0;_0x25b337<_0x4dd6ec[_0xa0b3('0x31')];_0x25b337+=0x1){_0x37bacf=_0x4dd6ec[_0x25b337][_0xa0b3('0x6f')]?_0x49f8df[_0x4dd6ec[_0x25b337][_0xa0b3('0x6f')]][_0xa0b3('0x70')]:_0x4dd6ec[_0x25b337][_0xa0b3('0x65')];_0x37bacf=_0x4dd6ec[_0x25b337][_0xa0b3('0x71')]?_['replace'](_0x46b036[_0x4dd6ec[_0x25b337]['function']],'%s',_0x37bacf):_0x37bacf;_0x37bacf=_0x4dd6ec[_0x25b337][_0xa0b3('0x72')]?_[_0xa0b3('0x73')](_0x13e1d6[_0x4dd6ec[_0x25b337][_0xa0b3('0x72')]],'%s',_0x37bacf):_0x37bacf;if(_0x4dd6ec[_0x25b337][_0xa0b3('0x74')]){_0x1072ce[_0xa0b3('0x64')](_0x37bacf);}_0x4dd6ec[_0x25b337][_0xa0b3('0x75')]&&_0x1072ce[_0xa0b3('0x34')](_0x37bacf,_0x4dd6ec[_0x25b337][_0xa0b3('0x75')]===_0xa0b3('0x8a')?![]:!![]);_0x1072ce[_0xa0b3('0x65')](_0x37bacf,_0x4dd6ec[_0x25b337][_0xa0b3('0x76')]||_0x37bacf);}if(_0x77fec1[_0xa0b3('0x77')]){_0x77fec1[_0xa0b3('0x77')]=JSON[_0xa0b3('0x78')](_0x77fec1['joins']);for(var _0x580ccf=0x0;_0x580ccf<_0x77fec1['joins'][_0xa0b3('0x31')];_0x580ccf+=0x1){if(_0x77fec1[_0xa0b3('0x77')][_0x580ccf][_0xa0b3('0x79')]&&_[_0xa0b3('0x5f')](_0x29684f,_0x77fec1['joins'][_0x580ccf][_0xa0b3('0x79')])&&_0x77fec1[_0xa0b3('0x77')][_0x580ccf]['parentKey']&&_0x77fec1[_0xa0b3('0x77')][_0x580ccf][_0xa0b3('0x7b')]&&_0x77fec1[_0xa0b3('0x77')][_0x580ccf]['foreignKey']){_0x1072ce[_0x77fec1[_0xa0b3('0x77')][_0x580ccf][_0xa0b3('0x79')]](_0x77fec1['joins'][_0x580ccf][_0xa0b3('0x7b')],null,util[_0xa0b3('0x72')]('%s.%s\x20=\x20%s.%s',_0x77fec1[_0xa0b3('0x89')],_0x77fec1[_0xa0b3('0x77')][_0x580ccf][_0xa0b3('0x7a')],_0x77fec1[_0xa0b3('0x77')][_0x580ccf][_0xa0b3('0x7b')],_0x77fec1[_0xa0b3('0x77')][_0x580ccf][_0xa0b3('0x7c')]));}}}if(_0x77fec1[_0xa0b3('0x7d')]){_0x77fec1['conditions']=JSON[_0xa0b3('0x78')](_0x77fec1[_0xa0b3('0x7d')]);_0x1072ce[_0xa0b3('0x36')](_0x542e0e(_0x77fec1['conditions'][_0xa0b3('0x64')]));}_0x25eb2d=_0x1072ce[_0xa0b3('0x7e')]();_0x1072ce['limit'](_0x2867a0);_0x1072ce[_0xa0b3('0x18')](0x0);logger[_0xa0b3('0x7f')](_0xa0b3('0x80'),_0x1072ce[_0xa0b3('0x82')]());return dbH['sequelize'][_0xa0b3('0x2d')](_0x1072ce[_0xa0b3('0x82')](),{'type':dbH[_0xa0b3('0x81')][_0xa0b3('0x83')]['SELECT']});}})[_0xa0b3('0x21')](function(){return{'sql':_0x25eb2d[_0xa0b3('0x82')]()};})[_0xa0b3('0x21')](respondWithResult(_0x4cc944,null))[_0xa0b3('0x40')](handleError(_0x4cc944,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a9d7061..3475ccf 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 _0xf31b=['analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xf31b,0xa9));var _0xbf31=function(_0x5ccb7d,_0x546ead){_0x5ccb7d=_0x5ccb7d-0x0;var _0x53e62d=_0xf31b[_0x5ccb7d];return _0x53e62d;};'use strict';var _=require(_0xbf31('0x0'));var util=require(_0xbf31('0x1'));var logger=require('../../config/logger')(_0xbf31('0x2'));var moment=require(_0xbf31('0x3'));var BPromise=require(_0xbf31('0x4'));var rp=require(_0xbf31('0x5'));var fs=require('fs');var path=require(_0xbf31('0x6'));var rimraf=require(_0xbf31('0x7'));var config=require(_0xbf31('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0xbf31('0x9')]=function(_0x571c16,_0x40b9e9){return _0x571c16[_0xbf31('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0xbf31('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16ae=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0x16ae,0x146));var _0xe16a=function(_0x1a1ace,_0x67f34e){_0x1a1ace=_0x1a1ace-0x0;var _0x2931dd=_0x16ae[_0x1a1ace];return _0x2931dd;};'use strict';var _=require(_0xe16a('0x0'));var util=require(_0xe16a('0x1'));var logger=require(_0xe16a('0x2'))(_0xe16a('0x3'));var moment=require(_0xe16a('0x4'));var BPromise=require(_0xe16a('0x5'));var rp=require(_0xe16a('0x6'));var fs=require('fs');var path=require(_0xe16a('0x7'));var rimraf=require(_0xe16a('0x8'));var config=require(_0xe16a('0x9'));var attributes=require(_0xe16a('0xa'));module[_0xe16a('0xb')]=function(_0x1e2e31,_0x1b8385){return _0x1e2e31[_0xe16a('0xc')](_0xe16a('0xd'),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 4633058..9fbbd6f 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 _0x4105=['bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4105,0x1d1));var _0x5410=function(_0x4e2b67,_0xf1e740){_0x4e2b67=_0x4e2b67-0x0;var _0x1cd340=_0x4105[_0x4e2b67];return _0x1cd340;};'use strict';var _=require(_0x5410('0x0'));var util=require(_0x5410('0x1'));var moment=require(_0x5410('0x2'));var BPromise=require(_0x5410('0x3'));var rs=require(_0x5410('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5410('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5410('0x6'));var jayson=require(_0x5410('0x7'));var client=jayson['client'][_0x5410('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58ac56,_0x536eb2,_0xb5abed){return new BPromise(function(_0x3095e9,_0x2814e5){return client['request'](_0x58ac56,_0xb5abed)['then'](function(_0x2032a3){logger[_0x5410('0x9')](_0x5410('0xa'),_0x536eb2,_0x5410('0xb'));logger['debug'](_0x5410('0xc'),_0x536eb2,_0x5410('0xb'),JSON[_0x5410('0xd')](_0x2032a3));if(_0x2032a3['error']){if(_0x2032a3[_0x5410('0xe')][_0x5410('0xf')]===0x1f4){logger[_0x5410('0xe')](_0x5410('0xa'),_0x536eb2,_0x2032a3[_0x5410('0xe')][_0x5410('0x10')]);return _0x2814e5(_0x2032a3[_0x5410('0xe')][_0x5410('0x10')]);}logger[_0x5410('0xe')](_0x5410('0xa'),_0x536eb2,_0x2032a3['error']['message']);return _0x3095e9(_0x2032a3[_0x5410('0xe')][_0x5410('0x10')]);}else{logger[_0x5410('0x9')](_0x5410('0xa'),_0x536eb2,_0x5410('0xb'));_0x3095e9(_0x2032a3['result'][_0x5410('0x10')]);}})[_0x5410('0x11')](function(_0x5bd1e1){logger[_0x5410('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x536eb2,_0x5bd1e1);_0x2814e5(_0x5bd1e1);});});} \ No newline at end of file +var _0x1821=['info','AnalyticCustomReport,\x20%s,\x20%s','code','message','error','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1821,0x67));var _0x1182=function(_0x151c3c,_0x4164a9){_0x151c3c=_0x151c3c-0x0;var _0x3f6fbc=_0x1821[_0x151c3c];return _0x3f6fbc;};'use strict';var _=require(_0x1182('0x0'));var util=require(_0x1182('0x1'));var moment=require('moment');var BPromise=require(_0x1182('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1182('0x3'))['db'];var utils=require(_0x1182('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1182('0x5'));var jayson=require(_0x1182('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26c725,_0x4309ff,_0x595184){return new BPromise(function(_0x57d7fd,_0x5d2f5b){return client[_0x1182('0x7')](_0x26c725,_0x595184)[_0x1182('0x8')](function(_0xf5a2bd){logger[_0x1182('0x9')](_0x1182('0xa'),_0x4309ff,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4309ff,'request\x20sent',JSON['stringify'](_0xf5a2bd));if(_0xf5a2bd['error']){if(_0xf5a2bd['error'][_0x1182('0xb')]===0x1f4){logger['error'](_0x1182('0xa'),_0x4309ff,_0xf5a2bd['error'][_0x1182('0xc')]);return _0x5d2f5b(_0xf5a2bd[_0x1182('0xd')][_0x1182('0xc')]);}logger[_0x1182('0xd')](_0x1182('0xa'),_0x4309ff,_0xf5a2bd['error'][_0x1182('0xc')]);return _0x57d7fd(_0xf5a2bd[_0x1182('0xd')][_0x1182('0xc')]);}else{logger[_0x1182('0x9')](_0x1182('0xa'),_0x4309ff,'request\x20sent');_0x57d7fd(_0xf5a2bd[_0x1182('0xe')][_0x1182('0xc')]);}})[_0x1182('0xf')](function(_0x2e1dfd){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4309ff,_0x2e1dfd);_0x5d2f5b(_0x2e1dfd);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index aebfe2a..5941e52 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 _0xf900=['run','query','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id/preview','preview','/:id/run'];(function(_0x267bb1,_0x5c29db){var _0x101caa=function(_0x2f061c){while(--_0x2f061c){_0x267bb1['push'](_0x267bb1['shift']());}};_0x101caa(++_0x5c29db);}(_0xf900,0x140));var _0x0f90=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xf900[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x0f90('0x0'));var util=require(_0x0f90('0x1'));var path=require('path');var timeout=require(_0x0f90('0x2'));var express=require(_0x0f90('0x3'));var router=express[_0x0f90('0x4')]();var fs_extra=require(_0x0f90('0x5'));var auth=require(_0x0f90('0x6'));var interaction=require(_0x0f90('0x7'));var config=require(_0x0f90('0x8'));var controller=require(_0x0f90('0x9'));router['get']('/',auth[_0x0f90('0xa')](),controller[_0x0f90('0xb')]);router[_0x0f90('0xc')]('/:id',auth[_0x0f90('0xa')](),controller['show']);router['get'](_0x0f90('0xd'),auth[_0x0f90('0xa')](),controller[_0x0f90('0xe')]);router[_0x0f90('0xc')](_0x0f90('0xf'),auth[_0x0f90('0xa')](),controller[_0x0f90('0x10')]);router[_0x0f90('0xc')]('/:id/query',auth[_0x0f90('0xa')](),controller[_0x0f90('0x11')]);router['post']('/',auth[_0x0f90('0xa')](),controller['create']);router[_0x0f90('0x12')](_0x0f90('0x13'),auth[_0x0f90('0xa')](),controller[_0x0f90('0x14')]);router[_0x0f90('0x15')]('/:id',auth[_0x0f90('0xa')](),controller[_0x0f90('0x16')]);module[_0x0f90('0x17')]=router; \ No newline at end of file +var _0x3d21=['isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x3d21,0x15f));var _0x13d2=function(_0x474560,_0x8d9f63){_0x474560=_0x474560-0x0;var _0x1edfd0=_0x3d21[_0x474560];return _0x1edfd0;};'use strict';var multer=require(_0x13d2('0x0'));var util=require('util');var path=require(_0x13d2('0x1'));var timeout=require(_0x13d2('0x2'));var express=require('express');var router=express[_0x13d2('0x3')]();var fs_extra=require(_0x13d2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x13d2('0x5'));var config=require(_0x13d2('0x6'));var controller=require(_0x13d2('0x7'));router[_0x13d2('0x8')]('/',auth[_0x13d2('0x9')](),controller[_0x13d2('0xa')]);router[_0x13d2('0x8')](_0x13d2('0xb'),auth[_0x13d2('0x9')](),controller[_0x13d2('0xc')]);router['get'](_0x13d2('0xd'),auth[_0x13d2('0x9')](),controller[_0x13d2('0xe')]);router['get'](_0x13d2('0xf'),auth[_0x13d2('0x9')](),controller[_0x13d2('0x10')]);router[_0x13d2('0x8')](_0x13d2('0x11'),auth[_0x13d2('0x9')](),controller[_0x13d2('0x12')]);router[_0x13d2('0x13')]('/',auth[_0x13d2('0x9')](),controller[_0x13d2('0x14')]);router['put'](_0x13d2('0xb'),auth[_0x13d2('0x9')](),controller[_0x13d2('0x15')]);router[_0x13d2('0x16')](_0x13d2('0xb'),auth[_0x13d2('0x9')](),controller[_0x13d2('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index f08fbc9..83c2b5e 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 _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x5fd1,0x155));var _0x15fd=function(_0x4e9160,_0x24cfe9){_0x4e9160=_0x4e9160-0x0;var _0x168a15=_0x5fd1[_0x4e9160];return _0x168a15;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file +var _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xf494,0x1c6));var _0x4f49=function(_0x207140,_0x4c6556){_0x207140=_0x207140-0x0;var _0x39e8cf=_0xf494[_0x207140];return _0x39e8cf;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index b822af1..177b113 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x2de0ee,_0x575448){var _0x4bbb06=function(_0xa162ab){while(--_0xa162ab){_0x2de0ee['push'](_0x2de0ee['shift']());}};_0x4bbb06(++_0x575448);}(_0x53ec,0x192));var _0xc53e=function(_0x35ccde,_0xbe027){_0x35ccde=_0x35ccde-0x0;var _0xbd6110=_0x53ec[_0x35ccde];return _0xbd6110;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%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)','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','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x348527,_0x53940c){var _0x22c313=function(_0x24fd92){while(--_0x24fd92){_0x348527['push'](_0x348527['shift']());}};_0x22c313(++_0x53940c);}(_0x5fab,0x177));var _0xb5fa=function(_0x46827d,_0x1c6b7a){_0x46827d=_0x46827d-0x0;var _0x38d03e=_0x5fab[_0x46827d];return _0x38d03e;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f530c7c..e4376a0 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 _0xb46e=['define','analytics_default_reports','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x335f5c,_0xce622c){var _0x27458c=function(_0x108b7f){while(--_0x108b7f){_0x335f5c['push'](_0x335f5c['shift']());}};_0x27458c(++_0xce622c);}(_0xb46e,0x1d6));var _0xeb46=function(_0xd7138d,_0xc3196c){_0xd7138d=_0xd7138d-0x0;var _0x1768d4=_0xb46e[_0xd7138d];return _0x1768d4;};'use strict';var _=require(_0xeb46('0x0'));var util=require(_0xeb46('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeb46('0x2'));var BPromise=require(_0xeb46('0x3'));var rp=require(_0xeb46('0x4'));var fs=require('fs');var path=require(_0xeb46('0x5'));var rimraf=require('rimraf');var config=require(_0xeb46('0x6'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x2b1089,_0x4b2c59){return _0x2b1089[_0xeb46('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0xeb46('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd60=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','analytics_default_reports','lodash','util'];(function(_0x519df0,_0x4f41b1){var _0x419069=function(_0x4d42a8){while(--_0x4d42a8){_0x519df0['push'](_0x519df0['shift']());}};_0x419069(++_0x4f41b1);}(_0xcd60,0xfa));var _0x0cd6=function(_0x56ea35,_0x3928c8){_0x56ea35=_0x56ea35-0x0;var _0x15c62c=_0xcd60[_0x56ea35];return _0x15c62c;};'use strict';var _=require(_0x0cd6('0x0'));var util=require(_0x0cd6('0x1'));var logger=require(_0x0cd6('0x2'))('api');var moment=require(_0x0cd6('0x3'));var BPromise=require(_0x0cd6('0x4'));var rp=require(_0x0cd6('0x5'));var fs=require('fs');var path=require(_0x0cd6('0x6'));var rimraf=require(_0x0cd6('0x7'));var config=require(_0x0cd6('0x8'));var attributes=require(_0x0cd6('0x9'));module['exports']=function(_0xd3ca0,_0x339b34){return _0xd3ca0[_0x0cd6('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x0cd6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 5bdb70d..1d5a218 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 _0x69b9=['http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x4978d9,_0x203c70){var _0x540543=function(_0x2e2427){while(--_0x2e2427){_0x4978d9['push'](_0x4978d9['shift']());}};_0x540543(++_0x203c70);}(_0x69b9,0x113));var _0x969b=function(_0x2acbd5,_0x253ae1){_0x2acbd5=_0x2acbd5-0x0;var _0x251954=_0x69b9[_0x2acbd5];return _0x251954;};'use strict';var _=require(_0x969b('0x0'));var util=require(_0x969b('0x1'));var moment=require(_0x969b('0x2'));var BPromise=require(_0x969b('0x3'));var rs=require(_0x969b('0x4'));var fs=require('fs');var Redis=require(_0x969b('0x5'));var db=require(_0x969b('0x6'))['db'];var utils=require(_0x969b('0x7'));var logger=require('../../config/logger')(_0x969b('0x8'));var config=require('../../config/environment');var jayson=require(_0x969b('0x9'));var client=jayson[_0x969b('0xa')][_0x969b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x495f5a,_0x5a071f,_0x133add){return new BPromise(function(_0x1e3715,_0x264e83){return client['request'](_0x495f5a,_0x133add)[_0x969b('0xc')](function(_0x3a4733){logger[_0x969b('0xd')](_0x969b('0xe'),_0x5a071f,_0x969b('0xf'));logger['debug'](_0x969b('0x10'),_0x5a071f,_0x969b('0xf'),JSON['stringify'](_0x3a4733));if(_0x3a4733['error']){if(_0x3a4733[_0x969b('0x11')][_0x969b('0x12')]===0x1f4){logger[_0x969b('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5a071f,_0x3a4733['error'][_0x969b('0x13')]);return _0x264e83(_0x3a4733['error'][_0x969b('0x13')]);}logger[_0x969b('0x11')](_0x969b('0xe'),_0x5a071f,_0x3a4733['error'][_0x969b('0x13')]);return _0x1e3715(_0x3a4733[_0x969b('0x11')][_0x969b('0x13')]);}else{logger[_0x969b('0xd')](_0x969b('0xe'),_0x5a071f,_0x969b('0xf'));_0x1e3715(_0x3a4733[_0x969b('0x14')][_0x969b('0x13')]);}})[_0x969b('0x15')](function(_0x1d2067){logger[_0x969b('0x11')](_0x969b('0xe'),_0x5a071f,_0x1d2067);_0x264e83(_0x1d2067);});});} \ No newline at end of file +var _0x05a5=['then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x495b9b,_0x23243e){var _0x1ba8b9=function(_0x18590e){while(--_0x18590e){_0x495b9b['push'](_0x495b9b['shift']());}};_0x1ba8b9(++_0x23243e);}(_0x05a5,0x154));var _0x505a=function(_0x1eaf22,_0x27f0fa){_0x1eaf22=_0x1eaf22-0x0;var _0x370ff6=_0x05a5[_0x1eaf22];return _0x370ff6;};'use strict';var _=require(_0x505a('0x0'));var util=require('util');var moment=require(_0x505a('0x1'));var BPromise=require(_0x505a('0x2'));var rs=require(_0x505a('0x3'));var fs=require('fs');var Redis=require(_0x505a('0x4'));var db=require(_0x505a('0x5'))['db'];var utils=require(_0x505a('0x6'));var logger=require(_0x505a('0x7'))(_0x505a('0x8'));var config=require('../../config/environment');var jayson=require(_0x505a('0x9'));var client=jayson[_0x505a('0xa')][_0x505a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56e972,_0x264950,_0x4323aa){return new BPromise(function(_0x1701db,_0x1a4e72){return client['request'](_0x56e972,_0x4323aa)[_0x505a('0xc')](function(_0x9c1bb1){logger['info'](_0x505a('0xd'),_0x264950,_0x505a('0xe'));logger[_0x505a('0xf')](_0x505a('0x10'),_0x264950,'request\x20sent',JSON[_0x505a('0x11')](_0x9c1bb1));if(_0x9c1bb1['error']){if(_0x9c1bb1['error']['code']===0x1f4){logger[_0x505a('0x12')](_0x505a('0xd'),_0x264950,_0x9c1bb1['error'][_0x505a('0x13')]);return _0x1a4e72(_0x9c1bb1[_0x505a('0x12')][_0x505a('0x13')]);}logger[_0x505a('0x12')](_0x505a('0xd'),_0x264950,_0x9c1bb1[_0x505a('0x12')][_0x505a('0x13')]);return _0x1701db(_0x9c1bb1[_0x505a('0x12')][_0x505a('0x13')]);}else{logger[_0x505a('0x14')](_0x505a('0xd'),_0x264950,_0x505a('0xe'));_0x1701db(_0x9c1bb1['result'][_0x505a('0x13')]);}})[_0x505a('0x15')](function(_0x4cf286){logger['error'](_0x505a('0xd'),_0x264950,_0x4cf286);_0x1a4e72(_0x4cf286);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 786680e..630500f 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 _0xa937=['isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0xa937,0xde));var _0x7a93=function(_0x34c56d,_0x224f39){_0x34c56d=_0x34c56d-0x0;var _0x2b7ac4=_0xa937[_0x34c56d];return _0x2b7ac4;};'use strict';var multer=require(_0x7a93('0x0'));var util=require(_0x7a93('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7a93('0x2'));var router=express[_0x7a93('0x3')]();var fs_extra=require(_0x7a93('0x4'));var auth=require(_0x7a93('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a93('0x6'));var controller=require(_0x7a93('0x7'));router[_0x7a93('0x8')]('/',auth[_0x7a93('0x9')](),controller['index']);router[_0x7a93('0x8')](_0x7a93('0xa'),auth[_0x7a93('0x9')](),controller['show']);router[_0x7a93('0x8')](_0x7a93('0xb'),auth['isAuthenticated'](),controller[_0x7a93('0xc')]);router[_0x7a93('0x8')](_0x7a93('0xd'),auth[_0x7a93('0x9')](),controller[_0x7a93('0xe')]);router[_0x7a93('0x8')](_0x7a93('0xf'),auth[_0x7a93('0x9')](),controller['query']);router[_0x7a93('0x10')]('/',auth[_0x7a93('0x9')](),controller[_0x7a93('0x11')]);router[_0x7a93('0x12')]('/:id',auth[_0x7a93('0x9')](),controller[_0x7a93('0x13')]);router[_0x7a93('0x14')](_0x7a93('0xa'),auth[_0x7a93('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4e52=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','show','preview','/:id/run','run','query','create','/:id','delete','exports','multer'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0x4e52,0x1b8));var _0x24e5=function(_0x214321,_0x518e5b){_0x214321=_0x214321-0x0;var _0x481379=_0x4e52[_0x214321];return _0x481379;};'use strict';var multer=require(_0x24e5('0x0'));var util=require(_0x24e5('0x1'));var path=require('path');var timeout=require(_0x24e5('0x2'));var express=require(_0x24e5('0x3'));var router=express[_0x24e5('0x4')]();var fs_extra=require(_0x24e5('0x5'));var auth=require(_0x24e5('0x6'));var interaction=require(_0x24e5('0x7'));var config=require('../../config/environment');var controller=require(_0x24e5('0x8'));router[_0x24e5('0x9')]('/',auth[_0x24e5('0xa')](),controller[_0x24e5('0xb')]);router['get']('/:id',auth[_0x24e5('0xa')](),controller[_0x24e5('0xc')]);router[_0x24e5('0x9')]('/:id/preview',auth[_0x24e5('0xa')](),controller[_0x24e5('0xd')]);router[_0x24e5('0x9')](_0x24e5('0xe'),auth[_0x24e5('0xa')](),controller[_0x24e5('0xf')]);router[_0x24e5('0x9')]('/:id/query',auth[_0x24e5('0xa')](),controller[_0x24e5('0x10')]);router['post']('/',auth[_0x24e5('0xa')](),controller[_0x24e5('0x11')]);router['put'](_0x24e5('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x24e5('0x13')]('/:id',auth[_0x24e5('0xa')](),controller['destroy']);module[_0x24e5('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 1be4cfd..1ad99d5 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 _0xb1ec=['xlsx','DATE','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x244cae,_0x8ac36b){var _0x5891d9=function(_0x219dce){while(--_0x219dce){_0x244cae['push'](_0x244cae['shift']());}};_0x5891d9(++_0x8ac36b);}(_0xb1ec,0xb9));var _0xcb1e=function(_0x473523,_0x891e6b){_0x473523=_0x473523-0x0;var _0x1c3657=_0xb1ec[_0x473523];return _0x1c3657;};'use strict';var Sequelize=require(_0xcb1e('0x0'));var moment=require(_0xcb1e('0x1'));module[_0xcb1e('0x2')]={'name':{'type':Sequelize[_0xcb1e('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xcb1e('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xcb1e('0x4')](_0xcb1e('0x5'),_0xcb1e('0x6'),_0xcb1e('0x7')),'allowNull':![],'defaultValue':_0xcb1e('0x5')},'savename':{'type':Sequelize[_0xcb1e('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xcb1e('0x8')]},'endDate':{'type':Sequelize[_0xcb1e('0x8')]},'status':{'type':Sequelize[_0xcb1e('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xcb1e('0x4')](_0xcb1e('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xcb1e('0x9')},'reportId':{'type':Sequelize[_0xcb1e('0xa')](0xb)[_0xcb1e('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x82eb=['ENUM','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','csv','pdf','xlsx','DATE'];(function(_0x3ad7ad,_0x291a8d){var _0x225a60=function(_0xca7354){while(--_0xca7354){_0x3ad7ad['push'](_0x3ad7ad['shift']());}};_0x225a60(++_0x291a8d);}(_0x82eb,0x179));var _0xb82e=function(_0x5880a4,_0x55c1e2){_0x5880a4=_0x5880a4-0x0;var _0x5afbb7=_0x82eb[_0x5880a4];return _0x5afbb7;};'use strict';var Sequelize=require(_0xb82e('0x0'));var moment=require(_0xb82e('0x1'));module['exports']={'name':{'type':Sequelize[_0xb82e('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xb82e('0x3'),_0xb82e('0x4'),_0xb82e('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xb82e('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb82e('0x6')]},'endDate':{'type':Sequelize[_0xb82e('0x6')]},'status':{'type':Sequelize[_0xb82e('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xb82e('0x7')](_0xb82e('0x8'),_0xb82e('0x9')),'allowNull':![],'defaultValue':_0xb82e('0x8')},'reportId':{'type':Sequelize[_0xb82e('0xa')](0xb)[_0xb82e('0xb')]},'reportType':{'type':Sequelize[_0xb82e('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index fdd0031..8bbfb6d 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 _0x1849=['count','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','map','AnalyticExtractedReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','rows','show','params','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','join','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','%s.%s','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','status','end','json','offset','limit'];(function(_0x19324e,_0x35cc43){var _0xcfde4c=function(_0x58d362){while(--_0x58d362){_0x19324e['push'](_0x19324e['shift']());}};_0xcfde4c(++_0x35cc43);}(_0x1849,0xfe));var _0x9184=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1849[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x9184('0x0'));var rimraf=require(_0x9184('0x1'));var zipdir=require(_0x9184('0x2'));var jsonpatch=require(_0x9184('0x3'));var rp=require(_0x9184('0x4'));var moment=require(_0x9184('0x5'));var BPromise=require(_0x9184('0x6'));var Mustache=require(_0x9184('0x7'));var util=require(_0x9184('0x8'));var path=require(_0x9184('0x9'));var sox=require(_0x9184('0xa'));var csv=require(_0x9184('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9184('0xc'));var crypto=require(_0x9184('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9184('0xe'));var toCsv=require(_0x9184('0xb'));var querystring=require(_0x9184('0xf'));var Papa=require(_0x9184('0x10'));var Redis=require(_0x9184('0x11'));var authService=require(_0x9184('0x12'));var qs=require(_0x9184('0x13'));var as=require(_0x9184('0x14'));var hardwareService=require(_0x9184('0x15'));var logger=require(_0x9184('0x16'))(_0x9184('0x17'));var utils=require(_0x9184('0x18'));var config=require(_0x9184('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19750b,_0x20541b){_0x20541b=_0x20541b||0xcc;return function(_0x4a67cd){if(_0x4a67cd){return _0x19750b['sendStatus'](_0x20541b);}return _0x19750b[_0x9184('0x1a')](_0x20541b)[_0x9184('0x1b')]();};}function respondWithResult(_0x4ca450,_0x53d499){_0x53d499=_0x53d499||0xc8;return function(_0x52efd){if(_0x52efd){return _0x4ca450[_0x9184('0x1a')](_0x53d499)[_0x9184('0x1c')](_0x52efd);}};}function respondWithFilteredResult(_0x1ad8de,_0x92a78e){return function(_0xbbca8d){if(_0xbbca8d){var _0x388559=typeof _0x92a78e[_0x9184('0x1d')]==='undefined'&&typeof _0x92a78e[_0x9184('0x1e')]==='undefined';var _0x128533=_0xbbca8d[_0x9184('0x1f')];var _0x2e51f7=_0x388559?0x0:_0x92a78e[_0x9184('0x1d')];var _0x177f69=_0x388559?_0xbbca8d['count']:_0x92a78e[_0x9184('0x1d')]+_0x92a78e[_0x9184('0x1e')];var _0x516e06;if(_0x177f69>=_0x128533){_0x177f69=_0x128533;_0x516e06=0xc8;}else{_0x516e06=0xce;}_0x1ad8de['status'](_0x516e06);return _0x1ad8de[_0x9184('0x20')](_0x9184('0x21'),_0x2e51f7+'-'+_0x177f69+'/'+_0x128533)[_0x9184('0x1c')](_0xbbca8d);}return null;};}function patchUpdates(_0x1dec79){return function(_0x3faeb4){try{jsonpatch[_0x9184('0x22')](_0x3faeb4,_0x1dec79,!![]);}catch(_0x378d1d){return BPromise[_0x9184('0x23')](_0x378d1d);}return _0x3faeb4[_0x9184('0x24')]();};}function saveUpdates(_0x973764,_0x530ee4){return function(_0x31eff2){if(_0x31eff2){return _0x31eff2[_0x9184('0x25')](_0x973764)[_0x9184('0x26')](function(_0x55c4b4){return _0x55c4b4;});}return null;};}function removeEntity(_0x5af3f2,_0x48a69e){return function(_0xdf6988){if(_0xdf6988){return _0xdf6988[_0x9184('0x27')]()[_0x9184('0x26')](function(){var _0x2dbe78=_0xdf6988[_0x9184('0x28')]({'plain':!![]});var _0x169f48='ExtractedReports';return db['UserProfileResource'][_0x9184('0x27')]({'where':{'type':_0x169f48,'resourceId':_0x2dbe78['id']}})[_0x9184('0x26')](function(){return _0xdf6988;});})['then'](function(){_0x5af3f2['status'](0xcc)[_0x9184('0x1b')]();});}};}function handleEntityNotFound(_0xac2166,_0x31ad9f){return function(_0x5e6c61){if(!_0x5e6c61){_0xac2166[_0x9184('0x29')](0x194);}return _0x5e6c61;};}function handleError(_0x8024f9,_0x3f5f03){_0x3f5f03=_0x3f5f03||0x1f4;return function(_0x146b42){logger[_0x9184('0x2a')](_0x146b42[_0x9184('0x2b')]);if(_0x146b42[_0x9184('0x2c')]){delete _0x146b42[_0x9184('0x2c')];}_0x8024f9[_0x9184('0x1a')](_0x3f5f03)['send'](_0x146b42);};}exports['index']=function(_0x5d947c,_0x571f27){var _0x4d121a={},_0x4bddf4={},_0x41a4dd={'count':0x0,'rows':[]};var _0x391535=_[_0x9184('0x2d')](db[_0x9184('0x2e')][_0x9184('0x2f')],function(_0x1dc7bc){return{'name':_0x1dc7bc[_0x9184('0x30')],'type':_0x1dc7bc[_0x9184('0x31')]['key']};});_0x4bddf4['model']=_[_0x9184('0x2d')](_0x391535,_0x9184('0x2c'));_0x4bddf4[_0x9184('0x32')]=_[_0x9184('0x33')](_0x5d947c[_0x9184('0x32')]);_0x4bddf4[_0x9184('0x34')]=_[_0x9184('0x35')](_0x4bddf4[_0x9184('0x36')],_0x4bddf4['query']);_0x4d121a[_0x9184('0x37')]=_[_0x9184('0x35')](_0x4bddf4['model'],qs[_0x9184('0x38')](_0x5d947c[_0x9184('0x32')][_0x9184('0x38')]));_0x4d121a[_0x9184('0x37')]=_0x4d121a['attributes'][_0x9184('0x39')]?_0x4d121a[_0x9184('0x37')]:_0x4bddf4[_0x9184('0x36')];if(!_0x5d947c[_0x9184('0x32')][_0x9184('0x3a')]('nolimit')){_0x4d121a[_0x9184('0x1e')]=qs[_0x9184('0x1e')](_0x5d947c[_0x9184('0x32')][_0x9184('0x1e')]);_0x4d121a[_0x9184('0x1d')]=qs['offset'](_0x5d947c[_0x9184('0x32')][_0x9184('0x1d')]);}_0x4d121a[_0x9184('0x3b')]=qs[_0x9184('0x3c')](_0x5d947c[_0x9184('0x32')][_0x9184('0x3c')]);_0x4d121a[_0x9184('0x3d')]=qs['filters'](_[_0x9184('0x3e')](_0x5d947c['query'],_0x4bddf4[_0x9184('0x34')]),_0x391535);if(_0x5d947c[_0x9184('0x32')][_0x9184('0x3f')]){_0x4d121a[_0x9184('0x3d')]=_['merge'](_0x4d121a[_0x9184('0x3d')],{'$or':_['map'](_0x391535,function(_0x43bb97){if(_0x43bb97['type']!=='VIRTUAL'){var _0x1114e3={};_0x1114e3[_0x43bb97['name']]={'$like':'%'+_0x5d947c[_0x9184('0x32')][_0x9184('0x3f')]+'%'};return _0x1114e3;}})});}_0x4d121a=_['merge']({},_0x4d121a,_0x5d947c[_0x9184('0x40')]);var _0x43cb39={'where':_0x4d121a['where']};return db[_0x9184('0x2e')][_0x9184('0x1f')](_0x43cb39)[_0x9184('0x26')](function(_0x4f19f9){_0x41a4dd[_0x9184('0x1f')]=_0x4f19f9;if(_0x5d947c[_0x9184('0x32')][_0x9184('0x41')]){_0x4d121a[_0x9184('0x42')]=[{'all':!![]}];}return db[_0x9184('0x2e')]['findAll'](_0x4d121a);})[_0x9184('0x26')](function(_0x116811){_0x41a4dd[_0x9184('0x43')]=_0x116811;return _0x41a4dd;})[_0x9184('0x26')](respondWithFilteredResult(_0x571f27,_0x4d121a))['catch'](handleError(_0x571f27,null));};exports[_0x9184('0x44')]=function(_0x3514f3,_0x2edd30){var _0x2335c6={'raw':!![],'where':{'id':_0x3514f3[_0x9184('0x45')]['id']}},_0x414d36={};_0x414d36['model']=_[_0x9184('0x33')](db['AnalyticExtractedReport']['rawAttributes']);_0x414d36[_0x9184('0x32')]=_['keys'](_0x3514f3[_0x9184('0x32')]);_0x414d36['filters']=_[_0x9184('0x35')](_0x414d36[_0x9184('0x36')],_0x414d36['query']);_0x2335c6['attributes']=_[_0x9184('0x35')](_0x414d36[_0x9184('0x36')],qs['fields'](_0x3514f3[_0x9184('0x32')]['fields']));_0x2335c6[_0x9184('0x37')]=_0x2335c6[_0x9184('0x37')][_0x9184('0x39')]?_0x2335c6[_0x9184('0x37')]:_0x414d36[_0x9184('0x36')];if(_0x3514f3[_0x9184('0x32')][_0x9184('0x41')]){_0x2335c6[_0x9184('0x42')]=[{'all':!![]}];}_0x2335c6=_[_0x9184('0x46')]({},_0x2335c6,_0x3514f3[_0x9184('0x40')]);return db['AnalyticExtractedReport'][_0x9184('0x47')](_0x2335c6)[_0x9184('0x26')](handleEntityNotFound(_0x2edd30,null))[_0x9184('0x26')](respondWithResult(_0x2edd30,null))[_0x9184('0x48')](handleError(_0x2edd30,null));};exports[_0x9184('0x49')]=function(_0x421203,_0x1e3eb1){return db[_0x9184('0x2e')][_0x9184('0x49')](_0x421203[_0x9184('0x4a')],{})[_0x9184('0x26')](function(_0x55e236){var _0x4155cb=_0x421203[_0x9184('0x4b')][_0x9184('0x28')]({'plain':!![]});if(!_0x4155cb)throw new Error(_0x9184('0x4c'));if(_0x4155cb[_0x9184('0x4d')]===_0x9184('0x4b')){var _0x8f4cb4=_0x55e236[_0x9184('0x28')]({'plain':!![]});var _0x481028=_0x9184('0x4e');return db[_0x9184('0x4f')][_0x9184('0x47')]({'where':{'name':_0x481028,'userProfileId':_0x4155cb[_0x9184('0x50')]},'raw':!![]})[_0x9184('0x26')](function(_0x4d86ac){if(_0x4d86ac&&_0x4d86ac[_0x9184('0x51')]===0x0){return db[_0x9184('0x52')]['create']({'name':_0x8f4cb4[_0x9184('0x2c')],'resourceId':_0x8f4cb4['id'],'type':_0x4d86ac[_0x9184('0x2c')],'sectionId':_0x4d86ac['id']},{})['then'](function(){return _0x55e236;});}else{return _0x55e236;}})[_0x9184('0x48')](function(_0x7e8829){logger[_0x9184('0x2a')](_0x9184('0x53'),_0x7e8829);throw _0x7e8829;});}return _0x55e236;})['then'](respondWithResult(_0x1e3eb1,0xc9))[_0x9184('0x48')](handleError(_0x1e3eb1,null));};exports['update']=function(_0x1ec5ce,_0x43e91e){if(_0x1ec5ce[_0x9184('0x4a')]['id']){delete _0x1ec5ce['body']['id'];}return db[_0x9184('0x2e')][_0x9184('0x47')]({'where':{'id':_0x1ec5ce[_0x9184('0x45')]['id']}})[_0x9184('0x26')](handleEntityNotFound(_0x43e91e,null))[_0x9184('0x26')](saveUpdates(_0x1ec5ce[_0x9184('0x4a')],null))[_0x9184('0x26')](respondWithResult(_0x43e91e,null))[_0x9184('0x48')](handleError(_0x43e91e,null));};exports[_0x9184('0x27')]=function(_0x3fd42c,_0x2f28d0){return db['AnalyticExtractedReport'][_0x9184('0x47')]({'where':{'id':_0x3fd42c[_0x9184('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f28d0,null))['then'](removeEntity(_0x2f28d0,null))['catch'](handleError(_0x2f28d0,null));};exports[_0x9184('0x54')]=function(_0x54e752,_0x5459db,_0x58f5b4){return db[_0x9184('0x2e')][_0x9184('0x47')]({'where':{'id':_0x54e752[_0x9184('0x45')]['id']},'attributes':['name','basename','savename',_0x9184('0x55')],'raw':!![]})[_0x9184('0x26')](handleEntityNotFound(_0x5459db,null))[_0x9184('0x26')](function(_0x18c59f){if(_0x18c59f){if(!fs[_0x9184('0x56')](path[_0x9184('0x57')](config[_0x9184('0x58')],_0x9184('0x59'),_0x18c59f[_0x9184('0x5a')]))){throw new db['Sequelize'][(_0x9184('0x5b'))](_0x9184('0x5c'));}if(_0x54e752[_0x9184('0x32')]['exists']){return _0x5459db[_0x9184('0x29')](0xc8);}return _0x5459db[_0x9184('0x54')](path[_0x9184('0x57')](config[_0x9184('0x58')],_0x9184('0x59'),_0x18c59f[_0x9184('0x5a')]),util['format'](_0x9184('0x5d'),_0x18c59f[_0x9184('0x5e')]||_0x18c59f['name'],_0x18c59f['output']['toLowerCase']()));}})[_0x9184('0x48')](handleError(_0x5459db,null));}; \ No newline at end of file +var _0xfcc3=['end','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','get','ExtractedReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','catch','savename','output','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','join','format','%s.%s','basename','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xfcc3,0x178));var _0x3fcc=function(_0x553b56,_0x31ca1c){_0x553b56=_0x553b56-0x0;var _0x320b12=_0xfcc3[_0x553b56];return _0x320b12;};'use strict';var emlformat=require(_0x3fcc('0x0'));var rimraf=require(_0x3fcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fcc('0x2'));var rp=require(_0x3fcc('0x3'));var moment=require('moment');var BPromise=require(_0x3fcc('0x4'));var Mustache=require(_0x3fcc('0x5'));var util=require(_0x3fcc('0x6'));var path=require(_0x3fcc('0x7'));var sox=require(_0x3fcc('0x8'));var csv=require(_0x3fcc('0x9'));var ejs=require(_0x3fcc('0xa'));var fs=require('fs');var fs_extra=require(_0x3fcc('0xb'));var _=require(_0x3fcc('0xc'));var squel=require(_0x3fcc('0xd'));var crypto=require(_0x3fcc('0xe'));var jsforce=require(_0x3fcc('0xf'));var deskjs=require(_0x3fcc('0x10'));var toCsv=require(_0x3fcc('0x9'));var querystring=require(_0x3fcc('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3fcc('0x12'));var qs=require(_0x3fcc('0x13'));var as=require(_0x3fcc('0x14'));var hardwareService=require(_0x3fcc('0x15'));var logger=require(_0x3fcc('0x16'))('api');var utils=require(_0x3fcc('0x17'));var config=require(_0x3fcc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fcc('0x19'))['db'];function respondWithStatusCode(_0x312721,_0x1174ec){_0x1174ec=_0x1174ec||0xcc;return function(_0x3987d9){if(_0x3987d9){return _0x312721[_0x3fcc('0x1a')](_0x1174ec);}return _0x312721[_0x3fcc('0x1b')](_0x1174ec)[_0x3fcc('0x1c')]();};}function respondWithResult(_0x5a475d,_0x39538d){_0x39538d=_0x39538d||0xc8;return function(_0xcdc854){if(_0xcdc854){return _0x5a475d['status'](_0x39538d)[_0x3fcc('0x1d')](_0xcdc854);}};}function respondWithFilteredResult(_0x13269a,_0x2860fb){return function(_0x4f335e){if(_0x4f335e){var _0x353111=typeof _0x2860fb['offset']===_0x3fcc('0x1e')&&typeof _0x2860fb['limit']===_0x3fcc('0x1e');var _0x34b913=_0x4f335e[_0x3fcc('0x1f')];var _0xdb7754=_0x353111?0x0:_0x2860fb['offset'];var _0x3b3578=_0x353111?_0x4f335e['count']:_0x2860fb[_0x3fcc('0x20')]+_0x2860fb[_0x3fcc('0x21')];var _0x1d73ca;if(_0x3b3578>=_0x34b913){_0x3b3578=_0x34b913;_0x1d73ca=0xc8;}else{_0x1d73ca=0xce;}_0x13269a[_0x3fcc('0x1b')](_0x1d73ca);return _0x13269a[_0x3fcc('0x22')](_0x3fcc('0x23'),_0xdb7754+'-'+_0x3b3578+'/'+_0x34b913)['json'](_0x4f335e);}return null;};}function patchUpdates(_0x557d9f){return function(_0x47a618){try{jsonpatch[_0x3fcc('0x24')](_0x47a618,_0x557d9f,!![]);}catch(_0x2100e0){return BPromise['reject'](_0x2100e0);}return _0x47a618[_0x3fcc('0x25')]();};}function saveUpdates(_0x2eb8dd,_0x5f34d8){return function(_0x165fa3){if(_0x165fa3){return _0x165fa3['update'](_0x2eb8dd)[_0x3fcc('0x26')](function(_0x592f77){return _0x592f77;});}return null;};}function removeEntity(_0x54403f,_0x21a88f){return function(_0x43e6e8){if(_0x43e6e8){return _0x43e6e8['destroy']()[_0x3fcc('0x26')](function(){var _0x463e76=_0x43e6e8[_0x3fcc('0x27')]({'plain':!![]});var _0x3f0846=_0x3fcc('0x28');return db[_0x3fcc('0x29')][_0x3fcc('0x2a')]({'where':{'type':_0x3f0846,'resourceId':_0x463e76['id']}})[_0x3fcc('0x26')](function(){return _0x43e6e8;});})[_0x3fcc('0x26')](function(){_0x54403f[_0x3fcc('0x1b')](0xcc)[_0x3fcc('0x1c')]();});}};}function handleEntityNotFound(_0x2999f8,_0x334565){return function(_0x36ee7c){if(!_0x36ee7c){_0x2999f8['sendStatus'](0x194);}return _0x36ee7c;};}function handleError(_0x487f0e,_0x252143){_0x252143=_0x252143||0x1f4;return function(_0x4ac607){logger[_0x3fcc('0x2b')](_0x4ac607[_0x3fcc('0x2c')]);if(_0x4ac607[_0x3fcc('0x2d')]){delete _0x4ac607[_0x3fcc('0x2d')];}_0x487f0e['status'](_0x252143)[_0x3fcc('0x2e')](_0x4ac607);};}exports[_0x3fcc('0x2f')]=function(_0x317ee1,_0x1be9a2){var _0x54be92={},_0x554c3f={},_0x7a78c9={'count':0x0,'rows':[]};var _0x338eaa=_[_0x3fcc('0x30')](db[_0x3fcc('0x31')][_0x3fcc('0x32')],function(_0x56a606){return{'name':_0x56a606[_0x3fcc('0x33')],'type':_0x56a606[_0x3fcc('0x34')][_0x3fcc('0x35')]};});_0x554c3f[_0x3fcc('0x36')]=_[_0x3fcc('0x30')](_0x338eaa,_0x3fcc('0x2d'));_0x554c3f['query']=_['keys'](_0x317ee1['query']);_0x554c3f[_0x3fcc('0x37')]=_['intersection'](_0x554c3f[_0x3fcc('0x36')],_0x554c3f[_0x3fcc('0x38')]);_0x54be92['attributes']=_[_0x3fcc('0x39')](_0x554c3f['model'],qs['fields'](_0x317ee1[_0x3fcc('0x38')][_0x3fcc('0x3a')]));_0x54be92[_0x3fcc('0x3b')]=_0x54be92[_0x3fcc('0x3b')][_0x3fcc('0x3c')]?_0x54be92[_0x3fcc('0x3b')]:_0x554c3f[_0x3fcc('0x36')];if(!_0x317ee1[_0x3fcc('0x38')][_0x3fcc('0x3d')](_0x3fcc('0x3e'))){_0x54be92[_0x3fcc('0x21')]=qs[_0x3fcc('0x21')](_0x317ee1[_0x3fcc('0x38')][_0x3fcc('0x21')]);_0x54be92[_0x3fcc('0x20')]=qs['offset'](_0x317ee1[_0x3fcc('0x38')][_0x3fcc('0x20')]);}_0x54be92[_0x3fcc('0x3f')]=qs[_0x3fcc('0x40')](_0x317ee1['query'][_0x3fcc('0x40')]);_0x54be92[_0x3fcc('0x41')]=qs[_0x3fcc('0x37')](_['pick'](_0x317ee1[_0x3fcc('0x38')],_0x554c3f[_0x3fcc('0x37')]),_0x338eaa);if(_0x317ee1['query'][_0x3fcc('0x42')]){_0x54be92[_0x3fcc('0x41')]=_[_0x3fcc('0x43')](_0x54be92[_0x3fcc('0x41')],{'$or':_[_0x3fcc('0x30')](_0x338eaa,function(_0x303501){if(_0x303501[_0x3fcc('0x34')]!==_0x3fcc('0x44')){var _0x382e79={};_0x382e79[_0x303501['name']]={'$like':'%'+_0x317ee1[_0x3fcc('0x38')][_0x3fcc('0x42')]+'%'};return _0x382e79;}})});}_0x54be92=_[_0x3fcc('0x43')]({},_0x54be92,_0x317ee1[_0x3fcc('0x45')]);var _0x44606a={'where':_0x54be92[_0x3fcc('0x41')]};return db[_0x3fcc('0x31')][_0x3fcc('0x1f')](_0x44606a)[_0x3fcc('0x26')](function(_0x37e457){_0x7a78c9['count']=_0x37e457;if(_0x317ee1[_0x3fcc('0x38')][_0x3fcc('0x46')]){_0x54be92[_0x3fcc('0x47')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x3fcc('0x48')](_0x54be92);})['then'](function(_0x1e65d8){_0x7a78c9[_0x3fcc('0x49')]=_0x1e65d8;return _0x7a78c9;})['then'](respondWithFilteredResult(_0x1be9a2,_0x54be92))['catch'](handleError(_0x1be9a2,null));};exports[_0x3fcc('0x4a')]=function(_0x318e40,_0x569834){var _0x4838da={'raw':!![],'where':{'id':_0x318e40[_0x3fcc('0x4b')]['id']}},_0x13e30e={};_0x13e30e[_0x3fcc('0x36')]=_['keys'](db[_0x3fcc('0x31')][_0x3fcc('0x32')]);_0x13e30e['query']=_[_0x3fcc('0x4c')](_0x318e40[_0x3fcc('0x38')]);_0x13e30e[_0x3fcc('0x37')]=_[_0x3fcc('0x39')](_0x13e30e[_0x3fcc('0x36')],_0x13e30e[_0x3fcc('0x38')]);_0x4838da[_0x3fcc('0x3b')]=_[_0x3fcc('0x39')](_0x13e30e[_0x3fcc('0x36')],qs[_0x3fcc('0x3a')](_0x318e40[_0x3fcc('0x38')]['fields']));_0x4838da[_0x3fcc('0x3b')]=_0x4838da[_0x3fcc('0x3b')][_0x3fcc('0x3c')]?_0x4838da[_0x3fcc('0x3b')]:_0x13e30e[_0x3fcc('0x36')];if(_0x318e40[_0x3fcc('0x38')]['includeAll']){_0x4838da[_0x3fcc('0x47')]=[{'all':!![]}];}_0x4838da=_[_0x3fcc('0x43')]({},_0x4838da,_0x318e40['options']);return db['AnalyticExtractedReport'][_0x3fcc('0x4d')](_0x4838da)['then'](handleEntityNotFound(_0x569834,null))[_0x3fcc('0x26')](respondWithResult(_0x569834,null))['catch'](handleError(_0x569834,null));};exports[_0x3fcc('0x4e')]=function(_0x495c55,_0x1b2cea){return db['AnalyticExtractedReport'][_0x3fcc('0x4e')](_0x495c55[_0x3fcc('0x4f')],{})[_0x3fcc('0x26')](function(_0xc7e3ba){var _0x5d0d13=_0x495c55['user'][_0x3fcc('0x27')]({'plain':!![]});if(!_0x5d0d13)throw new Error(_0x3fcc('0x50'));if(_0x5d0d13[_0x3fcc('0x51')]===_0x3fcc('0x52')){var _0x14ead0=_0xc7e3ba[_0x3fcc('0x27')]({'plain':!![]});var _0x12821b=_0x3fcc('0x28');return db[_0x3fcc('0x53')][_0x3fcc('0x4d')]({'where':{'name':_0x12821b,'userProfileId':_0x5d0d13['userProfileId']},'raw':!![]})[_0x3fcc('0x26')](function(_0x50b5a7){if(_0x50b5a7&&_0x50b5a7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x14ead0[_0x3fcc('0x2d')],'resourceId':_0x14ead0['id'],'type':_0x50b5a7[_0x3fcc('0x2d')],'sectionId':_0x50b5a7['id']},{})[_0x3fcc('0x26')](function(){return _0xc7e3ba;});}else{return _0xc7e3ba;}})['catch'](function(_0x255a41){logger[_0x3fcc('0x2b')](_0x3fcc('0x54'),_0x255a41);throw _0x255a41;});}return _0xc7e3ba;})[_0x3fcc('0x26')](respondWithResult(_0x1b2cea,0xc9))['catch'](handleError(_0x1b2cea,null));};exports[_0x3fcc('0x55')]=function(_0x51bf82,_0x86da7f){if(_0x51bf82[_0x3fcc('0x4f')]['id']){delete _0x51bf82[_0x3fcc('0x4f')]['id'];}return db['AnalyticExtractedReport'][_0x3fcc('0x4d')]({'where':{'id':_0x51bf82[_0x3fcc('0x4b')]['id']}})[_0x3fcc('0x26')](handleEntityNotFound(_0x86da7f,null))[_0x3fcc('0x26')](saveUpdates(_0x51bf82[_0x3fcc('0x4f')],null))[_0x3fcc('0x26')](respondWithResult(_0x86da7f,null))['catch'](handleError(_0x86da7f,null));};exports[_0x3fcc('0x2a')]=function(_0x25facd,_0x535139){return db[_0x3fcc('0x31')]['find']({'where':{'id':_0x25facd['params']['id']}})['then'](handleEntityNotFound(_0x535139,null))['then'](removeEntity(_0x535139,null))[_0x3fcc('0x56')](handleError(_0x535139,null));};exports['download']=function(_0x75897d,_0x3a7e53,_0x15ca69){return db[_0x3fcc('0x31')][_0x3fcc('0x4d')]({'where':{'id':_0x75897d[_0x3fcc('0x4b')]['id']},'attributes':[_0x3fcc('0x2d'),'basename',_0x3fcc('0x57'),_0x3fcc('0x58')],'raw':!![]})[_0x3fcc('0x26')](handleEntityNotFound(_0x3a7e53,null))[_0x3fcc('0x26')](function(_0x195640){if(_0x195640){if(!fs['existsSync'](path['join'](config[_0x3fcc('0x59')],_0x3fcc('0x5a'),_0x195640[_0x3fcc('0x57')]))){throw new db[(_0x3fcc('0x5b'))][(_0x3fcc('0x5c'))](_0x3fcc('0x5d'));}if(_0x75897d[_0x3fcc('0x38')][_0x3fcc('0x5e')]){return _0x3a7e53['sendStatus'](0xc8);}return _0x3a7e53[_0x3fcc('0x5f')](path[_0x3fcc('0x60')](config[_0x3fcc('0x59')],_0x3fcc('0x5a'),_0x195640[_0x3fcc('0x57')]),util[_0x3fcc('0x61')](_0x3fcc('0x62'),_0x195640[_0x3fcc('0x63')]||_0x195640[_0x3fcc('0x2d')],_0x195640[_0x3fcc('0x58')][_0x3fcc('0x64')]()));}})[_0x3fcc('0x56')](handleError(_0x3a7e53,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 713a322..98ae9f8 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 _0x1921=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x1921,0x1e8));var _0x1192=function(_0x295414,_0x3c9a2e){_0x295414=_0x295414-0x0;var _0x4dcf10=_0x1921[_0x295414];return _0x4dcf10;};'use strict';var _=require('lodash');var util=require(_0x1192('0x0'));var logger=require(_0x1192('0x1'))(_0x1192('0x2'));var moment=require(_0x1192('0x3'));var BPromise=require('bluebird');var rp=require(_0x1192('0x4'));var fs=require('fs');var path=require(_0x1192('0x5'));var rimraf=require(_0x1192('0x6'));var config=require(_0x1192('0x7'));var attributes=require(_0x1192('0x8'));module['exports']=function(_0xa90653,_0x5538ba){return _0xa90653[_0x1192('0x9')](_0x1192('0xa'),attributes,{'tableName':_0x1192('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf004=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1e4a8a,_0x56718d){var _0x2640d1=function(_0x1a060d){while(--_0x1a060d){_0x1e4a8a['push'](_0x1e4a8a['shift']());}};_0x2640d1(++_0x56718d);}(_0xf004,0xc5));var _0x4f00=function(_0x35ad19,_0x5a2e52){_0x35ad19=_0x35ad19-0x0;var _0x21fb8b=_0xf004[_0x35ad19];return _0x21fb8b;};'use strict';var _=require('lodash');var util=require(_0x4f00('0x0'));var logger=require(_0x4f00('0x1'))(_0x4f00('0x2'));var moment=require(_0x4f00('0x3'));var BPromise=require(_0x4f00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f00('0x5'));var rimraf=require(_0x4f00('0x6'));var config=require('../../config/environment');var attributes=require(_0x4f00('0x7'));module[_0x4f00('0x8')]=function(_0x23f90e,_0x9b5e7b){return _0x23f90e[_0x4f00('0x9')](_0x4f00('0xa'),attributes,{'tableName':_0x4f00('0xb'),'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 1bcfc56..6788686 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 _0x4b96=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util'];(function(_0xa4c12b,_0x2d53f6){var _0x5128e4=function(_0x18a106){while(--_0x18a106){_0xa4c12b['push'](_0xa4c12b['shift']());}};_0x5128e4(++_0x2d53f6);}(_0x4b96,0x12e));var _0x64b9=function(_0x3f1fd5,_0x10a3fe){_0x3f1fd5=_0x3f1fd5-0x0;var _0x385726=_0x4b96[_0x3f1fd5];return _0x385726;};'use strict';var _=require(_0x64b9('0x0'));var util=require(_0x64b9('0x1'));var moment=require(_0x64b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x64b9('0x3'));var fs=require('fs');var Redis=require(_0x64b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64b9('0x5'));var logger=require(_0x64b9('0x6'))(_0x64b9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x64b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51433b,_0x46adab,_0x9c08fb){return new BPromise(function(_0x3f9512,_0x405c29){return client[_0x64b9('0x9')](_0x51433b,_0x9c08fb)['then'](function(_0x22060e){logger[_0x64b9('0xa')](_0x64b9('0xb'),_0x46adab,'request\x20sent');logger[_0x64b9('0xc')](_0x64b9('0xd'),_0x46adab,_0x64b9('0xe'),JSON[_0x64b9('0xf')](_0x22060e));if(_0x22060e['error']){if(_0x22060e[_0x64b9('0x10')][_0x64b9('0x11')]===0x1f4){logger['error'](_0x64b9('0xb'),_0x46adab,_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);return _0x405c29(_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);}logger[_0x64b9('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x46adab,_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);return _0x3f9512(_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);}else{logger[_0x64b9('0xa')](_0x64b9('0xb'),_0x46adab,'request\x20sent');_0x3f9512(_0x22060e['result'][_0x64b9('0x12')]);}})['catch'](function(_0x39f91c){logger[_0x64b9('0x10')](_0x64b9('0xb'),_0x46adab,_0x39f91c);_0x405c29(_0x39f91c);});});} \ No newline at end of file +var _0xcba4=['error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x537d83,_0x491108){var _0x301a0d=function(_0x3fe45c){while(--_0x3fe45c){_0x537d83['push'](_0x537d83['shift']());}};_0x301a0d(++_0x491108);}(_0xcba4,0x174));var _0x4cba=function(_0x4d51d3,_0x36bed3){_0x4d51d3=_0x4d51d3-0x0;var _0x1270fc=_0xcba4[_0x4d51d3];return _0x1270fc;};'use strict';var _=require(_0x4cba('0x0'));var util=require('util');var moment=require(_0x4cba('0x1'));var BPromise=require(_0x4cba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cba('0x3'));var db=require(_0x4cba('0x4'))['db'];var utils=require(_0x4cba('0x5'));var logger=require(_0x4cba('0x6'))(_0x4cba('0x7'));var config=require(_0x4cba('0x8'));var jayson=require(_0x4cba('0x9'));var client=jayson[_0x4cba('0xa')][_0x4cba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe19894,_0x3191c6,_0x19764d){return new BPromise(function(_0x200f84,_0x3f2201){return client[_0x4cba('0xc')](_0xe19894,_0x19764d)[_0x4cba('0xd')](function(_0x1f1250){logger[_0x4cba('0xe')](_0x4cba('0xf'),_0x3191c6,_0x4cba('0x10'));logger[_0x4cba('0x11')](_0x4cba('0x12'),_0x3191c6,_0x4cba('0x10'),JSON['stringify'](_0x1f1250));if(_0x1f1250[_0x4cba('0x13')]){if(_0x1f1250['error'][_0x4cba('0x14')]===0x1f4){logger[_0x4cba('0x13')](_0x4cba('0xf'),_0x3191c6,_0x1f1250[_0x4cba('0x13')]['message']);return _0x3f2201(_0x1f1250[_0x4cba('0x13')]['message']);}logger[_0x4cba('0x13')](_0x4cba('0xf'),_0x3191c6,_0x1f1250[_0x4cba('0x13')][_0x4cba('0x15')]);return _0x200f84(_0x1f1250[_0x4cba('0x13')][_0x4cba('0x15')]);}else{logger[_0x4cba('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3191c6,_0x4cba('0x10'));_0x200f84(_0x1f1250['result'][_0x4cba('0x15')]);}})[_0x4cba('0x16')](function(_0x45168f){logger[_0x4cba('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3191c6,_0x45168f);_0x3f2201(_0x45168f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index da838c5..a3a46bd 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 _0x10a9=['/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticExtractedReport.controller','isAuthenticated','get'];(function(_0x363887,_0x4f5e81){var _0x3dbf=function(_0x35a9b2){while(--_0x35a9b2){_0x363887['push'](_0x363887['shift']());}};_0x3dbf(++_0x4f5e81);}(_0x10a9,0x1e5));var _0x910a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x10a9[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x910a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x910a('0x1'));var express=require(_0x910a('0x2'));var router=express[_0x910a('0x3')]();var fs_extra=require(_0x910a('0x4'));var auth=require(_0x910a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x910a('0x6'));router['get']('/',auth[_0x910a('0x7')](),controller['index']);router[_0x910a('0x8')](_0x910a('0x9'),auth[_0x910a('0x7')](),controller[_0x910a('0xa')]);router[_0x910a('0x8')](_0x910a('0xb'),auth[_0x910a('0x7')](),controller[_0x910a('0xc')]);router[_0x910a('0xd')]('/',auth['isAuthenticated'](),controller[_0x910a('0xe')]);router[_0x910a('0xf')](_0x910a('0x9'),auth[_0x910a('0x7')](),controller[_0x910a('0x10')]);router[_0x910a('0x11')](_0x910a('0x9'),auth[_0x910a('0x7')](),controller[_0x910a('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd5ea=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete'];(function(_0x460e20,_0x3ff2d0){var _0x4088a4=function(_0x460092){while(--_0x460092){_0x460e20['push'](_0x460e20['shift']());}};_0x4088a4(++_0x3ff2d0);}(_0xd5ea,0x177));var _0xad5e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd5ea[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xad5e('0x0'));var util=require(_0xad5e('0x1'));var path=require(_0xad5e('0x2'));var timeout=require(_0xad5e('0x3'));var express=require(_0xad5e('0x4'));var router=express[_0xad5e('0x5')]();var fs_extra=require(_0xad5e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xad5e('0x7'));var config=require(_0xad5e('0x8'));var controller=require(_0xad5e('0x9'));router[_0xad5e('0xa')]('/',auth[_0xad5e('0xb')](),controller[_0xad5e('0xc')]);router[_0xad5e('0xa')](_0xad5e('0xd'),auth[_0xad5e('0xb')](),controller[_0xad5e('0xe')]);router[_0xad5e('0xa')](_0xad5e('0xf'),auth[_0xad5e('0xb')](),controller[_0xad5e('0x10')]);router[_0xad5e('0x11')]('/',auth[_0xad5e('0xb')](),controller['create']);router[_0xad5e('0x12')](_0xad5e('0xd'),auth['isAuthenticated'](),controller[_0xad5e('0x13')]);router[_0xad5e('0x14')](_0xad5e('0xd'),auth[_0xad5e('0xb')](),controller[_0xad5e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ed83139..efaa632 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 _0x50b2=['TEXT','STRING','BOOLEAN','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x50b2,0x157));var _0x250b=function(_0x3b791a,_0x400f19){_0x3b791a=_0x3b791a-0x0;var _0x154c99=_0x50b2[_0x3b791a];return _0x154c99;};'use strict';var Sequelize=require('sequelize');module[_0x250b('0x0')]={'field':{'type':Sequelize[_0x250b('0x1')]},'alias':{'type':Sequelize[_0x250b('0x2')]},'function':{'type':Sequelize[_0x250b('0x2')]},'format':{'type':Sequelize[_0x250b('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x250b('0x2')]},'custom':{'type':Sequelize[_0x250b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xecbf=['BOOLEAN','exports','TEXT','STRING'];(function(_0x52f0ae,_0x34c953){var _0x4aa93c=function(_0x28a599){while(--_0x28a599){_0x52f0ae['push'](_0x52f0ae['shift']());}};_0x4aa93c(++_0x34c953);}(_0xecbf,0x1d1));var _0xfecb=function(_0xe778b1,_0x3ebcf7){_0xe778b1=_0xe778b1-0x0;var _0x5ade1a=_0xecbf[_0xe778b1];return _0x5ade1a;};'use strict';var Sequelize=require('sequelize');module[_0xfecb('0x0')]={'field':{'type':Sequelize[_0xfecb('0x1')]},'alias':{'type':Sequelize[_0xfecb('0x2')]},'function':{'type':Sequelize[_0xfecb('0x2')]},'format':{'type':Sequelize[_0xfecb('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xfecb('0x2')]},'custom':{'type':Sequelize[_0xfecb('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 7b7603e..ce23ec8 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 _0xe8d6=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','bulkCreate','body','destroy','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','json','apply','reject','save','update','then','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields'];(function(_0x5cc118,_0x479136){var _0x87ff2b=function(_0x2e3aa7){while(--_0x2e3aa7){_0x5cc118['push'](_0x5cc118['shift']());}};_0x87ff2b(++_0x479136);}(_0xe8d6,0x107));var _0x6e8d=function(_0x48f511,_0x41ce70){_0x48f511=_0x48f511-0x0;var _0x15766a=_0xe8d6[_0x48f511];return _0x15766a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e8d('0x0'));var zipdir=require(_0x6e8d('0x1'));var jsonpatch=require(_0x6e8d('0x2'));var rp=require('request-promise');var moment=require(_0x6e8d('0x3'));var BPromise=require(_0x6e8d('0x4'));var Mustache=require(_0x6e8d('0x5'));var util=require('util');var path=require(_0x6e8d('0x6'));var sox=require(_0x6e8d('0x7'));var csv=require(_0x6e8d('0x8'));var ejs=require(_0x6e8d('0x9'));var fs=require('fs');var fs_extra=require(_0x6e8d('0xa'));var _=require(_0x6e8d('0xb'));var squel=require(_0x6e8d('0xc'));var crypto=require(_0x6e8d('0xd'));var jsforce=require(_0x6e8d('0xe'));var deskjs=require(_0x6e8d('0xf'));var toCsv=require(_0x6e8d('0x8'));var querystring=require(_0x6e8d('0x10'));var Papa=require('papaparse');var Redis=require(_0x6e8d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e8d('0x12'));var logger=require(_0x6e8d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6e8d('0x14'));var licenseUtil=require(_0x6e8d('0x15'));var db=require(_0x6e8d('0x16'))['db'];function respondWithStatusCode(_0x5c3170,_0x19f571){_0x19f571=_0x19f571||0xcc;return function(_0x13b15f){if(_0x13b15f){return _0x5c3170[_0x6e8d('0x17')](_0x19f571);}return _0x5c3170[_0x6e8d('0x18')](_0x19f571)['end']();};}function respondWithResult(_0x2e2fbc,_0x4f6c79){_0x4f6c79=_0x4f6c79||0xc8;return function(_0x2a725f){if(_0x2a725f){return _0x2e2fbc['status'](_0x4f6c79)['json'](_0x2a725f);}};}function respondWithFilteredResult(_0x4bbeef,_0x3a3aa9){return function(_0x396a56){if(_0x396a56){var _0x4c763a=typeof _0x3a3aa9['offset']===_0x6e8d('0x19')&&typeof _0x3a3aa9[_0x6e8d('0x1a')]===_0x6e8d('0x19');var _0x2390a9=_0x396a56[_0x6e8d('0x1b')];var _0x342815=_0x4c763a?0x0:_0x3a3aa9[_0x6e8d('0x1c')];var _0x133831=_0x4c763a?_0x396a56[_0x6e8d('0x1b')]:_0x3a3aa9[_0x6e8d('0x1c')]+_0x3a3aa9[_0x6e8d('0x1a')];var _0x1fb90b;if(_0x133831>=_0x2390a9){_0x133831=_0x2390a9;_0x1fb90b=0xc8;}else{_0x1fb90b=0xce;}_0x4bbeef[_0x6e8d('0x18')](_0x1fb90b);return _0x4bbeef['set']('Content-Range',_0x342815+'-'+_0x133831+'/'+_0x2390a9)[_0x6e8d('0x1d')](_0x396a56);}return null;};}function patchUpdates(_0x494898){return function(_0xa6a6c3){try{jsonpatch[_0x6e8d('0x1e')](_0xa6a6c3,_0x494898,!![]);}catch(_0x32d65f){return BPromise[_0x6e8d('0x1f')](_0x32d65f);}return _0xa6a6c3[_0x6e8d('0x20')]();};}function saveUpdates(_0x443a83,_0x20836e){return function(_0x5a6476){if(_0x5a6476){return _0x5a6476[_0x6e8d('0x21')](_0x443a83)[_0x6e8d('0x22')](function(_0x46edbd){return _0x46edbd;});}return null;};}function removeEntity(_0x10c508,_0x1d68ce){return function(_0x3ea954){if(_0x3ea954){return _0x3ea954['destroy']()[_0x6e8d('0x22')](function(){_0x10c508['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7872,_0x3b324){return function(_0x1ad602){if(!_0x1ad602){_0x5b7872['sendStatus'](0x194);}return _0x1ad602;};}function handleError(_0x49c468,_0x2b9094){_0x2b9094=_0x2b9094||0x1f4;return function(_0x43d443){logger[_0x6e8d('0x23')](_0x43d443[_0x6e8d('0x24')]);if(_0x43d443['name']){delete _0x43d443[_0x6e8d('0x25')];}_0x49c468[_0x6e8d('0x18')](_0x2b9094)[_0x6e8d('0x26')](_0x43d443);};}exports[_0x6e8d('0x27')]=function(_0x657e7d,_0x419f9a){var _0xd0a6b7={},_0x5383b3={},_0xfe2b17={'count':0x0,'rows':[]};var _0x3f4a50=_['map'](db[_0x6e8d('0x28')][_0x6e8d('0x29')],function(_0x4a6116){return{'name':_0x4a6116[_0x6e8d('0x2a')],'type':_0x4a6116[_0x6e8d('0x2b')][_0x6e8d('0x2c')]};});_0x5383b3['model']=_[_0x6e8d('0x2d')](_0x3f4a50,_0x6e8d('0x25'));_0x5383b3[_0x6e8d('0x2e')]=_[_0x6e8d('0x2f')](_0x657e7d[_0x6e8d('0x2e')]);_0x5383b3[_0x6e8d('0x30')]=_[_0x6e8d('0x31')](_0x5383b3[_0x6e8d('0x32')],_0x5383b3[_0x6e8d('0x2e')]);_0xd0a6b7[_0x6e8d('0x33')]=_[_0x6e8d('0x31')](_0x5383b3[_0x6e8d('0x32')],qs['fields'](_0x657e7d['query'][_0x6e8d('0x34')]));_0xd0a6b7[_0x6e8d('0x33')]=_0xd0a6b7['attributes']['length']?_0xd0a6b7[_0x6e8d('0x33')]:_0x5383b3['model'];if(!_0x657e7d[_0x6e8d('0x2e')][_0x6e8d('0x35')]('nolimit')){_0xd0a6b7['limit']=qs[_0x6e8d('0x1a')](_0x657e7d[_0x6e8d('0x2e')]['limit']);_0xd0a6b7[_0x6e8d('0x1c')]=qs[_0x6e8d('0x1c')](_0x657e7d['query']['offset']);}_0xd0a6b7[_0x6e8d('0x36')]=qs[_0x6e8d('0x37')](_0x657e7d[_0x6e8d('0x2e')][_0x6e8d('0x37')]);_0xd0a6b7[_0x6e8d('0x38')]=qs[_0x6e8d('0x30')](_[_0x6e8d('0x39')](_0x657e7d[_0x6e8d('0x2e')],_0x5383b3['filters']),_0x3f4a50);if(_0x657e7d[_0x6e8d('0x2e')][_0x6e8d('0x3a')]){_0xd0a6b7[_0x6e8d('0x38')]=_[_0x6e8d('0x3b')](_0xd0a6b7['where'],{'$or':_[_0x6e8d('0x2d')](_0x3f4a50,function(_0x2ad437){if(_0x2ad437['type']!==_0x6e8d('0x3c')){var _0x24fd41={};_0x24fd41[_0x2ad437[_0x6e8d('0x25')]]={'$like':'%'+_0x657e7d['query'][_0x6e8d('0x3a')]+'%'};return _0x24fd41;}})});}_0xd0a6b7=_[_0x6e8d('0x3b')]({},_0xd0a6b7,_0x657e7d[_0x6e8d('0x3d')]);var _0x4cce69={'where':_0xd0a6b7[_0x6e8d('0x38')]};return db[_0x6e8d('0x28')]['count'](_0x4cce69)[_0x6e8d('0x22')](function(_0xefa446){_0xfe2b17[_0x6e8d('0x1b')]=_0xefa446;if(_0x657e7d['query'][_0x6e8d('0x3e')]){_0xd0a6b7[_0x6e8d('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0xd0a6b7);})[_0x6e8d('0x22')](function(_0x1c97e7){_0xfe2b17[_0x6e8d('0x40')]=_0x1c97e7;return _0xfe2b17;})[_0x6e8d('0x22')](respondWithFilteredResult(_0x419f9a,_0xd0a6b7))[_0x6e8d('0x41')](handleError(_0x419f9a,null));};exports[_0x6e8d('0x42')]=function(_0x2f4775,_0x11649a){var _0xb73100={'raw':![],'where':{'id':_0x2f4775[_0x6e8d('0x43')]['id']}},_0x31f738={};_0x31f738[_0x6e8d('0x32')]=_['keys'](db[_0x6e8d('0x28')]['rawAttributes']);_0x31f738[_0x6e8d('0x2e')]=_[_0x6e8d('0x2f')](_0x2f4775[_0x6e8d('0x2e')]);_0x31f738[_0x6e8d('0x30')]=_['intersection'](_0x31f738['model'],_0x31f738[_0x6e8d('0x2e')]);_0xb73100[_0x6e8d('0x33')]=_['intersection'](_0x31f738['model'],qs['fields'](_0x2f4775[_0x6e8d('0x2e')]['fields']));_0xb73100[_0x6e8d('0x33')]=_0xb73100[_0x6e8d('0x33')][_0x6e8d('0x44')]?_0xb73100[_0x6e8d('0x33')]:_0x31f738[_0x6e8d('0x32')];if(_0x2f4775['query'][_0x6e8d('0x3e')]){_0xb73100[_0x6e8d('0x3f')]=[{'all':!![]}];}_0xb73100=_['merge']({},_0xb73100,_0x2f4775['options']);return db[_0x6e8d('0x28')][_0x6e8d('0x45')](_0xb73100)[_0x6e8d('0x22')](handleEntityNotFound(_0x11649a,null))[_0x6e8d('0x22')](respondWithResult(_0x11649a,null))['catch'](handleError(_0x11649a,null));};exports[_0x6e8d('0x46')]=function(_0x29599a,_0x400a9){return db[_0x6e8d('0x28')][_0x6e8d('0x46')](_0x29599a['body'],{})[_0x6e8d('0x22')](respondWithResult(_0x400a9,0xc9))[_0x6e8d('0x41')](handleError(_0x400a9,null));};exports[_0x6e8d('0x47')]=function(_0x4e50b0,_0x5ecfc0){return db[_0x6e8d('0x28')][_0x6e8d('0x47')](_0x4e50b0[_0x6e8d('0x48')],{'raw':![],'individualHooks':!![]})[_0x6e8d('0x22')](respondWithResult(_0x5ecfc0,0xc9))[_0x6e8d('0x41')](handleError(_0x5ecfc0,null));};exports[_0x6e8d('0x21')]=function(_0x382cce,_0x298694){if(_0x382cce[_0x6e8d('0x48')]['id']){delete _0x382cce[_0x6e8d('0x48')]['id'];}return db[_0x6e8d('0x28')][_0x6e8d('0x45')]({'where':{'id':_0x382cce['params']['id']}})[_0x6e8d('0x22')](handleEntityNotFound(_0x298694,null))['then'](saveUpdates(_0x382cce['body'],null))[_0x6e8d('0x22')](respondWithResult(_0x298694,null))[_0x6e8d('0x41')](handleError(_0x298694,null));};exports[_0x6e8d('0x49')]=function(_0x1bf12b,_0x154b0f){return db[_0x6e8d('0x28')][_0x6e8d('0x45')]({'where':{'id':_0x1bf12b['params']['id']}})[_0x6e8d('0x22')](handleEntityNotFound(_0x154b0f,null))[_0x6e8d('0x22')](removeEntity(_0x154b0f,null))[_0x6e8d('0x41')](handleError(_0x154b0f,null));};exports[_0x6e8d('0x4a')]=function(_0x270585,_0xc1f84e){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x270585[_0x6e8d('0x2e')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x6e8d('0x22')](respondWithResult(_0xc1f84e,0xcc))[_0x6e8d('0x41')](handleError(_0xc1f84e,null));};exports[_0x6e8d('0x4b')]=function(_0x2ca493,_0x486cec,_0x2265a9){return db[_0x6e8d('0x4c')]['findOne']({'where':{'id':_0x2ca493[_0x6e8d('0x43')]['id']}})[_0x6e8d('0x22')](handleEntityNotFound(_0x486cec,null))[_0x6e8d('0x22')](function(_0x343cf2){if(_0x343cf2){return db[_0x6e8d('0x4d')][_0x6e8d('0x4e')](function(_0x194bc4){return db[_0x6e8d('0x28')][_0x6e8d('0x49')]({'where':{'CustomReportId':_0x2ca493[_0x6e8d('0x43')]['id']},'transaction':_0x194bc4})[_0x6e8d('0x22')](function(_0x585457){var _0x98cca4=_[_0x6e8d('0x2d')](_0x2ca493['body'],function(_0x51650b){delete _0x51650b['id'];_0x51650b['CustomReportId']=_0x2ca493[_0x6e8d('0x43')]['id'];return _0x51650b;});return db[_0x6e8d('0x28')]['bulkCreate'](_0x98cca4,{'transaction':_0x194bc4});});})[_0x6e8d('0x22')](function(){return db[_0x6e8d('0x28')]['findAll']({'where':{'CustomReportId':_0x2ca493[_0x6e8d('0x43')]['id']}});});}})['then'](respondWithResult(_0x486cec,null))[_0x6e8d('0x41')](handleError(_0x486cec,null));}; \ No newline at end of file +var _0xbea3=['error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','include','findAll','rows','catch','show','params','includeAll','create','body','bulkCreate','find','destroy','bulkDestroy','addFields','AnalyticCustomReport','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then'];(function(_0x24fcbc,_0x5108d5){var _0x5d8757=function(_0x27d6ce){while(--_0x27d6ce){_0x24fcbc['push'](_0x24fcbc['shift']());}};_0x5d8757(++_0x5108d5);}(_0xbea3,0x1a6));var _0x3bea=function(_0x183887,_0x5cd3f3){_0x183887=_0x183887-0x0;var _0xf3fbdf=_0xbea3[_0x183887];return _0xf3fbdf;};'use strict';var emlformat=require(_0x3bea('0x0'));var rimraf=require(_0x3bea('0x1'));var zipdir=require(_0x3bea('0x2'));var jsonpatch=require(_0x3bea('0x3'));var rp=require(_0x3bea('0x4'));var moment=require(_0x3bea('0x5'));var BPromise=require(_0x3bea('0x6'));var Mustache=require('mustache');var util=require(_0x3bea('0x7'));var path=require(_0x3bea('0x8'));var sox=require(_0x3bea('0x9'));var csv=require(_0x3bea('0xa'));var ejs=require(_0x3bea('0xb'));var fs=require('fs');var fs_extra=require(_0x3bea('0xc'));var _=require('lodash');var squel=require(_0x3bea('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3bea('0xe'));var toCsv=require(_0x3bea('0xa'));var querystring=require(_0x3bea('0xf'));var Papa=require(_0x3bea('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3bea('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bea('0x12'))(_0x3bea('0x13'));var utils=require(_0x3bea('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3bea('0x15'))['db'];function respondWithStatusCode(_0x7b4cac,_0x3c44aa){_0x3c44aa=_0x3c44aa||0xcc;return function(_0x30997f){if(_0x30997f){return _0x7b4cac[_0x3bea('0x16')](_0x3c44aa);}return _0x7b4cac[_0x3bea('0x17')](_0x3c44aa)[_0x3bea('0x18')]();};}function respondWithResult(_0x50e9f3,_0xbcdb5a){_0xbcdb5a=_0xbcdb5a||0xc8;return function(_0x2b00be){if(_0x2b00be){return _0x50e9f3[_0x3bea('0x17')](_0xbcdb5a)[_0x3bea('0x19')](_0x2b00be);}};}function respondWithFilteredResult(_0x4cf130,_0xb52b24){return function(_0x1a85d1){if(_0x1a85d1){var _0x1be8b7=typeof _0xb52b24[_0x3bea('0x1a')]===_0x3bea('0x1b')&&typeof _0xb52b24['limit']===_0x3bea('0x1b');var _0x4ae1ac=_0x1a85d1[_0x3bea('0x1c')];var _0x266a41=_0x1be8b7?0x0:_0xb52b24['offset'];var _0x5afdbe=_0x1be8b7?_0x1a85d1[_0x3bea('0x1c')]:_0xb52b24['offset']+_0xb52b24[_0x3bea('0x1d')];var _0x32e332;if(_0x5afdbe>=_0x4ae1ac){_0x5afdbe=_0x4ae1ac;_0x32e332=0xc8;}else{_0x32e332=0xce;}_0x4cf130['status'](_0x32e332);return _0x4cf130[_0x3bea('0x1e')]('Content-Range',_0x266a41+'-'+_0x5afdbe+'/'+_0x4ae1ac)[_0x3bea('0x19')](_0x1a85d1);}return null;};}function patchUpdates(_0x35044c){return function(_0x4eafe9){try{jsonpatch['apply'](_0x4eafe9,_0x35044c,!![]);}catch(_0x3d8a2d){return BPromise[_0x3bea('0x1f')](_0x3d8a2d);}return _0x4eafe9['save']();};}function saveUpdates(_0x5a658c,_0x3f4eef){return function(_0x632c7a){if(_0x632c7a){return _0x632c7a[_0x3bea('0x20')](_0x5a658c)[_0x3bea('0x21')](function(_0x49c13a){return _0x49c13a;});}return null;};}function removeEntity(_0x27a723,_0x3ec25f){return function(_0x3853c4){if(_0x3853c4){return _0x3853c4['destroy']()['then'](function(){_0x27a723[_0x3bea('0x17')](0xcc)[_0x3bea('0x18')]();});}};}function handleEntityNotFound(_0x403aef,_0x189174){return function(_0x6b7f90){if(!_0x6b7f90){_0x403aef['sendStatus'](0x194);}return _0x6b7f90;};}function handleError(_0x846639,_0xa8f7af){_0xa8f7af=_0xa8f7af||0x1f4;return function(_0xd3da50){logger[_0x3bea('0x22')](_0xd3da50[_0x3bea('0x23')]);if(_0xd3da50[_0x3bea('0x24')]){delete _0xd3da50[_0x3bea('0x24')];}_0x846639[_0x3bea('0x17')](_0xa8f7af)[_0x3bea('0x25')](_0xd3da50);};}exports[_0x3bea('0x26')]=function(_0x152795,_0x1be807){var _0x5d38a1={},_0x4678fb={},_0x1525b1={'count':0x0,'rows':[]};var _0x418829=_[_0x3bea('0x27')](db[_0x3bea('0x28')][_0x3bea('0x29')],function(_0x1d5b88){return{'name':_0x1d5b88[_0x3bea('0x2a')],'type':_0x1d5b88['type']['key']};});_0x4678fb['model']=_['map'](_0x418829,_0x3bea('0x24'));_0x4678fb[_0x3bea('0x2b')]=_[_0x3bea('0x2c')](_0x152795['query']);_0x4678fb['filters']=_[_0x3bea('0x2d')](_0x4678fb['model'],_0x4678fb['query']);_0x5d38a1[_0x3bea('0x2e')]=_[_0x3bea('0x2d')](_0x4678fb[_0x3bea('0x2f')],qs[_0x3bea('0x30')](_0x152795[_0x3bea('0x2b')][_0x3bea('0x30')]));_0x5d38a1[_0x3bea('0x2e')]=_0x5d38a1['attributes'][_0x3bea('0x31')]?_0x5d38a1[_0x3bea('0x2e')]:_0x4678fb[_0x3bea('0x2f')];if(!_0x152795[_0x3bea('0x2b')]['hasOwnProperty'](_0x3bea('0x32'))){_0x5d38a1[_0x3bea('0x1d')]=qs['limit'](_0x152795[_0x3bea('0x2b')][_0x3bea('0x1d')]);_0x5d38a1['offset']=qs[_0x3bea('0x1a')](_0x152795[_0x3bea('0x2b')][_0x3bea('0x1a')]);}_0x5d38a1[_0x3bea('0x33')]=qs[_0x3bea('0x34')](_0x152795[_0x3bea('0x2b')][_0x3bea('0x34')]);_0x5d38a1[_0x3bea('0x35')]=qs[_0x3bea('0x36')](_[_0x3bea('0x37')](_0x152795[_0x3bea('0x2b')],_0x4678fb['filters']),_0x418829);if(_0x152795['query'][_0x3bea('0x38')]){_0x5d38a1[_0x3bea('0x35')]=_[_0x3bea('0x39')](_0x5d38a1[_0x3bea('0x35')],{'$or':_[_0x3bea('0x27')](_0x418829,function(_0x553a1b){if(_0x553a1b[_0x3bea('0x3a')]!=='VIRTUAL'){var _0x332245={};_0x332245[_0x553a1b['name']]={'$like':'%'+_0x152795[_0x3bea('0x2b')][_0x3bea('0x38')]+'%'};return _0x332245;}})});}_0x5d38a1=_[_0x3bea('0x39')]({},_0x5d38a1,_0x152795['options']);var _0x393892={'where':_0x5d38a1[_0x3bea('0x35')]};return db[_0x3bea('0x28')][_0x3bea('0x1c')](_0x393892)[_0x3bea('0x21')](function(_0x363a1e){_0x1525b1[_0x3bea('0x1c')]=_0x363a1e;if(_0x152795[_0x3bea('0x2b')]['includeAll']){_0x5d38a1[_0x3bea('0x3b')]=[{'all':!![]}];}return db[_0x3bea('0x28')][_0x3bea('0x3c')](_0x5d38a1);})[_0x3bea('0x21')](function(_0x152d71){_0x1525b1[_0x3bea('0x3d')]=_0x152d71;return _0x1525b1;})[_0x3bea('0x21')](respondWithFilteredResult(_0x1be807,_0x5d38a1))[_0x3bea('0x3e')](handleError(_0x1be807,null));};exports[_0x3bea('0x3f')]=function(_0x125123,_0x134768){var _0x4966a0={'raw':![],'where':{'id':_0x125123[_0x3bea('0x40')]['id']}},_0x10fd3c={};_0x10fd3c['model']=_[_0x3bea('0x2c')](db['AnalyticFieldReport'][_0x3bea('0x29')]);_0x10fd3c['query']=_[_0x3bea('0x2c')](_0x125123['query']);_0x10fd3c[_0x3bea('0x36')]=_[_0x3bea('0x2d')](_0x10fd3c[_0x3bea('0x2f')],_0x10fd3c['query']);_0x4966a0['attributes']=_[_0x3bea('0x2d')](_0x10fd3c[_0x3bea('0x2f')],qs[_0x3bea('0x30')](_0x125123[_0x3bea('0x2b')]['fields']));_0x4966a0[_0x3bea('0x2e')]=_0x4966a0[_0x3bea('0x2e')]['length']?_0x4966a0[_0x3bea('0x2e')]:_0x10fd3c[_0x3bea('0x2f')];if(_0x125123['query'][_0x3bea('0x41')]){_0x4966a0['include']=[{'all':!![]}];}_0x4966a0=_['merge']({},_0x4966a0,_0x125123['options']);return db[_0x3bea('0x28')]['find'](_0x4966a0)[_0x3bea('0x21')](handleEntityNotFound(_0x134768,null))[_0x3bea('0x21')](respondWithResult(_0x134768,null))[_0x3bea('0x3e')](handleError(_0x134768,null));};exports[_0x3bea('0x42')]=function(_0x304e37,_0x3f656d){return db[_0x3bea('0x28')][_0x3bea('0x42')](_0x304e37[_0x3bea('0x43')],{})[_0x3bea('0x21')](respondWithResult(_0x3f656d,0xc9))['catch'](handleError(_0x3f656d,null));};exports['bulkCreate']=function(_0x38d11e,_0x2efd6b){return db['AnalyticFieldReport'][_0x3bea('0x44')](_0x38d11e['body'],{'raw':![],'individualHooks':!![]})[_0x3bea('0x21')](respondWithResult(_0x2efd6b,0xc9))[_0x3bea('0x3e')](handleError(_0x2efd6b,null));};exports[_0x3bea('0x20')]=function(_0x16e410,_0x16e359){if(_0x16e410[_0x3bea('0x43')]['id']){delete _0x16e410[_0x3bea('0x43')]['id'];}return db['AnalyticFieldReport'][_0x3bea('0x45')]({'where':{'id':_0x16e410[_0x3bea('0x40')]['id']}})[_0x3bea('0x21')](handleEntityNotFound(_0x16e359,null))['then'](saveUpdates(_0x16e410['body'],null))[_0x3bea('0x21')](respondWithResult(_0x16e359,null))[_0x3bea('0x3e')](handleError(_0x16e359,null));};exports[_0x3bea('0x46')]=function(_0x55e02b,_0x4670a7){return db[_0x3bea('0x28')][_0x3bea('0x45')]({'where':{'id':_0x55e02b[_0x3bea('0x40')]['id']}})[_0x3bea('0x21')](handleEntityNotFound(_0x4670a7,null))[_0x3bea('0x21')](removeEntity(_0x4670a7,null))[_0x3bea('0x3e')](handleError(_0x4670a7,null));};exports[_0x3bea('0x47')]=function(_0x54d1d0,_0x3c0963){return db[_0x3bea('0x28')]['destroy']({'where':{'id':_0x54d1d0[_0x3bea('0x2b')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x3bea('0x21')](respondWithResult(_0x3c0963,0xcc))['catch'](handleError(_0x3c0963,null));};exports[_0x3bea('0x48')]=function(_0x4a5999,_0x463b22,_0x5e2be1){return db[_0x3bea('0x49')]['findOne']({'where':{'id':_0x4a5999[_0x3bea('0x40')]['id']}})[_0x3bea('0x21')](handleEntityNotFound(_0x463b22,null))['then'](function(_0x3efd65){if(_0x3efd65){return db['sequelize'][_0x3bea('0x4a')](function(_0x4a2029){return db[_0x3bea('0x28')]['destroy']({'where':{'CustomReportId':_0x4a5999[_0x3bea('0x40')]['id']},'transaction':_0x4a2029})['then'](function(_0x1e0659){var _0x47b761=_['map'](_0x4a5999[_0x3bea('0x43')],function(_0x5489e3){delete _0x5489e3['id'];_0x5489e3[_0x3bea('0x4b')]=_0x4a5999[_0x3bea('0x40')]['id'];return _0x5489e3;});return db['AnalyticFieldReport'][_0x3bea('0x44')](_0x47b761,{'transaction':_0x4a2029});});})[_0x3bea('0x21')](function(){return db[_0x3bea('0x28')]['findAll']({'where':{'CustomReportId':_0x4a5999[_0x3bea('0x40')]['id']}});});}})[_0x3bea('0x21')](respondWithResult(_0x463b22,null))[_0x3bea('0x3e')](handleError(_0x463b22,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 191c81e..16dbdbb 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 _0x340e=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c8654,_0x3e23ac){var _0x50f0b8=function(_0xd90314){while(--_0xd90314){_0x3c8654['push'](_0x3c8654['shift']());}};_0x50f0b8(++_0x3e23ac);}(_0x340e,0x102));var _0xe340=function(_0x150f60,_0x59ace3){_0x150f60=_0x150f60-0x0;var _0x241c02=_0x340e[_0x150f60];return _0x241c02;};'use strict';var _=require(_0xe340('0x0'));var util=require(_0xe340('0x1'));var logger=require(_0xe340('0x2'))(_0xe340('0x3'));var moment=require(_0xe340('0x4'));var BPromise=require(_0xe340('0x5'));var rp=require(_0xe340('0x6'));var fs=require('fs');var path=require(_0xe340('0x7'));var rimraf=require(_0xe340('0x8'));var config=require(_0xe340('0x9'));var attributes=require(_0xe340('0xa'));module[_0xe340('0xb')]=function(_0x1b0efa,_0x22abda){return _0x1b0efa[_0xe340('0xc')]('AnalyticFieldReport',attributes,{'tableName':_0xe340('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x475f=['./analyticFieldReport.attributes','define','lodash','util','request-promise','path','rimraf','../../config/environment'];(function(_0x129a7c,_0x5c7eae){var _0x33d5cc=function(_0x24988b){while(--_0x24988b){_0x129a7c['push'](_0x129a7c['shift']());}};_0x33d5cc(++_0x5c7eae);}(_0x475f,0xa2));var _0xf475=function(_0xb47885,_0x1bdcc7){_0xb47885=_0xb47885-0x0;var _0x39373b=_0x475f[_0xb47885];return _0x39373b;};'use strict';var _=require(_0xf475('0x0'));var util=require(_0xf475('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf475('0x2'));var fs=require('fs');var path=require(_0xf475('0x3'));var rimraf=require(_0xf475('0x4'));var config=require(_0xf475('0x5'));var attributes=require(_0xf475('0x6'));module['exports']=function(_0x2ec0e4,_0xace246){return _0x2ec0e4[_0xf475('0x7')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','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 4c9dbea..0de0e58 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 _0x4eb8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x2ec26a,_0x70bd9d){var _0x204b56=function(_0x58e3ef){while(--_0x58e3ef){_0x2ec26a['push'](_0x2ec26a['shift']());}};_0x204b56(++_0x70bd9d);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x4eb8[_0x3eb713];return _0x1d7128;};'use strict';var _=require(_0x84eb('0x0'));var util=require(_0x84eb('0x1'));var moment=require(_0x84eb('0x2'));var BPromise=require(_0x84eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84eb('0x4'));var db=require(_0x84eb('0x5'))['db'];var utils=require(_0x84eb('0x6'));var logger=require(_0x84eb('0x7'))(_0x84eb('0x8'));var config=require(_0x84eb('0x9'));var jayson=require(_0x84eb('0xa'));var client=jayson[_0x84eb('0xb')][_0x84eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x594e38,_0x131076,_0x37d9e6){return new BPromise(function(_0x12b996,_0xb3d36c){return client[_0x84eb('0xd')](_0x594e38,_0x37d9e6)[_0x84eb('0xe')](function(_0xf85549){logger[_0x84eb('0xf')](_0x84eb('0x10'),_0x131076,'request\x20sent');logger[_0x84eb('0x11')](_0x84eb('0x12'),_0x131076,_0x84eb('0x13'),JSON[_0x84eb('0x14')](_0xf85549));if(_0xf85549['error']){if(_0xf85549[_0x84eb('0x15')][_0x84eb('0x16')]===0x1f4){logger[_0x84eb('0x15')](_0x84eb('0x10'),_0x131076,_0xf85549[_0x84eb('0x15')]['message']);return _0xb3d36c(_0xf85549[_0x84eb('0x15')][_0x84eb('0x17')]);}logger[_0x84eb('0x15')](_0x84eb('0x10'),_0x131076,_0xf85549[_0x84eb('0x15')][_0x84eb('0x17')]);return _0x12b996(_0xf85549[_0x84eb('0x15')][_0x84eb('0x17')]);}else{logger[_0x84eb('0xf')](_0x84eb('0x10'),_0x131076,_0x84eb('0x13'));_0x12b996(_0xf85549[_0x84eb('0x18')]['message']);}})[_0x84eb('0x19')](function(_0x1dcafc){logger[_0x84eb('0x15')](_0x84eb('0x10'),_0x131076,_0x1dcafc);_0xb3d36c(_0x1dcafc);});});} \ No newline at end of file +var _0xa105=['message','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x23b85e,_0x39b209){var _0x329756=function(_0x3418e1){while(--_0x3418e1){_0x23b85e['push'](_0x23b85e['shift']());}};_0x329756(++_0x39b209);}(_0xa105,0xb1));var _0x5a10=function(_0x2dc811,_0x11cbf2){_0x2dc811=_0x2dc811-0x0;var _0x1e4aba=_0xa105[_0x2dc811];return _0x1e4aba;};'use strict';var _=require('lodash');var util=require(_0x5a10('0x0'));var moment=require('moment');var BPromise=require(_0x5a10('0x1'));var rs=require(_0x5a10('0x2'));var fs=require('fs');var Redis=require(_0x5a10('0x3'));var db=require(_0x5a10('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5a10('0x5'));var client=jayson['client'][_0x5a10('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xc172a1,_0x336378,_0x5918a4){return new BPromise(function(_0x340f9c,_0x4358c2){return client[_0x5a10('0x7')](_0xc172a1,_0x5918a4)[_0x5a10('0x8')](function(_0x2bb789){logger[_0x5a10('0x9')](_0x5a10('0xa'),_0x336378,_0x5a10('0xb'));logger['debug'](_0x5a10('0xc'),_0x336378,_0x5a10('0xb'),JSON['stringify'](_0x2bb789));if(_0x2bb789[_0x5a10('0xd')]){if(_0x2bb789[_0x5a10('0xd')][_0x5a10('0xe')]===0x1f4){logger[_0x5a10('0xd')](_0x5a10('0xa'),_0x336378,_0x2bb789['error'][_0x5a10('0xf')]);return _0x4358c2(_0x2bb789[_0x5a10('0xd')][_0x5a10('0xf')]);}logger[_0x5a10('0xd')](_0x5a10('0xa'),_0x336378,_0x2bb789[_0x5a10('0xd')][_0x5a10('0xf')]);return _0x340f9c(_0x2bb789['error']['message']);}else{logger['info'](_0x5a10('0xa'),_0x336378,_0x5a10('0xb'));_0x340f9c(_0x2bb789['result'][_0x5a10('0xf')]);}})['catch'](function(_0x24f102){logger[_0x5a10('0xd')](_0x5a10('0xa'),_0x336378,_0x24f102);_0x4358c2(_0x24f102);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a62107c..565b29f 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(_0x4eb2b8,_0x1e93f2){var _0x5da0ff=function(_0x433a22){while(--_0x433a22){_0x4eb2b8['push'](_0x4eb2b8['shift']());}};_0x5da0ff(++_0x1e93f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x1fbc02,_0x64d0ce){var _0x2c0493=function(_0x372fc7){while(--_0x372fc7){_0x1fbc02['push'](_0x1fbc02['shift']());}};_0x2c0493(++_0x64d0ce);}(_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['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 0af6127..ad9782b 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 _0x205d=['STRING','TEXT','sequelize','exports'];(function(_0x2fe611,_0x259389){var _0x1d26fd=function(_0x48fa34){while(--_0x48fa34){_0x2fe611['push'](_0x2fe611['shift']());}};_0x1d26fd(++_0x259389);}(_0x205d,0xf6));var _0xd205=function(_0x206adf,_0x2ba1a3){_0x206adf=_0x206adf-0x0;var _0x171caa=_0x205d[_0x206adf];return _0x171caa;};'use strict';var Sequelize=require(_0xd205('0x0'));module[_0xd205('0x1')]={'name':{'type':Sequelize[_0xd205('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xd205('0x3')]},'description':{'type':Sequelize[_0xd205('0x2')]}}; \ No newline at end of file +var _0x24cf=['TEXT','STRING','name'];(function(_0x4a3bf7,_0x417423){var _0x1b2784=function(_0x18aeec){while(--_0x18aeec){_0x4a3bf7['push'](_0x4a3bf7['shift']());}};_0x1b2784(++_0x417423);}(_0x24cf,0x1d5));var _0xf24c=function(_0x380c4c,_0x1f272b){_0x380c4c=_0x380c4c-0x0;var _0x4ad9cc=_0x24cf[_0x380c4c];return _0x4ad9cc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf24c('0x0')],'allowNull':![],'unique':_0xf24c('0x1')},'table':{'type':Sequelize[_0xf24c('0x0')]},'metric':{'type':Sequelize[_0xf24c('0x2')]},'description':{'type':Sequelize[_0xf24c('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 235bfab..86e5186 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 _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x338122,_0x17322e){var _0x4e3846=function(_0x2c70b9){while(--_0x2c70b9){_0x338122['push'](_0x338122['shift']());}};_0x4e3846(++_0x17322e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x5fc3[_0x1db831];return _0x39ba56;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file +var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x47e652,_0x2ed571){var _0xa71da=function(_0x3c89ef){while(--_0x3c89ef){_0x47e652['push'](_0x47e652['shift']());}};_0xa71da(++_0x2ed571);}(_0x5fc3,0xa8));var _0x35fc=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x5fc3[_0x363ef8];return _0x148822;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b7064a5..8f392ef 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 _0x7c1f=['moment','request-promise','path','rimraf','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x7c1f,0x194));var _0xf7c1=function(_0x578b77,_0x433209){_0x578b77=_0x578b77-0x0;var _0x4e57e1=_0x7c1f[_0x578b77];return _0x4e57e1;};'use strict';var _=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var logger=require(_0xf7c1('0x2'))(_0xf7c1('0x3'));var moment=require(_0xf7c1('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7c1('0x5'));var fs=require('fs');var path=require(_0xf7c1('0x6'));var rimraf=require(_0xf7c1('0x7'));var config=require('../../config/environment');var attributes=require(_0xf7c1('0x8'));module[_0xf7c1('0x9')]=function(_0x3c21cf,_0x136e1e){return _0x3c21cf['define'](_0xf7c1('0xa'),attributes,{'tableName':_0xf7c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x299fd9,_0x4d4c4d){var _0x5e61d7=function(_0x70e27d){while(--_0x70e27d){_0x299fd9['push'](_0x299fd9['shift']());}};_0x5e61d7(++_0x4d4c4d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x22f3a3,_0x4c0f88){_0x22f3a3=_0x22f3a3-0x0;var _0xf8cd68=_0x1cb9[_0x22f3a3];return _0xf8cd68;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index b6dde66..442b61c 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 _0x4c14=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59440b,_0x1453ec){var _0x1fd85e=function(_0x5ddca0){while(--_0x5ddca0){_0x59440b['push'](_0x59440b['shift']());}};_0x1fd85e(++_0x1453ec);}(_0x4c14,0x176));var _0x44c1=function(_0x3108b1,_0x4aa28a){_0x3108b1=_0x3108b1-0x0;var _0x4d6307=_0x4c14[_0x3108b1];return _0x4d6307;};'use strict';var _=require(_0x44c1('0x0'));var util=require('util');var moment=require(_0x44c1('0x1'));var BPromise=require(_0x44c1('0x2'));var rs=require(_0x44c1('0x3'));var fs=require('fs');var Redis=require(_0x44c1('0x4'));var db=require(_0x44c1('0x5'))['db'];var utils=require(_0x44c1('0x6'));var logger=require('../../config/logger')(_0x44c1('0x7'));var config=require(_0x44c1('0x8'));var jayson=require(_0x44c1('0x9'));var client=jayson[_0x44c1('0xa')][_0x44c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c138,_0x12517c,_0x38ac91){return new BPromise(function(_0x34004d,_0x299eba){return client['request'](_0x44c138,_0x38ac91)[_0x44c1('0xc')](function(_0x58ea58){logger[_0x44c1('0xd')](_0x44c1('0xe'),_0x12517c,_0x44c1('0xf'));logger[_0x44c1('0x10')](_0x44c1('0x11'),_0x12517c,_0x44c1('0xf'),JSON[_0x44c1('0x12')](_0x58ea58));if(_0x58ea58[_0x44c1('0x13')]){if(_0x58ea58[_0x44c1('0x13')]['code']===0x1f4){logger[_0x44c1('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x12517c,_0x58ea58[_0x44c1('0x13')]['message']);return _0x299eba(_0x58ea58[_0x44c1('0x13')][_0x44c1('0x14')]);}logger[_0x44c1('0x13')](_0x44c1('0xe'),_0x12517c,_0x58ea58['error']['message']);return _0x34004d(_0x58ea58['error'][_0x44c1('0x14')]);}else{logger[_0x44c1('0xd')](_0x44c1('0xe'),_0x12517c,'request\x20sent');_0x34004d(_0x58ea58[_0x44c1('0x15')][_0x44c1('0x14')]);}})[_0x44c1('0x16')](function(_0x4d93bb){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x12517c,_0x4d93bb);_0x299eba(_0x4d93bb);});});} \ No newline at end of file +var _0x8c40=['stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x887f6a,_0x469433){var _0x3ba2fe=function(_0x1c4ba4){while(--_0x1c4ba4){_0x887f6a['push'](_0x887f6a['shift']());}};_0x3ba2fe(++_0x469433);}(_0x8c40,0xf6));var _0x08c4=function(_0x2f9b19,_0x2cd17b){_0x2f9b19=_0x2f9b19-0x0;var _0xf1f33c=_0x8c40[_0x2f9b19];return _0xf1f33c;};'use strict';var _=require(_0x08c4('0x0'));var util=require(_0x08c4('0x1'));var moment=require('moment');var BPromise=require(_0x08c4('0x2'));var rs=require(_0x08c4('0x3'));var fs=require('fs');var Redis=require(_0x08c4('0x4'));var db=require(_0x08c4('0x5'))['db'];var utils=require(_0x08c4('0x6'));var logger=require(_0x08c4('0x7'))('rpc');var config=require(_0x08c4('0x8'));var jayson=require(_0x08c4('0x9'));var client=jayson[_0x08c4('0xa')][_0x08c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x176674,_0x29e750,_0x3cc451){return new BPromise(function(_0x3b3890,_0xac5eed){return client[_0x08c4('0xc')](_0x176674,_0x3cc451)[_0x08c4('0xd')](function(_0x2dc924){logger['info'](_0x08c4('0xe'),_0x29e750,_0x08c4('0xf'));logger[_0x08c4('0x10')](_0x08c4('0x11'),_0x29e750,_0x08c4('0xf'),JSON[_0x08c4('0x12')](_0x2dc924));if(_0x2dc924['error']){if(_0x2dc924[_0x08c4('0x13')][_0x08c4('0x14')]===0x1f4){logger[_0x08c4('0x13')](_0x08c4('0xe'),_0x29e750,_0x2dc924[_0x08c4('0x13')][_0x08c4('0x15')]);return _0xac5eed(_0x2dc924[_0x08c4('0x13')][_0x08c4('0x15')]);}logger['error'](_0x08c4('0xe'),_0x29e750,_0x2dc924['error'][_0x08c4('0x15')]);return _0x3b3890(_0x2dc924[_0x08c4('0x13')]['message']);}else{logger[_0x08c4('0x16')](_0x08c4('0xe'),_0x29e750,_0x08c4('0xf'));_0x3b3890(_0x2dc924['result'][_0x08c4('0x15')]);}})[_0x08c4('0x17')](function(_0xd958c2){logger[_0x08c4('0x13')](_0x08c4('0xe'),_0x29e750,_0xd958c2);_0xac5eed(_0xd958c2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c524841..d6b6030 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 _0x41d9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x448b0d,_0x167d71){var _0x4b582c=function(_0x5771b6){while(--_0x5771b6){_0x448b0d['push'](_0x448b0d['shift']());}};_0x4b582c(++_0x167d71);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var path=require(_0x941d('0x2'));var timeout=require(_0x941d('0x3'));var express=require(_0x941d('0x4'));var router=express[_0x941d('0x5')]();var fs_extra=require(_0x941d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x941d('0x7'));var config=require(_0x941d('0x8'));var controller=require('./analyticMetric.controller');router[_0x941d('0x9')]('/',auth[_0x941d('0xa')](),controller['index']);router[_0x941d('0x9')]('/:id',auth[_0x941d('0xa')](),controller[_0x941d('0xb')]);router[_0x941d('0xc')]('/',auth[_0x941d('0xa')](),controller[_0x941d('0xd')]);router['put'](_0x941d('0xe'),auth[_0x941d('0xa')](),controller[_0x941d('0xf')]);router[_0x941d('0x10')]('/:id',auth[_0x941d('0xa')](),controller[_0x941d('0x11')]);module[_0x941d('0x12')]=router; \ No newline at end of file +var _0xedf2=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','Router'];(function(_0x150466,_0x1decc2){var _0x164d2f=function(_0x1c0bc1){while(--_0x1c0bc1){_0x150466['push'](_0x150466['shift']());}};_0x164d2f(++_0x1decc2);}(_0xedf2,0x1ac));var _0x2edf=function(_0x2f5481,_0x51f55a){_0x2f5481=_0x2f5481-0x0;var _0x1c5e66=_0xedf2[_0x2f5481];return _0x1c5e66;};'use strict';var multer=require('multer');var util=require(_0x2edf('0x0'));var path=require(_0x2edf('0x1'));var timeout=require(_0x2edf('0x2'));var express=require('express');var router=express[_0x2edf('0x3')]();var fs_extra=require(_0x2edf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2edf('0x5'));var config=require(_0x2edf('0x6'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x2edf('0x7')](),controller[_0x2edf('0x8')]);router['get']('/:id',auth[_0x2edf('0x7')](),controller['show']);router[_0x2edf('0x9')]('/',auth['isAuthenticated'](),controller[_0x2edf('0xa')]);router[_0x2edf('0xb')](_0x2edf('0xc'),auth[_0x2edf('0x7')](),controller[_0x2edf('0xd')]);router[_0x2edf('0xe')](_0x2edf('0xc'),auth[_0x2edf('0x7')](),controller[_0x2edf('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 350dd5e..ebad8d1 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 _0x35a4=['sequelize','exports','TEXT'];(function(_0x562219,_0x538e13){var _0x208fa5=function(_0x5cd2fb){while(--_0x5cd2fb){_0x562219['push'](_0x562219['shift']());}};_0x208fa5(++_0x538e13);}(_0x35a4,0xab));var _0x435a=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x35a4[_0x3718b7];return _0xf8c91e;};'use strict';var Sequelize=require(_0x435a('0x0'));module[_0x435a('0x1')]={'tree':{'type':Sequelize[_0x435a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8846=['exports','TEXT','sequelize'];(function(_0x4fb31c,_0x539307){var _0xa82d19=function(_0x21f807){while(--_0x21f807){_0x4fb31c['push'](_0x4fb31c['shift']());}};_0xa82d19(++_0x539307);}(_0x8846,0x1ca));var _0x6884=function(_0x2ba224,_0x366b1b){_0x2ba224=_0x2ba224-0x0;var _0x36f9da=_0x8846[_0x2ba224];return _0x36f9da;};'use strict';var Sequelize=require(_0x6884('0x0'));module[_0x6884('0x1')]={'tree':{'type':Sequelize[_0x6884('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 401a42c..243f7db 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 _0xa782=['options','include','findAll','rows','catch','params','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x2abfb7,_0x1f6a6b){var _0x3cfb4e=function(_0x319f7b){while(--_0x319f7b){_0x2abfb7['push'](_0x2abfb7['shift']());}};_0x3cfb4e(++_0x1f6a6b);}(_0xa782,0xa4));var _0x2a78=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa782[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x2a78('0x0'));var rimraf=require(_0x2a78('0x1'));var zipdir=require(_0x2a78('0x2'));var jsonpatch=require(_0x2a78('0x3'));var rp=require(_0x2a78('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a78('0x5'));var util=require(_0x2a78('0x6'));var path=require(_0x2a78('0x7'));var sox=require(_0x2a78('0x8'));var csv=require('to-csv');var ejs=require(_0x2a78('0x9'));var fs=require('fs');var fs_extra=require(_0x2a78('0xa'));var _=require(_0x2a78('0xb'));var squel=require(_0x2a78('0xc'));var crypto=require(_0x2a78('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2a78('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a78('0xf'));var Redis=require(_0x2a78('0x10'));var authService=require(_0x2a78('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2a78('0x12'));var hardwareService=require(_0x2a78('0x13'));var logger=require(_0x2a78('0x14'))(_0x2a78('0x15'));var utils=require('../../config/utils');var config=require(_0x2a78('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a78('0x17'))['db'];function respondWithStatusCode(_0x3adbce,_0x4a9dd5){_0x4a9dd5=_0x4a9dd5||0xcc;return function(_0xdbee74){if(_0xdbee74){return _0x3adbce[_0x2a78('0x18')](_0x4a9dd5);}return _0x3adbce['status'](_0x4a9dd5)[_0x2a78('0x19')]();};}function respondWithResult(_0x5d94b5,_0x5cc5cb){_0x5cc5cb=_0x5cc5cb||0xc8;return function(_0xc12427){if(_0xc12427){return _0x5d94b5[_0x2a78('0x1a')](_0x5cc5cb)[_0x2a78('0x1b')](_0xc12427);}};}function respondWithFilteredResult(_0x24dee1,_0x24dbdd){return function(_0x545fde){if(_0x545fde){var _0x251a83=typeof _0x24dbdd[_0x2a78('0x1c')]===_0x2a78('0x1d')&&typeof _0x24dbdd[_0x2a78('0x1e')]==='undefined';var _0x190ebc=_0x545fde[_0x2a78('0x1f')];var _0x105979=_0x251a83?0x0:_0x24dbdd[_0x2a78('0x1c')];var _0xef5094=_0x251a83?_0x545fde[_0x2a78('0x1f')]:_0x24dbdd[_0x2a78('0x1c')]+_0x24dbdd[_0x2a78('0x1e')];var _0x119f12;if(_0xef5094>=_0x190ebc){_0xef5094=_0x190ebc;_0x119f12=0xc8;}else{_0x119f12=0xce;}_0x24dee1['status'](_0x119f12);return _0x24dee1['set'](_0x2a78('0x20'),_0x105979+'-'+_0xef5094+'/'+_0x190ebc)[_0x2a78('0x1b')](_0x545fde);}return null;};}function patchUpdates(_0x258dde){return function(_0x1f45b3){try{jsonpatch[_0x2a78('0x21')](_0x1f45b3,_0x258dde,!![]);}catch(_0x3fa351){return BPromise[_0x2a78('0x22')](_0x3fa351);}return _0x1f45b3[_0x2a78('0x23')]();};}function saveUpdates(_0x2e48db,_0x33dc7c){return function(_0x45d292){if(_0x45d292){return _0x45d292[_0x2a78('0x24')](_0x2e48db)['then'](function(_0x5e0064){return _0x5e0064;});}return null;};}function removeEntity(_0x4623c3,_0x5c3d9c){return function(_0x15f2eb){if(_0x15f2eb){return _0x15f2eb['destroy']()[_0x2a78('0x25')](function(){_0x4623c3[_0x2a78('0x1a')](0xcc)[_0x2a78('0x19')]();});}};}function handleEntityNotFound(_0x182500,_0x43d380){return function(_0x53c77f){if(!_0x53c77f){_0x182500[_0x2a78('0x18')](0x194);}return _0x53c77f;};}function handleError(_0xcdbe51,_0x14d6fe){_0x14d6fe=_0x14d6fe||0x1f4;return function(_0x56706d){logger[_0x2a78('0x26')](_0x56706d[_0x2a78('0x27')]);if(_0x56706d[_0x2a78('0x28')]){delete _0x56706d[_0x2a78('0x28')];}_0xcdbe51[_0x2a78('0x1a')](_0x14d6fe)[_0x2a78('0x29')](_0x56706d);};}exports[_0x2a78('0x2a')]=function(_0x3579d9,_0x481bcf){var _0x1065a4={},_0x40ea84={},_0x7fc2b6={'count':0x0,'rows':[]};var _0x14504f=_[_0x2a78('0x2b')](db[_0x2a78('0x2c')][_0x2a78('0x2d')],function(_0x52690e){return{'name':_0x52690e[_0x2a78('0x2e')],'type':_0x52690e[_0x2a78('0x2f')][_0x2a78('0x30')]};});_0x40ea84[_0x2a78('0x31')]=_['map'](_0x14504f,_0x2a78('0x28'));_0x40ea84[_0x2a78('0x32')]=_[_0x2a78('0x33')](_0x3579d9['query']);_0x40ea84['filters']=_[_0x2a78('0x34')](_0x40ea84[_0x2a78('0x31')],_0x40ea84[_0x2a78('0x32')]);_0x1065a4['attributes']=_[_0x2a78('0x34')](_0x40ea84[_0x2a78('0x31')],qs['fields'](_0x3579d9[_0x2a78('0x32')][_0x2a78('0x35')]));_0x1065a4[_0x2a78('0x36')]=_0x1065a4['attributes']['length']?_0x1065a4[_0x2a78('0x36')]:_0x40ea84[_0x2a78('0x31')];if(!_0x3579d9['query'][_0x2a78('0x37')](_0x2a78('0x38'))){_0x1065a4[_0x2a78('0x1e')]=qs[_0x2a78('0x1e')](_0x3579d9[_0x2a78('0x32')]['limit']);_0x1065a4['offset']=qs[_0x2a78('0x1c')](_0x3579d9[_0x2a78('0x32')][_0x2a78('0x1c')]);}_0x1065a4['order']=qs[_0x2a78('0x39')](_0x3579d9[_0x2a78('0x32')][_0x2a78('0x39')]);_0x1065a4['where']=qs[_0x2a78('0x3a')](_[_0x2a78('0x3b')](_0x3579d9['query'],_0x40ea84[_0x2a78('0x3a')]),_0x14504f);if(_0x3579d9['query'][_0x2a78('0x3c')]){_0x1065a4[_0x2a78('0x3d')]=_[_0x2a78('0x3e')](_0x1065a4['where'],{'$or':_[_0x2a78('0x2b')](_0x14504f,function(_0x293a25){if(_0x293a25[_0x2a78('0x2f')]!==_0x2a78('0x3f')){var _0x1df5ac={};_0x1df5ac[_0x293a25[_0x2a78('0x28')]]={'$like':'%'+_0x3579d9['query']['filter']+'%'};return _0x1df5ac;}})});}_0x1065a4=_['merge']({},_0x1065a4,_0x3579d9[_0x2a78('0x40')]);var _0x1869bf={'where':_0x1065a4[_0x2a78('0x3d')]};return db['AnalyticTreeReport']['count'](_0x1869bf)[_0x2a78('0x25')](function(_0x366d07){_0x7fc2b6[_0x2a78('0x1f')]=_0x366d07;if(_0x3579d9[_0x2a78('0x32')]['includeAll']){_0x1065a4[_0x2a78('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x2a78('0x42')](_0x1065a4);})[_0x2a78('0x25')](function(_0x1bbd9a){_0x7fc2b6[_0x2a78('0x43')]=_0x1bbd9a;return _0x7fc2b6;})[_0x2a78('0x25')](respondWithFilteredResult(_0x481bcf,_0x1065a4))[_0x2a78('0x44')](handleError(_0x481bcf,null));};exports['show']=function(_0x533f75,_0xa70eca){var _0x18e65c={'raw':!![],'where':{'id':_0x533f75[_0x2a78('0x45')]['id']}},_0x33d0c2={};_0x33d0c2[_0x2a78('0x31')]=_[_0x2a78('0x33')](db['AnalyticTreeReport'][_0x2a78('0x2d')]);_0x33d0c2[_0x2a78('0x32')]=_[_0x2a78('0x33')](_0x533f75[_0x2a78('0x32')]);_0x33d0c2[_0x2a78('0x3a')]=_['intersection'](_0x33d0c2['model'],_0x33d0c2[_0x2a78('0x32')]);_0x18e65c[_0x2a78('0x36')]=_[_0x2a78('0x34')](_0x33d0c2[_0x2a78('0x31')],qs[_0x2a78('0x35')](_0x533f75['query'][_0x2a78('0x35')]));_0x18e65c[_0x2a78('0x36')]=_0x18e65c['attributes'][_0x2a78('0x46')]?_0x18e65c['attributes']:_0x33d0c2[_0x2a78('0x31')];if(_0x533f75[_0x2a78('0x32')][_0x2a78('0x47')]){_0x18e65c[_0x2a78('0x41')]=[{'all':!![]}];}_0x18e65c=_[_0x2a78('0x3e')]({},_0x18e65c,_0x533f75[_0x2a78('0x40')]);return db[_0x2a78('0x2c')][_0x2a78('0x48')](_0x18e65c)[_0x2a78('0x25')](handleEntityNotFound(_0xa70eca,null))[_0x2a78('0x25')](respondWithResult(_0xa70eca,null))['catch'](handleError(_0xa70eca,null));};exports[_0x2a78('0x49')]=function(_0x54fb2f,_0x4c9674){return db[_0x2a78('0x2c')]['create'](_0x54fb2f[_0x2a78('0x4a')],{})[_0x2a78('0x25')](respondWithResult(_0x4c9674,0xc9))['catch'](handleError(_0x4c9674,null));};exports[_0x2a78('0x24')]=function(_0x1d5bfe,_0x5f5193){if(_0x1d5bfe[_0x2a78('0x4a')]['id']){delete _0x1d5bfe[_0x2a78('0x4a')]['id'];}return db[_0x2a78('0x2c')][_0x2a78('0x48')]({'where':{'id':_0x1d5bfe[_0x2a78('0x45')]['id']}})[_0x2a78('0x25')](handleEntityNotFound(_0x5f5193,null))[_0x2a78('0x25')](saveUpdates(_0x1d5bfe[_0x2a78('0x4a')],null))[_0x2a78('0x25')](respondWithResult(_0x5f5193,null))['catch'](handleError(_0x5f5193,null));};exports[_0x2a78('0x4b')]=function(_0x4e9eda,_0x1919ac){return db[_0x2a78('0x2c')]['find']({'where':{'id':_0x4e9eda[_0x2a78('0x45')]['id']}})[_0x2a78('0x25')](handleEntityNotFound(_0x1919ac,null))[_0x2a78('0x25')](removeEntity(_0x1919ac,null))[_0x2a78('0x44')](handleError(_0x1919ac,null));}; \ No newline at end of file +var _0xdeb9=['type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','create','body','update','destroy','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xdeb9,0xff));var _0x9deb=function(_0x56c588,_0x5e0c42){_0x56c588=_0x56c588-0x0;var _0x4e4197=_0xdeb9[_0x56c588];return _0x4e4197;};'use strict';var emlformat=require(_0x9deb('0x0'));var rimraf=require(_0x9deb('0x1'));var zipdir=require(_0x9deb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9deb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9deb('0x4'));var util=require(_0x9deb('0x5'));var path=require('path');var sox=require(_0x9deb('0x6'));var csv=require(_0x9deb('0x7'));var ejs=require(_0x9deb('0x8'));var fs=require('fs');var fs_extra=require(_0x9deb('0x9'));var _=require('lodash');var squel=require(_0x9deb('0xa'));var crypto=require('crypto');var jsforce=require(_0x9deb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9deb('0x7'));var querystring=require(_0x9deb('0xc'));var Papa=require(_0x9deb('0xd'));var Redis=require(_0x9deb('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9deb('0xf'));var as=require(_0x9deb('0x10'));var hardwareService=require(_0x9deb('0x11'));var logger=require(_0x9deb('0x12'))(_0x9deb('0x13'));var utils=require(_0x9deb('0x14'));var config=require(_0x9deb('0x15'));var licenseUtil=require(_0x9deb('0x16'));var db=require(_0x9deb('0x17'))['db'];function respondWithStatusCode(_0x2820ad,_0x456e0b){_0x456e0b=_0x456e0b||0xcc;return function(_0x485d10){if(_0x485d10){return _0x2820ad['sendStatus'](_0x456e0b);}return _0x2820ad[_0x9deb('0x18')](_0x456e0b)[_0x9deb('0x19')]();};}function respondWithResult(_0x2c2750,_0x56b533){_0x56b533=_0x56b533||0xc8;return function(_0x53046f){if(_0x53046f){return _0x2c2750[_0x9deb('0x18')](_0x56b533)[_0x9deb('0x1a')](_0x53046f);}};}function respondWithFilteredResult(_0x358429,_0x26a95e){return function(_0xc4ae17){if(_0xc4ae17){var _0x107a2a=typeof _0x26a95e[_0x9deb('0x1b')]===_0x9deb('0x1c')&&typeof _0x26a95e[_0x9deb('0x1d')]===_0x9deb('0x1c');var _0x172317=_0xc4ae17['count'];var _0x25ec0a=_0x107a2a?0x0:_0x26a95e[_0x9deb('0x1b')];var _0x587591=_0x107a2a?_0xc4ae17[_0x9deb('0x1e')]:_0x26a95e[_0x9deb('0x1b')]+_0x26a95e['limit'];var _0x5636df;if(_0x587591>=_0x172317){_0x587591=_0x172317;_0x5636df=0xc8;}else{_0x5636df=0xce;}_0x358429[_0x9deb('0x18')](_0x5636df);return _0x358429['set'](_0x9deb('0x1f'),_0x25ec0a+'-'+_0x587591+'/'+_0x172317)['json'](_0xc4ae17);}return null;};}function patchUpdates(_0x46881d){return function(_0x5375a2){try{jsonpatch[_0x9deb('0x20')](_0x5375a2,_0x46881d,!![]);}catch(_0x4145b2){return BPromise['reject'](_0x4145b2);}return _0x5375a2[_0x9deb('0x21')]();};}function saveUpdates(_0x17f032,_0x35fd20){return function(_0x2225df){if(_0x2225df){return _0x2225df['update'](_0x17f032)[_0x9deb('0x22')](function(_0xa711eb){return _0xa711eb;});}return null;};}function removeEntity(_0x2957be,_0x263d6c){return function(_0x4fedc9){if(_0x4fedc9){return _0x4fedc9['destroy']()[_0x9deb('0x22')](function(){_0x2957be[_0x9deb('0x18')](0xcc)[_0x9deb('0x19')]();});}};}function handleEntityNotFound(_0x29822d,_0x5d0d3f){return function(_0x23e5bd){if(!_0x23e5bd){_0x29822d[_0x9deb('0x23')](0x194);}return _0x23e5bd;};}function handleError(_0x21c6f4,_0x464863){_0x464863=_0x464863||0x1f4;return function(_0x5c7d51){logger[_0x9deb('0x24')](_0x5c7d51[_0x9deb('0x25')]);if(_0x5c7d51[_0x9deb('0x26')]){delete _0x5c7d51[_0x9deb('0x26')];}_0x21c6f4[_0x9deb('0x18')](_0x464863)[_0x9deb('0x27')](_0x5c7d51);};}exports[_0x9deb('0x28')]=function(_0x5e36a5,_0xca0f96){var _0x323d14={},_0x305b57={},_0xe25936={'count':0x0,'rows':[]};var _0x15f4f3=_[_0x9deb('0x29')](db[_0x9deb('0x2a')][_0x9deb('0x2b')],function(_0x133c36){return{'name':_0x133c36[_0x9deb('0x2c')],'type':_0x133c36[_0x9deb('0x2d')][_0x9deb('0x2e')]};});_0x305b57[_0x9deb('0x2f')]=_[_0x9deb('0x29')](_0x15f4f3,_0x9deb('0x26'));_0x305b57[_0x9deb('0x30')]=_[_0x9deb('0x31')](_0x5e36a5[_0x9deb('0x30')]);_0x305b57['filters']=_[_0x9deb('0x32')](_0x305b57[_0x9deb('0x2f')],_0x305b57[_0x9deb('0x30')]);_0x323d14[_0x9deb('0x33')]=_['intersection'](_0x305b57[_0x9deb('0x2f')],qs[_0x9deb('0x34')](_0x5e36a5[_0x9deb('0x30')][_0x9deb('0x34')]));_0x323d14['attributes']=_0x323d14[_0x9deb('0x33')][_0x9deb('0x35')]?_0x323d14[_0x9deb('0x33')]:_0x305b57[_0x9deb('0x2f')];if(!_0x5e36a5[_0x9deb('0x30')]['hasOwnProperty']('nolimit')){_0x323d14[_0x9deb('0x1d')]=qs[_0x9deb('0x1d')](_0x5e36a5[_0x9deb('0x30')][_0x9deb('0x1d')]);_0x323d14['offset']=qs[_0x9deb('0x1b')](_0x5e36a5[_0x9deb('0x30')]['offset']);}_0x323d14[_0x9deb('0x36')]=qs[_0x9deb('0x37')](_0x5e36a5[_0x9deb('0x30')][_0x9deb('0x37')]);_0x323d14[_0x9deb('0x38')]=qs['filters'](_[_0x9deb('0x39')](_0x5e36a5[_0x9deb('0x30')],_0x305b57['filters']),_0x15f4f3);if(_0x5e36a5[_0x9deb('0x30')][_0x9deb('0x3a')]){_0x323d14[_0x9deb('0x38')]=_[_0x9deb('0x3b')](_0x323d14[_0x9deb('0x38')],{'$or':_[_0x9deb('0x29')](_0x15f4f3,function(_0x5da546){if(_0x5da546['type']!==_0x9deb('0x3c')){var _0x5dd9f4={};_0x5dd9f4[_0x5da546[_0x9deb('0x26')]]={'$like':'%'+_0x5e36a5['query'][_0x9deb('0x3a')]+'%'};return _0x5dd9f4;}})});}_0x323d14=_[_0x9deb('0x3b')]({},_0x323d14,_0x5e36a5[_0x9deb('0x3d')]);var _0x3f4d75={'where':_0x323d14[_0x9deb('0x38')]};return db[_0x9deb('0x2a')][_0x9deb('0x1e')](_0x3f4d75)[_0x9deb('0x22')](function(_0x475d0a){_0xe25936[_0x9deb('0x1e')]=_0x475d0a;if(_0x5e36a5[_0x9deb('0x30')][_0x9deb('0x3e')]){_0x323d14[_0x9deb('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x9deb('0x40')](_0x323d14);})[_0x9deb('0x22')](function(_0x847a55){_0xe25936[_0x9deb('0x41')]=_0x847a55;return _0xe25936;})[_0x9deb('0x22')](respondWithFilteredResult(_0xca0f96,_0x323d14))[_0x9deb('0x42')](handleError(_0xca0f96,null));};exports[_0x9deb('0x43')]=function(_0x2e7ae8,_0xa32f9a){var _0x599f48={'raw':!![],'where':{'id':_0x2e7ae8[_0x9deb('0x44')]['id']}},_0x5d9c81={};_0x5d9c81[_0x9deb('0x2f')]=_['keys'](db[_0x9deb('0x2a')][_0x9deb('0x2b')]);_0x5d9c81[_0x9deb('0x30')]=_[_0x9deb('0x31')](_0x2e7ae8['query']);_0x5d9c81[_0x9deb('0x45')]=_[_0x9deb('0x32')](_0x5d9c81[_0x9deb('0x2f')],_0x5d9c81[_0x9deb('0x30')]);_0x599f48[_0x9deb('0x33')]=_[_0x9deb('0x32')](_0x5d9c81[_0x9deb('0x2f')],qs['fields'](_0x2e7ae8[_0x9deb('0x30')][_0x9deb('0x34')]));_0x599f48[_0x9deb('0x33')]=_0x599f48['attributes'][_0x9deb('0x35')]?_0x599f48[_0x9deb('0x33')]:_0x5d9c81['model'];if(_0x2e7ae8['query']['includeAll']){_0x599f48[_0x9deb('0x3f')]=[{'all':!![]}];}_0x599f48=_['merge']({},_0x599f48,_0x2e7ae8[_0x9deb('0x3d')]);return db[_0x9deb('0x2a')]['find'](_0x599f48)['then'](handleEntityNotFound(_0xa32f9a,null))[_0x9deb('0x22')](respondWithResult(_0xa32f9a,null))[_0x9deb('0x42')](handleError(_0xa32f9a,null));};exports[_0x9deb('0x46')]=function(_0x3dde3d,_0x4f73cc){return db['AnalyticTreeReport'][_0x9deb('0x46')](_0x3dde3d[_0x9deb('0x47')],{})[_0x9deb('0x22')](respondWithResult(_0x4f73cc,0xc9))['catch'](handleError(_0x4f73cc,null));};exports[_0x9deb('0x48')]=function(_0x7b0683,_0x21586a){if(_0x7b0683[_0x9deb('0x47')]['id']){delete _0x7b0683[_0x9deb('0x47')]['id'];}return db[_0x9deb('0x2a')]['find']({'where':{'id':_0x7b0683[_0x9deb('0x44')]['id']}})[_0x9deb('0x22')](handleEntityNotFound(_0x21586a,null))[_0x9deb('0x22')](saveUpdates(_0x7b0683[_0x9deb('0x47')],null))[_0x9deb('0x22')](respondWithResult(_0x21586a,null))[_0x9deb('0x42')](handleError(_0x21586a,null));};exports[_0x9deb('0x49')]=function(_0x332a66,_0x285c5d){return db[_0x9deb('0x2a')][_0x9deb('0x4a')]({'where':{'id':_0x332a66['params']['id']}})[_0x9deb('0x22')](handleEntityNotFound(_0x285c5d,null))[_0x9deb('0x22')](removeEntity(_0x285c5d,null))['catch'](handleError(_0x285c5d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8b6a3ea..1650bc8 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 _0x7a1a=['request-promise','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','util','../../config/logger','api','moment','bluebird'];(function(_0x2f42f7,_0x3729a9){var _0x2dfc2f=function(_0x2c6aa4){while(--_0x2c6aa4){_0x2f42f7['push'](_0x2f42f7['shift']());}};_0x2dfc2f(++_0x3729a9);}(_0x7a1a,0x187));var _0xa7a1=function(_0x324aa5,_0x126018){_0x324aa5=_0x324aa5-0x0;var _0x3cfee8=_0x7a1a[_0x324aa5];return _0x3cfee8;};'use strict';var _=require('lodash');var util=require(_0xa7a1('0x0'));var logger=require(_0xa7a1('0x1'))(_0xa7a1('0x2'));var moment=require(_0xa7a1('0x3'));var BPromise=require(_0xa7a1('0x4'));var rp=require(_0xa7a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa7a1('0x6'));var attributes=require(_0xa7a1('0x7'));module[_0xa7a1('0x8')]=function(_0x58dbf4,_0x2d368f){return _0x58dbf4[_0xa7a1('0x9')](_0xa7a1('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1675=['./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0x1675,0x1b4));var _0x5167=function(_0x5d1a4f,_0xb1e7ae){_0x5d1a4f=_0x5d1a4f-0x0;var _0x1d4e1e=_0x1675[_0x5d1a4f];return _0x1d4e1e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5167('0x0'))(_0x5167('0x1'));var moment=require(_0x5167('0x2'));var BPromise=require('bluebird');var rp=require(_0x5167('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5167('0x4'));var config=require('../../config/environment');var attributes=require(_0x5167('0x5'));module[_0x5167('0x6')]=function(_0x221573,_0xa7160f){return _0x221573['define'](_0x5167('0x7'),attributes,{'tableName':_0x5167('0x8'),'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 dc08c85..81b3a62 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x545d36,_0x45c4b1){var _0x53b683=function(_0x211f84){while(--_0x211f84){_0x545d36['push'](_0x545d36['shift']());}};_0x53b683(++_0x45c4b1);}(_0x2ef3,0xba));var _0x32ef=function(_0xcd16a,_0x27f049){_0xcd16a=_0xcd16a-0x0;var _0x217268=_0x2ef3[_0xcd16a];return _0x217268;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x495630,_0x44449a){var _0x3da3ff=function(_0x133d91){while(--_0x133d91){_0x495630['push'](_0x495630['shift']());}};_0x3da3ff(++_0x44449a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f23dce9..4f7bdd2 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 _0x6ccf=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','post','create','put'];(function(_0x569d04,_0x40fbf7){var _0x505cf2=function(_0x54453f){while(--_0x54453f){_0x569d04['push'](_0x569d04['shift']());}};_0x505cf2(++_0x40fbf7);}(_0x6ccf,0x158));var _0xf6cc=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x6ccf[_0x5d30b4];return _0x1acfb8;};'use strict';var multer=require(_0xf6cc('0x0'));var util=require(_0xf6cc('0x1'));var path=require(_0xf6cc('0x2'));var timeout=require(_0xf6cc('0x3'));var express=require(_0xf6cc('0x4'));var router=express['Router']();var fs_extra=require(_0xf6cc('0x5'));var auth=require(_0xf6cc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf6cc('0x7'));var controller=require(_0xf6cc('0x8'));router[_0xf6cc('0x9')]('/',auth['isAuthenticated'](),controller[_0xf6cc('0xa')]);router[_0xf6cc('0x9')](_0xf6cc('0xb'),auth[_0xf6cc('0xc')](),controller['show']);router[_0xf6cc('0xd')]('/',auth[_0xf6cc('0xc')](),controller[_0xf6cc('0xe')]);router[_0xf6cc('0xf')](_0xf6cc('0xb'),auth[_0xf6cc('0xc')](),controller[_0xf6cc('0x10')]);router[_0xf6cc('0x11')](_0xf6cc('0xb'),auth[_0xf6cc('0xc')](),controller[_0xf6cc('0x12')]);module[_0xf6cc('0x13')]=router; \ No newline at end of file +var _0x52a5=['post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','get','/:id','show'];(function(_0x2f69f2,_0x3a156d){var _0x25040e=function(_0x568814){while(--_0x568814){_0x2f69f2['push'](_0x2f69f2['shift']());}};_0x25040e(++_0x3a156d);}(_0x52a5,0x1f1));var _0x552a=function(_0x4baa90,_0x5f375f){_0x4baa90=_0x4baa90-0x0;var _0x535a79=_0x52a5[_0x4baa90];return _0x535a79;};'use strict';var multer=require(_0x552a('0x0'));var util=require('util');var path=require(_0x552a('0x1'));var timeout=require(_0x552a('0x2'));var express=require(_0x552a('0x3'));var router=express[_0x552a('0x4')]();var fs_extra=require(_0x552a('0x5'));var auth=require(_0x552a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x552a('0x7'));var controller=require(_0x552a('0x8'));router['get']('/',auth[_0x552a('0x9')](),controller['index']);router[_0x552a('0xa')](_0x552a('0xb'),auth[_0x552a('0x9')](),controller[_0x552a('0xc')]);router[_0x552a('0xd')]('/',auth[_0x552a('0x9')](),controller[_0x552a('0xe')]);router['put'](_0x552a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x552a('0xf')](_0x552a('0xb'),auth[_0x552a('0x9')](),controller[_0x552a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 7ff96a0..d4a5119 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 _0xa588=['STRING','exports'];(function(_0xfa417e,_0x5b8199){var _0x536ae1=function(_0x5d1cf5){while(--_0x5d1cf5){_0xfa417e['push'](_0xfa417e['shift']());}};_0x536ae1(++_0x5b8199);}(_0xa588,0xe1));var _0x8a58=function(_0x2f1787,_0x321733){_0x2f1787=_0x2f1787-0x0;var _0x50c4c2=_0xa588[_0x2f1787];return _0x50c4c2;};'use strict';var Sequelize=require('sequelize');module[_0x8a58('0x0')]={'name':{'type':Sequelize[_0x8a58('0x1')]},'basename':{'type':Sequelize[_0x8a58('0x1')]},'type':{'type':Sequelize[_0x8a58('0x1')]}}; \ No newline at end of file +var _0x41f2=['exports','STRING','sequelize'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x41f2,0x14f));var _0x241f=function(_0x19a0c8,_0x32f30e){_0x19a0c8=_0x19a0c8-0x0;var _0x1e777b=_0x41f2[_0x19a0c8];return _0x1e777b;};'use strict';var Sequelize=require(_0x241f('0x0'));module[_0x241f('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x241f('0x2')]},'type':{'type':Sequelize[_0x241f('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 89cee12..826b5f6 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 _0x0a4b=['merge','VIRTUAL','options','Attachment','rows','catch','includeAll','include','find','clone','params','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','mimetype','ChatOfflineMessageId','root','server/files/attachments/','join','download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter'];(function(_0xa5e793,_0x4ab9b3){var _0x3e9490=function(_0x183c7b){while(--_0x183c7b){_0xa5e793['push'](_0xa5e793['shift']());}};_0x3e9490(++_0x4ab9b3);}(_0x0a4b,0x129));var _0xb0a4=function(_0x2e26fb,_0x31bf41){_0x2e26fb=_0x2e26fb-0x0;var _0x19978d=_0x0a4b[_0x2e26fb];return _0x19978d;};'use strict';var emlformat=require(_0xb0a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb0a4('0x1'));var rp=require(_0xb0a4('0x2'));var moment=require(_0xb0a4('0x3'));var BPromise=require(_0xb0a4('0x4'));var Mustache=require(_0xb0a4('0x5'));var util=require(_0xb0a4('0x6'));var path=require(_0xb0a4('0x7'));var sox=require('sox');var csv=require(_0xb0a4('0x8'));var ejs=require(_0xb0a4('0x9'));var fs=require('fs');var fs_extra=require(_0xb0a4('0xa'));var _=require(_0xb0a4('0xb'));var squel=require(_0xb0a4('0xc'));var crypto=require('crypto');var jsforce=require(_0xb0a4('0xd'));var deskjs=require(_0xb0a4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb0a4('0xf'));var Papa=require(_0xb0a4('0x10'));var Redis=require(_0xb0a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb0a4('0x12'));var as=require(_0xb0a4('0x13'));var hardwareService=require(_0xb0a4('0x14'));var logger=require(_0xb0a4('0x15'))(_0xb0a4('0x16'));var utils=require(_0xb0a4('0x17'));var config=require(_0xb0a4('0x18'));var licenseUtil=require(_0xb0a4('0x19'));var db=require(_0xb0a4('0x1a'))['db'];function respondWithStatusCode(_0x5a605e,_0xdf3368){_0xdf3368=_0xdf3368||0xcc;return function(_0x54a648){if(_0x54a648){return _0x5a605e[_0xb0a4('0x1b')](_0xdf3368);}return _0x5a605e[_0xb0a4('0x1c')](_0xdf3368)[_0xb0a4('0x1d')]();};}function respondWithResult(_0x40932e,_0x522f3d){_0x522f3d=_0x522f3d||0xc8;return function(_0x33f1b9){if(_0x33f1b9){return _0x40932e['status'](_0x522f3d)[_0xb0a4('0x1e')](_0x33f1b9);}};}function respondWithFilteredResult(_0x4a183a,_0x2aa9c9){return function(_0x385fe5){if(_0x385fe5){var _0x15ceee=typeof _0x2aa9c9[_0xb0a4('0x1f')]==='undefined'&&typeof _0x2aa9c9['limit']==='undefined';var _0x50147e=_0x385fe5[_0xb0a4('0x20')];var _0x46bd79=_0x15ceee?0x0:_0x2aa9c9[_0xb0a4('0x1f')];var _0x1b0cb7=_0x15ceee?_0x385fe5[_0xb0a4('0x20')]:_0x2aa9c9['offset']+_0x2aa9c9[_0xb0a4('0x21')];var _0x1dac36;if(_0x1b0cb7>=_0x50147e){_0x1b0cb7=_0x50147e;_0x1dac36=0xc8;}else{_0x1dac36=0xce;}_0x4a183a['status'](_0x1dac36);return _0x4a183a['set'](_0xb0a4('0x22'),_0x46bd79+'-'+_0x1b0cb7+'/'+_0x50147e)['json'](_0x385fe5);}return null;};}function patchUpdates(_0x1b2620){return function(_0x2fb12d){try{jsonpatch[_0xb0a4('0x23')](_0x2fb12d,_0x1b2620,!![]);}catch(_0x589099){return BPromise[_0xb0a4('0x24')](_0x589099);}return _0x2fb12d[_0xb0a4('0x25')]();};}function saveUpdates(_0x87f3b8,_0x2e30aa){return function(_0xdef65a){if(_0xdef65a){return _0xdef65a[_0xb0a4('0x26')](_0x87f3b8)[_0xb0a4('0x27')](function(_0x309fcd){return _0x309fcd;});}return null;};}function removeEntity(_0x36f6b8,_0x3d90f1){return function(_0x85291c){if(_0x85291c){return _0x85291c[_0xb0a4('0x28')]()[_0xb0a4('0x27')](function(){_0x36f6b8[_0xb0a4('0x1c')](0xcc)[_0xb0a4('0x1d')]();});}};}function handleEntityNotFound(_0x1d5b7f,_0x1675b2){return function(_0x4d0afe){if(!_0x4d0afe){_0x1d5b7f[_0xb0a4('0x1b')](0x194);}return _0x4d0afe;};}function handleError(_0x577d2b,_0x381eac){_0x381eac=_0x381eac||0x1f4;return function(_0x11f178){logger[_0xb0a4('0x29')](_0x11f178[_0xb0a4('0x2a')]);if(_0x11f178[_0xb0a4('0x2b')]){delete _0x11f178[_0xb0a4('0x2b')];}_0x577d2b[_0xb0a4('0x1c')](_0x381eac)[_0xb0a4('0x2c')](_0x11f178);};}exports[_0xb0a4('0x2d')]=function(_0x425347,_0x112a05){var _0x178511={},_0x80e3b7={},_0x4b8b36={'count':0x0,'rows':[]};var _0x4634ba=_['map'](db['Attachment'][_0xb0a4('0x2e')],function(_0x388e4d){return{'name':_0x388e4d[_0xb0a4('0x2f')],'type':_0x388e4d[_0xb0a4('0x30')]['key']};});_0x80e3b7[_0xb0a4('0x31')]=_[_0xb0a4('0x32')](_0x4634ba,_0xb0a4('0x2b'));_0x80e3b7['query']=_[_0xb0a4('0x33')](_0x425347[_0xb0a4('0x34')]);_0x80e3b7[_0xb0a4('0x35')]=_[_0xb0a4('0x36')](_0x80e3b7[_0xb0a4('0x31')],_0x80e3b7[_0xb0a4('0x34')]);_0x178511[_0xb0a4('0x37')]=_['intersection'](_0x80e3b7[_0xb0a4('0x31')],qs[_0xb0a4('0x38')](_0x425347[_0xb0a4('0x34')][_0xb0a4('0x38')]));_0x178511['attributes']=_0x178511[_0xb0a4('0x37')][_0xb0a4('0x39')]?_0x178511[_0xb0a4('0x37')]:_0x80e3b7[_0xb0a4('0x31')];if(!_0x425347['query'][_0xb0a4('0x3a')]('nolimit')){_0x178511[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x425347[_0xb0a4('0x34')][_0xb0a4('0x21')]);_0x178511[_0xb0a4('0x1f')]=qs['offset'](_0x425347['query'][_0xb0a4('0x1f')]);}_0x178511['order']=qs[_0xb0a4('0x3b')](_0x425347['query'][_0xb0a4('0x3b')]);_0x178511[_0xb0a4('0x3c')]=qs[_0xb0a4('0x35')](_[_0xb0a4('0x3d')](_0x425347[_0xb0a4('0x34')],_0x80e3b7[_0xb0a4('0x35')]),_0x4634ba);if(_0x425347['query'][_0xb0a4('0x3e')]){_0x178511[_0xb0a4('0x3c')]=_[_0xb0a4('0x3f')](_0x178511[_0xb0a4('0x3c')],{'$or':_['map'](_0x4634ba,function(_0x4bd2bf){if(_0x4bd2bf[_0xb0a4('0x30')]!==_0xb0a4('0x40')){var _0x51c0da={};_0x51c0da[_0x4bd2bf[_0xb0a4('0x2b')]]={'$like':'%'+_0x425347[_0xb0a4('0x34')][_0xb0a4('0x3e')]+'%'};return _0x51c0da;}})});}_0x178511=_['merge']({},_0x178511,_0x425347[_0xb0a4('0x41')]);var _0x1545d7={'where':_0x178511[_0xb0a4('0x3c')]};return db[_0xb0a4('0x42')][_0xb0a4('0x20')](_0x1545d7)[_0xb0a4('0x27')](function(_0x9c1fbe){_0x4b8b36[_0xb0a4('0x20')]=_0x9c1fbe;if(_0x425347['query']['includeAll']){_0x178511['include']=[{'all':!![]}];}return db[_0xb0a4('0x42')]['findAll'](_0x178511);})['then'](function(_0x512d82){_0x4b8b36[_0xb0a4('0x43')]=_0x512d82;return _0x4b8b36;})['then'](respondWithFilteredResult(_0x112a05,_0x178511))[_0xb0a4('0x44')](handleError(_0x112a05,null));};exports['show']=function(_0x2c3e93,_0x356f7f){var _0x308a26={'raw':!![],'where':{'id':_0x2c3e93['params']['id']}},_0x22b88a={};_0x22b88a['model']=_['keys'](db[_0xb0a4('0x42')][_0xb0a4('0x2e')]);_0x22b88a[_0xb0a4('0x34')]=_[_0xb0a4('0x33')](_0x2c3e93[_0xb0a4('0x34')]);_0x22b88a['filters']=_[_0xb0a4('0x36')](_0x22b88a[_0xb0a4('0x31')],_0x22b88a[_0xb0a4('0x34')]);_0x308a26[_0xb0a4('0x37')]=_[_0xb0a4('0x36')](_0x22b88a[_0xb0a4('0x31')],qs[_0xb0a4('0x38')](_0x2c3e93[_0xb0a4('0x34')][_0xb0a4('0x38')]));_0x308a26[_0xb0a4('0x37')]=_0x308a26[_0xb0a4('0x37')][_0xb0a4('0x39')]?_0x308a26[_0xb0a4('0x37')]:_0x22b88a[_0xb0a4('0x31')];if(_0x2c3e93[_0xb0a4('0x34')][_0xb0a4('0x45')]){_0x308a26[_0xb0a4('0x46')]=[{'all':!![]}];}_0x308a26=_[_0xb0a4('0x3f')]({},_0x308a26,_0x2c3e93[_0xb0a4('0x41')]);return db['Attachment'][_0xb0a4('0x47')](_0x308a26)[_0xb0a4('0x27')](handleEntityNotFound(_0x356f7f,null))[_0xb0a4('0x27')](respondWithResult(_0x356f7f,null))[_0xb0a4('0x44')](handleError(_0x356f7f,null));};exports[_0xb0a4('0x48')]=function(_0x1212f4,_0x2112d8){var _0x14357e={'where':{'id':_0x1212f4[_0xb0a4('0x49')]['id']}},_0x668623={};_0x668623[_0xb0a4('0x31')]=_[_0xb0a4('0x33')](db[_0xb0a4('0x42')][_0xb0a4('0x2e')]);_0x14357e[_0xb0a4('0x37')]=_[_0xb0a4('0x36')](_0x668623[_0xb0a4('0x31')],qs['fields'](_0x1212f4[_0xb0a4('0x34')][_0xb0a4('0x38')]));_0x14357e[_0xb0a4('0x37')]=_0x14357e['attributes'][_0xb0a4('0x39')]?_0x14357e[_0xb0a4('0x37')]:_0x668623[_0xb0a4('0x31')];if(_0x1212f4[_0xb0a4('0x34')]['includeAll']){_0x14357e['include']=[{'all':!![]}];}_0x14357e=_[_0xb0a4('0x3f')]({},_0x14357e,_0x1212f4['options']);return db['Attachment'][_0xb0a4('0x47')](_0x14357e)[_0xb0a4('0x27')](handleEntityNotFound(_0x2112d8,null))[_0xb0a4('0x27')](function(_0x36939e){if(_0x36939e){var _0x3c7b78=_0x36939e[_0xb0a4('0x4a')]({'plain':!![]});_0x3c7b78=qs['omit'](_0x3c7b78,['id',_0xb0a4('0x4b'),_0xb0a4('0x4c')]);_0x1212f4[_0xb0a4('0x4d')]=_[_0xb0a4('0x4e')](_0x1212f4[_0xb0a4('0x4d')],['id','createdAt',_0xb0a4('0x4c')]);return db[_0xb0a4('0x42')][_0xb0a4('0x4f')](_[_0xb0a4('0x3f')](_0x3c7b78,_0x1212f4[_0xb0a4('0x4d')]),{'include':_0x1212f4[_0xb0a4('0x34')][_0xb0a4('0x45')]?[{'all':!![]}]:undefined});}})[_0xb0a4('0x27')](respondWithResult(_0x2112d8,0xc9))[_0xb0a4('0x44')](handleError(_0x2112d8,null));};exports[_0xb0a4('0x26')]=function(_0x44e0be,_0x39dd14){if(_0x44e0be[_0xb0a4('0x4d')]['id']){delete _0x44e0be[_0xb0a4('0x4d')]['id'];}return db[_0xb0a4('0x42')]['find']({'where':{'id':_0x44e0be[_0xb0a4('0x49')]['id']}})[_0xb0a4('0x27')](handleEntityNotFound(_0x39dd14,null))[_0xb0a4('0x27')](saveUpdates(_0x44e0be[_0xb0a4('0x4d')],null))[_0xb0a4('0x27')](respondWithResult(_0x39dd14,null))[_0xb0a4('0x44')](handleError(_0x39dd14,null));};exports['destroy']=function(_0x3f5a55,_0x419543){return db[_0xb0a4('0x42')][_0xb0a4('0x47')]({'where':{'id':_0x3f5a55['params']['id']}})[_0xb0a4('0x27')](handleEntityNotFound(_0x419543,null))[_0xb0a4('0x27')](removeEntity(_0x419543,null))[_0xb0a4('0x44')](handleError(_0x419543,null));};exports['create']=function(_0x20c137,_0x42a52d,_0x5d8cb4){_0x20c137[_0xb0a4('0x4d')][_0xb0a4('0x2b')]=_0x20c137[_0xb0a4('0x50')][_0xb0a4('0x51')];_0x20c137[_0xb0a4('0x4d')][_0xb0a4('0x52')]=_0x20c137[_0xb0a4('0x50')][_0xb0a4('0x53')];_0x20c137[_0xb0a4('0x4d')][_0xb0a4('0x30')]=_0x20c137[_0xb0a4('0x50')][_0xb0a4('0x54')];return db[_0xb0a4('0x42')][_0xb0a4('0x4f')](_0x20c137['body'])[_0xb0a4('0x27')](respondWithResult(_0x42a52d,0xc9))[_0xb0a4('0x44')](handleError(_0x42a52d,null));};exports['download']=function(_0x55d7c8,_0x5d2081,_0x41146d){return db[_0xb0a4('0x42')]['findOne']({'where':{'id':_0x55d7c8['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5d2081,null))[_0xb0a4('0x27')](function(_0x279c65){if(_0x279c65){var _0x412be6=_0x279c65[_0xb0a4('0x55')]!==null;var _0x354cbf=path['join'](config[_0xb0a4('0x56')],_0xb0a4('0x57'));if(_0x412be6){_0x354cbf=path[_0xb0a4('0x58')](_0x354cbf,'offline-chat/');}var _0x4b9def=path[_0xb0a4('0x58')](_0x354cbf,_0x279c65[_0xb0a4('0x52')]);return _0x5d2081[_0xb0a4('0x59')](_0x4b9def);}})['catch'](handleError(_0x5d2081,null));}; \ No newline at end of file +var _0x9164=['root','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Attachment','then','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','clone','get','omit','createdAt','updatedAt','body','create','destroy','originalname','basename','file','mimetype','download','findOne','ChatOfflineMessageId','join'];(function(_0x288c2e,_0x557fb8){var _0x21a83c=function(_0x13ba82){while(--_0x13ba82){_0x288c2e['push'](_0x288c2e['shift']());}};_0x21a83c(++_0x557fb8);}(_0x9164,0x175));var _0x4916=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9164[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4916('0x0'));var rimraf=require(_0x4916('0x1'));var zipdir=require(_0x4916('0x2'));var jsonpatch=require(_0x4916('0x3'));var rp=require('request-promise');var moment=require(_0x4916('0x4'));var BPromise=require(_0x4916('0x5'));var Mustache=require(_0x4916('0x6'));var util=require(_0x4916('0x7'));var path=require(_0x4916('0x8'));var sox=require(_0x4916('0x9'));var csv=require('to-csv');var ejs=require(_0x4916('0xa'));var fs=require('fs');var fs_extra=require(_0x4916('0xb'));var _=require(_0x4916('0xc'));var squel=require(_0x4916('0xd'));var crypto=require(_0x4916('0xe'));var jsforce=require(_0x4916('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4916('0x10'));var querystring=require(_0x4916('0x11'));var Papa=require(_0x4916('0x12'));var Redis=require(_0x4916('0x13'));var authService=require(_0x4916('0x14'));var qs=require(_0x4916('0x15'));var as=require(_0x4916('0x16'));var hardwareService=require(_0x4916('0x17'));var logger=require(_0x4916('0x18'))(_0x4916('0x19'));var utils=require('../../config/utils');var config=require(_0x4916('0x1a'));var licenseUtil=require(_0x4916('0x1b'));var db=require(_0x4916('0x1c'))['db'];function respondWithStatusCode(_0x3f0fee,_0x504407){_0x504407=_0x504407||0xcc;return function(_0x51fa59){if(_0x51fa59){return _0x3f0fee[_0x4916('0x1d')](_0x504407);}return _0x3f0fee[_0x4916('0x1e')](_0x504407)['end']();};}function respondWithResult(_0x1ec15f,_0x3e3098){_0x3e3098=_0x3e3098||0xc8;return function(_0x5d6bd0){if(_0x5d6bd0){return _0x1ec15f[_0x4916('0x1e')](_0x3e3098)[_0x4916('0x1f')](_0x5d6bd0);}};}function respondWithFilteredResult(_0x3c6d08,_0x8b1d02){return function(_0x54f136){if(_0x54f136){var _0x3d5d0a=typeof _0x8b1d02['offset']===_0x4916('0x20')&&typeof _0x8b1d02[_0x4916('0x21')]===_0x4916('0x20');var _0xfdb1ee=_0x54f136['count'];var _0x538909=_0x3d5d0a?0x0:_0x8b1d02['offset'];var _0x459ccc=_0x3d5d0a?_0x54f136[_0x4916('0x22')]:_0x8b1d02[_0x4916('0x23')]+_0x8b1d02[_0x4916('0x21')];var _0x523ff7;if(_0x459ccc>=_0xfdb1ee){_0x459ccc=_0xfdb1ee;_0x523ff7=0xc8;}else{_0x523ff7=0xce;}_0x3c6d08['status'](_0x523ff7);return _0x3c6d08['set']('Content-Range',_0x538909+'-'+_0x459ccc+'/'+_0xfdb1ee)['json'](_0x54f136);}return null;};}function patchUpdates(_0x2640cb){return function(_0x5e43b5){try{jsonpatch[_0x4916('0x24')](_0x5e43b5,_0x2640cb,!![]);}catch(_0x5f0498){return BPromise[_0x4916('0x25')](_0x5f0498);}return _0x5e43b5[_0x4916('0x26')]();};}function saveUpdates(_0x3e5cea,_0x480b22){return function(_0x373a6a){if(_0x373a6a){return _0x373a6a[_0x4916('0x27')](_0x3e5cea)['then'](function(_0x3c9477){return _0x3c9477;});}return null;};}function removeEntity(_0x47491f,_0x55b6e3){return function(_0x1c741f){if(_0x1c741f){return _0x1c741f['destroy']()['then'](function(){_0x47491f[_0x4916('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c84f,_0x4a2253){return function(_0x555512){if(!_0x555512){_0x51c84f[_0x4916('0x1d')](0x194);}return _0x555512;};}function handleError(_0x41f307,_0x40a564){_0x40a564=_0x40a564||0x1f4;return function(_0x3a0d9c){logger['error'](_0x3a0d9c[_0x4916('0x28')]);if(_0x3a0d9c['name']){delete _0x3a0d9c[_0x4916('0x29')];}_0x41f307['status'](_0x40a564)[_0x4916('0x2a')](_0x3a0d9c);};}exports[_0x4916('0x2b')]=function(_0x3cee22,_0x3a94ff){var _0x4500e9={},_0x3d740f={},_0x58e264={'count':0x0,'rows':[]};var _0x3db907=_[_0x4916('0x2c')](db['Attachment']['rawAttributes'],function(_0x2537a9){return{'name':_0x2537a9[_0x4916('0x2d')],'type':_0x2537a9[_0x4916('0x2e')][_0x4916('0x2f')]};});_0x3d740f[_0x4916('0x30')]=_[_0x4916('0x2c')](_0x3db907,_0x4916('0x29'));_0x3d740f['query']=_[_0x4916('0x31')](_0x3cee22[_0x4916('0x32')]);_0x3d740f[_0x4916('0x33')]=_['intersection'](_0x3d740f[_0x4916('0x30')],_0x3d740f[_0x4916('0x32')]);_0x4500e9[_0x4916('0x34')]=_[_0x4916('0x35')](_0x3d740f[_0x4916('0x30')],qs[_0x4916('0x36')](_0x3cee22[_0x4916('0x32')][_0x4916('0x36')]));_0x4500e9['attributes']=_0x4500e9[_0x4916('0x34')][_0x4916('0x37')]?_0x4500e9[_0x4916('0x34')]:_0x3d740f[_0x4916('0x30')];if(!_0x3cee22[_0x4916('0x32')][_0x4916('0x38')](_0x4916('0x39'))){_0x4500e9[_0x4916('0x21')]=qs[_0x4916('0x21')](_0x3cee22['query']['limit']);_0x4500e9['offset']=qs['offset'](_0x3cee22[_0x4916('0x32')]['offset']);}_0x4500e9[_0x4916('0x3a')]=qs[_0x4916('0x3b')](_0x3cee22['query']['sort']);_0x4500e9[_0x4916('0x3c')]=qs[_0x4916('0x33')](_[_0x4916('0x3d')](_0x3cee22[_0x4916('0x32')],_0x3d740f[_0x4916('0x33')]),_0x3db907);if(_0x3cee22[_0x4916('0x32')][_0x4916('0x3e')]){_0x4500e9[_0x4916('0x3c')]=_[_0x4916('0x3f')](_0x4500e9[_0x4916('0x3c')],{'$or':_[_0x4916('0x2c')](_0x3db907,function(_0x397a30){if(_0x397a30[_0x4916('0x2e')]!=='VIRTUAL'){var _0x4c2977={};_0x4c2977[_0x397a30[_0x4916('0x29')]]={'$like':'%'+_0x3cee22[_0x4916('0x32')][_0x4916('0x3e')]+'%'};return _0x4c2977;}})});}_0x4500e9=_[_0x4916('0x3f')]({},_0x4500e9,_0x3cee22[_0x4916('0x40')]);var _0x5e2332={'where':_0x4500e9[_0x4916('0x3c')]};return db[_0x4916('0x41')][_0x4916('0x22')](_0x5e2332)[_0x4916('0x42')](function(_0x1fdc6e){_0x58e264['count']=_0x1fdc6e;if(_0x3cee22['query'][_0x4916('0x43')]){_0x4500e9['include']=[{'all':!![]}];}return db[_0x4916('0x41')][_0x4916('0x44')](_0x4500e9);})[_0x4916('0x42')](function(_0x2d2a22){_0x58e264[_0x4916('0x45')]=_0x2d2a22;return _0x58e264;})['then'](respondWithFilteredResult(_0x3a94ff,_0x4500e9))[_0x4916('0x46')](handleError(_0x3a94ff,null));};exports[_0x4916('0x47')]=function(_0x55acc0,_0x269c5b){var _0x6ab80d={'raw':!![],'where':{'id':_0x55acc0[_0x4916('0x48')]['id']}},_0x171039={};_0x171039[_0x4916('0x30')]=_['keys'](db[_0x4916('0x41')][_0x4916('0x49')]);_0x171039[_0x4916('0x32')]=_[_0x4916('0x31')](_0x55acc0[_0x4916('0x32')]);_0x171039[_0x4916('0x33')]=_[_0x4916('0x35')](_0x171039[_0x4916('0x30')],_0x171039['query']);_0x6ab80d[_0x4916('0x34')]=_[_0x4916('0x35')](_0x171039['model'],qs[_0x4916('0x36')](_0x55acc0[_0x4916('0x32')][_0x4916('0x36')]));_0x6ab80d[_0x4916('0x34')]=_0x6ab80d[_0x4916('0x34')]['length']?_0x6ab80d[_0x4916('0x34')]:_0x171039['model'];if(_0x55acc0[_0x4916('0x32')][_0x4916('0x43')]){_0x6ab80d[_0x4916('0x4a')]=[{'all':!![]}];}_0x6ab80d=_[_0x4916('0x3f')]({},_0x6ab80d,_0x55acc0['options']);return db[_0x4916('0x41')][_0x4916('0x4b')](_0x6ab80d)[_0x4916('0x42')](handleEntityNotFound(_0x269c5b,null))[_0x4916('0x42')](respondWithResult(_0x269c5b,null))[_0x4916('0x46')](handleError(_0x269c5b,null));};exports[_0x4916('0x4c')]=function(_0x5e0710,_0x6b576c){var _0x5a75a2={'where':{'id':_0x5e0710[_0x4916('0x48')]['id']}},_0x35699d={};_0x35699d[_0x4916('0x30')]=_[_0x4916('0x31')](db[_0x4916('0x41')][_0x4916('0x49')]);_0x5a75a2[_0x4916('0x34')]=_[_0x4916('0x35')](_0x35699d['model'],qs[_0x4916('0x36')](_0x5e0710['query'][_0x4916('0x36')]));_0x5a75a2[_0x4916('0x34')]=_0x5a75a2[_0x4916('0x34')]['length']?_0x5a75a2[_0x4916('0x34')]:_0x35699d[_0x4916('0x30')];if(_0x5e0710['query'][_0x4916('0x43')]){_0x5a75a2[_0x4916('0x4a')]=[{'all':!![]}];}_0x5a75a2=_[_0x4916('0x3f')]({},_0x5a75a2,_0x5e0710[_0x4916('0x40')]);return db[_0x4916('0x41')][_0x4916('0x4b')](_0x5a75a2)[_0x4916('0x42')](handleEntityNotFound(_0x6b576c,null))[_0x4916('0x42')](function(_0x10b202){if(_0x10b202){var _0x4940fe=_0x10b202[_0x4916('0x4d')]({'plain':!![]});_0x4940fe=qs[_0x4916('0x4e')](_0x4940fe,['id',_0x4916('0x4f'),_0x4916('0x50')]);_0x5e0710[_0x4916('0x51')]=_['omit'](_0x5e0710[_0x4916('0x51')],['id',_0x4916('0x4f'),'updatedAt']);return db['Attachment'][_0x4916('0x52')](_[_0x4916('0x3f')](_0x4940fe,_0x5e0710[_0x4916('0x51')]),{'include':_0x5e0710[_0x4916('0x32')][_0x4916('0x43')]?[{'all':!![]}]:undefined});}})[_0x4916('0x42')](respondWithResult(_0x6b576c,0xc9))[_0x4916('0x46')](handleError(_0x6b576c,null));};exports[_0x4916('0x27')]=function(_0x3e45a9,_0x1104a3){if(_0x3e45a9['body']['id']){delete _0x3e45a9[_0x4916('0x51')]['id'];}return db[_0x4916('0x41')]['find']({'where':{'id':_0x3e45a9[_0x4916('0x48')]['id']}})[_0x4916('0x42')](handleEntityNotFound(_0x1104a3,null))['then'](saveUpdates(_0x3e45a9[_0x4916('0x51')],null))['then'](respondWithResult(_0x1104a3,null))[_0x4916('0x46')](handleError(_0x1104a3,null));};exports[_0x4916('0x53')]=function(_0x36269b,_0x43999a){return db[_0x4916('0x41')][_0x4916('0x4b')]({'where':{'id':_0x36269b['params']['id']}})[_0x4916('0x42')](handleEntityNotFound(_0x43999a,null))[_0x4916('0x42')](removeEntity(_0x43999a,null))[_0x4916('0x46')](handleError(_0x43999a,null));};exports[_0x4916('0x52')]=function(_0x333a6c,_0x50226f,_0x1df093){_0x333a6c[_0x4916('0x51')][_0x4916('0x29')]=_0x333a6c['file'][_0x4916('0x54')];_0x333a6c['body'][_0x4916('0x55')]=_0x333a6c[_0x4916('0x56')]['filename'];_0x333a6c[_0x4916('0x51')][_0x4916('0x2e')]=_0x333a6c[_0x4916('0x56')][_0x4916('0x57')];return db['Attachment']['create'](_0x333a6c['body'])[_0x4916('0x42')](respondWithResult(_0x50226f,0xc9))[_0x4916('0x46')](handleError(_0x50226f,null));};exports[_0x4916('0x58')]=function(_0x10c150,_0x4a2793,_0x6287d7){return db[_0x4916('0x41')][_0x4916('0x59')]({'where':{'id':_0x10c150[_0x4916('0x48')]['id']},'raw':!![]})[_0x4916('0x42')](handleEntityNotFound(_0x4a2793,null))['then'](function(_0x45361f){if(_0x45361f){var _0x323cc4=_0x45361f[_0x4916('0x5a')]!==null;var _0x54538a=path[_0x4916('0x5b')](config[_0x4916('0x5c')],'server/files/attachments/');if(_0x323cc4){_0x54538a=path[_0x4916('0x5b')](_0x54538a,'offline-chat/');}var _0x354af6=path[_0x4916('0x5b')](_0x54538a,_0x45361f[_0x4916('0x55')]);return _0x4a2793[_0x4916('0x58')](_0x354af6);}})[_0x4916('0x46')](handleError(_0x4a2793,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 3725a93..5d59470 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 _0xb72b=['./attachment.attributes','exports','attachments','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x288867,_0x5c48a8){var _0x1a6b2e=function(_0x546727){while(--_0x546727){_0x288867['push'](_0x288867['shift']());}};_0x1a6b2e(++_0x5c48a8);}(_0xb72b,0x1a1));var _0xbb72=function(_0x559209,_0x2b2ecf){_0x559209=_0x559209-0x0;var _0x234e76=_0xb72b[_0x559209];return _0x234e76;};'use strict';var _=require('lodash');var util=require(_0xbb72('0x0'));var logger=require(_0xbb72('0x1'))(_0xbb72('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbb72('0x3'));var fs=require('fs');var path=require(_0xbb72('0x4'));var rimraf=require('rimraf');var config=require(_0xbb72('0x5'));var attributes=require(_0xbb72('0x6'));module[_0xbb72('0x7')]=function(_0x5808d3,_0x528024){return _0x5808d3['define']('Attachment',attributes,{'tableName':_0xbb72('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02d6=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','lodash','util','moment'];(function(_0x212bab,_0x3b12a7){var _0x4ba926=function(_0x1d7799){while(--_0x1d7799){_0x212bab['push'](_0x212bab['shift']());}};_0x4ba926(++_0x3b12a7);}(_0x02d6,0x1ec));var _0x602d=function(_0x4775bf,_0x31ba12){_0x4775bf=_0x4775bf-0x0;var _0x574079=_0x02d6[_0x4775bf];return _0x574079;};'use strict';var _=require(_0x602d('0x0'));var util=require(_0x602d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x602d('0x2'));var BPromise=require('bluebird');var rp=require(_0x602d('0x3'));var fs=require('fs');var path=require(_0x602d('0x4'));var rimraf=require(_0x602d('0x5'));var config=require(_0x602d('0x6'));var attributes=require(_0x602d('0x7'));module[_0x602d('0x8')]=function(_0x534c3a,_0x262082){return _0x534c3a[_0x602d('0x9')]('Attachment',attributes,{'tableName':_0x602d('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 5c991fc..54dce4d 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 _0xcabc=['error','code','message','result','catch','CreateAttachment','Attachment','create','body','raw','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3f1041,_0x3c9c76){var _0xb29e0f=function(_0x60db72){while(--_0x60db72){_0x3f1041['push'](_0x3f1041['shift']());}};_0xb29e0f(++_0x3c9c76);}(_0xcabc,0x16a));var _0xccab=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcabc[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xccab('0x0'));var moment=require(_0xccab('0x1'));var BPromise=require(_0xccab('0x2'));var rs=require(_0xccab('0x3'));var fs=require('fs');var Redis=require(_0xccab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xccab('0x5'));var logger=require(_0xccab('0x6'))('rpc');var config=require(_0xccab('0x7'));var jayson=require(_0xccab('0x8'));var client=jayson[_0xccab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x112ab8,_0x29f877,_0x24b95c){return new BPromise(function(_0x4a6f3c,_0x2c43fa){return client[_0xccab('0xa')](_0x112ab8,_0x24b95c)['then'](function(_0x401b85){logger[_0xccab('0xb')](_0xccab('0xc'),_0x29f877,_0xccab('0xd'));logger[_0xccab('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x29f877,'request\x20sent',JSON[_0xccab('0xf')](_0x401b85));if(_0x401b85[_0xccab('0x10')]){if(_0x401b85[_0xccab('0x10')][_0xccab('0x11')]===0x1f4){logger[_0xccab('0x10')](_0xccab('0xc'),_0x29f877,_0x401b85[_0xccab('0x10')]['message']);return _0x2c43fa(_0x401b85[_0xccab('0x10')][_0xccab('0x12')]);}logger['error'](_0xccab('0xc'),_0x29f877,_0x401b85['error']['message']);return _0x4a6f3c(_0x401b85[_0xccab('0x10')][_0xccab('0x12')]);}else{logger[_0xccab('0xb')]('Attachment,\x20%s,\x20%s',_0x29f877,_0xccab('0xd'));_0x4a6f3c(_0x401b85[_0xccab('0x13')]['message']);}})[_0xccab('0x14')](function(_0x333142){logger[_0xccab('0x10')](_0xccab('0xc'),_0x29f877,_0x333142);_0x2c43fa(_0x333142);});});}exports[_0xccab('0x15')]=function(_0x5157c6){var _0x4ba1c2=this;return new Promise(function(_0x1960e7,_0x5e1eeb){return db[_0xccab('0x16')][_0xccab('0x17')](_0x5157c6[_0xccab('0x18')],{'raw':_0x5157c6['options']?_0x5157c6['options'][_0xccab('0x19')]===undefined?!![]:![]:!![]})[_0xccab('0x1a')](function(_0x459090){logger['info'](_0xccab('0x15'),_0x5157c6);logger['debug'](_0xccab('0x15'),_0x5157c6,JSON[_0xccab('0xf')](_0x459090));_0x1960e7(_0x459090);})['catch'](function(_0x32c852){logger[_0xccab('0x10')](_0xccab('0x15'),_0x32c852[_0xccab('0x12')],_0x5157c6);_0x5e1eeb(_0x4ba1c2[_0xccab('0x10')](0x1f4,_0x32c852[_0xccab('0x12')]));});});}; \ No newline at end of file +var _0x6f7f=['stringify','error','code','message','Attachment,\x20%s,\x20%s','result','CreateAttachment','Attachment','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x99c600,_0xca659f){var _0x43c83e=function(_0x35942d){while(--_0x35942d){_0x99c600['push'](_0x99c600['shift']());}};_0x43c83e(++_0xca659f);}(_0x6f7f,0x177));var _0xf6f7=function(_0x2d0ef8,_0x5c18c7){_0x2d0ef8=_0x2d0ef8-0x0;var _0x441d8b=_0x6f7f[_0x2d0ef8];return _0x441d8b;};'use strict';var _=require('lodash');var util=require(_0xf6f7('0x0'));var moment=require(_0xf6f7('0x1'));var BPromise=require(_0xf6f7('0x2'));var rs=require(_0xf6f7('0x3'));var fs=require('fs');var Redis=require(_0xf6f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6f7('0x5'));var logger=require('../../config/logger')(_0xf6f7('0x6'));var config=require(_0xf6f7('0x7'));var jayson=require(_0xf6f7('0x8'));var client=jayson['client'][_0xf6f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x543eb3,_0x33a2b2,_0x3c641f){return new BPromise(function(_0xe86f3a,_0x279ed7){return client[_0xf6f7('0xa')](_0x543eb3,_0x3c641f)[_0xf6f7('0xb')](function(_0x506617){logger[_0xf6f7('0xc')]('Attachment,\x20%s,\x20%s',_0x33a2b2,'request\x20sent');logger['debug'](_0xf6f7('0xd'),_0x33a2b2,_0xf6f7('0xe'),JSON[_0xf6f7('0xf')](_0x506617));if(_0x506617[_0xf6f7('0x10')]){if(_0x506617[_0xf6f7('0x10')][_0xf6f7('0x11')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x33a2b2,_0x506617[_0xf6f7('0x10')][_0xf6f7('0x12')]);return _0x279ed7(_0x506617[_0xf6f7('0x10')][_0xf6f7('0x12')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x33a2b2,_0x506617[_0xf6f7('0x10')]['message']);return _0xe86f3a(_0x506617[_0xf6f7('0x10')]['message']);}else{logger[_0xf6f7('0xc')](_0xf6f7('0x13'),_0x33a2b2,_0xf6f7('0xe'));_0xe86f3a(_0x506617[_0xf6f7('0x14')][_0xf6f7('0x12')]);}})['catch'](function(_0x42aa26){logger[_0xf6f7('0x10')]('Attachment,\x20%s,\x20%s',_0x33a2b2,_0x42aa26);_0x279ed7(_0x42aa26);});});}exports[_0xf6f7('0x15')]=function(_0x438e3d){var _0xc23839=this;return new Promise(function(_0x5cc7a1,_0x5ba9f0){return db[_0xf6f7('0x16')][_0xf6f7('0x17')](_0x438e3d['body'],{'raw':_0x438e3d[_0xf6f7('0x18')]?_0x438e3d[_0xf6f7('0x18')][_0xf6f7('0x19')]===undefined?!![]:![]:!![]})[_0xf6f7('0xb')](function(_0x3143d1){logger[_0xf6f7('0xc')](_0xf6f7('0x15'),_0x438e3d);logger['debug'](_0xf6f7('0x15'),_0x438e3d,JSON['stringify'](_0x3143d1));_0x5cc7a1(_0x3143d1);})['catch'](function(_0x66e5e4){logger['error'](_0xf6f7('0x15'),_0x66e5e4[_0xf6f7('0x12')],_0x438e3d);_0x5ba9f0(_0xc23839['error'](0x1f4,_0x66e5e4[_0xf6f7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3b9a467..9f31c1d 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x2103a3,_0x588bd6){var _0x2f7915=function(_0x44bab4){while(--_0x44bab4){_0x2103a3['push'](_0x2103a3['shift']());}};_0x2f7915(++_0x588bd6);}(_0xb10b,0x12a));var _0xbb10=function(_0x430524,_0x23b611){_0x430524=_0x430524-0x0;var _0x3a726d=_0xb10b[_0x430524];return _0x3a726d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x34da25,_0x249330){var _0x58adc6=function(_0x151d32){while(--_0x151d32){_0x34da25['push'](_0x34da25['shift']());}};_0x58adc6(++_0x249330);}(_0xadb5,0xad));var _0x5adb=function(_0x24169e,_0x483db8){_0x24169e=_0x24169e-0x0;var _0x7d0798=_0xadb5[_0x24169e];return _0x7d0798;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f23085a..7ddbdaa 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 _0xfc46=['Strategy','moment','../../mysqldb','../../config/environment','signToken','../../config/utils','login','authenticate','google','profile','email','/login','use','clientID','clientSecret','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.','blocked','add','minutes','clearBlockUser','getLicense','lodash','passport-google-oauth20'];(function(_0x1e4b5a,_0x3e8dcc){var _0x2abfce=function(_0x5a667e){while(--_0x5a667e){_0x1e4b5a['push'](_0x1e4b5a['shift']());}};_0x2abfce(++_0x3e8dcc);}(_0xfc46,0x18a));var _0x6fc4=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0xfc46[_0x1b4c04];return _0x374f5d;};'use strict';var _=require(_0x6fc4('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x6fc4('0x1'))[_0x6fc4('0x2')];var moment=require(_0x6fc4('0x3'));var db=require(_0x6fc4('0x4'))['db'];var config=require(_0x6fc4('0x5'));var signToken=require('../../components/auth/service')[_0x6fc4('0x6')];var utils=require(_0x6fc4('0x7'));exports[_0x6fc4('0x8')]=passport[_0x6fc4('0x9')](_0x6fc4('0xa'),{'failureRedirect':'/login','scope':[_0x6fc4('0xb'),_0x6fc4('0xc')],'session':![]});exports['callback']=passport[_0x6fc4('0x9')](_0x6fc4('0xa'),{'failureRedirect':_0x6fc4('0xd'),'session':![]});passport[_0x6fc4('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x6fc4('0xa')][_0x6fc4('0xf')]:'id','clientSecret':config['google']?config[_0x6fc4('0xa')][_0x6fc4('0x10')]:_0x6fc4('0x11'),'callbackURL':config[_0x6fc4('0xa')]?config['google'][_0x6fc4('0x12')]:''},function(_0x559173,_0x2840e7,_0x48bba9,_0x333eb9){var _0x3e022b,_0x4d5cc5;return db['Setting'][_0x6fc4('0x13')]({'where':{'id':0x1},'attributes':[_0x6fc4('0x14'),_0x6fc4('0x15')],'raw':!![]})[_0x6fc4('0x16')](function(_0x163a8){_0x3e022b=_0x163a8;return db[_0x6fc4('0x17')][_0x6fc4('0x18')]({'where':{'email':_[_0x6fc4('0x19')](_0x48bba9['emails'],_0x6fc4('0x1a')),'role':{'$or':[_0x6fc4('0x1b'),_0x6fc4('0x1c'),_0x6fc4('0x1d')]}}});})[_0x6fc4('0x16')](function(_0x32302a){_0x4d5cc5=_0x32302a;if(_0x4d5cc5){if(_0x4d5cc5['disabled']){return _0x333eb9(_0x6fc4('0x1e'));}else if(_0x3e022b['blockDuration']>0x0){if(_0x4d5cc5[_0x6fc4('0x1f')]){if(moment(_0x4d5cc5['blockedAt'])[_0x6fc4('0x20')](_0x3e022b[_0x6fc4('0x15')],_0x6fc4('0x21'))>moment()){return _0x333eb9(_0x6fc4('0x1e'));}else{return utils[_0x6fc4('0x22')](_0x4d5cc5,0x0,![],null)[_0x6fc4('0x16')](function(){return utils['getLicense'](_0x4d5cc5);})[_0x6fc4('0x16')](function(){return _0x333eb9(null,_0x4d5cc5);});}}else{return utils[_0x6fc4('0x23')](_0x4d5cc5)['then'](function(){return _0x333eb9(null,_0x4d5cc5);});}}else{return utils[_0x6fc4('0x23')](_0x4d5cc5)[_0x6fc4('0x16')](function(){return _0x333eb9(null,_0x4d5cc5);});}}return _0x333eb9(_0x6fc4('0x1e'));})['catch'](function(_0x3dfdc5){_0x333eb9(_0x3dfdc5);});})); \ No newline at end of file +var _0x8985=['blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','signToken','../../config/utils','login','/login','authenticate','use','google','clientID','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','then','find','emails','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration'];(function(_0x2e02f9,_0x255aa7){var _0x259d17=function(_0x59c8e3){while(--_0x59c8e3){_0x2e02f9['push'](_0x2e02f9['shift']());}};_0x259d17(++_0x255aa7);}(_0x8985,0x1c1));var _0x5898=function(_0x2f401b,_0x5a9c64){_0x2f401b=_0x2f401b-0x0;var _0x3d4b06=_0x8985[_0x2f401b];return _0x3d4b06;};'use strict';var _=require(_0x5898('0x0'));var passport=require(_0x5898('0x1'));var GoogleStrategy=require(_0x5898('0x2'))[_0x5898('0x3')];var moment=require('moment');var db=require(_0x5898('0x4'))['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')[_0x5898('0x5')];var utils=require(_0x5898('0x6'));exports[_0x5898('0x7')]=passport['authenticate']('google',{'failureRedirect':_0x5898('0x8'),'scope':['profile','email'],'session':![]});exports['callback']=passport[_0x5898('0x9')]('google',{'failureRedirect':'/login','session':![]});passport[_0x5898('0xa')](new GoogleStrategy({'clientID':config['google']?config[_0x5898('0xb')][_0x5898('0xc')]:'id','clientSecret':config['google']?config[_0x5898('0xb')][_0x5898('0xd')]:'secret','callbackURL':config[_0x5898('0xb')]?config['google'][_0x5898('0xe')]:''},function(_0x313f6b,_0x223a50,_0x322e2d,_0x1e21cb){var _0x483b3a,_0x30dac0;return db[_0x5898('0xf')][_0x5898('0x10')]({'where':{'id':0x1},'attributes':[_0x5898('0x11'),'blockDuration'],'raw':!![]})[_0x5898('0x12')](function(_0x5c5ae6){_0x483b3a=_0x5c5ae6;return db['User'][_0x5898('0x13')]({'where':{'email':_['map'](_0x322e2d[_0x5898('0x14')],_0x5898('0x15')),'role':{'$or':[_0x5898('0x16'),_0x5898('0x17'),_0x5898('0x18')]}}});})[_0x5898('0x12')](function(_0x4ec32a){_0x30dac0=_0x4ec32a;if(_0x30dac0){if(_0x30dac0['disabled']){return _0x1e21cb(_0x5898('0x19'));}else if(_0x483b3a[_0x5898('0x1a')]>0x0){if(_0x30dac0[_0x5898('0x1b')]){if(moment(_0x30dac0[_0x5898('0x1c')])[_0x5898('0x1d')](_0x483b3a[_0x5898('0x1a')],_0x5898('0x1e'))>moment()){return _0x1e21cb(_0x5898('0x19'));}else{return utils[_0x5898('0x1f')](_0x30dac0,0x0,![],null)[_0x5898('0x12')](function(){return utils[_0x5898('0x20')](_0x30dac0);})[_0x5898('0x12')](function(){return _0x1e21cb(null,_0x30dac0);});}}else{return utils[_0x5898('0x20')](_0x30dac0)[_0x5898('0x12')](function(){return _0x1e21cb(null,_0x30dac0);});}}else{return utils[_0x5898('0x20')](_0x30dac0)[_0x5898('0x12')](function(){return _0x1e21cb(null,_0x30dac0);});}}return _0x1e21cb(_0x5898('0x19'));})[_0x5898('0x21')](function(_0x4f85a7){_0x1e21cb(_0x4f85a7);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index a2e391e..8d8d2cf 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 _0xba07=['isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback'];(function(_0x43bb39,_0x19e9dd){var _0x52cdba=function(_0x4f071d){while(--_0x4f071d){_0x43bb39['push'](_0x43bb39['shift']());}};_0x52cdba(++_0x19e9dd);}(_0xba07,0xc6));var _0x7ba0=function(_0x2932d9,_0x431abd){_0x2932d9=_0x2932d9-0x0;var _0x2cc783=_0xba07[_0x2932d9];return _0x2cc783;};'use strict';var express=require(_0x7ba0('0x0'));var passport=require(_0x7ba0('0x1'));var router=express[_0x7ba0('0x2')]();var controller=require(_0x7ba0('0x3'));var userController=require(_0x7ba0('0x4'));var authService=require(_0x7ba0('0x5'));router[_0x7ba0('0x6')]('/',controller[_0x7ba0('0x7')]);router[_0x7ba0('0x6')](_0x7ba0('0x8'),controller[_0x7ba0('0x9')],authService[_0x7ba0('0xa')],userController['login'],authService[_0x7ba0('0xb')]);module[_0x7ba0('0xc')]=router; \ No newline at end of file +var _0x57b6=['./authGoogle.controller','../user/user.controller.js','get','login','/callback','callback','setTokenCookie','exports','express','Router'];(function(_0x3354e5,_0x1926ce){var _0x194775=function(_0x4b5910){while(--_0x4b5910){_0x3354e5['push'](_0x3354e5['shift']());}};_0x194775(++_0x1926ce);}(_0x57b6,0x198));var _0x657b=function(_0x61492,_0x11c3c4){_0x61492=_0x61492-0x0;var _0x1caefa=_0x57b6[_0x61492];return _0x1caefa;};'use strict';var express=require(_0x657b('0x0'));var passport=require('passport');var router=express[_0x657b('0x1')]();var controller=require(_0x657b('0x2'));var userController=require(_0x657b('0x3'));var authService=require('../../components/auth/service');router[_0x657b('0x4')]('/',controller[_0x657b('0x5')]);router[_0x657b('0x4')](_0x657b('0x6'),controller[_0x657b('0x7')],authService['isMiddleware'],userController[_0x657b('0x5')],authService[_0x657b('0x8')]);module[_0x657b('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 12e7378..5129466 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 _0x5615=['jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','name','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','merge','format','message','error','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','forgot','body','Email\x20parameter\x20is\x20missing','trim','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','Password\x20reset!','use','util','passport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5615,0xa0));var _0x5561=function(_0x5b36a3,_0x1c2b4d){_0x5b36a3=_0x5b36a3-0x0;var _0x1f3838=_0x5615[_0x5b36a3];return _0x1f3838;};'use strict';var util=require(_0x5561('0x0'));var passport=require(_0x5561('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x5561('0x2'));var _=require(_0x5561('0x3'));var rs=require(_0x5561('0x4'));var moment=require('moment');var db=require(_0x5561('0x5'))['db'];var authService=require(_0x5561('0x6'));var utils=require(_0x5561('0x7'));var client=jayson['client'][_0x5561('0x8')]({'port':0x232b});function localAuthenticate(_0x1ef83c,_0xf685a2,_0x87bae,_0x4c03f0){var _0x7bdaa,_0x5756d1;return db[_0x5561('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x5561('0xa'),_0x5561('0xb')],'raw':!![]})[_0x5561('0xc')](function(_0x30bac3){_0x7bdaa=_0x30bac3;return _0x1ef83c['findOne']({'attributes':['id',_0x5561('0xd'),'password',_0x5561('0xe'),'role',_0x5561('0xf'),_0x5561('0x10'),_0x5561('0x11'),_0x5561('0x12')],'where':{'name':_0xf685a2,'role':{'$or':[_0x5561('0x13'),_0x5561('0x14'),_0x5561('0x15')]}}});})[_0x5561('0xc')](function(_0x45cfef){if(!_0x45cfef||_0x45cfef&&_0x45cfef[_0x5561('0xd')]!==_0xf685a2){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5756d1=_0x45cfef;return _0x5756d1;}})[_0x5561('0xc')](function(){_0x5756d1[_0x5561('0x16')](_0x87bae,function(_0xa8f217,_0x284403){var _0x4e08e7=_0x5756d1[_0x5561('0x12')]+0x1;if(_0xa8f217){return _0x4c03f0(_0xa8f217);}else if(!_0x284403){if(_0x5756d1[_0x5561('0xf')]){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else if(_0x7bdaa['allowedLoginAttempts']>0x0){if(_0x5756d1['blocked']){if(_0x7bdaa[_0x5561('0xb')]>0x0){if(moment(_0x5756d1[_0x5561('0x11')])[_0x5561('0x18')](_0x7bdaa[_0x5561('0xb')],_0x5561('0x19'))>moment()){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else{return utils['clearBlockUser'](_0x5756d1,_0x4e08e7,![],null)[_0x5561('0xc')](function(){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});});}}else{return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}}else{if(_0x4e08e7>=_0x7bdaa[_0x5561('0xa')]){return utils[_0x5561('0x1a')](_0x5756d1,0x0,!![],moment())[_0x5561('0xc')](function(){return _0x4c03f0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x5756d1,_0x4e08e7,![],null)[_0x5561('0xc')](function(){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});});}}}else{return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}}else{if(_0x5756d1[_0x5561('0xf')]){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else if(_0x7bdaa[_0x5561('0xa')]>0x0){if(_0x5756d1['blocked']){if(_0x7bdaa[_0x5561('0xb')]>0x0){if(moment(_0x5756d1[_0x5561('0x11')])[_0x5561('0x18')](_0x7bdaa[_0x5561('0xb')],_0x5561('0x19'))>moment()){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else{return utils['clearBlockUser'](_0x5756d1,0x0,![],null)[_0x5561('0xc')](function(){return utils[_0x5561('0x1b')](_0x5756d1);})[_0x5561('0xc')](function(){return _0x4c03f0(null,_0x5756d1);});}}else{return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}}else{return utils[_0x5561('0x1a')](_0x5756d1,0x0,![],null)[_0x5561('0xc')](function(){return utils['getLicense'](_0x5756d1);})['then'](function(){return _0x4c03f0(null,_0x5756d1);})[_0x5561('0x1c')](function(_0x42e156){return _0x4c03f0(null,![],_0x42e156);});}}else{if(_0x5756d1['blocked']){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else{return utils[_0x5561('0x1b')](_0x5756d1)[_0x5561('0xc')](function(){return _0x4c03f0(null,_0x5756d1);});}}}});})['catch'](function(_0x18c6c1){return _0x4c03f0(null,![],_0x18c6c1);});}function sendServiceMail(_0x103c27){return db[_0x5561('0x1d')][_0x5561('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x5561('0xd'),_0x5561('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x5561('0x20')}]})[_0x5561('0xc')](function(_0x57ec55){if(!_0x57ec55){throw new Error(_0x5561('0x21'));}var _0x41e876={'tls':{'rejectUnauthorized':![]}};if(_0x57ec55['Smtp'][_0x5561('0x22')]){_0x41e876[_0x5561('0x22')]=_0x57ec55[_0x5561('0x20')][_0x5561('0x22')];}else{_0x41e876['host']=_0x57ec55['Smtp'][_0x5561('0x23')];_0x41e876['port']=_0x57ec55[_0x5561('0x20')][_0x5561('0x24')];_0x41e876[_0x5561('0x25')]=_0x57ec55[_0x5561('0x20')][_0x5561('0x25')];}if(_0x57ec55[_0x5561('0x20')][_0x5561('0x26')]){_0x41e876[_0x5561('0x27')]={'user':_0x57ec55[_0x5561('0x20')][_0x5561('0x14')],'pass':_0x57ec55[_0x5561('0x20')]['pass']};}var _0x172d96={'account':_0x41e876,'message':_[_0x5561('0x28')]({'from':util[_0x5561('0x29')]('\x22%s\x22\x20<%s>',_0x57ec55[_0x5561('0xd')],_0x57ec55[_0x5561('0x1f')]||_0x57ec55['Smtp'][_0x5561('0x14')])},_0x103c27)};return client['request']('SendMail',_0x172d96);})[_0x5561('0xc')](function(_0x302c56){if(_0x302c56['error']){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x302c56['error'][_0x5561('0x2a')]||JSON['stringify'](_0x302c56[_0x5561('0x2b')])));}return!![];});}function handleError(_0x108cc5,_0x3953af,_0x358175){return _0x108cc5[_0x5561('0x2c')](_0x3953af||0x1f4)[_0x5561('0x2d')]({'message':_0x358175?_0x358175[_0x5561('0x2a')]||_0x358175:''});}exports[_0x5561('0x2e')]=function(_0x2f5952,_0x5eaa88,_0x1d8dfc){passport[_0x5561('0x16')]('local',function(_0x2c4449,_0x36d9a4,_0x4926ea){var _0x360806=_0x2c4449||_0x4926ea;if(_0x360806){return handleError(_0x5eaa88,0x191,_0x360806);}if(!_0x36d9a4){return handleError(_0x5eaa88,0x194,{'message':_0x5561('0x2f')});}else{var _0x5c070b={'payload':{'id':_0x36d9a4['id'],'role':_0x36d9a4[_0x5561('0x30')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5c070b)[_0x5561('0xc')](function(_0x51652c){_0x5eaa88[_0x5561('0x31')]({'id':_0x36d9a4['id'],'token':_0x51652c,'statusCall':'','isAlreadyLogged':_0x36d9a4['online']});});}})(_0x2f5952,_0x5eaa88,_0x1d8dfc);};exports[_0x5561('0x32')]=function(_0x29c957,_0x5c6fdb,_0x57f430){if(!_0x29c957[_0x5561('0x33')][_0x5561('0x1f')]){return handleError(_0x5c6fdb,0x1f4,{'message':_0x5561('0x34')});}var _0x25d8af=rs['generate']();_0x29c957[_0x5561('0x33')][_0x5561('0x1f')]=_0x29c957[_0x5561('0x33')][_0x5561('0x1f')][_0x5561('0x35')]()['toLowerCase']();var _0x274ef2;return db[_0x5561('0x9')][_0x5561('0x36')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5561('0xb')],'raw':!![]})[_0x5561('0xc')](function(_0x504925){_0x274ef2=_0x504925;return db[_0x5561('0x37')][_0x5561('0x1e')]({'where':{'email':_0x29c957[_0x5561('0x33')]['email']}});})[_0x5561('0xc')](function(_0x234f2c){if(!_0x234f2c){throw new Error(_0x5561('0x38'));}if(_0x234f2c['disabled']){throw new Error(_0x5561('0x39'));}if(_0x234f2c[_0x5561('0x10')]){if(moment(_0x234f2c[_0x5561('0x11')])['add'](_0x274ef2[_0x5561('0xb')],_0x5561('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x234f2c['blocked']=![];_0x234f2c[_0x5561('0x11')]=null;}}_0x234f2c['resetPasswordToken']=_0x25d8af;_0x234f2c['resetPasswordExpires']=Date[_0x5561('0x3a')]()+0x36ee80;return _0x234f2c[_0x5561('0x3b')]();})['then'](function(){return sendServiceMail({'to':_0x29c957['body'][_0x5561('0x1f')],'subject':_0x5561('0x3c'),'text':_0x5561('0x3d')+_0x5561('0x3e')+'https://'+_0x29c957[_0x5561('0x3f')][_0x5561('0x23')]+_0x5561('0x40')+_0x25d8af+'\x0a\x0a'+_0x5561('0x41')});})[_0x5561('0xc')](function(){_0x5c6fdb[_0x5561('0x2c')](0xc8)[_0x5561('0x2d')]({'message':_0x5561('0x42')});})[_0x5561('0x1c')](function(_0x3fb4da){return handleError(_0x5c6fdb,0x1f4,_0x3fb4da);});};exports[_0x5561('0x43')]=function(_0x4a5dde,_0x29a70e,_0x525640){return db[_0x5561('0x37')][_0x5561('0x1e')]({'where':{'resetPasswordToken':_0x4a5dde[_0x5561('0x44')][_0x5561('0x45')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x57dc57){if(!_0x57dc57){throw new Error(_0x5561('0x46'));}return db['Setting']['findOne']({'attributes':['id',_0x5561('0x47'),'enforcePasswordHistory',_0x5561('0x48')]})[_0x5561('0xc')](function(_0x310dbd){if(_0x310dbd[_0x5561('0x47')])authService['validatePasswordPattern'](_0x4a5dde['body'][_0x5561('0x49')]);if(!_0x310dbd[_0x5561('0x4a')]||!_0x57dc57[_0x5561('0x4b')])return _0x57dc57;authService[_0x5561('0x4c')](_0x4a5dde[_0x5561('0x33')]['password'],_0x57dc57[_0x5561('0x4b')],_0x310dbd['passwordHistoryLimit']);return _0x57dc57;})[_0x5561('0xc')](function(){_0x57dc57[_0x5561('0x49')]=_0x4a5dde[_0x5561('0x33')]['password'];_0x57dc57[_0x5561('0x4d')]=null;_0x57dc57[_0x5561('0x4e')]=null;return _0x57dc57[_0x5561('0x3b')]();});})['then'](function(){_0x29a70e['status'](0xc8)[_0x5561('0x2d')]({'message':_0x5561('0x4f')});})['catch'](function(_0x277140){return handleError(_0x29a70e,0x1f4,_0x277140);});};passport[_0x5561('0x50')](new LocalStrategy({'usernameField':_0x5561('0xd'),'passwordField':_0x5561('0x49')},function(_0x9c3f50,_0x2a97ed,_0x3ee911){return localAuthenticate(db['User'],_0x9c3f50,_0x2a97ed,_0x3ee911);})); \ No newline at end of file +var _0x1e36=['blockedAt','minutes','getLicense','catch','find','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','stringify','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','email','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','save','Password\x20reset!','use','passport','Strategy','jayson/promise','lodash','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser'];(function(_0x33ede5,_0x1c0719){var _0x2932f6=function(_0x1ea0ca){while(--_0x1ea0ca){_0x33ede5['push'](_0x33ede5['shift']());}};_0x2932f6(++_0x1c0719);}(_0x1e36,0x131));var _0x61e3=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0x1e36[_0x9b5bb2];return _0x2e1e92;};'use strict';var util=require('util');var passport=require(_0x61e3('0x0'));var LocalStrategy=require('passport-local')[_0x61e3('0x1')];var jayson=require(_0x61e3('0x2'));var _=require(_0x61e3('0x3'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x61e3('0x4'))['db'];var authService=require(_0x61e3('0x5'));var utils=require(_0x61e3('0x6'));var client=jayson[_0x61e3('0x7')][_0x61e3('0x8')]({'port':0x232b});function localAuthenticate(_0x5998c9,_0x5b9050,_0xee544d,_0x5559d6){var _0x403835,_0x147d8c;return db[_0x61e3('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x61e3('0xa'),_0x61e3('0xb')],'raw':!![]})[_0x61e3('0xc')](function(_0x29b33b){_0x403835=_0x29b33b;return _0x5998c9[_0x61e3('0xd')]({'attributes':['id',_0x61e3('0xe'),_0x61e3('0xf'),_0x61e3('0x10'),_0x61e3('0x11'),_0x61e3('0x12'),_0x61e3('0x13'),'blockedAt',_0x61e3('0x14')],'where':{'name':_0x5b9050,'role':{'$or':[_0x61e3('0x15'),_0x61e3('0x16'),'agent']}}});})[_0x61e3('0xc')](function(_0x9e9d80){if(!_0x9e9d80||_0x9e9d80&&_0x9e9d80[_0x61e3('0xe')]!==_0x5b9050){throw new Error(_0x61e3('0x17'));}else{_0x147d8c=_0x9e9d80;return _0x147d8c;}})[_0x61e3('0xc')](function(){_0x147d8c[_0x61e3('0x18')](_0xee544d,function(_0x25b259,_0xed97d8){var _0xf71a17=_0x147d8c[_0x61e3('0x14')]+0x1;if(_0x25b259){return _0x5559d6(_0x25b259);}else if(!_0xed97d8){if(_0x147d8c['disabled']){return _0x5559d6(null,![],{'message':_0x61e3('0x17')});}else if(_0x403835[_0x61e3('0xa')]>0x0){if(_0x147d8c[_0x61e3('0x13')]){if(_0x403835[_0x61e3('0xb')]>0x0){if(moment(_0x147d8c['blockedAt'])[_0x61e3('0x19')](_0x403835[_0x61e3('0xb')],'minutes')>moment()){return _0x5559d6(null,![],{'message':_0x61e3('0x17')});}else{return utils[_0x61e3('0x1a')](_0x147d8c,_0xf71a17,![],null)[_0x61e3('0xc')](function(){return _0x5559d6(null,![],{'message':_0x61e3('0x17')});});}}else{return _0x5559d6(null,![],{'message':_0x61e3('0x17')});}}else{if(_0xf71a17>=_0x403835['allowedLoginAttempts']){return utils[_0x61e3('0x1a')](_0x147d8c,0x0,!![],moment())[_0x61e3('0xc')](function(){return _0x5559d6(null,![],{'message':_0x61e3('0x17')});});}else{return utils[_0x61e3('0x1a')](_0x147d8c,_0xf71a17,![],null)['then'](function(){return _0x5559d6(null,![],{'message':_0x61e3('0x17')});});}}}else{return _0x5559d6(null,![],{'message':_0x61e3('0x17')});}}else{if(_0x147d8c[_0x61e3('0x12')]){return _0x5559d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x403835['allowedLoginAttempts']>0x0){if(_0x147d8c['blocked']){if(_0x403835['blockDuration']>0x0){if(moment(_0x147d8c[_0x61e3('0x1b')])['add'](_0x403835['blockDuration'],_0x61e3('0x1c'))>moment()){return _0x5559d6(null,![],{'message':_0x61e3('0x17')});}else{return utils[_0x61e3('0x1a')](_0x147d8c,0x0,![],null)[_0x61e3('0xc')](function(){return utils[_0x61e3('0x1d')](_0x147d8c);})[_0x61e3('0xc')](function(){return _0x5559d6(null,_0x147d8c);});}}else{return _0x5559d6(null,![],{'message':_0x61e3('0x17')});}}else{return utils[_0x61e3('0x1a')](_0x147d8c,0x0,![],null)[_0x61e3('0xc')](function(){return utils[_0x61e3('0x1d')](_0x147d8c);})[_0x61e3('0xc')](function(){return _0x5559d6(null,_0x147d8c);})['catch'](function(_0x422239){return _0x5559d6(null,![],_0x422239);});}}else{if(_0x147d8c[_0x61e3('0x13')]){return _0x5559d6(null,![],{'message':_0x61e3('0x17')});}else{return utils[_0x61e3('0x1d')](_0x147d8c)[_0x61e3('0xc')](function(){return _0x5559d6(null,_0x147d8c);});}}}});})[_0x61e3('0x1e')](function(_0x4f4ba7){return _0x5559d6(null,![],_0x4f4ba7);});}function sendServiceMail(_0x1f8560){return db['MailAccount'][_0x61e3('0x1f')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x61e3('0x20')],'as':'Smtp'}]})['then'](function(_0x2a8db2){if(!_0x2a8db2){throw new Error(_0x61e3('0x21'));}var _0x9ad865={'tls':{'rejectUnauthorized':![]}};if(_0x2a8db2[_0x61e3('0x22')][_0x61e3('0x23')]){_0x9ad865[_0x61e3('0x23')]=_0x2a8db2['Smtp'][_0x61e3('0x23')];}else{_0x9ad865[_0x61e3('0x24')]=_0x2a8db2[_0x61e3('0x22')][_0x61e3('0x24')];_0x9ad865[_0x61e3('0x25')]=_0x2a8db2[_0x61e3('0x22')][_0x61e3('0x25')];_0x9ad865[_0x61e3('0x26')]=_0x2a8db2[_0x61e3('0x22')][_0x61e3('0x26')];}if(_0x2a8db2[_0x61e3('0x22')][_0x61e3('0x27')]){_0x9ad865[_0x61e3('0x28')]={'user':_0x2a8db2[_0x61e3('0x22')][_0x61e3('0x16')],'pass':_0x2a8db2[_0x61e3('0x22')]['pass']};}var _0x313b5e={'account':_0x9ad865,'message':_[_0x61e3('0x29')]({'from':util[_0x61e3('0x2a')](_0x61e3('0x2b'),_0x2a8db2[_0x61e3('0xe')],_0x2a8db2['email']||_0x2a8db2[_0x61e3('0x22')][_0x61e3('0x16')])},_0x1f8560)};return client[_0x61e3('0x2c')](_0x61e3('0x2d'),_0x313b5e);})[_0x61e3('0xc')](function(_0x1fdb14){if(_0x1fdb14[_0x61e3('0x2e')]){throw new Error(util[_0x61e3('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1fdb14['error']['message']||JSON[_0x61e3('0x2f')](_0x1fdb14[_0x61e3('0x2e')])));}return!![];});}function handleError(_0x1646b7,_0x108381,_0x6f74d0){return _0x1646b7['status'](_0x108381||0x1f4)[_0x61e3('0x30')]({'message':_0x6f74d0?_0x6f74d0[_0x61e3('0x31')]||_0x6f74d0:''});}exports[_0x61e3('0x32')]=function(_0x55b092,_0x4b6304,_0x2bc44b){passport[_0x61e3('0x18')](_0x61e3('0x33'),function(_0x2cc53b,_0x522ff5,_0x3db6f0){var _0x37959d=_0x2cc53b||_0x3db6f0;if(_0x37959d){return handleError(_0x4b6304,0x191,_0x37959d);}if(!_0x522ff5){return handleError(_0x4b6304,0x194,{'message':_0x61e3('0x34')});}else{var _0x221511={'payload':{'id':_0x522ff5['id'],'role':_0x522ff5[_0x61e3('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x61e3('0x35')](_0x221511)['then'](function(_0x2043f6){_0x4b6304[_0x61e3('0x36')]({'id':_0x522ff5['id'],'token':_0x2043f6,'statusCall':'','isAlreadyLogged':_0x522ff5[_0x61e3('0x37')]});});}})(_0x55b092,_0x4b6304,_0x2bc44b);};exports[_0x61e3('0x38')]=function(_0x3b190f,_0xb436d7,_0x30e70f){if(!_0x3b190f[_0x61e3('0x39')]['email']){return handleError(_0xb436d7,0x1f4,{'message':_0x61e3('0x3a')});}var _0x35492d=rs[_0x61e3('0x3b')]();_0x3b190f[_0x61e3('0x39')][_0x61e3('0x3c')]=_0x3b190f['body'][_0x61e3('0x3c')][_0x61e3('0x3d')]()['toLowerCase']();var _0x3e24b5;return db[_0x61e3('0x9')][_0x61e3('0xd')]({'where':{'id':0x1},'attributes':[_0x61e3('0xa'),_0x61e3('0xb')],'raw':!![]})[_0x61e3('0xc')](function(_0x8fec9d){_0x3e24b5=_0x8fec9d;return db[_0x61e3('0x3e')]['find']({'where':{'email':_0x3b190f[_0x61e3('0x39')]['email']}});})[_0x61e3('0xc')](function(_0x976969){if(!_0x976969){throw new Error(_0x61e3('0x3f'));}if(_0x976969[_0x61e3('0x12')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x976969[_0x61e3('0x13')]){if(moment(_0x976969['blockedAt'])[_0x61e3('0x19')](_0x3e24b5[_0x61e3('0xb')],'minutes')>moment()){throw new Error(_0x61e3('0x40'));}else{_0x976969['blocked']=![];_0x976969[_0x61e3('0x1b')]=null;}}_0x976969[_0x61e3('0x41')]=_0x35492d;_0x976969[_0x61e3('0x42')]=Date[_0x61e3('0x43')]()+0x36ee80;return _0x976969['save']();})[_0x61e3('0xc')](function(){return sendServiceMail({'to':_0x3b190f[_0x61e3('0x39')][_0x61e3('0x3c')],'subject':_0x61e3('0x44'),'text':_0x61e3('0x45')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x61e3('0x46')+_0x3b190f[_0x61e3('0x47')]['host']+'/reset/'+_0x35492d+'\x0a\x0a'+_0x61e3('0x48')});})[_0x61e3('0xc')](function(){_0xb436d7[_0x61e3('0x49')](0xc8)[_0x61e3('0x30')]({'message':_0x61e3('0x4a')});})[_0x61e3('0x1e')](function(_0x15337c){return handleError(_0xb436d7,0x1f4,_0x15337c);});};exports['reset']=function(_0x20e6c2,_0x120f70,_0x18ab70){return db[_0x61e3('0x3e')][_0x61e3('0x1f')]({'where':{'resetPasswordToken':_0x20e6c2['params'][_0x61e3('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x61e3('0xc')](function(_0x26fbc9){if(!_0x26fbc9){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id',_0x61e3('0x4c'),_0x61e3('0x4d'),_0x61e3('0x4e')]})[_0x61e3('0xc')](function(_0x435852){if(_0x435852[_0x61e3('0x4c')])authService[_0x61e3('0x4f')](_0x20e6c2[_0x61e3('0x39')][_0x61e3('0xf')]);if(!_0x435852[_0x61e3('0x4d')]||!_0x26fbc9['previousPasswords'])return _0x26fbc9;authService['validatePasswordHistory'](_0x20e6c2[_0x61e3('0x39')][_0x61e3('0xf')],_0x26fbc9['previousPasswords'],_0x435852[_0x61e3('0x4e')]);return _0x26fbc9;})[_0x61e3('0xc')](function(){_0x26fbc9['password']=_0x20e6c2[_0x61e3('0x39')][_0x61e3('0xf')];_0x26fbc9['resetPasswordToken']=null;_0x26fbc9[_0x61e3('0x42')]=null;return _0x26fbc9[_0x61e3('0x50')]();});})[_0x61e3('0xc')](function(){_0x120f70[_0x61e3('0x49')](0xc8)[_0x61e3('0x30')]({'message':_0x61e3('0x51')});})[_0x61e3('0x1e')](function(_0x195487){return handleError(_0x120f70,0x1f4,_0x195487);});};passport[_0x61e3('0x52')](new LocalStrategy({'usernameField':'name','passwordField':_0x61e3('0xf')},function(_0x30e8ce,_0x3e0323,_0x58d27e){return localAuthenticate(db['User'],_0x30e8ce,_0x3e0323,_0x58d27e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 01075dc..854b17c 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 _0x56e4=['login','forgot','reset','exports','Router','post'];(function(_0x163157,_0x5408a9){var _0x1eb3ae=function(_0x22f4de){while(--_0x22f4de){_0x163157['push'](_0x163157['shift']());}};_0x1eb3ae(++_0x5408a9);}(_0x56e4,0x166));var _0x456e=function(_0x1827b4,_0x48e579){_0x1827b4=_0x1827b4-0x0;var _0x46ad8f=_0x56e4[_0x1827b4];return _0x46ad8f;};'use strict';var express=require('express');var router=express[_0x456e('0x0')]();var controller=require('./authLocal.controller');router[_0x456e('0x1')]('/',controller[_0x456e('0x2')]);router[_0x456e('0x1')]('/forgot',controller[_0x456e('0x3')]);router[_0x456e('0x1')]('/reset/:token',controller[_0x456e('0x4')]);module[_0x456e('0x5')]=router; \ No newline at end of file +var _0x5a17=['forgot','/reset/:token','express','Router','post','/forgot'];(function(_0x415f13,_0x53ef30){var _0x16f0fe=function(_0x4b5837){while(--_0x4b5837){_0x415f13['push'](_0x415f13['shift']());}};_0x16f0fe(++_0x53ef30);}(_0x5a17,0x8c));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x75a1('0x0'));var router=express[_0x75a1('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0x75a1('0x2')](_0x75a1('0x3'),controller[_0x75a1('0x4')]);router[_0x75a1('0x2')](_0x75a1('0x5'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 5a82834..050c7c6 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 _0xbc62=['exports','STRING','INTEGER','sequelize'];(function(_0x38459f,_0x1ac4e4){var _0x5f331c=function(_0x541ed0){while(--_0x541ed0){_0x38459f['push'](_0x38459f['shift']());}};_0x5f331c(++_0x1ac4e4);}(_0xbc62,0x107));var _0x2bc6=function(_0x4244f0,_0x2bb152){_0x4244f0=_0x4244f0-0x0;var _0xec0499=_0xbc62[_0x4244f0];return _0xec0499;};'use strict';var Sequelize=require(_0x2bc6('0x0'));module[_0x2bc6('0x1')]={'name':{'type':Sequelize[_0x2bc6('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2bc6('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2bc6('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x11ca=['exports','STRING','BOOLEAN','sequelize'];(function(_0xa83af1,_0x55f7c1){var _0x51867c=function(_0x20c035){while(--_0x20c035){_0xa83af1['push'](_0xa83af1['shift']());}};_0x51867c(++_0x55f7c1);}(_0x11ca,0x11b));var _0xa11c=function(_0x55d63e,_0x52920d){_0x55d63e=_0x55d63e-0x0;var _0x32515f=_0x11ca[_0x55d63e];return _0x32515f;};'use strict';var Sequelize=require(_0xa11c('0x0'));module[_0xa11c('0x1')]={'name':{'type':Sequelize[_0xa11c('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa11c('0x2')]},'status':{'type':Sequelize[_0xa11c('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 e0c6245..d5ccfae 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 _0x68d1=['filter','options','Automation','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','addConditions','ids','omit','getConditions','addActions','Action','findOne','eml-format','rimraf','fast-json-patch','request-promise','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','reject','update','then','end','error','stack','name','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x68d1,0xbb));var _0x168d=function(_0xac011,_0x56395){_0xac011=_0xac011-0x0;var _0x215727=_0x68d1[_0xac011];return _0x215727;};'use strict';var emlformat=require(_0x168d('0x0'));var rimraf=require(_0x168d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x168d('0x2'));var rp=require(_0x168d('0x3'));var moment=require('moment');var BPromise=require(_0x168d('0x4'));var Mustache=require(_0x168d('0x5'));var util=require(_0x168d('0x6'));var path=require(_0x168d('0x7'));var sox=require(_0x168d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x168d('0x9'));var _=require(_0x168d('0xa'));var squel=require(_0x168d('0xb'));var crypto=require(_0x168d('0xc'));var jsforce=require(_0x168d('0xd'));var deskjs=require(_0x168d('0xe'));var toCsv=require(_0x168d('0xf'));var querystring=require(_0x168d('0x10'));var Papa=require(_0x168d('0x11'));var Redis=require(_0x168d('0x12'));var authService=require(_0x168d('0x13'));var qs=require(_0x168d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x168d('0x15'));var logger=require(_0x168d('0x16'))(_0x168d('0x17'));var utils=require(_0x168d('0x18'));var config=require(_0x168d('0x19'));var licenseUtil=require(_0x168d('0x1a'));var db=require(_0x168d('0x1b'))['db'];function respondWithStatusCode(_0xfeae91,_0x5b3a7d){_0x5b3a7d=_0x5b3a7d||0xcc;return function(_0x1cb17e){if(_0x1cb17e){return _0xfeae91[_0x168d('0x1c')](_0x5b3a7d);}return _0xfeae91[_0x168d('0x1d')](_0x5b3a7d)['end']();};}function respondWithResult(_0x143eee,_0x5218b8){_0x5218b8=_0x5218b8||0xc8;return function(_0x2ad133){if(_0x2ad133){return _0x143eee[_0x168d('0x1d')](_0x5218b8)[_0x168d('0x1e')](_0x2ad133);}};}function respondWithFilteredResult(_0x31c777,_0x41e55c){return function(_0x193cae){if(_0x193cae){var _0x41989e=typeof _0x41e55c['offset']===_0x168d('0x1f')&&typeof _0x41e55c[_0x168d('0x20')]===_0x168d('0x1f');var _0x517a22=_0x193cae[_0x168d('0x21')];var _0x8b8ede=_0x41989e?0x0:_0x41e55c[_0x168d('0x22')];var _0x8af2c=_0x41989e?_0x193cae[_0x168d('0x21')]:_0x41e55c['offset']+_0x41e55c[_0x168d('0x20')];var _0x31d91a;if(_0x8af2c>=_0x517a22){_0x8af2c=_0x517a22;_0x31d91a=0xc8;}else{_0x31d91a=0xce;}_0x31c777[_0x168d('0x1d')](_0x31d91a);return _0x31c777[_0x168d('0x23')]('Content-Range',_0x8b8ede+'-'+_0x8af2c+'/'+_0x517a22)[_0x168d('0x1e')](_0x193cae);}return null;};}function patchUpdates(_0x94265c){return function(_0x5b9f78){try{jsonpatch['apply'](_0x5b9f78,_0x94265c,!![]);}catch(_0x482cbb){return BPromise[_0x168d('0x24')](_0x482cbb);}return _0x5b9f78['save']();};}function saveUpdates(_0x4ea0a9,_0x5665a8){return function(_0x54b7eb){if(_0x54b7eb){return _0x54b7eb[_0x168d('0x25')](_0x4ea0a9)[_0x168d('0x26')](function(_0x5c4339){return _0x5c4339;});}return null;};}function removeEntity(_0xc6f2ba,_0x4ace38){return function(_0x1b7297){if(_0x1b7297){return _0x1b7297['destroy']()[_0x168d('0x26')](function(){_0xc6f2ba[_0x168d('0x1d')](0xcc)[_0x168d('0x27')]();});}};}function handleEntityNotFound(_0x2aa12c,_0x2ed25c){return function(_0x1ce4ca){if(!_0x1ce4ca){_0x2aa12c[_0x168d('0x1c')](0x194);}return _0x1ce4ca;};}function handleError(_0x1a9687,_0x558883){_0x558883=_0x558883||0x1f4;return function(_0x2886c5){logger[_0x168d('0x28')](_0x2886c5[_0x168d('0x29')]);if(_0x2886c5['name']){delete _0x2886c5[_0x168d('0x2a')];}_0x1a9687[_0x168d('0x1d')](_0x558883)['send'](_0x2886c5);};}exports['index']=function(_0x555b54,_0x5f41fe){var _0x300c9c={},_0x332f32={},_0x1deb18={'count':0x0,'rows':[]};var _0x47be10=_[_0x168d('0x2b')](db['Automation']['rawAttributes'],function(_0x5e2c3b){return{'name':_0x5e2c3b[_0x168d('0x2c')],'type':_0x5e2c3b[_0x168d('0x2d')][_0x168d('0x2e')]};});_0x332f32['model']=_['map'](_0x47be10,_0x168d('0x2a'));_0x332f32[_0x168d('0x2f')]=_[_0x168d('0x30')](_0x555b54['query']);_0x332f32[_0x168d('0x31')]=_[_0x168d('0x32')](_0x332f32['model'],_0x332f32[_0x168d('0x2f')]);_0x300c9c[_0x168d('0x33')]=_[_0x168d('0x32')](_0x332f32[_0x168d('0x34')],qs[_0x168d('0x35')](_0x555b54[_0x168d('0x2f')]['fields']));_0x300c9c[_0x168d('0x33')]=_0x300c9c[_0x168d('0x33')]['length']?_0x300c9c[_0x168d('0x33')]:_0x332f32[_0x168d('0x34')];if(!_0x555b54[_0x168d('0x2f')][_0x168d('0x36')](_0x168d('0x37'))){_0x300c9c[_0x168d('0x20')]=qs['limit'](_0x555b54[_0x168d('0x2f')][_0x168d('0x20')]);_0x300c9c[_0x168d('0x22')]=qs[_0x168d('0x22')](_0x555b54[_0x168d('0x2f')][_0x168d('0x22')]);}_0x300c9c[_0x168d('0x38')]=qs[_0x168d('0x39')](_0x555b54[_0x168d('0x2f')]['sort']);_0x300c9c[_0x168d('0x3a')]=qs[_0x168d('0x31')](_[_0x168d('0x3b')](_0x555b54[_0x168d('0x2f')],_0x332f32[_0x168d('0x31')]),_0x47be10);if(_0x555b54[_0x168d('0x2f')]['filter']){_0x300c9c['where']=_[_0x168d('0x3c')](_0x300c9c[_0x168d('0x3a')],{'$or':_[_0x168d('0x2b')](_0x47be10,function(_0x1b8d2f){if(_0x1b8d2f[_0x168d('0x2d')]!==_0x168d('0x3d')){var _0x5e473e={};_0x5e473e[_0x1b8d2f['name']]={'$like':'%'+_0x555b54[_0x168d('0x2f')][_0x168d('0x3e')]+'%'};return _0x5e473e;}})});}_0x300c9c=_[_0x168d('0x3c')]({},_0x300c9c,_0x555b54[_0x168d('0x3f')]);var _0x21e7b8={'where':_0x300c9c[_0x168d('0x3a')]};return db[_0x168d('0x40')]['count'](_0x21e7b8)[_0x168d('0x26')](function(_0x4b85ee){_0x1deb18[_0x168d('0x21')]=_0x4b85ee;if(_0x555b54[_0x168d('0x2f')][_0x168d('0x41')]){_0x300c9c[_0x168d('0x42')]=[{'all':!![]}];}return db[_0x168d('0x40')][_0x168d('0x43')](_0x300c9c);})[_0x168d('0x26')](function(_0x52d7ff){_0x1deb18['rows']=_0x52d7ff;return _0x1deb18;})[_0x168d('0x26')](respondWithFilteredResult(_0x5f41fe,_0x300c9c))[_0x168d('0x44')](handleError(_0x5f41fe,null));};exports[_0x168d('0x45')]=function(_0x429a87,_0x48a2ad){var _0x4af370={'raw':![],'where':{'id':_0x429a87[_0x168d('0x46')]['id']}},_0x3ef855={};_0x3ef855[_0x168d('0x34')]=_['keys'](db[_0x168d('0x40')][_0x168d('0x47')]);_0x3ef855['query']=_[_0x168d('0x30')](_0x429a87['query']);_0x3ef855[_0x168d('0x31')]=_['intersection'](_0x3ef855[_0x168d('0x34')],_0x3ef855['query']);_0x4af370[_0x168d('0x33')]=_['intersection'](_0x3ef855[_0x168d('0x34')],qs['fields'](_0x429a87['query'][_0x168d('0x35')]));_0x4af370[_0x168d('0x33')]=_0x4af370[_0x168d('0x33')][_0x168d('0x48')]?_0x4af370[_0x168d('0x33')]:_0x3ef855['model'];if(_0x429a87['query']['includeAll']){_0x4af370[_0x168d('0x42')]=[{'all':!![]}];}_0x4af370=_['merge']({},_0x4af370,_0x429a87[_0x168d('0x3f')]);return db[_0x168d('0x40')][_0x168d('0x49')](_0x4af370)[_0x168d('0x26')](handleEntityNotFound(_0x48a2ad,null))[_0x168d('0x26')](respondWithResult(_0x48a2ad,null))['catch'](handleError(_0x48a2ad,null));};exports[_0x168d('0x4a')]=function(_0x1692c0,_0x45de80){return db[_0x168d('0x40')][_0x168d('0x4a')](_0x1692c0[_0x168d('0x4b')],{})['then'](respondWithResult(_0x45de80,0xc9))[_0x168d('0x44')](handleError(_0x45de80,null));};exports[_0x168d('0x25')]=function(_0x3ae847,_0x12fd31){if(_0x3ae847['body']['id']){delete _0x3ae847[_0x168d('0x4b')]['id'];}return db[_0x168d('0x40')][_0x168d('0x49')]({'where':{'id':_0x3ae847[_0x168d('0x46')]['id']}})['then'](handleEntityNotFound(_0x12fd31,null))[_0x168d('0x26')](saveUpdates(_0x3ae847[_0x168d('0x4b')],null))[_0x168d('0x26')](respondWithResult(_0x12fd31,null))[_0x168d('0x44')](handleError(_0x12fd31,null));};exports['destroy']=function(_0x209511,_0x11b2d3){return db[_0x168d('0x40')][_0x168d('0x49')]({'where':{'id':_0x209511['params']['id']}})[_0x168d('0x26')](handleEntityNotFound(_0x11b2d3,null))['then'](removeEntity(_0x11b2d3,null))[_0x168d('0x44')](handleError(_0x11b2d3,null));};exports['addConditions']=function(_0x4152d3,_0x395494,_0x5a93d5){return db['Condition'][_0x168d('0x49')]({'where':{'id':_0x4152d3[_0x168d('0x46')]['id']}})[_0x168d('0x26')](handleEntityNotFound(_0x395494,null))[_0x168d('0x26')](function(_0x287322){if(_0x287322){return _0x287322[_0x168d('0x4c')](_0x4152d3[_0x168d('0x4b')][_0x168d('0x4d')],_[_0x168d('0x4e')](_0x4152d3[_0x168d('0x4b')],[_0x168d('0x4d'),'id'])||{});}})[_0x168d('0x26')](respondWithResult(_0x395494,null))[_0x168d('0x44')](handleError(_0x395494,null));};exports[_0x168d('0x4f')]=function(_0x53073e,_0x311ca7,_0x48fc55){var _0xd77ee7={};var _0x473c7a={};var _0x282337;var _0x3f3f08;return db[_0x168d('0x40')]['findOne']({'where':{'id':_0x53073e[_0x168d('0x46')]['id']}})[_0x168d('0x26')](handleEntityNotFound(_0x311ca7,null))[_0x168d('0x26')](function(_0x50fffa){if(_0x50fffa){_0x282337=_0x50fffa;_0x473c7a[_0x168d('0x34')]=_[_0x168d('0x30')](db['Condition'][_0x168d('0x47')]);_0x473c7a[_0x168d('0x2f')]=_[_0x168d('0x30')](_0x53073e['query']);_0x473c7a[_0x168d('0x31')]=_['intersection'](_0x473c7a[_0x168d('0x34')],_0x473c7a[_0x168d('0x2f')]);_0xd77ee7[_0x168d('0x33')]=_[_0x168d('0x32')](_0x473c7a[_0x168d('0x34')],qs[_0x168d('0x35')](_0x53073e[_0x168d('0x2f')][_0x168d('0x35')]));_0xd77ee7['attributes']=_0xd77ee7[_0x168d('0x33')]['length']?_0xd77ee7[_0x168d('0x33')]:_0x473c7a[_0x168d('0x34')];_0xd77ee7['order']=qs['sort'](_0x53073e[_0x168d('0x2f')][_0x168d('0x39')]);_0xd77ee7['where']=qs[_0x168d('0x31')](_[_0x168d('0x3b')](_0x53073e[_0x168d('0x2f')],_0x473c7a[_0x168d('0x31')]));if(_0x53073e['query'][_0x168d('0x3e')]){_0xd77ee7[_0x168d('0x3a')]=_[_0x168d('0x3c')](_0xd77ee7[_0x168d('0x3a')],{'$or':_[_0x168d('0x2b')](_0xd77ee7['attributes'],function(_0x23c8d6){var _0x3bdf0c={};_0x3bdf0c[_0x23c8d6]={'$like':'%'+_0x53073e[_0x168d('0x2f')]['filter']+'%'};return _0x3bdf0c;})});}_0xd77ee7=_[_0x168d('0x3c')]({},_0xd77ee7,_0x53073e[_0x168d('0x3f')]);return _0x282337['getConditions'](_0xd77ee7);}})['then'](function(_0x236ee7){if(_0x236ee7){_0x3f3f08=_0x236ee7[_0x168d('0x48')];if(!_0x53073e[_0x168d('0x2f')]['hasOwnProperty'](_0x168d('0x37'))){_0xd77ee7['limit']=qs[_0x168d('0x20')](_0x53073e[_0x168d('0x2f')][_0x168d('0x20')]);_0xd77ee7['offset']=qs[_0x168d('0x22')](_0x53073e[_0x168d('0x2f')]['offset']);}return _0x282337[_0x168d('0x4f')](_0xd77ee7);}})[_0x168d('0x26')](function(_0x5cd846){if(_0x5cd846){return _0x5cd846?{'count':_0x3f3f08,'rows':_0x5cd846}:null;}})[_0x168d('0x26')](respondWithResult(_0x311ca7,null))[_0x168d('0x44')](handleError(_0x311ca7,null));};exports[_0x168d('0x50')]=function(_0x476874,_0xf8f927,_0x5e2c15){return db[_0x168d('0x51')][_0x168d('0x49')]({'where':{'id':_0x476874[_0x168d('0x46')]['id']}})['then'](handleEntityNotFound(_0xf8f927,null))[_0x168d('0x26')](function(_0x20074a){if(_0x20074a){return _0x20074a[_0x168d('0x50')](_0x476874[_0x168d('0x4b')][_0x168d('0x4d')],_[_0x168d('0x4e')](_0x476874[_0x168d('0x4b')],[_0x168d('0x4d'),'id'])||{});}})['then'](respondWithResult(_0xf8f927,null))[_0x168d('0x44')](handleError(_0xf8f927,null));};exports['getActions']=function(_0x144c7f,_0x194dd6,_0x3d8c39){var _0x376408={};var _0x1711fe={};var _0x55da5d;var _0x430e2b;return db[_0x168d('0x40')][_0x168d('0x52')]({'where':{'id':_0x144c7f['params']['id']}})['then'](handleEntityNotFound(_0x194dd6,null))[_0x168d('0x26')](function(_0x35e15c){if(_0x35e15c){_0x55da5d=_0x35e15c;_0x1711fe[_0x168d('0x34')]=_[_0x168d('0x30')](db[_0x168d('0x51')][_0x168d('0x47')]);_0x1711fe[_0x168d('0x2f')]=_[_0x168d('0x30')](_0x144c7f[_0x168d('0x2f')]);_0x1711fe[_0x168d('0x31')]=_[_0x168d('0x32')](_0x1711fe[_0x168d('0x34')],_0x1711fe[_0x168d('0x2f')]);_0x376408[_0x168d('0x33')]=_[_0x168d('0x32')](_0x1711fe[_0x168d('0x34')],qs['fields'](_0x144c7f[_0x168d('0x2f')][_0x168d('0x35')]));_0x376408['attributes']=_0x376408[_0x168d('0x33')][_0x168d('0x48')]?_0x376408['attributes']:_0x1711fe['model'];_0x376408['order']=qs[_0x168d('0x39')](_0x144c7f[_0x168d('0x2f')]['sort']);_0x376408[_0x168d('0x3a')]=qs[_0x168d('0x31')](_[_0x168d('0x3b')](_0x144c7f[_0x168d('0x2f')],_0x1711fe[_0x168d('0x31')]));if(_0x144c7f['query'][_0x168d('0x3e')]){_0x376408['where']=_[_0x168d('0x3c')](_0x376408[_0x168d('0x3a')],{'$or':_[_0x168d('0x2b')](_0x376408[_0x168d('0x33')],function(_0x4631d1){var _0x743aea={};_0x743aea[_0x4631d1]={'$like':'%'+_0x144c7f[_0x168d('0x2f')]['filter']+'%'};return _0x743aea;})});}_0x376408=_[_0x168d('0x3c')]({},_0x376408,_0x144c7f[_0x168d('0x3f')]);return _0x55da5d['getActions'](_0x376408);}})['then'](function(_0x516c15){if(_0x516c15){_0x430e2b=_0x516c15[_0x168d('0x48')];if(!_0x144c7f['query'][_0x168d('0x36')](_0x168d('0x37'))){_0x376408['limit']=qs[_0x168d('0x20')](_0x144c7f[_0x168d('0x2f')][_0x168d('0x20')]);_0x376408[_0x168d('0x22')]=qs[_0x168d('0x22')](_0x144c7f[_0x168d('0x2f')]['offset']);}return _0x55da5d['getActions'](_0x376408);}})[_0x168d('0x26')](function(_0x4244c1){if(_0x4244c1){return _0x4244c1?{'count':_0x430e2b,'rows':_0x4244c1}:null;}})[_0x168d('0x26')](respondWithResult(_0x194dd6,null))[_0x168d('0x44')](handleError(_0x194dd6,null));}; \ No newline at end of file +var _0x25c6=['VIRTUAL','name','includeAll','rows','params','rawAttributes','keys','include','options','find','catch','create','body','destroy','addConditions','Condition','ids','omit','getConditions','findOne','length','pick','addActions','Action','getActions','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','error','stack','send','index','map','Automation','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge'];(function(_0x2d3e56,_0x23317c){var _0x1903b6=function(_0x56214b){while(--_0x56214b){_0x2d3e56['push'](_0x2d3e56['shift']());}};_0x1903b6(++_0x23317c);}(_0x25c6,0x171));var _0x625c=function(_0x44ede8,_0x4e1b37){_0x44ede8=_0x44ede8-0x0;var _0x12fa9d=_0x25c6[_0x44ede8];return _0x12fa9d;};'use strict';var emlformat=require(_0x625c('0x0'));var rimraf=require(_0x625c('0x1'));var zipdir=require(_0x625c('0x2'));var jsonpatch=require(_0x625c('0x3'));var rp=require(_0x625c('0x4'));var moment=require(_0x625c('0x5'));var BPromise=require(_0x625c('0x6'));var Mustache=require('mustache');var util=require(_0x625c('0x7'));var path=require('path');var sox=require(_0x625c('0x8'));var csv=require(_0x625c('0x9'));var ejs=require(_0x625c('0xa'));var fs=require('fs');var fs_extra=require(_0x625c('0xb'));var _=require(_0x625c('0xc'));var squel=require('squel');var crypto=require(_0x625c('0xd'));var jsforce=require(_0x625c('0xe'));var deskjs=require(_0x625c('0xf'));var toCsv=require(_0x625c('0x9'));var querystring=require(_0x625c('0x10'));var Papa=require(_0x625c('0x11'));var Redis=require(_0x625c('0x12'));var authService=require(_0x625c('0x13'));var qs=require(_0x625c('0x14'));var as=require(_0x625c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x625c('0x16'))('api');var utils=require(_0x625c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x625c('0x18'));var db=require(_0x625c('0x19'))['db'];function respondWithStatusCode(_0x62ebf6,_0x54348d){_0x54348d=_0x54348d||0xcc;return function(_0x485be9){if(_0x485be9){return _0x62ebf6[_0x625c('0x1a')](_0x54348d);}return _0x62ebf6[_0x625c('0x1b')](_0x54348d)[_0x625c('0x1c')]();};}function respondWithResult(_0x13d8f0,_0x416fa7){_0x416fa7=_0x416fa7||0xc8;return function(_0x5d5212){if(_0x5d5212){return _0x13d8f0[_0x625c('0x1b')](_0x416fa7)[_0x625c('0x1d')](_0x5d5212);}};}function respondWithFilteredResult(_0x7aae1,_0x4b73f3){return function(_0x17e628){if(_0x17e628){var _0x4c4496=typeof _0x4b73f3[_0x625c('0x1e')]==='undefined'&&typeof _0x4b73f3[_0x625c('0x1f')]===_0x625c('0x20');var _0x1de42f=_0x17e628[_0x625c('0x21')];var _0x2d8cfd=_0x4c4496?0x0:_0x4b73f3['offset'];var _0x5b92be=_0x4c4496?_0x17e628['count']:_0x4b73f3[_0x625c('0x1e')]+_0x4b73f3['limit'];var _0x5ca2b2;if(_0x5b92be>=_0x1de42f){_0x5b92be=_0x1de42f;_0x5ca2b2=0xc8;}else{_0x5ca2b2=0xce;}_0x7aae1[_0x625c('0x1b')](_0x5ca2b2);return _0x7aae1['set'](_0x625c('0x22'),_0x2d8cfd+'-'+_0x5b92be+'/'+_0x1de42f)[_0x625c('0x1d')](_0x17e628);}return null;};}function patchUpdates(_0x46b1e5){return function(_0x3d8714){try{jsonpatch[_0x625c('0x23')](_0x3d8714,_0x46b1e5,!![]);}catch(_0x2b8e4d){return BPromise['reject'](_0x2b8e4d);}return _0x3d8714[_0x625c('0x24')]();};}function saveUpdates(_0x97d675,_0xab5999){return function(_0x9dc92a){if(_0x9dc92a){return _0x9dc92a[_0x625c('0x25')](_0x97d675)[_0x625c('0x26')](function(_0x39cee4){return _0x39cee4;});}return null;};}function removeEntity(_0x3168a3,_0xc65d09){return function(_0x45bb3a){if(_0x45bb3a){return _0x45bb3a['destroy']()[_0x625c('0x26')](function(){_0x3168a3[_0x625c('0x1b')](0xcc)[_0x625c('0x1c')]();});}};}function handleEntityNotFound(_0x444955,_0x3200fb){return function(_0x52c2f3){if(!_0x52c2f3){_0x444955[_0x625c('0x1a')](0x194);}return _0x52c2f3;};}function handleError(_0x5c74ab,_0x5992ce){_0x5992ce=_0x5992ce||0x1f4;return function(_0x8fe925){logger[_0x625c('0x27')](_0x8fe925[_0x625c('0x28')]);if(_0x8fe925['name']){delete _0x8fe925['name'];}_0x5c74ab[_0x625c('0x1b')](_0x5992ce)[_0x625c('0x29')](_0x8fe925);};}exports[_0x625c('0x2a')]=function(_0x41acf0,_0x2b9f53){var _0x5a56b3={},_0x522827={},_0x21cc04={'count':0x0,'rows':[]};var _0x1e298e=_[_0x625c('0x2b')](db[_0x625c('0x2c')]['rawAttributes'],function(_0xcbf885){return{'name':_0xcbf885[_0x625c('0x2d')],'type':_0xcbf885[_0x625c('0x2e')][_0x625c('0x2f')]};});_0x522827['model']=_[_0x625c('0x2b')](_0x1e298e,'name');_0x522827[_0x625c('0x30')]=_['keys'](_0x41acf0[_0x625c('0x30')]);_0x522827[_0x625c('0x31')]=_[_0x625c('0x32')](_0x522827[_0x625c('0x33')],_0x522827[_0x625c('0x30')]);_0x5a56b3[_0x625c('0x34')]=_['intersection'](_0x522827[_0x625c('0x33')],qs[_0x625c('0x35')](_0x41acf0[_0x625c('0x30')][_0x625c('0x35')]));_0x5a56b3[_0x625c('0x34')]=_0x5a56b3[_0x625c('0x34')]['length']?_0x5a56b3[_0x625c('0x34')]:_0x522827[_0x625c('0x33')];if(!_0x41acf0[_0x625c('0x30')][_0x625c('0x36')](_0x625c('0x37'))){_0x5a56b3['limit']=qs['limit'](_0x41acf0['query'][_0x625c('0x1f')]);_0x5a56b3[_0x625c('0x1e')]=qs[_0x625c('0x1e')](_0x41acf0[_0x625c('0x30')]['offset']);}_0x5a56b3[_0x625c('0x38')]=qs[_0x625c('0x39')](_0x41acf0[_0x625c('0x30')]['sort']);_0x5a56b3['where']=qs['filters'](_['pick'](_0x41acf0[_0x625c('0x30')],_0x522827[_0x625c('0x31')]),_0x1e298e);if(_0x41acf0[_0x625c('0x30')][_0x625c('0x3a')]){_0x5a56b3[_0x625c('0x3b')]=_[_0x625c('0x3c')](_0x5a56b3[_0x625c('0x3b')],{'$or':_['map'](_0x1e298e,function(_0x3433a4){if(_0x3433a4[_0x625c('0x2e')]!==_0x625c('0x3d')){var _0x1025a3={};_0x1025a3[_0x3433a4[_0x625c('0x3e')]]={'$like':'%'+_0x41acf0[_0x625c('0x30')][_0x625c('0x3a')]+'%'};return _0x1025a3;}})});}_0x5a56b3=_[_0x625c('0x3c')]({},_0x5a56b3,_0x41acf0['options']);var _0x42b05e={'where':_0x5a56b3[_0x625c('0x3b')]};return db[_0x625c('0x2c')][_0x625c('0x21')](_0x42b05e)[_0x625c('0x26')](function(_0x3991be){_0x21cc04[_0x625c('0x21')]=_0x3991be;if(_0x41acf0[_0x625c('0x30')][_0x625c('0x3f')]){_0x5a56b3['include']=[{'all':!![]}];}return db[_0x625c('0x2c')]['findAll'](_0x5a56b3);})[_0x625c('0x26')](function(_0x2d4afc){_0x21cc04[_0x625c('0x40')]=_0x2d4afc;return _0x21cc04;})[_0x625c('0x26')](respondWithFilteredResult(_0x2b9f53,_0x5a56b3))['catch'](handleError(_0x2b9f53,null));};exports['show']=function(_0x38a024,_0x46f16f){var _0x52ce2d={'raw':![],'where':{'id':_0x38a024[_0x625c('0x41')]['id']}},_0x1d859a={};_0x1d859a[_0x625c('0x33')]=_['keys'](db[_0x625c('0x2c')][_0x625c('0x42')]);_0x1d859a['query']=_[_0x625c('0x43')](_0x38a024['query']);_0x1d859a[_0x625c('0x31')]=_[_0x625c('0x32')](_0x1d859a[_0x625c('0x33')],_0x1d859a[_0x625c('0x30')]);_0x52ce2d[_0x625c('0x34')]=_[_0x625c('0x32')](_0x1d859a[_0x625c('0x33')],qs[_0x625c('0x35')](_0x38a024[_0x625c('0x30')][_0x625c('0x35')]));_0x52ce2d[_0x625c('0x34')]=_0x52ce2d[_0x625c('0x34')]['length']?_0x52ce2d[_0x625c('0x34')]:_0x1d859a[_0x625c('0x33')];if(_0x38a024['query'][_0x625c('0x3f')]){_0x52ce2d[_0x625c('0x44')]=[{'all':!![]}];}_0x52ce2d=_[_0x625c('0x3c')]({},_0x52ce2d,_0x38a024[_0x625c('0x45')]);return db[_0x625c('0x2c')][_0x625c('0x46')](_0x52ce2d)['then'](handleEntityNotFound(_0x46f16f,null))[_0x625c('0x26')](respondWithResult(_0x46f16f,null))[_0x625c('0x47')](handleError(_0x46f16f,null));};exports[_0x625c('0x48')]=function(_0x2c0407,_0x5c976c){return db[_0x625c('0x2c')][_0x625c('0x48')](_0x2c0407[_0x625c('0x49')],{})[_0x625c('0x26')](respondWithResult(_0x5c976c,0xc9))[_0x625c('0x47')](handleError(_0x5c976c,null));};exports[_0x625c('0x25')]=function(_0x39dcab,_0x5de86f){if(_0x39dcab['body']['id']){delete _0x39dcab[_0x625c('0x49')]['id'];}return db[_0x625c('0x2c')][_0x625c('0x46')]({'where':{'id':_0x39dcab[_0x625c('0x41')]['id']}})[_0x625c('0x26')](handleEntityNotFound(_0x5de86f,null))[_0x625c('0x26')](saveUpdates(_0x39dcab[_0x625c('0x49')],null))[_0x625c('0x26')](respondWithResult(_0x5de86f,null))[_0x625c('0x47')](handleError(_0x5de86f,null));};exports[_0x625c('0x4a')]=function(_0x2402ad,_0x20e874){return db[_0x625c('0x2c')][_0x625c('0x46')]({'where':{'id':_0x2402ad[_0x625c('0x41')]['id']}})['then'](handleEntityNotFound(_0x20e874,null))[_0x625c('0x26')](removeEntity(_0x20e874,null))['catch'](handleError(_0x20e874,null));};exports[_0x625c('0x4b')]=function(_0x1f462e,_0x33e532,_0x11a09){return db[_0x625c('0x4c')][_0x625c('0x46')]({'where':{'id':_0x1f462e[_0x625c('0x41')]['id']}})['then'](handleEntityNotFound(_0x33e532,null))['then'](function(_0x14ebde){if(_0x14ebde){return _0x14ebde['addConditions'](_0x1f462e['body'][_0x625c('0x4d')],_[_0x625c('0x4e')](_0x1f462e[_0x625c('0x49')],[_0x625c('0x4d'),'id'])||{});}})[_0x625c('0x26')](respondWithResult(_0x33e532,null))['catch'](handleError(_0x33e532,null));};exports[_0x625c('0x4f')]=function(_0xeddde,_0x3782fb,_0x225e6a){var _0x192e89={};var _0x25a7a2={};var _0x56984d;var _0x5f4104;return db[_0x625c('0x2c')][_0x625c('0x50')]({'where':{'id':_0xeddde[_0x625c('0x41')]['id']}})['then'](handleEntityNotFound(_0x3782fb,null))[_0x625c('0x26')](function(_0x2749f6){if(_0x2749f6){_0x56984d=_0x2749f6;_0x25a7a2[_0x625c('0x33')]=_['keys'](db[_0x625c('0x4c')][_0x625c('0x42')]);_0x25a7a2['query']=_[_0x625c('0x43')](_0xeddde[_0x625c('0x30')]);_0x25a7a2['filters']=_['intersection'](_0x25a7a2[_0x625c('0x33')],_0x25a7a2[_0x625c('0x30')]);_0x192e89[_0x625c('0x34')]=_[_0x625c('0x32')](_0x25a7a2[_0x625c('0x33')],qs[_0x625c('0x35')](_0xeddde['query']['fields']));_0x192e89[_0x625c('0x34')]=_0x192e89[_0x625c('0x34')][_0x625c('0x51')]?_0x192e89[_0x625c('0x34')]:_0x25a7a2[_0x625c('0x33')];_0x192e89[_0x625c('0x38')]=qs[_0x625c('0x39')](_0xeddde[_0x625c('0x30')][_0x625c('0x39')]);_0x192e89[_0x625c('0x3b')]=qs[_0x625c('0x31')](_[_0x625c('0x52')](_0xeddde[_0x625c('0x30')],_0x25a7a2[_0x625c('0x31')]));if(_0xeddde[_0x625c('0x30')][_0x625c('0x3a')]){_0x192e89[_0x625c('0x3b')]=_['merge'](_0x192e89['where'],{'$or':_['map'](_0x192e89[_0x625c('0x34')],function(_0x1ce9e3){var _0x375f01={};_0x375f01[_0x1ce9e3]={'$like':'%'+_0xeddde[_0x625c('0x30')][_0x625c('0x3a')]+'%'};return _0x375f01;})});}_0x192e89=_[_0x625c('0x3c')]({},_0x192e89,_0xeddde[_0x625c('0x45')]);return _0x56984d[_0x625c('0x4f')](_0x192e89);}})[_0x625c('0x26')](function(_0x5977b8){if(_0x5977b8){_0x5f4104=_0x5977b8[_0x625c('0x51')];if(!_0xeddde[_0x625c('0x30')][_0x625c('0x36')](_0x625c('0x37'))){_0x192e89['limit']=qs['limit'](_0xeddde[_0x625c('0x30')][_0x625c('0x1f')]);_0x192e89['offset']=qs['offset'](_0xeddde['query'][_0x625c('0x1e')]);}return _0x56984d['getConditions'](_0x192e89);}})['then'](function(_0x330249){if(_0x330249){return _0x330249?{'count':_0x5f4104,'rows':_0x330249}:null;}})['then'](respondWithResult(_0x3782fb,null))[_0x625c('0x47')](handleError(_0x3782fb,null));};exports[_0x625c('0x53')]=function(_0x52ca4b,_0x3f33d9,_0x5503bf){return db['Action'][_0x625c('0x46')]({'where':{'id':_0x52ca4b[_0x625c('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f33d9,null))[_0x625c('0x26')](function(_0x53a714){if(_0x53a714){return _0x53a714[_0x625c('0x53')](_0x52ca4b[_0x625c('0x49')][_0x625c('0x4d')],_[_0x625c('0x4e')](_0x52ca4b[_0x625c('0x49')],[_0x625c('0x4d'),'id'])||{});}})[_0x625c('0x26')](respondWithResult(_0x3f33d9,null))[_0x625c('0x47')](handleError(_0x3f33d9,null));};exports['getActions']=function(_0x41a929,_0x3671a7,_0x178e26){var _0x5ec123={};var _0xa28028={};var _0x17f8f7;var _0x316a5d;return db[_0x625c('0x2c')][_0x625c('0x50')]({'where':{'id':_0x41a929['params']['id']}})[_0x625c('0x26')](handleEntityNotFound(_0x3671a7,null))['then'](function(_0x329a5a){if(_0x329a5a){_0x17f8f7=_0x329a5a;_0xa28028['model']=_[_0x625c('0x43')](db[_0x625c('0x54')][_0x625c('0x42')]);_0xa28028[_0x625c('0x30')]=_[_0x625c('0x43')](_0x41a929['query']);_0xa28028[_0x625c('0x31')]=_[_0x625c('0x32')](_0xa28028[_0x625c('0x33')],_0xa28028[_0x625c('0x30')]);_0x5ec123['attributes']=_['intersection'](_0xa28028[_0x625c('0x33')],qs[_0x625c('0x35')](_0x41a929[_0x625c('0x30')]['fields']));_0x5ec123[_0x625c('0x34')]=_0x5ec123[_0x625c('0x34')]['length']?_0x5ec123[_0x625c('0x34')]:_0xa28028[_0x625c('0x33')];_0x5ec123['order']=qs[_0x625c('0x39')](_0x41a929[_0x625c('0x30')][_0x625c('0x39')]);_0x5ec123[_0x625c('0x3b')]=qs[_0x625c('0x31')](_[_0x625c('0x52')](_0x41a929['query'],_0xa28028[_0x625c('0x31')]));if(_0x41a929['query'][_0x625c('0x3a')]){_0x5ec123[_0x625c('0x3b')]=_[_0x625c('0x3c')](_0x5ec123['where'],{'$or':_[_0x625c('0x2b')](_0x5ec123[_0x625c('0x34')],function(_0x2346c4){var _0x6cd3a2={};_0x6cd3a2[_0x2346c4]={'$like':'%'+_0x41a929['query'][_0x625c('0x3a')]+'%'};return _0x6cd3a2;})});}_0x5ec123=_[_0x625c('0x3c')]({},_0x5ec123,_0x41a929['options']);return _0x17f8f7['getActions'](_0x5ec123);}})[_0x625c('0x26')](function(_0x45b261){if(_0x45b261){_0x316a5d=_0x45b261['length'];if(!_0x41a929[_0x625c('0x30')]['hasOwnProperty'](_0x625c('0x37'))){_0x5ec123['limit']=qs[_0x625c('0x1f')](_0x41a929['query'][_0x625c('0x1f')]);_0x5ec123[_0x625c('0x1e')]=qs[_0x625c('0x1e')](_0x41a929[_0x625c('0x30')]['offset']);}return _0x17f8f7[_0x625c('0x55')](_0x5ec123);}})[_0x625c('0x26')](function(_0x366132){if(_0x366132){return _0x366132?{'count':_0x316a5d,'rows':_0x366132}:null;}})[_0x625c('0x26')](respondWithResult(_0x3671a7,null))[_0x625c('0x47')](handleError(_0x3671a7,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 0b0bb66..a5dff0c 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 _0x7426=['../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x94312,_0x512ea1){var _0x1a34eb=function(_0x1ea10c){while(--_0x1ea10c){_0x94312['push'](_0x94312['shift']());}};_0x1a34eb(++_0x512ea1);}(_0x7426,0xa2));var _0x6742=function(_0x3c9c45,_0x1fc52a){_0x3c9c45=_0x3c9c45-0x0;var _0x544045=_0x7426[_0x3c9c45];return _0x544045;};'use strict';var _=require(_0x6742('0x0'));var util=require(_0x6742('0x1'));var logger=require(_0x6742('0x2'))(_0x6742('0x3'));var moment=require(_0x6742('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6742('0x5'));var config=require(_0x6742('0x6'));var attributes=require(_0x6742('0x7'));module[_0x6742('0x8')]=function(_0x5e2503,_0x28afe4){return _0x5e2503[_0x6742('0x9')](_0x6742('0xa'),attributes,{'tableName':_0x6742('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe030=['rimraf','../../config/environment','define','tools_automations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3a8072,_0x110349){var _0x49579e=function(_0x1206c5){while(--_0x1206c5){_0x3a8072['push'](_0x3a8072['shift']());}};_0x49579e(++_0x110349);}(_0xe030,0xc1));var _0x0e03=function(_0x259ce8,_0x798276){_0x259ce8=_0x259ce8-0x0;var _0x5ef5c2=_0xe030[_0x259ce8];return _0x5ef5c2;};'use strict';var _=require(_0x0e03('0x0'));var util=require(_0x0e03('0x1'));var logger=require(_0x0e03('0x2'))('api');var moment=require(_0x0e03('0x3'));var BPromise=require(_0x0e03('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0e03('0x5'));var config=require(_0x0e03('0x6'));var attributes=require('./automation.attributes');module['exports']=function(_0x5a99d5,_0x118278){return _0x5a99d5[_0x0e03('0x7')]('Automation',attributes,{'tableName':_0x0e03('0x8'),'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 dcbbbef..a5ebc07 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 _0x00ea=['rpc','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b5abb,_0x11a93c){var _0x17f5be=function(_0x22e1fa){while(--_0x22e1fa){_0x3b5abb['push'](_0x3b5abb['shift']());}};_0x17f5be(++_0x11a93c);}(_0x00ea,0x19d));var _0xa00e=function(_0x1ae96d,_0x2d857b){_0x1ae96d=_0x1ae96d-0x0;var _0x220aca=_0x00ea[_0x1ae96d];return _0x220aca;};'use strict';var _=require('lodash');var util=require(_0xa00e('0x0'));var moment=require(_0xa00e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa00e('0x2'));var fs=require('fs');var Redis=require(_0xa00e('0x3'));var db=require(_0xa00e('0x4'))['db'];var utils=require(_0xa00e('0x5'));var logger=require(_0xa00e('0x6'))(_0xa00e('0x7'));var config=require('../../config/environment');var jayson=require(_0xa00e('0x8'));var client=jayson[_0xa00e('0x9')][_0xa00e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aab60,_0x5b09ef,_0x46f5fa){return new BPromise(function(_0x7f530c,_0x48dba0){return client[_0xa00e('0xb')](_0x2aab60,_0x46f5fa)[_0xa00e('0xc')](function(_0x48760e){logger[_0xa00e('0xd')](_0xa00e('0xe'),_0x5b09ef,_0xa00e('0xf'));logger['debug'](_0xa00e('0x10'),_0x5b09ef,_0xa00e('0xf'),JSON['stringify'](_0x48760e));if(_0x48760e[_0xa00e('0x11')]){if(_0x48760e['error'][_0xa00e('0x12')]===0x1f4){logger[_0xa00e('0x11')](_0xa00e('0xe'),_0x5b09ef,_0x48760e[_0xa00e('0x11')]['message']);return _0x48dba0(_0x48760e[_0xa00e('0x11')][_0xa00e('0x13')]);}logger['error'](_0xa00e('0xe'),_0x5b09ef,_0x48760e['error'][_0xa00e('0x13')]);return _0x7f530c(_0x48760e[_0xa00e('0x11')][_0xa00e('0x13')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x5b09ef,_0xa00e('0xf'));_0x7f530c(_0x48760e['result'][_0xa00e('0x13')]);}})[_0xa00e('0x14')](function(_0x1d0095){logger[_0xa00e('0x11')](_0xa00e('0xe'),_0x5b09ef,_0x1d0095);_0x48dba0(_0x1d0095);});});} \ No newline at end of file +var _0x639a=['debug','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent'];(function(_0x5ad428,_0x591368){var _0x51f70e=function(_0x26067f){while(--_0x26067f){_0x5ad428['push'](_0x5ad428['shift']());}};_0x51f70e(++_0x591368);}(_0x639a,0x1e8));var _0xa639=function(_0x52f94e,_0x1ea1dc){_0x52f94e=_0x52f94e-0x0;var _0x496f74=_0x639a[_0x52f94e];return _0x496f74;};'use strict';var _=require(_0xa639('0x0'));var util=require(_0xa639('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa639('0x2'));var fs=require('fs');var Redis=require(_0xa639('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa639('0x4'));var logger=require(_0xa639('0x5'))(_0xa639('0x6'));var config=require(_0xa639('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa639('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x276815,_0x38b779,_0x277b76){return new BPromise(function(_0x2f4bce,_0x41a185){return client['request'](_0x276815,_0x277b76)[_0xa639('0x9')](function(_0x16d090){logger[_0xa639('0xa')]('Automation,\x20%s,\x20%s',_0x38b779,_0xa639('0xb'));logger[_0xa639('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x38b779,_0xa639('0xb'),JSON[_0xa639('0xd')](_0x16d090));if(_0x16d090['error']){if(_0x16d090[_0xa639('0xe')][_0xa639('0xf')]===0x1f4){logger['error'](_0xa639('0x10'),_0x38b779,_0x16d090[_0xa639('0xe')][_0xa639('0x11')]);return _0x41a185(_0x16d090[_0xa639('0xe')][_0xa639('0x11')]);}logger[_0xa639('0xe')](_0xa639('0x10'),_0x38b779,_0x16d090['error'][_0xa639('0x11')]);return _0x2f4bce(_0x16d090[_0xa639('0xe')][_0xa639('0x11')]);}else{logger[_0xa639('0xa')](_0xa639('0x10'),_0x38b779,_0xa639('0xb'));_0x2f4bce(_0x16d090[_0xa639('0x12')][_0xa639('0x11')]);}})[_0xa639('0x13')](function(_0x58eded){logger[_0xa639('0xe')](_0xa639('0x10'),_0x38b779,_0x58eded);_0x41a185(_0x58eded);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 4ec8e1a..c33cfb9 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 _0x7aa7=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','put','delete','destroy','exports'];(function(_0x3b4adb,_0x18f96c){var _0x22cce9=function(_0x2e85d7){while(--_0x2e85d7){_0x3b4adb['push'](_0x3b4adb['shift']());}};_0x22cce9(++_0x18f96c);}(_0x7aa7,0xfd));var _0x77aa=function(_0x3524ec,_0x24fb73){_0x3524ec=_0x3524ec-0x0;var _0x273ddc=_0x7aa7[_0x3524ec];return _0x273ddc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x77aa('0x0'));var timeout=require(_0x77aa('0x1'));var express=require(_0x77aa('0x2'));var router=express['Router']();var fs_extra=require(_0x77aa('0x3'));var auth=require(_0x77aa('0x4'));var interaction=require(_0x77aa('0x5'));var config=require(_0x77aa('0x6'));var controller=require(_0x77aa('0x7'));router[_0x77aa('0x8')]('/',auth[_0x77aa('0x9')](),controller[_0x77aa('0xa')]);router['get'](_0x77aa('0xb'),auth[_0x77aa('0x9')](),controller[_0x77aa('0xc')]);router[_0x77aa('0x8')](_0x77aa('0xd'),auth[_0x77aa('0x9')](),controller[_0x77aa('0xe')]);router['get'](_0x77aa('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0x77aa('0x10')]('/',auth[_0x77aa('0x9')](),controller[_0x77aa('0x11')]);router[_0x77aa('0x10')](_0x77aa('0xd'),auth['isAuthenticated'](),controller[_0x77aa('0x12')]);router[_0x77aa('0x10')](_0x77aa('0xf'),auth[_0x77aa('0x9')](),controller['addActions']);router[_0x77aa('0x13')](_0x77aa('0xb'),auth[_0x77aa('0x9')](),controller['update']);router[_0x77aa('0x14')]('/:id',auth[_0x77aa('0x9')](),controller[_0x77aa('0x15')]);module[_0x77aa('0x16')]=router; \ No newline at end of file +var _0xe953=['post','addConditions','addActions','put','update','delete','destroy','exports','Router','fs-extra','../../components/interaction/service','./automation.controller','isAuthenticated','index','get','/:id','/:id/conditions','/:id/actions','getActions'];(function(_0x4e2ace,_0xebc616){var _0x12e9ff=function(_0x2003b4){while(--_0x2003b4){_0x4e2ace['push'](_0x4e2ace['shift']());}};_0x12e9ff(++_0xebc616);}(_0xe953,0x1d0));var _0x3e95=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xe953[_0x5ddaac];return _0x2a9c58;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3e95('0x0')]();var fs_extra=require(_0x3e95('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x3e95('0x2'));var config=require('../../config/environment');var controller=require(_0x3e95('0x3'));router['get']('/',auth[_0x3e95('0x4')](),controller[_0x3e95('0x5')]);router[_0x3e95('0x6')](_0x3e95('0x7'),auth[_0x3e95('0x4')](),controller['show']);router[_0x3e95('0x6')](_0x3e95('0x8'),auth[_0x3e95('0x4')](),controller['getConditions']);router[_0x3e95('0x6')](_0x3e95('0x9'),auth[_0x3e95('0x4')](),controller[_0x3e95('0xa')]);router['post']('/',auth[_0x3e95('0x4')](),controller['create']);router[_0x3e95('0xb')](_0x3e95('0x8'),auth[_0x3e95('0x4')](),controller[_0x3e95('0xc')]);router[_0x3e95('0xb')](_0x3e95('0x9'),auth['isAuthenticated'](),controller[_0x3e95('0xd')]);router[_0x3e95('0xe')]('/:id',auth[_0x3e95('0x4')](),controller[_0x3e95('0xf')]);router[_0x3e95('0x10')](_0x3e95('0x7'),auth['isAuthenticated'](),controller[_0x3e95('0x11')]);module[_0x3e95('0x12')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 932c2cc..5973533 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 _0x7508=['INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0xdca4a6,_0x4965f6){var _0x5c5b95=function(_0x2c8fe7){while(--_0x2c8fe7){_0xdca4a6['push'](_0xdca4a6['shift']());}};_0x5c5b95(++_0x4965f6);}(_0x7508,0xc3));var _0x8750=function(_0x92f1b,_0x57f2d6){_0x92f1b=_0x92f1b-0x0;var _0x874d22=_0x7508[_0x92f1b];return _0x874d22;};'use strict';var Sequelize=require(_0x8750('0x0'));module['exports']={'name':{'type':Sequelize[_0x8750('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8750('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x8750('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8750('0x4')],'defaultValue':0x0,'comment':_0x8750('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x8750('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8750('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8750('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8750('0x6')],'defaultValue':0x3,'comment':_0x8750('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8750('0x10')},'dialTimezone':{'type':Sequelize[_0x8750('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8750('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8750('0x2')](_0x8750('0x11'),'never','onlyIfOpen'),'defaultValue':_0x8750('0x11')},'dialAMDActive':{'type':Sequelize[_0x8750('0x4')],'defaultValue':0x0,'comment':_0x8750('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8750('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8750('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x8750('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8750('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8750('0x9')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8750('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8750('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8750('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8750('0x2')](_0x8750('0x17'),_0x8750('0x18')),'defaultValue':_0x8750('0x17')},'dialPrefix':{'type':Sequelize[_0x8750('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x8750('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8750('0x19')},'dialCutDigit':{'type':Sequelize[_0x8750('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8750('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x21')}}; \ No newline at end of file +var _0x5bf9=['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)','ENUM','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#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)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5bf9,0xa2));var _0x95bf=function(_0xb712c6,_0x119df6){_0xb712c6=_0xb712c6-0x0;var _0x2ffcc9=_0x5bf9[_0xb712c6];return _0x2ffcc9;};'use strict';var Sequelize=require('sequelize');module[_0x95bf('0x0')]={'name':{'type':Sequelize[_0x95bf('0x1')],'unique':_0x95bf('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x95bf('0x3')),'allowNull':![],'defaultValue':_0x95bf('0x3')},'description':{'type':Sequelize[_0x95bf('0x1')]},'active':{'type':Sequelize[_0x95bf('0x4')],'defaultValue':0x0,'comment':_0x95bf('0x5')},'limitCalls':{'type':Sequelize[_0x95bf('0x6')](0x4)[_0x95bf('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x95bf('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x95bf('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x95bf('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x95bf('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x95bf('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x95bf('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95bf('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x95bf('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x95bf('0x6')](0x5)[_0x95bf('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95bf('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x95bf('0x6')](0x3)[_0x95bf('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x95bf('0x6')](0x5)[_0x95bf('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95bf('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x95bf('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x95bf('0xf')},'dialTimezone':{'type':Sequelize[_0x95bf('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x95bf('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x95bf('0x10')](_0x95bf('0x11'),'never',_0x95bf('0x12')),'defaultValue':_0x95bf('0x11')},'dialAMDActive':{'type':Sequelize[_0x95bf('0x4')],'defaultValue':0x0,'comment':_0x95bf('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x95bf('0x6')](0x9)[_0x95bf('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x95bf('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x95bf('0x6')](0x9)[_0x95bf('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x95bf('0x6')](0x9)[_0x95bf('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x95bf('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x95bf('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x95bf('0x6')](0x9)[_0x95bf('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x95bf('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x95bf('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x95bf('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x95bf('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x95bf('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x95bf('0x6')](0x9)[_0x95bf('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x95bf('0x10')](_0x95bf('0x1a'),'ASC'),'defaultValue':_0x95bf('0x1a')},'dialPrefix':{'type':Sequelize[_0x95bf('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x95bf('0x6')](0x3)[_0x95bf('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x95bf('0x1b')},'dialCutDigit':{'type':Sequelize[_0x95bf('0x6')](0x3)[_0x95bf('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x95bf('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x95bf('0x6')](0x3)[_0x95bf('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x95bf('0x6')](0x5)[_0x95bf('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x95bf('0x6')](0x3)[_0x95bf('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x95bf('0x6')](0x5)[_0x95bf('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95bf('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x95bf('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x95bf('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x95bf('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95bf('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x95bf('0x6')](0x3)[_0x95bf('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x95bf('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x95bf('0x6')](0x5)[_0x95bf('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95bf('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x95bf('0x6')](0x3)[_0x95bf('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x95bf('0x6')](0x5)[_0x95bf('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x95bf('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 17c25b9..c01d0d0 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 _0x90c5=['CampaignId','CmHopper','findAll','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','select','field','ContactId','toString','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_contacts','ListId','phone\x20IS\x20NOT\x20NULL','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','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','sendStatus','status','end','offset','undefined','count','limit','reject','save','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','map','Campaign','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','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','clone','omit','createdAt','updatedAt','update','getHoppers'];(function(_0x4b8dfd,_0x3efad5){var _0x55b94a=function(_0x443de7){while(--_0x443de7){_0x4b8dfd['push'](_0x4b8dfd['shift']());}};_0x55b94a(++_0x3efad5);}(_0x90c5,0xb4));var _0x590c=function(_0x3c0488,_0x5c74fb){_0x3c0488=_0x3c0488-0x0;var _0x4c0f26=_0x90c5[_0x3c0488];return _0x4c0f26;};'use strict';var emlformat=require(_0x590c('0x0'));var rimraf=require(_0x590c('0x1'));var zipdir=require(_0x590c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x590c('0x3'));var moment=require(_0x590c('0x4'));var BPromise=require(_0x590c('0x5'));var Mustache=require(_0x590c('0x6'));var util=require(_0x590c('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x590c('0x8'));var fs=require('fs');var fs_extra=require(_0x590c('0x9'));var _=require(_0x590c('0xa'));var squel=require(_0x590c('0xb'));var crypto=require(_0x590c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x590c('0xd'));var toCsv=require(_0x590c('0xe'));var querystring=require('querystring');var Papa=require(_0x590c('0xf'));var Redis=require(_0x590c('0x10'));var authService=require(_0x590c('0x11'));var qs=require(_0x590c('0x12'));var as=require(_0x590c('0x13'));var hardwareService=require(_0x590c('0x14'));var logger=require(_0x590c('0x15'))(_0x590c('0x16'));var utils=require(_0x590c('0x17'));var config=require(_0x590c('0x18'));var licenseUtil=require(_0x590c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e54f6,_0x4e310c){_0x4e310c=_0x4e310c||0xcc;return function(_0x3f617b){if(_0x3f617b){return _0x2e54f6[_0x590c('0x1a')](_0x4e310c);}return _0x2e54f6[_0x590c('0x1b')](_0x4e310c)[_0x590c('0x1c')]();};}function respondWithResult(_0x4862eb,_0x3f4fcf){_0x3f4fcf=_0x3f4fcf||0xc8;return function(_0x32d4e8){if(_0x32d4e8){return _0x4862eb['status'](_0x3f4fcf)['json'](_0x32d4e8);}};}function respondWithFilteredResult(_0x332dd1,_0x908ec0){return function(_0x503922){if(_0x503922){var _0x4c0214=typeof _0x908ec0[_0x590c('0x1d')]==='undefined'&&typeof _0x908ec0['limit']===_0x590c('0x1e');var _0x560e60=_0x503922['count'];var _0x2e2332=_0x4c0214?0x0:_0x908ec0[_0x590c('0x1d')];var _0x22aac8=_0x4c0214?_0x503922[_0x590c('0x1f')]:_0x908ec0['offset']+_0x908ec0[_0x590c('0x20')];var _0x1be593;if(_0x22aac8>=_0x560e60){_0x22aac8=_0x560e60;_0x1be593=0xc8;}else{_0x1be593=0xce;}_0x332dd1[_0x590c('0x1b')](_0x1be593);return _0x332dd1['set']('Content-Range',_0x2e2332+'-'+_0x22aac8+'/'+_0x560e60)['json'](_0x503922);}return null;};}function patchUpdates(_0x4e39ba){return function(_0x207094){try{jsonpatch['apply'](_0x207094,_0x4e39ba,!![]);}catch(_0x51c5a4){return BPromise[_0x590c('0x21')](_0x51c5a4);}return _0x207094[_0x590c('0x22')]();};}function saveUpdates(_0x3d0416,_0x18371a){return function(_0x1f329f){if(_0x1f329f){return _0x1f329f['update'](_0x3d0416)['then'](function(_0x205d29){return _0x205d29;});}return null;};}function removeEntity(_0x15fe93,_0x408e90){return function(_0x3c1b20){if(_0x3c1b20){return _0x3c1b20[_0x590c('0x23')]()[_0x590c('0x24')](function(){var _0x189380=_0x3c1b20[_0x590c('0x25')]({'plain':!![]});var _0xae88dd=_0x590c('0x26');return db[_0x590c('0x27')][_0x590c('0x23')]({'where':{'type':_0xae88dd,'resourceId':_0x189380['id']}})[_0x590c('0x24')](function(){return _0x3c1b20;});})['then'](function(){_0x15fe93[_0x590c('0x1b')](0xcc)[_0x590c('0x1c')]();});}};}function handleEntityNotFound(_0x1516db,_0x30fb7e){return function(_0x17520f){if(!_0x17520f){_0x1516db[_0x590c('0x1a')](0x194);}return _0x17520f;};}function handleError(_0x1ec69d,_0xf65ed4){_0xf65ed4=_0xf65ed4||0x1f4;return function(_0x475717){logger[_0x590c('0x28')](_0x475717[_0x590c('0x29')]);if(_0x475717[_0x590c('0x2a')]){delete _0x475717[_0x590c('0x2a')];}_0x1ec69d['status'](_0xf65ed4)[_0x590c('0x2b')](_0x475717);};}exports['index']=function(_0x544961,_0x1b2250){var _0x3ff1dd={},_0x3dfdb8={},_0x407e43={'count':0x0,'rows':[]};var _0x38927d=_[_0x590c('0x2c')](db[_0x590c('0x2d')][_0x590c('0x2e')],function(_0x326832){return{'name':_0x326832[_0x590c('0x2f')],'type':_0x326832[_0x590c('0x30')]['key']};});_0x3dfdb8[_0x590c('0x31')]=_[_0x590c('0x2c')](_0x38927d,_0x590c('0x2a'));_0x3dfdb8[_0x590c('0x32')]=_[_0x590c('0x33')](_0x544961[_0x590c('0x32')]);_0x3dfdb8['filters']=_[_0x590c('0x34')](_0x3dfdb8[_0x590c('0x31')],_0x3dfdb8['query']);_0x3ff1dd[_0x590c('0x35')]=_['intersection'](_0x3dfdb8[_0x590c('0x31')],qs[_0x590c('0x36')](_0x544961['query']['fields']));_0x3ff1dd['attributes']=_0x3ff1dd['attributes'][_0x590c('0x37')]?_0x3ff1dd[_0x590c('0x35')]:_0x3dfdb8['model'];if(!_0x544961[_0x590c('0x32')][_0x590c('0x38')](_0x590c('0x39'))){_0x3ff1dd['limit']=qs[_0x590c('0x20')](_0x544961[_0x590c('0x32')][_0x590c('0x20')]);_0x3ff1dd[_0x590c('0x1d')]=qs[_0x590c('0x1d')](_0x544961[_0x590c('0x32')][_0x590c('0x1d')]);}_0x3ff1dd[_0x590c('0x3a')]=qs['sort'](_0x544961[_0x590c('0x32')][_0x590c('0x3b')]);_0x3ff1dd[_0x590c('0x3c')]=qs['filters'](_[_0x590c('0x3d')](_0x544961[_0x590c('0x32')],_0x3dfdb8[_0x590c('0x3e')]),_0x38927d);if(_0x544961[_0x590c('0x32')][_0x590c('0x3f')]){_0x3ff1dd[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x3ff1dd[_0x590c('0x3c')],{'$or':_[_0x590c('0x2c')](_0x38927d,function(_0x1712eb){if(_0x1712eb['type']!==_0x590c('0x41')){var _0xb95c5d={};_0xb95c5d[_0x1712eb[_0x590c('0x2a')]]={'$like':'%'+_0x544961[_0x590c('0x32')][_0x590c('0x3f')]+'%'};return _0xb95c5d;}})});}_0x3ff1dd=_[_0x590c('0x40')]({},_0x3ff1dd,_0x544961[_0x590c('0x42')]);var _0x3253fb={'where':_0x3ff1dd[_0x590c('0x3c')]};return db[_0x590c('0x2d')][_0x590c('0x1f')](_0x3253fb)[_0x590c('0x24')](function(_0x562183){_0x407e43[_0x590c('0x1f')]=_0x562183;if(_0x544961[_0x590c('0x32')][_0x590c('0x43')]){_0x3ff1dd[_0x590c('0x44')]=[{'all':!![]}];}return db[_0x590c('0x2d')]['findAll'](_0x3ff1dd);})[_0x590c('0x24')](function(_0x576cd9){_0x407e43[_0x590c('0x45')]=_0x576cd9;return _0x407e43;})[_0x590c('0x24')](respondWithFilteredResult(_0x1b2250,_0x3ff1dd))[_0x590c('0x46')](handleError(_0x1b2250,null));};exports['show']=function(_0x366eda,_0x415391){var _0x4aa2b8={'raw':![],'where':{'id':_0x366eda[_0x590c('0x47')]['id']}},_0x15fc96={};_0x15fc96[_0x590c('0x31')]=_[_0x590c('0x33')](db['Campaign'][_0x590c('0x2e')]);_0x15fc96[_0x590c('0x32')]=_[_0x590c('0x33')](_0x366eda[_0x590c('0x32')]);_0x15fc96[_0x590c('0x3e')]=_['intersection'](_0x15fc96[_0x590c('0x31')],_0x15fc96['query']);_0x4aa2b8[_0x590c('0x35')]=_['intersection'](_0x15fc96['model'],qs[_0x590c('0x36')](_0x366eda[_0x590c('0x32')]['fields']));_0x4aa2b8['attributes']=_0x4aa2b8['attributes'][_0x590c('0x37')]?_0x4aa2b8[_0x590c('0x35')]:_0x15fc96[_0x590c('0x31')];if(_0x366eda[_0x590c('0x32')][_0x590c('0x43')]){_0x4aa2b8[_0x590c('0x44')]=[{'all':!![]}];}_0x4aa2b8=_['merge']({},_0x4aa2b8,_0x366eda['options']);return db['Campaign'][_0x590c('0x48')](_0x4aa2b8)[_0x590c('0x24')](handleEntityNotFound(_0x415391,null))[_0x590c('0x24')](respondWithResult(_0x415391,null))[_0x590c('0x46')](handleError(_0x415391,null));};exports['create']=function(_0x2e60f2,_0x144678){return db[_0x590c('0x2d')][_0x590c('0x49')](_0x2e60f2[_0x590c('0x4a')],{})[_0x590c('0x24')](function(_0x588372){var _0x28a4b2=_0x2e60f2[_0x590c('0x4b')][_0x590c('0x25')]({'plain':!![]});if(!_0x28a4b2)throw new Error(_0x590c('0x4c'));if(_0x28a4b2[_0x590c('0x4d')]===_0x590c('0x4b')){var _0x5435b5=_0x588372[_0x590c('0x25')]({'plain':!![]});var _0x29d835='IvrCampaigns';return db[_0x590c('0x4e')][_0x590c('0x48')]({'where':{'name':_0x29d835,'userProfileId':_0x28a4b2[_0x590c('0x4f')]},'raw':!![]})[_0x590c('0x24')](function(_0x481a86){if(_0x481a86&&_0x481a86[_0x590c('0x50')]===0x0){return db[_0x590c('0x27')][_0x590c('0x49')]({'name':_0x5435b5['name'],'resourceId':_0x5435b5['id'],'type':_0x481a86[_0x590c('0x2a')],'sectionId':_0x481a86['id']},{})['then'](function(){return _0x588372;});}else{return _0x588372;}})[_0x590c('0x46')](function(_0x4119a3){logger[_0x590c('0x28')](_0x590c('0x51'),_0x4119a3);throw _0x4119a3;});}return _0x588372;})[_0x590c('0x24')](respondWithResult(_0x144678,0xc9))[_0x590c('0x46')](handleError(_0x144678,null));};exports[_0x590c('0x52')]=function(_0x18322e,_0x4eb5f0){var _0x1ed5f8={'where':{'id':_0x18322e[_0x590c('0x47')]['id']}},_0x8dee3={};_0x8dee3[_0x590c('0x31')]=_[_0x590c('0x33')](db['Campaign'][_0x590c('0x2e')]);_0x1ed5f8['attributes']=_['intersection'](_0x8dee3[_0x590c('0x31')],qs[_0x590c('0x36')](_0x18322e['query'][_0x590c('0x36')]));_0x1ed5f8[_0x590c('0x35')]=_0x1ed5f8[_0x590c('0x35')][_0x590c('0x37')]?_0x1ed5f8[_0x590c('0x35')]:_0x8dee3['model'];if(_0x18322e[_0x590c('0x32')][_0x590c('0x43')]){_0x1ed5f8[_0x590c('0x44')]=[{'all':!![]}];}_0x1ed5f8=_[_0x590c('0x40')]({},_0x1ed5f8,_0x18322e['options']);return db['Campaign'][_0x590c('0x48')](_0x1ed5f8)['then'](handleEntityNotFound(_0x4eb5f0,null))[_0x590c('0x24')](function(_0x6bd12b){if(_0x6bd12b){var _0x353938=_0x6bd12b[_0x590c('0x25')]({'plain':!![]});_0x353938=qs[_0x590c('0x53')](_0x353938,['id',_0x590c('0x54'),_0x590c('0x55')]);_0x18322e['body']=_[_0x590c('0x53')](_0x18322e[_0x590c('0x4a')],['id',_0x590c('0x54'),_0x590c('0x55')]);return db['Campaign'][_0x590c('0x49')](_[_0x590c('0x40')](_0x353938,_0x18322e[_0x590c('0x4a')]),{'include':_0x18322e[_0x590c('0x32')][_0x590c('0x43')]?[{'all':!![]}]:undefined})[_0x590c('0x24')](function(_0x50c32b){var _0x275993=_0x18322e['user'][_0x590c('0x25')]({'plain':!![]});if(!_0x275993)throw new Error(_0x590c('0x4c'));if(_0x275993[_0x590c('0x4d')]===_0x590c('0x4b')){var _0x450431=_0x50c32b['get']({'plain':!![]});var _0x30c3d8=_0x590c('0x26');return db[_0x590c('0x4e')][_0x590c('0x48')]({'where':{'name':_0x30c3d8,'userProfileId':_0x275993['userProfileId']},'raw':!![]})[_0x590c('0x24')](function(_0x410c0b){if(_0x410c0b&&_0x410c0b[_0x590c('0x50')]===0x0){return db[_0x590c('0x27')]['create']({'name':_0x450431['name'],'resourceId':_0x450431['id'],'type':_0x410c0b['name'],'sectionId':_0x410c0b['id']},{})[_0x590c('0x24')](function(){return _0x50c32b;});}else{return _0x50c32b;}})[_0x590c('0x46')](function(_0x5301ea){logger[_0x590c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5301ea);throw _0x5301ea;});}return _0x50c32b;});}})['then'](respondWithResult(_0x4eb5f0,0xc9))['catch'](handleError(_0x4eb5f0,null));};exports[_0x590c('0x56')]=function(_0x359910,_0x1efd98){if(_0x359910[_0x590c('0x4a')]['id']){delete _0x359910[_0x590c('0x4a')]['id'];}return db['Campaign'][_0x590c('0x48')]({'where':{'id':_0x359910['params']['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x1efd98,null))['then'](saveUpdates(_0x359910[_0x590c('0x4a')],null))[_0x590c('0x24')](respondWithResult(_0x1efd98,null))['catch'](handleError(_0x1efd98,null));};exports[_0x590c('0x23')]=function(_0x2abe34,_0x50f6a6){return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0x2abe34[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x50f6a6,null))[_0x590c('0x24')](removeEntity(_0x50f6a6,null))[_0x590c('0x46')](handleError(_0x50f6a6,null));};exports[_0x590c('0x57')]=function(_0x4ccca8,_0x118dd1,_0x42ea48){var _0x147540={'raw':!![],'where':{}};var _0x2643c0={};var _0x9871e6={'count':0x0,'rows':[]};return db[_0x590c('0x2d')]['findOne']({'where':{'id':_0x4ccca8[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x118dd1,null))['then'](function(_0x263e73){if(_0x263e73){_0x2643c0['model']=_[_0x590c('0x33')](db['CmHopper'][_0x590c('0x2e')]);_0x2643c0[_0x590c('0x32')]=_['keys'](_0x4ccca8[_0x590c('0x32')]);_0x2643c0[_0x590c('0x3e')]=_[_0x590c('0x34')](_0x2643c0[_0x590c('0x31')],_0x2643c0[_0x590c('0x32')]);_0x147540[_0x590c('0x35')]=_[_0x590c('0x34')](_0x2643c0[_0x590c('0x31')],qs[_0x590c('0x36')](_0x4ccca8[_0x590c('0x32')][_0x590c('0x36')]));_0x147540['attributes']=_0x147540[_0x590c('0x35')]['length']?_0x147540[_0x590c('0x35')]:_0x2643c0[_0x590c('0x31')];if(!_0x4ccca8[_0x590c('0x32')][_0x590c('0x38')]('nolimit')){_0x147540['limit']=qs[_0x590c('0x20')](_0x4ccca8[_0x590c('0x32')][_0x590c('0x20')]);_0x147540[_0x590c('0x1d')]=qs[_0x590c('0x1d')](_0x4ccca8[_0x590c('0x32')]['offset']);}_0x147540[_0x590c('0x3a')]=qs['sort'](_0x4ccca8[_0x590c('0x32')][_0x590c('0x3b')]);_0x147540[_0x590c('0x3c')]=qs[_0x590c('0x3e')](_['pick'](_0x4ccca8['query'],_0x2643c0[_0x590c('0x3e')]));_0x147540['where'][_0x590c('0x58')]=_0x263e73['id'];if(_0x4ccca8[_0x590c('0x32')][_0x590c('0x3f')]){_0x147540[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x147540['where'],{'$or':_[_0x590c('0x2c')](_0x147540[_0x590c('0x35')],function(_0x3f76b9){var _0x4336fd={};_0x4336fd[_0x3f76b9]={'$like':'%'+_0x4ccca8['query']['filter']+'%'};return _0x4336fd;})});}_0x147540=_[_0x590c('0x40')]({},_0x147540,_0x4ccca8[_0x590c('0x42')]);return db['CmHopper'][_0x590c('0x1f')]({'where':_0x147540[_0x590c('0x3c')]})[_0x590c('0x24')](function(_0x2eba1f){_0x9871e6[_0x590c('0x1f')]=_0x2eba1f;if(_0x4ccca8['query'][_0x590c('0x43')]){_0x147540[_0x590c('0x44')]=[{'all':!![]}];}return db[_0x590c('0x59')][_0x590c('0x5a')](_0x147540);})[_0x590c('0x24')](function(_0x21b0d6){_0x9871e6[_0x590c('0x45')]=_0x21b0d6;return _0x9871e6;});}})[_0x590c('0x24')](respondWithFilteredResult(_0x118dd1,_0x147540))[_0x590c('0x46')](handleError(_0x118dd1,null));};exports['getHopperHistories']=function(_0x14fa86,_0x559b2e,_0x3b28e6){var _0x132de1={'raw':!![],'where':{}};var _0x52a1ab={};var _0xa72792={'count':0x0,'rows':[]};return db[_0x590c('0x2d')][_0x590c('0x5b')]({'where':{'id':_0x14fa86[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x559b2e,null))['then'](function(_0x5a8f6d){if(_0x5a8f6d){_0x52a1ab[_0x590c('0x31')]=_[_0x590c('0x33')](db[_0x590c('0x5c')][_0x590c('0x2e')]);_0x52a1ab[_0x590c('0x32')]=_[_0x590c('0x33')](_0x14fa86[_0x590c('0x32')]);_0x52a1ab[_0x590c('0x3e')]=_['intersection'](_0x52a1ab[_0x590c('0x31')],_0x52a1ab[_0x590c('0x32')]);_0x132de1[_0x590c('0x35')]=_[_0x590c('0x34')](_0x52a1ab['model'],qs['fields'](_0x14fa86['query'][_0x590c('0x36')]));_0x132de1[_0x590c('0x35')]=_0x132de1[_0x590c('0x35')]['length']?_0x132de1['attributes']:_0x52a1ab[_0x590c('0x31')];if(!_0x14fa86[_0x590c('0x32')][_0x590c('0x38')](_0x590c('0x39'))){_0x132de1[_0x590c('0x20')]=qs[_0x590c('0x20')](_0x14fa86[_0x590c('0x32')][_0x590c('0x20')]);_0x132de1[_0x590c('0x1d')]=qs['offset'](_0x14fa86[_0x590c('0x32')][_0x590c('0x1d')]);}_0x132de1[_0x590c('0x3a')]=qs['sort'](_0x14fa86[_0x590c('0x32')][_0x590c('0x3b')]);_0x132de1[_0x590c('0x3c')]=qs[_0x590c('0x3e')](_[_0x590c('0x3d')](_0x14fa86[_0x590c('0x32')],_0x52a1ab[_0x590c('0x3e')]));_0x132de1['where'][_0x590c('0x58')]=_0x5a8f6d['id'];if(_0x14fa86['query'][_0x590c('0x3f')]){_0x132de1[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x132de1[_0x590c('0x3c')],{'$or':_['map'](_0x132de1[_0x590c('0x35')],function(_0x50acd3){var _0x340ae7={};_0x340ae7[_0x50acd3]={'$like':'%'+_0x14fa86[_0x590c('0x32')][_0x590c('0x3f')]+'%'};return _0x340ae7;})});}_0x132de1=_[_0x590c('0x40')]({},_0x132de1,_0x14fa86[_0x590c('0x42')]);return db[_0x590c('0x5c')]['count']({'where':_0x132de1[_0x590c('0x3c')]})['then'](function(_0x4702a1){_0xa72792[_0x590c('0x1f')]=_0x4702a1;if(_0x14fa86[_0x590c('0x32')][_0x590c('0x43')]){_0x132de1[_0x590c('0x44')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x132de1);})[_0x590c('0x24')](function(_0x27895a){_0xa72792[_0x590c('0x45')]=_0x27895a;return _0xa72792;});}})[_0x590c('0x24')](respondWithFilteredResult(_0x559b2e,_0x132de1))[_0x590c('0x46')](handleError(_0x559b2e,null));};exports[_0x590c('0x5d')]=function(_0x56fdb1,_0x45ed12,_0x3646fe){var _0x356437={'raw':!![],'where':{}};var _0x3b2789={};var _0x111e49={'count':0x0,'rows':[]};return db[_0x590c('0x2d')][_0x590c('0x5b')]({'where':{'id':_0x56fdb1['params']['id']}})['then'](handleEntityNotFound(_0x45ed12,null))['then'](function(_0x3358c8){if(_0x3358c8){_0x3b2789[_0x590c('0x31')]=_[_0x590c('0x33')](db['CmHopperFinal'][_0x590c('0x2e')]);_0x3b2789['query']=_[_0x590c('0x33')](_0x56fdb1['query']);_0x3b2789['filters']=_[_0x590c('0x34')](_0x3b2789['model'],_0x3b2789['query']);_0x356437['attributes']=_['intersection'](_0x3b2789[_0x590c('0x31')],qs[_0x590c('0x36')](_0x56fdb1[_0x590c('0x32')][_0x590c('0x36')]));_0x356437[_0x590c('0x35')]=_0x356437[_0x590c('0x35')][_0x590c('0x37')]?_0x356437[_0x590c('0x35')]:_0x3b2789[_0x590c('0x31')];if(!_0x56fdb1[_0x590c('0x32')][_0x590c('0x38')]('nolimit')){_0x356437[_0x590c('0x20')]=qs['limit'](_0x56fdb1[_0x590c('0x32')][_0x590c('0x20')]);_0x356437[_0x590c('0x1d')]=qs['offset'](_0x56fdb1[_0x590c('0x32')][_0x590c('0x1d')]);}_0x356437[_0x590c('0x3a')]=qs[_0x590c('0x3b')](_0x56fdb1[_0x590c('0x32')]['sort']);_0x356437['where']=qs['filters'](_['pick'](_0x56fdb1[_0x590c('0x32')],_0x3b2789['filters']));_0x356437[_0x590c('0x3c')][_0x590c('0x58')]=_0x3358c8['id'];if(_0x56fdb1['query'][_0x590c('0x3f')]){_0x356437[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x356437[_0x590c('0x3c')],{'$or':_['map'](_0x356437[_0x590c('0x35')],function(_0x4b09f2){var _0x133dd6={};_0x133dd6[_0x4b09f2]={'$like':'%'+_0x56fdb1['query']['filter']+'%'};return _0x133dd6;})});}_0x356437=_[_0x590c('0x40')]({},_0x356437,_0x56fdb1[_0x590c('0x42')]);return db['CmHopperFinal']['count']({'where':_0x356437[_0x590c('0x3c')]})['then'](function(_0x2f291c){_0x111e49['count']=_0x2f291c;if(_0x56fdb1[_0x590c('0x32')][_0x590c('0x43')]){_0x356437[_0x590c('0x44')]=[{'all':!![]}];}return db[_0x590c('0x5e')][_0x590c('0x5a')](_0x356437);})[_0x590c('0x24')](function(_0xbf1baa){_0x111e49['rows']=_0xbf1baa;return _0x111e49;});}})[_0x590c('0x24')](respondWithFilteredResult(_0x45ed12,_0x356437))['catch'](handleError(_0x45ed12,null));};exports['getHopperBlacks']=function(_0x467018,_0x15f738,_0x4d8b72){var _0xed9f2d={'raw':!![],'where':{}};var _0x1faaec={};var _0x474074={'count':0x0,'rows':[]};return db[_0x590c('0x2d')]['findOne']({'where':{'id':_0x467018['params']['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x15f738,null))['then'](function(_0x182c32){if(_0x182c32){_0x1faaec[_0x590c('0x31')]=_[_0x590c('0x33')](db['CmHopperBlack']['rawAttributes']);_0x1faaec['query']=_[_0x590c('0x33')](_0x467018['query']);_0x1faaec[_0x590c('0x3e')]=_[_0x590c('0x34')](_0x1faaec[_0x590c('0x31')],_0x1faaec[_0x590c('0x32')]);_0xed9f2d[_0x590c('0x35')]=_[_0x590c('0x34')](_0x1faaec[_0x590c('0x31')],qs[_0x590c('0x36')](_0x467018[_0x590c('0x32')]['fields']));_0xed9f2d[_0x590c('0x35')]=_0xed9f2d[_0x590c('0x35')][_0x590c('0x37')]?_0xed9f2d[_0x590c('0x35')]:_0x1faaec['model'];if(!_0x467018[_0x590c('0x32')][_0x590c('0x38')](_0x590c('0x39'))){_0xed9f2d[_0x590c('0x20')]=qs['limit'](_0x467018[_0x590c('0x32')][_0x590c('0x20')]);_0xed9f2d[_0x590c('0x1d')]=qs[_0x590c('0x1d')](_0x467018[_0x590c('0x32')][_0x590c('0x1d')]);}_0xed9f2d[_0x590c('0x3a')]=qs['sort'](_0x467018[_0x590c('0x32')][_0x590c('0x3b')]);_0xed9f2d['where']=qs[_0x590c('0x3e')](_[_0x590c('0x3d')](_0x467018[_0x590c('0x32')],_0x1faaec[_0x590c('0x3e')]));_0xed9f2d[_0x590c('0x3c')][_0x590c('0x58')]=_0x182c32['id'];if(_0x467018[_0x590c('0x32')]['filter']){_0xed9f2d[_0x590c('0x3c')]=_[_0x590c('0x40')](_0xed9f2d['where'],{'$or':_['map'](_0xed9f2d[_0x590c('0x35')],function(_0xa6da0b){var _0x33b0be={};_0x33b0be[_0xa6da0b]={'$like':'%'+_0x467018[_0x590c('0x32')][_0x590c('0x3f')]+'%'};return _0x33b0be;})});}_0xed9f2d=_[_0x590c('0x40')]({},_0xed9f2d,_0x467018[_0x590c('0x42')]);return db[_0x590c('0x5f')][_0x590c('0x1f')]({'where':_0xed9f2d[_0x590c('0x3c')]})[_0x590c('0x24')](function(_0x4ed8d7){_0x474074['count']=_0x4ed8d7;if(_0x467018[_0x590c('0x32')][_0x590c('0x43')]){_0xed9f2d[_0x590c('0x44')]=[{'all':!![]}];}return db[_0x590c('0x5f')][_0x590c('0x5a')](_0xed9f2d);})[_0x590c('0x24')](function(_0x13ba07){_0x474074[_0x590c('0x45')]=_0x13ba07;return _0x474074;});}})[_0x590c('0x24')](respondWithFilteredResult(_0x15f738,_0xed9f2d))[_0x590c('0x46')](handleError(_0x15f738,null));};exports[_0x590c('0x60')]=function(_0x50f1f9,_0x5dc0d2,_0x13f85e){var _0x2ed354={};var _0x37fc8a={};var _0x2c92a5;var _0x75e5bc;return db[_0x590c('0x2d')][_0x590c('0x5b')]({'where':{'id':_0x50f1f9[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x5dc0d2,null))['then'](function(_0x13c433){if(_0x13c433){_0x2c92a5=_0x13c433;_0x37fc8a[_0x590c('0x31')]=_[_0x590c('0x33')](db[_0x590c('0x61')]['rawAttributes']);_0x37fc8a[_0x590c('0x32')]=_[_0x590c('0x33')](_0x50f1f9[_0x590c('0x32')]);_0x37fc8a['filters']=_[_0x590c('0x34')](_0x37fc8a['model'],_0x37fc8a[_0x590c('0x32')]);_0x2ed354[_0x590c('0x35')]=_[_0x590c('0x34')](_0x37fc8a[_0x590c('0x31')],qs['fields'](_0x50f1f9[_0x590c('0x32')]['fields']));_0x2ed354['attributes']=_0x2ed354[_0x590c('0x35')][_0x590c('0x37')]?_0x2ed354['attributes']:_0x37fc8a[_0x590c('0x31')];_0x2ed354['order']=qs['sort'](_0x50f1f9['query'][_0x590c('0x3b')]);_0x2ed354[_0x590c('0x3c')]=qs[_0x590c('0x3e')](_[_0x590c('0x3d')](_0x50f1f9[_0x590c('0x32')],_0x37fc8a['filters']));if(_0x50f1f9['query']['filter']){_0x2ed354[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x2ed354[_0x590c('0x3c')],{'$or':_[_0x590c('0x2c')](_0x2ed354['attributes'],function(_0x2e655d){var _0x41aaf0={};_0x41aaf0[_0x2e655d]={'$like':'%'+_0x50f1f9['query'][_0x590c('0x3f')]+'%'};return _0x41aaf0;})});}_0x2ed354=_[_0x590c('0x40')]({},_0x2ed354,_0x50f1f9[_0x590c('0x42')]);return _0x2c92a5['getLists'](_0x2ed354);}})['then'](function(_0x4ff91e){if(_0x4ff91e){_0x75e5bc=_0x4ff91e['length'];if(!_0x50f1f9[_0x590c('0x32')][_0x590c('0x38')](_0x590c('0x39'))){_0x2ed354['limit']=qs[_0x590c('0x20')](_0x50f1f9['query'][_0x590c('0x20')]);_0x2ed354[_0x590c('0x1d')]=qs['offset'](_0x50f1f9[_0x590c('0x32')][_0x590c('0x1d')]);}return _0x2c92a5['getLists'](_0x2ed354);}})[_0x590c('0x24')](function(_0x2b1299){if(_0x2b1299){return _0x2b1299?{'count':_0x75e5bc,'rows':_0x2b1299}:null;}})[_0x590c('0x24')](respondWithResult(_0x5dc0d2,null))[_0x590c('0x46')](handleError(_0x5dc0d2,null));};exports['addLists']=function(_0x23a44f,_0x37ddd9,_0x3d14fe){var _0x4c9250,_0x26895e;return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0x23a44f[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x37ddd9,null))[_0x590c('0x24')](function(_0x10d5dd){if(_0x10d5dd){_0x26895e=_0x10d5dd;return _0x10d5dd[_0x590c('0x62')](_0x23a44f[_0x590c('0x4a')][_0x590c('0x63')],_[_0x590c('0x53')](_0x23a44f['body'],['ids','id'])||{});}return null;})['spread'](function(_0x524143){var _0x5ae2f5;_0x4c9250=_0x524143||[];var _0x139316=[];if(_0x524143){for(var _0x48820e=0x0;_0x48820e<_0x524143[_0x590c('0x37')];_0x48820e+=0x1){var _0x3c9f77=_0x524143[_0x48820e][_0x590c('0x25')]({'plain':!![]});_0x26895e[_0x590c('0x64')]=_0x23a44f['body'][_0x590c('0x64')]?_0x23a44f[_0x590c('0x4a')]['dialCheckDuplicateType']:_0x26895e[_0x590c('0x64')];switch(_0x26895e['dialCheckDuplicateType']){case _0x590c('0x65'):_0x5ae2f5=squel[_0x590c('0x66')]()[_0x590c('0x67')]('cm_hopper')[_0x590c('0x68')]([_0x590c('0x69'),_0x590c('0x6a'),'ContactId','ListId',_0x590c('0x58'),_0x590c('0x54'),_0x590c('0x55')],squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x69'),'phone')[_0x590c('0x6c')]('NOW()',_0x590c('0x6a'))[_0x590c('0x6c')]('id',_0x590c('0x6d'))[_0x590c('0x6c')](_0x3c9f77['CmListId'][_0x590c('0x6e')](),'ListId')[_0x590c('0x6c')](_0x23a44f[_0x590c('0x47')]['id'][_0x590c('0x6e')](),_0x590c('0x58'))[_0x590c('0x6c')](_0x590c('0x6f'),'createdAt')[_0x590c('0x6c')](_0x590c('0x6f'),_0x590c('0x55'))['from']('cm_contacts')['where'](_0x590c('0x70'))[_0x590c('0x3c')](_0x590c('0x71'),_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')]())[_0x590c('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x590c('0x3c')](_0x590c('0x73'),squel[_0x590c('0x6b')]()['field'](_0x590c('0x74'))[_0x590c('0x75')]('cm_hopper_final')[_0x590c('0x3c')](_0x590c('0x76'),_0x23a44f['params']['id']['toString']()))['where'](_0x590c('0x73'),squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x77'))[_0x590c('0x75')](_0x590c('0x78'))[_0x590c('0x3c')]('CampaignId\x20=\x20?',_0x23a44f[_0x590c('0x47')]['id'][_0x590c('0x6e')]())))[_0x590c('0x6e')]();break;case _0x590c('0x79'):_0x5ae2f5=squel[_0x590c('0x66')]()[_0x590c('0x67')](_0x590c('0x78'))['fromQuery']([_0x590c('0x69'),_0x590c('0x6a'),_0x590c('0x6d'),'ListId',_0x590c('0x58'),_0x590c('0x54'),_0x590c('0x55')],squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x69'),_0x590c('0x69'))[_0x590c('0x6c')](_0x590c('0x6f'),_0x590c('0x6a'))['field']('id','ContactId')[_0x590c('0x6c')](_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')](),'ListId')[_0x590c('0x6c')](_0x23a44f[_0x590c('0x47')]['id']['toString'](),_0x590c('0x58'))[_0x590c('0x6c')](_0x590c('0x6f'),'createdAt')[_0x590c('0x6c')]('NOW()',_0x590c('0x55'))[_0x590c('0x75')](_0x590c('0x7a'))['where'](_0x590c('0x70'))[_0x590c('0x3c')](_0x590c('0x71'),_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')]())[_0x590c('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x590c('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x77'))[_0x590c('0x75')](_0x590c('0x78'))['where']('CampaignId\x20=\x20?',_0x23a44f[_0x590c('0x47')]['id'][_0x590c('0x6e')]())))[_0x590c('0x6e')]();break;default:_0x5ae2f5=squel[_0x590c('0x66')]()['into'](_0x590c('0x78'))[_0x590c('0x68')]([_0x590c('0x69'),_0x590c('0x6a'),'ContactId',_0x590c('0x7b'),_0x590c('0x58'),_0x590c('0x54'),_0x590c('0x55')],squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x69'),_0x590c('0x69'))[_0x590c('0x6c')]('NOW()',_0x590c('0x6a'))['field']('id',_0x590c('0x6d'))[_0x590c('0x6c')](_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')](),_0x590c('0x7b'))[_0x590c('0x6c')](_0x23a44f[_0x590c('0x47')]['id'][_0x590c('0x6e')](),_0x590c('0x58'))[_0x590c('0x6c')](_0x590c('0x6f'),'createdAt')['field'](_0x590c('0x6f'),'updatedAt')[_0x590c('0x75')]('cm_contacts')['where'](_0x590c('0x70'))[_0x590c('0x3c')](_0x590c('0x71'),_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')]())[_0x590c('0x3c')](_0x590c('0x7c')))['toString']();}_0x139316['push'](db[_0x590c('0x7d')][_0x590c('0x32')](_0x5ae2f5));}return BPromise[_0x590c('0x7e')](_0x139316);}})['then'](function(){return _0x4c9250;})[_0x590c('0x24')](respondWithResult(_0x37ddd9,null))[_0x590c('0x46')](handleError(_0x37ddd9,null));};exports[_0x590c('0x7f')]=function(_0xc54b20,_0x1a6f3e,_0x1a7fc9){return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0xc54b20[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x1a6f3e,null))[_0x590c('0x24')](function(_0x249aca){if(_0x249aca){return _0x249aca[_0x590c('0x7f')](_0xc54b20[_0x590c('0x32')][_0x590c('0x63')]);}})[_0x590c('0x24')](function(_0x223995){if(_0x223995){return db[_0x590c('0x59')]['destroy']({'where':{'ListId':_0xc54b20[_0x590c('0x32')]['ids'],'CampaignId':_0xc54b20[_0x590c('0x47')]['id']}})[_0x590c('0x24')](function(){return _0x223995;});}})['then'](respondWithStatusCode(_0x1a6f3e,null))['catch'](handleError(_0x1a6f3e,null));};exports['getBlackLists']=function(_0x4cc720,_0x4b33c3,_0x167993){var _0x3fb909={};var _0x214354={};var _0x4a5585;var _0x7bc81c;return db[_0x590c('0x2d')][_0x590c('0x5b')]({'where':{'id':_0x4cc720[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x4b33c3,null))[_0x590c('0x24')](function(_0xef6030){if(_0xef6030){_0x4a5585=_0xef6030;_0x214354[_0x590c('0x31')]=_[_0x590c('0x33')](db[_0x590c('0x61')]['rawAttributes']);_0x214354[_0x590c('0x32')]=_[_0x590c('0x33')](_0x4cc720[_0x590c('0x32')]);_0x214354[_0x590c('0x3e')]=_[_0x590c('0x34')](_0x214354[_0x590c('0x31')],_0x214354[_0x590c('0x32')]);_0x3fb909['attributes']=_['intersection'](_0x214354[_0x590c('0x31')],qs['fields'](_0x4cc720[_0x590c('0x32')][_0x590c('0x36')]));_0x3fb909[_0x590c('0x35')]=_0x3fb909['attributes'][_0x590c('0x37')]?_0x3fb909[_0x590c('0x35')]:_0x214354[_0x590c('0x31')];_0x3fb909[_0x590c('0x3a')]=qs[_0x590c('0x3b')](_0x4cc720[_0x590c('0x32')][_0x590c('0x3b')]);_0x3fb909['where']=qs['filters'](_['pick'](_0x4cc720[_0x590c('0x32')],_0x214354[_0x590c('0x3e')]));if(_0x4cc720['query'][_0x590c('0x3f')]){_0x3fb909['where']=_[_0x590c('0x40')](_0x3fb909[_0x590c('0x3c')],{'$or':_[_0x590c('0x2c')](_0x3fb909['attributes'],function(_0x406578){var _0x277f68={};_0x277f68[_0x406578]={'$like':'%'+_0x4cc720[_0x590c('0x32')][_0x590c('0x3f')]+'%'};return _0x277f68;})});}_0x3fb909=_[_0x590c('0x40')]({},_0x3fb909,_0x4cc720[_0x590c('0x42')]);return _0x4a5585[_0x590c('0x80')](_0x3fb909);}})[_0x590c('0x24')](function(_0x204c27){if(_0x204c27){_0x7bc81c=_0x204c27['length'];if(!_0x4cc720[_0x590c('0x32')][_0x590c('0x38')]('nolimit')){_0x3fb909['limit']=qs[_0x590c('0x20')](_0x4cc720['query'][_0x590c('0x20')]);_0x3fb909[_0x590c('0x1d')]=qs['offset'](_0x4cc720['query']['offset']);}return _0x4a5585[_0x590c('0x80')](_0x3fb909);}})['then'](function(_0x4a7550){if(_0x4a7550){return _0x4a7550?{'count':_0x7bc81c,'rows':_0x4a7550}:null;}})[_0x590c('0x24')](respondWithResult(_0x4b33c3,null))[_0x590c('0x46')](handleError(_0x4b33c3,null));};exports[_0x590c('0x81')]=function(_0x54c85a,_0x529c88,_0x22cbb5){var _0x176fb5,_0x2a5885;return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0x54c85a[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x529c88,null))[_0x590c('0x24')](function(_0x5f2d33){if(_0x5f2d33){_0x2a5885=_0x5f2d33;return _0x5f2d33['addBlackLists'](_0x54c85a[_0x590c('0x4a')]['ids'],_[_0x590c('0x53')](_0x54c85a['body'],[_0x590c('0x63'),'id'])||{});}return null;})[_0x590c('0x82')](function(_0x5b413c){var _0x163bc9;_0x176fb5=_0x5b413c||[];var _0x48048e=[];if(_0x5b413c){for(var _0x1642d1=0x0;_0x1642d1<_0x5b413c[_0x590c('0x37')];_0x1642d1+=0x1){var _0x3fc5c3=_0x5b413c[_0x1642d1][_0x590c('0x25')]({'plain':!![]});_0x163bc9=squel[_0x590c('0x66')]()[_0x590c('0x67')](_0x590c('0x83'))['fromQuery']([_0x590c('0x69'),_0x590c('0x6d'),_0x590c('0x7b'),'CampaignId',_0x590c('0x54'),_0x590c('0x55')],squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x69'),_0x590c('0x69'))[_0x590c('0x6c')]('id',_0x590c('0x6d'))[_0x590c('0x6c')](_0x3fc5c3[_0x590c('0x72')][_0x590c('0x6e')](),'ListId')[_0x590c('0x6c')](_0x54c85a[_0x590c('0x47')]['id'][_0x590c('0x6e')](),_0x590c('0x58'))[_0x590c('0x6c')]('NOW()',_0x590c('0x54'))[_0x590c('0x6c')](_0x590c('0x6f'),_0x590c('0x55'))['from'](_0x590c('0x7a'))[_0x590c('0x3c')](_0x590c('0x70'))[_0x590c('0x3c')](_0x590c('0x71'),_0x3fc5c3[_0x590c('0x72')][_0x590c('0x6e')]())[_0x590c('0x3c')](_0x590c('0x7c')))[_0x590c('0x6e')]();_0x48048e[_0x590c('0x84')](db['sequelize'][_0x590c('0x32')](_0x163bc9));}return BPromise['all'](_0x48048e);}})[_0x590c('0x24')](function(){return _0x176fb5;})[_0x590c('0x24')](respondWithResult(_0x529c88,null))[_0x590c('0x46')](handleError(_0x529c88,null));};exports['removeBlackLists']=function(_0x596097,_0x4c38c1,_0x2b8acd){return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0x596097[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x4c38c1,null))[_0x590c('0x24')](function(_0x31dffc){if(_0x31dffc){return _0x31dffc[_0x590c('0x85')](_0x596097[_0x590c('0x32')][_0x590c('0x63')]);}})[_0x590c('0x24')](function(_0x1a4ae5){if(_0x1a4ae5){return db[_0x590c('0x5f')][_0x590c('0x23')]({'where':{'ListId':_0x596097['query']['ids'],'CampaignId':_0x596097[_0x590c('0x47')]['id']}})[_0x590c('0x24')](function(){return _0x1a4ae5;});}})[_0x590c('0x24')](respondWithStatusCode(_0x4c38c1,null))[_0x590c('0x46')](handleError(_0x4c38c1,null));}; \ No newline at end of file +var _0x5b6e=['findOne','CmHopper','CampaignId','getHopperHistories','nolimit','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','fromQuery','phone','scheduledAt','ListId','select','field','ContactId','CmListId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_contacts','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','Campaign','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','getHoppers'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x5b6e,0x1c2));var _0xe5b6=function(_0x1b70f9,_0x5decd0){_0x1b70f9=_0x1b70f9-0x0;var _0x23ac0b=_0x5b6e[_0x1b70f9];return _0x23ac0b;};'use strict';var emlformat=require(_0xe5b6('0x0'));var rimraf=require(_0xe5b6('0x1'));var zipdir=require(_0xe5b6('0x2'));var jsonpatch=require(_0xe5b6('0x3'));var rp=require(_0xe5b6('0x4'));var moment=require(_0xe5b6('0x5'));var BPromise=require(_0xe5b6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe5b6('0x7'));var sox=require(_0xe5b6('0x8'));var csv=require(_0xe5b6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5b6('0xa'));var squel=require(_0xe5b6('0xb'));var crypto=require(_0xe5b6('0xc'));var jsforce=require(_0xe5b6('0xd'));var deskjs=require(_0xe5b6('0xe'));var toCsv=require(_0xe5b6('0x9'));var querystring=require(_0xe5b6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe5b6('0x10'));var qs=require(_0xe5b6('0x11'));var as=require(_0xe5b6('0x12'));var hardwareService=require(_0xe5b6('0x13'));var logger=require(_0xe5b6('0x14'))(_0xe5b6('0x15'));var utils=require(_0xe5b6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe5b6('0x17'));var db=require(_0xe5b6('0x18'))['db'];function respondWithStatusCode(_0x30e176,_0x3f3448){_0x3f3448=_0x3f3448||0xcc;return function(_0x27e0b5){if(_0x27e0b5){return _0x30e176[_0xe5b6('0x19')](_0x3f3448);}return _0x30e176[_0xe5b6('0x1a')](_0x3f3448)[_0xe5b6('0x1b')]();};}function respondWithResult(_0x4c7d36,_0x162371){_0x162371=_0x162371||0xc8;return function(_0x465b97){if(_0x465b97){return _0x4c7d36[_0xe5b6('0x1a')](_0x162371)[_0xe5b6('0x1c')](_0x465b97);}};}function respondWithFilteredResult(_0x3306e3,_0x34be19){return function(_0x4a79a4){if(_0x4a79a4){var _0x20c593=typeof _0x34be19[_0xe5b6('0x1d')]===_0xe5b6('0x1e')&&typeof _0x34be19[_0xe5b6('0x1f')]===_0xe5b6('0x1e');var _0x41acca=_0x4a79a4[_0xe5b6('0x20')];var _0x524032=_0x20c593?0x0:_0x34be19[_0xe5b6('0x1d')];var _0x8683e4=_0x20c593?_0x4a79a4[_0xe5b6('0x20')]:_0x34be19[_0xe5b6('0x1d')]+_0x34be19['limit'];var _0x34e518;if(_0x8683e4>=_0x41acca){_0x8683e4=_0x41acca;_0x34e518=0xc8;}else{_0x34e518=0xce;}_0x3306e3['status'](_0x34e518);return _0x3306e3[_0xe5b6('0x21')](_0xe5b6('0x22'),_0x524032+'-'+_0x8683e4+'/'+_0x41acca)[_0xe5b6('0x1c')](_0x4a79a4);}return null;};}function patchUpdates(_0x50e14e){return function(_0x3bf8d2){try{jsonpatch[_0xe5b6('0x23')](_0x3bf8d2,_0x50e14e,!![]);}catch(_0x5130d0){return BPromise[_0xe5b6('0x24')](_0x5130d0);}return _0x3bf8d2[_0xe5b6('0x25')]();};}function saveUpdates(_0x5d0ae8,_0x10a566){return function(_0x2aa87a){if(_0x2aa87a){return _0x2aa87a[_0xe5b6('0x26')](_0x5d0ae8)[_0xe5b6('0x27')](function(_0x2c77c1){return _0x2c77c1;});}return null;};}function removeEntity(_0x2706b5,_0x48dca1){return function(_0x199b1c){if(_0x199b1c){return _0x199b1c[_0xe5b6('0x28')]()[_0xe5b6('0x27')](function(){var _0x3e6935=_0x199b1c[_0xe5b6('0x29')]({'plain':!![]});var _0x478efd='IvrCampaigns';return db[_0xe5b6('0x2a')][_0xe5b6('0x28')]({'where':{'type':_0x478efd,'resourceId':_0x3e6935['id']}})[_0xe5b6('0x27')](function(){return _0x199b1c;});})[_0xe5b6('0x27')](function(){_0x2706b5[_0xe5b6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5992a9,_0x5d6abe){return function(_0x207317){if(!_0x207317){_0x5992a9[_0xe5b6('0x19')](0x194);}return _0x207317;};}function handleError(_0x230b5c,_0x287e22){_0x287e22=_0x287e22||0x1f4;return function(_0xd26e80){logger[_0xe5b6('0x2b')](_0xd26e80[_0xe5b6('0x2c')]);if(_0xd26e80[_0xe5b6('0x2d')]){delete _0xd26e80[_0xe5b6('0x2d')];}_0x230b5c[_0xe5b6('0x1a')](_0x287e22)[_0xe5b6('0x2e')](_0xd26e80);};}exports['index']=function(_0x13b605,_0x39de33){var _0x515d96={},_0x33d586={},_0x259317={'count':0x0,'rows':[]};var _0x2abb72=_['map'](db[_0xe5b6('0x2f')][_0xe5b6('0x30')],function(_0x111d41){return{'name':_0x111d41[_0xe5b6('0x31')],'type':_0x111d41[_0xe5b6('0x32')][_0xe5b6('0x33')]};});_0x33d586['model']=_[_0xe5b6('0x34')](_0x2abb72,_0xe5b6('0x2d'));_0x33d586[_0xe5b6('0x35')]=_[_0xe5b6('0x36')](_0x13b605[_0xe5b6('0x35')]);_0x33d586[_0xe5b6('0x37')]=_[_0xe5b6('0x38')](_0x33d586['model'],_0x33d586[_0xe5b6('0x35')]);_0x515d96['attributes']=_[_0xe5b6('0x38')](_0x33d586[_0xe5b6('0x39')],qs[_0xe5b6('0x3a')](_0x13b605[_0xe5b6('0x35')][_0xe5b6('0x3a')]));_0x515d96[_0xe5b6('0x3b')]=_0x515d96[_0xe5b6('0x3b')][_0xe5b6('0x3c')]?_0x515d96[_0xe5b6('0x3b')]:_0x33d586[_0xe5b6('0x39')];if(!_0x13b605['query'][_0xe5b6('0x3d')]('nolimit')){_0x515d96[_0xe5b6('0x1f')]=qs[_0xe5b6('0x1f')](_0x13b605[_0xe5b6('0x35')][_0xe5b6('0x1f')]);_0x515d96['offset']=qs[_0xe5b6('0x1d')](_0x13b605['query'][_0xe5b6('0x1d')]);}_0x515d96[_0xe5b6('0x3e')]=qs[_0xe5b6('0x3f')](_0x13b605['query'][_0xe5b6('0x3f')]);_0x515d96[_0xe5b6('0x40')]=qs['filters'](_[_0xe5b6('0x41')](_0x13b605[_0xe5b6('0x35')],_0x33d586[_0xe5b6('0x37')]),_0x2abb72);if(_0x13b605[_0xe5b6('0x35')][_0xe5b6('0x42')]){_0x515d96['where']=_[_0xe5b6('0x43')](_0x515d96[_0xe5b6('0x40')],{'$or':_[_0xe5b6('0x34')](_0x2abb72,function(_0x4bc8d1){if(_0x4bc8d1[_0xe5b6('0x32')]!=='VIRTUAL'){var _0x9d216={};_0x9d216[_0x4bc8d1[_0xe5b6('0x2d')]]={'$like':'%'+_0x13b605['query'][_0xe5b6('0x42')]+'%'};return _0x9d216;}})});}_0x515d96=_[_0xe5b6('0x43')]({},_0x515d96,_0x13b605['options']);var _0xf0697b={'where':_0x515d96[_0xe5b6('0x40')]};return db[_0xe5b6('0x2f')]['count'](_0xf0697b)['then'](function(_0x2a3fe3){_0x259317[_0xe5b6('0x20')]=_0x2a3fe3;if(_0x13b605[_0xe5b6('0x35')][_0xe5b6('0x44')]){_0x515d96[_0xe5b6('0x45')]=[{'all':!![]}];}return db[_0xe5b6('0x2f')][_0xe5b6('0x46')](_0x515d96);})['then'](function(_0x4024df){_0x259317[_0xe5b6('0x47')]=_0x4024df;return _0x259317;})['then'](respondWithFilteredResult(_0x39de33,_0x515d96))[_0xe5b6('0x48')](handleError(_0x39de33,null));};exports[_0xe5b6('0x49')]=function(_0x38b45c,_0x424226){var _0xe99948={'raw':![],'where':{'id':_0x38b45c['params']['id']}},_0x49dee1={};_0x49dee1[_0xe5b6('0x39')]=_[_0xe5b6('0x36')](db[_0xe5b6('0x2f')][_0xe5b6('0x30')]);_0x49dee1[_0xe5b6('0x35')]=_['keys'](_0x38b45c['query']);_0x49dee1[_0xe5b6('0x37')]=_[_0xe5b6('0x38')](_0x49dee1[_0xe5b6('0x39')],_0x49dee1[_0xe5b6('0x35')]);_0xe99948[_0xe5b6('0x3b')]=_[_0xe5b6('0x38')](_0x49dee1[_0xe5b6('0x39')],qs[_0xe5b6('0x3a')](_0x38b45c[_0xe5b6('0x35')][_0xe5b6('0x3a')]));_0xe99948[_0xe5b6('0x3b')]=_0xe99948['attributes'][_0xe5b6('0x3c')]?_0xe99948[_0xe5b6('0x3b')]:_0x49dee1['model'];if(_0x38b45c[_0xe5b6('0x35')]['includeAll']){_0xe99948[_0xe5b6('0x45')]=[{'all':!![]}];}_0xe99948=_[_0xe5b6('0x43')]({},_0xe99948,_0x38b45c[_0xe5b6('0x4a')]);return db[_0xe5b6('0x2f')][_0xe5b6('0x4b')](_0xe99948)[_0xe5b6('0x27')](handleEntityNotFound(_0x424226,null))[_0xe5b6('0x27')](respondWithResult(_0x424226,null))[_0xe5b6('0x48')](handleError(_0x424226,null));};exports[_0xe5b6('0x4c')]=function(_0x2bc2ef,_0x4c5c50){return db[_0xe5b6('0x2f')][_0xe5b6('0x4c')](_0x2bc2ef[_0xe5b6('0x4d')],{})[_0xe5b6('0x27')](function(_0x444e84){var _0x4bf848=_0x2bc2ef['user'][_0xe5b6('0x29')]({'plain':!![]});if(!_0x4bf848)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bf848['role']===_0xe5b6('0x4e')){var _0x45f065=_0x444e84[_0xe5b6('0x29')]({'plain':!![]});var _0x1f419c='IvrCampaigns';return db[_0xe5b6('0x4f')][_0xe5b6('0x4b')]({'where':{'name':_0x1f419c,'userProfileId':_0x4bf848[_0xe5b6('0x50')]},'raw':!![]})['then'](function(_0x4b97b0){if(_0x4b97b0&&_0x4b97b0[_0xe5b6('0x51')]===0x0){return db['UserProfileResource'][_0xe5b6('0x4c')]({'name':_0x45f065[_0xe5b6('0x2d')],'resourceId':_0x45f065['id'],'type':_0x4b97b0[_0xe5b6('0x2d')],'sectionId':_0x4b97b0['id']},{})[_0xe5b6('0x27')](function(){return _0x444e84;});}else{return _0x444e84;}})['catch'](function(_0x26cbcb){logger[_0xe5b6('0x2b')](_0xe5b6('0x52'),_0x26cbcb);throw _0x26cbcb;});}return _0x444e84;})[_0xe5b6('0x27')](respondWithResult(_0x4c5c50,0xc9))[_0xe5b6('0x48')](handleError(_0x4c5c50,null));};exports['clone']=function(_0x4f4e8c,_0x17ffc8){var _0x2bc89b={'where':{'id':_0x4f4e8c[_0xe5b6('0x53')]['id']}},_0x4d9530={};_0x4d9530[_0xe5b6('0x39')]=_[_0xe5b6('0x36')](db['Campaign'][_0xe5b6('0x30')]);_0x2bc89b[_0xe5b6('0x3b')]=_['intersection'](_0x4d9530[_0xe5b6('0x39')],qs[_0xe5b6('0x3a')](_0x4f4e8c[_0xe5b6('0x35')]['fields']));_0x2bc89b[_0xe5b6('0x3b')]=_0x2bc89b[_0xe5b6('0x3b')][_0xe5b6('0x3c')]?_0x2bc89b['attributes']:_0x4d9530[_0xe5b6('0x39')];if(_0x4f4e8c['query'][_0xe5b6('0x44')]){_0x2bc89b[_0xe5b6('0x45')]=[{'all':!![]}];}_0x2bc89b=_[_0xe5b6('0x43')]({},_0x2bc89b,_0x4f4e8c[_0xe5b6('0x4a')]);return db['Campaign'][_0xe5b6('0x4b')](_0x2bc89b)[_0xe5b6('0x27')](handleEntityNotFound(_0x17ffc8,null))['then'](function(_0x1a470d){if(_0x1a470d){var _0x188777=_0x1a470d[_0xe5b6('0x29')]({'plain':!![]});_0x188777=qs[_0xe5b6('0x54')](_0x188777,['id','createdAt',_0xe5b6('0x55')]);_0x4f4e8c[_0xe5b6('0x4d')]=_[_0xe5b6('0x54')](_0x4f4e8c[_0xe5b6('0x4d')],['id',_0xe5b6('0x56'),_0xe5b6('0x55')]);return db[_0xe5b6('0x2f')][_0xe5b6('0x4c')](_[_0xe5b6('0x43')](_0x188777,_0x4f4e8c[_0xe5b6('0x4d')]),{'include':_0x4f4e8c[_0xe5b6('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0xe5b6('0x27')](function(_0x35d7c2){var _0x488dd6=_0x4f4e8c[_0xe5b6('0x4e')][_0xe5b6('0x29')]({'plain':!![]});if(!_0x488dd6)throw new Error(_0xe5b6('0x57'));if(_0x488dd6['role']===_0xe5b6('0x4e')){var _0x139bcb=_0x35d7c2[_0xe5b6('0x29')]({'plain':!![]});var _0x2ffe45=_0xe5b6('0x58');return db[_0xe5b6('0x4f')]['find']({'where':{'name':_0x2ffe45,'userProfileId':_0x488dd6[_0xe5b6('0x50')]},'raw':!![]})[_0xe5b6('0x27')](function(_0xdb0019){if(_0xdb0019&&_0xdb0019[_0xe5b6('0x51')]===0x0){return db[_0xe5b6('0x2a')][_0xe5b6('0x4c')]({'name':_0x139bcb[_0xe5b6('0x2d')],'resourceId':_0x139bcb['id'],'type':_0xdb0019[_0xe5b6('0x2d')],'sectionId':_0xdb0019['id']},{})[_0xe5b6('0x27')](function(){return _0x35d7c2;});}else{return _0x35d7c2;}})[_0xe5b6('0x48')](function(_0x99c1dc){logger[_0xe5b6('0x2b')](_0xe5b6('0x52'),_0x99c1dc);throw _0x99c1dc;});}return _0x35d7c2;});}})['then'](respondWithResult(_0x17ffc8,0xc9))[_0xe5b6('0x48')](handleError(_0x17ffc8,null));};exports[_0xe5b6('0x26')]=function(_0x1c1f5c,_0x4e09aa){if(_0x1c1f5c[_0xe5b6('0x4d')]['id']){delete _0x1c1f5c[_0xe5b6('0x4d')]['id'];}return db[_0xe5b6('0x2f')]['find']({'where':{'id':_0x1c1f5c[_0xe5b6('0x53')]['id']}})[_0xe5b6('0x27')](handleEntityNotFound(_0x4e09aa,null))[_0xe5b6('0x27')](saveUpdates(_0x1c1f5c[_0xe5b6('0x4d')],null))[_0xe5b6('0x27')](respondWithResult(_0x4e09aa,null))[_0xe5b6('0x48')](handleError(_0x4e09aa,null));};exports[_0xe5b6('0x28')]=function(_0x3cc602,_0x19213b){return db[_0xe5b6('0x2f')][_0xe5b6('0x4b')]({'where':{'id':_0x3cc602[_0xe5b6('0x53')]['id']}})['then'](handleEntityNotFound(_0x19213b,null))[_0xe5b6('0x27')](removeEntity(_0x19213b,null))[_0xe5b6('0x48')](handleError(_0x19213b,null));};exports[_0xe5b6('0x59')]=function(_0x2dbb15,_0x17baa5,_0x2cea24){var _0x43a059={'raw':!![],'where':{}};var _0x2e4130={};var _0x529b68={'count':0x0,'rows':[]};return db[_0xe5b6('0x2f')][_0xe5b6('0x5a')]({'where':{'id':_0x2dbb15[_0xe5b6('0x53')]['id']}})['then'](handleEntityNotFound(_0x17baa5,null))[_0xe5b6('0x27')](function(_0x25f21a){if(_0x25f21a){_0x2e4130['model']=_['keys'](db[_0xe5b6('0x5b')][_0xe5b6('0x30')]);_0x2e4130[_0xe5b6('0x35')]=_[_0xe5b6('0x36')](_0x2dbb15[_0xe5b6('0x35')]);_0x2e4130[_0xe5b6('0x37')]=_[_0xe5b6('0x38')](_0x2e4130[_0xe5b6('0x39')],_0x2e4130[_0xe5b6('0x35')]);_0x43a059['attributes']=_[_0xe5b6('0x38')](_0x2e4130['model'],qs[_0xe5b6('0x3a')](_0x2dbb15[_0xe5b6('0x35')][_0xe5b6('0x3a')]));_0x43a059[_0xe5b6('0x3b')]=_0x43a059[_0xe5b6('0x3b')][_0xe5b6('0x3c')]?_0x43a059[_0xe5b6('0x3b')]:_0x2e4130['model'];if(!_0x2dbb15[_0xe5b6('0x35')]['hasOwnProperty']('nolimit')){_0x43a059[_0xe5b6('0x1f')]=qs['limit'](_0x2dbb15[_0xe5b6('0x35')][_0xe5b6('0x1f')]);_0x43a059['offset']=qs[_0xe5b6('0x1d')](_0x2dbb15[_0xe5b6('0x35')][_0xe5b6('0x1d')]);}_0x43a059[_0xe5b6('0x3e')]=qs[_0xe5b6('0x3f')](_0x2dbb15['query']['sort']);_0x43a059['where']=qs[_0xe5b6('0x37')](_[_0xe5b6('0x41')](_0x2dbb15[_0xe5b6('0x35')],_0x2e4130[_0xe5b6('0x37')]));_0x43a059[_0xe5b6('0x40')][_0xe5b6('0x5c')]=_0x25f21a['id'];if(_0x2dbb15['query'][_0xe5b6('0x42')]){_0x43a059[_0xe5b6('0x40')]=_[_0xe5b6('0x43')](_0x43a059['where'],{'$or':_['map'](_0x43a059[_0xe5b6('0x3b')],function(_0x57e559){var _0xa495b0={};_0xa495b0[_0x57e559]={'$like':'%'+_0x2dbb15[_0xe5b6('0x35')][_0xe5b6('0x42')]+'%'};return _0xa495b0;})});}_0x43a059=_[_0xe5b6('0x43')]({},_0x43a059,_0x2dbb15['options']);return db[_0xe5b6('0x5b')][_0xe5b6('0x20')]({'where':_0x43a059[_0xe5b6('0x40')]})[_0xe5b6('0x27')](function(_0x838480){_0x529b68[_0xe5b6('0x20')]=_0x838480;if(_0x2dbb15[_0xe5b6('0x35')][_0xe5b6('0x44')]){_0x43a059['include']=[{'all':!![]}];}return db['CmHopper'][_0xe5b6('0x46')](_0x43a059);})['then'](function(_0x11c1f8){_0x529b68[_0xe5b6('0x47')]=_0x11c1f8;return _0x529b68;});}})[_0xe5b6('0x27')](respondWithFilteredResult(_0x17baa5,_0x43a059))['catch'](handleError(_0x17baa5,null));};exports[_0xe5b6('0x5d')]=function(_0x296933,_0x1e87e5,_0x2998d2){var _0x28781c={'raw':!![],'where':{}};var _0x1ec007={};var _0x418861={'count':0x0,'rows':[]};return db[_0xe5b6('0x2f')][_0xe5b6('0x5a')]({'where':{'id':_0x296933[_0xe5b6('0x53')]['id']}})[_0xe5b6('0x27')](handleEntityNotFound(_0x1e87e5,null))[_0xe5b6('0x27')](function(_0x8b742b){if(_0x8b742b){_0x1ec007[_0xe5b6('0x39')]=_['keys'](db['CmHopperHistory'][_0xe5b6('0x30')]);_0x1ec007[_0xe5b6('0x35')]=_[_0xe5b6('0x36')](_0x296933[_0xe5b6('0x35')]);_0x1ec007['filters']=_['intersection'](_0x1ec007['model'],_0x1ec007[_0xe5b6('0x35')]);_0x28781c[_0xe5b6('0x3b')]=_[_0xe5b6('0x38')](_0x1ec007[_0xe5b6('0x39')],qs[_0xe5b6('0x3a')](_0x296933['query'][_0xe5b6('0x3a')]));_0x28781c[_0xe5b6('0x3b')]=_0x28781c['attributes'][_0xe5b6('0x3c')]?_0x28781c[_0xe5b6('0x3b')]:_0x1ec007['model'];if(!_0x296933[_0xe5b6('0x35')][_0xe5b6('0x3d')](_0xe5b6('0x5e'))){_0x28781c['limit']=qs['limit'](_0x296933[_0xe5b6('0x35')][_0xe5b6('0x1f')]);_0x28781c['offset']=qs[_0xe5b6('0x1d')](_0x296933['query'][_0xe5b6('0x1d')]);}_0x28781c['order']=qs[_0xe5b6('0x3f')](_0x296933['query'][_0xe5b6('0x3f')]);_0x28781c['where']=qs[_0xe5b6('0x37')](_[_0xe5b6('0x41')](_0x296933['query'],_0x1ec007[_0xe5b6('0x37')]));_0x28781c[_0xe5b6('0x40')][_0xe5b6('0x5c')]=_0x8b742b['id'];if(_0x296933[_0xe5b6('0x35')][_0xe5b6('0x42')]){_0x28781c['where']=_[_0xe5b6('0x43')](_0x28781c[_0xe5b6('0x40')],{'$or':_[_0xe5b6('0x34')](_0x28781c[_0xe5b6('0x3b')],function(_0x278fb5){var _0x21acf3={};_0x21acf3[_0x278fb5]={'$like':'%'+_0x296933[_0xe5b6('0x35')][_0xe5b6('0x42')]+'%'};return _0x21acf3;})});}_0x28781c=_[_0xe5b6('0x43')]({},_0x28781c,_0x296933[_0xe5b6('0x4a')]);return db[_0xe5b6('0x5f')][_0xe5b6('0x20')]({'where':_0x28781c[_0xe5b6('0x40')]})[_0xe5b6('0x27')](function(_0x2ddb36){_0x418861['count']=_0x2ddb36;if(_0x296933[_0xe5b6('0x35')][_0xe5b6('0x44')]){_0x28781c[_0xe5b6('0x45')]=[{'all':!![]}];}return db[_0xe5b6('0x5f')][_0xe5b6('0x46')](_0x28781c);})[_0xe5b6('0x27')](function(_0xcc9f25){_0x418861['rows']=_0xcc9f25;return _0x418861;});}})[_0xe5b6('0x27')](respondWithFilteredResult(_0x1e87e5,_0x28781c))[_0xe5b6('0x48')](handleError(_0x1e87e5,null));};exports[_0xe5b6('0x60')]=function(_0x4d0e88,_0xc79b67,_0x4fce31){var _0x5d99e3={'raw':!![],'where':{}};var _0xffc776={};var _0x47df63={'count':0x0,'rows':[]};return db[_0xe5b6('0x2f')][_0xe5b6('0x5a')]({'where':{'id':_0x4d0e88[_0xe5b6('0x53')]['id']}})['then'](handleEntityNotFound(_0xc79b67,null))[_0xe5b6('0x27')](function(_0x50b4f5){if(_0x50b4f5){_0xffc776[_0xe5b6('0x39')]=_[_0xe5b6('0x36')](db[_0xe5b6('0x61')][_0xe5b6('0x30')]);_0xffc776[_0xe5b6('0x35')]=_[_0xe5b6('0x36')](_0x4d0e88[_0xe5b6('0x35')]);_0xffc776['filters']=_['intersection'](_0xffc776[_0xe5b6('0x39')],_0xffc776['query']);_0x5d99e3[_0xe5b6('0x3b')]=_[_0xe5b6('0x38')](_0xffc776[_0xe5b6('0x39')],qs[_0xe5b6('0x3a')](_0x4d0e88['query']['fields']));_0x5d99e3[_0xe5b6('0x3b')]=_0x5d99e3['attributes'][_0xe5b6('0x3c')]?_0x5d99e3[_0xe5b6('0x3b')]:_0xffc776[_0xe5b6('0x39')];if(!_0x4d0e88[_0xe5b6('0x35')][_0xe5b6('0x3d')](_0xe5b6('0x5e'))){_0x5d99e3[_0xe5b6('0x1f')]=qs[_0xe5b6('0x1f')](_0x4d0e88[_0xe5b6('0x35')][_0xe5b6('0x1f')]);_0x5d99e3['offset']=qs[_0xe5b6('0x1d')](_0x4d0e88[_0xe5b6('0x35')][_0xe5b6('0x1d')]);}_0x5d99e3[_0xe5b6('0x3e')]=qs['sort'](_0x4d0e88[_0xe5b6('0x35')][_0xe5b6('0x3f')]);_0x5d99e3[_0xe5b6('0x40')]=qs[_0xe5b6('0x37')](_['pick'](_0x4d0e88[_0xe5b6('0x35')],_0xffc776[_0xe5b6('0x37')]));_0x5d99e3[_0xe5b6('0x40')]['CampaignId']=_0x50b4f5['id'];if(_0x4d0e88[_0xe5b6('0x35')]['filter']){_0x5d99e3[_0xe5b6('0x40')]=_['merge'](_0x5d99e3[_0xe5b6('0x40')],{'$or':_[_0xe5b6('0x34')](_0x5d99e3[_0xe5b6('0x3b')],function(_0x13da6f){var _0x554ba0={};_0x554ba0[_0x13da6f]={'$like':'%'+_0x4d0e88[_0xe5b6('0x35')][_0xe5b6('0x42')]+'%'};return _0x554ba0;})});}_0x5d99e3=_['merge']({},_0x5d99e3,_0x4d0e88['options']);return db[_0xe5b6('0x61')]['count']({'where':_0x5d99e3[_0xe5b6('0x40')]})[_0xe5b6('0x27')](function(_0x46f376){_0x47df63['count']=_0x46f376;if(_0x4d0e88[_0xe5b6('0x35')][_0xe5b6('0x44')]){_0x5d99e3['include']=[{'all':!![]}];}return db[_0xe5b6('0x61')]['findAll'](_0x5d99e3);})['then'](function(_0x4a01c9){_0x47df63[_0xe5b6('0x47')]=_0x4a01c9;return _0x47df63;});}})[_0xe5b6('0x27')](respondWithFilteredResult(_0xc79b67,_0x5d99e3))[_0xe5b6('0x48')](handleError(_0xc79b67,null));};exports[_0xe5b6('0x62')]=function(_0x454515,_0x4a0c60,_0x5d2300){var _0x457046={'raw':!![],'where':{}};var _0x5eeeb2={};var _0x18593e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x454515[_0xe5b6('0x53')]['id']}})[_0xe5b6('0x27')](handleEntityNotFound(_0x4a0c60,null))['then'](function(_0x40ba28){if(_0x40ba28){_0x5eeeb2[_0xe5b6('0x39')]=_[_0xe5b6('0x36')](db[_0xe5b6('0x63')][_0xe5b6('0x30')]);_0x5eeeb2[_0xe5b6('0x35')]=_[_0xe5b6('0x36')](_0x454515['query']);_0x5eeeb2[_0xe5b6('0x37')]=_[_0xe5b6('0x38')](_0x5eeeb2[_0xe5b6('0x39')],_0x5eeeb2['query']);_0x457046[_0xe5b6('0x3b')]=_[_0xe5b6('0x38')](_0x5eeeb2['model'],qs[_0xe5b6('0x3a')](_0x454515[_0xe5b6('0x35')][_0xe5b6('0x3a')]));_0x457046['attributes']=_0x457046['attributes'][_0xe5b6('0x3c')]?_0x457046[_0xe5b6('0x3b')]:_0x5eeeb2[_0xe5b6('0x39')];if(!_0x454515['query'][_0xe5b6('0x3d')](_0xe5b6('0x5e'))){_0x457046[_0xe5b6('0x1f')]=qs[_0xe5b6('0x1f')](_0x454515[_0xe5b6('0x35')]['limit']);_0x457046[_0xe5b6('0x1d')]=qs[_0xe5b6('0x1d')](_0x454515[_0xe5b6('0x35')][_0xe5b6('0x1d')]);}_0x457046[_0xe5b6('0x3e')]=qs[_0xe5b6('0x3f')](_0x454515[_0xe5b6('0x35')]['sort']);_0x457046[_0xe5b6('0x40')]=qs['filters'](_[_0xe5b6('0x41')](_0x454515[_0xe5b6('0x35')],_0x5eeeb2[_0xe5b6('0x37')]));_0x457046[_0xe5b6('0x40')][_0xe5b6('0x5c')]=_0x40ba28['id'];if(_0x454515[_0xe5b6('0x35')][_0xe5b6('0x42')]){_0x457046[_0xe5b6('0x40')]=_['merge'](_0x457046[_0xe5b6('0x40')],{'$or':_[_0xe5b6('0x34')](_0x457046[_0xe5b6('0x3b')],function(_0x505ad5){var _0x459af5={};_0x459af5[_0x505ad5]={'$like':'%'+_0x454515['query'][_0xe5b6('0x42')]+'%'};return _0x459af5;})});}_0x457046=_['merge']({},_0x457046,_0x454515['options']);return db[_0xe5b6('0x63')][_0xe5b6('0x20')]({'where':_0x457046[_0xe5b6('0x40')]})['then'](function(_0x1dcac1){_0x18593e[_0xe5b6('0x20')]=_0x1dcac1;if(_0x454515[_0xe5b6('0x35')][_0xe5b6('0x44')]){_0x457046[_0xe5b6('0x45')]=[{'all':!![]}];}return db[_0xe5b6('0x63')][_0xe5b6('0x46')](_0x457046);})[_0xe5b6('0x27')](function(_0x525902){_0x18593e[_0xe5b6('0x47')]=_0x525902;return _0x18593e;});}})[_0xe5b6('0x27')](respondWithFilteredResult(_0x4a0c60,_0x457046))[_0xe5b6('0x48')](handleError(_0x4a0c60,null));};exports[_0xe5b6('0x64')]=function(_0x2df2e3,_0x27edd9,_0x49a294){var _0x1cd788={};var _0x5a2b06={};var _0x523afc;var _0x119430;return db[_0xe5b6('0x2f')][_0xe5b6('0x5a')]({'where':{'id':_0x2df2e3[_0xe5b6('0x53')]['id']}})['then'](handleEntityNotFound(_0x27edd9,null))[_0xe5b6('0x27')](function(_0x185c14){if(_0x185c14){_0x523afc=_0x185c14;_0x5a2b06[_0xe5b6('0x39')]=_['keys'](db[_0xe5b6('0x65')][_0xe5b6('0x30')]);_0x5a2b06[_0xe5b6('0x35')]=_[_0xe5b6('0x36')](_0x2df2e3[_0xe5b6('0x35')]);_0x5a2b06[_0xe5b6('0x37')]=_[_0xe5b6('0x38')](_0x5a2b06[_0xe5b6('0x39')],_0x5a2b06['query']);_0x1cd788[_0xe5b6('0x3b')]=_[_0xe5b6('0x38')](_0x5a2b06['model'],qs[_0xe5b6('0x3a')](_0x2df2e3[_0xe5b6('0x35')][_0xe5b6('0x3a')]));_0x1cd788[_0xe5b6('0x3b')]=_0x1cd788[_0xe5b6('0x3b')][_0xe5b6('0x3c')]?_0x1cd788[_0xe5b6('0x3b')]:_0x5a2b06['model'];_0x1cd788[_0xe5b6('0x3e')]=qs['sort'](_0x2df2e3[_0xe5b6('0x35')][_0xe5b6('0x3f')]);_0x1cd788[_0xe5b6('0x40')]=qs[_0xe5b6('0x37')](_['pick'](_0x2df2e3[_0xe5b6('0x35')],_0x5a2b06[_0xe5b6('0x37')]));if(_0x2df2e3['query'][_0xe5b6('0x42')]){_0x1cd788[_0xe5b6('0x40')]=_['merge'](_0x1cd788['where'],{'$or':_[_0xe5b6('0x34')](_0x1cd788[_0xe5b6('0x3b')],function(_0x1f0d52){var _0x5be714={};_0x5be714[_0x1f0d52]={'$like':'%'+_0x2df2e3[_0xe5b6('0x35')][_0xe5b6('0x42')]+'%'};return _0x5be714;})});}_0x1cd788=_['merge']({},_0x1cd788,_0x2df2e3[_0xe5b6('0x4a')]);return _0x523afc['getLists'](_0x1cd788);}})['then'](function(_0x37d54e){if(_0x37d54e){_0x119430=_0x37d54e[_0xe5b6('0x3c')];if(!_0x2df2e3[_0xe5b6('0x35')][_0xe5b6('0x3d')](_0xe5b6('0x5e'))){_0x1cd788['limit']=qs[_0xe5b6('0x1f')](_0x2df2e3[_0xe5b6('0x35')]['limit']);_0x1cd788[_0xe5b6('0x1d')]=qs[_0xe5b6('0x1d')](_0x2df2e3[_0xe5b6('0x35')][_0xe5b6('0x1d')]);}return _0x523afc[_0xe5b6('0x64')](_0x1cd788);}})[_0xe5b6('0x27')](function(_0x1ebda9){if(_0x1ebda9){return _0x1ebda9?{'count':_0x119430,'rows':_0x1ebda9}:null;}})['then'](respondWithResult(_0x27edd9,null))[_0xe5b6('0x48')](handleError(_0x27edd9,null));};exports[_0xe5b6('0x66')]=function(_0x357c80,_0x28237a,_0x385133){var _0x5e4446,_0x43b386;return db[_0xe5b6('0x2f')][_0xe5b6('0x4b')]({'where':{'id':_0x357c80[_0xe5b6('0x53')]['id']}})[_0xe5b6('0x27')](handleEntityNotFound(_0x28237a,null))[_0xe5b6('0x27')](function(_0x40d39b){if(_0x40d39b){_0x43b386=_0x40d39b;return _0x40d39b[_0xe5b6('0x66')](_0x357c80['body'][_0xe5b6('0x67')],_['omit'](_0x357c80[_0xe5b6('0x4d')],[_0xe5b6('0x67'),'id'])||{});}return null;})[_0xe5b6('0x68')](function(_0x1564a1){var _0x37ff00;_0x5e4446=_0x1564a1||[];var _0x39b6aa=[];if(_0x1564a1){for(var _0x4479d0=0x0;_0x4479d0<_0x1564a1[_0xe5b6('0x3c')];_0x4479d0+=0x1){var _0x597673=_0x1564a1[_0x4479d0][_0xe5b6('0x29')]({'plain':!![]});_0x43b386[_0xe5b6('0x69')]=_0x357c80['body']['dialCheckDuplicateType']?_0x357c80[_0xe5b6('0x4d')][_0xe5b6('0x69')]:_0x43b386[_0xe5b6('0x69')];switch(_0x43b386['dialCheckDuplicateType']){case'always':_0x37ff00=squel[_0xe5b6('0x6a')]()['into']('cm_hopper')[_0xe5b6('0x6b')]([_0xe5b6('0x6c'),_0xe5b6('0x6d'),'ContactId',_0xe5b6('0x6e'),_0xe5b6('0x5c'),_0xe5b6('0x56'),_0xe5b6('0x55')],squel[_0xe5b6('0x6f')]()[_0xe5b6('0x70')]('phone',_0xe5b6('0x6c'))[_0xe5b6('0x70')]('NOW()',_0xe5b6('0x6d'))[_0xe5b6('0x70')]('id',_0xe5b6('0x71'))[_0xe5b6('0x70')](_0x597673[_0xe5b6('0x72')][_0xe5b6('0x73')](),_0xe5b6('0x6e'))[_0xe5b6('0x70')](_0x357c80['params']['id'][_0xe5b6('0x73')](),_0xe5b6('0x5c'))['field'](_0xe5b6('0x74'),'createdAt')[_0xe5b6('0x70')](_0xe5b6('0x74'),_0xe5b6('0x55'))[_0xe5b6('0x75')]('cm_contacts')[_0xe5b6('0x40')](_0xe5b6('0x76'))['where'](_0xe5b6('0x77'),_0x597673[_0xe5b6('0x72')][_0xe5b6('0x73')]())[_0xe5b6('0x40')](_0xe5b6('0x78'))[_0xe5b6('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe5b6('0x6f')]()[_0xe5b6('0x70')](_0xe5b6('0x79'))[_0xe5b6('0x75')](_0xe5b6('0x7a'))['where'](_0xe5b6('0x7b'),_0x357c80['params']['id']['toString']()))[_0xe5b6('0x40')](_0xe5b6('0x7c'),squel[_0xe5b6('0x6f')]()[_0xe5b6('0x70')](_0xe5b6('0x7d'))[_0xe5b6('0x75')](_0xe5b6('0x7e'))[_0xe5b6('0x40')](_0xe5b6('0x7b'),_0x357c80[_0xe5b6('0x53')]['id'][_0xe5b6('0x73')]())))['toString']();break;case _0xe5b6('0x7f'):_0x37ff00=squel[_0xe5b6('0x6a')]()['into'](_0xe5b6('0x7e'))['fromQuery']([_0xe5b6('0x6c'),'scheduledAt',_0xe5b6('0x71'),'ListId',_0xe5b6('0x5c'),_0xe5b6('0x56'),_0xe5b6('0x55')],squel[_0xe5b6('0x6f')]()['field']('phone',_0xe5b6('0x6c'))['field'](_0xe5b6('0x74'),_0xe5b6('0x6d'))['field']('id',_0xe5b6('0x71'))[_0xe5b6('0x70')](_0x597673[_0xe5b6('0x72')][_0xe5b6('0x73')](),_0xe5b6('0x6e'))[_0xe5b6('0x70')](_0x357c80['params']['id'][_0xe5b6('0x73')](),'CampaignId')[_0xe5b6('0x70')](_0xe5b6('0x74'),_0xe5b6('0x56'))[_0xe5b6('0x70')]('NOW()',_0xe5b6('0x55'))['from'](_0xe5b6('0x80'))['where'](_0xe5b6('0x76'))[_0xe5b6('0x40')]('ListId\x20=\x20?',_0x597673['CmListId']['toString']())['where'](_0xe5b6('0x78'))[_0xe5b6('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe5b6('0x6f')]()['field'](_0xe5b6('0x7d'))[_0xe5b6('0x75')](_0xe5b6('0x7e'))['where'](_0xe5b6('0x7b'),_0x357c80['params']['id']['toString']())))[_0xe5b6('0x73')]();break;default:_0x37ff00=squel[_0xe5b6('0x6a')]()['into'](_0xe5b6('0x7e'))[_0xe5b6('0x6b')](['phone',_0xe5b6('0x6d'),_0xe5b6('0x71'),'ListId',_0xe5b6('0x5c'),_0xe5b6('0x56'),_0xe5b6('0x55')],squel[_0xe5b6('0x6f')]()[_0xe5b6('0x70')](_0xe5b6('0x6c'),_0xe5b6('0x6c'))[_0xe5b6('0x70')]('NOW()',_0xe5b6('0x6d'))['field']('id',_0xe5b6('0x71'))[_0xe5b6('0x70')](_0x597673[_0xe5b6('0x72')][_0xe5b6('0x73')](),_0xe5b6('0x6e'))[_0xe5b6('0x70')](_0x357c80[_0xe5b6('0x53')]['id'][_0xe5b6('0x73')](),_0xe5b6('0x5c'))[_0xe5b6('0x70')](_0xe5b6('0x74'),_0xe5b6('0x56'))['field']('NOW()',_0xe5b6('0x55'))[_0xe5b6('0x75')](_0xe5b6('0x80'))[_0xe5b6('0x40')](_0xe5b6('0x76'))[_0xe5b6('0x40')](_0xe5b6('0x77'),_0x597673[_0xe5b6('0x72')][_0xe5b6('0x73')]())[_0xe5b6('0x40')](_0xe5b6('0x78')))['toString']();}_0x39b6aa['push'](db[_0xe5b6('0x81')][_0xe5b6('0x35')](_0x37ff00));}return BPromise[_0xe5b6('0x82')](_0x39b6aa);}})[_0xe5b6('0x27')](function(){return _0x5e4446;})[_0xe5b6('0x27')](respondWithResult(_0x28237a,null))[_0xe5b6('0x48')](handleError(_0x28237a,null));};exports[_0xe5b6('0x83')]=function(_0x1ca877,_0x26075f,_0x5416d2){return db['Campaign'][_0xe5b6('0x4b')]({'where':{'id':_0x1ca877[_0xe5b6('0x53')]['id']}})[_0xe5b6('0x27')](handleEntityNotFound(_0x26075f,null))[_0xe5b6('0x27')](function(_0x4b4480){if(_0x4b4480){return _0x4b4480['removeLists'](_0x1ca877[_0xe5b6('0x35')][_0xe5b6('0x67')]);}})[_0xe5b6('0x27')](function(_0x4e3d65){if(_0x4e3d65){return db[_0xe5b6('0x5b')][_0xe5b6('0x28')]({'where':{'ListId':_0x1ca877['query'][_0xe5b6('0x67')],'CampaignId':_0x1ca877['params']['id']}})['then'](function(){return _0x4e3d65;});}})[_0xe5b6('0x27')](respondWithStatusCode(_0x26075f,null))[_0xe5b6('0x48')](handleError(_0x26075f,null));};exports[_0xe5b6('0x84')]=function(_0x5cc76,_0x1b1e67,_0x3f9702){var _0xb8eedf={};var _0x1dc639={};var _0xf2861d;var _0x258ece;return db[_0xe5b6('0x2f')]['findOne']({'where':{'id':_0x5cc76[_0xe5b6('0x53')]['id']}})[_0xe5b6('0x27')](handleEntityNotFound(_0x1b1e67,null))[_0xe5b6('0x27')](function(_0x1486fa){if(_0x1486fa){_0xf2861d=_0x1486fa;_0x1dc639[_0xe5b6('0x39')]=_[_0xe5b6('0x36')](db[_0xe5b6('0x65')][_0xe5b6('0x30')]);_0x1dc639[_0xe5b6('0x35')]=_['keys'](_0x5cc76[_0xe5b6('0x35')]);_0x1dc639[_0xe5b6('0x37')]=_[_0xe5b6('0x38')](_0x1dc639[_0xe5b6('0x39')],_0x1dc639[_0xe5b6('0x35')]);_0xb8eedf[_0xe5b6('0x3b')]=_[_0xe5b6('0x38')](_0x1dc639[_0xe5b6('0x39')],qs[_0xe5b6('0x3a')](_0x5cc76[_0xe5b6('0x35')][_0xe5b6('0x3a')]));_0xb8eedf[_0xe5b6('0x3b')]=_0xb8eedf[_0xe5b6('0x3b')][_0xe5b6('0x3c')]?_0xb8eedf['attributes']:_0x1dc639[_0xe5b6('0x39')];_0xb8eedf['order']=qs[_0xe5b6('0x3f')](_0x5cc76[_0xe5b6('0x35')][_0xe5b6('0x3f')]);_0xb8eedf['where']=qs[_0xe5b6('0x37')](_[_0xe5b6('0x41')](_0x5cc76[_0xe5b6('0x35')],_0x1dc639[_0xe5b6('0x37')]));if(_0x5cc76[_0xe5b6('0x35')][_0xe5b6('0x42')]){_0xb8eedf[_0xe5b6('0x40')]=_[_0xe5b6('0x43')](_0xb8eedf[_0xe5b6('0x40')],{'$or':_[_0xe5b6('0x34')](_0xb8eedf[_0xe5b6('0x3b')],function(_0x446a89){var _0x16a997={};_0x16a997[_0x446a89]={'$like':'%'+_0x5cc76[_0xe5b6('0x35')][_0xe5b6('0x42')]+'%'};return _0x16a997;})});}_0xb8eedf=_['merge']({},_0xb8eedf,_0x5cc76[_0xe5b6('0x4a')]);return _0xf2861d['getBlackLists'](_0xb8eedf);}})[_0xe5b6('0x27')](function(_0x243899){if(_0x243899){_0x258ece=_0x243899[_0xe5b6('0x3c')];if(!_0x5cc76['query'][_0xe5b6('0x3d')](_0xe5b6('0x5e'))){_0xb8eedf[_0xe5b6('0x1f')]=qs[_0xe5b6('0x1f')](_0x5cc76[_0xe5b6('0x35')][_0xe5b6('0x1f')]);_0xb8eedf['offset']=qs[_0xe5b6('0x1d')](_0x5cc76[_0xe5b6('0x35')]['offset']);}return _0xf2861d[_0xe5b6('0x84')](_0xb8eedf);}})['then'](function(_0x42496e){if(_0x42496e){return _0x42496e?{'count':_0x258ece,'rows':_0x42496e}:null;}})['then'](respondWithResult(_0x1b1e67,null))[_0xe5b6('0x48')](handleError(_0x1b1e67,null));};exports[_0xe5b6('0x85')]=function(_0x26619e,_0x53ba5a,_0x523c90){var _0x5b87d9,_0x11e2ea;return db[_0xe5b6('0x2f')][_0xe5b6('0x4b')]({'where':{'id':_0x26619e[_0xe5b6('0x53')]['id']}})['then'](handleEntityNotFound(_0x53ba5a,null))[_0xe5b6('0x27')](function(_0x370688){if(_0x370688){_0x11e2ea=_0x370688;return _0x370688[_0xe5b6('0x85')](_0x26619e[_0xe5b6('0x4d')][_0xe5b6('0x67')],_['omit'](_0x26619e[_0xe5b6('0x4d')],[_0xe5b6('0x67'),'id'])||{});}return null;})['spread'](function(_0x12ec9e){var _0x141581;_0x5b87d9=_0x12ec9e||[];var _0x4277ee=[];if(_0x12ec9e){for(var _0x1c7a25=0x0;_0x1c7a25<_0x12ec9e[_0xe5b6('0x3c')];_0x1c7a25+=0x1){var _0x223f29=_0x12ec9e[_0x1c7a25][_0xe5b6('0x29')]({'plain':!![]});_0x141581=squel[_0xe5b6('0x6a')]()['into']('cm_hopper_black')['fromQuery']([_0xe5b6('0x6c'),_0xe5b6('0x71'),'ListId',_0xe5b6('0x5c'),_0xe5b6('0x56'),_0xe5b6('0x55')],squel[_0xe5b6('0x6f')]()[_0xe5b6('0x70')](_0xe5b6('0x6c'),'phone')[_0xe5b6('0x70')]('id',_0xe5b6('0x71'))[_0xe5b6('0x70')](_0x223f29[_0xe5b6('0x72')][_0xe5b6('0x73')](),_0xe5b6('0x6e'))['field'](_0x26619e[_0xe5b6('0x53')]['id'][_0xe5b6('0x73')](),_0xe5b6('0x5c'))[_0xe5b6('0x70')](_0xe5b6('0x74'),'createdAt')[_0xe5b6('0x70')](_0xe5b6('0x74'),_0xe5b6('0x55'))[_0xe5b6('0x75')](_0xe5b6('0x80'))[_0xe5b6('0x40')]('deletedAt\x20IS\x20NULL')[_0xe5b6('0x40')](_0xe5b6('0x77'),_0x223f29['CmListId'][_0xe5b6('0x73')]())[_0xe5b6('0x40')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x4277ee['push'](db['sequelize'][_0xe5b6('0x35')](_0x141581));}return BPromise[_0xe5b6('0x82')](_0x4277ee);}})['then'](function(){return _0x5b87d9;})['then'](respondWithResult(_0x53ba5a,null))[_0xe5b6('0x48')](handleError(_0x53ba5a,null));};exports[_0xe5b6('0x86')]=function(_0x373474,_0x128b46,_0x2a9945){return db[_0xe5b6('0x2f')][_0xe5b6('0x4b')]({'where':{'id':_0x373474[_0xe5b6('0x53')]['id']}})[_0xe5b6('0x27')](handleEntityNotFound(_0x128b46,null))[_0xe5b6('0x27')](function(_0x518dfc){if(_0x518dfc){return _0x518dfc[_0xe5b6('0x86')](_0x373474[_0xe5b6('0x35')][_0xe5b6('0x67')]);}})[_0xe5b6('0x27')](function(_0x1a0434){if(_0x1a0434){return db['CmHopperBlack'][_0xe5b6('0x28')]({'where':{'ListId':_0x373474[_0xe5b6('0x35')][_0xe5b6('0x67')],'CampaignId':_0x373474['params']['id']}})[_0xe5b6('0x27')](function(){return _0x1a0434;});}})[_0xe5b6('0x27')](respondWithStatusCode(_0x128b46,null))[_0xe5b6('0x48')](handleError(_0x128b46,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6791c22..aa4b6ba 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x186591,_0x41385c){var _0x54d42d=function(_0x50e4f9){while(--_0x50e4f9){_0x186591['push'](_0x186591['shift']());}};_0x54d42d(++_0x41385c);}(_0x7a54,0x106));var _0x47a5=function(_0x52b73a,_0x16cab9){_0x52b73a=_0x52b73a-0x0;var _0x3ae8a4=_0x7a54[_0x52b73a];return _0x3ae8a4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2e5e73,_0x30d4d9){var _0x4cf641=function(_0x26b1b6){while(--_0x26b1b6){_0x2e5e73['push'](_0x2e5e73['shift']());}};_0x4cf641(++_0x30d4d9);}(_0x7a54,0x106));var _0x47a5=function(_0x1eb67d,_0x38af6f){_0x1eb67d=_0x1eb67d-0x0;var _0x4706d7=_0x7a54[_0x1eb67d];return _0x4706d7;};'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 1dd9699..9b4c448 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 _0xa477=['Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2d11c4,_0x31b483){var _0x2406de=function(_0x1eda5b){while(--_0x1eda5b){_0x2d11c4['push'](_0x2d11c4['shift']());}};_0x2406de(++_0x31b483);}(_0xa477,0xe6));var _0x7a47=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa477[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});}exports[_0x7a47('0x18')]=function(_0x5a4e79){var _0x444c48=this;return new Promise(function(_0x4a24b6,_0x203ab4){return db[_0x7a47('0x19')][_0x7a47('0x1a')]({'raw':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1d')]||null:null,'attributes':_0x5a4e79['options']?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1e')]||null:null,'limit':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1f')]||null:null,'include':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x20')]?_[_0x7a47('0x21')](_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x20')],function(_0xe9bb12){return{'model':db[_0xe9bb12['model']],'as':_0xe9bb12['as'],'attributes':_0xe9bb12['attributes'],'include':_0xe9bb12[_0x7a47('0x20')]?_[_0x7a47('0x21')](_0xe9bb12[_0x7a47('0x20')],function(_0x3e598b){return{'model':db[_0x3e598b['model']],'as':_0x3e598b['as'],'attributes':_0x3e598b[_0x7a47('0x1e')],'include':_0x3e598b[_0x7a47('0x20')]?_['map'](_0x3e598b[_0x7a47('0x20')],function(_0x324a85){return{'model':db[_0x324a85[_0x7a47('0x22')]],'as':_0x324a85['as'],'attributes':_0x324a85[_0x7a47('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a47('0xd')](function(_0x5b2a0c){logger[_0x7a47('0xe')](_0x7a47('0x18'),_0x5a4e79);logger[_0x7a47('0x11')](_0x7a47('0x18'),_0x5a4e79,JSON['stringify'](_0x5b2a0c));_0x4a24b6(_0x5b2a0c);})['catch'](function(_0x5d4b9c){logger[_0x7a47('0x14')](_0x7a47('0x18'),_0x5d4b9c[_0x7a47('0x16')],_0x5a4e79);_0x203ab4(_0x444c48[_0x7a47('0x14')](0x1f4,_0x5d4b9c[_0x7a47('0x16')]));});});}; \ No newline at end of file +var _0x630e=['include','model','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map'];(function(_0x48ae51,_0x2a222f){var _0x5a8bb1=function(_0x1f0bc5){while(--_0x1f0bc5){_0x48ae51['push'](_0x48ae51['shift']());}};_0x5a8bb1(++_0x2a222f);}(_0x630e,0x1af));var _0xe630=function(_0x3353ee,_0x5167bf){_0x3353ee=_0x3353ee-0x0;var _0x3fdd87=_0x630e[_0x3353ee];return _0x3fdd87;};'use strict';var _=require(_0xe630('0x0'));var util=require('util');var moment=require(_0xe630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe630('0x2'));var db=require(_0xe630('0x3'))['db'];var utils=require(_0xe630('0x4'));var logger=require('../../config/logger')(_0xe630('0x5'));var config=require(_0xe630('0x6'));var jayson=require(_0xe630('0x7'));var client=jayson[_0xe630('0x8')][_0xe630('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x481b21,_0x20193d,_0x34bad4){return new BPromise(function(_0x5a73ad,_0x267926){return client['request'](_0x481b21,_0x34bad4)[_0xe630('0xa')](function(_0x3da641){logger[_0xe630('0xb')]('Campaign,\x20%s,\x20%s',_0x20193d,'request\x20sent');logger[_0xe630('0xc')](_0xe630('0xd'),_0x20193d,_0xe630('0xe'),JSON[_0xe630('0xf')](_0x3da641));if(_0x3da641['error']){if(_0x3da641[_0xe630('0x10')][_0xe630('0x11')]===0x1f4){logger[_0xe630('0x10')](_0xe630('0x12'),_0x20193d,_0x3da641[_0xe630('0x10')][_0xe630('0x13')]);return _0x267926(_0x3da641[_0xe630('0x10')][_0xe630('0x13')]);}logger[_0xe630('0x10')](_0xe630('0x12'),_0x20193d,_0x3da641[_0xe630('0x10')][_0xe630('0x13')]);return _0x5a73ad(_0x3da641[_0xe630('0x10')]['message']);}else{logger[_0xe630('0xb')](_0xe630('0x12'),_0x20193d,_0xe630('0xe'));_0x5a73ad(_0x3da641[_0xe630('0x14')][_0xe630('0x13')]);}})[_0xe630('0x15')](function(_0x26a2b7){logger[_0xe630('0x10')](_0xe630('0x12'),_0x20193d,_0x26a2b7);_0x267926(_0x26a2b7);});});}exports[_0xe630('0x16')]=function(_0x3dbcf6){var _0x9721fa=this;return new Promise(function(_0xafcf13,_0x79213e){return db[_0xe630('0x17')][_0xe630('0x18')]({'raw':_0x3dbcf6[_0xe630('0x19')]?_0x3dbcf6[_0xe630('0x19')][_0xe630('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dbcf6[_0xe630('0x19')]?_0x3dbcf6[_0xe630('0x19')][_0xe630('0x1b')]||null:null,'attributes':_0x3dbcf6[_0xe630('0x19')]?_0x3dbcf6[_0xe630('0x19')][_0xe630('0x1c')]||null:null,'limit':_0x3dbcf6[_0xe630('0x19')]?_0x3dbcf6['options'][_0xe630('0x1d')]||null:null,'include':_0x3dbcf6[_0xe630('0x19')]?_0x3dbcf6[_0xe630('0x19')]['include']?_[_0xe630('0x1e')](_0x3dbcf6[_0xe630('0x19')][_0xe630('0x1f')],function(_0x5c2ac6){return{'model':db[_0x5c2ac6[_0xe630('0x20')]],'as':_0x5c2ac6['as'],'attributes':_0x5c2ac6[_0xe630('0x1c')],'include':_0x5c2ac6[_0xe630('0x1f')]?_[_0xe630('0x1e')](_0x5c2ac6[_0xe630('0x1f')],function(_0x277b9f){return{'model':db[_0x277b9f[_0xe630('0x20')]],'as':_0x277b9f['as'],'attributes':_0x277b9f['attributes'],'include':_0x277b9f[_0xe630('0x1f')]?_[_0xe630('0x1e')](_0x277b9f['include'],function(_0x69c24c){return{'model':db[_0x69c24c[_0xe630('0x20')]],'as':_0x69c24c['as'],'attributes':_0x69c24c[_0xe630('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5670a1){logger['info']('GetCampaign',_0x3dbcf6);logger['debug'](_0xe630('0x16'),_0x3dbcf6,JSON['stringify'](_0x5670a1));_0xafcf13(_0x5670a1);})['catch'](function(_0x70f17e){logger[_0xe630('0x10')](_0xe630('0x16'),_0x70f17e[_0xe630('0x13')],_0x3dbcf6);_0x79213e(_0x9721fa[_0xe630('0x10')](0x1f4,_0x70f17e[_0xe630('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 67323aa..a65df0f 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 _0x7188=['get','index','isAuthenticated','show','getHoppers','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','addLists','put','/:id','delete','removeLists','removeBlackLists','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller'];(function(_0xbff16e,_0x4d9923){var _0xcb701d=function(_0x5464b4){while(--_0x5464b4){_0xbff16e['push'](_0xbff16e['shift']());}};_0xcb701d(++_0x4d9923);}(_0x7188,0x172));var _0x8718=function(_0x3c10b7,_0x10fb4a){_0x3c10b7=_0x3c10b7-0x0;var _0xbd891b=_0x7188[_0x3c10b7];return _0xbd891b;};'use strict';var multer=require('multer');var util=require(_0x8718('0x0'));var path=require('path');var timeout=require(_0x8718('0x1'));var express=require(_0x8718('0x2'));var router=express[_0x8718('0x3')]();var fs_extra=require(_0x8718('0x4'));var auth=require(_0x8718('0x5'));var interaction=require(_0x8718('0x6'));var config=require('../../config/environment');var controller=require(_0x8718('0x7'));router[_0x8718('0x8')]('/',auth['isAuthenticated'](),controller[_0x8718('0x9')]);router[_0x8718('0x8')]('/:id',auth[_0x8718('0xa')](),controller[_0x8718('0xb')]);router[_0x8718('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x8718('0xc')]);router[_0x8718('0x8')]('/:id/hopper_histories',auth[_0x8718('0xa')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x8718('0xd')]);router[_0x8718('0x8')](_0x8718('0xe'),auth[_0x8718('0xa')](),controller[_0x8718('0xf')]);router[_0x8718('0x8')](_0x8718('0x10'),auth['isAuthenticated'](),controller[_0x8718('0x11')]);router['get'](_0x8718('0x12'),auth[_0x8718('0xa')](),controller['getBlackLists']);router[_0x8718('0x13')]('/',auth[_0x8718('0xa')](),controller[_0x8718('0x14')]);router[_0x8718('0x13')]('/:id/clone',auth[_0x8718('0xa')](),controller['clone']);router[_0x8718('0x13')](_0x8718('0x10'),auth[_0x8718('0xa')](),controller[_0x8718('0x15')]);router['post'](_0x8718('0x12'),auth[_0x8718('0xa')](),controller['addBlackLists']);router[_0x8718('0x16')](_0x8718('0x17'),auth[_0x8718('0xa')](),controller['update']);router[_0x8718('0x18')](_0x8718('0x17'),auth[_0x8718('0xa')](),controller['destroy']);router['delete'](_0x8718('0x10'),auth['isAuthenticated'](),controller[_0x8718('0x19')]);router[_0x8718('0x18')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x8718('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x7e68=['./campaign.controller','get','index','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','removeLists','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c1c74,_0x39ea0b){var _0x5667f7=function(_0x3a58eb){while(--_0x3a58eb){_0x5c1c74['push'](_0x5c1c74['shift']());}};_0x5667f7(++_0x39ea0b);}(_0x7e68,0xd8));var _0x87e6=function(_0x12c53e,_0x5b0099){_0x12c53e=_0x12c53e-0x0;var _0x291cbc=_0x7e68[_0x12c53e];return _0x291cbc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x87e6('0x0'));var timeout=require(_0x87e6('0x1'));var express=require(_0x87e6('0x2'));var router=express[_0x87e6('0x3')]();var fs_extra=require(_0x87e6('0x4'));var auth=require(_0x87e6('0x5'));var interaction=require(_0x87e6('0x6'));var config=require(_0x87e6('0x7'));var controller=require(_0x87e6('0x8'));router[_0x87e6('0x9')]('/',auth['isAuthenticated'](),controller[_0x87e6('0xa')]);router['get'](_0x87e6('0xb'),auth[_0x87e6('0xc')](),controller['show']);router[_0x87e6('0x9')](_0x87e6('0xd'),auth[_0x87e6('0xc')](),controller[_0x87e6('0xe')]);router['get'](_0x87e6('0xf'),auth[_0x87e6('0xc')](),controller['getHopperHistories']);router['get'](_0x87e6('0x10'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x11')]);router[_0x87e6('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x87e6('0x12')]);router[_0x87e6('0x9')](_0x87e6('0x13'),auth[_0x87e6('0xc')](),controller['getLists']);router[_0x87e6('0x9')](_0x87e6('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x87e6('0x15')]('/',auth[_0x87e6('0xc')](),controller[_0x87e6('0x16')]);router[_0x87e6('0x15')](_0x87e6('0x17'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x18')]);router['post'](_0x87e6('0x13'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x19')]);router['post'](_0x87e6('0x14'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x1a')]);router[_0x87e6('0x1b')](_0x87e6('0xb'),auth['isAuthenticated'](),controller[_0x87e6('0x1c')]);router[_0x87e6('0x1d')](_0x87e6('0xb'),auth[_0x87e6('0xc')](),controller['destroy']);router[_0x87e6('0x1d')](_0x87e6('0x13'),auth[_0x87e6('0xc')](),controller[_0x87e6('0x1e')]);router[_0x87e6('0x1d')](_0x87e6('0x14'),auth[_0x87e6('0xc')](),controller['removeBlackLists']);module[_0x87e6('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f50185f..6759700 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 _0xa4d7=['exports','TEXT','VIRTUAL','getDataValue','key','sequelize'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa4d7,0x1c7));var _0x7a4d=function(_0x25e01f,_0x159194){_0x25e01f=_0x25e01f-0x0;var _0x51b4f9=_0xa4d7[_0x25e01f];return _0x51b4f9;};'use strict';var Sequelize=require(_0x7a4d('0x0'));module[_0x7a4d('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7a4d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x7a4d('0x3')],'get':function(){return this[_0x7a4d('0x4')](_0x7a4d('0x5'));}}}; \ No newline at end of file +var _0xf1e4=['TEXT','VIRTUAL','key','exports','STRING'];(function(_0x3ac3f9,_0x2ca757){var _0x15db0a=function(_0xdac7bb){while(--_0xdac7bb){_0x3ac3f9['push'](_0x3ac3f9['shift']());}};_0x15db0a(++_0x2ca757);}(_0xf1e4,0x1e3));var _0x4f1e=function(_0x5d0a72,_0x45940b){_0x5d0a72=_0x5d0a72-0x0;var _0x36de1b=_0xf1e4[_0x5d0a72];return _0x36de1b;};'use strict';var Sequelize=require('sequelize');module[_0x4f1e('0x0')]={'key':{'type':Sequelize[_0x4f1e('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x4f1e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4f1e('0x1')]},'name':{'type':Sequelize[_0x4f1e('0x3')],'get':function(){return this['getDataValue'](_0x4f1e('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0221eda..5ad7392 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 _0x9a59=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','CannedAnswers','UserProfileResource','then','end','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','CannedAnswer','includeAll','include','findAll','catch','show','params','find','create','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.'];(function(_0x1983ab,_0x9efe34){var _0xf03bfc=function(_0x4a50c2){while(--_0x4a50c2){_0x1983ab['push'](_0x1983ab['shift']());}};_0xf03bfc(++_0x9efe34);}(_0x9a59,0x107));var _0x99a5=function(_0x5bb82b,_0x51a145){_0x5bb82b=_0x5bb82b-0x0;var _0x9feec9=_0x9a59[_0x5bb82b];return _0x9feec9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99a5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x99a5('0x1'));var moment=require(_0x99a5('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x99a5('0x3'));var path=require(_0x99a5('0x4'));var sox=require(_0x99a5('0x5'));var csv=require(_0x99a5('0x6'));var ejs=require(_0x99a5('0x7'));var fs=require('fs');var fs_extra=require(_0x99a5('0x8'));var _=require('lodash');var squel=require(_0x99a5('0x9'));var crypto=require(_0x99a5('0xa'));var jsforce=require(_0x99a5('0xb'));var deskjs=require(_0x99a5('0xc'));var toCsv=require(_0x99a5('0x6'));var querystring=require('querystring');var Papa=require(_0x99a5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x99a5('0xe'));var as=require(_0x99a5('0xf'));var hardwareService=require(_0x99a5('0x10'));var logger=require(_0x99a5('0x11'))(_0x99a5('0x12'));var utils=require(_0x99a5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x99a5('0x14'));var db=require(_0x99a5('0x15'))['db'];function respondWithStatusCode(_0x42988b,_0x55ffa2){_0x55ffa2=_0x55ffa2||0xcc;return function(_0x33def2){if(_0x33def2){return _0x42988b[_0x99a5('0x16')](_0x55ffa2);}return _0x42988b[_0x99a5('0x17')](_0x55ffa2)['end']();};}function respondWithResult(_0x53039d,_0x209e43){_0x209e43=_0x209e43||0xc8;return function(_0x1c714c){if(_0x1c714c){return _0x53039d['status'](_0x209e43)[_0x99a5('0x18')](_0x1c714c);}};}function respondWithFilteredResult(_0xbcdaf1,_0x4f8283){return function(_0x249105){if(_0x249105){var _0x150519=typeof _0x4f8283[_0x99a5('0x19')]==='undefined'&&typeof _0x4f8283['limit']===_0x99a5('0x1a');var _0x504bbb=_0x249105[_0x99a5('0x1b')];var _0x4d9c44=_0x150519?0x0:_0x4f8283[_0x99a5('0x19')];var _0x2088f2=_0x150519?_0x249105[_0x99a5('0x1b')]:_0x4f8283[_0x99a5('0x19')]+_0x4f8283[_0x99a5('0x1c')];var _0x48510b;if(_0x2088f2>=_0x504bbb){_0x2088f2=_0x504bbb;_0x48510b=0xc8;}else{_0x48510b=0xce;}_0xbcdaf1[_0x99a5('0x17')](_0x48510b);return _0xbcdaf1['set'](_0x99a5('0x1d'),_0x4d9c44+'-'+_0x2088f2+'/'+_0x504bbb)[_0x99a5('0x18')](_0x249105);}return null;};}function patchUpdates(_0x27b2ed){return function(_0x4a8a7f){try{jsonpatch[_0x99a5('0x1e')](_0x4a8a7f,_0x27b2ed,!![]);}catch(_0x2450d4){return BPromise[_0x99a5('0x1f')](_0x2450d4);}return _0x4a8a7f[_0x99a5('0x20')]();};}function saveUpdates(_0x4af509,_0x288ac7){return function(_0x1b2ebd){if(_0x1b2ebd){return _0x1b2ebd[_0x99a5('0x21')](_0x4af509)['then'](function(_0x2276e1){return _0x2276e1;});}return null;};}function removeEntity(_0x10c789,_0x1c5e40){return function(_0x3322e9){if(_0x3322e9){return _0x3322e9[_0x99a5('0x22')]()['then'](function(){var _0x368e6c=_0x3322e9[_0x99a5('0x23')]({'plain':!![]});var _0x9a39ae=_0x99a5('0x24');return db[_0x99a5('0x25')][_0x99a5('0x22')]({'where':{'type':_0x9a39ae,'resourceId':_0x368e6c['id']}})[_0x99a5('0x26')](function(){return _0x3322e9;});})[_0x99a5('0x26')](function(){_0x10c789['status'](0xcc)[_0x99a5('0x27')]();});}};}function handleEntityNotFound(_0x471c20,_0x517b5f){return function(_0x411748){if(!_0x411748){_0x471c20['sendStatus'](0x194);}return _0x411748;};}function handleError(_0x1a197c,_0x29b020){_0x29b020=_0x29b020||0x1f4;return function(_0x51b7da){logger[_0x99a5('0x28')](_0x51b7da[_0x99a5('0x29')]);if(_0x51b7da[_0x99a5('0x2a')]){delete _0x51b7da['name'];}_0x1a197c['status'](_0x29b020)['send'](_0x51b7da);};}exports[_0x99a5('0x2b')]=function(_0xe6bafd,_0x159313){var _0x12e761={},_0x38c2b7={},_0x18e12e={'count':0x0,'rows':[]};var _0x17ff69=_[_0x99a5('0x2c')](db['CannedAnswer'][_0x99a5('0x2d')],function(_0x414ba2){return{'name':_0x414ba2['fieldName'],'type':_0x414ba2['type'][_0x99a5('0x2e')]};});_0x38c2b7[_0x99a5('0x2f')]=_[_0x99a5('0x2c')](_0x17ff69,_0x99a5('0x2a'));_0x38c2b7[_0x99a5('0x30')]=_[_0x99a5('0x31')](_0xe6bafd[_0x99a5('0x30')]);_0x38c2b7[_0x99a5('0x32')]=_[_0x99a5('0x33')](_0x38c2b7[_0x99a5('0x2f')],_0x38c2b7['query']);_0x12e761['attributes']=_[_0x99a5('0x33')](_0x38c2b7['model'],qs['fields'](_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x34')]));_0x12e761['attributes']=_0x12e761[_0x99a5('0x35')][_0x99a5('0x36')]?_0x12e761[_0x99a5('0x35')]:_0x38c2b7['model'];if(!_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x37')](_0x99a5('0x38'))){_0x12e761[_0x99a5('0x1c')]=qs[_0x99a5('0x1c')](_0xe6bafd['query'][_0x99a5('0x1c')]);_0x12e761['offset']=qs[_0x99a5('0x19')](_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x19')]);}_0x12e761[_0x99a5('0x39')]=qs[_0x99a5('0x3a')](_0xe6bafd['query']['sort']);_0x12e761['where']=qs[_0x99a5('0x32')](_[_0x99a5('0x3b')](_0xe6bafd[_0x99a5('0x30')],_0x38c2b7[_0x99a5('0x32')]),_0x17ff69);if(_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x3c')]){_0x12e761[_0x99a5('0x3d')]=_[_0x99a5('0x3e')](_0x12e761[_0x99a5('0x3d')],{'$or':[{'key':{'$like':'%'+_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x3c')]+'%'}},{'value':{'$like':'%'+_0xe6bafd[_0x99a5('0x30')]['filter']+'%'}}]});}_0x12e761=_['merge']({},_0x12e761,_0xe6bafd[_0x99a5('0x3f')]);var _0x436c6b={'where':_0x12e761['where']};return db[_0x99a5('0x40')]['count'](_0x436c6b)[_0x99a5('0x26')](function(_0x1519b1){_0x18e12e[_0x99a5('0x1b')]=_0x1519b1;if(_0xe6bafd['query'][_0x99a5('0x41')]){_0x12e761[_0x99a5('0x42')]=[{'all':!![]}];}return db[_0x99a5('0x40')][_0x99a5('0x43')](_0x12e761);})[_0x99a5('0x26')](function(_0x140513){_0x18e12e['rows']=_0x140513;return _0x18e12e;})['then'](respondWithFilteredResult(_0x159313,_0x12e761))[_0x99a5('0x44')](handleError(_0x159313,null));};exports[_0x99a5('0x45')]=function(_0x287ebc,_0x4fb1d6){var _0x30abd3={'raw':!![],'where':{'id':_0x287ebc[_0x99a5('0x46')]['id']}},_0xf218e5={};_0xf218e5[_0x99a5('0x2f')]=_[_0x99a5('0x31')](db[_0x99a5('0x40')][_0x99a5('0x2d')]);_0xf218e5[_0x99a5('0x30')]=_[_0x99a5('0x31')](_0x287ebc[_0x99a5('0x30')]);_0xf218e5[_0x99a5('0x32')]=_[_0x99a5('0x33')](_0xf218e5['model'],_0xf218e5[_0x99a5('0x30')]);_0x30abd3[_0x99a5('0x35')]=_[_0x99a5('0x33')](_0xf218e5[_0x99a5('0x2f')],qs[_0x99a5('0x34')](_0x287ebc['query']['fields']));_0x30abd3[_0x99a5('0x35')]=_0x30abd3[_0x99a5('0x35')][_0x99a5('0x36')]?_0x30abd3[_0x99a5('0x35')]:_0xf218e5[_0x99a5('0x2f')];if(_0x287ebc[_0x99a5('0x30')][_0x99a5('0x41')]){_0x30abd3[_0x99a5('0x42')]=[{'all':!![]}];}_0x30abd3=_[_0x99a5('0x3e')]({},_0x30abd3,_0x287ebc['options']);return db['CannedAnswer'][_0x99a5('0x47')](_0x30abd3)[_0x99a5('0x26')](handleEntityNotFound(_0x4fb1d6,null))[_0x99a5('0x26')](respondWithResult(_0x4fb1d6,null))[_0x99a5('0x44')](handleError(_0x4fb1d6,null));};exports[_0x99a5('0x21')]=function(_0x5a644a,_0x31290b){if(_0x5a644a['body']['id']){delete _0x5a644a['body']['id'];}return db[_0x99a5('0x40')][_0x99a5('0x47')]({'where':{'id':_0x5a644a['params']['id']}})['then'](handleEntityNotFound(_0x31290b,null))[_0x99a5('0x26')](saveUpdates(_0x5a644a['body'],null))[_0x99a5('0x26')](respondWithResult(_0x31290b,null))[_0x99a5('0x44')](handleError(_0x31290b,null));};exports[_0x99a5('0x22')]=function(_0x256e85,_0x328a40){return db[_0x99a5('0x40')][_0x99a5('0x47')]({'where':{'id':_0x256e85[_0x99a5('0x46')]['id']}})[_0x99a5('0x26')](handleEntityNotFound(_0x328a40,null))[_0x99a5('0x26')](removeEntity(_0x328a40,null))[_0x99a5('0x44')](handleError(_0x328a40,null));};exports[_0x99a5('0x48')]=function(_0x2f29b3,_0x6bf379){var _0x15b30f={'key':_0x2f29b3['body'][_0x99a5('0x2e')]};if(_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4a')]){_0x15b30f[_0x99a5('0x4a')]=_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4a')];}else if(_0x2f29b3[_0x99a5('0x49')]['SmsAccountId']){_0x15b30f[_0x99a5('0x4b')]=_0x2f29b3[_0x99a5('0x49')]['SmsAccountId'];}else if(_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4c')]){_0x15b30f[_0x99a5('0x4c')]=_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4c')];}else if(_0x2f29b3[_0x99a5('0x49')]['ChatWebsiteId']){_0x15b30f[_0x99a5('0x4d')]=_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4d')];}return db['CannedAnswer'][_0x99a5('0x47')]({'where':_0x15b30f})[_0x99a5('0x26')](function(_0x57290e){if(_0x57290e){throw new db[(_0x99a5('0x4e'))][(_0x99a5('0x4f'))](_0x99a5('0x50'));}return db['CannedAnswer']['create'](_0x2f29b3[_0x99a5('0x49')]);})[_0x99a5('0x26')](function(_0x121e72){var _0xe9261f=_0x2f29b3['user'][_0x99a5('0x23')]({'plain':!![]});if(!_0xe9261f)throw new Error(_0x99a5('0x51'));if(_0xe9261f[_0x99a5('0x52')]===_0x99a5('0x53')){var _0x54b1ec=_0x121e72[_0x99a5('0x23')]({'plain':!![]});return db[_0x99a5('0x54')][_0x99a5('0x47')]({'where':{'name':_0x99a5('0x24'),'userProfileId':_0xe9261f[_0x99a5('0x55')]},'raw':!![]})[_0x99a5('0x26')](function(_0x1fc827){if(_0x1fc827&&_0x1fc827['autoAssociation']===0x0){return db['UserProfileResource'][_0x99a5('0x48')]({'name':_0x54b1ec[_0x99a5('0x2a')],'resourceId':_0x54b1ec['id'],'type':_0x1fc827[_0x99a5('0x2a')],'sectionId':_0x1fc827['id']},{})['then'](function(){return _0x121e72;});}else{return _0x121e72;}})[_0x99a5('0x44')](function(_0x723510){logger[_0x99a5('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x723510);throw _0x723510;});}return _0x121e72;})[_0x99a5('0x26')](respondWithResult(_0x6bf379,0xc9))[_0x99a5('0x44')](handleError(_0x6bf379,null));}; \ No newline at end of file +var _0x0ceb=['end','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','length','include','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers'];(function(_0x1022a9,_0x5ec915){var _0x470b65=function(_0x292c12){while(--_0x292c12){_0x1022a9['push'](_0x1022a9['shift']());}};_0x470b65(++_0x5ec915);}(_0x0ceb,0xef));var _0xb0ce=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0ceb[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb0ce('0x0'));var zipdir=require(_0xb0ce('0x1'));var jsonpatch=require(_0xb0ce('0x2'));var rp=require(_0xb0ce('0x3'));var moment=require('moment');var BPromise=require(_0xb0ce('0x4'));var Mustache=require(_0xb0ce('0x5'));var util=require(_0xb0ce('0x6'));var path=require(_0xb0ce('0x7'));var sox=require(_0xb0ce('0x8'));var csv=require('to-csv');var ejs=require(_0xb0ce('0x9'));var fs=require('fs');var fs_extra=require(_0xb0ce('0xa'));var _=require(_0xb0ce('0xb'));var squel=require(_0xb0ce('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb0ce('0xd'));var toCsv=require(_0xb0ce('0xe'));var querystring=require(_0xb0ce('0xf'));var Papa=require(_0xb0ce('0x10'));var Redis=require(_0xb0ce('0x11'));var authService=require(_0xb0ce('0x12'));var qs=require(_0xb0ce('0x13'));var as=require(_0xb0ce('0x14'));var hardwareService=require(_0xb0ce('0x15'));var logger=require(_0xb0ce('0x16'))(_0xb0ce('0x17'));var utils=require(_0xb0ce('0x18'));var config=require(_0xb0ce('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0ce('0x1a'))['db'];function respondWithStatusCode(_0x47e730,_0x43c977){_0x43c977=_0x43c977||0xcc;return function(_0x1033b5){if(_0x1033b5){return _0x47e730[_0xb0ce('0x1b')](_0x43c977);}return _0x47e730[_0xb0ce('0x1c')](_0x43c977)['end']();};}function respondWithResult(_0x2312bd,_0x2ec5c3){_0x2ec5c3=_0x2ec5c3||0xc8;return function(_0x4895be){if(_0x4895be){return _0x2312bd[_0xb0ce('0x1c')](_0x2ec5c3)[_0xb0ce('0x1d')](_0x4895be);}};}function respondWithFilteredResult(_0x3e2da8,_0x4a5e4b){return function(_0x45886e){if(_0x45886e){var _0x2b570c=typeof _0x4a5e4b['offset']==='undefined'&&typeof _0x4a5e4b[_0xb0ce('0x1e')]==='undefined';var _0x1ef86e=_0x45886e[_0xb0ce('0x1f')];var _0x8e85cd=_0x2b570c?0x0:_0x4a5e4b[_0xb0ce('0x20')];var _0x20f7c2=_0x2b570c?_0x45886e['count']:_0x4a5e4b[_0xb0ce('0x20')]+_0x4a5e4b[_0xb0ce('0x1e')];var _0x5ee0bd;if(_0x20f7c2>=_0x1ef86e){_0x20f7c2=_0x1ef86e;_0x5ee0bd=0xc8;}else{_0x5ee0bd=0xce;}_0x3e2da8[_0xb0ce('0x1c')](_0x5ee0bd);return _0x3e2da8[_0xb0ce('0x21')](_0xb0ce('0x22'),_0x8e85cd+'-'+_0x20f7c2+'/'+_0x1ef86e)['json'](_0x45886e);}return null;};}function patchUpdates(_0x4afd92){return function(_0x3155b9){try{jsonpatch[_0xb0ce('0x23')](_0x3155b9,_0x4afd92,!![]);}catch(_0x6917e3){return BPromise[_0xb0ce('0x24')](_0x6917e3);}return _0x3155b9[_0xb0ce('0x25')]();};}function saveUpdates(_0x5126d4,_0xe1f8c5){return function(_0x5e01f7){if(_0x5e01f7){return _0x5e01f7[_0xb0ce('0x26')](_0x5126d4)[_0xb0ce('0x27')](function(_0x33d1b1){return _0x33d1b1;});}return null;};}function removeEntity(_0xbb9b88,_0x1a3341){return function(_0x357b10){if(_0x357b10){return _0x357b10[_0xb0ce('0x28')]()[_0xb0ce('0x27')](function(){var _0x4c14b8=_0x357b10[_0xb0ce('0x29')]({'plain':!![]});var _0x39ab75=_0xb0ce('0x2a');return db['UserProfileResource'][_0xb0ce('0x28')]({'where':{'type':_0x39ab75,'resourceId':_0x4c14b8['id']}})[_0xb0ce('0x27')](function(){return _0x357b10;});})[_0xb0ce('0x27')](function(){_0xbb9b88[_0xb0ce('0x1c')](0xcc)[_0xb0ce('0x2b')]();});}};}function handleEntityNotFound(_0x51edb6,_0x4537ba){return function(_0x5970d4){if(!_0x5970d4){_0x51edb6[_0xb0ce('0x1b')](0x194);}return _0x5970d4;};}function handleError(_0x429e68,_0x38323c){_0x38323c=_0x38323c||0x1f4;return function(_0x52405f){logger['error'](_0x52405f[_0xb0ce('0x2c')]);if(_0x52405f[_0xb0ce('0x2d')]){delete _0x52405f['name'];}_0x429e68['status'](_0x38323c)[_0xb0ce('0x2e')](_0x52405f);};}exports[_0xb0ce('0x2f')]=function(_0x3b9a1f,_0x562cdb){var _0x124d35={},_0x54ae0c={},_0x432235={'count':0x0,'rows':[]};var _0x3e713c=_[_0xb0ce('0x30')](db[_0xb0ce('0x31')][_0xb0ce('0x32')],function(_0x353319){return{'name':_0x353319['fieldName'],'type':_0x353319[_0xb0ce('0x33')][_0xb0ce('0x34')]};});_0x54ae0c[_0xb0ce('0x35')]=_[_0xb0ce('0x30')](_0x3e713c,'name');_0x54ae0c[_0xb0ce('0x36')]=_[_0xb0ce('0x37')](_0x3b9a1f['query']);_0x54ae0c[_0xb0ce('0x38')]=_['intersection'](_0x54ae0c[_0xb0ce('0x35')],_0x54ae0c['query']);_0x124d35[_0xb0ce('0x39')]=_[_0xb0ce('0x3a')](_0x54ae0c['model'],qs['fields'](_0x3b9a1f[_0xb0ce('0x36')][_0xb0ce('0x3b')]));_0x124d35['attributes']=_0x124d35['attributes']['length']?_0x124d35['attributes']:_0x54ae0c[_0xb0ce('0x35')];if(!_0x3b9a1f['query'][_0xb0ce('0x3c')](_0xb0ce('0x3d'))){_0x124d35['limit']=qs[_0xb0ce('0x1e')](_0x3b9a1f[_0xb0ce('0x36')][_0xb0ce('0x1e')]);_0x124d35[_0xb0ce('0x20')]=qs['offset'](_0x3b9a1f['query'][_0xb0ce('0x20')]);}_0x124d35[_0xb0ce('0x3e')]=qs[_0xb0ce('0x3f')](_0x3b9a1f['query'][_0xb0ce('0x3f')]);_0x124d35[_0xb0ce('0x40')]=qs['filters'](_[_0xb0ce('0x41')](_0x3b9a1f[_0xb0ce('0x36')],_0x54ae0c[_0xb0ce('0x38')]),_0x3e713c);if(_0x3b9a1f[_0xb0ce('0x36')]['filter']){_0x124d35['where']=_['merge'](_0x124d35[_0xb0ce('0x40')],{'$or':[{'key':{'$like':'%'+_0x3b9a1f[_0xb0ce('0x36')]['filter']+'%'}},{'value':{'$like':'%'+_0x3b9a1f['query'][_0xb0ce('0x42')]+'%'}}]});}_0x124d35=_[_0xb0ce('0x43')]({},_0x124d35,_0x3b9a1f[_0xb0ce('0x44')]);var _0x2707aa={'where':_0x124d35[_0xb0ce('0x40')]};return db[_0xb0ce('0x31')][_0xb0ce('0x1f')](_0x2707aa)['then'](function(_0x37e9c2){_0x432235[_0xb0ce('0x1f')]=_0x37e9c2;if(_0x3b9a1f[_0xb0ce('0x36')][_0xb0ce('0x45')]){_0x124d35['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x124d35);})[_0xb0ce('0x27')](function(_0x3c7bee){_0x432235[_0xb0ce('0x46')]=_0x3c7bee;return _0x432235;})['then'](respondWithFilteredResult(_0x562cdb,_0x124d35))[_0xb0ce('0x47')](handleError(_0x562cdb,null));};exports[_0xb0ce('0x48')]=function(_0x3b4821,_0x4277cc){var _0xaeb618={'raw':!![],'where':{'id':_0x3b4821['params']['id']}},_0x2c0dd5={};_0x2c0dd5[_0xb0ce('0x35')]=_['keys'](db[_0xb0ce('0x31')][_0xb0ce('0x32')]);_0x2c0dd5[_0xb0ce('0x36')]=_[_0xb0ce('0x37')](_0x3b4821[_0xb0ce('0x36')]);_0x2c0dd5['filters']=_[_0xb0ce('0x3a')](_0x2c0dd5[_0xb0ce('0x35')],_0x2c0dd5[_0xb0ce('0x36')]);_0xaeb618[_0xb0ce('0x39')]=_[_0xb0ce('0x3a')](_0x2c0dd5[_0xb0ce('0x35')],qs[_0xb0ce('0x3b')](_0x3b4821[_0xb0ce('0x36')][_0xb0ce('0x3b')]));_0xaeb618[_0xb0ce('0x39')]=_0xaeb618[_0xb0ce('0x39')][_0xb0ce('0x49')]?_0xaeb618[_0xb0ce('0x39')]:_0x2c0dd5['model'];if(_0x3b4821[_0xb0ce('0x36')][_0xb0ce('0x45')]){_0xaeb618[_0xb0ce('0x4a')]=[{'all':!![]}];}_0xaeb618=_[_0xb0ce('0x43')]({},_0xaeb618,_0x3b4821[_0xb0ce('0x44')]);return db[_0xb0ce('0x31')][_0xb0ce('0x4b')](_0xaeb618)[_0xb0ce('0x27')](handleEntityNotFound(_0x4277cc,null))['then'](respondWithResult(_0x4277cc,null))[_0xb0ce('0x47')](handleError(_0x4277cc,null));};exports['update']=function(_0x4261cf,_0x566265){if(_0x4261cf[_0xb0ce('0x4c')]['id']){delete _0x4261cf[_0xb0ce('0x4c')]['id'];}return db[_0xb0ce('0x31')]['find']({'where':{'id':_0x4261cf[_0xb0ce('0x4d')]['id']}})[_0xb0ce('0x27')](handleEntityNotFound(_0x566265,null))['then'](saveUpdates(_0x4261cf[_0xb0ce('0x4c')],null))['then'](respondWithResult(_0x566265,null))[_0xb0ce('0x47')](handleError(_0x566265,null));};exports[_0xb0ce('0x28')]=function(_0x274f4f,_0x56546c){return db['CannedAnswer'][_0xb0ce('0x4b')]({'where':{'id':_0x274f4f['params']['id']}})['then'](handleEntityNotFound(_0x56546c,null))['then'](removeEntity(_0x56546c,null))['catch'](handleError(_0x56546c,null));};exports[_0xb0ce('0x4e')]=function(_0x526ae8,_0x27eb5a){var _0x2122f8={'key':_0x526ae8[_0xb0ce('0x4c')][_0xb0ce('0x34')]};if(_0x526ae8[_0xb0ce('0x4c')]['MailAccountId']){_0x2122f8['MailAccountId']=_0x526ae8[_0xb0ce('0x4c')][_0xb0ce('0x4f')];}else if(_0x526ae8[_0xb0ce('0x4c')][_0xb0ce('0x50')]){_0x2122f8[_0xb0ce('0x50')]=_0x526ae8['body'][_0xb0ce('0x50')];}else if(_0x526ae8[_0xb0ce('0x4c')]['OpenchannelAccountId']){_0x2122f8[_0xb0ce('0x51')]=_0x526ae8[_0xb0ce('0x4c')][_0xb0ce('0x51')];}else if(_0x526ae8['body'][_0xb0ce('0x52')]){_0x2122f8[_0xb0ce('0x52')]=_0x526ae8['body'][_0xb0ce('0x52')];}return db['CannedAnswer']['find']({'where':_0x2122f8})[_0xb0ce('0x27')](function(_0x53a839){if(_0x53a839){throw new db[(_0xb0ce('0x53'))][(_0xb0ce('0x54'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xb0ce('0x4e')](_0x526ae8[_0xb0ce('0x4c')]);})[_0xb0ce('0x27')](function(_0x57793b){var _0x365316=_0x526ae8['user'][_0xb0ce('0x29')]({'plain':!![]});if(!_0x365316)throw new Error(_0xb0ce('0x55'));if(_0x365316[_0xb0ce('0x56')]===_0xb0ce('0x57')){var _0x2d0f6f=_0x57793b[_0xb0ce('0x29')]({'plain':!![]});return db[_0xb0ce('0x58')][_0xb0ce('0x4b')]({'where':{'name':'CannedAnswers','userProfileId':_0x365316[_0xb0ce('0x59')]},'raw':!![]})[_0xb0ce('0x27')](function(_0x3ef1db){if(_0x3ef1db&&_0x3ef1db[_0xb0ce('0x5a')]===0x0){return db[_0xb0ce('0x5b')][_0xb0ce('0x4e')]({'name':_0x2d0f6f[_0xb0ce('0x2d')],'resourceId':_0x2d0f6f['id'],'type':_0x3ef1db[_0xb0ce('0x2d')],'sectionId':_0x3ef1db['id']},{})[_0xb0ce('0x27')](function(){return _0x57793b;});}else{return _0x57793b;}})[_0xb0ce('0x47')](function(_0x1f9c09){logger[_0xb0ce('0x5c')](_0xb0ce('0x5d'),_0x1f9c09);throw _0x1f9c09;});}return _0x57793b;})[_0xb0ce('0x27')](respondWithResult(_0x27eb5a,0xc9))[_0xb0ce('0x47')](handleError(_0x27eb5a,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0a2effe..969186c 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 _0xa095=['exports','define','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes'];(function(_0x54a687,_0x4ce189){var _0x4b5083=function(_0x4e9dc7){while(--_0x4e9dc7){_0x54a687['push'](_0x54a687['shift']());}};_0x4b5083(++_0x4ce189);}(_0xa095,0x7c));var _0x5a09=function(_0x2a99e2,_0x1803e4){_0x2a99e2=_0x2a99e2-0x0;var _0x23fb5f=_0xa095[_0x2a99e2];return _0x23fb5f;};'use strict';var _=require(_0x5a09('0x0'));var util=require(_0x5a09('0x1'));var logger=require('../../config/logger')(_0x5a09('0x2'));var moment=require('moment');var BPromise=require(_0x5a09('0x3'));var rp=require(_0x5a09('0x4'));var fs=require('fs');var path=require(_0x5a09('0x5'));var rimraf=require(_0x5a09('0x6'));var config=require('../../config/environment');var attributes=require(_0x5a09('0x7'));module[_0x5a09('0x8')]=function(_0x25edc3,_0x327fe6){return _0x25edc3[_0x5a09('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5a09('0xa')});}; \ No newline at end of file +var _0x63a1=['define','CannedAnswer','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x3856f7,_0x1f9777){var _0x3a7a7f=function(_0x20c649){while(--_0x20c649){_0x3856f7['push'](_0x3856f7['shift']());}};_0x3a7a7f(++_0x1f9777);}(_0x63a1,0xdf));var _0x163a=function(_0x3aa5eb,_0x5402fc){_0x3aa5eb=_0x3aa5eb-0x0;var _0x3b7cf3=_0x63a1[_0x3aa5eb];return _0x3b7cf3;};'use strict';var _=require('lodash');var util=require(_0x163a('0x0'));var logger=require(_0x163a('0x1'))(_0x163a('0x2'));var moment=require(_0x163a('0x3'));var BPromise=require('bluebird');var rp=require(_0x163a('0x4'));var fs=require('fs');var path=require(_0x163a('0x5'));var rimraf=require('rimraf');var config=require(_0x163a('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x163a('0x7')]=function(_0x50099a,_0x5c8108){return _0x50099a[_0x163a('0x8')](_0x163a('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x163a('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index cc04376..0933b32 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(_0x154a66,_0x3ff7b0){var _0xf954a3=function(_0xd6876b){while(--_0xd6876b){_0x154a66['push'](_0x154a66['shift']());}};_0xf954a3(++_0x3ff7b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xfa424d,_0x56efcb){var _0x262a78=function(_0x1a77a8){while(--_0x1a77a8){_0xfa424d['push'](_0xfa424d['shift']());}};_0x262a78(++_0x56efcb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 e03e6d7..cb4e5c3 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 _0xd9b4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd9b4,0x1de));var _0x4d9b=function(_0x436570,_0x29789b){_0x436570=_0x436570-0x0;var _0x2c45f7=_0xd9b4[_0x436570];return _0x2c45f7;};'use strict';var multer=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var path=require(_0x4d9b('0x2'));var timeout=require(_0x4d9b('0x3'));var express=require(_0x4d9b('0x4'));var router=express[_0x4d9b('0x5')]();var fs_extra=require(_0x4d9b('0x6'));var auth=require(_0x4d9b('0x7'));var interaction=require(_0x4d9b('0x8'));var config=require(_0x4d9b('0x9'));var controller=require(_0x4d9b('0xa'));router[_0x4d9b('0xb')]('/',auth[_0x4d9b('0xc')](),controller[_0x4d9b('0xd')]);router[_0x4d9b('0xb')](_0x4d9b('0xe'),auth[_0x4d9b('0xc')](),controller['show']);router[_0x4d9b('0xf')]('/',auth['isAuthenticated'](),controller[_0x4d9b('0x10')]);router[_0x4d9b('0x11')](_0x4d9b('0xe'),auth[_0x4d9b('0xc')](),controller[_0x4d9b('0x12')]);router[_0x4d9b('0x13')](_0x4d9b('0xe'),auth[_0x4d9b('0xc')](),controller[_0x4d9b('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb1d3=['/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','post','create','put'];(function(_0x5050a9,_0x2729d1){var _0x5cedee=function(_0x3b387b){while(--_0x3b387b){_0x5050a9['push'](_0x5050a9['shift']());}};_0x5cedee(++_0x2729d1);}(_0xb1d3,0x147));var _0x3b1d=function(_0x309f78,_0xf42ef){_0x309f78=_0x309f78-0x0;var _0x1321cc=_0xb1d3[_0x309f78];return _0x1321cc;};'use strict';var multer=require(_0x3b1d('0x0'));var util=require(_0x3b1d('0x1'));var path=require('path');var timeout=require(_0x3b1d('0x2'));var express=require(_0x3b1d('0x3'));var router=express[_0x3b1d('0x4')]();var fs_extra=require(_0x3b1d('0x5'));var auth=require(_0x3b1d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b1d('0x7'));var controller=require(_0x3b1d('0x8'));router[_0x3b1d('0x9')]('/',auth[_0x3b1d('0xa')](),controller[_0x3b1d('0xb')]);router[_0x3b1d('0x9')]('/:id',auth[_0x3b1d('0xa')](),controller['show']);router[_0x3b1d('0xc')]('/',auth['isAuthenticated'](),controller[_0x3b1d('0xd')]);router[_0x3b1d('0xe')](_0x3b1d('0xf'),auth[_0x3b1d('0xa')](),controller[_0x3b1d('0x10')]);router[_0x3b1d('0x11')]('/:id',auth[_0x3b1d('0xa')](),controller['destroy']);module[_0x3b1d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ed57b23..03dd352 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 _0x7314=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x48a6d0,_0x327e64){var _0x33501d=function(_0x102a47){while(--_0x102a47){_0x48a6d0['push'](_0x48a6d0['shift']());}};_0x33501d(++_0x327e64);}(_0x7314,0x100));var _0x4731=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7314[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4731('0x0'));module[_0x4731('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x4731('0x2')},'clid':{'type':Sequelize[_0x4731('0x3')]},'src':{'type':Sequelize[_0x4731('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x4731('0x3')]},'channel':{'type':Sequelize[_0x4731('0x3')]},'dstchannel':{'type':Sequelize[_0x4731('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x4731('0x3')]},'duration':{'type':Sequelize[_0x4731('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4731('0x3')]},'amaflags':{'type':Sequelize[_0x4731('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4731('0x3')]},'userfield':{'type':Sequelize[_0x4731('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x4731('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x4731('0x3')]},'type':{'type':Sequelize[_0x4731('0x3')]},'tag':{'type':Sequelize[_0x4731('0x3')]}}; \ No newline at end of file +var _0xcb18=['DATE','STRING','INTEGER'];(function(_0x2eec5e,_0x408a41){var _0x259911=function(_0x2be6cd){while(--_0x2be6cd){_0x2eec5e['push'](_0x2eec5e['shift']());}};_0x259911(++_0x408a41);}(_0xcb18,0x159));var _0x8cb1=function(_0x144dca,_0x179bd1){_0x144dca=_0x144dca-0x0;var _0x561879=_0xcb18[_0x144dca];return _0x561879;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x8cb1('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x8cb1('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8cb1('0x1')]},'dcontext':{'type':Sequelize[_0x8cb1('0x1')]},'channel':{'type':Sequelize[_0x8cb1('0x1')]},'dstchannel':{'type':Sequelize[_0x8cb1('0x1')]},'lastapp':{'type':Sequelize[_0x8cb1('0x1')]},'lastdata':{'type':Sequelize[_0x8cb1('0x1')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8cb1('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8cb1('0x1')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8cb1('0x1')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8cb1('0x1')]},'linkedid':{'type':Sequelize[_0x8cb1('0x1')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x8cb1('0x1')]},'type':{'type':Sequelize[_0x8cb1('0x1')]},'tag':{'type':Sequelize[_0x8cb1('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b257e22..d19e755 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 _0x6f47=['undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Cdr','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','describe','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset'];(function(_0x151502,_0x3f0f5a){var _0x4db056=function(_0x4cc051){while(--_0x4cc051){_0x151502['push'](_0x151502['shift']());}};_0x4db056(++_0x3f0f5a);}(_0x6f47,0xc7));var _0x76f4=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6f47[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['map'](_0x1dea0e,'name');_0x30f02e[_0x76f4('0x2e')]=_[_0x76f4('0x2f')](_0x5346be[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2e')]);_0x10ddb4[_0x76f4('0x32')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5346be[_0x76f4('0x2e')]['fields']));_0x10ddb4['attributes']=_0x10ddb4['attributes']['length']?_0x10ddb4[_0x76f4('0x32')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2e')][_0x76f4('0x34')](_0x76f4('0x35'))){_0x10ddb4['limit']=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x30')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2e')],_0x30f02e[_0x76f4('0x30')]),_0x1dea0e);if(_0x5346be[_0x76f4('0x2e')][_0x76f4('0x3a')]){_0x10ddb4['where']=_[_0x76f4('0x3b')](_0x10ddb4[_0x76f4('0x38')],{'$or':_[_0x76f4('0x3c')](_0x1dea0e,function(_0x589637){if(_0x589637['type']!==_0x76f4('0x3d')){var _0x487926={};_0x487926[_0x589637[_0x76f4('0x27')]]={'$like':'%'+_0x5346be['query'][_0x76f4('0x3a')]+'%'};return _0x487926;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3e')]);var _0x378675={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x378675)[_0x76f4('0x23')](function(_0x16779e){_0x41dea4[_0x76f4('0x1c')]=_0x16779e;if(_0x5346be['query']['includeAll']){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x2b7dc8){_0x41dea4[_0x76f4('0x41')]=_0x2b7dc8;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))[_0x76f4('0x42')](handleError(_0x5b3f07,null));};exports[_0x76f4('0x43')]=function(_0x5b667b,_0xbc3d7e){var _0xe744af={'raw':!![],'where':{'id':_0x5b667b['params']['id']}},_0x4f0d1a={};_0x4f0d1a[_0x76f4('0x2d')]=_[_0x76f4('0x2f')](db[_0x76f4('0x29')][_0x76f4('0x44')]);_0x4f0d1a[_0x76f4('0x2e')]=_['keys'](_0x5b667b[_0x76f4('0x2e')]);_0x4f0d1a[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x4f0d1a[_0x76f4('0x2d')],_0x4f0d1a[_0x76f4('0x2e')]);_0xe744af[_0x76f4('0x32')]=_['intersection'](_0x4f0d1a[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5b667b[_0x76f4('0x2e')]['fields']));_0xe744af['attributes']=_0xe744af[_0x76f4('0x32')][_0x76f4('0x45')]?_0xe744af[_0x76f4('0x32')]:_0x4f0d1a[_0x76f4('0x2d')];if(_0x5b667b[_0x76f4('0x2e')]['includeAll']){_0xe744af['include']=[{'all':!![]}];}_0xe744af=_[_0x76f4('0x3b')]({},_0xe744af,_0x5b667b['options']);return db[_0x76f4('0x29')][_0x76f4('0x46')](_0xe744af)['then'](handleEntityNotFound(_0xbc3d7e,null))['then'](respondWithResult(_0xbc3d7e,null))[_0x76f4('0x42')](handleError(_0xbc3d7e,null));};exports[_0x76f4('0x47')]=function(_0x3f35ce,_0x217d3a){return db['Cdr'][_0x76f4('0x47')](_0x3f35ce[_0x76f4('0x48')],{})[_0x76f4('0x23')](respondWithResult(_0x217d3a,0xc9))['catch'](handleError(_0x217d3a,null));};exports[_0x76f4('0x22')]=function(_0x6bbcf2,_0x535eca){if(_0x6bbcf2['body']['id']){delete _0x6bbcf2[_0x76f4('0x48')]['id'];}return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x6bbcf2[_0x76f4('0x49')]['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x535eca,null))['then'](saveUpdates(_0x6bbcf2[_0x76f4('0x48')],null))['then'](respondWithResult(_0x535eca,null))[_0x76f4('0x42')](handleError(_0x535eca,null));};exports[_0x76f4('0x24')]=function(_0x270baf,_0x5e9a45){return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x270baf['params']['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x5e9a45,null))[_0x76f4('0x23')](removeEntity(_0x5e9a45,null))[_0x76f4('0x42')](handleError(_0x5e9a45,null));};exports[_0x76f4('0x4a')]=function(_0x40ff20,_0x479c4b){return db[_0x76f4('0x29')]['describe']()[_0x76f4('0x23')](respondWithResult(_0x479c4b,null))[_0x76f4('0x42')](handleError(_0x479c4b,null));}; \ No newline at end of file +var _0xfd87=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','filter','merge','where','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x5cf009,_0xa01373){var _0x1cb8fe=function(_0x2d35c4){while(--_0x2d35c4){_0x5cf009['push'](_0x5cf009['shift']());}};_0x1cb8fe(++_0xa01373);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7fd8('0x0'));var rimraf=require(_0x7fd8('0x1'));var zipdir=require(_0x7fd8('0x2'));var jsonpatch=require(_0x7fd8('0x3'));var rp=require(_0x7fd8('0x4'));var moment=require(_0x7fd8('0x5'));var BPromise=require(_0x7fd8('0x6'));var Mustache=require(_0x7fd8('0x7'));var util=require(_0x7fd8('0x8'));var path=require(_0x7fd8('0x9'));var sox=require(_0x7fd8('0xa'));var csv=require('to-csv');var ejs=require(_0x7fd8('0xb'));var fs=require('fs');var fs_extra=require(_0x7fd8('0xc'));var _=require('lodash');var squel=require(_0x7fd8('0xd'));var crypto=require(_0x7fd8('0xe'));var jsforce=require(_0x7fd8('0xf'));var deskjs=require(_0x7fd8('0x10'));var toCsv=require(_0x7fd8('0x11'));var querystring=require('querystring');var Papa=require(_0x7fd8('0x12'));var Redis=require(_0x7fd8('0x13'));var authService=require(_0x7fd8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fd8('0x15'))('api');var utils=require(_0x7fd8('0x16'));var config=require(_0x7fd8('0x17'));var licenseUtil=require(_0x7fd8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136770,_0x2cccdb){_0x2cccdb=_0x2cccdb||0xcc;return function(_0xe84aa7){if(_0xe84aa7){return _0x136770[_0x7fd8('0x19')](_0x2cccdb);}return _0x136770[_0x7fd8('0x1a')](_0x2cccdb)['end']();};}function respondWithResult(_0x1af365,_0x17a3a1){_0x17a3a1=_0x17a3a1||0xc8;return function(_0x1d481a){if(_0x1d481a){return _0x1af365[_0x7fd8('0x1a')](_0x17a3a1)[_0x7fd8('0x1b')](_0x1d481a);}};}function respondWithFilteredResult(_0x38d45a,_0x1a4a52){return function(_0x33c8f9){if(_0x33c8f9){var _0x2a8818=typeof _0x1a4a52[_0x7fd8('0x1c')]===_0x7fd8('0x1d')&&typeof _0x1a4a52['limit']==='undefined';var _0x5ca7f6=_0x33c8f9[_0x7fd8('0x1e')];var _0xce23dc=_0x2a8818?0x0:_0x1a4a52['offset'];var _0x39e301=_0x2a8818?_0x33c8f9[_0x7fd8('0x1e')]:_0x1a4a52[_0x7fd8('0x1c')]+_0x1a4a52[_0x7fd8('0x1f')];var _0x3ab724;if(_0x39e301>=_0x5ca7f6){_0x39e301=_0x5ca7f6;_0x3ab724=0xc8;}else{_0x3ab724=0xce;}_0x38d45a[_0x7fd8('0x1a')](_0x3ab724);return _0x38d45a[_0x7fd8('0x20')](_0x7fd8('0x21'),_0xce23dc+'-'+_0x39e301+'/'+_0x5ca7f6)['json'](_0x33c8f9);}return null;};}function patchUpdates(_0x34bc09){return function(_0x3b7b49){try{jsonpatch[_0x7fd8('0x22')](_0x3b7b49,_0x34bc09,!![]);}catch(_0x13417d){return BPromise[_0x7fd8('0x23')](_0x13417d);}return _0x3b7b49[_0x7fd8('0x24')]();};}function saveUpdates(_0x4f8563,_0xecd3f3){return function(_0x1d26d4){if(_0x1d26d4){return _0x1d26d4[_0x7fd8('0x25')](_0x4f8563)[_0x7fd8('0x26')](function(_0x52b71a){return _0x52b71a;});}return null;};}function removeEntity(_0x3f71a4,_0x402fa1){return function(_0x2e7520){if(_0x2e7520){return _0x2e7520[_0x7fd8('0x27')]()[_0x7fd8('0x26')](function(){_0x3f71a4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3650cb,_0x6cccad){return function(_0xa273a7){if(!_0xa273a7){_0x3650cb[_0x7fd8('0x19')](0x194);}return _0xa273a7;};}function handleError(_0x17b86a,_0x50f34f){_0x50f34f=_0x50f34f||0x1f4;return function(_0x12bc21){logger[_0x7fd8('0x28')](_0x12bc21[_0x7fd8('0x29')]);if(_0x12bc21[_0x7fd8('0x2a')]){delete _0x12bc21[_0x7fd8('0x2a')];}_0x17b86a['status'](_0x50f34f)['send'](_0x12bc21);};}exports[_0x7fd8('0x2b')]=function(_0x2bd721,_0x3919b1){var _0x4319b8={},_0x573ed0={},_0x4fc63a={'count':0x0,'rows':[]};var _0x8f9a8e=_['map'](db[_0x7fd8('0x2c')][_0x7fd8('0x2d')],function(_0x3df0a2){return{'name':_0x3df0a2['fieldName'],'type':_0x3df0a2[_0x7fd8('0x2e')]['key']};});_0x573ed0[_0x7fd8('0x2f')]=_[_0x7fd8('0x30')](_0x8f9a8e,_0x7fd8('0x2a'));_0x573ed0[_0x7fd8('0x31')]=_[_0x7fd8('0x32')](_0x2bd721[_0x7fd8('0x31')]);_0x573ed0[_0x7fd8('0x33')]=_['intersection'](_0x573ed0[_0x7fd8('0x2f')],_0x573ed0[_0x7fd8('0x31')]);_0x4319b8[_0x7fd8('0x34')]=_[_0x7fd8('0x35')](_0x573ed0[_0x7fd8('0x2f')],qs[_0x7fd8('0x36')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x36')]));_0x4319b8['attributes']=_0x4319b8['attributes'][_0x7fd8('0x37')]?_0x4319b8[_0x7fd8('0x34')]:_0x573ed0[_0x7fd8('0x2f')];if(!_0x2bd721['query'][_0x7fd8('0x38')]('nolimit')){_0x4319b8['limit']=qs[_0x7fd8('0x1f')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x1f')]);_0x4319b8[_0x7fd8('0x1c')]=qs[_0x7fd8('0x1c')](_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x1c')]);}_0x4319b8[_0x7fd8('0x39')]=qs['sort'](_0x2bd721[_0x7fd8('0x31')]['sort']);_0x4319b8['where']=qs[_0x7fd8('0x33')](_['pick'](_0x2bd721['query'],_0x573ed0['filters']),_0x8f9a8e);if(_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x3a')]){_0x4319b8['where']=_[_0x7fd8('0x3b')](_0x4319b8[_0x7fd8('0x3c')],{'$or':_[_0x7fd8('0x30')](_0x8f9a8e,function(_0x5d8d3d){if(_0x5d8d3d['type']!=='VIRTUAL'){var _0x1cc1d5={};_0x1cc1d5[_0x5d8d3d[_0x7fd8('0x2a')]]={'$like':'%'+_0x2bd721[_0x7fd8('0x31')][_0x7fd8('0x3a')]+'%'};return _0x1cc1d5;}})});}_0x4319b8=_[_0x7fd8('0x3b')]({},_0x4319b8,_0x2bd721[_0x7fd8('0x3d')]);var _0x2b5abb={'where':_0x4319b8['where']};return db['Cdr']['count'](_0x2b5abb)[_0x7fd8('0x26')](function(_0x24a0f8){_0x4fc63a[_0x7fd8('0x1e')]=_0x24a0f8;if(_0x2bd721['query'][_0x7fd8('0x3e')]){_0x4319b8[_0x7fd8('0x3f')]=[{'all':!![]}];}return db[_0x7fd8('0x2c')][_0x7fd8('0x40')](_0x4319b8);})['then'](function(_0x2f480c){_0x4fc63a[_0x7fd8('0x41')]=_0x2f480c;return _0x4fc63a;})['then'](respondWithFilteredResult(_0x3919b1,_0x4319b8))[_0x7fd8('0x42')](handleError(_0x3919b1,null));};exports['show']=function(_0x92b45f,_0x2026aa){var _0x393174={'raw':!![],'where':{'id':_0x92b45f['params']['id']}},_0xffd29a={};_0xffd29a[_0x7fd8('0x2f')]=_[_0x7fd8('0x32')](db[_0x7fd8('0x2c')][_0x7fd8('0x2d')]);_0xffd29a[_0x7fd8('0x31')]=_[_0x7fd8('0x32')](_0x92b45f['query']);_0xffd29a['filters']=_['intersection'](_0xffd29a[_0x7fd8('0x2f')],_0xffd29a[_0x7fd8('0x31')]);_0x393174['attributes']=_['intersection'](_0xffd29a[_0x7fd8('0x2f')],qs[_0x7fd8('0x36')](_0x92b45f['query'][_0x7fd8('0x36')]));_0x393174[_0x7fd8('0x34')]=_0x393174[_0x7fd8('0x34')]['length']?_0x393174[_0x7fd8('0x34')]:_0xffd29a[_0x7fd8('0x2f')];if(_0x92b45f['query'][_0x7fd8('0x3e')]){_0x393174['include']=[{'all':!![]}];}_0x393174=_[_0x7fd8('0x3b')]({},_0x393174,_0x92b45f[_0x7fd8('0x3d')]);return db[_0x7fd8('0x2c')][_0x7fd8('0x43')](_0x393174)[_0x7fd8('0x26')](handleEntityNotFound(_0x2026aa,null))[_0x7fd8('0x26')](respondWithResult(_0x2026aa,null))[_0x7fd8('0x42')](handleError(_0x2026aa,null));};exports[_0x7fd8('0x44')]=function(_0x4c2784,_0x1666e7){return db['Cdr'][_0x7fd8('0x44')](_0x4c2784[_0x7fd8('0x45')],{})['then'](respondWithResult(_0x1666e7,0xc9))[_0x7fd8('0x42')](handleError(_0x1666e7,null));};exports[_0x7fd8('0x25')]=function(_0x5cbc91,_0x5e3a45){if(_0x5cbc91['body']['id']){delete _0x5cbc91[_0x7fd8('0x45')]['id'];}return db['Cdr'][_0x7fd8('0x43')]({'where':{'id':_0x5cbc91[_0x7fd8('0x46')]['id']}})[_0x7fd8('0x26')](handleEntityNotFound(_0x5e3a45,null))[_0x7fd8('0x26')](saveUpdates(_0x5cbc91[_0x7fd8('0x45')],null))['then'](respondWithResult(_0x5e3a45,null))['catch'](handleError(_0x5e3a45,null));};exports[_0x7fd8('0x27')]=function(_0x46c230,_0x6924a2){return db[_0x7fd8('0x2c')]['find']({'where':{'id':_0x46c230[_0x7fd8('0x46')]['id']}})['then'](handleEntityNotFound(_0x6924a2,null))[_0x7fd8('0x26')](removeEntity(_0x6924a2,null))[_0x7fd8('0x42')](handleError(_0x6924a2,null));};exports[_0x7fd8('0x47')]=function(_0x1a6a03,_0x32160c){return db[_0x7fd8('0x2c')][_0x7fd8('0x47')]()[_0x7fd8('0x26')](respondWithResult(_0x32160c,null))[_0x7fd8('0x42')](handleError(_0x32160c,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2ab7de5..42a5571 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(_0x306b9b,_0x5842b1){var _0x4bcca5=function(_0x29f5fe){while(--_0x29f5fe){_0x306b9b['push'](_0x306b9b['shift']());}};_0x4bcca5(++_0x5842b1);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x420ab0,_0xaeaa4e){var _0x5224bb=function(_0x1e6d38){while(--_0x1e6d38){_0x420ab0['push'](_0x420ab0['shift']());}};_0x5224bb(++_0xaeaa4e);}(_0x7a54,0x106));var _0x47a5=function(_0x5495df,_0x5da3f2){_0x5495df=_0x5495df-0x0;var _0x5327a9=_0x7a54[_0x5495df];return _0x5327a9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index efcba02..ac5d132 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 _0xed6c=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xed6c,0xb2));var _0xced6=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xed6c[_0xd0a847];return _0x2536ec;};'use strict';var _=require(_0xced6('0x0'));var util=require(_0xced6('0x1'));var moment=require(_0xced6('0x2'));var BPromise=require(_0xced6('0x3'));var rs=require(_0xced6('0x4'));var fs=require('fs');var Redis=require(_0xced6('0x5'));var db=require(_0xced6('0x6'))['db'];var utils=require(_0xced6('0x7'));var logger=require(_0xced6('0x8'))(_0xced6('0x9'));var config=require('../../config/environment');var jayson=require(_0xced6('0xa'));var client=jayson[_0xced6('0xb')][_0xced6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xec8fb1,_0xae90a5,_0x159d06){return new BPromise(function(_0x1994f5,_0x59d7ce){return client[_0xced6('0xd')](_0xec8fb1,_0x159d06)['then'](function(_0x230ba7){logger[_0xced6('0xe')](_0xced6('0xf'),_0xae90a5,_0xced6('0x10'));logger[_0xced6('0x11')](_0xced6('0x12'),_0xae90a5,_0xced6('0x10'),JSON[_0xced6('0x13')](_0x230ba7));if(_0x230ba7[_0xced6('0x14')]){if(_0x230ba7[_0xced6('0x14')][_0xced6('0x15')]===0x1f4){logger[_0xced6('0x14')](_0xced6('0xf'),_0xae90a5,_0x230ba7[_0xced6('0x14')]['message']);return _0x59d7ce(_0x230ba7[_0xced6('0x14')]['message']);}logger[_0xced6('0x14')]('Cdr,\x20%s,\x20%s',_0xae90a5,_0x230ba7['error'][_0xced6('0x16')]);return _0x1994f5(_0x230ba7['error']['message']);}else{logger[_0xced6('0xe')](_0xced6('0xf'),_0xae90a5,_0xced6('0x10'));_0x1994f5(_0x230ba7[_0xced6('0x17')][_0xced6('0x16')]);}})['catch'](function(_0x12e1d7){logger[_0xced6('0x14')]('Cdr,\x20%s,\x20%s',_0xae90a5,_0x12e1d7);_0x59d7ce(_0x12e1d7);});});} \ No newline at end of file +var _0x802a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','util','moment','bluebird'];(function(_0xfe37da,_0x20fa71){var _0x3009a5=function(_0x29a992){while(--_0x29a992){_0xfe37da['push'](_0xfe37da['shift']());}};_0x3009a5(++_0x20fa71);}(_0x802a,0xbd));var _0xa802=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x802a[_0x29d915];return _0x160f86;};'use strict';var _=require('lodash');var util=require(_0xa802('0x0'));var moment=require(_0xa802('0x1'));var BPromise=require(_0xa802('0x2'));var rs=require(_0xa802('0x3'));var fs=require('fs');var Redis=require(_0xa802('0x4'));var db=require(_0xa802('0x5'))['db'];var utils=require(_0xa802('0x6'));var logger=require('../../config/logger')(_0xa802('0x7'));var config=require(_0xa802('0x8'));var jayson=require(_0xa802('0x9'));var client=jayson[_0xa802('0xa')][_0xa802('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da56d,_0x1d3e69,_0x2c9791){return new BPromise(function(_0xe2fed4,_0x2fba71){return client[_0xa802('0xc')](_0x2da56d,_0x2c9791)[_0xa802('0xd')](function(_0xad00b3){logger['info'](_0xa802('0xe'),_0x1d3e69,_0xa802('0xf'));logger[_0xa802('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x1d3e69,_0xa802('0xf'),JSON[_0xa802('0x11')](_0xad00b3));if(_0xad00b3['error']){if(_0xad00b3['error'][_0xa802('0x12')]===0x1f4){logger['error'](_0xa802('0xe'),_0x1d3e69,_0xad00b3['error']['message']);return _0x2fba71(_0xad00b3[_0xa802('0x13')][_0xa802('0x14')]);}logger[_0xa802('0x13')](_0xa802('0xe'),_0x1d3e69,_0xad00b3['error'][_0xa802('0x14')]);return _0xe2fed4(_0xad00b3[_0xa802('0x13')][_0xa802('0x14')]);}else{logger[_0xa802('0x15')](_0xa802('0xe'),_0x1d3e69,_0xa802('0xf'));_0xe2fed4(_0xad00b3[_0xa802('0x16')][_0xa802('0x14')]);}})[_0xa802('0x17')](function(_0x1896b2){logger['error'](_0xa802('0xe'),_0x1d3e69,_0x1896b2);_0x2fba71(_0x1896b2);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9860c72..10847e4 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_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 bea0add..71f3217 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 _0xaca9=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xaca9,0x88));var _0x9aca=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xaca9[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0x9aca('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9aca('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9aca('0x2')],'allowNull':![],'defaultValue':_0x9aca('0x3')},'appdata':{'type':Sequelize[_0x9aca('0x4')]()},'description':{'type':Sequelize[_0x9aca('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9aca('0x5')}}; \ No newline at end of file +var _0x2769=['noop','TEXT','STRING','sequelize','INTEGER'];(function(_0x567706,_0x571c33){var _0x172d6b=function(_0x3e5dc8){while(--_0x3e5dc8){_0x567706['push'](_0x567706['shift']());}};_0x172d6b(++_0x571c33);}(_0x2769,0x1c5));var _0x9276=function(_0x5ed16d,_0x3fcc9f){_0x5ed16d=_0x5ed16d-0x0;var _0x3a568b=_0x2769[_0x5ed16d];return _0x3a568b;};'use strict';var Sequelize=require(_0x9276('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9276('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9276('0x2')},'appdata':{'type':Sequelize[_0x9276('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9276('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c9735fc..c3786f3 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 _0x6d4a=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','error','name','send','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include','merge','catch','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2ce733,_0x1a2ea2){var _0x31dc08=function(_0x15fbee){while(--_0x15fbee){_0x2ce733['push'](_0x2ce733['shift']());}};_0x31dc08(++_0x1a2ea2);}(_0x6d4a,0x117));var _0xa6d4=function(_0x1b8c8f,_0x3230d7){_0x1b8c8f=_0x1b8c8f-0x0;var _0xf51725=_0x6d4a[_0x1b8c8f];return _0xf51725;};'use strict';var emlformat=require(_0xa6d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6d4('0x1'));var jsonpatch=require(_0xa6d4('0x2'));var rp=require(_0xa6d4('0x3'));var moment=require(_0xa6d4('0x4'));var BPromise=require(_0xa6d4('0x5'));var Mustache=require(_0xa6d4('0x6'));var util=require(_0xa6d4('0x7'));var path=require(_0xa6d4('0x8'));var sox=require(_0xa6d4('0x9'));var csv=require(_0xa6d4('0xa'));var ejs=require(_0xa6d4('0xb'));var fs=require('fs');var fs_extra=require(_0xa6d4('0xc'));var _=require(_0xa6d4('0xd'));var squel=require(_0xa6d4('0xe'));var crypto=require('crypto');var jsforce=require(_0xa6d4('0xf'));var deskjs=require(_0xa6d4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa6d4('0x11'));var Papa=require(_0xa6d4('0x12'));var Redis=require(_0xa6d4('0x13'));var authService=require(_0xa6d4('0x14'));var qs=require(_0xa6d4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6d4('0x16'));var logger=require(_0xa6d4('0x17'))('api');var utils=require(_0xa6d4('0x18'));var config=require(_0xa6d4('0x19'));var licenseUtil=require(_0xa6d4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31ac95,_0x53b1c1){_0x53b1c1=_0x53b1c1||0xcc;return function(_0x23830f){if(_0x23830f){return _0x31ac95[_0xa6d4('0x1b')](_0x53b1c1);}return _0x31ac95['status'](_0x53b1c1)[_0xa6d4('0x1c')]();};}function respondWithResult(_0x101f40,_0x3a0d34){_0x3a0d34=_0x3a0d34||0xc8;return function(_0x9631de){if(_0x9631de){return _0x101f40[_0xa6d4('0x1d')](_0x3a0d34)[_0xa6d4('0x1e')](_0x9631de);}};}function respondWithFilteredResult(_0x2110d1,_0x3e714f){return function(_0x7420d8){if(_0x7420d8){var _0x17a926=typeof _0x3e714f[_0xa6d4('0x1f')]===_0xa6d4('0x20')&&typeof _0x3e714f['limit']===_0xa6d4('0x20');var _0x493077=_0x7420d8[_0xa6d4('0x21')];var _0x474b62=_0x17a926?0x0:_0x3e714f[_0xa6d4('0x1f')];var _0x4a7af1=_0x17a926?_0x7420d8[_0xa6d4('0x21')]:_0x3e714f[_0xa6d4('0x1f')]+_0x3e714f['limit'];var _0x3fa155;if(_0x4a7af1>=_0x493077){_0x4a7af1=_0x493077;_0x3fa155=0xc8;}else{_0x3fa155=0xce;}_0x2110d1[_0xa6d4('0x1d')](_0x3fa155);return _0x2110d1[_0xa6d4('0x22')](_0xa6d4('0x23'),_0x474b62+'-'+_0x4a7af1+'/'+_0x493077)[_0xa6d4('0x1e')](_0x7420d8);}return null;};}function patchUpdates(_0x5c40f5){return function(_0x3e0ae2){try{jsonpatch[_0xa6d4('0x24')](_0x3e0ae2,_0x5c40f5,!![]);}catch(_0xb7fbf9){return BPromise['reject'](_0xb7fbf9);}return _0x3e0ae2['save']();};}function saveUpdates(_0x3d98c2,_0x32bea3){return function(_0x46d32f){if(_0x46d32f){return _0x46d32f[_0xa6d4('0x25')](_0x3d98c2)[_0xa6d4('0x26')](function(_0x83abb5){return _0x83abb5;});}return null;};}function removeEntity(_0x4a744e,_0x1bf8cb){return function(_0xd4a69e){if(_0xd4a69e){return _0xd4a69e[_0xa6d4('0x27')]()[_0xa6d4('0x26')](function(){_0x4a744e[_0xa6d4('0x1d')](0xcc)[_0xa6d4('0x1c')]();});}};}function handleEntityNotFound(_0x4dca66,_0x3a3ed8){return function(_0x5589c5){if(!_0x5589c5){_0x4dca66[_0xa6d4('0x1b')](0x194);}return _0x5589c5;};}function handleError(_0x5928c9,_0x272759){_0x272759=_0x272759||0x1f4;return function(_0xf2f536){logger[_0xa6d4('0x28')](_0xf2f536['stack']);if(_0xf2f536[_0xa6d4('0x29')]){delete _0xf2f536[_0xa6d4('0x29')];}_0x5928c9['status'](_0x272759)[_0xa6d4('0x2a')](_0xf2f536);};}exports[_0xa6d4('0x2b')]=function(_0x501bd1,_0x581bae){var _0x44b967={'raw':!![],'where':{'id':_0x501bd1[_0xa6d4('0x2c')]['id']}},_0x378bf6={};_0x378bf6['model']=_[_0xa6d4('0x2d')](db[_0xa6d4('0x2e')][_0xa6d4('0x2f')]);_0x378bf6[_0xa6d4('0x30')]=_['keys'](_0x501bd1['query']);_0x378bf6['filters']=_[_0xa6d4('0x31')](_0x378bf6[_0xa6d4('0x32')],_0x378bf6[_0xa6d4('0x30')]);_0x44b967[_0xa6d4('0x33')]=_[_0xa6d4('0x31')](_0x378bf6[_0xa6d4('0x32')],qs[_0xa6d4('0x34')](_0x501bd1['query']['fields']));_0x44b967[_0xa6d4('0x33')]=_0x44b967[_0xa6d4('0x33')][_0xa6d4('0x35')]?_0x44b967[_0xa6d4('0x33')]:_0x378bf6[_0xa6d4('0x32')];if(_0x501bd1[_0xa6d4('0x30')][_0xa6d4('0x36')]){_0x44b967[_0xa6d4('0x37')]=[{'all':!![]}];}_0x44b967=_[_0xa6d4('0x38')]({},_0x44b967,_0x501bd1['options']);return db[_0xa6d4('0x2e')]['find'](_0x44b967)[_0xa6d4('0x26')](handleEntityNotFound(_0x581bae,null))[_0xa6d4('0x26')](respondWithResult(_0x581bae,null))[_0xa6d4('0x39')](handleError(_0x581bae,null));};exports[_0xa6d4('0x25')]=function(_0x3c9819,_0x3f3742){if(_0x3c9819[_0xa6d4('0x3a')]['id']){delete _0x3c9819['body']['id'];}return db['ChatApplication'][_0xa6d4('0x3b')]({'where':{'id':_0x3c9819[_0xa6d4('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3f3742,null))[_0xa6d4('0x26')](saveUpdates(_0x3c9819['body'],null))[_0xa6d4('0x26')](respondWithResult(_0x3f3742,null))[_0xa6d4('0x39')](handleError(_0x3f3742,null));};exports['destroy']=function(_0x5f0f00,_0x350ec4){return db[_0xa6d4('0x2e')]['find']({'where':{'id':_0x5f0f00[_0xa6d4('0x2c')]['id']}})[_0xa6d4('0x26')](handleEntityNotFound(_0x350ec4,null))[_0xa6d4('0x26')](removeEntity(_0x350ec4,null))[_0xa6d4('0x39')](handleError(_0x350ec4,null));}; \ No newline at end of file +var _0xb688=['then','destroy','end','error','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','body','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'];(function(_0x453dc5,_0x43231a){var _0x54e1b2=function(_0x131989){while(--_0x131989){_0x453dc5['push'](_0x453dc5['shift']());}};_0x54e1b2(++_0x43231a);}(_0xb688,0xcf));var _0x8b68=function(_0x1cb5c8,_0x5ca02e){_0x1cb5c8=_0x1cb5c8-0x0;var _0x1d31e4=_0xb688[_0x1cb5c8];return _0x1d31e4;};'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(){_0x32ddc5['status'](0xcc)[_0x8b68('0x27')]();});}};}function handleEntityNotFound(_0x3cf8d2,_0x240b0b){return function(_0x5590ec){if(!_0x5590ec){_0x3cf8d2['sendStatus'](0x194);}return _0x5590ec;};}function handleError(_0x4fe8f6,_0x92d186){_0x92d186=_0x92d186||0x1f4;return function(_0x448e43){logger[_0x8b68('0x28')](_0x448e43['stack']);if(_0x448e43[_0x8b68('0x29')]){delete _0x448e43['name'];}_0x4fe8f6['status'](_0x92d186)[_0x8b68('0x2a')](_0x448e43);};}exports['show']=function(_0x26cad7,_0x3ac356){var _0x48e2c8={'raw':!![],'where':{'id':_0x26cad7[_0x8b68('0x2b')]['id']}},_0x494ce4={};_0x494ce4[_0x8b68('0x2c')]=_[_0x8b68('0x2d')](db[_0x8b68('0x2e')][_0x8b68('0x2f')]);_0x494ce4[_0x8b68('0x30')]=_[_0x8b68('0x2d')](_0x26cad7['query']);_0x494ce4[_0x8b68('0x31')]=_['intersection'](_0x494ce4[_0x8b68('0x2c')],_0x494ce4[_0x8b68('0x30')]);_0x48e2c8['attributes']=_[_0x8b68('0x32')](_0x494ce4[_0x8b68('0x2c')],qs[_0x8b68('0x33')](_0x26cad7['query']['fields']));_0x48e2c8[_0x8b68('0x34')]=_0x48e2c8[_0x8b68('0x34')][_0x8b68('0x35')]?_0x48e2c8[_0x8b68('0x34')]:_0x494ce4[_0x8b68('0x2c')];if(_0x26cad7[_0x8b68('0x30')][_0x8b68('0x36')]){_0x48e2c8[_0x8b68('0x37')]=[{'all':!![]}];}_0x48e2c8=_[_0x8b68('0x38')]({},_0x48e2c8,_0x26cad7[_0x8b68('0x39')]);return db[_0x8b68('0x2e')][_0x8b68('0x3a')](_0x48e2c8)[_0x8b68('0x25')](handleEntityNotFound(_0x3ac356,null))[_0x8b68('0x25')](respondWithResult(_0x3ac356,null))[_0x8b68('0x3b')](handleError(_0x3ac356,null));};exports[_0x8b68('0x24')]=function(_0x23336e,_0x2a7dd5){if(_0x23336e[_0x8b68('0x3c')]['id']){delete _0x23336e[_0x8b68('0x3c')]['id'];}return db[_0x8b68('0x2e')][_0x8b68('0x3a')]({'where':{'id':_0x23336e['params']['id']}})['then'](handleEntityNotFound(_0x2a7dd5,null))[_0x8b68('0x25')](saveUpdates(_0x23336e[_0x8b68('0x3c')],null))[_0x8b68('0x25')](respondWithResult(_0x2a7dd5,null))[_0x8b68('0x3b')](handleError(_0x2a7dd5,null));};exports[_0x8b68('0x26')]=function(_0xce486c,_0x75a62f){return db[_0x8b68('0x2e')]['find']({'where':{'id':_0xce486c[_0x8b68('0x2b')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x75a62f,null))[_0x8b68('0x25')](removeEntity(_0x75a62f,null))[_0x8b68('0x3b')](handleError(_0x75a62f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f748353..1311862 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 _0xdd0c=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x23e363,_0x4a8453){var _0x192e82=function(_0x4e2c3c){while(--_0x4e2c3c){_0x23e363['push'](_0x23e363['shift']());}};_0x192e82(++_0x4a8453);}(_0xdd0c,0x165));var _0xcdd0=function(_0x46e468,_0x15976d){_0x46e468=_0x46e468-0x0;var _0x5a393c=_0xdd0c[_0x46e468];return _0x5a393c;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var logger=require(_0xcdd0('0x1'))(_0xcdd0('0x2'));var moment=require('moment');var BPromise=require(_0xcdd0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdd0('0x4'));var rimraf=require(_0xcdd0('0x5'));var config=require(_0xcdd0('0x6'));var attributes=require(_0xcdd0('0x7'));module[_0xcdd0('0x8')]=function(_0x5ae472,_0x2b33fc){return _0x5ae472[_0xcdd0('0x9')](_0xcdd0('0xa'),attributes,{'tableName':_0xcdd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcdd0('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x85a8=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatApplication','chat_applications'];(function(_0x396665,_0x26e89f){var _0x1eb77b=function(_0x1db3a1){while(--_0x1db3a1){_0x396665['push'](_0x396665['shift']());}};_0x1eb77b(++_0x26e89f);}(_0x85a8,0xc6));var _0x885a=function(_0x3f4d09,_0x5e3120){_0x3f4d09=_0x3f4d09-0x0;var _0x2732e0=_0x85a8[_0x3f4d09];return _0x2732e0;};'use strict';var _=require(_0x885a('0x0'));var util=require(_0x885a('0x1'));var logger=require('../../config/logger')(_0x885a('0x2'));var moment=require(_0x885a('0x3'));var BPromise=require(_0x885a('0x4'));var rp=require(_0x885a('0x5'));var fs=require('fs');var path=require(_0x885a('0x6'));var rimraf=require(_0x885a('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x885a('0x8')]=function(_0x12f4bb,_0x1d37a8){return _0x12f4bb[_0x885a('0x9')](_0x885a('0xa'),attributes,{'tableName':_0x885a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x885a('0xc'),'collate':_0x885a('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0062cf2..10bb0ea 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 _0xc3c2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x3bc8ab,_0x4f4594){var _0x1c2e1b=function(_0x3d6f92){while(--_0x3d6f92){_0x3bc8ab['push'](_0x3bc8ab['shift']());}};_0x1c2e1b(++_0x4f4594);}(_0xc3c2,0x16f));var _0x2c3c=function(_0x552b43,_0x2dcc68){_0x552b43=_0x552b43-0x0;var _0x3e01b9=_0xc3c2[_0x552b43];return _0x3e01b9;};'use strict';var _=require('lodash');var util=require(_0x2c3c('0x0'));var moment=require(_0x2c3c('0x1'));var BPromise=require(_0x2c3c('0x2'));var rs=require(_0x2c3c('0x3'));var fs=require('fs');var Redis=require(_0x2c3c('0x4'));var db=require(_0x2c3c('0x5'))['db'];var utils=require(_0x2c3c('0x6'));var logger=require('../../config/logger')(_0x2c3c('0x7'));var config=require(_0x2c3c('0x8'));var jayson=require(_0x2c3c('0x9'));var client=jayson[_0x2c3c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45f690,_0x4f7c40,_0x573055){return new BPromise(function(_0x279942,_0x4278fb){return client[_0x2c3c('0xb')](_0x45f690,_0x573055)[_0x2c3c('0xc')](function(_0x6379f9){logger[_0x2c3c('0xd')](_0x2c3c('0xe'),_0x4f7c40,_0x2c3c('0xf'));logger[_0x2c3c('0x10')](_0x2c3c('0x11'),_0x4f7c40,_0x2c3c('0xf'),JSON[_0x2c3c('0x12')](_0x6379f9));if(_0x6379f9[_0x2c3c('0x13')]){if(_0x6379f9[_0x2c3c('0x13')][_0x2c3c('0x14')]===0x1f4){logger['error'](_0x2c3c('0xe'),_0x4f7c40,_0x6379f9['error'][_0x2c3c('0x15')]);return _0x4278fb(_0x6379f9[_0x2c3c('0x13')][_0x2c3c('0x15')]);}logger[_0x2c3c('0x13')](_0x2c3c('0xe'),_0x4f7c40,_0x6379f9['error'][_0x2c3c('0x15')]);return _0x279942(_0x6379f9['error'][_0x2c3c('0x15')]);}else{logger[_0x2c3c('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4f7c40,_0x2c3c('0xf'));_0x279942(_0x6379f9['result'][_0x2c3c('0x15')]);}})[_0x2c3c('0x16')](function(_0x8fed63){logger[_0x2c3c('0x13')]('ChatApplication,\x20%s,\x20%s',_0x4f7c40,_0x8fed63);_0x4278fb(_0x8fed63);});});} \ No newline at end of file +var _0x2d16=['jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2d16,0x77));var _0x62d1=function(_0x4e4f6f,_0x4376e2){_0x4e4f6f=_0x4e4f6f-0x0;var _0x5ce977=_0x2d16[_0x4e4f6f];return _0x5ce977;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x62d1('0x0'));var rs=require(_0x62d1('0x1'));var fs=require('fs');var Redis=require(_0x62d1('0x2'));var db=require(_0x62d1('0x3'))['db'];var utils=require(_0x62d1('0x4'));var logger=require(_0x62d1('0x5'))(_0x62d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x62d1('0x7'));var client=jayson[_0x62d1('0x8')][_0x62d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ce1b1,_0x31453e,_0x5960b0){return new BPromise(function(_0x4835ae,_0x2943fa){return client[_0x62d1('0xa')](_0x5ce1b1,_0x5960b0)[_0x62d1('0xb')](function(_0x2b9990){logger[_0x62d1('0xc')](_0x62d1('0xd'),_0x31453e,_0x62d1('0xe'));logger[_0x62d1('0xf')](_0x62d1('0x10'),_0x31453e,_0x62d1('0xe'),JSON['stringify'](_0x2b9990));if(_0x2b9990['error']){if(_0x2b9990[_0x62d1('0x11')][_0x62d1('0x12')]===0x1f4){logger[_0x62d1('0x11')]('ChatApplication,\x20%s,\x20%s',_0x31453e,_0x2b9990[_0x62d1('0x11')]['message']);return _0x2943fa(_0x2b9990[_0x62d1('0x11')][_0x62d1('0x13')]);}logger[_0x62d1('0x11')](_0x62d1('0xd'),_0x31453e,_0x2b9990[_0x62d1('0x11')][_0x62d1('0x13')]);return _0x4835ae(_0x2b9990[_0x62d1('0x11')]['message']);}else{logger[_0x62d1('0xc')]('ChatApplication,\x20%s,\x20%s',_0x31453e,_0x62d1('0xe'));_0x4835ae(_0x2b9990['result'][_0x62d1('0x13')]);}})[_0x62d1('0x14')](function(_0x52849d){logger[_0x62d1('0x11')](_0x62d1('0xd'),_0x31453e,_0x52849d);_0x2943fa(_0x52849d);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 453d19b..8ae22e8 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 _0x9f05=['util','path','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0xce06e8,_0x149121){var _0x1ba240=function(_0x37d35d){while(--_0x37d35d){_0xce06e8['push'](_0xce06e8['shift']());}};_0x1ba240(++_0x149121);}(_0x9f05,0x1c1));var _0x59f0=function(_0x2d3382,_0x35e70b){_0x2d3382=_0x2d3382-0x0;var _0x9f09bf=_0x9f05[_0x2d3382];return _0x9f09bf;};'use strict';var multer=require(_0x59f0('0x0'));var util=require(_0x59f0('0x1'));var path=require(_0x59f0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x59f0('0x3'));var config=require(_0x59f0('0x4'));var controller=require(_0x59f0('0x5'));router[_0x59f0('0x6')](_0x59f0('0x7'),auth[_0x59f0('0x8')](),controller[_0x59f0('0x9')]);router[_0x59f0('0xa')](_0x59f0('0x7'),auth['isAuthenticated'](),controller[_0x59f0('0xb')]);router[_0x59f0('0xc')](_0x59f0('0x7'),auth[_0x59f0('0x8')](),controller[_0x59f0('0xd')]);module[_0x59f0('0xe')]=router; \ No newline at end of file +var _0x19ef=['express','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','update','delete','exports','util','path','connect-timeout'];(function(_0x2b9c44,_0x5516e2){var _0x4d200a=function(_0x1faf76){while(--_0x1faf76){_0x2b9c44['push'](_0x2b9c44['shift']());}};_0x4d200a(++_0x5516e2);}(_0x19ef,0xc1));var _0xf19e=function(_0xa3ffc1,_0x17f690){_0xa3ffc1=_0xa3ffc1-0x0;var _0x3d7ed6=_0x19ef[_0xa3ffc1];return _0x3d7ed6;};'use strict';var multer=require('multer');var util=require(_0xf19e('0x0'));var path=require(_0xf19e('0x1'));var timeout=require(_0xf19e('0x2'));var express=require(_0xf19e('0x3'));var router=express['Router']();var fs_extra=require(_0xf19e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf19e('0x5'));var config=require(_0xf19e('0x6'));var controller=require(_0xf19e('0x7'));router['get'](_0xf19e('0x8'),auth[_0xf19e('0x9')](),controller[_0xf19e('0xa')]);router['put'](_0xf19e('0x8'),auth['isAuthenticated'](),controller[_0xf19e('0xb')]);router[_0xf19e('0xc')]('/:id',auth[_0xf19e('0x9')](),controller['destroy']);module[_0xf19e('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 0aae94b..14ab5da 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 _0x3843=['sequelize','exports','STRING'];(function(_0x3db91a,_0x425740){var _0x54c81c=function(_0x4ccf10){while(--_0x4ccf10){_0x3db91a['push'](_0x3db91a['shift']());}};_0x54c81c(++_0x425740);}(_0x3843,0x144));var _0x3384=function(_0x554fb4,_0x1db667){_0x554fb4=_0x554fb4-0x0;var _0x494205=_0x3843[_0x554fb4];return _0x494205;};'use strict';var Sequelize=require(_0x3384('0x0'));module[_0x3384('0x1')]={'name':{'type':Sequelize[_0x3384('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3199=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2b7de6,_0x751b7e){var _0x31fcbf=function(_0x259ed0){while(--_0x259ed0){_0x2b7de6['push'](_0x2b7de6['shift']());}};_0x31fcbf(++_0x751b7e);}(_0x3199,0xe2));var _0x9319=function(_0x19d4b1,_0x441c45){_0x19d4b1=_0x19d4b1-0x0;var _0x3aa962=_0x3199[_0x19d4b1];return _0x3aa962;};'use strict';var Sequelize=require(_0x9319('0x0'));module[_0x9319('0x1')]={'name':{'type':Sequelize[_0x9319('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x9319('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 78d56bc..ebf1907 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 _0x5587=['getMembers','findOne','User','rawAttributes','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatGroup','count','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit'];(function(_0xd73884,_0x2ca96d){var _0x16b79c=function(_0x1521bc){while(--_0x1521bc){_0xd73884['push'](_0xd73884['shift']());}};_0x16b79c(++_0x2ca96d);}(_0x5587,0x6e));var _0x7558=function(_0x5d6c6e,_0x6d7dd0){_0x5d6c6e=_0x5d6c6e-0x0;var _0x1afcb0=_0x5587[_0x5d6c6e];return _0x1afcb0;};'use strict';var emlformat=require(_0x7558('0x0'));var rimraf=require(_0x7558('0x1'));var zipdir=require(_0x7558('0x2'));var jsonpatch=require(_0x7558('0x3'));var rp=require(_0x7558('0x4'));var moment=require(_0x7558('0x5'));var BPromise=require(_0x7558('0x6'));var Mustache=require(_0x7558('0x7'));var util=require('util');var path=require(_0x7558('0x8'));var sox=require('sox');var csv=require(_0x7558('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7558('0xa'));var crypto=require(_0x7558('0xb'));var jsforce=require(_0x7558('0xc'));var deskjs=require(_0x7558('0xd'));var toCsv=require(_0x7558('0x9'));var querystring=require('querystring');var Papa=require(_0x7558('0xe'));var Redis=require('ioredis');var authService=require(_0x7558('0xf'));var qs=require(_0x7558('0x10'));var as=require(_0x7558('0x11'));var hardwareService=require(_0x7558('0x12'));var logger=require(_0x7558('0x13'))(_0x7558('0x14'));var utils=require(_0x7558('0x15'));var config=require(_0x7558('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7558('0x17'))['db'];config['redis']=_[_0x7558('0x18')](config[_0x7558('0x19')],{'host':_0x7558('0x1a'),'port':0x18eb});var socket=require(_0x7558('0x1b'))(new Redis(config[_0x7558('0x19')]));require(_0x7558('0x1c'))[_0x7558('0x1d')](socket);function respondWithStatusCode(_0x5a616c,_0x3ced8f){_0x3ced8f=_0x3ced8f||0xcc;return function(_0x4f4463){if(_0x4f4463){return _0x5a616c[_0x7558('0x1e')](_0x3ced8f);}return _0x5a616c[_0x7558('0x1f')](_0x3ced8f)['end']();};}function respondWithResult(_0x505eb6,_0x5b4e49){_0x5b4e49=_0x5b4e49||0xc8;return function(_0x43fee8){if(_0x43fee8){return _0x505eb6[_0x7558('0x1f')](_0x5b4e49)[_0x7558('0x20')](_0x43fee8);}};}function respondWithFilteredResult(_0x5a02fe,_0x208ee5){return function(_0x2f00e5){if(_0x2f00e5){var _0x39df8b=typeof _0x208ee5[_0x7558('0x21')]==='undefined'&&typeof _0x208ee5[_0x7558('0x22')]===_0x7558('0x23');var _0x4a2ba7=_0x2f00e5['count'];var _0x44a64d=_0x39df8b?0x0:_0x208ee5['offset'];var _0x225fc4=_0x39df8b?_0x2f00e5['count']:_0x208ee5[_0x7558('0x21')]+_0x208ee5[_0x7558('0x22')];var _0x1999f7;if(_0x225fc4>=_0x4a2ba7){_0x225fc4=_0x4a2ba7;_0x1999f7=0xc8;}else{_0x1999f7=0xce;}_0x5a02fe[_0x7558('0x1f')](_0x1999f7);return _0x5a02fe[_0x7558('0x24')](_0x7558('0x25'),_0x44a64d+'-'+_0x225fc4+'/'+_0x4a2ba7)['json'](_0x2f00e5);}return null;};}function patchUpdates(_0x6677f5){return function(_0x2e41bb){try{jsonpatch[_0x7558('0x26')](_0x2e41bb,_0x6677f5,!![]);}catch(_0x30c60a){return BPromise[_0x7558('0x27')](_0x30c60a);}return _0x2e41bb['save']();};}function saveUpdates(_0x928046,_0x558234){return function(_0x595919){if(_0x595919){return _0x595919[_0x7558('0x28')](_0x928046)[_0x7558('0x29')](function(_0x29fece){return _0x29fece;});}return null;};}function removeEntity(_0x8478bb,_0x3f9f7d){return function(_0x4ef423){if(_0x4ef423){return _0x4ef423[_0x7558('0x2a')]()[_0x7558('0x29')](function(){_0x8478bb['status'](0xcc)[_0x7558('0x2b')]();});}};}function handleEntityNotFound(_0x419842,_0xb60f25){return function(_0x4b7549){if(!_0x4b7549){_0x419842[_0x7558('0x1e')](0x194);}return _0x4b7549;};}function handleError(_0x1861ce,_0x2cfee6){_0x2cfee6=_0x2cfee6||0x1f4;return function(_0x115c4){logger[_0x7558('0x2c')](_0x115c4[_0x7558('0x2d')]);if(_0x115c4[_0x7558('0x2e')]){delete _0x115c4[_0x7558('0x2e')];}_0x1861ce['status'](_0x2cfee6)[_0x7558('0x2f')](_0x115c4);};}exports[_0x7558('0x30')]=function(_0x558940,_0x52c48b){var _0x6f8523={},_0x596351={},_0x588bf4={'count':0x0,'rows':[]};var _0xeb1b87=_[_0x7558('0x31')](db['ChatGroup']['rawAttributes'],function(_0x1a4bcc){return{'name':_0x1a4bcc['fieldName'],'type':_0x1a4bcc['type'][_0x7558('0x32')]};});_0x596351['model']=_[_0x7558('0x31')](_0xeb1b87,_0x7558('0x2e'));_0x596351[_0x7558('0x33')]=_[_0x7558('0x34')](_0x558940[_0x7558('0x33')]);_0x596351[_0x7558('0x35')]=_[_0x7558('0x36')](_0x596351[_0x7558('0x37')],_0x596351[_0x7558('0x33')]);_0x6f8523[_0x7558('0x38')]=_['intersection'](_0x596351['model'],qs[_0x7558('0x39')](_0x558940['query'][_0x7558('0x39')]));_0x6f8523[_0x7558('0x38')]=_0x6f8523[_0x7558('0x38')][_0x7558('0x3a')]?_0x6f8523['attributes']:_0x596351[_0x7558('0x37')];if(!_0x558940[_0x7558('0x33')][_0x7558('0x3b')](_0x7558('0x3c'))){_0x6f8523[_0x7558('0x22')]=qs['limit'](_0x558940[_0x7558('0x33')][_0x7558('0x22')]);_0x6f8523[_0x7558('0x21')]=qs[_0x7558('0x21')](_0x558940[_0x7558('0x33')][_0x7558('0x21')]);}_0x6f8523[_0x7558('0x3d')]=qs[_0x7558('0x3e')](_0x558940[_0x7558('0x33')]['sort']);_0x6f8523[_0x7558('0x3f')]=qs['filters'](_[_0x7558('0x40')](_0x558940['query'],_0x596351['filters']),_0xeb1b87);if(_0x558940[_0x7558('0x33')][_0x7558('0x41')]){_0x6f8523[_0x7558('0x3f')]=_[_0x7558('0x42')](_0x6f8523[_0x7558('0x3f')],{'$or':_['map'](_0xeb1b87,function(_0x2ef4d7){if(_0x2ef4d7['type']!==_0x7558('0x43')){var _0x26fde0={};_0x26fde0[_0x2ef4d7['name']]={'$like':'%'+_0x558940[_0x7558('0x33')][_0x7558('0x41')]+'%'};return _0x26fde0;}})});}_0x6f8523=_[_0x7558('0x42')]({},_0x6f8523,_0x558940[_0x7558('0x44')]);var _0x4b27a8={'where':_0x6f8523[_0x7558('0x3f')]};return db[_0x7558('0x45')][_0x7558('0x46')](_0x4b27a8)['then'](function(_0x11f4d0){_0x588bf4['count']=_0x11f4d0;if(_0x558940[_0x7558('0x33')][_0x7558('0x47')]){_0x6f8523[_0x7558('0x48')]=[{'all':!![]}];}return db['ChatGroup'][_0x7558('0x49')](_0x6f8523);})['then'](function(_0x26570d){_0x588bf4[_0x7558('0x4a')]=_0x26570d;return _0x588bf4;})[_0x7558('0x29')](respondWithFilteredResult(_0x52c48b,_0x6f8523))['catch'](handleError(_0x52c48b,null));};exports[_0x7558('0x4b')]=function(_0x89e2,_0x244862){var _0x1f6ba9={'raw':!![],'where':{'id':_0x89e2[_0x7558('0x4c')]['id']}},_0x2bbc89={};_0x2bbc89[_0x7558('0x37')]=_[_0x7558('0x34')](db[_0x7558('0x45')]['rawAttributes']);_0x2bbc89[_0x7558('0x33')]=_[_0x7558('0x34')](_0x89e2[_0x7558('0x33')]);_0x2bbc89['filters']=_['intersection'](_0x2bbc89[_0x7558('0x37')],_0x2bbc89[_0x7558('0x33')]);_0x1f6ba9['attributes']=_['intersection'](_0x2bbc89[_0x7558('0x37')],qs[_0x7558('0x39')](_0x89e2[_0x7558('0x33')]['fields']));_0x1f6ba9['attributes']=_0x1f6ba9[_0x7558('0x38')][_0x7558('0x3a')]?_0x1f6ba9[_0x7558('0x38')]:_0x2bbc89['model'];if(_0x89e2['query']['includeAll']){_0x1f6ba9[_0x7558('0x48')]=[{'all':!![]}];}_0x1f6ba9=_['merge']({},_0x1f6ba9,_0x89e2['options']);return db[_0x7558('0x45')][_0x7558('0x4d')](_0x1f6ba9)[_0x7558('0x29')](handleEntityNotFound(_0x244862,null))[_0x7558('0x29')](respondWithResult(_0x244862,null))['catch'](handleError(_0x244862,null));};exports[_0x7558('0x4e')]=function(_0x248306,_0x129a7e){return db[_0x7558('0x45')][_0x7558('0x4e')](_0x248306[_0x7558('0x4f')],{})[_0x7558('0x29')](respondWithResult(_0x129a7e,0xc9))[_0x7558('0x50')](handleError(_0x129a7e,null));};exports[_0x7558('0x28')]=function(_0x1504d6,_0x30851c){if(_0x1504d6[_0x7558('0x4f')]['id']){delete _0x1504d6[_0x7558('0x4f')]['id'];}return db[_0x7558('0x45')][_0x7558('0x4d')]({'where':{'id':_0x1504d6[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x30851c,null))[_0x7558('0x29')](saveUpdates(_0x1504d6['body'],null))[_0x7558('0x29')](respondWithResult(_0x30851c,null))[_0x7558('0x50')](handleError(_0x30851c,null));};exports[_0x7558('0x2a')]=function(_0x44043d,_0x5827f4){return db[_0x7558('0x45')][_0x7558('0x4d')]({'where':{'id':_0x44043d[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x5827f4,null))[_0x7558('0x29')](removeEntity(_0x5827f4,null))[_0x7558('0x50')](handleError(_0x5827f4,null));};exports[_0x7558('0x51')]=function(_0x2c4511,_0x42ca74){return db[_0x7558('0x45')][_0x7558('0x51')]()[_0x7558('0x29')](respondWithResult(_0x42ca74,null))[_0x7558('0x50')](handleError(_0x42ca74,null));};exports['getUnread']=function(_0x355249,_0x45700b,_0x14551c){return db[_0x7558('0x52')]['count']({'where':{'ChatGroupId':_0x355249[_0x7558('0x4c')]['id'],'ToId':_0x355249[_0x7558('0x53')]['id'],'read':![]}})[_0x7558('0x29')](function(_0x5ef917){return{'id':_[_0x7558('0x54')](_0x355249[_0x7558('0x4c')]['id']),'count':_0x5ef917};})[_0x7558('0x29')](respondWithResult(_0x45700b,null))[_0x7558('0x50')](handleError(_0x45700b,null));};exports['addMembers']=function(_0x32c7a5,_0x18f934,_0x5e8275){return db[_0x7558('0x45')]['find']({'where':{'id':_0x32c7a5[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x18f934,null))[_0x7558('0x29')](function(_0x5481e9){if(_0x5481e9){return _0x5481e9[_0x7558('0x55')](_0x32c7a5[_0x7558('0x4f')][_0x7558('0x56')],_[_0x7558('0x57')](_0x32c7a5[_0x7558('0x4f')],[_0x7558('0x56'),'id'])||{});}})[_0x7558('0x29')](respondWithResult(_0x18f934,null))['catch'](handleError(_0x18f934,null));};exports[_0x7558('0x58')]=function(_0x2e540a,_0x325737,_0x3c3381){var _0x243bc1={};var _0x53444a={};var _0xf5a3ba;var _0x309fae;return db['ChatGroup'][_0x7558('0x59')]({'where':{'id':_0x2e540a[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x325737,null))[_0x7558('0x29')](function(_0x3571f2){if(_0x3571f2){_0xf5a3ba=_0x3571f2;_0x53444a[_0x7558('0x37')]=_['keys'](db[_0x7558('0x5a')][_0x7558('0x5b')]);_0x53444a['query']=_['keys'](_0x2e540a[_0x7558('0x33')]);_0x53444a[_0x7558('0x35')]=_['intersection'](_0x53444a[_0x7558('0x37')],_0x53444a['query']);_0x243bc1[_0x7558('0x38')]=_['intersection'](_0x53444a[_0x7558('0x37')],qs['fields'](_0x2e540a[_0x7558('0x33')]['fields']));_0x243bc1[_0x7558('0x38')]=_0x243bc1['attributes'][_0x7558('0x3a')]?_0x243bc1[_0x7558('0x38')]:_0x53444a[_0x7558('0x37')];_0x243bc1[_0x7558('0x3d')]=qs['sort'](_0x2e540a[_0x7558('0x33')][_0x7558('0x3e')]);_0x243bc1[_0x7558('0x3f')]=qs['filters'](_[_0x7558('0x40')](_0x2e540a[_0x7558('0x33')],_0x53444a[_0x7558('0x35')]));if(_0x2e540a[_0x7558('0x33')][_0x7558('0x41')]){_0x243bc1['where']=_[_0x7558('0x42')](_0x243bc1['where'],{'$or':_['map'](_0x243bc1[_0x7558('0x38')],function(_0x26288c){var _0x4a454b={};_0x4a454b[_0x26288c]={'$like':'%'+_0x2e540a[_0x7558('0x33')][_0x7558('0x41')]+'%'};return _0x4a454b;})});}_0x243bc1=_[_0x7558('0x42')]({},_0x243bc1,_0x2e540a['options']);return _0xf5a3ba[_0x7558('0x58')](_0x243bc1);}})[_0x7558('0x29')](function(_0x5660c7){if(_0x5660c7){_0x309fae=_0x5660c7[_0x7558('0x3a')];if(!_0x2e540a[_0x7558('0x33')][_0x7558('0x3b')](_0x7558('0x3c'))){_0x243bc1[_0x7558('0x22')]=qs[_0x7558('0x22')](_0x2e540a[_0x7558('0x33')][_0x7558('0x22')]);_0x243bc1[_0x7558('0x21')]=qs['offset'](_0x2e540a[_0x7558('0x33')][_0x7558('0x21')]);}return _0xf5a3ba[_0x7558('0x58')](_0x243bc1);}})[_0x7558('0x29')](function(_0xf268cb){if(_0xf268cb){return _0xf268cb?{'count':_0x309fae,'rows':_0xf268cb}:null;}})[_0x7558('0x29')](respondWithResult(_0x325737,null))[_0x7558('0x50')](handleError(_0x325737,null));};exports[_0x7558('0x5c')]=function(_0x19dec0,_0x5989d4,_0xc08830){return db[_0x7558('0x45')][_0x7558('0x4d')]({'where':{'id':_0x19dec0[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x5989d4,null))[_0x7558('0x29')](function(_0x12fedc){if(_0x12fedc){return _0x12fedc['removeMembers'](_0x19dec0[_0x7558('0x33')]['ids']);}})[_0x7558('0x29')](respondWithStatusCode(_0x5989d4,null))[_0x7558('0x50')](handleError(_0x5989d4,null));};exports[_0x7558('0x5d')]=function(_0x2e3f41,_0x425227,_0x200469){if(_0x2e3f41[_0x7558('0x4f')]['id']){delete _0x2e3f41['body']['id'];}return db[_0x7558('0x45')][_0x7558('0x4d')]({'where':{'id':_0x2e3f41[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x425227,null))['then'](function(_0x457626){if(_0x457626){_0x2e3f41[_0x7558('0x4f')][_0x7558('0x5e')]=_0x457626['id'];return db[_0x7558('0x52')][_0x7558('0x4e')](_0x2e3f41[_0x7558('0x4f')]);}})[_0x7558('0x29')](respondWithResult(_0x425227,null))[_0x7558('0x50')](handleError(_0x425227,null));};exports[_0x7558('0x5f')]=function(_0x549417,_0x11c7b2,_0x4412db){var _0x4a458c={};var _0x68aabf={};var _0x11192a;var _0x660182;return db[_0x7558('0x45')][_0x7558('0x59')]({'where':{'id':_0x549417[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x11c7b2,null))[_0x7558('0x29')](function(_0x5566f9){if(_0x5566f9){_0x11192a=_0x5566f9;_0x68aabf[_0x7558('0x37')]=_[_0x7558('0x34')](db[_0x7558('0x52')]['rawAttributes']);_0x68aabf['query']=_[_0x7558('0x34')](_0x549417[_0x7558('0x33')]);_0x68aabf[_0x7558('0x35')]=_['intersection'](_0x68aabf[_0x7558('0x37')],_0x68aabf[_0x7558('0x33')]);_0x4a458c[_0x7558('0x38')]=_['intersection'](_0x68aabf[_0x7558('0x37')],qs[_0x7558('0x39')](_0x549417[_0x7558('0x33')][_0x7558('0x39')]));_0x4a458c['attributes']=_0x4a458c[_0x7558('0x38')][_0x7558('0x3a')]?_0x4a458c['attributes']:_0x68aabf[_0x7558('0x37')];_0x4a458c['order']=qs[_0x7558('0x3e')](_0x549417['query'][_0x7558('0x3e')]);_0x4a458c[_0x7558('0x3f')]=qs[_0x7558('0x35')](_[_0x7558('0x40')](_0x549417[_0x7558('0x33')],_0x68aabf[_0x7558('0x35')]));if(_0x549417[_0x7558('0x33')][_0x7558('0x41')]){_0x4a458c[_0x7558('0x3f')]=_[_0x7558('0x42')](_0x4a458c[_0x7558('0x3f')],{'$or':_[_0x7558('0x31')](_0x4a458c['attributes'],function(_0x5eec25){var _0x278f8e={};_0x278f8e[_0x5eec25]={'$like':'%'+_0x549417[_0x7558('0x33')][_0x7558('0x41')]+'%'};return _0x278f8e;})});}if(_0x549417[_0x7558('0x33')][_0x7558('0x60')]){var _0x387179=_0x549417[_0x7558('0x33')][_0x7558('0x60')][_0x7558('0x61')](',');var _0x2413b0={};_0x2413b0[_0x387179[0x0]]={'$gte':moment(_0x387179[0x1])[_0x7558('0x62')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4a458c['where']=_[_0x7558('0x42')](_0x4a458c['where'],_0x2413b0);}_0x4a458c=_[_0x7558('0x42')]({},_0x4a458c,_0x549417[_0x7558('0x44')]);return _0x11192a[_0x7558('0x5f')](_0x4a458c);}})[_0x7558('0x29')](function(_0x3d3d33){if(_0x3d3d33){_0x660182=_0x3d3d33[_0x7558('0x3a')];if(!_0x549417[_0x7558('0x33')][_0x7558('0x3b')]('nolimit')){_0x4a458c[_0x7558('0x22')]=qs[_0x7558('0x22')](_0x549417['query'][_0x7558('0x22')]);_0x4a458c['offset']=qs[_0x7558('0x21')](_0x549417[_0x7558('0x33')][_0x7558('0x21')]);}return _0x11192a[_0x7558('0x5f')](_0x4a458c);}})[_0x7558('0x29')](function(_0x12cb2e){if(_0x12cb2e){return _0x12cb2e?{'count':_0x660182,'rows':_0x12cb2e}:null;}})['then'](respondWithResult(_0x11c7b2,null))[_0x7558('0x50')](handleError(_0x11c7b2,null));}; \ No newline at end of file +var _0xe69d=['model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','filter','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type'];(function(_0x4ba45f,_0xf48e2b){var _0x4aabda=function(_0x5509cf){while(--_0x5509cf){_0x4ba45f['push'](_0x4ba45f['shift']());}};_0x4aabda(++_0xf48e2b);}(_0xe69d,0xf1));var _0xde69=function(_0x1d4b1e,_0x5f5ba6){_0x1d4b1e=_0x1d4b1e-0x0;var _0x430534=_0xe69d[_0x1d4b1e];return _0x430534;};'use strict';var emlformat=require(_0xde69('0x0'));var rimraf=require(_0xde69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xde69('0x2'));var moment=require(_0xde69('0x3'));var BPromise=require(_0xde69('0x4'));var Mustache=require(_0xde69('0x5'));var util=require(_0xde69('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xde69('0x7'));var ejs=require(_0xde69('0x8'));var fs=require('fs');var fs_extra=require(_0xde69('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde69('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xde69('0x7'));var querystring=require(_0xde69('0xb'));var Papa=require(_0xde69('0xc'));var Redis=require(_0xde69('0xd'));var authService=require(_0xde69('0xe'));var qs=require(_0xde69('0xf'));var as=require(_0xde69('0x10'));var hardwareService=require(_0xde69('0x11'));var logger=require(_0xde69('0x12'))(_0xde69('0x13'));var utils=require('../../config/utils');var config=require(_0xde69('0x14'));var licenseUtil=require(_0xde69('0x15'));var db=require('../../mysqldb')['db'];config[_0xde69('0x16')]=_['defaults'](config[_0xde69('0x16')],{'host':_0xde69('0x17'),'port':0x18eb});var socket=require(_0xde69('0x18'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xde69('0x19')](socket);function respondWithStatusCode(_0x49359e,_0x582d54){_0x582d54=_0x582d54||0xcc;return function(_0x593786){if(_0x593786){return _0x49359e[_0xde69('0x1a')](_0x582d54);}return _0x49359e['status'](_0x582d54)[_0xde69('0x1b')]();};}function respondWithResult(_0x26a575,_0x5f4b45){_0x5f4b45=_0x5f4b45||0xc8;return function(_0x49993b){if(_0x49993b){return _0x26a575[_0xde69('0x1c')](_0x5f4b45)[_0xde69('0x1d')](_0x49993b);}};}function respondWithFilteredResult(_0x25c4aa,_0x2844ff){return function(_0x2113f6){if(_0x2113f6){var _0x224b03=typeof _0x2844ff[_0xde69('0x1e')]===_0xde69('0x1f')&&typeof _0x2844ff[_0xde69('0x20')]==='undefined';var _0x5cc59e=_0x2113f6['count'];var _0x5892a9=_0x224b03?0x0:_0x2844ff[_0xde69('0x1e')];var _0x3de501=_0x224b03?_0x2113f6['count']:_0x2844ff['offset']+_0x2844ff['limit'];var _0x46bafa;if(_0x3de501>=_0x5cc59e){_0x3de501=_0x5cc59e;_0x46bafa=0xc8;}else{_0x46bafa=0xce;}_0x25c4aa[_0xde69('0x1c')](_0x46bafa);return _0x25c4aa[_0xde69('0x21')](_0xde69('0x22'),_0x5892a9+'-'+_0x3de501+'/'+_0x5cc59e)['json'](_0x2113f6);}return null;};}function patchUpdates(_0x1e18e8){return function(_0x373c99){try{jsonpatch[_0xde69('0x23')](_0x373c99,_0x1e18e8,!![]);}catch(_0x2e7f03){return BPromise[_0xde69('0x24')](_0x2e7f03);}return _0x373c99[_0xde69('0x25')]();};}function saveUpdates(_0x28ccc7,_0x11d648){return function(_0x337419){if(_0x337419){return _0x337419[_0xde69('0x26')](_0x28ccc7)['then'](function(_0x57ea5e){return _0x57ea5e;});}return null;};}function removeEntity(_0x1a41a1,_0x5f5d81){return function(_0x6b4797){if(_0x6b4797){return _0x6b4797[_0xde69('0x27')]()[_0xde69('0x28')](function(){_0x1a41a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x504793,_0x2572f6){return function(_0x30ee6c){if(!_0x30ee6c){_0x504793['sendStatus'](0x194);}return _0x30ee6c;};}function handleError(_0x5b0c6c,_0x281061){_0x281061=_0x281061||0x1f4;return function(_0x282381){logger[_0xde69('0x29')](_0x282381[_0xde69('0x2a')]);if(_0x282381[_0xde69('0x2b')]){delete _0x282381[_0xde69('0x2b')];}_0x5b0c6c[_0xde69('0x1c')](_0x281061)[_0xde69('0x2c')](_0x282381);};}exports[_0xde69('0x2d')]=function(_0x3e970b,_0x3636c2){var _0x5977ed={},_0x2dedf2={},_0x222c1f={'count':0x0,'rows':[]};var _0x250232=_['map'](db[_0xde69('0x2e')][_0xde69('0x2f')],function(_0x5dca36){return{'name':_0x5dca36[_0xde69('0x30')],'type':_0x5dca36[_0xde69('0x31')]['key']};});_0x2dedf2[_0xde69('0x32')]=_[_0xde69('0x33')](_0x250232,'name');_0x2dedf2[_0xde69('0x34')]=_[_0xde69('0x35')](_0x3e970b[_0xde69('0x34')]);_0x2dedf2[_0xde69('0x36')]=_[_0xde69('0x37')](_0x2dedf2[_0xde69('0x32')],_0x2dedf2[_0xde69('0x34')]);_0x5977ed['attributes']=_[_0xde69('0x37')](_0x2dedf2[_0xde69('0x32')],qs[_0xde69('0x38')](_0x3e970b[_0xde69('0x34')][_0xde69('0x38')]));_0x5977ed['attributes']=_0x5977ed[_0xde69('0x39')][_0xde69('0x3a')]?_0x5977ed[_0xde69('0x39')]:_0x2dedf2[_0xde69('0x32')];if(!_0x3e970b[_0xde69('0x34')][_0xde69('0x3b')](_0xde69('0x3c'))){_0x5977ed[_0xde69('0x20')]=qs[_0xde69('0x20')](_0x3e970b[_0xde69('0x34')][_0xde69('0x20')]);_0x5977ed[_0xde69('0x1e')]=qs[_0xde69('0x1e')](_0x3e970b[_0xde69('0x34')][_0xde69('0x1e')]);}_0x5977ed[_0xde69('0x3d')]=qs[_0xde69('0x3e')](_0x3e970b[_0xde69('0x34')][_0xde69('0x3e')]);_0x5977ed[_0xde69('0x3f')]=qs[_0xde69('0x36')](_[_0xde69('0x40')](_0x3e970b[_0xde69('0x34')],_0x2dedf2[_0xde69('0x36')]),_0x250232);if(_0x3e970b[_0xde69('0x34')]['filter']){_0x5977ed['where']=_[_0xde69('0x41')](_0x5977ed['where'],{'$or':_['map'](_0x250232,function(_0x503810){if(_0x503810[_0xde69('0x31')]!=='VIRTUAL'){var _0x3e7d4a={};_0x3e7d4a[_0x503810[_0xde69('0x2b')]]={'$like':'%'+_0x3e970b[_0xde69('0x34')]['filter']+'%'};return _0x3e7d4a;}})});}_0x5977ed=_[_0xde69('0x41')]({},_0x5977ed,_0x3e970b[_0xde69('0x42')]);var _0x1bdd7d={'where':_0x5977ed[_0xde69('0x3f')]};return db['ChatGroup'][_0xde69('0x43')](_0x1bdd7d)[_0xde69('0x28')](function(_0x30b2d8){_0x222c1f[_0xde69('0x43')]=_0x30b2d8;if(_0x3e970b[_0xde69('0x34')][_0xde69('0x44')]){_0x5977ed[_0xde69('0x45')]=[{'all':!![]}];}return db[_0xde69('0x2e')][_0xde69('0x46')](_0x5977ed);})[_0xde69('0x28')](function(_0x3441c4){_0x222c1f[_0xde69('0x47')]=_0x3441c4;return _0x222c1f;})[_0xde69('0x28')](respondWithFilteredResult(_0x3636c2,_0x5977ed))['catch'](handleError(_0x3636c2,null));};exports[_0xde69('0x48')]=function(_0x596e0d,_0x4b9d9c){var _0x2c99ee={'raw':!![],'where':{'id':_0x596e0d[_0xde69('0x49')]['id']}},_0x9cfa64={};_0x9cfa64[_0xde69('0x32')]=_[_0xde69('0x35')](db['ChatGroup'][_0xde69('0x2f')]);_0x9cfa64[_0xde69('0x34')]=_[_0xde69('0x35')](_0x596e0d[_0xde69('0x34')]);_0x9cfa64[_0xde69('0x36')]=_['intersection'](_0x9cfa64[_0xde69('0x32')],_0x9cfa64[_0xde69('0x34')]);_0x2c99ee['attributes']=_['intersection'](_0x9cfa64['model'],qs['fields'](_0x596e0d[_0xde69('0x34')][_0xde69('0x38')]));_0x2c99ee[_0xde69('0x39')]=_0x2c99ee[_0xde69('0x39')][_0xde69('0x3a')]?_0x2c99ee[_0xde69('0x39')]:_0x9cfa64[_0xde69('0x32')];if(_0x596e0d[_0xde69('0x34')][_0xde69('0x44')]){_0x2c99ee[_0xde69('0x45')]=[{'all':!![]}];}_0x2c99ee=_['merge']({},_0x2c99ee,_0x596e0d[_0xde69('0x42')]);return db['ChatGroup'][_0xde69('0x4a')](_0x2c99ee)[_0xde69('0x28')](handleEntityNotFound(_0x4b9d9c,null))[_0xde69('0x28')](respondWithResult(_0x4b9d9c,null))[_0xde69('0x4b')](handleError(_0x4b9d9c,null));};exports[_0xde69('0x4c')]=function(_0x357403,_0x311d58){return db[_0xde69('0x2e')][_0xde69('0x4c')](_0x357403['body'],{})['then'](respondWithResult(_0x311d58,0xc9))[_0xde69('0x4b')](handleError(_0x311d58,null));};exports[_0xde69('0x26')]=function(_0x21c618,_0x2823a9){if(_0x21c618[_0xde69('0x4d')]['id']){delete _0x21c618[_0xde69('0x4d')]['id'];}return db[_0xde69('0x2e')]['find']({'where':{'id':_0x21c618[_0xde69('0x49')]['id']}})[_0xde69('0x28')](handleEntityNotFound(_0x2823a9,null))[_0xde69('0x28')](saveUpdates(_0x21c618[_0xde69('0x4d')],null))[_0xde69('0x28')](respondWithResult(_0x2823a9,null))[_0xde69('0x4b')](handleError(_0x2823a9,null));};exports['destroy']=function(_0x122c45,_0x182cf4){return db[_0xde69('0x2e')][_0xde69('0x4a')]({'where':{'id':_0x122c45[_0xde69('0x49')]['id']}})[_0xde69('0x28')](handleEntityNotFound(_0x182cf4,null))['then'](removeEntity(_0x182cf4,null))[_0xde69('0x4b')](handleError(_0x182cf4,null));};exports[_0xde69('0x4e')]=function(_0x22e53e,_0x4c4c05){return db[_0xde69('0x2e')]['describe']()[_0xde69('0x28')](respondWithResult(_0x4c4c05,null))['catch'](handleError(_0x4c4c05,null));};exports[_0xde69('0x4f')]=function(_0x23aa59,_0x3c54c1,_0x5c23d3){return db[_0xde69('0x50')]['count']({'where':{'ChatGroupId':_0x23aa59[_0xde69('0x49')]['id'],'ToId':_0x23aa59['user']['id'],'read':![]}})[_0xde69('0x28')](function(_0x33d7bd){return{'id':_[_0xde69('0x51')](_0x23aa59[_0xde69('0x49')]['id']),'count':_0x33d7bd};})[_0xde69('0x28')](respondWithResult(_0x3c54c1,null))[_0xde69('0x4b')](handleError(_0x3c54c1,null));};exports[_0xde69('0x52')]=function(_0x5d202a,_0x20ab9d,_0x1cf3b5){return db[_0xde69('0x2e')][_0xde69('0x4a')]({'where':{'id':_0x5d202a[_0xde69('0x49')]['id']}})[_0xde69('0x28')](handleEntityNotFound(_0x20ab9d,null))[_0xde69('0x28')](function(_0x483fa1){if(_0x483fa1){return _0x483fa1[_0xde69('0x52')](_0x5d202a['body'][_0xde69('0x53')],_[_0xde69('0x54')](_0x5d202a['body'],[_0xde69('0x53'),'id'])||{});}})[_0xde69('0x28')](respondWithResult(_0x20ab9d,null))['catch'](handleError(_0x20ab9d,null));};exports[_0xde69('0x55')]=function(_0x2066e2,_0x4b645e,_0x328a13){var _0xa8d96c={};var _0x30404d={};var _0x15be6f;var _0x56125d;return db[_0xde69('0x2e')][_0xde69('0x56')]({'where':{'id':_0x2066e2['params']['id']}})[_0xde69('0x28')](handleEntityNotFound(_0x4b645e,null))[_0xde69('0x28')](function(_0xecb190){if(_0xecb190){_0x15be6f=_0xecb190;_0x30404d[_0xde69('0x32')]=_[_0xde69('0x35')](db[_0xde69('0x57')][_0xde69('0x2f')]);_0x30404d[_0xde69('0x34')]=_[_0xde69('0x35')](_0x2066e2[_0xde69('0x34')]);_0x30404d[_0xde69('0x36')]=_[_0xde69('0x37')](_0x30404d['model'],_0x30404d[_0xde69('0x34')]);_0xa8d96c['attributes']=_[_0xde69('0x37')](_0x30404d['model'],qs[_0xde69('0x38')](_0x2066e2[_0xde69('0x34')]['fields']));_0xa8d96c[_0xde69('0x39')]=_0xa8d96c['attributes'][_0xde69('0x3a')]?_0xa8d96c[_0xde69('0x39')]:_0x30404d['model'];_0xa8d96c[_0xde69('0x3d')]=qs[_0xde69('0x3e')](_0x2066e2[_0xde69('0x34')]['sort']);_0xa8d96c[_0xde69('0x3f')]=qs[_0xde69('0x36')](_['pick'](_0x2066e2[_0xde69('0x34')],_0x30404d[_0xde69('0x36')]));if(_0x2066e2['query'][_0xde69('0x58')]){_0xa8d96c[_0xde69('0x3f')]=_[_0xde69('0x41')](_0xa8d96c[_0xde69('0x3f')],{'$or':_[_0xde69('0x33')](_0xa8d96c['attributes'],function(_0x4a3f86){var _0x4c6bcc={};_0x4c6bcc[_0x4a3f86]={'$like':'%'+_0x2066e2[_0xde69('0x34')]['filter']+'%'};return _0x4c6bcc;})});}_0xa8d96c=_[_0xde69('0x41')]({},_0xa8d96c,_0x2066e2[_0xde69('0x42')]);return _0x15be6f[_0xde69('0x55')](_0xa8d96c);}})[_0xde69('0x28')](function(_0x487eaf){if(_0x487eaf){_0x56125d=_0x487eaf[_0xde69('0x3a')];if(!_0x2066e2[_0xde69('0x34')][_0xde69('0x3b')](_0xde69('0x3c'))){_0xa8d96c[_0xde69('0x20')]=qs[_0xde69('0x20')](_0x2066e2[_0xde69('0x34')]['limit']);_0xa8d96c['offset']=qs[_0xde69('0x1e')](_0x2066e2[_0xde69('0x34')]['offset']);}return _0x15be6f[_0xde69('0x55')](_0xa8d96c);}})['then'](function(_0x36a870){if(_0x36a870){return _0x36a870?{'count':_0x56125d,'rows':_0x36a870}:null;}})[_0xde69('0x28')](respondWithResult(_0x4b645e,null))[_0xde69('0x4b')](handleError(_0x4b645e,null));};exports[_0xde69('0x59')]=function(_0x1b3fcb,_0x554c89,_0x1af172){return db['ChatGroup']['find']({'where':{'id':_0x1b3fcb[_0xde69('0x49')]['id']}})[_0xde69('0x28')](handleEntityNotFound(_0x554c89,null))[_0xde69('0x28')](function(_0x118978){if(_0x118978){return _0x118978['removeMembers'](_0x1b3fcb[_0xde69('0x34')][_0xde69('0x53')]);}})[_0xde69('0x28')](respondWithStatusCode(_0x554c89,null))['catch'](handleError(_0x554c89,null));};exports[_0xde69('0x5a')]=function(_0x464020,_0x4c0405,_0x4c1ca2){if(_0x464020[_0xde69('0x4d')]['id']){delete _0x464020[_0xde69('0x4d')]['id'];}return db['ChatGroup'][_0xde69('0x4a')]({'where':{'id':_0x464020['params']['id']}})['then'](handleEntityNotFound(_0x4c0405,null))[_0xde69('0x28')](function(_0x35e43a){if(_0x35e43a){_0x464020[_0xde69('0x4d')][_0xde69('0x5b')]=_0x35e43a['id'];return db['ChatInternalMessage'][_0xde69('0x4c')](_0x464020['body']);}})[_0xde69('0x28')](respondWithResult(_0x4c0405,null))[_0xde69('0x4b')](handleError(_0x4c0405,null));};exports[_0xde69('0x5c')]=function(_0x1fdd7f,_0x5ad556,_0x1fc177){var _0x160983={};var _0x2b52c5={};var _0x2dd104;var _0x2739f1;return db[_0xde69('0x2e')][_0xde69('0x56')]({'where':{'id':_0x1fdd7f[_0xde69('0x49')]['id']}})[_0xde69('0x28')](handleEntityNotFound(_0x5ad556,null))['then'](function(_0x2def34){if(_0x2def34){_0x2dd104=_0x2def34;_0x2b52c5[_0xde69('0x32')]=_[_0xde69('0x35')](db[_0xde69('0x50')][_0xde69('0x2f')]);_0x2b52c5[_0xde69('0x34')]=_['keys'](_0x1fdd7f[_0xde69('0x34')]);_0x2b52c5[_0xde69('0x36')]=_[_0xde69('0x37')](_0x2b52c5[_0xde69('0x32')],_0x2b52c5['query']);_0x160983[_0xde69('0x39')]=_['intersection'](_0x2b52c5[_0xde69('0x32')],qs[_0xde69('0x38')](_0x1fdd7f[_0xde69('0x34')][_0xde69('0x38')]));_0x160983[_0xde69('0x39')]=_0x160983[_0xde69('0x39')][_0xde69('0x3a')]?_0x160983[_0xde69('0x39')]:_0x2b52c5[_0xde69('0x32')];_0x160983['order']=qs[_0xde69('0x3e')](_0x1fdd7f[_0xde69('0x34')][_0xde69('0x3e')]);_0x160983[_0xde69('0x3f')]=qs[_0xde69('0x36')](_[_0xde69('0x40')](_0x1fdd7f[_0xde69('0x34')],_0x2b52c5[_0xde69('0x36')]));if(_0x1fdd7f[_0xde69('0x34')]['filter']){_0x160983['where']=_[_0xde69('0x41')](_0x160983[_0xde69('0x3f')],{'$or':_[_0xde69('0x33')](_0x160983[_0xde69('0x39')],function(_0x14e3a9){var _0x588f04={};_0x588f04[_0x14e3a9]={'$like':'%'+_0x1fdd7f[_0xde69('0x34')][_0xde69('0x58')]+'%'};return _0x588f04;})});}if(_0x1fdd7f[_0xde69('0x34')]['$gte']){var _0x3cba30=_0x1fdd7f[_0xde69('0x34')][_0xde69('0x5d')][_0xde69('0x5e')](',');var _0x5b28d9={};_0x5b28d9[_0x3cba30[0x0]]={'$gte':moment(_0x3cba30[0x1])[_0xde69('0x5f')](_0xde69('0x60'))};_0x160983['where']=_[_0xde69('0x41')](_0x160983[_0xde69('0x3f')],_0x5b28d9);}_0x160983=_[_0xde69('0x41')]({},_0x160983,_0x1fdd7f[_0xde69('0x42')]);return _0x2dd104['getMessages'](_0x160983);}})[_0xde69('0x28')](function(_0x1fb3c3){if(_0x1fb3c3){_0x2739f1=_0x1fb3c3[_0xde69('0x3a')];if(!_0x1fdd7f['query']['hasOwnProperty'](_0xde69('0x3c'))){_0x160983['limit']=qs[_0xde69('0x20')](_0x1fdd7f['query'][_0xde69('0x20')]);_0x160983[_0xde69('0x1e')]=qs['offset'](_0x1fdd7f[_0xde69('0x34')][_0xde69('0x1e')]);}return _0x2dd104['getMessages'](_0x160983);}})[_0xde69('0x28')](function(_0x5d9baf){if(_0x5d9baf){return _0x5d9baf?{'count':_0x2739f1,'rows':_0x5d9baf}:null;}})[_0xde69('0x28')](respondWithResult(_0x5ad556,null))[_0xde69('0x4b')](handleError(_0x5ad556,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 11d5443..98a1a8d 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 _0xf23e=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x17b2ab,_0x43a8dd){var _0x242a20=function(_0x3f0fe1){while(--_0x3f0fe1){_0x17b2ab['push'](_0x17b2ab['shift']());}};_0x242a20(++_0x43a8dd);}(_0xf23e,0xd2));var _0xef23=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xf23e[_0x1a72f3];return _0x57ef47;};'use strict';var EventEmitter=require(_0xef23('0x0'));var ChatGroup=require(_0xef23('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xef23('0x2')](0x0);var events={'afterCreate':_0xef23('0x3'),'afterUpdate':_0xef23('0x4'),'afterDestroy':_0xef23('0x5')};function emitEvent(_0x48a4e6){return function(_0x4a747a,_0x3a8cb1,_0x36c0c5){ChatGroupEvents[_0xef23('0x6')](_0x48a4e6+':'+_0x4a747a['id'],_0x4a747a);ChatGroupEvents[_0xef23('0x6')](_0x48a4e6,_0x4a747a);_0x36c0c5(null);};}for(var e in events){if(events[_0xef23('0x7')](e)){var event=events[e];ChatGroup[_0xef23('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x1122=['exports','events','ChatGroup','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3ec0e8,_0x485a9d){var _0x26fd54=function(_0x4df6a5){while(--_0x4df6a5){_0x3ec0e8['push'](_0x3ec0e8['shift']());}};_0x26fd54(++_0x485a9d);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2112('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x2112('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2112('0x2')](0x0);var events={'afterCreate':_0x2112('0x3'),'afterUpdate':_0x2112('0x4'),'afterDestroy':_0x2112('0x5')};function emitEvent(_0x4f2bbe){return function(_0x5e16d6,_0x20d49a,_0x4c5a48){ChatGroupEvents[_0x2112('0x6')](_0x4f2bbe+':'+_0x5e16d6['id'],_0x5e16d6);ChatGroupEvents[_0x2112('0x6')](_0x4f2bbe,_0x5e16d6);_0x4c5a48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x2112('0x7')](e,emitEvent(event));}}module[_0x2112('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 990f075..a3a9c8d 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 _0xcc95=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment'];(function(_0x59ed8c,_0x497c0f){var _0x2ae760=function(_0x5e0c08){while(--_0x5e0c08){_0x59ed8c['push'](_0x59ed8c['shift']());}};_0x2ae760(++_0x497c0f);}(_0xcc95,0x10d));var _0x5cc9=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xcc95[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require('lodash');var util=require(_0x5cc9('0x0'));var logger=require(_0x5cc9('0x1'))(_0x5cc9('0x2'));var moment=require(_0x5cc9('0x3'));var BPromise=require(_0x5cc9('0x4'));var rp=require(_0x5cc9('0x5'));var fs=require('fs');var path=require(_0x5cc9('0x6'));var rimraf=require(_0x5cc9('0x7'));var config=require(_0x5cc9('0x8'));var attributes=require('./chatGroup.attributes');module[_0x5cc9('0x9')]=function(_0x3a5e73,_0x34068b){return _0x3a5e73[_0x5cc9('0xa')](_0x5cc9('0xb'),attributes,{'tableName':_0x5cc9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f8b=['api','bluebird','path','rimraf','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x1139aa,_0x294e00){var _0x5a7f1e=function(_0x1f335d){while(--_0x1f335d){_0x1139aa['push'](_0x1139aa['shift']());}};_0x5a7f1e(++_0x294e00);}(_0x8f8b,0xc3));var _0xb8f8=function(_0x1f08fe,_0x454d16){_0x1f08fe=_0x1f08fe-0x0;var _0x3f5109=_0x8f8b[_0x1f08fe];return _0x3f5109;};'use strict';var _=require(_0xb8f8('0x0'));var util=require(_0xb8f8('0x1'));var logger=require(_0xb8f8('0x2'))(_0xb8f8('0x3'));var moment=require('moment');var BPromise=require(_0xb8f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8f8('0x5'));var rimraf=require(_0xb8f8('0x6'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xb8f8('0x7')]=function(_0x134794,_0x52d210){return _0x134794[_0xb8f8('0x8')](_0xb8f8('0x9'),attributes,{'tableName':_0xb8f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 1e1f043..f37ffa0 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 _0xaa19=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatGroup.socket','register','then','request\x20sent','debug','stringify','error','message','ChatGroup,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xaa19,0x79));var _0x9aa1=function(_0x2ed115,_0x5877d6){_0x2ed115=_0x2ed115-0x0;var _0x73d26f=_0xaa19[_0x2ed115];return _0x73d26f;};'use strict';var _=require(_0x9aa1('0x0'));var util=require(_0x9aa1('0x1'));var moment=require(_0x9aa1('0x2'));var BPromise=require(_0x9aa1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9aa1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9aa1('0x5'));var logger=require('../../config/logger')(_0x9aa1('0x6'));var config=require(_0x9aa1('0x7'));var jayson=require(_0x9aa1('0x8'));var client=jayson['client'][_0x9aa1('0x9')]({'port':0x232a});config[_0x9aa1('0xa')]=_[_0x9aa1('0xb')](config['redis'],{'host':_0x9aa1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9aa1('0xd'))[_0x9aa1('0xe')](socket);function respondWithRpcPromise(_0x458c96,_0x3cd39b,_0x48448b){return new BPromise(function(_0x5e76cc,_0x1c31c3){return client['request'](_0x458c96,_0x48448b)[_0x9aa1('0xf')](function(_0x4b3352){logger['info']('ChatGroup,\x20%s,\x20%s',_0x3cd39b,_0x9aa1('0x10'));logger[_0x9aa1('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3cd39b,_0x9aa1('0x10'),JSON[_0x9aa1('0x12')](_0x4b3352));if(_0x4b3352[_0x9aa1('0x13')]){if(_0x4b3352['error']['code']===0x1f4){logger[_0x9aa1('0x13')]('ChatGroup,\x20%s,\x20%s',_0x3cd39b,_0x4b3352[_0x9aa1('0x13')]['message']);return _0x1c31c3(_0x4b3352[_0x9aa1('0x13')][_0x9aa1('0x14')]);}logger[_0x9aa1('0x13')](_0x9aa1('0x15'),_0x3cd39b,_0x4b3352['error']['message']);return _0x5e76cc(_0x4b3352[_0x9aa1('0x13')][_0x9aa1('0x14')]);}else{logger[_0x9aa1('0x16')](_0x9aa1('0x15'),_0x3cd39b,_0x9aa1('0x10'));_0x5e76cc(_0x4b3352[_0x9aa1('0x17')][_0x9aa1('0x14')]);}})[_0x9aa1('0x18')](function(_0x356201){logger[_0x9aa1('0x13')](_0x9aa1('0x15'),_0x3cd39b,_0x356201);_0x1c31c3(_0x356201);});});} \ No newline at end of file +var _0xfb92=['client','redis','localhost','socket.io-emitter','register','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb92,0x1e3));var _0x2fb9=function(_0x48ecfb,_0x168d52){_0x48ecfb=_0x48ecfb-0x0;var _0x739783=_0xfb92[_0x48ecfb];return _0x739783;};'use strict';var _=require(_0x2fb9('0x0'));var util=require('util');var moment=require(_0x2fb9('0x1'));var BPromise=require(_0x2fb9('0x2'));var rs=require(_0x2fb9('0x3'));var fs=require('fs');var Redis=require(_0x2fb9('0x4'));var db=require(_0x2fb9('0x5'))['db'];var utils=require(_0x2fb9('0x6'));var logger=require(_0x2fb9('0x7'))(_0x2fb9('0x8'));var config=require(_0x2fb9('0x9'));var jayson=require(_0x2fb9('0xa'));var client=jayson[_0x2fb9('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x2fb9('0xc')],{'host':_0x2fb9('0xd'),'port':0x18eb});var socket=require(_0x2fb9('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x2fb9('0xf')](socket);function respondWithRpcPromise(_0x1773f9,_0x2eb82c,_0x32b8e4){return new BPromise(function(_0x48b755,_0x1df062){return client['request'](_0x1773f9,_0x32b8e4)['then'](function(_0x497f2e){logger[_0x2fb9('0x10')](_0x2fb9('0x11'),_0x2eb82c,_0x2fb9('0x12'));logger[_0x2fb9('0x13')](_0x2fb9('0x14'),_0x2eb82c,_0x2fb9('0x12'),JSON[_0x2fb9('0x15')](_0x497f2e));if(_0x497f2e[_0x2fb9('0x16')]){if(_0x497f2e[_0x2fb9('0x16')]['code']===0x1f4){logger[_0x2fb9('0x16')](_0x2fb9('0x11'),_0x2eb82c,_0x497f2e[_0x2fb9('0x16')]['message']);return _0x1df062(_0x497f2e[_0x2fb9('0x16')]['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x2eb82c,_0x497f2e[_0x2fb9('0x16')]['message']);return _0x48b755(_0x497f2e['error']['message']);}else{logger[_0x2fb9('0x10')](_0x2fb9('0x11'),_0x2eb82c,_0x2fb9('0x12'));_0x48b755(_0x497f2e[_0x2fb9('0x17')][_0x2fb9('0x18')]);}})[_0x2fb9('0x19')](function(_0x12caa9){logger[_0x2fb9('0x16')](_0x2fb9('0x11'),_0x2eb82c,_0x12caa9);_0x1df062(_0x12caa9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index cd357b1..ee81dca 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 _0x2422=['chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x2422,0x18d));var _0x2242=function(_0x3b2044,_0x10a5a6){_0x3b2044=_0x3b2044-0x0;var _0x484ab8=_0x2422[_0x3b2044];return _0x484ab8;};'use strict';var ChatGroupEvents=require(_0x2242('0x0'));var events=[_0x2242('0x1'),_0x2242('0x2'),_0x2242('0x3')];function createListener(_0x18e70b,_0x4108e5){return function(_0x232623){_0x4108e5[_0x2242('0x4')](_0x18e70b,_0x232623);};}function removeListener(_0x2e29be,_0x1362d5){return function(){ChatGroupEvents['removeListener'](_0x2e29be,_0x1362d5);};}exports['register']=function(_0x23779f){for(var _0x3ac895=0x0,_0x452000=events['length'];_0x3ac895<_0x452000;_0x3ac895++){var _0xef89e6=events[_0x3ac895];var _0x4954d6=createListener(_0x2242('0x5')+_0xef89e6,_0x23779f);ChatGroupEvents['on'](_0xef89e6,_0x4954d6);}}; \ No newline at end of file +var _0xc27f=['update','emit','removeListener','register','length','./chatGroup.events','save'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0xc27f,0x139));var _0xfc27=function(_0x5ac358,_0x57d0d0){_0x5ac358=_0x5ac358-0x0;var _0xfe9b30=_0xc27f[_0x5ac358];return _0xfe9b30;};'use strict';var ChatGroupEvents=require(_0xfc27('0x0'));var events=[_0xfc27('0x1'),'remove',_0xfc27('0x2')];function createListener(_0x432535,_0x381675){return function(_0xde1ea7){_0x381675[_0xfc27('0x3')](_0x432535,_0xde1ea7);};}function removeListener(_0x431166,_0x5e2c61){return function(){ChatGroupEvents[_0xfc27('0x4')](_0x431166,_0x5e2c61);};}exports[_0xfc27('0x5')]=function(_0x25110c){for(var _0x39d360=0x0,_0x4fd019=events[_0xfc27('0x6')];_0x39d360<_0x4fd019;_0x39d360++){var _0x581037=events[_0x39d360];var _0x4b256c=createListener('chatGroup:'+_0x581037,_0x25110c);ChatGroupEvents['on'](_0x581037,_0x4b256c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 122e7dc..18f3308 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 _0x08eb=['get','isAuthenticated','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','destroy','delete','removeMembers','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatGroup.controller'];(function(_0x11f541,_0x287622){var _0xc9be7d=function(_0x4a54b9){while(--_0x4a54b9){_0x11f541['push'](_0x11f541['shift']());}};_0xc9be7d(++_0x287622);}(_0x08eb,0x8f));var _0xb08e=function(_0x2f0224,_0x1ee67d){_0x2f0224=_0x2f0224-0x0;var _0x1ec93d=_0x08eb[_0x2f0224];return _0x1ec93d;};'use strict';var multer=require(_0xb08e('0x0'));var util=require(_0xb08e('0x1'));var path=require(_0xb08e('0x2'));var timeout=require(_0xb08e('0x3'));var express=require('express');var router=express[_0xb08e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb08e('0x5'));var config=require('../../config/environment');var controller=require(_0xb08e('0x6'));router[_0xb08e('0x7')]('/',auth[_0xb08e('0x8')](),controller['index']);router[_0xb08e('0x7')]('/describe',auth[_0xb08e('0x8')](),controller[_0xb08e('0x9')]);router[_0xb08e('0x7')](_0xb08e('0xa'),auth[_0xb08e('0x8')](),controller[_0xb08e('0xb')]);router['get']('/:id/unread',auth[_0xb08e('0x8')](),controller[_0xb08e('0xc')]);router[_0xb08e('0x7')](_0xb08e('0xd'),auth[_0xb08e('0x8')](),controller[_0xb08e('0xe')]);router[_0xb08e('0x7')](_0xb08e('0xf'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x10')]);router[_0xb08e('0x11')]('/',auth['isAuthenticated'](),controller[_0xb08e('0x12')]);router[_0xb08e('0x11')](_0xb08e('0xd'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x13')]);router[_0xb08e('0x11')](_0xb08e('0xf'),auth[_0xb08e('0x8')](),controller['addMessage']);router[_0xb08e('0x14')](_0xb08e('0xa'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x15')]);router['delete'](_0xb08e('0xa'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x16')]);router[_0xb08e('0x17')](_0xb08e('0xd'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xb63b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/unread','getUnread','getMembers','getMessages','post','create','/:id/members','addMembers','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3b6073,_0x2f2090){var _0x2abd9c=function(_0x58a0dc){while(--_0x58a0dc){_0x3b6073['push'](_0x3b6073['shift']());}};_0x2abd9c(++_0x2f2090);}(_0xb63b,0x185));var _0xbb63=function(_0x3ce208,_0x1f8230){_0x3ce208=_0x3ce208-0x0;var _0x45c5fb=_0xb63b[_0x3ce208];return _0x45c5fb;};'use strict';var multer=require(_0xbb63('0x0'));var util=require(_0xbb63('0x1'));var path=require(_0xbb63('0x2'));var timeout=require(_0xbb63('0x3'));var express=require(_0xbb63('0x4'));var router=express[_0xbb63('0x5')]();var fs_extra=require(_0xbb63('0x6'));var auth=require(_0xbb63('0x7'));var interaction=require(_0xbb63('0x8'));var config=require(_0xbb63('0x9'));var controller=require(_0xbb63('0xa'));router['get']('/',auth[_0xbb63('0xb')](),controller['index']);router['get'](_0xbb63('0xc'),auth['isAuthenticated'](),controller[_0xbb63('0xd')]);router[_0xbb63('0xe')](_0xbb63('0xf'),auth[_0xbb63('0xb')](),controller[_0xbb63('0x10')]);router['get'](_0xbb63('0x11'),auth[_0xbb63('0xb')](),controller[_0xbb63('0x12')]);router['get']('/:id/members',auth[_0xbb63('0xb')](),controller[_0xbb63('0x13')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xbb63('0x14')]);router[_0xbb63('0x15')]('/',auth['isAuthenticated'](),controller[_0xbb63('0x16')]);router[_0xbb63('0x15')](_0xbb63('0x17'),auth['isAuthenticated'](),controller[_0xbb63('0x18')]);router['post'](_0xbb63('0x19'),auth[_0xbb63('0xb')](),controller[_0xbb63('0x1a')]);router[_0xbb63('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xbb63('0x1c')]);router[_0xbb63('0x1d')]('/:id',auth[_0xbb63('0xb')](),controller[_0xbb63('0x1e')]);router[_0xbb63('0x1d')](_0xbb63('0x17'),auth[_0xbb63('0xb')](),controller[_0xbb63('0x1f')]);module[_0xbb63('0x20')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c5e59e1..9790839 100644 --- a/server/api/chatInteraction/chatInteraction.attributes.js +++ b/server/api/chatInteraction/chatInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc87=['sequelize','INTEGER','ENUM','star','TEXT','STRING','DATE','long','out'];(function(_0x20574e,_0x39ddd2){var _0x4b06f1=function(_0x3a348b){while(--_0x3a348b){_0x20574e['push'](_0x20574e['shift']());}};_0x4b06f1(++_0x39ddd2);}(_0xbc87,0x144));var _0x7bc8=function(_0x3db622,_0x32953f){_0x3db622=_0x3db622-0x0;var _0xf6f42d=_0xbc87[_0x3db622];return _0xf6f42d;};'use strict';var Sequelize=require(_0x7bc8('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7bc8('0x1')]},'ratingType':{'type':Sequelize[_0x7bc8('0x2')](_0x7bc8('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x7bc8('0x4')]},'pathTranscript':{'type':Sequelize[_0x7bc8('0x4')]},'mailTranscript':{'type':Sequelize[_0x7bc8('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7bc8('0x6')]},'disposition':{'type':Sequelize[_0x7bc8('0x5')]},'secondDisposition':{'type':Sequelize[_0x7bc8('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7bc8('0x5')]},'note':{'type':Sequelize[_0x7bc8('0x5')]},'browserName':{'type':Sequelize[_0x7bc8('0x5')]},'browserVersion':{'type':Sequelize[_0x7bc8('0x5')]},'osName':{'type':Sequelize[_0x7bc8('0x5')]},'osVersion':{'type':Sequelize[_0x7bc8('0x5')]},'deviceModel':{'type':Sequelize[_0x7bc8('0x5')]},'deviceVendor':{'type':Sequelize[_0x7bc8('0x5')]},'deviceType':{'type':Sequelize[_0x7bc8('0x5')]},'referer':{'type':Sequelize[_0x7bc8('0x4')]},'customerIp':{'type':Sequelize[_0x7bc8('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x7bc8('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x7bc8('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x7bc8('0x2')]('in',_0x7bc8('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7bc8('0x5')]},'customerPort':{'type':Sequelize[_0x7bc8('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x7bc8('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9563=['thumb','TEXT','DATE','STRING','long','out','BOOLEAN','sequelize','exports','INTEGER','ENUM','star'];(function(_0x5191ee,_0x73bcd0){var _0x4e4602=function(_0x48d546){while(--_0x48d546){_0x5191ee['push'](_0x5191ee['shift']());}};_0x4e4602(++_0x73bcd0);}(_0x9563,0x1e7));var _0x3956=function(_0x374d03,_0x312da9){_0x374d03=_0x374d03-0x0;var _0x245af2=_0x9563[_0x374d03];return _0x245af2;};'use strict';var Sequelize=require(_0x3956('0x0'));module[_0x3956('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3956('0x2')]},'ratingType':{'type':Sequelize[_0x3956('0x3')](_0x3956('0x4'),_0x3956('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x3956('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3956('0x7')]},'disposition':{'type':Sequelize[_0x3956('0x8')]},'secondDisposition':{'type':Sequelize[_0x3956('0x8')]},'thirdDisposition':{'type':Sequelize[_0x3956('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x3956('0x8')]},'browserVersion':{'type':Sequelize[_0x3956('0x8')]},'osName':{'type':Sequelize[_0x3956('0x8')]},'osVersion':{'type':Sequelize[_0x3956('0x8')]},'deviceModel':{'type':Sequelize[_0x3956('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x3956('0x6')]},'customerIp':{'type':Sequelize[_0x3956('0x8')]},'formData':{'type':Sequelize[_0x3956('0x6')](_0x3956('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x3956('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x3956('0x3')]('in',_0x3956('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3956('0x8')]},'customerPort':{'type':Sequelize[_0x3956('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x3956('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x3956('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c0662d2..6ff742d 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 _0x087b=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','render','body','contact','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','index','ChatInteraction','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','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','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','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','include','options','catch','create','describe','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','disposition','file','filename','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','nolimit','filter','findAll','rows','getMyMessages','includeAll','addTags','setTags','chatInteractionTags:save','removeTags','unix','files','server','attachments','transcript-%d-%s.zip','firstName','Account','Owner','YYYY-MM-DD\x20HH:mm:ss','referer','customerIp','customerPort','N.A.','tail','existsSync','pipe','createWriteStream','out','lastName','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register'];(function(_0x4feb9c,_0x19a66b){var _0x341ce3=function(_0x32aba6){while(--_0x32aba6){_0x4feb9c['push'](_0x4feb9c['shift']());}};_0x341ce3(++_0x19a66b);}(_0x087b,0x11a));var _0xb087=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x087b[_0x4ed520];return _0x4415a6;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var pdf=require(_0xb087('0x15'));var hardwareService=require(_0xb087('0x16'));var logger=require(_0xb087('0x17'))(_0xb087('0x18'));var utils=require(_0xb087('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb087('0x1a'));var db=require(_0xb087('0x1b'))['db'];config[_0xb087('0x1c')]=_['defaults'](config[_0xb087('0x1c')],{'host':_0xb087('0x1d'),'port':0x18eb});var socket=require(_0xb087('0x1e'))(new Redis(config[_0xb087('0x1c')]));require(_0xb087('0x1f'))[_0xb087('0x20')](socket);var jayson=require(_0xb087('0x21'));var client=jayson[_0xb087('0x22')][_0xb087('0x23')]({'port':0x232b});var client9004=jayson[_0xb087('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x43e576,_0x412b48,_0x597478,_0xcc4426){return new BPromise(function(_0x2b83b7,_0x2e9e74){var _0x5bb80b=_0xcc4426||client;return _0x5bb80b[_0xb087('0x24')](_0x43e576,_0x597478)[_0xb087('0x25')](function(_0x17200d){logger[_0xb087('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0xb087('0x27'));logger[_0xb087('0x28')](_0xb087('0x29'),_0x412b48,_0xb087('0x27'),JSON['stringify'](_0x17200d));if(_0x17200d['error']){if(_0x17200d['error']['code']===0x1f4){logger[_0xb087('0x2a')](_0xb087('0x2b'),_0x412b48,_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);return _0x2e9e74(_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);}logger[_0xb087('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);return _0x2b83b7(_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);}else{logger[_0xb087('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0xb087('0x27'));_0x2b83b7(_0x17200d[_0xb087('0x2d')]['message']);}})['catch'](function(_0x50745a){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0x50745a);_0x2e9e74(_0x50745a);});});}function respondWithStatusCode(_0x304840,_0x45685d){_0x45685d=_0x45685d||0xcc;return function(_0x1d124f){if(_0x1d124f){return _0x304840[_0xb087('0x2e')](_0x45685d);}return _0x304840[_0xb087('0x2f')](_0x45685d)[_0xb087('0x30')]();};}function respondWithResult(_0xf3f41f,_0x35a52c){_0x35a52c=_0x35a52c||0xc8;return function(_0x6cfb22){if(_0x6cfb22){return _0xf3f41f[_0xb087('0x2f')](_0x35a52c)[_0xb087('0x31')](_0x6cfb22);}};}function respondWithFilteredResult(_0x31e3e6,_0xb0baf6){return function(_0x263259){if(_0x263259){var _0x593b78=typeof _0xb0baf6[_0xb087('0x32')]===_0xb087('0x33')&&typeof _0xb0baf6[_0xb087('0x34')]===_0xb087('0x33');var _0x22d441=_0x263259[_0xb087('0x35')];var _0x2e1c57=_0x593b78?0x0:_0xb0baf6[_0xb087('0x32')];var _0x53a535=_0x593b78?_0x263259['count']:_0xb0baf6[_0xb087('0x32')]+_0xb0baf6[_0xb087('0x34')];var _0x4cb5a8;if(_0x53a535>=_0x22d441){_0x53a535=_0x22d441;_0x4cb5a8=0xc8;}else{_0x4cb5a8=0xce;}_0x31e3e6[_0xb087('0x2f')](_0x4cb5a8);return _0x31e3e6[_0xb087('0x36')](_0xb087('0x37'),_0x2e1c57+'-'+_0x53a535+'/'+_0x22d441)[_0xb087('0x31')](_0x263259);}return null;};}function patchUpdates(_0x3c61c4){return function(_0x427905){try{jsonpatch[_0xb087('0x38')](_0x427905,_0x3c61c4,!![]);}catch(_0x3b7ace){return BPromise[_0xb087('0x39')](_0x3b7ace);}return _0x427905[_0xb087('0x3a')]();};}function saveUpdates(_0x442a5e,_0x3069b5){return function(_0x57ae94){if(_0x57ae94){return _0x57ae94[_0xb087('0x3b')](_0x442a5e)['then'](function(_0x906987){return _0x906987;});}return null;};}function removeEntity(_0x296e9b,_0x738e68){return function(_0xd0659e){if(_0xd0659e){return _0xd0659e[_0xb087('0x3c')]()[_0xb087('0x25')](function(){_0x296e9b[_0xb087('0x2f')](0xcc)[_0xb087('0x30')]();});}};}function handleEntityNotFound(_0x8a4c3c,_0x521c3f){return function(_0x5814c2){if(!_0x5814c2){_0x8a4c3c[_0xb087('0x2e')](0x194);}return _0x5814c2;};}function handleError(_0x3c4f33,_0x1ce1ef){_0x1ce1ef=_0x1ce1ef||0x1f4;return function(_0x2d2902){logger[_0xb087('0x2a')](_0x2d2902['stack']);if(_0x2d2902[_0xb087('0x3d')]){delete _0x2d2902[_0xb087('0x3d')];}_0x3c4f33['status'](_0x1ce1ef)['send'](_0x2d2902);};}function getMustacheRender(_0x1726c2,_0x1c7d90){return Mustache[_0xb087('0x3e')](_0x1726c2,_['merge'](_0x1c7d90[_0xb087('0x3f')],{'contact':_0x1c7d90[_0xb087('0x40')],'message':_0x1c7d90[_0xb087('0x2c')],'agent':_0x1c7d90[_0xb087('0x41')],'interaction':_0x1c7d90[_0xb087('0x42')],'account':_0x1c7d90['account']}))||'';}function getInteractionUsers(_0x7e1315,_0x5bb6bc){return new BPromise(function(_0x18e23f,_0x5a582d){try{if(_0x5bb6bc[_0x7e1315['id']]){_0x7e1315[_0xb087('0x43')]=_[_0xb087('0x44')](_0x5bb6bc[_0x7e1315['id']],function(_0x513332){return{'id':_0x513332['id'],'fullname':_0x513332[_0xb087('0x45')]};});}}catch(_0x5aa11d){_0x5a582d(_0x5aa11d);}_0x18e23f(_0x7e1315);});}function getInteractionTags(_0x46d12a,_0x4a360c){return new BPromise(function(_0x2d2c74,_0x326934){try{if(_0x46d12a[_0xb087('0x46')]){_0x46d12a[_0xb087('0x47')]=[];_0x46d12a[_0xb087('0x46')][_0xb087('0x48')](',')[_0xb087('0x49')](function(_0x5e7690){_0x46d12a[_0xb087('0x47')]['push'](_0x4a360c[_0x5e7690]);});}delete _0x46d12a[_0xb087('0x46')];}catch(_0x2d71c2){_0x326934(_0x2d71c2);}_0x2d2c74(_0x46d12a);});}function updateChatInteraction(_0x5b6924,_0xb662bf,_0x45dc6f){return new BPromise(function(_0x7650c5,_0x4c33cc){return getInteractionUsers(_0x5b6924,_0x45dc6f)[_0xb087('0x25')](function(_0x4a9ccb){return getInteractionTags(_0x4a9ccb,_0xb662bf);})[_0xb087('0x25')](function(_0x32b9d3){_0x7650c5(_0x32b9d3);})['catch'](function(_0x38cb9d){_0x4c33cc(_0x38cb9d);});});}exports[_0xb087('0x4a')]=function(_0x4addbd,_0x2b969a){var _0x171778={},_0x54eb11={},_0x93ada7={'count':0x0,'rows':[]};var _0x46c713=_[_0xb087('0x44')](db[_0xb087('0x4b')]['rawAttributes'],function(_0x47902e){return{'name':_0x47902e[_0xb087('0x4c')],'type':_0x47902e[_0xb087('0x4d')][_0xb087('0x4e')]};});_0x54eb11[_0xb087('0x4f')]=_[_0xb087('0x44')](_0x46c713,_0xb087('0x3d'));_0x54eb11['query']=_['keys'](_0x4addbd[_0xb087('0x50')]);_0x54eb11['filters']=_[_0xb087('0x51')](_0x54eb11[_0xb087('0x4f')],_0x54eb11[_0xb087('0x50')]);_0x171778[_0xb087('0x52')]=_['intersection'](_0x54eb11[_0xb087('0x4f')],qs['fields'](_0x4addbd[_0xb087('0x50')][_0xb087('0x53')]));_0x171778[_0xb087('0x52')]=_0x171778[_0xb087('0x52')][_0xb087('0x54')]?_0x171778['attributes']:_0x54eb11[_0xb087('0x4f')];if(!_0x4addbd[_0xb087('0x50')][_0xb087('0x55')]('nolimit')){_0x171778[_0xb087('0x34')]=qs['limit'](_0x4addbd['query'][_0xb087('0x34')]);_0x171778[_0xb087('0x32')]=qs['offset'](_0x4addbd[_0xb087('0x50')][_0xb087('0x32')]);}_0x171778[_0xb087('0x56')]=qs['sort'](_0x4addbd['query'][_0xb087('0x57')]);_0x171778['where']=qs['filters'](_[_0xb087('0x58')](_0x4addbd[_0xb087('0x50')],_0x54eb11[_0xb087('0x59')]),_0x46c713);var _0x4067cf=[];var _0x2bf92f=squel[_0xb087('0x5a')]()[_0xb087('0x5b')]('id')[_0xb087('0x5b')](_0xb087('0x3d'))[_0xb087('0x5b')](_0xb087('0x5c'))[_0xb087('0x5d')]('tools_tags');var _0x46d570=squel[_0xb087('0x5a')]()['field'](_0xb087('0x5e'))[_0xb087('0x5b')](_0xb087('0x5f'))[_0xb087('0x5b')](_0xb087('0x60'))[_0xb087('0x5d')](_0xb087('0x61'),'ui')[_0xb087('0x62')](_0xb087('0x63'),'u',_0xb087('0x64'));var _0x17c6d0=squel['select']()[_0xb087('0x5d')]('chat_interactions','i')[_0xb087('0x62')]('cm_contacts','c',_0xb087('0x65'))[_0xb087('0x62')](_0xb087('0x63'),'o',_0xb087('0x66'))[_0xb087('0x62')](_0xb087('0x67'),'a',_0xb087('0x68'))[_0xb087('0x62')](_0xb087('0x69'),'me',_0xb087('0x6a'))[_0xb087('0x62')](_0xb087('0x6b'),'it',_0xb087('0x6c'))[_0xb087('0x62')](_0xb087('0x6d'),'t',_0xb087('0x6e'));var _0x217f26=squel[_0xb087('0x6f')]();var _0x40ff74=[];var _0xe3cb2=squel[_0xb087('0x6f')]();var _0x459c5b;if(_0x4addbd['query'][_0xb087('0x70')]){_0x459c5b=as[_0xb087('0x71')](_0x4addbd[_0xb087('0x50')]['search']);var _0x4099cc=_0x459c5b[_0xb087('0x72')];for(var _0x5685b1=0x0;_0x5685b1<_0x459c5b[_0xb087('0x73')][_0xb087('0x54')];_0x5685b1++){var _0x2e3a14=_0x459c5b['conditions'][_0x5685b1];var _0x133c58='i';var _0x257894=_[_0xb087('0x74')](_0x46c713,[_0xb087('0x3d'),_0x2e3a14[_0xb087('0x5b')]]);if(!_0x257894){switch(_0x2e3a14[_0xb087('0x5b')]){case _0xb087('0x75'):if(_0x2e3a14[_0xb087('0x76')]==0x1){_0x17c6d0['having']('`'+_0x2e3a14[_0xb087('0x5b')]+_0xb087('0x77'));}else{_0x17c6d0[_0xb087('0x78')]('`'+_0x2e3a14['field']+_0xb087('0x79'));}break;case'Contact':if(_0x2e3a14['operator']===_0xb087('0x7a')){if(_0x2e3a14[_0xb087('0x76')]['split']('\x20')[_0xb087('0x54')]>0x1){_0x217f26[_0x4099cc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb087('0x7b')](_0x2e3a14[_0xb087('0x76')]),null);}else{var _0x5938ad='%'+_0x2e3a14['value']+'%';_0x217f26[_0x4099cc](_0xb087('0x7c'),_0x5938ad,_0x5938ad,_0x5938ad);}}else{_0x257894=_['find'](_0x46c713,['name',_0xb087('0x7d')]);_0x2e3a14['field']=_0xb087('0x7d');_0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309[_0xb087('0x76')][_0xb087('0x30')]);}break;case'Tag':var _0x200869=_0x2e3a14['value'][_0xb087('0x48')](',')[_0xb087('0x44')](function(_0x1060e1){return Number(_0x1060e1);});_0x200869['forEach'](function(_0x298bbb){_0xe3cb2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x298bbb+',%');});_0x40ff74=_[_0xb087('0x80')](_0x40ff74,_0x200869);break;case _0xb087('0x81'):if(_0x2e3a14[_0xb087('0x82')]===_0xb087('0x7a')){_0x217f26[_0x4099cc](_0xb087('0x83'),'%'+_0x2e3a14[_0xb087('0x76')]+'%',null);}else{_0x257894=_['find'](_0x46c713,[_0xb087('0x3d'),_0xb087('0x84')]);_0x2e3a14['field']=_0xb087('0x84');_0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309[_0xb087('0x76')][_0xb087('0x30')]);}break;case _0xb087('0x3f'):_0x390309=as[_0xb087('0x85')]('me',null,_0x2e3a14);_0x217f26[_0x4099cc](_0x390309['text'],_0x390309['value']['start'],_0x390309[_0xb087('0x76')]['end']);break;}}else{var _0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309['value'][_0xb087('0x30')]);}}}else{var _0x53f04a=_(_0x4addbd[_0xb087('0x50')])[_0xb087('0x86')]()[_0xb087('0x44')](function(_0x42f4a3){return _['some'](_0x46c713,['name',_0x42f4a3])?_0x42f4a3:undefined;})[_0xb087('0x87')]()['value']();if(!_[_0xb087('0x88')](_0x53f04a)){_0x53f04a[_0xb087('0x49')](function(_0x2ca987){if(_0x2ca987===_0xb087('0x89')){_0x17c6d0['where']('i.ChatWebsiteId\x20IN\x20?',[][_0xb087('0x8a')](_0x4addbd['query'][_0x2ca987]));}else if(_0x2ca987===_0xb087('0x8b')){var _0x1c7cd7=JSON[_0xb087('0x8c')](_0x4addbd[_0xb087('0x50')][_0x2ca987])[_0xb087('0x8d')];var _0x581ad4=JSON[_0xb087('0x8c')](_0x4addbd[_0xb087('0x50')][_0x2ca987])['$lte'];_0x17c6d0['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1c7cd7,_0x581ad4);}else{if(_0x4addbd[_0xb087('0x50')][_0x2ca987]===_0xb087('0x8e')){_0x17c6d0[_0xb087('0x8f')]('i.'+_0x2ca987+_0xb087('0x90'));}else{_0x17c6d0[_0xb087('0x8f')]('i.'+_0x2ca987+_0xb087('0x91'),_0x4addbd['query'][_0x2ca987]);}}});}if(_0x4addbd[_0xb087('0x50')][_0xb087('0x92')]){if(_0x4addbd[_0xb087('0x50')][_0xb087('0x92')]==0x1){_0x17c6d0[_0xb087('0x78')](_0xb087('0x93'));}else{_0x17c6d0[_0xb087('0x78')]('`unreadMessages`\x20>\x200');}}if(_0x4addbd[_0xb087('0x50')][_0xb087('0x94')]){_0x40ff74=_[_0xb087('0x95')](_0x4addbd['query'][_0xb087('0x94')])?_0x4addbd['query'][_0xb087('0x94')]:new Array(_0x4addbd[_0xb087('0x50')][_0xb087('0x94')]);_0x40ff74[_0xb087('0x49')](function(_0x463791){_0xe3cb2['or'](_0xb087('0x96'),'%,'+_0x463791+',%');});}if(_0x4addbd['query']['filter']){var _0x1e7a22=_0x4addbd[_0xb087('0x50')]['filter'][_0xb087('0x97')]('\x5c','\x5c\x5c')[_0xb087('0x97')](/'/g,'\x27\x27');if(qs[_0xb087('0x98')](_0x1e7a22)){_0x217f26['or'](_0xb087('0x99'),_0x1e7a22+'%');}else{_0x217f26['or'](_0xb087('0x9a'),qs[_0xb087('0x7b')](_0x1e7a22))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1e7a22+'%');}}}_0x17c6d0[_0xb087('0x8f')](_0x217f26);_0x17c6d0[_0xb087('0x9b')](_0xb087('0x9c'));var _0x3114ce={'type':db[_0xb087('0x9d')][_0xb087('0x9e')][_0xb087('0x9f')],'raw':!![]};var _0x1fc613=_0x17c6d0[_0xb087('0xa0')]();_0x1fc613['field'](_0xb087('0x9c'));_0x1fc613['field'](_0xb087('0xa1'),_0xb087('0x75'));if(_0x171778['order']){_0x171778[_0xb087('0x56')][_0xb087('0x49')](function(_0x8b1a5b){var _0x2a076b=_0x8b1a5b[0x0]===_0xb087('0xa2')?_0x8b1a5b[0x0]:'i.'+_0x8b1a5b[0x0];_0x17c6d0[_0xb087('0x56')](_0x2a076b,_0x8b1a5b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb087('0x88')](_0x40ff74)){_0x17c6d0[_0xb087('0x78')](_0xe3cb2);_0x1fc613[_0xb087('0x8f')](_0xb087('0xa3'),_0x40ff74);}BPromise[_0xb087('0xa4')]()['then'](function(){if(!_0x459c5b){if(_0x4addbd[_0xb087('0x50')][_0xb087('0x89')])return;_0x1fc613[_0xb087('0x8f')](_0xb087('0xa5'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xa5'));return;}if(_0x4addbd[_0xb087('0xa6')][_0xb087('0xa7')]!==_0xb087('0x41'))return;return _0x4addbd[_0xb087('0xa6')][_0xb087('0xa8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59121a){if(_[_0xb087('0x88')](_0x59121a)){_0x1fc613[_0xb087('0x8f')](_0xb087('0xa9'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xa9'));}else{_0x1fc613['where'](_0xb087('0xaa'),_[_0xb087('0x44')](_0x59121a,'id'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xaa'),_[_0xb087('0x44')](_0x59121a,'id'));}});})[_0xb087('0x25')](function(){if(_0x4addbd['user'][_0xb087('0xa7')]==='agent'&&!_0x459c5b&&!_0x4addbd['query'][_0xb087('0x89')])return[];return db[_0xb087('0xab')][_0xb087('0x50')](_0x1fc613[_0xb087('0xac')](),_0x3114ce);})['then'](function(_0x313c9b){_0x93ada7[_0xb087('0x35')]=_0x313c9b['length'];if(_0x93ada7[_0xb087('0x35')]===0x0)return[];return db['sequelize']['query'](_0x2bf92f[_0xb087('0xac')](),_0x3114ce)[_0xb087('0x25')](function(_0x414cb4){_0x4067cf=_[_0xb087('0xad')](_0x414cb4,'id');_0x3114ce=_[_0xb087('0xae')](_0x3114ce,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4addbd[_0xb087('0x50')][_0xb087('0x53')]){_0x171778[_0xb087('0x52')][_0xb087('0x49')](function(_0x48e2c6){_0x17c6d0['field']('i.'+_0x48e2c6);});}else{_0x17c6d0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb087('0x75'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xaf'),_0xb087('0xb0'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb1'),_0xb087('0xb2'));_0x17c6d0['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb087('0xa2'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb3'));_0x17c6d0[_0xb087('0x5b')]('c.firstName',_0xb087('0xb4'));_0x17c6d0['field'](_0xb087('0xb5'),'Contact.lastName');_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb6'),_0xb087('0xb7'));_0x17c6d0[_0xb087('0x5b')]('c.phone',_0xb087('0xb8'));_0x17c6d0['field']('c.mobile','Contact.mobile');_0x17c6d0[_0xb087('0x5b')]('c.fax',_0xb087('0xb9'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xba'),_0xb087('0xbb'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xbc'),_0xb087('0xbd'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xbe'),_0xb087('0x46'));}if(_0x171778[_0xb087('0x34')])_0x17c6d0[_0xb087('0x34')](_0x171778[_0xb087('0x34')]);if(_0x171778[_0xb087('0x32')])_0x17c6d0[_0xb087('0x32')](_0x171778[_0xb087('0x32')]);return db[_0xb087('0xab')][_0xb087('0x50')](_0x17c6d0['toString'](),_0x3114ce);})[_0xb087('0x25')](function(_0x5c2a14){if(_0x5c2a14[_0xb087('0x54')]>0x0)_0x46d570[_0xb087('0x8f')](_0xb087('0xbf'),_[_0xb087('0x44')](_0x5c2a14,'id'));return db[_0xb087('0xab')][_0xb087('0x50')](_0x46d570[_0xb087('0xac')](),_0x3114ce)['then'](function(_0x5103ab){var _0x5194f2=_[_0xb087('0xc0')](_0x5103ab,_0xb087('0xc1'));var _0x3a403f=[];_0x5c2a14[_0xb087('0x49')](function(_0x18b90b){_0x3a403f[_0xb087('0xc2')](updateChatInteraction(_0x18b90b,_0x4067cf,_0x5194f2));});return BPromise[_0xb087('0xc3')](_0x3a403f);});});})[_0xb087('0x25')](function(_0x181c56){_0x93ada7['rows']=_0x181c56;return _0x93ada7;})[_0xb087('0x25')](respondWithFilteredResult(_0x2b969a,_0x171778))['catch'](handleError(_0x2b969a,null));};exports[_0xb087('0xc4')]=function(_0x25910a,_0x597d80){var _0x4c3aef={'raw':![],'where':{'id':_0x25910a[_0xb087('0xc5')]['id']}},_0x2f2597={};_0x2f2597[_0xb087('0x4f')]=_[_0xb087('0x86')](db['ChatInteraction'][_0xb087('0xc6')]);_0x2f2597[_0xb087('0x50')]=_['keys'](_0x25910a['query']);_0x2f2597[_0xb087('0x59')]=_['intersection'](_0x2f2597['model'],_0x2f2597[_0xb087('0x50')]);_0x4c3aef['attributes']=_[_0xb087('0x51')](_0x2f2597[_0xb087('0x4f')],qs[_0xb087('0x53')](_0x25910a[_0xb087('0x50')][_0xb087('0x53')]));_0x4c3aef[_0xb087('0x52')]=_0x4c3aef[_0xb087('0x52')][_0xb087('0x54')]?_0x4c3aef['attributes']:_0x2f2597[_0xb087('0x4f')];if(_0x25910a['query']['includeAll']){_0x4c3aef[_0xb087('0xc7')]=[{'all':!![]}];}_0x4c3aef=_[_0xb087('0xae')]({},_0x4c3aef,_0x25910a[_0xb087('0xc8')]);return db['ChatInteraction'][_0xb087('0x74')](_0x4c3aef)[_0xb087('0x25')](handleEntityNotFound(_0x597d80,null))[_0xb087('0x25')](respondWithResult(_0x597d80,null))[_0xb087('0xc9')](handleError(_0x597d80,null));};exports['create']=function(_0x1f3ecb,_0x3e865d){return db[_0xb087('0x4b')][_0xb087('0xca')](_0x1f3ecb[_0xb087('0x3f')],{})[_0xb087('0x25')](respondWithResult(_0x3e865d,0xc9))[_0xb087('0xc9')](handleError(_0x3e865d,null));};exports['update']=function(_0x1de68b,_0xfc3490){if(_0x1de68b[_0xb087('0x3f')]['id']){delete _0x1de68b[_0xb087('0x3f')]['id'];}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x1de68b['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xfc3490,null))[_0xb087('0x25')](saveUpdates(_0x1de68b[_0xb087('0x3f')],null))['then'](respondWithResult(_0xfc3490,null))['catch'](handleError(_0xfc3490,null));};exports[_0xb087('0x3c')]=function(_0x12c676,_0xee09f5){return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x12c676[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xee09f5,null))[_0xb087('0x25')](removeEntity(_0xee09f5,null))[_0xb087('0xc9')](handleError(_0xee09f5,null));};exports[_0xb087('0xcb')]=function(_0x5ef263,_0x1a7486){return db[_0xb087('0x4b')][_0xb087('0xcb')]()[_0xb087('0x25')](respondWithResult(_0x1a7486,null))[_0xb087('0xc9')](handleError(_0x1a7486,null));};exports['createVidaooSession']=function(_0x33756c,_0x2e8eb1){var _0x189e0a=_0x33756c[_0xb087('0xc5')]['id'];var _0x52268a;var _0x259ac0;var _0x547968;return db[_0xb087('0x4b')]['findOne']({'where':{'id':_0x189e0a}})['then'](function(_0x321da9){_0x52268a=_0x321da9;return db[_0xb087('0xcc')][_0xb087('0xcd')]({'where':{'id':_0x321da9['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xb087('0xce'),_0xb087('0xcf'),_0xb087('0xd0'),_0xb087('0xd1')],'raw':!![]});})[_0xb087('0x25')](function(_0x48a94f){if(_0x48a94f&&_0x48a94f[_0xb087('0xd2')]&&_0x48a94f[_0xb087('0xce')]){_0x259ac0=_0x48a94f;var _0x290338={'interaction':{'id':_0x189e0a},'agent':{'id':_0x33756c[_0xb087('0xa6')]['id'],'name':_0x33756c[_0xb087('0xa6')][_0xb087('0x3d')],'fullname':_0x33756c['user']['fullname'],'email':_0x33756c[_0xb087('0xa6')][_0xb087('0xd3')]},'contact':_0x33756c['body'][_0xb087('0x40')],'account':_0x33756c['body']['account']};var _0x471c54={'rejectUnauthorized':![],'method':_0xb087('0xd4'),'url':_0xb087('0xd5'),'headers':{'X-APIKEY':_0x48a94f[_0xb087('0xd2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x33756c[_0xb087('0xa6')][_0xb087('0xd3')]],'buttons':null,'topic':_0x259ac0[_0xb087('0xcf')],'note':_[_0xb087('0xd6')](_0x259ac0[_0xb087('0xd0')])?null:getMustacheRender(_0x259ac0[_0xb087('0xd0')],_0x290338),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x259ac0['vidaooMetadata'])){var _0x2ebe58=getMustacheRender(_0x259ac0['vidaooMetadata'],_0x290338);var _0x173a1b=JSON['parse'](_0x2ebe58);_0x471c54['body'][_0xb087('0xd7')]=_0x173a1b;}}catch(_0x2e3036){throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))](_0xb087('0xd9'));}return rp(_0x471c54);}else{throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))](_0xb087('0xda'));}})[_0xb087('0x25')](function(_0x2fdcee){_0x547968=_0x2fdcee;if(_0x547968['id']){var _0x5ae13d={'body':_0x547968[_0xb087('0xdb')],'ChatWebsiteId':_0x259ac0['id'],'ChatInteractionId':_0x52268a['id'],'direction':'out','UserId':_0x33756c[_0xb087('0xa6')]['id']};return db[_0xb087('0xdc')]['create'](_0x5ae13d,{});}else{throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x52268a[_0xb087('0xdd')]({'vidaooSessionId':_0x547968['id']});})['then'](respondWithResult(_0x2e8eb1,null))[_0xb087('0xc9')](handleError(_0x2e8eb1,null));};exports['customUpdate']=function(_0x1e04ff,_0x1a99a3){if(_0x1e04ff[_0xb087('0x3f')]['id']){delete _0x1e04ff['body']['id'];}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x1e04ff[_0xb087('0xc5')]['id']},'include':[{'model':db[_0xb087('0xde')],'as':_0xb087('0xdf')}]})[_0xb087('0x25')](handleEntityNotFound(_0x1a99a3,null))[_0xb087('0x25')](saveUpdates(_0x1e04ff[_0xb087('0x3f')],null))[_0xb087('0x25')](respondWithResult(_0x1a99a3,null))[_0xb087('0xc9')](handleError(_0x1a99a3,null));};exports['abandon']=function(_0x3a5432,_0x520aa9,_0x31d03d){if(_0x3a5432[_0xb087('0x3f')]['id']){delete _0x3a5432[_0xb087('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x3a5432['params']['id']}})[_0xb087('0x25')](function(_0xfaa17f){if(!_0xfaa17f){logger[_0xb087('0x2a')](_0xb087('0xe0'),_0xb087('0xe1'),0x194,_0xb087('0xe2'));_0x520aa9[_0xb087('0x2e')](0x194);}else{if(_0xfaa17f['UserId']){throw new db[(_0xb087('0x9d'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0xfaa17f;})['then'](function(_0x4cde01){if(_0x4cde01){return _0x4cde01[_0xb087('0x3b')]({'closed':_0x3a5432[_0xb087('0x3f')]['closed'],'disposition':_0x3a5432[_0xb087('0x3f')][_0xb087('0xe3')]})[_0xb087('0x25')](function(_0x500a2b){return _0x500a2b;});}})[_0xb087('0x25')](function(_0x11a1a5){return respondWithRpcPromise('AbandonInteraction',_0xb087('0xe1'),_0x3a5432[_0xb087('0x3f')],client9004);})[_0xb087('0x25')](respondWithResult(_0x520aa9,null))[_0xb087('0xc9')](handleError(_0x520aa9,null));};exports['attachmentUpload']=function(_0x270e65,_0x10c680,_0x164371){_0x270e65[_0xb087('0x3f')][_0xb087('0x3d')]=_0x270e65[_0xb087('0xe4')]['originalname'];_0x270e65[_0xb087('0x3f')]['basename']=_0x270e65[_0xb087('0xe4')][_0xb087('0xe5')];_0x270e65['body'][_0xb087('0x4d')]=_0x270e65['file']['mimetype'];return db['Attachment'][_0xb087('0xca')](_0x270e65[_0xb087('0x3f')])[_0xb087('0x25')](respondWithResult(_0x10c680,0xc9))[_0xb087('0xc9')](handleError(_0x10c680,null));};exports[_0xb087('0xe6')]=function(_0x1e0751,_0x2831b4,_0x218fe3){return db['ChatInteraction'][_0xb087('0xcd')]({'where':{'id':_0x1e0751['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2831b4,null))[_0xb087('0x25')](function(_0x1babd3){if(_0x1babd3){if(_0x1babd3[_0xb087('0xe7')]){return _0x2831b4['status'](0x193)['json']({'status':0x193,'message':_0xb087('0xe8')});}return db[_0xb087('0xe9')][_0xb087('0xcd')]({'where':{'id':_0x1e0751[_0xb087('0x50')][_0xb087('0xea')]},'raw':!![]})[_0xb087('0x25')](handleEntityNotFound(_0x2831b4,null));}})['then'](function(_0x52341e){if(_0x52341e){var _0x54eed6=_0x52341e[_0xb087('0xeb')]!==null;var _0x12d277=path[_0xb087('0xec')](config[_0xb087('0xed')],'server/files/attachments/');if(_0x54eed6){_0x12d277=path[_0xb087('0xec')](_0x12d277,_0xb087('0xee'));}var _0x1b5422=path[_0xb087('0xec')](_0x12d277,_0x52341e[_0xb087('0xef')]);return _0x2831b4[_0xb087('0xf0')](_0x1b5422);}})[_0xb087('0xc9')](handleError(_0x2831b4,null));};exports[_0xb087('0xf1')]=function(_0x120012,_0x385065){var _0x56e768=null;var _0x5a2142=null;var _0x24171a=null;var _0x39577d=null;if(_0x120012[_0xb087('0x3f')]['id']){delete _0x120012[_0xb087('0x3f')]['id'];}if(_0x120012[_0xb087('0x3f')][_0xb087('0xf2')]){_0x39577d=path[_0xb087('0xec')](config[_0xb087('0xed')],_0xb087('0xf3'),util[_0xb087('0xf4')](_0xb087('0xf5'),Date[_0xb087('0xf6')]()));_0x120012[_0xb087('0x3f')][_0xb087('0xf7')]=_0x39577d;}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x120012[_0xb087('0xc5')]['id']},'include':[{'model':db[_0xb087('0xdc')],'as':_0xb087('0xf8'),'include':[{'model':db[_0xb087('0x81')],'as':_0xb087('0x81')}]}]})[_0xb087('0x25')](handleEntityNotFound(_0x385065,null))[_0xb087('0x25')](saveUpdates(_0x120012[_0xb087('0x3f')],null))[_0xb087('0x25')](function(_0x365d41){if(_0x365d41){_0x56e768=_0x365d41;return db[_0xb087('0xcc')][_0xb087('0x74')]({'where':{'id':_0x56e768[_0xb087('0x89')]}});}})[_0xb087('0x25')](function(_0x159082){if(_0x159082){_0x24171a=_0x159082;return db[_0xb087('0xde')][_0xb087('0x74')]({'where':{'id':_0x56e768[_0xb087('0x7d')]}});}})[_0xb087('0x25')](function(_0x2d8c34){if(_0x2d8c34){_0x5a2142=_0x2d8c34;if(_0x39577d){var _0x5a50a1=null;for(var _0x57186a=0x1;_0x57186a<_0x56e768['Messages'][_0xb087('0x54')];++_0x57186a){_0x5a50a1=_0x56e768[_0xb087('0xf8')][_0x57186a];var _0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util['format'](_0xb087('0xf9'),_0x24171a[_0xb087('0xfa')],_0x5a50a1[_0xb087('0x84')]):_0xb087('0xfb');var _0x39f701=_0x120012[_0xb087('0x3f')][_0xb087('0xfc')]||util[_0xb087('0xf4')](_0xb087('0xf9'),_0xb087('0xfd'),_0x5a50a1[_0xb087('0x7d')]);switch(_0x24171a['agentIdentifier']){case _0xb087('0xfe'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util[_0xb087('0xf4')](_0xb087('0xf9'),_0x24171a['agentAlias'],_0x5a50a1[_0xb087('0x84')]):_0xb087('0xfb');break;case _0xb087('0xff'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?_0x5a50a1[_0xb087('0x81')][_0xb087('0x100')]||_0x5a50a1[_0xb087('0x81')][_0xb087('0x45')]:_0xb087('0xfb');break;case _0xb087('0x101'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?_0x5a50a1[_0xb087('0x81')][_0xb087('0x45')]:_0xb087('0xfb');break;default:_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util[_0xb087('0xf4')](_0xb087('0xf9'),_0x24171a[_0xb087('0xfa')],_0x5a50a1['UserId']):_0xb087('0xfb');}var _0x2c85ed=util[_0xb087('0xf4')](_0xb087('0x102'),moment(_0x5a50a1['createdAt'])[_0xb087('0xf4')](_0xb087('0x103')),_0x5a50a1[_0xb087('0x104')]==='in'?_0x39f701:_0x4cbc90,_0x5a50a1[_0xb087('0x3f')]);if(!_0x5a50a1[_0xb087('0x105')]){fs['appendFileSync'](_0x39577d,_0x2c85ed);}}return db[_0xb087('0x106')][_0xb087('0xcd')]({'where':{'service':!![]},'include':[{'model':db[_0xb087('0x107')],'as':_0xb087('0x108'),'raw':!![]}]});}}})[_0xb087('0x25')](function(_0x17ad89){if(_0x17ad89&&_0x17ad89[_0xb087('0x108')]&&_0x120012[_0xb087('0x3f')]){var _0x58a76b={'tls':{'rejectUnauthorized':![]}};if(_0x17ad89[_0xb087('0x108')][_0xb087('0x109')]){_0x58a76b['service']=_0x17ad89[_0xb087('0x108')][_0xb087('0x109')];}else{_0x58a76b['host']=_0x17ad89[_0xb087('0x108')][_0xb087('0x10a')];_0x58a76b[_0xb087('0x10b')]=_0x17ad89[_0xb087('0x108')][_0xb087('0x10b')];_0x58a76b[_0xb087('0x10c')]=_0x17ad89[_0xb087('0x108')]['secure'];}if(_0x17ad89[_0xb087('0x108')][_0xb087('0x10d')]){_0x58a76b[_0xb087('0x10e')]={'user':_0x17ad89[_0xb087('0x108')][_0xb087('0xa6')],'pass':_0x17ad89[_0xb087('0x108')]['pass']};}return respondWithRpcPromise(_0xb087('0x10f'),_0xb087('0x110'),{'account':_0x58a76b,'message':{'from':util[_0xb087('0xf4')](_0xb087('0x111'),_0x17ad89[_0xb087('0x3d')],_0x17ad89['email']||_0x17ad89[_0xb087('0x108')][_0xb087('0xa6')]),'to':_0x120012[_0xb087('0x3f')]['mailTranscript'],'subject':_0xb087('0x112'),'text':util['format'](_0xb087('0x113'),_0x120012['body'][_0xb087('0xf2')]),'attachments':[{'path':_0x39577d}]}})['then'](function(){return _0x56e768;})[_0xb087('0xc9')](function(_0x3d916e){console['error'](_0x3d916e);});}else{return _0x56e768;}})[_0xb087('0x25')](respondWithStatusCode(_0x385065,0xc8))['catch'](handleError(_0x385065,null));};exports['addMessage']=function(_0x5180ad,_0x396660,_0x4b2169){return db[_0xb087('0xdc')]['find']({'where':{'id':_0x5180ad['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x396660,null))[_0xb087('0x25')](function(_0x371655){if(_0x371655){return _0x371655[_0xb087('0x114')](_0x5180ad[_0xb087('0x3f')]['ids'],_[_0xb087('0x115')](_0x5180ad[_0xb087('0x3f')],[_0xb087('0x116'),'id'])||{});}})[_0xb087('0x25')](respondWithResult(_0x396660,null))[_0xb087('0xc9')](handleError(_0x396660,null));};exports[_0xb087('0x117')]=function(_0x1ca818,_0x2ec638,_0x57d42a){var _0x451c8a={'raw':![],'where':{}};var _0x3768db={};var _0x1db8ba={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb087('0xcd')]({'where':{'id':_0x1ca818[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x2ec638,null))['then'](function(_0x4904ea){if(_0x4904ea){_0x3768db[_0xb087('0x4f')]=_[_0xb087('0x86')](db[_0xb087('0xdc')][_0xb087('0xc6')]);_0x3768db['query']=_[_0xb087('0x86')](_0x1ca818[_0xb087('0x50')]);_0x3768db[_0xb087('0x59')]=_[_0xb087('0x51')](_0x3768db[_0xb087('0x4f')],_0x3768db['query']);_0x451c8a['attributes']=_[_0xb087('0x51')](_0x3768db[_0xb087('0x4f')],qs['fields'](_0x1ca818[_0xb087('0x50')][_0xb087('0x53')]));_0x451c8a[_0xb087('0x52')]=_0x451c8a[_0xb087('0x52')][_0xb087('0x54')]?_0x451c8a[_0xb087('0x52')]:_0x3768db[_0xb087('0x4f')];if(!_0x1ca818['query'][_0xb087('0x55')](_0xb087('0x118'))){_0x451c8a[_0xb087('0x34')]=qs['limit'](_0x1ca818['query'][_0xb087('0x34')]);_0x451c8a[_0xb087('0x32')]=qs[_0xb087('0x32')](_0x1ca818[_0xb087('0x50')]['offset']);}_0x451c8a[_0xb087('0x56')]=qs[_0xb087('0x57')](_0x1ca818[_0xb087('0x50')]['sort']);_0x451c8a['where']=qs[_0xb087('0x59')](_['pick'](_0x1ca818[_0xb087('0x50')],_0x3768db[_0xb087('0x59')]));_0x451c8a['where']['ChatInteractionId']=_0x4904ea['id'];if(_0x1ca818[_0xb087('0x50')][_0xb087('0x119')]){_0x451c8a[_0xb087('0x8f')]=_[_0xb087('0xae')](_0x451c8a['where'],{'$or':_[_0xb087('0x44')](_0x451c8a['attributes'],function(_0x52cc1a){var _0x117552={};_0x117552[_0x52cc1a]={'$like':'%'+_0x1ca818[_0xb087('0x50')][_0xb087('0x119')]+'%'};return _0x117552;})});}if(_0x1ca818[_0xb087('0x50')][_0xb087('0x8d')]){var _0x484bb5=_0x1ca818[_0xb087('0x50')]['$gte']['split'](',');var _0x46f8cf={};_0x46f8cf[_0x484bb5[0x0]]={'$gte':moment(_0x484bb5[0x1])[_0xb087('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x451c8a[_0xb087('0x8f')]=_[_0xb087('0xae')](_0x451c8a[_0xb087('0x8f')],_0x46f8cf);}_0x451c8a=_[_0xb087('0xae')]({},_0x451c8a,_0x1ca818['options']);return db[_0xb087('0xdc')][_0xb087('0x35')]({'where':_0x451c8a[_0xb087('0x8f')]})[_0xb087('0x25')](function(_0x2c3d1b){_0x1db8ba['count']=_0x2c3d1b;if(_0x1ca818['query']['includeAll']){_0x451c8a[_0xb087('0xc7')]=[{'all':!![]}];}return db['ChatMessage'][_0xb087('0x11a')](_0x451c8a);})[_0xb087('0x25')](function(_0x4c1577){_0x1db8ba[_0xb087('0x11b')]=_0x4c1577;return _0x1db8ba;});}})[_0xb087('0x25')](respondWithFilteredResult(_0x2ec638,_0x451c8a))[_0xb087('0xc9')](handleError(_0x2ec638,null));};exports[_0xb087('0x11c')]=function(_0xad3eae,_0xb6682a,_0x1dbeb1){var _0x2caa79={'where':{}},_0x521e0c={},_0x1ffbd9={'count':0x0,'rows':[]};return db[_0xb087('0x4b')][_0xb087('0xcd')]({'where':{'id':_0xad3eae['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xb6682a,null))[_0xb087('0x25')](function(_0x3fd51b){if(_0x3fd51b){_0x521e0c[_0xb087('0x4f')]=_['keys'](db['ChatMessage'][_0xb087('0xc6')]);_0x521e0c[_0xb087('0x50')]=_[_0xb087('0x86')](_0xad3eae[_0xb087('0x50')]);_0x521e0c[_0xb087('0x59')]=_[_0xb087('0x51')](_0x521e0c['model'],_0x521e0c['query']);_0x2caa79[_0xb087('0x52')]=_[_0xb087('0x51')](_0x521e0c[_0xb087('0x4f')],qs[_0xb087('0x53')](_0xad3eae['query'][_0xb087('0x53')]));_0x2caa79[_0xb087('0x52')]=_0x2caa79[_0xb087('0x52')][_0xb087('0x54')]?_0x2caa79[_0xb087('0x52')]:_0x521e0c[_0xb087('0x4f')];if(!_0xad3eae[_0xb087('0x50')][_0xb087('0x55')](_0xb087('0x118'))){_0x2caa79[_0xb087('0x34')]=qs[_0xb087('0x34')](_0xad3eae[_0xb087('0x50')][_0xb087('0x34')]);_0x2caa79[_0xb087('0x32')]=qs[_0xb087('0x32')](_0xad3eae[_0xb087('0x50')][_0xb087('0x32')]);}_0x2caa79[_0xb087('0x56')]=qs[_0xb087('0x57')](_0xad3eae[_0xb087('0x50')]['sort']);_0x2caa79[_0xb087('0x8f')]=qs[_0xb087('0x59')](_['pick'](_0xad3eae[_0xb087('0x50')],_0x521e0c[_0xb087('0x59')]));_0x2caa79[_0xb087('0x8f')]['ChatInteractionId']=_0x3fd51b['id'];if(_0xad3eae[_0xb087('0x50')]['filter']){_0x2caa79['where']=_[_0xb087('0xae')](_0x2caa79[_0xb087('0x8f')],{'$or':_[_0xb087('0x44')](_0x2caa79[_0xb087('0x52')],function(_0x4a1749){var _0x300e08={};_0x300e08[_0x4a1749]={'$like':'%'+_0xad3eae['query'][_0xb087('0x119')]+'%'};return _0x300e08;})});}_0x2caa79[_0xb087('0x8f')][_0xb087('0x105')]=![];if(_0xad3eae['query']['id']){_0x2caa79['where']['id']={'$gt':_0xad3eae[_0xb087('0x50')]['id']};}_0x2caa79=_['merge']({},_0x2caa79,_0xad3eae['options']);return db[_0xb087('0xdc')][_0xb087('0x35')]({'where':_0x2caa79['where']})[_0xb087('0x25')](function(_0x241c68){_0x1ffbd9[_0xb087('0x35')]=_0x241c68;_0x2caa79[_0xb087('0xc7')]=[];if(_0xad3eae['query']['includeAgent']){_0x2caa79[_0xb087('0xc7')][_0xb087('0xc2')]({'model':db[_0xb087('0x81')],'as':_0xb087('0x81'),'attributes':['id','fullname',_0xb087('0x100')]});}if(_0xad3eae[_0xb087('0x50')][_0xb087('0x11d')]){_0x2caa79[_0xb087('0xc7')]=[{'all':!![]}];}return db[_0xb087('0xdc')][_0xb087('0x11a')](_0x2caa79);})[_0xb087('0x25')](function(_0x3b5740){_0x1ffbd9['rows']=_0x3b5740;return _0x1ffbd9;});}})[_0xb087('0x25')](respondWithFilteredResult(_0xb6682a,_0x2caa79))[_0xb087('0xc9')](handleError(_0xb6682a,null));};exports[_0xb087('0x11e')]=function(_0x594ddc,_0x30521e,_0x13acd8){return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x594ddc[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x30521e,null))['then'](function(_0x528edd){if(_0x528edd){return _0x528edd[_0xb087('0x11f')](_0x594ddc[_0xb087('0x3f')][_0xb087('0x116')],_[_0xb087('0x115')](_0x594ddc[_0xb087('0x3f')],[_0xb087('0x116'),'id'])||{})['spread'](function(){return db['Tag'][_0xb087('0x11a')]({'attributes':['id',_0xb087('0x3d'),'color'],'where':{'id':_0x594ddc['body'][_0xb087('0x116')]}});})[_0xb087('0x25')](function(_0x24ae87){socket['emit'](_0xb087('0x120'),{'id':Number(_0x594ddc[_0xb087('0xc5')]['id']),'tags':_0x24ae87||[]});return{'id':Number(_0x594ddc['params']['id']),'tags':_0x24ae87||[]};});}})[_0xb087('0x25')](respondWithResult(_0x30521e,null))['catch'](handleError(_0x30521e,null));};exports['removeTags']=function(_0x592d18,_0x5cbda4,_0x5a182e){return db[_0xb087('0x4b')]['find']({'where':{'id':_0x592d18[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x5cbda4,null))['then'](function(_0x12f2b2){if(_0x12f2b2){return _0x12f2b2[_0xb087('0x121')](_0x592d18[_0xb087('0x50')][_0xb087('0x116')]);}})['then'](respondWithStatusCode(_0x5cbda4,null))[_0xb087('0xc9')](handleError(_0x5cbda4,null));};exports[_0xb087('0xf0')]=function(_0x17d60b,_0x5df18d){var _0x538812=moment()[_0xb087('0x122')]()[_0xb087('0xac')]();var _0x39732b=path[_0xb087('0xec')](config[_0xb087('0xed')],'server',_0xb087('0x123'),'tmp');var _0x1d8582=path[_0xb087('0xec')](config['root'],_0xb087('0x124'),'files',_0xb087('0x125'));var _0x3f2e19=path[_0xb087('0xec')](_0x39732b,_0x538812);var _0x2d500c=util[_0xb087('0xf4')](_0xb087('0x126'),_0x17d60b[_0xb087('0xc5')]['id'],_0x538812);var _0x407837=path['join'](_0x39732b,_0x2d500c);var _0x220896=[];_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0x81')],'as':_0xb087('0x81'),'attributes':['id',_0xb087('0x45')],'raw':!![]});_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0xde')],'as':_0xb087('0xdf'),'attributes':['id',_0xb087('0x127'),'lastName'],'raw':!![]});if(_0x17d60b[_0xb087('0x50')][_0xb087('0x125')]){_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0xe9')],'as':_0xb087('0xe9'),'raw':!![]});}var _0x6fa760=[{'model':db['ChatMessage'],'as':_0xb087('0xf8'),'attributes':['id',_0xb087('0x3f'),_0xb087('0x8b'),'direction',_0xb087('0x105'),_0xb087('0x92')],'include':_0x220896}];_0x6fa760[_0xb087('0xc2')]({'model':db['ChatWebsite'],'as':_0xb087('0x128'),'attributes':['id',_0xb087('0x3d')]});_0x6fa760['push']({'model':db[_0xb087('0x81')],'as':_0xb087('0x129'),'attributes':['id',_0xb087('0x45')]});return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x17d60b['params']['id']},'include':_0x6fa760})[_0xb087('0x25')](handleEntityNotFound(_0x5df18d,null))[_0xb087('0x25')](function(_0x196111){if(_0x196111){var _0x2711ed=_0x196111['get']({'plain':!![]});fs['mkdirSync'](_0x3f2e19);var _0x2aa136={'channel':'Chat','account':_0x2711ed[_0xb087('0x128')][_0xb087('0x3d')],'agent':_0x2711ed['Owner']?_0x2711ed[_0xb087('0x129')][_0xb087('0x45')]:'N.A.','createdAt':moment(_0x2711ed['createdAt'])[_0xb087('0xf4')](_0xb087('0x12a'))[_0xb087('0xac')](),'closedAt':_0x2711ed['closed']?moment(_0x2711ed['closedAt'])['format'](_0xb087('0x12a'))[_0xb087('0xac')]():'','disposition':_0x2711ed[_0xb087('0xe3')],'chatInfo':{'browser':_0x2711ed['browserName'],'os':_0x2711ed['osName'],'referer':_0x2711ed[_0xb087('0x12b')],'customerIp':_0x2711ed[_0xb087('0x12c')],'customerPort':_0x2711ed[_0xb087('0x12d')]?_0x2711ed[_0xb087('0x12d')]:_0xb087('0x12e')},'messages':_(_0x2711ed[_0xb087('0xf8')])[_0xb087('0x12f')]()[_0xb087('0x119')]({'secret':![]})[_0xb087('0x44')](function(_0x4392f7){if(_0x4392f7[_0xb087('0xe9')]){var _0x2ce41b=path[_0xb087('0xec')](_0x1d8582,_0x4392f7[_0xb087('0xe9')][_0xb087('0xef')]);if(fs[_0xb087('0x130')](_0x2ce41b)){fs['createReadStream'](_0x2ce41b)[_0xb087('0x131')](fs[_0xb087('0x132')](path['join'](_0x3f2e19,_0x4392f7['Attachment'][_0xb087('0xef')])));}}return{'date':moment(_0x4392f7[_0xb087('0x8b')])[_0xb087('0xf4')](_0xb087('0x12a'))['toString'](),'sender':_0x4392f7[_0xb087('0x104')]===_0xb087('0x133')?_0x4392f7['User']?_0x4392f7['User'][_0xb087('0x45')]:_0xb087('0xfb'):_0x4392f7[_0xb087('0xdf')]['firstName']+(_0x4392f7[_0xb087('0xdf')][_0xb087('0x134')]?'\x20'+_0x4392f7[_0xb087('0xdf')][_0xb087('0x134')]:''),'body':_0x4392f7[_0xb087('0xe9')]?_0x4392f7[_0xb087('0xe9')][_0xb087('0xef')]:_0x4392f7['body'],'direction':_0x4392f7[_0xb087('0x104')]===_0xb087('0x133')?'A':'C','secret':_0x4392f7[_0xb087('0x105')],'read':_0x4392f7[_0xb087('0x92')],'attachment':_0x4392f7[_0xb087('0xe9')]};})['value']()};return ejs['renderFile'](path[_0xb087('0xec')](config[_0xb087('0xed')],_0xb087('0x124'),'views',_0xb087('0x135')),{'interaction':_0x2aa136})[_0xb087('0x25')](function(_0x3e4bec){var _0x52b038=path[_0xb087('0xec')](_0x3f2e19,_0xb087('0x136')+_0x2711ed['id']+'-'+_0x538812+_0xb087('0x137'));var _0x4e6b9f={'path':_0x52b038,'channel':'Chat','interactionId':_0x2711ed['id']};return pdf['createPdfFromHTML'](_0x3e4bec,_0x4e6b9f);})[_0xb087('0x25')](function(){return new BPromise(function(_0x22dea9,_0x1c9337){zipdir(_0x3f2e19,{'saveTo':_0x407837},function(_0x3d0278,_0x1c8982){if(_0x3d0278)return _0x1c9337(_0x3d0278);return _0x22dea9(_0x1c8982);});})[_0xb087('0x25')](function(){return new BPromise(function(_0x31b3e7,_0x6b8337){rimraf(_0x3f2e19,function(_0x348c92){if(_0x348c92)_0x6b8337(_0x348c92);return _0x31b3e7();});});})[_0xb087('0x25')](function(){return _0x5df18d[_0xb087('0xf0')](_0x407837,_0x2d500c,function(_0x218e1c){if(_0x218e1c){console[_0xb087('0x138')](_0xb087('0x139'),_0x218e1c);}else{fs[_0xb087('0x13a')](_0x407837);}});});});}else{return _0x5df18d[_0xb087('0x2e')](0xc8);}})[_0xb087('0xc9')](handleError(_0x5df18d,null));}; \ No newline at end of file +var _0x0b0e=['closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','spread','chatInteractionTags:save','removeTags','files','tmp','attachments','lastName','Account','Owner','get','mkdirSync','N.A.','browserName','customerIp','customerPort','createReadStream','pipe','createWriteStream','firstName','renderFile','server','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','then','request\x20sent','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','send','merge','body','contact','interaction','account','Users','map','TagIds','split','forEach','Tags','push','index','ChatInteraction','rawAttributes','fieldName','type','name','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','field','color','from','tools_tags','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','isEmpty','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','null','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','ChatWebsiteId','sequelize','toString','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','params','filters','includeAll','include','options','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','fullname','email','POST','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned'];(function(_0x190f29,_0x4098cb){var _0x511874=function(_0x2fe191){while(--_0x2fe191){_0x190f29['push'](_0x190f29['shift']());}};_0x511874(++_0x4098cb);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3311ae,_0x362cee){_0x3311ae=_0x3311ae-0x0;var _0x107949=_0x0b0e[_0x3311ae];return _0x107949;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var pdf=require(_0xe0b0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0b0('0x14'))(_0xe0b0('0x15'));var utils=require(_0xe0b0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe0b0('0x17'));var db=require(_0xe0b0('0x18'))['db'];config[_0xe0b0('0x19')]=_[_0xe0b0('0x1a')](config[_0xe0b0('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0b0('0x1b'))(new Redis(config[_0xe0b0('0x19')]));require(_0xe0b0('0x1c'))[_0xe0b0('0x1d')](socket);var jayson=require(_0xe0b0('0x1e'));var client=jayson['client'][_0xe0b0('0x1f')]({'port':0x232b});var client9004=jayson['client'][_0xe0b0('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xadee6e,_0x519ae8,_0x11fdca,_0x4a4cc0){return new BPromise(function(_0x2d6fb6,_0x100204){var _0x56bcc7=_0x4a4cc0||client;return _0x56bcc7['request'](_0xadee6e,_0x11fdca)[_0xe0b0('0x20')](function(_0x50a441){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x519ae8,_0xe0b0('0x21'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x519ae8,_0xe0b0('0x21'),JSON['stringify'](_0x50a441));if(_0x50a441[_0xe0b0('0x22')]){if(_0x50a441['error'][_0xe0b0('0x23')]===0x1f4){logger[_0xe0b0('0x22')](_0xe0b0('0x24'),_0x519ae8,_0x50a441[_0xe0b0('0x22')][_0xe0b0('0x25')]);return _0x100204(_0x50a441['error']['message']);}logger[_0xe0b0('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x519ae8,_0x50a441[_0xe0b0('0x22')][_0xe0b0('0x25')]);return _0x2d6fb6(_0x50a441['error'][_0xe0b0('0x25')]);}else{logger['info'](_0xe0b0('0x24'),_0x519ae8,'request\x20sent');_0x2d6fb6(_0x50a441[_0xe0b0('0x26')]['message']);}})[_0xe0b0('0x27')](function(_0x4de537){logger[_0xe0b0('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x519ae8,_0x4de537);_0x100204(_0x4de537);});});}function respondWithStatusCode(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0xcc;return function(_0x362aba){if(_0x362aba){return _0x3c221d[_0xe0b0('0x28')](_0x5c5317);}return _0x3c221d[_0xe0b0('0x29')](_0x5c5317)[_0xe0b0('0x2a')]();};}function respondWithResult(_0x3ec2,_0x10745d){_0x10745d=_0x10745d||0xc8;return function(_0x5200a6){if(_0x5200a6){return _0x3ec2[_0xe0b0('0x29')](_0x10745d)[_0xe0b0('0x2b')](_0x5200a6);}};}function respondWithFilteredResult(_0x5b7a64,_0x15e13b){return function(_0x419b1f){if(_0x419b1f){var _0x36d137=typeof _0x15e13b[_0xe0b0('0x2c')]===_0xe0b0('0x2d')&&typeof _0x15e13b[_0xe0b0('0x2e')]===_0xe0b0('0x2d');var _0x4fb3b7=_0x419b1f[_0xe0b0('0x2f')];var _0x3c0109=_0x36d137?0x0:_0x15e13b['offset'];var _0x4fe400=_0x36d137?_0x419b1f[_0xe0b0('0x2f')]:_0x15e13b[_0xe0b0('0x2c')]+_0x15e13b[_0xe0b0('0x2e')];var _0x3f81d5;if(_0x4fe400>=_0x4fb3b7){_0x4fe400=_0x4fb3b7;_0x3f81d5=0xc8;}else{_0x3f81d5=0xce;}_0x5b7a64[_0xe0b0('0x29')](_0x3f81d5);return _0x5b7a64['set'](_0xe0b0('0x30'),_0x3c0109+'-'+_0x4fe400+'/'+_0x4fb3b7)[_0xe0b0('0x2b')](_0x419b1f);}return null;};}function patchUpdates(_0x7867c4){return function(_0x29d725){try{jsonpatch[_0xe0b0('0x31')](_0x29d725,_0x7867c4,!![]);}catch(_0x4fe835){return BPromise[_0xe0b0('0x32')](_0x4fe835);}return _0x29d725[_0xe0b0('0x33')]();};}function saveUpdates(_0xfc51d3,_0x31c6f5){return function(_0x3575bc){if(_0x3575bc){return _0x3575bc[_0xe0b0('0x34')](_0xfc51d3)[_0xe0b0('0x20')](function(_0x20908f){return _0x20908f;});}return null;};}function removeEntity(_0x2125d5,_0x1dd010){return function(_0xd56467){if(_0xd56467){return _0xd56467[_0xe0b0('0x35')]()[_0xe0b0('0x20')](function(){_0x2125d5[_0xe0b0('0x29')](0xcc)[_0xe0b0('0x2a')]();});}};}function handleEntityNotFound(_0x4cf80c,_0x121608){return function(_0x135be5){if(!_0x135be5){_0x4cf80c[_0xe0b0('0x28')](0x194);}return _0x135be5;};}function handleError(_0x1eb3f9,_0x1a2d24){_0x1a2d24=_0x1a2d24||0x1f4;return function(_0x2c6e60){logger[_0xe0b0('0x22')](_0x2c6e60['stack']);if(_0x2c6e60['name']){delete _0x2c6e60['name'];}_0x1eb3f9['status'](_0x1a2d24)[_0xe0b0('0x36')](_0x2c6e60);};}function getMustacheRender(_0xc3d967,_0xe6f635){return Mustache['render'](_0xc3d967,_[_0xe0b0('0x37')](_0xe6f635[_0xe0b0('0x38')],{'contact':_0xe6f635[_0xe0b0('0x39')],'message':_0xe6f635[_0xe0b0('0x25')],'agent':_0xe6f635['agent'],'interaction':_0xe6f635[_0xe0b0('0x3a')],'account':_0xe6f635[_0xe0b0('0x3b')]}))||'';}function getInteractionUsers(_0x43d352,_0x30dcbb){return new BPromise(function(_0x4265e3,_0x1205db){try{if(_0x30dcbb[_0x43d352['id']]){_0x43d352[_0xe0b0('0x3c')]=_[_0xe0b0('0x3d')](_0x30dcbb[_0x43d352['id']],function(_0xeaffbb){return{'id':_0xeaffbb['id'],'fullname':_0xeaffbb['fullname']};});}}catch(_0x3e349b){_0x1205db(_0x3e349b);}_0x4265e3(_0x43d352);});}function getInteractionTags(_0x54f646,_0x34178d){return new BPromise(function(_0x2d5f47,_0x46c4ea){try{if(_0x54f646[_0xe0b0('0x3e')]){_0x54f646['Tags']=[];_0x54f646[_0xe0b0('0x3e')][_0xe0b0('0x3f')](',')[_0xe0b0('0x40')](function(_0x402a0e){_0x54f646[_0xe0b0('0x41')][_0xe0b0('0x42')](_0x34178d[_0x402a0e]);});}delete _0x54f646[_0xe0b0('0x3e')];}catch(_0x3bde8b){_0x46c4ea(_0x3bde8b);}_0x2d5f47(_0x54f646);});}function updateChatInteraction(_0x52ffe4,_0x2aad80,_0x309bbf){return new BPromise(function(_0x528818,_0x515bd2){return getInteractionUsers(_0x52ffe4,_0x309bbf)[_0xe0b0('0x20')](function(_0x247f8d){return getInteractionTags(_0x247f8d,_0x2aad80);})['then'](function(_0x18a59d){_0x528818(_0x18a59d);})[_0xe0b0('0x27')](function(_0x6bca5c){_0x515bd2(_0x6bca5c);});});}exports[_0xe0b0('0x43')]=function(_0x1a8cc7,_0x5c31b5){var _0x5d2fa2={},_0x51c580={},_0xc3235b={'count':0x0,'rows':[]};var _0x38e715=_['map'](db[_0xe0b0('0x44')][_0xe0b0('0x45')],function(_0x14197b){return{'name':_0x14197b[_0xe0b0('0x46')],'type':_0x14197b[_0xe0b0('0x47')]['key']};});_0x51c580['model']=_[_0xe0b0('0x3d')](_0x38e715,_0xe0b0('0x48'));_0x51c580[_0xe0b0('0x49')]=_[_0xe0b0('0x4a')](_0x1a8cc7[_0xe0b0('0x49')]);_0x51c580['filters']=_[_0xe0b0('0x4b')](_0x51c580[_0xe0b0('0x4c')],_0x51c580['query']);_0x5d2fa2['attributes']=_['intersection'](_0x51c580[_0xe0b0('0x4c')],qs[_0xe0b0('0x4d')](_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x4d')]));_0x5d2fa2['attributes']=_0x5d2fa2[_0xe0b0('0x4e')][_0xe0b0('0x4f')]?_0x5d2fa2['attributes']:_0x51c580['model'];if(!_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x50')]('nolimit')){_0x5d2fa2[_0xe0b0('0x2e')]=qs[_0xe0b0('0x2e')](_0x1a8cc7['query']['limit']);_0x5d2fa2[_0xe0b0('0x2c')]=qs['offset'](_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x2c')]);}_0x5d2fa2[_0xe0b0('0x51')]=qs[_0xe0b0('0x52')](_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x52')]);_0x5d2fa2['where']=qs['filters'](_[_0xe0b0('0x53')](_0x1a8cc7['query'],_0x51c580['filters']),_0x38e715);var _0x249d9a=[];var _0x222174=squel['select']()['field']('id')[_0xe0b0('0x54')](_0xe0b0('0x48'))[_0xe0b0('0x54')](_0xe0b0('0x55'))[_0xe0b0('0x56')](_0xe0b0('0x57'));var _0x84fabb=squel['select']()[_0xe0b0('0x54')]('u.id')[_0xe0b0('0x54')]('u.fullname')['field'](_0xe0b0('0x58'))[_0xe0b0('0x56')](_0xe0b0('0x59'),'ui')[_0xe0b0('0x5a')](_0xe0b0('0x5b'),'u',_0xe0b0('0x5c'));var _0x4548da=squel[_0xe0b0('0x5d')]()[_0xe0b0('0x56')]('chat_interactions','i')[_0xe0b0('0x5a')]('cm_contacts','c',_0xe0b0('0x5e'))[_0xe0b0('0x5a')](_0xe0b0('0x5b'),'o',_0xe0b0('0x5f'))[_0xe0b0('0x5a')](_0xe0b0('0x60'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xe0b0('0x5a')](_0xe0b0('0x61'),'me',_0xe0b0('0x62'))[_0xe0b0('0x5a')](_0xe0b0('0x63'),'it',_0xe0b0('0x64'))[_0xe0b0('0x5a')](_0xe0b0('0x57'),'t',_0xe0b0('0x65'));var _0xf331df=squel[_0xe0b0('0x66')]();var _0x18ab99=[];var _0xc719d2=squel[_0xe0b0('0x66')]();var _0xcdf97;if(_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x67')]){_0xcdf97=as[_0xe0b0('0x68')](_0x1a8cc7['query'][_0xe0b0('0x67')]);var _0xe7fbac=_0xcdf97[_0xe0b0('0x69')];for(var _0x2f24e6=0x0;_0x2f24e6<_0xcdf97[_0xe0b0('0x6a')][_0xe0b0('0x4f')];_0x2f24e6++){var _0x2bdb59=_0xcdf97['conditions'][_0x2f24e6];var _0x47dcc4='i';var _0x139014=_[_0xe0b0('0x6b')](_0x38e715,[_0xe0b0('0x48'),_0x2bdb59['field']]);if(!_0x139014){switch(_0x2bdb59[_0xe0b0('0x54')]){case _0xe0b0('0x6c'):if(_0x2bdb59[_0xe0b0('0x6d')]==0x1){_0x4548da[_0xe0b0('0x6e')]('`'+_0x2bdb59[_0xe0b0('0x54')]+'`\x20=\x200');}else{_0x4548da[_0xe0b0('0x6e')]('`'+_0x2bdb59[_0xe0b0('0x54')]+_0xe0b0('0x6f'));}break;case'Contact':if(_0x2bdb59[_0xe0b0('0x70')]===_0xe0b0('0x71')){if(_0x2bdb59['value'][_0xe0b0('0x3f')]('\x20')['length']>0x1){_0xf331df[_0xe7fbac]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe0b0('0x72')](_0x2bdb59['value']),null);}else{var _0x4d75e4='%'+_0x2bdb59[_0xe0b0('0x6d')]+'%';_0xf331df[_0xe7fbac](_0xe0b0('0x73'),_0x4d75e4,_0x4d75e4,_0x4d75e4);}}else{_0x139014=_[_0xe0b0('0x6b')](_0x38e715,[_0xe0b0('0x48'),'ContactId']);_0x2bdb59[_0xe0b0('0x54')]=_0xe0b0('0x74');_0x14da9c=as[_0xe0b0('0x75')](_0x47dcc4,_0x139014[_0xe0b0('0x47')],_0x2bdb59);_0xf331df[_0xe7fbac](_0x14da9c[_0xe0b0('0x76')],_0x14da9c[_0xe0b0('0x6d')][_0xe0b0('0x77')],_0x14da9c[_0xe0b0('0x6d')]['end']);}break;case'Tag':var _0x4b41a=_0x2bdb59[_0xe0b0('0x6d')][_0xe0b0('0x3f')](',')['map'](function(_0x49b754){return Number(_0x49b754);});_0x4b41a[_0xe0b0('0x40')](function(_0x26f36f){_0xc719d2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x26f36f+',%');});_0x18ab99=_['union'](_0x18ab99,_0x4b41a);break;case _0xe0b0('0x78'):if(_0x2bdb59[_0xe0b0('0x70')]===_0xe0b0('0x71')){_0xf331df[_0xe7fbac](_0xe0b0('0x79'),'%'+_0x2bdb59[_0xe0b0('0x6d')]+'%',null);}else{_0x139014=_[_0xe0b0('0x6b')](_0x38e715,[_0xe0b0('0x48'),_0xe0b0('0x7a')]);_0x2bdb59['field']=_0xe0b0('0x7a');_0x14da9c=as[_0xe0b0('0x75')](_0x47dcc4,_0x139014[_0xe0b0('0x47')],_0x2bdb59);_0xf331df[_0xe7fbac](_0x14da9c['text'],_0x14da9c['value']['start'],_0x14da9c['value']['end']);}break;case'body':_0x14da9c=as[_0xe0b0('0x75')]('me',null,_0x2bdb59);_0xf331df[_0xe7fbac](_0x14da9c['text'],_0x14da9c['value'][_0xe0b0('0x77')],_0x14da9c[_0xe0b0('0x6d')][_0xe0b0('0x2a')]);break;}}else{var _0x14da9c=as[_0xe0b0('0x75')](_0x47dcc4,_0x139014[_0xe0b0('0x47')],_0x2bdb59);_0xf331df[_0xe7fbac](_0x14da9c[_0xe0b0('0x76')],_0x14da9c[_0xe0b0('0x6d')]['start'],_0x14da9c[_0xe0b0('0x6d')][_0xe0b0('0x2a')]);}}}else{var _0x86e90=_(_0x1a8cc7[_0xe0b0('0x49')])[_0xe0b0('0x4a')]()[_0xe0b0('0x3d')](function(_0x16a2ae){return _['some'](_0x38e715,[_0xe0b0('0x48'),_0x16a2ae])?_0x16a2ae:undefined;})['compact']()[_0xe0b0('0x6d')]();if(!_[_0xe0b0('0x7b')](_0x86e90)){_0x86e90[_0xe0b0('0x40')](function(_0x9c7221){if(_0x9c7221==='ChatWebsiteId'){_0x4548da[_0xe0b0('0x7c')](_0xe0b0('0x7d'),[]['concat'](_0x1a8cc7['query'][_0x9c7221]));}else if(_0x9c7221===_0xe0b0('0x7e')){var _0x30adc5=JSON[_0xe0b0('0x7f')](_0x1a8cc7[_0xe0b0('0x49')][_0x9c7221])[_0xe0b0('0x80')];var _0x31dd21=JSON[_0xe0b0('0x7f')](_0x1a8cc7[_0xe0b0('0x49')][_0x9c7221])[_0xe0b0('0x81')];_0x4548da[_0xe0b0('0x7c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x30adc5,_0x31dd21);}else{if(_0x1a8cc7['query'][_0x9c7221]===_0xe0b0('0x82')){_0x4548da['where']('i.'+_0x9c7221+'\x20IS\x20NULL');}else{_0x4548da['where']('i.'+_0x9c7221+'\x20=\x20?',_0x1a8cc7[_0xe0b0('0x49')][_0x9c7221]);}}});}if(_0x1a8cc7['query'][_0xe0b0('0x83')]){if(_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x83')]==0x1){_0x4548da[_0xe0b0('0x6e')]('`unreadMessages`\x20=\x200');}else{_0x4548da[_0xe0b0('0x6e')](_0xe0b0('0x84'));}}if(_0x1a8cc7['query'][_0xe0b0('0x85')]){_0x18ab99=_[_0xe0b0('0x86')](_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x85')])?_0x1a8cc7[_0xe0b0('0x49')]['tag']:new Array(_0x1a8cc7['query']['tag']);_0x18ab99['forEach'](function(_0x5c258b){_0xc719d2['or'](_0xe0b0('0x87'),'%,'+_0x5c258b+',%');});}if(_0x1a8cc7['query'][_0xe0b0('0x88')]){var _0x5f4aaf=_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x88')][_0xe0b0('0x89')]('\x5c','\x5c\x5c')[_0xe0b0('0x89')](/'/g,'\x27\x27');if(qs[_0xe0b0('0x8a')](_0x5f4aaf)){_0xf331df['or'](_0xe0b0('0x8b'),_0x5f4aaf+'%');}else{_0xf331df['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5f4aaf))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5f4aaf+'%');}}}_0x4548da['where'](_0xf331df);_0x4548da[_0xe0b0('0x8c')](_0xe0b0('0x8d'));var _0x264363={'type':db[_0xe0b0('0x8e')][_0xe0b0('0x8f')]['SELECT'],'raw':!![]};var _0x234716=_0x4548da[_0xe0b0('0x90')]();_0x234716[_0xe0b0('0x54')](_0xe0b0('0x8d'));_0x234716[_0xe0b0('0x54')](_0xe0b0('0x91'),_0xe0b0('0x6c'));if(_0x5d2fa2[_0xe0b0('0x51')]){_0x5d2fa2[_0xe0b0('0x51')]['forEach'](function(_0x589c47){var _0x6e0e9=_0x589c47[0x0]===_0xe0b0('0x92')?_0x589c47[0x0]:'i.'+_0x589c47[0x0];_0x4548da['order'](_0x6e0e9,_0x589c47[0x1]===_0xe0b0('0x93')?![]:!![]);});}if(!_[_0xe0b0('0x7b')](_0x18ab99)){_0x4548da[_0xe0b0('0x6e')](_0xc719d2);_0x234716[_0xe0b0('0x7c')](_0xe0b0('0x94'),_0x18ab99);}BPromise[_0xe0b0('0x95')]()[_0xe0b0('0x20')](function(){if(!_0xcdf97){if(_0x1a8cc7[_0xe0b0('0x49')]['ChatWebsiteId'])return;_0x234716['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x4548da[_0xe0b0('0x7c')](_0xe0b0('0x96'));return;}if(_0x1a8cc7['user'][_0xe0b0('0x97')]!==_0xe0b0('0x98'))return;return _0x1a8cc7[_0xe0b0('0x99')][_0xe0b0('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x56c4b9){if(_['isEmpty'](_0x56c4b9)){_0x234716[_0xe0b0('0x7c')](_0xe0b0('0x9b'));_0x4548da['where'](_0xe0b0('0x9b'));}else{_0x234716[_0xe0b0('0x7c')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x56c4b9,'id'));_0x4548da[_0xe0b0('0x7c')]('i.ChatWebsiteId\x20IN\x20?',_[_0xe0b0('0x3d')](_0x56c4b9,'id'));}});})['then'](function(){if(_0x1a8cc7[_0xe0b0('0x99')][_0xe0b0('0x97')]===_0xe0b0('0x98')&&!_0xcdf97&&!_0x1a8cc7[_0xe0b0('0x49')][_0xe0b0('0x9c')])return[];return db[_0xe0b0('0x9d')][_0xe0b0('0x49')](_0x234716[_0xe0b0('0x9e')](),_0x264363);})[_0xe0b0('0x20')](function(_0x48497e){_0xc3235b[_0xe0b0('0x2f')]=_0x48497e[_0xe0b0('0x4f')];if(_0xc3235b[_0xe0b0('0x2f')]===0x0)return[];return db['sequelize'][_0xe0b0('0x49')](_0x222174['toString'](),_0x264363)[_0xe0b0('0x20')](function(_0x350c40){_0x249d9a=_['keyBy'](_0x350c40,'id');_0x264363=_[_0xe0b0('0x37')](_0x264363,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a8cc7['query'][_0xe0b0('0x4d')]){_0x5d2fa2['attributes']['forEach'](function(_0x4f027c){_0x4548da[_0xe0b0('0x54')]('i.'+_0x4f027c);});}else{_0x4548da[_0xe0b0('0x54')](_0xe0b0('0x91'),_0xe0b0('0x6c'));_0x4548da[_0xe0b0('0x54')]('a.key',_0xe0b0('0x9f'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa0'),'Account.mandatoryDisposition');_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa1'),'contactName');_0x4548da['field'](_0xe0b0('0xa2'));_0x4548da['field'](_0xe0b0('0xa3'),_0xe0b0('0xa4'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa5'),_0xe0b0('0xa6'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa7'),'Contact.email');_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xa8'),_0xe0b0('0xa9'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xaa'),'Contact.mobile');_0x4548da['field'](_0xe0b0('0xab'),_0xe0b0('0xac'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xad'),_0xe0b0('0xae'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xaf'),_0xe0b0('0xb0'));_0x4548da[_0xe0b0('0x54')](_0xe0b0('0xb1'),'TagIds');}if(_0x5d2fa2[_0xe0b0('0x2e')])_0x4548da[_0xe0b0('0x2e')](_0x5d2fa2[_0xe0b0('0x2e')]);if(_0x5d2fa2[_0xe0b0('0x2c')])_0x4548da['offset'](_0x5d2fa2[_0xe0b0('0x2c')]);return db[_0xe0b0('0x9d')][_0xe0b0('0x49')](_0x4548da[_0xe0b0('0x9e')](),_0x264363);})[_0xe0b0('0x20')](function(_0x484cb2){if(_0x484cb2[_0xe0b0('0x4f')]>0x0)_0x84fabb['where'](_0xe0b0('0xb2'),_[_0xe0b0('0x3d')](_0x484cb2,'id'));return db[_0xe0b0('0x9d')][_0xe0b0('0x49')](_0x84fabb[_0xe0b0('0x9e')](),_0x264363)['then'](function(_0x567e42){var _0x3822e4=_['groupBy'](_0x567e42,_0xe0b0('0xb3'));var _0x4c82d6=[];_0x484cb2[_0xe0b0('0x40')](function(_0x474fbb){_0x4c82d6[_0xe0b0('0x42')](updateChatInteraction(_0x474fbb,_0x249d9a,_0x3822e4));});return BPromise[_0xe0b0('0xb4')](_0x4c82d6);});});})[_0xe0b0('0x20')](function(_0x1bb4da){_0xc3235b[_0xe0b0('0xb5')]=_0x1bb4da;return _0xc3235b;})['then'](respondWithFilteredResult(_0x5c31b5,_0x5d2fa2))['catch'](handleError(_0x5c31b5,null));};exports[_0xe0b0('0xb6')]=function(_0x717e74,_0x184938){var _0x20d6bd={'raw':![],'where':{'id':_0x717e74[_0xe0b0('0xb7')]['id']}},_0xd83992={};_0xd83992[_0xe0b0('0x4c')]=_[_0xe0b0('0x4a')](db[_0xe0b0('0x44')][_0xe0b0('0x45')]);_0xd83992['query']=_['keys'](_0x717e74[_0xe0b0('0x49')]);_0xd83992[_0xe0b0('0xb8')]=_[_0xe0b0('0x4b')](_0xd83992[_0xe0b0('0x4c')],_0xd83992[_0xe0b0('0x49')]);_0x20d6bd[_0xe0b0('0x4e')]=_[_0xe0b0('0x4b')](_0xd83992['model'],qs['fields'](_0x717e74[_0xe0b0('0x49')][_0xe0b0('0x4d')]));_0x20d6bd[_0xe0b0('0x4e')]=_0x20d6bd[_0xe0b0('0x4e')][_0xe0b0('0x4f')]?_0x20d6bd[_0xe0b0('0x4e')]:_0xd83992[_0xe0b0('0x4c')];if(_0x717e74[_0xe0b0('0x49')][_0xe0b0('0xb9')]){_0x20d6bd[_0xe0b0('0xba')]=[{'all':!![]}];}_0x20d6bd=_['merge']({},_0x20d6bd,_0x717e74[_0xe0b0('0xbb')]);return db[_0xe0b0('0x44')]['find'](_0x20d6bd)[_0xe0b0('0x20')](handleEntityNotFound(_0x184938,null))[_0xe0b0('0x20')](respondWithResult(_0x184938,null))[_0xe0b0('0x27')](handleError(_0x184938,null));};exports[_0xe0b0('0xbc')]=function(_0x41fdef,_0x594f91){return db[_0xe0b0('0x44')][_0xe0b0('0xbc')](_0x41fdef[_0xe0b0('0x38')],{})[_0xe0b0('0x20')](respondWithResult(_0x594f91,0xc9))[_0xe0b0('0x27')](handleError(_0x594f91,null));};exports['update']=function(_0x475404,_0x58d61b){if(_0x475404[_0xe0b0('0x38')]['id']){delete _0x475404[_0xe0b0('0x38')]['id'];}return db[_0xe0b0('0x44')]['find']({'where':{'id':_0x475404['params']['id']}})[_0xe0b0('0x20')](handleEntityNotFound(_0x58d61b,null))[_0xe0b0('0x20')](saveUpdates(_0x475404[_0xe0b0('0x38')],null))['then'](respondWithResult(_0x58d61b,null))['catch'](handleError(_0x58d61b,null));};exports['destroy']=function(_0x5175e1,_0x57694c){return db['ChatInteraction'][_0xe0b0('0x6b')]({'where':{'id':_0x5175e1[_0xe0b0('0xb7')]['id']}})['then'](handleEntityNotFound(_0x57694c,null))[_0xe0b0('0x20')](removeEntity(_0x57694c,null))[_0xe0b0('0x27')](handleError(_0x57694c,null));};exports[_0xe0b0('0xbd')]=function(_0xd73b8a,_0x437588){return db['ChatInteraction']['describe']()[_0xe0b0('0x20')](respondWithResult(_0x437588,null))[_0xe0b0('0x27')](handleError(_0x437588,null));};exports[_0xe0b0('0xbe')]=function(_0x52dfd8,_0x6ab413){var _0x395083=_0x52dfd8[_0xe0b0('0xb7')]['id'];var _0xd231c4;var _0x35ca4e;var _0x1b8d4a;return db['ChatInteraction']['findOne']({'where':{'id':_0x395083}})['then'](function(_0x1ce027){_0xd231c4=_0x1ce027;return db[_0xe0b0('0xbf')][_0xe0b0('0xc0')]({'where':{'id':_0x1ce027[_0xe0b0('0x9c')]},'attributes':['id',_0xe0b0('0xc1'),_0xe0b0('0xc2'),_0xe0b0('0xc3'),_0xe0b0('0xc4'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x28ba25){if(_0x28ba25&&_0x28ba25[_0xe0b0('0xc1')]&&_0x28ba25[_0xe0b0('0xc2')]){_0x35ca4e=_0x28ba25;var _0x5451e7={'interaction':{'id':_0x395083},'agent':{'id':_0x52dfd8[_0xe0b0('0x99')]['id'],'name':_0x52dfd8[_0xe0b0('0x99')][_0xe0b0('0x48')],'fullname':_0x52dfd8['user'][_0xe0b0('0xc5')],'email':_0x52dfd8['user'][_0xe0b0('0xc6')]},'contact':_0x52dfd8[_0xe0b0('0x38')][_0xe0b0('0x39')],'account':_0x52dfd8[_0xe0b0('0x38')][_0xe0b0('0x3b')]};var _0x26df60={'rejectUnauthorized':![],'method':_0xe0b0('0xc7'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x28ba25[_0xe0b0('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x52dfd8[_0xe0b0('0x99')]['email']],'buttons':null,'topic':_0x35ca4e[_0xe0b0('0xc3')],'note':_[_0xe0b0('0xc8')](_0x35ca4e[_0xe0b0('0xc4')])?null:getMustacheRender(_0x35ca4e['vidaooNote'],_0x5451e7),'metadata':null},'redirect':_0xe0b0('0xc9'),'json':!![]};try{if(!_[_0xe0b0('0xc8')](_0x35ca4e[_0xe0b0('0xca')])){var _0x566a6e=getMustacheRender(_0x35ca4e[_0xe0b0('0xca')],_0x5451e7);var _0x32f67b=JSON[_0xe0b0('0x7f')](_0x566a6e);_0x26df60[_0xe0b0('0x38')][_0xe0b0('0xcb')]=_0x32f67b;}}catch(_0x15be52){throw new db['Sequelize'][(_0xe0b0('0xcc'))](_0xe0b0('0xcd'));}return rp(_0x26df60);}else{throw new db[(_0xe0b0('0x8e'))][(_0xe0b0('0xcc'))](_0xe0b0('0xce'));}})[_0xe0b0('0x20')](function(_0x38b2cf){_0x1b8d4a=_0x38b2cf;if(_0x1b8d4a['id']){var _0x31b01a={'body':_0x1b8d4a[_0xe0b0('0xcf')],'ChatWebsiteId':_0x35ca4e['id'],'ChatInteractionId':_0xd231c4['id'],'direction':_0xe0b0('0xd0'),'UserId':_0x52dfd8[_0xe0b0('0x99')]['id']};return db['ChatMessage'][_0xe0b0('0xbc')](_0x31b01a,{});}else{throw new db['Sequelize']['ValidationError'](_0xe0b0('0xd1'));}})[_0xe0b0('0x20')](function(){return _0xd231c4['updateAttributes']({'vidaooSessionId':_0x1b8d4a['id']});})[_0xe0b0('0x20')](respondWithResult(_0x6ab413,null))[_0xe0b0('0x27')](handleError(_0x6ab413,null));};exports[_0xe0b0('0xd2')]=function(_0x11e969,_0xa18619){if(_0x11e969[_0xe0b0('0x38')]['id']){delete _0x11e969[_0xe0b0('0x38')]['id'];}return db[_0xe0b0('0x44')][_0xe0b0('0x6b')]({'where':{'id':_0x11e969['params']['id']},'include':[{'model':db[_0xe0b0('0xd3')],'as':_0xe0b0('0xd4')}]})[_0xe0b0('0x20')](handleEntityNotFound(_0xa18619,null))[_0xe0b0('0x20')](saveUpdates(_0x11e969['body'],null))['then'](respondWithResult(_0xa18619,null))[_0xe0b0('0x27')](handleError(_0xa18619,null));};exports[_0xe0b0('0xd5')]=function(_0x333c2a,_0x2cd7db,_0x308d03){if(_0x333c2a[_0xe0b0('0x38')]['id']){delete _0x333c2a[_0xe0b0('0x38')]['id'];}return db[_0xe0b0('0x44')][_0xe0b0('0x6b')]({'where':{'id':_0x333c2a[_0xe0b0('0xb7')]['id']}})[_0xe0b0('0x20')](function(_0xaa7a71){if(!_0xaa7a71){logger[_0xe0b0('0x22')](_0xe0b0('0xd6'),_0xe0b0('0xd5'),0x194,_0xe0b0('0xd7'));_0x2cd7db[_0xe0b0('0x28')](0x194);}else{if(_0xaa7a71[_0xe0b0('0x7a')]){throw new db[(_0xe0b0('0x8e'))]['ValidationError'](_0xe0b0('0xd8'));}}return _0xaa7a71;})[_0xe0b0('0x20')](function(_0x36a006){if(_0x36a006){return _0x36a006['update']({'closed':_0x333c2a[_0xe0b0('0x38')][_0xe0b0('0xd9')],'disposition':_0x333c2a[_0xe0b0('0x38')][_0xe0b0('0xda')]})[_0xe0b0('0x20')](function(_0x3532f1){return _0x3532f1;});}})[_0xe0b0('0x20')](function(_0x581ae9){return respondWithRpcPromise(_0xe0b0('0xdb'),'abandon',_0x333c2a[_0xe0b0('0x38')],client9004);})['then'](respondWithResult(_0x2cd7db,null))[_0xe0b0('0x27')](handleError(_0x2cd7db,null));};exports[_0xe0b0('0xdc')]=function(_0x4bd799,_0x2102bc,_0x4f0cbe){_0x4bd799[_0xe0b0('0x38')][_0xe0b0('0x48')]=_0x4bd799[_0xe0b0('0xdd')][_0xe0b0('0xde')];_0x4bd799[_0xe0b0('0x38')][_0xe0b0('0xdf')]=_0x4bd799[_0xe0b0('0xdd')][_0xe0b0('0xe0')];_0x4bd799['body'][_0xe0b0('0x47')]=_0x4bd799['file']['mimetype'];return db[_0xe0b0('0xe1')][_0xe0b0('0xbc')](_0x4bd799[_0xe0b0('0x38')])['then'](respondWithResult(_0x2102bc,0xc9))['catch'](handleError(_0x2102bc,null));};exports[_0xe0b0('0xe2')]=function(_0x3c207e,_0x4fc379,_0x98e7c9){return db[_0xe0b0('0x44')][_0xe0b0('0xc0')]({'where':{'id':_0x3c207e[_0xe0b0('0xb7')]['id']},'raw':!![]})[_0xe0b0('0x20')](handleEntityNotFound(_0x4fc379,null))[_0xe0b0('0x20')](function(_0x4074bb){if(_0x4074bb){if(_0x4074bb[_0xe0b0('0xd9')]){return _0x4fc379[_0xe0b0('0x29')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xe0b0('0xe1')][_0xe0b0('0xc0')]({'where':{'id':_0x3c207e[_0xe0b0('0x49')][_0xe0b0('0xe3')]},'raw':!![]})[_0xe0b0('0x20')](handleEntityNotFound(_0x4fc379,null));}})[_0xe0b0('0x20')](function(_0x54f90a){if(_0x54f90a){var _0x1aa40b=_0x54f90a[_0xe0b0('0xe4')]!==null;var _0x22c8a2=path[_0xe0b0('0xe5')](config[_0xe0b0('0xe6')],'server/files/attachments/');if(_0x1aa40b){_0x22c8a2=path[_0xe0b0('0xe5')](_0x22c8a2,_0xe0b0('0xe7'));}var _0x321b0b=path[_0xe0b0('0xe5')](_0x22c8a2,_0x54f90a[_0xe0b0('0xdf')]);return _0x4fc379[_0xe0b0('0xe8')](_0x321b0b);}})[_0xe0b0('0x27')](handleError(_0x4fc379,null));};exports[_0xe0b0('0xe9')]=function(_0x1ccfc1,_0x2b1474){var _0x574f0a=null;var _0x108371=null;var _0x3f2ec=null;var _0x4f0db7=null;if(_0x1ccfc1[_0xe0b0('0x38')]['id']){delete _0x1ccfc1['body']['id'];}if(_0x1ccfc1[_0xe0b0('0x38')][_0xe0b0('0xea')]){_0x4f0db7=path['join'](config[_0xe0b0('0xe6')],_0xe0b0('0xeb'),util[_0xe0b0('0xec')](_0xe0b0('0xed'),Date[_0xe0b0('0xee')]()));_0x1ccfc1[_0xe0b0('0x38')][_0xe0b0('0xef')]=_0x4f0db7;}return db['ChatInteraction']['find']({'where':{'id':_0x1ccfc1[_0xe0b0('0xb7')]['id']},'include':[{'model':db[_0xe0b0('0xf0')],'as':_0xe0b0('0xf1'),'include':[{'model':db['User'],'as':_0xe0b0('0x78')}]}]})[_0xe0b0('0x20')](handleEntityNotFound(_0x2b1474,null))[_0xe0b0('0x20')](saveUpdates(_0x1ccfc1[_0xe0b0('0x38')],null))[_0xe0b0('0x20')](function(_0x117d00){if(_0x117d00){_0x574f0a=_0x117d00;return db[_0xe0b0('0xbf')][_0xe0b0('0x6b')]({'where':{'id':_0x574f0a[_0xe0b0('0x9c')]}});}})[_0xe0b0('0x20')](function(_0x5aa313){if(_0x5aa313){_0x3f2ec=_0x5aa313;return db['CmContact'][_0xe0b0('0x6b')]({'where':{'id':_0x574f0a[_0xe0b0('0x74')]}});}})[_0xe0b0('0x20')](function(_0x3c93c6){if(_0x3c93c6){_0x108371=_0x3c93c6;if(_0x4f0db7){var _0x203351=null;for(var _0x343409=0x1;_0x343409<_0x574f0a[_0xe0b0('0xf1')]['length'];++_0x343409){_0x203351=_0x574f0a[_0xe0b0('0xf1')][_0x343409];var _0x2e7fe2=_0x203351[_0xe0b0('0x7a')]?util['format'](_0xe0b0('0xf2'),_0x3f2ec[_0xe0b0('0xf3')],_0x203351['UserId']):'System';var _0x3b3473=_0x1ccfc1['body'][_0xe0b0('0xf4')]||util['format'](_0xe0b0('0xf2'),_0xe0b0('0xf5'),_0x203351['ContactId']);switch(_0x3f2ec[_0xe0b0('0xf6')]){case _0xe0b0('0xf7'):_0x2e7fe2=_0x203351['UserId']?util[_0xe0b0('0xec')]('%s%d',_0x3f2ec[_0xe0b0('0xf3')],_0x203351[_0xe0b0('0x7a')]):_0xe0b0('0xf8');break;case _0xe0b0('0xf9'):_0x2e7fe2=_0x203351[_0xe0b0('0x7a')]?_0x203351[_0xe0b0('0x78')][_0xe0b0('0xfa')]||_0x203351['User'][_0xe0b0('0xc5')]:_0xe0b0('0xf8');break;case'agent_fullname':_0x2e7fe2=_0x203351['UserId']?_0x203351[_0xe0b0('0x78')]['fullname']:_0xe0b0('0xf8');break;default:_0x2e7fe2=_0x203351[_0xe0b0('0x7a')]?util[_0xe0b0('0xec')](_0xe0b0('0xf2'),_0x3f2ec[_0xe0b0('0xf3')],_0x203351[_0xe0b0('0x7a')]):_0xe0b0('0xf8');}var _0x8364b0=util[_0xe0b0('0xec')](_0xe0b0('0xfb'),moment(_0x203351[_0xe0b0('0x7e')])[_0xe0b0('0xec')](_0xe0b0('0xfc')),_0x203351[_0xe0b0('0xfd')]==='in'?_0x3b3473:_0x2e7fe2,_0x203351['body']);if(!_0x203351[_0xe0b0('0xfe')]){fs[_0xe0b0('0xff')](_0x4f0db7,_0x8364b0);}}return db[_0xe0b0('0x100')][_0xe0b0('0xc0')]({'where':{'service':!![]},'include':[{'model':db[_0xe0b0('0x101')],'as':'Smtp','raw':!![]}]});}}})[_0xe0b0('0x20')](function(_0x3a75d8){if(_0x3a75d8&&_0x3a75d8[_0xe0b0('0x102')]&&_0x1ccfc1[_0xe0b0('0x38')]){var _0x1e2ef8={'tls':{'rejectUnauthorized':![]}};if(_0x3a75d8[_0xe0b0('0x102')]['service']){_0x1e2ef8[_0xe0b0('0x103')]=_0x3a75d8['Smtp'][_0xe0b0('0x103')];}else{_0x1e2ef8[_0xe0b0('0x104')]=_0x3a75d8[_0xe0b0('0x102')][_0xe0b0('0x104')];_0x1e2ef8[_0xe0b0('0x105')]=_0x3a75d8[_0xe0b0('0x102')]['port'];_0x1e2ef8[_0xe0b0('0x106')]=_0x3a75d8[_0xe0b0('0x102')][_0xe0b0('0x106')];}if(_0x3a75d8[_0xe0b0('0x102')][_0xe0b0('0x107')]){_0x1e2ef8[_0xe0b0('0x108')]={'user':_0x3a75d8[_0xe0b0('0x102')][_0xe0b0('0x99')],'pass':_0x3a75d8['Smtp']['pass']};}return respondWithRpcPromise(_0xe0b0('0x109'),'sendMail',{'account':_0x1e2ef8,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x3a75d8['name'],_0x3a75d8[_0xe0b0('0xc6')]||_0x3a75d8['Smtp']['user']),'to':_0x1ccfc1[_0xe0b0('0x38')][_0xe0b0('0xea')],'subject':_0xe0b0('0x10a'),'text':util[_0xe0b0('0xec')](_0xe0b0('0x10b'),_0x1ccfc1[_0xe0b0('0x38')][_0xe0b0('0xea')]),'attachments':[{'path':_0x4f0db7}]}})[_0xe0b0('0x20')](function(){return _0x574f0a;})[_0xe0b0('0x27')](function(_0x43f1b1){console['error'](_0x43f1b1);});}else{return _0x574f0a;}})['then'](respondWithStatusCode(_0x2b1474,0xc8))[_0xe0b0('0x27')](handleError(_0x2b1474,null));};exports[_0xe0b0('0x10c')]=function(_0x2b8a03,_0x4f784a,_0x4b5a48){return db[_0xe0b0('0xf0')]['find']({'where':{'id':_0x2b8a03[_0xe0b0('0xb7')]['id']}})[_0xe0b0('0x20')](handleEntityNotFound(_0x4f784a,null))['then'](function(_0x2e393e){if(_0x2e393e){return _0x2e393e[_0xe0b0('0x10c')](_0x2b8a03[_0xe0b0('0x38')][_0xe0b0('0x10d')],_[_0xe0b0('0x10e')](_0x2b8a03[_0xe0b0('0x38')],[_0xe0b0('0x10d'),'id'])||{});}})['then'](respondWithResult(_0x4f784a,null))[_0xe0b0('0x27')](handleError(_0x4f784a,null));};exports[_0xe0b0('0x10f')]=function(_0x1f3162,_0x22da3a,_0x2b2c68){var _0x5c5c2d={'raw':![],'where':{}};var _0x4d6429={};var _0x322d1b={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x1f3162[_0xe0b0('0xb7')]['id']}})['then'](handleEntityNotFound(_0x22da3a,null))[_0xe0b0('0x20')](function(_0x151da2){if(_0x151da2){_0x4d6429[_0xe0b0('0x4c')]=_[_0xe0b0('0x4a')](db['ChatMessage']['rawAttributes']);_0x4d6429[_0xe0b0('0x49')]=_[_0xe0b0('0x4a')](_0x1f3162[_0xe0b0('0x49')]);_0x4d6429[_0xe0b0('0xb8')]=_[_0xe0b0('0x4b')](_0x4d6429[_0xe0b0('0x4c')],_0x4d6429[_0xe0b0('0x49')]);_0x5c5c2d[_0xe0b0('0x4e')]=_['intersection'](_0x4d6429[_0xe0b0('0x4c')],qs[_0xe0b0('0x4d')](_0x1f3162[_0xe0b0('0x49')]['fields']));_0x5c5c2d[_0xe0b0('0x4e')]=_0x5c5c2d[_0xe0b0('0x4e')][_0xe0b0('0x4f')]?_0x5c5c2d[_0xe0b0('0x4e')]:_0x4d6429[_0xe0b0('0x4c')];if(!_0x1f3162[_0xe0b0('0x49')]['hasOwnProperty'](_0xe0b0('0x110'))){_0x5c5c2d[_0xe0b0('0x2e')]=qs[_0xe0b0('0x2e')](_0x1f3162['query'][_0xe0b0('0x2e')]);_0x5c5c2d[_0xe0b0('0x2c')]=qs[_0xe0b0('0x2c')](_0x1f3162[_0xe0b0('0x49')]['offset']);}_0x5c5c2d[_0xe0b0('0x51')]=qs[_0xe0b0('0x52')](_0x1f3162[_0xe0b0('0x49')][_0xe0b0('0x52')]);_0x5c5c2d[_0xe0b0('0x7c')]=qs[_0xe0b0('0xb8')](_[_0xe0b0('0x53')](_0x1f3162[_0xe0b0('0x49')],_0x4d6429['filters']));_0x5c5c2d[_0xe0b0('0x7c')]['ChatInteractionId']=_0x151da2['id'];if(_0x1f3162['query'][_0xe0b0('0x88')]){_0x5c5c2d[_0xe0b0('0x7c')]=_[_0xe0b0('0x37')](_0x5c5c2d['where'],{'$or':_[_0xe0b0('0x3d')](_0x5c5c2d['attributes'],function(_0xf0c217){var _0x4c5406={};_0x4c5406[_0xf0c217]={'$like':'%'+_0x1f3162['query']['filter']+'%'};return _0x4c5406;})});}if(_0x1f3162[_0xe0b0('0x49')][_0xe0b0('0x80')]){var _0x55e013=_0x1f3162[_0xe0b0('0x49')]['$gte']['split'](',');var _0x31fa9d={};_0x31fa9d[_0x55e013[0x0]]={'$gte':moment(_0x55e013[0x1])['format'](_0xe0b0('0x111'))};_0x5c5c2d[_0xe0b0('0x7c')]=_[_0xe0b0('0x37')](_0x5c5c2d[_0xe0b0('0x7c')],_0x31fa9d);}_0x5c5c2d=_['merge']({},_0x5c5c2d,_0x1f3162[_0xe0b0('0xbb')]);return db[_0xe0b0('0xf0')][_0xe0b0('0x2f')]({'where':_0x5c5c2d[_0xe0b0('0x7c')]})[_0xe0b0('0x20')](function(_0x51600e){_0x322d1b[_0xe0b0('0x2f')]=_0x51600e;if(_0x1f3162[_0xe0b0('0x49')]['includeAll']){_0x5c5c2d[_0xe0b0('0xba')]=[{'all':!![]}];}return db['ChatMessage'][_0xe0b0('0x112')](_0x5c5c2d);})[_0xe0b0('0x20')](function(_0x1e0374){_0x322d1b[_0xe0b0('0xb5')]=_0x1e0374;return _0x322d1b;});}})[_0xe0b0('0x20')](respondWithFilteredResult(_0x22da3a,_0x5c5c2d))[_0xe0b0('0x27')](handleError(_0x22da3a,null));};exports[_0xe0b0('0x113')]=function(_0x5b7b02,_0x565f67,_0x2853bf){var _0x4c0d9d={'where':{}},_0x38dd79={},_0x2dc446={'count':0x0,'rows':[]};return db[_0xe0b0('0x44')][_0xe0b0('0xc0')]({'where':{'id':_0x5b7b02[_0xe0b0('0xb7')]['id']}})[_0xe0b0('0x20')](handleEntityNotFound(_0x565f67,null))['then'](function(_0x5996a6){if(_0x5996a6){_0x38dd79[_0xe0b0('0x4c')]=_[_0xe0b0('0x4a')](db['ChatMessage'][_0xe0b0('0x45')]);_0x38dd79[_0xe0b0('0x49')]=_['keys'](_0x5b7b02[_0xe0b0('0x49')]);_0x38dd79[_0xe0b0('0xb8')]=_[_0xe0b0('0x4b')](_0x38dd79['model'],_0x38dd79[_0xe0b0('0x49')]);_0x4c0d9d[_0xe0b0('0x4e')]=_[_0xe0b0('0x4b')](_0x38dd79[_0xe0b0('0x4c')],qs['fields'](_0x5b7b02[_0xe0b0('0x49')]['fields']));_0x4c0d9d[_0xe0b0('0x4e')]=_0x4c0d9d[_0xe0b0('0x4e')][_0xe0b0('0x4f')]?_0x4c0d9d['attributes']:_0x38dd79[_0xe0b0('0x4c')];if(!_0x5b7b02[_0xe0b0('0x49')][_0xe0b0('0x50')](_0xe0b0('0x110'))){_0x4c0d9d['limit']=qs[_0xe0b0('0x2e')](_0x5b7b02[_0xe0b0('0x49')][_0xe0b0('0x2e')]);_0x4c0d9d[_0xe0b0('0x2c')]=qs[_0xe0b0('0x2c')](_0x5b7b02[_0xe0b0('0x49')]['offset']);}_0x4c0d9d['order']=qs['sort'](_0x5b7b02[_0xe0b0('0x49')]['sort']);_0x4c0d9d[_0xe0b0('0x7c')]=qs['filters'](_['pick'](_0x5b7b02[_0xe0b0('0x49')],_0x38dd79[_0xe0b0('0xb8')]));_0x4c0d9d[_0xe0b0('0x7c')][_0xe0b0('0xb3')]=_0x5996a6['id'];if(_0x5b7b02[_0xe0b0('0x49')][_0xe0b0('0x88')]){_0x4c0d9d[_0xe0b0('0x7c')]=_['merge'](_0x4c0d9d[_0xe0b0('0x7c')],{'$or':_[_0xe0b0('0x3d')](_0x4c0d9d[_0xe0b0('0x4e')],function(_0x15033e){var _0x14ba21={};_0x14ba21[_0x15033e]={'$like':'%'+_0x5b7b02[_0xe0b0('0x49')]['filter']+'%'};return _0x14ba21;})});}_0x4c0d9d['where'][_0xe0b0('0xfe')]=![];if(_0x5b7b02[_0xe0b0('0x49')]['id']){_0x4c0d9d[_0xe0b0('0x7c')]['id']={'$gt':_0x5b7b02[_0xe0b0('0x49')]['id']};}_0x4c0d9d=_[_0xe0b0('0x37')]({},_0x4c0d9d,_0x5b7b02[_0xe0b0('0xbb')]);return db[_0xe0b0('0xf0')]['count']({'where':_0x4c0d9d['where']})[_0xe0b0('0x20')](function(_0x16386b){_0x2dc446[_0xe0b0('0x2f')]=_0x16386b;_0x4c0d9d['include']=[];if(_0x5b7b02['query'][_0xe0b0('0x114')]){_0x4c0d9d[_0xe0b0('0xba')][_0xe0b0('0x42')]({'model':db[_0xe0b0('0x78')],'as':_0xe0b0('0x78'),'attributes':['id',_0xe0b0('0xc5'),_0xe0b0('0xfa')]});}if(_0x5b7b02[_0xe0b0('0x49')][_0xe0b0('0xb9')]){_0x4c0d9d[_0xe0b0('0xba')]=[{'all':!![]}];}return db['ChatMessage'][_0xe0b0('0x112')](_0x4c0d9d);})['then'](function(_0x2df3df){_0x2dc446['rows']=_0x2df3df;return _0x2dc446;});}})[_0xe0b0('0x20')](respondWithFilteredResult(_0x565f67,_0x4c0d9d))[_0xe0b0('0x27')](handleError(_0x565f67,null));};exports['addTags']=function(_0x236966,_0x41fd0e,_0x17e7d4){return db['ChatInteraction'][_0xe0b0('0x6b')]({'where':{'id':_0x236966[_0xe0b0('0xb7')]['id']}})['then'](handleEntityNotFound(_0x41fd0e,null))[_0xe0b0('0x20')](function(_0x19dafb){if(_0x19dafb){return _0x19dafb['setTags'](_0x236966['body'][_0xe0b0('0x10d')],_[_0xe0b0('0x10e')](_0x236966['body'],['ids','id'])||{})[_0xe0b0('0x115')](function(){return db['Tag'][_0xe0b0('0x112')]({'attributes':['id',_0xe0b0('0x48'),_0xe0b0('0x55')],'where':{'id':_0x236966[_0xe0b0('0x38')][_0xe0b0('0x10d')]}});})[_0xe0b0('0x20')](function(_0x36106e){socket['emit'](_0xe0b0('0x116'),{'id':Number(_0x236966['params']['id']),'tags':_0x36106e||[]});return{'id':Number(_0x236966['params']['id']),'tags':_0x36106e||[]};});}})['then'](respondWithResult(_0x41fd0e,null))[_0xe0b0('0x27')](handleError(_0x41fd0e,null));};exports[_0xe0b0('0x117')]=function(_0x263288,_0x7117ca,_0x21ccfe){return db['ChatInteraction']['find']({'where':{'id':_0x263288['params']['id']}})['then'](handleEntityNotFound(_0x7117ca,null))[_0xe0b0('0x20')](function(_0x1bd420){if(_0x1bd420){return _0x1bd420[_0xe0b0('0x117')](_0x263288['query'][_0xe0b0('0x10d')]);}})[_0xe0b0('0x20')](respondWithStatusCode(_0x7117ca,null))[_0xe0b0('0x27')](handleError(_0x7117ca,null));};exports[_0xe0b0('0xe8')]=function(_0x2d2852,_0x16a02b){var _0x125ead=moment()['unix']()[_0xe0b0('0x9e')]();var _0x380fe1=path[_0xe0b0('0xe5')](config[_0xe0b0('0xe6')],'server',_0xe0b0('0x118'),_0xe0b0('0x119'));var _0x3eb643=path[_0xe0b0('0xe5')](config['root'],'server',_0xe0b0('0x118'),_0xe0b0('0x11a'));var _0x26bd6c=path[_0xe0b0('0xe5')](_0x380fe1,_0x125ead);var _0x104409=util[_0xe0b0('0xec')]('transcript-%d-%s.zip',_0x2d2852[_0xe0b0('0xb7')]['id'],_0x125ead);var _0x6f9dbd=path[_0xe0b0('0xe5')](_0x380fe1,_0x104409);var _0x4c6646=[];_0x4c6646[_0xe0b0('0x42')]({'model':db['User'],'as':_0xe0b0('0x78'),'attributes':['id',_0xe0b0('0xc5')],'raw':!![]});_0x4c6646['push']({'model':db[_0xe0b0('0xd3')],'as':'Contact','attributes':['id','firstName',_0xe0b0('0x11b')],'raw':!![]});if(_0x2d2852['query']['attachments']){_0x4c6646['push']({'model':db[_0xe0b0('0xe1')],'as':_0xe0b0('0xe1'),'raw':!![]});}var _0x573ca9=[{'model':db[_0xe0b0('0xf0')],'as':'Messages','attributes':['id',_0xe0b0('0x38'),_0xe0b0('0x7e'),_0xe0b0('0xfd'),_0xe0b0('0xfe'),'read'],'include':_0x4c6646}];_0x573ca9['push']({'model':db['ChatWebsite'],'as':_0xe0b0('0x11c'),'attributes':['id',_0xe0b0('0x48')]});_0x573ca9['push']({'model':db['User'],'as':_0xe0b0('0x11d'),'attributes':['id',_0xe0b0('0xc5')]});return db[_0xe0b0('0x44')][_0xe0b0('0x6b')]({'where':{'id':_0x2d2852['params']['id']},'include':_0x573ca9})['then'](handleEntityNotFound(_0x16a02b,null))[_0xe0b0('0x20')](function(_0x329684){if(_0x329684){var _0x5b1bb7=_0x329684[_0xe0b0('0x11e')]({'plain':!![]});fs[_0xe0b0('0x11f')](_0x26bd6c);var _0x5b7df1={'channel':'Chat','account':_0x5b1bb7['Account'][_0xe0b0('0x48')],'agent':_0x5b1bb7[_0xe0b0('0x11d')]?_0x5b1bb7['Owner'][_0xe0b0('0xc5')]:_0xe0b0('0x120'),'createdAt':moment(_0x5b1bb7[_0xe0b0('0x7e')])[_0xe0b0('0xec')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe0b0('0x9e')](),'closedAt':_0x5b1bb7[_0xe0b0('0xd9')]?moment(_0x5b1bb7['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe0b0('0x9e')]():'','disposition':_0x5b1bb7['disposition'],'chatInfo':{'browser':_0x5b1bb7[_0xe0b0('0x121')],'os':_0x5b1bb7['osName'],'referer':_0x5b1bb7['referer'],'customerIp':_0x5b1bb7[_0xe0b0('0x122')],'customerPort':_0x5b1bb7[_0xe0b0('0x123')]?_0x5b1bb7[_0xe0b0('0x123')]:_0xe0b0('0x120')},'messages':_(_0x5b1bb7['Messages'])['tail']()['filter']({'secret':![]})['map'](function(_0x26a916){if(_0x26a916[_0xe0b0('0xe1')]){var _0x5b5bb2=path['join'](_0x3eb643,_0x26a916[_0xe0b0('0xe1')][_0xe0b0('0xdf')]);if(fs['existsSync'](_0x5b5bb2)){fs[_0xe0b0('0x124')](_0x5b5bb2)[_0xe0b0('0x125')](fs[_0xe0b0('0x126')](path[_0xe0b0('0xe5')](_0x26bd6c,_0x26a916['Attachment'][_0xe0b0('0xdf')])));}}return{'date':moment(_0x26a916[_0xe0b0('0x7e')])[_0xe0b0('0xec')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe0b0('0x9e')](),'sender':_0x26a916[_0xe0b0('0xfd')]===_0xe0b0('0xd0')?_0x26a916[_0xe0b0('0x78')]?_0x26a916['User'][_0xe0b0('0xc5')]:_0xe0b0('0xf8'):_0x26a916[_0xe0b0('0xd4')][_0xe0b0('0x127')]+(_0x26a916[_0xe0b0('0xd4')]['lastName']?'\x20'+_0x26a916[_0xe0b0('0xd4')][_0xe0b0('0x11b')]:''),'body':_0x26a916['Attachment']?_0x26a916[_0xe0b0('0xe1')][_0xe0b0('0xdf')]:_0x26a916[_0xe0b0('0x38')],'direction':_0x26a916[_0xe0b0('0xfd')]===_0xe0b0('0xd0')?'A':'C','secret':_0x26a916[_0xe0b0('0xfe')],'read':_0x26a916['read'],'attachment':_0x26a916[_0xe0b0('0xe1')]};})[_0xe0b0('0x6d')]()};return ejs[_0xe0b0('0x128')](path[_0xe0b0('0xe5')](config[_0xe0b0('0xe6')],_0xe0b0('0x129'),_0xe0b0('0x12a'),_0xe0b0('0x12b')),{'interaction':_0x5b7df1})[_0xe0b0('0x20')](function(_0x1f5871){var _0x4d12b2=path[_0xe0b0('0xe5')](_0x26bd6c,'transcript-'+_0x5b1bb7['id']+'-'+_0x125ead+_0xe0b0('0x12c'));var _0x4b655d={'path':_0x4d12b2,'channel':'Chat','interactionId':_0x5b1bb7['id']};return pdf[_0xe0b0('0x12d')](_0x1f5871,_0x4b655d);})[_0xe0b0('0x20')](function(){return new BPromise(function(_0x5b8cef,_0x4d4eae){zipdir(_0x26bd6c,{'saveTo':_0x6f9dbd},function(_0x388f0d,_0x317dee){if(_0x388f0d)return _0x4d4eae(_0x388f0d);return _0x5b8cef(_0x317dee);});})['then'](function(){return new BPromise(function(_0x5501c2,_0xa7f2cf){rimraf(_0x26bd6c,function(_0x2c61b3){if(_0x2c61b3)_0xa7f2cf(_0x2c61b3);return _0x5501c2();});});})['then'](function(){return _0x16a02b[_0xe0b0('0xe8')](_0x6f9dbd,_0x104409,function(_0x465315){if(_0x465315){console[_0xe0b0('0x12e')](_0xe0b0('0x12f'),_0x465315);}else{fs['unlinkSync'](_0x6f9dbd);}});});});}else{return _0x16a02b[_0xe0b0('0x28')](0xc8);}})[_0xe0b0('0x27')](handleError(_0x16a02b,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index de52a2d..c4ac573 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 _0xd7c7=['setDataValue','Users','unreadMessages','length','emit','catch','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xd7c7,0x173));var _0x7d7c=function(_0x4994cb,_0x22cdd3){_0x4994cb=_0x4994cb-0x0;var _0x3324d0=_0xd7c7[_0x4994cb];return _0x3324d0;};'use strict';var EventEmitter=require(_0x7d7c('0x0'));var ChatInteraction=require(_0x7d7c('0x1'))['db'][_0x7d7c('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x7d7c('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7d7c('0x4'),'afterUpdate':_0x7d7c('0x5'),'afterDestroy':_0x7d7c('0x6')};function emitEvent(_0x4e0814){return function(_0x101771,_0xe2cf4c,_0x1fd274){_0x101771['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x11b9b7){_0x101771[_0x7d7c('0x7')](_0x7d7c('0x8'),_0x11b9b7['map'](function(_0x5c5581){return{'id':_0x5c5581['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x101771['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1bb75f){_0x101771[_0x7d7c('0x7')](_0x7d7c('0x9'),_0x1bb75f[_0x7d7c('0xa')]);ChatInteractionEvents[_0x7d7c('0xb')](_0x4e0814+':'+_0x101771['id'],_0x101771);ChatInteractionEvents[_0x7d7c('0xb')](_0x4e0814,_0x101771);_0x1fd274(null);})[_0x7d7c('0xc')](_0x1fd274(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x7d7c('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0x3252=['remove','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x3252,0xfa));var _0x2325=function(_0x3f09da,_0x3f67dd){_0x3f09da=_0x3f09da-0x0;var _0x137875=_0x3252[_0x3f09da];return _0x137875;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x2325('0x0'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x2325('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2325('0x2')](0x0);var events={'afterCreate':_0x2325('0x3'),'afterUpdate':_0x2325('0x4'),'afterDestroy':_0x2325('0x5')};function emitEvent(_0x4a8e17){return function(_0x2dc435,_0x12c376,_0x51a82d){_0x2dc435[_0x2325('0x6')]({'attributes':['id'],'raw':!![]})[_0x2325('0x7')](function(_0x501e80){_0x2dc435[_0x2325('0x8')](_0x2325('0x9'),_0x501e80['map'](function(_0xab9702){return{'id':_0xab9702['id']};}));return ChatMessage[_0x2325('0xa')]({'where':{'ChatInteractionId':_0x2dc435['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2325('0x7')](function(_0xf9c157){_0x2dc435[_0x2325('0x8')]('unreadMessages',_0xf9c157[_0x2325('0xb')]);ChatInteractionEvents[_0x2325('0xc')](_0x4a8e17+':'+_0x2dc435['id'],_0x2dc435);ChatInteractionEvents[_0x2325('0xc')](_0x4a8e17,_0x2dc435);_0x51a82d(null);})[_0x2325('0xd')](_0x51a82d(null));};}for(var e in events){if(events[_0x2325('0xe')](e)){var event=events[e];ChatInteraction[_0x2325('0xf')](e,emitEvent(event));}}module[_0x2325('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 1dcdce6..904b13e 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 _0x7c80=['ChatInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4810b8,_0x549a3c){var _0x505e94=function(_0x81186c){while(--_0x81186c){_0x4810b8['push'](_0x4810b8['shift']());}};_0x505e94(++_0x549a3c);}(_0x7c80,0x7e));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x07c8('0x0'));var logger=require(_0x07c8('0x1'))('api');var moment=require(_0x07c8('0x2'));var BPromise=require(_0x07c8('0x3'));var rp=require(_0x07c8('0x4'));var fs=require('fs');var path=require(_0x07c8('0x5'));var rimraf=require(_0x07c8('0x6'));var config=require(_0x07c8('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x07c8('0x8')]=function(_0x376e35,_0x16696f){return _0x376e35[_0x07c8('0x9')](_0x07c8('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32960c,_0x2a6b16,_0x4c33c0){if(_0x32960c['changed'](_0x07c8('0xb'))){_0x32960c[_0x07c8('0xc')]=moment()[_0x07c8('0xd')](_0x07c8('0xe'));}_0x4c33c0(null,_0x32960c);}},'charset':_0x07c8('0xf'),'collate':_0x07c8('0x10')});}; \ No newline at end of file +var _0x52ed=['moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','api'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x52ed,0x95));var _0xd52e=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0x52ed[_0x52bfa5];return _0x26f80b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd52e('0x0'));var moment=require(_0xd52e('0x1'));var BPromise=require(_0xd52e('0x2'));var rp=require(_0xd52e('0x3'));var fs=require('fs');var path=require(_0xd52e('0x4'));var rimraf=require('rimraf');var config=require(_0xd52e('0x5'));var attributes=require(_0xd52e('0x6'));module[_0xd52e('0x7')]=function(_0x3c334c,_0x1cd56f){return _0x3c334c[_0xd52e('0x8')]('ChatInteraction',attributes,{'tableName':_0xd52e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x151bc9,_0x2bcbcd,_0x24855d){if(_0x151bc9[_0xd52e('0xa')]('closed')){_0x151bc9[_0xd52e('0xb')]=moment()[_0xd52e('0xc')](_0xd52e('0xd'));}_0x24855d(null,_0x151bc9);}},'charset':'utf8mb4','collate':_0xd52e('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 20b2ecc..bacd130 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 _0xaf87=['../../config/environment','jayson/promise','client','redis','localhost','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateChatInteraction','ChatInteraction','update','options','attributes','catch','addTags','ids','omit','body','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf87,0x1b4));var _0x7af8=function(_0x1077a9,_0x2f4705){_0x1077a9=_0x1077a9-0x0;var _0x273e1c=_0xaf87[_0x1077a9];return _0x273e1c;};'use strict';var _=require(_0x7af8('0x0'));var util=require(_0x7af8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7af8('0x2'));var fs=require('fs');var Redis=require(_0x7af8('0x3'));var db=require(_0x7af8('0x4'))['db'];var utils=require(_0x7af8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7af8('0x6'));var jayson=require(_0x7af8('0x7'));var client=jayson[_0x7af8('0x8')]['http']({'port':0x232a});config[_0x7af8('0x9')]=_['defaults'](config[_0x7af8('0x9')],{'host':_0x7af8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7af8('0x9')]));require('./chatInteraction.socket')[_0x7af8('0xb')](socket);function respondWithRpcPromise(_0x7e4330,_0x232925,_0x15cd0a){return new BPromise(function(_0x5582b1,_0x5d55e6){return client[_0x7af8('0xc')](_0x7e4330,_0x15cd0a)['then'](function(_0x585403){logger[_0x7af8('0xd')](_0x7af8('0xe'),_0x232925,_0x7af8('0xf'));logger[_0x7af8('0x10')](_0x7af8('0x11'),_0x232925,'request\x20sent',JSON[_0x7af8('0x12')](_0x585403));if(_0x585403[_0x7af8('0x13')]){if(_0x585403[_0x7af8('0x13')]['code']===0x1f4){logger[_0x7af8('0x13')](_0x7af8('0xe'),_0x232925,_0x585403['error'][_0x7af8('0x14')]);return _0x5d55e6(_0x585403[_0x7af8('0x13')][_0x7af8('0x14')]);}logger[_0x7af8('0x13')](_0x7af8('0xe'),_0x232925,_0x585403[_0x7af8('0x13')][_0x7af8('0x14')]);return _0x5582b1(_0x585403['error'][_0x7af8('0x14')]);}else{logger[_0x7af8('0xd')](_0x7af8('0xe'),_0x232925,_0x7af8('0xf'));_0x5582b1(_0x585403[_0x7af8('0x15')]['message']);}})['catch'](function(_0x3e89bd){logger[_0x7af8('0x13')](_0x7af8('0xe'),_0x232925,_0x3e89bd);_0x5d55e6(_0x3e89bd);});});}exports[_0x7af8('0x16')]=function(_0x153eaf){var _0x33e7dc=this;return new Promise(function(_0x556fb8,_0x30713c){return db[_0x7af8('0x17')][_0x7af8('0x18')](_0x153eaf['body'],{'raw':_0x153eaf['options']?_0x153eaf[_0x7af8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153eaf[_0x7af8('0x19')]?_0x153eaf[_0x7af8('0x19')]['where']||null:null,'attributes':_0x153eaf['options']?_0x153eaf[_0x7af8('0x19')][_0x7af8('0x1a')]||null:null,'limit':_0x153eaf['options']?_0x153eaf[_0x7af8('0x19')]['limit']||null:null})['then'](function(_0x476989){logger[_0x7af8('0xd')](_0x7af8('0x16'),_0x153eaf);logger[_0x7af8('0x10')](_0x7af8('0x16'),_0x153eaf,JSON[_0x7af8('0x12')](_0x476989));_0x556fb8(_0x476989);})[_0x7af8('0x1b')](function(_0x3b389c){logger['error'](_0x7af8('0x16'),_0x3b389c[_0x7af8('0x14')],_0x153eaf);_0x30713c(_0x33e7dc[_0x7af8('0x13')](0x1f4,_0x3b389c['message']));});});};exports['AddTagsToChatInteraction']=function(_0x5ae03c){return new Promise(function(_0x20c614,_0x2c8205){return db[_0x7af8('0x17')]['find']({'where':_0x5ae03c[_0x7af8('0x19')]?_0x5ae03c[_0x7af8('0x19')]['where']||null:null})['then'](function(_0x2f5018){if(_0x2f5018){return _0x2f5018[_0x7af8('0x1c')](_0x5ae03c['body'][_0x7af8('0x1d')],_[_0x7af8('0x1e')](_0x5ae03c[_0x7af8('0x1f')],['ids','id'])||{});}})[_0x7af8('0x20')](function(_0x540c69){logger[_0x7af8('0xd')](_0x7af8('0x21'),_0x5ae03c);logger[_0x7af8('0x10')](_0x7af8('0x21'),_0x5ae03c,JSON[_0x7af8('0x12')](_0x540c69));_0x20c614(_0x540c69);})[_0x7af8('0x1b')](function(_0x3040f8){logger[_0x7af8('0x13')]('AddTags',_0x3040f8[_0x7af8('0x14')],_0x5ae03c);_0x2c8205(_this[_0x7af8('0x13')](0x1f4,_0x3040f8[_0x7af8('0x14')]));});});}; \ No newline at end of file +var _0x3e13=['debug','request\x20sent','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info'];(function(_0x10c4a6,_0x4b5076){var _0x142255=function(_0x2c3ba0){while(--_0x2c3ba0){_0x10c4a6['push'](_0x10c4a6['shift']());}};_0x142255(++_0x4b5076);}(_0x3e13,0x1ad));var _0x33e1=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x3e13[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x33e1('0x0'));var util=require(_0x33e1('0x1'));var moment=require(_0x33e1('0x2'));var BPromise=require(_0x33e1('0x3'));var rs=require(_0x33e1('0x4'));var fs=require('fs');var Redis=require(_0x33e1('0x5'));var db=require(_0x33e1('0x6'))['db'];var utils=require(_0x33e1('0x7'));var logger=require(_0x33e1('0x8'))(_0x33e1('0x9'));var config=require(_0x33e1('0xa'));var jayson=require(_0x33e1('0xb'));var client=jayson[_0x33e1('0xc')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x33e1('0xd')],{'host':_0x33e1('0xe'),'port':0x18eb});var socket=require(_0x33e1('0xf'))(new Redis(config['redis']));require(_0x33e1('0x10'))[_0x33e1('0x11')](socket);function respondWithRpcPromise(_0xce2d91,_0x3557a3,_0x2147b1){return new BPromise(function(_0x2c0787,_0x4ef433){return client[_0x33e1('0x12')](_0xce2d91,_0x2147b1)[_0x33e1('0x13')](function(_0x5a7cf5){logger[_0x33e1('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x3557a3,'request\x20sent');logger[_0x33e1('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3557a3,_0x33e1('0x16'),JSON[_0x33e1('0x17')](_0x5a7cf5));if(_0x5a7cf5['error']){if(_0x5a7cf5['error']['code']===0x1f4){logger[_0x33e1('0x18')](_0x33e1('0x19'),_0x3557a3,_0x5a7cf5[_0x33e1('0x18')][_0x33e1('0x1a')]);return _0x4ef433(_0x5a7cf5['error'][_0x33e1('0x1a')]);}logger[_0x33e1('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x3557a3,_0x5a7cf5[_0x33e1('0x18')][_0x33e1('0x1a')]);return _0x2c0787(_0x5a7cf5[_0x33e1('0x18')][_0x33e1('0x1a')]);}else{logger[_0x33e1('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x3557a3,_0x33e1('0x16'));_0x2c0787(_0x5a7cf5[_0x33e1('0x1b')]['message']);}})[_0x33e1('0x1c')](function(_0x429904){logger[_0x33e1('0x18')](_0x33e1('0x19'),_0x3557a3,_0x429904);_0x4ef433(_0x429904);});});}exports[_0x33e1('0x1d')]=function(_0x7d5ed0){var _0x42a398=this;return new Promise(function(_0x11e611,_0x127bab){return db[_0x33e1('0x1e')][_0x33e1('0x1f')](_0x7d5ed0[_0x33e1('0x20')],{'raw':_0x7d5ed0[_0x33e1('0x21')]?_0x7d5ed0[_0x33e1('0x21')][_0x33e1('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7d5ed0[_0x33e1('0x21')]?_0x7d5ed0[_0x33e1('0x21')][_0x33e1('0x23')]||null:null,'attributes':_0x7d5ed0['options']?_0x7d5ed0['options'][_0x33e1('0x24')]||null:null,'limit':_0x7d5ed0['options']?_0x7d5ed0[_0x33e1('0x21')][_0x33e1('0x25')]||null:null})['then'](function(_0x153877){logger['info']('UpdateChatInteraction',_0x7d5ed0);logger[_0x33e1('0x15')](_0x33e1('0x1d'),_0x7d5ed0,JSON[_0x33e1('0x17')](_0x153877));_0x11e611(_0x153877);})[_0x33e1('0x1c')](function(_0x320af6){logger[_0x33e1('0x18')]('UpdateChatInteraction',_0x320af6[_0x33e1('0x1a')],_0x7d5ed0);_0x127bab(_0x42a398[_0x33e1('0x18')](0x1f4,_0x320af6[_0x33e1('0x1a')]));});});};exports[_0x33e1('0x26')]=function(_0x348105){return new Promise(function(_0x4b94ec,_0x3d7b22){return db[_0x33e1('0x1e')][_0x33e1('0x27')]({'where':_0x348105[_0x33e1('0x21')]?_0x348105[_0x33e1('0x21')]['where']||null:null})[_0x33e1('0x13')](function(_0x3caa75){if(_0x3caa75){return _0x3caa75[_0x33e1('0x28')](_0x348105[_0x33e1('0x20')][_0x33e1('0x29')],_[_0x33e1('0x2a')](_0x348105[_0x33e1('0x20')],[_0x33e1('0x29'),'id'])||{});}})[_0x33e1('0x2b')](function(_0x2abc36){logger[_0x33e1('0x14')](_0x33e1('0x2c'),_0x348105);logger[_0x33e1('0x15')](_0x33e1('0x2c'),_0x348105,JSON[_0x33e1('0x17')](_0x2abc36));_0x4b94ec(_0x2abc36);})[_0x33e1('0x1c')](function(_0x5f1402){logger[_0x33e1('0x18')]('AddTags',_0x5f1402['message'],_0x348105);_0x3d7b22(_this[_0x33e1('0x18')](0x1f4,_0x5f1402[_0x33e1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index bf85c74..dd373c7 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 _0xe01b=['emit','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x39ded1,_0xaee436){var _0x2e248e=function(_0x193df3){while(--_0x193df3){_0x39ded1['push'](_0x39ded1['shift']());}};_0x2e248e(++_0xaee436);}(_0xe01b,0x7a));var _0xbe01=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xe01b[_0x256b72];return _0x2183e3;};'use strict';var ChatInteractionEvents=require(_0xbe01('0x0'));var events=[_0xbe01('0x1'),_0xbe01('0x2'),_0xbe01('0x3')];function createListener(_0x4c5001,_0x1ac197){return function(_0x353a07){_0x1ac197[_0xbe01('0x4')](_0x4c5001,_0x353a07);};}function removeListener(_0x30091f,_0x54b073){return function(){ChatInteractionEvents['removeListener'](_0x30091f,_0x54b073);};}exports['register']=function(_0x1d6b7f){for(var _0x2a70dd=0x0,_0x47bc30=events[_0xbe01('0x5')];_0x2a70dd<_0x47bc30;_0x2a70dd++){var _0x233497=events[_0x2a70dd];var _0x90f4=createListener(_0xbe01('0x6')+_0x233497,_0x1d6b7f);ChatInteractionEvents['on'](_0x233497,_0x90f4);}}; \ No newline at end of file +var _0x4471=['chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x286ba0,_0x2f328){var _0xb2a15e=function(_0x553614){while(--_0x553614){_0x286ba0['push'](_0x286ba0['shift']());}};_0xb2a15e(++_0x2f328);}(_0x4471,0x151));var _0x1447=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x4471[_0x2be8c2];return _0x97f531;};'use strict';var ChatInteractionEvents=require(_0x1447('0x0'));var events=[_0x1447('0x1'),_0x1447('0x2'),_0x1447('0x3')];function createListener(_0x2fa009,_0x41a135){return function(_0x454b58){_0x41a135[_0x1447('0x4')](_0x2fa009,_0x454b58);};}function removeListener(_0x2587f3,_0x1be2dd){return function(){ChatInteractionEvents[_0x1447('0x5')](_0x2587f3,_0x1be2dd);};}exports['register']=function(_0x526d64){for(var _0x325a0f=0x0,_0x2f5832=events[_0x1447('0x6')];_0x325a0f<_0x2f5832;_0x325a0f++){var _0x2ac509=events[_0x325a0f];var _0x23f35e=createListener(_0x1447('0x7')+_0x2ac509,_0x526d64);ChatInteractionEvents['on'](_0x2ac509,_0x23f35e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0e03a3e..891777e 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 _0xa9f4=['attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','addTags','put','tracked','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xa9f4,0xbe));var _0x4a9f=function(_0xb3192b,_0x7d4ca8){_0xb3192b=_0xb3192b-0x0;var _0x55c461=_0xa9f4[_0xb3192b];return _0x55c461;};'use strict';var multer=require(_0x4a9f('0x0'));var util=require(_0x4a9f('0x1'));var path=require(_0x4a9f('0x2'));var timeout=require(_0x4a9f('0x3'));var express=require(_0x4a9f('0x4'));var router=express[_0x4a9f('0x5')]();var fs_extra=require(_0x4a9f('0x6'));var auth=require(_0x4a9f('0x7'));var interaction=require(_0x4a9f('0x8'));var config=require(_0x4a9f('0x9'));var controller=require(_0x4a9f('0xa'));router[_0x4a9f('0xb')]('/',auth[_0x4a9f('0xc')](),controller[_0x4a9f('0xd')]);router[_0x4a9f('0xb')](_0x4a9f('0xe'),auth['isAuthenticated'](),controller[_0x4a9f('0xf')]);router[_0x4a9f('0xb')](_0x4a9f('0x10'),auth[_0x4a9f('0x11')](),controller['show']);router[_0x4a9f('0xb')]('/:id/attachment_download',auth[_0x4a9f('0x11')](),controller[_0x4a9f('0x12')]);router['get'](_0x4a9f('0x13'),auth[_0x4a9f('0xc')](),controller['getMessages']);router['get'](_0x4a9f('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x4a9f('0x15')]);router[_0x4a9f('0xb')]('/:id/download',auth[_0x4a9f('0xc')](),controller[_0x4a9f('0x16')]);router[_0x4a9f('0x17')]('/',auth[_0x4a9f('0xc')](),controller['create']);router['post'](_0x4a9f('0x18'),auth[_0x4a9f('0xc')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x4a9f('0x19')]({'destination':function(_0x9c193a,_0x4be61b,_0x568fc1){_0x568fc1(null,path['join'](config[_0x4a9f('0x1a')],_0x4a9f('0x1b')));},'filename':function(_0x5064cf,_0x571148,_0x469197){_0x469197(null,util[_0x4a9f('0x1c')](_0x4a9f('0x1d'),Date[_0x4a9f('0x1e')](),_0x571148[_0x4a9f('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4a9f('0x17')](_0x4a9f('0x20'),upload[_0x4a9f('0x21')](_0x4a9f('0x22')),controller[_0x4a9f('0x23')]);router['post'](_0x4a9f('0x13'),auth[_0x4a9f('0x11')](),controller[_0x4a9f('0x24')]);router[_0x4a9f('0x17')](_0x4a9f('0x25'),auth[_0x4a9f('0xc')](),interaction['tracked'](_0x4a9f('0x26'),'chatinteraction:addtags'),controller[_0x4a9f('0x27')]);router[_0x4a9f('0x28')](_0x4a9f('0x10'),auth[_0x4a9f('0xc')](),interaction[_0x4a9f('0x29')](_0x4a9f('0x26'),_0x4a9f('0x2a')),controller[_0x4a9f('0x2b')]);router[_0x4a9f('0x28')]('/:id/custom_update',controller[_0x4a9f('0x2c')]);router[_0x4a9f('0x28')](_0x4a9f('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0x4a9f('0x2e')]);router[_0x4a9f('0x28')](_0x4a9f('0x2f'),controller[_0x4a9f('0x30')]);router[_0x4a9f('0x31')](_0x4a9f('0x10'),auth[_0x4a9f('0xc')](),interaction[_0x4a9f('0x29')]('chat','chatinteraction:destroy'),controller[_0x4a9f('0x32')]);router[_0x4a9f('0x31')](_0x4a9f('0x25'),auth[_0x4a9f('0xc')](),controller[_0x4a9f('0x33')]);module['exports']=router; \ No newline at end of file +var _0x4969=['now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','update','abandon','chatinteraction:destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','diskStorage','join','root','server/files/attachments/','%s-%s'];(function(_0x209e6a,_0x34e31a){var _0x226857=function(_0x1f317e){while(--_0x1f317e){_0x209e6a['push'](_0x209e6a['shift']());}};_0x226857(++_0x34e31a);}(_0x4969,0x6c));var _0x9496=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0x4969[_0x228641];return _0x5d5d78;};'use strict';var multer=require(_0x9496('0x0'));var util=require(_0x9496('0x1'));var path=require('path');var timeout=require(_0x9496('0x2'));var express=require(_0x9496('0x3'));var router=express[_0x9496('0x4')]();var fs_extra=require(_0x9496('0x5'));var auth=require(_0x9496('0x6'));var interaction=require(_0x9496('0x7'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x9496('0x8')](),controller[_0x9496('0x9')]);router[_0x9496('0xa')](_0x9496('0xb'),auth[_0x9496('0x8')](),controller[_0x9496('0xc')]);router['get']('/:id',auth[_0x9496('0xd')](),controller['show']);router['get'](_0x9496('0xe'),auth[_0x9496('0xd')](),controller['attachmentDownload']);router[_0x9496('0xa')](_0x9496('0xf'),auth[_0x9496('0x8')](),controller[_0x9496('0x10')]);router[_0x9496('0xa')](_0x9496('0x11'),auth[_0x9496('0xd')](),controller[_0x9496('0x12')]);router[_0x9496('0xa')](_0x9496('0x13'),auth['isAuthenticated'](),controller[_0x9496('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9496('0x15')]('/:id/vidaoo',auth[_0x9496('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x9496('0x16')]({'destination':function(_0x557e4c,_0x20dc1d,_0x367ec8){_0x367ec8(null,path[_0x9496('0x17')](config[_0x9496('0x18')],_0x9496('0x19')));},'filename':function(_0x5397ec,_0x30764e,_0x7b5f90){_0x7b5f90(null,util['format'](_0x9496('0x1a'),Date[_0x9496('0x1b')](),_0x30764e[_0x9496('0x1c')][_0x9496('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9496('0x15')](_0x9496('0x1e'),upload[_0x9496('0x1f')]('file'),controller[_0x9496('0x20')]);router[_0x9496('0x15')](_0x9496('0xf'),auth[_0x9496('0xd')](),controller[_0x9496('0x21')]);router[_0x9496('0x15')](_0x9496('0x22'),auth[_0x9496('0x8')](),interaction[_0x9496('0x23')](_0x9496('0x24'),_0x9496('0x25')),controller[_0x9496('0x26')]);router[_0x9496('0x27')](_0x9496('0x28'),auth[_0x9496('0x8')](),interaction[_0x9496('0x23')]('chat','chatinteraction:update'),controller[_0x9496('0x29')]);router[_0x9496('0x27')]('/:id/custom_update',controller['customUpdate']);router[_0x9496('0x27')]('/:id/abandon',auth[_0x9496('0xd')](),controller[_0x9496('0x2a')]);router['put']('/:id/close',controller['close']);router['delete'](_0x9496('0x28'),auth['isAuthenticated'](),interaction['tracked'](_0x9496('0x24'),_0x9496('0x2b')),controller['destroy']);router['delete']('/:id/tags',auth[_0x9496('0x8')](),controller['removeTags']);module[_0x9496('0x2c')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 8e6b99f..288f7ba 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 _0x57f5=['TEXT','INTEGER','exports'];(function(_0x4642b0,_0x541c72){var _0x5e52d3=function(_0x50b0ed){while(--_0x50b0ed){_0x4642b0['push'](_0x4642b0['shift']());}};_0x5e52d3(++_0x541c72);}(_0x57f5,0xfb));var _0x557f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x57f5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x557f('0x0')]={'body':{'type':Sequelize[_0x557f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x557f('0x2')]}}; \ No newline at end of file +var _0xce61=['exports','BOOLEAN','INTEGER'];(function(_0x5970a6,_0x449be8){var _0x1f6652=function(_0x527e6f){while(--_0x527e6f){_0x5970a6['push'](_0x5970a6['shift']());}};_0x1f6652(++_0x449be8);}(_0xce61,0x66));var _0x1ce6=function(_0x26e256,_0x1b4a13){_0x26e256=_0x26e256-0x0;var _0x12ae29=_0xce61[_0x26e256];return _0x12ae29;};'use strict';var Sequelize=require('sequelize');module[_0x1ce6('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1ce6('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1ce6('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ed54cff..b09a7b7 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 _0xb8cb=['stack','name','send','index','map','rawAttributes','fieldName','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','ChatInternalMessage','includeAll','include','findAll','catch','length','options','find','create','body','params','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','push','createdAt','FromId','ToId','read','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error'];(function(_0x4a2acb,_0x263021){var _0x3ec7fa=function(_0x218fbf){while(--_0x218fbf){_0x4a2acb['push'](_0x4a2acb['shift']());}};_0x3ec7fa(++_0x263021);}(_0xb8cb,0x188));var _0xbb8c=function(_0x2cf4f1,_0x81dac6){_0x2cf4f1=_0x2cf4f1-0x0;var _0x574a66=_0xb8cb[_0x2cf4f1];return _0x574a66;};'use strict';var emlformat=require(_0xbb8c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb8c('0x1'));var jsonpatch=require(_0xbb8c('0x2'));var rp=require(_0xbb8c('0x3'));var moment=require(_0xbb8c('0x4'));var BPromise=require(_0xbb8c('0x5'));var Mustache=require(_0xbb8c('0x6'));var util=require('util');var path=require(_0xbb8c('0x7'));var sox=require('sox');var csv=require(_0xbb8c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb8c('0x9'));var _=require('lodash');var squel=require(_0xbb8c('0xa'));var crypto=require(_0xbb8c('0xb'));var jsforce=require(_0xbb8c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb8c('0xd'));var Redis=require(_0xbb8c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb8c('0xf'));var hardwareService=require(_0xbb8c('0x10'));var logger=require(_0xbb8c('0x11'))(_0xbb8c('0x12'));var utils=require(_0xbb8c('0x13'));var config=require(_0xbb8c('0x14'));var licenseUtil=require(_0xbb8c('0x15'));var db=require(_0xbb8c('0x16'))['db'];config[_0xbb8c('0x17')]=_[_0xbb8c('0x18')](config['redis'],{'host':_0xbb8c('0x19'),'port':0x18eb});var socket=require(_0xbb8c('0x1a'))(new Redis(config['redis']));require(_0xbb8c('0x1b'))[_0xbb8c('0x1c')](socket);function respondWithStatusCode(_0x19380b,_0x52bb2b){_0x52bb2b=_0x52bb2b||0xcc;return function(_0x349904){if(_0x349904){return _0x19380b[_0xbb8c('0x1d')](_0x52bb2b);}return _0x19380b[_0xbb8c('0x1e')](_0x52bb2b)['end']();};}function respondWithResult(_0x4b35c7,_0x61482a){_0x61482a=_0x61482a||0xc8;return function(_0x5a7a11){if(_0x5a7a11){return _0x4b35c7['status'](_0x61482a)['json'](_0x5a7a11);}};}function respondWithFilteredResult(_0x531d54,_0x1042e5){return function(_0x32d077){if(_0x32d077){var _0x28789b=typeof _0x1042e5[_0xbb8c('0x1f')]==='undefined'&&typeof _0x1042e5[_0xbb8c('0x20')]==='undefined';var _0x967293=_0x32d077[_0xbb8c('0x21')];var _0x3096b3=_0x28789b?0x0:_0x1042e5[_0xbb8c('0x1f')];var _0x5162b1=_0x28789b?_0x32d077['count']:_0x1042e5[_0xbb8c('0x1f')]+_0x1042e5[_0xbb8c('0x20')];var _0x5845ee;if(_0x5162b1>=_0x967293){_0x5162b1=_0x967293;_0x5845ee=0xc8;}else{_0x5845ee=0xce;}_0x531d54['status'](_0x5845ee);return _0x531d54[_0xbb8c('0x22')](_0xbb8c('0x23'),_0x3096b3+'-'+_0x5162b1+'/'+_0x967293)[_0xbb8c('0x24')](_0x32d077);}return null;};}function patchUpdates(_0x648b55){return function(_0x5ecc08){try{jsonpatch[_0xbb8c('0x25')](_0x5ecc08,_0x648b55,!![]);}catch(_0x5307b1){return BPromise['reject'](_0x5307b1);}return _0x5ecc08[_0xbb8c('0x26')]();};}function saveUpdates(_0x177581,_0x2d572f){return function(_0x124c6e){if(_0x124c6e){return _0x124c6e[_0xbb8c('0x27')](_0x177581)[_0xbb8c('0x28')](function(_0x212529){return _0x212529;});}return null;};}function removeEntity(_0x3c158a,_0x365723){return function(_0x2303f8){if(_0x2303f8){return _0x2303f8[_0xbb8c('0x29')]()[_0xbb8c('0x28')](function(){_0x3c158a[_0xbb8c('0x1e')](0xcc)[_0xbb8c('0x2a')]();});}};}function handleEntityNotFound(_0xe69607,_0x446238){return function(_0xfd53a6){if(!_0xfd53a6){_0xe69607[_0xbb8c('0x1d')](0x194);}return _0xfd53a6;};}function handleError(_0x18713a,_0x4cc480){_0x4cc480=_0x4cc480||0x1f4;return function(_0x554030){logger[_0xbb8c('0x2b')](_0x554030[_0xbb8c('0x2c')]);if(_0x554030[_0xbb8c('0x2d')]){delete _0x554030[_0xbb8c('0x2d')];}_0x18713a[_0xbb8c('0x1e')](_0x4cc480)[_0xbb8c('0x2e')](_0x554030);};}exports[_0xbb8c('0x2f')]=function(_0x5461b0,_0x504951){var _0x5ba687={},_0x439d66={},_0xd51612={'count':0x0,'rows':[]};var _0x58a85f=_[_0xbb8c('0x30')](db['ChatInternalMessage'][_0xbb8c('0x31')],function(_0x1d58d4){return{'name':_0x1d58d4[_0xbb8c('0x32')],'type':_0x1d58d4['type']['key']};});_0x439d66['model']=_[_0xbb8c('0x30')](_0x58a85f,_0xbb8c('0x2d'));_0x439d66['query']=_[_0xbb8c('0x33')](_0x5461b0[_0xbb8c('0x34')]);_0x439d66[_0xbb8c('0x35')]=_[_0xbb8c('0x36')](_0x439d66['model'],_0x439d66['query']);_0x5ba687['attributes']=_[_0xbb8c('0x36')](_0x439d66[_0xbb8c('0x37')],qs[_0xbb8c('0x38')](_0x5461b0['query'][_0xbb8c('0x38')]));_0x5ba687[_0xbb8c('0x39')]=_0x5ba687[_0xbb8c('0x39')]['length']?_0x5ba687[_0xbb8c('0x39')]:_0x439d66[_0xbb8c('0x37')];if(!_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x3a')](_0xbb8c('0x3b'))){_0x5ba687[_0xbb8c('0x20')]=qs['limit'](_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x20')]);_0x5ba687[_0xbb8c('0x1f')]=qs[_0xbb8c('0x1f')](_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x1f')]);}_0x5ba687[_0xbb8c('0x3c')]=qs[_0xbb8c('0x3d')](_0x5461b0[_0xbb8c('0x34')]['sort']);_0x5ba687['where']=qs[_0xbb8c('0x35')](_[_0xbb8c('0x3e')](_0x5461b0[_0xbb8c('0x34')],_0x439d66[_0xbb8c('0x35')]),_0x58a85f);if(_0x5461b0['query'][_0xbb8c('0x3f')]){_0x5ba687[_0xbb8c('0x40')]=_['merge'](_0x5ba687['where'],{'$or':_[_0xbb8c('0x30')](_0x58a85f,function(_0xae6228){if(_0xae6228[_0xbb8c('0x41')]!==_0xbb8c('0x42')){var _0x1e82f7={};_0x1e82f7[_0xae6228[_0xbb8c('0x2d')]]={'$like':'%'+_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x3f')]+'%'};return _0x1e82f7;}})});}_0x5ba687=_[_0xbb8c('0x43')]({},_0x5ba687,_0x5461b0['options']);var _0x3984a4={'where':_0x5ba687[_0xbb8c('0x40')]};return db[_0xbb8c('0x44')]['count'](_0x3984a4)[_0xbb8c('0x28')](function(_0x3df52d){_0xd51612[_0xbb8c('0x21')]=_0x3df52d;if(_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x45')]){_0x5ba687[_0xbb8c('0x46')]=[{'all':!![]}];}return db[_0xbb8c('0x44')][_0xbb8c('0x47')](_0x5ba687);})['then'](function(_0xe5acfa){_0xd51612['rows']=_0xe5acfa;return _0xd51612;})['then'](respondWithFilteredResult(_0x504951,_0x5ba687))[_0xbb8c('0x48')](handleError(_0x504951,null));};exports['show']=function(_0x1e3513,_0x3079e7){var _0x1fff72={'raw':!![],'where':{'id':_0x1e3513['params']['id']}},_0x56af41={};_0x56af41[_0xbb8c('0x37')]=_[_0xbb8c('0x33')](db[_0xbb8c('0x44')][_0xbb8c('0x31')]);_0x56af41[_0xbb8c('0x34')]=_['keys'](_0x1e3513[_0xbb8c('0x34')]);_0x56af41[_0xbb8c('0x35')]=_['intersection'](_0x56af41['model'],_0x56af41[_0xbb8c('0x34')]);_0x1fff72[_0xbb8c('0x39')]=_[_0xbb8c('0x36')](_0x56af41[_0xbb8c('0x37')],qs[_0xbb8c('0x38')](_0x1e3513['query'][_0xbb8c('0x38')]));_0x1fff72[_0xbb8c('0x39')]=_0x1fff72[_0xbb8c('0x39')][_0xbb8c('0x49')]?_0x1fff72[_0xbb8c('0x39')]:_0x56af41[_0xbb8c('0x37')];if(_0x1e3513[_0xbb8c('0x34')][_0xbb8c('0x45')]){_0x1fff72[_0xbb8c('0x46')]=[{'all':!![]}];}_0x1fff72=_['merge']({},_0x1fff72,_0x1e3513[_0xbb8c('0x4a')]);return db[_0xbb8c('0x44')][_0xbb8c('0x4b')](_0x1fff72)[_0xbb8c('0x28')](handleEntityNotFound(_0x3079e7,null))[_0xbb8c('0x28')](respondWithResult(_0x3079e7,null))[_0xbb8c('0x48')](handleError(_0x3079e7,null));};exports[_0xbb8c('0x4c')]=function(_0x5666ff,_0x4cf050){return db[_0xbb8c('0x44')][_0xbb8c('0x4c')](_0x5666ff[_0xbb8c('0x4d')],{})[_0xbb8c('0x28')](respondWithResult(_0x4cf050,0xc9))['catch'](handleError(_0x4cf050,null));};exports[_0xbb8c('0x27')]=function(_0x4253ee,_0x1b1e0e){if(_0x4253ee[_0xbb8c('0x4d')]['id']){delete _0x4253ee[_0xbb8c('0x4d')]['id'];}return db[_0xbb8c('0x44')][_0xbb8c('0x4b')]({'where':{'id':_0x4253ee[_0xbb8c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1b1e0e,null))[_0xbb8c('0x28')](saveUpdates(_0x4253ee[_0xbb8c('0x4d')],null))[_0xbb8c('0x28')](respondWithResult(_0x1b1e0e,null))[_0xbb8c('0x48')](handleError(_0x1b1e0e,null));};exports[_0xbb8c('0x29')]=function(_0x5a40fa,_0x25627c){return db[_0xbb8c('0x44')][_0xbb8c('0x4b')]({'where':{'id':_0x5a40fa['params']['id']}})[_0xbb8c('0x28')](handleEntityNotFound(_0x25627c,null))[_0xbb8c('0x28')](removeEntity(_0x25627c,null))[_0xbb8c('0x48')](handleError(_0x25627c,null));};exports[_0xbb8c('0x4f')]=function(_0x497234,_0x234ef9){return db[_0xbb8c('0x44')]['describe']()[_0xbb8c('0x28')](respondWithResult(_0x234ef9,null))['catch'](handleError(_0x234ef9,null));};function wrapUser(_0x1554b8){return function(_0x4d4f1e){var _0x2cd664=_0x1554b8[_0xbb8c('0x50')]({'plain':!![]});_0x2cd664[_0xbb8c('0x51')]=[];if(_0x4d4f1e){_0x2cd664[_0xbb8c('0x52')]=_0x4d4f1e['createdAt'];_0x2cd664['lastMessage']=_0x4d4f1e;}else{_0x2cd664[_0xbb8c('0x52')]=moment(0x0)[_0xbb8c('0x53')](_0xbb8c('0x54'));_0x2cd664[_0xbb8c('0x55')]={};}return _0x2cd664;};}exports[_0xbb8c('0x56')]=function(_0x420230,_0x5e1414,_0x2a92ab){var _0x30318d=[];return db[_0xbb8c('0x57')][_0xbb8c('0x47')]({'where':{'role':[_0xbb8c('0x58'),_0xbb8c('0x59'),_0xbb8c('0x5a')]},'attributes':['id','fullname',_0xbb8c('0x2d'),_0xbb8c('0x5b'),_0xbb8c('0x5c'),_0xbb8c('0x5d'),'online',_0xbb8c('0x5e'),_0xbb8c('0x5f'),_0xbb8c('0x60')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0xbb8c('0x2d'),_0xbb8c('0x41')],'through':{'attributes':[]}}]})[_0xbb8c('0x28')](function(_0x3e2734){if(_0x3e2734){var _0x266a40=_0x420230[_0xbb8c('0x5a')][_0xbb8c('0x50')]({'plain':!![]});if(!_0x266a40)throw new Error(_0xbb8c('0x61'));if(_0x266a40[_0xbb8c('0x5b')]==='user'){return db[_0xbb8c('0x62')][_0xbb8c('0x4b')]({'where':{'name':_0xbb8c('0x63'),'userProfileId':_0x266a40[_0xbb8c('0x64')]},'raw':!![]})[_0xbb8c('0x28')](function(_0x4326a5){if(_0x4326a5){if(_0x4326a5[_0xbb8c('0x65')]===0x0){return db[_0xbb8c('0x66')][_0xbb8c('0x47')]({'where':{'sectionId':_0x4326a5['id']},'raw':!![]})[_0xbb8c('0x28')](function(_0x2d0d15){var _0x2ff6de=[];if(_['isEmpty'](_0x2d0d15)){_0x2ff6de=_[_0xbb8c('0x3f')](_0x3e2734,function(_0x4d869c){if(_0x4d869c[_0xbb8c('0x5b')]!==_0xbb8c('0x58')){return _0x4d869c;}});return _0x2ff6de;}else{for(var _0x4e2f59=0x0;_0x4e2f59<_0x3e2734[_0xbb8c('0x49')];_0x4e2f59++){var _0x308f9a=_0x3e2734[_0x4e2f59];if(_0x308f9a['role']===_0xbb8c('0x58')){var _0x1f77b2=_[_0xbb8c('0x4b')](_0x2d0d15,function(_0x24a4df){return _0x24a4df['resourceId']===_0x308f9a['id'];});if(_0x1f77b2)_0x2ff6de[_0xbb8c('0x67')](_0x308f9a);}else{_0x2ff6de[_0xbb8c('0x67')](_0x308f9a);}}return _0x2ff6de;}});}else{return _0x3e2734;}}else{var _0x18ae02=_[_0xbb8c('0x3f')](_0x3e2734,function(_0x3d5dc2){if(_0x3d5dc2['role']!==_0xbb8c('0x58')){return _0x3d5dc2;}});return _0x18ae02;}});}else{return _0x3e2734;}}})['then'](function(_0x884903){var _0x45a512=[];if(_0x884903){_0x30318d=_0x884903;for(var _0x40de9c=0x0;_0x40de9c<_0x884903[_0xbb8c('0x49')];_0x40de9c+=0x1){_0x30318d[_0x40de9c][_0xbb8c('0x51')]=[];_0x45a512[_0xbb8c('0x67')](db[_0xbb8c('0x44')][_0xbb8c('0x4b')]({'where':{'FromId':[_0x420230['user']['id'],_0x884903[_0x40de9c]['id']],'ToId':[_0x420230[_0xbb8c('0x5a')]['id'],_0x884903[_0x40de9c]['id']],'ChatGroupId':null},'attributes':['id',_0xbb8c('0x68'),_0xbb8c('0x69'),_0xbb8c('0x6a'),_0xbb8c('0x6b'),_0xbb8c('0x4d')],'order':qs[_0xbb8c('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xbb8c('0x28')](wrapUser(_0x884903[_0x40de9c])));}return BPromise[_0xbb8c('0x6c')](_0x45a512);}return[];})[_0xbb8c('0x28')](function(_0x3e8728){return{'rows':_0x3e8728,'count':_0x3e8728['length']};})['then'](respondWithResult(_0x5e1414,null))[_0xbb8c('0x48')](handleError(_0x5e1414,null));}; \ No newline at end of file +var _0x82d8=['save','update','destroy','then','status','error','stack','name','send','index','map','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','ChatInternalMessage','findAll','rows','catch','params','includeAll','include','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','offset','undefined','count','limit','set','json','apply','reject'];(function(_0xd6801c,_0x40d989){var _0x4427f3=function(_0x120743){while(--_0x120743){_0xd6801c['push'](_0xd6801c['shift']());}};_0x4427f3(++_0x40d989);}(_0x82d8,0x185));var _0x882d=function(_0x2b117b,_0x458732){_0x2b117b=_0x2b117b-0x0;var _0x4f468d=_0x82d8[_0x2b117b];return _0x4f468d;};'use strict';var emlformat=require(_0x882d('0x0'));var rimraf=require(_0x882d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x882d('0x2'));var rp=require(_0x882d('0x3'));var moment=require(_0x882d('0x4'));var BPromise=require(_0x882d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x882d('0x6'));var csv=require(_0x882d('0x7'));var ejs=require(_0x882d('0x8'));var fs=require('fs');var fs_extra=require(_0x882d('0x9'));var _=require(_0x882d('0xa'));var squel=require('squel');var crypto=require(_0x882d('0xb'));var jsforce=require(_0x882d('0xc'));var deskjs=require(_0x882d('0xd'));var toCsv=require(_0x882d('0x7'));var querystring=require(_0x882d('0xe'));var Papa=require(_0x882d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x882d('0x10'));var as=require(_0x882d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x882d('0x12'))(_0x882d('0x13'));var utils=require(_0x882d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x882d('0x15'));var db=require(_0x882d('0x16'))['db'];config[_0x882d('0x17')]=_[_0x882d('0x18')](config[_0x882d('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x882d('0x17')]));require('./chatInternalMessage.socket')[_0x882d('0x19')](socket);function respondWithStatusCode(_0x4fbcf7,_0x2238f0){_0x2238f0=_0x2238f0||0xcc;return function(_0x2f5396){if(_0x2f5396){return _0x4fbcf7[_0x882d('0x1a')](_0x2238f0);}return _0x4fbcf7['status'](_0x2238f0)['end']();};}function respondWithResult(_0x5b20c4,_0x10640e){_0x10640e=_0x10640e||0xc8;return function(_0xee504e){if(_0xee504e){return _0x5b20c4['status'](_0x10640e)['json'](_0xee504e);}};}function respondWithFilteredResult(_0xe80651,_0x47543a){return function(_0x45553a){if(_0x45553a){var _0x43fc72=typeof _0x47543a[_0x882d('0x1b')]===_0x882d('0x1c')&&typeof _0x47543a['limit']===_0x882d('0x1c');var _0x5dec90=_0x45553a[_0x882d('0x1d')];var _0x5ee0a8=_0x43fc72?0x0:_0x47543a[_0x882d('0x1b')];var _0x37cd26=_0x43fc72?_0x45553a['count']:_0x47543a['offset']+_0x47543a[_0x882d('0x1e')];var _0x305c78;if(_0x37cd26>=_0x5dec90){_0x37cd26=_0x5dec90;_0x305c78=0xc8;}else{_0x305c78=0xce;}_0xe80651['status'](_0x305c78);return _0xe80651[_0x882d('0x1f')]('Content-Range',_0x5ee0a8+'-'+_0x37cd26+'/'+_0x5dec90)[_0x882d('0x20')](_0x45553a);}return null;};}function patchUpdates(_0x3d215b){return function(_0x17a0e1){try{jsonpatch[_0x882d('0x21')](_0x17a0e1,_0x3d215b,!![]);}catch(_0x412542){return BPromise[_0x882d('0x22')](_0x412542);}return _0x17a0e1[_0x882d('0x23')]();};}function saveUpdates(_0x3e6085,_0x407e40){return function(_0x31345c){if(_0x31345c){return _0x31345c[_0x882d('0x24')](_0x3e6085)['then'](function(_0x3fc5ff){return _0x3fc5ff;});}return null;};}function removeEntity(_0x570c35,_0x87364b){return function(_0x107c69){if(_0x107c69){return _0x107c69[_0x882d('0x25')]()[_0x882d('0x26')](function(){_0x570c35[_0x882d('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589d5a,_0x2509aa){return function(_0x3b08b7){if(!_0x3b08b7){_0x589d5a['sendStatus'](0x194);}return _0x3b08b7;};}function handleError(_0x4fc853,_0x27aa8a){_0x27aa8a=_0x27aa8a||0x1f4;return function(_0xcb4372){logger[_0x882d('0x28')](_0xcb4372[_0x882d('0x29')]);if(_0xcb4372[_0x882d('0x2a')]){delete _0xcb4372[_0x882d('0x2a')];}_0x4fc853[_0x882d('0x27')](_0x27aa8a)[_0x882d('0x2b')](_0xcb4372);};}exports[_0x882d('0x2c')]=function(_0x346882,_0x4bca43){var _0x16c556={},_0xc9adad={},_0xd7d861={'count':0x0,'rows':[]};var _0x3fdfd6=_[_0x882d('0x2d')](db['ChatInternalMessage'][_0x882d('0x2e')],function(_0x543c68){return{'name':_0x543c68['fieldName'],'type':_0x543c68[_0x882d('0x2f')]['key']};});_0xc9adad['model']=_[_0x882d('0x2d')](_0x3fdfd6,_0x882d('0x2a'));_0xc9adad[_0x882d('0x30')]=_[_0x882d('0x31')](_0x346882[_0x882d('0x30')]);_0xc9adad['filters']=_[_0x882d('0x32')](_0xc9adad[_0x882d('0x33')],_0xc9adad[_0x882d('0x30')]);_0x16c556[_0x882d('0x34')]=_[_0x882d('0x32')](_0xc9adad['model'],qs[_0x882d('0x35')](_0x346882[_0x882d('0x30')][_0x882d('0x35')]));_0x16c556[_0x882d('0x34')]=_0x16c556[_0x882d('0x34')][_0x882d('0x36')]?_0x16c556[_0x882d('0x34')]:_0xc9adad[_0x882d('0x33')];if(!_0x346882['query'][_0x882d('0x37')](_0x882d('0x38'))){_0x16c556['limit']=qs[_0x882d('0x1e')](_0x346882[_0x882d('0x30')][_0x882d('0x1e')]);_0x16c556[_0x882d('0x1b')]=qs[_0x882d('0x1b')](_0x346882['query'][_0x882d('0x1b')]);}_0x16c556['order']=qs[_0x882d('0x39')](_0x346882[_0x882d('0x30')][_0x882d('0x39')]);_0x16c556[_0x882d('0x3a')]=qs[_0x882d('0x3b')](_['pick'](_0x346882[_0x882d('0x30')],_0xc9adad[_0x882d('0x3b')]),_0x3fdfd6);if(_0x346882[_0x882d('0x30')][_0x882d('0x3c')]){_0x16c556[_0x882d('0x3a')]=_['merge'](_0x16c556[_0x882d('0x3a')],{'$or':_[_0x882d('0x2d')](_0x3fdfd6,function(_0x1fb118){if(_0x1fb118['type']!==_0x882d('0x3d')){var _0x2cb12a={};_0x2cb12a[_0x1fb118[_0x882d('0x2a')]]={'$like':'%'+_0x346882[_0x882d('0x30')]['filter']+'%'};return _0x2cb12a;}})});}_0x16c556=_[_0x882d('0x3e')]({},_0x16c556,_0x346882[_0x882d('0x3f')]);var _0x2f5dae={'where':_0x16c556[_0x882d('0x3a')]};return db['ChatInternalMessage'][_0x882d('0x1d')](_0x2f5dae)[_0x882d('0x26')](function(_0xfcf3db){_0xd7d861['count']=_0xfcf3db;if(_0x346882['query']['includeAll']){_0x16c556['include']=[{'all':!![]}];}return db[_0x882d('0x40')][_0x882d('0x41')](_0x16c556);})[_0x882d('0x26')](function(_0x543c4c){_0xd7d861[_0x882d('0x42')]=_0x543c4c;return _0xd7d861;})['then'](respondWithFilteredResult(_0x4bca43,_0x16c556))[_0x882d('0x43')](handleError(_0x4bca43,null));};exports['show']=function(_0x51c727,_0x246a32){var _0x175819={'raw':!![],'where':{'id':_0x51c727[_0x882d('0x44')]['id']}},_0x19955e={};_0x19955e[_0x882d('0x33')]=_[_0x882d('0x31')](db['ChatInternalMessage']['rawAttributes']);_0x19955e[_0x882d('0x30')]=_['keys'](_0x51c727[_0x882d('0x30')]);_0x19955e[_0x882d('0x3b')]=_[_0x882d('0x32')](_0x19955e[_0x882d('0x33')],_0x19955e[_0x882d('0x30')]);_0x175819['attributes']=_['intersection'](_0x19955e[_0x882d('0x33')],qs[_0x882d('0x35')](_0x51c727[_0x882d('0x30')][_0x882d('0x35')]));_0x175819[_0x882d('0x34')]=_0x175819[_0x882d('0x34')]['length']?_0x175819[_0x882d('0x34')]:_0x19955e[_0x882d('0x33')];if(_0x51c727[_0x882d('0x30')][_0x882d('0x45')]){_0x175819[_0x882d('0x46')]=[{'all':!![]}];}_0x175819=_[_0x882d('0x3e')]({},_0x175819,_0x51c727['options']);return db[_0x882d('0x40')][_0x882d('0x47')](_0x175819)[_0x882d('0x26')](handleEntityNotFound(_0x246a32,null))[_0x882d('0x26')](respondWithResult(_0x246a32,null))[_0x882d('0x43')](handleError(_0x246a32,null));};exports[_0x882d('0x48')]=function(_0x56cdfe,_0x26e2a5){return db[_0x882d('0x40')][_0x882d('0x48')](_0x56cdfe['body'],{})[_0x882d('0x26')](respondWithResult(_0x26e2a5,0xc9))['catch'](handleError(_0x26e2a5,null));};exports[_0x882d('0x24')]=function(_0x225ff6,_0x352e82){if(_0x225ff6[_0x882d('0x49')]['id']){delete _0x225ff6[_0x882d('0x49')]['id'];}return db[_0x882d('0x40')][_0x882d('0x47')]({'where':{'id':_0x225ff6[_0x882d('0x44')]['id']}})[_0x882d('0x26')](handleEntityNotFound(_0x352e82,null))[_0x882d('0x26')](saveUpdates(_0x225ff6['body'],null))[_0x882d('0x26')](respondWithResult(_0x352e82,null))[_0x882d('0x43')](handleError(_0x352e82,null));};exports[_0x882d('0x25')]=function(_0x945338,_0xbd5669){return db[_0x882d('0x40')][_0x882d('0x47')]({'where':{'id':_0x945338[_0x882d('0x44')]['id']}})[_0x882d('0x26')](handleEntityNotFound(_0xbd5669,null))[_0x882d('0x26')](removeEntity(_0xbd5669,null))[_0x882d('0x43')](handleError(_0xbd5669,null));};exports[_0x882d('0x4a')]=function(_0xf0e39f,_0x482ff4){return db['ChatInternalMessage'][_0x882d('0x4a')]()['then'](respondWithResult(_0x482ff4,null))[_0x882d('0x43')](handleError(_0x482ff4,null));};function wrapUser(_0x421446){return function(_0x1c36d1){var _0x378247=_0x421446[_0x882d('0x4b')]({'plain':!![]});_0x378247[_0x882d('0x4c')]=[];if(_0x1c36d1){_0x378247[_0x882d('0x4d')]=_0x1c36d1[_0x882d('0x4e')];_0x378247[_0x882d('0x4f')]=_0x1c36d1;}else{_0x378247[_0x882d('0x4d')]=moment(0x0)[_0x882d('0x50')](_0x882d('0x51'));_0x378247['lastMessage']={};}return _0x378247;};}exports[_0x882d('0x52')]=function(_0x54522c,_0x467d18,_0x171f95){var _0xc69d8f=[];return db[_0x882d('0x53')]['findAll']({'where':{'role':[_0x882d('0x54'),_0x882d('0x55'),_0x882d('0x56')]},'attributes':['id','fullname',_0x882d('0x2a'),_0x882d('0x57'),_0x882d('0x58'),_0x882d('0x59'),_0x882d('0x5a'),_0x882d('0x5b'),_0x882d('0x5c'),_0x882d('0x5d')],'order':qs[_0x882d('0x39')](_0x882d('0x5e')),'include':[{'model':db['VoiceQueue'],'as':_0x882d('0x5f'),'attributes':['id',_0x882d('0x2a'),_0x882d('0x2f')],'through':{'attributes':[]}}]})[_0x882d('0x26')](function(_0x582d06){if(_0x582d06){var _0xedca71=_0x54522c['user'][_0x882d('0x4b')]({'plain':!![]});if(!_0xedca71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xedca71[_0x882d('0x57')]==='user'){return db['UserProfileSection'][_0x882d('0x47')]({'where':{'name':_0x882d('0x60'),'userProfileId':_0xedca71['userProfileId']},'raw':!![]})['then'](function(_0x3b6ece){if(_0x3b6ece){if(_0x3b6ece[_0x882d('0x61')]===0x0){return db[_0x882d('0x62')][_0x882d('0x41')]({'where':{'sectionId':_0x3b6ece['id']},'raw':!![]})[_0x882d('0x26')](function(_0x248657){var _0x517f53=[];if(_[_0x882d('0x63')](_0x248657)){_0x517f53=_[_0x882d('0x3c')](_0x582d06,function(_0x54621c){if(_0x54621c[_0x882d('0x57')]!=='agent'){return _0x54621c;}});return _0x517f53;}else{for(var _0x4fcd2e=0x0;_0x4fcd2e<_0x582d06[_0x882d('0x36')];_0x4fcd2e++){var _0x2667bb=_0x582d06[_0x4fcd2e];if(_0x2667bb[_0x882d('0x57')]===_0x882d('0x54')){var _0x5e3cb4=_[_0x882d('0x47')](_0x248657,function(_0x3615be){return _0x3615be[_0x882d('0x64')]===_0x2667bb['id'];});if(_0x5e3cb4)_0x517f53[_0x882d('0x65')](_0x2667bb);}else{_0x517f53[_0x882d('0x65')](_0x2667bb);}}return _0x517f53;}});}else{return _0x582d06;}}else{var _0x302f8e=_['filter'](_0x582d06,function(_0x5d312b){if(_0x5d312b[_0x882d('0x57')]!==_0x882d('0x54')){return _0x5d312b;}});return _0x302f8e;}});}else{return _0x582d06;}}})['then'](function(_0x24f7fb){var _0x33fa3e=[];if(_0x24f7fb){_0xc69d8f=_0x24f7fb;for(var _0x5ef805=0x0;_0x5ef805<_0x24f7fb['length'];_0x5ef805+=0x1){_0xc69d8f[_0x5ef805]['messages']=[];_0x33fa3e[_0x882d('0x65')](db[_0x882d('0x40')][_0x882d('0x47')]({'where':{'FromId':[_0x54522c[_0x882d('0x56')]['id'],_0x24f7fb[_0x5ef805]['id']],'ToId':[_0x54522c['user']['id'],_0x24f7fb[_0x5ef805]['id']],'ChatGroupId':null},'attributes':['id',_0x882d('0x4e'),'FromId',_0x882d('0x66'),_0x882d('0x67'),_0x882d('0x49')],'order':qs[_0x882d('0x39')](_0x882d('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x24f7fb[_0x5ef805])));}return BPromise[_0x882d('0x69')](_0x33fa3e);}return[];})[_0x882d('0x26')](function(_0x371ba4){return{'rows':_0x371ba4,'count':_0x371ba4[_0x882d('0x36')]};})[_0x882d('0x26')](respondWithResult(_0x467d18,null))[_0x882d('0x43')](handleError(_0x467d18,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a30b89e..f7e92f5 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 _0x707b=['exports','events','../../mysqldb','ChatInternalMessage','save','emit'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x707b,0xdf));var _0xb707=function(_0x309e57,_0xe1c277){_0x309e57=_0x309e57-0x0;var _0x313c98=_0x707b[_0x309e57];return _0x313c98;};'use strict';var EventEmitter=require(_0xb707('0x0'));var ChatInternalMessage=require(_0xb707('0x1'))['db'][_0xb707('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb707('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xe4c060){return function(_0x5db6ce,_0x39cd37,_0x157b23){ChatInternalMessageEvents[_0xb707('0x4')](_0xe4c060+':'+_0x5db6ce['id'],_0x5db6ce);ChatInternalMessageEvents['emit'](_0xe4c060,_0x5db6ce);_0x157b23(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xb707('0x5')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb146=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','ChatInternalMessage'];(function(_0x38cc97,_0x56269){var _0x1c52d2=function(_0x1cd6c9){while(--_0x1cd6c9){_0x38cc97['push'](_0x38cc97['shift']());}};_0x1c52d2(++_0x56269);}(_0xb146,0xa0));var _0x6b14=function(_0x168313,_0x399a14){_0x168313=_0x168313-0x0;var _0x356339=_0xb146[_0x168313];return _0x356339;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x6b14('0x0'))['db'][_0x6b14('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6b14('0x2')](0x0);var events={'afterCreate':_0x6b14('0x3'),'afterUpdate':_0x6b14('0x4'),'afterDestroy':_0x6b14('0x5')};function emitEvent(_0x59b224){return function(_0x2b8855,_0x17f4bc,_0x2981f0){ChatInternalMessageEvents[_0x6b14('0x6')](_0x59b224+':'+_0x2b8855['id'],_0x2b8855);ChatInternalMessageEvents[_0x6b14('0x6')](_0x59b224,_0x2b8855);_0x2981f0(null);};}for(var e in events){if(events[_0x6b14('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x6b14('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index cdf6ab3..a099f9a 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 _0xc2e0=['util','bluebird','request-promise','rimraf','exports','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xc2e0,0xfb));var _0x0c2e=function(_0x52d881,_0x3a47c9){_0x52d881=_0x52d881-0x0;var _0x41d8af=_0xc2e0[_0x52d881];return _0x41d8af;};'use strict';var _=require(_0x0c2e('0x0'));var util=require(_0x0c2e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0c2e('0x2'));var rp=require(_0x0c2e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c2e('0x4'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x0c2e('0x5')]=function(_0x563b1a,_0x514d89){return _0x563b1a['define'](_0x0c2e('0x6'),attributes,{'tableName':_0x0c2e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0c2e('0x8')});}; \ No newline at end of file +var _0x2b15=['./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x317184,_0x1c69aa){var _0x8e9778=function(_0x4bf2a8){while(--_0x4bf2a8){_0x317184['push'](_0x317184['shift']());}};_0x8e9778(++_0x1c69aa);}(_0x2b15,0x101));var _0x52b1=function(_0x102b00,_0x305e2d){_0x102b00=_0x102b00-0x0;var _0x40e551=_0x2b15[_0x102b00];return _0x40e551;};'use strict';var _=require(_0x52b1('0x0'));var util=require(_0x52b1('0x1'));var logger=require('../../config/logger')(_0x52b1('0x2'));var moment=require('moment');var BPromise=require(_0x52b1('0x3'));var rp=require(_0x52b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52b1('0x5'));var config=require(_0x52b1('0x6'));var attributes=require(_0x52b1('0x7'));module['exports']=function(_0x29d645,_0xa5497f){return _0x29d645['define'](_0x52b1('0x8'),attributes,{'tableName':_0x52b1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x52b1('0xa'),'collate':_0x52b1('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1ac5404..f97907a 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 _0xeae4=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1c2a31,_0x5ab97a){var _0xaabd37=function(_0x509d64){while(--_0x509d64){_0x1c2a31['push'](_0x1c2a31['shift']());}};_0xaabd37(++_0x5ab97a);}(_0xeae4,0x78));var _0x4eae=function(_0x2fb6e3,_0x1282d2){_0x2fb6e3=_0x2fb6e3-0x0;var _0xe2db47=_0xeae4[_0x2fb6e3];return _0xe2db47;};'use strict';var _=require(_0x4eae('0x0'));var util=require(_0x4eae('0x1'));var moment=require('moment');var BPromise=require(_0x4eae('0x2'));var rs=require(_0x4eae('0x3'));var fs=require('fs');var Redis=require(_0x4eae('0x4'));var db=require(_0x4eae('0x5'))['db'];var utils=require(_0x4eae('0x6'));var logger=require('../../config/logger')(_0x4eae('0x7'));var config=require(_0x4eae('0x8'));var jayson=require(_0x4eae('0x9'));var client=jayson[_0x4eae('0xa')][_0x4eae('0xb')]({'port':0x232a});config[_0x4eae('0xc')]=_[_0x4eae('0xd')](config[_0x4eae('0xc')],{'host':_0x4eae('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4eae('0xc')]));require(_0x4eae('0xf'))[_0x4eae('0x10')](socket);function respondWithRpcPromise(_0x48da8a,_0x8f9aab,_0x4b9d93){return new BPromise(function(_0x171bdc,_0x5e309a){return client['request'](_0x48da8a,_0x4b9d93)[_0x4eae('0x11')](function(_0x117e54){logger[_0x4eae('0x12')](_0x4eae('0x13'),_0x8f9aab,_0x4eae('0x14'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x8f9aab,_0x4eae('0x14'),JSON[_0x4eae('0x15')](_0x117e54));if(_0x117e54[_0x4eae('0x16')]){if(_0x117e54[_0x4eae('0x16')]['code']===0x1f4){logger[_0x4eae('0x16')](_0x4eae('0x13'),_0x8f9aab,_0x117e54['error'][_0x4eae('0x17')]);return _0x5e309a(_0x117e54[_0x4eae('0x16')][_0x4eae('0x17')]);}logger['error'](_0x4eae('0x13'),_0x8f9aab,_0x117e54[_0x4eae('0x16')][_0x4eae('0x17')]);return _0x171bdc(_0x117e54['error']['message']);}else{logger[_0x4eae('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x8f9aab,'request\x20sent');_0x171bdc(_0x117e54['result'][_0x4eae('0x17')]);}})[_0x4eae('0x18')](function(_0x25e2f6){logger[_0x4eae('0x16')](_0x4eae('0x13'),_0x8f9aab,_0x25e2f6);_0x5e309a(_0x25e2f6);});});} \ No newline at end of file +var _0xed8c=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x23b446,_0x160866){var _0x59c708=function(_0x3d9bdb){while(--_0x3d9bdb){_0x23b446['push'](_0x23b446['shift']());}};_0x59c708(++_0x160866);}(_0xed8c,0x64));var _0xced8=function(_0x19f420,_0x57dba0){_0x19f420=_0x19f420-0x0;var _0x166c59=_0xed8c[_0x19f420];return _0x166c59;};'use strict';var _=require('lodash');var util=require(_0xced8('0x0'));var moment=require(_0xced8('0x1'));var BPromise=require('bluebird');var rs=require(_0xced8('0x2'));var fs=require('fs');var Redis=require(_0xced8('0x3'));var db=require(_0xced8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xced8('0x5'))(_0xced8('0x6'));var config=require(_0xced8('0x7'));var jayson=require(_0xced8('0x8'));var client=jayson[_0xced8('0x9')][_0xced8('0xa')]({'port':0x232a});config[_0xced8('0xb')]=_[_0xced8('0xc')](config[_0xced8('0xb')],{'host':_0xced8('0xd'),'port':0x18eb});var socket=require(_0xced8('0xe'))(new Redis(config[_0xced8('0xb')]));require('./chatInternalMessage.socket')[_0xced8('0xf')](socket);function respondWithRpcPromise(_0x2b6627,_0x23d502,_0x4bcbbf){return new BPromise(function(_0x21c033,_0x531090){return client[_0xced8('0x10')](_0x2b6627,_0x4bcbbf)[_0xced8('0x11')](function(_0x458d94){logger[_0xced8('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x23d502,_0xced8('0x13'));logger[_0xced8('0x14')](_0xced8('0x15'),_0x23d502,_0xced8('0x13'),JSON['stringify'](_0x458d94));if(_0x458d94['error']){if(_0x458d94[_0xced8('0x16')][_0xced8('0x17')]===0x1f4){logger[_0xced8('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x23d502,_0x458d94['error'][_0xced8('0x18')]);return _0x531090(_0x458d94[_0xced8('0x16')][_0xced8('0x18')]);}logger[_0xced8('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x23d502,_0x458d94[_0xced8('0x16')][_0xced8('0x18')]);return _0x21c033(_0x458d94[_0xced8('0x16')][_0xced8('0x18')]);}else{logger[_0xced8('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x23d502,'request\x20sent');_0x21c033(_0x458d94[_0xced8('0x19')]['message']);}})[_0xced8('0x1a')](function(_0xea88b1){logger[_0xced8('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x23d502,_0xea88b1);_0x531090(_0xea88b1);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 8dcdcda..faebcae 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 _0xce8d=['remove','update','emit','removeListener','length','./chatInternalMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce8d,0x11f));var _0xdce8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce8d[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0xdce8('0x0'));var events=['save',_0xdce8('0x1'),_0xdce8('0x2')];function createListener(_0x4ae4cf,_0x91eaa6){return function(_0x5d5b9a){_0x91eaa6[_0xdce8('0x3')](_0x4ae4cf,_0x5d5b9a);};}function removeListener(_0x57eeb1,_0x3429a1){return function(){ChatInternalMessageEvents[_0xdce8('0x4')](_0x57eeb1,_0x3429a1);};}exports['register']=function(_0x4675d1){for(var _0x4f1144=0x0,_0x218524=events[_0xdce8('0x5')];_0x4f1144<_0x218524;_0x4f1144++){var _0x222ab4=events[_0x4f1144];var _0x36788a=createListener('chatInternalMessage:'+_0x222ab4,_0x4675d1);ChatInternalMessageEvents['on'](_0x222ab4,_0x36788a);}}; \ No newline at end of file +var _0x5a24=['update','emit','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x5a24,0x1ed));var _0x45a2=function(_0x3237f1,_0x273bfc){_0x3237f1=_0x3237f1-0x0;var _0x3b9d93=_0x5a24[_0x3237f1];return _0x3b9d93;};'use strict';var ChatInternalMessageEvents=require(_0x45a2('0x0'));var events=[_0x45a2('0x1'),'remove',_0x45a2('0x2')];function createListener(_0x524e47,_0x478266){return function(_0x46d6ec){_0x478266[_0x45a2('0x3')](_0x524e47,_0x46d6ec);};}function removeListener(_0x98be46,_0x341831){return function(){ChatInternalMessageEvents['removeListener'](_0x98be46,_0x341831);};}exports['register']=function(_0xdfd544){for(var _0x272d15=0x0,_0x1f6eb4=events['length'];_0x272d15<_0x1f6eb4;_0x272d15++){var _0x21a02a=events[_0x272d15];var _0x1985b7=createListener(_0x45a2('0x4')+_0x21a02a,_0xdfd544);ChatInternalMessageEvents['on'](_0x21a02a,_0x1985b7);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ac67b04..2869b2d 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 _0x207e=['show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id'];(function(_0x54aaf0,_0x39bd60){var _0xd8fa4d=function(_0x1b0849){while(--_0x1b0849){_0x54aaf0['push'](_0x54aaf0['shift']());}};_0xd8fa4d(++_0x39bd60);}(_0x207e,0x8a));var _0xe207=function(_0x4eee57,_0x34ccc0){_0x4eee57=_0x4eee57-0x0;var _0x3a5259=_0x207e[_0x4eee57];return _0x3a5259;};'use strict';var multer=require(_0xe207('0x0'));var util=require(_0xe207('0x1'));var path=require(_0xe207('0x2'));var timeout=require(_0xe207('0x3'));var express=require(_0xe207('0x4'));var router=express[_0xe207('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe207('0x7'));var controller=require(_0xe207('0x8'));router[_0xe207('0x9')]('/',auth[_0xe207('0xa')](),controller[_0xe207('0xb')]);router[_0xe207('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe207('0xc')]);router['get'](_0xe207('0xd'),auth[_0xe207('0xa')](),controller[_0xe207('0xe')]);router[_0xe207('0x9')](_0xe207('0xf'),auth[_0xe207('0xa')](),controller[_0xe207('0x10')]);router[_0xe207('0x11')]('/',auth[_0xe207('0xa')](),controller[_0xe207('0x12')]);router[_0xe207('0x13')](_0xe207('0xf'),controller[_0xe207('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe207('0x15')]);module['exports']=router; \ No newline at end of file +var _0x483b=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','describe','/users','isAuthenticated','getUsers','/:id','show','post'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x483b,0x1a6));var _0xb483=function(_0x282649,_0x3c0912){_0x282649=_0x282649-0x0;var _0x2e6b25=_0x483b[_0x282649];return _0x2e6b25;};'use strict';var multer=require(_0xb483('0x0'));var util=require(_0xb483('0x1'));var path=require(_0xb483('0x2'));var timeout=require(_0xb483('0x3'));var express=require(_0xb483('0x4'));var router=express[_0xb483('0x5')]();var fs_extra=require(_0xb483('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb483('0x7'));var config=require(_0xb483('0x8'));var controller=require(_0xb483('0x9'));router[_0xb483('0xa')]('/',auth['isAuthenticated'](),controller[_0xb483('0xb')]);router[_0xb483('0xa')](_0xb483('0xc'),auth['isAuthenticated'](),controller[_0xb483('0xd')]);router[_0xb483('0xa')](_0xb483('0xe'),auth[_0xb483('0xf')](),controller[_0xb483('0x10')]);router[_0xb483('0xa')](_0xb483('0x11'),auth['isAuthenticated'](),controller[_0xb483('0x12')]);router[_0xb483('0x13')]('/',auth[_0xb483('0xf')](),controller[_0xb483('0x14')]);router[_0xb483('0x15')]('/:id',controller[_0xb483('0x16')]);router[_0xb483('0x17')](_0xb483('0x11'),auth[_0xb483('0xf')](),controller[_0xb483('0x18')]);module[_0xb483('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 707eb7a..d04367f 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 _0x7916=['out','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0x7916,0x128));var _0x6791=function(_0x204ef6,_0x14dc9b){_0x204ef6=_0x204ef6-0x0;var _0x5e3a4b=_0x7916[_0x204ef6];return _0x5e3a4b;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'body':{'type':Sequelize[_0x6791('0x1')](_0x6791('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x6791('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6791('0x4')]('in',_0x6791('0x5')),'defaultValue':_0x6791('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6791('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0647=['medium','BOOLEAN','ENUM','DATE','STRING','sequelize','TEXT'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0647,0xd0));var _0x7064=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x0647[_0x4aa838];return _0x3abff0;};'use strict';var Sequelize=require(_0x7064('0x0'));module['exports']={'body':{'type':Sequelize[_0x7064('0x1')](_0x7064('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7064('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7064('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7064('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x7064('0x5')]},'providerName':{'type':Sequelize[_0x7064('0x6')]},'providerResponse':{'type':Sequelize[_0x7064('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index b131e90..ec6bb9b 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 _0x0dfc=['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','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','undefined','limit','count','offset','status','Content-Range','json','apply','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','ChatMessage','includeAll','include','rows','show','params','options','find','create','body','describe','accept','chat','read','format','agent','get','ChatInteractionId','UserId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','motionChannel','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','reject','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3d2a39,_0x4e0506){var _0x452043=function(_0x25d797){while(--_0x25d797){_0x3d2a39['push'](_0x3d2a39['shift']());}};_0x452043(++_0x4e0506);}(_0x0dfc,0x7a));var _0xc0df=function(_0x351b52,_0x171378){_0x351b52=_0x351b52-0x0;var _0x2a58ed=_0x0dfc[_0x351b52];return _0x2a58ed;};'use strict';var emlformat=require(_0xc0df('0x0'));var rimraf=require(_0xc0df('0x1'));var zipdir=require(_0xc0df('0x2'));var jsonpatch=require(_0xc0df('0x3'));var rp=require(_0xc0df('0x4'));var moment=require(_0xc0df('0x5'));var BPromise=require(_0xc0df('0x6'));var Mustache=require('mustache');var util=require(_0xc0df('0x7'));var path=require(_0xc0df('0x8'));var sox=require(_0xc0df('0x9'));var csv=require(_0xc0df('0xa'));var ejs=require(_0xc0df('0xb'));var fs=require('fs');var fs_extra=require(_0xc0df('0xc'));var _=require('lodash');var squel=require(_0xc0df('0xd'));var crypto=require(_0xc0df('0xe'));var jsforce=require(_0xc0df('0xf'));var deskjs=require(_0xc0df('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc0df('0x11'));var Papa=require(_0xc0df('0x12'));var Redis=require(_0xc0df('0x13'));var authService=require(_0xc0df('0x14'));var qs=require(_0xc0df('0x15'));var as=require(_0xc0df('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0df('0x17'))('api');var utils=require(_0xc0df('0x18'));var config=require(_0xc0df('0x19'));var licenseUtil=require(_0xc0df('0x1a'));var db=require(_0xc0df('0x1b'))['db'];config[_0xc0df('0x1c')]=_[_0xc0df('0x1d')](config['redis'],{'host':_0xc0df('0x1e'),'port':0x18eb});var socket=require(_0xc0df('0x1f'))(new Redis(config[_0xc0df('0x1c')]));require(_0xc0df('0x20'))[_0xc0df('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc0df('0x22')][_0xc0df('0x23')]({'port':0x232c});var client9002=jayson[_0xc0df('0x22')][_0xc0df('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2e4730,_0x20428b,_0x4659f6,_0x393a5c){return new BPromise(function(_0x44e66e,_0x271bd5){var _0x53b673=_0x393a5c||client;return _0x53b673[_0xc0df('0x24')](_0x2e4730,_0x4659f6)['then'](function(_0x1268dc){logger[_0xc0df('0x25')](_0xc0df('0x26'),_0x20428b,_0xc0df('0x27'));logger[_0xc0df('0x28')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x20428b,'request\x20sent',JSON[_0xc0df('0x29')](_0x1268dc));if(_0x1268dc[_0xc0df('0x2a')]){if(_0x1268dc[_0xc0df('0x2a')][_0xc0df('0x2b')]===0x1f4){logger[_0xc0df('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x20428b,_0x1268dc[_0xc0df('0x2a')][_0xc0df('0x2c')]);return _0x271bd5(_0x1268dc[_0xc0df('0x2a')][_0xc0df('0x2c')]);}logger[_0xc0df('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x20428b,_0x1268dc[_0xc0df('0x2a')][_0xc0df('0x2c')]);return _0x44e66e(_0x1268dc['error'][_0xc0df('0x2c')]);}else{logger['info'](_0xc0df('0x26'),_0x20428b,_0xc0df('0x27'));_0x44e66e(_0x1268dc[_0xc0df('0x2d')][_0xc0df('0x2c')]);}})[_0xc0df('0x2e')](function(_0x452a28){logger['error'](_0xc0df('0x26'),_0x20428b,_0x452a28);_0x271bd5(_0x452a28);});});}function respondWithStatusCode(_0x3aa8b2,_0x4f8f66){_0x4f8f66=_0x4f8f66||0xcc;return function(_0x1a4d15){if(_0x1a4d15){return _0x3aa8b2[_0xc0df('0x2f')](_0x4f8f66);}return _0x3aa8b2['status'](_0x4f8f66)[_0xc0df('0x30')]();};}function respondWithResult(_0x5d3b8d,_0x524f24){_0x524f24=_0x524f24||0xc8;return function(_0x44161c){if(_0x44161c){return _0x5d3b8d['status'](_0x524f24)['json'](_0x44161c);}};}function respondWithFilteredResult(_0x4b4d52,_0x125ff8){return function(_0x1ad2b4){if(_0x1ad2b4){var _0x5b1d90=typeof _0x125ff8['offset']===_0xc0df('0x31')&&typeof _0x125ff8[_0xc0df('0x32')]===_0xc0df('0x31');var _0x4a2c0d=_0x1ad2b4[_0xc0df('0x33')];var _0x40fdb6=_0x5b1d90?0x0:_0x125ff8[_0xc0df('0x34')];var _0x58f6e1=_0x5b1d90?_0x1ad2b4[_0xc0df('0x33')]:_0x125ff8['offset']+_0x125ff8[_0xc0df('0x32')];var _0x5d669f;if(_0x58f6e1>=_0x4a2c0d){_0x58f6e1=_0x4a2c0d;_0x5d669f=0xc8;}else{_0x5d669f=0xce;}_0x4b4d52[_0xc0df('0x35')](_0x5d669f);return _0x4b4d52['set'](_0xc0df('0x36'),_0x40fdb6+'-'+_0x58f6e1+'/'+_0x4a2c0d)[_0xc0df('0x37')](_0x1ad2b4);}return null;};}function patchUpdates(_0xc2555){return function(_0x59b67a){try{jsonpatch[_0xc0df('0x38')](_0x59b67a,_0xc2555,!![]);}catch(_0x2a73ae){return BPromise['reject'](_0x2a73ae);}return _0x59b67a['save']();};}function saveUpdates(_0x377061,_0x5ef525){return function(_0x3f654c){if(_0x3f654c){return _0x3f654c['update'](_0x377061)[_0xc0df('0x39')](function(_0x2f3b26){return _0x2f3b26;});}return null;};}function removeEntity(_0x4d683e,_0x48a2df){return function(_0x2cf122){if(_0x2cf122){return _0x2cf122[_0xc0df('0x3a')]()[_0xc0df('0x39')](function(){_0x4d683e[_0xc0df('0x35')](0xcc)[_0xc0df('0x30')]();});}};}function handleEntityNotFound(_0x264af6,_0x47c4ce){return function(_0x1319c7){if(!_0x1319c7){_0x264af6[_0xc0df('0x2f')](0x194);}return _0x1319c7;};}function handleError(_0x10ebe2,_0x412cd9){_0x412cd9=_0x412cd9||0x1f4;return function(_0x59ab04){logger[_0xc0df('0x2a')](_0x59ab04[_0xc0df('0x3b')]);if(_0x59ab04[_0xc0df('0x3c')]){delete _0x59ab04[_0xc0df('0x3c')];}_0x10ebe2['status'](_0x412cd9)[_0xc0df('0x3d')](_0x59ab04);};}exports['index']=function(_0x29312f,_0x49914e){var _0x1bbecb={},_0x182623={},_0x26721c={'count':0x0,'rows':[]};var _0x79e0a7=_[_0xc0df('0x3e')](db['ChatMessage'][_0xc0df('0x3f')],function(_0x439cf2){return{'name':_0x439cf2[_0xc0df('0x40')],'type':_0x439cf2['type'][_0xc0df('0x41')]};});_0x182623['model']=_[_0xc0df('0x3e')](_0x79e0a7,'name');_0x182623[_0xc0df('0x42')]=_[_0xc0df('0x43')](_0x29312f[_0xc0df('0x42')]);_0x182623[_0xc0df('0x44')]=_[_0xc0df('0x45')](_0x182623[_0xc0df('0x46')],_0x182623[_0xc0df('0x42')]);_0x1bbecb[_0xc0df('0x47')]=_[_0xc0df('0x45')](_0x182623['model'],qs['fields'](_0x29312f[_0xc0df('0x42')][_0xc0df('0x48')]));_0x1bbecb[_0xc0df('0x47')]=_0x1bbecb[_0xc0df('0x47')][_0xc0df('0x49')]?_0x1bbecb[_0xc0df('0x47')]:_0x182623[_0xc0df('0x46')];if(!_0x29312f[_0xc0df('0x42')]['hasOwnProperty'](_0xc0df('0x4a'))){_0x1bbecb[_0xc0df('0x32')]=qs['limit'](_0x29312f[_0xc0df('0x42')]['limit']);_0x1bbecb['offset']=qs[_0xc0df('0x34')](_0x29312f['query'][_0xc0df('0x34')]);}_0x1bbecb[_0xc0df('0x4b')]=qs[_0xc0df('0x4c')](_0x29312f[_0xc0df('0x42')][_0xc0df('0x4c')]);_0x1bbecb[_0xc0df('0x4d')]=qs[_0xc0df('0x44')](_[_0xc0df('0x4e')](_0x29312f[_0xc0df('0x42')],_0x182623[_0xc0df('0x44')]),_0x79e0a7);if(_0x29312f[_0xc0df('0x42')]['filter']){_0x1bbecb[_0xc0df('0x4d')]=_[_0xc0df('0x4f')](_0x1bbecb[_0xc0df('0x4d')],{'$or':_['map'](_0x79e0a7,function(_0x2c342d){if(_0x2c342d[_0xc0df('0x50')]!==_0xc0df('0x51')){var _0x1cc447={};_0x1cc447[_0x2c342d[_0xc0df('0x3c')]]={'$like':'%'+_0x29312f[_0xc0df('0x42')][_0xc0df('0x52')]+'%'};return _0x1cc447;}})});}_0x1bbecb=_[_0xc0df('0x4f')]({},_0x1bbecb,_0x29312f['options']);var _0x2fb88b={'where':_0x1bbecb[_0xc0df('0x4d')]};return db[_0xc0df('0x53')][_0xc0df('0x33')](_0x2fb88b)[_0xc0df('0x39')](function(_0x8c9fd3){_0x26721c[_0xc0df('0x33')]=_0x8c9fd3;if(_0x29312f[_0xc0df('0x42')][_0xc0df('0x54')]){_0x1bbecb[_0xc0df('0x55')]=[{'all':!![]}];}return db[_0xc0df('0x53')]['findAll'](_0x1bbecb);})['then'](function(_0xfd56f0){_0x26721c[_0xc0df('0x56')]=_0xfd56f0;return _0x26721c;})[_0xc0df('0x39')](respondWithFilteredResult(_0x49914e,_0x1bbecb))[_0xc0df('0x2e')](handleError(_0x49914e,null));};exports[_0xc0df('0x57')]=function(_0x430a7e,_0x2a44b7){var _0x5ea576={'raw':!![],'where':{'id':_0x430a7e[_0xc0df('0x58')]['id']}},_0x38a04b={};_0x38a04b['model']=_[_0xc0df('0x43')](db[_0xc0df('0x53')]['rawAttributes']);_0x38a04b[_0xc0df('0x42')]=_[_0xc0df('0x43')](_0x430a7e['query']);_0x38a04b[_0xc0df('0x44')]=_[_0xc0df('0x45')](_0x38a04b[_0xc0df('0x46')],_0x38a04b['query']);_0x5ea576['attributes']=_[_0xc0df('0x45')](_0x38a04b[_0xc0df('0x46')],qs[_0xc0df('0x48')](_0x430a7e['query'][_0xc0df('0x48')]));_0x5ea576[_0xc0df('0x47')]=_0x5ea576['attributes']['length']?_0x5ea576[_0xc0df('0x47')]:_0x38a04b[_0xc0df('0x46')];if(_0x430a7e[_0xc0df('0x42')][_0xc0df('0x54')]){_0x5ea576['include']=[{'all':!![]}];}_0x5ea576=_['merge']({},_0x5ea576,_0x430a7e[_0xc0df('0x59')]);return db['ChatMessage'][_0xc0df('0x5a')](_0x5ea576)[_0xc0df('0x39')](handleEntityNotFound(_0x2a44b7,null))[_0xc0df('0x39')](respondWithResult(_0x2a44b7,null))[_0xc0df('0x2e')](handleError(_0x2a44b7,null));};exports[_0xc0df('0x5b')]=function(_0x1a79cd,_0x590073){return db[_0xc0df('0x53')][_0xc0df('0x5b')](_0x1a79cd[_0xc0df('0x5c')],{})[_0xc0df('0x39')](respondWithResult(_0x590073,0xc9))['catch'](handleError(_0x590073,null));};exports['update']=function(_0x4f576d,_0x16b149){if(_0x4f576d[_0xc0df('0x5c')]['id']){delete _0x4f576d['body']['id'];}return db[_0xc0df('0x53')][_0xc0df('0x5a')]({'where':{'id':_0x4f576d[_0xc0df('0x58')]['id']}})[_0xc0df('0x39')](handleEntityNotFound(_0x16b149,null))[_0xc0df('0x39')](saveUpdates(_0x4f576d[_0xc0df('0x5c')],null))['then'](respondWithResult(_0x16b149,null))[_0xc0df('0x2e')](handleError(_0x16b149,null));};exports['destroy']=function(_0x53707c,_0x1057d1){return db['ChatMessage'][_0xc0df('0x5a')]({'where':{'id':_0x53707c['params']['id']}})[_0xc0df('0x39')](handleEntityNotFound(_0x1057d1,null))[_0xc0df('0x39')](removeEntity(_0x1057d1,null))[_0xc0df('0x2e')](handleError(_0x1057d1,null));};exports[_0xc0df('0x5d')]=function(_0x1c53be,_0x24ad23){return db['ChatMessage'][_0xc0df('0x5d')]()[_0xc0df('0x39')](respondWithResult(_0x24ad23,null))[_0xc0df('0x2e')](handleError(_0x24ad23,null));};var interaction_log=require(_0xc0df('0x17'))('chat-interactions');exports[_0xc0df('0x5e')]=function(_0xe19d0b,_0x2103d9,_0x247f2b){var _0x514d72={'agent':{},'channel':_0xc0df('0x5f')};if(_0xe19d0b[_0xc0df('0x5c')]['id']){delete _0xe19d0b[_0xc0df('0x5c')]['id'];}_0xe19d0b['body'][_0xc0df('0x60')]=!![];_0xe19d0b[_0xc0df('0x5c')]['readAt']=moment()[_0xc0df('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0xe19d0b['body']['UserId']=_0xe19d0b['body']['UserId']||_0xe19d0b['user']['id'];_0x514d72[_0xc0df('0x62')]['id']=_0xe19d0b[_0xc0df('0x5c')]['UserId'];return db[_0xc0df('0x53')][_0xc0df('0x5a')]({'where':{'id':_0xe19d0b[_0xc0df('0x58')]['id'],'UserId':null}})[_0xc0df('0x39')](handleEntityNotFound(_0x2103d9,null))[_0xc0df('0x39')](saveUpdates(_0xe19d0b[_0xc0df('0x5c')],null))['then'](function(_0xd60bb0){if(_0xd60bb0){_0x514d72[_0xc0df('0x2c')]=_0xd60bb0[_0xc0df('0x63')]({'plain':!![]});return db['ChatInteraction'][_0xc0df('0x5a')]({'where':{'id':_0xd60bb0[_0xc0df('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2103d9,null))['then'](function(_0x561f65){if(_0x561f65){return _0x561f65['update']({'UserId':_0xe19d0b[_0xc0df('0x5c')][_0xc0df('0x65')],'read1stAt':_['isNil'](_0x561f65[_0xc0df('0x66')])?moment()[_0xc0df('0x61')](_0xc0df('0x67')):undefined});}return null;})[_0xc0df('0x39')](function(_0x12177f){if(_0x12177f){_0x514d72[_0xc0df('0x68')]=_0x12177f[_0xc0df('0x63')]({'plain':!![]});interaction_log['info'](_0xc0df('0x69'),_0xe19d0b['user']['id'],_0xe19d0b[_0xc0df('0x6a')][_0xc0df('0x3c')],_0xe19d0b[_0xc0df('0x6a')][_0xc0df('0x6b')],_0x514d72[_0xc0df('0x68')]['id'],_0xe19d0b[_0xc0df('0x5c')]?JSON[_0xc0df('0x29')](_0xe19d0b[_0xc0df('0x5c')]):_0xc0df('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xc0df('0x6d'),_0x514d72);}return null;})[_0xc0df('0x39')](function(_0x409be1){var _0x301751='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x409be1[_0xc0df('0x2c')][_0xc0df('0x6e')];return db['sequelize']['query'](_0x301751,{'type':db[_0xc0df('0x6f')][_0xc0df('0x70')][_0xc0df('0x71')],'raw':!![]})[_0xc0df('0x39')](function(_0x4d1689){return _0x4d1689;});})[_0xc0df('0x39')](function(_0x3428dc){if(_0x3428dc){_0x514d72['message'][_0xc0df('0x72')]=_0x3428dc[0x0];if(!_0xe19d0b[_0xc0df('0x5c')]['UserId'])return;return db[_0xc0df('0x73')][_0xc0df('0x5a')]({'where':{'id':_0xe19d0b['body'][_0xc0df('0x65')],'role':'agent'},'attributes':['id','name',_0xc0df('0x74'),_0xc0df('0x75'),_0xc0df('0x76')],'raw':!![]});}return null;})[_0xc0df('0x39')](function(_0x133160){if(!_0x133160)return null;_0x514d72['message'][_0xc0df('0x62')]=_0x133160;return _0x514d72;})['then'](function(_0x1c2cb0){if(_0x1c2cb0){if(_0xe19d0b[_0xc0df('0x5c')][_0xc0df('0x77')]){_0x514d72[_0xc0df('0x2c')][_0xc0df('0x78')]=util[_0xc0df('0x61')]('SIP/%s',_0xe19d0b[_0xc0df('0x6a')][_0xc0df('0x3c')]);_0x514d72['message']['channel']=_0x514d72['channel'];_0x514d72[_0xc0df('0x2c')][_0xc0df('0x79')]=_0x514d72[_0xc0df('0x7a')];_0x514d72[_0xc0df('0x2c')][_0xc0df('0x7b')]=_0xc0df('0x5e');return respondWithRpcPromise('EventManager',_0xc0df('0x7c'),{'event':_0xc0df('0x7d'),'message':_[_0xc0df('0x4f')](_0x514d72['message'],JSON[_0xc0df('0x7e')](_0x514d72[_0xc0df('0x68')][_0xc0df('0x7f')]))},client9002)['then'](function(){return _0x514d72;});}return _0x514d72;}return null;})[_0xc0df('0x39')](respondWithResult(_0x2103d9,null))[_0xc0df('0x2e')](handleError(_0x2103d9,null));};var interaction_log=require(_0xc0df('0x17'))(_0xc0df('0x80'));exports['reject']=function(_0x2d24f1,_0x4fdf75,_0x21a7cb){var _0x1a5150={'agent':{},'channel':_0xc0df('0x5f')};if(_0x2d24f1[_0xc0df('0x5c')]['id']){delete _0x2d24f1['body']['id'];}_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')]=_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')]||_0x2d24f1[_0xc0df('0x6a')]['id'];_0x1a5150[_0xc0df('0x62')]['id']=_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')];return db[_0xc0df('0x53')][_0xc0df('0x5a')]({'where':{'id':_0x2d24f1[_0xc0df('0x58')]['id'],'UserId':null}})[_0xc0df('0x39')](handleEntityNotFound(_0x4fdf75,null))[_0xc0df('0x39')](function(_0x1ca290){if(_0x1ca290){_0x1a5150['message']=_0x1ca290[_0xc0df('0x63')]({'plain':!![]});return db['ChatInteraction'][_0xc0df('0x5a')]({'where':{'id':_0x1ca290['ChatInteractionId']}});}return null;})[_0xc0df('0x39')](handleEntityNotFound(_0x4fdf75,null))[_0xc0df('0x39')](function(_0x35a633){if(_0x35a633){_0x1a5150[_0xc0df('0x68')]=_0x35a633['get']({'plain':!![]});interaction_log['info'](_0xc0df('0x81'),_0x2d24f1['user']['id'],_0x2d24f1['user']['name'],_0x2d24f1['user']['role'],_0x1a5150['interaction']['id'],_0x2d24f1[_0xc0df('0x5c')]?JSON[_0xc0df('0x29')](_0x2d24f1[_0xc0df('0x5c')]):'null');return respondWithRpcPromise('RejectMessage',_0xc0df('0x82'),_0x1a5150);}return null;})[_0xc0df('0x39')](function(_0xebc513){var _0x1530d3=_0xc0df('0x83')+_0xebc513['message'][_0xc0df('0x6e')];return db[_0xc0df('0x84')]['query'](_0x1530d3,{'type':db[_0xc0df('0x6f')][_0xc0df('0x70')][_0xc0df('0x71')],'raw':!![]})[_0xc0df('0x39')](function(_0x2d11d5){return _0x2d11d5;});})['then'](function(_0x21d0b3){if(_0x21d0b3){_0x1a5150[_0xc0df('0x2c')]['contact']=_0x21d0b3[0x0];if(!_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')])return;return db[_0xc0df('0x73')][_0xc0df('0x5a')]({'where':{'id':_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')],'role':_0xc0df('0x62')},'attributes':['id',_0xc0df('0x3c'),_0xc0df('0x74'),_0xc0df('0x75'),_0xc0df('0x76')],'raw':!![]});}return null;})[_0xc0df('0x39')](function(_0x3625b1){if(!_0x3625b1)return null;_0x1a5150[_0xc0df('0x2c')][_0xc0df('0x62')]=_0x3625b1;return _0x1a5150;})[_0xc0df('0x39')](function(_0x76f039){if(_0x76f039){_0x76f039[_0xc0df('0x2c')][_0xc0df('0x78')]=util[_0xc0df('0x61')]('SIP/%s',_0x2d24f1['user'][_0xc0df('0x3c')]);_0x76f039[_0xc0df('0x2c')]['channel']=_0x1a5150[_0xc0df('0x7a')];_0x76f039[_0xc0df('0x2c')]['motionChannel']=_0x1a5150[_0xc0df('0x7a')];_0x76f039['message']['event']=_0xc0df('0x85');respondWithRpcPromise(_0xc0df('0x7c'),_0xc0df('0x7c'),{'event':_0xc0df('0x86'),'message':_[_0xc0df('0x4f')](_0x1a5150['message'],JSON[_0xc0df('0x7e')](_0x1a5150[_0xc0df('0x68')][_0xc0df('0x7f')]))},client9002);return _0x1a5150;}return null;})['then'](respondWithResult(_0x4fdf75,null))[_0xc0df('0x2e')](handleError(_0x4fdf75,null));}; \ No newline at end of file +var _0x2b31=['name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','find','catch','create','body','describe','chat-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','isNil','read1stAt','interaction','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','ContactId','Sequelize','SELECT','User','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','chat','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','contact','fullname','email','internal','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack'];(function(_0x506874,_0x27bdf9){var _0xa4f425=function(_0x5aabe2){while(--_0x5aabe2){_0x506874['push'](_0x506874['shift']());}};_0xa4f425(++_0x27bdf9);}(_0x2b31,0xd2));var _0x12b3=function(_0x274a9c,_0x4e2b19){_0x274a9c=_0x274a9c-0x0;var _0x32cf95=_0x2b31[_0x274a9c];return _0x32cf95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12b3('0x0'));var zipdir=require(_0x12b3('0x1'));var jsonpatch=require(_0x12b3('0x2'));var rp=require(_0x12b3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x12b3('0x4'));var util=require(_0x12b3('0x5'));var path=require(_0x12b3('0x6'));var sox=require('sox');var csv=require(_0x12b3('0x7'));var ejs=require(_0x12b3('0x8'));var fs=require('fs');var fs_extra=require(_0x12b3('0x9'));var _=require(_0x12b3('0xa'));var squel=require(_0x12b3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x12b3('0xc'));var toCsv=require(_0x12b3('0x7'));var querystring=require(_0x12b3('0xd'));var Papa=require(_0x12b3('0xe'));var Redis=require(_0x12b3('0xf'));var authService=require(_0x12b3('0x10'));var qs=require(_0x12b3('0x11'));var as=require(_0x12b3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x12b3('0x13'))(_0x12b3('0x14'));var utils=require(_0x12b3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x12b3('0x16'));var db=require(_0x12b3('0x17'))['db'];config[_0x12b3('0x18')]=_[_0x12b3('0x19')](config[_0x12b3('0x18')],{'host':_0x12b3('0x1a'),'port':0x18eb});var socket=require(_0x12b3('0x1b'))(new Redis(config['redis']));require(_0x12b3('0x1c'))[_0x12b3('0x1d')](socket);var jayson=require(_0x12b3('0x1e'));var client=jayson[_0x12b3('0x1f')][_0x12b3('0x20')]({'port':0x232c});var client9002=jayson[_0x12b3('0x1f')][_0x12b3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2e3f49,_0x5afdf4,_0x47809b,_0x4a1e51){return new BPromise(function(_0x7f02a1,_0x3616f4){var _0x269e7d=_0x4a1e51||client;return _0x269e7d['request'](_0x2e3f49,_0x47809b)['then'](function(_0x4d4463){logger['info'](_0x12b3('0x21'),_0x5afdf4,_0x12b3('0x22'));logger['debug'](_0x12b3('0x23'),_0x5afdf4,_0x12b3('0x22'),JSON['stringify'](_0x4d4463));if(_0x4d4463[_0x12b3('0x24')]){if(_0x4d4463['error'][_0x12b3('0x25')]===0x1f4){logger['error'](_0x12b3('0x21'),_0x5afdf4,_0x4d4463[_0x12b3('0x24')][_0x12b3('0x26')]);return _0x3616f4(_0x4d4463[_0x12b3('0x24')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x5afdf4,_0x4d4463[_0x12b3('0x24')][_0x12b3('0x26')]);return _0x7f02a1(_0x4d4463[_0x12b3('0x24')]['message']);}else{logger['info'](_0x12b3('0x21'),_0x5afdf4,_0x12b3('0x22'));_0x7f02a1(_0x4d4463[_0x12b3('0x27')]['message']);}})['catch'](function(_0x5b47ba){logger[_0x12b3('0x24')]('ChatMessage,\x20%s,\x20%s',_0x5afdf4,_0x5b47ba);_0x3616f4(_0x5b47ba);});});}function respondWithStatusCode(_0x4465b8,_0x156872){_0x156872=_0x156872||0xcc;return function(_0x3b0129){if(_0x3b0129){return _0x4465b8[_0x12b3('0x28')](_0x156872);}return _0x4465b8['status'](_0x156872)[_0x12b3('0x29')]();};}function respondWithResult(_0x2791fb,_0x148043){_0x148043=_0x148043||0xc8;return function(_0x18fa3f){if(_0x18fa3f){return _0x2791fb[_0x12b3('0x2a')](_0x148043)[_0x12b3('0x2b')](_0x18fa3f);}};}function respondWithFilteredResult(_0x47da61,_0x5a6923){return function(_0x4a6179){if(_0x4a6179){var _0x2748a9=typeof _0x5a6923[_0x12b3('0x2c')]===_0x12b3('0x2d')&&typeof _0x5a6923[_0x12b3('0x2e')]===_0x12b3('0x2d');var _0x4d8521=_0x4a6179[_0x12b3('0x2f')];var _0x18d72f=_0x2748a9?0x0:_0x5a6923[_0x12b3('0x2c')];var _0x4ddfa1=_0x2748a9?_0x4a6179[_0x12b3('0x2f')]:_0x5a6923[_0x12b3('0x2c')]+_0x5a6923['limit'];var _0x6e3538;if(_0x4ddfa1>=_0x4d8521){_0x4ddfa1=_0x4d8521;_0x6e3538=0xc8;}else{_0x6e3538=0xce;}_0x47da61['status'](_0x6e3538);return _0x47da61[_0x12b3('0x30')]('Content-Range',_0x18d72f+'-'+_0x4ddfa1+'/'+_0x4d8521)['json'](_0x4a6179);}return null;};}function patchUpdates(_0x1ff563){return function(_0x5ed7d5){try{jsonpatch[_0x12b3('0x31')](_0x5ed7d5,_0x1ff563,!![]);}catch(_0x13a954){return BPromise[_0x12b3('0x32')](_0x13a954);}return _0x5ed7d5[_0x12b3('0x33')]();};}function saveUpdates(_0x2c9d8f,_0x51eb2e){return function(_0x5c1385){if(_0x5c1385){return _0x5c1385[_0x12b3('0x34')](_0x2c9d8f)[_0x12b3('0x35')](function(_0x41857b){return _0x41857b;});}return null;};}function removeEntity(_0x28daf4,_0x111d16){return function(_0x4ab1c3){if(_0x4ab1c3){return _0x4ab1c3[_0x12b3('0x36')]()[_0x12b3('0x35')](function(){_0x28daf4['status'](0xcc)[_0x12b3('0x29')]();});}};}function handleEntityNotFound(_0x5df16d,_0x586ac4){return function(_0x15a661){if(!_0x15a661){_0x5df16d[_0x12b3('0x28')](0x194);}return _0x15a661;};}function handleError(_0x31298c,_0x418dbc){_0x418dbc=_0x418dbc||0x1f4;return function(_0x11ae43){logger[_0x12b3('0x24')](_0x11ae43[_0x12b3('0x37')]);if(_0x11ae43[_0x12b3('0x38')]){delete _0x11ae43[_0x12b3('0x38')];}_0x31298c[_0x12b3('0x2a')](_0x418dbc)[_0x12b3('0x39')](_0x11ae43);};}exports[_0x12b3('0x3a')]=function(_0x1a319a,_0x3e2582){var _0x53e6a3={},_0x4e37c4={},_0xb19942={'count':0x0,'rows':[]};var _0x3f12f4=_[_0x12b3('0x3b')](db[_0x12b3('0x3c')][_0x12b3('0x3d')],function(_0x535274){return{'name':_0x535274[_0x12b3('0x3e')],'type':_0x535274[_0x12b3('0x3f')][_0x12b3('0x40')]};});_0x4e37c4[_0x12b3('0x41')]=_['map'](_0x3f12f4,_0x12b3('0x38'));_0x4e37c4[_0x12b3('0x42')]=_[_0x12b3('0x43')](_0x1a319a[_0x12b3('0x42')]);_0x4e37c4[_0x12b3('0x44')]=_[_0x12b3('0x45')](_0x4e37c4[_0x12b3('0x41')],_0x4e37c4[_0x12b3('0x42')]);_0x53e6a3[_0x12b3('0x46')]=_['intersection'](_0x4e37c4['model'],qs['fields'](_0x1a319a[_0x12b3('0x42')][_0x12b3('0x47')]));_0x53e6a3['attributes']=_0x53e6a3['attributes']['length']?_0x53e6a3['attributes']:_0x4e37c4[_0x12b3('0x41')];if(!_0x1a319a[_0x12b3('0x42')][_0x12b3('0x48')](_0x12b3('0x49'))){_0x53e6a3[_0x12b3('0x2e')]=qs[_0x12b3('0x2e')](_0x1a319a[_0x12b3('0x42')]['limit']);_0x53e6a3[_0x12b3('0x2c')]=qs['offset'](_0x1a319a[_0x12b3('0x42')][_0x12b3('0x2c')]);}_0x53e6a3[_0x12b3('0x4a')]=qs[_0x12b3('0x4b')](_0x1a319a['query']['sort']);_0x53e6a3[_0x12b3('0x4c')]=qs[_0x12b3('0x44')](_[_0x12b3('0x4d')](_0x1a319a['query'],_0x4e37c4[_0x12b3('0x44')]),_0x3f12f4);if(_0x1a319a[_0x12b3('0x42')]['filter']){_0x53e6a3[_0x12b3('0x4c')]=_[_0x12b3('0x4e')](_0x53e6a3[_0x12b3('0x4c')],{'$or':_['map'](_0x3f12f4,function(_0x18d985){if(_0x18d985['type']!=='VIRTUAL'){var _0x15355b={};_0x15355b[_0x18d985[_0x12b3('0x38')]]={'$like':'%'+_0x1a319a['query'][_0x12b3('0x4f')]+'%'};return _0x15355b;}})});}_0x53e6a3=_[_0x12b3('0x4e')]({},_0x53e6a3,_0x1a319a[_0x12b3('0x50')]);var _0xeed0f5={'where':_0x53e6a3[_0x12b3('0x4c')]};return db['ChatMessage']['count'](_0xeed0f5)[_0x12b3('0x35')](function(_0x2f4b24){_0xb19942[_0x12b3('0x2f')]=_0x2f4b24;if(_0x1a319a['query'][_0x12b3('0x51')]){_0x53e6a3[_0x12b3('0x52')]=[{'all':!![]}];}return db[_0x12b3('0x3c')]['findAll'](_0x53e6a3);})[_0x12b3('0x35')](function(_0x1a1cd0){_0xb19942[_0x12b3('0x53')]=_0x1a1cd0;return _0xb19942;})[_0x12b3('0x35')](respondWithFilteredResult(_0x3e2582,_0x53e6a3))['catch'](handleError(_0x3e2582,null));};exports[_0x12b3('0x54')]=function(_0x47a68e,_0x10500b){var _0x22d359={'raw':!![],'where':{'id':_0x47a68e[_0x12b3('0x55')]['id']}},_0x447854={};_0x447854['model']=_[_0x12b3('0x43')](db[_0x12b3('0x3c')][_0x12b3('0x3d')]);_0x447854[_0x12b3('0x42')]=_[_0x12b3('0x43')](_0x47a68e[_0x12b3('0x42')]);_0x447854[_0x12b3('0x44')]=_['intersection'](_0x447854[_0x12b3('0x41')],_0x447854[_0x12b3('0x42')]);_0x22d359[_0x12b3('0x46')]=_['intersection'](_0x447854[_0x12b3('0x41')],qs[_0x12b3('0x47')](_0x47a68e[_0x12b3('0x42')][_0x12b3('0x47')]));_0x22d359['attributes']=_0x22d359[_0x12b3('0x46')]['length']?_0x22d359[_0x12b3('0x46')]:_0x447854['model'];if(_0x47a68e[_0x12b3('0x42')][_0x12b3('0x51')]){_0x22d359[_0x12b3('0x52')]=[{'all':!![]}];}_0x22d359=_['merge']({},_0x22d359,_0x47a68e['options']);return db['ChatMessage'][_0x12b3('0x56')](_0x22d359)[_0x12b3('0x35')](handleEntityNotFound(_0x10500b,null))[_0x12b3('0x35')](respondWithResult(_0x10500b,null))[_0x12b3('0x57')](handleError(_0x10500b,null));};exports[_0x12b3('0x58')]=function(_0x1db1b7,_0x28d2ec){return db[_0x12b3('0x3c')]['create'](_0x1db1b7[_0x12b3('0x59')],{})[_0x12b3('0x35')](respondWithResult(_0x28d2ec,0xc9))[_0x12b3('0x57')](handleError(_0x28d2ec,null));};exports[_0x12b3('0x34')]=function(_0x22a205,_0x4f7e35){if(_0x22a205['body']['id']){delete _0x22a205[_0x12b3('0x59')]['id'];}return db[_0x12b3('0x3c')]['find']({'where':{'id':_0x22a205[_0x12b3('0x55')]['id']}})[_0x12b3('0x35')](handleEntityNotFound(_0x4f7e35,null))[_0x12b3('0x35')](saveUpdates(_0x22a205[_0x12b3('0x59')],null))['then'](respondWithResult(_0x4f7e35,null))[_0x12b3('0x57')](handleError(_0x4f7e35,null));};exports[_0x12b3('0x36')]=function(_0x50175f,_0x279a28){return db[_0x12b3('0x3c')][_0x12b3('0x56')]({'where':{'id':_0x50175f[_0x12b3('0x55')]['id']}})['then'](handleEntityNotFound(_0x279a28,null))[_0x12b3('0x35')](removeEntity(_0x279a28,null))[_0x12b3('0x57')](handleError(_0x279a28,null));};exports[_0x12b3('0x5a')]=function(_0x49bafa,_0x50bd4f){return db['ChatMessage'][_0x12b3('0x5a')]()[_0x12b3('0x35')](respondWithResult(_0x50bd4f,null))['catch'](handleError(_0x50bd4f,null));};var interaction_log=require('../../config/logger')(_0x12b3('0x5b'));exports[_0x12b3('0x5c')]=function(_0x3599ae,_0x237de4,_0x4f9d7f){var _0x1cacde={'agent':{},'channel':'chat'};if(_0x3599ae[_0x12b3('0x59')]['id']){delete _0x3599ae[_0x12b3('0x59')]['id'];}_0x3599ae[_0x12b3('0x59')][_0x12b3('0x5d')]=!![];_0x3599ae[_0x12b3('0x59')]['readAt']=moment()[_0x12b3('0x5e')](_0x12b3('0x5f'));_0x3599ae[_0x12b3('0x59')]['UserId']=_0x3599ae[_0x12b3('0x59')]['UserId']||_0x3599ae['user']['id'];_0x1cacde[_0x12b3('0x60')]['id']=_0x3599ae[_0x12b3('0x59')][_0x12b3('0x61')];return db['ChatMessage'][_0x12b3('0x56')]({'where':{'id':_0x3599ae['params']['id'],'UserId':null}})[_0x12b3('0x35')](handleEntityNotFound(_0x237de4,null))['then'](saveUpdates(_0x3599ae[_0x12b3('0x59')],null))['then'](function(_0xb1455b){if(_0xb1455b){_0x1cacde[_0x12b3('0x26')]=_0xb1455b[_0x12b3('0x62')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0xb1455b['ChatInteractionId']}});}return null;})[_0x12b3('0x35')](handleEntityNotFound(_0x237de4,null))[_0x12b3('0x35')](function(_0xd59073){if(_0xd59073){return _0xd59073[_0x12b3('0x34')]({'UserId':_0x3599ae[_0x12b3('0x59')]['UserId'],'read1stAt':_[_0x12b3('0x63')](_0xd59073[_0x12b3('0x64')])?moment()[_0x12b3('0x5e')](_0x12b3('0x5f')):undefined});}return null;})['then'](function(_0x553056){if(_0x553056){_0x1cacde[_0x12b3('0x65')]=_0x553056[_0x12b3('0x62')]({'plain':!![]});interaction_log[_0x12b3('0x66')](_0x12b3('0x67'),_0x3599ae[_0x12b3('0x68')]['id'],_0x3599ae['user'][_0x12b3('0x38')],_0x3599ae['user'][_0x12b3('0x69')],_0x1cacde['interaction']['id'],_0x3599ae[_0x12b3('0x59')]?JSON[_0x12b3('0x6a')](_0x3599ae[_0x12b3('0x59')]):_0x12b3('0x6b'));return respondWithRpcPromise(_0x12b3('0x6c'),_0x12b3('0x6d'),_0x1cacde);}return null;})[_0x12b3('0x35')](function(_0x72e621){var _0x5cc8c9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x72e621[_0x12b3('0x26')][_0x12b3('0x6e')];return db['sequelize']['query'](_0x5cc8c9,{'type':db[_0x12b3('0x6f')]['QueryTypes'][_0x12b3('0x70')],'raw':!![]})[_0x12b3('0x35')](function(_0x3646ec){return _0x3646ec;});})[_0x12b3('0x35')](function(_0x1a4b11){if(_0x1a4b11){_0x1cacde[_0x12b3('0x26')]['contact']=_0x1a4b11[0x0];if(!_0x3599ae[_0x12b3('0x59')][_0x12b3('0x61')])return;return db[_0x12b3('0x71')][_0x12b3('0x56')]({'where':{'id':_0x3599ae['body'][_0x12b3('0x61')],'role':_0x12b3('0x60')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x481af9){if(!_0x481af9)return null;_0x1cacde['message'][_0x12b3('0x60')]=_0x481af9;return _0x1cacde;})['then'](function(_0x2aa96f){if(_0x2aa96f){if(_0x3599ae[_0x12b3('0x59')][_0x12b3('0x72')]){_0x1cacde[_0x12b3('0x26')][_0x12b3('0x73')]=util['format'](_0x12b3('0x74'),_0x3599ae[_0x12b3('0x68')][_0x12b3('0x38')]);_0x1cacde[_0x12b3('0x26')][_0x12b3('0x75')]=_0x1cacde[_0x12b3('0x75')];_0x1cacde[_0x12b3('0x26')][_0x12b3('0x76')]=_0x1cacde[_0x12b3('0x75')];_0x1cacde['message']['event']=_0x12b3('0x5c');return respondWithRpcPromise(_0x12b3('0x77'),'EventManager',{'event':_0x12b3('0x78'),'message':_[_0x12b3('0x4e')](_0x1cacde['message'],JSON[_0x12b3('0x79')](_0x1cacde[_0x12b3('0x65')][_0x12b3('0x7a')]))},client9002)[_0x12b3('0x35')](function(){return _0x1cacde;});}return _0x1cacde;}return null;})[_0x12b3('0x35')](respondWithResult(_0x237de4,null))[_0x12b3('0x57')](handleError(_0x237de4,null));};var interaction_log=require(_0x12b3('0x13'))(_0x12b3('0x5b'));exports[_0x12b3('0x32')]=function(_0x2eba5b,_0x75e373,_0x278044){var _0xa4ef66={'agent':{},'channel':_0x12b3('0x7b')};if(_0x2eba5b[_0x12b3('0x59')]['id']){delete _0x2eba5b[_0x12b3('0x59')]['id'];}_0x2eba5b[_0x12b3('0x59')][_0x12b3('0x61')]=_0x2eba5b[_0x12b3('0x59')]['UserId']||_0x2eba5b[_0x12b3('0x68')]['id'];_0xa4ef66[_0x12b3('0x60')]['id']=_0x2eba5b[_0x12b3('0x59')][_0x12b3('0x61')];return db[_0x12b3('0x3c')]['find']({'where':{'id':_0x2eba5b['params']['id'],'UserId':null}})[_0x12b3('0x35')](handleEntityNotFound(_0x75e373,null))[_0x12b3('0x35')](function(_0xf2b6a8){if(_0xf2b6a8){_0xa4ef66[_0x12b3('0x26')]=_0xf2b6a8[_0x12b3('0x62')]({'plain':!![]});return db['ChatInteraction'][_0x12b3('0x56')]({'where':{'id':_0xf2b6a8[_0x12b3('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x75e373,null))[_0x12b3('0x35')](function(_0x5d83f6){if(_0x5d83f6){_0xa4ef66['interaction']=_0x5d83f6[_0x12b3('0x62')]({'plain':!![]});interaction_log['info'](_0x12b3('0x7d'),_0x2eba5b[_0x12b3('0x68')]['id'],_0x2eba5b[_0x12b3('0x68')]['name'],_0x2eba5b[_0x12b3('0x68')][_0x12b3('0x69')],_0xa4ef66[_0x12b3('0x65')]['id'],_0x2eba5b['body']?JSON[_0x12b3('0x6a')](_0x2eba5b[_0x12b3('0x59')]):_0x12b3('0x6b'));return respondWithRpcPromise(_0x12b3('0x7e'),_0x12b3('0x7f'),_0xa4ef66);}return null;})['then'](function(_0x2fbf54){var _0x350b97='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2fbf54[_0x12b3('0x26')][_0x12b3('0x6e')];return db[_0x12b3('0x80')][_0x12b3('0x42')](_0x350b97,{'type':db[_0x12b3('0x6f')]['QueryTypes'][_0x12b3('0x70')],'raw':!![]})[_0x12b3('0x35')](function(_0x2d8872){return _0x2d8872;});})[_0x12b3('0x35')](function(_0x1484f6){if(_0x1484f6){_0xa4ef66[_0x12b3('0x26')][_0x12b3('0x81')]=_0x1484f6[0x0];if(!_0x2eba5b[_0x12b3('0x59')][_0x12b3('0x61')])return;return db['User'][_0x12b3('0x56')]({'where':{'id':_0x2eba5b[_0x12b3('0x59')]['UserId'],'role':_0x12b3('0x60')},'attributes':['id',_0x12b3('0x38'),_0x12b3('0x82'),_0x12b3('0x83'),_0x12b3('0x84')],'raw':!![]});}return null;})['then'](function(_0x19527a){if(!_0x19527a)return null;_0xa4ef66[_0x12b3('0x26')][_0x12b3('0x60')]=_0x19527a;return _0xa4ef66;})[_0x12b3('0x35')](function(_0x59f637){if(_0x59f637){_0x59f637[_0x12b3('0x26')]['interface']=util[_0x12b3('0x5e')]('SIP/%s',_0x2eba5b[_0x12b3('0x68')][_0x12b3('0x38')]);_0x59f637[_0x12b3('0x26')][_0x12b3('0x75')]=_0xa4ef66[_0x12b3('0x75')];_0x59f637[_0x12b3('0x26')]['motionChannel']=_0xa4ef66[_0x12b3('0x75')];_0x59f637[_0x12b3('0x26')]['event']=_0x12b3('0x32');respondWithRpcPromise(_0x12b3('0x77'),'EventManager',{'event':'rejectmessage','message':_[_0x12b3('0x4e')](_0xa4ef66[_0x12b3('0x26')],JSON[_0x12b3('0x79')](_0xa4ef66[_0x12b3('0x65')][_0x12b3('0x7a')]))},client9002);return _0xa4ef66;}return null;})[_0x12b3('0x35')](respondWithResult(_0x75e373,null))[_0x12b3('0x57')](handleError(_0x75e373,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9e9fa47..19f76ba 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 _0xedc9=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0xab4d08,_0x4de007){var _0x29f61a=function(_0x1492fe){while(--_0x1492fe){_0xab4d08['push'](_0xab4d08['shift']());}};_0x29f61a(++_0x4de007);}(_0xedc9,0x102));var _0x9edc=function(_0x317d4e,_0x3de942){_0x317d4e=_0x317d4e-0x0;var _0x56ce3d=_0xedc9[_0x317d4e];return _0x56ce3d;};'use strict';var EventEmitter=require(_0x9edc('0x0'));var ChatMessage=require(_0x9edc('0x1'))['db'][_0x9edc('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9edc('0x3')](0x0);var events={'afterCreate':_0x9edc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x34bca7){return function(_0x176f24,_0x13bc05,_0x2ee059){ChatMessageEvents[_0x9edc('0x5')](_0x34bca7+':'+_0x176f24['id'],_0x176f24);ChatMessageEvents[_0x9edc('0x5')](_0x34bca7,_0x176f24);_0x2ee059(null);};}for(var e in events){if(events[_0x9edc('0x6')](e)){var event=events[e];ChatMessage[_0x9edc('0x7')](e,emitEvent(event));}}module[_0x9edc('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xfabf=['save','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x179de4,_0x54a158){var _0x2a5388=function(_0x129826){while(--_0x129826){_0x179de4['push'](_0x179de4['shift']());}};_0x2a5388(++_0x54a158);}(_0xfabf,0x1dd));var _0xffab=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfabf[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xffab('0x0'));var ChatMessage=require(_0xffab('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xffab('0x2')](0x0);var events={'afterCreate':_0xffab('0x3'),'afterUpdate':'update','afterDestroy':_0xffab('0x4')};function emitEvent(_0x4ed091){return function(_0x241699,_0x5659c0,_0x178355){ChatMessageEvents[_0xffab('0x5')](_0x4ed091+':'+_0x241699['id'],_0x241699);ChatMessageEvents[_0xffab('0x5')](_0x4ed091,_0x241699);_0x178355(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xffab('0x6')](e,emitEvent(event));}}module[_0xffab('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c54ccbb..4eb04ba 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 _0xcefe=['api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x10f2b0,_0x37c84c){var _0xa4cf05=function(_0x2a3435){while(--_0x2a3435){_0x10f2b0['push'](_0x10f2b0['shift']());}};_0xa4cf05(++_0x37c84c);}(_0xcefe,0x15a));var _0xecef=function(_0x446267,_0x42e31){_0x446267=_0x446267-0x0;var _0x57caae=_0xcefe[_0x446267];return _0x57caae;};'use strict';var _=require(_0xecef('0x0'));var util=require('util');var logger=require(_0xecef('0x1'))(_0xecef('0x2'));var moment=require(_0xecef('0x3'));var BPromise=require('bluebird');var rp=require(_0xecef('0x4'));var fs=require('fs');var path=require(_0xecef('0x5'));var rimraf=require(_0xecef('0x6'));var config=require(_0xecef('0x7'));var attributes=require(_0xecef('0x8'));module['exports']=function(_0x5bc733,_0x147289){return _0x5bc733[_0xecef('0x9')]('ChatMessage',attributes,{'tableName':_0xecef('0xa'),'paranoid':![],'indexes':[{'name':_0xecef('0xb'),'fields':[_0xecef('0xc')],'type':_0xecef('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41bb3f,_0x361e61,_0x36cc1b){var _0x316a26=_0x5bc733[_0xecef('0xe')];var _0x43e0c0=_0x41bb3f[_0xecef('0xf')]({'plain':!![]});if(_0x43e0c0[_0xecef('0x10')][_0xecef('0x11')]()==='in'||_0x43e0c0[_0xecef('0x10')][_0xecef('0x11')]()===_0xecef('0x12')&&!_0x43e0c0[_0xecef('0x13')]&&!_['isNil'](_0x43e0c0[_0xecef('0x14')])){_0x316a26[_0xecef('0x15')][_0xecef('0x16')]({'where':{'id':_0x43e0c0['ChatInteractionId']}})[_0xecef('0x17')](function(_0x29e515){if(_0x29e515){_0x29e515[_0xecef('0x18')]({'lastMsgAt':_0x43e0c0[_0xecef('0x19')],'lastMsgDirection':_0x43e0c0[_0xecef('0x10')][_0xecef('0x11')]()});}})[_0xecef('0x1a')](function(_0x29e69b){console[_0xecef('0x1b')](_0x29e69b);});}_0x36cc1b();}},'charset':'utf8mb4','collate':_0xecef('0x1c')});}; \ No newline at end of file +var _0xcb16=['body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatMessage','chat_messages','fti_chat_messages'];(function(_0x31b4b3,_0x1e183a){var _0x1bdae6=function(_0x5f20b0){while(--_0x5f20b0){_0x31b4b3['push'](_0x31b4b3['shift']());}};_0x1bdae6(++_0x1e183a);}(_0xcb16,0x109));var _0x6cb1=function(_0x46828f,_0x469534){_0x46828f=_0x46828f-0x0;var _0x15b51a=_0xcb16[_0x46828f];return _0x15b51a;};'use strict';var _=require(_0x6cb1('0x0'));var util=require(_0x6cb1('0x1'));var logger=require(_0x6cb1('0x2'))(_0x6cb1('0x3'));var moment=require(_0x6cb1('0x4'));var BPromise=require(_0x6cb1('0x5'));var rp=require(_0x6cb1('0x6'));var fs=require('fs');var path=require(_0x6cb1('0x7'));var rimraf=require(_0x6cb1('0x8'));var config=require(_0x6cb1('0x9'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x131226,_0x148562){return _0x131226[_0x6cb1('0xa')](_0x6cb1('0xb'),attributes,{'tableName':_0x6cb1('0xc'),'paranoid':![],'indexes':[{'name':_0x6cb1('0xd'),'fields':[_0x6cb1('0xe')],'type':_0x6cb1('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c7192,_0x3698c0,_0x20e64e){var _0x11f6be=_0x131226[_0x6cb1('0x10')];var _0x4747a6=_0x5c7192[_0x6cb1('0x11')]({'plain':!![]});if(_0x4747a6['direction'][_0x6cb1('0x12')]()==='in'||_0x4747a6['direction'][_0x6cb1('0x12')]()===_0x6cb1('0x13')&&!_0x4747a6[_0x6cb1('0x14')]&&!_[_0x6cb1('0x15')](_0x4747a6['UserId'])){_0x11f6be[_0x6cb1('0x16')][_0x6cb1('0x17')]({'where':{'id':_0x4747a6[_0x6cb1('0x18')]}})[_0x6cb1('0x19')](function(_0xecc76a){if(_0xecc76a){_0xecc76a['update']({'lastMsgAt':_0x4747a6['createdAt'],'lastMsgDirection':_0x4747a6[_0x6cb1('0x1a')][_0x6cb1('0x12')]()});}})[_0x6cb1('0x1b')](function(_0x310c64){console[_0x6cb1('0x1c')](_0x310c64);});}_0x20e64e();}},'charset':_0x6cb1('0x1d'),'collate':_0x6cb1('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 92b8980..c3e504d 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 _0x27e9=['CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x27e9,0x116));var _0x927e=function(_0x2faa64,_0x6f5fe0){_0x2faa64=_0x2faa64-0x0;var _0x29f12f=_0x27e9[_0x2faa64];return _0x29f12f;};'use strict';var _=require(_0x927e('0x0'));var util=require(_0x927e('0x1'));var moment=require('moment');var BPromise=require(_0x927e('0x2'));var rs=require(_0x927e('0x3'));var fs=require('fs');var Redis=require(_0x927e('0x4'));var db=require(_0x927e('0x5'))['db'];var utils=require(_0x927e('0x6'));var logger=require(_0x927e('0x7'))('rpc');var config=require(_0x927e('0x8'));var jayson=require(_0x927e('0x9'));var client=jayson[_0x927e('0xa')]['http']({'port':0x232a});config[_0x927e('0xb')]=_[_0x927e('0xc')](config[_0x927e('0xb')],{'host':_0x927e('0xd'),'port':0x18eb});var socket=require(_0x927e('0xe'))(new Redis(config[_0x927e('0xb')]));require('./chatMessage.socket')[_0x927e('0xf')](socket);function respondWithRpcPromise(_0x359338,_0x5d1336,_0x26242e){return new BPromise(function(_0x2ecbfa,_0x8f9fd1){return client[_0x927e('0x10')](_0x359338,_0x26242e)[_0x927e('0x11')](function(_0x225a25){logger[_0x927e('0x12')](_0x927e('0x13'),_0x5d1336,_0x927e('0x14'));logger['debug'](_0x927e('0x15'),_0x5d1336,_0x927e('0x14'),JSON[_0x927e('0x16')](_0x225a25));if(_0x225a25[_0x927e('0x17')]){if(_0x225a25['error'][_0x927e('0x18')]===0x1f4){logger['error'](_0x927e('0x13'),_0x5d1336,_0x225a25['error'][_0x927e('0x19')]);return _0x8f9fd1(_0x225a25['error'][_0x927e('0x19')]);}logger[_0x927e('0x17')](_0x927e('0x13'),_0x5d1336,_0x225a25[_0x927e('0x17')]['message']);return _0x2ecbfa(_0x225a25[_0x927e('0x17')][_0x927e('0x19')]);}else{logger['info'](_0x927e('0x13'),_0x5d1336,_0x927e('0x14'));_0x2ecbfa(_0x225a25[_0x927e('0x1a')][_0x927e('0x19')]);}})[_0x927e('0x1b')](function(_0x43ee4a){logger[_0x927e('0x17')](_0x927e('0x13'),_0x5d1336,_0x43ee4a);_0x8f9fd1(_0x43ee4a);});});}exports[_0x927e('0x1c')]=function(_0x23afc4){var _0x30892c=this;return new Promise(function(_0x58c2f7,_0x3f20e6){return db[_0x927e('0x1d')][_0x927e('0x1e')](_0x23afc4[_0x927e('0x1f')],{'raw':_0x23afc4[_0x927e('0x20')]?_0x23afc4[_0x927e('0x20')][_0x927e('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x40d8ce){logger[_0x927e('0x12')]('CreateChatMessage',_0x23afc4);logger['debug'](_0x927e('0x1c'),_0x23afc4,JSON['stringify'](_0x40d8ce));_0x58c2f7(_0x40d8ce);})[_0x927e('0x1b')](function(_0x59413c){logger[_0x927e('0x17')](_0x927e('0x1c'),_0x59413c[_0x927e('0x19')],_0x23afc4);_0x3f20e6(_0x30892c[_0x927e('0x17')](0x1f4,_0x59413c[_0x927e('0x19')]));});});}; \ No newline at end of file +var _0x412d=['body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatMessage','ChatMessage','create'];(function(_0x2dd35d,_0x7a2fa8){var _0x2e668c=function(_0x79c886){while(--_0x79c886){_0x2dd35d['push'](_0x2dd35d['shift']());}};_0x2e668c(++_0x7a2fa8);}(_0x412d,0xfc));var _0xd412=function(_0x2941e9,_0x31b90b){_0x2941e9=_0x2941e9-0x0;var _0x409590=_0x412d[_0x2941e9];return _0x409590;};'use strict';var _=require(_0xd412('0x0'));var util=require(_0xd412('0x1'));var moment=require(_0xd412('0x2'));var BPromise=require(_0xd412('0x3'));var rs=require(_0xd412('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd412('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd412('0x6'));var client=jayson[_0xd412('0x7')][_0xd412('0x8')]({'port':0x232a});config['redis']=_[_0xd412('0x9')](config[_0xd412('0xa')],{'host':_0xd412('0xb'),'port':0x18eb});var socket=require(_0xd412('0xc'))(new Redis(config[_0xd412('0xa')]));require(_0xd412('0xd'))[_0xd412('0xe')](socket);function respondWithRpcPromise(_0x2b89bf,_0xae447e,_0x5951a1){return new BPromise(function(_0x5f400c,_0x55d209){return client['request'](_0x2b89bf,_0x5951a1)[_0xd412('0xf')](function(_0x5413a5){logger['info'](_0xd412('0x10'),_0xae447e,_0xd412('0x11'));logger[_0xd412('0x12')](_0xd412('0x13'),_0xae447e,_0xd412('0x11'),JSON['stringify'](_0x5413a5));if(_0x5413a5[_0xd412('0x14')]){if(_0x5413a5['error']['code']===0x1f4){logger[_0xd412('0x14')](_0xd412('0x10'),_0xae447e,_0x5413a5[_0xd412('0x14')][_0xd412('0x15')]);return _0x55d209(_0x5413a5[_0xd412('0x14')][_0xd412('0x15')]);}logger[_0xd412('0x14')](_0xd412('0x10'),_0xae447e,_0x5413a5[_0xd412('0x14')][_0xd412('0x15')]);return _0x5f400c(_0x5413a5[_0xd412('0x14')][_0xd412('0x15')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0xae447e,'request\x20sent');_0x5f400c(_0x5413a5[_0xd412('0x16')][_0xd412('0x15')]);}})[_0xd412('0x17')](function(_0x103304){logger['error'](_0xd412('0x10'),_0xae447e,_0x103304);_0x55d209(_0x103304);});});}exports[_0xd412('0x18')]=function(_0x18cba5){var _0x4cbcfb=this;return new Promise(function(_0x5b29fb,_0x4a7e65){return db[_0xd412('0x19')][_0xd412('0x1a')](_0x18cba5[_0xd412('0x1b')],{'raw':_0x18cba5['options']?_0x18cba5[_0xd412('0x1c')][_0xd412('0x1d')]===undefined?!![]:![]:!![]})[_0xd412('0xf')](function(_0x41610d){logger['info']('CreateChatMessage',_0x18cba5);logger['debug'](_0xd412('0x18'),_0x18cba5,JSON[_0xd412('0x1e')](_0x41610d));_0x5b29fb(_0x41610d);})[_0xd412('0x17')](function(_0x302937){logger[_0xd412('0x14')](_0xd412('0x18'),_0x302937['message'],_0x18cba5);_0x4a7e65(_0x4cbcfb[_0xd412('0x14')](0x1f4,_0x302937['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2dac4fa..3f27410 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 _0x8ca9=['length','chatMessage:','./chatMessage.events','save','remove','update','register'];(function(_0x3779cf,_0x4f316a){var _0x264263=function(_0x2163de){while(--_0x2163de){_0x3779cf['push'](_0x3779cf['shift']());}};_0x264263(++_0x4f316a);}(_0x8ca9,0x9c));var _0x98ca=function(_0xb6298b,_0x2631cc){_0xb6298b=_0xb6298b-0x0;var _0x3239d9=_0x8ca9[_0xb6298b];return _0x3239d9;};'use strict';var ChatMessageEvents=require(_0x98ca('0x0'));var events=[_0x98ca('0x1'),_0x98ca('0x2'),_0x98ca('0x3')];function createListener(_0x3d9153,_0x22047f){return function(_0xe479d6){_0x22047f['emit'](_0x3d9153,_0xe479d6);};}function removeListener(_0x4c230f,_0x142793){return function(){ChatMessageEvents['removeListener'](_0x4c230f,_0x142793);};}exports[_0x98ca('0x4')]=function(_0x48415d){for(var _0x219619=0x0,_0xca4097=events[_0x98ca('0x5')];_0x219619<_0xca4097;_0x219619++){var _0x2852a0=events[_0x219619];var _0x323c95=createListener(_0x98ca('0x6')+_0x2852a0,_0x48415d);ChatMessageEvents['on'](_0x2852a0,_0x323c95);}}; \ No newline at end of file +var _0x7c8e=['update','emit','removeListener','register','length','chatMessage:','save','remove'];(function(_0x39cf69,_0x1ddc96){var _0x4c0fa6=function(_0x5cfeb1){while(--_0x5cfeb1){_0x39cf69['push'](_0x39cf69['shift']());}};_0x4c0fa6(++_0x1ddc96);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x5a6355,_0x2b5c5b){_0x5a6355=_0x5a6355-0x0;var _0x14b0f6=_0x7c8e[_0x5a6355];return _0x14b0f6;};'use strict';var ChatMessageEvents=require('./chatMessage.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(){ChatMessageEvents[_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);ChatMessageEvents['on'](_0x3d3f66,_0x5261da);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 07733c9..3714d81 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 _0x3eaf=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x3eaf,0x180));var _0xf3ea=function(_0x2e9626,_0x22c5a1){_0x2e9626=_0x2e9626-0x0;var _0x292f9c=_0x3eaf[_0x2e9626];return _0x292f9c;};'use strict';var multer=require(_0xf3ea('0x0'));var util=require(_0xf3ea('0x1'));var path=require(_0xf3ea('0x2'));var timeout=require('connect-timeout');var express=require(_0xf3ea('0x3'));var router=express[_0xf3ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf3ea('0x5'));var interaction=require(_0xf3ea('0x6'));var config=require(_0xf3ea('0x7'));var controller=require(_0xf3ea('0x8'));router[_0xf3ea('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf3ea('0x9')]('/describe',auth[_0xf3ea('0xa')](),controller[_0xf3ea('0xb')]);router['get'](_0xf3ea('0xc'),auth[_0xf3ea('0xa')](),controller[_0xf3ea('0xd')]);router[_0xf3ea('0xe')]('/',auth[_0xf3ea('0xa')](),interaction[_0xf3ea('0xf')](_0xf3ea('0x10'),_0xf3ea('0x11')),controller[_0xf3ea('0x12')]);router[_0xf3ea('0x13')](_0xf3ea('0xc'),controller['update']);router[_0xf3ea('0x13')](_0xf3ea('0x14'),auth['isAuthenticated'](),controller[_0xf3ea('0x15')]);router[_0xf3ea('0x13')]('/:id/reject',auth[_0xf3ea('0xa')](),controller[_0xf3ea('0x16')]);router[_0xf3ea('0x17')](_0xf3ea('0xc'),auth[_0xf3ea('0xa')](),controller[_0xf3ea('0x18')]);module[_0xf3ea('0x19')]=router; \ No newline at end of file +var _0x4933=['/:id','update','/:id/accept','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatMessage.controller','get','index','/describe','isAuthenticated','show','post','tracked','chat','chatmessage:create','create','put'];(function(_0x28d956,_0x59cd59){var _0x110eda=function(_0x24c847){while(--_0x24c847){_0x28d956['push'](_0x28d956['shift']());}};_0x110eda(++_0x59cd59);}(_0x4933,0x19d));var _0x3493=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x4933[_0x13187a];return _0x65b85f;};'use strict';var multer=require(_0x3493('0x0'));var util=require(_0x3493('0x1'));var path=require(_0x3493('0x2'));var timeout=require(_0x3493('0x3'));var express=require('express');var router=express[_0x3493('0x4')]();var fs_extra=require(_0x3493('0x5'));var auth=require(_0x3493('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3493('0x7'));router[_0x3493('0x8')]('/',auth['isAuthenticated'](),controller[_0x3493('0x9')]);router[_0x3493('0x8')](_0x3493('0xa'),auth[_0x3493('0xb')](),controller['describe']);router[_0x3493('0x8')]('/:id',auth[_0x3493('0xb')](),controller[_0x3493('0xc')]);router[_0x3493('0xd')]('/',auth['isAuthenticated'](),interaction[_0x3493('0xe')](_0x3493('0xf'),_0x3493('0x10')),controller[_0x3493('0x11')]);router[_0x3493('0x12')](_0x3493('0x13'),controller[_0x3493('0x14')]);router[_0x3493('0x12')](_0x3493('0x15'),auth[_0x3493('0xb')](),controller['accept']);router['put']('/:id/reject',auth[_0x3493('0xb')](),controller['reject']);router['delete']('/:id',auth[_0x3493('0xb')](),controller[_0x3493('0x16')]);module[_0x3493('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 8704df4..f93101e 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 _0x15f4=['TEXT','medium','sequelize'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x15f4,0x167));var _0x415f=function(_0x4275af,_0x54d474){_0x4275af=_0x4275af-0x0;var _0x317cb6=_0x15f4[_0x4275af];return _0x317cb6;};'use strict';var Sequelize=require(_0x415f('0x0'));module['exports']={'body':{'type':Sequelize[_0x415f('0x1')](_0x415f('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x02e4=['sequelize','exports','TEXT'];(function(_0x2356e3,_0x3c1521){var _0x12e9f7=function(_0x47acc9){while(--_0x47acc9){_0x2356e3['push'](_0x2356e3['shift']());}};_0x12e9f7(++_0x3c1521);}(_0x02e4,0xa5));var _0x402e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x02e4[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x402e('0x0'));module[_0x402e('0x1')]={'body':{'type':Sequelize[_0x402e('0x2')]('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 3212d82..779306b 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 _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(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7a54,0x106));var _0x47a5=function(_0x579a37,_0x255448){_0x579a37=_0x579a37-0x0;var _0x12e8dc=_0x7a54[_0x579a37];return _0x12e8dc;};'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 +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(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x7a54,0x106));var _0x47a5=function(_0xf59382,_0x18a6ca){_0xf59382=_0xf59382-0x0;var _0x5131ca=_0x7a54[_0xf59382];return _0x5131ca;};'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.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index fb88e2b..49ea97d 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 _0xb00a=['bluebird','path','rimraf','../../config/environment','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x38df12,_0x40fbea){var _0x4cbe9=function(_0x3bfd91){while(--_0x3bfd91){_0x38df12['push'](_0x38df12['shift']());}};_0x4cbe9(++_0x40fbea);}(_0xb00a,0xa3));var _0xab00=function(_0x3cbdab,_0x3b2a8c){_0x3cbdab=_0x3cbdab-0x0;var _0x312b74=_0xb00a[_0x3cbdab];return _0x312b74;};'use strict';var _=require('lodash');var util=require(_0xab00('0x0'));var logger=require(_0xab00('0x1'))('api');var moment=require('moment');var BPromise=require(_0xab00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab00('0x3'));var rimraf=require(_0xab00('0x4'));var config=require(_0xab00('0x5'));var attributes=require('./chatOfflineMessage.attributes');module[_0xab00('0x6')]=function(_0x470e2f,_0x3b47ae){return _0x470e2f[_0xab00('0x7')](_0xab00('0x8'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab00('0x9'),'collate':_0xab00('0xa')});}; \ No newline at end of file +var _0xfc64=['bluebird','request-promise','path','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0xfc64,0x101));var _0x4fc6=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xfc64[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x4fc6('0x0'));var util=require(_0x4fc6('0x1'));var logger=require('../../config/logger')(_0x4fc6('0x2'));var moment=require('moment');var BPromise=require(_0x4fc6('0x3'));var rp=require(_0x4fc6('0x4'));var fs=require('fs');var path=require(_0x4fc6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4fc6('0x6'));module[_0x4fc6('0x7')]=function(_0xff9796,_0x599bc9){return _0xff9796[_0x4fc6('0x8')](_0x4fc6('0x9'),attributes,{'tableName':_0x4fc6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4fc6('0xb'),'collate':_0x4fc6('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 1c83fa9..b0382ee 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 _0xadc5=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x47d12e,_0x2d0ada){var _0x1250dc=function(_0x21a5e8){while(--_0x21a5e8){_0x47d12e['push'](_0x47d12e['shift']());}};_0x1250dc(++_0x2d0ada);}(_0xadc5,0x1bd));var _0x5adc=function(_0x4f5185,_0x3f5e83){_0x4f5185=_0x4f5185-0x0;var _0x4f70d8=_0xadc5[_0x4f5185];return _0x4f70d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5adc('0x0'));var BPromise=require(_0x5adc('0x1'));var rs=require(_0x5adc('0x2'));var fs=require('fs');var Redis=require(_0x5adc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5adc('0x4'))(_0x5adc('0x5'));var config=require(_0x5adc('0x6'));var jayson=require(_0x5adc('0x7'));var client=jayson[_0x5adc('0x8')][_0x5adc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d8bf0,_0x44182d,_0x467654){return new BPromise(function(_0xc27950,_0x19b10e){return client[_0x5adc('0xa')](_0x2d8bf0,_0x467654)[_0x5adc('0xb')](function(_0x1c86dc){logger[_0x5adc('0xc')](_0x5adc('0xd'),_0x44182d,_0x5adc('0xe'));logger[_0x5adc('0xf')](_0x5adc('0x10'),_0x44182d,_0x5adc('0xe'),JSON[_0x5adc('0x11')](_0x1c86dc));if(_0x1c86dc[_0x5adc('0x12')]){if(_0x1c86dc[_0x5adc('0x12')][_0x5adc('0x13')]===0x1f4){logger[_0x5adc('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x44182d,_0x1c86dc[_0x5adc('0x12')][_0x5adc('0x14')]);return _0x19b10e(_0x1c86dc[_0x5adc('0x12')][_0x5adc('0x14')]);}logger[_0x5adc('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x44182d,_0x1c86dc[_0x5adc('0x12')][_0x5adc('0x14')]);return _0xc27950(_0x1c86dc['error'][_0x5adc('0x14')]);}else{logger[_0x5adc('0xc')](_0x5adc('0xd'),_0x44182d,_0x5adc('0xe'));_0xc27950(_0x1c86dc[_0x5adc('0x15')][_0x5adc('0x14')]);}})[_0x5adc('0x16')](function(_0x4412d9){logger[_0x5adc('0x12')](_0x5adc('0xd'),_0x44182d,_0x4412d9);_0x19b10e(_0x4412d9);});});} \ No newline at end of file +var _0xd4c1=['../../mysqldb','../../config/utils','../../config/logger','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','ioredis'];(function(_0x6b893a,_0x1c8b87){var _0x53195f=function(_0xdd4e17){while(--_0xdd4e17){_0x6b893a['push'](_0x6b893a['shift']());}};_0x53195f(++_0x1c8b87);}(_0xd4c1,0x165));var _0x1d4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4c1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1d4c('0x0'));var moment=require(_0x1d4c('0x1'));var BPromise=require(_0x1d4c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d4c('0x3'));var db=require(_0x1d4c('0x4'))['db'];var utils=require(_0x1d4c('0x5'));var logger=require(_0x1d4c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1d4c('0x7')][_0x1d4c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21e7b3,_0x5c9e2b,_0x1805c7){return new BPromise(function(_0x1a67db,_0x33522c){return client[_0x1d4c('0x9')](_0x21e7b3,_0x1805c7)['then'](function(_0x6df85e){logger['info'](_0x1d4c('0xa'),_0x5c9e2b,_0x1d4c('0xb'));logger['debug'](_0x1d4c('0xc'),_0x5c9e2b,_0x1d4c('0xb'),JSON[_0x1d4c('0xd')](_0x6df85e));if(_0x6df85e[_0x1d4c('0xe')]){if(_0x6df85e['error'][_0x1d4c('0xf')]===0x1f4){logger[_0x1d4c('0xe')](_0x1d4c('0xa'),_0x5c9e2b,_0x6df85e[_0x1d4c('0xe')][_0x1d4c('0x10')]);return _0x33522c(_0x6df85e[_0x1d4c('0xe')][_0x1d4c('0x10')]);}logger[_0x1d4c('0xe')](_0x1d4c('0xa'),_0x5c9e2b,_0x6df85e['error'][_0x1d4c('0x10')]);return _0x1a67db(_0x6df85e[_0x1d4c('0xe')][_0x1d4c('0x10')]);}else{logger[_0x1d4c('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5c9e2b,_0x1d4c('0xb'));_0x1a67db(_0x6df85e[_0x1d4c('0x12')][_0x1d4c('0x10')]);}})['catch'](function(_0x1c5fce){logger['error'](_0x1d4c('0xa'),_0x5c9e2b,_0x1c5fce);_0x33522c(_0x1c5fce);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3e0906f..6e4b532 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 _0x2979=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','connect-timeout','express','Router','fs-extra'];(function(_0x52c71f,_0x5aa1e9){var _0x4063a1=function(_0xca8971){while(--_0xca8971){_0x52c71f['push'](_0x52c71f['shift']());}};_0x4063a1(++_0x5aa1e9);}(_0x2979,0x74));var _0x9297=function(_0x51ee74,_0x18e42e){_0x51ee74=_0x51ee74-0x0;var _0x1971dd=_0x2979[_0x51ee74];return _0x1971dd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9297('0x0'));var express=require(_0x9297('0x1'));var router=express[_0x9297('0x2')]();var fs_extra=require(_0x9297('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9297('0x4'));var controller=require(_0x9297('0x5'));router[_0x9297('0x6')]('/',auth[_0x9297('0x7')](),controller[_0x9297('0x8')]);router[_0x9297('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x9297('0x9'),auth[_0x9297('0x7')](),controller[_0x9297('0xa')]);router['post']('/',auth[_0x9297('0x7')](),controller['create']);router[_0x9297('0xb')](_0x9297('0x9'),auth['isAuthenticated'](),controller[_0x9297('0xc')]);router[_0x9297('0xd')](_0x9297('0x9'),auth[_0x9297('0x7')](),controller['destroy']);module[_0x9297('0xe')]=router; \ No newline at end of file +var _0x671e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','exports','multer','util','connect-timeout','Router'];(function(_0x3cec18,_0x95c004){var _0x54fd25=function(_0x3b4cbf){while(--_0x3b4cbf){_0x3cec18['push'](_0x3cec18['shift']());}};_0x54fd25(++_0x95c004);}(_0x671e,0x152));var _0xe671=function(_0x456f2d,_0x3ff5d8){_0x456f2d=_0x456f2d-0x0;var _0x18281a=_0x671e[_0x456f2d];return _0x18281a;};'use strict';var multer=require(_0xe671('0x0'));var util=require(_0xe671('0x1'));var path=require('path');var timeout=require(_0xe671('0x2'));var express=require('express');var router=express[_0xe671('0x3')]();var fs_extra=require(_0xe671('0x4'));var auth=require(_0xe671('0x5'));var interaction=require(_0xe671('0x6'));var config=require(_0xe671('0x7'));var controller=require(_0xe671('0x8'));router[_0xe671('0x9')]('/',auth[_0xe671('0xa')](),controller[_0xe671('0xb')]);router[_0xe671('0x9')](_0xe671('0xc'),auth[_0xe671('0xa')](),controller['describe']);router[_0xe671('0x9')](_0xe671('0xd'),auth[_0xe671('0xa')](),controller[_0xe671('0xe')]);router[_0xe671('0xf')]('/',auth['isAuthenticated'](),controller[_0xe671('0x10')]);router[_0xe671('0x11')]('/:id',auth[_0xe671('0xa')](),controller['update']);router['delete'](_0xe671('0xd'),auth[_0xe671('0xa')](),controller['destroy']);module[_0xe671('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 88afb91..3c2886d 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 _0x8109=['mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0x474bc7,_0x2b7561){var _0x17566c=function(_0x1b1220){while(--_0x1b1220){_0x474bc7['push'](_0x474bc7['shift']());}};_0x17566c(++_0x2b7561);}(_0x8109,0x1ce));var _0x9810=function(_0x53146b,_0x599c6e){_0x53146b=_0x53146b-0x0;var _0x25b2b3=_0x8109[_0x53146b];return _0x25b2b3;};'use strict';var Sequelize=require(_0x9810('0x0'));module[_0x9810('0x1')]={'name':{'type':Sequelize[_0x9810('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9810('0x3'),'timeout'),'defaultValue':_0x9810('0x3')},'selector':{'type':Sequelize[_0x9810('0x2')]},'timeout':{'type':Sequelize[_0x9810('0x4')]}}; \ No newline at end of file +var _0xbc95=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x49faff,_0x247916){var _0x127f8b=function(_0x274428){while(--_0x274428){_0x49faff['push'](_0x49faff['shift']());}};_0x127f8b(++_0x247916);}(_0xbc95,0x139));var _0x5bc9=function(_0x487d0a,_0x1b7cb4){_0x487d0a=_0x487d0a-0x0;var _0x3d740c=_0xbc95[_0x487d0a];return _0x3d740c;};'use strict';var Sequelize=require(_0x5bc9('0x0'));module[_0x5bc9('0x1')]={'name':{'type':Sequelize[_0x5bc9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5bc9('0x3')]('mouseOver','timeout'),'defaultValue':_0x5bc9('0x4')},'selector':{'type':Sequelize[_0x5bc9('0x2')]},'timeout':{'type':Sequelize[_0x5bc9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ab27b29..e11c2d0 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 _0xc090=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','name','send','show','params','model','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','body','update','ChatProactiveAction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x52dfa5,_0x49ac28){var _0x49970d=function(_0x3e0e9e){while(--_0x3e0e9e){_0x52dfa5['push'](_0x52dfa5['shift']());}};_0x49970d(++_0x49ac28);}(_0xc090,0x112));var _0x0c09=function(_0x36f104,_0xfae805){_0x36f104=_0x36f104-0x0;var _0x985b3d=_0xc090[_0x36f104];return _0x985b3d;};'use strict';var emlformat=require(_0x0c09('0x0'));var rimraf=require(_0x0c09('0x1'));var zipdir=require(_0x0c09('0x2'));var jsonpatch=require(_0x0c09('0x3'));var rp=require(_0x0c09('0x4'));var moment=require(_0x0c09('0x5'));var BPromise=require(_0x0c09('0x6'));var Mustache=require(_0x0c09('0x7'));var util=require(_0x0c09('0x8'));var path=require('path');var sox=require(_0x0c09('0x9'));var csv=require(_0x0c09('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c09('0xb'));var squel=require('squel');var crypto=require(_0x0c09('0xc'));var jsforce=require(_0x0c09('0xd'));var deskjs=require(_0x0c09('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0c09('0xf'));var Papa=require(_0x0c09('0x10'));var Redis=require('ioredis');var authService=require(_0x0c09('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0c09('0x12'));var hardwareService=require(_0x0c09('0x13'));var logger=require(_0x0c09('0x14'))(_0x0c09('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c09('0x16'))['db'];function respondWithStatusCode(_0x5d1d77,_0x59df8b){_0x59df8b=_0x59df8b||0xcc;return function(_0xbe8522){if(_0xbe8522){return _0x5d1d77['sendStatus'](_0x59df8b);}return _0x5d1d77[_0x0c09('0x17')](_0x59df8b)[_0x0c09('0x18')]();};}function respondWithResult(_0x21c45b,_0xeb18fb){_0xeb18fb=_0xeb18fb||0xc8;return function(_0x388b2e){if(_0x388b2e){return _0x21c45b[_0x0c09('0x17')](_0xeb18fb)[_0x0c09('0x19')](_0x388b2e);}};}function respondWithFilteredResult(_0x2dcdae,_0x367c86){return function(_0x264d21){if(_0x264d21){var _0x482dc1=typeof _0x367c86[_0x0c09('0x1a')]===_0x0c09('0x1b')&&typeof _0x367c86[_0x0c09('0x1c')]===_0x0c09('0x1b');var _0x20ad8a=_0x264d21[_0x0c09('0x1d')];var _0x2d610d=_0x482dc1?0x0:_0x367c86[_0x0c09('0x1a')];var _0xffc47=_0x482dc1?_0x264d21[_0x0c09('0x1d')]:_0x367c86[_0x0c09('0x1a')]+_0x367c86[_0x0c09('0x1c')];var _0x519eea;if(_0xffc47>=_0x20ad8a){_0xffc47=_0x20ad8a;_0x519eea=0xc8;}else{_0x519eea=0xce;}_0x2dcdae[_0x0c09('0x17')](_0x519eea);return _0x2dcdae[_0x0c09('0x1e')]('Content-Range',_0x2d610d+'-'+_0xffc47+'/'+_0x20ad8a)['json'](_0x264d21);}return null;};}function patchUpdates(_0x2af860){return function(_0x205962){try{jsonpatch[_0x0c09('0x1f')](_0x205962,_0x2af860,!![]);}catch(_0x48c124){return BPromise[_0x0c09('0x20')](_0x48c124);}return _0x205962[_0x0c09('0x21')]();};}function saveUpdates(_0x3206b5,_0x5488ac){return function(_0x301938){if(_0x301938){return _0x301938['update'](_0x3206b5)[_0x0c09('0x22')](function(_0x39452e){return _0x39452e;});}return null;};}function removeEntity(_0x3aaabf,_0x1dc995){return function(_0xad7cf9){if(_0xad7cf9){return _0xad7cf9[_0x0c09('0x23')]()[_0x0c09('0x22')](function(){_0x3aaabf[_0x0c09('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x544ac4,_0xcf0257){return function(_0x1b7731){if(!_0x1b7731){_0x544ac4[_0x0c09('0x24')](0x194);}return _0x1b7731;};}function handleError(_0x63bd83,_0x36e0c0){_0x36e0c0=_0x36e0c0||0x1f4;return function(_0x449262){logger[_0x0c09('0x25')](_0x449262['stack']);if(_0x449262['name']){delete _0x449262[_0x0c09('0x26')];}_0x63bd83[_0x0c09('0x17')](_0x36e0c0)[_0x0c09('0x27')](_0x449262);};}exports[_0x0c09('0x28')]=function(_0x2ce4e9,_0x61a907){var _0x1dee90={'raw':!![],'where':{'id':_0x2ce4e9[_0x0c09('0x29')]['id']}},_0x376742={};_0x376742[_0x0c09('0x2a')]=_['keys'](db['ChatProactiveAction'][_0x0c09('0x2b')]);_0x376742[_0x0c09('0x2c')]=_['keys'](_0x2ce4e9[_0x0c09('0x2c')]);_0x376742[_0x0c09('0x2d')]=_[_0x0c09('0x2e')](_0x376742[_0x0c09('0x2a')],_0x376742[_0x0c09('0x2c')]);_0x1dee90[_0x0c09('0x2f')]=_['intersection'](_0x376742[_0x0c09('0x2a')],qs[_0x0c09('0x30')](_0x2ce4e9[_0x0c09('0x2c')]['fields']));_0x1dee90[_0x0c09('0x2f')]=_0x1dee90['attributes']['length']?_0x1dee90['attributes']:_0x376742[_0x0c09('0x2a')];if(_0x2ce4e9[_0x0c09('0x2c')][_0x0c09('0x31')]){_0x1dee90[_0x0c09('0x32')]=[{'all':!![]}];}_0x1dee90=_[_0x0c09('0x33')]({},_0x1dee90,_0x2ce4e9[_0x0c09('0x34')]);return db['ChatProactiveAction'][_0x0c09('0x35')](_0x1dee90)[_0x0c09('0x22')](handleEntityNotFound(_0x61a907,null))['then'](respondWithResult(_0x61a907,null))[_0x0c09('0x36')](handleError(_0x61a907,null));};exports['create']=function(_0x5728f2,_0x3dde4a){return db['ChatProactiveAction']['create'](_0x5728f2[_0x0c09('0x37')],{})[_0x0c09('0x22')](respondWithResult(_0x3dde4a,0xc9))[_0x0c09('0x36')](handleError(_0x3dde4a,null));};exports[_0x0c09('0x38')]=function(_0x39cd87,_0x1b602c){if(_0x39cd87[_0x0c09('0x37')]['id']){delete _0x39cd87['body']['id'];}return db[_0x0c09('0x39')][_0x0c09('0x35')]({'where':{'id':_0x39cd87[_0x0c09('0x29')]['id']}})[_0x0c09('0x22')](handleEntityNotFound(_0x1b602c,null))[_0x0c09('0x22')](saveUpdates(_0x39cd87[_0x0c09('0x37')],null))[_0x0c09('0x22')](respondWithResult(_0x1b602c,null))[_0x0c09('0x36')](handleError(_0x1b602c,null));};exports[_0x0c09('0x23')]=function(_0x56ac67,_0x25be9c){return db[_0x0c09('0x39')][_0x0c09('0x35')]({'where':{'id':_0x56ac67[_0x0c09('0x29')]['id']}})[_0x0c09('0x22')](handleEntityNotFound(_0x25be9c,null))[_0x0c09('0x22')](removeEntity(_0x25be9c,null))[_0x0c09('0x36')](handleError(_0x25be9c,null));}; \ No newline at end of file +var _0xf1e1=['rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','show','params','model','keys','ChatProactiveAction'];(function(_0x252082,_0x29c8c8){var _0x2cafc7=function(_0x16ab45){while(--_0x16ab45){_0x252082['push'](_0x252082['shift']());}};_0x2cafc7(++_0x29c8c8);}(_0xf1e1,0x102));var _0x1f1e=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xf1e1[_0x4ae829];return _0x256b31;};'use strict';var emlformat=require(_0x1f1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f1e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f1e('0x2'));var moment=require('moment');var BPromise=require(_0x1f1e('0x3'));var Mustache=require(_0x1f1e('0x4'));var util=require(_0x1f1e('0x5'));var path=require(_0x1f1e('0x6'));var sox=require(_0x1f1e('0x7'));var csv=require(_0x1f1e('0x8'));var ejs=require(_0x1f1e('0x9'));var fs=require('fs');var fs_extra=require(_0x1f1e('0xa'));var _=require(_0x1f1e('0xb'));var squel=require(_0x1f1e('0xc'));var crypto=require(_0x1f1e('0xd'));var jsforce=require(_0x1f1e('0xe'));var deskjs=require(_0x1f1e('0xf'));var toCsv=require(_0x1f1e('0x8'));var querystring=require('querystring');var Papa=require(_0x1f1e('0x10'));var Redis=require(_0x1f1e('0x11'));var authService=require(_0x1f1e('0x12'));var qs=require(_0x1f1e('0x13'));var as=require(_0x1f1e('0x14'));var hardwareService=require(_0x1f1e('0x15'));var logger=require(_0x1f1e('0x16'))(_0x1f1e('0x17'));var utils=require(_0x1f1e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1f1e('0x19'));var db=require(_0x1f1e('0x1a'))['db'];function respondWithStatusCode(_0x1cfe77,_0x3f5ade){_0x3f5ade=_0x3f5ade||0xcc;return function(_0x11a6c8){if(_0x11a6c8){return _0x1cfe77[_0x1f1e('0x1b')](_0x3f5ade);}return _0x1cfe77[_0x1f1e('0x1c')](_0x3f5ade)['end']();};}function respondWithResult(_0x3ff746,_0x4609c4){_0x4609c4=_0x4609c4||0xc8;return function(_0x53c5e1){if(_0x53c5e1){return _0x3ff746[_0x1f1e('0x1c')](_0x4609c4)[_0x1f1e('0x1d')](_0x53c5e1);}};}function respondWithFilteredResult(_0x5b075c,_0x1553d){return function(_0x21da96){if(_0x21da96){var _0xe4cef0=typeof _0x1553d[_0x1f1e('0x1e')]===_0x1f1e('0x1f')&&typeof _0x1553d[_0x1f1e('0x20')]===_0x1f1e('0x1f');var _0x2e9227=_0x21da96[_0x1f1e('0x21')];var _0x4d0882=_0xe4cef0?0x0:_0x1553d[_0x1f1e('0x1e')];var _0x14f812=_0xe4cef0?_0x21da96['count']:_0x1553d[_0x1f1e('0x1e')]+_0x1553d[_0x1f1e('0x20')];var _0xb1f54f;if(_0x14f812>=_0x2e9227){_0x14f812=_0x2e9227;_0xb1f54f=0xc8;}else{_0xb1f54f=0xce;}_0x5b075c['status'](_0xb1f54f);return _0x5b075c['set']('Content-Range',_0x4d0882+'-'+_0x14f812+'/'+_0x2e9227)[_0x1f1e('0x1d')](_0x21da96);}return null;};}function patchUpdates(_0x226f45){return function(_0xed547a){try{jsonpatch[_0x1f1e('0x22')](_0xed547a,_0x226f45,!![]);}catch(_0x300f60){return BPromise[_0x1f1e('0x23')](_0x300f60);}return _0xed547a[_0x1f1e('0x24')]();};}function saveUpdates(_0x262f91,_0x5c777e){return function(_0x497c57){if(_0x497c57){return _0x497c57['update'](_0x262f91)[_0x1f1e('0x25')](function(_0x4156bf){return _0x4156bf;});}return null;};}function removeEntity(_0x2830d0,_0x4268ed){return function(_0x5b9a47){if(_0x5b9a47){return _0x5b9a47[_0x1f1e('0x26')]()[_0x1f1e('0x25')](function(){_0x2830d0[_0x1f1e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2394,_0x1dfe89){return function(_0x44fef9){if(!_0x44fef9){_0x5b2394[_0x1f1e('0x1b')](0x194);}return _0x44fef9;};}function handleError(_0x5102e2,_0x2e76e5){_0x2e76e5=_0x2e76e5||0x1f4;return function(_0x31f48b){logger['error'](_0x31f48b[_0x1f1e('0x27')]);if(_0x31f48b['name']){delete _0x31f48b[_0x1f1e('0x28')];}_0x5102e2[_0x1f1e('0x1c')](_0x2e76e5)[_0x1f1e('0x29')](_0x31f48b);};}exports[_0x1f1e('0x2a')]=function(_0xa2076c,_0x420e4b){var _0x52e414={'raw':!![],'where':{'id':_0xa2076c[_0x1f1e('0x2b')]['id']}},_0x2b24a6={};_0x2b24a6[_0x1f1e('0x2c')]=_[_0x1f1e('0x2d')](db[_0x1f1e('0x2e')][_0x1f1e('0x2f')]);_0x2b24a6[_0x1f1e('0x30')]=_['keys'](_0xa2076c[_0x1f1e('0x30')]);_0x2b24a6[_0x1f1e('0x31')]=_[_0x1f1e('0x32')](_0x2b24a6[_0x1f1e('0x2c')],_0x2b24a6[_0x1f1e('0x30')]);_0x52e414[_0x1f1e('0x33')]=_[_0x1f1e('0x32')](_0x2b24a6[_0x1f1e('0x2c')],qs['fields'](_0xa2076c['query'][_0x1f1e('0x34')]));_0x52e414['attributes']=_0x52e414['attributes'][_0x1f1e('0x35')]?_0x52e414[_0x1f1e('0x33')]:_0x2b24a6[_0x1f1e('0x2c')];if(_0xa2076c[_0x1f1e('0x30')][_0x1f1e('0x36')]){_0x52e414[_0x1f1e('0x37')]=[{'all':!![]}];}_0x52e414=_['merge']({},_0x52e414,_0xa2076c[_0x1f1e('0x38')]);return db[_0x1f1e('0x2e')][_0x1f1e('0x39')](_0x52e414)['then'](handleEntityNotFound(_0x420e4b,null))[_0x1f1e('0x25')](respondWithResult(_0x420e4b,null))[_0x1f1e('0x3a')](handleError(_0x420e4b,null));};exports['create']=function(_0x5cdf2c,_0x4f8f96){return db['ChatProactiveAction'][_0x1f1e('0x3b')](_0x5cdf2c['body'],{})[_0x1f1e('0x25')](respondWithResult(_0x4f8f96,0xc9))[_0x1f1e('0x3a')](handleError(_0x4f8f96,null));};exports['update']=function(_0x2c4d2e,_0x538458){if(_0x2c4d2e[_0x1f1e('0x3c')]['id']){delete _0x2c4d2e['body']['id'];}return db[_0x1f1e('0x2e')][_0x1f1e('0x39')]({'where':{'id':_0x2c4d2e[_0x1f1e('0x2b')]['id']}})[_0x1f1e('0x25')](handleEntityNotFound(_0x538458,null))[_0x1f1e('0x25')](saveUpdates(_0x2c4d2e[_0x1f1e('0x3c')],null))[_0x1f1e('0x25')](respondWithResult(_0x538458,null))['catch'](handleError(_0x538458,null));};exports[_0x1f1e('0x26')]=function(_0x505594,_0x3ac415){return db['ChatProactiveAction']['find']({'where':{'id':_0x505594[_0x1f1e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3ac415,null))[_0x1f1e('0x25')](removeEntity(_0x3ac415,null))[_0x1f1e('0x3a')](handleError(_0x3ac415,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2d0e571..c778b0c 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 _0x349b=['./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ea2b4,_0x2235e2){var _0x3cab45=function(_0x4ce8cc){while(--_0x4ce8cc){_0x1ea2b4['push'](_0x1ea2b4['shift']());}};_0x3cab45(++_0x2235e2);}(_0x349b,0x16b));var _0xb349=function(_0x30d9be,_0x4259e5){_0x30d9be=_0x30d9be-0x0;var _0xce6de5=_0x349b[_0x30d9be];return _0xce6de5;};'use strict';var _=require(_0xb349('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb349('0x1'));var moment=require(_0xb349('0x2'));var BPromise=require(_0xb349('0x3'));var rp=require(_0xb349('0x4'));var fs=require('fs');var path=require(_0xb349('0x5'));var rimraf=require(_0xb349('0x6'));var config=require('../../config/environment');var attributes=require(_0xb349('0x7'));module[_0xb349('0x8')]=function(_0x3ac5c5,_0x199be8){return _0x3ac5c5['define'](_0xb349('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6c7=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util','../../config/logger','request-promise','rimraf','../../config/environment'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0xb6c7,0xca));var _0x7b6c=function(_0x26f1d7,_0xedefdc){_0x26f1d7=_0x26f1d7-0x0;var _0x169888=_0xb6c7[_0x26f1d7];return _0x169888;};'use strict';var _=require('lodash');var util=require(_0x7b6c('0x0'));var logger=require(_0x7b6c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7b6c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b6c('0x3'));var config=require(_0x7b6c('0x4'));var attributes=require(_0x7b6c('0x5'));module[_0x7b6c('0x6')]=function(_0x43e1dd,_0x1bcdeb){return _0x43e1dd[_0x7b6c('0x7')](_0x7b6c('0x8'),attributes,{'tableName':'chat_proactive_actions','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 4fe9ee4..c332573 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 _0xb8b2=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment'];(function(_0x297f87,_0x529eec){var _0x1f33a1=function(_0x431bf1){while(--_0x431bf1){_0x297f87['push'](_0x297f87['shift']());}};_0x1f33a1(++_0x529eec);}(_0xb8b2,0x11a));var _0x2b8b=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xb8b2[_0x43776a];return _0x18eb8f;};'use strict';var _=require(_0x2b8b('0x0'));var util=require(_0x2b8b('0x1'));var moment=require(_0x2b8b('0x2'));var BPromise=require(_0x2b8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b8b('0x4'));var db=require(_0x2b8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b8b('0x6'))(_0x2b8b('0x7'));var config=require(_0x2b8b('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x182dc8,_0x44fd59,_0x4e749d){return new BPromise(function(_0x807766,_0x32bcbe){return client[_0x2b8b('0x9')](_0x182dc8,_0x4e749d)[_0x2b8b('0xa')](function(_0x2bacd5){logger[_0x2b8b('0xb')](_0x2b8b('0xc'),_0x44fd59,'request\x20sent');logger[_0x2b8b('0xd')](_0x2b8b('0xe'),_0x44fd59,_0x2b8b('0xf'),JSON[_0x2b8b('0x10')](_0x2bacd5));if(_0x2bacd5['error']){if(_0x2bacd5['error']['code']===0x1f4){logger['error'](_0x2b8b('0xc'),_0x44fd59,_0x2bacd5['error']['message']);return _0x32bcbe(_0x2bacd5['error']['message']);}logger[_0x2b8b('0x11')](_0x2b8b('0xc'),_0x44fd59,_0x2bacd5[_0x2b8b('0x11')][_0x2b8b('0x12')]);return _0x807766(_0x2bacd5[_0x2b8b('0x11')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x44fd59,_0x2b8b('0xf'));_0x807766(_0x2bacd5['result']['message']);}})['catch'](function(_0x7cbecc){logger[_0x2b8b('0x11')](_0x2b8b('0xc'),_0x44fd59,_0x7cbecc);_0x32bcbe(_0x7cbecc);});});} \ No newline at end of file +var _0xc440=['debug','request\x20sent','stringify','error','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x300030,_0x529cfb){var _0x25fb3b=function(_0x4558b2){while(--_0x4558b2){_0x300030['push'](_0x300030['shift']());}};_0x25fb3b(++_0x529cfb);}(_0xc440,0x94));var _0x0c44=function(_0x17e667,_0x1e6019){_0x17e667=_0x17e667-0x0;var _0x49c33d=_0xc440[_0x17e667];return _0x49c33d;};'use strict';var _=require(_0x0c44('0x0'));var util=require(_0x0c44('0x1'));var moment=require(_0x0c44('0x2'));var BPromise=require(_0x0c44('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c44('0x4'));var db=require(_0x0c44('0x5'))['db'];var utils=require(_0x0c44('0x6'));var logger=require('../../config/logger')(_0x0c44('0x7'));var config=require('../../config/environment');var jayson=require(_0x0c44('0x8'));var client=jayson[_0x0c44('0x9')][_0x0c44('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x980bbb,_0x6ec0c,_0x2a8c81){return new BPromise(function(_0x3f036c,_0x44f99f){return client[_0x0c44('0xb')](_0x980bbb,_0x2a8c81)['then'](function(_0x3c5306){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x6ec0c,'request\x20sent');logger[_0x0c44('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x6ec0c,_0x0c44('0xd'),JSON[_0x0c44('0xe')](_0x3c5306));if(_0x3c5306['error']){if(_0x3c5306['error']['code']===0x1f4){logger[_0x0c44('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x6ec0c,_0x3c5306['error']['message']);return _0x44f99f(_0x3c5306['error']['message']);}logger[_0x0c44('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x6ec0c,_0x3c5306[_0x0c44('0xf')][_0x0c44('0x10')]);return _0x3f036c(_0x3c5306[_0x0c44('0xf')]['message']);}else{logger['info'](_0x0c44('0x11'),_0x6ec0c,'request\x20sent');_0x3f036c(_0x3c5306[_0x0c44('0x12')][_0x0c44('0x10')]);}})[_0x0c44('0x13')](function(_0x32c9b7){logger[_0x0c44('0xf')](_0x0c44('0x11'),_0x6ec0c,_0x32c9b7);_0x44f99f(_0x32c9b7);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 788c754..da54011 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 _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x038b,0x114));var _0xb038=function(_0x27f865,_0x25b6c5){_0x27f865=_0x27f865-0x0;var _0x121c3c=_0x038b[_0x27f865];return _0x121c3c;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file +var _0x326f=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x46be85,_0x4c7252){var _0x4be35a=function(_0x42f8e5){while(--_0x42f8e5){_0x46be85['push'](_0x46be85['shift']());}};_0x4be35a(++_0x4c7252);}(_0x326f,0xd1));var _0xf326=function(_0x3ebbe3,_0x46493a){_0x3ebbe3=_0x3ebbe3-0x0;var _0x3ba4c0=_0x326f[_0x3ebbe3];return _0x3ba4c0;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')]('/',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xf')]);router[_0xf326('0x10')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 33d4aa2..307104c 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 _0xa9d3=['INTEGER','beepall','roundrobin','exports','STRING'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa9d3,0x9e));var _0x3a9d=function(_0x154148,_0x429c05){_0x154148=_0x154148-0x0;var _0x44f5a2=_0xa9d3[_0x154148];return _0x44f5a2;};'use strict';var Sequelize=require('sequelize');module[_0x3a9d('0x0')]={'name':{'type':Sequelize[_0x3a9d('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3a9d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x3a9d('0x3'),_0x3a9d('0x4'))}}; \ No newline at end of file +var _0x738b=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x738b,0x123));var _0xb738=function(_0x34a923,_0x3ce38d){_0x34a923=_0x34a923-0x0;var _0x46442b=_0x738b[_0x34a923];return _0x46442b;};'use strict';var Sequelize=require(_0xb738('0x0'));module[_0xb738('0x1')]={'name':{'type':Sequelize[_0xb738('0x2')],'unique':_0xb738('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb738('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb738('0x4')](_0xb738('0x5'),_0xb738('0x6'),_0xb738('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index de584aa..d58ea34 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 _0xcdc4=['field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','getAgents','pick','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','ChatQueues','sendStatus','stack','name','index','map','ChatQueue','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserChatQueue','length','ChatQueueId','findAndCountAll','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','User','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','userChatQueue:save','removeTeams','ids'];(function(_0x4f203d,_0x485658){var _0x512282=function(_0x409d79){while(--_0x409d79){_0x4f203d['push'](_0x4f203d['shift']());}};_0x512282(++_0x485658);}(_0xcdc4,0x151));var _0x4cdc=function(_0x18313b,_0x5c914f){_0x18313b=_0x18313b-0x0;var _0x2ba97d=_0xcdc4[_0x18313b];return _0x2ba97d;};'use strict';var emlformat=require(_0x4cdc('0x0'));var rimraf=require(_0x4cdc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4cdc('0x2'));var moment=require(_0x4cdc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4cdc('0x4'));var util=require(_0x4cdc('0x5'));var path=require(_0x4cdc('0x6'));var sox=require(_0x4cdc('0x7'));var csv=require(_0x4cdc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4cdc('0x9'));var squel=require(_0x4cdc('0xa'));var crypto=require('crypto');var jsforce=require(_0x4cdc('0xb'));var deskjs=require(_0x4cdc('0xc'));var toCsv=require(_0x4cdc('0x8'));var querystring=require('querystring');var Papa=require(_0x4cdc('0xd'));var Redis=require(_0x4cdc('0xe'));var authService=require(_0x4cdc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4cdc('0x10'));var hardwareService=require(_0x4cdc('0x11'));var logger=require(_0x4cdc('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4cdc('0x13'));var licenseUtil=require(_0x4cdc('0x14'));var db=require(_0x4cdc('0x15'))['db'];config['redis']=_['defaults'](config[_0x4cdc('0x16')],{'host':_0x4cdc('0x17'),'port':0x18eb});var socket=require(_0x4cdc('0x18'))(new Redis(config[_0x4cdc('0x16')]));require('./chatQueue.socket')[_0x4cdc('0x19')](socket);var jayson=require(_0x4cdc('0x1a'));var client=jayson['client'][_0x4cdc('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4b2c67,_0xfd77c2,_0x3b4758,_0x1dc43d){return new BPromise(function(_0x5608b0,_0x394bd2){var _0x5a860d=_0x1dc43d||client;return _0x5a860d[_0x4cdc('0x1c')](_0x4b2c67,_0x3b4758)[_0x4cdc('0x1d')](function(_0x4d7ad0){logger[_0x4cdc('0x1e')]('ChatQueue,\x20%s,\x20%s',_0xfd77c2,_0x4cdc('0x1f'));logger[_0x4cdc('0x20')](_0x4cdc('0x21'),_0xfd77c2,_0x4cdc('0x1f'),JSON[_0x4cdc('0x22')](_0x4d7ad0));if(_0x4d7ad0[_0x4cdc('0x23')]){if(_0x4d7ad0['error'][_0x4cdc('0x24')]===0x1f4){logger[_0x4cdc('0x23')](_0x4cdc('0x25'),_0xfd77c2,_0x4d7ad0[_0x4cdc('0x23')][_0x4cdc('0x26')]);return _0x394bd2(_0x4d7ad0[_0x4cdc('0x23')][_0x4cdc('0x26')]);}logger[_0x4cdc('0x23')](_0x4cdc('0x25'),_0xfd77c2,_0x4d7ad0[_0x4cdc('0x23')][_0x4cdc('0x26')]);return _0x5608b0(_0x4d7ad0[_0x4cdc('0x23')][_0x4cdc('0x26')]);}else{logger[_0x4cdc('0x1e')]('ChatQueue,\x20%s,\x20%s',_0xfd77c2,_0x4cdc('0x1f'));_0x5608b0(_0x4d7ad0[_0x4cdc('0x27')]['message']);}})['catch'](function(_0x5dc2a8){logger['error'](_0x4cdc('0x25'),_0xfd77c2,_0x5dc2a8);_0x394bd2(_0x5dc2a8);});});}function respondWithStatusCode(_0x4bcb66,_0x16786e){_0x16786e=_0x16786e||0xcc;return function(_0x1ae64e){if(_0x1ae64e){return _0x4bcb66['sendStatus'](_0x16786e);}return _0x4bcb66[_0x4cdc('0x28')](_0x16786e)[_0x4cdc('0x29')]();};}function respondWithResult(_0x4ad6ed,_0x40fa07){_0x40fa07=_0x40fa07||0xc8;return function(_0x47c280){if(_0x47c280){return _0x4ad6ed['status'](_0x40fa07)[_0x4cdc('0x2a')](_0x47c280);}};}function respondWithFilteredResult(_0x215a1e,_0x385985){return function(_0x49670f){if(_0x49670f){var _0x5177b5=typeof _0x385985[_0x4cdc('0x2b')]===_0x4cdc('0x2c')&&typeof _0x385985['limit']===_0x4cdc('0x2c');var _0x2073c8=_0x49670f[_0x4cdc('0x2d')];var _0x484ee5=_0x5177b5?0x0:_0x385985[_0x4cdc('0x2b')];var _0x435034=_0x5177b5?_0x49670f['count']:_0x385985[_0x4cdc('0x2b')]+_0x385985[_0x4cdc('0x2e')];var _0x577273;if(_0x435034>=_0x2073c8){_0x435034=_0x2073c8;_0x577273=0xc8;}else{_0x577273=0xce;}_0x215a1e[_0x4cdc('0x28')](_0x577273);return _0x215a1e[_0x4cdc('0x2f')](_0x4cdc('0x30'),_0x484ee5+'-'+_0x435034+'/'+_0x2073c8)[_0x4cdc('0x2a')](_0x49670f);}return null;};}function patchUpdates(_0x8e9be9){return function(_0xdf4356){try{jsonpatch[_0x4cdc('0x31')](_0xdf4356,_0x8e9be9,!![]);}catch(_0x385f12){return BPromise[_0x4cdc('0x32')](_0x385f12);}return _0xdf4356[_0x4cdc('0x33')]();};}function saveUpdates(_0xca1641,_0x2c17dd){return function(_0x34ce13){if(_0x34ce13){return _0x34ce13[_0x4cdc('0x34')](_0xca1641)[_0x4cdc('0x1d')](function(_0x496647){return _0x496647;});}return null;};}function removeEntity(_0x1ce63d,_0x55f0e9){return function(_0x16d841){if(_0x16d841){return _0x16d841[_0x4cdc('0x35')]()[_0x4cdc('0x1d')](function(){var _0x760d7f=_0x16d841['get']({'plain':!![]});var _0x3b6017=_0x4cdc('0x36');return db['UserProfileResource'][_0x4cdc('0x35')]({'where':{'type':_0x3b6017,'resourceId':_0x760d7f['id']}})[_0x4cdc('0x1d')](function(){return _0x16d841;});})[_0x4cdc('0x1d')](function(){_0x1ce63d[_0x4cdc('0x28')](0xcc)[_0x4cdc('0x29')]();});}};}function handleEntityNotFound(_0x3c08e5,_0x4b3bd7){return function(_0x15c506){if(!_0x15c506){_0x3c08e5[_0x4cdc('0x37')](0x194);}return _0x15c506;};}function handleError(_0x59d2b7,_0x4f3acb){_0x4f3acb=_0x4f3acb||0x1f4;return function(_0x3f9512){logger[_0x4cdc('0x23')](_0x3f9512[_0x4cdc('0x38')]);if(_0x3f9512['name']){delete _0x3f9512[_0x4cdc('0x39')];}_0x59d2b7['status'](_0x4f3acb)['send'](_0x3f9512);};}exports[_0x4cdc('0x3a')]=function(_0x27377d,_0x19eb6a){var _0x177099={},_0x344265={},_0x4213d3={'count':0x0,'rows':[]};var _0x214677=_[_0x4cdc('0x3b')](db[_0x4cdc('0x3c')]['rawAttributes'],function(_0x1c9f2b){return{'name':_0x1c9f2b['fieldName'],'type':_0x1c9f2b[_0x4cdc('0x3d')][_0x4cdc('0x3e')]};});_0x344265[_0x4cdc('0x3f')]=_['map'](_0x214677,'name');_0x344265[_0x4cdc('0x40')]=_['keys'](_0x27377d[_0x4cdc('0x40')]);_0x344265[_0x4cdc('0x41')]=_[_0x4cdc('0x42')](_0x344265[_0x4cdc('0x3f')],_0x344265[_0x4cdc('0x40')]);_0x177099[_0x4cdc('0x43')]=_[_0x4cdc('0x42')](_0x344265[_0x4cdc('0x3f')],qs[_0x4cdc('0x44')](_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x44')]));_0x177099[_0x4cdc('0x43')]=_0x177099[_0x4cdc('0x43')]['length']?_0x177099['attributes']:_0x344265[_0x4cdc('0x3f')];if(!_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x45')](_0x4cdc('0x46'))){_0x177099[_0x4cdc('0x2e')]=qs[_0x4cdc('0x2e')](_0x27377d[_0x4cdc('0x40')]['limit']);_0x177099['offset']=qs[_0x4cdc('0x2b')](_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x2b')]);}_0x177099[_0x4cdc('0x47')]=qs[_0x4cdc('0x48')](_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x48')]);_0x177099[_0x4cdc('0x49')]=qs[_0x4cdc('0x41')](_['pick'](_0x27377d[_0x4cdc('0x40')],_0x344265[_0x4cdc('0x41')]),_0x214677);if(_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x4a')]){_0x177099['where']=_[_0x4cdc('0x4b')](_0x177099['where'],{'$or':_[_0x4cdc('0x3b')](_0x214677,function(_0x3106a4){if(_0x3106a4[_0x4cdc('0x3d')]!==_0x4cdc('0x4c')){var _0x4caaf3={};_0x4caaf3[_0x3106a4[_0x4cdc('0x39')]]={'$like':'%'+_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x4a')]+'%'};return _0x4caaf3;}})});}_0x177099=_[_0x4cdc('0x4b')]({},_0x177099,_0x27377d[_0x4cdc('0x4d')]);var _0x5de949={'where':_0x177099[_0x4cdc('0x49')]};return db[_0x4cdc('0x3c')][_0x4cdc('0x2d')](_0x5de949)[_0x4cdc('0x1d')](function(_0x24e44c){_0x4213d3[_0x4cdc('0x2d')]=_0x24e44c;if(_0x27377d['query']['includeAll']){_0x177099[_0x4cdc('0x4e')]=[{'all':!![]}];}return db[_0x4cdc('0x3c')][_0x4cdc('0x4f')](_0x177099);})[_0x4cdc('0x1d')](function(_0x2b0ff5){_0x4213d3[_0x4cdc('0x50')]=_0x2b0ff5;return _0x4213d3;})[_0x4cdc('0x1d')](respondWithFilteredResult(_0x19eb6a,_0x177099))[_0x4cdc('0x51')](handleError(_0x19eb6a,null));};exports[_0x4cdc('0x52')]=function(_0x1e3b3f,_0x3762dc){var _0x48689f={'raw':!![],'where':{'id':_0x1e3b3f[_0x4cdc('0x53')]['id']}},_0x51ab6d={};_0x51ab6d['model']=_[_0x4cdc('0x54')](db[_0x4cdc('0x3c')][_0x4cdc('0x55')]);_0x51ab6d[_0x4cdc('0x40')]=_[_0x4cdc('0x54')](_0x1e3b3f[_0x4cdc('0x40')]);_0x51ab6d[_0x4cdc('0x41')]=_[_0x4cdc('0x42')](_0x51ab6d['model'],_0x51ab6d[_0x4cdc('0x40')]);_0x48689f[_0x4cdc('0x43')]=_[_0x4cdc('0x42')](_0x51ab6d[_0x4cdc('0x3f')],qs[_0x4cdc('0x44')](_0x1e3b3f[_0x4cdc('0x40')]['fields']));_0x48689f[_0x4cdc('0x43')]=_0x48689f['attributes']['length']?_0x48689f['attributes']:_0x51ab6d[_0x4cdc('0x3f')];if(_0x1e3b3f[_0x4cdc('0x40')][_0x4cdc('0x56')]){_0x48689f['include']=[{'all':!![]}];}_0x48689f=_[_0x4cdc('0x4b')]({},_0x48689f,_0x1e3b3f[_0x4cdc('0x4d')]);return db[_0x4cdc('0x3c')]['find'](_0x48689f)[_0x4cdc('0x1d')](handleEntityNotFound(_0x3762dc,null))[_0x4cdc('0x1d')](respondWithResult(_0x3762dc,null))[_0x4cdc('0x51')](handleError(_0x3762dc,null));};exports['create']=function(_0x1becf0,_0x5e3cab){return db[_0x4cdc('0x3c')][_0x4cdc('0x57')](_0x1becf0['body'],{})[_0x4cdc('0x1d')](function(_0x1db7f7){var _0x3f78d2=_0x1becf0[_0x4cdc('0x58')][_0x4cdc('0x59')]({'plain':!![]});if(!_0x3f78d2)throw new Error(_0x4cdc('0x5a'));if(_0x3f78d2[_0x4cdc('0x5b')]===_0x4cdc('0x58')){var _0x2c15e1=_0x1db7f7[_0x4cdc('0x59')]({'plain':!![]});var _0x3ad6bd=_0x4cdc('0x36');return db[_0x4cdc('0x5c')][_0x4cdc('0x5d')]({'where':{'name':_0x3ad6bd,'userProfileId':_0x3f78d2[_0x4cdc('0x5e')]},'raw':!![]})[_0x4cdc('0x1d')](function(_0x26587a){if(_0x26587a&&_0x26587a[_0x4cdc('0x5f')]===0x0){return db[_0x4cdc('0x60')][_0x4cdc('0x57')]({'name':_0x2c15e1[_0x4cdc('0x39')],'resourceId':_0x2c15e1['id'],'type':_0x26587a['name'],'sectionId':_0x26587a['id']},{})[_0x4cdc('0x1d')](function(){return _0x1db7f7;});}else{return _0x1db7f7;}})[_0x4cdc('0x51')](function(_0x4419ad){logger[_0x4cdc('0x23')](_0x4cdc('0x61'),_0x4419ad);throw _0x4419ad;});}return _0x1db7f7;})[_0x4cdc('0x1d')](respondWithResult(_0x5e3cab,0xc9))[_0x4cdc('0x51')](handleError(_0x5e3cab,null));};exports[_0x4cdc('0x34')]=function(_0x4eff1a,_0x230e9e){if(_0x4eff1a[_0x4cdc('0x62')]['id']){delete _0x4eff1a[_0x4cdc('0x62')]['id'];}return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x4eff1a['params']['id']}})[_0x4cdc('0x1d')](handleEntityNotFound(_0x230e9e,null))[_0x4cdc('0x1d')](saveUpdates(_0x4eff1a[_0x4cdc('0x62')],null))[_0x4cdc('0x1d')](respondWithResult(_0x230e9e,null))[_0x4cdc('0x51')](handleError(_0x230e9e,null));};exports[_0x4cdc('0x35')]=function(_0x38656b,_0x374252){return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x38656b[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0x374252,null))[_0x4cdc('0x1d')](removeEntity(_0x374252,null))[_0x4cdc('0x51')](handleError(_0x374252,null));};exports[_0x4cdc('0x63')]=function(_0x21c811,_0x35ff5b){return db[_0x4cdc('0x3c')][_0x4cdc('0x63')]()[_0x4cdc('0x1d')](respondWithResult(_0x35ff5b,null))[_0x4cdc('0x51')](handleError(_0x35ff5b,null));};exports[_0x4cdc('0x64')]=function(_0x3b7bea,_0xef68cf,_0x270439){var _0x306363={'raw':!![],'where':{}},_0x3d445a={},_0x39b5b3;return db['ChatQueue']['findOne']({'where':{'id':_0x3b7bea[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0xef68cf,null))[_0x4cdc('0x1d')](function(_0x941e80){if(_0x941e80){_0x39b5b3=_0x941e80[_0x4cdc('0x59')]({'plain':!![]});_0x3d445a['model']=_[_0x4cdc('0x54')](db[_0x4cdc('0x65')][_0x4cdc('0x55')]);_0x3d445a[_0x4cdc('0x40')]=_[_0x4cdc('0x54')](_0x3b7bea[_0x4cdc('0x40')]);_0x3d445a[_0x4cdc('0x41')]=_['intersection'](_0x3d445a[_0x4cdc('0x3f')],_0x3d445a['query']);_0x306363[_0x4cdc('0x43')]=_['intersection'](_0x3d445a[_0x4cdc('0x3f')],qs[_0x4cdc('0x44')](_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x44')]));_0x306363['attributes']=_0x306363[_0x4cdc('0x43')][_0x4cdc('0x66')]?_0x306363[_0x4cdc('0x43')]:_0x3d445a['model'];if(!_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x45')](_0x4cdc('0x46'))){_0x306363[_0x4cdc('0x2e')]=qs[_0x4cdc('0x2e')](_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x2e')]);_0x306363[_0x4cdc('0x2b')]=qs[_0x4cdc('0x2b')](_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x2b')]);}_0x306363[_0x4cdc('0x47')]=qs['sort'](_0x3b7bea['query'][_0x4cdc('0x48')]);_0x306363[_0x4cdc('0x49')]=qs['filters'](_['pick'](_0x3b7bea['query'],_0x3d445a[_0x4cdc('0x41')]));_0x306363[_0x4cdc('0x49')][_0x4cdc('0x67')]=_0x941e80['id'];if(_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x4a')]){_0x306363[_0x4cdc('0x49')]=_[_0x4cdc('0x4b')](_0x306363['where'],{'$or':_[_0x4cdc('0x3b')](_0x306363['attributes'],function(_0x6fd36e){var _0x1bad9c={};_0x1bad9c[_0x6fd36e]={'$like':'%'+_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x4a')]+'%'};return _0x1bad9c;})});}_0x306363=_[_0x4cdc('0x4b')]({},_0x306363,_0x3b7bea[_0x4cdc('0x4d')]);return db[_0x4cdc('0x65')][_0x4cdc('0x4f')](_0x306363);}})[_0x4cdc('0x1d')](function(_0xbd2a04){if(_0xbd2a04){return db['User'][_0x4cdc('0x68')]({'where':{'id':_[_0x4cdc('0x3b')](_0xbd2a04,'UserId'),'role':'agent'},'attributes':['id','name','chatPause',_0x4cdc('0x69'),_0x4cdc('0x6a')]});}})[_0x4cdc('0x1d')](function(_0x2e8563){if(_0x2e8563){return{'count':_0x2e8563[_0x4cdc('0x2d')],'rows':_[_0x4cdc('0x3b')](_0x2e8563[_0x4cdc('0x50')],function(_0x7eb24e){return{'membername':_0x7eb24e[_0x4cdc('0x39')],'UserId':_0x7eb24e['id'],'queue_name':_0x39b5b3['name'],'ChatQueueId':_0x39b5b3['id'],'interface':util[_0x4cdc('0x6b')](_0x4cdc('0x6c'),_0x4cdc('0x6d'),_0x7eb24e[_0x4cdc('0x39')]),'penalty':0x0,'paused':_0x7eb24e['chatPause'],'createdAt':_0x7eb24e[_0x4cdc('0x6a')],'updatedAt':_0x7eb24e[_0x4cdc('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4cdc('0x1d')](respondWithFilteredResult(_0xef68cf,_0x306363))[_0x4cdc('0x51')](handleError(_0xef68cf,null));};exports[_0x4cdc('0x6e')]=function(_0x4dba35,_0x34e948,_0x4fb29b){var _0x1a3f7a={};var _0x49c459={};var _0x5cf3ae;var _0x3cf1d9;return db[_0x4cdc('0x3c')][_0x4cdc('0x6f')]({'where':{'id':_0x4dba35[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0x34e948,null))[_0x4cdc('0x1d')](function(_0x1ba230){if(_0x1ba230){_0x5cf3ae=_0x1ba230;_0x49c459['model']=_[_0x4cdc('0x54')](db[_0x4cdc('0x70')][_0x4cdc('0x55')]);_0x49c459[_0x4cdc('0x40')]=_[_0x4cdc('0x54')](_0x4dba35[_0x4cdc('0x40')]);_0x49c459['filters']=_[_0x4cdc('0x42')](_0x49c459['model'],_0x49c459[_0x4cdc('0x40')]);_0x1a3f7a[_0x4cdc('0x43')]=_[_0x4cdc('0x42')](_0x49c459[_0x4cdc('0x3f')],qs['fields'](_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x44')]));_0x1a3f7a[_0x4cdc('0x43')]=_0x1a3f7a['attributes'][_0x4cdc('0x66')]?_0x1a3f7a['attributes']:_0x49c459['model'];_0x1a3f7a[_0x4cdc('0x47')]=qs[_0x4cdc('0x48')](_0x4dba35['query'][_0x4cdc('0x48')]);_0x1a3f7a[_0x4cdc('0x49')]=qs['filters'](_['pick'](_0x4dba35[_0x4cdc('0x40')],_0x49c459[_0x4cdc('0x41')]));if(_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x4a')]){_0x1a3f7a['where']=_[_0x4cdc('0x4b')](_0x1a3f7a['where'],{'$or':_[_0x4cdc('0x3b')](_0x1a3f7a[_0x4cdc('0x43')],function(_0x47c584){var _0x3faa95={};_0x3faa95[_0x47c584]={'$like':'%'+_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x4a')]+'%'};return _0x3faa95;})});}_0x1a3f7a=_[_0x4cdc('0x4b')]({},_0x1a3f7a,_0x4dba35['options']);return _0x5cf3ae['getTeams'](_0x1a3f7a);}})[_0x4cdc('0x1d')](function(_0x3e87c4){if(_0x3e87c4){_0x3cf1d9=_0x3e87c4[_0x4cdc('0x66')];if(!_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x45')]('nolimit')){_0x1a3f7a[_0x4cdc('0x2e')]=qs[_0x4cdc('0x2e')](_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x2e')]);_0x1a3f7a[_0x4cdc('0x2b')]=qs[_0x4cdc('0x2b')](_0x4dba35[_0x4cdc('0x40')]['offset']);}return _0x5cf3ae[_0x4cdc('0x6e')](_0x1a3f7a);}})[_0x4cdc('0x1d')](function(_0x1e155b){if(_0x1e155b){return _0x1e155b?{'count':_0x3cf1d9,'rows':_0x1e155b}:null;}})[_0x4cdc('0x1d')](respondWithResult(_0x34e948,null))[_0x4cdc('0x51')](handleError(_0x34e948,null));};exports['addTeams']=function(_0x564108,_0x118d42,_0xf5edb9){var _0x5dd120=_0x564108[_0x4cdc('0x62')]['ids'];return db[_0x4cdc('0x70')][_0x4cdc('0x4f')]({'where':{'id':_0x5dd120},'attributes':['id'],'include':[{'model':db[_0x4cdc('0x71')],'as':'Agents','attributes':['id',_0x4cdc('0x39'),_0x4cdc('0x72'),_0x4cdc('0x73'),_0x4cdc('0x74')],'raw':!![]}]})[_0x4cdc('0x1d')](function(_0x5d7582){if(_0x5d7582){var _0x68e70c=_[_0x4cdc('0x75')](_0x5d7582,function(_0x20bfc7){var _0x4e63cb=_0x20bfc7['get']({'plain':!![]});return _0x4e63cb['Agents'];});return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x564108[_0x4cdc('0x53')]['id']}})[_0x4cdc('0x1d')](function(_0x29efab){return db[_0x4cdc('0x76')][_0x4cdc('0x77')](function(_0x2bd381){return _0x29efab[_0x4cdc('0x78')](_0x5dd120,{'transaction':_0x2bd381})[_0x4cdc('0x1d')](function(){return BPromise['each'](_0x68e70c,function(_0x35a3d7){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x35a3d7['id'],'ChatQueueId':_0x564108[_0x4cdc('0x53')]['id']},'transaction':_0x2bd381});});})[_0x4cdc('0x1d')](function(){_0x68e70c[_0x4cdc('0x79')](function(_0x1b1095){socket['emit'](_0x4cdc('0x7a'),{'UserId':_0x1b1095['id'],'ChatQueueId':_0x29efab['id']});});});});});}})[_0x4cdc('0x1d')](respondWithStatusCode(_0x118d42,null))[_0x4cdc('0x51')](handleError(_0x118d42,null));};exports[_0x4cdc('0x7b')]=function(_0x2ef483,_0x1aee2d,_0x35585d){return db['Team'][_0x4cdc('0x4f')]({'where':{'id':_0x2ef483[_0x4cdc('0x40')][_0x4cdc('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x4cdc('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4cdc('0x1d')](handleEntityNotFound(_0x1aee2d,null))[_0x4cdc('0x1d')](function(_0x30eb22){var _0x3634c2=_['map'](_0x30eb22,'id');var _0x16a417=[];var _0x5ce506=[];var _0x51c9c2=squel['select']();_0x51c9c2[_0x4cdc('0x7d')](_0x4cdc('0x7e'))[_0x4cdc('0x7f')](_0x4cdc('0x80'),'tq')[_0x4cdc('0x81')](_0x4cdc('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x4cdc('0x83'),_0x2ef483[_0x4cdc('0x53')]['id']);for(var _0x238e17=0x0;_0x238e17<_0x30eb22['length'];_0x238e17+=0x1){let _0x140d52=_0x30eb22[_0x238e17];for(var _0x439c3a=0x0;_0x439c3a<_0x140d52[_0x4cdc('0x84')]['length'];_0x439c3a+=0x1){let _0x2f8c87=_0x140d52[_0x4cdc('0x84')][_0x439c3a];var _0x4bb33f=_0x51c9c2[_0x4cdc('0x85')]();_0x4bb33f['where'](_0x4cdc('0x86'),_0x2f8c87['id']);_0x5ce506[_0x4cdc('0x87')](db[_0x4cdc('0x76')]['query'](_0x4bb33f[_0x4cdc('0x88')](),{'type':db[_0x4cdc('0x76')][_0x4cdc('0x89')][_0x4cdc('0x8a')]})['then'](function(_0x25ed56){if(_0x25ed56[_0x4cdc('0x66')]===0x1){return _0x2f8c87['id'];}else{var _0x344a0e=_['every'](_[_0x4cdc('0x3b')](_0x25ed56,_0x4cdc('0x8b')),function(_0x1e17b3){return _[_0x4cdc('0x8c')](_0x3634c2,_0x1e17b3);});if(_0x344a0e){return _0x2f8c87['id'];}}}));}}return BPromise[_0x4cdc('0x8d')](_0x5ce506)['then'](function(_0x2b1a35){_0x16a417=_(_0x16a417)[_0x4cdc('0x8e')](_0x2b1a35)[_0x4cdc('0x8f')]()[_0x4cdc('0x90')]();return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x2ef483['params']['id']}})[_0x4cdc('0x1d')](function(_0x4e0ffd){return db[_0x4cdc('0x76')]['transaction'](function(_0xd395ea){return _0x4e0ffd[_0x4cdc('0x7b')](_0x2ef483[_0x4cdc('0x40')][_0x4cdc('0x7c')],{'transaction':_0xd395ea})[_0x4cdc('0x1d')](function(){if(!_[_0x4cdc('0x91')](_0x16a417)){return _0x4e0ffd[_0x4cdc('0x92')](_0x16a417,{'transaction':_0xd395ea});}})['then'](function(){_0x16a417['forEach'](function(_0x5ddc93){socket[_0x4cdc('0x93')](_0x4cdc('0x94'),{'UserId':_0x5ddc93,'ChatQueueId':_0x4e0ffd['id']});});});});});});})[_0x4cdc('0x1d')](respondWithStatusCode(_0x1aee2d,null))[_0x4cdc('0x51')](handleError(_0x1aee2d,null));};exports[_0x4cdc('0x95')]=function(_0x647cf1,_0x27e4de,_0x123e17){return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x647cf1[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0x27e4de,null))[_0x4cdc('0x1d')](function(_0x28c06f){if(_0x28c06f){return _0x28c06f[_0x4cdc('0x95')](_0x647cf1[_0x4cdc('0x62')][_0x4cdc('0x7c')],_[_0x4cdc('0x96')](_0x647cf1['body'],[_0x4cdc('0x7c'),'id'])||{})[_0x4cdc('0x97')](function(_0x52e95f){for(var _0x1af842=0x0;_0x1af842<_0x647cf1[_0x4cdc('0x62')][_0x4cdc('0x7c')][_0x4cdc('0x66')];_0x1af842+=0x1){socket['emit'](_0x4cdc('0x7a'),{'UserId':Number(_0x647cf1[_0x4cdc('0x62')][_0x4cdc('0x7c')][_0x1af842]),'ChatQueueId':Number(_0x647cf1[_0x4cdc('0x53')]['id'])});}return _0x52e95f;});}})[_0x4cdc('0x1d')](respondWithResult(_0x27e4de,null))[_0x4cdc('0x51')](handleError(_0x27e4de,null));};exports[_0x4cdc('0x92')]=function(_0x413179,_0x593e1e,_0xfbcce5){return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x413179[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0x593e1e,null))['then'](function(_0x3b5b6f){if(_0x3b5b6f){return _0x3b5b6f[_0x4cdc('0x92')](_0x413179[_0x4cdc('0x40')][_0x4cdc('0x7c')])[_0x4cdc('0x1d')](function(){if(_['isArray'](_0x413179[_0x4cdc('0x40')]['ids'])){for(var _0x2a916f=0x0;_0x2a916f<_0x413179['query']['ids'][_0x4cdc('0x66')];_0x2a916f+=0x1){socket[_0x4cdc('0x93')](_0x4cdc('0x94'),{'UserId':Number(_0x413179[_0x4cdc('0x40')][_0x4cdc('0x7c')][_0x2a916f]),'ChatQueueId':Number(_0x413179['params']['id'])});}}else{socket['emit'](_0x4cdc('0x94'),{'UserId':Number(_0x413179[_0x4cdc('0x40')][_0x4cdc('0x7c')]),'ChatQueueId':Number(_0x413179['params']['id'])});}});}})[_0x4cdc('0x1d')](respondWithStatusCode(_0x593e1e,null))[_0x4cdc('0x51')](handleError(_0x593e1e,null));};exports[_0x4cdc('0x98')]=function(_0x47f0c0,_0x2cae64,_0x363a0b){var _0x160d51={};var _0x394ff4={};var _0x4d4403;var _0x3f431a;return db[_0x4cdc('0x3c')]['findOne']({'where':{'id':_0x47f0c0[_0x4cdc('0x53')]['id']}})[_0x4cdc('0x1d')](handleEntityNotFound(_0x2cae64,null))[_0x4cdc('0x1d')](function(_0x181032){if(_0x181032){_0x4d4403=_0x181032;_0x394ff4[_0x4cdc('0x3f')]=_[_0x4cdc('0x54')](db[_0x4cdc('0x71')][_0x4cdc('0x55')]);_0x394ff4[_0x4cdc('0x40')]=_[_0x4cdc('0x54')](_0x47f0c0[_0x4cdc('0x40')]);_0x394ff4[_0x4cdc('0x41')]=_['intersection'](_0x394ff4['model'],_0x394ff4[_0x4cdc('0x40')]);_0x160d51['attributes']=_[_0x4cdc('0x42')](_0x394ff4[_0x4cdc('0x3f')],qs[_0x4cdc('0x44')](_0x47f0c0[_0x4cdc('0x40')][_0x4cdc('0x44')]));_0x160d51['attributes']=_0x160d51[_0x4cdc('0x43')]['length']?_0x160d51[_0x4cdc('0x43')]:_0x394ff4['model'];_0x160d51[_0x4cdc('0x47')]=qs[_0x4cdc('0x48')](_0x47f0c0['query'][_0x4cdc('0x48')]);_0x160d51[_0x4cdc('0x49')]=qs[_0x4cdc('0x41')](_[_0x4cdc('0x99')](_0x47f0c0[_0x4cdc('0x40')],_0x394ff4[_0x4cdc('0x41')]));if(_0x47f0c0[_0x4cdc('0x40')][_0x4cdc('0x4a')]){_0x160d51[_0x4cdc('0x49')]=_['merge'](_0x160d51['where'],{'$or':_[_0x4cdc('0x3b')](_0x160d51[_0x4cdc('0x43')],function(_0x812d77){var _0x428031={};_0x428031[_0x812d77]={'$like':'%'+_0x47f0c0[_0x4cdc('0x40')]['filter']+'%'};return _0x428031;})});}_0x160d51=_[_0x4cdc('0x4b')]({},_0x160d51,_0x47f0c0['options']);return _0x4d4403['getAgents'](_0x160d51);}})[_0x4cdc('0x1d')](function(_0x166d40){if(_0x166d40){_0x3f431a=_0x166d40['length'];if(!_0x47f0c0['query'][_0x4cdc('0x45')]('nolimit')){_0x160d51['limit']=qs['limit'](_0x47f0c0[_0x4cdc('0x40')][_0x4cdc('0x2e')]);_0x160d51[_0x4cdc('0x2b')]=qs[_0x4cdc('0x2b')](_0x47f0c0[_0x4cdc('0x40')][_0x4cdc('0x2b')]);}return _0x4d4403[_0x4cdc('0x98')](_0x160d51);}})['then'](function(_0x4ae80a){if(_0x4ae80a){return _0x4ae80a?{'count':_0x3f431a,'rows':_0x4ae80a}:null;}})[_0x4cdc('0x1d')](respondWithResult(_0x2cae64,null))[_0x4cdc('0x51')](handleError(_0x2cae64,null));}; \ No newline at end of file +var _0x4713=['result','catch','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','send','index','map','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','ChatQueue','include','findAll','rows','params','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','chatPause','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','isEmpty','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','jayson/promise','client','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x2b81db,_0xe9c3cb){var _0x1e0f1d=function(_0x63f3b2){while(--_0x63f3b2){_0x2b81db['push'](_0x2b81db['shift']());}};_0x1e0f1d(++_0xe9c3cb);}(_0x4713,0x112));var _0x3471=function(_0x287253,_0x380a6f){_0x287253=_0x287253-0x0;var _0x57c547=_0x4713[_0x287253];return _0x57c547;};'use strict';var emlformat=require(_0x3471('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3471('0x1'));var rp=require(_0x3471('0x2'));var moment=require(_0x3471('0x3'));var BPromise=require(_0x3471('0x4'));var Mustache=require(_0x3471('0x5'));var util=require(_0x3471('0x6'));var path=require(_0x3471('0x7'));var sox=require(_0x3471('0x8'));var csv=require(_0x3471('0x9'));var ejs=require(_0x3471('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3471('0xb'));var squel=require(_0x3471('0xc'));var crypto=require(_0x3471('0xd'));var jsforce=require(_0x3471('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3471('0x9'));var querystring=require(_0x3471('0xf'));var Papa=require(_0x3471('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3471('0x11'));var as=require(_0x3471('0x12'));var hardwareService=require(_0x3471('0x13'));var logger=require(_0x3471('0x14'))('api');var utils=require(_0x3471('0x15'));var config=require(_0x3471('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3471('0x17')](config[_0x3471('0x18')],{'host':_0x3471('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x3471('0x1a'));var client=jayson[_0x3471('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3ce8,_0x126ec1,_0x53984e,_0x33e321){return new BPromise(function(_0x16a18c,_0x156a71){var _0x1ad607=_0x33e321||client;return _0x1ad607[_0x3471('0x1c')](_0x1d3ce8,_0x53984e)['then'](function(_0x2f57f4){logger[_0x3471('0x1d')](_0x3471('0x1e'),_0x126ec1,'request\x20sent');logger[_0x3471('0x1f')](_0x3471('0x20'),_0x126ec1,'request\x20sent',JSON[_0x3471('0x21')](_0x2f57f4));if(_0x2f57f4[_0x3471('0x22')]){if(_0x2f57f4[_0x3471('0x22')][_0x3471('0x23')]===0x1f4){logger[_0x3471('0x22')](_0x3471('0x1e'),_0x126ec1,_0x2f57f4[_0x3471('0x22')][_0x3471('0x24')]);return _0x156a71(_0x2f57f4[_0x3471('0x22')]['message']);}logger[_0x3471('0x22')]('ChatQueue,\x20%s,\x20%s',_0x126ec1,_0x2f57f4['error'][_0x3471('0x24')]);return _0x16a18c(_0x2f57f4[_0x3471('0x22')]['message']);}else{logger[_0x3471('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x126ec1,_0x3471('0x25'));_0x16a18c(_0x2f57f4[_0x3471('0x26')][_0x3471('0x24')]);}})[_0x3471('0x27')](function(_0x539f85){logger[_0x3471('0x22')](_0x3471('0x1e'),_0x126ec1,_0x539f85);_0x156a71(_0x539f85);});});}function respondWithStatusCode(_0x181776,_0x3efb6e){_0x3efb6e=_0x3efb6e||0xcc;return function(_0x45ea71){if(_0x45ea71){return _0x181776['sendStatus'](_0x3efb6e);}return _0x181776[_0x3471('0x28')](_0x3efb6e)['end']();};}function respondWithResult(_0x562b51,_0x46fb6a){_0x46fb6a=_0x46fb6a||0xc8;return function(_0x3b8925){if(_0x3b8925){return _0x562b51['status'](_0x46fb6a)['json'](_0x3b8925);}};}function respondWithFilteredResult(_0x323896,_0x14403e){return function(_0x202c5d){if(_0x202c5d){var _0xab31a1=typeof _0x14403e[_0x3471('0x29')]===_0x3471('0x2a')&&typeof _0x14403e[_0x3471('0x2b')]===_0x3471('0x2a');var _0x5560a3=_0x202c5d[_0x3471('0x2c')];var _0xc8ac2=_0xab31a1?0x0:_0x14403e[_0x3471('0x29')];var _0x3ab26f=_0xab31a1?_0x202c5d['count']:_0x14403e[_0x3471('0x29')]+_0x14403e['limit'];var _0x3c1791;if(_0x3ab26f>=_0x5560a3){_0x3ab26f=_0x5560a3;_0x3c1791=0xc8;}else{_0x3c1791=0xce;}_0x323896[_0x3471('0x28')](_0x3c1791);return _0x323896[_0x3471('0x2d')](_0x3471('0x2e'),_0xc8ac2+'-'+_0x3ab26f+'/'+_0x5560a3)['json'](_0x202c5d);}return null;};}function patchUpdates(_0x67bf34){return function(_0x1fb1c8){try{jsonpatch[_0x3471('0x2f')](_0x1fb1c8,_0x67bf34,!![]);}catch(_0x37a3ba){return BPromise[_0x3471('0x30')](_0x37a3ba);}return _0x1fb1c8[_0x3471('0x31')]();};}function saveUpdates(_0x4b5df1,_0x3beb08){return function(_0x55d233){if(_0x55d233){return _0x55d233[_0x3471('0x32')](_0x4b5df1)[_0x3471('0x33')](function(_0x1facea){return _0x1facea;});}return null;};}function removeEntity(_0x2b7d1d,_0x18711e){return function(_0x4a7a5c){if(_0x4a7a5c){return _0x4a7a5c[_0x3471('0x34')]()[_0x3471('0x33')](function(){var _0x15093d=_0x4a7a5c[_0x3471('0x35')]({'plain':!![]});var _0x3e2e94='ChatQueues';return db[_0x3471('0x36')][_0x3471('0x34')]({'where':{'type':_0x3e2e94,'resourceId':_0x15093d['id']}})['then'](function(){return _0x4a7a5c;});})[_0x3471('0x33')](function(){_0x2b7d1d[_0x3471('0x28')](0xcc)[_0x3471('0x37')]();});}};}function handleEntityNotFound(_0x378ad1,_0x223e99){return function(_0x262aab){if(!_0x262aab){_0x378ad1[_0x3471('0x38')](0x194);}return _0x262aab;};}function handleError(_0x1d0d90,_0x2708fc){_0x2708fc=_0x2708fc||0x1f4;return function(_0x25d84b){logger[_0x3471('0x22')](_0x25d84b[_0x3471('0x39')]);if(_0x25d84b['name']){delete _0x25d84b['name'];}_0x1d0d90[_0x3471('0x28')](_0x2708fc)[_0x3471('0x3a')](_0x25d84b);};}exports[_0x3471('0x3b')]=function(_0x35ef90,_0x447ba0){var _0x3e1536={},_0x36be33={},_0x255ad8={'count':0x0,'rows':[]};var _0x1f04c1=_[_0x3471('0x3c')](db['ChatQueue']['rawAttributes'],function(_0x3a655b){return{'name':_0x3a655b[_0x3471('0x3d')],'type':_0x3a655b[_0x3471('0x3e')][_0x3471('0x3f')]};});_0x36be33[_0x3471('0x40')]=_[_0x3471('0x3c')](_0x1f04c1,_0x3471('0x41'));_0x36be33[_0x3471('0x42')]=_[_0x3471('0x43')](_0x35ef90[_0x3471('0x42')]);_0x36be33['filters']=_[_0x3471('0x44')](_0x36be33[_0x3471('0x40')],_0x36be33[_0x3471('0x42')]);_0x3e1536[_0x3471('0x45')]=_[_0x3471('0x44')](_0x36be33[_0x3471('0x40')],qs[_0x3471('0x46')](_0x35ef90['query'][_0x3471('0x46')]));_0x3e1536[_0x3471('0x45')]=_0x3e1536['attributes'][_0x3471('0x47')]?_0x3e1536[_0x3471('0x45')]:_0x36be33[_0x3471('0x40')];if(!_0x35ef90[_0x3471('0x42')][_0x3471('0x48')](_0x3471('0x49'))){_0x3e1536[_0x3471('0x2b')]=qs[_0x3471('0x2b')](_0x35ef90[_0x3471('0x42')][_0x3471('0x2b')]);_0x3e1536[_0x3471('0x29')]=qs['offset'](_0x35ef90[_0x3471('0x42')][_0x3471('0x29')]);}_0x3e1536[_0x3471('0x4a')]=qs[_0x3471('0x4b')](_0x35ef90['query']['sort']);_0x3e1536[_0x3471('0x4c')]=qs[_0x3471('0x4d')](_['pick'](_0x35ef90[_0x3471('0x42')],_0x36be33[_0x3471('0x4d')]),_0x1f04c1);if(_0x35ef90[_0x3471('0x42')]['filter']){_0x3e1536['where']=_[_0x3471('0x4e')](_0x3e1536['where'],{'$or':_['map'](_0x1f04c1,function(_0x105676){if(_0x105676[_0x3471('0x3e')]!==_0x3471('0x4f')){var _0xb9b495={};_0xb9b495[_0x105676[_0x3471('0x41')]]={'$like':'%'+_0x35ef90['query'][_0x3471('0x50')]+'%'};return _0xb9b495;}})});}_0x3e1536=_[_0x3471('0x4e')]({},_0x3e1536,_0x35ef90[_0x3471('0x51')]);var _0x1c6d55={'where':_0x3e1536['where']};return db[_0x3471('0x52')][_0x3471('0x2c')](_0x1c6d55)[_0x3471('0x33')](function(_0xfa1bd8){_0x255ad8[_0x3471('0x2c')]=_0xfa1bd8;if(_0x35ef90[_0x3471('0x42')]['includeAll']){_0x3e1536[_0x3471('0x53')]=[{'all':!![]}];}return db['ChatQueue'][_0x3471('0x54')](_0x3e1536);})[_0x3471('0x33')](function(_0x2e869e){_0x255ad8[_0x3471('0x55')]=_0x2e869e;return _0x255ad8;})[_0x3471('0x33')](respondWithFilteredResult(_0x447ba0,_0x3e1536))[_0x3471('0x27')](handleError(_0x447ba0,null));};exports['show']=function(_0x119ef4,_0x182679){var _0xb9c262={'raw':!![],'where':{'id':_0x119ef4[_0x3471('0x56')]['id']}},_0x29c24e={};_0x29c24e[_0x3471('0x40')]=_[_0x3471('0x43')](db[_0x3471('0x52')][_0x3471('0x57')]);_0x29c24e['query']=_['keys'](_0x119ef4[_0x3471('0x42')]);_0x29c24e[_0x3471('0x4d')]=_[_0x3471('0x44')](_0x29c24e[_0x3471('0x40')],_0x29c24e['query']);_0xb9c262[_0x3471('0x45')]=_['intersection'](_0x29c24e[_0x3471('0x40')],qs[_0x3471('0x46')](_0x119ef4[_0x3471('0x42')][_0x3471('0x46')]));_0xb9c262['attributes']=_0xb9c262[_0x3471('0x45')][_0x3471('0x47')]?_0xb9c262[_0x3471('0x45')]:_0x29c24e[_0x3471('0x40')];if(_0x119ef4[_0x3471('0x42')][_0x3471('0x58')]){_0xb9c262['include']=[{'all':!![]}];}_0xb9c262=_['merge']({},_0xb9c262,_0x119ef4[_0x3471('0x51')]);return db[_0x3471('0x52')][_0x3471('0x59')](_0xb9c262)[_0x3471('0x33')](handleEntityNotFound(_0x182679,null))[_0x3471('0x33')](respondWithResult(_0x182679,null))['catch'](handleError(_0x182679,null));};exports[_0x3471('0x5a')]=function(_0x388054,_0x1d741e){return db[_0x3471('0x52')]['create'](_0x388054[_0x3471('0x5b')],{})['then'](function(_0x1d5067){var _0x1a3cee=_0x388054['user'][_0x3471('0x35')]({'plain':!![]});if(!_0x1a3cee)throw new Error(_0x3471('0x5c'));if(_0x1a3cee[_0x3471('0x5d')]==='user'){var _0x2a91ab=_0x1d5067[_0x3471('0x35')]({'plain':!![]});var _0x2fe5ff=_0x3471('0x5e');return db[_0x3471('0x5f')][_0x3471('0x59')]({'where':{'name':_0x2fe5ff,'userProfileId':_0x1a3cee[_0x3471('0x60')]},'raw':!![]})[_0x3471('0x33')](function(_0x55740c){if(_0x55740c&&_0x55740c[_0x3471('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a91ab[_0x3471('0x41')],'resourceId':_0x2a91ab['id'],'type':_0x55740c['name'],'sectionId':_0x55740c['id']},{})['then'](function(){return _0x1d5067;});}else{return _0x1d5067;}})['catch'](function(_0x1de31a){logger[_0x3471('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1de31a);throw _0x1de31a;});}return _0x1d5067;})[_0x3471('0x33')](respondWithResult(_0x1d741e,0xc9))['catch'](handleError(_0x1d741e,null));};exports['update']=function(_0x13d8fc,_0x1f9959){if(_0x13d8fc[_0x3471('0x5b')]['id']){delete _0x13d8fc[_0x3471('0x5b')]['id'];}return db['ChatQueue'][_0x3471('0x59')]({'where':{'id':_0x13d8fc[_0x3471('0x56')]['id']}})[_0x3471('0x33')](handleEntityNotFound(_0x1f9959,null))[_0x3471('0x33')](saveUpdates(_0x13d8fc[_0x3471('0x5b')],null))[_0x3471('0x33')](respondWithResult(_0x1f9959,null))[_0x3471('0x27')](handleError(_0x1f9959,null));};exports['destroy']=function(_0x28f254,_0x43c890){return db[_0x3471('0x52')][_0x3471('0x59')]({'where':{'id':_0x28f254['params']['id']}})[_0x3471('0x33')](handleEntityNotFound(_0x43c890,null))['then'](removeEntity(_0x43c890,null))[_0x3471('0x27')](handleError(_0x43c890,null));};exports[_0x3471('0x62')]=function(_0x136bf9,_0x227aa3){return db[_0x3471('0x52')][_0x3471('0x62')]()[_0x3471('0x33')](respondWithResult(_0x227aa3,null))['catch'](handleError(_0x227aa3,null));};exports[_0x3471('0x63')]=function(_0x1e095b,_0x43b3b1,_0x4ed307){var _0x246d89={'raw':!![],'where':{}},_0x1b42ad={},_0x534c80;return db[_0x3471('0x52')]['findOne']({'where':{'id':_0x1e095b[_0x3471('0x56')]['id']}})['then'](handleEntityNotFound(_0x43b3b1,null))['then'](function(_0x344ef8){if(_0x344ef8){_0x534c80=_0x344ef8['get']({'plain':!![]});_0x1b42ad[_0x3471('0x40')]=_[_0x3471('0x43')](db[_0x3471('0x64')][_0x3471('0x57')]);_0x1b42ad[_0x3471('0x42')]=_[_0x3471('0x43')](_0x1e095b[_0x3471('0x42')]);_0x1b42ad['filters']=_[_0x3471('0x44')](_0x1b42ad['model'],_0x1b42ad[_0x3471('0x42')]);_0x246d89[_0x3471('0x45')]=_[_0x3471('0x44')](_0x1b42ad[_0x3471('0x40')],qs['fields'](_0x1e095b[_0x3471('0x42')][_0x3471('0x46')]));_0x246d89['attributes']=_0x246d89[_0x3471('0x45')][_0x3471('0x47')]?_0x246d89[_0x3471('0x45')]:_0x1b42ad[_0x3471('0x40')];if(!_0x1e095b['query'][_0x3471('0x48')]('nolimit')){_0x246d89['limit']=qs[_0x3471('0x2b')](_0x1e095b[_0x3471('0x42')][_0x3471('0x2b')]);_0x246d89[_0x3471('0x29')]=qs[_0x3471('0x29')](_0x1e095b['query'][_0x3471('0x29')]);}_0x246d89['order']=qs['sort'](_0x1e095b[_0x3471('0x42')][_0x3471('0x4b')]);_0x246d89[_0x3471('0x4c')]=qs[_0x3471('0x4d')](_[_0x3471('0x65')](_0x1e095b[_0x3471('0x42')],_0x1b42ad[_0x3471('0x4d')]));_0x246d89[_0x3471('0x4c')][_0x3471('0x66')]=_0x344ef8['id'];if(_0x1e095b[_0x3471('0x42')]['filter']){_0x246d89[_0x3471('0x4c')]=_['merge'](_0x246d89[_0x3471('0x4c')],{'$or':_[_0x3471('0x3c')](_0x246d89['attributes'],function(_0x328559){var _0x3fe3ba={};_0x3fe3ba[_0x328559]={'$like':'%'+_0x1e095b[_0x3471('0x42')][_0x3471('0x50')]+'%'};return _0x3fe3ba;})});}_0x246d89=_[_0x3471('0x4e')]({},_0x246d89,_0x1e095b[_0x3471('0x51')]);return db[_0x3471('0x64')][_0x3471('0x54')](_0x246d89);}})[_0x3471('0x33')](function(_0x430e18){if(_0x430e18){return db[_0x3471('0x67')][_0x3471('0x68')]({'where':{'id':_['map'](_0x430e18,_0x3471('0x69')),'role':_0x3471('0x6a')},'attributes':['id',_0x3471('0x41'),'chatPause',_0x3471('0x6b'),_0x3471('0x6c')]});}})[_0x3471('0x33')](function(_0x33b0e3){if(_0x33b0e3){return{'count':_0x33b0e3[_0x3471('0x2c')],'rows':_[_0x3471('0x3c')](_0x33b0e3[_0x3471('0x55')],function(_0x31d0a4){return{'membername':_0x31d0a4[_0x3471('0x41')],'UserId':_0x31d0a4['id'],'queue_name':_0x534c80[_0x3471('0x41')],'ChatQueueId':_0x534c80['id'],'interface':util[_0x3471('0x6d')](_0x3471('0x6e'),'SIP',_0x31d0a4[_0x3471('0x41')]),'penalty':0x0,'paused':_0x31d0a4[_0x3471('0x6f')],'createdAt':_0x31d0a4[_0x3471('0x6c')],'updatedAt':_0x31d0a4[_0x3471('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3471('0x33')](respondWithFilteredResult(_0x43b3b1,_0x246d89))[_0x3471('0x27')](handleError(_0x43b3b1,null));};exports[_0x3471('0x70')]=function(_0x8ebdeb,_0x2a7d72,_0x5160f9){var _0x490218={};var _0x140439={};var _0x2dcd59;var _0x1e82f4;return db[_0x3471('0x52')]['findOne']({'where':{'id':_0x8ebdeb[_0x3471('0x56')]['id']}})[_0x3471('0x33')](handleEntityNotFound(_0x2a7d72,null))[_0x3471('0x33')](function(_0x2b9b1a){if(_0x2b9b1a){_0x2dcd59=_0x2b9b1a;_0x140439[_0x3471('0x40')]=_['keys'](db[_0x3471('0x71')]['rawAttributes']);_0x140439[_0x3471('0x42')]=_[_0x3471('0x43')](_0x8ebdeb[_0x3471('0x42')]);_0x140439['filters']=_[_0x3471('0x44')](_0x140439[_0x3471('0x40')],_0x140439[_0x3471('0x42')]);_0x490218[_0x3471('0x45')]=_[_0x3471('0x44')](_0x140439[_0x3471('0x40')],qs[_0x3471('0x46')](_0x8ebdeb[_0x3471('0x42')][_0x3471('0x46')]));_0x490218[_0x3471('0x45')]=_0x490218[_0x3471('0x45')][_0x3471('0x47')]?_0x490218['attributes']:_0x140439[_0x3471('0x40')];_0x490218[_0x3471('0x4a')]=qs[_0x3471('0x4b')](_0x8ebdeb[_0x3471('0x42')]['sort']);_0x490218[_0x3471('0x4c')]=qs['filters'](_[_0x3471('0x65')](_0x8ebdeb[_0x3471('0x42')],_0x140439[_0x3471('0x4d')]));if(_0x8ebdeb['query'][_0x3471('0x50')]){_0x490218[_0x3471('0x4c')]=_[_0x3471('0x4e')](_0x490218['where'],{'$or':_[_0x3471('0x3c')](_0x490218[_0x3471('0x45')],function(_0x4aa880){var _0x29edd1={};_0x29edd1[_0x4aa880]={'$like':'%'+_0x8ebdeb['query'][_0x3471('0x50')]+'%'};return _0x29edd1;})});}_0x490218=_['merge']({},_0x490218,_0x8ebdeb['options']);return _0x2dcd59[_0x3471('0x70')](_0x490218);}})[_0x3471('0x33')](function(_0x50d95b){if(_0x50d95b){_0x1e82f4=_0x50d95b[_0x3471('0x47')];if(!_0x8ebdeb[_0x3471('0x42')][_0x3471('0x48')](_0x3471('0x49'))){_0x490218[_0x3471('0x2b')]=qs[_0x3471('0x2b')](_0x8ebdeb[_0x3471('0x42')][_0x3471('0x2b')]);_0x490218[_0x3471('0x29')]=qs['offset'](_0x8ebdeb[_0x3471('0x42')][_0x3471('0x29')]);}return _0x2dcd59[_0x3471('0x70')](_0x490218);}})[_0x3471('0x33')](function(_0x187958){if(_0x187958){return _0x187958?{'count':_0x1e82f4,'rows':_0x187958}:null;}})[_0x3471('0x33')](respondWithResult(_0x2a7d72,null))['catch'](handleError(_0x2a7d72,null));};exports[_0x3471('0x72')]=function(_0x69028c,_0x18eff4,_0x2a093f){var _0x59bf17=_0x69028c['body'][_0x3471('0x73')];return db[_0x3471('0x71')][_0x3471('0x54')]({'where':{'id':_0x59bf17},'attributes':['id'],'include':[{'model':db[_0x3471('0x67')],'as':_0x3471('0x74'),'attributes':['id',_0x3471('0x41'),_0x3471('0x75'),'voicePause',_0x3471('0x76')],'raw':!![]}]})[_0x3471('0x33')](function(_0x1114d5){if(_0x1114d5){var _0x20f7e1=_[_0x3471('0x77')](_0x1114d5,function(_0x40abd7){var _0x514fd0=_0x40abd7[_0x3471('0x35')]({'plain':!![]});return _0x514fd0[_0x3471('0x74')];});return db[_0x3471('0x52')][_0x3471('0x59')]({'where':{'id':_0x69028c[_0x3471('0x56')]['id']}})[_0x3471('0x33')](function(_0x4388ef){return db[_0x3471('0x78')][_0x3471('0x79')](function(_0x49020d){return _0x4388ef[_0x3471('0x72')](_0x59bf17,{'transaction':_0x49020d})[_0x3471('0x33')](function(){return BPromise[_0x3471('0x7a')](_0x20f7e1,function(_0x346d89){return db[_0x3471('0x64')][_0x3471('0x7b')]({'where':{'UserId':_0x346d89['id'],'ChatQueueId':_0x69028c[_0x3471('0x56')]['id']},'transaction':_0x49020d});});})['then'](function(){_0x20f7e1[_0x3471('0x7c')](function(_0x484ab0){socket['emit'](_0x3471('0x7d'),{'UserId':_0x484ab0['id'],'ChatQueueId':_0x4388ef['id']});});});});});}})[_0x3471('0x33')](respondWithStatusCode(_0x18eff4,null))['catch'](handleError(_0x18eff4,null));};exports[_0x3471('0x7e')]=function(_0x4ea87b,_0x1a8467,_0x4a83c2){return db[_0x3471('0x71')][_0x3471('0x54')]({'where':{'id':_0x4ea87b[_0x3471('0x42')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3471('0x74'),'attributes':['id'],'raw':!![]}]})[_0x3471('0x33')](handleEntityNotFound(_0x1a8467,null))['then'](function(_0xc2651b){var _0x262428=_[_0x3471('0x3c')](_0xc2651b,'id');var _0xc160f=[];var _0x16aa99=[];var _0x460712=squel[_0x3471('0x7f')]();_0x460712[_0x3471('0x80')](_0x3471('0x81'))[_0x3471('0x82')](_0x3471('0x83'),'tq')[_0x3471('0x84')](_0x3471('0x85'),'ut',_0x3471('0x86'))['where'](_0x3471('0x87'),_0x4ea87b['params']['id']);for(var _0xb579d6=0x0;_0xb579d6<_0xc2651b['length'];_0xb579d6+=0x1){let _0x4e9ffa=_0xc2651b[_0xb579d6];for(var _0x44e4a5=0x0;_0x44e4a5<_0x4e9ffa[_0x3471('0x74')]['length'];_0x44e4a5+=0x1){let _0x12b365=_0x4e9ffa[_0x3471('0x74')][_0x44e4a5];var _0x140c09=_0x460712[_0x3471('0x88')]();_0x140c09[_0x3471('0x4c')](_0x3471('0x89'),_0x12b365['id']);_0x16aa99[_0x3471('0x8a')](db[_0x3471('0x78')][_0x3471('0x42')](_0x140c09[_0x3471('0x8b')](),{'type':db['sequelize'][_0x3471('0x8c')][_0x3471('0x8d')]})[_0x3471('0x33')](function(_0x3390b9){if(_0x3390b9[_0x3471('0x47')]===0x1){return _0x12b365['id'];}else{var _0x20f493=_['every'](_[_0x3471('0x3c')](_0x3390b9,_0x3471('0x8e')),function(_0x34926f){return _[_0x3471('0x8f')](_0x262428,_0x34926f);});if(_0x20f493){return _0x12b365['id'];}}}));}}return BPromise[_0x3471('0x90')](_0x16aa99)[_0x3471('0x33')](function(_0x35ab76){_0xc160f=_(_0xc160f)['union'](_0x35ab76)[_0x3471('0x91')]()[_0x3471('0x92')]();return db[_0x3471('0x52')][_0x3471('0x59')]({'where':{'id':_0x4ea87b[_0x3471('0x56')]['id']}})[_0x3471('0x33')](function(_0x4cde33){return db['sequelize'][_0x3471('0x79')](function(_0x1fb36a){return _0x4cde33[_0x3471('0x7e')](_0x4ea87b[_0x3471('0x42')][_0x3471('0x73')],{'transaction':_0x1fb36a})['then'](function(){if(!_[_0x3471('0x93')](_0xc160f)){return _0x4cde33['removeAgents'](_0xc160f,{'transaction':_0x1fb36a});}})[_0x3471('0x33')](function(){_0xc160f[_0x3471('0x7c')](function(_0xb0bf90){socket[_0x3471('0x94')](_0x3471('0x95'),{'UserId':_0xb0bf90,'ChatQueueId':_0x4cde33['id']});});});});});});})['then'](respondWithStatusCode(_0x1a8467,null))[_0x3471('0x27')](handleError(_0x1a8467,null));};exports[_0x3471('0x96')]=function(_0x3cb292,_0x19024c,_0x132444){return db[_0x3471('0x52')][_0x3471('0x59')]({'where':{'id':_0x3cb292[_0x3471('0x56')]['id']}})['then'](handleEntityNotFound(_0x19024c,null))[_0x3471('0x33')](function(_0x5804ae){if(_0x5804ae){return _0x5804ae['addAgents'](_0x3cb292['body'][_0x3471('0x73')],_[_0x3471('0x97')](_0x3cb292[_0x3471('0x5b')],[_0x3471('0x73'),'id'])||{})[_0x3471('0x98')](function(_0x38e577){for(var _0xa6c3fb=0x0;_0xa6c3fb<_0x3cb292[_0x3471('0x5b')][_0x3471('0x73')]['length'];_0xa6c3fb+=0x1){socket[_0x3471('0x94')]('userChatQueue:save',{'UserId':Number(_0x3cb292[_0x3471('0x5b')][_0x3471('0x73')][_0xa6c3fb]),'ChatQueueId':Number(_0x3cb292['params']['id'])});}return _0x38e577;});}})[_0x3471('0x33')](respondWithResult(_0x19024c,null))[_0x3471('0x27')](handleError(_0x19024c,null));};exports[_0x3471('0x99')]=function(_0x3ab46f,_0x25cb76,_0xdc503b){return db[_0x3471('0x52')]['find']({'where':{'id':_0x3ab46f[_0x3471('0x56')]['id']}})['then'](handleEntityNotFound(_0x25cb76,null))[_0x3471('0x33')](function(_0x408fc1){if(_0x408fc1){return _0x408fc1[_0x3471('0x99')](_0x3ab46f[_0x3471('0x42')][_0x3471('0x73')])[_0x3471('0x33')](function(){if(_['isArray'](_0x3ab46f[_0x3471('0x42')]['ids'])){for(var _0x27a7a1=0x0;_0x27a7a1<_0x3ab46f[_0x3471('0x42')][_0x3471('0x73')][_0x3471('0x47')];_0x27a7a1+=0x1){socket[_0x3471('0x94')](_0x3471('0x95'),{'UserId':Number(_0x3ab46f['query'][_0x3471('0x73')][_0x27a7a1]),'ChatQueueId':Number(_0x3ab46f[_0x3471('0x56')]['id'])});}}else{socket[_0x3471('0x94')](_0x3471('0x95'),{'UserId':Number(_0x3ab46f[_0x3471('0x42')][_0x3471('0x73')]),'ChatQueueId':Number(_0x3ab46f[_0x3471('0x56')]['id'])});}});}})[_0x3471('0x33')](respondWithStatusCode(_0x25cb76,null))['catch'](handleError(_0x25cb76,null));};exports[_0x3471('0x9a')]=function(_0x5ba7d7,_0x57d4f7,_0x301d78){var _0xd3b356={};var _0x400b13={};var _0x57ae31;var _0x2a6122;return db[_0x3471('0x52')][_0x3471('0x9b')]({'where':{'id':_0x5ba7d7[_0x3471('0x56')]['id']}})[_0x3471('0x33')](handleEntityNotFound(_0x57d4f7,null))[_0x3471('0x33')](function(_0x3b4fd4){if(_0x3b4fd4){_0x57ae31=_0x3b4fd4;_0x400b13[_0x3471('0x40')]=_[_0x3471('0x43')](db[_0x3471('0x67')]['rawAttributes']);_0x400b13[_0x3471('0x42')]=_['keys'](_0x5ba7d7[_0x3471('0x42')]);_0x400b13[_0x3471('0x4d')]=_['intersection'](_0x400b13[_0x3471('0x40')],_0x400b13[_0x3471('0x42')]);_0xd3b356[_0x3471('0x45')]=_[_0x3471('0x44')](_0x400b13[_0x3471('0x40')],qs['fields'](_0x5ba7d7['query']['fields']));_0xd3b356['attributes']=_0xd3b356[_0x3471('0x45')][_0x3471('0x47')]?_0xd3b356[_0x3471('0x45')]:_0x400b13[_0x3471('0x40')];_0xd3b356[_0x3471('0x4a')]=qs[_0x3471('0x4b')](_0x5ba7d7[_0x3471('0x42')][_0x3471('0x4b')]);_0xd3b356[_0x3471('0x4c')]=qs[_0x3471('0x4d')](_[_0x3471('0x65')](_0x5ba7d7['query'],_0x400b13['filters']));if(_0x5ba7d7['query'][_0x3471('0x50')]){_0xd3b356[_0x3471('0x4c')]=_[_0x3471('0x4e')](_0xd3b356[_0x3471('0x4c')],{'$or':_['map'](_0xd3b356[_0x3471('0x45')],function(_0xdb30e3){var _0x14d707={};_0x14d707[_0xdb30e3]={'$like':'%'+_0x5ba7d7[_0x3471('0x42')]['filter']+'%'};return _0x14d707;})});}_0xd3b356=_[_0x3471('0x4e')]({},_0xd3b356,_0x5ba7d7['options']);return _0x57ae31[_0x3471('0x9a')](_0xd3b356);}})['then'](function(_0x3995c4){if(_0x3995c4){_0x2a6122=_0x3995c4[_0x3471('0x47')];if(!_0x5ba7d7[_0x3471('0x42')][_0x3471('0x48')](_0x3471('0x49'))){_0xd3b356[_0x3471('0x2b')]=qs['limit'](_0x5ba7d7['query'][_0x3471('0x2b')]);_0xd3b356['offset']=qs['offset'](_0x5ba7d7['query'][_0x3471('0x29')]);}return _0x57ae31[_0x3471('0x9a')](_0xd3b356);}})[_0x3471('0x33')](function(_0x1f4283){if(_0x1f4283){return _0x1f4283?{'count':_0x2a6122,'rows':_0x1f4283}:null;}})[_0x3471('0x33')](respondWithResult(_0x57d4f7,null))[_0x3471('0x27')](handleError(_0x57d4f7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 576db9e..7198a08 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 _0x20da=['remove','emit','exports','events','../../mysqldb','ChatQueue','setMaxListeners','update'];(function(_0x65656f,_0x23d7fd){var _0x5824c9=function(_0x369f7f){while(--_0x369f7f){_0x65656f['push'](_0x65656f['shift']());}};_0x5824c9(++_0x23d7fd);}(_0x20da,0xcb));var _0xa20d=function(_0x32ab21,_0x26ca1b){_0x32ab21=_0x32ab21-0x0;var _0x3c9408=_0x20da[_0x32ab21];return _0x3c9408;};'use strict';var EventEmitter=require(_0xa20d('0x0'));var ChatQueue=require(_0xa20d('0x1'))['db'][_0xa20d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa20d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa20d('0x4'),'afterDestroy':_0xa20d('0x5')};function emitEvent(_0x16e90a){return function(_0x3ae6ba,_0x416aeb,_0x17b952){ChatQueueEvents[_0xa20d('0x6')](_0x16e90a+':'+_0x3ae6ba['id'],_0x3ae6ba);ChatQueueEvents[_0xa20d('0x6')](_0x16e90a,_0x3ae6ba);_0x17b952(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xa20d('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x8d5b=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x8d5b,0x102));var _0xb8d5=function(_0x3a814f,_0x553e5b){_0x3a814f=_0x3a814f-0x0;var _0x150de1=_0x8d5b[_0x3a814f];return _0x150de1;};'use strict';var EventEmitter=require(_0xb8d5('0x0'));var ChatQueue=require(_0xb8d5('0x1'))['db'][_0xb8d5('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xb8d5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb8d5('0x4')};function emitEvent(_0x9d78b9){return function(_0x450e04,_0x5468a9,_0x4eacc7){ChatQueueEvents[_0xb8d5('0x5')](_0x9d78b9+':'+_0x450e04['id'],_0x450e04);ChatQueueEvents['emit'](_0x9d78b9,_0x450e04);_0x4eacc7(null);};}for(var e in events){if(events[_0xb8d5('0x6')](e)){var event=events[e];ChatQueue[_0xb8d5('0x7')](e,emitEvent(event));}}module[_0xb8d5('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 14c79d0..85820be 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 _0xb2db=['path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x374785,_0x4f71b8){var _0x572c40=function(_0x1cf7b0){while(--_0x1cf7b0){_0x374785['push'](_0x374785['shift']());}};_0x572c40(++_0x4f71b8);}(_0xb2db,0xca));var _0xbb2d=function(_0x19d0bb,_0x1fcc68){_0x19d0bb=_0x19d0bb-0x0;var _0x1bc556=_0xb2db[_0x19d0bb];return _0x1bc556;};'use strict';var _=require('lodash');var util=require(_0xbb2d('0x0'));var logger=require(_0xbb2d('0x1'))(_0xbb2d('0x2'));var moment=require(_0xbb2d('0x3'));var BPromise=require(_0xbb2d('0x4'));var rp=require(_0xbb2d('0x5'));var fs=require('fs');var path=require(_0xbb2d('0x6'));var rimraf=require('rimraf');var config=require(_0xbb2d('0x7'));var attributes=require(_0xbb2d('0x8'));module[_0xbb2d('0x9')]=function(_0x4768d3,_0x798452){return _0x4768d3[_0xbb2d('0xa')](_0xbb2d('0xb'),attributes,{'tableName':_0xbb2d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf594=['exports','ChatQueue','lodash','util','api','moment','bluebird','../../config/environment','./chatQueue.attributes'];(function(_0x289a3a,_0x189aad){var _0x2957f7=function(_0x4a190b){while(--_0x4a190b){_0x289a3a['push'](_0x289a3a['shift']());}};_0x2957f7(++_0x189aad);}(_0xf594,0xc8));var _0x4f59=function(_0x42d124,_0x1b7e08){_0x42d124=_0x42d124-0x0;var _0x1bb79c=_0xf594[_0x42d124];return _0x1bb79c;};'use strict';var _=require(_0x4f59('0x0'));var util=require(_0x4f59('0x1'));var logger=require('../../config/logger')(_0x4f59('0x2'));var moment=require(_0x4f59('0x3'));var BPromise=require(_0x4f59('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4f59('0x5'));var attributes=require(_0x4f59('0x6'));module[_0x4f59('0x7')]=function(_0xe7ce64,_0x20f1d4){return _0xe7ce64['define'](_0x4f59('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 73deaa9..7621852 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 _0x7ae6=['localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue','findAll','options','raw','attributes','limit','map','include','model','ShowChatQueue','find','where','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0x7ae6,0x94));var _0x67ae=function(_0x4219dc,_0x45af02){_0x4219dc=_0x4219dc-0x0;var _0xfe8ac6=_0x7ae6[_0x4219dc];return _0xfe8ac6;};'use strict';var _=require('lodash');var util=require(_0x67ae('0x0'));var moment=require('moment');var BPromise=require(_0x67ae('0x1'));var rs=require(_0x67ae('0x2'));var fs=require('fs');var Redis=require(_0x67ae('0x3'));var db=require(_0x67ae('0x4'))['db'];var utils=require(_0x67ae('0x5'));var logger=require(_0x67ae('0x6'))('rpc');var config=require(_0x67ae('0x7'));var jayson=require(_0x67ae('0x8'));var client=jayson[_0x67ae('0x9')][_0x67ae('0xa')]({'port':0x232a});config[_0x67ae('0xb')]=_['defaults'](config[_0x67ae('0xb')],{'host':_0x67ae('0xc'),'port':0x18eb});var socket=require(_0x67ae('0xd'))(new Redis(config[_0x67ae('0xb')]));require(_0x67ae('0xe'))[_0x67ae('0xf')](socket);function respondWithRpcPromise(_0x46140e,_0x417111,_0x4d278b){return new BPromise(function(_0x28d20a,_0x3143cb){return client[_0x67ae('0x10')](_0x46140e,_0x4d278b)[_0x67ae('0x11')](function(_0xf3f46b){logger[_0x67ae('0x12')](_0x67ae('0x13'),_0x417111,_0x67ae('0x14'));logger[_0x67ae('0x15')](_0x67ae('0x16'),_0x417111,_0x67ae('0x14'),JSON[_0x67ae('0x17')](_0xf3f46b));if(_0xf3f46b[_0x67ae('0x18')]){if(_0xf3f46b[_0x67ae('0x18')][_0x67ae('0x19')]===0x1f4){logger['error'](_0x67ae('0x13'),_0x417111,_0xf3f46b[_0x67ae('0x18')][_0x67ae('0x1a')]);return _0x3143cb(_0xf3f46b['error']['message']);}logger[_0x67ae('0x18')]('ChatQueue,\x20%s,\x20%s',_0x417111,_0xf3f46b['error'][_0x67ae('0x1a')]);return _0x28d20a(_0xf3f46b[_0x67ae('0x18')]['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x417111,_0x67ae('0x14'));_0x28d20a(_0xf3f46b['result'][_0x67ae('0x1a')]);}})['catch'](function(_0x3654fd){logger[_0x67ae('0x18')](_0x67ae('0x13'),_0x417111,_0x3654fd);_0x3143cb(_0x3654fd);});});}exports['GetChatQueue']=function(_0x30606a){var _0x18876d=this;return new Promise(function(_0x23ca2c,_0xbe6112){return db[_0x67ae('0x1b')][_0x67ae('0x1c')]({'raw':_0x30606a[_0x67ae('0x1d')]?_0x30606a['options'][_0x67ae('0x1e')]===undefined?!![]:![]:!![],'where':_0x30606a[_0x67ae('0x1d')]?_0x30606a['options']['where']||null:null,'attributes':_0x30606a['options']?_0x30606a[_0x67ae('0x1d')][_0x67ae('0x1f')]||null:null,'limit':_0x30606a[_0x67ae('0x1d')]?_0x30606a['options'][_0x67ae('0x20')]||null:null,'include':_0x30606a[_0x67ae('0x1d')]?_0x30606a['options']['include']?_[_0x67ae('0x21')](_0x30606a[_0x67ae('0x1d')][_0x67ae('0x22')],function(_0x219d03){return{'model':db[_0x219d03[_0x67ae('0x23')]],'as':_0x219d03['as'],'attributes':_0x219d03[_0x67ae('0x1f')],'include':_0x219d03[_0x67ae('0x22')]?_[_0x67ae('0x21')](_0x219d03[_0x67ae('0x22')],function(_0x479b8a){return{'model':db[_0x479b8a[_0x67ae('0x23')]],'as':_0x479b8a['as'],'attributes':_0x479b8a['attributes'],'include':_0x479b8a[_0x67ae('0x22')]?_[_0x67ae('0x21')](_0x479b8a[_0x67ae('0x22')],function(_0x266d26){return{'model':db[_0x266d26[_0x67ae('0x23')]],'as':_0x266d26['as'],'attributes':_0x266d26[_0x67ae('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x67ae('0x11')](function(_0x361f98){logger['info']('GetChatQueue',_0x30606a);logger['debug']('GetChatQueue',_0x30606a,JSON[_0x67ae('0x17')](_0x361f98));_0x23ca2c(_0x361f98);})['catch'](function(_0x5c3020){logger[_0x67ae('0x18')]('GetChatQueue',_0x5c3020[_0x67ae('0x1a')],_0x30606a);_0xbe6112(_0x18876d['error'](0x1f4,_0x5c3020['message']));});});};exports[_0x67ae('0x24')]=function(_0x2d2eb6){var _0x5696db=this;return new Promise(function(_0x503cc5,_0x416e23){return db['ChatQueue'][_0x67ae('0x25')]({'raw':_0x2d2eb6[_0x67ae('0x1d')]?_0x2d2eb6[_0x67ae('0x1d')][_0x67ae('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d2eb6[_0x67ae('0x1d')]?_0x2d2eb6['options'][_0x67ae('0x26')]||null:null,'attributes':_0x2d2eb6[_0x67ae('0x1d')]?_0x2d2eb6[_0x67ae('0x1d')][_0x67ae('0x1f')]||null:null,'include':_0x2d2eb6[_0x67ae('0x1d')]?_0x2d2eb6[_0x67ae('0x1d')]['include']?_[_0x67ae('0x21')](_0x2d2eb6['options'][_0x67ae('0x22')],function(_0x1b655d){return{'model':db[_0x1b655d[_0x67ae('0x23')]],'as':_0x1b655d['as'],'attributes':_0x1b655d['attributes'],'include':_0x1b655d[_0x67ae('0x22')]?_[_0x67ae('0x21')](_0x1b655d[_0x67ae('0x22')],function(_0x23e758){return{'model':db[_0x23e758[_0x67ae('0x23')]],'as':_0x23e758['as'],'attributes':_0x23e758[_0x67ae('0x1f')],'include':_0x23e758[_0x67ae('0x22')]?_[_0x67ae('0x21')](_0x23e758['include'],function(_0x42ef2b){return{'model':db[_0x42ef2b['model']],'as':_0x42ef2b['as'],'attributes':_0x42ef2b[_0x67ae('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x67ae('0x11')](function(_0x82ba8c){logger[_0x67ae('0x12')]('ShowChatQueue',_0x2d2eb6);logger['debug']('ShowChatQueue',_0x2d2eb6,JSON[_0x67ae('0x17')](_0x82ba8c));_0x503cc5(_0x82ba8c);})[_0x67ae('0x27')](function(_0x5f60c7){logger['error']('ShowChatQueue',_0x5f60c7[_0x67ae('0x1a')],_0x2d2eb6);_0x416e23(_0x5696db[_0x67ae('0x18')](0x1f4,_0x5f60c7[_0x67ae('0x1a')]));});});}; \ No newline at end of file +var _0x8127=['options','attributes','include','map','model','ShowChatQueue','find','raw','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','ChatQueue'];(function(_0x3ad140,_0x184cc9){var _0xe2718f=function(_0x28266d){while(--_0x28266d){_0x3ad140['push'](_0x3ad140['shift']());}};_0xe2718f(++_0x184cc9);}(_0x8127,0x1d1));var _0x7812=function(_0x93f88e,_0x301e95){_0x93f88e=_0x93f88e-0x0;var _0x57fcf9=_0x8127[_0x93f88e];return _0x57fcf9;};'use strict';var _=require('lodash');var util=require(_0x7812('0x0'));var moment=require(_0x7812('0x1'));var BPromise=require(_0x7812('0x2'));var rs=require(_0x7812('0x3'));var fs=require('fs');var Redis=require(_0x7812('0x4'));var db=require(_0x7812('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7812('0x6'))(_0x7812('0x7'));var config=require(_0x7812('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7812('0x9')]({'port':0x232a});config['redis']=_[_0x7812('0xa')](config[_0x7812('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7812('0xc'))(new Redis(config[_0x7812('0xb')]));require(_0x7812('0xd'))[_0x7812('0xe')](socket);function respondWithRpcPromise(_0x5af6f2,_0xd790c0,_0x1ac392){return new BPromise(function(_0x8ee2ea,_0x58cecf){return client[_0x7812('0xf')](_0x5af6f2,_0x1ac392)[_0x7812('0x10')](function(_0x493e78){logger[_0x7812('0x11')](_0x7812('0x12'),_0xd790c0,_0x7812('0x13'));logger[_0x7812('0x14')](_0x7812('0x15'),_0xd790c0,_0x7812('0x13'),JSON[_0x7812('0x16')](_0x493e78));if(_0x493e78['error']){if(_0x493e78[_0x7812('0x17')]['code']===0x1f4){logger[_0x7812('0x17')](_0x7812('0x12'),_0xd790c0,_0x493e78[_0x7812('0x17')][_0x7812('0x18')]);return _0x58cecf(_0x493e78['error'][_0x7812('0x18')]);}logger[_0x7812('0x17')](_0x7812('0x12'),_0xd790c0,_0x493e78[_0x7812('0x17')][_0x7812('0x18')]);return _0x8ee2ea(_0x493e78['error']['message']);}else{logger['info'](_0x7812('0x12'),_0xd790c0,'request\x20sent');_0x8ee2ea(_0x493e78[_0x7812('0x19')][_0x7812('0x18')]);}})[_0x7812('0x1a')](function(_0x798495){logger['error'](_0x7812('0x12'),_0xd790c0,_0x798495);_0x58cecf(_0x798495);});});}exports[_0x7812('0x1b')]=function(_0x3730df){var _0x190b2b=this;return new Promise(function(_0x23f6f1,_0x2d853b){return db[_0x7812('0x1c')]['findAll']({'raw':_0x3730df[_0x7812('0x1d')]?_0x3730df['options']['raw']===undefined?!![]:![]:!![],'where':_0x3730df[_0x7812('0x1d')]?_0x3730df[_0x7812('0x1d')]['where']||null:null,'attributes':_0x3730df[_0x7812('0x1d')]?_0x3730df[_0x7812('0x1d')][_0x7812('0x1e')]||null:null,'limit':_0x3730df[_0x7812('0x1d')]?_0x3730df[_0x7812('0x1d')]['limit']||null:null,'include':_0x3730df[_0x7812('0x1d')]?_0x3730df[_0x7812('0x1d')][_0x7812('0x1f')]?_[_0x7812('0x20')](_0x3730df[_0x7812('0x1d')][_0x7812('0x1f')],function(_0x574ab4){return{'model':db[_0x574ab4[_0x7812('0x21')]],'as':_0x574ab4['as'],'attributes':_0x574ab4[_0x7812('0x1e')],'include':_0x574ab4[_0x7812('0x1f')]?_[_0x7812('0x20')](_0x574ab4['include'],function(_0x20bca5){return{'model':db[_0x20bca5['model']],'as':_0x20bca5['as'],'attributes':_0x20bca5[_0x7812('0x1e')],'include':_0x20bca5[_0x7812('0x1f')]?_[_0x7812('0x20')](_0x20bca5[_0x7812('0x1f')],function(_0xf2480b){return{'model':db[_0xf2480b['model']],'as':_0xf2480b['as'],'attributes':_0xf2480b[_0x7812('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7812('0x10')](function(_0x35ab2b){logger[_0x7812('0x11')]('GetChatQueue',_0x3730df);logger['debug']('GetChatQueue',_0x3730df,JSON[_0x7812('0x16')](_0x35ab2b));_0x23f6f1(_0x35ab2b);})[_0x7812('0x1a')](function(_0x106a63){logger[_0x7812('0x17')](_0x7812('0x1b'),_0x106a63[_0x7812('0x18')],_0x3730df);_0x2d853b(_0x190b2b['error'](0x1f4,_0x106a63[_0x7812('0x18')]));});});};exports[_0x7812('0x22')]=function(_0x4b5a75){var _0x57eac5=this;return new Promise(function(_0xad3f2d,_0x5e029e){return db[_0x7812('0x1c')][_0x7812('0x23')]({'raw':_0x4b5a75[_0x7812('0x1d')]?_0x4b5a75[_0x7812('0x1d')][_0x7812('0x24')]===undefined?!![]:![]:!![],'where':_0x4b5a75[_0x7812('0x1d')]?_0x4b5a75['options'][_0x7812('0x25')]||null:null,'attributes':_0x4b5a75[_0x7812('0x1d')]?_0x4b5a75[_0x7812('0x1d')]['attributes']||null:null,'include':_0x4b5a75[_0x7812('0x1d')]?_0x4b5a75[_0x7812('0x1d')][_0x7812('0x1f')]?_[_0x7812('0x20')](_0x4b5a75['options']['include'],function(_0x151c42){return{'model':db[_0x151c42[_0x7812('0x21')]],'as':_0x151c42['as'],'attributes':_0x151c42['attributes'],'include':_0x151c42[_0x7812('0x1f')]?_[_0x7812('0x20')](_0x151c42['include'],function(_0x113caa){return{'model':db[_0x113caa['model']],'as':_0x113caa['as'],'attributes':_0x113caa[_0x7812('0x1e')],'include':_0x113caa['include']?_[_0x7812('0x20')](_0x113caa[_0x7812('0x1f')],function(_0x29a1a3){return{'model':db[_0x29a1a3[_0x7812('0x21')]],'as':_0x29a1a3['as'],'attributes':_0x29a1a3[_0x7812('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x394740){logger[_0x7812('0x11')]('ShowChatQueue',_0x4b5a75);logger[_0x7812('0x14')](_0x7812('0x22'),_0x4b5a75,JSON[_0x7812('0x16')](_0x394740));_0xad3f2d(_0x394740);})[_0x7812('0x1a')](function(_0x387a34){logger['error'](_0x7812('0x22'),_0x387a34['message'],_0x4b5a75);_0x5e029e(_0x57eac5[_0x7812('0x17')](0x1f4,_0x387a34[_0x7812('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0810613..e87579c 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(_0x2288e9,_0x15e163){var _0x24bec9=function(_0xf4dd47){while(--_0xf4dd47){_0x2288e9['push'](_0x2288e9['shift']());}};_0x24bec9(++_0x15e163);}(_0x0faf,0x132));var _0xf0fa=function(_0x4ccf7f,_0x161ffd){_0x4ccf7f=_0x4ccf7f-0x0;var _0x1953f0=_0x0faf[_0x4ccf7f];return _0x1953f0;};'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 _0xd2ea=['./chatQueue.events','save','remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x44b0a3,_0x3ce269){var _0x1eb81a=function(_0x591eb8){while(--_0x591eb8){_0x44b0a3['push'](_0x44b0a3['shift']());}};_0x1eb81a(++_0x3ce269);}(_0xd2ea,0x15f));var _0xad2e=function(_0x105342,_0x5fb601){_0x105342=_0x105342-0x0;var _0x52b1d9=_0xd2ea[_0x105342];return _0x52b1d9;};'use strict';var ChatQueueEvents=require(_0xad2e('0x0'));var events=[_0xad2e('0x1'),_0xad2e('0x2'),_0xad2e('0x3')];function createListener(_0x44b30d,_0x5c9fa9){return function(_0x3a9d11){_0x5c9fa9[_0xad2e('0x4')](_0x44b30d,_0x3a9d11);};}function removeListener(_0xcba7cb,_0x3e0741){return function(){ChatQueueEvents[_0xad2e('0x5')](_0xcba7cb,_0x3e0741);};}exports[_0xad2e('0x6')]=function(_0x29e97f){for(var _0x592e8b=0x0,_0x3b5170=events[_0xad2e('0x7')];_0x592e8b<_0x3b5170;_0x592e8b++){var _0x2ff7b2=events[_0x592e8b];var _0x5710ac=createListener(_0xad2e('0x8')+_0x2ff7b2,_0x29e97f);ChatQueueEvents['on'](_0x2ff7b2,_0x5710ac);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 93cf5f5..b16f670 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x12457c,_0x27e0d5){var _0x426147=function(_0x2bdda3){while(--_0x2bdda3){_0x12457c['push'](_0x12457c['shift']());}};_0x426147(++_0x27e0d5);}(_0x008c,0x188));var _0xc008=function(_0x44f315,_0x5a799f){_0x44f315=_0x44f315-0x0;var _0x20478e=_0x008c[_0x44f315];return _0x20478e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +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(_0x345cea,_0x409aea){var _0x14b70e=function(_0x502881){while(--_0x502881){_0x345cea['push'](_0x345cea['shift']());}};_0x14b70e(++_0x409aea);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 0749344..773b31e 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 _0xb416=['sequelize','STRING','DATE','moment'];(function(_0x727b91,_0x56d897){var _0x423ea1=function(_0x223ba0){while(--_0x223ba0){_0x727b91['push'](_0x727b91['shift']());}};_0x423ea1(++_0x56d897);}(_0xb416,0x173));var _0x6b41=function(_0x422c48,_0x1f722e){_0x422c48=_0x422c48-0x0;var _0x51a366=_0xb416[_0x422c48];return _0x51a366;};'use strict';var moment=require(_0x6b41('0x0'));var Sequelize=require(_0x6b41('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6b41('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6b41('0x2')]},'joinAt':{'type':Sequelize[_0x6b41('0x3')]},'leaveAt':{'type':Sequelize[_0x6b41('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6b41('0x3')]},'reason':{'type':Sequelize[_0x6b41('0x2')]}}; \ No newline at end of file +var _0xbc5d=['STRING','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc5d,0x19e));var _0xdbc5=function(_0x66511c,_0x38e069){_0x66511c=_0x66511c-0x0;var _0x1a4838=_0xbc5d[_0x66511c];return _0x1a4838;};'use strict';var moment=require('moment');var Sequelize=require(_0xdbc5('0x0'));module[_0xdbc5('0x1')]={'uniqueid':{'type':Sequelize[_0xdbc5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdbc5('0x2')]},'joinAt':{'type':Sequelize[_0xdbc5('0x3')]},'leaveAt':{'type':Sequelize[_0xdbc5('0x3')]},'acceptAt':{'type':Sequelize[_0xdbc5('0x3')]},'exitAt':{'type':Sequelize[_0xdbc5('0x3')]},'reason':{'type':Sequelize[_0xdbc5('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 511bd6c..3b18163 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 _0x02ca=['update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','type','options','include','ChatQueueReport','findAll','rows','catch','params','includeAll','create','body'];(function(_0x22b252,_0x2fa785){var _0x72a312=function(_0x399974){while(--_0x399974){_0x22b252['push'](_0x22b252['shift']());}};_0x72a312(++_0x2fa785);}(_0x02ca,0x97));var _0xa02c=function(_0x1537f6,_0x1cfcd2){_0x1537f6=_0x1537f6-0x0;var _0x4fcfb3=_0x02ca[_0x1537f6];return _0x4fcfb3;};'use strict';var emlformat=require(_0xa02c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa02c('0x1'));var jsonpatch=require(_0xa02c('0x2'));var rp=require(_0xa02c('0x3'));var moment=require(_0xa02c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa02c('0x5'));var util=require(_0xa02c('0x6'));var path=require(_0xa02c('0x7'));var sox=require(_0xa02c('0x8'));var csv=require(_0xa02c('0x9'));var ejs=require(_0xa02c('0xa'));var fs=require('fs');var fs_extra=require(_0xa02c('0xb'));var _=require(_0xa02c('0xc'));var squel=require(_0xa02c('0xd'));var crypto=require(_0xa02c('0xe'));var jsforce=require(_0xa02c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa02c('0x9'));var querystring=require(_0xa02c('0x10'));var Papa=require(_0xa02c('0x11'));var Redis=require(_0xa02c('0x12'));var authService=require(_0xa02c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa02c('0x14'));var utils=require(_0xa02c('0x15'));var config=require(_0xa02c('0x16'));var licenseUtil=require(_0xa02c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x456fd5,_0x3719d4){_0x3719d4=_0x3719d4||0xcc;return function(_0x9cb7ba){if(_0x9cb7ba){return _0x456fd5[_0xa02c('0x18')](_0x3719d4);}return _0x456fd5['status'](_0x3719d4)[_0xa02c('0x19')]();};}function respondWithResult(_0xefaee9,_0x3b24e5){_0x3b24e5=_0x3b24e5||0xc8;return function(_0x546729){if(_0x546729){return _0xefaee9[_0xa02c('0x1a')](_0x3b24e5)[_0xa02c('0x1b')](_0x546729);}};}function respondWithFilteredResult(_0x5eeece,_0x35f533){return function(_0x2a3604){if(_0x2a3604){var _0x4bc36d=typeof _0x35f533[_0xa02c('0x1c')]===_0xa02c('0x1d')&&typeof _0x35f533[_0xa02c('0x1e')]==='undefined';var _0x3c1bba=_0x2a3604['count'];var _0x4d7cb5=_0x4bc36d?0x0:_0x35f533['offset'];var _0x3fcc66=_0x4bc36d?_0x2a3604[_0xa02c('0x1f')]:_0x35f533[_0xa02c('0x1c')]+_0x35f533['limit'];var _0x12688a;if(_0x3fcc66>=_0x3c1bba){_0x3fcc66=_0x3c1bba;_0x12688a=0xc8;}else{_0x12688a=0xce;}_0x5eeece['status'](_0x12688a);return _0x5eeece[_0xa02c('0x20')](_0xa02c('0x21'),_0x4d7cb5+'-'+_0x3fcc66+'/'+_0x3c1bba)[_0xa02c('0x1b')](_0x2a3604);}return null;};}function patchUpdates(_0x476777){return function(_0x56406d){try{jsonpatch[_0xa02c('0x22')](_0x56406d,_0x476777,!![]);}catch(_0x4fb1db){return BPromise[_0xa02c('0x23')](_0x4fb1db);}return _0x56406d[_0xa02c('0x24')]();};}function saveUpdates(_0x45f7b0,_0x5b10b4){return function(_0x4787c7){if(_0x4787c7){return _0x4787c7['update'](_0x45f7b0)[_0xa02c('0x25')](function(_0x2ee242){return _0x2ee242;});}return null;};}function removeEntity(_0x2e4e9d,_0x514ef1){return function(_0x4ba050){if(_0x4ba050){return _0x4ba050[_0xa02c('0x26')]()[_0xa02c('0x25')](function(){_0x2e4e9d[_0xa02c('0x1a')](0xcc)[_0xa02c('0x19')]();});}};}function handleEntityNotFound(_0x437308,_0x58496c){return function(_0x4de358){if(!_0x4de358){_0x437308[_0xa02c('0x18')](0x194);}return _0x4de358;};}function handleError(_0x2277d2,_0x320a8d){_0x320a8d=_0x320a8d||0x1f4;return function(_0x39124e){logger[_0xa02c('0x27')](_0x39124e[_0xa02c('0x28')]);if(_0x39124e[_0xa02c('0x29')]){delete _0x39124e[_0xa02c('0x29')];}_0x2277d2['status'](_0x320a8d)[_0xa02c('0x2a')](_0x39124e);};}exports[_0xa02c('0x2b')]=function(_0x31b520,_0x67d524){var _0x267ab4={},_0x402f72={},_0x19f1c9={'count':0x0,'rows':[]};var _0x1dfc2c=_[_0xa02c('0x2c')](db['ChatQueueReport'][_0xa02c('0x2d')],function(_0xb9f91){return{'name':_0xb9f91[_0xa02c('0x2e')],'type':_0xb9f91['type']['key']};});_0x402f72[_0xa02c('0x2f')]=_[_0xa02c('0x2c')](_0x1dfc2c,_0xa02c('0x29'));_0x402f72[_0xa02c('0x30')]=_[_0xa02c('0x31')](_0x31b520[_0xa02c('0x30')]);_0x402f72[_0xa02c('0x32')]=_[_0xa02c('0x33')](_0x402f72[_0xa02c('0x2f')],_0x402f72[_0xa02c('0x30')]);_0x267ab4['attributes']=_['intersection'](_0x402f72[_0xa02c('0x2f')],qs[_0xa02c('0x34')](_0x31b520[_0xa02c('0x30')][_0xa02c('0x34')]));_0x267ab4[_0xa02c('0x35')]=_0x267ab4[_0xa02c('0x35')][_0xa02c('0x36')]?_0x267ab4[_0xa02c('0x35')]:_0x402f72[_0xa02c('0x2f')];if(!_0x31b520[_0xa02c('0x30')][_0xa02c('0x37')]('nolimit')){_0x267ab4[_0xa02c('0x1e')]=qs[_0xa02c('0x1e')](_0x31b520[_0xa02c('0x30')][_0xa02c('0x1e')]);_0x267ab4['offset']=qs['offset'](_0x31b520[_0xa02c('0x30')][_0xa02c('0x1c')]);}_0x267ab4['order']=qs['sort'](_0x31b520['query']['sort']);_0x267ab4[_0xa02c('0x38')]=qs[_0xa02c('0x32')](_[_0xa02c('0x39')](_0x31b520[_0xa02c('0x30')],_0x402f72['filters']),_0x1dfc2c);if(_0x31b520[_0xa02c('0x30')][_0xa02c('0x3a')]){_0x267ab4[_0xa02c('0x38')]=_[_0xa02c('0x3b')](_0x267ab4[_0xa02c('0x38')],{'$or':_[_0xa02c('0x2c')](_0x1dfc2c,function(_0x2ab794){if(_0x2ab794[_0xa02c('0x3c')]!=='VIRTUAL'){var _0x5b957b={};_0x5b957b[_0x2ab794[_0xa02c('0x29')]]={'$like':'%'+_0x31b520[_0xa02c('0x30')][_0xa02c('0x3a')]+'%'};return _0x5b957b;}})});}_0x267ab4=_[_0xa02c('0x3b')]({},_0x267ab4,_0x31b520[_0xa02c('0x3d')]);var _0x2a491b={'where':_0x267ab4[_0xa02c('0x38')]};return db['ChatQueueReport'][_0xa02c('0x1f')](_0x2a491b)[_0xa02c('0x25')](function(_0x33a9a3){_0x19f1c9[_0xa02c('0x1f')]=_0x33a9a3;if(_0x31b520['query']['includeAll']){_0x267ab4[_0xa02c('0x3e')]=[{'all':!![]}];}return db[_0xa02c('0x3f')][_0xa02c('0x40')](_0x267ab4);})['then'](function(_0x5d2ca0){_0x19f1c9[_0xa02c('0x41')]=_0x5d2ca0;return _0x19f1c9;})['then'](respondWithFilteredResult(_0x67d524,_0x267ab4))[_0xa02c('0x42')](handleError(_0x67d524,null));};exports['show']=function(_0x43b52a,_0x48996d){var _0x5ab62c={'raw':!![],'where':{'id':_0x43b52a[_0xa02c('0x43')]['id']}},_0x4a84c4={};_0x4a84c4['model']=_['keys'](db['ChatQueueReport'][_0xa02c('0x2d')]);_0x4a84c4['query']=_['keys'](_0x43b52a[_0xa02c('0x30')]);_0x4a84c4[_0xa02c('0x32')]=_[_0xa02c('0x33')](_0x4a84c4[_0xa02c('0x2f')],_0x4a84c4[_0xa02c('0x30')]);_0x5ab62c['attributes']=_[_0xa02c('0x33')](_0x4a84c4[_0xa02c('0x2f')],qs[_0xa02c('0x34')](_0x43b52a[_0xa02c('0x30')]['fields']));_0x5ab62c[_0xa02c('0x35')]=_0x5ab62c[_0xa02c('0x35')][_0xa02c('0x36')]?_0x5ab62c[_0xa02c('0x35')]:_0x4a84c4['model'];if(_0x43b52a[_0xa02c('0x30')][_0xa02c('0x44')]){_0x5ab62c['include']=[{'all':!![]}];}_0x5ab62c=_[_0xa02c('0x3b')]({},_0x5ab62c,_0x43b52a[_0xa02c('0x3d')]);return db[_0xa02c('0x3f')]['find'](_0x5ab62c)[_0xa02c('0x25')](handleEntityNotFound(_0x48996d,null))[_0xa02c('0x25')](respondWithResult(_0x48996d,null))[_0xa02c('0x42')](handleError(_0x48996d,null));};exports[_0xa02c('0x45')]=function(_0x282f1e,_0x4f11b2){return db['ChatQueueReport'][_0xa02c('0x45')](_0x282f1e[_0xa02c('0x46')],{})[_0xa02c('0x25')](respondWithResult(_0x4f11b2,0xc9))[_0xa02c('0x42')](handleError(_0x4f11b2,null));};exports[_0xa02c('0x47')]=function(_0x128a87,_0x538df7){if(_0x128a87[_0xa02c('0x46')]['id']){delete _0x128a87[_0xa02c('0x46')]['id'];}return db[_0xa02c('0x3f')][_0xa02c('0x48')]({'where':{'id':_0x128a87[_0xa02c('0x43')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x538df7,null))['then'](saveUpdates(_0x128a87['body'],null))['then'](respondWithResult(_0x538df7,null))[_0xa02c('0x42')](handleError(_0x538df7,null));};exports['destroy']=function(_0x115c9f,_0x1cae2a){return db[_0xa02c('0x3f')][_0xa02c('0x48')]({'where':{'id':_0x115c9f[_0xa02c('0x43')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x1cae2a,null))[_0xa02c('0x25')](removeEntity(_0x1cae2a,null))['catch'](handleError(_0x1cae2a,null));};exports[_0xa02c('0x49')]=function(_0x59d77f,_0x57a1a0){return db['ChatQueueReport'][_0xa02c('0x49')]()['then'](respondWithResult(_0x57a1a0,null))[_0xa02c('0x42')](handleError(_0x57a1a0,null));}; \ No newline at end of file +var _0x147b=['index','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','rawAttributes','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name'];(function(_0x135d25,_0xd531df){var _0x4ba0f8=function(_0x3b08dd){while(--_0x3b08dd){_0x135d25['push'](_0x135d25['shift']());}};_0x4ba0f8(++_0xd531df);}(_0x147b,0x193));var _0xb147=function(_0x3ddb2,_0x386ec3){_0x3ddb2=_0x3ddb2-0x0;var _0x41cc1f=_0x147b[_0x3ddb2];return _0x41cc1f;};'use strict';var emlformat=require(_0xb147('0x0'));var rimraf=require(_0xb147('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb147('0x2'));var rp=require(_0xb147('0x3'));var moment=require('moment');var BPromise=require(_0xb147('0x4'));var Mustache=require(_0xb147('0x5'));var util=require(_0xb147('0x6'));var path=require('path');var sox=require(_0xb147('0x7'));var csv=require('to-csv');var ejs=require(_0xb147('0x8'));var fs=require('fs');var fs_extra=require(_0xb147('0x9'));var _=require(_0xb147('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb147('0xb'));var deskjs=require(_0xb147('0xc'));var toCsv=require(_0xb147('0xd'));var querystring=require(_0xb147('0xe'));var Papa=require(_0xb147('0xf'));var Redis=require(_0xb147('0x10'));var authService=require(_0xb147('0x11'));var qs=require(_0xb147('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb147('0x13'))(_0xb147('0x14'));var utils=require(_0xb147('0x15'));var config=require(_0xb147('0x16'));var licenseUtil=require(_0xb147('0x17'));var db=require(_0xb147('0x18'))['db'];function respondWithStatusCode(_0x1465f6,_0x2d5e1c){_0x2d5e1c=_0x2d5e1c||0xcc;return function(_0x38040c){if(_0x38040c){return _0x1465f6[_0xb147('0x19')](_0x2d5e1c);}return _0x1465f6[_0xb147('0x1a')](_0x2d5e1c)['end']();};}function respondWithResult(_0xc110cb,_0x3dcfe0){_0x3dcfe0=_0x3dcfe0||0xc8;return function(_0x23ad29){if(_0x23ad29){return _0xc110cb[_0xb147('0x1a')](_0x3dcfe0)['json'](_0x23ad29);}};}function respondWithFilteredResult(_0x2a0eeb,_0x394614){return function(_0x4ab867){if(_0x4ab867){var _0x4df7e9=typeof _0x394614[_0xb147('0x1b')]===_0xb147('0x1c')&&typeof _0x394614[_0xb147('0x1d')]==='undefined';var _0x52af1f=_0x4ab867[_0xb147('0x1e')];var _0x5e3235=_0x4df7e9?0x0:_0x394614[_0xb147('0x1b')];var _0x107b35=_0x4df7e9?_0x4ab867[_0xb147('0x1e')]:_0x394614['offset']+_0x394614['limit'];var _0x4cd62f;if(_0x107b35>=_0x52af1f){_0x107b35=_0x52af1f;_0x4cd62f=0xc8;}else{_0x4cd62f=0xce;}_0x2a0eeb[_0xb147('0x1a')](_0x4cd62f);return _0x2a0eeb[_0xb147('0x1f')](_0xb147('0x20'),_0x5e3235+'-'+_0x107b35+'/'+_0x52af1f)['json'](_0x4ab867);}return null;};}function patchUpdates(_0x39c15c){return function(_0x84c1ed){try{jsonpatch[_0xb147('0x21')](_0x84c1ed,_0x39c15c,!![]);}catch(_0x45cbe8){return BPromise[_0xb147('0x22')](_0x45cbe8);}return _0x84c1ed['save']();};}function saveUpdates(_0xa85f38,_0xf64527){return function(_0x243523){if(_0x243523){return _0x243523[_0xb147('0x23')](_0xa85f38)[_0xb147('0x24')](function(_0x53ac4b){return _0x53ac4b;});}return null;};}function removeEntity(_0x565acd,_0x203161){return function(_0x98509e){if(_0x98509e){return _0x98509e[_0xb147('0x25')]()[_0xb147('0x24')](function(){_0x565acd['status'](0xcc)[_0xb147('0x26')]();});}};}function handleEntityNotFound(_0x4c5475,_0x5930a5){return function(_0x2b7c3a){if(!_0x2b7c3a){_0x4c5475[_0xb147('0x19')](0x194);}return _0x2b7c3a;};}function handleError(_0x444d58,_0x139057){_0x139057=_0x139057||0x1f4;return function(_0x12c18f){logger[_0xb147('0x27')](_0x12c18f['stack']);if(_0x12c18f['name']){delete _0x12c18f[_0xb147('0x28')];}_0x444d58[_0xb147('0x1a')](_0x139057)['send'](_0x12c18f);};}exports[_0xb147('0x29')]=function(_0x45887f,_0x50f831){var _0x517990={},_0x2b90ef={},_0xe07da5={'count':0x0,'rows':[]};var _0x1ba125=_[_0xb147('0x2a')](db[_0xb147('0x2b')]['rawAttributes'],function(_0x3e6a3c){return{'name':_0x3e6a3c[_0xb147('0x2c')],'type':_0x3e6a3c[_0xb147('0x2d')][_0xb147('0x2e')]};});_0x2b90ef[_0xb147('0x2f')]=_['map'](_0x1ba125,_0xb147('0x28'));_0x2b90ef[_0xb147('0x30')]=_[_0xb147('0x31')](_0x45887f[_0xb147('0x30')]);_0x2b90ef[_0xb147('0x32')]=_[_0xb147('0x33')](_0x2b90ef[_0xb147('0x2f')],_0x2b90ef[_0xb147('0x30')]);_0x517990[_0xb147('0x34')]=_['intersection'](_0x2b90ef[_0xb147('0x2f')],qs[_0xb147('0x35')](_0x45887f[_0xb147('0x30')][_0xb147('0x35')]));_0x517990[_0xb147('0x34')]=_0x517990[_0xb147('0x34')][_0xb147('0x36')]?_0x517990[_0xb147('0x34')]:_0x2b90ef['model'];if(!_0x45887f[_0xb147('0x30')][_0xb147('0x37')](_0xb147('0x38'))){_0x517990[_0xb147('0x1d')]=qs[_0xb147('0x1d')](_0x45887f[_0xb147('0x30')][_0xb147('0x1d')]);_0x517990['offset']=qs[_0xb147('0x1b')](_0x45887f['query'][_0xb147('0x1b')]);}_0x517990[_0xb147('0x39')]=qs['sort'](_0x45887f['query']['sort']);_0x517990[_0xb147('0x3a')]=qs[_0xb147('0x32')](_[_0xb147('0x3b')](_0x45887f[_0xb147('0x30')],_0x2b90ef[_0xb147('0x32')]),_0x1ba125);if(_0x45887f['query'][_0xb147('0x3c')]){_0x517990['where']=_['merge'](_0x517990['where'],{'$or':_[_0xb147('0x2a')](_0x1ba125,function(_0xdbc869){if(_0xdbc869[_0xb147('0x2d')]!==_0xb147('0x3d')){var _0x2fb83d={};_0x2fb83d[_0xdbc869[_0xb147('0x28')]]={'$like':'%'+_0x45887f['query'][_0xb147('0x3c')]+'%'};return _0x2fb83d;}})});}_0x517990=_[_0xb147('0x3e')]({},_0x517990,_0x45887f[_0xb147('0x3f')]);var _0x449412={'where':_0x517990[_0xb147('0x3a')]};return db[_0xb147('0x2b')]['count'](_0x449412)[_0xb147('0x24')](function(_0x22043c){_0xe07da5[_0xb147('0x1e')]=_0x22043c;if(_0x45887f['query'][_0xb147('0x40')]){_0x517990[_0xb147('0x41')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x517990);})['then'](function(_0x40762c){_0xe07da5['rows']=_0x40762c;return _0xe07da5;})['then'](respondWithFilteredResult(_0x50f831,_0x517990))[_0xb147('0x42')](handleError(_0x50f831,null));};exports[_0xb147('0x43')]=function(_0x2fd593,_0x4673cd){var _0x4a7c03={'raw':!![],'where':{'id':_0x2fd593['params']['id']}},_0x3d9358={};_0x3d9358[_0xb147('0x2f')]=_[_0xb147('0x31')](db[_0xb147('0x2b')][_0xb147('0x44')]);_0x3d9358[_0xb147('0x30')]=_[_0xb147('0x31')](_0x2fd593[_0xb147('0x30')]);_0x3d9358[_0xb147('0x32')]=_['intersection'](_0x3d9358[_0xb147('0x2f')],_0x3d9358[_0xb147('0x30')]);_0x4a7c03[_0xb147('0x34')]=_[_0xb147('0x33')](_0x3d9358[_0xb147('0x2f')],qs[_0xb147('0x35')](_0x2fd593['query'][_0xb147('0x35')]));_0x4a7c03['attributes']=_0x4a7c03[_0xb147('0x34')][_0xb147('0x36')]?_0x4a7c03[_0xb147('0x34')]:_0x3d9358[_0xb147('0x2f')];if(_0x2fd593['query'][_0xb147('0x40')]){_0x4a7c03[_0xb147('0x41')]=[{'all':!![]}];}_0x4a7c03=_[_0xb147('0x3e')]({},_0x4a7c03,_0x2fd593['options']);return db[_0xb147('0x2b')]['find'](_0x4a7c03)[_0xb147('0x24')](handleEntityNotFound(_0x4673cd,null))[_0xb147('0x24')](respondWithResult(_0x4673cd,null))[_0xb147('0x42')](handleError(_0x4673cd,null));};exports[_0xb147('0x45')]=function(_0x1d679e,_0x17975d){return db[_0xb147('0x2b')][_0xb147('0x45')](_0x1d679e[_0xb147('0x46')],{})[_0xb147('0x24')](respondWithResult(_0x17975d,0xc9))[_0xb147('0x42')](handleError(_0x17975d,null));};exports[_0xb147('0x23')]=function(_0x37e03b,_0x39e48a){if(_0x37e03b[_0xb147('0x46')]['id']){delete _0x37e03b['body']['id'];}return db[_0xb147('0x2b')][_0xb147('0x47')]({'where':{'id':_0x37e03b[_0xb147('0x48')]['id']}})[_0xb147('0x24')](handleEntityNotFound(_0x39e48a,null))[_0xb147('0x24')](saveUpdates(_0x37e03b['body'],null))[_0xb147('0x24')](respondWithResult(_0x39e48a,null))[_0xb147('0x42')](handleError(_0x39e48a,null));};exports['destroy']=function(_0x2d6c1d,_0x57e700){return db['ChatQueueReport'][_0xb147('0x47')]({'where':{'id':_0x2d6c1d[_0xb147('0x48')]['id']}})['then'](handleEntityNotFound(_0x57e700,null))[_0xb147('0x24')](removeEntity(_0x57e700,null))[_0xb147('0x42')](handleError(_0x57e700,null));};exports[_0xb147('0x49')]=function(_0x3a8363,_0x359940){return db['ChatQueueReport'][_0xb147('0x49')]()[_0xb147('0x24')](respondWithResult(_0x359940,null))[_0xb147('0x42')](handleError(_0x359940,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index d9f2809..59aa9df 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x5c883f,_0x38f092){var _0x4210cc=function(_0x51be71){while(--_0x51be71){_0x5c883f['push'](_0x5c883f['shift']());}};_0x4210cc(++_0x38f092);}(_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 +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x18cebd,_0x5f138f){var _0x4c702f=function(_0x354a87){while(--_0x354a87){_0x18cebd['push'](_0x18cebd['shift']());}};_0x4c702f(++_0x5f138f);}(_0xe706,0xa3));var _0x6e70=function(_0xea25aa,_0x4c3a90){_0xea25aa=_0xea25aa-0x0;var _0x45c7ac=_0xe706[_0xea25aa];return _0x45c7ac;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 069b43d..787e868 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 _0x467a=['raw','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','ChatQueueReport','create','body','options','then','CreateChatQueueReport','UpdateChatQueueReport','update'];(function(_0x21dd3e,_0x31afc5){var _0x281451=function(_0x55707e){while(--_0x55707e){_0x21dd3e['push'](_0x21dd3e['shift']());}};_0x281451(++_0x31afc5);}(_0x467a,0x124));var _0xa467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x467a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa467('0x0'));var util=require('util');var moment=require(_0xa467('0x1'));var BPromise=require(_0xa467('0x2'));var rs=require(_0xa467('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa467('0x4'))['db'];var utils=require(_0xa467('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa467('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa467('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2258bf,_0x52c0ad,_0xca8d9){return new BPromise(function(_0x34dc84,_0x19964f){return client[_0xa467('0x8')](_0x2258bf,_0xca8d9)['then'](function(_0x4bc5ef){logger[_0xa467('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x52c0ad,'request\x20sent');logger[_0xa467('0xa')](_0xa467('0xb'),_0x52c0ad,_0xa467('0xc'),JSON[_0xa467('0xd')](_0x4bc5ef));if(_0x4bc5ef[_0xa467('0xe')]){if(_0x4bc5ef['error'][_0xa467('0xf')]===0x1f4){logger[_0xa467('0xe')](_0xa467('0x10'),_0x52c0ad,_0x4bc5ef[_0xa467('0xe')]['message']);return _0x19964f(_0x4bc5ef[_0xa467('0xe')][_0xa467('0x11')]);}logger[_0xa467('0xe')](_0xa467('0x10'),_0x52c0ad,_0x4bc5ef[_0xa467('0xe')]['message']);return _0x34dc84(_0x4bc5ef[_0xa467('0xe')][_0xa467('0x11')]);}else{logger[_0xa467('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x52c0ad,_0xa467('0xc'));_0x34dc84(_0x4bc5ef[_0xa467('0x12')]['message']);}})[_0xa467('0x13')](function(_0x48599b){logger[_0xa467('0xe')](_0xa467('0x10'),_0x52c0ad,_0x48599b);_0x19964f(_0x48599b);});});}exports['CreateChatQueueReport']=function(_0x44965e){var _0x15730b=this;return new Promise(function(_0x49db82,_0x141344){return db[_0xa467('0x14')][_0xa467('0x15')](_0x44965e[_0xa467('0x16')],{'raw':_0x44965e['options']?_0x44965e[_0xa467('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xa467('0x18')](function(_0x2c0f26){logger[_0xa467('0x9')](_0xa467('0x19'),_0x44965e);logger[_0xa467('0xa')](_0xa467('0x19'),_0x44965e,JSON[_0xa467('0xd')](_0x2c0f26));_0x49db82(_0x2c0f26);})[_0xa467('0x13')](function(_0x309889){logger[_0xa467('0xe')](_0xa467('0x19'),_0x309889[_0xa467('0x11')],_0x44965e);_0x141344(_0x15730b['error'](0x1f4,_0x309889[_0xa467('0x11')]));});});};exports[_0xa467('0x1a')]=function(_0x2c1804){var _0x1e00d0=this;return new Promise(function(_0x364f7f,_0x20a9c9){return db[_0xa467('0x14')][_0xa467('0x1b')](_0x2c1804[_0xa467('0x16')],{'raw':_0x2c1804['options']?_0x2c1804['options'][_0xa467('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c1804['options']?_0x2c1804[_0xa467('0x17')][_0xa467('0x1d')]||null:null,'attributes':_0x2c1804['options']?_0x2c1804[_0xa467('0x17')][_0xa467('0x1e')]||null:null,'limit':_0x2c1804[_0xa467('0x17')]?_0x2c1804[_0xa467('0x17')][_0xa467('0x1f')]||null:null})[_0xa467('0x18')](function(_0xe2301e){logger['info'](_0xa467('0x1a'),_0x2c1804);logger[_0xa467('0xa')](_0xa467('0x1a'),_0x2c1804,JSON[_0xa467('0xd')](_0xe2301e));_0x364f7f(_0xe2301e);})[_0xa467('0x13')](function(_0x20872d){logger[_0xa467('0xe')](_0xa467('0x1a'),_0x20872d[_0xa467('0x11')],_0x2c1804);_0x20a9c9(_0x1e00d0[_0xa467('0xe')](0x1f4,_0x20872d['message']));});});}; \ No newline at end of file +var _0x9563=['client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0xc95ad1,_0x1a1d11){var _0x364dbe=function(_0x320fa9){while(--_0x320fa9){_0xc95ad1['push'](_0xc95ad1['shift']());}};_0x364dbe(++_0x1a1d11);}(_0x9563,0x1e7));var _0x3956=function(_0x123fb3,_0x48e32a){_0x123fb3=_0x123fb3-0x0;var _0x5c3cf6=_0x9563[_0x123fb3];return _0x5c3cf6;};'use strict';var _=require(_0x3956('0x0'));var util=require(_0x3956('0x1'));var moment=require('moment');var BPromise=require(_0x3956('0x2'));var rs=require(_0x3956('0x3'));var fs=require('fs');var Redis=require(_0x3956('0x4'));var db=require(_0x3956('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3956('0x6'));var config=require('../../config/environment');var jayson=require(_0x3956('0x7'));var client=jayson[_0x3956('0x8')][_0x3956('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xba3e4b,_0x47bdbc,_0x234e06){return new BPromise(function(_0xf1e100,_0x2863cd){return client[_0x3956('0xa')](_0xba3e4b,_0x234e06)[_0x3956('0xb')](function(_0x4dd27f){logger['info'](_0x3956('0xc'),_0x47bdbc,_0x3956('0xd'));logger[_0x3956('0xe')](_0x3956('0xf'),_0x47bdbc,'request\x20sent',JSON[_0x3956('0x10')](_0x4dd27f));if(_0x4dd27f[_0x3956('0x11')]){if(_0x4dd27f[_0x3956('0x11')][_0x3956('0x12')]===0x1f4){logger[_0x3956('0x11')](_0x3956('0xc'),_0x47bdbc,_0x4dd27f[_0x3956('0x11')][_0x3956('0x13')]);return _0x2863cd(_0x4dd27f[_0x3956('0x11')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x47bdbc,_0x4dd27f[_0x3956('0x11')][_0x3956('0x13')]);return _0xf1e100(_0x4dd27f['error'][_0x3956('0x13')]);}else{logger[_0x3956('0x14')](_0x3956('0xc'),_0x47bdbc,_0x3956('0xd'));_0xf1e100(_0x4dd27f[_0x3956('0x15')][_0x3956('0x13')]);}})[_0x3956('0x16')](function(_0x458b4a){logger[_0x3956('0x11')](_0x3956('0xc'),_0x47bdbc,_0x458b4a);_0x2863cd(_0x458b4a);});});}exports[_0x3956('0x17')]=function(_0x189e6c){var _0x2dce16=this;return new Promise(function(_0x5e23e5,_0x3a90b2){return db[_0x3956('0x18')][_0x3956('0x19')](_0x189e6c[_0x3956('0x1a')],{'raw':_0x189e6c[_0x3956('0x1b')]?_0x189e6c[_0x3956('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3956('0xb')](function(_0x401aa2){logger['info']('CreateChatQueueReport',_0x189e6c);logger['debug'](_0x3956('0x17'),_0x189e6c,JSON[_0x3956('0x10')](_0x401aa2));_0x5e23e5(_0x401aa2);})['catch'](function(_0x2f9bb5){logger['error'](_0x3956('0x17'),_0x2f9bb5['message'],_0x189e6c);_0x3a90b2(_0x2dce16[_0x3956('0x11')](0x1f4,_0x2f9bb5[_0x3956('0x13')]));});});};exports[_0x3956('0x1c')]=function(_0x1d9163){var _0x31b849=this;return new Promise(function(_0x3f6c2c,_0x5e27fd){return db['ChatQueueReport'][_0x3956('0x1d')](_0x1d9163[_0x3956('0x1a')],{'raw':_0x1d9163['options']?_0x1d9163['options'][_0x3956('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9163[_0x3956('0x1b')]?_0x1d9163['options'][_0x3956('0x1f')]||null:null,'attributes':_0x1d9163[_0x3956('0x1b')]?_0x1d9163[_0x3956('0x1b')][_0x3956('0x20')]||null:null,'limit':_0x1d9163[_0x3956('0x1b')]?_0x1d9163[_0x3956('0x1b')]['limit']||null:null})[_0x3956('0xb')](function(_0x222986){logger[_0x3956('0x14')]('UpdateChatQueueReport',_0x1d9163);logger[_0x3956('0xe')](_0x3956('0x1c'),_0x1d9163,JSON[_0x3956('0x10')](_0x222986));_0x3f6c2c(_0x222986);})['catch'](function(_0x1bc983){logger[_0x3956('0x11')](_0x3956('0x1c'),_0x1bc983[_0x3956('0x13')],_0x1d9163);_0x5e27fd(_0x31b849[_0x3956('0x11')](0x1f4,_0x1bc983[_0x3956('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 7ffdf9c..eeccbd4 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 _0xf882=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id'];(function(_0x4a1883,_0x437f8e){var _0x32e815=function(_0x5e33a3){while(--_0x5e33a3){_0x4a1883['push'](_0x4a1883['shift']());}};_0x32e815(++_0x437f8e);}(_0xf882,0x138));var _0x2f88=function(_0x41df00,_0x2125b7){_0x41df00=_0x41df00-0x0;var _0x4e6378=_0xf882[_0x41df00];return _0x4e6378;};'use strict';var multer=require('multer');var util=require(_0x2f88('0x0'));var path=require('path');var timeout=require(_0x2f88('0x1'));var express=require(_0x2f88('0x2'));var router=express[_0x2f88('0x3')]();var fs_extra=require(_0x2f88('0x4'));var auth=require(_0x2f88('0x5'));var interaction=require(_0x2f88('0x6'));var config=require(_0x2f88('0x7'));var controller=require(_0x2f88('0x8'));router[_0x2f88('0x9')]('/',auth[_0x2f88('0xa')](),controller[_0x2f88('0xb')]);router[_0x2f88('0x9')](_0x2f88('0xc'),auth[_0x2f88('0xa')](),controller[_0x2f88('0xd')]);router[_0x2f88('0x9')]('/:id',auth[_0x2f88('0xa')](),controller['show']);router[_0x2f88('0xe')]('/',auth[_0x2f88('0xa')](),controller[_0x2f88('0xf')]);router[_0x2f88('0x10')](_0x2f88('0x11'),auth['isAuthenticated'](),controller[_0x2f88('0x12')]);router[_0x2f88('0x13')](_0x2f88('0x11'),auth[_0x2f88('0xa')](),controller[_0x2f88('0x14')]);module[_0x2f88('0x15')]=router; \ No newline at end of file +var _0x27e0=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xdc09bf,_0x420749){var _0x4cfaa3=function(_0x1ce7e8){while(--_0x1ce7e8){_0xdc09bf['push'](_0xdc09bf['shift']());}};_0x4cfaa3(++_0x420749);}(_0x27e0,0x1be));var _0x027e=function(_0x50c199,_0x4d8e42){_0x50c199=_0x50c199-0x0;var _0x176f00=_0x27e0[_0x50c199];return _0x176f00;};'use strict';var multer=require('multer');var util=require(_0x027e('0x0'));var path=require(_0x027e('0x1'));var timeout=require(_0x027e('0x2'));var express=require(_0x027e('0x3'));var router=express[_0x027e('0x4')]();var fs_extra=require(_0x027e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x027e('0x6'));var config=require(_0x027e('0x7'));var controller=require(_0x027e('0x8'));router[_0x027e('0x9')]('/',auth[_0x027e('0xa')](),controller[_0x027e('0xb')]);router[_0x027e('0x9')](_0x027e('0xc'),auth[_0x027e('0xa')](),controller[_0x027e('0xd')]);router[_0x027e('0x9')](_0x027e('0xe'),auth[_0x027e('0xa')](),controller[_0x027e('0xf')]);router[_0x027e('0x10')]('/',auth[_0x027e('0xa')](),controller[_0x027e('0x11')]);router[_0x027e('0x12')](_0x027e('0xe'),auth[_0x027e('0xa')](),controller[_0x027e('0x13')]);router[_0x027e('0x14')](_0x027e('0xe'),auth[_0x027e('0xa')](),controller[_0x027e('0x15')]);module[_0x027e('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 1cac293..1f0f945 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x284fd3,_0x21eb0d){var _0x3ad39b=function(_0xcb1752){while(--_0xcb1752){_0x284fd3['push'](_0x284fd3['shift']());}};_0x3ad39b(++_0x21eb0d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x586867,_0x20cdbd){_0x586867=_0x586867-0x0;var _0x1c2237=_0xf4eb[_0x586867];return _0x1c2237;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x720057,_0x2bfc55){var _0x35924b=function(_0x21061d){while(--_0x21061d){_0x720057['push'](_0x720057['shift']());}};_0x35924b(++_0x2bfc55);}(_0x008c,0x188));var _0xc008=function(_0x6e5bf7,_0x2c5d6c){_0x6e5bf7=_0x6e5bf7-0x0;var _0x145f89=_0x008c[_0x6e5bf7];return _0x145f89;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7f660de..8479571 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 _0xc808=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','reject','save','then','destroy','error','stack','name','index','ChatTransferReport','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','length','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x10bf5d,_0x10a3a9){var _0x27f511=function(_0x209cf3){while(--_0x209cf3){_0x10bf5d['push'](_0x10bf5d['shift']());}};_0x27f511(++_0x10a3a9);}(_0xc808,0x97));var _0x8c80=function(_0x219cc1,_0x3d03b5){_0x219cc1=_0x219cc1-0x0;var _0x177034=_0xc808[_0x219cc1];return _0x177034;};'use strict';var emlformat=require(_0x8c80('0x0'));var rimraf=require(_0x8c80('0x1'));var zipdir=require(_0x8c80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c80('0x3'));var moment=require(_0x8c80('0x4'));var BPromise=require(_0x8c80('0x5'));var Mustache=require(_0x8c80('0x6'));var util=require(_0x8c80('0x7'));var path=require(_0x8c80('0x8'));var sox=require(_0x8c80('0x9'));var csv=require(_0x8c80('0xa'));var ejs=require(_0x8c80('0xb'));var fs=require('fs');var fs_extra=require(_0x8c80('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8c80('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8c80('0xe'));var toCsv=require(_0x8c80('0xa'));var querystring=require('querystring');var Papa=require(_0x8c80('0xf'));var Redis=require(_0x8c80('0x10'));var authService=require(_0x8c80('0x11'));var qs=require(_0x8c80('0x12'));var as=require(_0x8c80('0x13'));var hardwareService=require(_0x8c80('0x14'));var logger=require(_0x8c80('0x15'))(_0x8c80('0x16'));var utils=require(_0x8c80('0x17'));var config=require(_0x8c80('0x18'));var licenseUtil=require(_0x8c80('0x19'));var db=require(_0x8c80('0x1a'))['db'];function respondWithStatusCode(_0x1aa841,_0x2432d8){_0x2432d8=_0x2432d8||0xcc;return function(_0x4ed424){if(_0x4ed424){return _0x1aa841[_0x8c80('0x1b')](_0x2432d8);}return _0x1aa841['status'](_0x2432d8)[_0x8c80('0x1c')]();};}function respondWithResult(_0x328a87,_0x46da68){_0x46da68=_0x46da68||0xc8;return function(_0x5a4881){if(_0x5a4881){return _0x328a87['status'](_0x46da68)[_0x8c80('0x1d')](_0x5a4881);}};}function respondWithFilteredResult(_0x374c48,_0xc38cfc){return function(_0x2c01a8){if(_0x2c01a8){var _0x314570=typeof _0xc38cfc['offset']===_0x8c80('0x1e')&&typeof _0xc38cfc[_0x8c80('0x1f')]==='undefined';var _0x401070=_0x2c01a8['count'];var _0x384023=_0x314570?0x0:_0xc38cfc[_0x8c80('0x20')];var _0xe60216=_0x314570?_0x2c01a8[_0x8c80('0x21')]:_0xc38cfc[_0x8c80('0x20')]+_0xc38cfc['limit'];var _0x42f5be;if(_0xe60216>=_0x401070){_0xe60216=_0x401070;_0x42f5be=0xc8;}else{_0x42f5be=0xce;}_0x374c48[_0x8c80('0x22')](_0x42f5be);return _0x374c48[_0x8c80('0x23')](_0x8c80('0x24'),_0x384023+'-'+_0xe60216+'/'+_0x401070)[_0x8c80('0x1d')](_0x2c01a8);}return null;};}function patchUpdates(_0x39bdcb){return function(_0x2d1771){try{jsonpatch['apply'](_0x2d1771,_0x39bdcb,!![]);}catch(_0x56fbb5){return BPromise[_0x8c80('0x25')](_0x56fbb5);}return _0x2d1771[_0x8c80('0x26')]();};}function saveUpdates(_0x103bf7,_0x7bc10){return function(_0x53f225){if(_0x53f225){return _0x53f225['update'](_0x103bf7)[_0x8c80('0x27')](function(_0x355438){return _0x355438;});}return null;};}function removeEntity(_0x5d5d11,_0x48a404){return function(_0x2de3df){if(_0x2de3df){return _0x2de3df[_0x8c80('0x28')]()[_0x8c80('0x27')](function(){_0x5d5d11[_0x8c80('0x22')](0xcc)[_0x8c80('0x1c')]();});}};}function handleEntityNotFound(_0x157bb5,_0x2d8b55){return function(_0xce1986){if(!_0xce1986){_0x157bb5[_0x8c80('0x1b')](0x194);}return _0xce1986;};}function handleError(_0x2005b6,_0x587635){_0x587635=_0x587635||0x1f4;return function(_0x11a075){logger[_0x8c80('0x29')](_0x11a075[_0x8c80('0x2a')]);if(_0x11a075[_0x8c80('0x2b')]){delete _0x11a075['name'];}_0x2005b6[_0x8c80('0x22')](_0x587635)['send'](_0x11a075);};}exports[_0x8c80('0x2c')]=function(_0xa5293b,_0x5d1d4c){var _0x5f297c={},_0x4c267c={},_0x4a4303={'count':0x0,'rows':[]};var _0x48f24c=_['map'](db[_0x8c80('0x2d')][_0x8c80('0x2e')],function(_0x44ca9a){return{'name':_0x44ca9a[_0x8c80('0x2f')],'type':_0x44ca9a['type'][_0x8c80('0x30')]};});_0x4c267c[_0x8c80('0x31')]=_[_0x8c80('0x32')](_0x48f24c,'name');_0x4c267c[_0x8c80('0x33')]=_['keys'](_0xa5293b[_0x8c80('0x33')]);_0x4c267c[_0x8c80('0x34')]=_['intersection'](_0x4c267c[_0x8c80('0x31')],_0x4c267c[_0x8c80('0x33')]);_0x5f297c[_0x8c80('0x35')]=_[_0x8c80('0x36')](_0x4c267c[_0x8c80('0x31')],qs['fields'](_0xa5293b[_0x8c80('0x33')][_0x8c80('0x37')]));_0x5f297c['attributes']=_0x5f297c[_0x8c80('0x35')]['length']?_0x5f297c['attributes']:_0x4c267c[_0x8c80('0x31')];if(!_0xa5293b[_0x8c80('0x33')]['hasOwnProperty'](_0x8c80('0x38'))){_0x5f297c[_0x8c80('0x1f')]=qs['limit'](_0xa5293b['query'][_0x8c80('0x1f')]);_0x5f297c[_0x8c80('0x20')]=qs['offset'](_0xa5293b['query'][_0x8c80('0x20')]);}_0x5f297c[_0x8c80('0x39')]=qs[_0x8c80('0x3a')](_0xa5293b['query'][_0x8c80('0x3a')]);_0x5f297c[_0x8c80('0x3b')]=qs[_0x8c80('0x34')](_['pick'](_0xa5293b[_0x8c80('0x33')],_0x4c267c['filters']),_0x48f24c);if(_0xa5293b[_0x8c80('0x33')]['filter']){_0x5f297c[_0x8c80('0x3b')]=_[_0x8c80('0x3c')](_0x5f297c[_0x8c80('0x3b')],{'$or':_[_0x8c80('0x32')](_0x48f24c,function(_0x4dbb4a){if(_0x4dbb4a[_0x8c80('0x3d')]!==_0x8c80('0x3e')){var _0x4e576c={};_0x4e576c[_0x4dbb4a[_0x8c80('0x2b')]]={'$like':'%'+_0xa5293b[_0x8c80('0x33')][_0x8c80('0x3f')]+'%'};return _0x4e576c;}})});}_0x5f297c=_[_0x8c80('0x3c')]({},_0x5f297c,_0xa5293b[_0x8c80('0x40')]);var _0xa2cb92={'where':_0x5f297c[_0x8c80('0x3b')]};return db[_0x8c80('0x2d')][_0x8c80('0x21')](_0xa2cb92)[_0x8c80('0x27')](function(_0x55a084){_0x4a4303[_0x8c80('0x21')]=_0x55a084;if(_0xa5293b[_0x8c80('0x33')][_0x8c80('0x41')]){_0x5f297c[_0x8c80('0x42')]=[{'all':!![]}];}return db[_0x8c80('0x2d')]['findAll'](_0x5f297c);})[_0x8c80('0x27')](function(_0x1d531b){_0x4a4303[_0x8c80('0x43')]=_0x1d531b;return _0x4a4303;})[_0x8c80('0x27')](respondWithFilteredResult(_0x5d1d4c,_0x5f297c))[_0x8c80('0x44')](handleError(_0x5d1d4c,null));};exports[_0x8c80('0x45')]=function(_0x2662cd,_0x2f0768){var _0x3b99eb={'raw':!![],'where':{'id':_0x2662cd['params']['id']}},_0x2786fd={};_0x2786fd[_0x8c80('0x31')]=_[_0x8c80('0x46')](db[_0x8c80('0x2d')][_0x8c80('0x2e')]);_0x2786fd[_0x8c80('0x33')]=_[_0x8c80('0x46')](_0x2662cd[_0x8c80('0x33')]);_0x2786fd['filters']=_[_0x8c80('0x36')](_0x2786fd[_0x8c80('0x31')],_0x2786fd[_0x8c80('0x33')]);_0x3b99eb['attributes']=_[_0x8c80('0x36')](_0x2786fd[_0x8c80('0x31')],qs[_0x8c80('0x37')](_0x2662cd[_0x8c80('0x33')]['fields']));_0x3b99eb[_0x8c80('0x35')]=_0x3b99eb[_0x8c80('0x35')][_0x8c80('0x47')]?_0x3b99eb['attributes']:_0x2786fd[_0x8c80('0x31')];if(_0x2662cd[_0x8c80('0x33')][_0x8c80('0x41')]){_0x3b99eb[_0x8c80('0x42')]=[{'all':!![]}];}_0x3b99eb=_[_0x8c80('0x3c')]({},_0x3b99eb,_0x2662cd[_0x8c80('0x40')]);return db[_0x8c80('0x2d')][_0x8c80('0x48')](_0x3b99eb)['then'](handleEntityNotFound(_0x2f0768,null))[_0x8c80('0x27')](respondWithResult(_0x2f0768,null))[_0x8c80('0x44')](handleError(_0x2f0768,null));};exports[_0x8c80('0x49')]=function(_0x3d6c7d,_0x457509){return db[_0x8c80('0x2d')][_0x8c80('0x49')](_0x3d6c7d[_0x8c80('0x4a')],{})[_0x8c80('0x27')](respondWithResult(_0x457509,0xc9))[_0x8c80('0x44')](handleError(_0x457509,null));};exports[_0x8c80('0x4b')]=function(_0x4cda3c,_0x387905){if(_0x4cda3c[_0x8c80('0x4a')]['id']){delete _0x4cda3c[_0x8c80('0x4a')]['id'];}return db['ChatTransferReport'][_0x8c80('0x48')]({'where':{'id':_0x4cda3c['params']['id']}})['then'](handleEntityNotFound(_0x387905,null))[_0x8c80('0x27')](saveUpdates(_0x4cda3c[_0x8c80('0x4a')],null))[_0x8c80('0x27')](respondWithResult(_0x387905,null))[_0x8c80('0x44')](handleError(_0x387905,null));};exports[_0x8c80('0x28')]=function(_0x24dc95,_0x44adea){return db[_0x8c80('0x2d')][_0x8c80('0x48')]({'where':{'id':_0x24dc95[_0x8c80('0x4c')]['id']}})[_0x8c80('0x27')](handleEntityNotFound(_0x44adea,null))[_0x8c80('0x27')](removeEntity(_0x44adea,null))[_0x8c80('0x44')](handleError(_0x44adea,null));};exports[_0x8c80('0x4d')]=function(_0x162f36,_0x3e1c8d){return db[_0x8c80('0x2d')][_0x8c80('0x4d')]()['then'](respondWithResult(_0x3e1c8d,null))[_0x8c80('0x44')](handleError(_0x3e1c8d,null));}; \ No newline at end of file +var _0xfa28=['path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','update','then','destroy','stack','name','rawAttributes','fieldName','key','model','map','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ChatTransferReport','rows','show','params','keys','create','body','catch','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x51c231,_0xd81704){var _0x4ea637=function(_0x35eacf){while(--_0x35eacf){_0x51c231['push'](_0x51c231['shift']());}};_0x4ea637(++_0xd81704);}(_0xfa28,0x84));var _0x8fa2=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xfa28[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8fa2('0x0'));var jsonpatch=require(_0x8fa2('0x1'));var rp=require(_0x8fa2('0x2'));var moment=require(_0x8fa2('0x3'));var BPromise=require(_0x8fa2('0x4'));var Mustache=require('mustache');var util=require(_0x8fa2('0x5'));var path=require(_0x8fa2('0x6'));var sox=require(_0x8fa2('0x7'));var csv=require(_0x8fa2('0x8'));var ejs=require(_0x8fa2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8fa2('0xa'));var jsforce=require(_0x8fa2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8fa2('0x8'));var querystring=require(_0x8fa2('0xc'));var Papa=require(_0x8fa2('0xd'));var Redis=require(_0x8fa2('0xe'));var authService=require(_0x8fa2('0xf'));var qs=require(_0x8fa2('0x10'));var as=require(_0x8fa2('0x11'));var hardwareService=require(_0x8fa2('0x12'));var logger=require(_0x8fa2('0x13'))(_0x8fa2('0x14'));var utils=require('../../config/utils');var config=require(_0x8fa2('0x15'));var licenseUtil=require(_0x8fa2('0x16'));var db=require(_0x8fa2('0x17'))['db'];function respondWithStatusCode(_0x1691ac,_0x21f15a){_0x21f15a=_0x21f15a||0xcc;return function(_0x52d153){if(_0x52d153){return _0x1691ac[_0x8fa2('0x18')](_0x21f15a);}return _0x1691ac[_0x8fa2('0x19')](_0x21f15a)[_0x8fa2('0x1a')]();};}function respondWithResult(_0x45aab9,_0x88f396){_0x88f396=_0x88f396||0xc8;return function(_0x59c78c){if(_0x59c78c){return _0x45aab9[_0x8fa2('0x19')](_0x88f396)[_0x8fa2('0x1b')](_0x59c78c);}};}function respondWithFilteredResult(_0x150988,_0x32ee7d){return function(_0x454612){if(_0x454612){var _0x4ec316=typeof _0x32ee7d['offset']==='undefined'&&typeof _0x32ee7d['limit']===_0x8fa2('0x1c');var _0x36945c=_0x454612[_0x8fa2('0x1d')];var _0x4608ee=_0x4ec316?0x0:_0x32ee7d[_0x8fa2('0x1e')];var _0x3de38d=_0x4ec316?_0x454612[_0x8fa2('0x1d')]:_0x32ee7d[_0x8fa2('0x1e')]+_0x32ee7d[_0x8fa2('0x1f')];var _0x595af8;if(_0x3de38d>=_0x36945c){_0x3de38d=_0x36945c;_0x595af8=0xc8;}else{_0x595af8=0xce;}_0x150988['status'](_0x595af8);return _0x150988['set']('Content-Range',_0x4608ee+'-'+_0x3de38d+'/'+_0x36945c)['json'](_0x454612);}return null;};}function patchUpdates(_0x416cac){return function(_0x110d02){try{jsonpatch[_0x8fa2('0x20')](_0x110d02,_0x416cac,!![]);}catch(_0x36d3a8){return BPromise[_0x8fa2('0x21')](_0x36d3a8);}return _0x110d02['save']();};}function saveUpdates(_0x3fce28,_0x26ff73){return function(_0x404c36){if(_0x404c36){return _0x404c36[_0x8fa2('0x22')](_0x3fce28)[_0x8fa2('0x23')](function(_0x440bb8){return _0x440bb8;});}return null;};}function removeEntity(_0x48e7e9,_0x527fb3){return function(_0x407dfb){if(_0x407dfb){return _0x407dfb[_0x8fa2('0x24')]()[_0x8fa2('0x23')](function(){_0x48e7e9['status'](0xcc)[_0x8fa2('0x1a')]();});}};}function handleEntityNotFound(_0x58d1f0,_0x409608){return function(_0x3906e0){if(!_0x3906e0){_0x58d1f0[_0x8fa2('0x18')](0x194);}return _0x3906e0;};}function handleError(_0x1ea073,_0x5b9eeb){_0x5b9eeb=_0x5b9eeb||0x1f4;return function(_0xe010fe){logger['error'](_0xe010fe[_0x8fa2('0x25')]);if(_0xe010fe[_0x8fa2('0x26')]){delete _0xe010fe['name'];}_0x1ea073[_0x8fa2('0x19')](_0x5b9eeb)['send'](_0xe010fe);};}exports['index']=function(_0xdbfb3f,_0x1adec0){var _0x378831={},_0x2ea9f5={},_0x173310={'count':0x0,'rows':[]};var _0x4b5b57=_['map'](db['ChatTransferReport'][_0x8fa2('0x27')],function(_0xbd8b9e){return{'name':_0xbd8b9e[_0x8fa2('0x28')],'type':_0xbd8b9e['type'][_0x8fa2('0x29')]};});_0x2ea9f5[_0x8fa2('0x2a')]=_[_0x8fa2('0x2b')](_0x4b5b57,_0x8fa2('0x26'));_0x2ea9f5[_0x8fa2('0x2c')]=_['keys'](_0xdbfb3f[_0x8fa2('0x2c')]);_0x2ea9f5[_0x8fa2('0x2d')]=_['intersection'](_0x2ea9f5[_0x8fa2('0x2a')],_0x2ea9f5[_0x8fa2('0x2c')]);_0x378831['attributes']=_['intersection'](_0x2ea9f5[_0x8fa2('0x2a')],qs[_0x8fa2('0x2e')](_0xdbfb3f[_0x8fa2('0x2c')][_0x8fa2('0x2e')]));_0x378831[_0x8fa2('0x2f')]=_0x378831[_0x8fa2('0x2f')][_0x8fa2('0x30')]?_0x378831[_0x8fa2('0x2f')]:_0x2ea9f5[_0x8fa2('0x2a')];if(!_0xdbfb3f['query'][_0x8fa2('0x31')](_0x8fa2('0x32'))){_0x378831[_0x8fa2('0x1f')]=qs[_0x8fa2('0x1f')](_0xdbfb3f['query'][_0x8fa2('0x1f')]);_0x378831['offset']=qs[_0x8fa2('0x1e')](_0xdbfb3f[_0x8fa2('0x2c')]['offset']);}_0x378831[_0x8fa2('0x33')]=qs[_0x8fa2('0x34')](_0xdbfb3f[_0x8fa2('0x2c')]['sort']);_0x378831[_0x8fa2('0x35')]=qs[_0x8fa2('0x2d')](_[_0x8fa2('0x36')](_0xdbfb3f['query'],_0x2ea9f5[_0x8fa2('0x2d')]),_0x4b5b57);if(_0xdbfb3f[_0x8fa2('0x2c')][_0x8fa2('0x37')]){_0x378831[_0x8fa2('0x35')]=_[_0x8fa2('0x38')](_0x378831[_0x8fa2('0x35')],{'$or':_[_0x8fa2('0x2b')](_0x4b5b57,function(_0x4559a8){if(_0x4559a8['type']!==_0x8fa2('0x39')){var _0x19811b={};_0x19811b[_0x4559a8[_0x8fa2('0x26')]]={'$like':'%'+_0xdbfb3f[_0x8fa2('0x2c')][_0x8fa2('0x37')]+'%'};return _0x19811b;}})});}_0x378831=_[_0x8fa2('0x38')]({},_0x378831,_0xdbfb3f[_0x8fa2('0x3a')]);var _0x1d7a5c={'where':_0x378831['where']};return db['ChatTransferReport'][_0x8fa2('0x1d')](_0x1d7a5c)[_0x8fa2('0x23')](function(_0x33d9ca){_0x173310[_0x8fa2('0x1d')]=_0x33d9ca;if(_0xdbfb3f[_0x8fa2('0x2c')][_0x8fa2('0x3b')]){_0x378831['include']=[{'all':!![]}];}return db[_0x8fa2('0x3c')]['findAll'](_0x378831);})[_0x8fa2('0x23')](function(_0x40ac11){_0x173310[_0x8fa2('0x3d')]=_0x40ac11;return _0x173310;})[_0x8fa2('0x23')](respondWithFilteredResult(_0x1adec0,_0x378831))['catch'](handleError(_0x1adec0,null));};exports[_0x8fa2('0x3e')]=function(_0x5495e2,_0x331883){var _0x15f40c={'raw':!![],'where':{'id':_0x5495e2[_0x8fa2('0x3f')]['id']}},_0x44fb11={};_0x44fb11[_0x8fa2('0x2a')]=_['keys'](db[_0x8fa2('0x3c')][_0x8fa2('0x27')]);_0x44fb11['query']=_[_0x8fa2('0x40')](_0x5495e2[_0x8fa2('0x2c')]);_0x44fb11[_0x8fa2('0x2d')]=_['intersection'](_0x44fb11[_0x8fa2('0x2a')],_0x44fb11[_0x8fa2('0x2c')]);_0x15f40c[_0x8fa2('0x2f')]=_['intersection'](_0x44fb11[_0x8fa2('0x2a')],qs[_0x8fa2('0x2e')](_0x5495e2[_0x8fa2('0x2c')][_0x8fa2('0x2e')]));_0x15f40c[_0x8fa2('0x2f')]=_0x15f40c['attributes'][_0x8fa2('0x30')]?_0x15f40c[_0x8fa2('0x2f')]:_0x44fb11[_0x8fa2('0x2a')];if(_0x5495e2[_0x8fa2('0x2c')][_0x8fa2('0x3b')]){_0x15f40c['include']=[{'all':!![]}];}_0x15f40c=_[_0x8fa2('0x38')]({},_0x15f40c,_0x5495e2[_0x8fa2('0x3a')]);return db[_0x8fa2('0x3c')]['find'](_0x15f40c)[_0x8fa2('0x23')](handleEntityNotFound(_0x331883,null))[_0x8fa2('0x23')](respondWithResult(_0x331883,null))['catch'](handleError(_0x331883,null));};exports[_0x8fa2('0x41')]=function(_0x38a1c7,_0x368a39){return db[_0x8fa2('0x3c')][_0x8fa2('0x41')](_0x38a1c7[_0x8fa2('0x42')],{})[_0x8fa2('0x23')](respondWithResult(_0x368a39,0xc9))['catch'](handleError(_0x368a39,null));};exports[_0x8fa2('0x22')]=function(_0x25db88,_0x3127bb){if(_0x25db88['body']['id']){delete _0x25db88['body']['id'];}return db[_0x8fa2('0x3c')]['find']({'where':{'id':_0x25db88[_0x8fa2('0x3f')]['id']}})[_0x8fa2('0x23')](handleEntityNotFound(_0x3127bb,null))[_0x8fa2('0x23')](saveUpdates(_0x25db88['body'],null))[_0x8fa2('0x23')](respondWithResult(_0x3127bb,null))[_0x8fa2('0x43')](handleError(_0x3127bb,null));};exports[_0x8fa2('0x24')]=function(_0x358c5d,_0x227b37){return db['ChatTransferReport']['find']({'where':{'id':_0x358c5d[_0x8fa2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x227b37,null))[_0x8fa2('0x23')](removeEntity(_0x227b37,null))['catch'](handleError(_0x227b37,null));};exports[_0x8fa2('0x44')]=function(_0x493a37,_0x171fa7){return db[_0x8fa2('0x3c')][_0x8fa2('0x44')]()[_0x8fa2('0x23')](respondWithResult(_0x171fa7,null))['catch'](handleError(_0x171fa7,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8291c9f..09d5915 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 _0xf6b4=['define','ChatTransferReport','uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0xf3f0cc,_0x5a6ff3){var _0x30935a=function(_0x180114){while(--_0x180114){_0xf3f0cc['push'](_0xf3f0cc['shift']());}};_0x30935a(++_0x5a6ff3);}(_0xf6b4,0xc9));var _0x4f6b=function(_0x178ca4,_0x5aaa16){_0x178ca4=_0x178ca4-0x0;var _0x57f6a8=_0xf6b4[_0x178ca4];return _0x57f6a8;};'use strict';var _=require(_0x4f6b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4f6b('0x1'));var BPromise=require(_0x4f6b('0x2'));var rp=require(_0x4f6b('0x3'));var fs=require('fs');var path=require(_0x4f6b('0x4'));var rimraf=require(_0x4f6b('0x5'));var config=require(_0x4f6b('0x6'));var attributes=require(_0x4f6b('0x7'));module['exports']=function(_0x442265,_0x313c59){return _0x442265[_0x4f6b('0x8')](_0x4f6b('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4f6b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd70c=['../../config/logger','moment','path','rimraf','../../config/environment','./chatTransferReport.attributes','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd70c,0x1d7));var _0xcd70=function(_0x1b767a,_0x1803b1){_0x1b767a=_0x1b767a-0x0;var _0x3f8493=_0xd70c[_0x1b767a];return _0x3f8493;};'use strict';var _=require(_0xcd70('0x0'));var util=require(_0xcd70('0x1'));var logger=require(_0xcd70('0x2'))('api');var moment=require(_0xcd70('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd70('0x4'));var rimraf=require(_0xcd70('0x5'));var config=require(_0xcd70('0x6'));var attributes=require(_0xcd70('0x7'));module['exports']=function(_0x85566d,_0x295298){return _0x85566d['define'](_0xcd70('0x8'),attributes,{'tableName':_0xcd70('0x9'),'paranoid':![],'indexes':[{'name':_0xcd70('0xa'),'fields':[_0xcd70('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index fac8a62..c3e68ed 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 _0xc2fe=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xc2fe,0x149));var _0xec2f=function(_0x3f8261,_0x2a51ec){_0x3f8261=_0x3f8261-0x0;var _0x17a540=_0xc2fe[_0x3f8261];return _0x17a540;};'use strict';var _=require(_0xec2f('0x0'));var util=require(_0xec2f('0x1'));var moment=require('moment');var BPromise=require(_0xec2f('0x2'));var rs=require(_0xec2f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec2f('0x4'))['db'];var utils=require(_0xec2f('0x5'));var logger=require(_0xec2f('0x6'))(_0xec2f('0x7'));var config=require(_0xec2f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xec2f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353971,_0x3ec63b,_0x44b804){return new BPromise(function(_0x5150c1,_0x5e6e4c){return client[_0xec2f('0xa')](_0x353971,_0x44b804)[_0xec2f('0xb')](function(_0x53bfd9){logger['info'](_0xec2f('0xc'),_0x3ec63b,_0xec2f('0xd'));logger[_0xec2f('0xe')](_0xec2f('0xf'),_0x3ec63b,'request\x20sent',JSON[_0xec2f('0x10')](_0x53bfd9));if(_0x53bfd9[_0xec2f('0x11')]){if(_0x53bfd9[_0xec2f('0x11')]['code']===0x1f4){logger[_0xec2f('0x11')](_0xec2f('0xc'),_0x3ec63b,_0x53bfd9['error'][_0xec2f('0x12')]);return _0x5e6e4c(_0x53bfd9[_0xec2f('0x11')][_0xec2f('0x12')]);}logger[_0xec2f('0x11')](_0xec2f('0xc'),_0x3ec63b,_0x53bfd9[_0xec2f('0x11')][_0xec2f('0x12')]);return _0x5150c1(_0x53bfd9[_0xec2f('0x11')]['message']);}else{logger[_0xec2f('0x13')](_0xec2f('0xc'),_0x3ec63b,_0xec2f('0xd'));_0x5150c1(_0x53bfd9[_0xec2f('0x14')][_0xec2f('0x12')]);}})[_0xec2f('0x15')](function(_0x405839){logger[_0xec2f('0x11')](_0xec2f('0xc'),_0x3ec63b,_0x405839);_0x5e6e4c(_0x405839);});});} \ No newline at end of file +var _0x61e0=['request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x1e8fd2,_0x2ab84b){var _0x389a37=function(_0x21fb8c){while(--_0x21fb8c){_0x1e8fd2['push'](_0x1e8fd2['shift']());}};_0x389a37(++_0x2ab84b);}(_0x61e0,0x1b0));var _0x061e=function(_0x4a8ba8,_0x45db4c){_0x4a8ba8=_0x4a8ba8-0x0;var _0xde71d8=_0x61e0[_0x4a8ba8];return _0xde71d8;};'use strict';var _=require(_0x061e('0x0'));var util=require(_0x061e('0x1'));var moment=require(_0x061e('0x2'));var BPromise=require('bluebird');var rs=require(_0x061e('0x3'));var fs=require('fs');var Redis=require(_0x061e('0x4'));var db=require(_0x061e('0x5'))['db'];var utils=require(_0x061e('0x6'));var logger=require(_0x061e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x061e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4560e8,_0xa2c164,_0x4193d4){return new BPromise(function(_0x59fe52,_0xbbf7d5){return client[_0x061e('0x9')](_0x4560e8,_0x4193d4)['then'](function(_0x50d37a){logger[_0x061e('0xa')](_0x061e('0xb'),_0xa2c164,_0x061e('0xc'));logger[_0x061e('0xd')](_0x061e('0xe'),_0xa2c164,_0x061e('0xc'),JSON[_0x061e('0xf')](_0x50d37a));if(_0x50d37a[_0x061e('0x10')]){if(_0x50d37a['error'][_0x061e('0x11')]===0x1f4){logger[_0x061e('0x10')](_0x061e('0xb'),_0xa2c164,_0x50d37a[_0x061e('0x10')][_0x061e('0x12')]);return _0xbbf7d5(_0x50d37a[_0x061e('0x10')]['message']);}logger[_0x061e('0x10')](_0x061e('0xb'),_0xa2c164,_0x50d37a[_0x061e('0x10')][_0x061e('0x12')]);return _0x59fe52(_0x50d37a[_0x061e('0x10')][_0x061e('0x12')]);}else{logger[_0x061e('0xa')](_0x061e('0xb'),_0xa2c164,_0x061e('0xc'));_0x59fe52(_0x50d37a[_0x061e('0x13')]['message']);}})[_0x061e('0x14')](function(_0x1d65be){logger['error'](_0x061e('0xb'),_0xa2c164,_0x1d65be);_0xbbf7d5(_0x1d65be);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2097353..057b907 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 _0x4daa=['show','post','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x271e46,_0x2626ef){var _0x5951df=function(_0x4ce493){while(--_0x4ce493){_0x271e46['push'](_0x271e46['shift']());}};_0x5951df(++_0x2626ef);}(_0x4daa,0x14b));var _0xa4da=function(_0x213f3d,_0x31c31f){_0x213f3d=_0x213f3d-0x0;var _0x238251=_0x4daa[_0x213f3d];return _0x238251;};'use strict';var multer=require(_0xa4da('0x0'));var util=require('util');var path=require(_0xa4da('0x1'));var timeout=require(_0xa4da('0x2'));var express=require('express');var router=express[_0xa4da('0x3')]();var fs_extra=require(_0xa4da('0x4'));var auth=require(_0xa4da('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa4da('0x6'));router[_0xa4da('0x7')]('/',auth[_0xa4da('0x8')](),controller[_0xa4da('0x9')]);router[_0xa4da('0x7')](_0xa4da('0xa'),auth[_0xa4da('0x8')](),controller['describe']);router[_0xa4da('0x7')]('/:id',auth[_0xa4da('0x8')](),controller[_0xa4da('0xb')]);router[_0xa4da('0xc')]('/',auth[_0xa4da('0x8')](),controller['create']);router[_0xa4da('0xd')](_0xa4da('0xe'),auth[_0xa4da('0x8')](),controller[_0xa4da('0xf')]);router[_0xa4da('0x10')](_0xa4da('0xe'),auth[_0xa4da('0x8')](),controller['destroy']);module[_0xa4da('0x11')]=router; \ No newline at end of file +var _0x77d2=['./chatTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e57ac,_0x2e8a28){var _0x5c626f=function(_0x817263){while(--_0x817263){_0x4e57ac['push'](_0x4e57ac['shift']());}};_0x5c626f(++_0x2e8a28);}(_0x77d2,0x138));var _0x277d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x77d2[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x277d('0x0'));var util=require(_0x277d('0x1'));var path=require(_0x277d('0x2'));var timeout=require(_0x277d('0x3'));var express=require(_0x277d('0x4'));var router=express[_0x277d('0x5')]();var fs_extra=require(_0x277d('0x6'));var auth=require(_0x277d('0x7'));var interaction=require(_0x277d('0x8'));var config=require(_0x277d('0x9'));var controller=require(_0x277d('0xa'));router['get']('/',auth[_0x277d('0xb')](),controller[_0x277d('0xc')]);router[_0x277d('0xd')]('/describe',auth['isAuthenticated'](),controller[_0x277d('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x277d('0xf')]);router[_0x277d('0x10')]('/',auth['isAuthenticated'](),controller[_0x277d('0x11')]);router[_0x277d('0x12')](_0x277d('0x13'),auth['isAuthenticated'](),controller[_0x277d('0x14')]);router['delete'](_0x277d('0x13'),auth[_0x277d('0xb')](),controller[_0x277d('0x15')]);module[_0x277d('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 3cf46eb..d4fefb2 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 _0x5618=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','INTEGER','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!','Feedback','star','thumb','input','text','name','onlineForm','parse','setDataValue','stringify','textarea','Comments','getDataValue','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:','Skip','website_alias','bottom_right','alternate','#fafafa'];(function(_0x4975e3,_0xb81a29){var _0x2e8b32=function(_0x14fca6){while(--_0x14fca6){_0x4975e3['push'](_0x4975e3['shift']());}};_0x2e8b32(++_0xb81a29);}(_0x5618,0x143));var _0x8561=function(_0x968d62,_0x8ab40d){_0x968d62=_0x968d62-0x0;var _0x13ee25=_0x5618[_0x968d62];return _0x13ee25;};'use strict';var Sequelize=require(_0x8561('0x0'));var rs=require('randomstring');module[_0x8561('0x1')]={'name':{'type':Sequelize[_0x8561('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'unique':_0x8561('0x3')},'description':{'type':Sequelize[_0x8561('0x2')]},'mapKey':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x5')},'customerAlias':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8561('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'defaultValue':_0x8561('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8561('0x9')]('rounded',_0x8561('0xa')),'defaultValue':_0x8561('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0xc')},'start_chat_button':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0xd')},'header_offline':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0xe')},'download_transcript':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8561('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8561('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0x15')},'placeholderMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x16')},'closingMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x17')},'closingMessageButton':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x18')},'ratingType':{'type':Sequelize['ENUM'](_0x8561('0x19'),_0x8561('0x1a')),'defaultValue':_0x8561('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x8561('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8561('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8561('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x8561('0x1c'),'required':!![]},'props':{'title':_0x8561('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x8561('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8561('0x4'),'type':_0x8561('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x8561('0x1e'))?JSON[_0x8561('0x1f')](this['getDataValue'](_0x8561('0x1e'))):{};},'set':function(_0x6a4e03){return this[_0x8561('0x20')](_0x8561('0x1e'),JSON[_0x8561('0x21')](_0x6a4e03));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x8561('0x21')]({'items':[{'type':_0x8561('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x8561('0x4'),'type':'email'},'variable':null},{'type':_0x8561('0x22'),'config':{'placeholder':_0x8561('0x23')},'props':{'title':_0x8561('0x23'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x8561('0x24')](_0x8561('0x25'))?JSON[_0x8561('0x1f')](this[_0x8561('0x24')]('offlineForm')):{};},'set':function(_0x190986){return this[_0x8561('0x20')]('offlineForm',JSON[_0x8561('0x21')](_0x190986));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8561('0x26')]();}},'autoclose':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8561('0x2')]},'forwardOffline':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8561('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0x27')},'waitingMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x29')},'offlineMessageBody':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x2b')},'sendUnmanaged':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8561('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8561('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8561('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0x2d')},'verticalAlignment':{'type':Sequelize[_0x8561('0xf')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x2e')},'defaultTitle':{'type':Sequelize[_0x8561('0x2')]},'customerAvatar':{'type':Sequelize[_0x8561('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8561('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'defaultValue':_0x8561('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x8561('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8561('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![],'comment':_0x8561('0x31'),'set':function(_0x58d7a0){if(!_0x58d7a0)this[_0x8561('0x20')](_0x8561('0x32'),null);this['setDataValue']('mandatoryDisposition',_0x58d7a0);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8561('0x2')]},'vidaooTopic':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'defaultValue':_0x8561('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x8561('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x8561('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8561('0x11')]}}; \ No newline at end of file +var _0x83a8=['mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb','star','stringify','input','name','getDataValue','parse','onlineForm','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.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x58f42a,_0x582f5c){var _0x249e18=function(_0x456bbe){while(--_0x456bbe){_0x58f42a['push'](_0x58f42a['shift']());}};_0x249e18(++_0x582f5c);}(_0x83a8,0x1b3));var _0x883a=function(_0x3ed717,_0x2b21b5){_0x3ed717=_0x3ed717-0x0;var _0x432599=_0x83a8[_0x3ed717];return _0x432599;};'use strict';var Sequelize=require(_0x883a('0x0'));var rs=require(_0x883a('0x1'));module[_0x883a('0x2')]={'name':{'type':Sequelize[_0x883a('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x883a('0x3')],'allowNull':![],'unique':_0x883a('0x4')},'description':{'type':Sequelize[_0x883a('0x3')]},'mapKey':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x5')},'key':{'type':Sequelize[_0x883a('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x6')},'customerAlias':{'type':Sequelize[_0x883a('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x883a('0x3')],'allowNull':![],'defaultValue':_0x883a('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x883a('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x883a('0x3')],'allowNull':![],'defaultValue':_0x883a('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x883a('0x3')]},'animation':{'type':Sequelize[_0x883a('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x883a('0xa'),'squared'),'defaultValue':_0x883a('0xa')},'header_online':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0xb')},'start_chat_button':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0xc')},'offline_chat_button':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0xd')},'header_offline':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0xe')},'download_transcript':{'type':Sequelize[_0x883a('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x883a('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x883a('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x883a('0x11')]},'closingQuestion':{'type':Sequelize[_0x883a('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x14')},'placeholderMessage':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x16')},'closingMessageButton':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0xd')},'skipMessageButton':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0x17')},'conditionAgreement':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x18')},'ratingType':{'type':Sequelize[_0x883a('0x19')]('star',_0x883a('0x1a')),'defaultValue':_0x883a('0x1b')},'ratingStarsNumber':{'type':Sequelize[_0x883a('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x883a('0x11')],'defaultValue':function(){return JSON[_0x883a('0x1c')]({'items':[{'type':_0x883a('0x1d'),'variable':null,'config':{'placeholder':_0x883a('0x1e'),'type':'text','required':!![]},'props':{'title':_0x883a('0x1e'),'helpText':''}},{'type':_0x883a('0x1d'),'props':{'title':_0x883a('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x883a('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x883a('0x1f')]('onlineForm')?JSON[_0x883a('0x20')](this['getDataValue'](_0x883a('0x21'))):{};},'set':function(_0xa24bb9){return this[_0x883a('0x22')](_0x883a('0x21'),JSON[_0x883a('0x1c')](_0xa24bb9));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x883a('0x1c')]({'items':[{'type':'input','props':{'title':_0x883a('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x883a('0x5'),'type':_0x883a('0x5')},'variable':null},{'type':_0x883a('0x23'),'config':{'placeholder':_0x883a('0x24')},'props':{'title':'Comments','helpText':_0x883a('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0x883a('0x1f')](_0x883a('0x26'))?JSON[_0x883a('0x20')](this[_0x883a('0x1f')](_0x883a('0x26'))):{};},'set':function(_0xde4993){return this[_0x883a('0x22')](_0x883a('0x26'),JSON['stringify'](_0xde4993));}},'token':{'type':Sequelize[_0x883a('0x3')],'defaultValue':function(){return rs[_0x883a('0x27')]();}},'autoclose':{'type':Sequelize[_0x883a('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x883a('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x883a('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x28')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x29')},'offlineMessageSubject':{'type':Sequelize[_0x883a('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x883a('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x883a('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x883a('0x17')},'sendUnmanaged':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x883a('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x883a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x883a('0x11')],'defaultValue':function(){return _0x883a('0x2b');}},'notificationSound':{'type':Sequelize[_0x883a('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x883a('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0x2d')},'verticalAlignment':{'type':Sequelize[_0x883a('0xf')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0x2e')},'defaultTitle':{'type':Sequelize[_0x883a('0x3')]},'customerAvatar':{'type':Sequelize[_0x883a('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x883a('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x883a('0x3')],'allowNull':![],'defaultValue':_0x883a('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x883a('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x883a('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x883a('0x3')],'defaultValue':_0x883a('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x883a('0xf')],'comment':_0x883a('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![],'comment':_0x883a('0x32'),'set':function(_0xc14f15){if(!_0xc14f15)this[_0x883a('0x22')](_0x883a('0x33'),null);this[_0x883a('0x22')](_0x883a('0x34'),_0xc14f15);}},'vidaooEscalation':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x883a('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x883a('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x883a('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x883a('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3e9834a..4965daf 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 _0xeced=['systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','from','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','priority','asc','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','version','format','%s\x20%s','browser','unknown','device','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','MailAccount','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','toPairsIn','mapValues','subjectOffline','offlineMessageSubject','Chat','NotifyMailAccount','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','License','increment','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','referer','virtual','replace','render','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:remove','getAgents','User','bluebird','mustache','util','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','register','client','http','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','params','keys','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','length','rows','removeDispositions','ids','CannedAnswer','getAnswers','findOne','includeAll','addLogo','sitepic','filename','addAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar'];(function(_0x50da13,_0x45915c){var _0x2b5999=function(_0x2b1f7f){while(--_0x2b1f7f){_0x50da13['push'](_0x50da13['shift']());}};_0x2b5999(++_0x45915c);}(_0xeced,0x1e2));var _0xdece=function(_0x3818e8,_0x127a59){_0x3818e8=_0x3818e8-0x0;var _0x4a6a9=_0xeced[_0x3818e8];return _0x4a6a9;};'use strict';var BPromise=require(_0xdece('0x0'));var Mustache=require(_0xdece('0x1'));var util=require(_0xdece('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdece('0x3'));var querystring=require(_0xdece('0x4'));var Redis=require('ioredis');var qs=require(_0xdece('0x5'));var logger=require(_0xdece('0x6'))(_0xdece('0x7'));var config=require(_0xdece('0x8'));var db=require(_0xdece('0x9'))['db'];config['redis']=_[_0xdece('0xa')](config[_0xdece('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdece('0xc'))(new Redis(config[_0xdece('0xb')]));require(_0xdece('0xd'))[_0xdece('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdece('0xf')][_0xdece('0x10')]({'port':0x232c});var client9002=jayson[_0xdece('0xf')][_0xdece('0x10')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x11681b,_0x8001f4,_0x241640,_0x23c623){return new BPromise(function(_0x3150cf,_0x27e1c){var _0x348448=_0x23c623||client;return _0x348448['request'](_0x11681b,_0x241640)['then'](function(_0x3b5660){logger[_0xdece('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x8001f4,'request\x20sent');logger[_0xdece('0x12')](_0xdece('0x13'),_0x8001f4,_0xdece('0x14'),JSON[_0xdece('0x15')](_0x3b5660));if(_0x3b5660[_0xdece('0x16')]){if(_0x3b5660[_0xdece('0x16')]['code']===0x1f4){logger[_0xdece('0x16')](_0xdece('0x17'),_0x8001f4,_0x3b5660[_0xdece('0x16')][_0xdece('0x18')]);return _0x27e1c(_0x3b5660[_0xdece('0x16')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x8001f4,_0x3b5660['error'][_0xdece('0x18')]);return _0x3150cf(_0x3b5660[_0xdece('0x16')]['message']);}else{logger[_0xdece('0x11')](_0xdece('0x17'),_0x8001f4,_0xdece('0x14'));_0x3150cf(_0x3b5660[_0xdece('0x19')][_0xdece('0x18')]);}})[_0xdece('0x1a')](function(_0x112a96){logger[_0xdece('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x8001f4,_0x112a96);_0x27e1c(_0x112a96);});});}function respondWithStatusCode(_0x1fbbac,_0x5b4050){_0x5b4050=_0x5b4050||0xcc;return function(_0x4161b2){if(_0x4161b2){return _0x1fbbac[_0xdece('0x1b')](_0x5b4050);}return _0x1fbbac[_0xdece('0x1c')](_0x5b4050)[_0xdece('0x1d')]();};}function respondWithResult(_0x20e392,_0x3c2945){_0x3c2945=_0x3c2945||0xc8;return function(_0x3d41cc){if(_0x3d41cc){return _0x20e392['status'](_0x3c2945)['json'](_0x3d41cc);}};}function respondWithFilteredResult(_0x1364d9,_0x250da0){return function(_0x4a5ae9){if(_0x4a5ae9){var _0x20f2cf=typeof _0x250da0[_0xdece('0x1e')]===_0xdece('0x1f')&&typeof _0x250da0[_0xdece('0x20')]===_0xdece('0x1f');var _0x1c0ca9=_0x4a5ae9[_0xdece('0x21')];var _0x53c9e0=_0x20f2cf?0x0:_0x250da0['offset'];var _0x5da62a=_0x20f2cf?_0x4a5ae9[_0xdece('0x21')]:_0x250da0['offset']+_0x250da0[_0xdece('0x20')];var _0x359a4e;if(_0x5da62a>=_0x1c0ca9){_0x5da62a=_0x1c0ca9;_0x359a4e=0xc8;}else{_0x359a4e=0xce;}_0x1364d9['status'](_0x359a4e);return _0x1364d9[_0xdece('0x22')](_0xdece('0x23'),_0x53c9e0+'-'+_0x5da62a+'/'+_0x1c0ca9)[_0xdece('0x24')](_0x4a5ae9);}return null;};}function saveUpdates(_0x567424){return function(_0x10868a){if(_0x10868a){return _0x10868a[_0xdece('0x25')](_0x567424)['then'](function(_0x20d463){return _0x20d463;});}return null;};}function removeEntity(_0x4332c3){return function(_0xd5db4a){if(_0xd5db4a){return _0xd5db4a[_0xdece('0x26')]()[_0xdece('0x27')](function(){var _0x728843=_0xd5db4a[_0xdece('0x28')]({'plain':!![]});var _0x427e0f=_0xdece('0x29');return db[_0xdece('0x2a')][_0xdece('0x26')]({'where':{'type':_0x427e0f,'resourceId':_0x728843['id']}})[_0xdece('0x27')](function(){return _0xd5db4a;});})['then'](function(){_0x4332c3[_0xdece('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x520486){return function(_0x2d6bcb){if(!_0x2d6bcb){_0x520486[_0xdece('0x1b')](0x194);}return _0x2d6bcb;};}function handleError(_0x5af92e,_0x48a438){_0x48a438=_0x48a438||0x1f4;return function(_0x3b893e){logger['error'](_0x3b893e[_0xdece('0x2b')]);if(_0x3b893e['name']){delete _0x3b893e[_0xdece('0x2c')];}_0x5af92e[_0xdece('0x1c')](_0x48a438)['send'](_0x3b893e);};}exports[_0xdece('0x2d')]=function(_0x3ab930,_0x250520){var _0x251162={'include':[{'model':db[_0xdece('0x2e')],'as':_0xdece('0x2f')}]},_0x11b2ae={},_0x166c6b={'count':0x0,'rows':[]};var _0x4d3ed2=_[_0xdece('0x30')](db[_0xdece('0x31')][_0xdece('0x32')],function(_0x5d4c43){return{'name':_0x5d4c43[_0xdece('0x33')],'type':_0x5d4c43[_0xdece('0x34')][_0xdece('0x35')]};});_0x11b2ae[_0xdece('0x36')]=_[_0xdece('0x30')](_0x4d3ed2,_0xdece('0x2c'));_0x11b2ae[_0xdece('0x37')]=_['keys'](_0x3ab930[_0xdece('0x37')]);_0x11b2ae[_0xdece('0x38')]=_['intersection'](_0x11b2ae[_0xdece('0x36')],_0x11b2ae[_0xdece('0x37')]);_0x251162[_0xdece('0x39')]=_[_0xdece('0x3a')](_0x11b2ae[_0xdece('0x36')],qs['fields'](_0x3ab930[_0xdece('0x37')]['fields']));_0x251162[_0xdece('0x39')]=_0x251162[_0xdece('0x39')]['length']?_0x251162[_0xdece('0x39')]:_0x11b2ae[_0xdece('0x36')];if(!_0x3ab930['query'][_0xdece('0x3b')](_0xdece('0x3c'))){_0x251162[_0xdece('0x20')]=qs[_0xdece('0x20')](_0x3ab930[_0xdece('0x37')][_0xdece('0x20')]);_0x251162[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x3ab930[_0xdece('0x37')][_0xdece('0x1e')]);}_0x251162[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x3ab930[_0xdece('0x37')][_0xdece('0x3e')]);_0x251162[_0xdece('0x3f')]=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x3ab930[_0xdece('0x37')],_0x11b2ae['filters']),_0x4d3ed2);if(_0x3ab930[_0xdece('0x37')]['filter']){_0x251162['where']=_[_0xdece('0x41')](_0x251162['where'],{'$or':_[_0xdece('0x30')](_0x4d3ed2,function(_0x12f2a0){if(_0x12f2a0[_0xdece('0x34')]!==_0xdece('0x42')){var _0x65b829={};_0x65b829[_0x12f2a0['name']]={'$like':'%'+_0x3ab930['query'][_0xdece('0x43')]+'%'};return _0x65b829;}})});}_0x251162=_[_0xdece('0x41')]({},_0x251162,_0x3ab930[_0xdece('0x44')]);var _0x2da674={'where':_0x251162[_0xdece('0x3f')]};return db[_0xdece('0x31')][_0xdece('0x21')](_0x2da674)[_0xdece('0x27')](function(_0x16b2a2){_0x166c6b[_0xdece('0x21')]=_0x16b2a2;if(_0x3ab930[_0xdece('0x37')]['includeAll']){_0x251162[_0xdece('0x45')]=[{'all':!![]}];}return db[_0xdece('0x31')][_0xdece('0x46')](_0x251162);})[_0xdece('0x27')](function(_0x1ec133){_0x166c6b['rows']=_0x1ec133;return _0x166c6b;})[_0xdece('0x27')](respondWithFilteredResult(_0x250520,_0x251162))['catch'](handleError(_0x250520,null));};exports['show']=function(_0x423396,_0x244bbb){var _0x2aff03={'raw':![],'where':{'id':_0x423396[_0xdece('0x47')]['id']},'include':[{'model':db[_0xdece('0x2e')],'as':_0xdece('0x2f')}]},_0x206f1e={};_0x206f1e[_0xdece('0x36')]=_['keys'](db[_0xdece('0x31')][_0xdece('0x32')]);_0x206f1e['query']=_[_0xdece('0x48')](_0x423396[_0xdece('0x37')]);_0x206f1e[_0xdece('0x38')]=_['intersection'](_0x206f1e[_0xdece('0x36')],_0x206f1e[_0xdece('0x37')]);_0x2aff03['attributes']=_['intersection'](_0x206f1e['model'],qs[_0xdece('0x49')](_0x423396[_0xdece('0x37')][_0xdece('0x49')]));_0x2aff03[_0xdece('0x39')]=_0x2aff03['attributes']['length']?_0x2aff03[_0xdece('0x39')]:_0x206f1e[_0xdece('0x36')];if(_0x423396['query']['includeAll']){_0x2aff03['include']=[{'all':!![]}];}_0x2aff03=_[_0xdece('0x41')]({},_0x2aff03,_0x423396[_0xdece('0x44')]);return db[_0xdece('0x31')]['find'](_0x2aff03)[_0xdece('0x27')](handleEntityNotFound(_0x244bbb,null))[_0xdece('0x27')](respondWithResult(_0x244bbb,null))[_0xdece('0x1a')](handleError(_0x244bbb,null));};exports[_0xdece('0x4a')]=function(_0x3d2b32,_0x3718e3){return db[_0xdece('0x31')][_0xdece('0x4a')](_0x3d2b32[_0xdece('0x4b')],{})[_0xdece('0x27')](function(_0x195bcf){var _0x2b1c5d=_0x3d2b32[_0xdece('0x4c')][_0xdece('0x28')]({'plain':!![]});if(!_0x2b1c5d)throw new Error(_0xdece('0x4d'));if(_0x2b1c5d[_0xdece('0x4e')]===_0xdece('0x4c')){var _0x23d4a7=_0x195bcf[_0xdece('0x28')]({'plain':!![]});var _0x3b4631=_0xdece('0x29');return db['UserProfileSection'][_0xdece('0x4f')]({'where':{'name':_0x3b4631,'userProfileId':_0x2b1c5d[_0xdece('0x50')]},'raw':!![]})[_0xdece('0x27')](function(_0x50a042){if(_0x50a042&&_0x50a042[_0xdece('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x23d4a7['name'],'resourceId':_0x23d4a7['id'],'type':_0x50a042[_0xdece('0x2c')],'sectionId':_0x50a042['id']},{})[_0xdece('0x27')](function(){return _0x195bcf;});}else{return _0x195bcf;}})[_0xdece('0x1a')](function(_0x43402f){logger[_0xdece('0x16')](_0xdece('0x52'),_0x43402f);throw _0x43402f;});}return _0x195bcf;})[_0xdece('0x27')](respondWithResult(_0x3718e3,0xc9))[_0xdece('0x1a')](handleError(_0x3718e3,null));};exports['update']=function(_0x3f7a46,_0x2f555e){if(_0x3f7a46[_0xdece('0x4b')]['id']){delete _0x3f7a46[_0xdece('0x4b')]['id'];}return db[_0xdece('0x31')]['find']({'where':{'id':_0x3f7a46['params']['id']},'include':[{'model':db[_0xdece('0x2e')],'as':_0xdece('0x2f')}]})[_0xdece('0x27')](handleEntityNotFound(_0x2f555e,null))[_0xdece('0x27')](saveUpdates(_0x3f7a46['body'],null))[_0xdece('0x27')](respondWithResult(_0x2f555e,null))[_0xdece('0x1a')](handleError(_0x2f555e,null));};exports['destroy']=function(_0x4f0256,_0x4fbed4){return db['ChatWebsite'][_0xdece('0x4f')]({'where':{'id':_0x4f0256['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x4fbed4,null))[_0xdece('0x27')](removeEntity(_0x4fbed4,null))['catch'](handleError(_0x4fbed4,null));};exports[_0xdece('0x53')]=function(_0x2f9aff,_0x381209){return db[_0xdece('0x31')][_0xdece('0x53')]()['then'](respondWithResult(_0x381209,null))[_0xdece('0x1a')](handleError(_0x381209,null));};exports[_0xdece('0x54')]=function(_0x49d1ef,_0x50642b){if(_0x49d1ef[_0xdece('0x4b')]['id']){delete _0x49d1ef[_0xdece('0x4b')]['id'];}return db[_0xdece('0x31')][_0xdece('0x4f')]({'where':{'id':_0x49d1ef[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x50642b,null))['then'](function(_0x339f41){if(_0x339f41){_0x49d1ef[_0xdece('0x4b')][_0xdece('0x55')]=_0x339f41['id'];return db['Disposition']['create'](_0x49d1ef['body']);}})[_0xdece('0x27')](respondWithResult(_0x50642b,null))[_0xdece('0x1a')](handleError(_0x50642b,null));};exports[_0xdece('0x56')]=function(_0x48f53c,_0x408ce3){var _0x38adb8={'raw':![],'where':{}};var _0x566f00={};var _0x3a7d5e={'count':0x0,'rows':[]};return db[_0xdece('0x31')]['findOne']({'where':{'id':_0x48f53c[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x408ce3,null))[_0xdece('0x27')](function(_0x4d805c){if(_0x4d805c){_0x566f00[_0xdece('0x36')]=_['keys'](db[_0xdece('0x57')]['rawAttributes']);_0x566f00[_0xdece('0x37')]=_[_0xdece('0x48')](_0x48f53c[_0xdece('0x37')]);_0x566f00['filters']=_[_0xdece('0x3a')](_0x566f00[_0xdece('0x36')],_0x566f00[_0xdece('0x37')]);_0x38adb8[_0xdece('0x39')]=_['intersection'](_0x566f00[_0xdece('0x36')],qs['fields'](_0x48f53c[_0xdece('0x37')][_0xdece('0x49')]));_0x38adb8['attributes']=_0x38adb8[_0xdece('0x39')][_0xdece('0x58')]?_0x38adb8[_0xdece('0x39')]:_0x566f00[_0xdece('0x36')];if(!_0x48f53c[_0xdece('0x37')]['hasOwnProperty'](_0xdece('0x3c'))){_0x38adb8['limit']=qs[_0xdece('0x20')](_0x48f53c['query']['limit']);_0x38adb8[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x48f53c[_0xdece('0x37')][_0xdece('0x1e')]);}_0x38adb8[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x48f53c['query'][_0xdece('0x3e')]);_0x38adb8['where']=qs[_0xdece('0x38')](_['pick'](_0x48f53c['query'],_0x566f00[_0xdece('0x38')]));_0x38adb8[_0xdece('0x3f')][_0xdece('0x55')]=_0x4d805c['id'];if(_0x48f53c[_0xdece('0x37')][_0xdece('0x43')]){_0x38adb8['where']=_['merge'](_0x38adb8[_0xdece('0x3f')],{'$or':_[_0xdece('0x30')](_0x38adb8[_0xdece('0x39')],function(_0x1a5e08){var _0x4da96b={};_0x4da96b[_0x1a5e08]={'$like':'%'+_0x48f53c[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x4da96b;})});}_0x38adb8=_['merge']({},_0x38adb8,_0x48f53c['options']);return db[_0xdece('0x57')]['count']({'where':_0x38adb8[_0xdece('0x3f')]})[_0xdece('0x27')](function(_0x221611){_0x3a7d5e['count']=_0x221611;if(_0x48f53c[_0xdece('0x37')]['includeAll']){_0x38adb8[_0xdece('0x45')]=[{'all':!![]}];}return db[_0xdece('0x57')][_0xdece('0x46')](_0x38adb8);})[_0xdece('0x27')](function(_0x1d919d){_0x3a7d5e[_0xdece('0x59')]=_0x1d919d;return _0x3a7d5e;});}})[_0xdece('0x27')](respondWithFilteredResult(_0x408ce3,_0x38adb8))[_0xdece('0x1a')](handleError(_0x408ce3,null));};exports[_0xdece('0x5a')]=function(_0x597581,_0x575e6e){return db[_0xdece('0x31')][_0xdece('0x4f')]({'where':{'id':_0x597581[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x575e6e,null))[_0xdece('0x27')](function(_0x17ef37){if(_0x17ef37){return _0x17ef37[_0xdece('0x5a')](_0x597581[_0xdece('0x37')][_0xdece('0x5b')]);}})[_0xdece('0x27')](respondWithStatusCode(_0x575e6e,null))[_0xdece('0x1a')](handleError(_0x575e6e,null));};exports['addAnswer']=function(_0x50044d,_0xb9d6b7){if(_0x50044d[_0xdece('0x4b')]['id']){delete _0x50044d[_0xdece('0x4b')]['id'];}return db['ChatWebsite'][_0xdece('0x4f')]({'where':{'id':_0x50044d['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0xb9d6b7,null))[_0xdece('0x27')](function(_0x253338){if(_0x253338){_0x50044d[_0xdece('0x4b')][_0xdece('0x55')]=_0x253338['id'];return db[_0xdece('0x5c')]['create'](_0x50044d[_0xdece('0x4b')]);}})['then'](respondWithResult(_0xb9d6b7,null))[_0xdece('0x1a')](handleError(_0xb9d6b7,null));};exports[_0xdece('0x5d')]=function(_0x45c875,_0x33f8fe){var _0x205ef4={'raw':![],'where':{}};var _0x9fd0fb={};var _0x269fd8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xdece('0x5e')]({'where':{'id':_0x45c875[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x33f8fe,null))[_0xdece('0x27')](function(_0xb4ce56){if(_0xb4ce56){_0x9fd0fb['model']=_['keys'](db['CannedAnswer'][_0xdece('0x32')]);_0x9fd0fb[_0xdece('0x37')]=_[_0xdece('0x48')](_0x45c875[_0xdece('0x37')]);_0x9fd0fb[_0xdece('0x38')]=_[_0xdece('0x3a')](_0x9fd0fb[_0xdece('0x36')],_0x9fd0fb[_0xdece('0x37')]);_0x205ef4[_0xdece('0x39')]=_['intersection'](_0x9fd0fb[_0xdece('0x36')],qs[_0xdece('0x49')](_0x45c875[_0xdece('0x37')][_0xdece('0x49')]));_0x205ef4[_0xdece('0x39')]=_0x205ef4[_0xdece('0x39')][_0xdece('0x58')]?_0x205ef4[_0xdece('0x39')]:_0x9fd0fb[_0xdece('0x36')];if(!_0x45c875[_0xdece('0x37')]['hasOwnProperty'](_0xdece('0x3c'))){_0x205ef4[_0xdece('0x20')]=qs['limit'](_0x45c875['query'][_0xdece('0x20')]);_0x205ef4['offset']=qs[_0xdece('0x1e')](_0x45c875[_0xdece('0x37')][_0xdece('0x1e')]);}_0x205ef4[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x45c875[_0xdece('0x37')][_0xdece('0x3e')]);_0x205ef4[_0xdece('0x3f')]=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x45c875[_0xdece('0x37')],_0x9fd0fb[_0xdece('0x38')]));_0x205ef4[_0xdece('0x3f')][_0xdece('0x55')]=_0xb4ce56['id'];if(_0x45c875[_0xdece('0x37')]['filter']){_0x205ef4[_0xdece('0x3f')]=_[_0xdece('0x41')](_0x205ef4[_0xdece('0x3f')],{'$or':_[_0xdece('0x30')](_0x205ef4[_0xdece('0x39')],function(_0x542f0c){var _0x1e9bc1={};_0x1e9bc1[_0x542f0c]={'$like':'%'+_0x45c875[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x1e9bc1;})});}_0x205ef4=_[_0xdece('0x41')]({},_0x205ef4,_0x45c875['options']);return db['CannedAnswer'][_0xdece('0x21')]({'where':_0x205ef4[_0xdece('0x3f')]})[_0xdece('0x27')](function(_0x35ad45){_0x269fd8[_0xdece('0x21')]=_0x35ad45;if(_0x45c875['query'][_0xdece('0x5f')]){_0x205ef4[_0xdece('0x45')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x205ef4);})[_0xdece('0x27')](function(_0x106ba2){_0x269fd8[_0xdece('0x59')]=_0x106ba2;return _0x269fd8;});}})[_0xdece('0x27')](respondWithFilteredResult(_0x33f8fe,_0x205ef4))['catch'](handleError(_0x33f8fe,null));};exports['removeAnswers']=function(_0x2021c3,_0x384a67){return db[_0xdece('0x31')]['find']({'where':{'id':_0x2021c3[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x384a67,null))[_0xdece('0x27')](function(_0x20fa84){if(_0x20fa84){return _0x20fa84['removeAnswers'](_0x2021c3['query']['ids']);}})[_0xdece('0x27')](respondWithStatusCode(_0x384a67,null))['catch'](handleError(_0x384a67,null));};exports[_0xdece('0x60')]=function(_0x1e619f,_0x2128bf){_0x1e619f['body'][_0xdece('0x61')]=_0x1e619f['file'][_0xdece('0x62')];return db[_0xdece('0x31')][_0xdece('0x4f')]({'where':{'id':_0x1e619f[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x2128bf,null))[_0xdece('0x27')](saveUpdates(_0x1e619f['body'],null))[_0xdece('0x27')](respondWithResult(_0x2128bf,null))[_0xdece('0x1a')](handleError(_0x2128bf,null));};exports[_0xdece('0x63')]=function(_0x31e56d,_0x5ee7ad){_0x31e56d[_0xdece('0x4b')]['agentAvatar']=_0x31e56d[_0xdece('0x64')][_0xdece('0x62')];return db[_0xdece('0x31')]['find']({'where':{'id':_0x31e56d['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x5ee7ad,null))[_0xdece('0x27')](saveUpdates(_0x31e56d['body'],null))[_0xdece('0x27')](respondWithResult(_0x5ee7ad,null))[_0xdece('0x1a')](handleError(_0x5ee7ad,null));};exports[_0xdece('0x65')]=function(_0x234a51,_0x2fdfaa){_0x234a51[_0xdece('0x4b')][_0xdece('0x66')]=_0x234a51[_0xdece('0x64')][_0xdece('0x62')];return db[_0xdece('0x31')][_0xdece('0x4f')]({'where':{'id':_0x234a51[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x2fdfaa,null))[_0xdece('0x27')](saveUpdates(_0x234a51[_0xdece('0x4b')],null))[_0xdece('0x27')](respondWithResult(_0x2fdfaa,null))[_0xdece('0x1a')](handleError(_0x2fdfaa,null));};exports[_0xdece('0x67')]=function(_0x105ac4,_0x29a28e){_0x105ac4[_0xdece('0x4b')][_0xdece('0x68')]=_0x105ac4[_0xdece('0x64')][_0xdece('0x62')];return db[_0xdece('0x31')]['find']({'where':{'id':_0x105ac4[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x29a28e,null))['then'](saveUpdates(_0x105ac4[_0xdece('0x4b')],null))[_0xdece('0x27')](respondWithResult(_0x29a28e,null))[_0xdece('0x1a')](handleError(_0x29a28e,null));};exports[_0xdece('0x69')]=function(_0x31b2f3,_0x40eab5){var _0xf73dfa=path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0x6c'));var _0x2623c9={'where':{'id':_0x31b2f3[_0xdece('0x47')]['id']},'attributes':['id',_0xdece('0x61')],'raw':!![]};var _0x2fc86e=![];return require(_0xdece('0x6d'))[_0xdece('0x6e')]()[_0xdece('0x27')](function(_0x544e3a){if(_0x544e3a){_0x2fc86e=_0x544e3a[_0xdece('0x6f')];}})[_0xdece('0x27')](function(){return db[_0xdece('0x31')][_0xdece('0x4f')](_0x2623c9);})[_0xdece('0x27')](handleEntityNotFound(_0x40eab5,null))[_0xdece('0x27')](function(_0x59aa56){if(_0x59aa56){if(!_[_0xdece('0x70')](_0x59aa56[_0xdece('0x61')])){if(fs[_0xdece('0x71')](path[_0xdece('0x6a')](config['root'],_0xdece('0x72'),_0x59aa56[_0xdece('0x61')]))&&_0x2fc86e){_0xf73dfa=path[_0xdece('0x6a')](config['root'],_0xdece('0x72'),_0x59aa56[_0xdece('0x61')]);}}return _0x40eab5[_0xdece('0x73')](_0xf73dfa);}})[_0xdece('0x1a')](handleError(_0x40eab5,null));};exports[_0xdece('0x74')]=function(_0x1c09c6,_0x463500){var _0x4bb690=path[_0xdece('0x6a')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x4cd003={'where':{'id':_0x1c09c6['params']['id']},'attributes':['id',_0xdece('0x75')],'raw':!![]};return db['ChatWebsite'][_0xdece('0x4f')](_0x4cd003)['then'](handleEntityNotFound(_0x463500,null))[_0xdece('0x27')](function(_0x322f91){if(_0x322f91){if(!_[_0xdece('0x70')](_0x322f91['agentAvatar'])){if(fs[_0xdece('0x71')](path[_0xdece('0x6a')](config['root'],_0xdece('0x76'),_0x322f91[_0xdece('0x75')]))){_0x4bb690=path[_0xdece('0x6a')](config['root'],'server/files/images/avatars/',_0x322f91[_0xdece('0x75')]);}}return _0x463500[_0xdece('0x73')](_0x4bb690);}})[_0xdece('0x1a')](handleError(_0x463500,null));};exports[_0xdece('0x77')]=function(_0x4e61cf,_0xd178ec){var _0x5f15f5=path['join'](config[_0xdece('0x6b')],_0xdece('0x78'));var _0x37d86b={'where':{'id':_0x4e61cf[_0xdece('0x47')]['id']},'attributes':['id',_0xdece('0x66'),_0xdece('0x79')],'raw':!![]};return db[_0xdece('0x31')][_0xdece('0x4f')](_0x37d86b)['then'](handleEntityNotFound(_0xd178ec,null))[_0xdece('0x27')](function(_0x15f2d6){if(_0x15f2d6){if(!_['isNil'](_0x15f2d6[_0xdece('0x66')])){if(fs['existsSync'](path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0x76'),_0x15f2d6['customerAvatar']))&&_0x15f2d6[_0xdece('0x79')]){_0x5f15f5=path[_0xdece('0x6a')](config['root'],_0xdece('0x76'),_0x15f2d6[_0xdece('0x66')]);}}return _0xd178ec[_0xdece('0x73')](_0x5f15f5);}})['catch'](handleError(_0xd178ec,null));};exports['getSystemAvatar']=function(_0x2b2bf7,_0xfd14dd){var _0x261908=path[_0xdece('0x6a')](config[_0xdece('0x6b')],'server/files/images/avatars/system_avatar.png');var _0x396974={'where':{'id':_0x2b2bf7[_0xdece('0x47')]['id']},'attributes':['id',_0xdece('0x68')],'raw':!![]};return db[_0xdece('0x31')]['find'](_0x396974)[_0xdece('0x27')](handleEntityNotFound(_0xfd14dd,null))[_0xdece('0x27')](function(_0x196167){if(_0x196167){if(!_[_0xdece('0x70')](_0x196167[_0xdece('0x68')])){if(fs[_0xdece('0x71')](path[_0xdece('0x6a')](config[_0xdece('0x6b')],'server/files/images/avatars/',_0x196167[_0xdece('0x68')]))){_0x261908=path[_0xdece('0x6a')](config['root'],_0xdece('0x76'),_0x196167[_0xdece('0x68')]);}}return _0xfd14dd[_0xdece('0x73')](_0x261908);}})['catch'](handleError(_0xfd14dd,null));};exports['notify']=function(_0x534ad7,_0x4bba23){var _0x5ccf62=require('user-agent-parser');var _0x40d4f0=new _0x5ccf62();var _0xd1c76=_0x40d4f0['setUA'](_0x534ad7[_0xdece('0x7a')][_0xdece('0x7b')])[_0xdece('0x7c')]();var _0x485efa={'body':_0x534ad7['body'],'channel':_0xdece('0x7d')};var _0xe14b6e=[];var _0x2838e6=[];var _0x480db5={};var _0x38c3b9=![];return db[_0xdece('0x7e')][_0xdece('0x53')]()[_0xdece('0x27')](function(_0x4393ef){if(!_0x4393ef){throw new db['Sequelize'][(_0xdece('0x7f'))](_0xdece('0x80'));}_0xe14b6e=_['difference'](_[_0xdece('0x48')](_0x4393ef),['createdAt',_0xdece('0x81')]);_0x2838e6=_[_0xdece('0x82')](_['keys'](_0x4393ef),['createdAt','updatedAt',_0xdece('0x83'),'ListId']);if(_0x534ad7[_0xdece('0x4b')]['id']){delete _0x534ad7[_0xdece('0x4b')]['id'];}if(_[_0xdece('0x70')](_0x534ad7[_0xdece('0x4b')][_0xdece('0x84')])){throw new db[(_0xdece('0x85'))][(_0xdece('0x7f'))]('from\x20is\x20mandatory');}if(_[_0xdece('0x70')](_0x534ad7[_0xdece('0x4b')][_0xdece('0x4b')])||_0x534ad7[_0xdece('0x4b')][_0xdece('0x4b')]===''){throw new db[(_0xdece('0x85'))][(_0xdece('0x7f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdece('0x70')](_0x534ad7['body'][_0xdece('0x86')])){throw new db[(_0xdece('0x85'))][(_0xdece('0x7f'))](_0xdece('0x87')+_0x2838e6);}if(!_['includes'](_0x2838e6,_0x534ad7[_0xdece('0x4b')]['mapKey'])){throw new db['Sequelize'][(_0xdece('0x7f'))](_0xdece('0x88')+_0x2838e6);}_0x480db5[_0x534ad7[_0xdece('0x4b')][_0xdece('0x86')]]=_0x534ad7[_0xdece('0x4b')][_0xdece('0x84')];})[_0xdece('0x27')](function(){return db['ChatWebsite'][_0xdece('0x4f')]({'where':{'id':_0x534ad7[_0xdece('0x47')]['id']},'include':[{'model':db[_0xdece('0x89')],'as':_0xdece('0x8a'),'include':[{'model':db['CmContact'],'as':_0xdece('0x8b'),'where':_0x480db5,'limit':0x1,'order':[['updatedAt',_0xdece('0x8c')]]}]},{'model':db['ChatApplication'],'as':_0xdece('0x8d')}]});})[_0xdece('0x27')](handleEntityNotFound(_0x4bba23,null))[_0xdece('0x27')](function(_0x9e438a){if(_0x9e438a&&_0x9e438a[_0xdece('0x8a')]){_0x485efa[_0xdece('0x8e')]=_0x9e438a;_0x485efa[_0xdece('0x8f')]=_0x9e438a['Applications'];_0x485efa['list']=_0x9e438a['List'];_0x485efa[_0xdece('0x8f')]=_['orderBy'](_0x485efa['applications'],[_0xdece('0x90')],[_0xdece('0x91')]);if(_0x485efa[_0xdece('0x8e')][_0xdece('0x8d')]){delete _0x485efa[_0xdece('0x8e')]['Applications'];}if(_0x485efa[_0xdece('0x8e')]['List']&&_0x485efa[_0xdece('0x8e')][_0xdece('0x8a')][_0xdece('0x8b')][_0xdece('0x58')]){return _0x485efa[_0xdece('0x8e')][_0xdece('0x8a')]['Contacts'][0x0];}var _0x48e46d=_[_0xdece('0xa')](_0x534ad7[_0xdece('0x4b')],{'firstName':_0x534ad7[_0xdece('0x4b')][_0xdece('0x84')],'ListId':_0x9e438a[_0xdece('0x92')]});_0x48e46d[_0x534ad7[_0xdece('0x4b')][_0xdece('0x86')]]=_0x534ad7['body']['from'];return db[_0xdece('0x7e')]['create'](_0x48e46d,{'fields':_0xe14b6e,'raw':!![]});}})[_0xdece('0x27')](handleEntityNotFound(_0x4bba23,null))[_0xdece('0x27')](function(_0x1958a6){_0x485efa[_0xdece('0x93')]=_0x1958a6;var _0x352318=_0x534ad7[_0xdece('0x4b')][_0xdece('0x94')];if(_0x534ad7[_0xdece('0x7a')][_0xdece('0x95')]){_0x352318=_0x534ad7[_0xdece('0x7a')][_0xdece('0x95')];}else if(_0x534ad7[_0xdece('0x7a')][_0xdece('0x96')]){_0x352318=_['first'](_0x534ad7[_0xdece('0x7a')][_0xdece('0x96')][_0xdece('0x97')](','));}if(_0x1958a6){var _0x41fdfc={'ContactId':_0x1958a6['id'],'ChatWebsiteId':_0x534ad7[_0xdece('0x47')]['id'],'from':(_0x1958a6[_0xdece('0x98')]||'')+'\x20'+(_0x1958a6[_0xdece('0x99')]||''),'customerIp':_0x352318,'customerPort':_0x534ad7[_0xdece('0x7a')][_0xdece('0x9a')]?_0x534ad7['headers'][_0xdece('0x9a')]:null,'referer':_0x534ad7[_0xdece('0x4b')]['referer'],'browserName':_0xd1c76['browser'][_0xdece('0x2c')]&&_0xd1c76['browser'][_0xdece('0x9b')]?util[_0xdece('0x9c')](_0xdece('0x9d'),_0xd1c76[_0xdece('0x9e')][_0xdece('0x2c')],_0xd1c76[_0xdece('0x9e')][_0xdece('0x9b')]):_0xdece('0x9f'),'browserVersion':_0xd1c76[_0xdece('0x9e')]['version']||'unknown','osName':util['format'](_0xdece('0x9d'),_0xd1c76['os']['name'],_0xd1c76['os']['version']),'osVersion':_0xd1c76['os']['version'],'deviceModel':_0xd1c76[_0xdece('0xa0')][_0xdece('0x36')]&&_0xd1c76[_0xdece('0xa0')]['vendor']?util[_0xdece('0x9c')](_0xdece('0xa1'),_0xd1c76['device']['model'],_0xd1c76[_0xdece('0xa0')]['vendor'],_0xd1c76[_0xdece('0xa0')][_0xdece('0x34')]):null,'deviceVendor':_0xd1c76[_0xdece('0xa0')]['vendor'],'deviceType':_0xd1c76[_0xdece('0xa0')]['type'],'formData':JSON[_0xdece('0x15')](_0x534ad7['body'])};var _0x106a41={'ChatWebsiteId':_0x534ad7[_0xdece('0x47')]['id'],'closed':![]};if(_0x534ad7['body'][_0xdece('0xa2')]){_0x106a41[_0xdece('0xa2')]=_0x534ad7['body'][_0xdece('0xa2')];return db[_0xdece('0xa3')]['find']({'where':_0x106a41})['then'](function(_0x487bd1){if(_0x487bd1){return[_0x487bd1,![]];}_0x41fdfc[_0xdece('0xa2')]=_0x534ad7[_0xdece('0x4b')][_0xdece('0xa2')];_0x41fdfc[_0xdece('0xa4')]=_0x534ad7['body'][_0xdece('0xa4')];return db[_0xdece('0xa3')][_0xdece('0x4a')](_0x41fdfc)['then'](function(_0x13458e){return[_0x13458e,!![]];});});}_0x106a41[_0xdece('0xa5')]=_0x1958a6['id'];if(_0x534ad7[_0xdece('0x4b')][_0xdece('0xa6')]&&_0x534ad7[_0xdece('0x4b')][_0xdece('0xa6')]['id']){_0x106a41['id']=_0x534ad7[_0xdece('0x4b')][_0xdece('0xa6')]['id'];return db[_0xdece('0xa3')][_0xdece('0x4f')]({'where':_0x106a41})[_0xdece('0x27')](function(_0x2a53f4){if(_0x2a53f4){return[_0x2a53f4,![]];}return db[_0xdece('0xa3')][_0xdece('0x4a')](_0x41fdfc)['then'](function(_0x1143a0){return[_0x1143a0,!![]];});});}return db[_0xdece('0xa3')][_0xdece('0x4a')](_0x41fdfc)[_0xdece('0x27')](function(_0x1aa00b){return[_0x1aa00b,!![]];});}})[_0xdece('0xa7')](function(_0x3a937d,_0x4276ad){if(_0x3a937d){_0x38c3b9=_0x4276ad;if(!_0x4276ad){var _0x58bc1e={'from':(_0x485efa[_0xdece('0x93')][_0xdece('0x98')]||'')+'\x20'+(_0x485efa[_0xdece('0x93')]['lastName']||'')};if(_0x534ad7['body'][_0xdece('0xa2')]&&_0x534ad7[_0xdece('0x4b')][_0xdece('0xa8')]&&_0x534ad7[_0xdece('0x4b')]['threadId']!=_0x534ad7[_0xdece('0x4b')][_0xdece('0xa8')]){_0x58bc1e['threadId']=_0x534ad7[_0xdece('0x4b')][_0xdece('0xa8')];}return _0x3a937d['update'](_0x58bc1e);}else{return _0x3a937d;}}})[_0xdece('0x27')](function(_0x1fe3bd){_0x485efa[_0xdece('0xa6')]=_0x1fe3bd[_0xdece('0x28')]({'plain':!![]});_0x485efa[_0xdece('0xa6')]['created']=_0x38c3b9;if(_0x485efa['interaction'][_0xdece('0xa9')]){if(_0x485efa[_0xdece('0x8e')][_0xdece('0xaa')]){_0x485efa[_0xdece('0x8f')][_0xdece('0xab')]({'id':0x0,'priority':_0x485efa[_0xdece('0x8f')][_0xdece('0x58')]+0x1,'app':_0xdece('0xac'),'appdata':_0xdece('0xad'),'interval':_0xdece('0xae')});}}return db[_0xdece('0xaf')][_0xdece('0x4a')]({'body':_0x534ad7[_0xdece('0x4b')][_0xdece('0x4b')],'ChatWebsiteId':_0x534ad7[_0xdece('0x47')]['id'],'ChatInteractionId':_0x1fe3bd['id'],'direction':'in','ContactId':_0x485efa[_0xdece('0x93')]['id'],'AttachmentId':_0x534ad7['body'][_0xdece('0xb0')]});})[_0xdece('0x27')](function(_0x3ae8d9){_0x485efa[_0xdece('0x18')]=_0x3ae8d9;if(_0x485efa[_0xdece('0xa6')][_0xdece('0xb1')]){return db['User']['find']({'attributes':['id',_0xdece('0x2c')],'where':{'id':_0x485efa[_0xdece('0xa6')]['UserId']}})[_0xdece('0x27')](function(_0x558d99){if(_0x558d99){_0x485efa[_0xdece('0x8f')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdece('0xb2'),'appdata':_0x558d99['name']+','+(_0x485efa[_0xdece('0x8e')][_0xdece('0xb3')]||0xa),'interval':_0xdece('0xae')});_0x485efa[_0xdece('0xb4')]=!![];}return respondWithRpcPromise(_0xdece('0xb5'),_0xdece('0xb6'),_0x485efa);});}return respondWithRpcPromise(_0xdece('0xb5'),_0xdece('0xb6'),_0x485efa);})[_0xdece('0x27')](function(_0x472877){respondWithRpcPromise(_0xdece('0xb7'),_0xdece('0xb7'),{'event':_0xdece('0xb8'),'message':_0x472877},client9002);return _0x472877;})['then'](respondWithResult(_0x4bba23,null))[_0xdece('0x1a')](handleError(_0x4bba23,null));};exports[_0xdece('0xb9')]=function(_0x5065e1,_0x3d32b2){var _0x4efff4,_0x43c12a,_0x270883;var _0x2b80d2=[];var _0x324202={};var _0x45d1aa=_0x5065e1[_0xdece('0xba')]||[];var _0x173d5d=[];var _0x119fe0;return db[_0xdece('0x7e')]['describe']()[_0xdece('0x27')](function(_0x410a86){if(!_0x410a86){throw new db[(_0xdece('0x85'))]['ValidationError'](_0xdece('0x80'));}_0x2b80d2=_[_0xdece('0x82')](_[_0xdece('0x48')](_0x410a86),['createdAt',_0xdece('0x81'),_0xdece('0x83'),_0xdece('0x92')]);if(_0x5065e1['body']['id']){delete _0x5065e1['body']['id'];}if(_[_0xdece('0x70')](_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')])){throw _0x3d32b2[_0xdece('0x1c')](0x1f4)[_0xdece('0xbb')](new db[(_0xdece('0x85'))][(_0xdece('0x7f'))](_0xdece('0xbc')));}if(_[_0xdece('0x70')](_0x5065e1[_0xdece('0x4b')][_0xdece('0x4b')])||_0x5065e1[_0xdece('0x4b')]['body']===''){throw _0x3d32b2[_0xdece('0x1c')](0x1f4)['send'](new db[(_0xdece('0x85'))]['ValidationError'](_0xdece('0xbd')));}if(_['isNil'](_0x5065e1['body']['mapKeyOffline'])){throw _0x3d32b2[_0xdece('0x1c')](0x1f4)[_0xdece('0xbb')](new db[(_0xdece('0x85'))][(_0xdece('0x7f'))](_0xdece('0xbe')+_0x2b80d2));}if(!_[_0xdece('0xbf')](_0x2b80d2,_0x5065e1[_0xdece('0x4b')][_0xdece('0xc0')])){throw _0x3d32b2[_0xdece('0x1c')](0x1f4)[_0xdece('0xbb')](new db[(_0xdece('0x85'))][(_0xdece('0x7f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b80d2));}_0x324202[_0x5065e1['body'][_0xdece('0xc0')]]=_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')];})[_0xdece('0x27')](function(){return db['ChatWebsite'][_0xdece('0x4f')]({'where':{'id':_0x5065e1['params']['id']},'include':[{'model':db['CmList'],'as':_0xdece('0x8a')},{'model':db[_0xdece('0xc1')],'as':_0xdece('0xc1')}]});})['then'](handleEntityNotFound(_0x3d32b2,null))[_0xdece('0x27')](function(_0x506bce){if(_0x506bce&&_0x506bce[_0xdece('0x8a')]){_0x43c12a=_0x506bce;var _0x44dbe4=_[_0xdece('0xa')](_0x5065e1[_0xdece('0x4b')],{'firstName':_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')],'phone':_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')],'ListId':_0x506bce[_0xdece('0x92')]});_0x44dbe4[_0x5065e1[_0xdece('0x4b')][_0xdece('0xc0')]]=_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')];return db[_0xdece('0x7e')][_0xdece('0xc2')]({'where':_0x324202,'defaults':_0x44dbe4});}})[_0xdece('0xa7')](function(_0x19b464){if(_0x19b464){_0x270883=_0x19b464;var _0x308616=fs[_0xdece('0xc3')](path[_0xdece('0x6a')](config[_0xdece('0x6b')],'server/files/templates/chatOfflineMessage.ejs'),_0xdece('0xc4'));var _0x2551e7=ejs['render'](_0x308616,{'body':_[_0xdece('0xc5')](_0x5065e1[_0xdece('0x4b')][_0xdece('0x4b')]),'bodyTitle':_0x43c12a[_0xdece('0xc6')]});return db[_0xdece('0xc7')][_0xdece('0x4a')]({'body':_0x2551e7,'ContactId':_0x19b464['id'],'ChatWebsiteId':_0x43c12a['id']});}})['then'](function(_0x4c3a70){_0x119fe0=_0x4c3a70;if(_0x45d1aa[_0xdece('0x58')]){var _0x58ffc2=_0x45d1aa[_0xdece('0x30')](function(_0x41efa7){return{'name':_0x41efa7[_0xdece('0xc8')],'basename':_0x41efa7[_0xdece('0x62')],'type':_0x41efa7[_0xdece('0xc9')],'ChatOfflineMessageId':_0x4c3a70['id']};});_0x173d5d=_0x58ffc2[_0xdece('0x30')](_0x3389d5=>{var _0x4746c5={'filename':_0x3389d5[_0xdece('0x2c')],'path':path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0xca'),_0xdece('0xba'),_0xdece('0xcb'),_0xdece('0xcc'),_0x3389d5['basename'])};return _0x4746c5;});if(!_0x43c12a[_0xdece('0xcd')]){return db[_0xdece('0xce')][_0xdece('0xcf')](function(_0x2b7aaf){return db[_0xdece('0xd0')][_0xdece('0xd1')](_0x58ffc2,{'transaction':_0x2b7aaf});});}}})[_0xdece('0x27')](function(){if(_0x119fe0){_0x4efff4=_0x119fe0;return db['MailAccount']['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xdece('0xd2')],'as':'Smtp','raw':!![]}]});}})[_0xdece('0x27')](function(_0x4576a7){if(_0x4576a7&&_0x4576a7[_0xdece('0xd3')]&&_0x43c12a[_0xdece('0xd4')]&&_0x43c12a[_0xdece('0xd5')]){var _0x2ee9de={'tls':{'rejectUnauthorized':![]}};if(_0x4576a7[_0xdece('0xd3')][_0xdece('0xd6')]){_0x2ee9de[_0xdece('0xd6')]=_0x4576a7['Smtp'][_0xdece('0xd6')];}else{_0x2ee9de['host']=_0x4576a7['Smtp'][_0xdece('0xd7')];_0x2ee9de[_0xdece('0xd8')]=_0x4576a7[_0xdece('0xd3')][_0xdece('0xd8')];_0x2ee9de['secure']=_0x4576a7['Smtp']['secure'];}if(_0x4576a7['Smtp'][_0xdece('0xd9')]){_0x2ee9de[_0xdece('0xda')]={'user':_0x4576a7['Smtp']['user'],'pass':_0x4576a7[_0xdece('0xd3')][_0xdece('0xdb')]};}return respondWithRpcPromise(_0xdece('0xdc'),_0xdece('0xdd'),{'account':_0x2ee9de,'message':{'from':util['format'](_0xdece('0xde'),_0x4576a7[_0xdece('0x2c')],_0x4576a7[_0xdece('0xdf')]||_0x4576a7['Smtp']['user']),'to':_0x43c12a[_0xdece('0xd5')],'subject':_0x43c12a['offlineMessageSubject'],'html':_0x4efff4[_0xdece('0x4b')],'attachments':_0x173d5d}},client9003)[_0xdece('0x27')](function(){return _0x4efff4;})[_0xdece('0x1a')](function(_0x4e13ff){console[_0xdece('0x16')](_0x4e13ff);});}})[_0xdece('0x27')](function(){if(_0x43c12a&&_0x43c12a[_0xdece('0xcd')]&&_0x43c12a[_0xdece('0xe0')]){var _0x1a93de=[];if(_0x45d1aa[_0xdece('0x58')]){_0x1a93de=_0x45d1aa[_0xdece('0x30')](function(_0x1aa321){return{'name':_0x1aa321[_0xdece('0xc8')],'basename':_0x1aa321[_0xdece('0x62')],'type':_0x1aa321[_0xdece('0xc9')],'ChatOfflineMessageId':_0x119fe0['id']};});}var _0x5526d9;if(!_[_0xdece('0x70')](_0x43c12a['subjectOffline'])){var _0x312e66=_[_0xdece('0x30')](_0x5065e1[_0xdece('0x4b')],function(_0x11d4ba){return _0x11d4ba;});var _0x57bf15=_[_0xdece('0xe1')](_0x312e66)[0x0];var _0x305e9c=_[_0xdece('0xe2')](_0x57bf15,function(_0x5519e4){return _0x5519e4;});_0x5526d9=_0x305e9c[0x1][_0x43c12a[_0xdece('0xe3')]];}var _0x3d1984={'from':_0x270883[_0xdece('0xdf')],'firstName':_0x270883[_0xdece('0x98')],'lastName':_0x270883['lastName'],'mapKey':'email','message':{'from':_0x270883[_0xdece('0xdf')],'to':_0x43c12a[_0xdece('0xc1')][_0xdece('0xdf')],'cc':'','subject':_['isNil'](_0x5526d9)?_0x43c12a[_0xdece('0xe4')]:_0x5526d9,'messageId':'','sentAt':new Date(),'attach':_0x1a93de[_0xdece('0x58')],'attachments':_0x1a93de,'originChannel':_0xdece('0xe5'),'ChatWebsiteId':_0x43c12a['id'],'ChatOfflineMessageId':_0x4efff4['id'],'originTo':_0x43c12a[_0xdece('0xc1')][_0xdece('0xdf')]},'body':_0x4efff4[_0xdece('0x4b')]};var _0x3c7c19={'account':{'id':_0x43c12a[_0xdece('0xe0')]},'body':_0x3d1984,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xdece('0xe6'),'notifyMail',_0x3c7c19,client9001)['then'](function(){return _0x4efff4;})['catch'](function(_0xced384){console['error'](_0xced384);});}return;})[_0xdece('0x27')](function(){if(_0x4efff4){return _0x4efff4;}})[_0xdece('0x27')](respondWithResult(_0x3d32b2,null))[_0xdece('0x1a')](function(_0x955ddd){console[_0xdece('0x16')](_0xdece('0x1a'),_0x955ddd);for(var _0x144107 of _0x45d1aa){var _0x10c1f2=path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0xca'),_0xdece('0xba'),_0xdece('0xcb'),'offline-chat',_0x144107['filename']);fs_extra['remove'](_0x10c1f2)[_0xdece('0x1a')](function(_0xc78e7c){console[_0xdece('0x16')](_0xdece('0xe7'),_0x10c1f2,_0xc78e7c);});}});};exports[_0xdece('0xe8')]=function(_0x7e24ff,_0x2944ea){return db[_0xdece('0xa3')][_0xdece('0x4f')]({'where':{'id':_0x7e24ff['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x2944ea,null))[_0xdece('0x27')](function(_0x403d9b){if(_0x403d9b){return _0x403d9b[_0xdece('0xe8')](_0x7e24ff[_0xdece('0x4b')][_0xdece('0x5b')],_[_0xdece('0xe9')](_0x7e24ff['body'],[_0xdece('0x5b'),'id'])||{});}})[_0xdece('0x27')](respondWithResult(_0x2944ea,null))[_0xdece('0x1a')](handleError(_0x2944ea,null));};exports[_0xdece('0xea')]=function(_0x357f6b,_0x463f6f){var _0x485558={'raw':![],'where':{}};var _0x3bbb9f={};var _0x38d7b5={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x357f6b[_0xdece('0x47')]['id']}})['then'](handleEntityNotFound(_0x463f6f,null))[_0xdece('0x27')](function(_0x45d9d3){if(_0x45d9d3){_0x3bbb9f[_0xdece('0x36')]=_['keys'](db[_0xdece('0xa3')]['rawAttributes']);_0x3bbb9f[_0xdece('0x37')]=_[_0xdece('0x48')](_0x357f6b[_0xdece('0x37')]);_0x3bbb9f[_0xdece('0x38')]=_[_0xdece('0x3a')](_0x3bbb9f[_0xdece('0x36')],_0x3bbb9f[_0xdece('0x37')]);_0x485558[_0xdece('0x39')]=_[_0xdece('0x3a')](_0x3bbb9f[_0xdece('0x36')],qs[_0xdece('0x49')](_0x357f6b[_0xdece('0x37')]['fields']));_0x485558[_0xdece('0x39')]=_0x485558['attributes']['length']?_0x485558[_0xdece('0x39')]:_0x3bbb9f[_0xdece('0x36')];if(!_0x357f6b[_0xdece('0x37')][_0xdece('0x3b')](_0xdece('0x3c'))){_0x485558[_0xdece('0x20')]=qs[_0xdece('0x20')](_0x357f6b[_0xdece('0x37')][_0xdece('0x20')]);_0x485558['offset']=qs[_0xdece('0x1e')](_0x357f6b[_0xdece('0x37')][_0xdece('0x1e')]);}_0x485558[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x357f6b[_0xdece('0x37')][_0xdece('0x3e')]);_0x485558['where']=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x357f6b[_0xdece('0x37')],_0x3bbb9f['filters']));_0x485558[_0xdece('0x3f')][_0xdece('0x55')]=_0x45d9d3['id'];if(_0x357f6b[_0xdece('0x37')]['filter']){_0x485558[_0xdece('0x3f')]=_[_0xdece('0x41')](_0x485558[_0xdece('0x3f')],{'$or':_[_0xdece('0x30')](_0x485558[_0xdece('0x39')],function(_0x2c7145){var _0xf2deee={};_0xf2deee[_0x2c7145]={'$like':'%'+_0x357f6b[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0xf2deee;})});}_0x485558=_[_0xdece('0x41')]({},_0x485558,_0x357f6b[_0xdece('0x44')]);return db['ChatInteraction'][_0xdece('0x21')]({'where':_0x485558[_0xdece('0x3f')]})[_0xdece('0x27')](function(_0x2fcced){_0x38d7b5['count']=_0x2fcced;if(_0x357f6b['query']['includeAll']){_0x485558['include']=[{'model':db[_0xdece('0x7e')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xdece('0xeb'),'attributes':[_0xdece('0x2c'),_0xdece('0xec'),_0xdece('0xed')],'required':![]},{'model':db['Tag'],'as':_0xdece('0xee'),'attributes':['id',_0xdece('0x2c'),_0xdece('0xef')],'where':_0x357f6b[_0xdece('0x37')][_0xdece('0xf0')]?{'id':_0x357f6b[_0xdece('0x37')][_0xdece('0xf0')]}:undefined,'required':_0x357f6b['query'][_0xdece('0xf0')]?!![]:![]}];}return db[_0xdece('0xa3')]['findAll'](_0x485558);})['then'](function(_0x402c52){_0x38d7b5[_0xdece('0x59')]=_0x402c52;return _0x38d7b5;});}})[_0xdece('0x27')](respondWithFilteredResult(_0x463f6f,_0x485558))[_0xdece('0x1a')](handleError(_0x463f6f,null));};function iftimePromise(_0x5a8292,_0x2bfc17){return respondWithRpcPromise('Command',_0xdece('0xf1'),{'command':_0x2bfc17[_0xdece('0xf2')]?util['format']('iftime\x20%s,%s',_0x5a8292[_0xdece('0xf3')],_0x2bfc17[_0xdece('0xf2')]):util[_0xdece('0x9c')](_0xdece('0xf4'),_0x5a8292[_0xdece('0xf3')])},client9002)[_0xdece('0x27')](function(_0x1aaab6){var _0x3513f0=_0x1aaab6&&_0x1aaab6[_0xdece('0xf5')](_0xdece('0xf6'))>=0x0?!![]:![];logger[_0xdece('0x11')](_0xdece('0xf7'),_0x2bfc17['id'],_0x5a8292['id'],_0x5a8292['interval'],_0x3513f0?'ONLINE':'OFFLINE',_0x2bfc17[_0xdece('0xf2')]?_0x2bfc17[_0xdece('0xf2')]:'No\x20timezone');return _0x3513f0;})[_0xdece('0x1a')](function(_0x2c2389){logger['error'](_0xdece('0xf7'),_0x2bfc17['id'],_0x5a8292['id'],_0x5a8292[_0xdece('0xf3')],util[_0xdece('0xf8')](_0x2c2389,{'showHidden':![],'depth':null}),_0x2bfc17[_0xdece('0xf2')]?_0x2bfc17[_0xdece('0xf2')]:'No\x20timezone');return![];});}exports[_0xdece('0xf1')]=function(_0x4a393a,_0x528be6){var _0x26a092=0x0;var _0x4d8d6b=0x0;var _0x34ec78=![];var _0x47c86f;var _0x54e94c;return db[_0xdece('0x31')]['find']({'where':{'id':_0x4a393a[_0xdece('0x47')]['id']},'include':[{'model':db[_0xdece('0xf9')],'as':_0xdece('0xf9'),'include':[{'model':db[_0xdece('0xf9')],'as':_0xdece('0xfa'),'attributes':['id',_0xdece('0xf3')],'raw':!![]}]}]})[_0xdece('0x27')](handleEntityNotFound(_0x528be6,null))[_0xdece('0x27')](function(_0x27821b){if(_0x27821b){_0x47c86f=_0x27821b;return _0x27821b['getProactiveActions']({'raw':!![]});}})[_0xdece('0x27')](function(_0x4bef23){if(_0x47c86f){if(_0x4bef23){_0x54e94c=_0x4bef23;}}return require(_0xdece('0x6d'))[_0xdece('0x6e')]();})[_0xdece('0x27')](function(_0x118c53){if(_0x118c53){_0x4d8d6b=_0x118c53['virtual'];_0x34ec78=_0x118c53[_0xdece('0x6f')];}})[_0xdece('0x27')](function(){return db[_0xdece('0xa3')][_0xdece('0x21')]({'where':{'closed':![]}});})[_0xdece('0x27')](function(_0x2402af){_0x26a092=_0x2402af;if(_0x4d8d6b&&_0x2402af>_0x4d8d6b){return db[_0xdece('0xfb')][_0xdece('0x5e')]({'where':{'id':0x1}})['then'](function(_0x53d05d){if(_0x53d05d){_0x53d05d[_0xdece('0xfc')]('chatLicenseExceeded');}});}})[_0xdece('0x27')](function(){if(_0x47c86f['Interval']&&_0x47c86f[_0xdece('0xf9')][_0xdece('0xfa')]){var _0x4c01e8=[];for(var _0x551104=0x0;_0x551104<_0x47c86f[_0xdece('0xf9')][_0xdece('0xfa')]['length'];_0x551104++){var _0x272bfc=_0x47c86f['Interval']['Intervals'][_0x551104][_0xdece('0x28')]({'plain':!![]});_0x4c01e8[_0xdece('0xab')](iftimePromise(_0x272bfc,_0x47c86f));}return BPromise[_0xdece('0xfd')](_0x4c01e8)[_0xdece('0x27')](function(_0x60e630){return _[_0xdece('0xfe')](_0x60e630);});}else{return!![];}})[_0xdece('0x27')](function(_0xa70643){var _0x2b6ccc=fs[_0xdece('0xc3')](path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0xff')),_0xdece('0xc4'));var _0x359f9b={'remote':_0x47c86f[_0xdece('0x100')],'query':querystring['stringify'](_[_0xdece('0x41')](_0x47c86f[_0xdece('0x28')]({'plain':!![]}),{'customerIp':_0x4a393a[_0xdece('0x7a')][_0xdece('0x96')]||_0x4a393a['headers'][_0xdece('0x101')]||_0x4a393a[_0xdece('0x102')][_0xdece('0x103')]||_0x4a393a['ip'],'referer':_0x4a393a[_0xdece('0x7a')][_0xdece('0x104')],'openedInteractions':_0x26a092,'maxInteractions':_0x4d8d6b,'virtual':_0x34ec78[_0xdece('0x105')],'online':_0xa70643,'custom':_0x34ec78}))[_0xdece('0x106')](/'/g,'\x5c\x27')};_0x528be6['send'](ejs[_0xdece('0x107')](Mustache[_0xdece('0x107')](_0x2b6ccc,_0x359f9b),{'proactiveActions':_0x54e94c,'alignment':_0x47c86f[_0xdece('0x108')],'verticalAlignment':_0x47c86f[_0xdece('0x109')],'div_color':_0x47c86f[_0xdece('0xef')],'text_color':_0x47c86f[_0xdece('0x10a')],'button_color':_0x47c86f[_0xdece('0x10b')],'background_color':_0x47c86f[_0xdece('0x10c')]}));})[_0xdece('0x1a')](handleError(_0x528be6,null));};exports[_0xdece('0x10d')]=function(_0x2042d8,_0x46f25d){var _0xba7e99=_0x2042d8[_0xdece('0x47')]['id'];var _0x756c75=_0x2042d8['body'];var _0x4fbcc2=0xc8;var _0x341279=null;return db[_0xdece('0xce')][_0xdece('0xcf')]({'isolationLevel':db[_0xdece('0xce')][_0xdece('0x10e')][_0xdece('0x10f')][_0xdece('0x110')]},function(_0x544153){return db[_0xdece('0x31')]['findOne']({'where':{'id':_0xba7e99},'transaction':_0x544153})[_0xdece('0x27')](function(_0xe3d0e6){if(_0xe3d0e6){return db[_0xdece('0x111')][_0xdece('0x26')]({'where':{'ChatWebsiteId':_0xba7e99},'transaction':_0x544153})['then'](function(){var _0x4c936f=_[_0xdece('0x30')](_0x756c75,function(_0x311e04){_0x311e04['ChatWebsiteId']=_0xba7e99;return _0x311e04;});return db['ChatApplication'][_0xdece('0xd1')](_0x4c936f,{'transaction':_0x544153});});}else{_0x4fbcc2=0x194;_0x341279=[];}});})[_0xdece('0x27')](function(){if(_0x4fbcc2!==0x194){return db[_0xdece('0x111')][_0xdece('0x112')]({'where':{'ChatWebsiteId':_0xba7e99},'order':_0xdece('0x90')})['then'](function(_0x160fa1){_0x341279=_0x160fa1;});}})[_0xdece('0x1a')](function(_0x2e0369){_0x4fbcc2=0x1f4;logger[_0xdece('0x16')](_0x2e0369[_0xdece('0x2b')]);if(_0x2e0369[_0xdece('0x2c')]){delete _0x2e0369[_0xdece('0x2c')];}_0x341279=_0x2e0369;})[_0xdece('0x113')](function(){if(_0x341279===null){_0x46f25d[_0xdece('0x1b')](_0x4fbcc2);}else{if(_0x4fbcc2===0x1f4){_0x46f25d[_0xdece('0x1c')](_0x4fbcc2)[_0xdece('0xbb')](_0x341279);}else{_0x46f25d[_0xdece('0x1c')](_0x4fbcc2)[_0xdece('0x24')](_0x341279);}}});};exports[_0xdece('0x114')]=function(_0x52c5e7,_0x2ccad1){var _0x523c22={};var _0x553171={};var _0x19020f;var _0x5c685c;return db['ChatWebsite'][_0xdece('0x5e')]({'where':{'id':_0x52c5e7['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x2ccad1,null))['then'](function(_0x5c386c){if(_0x5c386c){_0x19020f=_0x5c386c;_0x553171['model']=_[_0xdece('0x48')](db[_0xdece('0x111')][_0xdece('0x32')]);_0x553171[_0xdece('0x37')]=_[_0xdece('0x48')](_0x52c5e7['query']);_0x553171[_0xdece('0x38')]=_['intersection'](_0x553171[_0xdece('0x36')],_0x553171[_0xdece('0x37')]);_0x523c22[_0xdece('0x39')]=_['intersection'](_0x553171['model'],qs[_0xdece('0x49')](_0x52c5e7[_0xdece('0x37')][_0xdece('0x49')]));_0x523c22['attributes']=_0x523c22['attributes']['length']?_0x523c22[_0xdece('0x39')]:_0x553171[_0xdece('0x36')];_0x523c22[_0xdece('0x3d')]=qs['sort'](_0x52c5e7[_0xdece('0x37')]['sort']);_0x523c22[_0xdece('0x3f')]=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x52c5e7[_0xdece('0x37')],_0x553171[_0xdece('0x38')]));if(_0x52c5e7['query'][_0xdece('0x43')]){_0x523c22[_0xdece('0x3f')]=_['merge'](_0x523c22['where'],{'$or':_['map'](_0x523c22[_0xdece('0x39')],function(_0x117f48){var _0x43b00f={};_0x43b00f[_0x117f48]={'$like':'%'+_0x52c5e7[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x43b00f;})});}_0x523c22=_['merge']({},_0x523c22,_0x52c5e7[_0xdece('0x44')]);return _0x19020f['getApplications'](_0x523c22);}})['then'](function(_0xef18ca){if(_0xef18ca){_0x5c685c=_0xef18ca[_0xdece('0x58')];if(!_0x52c5e7[_0xdece('0x37')]['hasOwnProperty'](_0xdece('0x3c'))){_0x523c22['limit']=qs[_0xdece('0x20')](_0x52c5e7[_0xdece('0x37')][_0xdece('0x20')]);_0x523c22[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x52c5e7[_0xdece('0x37')][_0xdece('0x1e')]);}return _0x19020f['getApplications'](_0x523c22);}})[_0xdece('0x27')](function(_0x46e2ca){if(_0x46e2ca){return _0x46e2ca?{'count':_0x5c685c,'rows':_0x46e2ca}:null;}})[_0xdece('0x27')](respondWithResult(_0x2ccad1,null))['catch'](handleError(_0x2ccad1,null));};exports['addProactiveActions']=function(_0x4fec68,_0x44f635){return db[_0xdece('0x115')][_0xdece('0x4f')]({'where':{'id':_0x4fec68[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x44f635,null))[_0xdece('0x27')](function(_0x46e204){if(_0x46e204){return _0x46e204[_0xdece('0x116')](_0x4fec68[_0xdece('0x4b')]['ids'],_[_0xdece('0xe9')](_0x4fec68[_0xdece('0x4b')],[_0xdece('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x44f635,null))[_0xdece('0x1a')](handleError(_0x44f635,null));};exports[_0xdece('0x117')]=function(_0x3f58de,_0x3026c7){var _0x197af5={};var _0x29408b={};var _0xd1d731;var _0x5affce;return db[_0xdece('0x31')][_0xdece('0x5e')]({'where':{'id':_0x3f58de[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x3026c7,null))[_0xdece('0x27')](function(_0x5d257e){if(_0x5d257e){_0xd1d731=_0x5d257e;_0x29408b[_0xdece('0x36')]=_[_0xdece('0x48')](db['ChatProactiveAction'][_0xdece('0x32')]);_0x29408b[_0xdece('0x37')]=_['keys'](_0x3f58de[_0xdece('0x37')]);_0x29408b[_0xdece('0x38')]=_['intersection'](_0x29408b[_0xdece('0x36')],_0x29408b[_0xdece('0x37')]);_0x197af5[_0xdece('0x39')]=_['intersection'](_0x29408b[_0xdece('0x36')],qs[_0xdece('0x49')](_0x3f58de[_0xdece('0x37')][_0xdece('0x49')]));_0x197af5[_0xdece('0x39')]=_0x197af5[_0xdece('0x39')][_0xdece('0x58')]?_0x197af5[_0xdece('0x39')]:_0x29408b[_0xdece('0x36')];_0x197af5[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x3f58de[_0xdece('0x37')]['sort']);_0x197af5[_0xdece('0x3f')]=qs['filters'](_['pick'](_0x3f58de[_0xdece('0x37')],_0x29408b[_0xdece('0x38')]));if(_0x3f58de['query'][_0xdece('0x43')]){_0x197af5[_0xdece('0x3f')]=_[_0xdece('0x41')](_0x197af5['where'],{'$or':_[_0xdece('0x30')](_0x197af5[_0xdece('0x39')],function(_0x3b1246){var _0x5583bb={};_0x5583bb[_0x3b1246]={'$like':'%'+_0x3f58de[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x5583bb;})});}_0x197af5=_[_0xdece('0x41')]({},_0x197af5,_0x3f58de[_0xdece('0x44')]);return _0xd1d731[_0xdece('0x117')](_0x197af5);}})[_0xdece('0x27')](function(_0x2a19f2){if(_0x2a19f2){_0x5affce=_0x2a19f2[_0xdece('0x58')];if(!_0x3f58de[_0xdece('0x37')][_0xdece('0x3b')](_0xdece('0x3c'))){_0x197af5[_0xdece('0x20')]=qs['limit'](_0x3f58de[_0xdece('0x37')]['limit']);_0x197af5[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x3f58de['query'][_0xdece('0x1e')]);}return _0xd1d731['getProactiveActions'](_0x197af5);}})[_0xdece('0x27')](function(_0x4dfe21){if(_0x4dfe21){return _0x4dfe21?{'count':_0x5affce,'rows':_0x4dfe21}:null;}})[_0xdece('0x27')](respondWithResult(_0x3026c7,null))[_0xdece('0x1a')](handleError(_0x3026c7,null));};exports['getFields']=function(_0x5b4098,_0x1a5083){var _0x22349f=_0x5b4098[_0xdece('0x37')][_0xdece('0x118')]===_0xdece('0x119')?_0xdece('0x11a'):_0xdece('0x11b');return db['ChatWebsite']['find']({'attributes':['id',_0x22349f],'where':{'id':_0x5b4098[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x1a5083,null))[_0xdece('0x27')](function(_0xdfaa4c){if(_0xdfaa4c){var _0x4411ad=_0xdfaa4c[_0x22349f];var _0x49352b=_0x4411ad&&_0x4411ad[_0xdece('0x11c')]?_0x4411ad[_0xdece('0x11c')]:[];_0x1a5083[_0xdece('0xbb')]({'fromKey':_['isNil'](_0x4411ad[_0xdece('0x11d')])?undefined:_0x4411ad[_0xdece('0x11d')],'count':_0x49352b['length'],'rows':_0x49352b});}})[_0xdece('0x1a')](handleError(_0x1a5083,null));};exports[_0xdece('0x11e')]=function(_0x3907fa,_0x3e9a8f){var _0xf07038={'raw':![],'where':{}};var _0x401a91={};var _0x1d53a3={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x3907fa[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x3e9a8f,null))[_0xdece('0x27')](function(_0x61912e){if(_0x61912e){_0x401a91[_0xdece('0x36')]=_['keys'](db[_0xdece('0xc7')][_0xdece('0x32')]);_0x401a91[_0xdece('0x37')]=_[_0xdece('0x48')](_0x3907fa['query']);_0x401a91[_0xdece('0x38')]=_[_0xdece('0x3a')](_0x401a91[_0xdece('0x36')],_0x401a91[_0xdece('0x37')]);_0xf07038['attributes']=_[_0xdece('0x3a')](_0x401a91['model'],qs[_0xdece('0x49')](_0x3907fa['query'][_0xdece('0x49')]));_0xf07038[_0xdece('0x39')]=_0xf07038[_0xdece('0x39')][_0xdece('0x58')]?_0xf07038[_0xdece('0x39')]:_0x401a91['model'];if(!_0x3907fa['query'][_0xdece('0x3b')](_0xdece('0x3c'))){_0xf07038['limit']=qs[_0xdece('0x20')](_0x3907fa[_0xdece('0x37')]['limit']);_0xf07038[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x3907fa[_0xdece('0x37')][_0xdece('0x1e')]);}_0xf07038[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x3907fa['query'][_0xdece('0x3e')]);_0xf07038[_0xdece('0x3f')]=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x3907fa['query'],_0x401a91[_0xdece('0x38')]));_0xf07038[_0xdece('0x3f')][_0xdece('0x55')]=_0x61912e['id'];if(_0x3907fa['query'][_0xdece('0x43')]){_0xf07038[_0xdece('0x3f')]=_['merge'](_0xf07038[_0xdece('0x3f')],{'$or':_[_0xdece('0x30')](_0xf07038['attributes'],function(_0x34416e){var _0x48ac0b={};_0x48ac0b[_0x34416e]={'$like':'%'+_0x3907fa[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x48ac0b;})});}_0xf07038=_[_0xdece('0x41')]({},_0xf07038,_0x3907fa[_0xdece('0x44')]);return db[_0xdece('0xc7')][_0xdece('0x21')]({'where':_0xf07038['where']})[_0xdece('0x27')](function(_0x4f00de){_0x1d53a3[_0xdece('0x21')]=_0x4f00de;if(_0x3907fa[_0xdece('0x37')][_0xdece('0x5f')]){_0xf07038[_0xdece('0x45')]=[{'all':!![]}];}else{_0xf07038[_0xdece('0x45')]=[{'model':db[_0xdece('0x7e')],'as':_0xdece('0x11f'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xdece('0xc7')][_0xdece('0x46')](_0xf07038);})[_0xdece('0x27')](function(_0x5afcc2){_0x1d53a3[_0xdece('0x59')]=_0x5afcc2;return _0x1d53a3;});}})[_0xdece('0x27')](respondWithFilteredResult(_0x3e9a8f,_0xf07038))[_0xdece('0x1a')](handleError(_0x3e9a8f,null));};exports[_0xdece('0x120')]=function(_0x1e8252,_0x438aff){return db['ChatWebsite']['find']({'where':{'id':_0x1e8252['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x438aff,null))[_0xdece('0x27')](function(_0x153a22){if(_0x153a22){return _0x153a22[_0xdece('0x120')](_0x1e8252[_0xdece('0x4b')][_0xdece('0x5b')],_[_0xdece('0xe9')](_0x1e8252['body'],['ids','id'])||{})[_0xdece('0xa7')](function(_0x304086){for(var _0x41555f=0x0;_0x41555f<_0x1e8252[_0xdece('0x4b')][_0xdece('0x5b')]['length'];_0x41555f+=0x1){socket[_0xdece('0x121')]('userChatWebsite:save',{'UserId':Number(_0x1e8252['body'][_0xdece('0x5b')][_0x41555f]),'ChatWebsiteId':Number(_0x1e8252[_0xdece('0x47')]['id'])});}return _0x304086;});}})[_0xdece('0x27')](respondWithResult(_0x438aff,null))[_0xdece('0x1a')](handleError(_0x438aff,null));};exports['removeAgents']=function(_0x1302cf,_0x52f736){return db[_0xdece('0x31')]['find']({'where':{'id':_0x1302cf['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x52f736,null))[_0xdece('0x27')](function(_0x1303b8){if(_0x1303b8){return _0x1303b8['removeAgents'](_0x1302cf[_0xdece('0x37')]['ids'])['then'](function(){if(_['isArray'](_0x1302cf['query'][_0xdece('0x5b')])){for(var _0x155e0c=0x0;_0x155e0c<_0x1302cf['query'][_0xdece('0x5b')]['length'];_0x155e0c+=0x1){socket[_0xdece('0x121')]('userChatWebsite:remove',{'UserId':Number(_0x1302cf[_0xdece('0x37')]['ids'][_0x155e0c]),'ChatWebsiteId':Number(_0x1302cf[_0xdece('0x47')]['id'])});}}else{socket['emit'](_0xdece('0x122'),{'UserId':Number(_0x1302cf[_0xdece('0x37')][_0xdece('0x5b')]),'ChatWebsiteId':Number(_0x1302cf[_0xdece('0x47')]['id'])});}});}})[_0xdece('0x27')](respondWithStatusCode(_0x52f736,null))[_0xdece('0x1a')](handleError(_0x52f736,null));};exports[_0xdece('0x123')]=function(_0x2a21b0,_0x48f8f9){var _0x5db2ac={};var _0x49f9d3={};var _0x591e69;var _0xcb6533;return db['ChatWebsite'][_0xdece('0x5e')]({'where':{'id':_0x2a21b0[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x48f8f9,null))[_0xdece('0x27')](function(_0x50b636){if(_0x50b636){_0x591e69=_0x50b636;_0x49f9d3[_0xdece('0x36')]=_[_0xdece('0x48')](db[_0xdece('0x124')][_0xdece('0x32')]);_0x49f9d3['query']=_['keys'](_0x2a21b0[_0xdece('0x37')]);_0x49f9d3[_0xdece('0x38')]=_['intersection'](_0x49f9d3['model'],_0x49f9d3[_0xdece('0x37')]);_0x5db2ac[_0xdece('0x39')]=_[_0xdece('0x3a')](_0x49f9d3[_0xdece('0x36')],qs[_0xdece('0x49')](_0x2a21b0[_0xdece('0x37')]['fields']));_0x5db2ac[_0xdece('0x39')]=_0x5db2ac['attributes']['length']?_0x5db2ac['attributes']:_0x49f9d3[_0xdece('0x36')];_0x5db2ac[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x2a21b0[_0xdece('0x37')][_0xdece('0x3e')]);_0x5db2ac[_0xdece('0x3f')]=qs['filters'](_[_0xdece('0x40')](_0x2a21b0[_0xdece('0x37')],_0x49f9d3[_0xdece('0x38')]));if(_0x2a21b0[_0xdece('0x37')][_0xdece('0x43')]){_0x5db2ac[_0xdece('0x3f')]=_['merge'](_0x5db2ac['where'],{'$or':_[_0xdece('0x30')](_0x5db2ac['attributes'],function(_0x5bc81b){var _0xacc150={};_0xacc150[_0x5bc81b]={'$like':'%'+_0x2a21b0[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0xacc150;})});}_0x5db2ac=_['merge']({},_0x5db2ac,_0x2a21b0[_0xdece('0x44')]);return _0x591e69[_0xdece('0x123')](_0x5db2ac);}})['then'](function(_0x310b6b){if(_0x310b6b){_0xcb6533=_0x310b6b[_0xdece('0x58')];if(!_0x2a21b0[_0xdece('0x37')][_0xdece('0x3b')]('nolimit')){_0x5db2ac[_0xdece('0x20')]=qs['limit'](_0x2a21b0['query']['limit']);_0x5db2ac['offset']=qs[_0xdece('0x1e')](_0x2a21b0[_0xdece('0x37')][_0xdece('0x1e')]);}return _0x591e69['getAgents'](_0x5db2ac);}})['then'](function(_0xfad6b6){if(_0xfad6b6){return _0xfad6b6?{'count':_0xcb6533,'rows':_0xfad6b6}:null;}})[_0xdece('0x27')](respondWithResult(_0x48f8f9,null))[_0xdece('0x1a')](handleError(_0x48f8f9,null));}; \ No newline at end of file +var _0x3e4d=['ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','account','applications','list','orderBy','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','externalUrl','ContactId','interaction','ChatInteraction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','pick','Contact','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','increment','chatLicenseExceeded','push','x-real-ip','connection','remoteAddress','render','alignment','verticalAlignment','color_button','backgroundColor','addApplications','priority','stack','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','User','bluebird','util','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','ChatWebsites','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions'];(function(_0x9c2e7d,_0xb43967){var _0x451b19=function(_0x54b73d){while(--_0x54b73d){_0x9c2e7d['push'](_0x9c2e7d['shift']());}};_0x451b19(++_0xb43967);}(_0x3e4d,0xca));var _0xd3e4=function(_0x113537,_0x2b5a94){_0x113537=_0x113537-0x0;var _0xd7bc92=_0x3e4d[_0x113537];return _0xd7bc92;};'use strict';var BPromise=require(_0xd3e4('0x0'));var Mustache=require('mustache');var util=require(_0xd3e4('0x1'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3e4('0x2'));var querystring=require(_0xd3e4('0x3'));var Redis=require(_0xd3e4('0x4'));var qs=require(_0xd3e4('0x5'));var logger=require(_0xd3e4('0x6'))(_0xd3e4('0x7'));var config=require('../../config/environment');var db=require(_0xd3e4('0x8'))['db'];config[_0xd3e4('0x9')]=_[_0xd3e4('0xa')](config[_0xd3e4('0x9')],{'host':_0xd3e4('0xb'),'port':0x18eb});var socket=require(_0xd3e4('0xc'))(new Redis(config[_0xd3e4('0x9')]));require(_0xd3e4('0xd'))[_0xd3e4('0xe')](socket);var jayson=require(_0xd3e4('0xf'));var client=jayson[_0xd3e4('0x10')]['http']({'port':0x232c});var client9002=jayson[_0xd3e4('0x10')]['http']({'port':0x232a});var client9003=jayson[_0xd3e4('0x10')][_0xd3e4('0x11')]({'port':0x232b});var client9001=jayson[_0xd3e4('0x10')][_0xd3e4('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x3bdff7,_0x520af9,_0x5dde62,_0x407925){return new BPromise(function(_0x3bc99,_0x302d23){var _0x264591=_0x407925||client;return _0x264591['request'](_0x3bdff7,_0x5dde62)[_0xd3e4('0x12')](function(_0x2364f6){logger[_0xd3e4('0x13')](_0xd3e4('0x14'),_0x520af9,'request\x20sent');logger[_0xd3e4('0x15')](_0xd3e4('0x16'),_0x520af9,_0xd3e4('0x17'),JSON[_0xd3e4('0x18')](_0x2364f6));if(_0x2364f6[_0xd3e4('0x19')]){if(_0x2364f6[_0xd3e4('0x19')][_0xd3e4('0x1a')]===0x1f4){logger[_0xd3e4('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x520af9,_0x2364f6[_0xd3e4('0x19')][_0xd3e4('0x1b')]);return _0x302d23(_0x2364f6[_0xd3e4('0x19')][_0xd3e4('0x1b')]);}logger[_0xd3e4('0x19')](_0xd3e4('0x14'),_0x520af9,_0x2364f6['error'][_0xd3e4('0x1b')]);return _0x3bc99(_0x2364f6[_0xd3e4('0x19')][_0xd3e4('0x1b')]);}else{logger['info'](_0xd3e4('0x14'),_0x520af9,'request\x20sent');_0x3bc99(_0x2364f6[_0xd3e4('0x1c')][_0xd3e4('0x1b')]);}})['catch'](function(_0x14248b){logger[_0xd3e4('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x520af9,_0x14248b);_0x302d23(_0x14248b);});});}function respondWithStatusCode(_0x36cd2e,_0x3c1f62){_0x3c1f62=_0x3c1f62||0xcc;return function(_0x2fdd47){if(_0x2fdd47){return _0x36cd2e[_0xd3e4('0x1d')](_0x3c1f62);}return _0x36cd2e[_0xd3e4('0x1e')](_0x3c1f62)[_0xd3e4('0x1f')]();};}function respondWithResult(_0xa1a086,_0x52d547){_0x52d547=_0x52d547||0xc8;return function(_0x29fcff){if(_0x29fcff){return _0xa1a086[_0xd3e4('0x1e')](_0x52d547)[_0xd3e4('0x20')](_0x29fcff);}};}function respondWithFilteredResult(_0x28b60b,_0x55dc04){return function(_0x8c7e5f){if(_0x8c7e5f){var _0x2c3a48=typeof _0x55dc04[_0xd3e4('0x21')]===_0xd3e4('0x22')&&typeof _0x55dc04[_0xd3e4('0x23')]===_0xd3e4('0x22');var _0x1dbc00=_0x8c7e5f[_0xd3e4('0x24')];var _0x1b887e=_0x2c3a48?0x0:_0x55dc04[_0xd3e4('0x21')];var _0x10edda=_0x2c3a48?_0x8c7e5f[_0xd3e4('0x24')]:_0x55dc04[_0xd3e4('0x21')]+_0x55dc04['limit'];var _0x1c5a63;if(_0x10edda>=_0x1dbc00){_0x10edda=_0x1dbc00;_0x1c5a63=0xc8;}else{_0x1c5a63=0xce;}_0x28b60b[_0xd3e4('0x1e')](_0x1c5a63);return _0x28b60b[_0xd3e4('0x25')](_0xd3e4('0x26'),_0x1b887e+'-'+_0x10edda+'/'+_0x1dbc00)[_0xd3e4('0x20')](_0x8c7e5f);}return null;};}function saveUpdates(_0x5cd969){return function(_0x578cd0){if(_0x578cd0){return _0x578cd0['update'](_0x5cd969)[_0xd3e4('0x12')](function(_0x199776){return _0x199776;});}return null;};}function removeEntity(_0x12eb4c){return function(_0x11741f){if(_0x11741f){return _0x11741f[_0xd3e4('0x27')]()[_0xd3e4('0x12')](function(){var _0x3867c8=_0x11741f['get']({'plain':!![]});var _0x549d6a=_0xd3e4('0x28');return db[_0xd3e4('0x29')][_0xd3e4('0x27')]({'where':{'type':_0x549d6a,'resourceId':_0x3867c8['id']}})['then'](function(){return _0x11741f;});})['then'](function(){_0x12eb4c[_0xd3e4('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x290ac5){return function(_0x4a987b){if(!_0x4a987b){_0x290ac5['sendStatus'](0x194);}return _0x4a987b;};}function handleError(_0x5e2009,_0x9f0a04){_0x9f0a04=_0x9f0a04||0x1f4;return function(_0x38d158){logger[_0xd3e4('0x19')](_0x38d158['stack']);if(_0x38d158[_0xd3e4('0x2a')]){delete _0x38d158[_0xd3e4('0x2a')];}_0x5e2009['status'](_0x9f0a04)[_0xd3e4('0x2b')](_0x38d158);};}exports[_0xd3e4('0x2c')]=function(_0xaec93e,_0x17dff2){var _0x477d57={'include':[{'model':db[_0xd3e4('0x2d')],'as':_0xd3e4('0x2e')}]},_0x26662a={},_0x561793={'count':0x0,'rows':[]};var _0x10b870=_[_0xd3e4('0x2f')](db[_0xd3e4('0x30')][_0xd3e4('0x31')],function(_0xf3013b){return{'name':_0xf3013b['fieldName'],'type':_0xf3013b[_0xd3e4('0x32')][_0xd3e4('0x33')]};});_0x26662a[_0xd3e4('0x34')]=_[_0xd3e4('0x2f')](_0x10b870,'name');_0x26662a[_0xd3e4('0x35')]=_['keys'](_0xaec93e['query']);_0x26662a[_0xd3e4('0x36')]=_[_0xd3e4('0x37')](_0x26662a['model'],_0x26662a['query']);_0x477d57[_0xd3e4('0x38')]=_[_0xd3e4('0x37')](_0x26662a['model'],qs[_0xd3e4('0x39')](_0xaec93e[_0xd3e4('0x35')]['fields']));_0x477d57[_0xd3e4('0x38')]=_0x477d57[_0xd3e4('0x38')][_0xd3e4('0x3a')]?_0x477d57[_0xd3e4('0x38')]:_0x26662a[_0xd3e4('0x34')];if(!_0xaec93e[_0xd3e4('0x35')]['hasOwnProperty'](_0xd3e4('0x3b'))){_0x477d57[_0xd3e4('0x23')]=qs[_0xd3e4('0x23')](_0xaec93e[_0xd3e4('0x35')][_0xd3e4('0x23')]);_0x477d57[_0xd3e4('0x21')]=qs[_0xd3e4('0x21')](_0xaec93e[_0xd3e4('0x35')]['offset']);}_0x477d57[_0xd3e4('0x3c')]=qs[_0xd3e4('0x3d')](_0xaec93e[_0xd3e4('0x35')][_0xd3e4('0x3d')]);_0x477d57[_0xd3e4('0x3e')]=qs[_0xd3e4('0x36')](_['pick'](_0xaec93e['query'],_0x26662a[_0xd3e4('0x36')]),_0x10b870);if(_0xaec93e[_0xd3e4('0x35')]['filter']){_0x477d57[_0xd3e4('0x3e')]=_[_0xd3e4('0x3f')](_0x477d57[_0xd3e4('0x3e')],{'$or':_[_0xd3e4('0x2f')](_0x10b870,function(_0x10c81f){if(_0x10c81f['type']!==_0xd3e4('0x40')){var _0x592047={};_0x592047[_0x10c81f[_0xd3e4('0x2a')]]={'$like':'%'+_0xaec93e[_0xd3e4('0x35')][_0xd3e4('0x41')]+'%'};return _0x592047;}})});}_0x477d57=_[_0xd3e4('0x3f')]({},_0x477d57,_0xaec93e[_0xd3e4('0x42')]);var _0x26914d={'where':_0x477d57[_0xd3e4('0x3e')]};return db[_0xd3e4('0x30')]['count'](_0x26914d)[_0xd3e4('0x12')](function(_0x54fbc0){_0x561793[_0xd3e4('0x24')]=_0x54fbc0;if(_0xaec93e[_0xd3e4('0x35')][_0xd3e4('0x43')]){_0x477d57[_0xd3e4('0x44')]=[{'all':!![]}];}return db[_0xd3e4('0x30')][_0xd3e4('0x45')](_0x477d57);})[_0xd3e4('0x12')](function(_0x5cf1ec){_0x561793[_0xd3e4('0x46')]=_0x5cf1ec;return _0x561793;})['then'](respondWithFilteredResult(_0x17dff2,_0x477d57))[_0xd3e4('0x47')](handleError(_0x17dff2,null));};exports[_0xd3e4('0x48')]=function(_0x3d05e6,_0x36f7b7){var _0x2d8cde={'raw':![],'where':{'id':_0x3d05e6[_0xd3e4('0x49')]['id']},'include':[{'model':db['Pause'],'as':_0xd3e4('0x2e')}]},_0x1869e0={};_0x1869e0['model']=_[_0xd3e4('0x4a')](db[_0xd3e4('0x30')]['rawAttributes']);_0x1869e0[_0xd3e4('0x35')]=_[_0xd3e4('0x4a')](_0x3d05e6[_0xd3e4('0x35')]);_0x1869e0[_0xd3e4('0x36')]=_[_0xd3e4('0x37')](_0x1869e0[_0xd3e4('0x34')],_0x1869e0['query']);_0x2d8cde[_0xd3e4('0x38')]=_['intersection'](_0x1869e0[_0xd3e4('0x34')],qs['fields'](_0x3d05e6['query'][_0xd3e4('0x39')]));_0x2d8cde[_0xd3e4('0x38')]=_0x2d8cde[_0xd3e4('0x38')][_0xd3e4('0x3a')]?_0x2d8cde[_0xd3e4('0x38')]:_0x1869e0[_0xd3e4('0x34')];if(_0x3d05e6[_0xd3e4('0x35')][_0xd3e4('0x43')]){_0x2d8cde[_0xd3e4('0x44')]=[{'all':!![]}];}_0x2d8cde=_[_0xd3e4('0x3f')]({},_0x2d8cde,_0x3d05e6[_0xd3e4('0x42')]);return db['ChatWebsite'][_0xd3e4('0x4b')](_0x2d8cde)['then'](handleEntityNotFound(_0x36f7b7,null))[_0xd3e4('0x12')](respondWithResult(_0x36f7b7,null))['catch'](handleError(_0x36f7b7,null));};exports[_0xd3e4('0x4c')]=function(_0x99eb8d,_0x146b56){return db['ChatWebsite'][_0xd3e4('0x4c')](_0x99eb8d[_0xd3e4('0x4d')],{})['then'](function(_0x37a9dd){var _0x5c539e=_0x99eb8d[_0xd3e4('0x4e')][_0xd3e4('0x4f')]({'plain':!![]});if(!_0x5c539e)throw new Error(_0xd3e4('0x50'));if(_0x5c539e[_0xd3e4('0x51')]===_0xd3e4('0x4e')){var _0x147895=_0x37a9dd[_0xd3e4('0x4f')]({'plain':!![]});var _0x3a094c=_0xd3e4('0x28');return db['UserProfileSection'][_0xd3e4('0x4b')]({'where':{'name':_0x3a094c,'userProfileId':_0x5c539e['userProfileId']},'raw':!![]})[_0xd3e4('0x12')](function(_0x3f9b0a){if(_0x3f9b0a&&_0x3f9b0a['autoAssociation']===0x0){return db[_0xd3e4('0x29')][_0xd3e4('0x4c')]({'name':_0x147895[_0xd3e4('0x2a')],'resourceId':_0x147895['id'],'type':_0x3f9b0a[_0xd3e4('0x2a')],'sectionId':_0x3f9b0a['id']},{})[_0xd3e4('0x12')](function(){return _0x37a9dd;});}else{return _0x37a9dd;}})[_0xd3e4('0x47')](function(_0x3bf7a2){logger[_0xd3e4('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bf7a2);throw _0x3bf7a2;});}return _0x37a9dd;})[_0xd3e4('0x12')](respondWithResult(_0x146b56,0xc9))['catch'](handleError(_0x146b56,null));};exports[_0xd3e4('0x52')]=function(_0x11eae2,_0x410ec4){if(_0x11eae2[_0xd3e4('0x4d')]['id']){delete _0x11eae2['body']['id'];}return db[_0xd3e4('0x30')][_0xd3e4('0x4b')]({'where':{'id':_0x11eae2['params']['id']},'include':[{'model':db[_0xd3e4('0x2d')],'as':_0xd3e4('0x2e')}]})[_0xd3e4('0x12')](handleEntityNotFound(_0x410ec4,null))[_0xd3e4('0x12')](saveUpdates(_0x11eae2[_0xd3e4('0x4d')],null))['then'](respondWithResult(_0x410ec4,null))[_0xd3e4('0x47')](handleError(_0x410ec4,null));};exports[_0xd3e4('0x27')]=function(_0x1addc0,_0x2cf101){return db[_0xd3e4('0x30')][_0xd3e4('0x4b')]({'where':{'id':_0x1addc0[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x2cf101,null))[_0xd3e4('0x12')](removeEntity(_0x2cf101,null))[_0xd3e4('0x47')](handleError(_0x2cf101,null));};exports[_0xd3e4('0x53')]=function(_0x5291ed,_0x2e09ab){return db[_0xd3e4('0x30')][_0xd3e4('0x53')]()[_0xd3e4('0x12')](respondWithResult(_0x2e09ab,null))[_0xd3e4('0x47')](handleError(_0x2e09ab,null));};exports[_0xd3e4('0x54')]=function(_0x54130d,_0x2705bf){if(_0x54130d[_0xd3e4('0x4d')]['id']){delete _0x54130d[_0xd3e4('0x4d')]['id'];}return db['ChatWebsite'][_0xd3e4('0x4b')]({'where':{'id':_0x54130d['params']['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x2705bf,null))[_0xd3e4('0x12')](function(_0x22368c){if(_0x22368c){_0x54130d[_0xd3e4('0x4d')][_0xd3e4('0x55')]=_0x22368c['id'];return db[_0xd3e4('0x56')]['create'](_0x54130d['body']);}})[_0xd3e4('0x12')](respondWithResult(_0x2705bf,null))[_0xd3e4('0x47')](handleError(_0x2705bf,null));};exports[_0xd3e4('0x57')]=function(_0x193385,_0x1a5369){var _0x351df2={'raw':![],'where':{}};var _0x37dbec={};var _0x52e04e={'count':0x0,'rows':[]};return db[_0xd3e4('0x30')][_0xd3e4('0x58')]({'where':{'id':_0x193385[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x1a5369,null))[_0xd3e4('0x12')](function(_0x30ea25){if(_0x30ea25){_0x37dbec['model']=_[_0xd3e4('0x4a')](db[_0xd3e4('0x56')][_0xd3e4('0x31')]);_0x37dbec[_0xd3e4('0x35')]=_['keys'](_0x193385['query']);_0x37dbec['filters']=_[_0xd3e4('0x37')](_0x37dbec[_0xd3e4('0x34')],_0x37dbec[_0xd3e4('0x35')]);_0x351df2[_0xd3e4('0x38')]=_[_0xd3e4('0x37')](_0x37dbec['model'],qs['fields'](_0x193385[_0xd3e4('0x35')][_0xd3e4('0x39')]));_0x351df2[_0xd3e4('0x38')]=_0x351df2[_0xd3e4('0x38')][_0xd3e4('0x3a')]?_0x351df2[_0xd3e4('0x38')]:_0x37dbec[_0xd3e4('0x34')];if(!_0x193385[_0xd3e4('0x35')][_0xd3e4('0x59')](_0xd3e4('0x3b'))){_0x351df2[_0xd3e4('0x23')]=qs[_0xd3e4('0x23')](_0x193385[_0xd3e4('0x35')]['limit']);_0x351df2[_0xd3e4('0x21')]=qs[_0xd3e4('0x21')](_0x193385['query'][_0xd3e4('0x21')]);}_0x351df2[_0xd3e4('0x3c')]=qs[_0xd3e4('0x3d')](_0x193385[_0xd3e4('0x35')][_0xd3e4('0x3d')]);_0x351df2[_0xd3e4('0x3e')]=qs[_0xd3e4('0x36')](_['pick'](_0x193385[_0xd3e4('0x35')],_0x37dbec[_0xd3e4('0x36')]));_0x351df2[_0xd3e4('0x3e')][_0xd3e4('0x55')]=_0x30ea25['id'];if(_0x193385[_0xd3e4('0x35')]['filter']){_0x351df2[_0xd3e4('0x3e')]=_['merge'](_0x351df2[_0xd3e4('0x3e')],{'$or':_[_0xd3e4('0x2f')](_0x351df2[_0xd3e4('0x38')],function(_0x42c893){var _0x44a73c={};_0x44a73c[_0x42c893]={'$like':'%'+_0x193385['query'][_0xd3e4('0x41')]+'%'};return _0x44a73c;})});}_0x351df2=_[_0xd3e4('0x3f')]({},_0x351df2,_0x193385[_0xd3e4('0x42')]);return db[_0xd3e4('0x56')][_0xd3e4('0x24')]({'where':_0x351df2[_0xd3e4('0x3e')]})[_0xd3e4('0x12')](function(_0x1bbaa7){_0x52e04e['count']=_0x1bbaa7;if(_0x193385[_0xd3e4('0x35')]['includeAll']){_0x351df2[_0xd3e4('0x44')]=[{'all':!![]}];}return db[_0xd3e4('0x56')][_0xd3e4('0x45')](_0x351df2);})[_0xd3e4('0x12')](function(_0x4626ed){_0x52e04e[_0xd3e4('0x46')]=_0x4626ed;return _0x52e04e;});}})['then'](respondWithFilteredResult(_0x1a5369,_0x351df2))[_0xd3e4('0x47')](handleError(_0x1a5369,null));};exports[_0xd3e4('0x5a')]=function(_0x36635f,_0x10e3ee){return db[_0xd3e4('0x30')][_0xd3e4('0x4b')]({'where':{'id':_0x36635f[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x10e3ee,null))[_0xd3e4('0x12')](function(_0x196ed2){if(_0x196ed2){return _0x196ed2['removeDispositions'](_0x36635f[_0xd3e4('0x35')][_0xd3e4('0x5b')]);}})[_0xd3e4('0x12')](respondWithStatusCode(_0x10e3ee,null))[_0xd3e4('0x47')](handleError(_0x10e3ee,null));};exports['addAnswer']=function(_0x4ba8e3,_0x3a4c3e){if(_0x4ba8e3[_0xd3e4('0x4d')]['id']){delete _0x4ba8e3[_0xd3e4('0x4d')]['id'];}return db[_0xd3e4('0x30')]['find']({'where':{'id':_0x4ba8e3[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x3a4c3e,null))[_0xd3e4('0x12')](function(_0x522bd5){if(_0x522bd5){_0x4ba8e3[_0xd3e4('0x4d')][_0xd3e4('0x55')]=_0x522bd5['id'];return db['CannedAnswer'][_0xd3e4('0x4c')](_0x4ba8e3[_0xd3e4('0x4d')]);}})['then'](respondWithResult(_0x3a4c3e,null))['catch'](handleError(_0x3a4c3e,null));};exports[_0xd3e4('0x5c')]=function(_0x518a86,_0x2ad459){var _0x3980f5={'raw':![],'where':{}};var _0x50004c={};var _0x44aa62={'count':0x0,'rows':[]};return db[_0xd3e4('0x30')][_0xd3e4('0x58')]({'where':{'id':_0x518a86[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x2ad459,null))[_0xd3e4('0x12')](function(_0x4c26f2){if(_0x4c26f2){_0x50004c[_0xd3e4('0x34')]=_[_0xd3e4('0x4a')](db[_0xd3e4('0x5d')][_0xd3e4('0x31')]);_0x50004c[_0xd3e4('0x35')]=_[_0xd3e4('0x4a')](_0x518a86['query']);_0x50004c[_0xd3e4('0x36')]=_[_0xd3e4('0x37')](_0x50004c[_0xd3e4('0x34')],_0x50004c[_0xd3e4('0x35')]);_0x3980f5['attributes']=_[_0xd3e4('0x37')](_0x50004c[_0xd3e4('0x34')],qs[_0xd3e4('0x39')](_0x518a86[_0xd3e4('0x35')][_0xd3e4('0x39')]));_0x3980f5['attributes']=_0x3980f5[_0xd3e4('0x38')][_0xd3e4('0x3a')]?_0x3980f5[_0xd3e4('0x38')]:_0x50004c[_0xd3e4('0x34')];if(!_0x518a86[_0xd3e4('0x35')][_0xd3e4('0x59')](_0xd3e4('0x3b'))){_0x3980f5[_0xd3e4('0x23')]=qs[_0xd3e4('0x23')](_0x518a86[_0xd3e4('0x35')][_0xd3e4('0x23')]);_0x3980f5['offset']=qs['offset'](_0x518a86[_0xd3e4('0x35')][_0xd3e4('0x21')]);}_0x3980f5[_0xd3e4('0x3c')]=qs['sort'](_0x518a86[_0xd3e4('0x35')][_0xd3e4('0x3d')]);_0x3980f5[_0xd3e4('0x3e')]=qs[_0xd3e4('0x36')](_['pick'](_0x518a86['query'],_0x50004c['filters']));_0x3980f5[_0xd3e4('0x3e')][_0xd3e4('0x55')]=_0x4c26f2['id'];if(_0x518a86[_0xd3e4('0x35')]['filter']){_0x3980f5[_0xd3e4('0x3e')]=_[_0xd3e4('0x3f')](_0x3980f5[_0xd3e4('0x3e')],{'$or':_[_0xd3e4('0x2f')](_0x3980f5[_0xd3e4('0x38')],function(_0x38e97d){var _0x3d9c2a={};_0x3d9c2a[_0x38e97d]={'$like':'%'+_0x518a86[_0xd3e4('0x35')]['filter']+'%'};return _0x3d9c2a;})});}_0x3980f5=_[_0xd3e4('0x3f')]({},_0x3980f5,_0x518a86[_0xd3e4('0x42')]);return db[_0xd3e4('0x5d')][_0xd3e4('0x24')]({'where':_0x3980f5['where']})[_0xd3e4('0x12')](function(_0x359163){_0x44aa62[_0xd3e4('0x24')]=_0x359163;if(_0x518a86[_0xd3e4('0x35')][_0xd3e4('0x43')]){_0x3980f5[_0xd3e4('0x44')]=[{'all':!![]}];}return db[_0xd3e4('0x5d')][_0xd3e4('0x45')](_0x3980f5);})['then'](function(_0x45cd51){_0x44aa62[_0xd3e4('0x46')]=_0x45cd51;return _0x44aa62;});}})['then'](respondWithFilteredResult(_0x2ad459,_0x3980f5))['catch'](handleError(_0x2ad459,null));};exports[_0xd3e4('0x5e')]=function(_0x8d1df6,_0x436117){return db[_0xd3e4('0x30')][_0xd3e4('0x4b')]({'where':{'id':_0x8d1df6[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x436117,null))[_0xd3e4('0x12')](function(_0x41fef4){if(_0x41fef4){return _0x41fef4[_0xd3e4('0x5e')](_0x8d1df6['query'][_0xd3e4('0x5b')]);}})['then'](respondWithStatusCode(_0x436117,null))[_0xd3e4('0x47')](handleError(_0x436117,null));};exports[_0xd3e4('0x5f')]=function(_0x36a916,_0x2ab6a5){_0x36a916[_0xd3e4('0x4d')][_0xd3e4('0x60')]=_0x36a916[_0xd3e4('0x61')][_0xd3e4('0x62')];return db[_0xd3e4('0x30')]['find']({'where':{'id':_0x36a916[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x2ab6a5,null))['then'](saveUpdates(_0x36a916[_0xd3e4('0x4d')],null))['then'](respondWithResult(_0x2ab6a5,null))[_0xd3e4('0x47')](handleError(_0x2ab6a5,null));};exports[_0xd3e4('0x63')]=function(_0x2cc3c5,_0x43e9f1){_0x2cc3c5[_0xd3e4('0x4d')]['agentAvatar']=_0x2cc3c5[_0xd3e4('0x61')][_0xd3e4('0x62')];return db[_0xd3e4('0x30')]['find']({'where':{'id':_0x2cc3c5[_0xd3e4('0x49')]['id']}})['then'](handleEntityNotFound(_0x43e9f1,null))[_0xd3e4('0x12')](saveUpdates(_0x2cc3c5[_0xd3e4('0x4d')],null))['then'](respondWithResult(_0x43e9f1,null))[_0xd3e4('0x47')](handleError(_0x43e9f1,null));};exports[_0xd3e4('0x64')]=function(_0x33b1e8,_0x4fb5cd){_0x33b1e8['body']['customerAvatar']=_0x33b1e8[_0xd3e4('0x61')][_0xd3e4('0x62')];return db[_0xd3e4('0x30')]['find']({'where':{'id':_0x33b1e8[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x4fb5cd,null))['then'](saveUpdates(_0x33b1e8['body'],null))[_0xd3e4('0x12')](respondWithResult(_0x4fb5cd,null))[_0xd3e4('0x47')](handleError(_0x4fb5cd,null));};exports[_0xd3e4('0x65')]=function(_0x547da3,_0x29db1c){_0x547da3[_0xd3e4('0x4d')][_0xd3e4('0x66')]=_0x547da3[_0xd3e4('0x61')]['filename'];return db[_0xd3e4('0x30')][_0xd3e4('0x4b')]({'where':{'id':_0x547da3['params']['id']}})['then'](handleEntityNotFound(_0x29db1c,null))[_0xd3e4('0x12')](saveUpdates(_0x547da3['body'],null))[_0xd3e4('0x12')](respondWithResult(_0x29db1c,null))['catch'](handleError(_0x29db1c,null));};exports[_0xd3e4('0x67')]=function(_0x3ee935,_0x31287c){var _0x356d59=path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],_0xd3e4('0x6a'));var _0xb99395={'where':{'id':_0x3ee935['params']['id']},'attributes':['id',_0xd3e4('0x60')],'raw':!![]};var _0x2f5213=![];return require(_0xd3e4('0x6b'))['getLicense']()[_0xd3e4('0x12')](function(_0x526f46){if(_0x526f46){_0x2f5213=_0x526f46[_0xd3e4('0x6c')];}})[_0xd3e4('0x12')](function(){return db[_0xd3e4('0x30')][_0xd3e4('0x4b')](_0xb99395);})['then'](handleEntityNotFound(_0x31287c,null))['then'](function(_0x5525aa){if(_0x5525aa){if(!_[_0xd3e4('0x6d')](_0x5525aa[_0xd3e4('0x60')])){if(fs[_0xd3e4('0x6e')](path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],'server/files/images/logos/',_0x5525aa[_0xd3e4('0x60')]))&&_0x2f5213){_0x356d59=path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],_0xd3e4('0x6f'),_0x5525aa[_0xd3e4('0x60')]);}}return _0x31287c[_0xd3e4('0x70')](_0x356d59);}})[_0xd3e4('0x47')](handleError(_0x31287c,null));};exports[_0xd3e4('0x71')]=function(_0x53c911,_0x2d26ec){var _0x5a8638=path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],_0xd3e4('0x72'));var _0x4de1e3={'where':{'id':_0x53c911[_0xd3e4('0x49')]['id']},'attributes':['id',_0xd3e4('0x73')],'raw':!![]};return db['ChatWebsite'][_0xd3e4('0x4b')](_0x4de1e3)[_0xd3e4('0x12')](handleEntityNotFound(_0x2d26ec,null))[_0xd3e4('0x12')](function(_0x1437d8){if(_0x1437d8){if(!_[_0xd3e4('0x6d')](_0x1437d8[_0xd3e4('0x73')])){if(fs[_0xd3e4('0x6e')](path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],_0xd3e4('0x74'),_0x1437d8[_0xd3e4('0x73')]))){_0x5a8638=path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],_0xd3e4('0x74'),_0x1437d8[_0xd3e4('0x73')]);}}return _0x2d26ec[_0xd3e4('0x70')](_0x5a8638);}})[_0xd3e4('0x47')](handleError(_0x2d26ec,null));};exports[_0xd3e4('0x75')]=function(_0x349bda,_0x8230b0){var _0x1e7712=path['join'](config['root'],_0xd3e4('0x76'));var _0x2a63b7={'where':{'id':_0x349bda[_0xd3e4('0x49')]['id']},'attributes':['id',_0xd3e4('0x77'),'showCustomerAvatar'],'raw':!![]};return db[_0xd3e4('0x30')][_0xd3e4('0x4b')](_0x2a63b7)[_0xd3e4('0x12')](handleEntityNotFound(_0x8230b0,null))[_0xd3e4('0x12')](function(_0x540b29){if(_0x540b29){if(!_[_0xd3e4('0x6d')](_0x540b29[_0xd3e4('0x77')])){if(fs[_0xd3e4('0x6e')](path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],_0xd3e4('0x74'),_0x540b29[_0xd3e4('0x77')]))&&_0x540b29[_0xd3e4('0x78')]){_0x1e7712=path['join'](config['root'],'server/files/images/avatars/',_0x540b29['customerAvatar']);}}return _0x8230b0[_0xd3e4('0x70')](_0x1e7712);}})['catch'](handleError(_0x8230b0,null));};exports['getSystemAvatar']=function(_0x1c226f,_0x2eb1bc){var _0x2cf9e7=path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],_0xd3e4('0x79'));var _0x289953={'where':{'id':_0x1c226f['params']['id']},'attributes':['id',_0xd3e4('0x66')],'raw':!![]};return db[_0xd3e4('0x30')][_0xd3e4('0x4b')](_0x289953)[_0xd3e4('0x12')](handleEntityNotFound(_0x2eb1bc,null))['then'](function(_0x258f98){if(_0x258f98){if(!_[_0xd3e4('0x6d')](_0x258f98[_0xd3e4('0x66')])){if(fs[_0xd3e4('0x6e')](path['join'](config[_0xd3e4('0x69')],_0xd3e4('0x74'),_0x258f98[_0xd3e4('0x66')]))){_0x2cf9e7=path[_0xd3e4('0x68')](config['root'],_0xd3e4('0x74'),_0x258f98[_0xd3e4('0x66')]);}}return _0x2eb1bc[_0xd3e4('0x70')](_0x2cf9e7);}})[_0xd3e4('0x47')](handleError(_0x2eb1bc,null));};exports[_0xd3e4('0x7a')]=function(_0x2a711c,_0x1697e5){var _0x1858c1=require('user-agent-parser');var _0xc31606=new _0x1858c1();var _0x5cb658=_0xc31606[_0xd3e4('0x7b')](_0x2a711c['headers'][_0xd3e4('0x7c')])[_0xd3e4('0x7d')]();var _0x589a39={'body':_0x2a711c[_0xd3e4('0x4d')],'channel':_0xd3e4('0x7e')};var _0x4218d9=[];var _0x1f9dae=[];var _0x4efbf3={};var _0xc4b391=![];return db[_0xd3e4('0x7f')]['describe']()[_0xd3e4('0x12')](function(_0x2029a1){if(!_0x2029a1){throw new db[(_0xd3e4('0x80'))][(_0xd3e4('0x81'))](_0xd3e4('0x82'));}_0x4218d9=_[_0xd3e4('0x83')](_[_0xd3e4('0x4a')](_0x2029a1),[_0xd3e4('0x84'),_0xd3e4('0x85')]);_0x1f9dae=_['difference'](_[_0xd3e4('0x4a')](_0x2029a1),[_0xd3e4('0x84'),_0xd3e4('0x85'),_0xd3e4('0x86'),_0xd3e4('0x87')]);if(_0x2a711c[_0xd3e4('0x4d')]['id']){delete _0x2a711c[_0xd3e4('0x4d')]['id'];}if(_['isNil'](_0x2a711c['body'][_0xd3e4('0x88')])){throw new db[(_0xd3e4('0x80'))][(_0xd3e4('0x81'))](_0xd3e4('0x89'));}if(_['isNil'](_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0x4d')])||_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0x4d')]===''){throw new db[(_0xd3e4('0x80'))][(_0xd3e4('0x81'))](_0xd3e4('0x8a'));}if(_[_0xd3e4('0x6d')](_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0x8b')])){throw new db[(_0xd3e4('0x80'))][(_0xd3e4('0x81'))](_0xd3e4('0x8c')+_0x1f9dae);}if(!_[_0xd3e4('0x8d')](_0x1f9dae,_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0x8b')])){throw new db[(_0xd3e4('0x80'))][(_0xd3e4('0x81'))](_0xd3e4('0x8e')+_0x1f9dae);}_0x4efbf3[_0x2a711c[_0xd3e4('0x4d')]['mapKey']]=_0x2a711c['body'][_0xd3e4('0x88')];})['then'](function(){return db[_0xd3e4('0x30')]['find']({'where':{'id':_0x2a711c[_0xd3e4('0x49')]['id']},'include':[{'model':db[_0xd3e4('0x8f')],'as':_0xd3e4('0x90'),'include':[{'model':db[_0xd3e4('0x7f')],'as':_0xd3e4('0x91'),'where':_0x4efbf3,'limit':0x1,'order':[[_0xd3e4('0x85'),'DESC']]}]},{'model':db[_0xd3e4('0x92')],'as':_0xd3e4('0x93')}]});})[_0xd3e4('0x12')](handleEntityNotFound(_0x1697e5,null))[_0xd3e4('0x12')](function(_0x27511c){if(_0x27511c&&_0x27511c[_0xd3e4('0x90')]){_0x589a39[_0xd3e4('0x94')]=_0x27511c;_0x589a39[_0xd3e4('0x95')]=_0x27511c[_0xd3e4('0x93')];_0x589a39[_0xd3e4('0x96')]=_0x27511c[_0xd3e4('0x90')];_0x589a39['applications']=_[_0xd3e4('0x97')](_0x589a39[_0xd3e4('0x95')],['priority'],['asc']);if(_0x589a39[_0xd3e4('0x94')][_0xd3e4('0x93')]){delete _0x589a39[_0xd3e4('0x94')][_0xd3e4('0x93')];}if(_0x589a39[_0xd3e4('0x94')][_0xd3e4('0x90')]&&_0x589a39[_0xd3e4('0x94')][_0xd3e4('0x90')]['Contacts'][_0xd3e4('0x3a')]){return _0x589a39[_0xd3e4('0x94')][_0xd3e4('0x90')]['Contacts'][0x0];}var _0x9eac8=_[_0xd3e4('0xa')](_0x2a711c[_0xd3e4('0x4d')],{'firstName':_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0x88')],'ListId':_0x27511c[_0xd3e4('0x87')]});_0x9eac8[_0x2a711c['body'][_0xd3e4('0x8b')]]=_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0x88')];return db[_0xd3e4('0x7f')][_0xd3e4('0x4c')](_0x9eac8,{'fields':_0x4218d9,'raw':!![]});}})[_0xd3e4('0x12')](handleEntityNotFound(_0x1697e5,null))['then'](function(_0x19af8e){_0x589a39[_0xd3e4('0x98')]=_0x19af8e;var _0x298eea=_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0x99')];if(_0x2a711c['headers'][_0xd3e4('0x9a')]){_0x298eea=_0x2a711c[_0xd3e4('0x9b')][_0xd3e4('0x9a')];}else if(_0x2a711c[_0xd3e4('0x9b')][_0xd3e4('0x9c')]){_0x298eea=_[_0xd3e4('0x9d')](_0x2a711c[_0xd3e4('0x9b')][_0xd3e4('0x9c')][_0xd3e4('0x9e')](','));}if(_0x19af8e){var _0x28d1f5={'ContactId':_0x19af8e['id'],'ChatWebsiteId':_0x2a711c['params']['id'],'from':(_0x19af8e[_0xd3e4('0x9f')]||'')+'\x20'+(_0x19af8e[_0xd3e4('0xa0')]||''),'customerIp':_0x298eea,'customerPort':_0x2a711c[_0xd3e4('0x9b')][_0xd3e4('0xa1')]?_0x2a711c[_0xd3e4('0x9b')][_0xd3e4('0xa1')]:null,'referer':_0x2a711c['body'][_0xd3e4('0xa2')],'browserName':_0x5cb658[_0xd3e4('0xa3')][_0xd3e4('0x2a')]&&_0x5cb658[_0xd3e4('0xa3')][_0xd3e4('0xa4')]?util[_0xd3e4('0xa5')](_0xd3e4('0xa6'),_0x5cb658[_0xd3e4('0xa3')][_0xd3e4('0x2a')],_0x5cb658[_0xd3e4('0xa3')][_0xd3e4('0xa4')]):_0xd3e4('0xa7'),'browserVersion':_0x5cb658[_0xd3e4('0xa3')][_0xd3e4('0xa4')]||_0xd3e4('0xa7'),'osName':util[_0xd3e4('0xa5')](_0xd3e4('0xa6'),_0x5cb658['os'][_0xd3e4('0x2a')],_0x5cb658['os'][_0xd3e4('0xa4')]),'osVersion':_0x5cb658['os'][_0xd3e4('0xa4')],'deviceModel':_0x5cb658[_0xd3e4('0xa8')][_0xd3e4('0x34')]&&_0x5cb658['device']['vendor']?util[_0xd3e4('0xa5')](_0xd3e4('0xa9'),_0x5cb658[_0xd3e4('0xa8')][_0xd3e4('0x34')],_0x5cb658[_0xd3e4('0xa8')][_0xd3e4('0xaa')],_0x5cb658[_0xd3e4('0xa8')]['type']):null,'deviceVendor':_0x5cb658[_0xd3e4('0xa8')][_0xd3e4('0xaa')],'deviceType':_0x5cb658['device'][_0xd3e4('0x32')],'formData':JSON[_0xd3e4('0x18')](_0x2a711c[_0xd3e4('0x4d')])};var _0x376ab4={'ChatWebsiteId':_0x2a711c[_0xd3e4('0x49')]['id'],'closed':![]};if(_0x2a711c[_0xd3e4('0x4d')]['threadId']){_0x376ab4['threadId']=_0x2a711c[_0xd3e4('0x4d')]['threadId'];return db['ChatInteraction'][_0xd3e4('0x4b')]({'where':_0x376ab4})['then'](function(_0xb72eb6){if(_0xb72eb6){return[_0xb72eb6,![]];}_0x28d1f5[_0xd3e4('0xab')]=_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0xab')];_0x28d1f5[_0xd3e4('0xac')]=_0x2a711c[_0xd3e4('0x4d')]['externalUrl'];return db['ChatInteraction'][_0xd3e4('0x4c')](_0x28d1f5)[_0xd3e4('0x12')](function(_0x5cfaed){return[_0x5cfaed,!![]];});});}_0x376ab4[_0xd3e4('0xad')]=_0x19af8e['id'];if(_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0xae')]&&_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0xae')]['id']){_0x376ab4['id']=_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0xae')]['id'];return db[_0xd3e4('0xaf')]['find']({'where':_0x376ab4})[_0xd3e4('0x12')](function(_0x2dcfe4){if(_0x2dcfe4){return[_0x2dcfe4,![]];}return db[_0xd3e4('0xaf')][_0xd3e4('0x4c')](_0x28d1f5)[_0xd3e4('0x12')](function(_0x158a33){return[_0x158a33,!![]];});});}return db[_0xd3e4('0xaf')]['create'](_0x28d1f5)[_0xd3e4('0x12')](function(_0x5c7646){return[_0x5c7646,!![]];});}})[_0xd3e4('0xb0')](function(_0x57d7f9,_0x1d9e0e){if(_0x57d7f9){_0xc4b391=_0x1d9e0e;if(!_0x1d9e0e){var _0x5129f0={'from':(_0x589a39[_0xd3e4('0x98')][_0xd3e4('0x9f')]||'')+'\x20'+(_0x589a39[_0xd3e4('0x98')][_0xd3e4('0xa0')]||'')};if(_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0xab')]&&_0x2a711c['body']['messageId']&&_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0xab')]!=_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0xb1')]){_0x5129f0[_0xd3e4('0xab')]=_0x2a711c[_0xd3e4('0x4d')]['messageId'];}return _0x57d7f9[_0xd3e4('0x52')](_0x5129f0);}else{return _0x57d7f9;}}})['then'](function(_0x556d36){_0x589a39[_0xd3e4('0xae')]=_0x556d36['get']({'plain':!![]});_0x589a39[_0xd3e4('0xae')][_0xd3e4('0xb2')]=_0xc4b391;if(_0x589a39[_0xd3e4('0xae')][_0xd3e4('0xb2')]){if(_0x589a39['account'][_0xd3e4('0xb3')]){_0x589a39[_0xd3e4('0x95')]['push']({'id':0x0,'priority':_0x589a39['applications']['length']+0x1,'app':_0xd3e4('0xb4'),'appdata':_0xd3e4('0xb5'),'interval':_0xd3e4('0xb6')});}}return db[_0xd3e4('0xb7')][_0xd3e4('0x4c')]({'body':_0x2a711c[_0xd3e4('0x4d')]['body'],'ChatWebsiteId':_0x2a711c[_0xd3e4('0x49')]['id'],'ChatInteractionId':_0x556d36['id'],'direction':'in','ContactId':_0x589a39[_0xd3e4('0x98')]['id'],'AttachmentId':_0x2a711c[_0xd3e4('0x4d')][_0xd3e4('0xb8')]});})[_0xd3e4('0x12')](function(_0xe7bb0f){_0x589a39['message']=_0xe7bb0f;if(_0x589a39[_0xd3e4('0xae')][_0xd3e4('0xb9')]){return db['User'][_0xd3e4('0x4b')]({'attributes':['id','name'],'where':{'id':_0x589a39[_0xd3e4('0xae')][_0xd3e4('0xb9')]}})['then'](function(_0x35ad6a){if(_0x35ad6a){_0x589a39[_0xd3e4('0x95')][_0xd3e4('0xba')]({'id':0x0,'priority':0x0,'app':_0xd3e4('0xbb'),'appdata':_0x35ad6a[_0xd3e4('0x2a')]+','+(_0x589a39[_0xd3e4('0x94')][_0xd3e4('0xbc')]||0xa),'interval':_0xd3e4('0xb6')});_0x589a39[_0xd3e4('0xbd')]=!![];}return respondWithRpcPromise(_0xd3e4('0xbe'),_0xd3e4('0xbf'),_0x589a39);});}return respondWithRpcPromise(_0xd3e4('0xbe'),'startRouting',_0x589a39);})[_0xd3e4('0x12')](function(_0x3ed2a5){respondWithRpcPromise('EventManager',_0xd3e4('0xc0'),{'event':_0xd3e4('0x7a'),'message':_0x3ed2a5},client9002);return _0x3ed2a5;})[_0xd3e4('0x12')](respondWithResult(_0x1697e5,null))[_0xd3e4('0x47')](handleError(_0x1697e5,null));};exports[_0xd3e4('0xc1')]=function(_0x460b9f,_0x39bce4){var _0x16957d,_0x1252b7,_0x541ede;var _0x61a923=[];var _0x288fa6={};var _0x5163df=_0x460b9f[_0xd3e4('0xc2')]||[];var _0x4aec98=[];var _0x3a2e69;return db['CmContact'][_0xd3e4('0x53')]()[_0xd3e4('0x12')](function(_0x14fac3){if(!_0x14fac3){throw new db['Sequelize']['ValidationError'](_0xd3e4('0x82'));}_0x61a923=_[_0xd3e4('0x83')](_['keys'](_0x14fac3),[_0xd3e4('0x84'),'updatedAt',_0xd3e4('0x86'),_0xd3e4('0x87')]);if(_0x460b9f[_0xd3e4('0x4d')]['id']){delete _0x460b9f[_0xd3e4('0x4d')]['id'];}if(_['isNil'](_0x460b9f['body'][_0xd3e4('0x88')])){throw _0x39bce4['status'](0x1f4)[_0xd3e4('0x2b')](new db[(_0xd3e4('0x80'))][(_0xd3e4('0x81'))](_0xd3e4('0x89')));}if(_[_0xd3e4('0x6d')](_0x460b9f['body'][_0xd3e4('0x4d')])||_0x460b9f[_0xd3e4('0x4d')][_0xd3e4('0x4d')]===''){throw _0x39bce4['status'](0x1f4)[_0xd3e4('0x2b')](new db[(_0xd3e4('0x80'))]['ValidationError'](_0xd3e4('0x8a')));}if(_['isNil'](_0x460b9f[_0xd3e4('0x4d')][_0xd3e4('0xc3')])){throw _0x39bce4['status'](0x1f4)[_0xd3e4('0x2b')](new db[(_0xd3e4('0x80'))]['ValidationError'](_0xd3e4('0xc4')+_0x61a923));}if(!_['includes'](_0x61a923,_0x460b9f[_0xd3e4('0x4d')]['mapKeyOffline'])){throw _0x39bce4['status'](0x1f4)[_0xd3e4('0x2b')](new db[(_0xd3e4('0x80'))][(_0xd3e4('0x81'))](_0xd3e4('0xc5')+_0x61a923));}_0x288fa6[_0x460b9f['body'][_0xd3e4('0xc3')]]=_0x460b9f['body'][_0xd3e4('0x88')];})['then'](function(){return db[_0xd3e4('0x30')][_0xd3e4('0x4b')]({'where':{'id':_0x460b9f[_0xd3e4('0x49')]['id']},'include':[{'model':db[_0xd3e4('0x8f')],'as':_0xd3e4('0x90')},{'model':db[_0xd3e4('0xc6')],'as':_0xd3e4('0xc6')}]});})[_0xd3e4('0x12')](handleEntityNotFound(_0x39bce4,null))['then'](function(_0x545f76){if(_0x545f76&&_0x545f76[_0xd3e4('0x90')]){_0x1252b7=_0x545f76;var _0x568d0e=_[_0xd3e4('0xa')](_0x460b9f['body'],{'firstName':_0x460b9f[_0xd3e4('0x4d')][_0xd3e4('0x88')],'phone':_0x460b9f[_0xd3e4('0x4d')][_0xd3e4('0x88')],'ListId':_0x545f76[_0xd3e4('0x87')]});_0x568d0e[_0x460b9f[_0xd3e4('0x4d')]['mapKeyOffline']]=_0x460b9f[_0xd3e4('0x4d')][_0xd3e4('0x88')];return db[_0xd3e4('0x7f')]['findOrCreate']({'where':_0x288fa6,'defaults':_0x568d0e});}})['spread'](function(_0x5c2e8d){if(_0x5c2e8d){_0x541ede=_0x5c2e8d;var _0x5e54f8=fs[_0xd3e4('0xc7')](path['join'](config['root'],_0xd3e4('0xc8')),_0xd3e4('0xc9'));var _0x17e3da=ejs['render'](_0x5e54f8,{'body':_[_0xd3e4('0xca')](_0x460b9f['body'][_0xd3e4('0x4d')]),'bodyTitle':_0x1252b7[_0xd3e4('0xcb')]});return db[_0xd3e4('0xcc')]['create']({'body':_0x17e3da,'ContactId':_0x5c2e8d['id'],'ChatWebsiteId':_0x1252b7['id']});}})[_0xd3e4('0x12')](function(_0x39b538){_0x3a2e69=_0x39b538;if(_0x5163df['length']){var _0x162bad=_0x5163df['map'](function(_0x2d1414){return{'name':_0x2d1414[_0xd3e4('0xcd')],'basename':_0x2d1414[_0xd3e4('0x62')],'type':_0x2d1414[_0xd3e4('0xce')],'ChatOfflineMessageId':_0x39b538['id']};});_0x4aec98=_0x162bad[_0xd3e4('0x2f')](_0x2e3a1c=>{var _0x4ff485={'filename':_0x2e3a1c['name'],'path':path['join'](config[_0xd3e4('0x69')],_0xd3e4('0xcf'),'files',_0xd3e4('0xd0'),_0xd3e4('0xd1'),_0x2e3a1c['basename'])};return _0x4ff485;});if(!_0x1252b7[_0xd3e4('0xd2')]){return db[_0xd3e4('0xd3')][_0xd3e4('0xd4')](function(_0x2cd612){return db[_0xd3e4('0xd5')][_0xd3e4('0xd6')](_0x162bad,{'transaction':_0x2cd612});});}}})[_0xd3e4('0x12')](function(){if(_0x3a2e69){_0x16957d=_0x3a2e69;return db[_0xd3e4('0xc6')][_0xd3e4('0x58')]({'where':{'active':!![]},'include':[{'model':db[_0xd3e4('0xd7')],'as':_0xd3e4('0xd8'),'raw':!![]}]});}})[_0xd3e4('0x12')](function(_0x2ad255){if(_0x2ad255&&_0x2ad255[_0xd3e4('0xd8')]&&_0x1252b7[_0xd3e4('0xd9')]&&_0x1252b7[_0xd3e4('0xda')]){var _0x423ec7={'tls':{'rejectUnauthorized':![]}};if(_0x2ad255['Smtp'][_0xd3e4('0xdb')]){_0x423ec7['service']=_0x2ad255[_0xd3e4('0xd8')]['service'];}else{_0x423ec7[_0xd3e4('0xdc')]=_0x2ad255[_0xd3e4('0xd8')][_0xd3e4('0xdc')];_0x423ec7['port']=_0x2ad255[_0xd3e4('0xd8')]['port'];_0x423ec7[_0xd3e4('0xdd')]=_0x2ad255[_0xd3e4('0xd8')]['secure'];}if(_0x2ad255[_0xd3e4('0xd8')][_0xd3e4('0xde')]){_0x423ec7[_0xd3e4('0xdf')]={'user':_0x2ad255[_0xd3e4('0xd8')][_0xd3e4('0x4e')],'pass':_0x2ad255[_0xd3e4('0xd8')][_0xd3e4('0xe0')]};}return respondWithRpcPromise(_0xd3e4('0xe1'),_0xd3e4('0xe2'),{'account':_0x423ec7,'message':{'from':util['format'](_0xd3e4('0xe3'),_0x2ad255[_0xd3e4('0x2a')],_0x2ad255[_0xd3e4('0xe4')]||_0x2ad255[_0xd3e4('0xd8')][_0xd3e4('0x4e')]),'to':_0x1252b7[_0xd3e4('0xda')],'subject':_0x1252b7[_0xd3e4('0xe5')],'html':_0x16957d[_0xd3e4('0x4d')],'attachments':_0x4aec98}},client9003)[_0xd3e4('0x12')](function(){return _0x16957d;})[_0xd3e4('0x47')](function(_0x3786d1){console[_0xd3e4('0x19')](_0x3786d1);});}})['then'](function(){if(_0x1252b7&&_0x1252b7['openNewInteraction']&&_0x1252b7[_0xd3e4('0xe6')]){var _0x576dc8=[];if(_0x5163df[_0xd3e4('0x3a')]){_0x576dc8=_0x5163df['map'](function(_0x3e2806){return{'name':_0x3e2806[_0xd3e4('0xcd')],'basename':_0x3e2806[_0xd3e4('0x62')],'type':_0x3e2806[_0xd3e4('0xce')],'ChatOfflineMessageId':_0x3a2e69['id']};});}var _0xef0e49;if(!_[_0xd3e4('0x6d')](_0x1252b7['subjectOffline'])){var _0x3fe062=_[_0xd3e4('0x2f')](_0x460b9f[_0xd3e4('0x4d')],function(_0xb534fd){return _0xb534fd;});var _0x34e105=_[_0xd3e4('0xe7')](_0x3fe062)[0x0];var _0x1dc736=_[_0xd3e4('0xe8')](_0x34e105,function(_0x1b6114){return _0x1b6114;});_0xef0e49=_0x1dc736[0x1][_0x1252b7['subjectOffline']];}var _0x4cebcb={'from':_0x541ede[_0xd3e4('0xe4')],'firstName':_0x541ede['firstName'],'lastName':_0x541ede[_0xd3e4('0xa0')],'mapKey':_0xd3e4('0xe4'),'message':{'from':_0x541ede[_0xd3e4('0xe4')],'to':_0x1252b7[_0xd3e4('0xc6')][_0xd3e4('0xe4')],'cc':'','subject':_['isNil'](_0xef0e49)?_0x1252b7[_0xd3e4('0xe5')]:_0xef0e49,'messageId':'','sentAt':new Date(),'attach':_0x576dc8[_0xd3e4('0x3a')],'attachments':_0x576dc8,'originChannel':'Chat','ChatWebsiteId':_0x1252b7['id'],'ChatOfflineMessageId':_0x16957d['id'],'originTo':_0x1252b7[_0xd3e4('0xc6')][_0xd3e4('0xe4')]},'body':_0x16957d[_0xd3e4('0x4d')]};var _0xf9ac11={'account':{'id':_0x1252b7['MailAccountId']},'body':_0x4cebcb,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xd3e4('0xe9'),_0xd3e4('0xea'),_0xf9ac11,client9001)[_0xd3e4('0x12')](function(){return _0x16957d;})[_0xd3e4('0x47')](function(_0x38c9f9){console['error'](_0x38c9f9);});}return;})[_0xd3e4('0x12')](function(){if(_0x16957d){return _0x16957d;}})['then'](respondWithResult(_0x39bce4,null))[_0xd3e4('0x47')](function(_0x4b04e5){console['error'](_0xd3e4('0x47'),_0x4b04e5);for(var _0x1d9c03 of _0x5163df){var _0x31e47d=path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],_0xd3e4('0xcf'),_0xd3e4('0xc2'),_0xd3e4('0xd0'),_0xd3e4('0xd1'),_0x1d9c03[_0xd3e4('0x62')]);fs_extra[_0xd3e4('0xeb')](_0x31e47d)[_0xd3e4('0x47')](function(_0x1c5565){console['error']('Could\x20not\x20remove\x20attachment\x20file',_0x31e47d,_0x1c5565);});}});};exports[_0xd3e4('0xec')]=function(_0x232125,_0x2c3250){return db['ChatInteraction'][_0xd3e4('0x4b')]({'where':{'id':_0x232125[_0xd3e4('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c3250,null))[_0xd3e4('0x12')](function(_0x4b4175){if(_0x4b4175){return _0x4b4175['addInteraction'](_0x232125[_0xd3e4('0x4d')]['ids'],_[_0xd3e4('0xed')](_0x232125[_0xd3e4('0x4d')],[_0xd3e4('0x5b'),'id'])||{});}})[_0xd3e4('0x12')](respondWithResult(_0x2c3250,null))[_0xd3e4('0x47')](handleError(_0x2c3250,null));};exports[_0xd3e4('0xee')]=function(_0x588a2c,_0x5c08f3){var _0x3f9c4d={'raw':![],'where':{}};var _0xbbeb3f={};var _0x3418a1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd3e4('0x58')]({'where':{'id':_0x588a2c[_0xd3e4('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c08f3,null))[_0xd3e4('0x12')](function(_0x239faa){if(_0x239faa){_0xbbeb3f[_0xd3e4('0x34')]=_['keys'](db[_0xd3e4('0xaf')][_0xd3e4('0x31')]);_0xbbeb3f[_0xd3e4('0x35')]=_[_0xd3e4('0x4a')](_0x588a2c[_0xd3e4('0x35')]);_0xbbeb3f[_0xd3e4('0x36')]=_['intersection'](_0xbbeb3f[_0xd3e4('0x34')],_0xbbeb3f[_0xd3e4('0x35')]);_0x3f9c4d[_0xd3e4('0x38')]=_[_0xd3e4('0x37')](_0xbbeb3f[_0xd3e4('0x34')],qs[_0xd3e4('0x39')](_0x588a2c[_0xd3e4('0x35')][_0xd3e4('0x39')]));_0x3f9c4d[_0xd3e4('0x38')]=_0x3f9c4d['attributes'][_0xd3e4('0x3a')]?_0x3f9c4d[_0xd3e4('0x38')]:_0xbbeb3f['model'];if(!_0x588a2c[_0xd3e4('0x35')][_0xd3e4('0x59')]('nolimit')){_0x3f9c4d[_0xd3e4('0x23')]=qs[_0xd3e4('0x23')](_0x588a2c['query'][_0xd3e4('0x23')]);_0x3f9c4d[_0xd3e4('0x21')]=qs[_0xd3e4('0x21')](_0x588a2c[_0xd3e4('0x35')][_0xd3e4('0x21')]);}_0x3f9c4d[_0xd3e4('0x3c')]=qs[_0xd3e4('0x3d')](_0x588a2c['query'][_0xd3e4('0x3d')]);_0x3f9c4d[_0xd3e4('0x3e')]=qs['filters'](_[_0xd3e4('0xef')](_0x588a2c['query'],_0xbbeb3f[_0xd3e4('0x36')]));_0x3f9c4d[_0xd3e4('0x3e')]['ChatWebsiteId']=_0x239faa['id'];if(_0x588a2c[_0xd3e4('0x35')][_0xd3e4('0x41')]){_0x3f9c4d[_0xd3e4('0x3e')]=_[_0xd3e4('0x3f')](_0x3f9c4d['where'],{'$or':_[_0xd3e4('0x2f')](_0x3f9c4d[_0xd3e4('0x38')],function(_0x252ef9){var _0x52c7d9={};_0x52c7d9[_0x252ef9]={'$like':'%'+_0x588a2c[_0xd3e4('0x35')]['filter']+'%'};return _0x52c7d9;})});}_0x3f9c4d=_[_0xd3e4('0x3f')]({},_0x3f9c4d,_0x588a2c[_0xd3e4('0x42')]);return db[_0xd3e4('0xaf')][_0xd3e4('0x24')]({'where':_0x3f9c4d['where']})[_0xd3e4('0x12')](function(_0x33e1d7){_0x3418a1[_0xd3e4('0x24')]=_0x33e1d7;if(_0x588a2c[_0xd3e4('0x35')][_0xd3e4('0x43')]){_0x3f9c4d['include']=[{'model':db[_0xd3e4('0x7f')],'as':_0xd3e4('0xf0'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xd3e4('0x2a'),_0xd3e4('0xf1'),_0xd3e4('0xf2')],'required':![]},{'model':db[_0xd3e4('0xf3')],'as':_0xd3e4('0xf4'),'attributes':['id','name',_0xd3e4('0xf5')],'where':_0x588a2c[_0xd3e4('0x35')]['tag']?{'id':_0x588a2c[_0xd3e4('0x35')][_0xd3e4('0xf6')]}:undefined,'required':_0x588a2c[_0xd3e4('0x35')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0xd3e4('0x45')](_0x3f9c4d);})[_0xd3e4('0x12')](function(_0x448957){_0x3418a1[_0xd3e4('0x46')]=_0x448957;return _0x3418a1;});}})[_0xd3e4('0x12')](respondWithFilteredResult(_0x5c08f3,_0x3f9c4d))[_0xd3e4('0x47')](handleError(_0x5c08f3,null));};function iftimePromise(_0x2745fc,_0x4f4056){return respondWithRpcPromise('Command',_0xd3e4('0xf7'),{'command':_0x4f4056[_0xd3e4('0xf8')]?util[_0xd3e4('0xa5')](_0xd3e4('0xf9'),_0x2745fc[_0xd3e4('0xfa')],_0x4f4056[_0xd3e4('0xf8')]):util['format']('iftime\x20%s',_0x2745fc['interval'])},client9002)['then'](function(_0x149804){var _0xbdf961=_0x149804&&_0x149804[_0xd3e4('0xfb')](_0xd3e4('0xfc'))>=0x0?!![]:![];logger[_0xd3e4('0x13')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4f4056['id'],_0x2745fc['id'],_0x2745fc[_0xd3e4('0xfa')],_0xbdf961?'ONLINE':_0xd3e4('0xfd'),_0x4f4056[_0xd3e4('0xf8')]?_0x4f4056[_0xd3e4('0xf8')]:_0xd3e4('0xfe'));return _0xbdf961;})[_0xd3e4('0x47')](function(_0x3ab4ff){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4f4056['id'],_0x2745fc['id'],_0x2745fc[_0xd3e4('0xfa')],util[_0xd3e4('0xff')](_0x3ab4ff,{'showHidden':![],'depth':null}),_0x4f4056['timezone']?_0x4f4056['timezone']:_0xd3e4('0xfe'));return![];});}exports[_0xd3e4('0xf7')]=function(_0x3f17d3,_0x5a0e73){var _0x2d3870=0x0;var _0x3760f4=0x0;var _0x1192f4=![];var _0x1f5526;var _0x5a897a;return db[_0xd3e4('0x30')][_0xd3e4('0x4b')]({'where':{'id':_0x3f17d3[_0xd3e4('0x49')]['id']},'include':[{'model':db[_0xd3e4('0x100')],'as':'Interval','include':[{'model':db[_0xd3e4('0x100')],'as':_0xd3e4('0x101'),'attributes':['id',_0xd3e4('0xfa')],'raw':!![]}]}]})[_0xd3e4('0x12')](handleEntityNotFound(_0x5a0e73,null))['then'](function(_0x4bc1d7){if(_0x4bc1d7){_0x1f5526=_0x4bc1d7;return _0x4bc1d7[_0xd3e4('0x102')]({'raw':!![]});}})[_0xd3e4('0x12')](function(_0x37ddf1){if(_0x1f5526){if(_0x37ddf1){_0x5a897a=_0x37ddf1;}}return require(_0xd3e4('0x6b'))[_0xd3e4('0x103')]();})[_0xd3e4('0x12')](function(_0x4bb9a8){if(_0x4bb9a8){_0x3760f4=_0x4bb9a8[_0xd3e4('0x104')];_0x1192f4=_0x4bb9a8[_0xd3e4('0x6c')];}})['then'](function(){return db['ChatInteraction'][_0xd3e4('0x24')]({'where':{'closed':![]}});})[_0xd3e4('0x12')](function(_0x66e34f){_0x2d3870=_0x66e34f;if(_0x3760f4&&_0x66e34f>_0x3760f4){return db['License']['findOne']({'where':{'id':0x1}})[_0xd3e4('0x12')](function(_0x385e53){if(_0x385e53){_0x385e53[_0xd3e4('0x105')](_0xd3e4('0x106'));}});}})[_0xd3e4('0x12')](function(){if(_0x1f5526['Interval']&&_0x1f5526[_0xd3e4('0x100')][_0xd3e4('0x101')]){var _0x25c66c=[];for(var _0x4e07e5=0x0;_0x4e07e5<_0x1f5526[_0xd3e4('0x100')][_0xd3e4('0x101')][_0xd3e4('0x3a')];_0x4e07e5++){var _0x58cdef=_0x1f5526[_0xd3e4('0x100')][_0xd3e4('0x101')][_0x4e07e5][_0xd3e4('0x4f')]({'plain':!![]});_0x25c66c[_0xd3e4('0x107')](iftimePromise(_0x58cdef,_0x1f5526));}return BPromise['all'](_0x25c66c)['then'](function(_0x5dd79e){return _['some'](_0x5dd79e);});}else{return!![];}})['then'](function(_0x32898d){var _0x5aa53b=fs[_0xd3e4('0xc7')](path[_0xd3e4('0x68')](config[_0xd3e4('0x69')],'server/files/chat/iframe.ejs'),'utf8');var _0xdf061a={'remote':_0x1f5526['remote'],'query':querystring['stringify'](_[_0xd3e4('0x3f')](_0x1f5526[_0xd3e4('0x4f')]({'plain':!![]}),{'customerIp':_0x3f17d3[_0xd3e4('0x9b')][_0xd3e4('0x9c')]||_0x3f17d3['headers'][_0xd3e4('0x108')]||_0x3f17d3[_0xd3e4('0x109')][_0xd3e4('0x10a')]||_0x3f17d3['ip'],'referer':_0x3f17d3[_0xd3e4('0x9b')][_0xd3e4('0xa2')],'openedInteractions':_0x2d3870,'maxInteractions':_0x3760f4,'virtual':_0x1192f4['virtual'],'online':_0x32898d,'custom':_0x1192f4}))['replace'](/'/g,'\x5c\x27')};_0x5a0e73['send'](ejs[_0xd3e4('0x10b')](Mustache['render'](_0x5aa53b,_0xdf061a),{'proactiveActions':_0x5a897a,'alignment':_0x1f5526[_0xd3e4('0x10c')],'verticalAlignment':_0x1f5526[_0xd3e4('0x10d')],'div_color':_0x1f5526[_0xd3e4('0xf5')],'text_color':_0x1f5526['textColor'],'button_color':_0x1f5526[_0xd3e4('0x10e')],'background_color':_0x1f5526[_0xd3e4('0x10f')]}));})['catch'](handleError(_0x5a0e73,null));};exports[_0xd3e4('0x110')]=function(_0x4814ea,_0x15135a){var _0x3aadb4=_0x4814ea[_0xd3e4('0x49')]['id'];var _0x534e40=_0x4814ea[_0xd3e4('0x4d')];var _0x1d6bcf=0xc8;var _0x2f7b6e=null;return db[_0xd3e4('0xd3')][_0xd3e4('0xd4')]({'isolationLevel':db[_0xd3e4('0xd3')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x444e82){return db['ChatWebsite']['findOne']({'where':{'id':_0x3aadb4},'transaction':_0x444e82})[_0xd3e4('0x12')](function(_0x382dfe){if(_0x382dfe){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x3aadb4},'transaction':_0x444e82})[_0xd3e4('0x12')](function(){var _0x14cfcb=_[_0xd3e4('0x2f')](_0x534e40,function(_0x1e0ed0){_0x1e0ed0['ChatWebsiteId']=_0x3aadb4;return _0x1e0ed0;});return db[_0xd3e4('0x92')][_0xd3e4('0xd6')](_0x14cfcb,{'transaction':_0x444e82});});}else{_0x1d6bcf=0x194;_0x2f7b6e=[];}});})[_0xd3e4('0x12')](function(){if(_0x1d6bcf!==0x194){return db[_0xd3e4('0x92')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x3aadb4},'order':_0xd3e4('0x111')})[_0xd3e4('0x12')](function(_0x1b26b3){_0x2f7b6e=_0x1b26b3;});}})[_0xd3e4('0x47')](function(_0x5c807a){_0x1d6bcf=0x1f4;logger[_0xd3e4('0x19')](_0x5c807a[_0xd3e4('0x112')]);if(_0x5c807a[_0xd3e4('0x2a')]){delete _0x5c807a[_0xd3e4('0x2a')];}_0x2f7b6e=_0x5c807a;})[_0xd3e4('0x113')](function(){if(_0x2f7b6e===null){_0x15135a[_0xd3e4('0x1d')](_0x1d6bcf);}else{if(_0x1d6bcf===0x1f4){_0x15135a[_0xd3e4('0x1e')](_0x1d6bcf)[_0xd3e4('0x2b')](_0x2f7b6e);}else{_0x15135a[_0xd3e4('0x1e')](_0x1d6bcf)['json'](_0x2f7b6e);}}});};exports[_0xd3e4('0x114')]=function(_0x47b1cc,_0x2f1b75){var _0x378ec6={};var _0x307859={};var _0x592b74;var _0x852334;return db[_0xd3e4('0x30')][_0xd3e4('0x58')]({'where':{'id':_0x47b1cc[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x2f1b75,null))['then'](function(_0x35c66b){if(_0x35c66b){_0x592b74=_0x35c66b;_0x307859[_0xd3e4('0x34')]=_['keys'](db[_0xd3e4('0x92')]['rawAttributes']);_0x307859['query']=_['keys'](_0x47b1cc[_0xd3e4('0x35')]);_0x307859[_0xd3e4('0x36')]=_[_0xd3e4('0x37')](_0x307859['model'],_0x307859[_0xd3e4('0x35')]);_0x378ec6[_0xd3e4('0x38')]=_[_0xd3e4('0x37')](_0x307859[_0xd3e4('0x34')],qs['fields'](_0x47b1cc[_0xd3e4('0x35')][_0xd3e4('0x39')]));_0x378ec6[_0xd3e4('0x38')]=_0x378ec6[_0xd3e4('0x38')][_0xd3e4('0x3a')]?_0x378ec6[_0xd3e4('0x38')]:_0x307859[_0xd3e4('0x34')];_0x378ec6['order']=qs[_0xd3e4('0x3d')](_0x47b1cc['query'][_0xd3e4('0x3d')]);_0x378ec6['where']=qs[_0xd3e4('0x36')](_['pick'](_0x47b1cc[_0xd3e4('0x35')],_0x307859['filters']));if(_0x47b1cc[_0xd3e4('0x35')]['filter']){_0x378ec6[_0xd3e4('0x3e')]=_['merge'](_0x378ec6[_0xd3e4('0x3e')],{'$or':_['map'](_0x378ec6[_0xd3e4('0x38')],function(_0x380096){var _0x4af7bb={};_0x4af7bb[_0x380096]={'$like':'%'+_0x47b1cc[_0xd3e4('0x35')][_0xd3e4('0x41')]+'%'};return _0x4af7bb;})});}_0x378ec6=_[_0xd3e4('0x3f')]({},_0x378ec6,_0x47b1cc[_0xd3e4('0x42')]);return _0x592b74['getApplications'](_0x378ec6);}})[_0xd3e4('0x12')](function(_0x49fb95){if(_0x49fb95){_0x852334=_0x49fb95['length'];if(!_0x47b1cc['query'][_0xd3e4('0x59')](_0xd3e4('0x3b'))){_0x378ec6['limit']=qs[_0xd3e4('0x23')](_0x47b1cc[_0xd3e4('0x35')][_0xd3e4('0x23')]);_0x378ec6[_0xd3e4('0x21')]=qs[_0xd3e4('0x21')](_0x47b1cc[_0xd3e4('0x35')][_0xd3e4('0x21')]);}return _0x592b74[_0xd3e4('0x114')](_0x378ec6);}})[_0xd3e4('0x12')](function(_0xb4be53){if(_0xb4be53){return _0xb4be53?{'count':_0x852334,'rows':_0xb4be53}:null;}})['then'](respondWithResult(_0x2f1b75,null))[_0xd3e4('0x47')](handleError(_0x2f1b75,null));};exports[_0xd3e4('0x115')]=function(_0x742e3c,_0x1702cc){return db['chatProactiveAction']['find']({'where':{'id':_0x742e3c[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x1702cc,null))[_0xd3e4('0x12')](function(_0x2d8bbc){if(_0x2d8bbc){return _0x2d8bbc[_0xd3e4('0x115')](_0x742e3c['body'][_0xd3e4('0x5b')],_[_0xd3e4('0xed')](_0x742e3c[_0xd3e4('0x4d')],['ids','id'])||{});}})[_0xd3e4('0x12')](respondWithResult(_0x1702cc,null))[_0xd3e4('0x47')](handleError(_0x1702cc,null));};exports['getProactiveActions']=function(_0x2e65f0,_0x4ab6d2){var _0x371b28={};var _0x20b157={};var _0xcb0ef;var _0x9d47fd;return db[_0xd3e4('0x30')][_0xd3e4('0x58')]({'where':{'id':_0x2e65f0[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x4ab6d2,null))[_0xd3e4('0x12')](function(_0x1590b9){if(_0x1590b9){_0xcb0ef=_0x1590b9;_0x20b157['model']=_['keys'](db[_0xd3e4('0x116')]['rawAttributes']);_0x20b157['query']=_['keys'](_0x2e65f0[_0xd3e4('0x35')]);_0x20b157[_0xd3e4('0x36')]=_['intersection'](_0x20b157[_0xd3e4('0x34')],_0x20b157[_0xd3e4('0x35')]);_0x371b28[_0xd3e4('0x38')]=_[_0xd3e4('0x37')](_0x20b157[_0xd3e4('0x34')],qs[_0xd3e4('0x39')](_0x2e65f0[_0xd3e4('0x35')]['fields']));_0x371b28[_0xd3e4('0x38')]=_0x371b28[_0xd3e4('0x38')][_0xd3e4('0x3a')]?_0x371b28['attributes']:_0x20b157[_0xd3e4('0x34')];_0x371b28[_0xd3e4('0x3c')]=qs[_0xd3e4('0x3d')](_0x2e65f0[_0xd3e4('0x35')][_0xd3e4('0x3d')]);_0x371b28[_0xd3e4('0x3e')]=qs['filters'](_[_0xd3e4('0xef')](_0x2e65f0[_0xd3e4('0x35')],_0x20b157[_0xd3e4('0x36')]));if(_0x2e65f0[_0xd3e4('0x35')]['filter']){_0x371b28[_0xd3e4('0x3e')]=_[_0xd3e4('0x3f')](_0x371b28[_0xd3e4('0x3e')],{'$or':_[_0xd3e4('0x2f')](_0x371b28[_0xd3e4('0x38')],function(_0x4eb822){var _0x4db6b0={};_0x4db6b0[_0x4eb822]={'$like':'%'+_0x2e65f0[_0xd3e4('0x35')][_0xd3e4('0x41')]+'%'};return _0x4db6b0;})});}_0x371b28=_[_0xd3e4('0x3f')]({},_0x371b28,_0x2e65f0[_0xd3e4('0x42')]);return _0xcb0ef['getProactiveActions'](_0x371b28);}})[_0xd3e4('0x12')](function(_0x61e629){if(_0x61e629){_0x9d47fd=_0x61e629['length'];if(!_0x2e65f0[_0xd3e4('0x35')][_0xd3e4('0x59')]('nolimit')){_0x371b28[_0xd3e4('0x23')]=qs[_0xd3e4('0x23')](_0x2e65f0[_0xd3e4('0x35')][_0xd3e4('0x23')]);_0x371b28[_0xd3e4('0x21')]=qs[_0xd3e4('0x21')](_0x2e65f0[_0xd3e4('0x35')]['offset']);}return _0xcb0ef[_0xd3e4('0x102')](_0x371b28);}})['then'](function(_0x254902){if(_0x254902){return _0x254902?{'count':_0x9d47fd,'rows':_0x254902}:null;}})[_0xd3e4('0x12')](respondWithResult(_0x4ab6d2,null))['catch'](handleError(_0x4ab6d2,null));};exports[_0xd3e4('0x117')]=function(_0x29cb72,_0x5563cf){var _0x591372=_0x29cb72[_0xd3e4('0x35')]['online']==='false'?_0xd3e4('0x118'):_0xd3e4('0x119');return db[_0xd3e4('0x30')][_0xd3e4('0x4b')]({'attributes':['id',_0x591372],'where':{'id':_0x29cb72['params']['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x5563cf,null))[_0xd3e4('0x12')](function(_0x17683c){if(_0x17683c){var _0x2c5ffc=_0x17683c[_0x591372];var _0x5de96f=_0x2c5ffc&&_0x2c5ffc[_0xd3e4('0x11a')]?_0x2c5ffc[_0xd3e4('0x11a')]:[];_0x5563cf[_0xd3e4('0x2b')]({'fromKey':_[_0xd3e4('0x6d')](_0x2c5ffc[_0xd3e4('0x11b')])?undefined:_0x2c5ffc[_0xd3e4('0x11b')],'count':_0x5de96f[_0xd3e4('0x3a')],'rows':_0x5de96f});}})[_0xd3e4('0x47')](handleError(_0x5563cf,null));};exports[_0xd3e4('0x11c')]=function(_0x1ee436,_0x2aef28){var _0x5d4f23={'raw':![],'where':{}};var _0x430709={};var _0x4747ed={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd3e4('0x58')]({'where':{'id':_0x1ee436[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x2aef28,null))[_0xd3e4('0x12')](function(_0xe28ff5){if(_0xe28ff5){_0x430709['model']=_[_0xd3e4('0x4a')](db[_0xd3e4('0xcc')][_0xd3e4('0x31')]);_0x430709[_0xd3e4('0x35')]=_[_0xd3e4('0x4a')](_0x1ee436['query']);_0x430709['filters']=_['intersection'](_0x430709[_0xd3e4('0x34')],_0x430709[_0xd3e4('0x35')]);_0x5d4f23[_0xd3e4('0x38')]=_[_0xd3e4('0x37')](_0x430709['model'],qs[_0xd3e4('0x39')](_0x1ee436[_0xd3e4('0x35')]['fields']));_0x5d4f23['attributes']=_0x5d4f23[_0xd3e4('0x38')][_0xd3e4('0x3a')]?_0x5d4f23[_0xd3e4('0x38')]:_0x430709[_0xd3e4('0x34')];if(!_0x1ee436['query']['hasOwnProperty'](_0xd3e4('0x3b'))){_0x5d4f23['limit']=qs[_0xd3e4('0x23')](_0x1ee436[_0xd3e4('0x35')][_0xd3e4('0x23')]);_0x5d4f23[_0xd3e4('0x21')]=qs['offset'](_0x1ee436[_0xd3e4('0x35')]['offset']);}_0x5d4f23[_0xd3e4('0x3c')]=qs['sort'](_0x1ee436[_0xd3e4('0x35')][_0xd3e4('0x3d')]);_0x5d4f23[_0xd3e4('0x3e')]=qs[_0xd3e4('0x36')](_[_0xd3e4('0xef')](_0x1ee436[_0xd3e4('0x35')],_0x430709[_0xd3e4('0x36')]));_0x5d4f23[_0xd3e4('0x3e')]['ChatWebsiteId']=_0xe28ff5['id'];if(_0x1ee436['query'][_0xd3e4('0x41')]){_0x5d4f23[_0xd3e4('0x3e')]=_['merge'](_0x5d4f23[_0xd3e4('0x3e')],{'$or':_[_0xd3e4('0x2f')](_0x5d4f23[_0xd3e4('0x38')],function(_0x10339e){var _0x24a8bb={};_0x24a8bb[_0x10339e]={'$like':'%'+_0x1ee436[_0xd3e4('0x35')][_0xd3e4('0x41')]+'%'};return _0x24a8bb;})});}_0x5d4f23=_[_0xd3e4('0x3f')]({},_0x5d4f23,_0x1ee436['options']);return db[_0xd3e4('0xcc')]['count']({'where':_0x5d4f23[_0xd3e4('0x3e')]})['then'](function(_0x2f04b7){_0x4747ed[_0xd3e4('0x24')]=_0x2f04b7;if(_0x1ee436['query']['includeAll']){_0x5d4f23[_0xd3e4('0x44')]=[{'all':!![]}];}else{_0x5d4f23[_0xd3e4('0x44')]=[{'model':db[_0xd3e4('0x7f')],'as':'Contact','required':![]},{'model':db[_0xd3e4('0xd5')],'as':'Attachments','required':![]}];}return db[_0xd3e4('0xcc')][_0xd3e4('0x45')](_0x5d4f23);})[_0xd3e4('0x12')](function(_0x7f15eb){_0x4747ed[_0xd3e4('0x46')]=_0x7f15eb;return _0x4747ed;});}})[_0xd3e4('0x12')](respondWithFilteredResult(_0x2aef28,_0x5d4f23))['catch'](handleError(_0x2aef28,null));};exports[_0xd3e4('0x11d')]=function(_0x3d8bd7,_0x10ee31){return db[_0xd3e4('0x30')]['find']({'where':{'id':_0x3d8bd7[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x10ee31,null))[_0xd3e4('0x12')](function(_0x396fe8){if(_0x396fe8){return _0x396fe8['addAgents'](_0x3d8bd7[_0xd3e4('0x4d')][_0xd3e4('0x5b')],_[_0xd3e4('0xed')](_0x3d8bd7['body'],['ids','id'])||{})[_0xd3e4('0xb0')](function(_0x4be429){for(var _0x2f6d35=0x0;_0x2f6d35<_0x3d8bd7['body'][_0xd3e4('0x5b')][_0xd3e4('0x3a')];_0x2f6d35+=0x1){socket['emit'](_0xd3e4('0x11e'),{'UserId':Number(_0x3d8bd7[_0xd3e4('0x4d')][_0xd3e4('0x5b')][_0x2f6d35]),'ChatWebsiteId':Number(_0x3d8bd7[_0xd3e4('0x49')]['id'])});}return _0x4be429;});}})['then'](respondWithResult(_0x10ee31,null))['catch'](handleError(_0x10ee31,null));};exports[_0xd3e4('0x11f')]=function(_0x21a631,_0x2dfd5d){return db[_0xd3e4('0x30')][_0xd3e4('0x4b')]({'where':{'id':_0x21a631[_0xd3e4('0x49')]['id']}})[_0xd3e4('0x12')](handleEntityNotFound(_0x2dfd5d,null))[_0xd3e4('0x12')](function(_0x7e2dbd){if(_0x7e2dbd){return _0x7e2dbd[_0xd3e4('0x11f')](_0x21a631[_0xd3e4('0x35')]['ids'])[_0xd3e4('0x12')](function(){if(_[_0xd3e4('0x120')](_0x21a631[_0xd3e4('0x35')]['ids'])){for(var _0x3087b9=0x0;_0x3087b9<_0x21a631[_0xd3e4('0x35')][_0xd3e4('0x5b')]['length'];_0x3087b9+=0x1){socket[_0xd3e4('0x121')](_0xd3e4('0x122'),{'UserId':Number(_0x21a631[_0xd3e4('0x35')][_0xd3e4('0x5b')][_0x3087b9]),'ChatWebsiteId':Number(_0x21a631['params']['id'])});}}else{socket[_0xd3e4('0x121')](_0xd3e4('0x122'),{'UserId':Number(_0x21a631[_0xd3e4('0x35')]['ids']),'ChatWebsiteId':Number(_0x21a631[_0xd3e4('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x2dfd5d,null))[_0xd3e4('0x47')](handleError(_0x2dfd5d,null));};exports[_0xd3e4('0x123')]=function(_0x536e10,_0x362689){var _0x487e7e={};var _0x365a0c={};var _0x358d20;var _0x477a65;return db[_0xd3e4('0x30')][_0xd3e4('0x58')]({'where':{'id':_0x536e10[_0xd3e4('0x49')]['id']}})['then'](handleEntityNotFound(_0x362689,null))['then'](function(_0x5f2445){if(_0x5f2445){_0x358d20=_0x5f2445;_0x365a0c[_0xd3e4('0x34')]=_['keys'](db[_0xd3e4('0x124')]['rawAttributes']);_0x365a0c[_0xd3e4('0x35')]=_[_0xd3e4('0x4a')](_0x536e10[_0xd3e4('0x35')]);_0x365a0c[_0xd3e4('0x36')]=_[_0xd3e4('0x37')](_0x365a0c[_0xd3e4('0x34')],_0x365a0c[_0xd3e4('0x35')]);_0x487e7e[_0xd3e4('0x38')]=_['intersection'](_0x365a0c[_0xd3e4('0x34')],qs[_0xd3e4('0x39')](_0x536e10[_0xd3e4('0x35')][_0xd3e4('0x39')]));_0x487e7e[_0xd3e4('0x38')]=_0x487e7e[_0xd3e4('0x38')][_0xd3e4('0x3a')]?_0x487e7e[_0xd3e4('0x38')]:_0x365a0c[_0xd3e4('0x34')];_0x487e7e[_0xd3e4('0x3c')]=qs['sort'](_0x536e10['query'][_0xd3e4('0x3d')]);_0x487e7e[_0xd3e4('0x3e')]=qs['filters'](_[_0xd3e4('0xef')](_0x536e10['query'],_0x365a0c[_0xd3e4('0x36')]));if(_0x536e10[_0xd3e4('0x35')][_0xd3e4('0x41')]){_0x487e7e[_0xd3e4('0x3e')]=_['merge'](_0x487e7e['where'],{'$or':_[_0xd3e4('0x2f')](_0x487e7e['attributes'],function(_0x3c62f6){var _0x235f29={};_0x235f29[_0x3c62f6]={'$like':'%'+_0x536e10['query'][_0xd3e4('0x41')]+'%'};return _0x235f29;})});}_0x487e7e=_['merge']({},_0x487e7e,_0x536e10['options']);return _0x358d20[_0xd3e4('0x123')](_0x487e7e);}})[_0xd3e4('0x12')](function(_0x3e76f6){if(_0x3e76f6){_0x477a65=_0x3e76f6[_0xd3e4('0x3a')];if(!_0x536e10[_0xd3e4('0x35')][_0xd3e4('0x59')](_0xd3e4('0x3b'))){_0x487e7e[_0xd3e4('0x23')]=qs[_0xd3e4('0x23')](_0x536e10[_0xd3e4('0x35')]['limit']);_0x487e7e[_0xd3e4('0x21')]=qs['offset'](_0x536e10[_0xd3e4('0x35')][_0xd3e4('0x21')]);}return _0x358d20[_0xd3e4('0x123')](_0x487e7e);}})[_0xd3e4('0x12')](function(_0x57b5d3){if(_0x57b5d3){return _0x57b5d3?{'count':_0x477a65,'rows':_0x57b5d3}:null;}})[_0xd3e4('0x12')](respondWithResult(_0x362689,null))['catch'](handleError(_0x362689,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 05fac65..f559ad9 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 _0x2830=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2830,0x117));var _0x0283=function(_0x43d7f1,_0x11a1eb){_0x43d7f1=_0x43d7f1-0x0;var _0x470f7e=_0x2830[_0x43d7f1];return _0x470f7e;};'use strict';var EventEmitter=require(_0x0283('0x0'));var ChatWebsite=require(_0x0283('0x1'))['db'][_0x0283('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0283('0x3')](0x0);var events={'afterCreate':_0x0283('0x4'),'afterUpdate':_0x0283('0x5'),'afterDestroy':_0x0283('0x6')};function emitEvent(_0x56984a){return function(_0x414c89,_0x4aa050,_0x1a8998){ChatWebsiteEvents[_0x0283('0x7')](_0x56984a+':'+_0x414c89['id'],_0x414c89);ChatWebsiteEvents[_0x0283('0x7')](_0x56984a,_0x414c89);_0x1a8998(null);};}for(var e in events){if(events[_0x0283('0x8')](e)){var event=events[e];ChatWebsite[_0x0283('0x9')](e,emitEvent(event));}}module[_0x0283('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x1793=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x2b7577,_0x422c99){var _0x1a7c9b=function(_0x386a67){while(--_0x386a67){_0x2b7577['push'](_0x2b7577['shift']());}};_0x1a7c9b(++_0x422c99);}(_0x1793,0x1ce));var _0x3179=function(_0x3f1b36,_0x205b14){_0x3f1b36=_0x3f1b36-0x0;var _0x56a704=_0x1793[_0x3f1b36];return _0x56a704;};'use strict';var EventEmitter=require(_0x3179('0x0'));var ChatWebsite=require(_0x3179('0x1'))['db'][_0x3179('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3179('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3179('0x4'),'afterDestroy':_0x3179('0x5')};function emitEvent(_0xadb4b9){return function(_0x1e67c2,_0x24b4db,_0x58bd3d){ChatWebsiteEvents['emit'](_0xadb4b9+':'+_0x1e67c2['id'],_0x1e67c2);ChatWebsiteEvents[_0x3179('0x6')](_0xadb4b9,_0x1e67c2);_0x58bd3d(null);};}for(var e in events){if(events[_0x3179('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ecf6f18..f03eacf 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 _0xf1a1=['define','ChatWebsite','chat_websites','../../config/logger','api','bluebird','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x10ad76,_0x4fc94a){var _0x1ced1a=function(_0x45e5c7){while(--_0x45e5c7){_0x10ad76['push'](_0x10ad76['shift']());}};_0x1ced1a(++_0x4fc94a);}(_0xf1a1,0x66));var _0x1f1a=function(_0x1d3168,_0x43b8f9){_0x1d3168=_0x1d3168-0x0;var _0x497266=_0xf1a1[_0x1d3168];return _0x497266;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f1a('0x0'))(_0x1f1a('0x1'));var moment=require('moment');var BPromise=require(_0x1f1a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1f1a('0x3'));var attributes=require(_0x1f1a('0x4'));module[_0x1f1a('0x5')]=function(_0x4b848b,_0x53f7b9){return _0x4b848b[_0x1f1a('0x6')](_0x1f1a('0x7'),attributes,{'tableName':_0x1f1a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a43=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a43,0x9f));var _0x33a4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3a43[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x33a4('0x0'));var util=require('util');var logger=require(_0x33a4('0x1'))('api');var moment=require(_0x33a4('0x2'));var BPromise=require(_0x33a4('0x3'));var rp=require(_0x33a4('0x4'));var fs=require('fs');var path=require(_0x33a4('0x5'));var rimraf=require('rimraf');var config=require(_0x33a4('0x6'));var attributes=require(_0x33a4('0x7'));module['exports']=function(_0x2362c1,_0x1cce51){return _0x2362c1[_0x33a4('0x8')](_0x33a4('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 85b0ed8..2a9edc0 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 _0x5632=['request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','message'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0x5632,0x1b3));var _0x2563=function(_0xfb0f99,_0x4048ad){_0xfb0f99=_0xfb0f99-0x0;var _0x3faf0b=_0x5632[_0xfb0f99];return _0x3faf0b;};'use strict';var _=require(_0x2563('0x0'));var util=require(_0x2563('0x1'));var moment=require(_0x2563('0x2'));var BPromise=require(_0x2563('0x3'));var rs=require(_0x2563('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2563('0x5'))['db'];var utils=require(_0x2563('0x6'));var logger=require('../../config/logger')(_0x2563('0x7'));var config=require(_0x2563('0x8'));var jayson=require(_0x2563('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2563('0xa')]=_[_0x2563('0xb')](config['redis'],{'host':_0x2563('0xc'),'port':0x18eb});var socket=require(_0x2563('0xd'))(new Redis(config[_0x2563('0xa')]));require(_0x2563('0xe'))[_0x2563('0xf')](socket);function respondWithRpcPromise(_0x36a210,_0x50af74,_0x3a5a79){return new BPromise(function(_0x2304e7,_0x52697c){return client[_0x2563('0x10')](_0x36a210,_0x3a5a79)[_0x2563('0x11')](function(_0x482c75){logger[_0x2563('0x12')](_0x2563('0x13'),_0x50af74,'request\x20sent');logger[_0x2563('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x50af74,'request\x20sent',JSON[_0x2563('0x15')](_0x482c75));if(_0x482c75[_0x2563('0x16')]){if(_0x482c75[_0x2563('0x16')]['code']===0x1f4){logger[_0x2563('0x16')](_0x2563('0x13'),_0x50af74,_0x482c75[_0x2563('0x16')][_0x2563('0x17')]);return _0x52697c(_0x482c75[_0x2563('0x16')][_0x2563('0x17')]);}logger[_0x2563('0x16')](_0x2563('0x13'),_0x50af74,_0x482c75[_0x2563('0x16')][_0x2563('0x17')]);return _0x2304e7(_0x482c75['error']['message']);}else{logger[_0x2563('0x12')](_0x2563('0x13'),_0x50af74,_0x2563('0x18'));_0x2304e7(_0x482c75[_0x2563('0x19')][_0x2563('0x17')]);}})[_0x2563('0x1a')](function(_0x54f0a4){logger['error'](_0x2563('0x13'),_0x50af74,_0x54f0a4);_0x52697c(_0x54f0a4);});});} \ No newline at end of file +var _0x4e0b=['moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4e0b,0x76));var _0xb4e0=function(_0x573c3c,_0xa98e5e){_0x573c3c=_0x573c3c-0x0;var _0x4c8ba4=_0x4e0b[_0x573c3c];return _0x4c8ba4;};'use strict';var _=require(_0xb4e0('0x0'));var util=require(_0xb4e0('0x1'));var moment=require(_0xb4e0('0x2'));var BPromise=require('bluebird');var rs=require(_0xb4e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4e0('0x4'))['db'];var utils=require(_0xb4e0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb4e0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb4e0('0x7')][_0xb4e0('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb4e0('0x9')],{'host':_0xb4e0('0xa'),'port':0x18eb});var socket=require(_0xb4e0('0xb'))(new Redis(config['redis']));require(_0xb4e0('0xc'))[_0xb4e0('0xd')](socket);function respondWithRpcPromise(_0x3dc10e,_0x59b647,_0x16ec0c){return new BPromise(function(_0x7ee8e4,_0x5c9bc9){return client[_0xb4e0('0xe')](_0x3dc10e,_0x16ec0c)['then'](function(_0x3b2993){logger[_0xb4e0('0xf')](_0xb4e0('0x10'),_0x59b647,_0xb4e0('0x11'));logger[_0xb4e0('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x59b647,'request\x20sent',JSON[_0xb4e0('0x13')](_0x3b2993));if(_0x3b2993[_0xb4e0('0x14')]){if(_0x3b2993[_0xb4e0('0x14')][_0xb4e0('0x15')]===0x1f4){logger[_0xb4e0('0x14')](_0xb4e0('0x10'),_0x59b647,_0x3b2993[_0xb4e0('0x14')]['message']);return _0x5c9bc9(_0x3b2993[_0xb4e0('0x14')][_0xb4e0('0x16')]);}logger['error'](_0xb4e0('0x10'),_0x59b647,_0x3b2993[_0xb4e0('0x14')][_0xb4e0('0x16')]);return _0x7ee8e4(_0x3b2993[_0xb4e0('0x14')][_0xb4e0('0x16')]);}else{logger[_0xb4e0('0xf')](_0xb4e0('0x10'),_0x59b647,'request\x20sent');_0x7ee8e4(_0x3b2993[_0xb4e0('0x17')][_0xb4e0('0x16')]);}})['catch'](function(_0x513a52){logger['error'](_0xb4e0('0x10'),_0x59b647,_0x513a52);_0x5c9bc9(_0x513a52);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 9a0b0b6..1fc46ea 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 _0x1697=['register','length','save','remove','update','emit','removeListener'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0x1697,0xfe));var _0x7169=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x1697[_0x1035c1];return _0x308d67;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x7169('0x0'),_0x7169('0x1'),_0x7169('0x2')];function createListener(_0x1f7a39,_0x379de3){return function(_0x5bd18c){_0x379de3[_0x7169('0x3')](_0x1f7a39,_0x5bd18c);};}function removeListener(_0x5d362e,_0x1aaf25){return function(){ChatWebsiteEvents[_0x7169('0x4')](_0x5d362e,_0x1aaf25);};}exports[_0x7169('0x5')]=function(_0x294970){for(var _0xf012e2=0x0,_0x20b48e=events[_0x7169('0x6')];_0xf012e2<_0x20b48e;_0xf012e2++){var _0x4460f4=events[_0xf012e2];var _0x2845c5=createListener('chatWebsite:'+_0x4460f4,_0x294970);ChatWebsiteEvents['on'](_0x4460f4,_0x2845c5);}}; \ No newline at end of file +var _0xd9d6=['length','chatWebsite:','./chatWebsite.events','remove','update','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd9d6,0x9c));var _0x6d9d=function(_0x188edb,_0x19fed6){_0x188edb=_0x188edb-0x0;var _0x669a3d=_0xd9d6[_0x188edb];return _0x669a3d;};'use strict';var ChatWebsiteEvents=require(_0x6d9d('0x0'));var events=['save',_0x6d9d('0x1'),_0x6d9d('0x2')];function createListener(_0x7dcbdc,_0x51bbd4){return function(_0x29d081){_0x51bbd4['emit'](_0x7dcbdc,_0x29d081);};}function removeListener(_0x368ca1,_0x1fc900){return function(){ChatWebsiteEvents[_0x6d9d('0x3')](_0x368ca1,_0x1fc900);};}exports[_0x6d9d('0x4')]=function(_0x5e3ebe){for(var _0xc53186=0x0,_0x2cc1c0=events[_0x6d9d('0x5')];_0xc53186<_0x2cc1c0;_0xc53186++){var _0x5be800=events[_0xc53186];var _0x9fafc0=createListener(_0x6d9d('0x6')+_0x5be800,_0x5e3ebe);ChatWebsiteEvents['on'](_0x5be800,_0x9fafc0);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 15660b0..1a3db82 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 _0x158e=['create','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','/:id/offline','any','/:id/interactions','addInteraction','addApplications','put','update','delete','/:id/dispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/:id','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post'];(function(_0x45d80c,_0x35c0ff){var _0x449a98=function(_0x1b5ab7){while(--_0x1b5ab7){_0x45d80c['push'](_0x45d80c['shift']());}};_0x449a98(++_0x35c0ff);}(_0x158e,0xab));var _0xe158=function(_0x105dd9,_0x1a3e6b){_0x105dd9=_0x105dd9-0x0;var _0x1acd3a=_0x158e[_0x105dd9];return _0x1acd3a;};'use strict';var multer=require(_0xe158('0x0'));var util=require(_0xe158('0x1'));var path=require(_0xe158('0x2'));var timeout=require(_0xe158('0x3'));var express=require(_0xe158('0x4'));var router=express[_0xe158('0x5')]();var fs_extra=require(_0xe158('0x6'));var auth=require(_0xe158('0x7'));var interaction=require(_0xe158('0x8'));var config=require(_0xe158('0x9'));var controller=require(_0xe158('0xa'));router['get']('/',auth[_0xe158('0xb')](),controller[_0xe158('0xc')]);router[_0xe158('0xd')]('/describe',auth[_0xe158('0xb')](),controller['describe']);router[_0xe158('0xd')](_0xe158('0xe'),auth[_0xe158('0xb')](),controller['show']);router[_0xe158('0xd')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe158('0xf')]);router[_0xe158('0xd')](_0xe158('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xe158('0xd')](_0xe158('0x11'),controller[_0xe158('0x12')]);router['get'](_0xe158('0x13'),controller[_0xe158('0x14')]);router['get'](_0xe158('0x15'),controller[_0xe158('0x16')]);router['get'](_0xe158('0x17'),controller[_0xe158('0x18')]);router[_0xe158('0xd')]('/:id/interactions',auth[_0xe158('0xb')](),controller['getInteractions']);router[_0xe158('0xd')](_0xe158('0x19'),controller[_0xe158('0x1a')]);router['get']('/:id/applications',auth[_0xe158('0xb')](),controller[_0xe158('0x1b')]);router[_0xe158('0xd')](_0xe158('0x1c'),auth[_0xe158('0xb')](),controller[_0xe158('0x1d')]);router[_0xe158('0xd')](_0xe158('0x1e'),controller[_0xe158('0x1f')]);router[_0xe158('0xd')](_0xe158('0x20'),auth[_0xe158('0xb')](),controller[_0xe158('0x21')]);router[_0xe158('0xd')]('/:id/users',auth[_0xe158('0xb')](),controller[_0xe158('0x22')]);router[_0xe158('0x23')]('/',auth['isAuthenticated'](),controller[_0xe158('0x24')]);router['post']('/:id/dispositions',auth[_0xe158('0xb')](),controller[_0xe158('0x25')]);router['post'](_0xe158('0x10'),auth[_0xe158('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe158('0x26')]({'destination':function(_0x57f260,_0x318883,_0x2665fd){_0x2665fd(null,path[_0xe158('0x27')](config[_0xe158('0x28')],'server/files/images/logos/'));},'filename':function(_0x3e4819,_0x41fe1d,_0x201714){_0x201714(null,util[_0xe158('0x29')](_0xe158('0x2a'),Date[_0xe158('0x2b')](),_0x41fe1d[_0xe158('0x2c')]));}})});router[_0xe158('0x23')](_0xe158('0x11'),upload[_0xe158('0x2d')](_0xe158('0x2e')),controller[_0xe158('0x2f')]);var upload=multer({'storage':multer[_0xe158('0x26')]({'destination':function(_0x2de55e,_0x48694f,_0x3cc405){_0x3cc405(null,path['join'](config[_0xe158('0x28')],_0xe158('0x30')));},'filename':function(_0x1a34d3,_0x1866c0,_0x53d2ae){_0x53d2ae(null,util['format']('%s-%s',Date['now'](),_0x1866c0['originalname']));}})});router[_0xe158('0x23')](_0xe158('0x13'),upload['single'](_0xe158('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0xe158('0x26')]({'destination':function(_0x37e586,_0x27b388,_0x1d55ae){_0x1d55ae(null,path[_0xe158('0x27')](config[_0xe158('0x28')],_0xe158('0x30')));},'filename':function(_0x420346,_0x3cd480,_0x444fd8){_0x444fd8(null,util['format'](_0xe158('0x2a'),Date['now'](),_0x3cd480[_0xe158('0x2c')]));}})});router[_0xe158('0x23')](_0xe158('0x15'),upload['single'](_0xe158('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xe158('0x26')]({'destination':function(_0x1e52f1,_0x17c2d9,_0x1f0fcb){_0x1f0fcb(null,path['join'](config[_0xe158('0x28')],_0xe158('0x30')));},'filename':function(_0x2b4e30,_0x16cbb9,_0x4826b4){_0x4826b4(null,util[_0xe158('0x29')](_0xe158('0x2a'),Date[_0xe158('0x2b')](),_0x16cbb9['originalname']));}})});router[_0xe158('0x23')](_0xe158('0x17'),upload[_0xe158('0x2d')](_0xe158('0x2e')),controller['addSystemAvatar']);router[_0xe158('0x23')](_0xe158('0x31'),controller[_0xe158('0x32')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x107c56,_0x399eeb,_0x43a109){const _0x9f6ad9=path[_0xe158('0x27')](config[_0xe158('0x28')],_0xe158('0x33'),_0xe158('0x34'),_0xe158('0x35'));fs_extra[_0xe158('0x36')](_0x9f6ad9,function(){_0x43a109(null,_0x9f6ad9);});},'filename':function(_0x463b53,_0x206d53,_0xad0700){const _0x149b89=_0x206d53['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4b7c7f=path[_0xe158('0x37')](_0x149b89);const _0x5bd481=Date[_0xe158('0x2b')]()+'-'+_0x149b89['replace'](_0x4b7c7f,'')+_0x4b7c7f;_0xad0700(null,_0x5bd481);}})});router[_0xe158('0x23')](_0xe158('0x38'),offlineUploadMulter[_0xe158('0x39')](),controller['offline']);router['post'](_0xe158('0x3a'),auth['isAuthenticated'](),controller[_0xe158('0x3b')]);router[_0xe158('0x23')]('/:id/applications',auth[_0xe158('0xb')](),controller[_0xe158('0x3c')]);router[_0xe158('0x23')](_0xe158('0x1c'),auth[_0xe158('0xb')](),controller['addProactiveActions']);router[_0xe158('0x23')]('/:id/users',auth[_0xe158('0xb')](),controller['addAgents']);router[_0xe158('0x3d')]('/:id',auth[_0xe158('0xb')](),controller[_0xe158('0x3e')]);router[_0xe158('0x3f')](_0xe158('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe158('0x3f')](_0xe158('0x40'),auth[_0xe158('0xb')](),controller['removeDispositions']);router[_0xe158('0x3f')](_0xe158('0x10'),auth['isAuthenticated'](),controller[_0xe158('0x41')]);router['delete'](_0xe158('0x42'),auth['isAuthenticated'](),controller[_0xe158('0x43')]);module[_0xe158('0x44')]=router; \ No newline at end of file +var _0x8cdc=['now','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','single','file','addLogo','addAvatar','server/files/images/avatars/','addCustomerAvatar'];(function(_0x124717,_0x4a1ae7){var _0x369d35=function(_0x5128d0){while(--_0x5128d0){_0x124717['push'](_0x124717['shift']());}};_0x369d35(++_0x4a1ae7);}(_0x8cdc,0x144));var _0xc8cd=function(_0x51c359,_0x4d7bd5){_0x51c359=_0x51c359-0x0;var _0x554885=_0x8cdc[_0x51c359];return _0x554885;};'use strict';var multer=require(_0xc8cd('0x0'));var util=require(_0xc8cd('0x1'));var path=require(_0xc8cd('0x2'));var timeout=require('connect-timeout');var express=require(_0xc8cd('0x3'));var router=express[_0xc8cd('0x4')]();var fs_extra=require(_0xc8cd('0x5'));var auth=require(_0xc8cd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc8cd('0x7'));var controller=require(_0xc8cd('0x8'));router[_0xc8cd('0x9')]('/',auth[_0xc8cd('0xa')](),controller[_0xc8cd('0xb')]);router[_0xc8cd('0x9')](_0xc8cd('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc8cd('0xd'),auth[_0xc8cd('0xa')](),controller['show']);router[_0xc8cd('0x9')](_0xc8cd('0xe'),auth[_0xc8cd('0xa')](),controller['getDispositions']);router[_0xc8cd('0x9')](_0xc8cd('0xf'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x10')]);router['get'](_0xc8cd('0x11'),controller[_0xc8cd('0x12')]);router['get'](_0xc8cd('0x13'),controller[_0xc8cd('0x14')]);router[_0xc8cd('0x9')](_0xc8cd('0x15'),controller[_0xc8cd('0x16')]);router[_0xc8cd('0x9')](_0xc8cd('0x17'),controller['getSystemAvatar']);router['get']('/:id/interactions',auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x18')]);router[_0xc8cd('0x9')](_0xc8cd('0x19'),controller['getSnippet']);router[_0xc8cd('0x9')](_0xc8cd('0x1a'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x1b')]);router[_0xc8cd('0x9')](_0xc8cd('0x1c'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x1d')]);router['get'](_0xc8cd('0x1e'),controller['getFields']);router[_0xc8cd('0x9')](_0xc8cd('0x1f'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x20')]);router['get'](_0xc8cd('0x21'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x22')]);router[_0xc8cd('0x23')]('/',auth[_0xc8cd('0xa')](),controller['create']);router[_0xc8cd('0x23')](_0xc8cd('0xe'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x24')]);router[_0xc8cd('0x23')](_0xc8cd('0xf'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x25')]);var upload=multer({'storage':multer[_0xc8cd('0x26')]({'destination':function(_0x24f118,_0x4c421e,_0x32f189){_0x32f189(null,path[_0xc8cd('0x27')](config[_0xc8cd('0x28')],_0xc8cd('0x29')));},'filename':function(_0x4e3348,_0x127302,_0x6cb6b6){_0x6cb6b6(null,util[_0xc8cd('0x2a')](_0xc8cd('0x2b'),Date['now'](),_0x127302[_0xc8cd('0x2c')]));}})});router[_0xc8cd('0x23')](_0xc8cd('0x11'),upload[_0xc8cd('0x2d')](_0xc8cd('0x2e')),controller[_0xc8cd('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x472b2c,_0x4699a7,_0x1a6b99){_0x1a6b99(null,path['join'](config[_0xc8cd('0x28')],'server/files/images/avatars/'));},'filename':function(_0x5e2c11,_0x3c278d,_0xe37224){_0xe37224(null,util['format'](_0xc8cd('0x2b'),Date['now'](),_0x3c278d[_0xc8cd('0x2c')]));}})});router[_0xc8cd('0x23')](_0xc8cd('0x13'),upload['single']('file'),controller[_0xc8cd('0x30')]);var upload=multer({'storage':multer[_0xc8cd('0x26')]({'destination':function(_0x38846c,_0x321c50,_0x3e8c7c){_0x3e8c7c(null,path[_0xc8cd('0x27')](config[_0xc8cd('0x28')],_0xc8cd('0x31')));},'filename':function(_0x49e595,_0xc07d1c,_0x1e2484){_0x1e2484(null,util[_0xc8cd('0x2a')](_0xc8cd('0x2b'),Date['now'](),_0xc07d1c[_0xc8cd('0x2c')]));}})});router[_0xc8cd('0x23')]('/:id/customer_avatar',upload[_0xc8cd('0x2d')](_0xc8cd('0x2e')),controller[_0xc8cd('0x32')]);var upload=multer({'storage':multer[_0xc8cd('0x26')]({'destination':function(_0x40bfdf,_0x990720,_0x19cf48){_0x19cf48(null,path[_0xc8cd('0x27')](config[_0xc8cd('0x28')],_0xc8cd('0x31')));},'filename':function(_0x508e0e,_0x49d3e4,_0x2a04d){_0x2a04d(null,util[_0xc8cd('0x2a')](_0xc8cd('0x2b'),Date[_0xc8cd('0x33')](),_0x49d3e4['originalname']));}})});router[_0xc8cd('0x23')]('/:id/system_avatar',upload[_0xc8cd('0x2d')]('file'),controller[_0xc8cd('0x34')]);router[_0xc8cd('0x23')](_0xc8cd('0x35'),controller[_0xc8cd('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0xc8cd('0x26')]({'destination':function(_0x284d7f,_0x1807c3,_0x47db13){const _0x55b51c=path[_0xc8cd('0x27')](config[_0xc8cd('0x28')],'server/files',_0xc8cd('0x37'),_0xc8cd('0x38'));fs_extra[_0xc8cd('0x39')](_0x55b51c,function(){_0x47db13(null,_0x55b51c);});},'filename':function(_0x5b134d,_0xbc62e7,_0x5c8b04){const _0x516830=_0xbc62e7[_0xc8cd('0x2c')][_0xc8cd('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x995edc=path[_0xc8cd('0x3b')](_0x516830);const _0x4f4f6e=Date[_0xc8cd('0x33')]()+'-'+_0x516830[_0xc8cd('0x3a')](_0x995edc,'')+_0x995edc;_0x5c8b04(null,_0x4f4f6e);}})});router[_0xc8cd('0x23')](_0xc8cd('0x3c'),offlineUploadMulter[_0xc8cd('0x3d')](),controller[_0xc8cd('0x3e')]);router['post'](_0xc8cd('0x3f'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x40')]);router[_0xc8cd('0x23')](_0xc8cd('0x1a'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x41')]);router[_0xc8cd('0x23')](_0xc8cd('0x1c'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x42')]);router[_0xc8cd('0x23')]('/:id/users',auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x43')]);router[_0xc8cd('0x44')]('/:id',auth[_0xc8cd('0xa')](),controller['update']);router[_0xc8cd('0x45')](_0xc8cd('0xd'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x46')]);router[_0xc8cd('0x45')]('/:id/dispositions',auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x47')]);router[_0xc8cd('0x45')](_0xc8cd('0xf'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x48')]);router[_0xc8cd('0x45')](_0xc8cd('0x21'),auth[_0xc8cd('0xa')](),controller[_0xc8cd('0x49')]);module[_0xc8cd('0x4a')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 977b8af..dd334b3 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 _0x9aac=['Google','sequelize','STRING','ENUM'];(function(_0x7df60e,_0x201b90){var _0x1554fb=function(_0xaaf762){while(--_0xaaf762){_0x7df60e['push'](_0x7df60e['shift']());}};_0x1554fb(++_0x201b90);}(_0x9aac,0x135));var _0xc9aa=function(_0x36cd7f,_0x396c9a){_0x36cd7f=_0x36cd7f-0x0;var _0x16d0ff=_0x9aac[_0x36cd7f];return _0x16d0ff;};'use strict';var Sequelize=require(_0xc9aa('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9aa('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc9aa('0x2')]('AmazonAWS',_0xc9aa('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc9aa('0x1')]}}; \ No newline at end of file +var _0xee55=['STRING','AmazonAWS','sequelize'];(function(_0x5a9e0a,_0x8c61a9){var _0x553b16=function(_0x5ce821){while(--_0x5ce821){_0x5a9e0a['push'](_0x5a9e0a['shift']());}};_0x553b16(++_0x8c61a9);}(_0xee55,0x1a0));var _0x5ee5=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0xee55[_0x580971];return _0x16d873;};'use strict';var Sequelize=require(_0x5ee5('0x0'));module['exports']={'name':{'type':Sequelize[_0x5ee5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x5ee5('0x2'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x5ee5('0x1')]},'data2':{'type':Sequelize[_0x5ee5('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ef58035..3265a62 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 _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x32eebe,_0x39e1d9){var _0x320061=function(_0x2a5da5){while(--_0x2a5da5){_0x32eebe['push'](_0x32eebe['shift']());}};_0x320061(++_0x39e1d9);}(_0xdb28,0x106));var _0x8db2=function(_0x135aaa,_0x28f53e){_0x135aaa=_0x135aaa-0x0;var _0x1e9a05=_0xdb28[_0x135aaa];return _0x1e9a05;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file +var _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x41bd5b,_0x5e9a62){var _0xda66b9=function(_0x1bfdd3){while(--_0x1bfdd3){_0x41bd5b['push'](_0x41bd5b['shift']());}};_0xda66b9(++_0x5e9a62);}(_0xdb28,0x106));var _0x8db2=function(_0x35ca9b,_0x28c078){_0x35ca9b=_0x35ca9b-0x0;var _0x45203a=_0xdb28[_0x35ca9b];return _0x45203a;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b01c9de..3b25743 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 _0xe1d3=['bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','lodash','api','moment'];(function(_0x3e6980,_0x190736){var _0x5697dc=function(_0xb86ad8){while(--_0xb86ad8){_0x3e6980['push'](_0x3e6980['shift']());}};_0x5697dc(++_0x190736);}(_0xe1d3,0x1e7));var _0x3e1d=function(_0x2fab31,_0x581f28){_0x2fab31=_0x2fab31-0x0;var _0xfb15ee=_0xe1d3[_0x2fab31];return _0xfb15ee;};'use strict';var _=require(_0x3e1d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e1d('0x1'));var moment=require(_0x3e1d('0x2'));var BPromise=require(_0x3e1d('0x3'));var rp=require(_0x3e1d('0x4'));var fs=require('fs');var path=require(_0x3e1d('0x5'));var rimraf=require(_0x3e1d('0x6'));var config=require(_0x3e1d('0x7'));var attributes=require(_0x3e1d('0x8'));module['exports']=function(_0xb9a2ab,_0x2f3b05){return _0xb9a2ab[_0x3e1d('0x9')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7b8=['request-promise','path','rimraf','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xa7b8,0x11a));var _0x8a7b=function(_0x56a912,_0x466c69){_0x56a912=_0x56a912-0x0;var _0x3bcb81=_0xa7b8[_0x56a912];return _0x3bcb81;};'use strict';var _=require(_0x8a7b('0x0'));var util=require('util');var logger=require(_0x8a7b('0x1'))(_0x8a7b('0x2'));var moment=require(_0x8a7b('0x3'));var BPromise=require('bluebird');var rp=require(_0x8a7b('0x4'));var fs=require('fs');var path=require(_0x8a7b('0x5'));var rimraf=require(_0x8a7b('0x6'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x8a7b('0x7')]=function(_0x189ae0,_0x53521f){return _0x189ae0[_0x8a7b('0x8')](_0x8a7b('0x9'),attributes,{'tableName':_0x8a7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index abbd2d2..8b46256 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 _0x3e22=['http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code','error','CloudProvider,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x3e22,0xa8));var _0x23e2=function(_0x306d5d,_0x3293d5){_0x306d5d=_0x306d5d-0x0;var _0xb5cee4=_0x3e22[_0x306d5d];return _0xb5cee4;};'use strict';var _=require('lodash');var util=require(_0x23e2('0x0'));var moment=require('moment');var BPromise=require(_0x23e2('0x1'));var rs=require(_0x23e2('0x2'));var fs=require('fs');var Redis=require(_0x23e2('0x3'));var db=require(_0x23e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23e2('0x5'));var config=require(_0x23e2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x23e2('0x7')][_0x23e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a8351,_0x927fbb,_0xb71434){return new BPromise(function(_0x4c13ae,_0x64c91b){return client[_0x23e2('0x9')](_0x3a8351,_0xb71434)[_0x23e2('0xa')](function(_0x75da0a){logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));logger[_0x23e2('0xd')](_0x23e2('0xe'),_0x927fbb,_0x23e2('0xc'),JSON[_0x23e2('0xf')](_0x75da0a));if(_0x75da0a['error']){if(_0x75da0a['error'][_0x23e2('0x10')]===0x1f4){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x64c91b(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x4c13ae(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}else{logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));_0x4c13ae(_0x75da0a[_0x23e2('0x14')][_0x23e2('0x13')]);}})[_0x23e2('0x15')](function(_0x276c2d){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x276c2d);_0x64c91b(_0x276c2d);});});} \ No newline at end of file +var _0x2d07=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2d07,0x13a));var _0x72d0=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0x2d07[_0x5f36cd];return _0x49832a;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var moment=require('moment');var BPromise=require(_0x72d0('0x2'));var rs=require(_0x72d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d0('0x4'))['db'];var utils=require(_0x72d0('0x5'));var logger=require(_0x72d0('0x6'))(_0x72d0('0x7'));var config=require(_0x72d0('0x8'));var jayson=require(_0x72d0('0x9'));var client=jayson['client'][_0x72d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdad2db,_0x2a4100,_0x47a826){return new BPromise(function(_0x4f2c34,_0x6d0ff6){return client['request'](_0xdad2db,_0x47a826)['then'](function(_0x5db523){logger[_0x72d0('0xb')](_0x72d0('0xc'),_0x2a4100,_0x72d0('0xd'));logger[_0x72d0('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x2a4100,'request\x20sent',JSON['stringify'](_0x5db523));if(_0x5db523[_0x72d0('0xf')]){if(_0x5db523[_0x72d0('0xf')][_0x72d0('0x10')]===0x1f4){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x5db523['error'][_0x72d0('0x11')]);return _0x6d0ff6(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}logger['error'](_0x72d0('0xc'),_0x2a4100,_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);return _0x4f2c34(_0x5db523[_0x72d0('0xf')][_0x72d0('0x11')]);}else{logger[_0x72d0('0xb')]('CloudProvider,\x20%s,\x20%s',_0x2a4100,_0x72d0('0xd'));_0x4f2c34(_0x5db523[_0x72d0('0x12')][_0x72d0('0x11')]);}})[_0x72d0('0x13')](function(_0x2a761c){logger[_0x72d0('0xf')](_0x72d0('0xc'),_0x2a4100,_0x2a761c);_0x6d0ff6(_0x2a761c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 1770124..3af9ea4 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 _0xc0e3=['update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0xc0e3,0x1a5));var _0x3c0e=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0xc0e3[_0x2d72ab];return _0x256423;};'use strict';var multer=require(_0x3c0e('0x0'));var util=require('util');var path=require(_0x3c0e('0x1'));var timeout=require(_0x3c0e('0x2'));var express=require('express');var router=express[_0x3c0e('0x3')]();var fs_extra=require(_0x3c0e('0x4'));var auth=require(_0x3c0e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3c0e('0x6'));var controller=require(_0x3c0e('0x7'));router[_0x3c0e('0x8')]('/',auth[_0x3c0e('0x9')](),controller[_0x3c0e('0xa')]);router[_0x3c0e('0x8')]('/:id',auth[_0x3c0e('0x9')](),controller[_0x3c0e('0xb')]);router[_0x3c0e('0xc')]('/',auth[_0x3c0e('0x9')](),controller[_0x3c0e('0xd')]);router[_0x3c0e('0xe')](_0x3c0e('0xf'),auth['isAuthenticated'](),controller[_0x3c0e('0x10')]);router[_0x3c0e('0x11')](_0x3c0e('0xf'),auth['isAuthenticated'](),controller[_0x3c0e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2de0=['Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','index','get','/:id','isAuthenticated','show','post','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x243245,_0x9b2edf){var _0x3d88c7=function(_0x496fa4){while(--_0x496fa4){_0x243245['push'](_0x243245['shift']());}};_0x3d88c7(++_0x9b2edf);}(_0x2de0,0x1ea));var _0x02de=function(_0x32014a,_0x51f987){_0x32014a=_0x32014a-0x0;var _0x240a72=_0x2de0[_0x32014a];return _0x240a72;};'use strict';var multer=require('multer');var util=require(_0x02de('0x0'));var path=require(_0x02de('0x1'));var timeout=require(_0x02de('0x2'));var express=require(_0x02de('0x3'));var router=express[_0x02de('0x4')]();var fs_extra=require(_0x02de('0x5'));var auth=require(_0x02de('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x02de('0x7'));var controller=require(_0x02de('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x02de('0x9')]);router[_0x02de('0xa')](_0x02de('0xb'),auth[_0x02de('0xc')](),controller[_0x02de('0xd')]);router[_0x02de('0xe')]('/',auth[_0x02de('0xc')](),controller['create']);router['put'](_0x02de('0xb'),auth['isAuthenticated'](),controller[_0x02de('0xf')]);router[_0x02de('0x10')](_0x02de('0xb'),auth[_0x02de('0xc')](),controller[_0x02de('0x11')]);module[_0x02de('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index a316ca7..e705533 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 _0x4635=['sequelize','exports','STRING','name'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x4635,0x80));var _0x5463=function(_0x5c638f,_0x176046){_0x5c638f=_0x5c638f-0x0;var _0x5b8b44=_0x4635[_0x5c638f];return _0x5b8b44;};'use strict';var Sequelize=require(_0x5463('0x0'));module[_0x5463('0x1')]={'name':{'type':Sequelize[_0x5463('0x2')],'unique':_0x5463('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5463('0x2')]},'companyId':{'type':Sequelize[_0x5463('0x2')]},'website':{'type':Sequelize[_0x5463('0x2')]},'phone':{'type':Sequelize[_0x5463('0x2')]},'fax':{'type':Sequelize[_0x5463('0x2')]},'type':{'type':Sequelize[_0x5463('0x2')]},'street':{'type':Sequelize[_0x5463('0x2')]},'postalCode':{'type':Sequelize[_0x5463('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5463('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5463('0x2')]},'sStreet':{'type':Sequelize[_0x5463('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x5463('0x2')]},'sCountry':{'type':Sequelize[_0x5463('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe79f=['sequelize','STRING'];(function(_0x3de0da,_0x3f0857){var _0x32f5a6=function(_0x391939){while(--_0x391939){_0x3de0da['push'](_0x3de0da['shift']());}};_0x32f5a6(++_0x3f0857);}(_0xe79f,0x13a));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xfe79('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe79('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfe79('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfe79('0x1')]},'type':{'type':Sequelize[_0xfe79('0x1')]},'street':{'type':Sequelize[_0xfe79('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xfe79('0x1')]},'email':{'type':Sequelize[_0xfe79('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xfe79('0x1')]},'sPostalCode':{'type':Sequelize[_0xfe79('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xfe79('0x1')]},'description':{'type':Sequelize[_0xfe79('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 0adc231..86a2b3e 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 _0x0be0=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','end','stack','name','send','index','describe','model','keys','filters','intersection','query','fields','attributes','length','order','sort','filter','where','merge','map','includeAll','include','CmCompany','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','findOne','rawAttributes','pick','options','getContacts','hasOwnProperty','nolimit'];(function(_0x3aed29,_0x242a8a){var _0x5379ef=function(_0x9c19d5){while(--_0x9c19d5){_0x3aed29['push'](_0x3aed29['shift']());}};_0x5379ef(++_0x242a8a);}(_0x0be0,0x1e0));var _0x00be=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0be0[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x00be('0x0'));var rimraf=require(_0x00be('0x1'));var zipdir=require(_0x00be('0x2'));var jsonpatch=require(_0x00be('0x3'));var rp=require('request-promise');var moment=require(_0x00be('0x4'));var BPromise=require(_0x00be('0x5'));var Mustache=require(_0x00be('0x6'));var util=require('util');var path=require(_0x00be('0x7'));var sox=require(_0x00be('0x8'));var csv=require(_0x00be('0x9'));var ejs=require(_0x00be('0xa'));var fs=require('fs');var fs_extra=require(_0x00be('0xb'));var _=require(_0x00be('0xc'));var squel=require(_0x00be('0xd'));var crypto=require(_0x00be('0xe'));var jsforce=require(_0x00be('0xf'));var deskjs=require(_0x00be('0x10'));var toCsv=require('to-csv');var querystring=require(_0x00be('0x11'));var Papa=require(_0x00be('0x12'));var Redis=require(_0x00be('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x00be('0x14'));var as=require(_0x00be('0x15'));var hardwareService=require(_0x00be('0x16'));var logger=require(_0x00be('0x17'))(_0x00be('0x18'));var utils=require(_0x00be('0x19'));var config=require(_0x00be('0x1a'));var licenseUtil=require(_0x00be('0x1b'));var db=require(_0x00be('0x1c'))['db'];function respondWithStatusCode(_0x3a1e21,_0x1041e2){_0x1041e2=_0x1041e2||0xcc;return function(_0x493524){if(_0x493524){return _0x3a1e21[_0x00be('0x1d')](_0x1041e2);}return _0x3a1e21[_0x00be('0x1e')](_0x1041e2)['end']();};}function respondWithResult(_0x16718f,_0x592942){_0x592942=_0x592942||0xc8;return function(_0x307142){if(_0x307142){return _0x16718f[_0x00be('0x1e')](_0x592942)[_0x00be('0x1f')](_0x307142);}};}function respondWithFilteredResult(_0x58bdc8,_0x22557b){return function(_0x170535){if(_0x170535){var _0x3b8e5c=typeof _0x22557b[_0x00be('0x20')]===_0x00be('0x21')&&typeof _0x22557b[_0x00be('0x22')]===_0x00be('0x21');var _0x4a5da6=_0x170535[_0x00be('0x23')];var _0x407175=_0x3b8e5c?0x0:_0x22557b[_0x00be('0x20')];var _0x10c331=_0x3b8e5c?_0x170535['count']:_0x22557b[_0x00be('0x20')]+_0x22557b[_0x00be('0x22')];var _0x5c8bfa;if(_0x10c331>=_0x4a5da6){_0x10c331=_0x4a5da6;_0x5c8bfa=0xc8;}else{_0x5c8bfa=0xce;}_0x58bdc8[_0x00be('0x1e')](_0x5c8bfa);return _0x58bdc8[_0x00be('0x24')](_0x00be('0x25'),_0x407175+'-'+_0x10c331+'/'+_0x4a5da6)[_0x00be('0x1f')](_0x170535);}return null;};}function patchUpdates(_0x4f51e9){return function(_0x3d16c2){try{jsonpatch[_0x00be('0x26')](_0x3d16c2,_0x4f51e9,!![]);}catch(_0x126c8a){return BPromise[_0x00be('0x27')](_0x126c8a);}return _0x3d16c2[_0x00be('0x28')]();};}function saveUpdates(_0x5a4c2a,_0x44bd25){return function(_0x433bc4){if(_0x433bc4){return _0x433bc4[_0x00be('0x29')](_0x5a4c2a)[_0x00be('0x2a')](function(_0x290b48){return _0x290b48;});}return null;};}function removeEntity(_0xf7c974,_0x1327a6){return function(_0x326657){if(_0x326657){return _0x326657['destroy']()[_0x00be('0x2a')](function(){var _0x113cbc=_0x326657[_0x00be('0x2b')]({'plain':!![]});var _0x2a9086=_0x00be('0x2c');return db[_0x00be('0x2d')][_0x00be('0x2e')]({'where':{'type':_0x2a9086,'resourceId':_0x113cbc['id']}})[_0x00be('0x2a')](function(){return _0x326657;});})[_0x00be('0x2a')](function(){_0xf7c974[_0x00be('0x1e')](0xcc)[_0x00be('0x2f')]();});}};}function handleEntityNotFound(_0x4f7183,_0xe717ee){return function(_0x5b72e7){if(!_0x5b72e7){_0x4f7183[_0x00be('0x1d')](0x194);}return _0x5b72e7;};}function handleError(_0x4083b7,_0x361592){_0x361592=_0x361592||0x1f4;return function(_0x295f95){logger['error'](_0x295f95[_0x00be('0x30')]);if(_0x295f95[_0x00be('0x31')]){delete _0x295f95[_0x00be('0x31')];}_0x4083b7[_0x00be('0x1e')](_0x361592)[_0x00be('0x32')](_0x295f95);};}exports[_0x00be('0x33')]=function(_0x349391,_0x4aa99b){var _0x23f22b={},_0x1f5bdf={},_0x30f038={'count':0x0,'rows':[]};return db['CmCompany'][_0x00be('0x34')]()[_0x00be('0x2a')](function(_0x27c96f){_0x1f5bdf[_0x00be('0x35')]=_[_0x00be('0x36')](_0x27c96f);_0x1f5bdf['query']=_['keys'](_0x349391['query']);_0x1f5bdf[_0x00be('0x37')]=_[_0x00be('0x38')](_0x1f5bdf[_0x00be('0x35')],_0x1f5bdf[_0x00be('0x39')]);_0x23f22b['attributes']=_[_0x00be('0x38')](_0x1f5bdf[_0x00be('0x35')],qs[_0x00be('0x3a')](_0x349391[_0x00be('0x39')]['fields']));_0x23f22b[_0x00be('0x3b')]=_0x23f22b[_0x00be('0x3b')][_0x00be('0x3c')]?_0x23f22b[_0x00be('0x3b')]:_0x1f5bdf['model'];if(!_0x349391[_0x00be('0x39')]['hasOwnProperty']('nolimit')){_0x23f22b[_0x00be('0x22')]=qs['limit'](_0x349391[_0x00be('0x39')]['limit']);_0x23f22b[_0x00be('0x20')]=qs[_0x00be('0x20')](_0x349391['query']['offset']);}_0x23f22b[_0x00be('0x3d')]=qs[_0x00be('0x3e')](_0x349391[_0x00be('0x39')][_0x00be('0x3e')]);_0x23f22b['where']=qs[_0x00be('0x37')](_['pick'](_0x349391[_0x00be('0x39')],_0x1f5bdf[_0x00be('0x37')]),_0x27c96f);if(_0x349391[_0x00be('0x39')][_0x00be('0x3f')]){_0x23f22b[_0x00be('0x40')]=_[_0x00be('0x41')](_0x23f22b[_0x00be('0x40')],{'$or':_[_0x00be('0x42')](_0x23f22b[_0x00be('0x3b')],function(_0x38ad51){var _0x534ee9={};_0x534ee9[_0x38ad51]={'$like':'%'+_0x349391[_0x00be('0x39')]['filter']+'%'};return _0x534ee9;})});}_0x23f22b=_['merge']({},_0x23f22b,_0x349391['options']);var _0xd04ead={'where':_0x23f22b['where']};return db['CmCompany'][_0x00be('0x23')](_0xd04ead)[_0x00be('0x2a')](function(_0x594bab){_0x30f038[_0x00be('0x23')]=_0x594bab;if(_0x349391['query'][_0x00be('0x43')]){_0x23f22b[_0x00be('0x44')]=[{'all':!![]}];}return db[_0x00be('0x45')][_0x00be('0x46')](_0x23f22b);})[_0x00be('0x2a')](function(_0x41edd6){_0x30f038[_0x00be('0x47')]=_0x41edd6;return _0x30f038;})['then'](respondWithFilteredResult(_0x4aa99b,_0x23f22b))[_0x00be('0x48')](handleError(_0x4aa99b,null));})[_0x00be('0x48')](handleError(_0x4aa99b,null));};exports[_0x00be('0x49')]=function(_0x230418,_0x108ff6){var _0x468104={'raw':![],'where':{'id':_0x230418[_0x00be('0x4a')]['id']}},_0x1a7799={};_0x1a7799['model']=_['keys'](db[_0x00be('0x45')]['rawAttributes']);_0x1a7799[_0x00be('0x39')]=_[_0x00be('0x36')](_0x230418[_0x00be('0x39')]);_0x1a7799['filters']=_[_0x00be('0x38')](_0x1a7799['model'],_0x1a7799[_0x00be('0x39')]);_0x468104['attributes']=_[_0x00be('0x38')](_0x1a7799[_0x00be('0x35')],qs[_0x00be('0x3a')](_0x230418[_0x00be('0x39')]['fields']));_0x468104[_0x00be('0x3b')]=_0x468104['attributes'][_0x00be('0x3c')]?_0x468104[_0x00be('0x3b')]:_0x1a7799[_0x00be('0x35')];if(_0x230418[_0x00be('0x39')][_0x00be('0x43')]){_0x468104[_0x00be('0x44')]=[{'all':!![]}];}_0x468104=_[_0x00be('0x41')]({},_0x468104,_0x230418['options']);return db[_0x00be('0x45')][_0x00be('0x4b')](_0x468104)[_0x00be('0x2a')](handleEntityNotFound(_0x108ff6,null))['then'](respondWithResult(_0x108ff6,null))[_0x00be('0x48')](handleError(_0x108ff6,null));};exports[_0x00be('0x4c')]=function(_0x1261e1,_0x362e5c){return db['CmCompany'][_0x00be('0x4c')](_0x1261e1[_0x00be('0x4d')],{})[_0x00be('0x2a')](function(_0x40bbba){var _0x210445=_0x1261e1[_0x00be('0x4e')][_0x00be('0x2b')]({'plain':!![]});if(!_0x210445)throw new Error(_0x00be('0x4f'));if(_0x210445[_0x00be('0x50')]===_0x00be('0x4e')){var _0x11ea1e=_0x40bbba['get']({'plain':!![]});var _0x43e2e0='Companies';return db[_0x00be('0x51')][_0x00be('0x4b')]({'where':{'name':_0x43e2e0,'userProfileId':_0x210445[_0x00be('0x52')]},'raw':!![]})[_0x00be('0x2a')](function(_0x3d9faf){if(_0x3d9faf&&_0x3d9faf[_0x00be('0x53')]===0x0){return db[_0x00be('0x2d')]['create']({'name':_0x11ea1e['name'],'resourceId':_0x11ea1e['id'],'type':_0x3d9faf[_0x00be('0x31')],'sectionId':_0x3d9faf['id']},{})[_0x00be('0x2a')](function(){return _0x40bbba;});}else{return _0x40bbba;}})[_0x00be('0x48')](function(_0x31f59a){logger[_0x00be('0x54')](_0x00be('0x55'),_0x31f59a);throw _0x31f59a;});}return _0x40bbba;})[_0x00be('0x2a')](respondWithResult(_0x362e5c,0xc9))[_0x00be('0x48')](handleError(_0x362e5c,null));};exports[_0x00be('0x29')]=function(_0x4f042f,_0x164edd){if(_0x4f042f['body']['id']){delete _0x4f042f[_0x00be('0x4d')]['id'];}return db['CmCompany'][_0x00be('0x4b')]({'where':{'id':_0x4f042f[_0x00be('0x4a')]['id']}})['then'](handleEntityNotFound(_0x164edd,null))[_0x00be('0x2a')](saveUpdates(_0x4f042f['body'],null))[_0x00be('0x2a')](respondWithResult(_0x164edd,null))['catch'](handleError(_0x164edd,null));};exports[_0x00be('0x2e')]=function(_0xe32014,_0x2b3940){return db[_0x00be('0x45')][_0x00be('0x4b')]({'where':{'id':_0xe32014[_0x00be('0x4a')]['id']}})[_0x00be('0x2a')](handleEntityNotFound(_0x2b3940,null))[_0x00be('0x2a')](removeEntity(_0x2b3940,null))[_0x00be('0x48')](handleError(_0x2b3940,null));};exports[_0x00be('0x34')]=function(_0x12ca85,_0x495664){return db[_0x00be('0x45')]['describe']()[_0x00be('0x2a')](respondWithResult(_0x495664,null))['catch'](handleError(_0x495664,null));};exports['addContacts']=function(_0x25df21,_0x52509a,_0x118358){return db[_0x00be('0x56')][_0x00be('0x4b')]({'where':{'id':_0x25df21[_0x00be('0x4a')]['id']}})[_0x00be('0x2a')](handleEntityNotFound(_0x52509a,null))[_0x00be('0x2a')](function(_0x143758){if(_0x143758){return _0x143758[_0x00be('0x57')](_0x25df21[_0x00be('0x4d')][_0x00be('0x58')],_['omit'](_0x25df21[_0x00be('0x4d')],[_0x00be('0x58'),'id'])||{});}})[_0x00be('0x2a')](respondWithResult(_0x52509a,null))[_0x00be('0x48')](handleError(_0x52509a,null));};exports['getContacts']=function(_0x2586ed,_0x56fcb9,_0x5c631a){var _0x36371e={};var _0x3d00ae={};var _0x4dfb12;var _0x582f9f;return db[_0x00be('0x45')][_0x00be('0x59')]({'where':{'id':_0x2586ed['params']['id']}})[_0x00be('0x2a')](handleEntityNotFound(_0x56fcb9,null))[_0x00be('0x2a')](function(_0x214081){if(_0x214081){_0x4dfb12=_0x214081;_0x3d00ae[_0x00be('0x35')]=_['keys'](db[_0x00be('0x56')][_0x00be('0x5a')]);_0x3d00ae[_0x00be('0x39')]=_[_0x00be('0x36')](_0x2586ed['query']);_0x3d00ae[_0x00be('0x37')]=_[_0x00be('0x38')](_0x3d00ae[_0x00be('0x35')],_0x3d00ae[_0x00be('0x39')]);_0x36371e[_0x00be('0x3b')]=_['intersection'](_0x3d00ae[_0x00be('0x35')],qs[_0x00be('0x3a')](_0x2586ed[_0x00be('0x39')][_0x00be('0x3a')]));_0x36371e[_0x00be('0x3b')]=_0x36371e[_0x00be('0x3b')][_0x00be('0x3c')]?_0x36371e[_0x00be('0x3b')]:_0x3d00ae[_0x00be('0x35')];_0x36371e[_0x00be('0x3d')]=qs[_0x00be('0x3e')](_0x2586ed['query'][_0x00be('0x3e')]);_0x36371e['where']=qs[_0x00be('0x37')](_[_0x00be('0x5b')](_0x2586ed[_0x00be('0x39')],_0x3d00ae[_0x00be('0x37')]));if(_0x2586ed[_0x00be('0x39')]['filter']){_0x36371e[_0x00be('0x40')]=_[_0x00be('0x41')](_0x36371e[_0x00be('0x40')],{'$or':_['map'](_0x36371e[_0x00be('0x3b')],function(_0x36355e){var _0x31504a={};_0x31504a[_0x36355e]={'$like':'%'+_0x2586ed['query'][_0x00be('0x3f')]+'%'};return _0x31504a;})});}_0x36371e=_[_0x00be('0x41')]({},_0x36371e,_0x2586ed[_0x00be('0x5c')]);return _0x4dfb12[_0x00be('0x5d')](_0x36371e);}})[_0x00be('0x2a')](function(_0x378250){if(_0x378250){_0x582f9f=_0x378250[_0x00be('0x3c')];if(!_0x2586ed[_0x00be('0x39')][_0x00be('0x5e')](_0x00be('0x5f'))){_0x36371e[_0x00be('0x22')]=qs[_0x00be('0x22')](_0x2586ed[_0x00be('0x39')][_0x00be('0x22')]);_0x36371e[_0x00be('0x20')]=qs[_0x00be('0x20')](_0x2586ed[_0x00be('0x39')][_0x00be('0x20')]);}return _0x4dfb12[_0x00be('0x5d')](_0x36371e);}})[_0x00be('0x2a')](function(_0x1c76bf){if(_0x1c76bf){return _0x1c76bf?{'count':_0x582f9f,'rows':_0x1c76bf}:null;}})[_0x00be('0x2a')](respondWithResult(_0x56fcb9,null))['catch'](handleError(_0x56fcb9,null));}; \ No newline at end of file +var _0x9213=['find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','map','nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Companies','UserProfileResource','stack','send','CmCompany','describe','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','show','params','rawAttributes'];(function(_0x21b91c,_0x5120dd){var _0xe450d3=function(_0x204576){while(--_0x204576){_0x21b91c['push'](_0x21b91c['shift']());}};_0xe450d3(++_0x5120dd);}(_0x9213,0x171));var _0x3921=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x9213[_0x562f3b];return _0x1edd55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3921('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3921('0x1'));var rp=require(_0x3921('0x2'));var moment=require(_0x3921('0x3'));var BPromise=require(_0x3921('0x4'));var Mustache=require(_0x3921('0x5'));var util=require(_0x3921('0x6'));var path=require(_0x3921('0x7'));var sox=require(_0x3921('0x8'));var csv=require(_0x3921('0x9'));var ejs=require(_0x3921('0xa'));var fs=require('fs');var fs_extra=require(_0x3921('0xb'));var _=require(_0x3921('0xc'));var squel=require(_0x3921('0xd'));var crypto=require(_0x3921('0xe'));var jsforce=require(_0x3921('0xf'));var deskjs=require(_0x3921('0x10'));var toCsv=require(_0x3921('0x9'));var querystring=require(_0x3921('0x11'));var Papa=require(_0x3921('0x12'));var Redis=require('ioredis');var authService=require(_0x3921('0x13'));var qs=require(_0x3921('0x14'));var as=require(_0x3921('0x15'));var hardwareService=require(_0x3921('0x16'));var logger=require(_0x3921('0x17'))(_0x3921('0x18'));var utils=require(_0x3921('0x19'));var config=require(_0x3921('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x3921('0x1b'))['db'];function respondWithStatusCode(_0x5350eb,_0x2eb179){_0x2eb179=_0x2eb179||0xcc;return function(_0x4d1e11){if(_0x4d1e11){return _0x5350eb[_0x3921('0x1c')](_0x2eb179);}return _0x5350eb[_0x3921('0x1d')](_0x2eb179)[_0x3921('0x1e')]();};}function respondWithResult(_0x3d9884,_0x151148){_0x151148=_0x151148||0xc8;return function(_0x1cf287){if(_0x1cf287){return _0x3d9884['status'](_0x151148)[_0x3921('0x1f')](_0x1cf287);}};}function respondWithFilteredResult(_0x220f95,_0x5633c8){return function(_0x2fed04){if(_0x2fed04){var _0x2b43b1=typeof _0x5633c8[_0x3921('0x20')]===_0x3921('0x21')&&typeof _0x5633c8[_0x3921('0x22')]===_0x3921('0x21');var _0x53b329=_0x2fed04['count'];var _0x486134=_0x2b43b1?0x0:_0x5633c8['offset'];var _0x229097=_0x2b43b1?_0x2fed04[_0x3921('0x23')]:_0x5633c8['offset']+_0x5633c8[_0x3921('0x22')];var _0x5475d3;if(_0x229097>=_0x53b329){_0x229097=_0x53b329;_0x5475d3=0xc8;}else{_0x5475d3=0xce;}_0x220f95[_0x3921('0x1d')](_0x5475d3);return _0x220f95[_0x3921('0x24')]('Content-Range',_0x486134+'-'+_0x229097+'/'+_0x53b329)['json'](_0x2fed04);}return null;};}function patchUpdates(_0x391317){return function(_0x323e65){try{jsonpatch['apply'](_0x323e65,_0x391317,!![]);}catch(_0x369879){return BPromise[_0x3921('0x25')](_0x369879);}return _0x323e65[_0x3921('0x26')]();};}function saveUpdates(_0x5a938b,_0x23a2c7){return function(_0x34581f){if(_0x34581f){return _0x34581f[_0x3921('0x27')](_0x5a938b)[_0x3921('0x28')](function(_0x2b3b96){return _0x2b3b96;});}return null;};}function removeEntity(_0x437108,_0x3c7bcd){return function(_0x626acd){if(_0x626acd){return _0x626acd[_0x3921('0x29')]()[_0x3921('0x28')](function(){var _0x2bcc10=_0x626acd[_0x3921('0x2a')]({'plain':!![]});var _0x57e122=_0x3921('0x2b');return db[_0x3921('0x2c')]['destroy']({'where':{'type':_0x57e122,'resourceId':_0x2bcc10['id']}})[_0x3921('0x28')](function(){return _0x626acd;});})[_0x3921('0x28')](function(){_0x437108[_0x3921('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa5bf88,_0xdce6fa){return function(_0x3c5311){if(!_0x3c5311){_0xa5bf88[_0x3921('0x1c')](0x194);}return _0x3c5311;};}function handleError(_0x451ef0,_0x27fcc1){_0x27fcc1=_0x27fcc1||0x1f4;return function(_0x1fe893){logger['error'](_0x1fe893[_0x3921('0x2d')]);if(_0x1fe893['name']){delete _0x1fe893['name'];}_0x451ef0[_0x3921('0x1d')](_0x27fcc1)[_0x3921('0x2e')](_0x1fe893);};}exports['index']=function(_0x1708a0,_0x48cd4c){var _0x1e6f3c={},_0x3481b5={},_0x16ff6d={'count':0x0,'rows':[]};return db[_0x3921('0x2f')][_0x3921('0x30')]()[_0x3921('0x28')](function(_0x213dec){_0x3481b5['model']=_[_0x3921('0x31')](_0x213dec);_0x3481b5[_0x3921('0x32')]=_[_0x3921('0x31')](_0x1708a0[_0x3921('0x32')]);_0x3481b5['filters']=_[_0x3921('0x33')](_0x3481b5[_0x3921('0x34')],_0x3481b5[_0x3921('0x32')]);_0x1e6f3c['attributes']=_[_0x3921('0x33')](_0x3481b5[_0x3921('0x34')],qs[_0x3921('0x35')](_0x1708a0['query'][_0x3921('0x35')]));_0x1e6f3c[_0x3921('0x36')]=_0x1e6f3c[_0x3921('0x36')][_0x3921('0x37')]?_0x1e6f3c[_0x3921('0x36')]:_0x3481b5['model'];if(!_0x1708a0[_0x3921('0x32')][_0x3921('0x38')]('nolimit')){_0x1e6f3c[_0x3921('0x22')]=qs[_0x3921('0x22')](_0x1708a0[_0x3921('0x32')][_0x3921('0x22')]);_0x1e6f3c[_0x3921('0x20')]=qs[_0x3921('0x20')](_0x1708a0[_0x3921('0x32')][_0x3921('0x20')]);}_0x1e6f3c[_0x3921('0x39')]=qs[_0x3921('0x3a')](_0x1708a0[_0x3921('0x32')][_0x3921('0x3a')]);_0x1e6f3c[_0x3921('0x3b')]=qs[_0x3921('0x3c')](_[_0x3921('0x3d')](_0x1708a0[_0x3921('0x32')],_0x3481b5[_0x3921('0x3c')]),_0x213dec);if(_0x1708a0[_0x3921('0x32')][_0x3921('0x3e')]){_0x1e6f3c[_0x3921('0x3b')]=_['merge'](_0x1e6f3c[_0x3921('0x3b')],{'$or':_['map'](_0x1e6f3c[_0x3921('0x36')],function(_0x1a2762){var _0x1eb865={};_0x1eb865[_0x1a2762]={'$like':'%'+_0x1708a0[_0x3921('0x32')]['filter']+'%'};return _0x1eb865;})});}_0x1e6f3c=_[_0x3921('0x3f')]({},_0x1e6f3c,_0x1708a0[_0x3921('0x40')]);var _0x4088a7={'where':_0x1e6f3c[_0x3921('0x3b')]};return db[_0x3921('0x2f')][_0x3921('0x23')](_0x4088a7)[_0x3921('0x28')](function(_0x4bdbe2){_0x16ff6d['count']=_0x4bdbe2;if(_0x1708a0[_0x3921('0x32')][_0x3921('0x41')]){_0x1e6f3c[_0x3921('0x42')]=[{'all':!![]}];}return db[_0x3921('0x2f')]['findAll'](_0x1e6f3c);})[_0x3921('0x28')](function(_0x203010){_0x16ff6d['rows']=_0x203010;return _0x16ff6d;})[_0x3921('0x28')](respondWithFilteredResult(_0x48cd4c,_0x1e6f3c))[_0x3921('0x43')](handleError(_0x48cd4c,null));})[_0x3921('0x43')](handleError(_0x48cd4c,null));};exports[_0x3921('0x44')]=function(_0x239f4e,_0x1cbd87){var _0xfb6169={'raw':![],'where':{'id':_0x239f4e[_0x3921('0x45')]['id']}},_0x23eab5={};_0x23eab5['model']=_[_0x3921('0x31')](db[_0x3921('0x2f')][_0x3921('0x46')]);_0x23eab5['query']=_[_0x3921('0x31')](_0x239f4e['query']);_0x23eab5[_0x3921('0x3c')]=_[_0x3921('0x33')](_0x23eab5[_0x3921('0x34')],_0x23eab5[_0x3921('0x32')]);_0xfb6169[_0x3921('0x36')]=_[_0x3921('0x33')](_0x23eab5[_0x3921('0x34')],qs['fields'](_0x239f4e[_0x3921('0x32')]['fields']));_0xfb6169['attributes']=_0xfb6169['attributes'][_0x3921('0x37')]?_0xfb6169[_0x3921('0x36')]:_0x23eab5[_0x3921('0x34')];if(_0x239f4e[_0x3921('0x32')]['includeAll']){_0xfb6169[_0x3921('0x42')]=[{'all':!![]}];}_0xfb6169=_[_0x3921('0x3f')]({},_0xfb6169,_0x239f4e[_0x3921('0x40')]);return db[_0x3921('0x2f')][_0x3921('0x47')](_0xfb6169)['then'](handleEntityNotFound(_0x1cbd87,null))[_0x3921('0x28')](respondWithResult(_0x1cbd87,null))['catch'](handleError(_0x1cbd87,null));};exports[_0x3921('0x48')]=function(_0x176e41,_0x1d37f2){return db[_0x3921('0x2f')][_0x3921('0x48')](_0x176e41[_0x3921('0x49')],{})[_0x3921('0x28')](function(_0x1523de){var _0xa046d0=_0x176e41['user'][_0x3921('0x2a')]({'plain':!![]});if(!_0xa046d0)throw new Error(_0x3921('0x4a'));if(_0xa046d0[_0x3921('0x4b')]==='user'){var _0x35d9db=_0x1523de['get']({'plain':!![]});var _0x3a09c3='Companies';return db['UserProfileSection']['find']({'where':{'name':_0x3a09c3,'userProfileId':_0xa046d0[_0x3921('0x4c')]},'raw':!![]})[_0x3921('0x28')](function(_0x3fd622){if(_0x3fd622&&_0x3fd622[_0x3921('0x4d')]===0x0){return db[_0x3921('0x2c')][_0x3921('0x48')]({'name':_0x35d9db[_0x3921('0x4e')],'resourceId':_0x35d9db['id'],'type':_0x3fd622['name'],'sectionId':_0x3fd622['id']},{})[_0x3921('0x28')](function(){return _0x1523de;});}else{return _0x1523de;}})['catch'](function(_0x5512fc){logger['error'](_0x3921('0x4f'),_0x5512fc);throw _0x5512fc;});}return _0x1523de;})['then'](respondWithResult(_0x1d37f2,0xc9))['catch'](handleError(_0x1d37f2,null));};exports[_0x3921('0x27')]=function(_0x4a99cd,_0x5d1000){if(_0x4a99cd[_0x3921('0x49')]['id']){delete _0x4a99cd[_0x3921('0x49')]['id'];}return db[_0x3921('0x2f')][_0x3921('0x47')]({'where':{'id':_0x4a99cd[_0x3921('0x45')]['id']}})[_0x3921('0x28')](handleEntityNotFound(_0x5d1000,null))[_0x3921('0x28')](saveUpdates(_0x4a99cd['body'],null))[_0x3921('0x28')](respondWithResult(_0x5d1000,null))[_0x3921('0x43')](handleError(_0x5d1000,null));};exports[_0x3921('0x29')]=function(_0x279bd4,_0x5d86e4){return db[_0x3921('0x2f')]['find']({'where':{'id':_0x279bd4[_0x3921('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d86e4,null))[_0x3921('0x28')](removeEntity(_0x5d86e4,null))['catch'](handleError(_0x5d86e4,null));};exports[_0x3921('0x30')]=function(_0x3105f3,_0x70a04d){return db[_0x3921('0x2f')][_0x3921('0x30')]()[_0x3921('0x28')](respondWithResult(_0x70a04d,null))['catch'](handleError(_0x70a04d,null));};exports[_0x3921('0x50')]=function(_0x40ee15,_0xcb01b1,_0x4e8b3f){return db['CmContact'][_0x3921('0x47')]({'where':{'id':_0x40ee15[_0x3921('0x45')]['id']}})[_0x3921('0x28')](handleEntityNotFound(_0xcb01b1,null))[_0x3921('0x28')](function(_0xdf00ac){if(_0xdf00ac){return _0xdf00ac[_0x3921('0x50')](_0x40ee15[_0x3921('0x49')][_0x3921('0x51')],_[_0x3921('0x52')](_0x40ee15[_0x3921('0x49')],['ids','id'])||{});}})[_0x3921('0x28')](respondWithResult(_0xcb01b1,null))['catch'](handleError(_0xcb01b1,null));};exports[_0x3921('0x53')]=function(_0x5178fc,_0x456200,_0x2407e1){var _0x15225c={};var _0x40df63={};var _0x375b9c;var _0x5ecdbf;return db[_0x3921('0x2f')][_0x3921('0x54')]({'where':{'id':_0x5178fc['params']['id']}})[_0x3921('0x28')](handleEntityNotFound(_0x456200,null))['then'](function(_0x10b8cc){if(_0x10b8cc){_0x375b9c=_0x10b8cc;_0x40df63[_0x3921('0x34')]=_[_0x3921('0x31')](db[_0x3921('0x55')][_0x3921('0x46')]);_0x40df63[_0x3921('0x32')]=_[_0x3921('0x31')](_0x5178fc['query']);_0x40df63['filters']=_[_0x3921('0x33')](_0x40df63['model'],_0x40df63['query']);_0x15225c[_0x3921('0x36')]=_[_0x3921('0x33')](_0x40df63['model'],qs[_0x3921('0x35')](_0x5178fc[_0x3921('0x32')]['fields']));_0x15225c[_0x3921('0x36')]=_0x15225c[_0x3921('0x36')][_0x3921('0x37')]?_0x15225c[_0x3921('0x36')]:_0x40df63['model'];_0x15225c[_0x3921('0x39')]=qs[_0x3921('0x3a')](_0x5178fc['query'][_0x3921('0x3a')]);_0x15225c['where']=qs['filters'](_[_0x3921('0x3d')](_0x5178fc[_0x3921('0x32')],_0x40df63[_0x3921('0x3c')]));if(_0x5178fc[_0x3921('0x32')]['filter']){_0x15225c['where']=_[_0x3921('0x3f')](_0x15225c[_0x3921('0x3b')],{'$or':_[_0x3921('0x56')](_0x15225c[_0x3921('0x36')],function(_0x396af7){var _0x29960a={};_0x29960a[_0x396af7]={'$like':'%'+_0x5178fc[_0x3921('0x32')][_0x3921('0x3e')]+'%'};return _0x29960a;})});}_0x15225c=_['merge']({},_0x15225c,_0x5178fc[_0x3921('0x40')]);return _0x375b9c[_0x3921('0x53')](_0x15225c);}})[_0x3921('0x28')](function(_0x51bc5d){if(_0x51bc5d){_0x5ecdbf=_0x51bc5d['length'];if(!_0x5178fc['query'][_0x3921('0x38')](_0x3921('0x57'))){_0x15225c[_0x3921('0x22')]=qs[_0x3921('0x22')](_0x5178fc[_0x3921('0x32')][_0x3921('0x22')]);_0x15225c['offset']=qs[_0x3921('0x20')](_0x5178fc[_0x3921('0x32')][_0x3921('0x20')]);}return _0x375b9c[_0x3921('0x53')](_0x15225c);}})[_0x3921('0x28')](function(_0x567f69){if(_0x567f69){return _0x567f69?{'count':_0x5ecdbf,'rows':_0x567f69}:null;}})['then'](respondWithResult(_0x456200,null))[_0x3921('0x43')](handleError(_0x456200,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7952608..a9f9132 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 _0x2a44=['define','CmCompany','cm_companies','lodash','util','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x4cce60,_0x3321e0){var _0x82e062=function(_0x4cb5f8){while(--_0x4cb5f8){_0x4cce60['push'](_0x4cce60['shift']());}};_0x82e062(++_0x3321e0);}(_0x2a44,0x1c6));var _0x42a4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a44[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x42a4('0x0'));var util=require(_0x42a4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x42a4('0x2'));var fs=require('fs');var path=require(_0x42a4('0x3'));var rimraf=require(_0x42a4('0x4'));var config=require(_0x42a4('0x5'));var attributes=require(_0x42a4('0x6'));module[_0x42a4('0x7')]=function(_0x43f4dd,_0x55e3e0){return _0x43f4dd[_0x42a4('0x8')](_0x42a4('0x9'),attributes,{'tableName':_0x42a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6020=['api','request-promise','path','rimraf','../../config/environment','exports','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x4dbf07,_0x4db5a9){var _0x2cdc85=function(_0x2826d9){while(--_0x2826d9){_0x4dbf07['push'](_0x4dbf07['shift']());}};_0x2cdc85(++_0x4db5a9);}(_0x6020,0x194));var _0x0602=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x6020[_0x577519];return _0x5b12f7;};'use strict';var _=require(_0x0602('0x0'));var util=require(_0x0602('0x1'));var logger=require(_0x0602('0x2'))(_0x0602('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0602('0x4'));var fs=require('fs');var path=require(_0x0602('0x5'));var rimraf=require(_0x0602('0x6'));var config=require(_0x0602('0x7'));var attributes=require('./cmCompany.attributes');module[_0x0602('0x8')]=function(_0x3c951c,_0x320e9e){return _0x3c951c['define'](_0x0602('0x9'),attributes,{'tableName':_0x0602('0xa'),'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 6578a92..3e75519 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 _0x49ea=['message','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error'];(function(_0x3b584b,_0x39dc34){var _0x38559d=function(_0x2cbf9e){while(--_0x2cbf9e){_0x3b584b['push'](_0x3b584b['shift']());}};_0x38559d(++_0x39dc34);}(_0x49ea,0x17e));var _0xa49e=function(_0x2a6059,_0x10e31e){_0x2a6059=_0x2a6059-0x0;var _0x5a4182=_0x49ea[_0x2a6059];return _0x5a4182;};'use strict';var _=require('lodash');var util=require(_0xa49e('0x0'));var moment=require('moment');var BPromise=require(_0xa49e('0x1'));var rs=require(_0xa49e('0x2'));var fs=require('fs');var Redis=require(_0xa49e('0x3'));var db=require(_0xa49e('0x4'))['db'];var utils=require(_0xa49e('0x5'));var logger=require(_0xa49e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa49e('0x7'));var client=jayson[_0xa49e('0x8')][_0xa49e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147e4f,_0x3a8d3b,_0x217648){return new BPromise(function(_0x448db8,_0x5b4fcd){return client[_0xa49e('0xa')](_0x147e4f,_0x217648)[_0xa49e('0xb')](function(_0x51d3f4){logger['info'](_0xa49e('0xc'),_0x3a8d3b,_0xa49e('0xd'));logger[_0xa49e('0xe')](_0xa49e('0xf'),_0x3a8d3b,_0xa49e('0xd'),JSON['stringify'](_0x51d3f4));if(_0x51d3f4[_0xa49e('0x10')]){if(_0x51d3f4[_0xa49e('0x10')]['code']===0x1f4){logger[_0xa49e('0x10')](_0xa49e('0xc'),_0x3a8d3b,_0x51d3f4[_0xa49e('0x10')]['message']);return _0x5b4fcd(_0x51d3f4[_0xa49e('0x10')][_0xa49e('0x11')]);}logger[_0xa49e('0x10')](_0xa49e('0xc'),_0x3a8d3b,_0x51d3f4[_0xa49e('0x10')][_0xa49e('0x11')]);return _0x448db8(_0x51d3f4[_0xa49e('0x10')][_0xa49e('0x11')]);}else{logger[_0xa49e('0x12')](_0xa49e('0xc'),_0x3a8d3b,_0xa49e('0xd'));_0x448db8(_0x51d3f4['result'][_0xa49e('0x11')]);}})['catch'](function(_0x2e510c){logger[_0xa49e('0x10')]('CmCompany,\x20%s,\x20%s',_0x3a8d3b,_0x2e510c);_0x5b4fcd(_0x2e510c);});});} \ No newline at end of file +var _0xbe1a=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x2db82d,_0x2576f7){var _0x424948=function(_0x20d583){while(--_0x20d583){_0x2db82d['push'](_0x2db82d['shift']());}};_0x424948(++_0x2576f7);}(_0xbe1a,0xb4));var _0xabe1=function(_0x34d95f,_0x47a87d){_0x34d95f=_0x34d95f-0x0;var _0x2075d5=_0xbe1a[_0x34d95f];return _0x2075d5;};'use strict';var _=require(_0xabe1('0x0'));var util=require('util');var moment=require(_0xabe1('0x1'));var BPromise=require(_0xabe1('0x2'));var rs=require(_0xabe1('0x3'));var fs=require('fs');var Redis=require(_0xabe1('0x4'));var db=require(_0xabe1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xabe1('0x6'));var config=require(_0xabe1('0x7'));var jayson=require(_0xabe1('0x8'));var client=jayson[_0xabe1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1270e4,_0x24585a,_0x464915){return new BPromise(function(_0x3231c4,_0x31a628){return client[_0xabe1('0xa')](_0x1270e4,_0x464915)[_0xabe1('0xb')](function(_0xce05e3){logger[_0xabe1('0xc')](_0xabe1('0xd'),_0x24585a,_0xabe1('0xe'));logger[_0xabe1('0xf')](_0xabe1('0x10'),_0x24585a,_0xabe1('0xe'),JSON[_0xabe1('0x11')](_0xce05e3));if(_0xce05e3[_0xabe1('0x12')]){if(_0xce05e3[_0xabe1('0x12')][_0xabe1('0x13')]===0x1f4){logger[_0xabe1('0x12')](_0xabe1('0xd'),_0x24585a,_0xce05e3['error'][_0xabe1('0x14')]);return _0x31a628(_0xce05e3[_0xabe1('0x12')][_0xabe1('0x14')]);}logger['error'](_0xabe1('0xd'),_0x24585a,_0xce05e3['error']['message']);return _0x3231c4(_0xce05e3[_0xabe1('0x12')][_0xabe1('0x14')]);}else{logger[_0xabe1('0xc')](_0xabe1('0xd'),_0x24585a,_0xabe1('0xe'));_0x3231c4(_0xce05e3[_0xabe1('0x15')]['message']);}})[_0xabe1('0x16')](function(_0x201b57){logger[_0xabe1('0x12')](_0xabe1('0xd'),_0x24585a,_0x201b57);_0x31a628(_0x201b57);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0086f4e..ed930ae 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 _0x9f0e=['/:id/contacts','getContacts','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9f0e,0x8d));var _0xe9f0=function(_0x4e9372,_0x1dd466){_0x4e9372=_0x4e9372-0x0;var _0x9e6ff=_0x9f0e[_0x4e9372];return _0x9e6ff;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require('util');var path=require(_0xe9f0('0x1'));var timeout=require(_0xe9f0('0x2'));var express=require(_0xe9f0('0x3'));var router=express['Router']();var fs_extra=require(_0xe9f0('0x4'));var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xe9f0('0x7')]('/',auth[_0xe9f0('0x8')](),controller['index']);router[_0xe9f0('0x7')](_0xe9f0('0x9'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0xa')]);router[_0xe9f0('0x7')](_0xe9f0('0xb'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0xc')]);router[_0xe9f0('0x7')](_0xe9f0('0xd'),auth['isAuthenticated'](),controller[_0xe9f0('0xe')]);router[_0xe9f0('0xf')]('/',auth[_0xe9f0('0x8')](),controller[_0xe9f0('0x10')]);router['post'](_0xe9f0('0xd'),auth[_0xe9f0('0x8')](),controller['addContacts']);router[_0xe9f0('0x11')](_0xe9f0('0xb'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0x12')]);router[_0xe9f0('0x13')](_0xe9f0('0xb'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0x14')]);module[_0xe9f0('0x15')]=router; \ No newline at end of file +var _0x7af8=['/:id','show','/:id/contacts','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x58e73f,_0x2b8a34){var _0x259789=function(_0xa5386e){while(--_0xa5386e){_0x58e73f['push'](_0x58e73f['shift']());}};_0x259789(++_0x2b8a34);}(_0x7af8,0x95));var _0x87af=function(_0x1ba9bd,_0x3299e8){_0x1ba9bd=_0x1ba9bd-0x0;var _0x19aae2=_0x7af8[_0x1ba9bd];return _0x19aae2;};'use strict';var multer=require(_0x87af('0x0'));var util=require(_0x87af('0x1'));var path=require(_0x87af('0x2'));var timeout=require(_0x87af('0x3'));var express=require(_0x87af('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x87af('0x5'));var config=require(_0x87af('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x87af('0x7')](),controller[_0x87af('0x8')]);router[_0x87af('0x9')](_0x87af('0xa'),auth['isAuthenticated'](),controller[_0x87af('0xb')]);router[_0x87af('0x9')](_0x87af('0xc'),auth['isAuthenticated'](),controller[_0x87af('0xd')]);router[_0x87af('0x9')](_0x87af('0xe'),auth[_0x87af('0x7')](),controller['getContacts']);router[_0x87af('0xf')]('/',auth[_0x87af('0x7')](),controller[_0x87af('0x10')]);router[_0x87af('0xf')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x87af('0x11')]);router[_0x87af('0x12')](_0x87af('0xc'),auth[_0x87af('0x7')](),controller[_0x87af('0x13')]);router[_0x87af('0x14')](_0x87af('0xc'),auth[_0x87af('0x7')](),controller[_0x87af('0x15')]);module[_0x87af('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index a73ca1b..bf52ad3 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 _0x0e8e=['sequelize','exports','STRING','TEXT','INTEGER','NOW','lodash'];(function(_0x3c1ebf,_0x1aab00){var _0x4e2ce8=function(_0x3aa218){while(--_0x3aa218){_0x3c1ebf['push'](_0x3c1ebf['shift']());}};_0x4e2ce8(++_0x1aab00);}(_0x0e8e,0x1f0));var _0xe0e8=function(_0x5427bf,_0xb60e82){_0x5427bf=_0x5427bf-0x0;var _0x180b60=_0x0e8e[_0x5427bf];return _0x180b60;};'use strict';var _=require(_0xe0e8('0x0'));var Sequelize=require(_0xe0e8('0x1'));module[_0xe0e8('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0e8('0x3')]},'street':{'type':Sequelize[_0xe0e8('0x3')]},'postalCode':{'type':Sequelize[_0xe0e8('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xe0e8('0x3')]},'dateOfBirth':{'type':Sequelize[_0xe0e8('0x3')]},'description':{'type':Sequelize[_0xe0e8('0x4')]},'phone':{'type':Sequelize[_0xe0e8('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xe0e8('0x3')]},'email':{'type':Sequelize[_0xe0e8('0x3')]},'url':{'type':Sequelize[_0xe0e8('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xe0e8('0x3')]},'skype':{'type':Sequelize[_0xe0e8('0x3')]},'teams':{'type':Sequelize[_0xe0e8('0x3')]},'viber':{'type':Sequelize[_0xe0e8('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xe0e8('0x3')]},'telegram':{'type':Sequelize[_0xe0e8('0x3')]},'UserId':{'type':Sequelize[_0xe0e8('0x5')]},'priority':{'type':Sequelize[_0xe0e8('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xe0e8('0x6')]}}; \ No newline at end of file +var _0x55cb=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x590b57,_0x56732b){var _0x535584=function(_0x5c4b6c){while(--_0x5c4b6c){_0x590b57['push'](_0x590b57['shift']());}};_0x535584(++_0x56732b);}(_0x55cb,0x10e));var _0xb55c=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x55cb[_0x2defb5];return _0x229c53;};'use strict';var _=require(_0xb55c('0x0'));var Sequelize=require(_0xb55c('0x1'));module[_0xb55c('0x2')]={'firstName':{'type':Sequelize[_0xb55c('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb55c('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xb55c('0x3')]},'city':{'type':Sequelize[_0xb55c('0x3')]},'country':{'type':Sequelize[_0xb55c('0x3')]},'dateOfBirth':{'type':Sequelize[_0xb55c('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xb55c('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xb55c('0x3')]},'email':{'type':Sequelize[_0xb55c('0x3')]},'url':{'type':Sequelize[_0xb55c('0x3')]},'facebook':{'type':Sequelize[_0xb55c('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xb55c('0x3')]},'skype':{'type':Sequelize[_0xb55c('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xb55c('0x3')]},'line':{'type':Sequelize[_0xb55c('0x3')]},'wechat':{'type':Sequelize[_0xb55c('0x3')]},'telegram':{'type':Sequelize[_0xb55c('0x3')]},'UserId':{'type':Sequelize[_0xb55c('0x4')]},'priority':{'type':Sequelize[_0xb55c('0x4')](0x2)[_0xb55c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb55c('0x6')],'defaultValue':Sequelize[_0xb55c('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 211d4bf..753fed8 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 _0xf77d=['No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','binding_values','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','whatsapp','voice','-createdAt','channel','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','note','createdAt','userSecondDisposition','userThirdDisposition','fullname','VoiceCallReport','startCase','Website','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Owner','browserName','osName','ratingMessage','ratingType','ratingValue','subject','externalUrl','threadId','Interaction','findAndCountAll','sortBy','slice','moment','bluebird','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','end','sendStatus','error','name','send','index','CmContact','describe','length','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','intersection','fields','attributes','order','sort','filters','pick','select','field','color','from','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','where','expr','search','parseSearch','conditions','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','hasOwnProperty','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','getLists','c.ListId\x20IS\x20NULL','user','agent','sequelize','toString','keyBy','merge','c.lastName','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','find','params','columnName','displayName','analytics','findAll','alias','custom','values','body','get','mergeWith','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','update','MailMessage','SmsInteraction','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','$and','format','cf_%d','omit','table','setFields','toParam','phone','rawAttributes','options','getTags','nolimit','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject'];(function(_0x8c7987,_0x3d6936){var _0x582752=function(_0x249d8d){while(--_0x249d8d){_0x8c7987['push'](_0x8c7987['shift']());}};_0x582752(++_0x3d6936);}(_0xf77d,0x15c));var _0xdf77=function(_0x202aa2,_0x584b66){_0x202aa2=_0x202aa2-0x0;var _0x4e8000=_0xf77d[_0x202aa2];return _0x4e8000;};'use strict';var moment=require(_0xdf77('0x0'));var BPromise=require(_0xdf77('0x1'));var util=require(_0xdf77('0x2'));var path=require(_0xdf77('0x3'));var fs=require('fs');var _=require(_0xdf77('0x4'));var squel=require(_0xdf77('0x5'));var Papa=require('papaparse');var Redis=require(_0xdf77('0x6'));var qs=require(_0xdf77('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xdf77('0x8'))(_0xdf77('0x9'));var config=require('../../config/environment');var db=require(_0xdf77('0xa'))['db'];config[_0xdf77('0xb')]=_['defaults'](config[_0xdf77('0xb')],{'host':_0xdf77('0xc'),'port':0x18eb});var socket=require(_0xdf77('0xd'))(new Redis(config[_0xdf77('0xb')]));require('./cmContact.socket')[_0xdf77('0xe')](socket);function respondWithResult(_0x263a0e,_0x483698){_0x483698=_0x483698||0xc8;return function(_0x17b1ac){if(_0x17b1ac){return _0x263a0e[_0xdf77('0xf')](_0x483698)[_0xdf77('0x10')](_0x17b1ac);}};}function respondWithFilteredResult(_0x45b0b4,_0x3c2382){return function(_0x498476){if(_0x498476){var _0x585170=typeof _0x3c2382['offset']===_0xdf77('0x11')&&typeof _0x3c2382[_0xdf77('0x12')]==='undefined';var _0x32a439=_0x498476[_0xdf77('0x13')];var _0x2a8e1a=_0x585170?0x0:_0x3c2382[_0xdf77('0x14')];var _0x5d21af=_0x585170?_0x498476[_0xdf77('0x13')]:_0x3c2382[_0xdf77('0x14')]+_0x3c2382['limit'];var _0x5e3d3f;if(_0x5d21af>=_0x32a439){_0x5d21af=_0x32a439;_0x5e3d3f=0xc8;}else{_0x5e3d3f=0xce;}_0x45b0b4[_0xdf77('0xf')](_0x5e3d3f);return _0x45b0b4[_0xdf77('0x15')](_0xdf77('0x16'),_0x2a8e1a+'-'+_0x5d21af+'/'+_0x32a439)[_0xdf77('0x10')](_0x498476);}return null;};}function saveUpdates(_0x30c293){return function(_0x4661d0){if(_0x4661d0){return _0x4661d0['update'](_0x30c293)[_0xdf77('0x17')](function(_0x300775){return _0x300775;});}return null;};}function removeEntity(_0xf8b69f){return function(_0x11838d){if(_0x11838d){return _0x11838d[_0xdf77('0x18')]()[_0xdf77('0x17')](function(){_0xf8b69f[_0xdf77('0xf')](0xcc)[_0xdf77('0x19')]();});}};}function handleEntityNotFound(_0x25cc7d){return function(_0x336fa5){if(!_0x336fa5){_0x25cc7d[_0xdf77('0x1a')](0x194);}return _0x336fa5;};}function handleError(_0x26a626,_0x5d0e56){_0x5d0e56=_0x5d0e56||0x1f4;return function(_0x55a907){logger[_0xdf77('0x1b')](_0x55a907['stack']);if(_0x55a907[_0xdf77('0x1c')]){delete _0x55a907[_0xdf77('0x1c')];}_0x26a626[_0xdf77('0xf')](_0x5d0e56)[_0xdf77('0x1d')](_0x55a907);};}exports[_0xdf77('0x1e')]=function(_0x47d485,_0x4b5f2c){var _0x5901d0={},_0x3fb476={},_0x2ec8d1={'count':0x0,'rows':[]};return db[_0xdf77('0x1f')][_0xdf77('0x20')]()[_0xdf77('0x17')](function(_0x5afcdc){var _0x5374cd=[];for(var _0x27f911=0x0;_0x27f9110x1){_0x1fad3f['or'](_0xdf77('0x5f'),qs[_0xdf77('0x60')](_0x48cb8b),null);}else{if(qs['isNumeric'](_0x48cb8b)){_0x1fad3f['or'](_0xdf77('0x61'),_0x48cb8b+'%');_0x1fad3f['or'](_0xdf77('0x62'),_0x48cb8b+'%');_0x1fad3f['or'](_0xdf77('0x63'),_0x48cb8b+'%');_0x1fad3f['or']('c.fax\x20LIKE\x20?',_0x48cb8b+'%');}else if(qs[_0xdf77('0x64')](_0x48cb8b)){_0x1fad3f['or']('c.email\x20LIKE\x20?',_0x48cb8b+'%');}else{_0x1fad3f['or'](_0xdf77('0x65'),'%'+_0x48cb8b+'%');_0x1fad3f['or']('c.lastName\x20LIKE\x20?','%'+_0x48cb8b+'%');_0x1fad3f['or'](_0xdf77('0x66'),'%'+_0x48cb8b+'%');}}}}_0x516b75[_0xdf77('0x40')](_0x1fad3f);_0x516b75['group'](_0xdf77('0x67'));var _0x2bed88={'type':db[_0xdf77('0x68')][_0xdf77('0x69')][_0xdf77('0x6a')],'raw':!![]};var _0x4cc2c3=_0x516b75['clone']()['field']('c.id');if(_0x5901d0[_0xdf77('0x31')]){_0x5901d0[_0xdf77('0x31')][_0xdf77('0x49')](function(_0x2120fa){_0x516b75['order']('c.'+_0x2120fa[0x0],_0x2120fa[0x1]===_0xdf77('0x6b')?![]:!![]);});}if(!_[_0xdf77('0x6c')](_0x3c2027)){_0x516b75[_0xdf77('0x6d')](_0x43db32);_0x4cc2c3[_0xdf77('0x40')](_0xdf77('0x6e'),_0x3c2027);}BPromise[_0xdf77('0x6f')]()['then'](function(){if(!_0x3283ca)return;if(_0x47d485['user']['role']!=='agent')return;if(!_['some'](_0x3283ca[_0xdf77('0x44')],[_0xdf77('0x36'),_0xdf77('0x4c')])){return _0x47d485['user'][_0xdf77('0x70')]({'attributes':['id'],'raw':!![]})['then'](function(_0x258801){if(_[_0xdf77('0x6c')](_0x258801)){_0x4cc2c3[_0xdf77('0x40')](_0xdf77('0x71'));_0x516b75[_0xdf77('0x40')](_0xdf77('0x71'));}else{_0x4cc2c3[_0xdf77('0x40')](_0xdf77('0x59'),_[_0xdf77('0x48')](_0x258801,'id'));_0x516b75[_0xdf77('0x40')](_0xdf77('0x59'),_['map'](_0x258801,'id'));}});}})[_0xdf77('0x17')](function(){if(_0x47d485[_0xdf77('0x72')]['role']===_0xdf77('0x73')&&!_0x3283ca&&!_0x47d485[_0xdf77('0x2d')][_0xdf77('0x58')])return[];return db[_0xdf77('0x74')][_0xdf77('0x2d')](_0x4cc2c3[_0xdf77('0x75')](),_0x2bed88);})[_0xdf77('0x17')](function(_0x2827bb){_0x2ec8d1[_0xdf77('0x13')]=_0x2827bb['length'];if(_0x2ec8d1[_0xdf77('0x13')]===0x0)return[];return db[_0xdf77('0x74')][_0xdf77('0x2d')](_0x56b785[_0xdf77('0x75')](),_0x2bed88)[_0xdf77('0x17')](function(_0x5afd1d){_0x5021f9=_[_0xdf77('0x76')](_0x5afd1d,'id');_0x2bed88=_[_0xdf77('0x77')](_0x2bed88,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x47d485['query'][_0xdf77('0x2f')]){_0x5901d0[_0xdf77('0x30')]['forEach'](function(_0x202f78){_0x516b75[_0xdf77('0x36')]('c.'+_0x202f78);});}else{_0x516b75[_0xdf77('0x36')](_0xdf77('0x67'));_0x516b75[_0xdf77('0x36')]('c.firstName');_0x516b75['field'](_0xdf77('0x78'));_0x516b75['field']('c.phone');_0x516b75[_0xdf77('0x36')](_0xdf77('0x79'));_0x516b75[_0xdf77('0x36')](_0xdf77('0x7a'));_0x516b75[_0xdf77('0x36')](_0xdf77('0x7b'));_0x516b75[_0xdf77('0x36')]('c.ListId');_0x516b75[_0xdf77('0x36')](_0xdf77('0x7c'));_0x516b75[_0xdf77('0x36')](_0xdf77('0x7d'));_0x516b75[_0xdf77('0x36')](_0xdf77('0x7e'));_0x516b75[_0xdf77('0x36')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xdf77('0x7f'));}if(_0x5901d0[_0xdf77('0x12')])_0x516b75[_0xdf77('0x12')](_0x5901d0[_0xdf77('0x12')]);if(_0x5901d0['offset'])_0x516b75[_0xdf77('0x14')](_0x5901d0[_0xdf77('0x14')]);return db['sequelize'][_0xdf77('0x2d')](_0x516b75[_0xdf77('0x75')](),_0x2bed88);});})[_0xdf77('0x17')](function(_0x414781){_0x414781['forEach'](function(_0x535c60){if(_0x535c60[_0xdf77('0x7f')]){_0x535c60[_0xdf77('0x80')]=[];_0x535c60[_0xdf77('0x7f')][_0xdf77('0x47')](',')[_0xdf77('0x49')](function(_0x14e36e){_0x535c60['Tags'][_0xdf77('0x25')](_0x5021f9[_0x14e36e]);});}delete _0x535c60[_0xdf77('0x7f')];});_0x2ec8d1[_0xdf77('0x81')]=_0x414781;return _0x2ec8d1;})[_0xdf77('0x17')](respondWithFilteredResult(_0x4b5f2c,_0x5901d0));})[_0xdf77('0x82')](handleError(_0x4b5f2c,null));};exports[_0xdf77('0x18')]=function(_0x6af70a,_0x1db8db){return db[_0xdf77('0x1f')][_0xdf77('0x83')]({'where':{'id':_0x6af70a[_0xdf77('0x84')]['id']}})['then'](handleEntityNotFound(_0x1db8db,null))[_0xdf77('0x17')](removeEntity(_0x1db8db,null))[_0xdf77('0x82')](handleError(_0x1db8db,null));};exports[_0xdf77('0x20')]=function(_0x1d75b1,_0x577897){return db[_0xdf77('0x1f')][_0xdf77('0x20')]()[_0xdf77('0x17')](function(_0x536c47){delete _0x536c47['tags'];for(var _0x10fdbb=0x0;_0x10fdbb=_0xa65050){_0x1f4a6c=_0xa65050;_0x35b388=0xc8;}else{_0x35b388=0xce;}_0x501505['status'](_0x35b388);return _0x501505[_0x260f('0x15')](_0x260f('0x16'),_0x1d5a5b+'-'+_0x1f4a6c+'/'+_0xa65050)[_0x260f('0x11')](_0x1ae3f3);}return null;};}function saveUpdates(_0x1cac50){return function(_0x56ec95){if(_0x56ec95){return _0x56ec95[_0x260f('0x17')](_0x1cac50)[_0x260f('0x18')](function(_0x527b32){return _0x527b32;});}return null;};}function removeEntity(_0x50995f){return function(_0x555e6f){if(_0x555e6f){return _0x555e6f['destroy']()[_0x260f('0x18')](function(){_0x50995f['status'](0xcc)[_0x260f('0x19')]();});}};}function handleEntityNotFound(_0xb7b63e){return function(_0x32c4eb){if(!_0x32c4eb){_0xb7b63e[_0x260f('0x1a')](0x194);}return _0x32c4eb;};}function handleError(_0xebbedc,_0x2e9432){_0x2e9432=_0x2e9432||0x1f4;return function(_0x47cfb6){logger[_0x260f('0x1b')](_0x47cfb6['stack']);if(_0x47cfb6[_0x260f('0x1c')]){delete _0x47cfb6[_0x260f('0x1c')];}_0xebbedc[_0x260f('0x10')](_0x2e9432)[_0x260f('0x1d')](_0x47cfb6);};}exports['index']=function(_0xa4e150,_0x27dc11){var _0x3b23e2={},_0x27af42={},_0x23bb8e={'count':0x0,'rows':[]};return db[_0x260f('0x1e')][_0x260f('0x1f')]()['then'](function(_0x2022bc){var _0x26602a=[];for(var _0x4c4026=0x0;_0x4c40260x1){_0xe3ba20['or'](_0x260f('0x60'),qs['getFullTextValue'](_0x413de7),null);}else{if(qs[_0x260f('0x61')](_0x413de7)){_0xe3ba20['or'](_0x260f('0x62'),_0x413de7+'%');_0xe3ba20['or']('c.phone\x20LIKE\x20?',_0x413de7+'%');_0xe3ba20['or'](_0x260f('0x63'),_0x413de7+'%');_0xe3ba20['or']('c.fax\x20LIKE\x20?',_0x413de7+'%');}else if(qs[_0x260f('0x64')](_0x413de7)){_0xe3ba20['or']('c.email\x20LIKE\x20?',_0x413de7+'%');}else{_0xe3ba20['or'](_0x260f('0x65'),'%'+_0x413de7+'%');_0xe3ba20['or'](_0x260f('0x66'),'%'+_0x413de7+'%');_0xe3ba20['or'](_0x260f('0x67'),'%'+_0x413de7+'%');}}}}_0x9cd25[_0x260f('0x31')](_0xe3ba20);_0x9cd25[_0x260f('0x68')]('c.id');var _0x4bfa6b={'type':db[_0x260f('0x69')]['QueryTypes']['SELECT'],'raw':!![]};var _0x18d476=_0x9cd25[_0x260f('0x6a')]()['field'](_0x260f('0x6b'));if(_0x3b23e2[_0x260f('0x2f')]){_0x3b23e2[_0x260f('0x2f')]['forEach'](function(_0x467fce){_0x9cd25[_0x260f('0x2f')]('c.'+_0x467fce[0x0],_0x467fce[0x1]===_0x260f('0x6c')?![]:!![]);});}if(!_['isEmpty'](_0x482257)){_0x9cd25['having'](_0x5cfde3);_0x18d476['where']('t.id\x20IN\x20?',_0x482257);}BPromise[_0x260f('0x6d')]()[_0x260f('0x18')](function(){if(!_0x4ffa5d)return;if(_0xa4e150[_0x260f('0x6e')]['role']!==_0x260f('0x6f'))return;if(!_[_0x260f('0x70')](_0x4ffa5d['conditions'],[_0x260f('0x35'),'User'])){return _0xa4e150[_0x260f('0x6e')]['getLists']({'attributes':['id'],'raw':!![]})[_0x260f('0x18')](function(_0x3a87a4){if(_[_0x260f('0x71')](_0x3a87a4)){_0x18d476[_0x260f('0x31')]('c.ListId\x20IS\x20NULL');_0x9cd25[_0x260f('0x31')](_0x260f('0x72'));}else{_0x18d476[_0x260f('0x31')]('c.ListId\x20IN\x20?',_['map'](_0x3a87a4,'id'));_0x9cd25['where'](_0x260f('0x59'),_[_0x260f('0x55')](_0x3a87a4,'id'));}});}})[_0x260f('0x18')](function(){if(_0xa4e150[_0x260f('0x6e')]['role']===_0x260f('0x6f')&&!_0x4ffa5d&&!_0xa4e150['query']['ListId'])return[];return db['sequelize'][_0x260f('0x29')](_0x18d476[_0x260f('0x73')](),_0x4bfa6b);})['then'](function(_0x5d0804){_0x23bb8e[_0x260f('0x74')]=_0x5d0804[_0x260f('0x21')];if(_0x23bb8e[_0x260f('0x74')]===0x0)return[];return db['sequelize'][_0x260f('0x29')](_0x2383b0['toString'](),_0x4bfa6b)[_0x260f('0x18')](function(_0x3bfa2a){_0x579431=_[_0x260f('0x75')](_0x3bfa2a,'id');_0x4bfa6b=_[_0x260f('0x76')](_0x4bfa6b,{'model':db[_0x260f('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa4e150[_0x260f('0x29')]['fields']){_0x3b23e2[_0x260f('0x2c')][_0x260f('0x49')](function(_0x2ddad0){_0x9cd25[_0x260f('0x35')]('c.'+_0x2ddad0);});}else{_0x9cd25[_0x260f('0x35')](_0x260f('0x6b'));_0x9cd25[_0x260f('0x35')](_0x260f('0x77'));_0x9cd25[_0x260f('0x35')](_0x260f('0x78'));_0x9cd25[_0x260f('0x35')](_0x260f('0x79'));_0x9cd25['field'](_0x260f('0x7a'));_0x9cd25['field'](_0x260f('0x7b'));_0x9cd25[_0x260f('0x35')]('c.email');_0x9cd25[_0x260f('0x35')](_0x260f('0x7c'));_0x9cd25['field']('c.createdAt');_0x9cd25['field']('c.deletedAt');_0x9cd25[_0x260f('0x35')](_0x260f('0x7d'));_0x9cd25[_0x260f('0x35')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x260f('0x7e'));}if(_0x3b23e2[_0x260f('0x13')])_0x9cd25[_0x260f('0x13')](_0x3b23e2[_0x260f('0x13')]);if(_0x3b23e2['offset'])_0x9cd25[_0x260f('0x12')](_0x3b23e2['offset']);return db['sequelize'][_0x260f('0x29')](_0x9cd25[_0x260f('0x73')](),_0x4bfa6b);});})['then'](function(_0x84be1a){_0x84be1a[_0x260f('0x49')](function(_0x5499e2){if(_0x5499e2[_0x260f('0x7e')]){_0x5499e2[_0x260f('0x7f')]=[];_0x5499e2['TagIds'][_0x260f('0x48')](',')['forEach'](function(_0x22f99c){_0x5499e2[_0x260f('0x7f')][_0x260f('0x58')](_0x579431[_0x22f99c]);});}delete _0x5499e2[_0x260f('0x7e')];});_0x23bb8e[_0x260f('0x80')]=_0x84be1a;return _0x23bb8e;})[_0x260f('0x18')](respondWithFilteredResult(_0x27dc11,_0x3b23e2));})[_0x260f('0x81')](handleError(_0x27dc11,null));};exports['destroy']=function(_0x18563e,_0x1b6150){return db[_0x260f('0x1e')]['find']({'where':{'id':_0x18563e['params']['id']}})['then'](handleEntityNotFound(_0x1b6150,null))['then'](removeEntity(_0x1b6150,null))[_0x260f('0x81')](handleError(_0x1b6150,null));};exports['describe']=function(_0x337b89,_0x392395){return db[_0x260f('0x1e')][_0x260f('0x1f')]()[_0x260f('0x18')](function(_0x27d2f7){delete _0x27d2f7[_0x260f('0x82')];for(var _0x3f0479=0x0;_0x3f0479{}\s\\|]/g,'-');_0x4268ad(null,util[_0x3322('0x1d')](_0x3322('0x1e'),path[_0x3322('0x1f')](_0x3a8d04[_0x3322('0x1b')],path['extname'](_0x3a8d04[_0x3322('0x1b')])),Date['now'](),path['extname'](_0x3a8d04[_0x3322('0x1b')])));}})});router['post'](_0x3322('0x20'),upload[_0x3322('0x21')](_0x3322('0x22')),controller[_0x3322('0x23')]);var upload=multer({'storage':multer[_0x3322('0x17')]({'destination':function(_0x393bb2,_0x144cee,_0x36226f){_0x36226f(null,path[_0x3322('0x18')](config['root'],_0x3322('0x1a')));},'filename':function(_0x5447c5,_0x228063,_0x296024){_0x228063[_0x3322('0x1b')]=_0x228063[_0x3322('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x296024(null,util[_0x3322('0x1d')](_0x3322('0x1e'),path[_0x3322('0x1f')](_0x228063[_0x3322('0x1b')],path[_0x3322('0x24')](_0x228063[_0x3322('0x1b')])),Date['now'](),path[_0x3322('0x24')](_0x228063['originalname'])));}})});router[_0x3322('0x10')](_0x3322('0x25'),upload[_0x3322('0x21')]('file'),controller[_0x3322('0x26')]);router[_0x3322('0x10')](_0x3322('0x27'),auth['isAuthenticated'](),controller[_0x3322('0x28')]);router[_0x3322('0x29')](_0x3322('0x2a'),auth[_0x3322('0x7')](),controller[_0x3322('0x2b')]);router[_0x3322('0x2c')](_0x3322('0x2a'),auth[_0x3322('0x7')](),controller[_0x3322('0x2d')]);module['exports']=router; \ No newline at end of file +var _0x846c=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContact.controller','get','isAuthenticated','describe','/:id','show','/:id/tags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','originalname','replace','%s-%s%s','basename','extname','now','/csv','single','file','server/files/tmp','format','/upload','put','update'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x846c,0xfd));var _0xc846=function(_0x493caf,_0x58f93f){_0x493caf=_0x493caf-0x0;var _0x353eda=_0x846c[_0x493caf];return _0x353eda;};'use strict';var multer=require(_0xc846('0x0'));var util=require(_0xc846('0x1'));var path=require(_0xc846('0x2'));var timeout=require(_0xc846('0x3'));var express=require(_0xc846('0x4'));var router=express['Router']();var fs_extra=require(_0xc846('0x5'));var auth=require(_0xc846('0x6'));var interaction=require(_0xc846('0x7'));var config=require('../../config/environment');var controller=require(_0xc846('0x8'));router[_0xc846('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xc846('0xa')](),controller[_0xc846('0xb')]);router[_0xc846('0x9')](_0xc846('0xc'),auth['isAuthenticated'](),controller[_0xc846('0xd')]);router[_0xc846('0x9')](_0xc846('0xe'),auth[_0xc846('0xa')](),controller['getTags']);router[_0xc846('0x9')](_0xc846('0xf'),auth[_0xc846('0xa')](),controller[_0xc846('0x10')]);router['get']('/:id/hopper_histories',auth[_0xc846('0xa')](),controller[_0xc846('0x11')]);router['get'](_0xc846('0x12'),auth[_0xc846('0xa')](),controller[_0xc846('0x13')]);router['get'](_0xc846('0x14'),auth['isAuthenticated'](),controller[_0xc846('0x15')]);router[_0xc846('0x9')]('/:id/journey',auth[_0xc846('0xa')](),controller[_0xc846('0x16')]);router[_0xc846('0x17')](_0xc846('0x18'),auth[_0xc846('0xa')](),controller[_0xc846('0x19')]);router[_0xc846('0x17')]('/',auth[_0xc846('0xa')](),controller[_0xc846('0x1a')]);router[_0xc846('0x17')](_0xc846('0x1b'),auth[_0xc846('0xa')](),controller[_0xc846('0x1c')]);router[_0xc846('0x17')](_0xc846('0xe'),auth['isAuthenticated'](),controller[_0xc846('0x1d')]);var upload=multer({'storage':multer[_0xc846('0x1e')]({'destination':function(_0x3c2dc8,_0x540248,_0x54581b){_0x54581b(null,path[_0xc846('0x1f')](config[_0xc846('0x20')],'server/files/tmp'));},'filename':function(_0x5d0e0a,_0x2af9cd,_0x41ff8e){_0x2af9cd[_0xc846('0x21')]=_0x2af9cd[_0xc846('0x21')][_0xc846('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41ff8e(null,util['format'](_0xc846('0x23'),path[_0xc846('0x24')](_0x2af9cd[_0xc846('0x21')],path[_0xc846('0x25')](_0x2af9cd[_0xc846('0x21')])),Date[_0xc846('0x26')](),path['extname'](_0x2af9cd['originalname'])));}})});router[_0xc846('0x17')](_0xc846('0x27'),upload[_0xc846('0x28')](_0xc846('0x29')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x11bab3,_0x2a3852,_0x39e194){_0x39e194(null,path[_0xc846('0x1f')](config[_0xc846('0x20')],_0xc846('0x2a')));},'filename':function(_0x52f40a,_0x61588,_0x6d93aa){_0x61588['originalname']=_0x61588[_0xc846('0x21')][_0xc846('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x6d93aa(null,util[_0xc846('0x2b')](_0xc846('0x23'),path['basename'](_0x61588[_0xc846('0x21')],path[_0xc846('0x25')](_0x61588['originalname'])),Date[_0xc846('0x26')](),path[_0xc846('0x25')](_0x61588[_0xc846('0x21')])));}})});router[_0xc846('0x17')](_0xc846('0x2c'),upload[_0xc846('0x28')](_0xc846('0x29')),controller['upload']);router[_0xc846('0x17')]('/upload/:id',auth[_0xc846('0xa')](),controller['import']);router[_0xc846('0x2d')](_0xc846('0xc'),auth['isAuthenticated'](),controller[_0xc846('0x2e')]);router[_0xc846('0x2f')](_0xc846('0xc'),auth['isAuthenticated'](),controller[_0xc846('0x30')]);module[_0xc846('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3763abd..2e3445e 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 _0x538f=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify'];(function(_0x1f3eea,_0x411441){var _0x2f7246=function(_0x393543){while(--_0x393543){_0x1f3eea['push'](_0x1f3eea['shift']());}};_0x2f7246(++_0x411441);}(_0x538f,0x192));var _0xf538=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x538f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf538('0x0'));var _=require(_0xf538('0x1'));module[_0xf538('0x2')]={'name':{'type':Sequelize[_0xf538('0x3')],'get':function(_0x405f41){return this[_0xf538('0x4')]('alias');}},'alias':{'type':Sequelize[_0xf538('0x5')],'allowNull':![],'set':function(_0xaf30da){this[_0xf538('0x6')]('alias',_0xaf30da?_0xaf30da:this[_0xf538('0x4')](_0xf538('0x7')));}},'type':{'type':Sequelize[_0xf538('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf538('0x8')](_0xf538('0x9')),'get':function(){if(this[_0xf538('0x4')](_0xf538('0xa'))===_0xf538('0xb')){return JSON[_0xf538('0xc')](this['getDataValue'](_0xf538('0xd')));}else{return this[_0xf538('0x4')]('values');}},'set':function(_0x5e531f){if(Array[_0xf538('0xe')](_0x5e531f)){this[_0xf538('0x6')](_0xf538('0xd'),JSON[_0xf538('0xf')](_0x5e531f));}else{this[_0xf538('0x6')](_0xf538('0xd'),_0x5e531f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf538('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf538('0x11')](_0xf538('0x12'))}}; \ No newline at end of file +var _0x24c2=['ENUM','voice','sequelize','lodash','exports','VIRTUAL','STRING','setDataValue','alias','name','TEXT','long','getDataValue','type','select','values','isArray','stringify','BOOLEAN'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0x24c2,0x132));var _0x224c=function(_0x3e9e86,_0x2b53b6){_0x3e9e86=_0x3e9e86-0x0;var _0x520cda=_0x24c2[_0x3e9e86];return _0x520cda;};'use strict';var Sequelize=require(_0x224c('0x0'));var _=require(_0x224c('0x1'));module[_0x224c('0x2')]={'name':{'type':Sequelize[_0x224c('0x3')],'get':function(_0x43cd82){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x224c('0x4')],'allowNull':![],'set':function(_0x392889){this[_0x224c('0x5')](_0x224c('0x6'),_0x392889?_0x392889:this['getDataValue'](_0x224c('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x224c('0x8')](_0x224c('0x9')),'get':function(){if(this[_0x224c('0xa')](_0x224c('0xb'))===_0x224c('0xc')){return JSON['parse'](this[_0x224c('0xa')](_0x224c('0xd')));}else{return this['getDataValue']('values');}},'set':function(_0x19b59a){if(Array[_0x224c('0xe')](_0x19b59a)){this[_0x224c('0x5')]('values',JSON[_0x224c('0xf')](_0x19b59a));}else{this[_0x224c('0x5')]('values',_0x19b59a);}}},'required':{'type':Sequelize[_0x224c('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x224c('0x11')](_0x224c('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index b299016..6cdbe4f 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 _0x5107=['set','Content-Range','json','apply','update','stack','send','index','map','rawAttributes','fieldName','type','model','differenceBy','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','CmCustomField','then','catch','show','params','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x3cb52d,_0x5c618d){var _0x371f51=function(_0x4ffa60){while(--_0x4ffa60){_0x3cb52d['push'](_0x3cb52d['shift']());}};_0x371f51(++_0x5c618d);}(_0x5107,0x91));var _0x7510=function(_0x127b9a,_0x12906f){_0x127b9a=_0x127b9a-0x0;var _0x1d3bf8=_0x5107[_0x127b9a];return _0x1d3bf8;};'use strict';var emlformat=require(_0x7510('0x0'));var rimraf=require(_0x7510('0x1'));var zipdir=require(_0x7510('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7510('0x3'));var moment=require(_0x7510('0x4'));var BPromise=require(_0x7510('0x5'));var Mustache=require(_0x7510('0x6'));var util=require(_0x7510('0x7'));var path=require(_0x7510('0x8'));var sox=require(_0x7510('0x9'));var csv=require(_0x7510('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7510('0xb'));var _=require('lodash');var squel=require(_0x7510('0xc'));var crypto=require(_0x7510('0xd'));var jsforce=require(_0x7510('0xe'));var deskjs=require(_0x7510('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7510('0x10'));var Papa=require(_0x7510('0x11'));var Redis=require(_0x7510('0x12'));var authService=require(_0x7510('0x13'));var qs=require(_0x7510('0x14'));var as=require(_0x7510('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7510('0x16'))(_0x7510('0x17'));var utils=require(_0x7510('0x18'));var config=require(_0x7510('0x19'));var licenseUtil=require(_0x7510('0x1a'));var db=require(_0x7510('0x1b'))['db'];function respondWithStatusCode(_0xdd3639,_0x5ea3de){_0x5ea3de=_0x5ea3de||0xcc;return function(_0x390634){if(_0x390634){return _0xdd3639[_0x7510('0x1c')](_0x5ea3de);}return _0xdd3639[_0x7510('0x1d')](_0x5ea3de)[_0x7510('0x1e')]();};}function respondWithResult(_0x345b09,_0x33dce3){_0x33dce3=_0x33dce3||0xc8;return function(_0x3e1771){if(_0x3e1771){return _0x345b09[_0x7510('0x1d')](_0x33dce3)['json'](_0x3e1771);}};}function respondWithFilteredResult(_0x28006d,_0x310531){return function(_0x2a1bd8){if(_0x2a1bd8){var _0x51444d=typeof _0x310531[_0x7510('0x1f')]===_0x7510('0x20')&&typeof _0x310531[_0x7510('0x21')]===_0x7510('0x20');var _0x11debf=_0x2a1bd8['count'];var _0x1cb2a2=_0x51444d?0x0:_0x310531['offset'];var _0xacdb89=_0x51444d?_0x2a1bd8[_0x7510('0x22')]:_0x310531[_0x7510('0x1f')]+_0x310531[_0x7510('0x21')];var _0x51633f;if(_0xacdb89>=_0x11debf){_0xacdb89=_0x11debf;_0x51633f=0xc8;}else{_0x51633f=0xce;}_0x28006d['status'](_0x51633f);return _0x28006d[_0x7510('0x23')](_0x7510('0x24'),_0x1cb2a2+'-'+_0xacdb89+'/'+_0x11debf)[_0x7510('0x25')](_0x2a1bd8);}return null;};}function patchUpdates(_0x5c5100){return function(_0x3bd4b4){try{jsonpatch[_0x7510('0x26')](_0x3bd4b4,_0x5c5100,!![]);}catch(_0x540c08){return BPromise['reject'](_0x540c08);}return _0x3bd4b4['save']();};}function saveUpdates(_0x136fe0,_0x5902b9){return function(_0xb2eb7a){if(_0xb2eb7a){return _0xb2eb7a[_0x7510('0x27')](_0x136fe0)['then'](function(_0x41f78a){return _0x41f78a;});}return null;};}function removeEntity(_0x36268a,_0x9c551a){return function(_0x3b1501){if(_0x3b1501){return _0x3b1501['destroy']()['then'](function(){_0x36268a[_0x7510('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x310027,_0x4bf7bb){return function(_0x128464){if(!_0x128464){_0x310027['sendStatus'](0x194);}return _0x128464;};}function handleError(_0x3e516f,_0x64b8ab){_0x64b8ab=_0x64b8ab||0x1f4;return function(_0x470a93){logger['error'](_0x470a93[_0x7510('0x28')]);if(_0x470a93['name']){delete _0x470a93['name'];}_0x3e516f[_0x7510('0x1d')](_0x64b8ab)[_0x7510('0x29')](_0x470a93);};}exports[_0x7510('0x2a')]=function(_0x209db2,_0x4c4655){var _0x2fbf7b={},_0x471f9d={},_0x55d0f1={'count':0x0,'rows':[]};var _0x3bf504=_[_0x7510('0x2b')](db['CmCustomField'][_0x7510('0x2c')],function(_0x4298e6){return{'name':_0x4298e6[_0x7510('0x2d')],'type':_0x4298e6[_0x7510('0x2e')]['key']};});_0x471f9d[_0x7510('0x2f')]=_[_0x7510('0x30')](_[_0x7510('0x2b')](_0x3bf504,_0x7510('0x31')),[_0x7510('0x31')]);_0x471f9d['query']=_[_0x7510('0x32')](_0x209db2[_0x7510('0x33')]);_0x471f9d[_0x7510('0x34')]=_[_0x7510('0x35')](_0x471f9d[_0x7510('0x2f')],_0x471f9d[_0x7510('0x33')]);_0x2fbf7b[_0x7510('0x36')]=_[_0x7510('0x35')](_0x471f9d[_0x7510('0x2f')],qs[_0x7510('0x37')](_0x209db2['query'][_0x7510('0x37')]));_0x2fbf7b[_0x7510('0x36')]=_0x2fbf7b[_0x7510('0x36')][_0x7510('0x38')]?_0x2fbf7b['attributes']:_0x471f9d[_0x7510('0x2f')];if(!_0x209db2['query'][_0x7510('0x39')](_0x7510('0x3a'))){_0x2fbf7b[_0x7510('0x21')]=qs[_0x7510('0x21')](_0x209db2['query'][_0x7510('0x21')]);_0x2fbf7b[_0x7510('0x1f')]=qs[_0x7510('0x1f')](_0x209db2['query'][_0x7510('0x1f')]);}_0x2fbf7b[_0x7510('0x3b')]=qs[_0x7510('0x3c')](_0x209db2['query'][_0x7510('0x3c')]);_0x2fbf7b['where']=qs[_0x7510('0x34')](_['pick'](_0x209db2[_0x7510('0x33')],_0x471f9d[_0x7510('0x34')]),_0x3bf504);if(_0x209db2[_0x7510('0x33')]['filter']){_0x2fbf7b[_0x7510('0x3d')]=_[_0x7510('0x3e')](_0x2fbf7b['where'],{'$or':_[_0x7510('0x2b')](_0x3bf504,function(_0x4f77c2){if(_0x4f77c2[_0x7510('0x2e')]!==_0x7510('0x3f')){var _0x3cae11={};_0x3cae11[_0x4f77c2[_0x7510('0x31')]]={'$like':'%'+_0x209db2['query'][_0x7510('0x40')]+'%'};return _0x3cae11;}})});}_0x2fbf7b=_['merge']({},_0x2fbf7b,_0x209db2[_0x7510('0x41')]);var _0x30a916={'where':_0x2fbf7b['where']};return db['CmCustomField'][_0x7510('0x22')](_0x30a916)['then'](function(_0x3462ed){_0x55d0f1[_0x7510('0x22')]=_0x3462ed;if(_0x209db2['query'][_0x7510('0x42')]){_0x2fbf7b[_0x7510('0x43')]=[{'all':!![]}];}return db[_0x7510('0x44')]['findAll'](_0x2fbf7b);})['then'](function(_0x4d52e2){_0x55d0f1['rows']=_0x4d52e2;return _0x55d0f1;})[_0x7510('0x45')](respondWithFilteredResult(_0x4c4655,_0x2fbf7b))[_0x7510('0x46')](handleError(_0x4c4655,null));};exports[_0x7510('0x47')]=function(_0x920e6a,_0x463a58){var _0x392ae8={'raw':!![],'where':{'id':_0x920e6a[_0x7510('0x48')]['id']}},_0x14f8ee={};_0x14f8ee[_0x7510('0x2f')]=_[_0x7510('0x32')](db[_0x7510('0x44')][_0x7510('0x2c')]);_0x14f8ee[_0x7510('0x33')]=_[_0x7510('0x32')](_0x920e6a['query']);_0x14f8ee[_0x7510('0x34')]=_['intersection'](_0x14f8ee[_0x7510('0x2f')],_0x14f8ee[_0x7510('0x33')]);_0x392ae8[_0x7510('0x36')]=_[_0x7510('0x35')](_0x14f8ee[_0x7510('0x2f')],qs[_0x7510('0x37')](_0x920e6a[_0x7510('0x33')][_0x7510('0x37')]));_0x392ae8[_0x7510('0x36')]=_0x392ae8[_0x7510('0x36')][_0x7510('0x38')]?_0x392ae8[_0x7510('0x36')]:_0x14f8ee[_0x7510('0x2f')];if(_0x920e6a[_0x7510('0x33')][_0x7510('0x42')]){_0x392ae8[_0x7510('0x43')]=[{'all':!![]}];}_0x392ae8=_[_0x7510('0x3e')]({},_0x392ae8,_0x920e6a[_0x7510('0x41')]);return db[_0x7510('0x44')][_0x7510('0x49')](_0x392ae8)[_0x7510('0x45')](handleEntityNotFound(_0x463a58,null))[_0x7510('0x45')](respondWithResult(_0x463a58,null))[_0x7510('0x46')](handleError(_0x463a58,null));};exports[_0x7510('0x27')]=function(_0x271c96,_0x36f151){if(_0x271c96[_0x7510('0x4a')]['id']){delete _0x271c96[_0x7510('0x4a')]['id'];}return db[_0x7510('0x44')][_0x7510('0x49')]({'where':{'id':_0x271c96['params']['id']}})['then'](handleEntityNotFound(_0x36f151,null))[_0x7510('0x45')](saveUpdates(_0x271c96['body'],null))['then'](respondWithResult(_0x36f151,null))['catch'](handleError(_0x36f151,null));};exports[_0x7510('0x4b')]=function(_0x37fdd6,_0x1c2a9c){return db['CmCustomField'][_0x7510('0x49')]({'where':{'id':_0x37fdd6[_0x7510('0x48')]['id']}})[_0x7510('0x45')](handleEntityNotFound(_0x1c2a9c,null))['then'](removeEntity(_0x1c2a9c,null))[_0x7510('0x46')](handleError(_0x1c2a9c,null));};exports[_0x7510('0x4c')]=function(_0x1a702c,_0x368cff){var _0x873ce7;return db[_0x7510('0x4d')][_0x7510('0x4e')](function(_0x4437cb){return db[_0x7510('0x44')][_0x7510('0x4c')](_0x1a702c[_0x7510('0x4a')],{'transaction':_0x4437cb})['then'](function(_0x29709f){_0x873ce7=_0x29709f;var _0x3c0f40={'type':db[_0x7510('0x4f')][_0x7510('0x50')],'transaction':_0x4437cb};switch(_0x1a702c[_0x7510('0x4a')][_0x7510('0x2e')]){case _0x7510('0x51'):_0x3c0f40[_0x7510('0x2e')]=db[_0x7510('0x4f')][_0x7510('0x50')];break;case'number':_0x3c0f40[_0x7510('0x2e')]=db['Sequelize'][_0x7510('0x52')];break;case _0x7510('0x53'):_0x3c0f40[_0x7510('0x2e')]=db[_0x7510('0x4f')][_0x7510('0x54')];_0x3c0f40[_0x7510('0x55')]=![];break;default:}return db['sequelize'][_0x7510('0x56')][_0x7510('0x57')]('cm_contacts',util[_0x7510('0x58')](_0x7510('0x59'),_0x873ce7['id']),_0x3c0f40);})[_0x7510('0x45')](function(){return _0x873ce7;});})[_0x7510('0x45')](respondWithResult(_0x368cff,0xc9))[_0x7510('0x46')](handleError(_0x368cff,null));}; \ No newline at end of file +var _0x773c=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','length','find','update','body','params','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x236654,_0x16e44f){var _0x27653b=function(_0x2d227c){while(--_0x2d227c){_0x236654['push'](_0x236654['shift']());}};_0x27653b(++_0x16e44f);}(_0x773c,0x9f));var _0xc773=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x773c[_0x4b784d];return _0x2cdeaf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc773('0x0'));var zipdir=require(_0xc773('0x1'));var jsonpatch=require(_0xc773('0x2'));var rp=require(_0xc773('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc773('0x4'));var util=require(_0xc773('0x5'));var path=require(_0xc773('0x6'));var sox=require(_0xc773('0x7'));var csv=require(_0xc773('0x8'));var ejs=require(_0xc773('0x9'));var fs=require('fs');var fs_extra=require(_0xc773('0xa'));var _=require(_0xc773('0xb'));var squel=require(_0xc773('0xc'));var crypto=require(_0xc773('0xd'));var jsforce=require(_0xc773('0xe'));var deskjs=require(_0xc773('0xf'));var toCsv=require(_0xc773('0x8'));var querystring=require(_0xc773('0x10'));var Papa=require(_0xc773('0x11'));var Redis=require(_0xc773('0x12'));var authService=require(_0xc773('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc773('0x14'));var logger=require(_0xc773('0x15'))(_0xc773('0x16'));var utils=require(_0xc773('0x17'));var config=require(_0xc773('0x18'));var licenseUtil=require(_0xc773('0x19'));var db=require(_0xc773('0x1a'))['db'];function respondWithStatusCode(_0x5323e9,_0x360ef6){_0x360ef6=_0x360ef6||0xcc;return function(_0x3416f1){if(_0x3416f1){return _0x5323e9[_0xc773('0x1b')](_0x360ef6);}return _0x5323e9[_0xc773('0x1c')](_0x360ef6)[_0xc773('0x1d')]();};}function respondWithResult(_0x3af4c0,_0x36d914){_0x36d914=_0x36d914||0xc8;return function(_0x5f0253){if(_0x5f0253){return _0x3af4c0['status'](_0x36d914)['json'](_0x5f0253);}};}function respondWithFilteredResult(_0x285eba,_0x67de07){return function(_0x10f2ed){if(_0x10f2ed){var _0x229a06=typeof _0x67de07[_0xc773('0x1e')]===_0xc773('0x1f')&&typeof _0x67de07[_0xc773('0x20')]===_0xc773('0x1f');var _0x55d8ad=_0x10f2ed[_0xc773('0x21')];var _0x2105f7=_0x229a06?0x0:_0x67de07[_0xc773('0x1e')];var _0x36c509=_0x229a06?_0x10f2ed[_0xc773('0x21')]:_0x67de07['offset']+_0x67de07['limit'];var _0x2e1dae;if(_0x36c509>=_0x55d8ad){_0x36c509=_0x55d8ad;_0x2e1dae=0xc8;}else{_0x2e1dae=0xce;}_0x285eba[_0xc773('0x1c')](_0x2e1dae);return _0x285eba[_0xc773('0x22')](_0xc773('0x23'),_0x2105f7+'-'+_0x36c509+'/'+_0x55d8ad)[_0xc773('0x24')](_0x10f2ed);}return null;};}function patchUpdates(_0xdc711){return function(_0x42210a){try{jsonpatch[_0xc773('0x25')](_0x42210a,_0xdc711,!![]);}catch(_0xed05c3){return BPromise[_0xc773('0x26')](_0xed05c3);}return _0x42210a[_0xc773('0x27')]();};}function saveUpdates(_0x270447,_0x250720){return function(_0x2f84c3){if(_0x2f84c3){return _0x2f84c3['update'](_0x270447)[_0xc773('0x28')](function(_0x519d86){return _0x519d86;});}return null;};}function removeEntity(_0x543f63,_0xe51029){return function(_0x444ffb){if(_0x444ffb){return _0x444ffb[_0xc773('0x29')]()['then'](function(){_0x543f63[_0xc773('0x1c')](0xcc)[_0xc773('0x1d')]();});}};}function handleEntityNotFound(_0x2bd91d,_0x2150a6){return function(_0x2d1c40){if(!_0x2d1c40){_0x2bd91d[_0xc773('0x1b')](0x194);}return _0x2d1c40;};}function handleError(_0x2b9974,_0x46cf5f){_0x46cf5f=_0x46cf5f||0x1f4;return function(_0x485a83){logger['error'](_0x485a83[_0xc773('0x2a')]);if(_0x485a83[_0xc773('0x2b')]){delete _0x485a83[_0xc773('0x2b')];}_0x2b9974['status'](_0x46cf5f)[_0xc773('0x2c')](_0x485a83);};}exports[_0xc773('0x2d')]=function(_0x57b778,_0x2bd23c){var _0x3bc836={},_0x16e356={},_0x1a372a={'count':0x0,'rows':[]};var _0x296c77=_[_0xc773('0x2e')](db[_0xc773('0x2f')][_0xc773('0x30')],function(_0x15cf8a){return{'name':_0x15cf8a[_0xc773('0x31')],'type':_0x15cf8a[_0xc773('0x32')][_0xc773('0x33')]};});_0x16e356[_0xc773('0x34')]=_[_0xc773('0x35')](_[_0xc773('0x2e')](_0x296c77,_0xc773('0x2b')),[_0xc773('0x2b')]);_0x16e356[_0xc773('0x36')]=_[_0xc773('0x37')](_0x57b778[_0xc773('0x36')]);_0x16e356['filters']=_['intersection'](_0x16e356[_0xc773('0x34')],_0x16e356[_0xc773('0x36')]);_0x3bc836[_0xc773('0x38')]=_[_0xc773('0x39')](_0x16e356[_0xc773('0x34')],qs[_0xc773('0x3a')](_0x57b778['query'][_0xc773('0x3a')]));_0x3bc836[_0xc773('0x38')]=_0x3bc836[_0xc773('0x38')]['length']?_0x3bc836[_0xc773('0x38')]:_0x16e356['model'];if(!_0x57b778[_0xc773('0x36')][_0xc773('0x3b')](_0xc773('0x3c'))){_0x3bc836[_0xc773('0x20')]=qs[_0xc773('0x20')](_0x57b778['query']['limit']);_0x3bc836['offset']=qs[_0xc773('0x1e')](_0x57b778[_0xc773('0x36')][_0xc773('0x1e')]);}_0x3bc836[_0xc773('0x3d')]=qs['sort'](_0x57b778[_0xc773('0x36')]['sort']);_0x3bc836['where']=qs[_0xc773('0x3e')](_['pick'](_0x57b778['query'],_0x16e356[_0xc773('0x3e')]),_0x296c77);if(_0x57b778[_0xc773('0x36')][_0xc773('0x3f')]){_0x3bc836[_0xc773('0x40')]=_['merge'](_0x3bc836[_0xc773('0x40')],{'$or':_['map'](_0x296c77,function(_0x1ad780){if(_0x1ad780['type']!==_0xc773('0x41')){var _0x96e074={};_0x96e074[_0x1ad780[_0xc773('0x2b')]]={'$like':'%'+_0x57b778[_0xc773('0x36')][_0xc773('0x3f')]+'%'};return _0x96e074;}})});}_0x3bc836=_[_0xc773('0x42')]({},_0x3bc836,_0x57b778[_0xc773('0x43')]);var _0x174393={'where':_0x3bc836['where']};return db[_0xc773('0x2f')]['count'](_0x174393)[_0xc773('0x28')](function(_0x2eb700){_0x1a372a[_0xc773('0x21')]=_0x2eb700;if(_0x57b778[_0xc773('0x36')][_0xc773('0x44')]){_0x3bc836[_0xc773('0x45')]=[{'all':!![]}];}return db[_0xc773('0x2f')][_0xc773('0x46')](_0x3bc836);})[_0xc773('0x28')](function(_0x3ddc59){_0x1a372a[_0xc773('0x47')]=_0x3ddc59;return _0x1a372a;})['then'](respondWithFilteredResult(_0x2bd23c,_0x3bc836))[_0xc773('0x48')](handleError(_0x2bd23c,null));};exports[_0xc773('0x49')]=function(_0x22c82c,_0x268aea){var _0x2ba4e6={'raw':!![],'where':{'id':_0x22c82c['params']['id']}},_0x381dc1={};_0x381dc1[_0xc773('0x34')]=_[_0xc773('0x37')](db[_0xc773('0x2f')][_0xc773('0x30')]);_0x381dc1[_0xc773('0x36')]=_['keys'](_0x22c82c[_0xc773('0x36')]);_0x381dc1[_0xc773('0x3e')]=_[_0xc773('0x39')](_0x381dc1[_0xc773('0x34')],_0x381dc1[_0xc773('0x36')]);_0x2ba4e6['attributes']=_['intersection'](_0x381dc1[_0xc773('0x34')],qs[_0xc773('0x3a')](_0x22c82c[_0xc773('0x36')]['fields']));_0x2ba4e6['attributes']=_0x2ba4e6[_0xc773('0x38')][_0xc773('0x4a')]?_0x2ba4e6[_0xc773('0x38')]:_0x381dc1['model'];if(_0x22c82c['query'][_0xc773('0x44')]){_0x2ba4e6['include']=[{'all':!![]}];}_0x2ba4e6=_[_0xc773('0x42')]({},_0x2ba4e6,_0x22c82c[_0xc773('0x43')]);return db['CmCustomField'][_0xc773('0x4b')](_0x2ba4e6)[_0xc773('0x28')](handleEntityNotFound(_0x268aea,null))[_0xc773('0x28')](respondWithResult(_0x268aea,null))['catch'](handleError(_0x268aea,null));};exports[_0xc773('0x4c')]=function(_0x37e22e,_0x5e0973){if(_0x37e22e[_0xc773('0x4d')]['id']){delete _0x37e22e[_0xc773('0x4d')]['id'];}return db[_0xc773('0x2f')]['find']({'where':{'id':_0x37e22e[_0xc773('0x4e')]['id']}})[_0xc773('0x28')](handleEntityNotFound(_0x5e0973,null))[_0xc773('0x28')](saveUpdates(_0x37e22e['body'],null))['then'](respondWithResult(_0x5e0973,null))[_0xc773('0x48')](handleError(_0x5e0973,null));};exports['destroy']=function(_0x1892de,_0x125151){return db[_0xc773('0x2f')]['find']({'where':{'id':_0x1892de[_0xc773('0x4e')]['id']}})[_0xc773('0x28')](handleEntityNotFound(_0x125151,null))[_0xc773('0x28')](removeEntity(_0x125151,null))[_0xc773('0x48')](handleError(_0x125151,null));};exports[_0xc773('0x4f')]=function(_0x111c6f,_0x467811){var _0x5d8de7;return db[_0xc773('0x50')][_0xc773('0x51')](function(_0x19f6aa){return db[_0xc773('0x2f')][_0xc773('0x4f')](_0x111c6f['body'],{'transaction':_0x19f6aa})[_0xc773('0x28')](function(_0x565d85){_0x5d8de7=_0x565d85;var _0x517424={'type':db[_0xc773('0x52')][_0xc773('0x53')],'transaction':_0x19f6aa};switch(_0x111c6f['body']['type']){case _0xc773('0x54'):_0x517424[_0xc773('0x32')]=db[_0xc773('0x52')][_0xc773('0x53')];break;case'number':_0x517424[_0xc773('0x32')]=db[_0xc773('0x52')][_0xc773('0x55')];break;case _0xc773('0x56'):_0x517424[_0xc773('0x32')]=db[_0xc773('0x52')][_0xc773('0x57')];_0x517424[_0xc773('0x58')]=![];break;default:}return db[_0xc773('0x50')][_0xc773('0x59')][_0xc773('0x5a')](_0xc773('0x5b'),util[_0xc773('0x5c')]('cf_%d',_0x5d8de7['id']),_0x517424);})[_0xc773('0x28')](function(){return _0x5d8de7;});})[_0xc773('0x28')](respondWithResult(_0x467811,0xc9))[_0xc773('0x48')](handleError(_0x467811,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index a70e90f..d02f211 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 _0x54b5=['./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3e2100,_0x5f5a58){var _0x368960=function(_0x53c439){while(--_0x53c439){_0x3e2100['push'](_0x3e2100['shift']());}};_0x368960(++_0x5f5a58);}(_0x54b5,0x1c1));var _0x554b=function(_0x5dbc6a,_0x55c7c6){_0x5dbc6a=_0x5dbc6a-0x0;var _0x33c9c7=_0x54b5[_0x5dbc6a];return _0x33c9c7;};'use strict';var _=require(_0x554b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x554b('0x1'));var moment=require(_0x554b('0x2'));var BPromise=require(_0x554b('0x3'));var rp=require(_0x554b('0x4'));var fs=require('fs');var path=require(_0x554b('0x5'));var rimraf=require('rimraf');var config=require(_0x554b('0x6'));var attributes=require(_0x554b('0x7'));module[_0x554b('0x8')]=function(_0x3c353e,_0x3bc77f){return _0x3c353e[_0x554b('0x9')](_0x554b('0xa'),attributes,{'tableName':_0x554b('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6eb7=['api','moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','../../config/logger'];(function(_0xb4e075,_0x5ae852){var _0x53b95f=function(_0x4d5906){while(--_0x4d5906){_0xb4e075['push'](_0xb4e075['shift']());}};_0x53b95f(++_0x5ae852);}(_0x6eb7,0x1e3));var _0x76eb=function(_0x2dda4b,_0x358ee4){_0x2dda4b=_0x2dda4b-0x0;var _0x4b9f36=_0x6eb7[_0x2dda4b];return _0x4b9f36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x76eb('0x0'))(_0x76eb('0x1'));var moment=require(_0x76eb('0x2'));var BPromise=require('bluebird');var rp=require(_0x76eb('0x3'));var fs=require('fs');var path=require(_0x76eb('0x4'));var rimraf=require(_0x76eb('0x5'));var config=require(_0x76eb('0x6'));var attributes=require(_0x76eb('0x7'));module[_0x76eb('0x8')]=function(_0x466a90,_0x5a38ca){return _0x466a90['define'](_0x76eb('0x9'),attributes,{'tableName':_0x76eb('0xa'),'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 c5b50d7..14e1243 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 _0xd3fb=['../../config/environment','jayson/promise','client','http','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x42ea83,_0xe30ce8){var _0x21640f=function(_0x29492c){while(--_0x29492c){_0x42ea83['push'](_0x42ea83['shift']());}};_0x21640f(++_0xe30ce8);}(_0xd3fb,0x83));var _0xbd3f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd3fb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xbd3f('0x0'));var moment=require(_0xbd3f('0x1'));var BPromise=require(_0xbd3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd3f('0x3'));var logger=require(_0xbd3f('0x4'))('rpc');var config=require(_0xbd3f('0x5'));var jayson=require(_0xbd3f('0x6'));var client=jayson[_0xbd3f('0x7')][_0xbd3f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39d546,_0x46a227,_0x1931b7){return new BPromise(function(_0x1dd12c,_0x2d89a1){return client['request'](_0x39d546,_0x1931b7)['then'](function(_0x4d53ee){logger['info'](_0xbd3f('0x9'),_0x46a227,_0xbd3f('0xa'));logger['debug'](_0xbd3f('0xb'),_0x46a227,_0xbd3f('0xa'),JSON['stringify'](_0x4d53ee));if(_0x4d53ee['error']){if(_0x4d53ee[_0xbd3f('0xc')][_0xbd3f('0xd')]===0x1f4){logger[_0xbd3f('0xc')]('CmCustomField,\x20%s,\x20%s',_0x46a227,_0x4d53ee[_0xbd3f('0xc')]['message']);return _0x2d89a1(_0x4d53ee['error'][_0xbd3f('0xe')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x46a227,_0x4d53ee[_0xbd3f('0xc')][_0xbd3f('0xe')]);return _0x1dd12c(_0x4d53ee[_0xbd3f('0xc')]['message']);}else{logger[_0xbd3f('0xf')](_0xbd3f('0x9'),_0x46a227,_0xbd3f('0xa'));_0x1dd12c(_0x4d53ee[_0xbd3f('0x10')]['message']);}})['catch'](function(_0x494070){logger['error'](_0xbd3f('0x9'),_0x46a227,_0x494070);_0x2d89a1(_0x494070);});});} \ No newline at end of file +var _0xe386=['client','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x49902a,_0x39b07a){var _0x1d0cac=function(_0x20cea1){while(--_0x20cea1){_0x49902a['push'](_0x49902a['shift']());}};_0x1d0cac(++_0x39b07a);}(_0xe386,0x1db));var _0x6e38=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe386[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x6e38('0x0'));var moment=require(_0x6e38('0x1'));var BPromise=require(_0x6e38('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e38('0x3'));var db=require(_0x6e38('0x4'))['db'];var utils=require(_0x6e38('0x5'));var logger=require('../../config/logger')(_0x6e38('0x6'));var config=require(_0x6e38('0x7'));var jayson=require(_0x6e38('0x8'));var client=jayson[_0x6e38('0x9')][_0x6e38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2172bc,_0x308d61,_0xcfcb27){return new BPromise(function(_0x3c2eb6,_0x4ab1a7){return client['request'](_0x2172bc,_0xcfcb27)[_0x6e38('0xb')](function(_0x2b8703){logger[_0x6e38('0xc')](_0x6e38('0xd'),_0x308d61,_0x6e38('0xe'));logger[_0x6e38('0xf')](_0x6e38('0x10'),_0x308d61,_0x6e38('0xe'),JSON[_0x6e38('0x11')](_0x2b8703));if(_0x2b8703[_0x6e38('0x12')]){if(_0x2b8703['error'][_0x6e38('0x13')]===0x1f4){logger[_0x6e38('0x12')](_0x6e38('0xd'),_0x308d61,_0x2b8703[_0x6e38('0x12')]['message']);return _0x4ab1a7(_0x2b8703[_0x6e38('0x12')][_0x6e38('0x14')]);}logger[_0x6e38('0x12')]('CmCustomField,\x20%s,\x20%s',_0x308d61,_0x2b8703['error'][_0x6e38('0x14')]);return _0x3c2eb6(_0x2b8703[_0x6e38('0x12')]['message']);}else{logger[_0x6e38('0xc')](_0x6e38('0xd'),_0x308d61,_0x6e38('0xe'));_0x3c2eb6(_0x2b8703['result']['message']);}})[_0x6e38('0x15')](function(_0x5a29c8){logger[_0x6e38('0x12')](_0x6e38('0xd'),_0x308d61,_0x5a29c8);_0x4ab1a7(_0x5a29c8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5aa55d4..2e2d217 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 _0xd07b=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','put','exports','multer','util','path'];(function(_0x27f7b2,_0x432964){var _0x22454f=function(_0x37408d){while(--_0x37408d){_0x27f7b2['push'](_0x27f7b2['shift']());}};_0x22454f(++_0x432964);}(_0xd07b,0xfc));var _0xbd07=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd07b[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xbd07('0x0'));var util=require(_0xbd07('0x1'));var path=require(_0xbd07('0x2'));var timeout=require(_0xbd07('0x3'));var express=require(_0xbd07('0x4'));var router=express[_0xbd07('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbd07('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd07('0x7'));var controller=require(_0xbd07('0x8'));router[_0xbd07('0x9')]('/',auth[_0xbd07('0xa')](),controller[_0xbd07('0xb')]);router[_0xbd07('0x9')](_0xbd07('0xc'),auth[_0xbd07('0xa')](),controller['show']);router['post']('/',auth[_0xbd07('0xa')](),controller['create']);router[_0xbd07('0xd')]('/:id',auth[_0xbd07('0xa')](),controller['update']);router['delete'](_0xbd07('0xc'),auth[_0xbd07('0xa')](),controller['destroy']);module[_0xbd07('0xe')]=router; \ No newline at end of file +var _0x0f36=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xe2c115,_0x3bbbb6){var _0x9a0a94=function(_0x1560be){while(--_0x1560be){_0xe2c115['push'](_0xe2c115['shift']());}};_0x9a0a94(++_0x3bbbb6);}(_0x0f36,0x8b));var _0x60f3=function(_0x35644c,_0x3c80a0){_0x35644c=_0x35644c-0x0;var _0xc2e514=_0x0f36[_0x35644c];return _0xc2e514;};'use strict';var multer=require(_0x60f3('0x0'));var util=require(_0x60f3('0x1'));var path=require(_0x60f3('0x2'));var timeout=require(_0x60f3('0x3'));var express=require(_0x60f3('0x4'));var router=express[_0x60f3('0x5')]();var fs_extra=require(_0x60f3('0x6'));var auth=require(_0x60f3('0x7'));var interaction=require(_0x60f3('0x8'));var config=require(_0x60f3('0x9'));var controller=require(_0x60f3('0xa'));router[_0x60f3('0xb')]('/',auth[_0x60f3('0xc')](),controller[_0x60f3('0xd')]);router[_0x60f3('0xb')]('/:id',auth[_0x60f3('0xc')](),controller[_0x60f3('0xe')]);router['post']('/',auth[_0x60f3('0xc')](),controller[_0x60f3('0xf')]);router[_0x60f3('0x10')](_0x60f3('0x11'),auth[_0x60f3('0xc')](),controller[_0x60f3('0x12')]);router['delete'](_0x60f3('0x11'),auth[_0x60f3('0xc')](),controller[_0x60f3('0x13')]);module[_0x60f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6eada67..56f8d5f 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 _0x62cf=['sequelize','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','contactListQueue','DATE'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x62cf,0xe1));var _0xf62c=function(_0x2e50d2,_0x536c99){_0x2e50d2=_0x2e50d2-0x0;var _0x3c1ed=_0x62cf[_0x2e50d2];return _0x3c1ed;};'use strict';var moment=require('moment');var Sequelize=require(_0xf62c('0x0'));module[_0xf62c('0x1')]={'phone':{'type':Sequelize[_0xf62c('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xf62c('0x3')](_0xf62c('0x4'))},'countbusyretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf62c('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf62c('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf62c('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf62c('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xf62c('0x5')],'unique':_0xf62c('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xf62c('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xf62c('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize[_0xf62c('0x8')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xebde=['moment','sequelize','exports','STRING','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue'];(function(_0x468448,_0x374aaf){var _0x5ae811=function(_0x4a9676){while(--_0x4a9676){_0x468448['push'](_0x468448['shift']());}};_0x5ae811(++_0x374aaf);}(_0xebde,0x1e6));var _0xeebd=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0xebde[_0x2d4661];return _0x42ed1e;};'use strict';var moment=require(_0xeebd('0x0'));var Sequelize=require(_0xeebd('0x1'));module[_0xeebd('0x2')]={'phone':{'type':Sequelize[_0xeebd('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xeebd('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xeebd('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xeebd('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xeebd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xeebd('0x5')](0x2)[_0xeebd('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xeebd('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xeebd('0x5')],'unique':_0xeebd('0x8')},'ListId':{'type':Sequelize[_0xeebd('0x5')],'unique':_0xeebd('0x8')},'UserId':{'type':Sequelize[_0xeebd('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xeebd('0x5')],'unique':_0xeebd('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeebd('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeebd('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 3820f95..6a4d1c0 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 _0x53d5=['List','Queue','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','CmHopper','fieldName','type','key','model','map','query','filters','intersection','concat','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$iLike','$notILike','$overlap','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','find','create','body','update','describe','VoiceQueueId','Campaign','CampaignId','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList'];(function(_0x40bd56,_0x2491d1){var _0x20947d=function(_0x26a39c){while(--_0x26a39c){_0x40bd56['push'](_0x40bd56['shift']());}};_0x20947d(++_0x2491d1);}(_0x53d5,0x1cc));var _0x553d=function(_0x2f09f7,_0x461707){_0x2f09f7=_0x2f09f7-0x0;var _0x1b266c=_0x53d5[_0x2f09f7];return _0x1b266c;};'use strict';var emlformat=require(_0x553d('0x0'));var rimraf=require(_0x553d('0x1'));var zipdir=require(_0x553d('0x2'));var jsonpatch=require(_0x553d('0x3'));var rp=require(_0x553d('0x4'));var moment=require(_0x553d('0x5'));var BPromise=require(_0x553d('0x6'));var Mustache=require('mustache');var util=require(_0x553d('0x7'));var path=require(_0x553d('0x8'));var sox=require(_0x553d('0x9'));var csv=require(_0x553d('0xa'));var ejs=require(_0x553d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x553d('0xc'));var squel=require(_0x553d('0xd'));var crypto=require(_0x553d('0xe'));var jsforce=require(_0x553d('0xf'));var deskjs=require(_0x553d('0x10'));var toCsv=require(_0x553d('0xa'));var querystring=require(_0x553d('0x11'));var Papa=require(_0x553d('0x12'));var Redis=require(_0x553d('0x13'));var authService=require(_0x553d('0x14'));var qs=require(_0x553d('0x15'));var as=require(_0x553d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x553d('0x17'));var utils=require('../../config/utils');var config=require(_0x553d('0x18'));var licenseUtil=require(_0x553d('0x19'));var db=require(_0x553d('0x1a'))['db'];function respondWithStatusCode(_0x1a54ea,_0x41f6c1){_0x41f6c1=_0x41f6c1||0xcc;return function(_0x4285c0){if(_0x4285c0){return _0x1a54ea[_0x553d('0x1b')](_0x41f6c1);}return _0x1a54ea[_0x553d('0x1c')](_0x41f6c1)[_0x553d('0x1d')]();};}function respondWithResult(_0x32b169,_0x3cb13c){_0x3cb13c=_0x3cb13c||0xc8;return function(_0xd11e74){if(_0xd11e74){return _0x32b169['status'](_0x3cb13c)[_0x553d('0x1e')](_0xd11e74);}};}function respondWithFilteredResult(_0x5caa96,_0x1d4f35){return function(_0x2de0c1){if(_0x2de0c1){var _0x12b505=typeof _0x1d4f35['offset']==='undefined'&&typeof _0x1d4f35[_0x553d('0x1f')]===_0x553d('0x20');var _0x2857c5=_0x2de0c1['count'];var _0x2ab468=_0x12b505?0x0:_0x1d4f35[_0x553d('0x21')];var _0x343ce5=_0x12b505?_0x2de0c1[_0x553d('0x22')]:_0x1d4f35[_0x553d('0x21')]+_0x1d4f35[_0x553d('0x1f')];var _0x719651;if(_0x343ce5>=_0x2857c5){_0x343ce5=_0x2857c5;_0x719651=0xc8;}else{_0x719651=0xce;}_0x5caa96[_0x553d('0x1c')](_0x719651);return _0x5caa96[_0x553d('0x23')](_0x553d('0x24'),_0x2ab468+'-'+_0x343ce5+'/'+_0x2857c5)[_0x553d('0x1e')](_0x2de0c1);}return null;};}function patchUpdates(_0x4950e7){return function(_0x11bc86){try{jsonpatch[_0x553d('0x25')](_0x11bc86,_0x4950e7,!![]);}catch(_0x4c5f0f){return BPromise[_0x553d('0x26')](_0x4c5f0f);}return _0x11bc86[_0x553d('0x27')]();};}function saveUpdates(_0x4d00e3,_0x5bbd2d){return function(_0x4a6e0e){if(_0x4a6e0e){return _0x4a6e0e['update'](_0x4d00e3)[_0x553d('0x28')](function(_0x53b217){return _0x53b217;});}return null;};}function removeEntity(_0x82dd3a,_0xacc984){return function(_0x2e4f1b){if(_0x2e4f1b){return _0x2e4f1b[_0x553d('0x29')]()[_0x553d('0x28')](function(){_0x82dd3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caed9,_0x491dc2){return function(_0x576c56){if(!_0x576c56){_0x2caed9[_0x553d('0x1b')](0x194);}return _0x576c56;};}function handleError(_0x517a1c,_0x677832){_0x677832=_0x677832||0x1f4;return function(_0x2c0484){logger[_0x553d('0x2a')](_0x2c0484['stack']);if(_0x2c0484[_0x553d('0x2b')]){delete _0x2c0484[_0x553d('0x2b')];}_0x517a1c[_0x553d('0x1c')](_0x677832)['send'](_0x2c0484);};}exports[_0x553d('0x2c')]=function(_0x39943d,_0x2bf05d){var _0x50fbc3={},_0x37ddd7={},_0x180a66={'count':0x0,'rows':[]};var _0xc3d157=_['map'](db[_0x553d('0x2d')]['rawAttributes'],function(_0x174fea){return{'name':_0x174fea[_0x553d('0x2e')],'type':_0x174fea[_0x553d('0x2f')][_0x553d('0x30')]};});_0x37ddd7[_0x553d('0x31')]=_[_0x553d('0x32')](_0xc3d157,_0x553d('0x2b'));_0x37ddd7[_0x553d('0x33')]=_['keys'](_0x39943d[_0x553d('0x33')]);_0x37ddd7[_0x553d('0x34')]=_[_0x553d('0x35')](_0x37ddd7[_0x553d('0x31')],_0x37ddd7[_0x553d('0x33')]);_0x37ddd7[_0x553d('0x34')]=_[_0x553d('0x36')](_0x37ddd7[_0x553d('0x34')],['$and',_0x553d('0x37'),_0x553d('0x38'),_0x553d('0x39'),'$lt',_0x553d('0x3a'),_0x553d('0x3b'),_0x553d('0x3c'),_0x553d('0x3d'),_0x553d('0x3e'),_0x553d('0x3f'),_0x553d('0x40'),_0x553d('0x41'),'$like','$notLike',_0x553d('0x42'),_0x553d('0x43'),'$like',_0x553d('0x44'),'$contains','$contained',_0x553d('0x45')]);_0x50fbc3['attributes']=_[_0x553d('0x35')](_0x37ddd7['model'],qs[_0x553d('0x46')](_0x39943d[_0x553d('0x33')]['fields']));_0x50fbc3['attributes']=_0x50fbc3[_0x553d('0x47')][_0x553d('0x48')]?_0x50fbc3[_0x553d('0x47')]:_0x37ddd7[_0x553d('0x31')];if(!_0x39943d['query'][_0x553d('0x49')](_0x553d('0x4a'))){_0x50fbc3['limit']=qs[_0x553d('0x1f')](_0x39943d['query'][_0x553d('0x1f')]);_0x50fbc3[_0x553d('0x21')]=qs[_0x553d('0x21')](_0x39943d[_0x553d('0x33')]['offset']);}_0x50fbc3['order']=qs[_0x553d('0x4b')](_0x39943d[_0x553d('0x33')][_0x553d('0x4b')]);_0x50fbc3[_0x553d('0x4c')]=qs[_0x553d('0x34')](_[_0x553d('0x4d')](_0x39943d[_0x553d('0x33')],_0x37ddd7[_0x553d('0x34')]),_0xc3d157);if(_0x39943d[_0x553d('0x33')][_0x553d('0x4e')]){_0x50fbc3['where']=_[_0x553d('0x4f')](_0x50fbc3[_0x553d('0x4c')],{'$or':_['map'](_0xc3d157,function(_0x3fce6f){if(_0x3fce6f[_0x553d('0x2f')]!=='VIRTUAL'){var _0x1caab8={};_0x1caab8[_0x3fce6f[_0x553d('0x2b')]]={'$like':'%'+_0x39943d[_0x553d('0x33')][_0x553d('0x4e')]+'%'};return _0x1caab8;}})});}_0x50fbc3=_[_0x553d('0x4f')]({},_0x50fbc3,_0x39943d[_0x553d('0x50')]);var _0x596b71={'where':_0x50fbc3[_0x553d('0x4c')]};return db[_0x553d('0x2d')][_0x553d('0x22')](_0x596b71)['then'](function(_0x247bdf){_0x180a66[_0x553d('0x22')]=_0x247bdf;if(_0x39943d['query'][_0x553d('0x51')]){_0x50fbc3[_0x553d('0x52')]=[{'all':!![]}];}return db[_0x553d('0x2d')][_0x553d('0x53')](_0x50fbc3);})[_0x553d('0x28')](function(_0x39d602){_0x180a66[_0x553d('0x54')]=_0x39d602;return _0x180a66;})[_0x553d('0x28')](respondWithFilteredResult(_0x2bf05d,_0x50fbc3))[_0x553d('0x55')](handleError(_0x2bf05d,null));};exports['show']=function(_0x75a3da,_0x541f4f){var _0x17532b={'raw':!![],'where':{'id':_0x75a3da[_0x553d('0x56')]['id']}},_0x4868b8={};_0x4868b8[_0x553d('0x31')]=_['keys'](db[_0x553d('0x2d')][_0x553d('0x57')]);_0x4868b8[_0x553d('0x33')]=_[_0x553d('0x58')](_0x75a3da[_0x553d('0x33')]);_0x4868b8['filters']=_[_0x553d('0x35')](_0x4868b8['model'],_0x4868b8[_0x553d('0x33')]);_0x17532b[_0x553d('0x47')]=_[_0x553d('0x35')](_0x4868b8[_0x553d('0x31')],qs[_0x553d('0x46')](_0x75a3da[_0x553d('0x33')][_0x553d('0x46')]));_0x17532b[_0x553d('0x47')]=_0x17532b[_0x553d('0x47')][_0x553d('0x48')]?_0x17532b[_0x553d('0x47')]:_0x4868b8[_0x553d('0x31')];if(_0x75a3da[_0x553d('0x33')][_0x553d('0x51')]){_0x17532b[_0x553d('0x52')]=[{'all':!![]}];}_0x17532b=_[_0x553d('0x4f')]({},_0x17532b,_0x75a3da[_0x553d('0x50')]);return db['CmHopper'][_0x553d('0x59')](_0x17532b)[_0x553d('0x28')](handleEntityNotFound(_0x541f4f,null))[_0x553d('0x28')](respondWithResult(_0x541f4f,null))[_0x553d('0x55')](handleError(_0x541f4f,null));};exports['create']=function(_0x5a5df4,_0x1ef10a){return db[_0x553d('0x2d')][_0x553d('0x5a')](_0x5a5df4[_0x553d('0x5b')],{})[_0x553d('0x28')](respondWithResult(_0x1ef10a,0xc9))[_0x553d('0x55')](handleError(_0x1ef10a,null));};exports[_0x553d('0x5c')]=function(_0x10053b,_0x126d57){if(_0x10053b['body']['id']){delete _0x10053b[_0x553d('0x5b')]['id'];}return db[_0x553d('0x2d')][_0x553d('0x59')]({'where':{'id':_0x10053b[_0x553d('0x56')]['id']}})['then'](handleEntityNotFound(_0x126d57,null))['then'](saveUpdates(_0x10053b[_0x553d('0x5b')],null))[_0x553d('0x28')](respondWithResult(_0x126d57,null))[_0x553d('0x55')](handleError(_0x126d57,null));};exports[_0x553d('0x5d')]=function(_0x2bb795,_0x1f0a5c){return db[_0x553d('0x2d')][_0x553d('0x5d')]()['then'](respondWithResult(_0x1f0a5c,null))[_0x553d('0x55')](handleError(_0x1f0a5c,null));};exports['destroy']=function(_0x1bdec1,_0x4e8179){var _0x3b5169;return db['CmHopper']['find']({'where':{'id':_0x1bdec1[_0x553d('0x56')]['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x4e8179,null))['then'](function(_0x26f753){if(_0x26f753){return _0x26f753[_0x553d('0x29')]()[_0x553d('0x28')](function(_0x47ac58){return _0x47ac58;});}})[_0x553d('0x28')](function(_0x3bccbd){_0x3b5169=_0x3bccbd;if(_0x3bccbd){if(_0x3bccbd[_0x553d('0x5e')]||_0x3bccbd['CampaignId']){return db[_0x3bccbd['VoiceQueueId']?'VoiceQueue':_0x553d('0x5f')]['find']({'where':{'id':_0x3bccbd[_0x553d('0x5e')]?_0x3bccbd[_0x553d('0x5e')]:_0x3bccbd[_0x553d('0x60')]},'attributes':['id',_0x553d('0x2b')],'raw':!![]});}}})[_0x553d('0x28')](function(_0x50b4b8){var _0x295159={};if(_0x50b4b8){_[_0x553d('0x4f')](_0x295159,_[_0x553d('0x61')](_0x3b5169[_0x553d('0x62')],['createdAt',_0x553d('0x63'),'id']));_0x295159[_0x553d('0x64')]=0x15;_0x295159[_0x553d('0x65')]=_0x553d('0x66');_0x295159[_0x553d('0x67')]=_0x50b4b8[_0x553d('0x2b')];_0x295159['membername']=_0x1bdec1[_0x553d('0x68')][_0x553d('0x2b')];_0x295159[_0x553d('0x69')]=_0x1bdec1[_0x553d('0x68')]['id'];_0x295159['deleted']=!![];_0x295159[_0x553d('0x6a')]=moment()[_0x553d('0x6b')](_0x553d('0x6c'));_0x295159[_0x553d('0x6d')]=_0x3b5169['phone'];_0x295159[_0x553d('0x6e')]=_0x3b5169[_0x553d('0x5e')]?'queue':_0x553d('0x6f');return db[_0x553d('0x70')][_0x553d('0x59')]({'where':{'id':_0x295159['ContactId']},'attributes':[_0x553d('0x71'),_0x553d('0x72')]})[_0x553d('0x28')](function(_0x40f086){if(!_[_0x553d('0x73')](_0x4e8179)&&!_[_0x553d('0x73')](_0x40f086[_0x553d('0x71')])){_0x295159[_0x553d('0x74')]=_0x40f086[_0x553d('0x71')];if(!_[_0x553d('0x73')](_0x40f086[_0x553d('0x72')])){_0x295159[_0x553d('0x74')]+='\x20'+_0x40f086[_0x553d('0x72')];}}})[_0x553d('0x75')](function(){return db[_0x553d('0x76')][_0x553d('0x5a')](_0x295159);});}})[_0x553d('0x28')](function(){return _0x4e8179[_0x553d('0x1c')](0xcc)[_0x553d('0x1d')]();})[_0x553d('0x55')](handleError(_0x4e8179,null));};exports[_0x553d('0x77')]=function(_0x4a535f,_0x2fac68,_0x23a51c){var _0x494803=[];return db['CmContact'][_0x553d('0x5d')]()[_0x553d('0x28')](function(_0x22afce){_0x494803=_[_0x553d('0x58')](_0x22afce);return _0x4a535f[_0x553d('0x68')]['getVoiceQueues']({'where':{'type':_0x553d('0x78'),'dialActive':!![],'dialMethod':_0x553d('0x79')},'attributes':['id',_0x553d('0x7a'),_0x553d('0x7b')],'raw':!![]});})[_0x553d('0x28')](function(_0x4926e1){if(_0x4926e1&&_0x4926e1[_0x553d('0x48')]){return db[_0x553d('0x7c')][_0x553d('0x7d')](function(_0x356814){var _0x58e4d0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x553d('0x6c'))},'VoiceQueueId':{'$in':_['map'](_0x4926e1,'id')},'$or':[{'UserId':null},{'UserId':_0x4a535f[_0x553d('0x68')]['id']}]};var _0x2f9724={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4926e1)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x553d('0x32')]('id')[_0x553d('0x7e')]()},'$or':[{'UserId':null},{'UserId':_0x4a535f[_0x553d('0x68')]['id']}]};var _0x33836f={'$or':[_0x58e4d0,_0x2f9724]};var _0x399104=[];if(_0x4a535f[_0x553d('0x5b')][_0x553d('0x7f')]&&_0x4a535f['body'][_0x553d('0x7f')]==='prev'){if(!_[_0x553d('0x80')](_0x4a535f[_0x553d('0x5b')][_0x553d('0x81')])){_0x33836f['id']={'$in':_0x4a535f[_0x553d('0x5b')][_0x553d('0x81')]};}_0x399104=[['priority',_0x553d('0x82')],[_0x553d('0x83'),_0x4926e1[0x0][_0x553d('0x7a')]===_0x553d('0x82')?_0x553d('0x84'):_0x553d('0x82')],db[_0x553d('0x7c')][_0x553d('0x85')](_0x553d('0x86')),['id',_0x553d('0x84')]];}else{if(!_['isEmpty'](_0x4a535f[_0x553d('0x5b')][_0x553d('0x81')])){_0x33836f['id']={'$notIn':_0x4a535f[_0x553d('0x5b')][_0x553d('0x81')]};}_0x399104=[['priority','DESC'],[_0x553d('0x83'),_0x4926e1[0x0][_0x553d('0x7a')]],db['sequelize'][_0x553d('0x85')](_0x553d('0x87')),['id',_0x553d('0x82')]];}return db[_0x553d('0x2d')][_0x553d('0x88')]({'attributes':['id',_0x553d('0x89'),'recallme'],'where':_0x33836f,'order':_0x399104,'transaction':_0x356814,'lock':_0x356814[_0x553d('0x8a')][_0x553d('0x8b')],'include':[{'model':db[_0x553d('0x70')],'as':_0x553d('0x8c'),'attributes':_0x494803,'include':[{'model':db[_0x553d('0x8d')],'as':_0x553d('0x8e'),'attributes':['id',_0x553d('0x2b')]}]},{'model':db[_0x553d('0x8f')],'as':_0x553d('0x90'),'attributes':['id',_0x553d('0x2b')]},{'model':db['VoiceQueue'],'as':_0x553d('0x91'),'attributes':['id',_0x553d('0x2b'),'dialActive']}]})[_0x553d('0x28')](function(_0x25b48f){if(_0x25b48f){return _0x25b48f[_0x553d('0x5c')]({'UserId':_0x4a535f['user']['id']},{'transaction':_0x356814});}});});}})[_0x553d('0x28')](handleEntityNotFound(_0x2fac68,null))[_0x553d('0x28')](respondWithResult(_0x2fac68,null))[_0x553d('0x55')](handleError(_0x2fac68,null));};exports[_0x553d('0x92')]=function(_0x6972f3,_0x421157,_0x52687d){return _0x6972f3[_0x553d('0x68')][_0x553d('0x93')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x553d('0x79')},'attributes':['id'],'raw':!![]})[_0x553d('0x28')](function(_0x543e75){if(_0x543e75&&_0x543e75[_0x553d('0x48')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x553d('0x32')](_0x543e75,'id')},'$or':[{'UserId':null},{'UserId':_0x6972f3['user']['id']}]}});}return 0x0;})[_0x553d('0x28')](function(_0x2e1763){if(!_['isNil'](_0x2e1763)&&_[_0x553d('0x94')](_0x2e1763)){return _0x421157[_0x553d('0x1c')](0xc8)['json']({'contacts':_0x2e1763});}else{logger[_0x553d('0x2a')](_0x553d('0x95'),_0x553d('0x92'),0x194,_0x553d('0x96'));_0x421157['sendStatus'](0x194);}})['catch'](handleError(_0x421157,null));}; \ No newline at end of file +var _0x556d=['sox','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','status','json','limit','undefined','offset','count','Content-Range','apply','reject','save','then','end','error','name','index','map','CmHopper','rawAttributes','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$not','$notBetween','$notIn','$notLike','$iLike','$like','$overlap','$contained','$any','attributes','fields','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getPreview','outbound','preview','sequelize','transaction','dialPreviewAutoRecallMe','value','direction','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','priority','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x556d,0x83));var _0xd556=function(_0x3e94a4,_0x3da7a5){_0x3e94a4=_0x3e94a4-0x0;var _0x53d73b=_0x556d[_0x3e94a4];return _0x53d73b;};'use strict';var emlformat=require(_0xd556('0x0'));var rimraf=require(_0xd556('0x1'));var zipdir=require(_0xd556('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd556('0x3'));var moment=require(_0xd556('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd556('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd556('0x6'));var csv=require(_0xd556('0x7'));var ejs=require(_0xd556('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd556('0x9'));var squel=require('squel');var crypto=require(_0xd556('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd556('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd556('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xd556('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd556('0xe'));var utils=require(_0xd556('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xd556('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5eb4b9,_0x34fd1f){_0x34fd1f=_0x34fd1f||0xcc;return function(_0x56bcc6){if(_0x56bcc6){return _0x5eb4b9['sendStatus'](_0x34fd1f);}return _0x5eb4b9['status'](_0x34fd1f)['end']();};}function respondWithResult(_0x26b735,_0x1e0ee6){_0x1e0ee6=_0x1e0ee6||0xc8;return function(_0xca43d9){if(_0xca43d9){return _0x26b735[_0xd556('0x11')](_0x1e0ee6)[_0xd556('0x12')](_0xca43d9);}};}function respondWithFilteredResult(_0x3553fc,_0x4c985a){return function(_0x3c5ae6){if(_0x3c5ae6){var _0x3c158d=typeof _0x4c985a['offset']==='undefined'&&typeof _0x4c985a[_0xd556('0x13')]===_0xd556('0x14');var _0x43c6ad=_0x3c5ae6['count'];var _0x5c5371=_0x3c158d?0x0:_0x4c985a[_0xd556('0x15')];var _0x2a7eaa=_0x3c158d?_0x3c5ae6[_0xd556('0x16')]:_0x4c985a[_0xd556('0x15')]+_0x4c985a[_0xd556('0x13')];var _0x47a86e;if(_0x2a7eaa>=_0x43c6ad){_0x2a7eaa=_0x43c6ad;_0x47a86e=0xc8;}else{_0x47a86e=0xce;}_0x3553fc[_0xd556('0x11')](_0x47a86e);return _0x3553fc['set'](_0xd556('0x17'),_0x5c5371+'-'+_0x2a7eaa+'/'+_0x43c6ad)[_0xd556('0x12')](_0x3c5ae6);}return null;};}function patchUpdates(_0x5b0e8b){return function(_0xab388b){try{jsonpatch[_0xd556('0x18')](_0xab388b,_0x5b0e8b,!![]);}catch(_0x5549d2){return BPromise[_0xd556('0x19')](_0x5549d2);}return _0xab388b[_0xd556('0x1a')]();};}function saveUpdates(_0x2b91ec,_0x2eddf0){return function(_0x5f1fc5){if(_0x5f1fc5){return _0x5f1fc5['update'](_0x2b91ec)[_0xd556('0x1b')](function(_0x6c2b7b){return _0x6c2b7b;});}return null;};}function removeEntity(_0x38a9ae,_0x3314a0){return function(_0x856d5a){if(_0x856d5a){return _0x856d5a['destroy']()['then'](function(){_0x38a9ae['status'](0xcc)[_0xd556('0x1c')]();});}};}function handleEntityNotFound(_0x5d96d4,_0x518f2b){return function(_0x54152){if(!_0x54152){_0x5d96d4['sendStatus'](0x194);}return _0x54152;};}function handleError(_0x174a38,_0x370de8){_0x370de8=_0x370de8||0x1f4;return function(_0x5a8325){logger[_0xd556('0x1d')](_0x5a8325['stack']);if(_0x5a8325[_0xd556('0x1e')]){delete _0x5a8325[_0xd556('0x1e')];}_0x174a38[_0xd556('0x11')](_0x370de8)['send'](_0x5a8325);};}exports[_0xd556('0x1f')]=function(_0x28a0c8,_0x49635f){var _0x18216c={},_0x2207e7={},_0x5f18dd={'count':0x0,'rows':[]};var _0x38938f=_[_0xd556('0x20')](db[_0xd556('0x21')][_0xd556('0x22')],function(_0x2f08cb){return{'name':_0x2f08cb['fieldName'],'type':_0x2f08cb['type'][_0xd556('0x23')]};});_0x2207e7[_0xd556('0x24')]=_[_0xd556('0x20')](_0x38938f,_0xd556('0x1e'));_0x2207e7[_0xd556('0x25')]=_[_0xd556('0x26')](_0x28a0c8[_0xd556('0x25')]);_0x2207e7[_0xd556('0x27')]=_[_0xd556('0x28')](_0x2207e7[_0xd556('0x24')],_0x2207e7[_0xd556('0x25')]);_0x2207e7[_0xd556('0x27')]=_[_0xd556('0x29')](_0x2207e7[_0xd556('0x27')],[_0xd556('0x2a'),'$or',_0xd556('0x2b'),_0xd556('0x2c'),_0xd556('0x2d'),_0xd556('0x2e'),'$ne','$eq',_0xd556('0x2f'),'$between',_0xd556('0x30'),'$in',_0xd556('0x31'),'$like',_0xd556('0x32'),_0xd556('0x33'),'$notILike',_0xd556('0x34'),_0xd556('0x35'),'$contains',_0xd556('0x36'),_0xd556('0x37')]);_0x18216c[_0xd556('0x38')]=_[_0xd556('0x28')](_0x2207e7[_0xd556('0x24')],qs['fields'](_0x28a0c8[_0xd556('0x25')][_0xd556('0x39')]));_0x18216c[_0xd556('0x38')]=_0x18216c[_0xd556('0x38')][_0xd556('0x3a')]?_0x18216c[_0xd556('0x38')]:_0x2207e7[_0xd556('0x24')];if(!_0x28a0c8['query']['hasOwnProperty'](_0xd556('0x3b'))){_0x18216c['limit']=qs['limit'](_0x28a0c8[_0xd556('0x25')][_0xd556('0x13')]);_0x18216c[_0xd556('0x15')]=qs[_0xd556('0x15')](_0x28a0c8['query'][_0xd556('0x15')]);}_0x18216c[_0xd556('0x3c')]=qs['sort'](_0x28a0c8[_0xd556('0x25')]['sort']);_0x18216c['where']=qs['filters'](_[_0xd556('0x3d')](_0x28a0c8[_0xd556('0x25')],_0x2207e7[_0xd556('0x27')]),_0x38938f);if(_0x28a0c8[_0xd556('0x25')][_0xd556('0x3e')]){_0x18216c[_0xd556('0x3f')]=_['merge'](_0x18216c['where'],{'$or':_[_0xd556('0x20')](_0x38938f,function(_0x3df49b){if(_0x3df49b['type']!==_0xd556('0x40')){var _0x631c0f={};_0x631c0f[_0x3df49b[_0xd556('0x1e')]]={'$like':'%'+_0x28a0c8[_0xd556('0x25')][_0xd556('0x3e')]+'%'};return _0x631c0f;}})});}_0x18216c=_[_0xd556('0x41')]({},_0x18216c,_0x28a0c8[_0xd556('0x42')]);var _0x86ad91={'where':_0x18216c['where']};return db[_0xd556('0x21')][_0xd556('0x16')](_0x86ad91)[_0xd556('0x1b')](function(_0x53d55c){_0x5f18dd[_0xd556('0x16')]=_0x53d55c;if(_0x28a0c8[_0xd556('0x25')][_0xd556('0x43')]){_0x18216c['include']=[{'all':!![]}];}return db['CmHopper'][_0xd556('0x44')](_0x18216c);})['then'](function(_0x14c103){_0x5f18dd[_0xd556('0x45')]=_0x14c103;return _0x5f18dd;})['then'](respondWithFilteredResult(_0x49635f,_0x18216c))[_0xd556('0x46')](handleError(_0x49635f,null));};exports['show']=function(_0x18ba56,_0x4bc754){var _0xa1d011={'raw':!![],'where':{'id':_0x18ba56[_0xd556('0x47')]['id']}},_0x396022={};_0x396022[_0xd556('0x24')]=_[_0xd556('0x26')](db['CmHopper']['rawAttributes']);_0x396022[_0xd556('0x25')]=_[_0xd556('0x26')](_0x18ba56[_0xd556('0x25')]);_0x396022['filters']=_[_0xd556('0x28')](_0x396022[_0xd556('0x24')],_0x396022[_0xd556('0x25')]);_0xa1d011[_0xd556('0x38')]=_[_0xd556('0x28')](_0x396022['model'],qs[_0xd556('0x39')](_0x18ba56['query'][_0xd556('0x39')]));_0xa1d011[_0xd556('0x38')]=_0xa1d011[_0xd556('0x38')][_0xd556('0x3a')]?_0xa1d011[_0xd556('0x38')]:_0x396022[_0xd556('0x24')];if(_0x18ba56[_0xd556('0x25')]['includeAll']){_0xa1d011['include']=[{'all':!![]}];}_0xa1d011=_[_0xd556('0x41')]({},_0xa1d011,_0x18ba56[_0xd556('0x42')]);return db[_0xd556('0x21')][_0xd556('0x48')](_0xa1d011)[_0xd556('0x1b')](handleEntityNotFound(_0x4bc754,null))[_0xd556('0x1b')](respondWithResult(_0x4bc754,null))[_0xd556('0x46')](handleError(_0x4bc754,null));};exports[_0xd556('0x49')]=function(_0x2b0c4c,_0x417837){return db[_0xd556('0x21')][_0xd556('0x49')](_0x2b0c4c[_0xd556('0x4a')],{})[_0xd556('0x1b')](respondWithResult(_0x417837,0xc9))[_0xd556('0x46')](handleError(_0x417837,null));};exports[_0xd556('0x4b')]=function(_0x5d1415,_0x246b14){if(_0x5d1415['body']['id']){delete _0x5d1415[_0xd556('0x4a')]['id'];}return db[_0xd556('0x21')][_0xd556('0x48')]({'where':{'id':_0x5d1415[_0xd556('0x47')]['id']}})[_0xd556('0x1b')](handleEntityNotFound(_0x246b14,null))[_0xd556('0x1b')](saveUpdates(_0x5d1415[_0xd556('0x4a')],null))[_0xd556('0x1b')](respondWithResult(_0x246b14,null))[_0xd556('0x46')](handleError(_0x246b14,null));};exports[_0xd556('0x4c')]=function(_0x57313e,_0x4c2853){return db[_0xd556('0x21')][_0xd556('0x4c')]()[_0xd556('0x1b')](respondWithResult(_0x4c2853,null))[_0xd556('0x46')](handleError(_0x4c2853,null));};exports[_0xd556('0x4d')]=function(_0x5c62f4,_0x1ba764){var _0x33e2c6;return db['CmHopper'][_0xd556('0x48')]({'where':{'id':_0x5c62f4[_0xd556('0x47')]['id']}})[_0xd556('0x1b')](handleEntityNotFound(_0x1ba764,null))[_0xd556('0x1b')](function(_0x345188){if(_0x345188){return _0x345188[_0xd556('0x4d')]()[_0xd556('0x1b')](function(_0x5129a2){return _0x5129a2;});}})['then'](function(_0x468faa){_0x33e2c6=_0x468faa;if(_0x468faa){if(_0x468faa[_0xd556('0x4e')]||_0x468faa[_0xd556('0x4f')]){return db[_0x468faa[_0xd556('0x4e')]?'VoiceQueue':_0xd556('0x50')][_0xd556('0x48')]({'where':{'id':_0x468faa['VoiceQueueId']?_0x468faa[_0xd556('0x4e')]:_0x468faa[_0xd556('0x4f')]},'attributes':['id',_0xd556('0x1e')],'raw':!![]});}}})[_0xd556('0x1b')](function(_0x472d25){var _0x5c774b={};if(_0x472d25){_[_0xd556('0x41')](_0x5c774b,_[_0xd556('0x51')](_0x33e2c6[_0xd556('0x52')],[_0xd556('0x53'),'updatedAt','id']));_0x5c774b[_0xd556('0x54')]=0x15;_0x5c774b[_0xd556('0x55')]=_0xd556('0x56');_0x5c774b[_0xd556('0x57')]=_0x472d25[_0xd556('0x1e')];_0x5c774b[_0xd556('0x58')]=_0x5c62f4[_0xd556('0x59')][_0xd556('0x1e')];_0x5c774b[_0xd556('0x5a')]=_0x5c62f4[_0xd556('0x59')]['id'];_0x5c774b[_0xd556('0x56')]=!![];_0x5c774b[_0xd556('0x5b')]=moment()[_0xd556('0x5c')](_0xd556('0x5d'));_0x5c774b[_0xd556('0x5e')]=_0x33e2c6[_0xd556('0x5f')];_0x5c774b['campaigntype']=_0x33e2c6['VoiceQueueId']?_0xd556('0x60'):_0xd556('0x61');return db[_0xd556('0x62')][_0xd556('0x48')]({'where':{'id':_0x5c774b['ContactId']},'attributes':['firstName',_0xd556('0x63')]})['then'](function(_0x871699){if(!_[_0xd556('0x64')](_0x1ba764)&&!_['isNil'](_0x871699[_0xd556('0x65')])){_0x5c774b[_0xd556('0x66')]=_0x871699['firstName'];if(!_[_0xd556('0x64')](_0x871699[_0xd556('0x63')])){_0x5c774b[_0xd556('0x66')]+='\x20'+_0x871699['lastName'];}}})[_0xd556('0x67')](function(){return db[_0xd556('0x68')][_0xd556('0x49')](_0x5c774b);});}})[_0xd556('0x1b')](function(){return _0x1ba764[_0xd556('0x11')](0xcc)['end']();})['catch'](handleError(_0x1ba764,null));};exports[_0xd556('0x69')]=function(_0x38afd9,_0x29cade,_0x54ceed){var _0x3d24cb=[];return db[_0xd556('0x62')][_0xd556('0x4c')]()[_0xd556('0x1b')](function(_0x2e457c){_0x3d24cb=_['keys'](_0x2e457c);return _0x38afd9['user']['getVoiceQueues']({'where':{'type':_0xd556('0x6a'),'dialActive':!![],'dialMethod':_0xd556('0x6b')},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x33726b){if(_0x33726b&&_0x33726b['length']){return db[_0xd556('0x6c')][_0xd556('0x6d')](function(_0x2ec60f){var _0x480cf3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd556('0x5c')](_0xd556('0x5d'))},'VoiceQueueId':{'$in':_['map'](_0x33726b,'id')},'$or':[{'UserId':null},{'UserId':_0x38afd9['user']['id']}]};var _0x316b0a={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x33726b)[_0xd556('0x3e')]([_0xd556('0x6e'),0x0])[_0xd556('0x20')]('id')[_0xd556('0x6f')]()},'$or':[{'UserId':null},{'UserId':_0x38afd9[_0xd556('0x59')]['id']}]};var _0xa3ce5c={'$or':[_0x480cf3,_0x316b0a]};var _0x23b101=[];if(_0x38afd9[_0xd556('0x4a')][_0xd556('0x70')]&&_0x38afd9[_0xd556('0x4a')]['direction']==='prev'){if(!_[_0xd556('0x71')](_0x38afd9[_0xd556('0x4a')][_0xd556('0x72')])){_0xa3ce5c['id']={'$in':_0x38afd9['body'][_0xd556('0x72')]};}_0x23b101=[['priority',_0xd556('0x73')],[_0xd556('0x74'),_0x33726b[0x0]['dialOrderByScheduledAt']==='ASC'?_0xd556('0x75'):'ASC'],db[_0xd556('0x6c')][_0xd556('0x76')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xd556('0x75')]];}else{if(!_[_0xd556('0x71')](_0x38afd9[_0xd556('0x4a')]['hopperIds'])){_0xa3ce5c['id']={'$notIn':_0x38afd9[_0xd556('0x4a')]['hopperIds']};}_0x23b101=[[_0xd556('0x77'),_0xd556('0x75')],[_0xd556('0x74'),_0x33726b[0x0][_0xd556('0x78')]],db[_0xd556('0x6c')][_0xd556('0x76')](_0xd556('0x79')),['id',_0xd556('0x73')]];}return db[_0xd556('0x21')][_0xd556('0x7a')]({'attributes':['id',_0xd556('0x7b'),'recallme'],'where':_0xa3ce5c,'order':_0x23b101,'transaction':_0x2ec60f,'lock':_0x2ec60f[_0xd556('0x7c')]['UPDATE'],'include':[{'model':db[_0xd556('0x62')],'as':_0xd556('0x7d'),'attributes':_0x3d24cb,'include':[{'model':db['CmCompany'],'as':_0xd556('0x7e'),'attributes':['id','name']}]},{'model':db[_0xd556('0x7f')],'as':_0xd556('0x80'),'attributes':['id','name']},{'model':db[_0xd556('0x81')],'as':_0xd556('0x82'),'attributes':['id','name',_0xd556('0x83')]}]})[_0xd556('0x1b')](function(_0x4ce463){if(_0x4ce463){return _0x4ce463[_0xd556('0x4b')]({'UserId':_0x38afd9['user']['id']},{'transaction':_0x2ec60f});}});});}})[_0xd556('0x1b')](handleEntityNotFound(_0x29cade,null))['then'](respondWithResult(_0x29cade,null))[_0xd556('0x46')](handleError(_0x29cade,null));};exports[_0xd556('0x84')]=function(_0x1697c0,_0x2a3d1e,_0x22a9f3){return _0x1697c0[_0xd556('0x59')]['getVoiceQueues']({'where':{'type':_0xd556('0x6a'),'dialActive':!![],'dialMethod':_0xd556('0x6b')},'attributes':['id'],'raw':!![]})[_0xd556('0x1b')](function(_0x50fad5){if(_0x50fad5&&_0x50fad5[_0xd556('0x3a')]){return db[_0xd556('0x21')][_0xd556('0x16')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd556('0x5c')](_0xd556('0x5d'))},'VoiceQueueId':{'$in':_['map'](_0x50fad5,'id')},'$or':[{'UserId':null},{'UserId':_0x1697c0['user']['id']}]}});}return 0x0;})[_0xd556('0x1b')](function(_0x56b4ed){if(!_[_0xd556('0x64')](_0x56b4ed)&&_[_0xd556('0x85')](_0x56b4ed)){return _0x2a3d1e[_0xd556('0x11')](0xc8)[_0xd556('0x12')]({'contacts':_0x56b4ed});}else{logger[_0xd556('0x1d')](_0xd556('0x86'),_0xd556('0x84'),0x194,_0xd556('0x87'));_0x2a3d1e[_0xd556('0x88')](0x194);}})[_0xd556('0x46')](handleError(_0x2a3d1e,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4e8e8b5..1c624a4 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 _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x43bd79,_0x248d41){_0x43bd79=_0x43bd79-0x0;var _0x4c8174=_0xc6ac[_0x43bd79];return _0x4c8174;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x324189,_0x202ac1){var _0x495eee=function(_0x4380b9){while(--_0x4380b9){_0x324189['push'](_0x324189['shift']());}};_0x495eee(++_0x202ac1);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 338ce21..504c3c3 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 _0xace5=['code','message','result','catch','GetCmHopper','findAll','options','raw','where','attributes','limit','include','model','map','ShowCmHopper','find','info','CmHopper','body','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','sequelize','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','Contact','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','http','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x15ec64,_0x5bbcf4){var _0x371e91=function(_0x251e5b){while(--_0x251e5b){_0x15ec64['push'](_0x15ec64['shift']());}};_0x371e91(++_0x5bbcf4);}(_0xace5,0x1e5));var _0x5ace=function(_0x594415,_0x53ba11){_0x594415=_0x594415-0x0;var _0x471772=_0xace5[_0x594415];return _0x471772;};'use strict';var _=require(_0x5ace('0x0'));var util=require('util');var moment=require(_0x5ace('0x1'));var BPromise=require(_0x5ace('0x2'));var rs=require(_0x5ace('0x3'));var fs=require('fs');var Redis=require(_0x5ace('0x4'));var db=require(_0x5ace('0x5'))['db'];var utils=require(_0x5ace('0x6'));var logger=require('../../config/logger')(_0x5ace('0x7'));var config=require(_0x5ace('0x8'));var jayson=require(_0x5ace('0x9'));const {validateExpressRequest}=require(_0x5ace('0xa'));var client=jayson['client'][_0x5ace('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2db07f,_0xcb479b,_0x5c998a){return new BPromise(function(_0x5b8f26,_0x1a7b77){return client['request'](_0x2db07f,_0x5c998a)[_0x5ace('0xc')](function(_0xd6a7d1){logger['info'](_0x5ace('0xd'),_0xcb479b,_0x5ace('0xe'));logger[_0x5ace('0xf')](_0x5ace('0x10'),_0xcb479b,_0x5ace('0xe'),JSON[_0x5ace('0x11')](_0xd6a7d1));if(_0xd6a7d1[_0x5ace('0x12')]){if(_0xd6a7d1['error'][_0x5ace('0x13')]===0x1f4){logger[_0x5ace('0x12')]('CmHopper,\x20%s,\x20%s',_0xcb479b,_0xd6a7d1[_0x5ace('0x12')][_0x5ace('0x14')]);return _0x1a7b77(_0xd6a7d1[_0x5ace('0x12')][_0x5ace('0x14')]);}logger[_0x5ace('0x12')](_0x5ace('0xd'),_0xcb479b,_0xd6a7d1['error']['message']);return _0x5b8f26(_0xd6a7d1[_0x5ace('0x12')][_0x5ace('0x14')]);}else{logger['info'](_0x5ace('0xd'),_0xcb479b,_0x5ace('0xe'));_0x5b8f26(_0xd6a7d1[_0x5ace('0x15')][_0x5ace('0x14')]);}})[_0x5ace('0x16')](function(_0x3e60a1){logger[_0x5ace('0x12')](_0x5ace('0xd'),_0xcb479b,_0x3e60a1);_0x1a7b77(_0x3e60a1);});});}exports[_0x5ace('0x17')]=function(_0x481ea8){var _0x300cec=this;return new Promise(function(_0x28b470,_0x71fb10){return db['CmHopper'][_0x5ace('0x18')]({'raw':_0x481ea8['options']?_0x481ea8[_0x5ace('0x19')][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'where':_0x481ea8[_0x5ace('0x19')]?_0x481ea8[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x481ea8[_0x5ace('0x19')]?_0x481ea8['options'][_0x5ace('0x1c')]||null:null,'limit':_0x481ea8[_0x5ace('0x19')]?_0x481ea8['options'][_0x5ace('0x1d')]||null:null,'include':_0x481ea8[_0x5ace('0x19')]?_0x481ea8['options'][_0x5ace('0x1e')]?_['map'](_0x481ea8[_0x5ace('0x19')][_0x5ace('0x1e')],function(_0x37d3af){return{'model':db[_0x37d3af[_0x5ace('0x1f')]],'as':_0x37d3af['as'],'attributes':_0x37d3af[_0x5ace('0x1c')],'include':_0x37d3af[_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x37d3af[_0x5ace('0x1e')],function(_0x723bb8){return{'model':db[_0x723bb8['model']],'as':_0x723bb8['as'],'attributes':_0x723bb8['attributes'],'include':_0x723bb8[_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x723bb8[_0x5ace('0x1e')],function(_0x539b62){return{'model':db[_0x539b62[_0x5ace('0x1f')]],'as':_0x539b62['as'],'attributes':_0x539b62[_0x5ace('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5ace('0xc')](function(_0x4b97cf){logger['info'](_0x5ace('0x17'),_0x481ea8);logger[_0x5ace('0xf')](_0x5ace('0x17'),_0x481ea8,JSON[_0x5ace('0x11')](_0x4b97cf));_0x28b470(_0x4b97cf);})[_0x5ace('0x16')](function(_0xbdc079){logger['error'](_0x5ace('0x17'),_0xbdc079[_0x5ace('0x14')],_0x481ea8);_0x71fb10(_0x300cec[_0x5ace('0x12')](0x1f4,_0xbdc079[_0x5ace('0x14')]));});});};exports[_0x5ace('0x21')]=function(_0x4fa158){var _0x40d20e=this;return new Promise(function(_0x5982fd,_0x230f62){return db['CmHopper'][_0x5ace('0x22')]({'raw':_0x4fa158[_0x5ace('0x19')]?_0x4fa158['options'][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'where':_0x4fa158[_0x5ace('0x19')]?_0x4fa158[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x4fa158[_0x5ace('0x19')]?_0x4fa158[_0x5ace('0x19')][_0x5ace('0x1c')]||null:null,'include':_0x4fa158[_0x5ace('0x19')]?_0x4fa158['options']['include']?_[_0x5ace('0x20')](_0x4fa158[_0x5ace('0x19')][_0x5ace('0x1e')],function(_0x43ad2d){return{'model':db[_0x43ad2d[_0x5ace('0x1f')]],'as':_0x43ad2d['as'],'attributes':_0x43ad2d[_0x5ace('0x1c')],'include':_0x43ad2d[_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x43ad2d[_0x5ace('0x1e')],function(_0x352cd8){return{'model':db[_0x352cd8[_0x5ace('0x1f')]],'as':_0x352cd8['as'],'attributes':_0x352cd8['attributes'],'include':_0x352cd8[_0x5ace('0x1e')]?_['map'](_0x352cd8[_0x5ace('0x1e')],function(_0x53fcdd){return{'model':db[_0x53fcdd[_0x5ace('0x1f')]],'as':_0x53fcdd['as'],'attributes':_0x53fcdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x39394f){logger[_0x5ace('0x23')]('ShowCmHopper',_0x4fa158);logger[_0x5ace('0xf')](_0x5ace('0x21'),_0x4fa158,JSON[_0x5ace('0x11')](_0x39394f));_0x5982fd(_0x39394f);})[_0x5ace('0x16')](function(_0x392f9c){logger['error']('ShowCmHopper',_0x392f9c[_0x5ace('0x14')],_0x4fa158);_0x230f62(_0x40d20e[_0x5ace('0x12')](0x1f4,_0x392f9c['message']));});});};exports['CreateCmHopper']=function(_0x30c116){var _0x194998=this;return new Promise(function(_0x5e0932,_0x2022d4){return db[_0x5ace('0x24')]['create'](_0x30c116[_0x5ace('0x25')],{'raw':_0x30c116[_0x5ace('0x19')]?_0x30c116[_0x5ace('0x19')][_0x5ace('0x1a')]===undefined?!![]:![]:!![]})[_0x5ace('0xc')](function(_0x184d0a){logger['info']('CreateCmHopper',_0x30c116);logger[_0x5ace('0xf')](_0x5ace('0x26'),_0x30c116,JSON['stringify'](_0x184d0a));_0x5e0932(_0x184d0a);})[_0x5ace('0x16')](function(_0xc54ae6){logger['error']('CreateCmHopper',_0xc54ae6['message'],_0x30c116);_0x2022d4(_0x194998[_0x5ace('0x12')](0x1f4,_0xc54ae6[_0x5ace('0x14')]));});});};exports[_0x5ace('0x27')]=function(_0x324ef0){var _0x3cfd9f=this;return new Promise(function(_0x326be3,_0x23df69){return db[_0x5ace('0x24')][_0x5ace('0x28')](_0x324ef0['body'],{'raw':_0x324ef0[_0x5ace('0x19')]?_0x324ef0['options'][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x324ef0['options']?_0x324ef0[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x324ef0[_0x5ace('0x19')]?_0x324ef0[_0x5ace('0x19')][_0x5ace('0x1c')]||null:null,'limit':_0x324ef0[_0x5ace('0x19')]?_0x324ef0[_0x5ace('0x19')][_0x5ace('0x1d')]||null:null})[_0x5ace('0xc')](function(_0x2694d2){logger[_0x5ace('0x23')](_0x5ace('0x27'),_0x324ef0);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x324ef0[_0x5ace('0x19')][_0x5ace('0x1b')]),_0x324ef0['body'][_0x5ace('0x29')]);logger[_0x5ace('0xf')](_0x5ace('0x27'),_0x324ef0,JSON[_0x5ace('0x11')](_0x2694d2));_0x326be3(_0x2694d2);})['catch'](function(_0x2d2d77){logger['error']('UpdateCmHopper',_0x2d2d77['message'],_0x324ef0);_0x23df69(_0x3cfd9f[_0x5ace('0x12')](0x1f4,_0x2d2d77['message']));});});};exports[_0x5ace('0x2a')]=function(_0x1f4676){var _0x3caf12=this;return new Promise(function(_0x3cc78d,_0x21acd9){return db['CmHopper']['destroy']({'where':_0x1f4676[_0x5ace('0x19')]?_0x1f4676[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null})['then'](function(_0x484b4f){logger[_0x5ace('0x23')](_0x5ace('0x2a'),_0x1f4676);logger[_0x5ace('0xf')](_0x5ace('0x2a'),_0x1f4676,JSON[_0x5ace('0x11')](_0x484b4f));_0x3cc78d(_0x484b4f);})[_0x5ace('0x16')](function(_0x46d39b){logger[_0x5ace('0x12')](_0x5ace('0x2a'),_0x46d39b[_0x5ace('0x14')],_0x1f4676);_0x21acd9(_0x3caf12[_0x5ace('0x12')](0x1f4,_0x46d39b[_0x5ace('0x14')]));});});};exports[_0x5ace('0x2b')]=function(_0x535f75){var _0x11f75a=this;return new Promise(function(_0x3a1a2d,_0x71c431){return db[_0x5ace('0x2c')][_0x5ace('0x2d')]()['then'](function(_0x17adfd){return db['sequelize'][_0x5ace('0x2e')](function(_0x4ad3ff){return db[_0x5ace('0x24')][_0x5ace('0x18')]({'where':_0x535f75[_0x5ace('0x19')]?_0x535f75[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x535f75[_0x5ace('0x19')]?_0x535f75[_0x5ace('0x19')]['attributes']||null:null,'limit':_0x535f75[_0x5ace('0x19')]?_0x535f75['options'][_0x5ace('0x1d')]||null:null,'order':_0x535f75[_0x5ace('0x19')]?_0x535f75[_0x5ace('0x19')][_0x5ace('0x2f')]||null:null,'transaction':_0x4ad3ff,'lock':_0x4ad3ff[_0x5ace('0x30')][_0x5ace('0x31')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x5ace('0x32')](_0x17adfd)},{'model':db[_0x5ace('0x33')],'as':_0x5ace('0x34'),'attributes':['id',_0x5ace('0x35'),_0x5ace('0x36')]}]})[_0x5ace('0xc')](function(_0x383d84){var _0x3b3726=[];var _0xdfec34=[];for(var _0x1abeb5=0x0;_0x1abeb5<_0x383d84['length'];_0x1abeb5+=0x1){var _0x1b69f9=_0x383d84[_0x1abeb5][_0x5ace('0x37')];if(_0x1b69f9===null){_0x3b3726[_0x5ace('0x38')](_0x383d84[_0x1abeb5]['update'](_0x535f75[_0x5ace('0x25')],{'transaction':_0x4ad3ff}));}else if(!_0xdfec34[_0x5ace('0x39')](_0x1b69f9)){_0xdfec34['push'](_0x1b69f9);_0x3b3726[_0x5ace('0x38')](_0x383d84[_0x1abeb5][_0x5ace('0x28')](_0x535f75[_0x5ace('0x25')],{'transaction':_0x4ad3ff}));}}return BPromise[_0x5ace('0x3a')](_0x3b3726);});})['then'](function(_0x155d02){logger[_0x5ace('0x23')](_0x5ace('0x2b'),_0x535f75);if(_0x155d02[_0x5ace('0x3b')]>0x0){logger['info'](_0x5ace('0x3c'),_0x155d02[0x0][_0x5ace('0x3d')]['id'],_0x155d02[0x0][_0x5ace('0x3d')]['ContactId'],_0x155d02[0x0][_0x5ace('0x3d')][_0x5ace('0x29')]);}logger[_0x5ace('0xf')](_0x5ace('0x2b'),_0x535f75,JSON[_0x5ace('0x11')](_0x155d02));_0x3a1a2d(_0x155d02);})['catch'](function(_0x5ea1e6){logger[_0x5ace('0x12')](_0x5ace('0x2b'),_0x5ea1e6[_0x5ace('0x14')],_0x535f75);_0x71c431(_0x11f75a[_0x5ace('0x12')](0x1f4,_0x5ea1e6[_0x5ace('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x5df473){var _0x11cad5=this;return new Promise(function(_0x52eba2,_0xe4293e){return db['sequelize']['transaction'](function(_0x4b9fd2){return db['CmHopperFinal'][_0x5ace('0x3e')](_0x5df473[_0x5ace('0x25')],{'raw':_0x5df473[_0x5ace('0x19')]?_0x5df473['options'][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x4b9fd2})['then'](function(){logger[_0x5ace('0x23')](_0x5ace('0x3f'),JSON[_0x5ace('0x11')](_0x5df473['options']['where']),_0x5df473[_0x5ace('0x19')][_0x5ace('0x1b')][_0x5ace('0x29')]);return db[_0x5ace('0x24')][_0x5ace('0x40')]({'where':_0x5df473[_0x5ace('0x19')]?_0x5df473[_0x5ace('0x19')]['where']||null:null,'transaction':_0x4b9fd2});});})['then'](function(_0x11cebe){logger[_0x5ace('0x23')](_0x5ace('0x41'),_0x5df473);logger[_0x5ace('0xf')]('MoveContactManagedDialer',_0x5df473,JSON[_0x5ace('0x11')](_0x11cebe));_0x52eba2(_0x11cebe);})[_0x5ace('0x16')](function(_0x2bfc50){logger[_0x5ace('0x12')](_0x5ace('0x41'),_0x2bfc50['message'],_0x5df473);_0xe4293e(_0x11cad5['error'](0x1f4,_0x2bfc50[_0x5ace('0x14')]));});});};exports[_0x5ace('0x42')]=function(_0x1f1856){var _0xd8abd4=this;return new Promise(function(_0x41e35a,_0x360fb1){return db[_0x5ace('0x24')]['findAll']({'raw':_0x1f1856[_0x5ace('0x19')]?_0x1f1856['options'][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f1856[_0x5ace('0x19')]?_0x1f1856[_0x5ace('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x5ace('0x43')]['fn']('IF',db[_0x5ace('0x43')][_0x5ace('0x44')](_0x5ace('0x45')+util[_0x5ace('0x46')](_0x5ace('0x47'),moment()[_0x5ace('0x46')](_0x5ace('0x48')))+_0x5ace('0x49')))),'contactsRescheduled']]})[_0x5ace('0xc')](function(_0x240fc6){logger['info'](_0x5ace('0x42'),_0x1f1856);logger[_0x5ace('0xf')]('CountReScheduled',_0x1f1856,JSON[_0x5ace('0x11')](_0x240fc6));_0x41e35a(_0x240fc6);})['catch'](function(_0x5377d8){logger[_0x5ace('0x12')]('CountReScheduled',_0x5377d8[_0x5ace('0x14')],_0x1f1856);_0x360fb1(_0xd8abd4[_0x5ace('0x12')](0x1f4,_0x5377d8[_0x5ace('0x14')]));});});};exports[_0x5ace('0x4a')]=function(_0x2f628d){var _0x3a46dc=this;return new Promise(function(_0x326d3e,_0x17c638){return db['CmContact']['describe']()[_0x5ace('0xc')](function(_0x59da57){return db['sequelize'][_0x5ace('0x2e')](function(_0x45d051){return db[_0x5ace('0x24')]['findAll']({'where':_0x2f628d[_0x5ace('0x19')]?_0x2f628d[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x2f628d[_0x5ace('0x19')]?_0x2f628d[_0x5ace('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x2f628d[_0x5ace('0x19')]?_0x2f628d[_0x5ace('0x19')][_0x5ace('0x2f')]||null:null,'group':db[_0x5ace('0x24')]['UserId'],'transaction':_0x45d051,'lock':_0x45d051['LOCK'][_0x5ace('0x31')],'include':_0x2f628d[_0x5ace('0x19')]?_0x2f628d['options'][_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x2f628d[_0x5ace('0x19')][_0x5ace('0x1e')],function(_0x18e5a1){return{'model':db[_0x18e5a1[_0x5ace('0x1f')]],'as':_0x18e5a1['as'],'attributes':_0x18e5a1[_0x5ace('0x1c')],'include':_0x18e5a1['include']?_[_0x5ace('0x20')](_0x18e5a1[_0x5ace('0x1e')],function(_0x181048){return{'model':db[_0x181048[_0x5ace('0x1f')]],'as':_0x181048['as'],'attributes':_0x181048['attributes'],'include':_0x181048[_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x181048[_0x5ace('0x1e')],function(_0x2bfe22){return{'model':db[_0x2bfe22['model']],'as':_0x2bfe22['as'],'attributes':_0x2bfe22[_0x5ace('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5ace('0xc')](function(_0x858819){var _0x440e12=[];for(var _0x3225f8=0x0;_0x3225f8<_0x858819[_0x5ace('0x3b')];_0x3225f8+=0x1){_0x440e12['push'](_0x858819[_0x3225f8][_0x5ace('0x28')](_0x2f628d[_0x5ace('0x25')],{'transaction':_0x45d051}));}return BPromise[_0x5ace('0x3a')](_0x440e12);});})[_0x5ace('0xc')](function(_0x2db0eb){logger[_0x5ace('0x23')](_0x5ace('0x4a'),_0x2f628d);logger[_0x5ace('0xf')](_0x5ace('0x4a'),_0x2f628d,JSON[_0x5ace('0x11')](_0x2db0eb));_0x326d3e(_0x2db0eb);})[_0x5ace('0x16')](function(_0x56ab9a){logger[_0x5ace('0x12')](_0x5ace('0x4a'),_0x56ab9a['message'],_0x2f628d);_0x17c638(_0x3a46dc[_0x5ace('0x12')](0x1f4,_0x56ab9a[_0x5ace('0x14')]));});});});};exports[_0x5ace('0x4b')]=function(_0x16118e){var _0x15fd31=this;return new Promise(function(_0x422301,_0x183ba5){db[_0x5ace('0x2c')][_0x5ace('0x2d')]()[_0x5ace('0xc')](function(_0x19c0e8){return db[_0x5ace('0x24')][_0x5ace('0x18')]({'raw':_0x16118e['options']?_0x16118e[_0x5ace('0x19')][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'where':_0x16118e[_0x5ace('0x19')]?_0x16118e['options']['where']||null:null,'attributes':_0x16118e[_0x5ace('0x19')]?_0x16118e[_0x5ace('0x19')][_0x5ace('0x1c')]||null:null,'limit':_0x16118e[_0x5ace('0x19')]?_0x16118e['options'][_0x5ace('0x1d')]||null:null,'include':_0x16118e[_0x5ace('0x19')]?_0x16118e[_0x5ace('0x19')]['include']?_[_0x5ace('0x20')](_0x16118e[_0x5ace('0x19')][_0x5ace('0x1e')],function(_0x28558d){return{'model':db[_0x28558d[_0x5ace('0x1f')]],'as':_0x28558d['as'],'attributes':_0x28558d['as']===_0x5ace('0x4c')?_[_0x5ace('0x32')](_0x19c0e8):_0x28558d[_0x5ace('0x1c')],'include':_0x28558d['include']?_['map'](_0x28558d[_0x5ace('0x1e')],function(_0x3d11a9){return{'model':db[_0x3d11a9[_0x5ace('0x1f')]],'as':_0x3d11a9['as'],'attributes':_0x3d11a9[_0x5ace('0x1c')],'include':_0x3d11a9['include']?_[_0x5ace('0x20')](_0x3d11a9[_0x5ace('0x1e')],function(_0x5c1e9a){return{'model':db[_0x5c1e9a[_0x5ace('0x1f')]],'as':_0x5c1e9a['as'],'attributes':_0x5c1e9a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ace('0xc')](function(_0x2a2044){logger[_0x5ace('0x23')](_0x5ace('0x17'),_0x16118e);logger[_0x5ace('0xf')](_0x5ace('0x17'),_0x16118e,JSON['stringify'](_0x2a2044));_0x422301(_0x2a2044);})['catch'](function(_0x355443){logger[_0x5ace('0x12')]('GetCmHopper',_0x355443['message'],_0x16118e);_0x183ba5(_0x15fd31['error'](0x1f4,_0x355443['message']));});});});};exports[_0x5ace('0x4d')]=function(_0x1ea97a){var _0x4cb05e=this;return new Promise(function(_0x277d79,_0x110a4c){return db['sequelize'][_0x5ace('0x2e')](function(_0x22e161){return db['CmHopper'][_0x5ace('0x28')]({'active':![]},{'where':{},'transaction':_0x22e161})[_0x5ace('0xc')](function(_0x4e6db2){logger[_0x5ace('0x23')](_0x5ace('0x4d'),_0x1ea97a);logger[_0x5ace('0xf')]('ResetActiveCalls',_0x1ea97a,JSON[_0x5ace('0x11')](_0x4e6db2));_0x277d79(_0x4e6db2);})[_0x5ace('0x16')](function(_0x5d3e6c){logger['error'](_0x5ace('0x4d'),_0x5d3e6c[_0x5ace('0x14')],_0x1ea97a);_0x110a4c(_0x4cb05e[_0x5ace('0x12')](0x1f4,_0x5d3e6c[_0x5ace('0x14')]));});});});};exports[_0x5ace('0x4e')]=function(_0x1f8a89){var _0x64da28=this;var _0x40a066=_0x1f8a89[_0x5ace('0x25')][_0x5ace('0x1b')][_0x5ace('0x4f')];var _0x57ab33=_0x1f8a89[_0x5ace('0x25')][_0x5ace('0x1b')]['interval'];return new Promise(function(_0x242a32,_0x1ec39c){return db['CmHopper'][_0x5ace('0x18')]({'where':{'voiceQueueId':_0x40a066,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x5ace('0x43')]['literal'](_0x5ace('0x50')+_0x57ab33+_0x5ace('0x51'))}},'include':[{'model':db['CmContact'],'as':_0x5ace('0x4c')},{'model':db[_0x5ace('0x33')],'as':_0x5ace('0x34'),'attributes':['id',_0x5ace('0x35'),_0x5ace('0x36')]},{'model':db[_0x5ace('0x52')],'as':_0x5ace('0x53')}]})[_0x5ace('0xc')](function(_0x2e9bab){return db['sequelize']['transaction'](function(_0x28fc72){return db[_0x5ace('0x24')][_0x5ace('0x28')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x40a066,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x5ace('0x43')]['literal'](_0x5ace('0x50')+_0x57ab33+_0x5ace('0x51'))}},'transaction':_0x28fc72})[_0x5ace('0xc')](function(_0x21c68e){_0x242a32(_0x2e9bab);})['catch'](function(_0x52ac32){logger['error'](_0x5ace('0x4e'),_0x52ac32[_0x5ace('0x14')],_0x1f8a89);_0x1ec39c(validateExpressRequest);});});})[_0x5ace('0x16')](function(_0x775101){logger[_0x5ace('0x12')](_0x5ace('0x4e'),_0x775101[_0x5ace('0x14')],_0x1f8a89);_0x1ec39c(_0x64da28[_0x5ace('0x12')](0x1f4,_0x775101['message']));});});}; \ No newline at end of file +var _0xe281=['model','attributes','catch','CmHopper','find','raw','where','ShowCmHopper','CreateCmHopper','create','body','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','voicePause','length','UserId','includes','push','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','all','GetCmHopperPreview','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','twilio/lib/webhooks/webhooks','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','GetCmHopper','findAll','options','limit','include','map'];(function(_0x240119,_0x4dac32){var _0x31ef9f=function(_0x3fa2c1){while(--_0x3fa2c1){_0x240119['push'](_0x240119['shift']());}};_0x31ef9f(++_0x4dac32);}(_0xe281,0x1e2));var _0x1e28=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe281[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x1e28('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1e28('0x1'));var rs=require(_0x1e28('0x2'));var fs=require('fs');var Redis=require(_0x1e28('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e28('0x4'));var logger=require(_0x1e28('0x5'))(_0x1e28('0x6'));var config=require(_0x1e28('0x7'));var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0x1e28('0x8'));var client=jayson['client'][_0x1e28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x136299,_0x3c942e,_0x206a92){return new BPromise(function(_0x12a4f2,_0x231e60){return client[_0x1e28('0xa')](_0x136299,_0x206a92)[_0x1e28('0xb')](function(_0x472a0c){logger[_0x1e28('0xc')]('CmHopper,\x20%s,\x20%s',_0x3c942e,_0x1e28('0xd'));logger[_0x1e28('0xe')](_0x1e28('0xf'),_0x3c942e,_0x1e28('0xd'),JSON[_0x1e28('0x10')](_0x472a0c));if(_0x472a0c[_0x1e28('0x11')]){if(_0x472a0c['error'][_0x1e28('0x12')]===0x1f4){logger[_0x1e28('0x11')](_0x1e28('0x13'),_0x3c942e,_0x472a0c['error'][_0x1e28('0x14')]);return _0x231e60(_0x472a0c['error'][_0x1e28('0x14')]);}logger['error'](_0x1e28('0x13'),_0x3c942e,_0x472a0c[_0x1e28('0x11')][_0x1e28('0x14')]);return _0x12a4f2(_0x472a0c[_0x1e28('0x11')][_0x1e28('0x14')]);}else{logger['info'](_0x1e28('0x13'),_0x3c942e,_0x1e28('0xd'));_0x12a4f2(_0x472a0c[_0x1e28('0x15')][_0x1e28('0x14')]);}})['catch'](function(_0x61ceb9){logger[_0x1e28('0x11')](_0x1e28('0x13'),_0x3c942e,_0x61ceb9);_0x231e60(_0x61ceb9);});});}exports[_0x1e28('0x16')]=function(_0x3bb1a7){var _0x4e6760=this;return new Promise(function(_0x3bd14a,_0x24ab56){return db['CmHopper'][_0x1e28('0x17')]({'raw':_0x3bb1a7['options']?_0x3bb1a7[_0x1e28('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3bb1a7[_0x1e28('0x18')]?_0x3bb1a7[_0x1e28('0x18')]['where']||null:null,'attributes':_0x3bb1a7[_0x1e28('0x18')]?_0x3bb1a7[_0x1e28('0x18')]['attributes']||null:null,'limit':_0x3bb1a7[_0x1e28('0x18')]?_0x3bb1a7[_0x1e28('0x18')][_0x1e28('0x19')]||null:null,'include':_0x3bb1a7[_0x1e28('0x18')]?_0x3bb1a7[_0x1e28('0x18')][_0x1e28('0x1a')]?_[_0x1e28('0x1b')](_0x3bb1a7[_0x1e28('0x18')]['include'],function(_0x12f32d){return{'model':db[_0x12f32d[_0x1e28('0x1c')]],'as':_0x12f32d['as'],'attributes':_0x12f32d[_0x1e28('0x1d')],'include':_0x12f32d['include']?_[_0x1e28('0x1b')](_0x12f32d['include'],function(_0x53d64e){return{'model':db[_0x53d64e[_0x1e28('0x1c')]],'as':_0x53d64e['as'],'attributes':_0x53d64e[_0x1e28('0x1d')],'include':_0x53d64e['include']?_[_0x1e28('0x1b')](_0x53d64e[_0x1e28('0x1a')],function(_0x40562f){return{'model':db[_0x40562f[_0x1e28('0x1c')]],'as':_0x40562f['as'],'attributes':_0x40562f['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e28('0xb')](function(_0x20b076){logger[_0x1e28('0xc')]('GetCmHopper',_0x3bb1a7);logger[_0x1e28('0xe')](_0x1e28('0x16'),_0x3bb1a7,JSON[_0x1e28('0x10')](_0x20b076));_0x3bd14a(_0x20b076);})[_0x1e28('0x1e')](function(_0x4529a1){logger[_0x1e28('0x11')](_0x1e28('0x16'),_0x4529a1[_0x1e28('0x14')],_0x3bb1a7);_0x24ab56(_0x4e6760[_0x1e28('0x11')](0x1f4,_0x4529a1[_0x1e28('0x14')]));});});};exports['ShowCmHopper']=function(_0x3ed9a7){var _0x3b9398=this;return new Promise(function(_0x457a8a,_0x1448b9){return db[_0x1e28('0x1f')][_0x1e28('0x20')]({'raw':_0x3ed9a7[_0x1e28('0x18')]?_0x3ed9a7[_0x1e28('0x18')][_0x1e28('0x21')]===undefined?!![]:![]:!![],'where':_0x3ed9a7['options']?_0x3ed9a7['options'][_0x1e28('0x22')]||null:null,'attributes':_0x3ed9a7[_0x1e28('0x18')]?_0x3ed9a7[_0x1e28('0x18')][_0x1e28('0x1d')]||null:null,'include':_0x3ed9a7[_0x1e28('0x18')]?_0x3ed9a7[_0x1e28('0x18')][_0x1e28('0x1a')]?_[_0x1e28('0x1b')](_0x3ed9a7[_0x1e28('0x18')][_0x1e28('0x1a')],function(_0x2ce9bb){return{'model':db[_0x2ce9bb[_0x1e28('0x1c')]],'as':_0x2ce9bb['as'],'attributes':_0x2ce9bb[_0x1e28('0x1d')],'include':_0x2ce9bb[_0x1e28('0x1a')]?_[_0x1e28('0x1b')](_0x2ce9bb[_0x1e28('0x1a')],function(_0x207cfb){return{'model':db[_0x207cfb['model']],'as':_0x207cfb['as'],'attributes':_0x207cfb['attributes'],'include':_0x207cfb[_0x1e28('0x1a')]?_[_0x1e28('0x1b')](_0x207cfb[_0x1e28('0x1a')],function(_0x5a4e2f){return{'model':db[_0x5a4e2f['model']],'as':_0x5a4e2f['as'],'attributes':_0x5a4e2f[_0x1e28('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1e28('0xb')](function(_0x4ba699){logger[_0x1e28('0xc')](_0x1e28('0x23'),_0x3ed9a7);logger[_0x1e28('0xe')](_0x1e28('0x23'),_0x3ed9a7,JSON[_0x1e28('0x10')](_0x4ba699));_0x457a8a(_0x4ba699);})[_0x1e28('0x1e')](function(_0x2b5967){logger[_0x1e28('0x11')]('ShowCmHopper',_0x2b5967['message'],_0x3ed9a7);_0x1448b9(_0x3b9398[_0x1e28('0x11')](0x1f4,_0x2b5967[_0x1e28('0x14')]));});});};exports[_0x1e28('0x24')]=function(_0x245ba1){var _0x56572a=this;return new Promise(function(_0x7c8c53,_0x3ce6a0){return db[_0x1e28('0x1f')][_0x1e28('0x25')](_0x245ba1[_0x1e28('0x26')],{'raw':_0x245ba1['options']?_0x245ba1[_0x1e28('0x18')][_0x1e28('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x3fa8e3){logger['info'](_0x1e28('0x24'),_0x245ba1);logger['debug'](_0x1e28('0x24'),_0x245ba1,JSON[_0x1e28('0x10')](_0x3fa8e3));_0x7c8c53(_0x3fa8e3);})[_0x1e28('0x1e')](function(_0x83c224){logger[_0x1e28('0x11')]('CreateCmHopper',_0x83c224[_0x1e28('0x14')],_0x245ba1);_0x3ce6a0(_0x56572a[_0x1e28('0x11')](0x1f4,_0x83c224[_0x1e28('0x14')]));});});};exports['UpdateCmHopper']=function(_0x3787cb){var _0x39123b=this;return new Promise(function(_0x3f6a83,_0x68a82){return db[_0x1e28('0x1f')][_0x1e28('0x27')](_0x3787cb['body'],{'raw':_0x3787cb[_0x1e28('0x18')]?_0x3787cb['options'][_0x1e28('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3787cb[_0x1e28('0x18')]?_0x3787cb[_0x1e28('0x18')][_0x1e28('0x22')]||null:null,'attributes':_0x3787cb[_0x1e28('0x18')]?_0x3787cb['options'][_0x1e28('0x1d')]||null:null,'limit':_0x3787cb[_0x1e28('0x18')]?_0x3787cb['options']['limit']||null:null})[_0x1e28('0xb')](function(_0x323e45){logger['info']('UpdateCmHopper',_0x3787cb);logger[_0x1e28('0xc')](_0x1e28('0x28'),JSON[_0x1e28('0x10')](_0x3787cb[_0x1e28('0x18')][_0x1e28('0x22')]),_0x3787cb[_0x1e28('0x26')][_0x1e28('0x29')]);logger[_0x1e28('0xe')]('UpdateCmHopper',_0x3787cb,JSON[_0x1e28('0x10')](_0x323e45));_0x3f6a83(_0x323e45);})[_0x1e28('0x1e')](function(_0x4a4a68){logger[_0x1e28('0x11')]('UpdateCmHopper',_0x4a4a68[_0x1e28('0x14')],_0x3787cb);_0x68a82(_0x39123b['error'](0x1f4,_0x4a4a68[_0x1e28('0x14')]));});});};exports[_0x1e28('0x2a')]=function(_0x287a1f){var _0x461466=this;return new Promise(function(_0x387dd7,_0x47f2e8){return db[_0x1e28('0x1f')]['destroy']({'where':_0x287a1f[_0x1e28('0x18')]?_0x287a1f[_0x1e28('0x18')][_0x1e28('0x22')]||null:null})[_0x1e28('0xb')](function(_0x5b6116){logger[_0x1e28('0xc')](_0x1e28('0x2a'),_0x287a1f);logger['debug'](_0x1e28('0x2a'),_0x287a1f,JSON[_0x1e28('0x10')](_0x5b6116));_0x387dd7(_0x5b6116);})[_0x1e28('0x1e')](function(_0x31624e){logger[_0x1e28('0x11')]('DestroyCmHopper',_0x31624e[_0x1e28('0x14')],_0x287a1f);_0x47f2e8(_0x461466['error'](0x1f4,_0x31624e[_0x1e28('0x14')]));});});};exports['GetContactDialer']=function(_0x1c0a12){var _0x7bc7ed=this;return new Promise(function(_0x15c122,_0x529004){return db[_0x1e28('0x2b')]['describe']()['then'](function(_0x1172e3){return db[_0x1e28('0x2c')][_0x1e28('0x2d')](function(_0x12d789){return db[_0x1e28('0x1f')]['findAll']({'where':_0x1c0a12[_0x1e28('0x18')]?_0x1c0a12[_0x1e28('0x18')][_0x1e28('0x22')]||null:null,'attributes':_0x1c0a12['options']?_0x1c0a12[_0x1e28('0x18')][_0x1e28('0x1d')]||null:null,'limit':_0x1c0a12[_0x1e28('0x18')]?_0x1c0a12['options'][_0x1e28('0x19')]||null:null,'order':_0x1c0a12[_0x1e28('0x18')]?_0x1c0a12[_0x1e28('0x18')][_0x1e28('0x2e')]||null:null,'transaction':_0x12d789,'lock':_0x12d789[_0x1e28('0x2f')][_0x1e28('0x30')],'include':[{'model':db[_0x1e28('0x2b')],'as':_0x1e28('0x31'),'attributes':_[_0x1e28('0x32')](_0x1172e3)},{'model':db[_0x1e28('0x33')],'as':'Agent','attributes':['id','name',_0x1e28('0x34')]}]})['then'](function(_0x422f61){var _0x416445=[];var _0x3b12cd=[];for(var _0x53f198=0x0;_0x53f198<_0x422f61[_0x1e28('0x35')];_0x53f198+=0x1){var _0x34f9ca=_0x422f61[_0x53f198][_0x1e28('0x36')];if(_0x34f9ca===null){_0x416445['push'](_0x422f61[_0x53f198]['update'](_0x1c0a12[_0x1e28('0x26')],{'transaction':_0x12d789}));}else if(!_0x3b12cd[_0x1e28('0x37')](_0x34f9ca)){_0x3b12cd[_0x1e28('0x38')](_0x34f9ca);_0x416445[_0x1e28('0x38')](_0x422f61[_0x53f198][_0x1e28('0x27')](_0x1c0a12[_0x1e28('0x26')],{'transaction':_0x12d789}));}}return BPromise['all'](_0x416445);});})[_0x1e28('0xb')](function(_0x445e84){logger[_0x1e28('0xc')](_0x1e28('0x39'),_0x1c0a12);if(_0x445e84[_0x1e28('0x35')]>0x0){logger[_0x1e28('0xc')](_0x1e28('0x3a'),_0x445e84[0x0][_0x1e28('0x3b')]['id'],_0x445e84[0x0][_0x1e28('0x3b')]['ContactId'],_0x445e84[0x0][_0x1e28('0x3b')][_0x1e28('0x29')]);}logger[_0x1e28('0xe')]('GetContactDialer',_0x1c0a12,JSON[_0x1e28('0x10')](_0x445e84));_0x15c122(_0x445e84);})[_0x1e28('0x1e')](function(_0xa144ff){logger[_0x1e28('0x11')](_0x1e28('0x39'),_0xa144ff[_0x1e28('0x14')],_0x1c0a12);_0x529004(_0x7bc7ed[_0x1e28('0x11')](0x1f4,_0xa144ff[_0x1e28('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x545f93){var _0x201539=this;return new Promise(function(_0x43af70,_0xa371d6){return db[_0x1e28('0x2c')]['transaction'](function(_0x434eef){return db[_0x1e28('0x3c')][_0x1e28('0x25')](_0x545f93[_0x1e28('0x26')],{'raw':_0x545f93[_0x1e28('0x18')]?_0x545f93[_0x1e28('0x18')][_0x1e28('0x21')]===undefined?!![]:![]:!![],'transaction':_0x434eef})['then'](function(){logger[_0x1e28('0xc')](_0x1e28('0x3d'),JSON[_0x1e28('0x10')](_0x545f93[_0x1e28('0x18')][_0x1e28('0x22')]),_0x545f93[_0x1e28('0x18')][_0x1e28('0x22')][_0x1e28('0x29')]);return db[_0x1e28('0x1f')][_0x1e28('0x3e')]({'where':_0x545f93[_0x1e28('0x18')]?_0x545f93[_0x1e28('0x18')][_0x1e28('0x22')]||null:null,'transaction':_0x434eef});});})[_0x1e28('0xb')](function(_0x1ecf27){logger[_0x1e28('0xc')](_0x1e28('0x3f'),_0x545f93);logger[_0x1e28('0xe')]('MoveContactManagedDialer',_0x545f93,JSON[_0x1e28('0x10')](_0x1ecf27));_0x43af70(_0x1ecf27);})[_0x1e28('0x1e')](function(_0x292cc7){logger[_0x1e28('0x11')](_0x1e28('0x3f'),_0x292cc7[_0x1e28('0x14')],_0x545f93);_0xa371d6(_0x201539[_0x1e28('0x11')](0x1f4,_0x292cc7['message']));});});};exports[_0x1e28('0x40')]=function(_0x17bc16){var _0x24bf61=this;return new Promise(function(_0x9dc5c8,_0x100ac2){return db[_0x1e28('0x1f')]['findAll']({'raw':_0x17bc16[_0x1e28('0x18')]?_0x17bc16[_0x1e28('0x18')][_0x1e28('0x21')]===undefined?!![]:![]:!![],'where':_0x17bc16[_0x1e28('0x18')]?_0x17bc16[_0x1e28('0x18')][_0x1e28('0x22')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1e28('0x41'),db['sequelize']['fn']('IF',db[_0x1e28('0x2c')]['literal'](_0x1e28('0x42')+util[_0x1e28('0x43')](_0x1e28('0x44'),moment()[_0x1e28('0x43')](_0x1e28('0x45')))+_0x1e28('0x46')))),_0x1e28('0x47')]]})[_0x1e28('0xb')](function(_0x5ad8dd){logger[_0x1e28('0xc')]('CountReScheduled',_0x17bc16);logger[_0x1e28('0xe')](_0x1e28('0x40'),_0x17bc16,JSON[_0x1e28('0x10')](_0x5ad8dd));_0x9dc5c8(_0x5ad8dd);})['catch'](function(_0xb8885c){logger['error'](_0x1e28('0x40'),_0xb8885c[_0x1e28('0x14')],_0x17bc16);_0x100ac2(_0x24bf61['error'](0x1f4,_0xb8885c[_0x1e28('0x14')]));});});};exports[_0x1e28('0x48')]=function(_0x8f55a9){var _0xfcf382=this;return new Promise(function(_0x506cfb,_0xfa9718){return db[_0x1e28('0x2b')][_0x1e28('0x49')]()[_0x1e28('0xb')](function(_0x66fbb5){return db[_0x1e28('0x2c')][_0x1e28('0x2d')](function(_0x5a1b32){return db[_0x1e28('0x1f')]['findAll']({'where':_0x8f55a9[_0x1e28('0x18')]?_0x8f55a9[_0x1e28('0x18')][_0x1e28('0x22')]||null:null,'attributes':_0x8f55a9[_0x1e28('0x18')]?_0x8f55a9[_0x1e28('0x18')][_0x1e28('0x1d')]||null:null,'limit':0x1,'order':_0x8f55a9[_0x1e28('0x18')]?_0x8f55a9[_0x1e28('0x18')]['order']||null:null,'group':db[_0x1e28('0x1f')][_0x1e28('0x36')],'transaction':_0x5a1b32,'lock':_0x5a1b32[_0x1e28('0x2f')]['UPDATE'],'include':_0x8f55a9[_0x1e28('0x18')]?_0x8f55a9[_0x1e28('0x18')][_0x1e28('0x1a')]?_[_0x1e28('0x1b')](_0x8f55a9[_0x1e28('0x18')]['include'],function(_0x16d8e0){return{'model':db[_0x16d8e0[_0x1e28('0x1c')]],'as':_0x16d8e0['as'],'attributes':_0x16d8e0['attributes'],'include':_0x16d8e0[_0x1e28('0x1a')]?_['map'](_0x16d8e0[_0x1e28('0x1a')],function(_0x41421e){return{'model':db[_0x41421e['model']],'as':_0x41421e['as'],'attributes':_0x41421e['attributes'],'include':_0x41421e['include']?_[_0x1e28('0x1b')](_0x41421e[_0x1e28('0x1a')],function(_0x2d494b){return{'model':db[_0x2d494b[_0x1e28('0x1c')]],'as':_0x2d494b['as'],'attributes':_0x2d494b[_0x1e28('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18190a){var _0x58d970=[];for(var _0x22324c=0x0;_0x22324c<_0x18190a[_0x1e28('0x35')];_0x22324c+=0x1){_0x58d970[_0x1e28('0x38')](_0x18190a[_0x22324c][_0x1e28('0x27')](_0x8f55a9[_0x1e28('0x26')],{'transaction':_0x5a1b32}));}return BPromise[_0x1e28('0x4a')](_0x58d970);});})['then'](function(_0x1c84b5){logger[_0x1e28('0xc')](_0x1e28('0x48'),_0x8f55a9);logger['debug'](_0x1e28('0x48'),_0x8f55a9,JSON['stringify'](_0x1c84b5));_0x506cfb(_0x1c84b5);})[_0x1e28('0x1e')](function(_0x43226d){logger[_0x1e28('0x11')](_0x1e28('0x48'),_0x43226d[_0x1e28('0x14')],_0x8f55a9);_0xfa9718(_0xfcf382['error'](0x1f4,_0x43226d[_0x1e28('0x14')]));});});});};exports[_0x1e28('0x4b')]=function(_0x5a9477){var _0x429100=this;return new Promise(function(_0x57a9d1,_0x277d55){db[_0x1e28('0x2b')][_0x1e28('0x49')]()[_0x1e28('0xb')](function(_0x9eecc5){return db[_0x1e28('0x1f')][_0x1e28('0x17')]({'raw':_0x5a9477[_0x1e28('0x18')]?_0x5a9477[_0x1e28('0x18')][_0x1e28('0x21')]===undefined?!![]:![]:!![],'where':_0x5a9477[_0x1e28('0x18')]?_0x5a9477[_0x1e28('0x18')][_0x1e28('0x22')]||null:null,'attributes':_0x5a9477[_0x1e28('0x18')]?_0x5a9477[_0x1e28('0x18')]['attributes']||null:null,'limit':_0x5a9477['options']?_0x5a9477['options'][_0x1e28('0x19')]||null:null,'include':_0x5a9477['options']?_0x5a9477['options'][_0x1e28('0x1a')]?_['map'](_0x5a9477[_0x1e28('0x18')][_0x1e28('0x1a')],function(_0x34d989){return{'model':db[_0x34d989[_0x1e28('0x1c')]],'as':_0x34d989['as'],'attributes':_0x34d989['as']===_0x1e28('0x31')?_['keys'](_0x9eecc5):_0x34d989[_0x1e28('0x1d')],'include':_0x34d989[_0x1e28('0x1a')]?_[_0x1e28('0x1b')](_0x34d989[_0x1e28('0x1a')],function(_0x40905c){return{'model':db[_0x40905c['model']],'as':_0x40905c['as'],'attributes':_0x40905c['attributes'],'include':_0x40905c['include']?_['map'](_0x40905c[_0x1e28('0x1a')],function(_0xa9aa54){return{'model':db[_0xa9aa54[_0x1e28('0x1c')]],'as':_0xa9aa54['as'],'attributes':_0xa9aa54[_0x1e28('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1e28('0xb')](function(_0x445886){logger[_0x1e28('0xc')]('GetCmHopper',_0x5a9477);logger[_0x1e28('0xe')]('GetCmHopper',_0x5a9477,JSON['stringify'](_0x445886));_0x57a9d1(_0x445886);})[_0x1e28('0x1e')](function(_0x3403e0){logger['error'](_0x1e28('0x16'),_0x3403e0[_0x1e28('0x14')],_0x5a9477);_0x277d55(_0x429100[_0x1e28('0x11')](0x1f4,_0x3403e0[_0x1e28('0x14')]));});});});};exports[_0x1e28('0x4c')]=function(_0x3b024d){var _0x492424=this;return new Promise(function(_0x1e4e8d,_0x4f68d6){return db[_0x1e28('0x2c')][_0x1e28('0x2d')](function(_0x4c40a6){return db[_0x1e28('0x1f')][_0x1e28('0x27')]({'active':![]},{'where':{},'transaction':_0x4c40a6})[_0x1e28('0xb')](function(_0x295b0b){logger[_0x1e28('0xc')](_0x1e28('0x4c'),_0x3b024d);logger[_0x1e28('0xe')](_0x1e28('0x4c'),_0x3b024d,JSON[_0x1e28('0x10')](_0x295b0b));_0x1e4e8d(_0x295b0b);})['catch'](function(_0x14daae){logger[_0x1e28('0x11')](_0x1e28('0x4c'),_0x14daae[_0x1e28('0x14')],_0x3b024d);_0x4f68d6(_0x492424[_0x1e28('0x11')](0x1f4,_0x14daae[_0x1e28('0x14')]));});});});};exports[_0x1e28('0x4d')]=function(_0x48963f){var _0x49404d=this;var _0x33cd0e=_0x48963f[_0x1e28('0x26')][_0x1e28('0x22')][_0x1e28('0x4e')];var _0x2d6e0a=_0x48963f[_0x1e28('0x26')][_0x1e28('0x22')][_0x1e28('0x4f')];return new Promise(function(_0x3ab1f1,_0x18900d){return db[_0x1e28('0x1f')][_0x1e28('0x17')]({'where':{'voiceQueueId':_0x33cd0e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x1e28('0x2c')][_0x1e28('0x50')](_0x1e28('0x51')+_0x2d6e0a+_0x1e28('0x52'))}},'include':[{'model':db['CmContact'],'as':_0x1e28('0x31')},{'model':db['User'],'as':'Agent','attributes':['id','name',_0x1e28('0x34')]},{'model':db[_0x1e28('0x53')],'as':_0x1e28('0x54')}]})[_0x1e28('0xb')](function(_0x47fd8e){return db[_0x1e28('0x2c')][_0x1e28('0x2d')](function(_0x5b2e7b){return db[_0x1e28('0x1f')]['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x33cd0e,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x1e28('0x2c')][_0x1e28('0x50')](_0x1e28('0x51')+_0x2d6e0a+_0x1e28('0x52'))}},'transaction':_0x5b2e7b})['then'](function(_0x37519a){_0x3ab1f1(_0x47fd8e);})[_0x1e28('0x1e')](function(_0x476748){logger[_0x1e28('0x11')](_0x1e28('0x4d'),_0x476748[_0x1e28('0x14')],_0x48963f);_0x18900d(validateExpressRequest);});});})['catch'](function(_0xbf0277){logger[_0x1e28('0x11')]('CmHopperHandlePreviewRecallNotifications',_0xbf0277[_0x1e28('0x14')],_0x48963f);_0x18900d(_0x49404d[_0x1e28('0x11')](0x1f4,_0xbf0277[_0x1e28('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 7e99d8b..ffd9a4a 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 _0x3468=['/preview','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','get','/describe','/opencontacts','/:id','show','post','create'];(function(_0xb89c20,_0x427d28){var _0x1df11e=function(_0x367133){while(--_0x367133){_0xb89c20['push'](_0xb89c20['shift']());}};_0x1df11e(++_0x427d28);}(_0x3468,0xb6));var _0x8346=function(_0x4a18f4,_0x17220e){_0x4a18f4=_0x4a18f4-0x0;var _0x383f64=_0x3468[_0x4a18f4];return _0x383f64;};'use strict';var multer=require(_0x8346('0x0'));var util=require(_0x8346('0x1'));var path=require(_0x8346('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8346('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8346('0x4'));var interaction=require(_0x8346('0x5'));var config=require(_0x8346('0x6'));var controller=require(_0x8346('0x7'));router['get']('/',auth[_0x8346('0x8')](),controller['index']);router[_0x8346('0x9')](_0x8346('0xa'),auth[_0x8346('0x8')](),controller['describe']);router['get'](_0x8346('0xb'),auth[_0x8346('0x8')](),controller['getOpenContacts']);router[_0x8346('0x9')](_0x8346('0xc'),auth[_0x8346('0x8')](),controller[_0x8346('0xd')]);router[_0x8346('0xe')]('/',auth[_0x8346('0x8')](),controller[_0x8346('0xf')]);router[_0x8346('0xe')](_0x8346('0x10'),auth[_0x8346('0x8')](),controller['getPreview']);router[_0x8346('0x11')](_0x8346('0xc'),auth[_0x8346('0x8')](),controller[_0x8346('0x12')]);router[_0x8346('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8346('0x14')]);module[_0x8346('0x15')]=router; \ No newline at end of file +var _0x6844=['delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','isAuthenticated','describe','/:id','show','post','create','getPreview','put','update'];(function(_0x5bdabd,_0x1c500b){var _0x2e774b=function(_0x2d8c38){while(--_0x2d8c38){_0x5bdabd['push'](_0x5bdabd['shift']());}};_0x2e774b(++_0x1c500b);}(_0x6844,0x153));var _0x4684=function(_0x16bea6,_0x1a488a){_0x16bea6=_0x16bea6-0x0;var _0x169899=_0x6844[_0x16bea6];return _0x169899;};'use strict';var multer=require('multer');var util=require(_0x4684('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4684('0x1'));var router=express['Router']();var fs_extra=require(_0x4684('0x2'));var auth=require(_0x4684('0x3'));var interaction=require(_0x4684('0x4'));var config=require(_0x4684('0x5'));var controller=require(_0x4684('0x6'));router[_0x4684('0x7')]('/',auth['isAuthenticated'](),controller[_0x4684('0x8')]);router[_0x4684('0x7')]('/describe',auth[_0x4684('0x9')](),controller[_0x4684('0xa')]);router[_0x4684('0x7')]('/opencontacts',auth[_0x4684('0x9')](),controller['getOpenContacts']);router[_0x4684('0x7')](_0x4684('0xb'),auth[_0x4684('0x9')](),controller[_0x4684('0xc')]);router[_0x4684('0xd')]('/',auth['isAuthenticated'](),controller[_0x4684('0xe')]);router[_0x4684('0xd')]('/preview',auth[_0x4684('0x9')](),controller[_0x4684('0xf')]);router[_0x4684('0x10')](_0x4684('0xb'),auth['isAuthenticated'](),controller[_0x4684('0x11')]);router[_0x4684('0x12')](_0x4684('0xb'),auth[_0x4684('0x9')](),controller[_0x4684('0x13')]);module[_0x4684('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index de386ef..73ddcb1 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 _0xef2a=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x4f3cb2,_0x31b881){var _0x57f275=function(_0x4c7cca){while(--_0x4c7cca){_0x4f3cb2['push'](_0x4f3cb2['shift']());}};_0x57f275(++_0x31b881);}(_0xef2a,0x1a0));var _0xaef2=function(_0x5e3148,_0x44f5dd){_0x5e3148=_0x5e3148-0x0;var _0x31e5b6=_0xef2a[_0x5e3148];return _0x31e5b6;};'use strict';var moment=require(_0xaef2('0x0'));var Sequelize=require(_0xaef2('0x1'));module[_0xaef2('0x2')]={'phone':{'type':Sequelize[_0xaef2('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xaef2('0x4')],'unique':_0xaef2('0x5')},'ListId':{'type':Sequelize[_0xaef2('0x4')],'unique':_0xaef2('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xaef2('0x5')}}; \ No newline at end of file +var _0xa23f=['moment','sequelize','INTEGER','contactListQueue'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xa23f,0x7c));var _0xfa23=function(_0x3535d7,_0x25fda9){_0x3535d7=_0x3535d7-0x0;var _0x360184=_0xa23f[_0x3535d7];return _0x360184;};'use strict';var moment=require(_0xfa23('0x0'));var Sequelize=require(_0xfa23('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xfa23('0x2')],'unique':_0xfa23('0x3')},'ListId':{'type':Sequelize[_0xfa23('0x2')],'unique':_0xfa23('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xfa23('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2819608..c1370b6 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 _0xfba9=['include','findAll','rows','show','params','find','body','catch','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfba9,0x9b));var _0x9fba=function(_0x4715b7,_0x4dedec){_0x4715b7=_0x4715b7-0x0;var _0x11d72a=_0xfba9[_0x4715b7];return _0x11d72a;};'use strict';var emlformat=require(_0x9fba('0x0'));var rimraf=require(_0x9fba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fba('0x2'));var rp=require('request-promise');var moment=require(_0x9fba('0x3'));var BPromise=require(_0x9fba('0x4'));var Mustache=require(_0x9fba('0x5'));var util=require('util');var path=require(_0x9fba('0x6'));var sox=require(_0x9fba('0x7'));var csv=require('to-csv');var ejs=require(_0x9fba('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fba('0x9'));var squel=require(_0x9fba('0xa'));var crypto=require(_0x9fba('0xb'));var jsforce=require(_0x9fba('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9fba('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9fba('0xe'));var qs=require(_0x9fba('0xf'));var as=require(_0x9fba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fba('0x11'))(_0x9fba('0x12'));var utils=require(_0x9fba('0x13'));var config=require(_0x9fba('0x14'));var licenseUtil=require(_0x9fba('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x554900,_0x48f72b){_0x48f72b=_0x48f72b||0xcc;return function(_0x13d5fe){if(_0x13d5fe){return _0x554900[_0x9fba('0x16')](_0x48f72b);}return _0x554900[_0x9fba('0x17')](_0x48f72b)['end']();};}function respondWithResult(_0x31c3c8,_0x567d98){_0x567d98=_0x567d98||0xc8;return function(_0x385e35){if(_0x385e35){return _0x31c3c8[_0x9fba('0x17')](_0x567d98)[_0x9fba('0x18')](_0x385e35);}};}function respondWithFilteredResult(_0x1de69d,_0x56507e){return function(_0x3196d2){if(_0x3196d2){var _0x38da4c=typeof _0x56507e[_0x9fba('0x19')]===_0x9fba('0x1a')&&typeof _0x56507e[_0x9fba('0x1b')]===_0x9fba('0x1a');var _0x556715=_0x3196d2[_0x9fba('0x1c')];var _0x547b1e=_0x38da4c?0x0:_0x56507e[_0x9fba('0x19')];var _0x71934f=_0x38da4c?_0x3196d2['count']:_0x56507e[_0x9fba('0x19')]+_0x56507e[_0x9fba('0x1b')];var _0x198b9e;if(_0x71934f>=_0x556715){_0x71934f=_0x556715;_0x198b9e=0xc8;}else{_0x198b9e=0xce;}_0x1de69d['status'](_0x198b9e);return _0x1de69d[_0x9fba('0x1d')]('Content-Range',_0x547b1e+'-'+_0x71934f+'/'+_0x556715)[_0x9fba('0x18')](_0x3196d2);}return null;};}function patchUpdates(_0x5c3b77){return function(_0x1cd1c2){try{jsonpatch[_0x9fba('0x1e')](_0x1cd1c2,_0x5c3b77,!![]);}catch(_0x36a234){return BPromise[_0x9fba('0x1f')](_0x36a234);}return _0x1cd1c2[_0x9fba('0x20')]();};}function saveUpdates(_0x5e90f5,_0x117579){return function(_0x2fe52b){if(_0x2fe52b){return _0x2fe52b[_0x9fba('0x21')](_0x5e90f5)[_0x9fba('0x22')](function(_0x335242){return _0x335242;});}return null;};}function removeEntity(_0x2776f8,_0x5a7acd){return function(_0x4f33e8){if(_0x4f33e8){return _0x4f33e8[_0x9fba('0x23')]()[_0x9fba('0x22')](function(){_0x2776f8[_0x9fba('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe59943,_0x116a49){return function(_0x37ff8b){if(!_0x37ff8b){_0xe59943['sendStatus'](0x194);}return _0x37ff8b;};}function handleError(_0x4e5c55,_0x4a7a6d){_0x4a7a6d=_0x4a7a6d||0x1f4;return function(_0x237033){logger['error'](_0x237033['stack']);if(_0x237033[_0x9fba('0x24')]){delete _0x237033[_0x9fba('0x24')];}_0x4e5c55[_0x9fba('0x17')](_0x4a7a6d)[_0x9fba('0x25')](_0x237033);};}exports[_0x9fba('0x26')]=function(_0x200eea,_0x21fd21){var _0x2eb9dc={},_0x48f96c={},_0x21acc8={'count':0x0,'rows':[]};var _0x55dd6c=_[_0x9fba('0x27')](db[_0x9fba('0x28')][_0x9fba('0x29')],function(_0x5967b3){return{'name':_0x5967b3[_0x9fba('0x2a')],'type':_0x5967b3[_0x9fba('0x2b')][_0x9fba('0x2c')]};});_0x48f96c[_0x9fba('0x2d')]=_['map'](_0x55dd6c,_0x9fba('0x24'));_0x48f96c[_0x9fba('0x2e')]=_[_0x9fba('0x2f')](_0x200eea[_0x9fba('0x2e')]);_0x48f96c[_0x9fba('0x30')]=_[_0x9fba('0x31')](_0x48f96c[_0x9fba('0x2d')],_0x48f96c[_0x9fba('0x2e')]);_0x2eb9dc[_0x9fba('0x32')]=_['intersection'](_0x48f96c[_0x9fba('0x2d')],qs[_0x9fba('0x33')](_0x200eea[_0x9fba('0x2e')]['fields']));_0x2eb9dc[_0x9fba('0x32')]=_0x2eb9dc[_0x9fba('0x32')][_0x9fba('0x34')]?_0x2eb9dc[_0x9fba('0x32')]:_0x48f96c[_0x9fba('0x2d')];if(!_0x200eea[_0x9fba('0x2e')][_0x9fba('0x35')](_0x9fba('0x36'))){_0x2eb9dc[_0x9fba('0x1b')]=qs[_0x9fba('0x1b')](_0x200eea[_0x9fba('0x2e')][_0x9fba('0x1b')]);_0x2eb9dc[_0x9fba('0x19')]=qs[_0x9fba('0x19')](_0x200eea['query'][_0x9fba('0x19')]);}_0x2eb9dc[_0x9fba('0x37')]=qs[_0x9fba('0x38')](_0x200eea[_0x9fba('0x2e')]['sort']);_0x2eb9dc['where']=qs[_0x9fba('0x30')](_[_0x9fba('0x39')](_0x200eea[_0x9fba('0x2e')],_0x48f96c['filters']),_0x55dd6c);if(_0x200eea[_0x9fba('0x2e')][_0x9fba('0x3a')]){_0x2eb9dc[_0x9fba('0x3b')]=_[_0x9fba('0x3c')](_0x2eb9dc['where'],{'$or':_['map'](_0x55dd6c,function(_0x1fb3eb){if(_0x1fb3eb[_0x9fba('0x2b')]!==_0x9fba('0x3d')){var _0x20dd9f={};_0x20dd9f[_0x1fb3eb['name']]={'$like':'%'+_0x200eea[_0x9fba('0x2e')][_0x9fba('0x3a')]+'%'};return _0x20dd9f;}})});}_0x2eb9dc=_['merge']({},_0x2eb9dc,_0x200eea[_0x9fba('0x3e')]);var _0x58c8b5={'where':_0x2eb9dc[_0x9fba('0x3b')]};return db[_0x9fba('0x28')][_0x9fba('0x1c')](_0x58c8b5)[_0x9fba('0x22')](function(_0x21bca9){_0x21acc8[_0x9fba('0x1c')]=_0x21bca9;if(_0x200eea[_0x9fba('0x2e')][_0x9fba('0x3f')]){_0x2eb9dc[_0x9fba('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9fba('0x41')](_0x2eb9dc);})['then'](function(_0x5b1906){_0x21acc8[_0x9fba('0x42')]=_0x5b1906;return _0x21acc8;})[_0x9fba('0x22')](respondWithFilteredResult(_0x21fd21,_0x2eb9dc))['catch'](handleError(_0x21fd21,null));};exports[_0x9fba('0x43')]=function(_0x48f7f4,_0x30f1ce){var _0xc7078a={'raw':!![],'where':{'id':_0x48f7f4[_0x9fba('0x44')]['id']}},_0x42377a={};_0x42377a['model']=_[_0x9fba('0x2f')](db[_0x9fba('0x28')]['rawAttributes']);_0x42377a['query']=_[_0x9fba('0x2f')](_0x48f7f4[_0x9fba('0x2e')]);_0x42377a[_0x9fba('0x30')]=_['intersection'](_0x42377a[_0x9fba('0x2d')],_0x42377a['query']);_0xc7078a[_0x9fba('0x32')]=_[_0x9fba('0x31')](_0x42377a['model'],qs[_0x9fba('0x33')](_0x48f7f4['query']['fields']));_0xc7078a[_0x9fba('0x32')]=_0xc7078a[_0x9fba('0x32')][_0x9fba('0x34')]?_0xc7078a[_0x9fba('0x32')]:_0x42377a[_0x9fba('0x2d')];if(_0x48f7f4['query'][_0x9fba('0x3f')]){_0xc7078a[_0x9fba('0x40')]=[{'all':!![]}];}_0xc7078a=_[_0x9fba('0x3c')]({},_0xc7078a,_0x48f7f4[_0x9fba('0x3e')]);return db[_0x9fba('0x28')][_0x9fba('0x45')](_0xc7078a)['then'](handleEntityNotFound(_0x30f1ce,null))[_0x9fba('0x22')](respondWithResult(_0x30f1ce,null))['catch'](handleError(_0x30f1ce,null));};exports[_0x9fba('0x21')]=function(_0x4820d5,_0x2eaea7){if(_0x4820d5['body']['id']){delete _0x4820d5[_0x9fba('0x46')]['id'];}return db[_0x9fba('0x28')]['find']({'where':{'id':_0x4820d5[_0x9fba('0x44')]['id']}})['then'](handleEntityNotFound(_0x2eaea7,null))[_0x9fba('0x22')](saveUpdates(_0x4820d5[_0x9fba('0x46')],null))['then'](respondWithResult(_0x2eaea7,null))[_0x9fba('0x47')](handleError(_0x2eaea7,null));};exports[_0x9fba('0x23')]=function(_0x33257c,_0xc19fdf){return db[_0x9fba('0x28')][_0x9fba('0x45')]({'where':{'id':_0x33257c['params']['id']}})[_0x9fba('0x22')](handleEntityNotFound(_0xc19fdf,null))[_0x9fba('0x22')](removeEntity(_0xc19fdf,null))[_0x9fba('0x47')](handleError(_0xc19fdf,null));};exports['describe']=function(_0x3546a7,_0x454f8a){return db[_0x9fba('0x28')][_0x9fba('0x48')]()[_0x9fba('0x22')](respondWithResult(_0x454f8a,null))['catch'](handleError(_0x454f8a,null));}; \ No newline at end of file +var _0x45c2=['reject','save','update','destroy','then','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','offset','undefined','limit','count','json','apply'];(function(_0xe5ba16,_0x1f1b5d){var _0x161b12=function(_0x33da95){while(--_0x33da95){_0xe5ba16['push'](_0xe5ba16['shift']());}};_0x161b12(++_0x1f1b5d);}(_0x45c2,0x1af));var _0x245c=function(_0x3eff47,_0x2796a1){_0x3eff47=_0x3eff47-0x0;var _0x8c1be2=_0x45c2[_0x3eff47];return _0x8c1be2;};'use strict';var emlformat=require(_0x245c('0x0'));var rimraf=require(_0x245c('0x1'));var zipdir=require(_0x245c('0x2'));var jsonpatch=require(_0x245c('0x3'));var rp=require(_0x245c('0x4'));var moment=require('moment');var BPromise=require(_0x245c('0x5'));var Mustache=require(_0x245c('0x6'));var util=require(_0x245c('0x7'));var path=require('path');var sox=require(_0x245c('0x8'));var csv=require(_0x245c('0x9'));var ejs=require(_0x245c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x245c('0xb'));var squel=require(_0x245c('0xc'));var crypto=require(_0x245c('0xd'));var jsforce=require(_0x245c('0xe'));var deskjs=require(_0x245c('0xf'));var toCsv=require(_0x245c('0x9'));var querystring=require(_0x245c('0x10'));var Papa=require(_0x245c('0x11'));var Redis=require(_0x245c('0x12'));var authService=require(_0x245c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x245c('0x14'));var hardwareService=require(_0x245c('0x15'));var logger=require(_0x245c('0x16'))(_0x245c('0x17'));var utils=require(_0x245c('0x18'));var config=require(_0x245c('0x19'));var licenseUtil=require(_0x245c('0x1a'));var db=require(_0x245c('0x1b'))['db'];function respondWithStatusCode(_0x388a8b,_0x1e8893){_0x1e8893=_0x1e8893||0xcc;return function(_0x52d037){if(_0x52d037){return _0x388a8b[_0x245c('0x1c')](_0x1e8893);}return _0x388a8b[_0x245c('0x1d')](_0x1e8893)[_0x245c('0x1e')]();};}function respondWithResult(_0x3bf284,_0x5e7463){_0x5e7463=_0x5e7463||0xc8;return function(_0x2333f4){if(_0x2333f4){return _0x3bf284[_0x245c('0x1d')](_0x5e7463)['json'](_0x2333f4);}};}function respondWithFilteredResult(_0x3d323b,_0x31cde6){return function(_0x5058e4){if(_0x5058e4){var _0x502027=typeof _0x31cde6[_0x245c('0x1f')]===_0x245c('0x20')&&typeof _0x31cde6[_0x245c('0x21')]==='undefined';var _0xc92c3e=_0x5058e4[_0x245c('0x22')];var _0x515b09=_0x502027?0x0:_0x31cde6['offset'];var _0x1027dd=_0x502027?_0x5058e4[_0x245c('0x22')]:_0x31cde6[_0x245c('0x1f')]+_0x31cde6['limit'];var _0x49abcb;if(_0x1027dd>=_0xc92c3e){_0x1027dd=_0xc92c3e;_0x49abcb=0xc8;}else{_0x49abcb=0xce;}_0x3d323b[_0x245c('0x1d')](_0x49abcb);return _0x3d323b['set']('Content-Range',_0x515b09+'-'+_0x1027dd+'/'+_0xc92c3e)[_0x245c('0x23')](_0x5058e4);}return null;};}function patchUpdates(_0x449a4c){return function(_0x45994d){try{jsonpatch[_0x245c('0x24')](_0x45994d,_0x449a4c,!![]);}catch(_0x2d4dc){return BPromise[_0x245c('0x25')](_0x2d4dc);}return _0x45994d[_0x245c('0x26')]();};}function saveUpdates(_0x4e2a9f,_0x3040aa){return function(_0x1aa10e){if(_0x1aa10e){return _0x1aa10e[_0x245c('0x27')](_0x4e2a9f)['then'](function(_0xeb31a0){return _0xeb31a0;});}return null;};}function removeEntity(_0x1e75ab,_0x3fa73b){return function(_0x482bd1){if(_0x482bd1){return _0x482bd1[_0x245c('0x28')]()[_0x245c('0x29')](function(){_0x1e75ab[_0x245c('0x1d')](0xcc)[_0x245c('0x1e')]();});}};}function handleEntityNotFound(_0x3bc157,_0x57c2d3){return function(_0x316fdb){if(!_0x316fdb){_0x3bc157[_0x245c('0x1c')](0x194);}return _0x316fdb;};}function handleError(_0x17febe,_0x1191c5){_0x1191c5=_0x1191c5||0x1f4;return function(_0x1658fc){logger[_0x245c('0x2a')](_0x1658fc[_0x245c('0x2b')]);if(_0x1658fc[_0x245c('0x2c')]){delete _0x1658fc[_0x245c('0x2c')];}_0x17febe[_0x245c('0x1d')](_0x1191c5)['send'](_0x1658fc);};}exports[_0x245c('0x2d')]=function(_0x21c0d7,_0x483d1e){var _0x4ad753={},_0x3bdb4e={},_0x2daf79={'count':0x0,'rows':[]};var _0x505f04=_[_0x245c('0x2e')](db[_0x245c('0x2f')][_0x245c('0x30')],function(_0x598c25){return{'name':_0x598c25[_0x245c('0x31')],'type':_0x598c25[_0x245c('0x32')][_0x245c('0x33')]};});_0x3bdb4e[_0x245c('0x34')]=_['map'](_0x505f04,_0x245c('0x2c'));_0x3bdb4e['query']=_[_0x245c('0x35')](_0x21c0d7['query']);_0x3bdb4e[_0x245c('0x36')]=_[_0x245c('0x37')](_0x3bdb4e[_0x245c('0x34')],_0x3bdb4e[_0x245c('0x38')]);_0x4ad753['attributes']=_[_0x245c('0x37')](_0x3bdb4e[_0x245c('0x34')],qs['fields'](_0x21c0d7[_0x245c('0x38')][_0x245c('0x39')]));_0x4ad753[_0x245c('0x3a')]=_0x4ad753[_0x245c('0x3a')][_0x245c('0x3b')]?_0x4ad753['attributes']:_0x3bdb4e['model'];if(!_0x21c0d7['query'][_0x245c('0x3c')](_0x245c('0x3d'))){_0x4ad753[_0x245c('0x21')]=qs[_0x245c('0x21')](_0x21c0d7[_0x245c('0x38')]['limit']);_0x4ad753[_0x245c('0x1f')]=qs[_0x245c('0x1f')](_0x21c0d7[_0x245c('0x38')]['offset']);}_0x4ad753[_0x245c('0x3e')]=qs[_0x245c('0x3f')](_0x21c0d7[_0x245c('0x38')][_0x245c('0x3f')]);_0x4ad753[_0x245c('0x40')]=qs[_0x245c('0x36')](_[_0x245c('0x41')](_0x21c0d7['query'],_0x3bdb4e[_0x245c('0x36')]),_0x505f04);if(_0x21c0d7[_0x245c('0x38')]['filter']){_0x4ad753[_0x245c('0x40')]=_[_0x245c('0x42')](_0x4ad753[_0x245c('0x40')],{'$or':_[_0x245c('0x2e')](_0x505f04,function(_0x824576){if(_0x824576[_0x245c('0x32')]!=='VIRTUAL'){var _0x3ba543={};_0x3ba543[_0x824576['name']]={'$like':'%'+_0x21c0d7['query'][_0x245c('0x43')]+'%'};return _0x3ba543;}})});}_0x4ad753=_[_0x245c('0x42')]({},_0x4ad753,_0x21c0d7['options']);var _0x5681d4={'where':_0x4ad753[_0x245c('0x40')]};return db[_0x245c('0x2f')][_0x245c('0x22')](_0x5681d4)[_0x245c('0x29')](function(_0x50ad90){_0x2daf79['count']=_0x50ad90;if(_0x21c0d7[_0x245c('0x38')][_0x245c('0x44')]){_0x4ad753[_0x245c('0x45')]=[{'all':!![]}];}return db[_0x245c('0x2f')][_0x245c('0x46')](_0x4ad753);})[_0x245c('0x29')](function(_0x293d60){_0x2daf79[_0x245c('0x47')]=_0x293d60;return _0x2daf79;})[_0x245c('0x29')](respondWithFilteredResult(_0x483d1e,_0x4ad753))[_0x245c('0x48')](handleError(_0x483d1e,null));};exports[_0x245c('0x49')]=function(_0x3fd5ce,_0x5ce063){var _0x4bd3c9={'raw':!![],'where':{'id':_0x3fd5ce[_0x245c('0x4a')]['id']}},_0x3df0c9={};_0x3df0c9[_0x245c('0x34')]=_[_0x245c('0x35')](db['CmHopperBlack'][_0x245c('0x30')]);_0x3df0c9[_0x245c('0x38')]=_[_0x245c('0x35')](_0x3fd5ce['query']);_0x3df0c9[_0x245c('0x36')]=_[_0x245c('0x37')](_0x3df0c9[_0x245c('0x34')],_0x3df0c9[_0x245c('0x38')]);_0x4bd3c9[_0x245c('0x3a')]=_[_0x245c('0x37')](_0x3df0c9['model'],qs[_0x245c('0x39')](_0x3fd5ce[_0x245c('0x38')]['fields']));_0x4bd3c9['attributes']=_0x4bd3c9[_0x245c('0x3a')][_0x245c('0x3b')]?_0x4bd3c9[_0x245c('0x3a')]:_0x3df0c9[_0x245c('0x34')];if(_0x3fd5ce['query'][_0x245c('0x44')]){_0x4bd3c9[_0x245c('0x45')]=[{'all':!![]}];}_0x4bd3c9=_['merge']({},_0x4bd3c9,_0x3fd5ce['options']);return db[_0x245c('0x2f')][_0x245c('0x4b')](_0x4bd3c9)[_0x245c('0x29')](handleEntityNotFound(_0x5ce063,null))[_0x245c('0x29')](respondWithResult(_0x5ce063,null))['catch'](handleError(_0x5ce063,null));};exports[_0x245c('0x27')]=function(_0x5c32f5,_0x2996ca){if(_0x5c32f5['body']['id']){delete _0x5c32f5[_0x245c('0x4c')]['id'];}return db[_0x245c('0x2f')]['find']({'where':{'id':_0x5c32f5['params']['id']}})[_0x245c('0x29')](handleEntityNotFound(_0x2996ca,null))['then'](saveUpdates(_0x5c32f5[_0x245c('0x4c')],null))[_0x245c('0x29')](respondWithResult(_0x2996ca,null))[_0x245c('0x48')](handleError(_0x2996ca,null));};exports[_0x245c('0x28')]=function(_0x380826,_0xb69224){return db[_0x245c('0x2f')]['find']({'where':{'id':_0x380826['params']['id']}})['then'](handleEntityNotFound(_0xb69224,null))[_0x245c('0x29')](removeEntity(_0xb69224,null))['catch'](handleError(_0xb69224,null));};exports[_0x245c('0x4d')]=function(_0x238bf8,_0x3cf0b8){return db[_0x245c('0x2f')][_0x245c('0x4d')]()[_0x245c('0x29')](respondWithResult(_0x3cf0b8,null))[_0x245c('0x48')](handleError(_0x3cf0b8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 63ed852..75276ec 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 _0xe4e5=['exports','cm_hopper_black','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x34ddf1,_0x494e77){var _0x264cd6=function(_0x3b1d1a){while(--_0x3b1d1a){_0x34ddf1['push'](_0x34ddf1['shift']());}};_0x264cd6(++_0x494e77);}(_0xe4e5,0x1c4));var _0x5e4e=function(_0x5ad14c,_0x986b8f){_0x5ad14c=_0x5ad14c-0x0;var _0x53f498=_0xe4e5[_0x5ad14c];return _0x53f498;};'use strict';var _=require(_0x5e4e('0x0'));var util=require(_0x5e4e('0x1'));var logger=require(_0x5e4e('0x2'))(_0x5e4e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e4e('0x5'));var config=require(_0x5e4e('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x5e4e('0x7')]=function(_0x211329,_0x17a949){return _0x211329['define']('CmHopperBlack',attributes,{'tableName':_0x5e4e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf157=['CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x19d172,_0x21bf9b){var _0x4e1ccd=function(_0x144213){while(--_0x144213){_0x19d172['push'](_0x19d172['shift']());}};_0x4e1ccd(++_0x21bf9b);}(_0xf157,0x1d6));var _0x7f15=function(_0x5d3914,_0x1d9cc0){_0x5d3914=_0x5d3914-0x0;var _0x136f2d=_0xf157[_0x5d3914];return _0x136f2d;};'use strict';var _=require(_0x7f15('0x0'));var util=require(_0x7f15('0x1'));var logger=require(_0x7f15('0x2'))(_0x7f15('0x3'));var moment=require(_0x7f15('0x4'));var BPromise=require(_0x7f15('0x5'));var rp=require(_0x7f15('0x6'));var fs=require('fs');var path=require(_0x7f15('0x7'));var rimraf=require('rimraf');var config=require(_0x7f15('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x7f15('0x9')]=function(_0x3805f3,_0x55baad){return _0x3805f3[_0x7f15('0xa')](_0x7f15('0xb'),attributes,{'tableName':_0x7f15('0xc'),'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 d5b6874..5f9beda 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 _0xd2df=['include','model','UpdateCmHopperBlack','CmHopperBlack','update','body','raw','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','options','where','attributes','limit','map'];(function(_0x1d0184,_0x3fa782){var _0x364129=function(_0x14475f){while(--_0x14475f){_0x1d0184['push'](_0x1d0184['shift']());}};_0x364129(++_0x3fa782);}(_0xd2df,0x18e));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd2d('0x0'));var util=require(_0xfd2d('0x1'));var moment=require(_0xfd2d('0x2'));var BPromise=require(_0xfd2d('0x3'));var rs=require(_0xfd2d('0x4'));var fs=require('fs');var Redis=require(_0xfd2d('0x5'));var db=require(_0xfd2d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd2d('0x7'))(_0xfd2d('0x8'));var config=require(_0xfd2d('0x9'));var jayson=require(_0xfd2d('0xa'));var client=jayson['client'][_0xfd2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3702eb,_0x2ac5ad,_0x1d2e07){return new BPromise(function(_0x504ff9,_0x9de6db){return client[_0xfd2d('0xc')](_0x3702eb,_0x1d2e07)[_0xfd2d('0xd')](function(_0x379924){logger[_0xfd2d('0xe')](_0xfd2d('0xf'),_0x2ac5ad,_0xfd2d('0x10'));logger[_0xfd2d('0x11')](_0xfd2d('0x12'),_0x2ac5ad,'request\x20sent',JSON[_0xfd2d('0x13')](_0x379924));if(_0x379924['error']){if(_0x379924[_0xfd2d('0x14')][_0xfd2d('0x15')]===0x1f4){logger['error'](_0xfd2d('0xf'),_0x2ac5ad,_0x379924[_0xfd2d('0x14')][_0xfd2d('0x16')]);return _0x9de6db(_0x379924[_0xfd2d('0x14')]['message']);}logger[_0xfd2d('0x14')](_0xfd2d('0xf'),_0x2ac5ad,_0x379924[_0xfd2d('0x14')][_0xfd2d('0x16')]);return _0x504ff9(_0x379924[_0xfd2d('0x14')][_0xfd2d('0x16')]);}else{logger[_0xfd2d('0xe')](_0xfd2d('0xf'),_0x2ac5ad,'request\x20sent');_0x504ff9(_0x379924[_0xfd2d('0x17')]['message']);}})[_0xfd2d('0x18')](function(_0x59dbae){logger[_0xfd2d('0x14')](_0xfd2d('0xf'),_0x2ac5ad,_0x59dbae);_0x9de6db(_0x59dbae);});});}exports[_0xfd2d('0x19')]=function(_0x2714ad){var _0x235115=this;return new Promise(function(_0x364b58,_0x25e080){return db['CmHopperBlack']['findAll']({'raw':_0x2714ad[_0xfd2d('0x1a')]?_0x2714ad[_0xfd2d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2714ad['options']?_0x2714ad[_0xfd2d('0x1a')][_0xfd2d('0x1b')]||null:null,'attributes':_0x2714ad[_0xfd2d('0x1a')]?_0x2714ad[_0xfd2d('0x1a')][_0xfd2d('0x1c')]||null:null,'limit':_0x2714ad[_0xfd2d('0x1a')]?_0x2714ad[_0xfd2d('0x1a')][_0xfd2d('0x1d')]||null:null,'include':_0x2714ad['options']?_0x2714ad['options']['include']?_[_0xfd2d('0x1e')](_0x2714ad[_0xfd2d('0x1a')][_0xfd2d('0x1f')],function(_0x5b07d5){return{'model':db[_0x5b07d5[_0xfd2d('0x20')]],'as':_0x5b07d5['as'],'attributes':_0x5b07d5['attributes'],'include':_0x5b07d5['include']?_[_0xfd2d('0x1e')](_0x5b07d5['include'],function(_0x4a28da){return{'model':db[_0x4a28da[_0xfd2d('0x20')]],'as':_0x4a28da['as'],'attributes':_0x4a28da['attributes'],'include':_0x4a28da[_0xfd2d('0x1f')]?_[_0xfd2d('0x1e')](_0x4a28da[_0xfd2d('0x1f')],function(_0x58ef58){return{'model':db[_0x58ef58['model']],'as':_0x58ef58['as'],'attributes':_0x58ef58[_0xfd2d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c6ae7){logger[_0xfd2d('0xe')](_0xfd2d('0x19'),_0x2714ad);logger[_0xfd2d('0x11')](_0xfd2d('0x19'),_0x2714ad,JSON[_0xfd2d('0x13')](_0x3c6ae7));_0x364b58(_0x3c6ae7);})['catch'](function(_0x22afc0){logger[_0xfd2d('0x14')]('GetCmHopperBlack',_0x22afc0['message'],_0x2714ad);_0x25e080(_0x235115[_0xfd2d('0x14')](0x1f4,_0x22afc0[_0xfd2d('0x16')]));});});};exports[_0xfd2d('0x21')]=function(_0x1e1a82){var _0x3da84d=this;return new Promise(function(_0x2f69b5,_0xb74f00){return db[_0xfd2d('0x22')][_0xfd2d('0x23')](_0x1e1a82[_0xfd2d('0x24')],{'raw':_0x1e1a82[_0xfd2d('0x1a')]?_0x1e1a82[_0xfd2d('0x1a')][_0xfd2d('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e1a82[_0xfd2d('0x1a')]?_0x1e1a82[_0xfd2d('0x1a')][_0xfd2d('0x1b')]||null:null,'attributes':_0x1e1a82['options']?_0x1e1a82[_0xfd2d('0x1a')][_0xfd2d('0x1c')]||null:null,'limit':_0x1e1a82['options']?_0x1e1a82[_0xfd2d('0x1a')][_0xfd2d('0x1d')]||null:null})[_0xfd2d('0xd')](function(_0xfce205){logger['info'](_0xfd2d('0x21'),_0x1e1a82);logger[_0xfd2d('0x11')](_0xfd2d('0x21'),_0x1e1a82,JSON['stringify'](_0xfce205));_0x2f69b5(_0xfce205);})[_0xfd2d('0x18')](function(_0x2aa7b8){logger['error'](_0xfd2d('0x21'),_0x2aa7b8[_0xfd2d('0x16')],_0x1e1a82);_0xb74f00(_0x3da84d[_0xfd2d('0x14')](0x1f4,_0x2aa7b8[_0xfd2d('0x16')]));});});};exports['DestroyCmHopperBlack']=function(_0x599c94){var _0x34c408=this;return new Promise(function(_0x2dca8d,_0x30d731){return db[_0xfd2d('0x22')]['destroy']({'where':_0x599c94['options']?_0x599c94[_0xfd2d('0x1a')][_0xfd2d('0x1b')]||null:null})['then'](function(_0x44a3b8){logger[_0xfd2d('0xe')](_0xfd2d('0x26'),_0x599c94);logger[_0xfd2d('0x11')](_0xfd2d('0x26'),_0x599c94,JSON['stringify'](_0x44a3b8));_0x2dca8d(_0x44a3b8);})['catch'](function(_0x5bb87c){logger[_0xfd2d('0x14')](_0xfd2d('0x26'),_0x5bb87c[_0xfd2d('0x16')],_0x599c94);_0x30d731(_0x34c408[_0xfd2d('0x14')](0x1f4,_0x5bb87c[_0xfd2d('0x16')]));});});}; \ No newline at end of file +var _0x5f30=['catch','GetCmHopperBlack','CmHopperBlack','options','raw','attributes','limit','include','model','map','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result'];(function(_0x2191c7,_0x77db86){var _0x22aa56=function(_0x3d99a9){while(--_0x3d99a9){_0x2191c7['push'](_0x2191c7['shift']());}};_0x22aa56(++_0x77db86);}(_0x5f30,0x18b));var _0x05f3=function(_0x142e7f,_0x40e092){_0x142e7f=_0x142e7f-0x0;var _0x24977c=_0x5f30[_0x142e7f];return _0x24977c;};'use strict';var _=require(_0x05f3('0x0'));var util=require(_0x05f3('0x1'));var moment=require('moment');var BPromise=require(_0x05f3('0x2'));var rs=require(_0x05f3('0x3'));var fs=require('fs');var Redis=require(_0x05f3('0x4'));var db=require(_0x05f3('0x5'))['db'];var utils=require(_0x05f3('0x6'));var logger=require('../../config/logger')(_0x05f3('0x7'));var config=require(_0x05f3('0x8'));var jayson=require(_0x05f3('0x9'));var client=jayson[_0x05f3('0xa')][_0x05f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x490251,_0x88551e,_0x334980){return new BPromise(function(_0xcc3d20,_0x59399c){return client[_0x05f3('0xc')](_0x490251,_0x334980)[_0x05f3('0xd')](function(_0x1cc29f){logger[_0x05f3('0xe')](_0x05f3('0xf'),_0x88551e,_0x05f3('0x10'));logger[_0x05f3('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x88551e,_0x05f3('0x10'),JSON[_0x05f3('0x12')](_0x1cc29f));if(_0x1cc29f['error']){if(_0x1cc29f['error'][_0x05f3('0x13')]===0x1f4){logger[_0x05f3('0x14')](_0x05f3('0xf'),_0x88551e,_0x1cc29f['error'][_0x05f3('0x15')]);return _0x59399c(_0x1cc29f[_0x05f3('0x14')][_0x05f3('0x15')]);}logger[_0x05f3('0x14')](_0x05f3('0xf'),_0x88551e,_0x1cc29f[_0x05f3('0x14')][_0x05f3('0x15')]);return _0xcc3d20(_0x1cc29f['error'][_0x05f3('0x15')]);}else{logger[_0x05f3('0xe')](_0x05f3('0xf'),_0x88551e,_0x05f3('0x10'));_0xcc3d20(_0x1cc29f[_0x05f3('0x16')][_0x05f3('0x15')]);}})[_0x05f3('0x17')](function(_0x106513){logger[_0x05f3('0x14')](_0x05f3('0xf'),_0x88551e,_0x106513);_0x59399c(_0x106513);});});}exports[_0x05f3('0x18')]=function(_0x4c9448){var _0x55b64d=this;return new Promise(function(_0x404d3f,_0x594092){return db[_0x05f3('0x19')]['findAll']({'raw':_0x4c9448[_0x05f3('0x1a')]?_0x4c9448['options'][_0x05f3('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c9448[_0x05f3('0x1a')]?_0x4c9448['options']['where']||null:null,'attributes':_0x4c9448[_0x05f3('0x1a')]?_0x4c9448[_0x05f3('0x1a')][_0x05f3('0x1c')]||null:null,'limit':_0x4c9448[_0x05f3('0x1a')]?_0x4c9448['options'][_0x05f3('0x1d')]||null:null,'include':_0x4c9448[_0x05f3('0x1a')]?_0x4c9448[_0x05f3('0x1a')][_0x05f3('0x1e')]?_['map'](_0x4c9448['options'][_0x05f3('0x1e')],function(_0x5a9052){return{'model':db[_0x5a9052[_0x05f3('0x1f')]],'as':_0x5a9052['as'],'attributes':_0x5a9052['attributes'],'include':_0x5a9052[_0x05f3('0x1e')]?_[_0x05f3('0x20')](_0x5a9052[_0x05f3('0x1e')],function(_0x4f7d99){return{'model':db[_0x4f7d99[_0x05f3('0x1f')]],'as':_0x4f7d99['as'],'attributes':_0x4f7d99[_0x05f3('0x1c')],'include':_0x4f7d99[_0x05f3('0x1e')]?_[_0x05f3('0x20')](_0x4f7d99[_0x05f3('0x1e')],function(_0x1140bb){return{'model':db[_0x1140bb['model']],'as':_0x1140bb['as'],'attributes':_0x1140bb[_0x05f3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x05f3('0xd')](function(_0x24b0d7){logger['info'](_0x05f3('0x18'),_0x4c9448);logger[_0x05f3('0x11')](_0x05f3('0x18'),_0x4c9448,JSON['stringify'](_0x24b0d7));_0x404d3f(_0x24b0d7);})[_0x05f3('0x17')](function(_0x4ed2f3){logger[_0x05f3('0x14')](_0x05f3('0x18'),_0x4ed2f3[_0x05f3('0x15')],_0x4c9448);_0x594092(_0x55b64d['error'](0x1f4,_0x4ed2f3[_0x05f3('0x15')]));});});};exports[_0x05f3('0x21')]=function(_0x1a5b90){var _0x33b252=this;return new Promise(function(_0x2ff60a,_0x3866df){return db['CmHopperBlack'][_0x05f3('0x22')](_0x1a5b90['body'],{'raw':_0x1a5b90[_0x05f3('0x1a')]?_0x1a5b90['options'][_0x05f3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a5b90['options']?_0x1a5b90['options']['where']||null:null,'attributes':_0x1a5b90[_0x05f3('0x1a')]?_0x1a5b90['options'][_0x05f3('0x1c')]||null:null,'limit':_0x1a5b90['options']?_0x1a5b90[_0x05f3('0x1a')][_0x05f3('0x1d')]||null:null})[_0x05f3('0xd')](function(_0x132988){logger[_0x05f3('0xe')](_0x05f3('0x21'),_0x1a5b90);logger[_0x05f3('0x11')]('UpdateCmHopperBlack',_0x1a5b90,JSON['stringify'](_0x132988));_0x2ff60a(_0x132988);})[_0x05f3('0x17')](function(_0x30c1b6){logger[_0x05f3('0x14')](_0x05f3('0x21'),_0x30c1b6['message'],_0x1a5b90);_0x3866df(_0x33b252[_0x05f3('0x14')](0x1f4,_0x30c1b6['message']));});});};exports[_0x05f3('0x23')]=function(_0xd26159){var _0xd56882=this;return new Promise(function(_0x23cbe6,_0x4edfa1){return db[_0x05f3('0x19')][_0x05f3('0x24')]({'where':_0xd26159[_0x05f3('0x1a')]?_0xd26159[_0x05f3('0x1a')][_0x05f3('0x25')]||null:null})[_0x05f3('0xd')](function(_0x5a7710){logger['info'](_0x05f3('0x23'),_0xd26159);logger[_0x05f3('0x11')](_0x05f3('0x23'),_0xd26159,JSON[_0x05f3('0x12')](_0x5a7710));_0x23cbe6(_0x5a7710);})['catch'](function(_0x5b0672){logger[_0x05f3('0x14')]('DestroyCmHopperBlack',_0x5b0672[_0x05f3('0x15')],_0xd26159);_0x4edfa1(_0xd56882[_0x05f3('0x14')](0x1f4,_0x5b0672[_0x05f3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8a6d466..dd5cc3f 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 _0xd101=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd101,0xc1));var _0x1d10=function(_0x3d9606,_0x276fb5){_0x3d9606=_0x3d9606-0x0;var _0x1f10b7=_0xd101[_0x3d9606];return _0x1f10b7;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./cmHopperBlack.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xe'),auth['isAuthenticated'](),controller[_0x1d10('0x13')]);module[_0x1d10('0x14')]=router; \ No newline at end of file +var _0x524e=['../../config/environment','./cmHopperBlack.controller','get','index','/describe','describe','/:id','isAuthenticated','show','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d0efe,_0x5040b2){var _0x1af750=function(_0x13bf68){while(--_0x13bf68){_0x5d0efe['push'](_0x5d0efe['shift']());}};_0x1af750(++_0x5040b2);}(_0x524e,0x15e));var _0xe524=function(_0x913909,_0x5da0bc){_0x913909=_0x913909-0x0;var _0x4239f0=_0x524e[_0x913909];return _0x4239f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);module[_0xe524('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 9f75fdc..851ae03 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 _0xb640=['exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xb640,0x83));var _0x0b64=function(_0x47ad93,_0x1868ba){_0x47ad93=_0x47ad93-0x0;var _0x3c7cc9=_0xb640[_0x47ad93];return _0x3c7cc9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0b64('0x0'));module[_0x0b64('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0b64('0x2')]},'scheduledat':{'type':Sequelize[_0x0b64('0x3')]},'countbusyretry':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0b64('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0b64('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0b64('0x2')]},'calleridnum':{'type':Sequelize[_0x0b64('0x2')]},'calleridname':{'type':Sequelize[_0x0b64('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0b64('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0b64('0x3')]},'endtime':{'type':Sequelize[_0x0b64('0x3')]},'ringtime':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0b64('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0b64('0x2')]},'reason':{'type':Sequelize[_0x0b64('0x2')]},'disposition':{'type':Sequelize[_0x0b64('0x2')]},'secondDisposition':{'type':Sequelize[_0x0b64('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4be0d6){var _0x116eba=this[_0x0b64('0x5')](_0x0b64('0x6'));if(_0x116eba&&_0x4be0d6){this[_0x0b64('0x7')](_0x0b64('0x8'),moment(_0x4be0d6)[_0x0b64('0x9')](moment(_0x116eba),_0x0b64('0xa')));}return this[_0x0b64('0x7')]('dispositionat',_0x4be0d6);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0b64('0x3')]},'callback':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0b64('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0b64('0x3')]},'deleted':{'type':Sequelize[_0x0b64('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0b64('0x3')]},'recallme':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0b64('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb39=['STRING','DATE','INTEGER','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x2875b8,_0x237ad1){var _0x4f82ff=function(_0x1c817c){while(--_0x1c817c){_0x2875b8['push'](_0x2875b8['shift']());}};_0x4f82ff(++_0x237ad1);}(_0xcb39,0x76));var _0x9cb3=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0xcb39[_0x1ac6ec];return _0x48a489;};'use strict';var Sequelize=require(_0x9cb3('0x0'));var moment=require(_0x9cb3('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x9cb3('0x2')]},'scheduledat':{'type':Sequelize[_0x9cb3('0x3')]},'countbusyretry':{'type':Sequelize[_0x9cb3('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9cb3('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9cb3('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x9cb3('0x2')]},'calleridnum':{'type':Sequelize[_0x9cb3('0x2')]},'calleridname':{'type':Sequelize[_0x9cb3('0x2')]},'starttime':{'type':Sequelize[_0x9cb3('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9cb3('0x3')]},'droptime':{'type':Sequelize[_0x9cb3('0x3')]},'endtime':{'type':Sequelize[_0x9cb3('0x3')]},'ringtime':{'type':Sequelize[_0x9cb3('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9cb3('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9cb3('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x9cb3('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9cb3('0x2')]},'reason':{'type':Sequelize[_0x9cb3('0x2')]},'disposition':{'type':Sequelize[_0x9cb3('0x2')]},'secondDisposition':{'type':Sequelize[_0x9cb3('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x9cb3('0x3')],'set':function(_0x28a183){var _0x22e0d3=this['getDataValue']('endtime');if(_0x22e0d3&&_0x28a183){this[_0x9cb3('0x5')](_0x9cb3('0x6'),moment(_0x28a183)['diff'](moment(_0x22e0d3),_0x9cb3('0x7')));}return this['setDataValue'](_0x9cb3('0x8'),_0x28a183);}},'amd':{'type':Sequelize[_0x9cb3('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9cb3('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9cb3('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9cb3('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9cb3('0x3')]},'callback':{'type':Sequelize[_0x9cb3('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9cb3('0x3')]},'recallme':{'type':Sequelize[_0x9cb3('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9cb3('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x9cb3('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9cb3('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9cb3('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9cb3('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 3140427..31bdbd6 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 _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0x5d17,0x114));var _0x75d1=function(_0xed6f46,_0x1c9006){_0xed6f46=_0xed6f46-0x0;var _0x5b267c=_0x5d17[_0xed6f46];return _0x5b267c;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file +var _0xdb28=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','CmHopperFinal','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','insert','into','cm_hopper','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(CampaignId)','state','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf'];(function(_0x57b0eb,_0xd43c1c){var _0x15e00d=function(_0x7fa876){while(--_0x7fa876){_0x57b0eb['push'](_0x57b0eb['shift']());}};_0x15e00d(++_0xd43c1c);}(_0xdb28,0x106));var _0x8db2=function(_0xda4b48,_0x3ee8b1){_0xda4b48=_0xda4b48-0x0;var _0x6e7b1e=_0xdb28[_0xda4b48];return _0x6e7b1e;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['describe']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')]()['then'](respondWithResult(_0x2ada52,null))['catch'](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x2e46d4,_0x164020){if(_0x2e46d4['body']['uniqueid']){delete _0x2e46d4['body'][_0x8db2('0x4a')];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'uniqueid':_0x2e46d4[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x164020,null))[_0x8db2('0x24')](saveUpdates(_0x2e46d4[_0x8db2('0x4b')],null))['then'](respondWithResult(_0x164020,null))['catch'](handleError(_0x164020,null));};exports[_0x8db2('0x4c')]=function(_0x18c6ef,_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x18c6ef[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x54')))),_0x8db2('0x55')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x56')))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8db2('0x58')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5d')))),_0x8db2('0x5e')]]})['then'](handleEntityNotFound(_0x2908e4,null))[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x42')](handleError(_0x2908e4,null));};exports[_0x8db2('0x5f')]=function(_0xc27a7e,_0x349db0,_0x53b2dc){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'CampaignId':_0xc27a7e[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db['sequelize'][_0x8db2('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x8db2('0x55')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x60')))),_0x8db2('0x58')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5d')))),'answeringMachine']]})[_0x8db2('0x24')](handleEntityNotFound(_0x349db0,null))[_0x8db2('0x24')](respondWithResult(_0x349db0,null))[_0x8db2('0x42')](handleError(_0x349db0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x26523b,_0x291375,_0x2cf731){return db['VoiceQueue'][_0x8db2('0x48')]({'where':{'id':_0x26523b[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x291375,null))[_0x8db2('0x24')](function(_0x3a0946){var _0x5923b3;if(_0x3a0946){_0x5923b3=squel[_0x8db2('0x61')]()[_0x8db2('0x62')](_0x8db2('0x63'))['fromQuery'](['phone',_0x8db2('0x64'),_0x8db2('0x65'),'ListId',_0x8db2('0x66'),_0x8db2('0x67'),_0x8db2('0x68')],squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))[_0x8db2('0x6a')](_0x8db2('0x6e'),_0x8db2('0x65'))['field'](_0x8db2('0x6f'),'ListId')[_0x8db2('0x6a')](_0x8db2('0x70'),'VoiceQueueId')[_0x8db2('0x6a')](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())['where']('state\x20=\x20?',_0x26523b[_0x8db2('0x4b')]['state'][_0x8db2('0x74')]())[_0x8db2('0x3b')](_0x8db2('0x75'))['where'](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')]('phone')[_0x8db2('0x71')](_0x8db2('0x63'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b['params']['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id']['toString']())[_0x8db2('0x3b')](_0x8db2('0x78')))[_0x8db2('0x79')]('ContactId'))['toString']();return db['sequelize'][_0x8db2('0x30')](_0x5923b3);}return[];})[_0x8db2('0x24')](respondWithResult(_0x291375,null))[_0x8db2('0x42')](handleError(_0x291375,null));};exports[_0x8db2('0x7a')]=function(_0x2ad024,_0x313918,_0x339d09){return db[_0x8db2('0x7b')][_0x8db2('0x48')]({'where':{'id':_0x2ad024[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x313918,null))['then'](function(_0x360a06){var _0xa2e293;if(_0x360a06){_0xa2e293=squel[_0x8db2('0x61')]()[_0x8db2('0x62')]('cm_hopper')['fromQuery']([_0x8db2('0x6c'),_0x8db2('0x64'),'ContactId',_0x8db2('0x7c'),_0x8db2('0x7d'),_0x8db2('0x67'),'updatedAt'],squel['select']()['field'](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))['field'](_0x8db2('0x6e'),'ContactId')[_0x8db2('0x6a')](_0x8db2('0x6f'),_0x8db2('0x7c'))[_0x8db2('0x6a')](_0x8db2('0x7e'),'CampaignId')['field'](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')]('CampaignId\x20=\x20?',_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x20?',_0x2ad024[_0x8db2('0x4b')][_0x8db2('0x7f')]['toString']())[_0x8db2('0x3b')](_0x8db2('0x75'))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6c'))[_0x8db2('0x71')](_0x8db2('0x63'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x204'))[_0x8db2('0x79')](_0x8db2('0x65')))[_0x8db2('0x74')]();return db['sequelize']['query'](_0xa2e293);}return[];})[_0x8db2('0x24')](respondWithResult(_0x313918,null))[_0x8db2('0x42')](handleError(_0x313918,null));};exports[_0x8db2('0x81')]=function(_0xc83913,_0x4f9ce4,_0xaa2661){return db[_0x8db2('0x82')][_0x8db2('0x83')]({'where':{'VoiceQueueId':_0xc83913[_0x8db2('0x4b')]['VoiceQueueId'],'CampaignId':_0xc83913[_0x8db2('0x4b')][_0x8db2('0x7d')],'ContactId':_0xc83913[_0x8db2('0x4b')]['ContactId']}})['then'](handleEntityNotFound(_0x4f9ce4,null))['then'](function(_0x1ba097){if(_0x1ba097){return _0x1ba097;}return null;})[_0x8db2('0x24')](respondWithResult(_0x4f9ce4,null))[_0x8db2('0x42')](handleError(_0x4f9ce4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index dc7607f..d6f420a 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 _0xeaf3=['./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x2d3a4d,_0x47561e){var _0x3a94a3=function(_0x2f48da){while(--_0x2f48da){_0x2d3a4d['push'](_0x2d3a4d['shift']());}};_0x3a94a3(++_0x47561e);}(_0xeaf3,0x1b3));var _0x3eaf=function(_0x16a210,_0x2046a2){_0x16a210=_0x16a210-0x0;var _0x10b5ec=_0xeaf3[_0x16a210];return _0x10b5ec;};'use strict';var _=require(_0x3eaf('0x0'));var util=require(_0x3eaf('0x1'));var logger=require('../../config/logger')(_0x3eaf('0x2'));var moment=require(_0x3eaf('0x3'));var BPromise=require('bluebird');var rp=require(_0x3eaf('0x4'));var fs=require('fs');var path=require(_0x3eaf('0x5'));var rimraf=require(_0x3eaf('0x6'));var config=require('../../config/environment');var attributes=require(_0x3eaf('0x7'));module[_0x3eaf('0x8')]=function(_0x1e9d4e,_0x4beb9a){return _0x1e9d4e['define'](_0x3eaf('0x9'),attributes,{'tableName':_0x3eaf('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x3eaf('0xb')]},{'name':_0x3eaf('0xc'),'fields':[_0x3eaf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc95d=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','CmHopperFinal','calleridnum'];(function(_0x52d3d5,_0x58c8b7){var _0x5c35b5=function(_0x16857a){while(--_0x16857a){_0x52d3d5['push'](_0x52d3d5['shift']());}};_0x5c35b5(++_0x58c8b7);}(_0xc95d,0x76));var _0xdc95=function(_0x5a7757,_0x6ee636){_0x5a7757=_0x5a7757-0x0;var _0x7b3aba=_0xc95d[_0x5a7757];return _0x7b3aba;};'use strict';var _=require(_0xdc95('0x0'));var util=require(_0xdc95('0x1'));var logger=require(_0xdc95('0x2'))(_0xdc95('0x3'));var moment=require(_0xdc95('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc95('0x5'));var fs=require('fs');var path=require(_0xdc95('0x6'));var rimraf=require('rimraf');var config=require(_0xdc95('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0xdc95('0x8')]=function(_0x4593c3,_0x4f5b1b){return _0x4593c3[_0xdc95('0x9')](_0xdc95('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xdc95('0xb'),'fields':[_0xdc95('0xb')]},{'name':_0xdc95('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index f9ee10e..a721b7e 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(_0x381c68,_0x3f08a7){var _0x46833b=function(_0x3f9b5e){while(--_0x3f9b5e){_0x381c68['push'](_0x381c68['shift']());}};_0x46833b(++_0x3f08a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a09e9,_0x391256){_0x5a09e9=_0x5a09e9-0x0;var _0x5e4735=_0xb10b[_0x5a09e9];return _0x5e4735;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x38214e,_0x466e9d){var _0x475af7=function(_0x58438e){while(--_0x58438e){_0x38214e['push'](_0x38214e['shift']());}};_0x475af7(++_0x466e9d);}(_0xb10b,0x12a));var _0xbb10=function(_0x391154,_0x40fb12){_0x391154=_0x391154-0x0;var _0x4b7767=_0xb10b[_0x391154];return _0x4b7767;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e6f2192..d99395c 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 _0x71af=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer'];(function(_0xc85fd9,_0x12ef82){var _0x1cb181=function(_0x94ce1b){while(--_0x94ce1b){_0xc85fd9['push'](_0xc85fd9['shift']());}};_0x1cb181(++_0x12ef82);}(_0x71af,0x194));var _0xf71a=function(_0x5199a9,_0x4c77cb){_0x5199a9=_0x5199a9-0x0;var _0x404655=_0x71af[_0x5199a9];return _0x404655;};'use strict';var multer=require(_0xf71a('0x0'));var util=require(_0xf71a('0x1'));var path=require('path');var timeout=require(_0xf71a('0x2'));var express=require(_0xf71a('0x3'));var router=express[_0xf71a('0x4')]();var fs_extra=require(_0xf71a('0x5'));var auth=require(_0xf71a('0x6'));var interaction=require(_0xf71a('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xf71a('0x8')]('/',auth[_0xf71a('0x9')](),controller[_0xf71a('0xa')]);router[_0xf71a('0x8')](_0xf71a('0xb'),auth[_0xf71a('0x9')](),controller[_0xf71a('0xc')]);router[_0xf71a('0x8')](_0xf71a('0xd'),auth[_0xf71a('0x9')](),controller['show']);router[_0xf71a('0x8')](_0xf71a('0xe'),auth['isAuthenticated'](),controller[_0xf71a('0xf')]);router[_0xf71a('0x8')](_0xf71a('0x10'),auth[_0xf71a('0x9')](),controller[_0xf71a('0x11')]);router['post'](_0xf71a('0x12'),auth[_0xf71a('0x9')](),controller[_0xf71a('0x13')]);router[_0xf71a('0x14')](_0xf71a('0x15'),auth[_0xf71a('0x9')](),controller[_0xf71a('0x16')]);router[_0xf71a('0x14')](_0xf71a('0x17'),auth['isAuthenticated'](),controller[_0xf71a('0x18')]);router[_0xf71a('0x19')](_0xf71a('0xd'),auth[_0xf71a('0x9')](),controller['update']);module[_0xf71a('0x1a')]=router; \ No newline at end of file +var _0x6b6b=['moveContactsIvrCampaignHopperFinal','checkContactHopper','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x6b6b,0x16b));var _0xb6b6=function(_0x1b753f,_0x3e8e70){_0x1b753f=_0x1b753f-0x0;var _0xa85ce0=_0x6b6b[_0x1b753f];return _0xa85ce0;};'use strict';var multer=require(_0xb6b6('0x0'));var util=require(_0xb6b6('0x1'));var path=require(_0xb6b6('0x2'));var timeout=require(_0xb6b6('0x3'));var express=require(_0xb6b6('0x4'));var router=express[_0xb6b6('0x5')]();var fs_extra=require(_0xb6b6('0x6'));var auth=require(_0xb6b6('0x7'));var interaction=require(_0xb6b6('0x8'));var config=require(_0xb6b6('0x9'));var controller=require(_0xb6b6('0xa'));router[_0xb6b6('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb6b6('0xb')]('/describe',auth[_0xb6b6('0xc')](),controller[_0xb6b6('0xd')]);router['get'](_0xb6b6('0xe'),auth[_0xb6b6('0xc')](),controller['show']);router['get'](_0xb6b6('0xf'),auth[_0xb6b6('0xc')](),controller[_0xb6b6('0x10')]);router[_0xb6b6('0xb')](_0xb6b6('0x11'),auth[_0xb6b6('0xc')](),controller['countContactsIvrCampaignHopperFinal']);router['post']('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xb6b6('0x12')]);router[_0xb6b6('0x13')](_0xb6b6('0x14'),auth[_0xb6b6('0xc')](),controller[_0xb6b6('0x15')]);router[_0xb6b6('0x13')]('/checkContactHopper',auth[_0xb6b6('0xc')](),controller[_0xb6b6('0x16')]);router['put'](_0xb6b6('0xe'),auth[_0xb6b6('0xc')](),controller['update']);module[_0xb6b6('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index c6d4ca3..de99fa1 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 _0xa23d=['BOOLEAN','INTEGER','STRING','DATE'];(function(_0x52e9a6,_0x37ae6f){var _0x2ee971=function(_0x5191c9){while(--_0x5191c9){_0x52e9a6['push'](_0x52e9a6['shift']());}};_0x2ee971(++_0x37ae6f);}(_0xa23d,0x7d));var _0xda23=function(_0x3e8cf2,_0x178b47){_0x3e8cf2=_0x3e8cf2-0x0;var _0xc8fdc3=_0xa23d[_0x3e8cf2];return _0xc8fdc3;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xda23('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xda23('0x1')]},'scheduledat':{'type':Sequelize[_0xda23('0x2')]},'countbusyretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xda23('0x1')]},'originatecalleridname':{'type':Sequelize[_0xda23('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xda23('0x1')]},'starttime':{'type':Sequelize[_0xda23('0x2')]},'responsetime':{'type':Sequelize[_0xda23('0x2')]},'answertime':{'type':Sequelize[_0xda23('0x2')]},'droptime':{'type':Sequelize[_0xda23('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xda23('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xda23('0x1')]},'membername':{'type':Sequelize[_0xda23('0x1')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xda23('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xda23('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xda23('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xda23('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xda23('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xda23('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3bc4=['INTEGER','DATE','STRING','BOOLEAN'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3bc4,0x84));var _0x43bc=function(_0x1af420,_0x4ad7c5){_0x1af420=_0x1af420-0x0;var _0x572d5f=_0x3bc4[_0x1af420];return _0x572d5f;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x43bc('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x43bc('0x1')]},'countbusyretry':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x43bc('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x43bc('0x2')]},'originatecalleridname':{'type':Sequelize[_0x43bc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43bc('0x2')]},'starttime':{'type':Sequelize[_0x43bc('0x1')]},'responsetime':{'type':Sequelize[_0x43bc('0x1')]},'answertime':{'type':Sequelize[_0x43bc('0x1')]},'droptime':{'type':Sequelize[_0x43bc('0x1')]},'endtime':{'type':Sequelize[_0x43bc('0x1')]},'ringtime':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x43bc('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x43bc('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x43bc('0x3')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x43bc('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x43bc('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x43bc('0x1')]},'recallme':{'type':Sequelize[_0x43bc('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x43bc('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x43bc('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 3c699a9..bdf78bc 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 _0x1369=['intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','reject','save','update','destroy','then','error','stack','name','send','map','CmHopperHistory','fieldName','type','model','query','keys','filters'];(function(_0x1d3ece,_0x3fb359){var _0x1ba5d2=function(_0xaa2729){while(--_0xaa2729){_0x1d3ece['push'](_0x1d3ece['shift']());}};_0x1ba5d2(++_0x3fb359);}(_0x1369,0xae));var _0x9136=function(_0x5eef9e,_0x317fcf){_0x5eef9e=_0x5eef9e-0x0;var _0x45192c=_0x1369[_0x5eef9e];return _0x45192c;};'use strict';var emlformat=require(_0x9136('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9136('0x1'));var jsonpatch=require(_0x9136('0x2'));var rp=require(_0x9136('0x3'));var moment=require(_0x9136('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9136('0x5'));var util=require(_0x9136('0x6'));var path=require(_0x9136('0x7'));var sox=require(_0x9136('0x8'));var csv=require(_0x9136('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9136('0xa'));var _=require('lodash');var squel=require(_0x9136('0xb'));var crypto=require(_0x9136('0xc'));var jsforce=require(_0x9136('0xd'));var deskjs=require(_0x9136('0xe'));var toCsv=require(_0x9136('0x9'));var querystring=require(_0x9136('0xf'));var Papa=require(_0x9136('0x10'));var Redis=require(_0x9136('0x11'));var authService=require(_0x9136('0x12'));var qs=require(_0x9136('0x13'));var as=require(_0x9136('0x14'));var hardwareService=require(_0x9136('0x15'));var logger=require('../../config/logger')(_0x9136('0x16'));var utils=require('../../config/utils');var config=require(_0x9136('0x17'));var licenseUtil=require(_0x9136('0x18'));var db=require(_0x9136('0x19'))['db'];function respondWithStatusCode(_0x478a3f,_0x3512f2){_0x3512f2=_0x3512f2||0xcc;return function(_0x35534e){if(_0x35534e){return _0x478a3f[_0x9136('0x1a')](_0x3512f2);}return _0x478a3f[_0x9136('0x1b')](_0x3512f2)[_0x9136('0x1c')]();};}function respondWithResult(_0x5908b6,_0x12ddff){_0x12ddff=_0x12ddff||0xc8;return function(_0x588165){if(_0x588165){return _0x5908b6[_0x9136('0x1b')](_0x12ddff)[_0x9136('0x1d')](_0x588165);}};}function respondWithFilteredResult(_0x470ee9,_0x37287a){return function(_0x497048){if(_0x497048){var _0x3afab6=typeof _0x37287a['offset']==='undefined'&&typeof _0x37287a['limit']===_0x9136('0x1e');var _0x31b996=_0x497048[_0x9136('0x1f')];var _0x246cf6=_0x3afab6?0x0:_0x37287a[_0x9136('0x20')];var _0x3dffb1=_0x3afab6?_0x497048[_0x9136('0x1f')]:_0x37287a['offset']+_0x37287a[_0x9136('0x21')];var _0x53130b;if(_0x3dffb1>=_0x31b996){_0x3dffb1=_0x31b996;_0x53130b=0xc8;}else{_0x53130b=0xce;}_0x470ee9[_0x9136('0x1b')](_0x53130b);return _0x470ee9['set']('Content-Range',_0x246cf6+'-'+_0x3dffb1+'/'+_0x31b996)[_0x9136('0x1d')](_0x497048);}return null;};}function patchUpdates(_0x21d278){return function(_0x33895a){try{jsonpatch['apply'](_0x33895a,_0x21d278,!![]);}catch(_0x42291e){return BPromise[_0x9136('0x22')](_0x42291e);}return _0x33895a[_0x9136('0x23')]();};}function saveUpdates(_0x5a6abb,_0x5d50be){return function(_0x2c61b7){if(_0x2c61b7){return _0x2c61b7[_0x9136('0x24')](_0x5a6abb)['then'](function(_0x11904c){return _0x11904c;});}return null;};}function removeEntity(_0x5ad558,_0x1b7429){return function(_0x1f59d6){if(_0x1f59d6){return _0x1f59d6[_0x9136('0x25')]()[_0x9136('0x26')](function(){_0x5ad558['status'](0xcc)[_0x9136('0x1c')]();});}};}function handleEntityNotFound(_0xbf1f4c,_0x1e8857){return function(_0x57ffa1){if(!_0x57ffa1){_0xbf1f4c['sendStatus'](0x194);}return _0x57ffa1;};}function handleError(_0x6df202,_0x4a107a){_0x4a107a=_0x4a107a||0x1f4;return function(_0x22a80){logger[_0x9136('0x27')](_0x22a80[_0x9136('0x28')]);if(_0x22a80[_0x9136('0x29')]){delete _0x22a80[_0x9136('0x29')];}_0x6df202['status'](_0x4a107a)[_0x9136('0x2a')](_0x22a80);};}exports['index']=function(_0x1722d5,_0xe18c0f){var _0xca0d48={},_0x564f45={},_0x38f76d={'count':0x0,'rows':[]};var _0x57f594=_[_0x9136('0x2b')](db[_0x9136('0x2c')]['rawAttributes'],function(_0x56b5f8){return{'name':_0x56b5f8[_0x9136('0x2d')],'type':_0x56b5f8[_0x9136('0x2e')]['key']};});_0x564f45[_0x9136('0x2f')]=_[_0x9136('0x2b')](_0x57f594,_0x9136('0x29'));_0x564f45[_0x9136('0x30')]=_[_0x9136('0x31')](_0x1722d5['query']);_0x564f45[_0x9136('0x32')]=_[_0x9136('0x33')](_0x564f45[_0x9136('0x2f')],_0x564f45[_0x9136('0x30')]);_0xca0d48[_0x9136('0x34')]=_[_0x9136('0x33')](_0x564f45[_0x9136('0x2f')],qs['fields'](_0x1722d5[_0x9136('0x30')]['fields']));_0xca0d48[_0x9136('0x34')]=_0xca0d48[_0x9136('0x34')][_0x9136('0x35')]?_0xca0d48[_0x9136('0x34')]:_0x564f45[_0x9136('0x2f')];if(!_0x1722d5['query'][_0x9136('0x36')](_0x9136('0x37'))){_0xca0d48[_0x9136('0x21')]=qs[_0x9136('0x21')](_0x1722d5[_0x9136('0x30')]['limit']);_0xca0d48[_0x9136('0x20')]=qs[_0x9136('0x20')](_0x1722d5['query'][_0x9136('0x20')]);}_0xca0d48[_0x9136('0x38')]=qs[_0x9136('0x39')](_0x1722d5[_0x9136('0x30')]['sort']);_0xca0d48[_0x9136('0x3a')]=qs[_0x9136('0x32')](_[_0x9136('0x3b')](_0x1722d5[_0x9136('0x30')],_0x564f45[_0x9136('0x32')]),_0x57f594);if(_0x1722d5[_0x9136('0x30')]['filter']){_0xca0d48[_0x9136('0x3a')]=_[_0x9136('0x3c')](_0xca0d48[_0x9136('0x3a')],{'$or':_[_0x9136('0x2b')](_0x57f594,function(_0x438179){if(_0x438179[_0x9136('0x2e')]!==_0x9136('0x3d')){var _0x37558c={};_0x37558c[_0x438179[_0x9136('0x29')]]={'$like':'%'+_0x1722d5['query'][_0x9136('0x3e')]+'%'};return _0x37558c;}})});}_0xca0d48=_[_0x9136('0x3c')]({},_0xca0d48,_0x1722d5['options']);var _0x38075d={'where':_0xca0d48[_0x9136('0x3a')]};return db['CmHopperHistory'][_0x9136('0x1f')](_0x38075d)[_0x9136('0x26')](function(_0x29b38f){_0x38f76d[_0x9136('0x1f')]=_0x29b38f;if(_0x1722d5[_0x9136('0x30')][_0x9136('0x3f')]){_0xca0d48[_0x9136('0x40')]=[{'all':!![]}];}return db[_0x9136('0x2c')][_0x9136('0x41')](_0xca0d48);})['then'](function(_0x52664f){_0x38f76d[_0x9136('0x42')]=_0x52664f;return _0x38f76d;})[_0x9136('0x26')](respondWithFilteredResult(_0xe18c0f,_0xca0d48))[_0x9136('0x43')](handleError(_0xe18c0f,null));};exports[_0x9136('0x44')]=function(_0x3cda98,_0x1800d8){var _0x5cdac4={'raw':!![],'where':{'id':_0x3cda98[_0x9136('0x45')]['id']}},_0x2f845b={};_0x2f845b[_0x9136('0x2f')]=_[_0x9136('0x31')](db[_0x9136('0x2c')][_0x9136('0x46')]);_0x2f845b[_0x9136('0x30')]=_[_0x9136('0x31')](_0x3cda98[_0x9136('0x30')]);_0x2f845b[_0x9136('0x32')]=_[_0x9136('0x33')](_0x2f845b[_0x9136('0x2f')],_0x2f845b[_0x9136('0x30')]);_0x5cdac4['attributes']=_[_0x9136('0x33')](_0x2f845b[_0x9136('0x2f')],qs['fields'](_0x3cda98[_0x9136('0x30')]['fields']));_0x5cdac4['attributes']=_0x5cdac4[_0x9136('0x34')]['length']?_0x5cdac4[_0x9136('0x34')]:_0x2f845b[_0x9136('0x2f')];if(_0x3cda98['query'][_0x9136('0x3f')]){_0x5cdac4['include']=[{'all':!![]}];}_0x5cdac4=_['merge']({},_0x5cdac4,_0x3cda98['options']);return db[_0x9136('0x2c')][_0x9136('0x47')](_0x5cdac4)[_0x9136('0x26')](handleEntityNotFound(_0x1800d8,null))[_0x9136('0x26')](respondWithResult(_0x1800d8,null))['catch'](handleError(_0x1800d8,null));};exports['create']=function(_0x4db224,_0x33cc61){return db['CmHopperHistory'][_0x9136('0x48')](_0x4db224['body'],{})[_0x9136('0x26')](respondWithResult(_0x33cc61,0xc9))[_0x9136('0x43')](handleError(_0x33cc61,null));};exports['describe']=function(_0x167679,_0x434420){return db[_0x9136('0x2c')]['describe']()[_0x9136('0x26')](respondWithResult(_0x434420,null))[_0x9136('0x43')](handleError(_0x434420,null));};exports[_0x9136('0x24')]=function(_0x4dafea,_0x160b69){if(_0x4dafea[_0x9136('0x49')][_0x9136('0x4a')]){delete _0x4dafea[_0x9136('0x49')]['uniqueid'];}return db[_0x9136('0x2c')]['find']({'where':{'uniqueid':_0x4dafea[_0x9136('0x45')]['id']}})[_0x9136('0x26')](handleEntityNotFound(_0x160b69,null))[_0x9136('0x26')](saveUpdates(_0x4dafea['body'],null))['then'](respondWithResult(_0x160b69,null))[_0x9136('0x43')](handleError(_0x160b69,null));}; \ No newline at end of file +var _0x0a13=['offset','undefined','limit','count','Content-Range','json','reject','save','update','then','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','query','keys','filters','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','show','intersection','length','options','find','catch','create','describe','body','uniqueid','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end'];(function(_0x1e4b11,_0x419b6a){var _0x50f2dc=function(_0x209b83){while(--_0x209b83){_0x1e4b11['push'](_0x1e4b11['shift']());}};_0x50f2dc(++_0x419b6a);}(_0x0a13,0x18c));var _0x30a1=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x0a13[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x30a1('0x0'));var jsonpatch=require(_0x30a1('0x1'));var rp=require(_0x30a1('0x2'));var moment=require('moment');var BPromise=require(_0x30a1('0x3'));var Mustache=require(_0x30a1('0x4'));var util=require(_0x30a1('0x5'));var path=require(_0x30a1('0x6'));var sox=require('sox');var csv=require(_0x30a1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30a1('0x8'));var _=require(_0x30a1('0x9'));var squel=require(_0x30a1('0xa'));var crypto=require('crypto');var jsforce=require(_0x30a1('0xb'));var deskjs=require(_0x30a1('0xc'));var toCsv=require(_0x30a1('0x7'));var querystring=require(_0x30a1('0xd'));var Papa=require('papaparse');var Redis=require(_0x30a1('0xe'));var authService=require(_0x30a1('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30a1('0x10'));var logger=require(_0x30a1('0x11'))(_0x30a1('0x12'));var utils=require(_0x30a1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x30a1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275a53,_0x49eb59){_0x49eb59=_0x49eb59||0xcc;return function(_0x3c6ebf){if(_0x3c6ebf){return _0x275a53[_0x30a1('0x15')](_0x49eb59);}return _0x275a53[_0x30a1('0x16')](_0x49eb59)[_0x30a1('0x17')]();};}function respondWithResult(_0x3d5517,_0x4528bd){_0x4528bd=_0x4528bd||0xc8;return function(_0x424424){if(_0x424424){return _0x3d5517[_0x30a1('0x16')](_0x4528bd)['json'](_0x424424);}};}function respondWithFilteredResult(_0x35ab95,_0x16fd7b){return function(_0x18f516){if(_0x18f516){var _0x41ed8c=typeof _0x16fd7b[_0x30a1('0x18')]===_0x30a1('0x19')&&typeof _0x16fd7b[_0x30a1('0x1a')]===_0x30a1('0x19');var _0x5a919d=_0x18f516[_0x30a1('0x1b')];var _0x25448e=_0x41ed8c?0x0:_0x16fd7b[_0x30a1('0x18')];var _0x5c17f3=_0x41ed8c?_0x18f516[_0x30a1('0x1b')]:_0x16fd7b[_0x30a1('0x18')]+_0x16fd7b[_0x30a1('0x1a')];var _0x298c85;if(_0x5c17f3>=_0x5a919d){_0x5c17f3=_0x5a919d;_0x298c85=0xc8;}else{_0x298c85=0xce;}_0x35ab95['status'](_0x298c85);return _0x35ab95['set'](_0x30a1('0x1c'),_0x25448e+'-'+_0x5c17f3+'/'+_0x5a919d)[_0x30a1('0x1d')](_0x18f516);}return null;};}function patchUpdates(_0x3c2d47){return function(_0x496ea9){try{jsonpatch['apply'](_0x496ea9,_0x3c2d47,!![]);}catch(_0x4ff020){return BPromise[_0x30a1('0x1e')](_0x4ff020);}return _0x496ea9[_0x30a1('0x1f')]();};}function saveUpdates(_0xfd0528,_0x42a2d9){return function(_0x1a90b1){if(_0x1a90b1){return _0x1a90b1[_0x30a1('0x20')](_0xfd0528)[_0x30a1('0x21')](function(_0x5c0e4e){return _0x5c0e4e;});}return null;};}function removeEntity(_0x377fec,_0x11ca46){return function(_0xe352b9){if(_0xe352b9){return _0xe352b9['destroy']()[_0x30a1('0x21')](function(){_0x377fec[_0x30a1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x238e22,_0x5d9a34){return function(_0x30ac3e){if(!_0x30ac3e){_0x238e22[_0x30a1('0x15')](0x194);}return _0x30ac3e;};}function handleError(_0x1ceea8,_0x237a4f){_0x237a4f=_0x237a4f||0x1f4;return function(_0x1c0d7b){logger['error'](_0x1c0d7b[_0x30a1('0x22')]);if(_0x1c0d7b[_0x30a1('0x23')]){delete _0x1c0d7b[_0x30a1('0x23')];}_0x1ceea8[_0x30a1('0x16')](_0x237a4f)[_0x30a1('0x24')](_0x1c0d7b);};}exports[_0x30a1('0x25')]=function(_0x2ccdd9,_0x13b45e){var _0x585455={},_0x275197={},_0x3f7d7b={'count':0x0,'rows':[]};var _0xa7a00b=_[_0x30a1('0x26')](db[_0x30a1('0x27')][_0x30a1('0x28')],function(_0x3d5007){return{'name':_0x3d5007[_0x30a1('0x29')],'type':_0x3d5007[_0x30a1('0x2a')]['key']};});_0x275197['model']=_[_0x30a1('0x26')](_0xa7a00b,_0x30a1('0x23'));_0x275197[_0x30a1('0x2b')]=_[_0x30a1('0x2c')](_0x2ccdd9[_0x30a1('0x2b')]);_0x275197[_0x30a1('0x2d')]=_['intersection'](_0x275197['model'],_0x275197[_0x30a1('0x2b')]);_0x585455[_0x30a1('0x2e')]=_['intersection'](_0x275197[_0x30a1('0x2f')],qs['fields'](_0x2ccdd9['query'][_0x30a1('0x30')]));_0x585455[_0x30a1('0x2e')]=_0x585455[_0x30a1('0x2e')]['length']?_0x585455['attributes']:_0x275197[_0x30a1('0x2f')];if(!_0x2ccdd9['query'][_0x30a1('0x31')](_0x30a1('0x32'))){_0x585455[_0x30a1('0x1a')]=qs['limit'](_0x2ccdd9[_0x30a1('0x2b')][_0x30a1('0x1a')]);_0x585455[_0x30a1('0x18')]=qs[_0x30a1('0x18')](_0x2ccdd9[_0x30a1('0x2b')]['offset']);}_0x585455[_0x30a1('0x33')]=qs[_0x30a1('0x34')](_0x2ccdd9[_0x30a1('0x2b')][_0x30a1('0x34')]);_0x585455[_0x30a1('0x35')]=qs[_0x30a1('0x2d')](_['pick'](_0x2ccdd9[_0x30a1('0x2b')],_0x275197[_0x30a1('0x2d')]),_0xa7a00b);if(_0x2ccdd9[_0x30a1('0x2b')][_0x30a1('0x36')]){_0x585455[_0x30a1('0x35')]=_[_0x30a1('0x37')](_0x585455['where'],{'$or':_[_0x30a1('0x26')](_0xa7a00b,function(_0xc25342){if(_0xc25342[_0x30a1('0x2a')]!=='VIRTUAL'){var _0x3716b4={};_0x3716b4[_0xc25342[_0x30a1('0x23')]]={'$like':'%'+_0x2ccdd9[_0x30a1('0x2b')]['filter']+'%'};return _0x3716b4;}})});}_0x585455=_[_0x30a1('0x37')]({},_0x585455,_0x2ccdd9['options']);var _0xe279bc={'where':_0x585455['where']};return db[_0x30a1('0x27')][_0x30a1('0x1b')](_0xe279bc)[_0x30a1('0x21')](function(_0x44c25e){_0x3f7d7b[_0x30a1('0x1b')]=_0x44c25e;if(_0x2ccdd9['query'][_0x30a1('0x38')]){_0x585455[_0x30a1('0x39')]=[{'all':!![]}];}return db[_0x30a1('0x27')][_0x30a1('0x3a')](_0x585455);})[_0x30a1('0x21')](function(_0x1d2e96){_0x3f7d7b[_0x30a1('0x3b')]=_0x1d2e96;return _0x3f7d7b;})[_0x30a1('0x21')](respondWithFilteredResult(_0x13b45e,_0x585455))['catch'](handleError(_0x13b45e,null));};exports[_0x30a1('0x3c')]=function(_0x178183,_0x4a4023){var _0x1dbe5c={'raw':!![],'where':{'id':_0x178183['params']['id']}},_0x38cf70={};_0x38cf70[_0x30a1('0x2f')]=_['keys'](db['CmHopperHistory'][_0x30a1('0x28')]);_0x38cf70[_0x30a1('0x2b')]=_[_0x30a1('0x2c')](_0x178183[_0x30a1('0x2b')]);_0x38cf70[_0x30a1('0x2d')]=_['intersection'](_0x38cf70[_0x30a1('0x2f')],_0x38cf70[_0x30a1('0x2b')]);_0x1dbe5c[_0x30a1('0x2e')]=_[_0x30a1('0x3d')](_0x38cf70[_0x30a1('0x2f')],qs[_0x30a1('0x30')](_0x178183[_0x30a1('0x2b')]['fields']));_0x1dbe5c['attributes']=_0x1dbe5c['attributes'][_0x30a1('0x3e')]?_0x1dbe5c[_0x30a1('0x2e')]:_0x38cf70['model'];if(_0x178183['query'][_0x30a1('0x38')]){_0x1dbe5c[_0x30a1('0x39')]=[{'all':!![]}];}_0x1dbe5c=_[_0x30a1('0x37')]({},_0x1dbe5c,_0x178183[_0x30a1('0x3f')]);return db[_0x30a1('0x27')][_0x30a1('0x40')](_0x1dbe5c)[_0x30a1('0x21')](handleEntityNotFound(_0x4a4023,null))[_0x30a1('0x21')](respondWithResult(_0x4a4023,null))[_0x30a1('0x41')](handleError(_0x4a4023,null));};exports[_0x30a1('0x42')]=function(_0x227292,_0x314776){return db[_0x30a1('0x27')][_0x30a1('0x42')](_0x227292['body'],{})[_0x30a1('0x21')](respondWithResult(_0x314776,0xc9))[_0x30a1('0x41')](handleError(_0x314776,null));};exports[_0x30a1('0x43')]=function(_0x118d6d,_0x503ee7){return db[_0x30a1('0x27')][_0x30a1('0x43')]()['then'](respondWithResult(_0x503ee7,null))['catch'](handleError(_0x503ee7,null));};exports[_0x30a1('0x20')]=function(_0x546c4e,_0x38274c){if(_0x546c4e[_0x30a1('0x44')][_0x30a1('0x45')]){delete _0x546c4e[_0x30a1('0x44')]['uniqueid'];}return db[_0x30a1('0x27')][_0x30a1('0x40')]({'where':{'uniqueid':_0x546c4e['params']['id']}})[_0x30a1('0x21')](handleEntityNotFound(_0x38274c,null))[_0x30a1('0x21')](saveUpdates(_0x546c4e[_0x30a1('0x44')],null))[_0x30a1('0x21')](respondWithResult(_0x38274c,null))[_0x30a1('0x41')](handleError(_0x38274c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 402306c..384d18a 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 _0xfc4f=['bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','util','../../config/logger','api','moment'];(function(_0xc853e,_0x1d1da1){var _0x2ffae2=function(_0x259c20){while(--_0x259c20){_0xc853e['push'](_0xc853e['shift']());}};_0x2ffae2(++_0x1d1da1);}(_0xfc4f,0x192));var _0xffc4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfc4f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xffc4('0x0'));var logger=require(_0xffc4('0x1'))(_0xffc4('0x2'));var moment=require(_0xffc4('0x3'));var BPromise=require(_0xffc4('0x4'));var rp=require(_0xffc4('0x5'));var fs=require('fs');var path=require(_0xffc4('0x6'));var rimraf=require('rimraf');var config=require(_0xffc4('0x7'));var attributes=require(_0xffc4('0x8'));module[_0xffc4('0x9')]=function(_0x2efa5f,_0x4cd469){return _0x2efa5f[_0xffc4('0xa')](_0xffc4('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xffc4('0xc'),'fields':[_0xffc4('0xc')]},{'name':_0xffc4('0xd'),'fields':[_0xffc4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc7a=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x1c5cd7,_0x2f1080){var _0x238f34=function(_0x3bc223){while(--_0x3bc223){_0x1c5cd7['push'](_0x1c5cd7['shift']());}};_0x238f34(++_0x2f1080);}(_0xbc7a,0xa4));var _0xabc7=function(_0xe84886,_0x533156){_0xe84886=_0xe84886-0x0;var _0x2bf18f=_0xbc7a[_0xe84886];return _0x2bf18f;};'use strict';var _=require(_0xabc7('0x0'));var util=require(_0xabc7('0x1'));var logger=require(_0xabc7('0x2'))('api');var moment=require(_0xabc7('0x3'));var BPromise=require(_0xabc7('0x4'));var rp=require(_0xabc7('0x5'));var fs=require('fs');var path=require(_0xabc7('0x6'));var rimraf=require(_0xabc7('0x7'));var config=require(_0xabc7('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0xabc7('0x9')]=function(_0xc4f32a,_0x3a5248){return _0xc4f32a[_0xabc7('0xa')](_0xabc7('0xb'),attributes,{'tableName':_0xabc7('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xabc7('0xd')]},{'name':'uniqueid','fields':[_0xabc7('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 d66e6de..81ce5d5 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 _0x94ca=['name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CmHopperHistory','create','body','options','raw','then','CreateCmHopperHistory','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory'];(function(_0x46bec7,_0xc6e95f){var _0x46be32=function(_0x366044){while(--_0x366044){_0x46bec7['push'](_0x46bec7['shift']());}};_0x46be32(++_0xc6e95f);}(_0x94ca,0xde));var _0xa94c=function(_0xbbeaac,_0x2da9a0){_0xbbeaac=_0xbbeaac-0x0;var _0x11ca51=_0x94ca[_0xbbeaac];return _0x11ca51;};'use strict';var _=require(_0xa94c('0x0'));var util=require(_0xa94c('0x1'));var moment=require(_0xa94c('0x2'));var BPromise=require(_0xa94c('0x3'));var rs=require(_0xa94c('0x4'));var fs=require('fs');var Redis=require(_0xa94c('0x5'));var db=require(_0xa94c('0x6'))['db'];var utils=require(_0xa94c('0x7'));var logger=require(_0xa94c('0x8'))(_0xa94c('0x9'));var config=require(_0xa94c('0xa'));var jayson=require(_0xa94c('0xb'));var client=jayson[_0xa94c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14111f,_0x14766b,_0x421883){return new BPromise(function(_0x46f724,_0x579f29){return client['request'](_0x14111f,_0x421883)['then'](function(_0x5dcf28){logger[_0xa94c('0xd')](_0xa94c('0xe'),_0x14766b,'request\x20sent');logger[_0xa94c('0xf')](_0xa94c('0x10'),_0x14766b,_0xa94c('0x11'),JSON[_0xa94c('0x12')](_0x5dcf28));if(_0x5dcf28[_0xa94c('0x13')]){if(_0x5dcf28[_0xa94c('0x13')]['code']===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x14766b,_0x5dcf28[_0xa94c('0x13')][_0xa94c('0x14')]);return _0x579f29(_0x5dcf28[_0xa94c('0x13')][_0xa94c('0x14')]);}logger[_0xa94c('0x13')](_0xa94c('0xe'),_0x14766b,_0x5dcf28[_0xa94c('0x13')][_0xa94c('0x14')]);return _0x46f724(_0x5dcf28[_0xa94c('0x13')]['message']);}else{logger[_0xa94c('0xd')](_0xa94c('0xe'),_0x14766b,_0xa94c('0x11'));_0x46f724(_0x5dcf28[_0xa94c('0x15')]['message']);}})[_0xa94c('0x16')](function(_0x2ff7aa){logger[_0xa94c('0x13')](_0xa94c('0xe'),_0x14766b,_0x2ff7aa);_0x579f29(_0x2ff7aa);});});}exports['CreateCmHopperHistory']=function(_0x4c9867){var _0xadb156=this;return new Promise(function(_0x2aadc3,_0x4cefe3){return db[_0xa94c('0x17')][_0xa94c('0x18')](_0x4c9867[_0xa94c('0x19')],{'raw':_0x4c9867[_0xa94c('0x1a')]?_0x4c9867[_0xa94c('0x1a')][_0xa94c('0x1b')]===undefined?!![]:![]:!![]})[_0xa94c('0x1c')](function(_0x3b925c){logger[_0xa94c('0xd')](_0xa94c('0x1d'),_0x4c9867);logger[_0xa94c('0xf')](_0xa94c('0x1d'),_0x4c9867,JSON[_0xa94c('0x12')](_0x3b925c));_0x2aadc3(_0x3b925c);})['catch'](function(_0x52f0db){logger['error']('CreateCmHopperHistory',_0x52f0db[_0xa94c('0x14')],_0x4c9867);_0x4cefe3(_0xadb156[_0xa94c('0x13')](0x1f4,_0x52f0db[_0xa94c('0x14')]));});});};exports['AvgHandleTime']=function(_0x2be2fe){var _0x3164e8=this;return new Promise(function(_0x102e4a,_0x48c9bd){return db['CmHopperHistory'][_0xa94c('0x1e')]({'raw':_0x2be2fe[_0xa94c('0x1a')]?_0x2be2fe[_0xa94c('0x1a')][_0xa94c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2be2fe['options']?_0x2be2fe[_0xa94c('0x1a')][_0xa94c('0x1f')]||null:null,'attributes':[[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db['sequelize'][_0xa94c('0x22')]('id')),_0xa94c('0x23')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x25')))),_0xa94c('0x26')],[db[_0xa94c('0x20')]['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa94c('0x20')]['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db['sequelize'][_0xa94c('0x24')](_0xa94c('0x28')))),_0xa94c('0x29')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x2a'),db['sequelize']['fn']('IF',db[_0xa94c('0x20')]['literal'](_0xa94c('0x2b')))),_0xa94c('0x2c')],[db[_0xa94c('0x20')]['fn']('AVG',db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x2d')))),_0xa94c('0x2e')]]})[_0xa94c('0x1c')](function(_0x3f57ae){logger[_0xa94c('0xd')](_0xa94c('0x2f'),_0x2be2fe);logger[_0xa94c('0xf')](_0xa94c('0x2f'),_0x2be2fe,JSON[_0xa94c('0x12')](_0x3f57ae));_0x102e4a(_0x3f57ae);})[_0xa94c('0x16')](function(_0x40116f){logger[_0xa94c('0x13')](_0xa94c('0x2f'),_0x40116f[_0xa94c('0x14')],_0x2be2fe);_0x48c9bd(_0x3164e8[_0xa94c('0x13')](0x1f4,_0x40116f[_0xa94c('0x14')]));});});};exports[_0xa94c('0x30')]=function(_0x32927f){var _0x48002d=this;return new Promise(function(_0x3354eb,_0x4f5ba8){return db['CmHopperHistory'][_0xa94c('0x1e')]({'raw':_0x32927f[_0xa94c('0x1a')]?_0x32927f[_0xa94c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x32927f[_0xa94c('0x1a')]?_0x32927f['options']['where']||null:null,'attributes':[[_0xa94c('0x31'),'name'],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x32')))),_0xa94c('0x33')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x34')))),_0xa94c('0x35')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x25')))),'outboundAnswerCallsDay'],[db[_0xa94c('0x20')]['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')]('`state`\x20=\x205,\x201,\x20null'))),_0xa94c('0x36')],[db['sequelize']['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db['sequelize'][_0xa94c('0x24')](_0xa94c('0x37')))),_0xa94c('0x38')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x39')))),'outboundDropCallsDayTimeout'],[db[_0xa94c('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa94c('0x24')](_0xa94c('0x3a')))),_0xa94c('0x3b')],[db[_0xa94c('0x20')]['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x3c')))),_0xa94c('0x3d')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db['sequelize']['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x3e')))),_0xa94c('0x3f')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db['sequelize'][_0xa94c('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),_0xa94c('0x40')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db['sequelize']['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x41')))),_0xa94c('0x42')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x43')))),_0xa94c('0x40')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x44')))),'outboundReCallsDay']],'group':[_0xa94c('0x31')]})['then'](function(_0x26a231){logger['info'](_0xa94c('0x30'),_0x32927f);logger[_0xa94c('0xf')](_0xa94c('0x30'),_0x32927f,JSON['stringify'](_0x26a231));_0x3354eb(_0x26a231);})[_0xa94c('0x16')](function(_0x40330a){logger['error']('GetVoiceQueueHopperHistory',_0x40330a[_0xa94c('0x14')],_0x32927f);_0x4f5ba8(_0x48002d[_0xa94c('0x13')](0x1f4,_0x40330a[_0xa94c('0x14')]));});});};exports[_0xa94c('0x45')]=function(_0x121ebd){var _0xd220bc=this;return new Promise(function(_0x205b42,_0x4f48a1){return db['CmHopperHistory'][_0xa94c('0x1e')]({'raw':_0x121ebd[_0xa94c('0x1a')]?_0x121ebd[_0xa94c('0x1a')][_0xa94c('0x1b')]===undefined?!![]:![]:!![],'where':_0x121ebd[_0xa94c('0x1a')]?_0x121ebd[_0xa94c('0x1a')][_0xa94c('0x1f')]||null:null,'attributes':[[_0xa94c('0x31'),_0xa94c('0x46')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')][_0xa94c('0x22')]('id')),_0xa94c('0x47')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xa94c('0x48')]],'group':['campaign']})[_0xa94c('0x1c')](function(_0x4a3a36){logger[_0xa94c('0xd')](_0xa94c('0x45'),_0x121ebd);logger[_0xa94c('0xf')](_0xa94c('0x45'),_0x121ebd,JSON[_0xa94c('0x12')](_0x4a3a36));_0x205b42(_0x4a3a36);})[_0xa94c('0x16')](function(_0xa499e9){logger[_0xa94c('0x13')]('GetCampaignHopperHistory',_0xa499e9[_0xa94c('0x14')],_0x121ebd);_0x4f48a1(_0xd220bc[_0xa94c('0x13')](0x1f4,_0xa499e9[_0xa94c('0x14')]));});});}; \ No newline at end of file +var _0xc901=['request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','catch','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s'];(function(_0x4f6259,_0x35094b){var _0x35f1bb=function(_0x2ecb4e){while(--_0x2ecb4e){_0x4f6259['push'](_0x4f6259['shift']());}};_0x35f1bb(++_0x35094b);}(_0xc901,0x142));var _0x1c90=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc901[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x1c90('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c90('0x1'));var db=require(_0x1c90('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c90('0x3'))(_0x1c90('0x4'));var config=require(_0x1c90('0x5'));var jayson=require(_0x1c90('0x6'));var client=jayson[_0x1c90('0x7')][_0x1c90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x912860,_0x12c07d,_0x423cfb){return new BPromise(function(_0x19196f,_0x514386){return client[_0x1c90('0x9')](_0x912860,_0x423cfb)[_0x1c90('0xa')](function(_0x38cd18){logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));logger[_0x1c90('0xe')](_0x1c90('0xf'),_0x12c07d,'request\x20sent',JSON['stringify'](_0x38cd18));if(_0x38cd18[_0x1c90('0x10')]){if(_0x38cd18[_0x1c90('0x10')][_0x1c90('0x11')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x12c07d,_0x38cd18[_0x1c90('0x10')][_0x1c90('0x12')]);return _0x514386(_0x38cd18['error'][_0x1c90('0x12')]);}logger[_0x1c90('0x10')](_0x1c90('0xc'),_0x12c07d,_0x38cd18['error'][_0x1c90('0x12')]);return _0x19196f(_0x38cd18['error'][_0x1c90('0x12')]);}else{logger[_0x1c90('0xb')](_0x1c90('0xc'),_0x12c07d,_0x1c90('0xd'));_0x19196f(_0x38cd18['result'][_0x1c90('0x12')]);}})['catch'](function(_0x2d3c90){logger[_0x1c90('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x12c07d,_0x2d3c90);_0x514386(_0x2d3c90);});});}exports[_0x1c90('0x13')]=function(_0x4ec354){var _0x582246=this;return new Promise(function(_0x128bf0,_0x5dd488){return db[_0x1c90('0x14')][_0x1c90('0x15')](_0x4ec354[_0x1c90('0x16')],{'raw':_0x4ec354[_0x1c90('0x17')]?_0x4ec354['options'][_0x1c90('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x525997){logger[_0x1c90('0xb')](_0x1c90('0x13'),_0x4ec354);logger['debug'](_0x1c90('0x13'),_0x4ec354,JSON[_0x1c90('0x19')](_0x525997));_0x128bf0(_0x525997);})[_0x1c90('0x1a')](function(_0x4074fd){logger[_0x1c90('0x10')](_0x1c90('0x13'),_0x4074fd['message'],_0x4ec354);_0x5dd488(_0x582246[_0x1c90('0x10')](0x1f4,_0x4074fd[_0x1c90('0x12')]));});});};exports[_0x1c90('0x1b')]=function(_0x33c88b){var _0x24539a=this;return new Promise(function(_0x26d55a,_0x4c3bb0){return db['CmHopperHistory'][_0x1c90('0x1c')]({'raw':_0x33c88b[_0x1c90('0x17')]?_0x33c88b[_0x1c90('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x33c88b[_0x1c90('0x17')]?_0x33c88b[_0x1c90('0x17')]['where']||null:null,'attributes':[[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db['sequelize'][_0x1c90('0x1f')]('id')),_0x1c90('0x20')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x23')))),_0x1c90('0x24')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x25')))),_0x1c90('0x26')],[db['sequelize']['fn'](_0x1c90('0x27'),db['sequelize']['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x27'),db['sequelize']['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x1c90('0x29')]]})[_0x1c90('0xa')](function(_0x99cda1){logger[_0x1c90('0xb')](_0x1c90('0x1b'),_0x33c88b);logger['debug']('AvgHandleTime',_0x33c88b,JSON['stringify'](_0x99cda1));_0x26d55a(_0x99cda1);})['catch'](function(_0x4f753a){logger[_0x1c90('0x10')](_0x1c90('0x1b'),_0x4f753a[_0x1c90('0x12')],_0x33c88b);_0x4c3bb0(_0x24539a['error'](0x1f4,_0x4f753a[_0x1c90('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0xd8038){var _0x9cf23d=this;return new Promise(function(_0x56278e,_0x59ddbe){return db[_0x1c90('0x14')][_0x1c90('0x1c')]({'raw':_0xd8038[_0x1c90('0x17')]?_0xd8038[_0x1c90('0x17')][_0x1c90('0x18')]===undefined?!![]:![]:!![],'where':_0xd8038[_0x1c90('0x17')]?_0xd8038[_0x1c90('0x17')]['where']||null:null,'attributes':[['campaign',_0x1c90('0x2a')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x2b')))),_0x1c90('0x2c')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db['sequelize']['fn']('IF',db[_0x1c90('0x1d')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x1c90('0x2d')],[db['sequelize']['fn']('COUNT',db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x22')))),_0x1c90('0x2e')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1c90('0x21')](_0x1c90('0x2f')))),'outboundBusyCallsDay'],[db[_0x1c90('0x1d')]['fn']('COUNT',db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x30')))),_0x1c90('0x31')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x32')))),_0x1c90('0x33')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db['sequelize']['fn']('IF',db[_0x1c90('0x1d')]['literal'](_0x1c90('0x34')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x35')))),_0x1c90('0x36')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x1c90('0x37')))),_0x1c90('0x38')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x39')))),'outboundOriginateFailureCallsDay'],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x1c90('0x3a')))),'outboundRejectCallsDay'],[db[_0x1c90('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x1c90('0x1d')]['fn']('COUNT',db[_0x1c90('0x1d')]['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')](_0x1c90('0x3b')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x1c90('0x1d')]['fn']('IF',db['sequelize'][_0x1c90('0x21')](_0x1c90('0x3c')))),'outboundReCallsDay']],'group':[_0x1c90('0x3d')]})['then'](function(_0x30ed2a){logger['info'](_0x1c90('0x3e'),_0xd8038);logger[_0x1c90('0xe')](_0x1c90('0x3e'),_0xd8038,JSON[_0x1c90('0x19')](_0x30ed2a));_0x56278e(_0x30ed2a);})['catch'](function(_0x1bc4a3){logger[_0x1c90('0x10')](_0x1c90('0x3e'),_0x1bc4a3[_0x1c90('0x12')],_0xd8038);_0x59ddbe(_0x9cf23d['error'](0x1f4,_0x1bc4a3[_0x1c90('0x12')]));});});};exports[_0x1c90('0x3f')]=function(_0x3f133a){var _0x1329cb=this;return new Promise(function(_0x522ccb,_0x23f8da){return db[_0x1c90('0x14')]['findAll']({'raw':_0x3f133a[_0x1c90('0x17')]?_0x3f133a[_0x1c90('0x17')][_0x1c90('0x18')]===undefined?!![]:![]:!![],'where':_0x3f133a['options']?_0x3f133a['options'][_0x1c90('0x40')]||null:null,'attributes':[['campaign',_0x1c90('0x2a')],[db[_0x1c90('0x1d')]['fn'](_0x1c90('0x1e'),db[_0x1c90('0x1d')][_0x1c90('0x1f')]('id')),_0x1c90('0x41')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1c90('0x1d')][_0x1c90('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x1c90('0x42')]],'group':[_0x1c90('0x3d')]})[_0x1c90('0xa')](function(_0x2882c2){logger[_0x1c90('0xb')]('GetCampaignHopperHistory',_0x3f133a);logger[_0x1c90('0xe')](_0x1c90('0x3f'),_0x3f133a,JSON['stringify'](_0x2882c2));_0x522ccb(_0x2882c2);})[_0x1c90('0x1a')](function(_0xd8dd42){logger[_0x1c90('0x10')](_0x1c90('0x3f'),_0xd8dd42['message'],_0x3f133a);_0x23f8da(_0x1329cb[_0x1c90('0x10')](0x1f4,_0xd8dd42['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 6290221..0edd5eb 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 _0xf6d6=['./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2442b0,_0x21aca4){var _0x691afd=function(_0x2217d5){while(--_0x2217d5){_0x2442b0['push'](_0x2442b0['shift']());}};_0x691afd(++_0x21aca4);}(_0xf6d6,0x1a9));var _0x6f6d=function(_0x2d654a,_0x1c6ee0){_0x2d654a=_0x2d654a-0x0;var _0x1444d8=_0xf6d6[_0x2d654a];return _0x1444d8;};'use strict';var multer=require(_0x6f6d('0x0'));var util=require(_0x6f6d('0x1'));var path=require('path');var timeout=require(_0x6f6d('0x2'));var express=require(_0x6f6d('0x3'));var router=express[_0x6f6d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6f6d('0x5'));var config=require(_0x6f6d('0x6'));var controller=require(_0x6f6d('0x7'));router[_0x6f6d('0x8')]('/',auth['isAuthenticated'](),controller[_0x6f6d('0x9')]);router[_0x6f6d('0x8')](_0x6f6d('0xa'),auth[_0x6f6d('0xb')](),controller[_0x6f6d('0xc')]);router[_0x6f6d('0x8')](_0x6f6d('0xd'),auth[_0x6f6d('0xb')](),controller['show']);router['post']('/',auth[_0x6f6d('0xb')](),controller[_0x6f6d('0xe')]);router[_0x6f6d('0xf')](_0x6f6d('0xd'),auth['isAuthenticated'](),controller[_0x6f6d('0x10')]);module[_0x6f6d('0x11')]=router; \ No newline at end of file +var _0xaf9a=['./cmHopperHistory.controller','isAuthenticated','index','get','/:id','show','post','update','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaf9a,0x108));var _0xaaf9=function(_0x31f582,_0x523dc1){_0x31f582=_0x31f582-0x0;var _0x101031=_0xaf9a[_0x31f582];return _0x101031;};'use strict';var multer=require(_0xaaf9('0x0'));var util=require(_0xaaf9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaaf9('0x2'));var router=express[_0xaaf9('0x3')]();var fs_extra=require(_0xaaf9('0x4'));var auth=require(_0xaaf9('0x5'));var interaction=require(_0xaaf9('0x6'));var config=require(_0xaaf9('0x7'));var controller=require(_0xaaf9('0x8'));router['get']('/',auth[_0xaaf9('0x9')](),controller[_0xaaf9('0xa')]);router[_0xaaf9('0xb')]('/describe',auth[_0xaaf9('0x9')](),controller['describe']);router[_0xaaf9('0xb')](_0xaaf9('0xc'),auth[_0xaaf9('0x9')](),controller[_0xaaf9('0xd')]);router[_0xaaf9('0xe')]('/',auth[_0xaaf9('0x9')](),controller['create']);router['put'](_0xaaf9('0xc'),auth[_0xaaf9('0x9')](),controller[_0xaaf9('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 12559d9..1b0200b 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 _0xf8b2=['STRING','name','sequelize','exports'];(function(_0xdfb302,_0x3056b0){var _0x4c7735=function(_0x2d29cc){while(--_0x2d29cc){_0xdfb302['push'](_0xdfb302['shift']());}};_0x4c7735(++_0x3056b0);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x2aeb58,_0x575b09){_0x2aeb58=_0x2aeb58-0x0;var _0x1f5acc=_0xf8b2[_0x2aeb58];return _0x1f5acc;};'use strict';var Sequelize=require(_0x2f8b('0x0'));module[_0x2f8b('0x1')]={'name':{'type':Sequelize[_0x2f8b('0x2')],'unique':_0x2f8b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2f8b('0x2')]},'dialPrefix':{'type':Sequelize[_0x2f8b('0x2')]}}; \ No newline at end of file +var _0x4491=['STRING','sequelize'];(function(_0x28a139,_0x4e6bd5){var _0x2b67bd=function(_0x19d37d){while(--_0x19d37d){_0x28a139['push'](_0x28a139['shift']());}};_0x2b67bd(++_0x4e6bd5);}(_0x4491,0x1bb));var _0x1449=function(_0x12d848,_0x45a48e){_0x12d848=_0x12d848-0x0;var _0xb60a3b=_0x4491[_0x12d848];return _0xb60a3b;};'use strict';var Sequelize=require(_0x1449('0x0'));module['exports']={'name':{'type':Sequelize[_0x1449('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1449('0x1')]},'dialPrefix':{'type':Sequelize[_0x1449('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 71cc93d..6f0eaec 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 _0x068e=['cf_%d','getContactsCsv','concat','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','addCustomFields','Sequelize','TEXT','INTEGER','defaultValue','sequelize','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','count','includeAll','include','findAll','rows','catch','params','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','format'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0x068e,0x1cc));var _0xe068=function(_0x50d299,_0x53d765){_0x50d299=_0x50d299-0x0;var _0x2fa985=_0x068e[_0x50d299];return _0x2fa985;};'use strict';var emlformat=require(_0xe068('0x0'));var rimraf=require(_0xe068('0x1'));var zipdir=require(_0xe068('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe068('0x3'));var moment=require(_0xe068('0x4'));var BPromise=require(_0xe068('0x5'));var Mustache=require(_0xe068('0x6'));var util=require(_0xe068('0x7'));var path=require(_0xe068('0x8'));var sox=require(_0xe068('0x9'));var csv=require(_0xe068('0xa'));var ejs=require(_0xe068('0xb'));var fs=require('fs');var fs_extra=require(_0xe068('0xc'));var _=require(_0xe068('0xd'));var squel=require(_0xe068('0xe'));var crypto=require('crypto');var jsforce=require(_0xe068('0xf'));var deskjs=require(_0xe068('0x10'));var toCsv=require(_0xe068('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe068('0x11'));var authService=require(_0xe068('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe068('0x13'));var hardwareService=require(_0xe068('0x14'));var logger=require(_0xe068('0x15'))(_0xe068('0x16'));var utils=require('../../config/utils');var config=require(_0xe068('0x17'));var licenseUtil=require(_0xe068('0x18'));var db=require(_0xe068('0x19'))['db'];config['redis']=_['defaults'](config[_0xe068('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe068('0x1b'))(new Redis(config['redis']));require(_0xe068('0x1c'))[_0xe068('0x1d')](socket);function respondWithStatusCode(_0x588bdd,_0x53a352){_0x53a352=_0x53a352||0xcc;return function(_0x5e9f25){if(_0x5e9f25){return _0x588bdd[_0xe068('0x1e')](_0x53a352);}return _0x588bdd[_0xe068('0x1f')](_0x53a352)['end']();};}function respondWithResult(_0x4cdd8c,_0x24a1d7){_0x24a1d7=_0x24a1d7||0xc8;return function(_0x9f5e52){if(_0x9f5e52){return _0x4cdd8c[_0xe068('0x1f')](_0x24a1d7)['json'](_0x9f5e52);}};}function respondWithFilteredResult(_0x1e005c,_0x1a833e){return function(_0x2cd1e4){if(_0x2cd1e4){var _0x48d7ff=typeof _0x1a833e[_0xe068('0x20')]===_0xe068('0x21')&&typeof _0x1a833e[_0xe068('0x22')]===_0xe068('0x21');var _0x2b026d=_0x2cd1e4['count'];var _0x1fa548=_0x48d7ff?0x0:_0x1a833e[_0xe068('0x20')];var _0x339a76=_0x48d7ff?_0x2cd1e4['count']:_0x1a833e['offset']+_0x1a833e['limit'];var _0x30251b;if(_0x339a76>=_0x2b026d){_0x339a76=_0x2b026d;_0x30251b=0xc8;}else{_0x30251b=0xce;}_0x1e005c['status'](_0x30251b);return _0x1e005c['set'](_0xe068('0x23'),_0x1fa548+'-'+_0x339a76+'/'+_0x2b026d)[_0xe068('0x24')](_0x2cd1e4);}return null;};}function patchUpdates(_0x3a18af){return function(_0x236e95){try{jsonpatch[_0xe068('0x25')](_0x236e95,_0x3a18af,!![]);}catch(_0x2a3eae){return BPromise[_0xe068('0x26')](_0x2a3eae);}return _0x236e95[_0xe068('0x27')]();};}function saveUpdates(_0x395801,_0x92b653){return function(_0x2cb2b9){if(_0x2cb2b9){return _0x2cb2b9[_0xe068('0x28')](_0x395801)[_0xe068('0x29')](function(_0x1312d2){return _0x1312d2;});}return null;};}function removeEntity(_0x332da3,_0xaaefcc){return function(_0x248484){if(_0x248484){return _0x248484[_0xe068('0x2a')]()[_0xe068('0x29')](function(){var _0x4653f5=_0x248484[_0xe068('0x2b')]({'plain':!![]});var _0x38a042=_0xe068('0x2c');return db[_0xe068('0x2d')][_0xe068('0x2a')]({'where':{'type':_0x38a042,'resourceId':_0x4653f5['id']}})[_0xe068('0x29')](function(){return _0x248484;});})[_0xe068('0x29')](function(){_0x332da3[_0xe068('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5013c9,_0x44c88d){return function(_0x1f4856){if(!_0x1f4856){_0x5013c9['sendStatus'](0x194);}return _0x1f4856;};}function handleError(_0x164257,_0x2621dd){_0x2621dd=_0x2621dd||0x1f4;return function(_0x4a4de5){logger[_0xe068('0x2e')](_0x4a4de5[_0xe068('0x2f')]);if(_0x4a4de5[_0xe068('0x30')]){delete _0x4a4de5[_0xe068('0x30')];}_0x164257[_0xe068('0x1f')](_0x2621dd)[_0xe068('0x31')](_0x4a4de5);};}exports[_0xe068('0x32')]=function(_0x4dd1c9,_0x5302a2){var _0x3f9d4c={},_0x4818a7={},_0x41561e={'count':0x0,'rows':[]};var _0x52dc06=_[_0xe068('0x33')](db[_0xe068('0x34')][_0xe068('0x35')],function(_0x141424){return{'name':_0x141424['fieldName'],'type':_0x141424[_0xe068('0x36')][_0xe068('0x37')]};});_0x4818a7[_0xe068('0x38')]=_[_0xe068('0x33')](_0x52dc06,_0xe068('0x30'));_0x4818a7[_0xe068('0x39')]=_[_0xe068('0x3a')](_0x4dd1c9[_0xe068('0x39')]);_0x4818a7[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x4818a7[_0xe068('0x38')],_0x4818a7['query']);_0x3f9d4c[_0xe068('0x3d')]=_[_0xe068('0x3c')](_0x4818a7['model'],qs[_0xe068('0x3e')](_0x4dd1c9[_0xe068('0x39')][_0xe068('0x3e')]));_0x3f9d4c[_0xe068('0x3d')]=_0x3f9d4c['attributes'][_0xe068('0x3f')]?_0x3f9d4c[_0xe068('0x3d')]:_0x4818a7['model'];if(!_0x4dd1c9[_0xe068('0x39')][_0xe068('0x40')]('nolimit')){_0x3f9d4c['limit']=qs['limit'](_0x4dd1c9['query'][_0xe068('0x22')]);_0x3f9d4c['offset']=qs[_0xe068('0x20')](_0x4dd1c9[_0xe068('0x39')][_0xe068('0x20')]);}_0x3f9d4c[_0xe068('0x41')]=qs[_0xe068('0x42')](_0x4dd1c9[_0xe068('0x39')][_0xe068('0x42')]);_0x3f9d4c[_0xe068('0x43')]=qs[_0xe068('0x3b')](_[_0xe068('0x44')](_0x4dd1c9[_0xe068('0x39')],_0x4818a7[_0xe068('0x3b')]),_0x52dc06);if(_0x4dd1c9[_0xe068('0x39')][_0xe068('0x45')]){_0x3f9d4c[_0xe068('0x43')]=_['merge'](_0x3f9d4c[_0xe068('0x43')],{'$or':_[_0xe068('0x33')](_0x52dc06,function(_0x164ebb){if(_0x164ebb['type']!=='VIRTUAL'){var _0x80e309={};_0x80e309[_0x164ebb[_0xe068('0x30')]]={'$like':'%'+_0x4dd1c9[_0xe068('0x39')]['filter']+'%'};return _0x80e309;}})});}_0x3f9d4c=_['merge']({},_0x3f9d4c,_0x4dd1c9[_0xe068('0x46')]);var _0x6f2284={'where':_0x3f9d4c['where']};return db[_0xe068('0x34')]['count'](_0x6f2284)[_0xe068('0x29')](function(_0x348ca6){_0x41561e[_0xe068('0x47')]=_0x348ca6;if(_0x4dd1c9[_0xe068('0x39')][_0xe068('0x48')]){_0x3f9d4c[_0xe068('0x49')]=[{'all':!![]}];}return db['CmList'][_0xe068('0x4a')](_0x3f9d4c);})['then'](function(_0x28add5){_0x41561e[_0xe068('0x4b')]=_0x28add5;return _0x41561e;})[_0xe068('0x29')](respondWithFilteredResult(_0x5302a2,_0x3f9d4c))[_0xe068('0x4c')](handleError(_0x5302a2,null));};exports['show']=function(_0x577cc6,_0x457f20){var _0xdf6a05={'raw':![],'where':{'id':_0x577cc6[_0xe068('0x4d')]['id']}},_0x4672ad={};_0x4672ad['model']=_[_0xe068('0x3a')](db[_0xe068('0x34')][_0xe068('0x35')]);_0x4672ad['query']=_[_0xe068('0x3a')](_0x577cc6['query']);_0x4672ad[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x4672ad['model'],_0x4672ad['query']);_0xdf6a05['attributes']=_[_0xe068('0x3c')](_0x4672ad['model'],qs[_0xe068('0x3e')](_0x577cc6['query'][_0xe068('0x3e')]));_0xdf6a05['attributes']=_0xdf6a05[_0xe068('0x3d')][_0xe068('0x3f')]?_0xdf6a05[_0xe068('0x3d')]:_0x4672ad[_0xe068('0x38')];if(_0x577cc6[_0xe068('0x39')][_0xe068('0x48')]){_0xdf6a05['include']=[{'all':!![]}];}_0xdf6a05=_[_0xe068('0x4e')]({},_0xdf6a05,_0x577cc6[_0xe068('0x46')]);return db['CmList']['find'](_0xdf6a05)[_0xe068('0x29')](handleEntityNotFound(_0x457f20,null))[_0xe068('0x29')](respondWithResult(_0x457f20,null))[_0xe068('0x4c')](handleError(_0x457f20,null));};exports[_0xe068('0x4f')]=function(_0x2fe48b,_0x623fed){return db[_0xe068('0x34')][_0xe068('0x4f')](_0x2fe48b[_0xe068('0x50')],{})[_0xe068('0x29')](function(_0x5a2c65){var _0x46d197=_0x2fe48b['user'][_0xe068('0x2b')]({'plain':!![]});if(!_0x46d197)throw new Error(_0xe068('0x51'));if(_0x46d197[_0xe068('0x52')]===_0xe068('0x53')){var _0x27ef84=_0x5a2c65[_0xe068('0x2b')]({'plain':!![]});var _0x20d785=_0xe068('0x2c');return db[_0xe068('0x54')][_0xe068('0x55')]({'where':{'name':_0x20d785,'userProfileId':_0x46d197[_0xe068('0x56')]},'raw':!![]})[_0xe068('0x29')](function(_0x1f5047){if(_0x1f5047&&_0x1f5047['autoAssociation']===0x0){return db[_0xe068('0x2d')][_0xe068('0x4f')]({'name':_0x27ef84[_0xe068('0x30')],'resourceId':_0x27ef84['id'],'type':_0x1f5047[_0xe068('0x30')],'sectionId':_0x1f5047['id']},{})[_0xe068('0x29')](function(){return _0x5a2c65;});}else{return _0x5a2c65;}})[_0xe068('0x4c')](function(_0x391085){logger[_0xe068('0x2e')](_0xe068('0x57'),_0x391085);throw _0x391085;});}return _0x5a2c65;})[_0xe068('0x29')](respondWithResult(_0x623fed,0xc9))[_0xe068('0x4c')](handleError(_0x623fed,null));};exports[_0xe068('0x28')]=function(_0x4938bb,_0x5c5733){if(_0x4938bb[_0xe068('0x50')]['id']){delete _0x4938bb[_0xe068('0x50')]['id'];}return db[_0xe068('0x34')]['find']({'where':{'id':_0x4938bb[_0xe068('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c5733,null))['then'](saveUpdates(_0x4938bb[_0xe068('0x50')],null))[_0xe068('0x29')](respondWithResult(_0x5c5733,null))[_0xe068('0x4c')](handleError(_0x5c5733,null));};exports[_0xe068('0x2a')]=function(_0x4252a6,_0x500188){return db[_0xe068('0x34')]['find']({'where':{'id':_0x4252a6['params']['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x500188,null))[_0xe068('0x29')](removeEntity(_0x500188,null))[_0xe068('0x4c')](handleError(_0x500188,null));};exports[_0xe068('0x58')]=function(_0x431ae8,_0x2c82c2){return db['CmList']['describe']()[_0xe068('0x29')](respondWithResult(_0x2c82c2,null))['catch'](handleError(_0x2c82c2,null));};exports[_0xe068('0x59')]=function(_0xb45e33,_0x447645,_0x1c1f73){if(_0xb45e33[_0xe068('0x50')]['id']){delete _0xb45e33[_0xe068('0x50')]['id'];}return db[_0xe068('0x34')][_0xe068('0x55')]({'where':{'id':_0xb45e33[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x447645,null))[_0xe068('0x29')](function(_0x5b4481){if(_0x5b4481){_0xb45e33[_0xe068('0x50')][_0xe068('0x5a')]=_0x5b4481['id'];return db[_0xe068('0x5b')][_0xe068('0x4f')](_0xb45e33[_0xe068('0x50')]);}})[_0xe068('0x29')](respondWithResult(_0x447645,null))['catch'](handleError(_0x447645,null));};exports[_0xe068('0x5c')]=function(_0x508bda,_0x1ca2fe,_0x571fcb){var _0x4df14b={'raw':![],'where':{}};var _0x4d76a8={};var _0x45db2f={'count':0x0,'rows':[]};return db[_0xe068('0x34')][_0xe068('0x5d')]({'where':{'id':_0x508bda[_0xe068('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ca2fe,null))[_0xe068('0x29')](function(_0x4f34e6){if(_0x4f34e6){_0x4d76a8[_0xe068('0x38')]=_[_0xe068('0x3a')](db[_0xe068('0x5b')][_0xe068('0x35')]);_0x4d76a8[_0xe068('0x39')]=_[_0xe068('0x3a')](_0x508bda[_0xe068('0x39')]);_0x4d76a8[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x4d76a8['model'],_0x4d76a8['query']);_0x4df14b[_0xe068('0x3d')]=_[_0xe068('0x3c')](_0x4d76a8[_0xe068('0x38')],qs['fields'](_0x508bda[_0xe068('0x39')][_0xe068('0x3e')]));_0x4df14b[_0xe068('0x3d')]=_0x4df14b[_0xe068('0x3d')][_0xe068('0x3f')]?_0x4df14b[_0xe068('0x3d')]:_0x4d76a8[_0xe068('0x38')];if(!_0x508bda['query'][_0xe068('0x40')](_0xe068('0x5e'))){_0x4df14b[_0xe068('0x22')]=qs[_0xe068('0x22')](_0x508bda['query'][_0xe068('0x22')]);_0x4df14b[_0xe068('0x20')]=qs[_0xe068('0x20')](_0x508bda[_0xe068('0x39')]['offset']);}_0x4df14b[_0xe068('0x41')]=qs[_0xe068('0x42')](_0x508bda[_0xe068('0x39')][_0xe068('0x42')]);_0x4df14b[_0xe068('0x43')]=qs[_0xe068('0x3b')](_[_0xe068('0x44')](_0x508bda[_0xe068('0x39')],_0x4d76a8['filters']));_0x4df14b[_0xe068('0x43')][_0xe068('0x5a')]=_0x4f34e6['id'];if(_0x508bda['query'][_0xe068('0x45')]){_0x4df14b[_0xe068('0x43')]=_[_0xe068('0x4e')](_0x4df14b[_0xe068('0x43')],{'$or':_[_0xe068('0x33')](_0x4df14b[_0xe068('0x3d')],function(_0x15bc28){var _0xd7e451={};_0xd7e451[_0x15bc28]={'$like':'%'+_0x508bda[_0xe068('0x39')][_0xe068('0x45')]+'%'};return _0xd7e451;})});}_0x4df14b=_[_0xe068('0x4e')]({},_0x4df14b,_0x508bda['options']);return db['Disposition'][_0xe068('0x47')]({'where':_0x4df14b['where']})['then'](function(_0x1cf522){_0x45db2f[_0xe068('0x47')]=_0x1cf522;if(_0x508bda[_0xe068('0x39')][_0xe068('0x48')]){_0x4df14b[_0xe068('0x49')]=[{'all':!![]}];}return db[_0xe068('0x5b')][_0xe068('0x4a')](_0x4df14b);})[_0xe068('0x29')](function(_0x422dc1){_0x45db2f[_0xe068('0x4b')]=_0x422dc1;return _0x45db2f;});}})['then'](respondWithFilteredResult(_0x1ca2fe,_0x4df14b))[_0xe068('0x4c')](handleError(_0x1ca2fe,null));};exports['removeDispositions']=function(_0xed7571,_0x397ba1,_0x23e2be){return db[_0xe068('0x34')]['find']({'where':{'id':_0xed7571[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x397ba1,null))[_0xe068('0x29')](function(_0x4c73af){if(_0x4c73af){return _0x4c73af[_0xe068('0x5f')](_0xed7571[_0xe068('0x39')][_0xe068('0x60')]);}})[_0xe068('0x29')](respondWithStatusCode(_0x397ba1,null))[_0xe068('0x4c')](handleError(_0x397ba1,null));};exports[_0xe068('0x61')]=function(_0x1d260e,_0x4f6221,_0x16c917){return db[_0xe068('0x34')][_0xe068('0x55')]({'where':{'id':_0x1d260e[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x4f6221,null))[_0xe068('0x29')](function(_0x313941){if(_0x313941){var _0x34d40f=[];var _0x575f6b={'success':[],'errors':[]};return db[_0xe068('0x62')][_0xe068('0x58')]()['then'](function(_0x40b877){if(_0x1d260e['body'][_0xe068('0x63')]&&_[_0xe068('0x64')](_0x1d260e[_0xe068('0x50')]['tags'])){if(_0x1d260e[_0xe068('0x50')][_0xe068('0x63')][_0xe068('0x3f')]){_0x1d260e['body'][_0xe068('0x63')]=_0x1d260e['body'][_0xe068('0x63')]['join'](';')+';';}else{_0x1d260e[_0xe068('0x50')][_0xe068('0x63')]=null;}}else{_0x1d260e[_0xe068('0x50')]['tags']=null;}if(_0x1d260e['body']&&_[_0xe068('0x64')](_0x1d260e[_0xe068('0x50')])){for(var _0x120023=0x0;_0x120023<_0x1d260e[_0xe068('0x50')][_0xe068('0x3f')];_0x120023+=0x1){_0x1d260e[_0xe068('0x50')][_0x120023][_0xe068('0x5a')]=_0x1d260e[_0xe068('0x4d')]['id'];_0x34d40f[_0xe068('0x65')](_0x1d260e[_0xe068('0x50')][_0x120023]);}return BPromise[_0xe068('0x66')](_0x34d40f,function(_0x2bdf51){return db[_0xe068('0x62')][_0xe068('0x4f')](_[_0xe068('0x67')](_0x2bdf51,[_0xe068('0x60'),'id'])||{},{'fields':_[_0xe068('0x3a')](_0x40b877),'raw':!![]})['then'](function(_0x7aa663){_0x575f6b[_0xe068('0x68')][_0xe068('0x65')](_0x7aa663[_0xe068('0x69')]);})[_0xe068('0x4c')](function(_0x5a4fd1){_0x575f6b[_0xe068('0x6a')][_0xe068('0x65')]({'data':_0x2bdf51,'error':_0x5a4fd1[_0xe068('0x6b')]});});})[_0xe068('0x29')](function(_0x57726d){return _0x575f6b;})[_0xe068('0x4c')](function(_0x2f15f2){return _0x2f15f2;});}else{_0x4f6221[_0xe068('0x1f')](0x190)[_0xe068('0x24')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x4f6221,null))[_0xe068('0x4c')](handleError(_0x4f6221,null));};exports[_0xe068('0x6c')]=function(_0x434ece,_0x123c43,_0x3781e2){var _0x1bc03f;return db['CmList'][_0xe068('0x55')]({'where':{'id':_0x434ece[_0xe068('0x4d')]['id']},'include':[{'model':db[_0xe068('0x6d')],'as':_0xe068('0x6e')}]})[_0xe068('0x29')](handleEntityNotFound(_0x123c43,null))[_0xe068('0x29')](function(_0x2d581f){if(_0x2d581f){_0x1bc03f=_0x2d581f;return db[_0xe068('0x62')][_0xe068('0x35')];}})[_0xe068('0x29')](function(_0xc6ecfb){if(_0xc6ecfb){var _0x90d9ab={};var _0x4c5517={};_0x4c5517[_0xe068('0x38')]=_['concat'](_[_0xe068('0x3a')](_0xc6ecfb),_[_0xe068('0x33')](_0x1bc03f['CustomFields'],function(_0x155ba1){return util[_0xe068('0x6f')](_0xe068('0x70'),_0x155ba1['id']);}));_0x4c5517['query']=_['keys'](_0x434ece[_0xe068('0x39')]);_0x4c5517[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x4c5517[_0xe068('0x38')],_0x4c5517['query']);_0x90d9ab['attributes']=_['intersection'](_0x4c5517[_0xe068('0x38')],qs['fields'](_0x434ece['query'][_0xe068('0x3e')]));_0x90d9ab[_0xe068('0x3d')]=_0x90d9ab[_0xe068('0x3d')][_0xe068('0x3f')]?_0x90d9ab['attributes']:_0x4c5517[_0xe068('0x38')];if(!_0x434ece['query'][_0xe068('0x40')]('nolimit')){_0x90d9ab[_0xe068('0x22')]=qs[_0xe068('0x22')](_0x434ece[_0xe068('0x39')][_0xe068('0x22')]);_0x90d9ab[_0xe068('0x20')]=qs[_0xe068('0x20')](_0x434ece[_0xe068('0x39')][_0xe068('0x20')]);}_0x90d9ab['order']=qs[_0xe068('0x42')](_0x434ece['query'][_0xe068('0x42')]);_0x90d9ab[_0xe068('0x43')]=qs['filters'](_[_0xe068('0x44')](_0x434ece['query'],_0x4c5517[_0xe068('0x3b')]));_0x90d9ab['raw']=!![];if(_0x434ece['query'][_0xe068('0x45')]){_0x90d9ab[_0xe068('0x43')]=_[_0xe068('0x4e')](_0x90d9ab[_0xe068('0x43')],{'$or':_[_0xe068('0x33')](_0x90d9ab[_0xe068('0x3d')],function(_0x294952){var _0x1ea672={};_0x1ea672[_0x294952]={'$like':'%'+_0x434ece['query'][_0xe068('0x45')]+'%'};return _0x1ea672;})});}_0x90d9ab=_['merge']({},_0x90d9ab,_0x434ece[_0xe068('0x46')]);return _0x1bc03f[_0xe068('0x6c')](_0x90d9ab);}})[_0xe068('0x29')](respondWithResult(_0x123c43,null))['catch'](handleError(_0x123c43,null));};exports[_0xe068('0x71')]=function(_0x31ade8,_0xc18eb9,_0x59e7f0){var _0x188d7b;return db[_0xe068('0x34')]['find']({'where':{'id':_0x31ade8[_0xe068('0x4d')]['id']},'include':[{'model':db[_0xe068('0x6d')],'as':_0xe068('0x6e')}]})[_0xe068('0x29')](handleEntityNotFound(_0xc18eb9,null))[_0xe068('0x29')](function(_0xb7b3bd){if(_0xb7b3bd){_0x188d7b=_0xb7b3bd;return db['CmContact'][_0xe068('0x35')];}})['then'](function(_0x3efeea){if(_0x3efeea){var _0x6c73bd={};var _0x17e7cf={};_0x17e7cf[_0xe068('0x38')]=_[_0xe068('0x72')](_[_0xe068('0x3a')](_0x3efeea),_[_0xe068('0x33')](_0x188d7b[_0xe068('0x6e')],function(_0x423eb9){return util[_0xe068('0x6f')]('cf_%d',_0x423eb9['id']);}));_0x17e7cf['query']=_[_0xe068('0x3a')](_0x31ade8[_0xe068('0x39')]);_0x17e7cf[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x17e7cf[_0xe068('0x38')],_0x17e7cf[_0xe068('0x39')]);_0x6c73bd[_0xe068('0x3d')]=_[_0xe068('0x3c')](_0x17e7cf[_0xe068('0x38')],qs[_0xe068('0x3e')](_0x31ade8[_0xe068('0x39')][_0xe068('0x3e')]));_0x6c73bd['attributes']=_0x6c73bd[_0xe068('0x3d')][_0xe068('0x3f')]?_0x6c73bd[_0xe068('0x3d')]:_0x17e7cf['model'];if(!_0x31ade8[_0xe068('0x39')][_0xe068('0x40')](_0xe068('0x5e'))){_0x6c73bd[_0xe068('0x22')]=qs['limit'](_0x31ade8[_0xe068('0x39')][_0xe068('0x22')]);_0x6c73bd['offset']=qs[_0xe068('0x20')](_0x31ade8['query'][_0xe068('0x20')]);}_0x6c73bd['order']=qs[_0xe068('0x42')](_0x31ade8[_0xe068('0x39')]['sort']);_0x6c73bd[_0xe068('0x43')]=qs[_0xe068('0x3b')](_['pick'](_0x31ade8[_0xe068('0x39')],_0x17e7cf[_0xe068('0x3b')]));_0x6c73bd[_0xe068('0x73')]=!![];if(_0x31ade8[_0xe068('0x39')][_0xe068('0x45')]){_0x6c73bd['where']=_[_0xe068('0x4e')](_0x6c73bd['where'],{'$or':_[_0xe068('0x33')](_0x6c73bd[_0xe068('0x3d')],function(_0x489a15){var _0x2bdb11={};_0x2bdb11[_0x489a15]={'$like':'%'+_0x31ade8['query'][_0xe068('0x45')]+'%'};return _0x2bdb11;})});}_0x6c73bd=_['merge']({},_0x6c73bd,_0x31ade8[_0xe068('0x46')]);return _0x188d7b['getContacts'](_0x6c73bd);}})[_0xe068('0x29')](function(_0x2aaa5e){if(!_[_0xe068('0x74')](_0x2aaa5e)){var _0x5d0bdd=toCsv(_0x2aaa5e);var _0x4ba2eb=Date[_0xe068('0x75')]();fs[_0xe068('0x76')](util['format'](_0xe068('0x77'),_0x188d7b['id'],_0x4ba2eb),_0x5d0bdd);_0xc18eb9['setHeader'](_0xe068('0x78'),_0xe068('0x79')+util[_0xe068('0x6f')](_0xe068('0x7a'),_0x188d7b['id'],_0x4ba2eb));_0xc18eb9[_0xe068('0x7b')](_0xe068('0x7c'),_0xe068('0x7d'));return _0xc18eb9['download'](util['format']('/tmp/list_%d_%s.csv',_0x188d7b['id'],_0x4ba2eb));}else{return _0xc18eb9['sendStatus'](0xcc);}})['catch'](handleError(_0xc18eb9,null));};exports['addCustomField']=function(_0x534738,_0x53cd26,_0x34ad2b){var _0x131cfe;delete _0x534738[_0xe068('0x50')]['id'];return db['CmList'][_0xe068('0x5d')]({'where':{'id':_0x534738[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x53cd26,null))[_0xe068('0x29')](function(_0x3d5651){if(_0x3d5651){return db['sequelize']['transaction'](function(_0x1cdd90){return db[_0xe068('0x6d')][_0xe068('0x4f')](_0x534738[_0xe068('0x50')],{'transaction':_0x1cdd90})[_0xe068('0x29')](function(_0x23276f){_0x131cfe=_0x23276f;return _0x3d5651[_0xe068('0x7e')](_0x23276f,{'transaction':_0x1cdd90});})[_0xe068('0x29')](function(){var _0x531294={'type':db[_0xe068('0x7f')][_0xe068('0x80')],'transaction':_0x1cdd90};switch(_0x534738[_0xe068('0x50')][_0xe068('0x36')]){case'text':_0x531294[_0xe068('0x36')]=db[_0xe068('0x7f')]['TEXT'];break;case'number':_0x531294[_0xe068('0x36')]=db['Sequelize'][_0xe068('0x81')];break;case'switch':_0x531294[_0xe068('0x36')]=db[_0xe068('0x7f')]['BOOLEAN'];_0x531294[_0xe068('0x82')]=![];break;default:}return db[_0xe068('0x83')]['queryInterface']['addColumn'](_0xe068('0x84'),util['format'](_0xe068('0x85'),_0x131cfe['id']),_0x531294);})[_0xe068('0x29')](function(){return _0x131cfe;});});}})[_0xe068('0x29')](respondWithResult(_0x53cd26,null))[_0xe068('0x4c')](handleError(_0x53cd26,null));};exports[_0xe068('0x86')]=function(_0x5136f5,_0xfe3f1d,_0x7c148a){var _0xdc57a8={};var _0x1b6d5a={};var _0x369334;var _0x52d449;return db[_0xe068('0x34')][_0xe068('0x5d')]({'where':{'id':_0x5136f5[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0xfe3f1d,null))['then'](function(_0x232e00){if(_0x232e00){_0x369334=_0x232e00;_0x1b6d5a[_0xe068('0x38')]=_[_0xe068('0x3a')](db[_0xe068('0x6d')][_0xe068('0x35')]);_0x1b6d5a['query']=_['keys'](_0x5136f5['query']);_0x1b6d5a[_0xe068('0x3b')]=_['intersection'](_0x1b6d5a[_0xe068('0x38')],_0x1b6d5a[_0xe068('0x39')]);_0xdc57a8[_0xe068('0x3d')]=_[_0xe068('0x3c')](_0x1b6d5a[_0xe068('0x38')],qs['fields'](_0x5136f5['query'][_0xe068('0x3e')]));_0xdc57a8[_0xe068('0x3d')]=_0xdc57a8[_0xe068('0x3d')][_0xe068('0x3f')]?_0xdc57a8[_0xe068('0x3d')]:_0x1b6d5a['model'];_0xdc57a8[_0xe068('0x41')]=qs[_0xe068('0x42')](_0x5136f5[_0xe068('0x39')][_0xe068('0x42')]);_0xdc57a8[_0xe068('0x43')]=qs['filters'](_[_0xe068('0x44')](_0x5136f5[_0xe068('0x39')],_0x1b6d5a[_0xe068('0x3b')]));_0xdc57a8[_0xe068('0x43')]=_[_0xe068('0x4e')](_0xdc57a8['where'],{'$or':[{'ListId':_0x232e00['id']},{'ListId':null}]});if(_0x5136f5[_0xe068('0x39')][_0xe068('0x45')]){_0xdc57a8['where']=_['merge'](_0xdc57a8['where'],{'$or':_[_0xe068('0x33')](_0xdc57a8['attributes'],function(_0x17306f){var _0x40b2cd={};_0x40b2cd[_0x17306f]={'$like':'%'+_0x5136f5[_0xe068('0x39')][_0xe068('0x45')]+'%'};return _0x40b2cd;})});}_0xdc57a8=_[_0xe068('0x4e')]({},_0xdc57a8,_0x5136f5[_0xe068('0x46')]);return db['CmCustomField'][_0xe068('0x87')](_0xdc57a8);}})[_0xe068('0x29')](respondWithResult(_0xfe3f1d,null))[_0xe068('0x4c')](handleError(_0xfe3f1d,null));};exports[_0xe068('0x88')]=function(_0x2448b8,_0x5d8f3e,_0x4c7f19){return db['CmList'][_0xe068('0x55')]({'where':{'id':_0x2448b8['params']['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x5d8f3e,null))[_0xe068('0x29')](function(_0x51ba64){if(_0x51ba64){return _0x51ba64[_0xe068('0x88')](_0x2448b8[_0xe068('0x50')]['ids'],_['omit'](_0x2448b8[_0xe068('0x50')],[_0xe068('0x60'),'id'])||{})[_0xe068('0x89')](function(_0x5974c8){for(var _0x436693=0x0;_0x436693<_0x2448b8[_0xe068('0x50')]['ids'][_0xe068('0x3f')];_0x436693+=0x1){socket['emit'](_0xe068('0x8a'),{'UserId':Number(_0x2448b8['body']['ids'][_0x436693]),'CmListId':Number(_0x2448b8[_0xe068('0x4d')]['id'])});}return _0x5974c8;});}})['then'](respondWithResult(_0x5d8f3e,null))[_0xe068('0x4c')](handleError(_0x5d8f3e,null));};exports[_0xe068('0x8b')]=function(_0x5ec3be,_0x5b29d3,_0xcdc80){return db[_0xe068('0x34')][_0xe068('0x55')]({'where':{'id':_0x5ec3be[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x5b29d3,null))[_0xe068('0x29')](function(_0x4b22cf){if(_0x4b22cf){return _0x4b22cf[_0xe068('0x8b')](_0x5ec3be[_0xe068('0x39')][_0xe068('0x60')])[_0xe068('0x29')](function(){if(_[_0xe068('0x64')](_0x5ec3be['query'][_0xe068('0x60')])){for(var _0x59b690=0x0;_0x59b690<_0x5ec3be['query'][_0xe068('0x60')][_0xe068('0x3f')];_0x59b690+=0x1){socket[_0xe068('0x8c')]('userCmList:remove',{'UserId':Number(_0x5ec3be[_0xe068('0x39')][_0xe068('0x60')][_0x59b690]),'CmListId':Number(_0x5ec3be[_0xe068('0x4d')]['id'])});}}else{socket['emit'](_0xe068('0x8d'),{'UserId':Number(_0x5ec3be[_0xe068('0x39')]['ids']),'CmListId':Number(_0x5ec3be[_0xe068('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x5b29d3,null))[_0xe068('0x4c')](handleError(_0x5b29d3,null));};exports[_0xe068('0x8e')]=function(_0x23db6a,_0x3aa762,_0xf879c3){var _0x78629a={};var _0x2f0ad9={};var _0x4565c4;var _0x15e4e9;return db[_0xe068('0x34')][_0xe068('0x5d')]({'where':{'id':_0x23db6a[_0xe068('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3aa762,null))['then'](function(_0x3a07ca){if(_0x3a07ca){_0x4565c4=_0x3a07ca;_0x2f0ad9[_0xe068('0x38')]=_[_0xe068('0x3a')](db['User'][_0xe068('0x35')]);_0x2f0ad9['query']=_[_0xe068('0x3a')](_0x23db6a[_0xe068('0x39')]);_0x2f0ad9[_0xe068('0x3b')]=_['intersection'](_0x2f0ad9[_0xe068('0x38')],_0x2f0ad9['query']);_0x78629a['attributes']=_[_0xe068('0x3c')](_0x2f0ad9['model'],qs[_0xe068('0x3e')](_0x23db6a['query'][_0xe068('0x3e')]));_0x78629a[_0xe068('0x3d')]=_0x78629a[_0xe068('0x3d')]['length']?_0x78629a['attributes']:_0x2f0ad9['model'];_0x78629a[_0xe068('0x41')]=qs[_0xe068('0x42')](_0x23db6a[_0xe068('0x39')][_0xe068('0x42')]);_0x78629a['where']=qs[_0xe068('0x3b')](_[_0xe068('0x44')](_0x23db6a[_0xe068('0x39')],_0x2f0ad9['filters']));if(_0x23db6a[_0xe068('0x39')]['filter']){_0x78629a[_0xe068('0x43')]=_['merge'](_0x78629a['where'],{'$or':_[_0xe068('0x33')](_0x78629a[_0xe068('0x3d')],function(_0xb7e77f){var _0x15b0b7={};_0x15b0b7[_0xb7e77f]={'$like':'%'+_0x23db6a['query'][_0xe068('0x45')]+'%'};return _0x15b0b7;})});}_0x78629a=_[_0xe068('0x4e')]({},_0x78629a,_0x23db6a[_0xe068('0x46')]);return _0x4565c4[_0xe068('0x8e')](_0x78629a);}})['then'](function(_0x3f5931){if(_0x3f5931){_0x15e4e9=_0x3f5931['length'];if(!_0x23db6a[_0xe068('0x39')][_0xe068('0x40')](_0xe068('0x5e'))){_0x78629a[_0xe068('0x22')]=qs[_0xe068('0x22')](_0x23db6a[_0xe068('0x39')][_0xe068('0x22')]);_0x78629a[_0xe068('0x20')]=qs[_0xe068('0x20')](_0x23db6a[_0xe068('0x39')][_0xe068('0x20')]);}return _0x4565c4[_0xe068('0x8e')](_0x78629a);}})[_0xe068('0x29')](function(_0xe9f260){if(_0xe9f260){return _0xe9f260?{'count':_0x15e4e9,'rows':_0xe9f260}:null;}})[_0xe068('0x29')](respondWithResult(_0x3aa762,null))[_0xe068('0x4c')](handleError(_0x3aa762,null));}; \ No newline at end of file +var _0xd4c3=['cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','User','getAgents','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','./cmList.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','params','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags','isArray','ListId','push','omit','dataValues','errors','message','getContacts','CustomFields','concat','cf_%d','raw','getContactsCsv','CmCustomField','format','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd4c3,0x99));var _0x3d4c=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0xd4c3[_0x53a7a8];return _0x555f71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d4c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d4c('0x1'));var rp=require(_0x3d4c('0x2'));var moment=require(_0x3d4c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3d4c('0x4'));var util=require(_0x3d4c('0x5'));var path=require(_0x3d4c('0x6'));var sox=require('sox');var csv=require(_0x3d4c('0x7'));var ejs=require(_0x3d4c('0x8'));var fs=require('fs');var fs_extra=require(_0x3d4c('0x9'));var _=require(_0x3d4c('0xa'));var squel=require('squel');var crypto=require(_0x3d4c('0xb'));var jsforce=require(_0x3d4c('0xc'));var deskjs=require(_0x3d4c('0xd'));var toCsv=require(_0x3d4c('0x7'));var querystring=require('querystring');var Papa=require(_0x3d4c('0xe'));var Redis=require(_0x3d4c('0xf'));var authService=require(_0x3d4c('0x10'));var qs=require(_0x3d4c('0x11'));var as=require(_0x3d4c('0x12'));var hardwareService=require(_0x3d4c('0x13'));var logger=require(_0x3d4c('0x14'))(_0x3d4c('0x15'));var utils=require(_0x3d4c('0x16'));var config=require(_0x3d4c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3d4c('0x18')](config[_0x3d4c('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d4c('0x19')]));require(_0x3d4c('0x1a'))['register'](socket);function respondWithStatusCode(_0x3ac82c,_0x4943fc){_0x4943fc=_0x4943fc||0xcc;return function(_0x1b3051){if(_0x1b3051){return _0x3ac82c[_0x3d4c('0x1b')](_0x4943fc);}return _0x3ac82c[_0x3d4c('0x1c')](_0x4943fc)[_0x3d4c('0x1d')]();};}function respondWithResult(_0x5d50df,_0x324ce0){_0x324ce0=_0x324ce0||0xc8;return function(_0x573f80){if(_0x573f80){return _0x5d50df['status'](_0x324ce0)[_0x3d4c('0x1e')](_0x573f80);}};}function respondWithFilteredResult(_0x3216c5,_0x3556ab){return function(_0x1a9030){if(_0x1a9030){var _0x95a845=typeof _0x3556ab[_0x3d4c('0x1f')]===_0x3d4c('0x20')&&typeof _0x3556ab[_0x3d4c('0x21')]===_0x3d4c('0x20');var _0x336b90=_0x1a9030[_0x3d4c('0x22')];var _0x31c869=_0x95a845?0x0:_0x3556ab[_0x3d4c('0x1f')];var _0x3dfdff=_0x95a845?_0x1a9030[_0x3d4c('0x22')]:_0x3556ab[_0x3d4c('0x1f')]+_0x3556ab[_0x3d4c('0x21')];var _0x4908cf;if(_0x3dfdff>=_0x336b90){_0x3dfdff=_0x336b90;_0x4908cf=0xc8;}else{_0x4908cf=0xce;}_0x3216c5[_0x3d4c('0x1c')](_0x4908cf);return _0x3216c5[_0x3d4c('0x23')](_0x3d4c('0x24'),_0x31c869+'-'+_0x3dfdff+'/'+_0x336b90)['json'](_0x1a9030);}return null;};}function patchUpdates(_0x2fb9fd){return function(_0x1f059d){try{jsonpatch['apply'](_0x1f059d,_0x2fb9fd,!![]);}catch(_0x1924e2){return BPromise[_0x3d4c('0x25')](_0x1924e2);}return _0x1f059d[_0x3d4c('0x26')]();};}function saveUpdates(_0x3d9dd2,_0x1af592){return function(_0x19c1b8){if(_0x19c1b8){return _0x19c1b8[_0x3d4c('0x27')](_0x3d9dd2)[_0x3d4c('0x28')](function(_0x44b5b2){return _0x44b5b2;});}return null;};}function removeEntity(_0x21cdd7,_0x3c1b9d){return function(_0x3eefe1){if(_0x3eefe1){return _0x3eefe1[_0x3d4c('0x29')]()[_0x3d4c('0x28')](function(){var _0x85eaf5=_0x3eefe1['get']({'plain':!![]});var _0x565c6a='Lists';return db[_0x3d4c('0x2a')]['destroy']({'where':{'type':_0x565c6a,'resourceId':_0x85eaf5['id']}})[_0x3d4c('0x28')](function(){return _0x3eefe1;});})['then'](function(){_0x21cdd7[_0x3d4c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39f6a7,_0x3e23d8){return function(_0x2d469d){if(!_0x2d469d){_0x39f6a7[_0x3d4c('0x1b')](0x194);}return _0x2d469d;};}function handleError(_0x58044c,_0x27494a){_0x27494a=_0x27494a||0x1f4;return function(_0x435d56){logger[_0x3d4c('0x2b')](_0x435d56[_0x3d4c('0x2c')]);if(_0x435d56[_0x3d4c('0x2d')]){delete _0x435d56[_0x3d4c('0x2d')];}_0x58044c[_0x3d4c('0x1c')](_0x27494a)[_0x3d4c('0x2e')](_0x435d56);};}exports[_0x3d4c('0x2f')]=function(_0x2702a8,_0x3f8012){var _0x5ca71b={},_0x1e3347={},_0x111685={'count':0x0,'rows':[]};var _0x2f47b1=_[_0x3d4c('0x30')](db[_0x3d4c('0x31')][_0x3d4c('0x32')],function(_0xb5391a){return{'name':_0xb5391a[_0x3d4c('0x33')],'type':_0xb5391a[_0x3d4c('0x34')][_0x3d4c('0x35')]};});_0x1e3347[_0x3d4c('0x36')]=_['map'](_0x2f47b1,'name');_0x1e3347[_0x3d4c('0x37')]=_[_0x3d4c('0x38')](_0x2702a8[_0x3d4c('0x37')]);_0x1e3347[_0x3d4c('0x39')]=_[_0x3d4c('0x3a')](_0x1e3347[_0x3d4c('0x36')],_0x1e3347[_0x3d4c('0x37')]);_0x5ca71b[_0x3d4c('0x3b')]=_['intersection'](_0x1e3347[_0x3d4c('0x36')],qs[_0x3d4c('0x3c')](_0x2702a8[_0x3d4c('0x37')]['fields']));_0x5ca71b[_0x3d4c('0x3b')]=_0x5ca71b[_0x3d4c('0x3b')][_0x3d4c('0x3d')]?_0x5ca71b[_0x3d4c('0x3b')]:_0x1e3347[_0x3d4c('0x36')];if(!_0x2702a8['query'][_0x3d4c('0x3e')](_0x3d4c('0x3f'))){_0x5ca71b[_0x3d4c('0x21')]=qs['limit'](_0x2702a8[_0x3d4c('0x37')][_0x3d4c('0x21')]);_0x5ca71b[_0x3d4c('0x1f')]=qs[_0x3d4c('0x1f')](_0x2702a8[_0x3d4c('0x37')]['offset']);}_0x5ca71b[_0x3d4c('0x40')]=qs[_0x3d4c('0x41')](_0x2702a8[_0x3d4c('0x37')][_0x3d4c('0x41')]);_0x5ca71b['where']=qs[_0x3d4c('0x39')](_[_0x3d4c('0x42')](_0x2702a8[_0x3d4c('0x37')],_0x1e3347[_0x3d4c('0x39')]),_0x2f47b1);if(_0x2702a8[_0x3d4c('0x37')][_0x3d4c('0x43')]){_0x5ca71b[_0x3d4c('0x44')]=_['merge'](_0x5ca71b['where'],{'$or':_[_0x3d4c('0x30')](_0x2f47b1,function(_0xb203ca){if(_0xb203ca[_0x3d4c('0x34')]!==_0x3d4c('0x45')){var _0x11b8f3={};_0x11b8f3[_0xb203ca['name']]={'$like':'%'+_0x2702a8[_0x3d4c('0x37')][_0x3d4c('0x43')]+'%'};return _0x11b8f3;}})});}_0x5ca71b=_[_0x3d4c('0x46')]({},_0x5ca71b,_0x2702a8['options']);var _0x40c462={'where':_0x5ca71b[_0x3d4c('0x44')]};return db['CmList']['count'](_0x40c462)['then'](function(_0x20414f){_0x111685[_0x3d4c('0x22')]=_0x20414f;if(_0x2702a8[_0x3d4c('0x37')]['includeAll']){_0x5ca71b[_0x3d4c('0x47')]=[{'all':!![]}];}return db[_0x3d4c('0x31')][_0x3d4c('0x48')](_0x5ca71b);})[_0x3d4c('0x28')](function(_0x1dcdd6){_0x111685[_0x3d4c('0x49')]=_0x1dcdd6;return _0x111685;})[_0x3d4c('0x28')](respondWithFilteredResult(_0x3f8012,_0x5ca71b))['catch'](handleError(_0x3f8012,null));};exports['show']=function(_0x3af634,_0x299934){var _0x1d6d46={'raw':![],'where':{'id':_0x3af634[_0x3d4c('0x4a')]['id']}},_0x429870={};_0x429870['model']=_[_0x3d4c('0x38')](db['CmList'][_0x3d4c('0x32')]);_0x429870[_0x3d4c('0x37')]=_[_0x3d4c('0x38')](_0x3af634[_0x3d4c('0x37')]);_0x429870[_0x3d4c('0x39')]=_[_0x3d4c('0x3a')](_0x429870[_0x3d4c('0x36')],_0x429870[_0x3d4c('0x37')]);_0x1d6d46['attributes']=_[_0x3d4c('0x3a')](_0x429870[_0x3d4c('0x36')],qs[_0x3d4c('0x3c')](_0x3af634['query'][_0x3d4c('0x3c')]));_0x1d6d46['attributes']=_0x1d6d46[_0x3d4c('0x3b')][_0x3d4c('0x3d')]?_0x1d6d46[_0x3d4c('0x3b')]:_0x429870['model'];if(_0x3af634[_0x3d4c('0x37')][_0x3d4c('0x4b')]){_0x1d6d46[_0x3d4c('0x47')]=[{'all':!![]}];}_0x1d6d46=_[_0x3d4c('0x46')]({},_0x1d6d46,_0x3af634[_0x3d4c('0x4c')]);return db[_0x3d4c('0x31')][_0x3d4c('0x4d')](_0x1d6d46)[_0x3d4c('0x28')](handleEntityNotFound(_0x299934,null))[_0x3d4c('0x28')](respondWithResult(_0x299934,null))['catch'](handleError(_0x299934,null));};exports[_0x3d4c('0x4e')]=function(_0x2396c1,_0xd4548b){return db[_0x3d4c('0x31')]['create'](_0x2396c1[_0x3d4c('0x4f')],{})['then'](function(_0x405e4f){var _0x4d8dea=_0x2396c1[_0x3d4c('0x50')][_0x3d4c('0x51')]({'plain':!![]});if(!_0x4d8dea)throw new Error(_0x3d4c('0x52'));if(_0x4d8dea[_0x3d4c('0x53')]==='user'){var _0x329d8b=_0x405e4f[_0x3d4c('0x51')]({'plain':!![]});var _0x413859=_0x3d4c('0x54');return db[_0x3d4c('0x55')]['find']({'where':{'name':_0x413859,'userProfileId':_0x4d8dea[_0x3d4c('0x56')]},'raw':!![]})['then'](function(_0x4a3353){if(_0x4a3353&&_0x4a3353[_0x3d4c('0x57')]===0x0){return db[_0x3d4c('0x2a')]['create']({'name':_0x329d8b['name'],'resourceId':_0x329d8b['id'],'type':_0x4a3353[_0x3d4c('0x2d')],'sectionId':_0x4a3353['id']},{})[_0x3d4c('0x28')](function(){return _0x405e4f;});}else{return _0x405e4f;}})[_0x3d4c('0x58')](function(_0x585137){logger[_0x3d4c('0x2b')](_0x3d4c('0x59'),_0x585137);throw _0x585137;});}return _0x405e4f;})['then'](respondWithResult(_0xd4548b,0xc9))[_0x3d4c('0x58')](handleError(_0xd4548b,null));};exports[_0x3d4c('0x27')]=function(_0x54d2fe,_0x172e5b){if(_0x54d2fe[_0x3d4c('0x4f')]['id']){delete _0x54d2fe[_0x3d4c('0x4f')]['id'];}return db[_0x3d4c('0x31')][_0x3d4c('0x4d')]({'where':{'id':_0x54d2fe[_0x3d4c('0x4a')]['id']}})[_0x3d4c('0x28')](handleEntityNotFound(_0x172e5b,null))['then'](saveUpdates(_0x54d2fe[_0x3d4c('0x4f')],null))[_0x3d4c('0x28')](respondWithResult(_0x172e5b,null))[_0x3d4c('0x58')](handleError(_0x172e5b,null));};exports['destroy']=function(_0x1c9d4b,_0x229c08){return db[_0x3d4c('0x31')][_0x3d4c('0x4d')]({'where':{'id':_0x1c9d4b[_0x3d4c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x229c08,null))[_0x3d4c('0x28')](removeEntity(_0x229c08,null))[_0x3d4c('0x58')](handleError(_0x229c08,null));};exports[_0x3d4c('0x5a')]=function(_0x3a6f5c,_0x1fadd4){return db[_0x3d4c('0x31')][_0x3d4c('0x5a')]()['then'](respondWithResult(_0x1fadd4,null))['catch'](handleError(_0x1fadd4,null));};exports[_0x3d4c('0x5b')]=function(_0x4d462d,_0x1657a8,_0x541a37){if(_0x4d462d['body']['id']){delete _0x4d462d[_0x3d4c('0x4f')]['id'];}return db[_0x3d4c('0x31')][_0x3d4c('0x4d')]({'where':{'id':_0x4d462d['params']['id']}})[_0x3d4c('0x28')](handleEntityNotFound(_0x1657a8,null))[_0x3d4c('0x28')](function(_0x4f592f){if(_0x4f592f){_0x4d462d['body']['ListId']=_0x4f592f['id'];return db[_0x3d4c('0x5c')][_0x3d4c('0x4e')](_0x4d462d[_0x3d4c('0x4f')]);}})[_0x3d4c('0x28')](respondWithResult(_0x1657a8,null))['catch'](handleError(_0x1657a8,null));};exports[_0x3d4c('0x5d')]=function(_0xbe19da,_0x19325b,_0x2e67e0){var _0x58b8db={'raw':![],'where':{}};var _0x417c91={};var _0xc0b331={'count':0x0,'rows':[]};return db[_0x3d4c('0x31')][_0x3d4c('0x5e')]({'where':{'id':_0xbe19da[_0x3d4c('0x4a')]['id']}})[_0x3d4c('0x28')](handleEntityNotFound(_0x19325b,null))[_0x3d4c('0x28')](function(_0x5d1096){if(_0x5d1096){_0x417c91[_0x3d4c('0x36')]=_[_0x3d4c('0x38')](db[_0x3d4c('0x5c')][_0x3d4c('0x32')]);_0x417c91[_0x3d4c('0x37')]=_['keys'](_0xbe19da[_0x3d4c('0x37')]);_0x417c91[_0x3d4c('0x39')]=_[_0x3d4c('0x3a')](_0x417c91[_0x3d4c('0x36')],_0x417c91[_0x3d4c('0x37')]);_0x58b8db[_0x3d4c('0x3b')]=_[_0x3d4c('0x3a')](_0x417c91[_0x3d4c('0x36')],qs[_0x3d4c('0x3c')](_0xbe19da[_0x3d4c('0x37')][_0x3d4c('0x3c')]));_0x58b8db[_0x3d4c('0x3b')]=_0x58b8db[_0x3d4c('0x3b')][_0x3d4c('0x3d')]?_0x58b8db[_0x3d4c('0x3b')]:_0x417c91['model'];if(!_0xbe19da[_0x3d4c('0x37')]['hasOwnProperty'](_0x3d4c('0x3f'))){_0x58b8db[_0x3d4c('0x21')]=qs[_0x3d4c('0x21')](_0xbe19da[_0x3d4c('0x37')]['limit']);_0x58b8db[_0x3d4c('0x1f')]=qs[_0x3d4c('0x1f')](_0xbe19da[_0x3d4c('0x37')][_0x3d4c('0x1f')]);}_0x58b8db[_0x3d4c('0x40')]=qs[_0x3d4c('0x41')](_0xbe19da[_0x3d4c('0x37')][_0x3d4c('0x41')]);_0x58b8db[_0x3d4c('0x44')]=qs[_0x3d4c('0x39')](_[_0x3d4c('0x42')](_0xbe19da[_0x3d4c('0x37')],_0x417c91[_0x3d4c('0x39')]));_0x58b8db[_0x3d4c('0x44')]['ListId']=_0x5d1096['id'];if(_0xbe19da[_0x3d4c('0x37')][_0x3d4c('0x43')]){_0x58b8db['where']=_['merge'](_0x58b8db['where'],{'$or':_[_0x3d4c('0x30')](_0x58b8db[_0x3d4c('0x3b')],function(_0x266e8e){var _0x336bac={};_0x336bac[_0x266e8e]={'$like':'%'+_0xbe19da['query'][_0x3d4c('0x43')]+'%'};return _0x336bac;})});}_0x58b8db=_[_0x3d4c('0x46')]({},_0x58b8db,_0xbe19da['options']);return db[_0x3d4c('0x5c')][_0x3d4c('0x22')]({'where':_0x58b8db[_0x3d4c('0x44')]})[_0x3d4c('0x28')](function(_0x77a232){_0xc0b331[_0x3d4c('0x22')]=_0x77a232;if(_0xbe19da[_0x3d4c('0x37')][_0x3d4c('0x4b')]){_0x58b8db[_0x3d4c('0x47')]=[{'all':!![]}];}return db[_0x3d4c('0x5c')]['findAll'](_0x58b8db);})[_0x3d4c('0x28')](function(_0x21d417){_0xc0b331[_0x3d4c('0x49')]=_0x21d417;return _0xc0b331;});}})[_0x3d4c('0x28')](respondWithFilteredResult(_0x19325b,_0x58b8db))[_0x3d4c('0x58')](handleError(_0x19325b,null));};exports['removeDispositions']=function(_0x43aaaa,_0x35babf,_0x2a5c9){return db[_0x3d4c('0x31')][_0x3d4c('0x4d')]({'where':{'id':_0x43aaaa['params']['id']}})['then'](handleEntityNotFound(_0x35babf,null))[_0x3d4c('0x28')](function(_0x5d658a){if(_0x5d658a){return _0x5d658a[_0x3d4c('0x5f')](_0x43aaaa[_0x3d4c('0x37')][_0x3d4c('0x60')]);}})[_0x3d4c('0x28')](respondWithStatusCode(_0x35babf,null))[_0x3d4c('0x58')](handleError(_0x35babf,null));};exports[_0x3d4c('0x61')]=function(_0x24b199,_0x1b79a3,_0x3c64ed){return db['CmList'][_0x3d4c('0x4d')]({'where':{'id':_0x24b199[_0x3d4c('0x4a')]['id']}})[_0x3d4c('0x28')](handleEntityNotFound(_0x1b79a3,null))[_0x3d4c('0x28')](function(_0x561665){if(_0x561665){var _0x368e61=[];var _0x142e28={'success':[],'errors':[]};return db[_0x3d4c('0x62')][_0x3d4c('0x5a')]()[_0x3d4c('0x28')](function(_0x3b4ba4){if(_0x24b199[_0x3d4c('0x4f')][_0x3d4c('0x63')]&&_[_0x3d4c('0x64')](_0x24b199[_0x3d4c('0x4f')][_0x3d4c('0x63')])){if(_0x24b199[_0x3d4c('0x4f')][_0x3d4c('0x63')]['length']){_0x24b199[_0x3d4c('0x4f')][_0x3d4c('0x63')]=_0x24b199[_0x3d4c('0x4f')][_0x3d4c('0x63')]['join'](';')+';';}else{_0x24b199[_0x3d4c('0x4f')][_0x3d4c('0x63')]=null;}}else{_0x24b199[_0x3d4c('0x4f')][_0x3d4c('0x63')]=null;}if(_0x24b199['body']&&_[_0x3d4c('0x64')](_0x24b199[_0x3d4c('0x4f')])){for(var _0x137f16=0x0;_0x137f16<_0x24b199[_0x3d4c('0x4f')][_0x3d4c('0x3d')];_0x137f16+=0x1){_0x24b199[_0x3d4c('0x4f')][_0x137f16][_0x3d4c('0x65')]=_0x24b199[_0x3d4c('0x4a')]['id'];_0x368e61[_0x3d4c('0x66')](_0x24b199[_0x3d4c('0x4f')][_0x137f16]);}return BPromise['each'](_0x368e61,function(_0x4c06f8){return db[_0x3d4c('0x62')][_0x3d4c('0x4e')](_[_0x3d4c('0x67')](_0x4c06f8,['ids','id'])||{},{'fields':_[_0x3d4c('0x38')](_0x3b4ba4),'raw':!![]})[_0x3d4c('0x28')](function(_0x10eac6){_0x142e28['success']['push'](_0x10eac6[_0x3d4c('0x68')]);})[_0x3d4c('0x58')](function(_0x1d9394){_0x142e28[_0x3d4c('0x69')][_0x3d4c('0x66')]({'data':_0x4c06f8,'error':_0x1d9394[_0x3d4c('0x6a')]});});})[_0x3d4c('0x28')](function(_0x53712c){return _0x142e28;})[_0x3d4c('0x58')](function(_0xc00cc8){return _0xc00cc8;});}else{_0x1b79a3[_0x3d4c('0x1c')](0x190)[_0x3d4c('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x3d4c('0x28')](respondWithResult(_0x1b79a3,null))[_0x3d4c('0x58')](handleError(_0x1b79a3,null));};exports[_0x3d4c('0x6b')]=function(_0x4b2465,_0x403bd4,_0xbc39e7){var _0x1fd6f1;return db[_0x3d4c('0x31')][_0x3d4c('0x4d')]({'where':{'id':_0x4b2465[_0x3d4c('0x4a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x3d4c('0x6c')}]})[_0x3d4c('0x28')](handleEntityNotFound(_0x403bd4,null))[_0x3d4c('0x28')](function(_0x32f8d8){if(_0x32f8d8){_0x1fd6f1=_0x32f8d8;return db[_0x3d4c('0x62')][_0x3d4c('0x32')];}})[_0x3d4c('0x28')](function(_0x203f34){if(_0x203f34){var _0xa64b6f={};var _0x5d4bdb={};_0x5d4bdb['model']=_[_0x3d4c('0x6d')](_[_0x3d4c('0x38')](_0x203f34),_[_0x3d4c('0x30')](_0x1fd6f1[_0x3d4c('0x6c')],function(_0x5488b2){return util['format'](_0x3d4c('0x6e'),_0x5488b2['id']);}));_0x5d4bdb[_0x3d4c('0x37')]=_['keys'](_0x4b2465[_0x3d4c('0x37')]);_0x5d4bdb[_0x3d4c('0x39')]=_[_0x3d4c('0x3a')](_0x5d4bdb[_0x3d4c('0x36')],_0x5d4bdb['query']);_0xa64b6f[_0x3d4c('0x3b')]=_[_0x3d4c('0x3a')](_0x5d4bdb[_0x3d4c('0x36')],qs['fields'](_0x4b2465['query'][_0x3d4c('0x3c')]));_0xa64b6f['attributes']=_0xa64b6f[_0x3d4c('0x3b')][_0x3d4c('0x3d')]?_0xa64b6f[_0x3d4c('0x3b')]:_0x5d4bdb[_0x3d4c('0x36')];if(!_0x4b2465[_0x3d4c('0x37')][_0x3d4c('0x3e')](_0x3d4c('0x3f'))){_0xa64b6f['limit']=qs[_0x3d4c('0x21')](_0x4b2465['query'][_0x3d4c('0x21')]);_0xa64b6f[_0x3d4c('0x1f')]=qs['offset'](_0x4b2465[_0x3d4c('0x37')][_0x3d4c('0x1f')]);}_0xa64b6f[_0x3d4c('0x40')]=qs['sort'](_0x4b2465[_0x3d4c('0x37')]['sort']);_0xa64b6f[_0x3d4c('0x44')]=qs[_0x3d4c('0x39')](_[_0x3d4c('0x42')](_0x4b2465[_0x3d4c('0x37')],_0x5d4bdb[_0x3d4c('0x39')]));_0xa64b6f[_0x3d4c('0x6f')]=!![];if(_0x4b2465[_0x3d4c('0x37')][_0x3d4c('0x43')]){_0xa64b6f[_0x3d4c('0x44')]=_['merge'](_0xa64b6f[_0x3d4c('0x44')],{'$or':_['map'](_0xa64b6f[_0x3d4c('0x3b')],function(_0x36a77b){var _0x2b4a85={};_0x2b4a85[_0x36a77b]={'$like':'%'+_0x4b2465[_0x3d4c('0x37')][_0x3d4c('0x43')]+'%'};return _0x2b4a85;})});}_0xa64b6f=_[_0x3d4c('0x46')]({},_0xa64b6f,_0x4b2465['options']);return _0x1fd6f1[_0x3d4c('0x6b')](_0xa64b6f);}})[_0x3d4c('0x28')](respondWithResult(_0x403bd4,null))['catch'](handleError(_0x403bd4,null));};exports[_0x3d4c('0x70')]=function(_0x39f7de,_0x5bee3f,_0xb56831){var _0x19397b;return db[_0x3d4c('0x31')][_0x3d4c('0x4d')]({'where':{'id':_0x39f7de[_0x3d4c('0x4a')]['id']},'include':[{'model':db[_0x3d4c('0x71')],'as':_0x3d4c('0x6c')}]})['then'](handleEntityNotFound(_0x5bee3f,null))['then'](function(_0x5787a0){if(_0x5787a0){_0x19397b=_0x5787a0;return db['CmContact'][_0x3d4c('0x32')];}})['then'](function(_0x109de6){if(_0x109de6){var _0x58b97d={};var _0x14ab9c={};_0x14ab9c[_0x3d4c('0x36')]=_[_0x3d4c('0x6d')](_[_0x3d4c('0x38')](_0x109de6),_[_0x3d4c('0x30')](_0x19397b[_0x3d4c('0x6c')],function(_0x4e7fcc){return util[_0x3d4c('0x72')](_0x3d4c('0x6e'),_0x4e7fcc['id']);}));_0x14ab9c[_0x3d4c('0x37')]=_[_0x3d4c('0x38')](_0x39f7de[_0x3d4c('0x37')]);_0x14ab9c[_0x3d4c('0x39')]=_[_0x3d4c('0x3a')](_0x14ab9c[_0x3d4c('0x36')],_0x14ab9c[_0x3d4c('0x37')]);_0x58b97d[_0x3d4c('0x3b')]=_[_0x3d4c('0x3a')](_0x14ab9c[_0x3d4c('0x36')],qs[_0x3d4c('0x3c')](_0x39f7de[_0x3d4c('0x37')]['fields']));_0x58b97d[_0x3d4c('0x3b')]=_0x58b97d[_0x3d4c('0x3b')]['length']?_0x58b97d['attributes']:_0x14ab9c[_0x3d4c('0x36')];if(!_0x39f7de['query']['hasOwnProperty'](_0x3d4c('0x3f'))){_0x58b97d[_0x3d4c('0x21')]=qs['limit'](_0x39f7de[_0x3d4c('0x37')]['limit']);_0x58b97d[_0x3d4c('0x1f')]=qs[_0x3d4c('0x1f')](_0x39f7de[_0x3d4c('0x37')]['offset']);}_0x58b97d[_0x3d4c('0x40')]=qs[_0x3d4c('0x41')](_0x39f7de[_0x3d4c('0x37')][_0x3d4c('0x41')]);_0x58b97d['where']=qs[_0x3d4c('0x39')](_[_0x3d4c('0x42')](_0x39f7de[_0x3d4c('0x37')],_0x14ab9c['filters']));_0x58b97d['raw']=!![];if(_0x39f7de[_0x3d4c('0x37')][_0x3d4c('0x43')]){_0x58b97d['where']=_[_0x3d4c('0x46')](_0x58b97d['where'],{'$or':_[_0x3d4c('0x30')](_0x58b97d['attributes'],function(_0x3fd2ed){var _0x42b4a9={};_0x42b4a9[_0x3fd2ed]={'$like':'%'+_0x39f7de[_0x3d4c('0x37')][_0x3d4c('0x43')]+'%'};return _0x42b4a9;})});}_0x58b97d=_[_0x3d4c('0x46')]({},_0x58b97d,_0x39f7de[_0x3d4c('0x4c')]);return _0x19397b[_0x3d4c('0x6b')](_0x58b97d);}})['then'](function(_0x1fd40c){if(!_[_0x3d4c('0x73')](_0x1fd40c)){var _0x6dcbe6=toCsv(_0x1fd40c);var _0x46ebae=Date['now']();fs[_0x3d4c('0x74')](util[_0x3d4c('0x72')](_0x3d4c('0x75'),_0x19397b['id'],_0x46ebae),_0x6dcbe6);_0x5bee3f[_0x3d4c('0x76')]('Content-disposition',_0x3d4c('0x77')+util[_0x3d4c('0x72')](_0x3d4c('0x78'),_0x19397b['id'],_0x46ebae));_0x5bee3f[_0x3d4c('0x76')]('Content-type',_0x3d4c('0x79'));return _0x5bee3f[_0x3d4c('0x7a')](util[_0x3d4c('0x72')](_0x3d4c('0x75'),_0x19397b['id'],_0x46ebae));}else{return _0x5bee3f['sendStatus'](0xcc);}})[_0x3d4c('0x58')](handleError(_0x5bee3f,null));};exports['addCustomField']=function(_0x2bb859,_0x11a25e,_0x4ec907){var _0x2d6e5e;delete _0x2bb859[_0x3d4c('0x4f')]['id'];return db[_0x3d4c('0x31')][_0x3d4c('0x5e')]({'where':{'id':_0x2bb859[_0x3d4c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x11a25e,null))[_0x3d4c('0x28')](function(_0x13549f){if(_0x13549f){return db[_0x3d4c('0x7b')][_0x3d4c('0x7c')](function(_0x4d438d){return db[_0x3d4c('0x71')][_0x3d4c('0x4e')](_0x2bb859[_0x3d4c('0x4f')],{'transaction':_0x4d438d})['then'](function(_0x4c4a65){_0x2d6e5e=_0x4c4a65;return _0x13549f[_0x3d4c('0x7d')](_0x4c4a65,{'transaction':_0x4d438d});})['then'](function(){var _0x3375a1={'type':db['Sequelize']['TEXT'],'transaction':_0x4d438d};switch(_0x2bb859[_0x3d4c('0x4f')][_0x3d4c('0x34')]){case'text':_0x3375a1[_0x3d4c('0x34')]=db[_0x3d4c('0x7e')][_0x3d4c('0x7f')];break;case _0x3d4c('0x80'):_0x3375a1[_0x3d4c('0x34')]=db['Sequelize'][_0x3d4c('0x81')];break;case _0x3d4c('0x82'):_0x3375a1['type']=db[_0x3d4c('0x7e')][_0x3d4c('0x83')];_0x3375a1[_0x3d4c('0x84')]=![];break;default:}return db[_0x3d4c('0x7b')]['queryInterface'][_0x3d4c('0x85')](_0x3d4c('0x86'),util['format'](_0x3d4c('0x87'),_0x2d6e5e['id']),_0x3375a1);})[_0x3d4c('0x28')](function(){return _0x2d6e5e;});});}})[_0x3d4c('0x28')](respondWithResult(_0x11a25e,null))['catch'](handleError(_0x11a25e,null));};exports['getCustomFields']=function(_0x6de845,_0x4b210c,_0x5305eb){var _0x1d165d={};var _0x46009e={};var _0x398d5c;var _0x470e3f;return db[_0x3d4c('0x31')]['findOne']({'where':{'id':_0x6de845[_0x3d4c('0x4a')]['id']}})[_0x3d4c('0x28')](handleEntityNotFound(_0x4b210c,null))[_0x3d4c('0x28')](function(_0x4e38f7){if(_0x4e38f7){_0x398d5c=_0x4e38f7;_0x46009e[_0x3d4c('0x36')]=_[_0x3d4c('0x38')](db['CmCustomField'][_0x3d4c('0x32')]);_0x46009e[_0x3d4c('0x37')]=_['keys'](_0x6de845[_0x3d4c('0x37')]);_0x46009e['filters']=_[_0x3d4c('0x3a')](_0x46009e[_0x3d4c('0x36')],_0x46009e[_0x3d4c('0x37')]);_0x1d165d[_0x3d4c('0x3b')]=_['intersection'](_0x46009e[_0x3d4c('0x36')],qs[_0x3d4c('0x3c')](_0x6de845[_0x3d4c('0x37')]['fields']));_0x1d165d['attributes']=_0x1d165d['attributes'][_0x3d4c('0x3d')]?_0x1d165d['attributes']:_0x46009e['model'];_0x1d165d[_0x3d4c('0x40')]=qs['sort'](_0x6de845[_0x3d4c('0x37')]['sort']);_0x1d165d[_0x3d4c('0x44')]=qs[_0x3d4c('0x39')](_[_0x3d4c('0x42')](_0x6de845[_0x3d4c('0x37')],_0x46009e[_0x3d4c('0x39')]));_0x1d165d[_0x3d4c('0x44')]=_[_0x3d4c('0x46')](_0x1d165d[_0x3d4c('0x44')],{'$or':[{'ListId':_0x4e38f7['id']},{'ListId':null}]});if(_0x6de845['query'][_0x3d4c('0x43')]){_0x1d165d[_0x3d4c('0x44')]=_[_0x3d4c('0x46')](_0x1d165d[_0x3d4c('0x44')],{'$or':_[_0x3d4c('0x30')](_0x1d165d[_0x3d4c('0x3b')],function(_0x39e0cb){var _0x4fb41c={};_0x4fb41c[_0x39e0cb]={'$like':'%'+_0x6de845[_0x3d4c('0x37')][_0x3d4c('0x43')]+'%'};return _0x4fb41c;})});}_0x1d165d=_[_0x3d4c('0x46')]({},_0x1d165d,_0x6de845[_0x3d4c('0x4c')]);return db[_0x3d4c('0x71')][_0x3d4c('0x88')](_0x1d165d);}})[_0x3d4c('0x28')](respondWithResult(_0x4b210c,null))[_0x3d4c('0x58')](handleError(_0x4b210c,null));};exports[_0x3d4c('0x89')]=function(_0x221aaa,_0x4e7cd5,_0x1045ba){return db[_0x3d4c('0x31')]['find']({'where':{'id':_0x221aaa['params']['id']}})[_0x3d4c('0x28')](handleEntityNotFound(_0x4e7cd5,null))[_0x3d4c('0x28')](function(_0x2e8bb0){if(_0x2e8bb0){return _0x2e8bb0[_0x3d4c('0x89')](_0x221aaa['body'][_0x3d4c('0x60')],_[_0x3d4c('0x67')](_0x221aaa['body'],[_0x3d4c('0x60'),'id'])||{})[_0x3d4c('0x8a')](function(_0x499518){for(var _0x52d4b8=0x0;_0x52d4b8<_0x221aaa[_0x3d4c('0x4f')][_0x3d4c('0x60')][_0x3d4c('0x3d')];_0x52d4b8+=0x1){socket[_0x3d4c('0x8b')](_0x3d4c('0x8c'),{'UserId':Number(_0x221aaa[_0x3d4c('0x4f')][_0x3d4c('0x60')][_0x52d4b8]),'CmListId':Number(_0x221aaa[_0x3d4c('0x4a')]['id'])});}return _0x499518;});}})['then'](respondWithResult(_0x4e7cd5,null))['catch'](handleError(_0x4e7cd5,null));};exports[_0x3d4c('0x8d')]=function(_0x1f9f51,_0x370b31,_0x2d9c63){return db[_0x3d4c('0x31')][_0x3d4c('0x4d')]({'where':{'id':_0x1f9f51[_0x3d4c('0x4a')]['id']}})[_0x3d4c('0x28')](handleEntityNotFound(_0x370b31,null))[_0x3d4c('0x28')](function(_0x5d29ad){if(_0x5d29ad){return _0x5d29ad[_0x3d4c('0x8d')](_0x1f9f51[_0x3d4c('0x37')]['ids'])[_0x3d4c('0x28')](function(){if(_[_0x3d4c('0x64')](_0x1f9f51[_0x3d4c('0x37')][_0x3d4c('0x60')])){for(var _0x4d3267=0x0;_0x4d3267<_0x1f9f51[_0x3d4c('0x37')][_0x3d4c('0x60')][_0x3d4c('0x3d')];_0x4d3267+=0x1){socket[_0x3d4c('0x8b')]('userCmList:remove',{'UserId':Number(_0x1f9f51['query'][_0x3d4c('0x60')][_0x4d3267]),'CmListId':Number(_0x1f9f51['params']['id'])});}}else{socket[_0x3d4c('0x8b')]('userCmList:remove',{'UserId':Number(_0x1f9f51['query'][_0x3d4c('0x60')]),'CmListId':Number(_0x1f9f51['params']['id'])});}});}})[_0x3d4c('0x28')](respondWithStatusCode(_0x370b31,null))[_0x3d4c('0x58')](handleError(_0x370b31,null));};exports['getAgents']=function(_0x229de6,_0x2bda7d,_0x4a2c81){var _0x41d7c7={};var _0xaf8fba={};var _0x196ef2;var _0x30e8bf;return db['CmList'][_0x3d4c('0x5e')]({'where':{'id':_0x229de6['params']['id']}})[_0x3d4c('0x28')](handleEntityNotFound(_0x2bda7d,null))[_0x3d4c('0x28')](function(_0xf0e9a6){if(_0xf0e9a6){_0x196ef2=_0xf0e9a6;_0xaf8fba[_0x3d4c('0x36')]=_['keys'](db[_0x3d4c('0x8e')][_0x3d4c('0x32')]);_0xaf8fba[_0x3d4c('0x37')]=_[_0x3d4c('0x38')](_0x229de6[_0x3d4c('0x37')]);_0xaf8fba['filters']=_[_0x3d4c('0x3a')](_0xaf8fba[_0x3d4c('0x36')],_0xaf8fba[_0x3d4c('0x37')]);_0x41d7c7[_0x3d4c('0x3b')]=_['intersection'](_0xaf8fba[_0x3d4c('0x36')],qs[_0x3d4c('0x3c')](_0x229de6[_0x3d4c('0x37')]['fields']));_0x41d7c7[_0x3d4c('0x3b')]=_0x41d7c7['attributes'][_0x3d4c('0x3d')]?_0x41d7c7['attributes']:_0xaf8fba['model'];_0x41d7c7[_0x3d4c('0x40')]=qs[_0x3d4c('0x41')](_0x229de6['query'][_0x3d4c('0x41')]);_0x41d7c7['where']=qs[_0x3d4c('0x39')](_[_0x3d4c('0x42')](_0x229de6[_0x3d4c('0x37')],_0xaf8fba[_0x3d4c('0x39')]));if(_0x229de6['query'][_0x3d4c('0x43')]){_0x41d7c7['where']=_[_0x3d4c('0x46')](_0x41d7c7[_0x3d4c('0x44')],{'$or':_[_0x3d4c('0x30')](_0x41d7c7[_0x3d4c('0x3b')],function(_0x138630){var _0x344b54={};_0x344b54[_0x138630]={'$like':'%'+_0x229de6['query'][_0x3d4c('0x43')]+'%'};return _0x344b54;})});}_0x41d7c7=_[_0x3d4c('0x46')]({},_0x41d7c7,_0x229de6['options']);return _0x196ef2['getAgents'](_0x41d7c7);}})[_0x3d4c('0x28')](function(_0x50f375){if(_0x50f375){_0x30e8bf=_0x50f375[_0x3d4c('0x3d')];if(!_0x229de6['query'][_0x3d4c('0x3e')]('nolimit')){_0x41d7c7[_0x3d4c('0x21')]=qs[_0x3d4c('0x21')](_0x229de6[_0x3d4c('0x37')][_0x3d4c('0x21')]);_0x41d7c7[_0x3d4c('0x1f')]=qs['offset'](_0x229de6[_0x3d4c('0x37')][_0x3d4c('0x1f')]);}return _0x196ef2[_0x3d4c('0x8f')](_0x41d7c7);}})[_0x3d4c('0x28')](function(_0xbb2d77){if(_0xbb2d77){return _0xbb2d77?{'count':_0x30e8bf,'rows':_0xbb2d77}:null;}})['then'](respondWithResult(_0x2bda7d,null))[_0x3d4c('0x58')](handleError(_0x2bda7d,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3602ad0..ca35e88 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(_0x214aa7,_0x57de97){var _0x2aef7a=function(_0x2225a1){while(--_0x2225a1){_0x214aa7['push'](_0x214aa7['shift']());}};_0x2aef7a(++_0x57de97);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x1b765d,_0x1b4a2d){var _0x5d9ee1=function(_0x1d6298){while(--_0x1d6298){_0x1b765d['push'](_0x1b765d['shift']());}};_0x5d9ee1(++_0x1b4a2d);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 2f10c13..55bb667 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 _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x3dc2d6,_0x345dab){var _0x9d670b=function(_0x4fa133){while(--_0x4fa133){_0x3dc2d6['push'](_0x3dc2d6['shift']());}};_0x9d670b(++_0x345dab);}(_0x5ff3,0x17d));var _0x35ff=function(_0x416849,_0x43d9ff){_0x416849=_0x416849-0x0;var _0x49835b=_0x5ff3[_0x416849];return _0x49835b;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb7=['request-promise','path','rimraf','./cmList.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x498834,_0x57c709){_0x498834=_0x498834-0x0;var _0x2fc7ef=_0xbdb7[_0x498834];return _0x2fc7ef;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 284b6fa..263e71f 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 _0x007a=['./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x1cda7c,_0x4eb813){var _0x4c9b9b=function(_0x2ec2bc){while(--_0x2ec2bc){_0x1cda7c['push'](_0x1cda7c['shift']());}};_0x4c9b9b(++_0x4eb813);}(_0x007a,0xa8));var _0xa007=function(_0x10772c,_0x1df6ad){_0x10772c=_0x10772c-0x0;var _0x806119=_0x007a[_0x10772c];return _0x806119;};'use strict';var _=require(_0xa007('0x0'));var util=require(_0xa007('0x1'));var moment=require(_0xa007('0x2'));var BPromise=require(_0xa007('0x3'));var rs=require(_0xa007('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa007('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa007('0x6'))('rpc');var config=require(_0xa007('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa007('0x8')][_0xa007('0x9')]({'port':0x232a});config['redis']=_[_0xa007('0xa')](config[_0xa007('0xb')],{'host':_0xa007('0xc'),'port':0x18eb});var socket=require(_0xa007('0xd'))(new Redis(config[_0xa007('0xb')]));require(_0xa007('0xe'))[_0xa007('0xf')](socket);function respondWithRpcPromise(_0x3bec9e,_0x1e80e0,_0x40f8c3){return new BPromise(function(_0x174172,_0x6d0e46){return client[_0xa007('0x10')](_0x3bec9e,_0x40f8c3)['then'](function(_0x1f43ce){logger['info'](_0xa007('0x11'),_0x1e80e0,_0xa007('0x12'));logger[_0xa007('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x1e80e0,'request\x20sent',JSON['stringify'](_0x1f43ce));if(_0x1f43ce['error']){if(_0x1f43ce[_0xa007('0x14')][_0xa007('0x15')]===0x1f4){logger[_0xa007('0x14')](_0xa007('0x11'),_0x1e80e0,_0x1f43ce[_0xa007('0x14')][_0xa007('0x16')]);return _0x6d0e46(_0x1f43ce[_0xa007('0x14')][_0xa007('0x16')]);}logger[_0xa007('0x14')]('CmList,\x20%s,\x20%s',_0x1e80e0,_0x1f43ce[_0xa007('0x14')][_0xa007('0x16')]);return _0x174172(_0x1f43ce[_0xa007('0x14')][_0xa007('0x16')]);}else{logger[_0xa007('0x17')]('CmList,\x20%s,\x20%s',_0x1e80e0,_0xa007('0x12'));_0x174172(_0x1f43ce[_0xa007('0x18')]['message']);}})[_0xa007('0x19')](function(_0x4dcb0f){logger[_0xa007('0x14')](_0xa007('0x11'),_0x1e80e0,_0x4dcb0f);_0x6d0e46(_0x4dcb0f);});});} \ No newline at end of file +var _0xf706=['client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0xaa46d9,_0x27b41b){var _0x2b612f=function(_0x26eb36){while(--_0x26eb36){_0xaa46d9['push'](_0xaa46d9['shift']());}};_0x2b612f(++_0x27b41b);}(_0xf706,0x1c3));var _0x6f70=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xf706[_0x38eb23];return _0x48506a;};'use strict';var _=require(_0x6f70('0x0'));var util=require(_0x6f70('0x1'));var moment=require(_0x6f70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f70('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f70('0x4'))['db'];var utils=require(_0x6f70('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f70('0x6'));var jayson=require(_0x6f70('0x7'));var client=jayson[_0x6f70('0x8')][_0x6f70('0x9')]({'port':0x232a});config['redis']=_[_0x6f70('0xa')](config[_0x6f70('0xb')],{'host':_0x6f70('0xc'),'port':0x18eb});var socket=require(_0x6f70('0xd'))(new Redis(config['redis']));require(_0x6f70('0xe'))[_0x6f70('0xf')](socket);function respondWithRpcPromise(_0x48c7a7,_0x3dfaaf,_0x1077dd){return new BPromise(function(_0x25c376,_0xb13233){return client[_0x6f70('0x10')](_0x48c7a7,_0x1077dd)['then'](function(_0x4fe3b8){logger[_0x6f70('0x11')](_0x6f70('0x12'),_0x3dfaaf,_0x6f70('0x13'));logger['debug'](_0x6f70('0x14'),_0x3dfaaf,_0x6f70('0x13'),JSON[_0x6f70('0x15')](_0x4fe3b8));if(_0x4fe3b8[_0x6f70('0x16')]){if(_0x4fe3b8['error'][_0x6f70('0x17')]===0x1f4){logger[_0x6f70('0x16')]('CmList,\x20%s,\x20%s',_0x3dfaaf,_0x4fe3b8[_0x6f70('0x16')][_0x6f70('0x18')]);return _0xb13233(_0x4fe3b8['error'][_0x6f70('0x18')]);}logger['error'](_0x6f70('0x12'),_0x3dfaaf,_0x4fe3b8[_0x6f70('0x16')][_0x6f70('0x18')]);return _0x25c376(_0x4fe3b8[_0x6f70('0x16')][_0x6f70('0x18')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x3dfaaf,_0x6f70('0x13'));_0x25c376(_0x4fe3b8[_0x6f70('0x19')][_0x6f70('0x18')]);}})[_0x6f70('0x1a')](function(_0xba7c2a){logger[_0x6f70('0x16')](_0x6f70('0x12'),_0x3dfaaf,_0xba7c2a);_0xb13233(_0xba7c2a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 851583c..21d9795 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 _0xa2b1=['register','length','./cmList.events','save','update','emit'];(function(_0xf5b06d,_0x588cfc){var _0x28c5cf=function(_0x31c69d){while(--_0x31c69d){_0xf5b06d['push'](_0xf5b06d['shift']());}};_0x28c5cf(++_0x588cfc);}(_0xa2b1,0x158));var _0x1a2b=function(_0x1f2e00,_0x20627f){_0x1f2e00=_0x1f2e00-0x0;var _0x2e3c84=_0xa2b1[_0x1f2e00];return _0x2e3c84;};'use strict';var CmListEvents=require(_0x1a2b('0x0'));var events=[_0x1a2b('0x1'),'remove',_0x1a2b('0x2')];function createListener(_0x52e4f2,_0x47c2bf){return function(_0x2b01a4){_0x47c2bf[_0x1a2b('0x3')](_0x52e4f2,_0x2b01a4);};}function removeListener(_0x381b65,_0x2339e9){return function(){CmListEvents['removeListener'](_0x381b65,_0x2339e9);};}exports[_0x1a2b('0x4')]=function(_0x3aebac){for(var _0x437fab=0x0,_0x3ce956=events[_0x1a2b('0x5')];_0x437fab<_0x3ce956;_0x437fab++){var _0x2c019f=events[_0x437fab];var _0x4bf49f=createListener('cmList:'+_0x2c019f,_0x3aebac);CmListEvents['on'](_0x2c019f,_0x4bf49f);}}; \ No newline at end of file +var _0x7698=['removeListener','length','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x5aea75,_0x102252){var _0x592060=function(_0x18a474){while(--_0x18a474){_0x5aea75['push'](_0x5aea75['shift']());}};_0x592060(++_0x102252);}(_0x7698,0x1e3));var _0x8769=function(_0x3b39c5,_0xa54570){_0x3b39c5=_0x3b39c5-0x0;var _0x1a3c26=_0x7698[_0x3b39c5];return _0x1a3c26;};'use strict';var CmListEvents=require(_0x8769('0x0'));var events=[_0x8769('0x1'),_0x8769('0x2'),_0x8769('0x3')];function createListener(_0x49f7e1,_0x57ba46){return function(_0x5a7e29){_0x57ba46[_0x8769('0x4')](_0x49f7e1,_0x5a7e29);};}function removeListener(_0x38bca3,_0x497658){return function(){CmListEvents[_0x8769('0x5')](_0x38bca3,_0x497658);};}exports['register']=function(_0x431994){for(var _0x453843=0x0,_0x49aec9=events[_0x8769('0x6')];_0x453843<_0x49aec9;_0x453843++){var _0x5c526d=events[_0x453843];var _0x15fbe7=createListener(_0x8769('0x7')+_0x5c526d,_0x431994);CmListEvents['on'](_0x5c526d,_0x15fbe7);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e063f05..82efd8b 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 _0x3d16=['/:id/dispositions','addDisposition','addAgents','update','delete','removeDispositions','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','/:id/users','getAgents','post'];(function(_0x2669f5,_0x11aa08){var _0x10ed5c=function(_0x2978c0){while(--_0x2978c0){_0x2669f5['push'](_0x2669f5['shift']());}};_0x10ed5c(++_0x11aa08);}(_0x3d16,0xb6));var _0x63d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d16[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x63d1('0x0'));var timeout=require(_0x63d1('0x1'));var express=require('express');var router=express[_0x63d1('0x2')]();var fs_extra=require(_0x63d1('0x3'));var auth=require(_0x63d1('0x4'));var interaction=require(_0x63d1('0x5'));var config=require(_0x63d1('0x6'));var controller=require(_0x63d1('0x7'));router[_0x63d1('0x8')]('/',auth[_0x63d1('0x9')](),controller['index']);router[_0x63d1('0x8')]('/describe',auth[_0x63d1('0x9')](),controller[_0x63d1('0xa')]);router[_0x63d1('0x8')](_0x63d1('0xb'),auth[_0x63d1('0x9')](),controller[_0x63d1('0xc')]);router[_0x63d1('0x8')]('/:id/dispositions',auth[_0x63d1('0x9')](),controller[_0x63d1('0xd')]);router[_0x63d1('0x8')](_0x63d1('0xe'),auth[_0x63d1('0x9')](),controller[_0x63d1('0xf')]);router[_0x63d1('0x8')](_0x63d1('0x10'),auth[_0x63d1('0x9')](),controller['getContactsCsv']);router['get'](_0x63d1('0x11'),auth[_0x63d1('0x9')](),controller['getCustomFields']);router[_0x63d1('0x8')](_0x63d1('0x12'),auth[_0x63d1('0x9')](),controller[_0x63d1('0x13')]);router[_0x63d1('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x63d1('0x14')](_0x63d1('0x15'),auth['isAuthenticated'](),controller[_0x63d1('0x16')]);router[_0x63d1('0x14')](_0x63d1('0xe'),auth[_0x63d1('0x9')](),controller['addContacts']);router[_0x63d1('0x14')]('/:id/fields',auth['isAuthenticated'](),controller['addCustomField']);router[_0x63d1('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x63d1('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x63d1('0x18')]);router[_0x63d1('0x19')](_0x63d1('0xb'),auth[_0x63d1('0x9')](),controller['destroy']);router['delete'](_0x63d1('0x15'),auth[_0x63d1('0x9')](),controller[_0x63d1('0x1a')]);router[_0x63d1('0x19')](_0x63d1('0x12'),auth[_0x63d1('0x9')](),controller[_0x63d1('0x1b')]);module[_0x63d1('0x1c')]=router; \ No newline at end of file +var _0x4140=['getCustomFields','/:id/users','post','create','addContacts','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','Router','fs-extra','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields'];(function(_0x146ee5,_0xb51cd3){var _0x3fe921=function(_0x3f4ea0){while(--_0x3f4ea0){_0x146ee5['push'](_0x146ee5['shift']());}};_0x3fe921(++_0xb51cd3);}(_0x4140,0xbb));var _0x0414=function(_0x7c1a5d,_0x4bcb22){_0x7c1a5d=_0x7c1a5d-0x0;var _0x1cceb3=_0x4140[_0x7c1a5d];return _0x1cceb3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0414('0x0')]();var fs_extra=require(_0x0414('0x1'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0414('0x2'));var controller=require(_0x0414('0x3'));router[_0x0414('0x4')]('/',auth[_0x0414('0x5')](),controller[_0x0414('0x6')]);router[_0x0414('0x4')](_0x0414('0x7'),auth[_0x0414('0x5')](),controller['describe']);router[_0x0414('0x4')](_0x0414('0x8'),auth[_0x0414('0x5')](),controller[_0x0414('0x9')]);router[_0x0414('0x4')](_0x0414('0xa'),auth[_0x0414('0x5')](),controller[_0x0414('0xb')]);router['get'](_0x0414('0xc'),auth['isAuthenticated'](),controller[_0x0414('0xd')]);router[_0x0414('0x4')](_0x0414('0xe'),auth[_0x0414('0x5')](),controller['getContactsCsv']);router[_0x0414('0x4')](_0x0414('0xf'),auth['isAuthenticated'](),controller[_0x0414('0x10')]);router[_0x0414('0x4')](_0x0414('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0414('0x12')]('/',auth[_0x0414('0x5')](),controller[_0x0414('0x13')]);router[_0x0414('0x12')](_0x0414('0xa'),auth[_0x0414('0x5')](),controller['addDisposition']);router['post'](_0x0414('0xc'),auth['isAuthenticated'](),controller[_0x0414('0x14')]);router[_0x0414('0x12')](_0x0414('0xf'),auth[_0x0414('0x5')](),controller['addCustomField']);router['post'](_0x0414('0x11'),auth[_0x0414('0x5')](),controller[_0x0414('0x15')]);router[_0x0414('0x16')](_0x0414('0x8'),auth[_0x0414('0x5')](),controller[_0x0414('0x17')]);router[_0x0414('0x18')](_0x0414('0x8'),auth[_0x0414('0x5')](),controller[_0x0414('0x19')]);router[_0x0414('0x18')](_0x0414('0xa'),auth[_0x0414('0x5')](),controller[_0x0414('0x1a')]);router[_0x0414('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x0414('0x1b')]);module[_0x0414('0x1c')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1d6339b..d5322d0 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 _0x78cc=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x14bfd6,_0x5f3cf4){var _0x2c35ae=function(_0x1663a3){while(--_0x1663a3){_0x14bfd6['push'](_0x14bfd6['shift']());}};_0x2c35ae(++_0x5f3cf4);}(_0x78cc,0x1d8));var _0xc78c=function(_0x3fe078,_0x45c7f5){_0x3fe078=_0x3fe078-0x0;var _0x19db27=_0x78cc[_0x3fe078];return _0x19db27;};'use strict';var Sequelize=require(_0xc78c('0x0'));module[_0xc78c('0x1')]={'name':{'type':Sequelize[_0xc78c('0x2')],'get':function(_0x7b7fb2){return this[_0xc78c('0x3')](_0xc78c('0x4'));}},'field':{'type':Sequelize[_0xc78c('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xc78c('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xc78c('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x8be4=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x4f8ca8,_0x37f2df){var _0x54c936=function(_0x4c570e){while(--_0x4c570e){_0x4f8ca8['push'](_0x4f8ca8['shift']());}};_0x54c936(++_0x37f2df);}(_0x8be4,0xf7));var _0x48be=function(_0x535963,_0x326515){_0x535963=_0x535963-0x0;var _0x3975f6=_0x8be4[_0x535963];return _0x3975f6;};'use strict';var Sequelize=require(_0x48be('0x0'));module[_0x48be('0x1')]={'name':{'type':Sequelize[_0x48be('0x2')],'get':function(_0x2b9647){return this[_0x48be('0x3')](_0x48be('0x4'));}},'field':{'type':Sequelize[_0x48be('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x48be('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x48be('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 58a506b..51f66e9 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(_0x3d8f38,_0x2a35b6){var _0x4ccf8c=function(_0x152b32){while(--_0x152b32){_0x3d8f38['push'](_0x3d8f38['shift']());}};_0x4ccf8c(++_0x2a35b6);}(_0x7a54,0x106));var _0x47a5=function(_0x3b917d,_0x59f67f){_0x3b917d=_0x3b917d-0x0;var _0x8dd7bd=_0x7a54[_0x3b917d];return _0x8dd7bd;};'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 _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x36e7db,_0x3afbe8){var _0x172209=function(_0x5eccc0){while(--_0x5eccc0){_0x36e7db['push'](_0x36e7db['shift']());}};_0x172209(++_0x3afbe8);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index f6d2172..0c728dd 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 _0xb256=['moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x9b671a,_0x67166b){var _0x311286=function(_0x44ba72){while(--_0x44ba72){_0x9b671a['push'](_0x9b671a['shift']());}};_0x311286(++_0x67166b);}(_0xb256,0x106));var _0x6b25=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xb256[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x6b25('0x0'));var util=require(_0x6b25('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b25('0x2'));var BPromise=require(_0x6b25('0x3'));var rp=require(_0x6b25('0x4'));var fs=require('fs');var path=require(_0x6b25('0x5'));var rimraf=require('rimraf');var config=require(_0x6b25('0x6'));var attributes=require(_0x6b25('0x7'));module[_0x6b25('0x8')]=function(_0x2173aa,_0x4cb312){return _0x2173aa[_0x6b25('0x9')](_0x6b25('0xa'),attributes,{'tableName':_0x6b25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x779a=['rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x49f9c8,_0x1d7fc0){var _0x1fcaa9=function(_0x490c5d){while(--_0x490c5d){_0x49f9c8['push'](_0x49f9c8['shift']());}};_0x1fcaa9(++_0x1d7fc0);}(_0x779a,0x131));var _0xa779=function(_0x2ad166,_0x253cac){_0x2ad166=_0x2ad166-0x0;var _0x337f07=_0x779a[_0x2ad166];return _0x337f07;};'use strict';var _=require(_0xa779('0x0'));var util=require(_0xa779('0x1'));var logger=require(_0xa779('0x2'))(_0xa779('0x3'));var moment=require('moment');var BPromise=require(_0xa779('0x4'));var rp=require(_0xa779('0x5'));var fs=require('fs');var path=require(_0xa779('0x6'));var rimraf=require(_0xa779('0x7'));var config=require(_0xa779('0x8'));var attributes=require(_0xa779('0x9'));module[_0xa779('0xa')]=function(_0x28c902,_0x13a9a7){return _0x28c902[_0xa779('0xb')]('Condition',attributes,{'tableName':_0xa779('0xc'),'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 e33c2f0..ce1e2bb 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 _0x9360=['jayson/promise','client','http','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9360,0xd2));var _0x0936=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9360[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0936('0x0'));var util=require(_0x0936('0x1'));var moment=require(_0x0936('0x2'));var BPromise=require(_0x0936('0x3'));var rs=require(_0x0936('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0936('0x5'))['db'];var utils=require(_0x0936('0x6'));var logger=require(_0x0936('0x7'))(_0x0936('0x8'));var config=require(_0x0936('0x9'));var jayson=require(_0x0936('0xa'));var client=jayson[_0x0936('0xb')][_0x0936('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x493c05,_0x27a23c,_0x530c44){return new BPromise(function(_0x5161da,_0xa4fa52){return client['request'](_0x493c05,_0x530c44)['then'](function(_0x38c77e){logger[_0x0936('0xd')](_0x0936('0xe'),_0x27a23c,'request\x20sent');logger[_0x0936('0xf')](_0x0936('0x10'),_0x27a23c,'request\x20sent',JSON[_0x0936('0x11')](_0x38c77e));if(_0x38c77e['error']){if(_0x38c77e['error'][_0x0936('0x12')]===0x1f4){logger[_0x0936('0x13')](_0x0936('0xe'),_0x27a23c,_0x38c77e[_0x0936('0x13')][_0x0936('0x14')]);return _0xa4fa52(_0x38c77e['error'][_0x0936('0x14')]);}logger[_0x0936('0x13')](_0x0936('0xe'),_0x27a23c,_0x38c77e[_0x0936('0x13')][_0x0936('0x14')]);return _0x5161da(_0x38c77e[_0x0936('0x13')]['message']);}else{logger[_0x0936('0xd')](_0x0936('0xe'),_0x27a23c,_0x0936('0x15'));_0x5161da(_0x38c77e['result'][_0x0936('0x14')]);}})['catch'](function(_0xd0bd71){logger[_0x0936('0x13')]('Condition,\x20%s,\x20%s',_0x27a23c,_0xd0bd71);_0xa4fa52(_0xd0bd71);});});} \ No newline at end of file +var _0x0de0=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x482c6e,_0x25b9cf){var _0x490d38=function(_0x4edfd2){while(--_0x4edfd2){_0x482c6e['push'](_0x482c6e['shift']());}};_0x490d38(++_0x25b9cf);}(_0x0de0,0x1ce));var _0x00de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0de0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x00de('0x0'));var util=require(_0x00de('0x1'));var moment=require(_0x00de('0x2'));var BPromise=require(_0x00de('0x3'));var rs=require(_0x00de('0x4'));var fs=require('fs');var Redis=require(_0x00de('0x5'));var db=require(_0x00de('0x6'))['db'];var utils=require(_0x00de('0x7'));var logger=require(_0x00de('0x8'))(_0x00de('0x9'));var config=require(_0x00de('0xa'));var jayson=require(_0x00de('0xb'));var client=jayson[_0x00de('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363278,_0x5f06fc,_0x5b0ff8){return new BPromise(function(_0x560075,_0x3336cf){return client['request'](_0x363278,_0x5b0ff8)[_0x00de('0xd')](function(_0x138ffa){logger[_0x00de('0xe')](_0x00de('0xf'),_0x5f06fc,_0x00de('0x10'));logger['debug'](_0x00de('0x11'),_0x5f06fc,_0x00de('0x10'),JSON[_0x00de('0x12')](_0x138ffa));if(_0x138ffa[_0x00de('0x13')]){if(_0x138ffa[_0x00de('0x13')][_0x00de('0x14')]===0x1f4){logger[_0x00de('0x13')]('Condition,\x20%s,\x20%s',_0x5f06fc,_0x138ffa[_0x00de('0x13')][_0x00de('0x15')]);return _0x3336cf(_0x138ffa[_0x00de('0x13')][_0x00de('0x15')]);}logger[_0x00de('0x13')](_0x00de('0xf'),_0x5f06fc,_0x138ffa[_0x00de('0x13')]['message']);return _0x560075(_0x138ffa[_0x00de('0x13')]['message']);}else{logger[_0x00de('0xe')]('Condition,\x20%s,\x20%s',_0x5f06fc,_0x00de('0x10'));_0x560075(_0x138ffa[_0x00de('0x16')][_0x00de('0x15')]);}})[_0x00de('0x17')](function(_0x4ddca2){logger[_0x00de('0x13')](_0x00de('0xf'),_0x5f06fc,_0x4ddca2);_0x3336cf(_0x4ddca2);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 071e523..86e4946 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 _0x2ea7=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','delete','/:id','isAuthenticated','destroy'];(function(_0x3e8dba,_0x39cb30){var _0x1dd9eb=function(_0x406040){while(--_0x406040){_0x3e8dba['push'](_0x3e8dba['shift']());}};_0x1dd9eb(++_0x39cb30);}(_0x2ea7,0x1ec));var _0x72ea=function(_0x33bf01,_0x1898f9){_0x33bf01=_0x33bf01-0x0;var _0x1d1cd2=_0x2ea7[_0x33bf01];return _0x1d1cd2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x72ea('0x0'));var timeout=require('connect-timeout');var express=require(_0x72ea('0x1'));var router=express[_0x72ea('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x72ea('0x3'));var interaction=require(_0x72ea('0x4'));var config=require(_0x72ea('0x5'));var controller=require(_0x72ea('0x6'));router[_0x72ea('0x7')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x72ea('0x8')](_0x72ea('0x9'),auth[_0x72ea('0xa')](),controller[_0x72ea('0xb')]);module['exports']=router; \ No newline at end of file +var _0xb87c=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','put','isAuthenticated','update','delete','/:id','destroy','exports','multer'];(function(_0x11c2b8,_0x4e5d68){var _0x2ef559=function(_0x208b7b){while(--_0x208b7b){_0x11c2b8['push'](_0x11c2b8['shift']());}};_0x2ef559(++_0x4e5d68);}(_0xb87c,0x125));var _0xcb87=function(_0x4d31a2,_0x4ba34e){_0x4d31a2=_0x4d31a2-0x0;var _0x3c9f96=_0xb87c[_0x4d31a2];return _0x3c9f96;};'use strict';var multer=require(_0xcb87('0x0'));var util=require(_0xcb87('0x1'));var path=require(_0xcb87('0x2'));var timeout=require(_0xcb87('0x3'));var express=require(_0xcb87('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcb87('0x5'));var interaction=require(_0xcb87('0x6'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xcb87('0x7')]('/:id',auth[_0xcb87('0x8')](),controller[_0xcb87('0x9')]);router[_0xcb87('0xa')](_0xcb87('0xb'),auth[_0xcb87('0x8')](),controller[_0xcb87('0xc')]);module[_0xcb87('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 8170a46..5ca00b9 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 7830500..8e85ac0 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 _0x8e61=['sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','map','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','omit','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register'];(function(_0xc57fa4,_0x447484){var _0xc1b7bc=function(_0x309322){while(--_0x309322){_0xc57fa4['push'](_0xc57fa4['shift']());}};_0xc1b7bc(++_0x447484);}(_0x8e61,0x152));var _0x18e6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8e61[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0x18e6('0x0'));var rimraf=require(_0x18e6('0x1'));var zipdir=require(_0x18e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18e6('0x3'));var moment=require(_0x18e6('0x4'));var BPromise=require(_0x18e6('0x5'));var Mustache=require(_0x18e6('0x6'));var util=require('util');var path=require(_0x18e6('0x7'));var sox=require(_0x18e6('0x8'));var csv=require(_0x18e6('0x9'));var ejs=require(_0x18e6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18e6('0xb'));var squel=require(_0x18e6('0xc'));var crypto=require('crypto');var jsforce=require(_0x18e6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x18e6('0xe'));var Papa=require(_0x18e6('0xf'));var Redis=require(_0x18e6('0x10'));var authService=require(_0x18e6('0x11'));var qs=require(_0x18e6('0x12'));var as=require(_0x18e6('0x13'));var hardwareService=require(_0x18e6('0x14'));var logger=require(_0x18e6('0x15'))('api');var utils=require(_0x18e6('0x16'));var config=require(_0x18e6('0x17'));var licenseUtil=require(_0x18e6('0x18'));var db=require(_0x18e6('0x19'))['db'];config[_0x18e6('0x1a')]=_[_0x18e6('0x1b')](config[_0x18e6('0x1a')],{'host':_0x18e6('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18e6('0x1a')]));require(_0x18e6('0x1d'))[_0x18e6('0x1e')](socket);function respondWithStatusCode(_0x568343,_0x656cbb){_0x656cbb=_0x656cbb||0xcc;return function(_0x4a203a){if(_0x4a203a){return _0x568343[_0x18e6('0x1f')](_0x656cbb);}return _0x568343[_0x18e6('0x20')](_0x656cbb)[_0x18e6('0x21')]();};}function respondWithResult(_0x445398,_0x525956){_0x525956=_0x525956||0xc8;return function(_0x233189){if(_0x233189){return _0x445398[_0x18e6('0x20')](_0x525956)[_0x18e6('0x22')](_0x233189);}};}function respondWithFilteredResult(_0xe3ae07,_0x131a11){return function(_0x344588){if(_0x344588){var _0x4247a0=typeof _0x131a11[_0x18e6('0x23')]==='undefined'&&typeof _0x131a11[_0x18e6('0x24')]==='undefined';var _0x27ed7b=_0x344588[_0x18e6('0x25')];var _0x3fdfe1=_0x4247a0?0x0:_0x131a11['offset'];var _0x48d14e=_0x4247a0?_0x344588[_0x18e6('0x25')]:_0x131a11[_0x18e6('0x23')]+_0x131a11[_0x18e6('0x24')];var _0x276768;if(_0x48d14e>=_0x27ed7b){_0x48d14e=_0x27ed7b;_0x276768=0xc8;}else{_0x276768=0xce;}_0xe3ae07[_0x18e6('0x20')](_0x276768);return _0xe3ae07[_0x18e6('0x26')](_0x18e6('0x27'),_0x3fdfe1+'-'+_0x48d14e+'/'+_0x27ed7b)[_0x18e6('0x22')](_0x344588);}return null;};}function patchUpdates(_0x2ccc9e){return function(_0x21f87e){try{jsonpatch[_0x18e6('0x28')](_0x21f87e,_0x2ccc9e,!![]);}catch(_0x41555a){return BPromise[_0x18e6('0x29')](_0x41555a);}return _0x21f87e[_0x18e6('0x2a')]();};}function saveUpdates(_0x49673d,_0x54d164){return function(_0x2fa135){if(_0x2fa135){return _0x2fa135[_0x18e6('0x2b')](_0x49673d)[_0x18e6('0x2c')](function(_0x12768e){return _0x12768e;});}return null;};}function removeEntity(_0x48850d,_0xc87b5c){return function(_0x2e3555){if(_0x2e3555){return _0x2e3555[_0x18e6('0x2d')]()[_0x18e6('0x2c')](function(){var _0x7e2367=_0x2e3555[_0x18e6('0x2e')]({'plain':!![]});var _0x39c8c6=_0x18e6('0x2f');return db[_0x18e6('0x30')]['destroy']({'where':{'type':_0x39c8c6,'resourceId':_0x7e2367['id']}})[_0x18e6('0x2c')](function(){return _0x2e3555;});})[_0x18e6('0x2c')](function(){_0x48850d[_0x18e6('0x20')](0xcc)[_0x18e6('0x21')]();});}};}function handleEntityNotFound(_0x345ed5,_0x349903){return function(_0xc9dbee){if(!_0xc9dbee){_0x345ed5['sendStatus'](0x194);}return _0xc9dbee;};}function handleError(_0x5e0cd8,_0x5c687f){_0x5c687f=_0x5c687f||0x1f4;return function(_0x4036e6){logger['error'](_0x4036e6[_0x18e6('0x31')]);if(_0x4036e6[_0x18e6('0x32')]){delete _0x4036e6[_0x18e6('0x32')];}_0x5e0cd8[_0x18e6('0x20')](_0x5c687f)['send'](_0x4036e6);};}exports['index']=function(_0x1ca1ce,_0x15e9a3){var _0x26454c={},_0x200ed3={},_0x4c7fc9={'count':0x0,'rows':[]};var _0x4f8e2a=_[_0x18e6('0x33')](db['Dashboard'][_0x18e6('0x34')],function(_0x24e26d){return{'name':_0x24e26d[_0x18e6('0x35')],'type':_0x24e26d[_0x18e6('0x36')]['key']};});_0x200ed3['model']=_['map'](_0x4f8e2a,_0x18e6('0x32'));_0x200ed3[_0x18e6('0x37')]=_['keys'](_0x1ca1ce['query']);_0x200ed3[_0x18e6('0x38')]=_['intersection'](_0x200ed3[_0x18e6('0x39')],_0x200ed3[_0x18e6('0x37')]);_0x26454c[_0x18e6('0x3a')]=_[_0x18e6('0x3b')](_0x200ed3[_0x18e6('0x39')],qs[_0x18e6('0x3c')](_0x1ca1ce[_0x18e6('0x37')][_0x18e6('0x3c')]));_0x26454c['attributes']=_0x26454c[_0x18e6('0x3a')][_0x18e6('0x3d')]?_0x26454c[_0x18e6('0x3a')]:_0x200ed3[_0x18e6('0x39')];if(!_0x1ca1ce[_0x18e6('0x37')][_0x18e6('0x3e')](_0x18e6('0x3f'))){_0x26454c[_0x18e6('0x24')]=qs[_0x18e6('0x24')](_0x1ca1ce['query'][_0x18e6('0x24')]);_0x26454c[_0x18e6('0x23')]=qs['offset'](_0x1ca1ce['query'][_0x18e6('0x23')]);}_0x26454c[_0x18e6('0x40')]=qs[_0x18e6('0x41')](_0x1ca1ce['query']['sort']);_0x26454c[_0x18e6('0x42')]=qs[_0x18e6('0x38')](_[_0x18e6('0x43')](_0x1ca1ce['query'],_0x200ed3[_0x18e6('0x38')]),_0x4f8e2a);if(_0x1ca1ce['query'][_0x18e6('0x44')]){_0x26454c[_0x18e6('0x42')]=_[_0x18e6('0x45')](_0x26454c[_0x18e6('0x42')],{'$or':_[_0x18e6('0x33')](_0x4f8e2a,function(_0xf651b6){if(_0xf651b6[_0x18e6('0x36')]!==_0x18e6('0x46')){var _0x1ac0d7={};_0x1ac0d7[_0xf651b6[_0x18e6('0x32')]]={'$like':'%'+_0x1ca1ce[_0x18e6('0x37')][_0x18e6('0x44')]+'%'};return _0x1ac0d7;}})});}_0x26454c=_[_0x18e6('0x45')]({},_0x26454c,_0x1ca1ce[_0x18e6('0x47')]);var _0x766210={'where':_0x26454c[_0x18e6('0x42')]};return db[_0x18e6('0x48')][_0x18e6('0x25')](_0x766210)[_0x18e6('0x2c')](function(_0x1576f7){_0x4c7fc9[_0x18e6('0x25')]=_0x1576f7;if(_0x1ca1ce[_0x18e6('0x37')][_0x18e6('0x49')]){_0x26454c[_0x18e6('0x4a')]=[{'all':!![]}];}return db['Dashboard'][_0x18e6('0x4b')](_0x26454c);})[_0x18e6('0x2c')](function(_0x1e4c90){_0x4c7fc9[_0x18e6('0x4c')]=_0x1e4c90;return _0x4c7fc9;})[_0x18e6('0x2c')](respondWithFilteredResult(_0x15e9a3,_0x26454c))[_0x18e6('0x4d')](handleError(_0x15e9a3,null));};exports[_0x18e6('0x4e')]=function(_0xbc2429,_0x24cd23){var _0x6e8980={'raw':![],'where':{'id':_0xbc2429[_0x18e6('0x4f')]['id']}},_0x58bed4={};_0x58bed4[_0x18e6('0x39')]=_[_0x18e6('0x50')](db['Dashboard'][_0x18e6('0x34')]);_0x58bed4[_0x18e6('0x37')]=_[_0x18e6('0x50')](_0xbc2429[_0x18e6('0x37')]);_0x58bed4[_0x18e6('0x38')]=_['intersection'](_0x58bed4[_0x18e6('0x39')],_0x58bed4[_0x18e6('0x37')]);_0x6e8980[_0x18e6('0x3a')]=_[_0x18e6('0x3b')](_0x58bed4[_0x18e6('0x39')],qs[_0x18e6('0x3c')](_0xbc2429[_0x18e6('0x37')]['fields']));_0x6e8980[_0x18e6('0x3a')]=_0x6e8980[_0x18e6('0x3a')][_0x18e6('0x3d')]?_0x6e8980[_0x18e6('0x3a')]:_0x58bed4['model'];if(_0xbc2429[_0x18e6('0x37')][_0x18e6('0x49')]){_0x6e8980[_0x18e6('0x4a')]=[{'all':!![]}];}_0x6e8980=_[_0x18e6('0x45')]({},_0x6e8980,_0xbc2429['options']);return db[_0x18e6('0x48')][_0x18e6('0x51')](_0x6e8980)[_0x18e6('0x2c')](handleEntityNotFound(_0x24cd23,null))[_0x18e6('0x2c')](respondWithResult(_0x24cd23,null))['catch'](handleError(_0x24cd23,null));};exports[_0x18e6('0x52')]=function(_0x266873,_0x4841fc){return db[_0x18e6('0x48')][_0x18e6('0x52')](_0x266873[_0x18e6('0x53')],{})[_0x18e6('0x2c')](function(_0x5dafb1){var _0x542284=_0x266873[_0x18e6('0x54')]['get']({'plain':!![]});if(!_0x542284)throw new Error(_0x18e6('0x55'));if(_0x542284[_0x18e6('0x56')]===_0x18e6('0x54')){var _0x52cbf1=_0x5dafb1[_0x18e6('0x2e')]({'plain':!![]});var _0x3a7db5='CustomDashboards';return db[_0x18e6('0x57')][_0x18e6('0x51')]({'where':{'name':_0x3a7db5,'userProfileId':_0x542284[_0x18e6('0x58')]},'raw':!![]})['then'](function(_0x4722b7){if(_0x4722b7&&_0x4722b7[_0x18e6('0x59')]===0x0){return db[_0x18e6('0x30')][_0x18e6('0x52')]({'name':_0x52cbf1[_0x18e6('0x32')],'resourceId':_0x52cbf1['id'],'type':_0x4722b7[_0x18e6('0x32')],'sectionId':_0x4722b7['id']},{})['then'](function(){return _0x5dafb1;});}else{return _0x5dafb1;}})[_0x18e6('0x4d')](function(_0x3893c0){logger[_0x18e6('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3893c0);throw _0x3893c0;});}return _0x5dafb1;})[_0x18e6('0x2c')](respondWithResult(_0x4841fc,0xc9))[_0x18e6('0x4d')](handleError(_0x4841fc,null));};exports[_0x18e6('0x5b')]=function(_0x2272f5,_0x32a428){var _0x32b14f={'where':{'id':_0x2272f5[_0x18e6('0x4f')]['id']}},_0x161332={};_0x161332[_0x18e6('0x39')]=_[_0x18e6('0x50')](db[_0x18e6('0x48')][_0x18e6('0x34')]);_0x32b14f['attributes']=_[_0x18e6('0x3b')](_0x161332['model'],qs[_0x18e6('0x3c')](_0x2272f5[_0x18e6('0x37')]['fields']));_0x32b14f['attributes']=_0x32b14f['attributes'][_0x18e6('0x3d')]?_0x32b14f[_0x18e6('0x3a')]:_0x161332[_0x18e6('0x39')];if(_0x2272f5['query'][_0x18e6('0x49')]){_0x32b14f[_0x18e6('0x4a')]=[{'all':!![]}];}_0x32b14f=_[_0x18e6('0x45')]({},_0x32b14f,_0x2272f5['options']);return db[_0x18e6('0x48')][_0x18e6('0x51')](_0x32b14f)['then'](handleEntityNotFound(_0x32a428,null))[_0x18e6('0x2c')](function(_0x4b8f61){if(_0x4b8f61){var _0x270b9b=_0x4b8f61[_0x18e6('0x2e')]({'plain':!![]});_0x270b9b=qs[_0x18e6('0x5c')](_0x270b9b,['id',_0x18e6('0x5d'),'updatedAt']);_0x2272f5[_0x18e6('0x53')]=_[_0x18e6('0x5c')](_0x2272f5[_0x18e6('0x53')],['id',_0x18e6('0x5d'),'updatedAt']);return db[_0x18e6('0x48')][_0x18e6('0x52')](_[_0x18e6('0x45')](_0x270b9b,_0x2272f5[_0x18e6('0x53')]),{'include':_0x2272f5[_0x18e6('0x37')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x36ee2c){var _0x59060a=_0x2272f5[_0x18e6('0x54')][_0x18e6('0x2e')]({'plain':!![]});if(!_0x59060a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59060a['role']===_0x18e6('0x54')){var _0x14033=_0x36ee2c[_0x18e6('0x2e')]({'plain':!![]});var _0x3d8c6a='CustomDashboards';return db[_0x18e6('0x57')][_0x18e6('0x51')]({'where':{'name':_0x3d8c6a,'userProfileId':_0x59060a[_0x18e6('0x58')]},'raw':!![]})[_0x18e6('0x2c')](function(_0x53415e){if(_0x53415e&&_0x53415e['autoAssociation']===0x0){return db[_0x18e6('0x30')][_0x18e6('0x52')]({'name':_0x14033[_0x18e6('0x32')],'resourceId':_0x14033['id'],'type':_0x53415e[_0x18e6('0x32')],'sectionId':_0x53415e['id']},{})[_0x18e6('0x2c')](function(){return _0x36ee2c;});}else{return _0x36ee2c;}})[_0x18e6('0x4d')](function(_0x3e74cb){logger[_0x18e6('0x5a')](_0x18e6('0x5e'),_0x3e74cb);throw _0x3e74cb;});}return _0x36ee2c;});}})['then'](respondWithResult(_0x32a428,0xc9))[_0x18e6('0x4d')](handleError(_0x32a428,null));};exports['update']=function(_0x720718,_0x37f53b){if(_0x720718[_0x18e6('0x53')]['id']){delete _0x720718[_0x18e6('0x53')]['id'];}return db[_0x18e6('0x48')][_0x18e6('0x51')]({'where':{'id':_0x720718['params']['id']}})[_0x18e6('0x2c')](handleEntityNotFound(_0x37f53b,null))[_0x18e6('0x2c')](saveUpdates(_0x720718[_0x18e6('0x53')],null))[_0x18e6('0x2c')](respondWithResult(_0x37f53b,null))[_0x18e6('0x4d')](handleError(_0x37f53b,null));};exports[_0x18e6('0x2d')]=function(_0x32c11e,_0x53df93){return db[_0x18e6('0x48')]['find']({'where':{'id':_0x32c11e['params']['id']}})[_0x18e6('0x2c')](handleEntityNotFound(_0x53df93,null))[_0x18e6('0x2c')](removeEntity(_0x53df93,null))['catch'](handleError(_0x53df93,null));};function widgetAttributes(_0x186339){try{switch(_0x186339[_0x18e6('0x36')]){case'iframe':return[{'name':_0x18e6('0x5f'),'value':_0x186339[_0x18e6('0x5f')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339[_0x18e6('0x60')][0x0]['value']:undefined)||_0x18e6('0x61')}];case _0x18e6('0x62'):return[{'name':_0x18e6('0x63'),'value':_0x186339[_0x18e6('0x63')]||(_0x186339[_0x18e6('0x60')]&&_0x186339['attrs'][0x0]?_0x186339['attrs'][0x0][_0x18e6('0x64')]:undefined)||''}];case'clock':return[{'name':_0x18e6('0x65'),'value':_0x186339[_0x18e6('0x65')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339[_0x18e6('0x60')][0x0]['value']:undefined)||_0x18e6('0x66')},{'name':'attrTimezone','value':_0x186339[_0x18e6('0x67')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x1]?_0x186339[_0x18e6('0x60')][0x1]['value']:undefined)||_0x18e6('0x68')},{'name':_0x18e6('0x69'),'value':_0x186339[_0x18e6('0x69')]||(_0x186339['attrs']&&_0x186339[_0x18e6('0x60')][0x2]?_0x186339[_0x18e6('0x60')][0x2][_0x18e6('0x64')]:undefined)||0xc}];case _0x18e6('0x6a'):return[{'name':_0x18e6('0x6b'),'value':_0x186339[_0x18e6('0x6b')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339['attrs'][0x0][_0x18e6('0x64')]:undefined)||_0x18e6('0x6c')},{'name':_0x18e6('0x6d'),'value':_0x186339[_0x18e6('0x6d')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x1]?_0x186339['attrs'][0x1][_0x18e6('0x64')]:undefined)||[]},{'name':_0x18e6('0x69'),'value':_0x186339[_0x18e6('0x69')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x2]?_0x186339[_0x18e6('0x60')][0x2][_0x18e6('0x64')]:undefined)||0x14}];case'multibar-chart':case _0x18e6('0x6e'):return[{'name':_0x18e6('0x6f'),'value':_0x186339['attrSerie1']||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339[_0x18e6('0x60')][0x0][_0x18e6('0x64')]:undefined)||_0x18e6('0x6c')},{'name':_0x18e6('0x70'),'value':_0x186339[_0x18e6('0x70')]||(_0x186339[_0x18e6('0x60')]&&_0x186339['attrs'][0x1]?_0x186339[_0x18e6('0x60')][0x1]['value']:undefined)||null},{'name':_0x18e6('0x71'),'value':_0x186339[_0x18e6('0x71')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x2]?_0x186339[_0x18e6('0x60')][0x2][_0x18e6('0x64')]:undefined)||null},{'name':_0x18e6('0x6d'),'value':_0x186339[_0x18e6('0x6d')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x3]?_0x186339['attrs'][0x3]['value']:undefined)||[]}];case _0x18e6('0x72'):return[{'name':_0x18e6('0x73'),'type':_0x186339[_0x18e6('0x74')]||(_0x186339['attrs']&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339['attrs'][0x0][_0x18e6('0x36')]:undefined)||null,'value':_0x186339['attrReport']||(_0x186339['attrs']&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x186339[_0x18e6('0x75')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x1]?_0x186339[_0x18e6('0x60')][0x1][_0x18e6('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x5f459d){logger['error']('widgetAttributes:\x20%s',JSON[_0x18e6('0x76')](_0x5f459d));return[];}}exports[_0x18e6('0x77')]=function(_0x3f64ff,_0x4a0f5a,_0x29fdff){if(_0x3f64ff[_0x18e6('0x53')]['id']){delete _0x3f64ff['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x3f64ff['params']['id']}})[_0x18e6('0x2c')](handleEntityNotFound(_0x4a0f5a,null))['then'](function(_0x316a32){if(_0x316a32){_0x3f64ff[_0x18e6('0x53')][_0x18e6('0x78')]=_0x316a32['id'];_0x3f64ff[_0x18e6('0x53')][_0x18e6('0x60')]=widgetAttributes(_0x3f64ff['body']);return db[_0x18e6('0x79')][_0x18e6('0x52')](_0x3f64ff[_0x18e6('0x53')]);}})[_0x18e6('0x2c')](respondWithResult(_0x4a0f5a,null))[_0x18e6('0x4d')](handleError(_0x4a0f5a,null));};exports['getItems']=function(_0x3886a5,_0x520478,_0x5f04b6){var _0x5c0789={};var _0x4e95c1={};var _0x147c04;var _0x5679cb;return db[_0x18e6('0x48')]['findOne']({'where':{'id':_0x3886a5['params']['id']}})['then'](handleEntityNotFound(_0x520478,null))[_0x18e6('0x2c')](function(_0xd12832){if(_0xd12832){_0x147c04=_0xd12832;_0x4e95c1[_0x18e6('0x39')]=_[_0x18e6('0x50')](db[_0x18e6('0x79')][_0x18e6('0x34')]);_0x4e95c1[_0x18e6('0x37')]=_[_0x18e6('0x50')](_0x3886a5[_0x18e6('0x37')]);_0x4e95c1[_0x18e6('0x38')]=_[_0x18e6('0x3b')](_0x4e95c1[_0x18e6('0x39')],_0x4e95c1[_0x18e6('0x37')]);_0x5c0789[_0x18e6('0x3a')]=_[_0x18e6('0x3b')](_0x4e95c1[_0x18e6('0x39')],qs[_0x18e6('0x3c')](_0x3886a5[_0x18e6('0x37')][_0x18e6('0x3c')]));_0x5c0789[_0x18e6('0x3a')]=_0x5c0789['attributes'][_0x18e6('0x3d')]?_0x5c0789[_0x18e6('0x3a')]:_0x4e95c1[_0x18e6('0x39')];_0x5c0789[_0x18e6('0x40')]=qs[_0x18e6('0x41')](_0x3886a5['query'][_0x18e6('0x41')]);_0x5c0789[_0x18e6('0x42')]=qs[_0x18e6('0x38')](_[_0x18e6('0x43')](_0x3886a5['query'],_0x4e95c1[_0x18e6('0x38')]));if(_0x3886a5[_0x18e6('0x37')]['filter']){_0x5c0789[_0x18e6('0x42')]=_[_0x18e6('0x45')](_0x5c0789[_0x18e6('0x42')],{'$or':_[_0x18e6('0x33')](_0x5c0789['attributes'],function(_0x243683){var _0x23a7f1={};_0x23a7f1[_0x243683]={'$like':'%'+_0x3886a5[_0x18e6('0x37')][_0x18e6('0x44')]+'%'};return _0x23a7f1;})});}_0x5c0789=_[_0x18e6('0x45')]({},_0x5c0789,_0x3886a5['options']);return _0x147c04[_0x18e6('0x7a')](_0x5c0789);}})[_0x18e6('0x2c')](function(_0x47fbfc){if(_0x47fbfc){_0x5679cb=_0x47fbfc['length'];if(!_0x3886a5[_0x18e6('0x37')][_0x18e6('0x3e')](_0x18e6('0x3f'))){_0x5c0789[_0x18e6('0x24')]=qs['limit'](_0x3886a5['query'][_0x18e6('0x24')]);_0x5c0789[_0x18e6('0x23')]=qs['offset'](_0x3886a5[_0x18e6('0x37')][_0x18e6('0x23')]);}return _0x147c04[_0x18e6('0x7a')](_0x5c0789);}})[_0x18e6('0x2c')](function(_0x560cd1){if(_0x560cd1){return _0x560cd1?{'count':_0x5679cb,'rows':_0x560cd1}:null;}})['then'](respondWithResult(_0x520478,null))[_0x18e6('0x4d')](handleError(_0x520478,null));}; \ No newline at end of file +var _0x0934=['attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','Dashboard','includeAll','include','findAll','rows','params','find','catch','create','body','role','CustomDashboards','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report'];(function(_0x555735,_0x5328e6){var _0x5ace26=function(_0x5b3986){while(--_0x5b3986){_0x555735['push'](_0x555735['shift']());}};_0x5ace26(++_0x5328e6);}(_0x0934,0xf1));var _0x4093=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x0934[_0x56756b];return _0xa3002;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4093('0x0'));var zipdir=require(_0x4093('0x1'));var jsonpatch=require(_0x4093('0x2'));var rp=require('request-promise');var moment=require(_0x4093('0x3'));var BPromise=require(_0x4093('0x4'));var Mustache=require(_0x4093('0x5'));var util=require(_0x4093('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4093('0x7'));var ejs=require(_0x4093('0x8'));var fs=require('fs');var fs_extra=require(_0x4093('0x9'));var _=require(_0x4093('0xa'));var squel=require(_0x4093('0xb'));var crypto=require('crypto');var jsforce=require(_0x4093('0xc'));var deskjs=require(_0x4093('0xd'));var toCsv=require(_0x4093('0x7'));var querystring=require('querystring');var Papa=require(_0x4093('0xe'));var Redis=require('ioredis');var authService=require(_0x4093('0xf'));var qs=require(_0x4093('0x10'));var as=require(_0x4093('0x11'));var hardwareService=require(_0x4093('0x12'));var logger=require('../../config/logger')(_0x4093('0x13'));var utils=require('../../config/utils');var config=require(_0x4093('0x14'));var licenseUtil=require(_0x4093('0x15'));var db=require(_0x4093('0x16'))['db'];config['redis']=_[_0x4093('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4093('0x18'))(new Redis(config[_0x4093('0x19')]));require('./dashboard.socket')[_0x4093('0x1a')](socket);function respondWithStatusCode(_0x1524bd,_0x2935ee){_0x2935ee=_0x2935ee||0xcc;return function(_0x45c879){if(_0x45c879){return _0x1524bd[_0x4093('0x1b')](_0x2935ee);}return _0x1524bd[_0x4093('0x1c')](_0x2935ee)[_0x4093('0x1d')]();};}function respondWithResult(_0x1d6343,_0x16be7b){_0x16be7b=_0x16be7b||0xc8;return function(_0x5f1b8e){if(_0x5f1b8e){return _0x1d6343[_0x4093('0x1c')](_0x16be7b)[_0x4093('0x1e')](_0x5f1b8e);}};}function respondWithFilteredResult(_0x441618,_0x231bfd){return function(_0x210bcd){if(_0x210bcd){var _0x2e53f8=typeof _0x231bfd[_0x4093('0x1f')]==='undefined'&&typeof _0x231bfd[_0x4093('0x20')]===_0x4093('0x21');var _0x23d6d7=_0x210bcd[_0x4093('0x22')];var _0xe2bacd=_0x2e53f8?0x0:_0x231bfd['offset'];var _0xb949e3=_0x2e53f8?_0x210bcd[_0x4093('0x22')]:_0x231bfd[_0x4093('0x1f')]+_0x231bfd[_0x4093('0x20')];var _0x6e353;if(_0xb949e3>=_0x23d6d7){_0xb949e3=_0x23d6d7;_0x6e353=0xc8;}else{_0x6e353=0xce;}_0x441618[_0x4093('0x1c')](_0x6e353);return _0x441618['set'](_0x4093('0x23'),_0xe2bacd+'-'+_0xb949e3+'/'+_0x23d6d7)[_0x4093('0x1e')](_0x210bcd);}return null;};}function patchUpdates(_0x438ae0){return function(_0x4d9111){try{jsonpatch[_0x4093('0x24')](_0x4d9111,_0x438ae0,!![]);}catch(_0x49b373){return BPromise[_0x4093('0x25')](_0x49b373);}return _0x4d9111[_0x4093('0x26')]();};}function saveUpdates(_0x129035,_0xbc310e){return function(_0x36dc5d){if(_0x36dc5d){return _0x36dc5d['update'](_0x129035)[_0x4093('0x27')](function(_0x280b89){return _0x280b89;});}return null;};}function removeEntity(_0x3da484,_0x4f8758){return function(_0x51fcdf){if(_0x51fcdf){return _0x51fcdf[_0x4093('0x28')]()[_0x4093('0x27')](function(){var _0xe8f75d=_0x51fcdf[_0x4093('0x29')]({'plain':!![]});var _0x7f73af='CustomDashboards';return db[_0x4093('0x2a')][_0x4093('0x28')]({'where':{'type':_0x7f73af,'resourceId':_0xe8f75d['id']}})[_0x4093('0x27')](function(){return _0x51fcdf;});})[_0x4093('0x27')](function(){_0x3da484['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33c870,_0x5b21d1){return function(_0x416ee0){if(!_0x416ee0){_0x33c870[_0x4093('0x1b')](0x194);}return _0x416ee0;};}function handleError(_0x24e5ec,_0x934c43){_0x934c43=_0x934c43||0x1f4;return function(_0x169eb6){logger[_0x4093('0x2b')](_0x169eb6[_0x4093('0x2c')]);if(_0x169eb6[_0x4093('0x2d')]){delete _0x169eb6[_0x4093('0x2d')];}_0x24e5ec[_0x4093('0x1c')](_0x934c43)[_0x4093('0x2e')](_0x169eb6);};}exports['index']=function(_0x3fdf22,_0x1c84c8){var _0x408682={},_0x5644bf={},_0x4f7595={'count':0x0,'rows':[]};var _0x53ee16=_[_0x4093('0x2f')](db['Dashboard'][_0x4093('0x30')],function(_0xf9c9de){return{'name':_0xf9c9de['fieldName'],'type':_0xf9c9de['type'][_0x4093('0x31')]};});_0x5644bf['model']=_[_0x4093('0x2f')](_0x53ee16,'name');_0x5644bf[_0x4093('0x32')]=_[_0x4093('0x33')](_0x3fdf22[_0x4093('0x32')]);_0x5644bf[_0x4093('0x34')]=_[_0x4093('0x35')](_0x5644bf['model'],_0x5644bf['query']);_0x408682[_0x4093('0x36')]=_[_0x4093('0x35')](_0x5644bf[_0x4093('0x37')],qs[_0x4093('0x38')](_0x3fdf22[_0x4093('0x32')][_0x4093('0x38')]));_0x408682[_0x4093('0x36')]=_0x408682[_0x4093('0x36')][_0x4093('0x39')]?_0x408682[_0x4093('0x36')]:_0x5644bf[_0x4093('0x37')];if(!_0x3fdf22[_0x4093('0x32')][_0x4093('0x3a')](_0x4093('0x3b'))){_0x408682['limit']=qs[_0x4093('0x20')](_0x3fdf22[_0x4093('0x32')][_0x4093('0x20')]);_0x408682[_0x4093('0x1f')]=qs['offset'](_0x3fdf22['query'][_0x4093('0x1f')]);}_0x408682['order']=qs[_0x4093('0x3c')](_0x3fdf22['query']['sort']);_0x408682[_0x4093('0x3d')]=qs[_0x4093('0x34')](_[_0x4093('0x3e')](_0x3fdf22[_0x4093('0x32')],_0x5644bf[_0x4093('0x34')]),_0x53ee16);if(_0x3fdf22[_0x4093('0x32')][_0x4093('0x3f')]){_0x408682[_0x4093('0x3d')]=_[_0x4093('0x40')](_0x408682['where'],{'$or':_[_0x4093('0x2f')](_0x53ee16,function(_0x4623a8){if(_0x4623a8[_0x4093('0x41')]!=='VIRTUAL'){var _0x2c512e={};_0x2c512e[_0x4623a8[_0x4093('0x2d')]]={'$like':'%'+_0x3fdf22['query'][_0x4093('0x3f')]+'%'};return _0x2c512e;}})});}_0x408682=_[_0x4093('0x40')]({},_0x408682,_0x3fdf22[_0x4093('0x42')]);var _0xf6205f={'where':_0x408682[_0x4093('0x3d')]};return db[_0x4093('0x43')][_0x4093('0x22')](_0xf6205f)[_0x4093('0x27')](function(_0x58ded8){_0x4f7595[_0x4093('0x22')]=_0x58ded8;if(_0x3fdf22['query'][_0x4093('0x44')]){_0x408682[_0x4093('0x45')]=[{'all':!![]}];}return db[_0x4093('0x43')][_0x4093('0x46')](_0x408682);})[_0x4093('0x27')](function(_0x47019e){_0x4f7595[_0x4093('0x47')]=_0x47019e;return _0x4f7595;})['then'](respondWithFilteredResult(_0x1c84c8,_0x408682))['catch'](handleError(_0x1c84c8,null));};exports['show']=function(_0x5c52bb,_0x21b02c){var _0x4a5409={'raw':![],'where':{'id':_0x5c52bb[_0x4093('0x48')]['id']}},_0x4db742={};_0x4db742['model']=_[_0x4093('0x33')](db[_0x4093('0x43')][_0x4093('0x30')]);_0x4db742[_0x4093('0x32')]=_[_0x4093('0x33')](_0x5c52bb[_0x4093('0x32')]);_0x4db742[_0x4093('0x34')]=_['intersection'](_0x4db742[_0x4093('0x37')],_0x4db742['query']);_0x4a5409['attributes']=_[_0x4093('0x35')](_0x4db742['model'],qs[_0x4093('0x38')](_0x5c52bb[_0x4093('0x32')][_0x4093('0x38')]));_0x4a5409['attributes']=_0x4a5409[_0x4093('0x36')][_0x4093('0x39')]?_0x4a5409[_0x4093('0x36')]:_0x4db742[_0x4093('0x37')];if(_0x5c52bb[_0x4093('0x32')][_0x4093('0x44')]){_0x4a5409[_0x4093('0x45')]=[{'all':!![]}];}_0x4a5409=_[_0x4093('0x40')]({},_0x4a5409,_0x5c52bb[_0x4093('0x42')]);return db[_0x4093('0x43')][_0x4093('0x49')](_0x4a5409)[_0x4093('0x27')](handleEntityNotFound(_0x21b02c,null))[_0x4093('0x27')](respondWithResult(_0x21b02c,null))[_0x4093('0x4a')](handleError(_0x21b02c,null));};exports[_0x4093('0x4b')]=function(_0x2bc1e6,_0x2d5ea6){return db['Dashboard'][_0x4093('0x4b')](_0x2bc1e6[_0x4093('0x4c')],{})[_0x4093('0x27')](function(_0x5ec116){var _0x5f4a14=_0x2bc1e6['user'][_0x4093('0x29')]({'plain':!![]});if(!_0x5f4a14)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f4a14[_0x4093('0x4d')]==='user'){var _0x24683=_0x5ec116['get']({'plain':!![]});var _0x4d296a=_0x4093('0x4e');return db['UserProfileSection'][_0x4093('0x49')]({'where':{'name':_0x4d296a,'userProfileId':_0x5f4a14[_0x4093('0x4f')]},'raw':!![]})[_0x4093('0x27')](function(_0x4b2aec){if(_0x4b2aec&&_0x4b2aec[_0x4093('0x50')]===0x0){return db['UserProfileResource'][_0x4093('0x4b')]({'name':_0x24683[_0x4093('0x2d')],'resourceId':_0x24683['id'],'type':_0x4b2aec['name'],'sectionId':_0x4b2aec['id']},{})[_0x4093('0x27')](function(){return _0x5ec116;});}else{return _0x5ec116;}})[_0x4093('0x4a')](function(_0x194100){logger[_0x4093('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x194100);throw _0x194100;});}return _0x5ec116;})[_0x4093('0x27')](respondWithResult(_0x2d5ea6,0xc9))['catch'](handleError(_0x2d5ea6,null));};exports[_0x4093('0x51')]=function(_0x310b8b,_0x554196){var _0x27a385={'where':{'id':_0x310b8b['params']['id']}},_0x5050ba={};_0x5050ba['model']=_[_0x4093('0x33')](db[_0x4093('0x43')]['rawAttributes']);_0x27a385['attributes']=_[_0x4093('0x35')](_0x5050ba[_0x4093('0x37')],qs[_0x4093('0x38')](_0x310b8b['query']['fields']));_0x27a385[_0x4093('0x36')]=_0x27a385['attributes']['length']?_0x27a385[_0x4093('0x36')]:_0x5050ba['model'];if(_0x310b8b[_0x4093('0x32')][_0x4093('0x44')]){_0x27a385['include']=[{'all':!![]}];}_0x27a385=_[_0x4093('0x40')]({},_0x27a385,_0x310b8b['options']);return db[_0x4093('0x43')][_0x4093('0x49')](_0x27a385)[_0x4093('0x27')](handleEntityNotFound(_0x554196,null))[_0x4093('0x27')](function(_0x2175db){if(_0x2175db){var _0x16300e=_0x2175db[_0x4093('0x29')]({'plain':!![]});_0x16300e=qs['omit'](_0x16300e,['id',_0x4093('0x52'),_0x4093('0x53')]);_0x310b8b['body']=_[_0x4093('0x54')](_0x310b8b[_0x4093('0x4c')],['id',_0x4093('0x52'),_0x4093('0x53')]);return db[_0x4093('0x43')][_0x4093('0x4b')](_[_0x4093('0x40')](_0x16300e,_0x310b8b['body']),{'include':_0x310b8b[_0x4093('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x4093('0x27')](function(_0x5a6669){var _0x2a74e6=_0x310b8b[_0x4093('0x55')][_0x4093('0x29')]({'plain':!![]});if(!_0x2a74e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a74e6['role']==='user'){var _0xa3b5ab=_0x5a6669[_0x4093('0x29')]({'plain':!![]});var _0x2aadfb=_0x4093('0x4e');return db[_0x4093('0x56')]['find']({'where':{'name':_0x2aadfb,'userProfileId':_0x2a74e6[_0x4093('0x4f')]},'raw':!![]})[_0x4093('0x27')](function(_0x2939cd){if(_0x2939cd&&_0x2939cd['autoAssociation']===0x0){return db[_0x4093('0x2a')]['create']({'name':_0xa3b5ab[_0x4093('0x2d')],'resourceId':_0xa3b5ab['id'],'type':_0x2939cd[_0x4093('0x2d')],'sectionId':_0x2939cd['id']},{})[_0x4093('0x27')](function(){return _0x5a6669;});}else{return _0x5a6669;}})['catch'](function(_0x1ac244){logger[_0x4093('0x2b')](_0x4093('0x57'),_0x1ac244);throw _0x1ac244;});}return _0x5a6669;});}})['then'](respondWithResult(_0x554196,0xc9))[_0x4093('0x4a')](handleError(_0x554196,null));};exports['update']=function(_0x274c56,_0x5439fd){if(_0x274c56[_0x4093('0x4c')]['id']){delete _0x274c56[_0x4093('0x4c')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x274c56[_0x4093('0x48')]['id']}})[_0x4093('0x27')](handleEntityNotFound(_0x5439fd,null))[_0x4093('0x27')](saveUpdates(_0x274c56[_0x4093('0x4c')],null))[_0x4093('0x27')](respondWithResult(_0x5439fd,null))[_0x4093('0x4a')](handleError(_0x5439fd,null));};exports[_0x4093('0x28')]=function(_0x434e62,_0x16758a){return db[_0x4093('0x43')][_0x4093('0x49')]({'where':{'id':_0x434e62['params']['id']}})[_0x4093('0x27')](handleEntityNotFound(_0x16758a,null))[_0x4093('0x27')](removeEntity(_0x16758a,null))[_0x4093('0x4a')](handleError(_0x16758a,null));};function widgetAttributes(_0x3cb8d9){try{switch(_0x3cb8d9[_0x4093('0x41')]){case'iframe':return[{'name':'attrUrl','value':_0x3cb8d9['attrUrl']||(_0x3cb8d9['attrs']&&_0x3cb8d9[_0x4093('0x58')][0x0]?_0x3cb8d9[_0x4093('0x58')][0x0][_0x4093('0x59')]:undefined)||_0x4093('0x5a')}];case _0x4093('0x5b'):return[{'name':_0x4093('0x5c'),'value':_0x3cb8d9[_0x4093('0x5c')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9['attrs'][0x0]?_0x3cb8d9[_0x4093('0x58')][0x0][_0x4093('0x59')]:undefined)||''}];case'clock':return[{'name':_0x4093('0x5d'),'value':_0x3cb8d9[_0x4093('0x5d')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x0]?_0x3cb8d9['attrs'][0x0][_0x4093('0x59')]:undefined)||_0x4093('0x5e')},{'name':'attrTimezone','value':_0x3cb8d9['attrTimezone']||(_0x3cb8d9['attrs']&&_0x3cb8d9['attrs'][0x1]?_0x3cb8d9[_0x4093('0x58')][0x1][_0x4093('0x59')]:undefined)||_0x4093('0x5f')},{'name':_0x4093('0x60'),'value':_0x3cb8d9[_0x4093('0x60')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x2]?_0x3cb8d9[_0x4093('0x58')][0x2][_0x4093('0x59')]:undefined)||0xc}];case _0x4093('0x61'):return[{'name':_0x4093('0x62'),'value':_0x3cb8d9['attrMetric']||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x0]?_0x3cb8d9['attrs'][0x0]['value']:undefined)||_0x4093('0x63')},{'name':_0x4093('0x64'),'value':_0x3cb8d9[_0x4093('0x64')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x1]?_0x3cb8d9[_0x4093('0x58')][0x1][_0x4093('0x59')]:undefined)||[]},{'name':_0x4093('0x60'),'value':_0x3cb8d9[_0x4093('0x60')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x2]?_0x3cb8d9['attrs'][0x2][_0x4093('0x59')]:undefined)||0x14}];case _0x4093('0x65'):case _0x4093('0x66'):return[{'name':'attrSerie1','value':_0x3cb8d9[_0x4093('0x67')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x0]?_0x3cb8d9[_0x4093('0x58')][0x0][_0x4093('0x59')]:undefined)||_0x4093('0x63')},{'name':_0x4093('0x68'),'value':_0x3cb8d9[_0x4093('0x68')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x1]?_0x3cb8d9[_0x4093('0x58')][0x1][_0x4093('0x59')]:undefined)||null},{'name':_0x4093('0x69'),'value':_0x3cb8d9[_0x4093('0x69')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x2]?_0x3cb8d9[_0x4093('0x58')][0x2][_0x4093('0x59')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3cb8d9[_0x4093('0x64')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x3]?_0x3cb8d9['attrs'][0x3]['value']:undefined)||[]}];case _0x4093('0x6a'):return[{'name':_0x4093('0x6b'),'type':_0x3cb8d9[_0x4093('0x6c')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9['attrs'][0x0]?_0x3cb8d9['attrs'][0x0][_0x4093('0x41')]:undefined)||null,'value':_0x3cb8d9[_0x4093('0x6b')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9['attrs'][0x0]?_0x3cb8d9['attrs'][0x0][_0x4093('0x59')]:undefined)||null},{'name':'attrRefresh','value':_0x3cb8d9[_0x4093('0x6d')]||(_0x3cb8d9[_0x4093('0x58')]&&_0x3cb8d9[_0x4093('0x58')][0x1]?_0x3cb8d9[_0x4093('0x58')][0x1][_0x4093('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x599a0a){logger[_0x4093('0x2b')](_0x4093('0x6e'),JSON[_0x4093('0x6f')](_0x599a0a));return[];}}exports[_0x4093('0x70')]=function(_0x576e70,_0x35b699,_0x4ccc14){if(_0x576e70[_0x4093('0x4c')]['id']){delete _0x576e70[_0x4093('0x4c')]['id'];}return db[_0x4093('0x43')]['find']({'where':{'id':_0x576e70['params']['id']}})[_0x4093('0x27')](handleEntityNotFound(_0x35b699,null))[_0x4093('0x27')](function(_0x4c78fa){if(_0x4c78fa){_0x576e70[_0x4093('0x4c')][_0x4093('0x71')]=_0x4c78fa['id'];_0x576e70[_0x4093('0x4c')][_0x4093('0x58')]=widgetAttributes(_0x576e70[_0x4093('0x4c')]);return db[_0x4093('0x72')]['create'](_0x576e70[_0x4093('0x4c')]);}})[_0x4093('0x27')](respondWithResult(_0x35b699,null))[_0x4093('0x4a')](handleError(_0x35b699,null));};exports[_0x4093('0x73')]=function(_0x3aae1e,_0x570557,_0x2e292a){var _0x10c147={};var _0x430022={};var _0x2f0b0c;var _0x25c634;return db[_0x4093('0x43')]['findOne']({'where':{'id':_0x3aae1e[_0x4093('0x48')]['id']}})[_0x4093('0x27')](handleEntityNotFound(_0x570557,null))['then'](function(_0x1b15ec){if(_0x1b15ec){_0x2f0b0c=_0x1b15ec;_0x430022[_0x4093('0x37')]=_[_0x4093('0x33')](db[_0x4093('0x72')][_0x4093('0x30')]);_0x430022[_0x4093('0x32')]=_[_0x4093('0x33')](_0x3aae1e[_0x4093('0x32')]);_0x430022[_0x4093('0x34')]=_['intersection'](_0x430022[_0x4093('0x37')],_0x430022[_0x4093('0x32')]);_0x10c147[_0x4093('0x36')]=_['intersection'](_0x430022[_0x4093('0x37')],qs[_0x4093('0x38')](_0x3aae1e['query'][_0x4093('0x38')]));_0x10c147[_0x4093('0x36')]=_0x10c147[_0x4093('0x36')][_0x4093('0x39')]?_0x10c147['attributes']:_0x430022['model'];_0x10c147['order']=qs[_0x4093('0x3c')](_0x3aae1e[_0x4093('0x32')][_0x4093('0x3c')]);_0x10c147['where']=qs[_0x4093('0x34')](_[_0x4093('0x3e')](_0x3aae1e[_0x4093('0x32')],_0x430022[_0x4093('0x34')]));if(_0x3aae1e[_0x4093('0x32')][_0x4093('0x3f')]){_0x10c147[_0x4093('0x3d')]=_[_0x4093('0x40')](_0x10c147[_0x4093('0x3d')],{'$or':_[_0x4093('0x2f')](_0x10c147[_0x4093('0x36')],function(_0x778e29){var _0x212c05={};_0x212c05[_0x778e29]={'$like':'%'+_0x3aae1e[_0x4093('0x32')][_0x4093('0x3f')]+'%'};return _0x212c05;})});}_0x10c147=_[_0x4093('0x40')]({},_0x10c147,_0x3aae1e[_0x4093('0x42')]);return _0x2f0b0c[_0x4093('0x73')](_0x10c147);}})[_0x4093('0x27')](function(_0xf39bc1){if(_0xf39bc1){_0x25c634=_0xf39bc1[_0x4093('0x39')];if(!_0x3aae1e[_0x4093('0x32')][_0x4093('0x3a')]('nolimit')){_0x10c147[_0x4093('0x20')]=qs[_0x4093('0x20')](_0x3aae1e[_0x4093('0x32')][_0x4093('0x20')]);_0x10c147[_0x4093('0x1f')]=qs[_0x4093('0x1f')](_0x3aae1e[_0x4093('0x32')][_0x4093('0x1f')]);}return _0x2f0b0c['getItems'](_0x10c147);}})[_0x4093('0x27')](function(_0x44f92b){if(_0x44f92b){return _0x44f92b?{'count':_0x25c634,'rows':_0x44f92b}:null;}})[_0x4093('0x27')](respondWithResult(_0x570557,null))[_0x4093('0x4a')](handleError(_0x570557,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 0cf5014..b83f1a1 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 _0x0c32=['hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit'];(function(_0x5e60cf,_0x43d8e9){var _0x108087=function(_0x487028){while(--_0x487028){_0x5e60cf['push'](_0x5e60cf['shift']());}};_0x108087(++_0x43d8e9);}(_0x0c32,0x158));var _0x20c3=function(_0xf6d826,_0x2fde0f){_0xf6d826=_0xf6d826-0x0;var _0x13057a=_0x0c32[_0xf6d826];return _0x13057a;};'use strict';var EventEmitter=require(_0x20c3('0x0'));var Dashboard=require(_0x20c3('0x1'))['db'][_0x20c3('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x20c3('0x3')](0x0);var events={'afterCreate':_0x20c3('0x4'),'afterUpdate':'update','afterDestroy':_0x20c3('0x5')};function emitEvent(_0x58f349){return function(_0x16e633,_0x2da504,_0x1cffb3){DashboardEvents[_0x20c3('0x6')](_0x58f349+':'+_0x16e633['id'],_0x16e633);DashboardEvents[_0x20c3('0x6')](_0x58f349,_0x16e633);_0x1cffb3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x20c3('0x7')](e,emitEvent(event));}}module[_0x20c3('0x8')]=DashboardEvents; \ No newline at end of file +var _0x8e34=['update','remove','emit','hasOwnProperty','hook','exports','events','Dashboard','save'];(function(_0x45b888,_0x55a094){var _0xcbb171=function(_0x1a5b01){while(--_0x1a5b01){_0x45b888['push'](_0x45b888['shift']());}};_0xcbb171(++_0x55a094);}(_0x8e34,0x1bf));var _0x48e3=function(_0x20eca8,_0x5cf63f){_0x20eca8=_0x20eca8-0x0;var _0x1dd774=_0x8e34[_0x20eca8];return _0x1dd774;};'use strict';var EventEmitter=require(_0x48e3('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x48e3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x48e3('0x2'),'afterUpdate':_0x48e3('0x3'),'afterDestroy':_0x48e3('0x4')};function emitEvent(_0x530258){return function(_0xf01c75,_0x55fdc9,_0x4c7548){DashboardEvents[_0x48e3('0x5')](_0x530258+':'+_0xf01c75['id'],_0xf01c75);DashboardEvents[_0x48e3('0x5')](_0x530258,_0xf01c75);_0x4c7548(null);};}for(var e in events){if(events[_0x48e3('0x6')](e)){var event=events[e];Dashboard[_0x48e3('0x7')](e,emitEvent(event));}}module[_0x48e3('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 e2821c6..075e133 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 _0xdfcb=['rimraf','define','dashboards','lodash','../../config/logger','bluebird','request-promise'];(function(_0x11f1ea,_0x381b65){var _0x5af5f8=function(_0x4e3ded){while(--_0x4e3ded){_0x11f1ea['push'](_0x11f1ea['shift']());}};_0x5af5f8(++_0x381b65);}(_0xdfcb,0x10d));var _0xbdfc=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0xdfcb[_0x38af48];return _0x445384;};'use strict';var _=require(_0xbdfc('0x0'));var util=require('util');var logger=require(_0xbdfc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbdfc('0x2'));var rp=require(_0xbdfc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdfc('0x4'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module['exports']=function(_0x95d7fa,_0x1f6ff3){return _0x95d7fa[_0xbdfc('0x5')]('Dashboard',attributes,{'tableName':_0xbdfc('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cb8=['define','Dashboard','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8cb8,0x147));var _0x88cb=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x8cb8[_0x4d21ff];return _0x22b554;};'use strict';var _=require(_0x88cb('0x0'));var util=require(_0x88cb('0x1'));var logger=require(_0x88cb('0x2'))('api');var moment=require(_0x88cb('0x3'));var BPromise=require(_0x88cb('0x4'));var rp=require(_0x88cb('0x5'));var fs=require('fs');var path=require(_0x88cb('0x6'));var rimraf=require(_0x88cb('0x7'));var config=require(_0x88cb('0x8'));var attributes=require(_0x88cb('0x9'));module[_0x88cb('0xa')]=function(_0x5c8220,_0x3de1e3){return _0x5c8220[_0x88cb('0xb')](_0x88cb('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index a7e0fa8..7320db3 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 _0x6dbb=['Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then'];(function(_0x3df5ce,_0x4edc02){var _0x54f27f=function(_0x148962){while(--_0x148962){_0x3df5ce['push'](_0x3df5ce['shift']());}};_0x54f27f(++_0x4edc02);}(_0x6dbb,0x10f));var _0xb6db=function(_0x2a059a,_0xc5c6f1){_0x2a059a=_0x2a059a-0x0;var _0x16b9fa=_0x6dbb[_0x2a059a];return _0x16b9fa;};'use strict';var _=require(_0xb6db('0x0'));var util=require(_0xb6db('0x1'));var moment=require('moment');var BPromise=require(_0xb6db('0x2'));var rs=require(_0xb6db('0x3'));var fs=require('fs');var Redis=require(_0xb6db('0x4'));var db=require(_0xb6db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6db('0x6'))(_0xb6db('0x7'));var config=require(_0xb6db('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb6db('0x9')][_0xb6db('0xa')]({'port':0x232a});config[_0xb6db('0xb')]=_[_0xb6db('0xc')](config[_0xb6db('0xb')],{'host':_0xb6db('0xd'),'port':0x18eb});var socket=require(_0xb6db('0xe'))(new Redis(config['redis']));require(_0xb6db('0xf'))[_0xb6db('0x10')](socket);function respondWithRpcPromise(_0x87ad35,_0x484a62,_0x38932e){return new BPromise(function(_0x4194e0,_0x1776fc){return client[_0xb6db('0x11')](_0x87ad35,_0x38932e)[_0xb6db('0x12')](function(_0x346b22){logger['info'](_0xb6db('0x13'),_0x484a62,'request\x20sent');logger[_0xb6db('0x14')](_0xb6db('0x15'),_0x484a62,_0xb6db('0x16'),JSON['stringify'](_0x346b22));if(_0x346b22[_0xb6db('0x17')]){if(_0x346b22[_0xb6db('0x17')][_0xb6db('0x18')]===0x1f4){logger[_0xb6db('0x17')](_0xb6db('0x13'),_0x484a62,_0x346b22[_0xb6db('0x17')][_0xb6db('0x19')]);return _0x1776fc(_0x346b22[_0xb6db('0x17')][_0xb6db('0x19')]);}logger[_0xb6db('0x17')](_0xb6db('0x13'),_0x484a62,_0x346b22[_0xb6db('0x17')]['message']);return _0x4194e0(_0x346b22[_0xb6db('0x17')][_0xb6db('0x19')]);}else{logger[_0xb6db('0x1a')](_0xb6db('0x13'),_0x484a62,_0xb6db('0x16'));_0x4194e0(_0x346b22[_0xb6db('0x1b')][_0xb6db('0x19')]);}})[_0xb6db('0x1c')](function(_0x51a83c){logger['error'](_0xb6db('0x13'),_0x484a62,_0x51a83c);_0x1776fc(_0x51a83c);});});} \ No newline at end of file +var _0x3e79=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error'];(function(_0x5950fa,_0x4747a8){var _0x199a17=function(_0xa2af41){while(--_0xa2af41){_0x5950fa['push'](_0x5950fa['shift']());}};_0x199a17(++_0x4747a8);}(_0x3e79,0x148));var _0x93e7=function(_0x59f452,_0xd1b3fc){_0x59f452=_0x59f452-0x0;var _0x56b671=_0x3e79[_0x59f452];return _0x56b671;};'use strict';var _=require(_0x93e7('0x0'));var util=require(_0x93e7('0x1'));var moment=require(_0x93e7('0x2'));var BPromise=require(_0x93e7('0x3'));var rs=require(_0x93e7('0x4'));var fs=require('fs');var Redis=require(_0x93e7('0x5'));var db=require(_0x93e7('0x6'))['db'];var utils=require(_0x93e7('0x7'));var logger=require(_0x93e7('0x8'))(_0x93e7('0x9'));var config=require(_0x93e7('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x93e7('0xb')]['http']({'port':0x232a});config[_0x93e7('0xc')]=_['defaults'](config[_0x93e7('0xc')],{'host':_0x93e7('0xd'),'port':0x18eb});var socket=require(_0x93e7('0xe'))(new Redis(config[_0x93e7('0xc')]));require(_0x93e7('0xf'))['register'](socket);function respondWithRpcPromise(_0x342ce2,_0x1dddab,_0x499f63){return new BPromise(function(_0x3c009a,_0x3955b4){return client[_0x93e7('0x10')](_0x342ce2,_0x499f63)['then'](function(_0x5cc2fc){logger[_0x93e7('0x11')](_0x93e7('0x12'),_0x1dddab,_0x93e7('0x13'));logger[_0x93e7('0x14')](_0x93e7('0x15'),_0x1dddab,_0x93e7('0x13'),JSON['stringify'](_0x5cc2fc));if(_0x5cc2fc[_0x93e7('0x16')]){if(_0x5cc2fc[_0x93e7('0x16')][_0x93e7('0x17')]===0x1f4){logger[_0x93e7('0x16')](_0x93e7('0x12'),_0x1dddab,_0x5cc2fc[_0x93e7('0x16')]['message']);return _0x3955b4(_0x5cc2fc['error']['message']);}logger[_0x93e7('0x16')](_0x93e7('0x12'),_0x1dddab,_0x5cc2fc[_0x93e7('0x16')]['message']);return _0x3c009a(_0x5cc2fc[_0x93e7('0x16')][_0x93e7('0x18')]);}else{logger['info'](_0x93e7('0x12'),_0x1dddab,_0x93e7('0x13'));_0x3c009a(_0x5cc2fc[_0x93e7('0x19')][_0x93e7('0x18')]);}})[_0x93e7('0x1a')](function(_0x28f223){logger[_0x93e7('0x16')](_0x93e7('0x12'),_0x1dddab,_0x28f223);_0x3955b4(_0x28f223);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 0c27d87..608c041 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 _0xe79c=['dashboard:','./dashboard.events','save','update','emit','removeListener','length'];(function(_0x32eb4a,_0x427efa){var _0x527133=function(_0x36e8fa){while(--_0x36e8fa){_0x32eb4a['push'](_0x32eb4a['shift']());}};_0x527133(++_0x427efa);}(_0xe79c,0x1a5));var _0xce79=function(_0x2b03e4,_0xe14ca3){_0x2b03e4=_0x2b03e4-0x0;var _0x18f6aa=_0xe79c[_0x2b03e4];return _0x18f6aa;};'use strict';var DashboardEvents=require(_0xce79('0x0'));var events=[_0xce79('0x1'),'remove',_0xce79('0x2')];function createListener(_0x5ab112,_0x3cd26c){return function(_0x2304c6){_0x3cd26c[_0xce79('0x3')](_0x5ab112,_0x2304c6);};}function removeListener(_0x5ace3a,_0x41b3e4){return function(){DashboardEvents[_0xce79('0x4')](_0x5ace3a,_0x41b3e4);};}exports['register']=function(_0x1964a1){for(var _0x53f5aa=0x0,_0x338452=events[_0xce79('0x5')];_0x53f5aa<_0x338452;_0x53f5aa++){var _0x4ce670=events[_0x53f5aa];var _0x16e5b6=createListener(_0xce79('0x6')+_0x4ce670,_0x1964a1);DashboardEvents['on'](_0x4ce670,_0x16e5b6);}}; \ No newline at end of file +var _0x104e=['removeListener','register','length','dashboard:','save','remove','update'];(function(_0x46b818,_0x199c6f){var _0x4ea697=function(_0x42174f){while(--_0x42174f){_0x46b818['push'](_0x46b818['shift']());}};_0x4ea697(++_0x199c6f);}(_0x104e,0x1a1));var _0xe104=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x104e[_0x5311e8];return _0x582ad8;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xe104('0x0'),_0xe104('0x1'),_0xe104('0x2')];function createListener(_0x146b36,_0x338e65){return function(_0x2ec23a){_0x338e65['emit'](_0x146b36,_0x2ec23a);};}function removeListener(_0x588038,_0x5c1430){return function(){DashboardEvents[_0xe104('0x3')](_0x588038,_0x5c1430);};}exports[_0xe104('0x4')]=function(_0x59efeb){for(var _0x4b0942=0x0,_0x33e360=events[_0xe104('0x5')];_0x4b0942<_0x33e360;_0x4b0942++){var _0x3c7c85=events[_0x4b0942];var _0x538faf=createListener(_0xe104('0x6')+_0x3c7c85,_0x59efeb);DashboardEvents['on'](_0x3c7c85,_0x538faf);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ad3928d..92747d9 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 _0xee9e=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete','exports','multer'];(function(_0x3f853a,_0x5a1036){var _0x2e342b=function(_0x43d45a){while(--_0x43d45a){_0x3f853a['push'](_0x3f853a['shift']());}};_0x2e342b(++_0x5a1036);}(_0xee9e,0xb7));var _0xeee9=function(_0xeecc3c,_0x529b5b){_0xeecc3c=_0xeecc3c-0x0;var _0x280dbc=_0xee9e[_0xeecc3c];return _0x280dbc;};'use strict';var multer=require(_0xeee9('0x0'));var util=require(_0xeee9('0x1'));var path=require(_0xeee9('0x2'));var timeout=require(_0xeee9('0x3'));var express=require(_0xeee9('0x4'));var router=express[_0xeee9('0x5')]();var fs_extra=require(_0xeee9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xeee9('0x7'));var config=require(_0xeee9('0x8'));var controller=require('./dashboard.controller');router['get']('/',auth[_0xeee9('0x9')](),controller[_0xeee9('0xa')]);router[_0xeee9('0xb')](_0xeee9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xeee9('0xb')](_0xeee9('0xd'),auth['isAuthenticated'](),controller[_0xeee9('0xe')]);router['post']('/',auth[_0xeee9('0x9')](),controller['create']);router[_0xeee9('0xf')](_0xeee9('0x10'),auth[_0xeee9('0x9')](),controller[_0xeee9('0x11')]);router[_0xeee9('0xf')]('/:id/items',auth[_0xeee9('0x9')](),controller[_0xeee9('0x12')]);router[_0xeee9('0x13')]('/:id',auth[_0xeee9('0x9')](),controller[_0xeee9('0x14')]);router[_0xeee9('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xeee9('0x16')]=router; \ No newline at end of file +var _0xe5c5=['getItems','post','create','addItem','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items'];(function(_0x393449,_0x3a1340){var _0x22da41=function(_0x4d6763){while(--_0x4d6763){_0x393449['push'](_0x393449['shift']());}};_0x22da41(++_0x3a1340);}(_0xe5c5,0x8d));var _0x5e5c=function(_0x468e87,_0x2c63f1){_0x468e87=_0x468e87-0x0;var _0x173880=_0xe5c5[_0x468e87];return _0x173880;};'use strict';var multer=require(_0x5e5c('0x0'));var util=require(_0x5e5c('0x1'));var path=require(_0x5e5c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e5c('0x3')]();var fs_extra=require(_0x5e5c('0x4'));var auth=require(_0x5e5c('0x5'));var interaction=require(_0x5e5c('0x6'));var config=require('../../config/environment');var controller=require(_0x5e5c('0x7'));router[_0x5e5c('0x8')]('/',auth[_0x5e5c('0x9')](),controller['index']);router[_0x5e5c('0x8')](_0x5e5c('0xa'),auth[_0x5e5c('0x9')](),controller[_0x5e5c('0xb')]);router[_0x5e5c('0x8')](_0x5e5c('0xc'),auth[_0x5e5c('0x9')](),controller[_0x5e5c('0xd')]);router[_0x5e5c('0xe')]('/',auth[_0x5e5c('0x9')](),controller[_0x5e5c('0xf')]);router['post']('/:id/clone',auth[_0x5e5c('0x9')](),controller['clone']);router[_0x5e5c('0xe')](_0x5e5c('0xc'),auth[_0x5e5c('0x9')](),controller[_0x5e5c('0x10')]);router[_0x5e5c('0x11')](_0x5e5c('0xa'),auth[_0x5e5c('0x9')](),controller[_0x5e5c('0x12')]);router[_0x5e5c('0x13')]('/:id',auth[_0x5e5c('0x9')](),controller[_0x5e5c('0x14')]);module[_0x5e5c('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b806385..3c513ce 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xabce[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xeabc('0x0'));var squel=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));module[_0xeabc('0x3')]={'title':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xeabc('0x5')),'get':function(){try{return JSON[_0xeabc('0x6')](this[_0xeabc('0x7')]('attrs'));}catch(_0x54e4a8){return[];}},'set':function(_0x1b07a8){try{this['setDataValue'](_0xeabc('0x8'),JSON['stringify'](_0x1b07a8));}catch(_0x3bdc29){this[_0xeabc('0x9')](_0xeabc('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xeabc('0xa')]},'col':{'type':Sequelize[_0xeabc('0xa')]},'background':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xeabc('0x4')]},'titleFontSize':{'type':Sequelize[_0xeabc('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x396eaf,_0xb39e1d){var _0x448641=function(_0x236eb8){while(--_0x236eb8){_0x396eaf['push'](_0x396eaf['shift']());}};_0x448641(++_0xb39e1d);}(_0x5fab,0x177));var _0xb5fa=function(_0x1f4f14,_0x570d4b){_0x1f4f14=_0x1f4f14-0x0;var _0x3135b1=_0x5fab[_0x1f4f14];return _0x3135b1;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 896898e..5b11f2d 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 _0x07b5=['widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh'];(function(_0x1a8e9d,_0x34808a){var _0x5a9810=function(_0x5d6717){while(--_0x5d6717){_0x1a8e9d['push'](_0x1a8e9d['shift']());}};_0x5a9810(++_0x34808a);}(_0x07b5,0x10f));var _0x507b=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0x07b5[_0x2da357];return _0x138fdd;};'use strict';var emlformat=require(_0x507b('0x0'));var rimraf=require(_0x507b('0x1'));var zipdir=require(_0x507b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x507b('0x3'));var BPromise=require(_0x507b('0x4'));var Mustache=require(_0x507b('0x5'));var util=require(_0x507b('0x6'));var path=require(_0x507b('0x7'));var sox=require('sox');var csv=require(_0x507b('0x8'));var ejs=require(_0x507b('0x9'));var fs=require('fs');var fs_extra=require(_0x507b('0xa'));var _=require(_0x507b('0xb'));var squel=require('squel');var crypto=require(_0x507b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x507b('0x8'));var querystring=require(_0x507b('0xd'));var Papa=require(_0x507b('0xe'));var Redis=require(_0x507b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x507b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x507b('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x507b('0x12'));var licenseUtil=require(_0x507b('0x13'));var db=require(_0x507b('0x14'))['db'];config['redis']=_[_0x507b('0x15')](config[_0x507b('0x16')],{'host':_0x507b('0x17'),'port':0x18eb});var socket=require(_0x507b('0x18'))(new Redis(config['redis']));require(_0x507b('0x19'))[_0x507b('0x1a')](socket);function respondWithStatusCode(_0x58a1c9,_0x46a294){_0x46a294=_0x46a294||0xcc;return function(_0x52be32){if(_0x52be32){return _0x58a1c9[_0x507b('0x1b')](_0x46a294);}return _0x58a1c9[_0x507b('0x1c')](_0x46a294)[_0x507b('0x1d')]();};}function respondWithResult(_0x24329e,_0x5d39a3){_0x5d39a3=_0x5d39a3||0xc8;return function(_0x3d9e9b){if(_0x3d9e9b){return _0x24329e[_0x507b('0x1c')](_0x5d39a3)[_0x507b('0x1e')](_0x3d9e9b);}};}function respondWithFilteredResult(_0x21ac54,_0x59ca99){return function(_0xa82240){if(_0xa82240){var _0x150ab9=typeof _0x59ca99[_0x507b('0x1f')]==='undefined'&&typeof _0x59ca99[_0x507b('0x20')]===_0x507b('0x21');var _0x1b1fe1=_0xa82240[_0x507b('0x22')];var _0x4efee7=_0x150ab9?0x0:_0x59ca99[_0x507b('0x1f')];var _0xd1da35=_0x150ab9?_0xa82240['count']:_0x59ca99[_0x507b('0x1f')]+_0x59ca99['limit'];var _0x47a502;if(_0xd1da35>=_0x1b1fe1){_0xd1da35=_0x1b1fe1;_0x47a502=0xc8;}else{_0x47a502=0xce;}_0x21ac54[_0x507b('0x1c')](_0x47a502);return _0x21ac54[_0x507b('0x23')]('Content-Range',_0x4efee7+'-'+_0xd1da35+'/'+_0x1b1fe1)[_0x507b('0x1e')](_0xa82240);}return null;};}function patchUpdates(_0x2c36c4){return function(_0x48ba23){try{jsonpatch[_0x507b('0x24')](_0x48ba23,_0x2c36c4,!![]);}catch(_0x205a37){return BPromise[_0x507b('0x25')](_0x205a37);}return _0x48ba23[_0x507b('0x26')]();};}function saveUpdates(_0x2d6a4e,_0x13e9b2){return function(_0x41bb76){if(_0x41bb76){return _0x41bb76[_0x507b('0x27')](_0x2d6a4e)[_0x507b('0x28')](function(_0x7c634f){return _0x7c634f;});}return null;};}function removeEntity(_0x588fbd,_0x58e180){return function(_0x21809c){if(_0x21809c){return _0x21809c[_0x507b('0x29')]()[_0x507b('0x28')](function(){_0x588fbd[_0x507b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e6cda,_0x485443){return function(_0x1cd9d9){if(!_0x1cd9d9){_0x4e6cda[_0x507b('0x1b')](0x194);}return _0x1cd9d9;};}function handleError(_0x20746,_0x221255){_0x221255=_0x221255||0x1f4;return function(_0x3717a4){logger[_0x507b('0x2a')](_0x3717a4[_0x507b('0x2b')]);if(_0x3717a4[_0x507b('0x2c')]){delete _0x3717a4[_0x507b('0x2c')];}_0x20746['status'](_0x221255)[_0x507b('0x2d')](_0x3717a4);};}exports['show']=function(_0x29228a,_0x4d0ad2){var _0x3fd01d={'raw':![],'where':{'id':_0x29228a[_0x507b('0x2e')]['id']}},_0x54f1ff={};_0x54f1ff[_0x507b('0x2f')]=_[_0x507b('0x30')](db[_0x507b('0x31')][_0x507b('0x32')]);_0x54f1ff[_0x507b('0x33')]=_['keys'](_0x29228a['query']);_0x54f1ff['filters']=_[_0x507b('0x34')](_0x54f1ff[_0x507b('0x2f')],_0x54f1ff[_0x507b('0x33')]);_0x3fd01d[_0x507b('0x35')]=_[_0x507b('0x34')](_0x54f1ff['model'],qs[_0x507b('0x36')](_0x29228a[_0x507b('0x33')][_0x507b('0x36')]));_0x3fd01d[_0x507b('0x35')]=_0x3fd01d[_0x507b('0x35')]['length']?_0x3fd01d[_0x507b('0x35')]:_0x54f1ff[_0x507b('0x2f')];if(_0x29228a[_0x507b('0x33')][_0x507b('0x37')]){_0x3fd01d[_0x507b('0x38')]=[{'all':!![]}];}_0x3fd01d=_[_0x507b('0x39')]({},_0x3fd01d,_0x29228a[_0x507b('0x3a')]);return db[_0x507b('0x31')][_0x507b('0x3b')](_0x3fd01d)[_0x507b('0x28')](handleEntityNotFound(_0x4d0ad2,null))[_0x507b('0x28')](respondWithResult(_0x4d0ad2,null))[_0x507b('0x3c')](handleError(_0x4d0ad2,null));};exports[_0x507b('0x29')]=function(_0x53496a,_0x361816){return db[_0x507b('0x31')]['find']({'where':{'id':_0x53496a[_0x507b('0x2e')]['id']}})[_0x507b('0x28')](handleEntityNotFound(_0x361816,null))[_0x507b('0x28')](removeEntity(_0x361816,null))[_0x507b('0x3c')](handleError(_0x361816,null));};function widgetAttributes(_0x52ca51){try{switch(_0x52ca51[_0x507b('0x3d')]){case _0x507b('0x3e'):return[{'name':_0x507b('0x3f'),'value':_0x52ca51[_0x507b('0x3f')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51['attrs'][0x0]?_0x52ca51['attrs'][0x0][_0x507b('0x41')]:undefined)||_0x507b('0x42')}];case _0x507b('0x43'):return[{'name':_0x507b('0x44'),'value':_0x52ca51[_0x507b('0x44')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51[_0x507b('0x40')][0x0][_0x507b('0x41')]:undefined)||''}];case _0x507b('0x45'):return[{'name':_0x507b('0x46'),'value':_0x52ca51['attrHourFormat']||(_0x52ca51['attrs']&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51[_0x507b('0x40')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x507b('0x47'),'value':_0x52ca51[_0x507b('0x47')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51['attrs'][0x1]?_0x52ca51[_0x507b('0x40')][0x1][_0x507b('0x41')]:undefined)||_0x507b('0x48')},{'name':_0x507b('0x49'),'value':_0x52ca51['attrFontSize']||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x2]?_0x52ca51['attrs'][0x2][_0x507b('0x41')]:undefined)||0xc}];case _0x507b('0x4a'):return[{'name':_0x507b('0x4b'),'value':_0x52ca51[_0x507b('0x4b')]||(_0x52ca51['attrs']&&_0x52ca51['attrs'][0x0]?_0x52ca51[_0x507b('0x40')][0x0][_0x507b('0x41')]:undefined)||_0x507b('0x4c')},{'name':_0x507b('0x4d'),'value':_0x52ca51[_0x507b('0x4d')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x1]?_0x52ca51[_0x507b('0x40')][0x1]['value']:undefined)||[]},{'name':_0x507b('0x49'),'value':_0x52ca51[_0x507b('0x49')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x2]?_0x52ca51[_0x507b('0x40')][0x2]['value']:undefined)||0x14}];case _0x507b('0x4e'):case'pie-chart':return[{'name':'attrSerie1','value':_0x52ca51['attrSerie1']||(_0x52ca51['attrs']&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x52ca51[_0x507b('0x4f')]||(_0x52ca51['attrs']&&_0x52ca51[_0x507b('0x40')][0x1]?_0x52ca51[_0x507b('0x40')][0x1][_0x507b('0x41')]:undefined)||null},{'name':'attrSerie3','value':_0x52ca51[_0x507b('0x50')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51['attrs'][0x2]?_0x52ca51[_0x507b('0x40')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x52ca51[_0x507b('0x4d')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x3]?_0x52ca51[_0x507b('0x40')][0x3][_0x507b('0x41')]:undefined)||[]}];case _0x507b('0x51'):return[{'name':_0x507b('0x52'),'type':_0x52ca51[_0x507b('0x53')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51[_0x507b('0x40')][0x0][_0x507b('0x3d')]:undefined)||null,'value':_0x52ca51[_0x507b('0x52')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51[_0x507b('0x40')][0x0][_0x507b('0x41')]:undefined)||null},{'name':_0x507b('0x54'),'value':_0x52ca51['attrRefresh']||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x1]?_0x52ca51[_0x507b('0x40')][0x1][_0x507b('0x41')]:undefined)||0x0}];default:return[];}}catch(_0xa1808f){logger[_0x507b('0x2a')](_0x507b('0x55'),JSON[_0x507b('0x56')](_0xa1808f));return[];}}exports[_0x507b('0x57')]=function(_0x359a1b,_0x511e28){if(_0x359a1b[_0x507b('0x58')]){_0x359a1b['body'][_0x507b('0x40')]=widgetAttributes(_0x359a1b[_0x507b('0x58')]);}return db[_0x507b('0x31')][_0x507b('0x57')](_0x359a1b[_0x507b('0x58')],{})[_0x507b('0x28')](respondWithResult(_0x511e28,0xc9))[_0x507b('0x3c')](handleError(_0x511e28,null));};exports[_0x507b('0x27')]=function(_0x385096,_0x41838b){if(_0x385096['body']['id']){delete _0x385096['body']['id'];}_0x385096[_0x507b('0x58')][_0x507b('0x40')]=widgetAttributes(_0x385096[_0x507b('0x58')]);return db[_0x507b('0x31')][_0x507b('0x3b')]({'where':{'id':_0x385096[_0x507b('0x2e')]['id']}})['then'](handleEntityNotFound(_0x41838b,null))[_0x507b('0x28')](saveUpdates(_0x385096[_0x507b('0x58')],null))[_0x507b('0x28')](respondWithResult(_0x41838b,null))[_0x507b('0x3c')](handleError(_0x41838b,null));}; \ No newline at end of file +var _0xf5b2=['attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','type','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','destroy','then','end','error','stack','name','params','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','DashboardItem','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss'];(function(_0x313e25,_0x32d867){var _0x335afc=function(_0x1da46c){while(--_0x1da46c){_0x313e25['push'](_0x313e25['shift']());}};_0x335afc(++_0x32d867);}(_0xf5b2,0x11d));var _0x2f5b=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0xf5b2[_0x56b138];return _0x3df878;};'use strict';var emlformat=require(_0x2f5b('0x0'));var rimraf=require(_0x2f5b('0x1'));var zipdir=require(_0x2f5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2f5b('0x3'));var Mustache=require(_0x2f5b('0x4'));var util=require(_0x2f5b('0x5'));var path=require(_0x2f5b('0x6'));var sox=require(_0x2f5b('0x7'));var csv=require(_0x2f5b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f5b('0x9'));var _=require('lodash');var squel=require(_0x2f5b('0xa'));var crypto=require(_0x2f5b('0xb'));var jsforce=require(_0x2f5b('0xc'));var deskjs=require(_0x2f5b('0xd'));var toCsv=require(_0x2f5b('0x8'));var querystring=require(_0x2f5b('0xe'));var Papa=require(_0x2f5b('0xf'));var Redis=require(_0x2f5b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2f5b('0x11'));var as=require(_0x2f5b('0x12'));var hardwareService=require(_0x2f5b('0x13'));var logger=require(_0x2f5b('0x14'))(_0x2f5b('0x15'));var utils=require(_0x2f5b('0x16'));var config=require(_0x2f5b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2f5b('0x18')]=_[_0x2f5b('0x19')](config[_0x2f5b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f5b('0x1a'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x2f5b('0x1b')](socket);function respondWithStatusCode(_0x3d11f0,_0x23bb18){_0x23bb18=_0x23bb18||0xcc;return function(_0x539477){if(_0x539477){return _0x3d11f0[_0x2f5b('0x1c')](_0x23bb18);}return _0x3d11f0[_0x2f5b('0x1d')](_0x23bb18)['end']();};}function respondWithResult(_0x13060b,_0x283da8){_0x283da8=_0x283da8||0xc8;return function(_0x227846){if(_0x227846){return _0x13060b[_0x2f5b('0x1d')](_0x283da8)[_0x2f5b('0x1e')](_0x227846);}};}function respondWithFilteredResult(_0x161c75,_0x1cecec){return function(_0x4e07c8){if(_0x4e07c8){var _0x1f43d4=typeof _0x1cecec[_0x2f5b('0x1f')]===_0x2f5b('0x20')&&typeof _0x1cecec['limit']===_0x2f5b('0x20');var _0x2a9efe=_0x4e07c8[_0x2f5b('0x21')];var _0x1153fd=_0x1f43d4?0x0:_0x1cecec[_0x2f5b('0x1f')];var _0x2a0186=_0x1f43d4?_0x4e07c8['count']:_0x1cecec[_0x2f5b('0x1f')]+_0x1cecec[_0x2f5b('0x22')];var _0x25ff3c;if(_0x2a0186>=_0x2a9efe){_0x2a0186=_0x2a9efe;_0x25ff3c=0xc8;}else{_0x25ff3c=0xce;}_0x161c75['status'](_0x25ff3c);return _0x161c75['set']('Content-Range',_0x1153fd+'-'+_0x2a0186+'/'+_0x2a9efe)[_0x2f5b('0x1e')](_0x4e07c8);}return null;};}function patchUpdates(_0x594ffd){return function(_0x2f8730){try{jsonpatch[_0x2f5b('0x23')](_0x2f8730,_0x594ffd,!![]);}catch(_0x395527){return BPromise[_0x2f5b('0x24')](_0x395527);}return _0x2f8730[_0x2f5b('0x25')]();};}function saveUpdates(_0x4d5055,_0x403e39){return function(_0x3d8ddb){if(_0x3d8ddb){return _0x3d8ddb[_0x2f5b('0x26')](_0x4d5055)['then'](function(_0x123e74){return _0x123e74;});}return null;};}function removeEntity(_0xd8906a,_0x544f94){return function(_0x2039f7){if(_0x2039f7){return _0x2039f7[_0x2f5b('0x27')]()[_0x2f5b('0x28')](function(){_0xd8906a[_0x2f5b('0x1d')](0xcc)[_0x2f5b('0x29')]();});}};}function handleEntityNotFound(_0x2fded8,_0xf07a63){return function(_0x358fb5){if(!_0x358fb5){_0x2fded8['sendStatus'](0x194);}return _0x358fb5;};}function handleError(_0x422d90,_0x2da69c){_0x2da69c=_0x2da69c||0x1f4;return function(_0x42cb4c){logger[_0x2f5b('0x2a')](_0x42cb4c[_0x2f5b('0x2b')]);if(_0x42cb4c[_0x2f5b('0x2c')]){delete _0x42cb4c[_0x2f5b('0x2c')];}_0x422d90[_0x2f5b('0x1d')](_0x2da69c)['send'](_0x42cb4c);};}exports['show']=function(_0x18303f,_0x1269db){var _0x177c1e={'raw':![],'where':{'id':_0x18303f[_0x2f5b('0x2d')]['id']}},_0x393dee={};_0x393dee['model']=_[_0x2f5b('0x2e')](db['DashboardItem'][_0x2f5b('0x2f')]);_0x393dee[_0x2f5b('0x30')]=_[_0x2f5b('0x2e')](_0x18303f[_0x2f5b('0x30')]);_0x393dee[_0x2f5b('0x31')]=_['intersection'](_0x393dee[_0x2f5b('0x32')],_0x393dee[_0x2f5b('0x30')]);_0x177c1e[_0x2f5b('0x33')]=_[_0x2f5b('0x34')](_0x393dee[_0x2f5b('0x32')],qs[_0x2f5b('0x35')](_0x18303f[_0x2f5b('0x30')][_0x2f5b('0x35')]));_0x177c1e[_0x2f5b('0x33')]=_0x177c1e[_0x2f5b('0x33')][_0x2f5b('0x36')]?_0x177c1e['attributes']:_0x393dee['model'];if(_0x18303f[_0x2f5b('0x30')][_0x2f5b('0x37')]){_0x177c1e[_0x2f5b('0x38')]=[{'all':!![]}];}_0x177c1e=_[_0x2f5b('0x39')]({},_0x177c1e,_0x18303f[_0x2f5b('0x3a')]);return db['DashboardItem'][_0x2f5b('0x3b')](_0x177c1e)[_0x2f5b('0x28')](handleEntityNotFound(_0x1269db,null))[_0x2f5b('0x28')](respondWithResult(_0x1269db,null))[_0x2f5b('0x3c')](handleError(_0x1269db,null));};exports[_0x2f5b('0x27')]=function(_0x2d7164,_0x340586){return db[_0x2f5b('0x3d')][_0x2f5b('0x3b')]({'where':{'id':_0x2d7164[_0x2f5b('0x2d')]['id']}})[_0x2f5b('0x28')](handleEntityNotFound(_0x340586,null))['then'](removeEntity(_0x340586,null))[_0x2f5b('0x3c')](handleError(_0x340586,null));};function widgetAttributes(_0x1d916b){try{switch(_0x1d916b['type']){case _0x2f5b('0x3e'):return[{'name':_0x2f5b('0x3f'),'value':_0x1d916b[_0x2f5b('0x3f')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b['attrs'][0x0]?_0x1d916b[_0x2f5b('0x40')][0x0][_0x2f5b('0x41')]:undefined)||'https://'}];case _0x2f5b('0x42'):return[{'name':_0x2f5b('0x43'),'value':_0x1d916b[_0x2f5b('0x43')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x0]?_0x1d916b[_0x2f5b('0x40')][0x0]['value']:undefined)||''}];case _0x2f5b('0x44'):return[{'name':_0x2f5b('0x45'),'value':_0x1d916b['attrHourFormat']||(_0x1d916b['attrs']&&_0x1d916b['attrs'][0x0]?_0x1d916b[_0x2f5b('0x40')][0x0][_0x2f5b('0x41')]:undefined)||_0x2f5b('0x46')},{'name':_0x2f5b('0x47'),'value':_0x1d916b[_0x2f5b('0x47')]||(_0x1d916b['attrs']&&_0x1d916b[_0x2f5b('0x40')][0x1]?_0x1d916b['attrs'][0x1][_0x2f5b('0x41')]:undefined)||_0x2f5b('0x48')},{'name':'attrFontSize','value':_0x1d916b[_0x2f5b('0x49')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x2]?_0x1d916b[_0x2f5b('0x40')][0x2][_0x2f5b('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0x2f5b('0x4a'),'value':_0x1d916b[_0x2f5b('0x4a')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x0]?_0x1d916b[_0x2f5b('0x40')][0x0]['value']:undefined)||_0x2f5b('0x4b')},{'name':'attrVoiceQueues','value':_0x1d916b[_0x2f5b('0x4c')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x1]?_0x1d916b['attrs'][0x1]['value']:undefined)||[]},{'name':_0x2f5b('0x49'),'value':_0x1d916b[_0x2f5b('0x49')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x2]?_0x1d916b[_0x2f5b('0x40')][0x2][_0x2f5b('0x41')]:undefined)||0x14}];case'multibar-chart':case _0x2f5b('0x4d'):return[{'name':'attrSerie1','value':_0x1d916b[_0x2f5b('0x4e')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x0]?_0x1d916b['attrs'][0x0][_0x2f5b('0x41')]:undefined)||'total'},{'name':_0x2f5b('0x4f'),'value':_0x1d916b[_0x2f5b('0x4f')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x1]?_0x1d916b[_0x2f5b('0x40')][0x1][_0x2f5b('0x41')]:undefined)||null},{'name':_0x2f5b('0x50'),'value':_0x1d916b[_0x2f5b('0x50')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x2]?_0x1d916b[_0x2f5b('0x40')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x1d916b[_0x2f5b('0x4c')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b['attrs'][0x3]?_0x1d916b[_0x2f5b('0x40')][0x3][_0x2f5b('0x41')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x1d916b[_0x2f5b('0x51')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x0]?_0x1d916b[_0x2f5b('0x40')][0x0][_0x2f5b('0x52')]:undefined)||null,'value':_0x1d916b[_0x2f5b('0x53')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x0]?_0x1d916b[_0x2f5b('0x40')][0x0][_0x2f5b('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x1d916b[_0x2f5b('0x54')]||(_0x1d916b[_0x2f5b('0x40')]&&_0x1d916b[_0x2f5b('0x40')][0x1]?_0x1d916b[_0x2f5b('0x40')][0x1][_0x2f5b('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x4e4a72){logger['error'](_0x2f5b('0x55'),JSON[_0x2f5b('0x56')](_0x4e4a72));return[];}}exports[_0x2f5b('0x57')]=function(_0xb0e39e,_0x141552){if(_0xb0e39e[_0x2f5b('0x58')]){_0xb0e39e['body']['attrs']=widgetAttributes(_0xb0e39e['body']);}return db[_0x2f5b('0x3d')][_0x2f5b('0x57')](_0xb0e39e[_0x2f5b('0x58')],{})[_0x2f5b('0x28')](respondWithResult(_0x141552,0xc9))[_0x2f5b('0x3c')](handleError(_0x141552,null));};exports['update']=function(_0x62c704,_0x429285){if(_0x62c704['body']['id']){delete _0x62c704[_0x2f5b('0x58')]['id'];}_0x62c704['body']['attrs']=widgetAttributes(_0x62c704[_0x2f5b('0x58')]);return db[_0x2f5b('0x3d')]['find']({'where':{'id':_0x62c704[_0x2f5b('0x2d')]['id']}})['then'](handleEntityNotFound(_0x429285,null))[_0x2f5b('0x28')](saveUpdates(_0x62c704[_0x2f5b('0x58')],null))[_0x2f5b('0x28')](respondWithResult(_0x429285,null))[_0x2f5b('0x3c')](handleError(_0x429285,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 791ac39..0f5c866 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 _0x706c=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x14e09f,_0xca27e7){var _0x54a4d2=function(_0x55bdab){while(--_0x55bdab){_0x14e09f['push'](_0x14e09f['shift']());}};_0x54a4d2(++_0xca27e7);}(_0x706c,0xd1));var _0xc706=function(_0x5ca0b3,_0x33f5ef){_0x5ca0b3=_0x5ca0b3-0x0;var _0x6ba806=_0x706c[_0x5ca0b3];return _0x6ba806;};'use strict';var EventEmitter=require(_0xc706('0x0'));var DashboardItem=require(_0xc706('0x1'))['db'][_0xc706('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc706('0x3')](0x0);var events={'afterCreate':_0xc706('0x4'),'afterUpdate':_0xc706('0x5'),'afterDestroy':_0xc706('0x6')};function emitEvent(_0x2c147b){return function(_0x376f59,_0x5c827a,_0x46605e){DashboardItemEvents[_0xc706('0x7')](_0x2c147b+':'+_0x376f59['id'],_0x376f59);DashboardItemEvents[_0xc706('0x7')](_0x2c147b,_0x376f59);_0x46605e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xc706('0x8')](e,emitEvent(event));}}module[_0xc706('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x3caf=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','remove'];(function(_0x40c7cd,_0x8828d){var _0x2254b4=function(_0x54a76d){while(--_0x54a76d){_0x40c7cd['push'](_0x40c7cd['shift']());}};_0x2254b4(++_0x8828d);}(_0x3caf,0x108));var _0xf3ca=function(_0x48ead4,_0x509b4a){_0x48ead4=_0x48ead4-0x0;var _0x3410b3=_0x3caf[_0x48ead4];return _0x3410b3;};'use strict';var EventEmitter=require(_0xf3ca('0x0'));var DashboardItem=require(_0xf3ca('0x1'))['db'][_0xf3ca('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf3ca('0x3')](0x0);var events={'afterCreate':_0xf3ca('0x4'),'afterUpdate':'update','afterDestroy':_0xf3ca('0x5')};function emitEvent(_0x14e50d){return function(_0x27b275,_0xf6fc4a,_0x3e1697){DashboardItemEvents['emit'](_0x14e50d+':'+_0x27b275['id'],_0x27b275);DashboardItemEvents[_0xf3ca('0x6')](_0x14e50d,_0x27b275);_0x3e1697(null);};}for(var e in events){if(events[_0xf3ca('0x7')](e)){var event=events[e];DashboardItem[_0xf3ca('0x8')](e,emitEvent(event));}}module[_0xf3ca('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 89493dd..072ea1c 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 _0xd8ae=['bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0xd8ae,0x183));var _0xed8a=function(_0x514745,_0x4a2031){_0x514745=_0x514745-0x0;var _0x58a4d2=_0xd8ae[_0x514745];return _0x58a4d2;};'use strict';var _=require(_0xed8a('0x0'));var util=require(_0xed8a('0x1'));var logger=require(_0xed8a('0x2'))(_0xed8a('0x3'));var moment=require(_0xed8a('0x4'));var BPromise=require(_0xed8a('0x5'));var rp=require(_0xed8a('0x6'));var fs=require('fs');var path=require(_0xed8a('0x7'));var rimraf=require('rimraf');var config=require(_0xed8a('0x8'));var attributes=require(_0xed8a('0x9'));module[_0xed8a('0xa')]=function(_0x19ca95,_0x4b779e){return _0x19ca95[_0xed8a('0xb')](_0xed8a('0xc'),attributes,{'tableName':_0xed8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0adb=['bluebird','request-promise','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','util','../../config/logger','api','moment'];(function(_0xa3eab0,_0x390805){var _0x352b49=function(_0x3d9fc8){while(--_0x3d9fc8){_0xa3eab0['push'](_0xa3eab0['shift']());}};_0x352b49(++_0x390805);}(_0x0adb,0x1c4));var _0xb0ad=function(_0x5fa6d,_0x28b278){_0x5fa6d=_0x5fa6d-0x0;var _0xfe07be=_0x0adb[_0x5fa6d];return _0xfe07be;};'use strict';var _=require('lodash');var util=require(_0xb0ad('0x0'));var logger=require(_0xb0ad('0x1'))(_0xb0ad('0x2'));var moment=require(_0xb0ad('0x3'));var BPromise=require(_0xb0ad('0x4'));var rp=require(_0xb0ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0ad('0x6'));var attributes=require(_0xb0ad('0x7'));module[_0xb0ad('0x8')]=function(_0x228718,_0x44ddc7){return _0x228718[_0xb0ad('0x9')](_0xb0ad('0xa'),attributes,{'tableName':_0xb0ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 298bb8a..1a1aee1 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 _0x7bb7=['redis','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults'];(function(_0x1b8fc6,_0x5857b4){var _0x11cd9f=function(_0x10f5ad){while(--_0x10f5ad){_0x1b8fc6['push'](_0x1b8fc6['shift']());}};_0x11cd9f(++_0x5857b4);}(_0x7bb7,0x1ea));var _0x77bb=function(_0x4f2130,_0x28fd7e){_0x4f2130=_0x4f2130-0x0;var _0x3d45dd=_0x7bb7[_0x4f2130];return _0x3d45dd;};'use strict';var _=require('lodash');var util=require(_0x77bb('0x0'));var moment=require(_0x77bb('0x1'));var BPromise=require(_0x77bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77bb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x77bb('0x4'))(_0x77bb('0x5'));var config=require('../../config/environment');var jayson=require(_0x77bb('0x6'));var client=jayson[_0x77bb('0x7')][_0x77bb('0x8')]({'port':0x232a});config['redis']=_[_0x77bb('0x9')](config[_0x77bb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x77bb('0xb'))(new Redis(config[_0x77bb('0xa')]));require(_0x77bb('0xc'))[_0x77bb('0xd')](socket);function respondWithRpcPromise(_0x18c92e,_0x28d6a8,_0x2ec5f1){return new BPromise(function(_0x1538bd,_0x26e5d8){return client['request'](_0x18c92e,_0x2ec5f1)[_0x77bb('0xe')](function(_0x438746){logger[_0x77bb('0xf')](_0x77bb('0x10'),_0x28d6a8,'request\x20sent');logger[_0x77bb('0x11')](_0x77bb('0x12'),_0x28d6a8,_0x77bb('0x13'),JSON[_0x77bb('0x14')](_0x438746));if(_0x438746[_0x77bb('0x15')]){if(_0x438746[_0x77bb('0x15')][_0x77bb('0x16')]===0x1f4){logger[_0x77bb('0x15')]('DashboardItem,\x20%s,\x20%s',_0x28d6a8,_0x438746[_0x77bb('0x15')][_0x77bb('0x17')]);return _0x26e5d8(_0x438746[_0x77bb('0x15')]['message']);}logger['error'](_0x77bb('0x10'),_0x28d6a8,_0x438746[_0x77bb('0x15')][_0x77bb('0x17')]);return _0x1538bd(_0x438746[_0x77bb('0x15')][_0x77bb('0x17')]);}else{logger[_0x77bb('0xf')]('DashboardItem,\x20%s,\x20%s',_0x28d6a8,_0x77bb('0x13'));_0x1538bd(_0x438746['result'][_0x77bb('0x17')]);}})[_0x77bb('0x18')](function(_0x490d53){logger[_0x77bb('0x15')]('DashboardItem,\x20%s,\x20%s',_0x28d6a8,_0x490d53);_0x26e5d8(_0x490d53);});});} \ No newline at end of file +var _0x2425=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./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'];(function(_0x59c50f,_0x36c19c){var _0x1afb3d=function(_0x385653){while(--_0x385653){_0x59c50f['push'](_0x59c50f['shift']());}};_0x1afb3d(++_0x36c19c);}(_0x2425,0x1cc));var _0x5242=function(_0x352c4c,_0x246255){_0x352c4c=_0x352c4c-0x0;var _0x2fc5b9=_0x2425[_0x352c4c];return _0x2fc5b9;};'use strict';var _=require(_0x5242('0x0'));var util=require(_0x5242('0x1'));var moment=require('moment');var BPromise=require(_0x5242('0x2'));var rs=require(_0x5242('0x3'));var fs=require('fs');var Redis=require(_0x5242('0x4'));var db=require(_0x5242('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5242('0x6'))(_0x5242('0x7'));var config=require(_0x5242('0x8'));var jayson=require(_0x5242('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x5242('0xa')]=_[_0x5242('0xb')](config[_0x5242('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5242('0xa')]));require(_0x5242('0xc'))[_0x5242('0xd')](socket);function respondWithRpcPromise(_0x35e2f8,_0x368c45,_0x50e120){return new BPromise(function(_0x48464c,_0x482fc8){return client[_0x5242('0xe')](_0x35e2f8,_0x50e120)[_0x5242('0xf')](function(_0x42e8d1){logger[_0x5242('0x10')](_0x5242('0x11'),_0x368c45,_0x5242('0x12'));logger[_0x5242('0x13')](_0x5242('0x14'),_0x368c45,_0x5242('0x12'),JSON[_0x5242('0x15')](_0x42e8d1));if(_0x42e8d1[_0x5242('0x16')]){if(_0x42e8d1[_0x5242('0x16')][_0x5242('0x17')]===0x1f4){logger[_0x5242('0x16')]('DashboardItem,\x20%s,\x20%s',_0x368c45,_0x42e8d1[_0x5242('0x16')][_0x5242('0x18')]);return _0x482fc8(_0x42e8d1['error'][_0x5242('0x18')]);}logger[_0x5242('0x16')](_0x5242('0x11'),_0x368c45,_0x42e8d1['error'][_0x5242('0x18')]);return _0x48464c(_0x42e8d1[_0x5242('0x16')]['message']);}else{logger[_0x5242('0x10')](_0x5242('0x11'),_0x368c45,_0x5242('0x12'));_0x48464c(_0x42e8d1[_0x5242('0x19')][_0x5242('0x18')]);}})[_0x5242('0x1a')](function(_0x450dc3){logger[_0x5242('0x16')](_0x5242('0x11'),_0x368c45,_0x450dc3);_0x482fc8(_0x450dc3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5e82086..f3f00d4 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 _0x1377=['remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x20259c,_0xe43fb2){var _0x4d988e=function(_0x2097b9){while(--_0x2097b9){_0x20259c['push'](_0x20259c['shift']());}};_0x4d988e(++_0xe43fb2);}(_0x1377,0xfe));var _0x7137=function(_0x4b4ca5,_0x46fc17){_0x4b4ca5=_0x4b4ca5-0x0;var _0x406893=_0x1377[_0x4b4ca5];return _0x406893;};'use strict';var DashboardItemEvents=require(_0x7137('0x0'));var events=[_0x7137('0x1'),_0x7137('0x2'),_0x7137('0x3')];function createListener(_0x3876d9,_0x2bba75){return function(_0x134d35){_0x2bba75[_0x7137('0x4')](_0x3876d9,_0x134d35);};}function removeListener(_0xe216fc,_0x213439){return function(){DashboardItemEvents[_0x7137('0x5')](_0xe216fc,_0x213439);};}exports['register']=function(_0x261b98){for(var _0x51671f=0x0,_0x3d926a=events[_0x7137('0x6')];_0x51671f<_0x3d926a;_0x51671f++){var _0x287f58=events[_0x51671f];var _0x4d4ecb=createListener(_0x7137('0x7')+_0x287f58,_0x261b98);DashboardItemEvents['on'](_0x287f58,_0x4d4ecb);}}; \ No newline at end of file +var _0x9d09=['length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register'];(function(_0x381871,_0x2db4ad){var _0x5c1cb2=function(_0x4d2bc6){while(--_0x4d2bc6){_0x381871['push'](_0x381871['shift']());}};_0x5c1cb2(++_0x2db4ad);}(_0x9d09,0xc2));var _0x99d0=function(_0x3d5536,_0x3e6bde){_0x3d5536=_0x3d5536-0x0;var _0x10a59c=_0x9d09[_0x3d5536];return _0x10a59c;};'use strict';var DashboardItemEvents=require(_0x99d0('0x0'));var events=['save',_0x99d0('0x1'),_0x99d0('0x2')];function createListener(_0x5069ac,_0x52caee){return function(_0x23c4ad){_0x52caee[_0x99d0('0x3')](_0x5069ac,_0x23c4ad);};}function removeListener(_0x4dfa79,_0x18f8dc){return function(){DashboardItemEvents[_0x99d0('0x4')](_0x4dfa79,_0x18f8dc);};}exports[_0x99d0('0x5')]=function(_0x4a232a){for(var _0x528630=0x0,_0x92089e=events[_0x99d0('0x6')];_0x528630<_0x92089e;_0x528630++){var _0x27a391=events[_0x528630];var _0x3dbd5b=createListener(_0x99d0('0x7')+_0x27a391,_0x4a232a);DashboardItemEvents['on'](_0x27a391,_0x3dbd5b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 437f80c..0b71b36 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 _0x6d34=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x6d34,0x160));var _0x46d3=function(_0x472001,_0x564809){_0x472001=_0x472001-0x0;var _0x659007=_0x6d34[_0x472001];return _0x659007;};'use strict';var multer=require(_0x46d3('0x0'));var util=require(_0x46d3('0x1'));var path=require('path');var timeout=require(_0x46d3('0x2'));var express=require('express');var router=express[_0x46d3('0x3')]();var fs_extra=require(_0x46d3('0x4'));var auth=require(_0x46d3('0x5'));var interaction=require(_0x46d3('0x6'));var config=require(_0x46d3('0x7'));var controller=require(_0x46d3('0x8'));router[_0x46d3('0x9')](_0x46d3('0xa'),auth[_0x46d3('0xb')](),controller[_0x46d3('0xc')]);router[_0x46d3('0xd')]('/',auth['isAuthenticated'](),controller[_0x46d3('0xe')]);router['put'](_0x46d3('0xa'),auth['isAuthenticated'](),controller[_0x46d3('0xf')]);router[_0x46d3('0x10')](_0x46d3('0xa'),auth[_0x46d3('0xb')](),controller[_0x46d3('0x11')]);module[_0x46d3('0x12')]=router; \ No newline at end of file +var _0x68cc=['put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','post','create'];(function(_0x354c8f,_0x301b3d){var _0x109276=function(_0x13d8da){while(--_0x13d8da){_0x354c8f['push'](_0x354c8f['shift']());}};_0x109276(++_0x301b3d);}(_0x68cc,0x9c));var _0xc68c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x68cc[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xc68c('0x0'));var util=require(_0xc68c('0x1'));var path=require(_0xc68c('0x2'));var timeout=require(_0xc68c('0x3'));var express=require(_0xc68c('0x4'));var router=express['Router']();var fs_extra=require(_0xc68c('0x5'));var auth=require(_0xc68c('0x6'));var interaction=require(_0xc68c('0x7'));var config=require('../../config/environment');var controller=require(_0xc68c('0x8'));router[_0xc68c('0x9')](_0xc68c('0xa'),auth[_0xc68c('0xb')](),controller['show']);router[_0xc68c('0xc')]('/',auth[_0xc68c('0xb')](),controller[_0xc68c('0xd')]);router[_0xc68c('0xe')](_0xc68c('0xa'),auth[_0xc68c('0xb')](),controller[_0xc68c('0xf')]);router[_0xc68c('0x10')](_0xc68c('0xa'),auth[_0xc68c('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index bc8c56f..d5c14fd 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 _0x2b2a=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x3c9154,_0xd2e6d5){var _0x1b4708=function(_0x212415){while(--_0x212415){_0x3c9154['push'](_0x3c9154['shift']());}};_0x1b4708(++_0xd2e6d5);}(_0x2b2a,0xc2));var _0xa2b2=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x2b2a[_0xfcbcb8];return _0x1b1f97;};'use strict';var Sequelize=require(_0xa2b2('0x0'));module[_0xa2b2('0x1')]={'name':{'type':Sequelize[_0xa2b2('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xa2b2('0x3')](_0xa2b2('0x4'),_0xa2b2('0x5'),_0xa2b2('0x6')),'allowNull':![],'defaultValue':_0xa2b2('0x4')},'description':{'type':Sequelize[_0xa2b2('0x2')]}}; \ No newline at end of file +var _0xf657=['second','third','sequelize','exports','STRING','ENUM','first'];(function(_0x5d851d,_0x53c51c){var _0xbaaa92=function(_0x216b72){while(--_0x216b72){_0x5d851d['push'](_0x5d851d['shift']());}};_0xbaaa92(++_0x53c51c);}(_0xf657,0x79));var _0x7f65=function(_0x469c3e,_0x3137ac){_0x469c3e=_0x469c3e-0x0;var _0x390aef=_0xf657[_0x469c3e];return _0x390aef;};'use strict';var Sequelize=require(_0x7f65('0x0'));module[_0x7f65('0x1')]={'name':{'type':Sequelize[_0x7f65('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x7f65('0x3')](_0x7f65('0x4'),_0x7f65('0x5'),_0x7f65('0x6')),'allowNull':![],'defaultValue':_0x7f65('0x4')},'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 10b205a..110b07c 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 _0x29e8=['Dispositions','UserProfileResource','error','stack','name','send','index','Disposition','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','update','then','destroy','get'];(function(_0x323fff,_0x38f93e){var _0x326de5=function(_0x5520f9){while(--_0x5520f9){_0x323fff['push'](_0x323fff['shift']());}};_0x326de5(++_0x38f93e);}(_0x29e8,0x116));var _0x829e=function(_0x4eb1e2,_0x181732){_0x4eb1e2=_0x4eb1e2-0x0;var _0x23576a=_0x29e8[_0x4eb1e2];return _0x23576a;};'use strict';var emlformat=require(_0x829e('0x0'));var rimraf=require(_0x829e('0x1'));var zipdir=require(_0x829e('0x2'));var jsonpatch=require(_0x829e('0x3'));var rp=require('request-promise');var moment=require(_0x829e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x829e('0x5'));var util=require(_0x829e('0x6'));var path=require(_0x829e('0x7'));var sox=require(_0x829e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x829e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x829e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x829e('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x829e('0xc'));var Redis=require(_0x829e('0xd'));var authService=require(_0x829e('0xe'));var qs=require(_0x829e('0xf'));var as=require(_0x829e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x829e('0x11'))(_0x829e('0x12'));var utils=require(_0x829e('0x13'));var config=require(_0x829e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x829e('0x15'))['db'];function respondWithStatusCode(_0x74950b,_0x3a1697){_0x3a1697=_0x3a1697||0xcc;return function(_0x5b4107){if(_0x5b4107){return _0x74950b[_0x829e('0x16')](_0x3a1697);}return _0x74950b[_0x829e('0x17')](_0x3a1697)[_0x829e('0x18')]();};}function respondWithResult(_0x1f81bb,_0x2f7c64){_0x2f7c64=_0x2f7c64||0xc8;return function(_0x2162a8){if(_0x2162a8){return _0x1f81bb['status'](_0x2f7c64)[_0x829e('0x19')](_0x2162a8);}};}function respondWithFilteredResult(_0xc48685,_0x4b6de9){return function(_0x599f8b){if(_0x599f8b){var _0x39fd66=typeof _0x4b6de9[_0x829e('0x1a')]===_0x829e('0x1b')&&typeof _0x4b6de9['limit']==='undefined';var _0x8bdd5f=_0x599f8b['count'];var _0x2a7f8d=_0x39fd66?0x0:_0x4b6de9[_0x829e('0x1a')];var _0x5d43a0=_0x39fd66?_0x599f8b[_0x829e('0x1c')]:_0x4b6de9[_0x829e('0x1a')]+_0x4b6de9[_0x829e('0x1d')];var _0x22f012;if(_0x5d43a0>=_0x8bdd5f){_0x5d43a0=_0x8bdd5f;_0x22f012=0xc8;}else{_0x22f012=0xce;}_0xc48685['status'](_0x22f012);return _0xc48685['set']('Content-Range',_0x2a7f8d+'-'+_0x5d43a0+'/'+_0x8bdd5f)[_0x829e('0x19')](_0x599f8b);}return null;};}function patchUpdates(_0x44196d){return function(_0x370d2c){try{jsonpatch['apply'](_0x370d2c,_0x44196d,!![]);}catch(_0x5605dd){return BPromise['reject'](_0x5605dd);}return _0x370d2c['save']();};}function saveUpdates(_0x1fc75f,_0x30f9ca){return function(_0x4b5711){if(_0x4b5711){return _0x4b5711[_0x829e('0x1e')](_0x1fc75f)[_0x829e('0x1f')](function(_0x244b66){return _0x244b66;});}return null;};}function removeEntity(_0x5e264b,_0x1efdba){return function(_0x4e1082){if(_0x4e1082){return _0x4e1082[_0x829e('0x20')]()[_0x829e('0x1f')](function(){var _0x460ee9=_0x4e1082[_0x829e('0x21')]({'plain':!![]});var _0x37a6c1=_0x829e('0x22');return db[_0x829e('0x23')][_0x829e('0x20')]({'where':{'type':_0x37a6c1,'resourceId':_0x460ee9['id']}})[_0x829e('0x1f')](function(){return _0x4e1082;});})['then'](function(){_0x5e264b[_0x829e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e40ee,_0x4eb580){return function(_0x3c61d2){if(!_0x3c61d2){_0x5e40ee[_0x829e('0x16')](0x194);}return _0x3c61d2;};}function handleError(_0x2bfe6f,_0x3aae73){_0x3aae73=_0x3aae73||0x1f4;return function(_0xffd177){logger[_0x829e('0x24')](_0xffd177[_0x829e('0x25')]);if(_0xffd177['name']){delete _0xffd177[_0x829e('0x26')];}_0x2bfe6f[_0x829e('0x17')](_0x3aae73)[_0x829e('0x27')](_0xffd177);};}exports[_0x829e('0x28')]=function(_0x39a625,_0xa0c589){var _0x3cc330={},_0x5d9a23={},_0x2a9939={'count':0x0,'rows':[]};var _0x15c295=_['map'](db[_0x829e('0x29')]['rawAttributes'],function(_0x32a48f){return{'name':_0x32a48f['fieldName'],'type':_0x32a48f['type'][_0x829e('0x2a')]};});_0x5d9a23[_0x829e('0x2b')]=_[_0x829e('0x2c')](_0x15c295,_0x829e('0x26'));_0x5d9a23[_0x829e('0x2d')]=_[_0x829e('0x2e')](_0x39a625[_0x829e('0x2d')]);_0x5d9a23[_0x829e('0x2f')]=_[_0x829e('0x30')](_0x5d9a23[_0x829e('0x2b')],_0x5d9a23[_0x829e('0x2d')]);_0x3cc330[_0x829e('0x31')]=_['intersection'](_0x5d9a23[_0x829e('0x2b')],qs['fields'](_0x39a625[_0x829e('0x2d')][_0x829e('0x32')]));_0x3cc330[_0x829e('0x31')]=_0x3cc330[_0x829e('0x31')][_0x829e('0x33')]?_0x3cc330[_0x829e('0x31')]:_0x5d9a23[_0x829e('0x2b')];if(!_0x39a625[_0x829e('0x2d')][_0x829e('0x34')](_0x829e('0x35'))){_0x3cc330[_0x829e('0x1d')]=qs[_0x829e('0x1d')](_0x39a625[_0x829e('0x2d')][_0x829e('0x1d')]);_0x3cc330[_0x829e('0x1a')]=qs['offset'](_0x39a625['query']['offset']);}_0x3cc330[_0x829e('0x36')]=qs['sort'](_0x39a625['query'][_0x829e('0x37')]);_0x3cc330[_0x829e('0x38')]=qs[_0x829e('0x2f')](_[_0x829e('0x39')](_0x39a625[_0x829e('0x2d')],_0x5d9a23['filters']),_0x15c295);if(_0x39a625[_0x829e('0x2d')][_0x829e('0x3a')]){_0x3cc330[_0x829e('0x38')]=_[_0x829e('0x3b')](_0x3cc330['where'],{'$or':_[_0x829e('0x2c')](_0x15c295,function(_0x20d524){if(_0x20d524[_0x829e('0x3c')]!==_0x829e('0x3d')){var _0x10127d={};_0x10127d[_0x20d524[_0x829e('0x26')]]={'$like':'%'+_0x39a625[_0x829e('0x2d')][_0x829e('0x3a')]+'%'};return _0x10127d;}})});}_0x3cc330=_[_0x829e('0x3b')]({},_0x3cc330,_0x39a625[_0x829e('0x3e')]);var _0x11917d={'where':_0x3cc330[_0x829e('0x38')]};return db[_0x829e('0x29')][_0x829e('0x1c')](_0x11917d)[_0x829e('0x1f')](function(_0x132a2e){_0x2a9939[_0x829e('0x1c')]=_0x132a2e;if(_0x39a625[_0x829e('0x2d')][_0x829e('0x3f')]){_0x3cc330[_0x829e('0x40')]=[{'all':!![]}];}return db[_0x829e('0x29')]['findAll'](_0x3cc330);})[_0x829e('0x1f')](function(_0x37acd7){_0x2a9939[_0x829e('0x41')]=_0x37acd7;return _0x2a9939;})['then'](respondWithFilteredResult(_0xa0c589,_0x3cc330))[_0x829e('0x42')](handleError(_0xa0c589,null));};exports[_0x829e('0x43')]=function(_0x16d364,_0x14da29){var _0x2a485b={'raw':!![],'where':{'id':_0x16d364['params']['id']}},_0x3f8987={};_0x3f8987['model']=_[_0x829e('0x2e')](db[_0x829e('0x29')][_0x829e('0x44')]);_0x3f8987[_0x829e('0x2d')]=_[_0x829e('0x2e')](_0x16d364['query']);_0x3f8987[_0x829e('0x2f')]=_['intersection'](_0x3f8987['model'],_0x3f8987['query']);_0x2a485b[_0x829e('0x31')]=_[_0x829e('0x30')](_0x3f8987[_0x829e('0x2b')],qs['fields'](_0x16d364['query'][_0x829e('0x32')]));_0x2a485b['attributes']=_0x2a485b['attributes'][_0x829e('0x33')]?_0x2a485b[_0x829e('0x31')]:_0x3f8987[_0x829e('0x2b')];if(_0x16d364['query'][_0x829e('0x3f')]){_0x2a485b[_0x829e('0x40')]=[{'all':!![]}];}_0x2a485b=_['merge']({},_0x2a485b,_0x16d364[_0x829e('0x3e')]);return db[_0x829e('0x29')][_0x829e('0x45')](_0x2a485b)['then'](handleEntityNotFound(_0x14da29,null))['then'](respondWithResult(_0x14da29,null))[_0x829e('0x42')](handleError(_0x14da29,null));};exports[_0x829e('0x46')]=function(_0x38f8bf,_0x3f4655){return db[_0x829e('0x29')][_0x829e('0x46')](_0x38f8bf[_0x829e('0x47')],{})[_0x829e('0x1f')](function(_0x15784c){var _0x17679e=_0x38f8bf[_0x829e('0x48')][_0x829e('0x21')]({'plain':!![]});if(!_0x17679e)throw new Error(_0x829e('0x49'));if(_0x17679e[_0x829e('0x4a')]==='user'){var _0xbff9cc=_0x15784c[_0x829e('0x21')]({'plain':!![]});var _0x16b627=_0x829e('0x22');return db['UserProfileSection'][_0x829e('0x45')]({'where':{'name':_0x16b627,'userProfileId':_0x17679e['userProfileId']},'raw':!![]})['then'](function(_0x4a2b33){if(_0x4a2b33&&_0x4a2b33[_0x829e('0x4b')]===0x0){return db[_0x829e('0x23')][_0x829e('0x46')]({'name':_0xbff9cc['name'],'resourceId':_0xbff9cc['id'],'type':_0x4a2b33['name'],'sectionId':_0x4a2b33['id']},{})[_0x829e('0x1f')](function(){return _0x15784c;});}else{return _0x15784c;}})[_0x829e('0x42')](function(_0x200693){logger[_0x829e('0x24')](_0x829e('0x4c'),_0x200693);throw _0x200693;});}return _0x15784c;})[_0x829e('0x1f')](respondWithResult(_0x3f4655,0xc9))[_0x829e('0x42')](handleError(_0x3f4655,null));};exports[_0x829e('0x1e')]=function(_0x1d4655,_0x17edd3){if(_0x1d4655[_0x829e('0x47')]['id']){delete _0x1d4655[_0x829e('0x47')]['id'];}return db[_0x829e('0x29')][_0x829e('0x45')]({'where':{'id':_0x1d4655[_0x829e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17edd3,null))[_0x829e('0x1f')](saveUpdates(_0x1d4655[_0x829e('0x47')],null))[_0x829e('0x1f')](respondWithResult(_0x17edd3,null))[_0x829e('0x42')](handleError(_0x17edd3,null));};exports[_0x829e('0x20')]=function(_0x2203ae,_0x29b906){return db[_0x829e('0x29')][_0x829e('0x45')]({'where':{'id':_0x2203ae[_0x829e('0x4d')]['id']}})[_0x829e('0x1f')](handleEntityNotFound(_0x29b906,null))[_0x829e('0x1f')](removeEntity(_0x29b906,null))[_0x829e('0x42')](handleError(_0x29b906,null));}; \ No newline at end of file +var _0x7ac2=['includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','where','filter','merge','options','include','findAll','rows','catch','show','params','length'];(function(_0x168e24,_0x347c8a){var _0x2f90de=function(_0x47e50b){while(--_0x47e50b){_0x168e24['push'](_0x168e24['shift']());}};_0x2f90de(++_0x347c8a);}(_0x7ac2,0x16b));var _0x27ac=function(_0x1f7721,_0x57b84c){_0x1f7721=_0x1f7721-0x0;var _0x448a5e=_0x7ac2[_0x1f7721];return _0x448a5e;};'use strict';var emlformat=require(_0x27ac('0x0'));var rimraf=require(_0x27ac('0x1'));var zipdir=require(_0x27ac('0x2'));var jsonpatch=require(_0x27ac('0x3'));var rp=require(_0x27ac('0x4'));var moment=require(_0x27ac('0x5'));var BPromise=require(_0x27ac('0x6'));var Mustache=require(_0x27ac('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x27ac('0x8'));var fs=require('fs');var fs_extra=require(_0x27ac('0x9'));var _=require('lodash');var squel=require(_0x27ac('0xa'));var crypto=require(_0x27ac('0xb'));var jsforce=require(_0x27ac('0xc'));var deskjs=require(_0x27ac('0xd'));var toCsv=require(_0x27ac('0xe'));var querystring=require(_0x27ac('0xf'));var Papa=require(_0x27ac('0x10'));var Redis=require(_0x27ac('0x11'));var authService=require(_0x27ac('0x12'));var qs=require(_0x27ac('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27ac('0x14'));var logger=require(_0x27ac('0x15'))(_0x27ac('0x16'));var utils=require(_0x27ac('0x17'));var config=require(_0x27ac('0x18'));var licenseUtil=require(_0x27ac('0x19'));var db=require(_0x27ac('0x1a'))['db'];function respondWithStatusCode(_0x38b206,_0x47c2b6){_0x47c2b6=_0x47c2b6||0xcc;return function(_0x365380){if(_0x365380){return _0x38b206[_0x27ac('0x1b')](_0x47c2b6);}return _0x38b206[_0x27ac('0x1c')](_0x47c2b6)[_0x27ac('0x1d')]();};}function respondWithResult(_0x3e776d,_0x2f8f56){_0x2f8f56=_0x2f8f56||0xc8;return function(_0x1d35f8){if(_0x1d35f8){return _0x3e776d['status'](_0x2f8f56)['json'](_0x1d35f8);}};}function respondWithFilteredResult(_0xfeb7fb,_0x5a4a06){return function(_0x4461fd){if(_0x4461fd){var _0x16f4c8=typeof _0x5a4a06['offset']===_0x27ac('0x1e')&&typeof _0x5a4a06[_0x27ac('0x1f')]===_0x27ac('0x1e');var _0x333145=_0x4461fd['count'];var _0x5a9507=_0x16f4c8?0x0:_0x5a4a06[_0x27ac('0x20')];var _0xbfe3ee=_0x16f4c8?_0x4461fd[_0x27ac('0x21')]:_0x5a4a06[_0x27ac('0x20')]+_0x5a4a06[_0x27ac('0x1f')];var _0x4193e6;if(_0xbfe3ee>=_0x333145){_0xbfe3ee=_0x333145;_0x4193e6=0xc8;}else{_0x4193e6=0xce;}_0xfeb7fb['status'](_0x4193e6);return _0xfeb7fb['set'](_0x27ac('0x22'),_0x5a9507+'-'+_0xbfe3ee+'/'+_0x333145)[_0x27ac('0x23')](_0x4461fd);}return null;};}function patchUpdates(_0x2c7d19){return function(_0x300c63){try{jsonpatch['apply'](_0x300c63,_0x2c7d19,!![]);}catch(_0x19bee3){return BPromise[_0x27ac('0x24')](_0x19bee3);}return _0x300c63[_0x27ac('0x25')]();};}function saveUpdates(_0x3f3183,_0x561241){return function(_0x2f5afc){if(_0x2f5afc){return _0x2f5afc[_0x27ac('0x26')](_0x3f3183)[_0x27ac('0x27')](function(_0x5ed24c){return _0x5ed24c;});}return null;};}function removeEntity(_0x27549e,_0x24fa6e){return function(_0x5cdaab){if(_0x5cdaab){return _0x5cdaab['destroy']()['then'](function(){var _0x40bf8b=_0x5cdaab[_0x27ac('0x28')]({'plain':!![]});var _0x338352=_0x27ac('0x29');return db[_0x27ac('0x2a')][_0x27ac('0x2b')]({'where':{'type':_0x338352,'resourceId':_0x40bf8b['id']}})[_0x27ac('0x27')](function(){return _0x5cdaab;});})['then'](function(){_0x27549e[_0x27ac('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x336d11,_0x5759f0){return function(_0xde82a6){if(!_0xde82a6){_0x336d11[_0x27ac('0x1b')](0x194);}return _0xde82a6;};}function handleError(_0x40c048,_0x5ef048){_0x5ef048=_0x5ef048||0x1f4;return function(_0x339bc7){logger[_0x27ac('0x2c')](_0x339bc7[_0x27ac('0x2d')]);if(_0x339bc7['name']){delete _0x339bc7['name'];}_0x40c048[_0x27ac('0x1c')](_0x5ef048)[_0x27ac('0x2e')](_0x339bc7);};}exports[_0x27ac('0x2f')]=function(_0x15a1d2,_0x4705c5){var _0x3824fa={},_0x41b077={},_0x438d1f={'count':0x0,'rows':[]};var _0xeb2199=_[_0x27ac('0x30')](db[_0x27ac('0x31')][_0x27ac('0x32')],function(_0x39de7f){return{'name':_0x39de7f[_0x27ac('0x33')],'type':_0x39de7f[_0x27ac('0x34')][_0x27ac('0x35')]};});_0x41b077[_0x27ac('0x36')]=_[_0x27ac('0x30')](_0xeb2199,_0x27ac('0x37'));_0x41b077[_0x27ac('0x38')]=_[_0x27ac('0x39')](_0x15a1d2[_0x27ac('0x38')]);_0x41b077['filters']=_['intersection'](_0x41b077['model'],_0x41b077[_0x27ac('0x38')]);_0x3824fa[_0x27ac('0x3a')]=_[_0x27ac('0x3b')](_0x41b077[_0x27ac('0x36')],qs[_0x27ac('0x3c')](_0x15a1d2[_0x27ac('0x38')][_0x27ac('0x3c')]));_0x3824fa[_0x27ac('0x3a')]=_0x3824fa[_0x27ac('0x3a')]['length']?_0x3824fa[_0x27ac('0x3a')]:_0x41b077[_0x27ac('0x36')];if(!_0x15a1d2[_0x27ac('0x38')][_0x27ac('0x3d')](_0x27ac('0x3e'))){_0x3824fa[_0x27ac('0x1f')]=qs[_0x27ac('0x1f')](_0x15a1d2['query'][_0x27ac('0x1f')]);_0x3824fa[_0x27ac('0x20')]=qs[_0x27ac('0x20')](_0x15a1d2[_0x27ac('0x38')][_0x27ac('0x20')]);}_0x3824fa[_0x27ac('0x3f')]=qs[_0x27ac('0x40')](_0x15a1d2[_0x27ac('0x38')]['sort']);_0x3824fa['where']=qs[_0x27ac('0x41')](_['pick'](_0x15a1d2[_0x27ac('0x38')],_0x41b077[_0x27ac('0x41')]),_0xeb2199);if(_0x15a1d2[_0x27ac('0x38')]['filter']){_0x3824fa[_0x27ac('0x42')]=_['merge'](_0x3824fa[_0x27ac('0x42')],{'$or':_[_0x27ac('0x30')](_0xeb2199,function(_0x3d5725){if(_0x3d5725['type']!=='VIRTUAL'){var _0x21feb5={};_0x21feb5[_0x3d5725[_0x27ac('0x37')]]={'$like':'%'+_0x15a1d2[_0x27ac('0x38')][_0x27ac('0x43')]+'%'};return _0x21feb5;}})});}_0x3824fa=_[_0x27ac('0x44')]({},_0x3824fa,_0x15a1d2[_0x27ac('0x45')]);var _0x3e054e={'where':_0x3824fa[_0x27ac('0x42')]};return db[_0x27ac('0x31')]['count'](_0x3e054e)[_0x27ac('0x27')](function(_0x51732f){_0x438d1f[_0x27ac('0x21')]=_0x51732f;if(_0x15a1d2['query']['includeAll']){_0x3824fa[_0x27ac('0x46')]=[{'all':!![]}];}return db[_0x27ac('0x31')][_0x27ac('0x47')](_0x3824fa);})[_0x27ac('0x27')](function(_0xe4cc72){_0x438d1f[_0x27ac('0x48')]=_0xe4cc72;return _0x438d1f;})['then'](respondWithFilteredResult(_0x4705c5,_0x3824fa))[_0x27ac('0x49')](handleError(_0x4705c5,null));};exports[_0x27ac('0x4a')]=function(_0x4e462c,_0xfe4bc9){var _0x579824={'raw':!![],'where':{'id':_0x4e462c[_0x27ac('0x4b')]['id']}},_0x56ac8d={};_0x56ac8d[_0x27ac('0x36')]=_[_0x27ac('0x39')](db[_0x27ac('0x31')][_0x27ac('0x32')]);_0x56ac8d[_0x27ac('0x38')]=_[_0x27ac('0x39')](_0x4e462c[_0x27ac('0x38')]);_0x56ac8d[_0x27ac('0x41')]=_[_0x27ac('0x3b')](_0x56ac8d[_0x27ac('0x36')],_0x56ac8d[_0x27ac('0x38')]);_0x579824[_0x27ac('0x3a')]=_['intersection'](_0x56ac8d[_0x27ac('0x36')],qs[_0x27ac('0x3c')](_0x4e462c['query'][_0x27ac('0x3c')]));_0x579824[_0x27ac('0x3a')]=_0x579824[_0x27ac('0x3a')][_0x27ac('0x4c')]?_0x579824[_0x27ac('0x3a')]:_0x56ac8d[_0x27ac('0x36')];if(_0x4e462c['query'][_0x27ac('0x4d')]){_0x579824[_0x27ac('0x46')]=[{'all':!![]}];}_0x579824=_[_0x27ac('0x44')]({},_0x579824,_0x4e462c[_0x27ac('0x45')]);return db[_0x27ac('0x31')][_0x27ac('0x4e')](_0x579824)[_0x27ac('0x27')](handleEntityNotFound(_0xfe4bc9,null))[_0x27ac('0x27')](respondWithResult(_0xfe4bc9,null))[_0x27ac('0x49')](handleError(_0xfe4bc9,null));};exports[_0x27ac('0x4f')]=function(_0x4b3b79,_0x42e859){return db[_0x27ac('0x31')]['create'](_0x4b3b79[_0x27ac('0x50')],{})[_0x27ac('0x27')](function(_0x129a7e){var _0x3f75a4=_0x4b3b79[_0x27ac('0x51')][_0x27ac('0x28')]({'plain':!![]});if(!_0x3f75a4)throw new Error(_0x27ac('0x52'));if(_0x3f75a4[_0x27ac('0x53')]===_0x27ac('0x51')){var _0x45aa90=_0x129a7e[_0x27ac('0x28')]({'plain':!![]});var _0x3f6a6e='Dispositions';return db[_0x27ac('0x54')][_0x27ac('0x4e')]({'where':{'name':_0x3f6a6e,'userProfileId':_0x3f75a4[_0x27ac('0x55')]},'raw':!![]})['then'](function(_0x43eb5e){if(_0x43eb5e&&_0x43eb5e[_0x27ac('0x56')]===0x0){return db[_0x27ac('0x2a')][_0x27ac('0x4f')]({'name':_0x45aa90[_0x27ac('0x37')],'resourceId':_0x45aa90['id'],'type':_0x43eb5e[_0x27ac('0x37')],'sectionId':_0x43eb5e['id']},{})['then'](function(){return _0x129a7e;});}else{return _0x129a7e;}})[_0x27ac('0x49')](function(_0x30cc50){logger[_0x27ac('0x2c')](_0x27ac('0x57'),_0x30cc50);throw _0x30cc50;});}return _0x129a7e;})[_0x27ac('0x27')](respondWithResult(_0x42e859,0xc9))[_0x27ac('0x49')](handleError(_0x42e859,null));};exports[_0x27ac('0x26')]=function(_0x4d2c88,_0x4177de){if(_0x4d2c88['body']['id']){delete _0x4d2c88[_0x27ac('0x50')]['id'];}return db[_0x27ac('0x31')]['find']({'where':{'id':_0x4d2c88['params']['id']}})[_0x27ac('0x27')](handleEntityNotFound(_0x4177de,null))[_0x27ac('0x27')](saveUpdates(_0x4d2c88['body'],null))[_0x27ac('0x27')](respondWithResult(_0x4177de,null))['catch'](handleError(_0x4177de,null));};exports[_0x27ac('0x2b')]=function(_0x702ea3,_0x2cba4e){return db[_0x27ac('0x31')]['find']({'where':{'id':_0x702ea3[_0x27ac('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2cba4e,null))[_0x27ac('0x27')](removeEntity(_0x2cba4e,null))[_0x27ac('0x49')](handleError(_0x2cba4e,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 10caf9c..337d0da 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 _0xb846=['FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x20f96d,_0x23e67f){var _0x9a7524=function(_0x57c732){while(--_0x57c732){_0x20f96d['push'](_0x20f96d['shift']());}};_0x9a7524(++_0x23e67f);}(_0xb846,0x101));var _0x6b84=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb846[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x6b84('0x0'));var logger=require(_0x6b84('0x1'))(_0x6b84('0x2'));var moment=require(_0x6b84('0x3'));var BPromise=require(_0x6b84('0x4'));var rp=require(_0x6b84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b84('0x6'));var attributes=require(_0x6b84('0x7'));module[_0x6b84('0x8')]=function(_0x441259,_0x217dc1){return _0x441259[_0x6b84('0x9')](_0x6b84('0xa'),attributes,{'tableName':_0x6b84('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6b84('0xc'),'fields':[_0x6b84('0xd'),'ListId']},{'unique':!![],'name':_0x6b84('0xe'),'fields':[_0x6b84('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0x6b84('0xf'),'fields':[_0x6b84('0xd'),_0x6b84('0x10')]},{'unique':!![],'name':_0x6b84('0x11'),'fields':[_0x6b84('0xd'),_0x6b84('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x6b84('0xd'),_0x6b84('0x13')]},{'unique':!![],'name':_0x6b84('0x14'),'fields':[_0x6b84('0xd'),_0x6b84('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x6b84('0xd'),_0x6b84('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb799=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_mail','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb799,0x18c));var _0x9b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb799[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9b79('0x0'));var util=require(_0x9b79('0x1'));var logger=require(_0x9b79('0x2'))(_0x9b79('0x3'));var moment=require('moment');var BPromise=require(_0x9b79('0x4'));var rp=require(_0x9b79('0x5'));var fs=require('fs');var path=require(_0x9b79('0x6'));var rimraf=require('rimraf');var config=require(_0x9b79('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x456dd5,_0x428c81){return _0x456dd5[_0x9b79('0x8')]('Disposition',attributes,{'tableName':_0x9b79('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x9b79('0xa'),_0x9b79('0xb')]},{'unique':!![],'name':_0x9b79('0xc'),'fields':[_0x9b79('0xa'),_0x9b79('0xd')]},{'unique':!![],'name':_0x9b79('0xe'),'fields':[_0x9b79('0xa'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x9b79('0xa'),_0x9b79('0xf')]},{'unique':!![],'name':_0x9b79('0x10'),'fields':['name',_0x9b79('0x11')]},{'unique':!![],'name':_0x9b79('0x12'),'fields':[_0x9b79('0xa'),_0x9b79('0x13')]},{'unique':!![],'name':_0x9b79('0x14'),'fields':[_0x9b79('0xa'),_0x9b79('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index c09e890..885e192 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(_0x321b88,_0x3f23d6){var _0x464329=function(_0x41b541){while(--_0x41b541){_0x321b88['push'](_0x321b88['shift']());}};_0x464329(++_0x3f23d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x6e87c3,_0x597c19){var _0x14546c=function(_0x59f19c){while(--_0x59f19c){_0x6e87c3['push'](_0x6e87c3['shift']());}};_0x14546c(++_0x597c19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 55422cc..33d3306 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 _0xb05d=['../../config/environment','./disposition.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24a801,_0x4d1b37){var _0x478e3f=function(_0x4ef853){while(--_0x4ef853){_0x24a801['push'](_0x24a801['shift']());}};_0x478e3f(++_0x4d1b37);}(_0xb05d,0xdf));var _0xdb05=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0xb05d[_0x1fa760];return _0xd8eda1;};'use strict';var multer=require('multer');var util=require(_0xdb05('0x0'));var path=require(_0xdb05('0x1'));var timeout=require(_0xdb05('0x2'));var express=require(_0xdb05('0x3'));var router=express[_0xdb05('0x4')]();var fs_extra=require(_0xdb05('0x5'));var auth=require(_0xdb05('0x6'));var interaction=require(_0xdb05('0x7'));var config=require(_0xdb05('0x8'));var controller=require(_0xdb05('0x9'));router[_0xdb05('0xa')]('/',auth[_0xdb05('0xb')](),controller[_0xdb05('0xc')]);router['get']('/:id',auth[_0xdb05('0xb')](),controller[_0xdb05('0xd')]);router['post']('/',auth[_0xdb05('0xb')](),controller[_0xdb05('0xe')]);router[_0xdb05('0xf')](_0xdb05('0x10'),auth[_0xdb05('0xb')](),controller[_0xdb05('0x11')]);router[_0xdb05('0x12')](_0xdb05('0x10'),auth[_0xdb05('0xb')](),controller[_0xdb05('0x13')]);module[_0xdb05('0x14')]=router; \ No newline at end of file +var _0xcd98=['put','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xcd98,0x1e3));var _0x8cd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd98[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8cd9('0x0'));var util=require(_0x8cd9('0x1'));var path=require('path');var timeout=require(_0x8cd9('0x2'));var express=require('express');var router=express[_0x8cd9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8cd9('0x4'));var interaction=require(_0x8cd9('0x5'));var config=require(_0x8cd9('0x6'));var controller=require('./disposition.controller');router[_0x8cd9('0x7')]('/',auth[_0x8cd9('0x8')](),controller[_0x8cd9('0x9')]);router[_0x8cd9('0x7')](_0x8cd9('0xa'),auth[_0x8cd9('0x8')](),controller['show']);router[_0x8cd9('0xb')]('/',auth['isAuthenticated'](),controller[_0x8cd9('0xc')]);router[_0x8cd9('0xd')](_0x8cd9('0xa'),auth[_0x8cd9('0x8')](),controller['update']);router['delete'](_0x8cd9('0xa'),auth['isAuthenticated'](),controller[_0x8cd9('0xe')]);module[_0x8cd9('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index cb5f647..848582d 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 _0x9ad1=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x47b0b0,_0x3bdc6e){var _0x3ebba3=function(_0x187e63){while(--_0x187e63){_0x47b0b0['push'](_0x47b0b0['shift']());}};_0x3ebba3(++_0x3bdc6e);}(_0x9ad1,0x78));var _0x19ad=function(_0x2ce810,_0x373b88){_0x2ce810=_0x2ce810-0x0;var _0x514506=_0x9ad1[_0x2ce810];return _0x514506;};'use strict';var Sequelize=require(_0x19ad('0x0'));module[_0x19ad('0x1')]={'name':{'type':Sequelize[_0x19ad('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x19ad('0x2')]},'ecm':{'type':Sequelize[_0x19ad('0x3')]('yes','no'),'defaultValue':_0x19ad('0x4')},'headerinfo':{'type':Sequelize[_0x19ad('0x2')],'defaultValue':_0x19ad('0x5')},'localstationid':{'type':Sequelize[_0x19ad('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x19ad('0x3')](_0x19ad('0x6'),_0x19ad('0x7'),_0x19ad('0x8'),_0x19ad('0x9'),_0x19ad('0xa'),_0x19ad('0xb')),'defaultValue':_0x19ad('0x7')},'maxrate':{'type':Sequelize[_0x19ad('0x3')](_0x19ad('0x6'),_0x19ad('0x7'),_0x19ad('0x8'),_0x19ad('0x9'),'12000',_0x19ad('0xb')),'defaultValue':_0x19ad('0xb')},'modem':{'type':Sequelize[_0x19ad('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x19ad('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x19ad('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x19ad('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x19ad('0x3')]('SIP',_0x19ad('0xd'),_0x19ad('0xe'),_0x19ad('0xf')),'defaultValue':_0x19ad('0x10')},'key':{'type':Sequelize[_0x19ad('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x19ad('0x11')],'defaultValue':function(){return _0x19ad('0x12');}},'notificationSound':{'type':Sequelize[_0x19ad('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x19ad('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x19ad('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x19ad('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x19ad('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x19ad('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x19ad('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x19ad('0x13')],'defaultValue':![],'comment':_0x19ad('0x14'),'set':function(_0x4a9a6b){if(!_0x4a9a6b)this[_0x19ad('0x15')](_0x19ad('0x16'),null);this[_0x19ad('0x15')](_0x19ad('0x17'),_0x4a9a6b);}}}; \ No newline at end of file +var _0x37a5=['sequelize','exports','STRING','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x46777e,_0x2eb70b){var _0x315e20=function(_0x5b9a46){while(--_0x5b9a46){_0x46777e['push'](_0x46777e['shift']());}};_0x315e20(++_0x2eb70b);}(_0x37a5,0x114));var _0x537a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x37a5[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0x537a('0x0'));module[_0x537a('0x1')]={'name':{'type':Sequelize[_0x537a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x537a('0x2')],'defaultValue':_0x537a('0x3')},'localstationid':{'type':Sequelize[_0x537a('0x2')],'unique':_0x537a('0x4')},'minrate':{'type':Sequelize[_0x537a('0x5')](_0x537a('0x6'),_0x537a('0x7'),_0x537a('0x8'),_0x537a('0x9'),_0x537a('0xa'),'14400'),'defaultValue':_0x537a('0x7')},'maxrate':{'type':Sequelize[_0x537a('0x5')]('2400',_0x537a('0x7'),_0x537a('0x8'),_0x537a('0x9'),_0x537a('0xa'),'14400'),'defaultValue':_0x537a('0xb')},'modem':{'type':Sequelize[_0x537a('0x2')],'defaultValue':_0x537a('0xc')},'gateway':{'type':Sequelize[_0x537a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x537a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x537a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x537a('0x5')]('SIP',_0x537a('0xe'),_0x537a('0xf'),_0x537a('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x537a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x537a('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x537a('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x537a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x537a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x537a('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x537a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x537a('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x537a('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x537a('0x13'),'set':function(_0x430da2){if(!_0x430da2)this[_0x537a('0x14')](_0x537a('0x15'),null);this[_0x537a('0x14')](_0x537a('0x16'),_0x430da2);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2c6fa83..d5d1b5a 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 _0x3d90=['Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','send','index','FaxAccount','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','rows','show','Pause','mandatoryDispositionPause','include','find','create','user','role','FaxAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','findOne','length','hasOwnProperty','nolimit','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','from','\x22%s\x22\x20<%s>','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','isNil','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x48fa3f,_0x700760){var _0x16037d=function(_0x23fe27){while(--_0x23fe27){_0x48fa3f['push'](_0x48fa3f['shift']());}};_0x16037d(++_0x700760);}(_0x3d90,0x15c));var _0x03d9=function(_0x51816f,_0x11677e){_0x51816f=_0x51816f-0x0;var _0x41b781=_0x3d90[_0x51816f];return _0x41b781;};'use strict';var emlformat=require(_0x03d9('0x0'));var rimraf=require(_0x03d9('0x1'));var zipdir=require(_0x03d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03d9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x03d9('0x4'));var util=require(_0x03d9('0x5'));var path=require(_0x03d9('0x6'));var sox=require(_0x03d9('0x7'));var csv=require(_0x03d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03d9('0x9'));var _=require(_0x03d9('0xa'));var squel=require(_0x03d9('0xb'));var crypto=require(_0x03d9('0xc'));var jsforce=require(_0x03d9('0xd'));var deskjs=require(_0x03d9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x03d9('0xf'));var Papa=require(_0x03d9('0x10'));var Redis=require(_0x03d9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x03d9('0x12'));var as=require(_0x03d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03d9('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x03d9('0x15'));var db=require(_0x03d9('0x16'))['db'];config[_0x03d9('0x17')]=_['defaults'](config['redis'],{'host':_0x03d9('0x18'),'port':0x18eb});var socket=require(_0x03d9('0x19'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x03d9('0x1a')](socket);var jayson=require(_0x03d9('0x1b'));var client=jayson[_0x03d9('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x03d9('0x1c')][_0x03d9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x38239a,_0x225f5e,_0x465655,_0x4175d8){return new BPromise(function(_0x6e0a5f,_0x202bed){var _0x35704d=_0x4175d8||client;return _0x35704d[_0x03d9('0x1e')](_0x38239a,_0x465655)[_0x03d9('0x1f')](function(_0x50e32b){logger['info']('FaxAccount,\x20%s,\x20%s',_0x225f5e,_0x03d9('0x20'));logger[_0x03d9('0x21')](_0x03d9('0x22'),_0x225f5e,_0x03d9('0x20'),JSON[_0x03d9('0x23')](_0x50e32b));if(_0x50e32b[_0x03d9('0x24')]){if(_0x50e32b[_0x03d9('0x24')][_0x03d9('0x25')]===0x1f4){logger['error'](_0x03d9('0x26'),_0x225f5e,_0x50e32b['error'][_0x03d9('0x27')]);return _0x202bed(_0x50e32b[_0x03d9('0x24')][_0x03d9('0x27')]);}logger[_0x03d9('0x24')]('FaxAccount,\x20%s,\x20%s',_0x225f5e,_0x50e32b[_0x03d9('0x24')][_0x03d9('0x27')]);return _0x6e0a5f(_0x50e32b[_0x03d9('0x24')][_0x03d9('0x27')]);}else{logger[_0x03d9('0x28')](_0x03d9('0x26'),_0x225f5e,'request\x20sent');_0x6e0a5f(_0x50e32b[_0x03d9('0x29')][_0x03d9('0x27')]);}})[_0x03d9('0x2a')](function(_0x52d8d4){logger[_0x03d9('0x24')](_0x03d9('0x26'),_0x225f5e,_0x52d8d4);_0x202bed(_0x52d8d4);});});}function respondWithStatusCode(_0x472a9d,_0x4cf183){_0x4cf183=_0x4cf183||0xcc;return function(_0x1b7d2c){if(_0x1b7d2c){return _0x472a9d[_0x03d9('0x2b')](_0x4cf183);}return _0x472a9d[_0x03d9('0x2c')](_0x4cf183)[_0x03d9('0x2d')]();};}function respondWithResult(_0x53a284,_0x128939){_0x128939=_0x128939||0xc8;return function(_0x450345){if(_0x450345){return _0x53a284['status'](_0x128939)[_0x03d9('0x2e')](_0x450345);}};}function respondWithFilteredResult(_0x460b9b,_0x261d33){return function(_0x5f3da1){if(_0x5f3da1){var _0x2beb54=typeof _0x261d33['offset']===_0x03d9('0x2f')&&typeof _0x261d33[_0x03d9('0x30')]===_0x03d9('0x2f');var _0x5e057b=_0x5f3da1[_0x03d9('0x31')];var _0x94e53f=_0x2beb54?0x0:_0x261d33[_0x03d9('0x32')];var _0x11a580=_0x2beb54?_0x5f3da1[_0x03d9('0x31')]:_0x261d33['offset']+_0x261d33[_0x03d9('0x30')];var _0x40332a;if(_0x11a580>=_0x5e057b){_0x11a580=_0x5e057b;_0x40332a=0xc8;}else{_0x40332a=0xce;}_0x460b9b[_0x03d9('0x2c')](_0x40332a);return _0x460b9b[_0x03d9('0x33')](_0x03d9('0x34'),_0x94e53f+'-'+_0x11a580+'/'+_0x5e057b)['json'](_0x5f3da1);}return null;};}function patchUpdates(_0xcea0d9){return function(_0xaf775a){try{jsonpatch[_0x03d9('0x35')](_0xaf775a,_0xcea0d9,!![]);}catch(_0x556830){return BPromise[_0x03d9('0x36')](_0x556830);}return _0xaf775a[_0x03d9('0x37')]();};}function saveUpdates(_0x4fd11f,_0x2c74ac){return function(_0x590092){if(_0x590092){return _0x590092[_0x03d9('0x38')](_0x4fd11f)[_0x03d9('0x1f')](function(_0x1e4e0d){return _0x1e4e0d;});}return null;};}function removeEntity(_0x4915ad,_0x5a1167){return function(_0x5ea2ac){if(_0x5ea2ac){return _0x5ea2ac[_0x03d9('0x39')]()[_0x03d9('0x1f')](function(){var _0x2b9de3=_0x5ea2ac[_0x03d9('0x3a')]({'plain':!![]});var _0xbc9daa='FaxAccounts';return db[_0x03d9('0x3b')]['destroy']({'where':{'type':_0xbc9daa,'resourceId':_0x2b9de3['id']}})[_0x03d9('0x1f')](function(){return _0x5ea2ac;});})[_0x03d9('0x1f')](function(){_0x4915ad['status'](0xcc)[_0x03d9('0x2d')]();});}};}function handleEntityNotFound(_0x451214,_0x3af1dd){return function(_0x48cc03){if(!_0x48cc03){_0x451214['sendStatus'](0x194);}return _0x48cc03;};}function handleError(_0x337e08,_0x106b13){_0x106b13=_0x106b13||0x1f4;return function(_0x15a6e7){logger['error'](_0x15a6e7['stack']);if(_0x15a6e7['name']){delete _0x15a6e7['name'];}_0x337e08[_0x03d9('0x2c')](_0x106b13)[_0x03d9('0x3c')](_0x15a6e7);};}exports[_0x03d9('0x3d')]=function(_0x59c106,_0x5b9b02){var _0x2aa5bd={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4ee58d={},_0x33d65a={'count':0x0,'rows':[]};var _0x2066e0=_['map'](db[_0x03d9('0x3e')][_0x03d9('0x3f')],function(_0x27c5d8){return{'name':_0x27c5d8[_0x03d9('0x40')],'type':_0x27c5d8[_0x03d9('0x41')][_0x03d9('0x42')]};});_0x4ee58d['model']=_[_0x03d9('0x43')](_0x2066e0,'name');_0x4ee58d['query']=_[_0x03d9('0x44')](_0x59c106[_0x03d9('0x45')]);_0x4ee58d[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x4ee58d[_0x03d9('0x48')],_0x4ee58d['query']);_0x2aa5bd['attributes']=_[_0x03d9('0x47')](_0x4ee58d['model'],qs[_0x03d9('0x49')](_0x59c106['query'][_0x03d9('0x49')]));_0x2aa5bd[_0x03d9('0x4a')]=_0x2aa5bd[_0x03d9('0x4a')]['length']?_0x2aa5bd['attributes']:_0x4ee58d[_0x03d9('0x48')];if(!_0x59c106[_0x03d9('0x45')]['hasOwnProperty']('nolimit')){_0x2aa5bd[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x59c106[_0x03d9('0x45')][_0x03d9('0x30')]);_0x2aa5bd[_0x03d9('0x32')]=qs[_0x03d9('0x32')](_0x59c106[_0x03d9('0x45')]['offset']);}_0x2aa5bd[_0x03d9('0x4b')]=qs[_0x03d9('0x4c')](_0x59c106[_0x03d9('0x45')]['sort']);_0x2aa5bd['where']=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x59c106[_0x03d9('0x45')],_0x4ee58d[_0x03d9('0x46')]),_0x2066e0);if(_0x59c106[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x2aa5bd[_0x03d9('0x4f')]=_[_0x03d9('0x50')](_0x2aa5bd[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x43')](_0x2066e0,function(_0x262cf1){if(_0x262cf1[_0x03d9('0x41')]!==_0x03d9('0x51')){var _0x93eaf7={};_0x93eaf7[_0x262cf1[_0x03d9('0x52')]]={'$like':'%'+_0x59c106[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0x93eaf7;}})});}_0x2aa5bd=_[_0x03d9('0x50')]({},_0x2aa5bd,_0x59c106[_0x03d9('0x53')]);var _0x4b9fd5={'where':_0x2aa5bd[_0x03d9('0x4f')]};return db['FaxAccount'][_0x03d9('0x31')](_0x4b9fd5)[_0x03d9('0x1f')](function(_0x37b065){_0x33d65a['count']=_0x37b065;if(_0x59c106[_0x03d9('0x45')][_0x03d9('0x54')]){_0x2aa5bd['include']=[{'all':!![]}];}return db['FaxAccount'][_0x03d9('0x55')](_0x2aa5bd);})[_0x03d9('0x1f')](function(_0x97e40b){_0x33d65a[_0x03d9('0x56')]=_0x97e40b;return _0x33d65a;})[_0x03d9('0x1f')](respondWithFilteredResult(_0x5b9b02,_0x2aa5bd))[_0x03d9('0x2a')](handleError(_0x5b9b02,null));};exports[_0x03d9('0x57')]=function(_0xc1e483,_0x550b39){var _0x4dace3={'raw':![],'where':{'id':_0xc1e483['params']['id']},'include':[{'model':db[_0x03d9('0x58')],'as':_0x03d9('0x59')}]},_0x20948d={};_0x20948d['model']=_['keys'](db[_0x03d9('0x3e')][_0x03d9('0x3f')]);_0x20948d['query']=_[_0x03d9('0x44')](_0xc1e483[_0x03d9('0x45')]);_0x20948d['filters']=_[_0x03d9('0x47')](_0x20948d[_0x03d9('0x48')],_0x20948d[_0x03d9('0x45')]);_0x4dace3[_0x03d9('0x4a')]=_[_0x03d9('0x47')](_0x20948d[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0xc1e483[_0x03d9('0x45')][_0x03d9('0x49')]));_0x4dace3[_0x03d9('0x4a')]=_0x4dace3['attributes']['length']?_0x4dace3['attributes']:_0x20948d[_0x03d9('0x48')];if(_0xc1e483[_0x03d9('0x45')][_0x03d9('0x54')]){_0x4dace3[_0x03d9('0x5a')]=[{'all':!![]}];}_0x4dace3=_[_0x03d9('0x50')]({},_0x4dace3,_0xc1e483[_0x03d9('0x53')]);return db[_0x03d9('0x3e')][_0x03d9('0x5b')](_0x4dace3)[_0x03d9('0x1f')](handleEntityNotFound(_0x550b39,null))['then'](respondWithResult(_0x550b39,null))[_0x03d9('0x2a')](handleError(_0x550b39,null));};exports[_0x03d9('0x5c')]=function(_0x463498,_0x57cd4a){return db['FaxAccount']['create'](_0x463498['body'],{})[_0x03d9('0x1f')](function(_0x56f04b){var _0x1c20e2=_0x463498[_0x03d9('0x5d')][_0x03d9('0x3a')]({'plain':!![]});if(!_0x1c20e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c20e2[_0x03d9('0x5e')]===_0x03d9('0x5d')){var _0x21f99a=_0x56f04b['get']({'plain':!![]});var _0x22272a=_0x03d9('0x5f');return db['UserProfileSection'][_0x03d9('0x5b')]({'where':{'name':_0x22272a,'userProfileId':_0x1c20e2['userProfileId']},'raw':!![]})[_0x03d9('0x1f')](function(_0x482e36){if(_0x482e36&&_0x482e36[_0x03d9('0x60')]===0x0){return db[_0x03d9('0x3b')][_0x03d9('0x5c')]({'name':_0x21f99a[_0x03d9('0x52')],'resourceId':_0x21f99a['id'],'type':_0x482e36[_0x03d9('0x52')],'sectionId':_0x482e36['id']},{})[_0x03d9('0x1f')](function(){return _0x56f04b;});}else{return _0x56f04b;}})['catch'](function(_0x530dd7){logger['error'](_0x03d9('0x61'),_0x530dd7);throw _0x530dd7;});}return _0x56f04b;})['then'](respondWithResult(_0x57cd4a,0xc9))[_0x03d9('0x2a')](handleError(_0x57cd4a,null));};exports[_0x03d9('0x38')]=function(_0x18cdbb,_0x5a7e33){if(_0x18cdbb[_0x03d9('0x62')]['id']){delete _0x18cdbb['body']['id'];}return db[_0x03d9('0x3e')]['find']({'where':{'id':_0x18cdbb[_0x03d9('0x63')]['id']},'include':[{'model':db[_0x03d9('0x58')],'as':_0x03d9('0x59')}]})['then'](handleEntityNotFound(_0x5a7e33,null))[_0x03d9('0x1f')](saveUpdates(_0x18cdbb[_0x03d9('0x62')],null))[_0x03d9('0x1f')](respondWithResult(_0x5a7e33,null))[_0x03d9('0x2a')](handleError(_0x5a7e33,null));};exports[_0x03d9('0x39')]=function(_0x318191,_0x7bdc61){return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0x318191[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x7bdc61,null))[_0x03d9('0x1f')](removeEntity(_0x7bdc61,null))[_0x03d9('0x2a')](handleError(_0x7bdc61,null));};exports[_0x03d9('0x64')]=function(_0x39e328,_0x19ad24){return db[_0x03d9('0x3e')][_0x03d9('0x64')]()[_0x03d9('0x1f')](respondWithResult(_0x19ad24,null))[_0x03d9('0x2a')](handleError(_0x19ad24,null));};exports[_0x03d9('0x65')]=function(_0x1ee80d,_0x45b88c,_0x2b4bba){if(_0x1ee80d[_0x03d9('0x62')]['id']){delete _0x1ee80d[_0x03d9('0x62')]['id'];}return db[_0x03d9('0x3e')]['find']({'where':{'id':_0x1ee80d[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x45b88c,null))[_0x03d9('0x1f')](function(_0x33e5d1){if(_0x33e5d1){_0x1ee80d['body'][_0x03d9('0x66')]=_0x33e5d1['id'];return db[_0x03d9('0x67')][_0x03d9('0x5c')](_0x1ee80d['body']);}})[_0x03d9('0x1f')](respondWithResult(_0x45b88c,null))[_0x03d9('0x2a')](handleError(_0x45b88c,null));};exports['getDispositions']=function(_0x4070b8,_0x4f6d1c,_0xbc8fd5){var _0x29b3f4={'raw':![],'where':{}};var _0x2079d5={};var _0x10f29a={'count':0x0,'rows':[]};return db['FaxAccount'][_0x03d9('0x68')]({'where':{'id':_0x4070b8['params']['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x4f6d1c,null))['then'](function(_0x88176e){if(_0x88176e){_0x2079d5['model']=_['keys'](db['Disposition'][_0x03d9('0x3f')]);_0x2079d5[_0x03d9('0x45')]=_['keys'](_0x4070b8[_0x03d9('0x45')]);_0x2079d5[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x2079d5['model'],_0x2079d5['query']);_0x29b3f4[_0x03d9('0x4a')]=_[_0x03d9('0x47')](_0x2079d5[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0x4070b8[_0x03d9('0x45')][_0x03d9('0x49')]));_0x29b3f4[_0x03d9('0x4a')]=_0x29b3f4['attributes'][_0x03d9('0x69')]?_0x29b3f4[_0x03d9('0x4a')]:_0x2079d5[_0x03d9('0x48')];if(!_0x4070b8[_0x03d9('0x45')][_0x03d9('0x6a')](_0x03d9('0x6b'))){_0x29b3f4[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x4070b8[_0x03d9('0x45')][_0x03d9('0x30')]);_0x29b3f4['offset']=qs[_0x03d9('0x32')](_0x4070b8[_0x03d9('0x45')][_0x03d9('0x32')]);}_0x29b3f4['order']=qs[_0x03d9('0x4c')](_0x4070b8[_0x03d9('0x45')]['sort']);_0x29b3f4['where']=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x4070b8[_0x03d9('0x45')],_0x2079d5[_0x03d9('0x46')]));_0x29b3f4[_0x03d9('0x4f')][_0x03d9('0x66')]=_0x88176e['id'];if(_0x4070b8[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x29b3f4['where']=_[_0x03d9('0x50')](_0x29b3f4[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x43')](_0x29b3f4[_0x03d9('0x4a')],function(_0x373620){var _0xbebc52={};_0xbebc52[_0x373620]={'$like':'%'+_0x4070b8[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0xbebc52;})});}_0x29b3f4=_[_0x03d9('0x50')]({},_0x29b3f4,_0x4070b8['options']);return db['Disposition'][_0x03d9('0x31')]({'where':_0x29b3f4[_0x03d9('0x4f')]})['then'](function(_0x569186){_0x10f29a['count']=_0x569186;if(_0x4070b8[_0x03d9('0x45')]['includeAll']){_0x29b3f4['include']=[{'all':!![]}];}return db['Disposition'][_0x03d9('0x55')](_0x29b3f4);})[_0x03d9('0x1f')](function(_0x3e4cdc){_0x10f29a[_0x03d9('0x56')]=_0x3e4cdc;return _0x10f29a;});}})[_0x03d9('0x1f')](respondWithFilteredResult(_0x4f6d1c,_0x29b3f4))['catch'](handleError(_0x4f6d1c,null));};exports[_0x03d9('0x6c')]=function(_0xacaf27,_0x1f5713,_0x39eb10){return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0xacaf27['params']['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x1f5713,null))[_0x03d9('0x1f')](function(_0x18ef6f){if(_0x18ef6f){return _0x18ef6f[_0x03d9('0x6c')](_0xacaf27[_0x03d9('0x45')][_0x03d9('0x6d')]);}})['then'](respondWithStatusCode(_0x1f5713,null))[_0x03d9('0x2a')](handleError(_0x1f5713,null));};exports['addAnswer']=function(_0x586217,_0x505b39,_0x4e9efe){if(_0x586217[_0x03d9('0x62')]['id']){delete _0x586217[_0x03d9('0x62')]['id'];}return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0x586217[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x505b39,null))[_0x03d9('0x1f')](function(_0x323c8f){if(_0x323c8f){_0x586217['body'][_0x03d9('0x66')]=_0x323c8f['id'];return db[_0x03d9('0x6e')]['create'](_0x586217[_0x03d9('0x62')]);}})['then'](respondWithResult(_0x505b39,null))[_0x03d9('0x2a')](handleError(_0x505b39,null));};exports[_0x03d9('0x6f')]=function(_0x45fcc2,_0x3cae90,_0x3e5901){var _0x353e34={'raw':![],'where':{}};var _0x5cebdb={};var _0x100954={'count':0x0,'rows':[]};return db[_0x03d9('0x3e')][_0x03d9('0x68')]({'where':{'id':_0x45fcc2[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x3cae90,null))[_0x03d9('0x1f')](function(_0x5f3f4b){if(_0x5f3f4b){_0x5cebdb[_0x03d9('0x48')]=_[_0x03d9('0x44')](db[_0x03d9('0x6e')]['rawAttributes']);_0x5cebdb['query']=_[_0x03d9('0x44')](_0x45fcc2[_0x03d9('0x45')]);_0x5cebdb[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x5cebdb[_0x03d9('0x48')],_0x5cebdb['query']);_0x353e34['attributes']=_[_0x03d9('0x47')](_0x5cebdb[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x49')]));_0x353e34[_0x03d9('0x4a')]=_0x353e34[_0x03d9('0x4a')][_0x03d9('0x69')]?_0x353e34[_0x03d9('0x4a')]:_0x5cebdb[_0x03d9('0x48')];if(!_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x6a')]('nolimit')){_0x353e34[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x30')]);_0x353e34[_0x03d9('0x32')]=qs[_0x03d9('0x32')](_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x32')]);}_0x353e34[_0x03d9('0x4b')]=qs['sort'](_0x45fcc2[_0x03d9('0x45')]['sort']);_0x353e34[_0x03d9('0x4f')]=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x45fcc2[_0x03d9('0x45')],_0x5cebdb[_0x03d9('0x46')]));_0x353e34[_0x03d9('0x4f')]['FaxAccountId']=_0x5f3f4b['id'];if(_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x353e34[_0x03d9('0x4f')]=_[_0x03d9('0x50')](_0x353e34['where'],{'$or':_[_0x03d9('0x43')](_0x353e34['attributes'],function(_0x4e4d2f){var _0x13e1af={};_0x13e1af[_0x4e4d2f]={'$like':'%'+_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0x13e1af;})});}_0x353e34=_[_0x03d9('0x50')]({},_0x353e34,_0x45fcc2[_0x03d9('0x53')]);return db[_0x03d9('0x6e')][_0x03d9('0x31')]({'where':_0x353e34[_0x03d9('0x4f')]})[_0x03d9('0x1f')](function(_0x5555a0){_0x100954[_0x03d9('0x31')]=_0x5555a0;if(_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x54')]){_0x353e34['include']=[{'all':!![]}];}return db[_0x03d9('0x6e')][_0x03d9('0x55')](_0x353e34);})['then'](function(_0x68ea06){_0x100954[_0x03d9('0x56')]=_0x68ea06;return _0x100954;});}})['then'](respondWithFilteredResult(_0x3cae90,_0x353e34))[_0x03d9('0x2a')](handleError(_0x3cae90,null));};exports[_0x03d9('0x70')]=function(_0x317610,_0x2c1735,_0x350632){return db['FaxAccount']['find']({'where':{'id':_0x317610[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x2c1735,null))[_0x03d9('0x1f')](function(_0x3a1dee){if(_0x3a1dee){return _0x3a1dee[_0x03d9('0x70')](_0x317610[_0x03d9('0x45')][_0x03d9('0x6d')]);}})[_0x03d9('0x1f')](respondWithStatusCode(_0x2c1735,null))[_0x03d9('0x2a')](handleError(_0x2c1735,null));};exports[_0x03d9('0x71')]=function(_0x2fbe60,_0x43d754,_0x4c9f82){return db['FaxInteraction'][_0x03d9('0x5b')]({'where':{'id':_0x2fbe60[_0x03d9('0x63')]['id']}})['then'](handleEntityNotFound(_0x43d754,null))['then'](function(_0x4c3b8d){if(_0x4c3b8d){return _0x4c3b8d[_0x03d9('0x71')](_0x2fbe60[_0x03d9('0x62')][_0x03d9('0x6d')],_[_0x03d9('0x72')](_0x2fbe60['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x43d754,null))[_0x03d9('0x2a')](handleError(_0x43d754,null));};exports[_0x03d9('0x73')]=function(_0x90327d,_0x4eb6a5,_0x106509){var _0x5a5a46={'raw':![],'where':{}};var _0x4fb93a={};var _0x487b61={'count':0x0,'rows':[]};return db[_0x03d9('0x3e')]['findOne']({'where':{'id':_0x90327d[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x4eb6a5,null))[_0x03d9('0x1f')](function(_0x485041){if(_0x485041){_0x4fb93a[_0x03d9('0x48')]=_[_0x03d9('0x44')](db['FaxInteraction'][_0x03d9('0x3f')]);_0x4fb93a[_0x03d9('0x45')]=_[_0x03d9('0x44')](_0x90327d[_0x03d9('0x45')]);_0x4fb93a[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x4fb93a[_0x03d9('0x48')],_0x4fb93a['query']);_0x5a5a46['attributes']=_[_0x03d9('0x47')](_0x4fb93a['model'],qs[_0x03d9('0x49')](_0x90327d[_0x03d9('0x45')]['fields']));_0x5a5a46['attributes']=_0x5a5a46[_0x03d9('0x4a')]['length']?_0x5a5a46[_0x03d9('0x4a')]:_0x4fb93a[_0x03d9('0x48')];if(!_0x90327d[_0x03d9('0x45')][_0x03d9('0x6a')]('nolimit')){_0x5a5a46[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x90327d[_0x03d9('0x45')][_0x03d9('0x30')]);_0x5a5a46['offset']=qs[_0x03d9('0x32')](_0x90327d[_0x03d9('0x45')][_0x03d9('0x32')]);}_0x5a5a46[_0x03d9('0x4b')]=qs[_0x03d9('0x4c')](_0x90327d['query'][_0x03d9('0x4c')]);_0x5a5a46[_0x03d9('0x4f')]=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x90327d[_0x03d9('0x45')],_0x4fb93a['filters']));_0x5a5a46['where']['FaxAccountId']=_0x485041['id'];if(_0x90327d['query'][_0x03d9('0x4e')]){_0x5a5a46[_0x03d9('0x4f')]=_['merge'](_0x5a5a46['where'],{'$or':_[_0x03d9('0x43')](_0x5a5a46[_0x03d9('0x4a')],function(_0x52f688){var _0x3168b7={};_0x3168b7[_0x52f688]={'$like':'%'+_0x90327d[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0x3168b7;})});}_0x5a5a46=_[_0x03d9('0x50')]({},_0x5a5a46,_0x90327d[_0x03d9('0x53')]);return db[_0x03d9('0x74')][_0x03d9('0x31')]({'where':_0x5a5a46[_0x03d9('0x4f')]})[_0x03d9('0x1f')](function(_0x131d5d){_0x487b61[_0x03d9('0x31')]=_0x131d5d;if(_0x90327d[_0x03d9('0x45')][_0x03d9('0x54')]){_0x5a5a46[_0x03d9('0x5a')]=[{'model':db[_0x03d9('0x75')],'as':'Contact','required':![]},{'model':db[_0x03d9('0x76')],'as':_0x03d9('0x77'),'attributes':[_0x03d9('0x52'),_0x03d9('0x78'),_0x03d9('0x79')],'required':![]},{'model':db['Tag'],'as':_0x03d9('0x7a'),'attributes':['id','name',_0x03d9('0x7b')],'where':_0x90327d['query']['tag']?{'id':_0x90327d[_0x03d9('0x45')][_0x03d9('0x7c')]}:undefined,'required':_0x90327d[_0x03d9('0x45')][_0x03d9('0x7c')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x5a5a46);})[_0x03d9('0x1f')](function(_0x1d21ee){_0x487b61['rows']=_0x1d21ee;return _0x487b61;});}})[_0x03d9('0x1f')](respondWithFilteredResult(_0x4eb6a5,_0x5a5a46))[_0x03d9('0x2a')](handleError(_0x4eb6a5,null));};exports[_0x03d9('0x7d')]=function(_0x2ec672,_0x2c1ea0){var _0x3f3d42=_0x2ec672[_0x03d9('0x63')]['id'];var _0x285784=_0x2ec672['body'];var _0x140ddb=0xc8;var _0x295631=null;return db[_0x03d9('0x7e')][_0x03d9('0x7f')]({'isolationLevel':db['sequelize'][_0x03d9('0x80')][_0x03d9('0x81')][_0x03d9('0x82')]},function(_0x290f89){return db['FaxAccount'][_0x03d9('0x68')]({'where':{'id':_0x3f3d42},'transaction':_0x290f89})[_0x03d9('0x1f')](function(_0x25a725){if(_0x25a725){return db[_0x03d9('0x83')]['destroy']({'where':{'FaxAccountId':_0x3f3d42},'transaction':_0x290f89})[_0x03d9('0x1f')](function(){var _0x4d4276=_[_0x03d9('0x43')](_0x285784,function(_0x2b5b70){_0x2b5b70[_0x03d9('0x66')]=_0x3f3d42;return _0x2b5b70;});return db[_0x03d9('0x83')][_0x03d9('0x84')](_0x4d4276,{'transaction':_0x290f89});});}else{_0x140ddb=0x194;_0x295631=[];}});})[_0x03d9('0x1f')](function(){if(_0x140ddb!==0x194){return db[_0x03d9('0x83')][_0x03d9('0x85')]({'where':{'FaxAccountId':_0x3f3d42},'order':_0x03d9('0x86')})['then'](function(_0x3a42c5){_0x295631=_0x3a42c5;});}})[_0x03d9('0x2a')](function(_0x3e0d9f){_0x140ddb=0x1f4;logger['error'](_0x3e0d9f[_0x03d9('0x87')]);if(_0x3e0d9f['name']){delete _0x3e0d9f[_0x03d9('0x52')];}_0x295631=_0x3e0d9f;})[_0x03d9('0x88')](function(){if(_0x295631===null){_0x2c1ea0[_0x03d9('0x2b')](_0x140ddb);}else{if(_0x140ddb===0x1f4){_0x2c1ea0[_0x03d9('0x2c')](_0x140ddb)[_0x03d9('0x3c')](_0x295631);}else{_0x2c1ea0[_0x03d9('0x2c')](_0x140ddb)[_0x03d9('0x2e')](_0x295631);}}});};exports[_0x03d9('0x89')]=function(_0x2db705,_0x318c3d,_0x20e1b5){var _0x2c77aa={};var _0x2b31a5={};var _0x59def3;var _0x155fc3;return db[_0x03d9('0x3e')][_0x03d9('0x68')]({'where':{'id':_0x2db705['params']['id']}})['then'](handleEntityNotFound(_0x318c3d,null))['then'](function(_0x390273){if(_0x390273){_0x59def3=_0x390273;_0x2b31a5[_0x03d9('0x48')]=_['keys'](db[_0x03d9('0x83')][_0x03d9('0x3f')]);_0x2b31a5[_0x03d9('0x45')]=_[_0x03d9('0x44')](_0x2db705['query']);_0x2b31a5[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x2b31a5[_0x03d9('0x48')],_0x2b31a5['query']);_0x2c77aa['attributes']=_[_0x03d9('0x47')](_0x2b31a5[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0x2db705['query'][_0x03d9('0x49')]));_0x2c77aa['attributes']=_0x2c77aa[_0x03d9('0x4a')][_0x03d9('0x69')]?_0x2c77aa['attributes']:_0x2b31a5['model'];_0x2c77aa['order']=qs[_0x03d9('0x4c')](_0x2db705[_0x03d9('0x45')][_0x03d9('0x4c')]);_0x2c77aa[_0x03d9('0x4f')]=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x2db705[_0x03d9('0x45')],_0x2b31a5['filters']));if(_0x2db705[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x2c77aa[_0x03d9('0x4f')]=_['merge'](_0x2c77aa[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x43')](_0x2c77aa[_0x03d9('0x4a')],function(_0x175330){var _0xd988aa={};_0xd988aa[_0x175330]={'$like':'%'+_0x2db705['query']['filter']+'%'};return _0xd988aa;})});}_0x2c77aa=_[_0x03d9('0x50')]({},_0x2c77aa,_0x2db705[_0x03d9('0x53')]);return _0x59def3[_0x03d9('0x89')](_0x2c77aa);}})[_0x03d9('0x1f')](function(_0x79687d){if(_0x79687d){_0x155fc3=_0x79687d[_0x03d9('0x69')];if(!_0x2db705[_0x03d9('0x45')]['hasOwnProperty'](_0x03d9('0x6b'))){_0x2c77aa[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x2db705[_0x03d9('0x45')][_0x03d9('0x30')]);_0x2c77aa[_0x03d9('0x32')]=qs['offset'](_0x2db705[_0x03d9('0x45')][_0x03d9('0x32')]);}return _0x59def3['getApplications'](_0x2c77aa);}})['then'](function(_0x4e9e1a){if(_0x4e9e1a){return _0x4e9e1a?{'count':_0x155fc3,'rows':_0x4e9e1a}:null;}})[_0x03d9('0x1f')](respondWithResult(_0x318c3d,null))['catch'](handleError(_0x318c3d,null));};function Extension(_0x4a9eec,_0x5907cd,_0xefe17f,_0x4cad11){this[_0x03d9('0x8a')]=_0x03d9('0x8b');this['exten']=_0x4a9eec[_0x03d9('0x8c')];this['app']=_0x4cad11;this[_0x03d9('0x41')]=_0x03d9('0x8d');this[_0x03d9('0x8e')]=_0x03d9('0x8f');this[_0x03d9('0x66')]=_0x4a9eec['id'];this[_0x03d9('0x86')]=_0x5907cd;this[_0x03d9('0x90')]=_0xefe17f;}function createExtensionsReciveFax(_0x18cb2e){var _0x33eeac=0x1;var _0x594a0b=[];_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,'',_0x03d9('0x92')));_0x33eeac+=0x1;_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,_0x03d9('0x93'),_0x03d9('0x94')));_0x33eeac+=0x1;for(var _0xf11304 in _0x18cb2e){if(_0x18cb2e[_0x03d9('0x6a')](_0xf11304)&&(_0xf11304==='ecm'||_0xf11304===_0x03d9('0x8c')||_0xf11304==='gateway'||_0xf11304===_0x03d9('0x95')||_0xf11304===_0x03d9('0x96')||_0xf11304===_0x03d9('0x97')||_0xf11304===_0x03d9('0x98')||_0xf11304===_0x03d9('0x99')||_0xf11304===_0x03d9('0x9a'))){_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,_0x03d9('0x9b')+_0xf11304+')='+_0x18cb2e[_0xf11304],'Set'));_0x33eeac+=0x1;}}_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,'6',_0x03d9('0x9c')));_0x33eeac+=0x1;_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,_0x03d9('0x9d'),'ReceiveFax'));_0x33eeac=0x0;return _0x594a0b;}exports['addAccountApplications']=function(_0x319f84,_0x29eb3a,_0x2860c3){var _0x183fc5;return db[_0x03d9('0x7e')][_0x03d9('0x7f')](function(_0x51f8d9){return db[_0x03d9('0x3e')]['create'](_0x319f84[_0x03d9('0x62')],{'transaction':_0x51f8d9})[_0x03d9('0x1f')](function(_0x589930){_0x183fc5=_0x589930[_0x03d9('0x3a')]({'plain':!![]});return db[_0x03d9('0x9e')][_0x03d9('0x84')](createExtensionsReciveFax(_0x183fc5),{'transaction':_0x51f8d9});});})[_0x03d9('0x1f')](function(){return _0x183fc5;})[_0x03d9('0x1f')](respondWithResult(_0x29eb3a,null))['catch'](handleError(_0x29eb3a,null));};exports[_0x03d9('0x9f')]=function(_0x1fa161,_0x313ff4,_0x2fdf16){var _0x59f1ef;return db[_0x03d9('0x7e')][_0x03d9('0x7f')](function(_0x119c14){return db[_0x03d9('0x3e')][_0x03d9('0x38')](_0x1fa161[_0x03d9('0x62')],{'where':{'id':_0x1fa161[_0x03d9('0x62')]['id']},'transaction':_0x119c14})['then'](function(_0x4ede97){return db[_0x03d9('0x9e')][_0x03d9('0x39')]({'where':{'FaxAccountId':_0x1fa161[_0x03d9('0x62')]['id']},'transaction':_0x119c14})[_0x03d9('0x1f')](function(_0x189b1e){return db[_0x03d9('0x9e')]['bulkCreate'](createExtensionsReciveFax(_[_0x03d9('0x72')](_0x1fa161[_0x03d9('0x62')],['tech',_0x03d9('0x42'),_0x03d9('0xa0'),_0x03d9('0xa1'),_0x03d9('0xa2'),_0x03d9('0xa3')])),{'transaction':_0x119c14});});});})['then'](function(){return db[_0x03d9('0x3e')][_0x03d9('0xa4')](_0x1fa161[_0x03d9('0x62')]['id']);})[_0x03d9('0x1f')](respondWithResult(_0x313ff4,null))['catch'](handleError(_0x313ff4,null));};exports[_0x03d9('0xa5')]=function(_0x573c8b,_0x17ca0a,_0x34285b){var _0x1fd6f1={'raw':!![],'where':{}};var _0xd652f0={};var _0x281a9e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x573c8b[_0x03d9('0x63')]['id']}})['then'](handleEntityNotFound(_0x17ca0a,null))[_0x03d9('0x1f')](function(_0x4eca4b){if(_0x4eca4b){_0xd652f0[_0x03d9('0x48')]=_[_0x03d9('0x44')](db[_0x03d9('0xa6')][_0x03d9('0x3f')]);_0xd652f0[_0x03d9('0x45')]=_[_0x03d9('0x44')](_0x573c8b['query']);_0xd652f0[_0x03d9('0x46')]=_['intersection'](_0xd652f0[_0x03d9('0x48')],_0xd652f0[_0x03d9('0x45')]);_0x1fd6f1[_0x03d9('0x4a')]=_['intersection'](_0xd652f0[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0x573c8b[_0x03d9('0x45')][_0x03d9('0x49')]));_0x1fd6f1[_0x03d9('0x4a')]=_0x1fd6f1['attributes'][_0x03d9('0x69')]?_0x1fd6f1[_0x03d9('0x4a')]:_0xd652f0[_0x03d9('0x48')];if(!_0x573c8b[_0x03d9('0x45')][_0x03d9('0x6a')](_0x03d9('0x6b'))){_0x1fd6f1[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x573c8b[_0x03d9('0x45')][_0x03d9('0x30')]);_0x1fd6f1['offset']=qs[_0x03d9('0x32')](_0x573c8b[_0x03d9('0x45')]['offset']);}_0x1fd6f1[_0x03d9('0x4b')]=qs[_0x03d9('0x4c')](_0x573c8b[_0x03d9('0x45')][_0x03d9('0x4c')]);_0x1fd6f1[_0x03d9('0x4f')]=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x573c8b['query'],_0xd652f0[_0x03d9('0x46')]));_0x1fd6f1[_0x03d9('0x4f')][_0x03d9('0x66')]=_0x4eca4b['id'];if(_0x573c8b[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x1fd6f1[_0x03d9('0x4f')]=_[_0x03d9('0x50')](_0x1fd6f1['where'],{'$or':_[_0x03d9('0x43')](_0x1fd6f1[_0x03d9('0x4a')],function(_0x3b3d43){var _0x2a7a3d={};_0x2a7a3d[_0x3b3d43]={'$like':'%'+_0x573c8b['query'][_0x03d9('0x4e')]+'%'};return _0x2a7a3d;})});}if(_0x573c8b[_0x03d9('0x45')][_0x03d9('0xa7')]){var _0x84c3f=_0x573c8b[_0x03d9('0x45')][_0x03d9('0xa7')][_0x03d9('0xa8')](',');var _0x4283f0={};_0x4283f0[_0x84c3f[0x0]]={'$gte':moment(_0x84c3f[0x1])[_0x03d9('0xa9')](_0x03d9('0xaa'))};_0x1fd6f1[_0x03d9('0x4f')]=_['merge'](_0x1fd6f1['where'],_0x4283f0);}_0x1fd6f1=_[_0x03d9('0x50')]({},_0x1fd6f1,_0x573c8b[_0x03d9('0x53')]);return db[_0x03d9('0xa6')]['count']({'where':_0x1fd6f1[_0x03d9('0x4f')]})[_0x03d9('0x1f')](function(_0x5f0713){_0x281a9e['count']=_0x5f0713;if(_0x573c8b[_0x03d9('0x45')][_0x03d9('0x54')]){_0x1fd6f1[_0x03d9('0x5a')]=[{'all':!![]}];}return db[_0x03d9('0xa6')][_0x03d9('0x55')](_0x1fd6f1);})[_0x03d9('0x1f')](function(_0x3d2afe){_0x281a9e['rows']=_0x3d2afe;return _0x281a9e;});}})[_0x03d9('0x1f')](respondWithFilteredResult(_0x17ca0a,_0x1fd6f1))[_0x03d9('0x2a')](handleError(_0x17ca0a,null));};exports[_0x03d9('0x3c')]=function(_0x19f498,_0x5987cf,_0x3d0938){var _0x3ea751,_0x6ad030={},_0x4392bc;if(_0x19f498[_0x03d9('0x62')]['to']){_0x4392bc=_0x19f498[_0x03d9('0x62')]['to'][0x0];}return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0x19f498[_0x03d9('0x63')]['id']},'include':[{'model':db['CmList'],'as':_0x03d9('0xab'),'include':[{'model':db[_0x03d9('0x75')],'as':'Contacts','where':{'fax':_0x4392bc},'limit':0x1,'order':[[_0x03d9('0xa1'),_0x03d9('0xac')]]}]}]})['then'](handleEntityNotFound(_0x5987cf,null))[_0x03d9('0x1f')](function(_0x381650){_0x3ea751=_0x381650;if(_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')]&&_0x19f498[_0x03d9('0x62')]['attachments'][_0x03d9('0x69')]){for(var _0x20da7a=0x0;_0x20da7a<_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')]['length'];_0x20da7a+=0x1){_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][_0x20da7a]={'filename':_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][_0x20da7a]['name'],'id':_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][_0x20da7a]['id'],'path':path[_0x03d9('0xae')](config[_0x03d9('0xaf')],_0x03d9('0xb0'),_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][_0x20da7a][_0x03d9('0xb1')])};}}return respondWithRpcPromise(_0x03d9('0xb2'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x19f498['params']['id'])?undefined:_0x19f498[_0x03d9('0x63')]['id'],'path':_['isNil'](_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0][_0x03d9('0x6')])?undefined:_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0]['path'],'fax':_['isNil'](_0x19f498['body']['to'][0x0])?undefined:_0x19f498[_0x03d9('0x62')]['to'][0x0]},client9002);})[_0x03d9('0x1f')](function(){if(_0x3ea751){if(_['isNil'](_0x19f498['body'][_0x03d9('0xb3')])){_0x19f498[_0x03d9('0x62')][_0x03d9('0xb3')]=util[_0x03d9('0xa9')](_0x03d9('0xb4'),_0x3ea751[_0x03d9('0x52')],_0x3ea751['fax']);}if(_0x3ea751[_0x03d9('0xab')]){if(_0x3ea751[_0x03d9('0xab')][_0x03d9('0xb5')][_0x03d9('0x69')]){return _0x3ea751[_0x03d9('0xab')][_0x03d9('0xb5')][0x0];}else{return db[_0x03d9('0x75')][_0x03d9('0x5c')](_[_0x03d9('0xb6')](_0x19f498['body'],{'firstName':_0x19f498[_0x03d9('0x62')]['to'][0x0],'phone':_0x19f498[_0x03d9('0x62')]['to'][0x0],'fax':_0x19f498[_0x03d9('0x62')]['to'][0x0],'ListId':_0x3ea751[_0x03d9('0xa3')]}));}}else{throw new Error(_0x03d9('0xb7'));}}else{throw new Error(_0x03d9('0xb8'));}})[_0x03d9('0x1f')](function(_0x47d5ff){if(_0x47d5ff){return db['FaxInteraction'][_0x03d9('0x5b')]({'where':{'ContactId':_0x47d5ff['id'],'closed':![],'FaxAccountId':_0x3ea751['id']}})['then'](function(_0x5ef07b){if(_0x5ef07b){return[_0x5ef07b,![]];}return db[_0x03d9('0x74')][_0x03d9('0x5c')]({'UserId':_0x19f498[_0x03d9('0x5d')]['id'],'ContactId':_0x47d5ff['id'],'FaxAccountId':_0x3ea751['id'],'fax':_0x19f498[_0x03d9('0x62')]['to'][0x0],'firstMsgDirection':_0x03d9('0xb9'),'Messages':[_[_0x03d9('0x50')](_0x19f498[_0x03d9('0x62')],{'read':![],'body':_0x19f498['body'][_0x03d9('0xad')][0x0]['filename'],'FaxAccountId':_0x3ea751['id'],'UserId':_0x19f498[_0x03d9('0x5d')]['id'],'ContactId':_0x47d5ff['id'],'AttachmentId':_0x19f498[_0x03d9('0x62')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x03d9('0xba')}]})[_0x03d9('0x1f')](function(_0x34f804){return[_0x34f804,!![]];});});}else{throw new Error(_0x03d9('0xbb'));}})[_0x03d9('0xbc')](function(_0x1ba323,_0x59d90f){if(_0x59d90f){return _0x1ba323;}return db[_0x03d9('0xa6')][_0x03d9('0x5c')]({'direction':_0x03d9('0xb9'),'read':![],'body':_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0]['filename'],'FaxAccountId':_0x3ea751['id'],'FaxInteractionId':_0x1ba323['id'],'UserId':_0x19f498[_0x03d9('0x5d')]['id'],'ContactId':_0x1ba323[_0x03d9('0xbd')],'AttachmentId':_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0]['id']})[_0x03d9('0x1f')](function(_0x186a51){_0x1ba323[_0x03d9('0xbe')][_0x03d9('0xba')]=[];_0x1ba323['dataValues'][_0x03d9('0xba')][_0x03d9('0x91')](_0x186a51[_0x03d9('0xbe')]);return _0x1ba323;});})[_0x03d9('0x1f')](function(_0x297d12){respondWithRpcPromise(_0x03d9('0xbf'),_0x03d9('0xbf'),{'FaxAccountId':_[_0x03d9('0xc0')](_0x19f498[_0x03d9('0x63')]['id'])?undefined:_0x19f498[_0x03d9('0x63')]['id'],'path':_[_0x03d9('0xc0')](_0x19f498[_0x03d9('0x62')]['attachments'][0x0][_0x03d9('0x6')])?undefined:_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0]['path'],'fax':_[_0x03d9('0xc0')](_0x19f498['body']['to'][0x0])?undefined:_0x19f498[_0x03d9('0x62')]['to'][0x0],'AttachmentId':_0x19f498['body']['attachments'][0x0]['id']},client9002)['then'](function(_0xcb2428){logger[_0x03d9('0x28')](_0x03d9('0xc1'),_0xcb2428);})[_0x03d9('0x2a')](function(_0x5cadad){logger[_0x03d9('0x28')](_0x03d9('0xc1'),_0x5cadad);});return _0x297d12;})[_0x03d9('0x1f')](respondWithResult(_0x5987cf,null))['catch'](handleError(_0x5987cf,null));};exports['addAgents']=function(_0x5bac79,_0x1b11b9,_0x596414){return db['FaxAccount'][_0x03d9('0x5b')]({'where':{'id':_0x5bac79[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x1b11b9,null))[_0x03d9('0x1f')](function(_0x5612e3){if(_0x5612e3){return _0x5612e3[_0x03d9('0xc2')](_0x5bac79['body']['ids'],_['omit'](_0x5bac79[_0x03d9('0x62')],[_0x03d9('0x6d'),'id'])||{})[_0x03d9('0xbc')](function(_0x43a36a){for(var _0x39ff63=0x0;_0x39ff63<_0x5bac79[_0x03d9('0x62')][_0x03d9('0x6d')]['length'];_0x39ff63+=0x1){socket[_0x03d9('0xc3')]('userFaxAccount:save',{'UserId':Number(_0x5bac79[_0x03d9('0x62')][_0x03d9('0x6d')][_0x39ff63]),'FaxAccountId':Number(_0x5bac79['params']['id'])});}return _0x43a36a;});}})[_0x03d9('0x1f')](respondWithResult(_0x1b11b9,null))[_0x03d9('0x2a')](handleError(_0x1b11b9,null));};exports[_0x03d9('0xc4')]=function(_0x277185,_0x46c9a9,_0xa8dc6c){return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0x277185[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x46c9a9,null))['then'](function(_0x4d5f45){if(_0x4d5f45){return _0x4d5f45[_0x03d9('0xc4')](_0x277185[_0x03d9('0x45')][_0x03d9('0x6d')])[_0x03d9('0x1f')](function(){if(_[_0x03d9('0xc5')](_0x277185[_0x03d9('0x45')]['ids'])){for(var _0x536eca=0x0;_0x536eca<_0x277185[_0x03d9('0x45')]['ids'][_0x03d9('0x69')];_0x536eca+=0x1){socket[_0x03d9('0xc3')](_0x03d9('0xc6'),{'UserId':Number(_0x277185['query'][_0x03d9('0x6d')][_0x536eca]),'FaxAccountId':Number(_0x277185[_0x03d9('0x63')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x277185['query'][_0x03d9('0x6d')]),'FaxAccountId':Number(_0x277185[_0x03d9('0x63')]['id'])});}});}})[_0x03d9('0x1f')](respondWithStatusCode(_0x46c9a9,null))['catch'](handleError(_0x46c9a9,null));};exports['getAgents']=function(_0x4959a2,_0x382cff,_0x434896){var _0xfe6d4c={};var _0x1b2cfb={};var _0x1da6e7;var _0x53ffc3;return db[_0x03d9('0x3e')][_0x03d9('0x68')]({'where':{'id':_0x4959a2[_0x03d9('0x63')]['id']}})['then'](handleEntityNotFound(_0x382cff,null))[_0x03d9('0x1f')](function(_0x238796){if(_0x238796){_0x1da6e7=_0x238796;_0x1b2cfb[_0x03d9('0x48')]=_['keys'](db[_0x03d9('0x76')][_0x03d9('0x3f')]);_0x1b2cfb[_0x03d9('0x45')]=_['keys'](_0x4959a2[_0x03d9('0x45')]);_0x1b2cfb['filters']=_[_0x03d9('0x47')](_0x1b2cfb[_0x03d9('0x48')],_0x1b2cfb[_0x03d9('0x45')]);_0xfe6d4c[_0x03d9('0x4a')]=_['intersection'](_0x1b2cfb[_0x03d9('0x48')],qs['fields'](_0x4959a2[_0x03d9('0x45')][_0x03d9('0x49')]));_0xfe6d4c['attributes']=_0xfe6d4c['attributes'][_0x03d9('0x69')]?_0xfe6d4c[_0x03d9('0x4a')]:_0x1b2cfb[_0x03d9('0x48')];_0xfe6d4c['order']=qs[_0x03d9('0x4c')](_0x4959a2[_0x03d9('0x45')][_0x03d9('0x4c')]);_0xfe6d4c[_0x03d9('0x4f')]=qs['filters'](_[_0x03d9('0x4d')](_0x4959a2[_0x03d9('0x45')],_0x1b2cfb[_0x03d9('0x46')]));if(_0x4959a2[_0x03d9('0x45')][_0x03d9('0x4e')]){_0xfe6d4c[_0x03d9('0x4f')]=_[_0x03d9('0x50')](_0xfe6d4c[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x43')](_0xfe6d4c[_0x03d9('0x4a')],function(_0x5a08b9){var _0x5f2dc6={};_0x5f2dc6[_0x5a08b9]={'$like':'%'+_0x4959a2[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0x5f2dc6;})});}_0xfe6d4c=_[_0x03d9('0x50')]({},_0xfe6d4c,_0x4959a2[_0x03d9('0x53')]);return _0x1da6e7['getAgents'](_0xfe6d4c);}})['then'](function(_0xf85902){if(_0xf85902){_0x53ffc3=_0xf85902[_0x03d9('0x69')];if(!_0x4959a2[_0x03d9('0x45')]['hasOwnProperty'](_0x03d9('0x6b'))){_0xfe6d4c['limit']=qs[_0x03d9('0x30')](_0x4959a2['query'][_0x03d9('0x30')]);_0xfe6d4c[_0x03d9('0x32')]=qs[_0x03d9('0x32')](_0x4959a2[_0x03d9('0x45')]['offset']);}return _0x1da6e7[_0x03d9('0xc7')](_0xfe6d4c);}})['then'](function(_0x2c350d){if(_0x2c350d){return _0x2c350d?{'count':_0x53ffc3,'rows':_0x2c350d}:null;}})['then'](respondWithResult(_0x382cff,null))['catch'](handleError(_0x382cff,null));}; \ No newline at end of file +var _0x7f0d=['Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','rows','show','keys','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','Pause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','params','getAnswers','CannedAnswer','include','removeAnswers','addInteraction','FaxInteraction','getInteractions','findOne','User','Owner','fullname','Tag','Tags','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','updateAccountApplications','VoiceExtension','omit','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','FaxMessage','CmList','CmContact','attachments','join','root','basename','isNil','from','\x22%s\x22\x20<%s>','fax','List','Contacts','List\x20not\x20found','out','Messages'];(function(_0x9d3998,_0x29c38b){var _0x24c9ea=function(_0x5dd3eb){while(--_0x5dd3eb){_0x9d3998['push'](_0x9d3998['shift']());}};_0x24c9ea(++_0x29c38b);}(_0x7f0d,0xdb));var _0xd7f0=function(_0x2bc052,_0x59307a){_0x2bc052=_0x2bc052-0x0;var _0x58baca=_0x7f0d[_0x2bc052];return _0x58baca;};'use strict';var emlformat=require(_0xd7f0('0x0'));var rimraf=require(_0xd7f0('0x1'));var zipdir=require(_0xd7f0('0x2'));var jsonpatch=require(_0xd7f0('0x3'));var rp=require(_0xd7f0('0x4'));var moment=require('moment');var BPromise=require(_0xd7f0('0x5'));var Mustache=require(_0xd7f0('0x6'));var util=require('util');var path=require(_0xd7f0('0x7'));var sox=require(_0xd7f0('0x8'));var csv=require(_0xd7f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd7f0('0xa'));var _=require(_0xd7f0('0xb'));var squel=require(_0xd7f0('0xc'));var crypto=require(_0xd7f0('0xd'));var jsforce=require(_0xd7f0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd7f0('0x9'));var querystring=require(_0xd7f0('0xf'));var Papa=require(_0xd7f0('0x10'));var Redis=require(_0xd7f0('0x11'));var authService=require(_0xd7f0('0x12'));var qs=require(_0xd7f0('0x13'));var as=require(_0xd7f0('0x14'));var hardwareService=require(_0xd7f0('0x15'));var logger=require(_0xd7f0('0x16'))(_0xd7f0('0x17'));var utils=require(_0xd7f0('0x18'));var config=require(_0xd7f0('0x19'));var licenseUtil=require(_0xd7f0('0x1a'));var db=require(_0xd7f0('0x1b'))['db'];config[_0xd7f0('0x1c')]=_[_0xd7f0('0x1d')](config[_0xd7f0('0x1c')],{'host':_0xd7f0('0x1e'),'port':0x18eb});var socket=require(_0xd7f0('0x1f'))(new Redis(config[_0xd7f0('0x1c')]));require(_0xd7f0('0x20'))[_0xd7f0('0x21')](socket);var jayson=require(_0xd7f0('0x22'));var client=jayson[_0xd7f0('0x23')]['http']({'port':0x232c});var client9002=jayson[_0xd7f0('0x23')][_0xd7f0('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x18c2c4,_0x1dcce3,_0x5f00cb,_0x3e7a28){return new BPromise(function(_0x185f52,_0x2cdf8d){var _0x4fc1d4=_0x3e7a28||client;return _0x4fc1d4[_0xd7f0('0x25')](_0x18c2c4,_0x5f00cb)[_0xd7f0('0x26')](function(_0x3c80ed){logger[_0xd7f0('0x27')](_0xd7f0('0x28'),_0x1dcce3,_0xd7f0('0x29'));logger[_0xd7f0('0x2a')](_0xd7f0('0x2b'),_0x1dcce3,'request\x20sent',JSON[_0xd7f0('0x2c')](_0x3c80ed));if(_0x3c80ed[_0xd7f0('0x2d')]){if(_0x3c80ed[_0xd7f0('0x2d')][_0xd7f0('0x2e')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1dcce3,_0x3c80ed['error'][_0xd7f0('0x2f')]);return _0x2cdf8d(_0x3c80ed[_0xd7f0('0x2d')]['message']);}logger[_0xd7f0('0x2d')](_0xd7f0('0x28'),_0x1dcce3,_0x3c80ed['error']['message']);return _0x185f52(_0x3c80ed[_0xd7f0('0x2d')][_0xd7f0('0x2f')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1dcce3,_0xd7f0('0x29'));_0x185f52(_0x3c80ed['result'][_0xd7f0('0x2f')]);}})[_0xd7f0('0x30')](function(_0x5d8799){logger[_0xd7f0('0x2d')](_0xd7f0('0x28'),_0x1dcce3,_0x5d8799);_0x2cdf8d(_0x5d8799);});});}function respondWithStatusCode(_0xb336aa,_0x748569){_0x748569=_0x748569||0xcc;return function(_0x38c2fd){if(_0x38c2fd){return _0xb336aa[_0xd7f0('0x31')](_0x748569);}return _0xb336aa[_0xd7f0('0x32')](_0x748569)[_0xd7f0('0x33')]();};}function respondWithResult(_0x1b7872,_0x358986){_0x358986=_0x358986||0xc8;return function(_0x3a0d02){if(_0x3a0d02){return _0x1b7872['status'](_0x358986)[_0xd7f0('0x34')](_0x3a0d02);}};}function respondWithFilteredResult(_0x454484,_0x10719a){return function(_0x2907cb){if(_0x2907cb){var _0xc7565b=typeof _0x10719a[_0xd7f0('0x35')]===_0xd7f0('0x36')&&typeof _0x10719a['limit']===_0xd7f0('0x36');var _0x12c629=_0x2907cb[_0xd7f0('0x37')];var _0x486b18=_0xc7565b?0x0:_0x10719a[_0xd7f0('0x35')];var _0x192149=_0xc7565b?_0x2907cb[_0xd7f0('0x37')]:_0x10719a[_0xd7f0('0x35')]+_0x10719a[_0xd7f0('0x38')];var _0x1fd145;if(_0x192149>=_0x12c629){_0x192149=_0x12c629;_0x1fd145=0xc8;}else{_0x1fd145=0xce;}_0x454484[_0xd7f0('0x32')](_0x1fd145);return _0x454484['set'](_0xd7f0('0x39'),_0x486b18+'-'+_0x192149+'/'+_0x12c629)[_0xd7f0('0x34')](_0x2907cb);}return null;};}function patchUpdates(_0x552e8a){return function(_0x206893){try{jsonpatch[_0xd7f0('0x3a')](_0x206893,_0x552e8a,!![]);}catch(_0x2ea5bf){return BPromise[_0xd7f0('0x3b')](_0x2ea5bf);}return _0x206893['save']();};}function saveUpdates(_0x501a33,_0x42d077){return function(_0x59fad1){if(_0x59fad1){return _0x59fad1[_0xd7f0('0x3c')](_0x501a33)[_0xd7f0('0x26')](function(_0x33c08f){return _0x33c08f;});}return null;};}function removeEntity(_0x3b0c23,_0x49e2fe){return function(_0x572d20){if(_0x572d20){return _0x572d20[_0xd7f0('0x3d')]()['then'](function(){var _0x143bb1=_0x572d20[_0xd7f0('0x3e')]({'plain':!![]});var _0x521b89=_0xd7f0('0x3f');return db[_0xd7f0('0x40')][_0xd7f0('0x3d')]({'where':{'type':_0x521b89,'resourceId':_0x143bb1['id']}})[_0xd7f0('0x26')](function(){return _0x572d20;});})[_0xd7f0('0x26')](function(){_0x3b0c23[_0xd7f0('0x32')](0xcc)[_0xd7f0('0x33')]();});}};}function handleEntityNotFound(_0x27d3b2,_0x34abb0){return function(_0x113a5a){if(!_0x113a5a){_0x27d3b2[_0xd7f0('0x31')](0x194);}return _0x113a5a;};}function handleError(_0x1c5879,_0x306f87){_0x306f87=_0x306f87||0x1f4;return function(_0x5f0150){logger[_0xd7f0('0x2d')](_0x5f0150[_0xd7f0('0x41')]);if(_0x5f0150[_0xd7f0('0x42')]){delete _0x5f0150['name'];}_0x1c5879[_0xd7f0('0x32')](_0x306f87)[_0xd7f0('0x43')](_0x5f0150);};}exports[_0xd7f0('0x44')]=function(_0x31121a,_0x527736){var _0x50da9f={'include':[{'model':db['Pause'],'as':_0xd7f0('0x45')}]},_0x4b1491={},_0x28cef0={'count':0x0,'rows':[]};var _0x268b90=_[_0xd7f0('0x46')](db['FaxAccount'][_0xd7f0('0x47')],function(_0x5ca1e9){return{'name':_0x5ca1e9[_0xd7f0('0x48')],'type':_0x5ca1e9[_0xd7f0('0x49')]['key']};});_0x4b1491[_0xd7f0('0x4a')]=_['map'](_0x268b90,_0xd7f0('0x42'));_0x4b1491['query']=_['keys'](_0x31121a['query']);_0x4b1491[_0xd7f0('0x4b')]=_[_0xd7f0('0x4c')](_0x4b1491[_0xd7f0('0x4a')],_0x4b1491['query']);_0x50da9f[_0xd7f0('0x4d')]=_[_0xd7f0('0x4c')](_0x4b1491[_0xd7f0('0x4a')],qs['fields'](_0x31121a[_0xd7f0('0x4e')][_0xd7f0('0x4f')]));_0x50da9f[_0xd7f0('0x4d')]=_0x50da9f[_0xd7f0('0x4d')][_0xd7f0('0x50')]?_0x50da9f['attributes']:_0x4b1491['model'];if(!_0x31121a[_0xd7f0('0x4e')][_0xd7f0('0x51')](_0xd7f0('0x52'))){_0x50da9f['limit']=qs[_0xd7f0('0x38')](_0x31121a[_0xd7f0('0x4e')][_0xd7f0('0x38')]);_0x50da9f[_0xd7f0('0x35')]=qs[_0xd7f0('0x35')](_0x31121a[_0xd7f0('0x4e')][_0xd7f0('0x35')]);}_0x50da9f[_0xd7f0('0x53')]=qs['sort'](_0x31121a['query'][_0xd7f0('0x54')]);_0x50da9f[_0xd7f0('0x55')]=qs[_0xd7f0('0x4b')](_[_0xd7f0('0x56')](_0x31121a[_0xd7f0('0x4e')],_0x4b1491[_0xd7f0('0x4b')]),_0x268b90);if(_0x31121a[_0xd7f0('0x4e')][_0xd7f0('0x57')]){_0x50da9f[_0xd7f0('0x55')]=_[_0xd7f0('0x58')](_0x50da9f[_0xd7f0('0x55')],{'$or':_[_0xd7f0('0x46')](_0x268b90,function(_0x1899f3){if(_0x1899f3[_0xd7f0('0x49')]!==_0xd7f0('0x59')){var _0x4949fc={};_0x4949fc[_0x1899f3['name']]={'$like':'%'+_0x31121a[_0xd7f0('0x4e')]['filter']+'%'};return _0x4949fc;}})});}_0x50da9f=_[_0xd7f0('0x58')]({},_0x50da9f,_0x31121a[_0xd7f0('0x5a')]);var _0xdb6581={'where':_0x50da9f['where']};return db[_0xd7f0('0x5b')]['count'](_0xdb6581)[_0xd7f0('0x26')](function(_0xd7cbd7){_0x28cef0[_0xd7f0('0x37')]=_0xd7cbd7;if(_0x31121a[_0xd7f0('0x4e')][_0xd7f0('0x5c')]){_0x50da9f['include']=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x50da9f);})[_0xd7f0('0x26')](function(_0xf37771){_0x28cef0[_0xd7f0('0x5d')]=_0xf37771;return _0x28cef0;})['then'](respondWithFilteredResult(_0x527736,_0x50da9f))[_0xd7f0('0x30')](handleError(_0x527736,null));};exports[_0xd7f0('0x5e')]=function(_0x5293c5,_0x4f575f){var _0x3bc263={'raw':![],'where':{'id':_0x5293c5['params']['id']},'include':[{'model':db['Pause'],'as':_0xd7f0('0x45')}]},_0x342ceb={};_0x342ceb['model']=_[_0xd7f0('0x5f')](db['FaxAccount'][_0xd7f0('0x47')]);_0x342ceb[_0xd7f0('0x4e')]=_[_0xd7f0('0x5f')](_0x5293c5['query']);_0x342ceb[_0xd7f0('0x4b')]=_[_0xd7f0('0x4c')](_0x342ceb['model'],_0x342ceb[_0xd7f0('0x4e')]);_0x3bc263[_0xd7f0('0x4d')]=_[_0xd7f0('0x4c')](_0x342ceb[_0xd7f0('0x4a')],qs['fields'](_0x5293c5[_0xd7f0('0x4e')][_0xd7f0('0x4f')]));_0x3bc263[_0xd7f0('0x4d')]=_0x3bc263['attributes'][_0xd7f0('0x50')]?_0x3bc263[_0xd7f0('0x4d')]:_0x342ceb[_0xd7f0('0x4a')];if(_0x5293c5[_0xd7f0('0x4e')]['includeAll']){_0x3bc263['include']=[{'all':!![]}];}_0x3bc263=_[_0xd7f0('0x58')]({},_0x3bc263,_0x5293c5[_0xd7f0('0x5a')]);return db[_0xd7f0('0x5b')][_0xd7f0('0x60')](_0x3bc263)[_0xd7f0('0x26')](handleEntityNotFound(_0x4f575f,null))[_0xd7f0('0x26')](respondWithResult(_0x4f575f,null))[_0xd7f0('0x30')](handleError(_0x4f575f,null));};exports['create']=function(_0x5baed7,_0x25cdf4){return db[_0xd7f0('0x5b')][_0xd7f0('0x61')](_0x5baed7[_0xd7f0('0x62')],{})[_0xd7f0('0x26')](function(_0x1e71bc){var _0x132985=_0x5baed7[_0xd7f0('0x63')][_0xd7f0('0x3e')]({'plain':!![]});if(!_0x132985)throw new Error(_0xd7f0('0x64'));if(_0x132985[_0xd7f0('0x65')]===_0xd7f0('0x63')){var _0xe51512=_0x1e71bc[_0xd7f0('0x3e')]({'plain':!![]});var _0x55787f=_0xd7f0('0x3f');return db[_0xd7f0('0x66')]['find']({'where':{'name':_0x55787f,'userProfileId':_0x132985[_0xd7f0('0x67')]},'raw':!![]})['then'](function(_0x286b6a){if(_0x286b6a&&_0x286b6a[_0xd7f0('0x68')]===0x0){return db[_0xd7f0('0x40')][_0xd7f0('0x61')]({'name':_0xe51512[_0xd7f0('0x42')],'resourceId':_0xe51512['id'],'type':_0x286b6a[_0xd7f0('0x42')],'sectionId':_0x286b6a['id']},{})[_0xd7f0('0x26')](function(){return _0x1e71bc;});}else{return _0x1e71bc;}})[_0xd7f0('0x30')](function(_0x1b7e15){logger[_0xd7f0('0x2d')](_0xd7f0('0x69'),_0x1b7e15);throw _0x1b7e15;});}return _0x1e71bc;})[_0xd7f0('0x26')](respondWithResult(_0x25cdf4,0xc9))[_0xd7f0('0x30')](handleError(_0x25cdf4,null));};exports[_0xd7f0('0x3c')]=function(_0x514be0,_0x3cef7f){if(_0x514be0[_0xd7f0('0x62')]['id']){delete _0x514be0[_0xd7f0('0x62')]['id'];}return db[_0xd7f0('0x5b')][_0xd7f0('0x60')]({'where':{'id':_0x514be0['params']['id']},'include':[{'model':db[_0xd7f0('0x6a')],'as':_0xd7f0('0x45')}]})[_0xd7f0('0x26')](handleEntityNotFound(_0x3cef7f,null))['then'](saveUpdates(_0x514be0['body'],null))[_0xd7f0('0x26')](respondWithResult(_0x3cef7f,null))[_0xd7f0('0x30')](handleError(_0x3cef7f,null));};exports[_0xd7f0('0x3d')]=function(_0x3ac582,_0x488c8c){return db[_0xd7f0('0x5b')]['find']({'where':{'id':_0x3ac582['params']['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x488c8c,null))[_0xd7f0('0x26')](removeEntity(_0x488c8c,null))[_0xd7f0('0x30')](handleError(_0x488c8c,null));};exports[_0xd7f0('0x6b')]=function(_0x414fb3,_0x395de6){return db[_0xd7f0('0x5b')][_0xd7f0('0x6b')]()['then'](respondWithResult(_0x395de6,null))['catch'](handleError(_0x395de6,null));};exports[_0xd7f0('0x6c')]=function(_0x57fb06,_0x1ff02b,_0x47f8bc){if(_0x57fb06['body']['id']){delete _0x57fb06[_0xd7f0('0x62')]['id'];}return db[_0xd7f0('0x5b')][_0xd7f0('0x60')]({'where':{'id':_0x57fb06['params']['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x1ff02b,null))[_0xd7f0('0x26')](function(_0x51f00c){if(_0x51f00c){_0x57fb06[_0xd7f0('0x62')][_0xd7f0('0x6d')]=_0x51f00c['id'];return db[_0xd7f0('0x6e')][_0xd7f0('0x61')](_0x57fb06['body']);}})[_0xd7f0('0x26')](respondWithResult(_0x1ff02b,null))[_0xd7f0('0x30')](handleError(_0x1ff02b,null));};exports[_0xd7f0('0x6f')]=function(_0x4a1513,_0x47c33e,_0x5428b3){var _0x3547bb={'raw':![],'where':{}};var _0x3df5f2={};var _0xcf6727={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4a1513['params']['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x47c33e,null))[_0xd7f0('0x26')](function(_0x51d23f){if(_0x51d23f){_0x3df5f2[_0xd7f0('0x4a')]=_[_0xd7f0('0x5f')](db[_0xd7f0('0x6e')][_0xd7f0('0x47')]);_0x3df5f2['query']=_['keys'](_0x4a1513[_0xd7f0('0x4e')]);_0x3df5f2[_0xd7f0('0x4b')]=_['intersection'](_0x3df5f2['model'],_0x3df5f2[_0xd7f0('0x4e')]);_0x3547bb[_0xd7f0('0x4d')]=_[_0xd7f0('0x4c')](_0x3df5f2[_0xd7f0('0x4a')],qs[_0xd7f0('0x4f')](_0x4a1513[_0xd7f0('0x4e')]['fields']));_0x3547bb[_0xd7f0('0x4d')]=_0x3547bb['attributes']['length']?_0x3547bb['attributes']:_0x3df5f2[_0xd7f0('0x4a')];if(!_0x4a1513['query']['hasOwnProperty'](_0xd7f0('0x52'))){_0x3547bb[_0xd7f0('0x38')]=qs[_0xd7f0('0x38')](_0x4a1513[_0xd7f0('0x4e')][_0xd7f0('0x38')]);_0x3547bb['offset']=qs['offset'](_0x4a1513[_0xd7f0('0x4e')][_0xd7f0('0x35')]);}_0x3547bb['order']=qs[_0xd7f0('0x54')](_0x4a1513[_0xd7f0('0x4e')]['sort']);_0x3547bb[_0xd7f0('0x55')]=qs[_0xd7f0('0x4b')](_[_0xd7f0('0x56')](_0x4a1513[_0xd7f0('0x4e')],_0x3df5f2[_0xd7f0('0x4b')]));_0x3547bb[_0xd7f0('0x55')][_0xd7f0('0x6d')]=_0x51d23f['id'];if(_0x4a1513[_0xd7f0('0x4e')][_0xd7f0('0x57')]){_0x3547bb[_0xd7f0('0x55')]=_['merge'](_0x3547bb['where'],{'$or':_[_0xd7f0('0x46')](_0x3547bb[_0xd7f0('0x4d')],function(_0x486923){var _0x4a24f9={};_0x4a24f9[_0x486923]={'$like':'%'+_0x4a1513[_0xd7f0('0x4e')][_0xd7f0('0x57')]+'%'};return _0x4a24f9;})});}_0x3547bb=_[_0xd7f0('0x58')]({},_0x3547bb,_0x4a1513[_0xd7f0('0x5a')]);return db[_0xd7f0('0x6e')][_0xd7f0('0x37')]({'where':_0x3547bb[_0xd7f0('0x55')]})[_0xd7f0('0x26')](function(_0x5c76aa){_0xcf6727[_0xd7f0('0x37')]=_0x5c76aa;if(_0x4a1513['query'][_0xd7f0('0x5c')]){_0x3547bb['include']=[{'all':!![]}];}return db[_0xd7f0('0x6e')][_0xd7f0('0x70')](_0x3547bb);})['then'](function(_0x31dfaf){_0xcf6727[_0xd7f0('0x5d')]=_0x31dfaf;return _0xcf6727;});}})['then'](respondWithFilteredResult(_0x47c33e,_0x3547bb))[_0xd7f0('0x30')](handleError(_0x47c33e,null));};exports[_0xd7f0('0x71')]=function(_0x74fc3b,_0x4e901e,_0x402062){return db['FaxAccount']['find']({'where':{'id':_0x74fc3b['params']['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x4e901e,null))[_0xd7f0('0x26')](function(_0x52ad91){if(_0x52ad91){return _0x52ad91[_0xd7f0('0x71')](_0x74fc3b[_0xd7f0('0x4e')][_0xd7f0('0x72')]);}})[_0xd7f0('0x26')](respondWithStatusCode(_0x4e901e,null))[_0xd7f0('0x30')](handleError(_0x4e901e,null));};exports[_0xd7f0('0x73')]=function(_0x933c2e,_0x93ad77,_0x127633){if(_0x933c2e[_0xd7f0('0x62')]['id']){delete _0x933c2e[_0xd7f0('0x62')]['id'];}return db['FaxAccount'][_0xd7f0('0x60')]({'where':{'id':_0x933c2e[_0xd7f0('0x74')]['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x93ad77,null))[_0xd7f0('0x26')](function(_0x58abf3){if(_0x58abf3){_0x933c2e['body'][_0xd7f0('0x6d')]=_0x58abf3['id'];return db['CannedAnswer']['create'](_0x933c2e[_0xd7f0('0x62')]);}})[_0xd7f0('0x26')](respondWithResult(_0x93ad77,null))['catch'](handleError(_0x93ad77,null));};exports[_0xd7f0('0x75')]=function(_0x91d5bd,_0x18071b,_0x572fb9){var _0x1c3cfe={'raw':![],'where':{}};var _0x434a5f={};var _0x2663ea={'count':0x0,'rows':[]};return db[_0xd7f0('0x5b')]['findOne']({'where':{'id':_0x91d5bd['params']['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x18071b,null))[_0xd7f0('0x26')](function(_0x26c65d){if(_0x26c65d){_0x434a5f[_0xd7f0('0x4a')]=_[_0xd7f0('0x5f')](db[_0xd7f0('0x76')]['rawAttributes']);_0x434a5f[_0xd7f0('0x4e')]=_[_0xd7f0('0x5f')](_0x91d5bd[_0xd7f0('0x4e')]);_0x434a5f[_0xd7f0('0x4b')]=_[_0xd7f0('0x4c')](_0x434a5f[_0xd7f0('0x4a')],_0x434a5f[_0xd7f0('0x4e')]);_0x1c3cfe[_0xd7f0('0x4d')]=_[_0xd7f0('0x4c')](_0x434a5f[_0xd7f0('0x4a')],qs[_0xd7f0('0x4f')](_0x91d5bd['query'][_0xd7f0('0x4f')]));_0x1c3cfe['attributes']=_0x1c3cfe[_0xd7f0('0x4d')][_0xd7f0('0x50')]?_0x1c3cfe[_0xd7f0('0x4d')]:_0x434a5f['model'];if(!_0x91d5bd[_0xd7f0('0x4e')]['hasOwnProperty'](_0xd7f0('0x52'))){_0x1c3cfe['limit']=qs['limit'](_0x91d5bd[_0xd7f0('0x4e')]['limit']);_0x1c3cfe[_0xd7f0('0x35')]=qs[_0xd7f0('0x35')](_0x91d5bd[_0xd7f0('0x4e')][_0xd7f0('0x35')]);}_0x1c3cfe[_0xd7f0('0x53')]=qs[_0xd7f0('0x54')](_0x91d5bd[_0xd7f0('0x4e')][_0xd7f0('0x54')]);_0x1c3cfe[_0xd7f0('0x55')]=qs[_0xd7f0('0x4b')](_[_0xd7f0('0x56')](_0x91d5bd['query'],_0x434a5f[_0xd7f0('0x4b')]));_0x1c3cfe[_0xd7f0('0x55')][_0xd7f0('0x6d')]=_0x26c65d['id'];if(_0x91d5bd['query']['filter']){_0x1c3cfe[_0xd7f0('0x55')]=_['merge'](_0x1c3cfe[_0xd7f0('0x55')],{'$or':_[_0xd7f0('0x46')](_0x1c3cfe[_0xd7f0('0x4d')],function(_0x3de20a){var _0x4ab30c={};_0x4ab30c[_0x3de20a]={'$like':'%'+_0x91d5bd['query'][_0xd7f0('0x57')]+'%'};return _0x4ab30c;})});}_0x1c3cfe=_[_0xd7f0('0x58')]({},_0x1c3cfe,_0x91d5bd['options']);return db[_0xd7f0('0x76')]['count']({'where':_0x1c3cfe[_0xd7f0('0x55')]})['then'](function(_0x34ecf1){_0x2663ea[_0xd7f0('0x37')]=_0x34ecf1;if(_0x91d5bd[_0xd7f0('0x4e')][_0xd7f0('0x5c')]){_0x1c3cfe[_0xd7f0('0x77')]=[{'all':!![]}];}return db[_0xd7f0('0x76')][_0xd7f0('0x70')](_0x1c3cfe);})[_0xd7f0('0x26')](function(_0x23ffb8){_0x2663ea[_0xd7f0('0x5d')]=_0x23ffb8;return _0x2663ea;});}})[_0xd7f0('0x26')](respondWithFilteredResult(_0x18071b,_0x1c3cfe))['catch'](handleError(_0x18071b,null));};exports['removeAnswers']=function(_0x496e98,_0x4220b3,_0x180676){return db[_0xd7f0('0x5b')][_0xd7f0('0x60')]({'where':{'id':_0x496e98[_0xd7f0('0x74')]['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x4220b3,null))[_0xd7f0('0x26')](function(_0xc2063){if(_0xc2063){return _0xc2063[_0xd7f0('0x78')](_0x496e98[_0xd7f0('0x4e')][_0xd7f0('0x72')]);}})[_0xd7f0('0x26')](respondWithStatusCode(_0x4220b3,null))['catch'](handleError(_0x4220b3,null));};exports[_0xd7f0('0x79')]=function(_0x2c2a57,_0x2aeeb4,_0x520a9a){return db[_0xd7f0('0x7a')][_0xd7f0('0x60')]({'where':{'id':_0x2c2a57[_0xd7f0('0x74')]['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x2aeeb4,null))['then'](function(_0x125f83){if(_0x125f83){return _0x125f83['addInteraction'](_0x2c2a57[_0xd7f0('0x62')][_0xd7f0('0x72')],_['omit'](_0x2c2a57[_0xd7f0('0x62')],[_0xd7f0('0x72'),'id'])||{});}})[_0xd7f0('0x26')](respondWithResult(_0x2aeeb4,null))[_0xd7f0('0x30')](handleError(_0x2aeeb4,null));};exports[_0xd7f0('0x7b')]=function(_0x16bd0c,_0x5dc960,_0x34aa8f){var _0x48a889={'raw':![],'where':{}};var _0x587d56={};var _0x2c9801={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd7f0('0x7c')]({'where':{'id':_0x16bd0c['params']['id']}})['then'](handleEntityNotFound(_0x5dc960,null))['then'](function(_0x53be72){if(_0x53be72){_0x587d56[_0xd7f0('0x4a')]=_['keys'](db[_0xd7f0('0x7a')][_0xd7f0('0x47')]);_0x587d56[_0xd7f0('0x4e')]=_['keys'](_0x16bd0c[_0xd7f0('0x4e')]);_0x587d56[_0xd7f0('0x4b')]=_[_0xd7f0('0x4c')](_0x587d56[_0xd7f0('0x4a')],_0x587d56[_0xd7f0('0x4e')]);_0x48a889[_0xd7f0('0x4d')]=_[_0xd7f0('0x4c')](_0x587d56[_0xd7f0('0x4a')],qs[_0xd7f0('0x4f')](_0x16bd0c[_0xd7f0('0x4e')]['fields']));_0x48a889[_0xd7f0('0x4d')]=_0x48a889[_0xd7f0('0x4d')][_0xd7f0('0x50')]?_0x48a889['attributes']:_0x587d56[_0xd7f0('0x4a')];if(!_0x16bd0c[_0xd7f0('0x4e')][_0xd7f0('0x51')](_0xd7f0('0x52'))){_0x48a889[_0xd7f0('0x38')]=qs[_0xd7f0('0x38')](_0x16bd0c[_0xd7f0('0x4e')][_0xd7f0('0x38')]);_0x48a889[_0xd7f0('0x35')]=qs[_0xd7f0('0x35')](_0x16bd0c[_0xd7f0('0x4e')][_0xd7f0('0x35')]);}_0x48a889[_0xd7f0('0x53')]=qs[_0xd7f0('0x54')](_0x16bd0c[_0xd7f0('0x4e')][_0xd7f0('0x54')]);_0x48a889[_0xd7f0('0x55')]=qs[_0xd7f0('0x4b')](_[_0xd7f0('0x56')](_0x16bd0c[_0xd7f0('0x4e')],_0x587d56[_0xd7f0('0x4b')]));_0x48a889[_0xd7f0('0x55')][_0xd7f0('0x6d')]=_0x53be72['id'];if(_0x16bd0c['query'][_0xd7f0('0x57')]){_0x48a889[_0xd7f0('0x55')]=_[_0xd7f0('0x58')](_0x48a889[_0xd7f0('0x55')],{'$or':_[_0xd7f0('0x46')](_0x48a889[_0xd7f0('0x4d')],function(_0x346caf){var _0x16ba51={};_0x16ba51[_0x346caf]={'$like':'%'+_0x16bd0c[_0xd7f0('0x4e')][_0xd7f0('0x57')]+'%'};return _0x16ba51;})});}_0x48a889=_['merge']({},_0x48a889,_0x16bd0c['options']);return db['FaxInteraction']['count']({'where':_0x48a889['where']})['then'](function(_0x59e639){_0x2c9801[_0xd7f0('0x37')]=_0x59e639;if(_0x16bd0c[_0xd7f0('0x4e')][_0xd7f0('0x5c')]){_0x48a889[_0xd7f0('0x77')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xd7f0('0x7d')],'as':_0xd7f0('0x7e'),'attributes':[_0xd7f0('0x42'),_0xd7f0('0x7f'),'internal'],'required':![]},{'model':db[_0xd7f0('0x80')],'as':_0xd7f0('0x81'),'attributes':['id',_0xd7f0('0x42'),'color'],'where':_0x16bd0c[_0xd7f0('0x4e')][_0xd7f0('0x82')]?{'id':_0x16bd0c['query'][_0xd7f0('0x82')]}:undefined,'required':_0x16bd0c[_0xd7f0('0x4e')][_0xd7f0('0x82')]?!![]:![]}];}return db[_0xd7f0('0x7a')][_0xd7f0('0x70')](_0x48a889);})[_0xd7f0('0x26')](function(_0x1dd971){_0x2c9801[_0xd7f0('0x5d')]=_0x1dd971;return _0x2c9801;});}})['then'](respondWithFilteredResult(_0x5dc960,_0x48a889))['catch'](handleError(_0x5dc960,null));};exports[_0xd7f0('0x83')]=function(_0x9d72e2,_0x27f317){var _0x4b4f18=_0x9d72e2['params']['id'];var _0x26a990=_0x9d72e2[_0xd7f0('0x62')];var _0x5780a6=0xc8;var _0x3082e0=null;return db['sequelize'][_0xd7f0('0x84')]({'isolationLevel':db[_0xd7f0('0x85')][_0xd7f0('0x86')][_0xd7f0('0x87')][_0xd7f0('0x88')]},function(_0x45bcf6){return db['FaxAccount'][_0xd7f0('0x7c')]({'where':{'id':_0x4b4f18},'transaction':_0x45bcf6})['then'](function(_0x37ccbe){if(_0x37ccbe){return db[_0xd7f0('0x89')][_0xd7f0('0x3d')]({'where':{'FaxAccountId':_0x4b4f18},'transaction':_0x45bcf6})[_0xd7f0('0x26')](function(){var _0x296f76=_['map'](_0x26a990,function(_0x36d4ea){_0x36d4ea[_0xd7f0('0x6d')]=_0x4b4f18;return _0x36d4ea;});return db['FaxApplication'][_0xd7f0('0x8a')](_0x296f76,{'transaction':_0x45bcf6});});}else{_0x5780a6=0x194;_0x3082e0=[];}});})[_0xd7f0('0x26')](function(){if(_0x5780a6!==0x194){return db[_0xd7f0('0x89')][_0xd7f0('0x8b')]({'where':{'FaxAccountId':_0x4b4f18},'order':_0xd7f0('0x8c')})[_0xd7f0('0x26')](function(_0x12bae3){_0x3082e0=_0x12bae3;});}})[_0xd7f0('0x30')](function(_0x47dccf){_0x5780a6=0x1f4;logger[_0xd7f0('0x2d')](_0x47dccf[_0xd7f0('0x41')]);if(_0x47dccf[_0xd7f0('0x42')]){delete _0x47dccf['name'];}_0x3082e0=_0x47dccf;})['finally'](function(){if(_0x3082e0===null){_0x27f317[_0xd7f0('0x31')](_0x5780a6);}else{if(_0x5780a6===0x1f4){_0x27f317['status'](_0x5780a6)[_0xd7f0('0x43')](_0x3082e0);}else{_0x27f317[_0xd7f0('0x32')](_0x5780a6)['json'](_0x3082e0);}}});};exports[_0xd7f0('0x8d')]=function(_0x467d4e,_0x2d89c9,_0x18ac47){var _0x3ec550={};var _0x5de41c={};var _0xc724a4;var _0x5a12f0;return db[_0xd7f0('0x5b')]['findOne']({'where':{'id':_0x467d4e[_0xd7f0('0x74')]['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x2d89c9,null))[_0xd7f0('0x26')](function(_0x5ca844){if(_0x5ca844){_0xc724a4=_0x5ca844;_0x5de41c[_0xd7f0('0x4a')]=_[_0xd7f0('0x5f')](db['FaxApplication'][_0xd7f0('0x47')]);_0x5de41c[_0xd7f0('0x4e')]=_[_0xd7f0('0x5f')](_0x467d4e[_0xd7f0('0x4e')]);_0x5de41c['filters']=_[_0xd7f0('0x4c')](_0x5de41c[_0xd7f0('0x4a')],_0x5de41c[_0xd7f0('0x4e')]);_0x3ec550[_0xd7f0('0x4d')]=_['intersection'](_0x5de41c[_0xd7f0('0x4a')],qs['fields'](_0x467d4e[_0xd7f0('0x4e')]['fields']));_0x3ec550[_0xd7f0('0x4d')]=_0x3ec550[_0xd7f0('0x4d')][_0xd7f0('0x50')]?_0x3ec550[_0xd7f0('0x4d')]:_0x5de41c[_0xd7f0('0x4a')];_0x3ec550[_0xd7f0('0x53')]=qs[_0xd7f0('0x54')](_0x467d4e[_0xd7f0('0x4e')][_0xd7f0('0x54')]);_0x3ec550['where']=qs[_0xd7f0('0x4b')](_[_0xd7f0('0x56')](_0x467d4e['query'],_0x5de41c['filters']));if(_0x467d4e['query'][_0xd7f0('0x57')]){_0x3ec550[_0xd7f0('0x55')]=_[_0xd7f0('0x58')](_0x3ec550[_0xd7f0('0x55')],{'$or':_[_0xd7f0('0x46')](_0x3ec550[_0xd7f0('0x4d')],function(_0x4ddc68){var _0xf490a5={};_0xf490a5[_0x4ddc68]={'$like':'%'+_0x467d4e['query'][_0xd7f0('0x57')]+'%'};return _0xf490a5;})});}_0x3ec550=_[_0xd7f0('0x58')]({},_0x3ec550,_0x467d4e[_0xd7f0('0x5a')]);return _0xc724a4['getApplications'](_0x3ec550);}})[_0xd7f0('0x26')](function(_0x1eac08){if(_0x1eac08){_0x5a12f0=_0x1eac08[_0xd7f0('0x50')];if(!_0x467d4e['query'][_0xd7f0('0x51')]('nolimit')){_0x3ec550[_0xd7f0('0x38')]=qs[_0xd7f0('0x38')](_0x467d4e[_0xd7f0('0x4e')][_0xd7f0('0x38')]);_0x3ec550[_0xd7f0('0x35')]=qs[_0xd7f0('0x35')](_0x467d4e[_0xd7f0('0x4e')]['offset']);}return _0xc724a4[_0xd7f0('0x8d')](_0x3ec550);}})[_0xd7f0('0x26')](function(_0x1a230b){if(_0x1a230b){return _0x1a230b?{'count':_0x5a12f0,'rows':_0x1a230b}:null;}})[_0xd7f0('0x26')](respondWithResult(_0x2d89c9,null))[_0xd7f0('0x30')](handleError(_0x2d89c9,null));};function Extension(_0x4c9597,_0x23bb7c,_0x2ede46,_0x1aa990){this['context']=_0xd7f0('0x8e');this[_0xd7f0('0x8f')]=_0x4c9597[_0xd7f0('0x90')];this[_0xd7f0('0x91')]=_0x1aa990;this[_0xd7f0('0x49')]='system';this['description']=_0xd7f0('0x92');this[_0xd7f0('0x6d')]=_0x4c9597['id'];this['priority']=_0x23bb7c;this[_0xd7f0('0x93')]=_0x2ede46;}function createExtensionsReciveFax(_0x476e0b){var _0x44ebb1=0x1;var _0x508e2b=[];_0x508e2b[_0xd7f0('0x94')](new Extension(_0x476e0b,_0x44ebb1,'','Answer'));_0x44ebb1+=0x1;_0x508e2b['push'](new Extension(_0x476e0b,_0x44ebb1,_0xd7f0('0x95'),_0xd7f0('0x96')));_0x44ebb1+=0x1;for(var _0x45ea39 in _0x476e0b){if(_0x476e0b[_0xd7f0('0x51')](_0x45ea39)&&(_0x45ea39==='ecm'||_0x45ea39==='localstationid'||_0x45ea39===_0xd7f0('0x97')||_0x45ea39===_0xd7f0('0x98')||_0x45ea39===_0xd7f0('0x99')||_0x45ea39==='maxrate'||_0x45ea39===_0xd7f0('0x9a')||_0x45ea39===_0xd7f0('0x9b')||_0x45ea39===_0xd7f0('0x9c'))){_0x508e2b[_0xd7f0('0x94')](new Extension(_0x476e0b,_0x44ebb1,_0xd7f0('0x9d')+_0x45ea39+')='+_0x476e0b[_0x45ea39],_0xd7f0('0x96')));_0x44ebb1+=0x1;}}_0x508e2b[_0xd7f0('0x94')](new Extension(_0x476e0b,_0x44ebb1,'6',_0xd7f0('0x9e')));_0x44ebb1+=0x1;_0x508e2b[_0xd7f0('0x94')](new Extension(_0x476e0b,_0x44ebb1,_0xd7f0('0x9f'),'ReceiveFax'));_0x44ebb1=0x0;return _0x508e2b;}exports[_0xd7f0('0xa0')]=function(_0xa89263,_0x363b8e,_0x362cf7){var _0x4d17c2;return db[_0xd7f0('0x85')][_0xd7f0('0x84')](function(_0x4354e7){return db[_0xd7f0('0x5b')]['create'](_0xa89263['body'],{'transaction':_0x4354e7})[_0xd7f0('0x26')](function(_0x5b1436){_0x4d17c2=_0x5b1436[_0xd7f0('0x3e')]({'plain':!![]});return db['VoiceExtension'][_0xd7f0('0x8a')](createExtensionsReciveFax(_0x4d17c2),{'transaction':_0x4354e7});});})[_0xd7f0('0x26')](function(){return _0x4d17c2;})['then'](respondWithResult(_0x363b8e,null))[_0xd7f0('0x30')](handleError(_0x363b8e,null));};exports[_0xd7f0('0xa1')]=function(_0x36f658,_0x54ec54,_0x48419d){var _0x258d37;return db[_0xd7f0('0x85')][_0xd7f0('0x84')](function(_0x588f5a){return db[_0xd7f0('0x5b')][_0xd7f0('0x3c')](_0x36f658[_0xd7f0('0x62')],{'where':{'id':_0x36f658[_0xd7f0('0x62')]['id']},'transaction':_0x588f5a})['then'](function(_0x454fcc){return db['VoiceExtension'][_0xd7f0('0x3d')]({'where':{'FaxAccountId':_0x36f658[_0xd7f0('0x62')]['id']},'transaction':_0x588f5a})[_0xd7f0('0x26')](function(_0x55d648){return db[_0xd7f0('0xa2')][_0xd7f0('0x8a')](createExtensionsReciveFax(_[_0xd7f0('0xa3')](_0x36f658['body'],[_0xd7f0('0xa4'),_0xd7f0('0xa5'),_0xd7f0('0xa6'),_0xd7f0('0xa7'),_0xd7f0('0xa8'),_0xd7f0('0xa9')])),{'transaction':_0x588f5a});});});})['then'](function(){return db['FaxAccount'][_0xd7f0('0xaa')](_0x36f658[_0xd7f0('0x62')]['id']);})[_0xd7f0('0x26')](respondWithResult(_0x54ec54,null))[_0xd7f0('0x30')](handleError(_0x54ec54,null));};exports[_0xd7f0('0xab')]=function(_0xc3faff,_0x5abf1e,_0x21d99e){var _0x48af0b={'raw':!![],'where':{}};var _0x4c945e={};var _0xb22d12={'count':0x0,'rows':[]};return db[_0xd7f0('0x5b')][_0xd7f0('0x7c')]({'where':{'id':_0xc3faff['params']['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x5abf1e,null))[_0xd7f0('0x26')](function(_0x2aed5f){if(_0x2aed5f){_0x4c945e[_0xd7f0('0x4a')]=_[_0xd7f0('0x5f')](db['FaxMessage']['rawAttributes']);_0x4c945e[_0xd7f0('0x4e')]=_[_0xd7f0('0x5f')](_0xc3faff[_0xd7f0('0x4e')]);_0x4c945e[_0xd7f0('0x4b')]=_[_0xd7f0('0x4c')](_0x4c945e['model'],_0x4c945e[_0xd7f0('0x4e')]);_0x48af0b[_0xd7f0('0x4d')]=_[_0xd7f0('0x4c')](_0x4c945e[_0xd7f0('0x4a')],qs['fields'](_0xc3faff[_0xd7f0('0x4e')][_0xd7f0('0x4f')]));_0x48af0b[_0xd7f0('0x4d')]=_0x48af0b['attributes'][_0xd7f0('0x50')]?_0x48af0b['attributes']:_0x4c945e['model'];if(!_0xc3faff['query']['hasOwnProperty'](_0xd7f0('0x52'))){_0x48af0b[_0xd7f0('0x38')]=qs[_0xd7f0('0x38')](_0xc3faff[_0xd7f0('0x4e')][_0xd7f0('0x38')]);_0x48af0b[_0xd7f0('0x35')]=qs[_0xd7f0('0x35')](_0xc3faff[_0xd7f0('0x4e')]['offset']);}_0x48af0b[_0xd7f0('0x53')]=qs[_0xd7f0('0x54')](_0xc3faff[_0xd7f0('0x4e')][_0xd7f0('0x54')]);_0x48af0b[_0xd7f0('0x55')]=qs['filters'](_[_0xd7f0('0x56')](_0xc3faff['query'],_0x4c945e['filters']));_0x48af0b['where'][_0xd7f0('0x6d')]=_0x2aed5f['id'];if(_0xc3faff[_0xd7f0('0x4e')][_0xd7f0('0x57')]){_0x48af0b[_0xd7f0('0x55')]=_[_0xd7f0('0x58')](_0x48af0b[_0xd7f0('0x55')],{'$or':_[_0xd7f0('0x46')](_0x48af0b[_0xd7f0('0x4d')],function(_0x36cb77){var _0x7f2736={};_0x7f2736[_0x36cb77]={'$like':'%'+_0xc3faff[_0xd7f0('0x4e')]['filter']+'%'};return _0x7f2736;})});}if(_0xc3faff[_0xd7f0('0x4e')][_0xd7f0('0xac')]){var _0x3391ad=_0xc3faff['query'][_0xd7f0('0xac')][_0xd7f0('0xad')](',');var _0x298b45={};_0x298b45[_0x3391ad[0x0]]={'$gte':moment(_0x3391ad[0x1])[_0xd7f0('0xae')]('YYYY-MM-DD\x20HH:mm:ss')};_0x48af0b[_0xd7f0('0x55')]=_[_0xd7f0('0x58')](_0x48af0b[_0xd7f0('0x55')],_0x298b45);}_0x48af0b=_[_0xd7f0('0x58')]({},_0x48af0b,_0xc3faff['options']);return db[_0xd7f0('0xaf')]['count']({'where':_0x48af0b['where']})['then'](function(_0x11df5e){_0xb22d12[_0xd7f0('0x37')]=_0x11df5e;if(_0xc3faff[_0xd7f0('0x4e')][_0xd7f0('0x5c')]){_0x48af0b[_0xd7f0('0x77')]=[{'all':!![]}];}return db[_0xd7f0('0xaf')]['findAll'](_0x48af0b);})['then'](function(_0x5d5afc){_0xb22d12[_0xd7f0('0x5d')]=_0x5d5afc;return _0xb22d12;});}})[_0xd7f0('0x26')](respondWithFilteredResult(_0x5abf1e,_0x48af0b))[_0xd7f0('0x30')](handleError(_0x5abf1e,null));};exports[_0xd7f0('0x43')]=function(_0x3efe3a,_0x788f1a,_0x98a992){var _0xf77963,_0x31676d={},_0x5a3a8e;if(_0x3efe3a[_0xd7f0('0x62')]['to']){_0x5a3a8e=_0x3efe3a['body']['to'][0x0];}return db[_0xd7f0('0x5b')][_0xd7f0('0x60')]({'where':{'id':_0x3efe3a[_0xd7f0('0x74')]['id']},'include':[{'model':db[_0xd7f0('0xb0')],'as':'List','include':[{'model':db[_0xd7f0('0xb1')],'as':'Contacts','where':{'fax':_0x5a3a8e},'limit':0x1,'order':[[_0xd7f0('0xa7'),'DESC']]}]}]})[_0xd7f0('0x26')](handleEntityNotFound(_0x788f1a,null))['then'](function(_0x572b62){_0xf77963=_0x572b62;if(_0x3efe3a['body'][_0xd7f0('0xb2')]&&_0x3efe3a[_0xd7f0('0x62')][_0xd7f0('0xb2')][_0xd7f0('0x50')]){for(var _0xcc5b7e=0x0;_0xcc5b7e<_0x3efe3a[_0xd7f0('0x62')]['attachments'][_0xd7f0('0x50')];_0xcc5b7e+=0x1){_0x3efe3a[_0xd7f0('0x62')]['attachments'][_0xcc5b7e]={'filename':_0x3efe3a[_0xd7f0('0x62')][_0xd7f0('0xb2')][_0xcc5b7e][_0xd7f0('0x42')],'id':_0x3efe3a['body'][_0xd7f0('0xb2')][_0xcc5b7e]['id'],'path':path[_0xd7f0('0xb3')](config[_0xd7f0('0xb4')],'server/files/attachments',_0x3efe3a[_0xd7f0('0x62')][_0xd7f0('0xb2')][_0xcc5b7e][_0xd7f0('0xb5')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xd7f0('0xb6')](_0x3efe3a[_0xd7f0('0x74')]['id'])?undefined:_0x3efe3a['params']['id'],'path':_[_0xd7f0('0xb6')](_0x3efe3a[_0xd7f0('0x62')][_0xd7f0('0xb2')][0x0][_0xd7f0('0x7')])?undefined:_0x3efe3a['body'][_0xd7f0('0xb2')][0x0][_0xd7f0('0x7')],'fax':_[_0xd7f0('0xb6')](_0x3efe3a[_0xd7f0('0x62')]['to'][0x0])?undefined:_0x3efe3a[_0xd7f0('0x62')]['to'][0x0]},client9002);})[_0xd7f0('0x26')](function(){if(_0xf77963){if(_[_0xd7f0('0xb6')](_0x3efe3a['body'][_0xd7f0('0xb7')])){_0x3efe3a[_0xd7f0('0x62')][_0xd7f0('0xb7')]=util['format'](_0xd7f0('0xb8'),_0xf77963[_0xd7f0('0x42')],_0xf77963[_0xd7f0('0xb9')]);}if(_0xf77963[_0xd7f0('0xba')]){if(_0xf77963[_0xd7f0('0xba')][_0xd7f0('0xbb')][_0xd7f0('0x50')]){return _0xf77963[_0xd7f0('0xba')]['Contacts'][0x0];}else{return db[_0xd7f0('0xb1')][_0xd7f0('0x61')](_[_0xd7f0('0x1d')](_0x3efe3a[_0xd7f0('0x62')],{'firstName':_0x3efe3a['body']['to'][0x0],'phone':_0x3efe3a[_0xd7f0('0x62')]['to'][0x0],'fax':_0x3efe3a['body']['to'][0x0],'ListId':_0xf77963[_0xd7f0('0xa9')]}));}}else{throw new Error(_0xd7f0('0xbc'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xd7f0('0x26')](function(_0x40d90a){if(_0x40d90a){return db['FaxInteraction'][_0xd7f0('0x60')]({'where':{'ContactId':_0x40d90a['id'],'closed':![],'FaxAccountId':_0xf77963['id']}})[_0xd7f0('0x26')](function(_0x31efd8){if(_0x31efd8){return[_0x31efd8,![]];}return db['FaxInteraction'][_0xd7f0('0x61')]({'UserId':_0x3efe3a['user']['id'],'ContactId':_0x40d90a['id'],'FaxAccountId':_0xf77963['id'],'fax':_0x3efe3a[_0xd7f0('0x62')]['to'][0x0],'firstMsgDirection':_0xd7f0('0xbd'),'Messages':[_[_0xd7f0('0x58')](_0x3efe3a[_0xd7f0('0x62')],{'read':![],'body':_0x3efe3a['body'][_0xd7f0('0xb2')][0x0]['filename'],'FaxAccountId':_0xf77963['id'],'UserId':_0x3efe3a[_0xd7f0('0x63')]['id'],'ContactId':_0x40d90a['id'],'AttachmentId':_0x3efe3a[_0xd7f0('0x62')][_0xd7f0('0xb2')][0x0]['id']})]},{'include':[{'model':db[_0xd7f0('0xaf')],'as':_0xd7f0('0xbe')}]})[_0xd7f0('0x26')](function(_0x35b864){return[_0x35b864,!![]];});});}else{throw new Error(_0xd7f0('0xbf'));}})[_0xd7f0('0xc0')](function(_0x5ea11d,_0x19b371){if(_0x19b371){return _0x5ea11d;}return db[_0xd7f0('0xaf')][_0xd7f0('0x61')]({'direction':'out','read':![],'body':_0x3efe3a[_0xd7f0('0x62')][_0xd7f0('0xb2')][0x0][_0xd7f0('0xc1')],'FaxAccountId':_0xf77963['id'],'FaxInteractionId':_0x5ea11d['id'],'UserId':_0x3efe3a[_0xd7f0('0x63')]['id'],'ContactId':_0x5ea11d[_0xd7f0('0xc2')],'AttachmentId':_0x3efe3a['body'][_0xd7f0('0xb2')][0x0]['id']})[_0xd7f0('0x26')](function(_0xd5026c){_0x5ea11d[_0xd7f0('0xc3')][_0xd7f0('0xbe')]=[];_0x5ea11d[_0xd7f0('0xc3')][_0xd7f0('0xbe')][_0xd7f0('0x94')](_0xd5026c[_0xd7f0('0xc3')]);return _0x5ea11d;});})[_0xd7f0('0x26')](function(_0x2e491f){respondWithRpcPromise('SendFax',_0xd7f0('0xc4'),{'FaxAccountId':_['isNil'](_0x3efe3a[_0xd7f0('0x74')]['id'])?undefined:_0x3efe3a[_0xd7f0('0x74')]['id'],'path':_[_0xd7f0('0xb6')](_0x3efe3a[_0xd7f0('0x62')][_0xd7f0('0xb2')][0x0][_0xd7f0('0x7')])?undefined:_0x3efe3a[_0xd7f0('0x62')][_0xd7f0('0xb2')][0x0][_0xd7f0('0x7')],'fax':_[_0xd7f0('0xb6')](_0x3efe3a['body']['to'][0x0])?undefined:_0x3efe3a[_0xd7f0('0x62')]['to'][0x0],'AttachmentId':_0x3efe3a[_0xd7f0('0x62')]['attachments'][0x0]['id']},client9002)[_0xd7f0('0x26')](function(_0x2d6bf3){logger['info'](_0xd7f0('0xc5'),_0x2d6bf3);})[_0xd7f0('0x30')](function(_0x53f8b2){logger[_0xd7f0('0x27')](_0xd7f0('0xc5'),_0x53f8b2);});return _0x2e491f;})[_0xd7f0('0x26')](respondWithResult(_0x788f1a,null))[_0xd7f0('0x30')](handleError(_0x788f1a,null));};exports[_0xd7f0('0xc6')]=function(_0x49b9f9,_0x59b204,_0x544d43){return db[_0xd7f0('0x5b')][_0xd7f0('0x60')]({'where':{'id':_0x49b9f9[_0xd7f0('0x74')]['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x59b204,null))[_0xd7f0('0x26')](function(_0x3e01c8){if(_0x3e01c8){return _0x3e01c8[_0xd7f0('0xc6')](_0x49b9f9[_0xd7f0('0x62')][_0xd7f0('0x72')],_['omit'](_0x49b9f9[_0xd7f0('0x62')],[_0xd7f0('0x72'),'id'])||{})[_0xd7f0('0xc0')](function(_0x5b7ec0){for(var _0x4e4aa5=0x0;_0x4e4aa5<_0x49b9f9[_0xd7f0('0x62')][_0xd7f0('0x72')]['length'];_0x4e4aa5+=0x1){socket[_0xd7f0('0xc7')](_0xd7f0('0xc8'),{'UserId':Number(_0x49b9f9[_0xd7f0('0x62')][_0xd7f0('0x72')][_0x4e4aa5]),'FaxAccountId':Number(_0x49b9f9['params']['id'])});}return _0x5b7ec0;});}})['then'](respondWithResult(_0x59b204,null))[_0xd7f0('0x30')](handleError(_0x59b204,null));};exports[_0xd7f0('0xc9')]=function(_0x1b2ee1,_0x7d8d45,_0x6ad48f){return db[_0xd7f0('0x5b')][_0xd7f0('0x60')]({'where':{'id':_0x1b2ee1[_0xd7f0('0x74')]['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x7d8d45,null))[_0xd7f0('0x26')](function(_0x450992){if(_0x450992){return _0x450992[_0xd7f0('0xc9')](_0x1b2ee1['query'][_0xd7f0('0x72')])[_0xd7f0('0x26')](function(){if(_[_0xd7f0('0xca')](_0x1b2ee1[_0xd7f0('0x4e')][_0xd7f0('0x72')])){for(var _0x553a78=0x0;_0x553a78<_0x1b2ee1[_0xd7f0('0x4e')]['ids'][_0xd7f0('0x50')];_0x553a78+=0x1){socket['emit'](_0xd7f0('0xcb'),{'UserId':Number(_0x1b2ee1[_0xd7f0('0x4e')][_0xd7f0('0x72')][_0x553a78]),'FaxAccountId':Number(_0x1b2ee1[_0xd7f0('0x74')]['id'])});}}else{socket['emit'](_0xd7f0('0xcb'),{'UserId':Number(_0x1b2ee1[_0xd7f0('0x4e')][_0xd7f0('0x72')]),'FaxAccountId':Number(_0x1b2ee1[_0xd7f0('0x74')]['id'])});}});}})['then'](respondWithStatusCode(_0x7d8d45,null))[_0xd7f0('0x30')](handleError(_0x7d8d45,null));};exports['getAgents']=function(_0x3f7fda,_0x5e13c8,_0x446562){var _0x2f665f={};var _0x257afd={};var _0x572044;var _0x136d74;return db['FaxAccount']['findOne']({'where':{'id':_0x3f7fda['params']['id']}})[_0xd7f0('0x26')](handleEntityNotFound(_0x5e13c8,null))['then'](function(_0x1355e2){if(_0x1355e2){_0x572044=_0x1355e2;_0x257afd[_0xd7f0('0x4a')]=_['keys'](db[_0xd7f0('0x7d')][_0xd7f0('0x47')]);_0x257afd['query']=_[_0xd7f0('0x5f')](_0x3f7fda[_0xd7f0('0x4e')]);_0x257afd[_0xd7f0('0x4b')]=_[_0xd7f0('0x4c')](_0x257afd[_0xd7f0('0x4a')],_0x257afd[_0xd7f0('0x4e')]);_0x2f665f[_0xd7f0('0x4d')]=_[_0xd7f0('0x4c')](_0x257afd[_0xd7f0('0x4a')],qs[_0xd7f0('0x4f')](_0x3f7fda['query']['fields']));_0x2f665f[_0xd7f0('0x4d')]=_0x2f665f['attributes']['length']?_0x2f665f[_0xd7f0('0x4d')]:_0x257afd[_0xd7f0('0x4a')];_0x2f665f[_0xd7f0('0x53')]=qs[_0xd7f0('0x54')](_0x3f7fda[_0xd7f0('0x4e')][_0xd7f0('0x54')]);_0x2f665f[_0xd7f0('0x55')]=qs[_0xd7f0('0x4b')](_[_0xd7f0('0x56')](_0x3f7fda[_0xd7f0('0x4e')],_0x257afd[_0xd7f0('0x4b')]));if(_0x3f7fda[_0xd7f0('0x4e')][_0xd7f0('0x57')]){_0x2f665f[_0xd7f0('0x55')]=_[_0xd7f0('0x58')](_0x2f665f['where'],{'$or':_['map'](_0x2f665f['attributes'],function(_0x683edf){var _0x4dad57={};_0x4dad57[_0x683edf]={'$like':'%'+_0x3f7fda[_0xd7f0('0x4e')][_0xd7f0('0x57')]+'%'};return _0x4dad57;})});}_0x2f665f=_['merge']({},_0x2f665f,_0x3f7fda[_0xd7f0('0x5a')]);return _0x572044[_0xd7f0('0xcc')](_0x2f665f);}})[_0xd7f0('0x26')](function(_0x306886){if(_0x306886){_0x136d74=_0x306886[_0xd7f0('0x50')];if(!_0x3f7fda[_0xd7f0('0x4e')]['hasOwnProperty']('nolimit')){_0x2f665f[_0xd7f0('0x38')]=qs['limit'](_0x3f7fda['query'][_0xd7f0('0x38')]);_0x2f665f[_0xd7f0('0x35')]=qs[_0xd7f0('0x35')](_0x3f7fda[_0xd7f0('0x4e')][_0xd7f0('0x35')]);}return _0x572044[_0xd7f0('0xcc')](_0x2f665f);}})[_0xd7f0('0x26')](function(_0x8d1ddb){if(_0x8d1ddb){return _0x8d1ddb?{'count':_0x136d74,'rows':_0x8d1ddb}:null;}})[_0xd7f0('0x26')](respondWithResult(_0x5e13c8,null))[_0xd7f0('0x30')](handleError(_0x5e13c8,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 95f05f1..58e6ca7 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 _0x1740=['update','emit','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x4f9f88,_0x42b799){var _0x490fb7=function(_0x540f88){while(--_0x540f88){_0x4f9f88['push'](_0x4f9f88['shift']());}};_0x490fb7(++_0x42b799);}(_0x1740,0x1c6));var _0x0174=function(_0x17a582,_0x21bfb1){_0x17a582=_0x17a582-0x0;var _0x3d5bd7=_0x1740[_0x17a582];return _0x3d5bd7;};'use strict';var EventEmitter=require(_0x0174('0x0'));var FaxAccount=require(_0x0174('0x1'))['db'][_0x0174('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0174('0x3')](0x0);var events={'afterCreate':_0x0174('0x4'),'afterUpdate':_0x0174('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a333f){return function(_0x235956,_0x4a702e,_0x5bda34){FaxAccountEvents[_0x0174('0x6')](_0x2a333f+':'+_0x235956['id'],_0x235956);FaxAccountEvents[_0x0174('0x6')](_0x2a333f,_0x235956);_0x5bda34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x0174('0x7')](e,emitEvent(event));}}module[_0x0174('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x1abc=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0xc31458,_0x45ee76){var _0x1b4a90=function(_0x1a49b0){while(--_0x1a49b0){_0xc31458['push'](_0xc31458['shift']());}};_0x1b4a90(++_0x45ee76);}(_0x1abc,0xbd));var _0xc1ab=function(_0x55d1b0,_0x46fb94){_0x55d1b0=_0x55d1b0-0x0;var _0x17c5f7=_0x1abc[_0x55d1b0];return _0x17c5f7;};'use strict';var EventEmitter=require(_0xc1ab('0x0'));var FaxAccount=require(_0xc1ab('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc1ab('0x2')](0x0);var events={'afterCreate':_0xc1ab('0x3'),'afterUpdate':'update','afterDestroy':_0xc1ab('0x4')};function emitEvent(_0x550876){return function(_0x3603a0,_0x3d20d1,_0x428f6e){FaxAccountEvents[_0xc1ab('0x5')](_0x550876+':'+_0x3603a0['id'],_0x3603a0);FaxAccountEvents[_0xc1ab('0x5')](_0x550876,_0x3603a0);_0x428f6e(null);};}for(var e in events){if(events[_0xc1ab('0x6')](e)){var event=events[e];FaxAccount[_0xc1ab('0x7')](e,emitEvent(event));}}module[_0xc1ab('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 4a26b37..9bedfa6 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 _0xc065=['fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0xc065,0x187));var _0x5c06=function(_0xd0d98d,_0x34a193){_0xd0d98d=_0xd0d98d-0x0;var _0x5373cd=_0xc065[_0xd0d98d];return _0x5373cd;};'use strict';var _=require(_0x5c06('0x0'));var util=require(_0x5c06('0x1'));var logger=require(_0x5c06('0x2'))(_0x5c06('0x3'));var moment=require(_0x5c06('0x4'));var BPromise=require(_0x5c06('0x5'));var rp=require(_0x5c06('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c06('0x7'));var config=require(_0x5c06('0x8'));var attributes=require(_0x5c06('0x9'));module['exports']=function(_0x42f2a6,_0x142ff6){return _0x42f2a6[_0x5c06('0xa')](_0x5c06('0xb'),attributes,{'tableName':_0x5c06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b91=['exports','fax_accounts','lodash','../../config/logger','api','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0xe4d6c6,_0x3bdbf2){var _0x3a8935=function(_0x131483){while(--_0x131483){_0xe4d6c6['push'](_0xe4d6c6['shift']());}};_0x3a8935(++_0x3bdbf2);}(_0x4b91,0x16a));var _0x14b9=function(_0x522f66,_0x4fe04d){_0x522f66=_0x522f66-0x0;var _0xb2f6c5=_0x4b91[_0x522f66];return _0xb2f6c5;};'use strict';var _=require(_0x14b9('0x0'));var util=require('util');var logger=require(_0x14b9('0x1'))(_0x14b9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x14b9('0x3'));var rimraf=require(_0x14b9('0x4'));var config=require(_0x14b9('0x5'));var attributes=require(_0x14b9('0x6'));module[_0x14b9('0x7')]=function(_0xaac50d,_0x3cab5b){return _0xaac50d['define']('FaxAccount',attributes,{'tableName':_0x14b9('0x8'),'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 3a62a6b..bcb9c6a 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 _0x7b10=['model','map','NotifyFaxAccount','body','fax','CmContact','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','create','contact','find','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','name','UserId','agent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','message','error','result','catch','GetFaxAccount','FaxAccount','options','attributes','include'];(function(_0x5e45e9,_0x36f8fd){var _0xfd13e6=function(_0x43ad5c){while(--_0x43ad5c){_0x5e45e9['push'](_0x5e45e9['shift']());}};_0xfd13e6(++_0x36f8fd);}(_0x7b10,0x17c));var _0x07b1=function(_0x2a13dd,_0x354785){_0x2a13dd=_0x2a13dd-0x0;var _0x3bae10=_0x7b10[_0x2a13dd];return _0x3bae10;};'use strict';var _=require(_0x07b1('0x0'));var util=require(_0x07b1('0x1'));var moment=require(_0x07b1('0x2'));var BPromise=require(_0x07b1('0x3'));var rs=require(_0x07b1('0x4'));var fs=require('fs');var Redis=require(_0x07b1('0x5'));var db=require(_0x07b1('0x6'))['db'];var utils=require(_0x07b1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x07b1('0x8'));var jayson=require(_0x07b1('0x9'));var client=jayson[_0x07b1('0xa')]['http']({'port':0x232c});config[_0x07b1('0xb')]=_[_0x07b1('0xc')](config[_0x07b1('0xb')],{'host':_0x07b1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x590f8f,_0x39ef2e,_0x4cce9e){return new BPromise(function(_0x830668,_0x5c3960){return client[_0x07b1('0xe')](_0x590f8f,_0x4cce9e)[_0x07b1('0xf')](function(_0x46e3a8){logger[_0x07b1('0x10')](_0x07b1('0x11'),_0x39ef2e,_0x07b1('0x12'));logger[_0x07b1('0x13')](_0x07b1('0x14'),_0x39ef2e,_0x07b1('0x12'),JSON['stringify'](_0x46e3a8));if(_0x46e3a8['error']){if(_0x46e3a8['error']['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x39ef2e,_0x46e3a8['error'][_0x07b1('0x15')]);return _0x5c3960(_0x46e3a8[_0x07b1('0x16')][_0x07b1('0x15')]);}logger[_0x07b1('0x16')]('FaxAccount,\x20%s,\x20%s',_0x39ef2e,_0x46e3a8[_0x07b1('0x16')][_0x07b1('0x15')]);return _0x830668(_0x46e3a8[_0x07b1('0x16')][_0x07b1('0x15')]);}else{logger[_0x07b1('0x10')](_0x07b1('0x11'),_0x39ef2e,_0x07b1('0x12'));_0x830668(_0x46e3a8[_0x07b1('0x17')][_0x07b1('0x15')]);}})[_0x07b1('0x18')](function(_0x2ea9b5){logger['error'](_0x07b1('0x11'),_0x39ef2e,_0x2ea9b5);_0x5c3960(_0x2ea9b5);});});}exports[_0x07b1('0x19')]=function(_0x557508){var _0x11d7b6=this;return new Promise(function(_0x570e3e,_0x522db9){return db[_0x07b1('0x1a')]['findAll']({'raw':_0x557508[_0x07b1('0x1b')]?_0x557508[_0x07b1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x557508[_0x07b1('0x1b')]?_0x557508[_0x07b1('0x1b')]['where']||null:null,'attributes':_0x557508[_0x07b1('0x1b')]?_0x557508[_0x07b1('0x1b')][_0x07b1('0x1c')]||null:null,'limit':_0x557508[_0x07b1('0x1b')]?_0x557508[_0x07b1('0x1b')]['limit']||null:null,'include':_0x557508[_0x07b1('0x1b')]?_0x557508['options']['include']?_['map'](_0x557508[_0x07b1('0x1b')][_0x07b1('0x1d')],function(_0x2f5dbc){return{'model':db[_0x2f5dbc[_0x07b1('0x1e')]],'as':_0x2f5dbc['as'],'attributes':_0x2f5dbc[_0x07b1('0x1c')],'include':_0x2f5dbc[_0x07b1('0x1d')]?_['map'](_0x2f5dbc[_0x07b1('0x1d')],function(_0x2e68c0){return{'model':db[_0x2e68c0[_0x07b1('0x1e')]],'as':_0x2e68c0['as'],'attributes':_0x2e68c0[_0x07b1('0x1c')],'include':_0x2e68c0[_0x07b1('0x1d')]?_[_0x07b1('0x1f')](_0x2e68c0[_0x07b1('0x1d')],function(_0x3f13df){return{'model':db[_0x3f13df[_0x07b1('0x1e')]],'as':_0x3f13df['as'],'attributes':_0x3f13df[_0x07b1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x07b1('0xf')](function(_0x1f9548){logger[_0x07b1('0x10')]('GetFaxAccount',_0x557508);logger[_0x07b1('0x13')](_0x07b1('0x19'),_0x557508,JSON['stringify'](_0x1f9548));_0x570e3e(_0x1f9548);})[_0x07b1('0x18')](function(_0x316fbe){logger[_0x07b1('0x16')](_0x07b1('0x19'),_0x316fbe[_0x07b1('0x15')],_0x557508);_0x522db9(_0x11d7b6[_0x07b1('0x16')](0x1f4,_0x316fbe[_0x07b1('0x15')]));});});};exports[_0x07b1('0x20')]=function(_0x39b2f1,_0x324429,_0x2fb1f6){var _0x3b62c4=this;return new Promise(function(_0x538e3c,_0x56aa15){var _0x597010={'body':_0x39b2f1[_0x07b1('0x21')],'channel':_0x07b1('0x22')};var _0x38ccef=[];var _0x2d1f2a=[];var _0x29b133={};return db[_0x07b1('0x23')]['describe']()[_0x07b1('0xf')](function(_0x59a7e4){if(!_0x59a7e4){throw new db['Sequelize'][(_0x07b1('0x24'))](_0x07b1('0x25'));}_0x38ccef=_['difference'](_[_0x07b1('0x26')](_0x59a7e4),[_0x07b1('0x27'),_0x07b1('0x28')]);_0x2d1f2a=_[_0x07b1('0x29')](_['keys'](_0x59a7e4),[_0x07b1('0x27'),_0x07b1('0x28'),_0x07b1('0x2a'),'ListId']);if(_0x39b2f1[_0x07b1('0x21')]['id']){delete _0x39b2f1[_0x07b1('0x21')]['id'];}if(_[_0x07b1('0x2b')](_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x2c')])){throw new db[(_0x07b1('0x2d'))][(_0x07b1('0x24'))](_0x07b1('0x2e'));}if(_[_0x07b1('0x2b')](_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x21')])||_0x39b2f1['body'][_0x07b1('0x21')]===''){throw new db[(_0x07b1('0x2d'))][(_0x07b1('0x24'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x07b1('0x2b')](_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x2f')])){throw new db['Sequelize'][(_0x07b1('0x24'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d1f2a);}if(!_[_0x07b1('0x30')](_0x2d1f2a,_0x39b2f1['body'][_0x07b1('0x2f')])){throw new db['Sequelize'][(_0x07b1('0x24'))](_0x07b1('0x31')+_0x2d1f2a);}_0x29b133[_0x39b2f1[_0x07b1('0x21')]['mapKey']]=_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x2c')];})[_0x07b1('0xf')](function(){return db[_0x07b1('0x1a')]['find']({'where':{'id':_0x39b2f1[_0x07b1('0x32')]['id']},'include':[{'model':db['CmList'],'as':_0x07b1('0x33'),'include':[{'model':db[_0x07b1('0x23')],'as':_0x07b1('0x34'),'where':_0x29b133,'limit':0x1,'order':[[_0x07b1('0x28'),'DESC']]}]},{'model':db[_0x07b1('0x35')],'as':_0x07b1('0x36')}]});})['then'](function(_0x3051ff){if(_0x3051ff&&_0x3051ff[_0x07b1('0x33')]){var _0x1b6aa2=_0x3051ff[_0x07b1('0x37')]({'plain':!![]});_0x597010['account']=_0x1b6aa2;_0x597010[_0x07b1('0x38')]=_0x1b6aa2[_0x07b1('0x36')];_0x597010[_0x07b1('0x39')]=_0x1b6aa2[_0x07b1('0x33')];_0x597010[_0x07b1('0x38')]=_[_0x07b1('0x3a')](_0x597010[_0x07b1('0x38')],[_0x07b1('0x3b')],[_0x07b1('0x3c')]);if(_0x597010[_0x07b1('0x32')][_0x07b1('0x36')]){delete _0x597010[_0x07b1('0x32')][_0x07b1('0x36')];}if(_0x597010[_0x07b1('0x32')][_0x07b1('0x33')]&&_0x597010[_0x07b1('0x32')]['List']['Contacts'][_0x07b1('0x3d')]){return _0x597010['account'][_0x07b1('0x33')][_0x07b1('0x34')][0x0];}var _0x4bba20=_['defaults'](_0x39b2f1['body'],{'firstName':_0x39b2f1[_0x07b1('0x21')]['from'],'ListId':_0x1b6aa2['ListId']});_0x4bba20[_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x2f')]]=_0x39b2f1['body'][_0x07b1('0x2c')];return db[_0x07b1('0x23')][_0x07b1('0x3e')](_0x4bba20,{'fields':_0x38ccef,'raw':!![]});}})[_0x07b1('0xf')](function(_0x2d5e8a){_0x597010[_0x07b1('0x3f')]=_0x2d5e8a;if(_0x2d5e8a){var _0x9d7760={'ContactId':_0x2d5e8a['id'],'FaxAccountId':_0x39b2f1[_0x07b1('0x32')]['id'],'fax':_0x2d5e8a[_0x07b1('0x22')]};return db['FaxInteraction'][_0x07b1('0x40')]({'where':{'ContactId':_0x2d5e8a['id'],'closed':![],'FaxAccountId':_0x39b2f1[_0x07b1('0x32')]['id']}})[_0x07b1('0xf')](function(_0xa276e2){if(_0xa276e2){return[_0xa276e2,![]];}return db[_0x07b1('0x41')][_0x07b1('0x3e')](_0x9d7760)[_0x07b1('0xf')](function(_0x26a77e){return[_0x26a77e,!![]];});});}else{throw new Error(_0x07b1('0x42'));}})[_0x07b1('0x43')](function(_0x3524c3,_0x336c3a){var _0x549ee7=_0x3524c3['get']({'plain':!![]});if(_0x336c3a){if(_0x597010[_0x07b1('0x32')][_0x07b1('0x44')]){_0x597010[_0x07b1('0x38')][_0x07b1('0x45')]({'id':0x0,'priority':_0x597010[_0x07b1('0x38')][_0x07b1('0x3d')]+0x1,'app':'close','appdata':_0x07b1('0x46'),'interval':_0x07b1('0x47')});}_0x549ee7['created']=!![];}else{_0x549ee7[_0x07b1('0x48')]=![];}_0x597010[_0x07b1('0x49')]=_0x549ee7;return db[_0x07b1('0x4a')][_0x07b1('0x3e')]({'body':_0x39b2f1['body'][_0x07b1('0x21')],'FaxAccountId':_0x39b2f1[_0x07b1('0x32')]['id'],'FaxInteractionId':_0x3524c3['id'],'direction':'in','ContactId':_0x3524c3['ContactId'],'AttachmentId':_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x4b')]});})[_0x07b1('0xf')](function(_0x48c164){_0x597010[_0x07b1('0x15')]=_0x48c164;if(_0x597010[_0x07b1('0x49')]['UserId']){return db[_0x07b1('0x4c')][_0x07b1('0x40')]({'attributes':['id',_0x07b1('0x4d')],'where':{'id':_0x597010[_0x07b1('0x49')][_0x07b1('0x4e')]}})['then'](function(_0x3df11b){if(_0x3df11b){_0x597010[_0x07b1('0x38')]['unshift']({'id':0x0,'priority':0x0,'app':_0x07b1('0x4f'),'appdata':_0x3df11b[_0x07b1('0x4d')]+','+(_0x597010['account']['waitForTheAssignedAgent']||0xa),'interval':_0x07b1('0x47')});}return respondWithRpcPromise('Start',_0x07b1('0x50'),_0x597010);});}return respondWithRpcPromise(_0x07b1('0x51'),_0x07b1('0x50'),_0x597010);})[_0x07b1('0xf')](function(_0x224c0d){_0x538e3c(_0x224c0d);})[_0x07b1('0x18')](function(_0x5818db){_0x56aa15(_0x3b62c4[_0x07b1('0x16')](0x1f4,_0x5818db[_0x07b1('0x15')]));});});}; \ No newline at end of file +var _0xe3db=['find','CmList','List','CmContact','Contacts','DESC','Applications','get','account','list','applications','orderBy','asc','ListId','create','FaxInteraction','Contact\x20not\x20found','push','length','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','unshift','agent','name','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','fax','describe','Sequelize','difference','keys','createdAt','updatedAt','body','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from'];(function(_0x2edd08,_0x19eb8d){var _0x4c5c56=function(_0x24a1f5){while(--_0x24a1f5){_0x2edd08['push'](_0x2edd08['shift']());}};_0x4c5c56(++_0x19eb8d);}(_0xe3db,0x113));var _0xbe3d=function(_0x419fba,_0x42ea70){_0x419fba=_0x419fba-0x0;var _0x2a044f=_0xe3db[_0x419fba];return _0x2a044f;};'use strict';var _=require(_0xbe3d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbe3d('0x1'));var rs=require(_0xbe3d('0x2'));var fs=require('fs');var Redis=require(_0xbe3d('0x3'));var db=require(_0xbe3d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe3d('0x5'))(_0xbe3d('0x6'));var config=require('../../config/environment');var jayson=require(_0xbe3d('0x7'));var client=jayson[_0xbe3d('0x8')]['http']({'port':0x232c});config[_0xbe3d('0x9')]=_[_0xbe3d('0xa')](config[_0xbe3d('0x9')],{'host':_0xbe3d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbe3d('0xc'))['register'](socket);function respondWithRpcPromise(_0x2b35b0,_0x257402,_0x32df8d){return new BPromise(function(_0x2ffcf5,_0x389535){return client[_0xbe3d('0xd')](_0x2b35b0,_0x32df8d)[_0xbe3d('0xe')](function(_0x205dd8){logger[_0xbe3d('0xf')](_0xbe3d('0x10'),_0x257402,_0xbe3d('0x11'));logger[_0xbe3d('0x12')](_0xbe3d('0x13'),_0x257402,_0xbe3d('0x11'),JSON[_0xbe3d('0x14')](_0x205dd8));if(_0x205dd8[_0xbe3d('0x15')]){if(_0x205dd8[_0xbe3d('0x15')][_0xbe3d('0x16')]===0x1f4){logger[_0xbe3d('0x15')](_0xbe3d('0x10'),_0x257402,_0x205dd8[_0xbe3d('0x15')][_0xbe3d('0x17')]);return _0x389535(_0x205dd8[_0xbe3d('0x15')][_0xbe3d('0x17')]);}logger[_0xbe3d('0x15')](_0xbe3d('0x10'),_0x257402,_0x205dd8[_0xbe3d('0x15')][_0xbe3d('0x17')]);return _0x2ffcf5(_0x205dd8[_0xbe3d('0x15')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x257402,'request\x20sent');_0x2ffcf5(_0x205dd8['result'][_0xbe3d('0x17')]);}})[_0xbe3d('0x18')](function(_0x3fce8f){logger[_0xbe3d('0x15')](_0xbe3d('0x10'),_0x257402,_0x3fce8f);_0x389535(_0x3fce8f);});});}exports['GetFaxAccount']=function(_0x5548e2){var _0x2cd3c0=this;return new Promise(function(_0x3b06cc,_0x37fcdc){return db[_0xbe3d('0x19')][_0xbe3d('0x1a')]({'raw':_0x5548e2[_0xbe3d('0x1b')]?_0x5548e2[_0xbe3d('0x1b')][_0xbe3d('0x1c')]===undefined?!![]:![]:!![],'where':_0x5548e2[_0xbe3d('0x1b')]?_0x5548e2[_0xbe3d('0x1b')][_0xbe3d('0x1d')]||null:null,'attributes':_0x5548e2[_0xbe3d('0x1b')]?_0x5548e2[_0xbe3d('0x1b')][_0xbe3d('0x1e')]||null:null,'limit':_0x5548e2[_0xbe3d('0x1b')]?_0x5548e2[_0xbe3d('0x1b')][_0xbe3d('0x1f')]||null:null,'include':_0x5548e2[_0xbe3d('0x1b')]?_0x5548e2[_0xbe3d('0x1b')][_0xbe3d('0x20')]?_[_0xbe3d('0x21')](_0x5548e2[_0xbe3d('0x1b')][_0xbe3d('0x20')],function(_0x54065c){return{'model':db[_0x54065c['model']],'as':_0x54065c['as'],'attributes':_0x54065c[_0xbe3d('0x1e')],'include':_0x54065c['include']?_[_0xbe3d('0x21')](_0x54065c[_0xbe3d('0x20')],function(_0x1b1da){return{'model':db[_0x1b1da[_0xbe3d('0x22')]],'as':_0x1b1da['as'],'attributes':_0x1b1da['attributes'],'include':_0x1b1da[_0xbe3d('0x20')]?_[_0xbe3d('0x21')](_0x1b1da[_0xbe3d('0x20')],function(_0x12a960){return{'model':db[_0x12a960['model']],'as':_0x12a960['as'],'attributes':_0x12a960[_0xbe3d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ee97c){logger['info']('GetFaxAccount',_0x5548e2);logger[_0xbe3d('0x12')](_0xbe3d('0x23'),_0x5548e2,JSON[_0xbe3d('0x14')](_0x4ee97c));_0x3b06cc(_0x4ee97c);})['catch'](function(_0x380210){logger[_0xbe3d('0x15')](_0xbe3d('0x23'),_0x380210[_0xbe3d('0x17')],_0x5548e2);_0x37fcdc(_0x2cd3c0[_0xbe3d('0x15')](0x1f4,_0x380210[_0xbe3d('0x17')]));});});};exports[_0xbe3d('0x24')]=function(_0x45ebc6,_0x59a663,_0x52b853){var _0x521fcd=this;return new Promise(function(_0xb06265,_0x10aaf8){var _0x48cd7d={'body':_0x45ebc6['body'],'channel':_0xbe3d('0x25')};var _0x5d7228=[];var _0x37b7e5=[];var _0x3c6e9e={};return db['CmContact'][_0xbe3d('0x26')]()['then'](function(_0x1e635f){if(!_0x1e635f){throw new db[(_0xbe3d('0x27'))]['ValidationError']('no\x20available\x20attributes');}_0x5d7228=_[_0xbe3d('0x28')](_[_0xbe3d('0x29')](_0x1e635f),[_0xbe3d('0x2a'),_0xbe3d('0x2b')]);_0x37b7e5=_[_0xbe3d('0x28')](_[_0xbe3d('0x29')](_0x1e635f),[_0xbe3d('0x2a'),_0xbe3d('0x2b'),'CompanyId','ListId']);if(_0x45ebc6[_0xbe3d('0x2c')]['id']){delete _0x45ebc6[_0xbe3d('0x2c')]['id'];}if(_[_0xbe3d('0x2d')](_0x45ebc6['body']['from'])){throw new db[(_0xbe3d('0x27'))][(_0xbe3d('0x2e'))](_0xbe3d('0x2f'));}if(_[_0xbe3d('0x2d')](_0x45ebc6[_0xbe3d('0x2c')][_0xbe3d('0x2c')])||_0x45ebc6[_0xbe3d('0x2c')]['body']===''){throw new db['Sequelize'][(_0xbe3d('0x2e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbe3d('0x2d')](_0x45ebc6[_0xbe3d('0x2c')][_0xbe3d('0x30')])){throw new db[(_0xbe3d('0x27'))]['ValidationError'](_0xbe3d('0x31')+_0x37b7e5);}if(!_[_0xbe3d('0x32')](_0x37b7e5,_0x45ebc6[_0xbe3d('0x2c')][_0xbe3d('0x30')])){throw new db[(_0xbe3d('0x27'))][(_0xbe3d('0x2e'))](_0xbe3d('0x33')+_0x37b7e5);}_0x3c6e9e[_0x45ebc6['body'][_0xbe3d('0x30')]]=_0x45ebc6[_0xbe3d('0x2c')][_0xbe3d('0x34')];})['then'](function(){return db[_0xbe3d('0x19')][_0xbe3d('0x35')]({'where':{'id':_0x45ebc6['account']['id']},'include':[{'model':db[_0xbe3d('0x36')],'as':_0xbe3d('0x37'),'include':[{'model':db[_0xbe3d('0x38')],'as':_0xbe3d('0x39'),'where':_0x3c6e9e,'limit':0x1,'order':[[_0xbe3d('0x2b'),_0xbe3d('0x3a')]]}]},{'model':db['FaxApplication'],'as':_0xbe3d('0x3b')}]});})[_0xbe3d('0xe')](function(_0x407897){if(_0x407897&&_0x407897['List']){var _0x22961a=_0x407897[_0xbe3d('0x3c')]({'plain':!![]});_0x48cd7d[_0xbe3d('0x3d')]=_0x22961a;_0x48cd7d['applications']=_0x22961a['Applications'];_0x48cd7d[_0xbe3d('0x3e')]=_0x22961a[_0xbe3d('0x37')];_0x48cd7d[_0xbe3d('0x3f')]=_[_0xbe3d('0x40')](_0x48cd7d[_0xbe3d('0x3f')],['priority'],[_0xbe3d('0x41')]);if(_0x48cd7d[_0xbe3d('0x3d')][_0xbe3d('0x3b')]){delete _0x48cd7d['account'][_0xbe3d('0x3b')];}if(_0x48cd7d[_0xbe3d('0x3d')][_0xbe3d('0x37')]&&_0x48cd7d[_0xbe3d('0x3d')]['List'][_0xbe3d('0x39')]['length']){return _0x48cd7d[_0xbe3d('0x3d')][_0xbe3d('0x37')][_0xbe3d('0x39')][0x0];}var _0x565ba4=_['defaults'](_0x45ebc6[_0xbe3d('0x2c')],{'firstName':_0x45ebc6[_0xbe3d('0x2c')][_0xbe3d('0x34')],'ListId':_0x22961a[_0xbe3d('0x42')]});_0x565ba4[_0x45ebc6[_0xbe3d('0x2c')][_0xbe3d('0x30')]]=_0x45ebc6[_0xbe3d('0x2c')][_0xbe3d('0x34')];return db[_0xbe3d('0x38')][_0xbe3d('0x43')](_0x565ba4,{'fields':_0x5d7228,'raw':!![]});}})[_0xbe3d('0xe')](function(_0x3cc16a){_0x48cd7d['contact']=_0x3cc16a;if(_0x3cc16a){var _0x1be20f={'ContactId':_0x3cc16a['id'],'FaxAccountId':_0x45ebc6[_0xbe3d('0x3d')]['id'],'fax':_0x3cc16a['fax']};return db[_0xbe3d('0x44')][_0xbe3d('0x35')]({'where':{'ContactId':_0x3cc16a['id'],'closed':![],'FaxAccountId':_0x45ebc6[_0xbe3d('0x3d')]['id']}})['then'](function(_0x1a1f09){if(_0x1a1f09){return[_0x1a1f09,![]];}return db[_0xbe3d('0x44')]['create'](_0x1be20f)['then'](function(_0x17fd6e){return[_0x17fd6e,!![]];});});}else{throw new Error(_0xbe3d('0x45'));}})['spread'](function(_0x273199,_0x22f867){var _0x22ec3a=_0x273199['get']({'plain':!![]});if(_0x22f867){if(_0x48cd7d[_0xbe3d('0x3d')]['autoclose']){_0x48cd7d[_0xbe3d('0x3f')][_0xbe3d('0x46')]({'id':0x0,'priority':_0x48cd7d['applications'][_0xbe3d('0x47')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xbe3d('0x48')});}_0x22ec3a[_0xbe3d('0x49')]=!![];}else{_0x22ec3a['created']=![];}_0x48cd7d[_0xbe3d('0x4a')]=_0x22ec3a;return db[_0xbe3d('0x4b')][_0xbe3d('0x43')]({'body':_0x45ebc6[_0xbe3d('0x2c')][_0xbe3d('0x2c')],'FaxAccountId':_0x45ebc6[_0xbe3d('0x3d')]['id'],'FaxInteractionId':_0x273199['id'],'direction':'in','ContactId':_0x273199['ContactId'],'AttachmentId':_0x45ebc6['body'][_0xbe3d('0x4c')]});})[_0xbe3d('0xe')](function(_0x3c8fcf){_0x48cd7d[_0xbe3d('0x17')]=_0x3c8fcf;if(_0x48cd7d[_0xbe3d('0x4a')][_0xbe3d('0x4d')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x48cd7d[_0xbe3d('0x4a')][_0xbe3d('0x4d')]}})[_0xbe3d('0xe')](function(_0x4c3628){if(_0x4c3628){_0x48cd7d['applications'][_0xbe3d('0x4e')]({'id':0x0,'priority':0x0,'app':_0xbe3d('0x4f'),'appdata':_0x4c3628[_0xbe3d('0x50')]+','+(_0x48cd7d[_0xbe3d('0x3d')]['waitForTheAssignedAgent']||0xa),'interval':_0xbe3d('0x48')});}return respondWithRpcPromise('Start',_0xbe3d('0x51'),_0x48cd7d);});}return respondWithRpcPromise('Start','startRouting',_0x48cd7d);})[_0xbe3d('0xe')](function(_0x25e8e9){_0xb06265(_0x25e8e9);})[_0xbe3d('0x18')](function(_0x4e48a5){_0x10aaf8(_0x521fcd['error'](0x1f4,_0x4e48a5[_0xbe3d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 57ffffc..8b6e44e 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 _0x92db=['removeListener','register','length','faxAccount:','remove','emit'];(function(_0x5f50eb,_0x3e7d18){var _0xb912b6=function(_0x19d99d){while(--_0x19d99d){_0x5f50eb['push'](_0x5f50eb['shift']());}};_0xb912b6(++_0x3e7d18);}(_0x92db,0x154));var _0xb92d=function(_0x17873c,_0x5b6a58){_0x17873c=_0x17873c-0x0;var _0x547a57=_0x92db[_0x17873c];return _0x547a57;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xb92d('0x0'),'update'];function createListener(_0x38f67c,_0x1bdb5f){return function(_0x27f844){_0x1bdb5f[_0xb92d('0x1')](_0x38f67c,_0x27f844);};}function removeListener(_0x20d3cd,_0x13e901){return function(){FaxAccountEvents[_0xb92d('0x2')](_0x20d3cd,_0x13e901);};}exports[_0xb92d('0x3')]=function(_0x4c69fe){for(var _0x66771c=0x0,_0x3fab49=events[_0xb92d('0x4')];_0x66771c<_0x3fab49;_0x66771c++){var _0x5e52e2=events[_0x66771c];var _0x386775=createListener(_0xb92d('0x5')+_0x5e52e2,_0x4c69fe);FaxAccountEvents['on'](_0x5e52e2,_0x386775);}}; \ No newline at end of file +var _0xd666=['remove','emit','removeListener','length','./faxAccount.events'];(function(_0x1baa84,_0x3c938e){var _0x18523b=function(_0x120137){while(--_0x120137){_0x1baa84['push'](_0x1baa84['shift']());}};_0x18523b(++_0x3c938e);}(_0xd666,0x86));var _0x6d66=function(_0x31b57a,_0x3dddf3){_0x31b57a=_0x31b57a-0x0;var _0x2df3dd=_0xd666[_0x31b57a];return _0x2df3dd;};'use strict';var FaxAccountEvents=require(_0x6d66('0x0'));var events=['save',_0x6d66('0x1'),'update'];function createListener(_0x13e3e5,_0x3886a9){return function(_0x27ad0e){_0x3886a9[_0x6d66('0x2')](_0x13e3e5,_0x27ad0e);};}function removeListener(_0x188150,_0x4b69f0){return function(){FaxAccountEvents[_0x6d66('0x3')](_0x188150,_0x4b69f0);};}exports['register']=function(_0x1371ba){for(var _0x674767=0x0,_0x1bbcc6=events[_0x6d66('0x4')];_0x674767<_0x1bbcc6;_0x674767++){var _0x5306e7=events[_0x674767];var _0x424a1d=createListener('faxAccount:'+_0x5306e7,_0x1371ba);FaxAccountEvents['on'](_0x5306e7,_0x424a1d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 8a73723..acdd8a0 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(_0x49c008,_0x15dfd1){var _0x2626e4=function(_0xc1bfbd){while(--_0xc1bfbd){_0x49c008['push'](_0x49c008['shift']());}};_0x2626e4(++_0x15dfd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x3f498c,_0x571a61){var _0x12fd70=function(_0x41ad31){while(--_0x41ad31){_0x3f498c['push'](_0x3f498c['shift']());}};_0x12fd70(++_0x571a61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 ddae938..bee53b4 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 _0x2abf=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x2abf,0x182));var _0xf2ab=function(_0x28833b,_0x7b4698){_0x28833b=_0x28833b-0x0;var _0x20c7c1=_0x2abf[_0x28833b];return _0x20c7c1;};'use strict';var Sequelize=require(_0xf2ab('0x0'));module[_0xf2ab('0x1')]={'priority':{'type':Sequelize[_0xf2ab('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf2ab('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf2ab('0x4')]()},'description':{'type':Sequelize[_0xf2ab('0x3')]},'interval':{'type':Sequelize[_0xf2ab('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x31b8=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x31b8,0x1df));var _0x831b=function(_0x55c631,_0x3c2611){_0x55c631=_0x55c631-0x0;var _0x52dacf=_0x31b8[_0x55c631];return _0x52dacf;};'use strict';var Sequelize=require(_0x831b('0x0'));module[_0x831b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x831b('0x2')],'allowNull':![],'defaultValue':_0x831b('0x3')},'appdata':{'type':Sequelize[_0x831b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x831b('0x2')],'defaultValue':_0x831b('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7800413..c1fd7ab 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 _0x977a=['options','then','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../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','Content-Range','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','index','map','FaxApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0xb87143,_0x32d55a){var _0x3b57bd=function(_0x1c00bd){while(--_0x1c00bd){_0xb87143['push'](_0xb87143['shift']());}};_0x3b57bd(++_0x32d55a);}(_0x977a,0xa7));var _0xa977=function(_0x42fdeb,_0x310c4b){_0x42fdeb=_0x42fdeb-0x0;var _0x50bc60=_0x977a[_0x42fdeb];return _0x50bc60;};'use strict';var emlformat=require(_0xa977('0x0'));var rimraf=require(_0xa977('0x1'));var zipdir=require(_0xa977('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa977('0x3'));var moment=require(_0xa977('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa977('0x5'));var util=require(_0xa977('0x6'));var path=require(_0xa977('0x7'));var sox=require(_0xa977('0x8'));var csv=require(_0xa977('0x9'));var ejs=require(_0xa977('0xa'));var fs=require('fs');var fs_extra=require(_0xa977('0xb'));var _=require(_0xa977('0xc'));var squel=require(_0xa977('0xd'));var crypto=require(_0xa977('0xe'));var jsforce=require(_0xa977('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa977('0x9'));var querystring=require(_0xa977('0x10'));var Papa=require('papaparse');var Redis=require(_0xa977('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa977('0x12'));var as=require(_0xa977('0x13'));var hardwareService=require(_0xa977('0x14'));var logger=require(_0xa977('0x15'))(_0xa977('0x16'));var utils=require(_0xa977('0x17'));var config=require(_0xa977('0x18'));var licenseUtil=require(_0xa977('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4400ef,_0xf9a99){_0xf9a99=_0xf9a99||0xcc;return function(_0x11468f){if(_0x11468f){return _0x4400ef['sendStatus'](_0xf9a99);}return _0x4400ef[_0xa977('0x1a')](_0xf9a99)['end']();};}function respondWithResult(_0x3fabca,_0x4d9e4b){_0x4d9e4b=_0x4d9e4b||0xc8;return function(_0x13a31a){if(_0x13a31a){return _0x3fabca[_0xa977('0x1a')](_0x4d9e4b)['json'](_0x13a31a);}};}function respondWithFilteredResult(_0x4d5689,_0x299f39){return function(_0x3a24e0){if(_0x3a24e0){var _0x9c2d39=typeof _0x299f39[_0xa977('0x1b')]==='undefined'&&typeof _0x299f39['limit']===_0xa977('0x1c');var _0x52a5cf=_0x3a24e0['count'];var _0x1d5bdb=_0x9c2d39?0x0:_0x299f39[_0xa977('0x1b')];var _0x2afb0a=_0x9c2d39?_0x3a24e0[_0xa977('0x1d')]:_0x299f39[_0xa977('0x1b')]+_0x299f39[_0xa977('0x1e')];var _0xa10edf;if(_0x2afb0a>=_0x52a5cf){_0x2afb0a=_0x52a5cf;_0xa10edf=0xc8;}else{_0xa10edf=0xce;}_0x4d5689[_0xa977('0x1a')](_0xa10edf);return _0x4d5689[_0xa977('0x1f')](_0xa977('0x20'),_0x1d5bdb+'-'+_0x2afb0a+'/'+_0x52a5cf)['json'](_0x3a24e0);}return null;};}function patchUpdates(_0x57dd57){return function(_0x536066){try{jsonpatch[_0xa977('0x21')](_0x536066,_0x57dd57,!![]);}catch(_0x40d240){return BPromise[_0xa977('0x22')](_0x40d240);}return _0x536066[_0xa977('0x23')]();};}function saveUpdates(_0x359b05,_0x6148a8){return function(_0x179108){if(_0x179108){return _0x179108[_0xa977('0x24')](_0x359b05)['then'](function(_0xb8de68){return _0xb8de68;});}return null;};}function removeEntity(_0x2ef370,_0x4efb10){return function(_0x267511){if(_0x267511){return _0x267511[_0xa977('0x25')]()['then'](function(){_0x2ef370['status'](0xcc)[_0xa977('0x26')]();});}};}function handleEntityNotFound(_0x53d9bd,_0x113793){return function(_0x493ab7){if(!_0x493ab7){_0x53d9bd[_0xa977('0x27')](0x194);}return _0x493ab7;};}function handleError(_0x359d91,_0x21e77a){_0x21e77a=_0x21e77a||0x1f4;return function(_0x279e03){logger[_0xa977('0x28')](_0x279e03[_0xa977('0x29')]);if(_0x279e03[_0xa977('0x2a')]){delete _0x279e03[_0xa977('0x2a')];}_0x359d91[_0xa977('0x1a')](_0x21e77a)['send'](_0x279e03);};}exports[_0xa977('0x2b')]=function(_0x248675,_0x3f32fb){var _0x332853={},_0x33d103={},_0x5933ca={'count':0x0,'rows':[]};var _0x89f13f=_[_0xa977('0x2c')](db[_0xa977('0x2d')][_0xa977('0x2e')],function(_0x221e92){return{'name':_0x221e92['fieldName'],'type':_0x221e92[_0xa977('0x2f')][_0xa977('0x30')]};});_0x33d103[_0xa977('0x31')]=_[_0xa977('0x2c')](_0x89f13f,_0xa977('0x2a'));_0x33d103[_0xa977('0x32')]=_[_0xa977('0x33')](_0x248675[_0xa977('0x32')]);_0x33d103[_0xa977('0x34')]=_[_0xa977('0x35')](_0x33d103['model'],_0x33d103['query']);_0x332853[_0xa977('0x36')]=_[_0xa977('0x35')](_0x33d103[_0xa977('0x31')],qs[_0xa977('0x37')](_0x248675[_0xa977('0x32')][_0xa977('0x37')]));_0x332853['attributes']=_0x332853[_0xa977('0x36')]['length']?_0x332853[_0xa977('0x36')]:_0x33d103[_0xa977('0x31')];if(!_0x248675[_0xa977('0x32')][_0xa977('0x38')](_0xa977('0x39'))){_0x332853[_0xa977('0x1e')]=qs[_0xa977('0x1e')](_0x248675['query'][_0xa977('0x1e')]);_0x332853[_0xa977('0x1b')]=qs['offset'](_0x248675['query'][_0xa977('0x1b')]);}_0x332853[_0xa977('0x3a')]=qs[_0xa977('0x3b')](_0x248675[_0xa977('0x32')]['sort']);_0x332853['where']=qs[_0xa977('0x34')](_[_0xa977('0x3c')](_0x248675[_0xa977('0x32')],_0x33d103[_0xa977('0x34')]),_0x89f13f);if(_0x248675[_0xa977('0x32')][_0xa977('0x3d')]){_0x332853[_0xa977('0x3e')]=_[_0xa977('0x3f')](_0x332853[_0xa977('0x3e')],{'$or':_[_0xa977('0x2c')](_0x89f13f,function(_0x3aab8b){if(_0x3aab8b[_0xa977('0x2f')]!=='VIRTUAL'){var _0x49b12f={};_0x49b12f[_0x3aab8b[_0xa977('0x2a')]]={'$like':'%'+_0x248675[_0xa977('0x32')][_0xa977('0x3d')]+'%'};return _0x49b12f;}})});}_0x332853=_['merge']({},_0x332853,_0x248675[_0xa977('0x40')]);var _0x38c458={'where':_0x332853[_0xa977('0x3e')]};return db[_0xa977('0x2d')][_0xa977('0x1d')](_0x38c458)[_0xa977('0x41')](function(_0x147369){_0x5933ca[_0xa977('0x1d')]=_0x147369;if(_0x248675['query']['includeAll']){_0x332853[_0xa977('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0xa977('0x43')](_0x332853);})[_0xa977('0x41')](function(_0x445511){_0x5933ca[_0xa977('0x44')]=_0x445511;return _0x5933ca;})[_0xa977('0x41')](respondWithFilteredResult(_0x3f32fb,_0x332853))[_0xa977('0x45')](handleError(_0x3f32fb,null));};exports[_0xa977('0x46')]=function(_0x35f32a,_0xc5d78a){var _0x40cc5b={'raw':!![],'where':{'id':_0x35f32a[_0xa977('0x47')]['id']}},_0x1153fb={};_0x1153fb[_0xa977('0x31')]=_['keys'](db[_0xa977('0x2d')][_0xa977('0x2e')]);_0x1153fb[_0xa977('0x32')]=_[_0xa977('0x33')](_0x35f32a['query']);_0x1153fb[_0xa977('0x34')]=_[_0xa977('0x35')](_0x1153fb[_0xa977('0x31')],_0x1153fb['query']);_0x40cc5b[_0xa977('0x36')]=_[_0xa977('0x35')](_0x1153fb[_0xa977('0x31')],qs['fields'](_0x35f32a['query'][_0xa977('0x37')]));_0x40cc5b[_0xa977('0x36')]=_0x40cc5b[_0xa977('0x36')][_0xa977('0x48')]?_0x40cc5b[_0xa977('0x36')]:_0x1153fb[_0xa977('0x31')];if(_0x35f32a[_0xa977('0x32')][_0xa977('0x49')]){_0x40cc5b[_0xa977('0x42')]=[{'all':!![]}];}_0x40cc5b=_['merge']({},_0x40cc5b,_0x35f32a[_0xa977('0x40')]);return db[_0xa977('0x2d')][_0xa977('0x4a')](_0x40cc5b)[_0xa977('0x41')](handleEntityNotFound(_0xc5d78a,null))[_0xa977('0x41')](respondWithResult(_0xc5d78a,null))[_0xa977('0x45')](handleError(_0xc5d78a,null));};exports[_0xa977('0x4b')]=function(_0x46ba98,_0x45da71){return db[_0xa977('0x2d')][_0xa977('0x4b')](_0x46ba98[_0xa977('0x4c')],{})[_0xa977('0x41')](respondWithResult(_0x45da71,0xc9))['catch'](handleError(_0x45da71,null));};exports['update']=function(_0x2b8d49,_0x3420a9){if(_0x2b8d49[_0xa977('0x4c')]['id']){delete _0x2b8d49[_0xa977('0x4c')]['id'];}return db[_0xa977('0x2d')]['find']({'where':{'id':_0x2b8d49['params']['id']}})[_0xa977('0x41')](handleEntityNotFound(_0x3420a9,null))[_0xa977('0x41')](saveUpdates(_0x2b8d49[_0xa977('0x4c')],null))[_0xa977('0x41')](respondWithResult(_0x3420a9,null))['catch'](handleError(_0x3420a9,null));};exports[_0xa977('0x25')]=function(_0x36e27c,_0x5bb294){return db[_0xa977('0x2d')][_0xa977('0x4a')]({'where':{'id':_0x36e27c[_0xa977('0x47')]['id']}})[_0xa977('0x41')](handleEntityNotFound(_0x5bb294,null))['then'](removeEntity(_0x5bb294,null))[_0xa977('0x45')](handleError(_0x5bb294,null));}; \ No newline at end of file +var _0xa67a=['hasOwnProperty','order','sort','filters','filter','where','merge','options','FaxApplication','then','includeAll','include','findAll','rows','catch','params','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','destroy','error','name','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x224d93,_0x1877c0){var _0x540d7a=function(_0x1aca47){while(--_0x1aca47){_0x224d93['push'](_0x224d93['shift']());}};_0x540d7a(++_0x1877c0);}(_0xa67a,0xeb));var _0xaa67=function(_0x279471,_0x23c0c6){_0x279471=_0x279471-0x0;var _0x8a2cd1=_0xa67a[_0x279471];return _0x8a2cd1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa67('0x0'));var jsonpatch=require(_0xaa67('0x1'));var rp=require(_0xaa67('0x2'));var moment=require(_0xaa67('0x3'));var BPromise=require(_0xaa67('0x4'));var Mustache=require(_0xaa67('0x5'));var util=require(_0xaa67('0x6'));var path=require(_0xaa67('0x7'));var sox=require(_0xaa67('0x8'));var csv=require(_0xaa67('0x9'));var ejs=require(_0xaa67('0xa'));var fs=require('fs');var fs_extra=require(_0xaa67('0xb'));var _=require(_0xaa67('0xc'));var squel=require(_0xaa67('0xd'));var crypto=require(_0xaa67('0xe'));var jsforce=require(_0xaa67('0xf'));var deskjs=require(_0xaa67('0x10'));var toCsv=require(_0xaa67('0x9'));var querystring=require('querystring');var Papa=require(_0xaa67('0x11'));var Redis=require(_0xaa67('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa67('0x13'));var hardwareService=require(_0xaa67('0x14'));var logger=require(_0xaa67('0x15'))(_0xaa67('0x16'));var utils=require(_0xaa67('0x17'));var config=require(_0xaa67('0x18'));var licenseUtil=require(_0xaa67('0x19'));var db=require(_0xaa67('0x1a'))['db'];function respondWithStatusCode(_0x10488d,_0x3ba7ff){_0x3ba7ff=_0x3ba7ff||0xcc;return function(_0x4ed327){if(_0x4ed327){return _0x10488d[_0xaa67('0x1b')](_0x3ba7ff);}return _0x10488d[_0xaa67('0x1c')](_0x3ba7ff)[_0xaa67('0x1d')]();};}function respondWithResult(_0x42f34e,_0x225b22){_0x225b22=_0x225b22||0xc8;return function(_0x1bbc49){if(_0x1bbc49){return _0x42f34e[_0xaa67('0x1c')](_0x225b22)[_0xaa67('0x1e')](_0x1bbc49);}};}function respondWithFilteredResult(_0x58438d,_0x54f227){return function(_0x416260){if(_0x416260){var _0x3a57a5=typeof _0x54f227['offset']===_0xaa67('0x1f')&&typeof _0x54f227[_0xaa67('0x20')]==='undefined';var _0x322ecc=_0x416260[_0xaa67('0x21')];var _0x141b51=_0x3a57a5?0x0:_0x54f227[_0xaa67('0x22')];var _0x1ca043=_0x3a57a5?_0x416260[_0xaa67('0x21')]:_0x54f227[_0xaa67('0x22')]+_0x54f227[_0xaa67('0x20')];var _0x5b7231;if(_0x1ca043>=_0x322ecc){_0x1ca043=_0x322ecc;_0x5b7231=0xc8;}else{_0x5b7231=0xce;}_0x58438d[_0xaa67('0x1c')](_0x5b7231);return _0x58438d['set']('Content-Range',_0x141b51+'-'+_0x1ca043+'/'+_0x322ecc)['json'](_0x416260);}return null;};}function patchUpdates(_0x1988a0){return function(_0x2adb41){try{jsonpatch[_0xaa67('0x23')](_0x2adb41,_0x1988a0,!![]);}catch(_0x53cc58){return BPromise[_0xaa67('0x24')](_0x53cc58);}return _0x2adb41[_0xaa67('0x25')]();};}function saveUpdates(_0xcce17e,_0x163a17){return function(_0x438eb5){if(_0x438eb5){return _0x438eb5[_0xaa67('0x26')](_0xcce17e)['then'](function(_0x21db02){return _0x21db02;});}return null;};}function removeEntity(_0x33d1f2,_0x288a0c){return function(_0xd9f26f){if(_0xd9f26f){return _0xd9f26f[_0xaa67('0x27')]()['then'](function(){_0x33d1f2['status'](0xcc)[_0xaa67('0x1d')]();});}};}function handleEntityNotFound(_0x4c73c4,_0x43dc05){return function(_0xa7fbc9){if(!_0xa7fbc9){_0x4c73c4[_0xaa67('0x1b')](0x194);}return _0xa7fbc9;};}function handleError(_0x478427,_0xbd6f11){_0xbd6f11=_0xbd6f11||0x1f4;return function(_0x3b2886){logger[_0xaa67('0x28')](_0x3b2886['stack']);if(_0x3b2886[_0xaa67('0x29')]){delete _0x3b2886['name'];}_0x478427[_0xaa67('0x1c')](_0xbd6f11)['send'](_0x3b2886);};}exports['index']=function(_0x1478a2,_0x2ceb92){var _0x12b11c={},_0xd60421={},_0x240cfb={'count':0x0,'rows':[]};var _0x2c97f8=_[_0xaa67('0x2a')](db['FaxApplication'][_0xaa67('0x2b')],function(_0x12704d){return{'name':_0x12704d['fieldName'],'type':_0x12704d[_0xaa67('0x2c')][_0xaa67('0x2d')]};});_0xd60421[_0xaa67('0x2e')]=_[_0xaa67('0x2a')](_0x2c97f8,'name');_0xd60421[_0xaa67('0x2f')]=_[_0xaa67('0x30')](_0x1478a2[_0xaa67('0x2f')]);_0xd60421['filters']=_[_0xaa67('0x31')](_0xd60421[_0xaa67('0x2e')],_0xd60421[_0xaa67('0x2f')]);_0x12b11c[_0xaa67('0x32')]=_[_0xaa67('0x31')](_0xd60421[_0xaa67('0x2e')],qs[_0xaa67('0x33')](_0x1478a2[_0xaa67('0x2f')][_0xaa67('0x33')]));_0x12b11c['attributes']=_0x12b11c['attributes'][_0xaa67('0x34')]?_0x12b11c[_0xaa67('0x32')]:_0xd60421[_0xaa67('0x2e')];if(!_0x1478a2[_0xaa67('0x2f')][_0xaa67('0x35')]('nolimit')){_0x12b11c[_0xaa67('0x20')]=qs['limit'](_0x1478a2['query'][_0xaa67('0x20')]);_0x12b11c[_0xaa67('0x22')]=qs['offset'](_0x1478a2[_0xaa67('0x2f')][_0xaa67('0x22')]);}_0x12b11c[_0xaa67('0x36')]=qs[_0xaa67('0x37')](_0x1478a2[_0xaa67('0x2f')][_0xaa67('0x37')]);_0x12b11c['where']=qs[_0xaa67('0x38')](_['pick'](_0x1478a2['query'],_0xd60421[_0xaa67('0x38')]),_0x2c97f8);if(_0x1478a2[_0xaa67('0x2f')][_0xaa67('0x39')]){_0x12b11c[_0xaa67('0x3a')]=_['merge'](_0x12b11c['where'],{'$or':_[_0xaa67('0x2a')](_0x2c97f8,function(_0x4628c7){if(_0x4628c7[_0xaa67('0x2c')]!=='VIRTUAL'){var _0x477694={};_0x477694[_0x4628c7[_0xaa67('0x29')]]={'$like':'%'+_0x1478a2[_0xaa67('0x2f')][_0xaa67('0x39')]+'%'};return _0x477694;}})});}_0x12b11c=_[_0xaa67('0x3b')]({},_0x12b11c,_0x1478a2[_0xaa67('0x3c')]);var _0x50c2c7={'where':_0x12b11c[_0xaa67('0x3a')]};return db[_0xaa67('0x3d')][_0xaa67('0x21')](_0x50c2c7)[_0xaa67('0x3e')](function(_0xe0985b){_0x240cfb[_0xaa67('0x21')]=_0xe0985b;if(_0x1478a2[_0xaa67('0x2f')][_0xaa67('0x3f')]){_0x12b11c[_0xaa67('0x40')]=[{'all':!![]}];}return db[_0xaa67('0x3d')][_0xaa67('0x41')](_0x12b11c);})[_0xaa67('0x3e')](function(_0x53f151){_0x240cfb[_0xaa67('0x42')]=_0x53f151;return _0x240cfb;})[_0xaa67('0x3e')](respondWithFilteredResult(_0x2ceb92,_0x12b11c))[_0xaa67('0x43')](handleError(_0x2ceb92,null));};exports['show']=function(_0x5ce662,_0x3be513){var _0x32b90a={'raw':!![],'where':{'id':_0x5ce662[_0xaa67('0x44')]['id']}},_0x35a000={};_0x35a000['model']=_[_0xaa67('0x30')](db[_0xaa67('0x3d')]['rawAttributes']);_0x35a000[_0xaa67('0x2f')]=_[_0xaa67('0x30')](_0x5ce662[_0xaa67('0x2f')]);_0x35a000[_0xaa67('0x38')]=_[_0xaa67('0x31')](_0x35a000[_0xaa67('0x2e')],_0x35a000['query']);_0x32b90a[_0xaa67('0x32')]=_[_0xaa67('0x31')](_0x35a000[_0xaa67('0x2e')],qs[_0xaa67('0x33')](_0x5ce662[_0xaa67('0x2f')][_0xaa67('0x33')]));_0x32b90a[_0xaa67('0x32')]=_0x32b90a[_0xaa67('0x32')][_0xaa67('0x34')]?_0x32b90a[_0xaa67('0x32')]:_0x35a000['model'];if(_0x5ce662['query']['includeAll']){_0x32b90a[_0xaa67('0x40')]=[{'all':!![]}];}_0x32b90a=_['merge']({},_0x32b90a,_0x5ce662['options']);return db[_0xaa67('0x3d')][_0xaa67('0x45')](_0x32b90a)[_0xaa67('0x3e')](handleEntityNotFound(_0x3be513,null))[_0xaa67('0x3e')](respondWithResult(_0x3be513,null))[_0xaa67('0x43')](handleError(_0x3be513,null));};exports[_0xaa67('0x46')]=function(_0xc50b7a,_0x2b9b85){return db[_0xaa67('0x3d')]['create'](_0xc50b7a[_0xaa67('0x47')],{})[_0xaa67('0x3e')](respondWithResult(_0x2b9b85,0xc9))[_0xaa67('0x43')](handleError(_0x2b9b85,null));};exports[_0xaa67('0x26')]=function(_0x49310d,_0x5be01a){if(_0x49310d[_0xaa67('0x47')]['id']){delete _0x49310d[_0xaa67('0x47')]['id'];}return db[_0xaa67('0x3d')][_0xaa67('0x45')]({'where':{'id':_0x49310d['params']['id']}})[_0xaa67('0x3e')](handleEntityNotFound(_0x5be01a,null))[_0xaa67('0x3e')](saveUpdates(_0x49310d[_0xaa67('0x47')],null))['then'](respondWithResult(_0x5be01a,null))[_0xaa67('0x43')](handleError(_0x5be01a,null));};exports[_0xaa67('0x27')]=function(_0x42a183,_0x39a619){return db[_0xaa67('0x3d')][_0xaa67('0x45')]({'where':{'id':_0x42a183['params']['id']}})[_0xaa67('0x3e')](handleEntityNotFound(_0x39a619,null))['then'](removeEntity(_0x39a619,null))['catch'](handleError(_0x39a619,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 1ba65f9..153177d 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 _0x66e0=['./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x26373e,_0x1586ad){var _0x56b09d=function(_0x27cee9){while(--_0x27cee9){_0x26373e['push'](_0x26373e['shift']());}};_0x56b09d(++_0x1586ad);}(_0x66e0,0x8a));var _0x066e=function(_0x57f5a0,_0x2cba61){_0x57f5a0=_0x57f5a0-0x0;var _0x272865=_0x66e0[_0x57f5a0];return _0x272865;};'use strict';var _=require(_0x066e('0x0'));var util=require('util');var logger=require(_0x066e('0x1'))(_0x066e('0x2'));var moment=require(_0x066e('0x3'));var BPromise=require('bluebird');var rp=require(_0x066e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x066e('0x5'));var config=require('../../config/environment');var attributes=require(_0x066e('0x6'));module[_0x066e('0x7')]=function(_0x2cbe35,_0xda93a6){return _0x2cbe35[_0x066e('0x8')](_0x066e('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x066e('0xa'),'collate':_0x066e('0xb')});}; \ No newline at end of file +var _0x0532=['FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define'];(function(_0x59db37,_0xb9f095){var _0xad4427=function(_0x1ebe2b){while(--_0x1ebe2b){_0x59db37['push'](_0x59db37['shift']());}};_0xad4427(++_0xb9f095);}(_0x0532,0x121));var _0x2053=function(_0x6c1df8,_0xa27677){_0x6c1df8=_0x6c1df8-0x0;var _0x452d15=_0x0532[_0x6c1df8];return _0x452d15;};'use strict';var _=require(_0x2053('0x0'));var util=require(_0x2053('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2053('0x2'));var BPromise=require('bluebird');var rp=require(_0x2053('0x3'));var fs=require('fs');var path=require(_0x2053('0x4'));var rimraf=require(_0x2053('0x5'));var config=require(_0x2053('0x6'));var attributes=require(_0x2053('0x7'));module[_0x2053('0x8')]=function(_0x34887d,_0x41d9b4){return _0x34887d[_0x2053('0x9')](_0x2053('0xa'),attributes,{'tableName':_0x2053('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2053('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 3834c85..fb600f6 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 _0x1666=['http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x557e47,_0x3a471e){var _0x433c38=function(_0x10ef0e){while(--_0x10ef0e){_0x557e47['push'](_0x557e47['shift']());}};_0x433c38(++_0x3a471e);}(_0x1666,0x75));var _0x6166=function(_0x30b302,_0x111399){_0x30b302=_0x30b302-0x0;var _0xb6e513=_0x1666[_0x30b302];return _0xb6e513;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var moment=require('moment');var BPromise=require(_0x6166('0x2'));var rs=require(_0x6166('0x3'));var fs=require('fs');var Redis=require(_0x6166('0x4'));var db=require(_0x6166('0x5'))['db'];var utils=require(_0x6166('0x6'));var logger=require(_0x6166('0x7'))(_0x6166('0x8'));var config=require(_0x6166('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6166('0xa')][_0x6166('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x211a92,_0x1a61d0,_0x3a29ca){return new BPromise(function(_0x4873da,_0x51b51f){return client['request'](_0x211a92,_0x3a29ca)[_0x6166('0xc')](function(_0x5ee7b3){logger[_0x6166('0xd')](_0x6166('0xe'),_0x1a61d0,_0x6166('0xf'));logger[_0x6166('0x10')](_0x6166('0x11'),_0x1a61d0,_0x6166('0xf'),JSON[_0x6166('0x12')](_0x5ee7b3));if(_0x5ee7b3['error']){if(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x14')]===0x1f4){logger[_0x6166('0x13')]('FaxApplication,\x20%s,\x20%s',_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x51b51f(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}logger['error'](_0x6166('0xe'),_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x4873da(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}else{logger[_0x6166('0xd')]('FaxApplication,\x20%s,\x20%s',_0x1a61d0,_0x6166('0xf'));_0x4873da(_0x5ee7b3[_0x6166('0x16')][_0x6166('0x15')]);}})[_0x6166('0x17')](function(_0x24bdf3){logger[_0x6166('0x13')](_0x6166('0xe'),_0x1a61d0,_0x24bdf3);_0x51b51f(_0x24bdf3);});});}exports['UpdateFaxApplication']=function(_0x29764d){var _0x411477=this;return new Promise(function(_0x171795,_0x4642d0){return db[_0x6166('0x18')]['update'](_0x29764d[_0x6166('0x19')],{'raw':_0x29764d[_0x6166('0x1a')]?_0x29764d[_0x6166('0x1a')][_0x6166('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29764d[_0x6166('0x1a')]?_0x29764d[_0x6166('0x1a')][_0x6166('0x1c')]||null:null,'attributes':_0x29764d[_0x6166('0x1a')]?_0x29764d[_0x6166('0x1a')][_0x6166('0x1d')]||null:null,'limit':_0x29764d[_0x6166('0x1a')]?_0x29764d['options'][_0x6166('0x1e')]||null:null})[_0x6166('0xc')](function(_0x4b0810){logger[_0x6166('0xd')](_0x6166('0x1f'),_0x29764d);logger[_0x6166('0x10')](_0x6166('0x1f'),_0x29764d,JSON[_0x6166('0x12')](_0x4b0810));_0x171795(_0x4b0810);})['catch'](function(_0x2909d9){logger['error'](_0x6166('0x1f'),_0x2909d9[_0x6166('0x15')],_0x29764d);_0x4642d0(_0x411477['error'](0x1f4,_0x2909d9[_0x6166('0x15')]));});});}; \ No newline at end of file +var _0x96ab=['result','catch','UpdateFaxApplication','update','options','raw','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x10756b,_0x39e615){var _0x3df928=function(_0xf50e14){while(--_0xf50e14){_0x10756b['push'](_0x10756b['shift']());}};_0x3df928(++_0x39e615);}(_0x96ab,0x12a));var _0xb96a=function(_0x31106e,_0x112f35){_0x31106e=_0x31106e-0x0;var _0x2fd231=_0x96ab[_0x31106e];return _0x2fd231;};'use strict';var _=require(_0xb96a('0x0'));var util=require(_0xb96a('0x1'));var moment=require(_0xb96a('0x2'));var BPromise=require(_0xb96a('0x3'));var rs=require(_0xb96a('0x4'));var fs=require('fs');var Redis=require(_0xb96a('0x5'));var db=require(_0xb96a('0x6'))['db'];var utils=require(_0xb96a('0x7'));var logger=require(_0xb96a('0x8'))(_0xb96a('0x9'));var config=require('../../config/environment');var jayson=require(_0xb96a('0xa'));var client=jayson['client'][_0xb96a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25a16f,_0x500545,_0x1164ef){return new BPromise(function(_0x53274d,_0x536b00){return client[_0xb96a('0xc')](_0x25a16f,_0x1164ef)[_0xb96a('0xd')](function(_0xd94178){logger[_0xb96a('0xe')](_0xb96a('0xf'),_0x500545,_0xb96a('0x10'));logger[_0xb96a('0x11')](_0xb96a('0x12'),_0x500545,_0xb96a('0x10'),JSON['stringify'](_0xd94178));if(_0xd94178[_0xb96a('0x13')]){if(_0xd94178['error'][_0xb96a('0x14')]===0x1f4){logger[_0xb96a('0x13')]('FaxApplication,\x20%s,\x20%s',_0x500545,_0xd94178[_0xb96a('0x13')]['message']);return _0x536b00(_0xd94178['error'][_0xb96a('0x15')]);}logger[_0xb96a('0x13')](_0xb96a('0xf'),_0x500545,_0xd94178['error'][_0xb96a('0x15')]);return _0x53274d(_0xd94178['error'][_0xb96a('0x15')]);}else{logger[_0xb96a('0xe')](_0xb96a('0xf'),_0x500545,_0xb96a('0x10'));_0x53274d(_0xd94178[_0xb96a('0x16')][_0xb96a('0x15')]);}})[_0xb96a('0x17')](function(_0x5b6c95){logger['error']('FaxApplication,\x20%s,\x20%s',_0x500545,_0x5b6c95);_0x536b00(_0x5b6c95);});});}exports[_0xb96a('0x18')]=function(_0x211d91){var _0x111c6b=this;return new Promise(function(_0x423ef7,_0x15c70b){return db['FaxApplication'][_0xb96a('0x19')](_0x211d91['body'],{'raw':_0x211d91[_0xb96a('0x1a')]?_0x211d91[_0xb96a('0x1a')][_0xb96a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x211d91['options']?_0x211d91['options'][_0xb96a('0x1c')]||null:null,'attributes':_0x211d91['options']?_0x211d91[_0xb96a('0x1a')][_0xb96a('0x1d')]||null:null,'limit':_0x211d91[_0xb96a('0x1a')]?_0x211d91[_0xb96a('0x1a')][_0xb96a('0x1e')]||null:null})[_0xb96a('0xd')](function(_0x2d18b1){logger[_0xb96a('0xe')](_0xb96a('0x18'),_0x211d91);logger[_0xb96a('0x11')]('UpdateFaxApplication',_0x211d91,JSON[_0xb96a('0x1f')](_0x2d18b1));_0x423ef7(_0x2d18b1);})[_0xb96a('0x17')](function(_0x4f915b){logger[_0xb96a('0x13')](_0xb96a('0x18'),_0x4f915b['message'],_0x211d91);_0x15c70b(_0x111c6b[_0xb96a('0x13')](0x1f4,_0x4f915b[_0xb96a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 5f50c74..1d5febd 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 _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','express'];(function(_0x673604,_0x1ad10a){var _0x20d4bd=function(_0x59d175){while(--_0x59d175){_0x673604['push'](_0x673604['shift']());}};_0x20d4bd(++_0x1ad10a);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5b504b,_0x8985e){_0x5b504b=_0x5b504b-0x0;var _0x5cc4b2=_0xdd4f[_0x5b504b];return _0x5cc4b2;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./faxApplication.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['post']('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')]('/:id',auth[_0xfdd4('0x7')](),controller['update']);router[_0xfdd4('0xd')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file +var _0xb688=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xb688,0xcf));var _0x8b68=function(_0x3cdc87,_0x4d1769){_0x3cdc87=_0x3cdc87-0x0;var _0x1a58ae=_0xb688[_0x3cdc87];return _0x1a58ae;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0xe')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x10')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index dbf4c54..94552bc 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 _0xfa55=['BOOLEAN','STRING','DATE','ENUM','out','exports'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0xfa55,0x1d9));var _0x5fa5=function(_0x4692f9,_0x1e3293){_0x4692f9=_0x4692f9-0x0;var _0x4f20f0=_0xfa55[_0x4692f9];return _0x4f20f0;};'use strict';var Sequelize=require('sequelize');module[_0x5fa5('0x0')]={'closed':{'type':Sequelize[_0x5fa5('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5fa5('0x2')]},'secondDisposition':{'type':Sequelize[_0x5fa5('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5fa5('0x2')]},'note':{'type':Sequelize[_0x5fa5('0x2')]},'read1stAt':{'type':Sequelize[_0x5fa5('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x5fa5('0x4')]('in',_0x5fa5('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5fa5('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5fa5('0x4')]('in',_0x5fa5('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xbb8b=['exports','BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x198680,_0x13c5ad){var _0x44381a=function(_0x35b74c){while(--_0x35b74c){_0x198680['push'](_0x198680['shift']());}};_0x44381a(++_0x13c5ad);}(_0xbb8b,0x101));var _0xbbb8=function(_0x45f556,_0x58a9bb){_0x45f556=_0x45f556-0x0;var _0x46bb2e=_0xbb8b[_0x45f556];return _0x46bb2e;};'use strict';var Sequelize=require(_0xbbb8('0x0'));module[_0xbbb8('0x1')]={'closed':{'type':Sequelize[_0xbbb8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbbb8('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbbb8('0x4')]},'thirdDisposition':{'type':Sequelize[_0xbbb8('0x4')]},'note':{'type':Sequelize[_0xbbb8('0x4')]},'read1stAt':{'type':Sequelize[_0xbbb8('0x3')]},'fax':{'type':Sequelize[_0xbbb8('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbbb8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbbb8('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbbb8('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 5cedfdd..e54d5ae 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 _0xaef3=['it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','find','unreadMessages','value','`\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?','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','clone','i.id','contactName','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','options','create','update','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','nolimit','pick','format','includeAll','include','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','log','unlinkSync','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','select','field','color','tools_tags','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags'];(function(_0x1466bd,_0x40673a){var _0x194ef8=function(_0x34d774){while(--_0x34d774){_0x1466bd['push'](_0x1466bd['shift']());}};_0x194ef8(++_0x40673a);}(_0xaef3,0x87));var _0x3aef=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0xaef3[_0x543242];return _0x4c99b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3aef('0x0'));var zipdir=require(_0x3aef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3aef('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3aef('0x3'));var util=require(_0x3aef('0x4'));var path=require(_0x3aef('0x5'));var sox=require(_0x3aef('0x6'));var csv=require(_0x3aef('0x7'));var ejs=require(_0x3aef('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3aef('0x9'));var squel=require(_0x3aef('0xa'));var crypto=require('crypto');var jsforce=require(_0x3aef('0xb'));var deskjs=require(_0x3aef('0xc'));var toCsv=require(_0x3aef('0x7'));var querystring=require(_0x3aef('0xd'));var Papa=require(_0x3aef('0xe'));var Redis=require(_0x3aef('0xf'));var authService=require(_0x3aef('0x10'));var qs=require(_0x3aef('0x11'));var as=require(_0x3aef('0x12'));var hardwareService=require(_0x3aef('0x13'));var logger=require(_0x3aef('0x14'))(_0x3aef('0x15'));var utils=require(_0x3aef('0x16'));var config=require(_0x3aef('0x17'));var licenseUtil=require(_0x3aef('0x18'));var db=require(_0x3aef('0x19'))['db'];config['redis']=_[_0x3aef('0x1a')](config[_0x3aef('0x1b')],{'host':_0x3aef('0x1c'),'port':0x18eb});var socket=require(_0x3aef('0x1d'))(new Redis(config[_0x3aef('0x1b')]));require(_0x3aef('0x1e'))[_0x3aef('0x1f')](socket);function respondWithStatusCode(_0x367dca,_0x44b681){_0x44b681=_0x44b681||0xcc;return function(_0x1a1b49){if(_0x1a1b49){return _0x367dca[_0x3aef('0x20')](_0x44b681);}return _0x367dca[_0x3aef('0x21')](_0x44b681)[_0x3aef('0x22')]();};}function respondWithResult(_0x20bc00,_0x454e1b){_0x454e1b=_0x454e1b||0xc8;return function(_0x4aee3c){if(_0x4aee3c){return _0x20bc00[_0x3aef('0x21')](_0x454e1b)[_0x3aef('0x23')](_0x4aee3c);}};}function respondWithFilteredResult(_0x1e0a7a,_0x4d28af){return function(_0x435191){if(_0x435191){var _0x5387b5=typeof _0x4d28af[_0x3aef('0x24')]===_0x3aef('0x25')&&typeof _0x4d28af[_0x3aef('0x26')]===_0x3aef('0x25');var _0x24ac43=_0x435191[_0x3aef('0x27')];var _0x21c061=_0x5387b5?0x0:_0x4d28af[_0x3aef('0x24')];var _0x26749b=_0x5387b5?_0x435191[_0x3aef('0x27')]:_0x4d28af[_0x3aef('0x24')]+_0x4d28af[_0x3aef('0x26')];var _0x22cc54;if(_0x26749b>=_0x24ac43){_0x26749b=_0x24ac43;_0x22cc54=0xc8;}else{_0x22cc54=0xce;}_0x1e0a7a['status'](_0x22cc54);return _0x1e0a7a[_0x3aef('0x28')](_0x3aef('0x29'),_0x21c061+'-'+_0x26749b+'/'+_0x24ac43)[_0x3aef('0x23')](_0x435191);}return null;};}function patchUpdates(_0x50b0fc){return function(_0x25e618){try{jsonpatch[_0x3aef('0x2a')](_0x25e618,_0x50b0fc,!![]);}catch(_0x337540){return BPromise[_0x3aef('0x2b')](_0x337540);}return _0x25e618[_0x3aef('0x2c')]();};}function saveUpdates(_0x5ea44c,_0x10c8e1){return function(_0x4dcc6b){if(_0x4dcc6b){return _0x4dcc6b['update'](_0x5ea44c)[_0x3aef('0x2d')](function(_0x2a22c1){return _0x2a22c1;});}return null;};}function removeEntity(_0x394c2f,_0x22c237){return function(_0x163153){if(_0x163153){return _0x163153[_0x3aef('0x2e')]()[_0x3aef('0x2d')](function(){_0x394c2f[_0x3aef('0x21')](0xcc)[_0x3aef('0x22')]();});}};}function handleEntityNotFound(_0x3b04f1,_0x1efbc4){return function(_0x42e784){if(!_0x42e784){_0x3b04f1[_0x3aef('0x20')](0x194);}return _0x42e784;};}function handleError(_0x10e9b8,_0x18262b){_0x18262b=_0x18262b||0x1f4;return function(_0x5239f7){logger[_0x3aef('0x2f')](_0x5239f7[_0x3aef('0x30')]);if(_0x5239f7[_0x3aef('0x31')]){delete _0x5239f7[_0x3aef('0x31')];}_0x10e9b8[_0x3aef('0x21')](_0x18262b)[_0x3aef('0x32')](_0x5239f7);};}function getInteractionUsers(_0x264f79,_0x3ee4ac){return new BPromise(function(_0x1e1392,_0x4cd970){try{if(_0x3ee4ac[_0x264f79['id']]){_0x264f79[_0x3aef('0x33')]=_[_0x3aef('0x34')](_0x3ee4ac[_0x264f79['id']],function(_0x2a440f){return{'id':_0x2a440f['id'],'fullname':_0x2a440f[_0x3aef('0x35')]};});}}catch(_0x1cdacd){_0x4cd970(_0x1cdacd);}_0x1e1392(_0x264f79);});}function getInteractionTags(_0x4d39d4,_0x2a6d88){return new BPromise(function(_0x14cc5d,_0x101203){try{if(_0x4d39d4[_0x3aef('0x36')]){_0x4d39d4[_0x3aef('0x37')]=[];_0x4d39d4['TagIds'][_0x3aef('0x38')](',')[_0x3aef('0x39')](function(_0x1d9567){_0x4d39d4[_0x3aef('0x37')][_0x3aef('0x3a')](_0x2a6d88[_0x1d9567]);});}delete _0x4d39d4[_0x3aef('0x36')];}catch(_0x2c828a){_0x101203(_0x2c828a);}_0x14cc5d(_0x4d39d4);});}function updateFaxInteraction(_0x2d56fd,_0x283b34,_0x3dff43){return new BPromise(function(_0x1ddeb3,_0x51aa9b){return getInteractionUsers(_0x2d56fd,_0x3dff43)['then'](function(_0x699ca0){return getInteractionTags(_0x699ca0,_0x283b34);})['then'](function(_0x2c4b89){_0x1ddeb3(_0x2c4b89);})[_0x3aef('0x3b')](function(_0x4c2ffe){_0x51aa9b(_0x4c2ffe);});});}exports['index']=function(_0x169f05,_0x585e05){var _0x36f66a={},_0x3f203e={},_0x2f5401={'count':0x0,'rows':[]};var _0x5a8fa5=_[_0x3aef('0x34')](db['FaxInteraction'][_0x3aef('0x3c')],function(_0x120d8c){return{'name':_0x120d8c[_0x3aef('0x3d')],'type':_0x120d8c[_0x3aef('0x3e')][_0x3aef('0x3f')]};});_0x3f203e[_0x3aef('0x40')]=_[_0x3aef('0x34')](_0x5a8fa5,_0x3aef('0x31'));_0x3f203e['query']=_[_0x3aef('0x41')](_0x169f05[_0x3aef('0x42')]);_0x3f203e[_0x3aef('0x43')]=_[_0x3aef('0x44')](_0x3f203e[_0x3aef('0x40')],_0x3f203e[_0x3aef('0x42')]);_0x36f66a['attributes']=_['intersection'](_0x3f203e[_0x3aef('0x40')],qs[_0x3aef('0x45')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x45')]));_0x36f66a[_0x3aef('0x46')]=_0x36f66a[_0x3aef('0x46')][_0x3aef('0x47')]?_0x36f66a[_0x3aef('0x46')]:_0x3f203e[_0x3aef('0x40')];if(!_0x169f05[_0x3aef('0x42')][_0x3aef('0x48')]('nolimit')){_0x36f66a[_0x3aef('0x26')]=qs[_0x3aef('0x26')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x26')]);_0x36f66a[_0x3aef('0x24')]=qs[_0x3aef('0x24')](_0x169f05['query'][_0x3aef('0x24')]);}_0x36f66a['order']=qs[_0x3aef('0x49')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x49')]);_0x36f66a['where']=qs[_0x3aef('0x43')](_['pick'](_0x169f05[_0x3aef('0x42')],_0x3f203e[_0x3aef('0x43')]),_0x5a8fa5);var _0x13a58b=[];var _0x4c19b3=squel[_0x3aef('0x4a')]()[_0x3aef('0x4b')]('id')[_0x3aef('0x4b')](_0x3aef('0x31'))['field'](_0x3aef('0x4c'))['from'](_0x3aef('0x4d'));var _0x4b6fce=squel['select']()[_0x3aef('0x4b')]('u.id')[_0x3aef('0x4b')](_0x3aef('0x4e'))[_0x3aef('0x4b')](_0x3aef('0x4f'))[_0x3aef('0x50')](_0x3aef('0x51'),'ui')[_0x3aef('0x52')](_0x3aef('0x53'),'u',_0x3aef('0x54'));var _0x57e28f=squel[_0x3aef('0x4a')]()['from']('fax_interactions','i')[_0x3aef('0x52')](_0x3aef('0x55'),'c',_0x3aef('0x56'))[_0x3aef('0x52')](_0x3aef('0x53'),'o',_0x3aef('0x57'))['left_join'](_0x3aef('0x58'),'a',_0x3aef('0x59'))['left_join'](_0x3aef('0x5a'),'me',_0x3aef('0x5b'))[_0x3aef('0x52')](_0x3aef('0x5c'),'it',_0x3aef('0x5d'))[_0x3aef('0x52')](_0x3aef('0x4d'),'t',_0x3aef('0x5e'));var _0x321e50=squel[_0x3aef('0x5f')]();var _0x8a57dc=[];var _0x32ae81=squel['expr']();var _0x253c3e;if(_0x169f05['query'][_0x3aef('0x60')]){_0x253c3e=as[_0x3aef('0x61')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x60')]);var _0x439d9c=_0x253c3e['sqlOperator'];for(var _0x53eeb8=0x0;_0x53eeb8<_0x253c3e['conditions']['length'];_0x53eeb8++){var _0x3d4658=_0x253c3e['conditions'][_0x53eeb8];var _0x2c3813='i';var _0x585e48=_[_0x3aef('0x62')](_0x5a8fa5,[_0x3aef('0x31'),_0x3d4658['field']]);if(!_0x585e48){switch(_0x3d4658['field']){case _0x3aef('0x63'):if(_0x3d4658[_0x3aef('0x64')]==0x1){_0x57e28f['having']('`'+_0x3d4658[_0x3aef('0x4b')]+_0x3aef('0x65'));}else{_0x57e28f['having']('`'+_0x3d4658[_0x3aef('0x4b')]+_0x3aef('0x66'));}break;case _0x3aef('0x67'):if(_0x3d4658[_0x3aef('0x68')]===_0x3aef('0x69')){if(_0x3d4658[_0x3aef('0x64')][_0x3aef('0x38')]('\x20')[_0x3aef('0x47')]>0x1){_0x321e50[_0x439d9c](_0x3aef('0x6a'),qs[_0x3aef('0x6b')](_0x3d4658[_0x3aef('0x64')]),null);}else{var _0x5521ce='%'+_0x3d4658[_0x3aef('0x64')]+'%';_0x321e50[_0x439d9c](_0x3aef('0x6c'),_0x5521ce,_0x5521ce,_0x5521ce);}}else{_0x585e48=_['find'](_0x5a8fa5,[_0x3aef('0x31'),_0x3aef('0x6d')]);_0x3d4658[_0x3aef('0x4b')]=_0x3aef('0x6d');_0x43810c=as[_0x3aef('0x6e')](_0x2c3813,_0x585e48['type'],_0x3d4658);_0x321e50[_0x439d9c](_0x43810c[_0x3aef('0x6f')],_0x43810c[_0x3aef('0x64')][_0x3aef('0x70')],_0x43810c[_0x3aef('0x64')][_0x3aef('0x22')]);}break;case _0x3aef('0x71'):var _0x39224b=_0x3d4658[_0x3aef('0x64')][_0x3aef('0x38')](',')['map'](function(_0x1bfcb4){return Number(_0x1bfcb4);});_0x39224b[_0x3aef('0x39')](function(_0x5784f9){_0x32ae81['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5784f9+',%');});_0x8a57dc=_[_0x3aef('0x72')](_0x8a57dc,_0x39224b);break;case _0x3aef('0x73'):if(_0x3d4658[_0x3aef('0x68')]===_0x3aef('0x69')){_0x321e50[_0x439d9c](_0x3aef('0x74'),'%'+_0x3d4658[_0x3aef('0x64')]+'%',null);}else{_0x585e48=_[_0x3aef('0x62')](_0x5a8fa5,[_0x3aef('0x31'),_0x3aef('0x75')]);_0x3d4658[_0x3aef('0x4b')]=_0x3aef('0x75');_0x43810c=as[_0x3aef('0x6e')](_0x2c3813,_0x585e48[_0x3aef('0x3e')],_0x3d4658);_0x321e50[_0x439d9c](_0x43810c[_0x3aef('0x6f')],_0x43810c[_0x3aef('0x64')]['start'],_0x43810c['value'][_0x3aef('0x22')]);}break;case _0x3aef('0x76'):_0x43810c=as[_0x3aef('0x6e')]('me',null,_0x3d4658);_0x321e50[_0x439d9c](_0x43810c['text'],_0x43810c[_0x3aef('0x64')][_0x3aef('0x70')],_0x43810c['value'][_0x3aef('0x22')]);break;}}else{var _0x43810c=as[_0x3aef('0x6e')](_0x2c3813,_0x585e48[_0x3aef('0x3e')],_0x3d4658);_0x321e50[_0x439d9c](_0x43810c[_0x3aef('0x6f')],_0x43810c['value'][_0x3aef('0x70')],_0x43810c['value']['end']);}}}else{var _0x3d0eb8=_(_0x169f05[_0x3aef('0x42')])[_0x3aef('0x41')]()[_0x3aef('0x34')](function(_0x4418b1){return _['some'](_0x5a8fa5,[_0x3aef('0x31'),_0x4418b1])?_0x4418b1:undefined;})[_0x3aef('0x77')]()[_0x3aef('0x64')]();if(!_[_0x3aef('0x78')](_0x3d0eb8)){_0x3d0eb8[_0x3aef('0x39')](function(_0x5149a5){if(_0x5149a5===_0x3aef('0x79')){_0x57e28f['where'](_0x3aef('0x7a'),[]['concat'](_0x169f05[_0x3aef('0x42')][_0x5149a5]));}else if(_0x5149a5===_0x3aef('0x7b')){var _0x30aba0=JSON[_0x3aef('0x7c')](_0x169f05['query'][_0x5149a5])[_0x3aef('0x7d')];var _0x23aaa6=JSON[_0x3aef('0x7c')](_0x169f05[_0x3aef('0x42')][_0x5149a5])[_0x3aef('0x7e')];_0x57e28f[_0x3aef('0x7f')](_0x3aef('0x80'),_0x30aba0,_0x23aaa6);}else{if(_0x169f05[_0x3aef('0x42')][_0x5149a5]===_0x3aef('0x81')){_0x57e28f[_0x3aef('0x7f')]('i.'+_0x5149a5+_0x3aef('0x82'));}else{_0x57e28f[_0x3aef('0x7f')]('i.'+_0x5149a5+_0x3aef('0x83'),_0x169f05[_0x3aef('0x42')][_0x5149a5]);}}});}if(_0x169f05[_0x3aef('0x42')]['read']){if(_0x169f05[_0x3aef('0x42')][_0x3aef('0x84')]==0x1){_0x57e28f[_0x3aef('0x85')](_0x3aef('0x86'));}else{_0x57e28f[_0x3aef('0x85')]('`unreadMessages`\x20>\x200');}}if(_0x169f05[_0x3aef('0x42')][_0x3aef('0x87')]){_0x8a57dc=_[_0x3aef('0x88')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x87')])?_0x169f05[_0x3aef('0x42')]['tag']:new Array(_0x169f05[_0x3aef('0x42')][_0x3aef('0x87')]);_0x8a57dc[_0x3aef('0x39')](function(_0x1ac642){_0x32ae81['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ac642+',%');});}if(_0x169f05[_0x3aef('0x42')][_0x3aef('0x89')]){var _0x2969f0=_0x169f05[_0x3aef('0x42')][_0x3aef('0x89')][_0x3aef('0x8a')]('\x5c','\x5c\x5c')[_0x3aef('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2969f0)){_0x321e50['or'](_0x3aef('0x8b'),_0x2969f0+'%')['or'](_0x3aef('0x8c'),_0x2969f0+'%');}_0x321e50['or'](_0x3aef('0x8d'),_0x2969f0+'%');}}_0x57e28f[_0x3aef('0x7f')](_0x321e50);_0x57e28f[_0x3aef('0x8e')]('i.id');var _0xe67c0={'type':db['Sequelize']['QueryTypes'][_0x3aef('0x8f')],'raw':!![]};var _0x1a6aff=_0x57e28f[_0x3aef('0x90')]();_0x1a6aff[_0x3aef('0x4b')](_0x3aef('0x91'));_0x1a6aff[_0x3aef('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x36f66a['order']){_0x36f66a['order']['forEach'](function(_0xfdd8fc){var _0x33de7a=_0xfdd8fc[0x0]===_0x3aef('0x92')?_0xfdd8fc[0x0]:'i.'+_0xfdd8fc[0x0];_0x57e28f[_0x3aef('0x93')](_0x33de7a,_0xfdd8fc[0x1]===_0x3aef('0x94')?![]:!![]);});}if(!_[_0x3aef('0x78')](_0x8a57dc)){_0x57e28f[_0x3aef('0x85')](_0x32ae81);_0x1a6aff['where'](_0x3aef('0x95'),_0x8a57dc);}BPromise[_0x3aef('0x96')]()[_0x3aef('0x2d')](function(){if(!_0x253c3e){if(_0x169f05[_0x3aef('0x42')]['FaxAccountId'])return;_0x1a6aff[_0x3aef('0x7f')](_0x3aef('0x97'));_0x57e28f[_0x3aef('0x7f')](_0x3aef('0x97'));return;}if(_0x169f05[_0x3aef('0x98')][_0x3aef('0x99')]!==_0x3aef('0x9a'))return;return _0x169f05[_0x3aef('0x98')][_0x3aef('0x9b')]({'attributes':['id'],'raw':!![]})[_0x3aef('0x2d')](function(_0xd19bc3){if(_[_0x3aef('0x78')](_0xd19bc3)){_0x1a6aff[_0x3aef('0x7f')](_0x3aef('0x9c'));_0x57e28f[_0x3aef('0x7f')](_0x3aef('0x9c'));}else{_0x1a6aff[_0x3aef('0x7f')](_0x3aef('0x7a'),_[_0x3aef('0x34')](_0xd19bc3,'id'));_0x57e28f[_0x3aef('0x7f')](_0x3aef('0x7a'),_['map'](_0xd19bc3,'id'));}});})[_0x3aef('0x2d')](function(){if(_0x169f05['user'][_0x3aef('0x99')]===_0x3aef('0x9a')&&!_0x253c3e&&!_0x169f05['query']['FaxAccountId'])return[];return db['sequelize'][_0x3aef('0x42')](_0x1a6aff[_0x3aef('0x9d')](),_0xe67c0);})[_0x3aef('0x2d')](function(_0x536c79){_0x2f5401[_0x3aef('0x27')]=_0x536c79[_0x3aef('0x47')];if(_0x2f5401[_0x3aef('0x27')]===0x0)return[];return db[_0x3aef('0x9e')][_0x3aef('0x42')](_0x4c19b3['toString'](),_0xe67c0)['then'](function(_0x3b6f7e){_0x13a58b=_[_0x3aef('0x9f')](_0x3b6f7e,'id');_0xe67c0=_[_0x3aef('0xa0')](_0xe67c0,{'model':db[_0x3aef('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x169f05[_0x3aef('0x42')][_0x3aef('0x45')]){_0x36f66a[_0x3aef('0x46')][_0x3aef('0x39')](function(_0x3b90c9){_0x57e28f[_0x3aef('0x4b')]('i.'+_0x3b90c9);});}else{_0x57e28f[_0x3aef('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3aef('0x63'));_0x57e28f['field'](_0x3aef('0xa2'),_0x3aef('0xa3'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xa4'),_0x3aef('0xa5'));_0x57e28f['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3aef('0x92'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xa6'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xa7'),_0x3aef('0xa8'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xa9'),_0x3aef('0xaa'));_0x57e28f[_0x3aef('0x4b')]('c.email',_0x3aef('0xab'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xac'),_0x3aef('0xad'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xae'),_0x3aef('0xaf'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xb0'),_0x3aef('0xb1'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xb2'),_0x3aef('0xb3'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xb4'),_0x3aef('0xb5'));_0x57e28f['field'](_0x3aef('0xb6'),'TagIds');}if(_0x36f66a['limit'])_0x57e28f[_0x3aef('0x26')](_0x36f66a[_0x3aef('0x26')]);if(_0x36f66a[_0x3aef('0x24')])_0x57e28f[_0x3aef('0x24')](_0x36f66a['offset']);return db['sequelize'][_0x3aef('0x42')](_0x57e28f['toString'](),_0xe67c0);})[_0x3aef('0x2d')](function(_0x323fbe){if(_0x323fbe[_0x3aef('0x47')]>0x0)_0x4b6fce[_0x3aef('0x7f')](_0x3aef('0xb7'),_[_0x3aef('0x34')](_0x323fbe,'id'));return db[_0x3aef('0x9e')][_0x3aef('0x42')](_0x4b6fce[_0x3aef('0x9d')](),_0xe67c0)[_0x3aef('0x2d')](function(_0x4baebe){var _0x103b34=_[_0x3aef('0xb8')](_0x4baebe,_0x3aef('0xb9'));var _0x294778=[];_0x323fbe['forEach'](function(_0x11d869){_0x294778[_0x3aef('0x3a')](updateFaxInteraction(_0x11d869,_0x13a58b,_0x103b34));});return BPromise[_0x3aef('0xba')](_0x294778);});});})[_0x3aef('0x2d')](function(_0x539a4b){_0x2f5401['rows']=_0x539a4b;return _0x2f5401;})['then'](respondWithFilteredResult(_0x585e05,_0x36f66a))['catch'](handleError(_0x585e05,null));};exports[_0x3aef('0xbb')]=function(_0x2bea25,_0x1413de){var _0x3d98db={'raw':![],'where':{'id':_0x2bea25[_0x3aef('0xbc')]['id']}},_0x328b87={};_0x328b87[_0x3aef('0x40')]=_[_0x3aef('0x41')](db[_0x3aef('0xa1')][_0x3aef('0x3c')]);_0x328b87['query']=_['keys'](_0x2bea25[_0x3aef('0x42')]);_0x328b87[_0x3aef('0x43')]=_['intersection'](_0x328b87['model'],_0x328b87[_0x3aef('0x42')]);_0x3d98db[_0x3aef('0x46')]=_['intersection'](_0x328b87[_0x3aef('0x40')],qs[_0x3aef('0x45')](_0x2bea25[_0x3aef('0x42')][_0x3aef('0x45')]));_0x3d98db['attributes']=_0x3d98db[_0x3aef('0x46')][_0x3aef('0x47')]?_0x3d98db['attributes']:_0x328b87['model'];if(_0x2bea25[_0x3aef('0x42')]['includeAll']){_0x3d98db['include']=[{'all':!![]}];}_0x3d98db=_[_0x3aef('0xa0')]({},_0x3d98db,_0x2bea25[_0x3aef('0xbd')]);return db[_0x3aef('0xa1')]['find'](_0x3d98db)['then'](handleEntityNotFound(_0x1413de,null))[_0x3aef('0x2d')](respondWithResult(_0x1413de,null))[_0x3aef('0x3b')](handleError(_0x1413de,null));};exports[_0x3aef('0xbe')]=function(_0x393c2c,_0x181f20){return db[_0x3aef('0xa1')][_0x3aef('0xbe')](_0x393c2c[_0x3aef('0x76')],{})[_0x3aef('0x2d')](respondWithResult(_0x181f20,0xc9))['catch'](handleError(_0x181f20,null));};exports[_0x3aef('0xbf')]=function(_0x16d0c2,_0x2bc66b){if(_0x16d0c2['body']['id']){delete _0x16d0c2['body']['id'];}return db[_0x3aef('0xa1')]['find']({'where':{'id':_0x16d0c2[_0x3aef('0xbc')]['id']}})['then'](handleEntityNotFound(_0x2bc66b,null))[_0x3aef('0x2d')](saveUpdates(_0x16d0c2['body'],null))[_0x3aef('0x2d')](respondWithResult(_0x2bc66b,null))['catch'](handleError(_0x2bc66b,null));};exports[_0x3aef('0x2e')]=function(_0x10ffbf,_0x1ee622){return db[_0x3aef('0xa1')][_0x3aef('0x62')]({'where':{'id':_0x10ffbf['params']['id']}})[_0x3aef('0x2d')](handleEntityNotFound(_0x1ee622,null))[_0x3aef('0x2d')](removeEntity(_0x1ee622,null))[_0x3aef('0x3b')](handleError(_0x1ee622,null));};exports[_0x3aef('0xc0')]=function(_0x70f34a,_0xcd093b){return db[_0x3aef('0xa1')][_0x3aef('0xc0')]()[_0x3aef('0x2d')](respondWithResult(_0xcd093b,null))[_0x3aef('0x3b')](handleError(_0xcd093b,null));};exports[_0x3aef('0xc1')]=function(_0x1620c7,_0x3e6b33,_0x1078fb){return db[_0x3aef('0xc2')]['find']({'where':{'id':_0x1620c7['params']['id']}})[_0x3aef('0x2d')](handleEntityNotFound(_0x3e6b33,null))[_0x3aef('0x2d')](function(_0x58e0bb){if(_0x58e0bb){return _0x58e0bb[_0x3aef('0xc1')](_0x1620c7[_0x3aef('0x76')]['ids'],_[_0x3aef('0xc3')](_0x1620c7[_0x3aef('0x76')],[_0x3aef('0xc4'),'id'])||{});}})[_0x3aef('0x2d')](respondWithResult(_0x3e6b33,null))[_0x3aef('0x3b')](handleError(_0x3e6b33,null));};exports[_0x3aef('0xc5')]=function(_0x32c585,_0x3273a9,_0x3a27f0){var _0x51841c={'raw':![],'where':{}};var _0x30d8b4={};var _0x1399bd={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x3aef('0xc6')]({'where':{'id':_0x32c585[_0x3aef('0xbc')]['id']}})['then'](handleEntityNotFound(_0x3273a9,null))['then'](function(_0x9848f8){if(_0x9848f8){_0x30d8b4[_0x3aef('0x40')]=_[_0x3aef('0x41')](db['FaxMessage'][_0x3aef('0x3c')]);_0x30d8b4[_0x3aef('0x42')]=_[_0x3aef('0x41')](_0x32c585[_0x3aef('0x42')]);_0x30d8b4[_0x3aef('0x43')]=_[_0x3aef('0x44')](_0x30d8b4[_0x3aef('0x40')],_0x30d8b4[_0x3aef('0x42')]);_0x51841c[_0x3aef('0x46')]=_[_0x3aef('0x44')](_0x30d8b4['model'],qs[_0x3aef('0x45')](_0x32c585[_0x3aef('0x42')][_0x3aef('0x45')]));_0x51841c[_0x3aef('0x46')]=_0x51841c['attributes'][_0x3aef('0x47')]?_0x51841c['attributes']:_0x30d8b4[_0x3aef('0x40')];if(!_0x32c585['query'][_0x3aef('0x48')](_0x3aef('0xc7'))){_0x51841c[_0x3aef('0x26')]=qs[_0x3aef('0x26')](_0x32c585[_0x3aef('0x42')]['limit']);_0x51841c[_0x3aef('0x24')]=qs[_0x3aef('0x24')](_0x32c585[_0x3aef('0x42')]['offset']);}_0x51841c[_0x3aef('0x93')]=qs[_0x3aef('0x49')](_0x32c585[_0x3aef('0x42')][_0x3aef('0x49')]);_0x51841c[_0x3aef('0x7f')]=qs['filters'](_[_0x3aef('0xc8')](_0x32c585[_0x3aef('0x42')],_0x30d8b4['filters']));_0x51841c[_0x3aef('0x7f')][_0x3aef('0xb9')]=_0x9848f8['id'];if(_0x32c585[_0x3aef('0x42')][_0x3aef('0x89')]){_0x51841c['where']=_[_0x3aef('0xa0')](_0x51841c['where'],{'$or':_[_0x3aef('0x34')](_0x51841c[_0x3aef('0x46')],function(_0x1f3358){var _0x4c3afb={};_0x4c3afb[_0x1f3358]={'$like':'%'+_0x32c585['query'][_0x3aef('0x89')]+'%'};return _0x4c3afb;})});}if(_0x32c585[_0x3aef('0x42')][_0x3aef('0x7d')]){var _0x54463e=_0x32c585[_0x3aef('0x42')][_0x3aef('0x7d')]['split'](',');var _0x37215a={};_0x37215a[_0x54463e[0x0]]={'$gte':moment(_0x54463e[0x1])[_0x3aef('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x51841c[_0x3aef('0x7f')]=_[_0x3aef('0xa0')](_0x51841c['where'],_0x37215a);}_0x51841c=_[_0x3aef('0xa0')]({},_0x51841c,_0x32c585[_0x3aef('0xbd')]);return db[_0x3aef('0xc2')][_0x3aef('0x27')]({'where':_0x51841c['where']})[_0x3aef('0x2d')](function(_0x130556){_0x1399bd[_0x3aef('0x27')]=_0x130556;if(_0x32c585[_0x3aef('0x42')][_0x3aef('0xca')]){_0x51841c[_0x3aef('0xcb')]=[{'all':!![]}];}return db['FaxMessage'][_0x3aef('0xcc')](_0x51841c);})[_0x3aef('0x2d')](function(_0x2bc4df){_0x1399bd['rows']=_0x2bc4df;return _0x1399bd;});}})[_0x3aef('0x2d')](respondWithFilteredResult(_0x3273a9,_0x51841c))[_0x3aef('0x3b')](handleError(_0x3273a9,null));};exports[_0x3aef('0xcd')]=function(_0x37d052,_0x139201,_0x21fb41){return db[_0x3aef('0xa1')]['find']({'where':{'id':_0x37d052['params']['id']}})[_0x3aef('0x2d')](handleEntityNotFound(_0x139201,null))[_0x3aef('0x2d')](function(_0x469d3d){if(_0x469d3d){return _0x469d3d['setTags'](_0x37d052['body'][_0x3aef('0xc4')],_['omit'](_0x37d052[_0x3aef('0x76')],[_0x3aef('0xc4'),'id'])||{})[_0x3aef('0xce')](function(){return db['Tag'][_0x3aef('0xcc')]({'attributes':['id','name',_0x3aef('0x4c')],'where':{'id':_0x37d052['body']['ids']}});})['then'](function(_0x34c2fd){socket[_0x3aef('0xcf')](_0x3aef('0xd0'),{'id':Number(_0x37d052['params']['id']),'tags':_0x34c2fd||[]});return{'id':Number(_0x37d052[_0x3aef('0xbc')]['id']),'tags':_0x34c2fd||[]};});}})[_0x3aef('0x2d')](respondWithResult(_0x139201,null))[_0x3aef('0x3b')](handleError(_0x139201,null));};exports[_0x3aef('0xd1')]=function(_0x4f73dc,_0x16769b,_0x491527){return db[_0x3aef('0xa1')][_0x3aef('0x62')]({'where':{'id':_0x4f73dc[_0x3aef('0xbc')]['id']}})[_0x3aef('0x2d')](handleEntityNotFound(_0x16769b,null))[_0x3aef('0x2d')](function(_0x206df7){if(_0x206df7){return _0x206df7[_0x3aef('0xd1')](_0x4f73dc[_0x3aef('0x42')]['ids']);}})[_0x3aef('0x2d')](respondWithStatusCode(_0x16769b,null))[_0x3aef('0x3b')](handleError(_0x16769b,null));};exports[_0x3aef('0xd2')]=function(_0x250efe,_0x4a12f9){var _0x41cf3a=moment()[_0x3aef('0xd3')]()[_0x3aef('0x9d')]();var _0x257b66=path[_0x3aef('0xd4')](config[_0x3aef('0xd5')],_0x3aef('0xd6'),_0x3aef('0xd7'),_0x3aef('0xd8'));var _0x55e01c=path[_0x3aef('0xd4')](config[_0x3aef('0xd5')],_0x3aef('0xd6'),_0x3aef('0xd7'),_0x3aef('0xd9'));var _0x2ecc30=path[_0x3aef('0xd4')](_0x257b66,_0x41cf3a);var _0x446a01=util['format'](_0x3aef('0xda'),_0x250efe[_0x3aef('0xbc')]['id'],_0x41cf3a);var _0x2d1932=path[_0x3aef('0xd4')](_0x257b66,_0x446a01);var _0x16937e=[];_0x16937e[_0x3aef('0x3a')]({'model':db[_0x3aef('0xdb')],'as':'Attachment','raw':!![]});var _0x2b7e11=[{'model':db[_0x3aef('0xc2')],'as':_0x3aef('0xdc'),'attributes':['id',_0x3aef('0x76'),_0x3aef('0x7b')],'include':_0x16937e}];return db['FaxInteraction']['find']({'where':{'id':_0x250efe[_0x3aef('0xbc')]['id']},'include':_0x2b7e11})[_0x3aef('0x2d')](handleEntityNotFound(_0x4a12f9,null))[_0x3aef('0x2d')](function(_0x3b1d4e){if(_0x3b1d4e&&_0x3b1d4e['Messages']){var _0x27ae4a=_0x3b1d4e[_0x3aef('0xdd')]({'plain':!![]});fs[_0x3aef('0xde')](_0x2ecc30);for(var _0x2782fe=0x0;_0x2782fe<_0x27ae4a[_0x3aef('0xdc')][_0x3aef('0x47')];_0x2782fe++){var _0x5a396b=_0x27ae4a['Messages'][_0x2782fe]['Attachment'];if(_0x5a396b){var _0x51b0b1=path[_0x3aef('0xd4')](_0x55e01c,_0x5a396b[_0x3aef('0xdf')]);if(fs[_0x3aef('0xe0')](_0x51b0b1)){fs[_0x3aef('0xe1')](_0x51b0b1)['pipe'](fs['createWriteStream'](path[_0x3aef('0xd4')](_0x2ecc30,_0x5a396b['basename'])));}}}return BPromise[_0x3aef('0x96')]()[_0x3aef('0x2d')](function(){return new BPromise(function(_0x1a469a,_0x46f906){zipdir(_0x2ecc30,{'saveTo':_0x2d1932},function(_0x437491,_0x12a18b){if(_0x437491)return _0x46f906(_0x437491);return _0x1a469a(_0x12a18b);});})['then'](function(){return new BPromise(function(_0x327f41,_0x16f79c){rimraf(_0x2ecc30,function(_0x1179e2){if(_0x1179e2)_0x16f79c(_0x1179e2);return _0x327f41();});});})[_0x3aef('0x2d')](function(){return _0x4a12f9[_0x3aef('0xd2')](_0x2d1932,_0x446a01,function(_0x2ca210){if(_0x2ca210){console[_0x3aef('0xe2')]('err',_0x2ca210);}else{fs[_0x3aef('0xe3')](_0x2d1932);}});});});}else{return _0x4a12f9[_0x3aef('0x20')](0xc8);}})[_0x3aef('0x3b')](handleError(_0x4a12f9,null));}; \ No newline at end of file +var _0x9d8d=['addMessage','ids','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','omit','spread','Tag','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','log','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','querystring','../../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','./faxInteraction.socket','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','end','error','stack','name','send','map','TagIds','Tags','split','forEach','push','catch','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','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','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','start','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','keys','some','compact','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','toString','sequelize','keyBy','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','all','rows','params','intersection','includeAll','include','merge','options','create','describe','FaxMessage'];(function(_0x3f09ce,_0x4f8b7d){var _0x332e92=function(_0x1ceaaf){while(--_0x1ceaaf){_0x3f09ce['push'](_0x3f09ce['shift']());}};_0x332e92(++_0x4f8b7d);}(_0x9d8d,0x1cd));var _0xd9d8=function(_0x32251a,_0x469ebb){_0x32251a=_0x32251a-0x0;var _0x40ae29=_0x9d8d[_0x32251a];return _0x40ae29;};'use strict';var emlformat=require(_0xd9d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd9d8('0x1'));var jsonpatch=require(_0xd9d8('0x2'));var rp=require(_0xd9d8('0x3'));var moment=require('moment');var BPromise=require(_0xd9d8('0x4'));var Mustache=require('mustache');var util=require(_0xd9d8('0x5'));var path=require(_0xd9d8('0x6'));var sox=require(_0xd9d8('0x7'));var csv=require('to-csv');var ejs=require(_0xd9d8('0x8'));var fs=require('fs');var fs_extra=require(_0xd9d8('0x9'));var _=require('lodash');var squel=require(_0xd9d8('0xa'));var crypto=require(_0xd9d8('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd9d8('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd9d8('0xd'));var qs=require(_0xd9d8('0xe'));var as=require(_0xd9d8('0xf'));var hardwareService=require(_0xd9d8('0x10'));var logger=require(_0xd9d8('0x11'))(_0xd9d8('0x12'));var utils=require(_0xd9d8('0x13'));var config=require(_0xd9d8('0x14'));var licenseUtil=require(_0xd9d8('0x15'));var db=require(_0xd9d8('0x16'))['db'];config[_0xd9d8('0x17')]=_[_0xd9d8('0x18')](config[_0xd9d8('0x17')],{'host':_0xd9d8('0x19'),'port':0x18eb});var socket=require(_0xd9d8('0x1a'))(new Redis(config[_0xd9d8('0x17')]));require(_0xd9d8('0x1b'))[_0xd9d8('0x1c')](socket);function respondWithStatusCode(_0x397287,_0x2e2699){_0x2e2699=_0x2e2699||0xcc;return function(_0x26540d){if(_0x26540d){return _0x397287[_0xd9d8('0x1d')](_0x2e2699);}return _0x397287[_0xd9d8('0x1e')](_0x2e2699)['end']();};}function respondWithResult(_0x549e18,_0x390cdb){_0x390cdb=_0x390cdb||0xc8;return function(_0x29be41){if(_0x29be41){return _0x549e18[_0xd9d8('0x1e')](_0x390cdb)[_0xd9d8('0x1f')](_0x29be41);}};}function respondWithFilteredResult(_0x38ec88,_0x318e8e){return function(_0x5ac135){if(_0x5ac135){var _0xc79f4a=typeof _0x318e8e['offset']===_0xd9d8('0x20')&&typeof _0x318e8e['limit']==='undefined';var _0x56c5d8=_0x5ac135[_0xd9d8('0x21')];var _0x339b62=_0xc79f4a?0x0:_0x318e8e['offset'];var _0x11a000=_0xc79f4a?_0x5ac135[_0xd9d8('0x21')]:_0x318e8e[_0xd9d8('0x22')]+_0x318e8e[_0xd9d8('0x23')];var _0x1fa65a;if(_0x11a000>=_0x56c5d8){_0x11a000=_0x56c5d8;_0x1fa65a=0xc8;}else{_0x1fa65a=0xce;}_0x38ec88[_0xd9d8('0x1e')](_0x1fa65a);return _0x38ec88['set'](_0xd9d8('0x24'),_0x339b62+'-'+_0x11a000+'/'+_0x56c5d8)['json'](_0x5ac135);}return null;};}function patchUpdates(_0x1c0c02){return function(_0x23d7a6){try{jsonpatch[_0xd9d8('0x25')](_0x23d7a6,_0x1c0c02,!![]);}catch(_0x59ad8a){return BPromise[_0xd9d8('0x26')](_0x59ad8a);}return _0x23d7a6['save']();};}function saveUpdates(_0x41845f,_0x31f8a2){return function(_0x2c6ff6){if(_0x2c6ff6){return _0x2c6ff6[_0xd9d8('0x27')](_0x41845f)[_0xd9d8('0x28')](function(_0x498b3e){return _0x498b3e;});}return null;};}function removeEntity(_0x589de1,_0x1e0e5c){return function(_0x49b5f6){if(_0x49b5f6){return _0x49b5f6['destroy']()[_0xd9d8('0x28')](function(){_0x589de1[_0xd9d8('0x1e')](0xcc)[_0xd9d8('0x29')]();});}};}function handleEntityNotFound(_0x5d8594,_0x5a1067){return function(_0x187b71){if(!_0x187b71){_0x5d8594['sendStatus'](0x194);}return _0x187b71;};}function handleError(_0x5b3eaa,_0x3d9670){_0x3d9670=_0x3d9670||0x1f4;return function(_0xc080ed){logger[_0xd9d8('0x2a')](_0xc080ed[_0xd9d8('0x2b')]);if(_0xc080ed[_0xd9d8('0x2c')]){delete _0xc080ed[_0xd9d8('0x2c')];}_0x5b3eaa['status'](_0x3d9670)[_0xd9d8('0x2d')](_0xc080ed);};}function getInteractionUsers(_0xbefb86,_0x589dd8){return new BPromise(function(_0x123ed0,_0x4c0479){try{if(_0x589dd8[_0xbefb86['id']]){_0xbefb86['Users']=_[_0xd9d8('0x2e')](_0x589dd8[_0xbefb86['id']],function(_0xc97d9f){return{'id':_0xc97d9f['id'],'fullname':_0xc97d9f['fullname']};});}}catch(_0x4f5912){_0x4c0479(_0x4f5912);}_0x123ed0(_0xbefb86);});}function getInteractionTags(_0x3fe2a2,_0x4a67bc){return new BPromise(function(_0x10a3c1,_0xb12da4){try{if(_0x3fe2a2[_0xd9d8('0x2f')]){_0x3fe2a2[_0xd9d8('0x30')]=[];_0x3fe2a2['TagIds'][_0xd9d8('0x31')](',')[_0xd9d8('0x32')](function(_0x3ece44){_0x3fe2a2['Tags'][_0xd9d8('0x33')](_0x4a67bc[_0x3ece44]);});}delete _0x3fe2a2['TagIds'];}catch(_0x514f04){_0xb12da4(_0x514f04);}_0x10a3c1(_0x3fe2a2);});}function updateFaxInteraction(_0x2920de,_0x372be8,_0x447e59){return new BPromise(function(_0x3b40fa,_0x36ed39){return getInteractionUsers(_0x2920de,_0x447e59)[_0xd9d8('0x28')](function(_0x39b28a){return getInteractionTags(_0x39b28a,_0x372be8);})[_0xd9d8('0x28')](function(_0x21c654){_0x3b40fa(_0x21c654);})[_0xd9d8('0x34')](function(_0x102af9){_0x36ed39(_0x102af9);});});}exports['index']=function(_0x598214,_0x3b91de){var _0x1901f8={},_0x4432b6={},_0x4ef8cb={'count':0x0,'rows':[]};var _0x52a3a4=_[_0xd9d8('0x2e')](db['FaxInteraction'][_0xd9d8('0x35')],function(_0x24618e){return{'name':_0x24618e[_0xd9d8('0x36')],'type':_0x24618e[_0xd9d8('0x37')][_0xd9d8('0x38')]};});_0x4432b6[_0xd9d8('0x39')]=_[_0xd9d8('0x2e')](_0x52a3a4,_0xd9d8('0x2c'));_0x4432b6['query']=_['keys'](_0x598214[_0xd9d8('0x3a')]);_0x4432b6[_0xd9d8('0x3b')]=_['intersection'](_0x4432b6[_0xd9d8('0x39')],_0x4432b6[_0xd9d8('0x3a')]);_0x1901f8[_0xd9d8('0x3c')]=_['intersection'](_0x4432b6['model'],qs[_0xd9d8('0x3d')](_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x3d')]));_0x1901f8[_0xd9d8('0x3c')]=_0x1901f8[_0xd9d8('0x3c')][_0xd9d8('0x3e')]?_0x1901f8['attributes']:_0x4432b6['model'];if(!_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x3f')](_0xd9d8('0x40'))){_0x1901f8['limit']=qs[_0xd9d8('0x23')](_0x598214[_0xd9d8('0x3a')]['limit']);_0x1901f8[_0xd9d8('0x22')]=qs[_0xd9d8('0x22')](_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x22')]);}_0x1901f8[_0xd9d8('0x41')]=qs[_0xd9d8('0x42')](_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x42')]);_0x1901f8['where']=qs[_0xd9d8('0x3b')](_[_0xd9d8('0x43')](_0x598214[_0xd9d8('0x3a')],_0x4432b6['filters']),_0x52a3a4);var _0x464b39=[];var _0x48a2aa=squel[_0xd9d8('0x44')]()[_0xd9d8('0x45')]('id')[_0xd9d8('0x45')]('name')[_0xd9d8('0x45')](_0xd9d8('0x46'))[_0xd9d8('0x47')](_0xd9d8('0x48'));var _0x4305c1=squel[_0xd9d8('0x44')]()[_0xd9d8('0x45')](_0xd9d8('0x49'))[_0xd9d8('0x45')](_0xd9d8('0x4a'))[_0xd9d8('0x45')](_0xd9d8('0x4b'))[_0xd9d8('0x47')](_0xd9d8('0x4c'),'ui')[_0xd9d8('0x4d')](_0xd9d8('0x4e'),'u',_0xd9d8('0x4f'));var _0x33ba43=squel[_0xd9d8('0x44')]()['from'](_0xd9d8('0x50'),'i')[_0xd9d8('0x4d')](_0xd9d8('0x51'),'c',_0xd9d8('0x52'))[_0xd9d8('0x4d')](_0xd9d8('0x4e'),'o',_0xd9d8('0x53'))[_0xd9d8('0x4d')]('fax_accounts','a',_0xd9d8('0x54'))[_0xd9d8('0x4d')](_0xd9d8('0x55'),'me',_0xd9d8('0x56'))[_0xd9d8('0x4d')](_0xd9d8('0x57'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xd9d8('0x4d')](_0xd9d8('0x48'),'t',_0xd9d8('0x58'));var _0x246b4b=squel[_0xd9d8('0x59')]();var _0x4671be=[];var _0x2fa9ad=squel[_0xd9d8('0x59')]();var _0x2ecb6a;if(_0x598214[_0xd9d8('0x3a')]['search']){_0x2ecb6a=as[_0xd9d8('0x5a')](_0x598214['query'][_0xd9d8('0x5b')]);var _0x5d745b=_0x2ecb6a['sqlOperator'];for(var _0x540bd8=0x0;_0x540bd8<_0x2ecb6a[_0xd9d8('0x5c')][_0xd9d8('0x3e')];_0x540bd8++){var _0x35710f=_0x2ecb6a[_0xd9d8('0x5c')][_0x540bd8];var _0x137269='i';var _0x1d961f=_[_0xd9d8('0x5d')](_0x52a3a4,[_0xd9d8('0x2c'),_0x35710f['field']]);if(!_0x1d961f){switch(_0x35710f[_0xd9d8('0x45')]){case _0xd9d8('0x5e'):if(_0x35710f[_0xd9d8('0x5f')]==0x1){_0x33ba43[_0xd9d8('0x60')]('`'+_0x35710f[_0xd9d8('0x45')]+_0xd9d8('0x61'));}else{_0x33ba43[_0xd9d8('0x60')]('`'+_0x35710f['field']+'`\x20>\x200');}break;case'Contact':if(_0x35710f[_0xd9d8('0x62')]==='$substring'){if(_0x35710f[_0xd9d8('0x5f')][_0xd9d8('0x31')]('\x20')['length']>0x1){_0x246b4b[_0x5d745b](_0xd9d8('0x63'),qs[_0xd9d8('0x64')](_0x35710f['value']),null);}else{var _0x5f259a='%'+_0x35710f[_0xd9d8('0x5f')]+'%';_0x246b4b[_0x5d745b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5f259a,_0x5f259a,_0x5f259a);}}else{_0x1d961f=_[_0xd9d8('0x5d')](_0x52a3a4,['name','ContactId']);_0x35710f[_0xd9d8('0x45')]=_0xd9d8('0x65');_0xfb9e9=as['buildExpression'](_0x137269,_0x1d961f[_0xd9d8('0x37')],_0x35710f);_0x246b4b[_0x5d745b](_0xfb9e9['text'],_0xfb9e9['value'][_0xd9d8('0x66')],_0xfb9e9[_0xd9d8('0x5f')][_0xd9d8('0x29')]);}break;case'Tag':var _0x3389f5=_0x35710f[_0xd9d8('0x5f')][_0xd9d8('0x31')](',')[_0xd9d8('0x2e')](function(_0x23eeab){return Number(_0x23eeab);});_0x3389f5[_0xd9d8('0x32')](function(_0x3b3984){_0x2fa9ad['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3b3984+',%');});_0x4671be=_[_0xd9d8('0x67')](_0x4671be,_0x3389f5);break;case _0xd9d8('0x68'):if(_0x35710f[_0xd9d8('0x62')]===_0xd9d8('0x69')){_0x246b4b[_0x5d745b](_0xd9d8('0x6a'),'%'+_0x35710f['value']+'%',null);}else{_0x1d961f=_['find'](_0x52a3a4,[_0xd9d8('0x2c'),_0xd9d8('0x6b')]);_0x35710f['field']=_0xd9d8('0x6b');_0xfb9e9=as[_0xd9d8('0x6c')](_0x137269,_0x1d961f[_0xd9d8('0x37')],_0x35710f);_0x246b4b[_0x5d745b](_0xfb9e9[_0xd9d8('0x6d')],_0xfb9e9[_0xd9d8('0x5f')][_0xd9d8('0x66')],_0xfb9e9['value'][_0xd9d8('0x29')]);}break;case _0xd9d8('0x6e'):_0xfb9e9=as['buildExpression']('me',null,_0x35710f);_0x246b4b[_0x5d745b](_0xfb9e9['text'],_0xfb9e9['value'][_0xd9d8('0x66')],_0xfb9e9['value'][_0xd9d8('0x29')]);break;}}else{var _0xfb9e9=as[_0xd9d8('0x6c')](_0x137269,_0x1d961f[_0xd9d8('0x37')],_0x35710f);_0x246b4b[_0x5d745b](_0xfb9e9[_0xd9d8('0x6d')],_0xfb9e9[_0xd9d8('0x5f')]['start'],_0xfb9e9[_0xd9d8('0x5f')][_0xd9d8('0x29')]);}}}else{var _0x45be84=_(_0x598214[_0xd9d8('0x3a')])[_0xd9d8('0x6f')]()['map'](function(_0x4b7605){return _[_0xd9d8('0x70')](_0x52a3a4,['name',_0x4b7605])?_0x4b7605:undefined;})[_0xd9d8('0x71')]()[_0xd9d8('0x5f')]();if(!_['isEmpty'](_0x45be84)){_0x45be84[_0xd9d8('0x32')](function(_0x3083ba){if(_0x3083ba===_0xd9d8('0x72')){_0x33ba43[_0xd9d8('0x73')](_0xd9d8('0x74'),[][_0xd9d8('0x75')](_0x598214[_0xd9d8('0x3a')][_0x3083ba]));}else if(_0x3083ba===_0xd9d8('0x76')){var _0x518285=JSON[_0xd9d8('0x77')](_0x598214[_0xd9d8('0x3a')][_0x3083ba])[_0xd9d8('0x78')];var _0x5369cb=JSON[_0xd9d8('0x77')](_0x598214[_0xd9d8('0x3a')][_0x3083ba])[_0xd9d8('0x79')];_0x33ba43[_0xd9d8('0x73')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x518285,_0x5369cb);}else{if(_0x598214['query'][_0x3083ba]==='null'){_0x33ba43[_0xd9d8('0x73')]('i.'+_0x3083ba+'\x20IS\x20NULL');}else{_0x33ba43[_0xd9d8('0x73')]('i.'+_0x3083ba+_0xd9d8('0x7a'),_0x598214[_0xd9d8('0x3a')][_0x3083ba]);}}});}if(_0x598214['query'][_0xd9d8('0x7b')]){if(_0x598214[_0xd9d8('0x3a')]['read']==0x1){_0x33ba43[_0xd9d8('0x60')](_0xd9d8('0x7c'));}else{_0x33ba43[_0xd9d8('0x60')](_0xd9d8('0x7d'));}}if(_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x7e')]){_0x4671be=_[_0xd9d8('0x7f')](_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x7e')])?_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x7e')]:new Array(_0x598214[_0xd9d8('0x3a')]['tag']);_0x4671be[_0xd9d8('0x32')](function(_0x1cbba1){_0x2fa9ad['or'](_0xd9d8('0x80'),'%,'+_0x1cbba1+',%');});}if(_0x598214[_0xd9d8('0x3a')]['filter']){var _0x5bc5cc=_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x81')][_0xd9d8('0x82')]('\x5c','\x5c\x5c')[_0xd9d8('0x82')](/'/g,'\x27\x27');if(qs[_0xd9d8('0x83')](_0x5bc5cc)){_0x246b4b['or'](_0xd9d8('0x84'),_0x5bc5cc+'%')['or'](_0xd9d8('0x85'),_0x5bc5cc+'%');}_0x246b4b['or'](_0xd9d8('0x86'),_0x5bc5cc+'%');}}_0x33ba43[_0xd9d8('0x73')](_0x246b4b);_0x33ba43[_0xd9d8('0x87')](_0xd9d8('0x88'));var _0x286d07={'type':db[_0xd9d8('0x89')][_0xd9d8('0x8a')][_0xd9d8('0x8b')],'raw':!![]};var _0x18c0db=_0x33ba43[_0xd9d8('0x8c')]();_0x18c0db[_0xd9d8('0x45')](_0xd9d8('0x88'));_0x18c0db[_0xd9d8('0x45')](_0xd9d8('0x8d'),_0xd9d8('0x5e'));if(_0x1901f8['order']){_0x1901f8[_0xd9d8('0x41')]['forEach'](function(_0xc36418){var _0xfbfb1a=_0xc36418[0x0]==='contactName'?_0xc36418[0x0]:'i.'+_0xc36418[0x0];_0x33ba43[_0xd9d8('0x41')](_0xfbfb1a,_0xc36418[0x1]===_0xd9d8('0x8e')?![]:!![]);});}if(!_[_0xd9d8('0x8f')](_0x4671be)){_0x33ba43[_0xd9d8('0x60')](_0x2fa9ad);_0x18c0db[_0xd9d8('0x73')](_0xd9d8('0x90'),_0x4671be);}BPromise[_0xd9d8('0x91')]()['then'](function(){if(!_0x2ecb6a){if(_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x72')])return;_0x18c0db[_0xd9d8('0x73')](_0xd9d8('0x92'));_0x33ba43[_0xd9d8('0x73')](_0xd9d8('0x92'));return;}if(_0x598214[_0xd9d8('0x93')]['role']!==_0xd9d8('0x94'))return;return _0x598214[_0xd9d8('0x93')][_0xd9d8('0x95')]({'attributes':['id'],'raw':!![]})[_0xd9d8('0x28')](function(_0x5308f9){if(_['isEmpty'](_0x5308f9)){_0x18c0db[_0xd9d8('0x73')](_0xd9d8('0x96'));_0x33ba43[_0xd9d8('0x73')](_0xd9d8('0x96'));}else{_0x18c0db[_0xd9d8('0x73')](_0xd9d8('0x74'),_[_0xd9d8('0x2e')](_0x5308f9,'id'));_0x33ba43[_0xd9d8('0x73')](_0xd9d8('0x74'),_[_0xd9d8('0x2e')](_0x5308f9,'id'));}});})['then'](function(){if(_0x598214[_0xd9d8('0x93')][_0xd9d8('0x97')]===_0xd9d8('0x94')&&!_0x2ecb6a&&!_0x598214[_0xd9d8('0x3a')]['FaxAccountId'])return[];return db['sequelize']['query'](_0x18c0db[_0xd9d8('0x98')](),_0x286d07);})[_0xd9d8('0x28')](function(_0x5f5a87){_0x4ef8cb['count']=_0x5f5a87[_0xd9d8('0x3e')];if(_0x4ef8cb[_0xd9d8('0x21')]===0x0)return[];return db[_0xd9d8('0x99')][_0xd9d8('0x3a')](_0x48a2aa[_0xd9d8('0x98')](),_0x286d07)['then'](function(_0x4d2e24){_0x464b39=_[_0xd9d8('0x9a')](_0x4d2e24,'id');_0x286d07=_['merge'](_0x286d07,{'model':db[_0xd9d8('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x598214[_0xd9d8('0x3a')][_0xd9d8('0x3d')]){_0x1901f8[_0xd9d8('0x3c')][_0xd9d8('0x32')](function(_0x3104fd){_0x33ba43[_0xd9d8('0x45')]('i.'+_0x3104fd);});}else{_0x33ba43['field'](_0xd9d8('0x8d'),_0xd9d8('0x5e'));_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0x9c'),_0xd9d8('0x9d'));_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0x9e'),'Account.mandatoryDisposition');_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0x9f'),_0xd9d8('0xa0'));_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0xa1'));_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0xa2'),_0xd9d8('0xa3'));_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0xa4'),_0xd9d8('0xa5'));_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0xa6'),_0xd9d8('0xa7'));_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0xa8'),_0xd9d8('0xa9'));_0x33ba43[_0xd9d8('0x45')]('c.mobile','Contact.mobile');_0x33ba43[_0xd9d8('0x45')]('c.fax','Contact.fax');_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0xaa'),_0xd9d8('0xab'));_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0xac'),_0xd9d8('0xad'));_0x33ba43[_0xd9d8('0x45')](_0xd9d8('0xae'),_0xd9d8('0x2f'));}if(_0x1901f8[_0xd9d8('0x23')])_0x33ba43[_0xd9d8('0x23')](_0x1901f8[_0xd9d8('0x23')]);if(_0x1901f8[_0xd9d8('0x22')])_0x33ba43[_0xd9d8('0x22')](_0x1901f8['offset']);return db[_0xd9d8('0x99')][_0xd9d8('0x3a')](_0x33ba43[_0xd9d8('0x98')](),_0x286d07);})[_0xd9d8('0x28')](function(_0x83913a){if(_0x83913a['length']>0x0)_0x4305c1[_0xd9d8('0x73')]('ui.FaxInteractionId\x20IN\x20?',_[_0xd9d8('0x2e')](_0x83913a,'id'));return db[_0xd9d8('0x99')][_0xd9d8('0x3a')](_0x4305c1[_0xd9d8('0x98')](),_0x286d07)['then'](function(_0x5e1ffb){var _0xbcd95e=_['groupBy'](_0x5e1ffb,_0xd9d8('0xaf'));var _0x46665c=[];_0x83913a[_0xd9d8('0x32')](function(_0x2bcec9){_0x46665c['push'](updateFaxInteraction(_0x2bcec9,_0x464b39,_0xbcd95e));});return BPromise[_0xd9d8('0xb0')](_0x46665c);});});})[_0xd9d8('0x28')](function(_0x4c28fa){_0x4ef8cb[_0xd9d8('0xb1')]=_0x4c28fa;return _0x4ef8cb;})[_0xd9d8('0x28')](respondWithFilteredResult(_0x3b91de,_0x1901f8))[_0xd9d8('0x34')](handleError(_0x3b91de,null));};exports['show']=function(_0x2b4511,_0x439f04){var _0x2fe7b3={'raw':![],'where':{'id':_0x2b4511[_0xd9d8('0xb2')]['id']}},_0x381e89={};_0x381e89[_0xd9d8('0x39')]=_[_0xd9d8('0x6f')](db[_0xd9d8('0x9b')]['rawAttributes']);_0x381e89[_0xd9d8('0x3a')]=_[_0xd9d8('0x6f')](_0x2b4511['query']);_0x381e89[_0xd9d8('0x3b')]=_[_0xd9d8('0xb3')](_0x381e89[_0xd9d8('0x39')],_0x381e89[_0xd9d8('0x3a')]);_0x2fe7b3['attributes']=_['intersection'](_0x381e89[_0xd9d8('0x39')],qs[_0xd9d8('0x3d')](_0x2b4511[_0xd9d8('0x3a')]['fields']));_0x2fe7b3[_0xd9d8('0x3c')]=_0x2fe7b3[_0xd9d8('0x3c')][_0xd9d8('0x3e')]?_0x2fe7b3[_0xd9d8('0x3c')]:_0x381e89['model'];if(_0x2b4511[_0xd9d8('0x3a')][_0xd9d8('0xb4')]){_0x2fe7b3[_0xd9d8('0xb5')]=[{'all':!![]}];}_0x2fe7b3=_[_0xd9d8('0xb6')]({},_0x2fe7b3,_0x2b4511[_0xd9d8('0xb7')]);return db[_0xd9d8('0x9b')]['find'](_0x2fe7b3)[_0xd9d8('0x28')](handleEntityNotFound(_0x439f04,null))[_0xd9d8('0x28')](respondWithResult(_0x439f04,null))[_0xd9d8('0x34')](handleError(_0x439f04,null));};exports[_0xd9d8('0xb8')]=function(_0x20ecde,_0x1cda52){return db[_0xd9d8('0x9b')][_0xd9d8('0xb8')](_0x20ecde['body'],{})[_0xd9d8('0x28')](respondWithResult(_0x1cda52,0xc9))[_0xd9d8('0x34')](handleError(_0x1cda52,null));};exports[_0xd9d8('0x27')]=function(_0xb425fc,_0x4af275){if(_0xb425fc[_0xd9d8('0x6e')]['id']){delete _0xb425fc[_0xd9d8('0x6e')]['id'];}return db[_0xd9d8('0x9b')][_0xd9d8('0x5d')]({'where':{'id':_0xb425fc[_0xd9d8('0xb2')]['id']}})['then'](handleEntityNotFound(_0x4af275,null))[_0xd9d8('0x28')](saveUpdates(_0xb425fc[_0xd9d8('0x6e')],null))[_0xd9d8('0x28')](respondWithResult(_0x4af275,null))['catch'](handleError(_0x4af275,null));};exports['destroy']=function(_0x191d1b,_0x2a6dce){return db[_0xd9d8('0x9b')][_0xd9d8('0x5d')]({'where':{'id':_0x191d1b[_0xd9d8('0xb2')]['id']}})['then'](handleEntityNotFound(_0x2a6dce,null))[_0xd9d8('0x28')](removeEntity(_0x2a6dce,null))[_0xd9d8('0x34')](handleError(_0x2a6dce,null));};exports[_0xd9d8('0xb9')]=function(_0x3813b0,_0x4baa9b){return db[_0xd9d8('0x9b')][_0xd9d8('0xb9')]()[_0xd9d8('0x28')](respondWithResult(_0x4baa9b,null))[_0xd9d8('0x34')](handleError(_0x4baa9b,null));};exports['addMessage']=function(_0x50d530,_0x966335,_0x1592a7){return db[_0xd9d8('0xba')][_0xd9d8('0x5d')]({'where':{'id':_0x50d530[_0xd9d8('0xb2')]['id']}})[_0xd9d8('0x28')](handleEntityNotFound(_0x966335,null))[_0xd9d8('0x28')](function(_0x333c63){if(_0x333c63){return _0x333c63[_0xd9d8('0xbb')](_0x50d530[_0xd9d8('0x6e')][_0xd9d8('0xbc')],_['omit'](_0x50d530['body'],['ids','id'])||{});}})[_0xd9d8('0x28')](respondWithResult(_0x966335,null))[_0xd9d8('0x34')](handleError(_0x966335,null));};exports['getMessages']=function(_0x3e4d8c,_0xadfb4e,_0x3b6cfd){var _0x3e45d6={'raw':![],'where':{}};var _0x2c8d7e={};var _0x5683f1={'count':0x0,'rows':[]};return db[_0xd9d8('0x9b')][_0xd9d8('0xbd')]({'where':{'id':_0x3e4d8c[_0xd9d8('0xb2')]['id']}})['then'](handleEntityNotFound(_0xadfb4e,null))[_0xd9d8('0x28')](function(_0x5daf30){if(_0x5daf30){_0x2c8d7e[_0xd9d8('0x39')]=_[_0xd9d8('0x6f')](db['FaxMessage'][_0xd9d8('0x35')]);_0x2c8d7e[_0xd9d8('0x3a')]=_[_0xd9d8('0x6f')](_0x3e4d8c[_0xd9d8('0x3a')]);_0x2c8d7e[_0xd9d8('0x3b')]=_['intersection'](_0x2c8d7e[_0xd9d8('0x39')],_0x2c8d7e[_0xd9d8('0x3a')]);_0x3e45d6['attributes']=_[_0xd9d8('0xb3')](_0x2c8d7e[_0xd9d8('0x39')],qs[_0xd9d8('0x3d')](_0x3e4d8c['query']['fields']));_0x3e45d6[_0xd9d8('0x3c')]=_0x3e45d6[_0xd9d8('0x3c')]['length']?_0x3e45d6[_0xd9d8('0x3c')]:_0x2c8d7e['model'];if(!_0x3e4d8c[_0xd9d8('0x3a')]['hasOwnProperty']('nolimit')){_0x3e45d6[_0xd9d8('0x23')]=qs[_0xd9d8('0x23')](_0x3e4d8c['query'][_0xd9d8('0x23')]);_0x3e45d6[_0xd9d8('0x22')]=qs[_0xd9d8('0x22')](_0x3e4d8c['query'][_0xd9d8('0x22')]);}_0x3e45d6[_0xd9d8('0x41')]=qs[_0xd9d8('0x42')](_0x3e4d8c[_0xd9d8('0x3a')][_0xd9d8('0x42')]);_0x3e45d6[_0xd9d8('0x73')]=qs[_0xd9d8('0x3b')](_[_0xd9d8('0x43')](_0x3e4d8c[_0xd9d8('0x3a')],_0x2c8d7e[_0xd9d8('0x3b')]));_0x3e45d6[_0xd9d8('0x73')]['FaxInteractionId']=_0x5daf30['id'];if(_0x3e4d8c[_0xd9d8('0x3a')][_0xd9d8('0x81')]){_0x3e45d6['where']=_[_0xd9d8('0xb6')](_0x3e45d6[_0xd9d8('0x73')],{'$or':_[_0xd9d8('0x2e')](_0x3e45d6['attributes'],function(_0x4d4f92){var _0x52e49f={};_0x52e49f[_0x4d4f92]={'$like':'%'+_0x3e4d8c['query'][_0xd9d8('0x81')]+'%'};return _0x52e49f;})});}if(_0x3e4d8c[_0xd9d8('0x3a')][_0xd9d8('0x78')]){var _0x322e15=_0x3e4d8c[_0xd9d8('0x3a')][_0xd9d8('0x78')]['split'](',');var _0x357ff3={};_0x357ff3[_0x322e15[0x0]]={'$gte':moment(_0x322e15[0x1])[_0xd9d8('0xbe')](_0xd9d8('0xbf'))};_0x3e45d6[_0xd9d8('0x73')]=_[_0xd9d8('0xb6')](_0x3e45d6[_0xd9d8('0x73')],_0x357ff3);}_0x3e45d6=_[_0xd9d8('0xb6')]({},_0x3e45d6,_0x3e4d8c['options']);return db[_0xd9d8('0xba')][_0xd9d8('0x21')]({'where':_0x3e45d6[_0xd9d8('0x73')]})[_0xd9d8('0x28')](function(_0xc9e9bb){_0x5683f1[_0xd9d8('0x21')]=_0xc9e9bb;if(_0x3e4d8c[_0xd9d8('0x3a')][_0xd9d8('0xb4')]){_0x3e45d6[_0xd9d8('0xb5')]=[{'all':!![]}];}return db[_0xd9d8('0xba')][_0xd9d8('0xc0')](_0x3e45d6);})[_0xd9d8('0x28')](function(_0xdd46c8){_0x5683f1[_0xd9d8('0xb1')]=_0xdd46c8;return _0x5683f1;});}})[_0xd9d8('0x28')](respondWithFilteredResult(_0xadfb4e,_0x3e45d6))[_0xd9d8('0x34')](handleError(_0xadfb4e,null));};exports['addTags']=function(_0x5e66b2,_0x88e01f,_0x2a6aa1){return db[_0xd9d8('0x9b')][_0xd9d8('0x5d')]({'where':{'id':_0x5e66b2[_0xd9d8('0xb2')]['id']}})['then'](handleEntityNotFound(_0x88e01f,null))['then'](function(_0x1394ae){if(_0x1394ae){return _0x1394ae[_0xd9d8('0xc1')](_0x5e66b2['body'][_0xd9d8('0xbc')],_[_0xd9d8('0xc2')](_0x5e66b2['body'],['ids','id'])||{})[_0xd9d8('0xc3')](function(){return db[_0xd9d8('0xc4')][_0xd9d8('0xc0')]({'attributes':['id',_0xd9d8('0x2c'),_0xd9d8('0x46')],'where':{'id':_0x5e66b2[_0xd9d8('0x6e')][_0xd9d8('0xbc')]}});})[_0xd9d8('0x28')](function(_0x56a9a2){socket['emit']('faxInteractionTags:save',{'id':Number(_0x5e66b2[_0xd9d8('0xb2')]['id']),'tags':_0x56a9a2||[]});return{'id':Number(_0x5e66b2[_0xd9d8('0xb2')]['id']),'tags':_0x56a9a2||[]};});}})[_0xd9d8('0x28')](respondWithResult(_0x88e01f,null))[_0xd9d8('0x34')](handleError(_0x88e01f,null));};exports['removeTags']=function(_0x4580c6,_0x30977a,_0x325e25){return db[_0xd9d8('0x9b')][_0xd9d8('0x5d')]({'where':{'id':_0x4580c6[_0xd9d8('0xb2')]['id']}})[_0xd9d8('0x28')](handleEntityNotFound(_0x30977a,null))[_0xd9d8('0x28')](function(_0x5b1945){if(_0x5b1945){return _0x5b1945[_0xd9d8('0xc5')](_0x4580c6[_0xd9d8('0x3a')][_0xd9d8('0xbc')]);}})[_0xd9d8('0x28')](respondWithStatusCode(_0x30977a,null))[_0xd9d8('0x34')](handleError(_0x30977a,null));};exports[_0xd9d8('0xc6')]=function(_0x4520f9,_0x19a195){var _0x46a4e8=moment()[_0xd9d8('0xc7')]()['toString']();var _0x45c6ae=path[_0xd9d8('0xc8')](config[_0xd9d8('0xc9')],_0xd9d8('0xca'),_0xd9d8('0xcb'),_0xd9d8('0xcc'));var _0x442a49=path[_0xd9d8('0xc8')](config[_0xd9d8('0xc9')],_0xd9d8('0xca'),_0xd9d8('0xcb'),'attachments');var _0x230c98=path['join'](_0x45c6ae,_0x46a4e8);var _0x3dd5f7=util[_0xd9d8('0xbe')](_0xd9d8('0xcd'),_0x4520f9[_0xd9d8('0xb2')]['id'],_0x46a4e8);var _0x29ff72=path['join'](_0x45c6ae,_0x3dd5f7);var _0x528511=[];_0x528511[_0xd9d8('0x33')]({'model':db['Attachment'],'as':_0xd9d8('0xce'),'raw':!![]});var _0x44438f=[{'model':db[_0xd9d8('0xba')],'as':_0xd9d8('0xcf'),'attributes':['id',_0xd9d8('0x6e'),_0xd9d8('0x76')],'include':_0x528511}];return db[_0xd9d8('0x9b')]['find']({'where':{'id':_0x4520f9[_0xd9d8('0xb2')]['id']},'include':_0x44438f})[_0xd9d8('0x28')](handleEntityNotFound(_0x19a195,null))[_0xd9d8('0x28')](function(_0x1acf98){if(_0x1acf98&&_0x1acf98[_0xd9d8('0xcf')]){var _0x5f23e1=_0x1acf98[_0xd9d8('0xd0')]({'plain':!![]});fs[_0xd9d8('0xd1')](_0x230c98);for(var _0x27a1f0=0x0;_0x27a1f0<_0x5f23e1[_0xd9d8('0xcf')][_0xd9d8('0x3e')];_0x27a1f0++){var _0xbbd0f4=_0x5f23e1[_0xd9d8('0xcf')][_0x27a1f0][_0xd9d8('0xce')];if(_0xbbd0f4){var _0x10e116=path[_0xd9d8('0xc8')](_0x442a49,_0xbbd0f4[_0xd9d8('0xd2')]);if(fs[_0xd9d8('0xd3')](_0x10e116)){fs['createReadStream'](_0x10e116)[_0xd9d8('0xd4')](fs[_0xd9d8('0xd5')](path['join'](_0x230c98,_0xbbd0f4[_0xd9d8('0xd2')])));}}}return BPromise[_0xd9d8('0x91')]()[_0xd9d8('0x28')](function(){return new BPromise(function(_0x1ba64a,_0x3010d7){zipdir(_0x230c98,{'saveTo':_0x29ff72},function(_0xedaa0,_0xde402c){if(_0xedaa0)return _0x3010d7(_0xedaa0);return _0x1ba64a(_0xde402c);});})['then'](function(){return new BPromise(function(_0xbee1b0,_0x2d24d9){rimraf(_0x230c98,function(_0xcd7d15){if(_0xcd7d15)_0x2d24d9(_0xcd7d15);return _0xbee1b0();});});})[_0xd9d8('0x28')](function(){return _0x19a195['download'](_0x29ff72,_0x3dd5f7,function(_0x18370a){if(_0x18370a){console[_0xd9d8('0xd6')]('err',_0x18370a);}else{fs[_0xd9d8('0xd7')](_0x29ff72);}});});});}else{return _0x19a195['sendStatus'](0xc8);}})[_0xd9d8('0x34')](handleError(_0x19a195,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index cef00fd..d743e9e 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 _0x808f=['findAll','then','length','emit','catch','hasOwnProperty','hook','FaxInteraction','../../mysqldb','setMaxListeners','save','setDataValue','map'];(function(_0xc0dad,_0xc4e4ae){var _0x4e843c=function(_0x58e2c6){while(--_0x58e2c6){_0xc0dad['push'](_0xc0dad['shift']());}};_0x4e843c(++_0xc4e4ae);}(_0x808f,0x166));var _0xf808=function(_0x1cc410,_0x1b3d93){_0x1cc410=_0x1cc410-0x0;var _0x78dbca=_0x808f[_0x1cc410];return _0x78dbca;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0xf808('0x0')];var FaxMessage=require(_0xf808('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf808('0x2')](0x0);var events={'afterCreate':_0xf808('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5127bf){return function(_0x37e642,_0x548aa9,_0x20fa7d){_0x37e642['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2e9ce5){_0x37e642[_0xf808('0x4')]('Users',_0x2e9ce5[_0xf808('0x5')](function(_0x49780a){return{'id':_0x49780a['id']};}));return FaxMessage[_0xf808('0x6')]({'where':{'FaxInteractionId':_0x37e642['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf808('0x7')](function(_0x27f905){_0x37e642['setDataValue']('unreadMessages',_0x27f905[_0xf808('0x8')]);FaxInteractionEvents['emit'](_0x5127bf+':'+_0x37e642['id'],_0x37e642);FaxInteractionEvents[_0xf808('0x9')](_0x5127bf,_0x37e642);_0x20fa7d(null);})[_0xf808('0xa')](_0x20fa7d(null));};}for(var e in events){if(events[_0xf808('0xb')](e)){var event=events[e];FaxInteraction[_0xf808('0xc')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xcec3=['exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xcec3,0x157));var _0x3cec=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcec3[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x3cec('0x0'));var FaxInteraction=require(_0x3cec('0x1'))['db'][_0x3cec('0x2')];var FaxMessage=require(_0x3cec('0x1'))['db'][_0x3cec('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3cec('0x4')](0x0);var events={'afterCreate':_0x3cec('0x5'),'afterUpdate':_0x3cec('0x6'),'afterDestroy':'remove'};function emitEvent(_0x40eb7d){return function(_0x3d094e,_0x2b5bad,_0x374db5){_0x3d094e['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x19c9af){_0x3d094e[_0x3cec('0x7')](_0x3cec('0x8'),_0x19c9af[_0x3cec('0x9')](function(_0x5664bf){return{'id':_0x5664bf['id']};}));return FaxMessage[_0x3cec('0xa')]({'where':{'FaxInteractionId':_0x3d094e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3cec('0xb')](function(_0x31094b){_0x3d094e[_0x3cec('0x7')](_0x3cec('0xc'),_0x31094b[_0x3cec('0xd')]);FaxInteractionEvents[_0x3cec('0xe')](_0x40eb7d+':'+_0x3d094e['id'],_0x3d094e);FaxInteractionEvents[_0x3cec('0xe')](_0x40eb7d,_0x3d094e);_0x374db5(null);})[_0x3cec('0xf')](_0x374db5(null));};}for(var e in events){if(events[_0x3cec('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x3cec('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 9ea7bfe..22bcc45 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 _0x81b7=['define','changed','closedAt','format','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x49c46d,_0x260508){var _0x46fbf1=function(_0x1b2801){while(--_0x1b2801){_0x49c46d['push'](_0x49c46d['shift']());}};_0x46fbf1(++_0x260508);}(_0x81b7,0x1f2));var _0x781b=function(_0x37c0ae,_0x429eb1){_0x37c0ae=_0x37c0ae-0x0;var _0x4cd294=_0x81b7[_0x37c0ae];return _0x4cd294;};'use strict';var _=require('lodash');var util=require(_0x781b('0x0'));var logger=require(_0x781b('0x1'))(_0x781b('0x2'));var moment=require(_0x781b('0x3'));var BPromise=require('bluebird');var rp=require(_0x781b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x781b('0x5'));var config=require(_0x781b('0x6'));var attributes=require(_0x781b('0x7'));module[_0x781b('0x8')]=function(_0x5eed8e,_0x3d9d36){return _0x5eed8e[_0x781b('0x9')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3de3cd,_0x33c04b,_0x1fa67d){if(_0x3de3cd[_0x781b('0xa')]('closed')){_0x3de3cd[_0x781b('0xb')]=moment()[_0x781b('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1fa67d(null,_0x3de3cd);}}});}; \ No newline at end of file +var _0x6ee7=['define','FaxInteraction','changed','closed','closedAt','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x91acc3,_0x1b4d90){var _0x2a761c=function(_0x2b7cbc){while(--_0x2b7cbc){_0x91acc3['push'](_0x91acc3['shift']());}};_0x2a761c(++_0x1b4d90);}(_0x6ee7,0x1e1));var _0x76ee=function(_0x48c2c5,_0x4d6578){_0x48c2c5=_0x48c2c5-0x0;var _0xb48403=_0x6ee7[_0x48c2c5];return _0xb48403;};'use strict';var _=require(_0x76ee('0x0'));var util=require(_0x76ee('0x1'));var logger=require(_0x76ee('0x2'))(_0x76ee('0x3'));var moment=require('moment');var BPromise=require(_0x76ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x76ee('0x5'));var config=require(_0x76ee('0x6'));var attributes=require(_0x76ee('0x7'));module[_0x76ee('0x8')]=function(_0x353991,_0x2cacf7){return _0x353991[_0x76ee('0x9')](_0x76ee('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x180bb4,_0xcb749a,_0x181425){if(_0x180bb4[_0x76ee('0xb')](_0x76ee('0xc'))){_0x180bb4[_0x76ee('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x181425(null,_0x180bb4);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7071a6b..ee3630c 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 _0x6f6a=['then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','stringify','AddTagsToFaxInteraction','find','ids','omit','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request'];(function(_0x298b56,_0x44d566){var _0x3fcc7c=function(_0x111d55){while(--_0x111d55){_0x298b56['push'](_0x298b56['shift']());}};_0x3fcc7c(++_0x44d566);}(_0x6f6a,0x131));var _0xa6f6=function(_0x141d2f,_0x54fcb5){_0x141d2f=_0x141d2f-0x0;var _0x54da2d=_0x6f6a[_0x141d2f];return _0x54da2d;};'use strict';var _=require(_0xa6f6('0x0'));var util=require(_0xa6f6('0x1'));var moment=require('moment');var BPromise=require(_0xa6f6('0x2'));var rs=require(_0xa6f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6f6('0x5'))(_0xa6f6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa6f6('0x7')][_0xa6f6('0x8')]({'port':0x232a});config[_0xa6f6('0x9')]=_['defaults'](config[_0xa6f6('0x9')],{'host':_0xa6f6('0xa'),'port':0x18eb});var socket=require(_0xa6f6('0xb'))(new Redis(config['redis']));require(_0xa6f6('0xc'))[_0xa6f6('0xd')](socket);function respondWithRpcPromise(_0x16f4cf,_0x556458,_0x56ab33){return new BPromise(function(_0x1f2021,_0x57f7a0){return client[_0xa6f6('0xe')](_0x16f4cf,_0x56ab33)[_0xa6f6('0xf')](function(_0x43a35e){logger[_0xa6f6('0x10')](_0xa6f6('0x11'),_0x556458,_0xa6f6('0x12'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x556458,_0xa6f6('0x12'),JSON['stringify'](_0x43a35e));if(_0x43a35e[_0xa6f6('0x13')]){if(_0x43a35e[_0xa6f6('0x13')][_0xa6f6('0x14')]===0x1f4){logger[_0xa6f6('0x13')](_0xa6f6('0x11'),_0x556458,_0x43a35e[_0xa6f6('0x13')][_0xa6f6('0x15')]);return _0x57f7a0(_0x43a35e[_0xa6f6('0x13')]['message']);}logger['error'](_0xa6f6('0x11'),_0x556458,_0x43a35e[_0xa6f6('0x13')][_0xa6f6('0x15')]);return _0x1f2021(_0x43a35e[_0xa6f6('0x13')]['message']);}else{logger[_0xa6f6('0x10')](_0xa6f6('0x11'),_0x556458,'request\x20sent');_0x1f2021(_0x43a35e[_0xa6f6('0x16')][_0xa6f6('0x15')]);}})[_0xa6f6('0x17')](function(_0xf5f3b3){logger['error'](_0xa6f6('0x11'),_0x556458,_0xf5f3b3);_0x57f7a0(_0xf5f3b3);});});}exports[_0xa6f6('0x18')]=function(_0x407c54){var _0x193656=this;return new Promise(function(_0x2a39a9,_0x5b3201){return db[_0xa6f6('0x19')][_0xa6f6('0x1a')](_0x407c54[_0xa6f6('0x1b')],{'raw':_0x407c54[_0xa6f6('0x1c')]?_0x407c54[_0xa6f6('0x1c')][_0xa6f6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x407c54['options']?_0x407c54[_0xa6f6('0x1c')][_0xa6f6('0x1e')]||null:null,'attributes':_0x407c54[_0xa6f6('0x1c')]?_0x407c54[_0xa6f6('0x1c')][_0xa6f6('0x1f')]||null:null,'limit':_0x407c54[_0xa6f6('0x1c')]?_0x407c54[_0xa6f6('0x1c')][_0xa6f6('0x20')]||null:null})[_0xa6f6('0xf')](function(_0x73cc3f){logger['info'](_0xa6f6('0x18'),_0x407c54);logger[_0xa6f6('0x21')](_0xa6f6('0x18'),_0x407c54,JSON[_0xa6f6('0x22')](_0x73cc3f));_0x2a39a9(_0x73cc3f);})[_0xa6f6('0x17')](function(_0x4f9dac){logger['error'](_0xa6f6('0x18'),_0x4f9dac[_0xa6f6('0x15')],_0x407c54);_0x5b3201(_0x193656[_0xa6f6('0x13')](0x1f4,_0x4f9dac['message']));});});};exports[_0xa6f6('0x23')]=function(_0x17c187){return new Promise(function(_0x129d91,_0x198d01){return db['FaxInteraction'][_0xa6f6('0x24')]({'where':_0x17c187[_0xa6f6('0x1c')]?_0x17c187[_0xa6f6('0x1c')][_0xa6f6('0x1e')]||null:null})[_0xa6f6('0xf')](function(_0x41b78b){if(_0x41b78b){return _0x41b78b['addTags'](_0x17c187[_0xa6f6('0x1b')][_0xa6f6('0x25')],_[_0xa6f6('0x26')](_0x17c187[_0xa6f6('0x1b')],[_0xa6f6('0x25'),'id'])||{});}})['spread'](function(_0x45aec3){logger['info'](_0xa6f6('0x27'),_0x17c187);logger['debug']('AddTags',_0x17c187,JSON[_0xa6f6('0x22')](_0x45aec3));_0x129d91(_0x45aec3);})['catch'](function(_0x591de){logger[_0xa6f6('0x13')](_0xa6f6('0x27'),_0x591de['message'],_0x17c187);_0x198d01(_this[_0xa6f6('0x13')](0x1f4,_0x591de[_0xa6f6('0x15')]));});});}; \ No newline at end of file +var _0x147a=['where','attributes','limit','catch','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','body','options','raw'];(function(_0x26633,_0x5432e3){var _0x288fdd=function(_0x227155){while(--_0x227155){_0x26633['push'](_0x26633['shift']());}};_0x288fdd(++_0x5432e3);}(_0x147a,0x137));var _0xa147=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x147a[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require(_0xa147('0x0'));var util=require(_0xa147('0x1'));var moment=require(_0xa147('0x2'));var BPromise=require(_0xa147('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa147('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa147('0x5'));var logger=require(_0xa147('0x6'))(_0xa147('0x7'));var config=require(_0xa147('0x8'));var jayson=require(_0xa147('0x9'));var client=jayson[_0xa147('0xa')][_0xa147('0xb')]({'port':0x232a});config[_0xa147('0xc')]=_[_0xa147('0xd')](config[_0xa147('0xc')],{'host':_0xa147('0xe'),'port':0x18eb});var socket=require(_0xa147('0xf'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xa147('0x10')](socket);function respondWithRpcPromise(_0x3ef096,_0x295c1c,_0x4c59ef){return new BPromise(function(_0x36596e,_0x35195d){return client['request'](_0x3ef096,_0x4c59ef)[_0xa147('0x11')](function(_0x42dcc0){logger[_0xa147('0x12')](_0xa147('0x13'),_0x295c1c,'request\x20sent');logger[_0xa147('0x14')](_0xa147('0x15'),_0x295c1c,_0xa147('0x16'),JSON[_0xa147('0x17')](_0x42dcc0));if(_0x42dcc0[_0xa147('0x18')]){if(_0x42dcc0[_0xa147('0x18')][_0xa147('0x19')]===0x1f4){logger[_0xa147('0x18')](_0xa147('0x13'),_0x295c1c,_0x42dcc0[_0xa147('0x18')][_0xa147('0x1a')]);return _0x35195d(_0x42dcc0[_0xa147('0x18')][_0xa147('0x1a')]);}logger[_0xa147('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x295c1c,_0x42dcc0['error'][_0xa147('0x1a')]);return _0x36596e(_0x42dcc0[_0xa147('0x18')]['message']);}else{logger[_0xa147('0x12')](_0xa147('0x13'),_0x295c1c,'request\x20sent');_0x36596e(_0x42dcc0[_0xa147('0x1b')][_0xa147('0x1a')]);}})['catch'](function(_0x2643c6){logger[_0xa147('0x18')](_0xa147('0x13'),_0x295c1c,_0x2643c6);_0x35195d(_0x2643c6);});});}exports[_0xa147('0x1c')]=function(_0x2d98c5){var _0x494261=this;return new Promise(function(_0x5b66a2,_0x4e187d){return db[_0xa147('0x1d')]['update'](_0x2d98c5[_0xa147('0x1e')],{'raw':_0x2d98c5[_0xa147('0x1f')]?_0x2d98c5[_0xa147('0x1f')][_0xa147('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d98c5['options']?_0x2d98c5[_0xa147('0x1f')][_0xa147('0x21')]||null:null,'attributes':_0x2d98c5[_0xa147('0x1f')]?_0x2d98c5[_0xa147('0x1f')][_0xa147('0x22')]||null:null,'limit':_0x2d98c5[_0xa147('0x1f')]?_0x2d98c5[_0xa147('0x1f')][_0xa147('0x23')]||null:null})[_0xa147('0x11')](function(_0x5aa5cb){logger[_0xa147('0x12')](_0xa147('0x1c'),_0x2d98c5);logger[_0xa147('0x14')]('UpdateFaxInteraction',_0x2d98c5,JSON['stringify'](_0x5aa5cb));_0x5b66a2(_0x5aa5cb);})[_0xa147('0x24')](function(_0x4639b3){logger[_0xa147('0x18')](_0xa147('0x1c'),_0x4639b3[_0xa147('0x1a')],_0x2d98c5);_0x4e187d(_0x494261['error'](0x1f4,_0x4639b3[_0xa147('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x37d471){return new Promise(function(_0x1ec2c1,_0x587d62){return db['FaxInteraction'][_0xa147('0x25')]({'where':_0x37d471[_0xa147('0x1f')]?_0x37d471[_0xa147('0x1f')][_0xa147('0x21')]||null:null})[_0xa147('0x11')](function(_0x2a8b97){if(_0x2a8b97){return _0x2a8b97[_0xa147('0x26')](_0x37d471[_0xa147('0x1e')][_0xa147('0x27')],_[_0xa147('0x28')](_0x37d471['body'],[_0xa147('0x27'),'id'])||{});}})[_0xa147('0x29')](function(_0x120074){logger['info'](_0xa147('0x2a'),_0x37d471);logger[_0xa147('0x14')]('AddTags',_0x37d471,JSON[_0xa147('0x17')](_0x120074));_0x1ec2c1(_0x120074);})[_0xa147('0x24')](function(_0x3b8c10){logger[_0xa147('0x18')](_0xa147('0x2a'),_0x3b8c10[_0xa147('0x1a')],_0x37d471);_0x587d62(_this['error'](0x1f4,_0x3b8c10[_0xa147('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 15a9466..3c5c278 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 _0xa641=['faxInteraction:','remove','emit','register','length'];(function(_0x20c0e7,_0x4e172a){var _0x405098=function(_0x45853d){while(--_0x45853d){_0x20c0e7['push'](_0x20c0e7['shift']());}};_0x405098(++_0x4e172a);}(_0xa641,0xc4));var _0x1a64=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xa641[_0x45783c];return _0x1161da;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x1a64('0x0'),'update'];function createListener(_0x35d1a5,_0x5a9c13){return function(_0xa860d7){_0x5a9c13[_0x1a64('0x1')](_0x35d1a5,_0xa860d7);};}function removeListener(_0x1f4bca,_0x503a57){return function(){FaxInteractionEvents['removeListener'](_0x1f4bca,_0x503a57);};}exports[_0x1a64('0x2')]=function(_0x1b72b0){for(var _0x5ab91e=0x0,_0x174315=events[_0x1a64('0x3')];_0x5ab91e<_0x174315;_0x5ab91e++){var _0x22193f=events[_0x5ab91e];var _0x238ae2=createListener(_0x1a64('0x4')+_0x22193f,_0x1b72b0);FaxInteractionEvents['on'](_0x22193f,_0x238ae2);}}; \ No newline at end of file +var _0x7c0e=['remove','update','removeListener','register','./faxInteraction.events','save'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x7c0e,0x1b4));var _0xe7c0=function(_0x429ea5,_0x94873d){_0x429ea5=_0x429ea5-0x0;var _0x374eed=_0x7c0e[_0x429ea5];return _0x374eed;};'use strict';var FaxInteractionEvents=require(_0xe7c0('0x0'));var events=[_0xe7c0('0x1'),_0xe7c0('0x2'),_0xe7c0('0x3')];function createListener(_0xb0a892,_0x993c55){return function(_0x36a8ca){_0x993c55['emit'](_0xb0a892,_0x36a8ca);};}function removeListener(_0x4ee517,_0xa5ad17){return function(){FaxInteractionEvents[_0xe7c0('0x4')](_0x4ee517,_0xa5ad17);};}exports[_0xe7c0('0x5')]=function(_0x444255){for(var _0x4af9ca=0x0,_0x1702ec=events['length'];_0x4af9ca<_0x1702ec;_0x4af9ca++){var _0x3c238a=events[_0x4af9ca];var _0x14b91c=createListener('faxInteraction:'+_0x3c238a,_0x444255);FaxInteractionEvents['on'](_0x3c238a,_0x14b91c);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index a438873..8da2fe3 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 _0xa07c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update','update','tracked','faxinteraction:destroy','destroy','removeTags','multer','path'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0xa07c,0x11e));var _0xca07=function(_0x4b702b,_0x5636fc){_0x4b702b=_0x4b702b-0x0;var _0x9549=_0xa07c[_0x4b702b];return _0x9549;};'use strict';var multer=require(_0xca07('0x0'));var util=require('util');var path=require(_0xca07('0x1'));var timeout=require(_0xca07('0x2'));var express=require(_0xca07('0x3'));var router=express[_0xca07('0x4')]();var fs_extra=require(_0xca07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xca07('0x6'));var config=require(_0xca07('0x7'));var controller=require(_0xca07('0x8'));router[_0xca07('0x9')]('/',auth[_0xca07('0xa')](),controller[_0xca07('0xb')]);router[_0xca07('0x9')](_0xca07('0xc'),auth[_0xca07('0xa')](),controller[_0xca07('0xd')]);router[_0xca07('0x9')]('/:id',auth[_0xca07('0xa')](),controller['show']);router[_0xca07('0x9')](_0xca07('0xe'),auth[_0xca07('0xa')](),controller[_0xca07('0xf')]);router['get'](_0xca07('0x10'),auth[_0xca07('0xa')](),controller[_0xca07('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xca07('0x12')]);router[_0xca07('0x13')]('/:id/messages',auth[_0xca07('0xa')](),controller[_0xca07('0x14')]);router[_0xca07('0x13')](_0xca07('0x15'),auth[_0xca07('0xa')](),interaction['tracked'](_0xca07('0x16'),_0xca07('0x17')),controller[_0xca07('0x18')]);router['put'](_0xca07('0x19'),auth[_0xca07('0xa')](),interaction['tracked']('fax',_0xca07('0x1a')),controller[_0xca07('0x1b')]);router['delete'](_0xca07('0x19'),auth['isAuthenticated'](),interaction[_0xca07('0x1c')](_0xca07('0x16'),_0xca07('0x1d')),controller[_0xca07('0x1e')]);router['delete'](_0xca07('0x15'),auth['isAuthenticated'](),controller[_0xca07('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xbc46=['download','post','create','/:id/messages','fax','faxinteraction:addtags','addTags','put','tracked','update','faxinteraction:destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/download'];(function(_0x22c9bd,_0x10e282){var _0x4a875b=function(_0x3146e5){while(--_0x3146e5){_0x22c9bd['push'](_0x22c9bd['shift']());}};_0x4a875b(++_0x10e282);}(_0xbc46,0x9f));var _0x6bc4=function(_0x2b2a67,_0x14ea79){_0x2b2a67=_0x2b2a67-0x0;var _0x19ae63=_0xbc46[_0x2b2a67];return _0x19ae63;};'use strict';var multer=require(_0x6bc4('0x0'));var util=require(_0x6bc4('0x1'));var path=require(_0x6bc4('0x2'));var timeout=require(_0x6bc4('0x3'));var express=require(_0x6bc4('0x4'));var router=express[_0x6bc4('0x5')]();var fs_extra=require(_0x6bc4('0x6'));var auth=require(_0x6bc4('0x7'));var interaction=require(_0x6bc4('0x8'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x6bc4('0x9')]('/',auth[_0x6bc4('0xa')](),controller[_0x6bc4('0xb')]);router['get']('/describe',auth[_0x6bc4('0xa')](),controller[_0x6bc4('0xc')]);router[_0x6bc4('0x9')](_0x6bc4('0xd'),auth[_0x6bc4('0xa')](),controller['show']);router[_0x6bc4('0x9')]('/:id/messages',auth[_0x6bc4('0xa')](),controller['getMessages']);router[_0x6bc4('0x9')](_0x6bc4('0xe'),auth[_0x6bc4('0xa')](),controller[_0x6bc4('0xf')]);router[_0x6bc4('0x10')]('/',auth[_0x6bc4('0xa')](),controller[_0x6bc4('0x11')]);router[_0x6bc4('0x10')](_0x6bc4('0x12'),auth[_0x6bc4('0xa')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x6bc4('0x13'),_0x6bc4('0x14')),controller[_0x6bc4('0x15')]);router[_0x6bc4('0x16')](_0x6bc4('0xd'),auth[_0x6bc4('0xa')](),interaction[_0x6bc4('0x17')](_0x6bc4('0x13'),'faxinteraction:update'),controller[_0x6bc4('0x18')]);router['delete'](_0x6bc4('0xd'),auth[_0x6bc4('0xa')](),interaction[_0x6bc4('0x17')](_0x6bc4('0x13'),_0x6bc4('0x19')),controller['destroy']);router[_0x6bc4('0x1a')]('/:id/tags',auth[_0x6bc4('0xa')](),controller[_0x6bc4('0x1b')]);module[_0x6bc4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index d15c077..0f38b5b 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 _0xf9f7=['exports','TEXT','medium','BOOLEAN','ENUM','DATE','sequelize'];(function(_0x5769db,_0x134827){var _0x52b820=function(_0x342af7){while(--_0x342af7){_0x5769db['push'](_0x5769db['shift']());}};_0x52b820(++_0x134827);}(_0xf9f7,0xdf));var _0x7f9f=function(_0xc6879,_0x84a966){_0xc6879=_0xc6879-0x0;var _0x54f7a4=_0xf9f7[_0xc6879];return _0x54f7a4;};'use strict';var Sequelize=require(_0x7f9f('0x0'));module[_0x7f9f('0x1')]={'body':{'type':Sequelize[_0x7f9f('0x2')](_0x7f9f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7f9f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f9f('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x7f9f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7f9f('0x6')]}}; \ No newline at end of file +var _0xee24=['out','DATE','exports','TEXT','BOOLEAN','ENUM'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xee24,0x1a6));var _0x4ee2=function(_0x5e34a4,_0x2e63ed){_0x5e34a4=_0x5e34a4-0x0;var _0x8d41d7=_0xee24[_0x5e34a4];return _0x8d41d7;};'use strict';var Sequelize=require('sequelize');module[_0x4ee2('0x0')]={'body':{'type':Sequelize[_0x4ee2('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4ee2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4ee2('0x3')]('in',_0x4ee2('0x4')),'defaultValue':_0x4ee2('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x4ee2('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index ee7a5f1..4575a5b 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 _0x770b=['lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','status','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','rows','show','params','options','find','body','describe','../../config/logger','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','User','interface','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra'];(function(_0x29851d,_0x1a7baf){var _0x4d142f=function(_0x531542){while(--_0x531542){_0x29851d['push'](_0x29851d['shift']());}};_0x4d142f(++_0x1a7baf);}(_0x770b,0x81));var _0xb770=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x770b[_0xfc406a];return _0x395473;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb770('0x0'));var zipdir=require(_0xb770('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb770('0x2'));var moment=require(_0xb770('0x3'));var BPromise=require(_0xb770('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb770('0x5'));var sox=require('sox');var csv=require(_0xb770('0x6'));var ejs=require(_0xb770('0x7'));var fs=require('fs');var fs_extra=require(_0xb770('0x8'));var _=require(_0xb770('0x9'));var squel=require(_0xb770('0xa'));var crypto=require(_0xb770('0xb'));var jsforce=require(_0xb770('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb770('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb770('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb770('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb770('0x11'),'port':0x18eb});var socket=require(_0xb770('0x12'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xb770('0x13')](socket);var jayson=require(_0xb770('0x14'));var client=jayson[_0xb770('0x15')]['http']({'port':0x232c});var client9002=jayson['client'][_0xb770('0x16')]({'port':0x232a});function respondWithRpcPromise(_0xf01715,_0x18c461,_0x42f617,_0x31e7e2){return new BPromise(function(_0x567634,_0x4d3133){var _0x38d84a=_0x31e7e2||client;return _0x38d84a[_0xb770('0x17')](_0xf01715,_0x42f617)[_0xb770('0x18')](function(_0x1bfe2e){logger[_0xb770('0x19')]('FaxMessage,\x20%s,\x20%s',_0x18c461,_0xb770('0x1a'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x18c461,_0xb770('0x1a'),JSON['stringify'](_0x1bfe2e));if(_0x1bfe2e[_0xb770('0x1b')]){if(_0x1bfe2e['error'][_0xb770('0x1c')]===0x1f4){logger[_0xb770('0x1b')](_0xb770('0x1d'),_0x18c461,_0x1bfe2e[_0xb770('0x1b')][_0xb770('0x1e')]);return _0x4d3133(_0x1bfe2e[_0xb770('0x1b')][_0xb770('0x1e')]);}logger[_0xb770('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x18c461,_0x1bfe2e[_0xb770('0x1b')][_0xb770('0x1e')]);return _0x567634(_0x1bfe2e[_0xb770('0x1b')]['message']);}else{logger['info'](_0xb770('0x1d'),_0x18c461,'request\x20sent');_0x567634(_0x1bfe2e[_0xb770('0x1f')][_0xb770('0x1e')]);}})[_0xb770('0x20')](function(_0x29846f){logger['error'](_0xb770('0x1d'),_0x18c461,_0x29846f);_0x4d3133(_0x29846f);});});}function respondWithStatusCode(_0x1797fb,_0x456a14){_0x456a14=_0x456a14||0xcc;return function(_0x2bcaca){if(_0x2bcaca){return _0x1797fb[_0xb770('0x21')](_0x456a14);}return _0x1797fb['status'](_0x456a14)[_0xb770('0x22')]();};}function respondWithResult(_0x132069,_0x4a7d4f){_0x4a7d4f=_0x4a7d4f||0xc8;return function(_0xc2405f){if(_0xc2405f){return _0x132069['status'](_0x4a7d4f)[_0xb770('0x23')](_0xc2405f);}};}function respondWithFilteredResult(_0x628654,_0x30fc82){return function(_0x42104c){if(_0x42104c){var _0x2097bc=typeof _0x30fc82[_0xb770('0x24')]===_0xb770('0x25')&&typeof _0x30fc82[_0xb770('0x26')]===_0xb770('0x25');var _0x33fce0=_0x42104c['count'];var _0x1f26dc=_0x2097bc?0x0:_0x30fc82[_0xb770('0x24')];var _0x4f82d9=_0x2097bc?_0x42104c[_0xb770('0x27')]:_0x30fc82[_0xb770('0x24')]+_0x30fc82[_0xb770('0x26')];var _0x40c954;if(_0x4f82d9>=_0x33fce0){_0x4f82d9=_0x33fce0;_0x40c954=0xc8;}else{_0x40c954=0xce;}_0x628654['status'](_0x40c954);return _0x628654[_0xb770('0x28')]('Content-Range',_0x1f26dc+'-'+_0x4f82d9+'/'+_0x33fce0)[_0xb770('0x23')](_0x42104c);}return null;};}function patchUpdates(_0x2948b1){return function(_0x3c9b17){try{jsonpatch[_0xb770('0x29')](_0x3c9b17,_0x2948b1,!![]);}catch(_0x18e82b){return BPromise['reject'](_0x18e82b);}return _0x3c9b17[_0xb770('0x2a')]();};}function saveUpdates(_0x3f079d,_0x130c99){return function(_0x583d84){if(_0x583d84){return _0x583d84[_0xb770('0x2b')](_0x3f079d)[_0xb770('0x18')](function(_0x5a2dfe){return _0x5a2dfe;});}return null;};}function removeEntity(_0x2825e2,_0x291540){return function(_0x52ce8e){if(_0x52ce8e){return _0x52ce8e[_0xb770('0x2c')]()['then'](function(){_0x2825e2[_0xb770('0x2d')](0xcc)[_0xb770('0x22')]();});}};}function handleEntityNotFound(_0x5a5b9f,_0x3d59d7){return function(_0x5c521a){if(!_0x5c521a){_0x5a5b9f['sendStatus'](0x194);}return _0x5c521a;};}function handleError(_0x2b0c3e,_0x998164){_0x998164=_0x998164||0x1f4;return function(_0x2b25ad){logger[_0xb770('0x1b')](_0x2b25ad[_0xb770('0x2e')]);if(_0x2b25ad[_0xb770('0x2f')]){delete _0x2b25ad[_0xb770('0x2f')];}_0x2b0c3e[_0xb770('0x2d')](_0x998164)[_0xb770('0x30')](_0x2b25ad);};}exports[_0xb770('0x31')]=function(_0x49d631,_0x407211){var _0x4039f4={},_0x51ac12={},_0x8250e3={'count':0x0,'rows':[]};var _0x13a014=_[_0xb770('0x32')](db[_0xb770('0x33')][_0xb770('0x34')],function(_0x555ea9){return{'name':_0x555ea9[_0xb770('0x35')],'type':_0x555ea9['type'][_0xb770('0x36')]};});_0x51ac12['model']=_[_0xb770('0x32')](_0x13a014,_0xb770('0x2f'));_0x51ac12[_0xb770('0x37')]=_[_0xb770('0x38')](_0x49d631['query']);_0x51ac12[_0xb770('0x39')]=_['intersection'](_0x51ac12[_0xb770('0x3a')],_0x51ac12[_0xb770('0x37')]);_0x4039f4['attributes']=_[_0xb770('0x3b')](_0x51ac12[_0xb770('0x3a')],qs['fields'](_0x49d631[_0xb770('0x37')][_0xb770('0x3c')]));_0x4039f4[_0xb770('0x3d')]=_0x4039f4[_0xb770('0x3d')][_0xb770('0x3e')]?_0x4039f4[_0xb770('0x3d')]:_0x51ac12[_0xb770('0x3a')];if(!_0x49d631[_0xb770('0x37')][_0xb770('0x3f')](_0xb770('0x40'))){_0x4039f4['limit']=qs[_0xb770('0x26')](_0x49d631[_0xb770('0x37')][_0xb770('0x26')]);_0x4039f4[_0xb770('0x24')]=qs[_0xb770('0x24')](_0x49d631['query'][_0xb770('0x24')]);}_0x4039f4[_0xb770('0x41')]=qs[_0xb770('0x42')](_0x49d631[_0xb770('0x37')][_0xb770('0x42')]);_0x4039f4[_0xb770('0x43')]=qs[_0xb770('0x39')](_[_0xb770('0x44')](_0x49d631[_0xb770('0x37')],_0x51ac12[_0xb770('0x39')]),_0x13a014);if(_0x49d631[_0xb770('0x37')]['filter']){_0x4039f4[_0xb770('0x43')]=_['merge'](_0x4039f4[_0xb770('0x43')],{'$or':_[_0xb770('0x32')](_0x13a014,function(_0x1de325){if(_0x1de325[_0xb770('0x45')]!==_0xb770('0x46')){var _0x472038={};_0x472038[_0x1de325['name']]={'$like':'%'+_0x49d631['query'][_0xb770('0x47')]+'%'};return _0x472038;}})});}_0x4039f4=_[_0xb770('0x48')]({},_0x4039f4,_0x49d631['options']);var _0x5802ff={'where':_0x4039f4[_0xb770('0x43')]};return db[_0xb770('0x33')][_0xb770('0x27')](_0x5802ff)[_0xb770('0x18')](function(_0x1f5d67){_0x8250e3[_0xb770('0x27')]=_0x1f5d67;if(_0x49d631['query'][_0xb770('0x49')]){_0x4039f4[_0xb770('0x4a')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x4039f4);})['then'](function(_0x2cee56){_0x8250e3[_0xb770('0x4b')]=_0x2cee56;return _0x8250e3;})[_0xb770('0x18')](respondWithFilteredResult(_0x407211,_0x4039f4))[_0xb770('0x20')](handleError(_0x407211,null));};exports[_0xb770('0x4c')]=function(_0x9523f1,_0x209101){var _0x2e5409={'raw':!![],'where':{'id':_0x9523f1[_0xb770('0x4d')]['id']}},_0xa6b2b8={};_0xa6b2b8[_0xb770('0x3a')]=_[_0xb770('0x38')](db[_0xb770('0x33')][_0xb770('0x34')]);_0xa6b2b8[_0xb770('0x37')]=_[_0xb770('0x38')](_0x9523f1[_0xb770('0x37')]);_0xa6b2b8[_0xb770('0x39')]=_['intersection'](_0xa6b2b8[_0xb770('0x3a')],_0xa6b2b8['query']);_0x2e5409[_0xb770('0x3d')]=_[_0xb770('0x3b')](_0xa6b2b8[_0xb770('0x3a')],qs['fields'](_0x9523f1[_0xb770('0x37')]['fields']));_0x2e5409['attributes']=_0x2e5409[_0xb770('0x3d')][_0xb770('0x3e')]?_0x2e5409['attributes']:_0xa6b2b8[_0xb770('0x3a')];if(_0x9523f1[_0xb770('0x37')][_0xb770('0x49')]){_0x2e5409[_0xb770('0x4a')]=[{'all':!![]}];}_0x2e5409=_[_0xb770('0x48')]({},_0x2e5409,_0x9523f1[_0xb770('0x4e')]);return db[_0xb770('0x33')][_0xb770('0x4f')](_0x2e5409)['then'](handleEntityNotFound(_0x209101,null))['then'](respondWithResult(_0x209101,null))[_0xb770('0x20')](handleError(_0x209101,null));};exports[_0xb770('0x2b')]=function(_0x2a13ef,_0x102816){if(_0x2a13ef[_0xb770('0x50')]['id']){delete _0x2a13ef['body']['id'];}return db[_0xb770('0x33')][_0xb770('0x4f')]({'where':{'id':_0x2a13ef['params']['id']}})[_0xb770('0x18')](handleEntityNotFound(_0x102816,null))[_0xb770('0x18')](saveUpdates(_0x2a13ef[_0xb770('0x50')],null))[_0xb770('0x18')](respondWithResult(_0x102816,null))['catch'](handleError(_0x102816,null));};exports[_0xb770('0x2c')]=function(_0x1e874f,_0x1bb436){return db['FaxMessage'][_0xb770('0x4f')]({'where':{'id':_0x1e874f['params']['id']}})[_0xb770('0x18')](handleEntityNotFound(_0x1bb436,null))['then'](removeEntity(_0x1bb436,null))[_0xb770('0x20')](handleError(_0x1bb436,null));};exports[_0xb770('0x51')]=function(_0x219e4b,_0x33fc18){return db[_0xb770('0x33')][_0xb770('0x51')]()[_0xb770('0x18')](respondWithResult(_0x33fc18,null))[_0xb770('0x20')](handleError(_0x33fc18,null));};var interaction_log=require(_0xb770('0x52'))(_0xb770('0x53'));exports[_0xb770('0x54')]=function(_0x3ee12e,_0x25f7ac,_0x412d12){var _0x184c8b={'agent':{},'channel':'fax'};if(_0x3ee12e[_0xb770('0x50')]['id']){delete _0x3ee12e['body']['id'];}_0x3ee12e['body']['read']=!![];_0x3ee12e['body'][_0xb770('0x55')]=moment()[_0xb770('0x56')](_0xb770('0x57'));_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')]=_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')]||_0x3ee12e[_0xb770('0x59')]['id'];_0x184c8b[_0xb770('0x5a')]['id']=_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')];return db[_0xb770('0x33')][_0xb770('0x4f')]({'where':{'id':_0x3ee12e[_0xb770('0x4d')]['id'],'UserId':null}})[_0xb770('0x18')](handleEntityNotFound(_0x25f7ac,null))[_0xb770('0x18')](saveUpdates(_0x3ee12e[_0xb770('0x50')],null))['then'](function(_0x8219db){if(_0x8219db){_0x184c8b[_0xb770('0x1e')]=_0x8219db[_0xb770('0x5b')]({'plain':!![]});return db[_0xb770('0x5c')][_0xb770('0x4f')]({'where':{'id':_0x8219db[_0xb770('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x25f7ac,null))[_0xb770('0x18')](function(_0x2d6c22){if(_0x2d6c22){return _0x2d6c22[_0xb770('0x2b')]({'UserId':_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')],'read1stAt':_[_0xb770('0x5e')](_0x2d6c22['read1stAt'])?moment()['format'](_0xb770('0x57')):undefined});}return null;})[_0xb770('0x18')](function(_0x51e1f7){if(_0x51e1f7){_0x184c8b[_0xb770('0x5f')]=_0x51e1f7[_0xb770('0x5b')]({'plain':!![]});interaction_log[_0xb770('0x19')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ee12e[_0xb770('0x59')]['id'],_0x3ee12e[_0xb770('0x59')][_0xb770('0x2f')],_0x3ee12e[_0xb770('0x59')][_0xb770('0x60')],_0x184c8b[_0xb770('0x5f')]['id'],_0x3ee12e[_0xb770('0x50')]?JSON[_0xb770('0x61')](_0x3ee12e[_0xb770('0x50')]):'null');return respondWithRpcPromise(_0xb770('0x62'),_0xb770('0x63'),_0x184c8b);}return null;})[_0xb770('0x18')](function(_0x4a6937){var _0x52e542=_0xb770('0x64')+_0x4a6937[_0xb770('0x1e')][_0xb770('0x65')];return db[_0xb770('0x66')][_0xb770('0x37')](_0x52e542,{'type':db[_0xb770('0x67')][_0xb770('0x68')]['SELECT'],'raw':!![]})[_0xb770('0x18')](function(_0xb268c8){return _0xb268c8;});})[_0xb770('0x18')](function(_0x1ab10d){if(_0x1ab10d){_0x184c8b[_0xb770('0x1e')][_0xb770('0x69')]=_0x1ab10d[0x0];if(!_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')])return;return db['User'][_0xb770('0x4f')]({'where':{'id':_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')],'role':_0xb770('0x5a')},'attributes':['id',_0xb770('0x2f'),_0xb770('0x6a'),_0xb770('0x6b'),_0xb770('0x6c')],'raw':!![]});}return null;})[_0xb770('0x18')](function(_0x1cf568){if(!_0x1cf568)return null;_0x184c8b[_0xb770('0x1e')][_0xb770('0x5a')]=_0x1cf568;return _0x184c8b;})[_0xb770('0x18')](function(_0x37822c){if(_0x37822c){if(_0x3ee12e[_0xb770('0x50')]['manual']){_0x184c8b[_0xb770('0x1e')]['interface']=util['format'](_0xb770('0x6d'),_0x3ee12e[_0xb770('0x59')]['name']);_0x184c8b[_0xb770('0x1e')][_0xb770('0x6e')]=_0x184c8b['channel'];_0x184c8b[_0xb770('0x1e')][_0xb770('0x6f')]=_0x184c8b[_0xb770('0x6e')];_0x184c8b[_0xb770('0x1e')][_0xb770('0x70')]=_0xb770('0x54');return respondWithRpcPromise(_0xb770('0x71'),_0xb770('0x71'),{'event':_0xb770('0x72'),'message':_0x184c8b['message']},client9002)[_0xb770('0x18')](function(){return _0x184c8b;});}return _0x184c8b;}return null;})[_0xb770('0x18')](respondWithResult(_0x25f7ac,null))[_0xb770('0x20')](handleError(_0x25f7ac,null));};var interaction_log=require(_0xb770('0x52'))(_0xb770('0x53'));exports[_0xb770('0x73')]=function(_0x120e4d,_0x5b4ff7,_0x43b8c7){var _0x518e9d={'agent':{},'channel':_0xb770('0x74')};if(_0x120e4d[_0xb770('0x50')]['id']){delete _0x120e4d[_0xb770('0x50')]['id'];}_0x120e4d[_0xb770('0x50')][_0xb770('0x58')]=_0x120e4d[_0xb770('0x50')]['UserId']||_0x120e4d[_0xb770('0x59')]['id'];_0x518e9d[_0xb770('0x5a')]['id']=_0x120e4d['body']['UserId'];return db['FaxMessage'][_0xb770('0x4f')]({'where':{'id':_0x120e4d[_0xb770('0x4d')]['id'],'UserId':null}})[_0xb770('0x18')](handleEntityNotFound(_0x5b4ff7,null))[_0xb770('0x18')](function(_0x2f1492){if(_0x2f1492){_0x518e9d[_0xb770('0x1e')]=_0x2f1492['get']({'plain':!![]});return db[_0xb770('0x5c')][_0xb770('0x4f')]({'where':{'id':_0x2f1492[_0xb770('0x5d')]}});}return null;})[_0xb770('0x18')](handleEntityNotFound(_0x5b4ff7,null))[_0xb770('0x18')](function(_0x133c9e){if(_0x133c9e){_0x518e9d[_0xb770('0x5f')]=_0x133c9e[_0xb770('0x5b')]({'plain':!![]});interaction_log[_0xb770('0x19')](_0xb770('0x75'),_0x120e4d[_0xb770('0x59')]['id'],_0x120e4d[_0xb770('0x59')][_0xb770('0x2f')],_0x120e4d[_0xb770('0x59')]['role'],_0x518e9d['interaction']['id'],_0x120e4d[_0xb770('0x50')]?JSON[_0xb770('0x61')](_0x120e4d[_0xb770('0x50')]):'null');return respondWithRpcPromise(_0xb770('0x76'),_0xb770('0x77'),_0x518e9d);}return null;})[_0xb770('0x18')](function(_0x14f596){var _0x4cc9f6=_0xb770('0x64')+_0x14f596[_0xb770('0x1e')][_0xb770('0x65')];return db[_0xb770('0x66')][_0xb770('0x37')](_0x4cc9f6,{'type':db['Sequelize']['QueryTypes'][_0xb770('0x78')],'raw':!![]})[_0xb770('0x18')](function(_0x292587){return _0x292587;});})[_0xb770('0x18')](function(_0x4b505c){if(_0x4b505c){_0x518e9d[_0xb770('0x1e')][_0xb770('0x69')]=_0x4b505c[0x0];if(!_0x120e4d[_0xb770('0x50')][_0xb770('0x58')])return;return db[_0xb770('0x79')][_0xb770('0x4f')]({'where':{'id':_0x120e4d[_0xb770('0x50')][_0xb770('0x58')],'role':_0xb770('0x5a')},'attributes':['id','name',_0xb770('0x6a'),_0xb770('0x6b'),_0xb770('0x6c')],'raw':!![]});}return null;})[_0xb770('0x18')](function(_0x5f408b){if(!_0x5f408b)return null;_0x518e9d['message'][_0xb770('0x5a')]=_0x5f408b;return _0x518e9d;})[_0xb770('0x18')](function(_0x5dfadf){if(_0x5dfadf){_0x5dfadf[_0xb770('0x1e')][_0xb770('0x7a')]=util[_0xb770('0x56')](_0xb770('0x6d'),_0x120e4d[_0xb770('0x59')][_0xb770('0x2f')]);_0x5dfadf[_0xb770('0x1e')]['channel']=_0x518e9d['channel'];_0x5dfadf[_0xb770('0x1e')][_0xb770('0x6f')]=_0x518e9d[_0xb770('0x6e')];_0x5dfadf[_0xb770('0x1e')]['event']=_0xb770('0x73');respondWithRpcPromise(_0xb770('0x71'),'EventManager',{'event':'rejectmessage','message':_0x5dfadf[_0xb770('0x1e')]},client9002);return _0x518e9d;}return null;})[_0xb770('0x18')](respondWithResult(_0x5b4ff7,null))[_0xb770('0x20')](handleError(_0x5b4ff7,null));};exports[_0xb770('0x7b')]=function(_0x1938be,_0x3f015d){var _0x5d8acd;return db[_0xb770('0x33')]['create'](_0x1938be[_0xb770('0x50')],{})['then'](function(_0x2ceb2e){_0x5d8acd=_0x2ceb2e;return db[_0xb770('0x7c')][_0xb770('0x7d')]({'where':{'id':_0x5d8acd[_0xb770('0x65')]}});})[_0xb770('0x18')](function(_0x680ffb){if(_['isNil'](_0x680ffb)){return;}else{_0x5d8acd[_0xb770('0x74')]=_0x680ffb[_0xb770('0x74')];return db[_0xb770('0x7e')][_0xb770('0x7d')]({'where':{'id':_0x5d8acd[_0xb770('0x7f')]}});}})[_0xb770('0x18')](function(_0x451f03){return respondWithRpcPromise(_0xb770('0x80'),_0xb770('0x80'),{'FaxAccountId':_['isNil'](_0x1938be['body'])?undefined:_0x1938be[_0xb770('0x50')][_0xb770('0x81')],'path':_[_0xb770('0x5e')](_0x451f03)?undefined:util[_0xb770('0x56')](_0xb770('0x82'),_0x451f03[_0xb770('0x83')]),'fax':_['isNil'](_0x5d8acd[_0xb770('0x74')])?undefined:_0x5d8acd[_0xb770('0x74')],'AttachmentId':_0x5d8acd['AttachmentId']},client9002);})['then'](respondWithResult(_0x3f015d,0xc9))[_0xb770('0x20')](handleError(_0x3f015d,null));};exports[_0xb770('0x84')]=function(_0x58a52f,_0x41fd69){var _0x2021b8=path['join'](config[_0xb770('0x85')],_0xb770('0x86'),_0xb770('0x87'),_0xb770('0x88'));return db['FaxMessage']['find']({'where':{'id':_0x58a52f[_0xb770('0x4d')]['id']},'include':[{'model':db[_0xb770('0x7e')],'as':_0xb770('0x7e')}]})[_0xb770('0x18')](handleEntityNotFound(_0x41fd69,null))['then'](function(_0x3b8714){if(_0x3b8714){return _0x41fd69['download'](path[_0xb770('0x89')](_0x2021b8,_0x3b8714[_0xb770('0x7e')][_0xb770('0x83')]));}})[_0xb770('0x20')](handleError(_0x41fd69,null));}; \ No newline at end of file +var _0x6244=['includeAll','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','SIP/%s','channel','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','contact','motionChannel','event','EventManager','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./faxMessage.socket','register','client','http','then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','name','send','FaxMessage','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','show','params'];(function(_0x4c1763,_0x57f8be){var _0x361563=function(_0x17a85d){while(--_0x17a85d){_0x4c1763['push'](_0x4c1763['shift']());}};_0x361563(++_0x57f8be);}(_0x6244,0x1e9));var _0x4624=function(_0x236725,_0x29ef3f){_0x236725=_0x236725-0x0;var _0xe9ead1=_0x6244[_0x236725];return _0xe9ead1;};'use strict';var emlformat=require(_0x4624('0x0'));var rimraf=require(_0x4624('0x1'));var zipdir=require(_0x4624('0x2'));var jsonpatch=require(_0x4624('0x3'));var rp=require(_0x4624('0x4'));var moment=require(_0x4624('0x5'));var BPromise=require(_0x4624('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4624('0x7'));var sox=require(_0x4624('0x8'));var csv=require('to-csv');var ejs=require(_0x4624('0x9'));var fs=require('fs');var fs_extra=require(_0x4624('0xa'));var _=require('lodash');var squel=require(_0x4624('0xb'));var crypto=require('crypto');var jsforce=require(_0x4624('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4624('0xd'));var querystring=require('querystring');var Papa=require(_0x4624('0xe'));var Redis=require(_0x4624('0xf'));var authService=require(_0x4624('0x10'));var qs=require(_0x4624('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4624('0x12'));var logger=require(_0x4624('0x13'))(_0x4624('0x14'));var utils=require(_0x4624('0x15'));var config=require(_0x4624('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4624('0x17')]=_[_0x4624('0x18')](config[_0x4624('0x17')],{'host':_0x4624('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4624('0x17')]));require(_0x4624('0x1a'))[_0x4624('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4624('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x4624('0x1c')][_0x4624('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2db9b5,_0xd825df,_0x4e9ed7,_0x59cf84){return new BPromise(function(_0x275e5f,_0x4a1f44){var _0x4fab76=_0x59cf84||client;return _0x4fab76['request'](_0x2db9b5,_0x4e9ed7)[_0x4624('0x1e')](function(_0x4b9428){logger[_0x4624('0x1f')]('FaxMessage,\x20%s,\x20%s',_0xd825df,_0x4624('0x20'));logger[_0x4624('0x21')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0xd825df,_0x4624('0x20'),JSON[_0x4624('0x22')](_0x4b9428));if(_0x4b9428[_0x4624('0x23')]){if(_0x4b9428[_0x4624('0x23')][_0x4624('0x24')]===0x1f4){logger[_0x4624('0x23')](_0x4624('0x25'),_0xd825df,_0x4b9428['error']['message']);return _0x4a1f44(_0x4b9428[_0x4624('0x23')][_0x4624('0x26')]);}logger['error'](_0x4624('0x25'),_0xd825df,_0x4b9428[_0x4624('0x23')][_0x4624('0x26')]);return _0x275e5f(_0x4b9428[_0x4624('0x23')][_0x4624('0x26')]);}else{logger[_0x4624('0x1f')]('FaxMessage,\x20%s,\x20%s',_0xd825df,_0x4624('0x20'));_0x275e5f(_0x4b9428[_0x4624('0x27')][_0x4624('0x26')]);}})[_0x4624('0x28')](function(_0x66044c){logger['error'](_0x4624('0x25'),_0xd825df,_0x66044c);_0x4a1f44(_0x66044c);});});}function respondWithStatusCode(_0x2e4f55,_0x45fa6d){_0x45fa6d=_0x45fa6d||0xcc;return function(_0x52efa0){if(_0x52efa0){return _0x2e4f55[_0x4624('0x29')](_0x45fa6d);}return _0x2e4f55[_0x4624('0x2a')](_0x45fa6d)[_0x4624('0x2b')]();};}function respondWithResult(_0x57981f,_0x135af6){_0x135af6=_0x135af6||0xc8;return function(_0x21e169){if(_0x21e169){return _0x57981f[_0x4624('0x2a')](_0x135af6)[_0x4624('0x2c')](_0x21e169);}};}function respondWithFilteredResult(_0x1e1e2a,_0x5ebb7d){return function(_0x21c9e0){if(_0x21c9e0){var _0x347713=typeof _0x5ebb7d['offset']===_0x4624('0x2d')&&typeof _0x5ebb7d[_0x4624('0x2e')]===_0x4624('0x2d');var _0x109103=_0x21c9e0[_0x4624('0x2f')];var _0x1f3868=_0x347713?0x0:_0x5ebb7d[_0x4624('0x30')];var _0x3ad5ee=_0x347713?_0x21c9e0[_0x4624('0x2f')]:_0x5ebb7d['offset']+_0x5ebb7d['limit'];var _0x2bb462;if(_0x3ad5ee>=_0x109103){_0x3ad5ee=_0x109103;_0x2bb462=0xc8;}else{_0x2bb462=0xce;}_0x1e1e2a['status'](_0x2bb462);return _0x1e1e2a[_0x4624('0x31')](_0x4624('0x32'),_0x1f3868+'-'+_0x3ad5ee+'/'+_0x109103)[_0x4624('0x2c')](_0x21c9e0);}return null;};}function patchUpdates(_0xdbe655){return function(_0x2d665f){try{jsonpatch[_0x4624('0x33')](_0x2d665f,_0xdbe655,!![]);}catch(_0x284065){return BPromise[_0x4624('0x34')](_0x284065);}return _0x2d665f[_0x4624('0x35')]();};}function saveUpdates(_0x2bda2c,_0x364a35){return function(_0x4524cd){if(_0x4524cd){return _0x4524cd[_0x4624('0x36')](_0x2bda2c)[_0x4624('0x1e')](function(_0xd7aab1){return _0xd7aab1;});}return null;};}function removeEntity(_0xf13a9c,_0x27c08e){return function(_0x5e1a7a){if(_0x5e1a7a){return _0x5e1a7a['destroy']()[_0x4624('0x1e')](function(){_0xf13a9c[_0x4624('0x2a')](0xcc)[_0x4624('0x2b')]();});}};}function handleEntityNotFound(_0x4c6781,_0x5437a0){return function(_0x50472c){if(!_0x50472c){_0x4c6781[_0x4624('0x29')](0x194);}return _0x50472c;};}function handleError(_0x317efe,_0x1a9f28){_0x1a9f28=_0x1a9f28||0x1f4;return function(_0x597872){logger[_0x4624('0x23')](_0x597872['stack']);if(_0x597872['name']){delete _0x597872[_0x4624('0x37')];}_0x317efe[_0x4624('0x2a')](_0x1a9f28)[_0x4624('0x38')](_0x597872);};}exports['index']=function(_0x3d123e,_0x162a30){var _0x4862ec={},_0x3a8d65={},_0x4e3155={'count':0x0,'rows':[]};var _0x115f15=_['map'](db[_0x4624('0x39')][_0x4624('0x3a')],function(_0x3e533f){return{'name':_0x3e533f[_0x4624('0x3b')],'type':_0x3e533f[_0x4624('0x3c')][_0x4624('0x3d')]};});_0x3a8d65[_0x4624('0x3e')]=_[_0x4624('0x3f')](_0x115f15,_0x4624('0x37'));_0x3a8d65['query']=_[_0x4624('0x40')](_0x3d123e[_0x4624('0x41')]);_0x3a8d65['filters']=_[_0x4624('0x42')](_0x3a8d65[_0x4624('0x3e')],_0x3a8d65[_0x4624('0x41')]);_0x4862ec[_0x4624('0x43')]=_[_0x4624('0x42')](_0x3a8d65[_0x4624('0x3e')],qs['fields'](_0x3d123e[_0x4624('0x41')][_0x4624('0x44')]));_0x4862ec[_0x4624('0x43')]=_0x4862ec[_0x4624('0x43')][_0x4624('0x45')]?_0x4862ec['attributes']:_0x3a8d65[_0x4624('0x3e')];if(!_0x3d123e[_0x4624('0x41')][_0x4624('0x46')]('nolimit')){_0x4862ec[_0x4624('0x2e')]=qs[_0x4624('0x2e')](_0x3d123e['query'][_0x4624('0x2e')]);_0x4862ec[_0x4624('0x30')]=qs['offset'](_0x3d123e[_0x4624('0x41')][_0x4624('0x30')]);}_0x4862ec['order']=qs[_0x4624('0x47')](_0x3d123e['query'][_0x4624('0x47')]);_0x4862ec[_0x4624('0x48')]=qs[_0x4624('0x49')](_[_0x4624('0x4a')](_0x3d123e[_0x4624('0x41')],_0x3a8d65[_0x4624('0x49')]),_0x115f15);if(_0x3d123e[_0x4624('0x41')][_0x4624('0x4b')]){_0x4862ec[_0x4624('0x48')]=_[_0x4624('0x4c')](_0x4862ec[_0x4624('0x48')],{'$or':_[_0x4624('0x3f')](_0x115f15,function(_0x4ac75e){if(_0x4ac75e[_0x4624('0x3c')]!==_0x4624('0x4d')){var _0x30d15d={};_0x30d15d[_0x4ac75e[_0x4624('0x37')]]={'$like':'%'+_0x3d123e[_0x4624('0x41')]['filter']+'%'};return _0x30d15d;}})});}_0x4862ec=_[_0x4624('0x4c')]({},_0x4862ec,_0x3d123e[_0x4624('0x4e')]);var _0x12edad={'where':_0x4862ec[_0x4624('0x48')]};return db[_0x4624('0x39')][_0x4624('0x2f')](_0x12edad)[_0x4624('0x1e')](function(_0x144c26){_0x4e3155[_0x4624('0x2f')]=_0x144c26;if(_0x3d123e[_0x4624('0x41')]['includeAll']){_0x4862ec[_0x4624('0x4f')]=[{'all':!![]}];}return db[_0x4624('0x39')][_0x4624('0x50')](_0x4862ec);})[_0x4624('0x1e')](function(_0x36a032){_0x4e3155['rows']=_0x36a032;return _0x4e3155;})[_0x4624('0x1e')](respondWithFilteredResult(_0x162a30,_0x4862ec))[_0x4624('0x28')](handleError(_0x162a30,null));};exports[_0x4624('0x51')]=function(_0x24832d,_0xe537fa){var _0x26ea8a={'raw':!![],'where':{'id':_0x24832d[_0x4624('0x52')]['id']}},_0x163df1={};_0x163df1['model']=_[_0x4624('0x40')](db[_0x4624('0x39')][_0x4624('0x3a')]);_0x163df1[_0x4624('0x41')]=_['keys'](_0x24832d[_0x4624('0x41')]);_0x163df1[_0x4624('0x49')]=_[_0x4624('0x42')](_0x163df1[_0x4624('0x3e')],_0x163df1[_0x4624('0x41')]);_0x26ea8a[_0x4624('0x43')]=_[_0x4624('0x42')](_0x163df1[_0x4624('0x3e')],qs['fields'](_0x24832d[_0x4624('0x41')][_0x4624('0x44')]));_0x26ea8a[_0x4624('0x43')]=_0x26ea8a[_0x4624('0x43')][_0x4624('0x45')]?_0x26ea8a[_0x4624('0x43')]:_0x163df1[_0x4624('0x3e')];if(_0x24832d[_0x4624('0x41')][_0x4624('0x53')]){_0x26ea8a[_0x4624('0x4f')]=[{'all':!![]}];}_0x26ea8a=_[_0x4624('0x4c')]({},_0x26ea8a,_0x24832d['options']);return db[_0x4624('0x39')][_0x4624('0x54')](_0x26ea8a)[_0x4624('0x1e')](handleEntityNotFound(_0xe537fa,null))[_0x4624('0x1e')](respondWithResult(_0xe537fa,null))[_0x4624('0x28')](handleError(_0xe537fa,null));};exports['update']=function(_0x4d3718,_0x1c36cd){if(_0x4d3718['body']['id']){delete _0x4d3718[_0x4624('0x55')]['id'];}return db['FaxMessage'][_0x4624('0x54')]({'where':{'id':_0x4d3718[_0x4624('0x52')]['id']}})[_0x4624('0x1e')](handleEntityNotFound(_0x1c36cd,null))[_0x4624('0x1e')](saveUpdates(_0x4d3718['body'],null))[_0x4624('0x1e')](respondWithResult(_0x1c36cd,null))[_0x4624('0x28')](handleError(_0x1c36cd,null));};exports['destroy']=function(_0x5d496e,_0x45e4cc){return db[_0x4624('0x39')][_0x4624('0x54')]({'where':{'id':_0x5d496e[_0x4624('0x52')]['id']}})[_0x4624('0x1e')](handleEntityNotFound(_0x45e4cc,null))[_0x4624('0x1e')](removeEntity(_0x45e4cc,null))[_0x4624('0x28')](handleError(_0x45e4cc,null));};exports[_0x4624('0x56')]=function(_0x5e9fba,_0xf38ae5){return db[_0x4624('0x39')][_0x4624('0x56')]()[_0x4624('0x1e')](respondWithResult(_0xf38ae5,null))[_0x4624('0x28')](handleError(_0xf38ae5,null));};var interaction_log=require(_0x4624('0x13'))(_0x4624('0x57'));exports[_0x4624('0x58')]=function(_0x1053ca,_0x416fa4,_0x46b6d0){var _0x2e2733={'agent':{},'channel':_0x4624('0x59')};if(_0x1053ca[_0x4624('0x55')]['id']){delete _0x1053ca[_0x4624('0x55')]['id'];}_0x1053ca[_0x4624('0x55')][_0x4624('0x5a')]=!![];_0x1053ca['body'][_0x4624('0x5b')]=moment()[_0x4624('0x5c')](_0x4624('0x5d'));_0x1053ca[_0x4624('0x55')][_0x4624('0x5e')]=_0x1053ca['body'][_0x4624('0x5e')]||_0x1053ca['user']['id'];_0x2e2733[_0x4624('0x5f')]['id']=_0x1053ca[_0x4624('0x55')]['UserId'];return db[_0x4624('0x39')][_0x4624('0x54')]({'where':{'id':_0x1053ca['params']['id'],'UserId':null}})[_0x4624('0x1e')](handleEntityNotFound(_0x416fa4,null))[_0x4624('0x1e')](saveUpdates(_0x1053ca[_0x4624('0x55')],null))[_0x4624('0x1e')](function(_0x4f18ff){if(_0x4f18ff){_0x2e2733[_0x4624('0x26')]=_0x4f18ff[_0x4624('0x60')]({'plain':!![]});return db[_0x4624('0x61')]['find']({'where':{'id':_0x4f18ff[_0x4624('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x416fa4,null))[_0x4624('0x1e')](function(_0x5a7d06){if(_0x5a7d06){return _0x5a7d06[_0x4624('0x36')]({'UserId':_0x1053ca[_0x4624('0x55')][_0x4624('0x5e')],'read1stAt':_[_0x4624('0x63')](_0x5a7d06[_0x4624('0x64')])?moment()[_0x4624('0x5c')](_0x4624('0x5d')):undefined});}return null;})['then'](function(_0x172ea9){if(_0x172ea9){_0x2e2733['interaction']=_0x172ea9[_0x4624('0x60')]({'plain':!![]});interaction_log[_0x4624('0x1f')](_0x4624('0x65'),_0x1053ca[_0x4624('0x66')]['id'],_0x1053ca[_0x4624('0x66')][_0x4624('0x37')],_0x1053ca[_0x4624('0x66')][_0x4624('0x67')],_0x2e2733[_0x4624('0x68')]['id'],_0x1053ca['body']?JSON[_0x4624('0x22')](_0x1053ca['body']):_0x4624('0x69'));return respondWithRpcPromise('AcceptMessage',_0x4624('0x6a'),_0x2e2733);}return null;})[_0x4624('0x1e')](function(_0x358cc9){var _0x591215=_0x4624('0x6b')+_0x358cc9[_0x4624('0x26')][_0x4624('0x6c')];return db[_0x4624('0x6d')][_0x4624('0x41')](_0x591215,{'type':db[_0x4624('0x6e')][_0x4624('0x6f')]['SELECT'],'raw':!![]})[_0x4624('0x1e')](function(_0x43368a){return _0x43368a;});})[_0x4624('0x1e')](function(_0x17782d){if(_0x17782d){_0x2e2733['message']['contact']=_0x17782d[0x0];if(!_0x1053ca['body'][_0x4624('0x5e')])return;return db[_0x4624('0x70')]['find']({'where':{'id':_0x1053ca['body']['UserId'],'role':_0x4624('0x5f')},'attributes':['id',_0x4624('0x37'),_0x4624('0x71'),_0x4624('0x72'),_0x4624('0x73')],'raw':!![]});}return null;})[_0x4624('0x1e')](function(_0x23c9c8){if(!_0x23c9c8)return null;_0x2e2733['message'][_0x4624('0x5f')]=_0x23c9c8;return _0x2e2733;})[_0x4624('0x1e')](function(_0x196206){if(_0x196206){if(_0x1053ca[_0x4624('0x55')][_0x4624('0x74')]){_0x2e2733['message'][_0x4624('0x75')]=util['format'](_0x4624('0x76'),_0x1053ca[_0x4624('0x66')][_0x4624('0x37')]);_0x2e2733[_0x4624('0x26')]['channel']=_0x2e2733[_0x4624('0x77')];_0x2e2733['message']['motionChannel']=_0x2e2733[_0x4624('0x77')];_0x2e2733[_0x4624('0x26')]['event']=_0x4624('0x58');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x2e2733[_0x4624('0x26')]},client9002)['then'](function(){return _0x2e2733;});}return _0x2e2733;}return null;})[_0x4624('0x1e')](respondWithResult(_0x416fa4,null))[_0x4624('0x28')](handleError(_0x416fa4,null));};var interaction_log=require(_0x4624('0x13'))(_0x4624('0x57'));exports['reject']=function(_0x3a0301,_0x32345c,_0x522289){var _0x244741={'agent':{},'channel':'fax'};if(_0x3a0301[_0x4624('0x55')]['id']){delete _0x3a0301[_0x4624('0x55')]['id'];}_0x3a0301['body'][_0x4624('0x5e')]=_0x3a0301[_0x4624('0x55')][_0x4624('0x5e')]||_0x3a0301[_0x4624('0x66')]['id'];_0x244741[_0x4624('0x5f')]['id']=_0x3a0301[_0x4624('0x55')]['UserId'];return db[_0x4624('0x39')][_0x4624('0x54')]({'where':{'id':_0x3a0301['params']['id'],'UserId':null}})[_0x4624('0x1e')](handleEntityNotFound(_0x32345c,null))['then'](function(_0x12a742){if(_0x12a742){_0x244741['message']=_0x12a742['get']({'plain':!![]});return db['FaxInteraction'][_0x4624('0x54')]({'where':{'id':_0x12a742[_0x4624('0x62')]}});}return null;})[_0x4624('0x1e')](handleEntityNotFound(_0x32345c,null))[_0x4624('0x1e')](function(_0xc7b1b6){if(_0xc7b1b6){_0x244741[_0x4624('0x68')]=_0xc7b1b6['get']({'plain':!![]});interaction_log[_0x4624('0x1f')](_0x4624('0x78'),_0x3a0301[_0x4624('0x66')]['id'],_0x3a0301[_0x4624('0x66')][_0x4624('0x37')],_0x3a0301['user'][_0x4624('0x67')],_0x244741['interaction']['id'],_0x3a0301[_0x4624('0x55')]?JSON[_0x4624('0x22')](_0x3a0301[_0x4624('0x55')]):_0x4624('0x69'));return respondWithRpcPromise(_0x4624('0x79'),_0x4624('0x7a'),_0x244741);}return null;})[_0x4624('0x1e')](function(_0x39bfd7){var _0x6af74c=_0x4624('0x6b')+_0x39bfd7[_0x4624('0x26')][_0x4624('0x6c')];return db[_0x4624('0x6d')][_0x4624('0x41')](_0x6af74c,{'type':db[_0x4624('0x6e')][_0x4624('0x6f')][_0x4624('0x7b')],'raw':!![]})[_0x4624('0x1e')](function(_0x5952ca){return _0x5952ca;});})['then'](function(_0x3c845d){if(_0x3c845d){_0x244741[_0x4624('0x26')][_0x4624('0x7c')]=_0x3c845d[0x0];if(!_0x3a0301['body'][_0x4624('0x5e')])return;return db[_0x4624('0x70')][_0x4624('0x54')]({'where':{'id':_0x3a0301[_0x4624('0x55')][_0x4624('0x5e')],'role':_0x4624('0x5f')},'attributes':['id','name',_0x4624('0x71'),_0x4624('0x72'),_0x4624('0x73')],'raw':!![]});}return null;})[_0x4624('0x1e')](function(_0x3fb1ef){if(!_0x3fb1ef)return null;_0x244741[_0x4624('0x26')][_0x4624('0x5f')]=_0x3fb1ef;return _0x244741;})['then'](function(_0x1724c4){if(_0x1724c4){_0x1724c4[_0x4624('0x26')][_0x4624('0x75')]=util[_0x4624('0x5c')](_0x4624('0x76'),_0x3a0301['user'][_0x4624('0x37')]);_0x1724c4[_0x4624('0x26')]['channel']=_0x244741[_0x4624('0x77')];_0x1724c4[_0x4624('0x26')][_0x4624('0x7d')]=_0x244741[_0x4624('0x77')];_0x1724c4[_0x4624('0x26')][_0x4624('0x7e')]='reject';respondWithRpcPromise('EventManager',_0x4624('0x7f'),{'event':_0x4624('0x80'),'message':_0x1724c4['message']},client9002);return _0x244741;}return null;})[_0x4624('0x1e')](respondWithResult(_0x32345c,null))[_0x4624('0x28')](handleError(_0x32345c,null));};exports[_0x4624('0x81')]=function(_0x55c23a,_0x381f67){var _0x86db92;return db['FaxMessage'][_0x4624('0x81')](_0x55c23a[_0x4624('0x55')],{})[_0x4624('0x1e')](function(_0x42400b){_0x86db92=_0x42400b;return db[_0x4624('0x82')][_0x4624('0x83')]({'where':{'id':_0x86db92[_0x4624('0x6c')]}});})['then'](function(_0x3fe9c0){if(_[_0x4624('0x63')](_0x3fe9c0)){return;}else{_0x86db92['fax']=_0x3fe9c0[_0x4624('0x59')];return db[_0x4624('0x84')][_0x4624('0x83')]({'where':{'id':_0x86db92[_0x4624('0x85')]}});}})[_0x4624('0x1e')](function(_0x13b1d4){return respondWithRpcPromise(_0x4624('0x86'),_0x4624('0x86'),{'FaxAccountId':_[_0x4624('0x63')](_0x55c23a[_0x4624('0x55')])?undefined:_0x55c23a[_0x4624('0x55')][_0x4624('0x87')],'path':_[_0x4624('0x63')](_0x13b1d4)?undefined:util[_0x4624('0x5c')](_0x4624('0x88'),_0x13b1d4[_0x4624('0x89')]),'fax':_['isNil'](_0x86db92[_0x4624('0x59')])?undefined:_0x86db92['fax'],'AttachmentId':_0x86db92['AttachmentId']},client9002);})[_0x4624('0x1e')](respondWithResult(_0x381f67,0xc9))[_0x4624('0x28')](handleError(_0x381f67,null));};exports[_0x4624('0x8a')]=function(_0x41e21e,_0x3951b5){var _0x3cce03=path[_0x4624('0x8b')](config[_0x4624('0x8c')],_0x4624('0x8d'),_0x4624('0x8e'),'attachments');return db[_0x4624('0x39')][_0x4624('0x54')]({'where':{'id':_0x41e21e['params']['id']},'include':[{'model':db[_0x4624('0x84')],'as':_0x4624('0x84')}]})[_0x4624('0x1e')](handleEntityNotFound(_0x3951b5,null))[_0x4624('0x1e')](function(_0x26a82e){if(_0x26a82e){return _0x3951b5[_0x4624('0x8a')](path[_0x4624('0x8b')](_0x3cce03,_0x26a82e['Attachment']['basename']));}})[_0x4624('0x28')](handleError(_0x3951b5,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a5c9163..dc60857 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 _0x4312=['FaxMessage','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x4312,0xaf));var _0x2431=function(_0x171dbc,_0x1e46fe){_0x171dbc=_0x171dbc-0x0;var _0x455fc6=_0x4312[_0x171dbc];return _0x455fc6;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x2431('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x2431('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2431('0x2'),'afterDestroy':_0x2431('0x3')};function emitEvent(_0x728b00){return function(_0x237ac5,_0x22db34,_0xbf4fd6){FaxMessageEvents['emit'](_0x728b00+':'+_0x237ac5['id'],_0x237ac5);FaxMessageEvents[_0x2431('0x4')](_0x728b00,_0x237ac5);_0xbf4fd6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x2431('0x5')](e,emitEvent(event));}}module[_0x2431('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x1298=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x1298,0x19e));var _0x8129=function(_0xad02fd,_0x5b4e3c){_0xad02fd=_0xad02fd-0x0;var _0x3a5cf7=_0x1298[_0xad02fd];return _0x3a5cf7;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x8129('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8129('0x1')](0x0);var events={'afterCreate':_0x8129('0x2'),'afterUpdate':_0x8129('0x3'),'afterDestroy':_0x8129('0x4')};function emitEvent(_0x6031b2){return function(_0x31d02a,_0x39e214,_0x4fbaf9){FaxMessageEvents[_0x8129('0x5')](_0x6031b2+':'+_0x31d02a['id'],_0x31d02a);FaxMessageEvents[_0x8129('0x5')](_0x6031b2,_0x31d02a);_0x4fbaf9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x8129('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 53dab18..9d01c28 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 _0x4ffb=['body','FULLTEXT','models','toLowerCase','direction','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','fax_messages'];(function(_0xf72fb9,_0x509c7b){var _0x4fab55=function(_0x5c8007){while(--_0x5c8007){_0xf72fb9['push'](_0xf72fb9['shift']());}};_0x4fab55(++_0x509c7b);}(_0x4ffb,0x123));var _0xb4ff=function(_0x10c4f9,_0x100fb4){_0x10c4f9=_0x10c4f9-0x0;var _0x522b09=_0x4ffb[_0x10c4f9];return _0x522b09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb4ff('0x0'))(_0xb4ff('0x1'));var moment=require(_0xb4ff('0x2'));var BPromise=require(_0xb4ff('0x3'));var rp=require(_0xb4ff('0x4'));var fs=require('fs');var path=require(_0xb4ff('0x5'));var rimraf=require(_0xb4ff('0x6'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x48a5f3,_0x4da686){return _0x48a5f3[_0xb4ff('0x7')]('FaxMessage',attributes,{'tableName':_0xb4ff('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xb4ff('0x9')],'type':_0xb4ff('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x201a12,_0x481b18,_0x174936){var _0x47b637=_0x48a5f3[_0xb4ff('0xb')];var _0x3373e3=_0x201a12['get']({'plain':!![]});if(_0x3373e3['direction'][_0xb4ff('0xc')]()==='in'||_0x3373e3[_0xb4ff('0xd')][_0xb4ff('0xc')]()==='out'&&!_0x3373e3[_0xb4ff('0xe')]&&!_[_0xb4ff('0xf')](_0x3373e3[_0xb4ff('0x10')])){_0x47b637[_0xb4ff('0x11')][_0xb4ff('0x12')]({'where':{'id':_0x3373e3[_0xb4ff('0x13')]}})[_0xb4ff('0x14')](function(_0x5143b4){if(_0x5143b4){_0x5143b4['update']({'lastMsgAt':_0x3373e3[_0xb4ff('0x15')],'lastMsgDirection':_0x3373e3[_0xb4ff('0xd')][_0xb4ff('0xc')]()});}})[_0xb4ff('0x16')](function(_0x1a3022){console[_0xb4ff('0x17')](_0x1a3022);});}_0x174936();}},'charset':_0xb4ff('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2d64=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','body','FULLTEXT','models','direction','out','secret','UserId','findOne','FaxInteractionId','then','createdAt','toLowerCase','catch','error','utf8mb4_unicode_ci'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x2d64,0xd8));var _0x42d6=function(_0x7af270,_0x6fd218){_0x7af270=_0x7af270-0x0;var _0x4a5512=_0x2d64[_0x7af270];return _0x4a5512;};'use strict';var _=require(_0x42d6('0x0'));var util=require(_0x42d6('0x1'));var logger=require(_0x42d6('0x2'))(_0x42d6('0x3'));var moment=require(_0x42d6('0x4'));var BPromise=require(_0x42d6('0x5'));var rp=require(_0x42d6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42d6('0x7'));var config=require(_0x42d6('0x8'));var attributes=require(_0x42d6('0x9'));module['exports']=function(_0x27342c,_0x4e592f){return _0x27342c[_0x42d6('0xa')](_0x42d6('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x42d6('0xc')],'type':_0x42d6('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ea778,_0x2fd070,_0x1817ba){var _0x4b1652=_0x27342c[_0x42d6('0xe')];var _0xbbf557=_0x5ea778['get']({'plain':!![]});if(_0xbbf557[_0x42d6('0xf')]['toLowerCase']()==='in'||_0xbbf557[_0x42d6('0xf')]['toLowerCase']()===_0x42d6('0x10')&&!_0xbbf557[_0x42d6('0x11')]&&!_['isNil'](_0xbbf557[_0x42d6('0x12')])){_0x4b1652['FaxInteraction'][_0x42d6('0x13')]({'where':{'id':_0xbbf557[_0x42d6('0x14')]}})[_0x42d6('0x15')](function(_0x5d93bd){if(_0x5d93bd){_0x5d93bd['update']({'lastMsgAt':_0xbbf557[_0x42d6('0x16')],'lastMsgDirection':_0xbbf557['direction'][_0x42d6('0x17')]()});}})[_0x42d6('0x18')](function(_0x13517e){console[_0x42d6('0x19')](_0x13517e);});}_0x1817ba();}},'charset':'utf8mb4','collate':_0x42d6('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e15ccfe..712f7c6 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 _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x425d,0x1e0));var _0xd425=function(_0x445dc4,_0x3764da){_0x445dc4=_0x445dc4-0x0;var _0x19f060=_0x425d[_0x445dc4];return _0x19f060;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});config[_0xd425('0xc')]=_[_0xd425('0xd')](config['redis'],{'host':_0xd425('0xe'),'port':0x18eb});var socket=require(_0xd425('0xf'))(new Redis(config[_0xd425('0xc')]));require(_0xd425('0x10'))[_0xd425('0x11')](socket);function respondWithRpcPromise(_0x2beb20,_0x30111e,_0x1969ba){return new BPromise(function(_0x3a7a01,_0x35a7f4){return client[_0xd425('0x12')](_0x2beb20,_0x1969ba)[_0xd425('0x13')](function(_0x26f6d2){logger[_0xd425('0x14')](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));logger[_0xd425('0x17')](_0xd425('0x18'),_0x30111e,_0xd425('0x16'),JSON[_0xd425('0x19')](_0x26f6d2));if(_0x26f6d2['error']){if(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1b')]===0x1f4){logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x35a7f4(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x3a7a01(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}else{logger['info'](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));_0x3a7a01(_0x26f6d2[_0xd425('0x1d')][_0xd425('0x1c')]);}})['catch'](function(_0x58a0c1){logger['error']('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x58a0c1);_0x35a7f4(_0x58a0c1);});});}exports[_0xd425('0x1e')]=function(_0xb92870){var _0x3c98db=this;return new Promise(function(_0x5e797a,_0x355af0){return db[_0xd425('0x1f')]['create'](_0xb92870[_0xd425('0x20')],{'raw':_0xb92870[_0xd425('0x21')]?_0xb92870[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![]})[_0xd425('0x13')](function(_0xb240c4){logger[_0xd425('0x14')](_0xd425('0x1e'),_0xb92870);logger[_0xd425('0x17')](_0xd425('0x1e'),_0xb92870,JSON[_0xd425('0x19')](_0xb240c4));_0x5e797a(_0xb240c4);})[_0xd425('0x23')](function(_0x47f44a){logger[_0xd425('0x1a')](_0xd425('0x1e'),_0x47f44a[_0xd425('0x1c')],_0xb92870);_0x355af0(_0x3c98db[_0xd425('0x1a')](0x1f4,_0x47f44a[_0xd425('0x1c')]));});});};exports[_0xd425('0x24')]=function(_0x3c3402){var _0x577e4b=this;return new Promise(function(_0x12f951,_0x177de2){return db[_0xd425('0x1f')]['update'](_0x3c3402[_0xd425('0x20')],{'raw':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x25')]||null:null,'attributes':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x26')]||null:null,'limit':_0x3c3402['options']?_0x3c3402[_0xd425('0x21')][_0xd425('0x27')]||null:null})[_0xd425('0x13')](function(_0x3695dd){logger[_0xd425('0x14')](_0xd425('0x24'),_0x3c3402);logger[_0xd425('0x17')](_0xd425('0x24'),_0x3c3402,JSON[_0xd425('0x19')](_0x3695dd));_0x12f951(_0x3695dd);})[_0xd425('0x23')](function(_0x3583b0){logger['error'](_0xd425('0x24'),_0x3583b0[_0xd425('0x1c')],_0x3c3402);_0x177de2(_0x577e4b[_0xd425('0x1a')](0x1f4,_0x3583b0[_0xd425('0x1c')]));});});}; \ No newline at end of file +var _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3a47db,_0x3fdf7c){var _0x1156c3=function(_0x7aa3d0){while(--_0x7aa3d0){_0x3a47db['push'](_0x3a47db['shift']());}};_0x1156c3(++_0x3fdf7c);}(_0xe14d,0x1ee));var _0xde14=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xe14d[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 43e1e36..13dcf71 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 _0x38fb=['removeListener','register','length','faxMessage:','save','remove','update','emit'];(function(_0x41463e,_0x3f25f3){var _0x37320a=function(_0x2027a8){while(--_0x2027a8){_0x41463e['push'](_0x41463e['shift']());}};_0x37320a(++_0x3f25f3);}(_0x38fb,0x7c));var _0xb38f=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x38fb[_0x1dd82f];return _0x353ca4;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb38f('0x0'),_0xb38f('0x1'),_0xb38f('0x2')];function createListener(_0x1a882d,_0x43f058){return function(_0x4d97e6){_0x43f058[_0xb38f('0x3')](_0x1a882d,_0x4d97e6);};}function removeListener(_0x2a0b7a,_0x3cb8e2){return function(){FaxMessageEvents[_0xb38f('0x4')](_0x2a0b7a,_0x3cb8e2);};}exports[_0xb38f('0x5')]=function(_0x1ae081){for(var _0x40e046=0x0,_0x327b38=events[_0xb38f('0x6')];_0x40e046<_0x327b38;_0x40e046++){var _0x1f54d4=events[_0x40e046];var _0x4475a0=createListener(_0xb38f('0x7')+_0x1f54d4,_0x1ae081);FaxMessageEvents['on'](_0x1f54d4,_0x4475a0);}}; \ No newline at end of file +var _0x605d=['./faxMessage.events','save','remove','update','emit','removeListener','register','length','faxMessage:'];(function(_0x4a1cda,_0x550243){var _0x2ef404=function(_0x36b2f9){while(--_0x36b2f9){_0x4a1cda['push'](_0x4a1cda['shift']());}};_0x2ef404(++_0x550243);}(_0x605d,0x195));var _0xd605=function(_0x1353bc,_0x432b07){_0x1353bc=_0x1353bc-0x0;var _0x3097a6=_0x605d[_0x1353bc];return _0x3097a6;};'use strict';var FaxMessageEvents=require(_0xd605('0x0'));var events=[_0xd605('0x1'),_0xd605('0x2'),_0xd605('0x3')];function createListener(_0x3814a4,_0x30d8c3){return function(_0x547b0b){_0x30d8c3[_0xd605('0x4')](_0x3814a4,_0x547b0b);};}function removeListener(_0x8f8e42,_0x1bb298){return function(){FaxMessageEvents[_0xd605('0x5')](_0x8f8e42,_0x1bb298);};}exports[_0xd605('0x6')]=function(_0x2d94e7){for(var _0x1d9af5=0x0,_0x1bcbec=events[_0xd605('0x7')];_0x1d9af5<_0x1bcbec;_0x1d9af5++){var _0x5ed168=events[_0x1d9af5];var _0x2bbe29=createListener(_0xd605('0x8')+_0x5ed168,_0x2d94e7);FaxMessageEvents['on'](_0x5ed168,_0x2bbe29);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f05a509..a36bc6a 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 _0xeb74=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','show','/:id/download','download','post','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x42d6ce,_0x529e73){var _0x4d8bed=function(_0x5cc906){while(--_0x5cc906){_0x42d6ce['push'](_0x42d6ce['shift']());}};_0x4d8bed(++_0x529e73);}(_0xeb74,0xe3));var _0x4eb7=function(_0x521f0c,_0x5ccf39){_0x521f0c=_0x521f0c-0x0;var _0x1e7f1c=_0xeb74[_0x521f0c];return _0x1e7f1c;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var fs_extra=require(_0x4eb7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var controller=require(_0x4eb7('0x9'));router[_0x4eb7('0xa')]('/',auth[_0x4eb7('0xb')](),controller['index']);router[_0x4eb7('0xa')]('/describe',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xc')]);router['get']('/:id',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xd')]);router['get'](_0x4eb7('0xe'),auth['isAuthenticated'](),controller[_0x4eb7('0xf')]);router[_0x4eb7('0x10')]('/',auth[_0x4eb7('0xb')](),interaction['tracked'](_0x4eb7('0x11'),_0x4eb7('0x12')),controller[_0x4eb7('0x13')]);router[_0x4eb7('0x14')](_0x4eb7('0x15'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x16')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x4eb7('0x17')]);router['put'](_0x4eb7('0x18'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x19')]);router[_0x4eb7('0x1a')](_0x4eb7('0x15'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x1b')]);module[_0x4eb7('0x1c')]=router; \ No newline at end of file +var _0xc788=['describe','/:id','show','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc788,0xc4));var _0x8c78=function(_0x285f9b,_0xfcae6c){_0x285f9b=_0x285f9b-0x0;var _0x32dd58=_0xc788[_0x285f9b];return _0x32dd58;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./faxMessage.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/download',auth[_0x8c78('0x9')](),controller['download']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),interaction['tracked'](_0x8c78('0x10'),_0x8c78('0x11')),controller['create']);router[_0x8c78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8c78('0x13')]);router[_0x8c78('0x12')](_0x8c78('0x14'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x15')]);router[_0x8c78('0x12')](_0x8c78('0x16'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x17')]);router[_0x8c78('0x18')]('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 082fd80..e1573ad 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 _0x9219=['STRING','rrmemory','INTEGER'];(function(_0x1cb25f,_0x4112d7){var _0x2e7bdd=function(_0x2980bd){while(--_0x2980bd){_0x1cb25f['push'](_0x1cb25f['shift']());}};_0x2e7bdd(++_0x4112d7);}(_0x9219,0x19e));var _0x9921=function(_0x3a7559,_0xc15f1f){_0x3a7559=_0x3a7559-0x0;var _0x345b1e=_0x9219[_0x3a7559];return _0x345b1e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9921('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9921('0x1'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9921('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x023e=['beepall','roundrobin','sequelize','INTEGER','ENUM'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x023e,0xc5));var _0xe023=function(_0x5c5af9,_0x5a23d8){_0x5c5af9=_0x5c5af9-0x0;var _0x4ffae1=_0x023e[_0x5c5af9];return _0x4ffae1;};'use strict';var Sequelize=require(_0xe023('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe023('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe023('0x2')]('rrmemory',_0xe023('0x3'),_0xe023('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe023('0x1')],'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 571f7c1..8564509 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 _0xedfe=['offset','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','index','map','FaxQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','rawAttributes','FaxQueueId','merge','findAndCountAll','UserId','agent','faxPause','updatedAt','format','getTeams','Team','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','union','isEmpty','removeAgents','addAgents','omit','isArray','userFaxQueue:remove','getAgents','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','limit','undefined'];(function(_0x1e08fa,_0x2177b8){var _0x48a80f=function(_0x38c6d3){while(--_0x38c6d3){_0x1e08fa['push'](_0x1e08fa['shift']());}};_0x48a80f(++_0x2177b8);}(_0xedfe,0x182));var _0xeedf=function(_0x14b3fb,_0x569124){_0x14b3fb=_0x14b3fb-0x0;var _0x3a7342=_0xedfe[_0x14b3fb];return _0x3a7342;};'use strict';var emlformat=require(_0xeedf('0x0'));var rimraf=require(_0xeedf('0x1'));var zipdir=require(_0xeedf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeedf('0x3'));var moment=require(_0xeedf('0x4'));var BPromise=require(_0xeedf('0x5'));var Mustache=require(_0xeedf('0x6'));var util=require(_0xeedf('0x7'));var path=require(_0xeedf('0x8'));var sox=require('sox');var csv=require(_0xeedf('0x9'));var ejs=require(_0xeedf('0xa'));var fs=require('fs');var fs_extra=require(_0xeedf('0xb'));var _=require(_0xeedf('0xc'));var squel=require('squel');var crypto=require(_0xeedf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeedf('0xe'));var toCsv=require(_0xeedf('0x9'));var querystring=require(_0xeedf('0xf'));var Papa=require('papaparse');var Redis=require(_0xeedf('0x10'));var authService=require(_0xeedf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeedf('0x12'));var hardwareService=require(_0xeedf('0x13'));var logger=require(_0xeedf('0x14'))(_0xeedf('0x15'));var utils=require('../../config/utils');var config=require(_0xeedf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xeedf('0x17'))['db'];config['redis']=_[_0xeedf('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeedf('0x19'))(new Redis(config['redis']));require(_0xeedf('0x1a'))[_0xeedf('0x1b')](socket);function respondWithStatusCode(_0x48a2ce,_0x1908d){_0x1908d=_0x1908d||0xcc;return function(_0x5c9a68){if(_0x5c9a68){return _0x48a2ce[_0xeedf('0x1c')](_0x1908d);}return _0x48a2ce[_0xeedf('0x1d')](_0x1908d)[_0xeedf('0x1e')]();};}function respondWithResult(_0x4a5603,_0x515993){_0x515993=_0x515993||0xc8;return function(_0x524909){if(_0x524909){return _0x4a5603['status'](_0x515993)[_0xeedf('0x1f')](_0x524909);}};}function respondWithFilteredResult(_0x107620,_0x17a8f1){return function(_0x1f60f3){if(_0x1f60f3){var _0x248f37=typeof _0x17a8f1['offset']==='undefined'&&typeof _0x17a8f1[_0xeedf('0x20')]===_0xeedf('0x21');var _0x15e3cd=_0x1f60f3['count'];var _0x3401f1=_0x248f37?0x0:_0x17a8f1[_0xeedf('0x22')];var _0x44a520=_0x248f37?_0x1f60f3['count']:_0x17a8f1[_0xeedf('0x22')]+_0x17a8f1[_0xeedf('0x20')];var _0x18e4df;if(_0x44a520>=_0x15e3cd){_0x44a520=_0x15e3cd;_0x18e4df=0xc8;}else{_0x18e4df=0xce;}_0x107620['status'](_0x18e4df);return _0x107620[_0xeedf('0x23')](_0xeedf('0x24'),_0x3401f1+'-'+_0x44a520+'/'+_0x15e3cd)['json'](_0x1f60f3);}return null;};}function patchUpdates(_0x2c024e){return function(_0x5ee5c1){try{jsonpatch[_0xeedf('0x25')](_0x5ee5c1,_0x2c024e,!![]);}catch(_0x2ec7dc){return BPromise[_0xeedf('0x26')](_0x2ec7dc);}return _0x5ee5c1[_0xeedf('0x27')]();};}function saveUpdates(_0x393565,_0x113c0f){return function(_0x243463){if(_0x243463){return _0x243463[_0xeedf('0x28')](_0x393565)[_0xeedf('0x29')](function(_0x13b2c4){return _0x13b2c4;});}return null;};}function removeEntity(_0x11e73b,_0x404864){return function(_0x4af9d7){if(_0x4af9d7){return _0x4af9d7[_0xeedf('0x2a')]()[_0xeedf('0x29')](function(){var _0x86c8cc=_0x4af9d7[_0xeedf('0x2b')]({'plain':!![]});var _0x4b09b6='FaxQueues';return db['UserProfileResource'][_0xeedf('0x2a')]({'where':{'type':_0x4b09b6,'resourceId':_0x86c8cc['id']}})[_0xeedf('0x29')](function(){return _0x4af9d7;});})[_0xeedf('0x29')](function(){_0x11e73b[_0xeedf('0x1d')](0xcc)[_0xeedf('0x1e')]();});}};}function handleEntityNotFound(_0x50d73b,_0x1518e4){return function(_0x1dee52){if(!_0x1dee52){_0x50d73b[_0xeedf('0x1c')](0x194);}return _0x1dee52;};}function handleError(_0x31a12a,_0x27ac3b){_0x27ac3b=_0x27ac3b||0x1f4;return function(_0x24f200){logger['error'](_0x24f200[_0xeedf('0x2c')]);if(_0x24f200[_0xeedf('0x2d')]){delete _0x24f200[_0xeedf('0x2d')];}_0x31a12a[_0xeedf('0x1d')](_0x27ac3b)[_0xeedf('0x2e')](_0x24f200);};}exports[_0xeedf('0x2f')]=function(_0xd54d61,_0x3c777e){var _0x492021={},_0x29a995={},_0x229428={'count':0x0,'rows':[]};var _0x100ecb=_[_0xeedf('0x30')](db[_0xeedf('0x31')]['rawAttributes'],function(_0x530463){return{'name':_0x530463[_0xeedf('0x32')],'type':_0x530463[_0xeedf('0x33')][_0xeedf('0x34')]};});_0x29a995[_0xeedf('0x35')]=_[_0xeedf('0x30')](_0x100ecb,_0xeedf('0x2d'));_0x29a995[_0xeedf('0x36')]=_[_0xeedf('0x37')](_0xd54d61[_0xeedf('0x36')]);_0x29a995[_0xeedf('0x38')]=_[_0xeedf('0x39')](_0x29a995[_0xeedf('0x35')],_0x29a995[_0xeedf('0x36')]);_0x492021[_0xeedf('0x3a')]=_[_0xeedf('0x39')](_0x29a995[_0xeedf('0x35')],qs[_0xeedf('0x3b')](_0xd54d61[_0xeedf('0x36')][_0xeedf('0x3b')]));_0x492021['attributes']=_0x492021['attributes'][_0xeedf('0x3c')]?_0x492021['attributes']:_0x29a995[_0xeedf('0x35')];if(!_0xd54d61[_0xeedf('0x36')][_0xeedf('0x3d')](_0xeedf('0x3e'))){_0x492021[_0xeedf('0x20')]=qs[_0xeedf('0x20')](_0xd54d61[_0xeedf('0x36')][_0xeedf('0x20')]);_0x492021[_0xeedf('0x22')]=qs[_0xeedf('0x22')](_0xd54d61[_0xeedf('0x36')][_0xeedf('0x22')]);}_0x492021[_0xeedf('0x3f')]=qs[_0xeedf('0x40')](_0xd54d61[_0xeedf('0x36')][_0xeedf('0x40')]);_0x492021['where']=qs[_0xeedf('0x38')](_[_0xeedf('0x41')](_0xd54d61['query'],_0x29a995['filters']),_0x100ecb);if(_0xd54d61[_0xeedf('0x36')][_0xeedf('0x42')]){_0x492021[_0xeedf('0x43')]=_['merge'](_0x492021[_0xeedf('0x43')],{'$or':_['map'](_0x100ecb,function(_0x7d0b1f){if(_0x7d0b1f[_0xeedf('0x33')]!=='VIRTUAL'){var _0x582003={};_0x582003[_0x7d0b1f[_0xeedf('0x2d')]]={'$like':'%'+_0xd54d61[_0xeedf('0x36')][_0xeedf('0x42')]+'%'};return _0x582003;}})});}_0x492021=_['merge']({},_0x492021,_0xd54d61['options']);var _0x3a12d8={'where':_0x492021['where']};return db[_0xeedf('0x31')][_0xeedf('0x44')](_0x3a12d8)[_0xeedf('0x29')](function(_0x3e5ba4){_0x229428[_0xeedf('0x44')]=_0x3e5ba4;if(_0xd54d61[_0xeedf('0x36')][_0xeedf('0x45')]){_0x492021[_0xeedf('0x46')]=[{'all':!![]}];}return db['FaxQueue'][_0xeedf('0x47')](_0x492021);})[_0xeedf('0x29')](function(_0x4c7709){_0x229428[_0xeedf('0x48')]=_0x4c7709;return _0x229428;})[_0xeedf('0x29')](respondWithFilteredResult(_0x3c777e,_0x492021))[_0xeedf('0x49')](handleError(_0x3c777e,null));};exports[_0xeedf('0x4a')]=function(_0x53f645,_0x649693){var _0x39ea97={'raw':!![],'where':{'id':_0x53f645[_0xeedf('0x4b')]['id']}},_0x581c88={};_0x581c88[_0xeedf('0x35')]=_['keys'](db[_0xeedf('0x31')]['rawAttributes']);_0x581c88[_0xeedf('0x36')]=_[_0xeedf('0x37')](_0x53f645[_0xeedf('0x36')]);_0x581c88['filters']=_[_0xeedf('0x39')](_0x581c88[_0xeedf('0x35')],_0x581c88[_0xeedf('0x36')]);_0x39ea97['attributes']=_[_0xeedf('0x39')](_0x581c88[_0xeedf('0x35')],qs[_0xeedf('0x3b')](_0x53f645['query'][_0xeedf('0x3b')]));_0x39ea97[_0xeedf('0x3a')]=_0x39ea97[_0xeedf('0x3a')][_0xeedf('0x3c')]?_0x39ea97['attributes']:_0x581c88['model'];if(_0x53f645['query'][_0xeedf('0x45')]){_0x39ea97[_0xeedf('0x46')]=[{'all':!![]}];}_0x39ea97=_['merge']({},_0x39ea97,_0x53f645[_0xeedf('0x4c')]);return db[_0xeedf('0x31')][_0xeedf('0x4d')](_0x39ea97)[_0xeedf('0x29')](handleEntityNotFound(_0x649693,null))[_0xeedf('0x29')](respondWithResult(_0x649693,null))['catch'](handleError(_0x649693,null));};exports[_0xeedf('0x4e')]=function(_0xa14d89,_0x460199){return db[_0xeedf('0x31')]['create'](_0xa14d89[_0xeedf('0x4f')],{})[_0xeedf('0x29')](function(_0x1ad177){var _0x410b88=_0xa14d89[_0xeedf('0x50')][_0xeedf('0x2b')]({'plain':!![]});if(!_0x410b88)throw new Error(_0xeedf('0x51'));if(_0x410b88[_0xeedf('0x52')]===_0xeedf('0x50')){var _0x419023=_0x1ad177['get']({'plain':!![]});var _0xbc9b8b='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0xbc9b8b,'userProfileId':_0x410b88[_0xeedf('0x53')]},'raw':!![]})[_0xeedf('0x29')](function(_0x5d338f){if(_0x5d338f&&_0x5d338f[_0xeedf('0x54')]===0x0){return db[_0xeedf('0x55')][_0xeedf('0x4e')]({'name':_0x419023[_0xeedf('0x2d')],'resourceId':_0x419023['id'],'type':_0x5d338f[_0xeedf('0x2d')],'sectionId':_0x5d338f['id']},{})[_0xeedf('0x29')](function(){return _0x1ad177;});}else{return _0x1ad177;}})[_0xeedf('0x49')](function(_0x29f4b0){logger[_0xeedf('0x56')](_0xeedf('0x57'),_0x29f4b0);throw _0x29f4b0;});}return _0x1ad177;})['then'](respondWithResult(_0x460199,0xc9))[_0xeedf('0x49')](handleError(_0x460199,null));};exports['update']=function(_0x598927,_0x27775c){if(_0x598927['body']['id']){delete _0x598927[_0xeedf('0x4f')]['id'];}return db[_0xeedf('0x31')]['find']({'where':{'id':_0x598927[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x27775c,null))[_0xeedf('0x29')](saveUpdates(_0x598927[_0xeedf('0x4f')],null))['then'](respondWithResult(_0x27775c,null))[_0xeedf('0x49')](handleError(_0x27775c,null));};exports[_0xeedf('0x2a')]=function(_0x181d97,_0x5285e2){return db[_0xeedf('0x31')][_0xeedf('0x4d')]({'where':{'id':_0x181d97[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x5285e2,null))[_0xeedf('0x29')](removeEntity(_0x5285e2,null))[_0xeedf('0x49')](handleError(_0x5285e2,null));};exports['describe']=function(_0x3f9adb,_0x49741e){return db['FaxQueue'][_0xeedf('0x58')]()[_0xeedf('0x29')](respondWithResult(_0x49741e,null))[_0xeedf('0x49')](handleError(_0x49741e,null));};exports[_0xeedf('0x59')]=function(_0x1710cb,_0x2f4ccd,_0x29b7eb){var _0x1bee39={'raw':!![],'where':{}},_0x4194e6={},_0x2febb6;return db['FaxQueue']['findOne']({'where':{'id':_0x1710cb[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x2f4ccd,null))[_0xeedf('0x29')](function(_0xb86c83){if(_0xb86c83){_0x2febb6=_0xb86c83[_0xeedf('0x2b')]({'plain':!![]});_0x4194e6[_0xeedf('0x35')]=_[_0xeedf('0x37')](db[_0xeedf('0x5a')][_0xeedf('0x5b')]);_0x4194e6[_0xeedf('0x36')]=_[_0xeedf('0x37')](_0x1710cb[_0xeedf('0x36')]);_0x4194e6[_0xeedf('0x38')]=_['intersection'](_0x4194e6[_0xeedf('0x35')],_0x4194e6[_0xeedf('0x36')]);_0x1bee39['attributes']=_[_0xeedf('0x39')](_0x4194e6[_0xeedf('0x35')],qs['fields'](_0x1710cb[_0xeedf('0x36')][_0xeedf('0x3b')]));_0x1bee39['attributes']=_0x1bee39[_0xeedf('0x3a')]['length']?_0x1bee39[_0xeedf('0x3a')]:_0x4194e6[_0xeedf('0x35')];if(!_0x1710cb[_0xeedf('0x36')][_0xeedf('0x3d')](_0xeedf('0x3e'))){_0x1bee39[_0xeedf('0x20')]=qs[_0xeedf('0x20')](_0x1710cb[_0xeedf('0x36')][_0xeedf('0x20')]);_0x1bee39[_0xeedf('0x22')]=qs['offset'](_0x1710cb[_0xeedf('0x36')][_0xeedf('0x22')]);}_0x1bee39['order']=qs[_0xeedf('0x40')](_0x1710cb[_0xeedf('0x36')][_0xeedf('0x40')]);_0x1bee39[_0xeedf('0x43')]=qs['filters'](_[_0xeedf('0x41')](_0x1710cb[_0xeedf('0x36')],_0x4194e6['filters']));_0x1bee39[_0xeedf('0x43')][_0xeedf('0x5c')]=_0xb86c83['id'];if(_0x1710cb[_0xeedf('0x36')]['filter']){_0x1bee39[_0xeedf('0x43')]=_[_0xeedf('0x5d')](_0x1bee39[_0xeedf('0x43')],{'$or':_[_0xeedf('0x30')](_0x1bee39[_0xeedf('0x3a')],function(_0x13300b){var _0x2b3e49={};_0x2b3e49[_0x13300b]={'$like':'%'+_0x1710cb[_0xeedf('0x36')][_0xeedf('0x42')]+'%'};return _0x2b3e49;})});}_0x1bee39=_[_0xeedf('0x5d')]({},_0x1bee39,_0x1710cb[_0xeedf('0x4c')]);return db['UserFaxQueue'][_0xeedf('0x47')](_0x1bee39);}})['then'](function(_0x1e32e1){if(_0x1e32e1){return db['User'][_0xeedf('0x5e')]({'where':{'id':_[_0xeedf('0x30')](_0x1e32e1,_0xeedf('0x5f')),'role':_0xeedf('0x60')},'attributes':['id',_0xeedf('0x2d'),_0xeedf('0x61'),_0xeedf('0x62'),'createdAt']});}})[_0xeedf('0x29')](function(_0x47ac4a){if(_0x47ac4a){return{'count':_0x47ac4a['count'],'rows':_['map'](_0x47ac4a[_0xeedf('0x48')],function(_0x1b01f6){return{'membername':_0x1b01f6[_0xeedf('0x2d')],'UserId':_0x1b01f6['id'],'queue_name':_0x2febb6[_0xeedf('0x2d')],'FaxQueueId':_0x2febb6['id'],'interface':util[_0xeedf('0x63')]('%s/%s','SIP',_0x1b01f6['name']),'penalty':0x0,'paused':_0x1b01f6['faxPause'],'createdAt':_0x1b01f6['createdAt'],'updatedAt':_0x1b01f6[_0xeedf('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xeedf('0x29')](respondWithFilteredResult(_0x2f4ccd,_0x1bee39))[_0xeedf('0x49')](handleError(_0x2f4ccd,null));};exports[_0xeedf('0x64')]=function(_0x187463,_0x4f7a80,_0x26ca9a){var _0x27833e={};var _0x4d7e7a={};var _0x30535c;var _0x3bc68a;return db[_0xeedf('0x31')]['findOne']({'where':{'id':_0x187463[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x4f7a80,null))[_0xeedf('0x29')](function(_0x16802d){if(_0x16802d){_0x30535c=_0x16802d;_0x4d7e7a[_0xeedf('0x35')]=_[_0xeedf('0x37')](db[_0xeedf('0x65')][_0xeedf('0x5b')]);_0x4d7e7a[_0xeedf('0x36')]=_[_0xeedf('0x37')](_0x187463[_0xeedf('0x36')]);_0x4d7e7a[_0xeedf('0x38')]=_[_0xeedf('0x39')](_0x4d7e7a[_0xeedf('0x35')],_0x4d7e7a[_0xeedf('0x36')]);_0x27833e[_0xeedf('0x3a')]=_['intersection'](_0x4d7e7a[_0xeedf('0x35')],qs['fields'](_0x187463[_0xeedf('0x36')]['fields']));_0x27833e[_0xeedf('0x3a')]=_0x27833e[_0xeedf('0x3a')]['length']?_0x27833e[_0xeedf('0x3a')]:_0x4d7e7a[_0xeedf('0x35')];_0x27833e[_0xeedf('0x3f')]=qs[_0xeedf('0x40')](_0x187463[_0xeedf('0x36')][_0xeedf('0x40')]);_0x27833e[_0xeedf('0x43')]=qs[_0xeedf('0x38')](_[_0xeedf('0x41')](_0x187463[_0xeedf('0x36')],_0x4d7e7a[_0xeedf('0x38')]));if(_0x187463[_0xeedf('0x36')][_0xeedf('0x42')]){_0x27833e['where']=_[_0xeedf('0x5d')](_0x27833e[_0xeedf('0x43')],{'$or':_[_0xeedf('0x30')](_0x27833e[_0xeedf('0x3a')],function(_0x324806){var _0x385734={};_0x385734[_0x324806]={'$like':'%'+_0x187463[_0xeedf('0x36')][_0xeedf('0x42')]+'%'};return _0x385734;})});}_0x27833e=_[_0xeedf('0x5d')]({},_0x27833e,_0x187463[_0xeedf('0x4c')]);return _0x30535c[_0xeedf('0x64')](_0x27833e);}})[_0xeedf('0x29')](function(_0xef8f79){if(_0xef8f79){_0x3bc68a=_0xef8f79[_0xeedf('0x3c')];if(!_0x187463['query'][_0xeedf('0x3d')](_0xeedf('0x3e'))){_0x27833e[_0xeedf('0x20')]=qs['limit'](_0x187463[_0xeedf('0x36')][_0xeedf('0x20')]);_0x27833e['offset']=qs['offset'](_0x187463['query']['offset']);}return _0x30535c['getTeams'](_0x27833e);}})[_0xeedf('0x29')](function(_0x3a9776){if(_0x3a9776){return _0x3a9776?{'count':_0x3bc68a,'rows':_0x3a9776}:null;}})['then'](respondWithResult(_0x4f7a80,null))[_0xeedf('0x49')](handleError(_0x4f7a80,null));};exports[_0xeedf('0x66')]=function(_0x3248e1,_0x30f33f,_0xdc3dd1){var _0xf8920d=_0x3248e1[_0xeedf('0x4f')][_0xeedf('0x67')];return db[_0xeedf('0x65')][_0xeedf('0x47')]({'where':{'id':_0xf8920d},'attributes':['id'],'include':[{'model':db[_0xeedf('0x68')],'as':'Agents','attributes':['id','name',_0xeedf('0x69'),_0xeedf('0x6a'),_0xeedf('0x6b')],'raw':!![]}]})[_0xeedf('0x29')](function(_0x360f46){if(_0x360f46){var _0x15e6ef=_[_0xeedf('0x6c')](_0x360f46,function(_0x4652a8){var _0xb231ff=_0x4652a8[_0xeedf('0x2b')]({'plain':!![]});return _0xb231ff[_0xeedf('0x6d')];});return db[_0xeedf('0x31')][_0xeedf('0x4d')]({'where':{'id':_0x3248e1[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](function(_0x591abc){return db[_0xeedf('0x6e')][_0xeedf('0x6f')](function(_0x2a0d6f){return _0x591abc[_0xeedf('0x66')](_0xf8920d,{'transaction':_0x2a0d6f})[_0xeedf('0x29')](function(){return BPromise[_0xeedf('0x70')](_0x15e6ef,function(_0x10a367){return db[_0xeedf('0x5a')][_0xeedf('0x71')]({'where':{'UserId':_0x10a367['id'],'FaxQueueId':_0x3248e1[_0xeedf('0x4b')]['id']},'transaction':_0x2a0d6f});});})['then'](function(){_0x15e6ef['forEach'](function(_0x4ac866){socket[_0xeedf('0x72')](_0xeedf('0x73'),{'UserId':_0x4ac866['id'],'FaxQueueId':_0x591abc['id']});});});});});}})[_0xeedf('0x29')](respondWithStatusCode(_0x30f33f,null))[_0xeedf('0x49')](handleError(_0x30f33f,null));};exports[_0xeedf('0x74')]=function(_0x50d2d9,_0x1af30e,_0x2fdac7){return db[_0xeedf('0x65')][_0xeedf('0x47')]({'where':{'id':_0x50d2d9[_0xeedf('0x36')][_0xeedf('0x67')]},'attributes':['id'],'include':[{'model':db[_0xeedf('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1af30e,null))[_0xeedf('0x29')](function(_0x56348f){var _0x13fa35=_[_0xeedf('0x30')](_0x56348f,'id');var _0x39d690=[];var _0xfcecb3=[];var _0x53e00a=squel[_0xeedf('0x75')]();_0x53e00a['field'](_0xeedf('0x76'))[_0xeedf('0x77')](_0xeedf('0x78'),'tq')[_0xeedf('0x79')]('user_has_teams','ut',_0xeedf('0x7a'))[_0xeedf('0x43')](_0xeedf('0x7b'),_0x50d2d9[_0xeedf('0x4b')]['id']);for(var _0x2be469=0x0;_0x2be469<_0x56348f[_0xeedf('0x3c')];_0x2be469+=0x1){let _0x3e5d35=_0x56348f[_0x2be469];for(var _0x6c5cac=0x0;_0x6c5cac<_0x3e5d35[_0xeedf('0x6d')]['length'];_0x6c5cac+=0x1){let _0x4f52f0=_0x3e5d35[_0xeedf('0x6d')][_0x6c5cac];var _0x2775d6=_0x53e00a[_0xeedf('0x7c')]();_0x2775d6['where'](_0xeedf('0x7d'),_0x4f52f0['id']);_0xfcecb3[_0xeedf('0x7e')](db[_0xeedf('0x6e')][_0xeedf('0x36')](_0x2775d6[_0xeedf('0x7f')](),{'type':db[_0xeedf('0x6e')][_0xeedf('0x80')][_0xeedf('0x81')]})['then'](function(_0x2033d9){if(_0x2033d9[_0xeedf('0x3c')]===0x1){return _0x4f52f0['id'];}else{var _0x41b39a=_['every'](_['map'](_0x2033d9,_0xeedf('0x82')),function(_0x422cc0){return _['includes'](_0x13fa35,_0x422cc0);});if(_0x41b39a){return _0x4f52f0['id'];}}}));}}return BPromise['all'](_0xfcecb3)[_0xeedf('0x29')](function(_0x5ce1c7){_0x39d690=_(_0x39d690)[_0xeedf('0x83')](_0x5ce1c7)['compact']()['value']();return db[_0xeedf('0x31')][_0xeedf('0x4d')]({'where':{'id':_0x50d2d9['params']['id']}})[_0xeedf('0x29')](function(_0x2312e0){return db[_0xeedf('0x6e')][_0xeedf('0x6f')](function(_0x4312b6){return _0x2312e0[_0xeedf('0x74')](_0x50d2d9['query']['ids'],{'transaction':_0x4312b6})[_0xeedf('0x29')](function(){if(!_[_0xeedf('0x84')](_0x39d690)){return _0x2312e0[_0xeedf('0x85')](_0x39d690,{'transaction':_0x4312b6});}})[_0xeedf('0x29')](function(){_0x39d690['forEach'](function(_0x17d070){socket['emit']('userFaxQueue:remove',{'UserId':_0x17d070,'FaxQueueId':_0x2312e0['id']});});});});});});})[_0xeedf('0x29')](respondWithStatusCode(_0x1af30e,null))[_0xeedf('0x49')](handleError(_0x1af30e,null));};exports[_0xeedf('0x86')]=function(_0x2e995e,_0x5a9a8a,_0x2be643){return db[_0xeedf('0x31')]['find']({'where':{'id':_0x2e995e[_0xeedf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a9a8a,null))[_0xeedf('0x29')](function(_0x244555){if(_0x244555){return _0x244555['addAgents'](_0x2e995e[_0xeedf('0x4f')][_0xeedf('0x67')],_[_0xeedf('0x87')](_0x2e995e[_0xeedf('0x4f')],[_0xeedf('0x67'),'id'])||{})['spread'](function(_0x1aba27){for(var _0x5b17fd=0x0;_0x5b17fd<_0x2e995e['body'][_0xeedf('0x67')][_0xeedf('0x3c')];_0x5b17fd+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x2e995e['body'][_0xeedf('0x67')][_0x5b17fd]),'FaxQueueId':Number(_0x2e995e['params']['id'])});}return _0x1aba27;});}})[_0xeedf('0x29')](respondWithResult(_0x5a9a8a,null))[_0xeedf('0x49')](handleError(_0x5a9a8a,null));};exports[_0xeedf('0x85')]=function(_0x5f5dd3,_0x4f10bd,_0x188612){return db[_0xeedf('0x31')][_0xeedf('0x4d')]({'where':{'id':_0x5f5dd3[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x4f10bd,null))[_0xeedf('0x29')](function(_0x4621f0){if(_0x4621f0){return _0x4621f0[_0xeedf('0x85')](_0x5f5dd3['query'][_0xeedf('0x67')])[_0xeedf('0x29')](function(){if(_[_0xeedf('0x88')](_0x5f5dd3['query'][_0xeedf('0x67')])){for(var _0x27e2d8=0x0;_0x27e2d8<_0x5f5dd3[_0xeedf('0x36')]['ids'][_0xeedf('0x3c')];_0x27e2d8+=0x1){socket[_0xeedf('0x72')](_0xeedf('0x89'),{'UserId':Number(_0x5f5dd3[_0xeedf('0x36')]['ids'][_0x27e2d8]),'FaxQueueId':Number(_0x5f5dd3[_0xeedf('0x4b')]['id'])});}}else{socket[_0xeedf('0x72')](_0xeedf('0x89'),{'UserId':Number(_0x5f5dd3['query'][_0xeedf('0x67')]),'FaxQueueId':Number(_0x5f5dd3[_0xeedf('0x4b')]['id'])});}});}})[_0xeedf('0x29')](respondWithStatusCode(_0x4f10bd,null))[_0xeedf('0x49')](handleError(_0x4f10bd,null));};exports[_0xeedf('0x8a')]=function(_0x59d6c5,_0x2ff3cc,_0x2c3ba8){var _0x468494={};var _0x1b15a8={};var _0x432c40;var _0x106e16;return db[_0xeedf('0x31')][_0xeedf('0x8b')]({'where':{'id':_0x59d6c5[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x2ff3cc,null))[_0xeedf('0x29')](function(_0x104d83){if(_0x104d83){_0x432c40=_0x104d83;_0x1b15a8[_0xeedf('0x35')]=_['keys'](db['User']['rawAttributes']);_0x1b15a8[_0xeedf('0x36')]=_['keys'](_0x59d6c5[_0xeedf('0x36')]);_0x1b15a8[_0xeedf('0x38')]=_[_0xeedf('0x39')](_0x1b15a8[_0xeedf('0x35')],_0x1b15a8[_0xeedf('0x36')]);_0x468494[_0xeedf('0x3a')]=_[_0xeedf('0x39')](_0x1b15a8[_0xeedf('0x35')],qs[_0xeedf('0x3b')](_0x59d6c5[_0xeedf('0x36')]['fields']));_0x468494['attributes']=_0x468494[_0xeedf('0x3a')][_0xeedf('0x3c')]?_0x468494[_0xeedf('0x3a')]:_0x1b15a8[_0xeedf('0x35')];_0x468494['order']=qs[_0xeedf('0x40')](_0x59d6c5['query'][_0xeedf('0x40')]);_0x468494[_0xeedf('0x43')]=qs[_0xeedf('0x38')](_['pick'](_0x59d6c5['query'],_0x1b15a8[_0xeedf('0x38')]));if(_0x59d6c5[_0xeedf('0x36')][_0xeedf('0x42')]){_0x468494[_0xeedf('0x43')]=_[_0xeedf('0x5d')](_0x468494[_0xeedf('0x43')],{'$or':_['map'](_0x468494['attributes'],function(_0xb569dc){var _0x420c19={};_0x420c19[_0xb569dc]={'$like':'%'+_0x59d6c5[_0xeedf('0x36')][_0xeedf('0x42')]+'%'};return _0x420c19;})});}_0x468494=_[_0xeedf('0x5d')]({},_0x468494,_0x59d6c5['options']);return _0x432c40[_0xeedf('0x8a')](_0x468494);}})['then'](function(_0x45b6ee){if(_0x45b6ee){_0x106e16=_0x45b6ee[_0xeedf('0x3c')];if(!_0x59d6c5['query'][_0xeedf('0x3d')](_0xeedf('0x3e'))){_0x468494['limit']=qs[_0xeedf('0x20')](_0x59d6c5[_0xeedf('0x36')][_0xeedf('0x20')]);_0x468494[_0xeedf('0x22')]=qs[_0xeedf('0x22')](_0x59d6c5[_0xeedf('0x36')]['offset']);}return _0x432c40[_0xeedf('0x8a')](_0x468494);}})['then'](function(_0x20e929){if(_0x20e929){return _0x20e929?{'count':_0x106e16,'rows':_0x20e929}:null;}})[_0xeedf('0x29')](respondWithResult(_0x2ff3cc,null))[_0xeedf('0x49')](handleError(_0x2ff3cc,null));}; \ No newline at end of file +var _0xa50c=['key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxQueue','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','format','%s/%s','faxPause','createdAt','updatedAt','getTeams','findOne','addTeams','ids','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','removeTeams','Team','select','tq.TeamId','team_has_fax_queues','join','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeAgents','addAgents','omit','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','crypto','papaparse','../../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','./faxQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','FaxQueues','UserProfileResource','end','stack','name','send','index','rawAttributes','fieldName','type'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xa50c,0x168));var _0xca50=function(_0x443f0b,_0x264807){_0x443f0b=_0x443f0b-0x0;var _0x5bc435=_0xa50c[_0x443f0b];return _0x5bc435;};'use strict';var emlformat=require(_0xca50('0x0'));var rimraf=require(_0xca50('0x1'));var zipdir=require(_0xca50('0x2'));var jsonpatch=require(_0xca50('0x3'));var rp=require(_0xca50('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xca50('0x5'));var util=require('util');var path=require(_0xca50('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca50('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xca50('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca50('0x9'));var Redis=require('ioredis');var authService=require(_0xca50('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0xca50('0xb'));var hardwareService=require(_0xca50('0xc'));var logger=require(_0xca50('0xd'))(_0xca50('0xe'));var utils=require(_0xca50('0xf'));var config=require(_0xca50('0x10'));var licenseUtil=require(_0xca50('0x11'));var db=require(_0xca50('0x12'))['db'];config[_0xca50('0x13')]=_[_0xca50('0x14')](config['redis'],{'host':_0xca50('0x15'),'port':0x18eb});var socket=require(_0xca50('0x16'))(new Redis(config[_0xca50('0x13')]));require(_0xca50('0x17'))[_0xca50('0x18')](socket);function respondWithStatusCode(_0x482446,_0x3c71d9){_0x3c71d9=_0x3c71d9||0xcc;return function(_0x57ee31){if(_0x57ee31){return _0x482446['sendStatus'](_0x3c71d9);}return _0x482446['status'](_0x3c71d9)['end']();};}function respondWithResult(_0x13f10f,_0x2d446f){_0x2d446f=_0x2d446f||0xc8;return function(_0x4239cf){if(_0x4239cf){return _0x13f10f[_0xca50('0x19')](_0x2d446f)[_0xca50('0x1a')](_0x4239cf);}};}function respondWithFilteredResult(_0x2d4848,_0x4fe83f){return function(_0x4dd0b1){if(_0x4dd0b1){var _0x213779=typeof _0x4fe83f[_0xca50('0x1b')]===_0xca50('0x1c')&&typeof _0x4fe83f[_0xca50('0x1d')]===_0xca50('0x1c');var _0x300341=_0x4dd0b1[_0xca50('0x1e')];var _0xb4dc07=_0x213779?0x0:_0x4fe83f[_0xca50('0x1b')];var _0x3859a5=_0x213779?_0x4dd0b1[_0xca50('0x1e')]:_0x4fe83f[_0xca50('0x1b')]+_0x4fe83f['limit'];var _0x3b5029;if(_0x3859a5>=_0x300341){_0x3859a5=_0x300341;_0x3b5029=0xc8;}else{_0x3b5029=0xce;}_0x2d4848[_0xca50('0x19')](_0x3b5029);return _0x2d4848[_0xca50('0x1f')](_0xca50('0x20'),_0xb4dc07+'-'+_0x3859a5+'/'+_0x300341)[_0xca50('0x1a')](_0x4dd0b1);}return null;};}function patchUpdates(_0x4620ac){return function(_0x51b87d){try{jsonpatch['apply'](_0x51b87d,_0x4620ac,!![]);}catch(_0xac6c6c){return BPromise[_0xca50('0x21')](_0xac6c6c);}return _0x51b87d['save']();};}function saveUpdates(_0x5b0b77,_0x3876bf){return function(_0x5ba7dc){if(_0x5ba7dc){return _0x5ba7dc[_0xca50('0x22')](_0x5b0b77)[_0xca50('0x23')](function(_0x8f5997){return _0x8f5997;});}return null;};}function removeEntity(_0x4ae522,_0x38844d){return function(_0x54fccc){if(_0x54fccc){return _0x54fccc[_0xca50('0x24')]()[_0xca50('0x23')](function(){var _0x502b42=_0x54fccc[_0xca50('0x25')]({'plain':!![]});var _0x8ffbbf=_0xca50('0x26');return db[_0xca50('0x27')][_0xca50('0x24')]({'where':{'type':_0x8ffbbf,'resourceId':_0x502b42['id']}})['then'](function(){return _0x54fccc;});})[_0xca50('0x23')](function(){_0x4ae522['status'](0xcc)[_0xca50('0x28')]();});}};}function handleEntityNotFound(_0x4635e0,_0x58b967){return function(_0x163e8f){if(!_0x163e8f){_0x4635e0['sendStatus'](0x194);}return _0x163e8f;};}function handleError(_0x23f422,_0x937553){_0x937553=_0x937553||0x1f4;return function(_0x5c0713){logger['error'](_0x5c0713[_0xca50('0x29')]);if(_0x5c0713[_0xca50('0x2a')]){delete _0x5c0713[_0xca50('0x2a')];}_0x23f422['status'](_0x937553)[_0xca50('0x2b')](_0x5c0713);};}exports[_0xca50('0x2c')]=function(_0x49d1c3,_0x5ba595){var _0x5ba332={},_0x2f8151={},_0x2eb4af={'count':0x0,'rows':[]};var _0x47d171=_['map'](db['FaxQueue'][_0xca50('0x2d')],function(_0x2374b5){return{'name':_0x2374b5[_0xca50('0x2e')],'type':_0x2374b5[_0xca50('0x2f')][_0xca50('0x30')]};});_0x2f8151[_0xca50('0x31')]=_[_0xca50('0x32')](_0x47d171,_0xca50('0x2a'));_0x2f8151[_0xca50('0x33')]=_[_0xca50('0x34')](_0x49d1c3['query']);_0x2f8151[_0xca50('0x35')]=_[_0xca50('0x36')](_0x2f8151[_0xca50('0x31')],_0x2f8151[_0xca50('0x33')]);_0x5ba332[_0xca50('0x37')]=_[_0xca50('0x36')](_0x2f8151[_0xca50('0x31')],qs[_0xca50('0x38')](_0x49d1c3[_0xca50('0x33')]['fields']));_0x5ba332[_0xca50('0x37')]=_0x5ba332[_0xca50('0x37')]['length']?_0x5ba332[_0xca50('0x37')]:_0x2f8151[_0xca50('0x31')];if(!_0x49d1c3[_0xca50('0x33')][_0xca50('0x39')](_0xca50('0x3a'))){_0x5ba332[_0xca50('0x1d')]=qs['limit'](_0x49d1c3['query'][_0xca50('0x1d')]);_0x5ba332[_0xca50('0x1b')]=qs[_0xca50('0x1b')](_0x49d1c3[_0xca50('0x33')]['offset']);}_0x5ba332[_0xca50('0x3b')]=qs[_0xca50('0x3c')](_0x49d1c3[_0xca50('0x33')][_0xca50('0x3c')]);_0x5ba332[_0xca50('0x3d')]=qs[_0xca50('0x35')](_[_0xca50('0x3e')](_0x49d1c3[_0xca50('0x33')],_0x2f8151[_0xca50('0x35')]),_0x47d171);if(_0x49d1c3['query'][_0xca50('0x3f')]){_0x5ba332[_0xca50('0x3d')]=_[_0xca50('0x40')](_0x5ba332[_0xca50('0x3d')],{'$or':_[_0xca50('0x32')](_0x47d171,function(_0x3165aa){if(_0x3165aa[_0xca50('0x2f')]!==_0xca50('0x41')){var _0x59ee6a={};_0x59ee6a[_0x3165aa[_0xca50('0x2a')]]={'$like':'%'+_0x49d1c3['query']['filter']+'%'};return _0x59ee6a;}})});}_0x5ba332=_[_0xca50('0x40')]({},_0x5ba332,_0x49d1c3[_0xca50('0x42')]);var _0x2720f0={'where':_0x5ba332['where']};return db['FaxQueue'][_0xca50('0x1e')](_0x2720f0)[_0xca50('0x23')](function(_0x593e62){_0x2eb4af[_0xca50('0x1e')]=_0x593e62;if(_0x49d1c3[_0xca50('0x33')][_0xca50('0x43')]){_0x5ba332[_0xca50('0x44')]=[{'all':!![]}];}return db[_0xca50('0x45')][_0xca50('0x46')](_0x5ba332);})[_0xca50('0x23')](function(_0x16dc2c){_0x2eb4af[_0xca50('0x47')]=_0x16dc2c;return _0x2eb4af;})[_0xca50('0x23')](respondWithFilteredResult(_0x5ba595,_0x5ba332))[_0xca50('0x48')](handleError(_0x5ba595,null));};exports[_0xca50('0x49')]=function(_0x44a717,_0x144339){var _0x25464f={'raw':!![],'where':{'id':_0x44a717[_0xca50('0x4a')]['id']}},_0x48f1fa={};_0x48f1fa['model']=_[_0xca50('0x34')](db[_0xca50('0x45')][_0xca50('0x2d')]);_0x48f1fa[_0xca50('0x33')]=_[_0xca50('0x34')](_0x44a717[_0xca50('0x33')]);_0x48f1fa[_0xca50('0x35')]=_['intersection'](_0x48f1fa[_0xca50('0x31')],_0x48f1fa['query']);_0x25464f['attributes']=_[_0xca50('0x36')](_0x48f1fa['model'],qs[_0xca50('0x38')](_0x44a717[_0xca50('0x33')][_0xca50('0x38')]));_0x25464f[_0xca50('0x37')]=_0x25464f['attributes'][_0xca50('0x4b')]?_0x25464f['attributes']:_0x48f1fa[_0xca50('0x31')];if(_0x44a717[_0xca50('0x33')]['includeAll']){_0x25464f['include']=[{'all':!![]}];}_0x25464f=_[_0xca50('0x40')]({},_0x25464f,_0x44a717['options']);return db['FaxQueue'][_0xca50('0x4c')](_0x25464f)[_0xca50('0x23')](handleEntityNotFound(_0x144339,null))['then'](respondWithResult(_0x144339,null))[_0xca50('0x48')](handleError(_0x144339,null));};exports[_0xca50('0x4d')]=function(_0x48ebd0,_0x8d4c05){return db[_0xca50('0x45')]['create'](_0x48ebd0[_0xca50('0x4e')],{})[_0xca50('0x23')](function(_0x52bfb1){var _0x20e611=_0x48ebd0[_0xca50('0x4f')][_0xca50('0x25')]({'plain':!![]});if(!_0x20e611)throw new Error(_0xca50('0x50'));if(_0x20e611[_0xca50('0x51')]==='user'){var _0x483103=_0x52bfb1[_0xca50('0x25')]({'plain':!![]});var _0x3d9bb1=_0xca50('0x26');return db[_0xca50('0x52')][_0xca50('0x4c')]({'where':{'name':_0x3d9bb1,'userProfileId':_0x20e611['userProfileId']},'raw':!![]})[_0xca50('0x23')](function(_0x234865){if(_0x234865&&_0x234865[_0xca50('0x53')]===0x0){return db[_0xca50('0x27')][_0xca50('0x4d')]({'name':_0x483103[_0xca50('0x2a')],'resourceId':_0x483103['id'],'type':_0x234865[_0xca50('0x2a')],'sectionId':_0x234865['id']},{})[_0xca50('0x23')](function(){return _0x52bfb1;});}else{return _0x52bfb1;}})['catch'](function(_0x5a06be){logger['error'](_0xca50('0x54'),_0x5a06be);throw _0x5a06be;});}return _0x52bfb1;})[_0xca50('0x23')](respondWithResult(_0x8d4c05,0xc9))[_0xca50('0x48')](handleError(_0x8d4c05,null));};exports[_0xca50('0x22')]=function(_0x32b748,_0x597bd2){if(_0x32b748[_0xca50('0x4e')]['id']){delete _0x32b748[_0xca50('0x4e')]['id'];}return db[_0xca50('0x45')]['find']({'where':{'id':_0x32b748['params']['id']}})[_0xca50('0x23')](handleEntityNotFound(_0x597bd2,null))['then'](saveUpdates(_0x32b748[_0xca50('0x4e')],null))['then'](respondWithResult(_0x597bd2,null))[_0xca50('0x48')](handleError(_0x597bd2,null));};exports[_0xca50('0x24')]=function(_0x4b1af4,_0x5848e9){return db[_0xca50('0x45')][_0xca50('0x4c')]({'where':{'id':_0x4b1af4[_0xca50('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5848e9,null))[_0xca50('0x23')](removeEntity(_0x5848e9,null))[_0xca50('0x48')](handleError(_0x5848e9,null));};exports[_0xca50('0x55')]=function(_0x5ae745,_0xb08185){return db[_0xca50('0x45')][_0xca50('0x55')]()['then'](respondWithResult(_0xb08185,null))['catch'](handleError(_0xb08185,null));};exports[_0xca50('0x56')]=function(_0x4d1177,_0x56e17f,_0x15c09d){var _0x372f15={'raw':!![],'where':{}},_0x6a4191={},_0x3f0d97;return db['FaxQueue']['findOne']({'where':{'id':_0x4d1177[_0xca50('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56e17f,null))[_0xca50('0x23')](function(_0x5ba8a3){if(_0x5ba8a3){_0x3f0d97=_0x5ba8a3['get']({'plain':!![]});_0x6a4191[_0xca50('0x31')]=_[_0xca50('0x34')](db[_0xca50('0x57')][_0xca50('0x2d')]);_0x6a4191['query']=_[_0xca50('0x34')](_0x4d1177[_0xca50('0x33')]);_0x6a4191[_0xca50('0x35')]=_[_0xca50('0x36')](_0x6a4191[_0xca50('0x31')],_0x6a4191['query']);_0x372f15[_0xca50('0x37')]=_['intersection'](_0x6a4191[_0xca50('0x31')],qs[_0xca50('0x38')](_0x4d1177[_0xca50('0x33')][_0xca50('0x38')]));_0x372f15[_0xca50('0x37')]=_0x372f15[_0xca50('0x37')][_0xca50('0x4b')]?_0x372f15[_0xca50('0x37')]:_0x6a4191['model'];if(!_0x4d1177['query'][_0xca50('0x39')](_0xca50('0x3a'))){_0x372f15[_0xca50('0x1d')]=qs[_0xca50('0x1d')](_0x4d1177['query'][_0xca50('0x1d')]);_0x372f15[_0xca50('0x1b')]=qs[_0xca50('0x1b')](_0x4d1177[_0xca50('0x33')][_0xca50('0x1b')]);}_0x372f15[_0xca50('0x3b')]=qs[_0xca50('0x3c')](_0x4d1177[_0xca50('0x33')][_0xca50('0x3c')]);_0x372f15[_0xca50('0x3d')]=qs[_0xca50('0x35')](_[_0xca50('0x3e')](_0x4d1177[_0xca50('0x33')],_0x6a4191['filters']));_0x372f15[_0xca50('0x3d')][_0xca50('0x58')]=_0x5ba8a3['id'];if(_0x4d1177[_0xca50('0x33')][_0xca50('0x3f')]){_0x372f15['where']=_[_0xca50('0x40')](_0x372f15[_0xca50('0x3d')],{'$or':_[_0xca50('0x32')](_0x372f15[_0xca50('0x37')],function(_0x42e05a){var _0x352aea={};_0x352aea[_0x42e05a]={'$like':'%'+_0x4d1177[_0xca50('0x33')][_0xca50('0x3f')]+'%'};return _0x352aea;})});}_0x372f15=_[_0xca50('0x40')]({},_0x372f15,_0x4d1177[_0xca50('0x42')]);return db[_0xca50('0x57')]['findAll'](_0x372f15);}})[_0xca50('0x23')](function(_0x17a7c8){if(_0x17a7c8){return db[_0xca50('0x59')][_0xca50('0x5a')]({'where':{'id':_['map'](_0x17a7c8,_0xca50('0x5b')),'role':_0xca50('0x5c')},'attributes':['id',_0xca50('0x2a'),'faxPause','updatedAt','createdAt']});}})[_0xca50('0x23')](function(_0x4ffbde){if(_0x4ffbde){return{'count':_0x4ffbde[_0xca50('0x1e')],'rows':_[_0xca50('0x32')](_0x4ffbde['rows'],function(_0x2a2a11){return{'membername':_0x2a2a11[_0xca50('0x2a')],'UserId':_0x2a2a11['id'],'queue_name':_0x3f0d97[_0xca50('0x2a')],'FaxQueueId':_0x3f0d97['id'],'interface':util[_0xca50('0x5d')](_0xca50('0x5e'),'SIP',_0x2a2a11[_0xca50('0x2a')]),'penalty':0x0,'paused':_0x2a2a11[_0xca50('0x5f')],'createdAt':_0x2a2a11[_0xca50('0x60')],'updatedAt':_0x2a2a11[_0xca50('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x56e17f,_0x372f15))[_0xca50('0x48')](handleError(_0x56e17f,null));};exports[_0xca50('0x62')]=function(_0x2a9e78,_0xfc237c,_0x53eac0){var _0x490795={};var _0x2f122e={};var _0x342987;var _0x4b34ea;return db[_0xca50('0x45')][_0xca50('0x63')]({'where':{'id':_0x2a9e78[_0xca50('0x4a')]['id']}})[_0xca50('0x23')](handleEntityNotFound(_0xfc237c,null))[_0xca50('0x23')](function(_0x31be91){if(_0x31be91){_0x342987=_0x31be91;_0x2f122e[_0xca50('0x31')]=_[_0xca50('0x34')](db['Team'][_0xca50('0x2d')]);_0x2f122e['query']=_['keys'](_0x2a9e78[_0xca50('0x33')]);_0x2f122e['filters']=_[_0xca50('0x36')](_0x2f122e['model'],_0x2f122e[_0xca50('0x33')]);_0x490795['attributes']=_[_0xca50('0x36')](_0x2f122e[_0xca50('0x31')],qs['fields'](_0x2a9e78['query']['fields']));_0x490795['attributes']=_0x490795[_0xca50('0x37')][_0xca50('0x4b')]?_0x490795[_0xca50('0x37')]:_0x2f122e[_0xca50('0x31')];_0x490795[_0xca50('0x3b')]=qs[_0xca50('0x3c')](_0x2a9e78[_0xca50('0x33')][_0xca50('0x3c')]);_0x490795[_0xca50('0x3d')]=qs[_0xca50('0x35')](_[_0xca50('0x3e')](_0x2a9e78[_0xca50('0x33')],_0x2f122e['filters']));if(_0x2a9e78[_0xca50('0x33')][_0xca50('0x3f')]){_0x490795[_0xca50('0x3d')]=_[_0xca50('0x40')](_0x490795[_0xca50('0x3d')],{'$or':_[_0xca50('0x32')](_0x490795[_0xca50('0x37')],function(_0x1cd307){var _0x5c3cbd={};_0x5c3cbd[_0x1cd307]={'$like':'%'+_0x2a9e78[_0xca50('0x33')][_0xca50('0x3f')]+'%'};return _0x5c3cbd;})});}_0x490795=_['merge']({},_0x490795,_0x2a9e78['options']);return _0x342987[_0xca50('0x62')](_0x490795);}})[_0xca50('0x23')](function(_0x25f3d2){if(_0x25f3d2){_0x4b34ea=_0x25f3d2[_0xca50('0x4b')];if(!_0x2a9e78[_0xca50('0x33')][_0xca50('0x39')](_0xca50('0x3a'))){_0x490795[_0xca50('0x1d')]=qs[_0xca50('0x1d')](_0x2a9e78[_0xca50('0x33')][_0xca50('0x1d')]);_0x490795['offset']=qs[_0xca50('0x1b')](_0x2a9e78[_0xca50('0x33')][_0xca50('0x1b')]);}return _0x342987['getTeams'](_0x490795);}})[_0xca50('0x23')](function(_0x92a64c){if(_0x92a64c){return _0x92a64c?{'count':_0x4b34ea,'rows':_0x92a64c}:null;}})[_0xca50('0x23')](respondWithResult(_0xfc237c,null))[_0xca50('0x48')](handleError(_0xfc237c,null));};exports[_0xca50('0x64')]=function(_0x1ccc80,_0x10400b,_0x164d78){var _0x56a7a7=_0x1ccc80[_0xca50('0x4e')][_0xca50('0x65')];return db['Team'][_0xca50('0x46')]({'where':{'id':_0x56a7a7},'attributes':['id'],'include':[{'model':db['User'],'as':_0xca50('0x66'),'attributes':['id',_0xca50('0x2a'),_0xca50('0x67'),_0xca50('0x68'),_0xca50('0x69')],'raw':!![]}]})[_0xca50('0x23')](function(_0x5c5484){if(_0x5c5484){var _0x47cdec=_[_0xca50('0x6a')](_0x5c5484,function(_0x449d26){var _0x32e6ce=_0x449d26[_0xca50('0x25')]({'plain':!![]});return _0x32e6ce[_0xca50('0x66')];});return db['FaxQueue'][_0xca50('0x4c')]({'where':{'id':_0x1ccc80[_0xca50('0x4a')]['id']}})[_0xca50('0x23')](function(_0x32063c){return db['sequelize']['transaction'](function(_0x805866){return _0x32063c[_0xca50('0x64')](_0x56a7a7,{'transaction':_0x805866})['then'](function(){return BPromise[_0xca50('0x6b')](_0x47cdec,function(_0x31edd9){return db['UserFaxQueue'][_0xca50('0x6c')]({'where':{'UserId':_0x31edd9['id'],'FaxQueueId':_0x1ccc80[_0xca50('0x4a')]['id']},'transaction':_0x805866});});})['then'](function(){_0x47cdec[_0xca50('0x6d')](function(_0x3b69dc){socket[_0xca50('0x6e')]('userFaxQueue:save',{'UserId':_0x3b69dc['id'],'FaxQueueId':_0x32063c['id']});});});});});}})[_0xca50('0x23')](respondWithStatusCode(_0x10400b,null))[_0xca50('0x48')](handleError(_0x10400b,null));};exports[_0xca50('0x6f')]=function(_0x300d4a,_0x20fdb0,_0x1024e9){return db[_0xca50('0x70')][_0xca50('0x46')]({'where':{'id':_0x300d4a[_0xca50('0x33')][_0xca50('0x65')]},'attributes':['id'],'include':[{'model':db[_0xca50('0x59')],'as':_0xca50('0x66'),'attributes':['id'],'raw':!![]}]})[_0xca50('0x23')](handleEntityNotFound(_0x20fdb0,null))[_0xca50('0x23')](function(_0x30e5bd){var _0x1c9039=_[_0xca50('0x32')](_0x30e5bd,'id');var _0x3086cc=[];var _0x3e3749=[];var _0x42adc1=squel[_0xca50('0x71')]();_0x42adc1['field'](_0xca50('0x72'))['from'](_0xca50('0x73'),'tq')[_0xca50('0x74')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xca50('0x3d')]('FaxQueueId\x20=\x20?',_0x300d4a[_0xca50('0x4a')]['id']);for(var _0x2c1250=0x0;_0x2c1250<_0x30e5bd[_0xca50('0x4b')];_0x2c1250+=0x1){let _0x1bab25=_0x30e5bd[_0x2c1250];for(var _0x19c0c6=0x0;_0x19c0c6<_0x1bab25['Agents']['length'];_0x19c0c6+=0x1){let _0x1a5555=_0x1bab25[_0xca50('0x66')][_0x19c0c6];var _0x572e20=_0x42adc1[_0xca50('0x75')]();_0x572e20['where'](_0xca50('0x76'),_0x1a5555['id']);_0x3e3749[_0xca50('0x77')](db[_0xca50('0x78')][_0xca50('0x33')](_0x572e20[_0xca50('0x79')](),{'type':db['sequelize'][_0xca50('0x7a')][_0xca50('0x7b')]})['then'](function(_0xb2eda9){if(_0xb2eda9[_0xca50('0x4b')]===0x1){return _0x1a5555['id'];}else{var _0x891547=_['every'](_['map'](_0xb2eda9,_0xca50('0x7c')),function(_0x30744f){return _[_0xca50('0x7d')](_0x1c9039,_0x30744f);});if(_0x891547){return _0x1a5555['id'];}}}));}}return BPromise[_0xca50('0x7e')](_0x3e3749)[_0xca50('0x23')](function(_0x4eca92){_0x3086cc=_(_0x3086cc)[_0xca50('0x7f')](_0x4eca92)[_0xca50('0x80')]()['value']();return db['FaxQueue'][_0xca50('0x4c')]({'where':{'id':_0x300d4a[_0xca50('0x4a')]['id']}})['then'](function(_0x3ba96a){return db[_0xca50('0x78')]['transaction'](function(_0x18dd03){return _0x3ba96a[_0xca50('0x6f')](_0x300d4a[_0xca50('0x33')][_0xca50('0x65')],{'transaction':_0x18dd03})[_0xca50('0x23')](function(){if(!_['isEmpty'](_0x3086cc)){return _0x3ba96a[_0xca50('0x81')](_0x3086cc,{'transaction':_0x18dd03});}})['then'](function(){_0x3086cc[_0xca50('0x6d')](function(_0x12988c){socket[_0xca50('0x6e')]('userFaxQueue:remove',{'UserId':_0x12988c,'FaxQueueId':_0x3ba96a['id']});});});});});});})[_0xca50('0x23')](respondWithStatusCode(_0x20fdb0,null))[_0xca50('0x48')](handleError(_0x20fdb0,null));};exports[_0xca50('0x82')]=function(_0x41b996,_0x4ff671,_0x4aae26){return db[_0xca50('0x45')][_0xca50('0x4c')]({'where':{'id':_0x41b996[_0xca50('0x4a')]['id']}})[_0xca50('0x23')](handleEntityNotFound(_0x4ff671,null))['then'](function(_0x389633){if(_0x389633){return _0x389633[_0xca50('0x82')](_0x41b996[_0xca50('0x4e')][_0xca50('0x65')],_[_0xca50('0x83')](_0x41b996[_0xca50('0x4e')],['ids','id'])||{})['spread'](function(_0x5cf65f){for(var _0x12b7ba=0x0;_0x12b7ba<_0x41b996[_0xca50('0x4e')][_0xca50('0x65')][_0xca50('0x4b')];_0x12b7ba+=0x1){socket[_0xca50('0x6e')](_0xca50('0x84'),{'UserId':Number(_0x41b996[_0xca50('0x4e')][_0xca50('0x65')][_0x12b7ba]),'FaxQueueId':Number(_0x41b996['params']['id'])});}return _0x5cf65f;});}})[_0xca50('0x23')](respondWithResult(_0x4ff671,null))[_0xca50('0x48')](handleError(_0x4ff671,null));};exports['removeAgents']=function(_0x4b8677,_0x3714bf,_0x2d9485){return db['FaxQueue'][_0xca50('0x4c')]({'where':{'id':_0x4b8677[_0xca50('0x4a')]['id']}})[_0xca50('0x23')](handleEntityNotFound(_0x3714bf,null))['then'](function(_0x31429e){if(_0x31429e){return _0x31429e[_0xca50('0x81')](_0x4b8677[_0xca50('0x33')][_0xca50('0x65')])['then'](function(){if(_[_0xca50('0x85')](_0x4b8677[_0xca50('0x33')][_0xca50('0x65')])){for(var _0x80f9e7=0x0;_0x80f9e7<_0x4b8677[_0xca50('0x33')][_0xca50('0x65')][_0xca50('0x4b')];_0x80f9e7+=0x1){socket[_0xca50('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x4b8677['query']['ids'][_0x80f9e7]),'FaxQueueId':Number(_0x4b8677[_0xca50('0x4a')]['id'])});}}else{socket[_0xca50('0x6e')](_0xca50('0x86'),{'UserId':Number(_0x4b8677[_0xca50('0x33')][_0xca50('0x65')]),'FaxQueueId':Number(_0x4b8677[_0xca50('0x4a')]['id'])});}});}})[_0xca50('0x23')](respondWithStatusCode(_0x3714bf,null))['catch'](handleError(_0x3714bf,null));};exports[_0xca50('0x87')]=function(_0x4e6467,_0xafa194,_0x441375){var _0x113c6b={};var _0x5d28ef={};var _0x263494;var _0x4c7181;return db['FaxQueue'][_0xca50('0x63')]({'where':{'id':_0x4e6467[_0xca50('0x4a')]['id']}})['then'](handleEntityNotFound(_0xafa194,null))[_0xca50('0x23')](function(_0x49ed18){if(_0x49ed18){_0x263494=_0x49ed18;_0x5d28ef[_0xca50('0x31')]=_[_0xca50('0x34')](db['User'][_0xca50('0x2d')]);_0x5d28ef[_0xca50('0x33')]=_[_0xca50('0x34')](_0x4e6467[_0xca50('0x33')]);_0x5d28ef[_0xca50('0x35')]=_[_0xca50('0x36')](_0x5d28ef['model'],_0x5d28ef[_0xca50('0x33')]);_0x113c6b[_0xca50('0x37')]=_[_0xca50('0x36')](_0x5d28ef[_0xca50('0x31')],qs['fields'](_0x4e6467[_0xca50('0x33')]['fields']));_0x113c6b[_0xca50('0x37')]=_0x113c6b[_0xca50('0x37')][_0xca50('0x4b')]?_0x113c6b['attributes']:_0x5d28ef[_0xca50('0x31')];_0x113c6b[_0xca50('0x3b')]=qs[_0xca50('0x3c')](_0x4e6467[_0xca50('0x33')]['sort']);_0x113c6b[_0xca50('0x3d')]=qs['filters'](_['pick'](_0x4e6467[_0xca50('0x33')],_0x5d28ef[_0xca50('0x35')]));if(_0x4e6467[_0xca50('0x33')][_0xca50('0x3f')]){_0x113c6b[_0xca50('0x3d')]=_[_0xca50('0x40')](_0x113c6b[_0xca50('0x3d')],{'$or':_[_0xca50('0x32')](_0x113c6b[_0xca50('0x37')],function(_0x47b59a){var _0x514b12={};_0x514b12[_0x47b59a]={'$like':'%'+_0x4e6467[_0xca50('0x33')][_0xca50('0x3f')]+'%'};return _0x514b12;})});}_0x113c6b=_['merge']({},_0x113c6b,_0x4e6467['options']);return _0x263494[_0xca50('0x87')](_0x113c6b);}})[_0xca50('0x23')](function(_0x2b5043){if(_0x2b5043){_0x4c7181=_0x2b5043[_0xca50('0x4b')];if(!_0x4e6467['query'][_0xca50('0x39')](_0xca50('0x3a'))){_0x113c6b[_0xca50('0x1d')]=qs[_0xca50('0x1d')](_0x4e6467[_0xca50('0x33')][_0xca50('0x1d')]);_0x113c6b[_0xca50('0x1b')]=qs['offset'](_0x4e6467[_0xca50('0x33')][_0xca50('0x1b')]);}return _0x263494['getAgents'](_0x113c6b);}})[_0xca50('0x23')](function(_0x142091){if(_0x142091){return _0x142091?{'count':_0x4c7181,'rows':_0x142091}:null;}})['then'](respondWithResult(_0xafa194,null))[_0xca50('0x48')](handleError(_0xafa194,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ca9688c..032d0f7 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 _0x80d2=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxQueue','save'];(function(_0x225c40,_0x3882eb){var _0x59bdfa=function(_0x1a8626){while(--_0x1a8626){_0x225c40['push'](_0x225c40['shift']());}};_0x59bdfa(++_0x3882eb);}(_0x80d2,0x13c));var _0x280d=function(_0x3c3ece,_0x4e1149){_0x3c3ece=_0x3c3ece-0x0;var _0x708fc8=_0x80d2[_0x3c3ece];return _0x708fc8;};'use strict';var EventEmitter=require(_0x280d('0x0'));var FaxQueue=require(_0x280d('0x1'))['db'][_0x280d('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x280d('0x3'),'afterUpdate':'update','afterDestroy':_0x280d('0x4')};function emitEvent(_0x4d8e4f){return function(_0x371a63,_0x3c301e,_0x1a89ff){FaxQueueEvents[_0x280d('0x5')](_0x4d8e4f+':'+_0x371a63['id'],_0x371a63);FaxQueueEvents['emit'](_0x4d8e4f,_0x371a63);_0x1a89ff(null);};}for(var e in events){if(events[_0x280d('0x6')](e)){var event=events[e];FaxQueue[_0x280d('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xdf30=['hook','exports','../../mysqldb','FaxQueue','save','update','emit'];(function(_0xfaefc0,_0x1c6097){var _0x3a78e0=function(_0x432cd9){while(--_0x432cd9){_0xfaefc0['push'](_0xfaefc0['shift']());}};_0x3a78e0(++_0x1c6097);}(_0xdf30,0x72));var _0x0df3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf30[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x0df3('0x0'))['db'][_0x0df3('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0df3('0x2'),'afterUpdate':_0x0df3('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4de1ca){return function(_0x53185e,_0x1ecb25,_0x4e2fb0){FaxQueueEvents[_0x0df3('0x4')](_0x4de1ca+':'+_0x53185e['id'],_0x53185e);FaxQueueEvents['emit'](_0x4de1ca,_0x53185e);_0x4e2fb0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x0df3('0x5')](e,emitEvent(event));}}module[_0x0df3('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 82c685e..b959efe 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 _0x21b2=['FaxQueue','fax_queues','lodash','util','../../config/logger','bluebird','path','rimraf','exports'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0x21b2,0x1e8));var _0x221b=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x21b2[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x221b('0x0'));var util=require(_0x221b('0x1'));var logger=require(_0x221b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x221b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x221b('0x4'));var rimraf=require(_0x221b('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x221b('0x6')]=function(_0x1a4a17,_0x37b9eb){return _0x1a4a17['define'](_0x221b('0x7'),attributes,{'tableName':_0x221b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x220f=['../../config/environment','exports','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4eea19,_0x5447bc){var _0x1d64fb=function(_0x5b8580){while(--_0x5b8580){_0x4eea19['push'](_0x4eea19['shift']());}};_0x1d64fb(++_0x5447bc);}(_0x220f,0x66));var _0xf220=function(_0x446509,_0x3975a4){_0x446509=_0x446509-0x0;var _0x6395c0=_0x220f[_0x446509];return _0x6395c0;};'use strict';var _=require(_0xf220('0x0'));var util=require(_0xf220('0x1'));var logger=require(_0xf220('0x2'))(_0xf220('0x3'));var moment=require(_0xf220('0x4'));var BPromise=require(_0xf220('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf220('0x6'));var rimraf=require(_0xf220('0x7'));var config=require(_0xf220('0x8'));var attributes=require('./faxQueue.attributes');module[_0xf220('0x9')]=function(_0x208842,_0x29c527){return _0x208842['define']('FaxQueue',attributes,{'tableName':_0xf220('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 604e6d7..891f756 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 _0x2580=['result','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetFaxQueue','catch','ShowFaxQueue','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x2580,0x88));var _0x0258=function(_0x8d99aa,_0x33de9e){_0x8d99aa=_0x8d99aa-0x0;var _0x43a1c7=_0x2580[_0x8d99aa];return _0x43a1c7;};'use strict';var _=require('lodash');var util=require(_0x0258('0x0'));var moment=require(_0x0258('0x1'));var BPromise=require(_0x0258('0x2'));var rs=require(_0x0258('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0258('0x4'));var logger=require(_0x0258('0x5'))(_0x0258('0x6'));var config=require('../../config/environment');var jayson=require(_0x0258('0x7'));var client=jayson[_0x0258('0x8')][_0x0258('0x9')]({'port':0x232a});config['redis']=_[_0x0258('0xa')](config['redis'],{'host':_0x0258('0xb'),'port':0x18eb});var socket=require(_0x0258('0xc'))(new Redis(config[_0x0258('0xd')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3b8170,_0x14b43e,_0x1186db){return new BPromise(function(_0x34353c,_0x12830f){return client[_0x0258('0xe')](_0x3b8170,_0x1186db)['then'](function(_0x166c24){logger[_0x0258('0xf')](_0x0258('0x10'),_0x14b43e,'request\x20sent');logger[_0x0258('0x11')](_0x0258('0x12'),_0x14b43e,_0x0258('0x13'),JSON[_0x0258('0x14')](_0x166c24));if(_0x166c24[_0x0258('0x15')]){if(_0x166c24[_0x0258('0x15')][_0x0258('0x16')]===0x1f4){logger[_0x0258('0x15')]('FaxQueue,\x20%s,\x20%s',_0x14b43e,_0x166c24[_0x0258('0x15')]['message']);return _0x12830f(_0x166c24[_0x0258('0x15')][_0x0258('0x17')]);}logger['error'](_0x0258('0x10'),_0x14b43e,_0x166c24[_0x0258('0x15')][_0x0258('0x17')]);return _0x34353c(_0x166c24[_0x0258('0x15')][_0x0258('0x17')]);}else{logger[_0x0258('0xf')](_0x0258('0x10'),_0x14b43e,_0x0258('0x13'));_0x34353c(_0x166c24[_0x0258('0x18')][_0x0258('0x17')]);}})['catch'](function(_0x4cc7bd){logger['error'](_0x0258('0x10'),_0x14b43e,_0x4cc7bd);_0x12830f(_0x4cc7bd);});});}exports['GetFaxQueue']=function(_0x2dba07){var _0x22cc2e=this;return new Promise(function(_0x1b0262,_0x48cf16){return db[_0x0258('0x19')][_0x0258('0x1a')]({'raw':_0x2dba07[_0x0258('0x1b')]?_0x2dba07[_0x0258('0x1b')][_0x0258('0x1c')]===undefined?!![]:![]:!![],'where':_0x2dba07[_0x0258('0x1b')]?_0x2dba07[_0x0258('0x1b')][_0x0258('0x1d')]||null:null,'attributes':_0x2dba07['options']?_0x2dba07[_0x0258('0x1b')][_0x0258('0x1e')]||null:null,'limit':_0x2dba07[_0x0258('0x1b')]?_0x2dba07[_0x0258('0x1b')][_0x0258('0x1f')]||null:null,'include':_0x2dba07[_0x0258('0x1b')]?_0x2dba07[_0x0258('0x1b')][_0x0258('0x20')]?_[_0x0258('0x21')](_0x2dba07['options'][_0x0258('0x20')],function(_0x45a8c3){return{'model':db[_0x45a8c3[_0x0258('0x22')]],'as':_0x45a8c3['as'],'attributes':_0x45a8c3[_0x0258('0x1e')],'include':_0x45a8c3['include']?_[_0x0258('0x21')](_0x45a8c3[_0x0258('0x20')],function(_0x10fc49){return{'model':db[_0x10fc49[_0x0258('0x22')]],'as':_0x10fc49['as'],'attributes':_0x10fc49[_0x0258('0x1e')],'include':_0x10fc49[_0x0258('0x20')]?_[_0x0258('0x21')](_0x10fc49['include'],function(_0x40fab2){return{'model':db[_0x40fab2[_0x0258('0x22')]],'as':_0x40fab2['as'],'attributes':_0x40fab2[_0x0258('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0258('0x23')](function(_0x314da5){logger[_0x0258('0xf')](_0x0258('0x24'),_0x2dba07);logger[_0x0258('0x11')]('GetFaxQueue',_0x2dba07,JSON['stringify'](_0x314da5));_0x1b0262(_0x314da5);})[_0x0258('0x25')](function(_0x1a77d4){logger[_0x0258('0x15')](_0x0258('0x24'),_0x1a77d4[_0x0258('0x17')],_0x2dba07);_0x48cf16(_0x22cc2e[_0x0258('0x15')](0x1f4,_0x1a77d4[_0x0258('0x17')]));});});};exports[_0x0258('0x26')]=function(_0x5c9b5c){var _0x4ed1c9=this;return new Promise(function(_0x364995,_0x1d08a4){return db['FaxQueue'][_0x0258('0x27')]({'raw':_0x5c9b5c[_0x0258('0x1b')]?_0x5c9b5c[_0x0258('0x1b')][_0x0258('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c9b5c[_0x0258('0x1b')]?_0x5c9b5c['options'][_0x0258('0x1d')]||null:null,'attributes':_0x5c9b5c[_0x0258('0x1b')]?_0x5c9b5c['options'][_0x0258('0x1e')]||null:null,'include':_0x5c9b5c[_0x0258('0x1b')]?_0x5c9b5c[_0x0258('0x1b')][_0x0258('0x20')]?_[_0x0258('0x21')](_0x5c9b5c[_0x0258('0x1b')][_0x0258('0x20')],function(_0x491932){return{'model':db[_0x491932[_0x0258('0x22')]],'as':_0x491932['as'],'attributes':_0x491932[_0x0258('0x1e')],'include':_0x491932[_0x0258('0x20')]?_[_0x0258('0x21')](_0x491932[_0x0258('0x20')],function(_0x4c31ff){return{'model':db[_0x4c31ff['model']],'as':_0x4c31ff['as'],'attributes':_0x4c31ff[_0x0258('0x1e')],'include':_0x4c31ff[_0x0258('0x20')]?_[_0x0258('0x21')](_0x4c31ff[_0x0258('0x20')],function(_0x3ea3df){return{'model':db[_0x3ea3df[_0x0258('0x22')]],'as':_0x3ea3df['as'],'attributes':_0x3ea3df[_0x0258('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0258('0x23')](function(_0x20b4dd){logger['info']('ShowFaxQueue',_0x5c9b5c);logger[_0x0258('0x11')](_0x0258('0x26'),_0x5c9b5c,JSON[_0x0258('0x14')](_0x20b4dd));_0x364995(_0x20b4dd);})[_0x0258('0x25')](function(_0x22ab05){logger[_0x0258('0x15')]('ShowFaxQueue',_0x22ab05[_0x0258('0x17')],_0x5c9b5c);_0x1d08a4(_0x4ed1c9[_0x0258('0x15')](0x1f4,_0x22ab05[_0x0258('0x17')]));});});}; \ No newline at end of file +var _0xbe6f=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowFaxQueue','find','where','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4956f2,_0xd9faa8){var _0x35d537=function(_0x37e5c7){while(--_0x37e5c7){_0x4956f2['push'](_0x4956f2['shift']());}};_0x35d537(++_0xd9faa8);}(_0xbe6f,0x67));var _0xfbe6=function(_0x532bb2,_0x2ea33f){_0x532bb2=_0x532bb2-0x0;var _0x1ae8d4=_0xbe6f[_0x532bb2];return _0x1ae8d4;};'use strict';var _=require('lodash');var util=require(_0xfbe6('0x0'));var moment=require('moment');var BPromise=require(_0xfbe6('0x1'));var rs=require(_0xfbe6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbe6('0x3'))['db'];var utils=require(_0xfbe6('0x4'));var logger=require(_0xfbe6('0x5'))(_0xfbe6('0x6'));var config=require(_0xfbe6('0x7'));var jayson=require(_0xfbe6('0x8'));var client=jayson[_0xfbe6('0x9')][_0xfbe6('0xa')]({'port':0x232a});config[_0xfbe6('0xb')]=_[_0xfbe6('0xc')](config[_0xfbe6('0xb')],{'host':_0xfbe6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbe6('0xb')]));require(_0xfbe6('0xe'))[_0xfbe6('0xf')](socket);function respondWithRpcPromise(_0x47fb5c,_0xeb51ae,_0x2dfc06){return new BPromise(function(_0x36811e,_0x5afa0f){return client[_0xfbe6('0x10')](_0x47fb5c,_0x2dfc06)[_0xfbe6('0x11')](function(_0x396d2c){logger['info'](_0xfbe6('0x12'),_0xeb51ae,_0xfbe6('0x13'));logger[_0xfbe6('0x14')](_0xfbe6('0x15'),_0xeb51ae,_0xfbe6('0x13'),JSON[_0xfbe6('0x16')](_0x396d2c));if(_0x396d2c[_0xfbe6('0x17')]){if(_0x396d2c['error']['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0xeb51ae,_0x396d2c[_0xfbe6('0x17')][_0xfbe6('0x18')]);return _0x5afa0f(_0x396d2c[_0xfbe6('0x17')][_0xfbe6('0x18')]);}logger[_0xfbe6('0x17')](_0xfbe6('0x12'),_0xeb51ae,_0x396d2c[_0xfbe6('0x17')][_0xfbe6('0x18')]);return _0x36811e(_0x396d2c[_0xfbe6('0x17')][_0xfbe6('0x18')]);}else{logger[_0xfbe6('0x19')](_0xfbe6('0x12'),_0xeb51ae,_0xfbe6('0x13'));_0x36811e(_0x396d2c[_0xfbe6('0x1a')][_0xfbe6('0x18')]);}})['catch'](function(_0x813cd5){logger[_0xfbe6('0x17')](_0xfbe6('0x12'),_0xeb51ae,_0x813cd5);_0x5afa0f(_0x813cd5);});});}exports[_0xfbe6('0x1b')]=function(_0x5215e2){var _0x27389c=this;return new Promise(function(_0x18d065,_0x39be2f){return db[_0xfbe6('0x1c')][_0xfbe6('0x1d')]({'raw':_0x5215e2[_0xfbe6('0x1e')]?_0x5215e2[_0xfbe6('0x1e')][_0xfbe6('0x1f')]===undefined?!![]:![]:!![],'where':_0x5215e2[_0xfbe6('0x1e')]?_0x5215e2[_0xfbe6('0x1e')]['where']||null:null,'attributes':_0x5215e2[_0xfbe6('0x1e')]?_0x5215e2['options'][_0xfbe6('0x20')]||null:null,'limit':_0x5215e2[_0xfbe6('0x1e')]?_0x5215e2[_0xfbe6('0x1e')][_0xfbe6('0x21')]||null:null,'include':_0x5215e2['options']?_0x5215e2[_0xfbe6('0x1e')][_0xfbe6('0x22')]?_[_0xfbe6('0x23')](_0x5215e2[_0xfbe6('0x1e')][_0xfbe6('0x22')],function(_0x1332b4){return{'model':db[_0x1332b4[_0xfbe6('0x24')]],'as':_0x1332b4['as'],'attributes':_0x1332b4[_0xfbe6('0x20')],'include':_0x1332b4[_0xfbe6('0x22')]?_[_0xfbe6('0x23')](_0x1332b4[_0xfbe6('0x22')],function(_0x771394){return{'model':db[_0x771394[_0xfbe6('0x24')]],'as':_0x771394['as'],'attributes':_0x771394[_0xfbe6('0x20')],'include':_0x771394[_0xfbe6('0x22')]?_[_0xfbe6('0x23')](_0x771394['include'],function(_0x53a12a){return{'model':db[_0x53a12a[_0xfbe6('0x24')]],'as':_0x53a12a['as'],'attributes':_0x53a12a[_0xfbe6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfbe6('0x11')](function(_0xeb946e){logger[_0xfbe6('0x19')](_0xfbe6('0x1b'),_0x5215e2);logger[_0xfbe6('0x14')](_0xfbe6('0x1b'),_0x5215e2,JSON['stringify'](_0xeb946e));_0x18d065(_0xeb946e);})[_0xfbe6('0x25')](function(_0x23569f){logger['error'](_0xfbe6('0x1b'),_0x23569f['message'],_0x5215e2);_0x39be2f(_0x27389c[_0xfbe6('0x17')](0x1f4,_0x23569f[_0xfbe6('0x18')]));});});};exports[_0xfbe6('0x26')]=function(_0x5b70ad){var _0x25ff01=this;return new Promise(function(_0x1dbccb,_0x1c10e3){return db[_0xfbe6('0x1c')][_0xfbe6('0x27')]({'raw':_0x5b70ad[_0xfbe6('0x1e')]?_0x5b70ad['options'][_0xfbe6('0x1f')]===undefined?!![]:![]:!![],'where':_0x5b70ad[_0xfbe6('0x1e')]?_0x5b70ad[_0xfbe6('0x1e')][_0xfbe6('0x28')]||null:null,'attributes':_0x5b70ad[_0xfbe6('0x1e')]?_0x5b70ad['options']['attributes']||null:null,'include':_0x5b70ad[_0xfbe6('0x1e')]?_0x5b70ad[_0xfbe6('0x1e')]['include']?_[_0xfbe6('0x23')](_0x5b70ad[_0xfbe6('0x1e')][_0xfbe6('0x22')],function(_0x1e0599){return{'model':db[_0x1e0599['model']],'as':_0x1e0599['as'],'attributes':_0x1e0599[_0xfbe6('0x20')],'include':_0x1e0599[_0xfbe6('0x22')]?_[_0xfbe6('0x23')](_0x1e0599[_0xfbe6('0x22')],function(_0x2c800f){return{'model':db[_0x2c800f[_0xfbe6('0x24')]],'as':_0x2c800f['as'],'attributes':_0x2c800f[_0xfbe6('0x20')],'include':_0x2c800f[_0xfbe6('0x22')]?_['map'](_0x2c800f[_0xfbe6('0x22')],function(_0xedfe30){return{'model':db[_0xedfe30[_0xfbe6('0x24')]],'as':_0xedfe30['as'],'attributes':_0xedfe30[_0xfbe6('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfbe6('0x11')](function(_0x17d1f1){logger[_0xfbe6('0x19')]('ShowFaxQueue',_0x5b70ad);logger['debug']('ShowFaxQueue',_0x5b70ad,JSON[_0xfbe6('0x16')](_0x17d1f1));_0x1dbccb(_0x17d1f1);})[_0xfbe6('0x25')](function(_0x197bfb){logger[_0xfbe6('0x17')](_0xfbe6('0x26'),_0x197bfb[_0xfbe6('0x18')],_0x5b70ad);_0x1c10e3(_0x25ff01[_0xfbe6('0x17')](0x1f4,_0x197bfb[_0xfbe6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index f5c0ce6..3c97c6f 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 _0xa7af=['remove','update','emit','removeListener','register','faxQueue:','./faxQueue.events','save'];(function(_0x18fb82,_0x24cc8e){var _0x43ffbf=function(_0x362163){while(--_0x362163){_0x18fb82['push'](_0x18fb82['shift']());}};_0x43ffbf(++_0x24cc8e);}(_0xa7af,0x13e));var _0xfa7a=function(_0x148a63,_0x3c1877){_0x148a63=_0x148a63-0x0;var _0x4694fa=_0xa7af[_0x148a63];return _0x4694fa;};'use strict';var FaxQueueEvents=require(_0xfa7a('0x0'));var events=[_0xfa7a('0x1'),_0xfa7a('0x2'),_0xfa7a('0x3')];function createListener(_0x243e71,_0x4f3e90){return function(_0x30abf8){_0x4f3e90[_0xfa7a('0x4')](_0x243e71,_0x30abf8);};}function removeListener(_0x109bce,_0x38f167){return function(){FaxQueueEvents[_0xfa7a('0x5')](_0x109bce,_0x38f167);};}exports[_0xfa7a('0x6')]=function(_0x5401e0){for(var _0x5d6eef=0x0,_0x4f4b05=events['length'];_0x5d6eef<_0x4f4b05;_0x5d6eef++){var _0x4f7eff=events[_0x5d6eef];var _0x46fbcf=createListener(_0xfa7a('0x7')+_0x4f7eff,_0x5401e0);FaxQueueEvents['on'](_0x4f7eff,_0x46fbcf);}}; \ No newline at end of file +var _0x4044=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4044,0xcb));var _0x4404=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4044[_0xa464c9];return _0x3d73c4;};'use strict';var FaxQueueEvents=require(_0x4404('0x0'));var events=[_0x4404('0x1'),_0x4404('0x2'),_0x4404('0x3')];function createListener(_0x2c42f8,_0x44573d){return function(_0x2a9c6a){_0x44573d[_0x4404('0x4')](_0x2c42f8,_0x2a9c6a);};}function removeListener(_0x3ea96c,_0x9a4fdc){return function(){FaxQueueEvents[_0x4404('0x5')](_0x3ea96c,_0x9a4fdc);};}exports[_0x4404('0x6')]=function(_0x53cef4){for(var _0x4f8263=0x0,_0x110490=events[_0x4404('0x7')];_0x4f8263<_0x110490;_0x4f8263++){var _0x50c7de=events[_0x4f8263];var _0x7cd5a5=createListener(_0x4404('0x8')+_0x50c7de,_0x53cef4);FaxQueueEvents['on'](_0x50c7de,_0x7cd5a5);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1e304cf..34bfce7 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 _0xa9fc=['create','addTeams','addAgents','update','destroy','removeTeams','delete','/:id/users','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xa9fc,0x19f));var _0xca9f=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0xa9fc[_0xc69f39];return _0x93be41;};'use strict';var multer=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var path=require(_0xca9f('0x2'));var timeout=require(_0xca9f('0x3'));var express=require(_0xca9f('0x4'));var router=express['Router']();var fs_extra=require(_0xca9f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xca9f('0x6'));var config=require(_0xca9f('0x7'));var controller=require('./faxQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xca9f('0x8')]);router['get'](_0xca9f('0x9'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xb')]);router[_0xca9f('0xc')](_0xca9f('0xd'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xe')]);router[_0xca9f('0xc')]('/:id/members',auth[_0xca9f('0xa')](),controller[_0xca9f('0xf')]);router[_0xca9f('0xc')](_0xca9f('0x10'),auth['isAuthenticated'](),controller[_0xca9f('0x11')]);router[_0xca9f('0xc')]('/:id/users',auth[_0xca9f('0xa')](),controller[_0xca9f('0x12')]);router[_0xca9f('0x13')]('/',auth[_0xca9f('0xa')](),controller[_0xca9f('0x14')]);router[_0xca9f('0x13')](_0xca9f('0x10'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x15')]);router[_0xca9f('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xca9f('0x16')]);router['put']('/:id',auth[_0xca9f('0xa')](),controller[_0xca9f('0x17')]);router['delete'](_0xca9f('0xd'),auth['isAuthenticated'](),controller[_0xca9f('0x18')]);router['delete'](_0xca9f('0x10'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x19')]);router[_0xca9f('0x1a')](_0xca9f('0x1b'),auth['isAuthenticated'](),controller[_0xca9f('0x1c')]);module['exports']=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(_0x1ee102,_0x30642b){var _0x381011=function(_0x183955){while(--_0x183955){_0x1ee102['push'](_0x1ee102['shift']());}};_0x381011(++_0x30642b);}(_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 13daad9..013750e 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 _0x62b8=['exports','STRING','DATE','moment'];(function(_0x2efb60,_0xd14bd9){var _0x3992dc=function(_0x2b161e){while(--_0x2b161e){_0x2efb60['push'](_0x2efb60['shift']());}};_0x3992dc(++_0xd14bd9);}(_0x62b8,0xd3));var _0x862b=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x62b8[_0x879e31];return _0x3467e8;};'use strict';var moment=require(_0x862b('0x0'));var Sequelize=require('sequelize');module[_0x862b('0x1')]={'uniqueid':{'type':Sequelize[_0x862b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x862b('0x3')]},'leaveAt':{'type':Sequelize[_0x862b('0x3')]},'acceptAt':{'type':Sequelize[_0x862b('0x3')]},'exitAt':{'type':Sequelize[_0x862b('0x3')]},'reason':{'type':Sequelize[_0x862b('0x2')]}}; \ No newline at end of file +var _0x921f=['STRING','DATE','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x921f,0x186));var _0xf921=function(_0x322c6d,_0x7acdae){_0x322c6d=_0x322c6d-0x0;var _0x498a2c=_0x921f[_0x322c6d];return _0x498a2c;};'use strict';var moment=require('moment');var Sequelize=require(_0xf921('0x0'));module[_0xf921('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf921('0x2')]},'joinAt':{'type':Sequelize[_0xf921('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf921('0x3')]},'exitAt':{'type':Sequelize[_0xf921('0x3')]},'reason':{'type':Sequelize[_0xf921('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8e5414a..29abc3a 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 _0x74b1=['send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','include','findAll','rows','catch','show','includeAll','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','stack','name'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x74b1,0xb5));var _0x174b=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x74b1[_0x30f07a];return _0xb38461;};'use strict';var emlformat=require(_0x174b('0x0'));var rimraf=require(_0x174b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x174b('0x2'));var rp=require(_0x174b('0x3'));var moment=require('moment');var BPromise=require(_0x174b('0x4'));var Mustache=require(_0x174b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x174b('0x6'));var ejs=require(_0x174b('0x7'));var fs=require('fs');var fs_extra=require(_0x174b('0x8'));var _=require('lodash');var squel=require(_0x174b('0x9'));var crypto=require(_0x174b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x174b('0x6'));var querystring=require('querystring');var Papa=require(_0x174b('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x174b('0xc'));var as=require(_0x174b('0xd'));var hardwareService=require(_0x174b('0xe'));var logger=require(_0x174b('0xf'))(_0x174b('0x10'));var utils=require(_0x174b('0x11'));var config=require(_0x174b('0x12'));var licenseUtil=require(_0x174b('0x13'));var db=require(_0x174b('0x14'))['db'];function respondWithStatusCode(_0x4ea947,_0x70fa85){_0x70fa85=_0x70fa85||0xcc;return function(_0xc996e){if(_0xc996e){return _0x4ea947[_0x174b('0x15')](_0x70fa85);}return _0x4ea947[_0x174b('0x16')](_0x70fa85)[_0x174b('0x17')]();};}function respondWithResult(_0x44b778,_0xe9c224){_0xe9c224=_0xe9c224||0xc8;return function(_0x43143b){if(_0x43143b){return _0x44b778[_0x174b('0x16')](_0xe9c224)['json'](_0x43143b);}};}function respondWithFilteredResult(_0x1c5579,_0xde8235){return function(_0x210a3c){if(_0x210a3c){var _0x4a7aeb=typeof _0xde8235['offset']===_0x174b('0x18')&&typeof _0xde8235[_0x174b('0x19')]===_0x174b('0x18');var _0x209dd4=_0x210a3c[_0x174b('0x1a')];var _0x31f801=_0x4a7aeb?0x0:_0xde8235['offset'];var _0x1049dc=_0x4a7aeb?_0x210a3c[_0x174b('0x1a')]:_0xde8235[_0x174b('0x1b')]+_0xde8235[_0x174b('0x19')];var _0x2bef75;if(_0x1049dc>=_0x209dd4){_0x1049dc=_0x209dd4;_0x2bef75=0xc8;}else{_0x2bef75=0xce;}_0x1c5579[_0x174b('0x16')](_0x2bef75);return _0x1c5579[_0x174b('0x1c')](_0x174b('0x1d'),_0x31f801+'-'+_0x1049dc+'/'+_0x209dd4)[_0x174b('0x1e')](_0x210a3c);}return null;};}function patchUpdates(_0x1458a1){return function(_0x4e58f0){try{jsonpatch[_0x174b('0x1f')](_0x4e58f0,_0x1458a1,!![]);}catch(_0x49d32e){return BPromise['reject'](_0x49d32e);}return _0x4e58f0[_0x174b('0x20')]();};}function saveUpdates(_0x568b3f,_0x537ac3){return function(_0x2c09ad){if(_0x2c09ad){return _0x2c09ad[_0x174b('0x21')](_0x568b3f)[_0x174b('0x22')](function(_0x55f2ac){return _0x55f2ac;});}return null;};}function removeEntity(_0x150304,_0x4da1da){return function(_0x3b57c5){if(_0x3b57c5){return _0x3b57c5[_0x174b('0x23')]()[_0x174b('0x22')](function(){_0x150304[_0x174b('0x16')](0xcc)[_0x174b('0x17')]();});}};}function handleEntityNotFound(_0x242295,_0x487929){return function(_0x493561){if(!_0x493561){_0x242295[_0x174b('0x15')](0x194);}return _0x493561;};}function handleError(_0x17161c,_0x7c34f1){_0x7c34f1=_0x7c34f1||0x1f4;return function(_0x10507d){logger['error'](_0x10507d[_0x174b('0x24')]);if(_0x10507d[_0x174b('0x25')]){delete _0x10507d['name'];}_0x17161c[_0x174b('0x16')](_0x7c34f1)[_0x174b('0x26')](_0x10507d);};}exports[_0x174b('0x27')]=function(_0x50f947,_0x28ffef){var _0x2aea81={},_0x557d62={},_0x2c6189={'count':0x0,'rows':[]};var _0x555dc1=_[_0x174b('0x28')](db[_0x174b('0x29')][_0x174b('0x2a')],function(_0x3e6fb0){return{'name':_0x3e6fb0[_0x174b('0x2b')],'type':_0x3e6fb0[_0x174b('0x2c')][_0x174b('0x2d')]};});_0x557d62[_0x174b('0x2e')]=_[_0x174b('0x28')](_0x555dc1,'name');_0x557d62[_0x174b('0x2f')]=_[_0x174b('0x30')](_0x50f947[_0x174b('0x2f')]);_0x557d62['filters']=_[_0x174b('0x31')](_0x557d62['model'],_0x557d62['query']);_0x2aea81[_0x174b('0x32')]=_[_0x174b('0x31')](_0x557d62[_0x174b('0x2e')],qs[_0x174b('0x33')](_0x50f947['query'][_0x174b('0x33')]));_0x2aea81[_0x174b('0x32')]=_0x2aea81[_0x174b('0x32')][_0x174b('0x34')]?_0x2aea81[_0x174b('0x32')]:_0x557d62[_0x174b('0x2e')];if(!_0x50f947[_0x174b('0x2f')]['hasOwnProperty'](_0x174b('0x35'))){_0x2aea81['limit']=qs['limit'](_0x50f947[_0x174b('0x2f')][_0x174b('0x19')]);_0x2aea81[_0x174b('0x1b')]=qs[_0x174b('0x1b')](_0x50f947[_0x174b('0x2f')]['offset']);}_0x2aea81[_0x174b('0x36')]=qs[_0x174b('0x37')](_0x50f947[_0x174b('0x2f')][_0x174b('0x37')]);_0x2aea81[_0x174b('0x38')]=qs[_0x174b('0x39')](_[_0x174b('0x3a')](_0x50f947[_0x174b('0x2f')],_0x557d62[_0x174b('0x39')]),_0x555dc1);if(_0x50f947['query']['filter']){_0x2aea81[_0x174b('0x38')]=_[_0x174b('0x3b')](_0x2aea81[_0x174b('0x38')],{'$or':_[_0x174b('0x28')](_0x555dc1,function(_0xd0a6c4){if(_0xd0a6c4['type']!=='VIRTUAL'){var _0x1d37c6={};_0x1d37c6[_0xd0a6c4[_0x174b('0x25')]]={'$like':'%'+_0x50f947['query'][_0x174b('0x3c')]+'%'};return _0x1d37c6;}})});}_0x2aea81=_[_0x174b('0x3b')]({},_0x2aea81,_0x50f947[_0x174b('0x3d')]);var _0x3a5aaf={'where':_0x2aea81[_0x174b('0x38')]};return db[_0x174b('0x29')]['count'](_0x3a5aaf)['then'](function(_0x3caeab){_0x2c6189[_0x174b('0x1a')]=_0x3caeab;if(_0x50f947[_0x174b('0x2f')]['includeAll']){_0x2aea81[_0x174b('0x3e')]=[{'all':!![]}];}return db[_0x174b('0x29')][_0x174b('0x3f')](_0x2aea81);})[_0x174b('0x22')](function(_0x1d1d2b){_0x2c6189[_0x174b('0x40')]=_0x1d1d2b;return _0x2c6189;})[_0x174b('0x22')](respondWithFilteredResult(_0x28ffef,_0x2aea81))[_0x174b('0x41')](handleError(_0x28ffef,null));};exports[_0x174b('0x42')]=function(_0x41991d,_0x4f2c68){var _0x22097a={'raw':!![],'where':{'id':_0x41991d['params']['id']}},_0xf9dd00={};_0xf9dd00[_0x174b('0x2e')]=_['keys'](db[_0x174b('0x29')][_0x174b('0x2a')]);_0xf9dd00[_0x174b('0x2f')]=_['keys'](_0x41991d[_0x174b('0x2f')]);_0xf9dd00[_0x174b('0x39')]=_['intersection'](_0xf9dd00['model'],_0xf9dd00[_0x174b('0x2f')]);_0x22097a[_0x174b('0x32')]=_['intersection'](_0xf9dd00['model'],qs[_0x174b('0x33')](_0x41991d[_0x174b('0x2f')][_0x174b('0x33')]));_0x22097a[_0x174b('0x32')]=_0x22097a['attributes'][_0x174b('0x34')]?_0x22097a['attributes']:_0xf9dd00['model'];if(_0x41991d[_0x174b('0x2f')][_0x174b('0x43')]){_0x22097a[_0x174b('0x3e')]=[{'all':!![]}];}_0x22097a=_['merge']({},_0x22097a,_0x41991d[_0x174b('0x3d')]);return db['FaxQueueReport']['find'](_0x22097a)[_0x174b('0x22')](handleEntityNotFound(_0x4f2c68,null))[_0x174b('0x22')](respondWithResult(_0x4f2c68,null))['catch'](handleError(_0x4f2c68,null));};exports[_0x174b('0x44')]=function(_0x35cf49,_0x3cd6f4){return db[_0x174b('0x29')][_0x174b('0x44')](_0x35cf49[_0x174b('0x45')],{})[_0x174b('0x22')](respondWithResult(_0x3cd6f4,0xc9))[_0x174b('0x41')](handleError(_0x3cd6f4,null));};exports[_0x174b('0x21')]=function(_0x565ad0,_0x4cd165){if(_0x565ad0['body']['id']){delete _0x565ad0[_0x174b('0x45')]['id'];}return db[_0x174b('0x29')][_0x174b('0x46')]({'where':{'id':_0x565ad0[_0x174b('0x47')]['id']}})[_0x174b('0x22')](handleEntityNotFound(_0x4cd165,null))[_0x174b('0x22')](saveUpdates(_0x565ad0['body'],null))['then'](respondWithResult(_0x4cd165,null))[_0x174b('0x41')](handleError(_0x4cd165,null));};exports[_0x174b('0x23')]=function(_0x41d309,_0x102531){return db[_0x174b('0x29')][_0x174b('0x46')]({'where':{'id':_0x41d309[_0x174b('0x47')]['id']}})[_0x174b('0x22')](handleEntityNotFound(_0x102531,null))[_0x174b('0x22')](removeEntity(_0x102531,null))['catch'](handleError(_0x102531,null));};exports[_0x174b('0x48')]=function(_0x140d95,_0x6e217a){return db[_0x174b('0x29')][_0x174b('0x48')]()[_0x174b('0x22')](respondWithResult(_0x6e217a,null))[_0x174b('0x41')](handleError(_0x6e217a,null));}; \ No newline at end of file +var _0xc041=['reject','save','update','destroy','then','error','stack','index','type','key','model','map','name','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply'];(function(_0x5583a2,_0x143e17){var _0x43eee6=function(_0x2aa59b){while(--_0x2aa59b){_0x5583a2['push'](_0x5583a2['shift']());}};_0x43eee6(++_0x143e17);}(_0xc041,0x1ea));var _0x1c04=function(_0x1d3a3b,_0x49e405){_0x1d3a3b=_0x1d3a3b-0x0;var _0x59b26f=_0xc041[_0x1d3a3b];return _0x59b26f;};'use strict';var emlformat=require(_0x1c04('0x0'));var rimraf=require(_0x1c04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c04('0x2'));var rp=require('request-promise');var moment=require(_0x1c04('0x3'));var BPromise=require(_0x1c04('0x4'));var Mustache=require(_0x1c04('0x5'));var util=require(_0x1c04('0x6'));var path=require(_0x1c04('0x7'));var sox=require(_0x1c04('0x8'));var csv=require('to-csv');var ejs=require(_0x1c04('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1c04('0xa'));var crypto=require(_0x1c04('0xb'));var jsforce=require(_0x1c04('0xc'));var deskjs=require(_0x1c04('0xd'));var toCsv=require(_0x1c04('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1c04('0xf'));var authService=require(_0x1c04('0x10'));var qs=require(_0x1c04('0x11'));var as=require(_0x1c04('0x12'));var hardwareService=require(_0x1c04('0x13'));var logger=require(_0x1c04('0x14'))(_0x1c04('0x15'));var utils=require(_0x1c04('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1c04('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x178900,_0x167bd5){_0x167bd5=_0x167bd5||0xcc;return function(_0x48e69f){if(_0x48e69f){return _0x178900[_0x1c04('0x18')](_0x167bd5);}return _0x178900[_0x1c04('0x19')](_0x167bd5)[_0x1c04('0x1a')]();};}function respondWithResult(_0x199782,_0x3c7bb3){_0x3c7bb3=_0x3c7bb3||0xc8;return function(_0x30b019){if(_0x30b019){return _0x199782[_0x1c04('0x19')](_0x3c7bb3)['json'](_0x30b019);}};}function respondWithFilteredResult(_0x28d516,_0x2dbf09){return function(_0x408e4c){if(_0x408e4c){var _0x5a0ff4=typeof _0x2dbf09[_0x1c04('0x1b')]==='undefined'&&typeof _0x2dbf09[_0x1c04('0x1c')]===_0x1c04('0x1d');var _0x2ed73c=_0x408e4c[_0x1c04('0x1e')];var _0x2b3a8b=_0x5a0ff4?0x0:_0x2dbf09[_0x1c04('0x1b')];var _0x3e2bd9=_0x5a0ff4?_0x408e4c[_0x1c04('0x1e')]:_0x2dbf09['offset']+_0x2dbf09['limit'];var _0x51dad0;if(_0x3e2bd9>=_0x2ed73c){_0x3e2bd9=_0x2ed73c;_0x51dad0=0xc8;}else{_0x51dad0=0xce;}_0x28d516[_0x1c04('0x19')](_0x51dad0);return _0x28d516[_0x1c04('0x1f')](_0x1c04('0x20'),_0x2b3a8b+'-'+_0x3e2bd9+'/'+_0x2ed73c)[_0x1c04('0x21')](_0x408e4c);}return null;};}function patchUpdates(_0x1724a4){return function(_0x21c320){try{jsonpatch[_0x1c04('0x22')](_0x21c320,_0x1724a4,!![]);}catch(_0xf9255d){return BPromise[_0x1c04('0x23')](_0xf9255d);}return _0x21c320[_0x1c04('0x24')]();};}function saveUpdates(_0x290375,_0x460dd1){return function(_0x22a4cc){if(_0x22a4cc){return _0x22a4cc[_0x1c04('0x25')](_0x290375)['then'](function(_0x2ee6b2){return _0x2ee6b2;});}return null;};}function removeEntity(_0x5bb5bc,_0x247116){return function(_0x3c81b0){if(_0x3c81b0){return _0x3c81b0[_0x1c04('0x26')]()[_0x1c04('0x27')](function(){_0x5bb5bc[_0x1c04('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5101e2,_0x29293c){return function(_0x2c9f84){if(!_0x2c9f84){_0x5101e2[_0x1c04('0x18')](0x194);}return _0x2c9f84;};}function handleError(_0x43c4a8,_0x252fbe){_0x252fbe=_0x252fbe||0x1f4;return function(_0x1e2daa){logger[_0x1c04('0x28')](_0x1e2daa[_0x1c04('0x29')]);if(_0x1e2daa['name']){delete _0x1e2daa['name'];}_0x43c4a8[_0x1c04('0x19')](_0x252fbe)['send'](_0x1e2daa);};}exports[_0x1c04('0x2a')]=function(_0x228e4,_0x29d273){var _0x220cdc={},_0x3bf4fd={},_0x148237={'count':0x0,'rows':[]};var _0x22be53=_['map'](db['FaxQueueReport']['rawAttributes'],function(_0x2e26d2){return{'name':_0x2e26d2['fieldName'],'type':_0x2e26d2[_0x1c04('0x2b')][_0x1c04('0x2c')]};});_0x3bf4fd[_0x1c04('0x2d')]=_[_0x1c04('0x2e')](_0x22be53,_0x1c04('0x2f'));_0x3bf4fd[_0x1c04('0x30')]=_[_0x1c04('0x31')](_0x228e4[_0x1c04('0x30')]);_0x3bf4fd['filters']=_[_0x1c04('0x32')](_0x3bf4fd['model'],_0x3bf4fd['query']);_0x220cdc['attributes']=_[_0x1c04('0x32')](_0x3bf4fd[_0x1c04('0x2d')],qs[_0x1c04('0x33')](_0x228e4[_0x1c04('0x30')][_0x1c04('0x33')]));_0x220cdc[_0x1c04('0x34')]=_0x220cdc[_0x1c04('0x34')]['length']?_0x220cdc[_0x1c04('0x34')]:_0x3bf4fd[_0x1c04('0x2d')];if(!_0x228e4[_0x1c04('0x30')][_0x1c04('0x35')]('nolimit')){_0x220cdc['limit']=qs[_0x1c04('0x1c')](_0x228e4[_0x1c04('0x30')][_0x1c04('0x1c')]);_0x220cdc[_0x1c04('0x1b')]=qs[_0x1c04('0x1b')](_0x228e4['query'][_0x1c04('0x1b')]);}_0x220cdc[_0x1c04('0x36')]=qs['sort'](_0x228e4[_0x1c04('0x30')][_0x1c04('0x37')]);_0x220cdc[_0x1c04('0x38')]=qs[_0x1c04('0x39')](_['pick'](_0x228e4[_0x1c04('0x30')],_0x3bf4fd['filters']),_0x22be53);if(_0x228e4[_0x1c04('0x30')][_0x1c04('0x3a')]){_0x220cdc[_0x1c04('0x38')]=_[_0x1c04('0x3b')](_0x220cdc[_0x1c04('0x38')],{'$or':_[_0x1c04('0x2e')](_0x22be53,function(_0x1f1b67){if(_0x1f1b67[_0x1c04('0x2b')]!==_0x1c04('0x3c')){var _0x7e7d5e={};_0x7e7d5e[_0x1f1b67[_0x1c04('0x2f')]]={'$like':'%'+_0x228e4['query'][_0x1c04('0x3a')]+'%'};return _0x7e7d5e;}})});}_0x220cdc=_['merge']({},_0x220cdc,_0x228e4[_0x1c04('0x3d')]);var _0x1340b4={'where':_0x220cdc['where']};return db[_0x1c04('0x3e')]['count'](_0x1340b4)[_0x1c04('0x27')](function(_0x2fb2bb){_0x148237[_0x1c04('0x1e')]=_0x2fb2bb;if(_0x228e4['query'][_0x1c04('0x3f')]){_0x220cdc[_0x1c04('0x40')]=[{'all':!![]}];}return db[_0x1c04('0x3e')][_0x1c04('0x41')](_0x220cdc);})[_0x1c04('0x27')](function(_0x34dfea){_0x148237[_0x1c04('0x42')]=_0x34dfea;return _0x148237;})[_0x1c04('0x27')](respondWithFilteredResult(_0x29d273,_0x220cdc))[_0x1c04('0x43')](handleError(_0x29d273,null));};exports[_0x1c04('0x44')]=function(_0x5deaaa,_0x22c511){var _0x9a191a={'raw':!![],'where':{'id':_0x5deaaa[_0x1c04('0x45')]['id']}},_0x3a81a2={};_0x3a81a2[_0x1c04('0x2d')]=_[_0x1c04('0x31')](db[_0x1c04('0x3e')][_0x1c04('0x46')]);_0x3a81a2[_0x1c04('0x30')]=_['keys'](_0x5deaaa[_0x1c04('0x30')]);_0x3a81a2['filters']=_['intersection'](_0x3a81a2['model'],_0x3a81a2[_0x1c04('0x30')]);_0x9a191a[_0x1c04('0x34')]=_['intersection'](_0x3a81a2['model'],qs[_0x1c04('0x33')](_0x5deaaa[_0x1c04('0x30')][_0x1c04('0x33')]));_0x9a191a[_0x1c04('0x34')]=_0x9a191a[_0x1c04('0x34')]['length']?_0x9a191a[_0x1c04('0x34')]:_0x3a81a2[_0x1c04('0x2d')];if(_0x5deaaa['query'][_0x1c04('0x3f')]){_0x9a191a[_0x1c04('0x40')]=[{'all':!![]}];}_0x9a191a=_[_0x1c04('0x3b')]({},_0x9a191a,_0x5deaaa['options']);return db[_0x1c04('0x3e')][_0x1c04('0x47')](_0x9a191a)[_0x1c04('0x27')](handleEntityNotFound(_0x22c511,null))[_0x1c04('0x27')](respondWithResult(_0x22c511,null))[_0x1c04('0x43')](handleError(_0x22c511,null));};exports[_0x1c04('0x48')]=function(_0x285aa4,_0x5e3d77){return db['FaxQueueReport'][_0x1c04('0x48')](_0x285aa4[_0x1c04('0x49')],{})['then'](respondWithResult(_0x5e3d77,0xc9))[_0x1c04('0x43')](handleError(_0x5e3d77,null));};exports[_0x1c04('0x25')]=function(_0x170e6b,_0x4a1dbc){if(_0x170e6b[_0x1c04('0x49')]['id']){delete _0x170e6b[_0x1c04('0x49')]['id'];}return db[_0x1c04('0x3e')]['find']({'where':{'id':_0x170e6b[_0x1c04('0x45')]['id']}})[_0x1c04('0x27')](handleEntityNotFound(_0x4a1dbc,null))[_0x1c04('0x27')](saveUpdates(_0x170e6b[_0x1c04('0x49')],null))[_0x1c04('0x27')](respondWithResult(_0x4a1dbc,null))[_0x1c04('0x43')](handleError(_0x4a1dbc,null));};exports[_0x1c04('0x26')]=function(_0x54fa14,_0x4fdc6a){return db[_0x1c04('0x3e')][_0x1c04('0x47')]({'where':{'id':_0x54fa14[_0x1c04('0x45')]['id']}})[_0x1c04('0x27')](handleEntityNotFound(_0x4fdc6a,null))[_0x1c04('0x27')](removeEntity(_0x4fdc6a,null))['catch'](handleError(_0x4fdc6a,null));};exports[_0x1c04('0x4a')]=function(_0x7ab380,_0x557b67){return db[_0x1c04('0x3e')][_0x1c04('0x4a')]()['then'](respondWithResult(_0x557b67,null))['catch'](handleError(_0x557b67,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 00e18a9..21bc119 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0xebf33a,_0x39ecd3){var _0x2cc7fe=function(_0x5ee9f6){while(--_0x5ee9f6){_0xebf33a['push'](_0xebf33a['shift']());}};_0x2cc7fe(++_0x39ecd3);}(_0x1261,0x144));var _0x1126=function(_0x1c1577,_0x1d4d6d){_0x1c1577=_0x1c1577-0x0;var _0x566d1f=_0x1261[_0x1c1577];return _0x566d1f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5967c5,_0x37ec42){var _0xc2e467=function(_0x2788a3){while(--_0x2788a3){_0x5967c5['push'](_0x5967c5['shift']());}};_0xc2e467(++_0x37ec42);}(_0x4975,0x86));var _0x5497=function(_0x5786f3,_0x4cda16){_0x5786f3=_0x5786f3-0x0;var _0x462620=_0x4975[_0x5786f3];return _0x462620;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 9c5705d..9ddd7bb 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 _0x4a01=['info','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','where','attributes','limit'];(function(_0x4bf793,_0x404922){var _0x55a44b=function(_0xbbc6c0){while(--_0xbbc6c0){_0x4bf793['push'](_0x4bf793['shift']());}};_0x55a44b(++_0x404922);}(_0x4a01,0x1d0));var _0x14a0=function(_0x4d9ad5,_0x32de0b){_0x4d9ad5=_0x4d9ad5-0x0;var _0x587b8f=_0x4a01[_0x4d9ad5];return _0x587b8f;};'use strict';var _=require(_0x14a0('0x0'));var util=require(_0x14a0('0x1'));var moment=require(_0x14a0('0x2'));var BPromise=require(_0x14a0('0x3'));var rs=require(_0x14a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14a0('0x5'))['db'];var utils=require(_0x14a0('0x6'));var logger=require(_0x14a0('0x7'))(_0x14a0('0x8'));var config=require(_0x14a0('0x9'));var jayson=require(_0x14a0('0xa'));var client=jayson[_0x14a0('0xb')][_0x14a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b352a,_0x28c930,_0x1da412){return new BPromise(function(_0x4bae53,_0x18e9d9){return client['request'](_0x5b352a,_0x1da412)[_0x14a0('0xd')](function(_0x5b58b1){logger['info'](_0x14a0('0xe'),_0x28c930,_0x14a0('0xf'));logger[_0x14a0('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x28c930,'request\x20sent',JSON[_0x14a0('0x11')](_0x5b58b1));if(_0x5b58b1[_0x14a0('0x12')]){if(_0x5b58b1[_0x14a0('0x12')][_0x14a0('0x13')]===0x1f4){logger[_0x14a0('0x12')](_0x14a0('0xe'),_0x28c930,_0x5b58b1[_0x14a0('0x12')][_0x14a0('0x14')]);return _0x18e9d9(_0x5b58b1[_0x14a0('0x12')][_0x14a0('0x14')]);}logger[_0x14a0('0x12')](_0x14a0('0xe'),_0x28c930,_0x5b58b1[_0x14a0('0x12')]['message']);return _0x4bae53(_0x5b58b1[_0x14a0('0x12')]['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x28c930,_0x14a0('0xf'));_0x4bae53(_0x5b58b1[_0x14a0('0x15')]['message']);}})[_0x14a0('0x16')](function(_0x5239dc){logger[_0x14a0('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x28c930,_0x5239dc);_0x18e9d9(_0x5239dc);});});}exports[_0x14a0('0x17')]=function(_0x497df0){var _0x45286e=this;return new Promise(function(_0x14e9cc,_0x12870d){return db[_0x14a0('0x18')][_0x14a0('0x19')](_0x497df0[_0x14a0('0x1a')],{'raw':_0x497df0[_0x14a0('0x1b')]?_0x497df0[_0x14a0('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x14a0('0xd')](function(_0x3eb70d){logger['info'](_0x14a0('0x17'),_0x497df0);logger['debug'](_0x14a0('0x17'),_0x497df0,JSON['stringify'](_0x3eb70d));_0x14e9cc(_0x3eb70d);})[_0x14a0('0x16')](function(_0x852d12){logger[_0x14a0('0x12')]('CreateFaxQueueReport',_0x852d12[_0x14a0('0x14')],_0x497df0);_0x12870d(_0x45286e[_0x14a0('0x12')](0x1f4,_0x852d12[_0x14a0('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x110a79){var _0x1749b0=this;return new Promise(function(_0x53f878,_0x17c675){return db[_0x14a0('0x18')]['update'](_0x110a79[_0x14a0('0x1a')],{'raw':_0x110a79[_0x14a0('0x1b')]?_0x110a79[_0x14a0('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110a79[_0x14a0('0x1b')]?_0x110a79[_0x14a0('0x1b')][_0x14a0('0x1c')]||null:null,'attributes':_0x110a79[_0x14a0('0x1b')]?_0x110a79[_0x14a0('0x1b')][_0x14a0('0x1d')]||null:null,'limit':_0x110a79['options']?_0x110a79['options'][_0x14a0('0x1e')]||null:null})['then'](function(_0x2fe8f6){logger[_0x14a0('0x1f')](_0x14a0('0x20'),_0x110a79);logger[_0x14a0('0x10')](_0x14a0('0x20'),_0x110a79,JSON[_0x14a0('0x11')](_0x2fe8f6));_0x53f878(_0x2fe8f6);})['catch'](function(_0x4446fc){logger['error']('UpdateFaxQueueReport',_0x4446fc[_0x14a0('0x14')],_0x110a79);_0x17c675(_0x1749b0[_0x14a0('0x12')](0x1f4,_0x4446fc[_0x14a0('0x14')]));});});}; \ No newline at end of file +var _0x91e5=['code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','where','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x5f4df2,_0x4a054e){var _0x2ce265=function(_0x1c9467){while(--_0x1c9467){_0x5f4df2['push'](_0x5f4df2['shift']());}};_0x2ce265(++_0x4a054e);}(_0x91e5,0x6c));var _0x591e=function(_0x4f1977,_0x2339e4){_0x4f1977=_0x4f1977-0x0;var _0x1a1968=_0x91e5[_0x4f1977];return _0x1a1968;};'use strict';var _=require('lodash');var util=require(_0x591e('0x0'));var moment=require(_0x591e('0x1'));var BPromise=require(_0x591e('0x2'));var rs=require(_0x591e('0x3'));var fs=require('fs');var Redis=require(_0x591e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x591e('0x5'));var logger=require(_0x591e('0x6'))(_0x591e('0x7'));var config=require(_0x591e('0x8'));var jayson=require(_0x591e('0x9'));var client=jayson[_0x591e('0xa')][_0x591e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e7e1d,_0x14e141,_0x4d2358){return new BPromise(function(_0x1e3a4f,_0x13cd13){return client[_0x591e('0xc')](_0x5e7e1d,_0x4d2358)[_0x591e('0xd')](function(_0x273a4b){logger[_0x591e('0xe')](_0x591e('0xf'),_0x14e141,'request\x20sent');logger[_0x591e('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x14e141,_0x591e('0x11'),JSON[_0x591e('0x12')](_0x273a4b));if(_0x273a4b[_0x591e('0x13')]){if(_0x273a4b[_0x591e('0x13')][_0x591e('0x14')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x14e141,_0x273a4b[_0x591e('0x13')][_0x591e('0x15')]);return _0x13cd13(_0x273a4b[_0x591e('0x13')][_0x591e('0x15')]);}logger[_0x591e('0x13')](_0x591e('0xf'),_0x14e141,_0x273a4b[_0x591e('0x13')]['message']);return _0x1e3a4f(_0x273a4b[_0x591e('0x13')][_0x591e('0x15')]);}else{logger[_0x591e('0xe')](_0x591e('0xf'),_0x14e141,_0x591e('0x11'));_0x1e3a4f(_0x273a4b[_0x591e('0x16')][_0x591e('0x15')]);}})[_0x591e('0x17')](function(_0x2fd9f7){logger[_0x591e('0x13')](_0x591e('0xf'),_0x14e141,_0x2fd9f7);_0x13cd13(_0x2fd9f7);});});}exports[_0x591e('0x18')]=function(_0x19672a){var _0x1f3bf3=this;return new Promise(function(_0x23ba0a,_0x1b730d){return db[_0x591e('0x19')][_0x591e('0x1a')](_0x19672a['body'],{'raw':_0x19672a[_0x591e('0x1b')]?_0x19672a['options'][_0x591e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1a6e3f){logger['info'](_0x591e('0x18'),_0x19672a);logger['debug'](_0x591e('0x18'),_0x19672a,JSON['stringify'](_0x1a6e3f));_0x23ba0a(_0x1a6e3f);})['catch'](function(_0x269d6e){logger[_0x591e('0x13')](_0x591e('0x18'),_0x269d6e[_0x591e('0x15')],_0x19672a);_0x1b730d(_0x1f3bf3[_0x591e('0x13')](0x1f4,_0x269d6e[_0x591e('0x15')]));});});};exports[_0x591e('0x1d')]=function(_0x2dbc07){var _0x2d68c3=this;return new Promise(function(_0x35576f,_0x19cc5d){return db[_0x591e('0x19')]['update'](_0x2dbc07['body'],{'raw':_0x2dbc07[_0x591e('0x1b')]?_0x2dbc07['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dbc07[_0x591e('0x1b')]?_0x2dbc07[_0x591e('0x1b')][_0x591e('0x1e')]||null:null,'attributes':_0x2dbc07[_0x591e('0x1b')]?_0x2dbc07[_0x591e('0x1b')]['attributes']||null:null,'limit':_0x2dbc07['options']?_0x2dbc07[_0x591e('0x1b')][_0x591e('0x1f')]||null:null})[_0x591e('0xd')](function(_0x3b4ee5){logger[_0x591e('0xe')](_0x591e('0x1d'),_0x2dbc07);logger[_0x591e('0x10')](_0x591e('0x1d'),_0x2dbc07,JSON['stringify'](_0x3b4ee5));_0x35576f(_0x3b4ee5);})['catch'](function(_0x27269c){logger[_0x591e('0x13')](_0x591e('0x1d'),_0x27269c[_0x591e('0x15')],_0x2dbc07);_0x19cc5d(_0x2d68c3[_0x591e('0x13')](0x1f4,_0x27269c['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a277f27..86389bb 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 _0x4e5f=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','/:id'];(function(_0x233c6c,_0x3d10fc){var _0x2b9334=function(_0x1eee51){while(--_0x1eee51){_0x233c6c['push'](_0x233c6c['shift']());}};_0x2b9334(++_0x3d10fc);}(_0x4e5f,0x10d));var _0xf4e5=function(_0x27afe4,_0x646a11){_0x27afe4=_0x27afe4-0x0;var _0xab9355=_0x4e5f[_0x27afe4];return _0xab9355;};'use strict';var multer=require(_0xf4e5('0x0'));var util=require('util');var path=require(_0xf4e5('0x1'));var timeout=require('connect-timeout');var express=require(_0xf4e5('0x2'));var router=express[_0xf4e5('0x3')]();var fs_extra=require(_0xf4e5('0x4'));var auth=require(_0xf4e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf4e5('0x6'));var controller=require(_0xf4e5('0x7'));router[_0xf4e5('0x8')]('/',auth[_0xf4e5('0x9')](),controller[_0xf4e5('0xa')]);router[_0xf4e5('0x8')](_0xf4e5('0xb'),auth[_0xf4e5('0x9')](),controller[_0xf4e5('0xc')]);router[_0xf4e5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf4e5('0xd')]);router[_0xf4e5('0xe')]('/',auth[_0xf4e5('0x9')](),controller['create']);router['put'](_0xf4e5('0xf'),auth[_0xf4e5('0x9')](),controller['update']);router[_0xf4e5('0x10')]('/:id',auth[_0xf4e5('0x9')](),controller[_0xf4e5('0x11')]);module[_0xf4e5('0x12')]=router; \ No newline at end of file +var _0x1f67=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','show','post','create','put','update','/:id','exports'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x1f67,0xd8));var _0x71f6=function(_0x56150a,_0x77a5a3){_0x56150a=_0x56150a-0x0;var _0x42e330=_0x1f67[_0x56150a];return _0x42e330;};'use strict';var multer=require(_0x71f6('0x0'));var util=require('util');var path=require(_0x71f6('0x1'));var timeout=require(_0x71f6('0x2'));var express=require(_0x71f6('0x3'));var router=express[_0x71f6('0x4')]();var fs_extra=require(_0x71f6('0x5'));var auth=require(_0x71f6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x71f6('0x7')]('/',auth[_0x71f6('0x8')](),controller[_0x71f6('0x9')]);router[_0x71f6('0x7')]('/describe',auth[_0x71f6('0x8')](),controller[_0x71f6('0xa')]);router[_0x71f6('0x7')]('/:id',auth[_0x71f6('0x8')](),controller[_0x71f6('0xb')]);router[_0x71f6('0xc')]('/',auth[_0x71f6('0x8')](),controller[_0x71f6('0xd')]);router[_0x71f6('0xe')]('/:id',auth[_0x71f6('0x8')](),controller[_0x71f6('0xf')]);router['delete'](_0x71f6('0x10'),auth[_0x71f6('0x8')](),controller['destroy']);module[_0x71f6('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 699011b..012efc2 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x4b84[_0x367a3d];return _0x460539;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x39b275,_0x12210e){var _0x433e9e=function(_0x18992f){while(--_0x18992f){_0x39b275['push'](_0x39b275['shift']());}};_0x433e9e(++_0x12210e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xcb91[_0xe39824];return _0x4bc31e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 6d3e50b..f3915ac 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 _0x0826=['to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','then','includeAll','rows','show','params','fields','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x0826,0x8d));var _0x6082=function(_0x2f838a,_0x13bb0f){_0x2f838a=_0x2f838a-0x0;var _0x317747=_0x0826[_0x2f838a];return _0x317747;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6082('0x0'));var zipdir=require(_0x6082('0x1'));var jsonpatch=require(_0x6082('0x2'));var rp=require(_0x6082('0x3'));var moment=require('moment');var BPromise=require(_0x6082('0x4'));var Mustache=require(_0x6082('0x5'));var util=require(_0x6082('0x6'));var path=require(_0x6082('0x7'));var sox=require(_0x6082('0x8'));var csv=require(_0x6082('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6082('0xa'));var _=require(_0x6082('0xb'));var squel=require('squel');var crypto=require(_0x6082('0xc'));var jsforce=require(_0x6082('0xd'));var deskjs=require(_0x6082('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6082('0xf'));var Redis=require(_0x6082('0x10'));var authService=require(_0x6082('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6082('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6082('0x13'));var utils=require(_0x6082('0x14'));var config=require(_0x6082('0x15'));var licenseUtil=require(_0x6082('0x16'));var db=require(_0x6082('0x17'))['db'];function respondWithStatusCode(_0x58e68d,_0x18a319){_0x18a319=_0x18a319||0xcc;return function(_0x2906d5){if(_0x2906d5){return _0x58e68d[_0x6082('0x18')](_0x18a319);}return _0x58e68d['status'](_0x18a319)[_0x6082('0x19')]();};}function respondWithResult(_0x12646e,_0x1246b3){_0x1246b3=_0x1246b3||0xc8;return function(_0x1d0940){if(_0x1d0940){return _0x12646e[_0x6082('0x1a')](_0x1246b3)['json'](_0x1d0940);}};}function respondWithFilteredResult(_0xee10fb,_0x5ca96a){return function(_0x253630){if(_0x253630){var _0x411014=typeof _0x5ca96a[_0x6082('0x1b')]===_0x6082('0x1c')&&typeof _0x5ca96a[_0x6082('0x1d')]===_0x6082('0x1c');var _0x8f1e27=_0x253630[_0x6082('0x1e')];var _0x14b2ba=_0x411014?0x0:_0x5ca96a['offset'];var _0x1d4606=_0x411014?_0x253630[_0x6082('0x1e')]:_0x5ca96a['offset']+_0x5ca96a['limit'];var _0x1cc743;if(_0x1d4606>=_0x8f1e27){_0x1d4606=_0x8f1e27;_0x1cc743=0xc8;}else{_0x1cc743=0xce;}_0xee10fb['status'](_0x1cc743);return _0xee10fb['set']('Content-Range',_0x14b2ba+'-'+_0x1d4606+'/'+_0x8f1e27)[_0x6082('0x1f')](_0x253630);}return null;};}function patchUpdates(_0x48263b){return function(_0x2d5a3b){try{jsonpatch[_0x6082('0x20')](_0x2d5a3b,_0x48263b,!![]);}catch(_0x318b5d){return BPromise[_0x6082('0x21')](_0x318b5d);}return _0x2d5a3b[_0x6082('0x22')]();};}function saveUpdates(_0x330aec,_0x4d9f47){return function(_0x8b859d){if(_0x8b859d){return _0x8b859d['update'](_0x330aec)['then'](function(_0x41ec84){return _0x41ec84;});}return null;};}function removeEntity(_0x26766a,_0x53345a){return function(_0x2a9c29){if(_0x2a9c29){return _0x2a9c29[_0x6082('0x23')]()['then'](function(){_0x26766a[_0x6082('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dada9,_0x49d978){return function(_0x751abe){if(!_0x751abe){_0x4dada9['sendStatus'](0x194);}return _0x751abe;};}function handleError(_0x23311e,_0x75f986){_0x75f986=_0x75f986||0x1f4;return function(_0x4119e3){logger[_0x6082('0x24')](_0x4119e3[_0x6082('0x25')]);if(_0x4119e3['name']){delete _0x4119e3[_0x6082('0x26')];}_0x23311e[_0x6082('0x1a')](_0x75f986)[_0x6082('0x27')](_0x4119e3);};}exports[_0x6082('0x28')]=function(_0x2e052e,_0x12f1d1){var _0x48302c={},_0x3b18f8={},_0x37bba8={'count':0x0,'rows':[]};var _0x5e40ff=_[_0x6082('0x29')](db[_0x6082('0x2a')][_0x6082('0x2b')],function(_0x45ef95){return{'name':_0x45ef95[_0x6082('0x2c')],'type':_0x45ef95[_0x6082('0x2d')][_0x6082('0x2e')]};});_0x3b18f8[_0x6082('0x2f')]=_[_0x6082('0x29')](_0x5e40ff,'name');_0x3b18f8[_0x6082('0x30')]=_[_0x6082('0x31')](_0x2e052e['query']);_0x3b18f8[_0x6082('0x32')]=_[_0x6082('0x33')](_0x3b18f8[_0x6082('0x2f')],_0x3b18f8[_0x6082('0x30')]);_0x48302c[_0x6082('0x34')]=_[_0x6082('0x33')](_0x3b18f8[_0x6082('0x2f')],qs['fields'](_0x2e052e['query']['fields']));_0x48302c[_0x6082('0x34')]=_0x48302c['attributes'][_0x6082('0x35')]?_0x48302c[_0x6082('0x34')]:_0x3b18f8[_0x6082('0x2f')];if(!_0x2e052e[_0x6082('0x30')][_0x6082('0x36')](_0x6082('0x37'))){_0x48302c['limit']=qs[_0x6082('0x1d')](_0x2e052e[_0x6082('0x30')]['limit']);_0x48302c['offset']=qs[_0x6082('0x1b')](_0x2e052e[_0x6082('0x30')]['offset']);}_0x48302c[_0x6082('0x38')]=qs[_0x6082('0x39')](_0x2e052e[_0x6082('0x30')][_0x6082('0x39')]);_0x48302c['where']=qs[_0x6082('0x32')](_[_0x6082('0x3a')](_0x2e052e[_0x6082('0x30')],_0x3b18f8['filters']),_0x5e40ff);if(_0x2e052e[_0x6082('0x30')][_0x6082('0x3b')]){_0x48302c['where']=_[_0x6082('0x3c')](_0x48302c[_0x6082('0x3d')],{'$or':_[_0x6082('0x29')](_0x5e40ff,function(_0x10b0a1){if(_0x10b0a1[_0x6082('0x2d')]!=='VIRTUAL'){var _0x51f5b9={};_0x51f5b9[_0x10b0a1['name']]={'$like':'%'+_0x2e052e[_0x6082('0x30')]['filter']+'%'};return _0x51f5b9;}})});}_0x48302c=_[_0x6082('0x3c')]({},_0x48302c,_0x2e052e[_0x6082('0x3e')]);var _0x326213={'where':_0x48302c[_0x6082('0x3d')]};return db['FaxTransferReport']['count'](_0x326213)[_0x6082('0x3f')](function(_0x3a57e5){_0x37bba8[_0x6082('0x1e')]=_0x3a57e5;if(_0x2e052e[_0x6082('0x30')][_0x6082('0x40')]){_0x48302c['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x48302c);})['then'](function(_0x4e53e1){_0x37bba8[_0x6082('0x41')]=_0x4e53e1;return _0x37bba8;})[_0x6082('0x3f')](respondWithFilteredResult(_0x12f1d1,_0x48302c))['catch'](handleError(_0x12f1d1,null));};exports[_0x6082('0x42')]=function(_0x23ab36,_0x2806f7){var _0x4e1efa={'raw':!![],'where':{'id':_0x23ab36[_0x6082('0x43')]['id']}},_0x18680d={};_0x18680d[_0x6082('0x2f')]=_[_0x6082('0x31')](db[_0x6082('0x2a')][_0x6082('0x2b')]);_0x18680d[_0x6082('0x30')]=_[_0x6082('0x31')](_0x23ab36['query']);_0x18680d[_0x6082('0x32')]=_[_0x6082('0x33')](_0x18680d[_0x6082('0x2f')],_0x18680d[_0x6082('0x30')]);_0x4e1efa[_0x6082('0x34')]=_['intersection'](_0x18680d[_0x6082('0x2f')],qs[_0x6082('0x44')](_0x23ab36[_0x6082('0x30')]['fields']));_0x4e1efa['attributes']=_0x4e1efa[_0x6082('0x34')][_0x6082('0x35')]?_0x4e1efa['attributes']:_0x18680d['model'];if(_0x23ab36[_0x6082('0x30')][_0x6082('0x40')]){_0x4e1efa[_0x6082('0x45')]=[{'all':!![]}];}_0x4e1efa=_[_0x6082('0x3c')]({},_0x4e1efa,_0x23ab36[_0x6082('0x3e')]);return db[_0x6082('0x2a')][_0x6082('0x46')](_0x4e1efa)['then'](handleEntityNotFound(_0x2806f7,null))['then'](respondWithResult(_0x2806f7,null))[_0x6082('0x47')](handleError(_0x2806f7,null));};exports[_0x6082('0x48')]=function(_0x2db853,_0x1305cc){return db[_0x6082('0x2a')][_0x6082('0x48')](_0x2db853[_0x6082('0x49')],{})[_0x6082('0x3f')](respondWithResult(_0x1305cc,0xc9))[_0x6082('0x47')](handleError(_0x1305cc,null));};exports['update']=function(_0x23e49d,_0x25be29){if(_0x23e49d[_0x6082('0x49')]['id']){delete _0x23e49d[_0x6082('0x49')]['id'];}return db[_0x6082('0x2a')]['find']({'where':{'id':_0x23e49d['params']['id']}})[_0x6082('0x3f')](handleEntityNotFound(_0x25be29,null))['then'](saveUpdates(_0x23e49d[_0x6082('0x49')],null))[_0x6082('0x3f')](respondWithResult(_0x25be29,null))['catch'](handleError(_0x25be29,null));};exports[_0x6082('0x23')]=function(_0x178dd6,_0x124da2){return db[_0x6082('0x2a')][_0x6082('0x46')]({'where':{'id':_0x178dd6['params']['id']}})['then'](handleEntityNotFound(_0x124da2,null))[_0x6082('0x3f')](removeEntity(_0x124da2,null))[_0x6082('0x47')](handleError(_0x124da2,null));};exports[_0x6082('0x4a')]=function(_0x439afe,_0x44c6b1){return db['FaxTransferReport']['describe']()[_0x6082('0x3f')](respondWithResult(_0x44c6b1,null))[_0x6082('0x47')](handleError(_0x44c6b1,null));}; \ No newline at end of file +var _0x9455=['../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9455,0x76));var _0x5945=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9455[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x5945('0x0'));var rimraf=require(_0x5945('0x1'));var zipdir=require(_0x5945('0x2'));var jsonpatch=require(_0x5945('0x3'));var rp=require(_0x5945('0x4'));var moment=require(_0x5945('0x5'));var BPromise=require(_0x5945('0x6'));var Mustache=require(_0x5945('0x7'));var util=require('util');var path=require(_0x5945('0x8'));var sox=require(_0x5945('0x9'));var csv=require(_0x5945('0xa'));var ejs=require(_0x5945('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5945('0xc'));var squel=require(_0x5945('0xd'));var crypto=require(_0x5945('0xe'));var jsforce=require(_0x5945('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5945('0xa'));var querystring=require(_0x5945('0x10'));var Papa=require(_0x5945('0x11'));var Redis=require(_0x5945('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5945('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5945('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5945('0x15'));var db=require(_0x5945('0x16'))['db'];function respondWithStatusCode(_0x10814e,_0x10d266){_0x10d266=_0x10d266||0xcc;return function(_0x5e4129){if(_0x5e4129){return _0x10814e[_0x5945('0x17')](_0x10d266);}return _0x10814e[_0x5945('0x18')](_0x10d266)[_0x5945('0x19')]();};}function respondWithResult(_0x4056f1,_0x39292a){_0x39292a=_0x39292a||0xc8;return function(_0x278f17){if(_0x278f17){return _0x4056f1[_0x5945('0x18')](_0x39292a)[_0x5945('0x1a')](_0x278f17);}};}function respondWithFilteredResult(_0x248a55,_0x486a1f){return function(_0x861e1b){if(_0x861e1b){var _0x2b7b10=typeof _0x486a1f[_0x5945('0x1b')]==='undefined'&&typeof _0x486a1f[_0x5945('0x1c')]===_0x5945('0x1d');var _0x5bc60f=_0x861e1b[_0x5945('0x1e')];var _0x159472=_0x2b7b10?0x0:_0x486a1f[_0x5945('0x1b')];var _0x15aac7=_0x2b7b10?_0x861e1b['count']:_0x486a1f[_0x5945('0x1b')]+_0x486a1f[_0x5945('0x1c')];var _0x529387;if(_0x15aac7>=_0x5bc60f){_0x15aac7=_0x5bc60f;_0x529387=0xc8;}else{_0x529387=0xce;}_0x248a55[_0x5945('0x18')](_0x529387);return _0x248a55[_0x5945('0x1f')](_0x5945('0x20'),_0x159472+'-'+_0x15aac7+'/'+_0x5bc60f)['json'](_0x861e1b);}return null;};}function patchUpdates(_0x38bd53){return function(_0x2aca36){try{jsonpatch[_0x5945('0x21')](_0x2aca36,_0x38bd53,!![]);}catch(_0x34012b){return BPromise['reject'](_0x34012b);}return _0x2aca36['save']();};}function saveUpdates(_0xd63220,_0x433f10){return function(_0x69def6){if(_0x69def6){return _0x69def6[_0x5945('0x22')](_0xd63220)['then'](function(_0x539164){return _0x539164;});}return null;};}function removeEntity(_0x46495c,_0x41ad20){return function(_0x460efa){if(_0x460efa){return _0x460efa['destroy']()[_0x5945('0x23')](function(){_0x46495c[_0x5945('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e1f7b,_0x45f916){return function(_0xeb0481){if(!_0xeb0481){_0x3e1f7b[_0x5945('0x17')](0x194);}return _0xeb0481;};}function handleError(_0x3cee4f,_0x59b390){_0x59b390=_0x59b390||0x1f4;return function(_0xa4ac10){logger[_0x5945('0x24')](_0xa4ac10[_0x5945('0x25')]);if(_0xa4ac10[_0x5945('0x26')]){delete _0xa4ac10[_0x5945('0x26')];}_0x3cee4f['status'](_0x59b390)[_0x5945('0x27')](_0xa4ac10);};}exports[_0x5945('0x28')]=function(_0x17656b,_0x3a006b){var _0x6bcafd={},_0x4d7830={},_0x19cd7d={'count':0x0,'rows':[]};var _0x236a76=_[_0x5945('0x29')](db[_0x5945('0x2a')][_0x5945('0x2b')],function(_0x97b7bd){return{'name':_0x97b7bd['fieldName'],'type':_0x97b7bd[_0x5945('0x2c')][_0x5945('0x2d')]};});_0x4d7830[_0x5945('0x2e')]=_[_0x5945('0x29')](_0x236a76,_0x5945('0x26'));_0x4d7830[_0x5945('0x2f')]=_[_0x5945('0x30')](_0x17656b[_0x5945('0x2f')]);_0x4d7830[_0x5945('0x31')]=_[_0x5945('0x32')](_0x4d7830[_0x5945('0x2e')],_0x4d7830[_0x5945('0x2f')]);_0x6bcafd['attributes']=_[_0x5945('0x32')](_0x4d7830[_0x5945('0x2e')],qs[_0x5945('0x33')](_0x17656b['query']['fields']));_0x6bcafd[_0x5945('0x34')]=_0x6bcafd[_0x5945('0x34')][_0x5945('0x35')]?_0x6bcafd[_0x5945('0x34')]:_0x4d7830[_0x5945('0x2e')];if(!_0x17656b[_0x5945('0x2f')][_0x5945('0x36')]('nolimit')){_0x6bcafd[_0x5945('0x1c')]=qs[_0x5945('0x1c')](_0x17656b['query']['limit']);_0x6bcafd[_0x5945('0x1b')]=qs[_0x5945('0x1b')](_0x17656b[_0x5945('0x2f')][_0x5945('0x1b')]);}_0x6bcafd[_0x5945('0x37')]=qs[_0x5945('0x38')](_0x17656b[_0x5945('0x2f')][_0x5945('0x38')]);_0x6bcafd['where']=qs['filters'](_[_0x5945('0x39')](_0x17656b[_0x5945('0x2f')],_0x4d7830[_0x5945('0x31')]),_0x236a76);if(_0x17656b[_0x5945('0x2f')][_0x5945('0x3a')]){_0x6bcafd[_0x5945('0x3b')]=_[_0x5945('0x3c')](_0x6bcafd['where'],{'$or':_[_0x5945('0x29')](_0x236a76,function(_0x23d63c){if(_0x23d63c[_0x5945('0x2c')]!=='VIRTUAL'){var _0xdac67d={};_0xdac67d[_0x23d63c['name']]={'$like':'%'+_0x17656b['query'][_0x5945('0x3a')]+'%'};return _0xdac67d;}})});}_0x6bcafd=_['merge']({},_0x6bcafd,_0x17656b['options']);var _0x3e6ff2={'where':_0x6bcafd[_0x5945('0x3b')]};return db[_0x5945('0x2a')][_0x5945('0x1e')](_0x3e6ff2)[_0x5945('0x23')](function(_0x3d30b9){_0x19cd7d[_0x5945('0x1e')]=_0x3d30b9;if(_0x17656b[_0x5945('0x2f')][_0x5945('0x3d')]){_0x6bcafd[_0x5945('0x3e')]=[{'all':!![]}];}return db[_0x5945('0x2a')]['findAll'](_0x6bcafd);})[_0x5945('0x23')](function(_0x47a109){_0x19cd7d['rows']=_0x47a109;return _0x19cd7d;})[_0x5945('0x23')](respondWithFilteredResult(_0x3a006b,_0x6bcafd))['catch'](handleError(_0x3a006b,null));};exports[_0x5945('0x3f')]=function(_0x28fbb2,_0xa509a8){var _0x2b44b5={'raw':!![],'where':{'id':_0x28fbb2[_0x5945('0x40')]['id']}},_0x524cfc={};_0x524cfc[_0x5945('0x2e')]=_[_0x5945('0x30')](db[_0x5945('0x2a')][_0x5945('0x2b')]);_0x524cfc[_0x5945('0x2f')]=_['keys'](_0x28fbb2[_0x5945('0x2f')]);_0x524cfc[_0x5945('0x31')]=_[_0x5945('0x32')](_0x524cfc[_0x5945('0x2e')],_0x524cfc[_0x5945('0x2f')]);_0x2b44b5[_0x5945('0x34')]=_['intersection'](_0x524cfc['model'],qs[_0x5945('0x33')](_0x28fbb2[_0x5945('0x2f')][_0x5945('0x33')]));_0x2b44b5[_0x5945('0x34')]=_0x2b44b5[_0x5945('0x34')][_0x5945('0x35')]?_0x2b44b5[_0x5945('0x34')]:_0x524cfc['model'];if(_0x28fbb2['query']['includeAll']){_0x2b44b5[_0x5945('0x3e')]=[{'all':!![]}];}_0x2b44b5=_[_0x5945('0x3c')]({},_0x2b44b5,_0x28fbb2[_0x5945('0x41')]);return db['FaxTransferReport'][_0x5945('0x42')](_0x2b44b5)[_0x5945('0x23')](handleEntityNotFound(_0xa509a8,null))[_0x5945('0x23')](respondWithResult(_0xa509a8,null))[_0x5945('0x43')](handleError(_0xa509a8,null));};exports[_0x5945('0x44')]=function(_0x2e2339,_0x3303ae){return db[_0x5945('0x2a')][_0x5945('0x44')](_0x2e2339[_0x5945('0x45')],{})[_0x5945('0x23')](respondWithResult(_0x3303ae,0xc9))['catch'](handleError(_0x3303ae,null));};exports['update']=function(_0x55392e,_0x2cf568){if(_0x55392e[_0x5945('0x45')]['id']){delete _0x55392e[_0x5945('0x45')]['id'];}return db['FaxTransferReport'][_0x5945('0x42')]({'where':{'id':_0x55392e['params']['id']}})['then'](handleEntityNotFound(_0x2cf568,null))[_0x5945('0x23')](saveUpdates(_0x55392e[_0x5945('0x45')],null))['then'](respondWithResult(_0x2cf568,null))[_0x5945('0x43')](handleError(_0x2cf568,null));};exports['destroy']=function(_0x46026d,_0x312648){return db[_0x5945('0x2a')][_0x5945('0x42')]({'where':{'id':_0x46026d[_0x5945('0x40')]['id']}})[_0x5945('0x23')](handleEntityNotFound(_0x312648,null))[_0x5945('0x23')](removeEntity(_0x312648,null))[_0x5945('0x43')](handleError(_0x312648,null));};exports['describe']=function(_0x4493e9,_0x3b6da7){return db[_0x5945('0x2a')]['describe']()[_0x5945('0x23')](respondWithResult(_0x3b6da7,null))[_0x5945('0x43')](handleError(_0x3b6da7,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e3b603f..6422c10 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 _0x5332=['../../config/logger','api','moment','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x5390a3,_0x4d60f7){var _0x45d220=function(_0x47904f){while(--_0x47904f){_0x5390a3['push'](_0x5390a3['shift']());}};_0x45d220(++_0x4d60f7);}(_0x5332,0x12a));var _0x2533=function(_0x36f05b,_0x1db03f){_0x36f05b=_0x36f05b-0x0;var _0x125fb=_0x5332[_0x36f05b];return _0x125fb;};'use strict';var _=require(_0x2533('0x0'));var util=require('util');var logger=require(_0x2533('0x1'))(_0x2533('0x2'));var moment=require(_0x2533('0x3'));var BPromise=require('bluebird');var rp=require(_0x2533('0x4'));var fs=require('fs');var path=require(_0x2533('0x5'));var rimraf=require(_0x2533('0x6'));var config=require('../../config/environment');var attributes=require(_0x2533('0x7'));module[_0x2533('0x8')]=function(_0x4bc6dc,_0x5ec155){return _0x4bc6dc[_0x2533('0x9')](_0x2533('0xa'),attributes,{'tableName':_0x2533('0xb'),'paranoid':![],'indexes':[{'name':_0x2533('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe19a=['rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x372c78,_0x3d2435){var _0x470257=function(_0x3ffada){while(--_0x3ffada){_0x372c78['push'](_0x372c78['shift']());}};_0x470257(++_0x3d2435);}(_0xe19a,0xd6));var _0xae19=function(_0x36e557,_0x582535){_0x36e557=_0x36e557-0x0;var _0x4072f7=_0xe19a[_0x36e557];return _0x4072f7;};'use strict';var _=require(_0xae19('0x0'));var util=require('util');var logger=require(_0xae19('0x1'))(_0xae19('0x2'));var moment=require(_0xae19('0x3'));var BPromise=require(_0xae19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae19('0x5'));var rimraf=require(_0xae19('0x6'));var config=require('../../config/environment');var attributes=require(_0xae19('0x7'));module[_0xae19('0x8')]=function(_0xdd4649,_0x42bd22){return _0xdd4649['define'](_0xae19('0x9'),attributes,{'tableName':_0xae19('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index fd95d87..0dde5ae 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 _0x0db4=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x529c40,_0x4c262f){var _0x2ccd4d=function(_0x5c778f){while(--_0x5c778f){_0x529c40['push'](_0x529c40['shift']());}};_0x2ccd4d(++_0x4c262f);}(_0x0db4,0xab));var _0x40db=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x0db4[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x40db('0x0'));var util=require('util');var moment=require(_0x40db('0x1'));var BPromise=require(_0x40db('0x2'));var rs=require(_0x40db('0x3'));var fs=require('fs');var Redis=require(_0x40db('0x4'));var db=require(_0x40db('0x5'))['db'];var utils=require(_0x40db('0x6'));var logger=require('../../config/logger')(_0x40db('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x40db('0x8')][_0x40db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43d8de,_0x830999,_0x17cb1f){return new BPromise(function(_0x14a1f0,_0x26e635){return client[_0x40db('0xa')](_0x43d8de,_0x17cb1f)[_0x40db('0xb')](function(_0x1243ee){logger['info'](_0x40db('0xc'),_0x830999,_0x40db('0xd'));logger[_0x40db('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x830999,_0x40db('0xd'),JSON[_0x40db('0xf')](_0x1243ee));if(_0x1243ee[_0x40db('0x10')]){if(_0x1243ee['error']['code']===0x1f4){logger['error'](_0x40db('0xc'),_0x830999,_0x1243ee[_0x40db('0x10')][_0x40db('0x11')]);return _0x26e635(_0x1243ee[_0x40db('0x10')]['message']);}logger['error'](_0x40db('0xc'),_0x830999,_0x1243ee['error']['message']);return _0x14a1f0(_0x1243ee[_0x40db('0x10')][_0x40db('0x11')]);}else{logger['info'](_0x40db('0xc'),_0x830999,'request\x20sent');_0x14a1f0(_0x1243ee[_0x40db('0x12')][_0x40db('0x11')]);}})['catch'](function(_0x5f964e){logger[_0x40db('0x10')](_0x40db('0xc'),_0x830999,_0x5f964e);_0x26e635(_0x5f964e);});});} \ No newline at end of file +var _0x7c28=['client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7c28,0x1c4));var _0x87c2=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x7c28[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require(_0x87c2('0x0'));var util=require(_0x87c2('0x1'));var moment=require(_0x87c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x87c2('0x3'));var fs=require('fs');var Redis=require(_0x87c2('0x4'));var db=require(_0x87c2('0x5'))['db'];var utils=require(_0x87c2('0x6'));var logger=require(_0x87c2('0x7'))(_0x87c2('0x8'));var config=require('../../config/environment');var jayson=require(_0x87c2('0x9'));var client=jayson[_0x87c2('0xa')][_0x87c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23ad39,_0xde35d5,_0x3b6249){return new BPromise(function(_0x49dcbb,_0x2e2512){return client[_0x87c2('0xc')](_0x23ad39,_0x3b6249)[_0x87c2('0xd')](function(_0x1113d7){logger['info'](_0x87c2('0xe'),_0xde35d5,_0x87c2('0xf'));logger[_0x87c2('0x10')](_0x87c2('0x11'),_0xde35d5,_0x87c2('0xf'),JSON[_0x87c2('0x12')](_0x1113d7));if(_0x1113d7['error']){if(_0x1113d7['error']['code']===0x1f4){logger[_0x87c2('0x13')](_0x87c2('0xe'),_0xde35d5,_0x1113d7[_0x87c2('0x13')]['message']);return _0x2e2512(_0x1113d7[_0x87c2('0x13')][_0x87c2('0x14')]);}logger[_0x87c2('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0xde35d5,_0x1113d7[_0x87c2('0x13')][_0x87c2('0x14')]);return _0x49dcbb(_0x1113d7['error'][_0x87c2('0x14')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0xde35d5,_0x87c2('0xf'));_0x49dcbb(_0x1113d7['result'][_0x87c2('0x14')]);}})[_0x87c2('0x15')](function(_0x2b56eb){logger[_0x87c2('0x13')](_0x87c2('0xe'),_0xde35d5,_0x2b56eb);_0x2e2512(_0x2b56eb);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3a63817..e5a58b9 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 _0x003e=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x34f1e7,_0x566996){var _0x8155d2=function(_0x5b59b6){while(--_0x5b59b6){_0x34f1e7['push'](_0x34f1e7['shift']());}};_0x8155d2(++_0x566996);}(_0x003e,0x15b));var _0xe003=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x003e[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0xe003('0x0'));var util=require(_0xe003('0x1'));var path=require(_0xe003('0x2'));var timeout=require(_0xe003('0x3'));var express=require('express');var router=express[_0xe003('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe003('0x5'));var interaction=require(_0xe003('0x6'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0xe003('0x7')]('/',auth[_0xe003('0x8')](),controller[_0xe003('0x9')]);router[_0xe003('0x7')](_0xe003('0xa'),auth[_0xe003('0x8')](),controller[_0xe003('0xb')]);router[_0xe003('0x7')](_0xe003('0xc'),auth['isAuthenticated'](),controller[_0xe003('0xd')]);router[_0xe003('0xe')]('/',auth[_0xe003('0x8')](),controller[_0xe003('0xf')]);router[_0xe003('0x10')]('/:id',auth[_0xe003('0x8')](),controller[_0xe003('0x11')]);router[_0xe003('0x12')]('/:id',auth[_0xe003('0x8')](),controller[_0xe003('0x13')]);module[_0xe003('0x14')]=router; \ No newline at end of file +var _0x1da3=['isAuthenticated','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x27bf6e,_0x392b0d){var _0xc8a8dd=function(_0x483fa8){while(--_0x483fa8){_0x27bf6e['push'](_0x27bf6e['shift']());}};_0xc8a8dd(++_0x392b0d);}(_0x1da3,0x1c3));var _0x31da=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1da3[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x31da('0x0'));var util=require(_0x31da('0x1'));var path=require(_0x31da('0x2'));var timeout=require(_0x31da('0x3'));var express=require(_0x31da('0x4'));var router=express['Router']();var fs_extra=require(_0x31da('0x5'));var auth=require(_0x31da('0x6'));var interaction=require(_0x31da('0x7'));var config=require(_0x31da('0x8'));var controller=require(_0x31da('0x9'));router[_0x31da('0xa')]('/',auth[_0x31da('0xb')](),controller['index']);router[_0x31da('0xa')](_0x31da('0xc'),auth['isAuthenticated'](),controller[_0x31da('0xd')]);router[_0x31da('0xa')](_0x31da('0xe'),auth['isAuthenticated'](),controller[_0x31da('0xf')]);router[_0x31da('0x10')]('/',auth[_0x31da('0xb')](),controller['create']);router[_0x31da('0x11')](_0x31da('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x31da('0x12')](_0x31da('0xe'),auth[_0x31da('0xb')](),controller[_0x31da('0x13')]);module[_0x31da('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d86dbcd..1e7a822 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 _0xc21d=['update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xc21d,0xdf));var _0xdc21=function(_0x55d46b,_0xbd504c){_0x55d46b=_0x55d46b-0x0;var _0x4a1f2d=_0xc21d[_0x55d46b];return _0x4a1f2d;};'use strict';var multer=require(_0xdc21('0x0'));var util=require(_0xdc21('0x1'));var path=require(_0xdc21('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc21('0x3'));var router=express[_0xdc21('0x4')]();var fs_extra=require(_0xdc21('0x5'));var auth=require(_0xdc21('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc21('0x7'));var controller=require('./intDeskAccount.controller');router[_0xdc21('0x8')]('/',auth[_0xdc21('0x9')](),controller['index']);router['get'](_0xdc21('0xa'),auth[_0xdc21('0x9')](),controller[_0xdc21('0xb')]);router[_0xdc21('0x8')](_0xdc21('0xc'),auth[_0xdc21('0x9')](),controller['getConfigurations']);router['get'](_0xdc21('0xd'),auth['isAuthenticated'](),controller[_0xdc21('0xe')]);router[_0xdc21('0xf')]('/',auth[_0xdc21('0x9')](),controller[_0xdc21('0x10')]);router[_0xdc21('0xf')](_0xdc21('0xc'),auth[_0xdc21('0x9')](),controller[_0xdc21('0x11')]);router[_0xdc21('0x12')](_0xdc21('0xa'),auth[_0xdc21('0x9')](),controller[_0xdc21('0x13')]);router['delete'](_0xdc21('0xa'),auth[_0xdc21('0x9')](),controller[_0xdc21('0x14')]);module[_0xdc21('0x15')]=router; \ No newline at end of file +var _0xe53c=['create','/:id/configurations','destroy','exports','multer','Router','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','post'];(function(_0x258a27,_0x3ac8f8){var _0xe5ae54=function(_0x5dac08){while(--_0x5dac08){_0x258a27['push'](_0x258a27['shift']());}};_0xe5ae54(++_0x3ac8f8);}(_0xe53c,0x184));var _0xce53=function(_0x50e351,_0x35608c){_0x50e351=_0x50e351-0x0;var _0x418d06=_0xe53c[_0x50e351];return _0x418d06;};'use strict';var multer=require(_0xce53('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xce53('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xce53('0x2'));var config=require('../../config/environment');var controller=require(_0xce53('0x3'));router['get']('/',auth[_0xce53('0x4')](),controller[_0xce53('0x5')]);router[_0xce53('0x6')](_0xce53('0x7'),auth['isAuthenticated'](),controller[_0xce53('0x8')]);router['get']('/:id/configurations',auth[_0xce53('0x4')](),controller[_0xce53('0x9')]);router[_0xce53('0x6')]('/:id/fields',auth[_0xce53('0x4')](),controller[_0xce53('0xa')]);router[_0xce53('0xb')]('/',auth['isAuthenticated'](),controller[_0xce53('0xc')]);router[_0xce53('0xb')](_0xce53('0xd'),auth[_0xce53('0x4')](),controller['addConfiguration']);router['put']('/:id',auth[_0xce53('0x4')](),controller['update']);router['delete'](_0xce53('0x7'),auth[_0xce53('0x4')](),controller[_0xce53('0xe')]);module[_0xce53('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 13f749a..fe453f6 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 _0xf288=['exports','STRING','basic','ENUM','integrationTab','sequelize'];(function(_0x5f3884,_0x243e63){var _0x40e269=function(_0x114fa7){while(--_0x114fa7){_0x5f3884['push'](_0x5f3884['shift']());}};_0x40e269(++_0x243e63);}(_0xf288,0x1c1));var _0x8f28=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xf288[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0x8f28('0x0'));module[_0x8f28('0x1')]={'name':{'type':Sequelize[_0x8f28('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8f28('0x2')]},'remoteUri':{'type':Sequelize[_0x8f28('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x8f28('0x3')),'defaultValue':_0x8f28('0x3')},'password':{'type':Sequelize[_0x8f28('0x2')]},'consumerKey':{'type':Sequelize[_0x8f28('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8f28('0x2')]},'tokenSecret':{'type':Sequelize[_0x8f28('0x2')]},'serverUrl':{'type':Sequelize[_0x8f28('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8f28('0x4')]('integrationTab','newTab'),'defaultValue':_0x8f28('0x5')}}; \ No newline at end of file +var _0xc726=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0xc726,0x1ce));var _0x6c72=function(_0xd49cf5,_0x5be6c4){_0xd49cf5=_0xd49cf5-0x0;var _0x482c34=_0xc726[_0xd49cf5];return _0x482c34;};'use strict';var Sequelize=require(_0x6c72('0x0'));module['exports']={'name':{'type':Sequelize[_0x6c72('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6c72('0x1')]},'authType':{'type':Sequelize[_0x6c72('0x2')]('basic'),'defaultValue':_0x6c72('0x3')},'password':{'type':Sequelize[_0x6c72('0x1')]},'consumerKey':{'type':Sequelize[_0x6c72('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6c72('0x1')]},'tokenSecret':{'type':Sequelize[_0x6c72('0x1')]},'serverUrl':{'type':Sequelize[_0x6c72('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6c72('0x2')](_0x6c72('0x4'),_0x6c72('0x5')),'defaultValue':_0x6c72('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 977cbf6..aee0c91 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 _0xf009=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','DeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Descriptions','getFields','priority','remoteUri','authType','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','format','%s:%s','username','password','base64','concat','map','_embedded','entries','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf009,0xcf));var _0x9f00=function(_0x2ff8ae,_0x459670){_0x2ff8ae=_0x2ff8ae-0x0;var _0x52d112=_0xf009[_0x2ff8ae];return _0x52d112;};'use strict';var emlformat=require(_0x9f00('0x0'));var rimraf=require(_0x9f00('0x1'));var zipdir=require(_0x9f00('0x2'));var jsonpatch=require(_0x9f00('0x3'));var rp=require(_0x9f00('0x4'));var moment=require(_0x9f00('0x5'));var BPromise=require(_0x9f00('0x6'));var Mustache=require('mustache');var util=require(_0x9f00('0x7'));var path=require(_0x9f00('0x8'));var sox=require(_0x9f00('0x9'));var csv=require(_0x9f00('0xa'));var ejs=require(_0x9f00('0xb'));var fs=require('fs');var fs_extra=require(_0x9f00('0xc'));var _=require('lodash');var squel=require(_0x9f00('0xd'));var crypto=require('crypto');var jsforce=require(_0x9f00('0xe'));var deskjs=require(_0x9f00('0xf'));var toCsv=require(_0x9f00('0xa'));var querystring=require(_0x9f00('0x10'));var Papa=require('papaparse');var Redis=require(_0x9f00('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f00('0x12'));var hardwareService=require(_0x9f00('0x13'));var logger=require(_0x9f00('0x14'))(_0x9f00('0x15'));var utils=require('../../config/utils');var config=require(_0x9f00('0x16'));var licenseUtil=require(_0x9f00('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9f00('0x18'));function respondWithStatusCode(_0x54791f,_0x53e81b){_0x53e81b=_0x53e81b||0xcc;return function(_0x39235d){if(_0x39235d){return _0x54791f['sendStatus'](_0x53e81b);}return _0x54791f[_0x9f00('0x19')](_0x53e81b)[_0x9f00('0x1a')]();};}function respondWithResult(_0x480e8b,_0x48dc67){_0x48dc67=_0x48dc67||0xc8;return function(_0xc3cdb){if(_0xc3cdb){return _0x480e8b[_0x9f00('0x19')](_0x48dc67)[_0x9f00('0x1b')](_0xc3cdb);}};}function respondWithFilteredResult(_0x19c642,_0x1dbf63){return function(_0x3b0ead){if(_0x3b0ead){var _0x19777d=typeof _0x1dbf63[_0x9f00('0x1c')]===_0x9f00('0x1d')&&typeof _0x1dbf63['limit']===_0x9f00('0x1d');var _0x45a2dd=_0x3b0ead[_0x9f00('0x1e')];var _0x155324=_0x19777d?0x0:_0x1dbf63[_0x9f00('0x1c')];var _0x5cec2d=_0x19777d?_0x3b0ead[_0x9f00('0x1e')]:_0x1dbf63['offset']+_0x1dbf63[_0x9f00('0x1f')];var _0x187051;if(_0x5cec2d>=_0x45a2dd){_0x5cec2d=_0x45a2dd;_0x187051=0xc8;}else{_0x187051=0xce;}_0x19c642[_0x9f00('0x19')](_0x187051);return _0x19c642[_0x9f00('0x20')](_0x9f00('0x21'),_0x155324+'-'+_0x5cec2d+'/'+_0x45a2dd)[_0x9f00('0x1b')](_0x3b0ead);}return null;};}function patchUpdates(_0x420308){return function(_0xde847d){try{jsonpatch[_0x9f00('0x22')](_0xde847d,_0x420308,!![]);}catch(_0x17aacc){return BPromise[_0x9f00('0x23')](_0x17aacc);}return _0xde847d['save']();};}function saveUpdates(_0x38c0c0,_0x8b7faf){return function(_0x4c844b){if(_0x4c844b){return _0x4c844b[_0x9f00('0x24')](_0x38c0c0)[_0x9f00('0x25')](function(_0x5384e7){return _0x5384e7;});}return null;};}function removeEntity(_0x34487c,_0x45a55b){return function(_0x1ff373){if(_0x1ff373){return _0x1ff373['destroy']()['then'](function(){_0x34487c[_0x9f00('0x19')](0xcc)[_0x9f00('0x1a')]();});}};}function handleEntityNotFound(_0x166cbe,_0x4d0df5){return function(_0x20fcd8){if(!_0x20fcd8){_0x166cbe[_0x9f00('0x26')](0x194);}return _0x20fcd8;};}function handleError(_0x3d83c5,_0x3dbe1a){_0x3dbe1a=_0x3dbe1a||0x1f4;return function(_0x1a7db9){logger[_0x9f00('0x27')](_0x1a7db9[_0x9f00('0x28')]);if(_0x1a7db9['name']){delete _0x1a7db9[_0x9f00('0x29')];}_0x3d83c5[_0x9f00('0x19')](_0x3dbe1a)['send'](_0x1a7db9);};}exports[_0x9f00('0x2a')]=function(_0x1404ca,_0xd31c02){var _0x5d8f67={},_0x1ceaab={},_0x192dd={'count':0x0,'rows':[]};var _0x57006e=_['map'](db[_0x9f00('0x2b')]['rawAttributes'],function(_0x447bf0){return{'name':_0x447bf0[_0x9f00('0x2c')],'type':_0x447bf0[_0x9f00('0x2d')][_0x9f00('0x2e')]};});_0x1ceaab[_0x9f00('0x2f')]=_['map'](_0x57006e,_0x9f00('0x29'));_0x1ceaab[_0x9f00('0x30')]=_[_0x9f00('0x31')](_0x1404ca[_0x9f00('0x30')]);_0x1ceaab[_0x9f00('0x32')]=_[_0x9f00('0x33')](_0x1ceaab[_0x9f00('0x2f')],_0x1ceaab[_0x9f00('0x30')]);_0x5d8f67[_0x9f00('0x34')]=_[_0x9f00('0x33')](_0x1ceaab[_0x9f00('0x2f')],qs[_0x9f00('0x35')](_0x1404ca[_0x9f00('0x30')][_0x9f00('0x35')]));_0x5d8f67[_0x9f00('0x34')]=_0x5d8f67[_0x9f00('0x34')][_0x9f00('0x36')]?_0x5d8f67[_0x9f00('0x34')]:_0x1ceaab[_0x9f00('0x2f')];if(!_0x1404ca[_0x9f00('0x30')][_0x9f00('0x37')]('nolimit')){_0x5d8f67[_0x9f00('0x1f')]=qs[_0x9f00('0x1f')](_0x1404ca[_0x9f00('0x30')][_0x9f00('0x1f')]);_0x5d8f67[_0x9f00('0x1c')]=qs[_0x9f00('0x1c')](_0x1404ca[_0x9f00('0x30')][_0x9f00('0x1c')]);}_0x5d8f67[_0x9f00('0x38')]=qs[_0x9f00('0x39')](_0x1404ca[_0x9f00('0x30')][_0x9f00('0x39')]);_0x5d8f67[_0x9f00('0x3a')]=qs['filters'](_['pick'](_0x1404ca[_0x9f00('0x30')],_0x1ceaab[_0x9f00('0x32')]),_0x57006e);if(_0x1404ca[_0x9f00('0x30')][_0x9f00('0x3b')]){_0x5d8f67[_0x9f00('0x3a')]=_[_0x9f00('0x3c')](_0x5d8f67[_0x9f00('0x3a')],{'$or':_['map'](_0x57006e,function(_0x4bb36b){if(_0x4bb36b[_0x9f00('0x2d')]!==_0x9f00('0x3d')){var _0x468f5e={};_0x468f5e[_0x4bb36b[_0x9f00('0x29')]]={'$like':'%'+_0x1404ca[_0x9f00('0x30')][_0x9f00('0x3b')]+'%'};return _0x468f5e;}})});}_0x5d8f67=_[_0x9f00('0x3c')]({},_0x5d8f67,_0x1404ca[_0x9f00('0x3e')]);var _0x4b06d2={'where':_0x5d8f67[_0x9f00('0x3a')]};return db[_0x9f00('0x2b')][_0x9f00('0x1e')](_0x4b06d2)[_0x9f00('0x25')](function(_0x1b734c){_0x192dd['count']=_0x1b734c;if(_0x1404ca[_0x9f00('0x30')]['includeAll']){_0x5d8f67['include']=[{'all':!![]}];}return db['DeskAccount'][_0x9f00('0x3f')](_0x5d8f67);})[_0x9f00('0x25')](function(_0x2f7a50){_0x192dd[_0x9f00('0x40')]=_0x2f7a50;return _0x192dd;})[_0x9f00('0x25')](respondWithFilteredResult(_0xd31c02,_0x5d8f67))[_0x9f00('0x41')](handleError(_0xd31c02,null));};exports[_0x9f00('0x42')]=function(_0x246802,_0xd039ce){var _0xfc6fe={'raw':![],'where':{'id':_0x246802[_0x9f00('0x43')]['id']}},_0x36c88c={};_0x36c88c[_0x9f00('0x2f')]=_[_0x9f00('0x31')](db['DeskAccount'][_0x9f00('0x44')]);_0x36c88c[_0x9f00('0x30')]=_[_0x9f00('0x31')](_0x246802[_0x9f00('0x30')]);_0x36c88c['filters']=_[_0x9f00('0x33')](_0x36c88c[_0x9f00('0x2f')],_0x36c88c['query']);_0xfc6fe[_0x9f00('0x34')]=_[_0x9f00('0x33')](_0x36c88c[_0x9f00('0x2f')],qs[_0x9f00('0x35')](_0x246802[_0x9f00('0x30')][_0x9f00('0x35')]));_0xfc6fe[_0x9f00('0x34')]=_0xfc6fe['attributes']['length']?_0xfc6fe[_0x9f00('0x34')]:_0x36c88c[_0x9f00('0x2f')];if(_0x246802[_0x9f00('0x30')][_0x9f00('0x45')]){_0xfc6fe[_0x9f00('0x46')]=[{'all':!![]}];}_0xfc6fe=_[_0x9f00('0x3c')]({},_0xfc6fe,_0x246802[_0x9f00('0x3e')]);return db[_0x9f00('0x2b')][_0x9f00('0x47')](_0xfc6fe)[_0x9f00('0x25')](handleEntityNotFound(_0xd039ce,null))[_0x9f00('0x25')](respondWithResult(_0xd039ce,null))['catch'](handleError(_0xd039ce,null));};exports[_0x9f00('0x48')]=function(_0x53c9f7,_0x2edcf8){return db[_0x9f00('0x2b')][_0x9f00('0x48')](_0x53c9f7[_0x9f00('0x49')],{})[_0x9f00('0x25')](respondWithResult(_0x2edcf8,0xc9))[_0x9f00('0x41')](handleError(_0x2edcf8,null));};exports[_0x9f00('0x24')]=function(_0x239227,_0x2a5b4f){if(_0x239227[_0x9f00('0x49')]['id']){delete _0x239227[_0x9f00('0x49')]['id'];}return db[_0x9f00('0x2b')]['find']({'where':{'id':_0x239227['params']['id']}})[_0x9f00('0x25')](handleEntityNotFound(_0x2a5b4f,null))[_0x9f00('0x25')](saveUpdates(_0x239227[_0x9f00('0x49')],null))[_0x9f00('0x25')](respondWithResult(_0x2a5b4f,null))['catch'](handleError(_0x2a5b4f,null));};exports[_0x9f00('0x4a')]=function(_0x35a82c,_0x1af9be){return db[_0x9f00('0x2b')][_0x9f00('0x47')]({'where':{'id':_0x35a82c[_0x9f00('0x43')]['id']}})['then'](handleEntityNotFound(_0x1af9be,null))[_0x9f00('0x25')](removeEntity(_0x1af9be,null))[_0x9f00('0x41')](handleError(_0x1af9be,null));};exports[_0x9f00('0x4b')]=function(_0x4066ac,_0x57a7ee,_0x2b3e4a){var _0x1fb41b={};var _0x507946={};var _0x2e117a;var _0x44b86c;return db['DeskAccount'][_0x9f00('0x4c')]({'where':{'id':_0x4066ac[_0x9f00('0x43')]['id']}})[_0x9f00('0x25')](handleEntityNotFound(_0x57a7ee,null))['then'](function(_0x5d411c){if(_0x5d411c){_0x2e117a=_0x5d411c;_0x507946['model']=_[_0x9f00('0x31')](db[_0x9f00('0x4d')][_0x9f00('0x44')]);_0x507946[_0x9f00('0x30')]=_[_0x9f00('0x31')](_0x4066ac[_0x9f00('0x30')]);_0x507946[_0x9f00('0x32')]=_['intersection'](_0x507946['model'],_0x507946['query']);_0x1fb41b[_0x9f00('0x34')]=_['intersection'](_0x507946['model'],qs[_0x9f00('0x35')](_0x4066ac[_0x9f00('0x30')][_0x9f00('0x35')]));_0x1fb41b[_0x9f00('0x34')]=_0x1fb41b[_0x9f00('0x34')][_0x9f00('0x36')]?_0x1fb41b[_0x9f00('0x34')]:_0x507946['model'];_0x1fb41b[_0x9f00('0x38')]=qs[_0x9f00('0x39')](_0x4066ac[_0x9f00('0x30')][_0x9f00('0x39')]);_0x1fb41b[_0x9f00('0x3a')]=qs[_0x9f00('0x32')](_['pick'](_0x4066ac['query'],_0x507946[_0x9f00('0x32')]));if(_0x4066ac['query']['filter']){_0x1fb41b[_0x9f00('0x3a')]=_['merge'](_0x1fb41b[_0x9f00('0x3a')],{'$or':_['map'](_0x1fb41b[_0x9f00('0x34')],function(_0x1e3f20){var _0x6a4fbd={};_0x6a4fbd[_0x1e3f20]={'$like':'%'+_0x4066ac[_0x9f00('0x30')]['filter']+'%'};return _0x6a4fbd;})});}_0x1fb41b=_[_0x9f00('0x3c')]({},_0x1fb41b,_0x4066ac['options']);return _0x2e117a[_0x9f00('0x4b')](_0x1fb41b);}})[_0x9f00('0x25')](function(_0x3e8af8){if(_0x3e8af8){_0x44b86c=_0x3e8af8[_0x9f00('0x36')];if(!_0x4066ac[_0x9f00('0x30')][_0x9f00('0x37')](_0x9f00('0x4e'))){_0x1fb41b['limit']=qs[_0x9f00('0x1f')](_0x4066ac[_0x9f00('0x30')][_0x9f00('0x1f')]);_0x1fb41b[_0x9f00('0x1c')]=qs[_0x9f00('0x1c')](_0x4066ac[_0x9f00('0x30')][_0x9f00('0x1c')]);}return _0x2e117a[_0x9f00('0x4b')](_0x1fb41b);}})[_0x9f00('0x25')](function(_0x45c252){if(_0x45c252){return _0x45c252?{'count':_0x44b86c,'rows':_0x45c252}:null;}})[_0x9f00('0x25')](respondWithResult(_0x57a7ee,null))[_0x9f00('0x41')](handleError(_0x57a7ee,null));};exports[_0x9f00('0x4f')]=function(_0x1b62c9,_0x106a8c,_0x54603e){if(_0x1b62c9[_0x9f00('0x49')]['id']){delete _0x1b62c9['body']['id'];}return db[_0x9f00('0x2b')][_0x9f00('0x4c')]({'where':{'id':_0x1b62c9[_0x9f00('0x43')]['id']}})[_0x9f00('0x25')](handleEntityNotFound(_0x106a8c,null))[_0x9f00('0x25')](function(_0x27b9ec){if(_0x27b9ec){_0x1b62c9['body'][_0x9f00('0x50')]=_0x27b9ec['id'];_0x1b62c9['body']['Subjects']=integrations[_0x9f00('0x51')](_0x1b62c9[_0x9f00('0x49')][_0x9f00('0x52')],_0x1b62c9[_0x9f00('0x49')][_0x9f00('0x2d')]);_0x1b62c9[_0x9f00('0x49')]['Descriptions']=integrations[_0x9f00('0x53')](_0x1b62c9['body'][_0x9f00('0x52')],_0x1b62c9[_0x9f00('0x49')][_0x9f00('0x2d')]);return db[_0x9f00('0x4d')][_0x9f00('0x48')](_0x1b62c9[_0x9f00('0x49')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x9f00('0x54')}]});}return null;})['then'](respondWithResult(_0x106a8c,null))[_0x9f00('0x41')](handleError(_0x106a8c,null));};exports[_0x9f00('0x55')]=function(_0xdb58a2,_0x195604,_0x1128ab){var _0x4403f9=[{'name':_0x9f00('0x56'),'label':_0x9f00('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 _0x5dcc8e='';return db['DeskAccount']['findOne']({'where':{'id':_0xdb58a2['params']['id']},'attributes':['id',_0x9f00('0x57'),_0x9f00('0x58'),'username','password','consumerKey',_0x9f00('0x59'),_0x9f00('0x5a'),_0x9f00('0x5b')]})[_0x9f00('0x25')](handleEntityNotFound(_0x195604,null))['then'](function(_0x5af32c){if(_0x5af32c){_0x5dcc8e=_0x5af32c[_0x9f00('0x57')];var _0x9668a5=_0x5dcc8e['slice'](-0x1);if(_0x9668a5==='/'){_0x5dcc8e=_0x5dcc8e[_0x9f00('0x5c')](0x0,_0x5dcc8e[_0x9f00('0x5d')](_0x9668a5));}var _0x4c0b8c={'method':_0x9f00('0x5e'),'uri':util['format'](_0x9f00('0x5f'),_0x5dcc8e),'headers':{'Content-Type':_0x9f00('0x60'),'Accept':'application/json'},'json':!![]};if(_0x5af32c[_0x9f00('0x58')]===_0x9f00('0x61')){_0x4c0b8c[_0x9f00('0x62')][_0x9f00('0x63')]=util['format'](_0x9f00('0x64'),new Buffer(util[_0x9f00('0x65')](_0x9f00('0x66'),_0x5af32c[_0x9f00('0x67')],_0x5af32c[_0x9f00('0x68')]))['toString'](_0x9f00('0x69')));}return rp(_0x4c0b8c)[_0x9f00('0x25')](function(_0x59f730){return _0x4403f9[_0x9f00('0x6a')](_[_0x9f00('0x6b')](_0x59f730[_0x9f00('0x6c')][_0x9f00('0x6d')],function(_0x1e58a8){return{'id':_0x1e58a8[_0x9f00('0x29')],'name':_0x1e58a8['name'],'type':_0x1e58a8[_0x9f00('0x2d')],'active':_0x1e58a8[_0x9f00('0x6e')],'label':_0x1e58a8['label'],'custom':!![]};}));});}})[_0x9f00('0x25')](function(_0x147ea0){return{'count':_0x147ea0[_0x9f00('0x36')],'rows':_0x147ea0};})[_0x9f00('0x25')](respondWithResult(_0x195604,null))['catch'](function(_0x46ae6a){var _0x387732=_0xdb58a2[_0x9f00('0x30')]['test']?0x1f4:_0x46ae6a[_0x9f00('0x6f')]||0x1f4;logger['error'](_0x9f00('0x70'),_0x9f00('0x55'),_0x387732,JSON[_0x9f00('0x71')](_0x46ae6a));delete _0x46ae6a[_0x9f00('0x29')];if(_0x387732===0x191){_0x387732=0x190;}_0x195604[_0x9f00('0x19')](_0x387732)[_0x9f00('0x72')](_0xdb58a2['query'][_0x9f00('0x73')]?{'message':_0x9f00('0x74'),'statusCode':_0x46ae6a[_0x9f00('0x6f')]}:_0x46ae6a);});}; \ No newline at end of file +var _0x1a5b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','include','findAll','rows','show','params','fields','includeAll','find','catch','create','body','findOne','DeskConfiguration','getConfigurations','addConfiguration','Subjects','Descriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','slice','substring','lastIndexOf','GET','format','basic','headers','Authorization','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring'];(function(_0x441d3a,_0x49bed8){var _0x32a7c3=function(_0x34dcaf){while(--_0x34dcaf){_0x441d3a['push'](_0x441d3a['shift']());}};_0x32a7c3(++_0x49bed8);}(_0x1a5b,0x133));var _0xb1a5=function(_0xdf821b,_0x296544){_0xdf821b=_0xdf821b-0x0;var _0x2a2639=_0x1a5b[_0xdf821b];return _0x2a2639;};'use strict';var emlformat=require(_0xb1a5('0x0'));var rimraf=require(_0xb1a5('0x1'));var zipdir=require(_0xb1a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb1a5('0x3'));var path=require(_0xb1a5('0x4'));var sox=require('sox');var csv=require(_0xb1a5('0x5'));var ejs=require(_0xb1a5('0x6'));var fs=require('fs');var fs_extra=require(_0xb1a5('0x7'));var _=require('lodash');var squel=require(_0xb1a5('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb1a5('0x9'));var toCsv=require(_0xb1a5('0x5'));var querystring=require(_0xb1a5('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb1a5('0xb'));var qs=require(_0xb1a5('0xc'));var as=require(_0xb1a5('0xd'));var hardwareService=require(_0xb1a5('0xe'));var logger=require('../../config/logger')(_0xb1a5('0xf'));var utils=require(_0xb1a5('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xb1a5('0x11'));var db=require(_0xb1a5('0x12'))['db'];var integrations=require(_0xb1a5('0x13'));function respondWithStatusCode(_0x11c20e,_0x495b9b){_0x495b9b=_0x495b9b||0xcc;return function(_0x134ef9){if(_0x134ef9){return _0x11c20e[_0xb1a5('0x14')](_0x495b9b);}return _0x11c20e['status'](_0x495b9b)[_0xb1a5('0x15')]();};}function respondWithResult(_0x5783b8,_0x89a08d){_0x89a08d=_0x89a08d||0xc8;return function(_0x2e55b6){if(_0x2e55b6){return _0x5783b8[_0xb1a5('0x16')](_0x89a08d)[_0xb1a5('0x17')](_0x2e55b6);}};}function respondWithFilteredResult(_0x32ab74,_0x30213d){return function(_0x48a6e1){if(_0x48a6e1){var _0x4abe3d=typeof _0x30213d[_0xb1a5('0x18')]===_0xb1a5('0x19')&&typeof _0x30213d[_0xb1a5('0x1a')]==='undefined';var _0x3ebf7e=_0x48a6e1[_0xb1a5('0x1b')];var _0x427d70=_0x4abe3d?0x0:_0x30213d['offset'];var _0x4326aa=_0x4abe3d?_0x48a6e1['count']:_0x30213d['offset']+_0x30213d['limit'];var _0x36e747;if(_0x4326aa>=_0x3ebf7e){_0x4326aa=_0x3ebf7e;_0x36e747=0xc8;}else{_0x36e747=0xce;}_0x32ab74[_0xb1a5('0x16')](_0x36e747);return _0x32ab74['set'](_0xb1a5('0x1c'),_0x427d70+'-'+_0x4326aa+'/'+_0x3ebf7e)[_0xb1a5('0x17')](_0x48a6e1);}return null;};}function patchUpdates(_0x508e42){return function(_0x108d08){try{jsonpatch[_0xb1a5('0x1d')](_0x108d08,_0x508e42,!![]);}catch(_0x25aa8c){return BPromise[_0xb1a5('0x1e')](_0x25aa8c);}return _0x108d08[_0xb1a5('0x1f')]();};}function saveUpdates(_0x4d5e9f,_0x2954e4){return function(_0x26b942){if(_0x26b942){return _0x26b942[_0xb1a5('0x20')](_0x4d5e9f)[_0xb1a5('0x21')](function(_0x39aaab){return _0x39aaab;});}return null;};}function removeEntity(_0x835768,_0x584b54){return function(_0x1f3b39){if(_0x1f3b39){return _0x1f3b39[_0xb1a5('0x22')]()[_0xb1a5('0x21')](function(){_0x835768[_0xb1a5('0x16')](0xcc)[_0xb1a5('0x15')]();});}};}function handleEntityNotFound(_0x4b5e08,_0x2b48b4){return function(_0x22cf9f){if(!_0x22cf9f){_0x4b5e08[_0xb1a5('0x14')](0x194);}return _0x22cf9f;};}function handleError(_0x4d59a3,_0x3aa08a){_0x3aa08a=_0x3aa08a||0x1f4;return function(_0x1b1d4d){logger[_0xb1a5('0x23')](_0x1b1d4d[_0xb1a5('0x24')]);if(_0x1b1d4d[_0xb1a5('0x25')]){delete _0x1b1d4d[_0xb1a5('0x25')];}_0x4d59a3[_0xb1a5('0x16')](_0x3aa08a)[_0xb1a5('0x26')](_0x1b1d4d);};}exports[_0xb1a5('0x27')]=function(_0x59fa1f,_0xb1c49d){var _0xb2c454={},_0x11d500={},_0x17f7b9={'count':0x0,'rows':[]};var _0x36382e=_[_0xb1a5('0x28')](db['DeskAccount'][_0xb1a5('0x29')],function(_0x37a146){return{'name':_0x37a146[_0xb1a5('0x2a')],'type':_0x37a146[_0xb1a5('0x2b')][_0xb1a5('0x2c')]};});_0x11d500[_0xb1a5('0x2d')]=_['map'](_0x36382e,_0xb1a5('0x25'));_0x11d500[_0xb1a5('0x2e')]=_[_0xb1a5('0x2f')](_0x59fa1f[_0xb1a5('0x2e')]);_0x11d500[_0xb1a5('0x30')]=_['intersection'](_0x11d500[_0xb1a5('0x2d')],_0x11d500[_0xb1a5('0x2e')]);_0xb2c454['attributes']=_[_0xb1a5('0x31')](_0x11d500[_0xb1a5('0x2d')],qs['fields'](_0x59fa1f[_0xb1a5('0x2e')]['fields']));_0xb2c454[_0xb1a5('0x32')]=_0xb2c454[_0xb1a5('0x32')][_0xb1a5('0x33')]?_0xb2c454[_0xb1a5('0x32')]:_0x11d500[_0xb1a5('0x2d')];if(!_0x59fa1f[_0xb1a5('0x2e')][_0xb1a5('0x34')](_0xb1a5('0x35'))){_0xb2c454[_0xb1a5('0x1a')]=qs[_0xb1a5('0x1a')](_0x59fa1f[_0xb1a5('0x2e')][_0xb1a5('0x1a')]);_0xb2c454[_0xb1a5('0x18')]=qs[_0xb1a5('0x18')](_0x59fa1f[_0xb1a5('0x2e')]['offset']);}_0xb2c454[_0xb1a5('0x36')]=qs['sort'](_0x59fa1f['query'][_0xb1a5('0x37')]);_0xb2c454[_0xb1a5('0x38')]=qs[_0xb1a5('0x30')](_[_0xb1a5('0x39')](_0x59fa1f[_0xb1a5('0x2e')],_0x11d500[_0xb1a5('0x30')]),_0x36382e);if(_0x59fa1f['query'][_0xb1a5('0x3a')]){_0xb2c454['where']=_[_0xb1a5('0x3b')](_0xb2c454['where'],{'$or':_[_0xb1a5('0x28')](_0x36382e,function(_0x59d403){if(_0x59d403['type']!==_0xb1a5('0x3c')){var _0x56eeda={};_0x56eeda[_0x59d403[_0xb1a5('0x25')]]={'$like':'%'+_0x59fa1f[_0xb1a5('0x2e')][_0xb1a5('0x3a')]+'%'};return _0x56eeda;}})});}_0xb2c454=_[_0xb1a5('0x3b')]({},_0xb2c454,_0x59fa1f[_0xb1a5('0x3d')]);var _0x2dd510={'where':_0xb2c454[_0xb1a5('0x38')]};return db[_0xb1a5('0x3e')][_0xb1a5('0x1b')](_0x2dd510)[_0xb1a5('0x21')](function(_0x2fe5e3){_0x17f7b9[_0xb1a5('0x1b')]=_0x2fe5e3;if(_0x59fa1f[_0xb1a5('0x2e')]['includeAll']){_0xb2c454[_0xb1a5('0x3f')]=[{'all':!![]}];}return db[_0xb1a5('0x3e')][_0xb1a5('0x40')](_0xb2c454);})[_0xb1a5('0x21')](function(_0x196316){_0x17f7b9[_0xb1a5('0x41')]=_0x196316;return _0x17f7b9;})[_0xb1a5('0x21')](respondWithFilteredResult(_0xb1c49d,_0xb2c454))['catch'](handleError(_0xb1c49d,null));};exports[_0xb1a5('0x42')]=function(_0x2bf51c,_0x251ecf){var _0x4c909e={'raw':![],'where':{'id':_0x2bf51c[_0xb1a5('0x43')]['id']}},_0x34a295={};_0x34a295[_0xb1a5('0x2d')]=_[_0xb1a5('0x2f')](db['DeskAccount'][_0xb1a5('0x29')]);_0x34a295[_0xb1a5('0x2e')]=_[_0xb1a5('0x2f')](_0x2bf51c['query']);_0x34a295['filters']=_[_0xb1a5('0x31')](_0x34a295['model'],_0x34a295['query']);_0x4c909e[_0xb1a5('0x32')]=_[_0xb1a5('0x31')](_0x34a295[_0xb1a5('0x2d')],qs[_0xb1a5('0x44')](_0x2bf51c[_0xb1a5('0x2e')][_0xb1a5('0x44')]));_0x4c909e['attributes']=_0x4c909e[_0xb1a5('0x32')][_0xb1a5('0x33')]?_0x4c909e[_0xb1a5('0x32')]:_0x34a295[_0xb1a5('0x2d')];if(_0x2bf51c[_0xb1a5('0x2e')][_0xb1a5('0x45')]){_0x4c909e[_0xb1a5('0x3f')]=[{'all':!![]}];}_0x4c909e=_['merge']({},_0x4c909e,_0x2bf51c[_0xb1a5('0x3d')]);return db[_0xb1a5('0x3e')][_0xb1a5('0x46')](_0x4c909e)['then'](handleEntityNotFound(_0x251ecf,null))[_0xb1a5('0x21')](respondWithResult(_0x251ecf,null))[_0xb1a5('0x47')](handleError(_0x251ecf,null));};exports[_0xb1a5('0x48')]=function(_0x1b9fcd,_0x2f37dd){return db[_0xb1a5('0x3e')][_0xb1a5('0x48')](_0x1b9fcd[_0xb1a5('0x49')],{})[_0xb1a5('0x21')](respondWithResult(_0x2f37dd,0xc9))['catch'](handleError(_0x2f37dd,null));};exports[_0xb1a5('0x20')]=function(_0x1d0b1e,_0x420f49){if(_0x1d0b1e[_0xb1a5('0x49')]['id']){delete _0x1d0b1e[_0xb1a5('0x49')]['id'];}return db[_0xb1a5('0x3e')]['find']({'where':{'id':_0x1d0b1e['params']['id']}})[_0xb1a5('0x21')](handleEntityNotFound(_0x420f49,null))[_0xb1a5('0x21')](saveUpdates(_0x1d0b1e[_0xb1a5('0x49')],null))[_0xb1a5('0x21')](respondWithResult(_0x420f49,null))[_0xb1a5('0x47')](handleError(_0x420f49,null));};exports[_0xb1a5('0x22')]=function(_0x505d06,_0x1b2c5e){return db['DeskAccount'][_0xb1a5('0x46')]({'where':{'id':_0x505d06[_0xb1a5('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b2c5e,null))['then'](removeEntity(_0x1b2c5e,null))[_0xb1a5('0x47')](handleError(_0x1b2c5e,null));};exports['getConfigurations']=function(_0x472772,_0x55129e,_0x28e2ff){var _0x2541e1={};var _0x238ea1={};var _0x3721d3;var _0x560feb;return db['DeskAccount'][_0xb1a5('0x4a')]({'where':{'id':_0x472772[_0xb1a5('0x43')]['id']}})['then'](handleEntityNotFound(_0x55129e,null))[_0xb1a5('0x21')](function(_0x4857e5){if(_0x4857e5){_0x3721d3=_0x4857e5;_0x238ea1[_0xb1a5('0x2d')]=_[_0xb1a5('0x2f')](db[_0xb1a5('0x4b')][_0xb1a5('0x29')]);_0x238ea1['query']=_[_0xb1a5('0x2f')](_0x472772['query']);_0x238ea1[_0xb1a5('0x30')]=_['intersection'](_0x238ea1['model'],_0x238ea1[_0xb1a5('0x2e')]);_0x2541e1[_0xb1a5('0x32')]=_[_0xb1a5('0x31')](_0x238ea1[_0xb1a5('0x2d')],qs[_0xb1a5('0x44')](_0x472772['query'][_0xb1a5('0x44')]));_0x2541e1[_0xb1a5('0x32')]=_0x2541e1[_0xb1a5('0x32')][_0xb1a5('0x33')]?_0x2541e1[_0xb1a5('0x32')]:_0x238ea1[_0xb1a5('0x2d')];_0x2541e1[_0xb1a5('0x36')]=qs[_0xb1a5('0x37')](_0x472772[_0xb1a5('0x2e')][_0xb1a5('0x37')]);_0x2541e1[_0xb1a5('0x38')]=qs[_0xb1a5('0x30')](_[_0xb1a5('0x39')](_0x472772[_0xb1a5('0x2e')],_0x238ea1[_0xb1a5('0x30')]));if(_0x472772[_0xb1a5('0x2e')][_0xb1a5('0x3a')]){_0x2541e1[_0xb1a5('0x38')]=_[_0xb1a5('0x3b')](_0x2541e1[_0xb1a5('0x38')],{'$or':_[_0xb1a5('0x28')](_0x2541e1[_0xb1a5('0x32')],function(_0x1e0431){var _0x12d39e={};_0x12d39e[_0x1e0431]={'$like':'%'+_0x472772[_0xb1a5('0x2e')][_0xb1a5('0x3a')]+'%'};return _0x12d39e;})});}_0x2541e1=_['merge']({},_0x2541e1,_0x472772[_0xb1a5('0x3d')]);return _0x3721d3[_0xb1a5('0x4c')](_0x2541e1);}})['then'](function(_0x4b7ebe){if(_0x4b7ebe){_0x560feb=_0x4b7ebe[_0xb1a5('0x33')];if(!_0x472772[_0xb1a5('0x2e')][_0xb1a5('0x34')](_0xb1a5('0x35'))){_0x2541e1[_0xb1a5('0x1a')]=qs['limit'](_0x472772['query'][_0xb1a5('0x1a')]);_0x2541e1[_0xb1a5('0x18')]=qs[_0xb1a5('0x18')](_0x472772[_0xb1a5('0x2e')][_0xb1a5('0x18')]);}return _0x3721d3['getConfigurations'](_0x2541e1);}})[_0xb1a5('0x21')](function(_0x19bc1){if(_0x19bc1){return _0x19bc1?{'count':_0x560feb,'rows':_0x19bc1}:null;}})['then'](respondWithResult(_0x55129e,null))[_0xb1a5('0x47')](handleError(_0x55129e,null));};exports[_0xb1a5('0x4d')]=function(_0x185c0c,_0x5cf7dc,_0x575250){if(_0x185c0c[_0xb1a5('0x49')]['id']){delete _0x185c0c['body']['id'];}return db[_0xb1a5('0x3e')][_0xb1a5('0x4a')]({'where':{'id':_0x185c0c[_0xb1a5('0x43')]['id']}})[_0xb1a5('0x21')](handleEntityNotFound(_0x5cf7dc,null))[_0xb1a5('0x21')](function(_0x2ba8bd){if(_0x2ba8bd){_0x185c0c[_0xb1a5('0x49')]['AccountId']=_0x2ba8bd['id'];_0x185c0c['body'][_0xb1a5('0x4e')]=integrations['getSubjects'](_0x185c0c[_0xb1a5('0x49')]['channel'],_0x185c0c[_0xb1a5('0x49')]['type']);_0x185c0c['body'][_0xb1a5('0x4f')]=integrations['getDescriptions'](_0x185c0c[_0xb1a5('0x49')][_0xb1a5('0x50')],_0x185c0c['body'][_0xb1a5('0x2b')]);return db[_0xb1a5('0x4b')][_0xb1a5('0x48')](_0x185c0c[_0xb1a5('0x49')],{'include':[{'model':db[_0xb1a5('0x51')],'as':_0xb1a5('0x4e')},{'model':db[_0xb1a5('0x51')],'as':_0xb1a5('0x4f')}]});}return null;})[_0xb1a5('0x21')](respondWithResult(_0x5cf7dc,null))['catch'](handleError(_0x5cf7dc,null));};exports[_0xb1a5('0x52')]=function(_0x35e985,_0x2c2207,_0x2e269b){var _0x9783bc=[{'name':'priority','label':_0xb1a5('0x53'),'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 _0x3d2c19='';return db['DeskAccount'][_0xb1a5('0x4a')]({'where':{'id':_0x35e985[_0xb1a5('0x43')]['id']},'attributes':['id',_0xb1a5('0x54'),_0xb1a5('0x55'),_0xb1a5('0x56'),_0xb1a5('0x57'),_0xb1a5('0x58'),'consumerSecret','token','tokenSecret']})[_0xb1a5('0x21')](handleEntityNotFound(_0x2c2207,null))[_0xb1a5('0x21')](function(_0x250c7c){if(_0x250c7c){_0x3d2c19=_0x250c7c[_0xb1a5('0x54')];var _0xcc709=_0x3d2c19[_0xb1a5('0x59')](-0x1);if(_0xcc709==='/'){_0x3d2c19=_0x3d2c19[_0xb1a5('0x5a')](0x0,_0x3d2c19[_0xb1a5('0x5b')](_0xcc709));}var _0x54a89b={'method':_0xb1a5('0x5c'),'uri':util[_0xb1a5('0x5d')]('%s/custom_fields',_0x3d2c19),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x250c7c[_0xb1a5('0x55')]===_0xb1a5('0x5e')){_0x54a89b[_0xb1a5('0x5f')][_0xb1a5('0x60')]=util['format']('Basic\x20%s',new Buffer(util[_0xb1a5('0x5d')]('%s:%s',_0x250c7c[_0xb1a5('0x56')],_0x250c7c[_0xb1a5('0x57')]))['toString'](_0xb1a5('0x61')));}return rp(_0x54a89b)['then'](function(_0x5eeb14){return _0x9783bc['concat'](_['map'](_0x5eeb14[_0xb1a5('0x62')][_0xb1a5('0x63')],function(_0x29fc42){return{'id':_0x29fc42[_0xb1a5('0x25')],'name':_0x29fc42[_0xb1a5('0x25')],'type':_0x29fc42[_0xb1a5('0x2b')],'active':_0x29fc42[_0xb1a5('0x64')],'label':_0x29fc42[_0xb1a5('0x65')],'custom':!![]};}));});}})['then'](function(_0x1a1d7e){return{'count':_0x1a1d7e[_0xb1a5('0x33')],'rows':_0x1a1d7e};})[_0xb1a5('0x21')](respondWithResult(_0x2c2207,null))[_0xb1a5('0x47')](function(_0x431c5d){var _0x47a1e4=_0x35e985[_0xb1a5('0x2e')][_0xb1a5('0x66')]?0x1f4:_0x431c5d[_0xb1a5('0x67')]||0x1f4;logger[_0xb1a5('0x23')](_0xb1a5('0x68'),_0xb1a5('0x52'),_0x47a1e4,JSON['stringify'](_0x431c5d));delete _0x431c5d[_0xb1a5('0x25')];if(_0x47a1e4===0x191){_0x47a1e4=0x190;}_0x2c2207[_0xb1a5('0x16')](_0x47a1e4)[_0xb1a5('0x26')](_0x35e985[_0xb1a5('0x2e')][_0xb1a5('0x66')]?{'message':_0xb1a5('0x69'),'statusCode':_0x431c5d[_0xb1a5('0x67')]}:_0x431c5d);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ad1202b..7375a0f 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 _0x66f8=['int_desk_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x32da28,_0x4b085c){var _0x36f805=function(_0x2cf598){while(--_0x2cf598){_0x32da28['push'](_0x32da28['shift']());}};_0x36f805(++_0x4b085c);}(_0x66f8,0xe5));var _0x866f=function(_0x5ee0b9,_0xa1cf4d){_0x5ee0b9=_0x5ee0b9-0x0;var _0x97037a=_0x66f8[_0x5ee0b9];return _0x97037a;};'use strict';var _=require(_0x866f('0x0'));var util=require(_0x866f('0x1'));var logger=require(_0x866f('0x2'))('api');var moment=require(_0x866f('0x3'));var BPromise=require('bluebird');var rp=require(_0x866f('0x4'));var fs=require('fs');var path=require(_0x866f('0x5'));var rimraf=require(_0x866f('0x6'));var config=require(_0x866f('0x7'));var attributes=require(_0x866f('0x8'));var integrations=require(_0x866f('0x9'));module['exports']=function(_0x3c1d40,_0x309973){return _0x3c1d40[_0x866f('0xa')]('DeskAccount',attributes,{'tableName':_0x866f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6244=['./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e8897,_0x299e79){var _0x271b50=function(_0x74267a){while(--_0x74267a){_0x5e8897['push'](_0x5e8897['shift']());}};_0x271b50(++_0x299e79);}(_0x6244,0x178));var _0x4624=function(_0x5b46eb,_0x91cd40){_0x5b46eb=_0x5b46eb-0x0;var _0x38d569=_0x6244[_0x5b46eb];return _0x38d569;};'use strict';var _=require('lodash');var util=require(_0x4624('0x0'));var logger=require(_0x4624('0x1'))(_0x4624('0x2'));var moment=require('moment');var BPromise=require(_0x4624('0x3'));var rp=require(_0x4624('0x4'));var fs=require('fs');var path=require(_0x4624('0x5'));var rimraf=require(_0x4624('0x6'));var config=require(_0x4624('0x7'));var attributes=require(_0x4624('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5ec871,_0x1886d9){return _0x5ec871[_0x4624('0x9')](_0x4624('0xa'),attributes,{'tableName':_0x4624('0xb'),'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 030b953..198121b 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 _0x307a=['limit','include','model','attributes','GetDeskAccount','ShowDeskAccount','find','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','DeskAccount','findAll','options','raw','where'];(function(_0x4c7c25,_0x1e16a8){var _0x297619=function(_0x453f76){while(--_0x453f76){_0x4c7c25['push'](_0x4c7c25['shift']());}};_0x297619(++_0x1e16a8);}(_0x307a,0x189));var _0xa307=function(_0x2afe16,_0x29a39c){_0x2afe16=_0x2afe16-0x0;var _0x649df=_0x307a[_0x2afe16];return _0x649df;};'use strict';var _=require(_0xa307('0x0'));var util=require(_0xa307('0x1'));var moment=require(_0xa307('0x2'));var BPromise=require('bluebird');var rs=require(_0xa307('0x3'));var fs=require('fs');var Redis=require(_0xa307('0x4'));var db=require(_0xa307('0x5'))['db'];var utils=require(_0xa307('0x6'));var logger=require(_0xa307('0x7'))(_0xa307('0x8'));var config=require('../../config/environment');var jayson=require(_0xa307('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30b798,_0x29ed30,_0xcc2a26){return new BPromise(function(_0x23cce2,_0x3921f7){return client[_0xa307('0xa')](_0x30b798,_0xcc2a26)[_0xa307('0xb')](function(_0x3bd5e4){logger['info'](_0xa307('0xc'),_0x29ed30,_0xa307('0xd'));logger[_0xa307('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x29ed30,'request\x20sent',JSON[_0xa307('0xf')](_0x3bd5e4));if(_0x3bd5e4[_0xa307('0x10')]){if(_0x3bd5e4[_0xa307('0x10')][_0xa307('0x11')]===0x1f4){logger[_0xa307('0x10')](_0xa307('0xc'),_0x29ed30,_0x3bd5e4['error'][_0xa307('0x12')]);return _0x3921f7(_0x3bd5e4[_0xa307('0x10')][_0xa307('0x12')]);}logger[_0xa307('0x10')](_0xa307('0xc'),_0x29ed30,_0x3bd5e4[_0xa307('0x10')][_0xa307('0x12')]);return _0x23cce2(_0x3bd5e4['error']['message']);}else{logger[_0xa307('0x13')]('DeskAccount,\x20%s,\x20%s',_0x29ed30,_0xa307('0xd'));_0x23cce2(_0x3bd5e4[_0xa307('0x14')]['message']);}})[_0xa307('0x15')](function(_0x3d8e38){logger['error'](_0xa307('0xc'),_0x29ed30,_0x3d8e38);_0x3921f7(_0x3d8e38);});});}exports['GetDeskAccount']=function(_0x53ff37){var _0x336b39=this;return new Promise(function(_0x12b0c9,_0x35b738){return db[_0xa307('0x16')][_0xa307('0x17')]({'raw':_0x53ff37[_0xa307('0x18')]?_0x53ff37[_0xa307('0x18')][_0xa307('0x19')]===undefined?!![]:![]:!![],'where':_0x53ff37[_0xa307('0x18')]?_0x53ff37[_0xa307('0x18')][_0xa307('0x1a')]||null:null,'attributes':_0x53ff37[_0xa307('0x18')]?_0x53ff37[_0xa307('0x18')]['attributes']||null:null,'limit':_0x53ff37[_0xa307('0x18')]?_0x53ff37['options'][_0xa307('0x1b')]||null:null,'include':_0x53ff37[_0xa307('0x18')]?_0x53ff37['options'][_0xa307('0x1c')]?_['map'](_0x53ff37['options']['include'],function(_0x499443){return{'model':db[_0x499443[_0xa307('0x1d')]],'as':_0x499443['as'],'attributes':_0x499443[_0xa307('0x1e')],'include':_0x499443[_0xa307('0x1c')]?_['map'](_0x499443[_0xa307('0x1c')],function(_0x1abde4){return{'model':db[_0x1abde4[_0xa307('0x1d')]],'as':_0x1abde4['as'],'attributes':_0x1abde4[_0xa307('0x1e')],'include':_0x1abde4[_0xa307('0x1c')]?_['map'](_0x1abde4[_0xa307('0x1c')],function(_0x1b0500){return{'model':db[_0x1b0500[_0xa307('0x1d')]],'as':_0x1b0500['as'],'attributes':_0x1b0500[_0xa307('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa307('0xb')](function(_0xe626ca){logger[_0xa307('0x13')](_0xa307('0x1f'),_0x53ff37);logger[_0xa307('0xe')](_0xa307('0x1f'),_0x53ff37,JSON[_0xa307('0xf')](_0xe626ca));_0x12b0c9(_0xe626ca);})['catch'](function(_0x5a0875){logger[_0xa307('0x10')](_0xa307('0x1f'),_0x5a0875['message'],_0x53ff37);_0x35b738(_0x336b39[_0xa307('0x10')](0x1f4,_0x5a0875['message']));});});};exports[_0xa307('0x20')]=function(_0x9a61dc){var _0x4e27f0=this;return new Promise(function(_0x46d2fa,_0x5d164c){return db['DeskAccount'][_0xa307('0x21')]({'raw':_0x9a61dc[_0xa307('0x18')]?_0x9a61dc[_0xa307('0x18')][_0xa307('0x19')]===undefined?!![]:![]:!![],'where':_0x9a61dc[_0xa307('0x18')]?_0x9a61dc[_0xa307('0x18')]['where']||null:null,'attributes':_0x9a61dc[_0xa307('0x18')]?_0x9a61dc[_0xa307('0x18')][_0xa307('0x1e')]||null:null,'include':_0x9a61dc[_0xa307('0x18')]?_0x9a61dc[_0xa307('0x18')][_0xa307('0x1c')]?_[_0xa307('0x22')](_0x9a61dc[_0xa307('0x18')][_0xa307('0x1c')],function(_0x3f78b4){return{'model':db[_0x3f78b4[_0xa307('0x1d')]],'as':_0x3f78b4['as'],'attributes':_0x3f78b4[_0xa307('0x1e')],'include':_0x3f78b4[_0xa307('0x1c')]?_[_0xa307('0x22')](_0x3f78b4[_0xa307('0x1c')],function(_0x5e46e9){return{'model':db[_0x5e46e9[_0xa307('0x1d')]],'as':_0x5e46e9['as'],'attributes':_0x5e46e9['attributes'],'include':_0x5e46e9['include']?_['map'](_0x5e46e9[_0xa307('0x1c')],function(_0x9e9fc4){return{'model':db[_0x9e9fc4[_0xa307('0x1d')]],'as':_0x9e9fc4['as'],'attributes':_0x9e9fc4[_0xa307('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa307('0xb')](function(_0x3312d6){logger['info']('ShowDeskAccount',_0x9a61dc);logger['debug'](_0xa307('0x20'),_0x9a61dc,JSON[_0xa307('0xf')](_0x3312d6));_0x46d2fa(_0x3312d6);})[_0xa307('0x15')](function(_0x1eb45a){logger[_0xa307('0x10')](_0xa307('0x20'),_0x1eb45a[_0xa307('0x12')],_0x9a61dc);_0x5d164c(_0x4e27f0['error'](0x1f4,_0x1eb45a[_0xa307('0x12')]));});});}; \ No newline at end of file +var _0xb641=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','options','raw','where','include','map','model','attributes','GetDeskAccount','ShowDeskAccount','find','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x2145cd,_0x268cce){var _0x5a8c46=function(_0x37e1fb){while(--_0x37e1fb){_0x2145cd['push'](_0x2145cd['shift']());}};_0x5a8c46(++_0x268cce);}(_0xb641,0x1c2));var _0x1b64=function(_0x46ea74,_0x4d17f2){_0x46ea74=_0x46ea74-0x0;var _0x1f183b=_0xb641[_0x46ea74];return _0x1f183b;};'use strict';var _=require('lodash');var util=require(_0x1b64('0x0'));var moment=require(_0x1b64('0x1'));var BPromise=require(_0x1b64('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b64('0x3'))['db'];var utils=require(_0x1b64('0x4'));var logger=require(_0x1b64('0x5'))(_0x1b64('0x6'));var config=require(_0x1b64('0x7'));var jayson=require(_0x1b64('0x8'));var client=jayson['client'][_0x1b64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x73e71a,_0x2a3819,_0x441446){return new BPromise(function(_0x20d8df,_0x500ea9){return client['request'](_0x73e71a,_0x441446)[_0x1b64('0xa')](function(_0x16de0e){logger[_0x1b64('0xb')]('DeskAccount,\x20%s,\x20%s',_0x2a3819,_0x1b64('0xc'));logger[_0x1b64('0xd')](_0x1b64('0xe'),_0x2a3819,_0x1b64('0xc'),JSON[_0x1b64('0xf')](_0x16de0e));if(_0x16de0e[_0x1b64('0x10')]){if(_0x16de0e[_0x1b64('0x10')][_0x1b64('0x11')]===0x1f4){logger[_0x1b64('0x10')](_0x1b64('0x12'),_0x2a3819,_0x16de0e[_0x1b64('0x10')][_0x1b64('0x13')]);return _0x500ea9(_0x16de0e[_0x1b64('0x10')][_0x1b64('0x13')]);}logger['error'](_0x1b64('0x12'),_0x2a3819,_0x16de0e[_0x1b64('0x10')][_0x1b64('0x13')]);return _0x20d8df(_0x16de0e[_0x1b64('0x10')]['message']);}else{logger[_0x1b64('0xb')]('DeskAccount,\x20%s,\x20%s',_0x2a3819,_0x1b64('0xc'));_0x20d8df(_0x16de0e[_0x1b64('0x14')][_0x1b64('0x13')]);}})[_0x1b64('0x15')](function(_0x4aa6d1){logger['error'](_0x1b64('0x12'),_0x2a3819,_0x4aa6d1);_0x500ea9(_0x4aa6d1);});});}exports['GetDeskAccount']=function(_0x2bf135){var _0x5e0d98=this;return new Promise(function(_0x5e88f0,_0x1e7a6b){return db[_0x1b64('0x16')]['findAll']({'raw':_0x2bf135[_0x1b64('0x17')]?_0x2bf135['options'][_0x1b64('0x18')]===undefined?!![]:![]:!![],'where':_0x2bf135[_0x1b64('0x17')]?_0x2bf135[_0x1b64('0x17')][_0x1b64('0x19')]||null:null,'attributes':_0x2bf135[_0x1b64('0x17')]?_0x2bf135['options']['attributes']||null:null,'limit':_0x2bf135[_0x1b64('0x17')]?_0x2bf135['options']['limit']||null:null,'include':_0x2bf135[_0x1b64('0x17')]?_0x2bf135[_0x1b64('0x17')][_0x1b64('0x1a')]?_[_0x1b64('0x1b')](_0x2bf135['options']['include'],function(_0x30b17c){return{'model':db[_0x30b17c[_0x1b64('0x1c')]],'as':_0x30b17c['as'],'attributes':_0x30b17c[_0x1b64('0x1d')],'include':_0x30b17c['include']?_[_0x1b64('0x1b')](_0x30b17c[_0x1b64('0x1a')],function(_0x30ddfe){return{'model':db[_0x30ddfe['model']],'as':_0x30ddfe['as'],'attributes':_0x30ddfe[_0x1b64('0x1d')],'include':_0x30ddfe[_0x1b64('0x1a')]?_[_0x1b64('0x1b')](_0x30ddfe[_0x1b64('0x1a')],function(_0x4fbf6c){return{'model':db[_0x4fbf6c[_0x1b64('0x1c')]],'as':_0x4fbf6c['as'],'attributes':_0x4fbf6c[_0x1b64('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1b64('0xa')](function(_0x2c7726){logger[_0x1b64('0xb')](_0x1b64('0x1e'),_0x2bf135);logger['debug'](_0x1b64('0x1e'),_0x2bf135,JSON[_0x1b64('0xf')](_0x2c7726));_0x5e88f0(_0x2c7726);})[_0x1b64('0x15')](function(_0x1670a1){logger['error']('GetDeskAccount',_0x1670a1[_0x1b64('0x13')],_0x2bf135);_0x1e7a6b(_0x5e0d98['error'](0x1f4,_0x1670a1['message']));});});};exports[_0x1b64('0x1f')]=function(_0x4d0901){var _0x591f6d=this;return new Promise(function(_0xbf4f3c,_0x17b66d){return db[_0x1b64('0x16')][_0x1b64('0x20')]({'raw':_0x4d0901[_0x1b64('0x17')]?_0x4d0901[_0x1b64('0x17')][_0x1b64('0x18')]===undefined?!![]:![]:!![],'where':_0x4d0901['options']?_0x4d0901[_0x1b64('0x17')][_0x1b64('0x19')]||null:null,'attributes':_0x4d0901[_0x1b64('0x17')]?_0x4d0901['options']['attributes']||null:null,'include':_0x4d0901[_0x1b64('0x17')]?_0x4d0901[_0x1b64('0x17')]['include']?_[_0x1b64('0x1b')](_0x4d0901['options']['include'],function(_0x54b9fe){return{'model':db[_0x54b9fe[_0x1b64('0x1c')]],'as':_0x54b9fe['as'],'attributes':_0x54b9fe['attributes'],'include':_0x54b9fe[_0x1b64('0x1a')]?_[_0x1b64('0x1b')](_0x54b9fe['include'],function(_0x2132ea){return{'model':db[_0x2132ea['model']],'as':_0x2132ea['as'],'attributes':_0x2132ea[_0x1b64('0x1d')],'include':_0x2132ea['include']?_[_0x1b64('0x1b')](_0x2132ea[_0x1b64('0x1a')],function(_0x16c483){return{'model':db[_0x16c483[_0x1b64('0x1c')]],'as':_0x16c483['as'],'attributes':_0x16c483[_0x1b64('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1b64('0xa')](function(_0x248d7e){logger[_0x1b64('0xb')](_0x1b64('0x1f'),_0x4d0901);logger['debug'](_0x1b64('0x1f'),_0x4d0901,JSON[_0x1b64('0xf')](_0x248d7e));_0xbf4f3c(_0x248d7e);})['catch'](function(_0x3e8560){logger[_0x1b64('0x10')]('ShowDeskAccount',_0x3e8560['message'],_0x4d0901);_0x17b66d(_0x591f6d['error'](0x1f4,_0x3e8560['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index d049e68..7815c0b 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(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x55ca,0x126));var _0xa55c=function(_0x114c1c,_0x5bfd6d){_0x114c1c=_0x114c1c-0x0;var _0x50a0a6=_0x55ca[_0x114c1c];return _0x50a0a6;};'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(_0x1c0ff8,_0x5373d2){var _0x495160=function(_0xa40d0f){while(--_0xa40d0f){_0x1c0ff8['push'](_0x1c0ff8['shift']());}};_0x495160(++_0x5373d2);}(_0x008c,0x188));var _0xc008=function(_0x4b5075,_0xee1fb9){_0x4b5075=_0x4b5075-0x0;var _0x234617=_0x008c[_0x4b5075];return _0x234617;};'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 f1084d2..d67ec5e 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 _0x11e7=['STRING','sequelize','exports'];(function(_0x5676e6,_0x3af67d){var _0x4401a2=function(_0x436998){while(--_0x436998){_0x5676e6['push'](_0x5676e6['shift']());}};_0x4401a2(++_0x3af67d);}(_0x11e7,0x1ba));var _0x711e=function(_0x694277,_0x2e03a3){_0x694277=_0x694277-0x0;var _0x1e2511=_0x11e7[_0x694277];return _0x1e2511;};'use strict';var Sequelize=require(_0x711e('0x0'));module[_0x711e('0x1')]={'name':{'type':Sequelize[_0x711e('0x2')]},'description':{'type':Sequelize[_0x711e('0x2')]}}; \ No newline at end of file +var _0xe8ac=['exports','STRING'];(function(_0x439142,_0x38cda0){var _0x3de8a7=function(_0x28bd2a){while(--_0x28bd2a){_0x439142['push'](_0x439142['shift']());}};_0x3de8a7(++_0x38cda0);}(_0xe8ac,0xde));var _0xce8a=function(_0x3ab7ad,_0x2c22ea){_0x3ab7ad=_0x3ab7ad-0x0;var _0x40200e=_0xe8ac[_0x3ab7ad];return _0x40200e;};'use strict';var Sequelize=require('sequelize');module[_0xce8a('0x0')]={'name':{'type':Sequelize[_0xce8a('0x1')]},'description':{'type':Sequelize[_0xce8a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 7a838e0..1d63f59 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 _0x9de1=['ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','create','body','getFields','findOne','DeskField','merge','getSubjects','getDescriptions','pick','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x42eac1,_0x1b6bbb){var _0xedcf1c=function(_0x3d69f6){while(--_0x3d69f6){_0x42eac1['push'](_0x42eac1['shift']());}};_0xedcf1c(++_0x1b6bbb);}(_0x9de1,0x14a));var _0x19de=function(_0x2076ad,_0x14468a){_0x2076ad=_0x2076ad-0x0;var _0x23d332=_0x9de1[_0x2076ad];return _0x23d332;};'use strict';var emlformat=require(_0x19de('0x0'));var rimraf=require(_0x19de('0x1'));var zipdir=require(_0x19de('0x2'));var jsonpatch=require(_0x19de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x19de('0x4'));var Mustache=require(_0x19de('0x5'));var util=require(_0x19de('0x6'));var path=require(_0x19de('0x7'));var sox=require(_0x19de('0x8'));var csv=require(_0x19de('0x9'));var ejs=require(_0x19de('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x19de('0xb'));var squel=require(_0x19de('0xc'));var crypto=require('crypto');var jsforce=require(_0x19de('0xd'));var deskjs=require(_0x19de('0xe'));var toCsv=require(_0x19de('0x9'));var querystring=require(_0x19de('0xf'));var Papa=require(_0x19de('0x10'));var Redis=require('ioredis');var authService=require(_0x19de('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19de('0x12'));var logger=require(_0x19de('0x13'))(_0x19de('0x14'));var utils=require(_0x19de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x19de('0x16'));var db=require(_0x19de('0x17'))['db'];function respondWithStatusCode(_0x28209e,_0x3501cc){_0x3501cc=_0x3501cc||0xcc;return function(_0x490fcf){if(_0x490fcf){return _0x28209e[_0x19de('0x18')](_0x3501cc);}return _0x28209e[_0x19de('0x19')](_0x3501cc)['end']();};}function respondWithResult(_0x390d12,_0x2f9926){_0x2f9926=_0x2f9926||0xc8;return function(_0x50b7ad){if(_0x50b7ad){return _0x390d12['status'](_0x2f9926)[_0x19de('0x1a')](_0x50b7ad);}};}function respondWithFilteredResult(_0xa329e3,_0xe6e93){return function(_0x3da9b5){if(_0x3da9b5){var _0x44d202=typeof _0xe6e93['offset']===_0x19de('0x1b')&&typeof _0xe6e93['limit']===_0x19de('0x1b');var _0x17be52=_0x3da9b5[_0x19de('0x1c')];var _0x5cba88=_0x44d202?0x0:_0xe6e93[_0x19de('0x1d')];var _0x85cf99=_0x44d202?_0x3da9b5[_0x19de('0x1c')]:_0xe6e93[_0x19de('0x1d')]+_0xe6e93[_0x19de('0x1e')];var _0x55b53e;if(_0x85cf99>=_0x17be52){_0x85cf99=_0x17be52;_0x55b53e=0xc8;}else{_0x55b53e=0xce;}_0xa329e3[_0x19de('0x19')](_0x55b53e);return _0xa329e3[_0x19de('0x1f')](_0x19de('0x20'),_0x5cba88+'-'+_0x85cf99+'/'+_0x17be52)['json'](_0x3da9b5);}return null;};}function patchUpdates(_0xd03af1){return function(_0x43edaf){try{jsonpatch[_0x19de('0x21')](_0x43edaf,_0xd03af1,!![]);}catch(_0x192609){return BPromise[_0x19de('0x22')](_0x192609);}return _0x43edaf[_0x19de('0x23')]();};}function saveUpdates(_0x534ac4,_0x16fe96){return function(_0x46a0bb){if(_0x46a0bb){return _0x46a0bb[_0x19de('0x24')](_0x534ac4)[_0x19de('0x25')](function(_0x48f952){return _0x48f952;});}return null;};}function removeEntity(_0x39d301,_0x154118){return function(_0x56b3f4){if(_0x56b3f4){return _0x56b3f4[_0x19de('0x26')]()[_0x19de('0x25')](function(){_0x39d301[_0x19de('0x19')](0xcc)[_0x19de('0x27')]();});}};}function handleEntityNotFound(_0x5e21b7,_0x20db84){return function(_0x13e758){if(!_0x13e758){_0x5e21b7['sendStatus'](0x194);}return _0x13e758;};}function handleError(_0x4341d9,_0x3fc583){_0x3fc583=_0x3fc583||0x1f4;return function(_0x175872){logger[_0x19de('0x28')](_0x175872[_0x19de('0x29')]);if(_0x175872['name']){delete _0x175872['name'];}_0x4341d9[_0x19de('0x19')](_0x3fc583)[_0x19de('0x2a')](_0x175872);};}exports[_0x19de('0x2b')]=function(_0x2fff0c,_0x26cfdf){var _0x564b4c={},_0x362604={},_0x579dd0={'count':0x0,'rows':[]};var _0x3dd5bf=_['map'](db[_0x19de('0x2c')][_0x19de('0x2d')],function(_0x9d60e7){return{'name':_0x9d60e7[_0x19de('0x2e')],'type':_0x9d60e7[_0x19de('0x2f')][_0x19de('0x30')]};});_0x362604[_0x19de('0x31')]=_[_0x19de('0x32')](_0x3dd5bf,_0x19de('0x33'));_0x362604[_0x19de('0x34')]=_[_0x19de('0x35')](_0x2fff0c['query']);_0x362604[_0x19de('0x36')]=_['intersection'](_0x362604[_0x19de('0x31')],_0x362604[_0x19de('0x34')]);_0x564b4c[_0x19de('0x37')]=_[_0x19de('0x38')](_0x362604['model'],qs['fields'](_0x2fff0c[_0x19de('0x34')]['fields']));_0x564b4c['attributes']=_0x564b4c[_0x19de('0x37')][_0x19de('0x39')]?_0x564b4c[_0x19de('0x37')]:_0x362604['model'];if(!_0x2fff0c[_0x19de('0x34')][_0x19de('0x3a')](_0x19de('0x3b'))){_0x564b4c[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x2fff0c[_0x19de('0x34')][_0x19de('0x1e')]);_0x564b4c['offset']=qs[_0x19de('0x1d')](_0x2fff0c['query'][_0x19de('0x1d')]);}_0x564b4c[_0x19de('0x3c')]=qs[_0x19de('0x3d')](_0x2fff0c[_0x19de('0x34')][_0x19de('0x3d')]);_0x564b4c[_0x19de('0x3e')]=qs[_0x19de('0x36')](_['pick'](_0x2fff0c[_0x19de('0x34')],_0x362604[_0x19de('0x36')]),_0x3dd5bf);if(_0x2fff0c[_0x19de('0x34')]['filter']){_0x564b4c[_0x19de('0x3e')]=_['merge'](_0x564b4c['where'],{'$or':_[_0x19de('0x32')](_0x3dd5bf,function(_0x20067c){if(_0x20067c[_0x19de('0x2f')]!==_0x19de('0x3f')){var _0x384a67={};_0x384a67[_0x20067c[_0x19de('0x33')]]={'$like':'%'+_0x2fff0c[_0x19de('0x34')][_0x19de('0x40')]+'%'};return _0x384a67;}})});}_0x564b4c=_['merge']({},_0x564b4c,_0x2fff0c[_0x19de('0x41')]);var _0x129b2b={'where':_0x564b4c['where']};return db['DeskConfiguration']['count'](_0x129b2b)[_0x19de('0x25')](function(_0x374943){_0x579dd0[_0x19de('0x1c')]=_0x374943;if(_0x2fff0c[_0x19de('0x34')][_0x19de('0x42')]){_0x564b4c[_0x19de('0x43')]=[{'all':!![]}];}return db[_0x19de('0x2c')]['findAll'](_0x564b4c);})['then'](function(_0x3b58d6){_0x579dd0[_0x19de('0x44')]=_0x3b58d6;return _0x579dd0;})[_0x19de('0x25')](respondWithFilteredResult(_0x26cfdf,_0x564b4c))[_0x19de('0x45')](handleError(_0x26cfdf,null));};exports[_0x19de('0x46')]=function(_0x810785,_0x36a5c3){var _0x37da4c={'raw':![],'where':{'id':_0x810785[_0x19de('0x47')]['id']}},_0x1fa2a5={};_0x1fa2a5[_0x19de('0x31')]=_[_0x19de('0x35')](db[_0x19de('0x2c')][_0x19de('0x2d')]);_0x1fa2a5['query']=_['keys'](_0x810785[_0x19de('0x34')]);_0x1fa2a5['filters']=_[_0x19de('0x38')](_0x1fa2a5[_0x19de('0x31')],_0x1fa2a5[_0x19de('0x34')]);_0x37da4c[_0x19de('0x37')]=_[_0x19de('0x38')](_0x1fa2a5[_0x19de('0x31')],qs['fields'](_0x810785[_0x19de('0x34')][_0x19de('0x48')]));_0x37da4c[_0x19de('0x37')]=_0x37da4c[_0x19de('0x37')]['length']?_0x37da4c[_0x19de('0x37')]:_0x1fa2a5[_0x19de('0x31')];if(_0x810785[_0x19de('0x34')][_0x19de('0x42')]){_0x37da4c[_0x19de('0x43')]=[{'all':!![]}];}_0x37da4c=_['merge']({},_0x37da4c,_0x810785[_0x19de('0x41')]);return db['DeskConfiguration'][_0x19de('0x49')](_0x37da4c)[_0x19de('0x25')](handleEntityNotFound(_0x36a5c3,null))[_0x19de('0x25')](respondWithResult(_0x36a5c3,null))['catch'](handleError(_0x36a5c3,null));};exports['create']=function(_0x48b4a6,_0x5ed921){return db[_0x19de('0x2c')][_0x19de('0x4a')](_0x48b4a6[_0x19de('0x4b')],{})['then'](respondWithResult(_0x5ed921,0xc9))['catch'](handleError(_0x5ed921,null));};exports[_0x19de('0x24')]=function(_0x24c7b1,_0xcc7d1d){if(_0x24c7b1[_0x19de('0x4b')]['id']){delete _0x24c7b1[_0x19de('0x4b')]['id'];}return db['DeskConfiguration'][_0x19de('0x49')]({'where':{'id':_0x24c7b1[_0x19de('0x47')]['id']}})[_0x19de('0x25')](handleEntityNotFound(_0xcc7d1d,null))[_0x19de('0x25')](saveUpdates(_0x24c7b1[_0x19de('0x4b')],null))[_0x19de('0x25')](respondWithResult(_0xcc7d1d,null))[_0x19de('0x45')](handleError(_0xcc7d1d,null));};exports[_0x19de('0x26')]=function(_0x315ffa,_0x27114d){return db[_0x19de('0x2c')]['find']({'where':{'id':_0x315ffa[_0x19de('0x47')]['id']}})['then'](handleEntityNotFound(_0x27114d,null))[_0x19de('0x25')](removeEntity(_0x27114d,null))[_0x19de('0x45')](handleError(_0x27114d,null));};exports[_0x19de('0x4c')]=function(_0x57427d,_0x916857,_0x1f6234){var _0x7440c1={};var _0x47ffed={};var _0x2ba66d;var _0x4a79e7;return db['DeskConfiguration'][_0x19de('0x4d')]({'where':{'id':_0x57427d[_0x19de('0x47')]['id']}})['then'](handleEntityNotFound(_0x916857,null))[_0x19de('0x25')](function(_0x37d2db){if(_0x37d2db){_0x2ba66d=_0x37d2db;_0x47ffed[_0x19de('0x31')]=_['keys'](db[_0x19de('0x4e')][_0x19de('0x2d')]);_0x47ffed[_0x19de('0x34')]=_[_0x19de('0x35')](_0x57427d[_0x19de('0x34')]);_0x47ffed[_0x19de('0x36')]=_['intersection'](_0x47ffed[_0x19de('0x31')],_0x47ffed[_0x19de('0x34')]);_0x7440c1[_0x19de('0x37')]=_[_0x19de('0x38')](_0x47ffed[_0x19de('0x31')],qs[_0x19de('0x48')](_0x57427d['query']['fields']));_0x7440c1['attributes']=_0x7440c1[_0x19de('0x37')][_0x19de('0x39')]?_0x7440c1[_0x19de('0x37')]:_0x47ffed[_0x19de('0x31')];_0x7440c1[_0x19de('0x3c')]=qs['sort'](_0x57427d[_0x19de('0x34')][_0x19de('0x3d')]);_0x7440c1[_0x19de('0x3e')]=qs['filters'](_['pick'](_0x57427d[_0x19de('0x34')],_0x47ffed[_0x19de('0x36')]));if(_0x57427d[_0x19de('0x34')][_0x19de('0x40')]){_0x7440c1[_0x19de('0x3e')]=_['merge'](_0x7440c1[_0x19de('0x3e')],{'$or':_[_0x19de('0x32')](_0x7440c1['attributes'],function(_0x190c2c){var _0x2ff56c={};_0x2ff56c[_0x190c2c]={'$like':'%'+_0x57427d['query'][_0x19de('0x40')]+'%'};return _0x2ff56c;})});}_0x7440c1=_[_0x19de('0x4f')]({},_0x7440c1,_0x57427d[_0x19de('0x41')]);return _0x2ba66d[_0x19de('0x4c')](_0x7440c1);}})['then'](function(_0x2711e1){if(_0x2711e1){_0x4a79e7=_0x2711e1[_0x19de('0x39')];if(!_0x57427d[_0x19de('0x34')]['hasOwnProperty'](_0x19de('0x3b'))){_0x7440c1[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x57427d['query']['limit']);_0x7440c1[_0x19de('0x1d')]=qs[_0x19de('0x1d')](_0x57427d[_0x19de('0x34')][_0x19de('0x1d')]);}return _0x2ba66d[_0x19de('0x4c')](_0x7440c1);}})[_0x19de('0x25')](function(_0x36019a){if(_0x36019a){return _0x36019a?{'count':_0x4a79e7,'rows':_0x36019a}:null;}})[_0x19de('0x25')](respondWithResult(_0x916857,null))[_0x19de('0x45')](handleError(_0x916857,null));};exports[_0x19de('0x50')]=function(_0x32e345,_0x586676,_0x22e24e){var _0x4ce5f6={};var _0xa65a80={};var _0x582d40;var _0x14a3e2;return db[_0x19de('0x2c')][_0x19de('0x4d')]({'where':{'id':_0x32e345['params']['id']}})[_0x19de('0x25')](handleEntityNotFound(_0x586676,null))[_0x19de('0x25')](function(_0x279de0){if(_0x279de0){_0x582d40=_0x279de0;_0xa65a80[_0x19de('0x31')]=_[_0x19de('0x35')](db[_0x19de('0x4e')][_0x19de('0x2d')]);_0xa65a80['query']=_[_0x19de('0x35')](_0x32e345[_0x19de('0x34')]);_0xa65a80[_0x19de('0x36')]=_[_0x19de('0x38')](_0xa65a80[_0x19de('0x31')],_0xa65a80[_0x19de('0x34')]);_0x4ce5f6['attributes']=_[_0x19de('0x38')](_0xa65a80[_0x19de('0x31')],qs[_0x19de('0x48')](_0x32e345[_0x19de('0x34')][_0x19de('0x48')]));_0x4ce5f6[_0x19de('0x37')]=_0x4ce5f6[_0x19de('0x37')]['length']?_0x4ce5f6[_0x19de('0x37')]:_0xa65a80[_0x19de('0x31')];_0x4ce5f6[_0x19de('0x3c')]=qs[_0x19de('0x3d')](_0x32e345[_0x19de('0x34')][_0x19de('0x3d')]);_0x4ce5f6[_0x19de('0x3e')]=qs['filters'](_['pick'](_0x32e345['query'],_0xa65a80['filters']));if(_0x32e345[_0x19de('0x34')][_0x19de('0x40')]){_0x4ce5f6[_0x19de('0x3e')]=_[_0x19de('0x4f')](_0x4ce5f6[_0x19de('0x3e')],{'$or':_[_0x19de('0x32')](_0x4ce5f6[_0x19de('0x37')],function(_0xe5131d){var _0x488fe5={};_0x488fe5[_0xe5131d]={'$like':'%'+_0x32e345[_0x19de('0x34')][_0x19de('0x40')]+'%'};return _0x488fe5;})});}_0x4ce5f6=_[_0x19de('0x4f')]({},_0x4ce5f6,_0x32e345[_0x19de('0x41')]);return _0x582d40[_0x19de('0x50')](_0x4ce5f6);}})[_0x19de('0x25')](function(_0x54eef0){if(_0x54eef0){_0x14a3e2=_0x54eef0[_0x19de('0x39')];if(!_0x32e345[_0x19de('0x34')][_0x19de('0x3a')](_0x19de('0x3b'))){_0x4ce5f6[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x32e345[_0x19de('0x34')][_0x19de('0x1e')]);_0x4ce5f6[_0x19de('0x1d')]=qs[_0x19de('0x1d')](_0x32e345[_0x19de('0x34')][_0x19de('0x1d')]);}return _0x582d40[_0x19de('0x50')](_0x4ce5f6);}})[_0x19de('0x25')](function(_0xad7e4e){if(_0xad7e4e){return _0xad7e4e?{'count':_0x14a3e2,'rows':_0xad7e4e}:null;}})['then'](respondWithResult(_0x586676,null))[_0x19de('0x45')](handleError(_0x586676,null));};exports[_0x19de('0x51')]=function(_0x4d27ab,_0x2ccd4a,_0x245425){var _0x114ff0={};var _0x3ce274={};var _0xcb4ac;var _0x469039;return db[_0x19de('0x2c')][_0x19de('0x4d')]({'where':{'id':_0x4d27ab[_0x19de('0x47')]['id']}})[_0x19de('0x25')](handleEntityNotFound(_0x2ccd4a,null))['then'](function(_0xf51999){if(_0xf51999){_0xcb4ac=_0xf51999;_0x3ce274['model']=_['keys'](db[_0x19de('0x4e')][_0x19de('0x2d')]);_0x3ce274[_0x19de('0x34')]=_[_0x19de('0x35')](_0x4d27ab[_0x19de('0x34')]);_0x3ce274['filters']=_[_0x19de('0x38')](_0x3ce274[_0x19de('0x31')],_0x3ce274[_0x19de('0x34')]);_0x114ff0[_0x19de('0x37')]=_['intersection'](_0x3ce274[_0x19de('0x31')],qs[_0x19de('0x48')](_0x4d27ab['query'][_0x19de('0x48')]));_0x114ff0[_0x19de('0x37')]=_0x114ff0[_0x19de('0x37')][_0x19de('0x39')]?_0x114ff0[_0x19de('0x37')]:_0x3ce274[_0x19de('0x31')];_0x114ff0[_0x19de('0x3c')]=qs[_0x19de('0x3d')](_0x4d27ab[_0x19de('0x34')][_0x19de('0x3d')]);_0x114ff0[_0x19de('0x3e')]=qs[_0x19de('0x36')](_[_0x19de('0x52')](_0x4d27ab[_0x19de('0x34')],_0x3ce274[_0x19de('0x36')]));if(_0x4d27ab[_0x19de('0x34')][_0x19de('0x40')]){_0x114ff0['where']=_[_0x19de('0x4f')](_0x114ff0['where'],{'$or':_['map'](_0x114ff0[_0x19de('0x37')],function(_0x4e03ca){var _0x25d6d7={};_0x25d6d7[_0x4e03ca]={'$like':'%'+_0x4d27ab[_0x19de('0x34')]['filter']+'%'};return _0x25d6d7;})});}_0x114ff0=_[_0x19de('0x4f')]({},_0x114ff0,_0x4d27ab[_0x19de('0x41')]);return _0xcb4ac[_0x19de('0x51')](_0x114ff0);}})['then'](function(_0x3f7bae){if(_0x3f7bae){_0x469039=_0x3f7bae[_0x19de('0x39')];if(!_0x4d27ab[_0x19de('0x34')][_0x19de('0x3a')](_0x19de('0x3b'))){_0x114ff0[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x4d27ab['query'][_0x19de('0x1e')]);_0x114ff0[_0x19de('0x1d')]=qs['offset'](_0x4d27ab[_0x19de('0x34')]['offset']);}return _0xcb4ac[_0x19de('0x51')](_0x114ff0);}})['then'](function(_0x23ac1a){if(_0x23ac1a){return _0x23ac1a?{'count':_0x469039,'rows':_0x23ac1a}:null;}})[_0x19de('0x25')](respondWithResult(_0x2ccd4a,null))[_0x19de('0x45')](handleError(_0x2ccd4a,null));};exports[_0x19de('0x53')]=function(_0x242130,_0x193c6d,_0x3d628e){var _0x2ed2b3={};var _0xe82096={};var _0x3c9bfb;var _0x324694;return db['DeskConfiguration']['findOne']({'where':{'id':_0x242130[_0x19de('0x47')]['id']}})[_0x19de('0x25')](handleEntityNotFound(_0x193c6d,null))[_0x19de('0x25')](function(_0x128e87){if(_0x128e87){_0x3c9bfb=_0x128e87;_0xe82096[_0x19de('0x31')]=_[_0x19de('0x35')](db['Tag']['rawAttributes']);_0xe82096[_0x19de('0x34')]=_['keys'](_0x242130[_0x19de('0x34')]);_0xe82096[_0x19de('0x36')]=_[_0x19de('0x38')](_0xe82096[_0x19de('0x31')],_0xe82096['query']);_0x2ed2b3[_0x19de('0x37')]=_[_0x19de('0x38')](_0xe82096['model'],qs[_0x19de('0x48')](_0x242130['query'][_0x19de('0x48')]));_0x2ed2b3['attributes']=_0x2ed2b3[_0x19de('0x37')][_0x19de('0x39')]?_0x2ed2b3[_0x19de('0x37')]:_0xe82096[_0x19de('0x31')];_0x2ed2b3[_0x19de('0x3c')]=qs[_0x19de('0x3d')](_0x242130['query'][_0x19de('0x3d')]);_0x2ed2b3[_0x19de('0x3e')]=qs[_0x19de('0x36')](_[_0x19de('0x52')](_0x242130[_0x19de('0x34')],_0xe82096[_0x19de('0x36')]));if(_0x242130[_0x19de('0x34')][_0x19de('0x40')]){_0x2ed2b3[_0x19de('0x3e')]=_[_0x19de('0x4f')](_0x2ed2b3[_0x19de('0x3e')],{'$or':_['map'](_0x2ed2b3[_0x19de('0x37')],function(_0x2ce82e){var _0x4de396={};_0x4de396[_0x2ce82e]={'$like':'%'+_0x242130['query'][_0x19de('0x40')]+'%'};return _0x4de396;})});}_0x2ed2b3=_[_0x19de('0x4f')]({},_0x2ed2b3,_0x242130[_0x19de('0x41')]);return _0x3c9bfb[_0x19de('0x53')](_0x2ed2b3);}})['then'](function(_0x5f41bf){if(_0x5f41bf){_0x324694=_0x5f41bf[_0x19de('0x39')];if(!_0x242130[_0x19de('0x34')][_0x19de('0x3a')](_0x19de('0x3b'))){_0x2ed2b3[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x242130[_0x19de('0x34')][_0x19de('0x1e')]);_0x2ed2b3[_0x19de('0x1d')]=qs[_0x19de('0x1d')](_0x242130['query'][_0x19de('0x1d')]);}return _0x3c9bfb[_0x19de('0x53')](_0x2ed2b3);}})[_0x19de('0x25')](function(_0x46d93c){if(_0x46d93c){return _0x46d93c?{'count':_0x324694,'rows':_0x46d93c}:null;}})['then'](respondWithResult(_0x193c6d,null))['catch'](handleError(_0x193c6d,null));};exports[_0x19de('0x54')]=function(_0x56ce32,_0x571a2d,_0x1f46a5){if(_0x56ce32['body']['id']){delete _0x56ce32['body']['id'];}return db[_0x19de('0x2c')][_0x19de('0x4d')]({'where':{'id':_0x56ce32[_0x19de('0x47')]['id']}})[_0x19de('0x25')](handleEntityNotFound(_0x571a2d,null))['then'](function(_0x5760f0){if(_0x5760f0){return _0x5760f0[_0x19de('0x54')](_0x56ce32[_0x19de('0x4b')]['ids']||[]);}return null;})['then'](respondWithResult(_0x571a2d,null))[_0x19de('0x45')](handleError(_0x571a2d,null));}; \ No newline at end of file +var _0x7c89=['name','send','model','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','merge','where','map','type','VIRTUAL','DeskConfiguration','includeAll','include','findAll','rows','params','keys','find','create','body','catch','getFields','findOne','DeskField','rawAttributes','hasOwnProperty','getSubjects','order','options','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack'];(function(_0x557b82,_0x2c1e4c){var _0x14e9da=function(_0x2ebb56){while(--_0x2ebb56){_0x557b82['push'](_0x557b82['shift']());}};_0x14e9da(++_0x2c1e4c);}(_0x7c89,0x169));var _0x97c8=function(_0x42b949,_0x5ef2cd){_0x42b949=_0x42b949-0x0;var _0x1bd737=_0x7c89[_0x42b949];return _0x1bd737;};'use strict';var emlformat=require(_0x97c8('0x0'));var rimraf=require(_0x97c8('0x1'));var zipdir=require(_0x97c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c8('0x3'));var moment=require(_0x97c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x97c8('0x5'));var util=require(_0x97c8('0x6'));var path=require(_0x97c8('0x7'));var sox=require(_0x97c8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97c8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x97c8('0xa'));var deskjs=require(_0x97c8('0xb'));var toCsv=require(_0x97c8('0xc'));var querystring=require(_0x97c8('0xd'));var Papa=require(_0x97c8('0xe'));var Redis=require('ioredis');var authService=require(_0x97c8('0xf'));var qs=require(_0x97c8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c8('0x11'));var logger=require('../../config/logger')(_0x97c8('0x12'));var utils=require(_0x97c8('0x13'));var config=require(_0x97c8('0x14'));var licenseUtil=require(_0x97c8('0x15'));var db=require(_0x97c8('0x16'))['db'];function respondWithStatusCode(_0x56d3ba,_0x186416){_0x186416=_0x186416||0xcc;return function(_0x43d0e8){if(_0x43d0e8){return _0x56d3ba['sendStatus'](_0x186416);}return _0x56d3ba[_0x97c8('0x17')](_0x186416)[_0x97c8('0x18')]();};}function respondWithResult(_0x1378c9,_0x4e8563){_0x4e8563=_0x4e8563||0xc8;return function(_0x3f74bf){if(_0x3f74bf){return _0x1378c9[_0x97c8('0x17')](_0x4e8563)['json'](_0x3f74bf);}};}function respondWithFilteredResult(_0x58b878,_0xa58d88){return function(_0x4d317f){if(_0x4d317f){var _0x3615f4=typeof _0xa58d88[_0x97c8('0x19')]===_0x97c8('0x1a')&&typeof _0xa58d88[_0x97c8('0x1b')]==='undefined';var _0x3ee30b=_0x4d317f['count'];var _0x1f1c2e=_0x3615f4?0x0:_0xa58d88['offset'];var _0x17152f=_0x3615f4?_0x4d317f[_0x97c8('0x1c')]:_0xa58d88[_0x97c8('0x19')]+_0xa58d88[_0x97c8('0x1b')];var _0x24421c;if(_0x17152f>=_0x3ee30b){_0x17152f=_0x3ee30b;_0x24421c=0xc8;}else{_0x24421c=0xce;}_0x58b878[_0x97c8('0x17')](_0x24421c);return _0x58b878['set'](_0x97c8('0x1d'),_0x1f1c2e+'-'+_0x17152f+'/'+_0x3ee30b)[_0x97c8('0x1e')](_0x4d317f);}return null;};}function patchUpdates(_0x5d2ef1){return function(_0xaad40f){try{jsonpatch[_0x97c8('0x1f')](_0xaad40f,_0x5d2ef1,!![]);}catch(_0x3357a1){return BPromise[_0x97c8('0x20')](_0x3357a1);}return _0xaad40f[_0x97c8('0x21')]();};}function saveUpdates(_0x2a764b,_0x1d737a){return function(_0x300309){if(_0x300309){return _0x300309['update'](_0x2a764b)[_0x97c8('0x22')](function(_0x461af9){return _0x461af9;});}return null;};}function removeEntity(_0x156b1c,_0x16caef){return function(_0xc47f2b){if(_0xc47f2b){return _0xc47f2b[_0x97c8('0x23')]()[_0x97c8('0x22')](function(){_0x156b1c[_0x97c8('0x17')](0xcc)[_0x97c8('0x18')]();});}};}function handleEntityNotFound(_0x3cea8b,_0x43b31e){return function(_0x254c3c){if(!_0x254c3c){_0x3cea8b[_0x97c8('0x24')](0x194);}return _0x254c3c;};}function handleError(_0x5ad172,_0xc65dc6){_0xc65dc6=_0xc65dc6||0x1f4;return function(_0x389cd3){logger[_0x97c8('0x25')](_0x389cd3[_0x97c8('0x26')]);if(_0x389cd3[_0x97c8('0x27')]){delete _0x389cd3[_0x97c8('0x27')];}_0x5ad172[_0x97c8('0x17')](_0xc65dc6)[_0x97c8('0x28')](_0x389cd3);};}exports['index']=function(_0x158a73,_0x412fd5){var _0x57903a={},_0x22008c={},_0x2e7b2e={'count':0x0,'rows':[]};var _0x584c70=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x2f2806){return{'name':_0x2f2806['fieldName'],'type':_0x2f2806['type']['key']};});_0x22008c[_0x97c8('0x29')]=_['map'](_0x584c70,'name');_0x22008c[_0x97c8('0x2a')]=_['keys'](_0x158a73[_0x97c8('0x2a')]);_0x22008c[_0x97c8('0x2b')]=_[_0x97c8('0x2c')](_0x22008c[_0x97c8('0x29')],_0x22008c['query']);_0x57903a['attributes']=_[_0x97c8('0x2c')](_0x22008c[_0x97c8('0x29')],qs[_0x97c8('0x2d')](_0x158a73[_0x97c8('0x2a')][_0x97c8('0x2d')]));_0x57903a[_0x97c8('0x2e')]=_0x57903a['attributes'][_0x97c8('0x2f')]?_0x57903a[_0x97c8('0x2e')]:_0x22008c[_0x97c8('0x29')];if(!_0x158a73[_0x97c8('0x2a')]['hasOwnProperty'](_0x97c8('0x30'))){_0x57903a[_0x97c8('0x1b')]=qs[_0x97c8('0x1b')](_0x158a73[_0x97c8('0x2a')]['limit']);_0x57903a['offset']=qs[_0x97c8('0x19')](_0x158a73['query']['offset']);}_0x57903a['order']=qs['sort'](_0x158a73[_0x97c8('0x2a')][_0x97c8('0x31')]);_0x57903a['where']=qs[_0x97c8('0x2b')](_[_0x97c8('0x32')](_0x158a73[_0x97c8('0x2a')],_0x22008c[_0x97c8('0x2b')]),_0x584c70);if(_0x158a73[_0x97c8('0x2a')][_0x97c8('0x33')]){_0x57903a['where']=_[_0x97c8('0x34')](_0x57903a[_0x97c8('0x35')],{'$or':_[_0x97c8('0x36')](_0x584c70,function(_0x20d18f){if(_0x20d18f[_0x97c8('0x37')]!==_0x97c8('0x38')){var _0x177d64={};_0x177d64[_0x20d18f[_0x97c8('0x27')]]={'$like':'%'+_0x158a73[_0x97c8('0x2a')][_0x97c8('0x33')]+'%'};return _0x177d64;}})});}_0x57903a=_[_0x97c8('0x34')]({},_0x57903a,_0x158a73['options']);var _0x9c0ff9={'where':_0x57903a[_0x97c8('0x35')]};return db[_0x97c8('0x39')][_0x97c8('0x1c')](_0x9c0ff9)[_0x97c8('0x22')](function(_0x2acc5d){_0x2e7b2e[_0x97c8('0x1c')]=_0x2acc5d;if(_0x158a73[_0x97c8('0x2a')][_0x97c8('0x3a')]){_0x57903a[_0x97c8('0x3b')]=[{'all':!![]}];}return db[_0x97c8('0x39')][_0x97c8('0x3c')](_0x57903a);})['then'](function(_0x5e054e){_0x2e7b2e[_0x97c8('0x3d')]=_0x5e054e;return _0x2e7b2e;})[_0x97c8('0x22')](respondWithFilteredResult(_0x412fd5,_0x57903a))['catch'](handleError(_0x412fd5,null));};exports['show']=function(_0x360e72,_0x10f85c){var _0x3c7e52={'raw':![],'where':{'id':_0x360e72[_0x97c8('0x3e')]['id']}},_0x451e63={};_0x451e63['model']=_[_0x97c8('0x3f')](db[_0x97c8('0x39')]['rawAttributes']);_0x451e63[_0x97c8('0x2a')]=_[_0x97c8('0x3f')](_0x360e72['query']);_0x451e63['filters']=_[_0x97c8('0x2c')](_0x451e63[_0x97c8('0x29')],_0x451e63[_0x97c8('0x2a')]);_0x3c7e52['attributes']=_['intersection'](_0x451e63[_0x97c8('0x29')],qs[_0x97c8('0x2d')](_0x360e72[_0x97c8('0x2a')][_0x97c8('0x2d')]));_0x3c7e52[_0x97c8('0x2e')]=_0x3c7e52[_0x97c8('0x2e')][_0x97c8('0x2f')]?_0x3c7e52[_0x97c8('0x2e')]:_0x451e63[_0x97c8('0x29')];if(_0x360e72[_0x97c8('0x2a')]['includeAll']){_0x3c7e52[_0x97c8('0x3b')]=[{'all':!![]}];}_0x3c7e52=_[_0x97c8('0x34')]({},_0x3c7e52,_0x360e72['options']);return db['DeskConfiguration'][_0x97c8('0x40')](_0x3c7e52)[_0x97c8('0x22')](handleEntityNotFound(_0x10f85c,null))[_0x97c8('0x22')](respondWithResult(_0x10f85c,null))['catch'](handleError(_0x10f85c,null));};exports[_0x97c8('0x41')]=function(_0x1403f2,_0x27e346){return db[_0x97c8('0x39')]['create'](_0x1403f2[_0x97c8('0x42')],{})['then'](respondWithResult(_0x27e346,0xc9))[_0x97c8('0x43')](handleError(_0x27e346,null));};exports['update']=function(_0x330fc9,_0x11287b){if(_0x330fc9[_0x97c8('0x42')]['id']){delete _0x330fc9[_0x97c8('0x42')]['id'];}return db[_0x97c8('0x39')][_0x97c8('0x40')]({'where':{'id':_0x330fc9[_0x97c8('0x3e')]['id']}})[_0x97c8('0x22')](handleEntityNotFound(_0x11287b,null))[_0x97c8('0x22')](saveUpdates(_0x330fc9[_0x97c8('0x42')],null))['then'](respondWithResult(_0x11287b,null))[_0x97c8('0x43')](handleError(_0x11287b,null));};exports['destroy']=function(_0x39d081,_0x15ed6f){return db['DeskConfiguration'][_0x97c8('0x40')]({'where':{'id':_0x39d081[_0x97c8('0x3e')]['id']}})[_0x97c8('0x22')](handleEntityNotFound(_0x15ed6f,null))['then'](removeEntity(_0x15ed6f,null))[_0x97c8('0x43')](handleError(_0x15ed6f,null));};exports[_0x97c8('0x44')]=function(_0x3e11ab,_0x3e6f80,_0x1eed27){var _0x2a0b4a={};var _0x3413a8={};var _0x3104a1;var _0x2bcad7;return db['DeskConfiguration'][_0x97c8('0x45')]({'where':{'id':_0x3e11ab[_0x97c8('0x3e')]['id']}})[_0x97c8('0x22')](handleEntityNotFound(_0x3e6f80,null))['then'](function(_0x2d4bf9){if(_0x2d4bf9){_0x3104a1=_0x2d4bf9;_0x3413a8['model']=_['keys'](db[_0x97c8('0x46')][_0x97c8('0x47')]);_0x3413a8[_0x97c8('0x2a')]=_['keys'](_0x3e11ab[_0x97c8('0x2a')]);_0x3413a8[_0x97c8('0x2b')]=_[_0x97c8('0x2c')](_0x3413a8[_0x97c8('0x29')],_0x3413a8[_0x97c8('0x2a')]);_0x2a0b4a[_0x97c8('0x2e')]=_[_0x97c8('0x2c')](_0x3413a8[_0x97c8('0x29')],qs[_0x97c8('0x2d')](_0x3e11ab[_0x97c8('0x2a')]['fields']));_0x2a0b4a['attributes']=_0x2a0b4a[_0x97c8('0x2e')][_0x97c8('0x2f')]?_0x2a0b4a[_0x97c8('0x2e')]:_0x3413a8['model'];_0x2a0b4a['order']=qs['sort'](_0x3e11ab[_0x97c8('0x2a')][_0x97c8('0x31')]);_0x2a0b4a[_0x97c8('0x35')]=qs[_0x97c8('0x2b')](_[_0x97c8('0x32')](_0x3e11ab[_0x97c8('0x2a')],_0x3413a8[_0x97c8('0x2b')]));if(_0x3e11ab[_0x97c8('0x2a')]['filter']){_0x2a0b4a[_0x97c8('0x35')]=_[_0x97c8('0x34')](_0x2a0b4a[_0x97c8('0x35')],{'$or':_[_0x97c8('0x36')](_0x2a0b4a[_0x97c8('0x2e')],function(_0x1b9831){var _0x1f2ef5={};_0x1f2ef5[_0x1b9831]={'$like':'%'+_0x3e11ab[_0x97c8('0x2a')][_0x97c8('0x33')]+'%'};return _0x1f2ef5;})});}_0x2a0b4a=_[_0x97c8('0x34')]({},_0x2a0b4a,_0x3e11ab['options']);return _0x3104a1[_0x97c8('0x44')](_0x2a0b4a);}})[_0x97c8('0x22')](function(_0xc0fe16){if(_0xc0fe16){_0x2bcad7=_0xc0fe16[_0x97c8('0x2f')];if(!_0x3e11ab[_0x97c8('0x2a')][_0x97c8('0x48')]('nolimit')){_0x2a0b4a[_0x97c8('0x1b')]=qs[_0x97c8('0x1b')](_0x3e11ab[_0x97c8('0x2a')][_0x97c8('0x1b')]);_0x2a0b4a[_0x97c8('0x19')]=qs[_0x97c8('0x19')](_0x3e11ab[_0x97c8('0x2a')][_0x97c8('0x19')]);}return _0x3104a1[_0x97c8('0x44')](_0x2a0b4a);}})[_0x97c8('0x22')](function(_0x490a15){if(_0x490a15){return _0x490a15?{'count':_0x2bcad7,'rows':_0x490a15}:null;}})[_0x97c8('0x22')](respondWithResult(_0x3e6f80,null))[_0x97c8('0x43')](handleError(_0x3e6f80,null));};exports[_0x97c8('0x49')]=function(_0x2d3dfa,_0x37d0ad,_0x39fb58){var _0xedd83e={};var _0x260e9b={};var _0x4c5638;var _0x1ae467;return db[_0x97c8('0x39')]['findOne']({'where':{'id':_0x2d3dfa[_0x97c8('0x3e')]['id']}})[_0x97c8('0x22')](handleEntityNotFound(_0x37d0ad,null))[_0x97c8('0x22')](function(_0x1e6fb9){if(_0x1e6fb9){_0x4c5638=_0x1e6fb9;_0x260e9b['model']=_['keys'](db[_0x97c8('0x46')][_0x97c8('0x47')]);_0x260e9b[_0x97c8('0x2a')]=_['keys'](_0x2d3dfa[_0x97c8('0x2a')]);_0x260e9b[_0x97c8('0x2b')]=_[_0x97c8('0x2c')](_0x260e9b[_0x97c8('0x29')],_0x260e9b[_0x97c8('0x2a')]);_0xedd83e[_0x97c8('0x2e')]=_[_0x97c8('0x2c')](_0x260e9b['model'],qs[_0x97c8('0x2d')](_0x2d3dfa['query'][_0x97c8('0x2d')]));_0xedd83e[_0x97c8('0x2e')]=_0xedd83e[_0x97c8('0x2e')]['length']?_0xedd83e[_0x97c8('0x2e')]:_0x260e9b[_0x97c8('0x29')];_0xedd83e[_0x97c8('0x4a')]=qs['sort'](_0x2d3dfa[_0x97c8('0x2a')][_0x97c8('0x31')]);_0xedd83e['where']=qs[_0x97c8('0x2b')](_[_0x97c8('0x32')](_0x2d3dfa[_0x97c8('0x2a')],_0x260e9b[_0x97c8('0x2b')]));if(_0x2d3dfa[_0x97c8('0x2a')][_0x97c8('0x33')]){_0xedd83e[_0x97c8('0x35')]=_[_0x97c8('0x34')](_0xedd83e[_0x97c8('0x35')],{'$or':_[_0x97c8('0x36')](_0xedd83e[_0x97c8('0x2e')],function(_0x2e1454){var _0x188013={};_0x188013[_0x2e1454]={'$like':'%'+_0x2d3dfa[_0x97c8('0x2a')][_0x97c8('0x33')]+'%'};return _0x188013;})});}_0xedd83e=_[_0x97c8('0x34')]({},_0xedd83e,_0x2d3dfa[_0x97c8('0x4b')]);return _0x4c5638[_0x97c8('0x49')](_0xedd83e);}})['then'](function(_0x312d3b){if(_0x312d3b){_0x1ae467=_0x312d3b[_0x97c8('0x2f')];if(!_0x2d3dfa[_0x97c8('0x2a')][_0x97c8('0x48')](_0x97c8('0x30'))){_0xedd83e[_0x97c8('0x1b')]=qs[_0x97c8('0x1b')](_0x2d3dfa[_0x97c8('0x2a')][_0x97c8('0x1b')]);_0xedd83e[_0x97c8('0x19')]=qs[_0x97c8('0x19')](_0x2d3dfa[_0x97c8('0x2a')][_0x97c8('0x19')]);}return _0x4c5638[_0x97c8('0x49')](_0xedd83e);}})['then'](function(_0x505822){if(_0x505822){return _0x505822?{'count':_0x1ae467,'rows':_0x505822}:null;}})['then'](respondWithResult(_0x37d0ad,null))['catch'](handleError(_0x37d0ad,null));};exports[_0x97c8('0x4c')]=function(_0x572f4a,_0x59bd21,_0x1c6748){var _0x52620b={};var _0x2c38d7={};var _0x5d8621;var _0x222ef2;return db[_0x97c8('0x39')][_0x97c8('0x45')]({'where':{'id':_0x572f4a[_0x97c8('0x3e')]['id']}})[_0x97c8('0x22')](handleEntityNotFound(_0x59bd21,null))[_0x97c8('0x22')](function(_0x359feb){if(_0x359feb){_0x5d8621=_0x359feb;_0x2c38d7[_0x97c8('0x29')]=_[_0x97c8('0x3f')](db['DeskField']['rawAttributes']);_0x2c38d7[_0x97c8('0x2a')]=_[_0x97c8('0x3f')](_0x572f4a['query']);_0x2c38d7[_0x97c8('0x2b')]=_['intersection'](_0x2c38d7[_0x97c8('0x29')],_0x2c38d7[_0x97c8('0x2a')]);_0x52620b[_0x97c8('0x2e')]=_[_0x97c8('0x2c')](_0x2c38d7['model'],qs[_0x97c8('0x2d')](_0x572f4a[_0x97c8('0x2a')][_0x97c8('0x2d')]));_0x52620b[_0x97c8('0x2e')]=_0x52620b[_0x97c8('0x2e')][_0x97c8('0x2f')]?_0x52620b[_0x97c8('0x2e')]:_0x2c38d7[_0x97c8('0x29')];_0x52620b['order']=qs[_0x97c8('0x31')](_0x572f4a['query'][_0x97c8('0x31')]);_0x52620b['where']=qs[_0x97c8('0x2b')](_[_0x97c8('0x32')](_0x572f4a[_0x97c8('0x2a')],_0x2c38d7[_0x97c8('0x2b')]));if(_0x572f4a[_0x97c8('0x2a')]['filter']){_0x52620b[_0x97c8('0x35')]=_[_0x97c8('0x34')](_0x52620b[_0x97c8('0x35')],{'$or':_['map'](_0x52620b[_0x97c8('0x2e')],function(_0x2eda42){var _0x278bd9={};_0x278bd9[_0x2eda42]={'$like':'%'+_0x572f4a[_0x97c8('0x2a')][_0x97c8('0x33')]+'%'};return _0x278bd9;})});}_0x52620b=_[_0x97c8('0x34')]({},_0x52620b,_0x572f4a[_0x97c8('0x4b')]);return _0x5d8621[_0x97c8('0x4c')](_0x52620b);}})[_0x97c8('0x22')](function(_0x663f38){if(_0x663f38){_0x222ef2=_0x663f38[_0x97c8('0x2f')];if(!_0x572f4a[_0x97c8('0x2a')][_0x97c8('0x48')]('nolimit')){_0x52620b[_0x97c8('0x1b')]=qs[_0x97c8('0x1b')](_0x572f4a[_0x97c8('0x2a')]['limit']);_0x52620b[_0x97c8('0x19')]=qs[_0x97c8('0x19')](_0x572f4a[_0x97c8('0x2a')][_0x97c8('0x19')]);}return _0x5d8621['getDescriptions'](_0x52620b);}})['then'](function(_0x15a486){if(_0x15a486){return _0x15a486?{'count':_0x222ef2,'rows':_0x15a486}:null;}})[_0x97c8('0x22')](respondWithResult(_0x59bd21,null))['catch'](handleError(_0x59bd21,null));};exports[_0x97c8('0x4d')]=function(_0x74ed2,_0x2fa004,_0x50bd99){var _0x48a64d={};var _0x36b9a4={};var _0x32c9f9;var _0x54ce75;return db['DeskConfiguration'][_0x97c8('0x45')]({'where':{'id':_0x74ed2[_0x97c8('0x3e')]['id']}})[_0x97c8('0x22')](handleEntityNotFound(_0x2fa004,null))[_0x97c8('0x22')](function(_0x345009){if(_0x345009){_0x32c9f9=_0x345009;_0x36b9a4[_0x97c8('0x29')]=_[_0x97c8('0x3f')](db[_0x97c8('0x4e')][_0x97c8('0x47')]);_0x36b9a4[_0x97c8('0x2a')]=_[_0x97c8('0x3f')](_0x74ed2[_0x97c8('0x2a')]);_0x36b9a4[_0x97c8('0x2b')]=_[_0x97c8('0x2c')](_0x36b9a4[_0x97c8('0x29')],_0x36b9a4[_0x97c8('0x2a')]);_0x48a64d[_0x97c8('0x2e')]=_['intersection'](_0x36b9a4[_0x97c8('0x29')],qs[_0x97c8('0x2d')](_0x74ed2[_0x97c8('0x2a')]['fields']));_0x48a64d['attributes']=_0x48a64d[_0x97c8('0x2e')][_0x97c8('0x2f')]?_0x48a64d[_0x97c8('0x2e')]:_0x36b9a4[_0x97c8('0x29')];_0x48a64d[_0x97c8('0x4a')]=qs[_0x97c8('0x31')](_0x74ed2[_0x97c8('0x2a')][_0x97c8('0x31')]);_0x48a64d['where']=qs['filters'](_['pick'](_0x74ed2[_0x97c8('0x2a')],_0x36b9a4[_0x97c8('0x2b')]));if(_0x74ed2[_0x97c8('0x2a')][_0x97c8('0x33')]){_0x48a64d['where']=_['merge'](_0x48a64d['where'],{'$or':_[_0x97c8('0x36')](_0x48a64d['attributes'],function(_0x184a12){var _0x440451={};_0x440451[_0x184a12]={'$like':'%'+_0x74ed2[_0x97c8('0x2a')][_0x97c8('0x33')]+'%'};return _0x440451;})});}_0x48a64d=_['merge']({},_0x48a64d,_0x74ed2[_0x97c8('0x4b')]);return _0x32c9f9[_0x97c8('0x4d')](_0x48a64d);}})[_0x97c8('0x22')](function(_0x562e50){if(_0x562e50){_0x54ce75=_0x562e50[_0x97c8('0x2f')];if(!_0x74ed2[_0x97c8('0x2a')][_0x97c8('0x48')](_0x97c8('0x30'))){_0x48a64d['limit']=qs['limit'](_0x74ed2[_0x97c8('0x2a')][_0x97c8('0x1b')]);_0x48a64d[_0x97c8('0x19')]=qs[_0x97c8('0x19')](_0x74ed2[_0x97c8('0x2a')][_0x97c8('0x19')]);}return _0x32c9f9[_0x97c8('0x4d')](_0x48a64d);}})['then'](function(_0x3713dc){if(_0x3713dc){return _0x3713dc?{'count':_0x54ce75,'rows':_0x3713dc}:null;}})[_0x97c8('0x22')](respondWithResult(_0x2fa004,null))[_0x97c8('0x43')](handleError(_0x2fa004,null));};exports[_0x97c8('0x4f')]=function(_0xc9923f,_0x20236f,_0x5cfed9){if(_0xc9923f[_0x97c8('0x42')]['id']){delete _0xc9923f[_0x97c8('0x42')]['id'];}return db[_0x97c8('0x39')]['findOne']({'where':{'id':_0xc9923f[_0x97c8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x20236f,null))[_0x97c8('0x22')](function(_0x207d9d){if(_0x207d9d){return _0x207d9d['setTags'](_0xc9923f[_0x97c8('0x42')]['ids']||[]);}return null;})[_0x97c8('0x22')](respondWithResult(_0x20236f,null))[_0x97c8('0x43')](handleError(_0x20236f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0b31060..94f4b60 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 _0xb720=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xb720,0x191));var _0x0b72=function(_0x497d6d,_0xff7558){_0x497d6d=_0x497d6d-0x0;var _0x4a1d9a=_0xb720[_0x497d6d];return _0x4a1d9a;};'use strict';var _=require(_0x0b72('0x0'));var util=require('util');var logger=require(_0x0b72('0x1'))(_0x0b72('0x2'));var moment=require(_0x0b72('0x3'));var BPromise=require(_0x0b72('0x4'));var rp=require(_0x0b72('0x5'));var fs=require('fs');var path=require(_0x0b72('0x6'));var rimraf=require(_0x0b72('0x7'));var config=require(_0x0b72('0x8'));var attributes=require(_0x0b72('0x9'));module['exports']=function(_0x1fbb71,_0x51679c){return _0x1fbb71[_0x0b72('0xa')](_0x0b72('0xb'),attributes,{'tableName':_0x0b72('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e7d=['exports','define','int_desk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x578454,_0x53aec7){var _0x187920=function(_0x4f3515){while(--_0x4f3515){_0x578454['push'](_0x578454['shift']());}};_0x187920(++_0x53aec7);}(_0x1e7d,0x100));var _0xd1e7=function(_0x168c49,_0x3f221f){_0x168c49=_0x168c49-0x0;var _0x1e96fb=_0x1e7d[_0x168c49];return _0x1e96fb;};'use strict';var _=require('lodash');var util=require(_0xd1e7('0x0'));var logger=require(_0xd1e7('0x1'))(_0xd1e7('0x2'));var moment=require(_0xd1e7('0x3'));var BPromise=require(_0xd1e7('0x4'));var rp=require(_0xd1e7('0x5'));var fs=require('fs');var path=require(_0xd1e7('0x6'));var rimraf=require(_0xd1e7('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0xd1e7('0x8')]=function(_0x479f5d,_0x1cdb8b){return _0x479f5d[_0xd1e7('0x9')]('DeskConfiguration',attributes,{'tableName':_0xd1e7('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 0e4f253..207d5fb 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 _0x5458=['rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x431807,_0x187385){var _0x51d062=function(_0x2bd6a6){while(--_0x2bd6a6){_0x431807['push'](_0x431807['shift']());}};_0x51d062(++_0x187385);}(_0x5458,0x1c7));var _0x8545=function(_0x386451,_0x5945fd){_0x386451=_0x386451-0x0;var _0x30de1e=_0x5458[_0x386451];return _0x30de1e;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var moment=require(_0x8545('0x2'));var BPromise=require('bluebird');var rs=require(_0x8545('0x3'));var fs=require('fs');var Redis=require(_0x8545('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8545('0x5'));var logger=require(_0x8545('0x6'))(_0x8545('0x7'));var config=require('../../config/environment');var jayson=require(_0x8545('0x8'));var client=jayson[_0x8545('0x9')][_0x8545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359d01,_0x5062c7,_0x291bc9){return new BPromise(function(_0x507ed8,_0x2cc4f4){return client[_0x8545('0xb')](_0x359d01,_0x291bc9)[_0x8545('0xc')](function(_0x10931d){logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));logger[_0x8545('0x10')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5062c7,_0x8545('0xf'),JSON[_0x8545('0x11')](_0x10931d));if(_0x10931d[_0x8545('0x12')]){if(_0x10931d['error'][_0x8545('0x13')]===0x1f4){logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);return _0x2cc4f4(_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);}logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d['error'][_0x8545('0x14')]);return _0x507ed8(_0x10931d[_0x8545('0x12')]['message']);}else{logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));_0x507ed8(_0x10931d['result'][_0x8545('0x14')]);}})[_0x8545('0x15')](function(_0x3374f7){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5062c7,_0x3374f7);_0x2cc4f4(_0x3374f7);});});} \ No newline at end of file +var _0x9bc7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','lodash'];(function(_0x83b8c,_0x3369a2){var _0x5ef10c=function(_0x32f5fc){while(--_0x32f5fc){_0x83b8c['push'](_0x83b8c['shift']());}};_0x5ef10c(++_0x3369a2);}(_0x9bc7,0x1cd));var _0x79bc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9bc7[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x79bc('0x0'));var util=require(_0x79bc('0x1'));var moment=require(_0x79bc('0x2'));var BPromise=require(_0x79bc('0x3'));var rs=require(_0x79bc('0x4'));var fs=require('fs');var Redis=require(_0x79bc('0x5'));var db=require(_0x79bc('0x6'))['db'];var utils=require(_0x79bc('0x7'));var logger=require(_0x79bc('0x8'))(_0x79bc('0x9'));var config=require('../../config/environment');var jayson=require(_0x79bc('0xa'));var client=jayson[_0x79bc('0xb')][_0x79bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x559f38,_0xf0aefd,_0x4da6a3){return new BPromise(function(_0x450c79,_0x17b1cc){return client[_0x79bc('0xd')](_0x559f38,_0x4da6a3)[_0x79bc('0xe')](function(_0x6f370e){logger['info'](_0x79bc('0xf'),_0xf0aefd,'request\x20sent');logger[_0x79bc('0x10')](_0x79bc('0x11'),_0xf0aefd,'request\x20sent',JSON['stringify'](_0x6f370e));if(_0x6f370e[_0x79bc('0x12')]){if(_0x6f370e[_0x79bc('0x12')][_0x79bc('0x13')]===0x1f4){logger[_0x79bc('0x12')](_0x79bc('0xf'),_0xf0aefd,_0x6f370e[_0x79bc('0x12')][_0x79bc('0x14')]);return _0x17b1cc(_0x6f370e[_0x79bc('0x12')]['message']);}logger[_0x79bc('0x12')](_0x79bc('0xf'),_0xf0aefd,_0x6f370e[_0x79bc('0x12')][_0x79bc('0x14')]);return _0x450c79(_0x6f370e[_0x79bc('0x12')][_0x79bc('0x14')]);}else{logger['info'](_0x79bc('0xf'),_0xf0aefd,_0x79bc('0x15'));_0x450c79(_0x6f370e['result'][_0x79bc('0x14')]);}})['catch'](function(_0x403ebe){logger[_0x79bc('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xf0aefd,_0x403ebe);_0x17b1cc(_0x403ebe);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 1d7f4dc..0b05801 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 _0x0942=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','/:id','show','post','isAuthenticated','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x0942,0x11a));var _0x2094=function(_0x5956a1,_0x231b31){_0x5956a1=_0x5956a1-0x0;var _0x6d2204=_0x0942[_0x5956a1];return _0x6d2204;};'use strict';var multer=require('multer');var util=require(_0x2094('0x0'));var path=require(_0x2094('0x1'));var timeout=require(_0x2094('0x2'));var express=require(_0x2094('0x3'));var router=express[_0x2094('0x4')]();var fs_extra=require(_0x2094('0x5'));var auth=require(_0x2094('0x6'));var interaction=require(_0x2094('0x7'));var config=require('../../config/environment');var controller=require(_0x2094('0x8'));router[_0x2094('0x9')]('/',auth['isAuthenticated'](),controller[_0x2094('0xa')]);router[_0x2094('0x9')](_0x2094('0xb'),auth['isAuthenticated'](),controller[_0x2094('0xc')]);router[_0x2094('0xd')]('/',auth[_0x2094('0xe')](),controller['create']);router[_0x2094('0xf')](_0x2094('0xb'),auth[_0x2094('0xe')](),controller['update']);router[_0x2094('0x10')](_0x2094('0xb'),auth[_0x2094('0xe')](),controller[_0x2094('0x11')]);module[_0x2094('0x12')]=router; \ No newline at end of file +var _0xe31a=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id'];(function(_0x8f7d2b,_0x1bebaf){var _0x13c298=function(_0x54717e){while(--_0x54717e){_0x8f7d2b['push'](_0x8f7d2b['shift']());}};_0x13c298(++_0x1bebaf);}(_0xe31a,0x87));var _0xae31=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe31a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xae31('0x0'));var util=require(_0xae31('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xae31('0x2'));var router=express[_0xae31('0x3')]();var fs_extra=require(_0xae31('0x4'));var auth=require(_0xae31('0x5'));var interaction=require(_0xae31('0x6'));var config=require(_0xae31('0x7'));var controller=require(_0xae31('0x8'));router[_0xae31('0x9')]('/',auth['isAuthenticated'](),controller[_0xae31('0xa')]);router[_0xae31('0x9')](_0xae31('0xb'),auth[_0xae31('0xc')](),controller[_0xae31('0xd')]);router[_0xae31('0xe')]('/',auth[_0xae31('0xc')](),controller[_0xae31('0xf')]);router[_0xae31('0x10')](_0xae31('0xb'),auth[_0xae31('0xc')](),controller[_0xae31('0x11')]);router[_0xae31('0x12')](_0xae31('0xb'),auth['isAuthenticated'](),controller[_0xae31('0x13')]);module[_0xae31('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ff68c04..6d4de08 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 _0x0bd5=['customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string'];(function(_0x13b701,_0xf8a5ee){var _0x18d4a2=function(_0x17014b){while(--_0x17014b){_0x13b701['push'](_0x13b701['shift']());}};_0x18d4a2(++_0xf8a5ee);}(_0x0bd5,0xc5));var _0x50bd=function(_0x2cc161,_0x3880fc){_0x2cc161=_0x2cc161-0x0;var _0xbc6aac=_0x0bd5[_0x2cc161];return _0xbc6aac;};'use strict';var Sequelize=require(_0x50bd('0x0'));module[_0x50bd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x50bd('0x2'),'variable',_0x50bd('0x3'),_0x50bd('0x4'),_0x50bd('0x5')),'defaultValue':_0x50bd('0x2')},'content':{'type':Sequelize[_0x50bd('0x6')]},'key':{'type':Sequelize[_0x50bd('0x6')]},'keyType':{'type':Sequelize[_0x50bd('0x7')]('string',_0x50bd('0x8'),_0x50bd('0x3'))},'keyContent':{'type':Sequelize[_0x50bd('0x6')]},'idField':{'type':Sequelize[_0x50bd('0x6')]},'nameField':{'type':Sequelize[_0x50bd('0x6')]},'customField':{'type':Sequelize[_0x50bd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x20a4=['ENUM','customVariable','picklist','string','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x20a4,0x166));var _0x420a=function(_0x3c4365,_0x4bfbf4){_0x3c4365=_0x3c4365-0x0;var _0x5ccdfe=_0x20a4[_0x3c4365];return _0x5ccdfe;};'use strict';var Sequelize=require(_0x420a('0x0'));module[_0x420a('0x1')]={'type':{'type':Sequelize[_0x420a('0x2')]('string','variable',_0x420a('0x3'),'keyValue',_0x420a('0x4')),'defaultValue':_0x420a('0x5')},'content':{'type':Sequelize[_0x420a('0x6')]},'key':{'type':Sequelize[_0x420a('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x420a('0x5'),_0x420a('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x420a('0x6')]},'idField':{'type':Sequelize[_0x420a('0x6')]},'nameField':{'type':Sequelize[_0x420a('0x6')]},'customField':{'type':Sequelize[_0x420a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x420a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 29ca21e..181df56 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 _0x0650=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','DeskField','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name'];(function(_0x39819d,_0x3adc5a){var _0x55abd0=function(_0x10d3f7){while(--_0x10d3f7){_0x39819d['push'](_0x39819d['shift']());}};_0x55abd0(++_0x3adc5a);}(_0x0650,0xed));var _0x0065=function(_0x2f7270,_0x307af1){_0x2f7270=_0x2f7270-0x0;var _0xe1d89a=_0x0650[_0x2f7270];return _0xe1d89a;};'use strict';var emlformat=require(_0x0065('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0065('0x1'));var jsonpatch=require(_0x0065('0x2'));var rp=require('request-promise');var moment=require(_0x0065('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0065('0x4'));var util=require(_0x0065('0x5'));var path=require(_0x0065('0x6'));var sox=require('sox');var csv=require(_0x0065('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0065('0x8'));var crypto=require(_0x0065('0x9'));var jsforce=require(_0x0065('0xa'));var deskjs=require(_0x0065('0xb'));var toCsv=require(_0x0065('0x7'));var querystring=require(_0x0065('0xc'));var Papa=require(_0x0065('0xd'));var Redis=require(_0x0065('0xe'));var authService=require(_0x0065('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0065('0x10'));var hardwareService=require(_0x0065('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0065('0x12'));var licenseUtil=require(_0x0065('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c7d1,_0x4255f6){_0x4255f6=_0x4255f6||0xcc;return function(_0x4c6296){if(_0x4c6296){return _0x45c7d1[_0x0065('0x14')](_0x4255f6);}return _0x45c7d1[_0x0065('0x15')](_0x4255f6)['end']();};}function respondWithResult(_0x5ae653,_0x1b9b1e){_0x1b9b1e=_0x1b9b1e||0xc8;return function(_0x5c0b74){if(_0x5c0b74){return _0x5ae653['status'](_0x1b9b1e)[_0x0065('0x16')](_0x5c0b74);}};}function respondWithFilteredResult(_0x5773d6,_0x38a870){return function(_0x48d817){if(_0x48d817){var _0x391fc1=typeof _0x38a870[_0x0065('0x17')]===_0x0065('0x18')&&typeof _0x38a870[_0x0065('0x19')]===_0x0065('0x18');var _0x34b0e2=_0x48d817[_0x0065('0x1a')];var _0x393d6e=_0x391fc1?0x0:_0x38a870['offset'];var _0x18bfa1=_0x391fc1?_0x48d817[_0x0065('0x1a')]:_0x38a870['offset']+_0x38a870[_0x0065('0x19')];var _0x3a0517;if(_0x18bfa1>=_0x34b0e2){_0x18bfa1=_0x34b0e2;_0x3a0517=0xc8;}else{_0x3a0517=0xce;}_0x5773d6[_0x0065('0x15')](_0x3a0517);return _0x5773d6[_0x0065('0x1b')](_0x0065('0x1c'),_0x393d6e+'-'+_0x18bfa1+'/'+_0x34b0e2)[_0x0065('0x16')](_0x48d817);}return null;};}function patchUpdates(_0x319e7a){return function(_0x529e30){try{jsonpatch['apply'](_0x529e30,_0x319e7a,!![]);}catch(_0x4b1213){return BPromise[_0x0065('0x1d')](_0x4b1213);}return _0x529e30[_0x0065('0x1e')]();};}function saveUpdates(_0x5b60c3,_0x2de3ae){return function(_0x5f1733){if(_0x5f1733){return _0x5f1733[_0x0065('0x1f')](_0x5b60c3)[_0x0065('0x20')](function(_0x3ec265){return _0x3ec265;});}return null;};}function removeEntity(_0x376452,_0x161b4c){return function(_0x1efa70){if(_0x1efa70){return _0x1efa70[_0x0065('0x21')]()['then'](function(){_0x376452[_0x0065('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4a4e,_0x3c715a){return function(_0x5924b3){if(!_0x5924b3){_0x4b4a4e[_0x0065('0x14')](0x194);}return _0x5924b3;};}function handleError(_0x6bf13b,_0x5db92c){_0x5db92c=_0x5db92c||0x1f4;return function(_0x123604){logger['error'](_0x123604['stack']);if(_0x123604[_0x0065('0x22')]){delete _0x123604[_0x0065('0x22')];}_0x6bf13b['status'](_0x5db92c)['send'](_0x123604);};}exports['index']=function(_0x51e091,_0x2e554f){var _0x1a977a={},_0x1f8813={},_0x369d08={'count':0x0,'rows':[]};var _0x4f15f5=_['map'](db['DeskField'][_0x0065('0x23')],function(_0x3a5286){return{'name':_0x3a5286[_0x0065('0x24')],'type':_0x3a5286['type'][_0x0065('0x25')]};});_0x1f8813[_0x0065('0x26')]=_['map'](_0x4f15f5,_0x0065('0x22'));_0x1f8813[_0x0065('0x27')]=_[_0x0065('0x28')](_0x51e091[_0x0065('0x27')]);_0x1f8813[_0x0065('0x29')]=_[_0x0065('0x2a')](_0x1f8813[_0x0065('0x26')],_0x1f8813[_0x0065('0x27')]);_0x1a977a['attributes']=_['intersection'](_0x1f8813['model'],qs[_0x0065('0x2b')](_0x51e091[_0x0065('0x27')][_0x0065('0x2b')]));_0x1a977a[_0x0065('0x2c')]=_0x1a977a[_0x0065('0x2c')][_0x0065('0x2d')]?_0x1a977a[_0x0065('0x2c')]:_0x1f8813['model'];if(!_0x51e091[_0x0065('0x27')][_0x0065('0x2e')](_0x0065('0x2f'))){_0x1a977a[_0x0065('0x19')]=qs[_0x0065('0x19')](_0x51e091['query'][_0x0065('0x19')]);_0x1a977a[_0x0065('0x17')]=qs[_0x0065('0x17')](_0x51e091[_0x0065('0x27')][_0x0065('0x17')]);}_0x1a977a[_0x0065('0x30')]=qs[_0x0065('0x31')](_0x51e091[_0x0065('0x27')][_0x0065('0x31')]);_0x1a977a[_0x0065('0x32')]=qs['filters'](_[_0x0065('0x33')](_0x51e091[_0x0065('0x27')],_0x1f8813[_0x0065('0x29')]),_0x4f15f5);if(_0x51e091['query'][_0x0065('0x34')]){_0x1a977a[_0x0065('0x32')]=_[_0x0065('0x35')](_0x1a977a[_0x0065('0x32')],{'$or':_[_0x0065('0x36')](_0x4f15f5,function(_0x231986){if(_0x231986['type']!==_0x0065('0x37')){var _0x2d1ba9={};_0x2d1ba9[_0x231986[_0x0065('0x22')]]={'$like':'%'+_0x51e091['query'][_0x0065('0x34')]+'%'};return _0x2d1ba9;}})});}_0x1a977a=_['merge']({},_0x1a977a,_0x51e091[_0x0065('0x38')]);var _0x37a434={'where':_0x1a977a['where']};return db[_0x0065('0x39')][_0x0065('0x1a')](_0x37a434)[_0x0065('0x20')](function(_0x3c1d6b){_0x369d08[_0x0065('0x1a')]=_0x3c1d6b;if(_0x51e091[_0x0065('0x27')]['includeAll']){_0x1a977a[_0x0065('0x3a')]=[{'all':!![]}];}return db[_0x0065('0x39')][_0x0065('0x3b')](_0x1a977a);})[_0x0065('0x20')](function(_0x1d251d){_0x369d08[_0x0065('0x3c')]=_0x1d251d;return _0x369d08;})[_0x0065('0x20')](respondWithFilteredResult(_0x2e554f,_0x1a977a))[_0x0065('0x3d')](handleError(_0x2e554f,null));};exports[_0x0065('0x3e')]=function(_0x41d6f7,_0x26cef9){var _0x32ab66={'raw':!![],'where':{'id':_0x41d6f7[_0x0065('0x3f')]['id']}},_0x35722d={};_0x35722d[_0x0065('0x26')]=_[_0x0065('0x28')](db[_0x0065('0x39')][_0x0065('0x23')]);_0x35722d[_0x0065('0x27')]=_[_0x0065('0x28')](_0x41d6f7[_0x0065('0x27')]);_0x35722d[_0x0065('0x29')]=_[_0x0065('0x2a')](_0x35722d['model'],_0x35722d[_0x0065('0x27')]);_0x32ab66['attributes']=_[_0x0065('0x2a')](_0x35722d['model'],qs[_0x0065('0x2b')](_0x41d6f7['query'][_0x0065('0x2b')]));_0x32ab66[_0x0065('0x2c')]=_0x32ab66[_0x0065('0x2c')]['length']?_0x32ab66['attributes']:_0x35722d[_0x0065('0x26')];if(_0x41d6f7[_0x0065('0x27')][_0x0065('0x40')]){_0x32ab66[_0x0065('0x3a')]=[{'all':!![]}];}_0x32ab66=_['merge']({},_0x32ab66,_0x41d6f7[_0x0065('0x38')]);return db[_0x0065('0x39')][_0x0065('0x41')](_0x32ab66)[_0x0065('0x20')](handleEntityNotFound(_0x26cef9,null))[_0x0065('0x20')](respondWithResult(_0x26cef9,null))['catch'](handleError(_0x26cef9,null));};exports[_0x0065('0x42')]=function(_0x5ef382,_0x339730){return db[_0x0065('0x39')][_0x0065('0x42')](_0x5ef382[_0x0065('0x43')],{})['then'](respondWithResult(_0x339730,0xc9))[_0x0065('0x3d')](handleError(_0x339730,null));};exports['update']=function(_0x86fa3d,_0x20b727){if(_0x86fa3d[_0x0065('0x43')]['id']){delete _0x86fa3d[_0x0065('0x43')]['id'];}return db[_0x0065('0x39')][_0x0065('0x41')]({'where':{'id':_0x86fa3d[_0x0065('0x3f')]['id']}})[_0x0065('0x20')](handleEntityNotFound(_0x20b727,null))[_0x0065('0x20')](saveUpdates(_0x86fa3d[_0x0065('0x43')],null))[_0x0065('0x20')](respondWithResult(_0x20b727,null))['catch'](handleError(_0x20b727,null));};exports[_0x0065('0x21')]=function(_0xcd7d13,_0x277b74){return db[_0x0065('0x39')][_0x0065('0x41')]({'where':{'id':_0xcd7d13[_0x0065('0x3f')]['id']}})[_0x0065('0x20')](handleEntityNotFound(_0x277b74,null))['then'](removeEntity(_0x277b74,null))['catch'](handleError(_0x277b74,null));}; \ No newline at end of file +var _0x03fc=['query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where','type','VIRTUAL','options','includeAll','include','show','params','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','Content-Range','apply','destroy','then','sendStatus','stack','name','index','map','DeskField','rawAttributes','key','model'];(function(_0x3c063e,_0xae03e5){var _0x2553d3=function(_0x1c7eb6){while(--_0x1c7eb6){_0x3c063e['push'](_0x3c063e['shift']());}};_0x2553d3(++_0xae03e5);}(_0x03fc,0x128));var _0xc03f=function(_0x50068c,_0x38a87a){_0x50068c=_0x50068c-0x0;var _0x11826a=_0x03fc[_0x50068c];return _0x11826a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc03f('0x0'));var zipdir=require(_0xc03f('0x1'));var jsonpatch=require(_0xc03f('0x2'));var rp=require(_0xc03f('0x3'));var moment=require(_0xc03f('0x4'));var BPromise=require(_0xc03f('0x5'));var Mustache=require(_0xc03f('0x6'));var util=require(_0xc03f('0x7'));var path=require(_0xc03f('0x8'));var sox=require(_0xc03f('0x9'));var csv=require(_0xc03f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc03f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc03f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc03f('0xd'));var Papa=require(_0xc03f('0xe'));var Redis=require(_0xc03f('0xf'));var authService=require(_0xc03f('0x10'));var qs=require(_0xc03f('0x11'));var as=require(_0xc03f('0x12'));var hardwareService=require(_0xc03f('0x13'));var logger=require(_0xc03f('0x14'))('api');var utils=require(_0xc03f('0x15'));var config=require(_0xc03f('0x16'));var licenseUtil=require(_0xc03f('0x17'));var db=require(_0xc03f('0x18'))['db'];function respondWithStatusCode(_0x57ecc,_0x186948){_0x186948=_0x186948||0xcc;return function(_0x1870c6){if(_0x1870c6){return _0x57ecc['sendStatus'](_0x186948);}return _0x57ecc[_0xc03f('0x19')](_0x186948)[_0xc03f('0x1a')]();};}function respondWithResult(_0x126171,_0xcf57ba){_0xcf57ba=_0xcf57ba||0xc8;return function(_0x41cd71){if(_0x41cd71){return _0x126171['status'](_0xcf57ba)['json'](_0x41cd71);}};}function respondWithFilteredResult(_0x235e01,_0x2fa130){return function(_0x1a09eb){if(_0x1a09eb){var _0x5160b3=typeof _0x2fa130['offset']==='undefined'&&typeof _0x2fa130[_0xc03f('0x1b')]===_0xc03f('0x1c');var _0x65ce9b=_0x1a09eb[_0xc03f('0x1d')];var _0x4ec892=_0x5160b3?0x0:_0x2fa130[_0xc03f('0x1e')];var _0xe9c645=_0x5160b3?_0x1a09eb[_0xc03f('0x1d')]:_0x2fa130[_0xc03f('0x1e')]+_0x2fa130[_0xc03f('0x1b')];var _0x420ab2;if(_0xe9c645>=_0x65ce9b){_0xe9c645=_0x65ce9b;_0x420ab2=0xc8;}else{_0x420ab2=0xce;}_0x235e01['status'](_0x420ab2);return _0x235e01['set'](_0xc03f('0x1f'),_0x4ec892+'-'+_0xe9c645+'/'+_0x65ce9b)['json'](_0x1a09eb);}return null;};}function patchUpdates(_0x505241){return function(_0x386b69){try{jsonpatch[_0xc03f('0x20')](_0x386b69,_0x505241,!![]);}catch(_0x2c84e4){return BPromise['reject'](_0x2c84e4);}return _0x386b69['save']();};}function saveUpdates(_0x3089b9,_0x46e2fe){return function(_0x141810){if(_0x141810){return _0x141810['update'](_0x3089b9)['then'](function(_0x29cf03){return _0x29cf03;});}return null;};}function removeEntity(_0x224e8f,_0x1dff57){return function(_0x5e936a){if(_0x5e936a){return _0x5e936a[_0xc03f('0x21')]()[_0xc03f('0x22')](function(){_0x224e8f[_0xc03f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c03b,_0x223b5c){return function(_0x8a9cfe){if(!_0x8a9cfe){_0x14c03b[_0xc03f('0x23')](0x194);}return _0x8a9cfe;};}function handleError(_0x977ea8,_0x1c0211){_0x1c0211=_0x1c0211||0x1f4;return function(_0x12e15f){logger['error'](_0x12e15f[_0xc03f('0x24')]);if(_0x12e15f[_0xc03f('0x25')]){delete _0x12e15f[_0xc03f('0x25')];}_0x977ea8[_0xc03f('0x19')](_0x1c0211)['send'](_0x12e15f);};}exports[_0xc03f('0x26')]=function(_0x4470e8,_0x2a7b27){var _0x107956={},_0x236859={},_0x551653={'count':0x0,'rows':[]};var _0x27b569=_[_0xc03f('0x27')](db[_0xc03f('0x28')][_0xc03f('0x29')],function(_0xdd6a5d){return{'name':_0xdd6a5d['fieldName'],'type':_0xdd6a5d['type'][_0xc03f('0x2a')]};});_0x236859[_0xc03f('0x2b')]=_['map'](_0x27b569,_0xc03f('0x25'));_0x236859[_0xc03f('0x2c')]=_[_0xc03f('0x2d')](_0x4470e8[_0xc03f('0x2c')]);_0x236859['filters']=_[_0xc03f('0x2e')](_0x236859['model'],_0x236859['query']);_0x107956[_0xc03f('0x2f')]=_[_0xc03f('0x2e')](_0x236859[_0xc03f('0x2b')],qs[_0xc03f('0x30')](_0x4470e8[_0xc03f('0x2c')][_0xc03f('0x30')]));_0x107956['attributes']=_0x107956[_0xc03f('0x2f')][_0xc03f('0x31')]?_0x107956[_0xc03f('0x2f')]:_0x236859['model'];if(!_0x4470e8['query']['hasOwnProperty'](_0xc03f('0x32'))){_0x107956['limit']=qs[_0xc03f('0x1b')](_0x4470e8['query'][_0xc03f('0x1b')]);_0x107956[_0xc03f('0x1e')]=qs[_0xc03f('0x1e')](_0x4470e8[_0xc03f('0x2c')][_0xc03f('0x1e')]);}_0x107956[_0xc03f('0x33')]=qs[_0xc03f('0x34')](_0x4470e8[_0xc03f('0x2c')][_0xc03f('0x34')]);_0x107956['where']=qs[_0xc03f('0x35')](_['pick'](_0x4470e8['query'],_0x236859['filters']),_0x27b569);if(_0x4470e8['query'][_0xc03f('0x36')]){_0x107956['where']=_[_0xc03f('0x37')](_0x107956[_0xc03f('0x38')],{'$or':_[_0xc03f('0x27')](_0x27b569,function(_0x549500){if(_0x549500[_0xc03f('0x39')]!==_0xc03f('0x3a')){var _0x9ea941={};_0x9ea941[_0x549500[_0xc03f('0x25')]]={'$like':'%'+_0x4470e8[_0xc03f('0x2c')][_0xc03f('0x36')]+'%'};return _0x9ea941;}})});}_0x107956=_[_0xc03f('0x37')]({},_0x107956,_0x4470e8[_0xc03f('0x3b')]);var _0x31b50e={'where':_0x107956[_0xc03f('0x38')]};return db['DeskField'][_0xc03f('0x1d')](_0x31b50e)[_0xc03f('0x22')](function(_0xee6371){_0x551653[_0xc03f('0x1d')]=_0xee6371;if(_0x4470e8[_0xc03f('0x2c')][_0xc03f('0x3c')]){_0x107956[_0xc03f('0x3d')]=[{'all':!![]}];}return db[_0xc03f('0x28')]['findAll'](_0x107956);})[_0xc03f('0x22')](function(_0x8c200e){_0x551653['rows']=_0x8c200e;return _0x551653;})['then'](respondWithFilteredResult(_0x2a7b27,_0x107956))['catch'](handleError(_0x2a7b27,null));};exports[_0xc03f('0x3e')]=function(_0x5894fc,_0x21ee60){var _0x68e50={'raw':!![],'where':{'id':_0x5894fc[_0xc03f('0x3f')]['id']}},_0x11b9db={};_0x11b9db[_0xc03f('0x2b')]=_[_0xc03f('0x2d')](db[_0xc03f('0x28')][_0xc03f('0x29')]);_0x11b9db['query']=_[_0xc03f('0x2d')](_0x5894fc[_0xc03f('0x2c')]);_0x11b9db[_0xc03f('0x35')]=_[_0xc03f('0x2e')](_0x11b9db[_0xc03f('0x2b')],_0x11b9db[_0xc03f('0x2c')]);_0x68e50[_0xc03f('0x2f')]=_[_0xc03f('0x2e')](_0x11b9db['model'],qs[_0xc03f('0x30')](_0x5894fc[_0xc03f('0x2c')]['fields']));_0x68e50[_0xc03f('0x2f')]=_0x68e50[_0xc03f('0x2f')][_0xc03f('0x31')]?_0x68e50[_0xc03f('0x2f')]:_0x11b9db['model'];if(_0x5894fc[_0xc03f('0x2c')]['includeAll']){_0x68e50['include']=[{'all':!![]}];}_0x68e50=_['merge']({},_0x68e50,_0x5894fc[_0xc03f('0x3b')]);return db[_0xc03f('0x28')]['find'](_0x68e50)[_0xc03f('0x22')](handleEntityNotFound(_0x21ee60,null))['then'](respondWithResult(_0x21ee60,null))[_0xc03f('0x40')](handleError(_0x21ee60,null));};exports[_0xc03f('0x41')]=function(_0x2536c9,_0x891788){return db['DeskField']['create'](_0x2536c9[_0xc03f('0x42')],{})[_0xc03f('0x22')](respondWithResult(_0x891788,0xc9))[_0xc03f('0x40')](handleError(_0x891788,null));};exports[_0xc03f('0x43')]=function(_0x4b5601,_0x3fe69c){if(_0x4b5601['body']['id']){delete _0x4b5601[_0xc03f('0x42')]['id'];}return db[_0xc03f('0x28')]['find']({'where':{'id':_0x4b5601['params']['id']}})['then'](handleEntityNotFound(_0x3fe69c,null))[_0xc03f('0x22')](saveUpdates(_0x4b5601[_0xc03f('0x42')],null))['then'](respondWithResult(_0x3fe69c,null))[_0xc03f('0x40')](handleError(_0x3fe69c,null));};exports[_0xc03f('0x21')]=function(_0x2030a9,_0x34c716){return db[_0xc03f('0x28')]['find']({'where':{'id':_0x2030a9[_0xc03f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x34c716,null))[_0xc03f('0x22')](removeEntity(_0x34c716,null))[_0xc03f('0x40')](handleError(_0x34c716,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6e0e4f8..8ef55b9 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 _0x49af=['int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','define'];(function(_0x3df04e,_0x333c95){var _0x5c1c69=function(_0x260e9e){while(--_0x260e9e){_0x3df04e['push'](_0x3df04e['shift']());}};_0x5c1c69(++_0x333c95);}(_0x49af,0x1a8));var _0xf49a=function(_0x14349e,_0x38d20b){_0x14349e=_0x14349e-0x0;var _0x16d9e8=_0x49af[_0x14349e];return _0x16d9e8;};'use strict';var _=require(_0xf49a('0x0'));var util=require(_0xf49a('0x1'));var logger=require(_0xf49a('0x2'))(_0xf49a('0x3'));var moment=require(_0xf49a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf49a('0x5'));var rimraf=require(_0xf49a('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x32eefb,_0x138bb9){return _0x32eefb[_0xf49a('0x7')]('DeskField',attributes,{'tableName':_0xf49a('0x8'),'paranoid':![],'indexes':[{'name':_0xf49a('0x9'),'fields':[_0xf49a('0xa'),_0xf49a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92f6=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField'];(function(_0x196f40,_0x417e6e){var _0x544d7b=function(_0x46c19c){while(--_0x46c19c){_0x196f40['push'](_0x196f40['shift']());}};_0x544d7b(++_0x417e6e);}(_0x92f6,0x138));var _0x692f=function(_0x16ab80,_0x17ce26){_0x16ab80=_0x16ab80-0x0;var _0x3d0d78=_0x92f6[_0x16ab80];return _0x3d0d78;};'use strict';var _=require('lodash');var util=require(_0x692f('0x0'));var logger=require(_0x692f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x692f('0x2'));var rp=require(_0x692f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x692f('0x4'));var config=require(_0x692f('0x5'));var attributes=require(_0x692f('0x6'));module[_0x692f('0x7')]=function(_0x449f29,_0x3010d9){return _0x449f29[_0x692f('0x8')]('DeskField',attributes,{'tableName':_0x692f('0x9'),'paranoid':![],'indexes':[{'name':_0x692f('0xa'),'fields':[_0x692f('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 5881e64..ab3a8ac 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 _0xd7c3=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x32ab72,_0x47dd1b){var _0x83eea5=function(_0x5dc26c){while(--_0x5dc26c){_0x32ab72['push'](_0x32ab72['shift']());}};_0x83eea5(++_0x47dd1b);}(_0xd7c3,0x1c6));var _0x3d7c=function(_0x51c1b8,_0x222df4){_0x51c1b8=_0x51c1b8-0x0;var _0x2a56ca=_0xd7c3[_0x51c1b8];return _0x2a56ca;};'use strict';var _=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var moment=require(_0x3d7c('0x2'));var BPromise=require(_0x3d7c('0x3'));var rs=require(_0x3d7c('0x4'));var fs=require('fs');var Redis=require(_0x3d7c('0x5'));var db=require(_0x3d7c('0x6'))['db'];var utils=require(_0x3d7c('0x7'));var logger=require(_0x3d7c('0x8'))(_0x3d7c('0x9'));var config=require('../../config/environment');var jayson=require(_0x3d7c('0xa'));var client=jayson['client'][_0x3d7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a62d1,_0x1218c8,_0x81cc8){return new BPromise(function(_0x25aef0,_0x11a459){return client[_0x3d7c('0xc')](_0x5a62d1,_0x81cc8)[_0x3d7c('0xd')](function(_0x27be8a){logger['info'](_0x3d7c('0xe'),_0x1218c8,_0x3d7c('0xf'));logger['debug'](_0x3d7c('0x10'),_0x1218c8,_0x3d7c('0xf'),JSON[_0x3d7c('0x11')](_0x27be8a));if(_0x27be8a['error']){if(_0x27be8a[_0x3d7c('0x12')]['code']===0x1f4){logger[_0x3d7c('0x12')]('DeskField,\x20%s,\x20%s',_0x1218c8,_0x27be8a[_0x3d7c('0x12')]['message']);return _0x11a459(_0x27be8a['error'][_0x3d7c('0x13')]);}logger['error'](_0x3d7c('0xe'),_0x1218c8,_0x27be8a['error'][_0x3d7c('0x13')]);return _0x25aef0(_0x27be8a[_0x3d7c('0x12')][_0x3d7c('0x13')]);}else{logger[_0x3d7c('0x14')](_0x3d7c('0xe'),_0x1218c8,_0x3d7c('0xf'));_0x25aef0(_0x27be8a[_0x3d7c('0x15')][_0x3d7c('0x13')]);}})[_0x3d7c('0x16')](function(_0x10b646){logger[_0x3d7c('0x12')](_0x3d7c('0xe'),_0x1218c8,_0x10b646);_0x11a459(_0x10b646);});});} \ No newline at end of file +var _0x4813=['then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x433ad6,_0x233115){var _0x2ad817=function(_0xbf292c){while(--_0xbf292c){_0x433ad6['push'](_0x433ad6['shift']());}};_0x2ad817(++_0x233115);}(_0x4813,0x95));var _0x3481=function(_0x50f6c5,_0x12b2eb){_0x50f6c5=_0x50f6c5-0x0;var _0x2e623f=_0x4813[_0x50f6c5];return _0x2e623f;};'use strict';var _=require(_0x3481('0x0'));var util=require(_0x3481('0x1'));var moment=require('moment');var BPromise=require(_0x3481('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3481('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3481('0x4'));var logger=require(_0x3481('0x5'))(_0x3481('0x6'));var config=require(_0x3481('0x7'));var jayson=require(_0x3481('0x8'));var client=jayson[_0x3481('0x9')][_0x3481('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x337529,_0x3c3dd0,_0x1f81d5){return new BPromise(function(_0x2bf9ad,_0x1c0f45){return client['request'](_0x337529,_0x1f81d5)[_0x3481('0xb')](function(_0x21eb08){logger['info'](_0x3481('0xc'),_0x3c3dd0,_0x3481('0xd'));logger[_0x3481('0xe')](_0x3481('0xf'),_0x3c3dd0,'request\x20sent',JSON['stringify'](_0x21eb08));if(_0x21eb08[_0x3481('0x10')]){if(_0x21eb08[_0x3481('0x10')]['code']===0x1f4){logger[_0x3481('0x10')](_0x3481('0xc'),_0x3c3dd0,_0x21eb08['error']['message']);return _0x1c0f45(_0x21eb08[_0x3481('0x10')][_0x3481('0x11')]);}logger[_0x3481('0x10')](_0x3481('0xc'),_0x3c3dd0,_0x21eb08[_0x3481('0x10')][_0x3481('0x11')]);return _0x2bf9ad(_0x21eb08[_0x3481('0x10')]['message']);}else{logger['info'](_0x3481('0xc'),_0x3c3dd0,_0x3481('0xd'));_0x2bf9ad(_0x21eb08[_0x3481('0x12')][_0x3481('0x11')]);}})[_0x3481('0x13')](function(_0x36d8da){logger['error'](_0x3481('0xc'),_0x3c3dd0,_0x36d8da);_0x1c0f45(_0x36d8da);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6e213bc..f504262 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 _0xd982=['/:id','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index'];(function(_0x447338,_0x31ddb3){var _0x5e4ffd=function(_0x118347){while(--_0x118347){_0x447338['push'](_0x447338['shift']());}};_0x5e4ffd(++_0x31ddb3);}(_0xd982,0x67));var _0x2d98=function(_0x4a21cb,_0x1b0e50){_0x4a21cb=_0x4a21cb-0x0;var _0x584789=_0xd982[_0x4a21cb];return _0x584789;};'use strict';var multer=require(_0x2d98('0x0'));var util=require(_0x2d98('0x1'));var path=require(_0x2d98('0x2'));var timeout=require(_0x2d98('0x3'));var express=require(_0x2d98('0x4'));var router=express[_0x2d98('0x5')]();var fs_extra=require(_0x2d98('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2d98('0x7'));var controller=require(_0x2d98('0x8'));router[_0x2d98('0x9')]('/',auth[_0x2d98('0xa')](),controller[_0x2d98('0xb')]);router[_0x2d98('0x9')](_0x2d98('0xc'),auth[_0x2d98('0xa')](),controller['show']);router[_0x2d98('0x9')]('/:id/configurations',auth[_0x2d98('0xa')](),controller['getConfigurations']);router[_0x2d98('0x9')](_0x2d98('0xd'),auth[_0x2d98('0xa')](),controller['getFields']);router[_0x2d98('0xe')]('/',auth[_0x2d98('0xa')](),controller[_0x2d98('0xf')]);router[_0x2d98('0xe')](_0x2d98('0x10'),auth[_0x2d98('0xa')](),controller[_0x2d98('0x11')]);router[_0x2d98('0x12')](_0x2d98('0xc'),auth[_0x2d98('0xa')](),controller[_0x2d98('0x13')]);router[_0x2d98('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x2d98('0x15')]);module[_0x2d98('0x16')]=router; \ No newline at end of file +var _0x04e7=['destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','/:id','update','delete'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x04e7,0xa3));var _0x704e=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x04e7[_0x3f6565];return _0x4abd23;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x704e('0x0'));var timeout=require(_0x704e('0x1'));var express=require('express');var router=express[_0x704e('0x2')]();var fs_extra=require(_0x704e('0x3'));var auth=require(_0x704e('0x4'));var interaction=require(_0x704e('0x5'));var config=require(_0x704e('0x6'));var controller=require(_0x704e('0x7'));router[_0x704e('0x8')]('/',auth[_0x704e('0x9')](),controller[_0x704e('0xa')]);router[_0x704e('0x8')]('/:id',auth[_0x704e('0x9')](),controller[_0x704e('0xb')]);router['get']('/:id/configurations',auth[_0x704e('0x9')](),controller[_0x704e('0xc')]);router[_0x704e('0x8')](_0x704e('0xd'),auth[_0x704e('0x9')](),controller[_0x704e('0xe')]);router[_0x704e('0xf')]('/',auth[_0x704e('0x9')](),controller[_0x704e('0x10')]);router['post'](_0x704e('0x11'),auth[_0x704e('0x9')](),controller['addConfiguration']);router['put'](_0x704e('0x12'),auth[_0x704e('0x9')](),controller[_0x704e('0x13')]);router[_0x704e('0x14')](_0x704e('0x12'),auth[_0x704e('0x9')](),controller[_0x704e('0x15')]);module[_0x704e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6a35cd0..1f4a63d 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 _0x5081=['exports','STRING','sequelize'];(function(_0x5a48fd,_0x3592bb){var _0x263659=function(_0xddb66d){while(--_0xddb66d){_0x5a48fd['push'](_0x5a48fd['shift']());}};_0x263659(++_0x3592bb);}(_0x5081,0x1a0));var _0x1508=function(_0x421968,_0x597958){_0x421968=_0x421968-0x0;var _0x306dae=_0x5081[_0x421968];return _0x306dae;};'use strict';var Sequelize=require(_0x1508('0x0'));module[_0x1508('0x1')]={'name':{'type':Sequelize[_0x1508('0x2')]},'username':{'type':Sequelize[_0x1508('0x2')]},'password':{'type':Sequelize[_0x1508('0x2')]},'remoteUri':{'type':Sequelize[_0x1508('0x2')]},'tenantId':{'type':Sequelize[_0x1508('0x2')]},'clientId':{'type':Sequelize[_0x1508('0x2')]},'clientSecret':{'type':Sequelize[_0x1508('0x2')]},'serverUrl':{'type':Sequelize[_0x1508('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1508('0x2')]}}; \ No newline at end of file +var _0x23a6=['exports','STRING','sequelize'];(function(_0x40f3e9,_0x3710cf){var _0x5db154=function(_0x1570e1){while(--_0x1570e1){_0x40f3e9['push'](_0x40f3e9['shift']());}};_0x5db154(++_0x3710cf);}(_0x23a6,0x10d));var _0x623a=function(_0x4e3d18,_0x94e280){_0x4e3d18=_0x4e3d18-0x0;var _0x2e013b=_0x23a6[_0x4e3d18];return _0x2e013b;};'use strict';var Sequelize=require(_0x623a('0x0'));module[_0x623a('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x623a('0x2')]},'password':{'type':Sequelize[_0x623a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x623a('0x2')]},'clientId':{'type':Sequelize[_0x623a('0x2')]},'clientSecret':{'type':Sequelize[_0x623a('0x2')]},'serverUrl':{'type':Sequelize[_0x623a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x623a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d3a5cb1..9e6cbf2 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 _0xa73a=['params','length','include','find','create','body','getConfigurations','Dynamics365Configuration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','description','customerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','password','remoteUri','tenantId','substring','lastIndexOf','format','POST','https://login.microsoftonline.com/','clientId','clientSecret','access_token','GET','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','LogicalName','@odata.type','PicklistAttributeMetadata','MetadataId','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','map','Dynamics365Account','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa73a,0x82));var _0xaa73=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xa73a[_0x39f34f];return _0x59fee1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa73('0x0'));var zipdir=require(_0xaa73('0x1'));var jsonpatch=require(_0xaa73('0x2'));var rp=require(_0xaa73('0x3'));var moment=require(_0xaa73('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaa73('0x5'));var sox=require(_0xaa73('0x6'));var csv=require(_0xaa73('0x7'));var ejs=require(_0xaa73('0x8'));var fs=require('fs');var fs_extra=require(_0xaa73('0x9'));var _=require(_0xaa73('0xa'));var squel=require(_0xaa73('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa73('0xc'));var toCsv=require(_0xaa73('0x7'));var querystring=require(_0xaa73('0xd'));var Papa=require(_0xaa73('0xe'));var Redis=require(_0xaa73('0xf'));var authService=require(_0xaa73('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa73('0x11'));var logger=require('../../config/logger')(_0xaa73('0x12'));var utils=require('../../config/utils');var config=require(_0xaa73('0x13'));var licenseUtil=require(_0xaa73('0x14'));var db=require(_0xaa73('0x15'))['db'];var integrations=require(_0xaa73('0x16'));function respondWithStatusCode(_0x44915e,_0x213aa1){_0x213aa1=_0x213aa1||0xcc;return function(_0x5e3bba){if(_0x5e3bba){return _0x44915e[_0xaa73('0x17')](_0x213aa1);}return _0x44915e[_0xaa73('0x18')](_0x213aa1)[_0xaa73('0x19')]();};}function respondWithResult(_0x457922,_0xc4a8e){_0xc4a8e=_0xc4a8e||0xc8;return function(_0x319e55){if(_0x319e55){return _0x457922[_0xaa73('0x18')](_0xc4a8e)[_0xaa73('0x1a')](_0x319e55);}};}function respondWithFilteredResult(_0x339c82,_0x5a4174){return function(_0x409d07){if(_0x409d07){var _0x5e2932=typeof _0x5a4174[_0xaa73('0x1b')]===_0xaa73('0x1c')&&typeof _0x5a4174[_0xaa73('0x1d')]==='undefined';var _0x5ed9d6=_0x409d07[_0xaa73('0x1e')];var _0x5cc83b=_0x5e2932?0x0:_0x5a4174[_0xaa73('0x1b')];var _0x388ded=_0x5e2932?_0x409d07['count']:_0x5a4174[_0xaa73('0x1b')]+_0x5a4174[_0xaa73('0x1d')];var _0x2de907;if(_0x388ded>=_0x5ed9d6){_0x388ded=_0x5ed9d6;_0x2de907=0xc8;}else{_0x2de907=0xce;}_0x339c82[_0xaa73('0x18')](_0x2de907);return _0x339c82[_0xaa73('0x1f')](_0xaa73('0x20'),_0x5cc83b+'-'+_0x388ded+'/'+_0x5ed9d6)['json'](_0x409d07);}return null;};}function patchUpdates(_0x551790){return function(_0x53d9e8){try{jsonpatch[_0xaa73('0x21')](_0x53d9e8,_0x551790,!![]);}catch(_0x3f5c37){return BPromise[_0xaa73('0x22')](_0x3f5c37);}return _0x53d9e8[_0xaa73('0x23')]();};}function saveUpdates(_0x53b746,_0x5ac0c5){return function(_0x5303eb){if(_0x5303eb){return _0x5303eb[_0xaa73('0x24')](_0x53b746)[_0xaa73('0x25')](function(_0x2d7798){return _0x2d7798;});}return null;};}function removeEntity(_0x346d57,_0x482795){return function(_0x233764){if(_0x233764){return _0x233764[_0xaa73('0x26')]()[_0xaa73('0x25')](function(){_0x346d57['status'](0xcc)[_0xaa73('0x19')]();});}};}function handleEntityNotFound(_0x88731,_0x2e34a8){return function(_0x16cc63){if(!_0x16cc63){_0x88731[_0xaa73('0x17')](0x194);}return _0x16cc63;};}function handleError(_0x1253aa,_0x1ed112){_0x1ed112=_0x1ed112||0x1f4;return function(_0x3ab19f){logger['error'](_0x3ab19f['stack']);if(_0x3ab19f['name']){delete _0x3ab19f[_0xaa73('0x27')];}_0x1253aa['status'](_0x1ed112)['send'](_0x3ab19f);};}exports['index']=function(_0x7b7f86,_0x344e31){var _0x5613a4={},_0x532ded={},_0x5ce12c={'count':0x0,'rows':[]};var _0x35e714=_[_0xaa73('0x28')](db[_0xaa73('0x29')][_0xaa73('0x2a')],function(_0x4d69f0){return{'name':_0x4d69f0[_0xaa73('0x2b')],'type':_0x4d69f0['type'][_0xaa73('0x2c')]};});_0x532ded['model']=_['map'](_0x35e714,_0xaa73('0x27'));_0x532ded[_0xaa73('0x2d')]=_[_0xaa73('0x2e')](_0x7b7f86[_0xaa73('0x2d')]);_0x532ded['filters']=_[_0xaa73('0x2f')](_0x532ded[_0xaa73('0x30')],_0x532ded[_0xaa73('0x2d')]);_0x5613a4[_0xaa73('0x31')]=_[_0xaa73('0x2f')](_0x532ded[_0xaa73('0x30')],qs[_0xaa73('0x32')](_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x32')]));_0x5613a4['attributes']=_0x5613a4['attributes']['length']?_0x5613a4[_0xaa73('0x31')]:_0x532ded[_0xaa73('0x30')];if(!_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x33')](_0xaa73('0x34'))){_0x5613a4[_0xaa73('0x1d')]=qs[_0xaa73('0x1d')](_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x1d')]);_0x5613a4[_0xaa73('0x1b')]=qs['offset'](_0x7b7f86['query'][_0xaa73('0x1b')]);}_0x5613a4[_0xaa73('0x35')]=qs[_0xaa73('0x36')](_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x36')]);_0x5613a4[_0xaa73('0x37')]=qs[_0xaa73('0x38')](_[_0xaa73('0x39')](_0x7b7f86['query'],_0x532ded[_0xaa73('0x38')]),_0x35e714);if(_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x3a')]){_0x5613a4[_0xaa73('0x37')]=_[_0xaa73('0x3b')](_0x5613a4[_0xaa73('0x37')],{'$or':_['map'](_0x35e714,function(_0x448f8c){if(_0x448f8c[_0xaa73('0x3c')]!==_0xaa73('0x3d')){var _0x10f145={};_0x10f145[_0x448f8c['name']]={'$like':'%'+_0x7b7f86[_0xaa73('0x2d')]['filter']+'%'};return _0x10f145;}})});}_0x5613a4=_['merge']({},_0x5613a4,_0x7b7f86[_0xaa73('0x3e')]);var _0x309e6c={'where':_0x5613a4['where']};return db['Dynamics365Account']['count'](_0x309e6c)['then'](function(_0x639e19){_0x5ce12c[_0xaa73('0x1e')]=_0x639e19;if(_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x3f')]){_0x5613a4['include']=[{'all':!![]}];}return db[_0xaa73('0x29')][_0xaa73('0x40')](_0x5613a4);})[_0xaa73('0x25')](function(_0x474847){_0x5ce12c[_0xaa73('0x41')]=_0x474847;return _0x5ce12c;})['then'](respondWithFilteredResult(_0x344e31,_0x5613a4))[_0xaa73('0x42')](handleError(_0x344e31,null));};exports[_0xaa73('0x43')]=function(_0x28d590,_0x534e41){var _0x3ba022={'raw':![],'where':{'id':_0x28d590[_0xaa73('0x44')]['id']}},_0x2ba630={};_0x2ba630[_0xaa73('0x30')]=_[_0xaa73('0x2e')](db[_0xaa73('0x29')][_0xaa73('0x2a')]);_0x2ba630[_0xaa73('0x2d')]=_['keys'](_0x28d590[_0xaa73('0x2d')]);_0x2ba630[_0xaa73('0x38')]=_[_0xaa73('0x2f')](_0x2ba630[_0xaa73('0x30')],_0x2ba630[_0xaa73('0x2d')]);_0x3ba022[_0xaa73('0x31')]=_[_0xaa73('0x2f')](_0x2ba630['model'],qs['fields'](_0x28d590[_0xaa73('0x2d')][_0xaa73('0x32')]));_0x3ba022[_0xaa73('0x31')]=_0x3ba022[_0xaa73('0x31')][_0xaa73('0x45')]?_0x3ba022['attributes']:_0x2ba630[_0xaa73('0x30')];if(_0x28d590[_0xaa73('0x2d')][_0xaa73('0x3f')]){_0x3ba022[_0xaa73('0x46')]=[{'all':!![]}];}_0x3ba022=_[_0xaa73('0x3b')]({},_0x3ba022,_0x28d590[_0xaa73('0x3e')]);return db[_0xaa73('0x29')][_0xaa73('0x47')](_0x3ba022)['then'](handleEntityNotFound(_0x534e41,null))[_0xaa73('0x25')](respondWithResult(_0x534e41,null))[_0xaa73('0x42')](handleError(_0x534e41,null));};exports['create']=function(_0x5d9a5b,_0x341d2c){return db['Dynamics365Account'][_0xaa73('0x48')](_0x5d9a5b['body'],{})['then'](respondWithResult(_0x341d2c,0xc9))[_0xaa73('0x42')](handleError(_0x341d2c,null));};exports[_0xaa73('0x24')]=function(_0x2dd8e0,_0x1f6cde){if(_0x2dd8e0[_0xaa73('0x49')]['id']){delete _0x2dd8e0[_0xaa73('0x49')]['id'];}return db[_0xaa73('0x29')][_0xaa73('0x47')]({'where':{'id':_0x2dd8e0['params']['id']}})[_0xaa73('0x25')](handleEntityNotFound(_0x1f6cde,null))[_0xaa73('0x25')](saveUpdates(_0x2dd8e0['body'],null))[_0xaa73('0x25')](respondWithResult(_0x1f6cde,null))[_0xaa73('0x42')](handleError(_0x1f6cde,null));};exports[_0xaa73('0x26')]=function(_0x4ac6c8,_0x5a5032){return db['Dynamics365Account'][_0xaa73('0x47')]({'where':{'id':_0x4ac6c8['params']['id']}})['then'](handleEntityNotFound(_0x5a5032,null))[_0xaa73('0x25')](removeEntity(_0x5a5032,null))['catch'](handleError(_0x5a5032,null));};exports[_0xaa73('0x4a')]=function(_0x4ca2b7,_0x4dee94,_0x1d658f){var _0x590179={};var _0x18a96f={};var _0x3098bb;var _0x3501cb;return db[_0xaa73('0x29')]['findOne']({'where':{'id':_0x4ca2b7[_0xaa73('0x44')]['id']}})[_0xaa73('0x25')](handleEntityNotFound(_0x4dee94,null))['then'](function(_0x38f984){if(_0x38f984){_0x3098bb=_0x38f984;_0x18a96f[_0xaa73('0x30')]=_[_0xaa73('0x2e')](db[_0xaa73('0x4b')]['rawAttributes']);_0x18a96f[_0xaa73('0x2d')]=_[_0xaa73('0x2e')](_0x4ca2b7['query']);_0x18a96f['filters']=_[_0xaa73('0x2f')](_0x18a96f[_0xaa73('0x30')],_0x18a96f[_0xaa73('0x2d')]);_0x590179[_0xaa73('0x31')]=_[_0xaa73('0x2f')](_0x18a96f[_0xaa73('0x30')],qs[_0xaa73('0x32')](_0x4ca2b7[_0xaa73('0x2d')]['fields']));_0x590179[_0xaa73('0x31')]=_0x590179[_0xaa73('0x31')][_0xaa73('0x45')]?_0x590179[_0xaa73('0x31')]:_0x18a96f['model'];_0x590179['order']=qs['sort'](_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x36')]);_0x590179[_0xaa73('0x37')]=qs[_0xaa73('0x38')](_['pick'](_0x4ca2b7[_0xaa73('0x2d')],_0x18a96f[_0xaa73('0x38')]));if(_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x3a')]){_0x590179['where']=_['merge'](_0x590179[_0xaa73('0x37')],{'$or':_[_0xaa73('0x28')](_0x590179[_0xaa73('0x31')],function(_0x19217e){var _0x50e654={};_0x50e654[_0x19217e]={'$like':'%'+_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x3a')]+'%'};return _0x50e654;})});}_0x590179=_[_0xaa73('0x3b')]({},_0x590179,_0x4ca2b7[_0xaa73('0x3e')]);return _0x3098bb[_0xaa73('0x4a')](_0x590179);}})[_0xaa73('0x25')](function(_0x23c21e){if(_0x23c21e){_0x3501cb=_0x23c21e[_0xaa73('0x45')];if(!_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x33')](_0xaa73('0x34'))){_0x590179[_0xaa73('0x1d')]=qs[_0xaa73('0x1d')](_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x1d')]);_0x590179[_0xaa73('0x1b')]=qs[_0xaa73('0x1b')](_0x4ca2b7['query'][_0xaa73('0x1b')]);}return _0x3098bb[_0xaa73('0x4a')](_0x590179);}})[_0xaa73('0x25')](function(_0x57993c){if(_0x57993c){return _0x57993c?{'count':_0x3501cb,'rows':_0x57993c}:null;}})[_0xaa73('0x25')](respondWithResult(_0x4dee94,null))['catch'](handleError(_0x4dee94,null));};exports['addConfiguration']=function(_0x6a7bd6,_0x545342,_0x3eecd3){if(_0x6a7bd6[_0xaa73('0x49')]['id']){delete _0x6a7bd6[_0xaa73('0x49')]['id'];}return db['Dynamics365Account'][_0xaa73('0x4c')]({'where':{'id':_0x6a7bd6[_0xaa73('0x44')]['id']}})[_0xaa73('0x25')](handleEntityNotFound(_0x545342,null))[_0xaa73('0x25')](function(_0x39b517){if(_0x39b517){_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x4d')]=_0x39b517['id'];_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x4e')]=integrations[_0xaa73('0x4f')](_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x50')],_0x6a7bd6[_0xaa73('0x49')]['type']);_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x51')]=integrations[_0xaa73('0x52')](_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x50')],_0x6a7bd6['body'][_0xaa73('0x3c')]);return db[_0xaa73('0x4b')][_0xaa73('0x48')](_0x6a7bd6[_0xaa73('0x49')],{'include':[{'model':db[_0xaa73('0x53')],'as':'Subjects'},{'model':db[_0xaa73('0x53')],'as':_0xaa73('0x51')}]});}return null;})['then'](respondWithResult(_0x545342,null))[_0xaa73('0x42')](handleError(_0x545342,null));};exports[_0xaa73('0x54')]=function(_0x1c6b41,_0x1b1792,_0x5da602){var _0x28db5f=_0x1c6b41[_0xaa73('0x2d')][_0xaa73('0x55')];var _0x1c61c2=_0x28db5f===_0xaa73('0x56')?_0xaa73('0x57'):'PhoneCall';var _0xdbb7d8='';var _0x8bd6d1='';var _0x517a18='';var _0x48f472='';var _0x942a7='';var _0x548266='';var _0x2f60f3='';var _0x1a53cb='';var _0x3a63b4=['title',_0xaa73('0x58'),_0xaa73('0x59'),'ownerid','caseorigincode',_0xaa73('0x5a'),'phonenumber',_0xaa73('0x5b'),_0xaa73('0x5c'),_0xaa73('0x5d')];var _0xb4dcd3=[_0xaa73('0x5e'),_0xaa73('0x5f'),_0xaa73('0x60'),_0xaa73('0x61'),_0xaa73('0x62'),_0xaa73('0x63'),_0xaa73('0x64'),'contractidname',_0xaa73('0x65'),'createdbyexternalpartyyominame',_0xaa73('0x66'),_0xaa73('0x67'),_0xaa73('0x68'),'createdonbehalfbyname',_0xaa73('0x69'),_0xaa73('0x6a'),_0xaa73('0x6b'),_0xaa73('0x6c'),'emailaddress','entitlementidname','entityimage_timestamp',_0xaa73('0x6d'),_0xaa73('0x6e'),_0xaa73('0x6f'),_0xaa73('0x70'),_0xaa73('0x71'),'importsequencenumber',_0xaa73('0x72'),'kbarticleidname',_0xaa73('0x73'),_0xaa73('0x74'),'modifiedbyexternalpartyname',_0xaa73('0x75'),_0xaa73('0x76'),_0xaa73('0x77'),_0xaa73('0x78'),_0xaa73('0x79'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xaa73('0x7a'),_0xaa73('0x7b'),'onholdtime',_0xaa73('0x7c'),_0xaa73('0x7d'),_0xaa73('0x7e'),'owneridyominame',_0xaa73('0x7f'),_0xaa73('0x80'),'primarycontactidyominame',_0xaa73('0x81'),_0xaa73('0x82'),_0xaa73('0x83'),_0xaa73('0x84'),_0xaa73('0x85'),_0xaa73('0x86'),_0xaa73('0x87'),'responsiblecontactidyominame',_0xaa73('0x88'),'slainvokedidname','slaname',_0xaa73('0x89'),_0xaa73('0x8a'),_0xaa73('0x8b'),_0xaa73('0x8c'),_0xaa73('0x8d'),_0xaa73('0x8e'),_0xaa73('0x8f'),_0xaa73('0x90'),'utcconversiontimezonecode','versionnumber'];var _0x12f2c9=_0x3a63b4[_0xaa73('0x91')](_0xb4dcd3);return db[_0xaa73('0x29')][_0xaa73('0x4c')]({'where':{'id':_0x1c6b41[_0xaa73('0x44')]['id']},'attributes':['id',_0xaa73('0x92'),_0xaa73('0x93'),_0xaa73('0x94'),_0xaa73('0x95'),'clientId','clientSecret']})['then'](handleEntityNotFound(_0x1b1792,null))[_0xaa73('0x25')](function(_0x3cc5fb){if(_0x3cc5fb){_0x1a53cb=_0x3cc5fb[_0xaa73('0x94')];var _0x33fed3=_0x1a53cb['slice'](-0x1);if(_0x33fed3==='/'){_0x1a53cb=_0x1a53cb[_0xaa73('0x96')](0x0,_0x1a53cb[_0xaa73('0x97')](_0x33fed3));}_0x2f60f3=util[_0xaa73('0x98')]('%s/api/data/v9.0/',_0x1a53cb);var _0x45be09={'method':_0xaa73('0x99'),'uri':_0xaa73('0x9a')+_0x3cc5fb[_0xaa73('0x95')]+'/oauth2/token','form':{'client_id':_0x3cc5fb[_0xaa73('0x9b')],'resource':_0x1a53cb,'username':_0x3cc5fb[_0xaa73('0x92')],'password':_0x3cc5fb['password'],'grant_type':_0xaa73('0x93'),'client_secret':_0x3cc5fb[_0xaa73('0x9c')]},'json':!![]};return rp(_0x45be09);}})[_0xaa73('0x25')](function(_0xf9a491){_0x548266=_0xf9a491[_0xaa73('0x9d')];var _0x56122e={'method':_0xaa73('0x9e'),'uri':encodeURI(_0x2f60f3+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1c61c2+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x548266,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x56122e);})[_0xaa73('0x25')](function(_0x20ab60){var _0x94ffeb=_0x20ab60[_0xaa73('0x9f')][0x0];var _0x46c4ae=_0x94ffeb['MetadataId'];var _0x546b78={'method':_0xaa73('0x9e'),'uri':_0x2f60f3+'EntityDefinitions('+_0x46c4ae+_0xaa73('0xa0'),'headers':{'Authorization':_0xaa73('0xa1')+_0x548266,'If-None-Match':null,'OData-Version':_0xaa73('0xa2')},'json':!![]};return rp(_0x546b78);})[_0xaa73('0x25')](function(_0x1e7b64){_0xdbb7d8=_0x1e7b64;_0x8bd6d1=_0xdbb7d8[_0xaa73('0xa3')];_0x8bd6d1=_['remove'](_0x8bd6d1,function(_0x16a55e){return!_0x12f2c9['includes'](_0x16a55e[_0xaa73('0xa4')]);});var _0x2aa375=[];var _0x2f1bf7=[];_0x8bd6d1['forEach'](function(_0x20343d){if(_0x20343d[_0xaa73('0xa5')]){var _0x2ea62c=_0x20343d['@odata.type']['substring'](_0x20343d['@odata.type'][_0xaa73('0x97')]('.')+0x1);if(_0x2ea62c===_0xaa73('0xa6')){_0x2aa375['push'](getSelectList(_0x2f60f3,_0x28db5f,_0x2f1bf7,_0xdbb7d8[_0xaa73('0xa7')],_0x20343d[_0xaa73('0xa7')],_0x548266));}}});return Promise[_0xaa73('0xa8')](_0x2aa375);})['then'](function(_0x9c1eb9){_0x517a18=_0x9c1eb9[0x0];var _0x4f8fdf=[];var _0x2a47df=[];_0x8bd6d1[_0xaa73('0xa9')](function(_0x20d825){if(!_[_0xaa73('0xaa')](_0x20d825[_0xaa73('0xa5')])){var _0x1fde88=_0x20d825[_0xaa73('0xa5')][_0xaa73('0x96')](_0x20d825['@odata.type'][_0xaa73('0x97')]('.')+0x1);if(_0x1fde88===_0xaa73('0xab')){_0x4f8fdf[_0xaa73('0xac')](getBooleanList(_0x2f60f3,_0x28db5f,_0x2a47df,_0xdbb7d8[_0xaa73('0xa7')],_0x20d825[_0xaa73('0xa7')],_0x548266));}}});return Promise[_0xaa73('0xa8')](_0x4f8fdf);})[_0xaa73('0x25')](function(_0x330eb4){_0x48f472=_0x330eb4[0x0];var _0x2bb87f=[];var _0x28417c=[];_0x8bd6d1[_0xaa73('0xa9')](function(_0x1f9e5d){if(_0x1f9e5d[_0xaa73('0xa5')]){var _0x2e3049=_0x1f9e5d[_0xaa73('0xa5')][_0xaa73('0x96')](_0x1f9e5d[_0xaa73('0xa5')][_0xaa73('0x97')]('.')+0x1);if(_0x2e3049===_0xaa73('0xad')||_0x2e3049===_0xaa73('0xae')||_0x2e3049==='BigIntAttributeMetadata'||_0x2e3049===_0xaa73('0xaf')||_0x2e3049===_0xaa73('0xb0')||_0x2e3049==='DateTimeAttributeMetadata'||_0x2e3049==='StatusAttributeMetadata'||_0x2e3049===_0xaa73('0xb1')||_0x2e3049==='StateAttributeMetadata'||_0x2e3049===_0xaa73('0xb2')){_0x2bb87f[_0xaa73('0xac')](getInputList(_0x2f60f3,_0x28db5f,_0x2e3049,_0x28417c,_0xdbb7d8[_0xaa73('0xa7')],_0x1f9e5d[_0xaa73('0xa7')],_0x548266));}}});return Promise['all'](_0x2bb87f);})['then'](function(_0x146c25){_0x942a7=_0x146c25[0x0];var _0x1b3ba9=_0x517a18['concat'](_0x48f472)[_0xaa73('0x91')](_0x942a7);var _0x5904f2={'count':_0x1b3ba9[_0xaa73('0x45')],'rows':_0x1b3ba9};return _0x5904f2;})[_0xaa73('0x25')](respondWithResult(_0x1b1792,null))['catch'](function(_0x276a07){var _0x68e8d9=_0x1c6b41['query'][_0xaa73('0xb3')]?0x1f4:_0x276a07[_0xaa73('0xb4')]||0x1f4;logger[_0xaa73('0xb5')](_0x276a07['stack']);delete _0x276a07[_0xaa73('0x27')];if(_0x68e8d9===0x191){_0x68e8d9=0x190;}_0x1b1792[_0xaa73('0x18')](_0x68e8d9)[_0xaa73('0xb6')](_0x1c6b41['query'][_0xaa73('0xb3')]?{'message':_0xaa73('0xb7'),'statusCode':_0x276a07[_0xaa73('0xb4')]}:_0x276a07);});};function getSelectList(_0x458415,_0x199031,_0x48fc34,_0x5abf96,_0x7885d2,_0xeaebfa){var _0x4ad5fd={'method':_0xaa73('0x9e'),'uri':_0x458415+_0xaa73('0xb8')+_0x5abf96+_0xaa73('0xb9')+_0x7885d2+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xaa73('0xa1')+_0xeaebfa,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4ad5fd)[_0xaa73('0x25')](function(_0x30a8d5){var _0x231812=[];var _0x48f526=_0x30a8d5[_0xaa73('0xba')][_0xaa73('0xbb')];_0x48f526['forEach'](function(_0xbc8113){_0x231812[_0xaa73('0xac')]({'name':_0xbc8113[_0xaa73('0xbc')][_0xaa73('0xbd')][_0xaa73('0xbc')],'value':String(_0xbc8113[_0xaa73('0xbe')])});});var _0xfcd97d={'id':_0x199031+'_'+_0x30a8d5[_0xaa73('0xa4')],'name':_0x30a8d5[_0xaa73('0xbf')][_0xaa73('0xbd')][_0xaa73('0xbc')],'custom':![],'options':_0x231812};_0x48fc34[_0xaa73('0xac')](_0xfcd97d);return _0x48fc34;});}function getBooleanList(_0x2ed8ce,_0xdd17b5,_0x357831,_0x3457c5,_0x5a2444,_0x25e974){var _0x57f510={'method':'GET','uri':_0x2ed8ce+_0xaa73('0xb8')+_0x3457c5+_0xaa73('0xb9')+_0x5a2444+_0xaa73('0xc0'),'headers':{'Authorization':'Bearer\x20'+_0x25e974,'If-None-Match':null,'OData-Version':_0xaa73('0xa2')},'json':!![]};return rp(_0x57f510)[_0xaa73('0x25')](function(_0x20cc24){var _0x3cc480=[];_0x3cc480[_0xaa73('0xac')]({'name':_0x20cc24['OptionSet'][_0xaa73('0xc1')][_0xaa73('0xbc')]['UserLocalizedLabel'][_0xaa73('0xbc')],'value':_0xaa73('0xc2')},{'name':_0x20cc24[_0xaa73('0xba')][_0xaa73('0xc3')][_0xaa73('0xbc')][_0xaa73('0xbd')][_0xaa73('0xbc')],'value':_0xaa73('0xc4')});var _0x41c349={'id':_0xdd17b5+'_'+_0x20cc24[_0xaa73('0xa4')],'name':_0x20cc24[_0xaa73('0xbf')][_0xaa73('0xbd')][_0xaa73('0xbc')],'custom':![],'options':_0x3cc480};_0x357831['push'](_0x41c349);return _0x357831;});}function getInputList(_0x34eefb,_0x3a4966,_0x43591f,_0x3295f5,_0x24d294,_0x257e31,_0x1bfc30){var _0x3eafd0={'method':_0xaa73('0x9e'),'uri':_0x34eefb+_0xaa73('0xb8')+_0x24d294+_0xaa73('0xb9')+_0x257e31+')/Microsoft.Dynamics.CRM.'+_0x43591f+_0xaa73('0xc5'),'headers':{'Authorization':'Bearer\x20'+_0x1bfc30,'If-None-Match':null,'OData-Version':_0xaa73('0xa2')},'json':!![]};return rp(_0x3eafd0)[_0xaa73('0x25')](function(_0x306426){var _0xf41e6b={'id':_0x3a4966+'_'+_0x306426[_0xaa73('0xa4')],'name':_0x306426[_0xaa73('0xbf')]['UserLocalizedLabel']?_0x306426[_0xaa73('0xbf')][_0xaa73('0xbd')][_0xaa73('0xbc')]:_0x306426[_0xaa73('0xa4')],'custom':![],'options':[]};_0x3295f5[_0xaa73('0xac')](_0xf41e6b);return _0x3295f5;});} \ No newline at end of file +var _0xdab2=['getFields','ticketType','incident','PhoneCall','description','customerid','ownerid','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','all','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','Value','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','LogicalName','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','query','keys','filters','model','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','intersection','find','create','body','params','findOne','pick','options','getConfigurations','AccountId','Subjects','getSubjects','channel','Dynamics365Configuration','Dynamics365Field','Descriptions'];(function(_0x1a7a63,_0x152695){var _0x2b4329=function(_0x58288f){while(--_0x58288f){_0x1a7a63['push'](_0x1a7a63['shift']());}};_0x2b4329(++_0x152695);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2dab('0x0'));var rimraf=require(_0x2dab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dab('0x2'));var rp=require(_0x2dab('0x3'));var moment=require(_0x2dab('0x4'));var BPromise=require(_0x2dab('0x5'));var Mustache=require('mustache');var util=require(_0x2dab('0x6'));var path=require(_0x2dab('0x7'));var sox=require(_0x2dab('0x8'));var csv=require(_0x2dab('0x9'));var ejs=require(_0x2dab('0xa'));var fs=require('fs');var fs_extra=require(_0x2dab('0xb'));var _=require(_0x2dab('0xc'));var squel=require(_0x2dab('0xd'));var crypto=require(_0x2dab('0xe'));var jsforce=require(_0x2dab('0xf'));var deskjs=require(_0x2dab('0x10'));var toCsv=require(_0x2dab('0x9'));var querystring=require(_0x2dab('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2dab('0x12'));var qs=require(_0x2dab('0x13'));var as=require(_0x2dab('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2dab('0x15'));var utils=require(_0x2dab('0x16'));var config=require(_0x2dab('0x17'));var licenseUtil=require(_0x2dab('0x18'));var db=require(_0x2dab('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2653c8,_0x263f53){_0x263f53=_0x263f53||0xcc;return function(_0x4b47e1){if(_0x4b47e1){return _0x2653c8[_0x2dab('0x1a')](_0x263f53);}return _0x2653c8[_0x2dab('0x1b')](_0x263f53)[_0x2dab('0x1c')]();};}function respondWithResult(_0x597a6e,_0x4040d8){_0x4040d8=_0x4040d8||0xc8;return function(_0x149867){if(_0x149867){return _0x597a6e['status'](_0x4040d8)[_0x2dab('0x1d')](_0x149867);}};}function respondWithFilteredResult(_0x15a9e7,_0x3e8613){return function(_0x2f64c8){if(_0x2f64c8){var _0x1285d5=typeof _0x3e8613['offset']===_0x2dab('0x1e')&&typeof _0x3e8613[_0x2dab('0x1f')]===_0x2dab('0x1e');var _0x1815ed=_0x2f64c8[_0x2dab('0x20')];var _0x2a86b5=_0x1285d5?0x0:_0x3e8613['offset'];var _0x9436f0=_0x1285d5?_0x2f64c8[_0x2dab('0x20')]:_0x3e8613[_0x2dab('0x21')]+_0x3e8613['limit'];var _0x3340fd;if(_0x9436f0>=_0x1815ed){_0x9436f0=_0x1815ed;_0x3340fd=0xc8;}else{_0x3340fd=0xce;}_0x15a9e7[_0x2dab('0x1b')](_0x3340fd);return _0x15a9e7[_0x2dab('0x22')]('Content-Range',_0x2a86b5+'-'+_0x9436f0+'/'+_0x1815ed)[_0x2dab('0x1d')](_0x2f64c8);}return null;};}function patchUpdates(_0x14e373){return function(_0x114697){try{jsonpatch[_0x2dab('0x23')](_0x114697,_0x14e373,!![]);}catch(_0x2225dd){return BPromise[_0x2dab('0x24')](_0x2225dd);}return _0x114697['save']();};}function saveUpdates(_0x343bfc,_0x321469){return function(_0x4a1c14){if(_0x4a1c14){return _0x4a1c14[_0x2dab('0x25')](_0x343bfc)[_0x2dab('0x26')](function(_0xf16fec){return _0xf16fec;});}return null;};}function removeEntity(_0x37cb08,_0x119d38){return function(_0x115e8c){if(_0x115e8c){return _0x115e8c[_0x2dab('0x27')]()[_0x2dab('0x26')](function(){_0x37cb08[_0x2dab('0x1b')](0xcc)[_0x2dab('0x1c')]();});}};}function handleEntityNotFound(_0x50153d,_0x255478){return function(_0x485443){if(!_0x485443){_0x50153d[_0x2dab('0x1a')](0x194);}return _0x485443;};}function handleError(_0x11454f,_0x594f6f){_0x594f6f=_0x594f6f||0x1f4;return function(_0xeaad91){logger[_0x2dab('0x28')](_0xeaad91[_0x2dab('0x29')]);if(_0xeaad91[_0x2dab('0x2a')]){delete _0xeaad91['name'];}_0x11454f[_0x2dab('0x1b')](_0x594f6f)[_0x2dab('0x2b')](_0xeaad91);};}exports[_0x2dab('0x2c')]=function(_0x2b15c0,_0x31cde1){var _0x577a09={},_0x39a899={},_0x271d4f={'count':0x0,'rows':[]};var _0x2d9f18=_[_0x2dab('0x2d')](db[_0x2dab('0x2e')][_0x2dab('0x2f')],function(_0x1b441d){return{'name':_0x1b441d[_0x2dab('0x30')],'type':_0x1b441d[_0x2dab('0x31')]['key']};});_0x39a899['model']=_['map'](_0x2d9f18,_0x2dab('0x2a'));_0x39a899[_0x2dab('0x32')]=_[_0x2dab('0x33')](_0x2b15c0[_0x2dab('0x32')]);_0x39a899[_0x2dab('0x34')]=_['intersection'](_0x39a899[_0x2dab('0x35')],_0x39a899['query']);_0x577a09['attributes']=_['intersection'](_0x39a899[_0x2dab('0x35')],qs[_0x2dab('0x36')](_0x2b15c0['query']['fields']));_0x577a09[_0x2dab('0x37')]=_0x577a09[_0x2dab('0x37')][_0x2dab('0x38')]?_0x577a09[_0x2dab('0x37')]:_0x39a899[_0x2dab('0x35')];if(!_0x2b15c0[_0x2dab('0x32')]['hasOwnProperty'](_0x2dab('0x39'))){_0x577a09['limit']=qs[_0x2dab('0x1f')](_0x2b15c0[_0x2dab('0x32')][_0x2dab('0x1f')]);_0x577a09[_0x2dab('0x21')]=qs[_0x2dab('0x21')](_0x2b15c0[_0x2dab('0x32')]['offset']);}_0x577a09['order']=qs[_0x2dab('0x3a')](_0x2b15c0[_0x2dab('0x32')][_0x2dab('0x3a')]);_0x577a09[_0x2dab('0x3b')]=qs[_0x2dab('0x34')](_['pick'](_0x2b15c0[_0x2dab('0x32')],_0x39a899[_0x2dab('0x34')]),_0x2d9f18);if(_0x2b15c0[_0x2dab('0x32')][_0x2dab('0x3c')]){_0x577a09[_0x2dab('0x3b')]=_[_0x2dab('0x3d')](_0x577a09[_0x2dab('0x3b')],{'$or':_[_0x2dab('0x2d')](_0x2d9f18,function(_0xf6e9f1){if(_0xf6e9f1[_0x2dab('0x31')]!==_0x2dab('0x3e')){var _0x76a7f7={};_0x76a7f7[_0xf6e9f1['name']]={'$like':'%'+_0x2b15c0[_0x2dab('0x32')]['filter']+'%'};return _0x76a7f7;}})});}_0x577a09=_[_0x2dab('0x3d')]({},_0x577a09,_0x2b15c0['options']);var _0x4efb55={'where':_0x577a09[_0x2dab('0x3b')]};return db[_0x2dab('0x2e')][_0x2dab('0x20')](_0x4efb55)['then'](function(_0x1d2c0a){_0x271d4f[_0x2dab('0x20')]=_0x1d2c0a;if(_0x2b15c0[_0x2dab('0x32')][_0x2dab('0x3f')]){_0x577a09[_0x2dab('0x40')]=[{'all':!![]}];}return db[_0x2dab('0x2e')][_0x2dab('0x41')](_0x577a09);})[_0x2dab('0x26')](function(_0x3d43d4){_0x271d4f[_0x2dab('0x42')]=_0x3d43d4;return _0x271d4f;})['then'](respondWithFilteredResult(_0x31cde1,_0x577a09))[_0x2dab('0x43')](handleError(_0x31cde1,null));};exports['show']=function(_0x53239d,_0x25fd84){var _0x964bad={'raw':![],'where':{'id':_0x53239d['params']['id']}},_0xd53d79={};_0xd53d79['model']=_['keys'](db['Dynamics365Account'][_0x2dab('0x2f')]);_0xd53d79['query']=_[_0x2dab('0x33')](_0x53239d[_0x2dab('0x32')]);_0xd53d79[_0x2dab('0x34')]=_[_0x2dab('0x44')](_0xd53d79[_0x2dab('0x35')],_0xd53d79[_0x2dab('0x32')]);_0x964bad['attributes']=_[_0x2dab('0x44')](_0xd53d79[_0x2dab('0x35')],qs['fields'](_0x53239d[_0x2dab('0x32')][_0x2dab('0x36')]));_0x964bad['attributes']=_0x964bad['attributes'][_0x2dab('0x38')]?_0x964bad[_0x2dab('0x37')]:_0xd53d79[_0x2dab('0x35')];if(_0x53239d[_0x2dab('0x32')]['includeAll']){_0x964bad[_0x2dab('0x40')]=[{'all':!![]}];}_0x964bad=_[_0x2dab('0x3d')]({},_0x964bad,_0x53239d['options']);return db[_0x2dab('0x2e')][_0x2dab('0x45')](_0x964bad)[_0x2dab('0x26')](handleEntityNotFound(_0x25fd84,null))[_0x2dab('0x26')](respondWithResult(_0x25fd84,null))[_0x2dab('0x43')](handleError(_0x25fd84,null));};exports[_0x2dab('0x46')]=function(_0x3b0056,_0x3d5d58){return db[_0x2dab('0x2e')]['create'](_0x3b0056['body'],{})['then'](respondWithResult(_0x3d5d58,0xc9))['catch'](handleError(_0x3d5d58,null));};exports['update']=function(_0x358576,_0x3d17eb){if(_0x358576[_0x2dab('0x47')]['id']){delete _0x358576['body']['id'];}return db[_0x2dab('0x2e')][_0x2dab('0x45')]({'where':{'id':_0x358576[_0x2dab('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d17eb,null))[_0x2dab('0x26')](saveUpdates(_0x358576['body'],null))[_0x2dab('0x26')](respondWithResult(_0x3d17eb,null))[_0x2dab('0x43')](handleError(_0x3d17eb,null));};exports[_0x2dab('0x27')]=function(_0x83d78d,_0x251cd6){return db['Dynamics365Account'][_0x2dab('0x45')]({'where':{'id':_0x83d78d[_0x2dab('0x48')]['id']}})[_0x2dab('0x26')](handleEntityNotFound(_0x251cd6,null))['then'](removeEntity(_0x251cd6,null))['catch'](handleError(_0x251cd6,null));};exports['getConfigurations']=function(_0x3ce70a,_0x2509a7,_0x505605){var _0x1fc189={};var _0xf9fa02={};var _0x40c388;var _0x48c5fb;return db[_0x2dab('0x2e')][_0x2dab('0x49')]({'where':{'id':_0x3ce70a[_0x2dab('0x48')]['id']}})[_0x2dab('0x26')](handleEntityNotFound(_0x2509a7,null))[_0x2dab('0x26')](function(_0x343a3b){if(_0x343a3b){_0x40c388=_0x343a3b;_0xf9fa02['model']=_[_0x2dab('0x33')](db['Dynamics365Configuration'][_0x2dab('0x2f')]);_0xf9fa02[_0x2dab('0x32')]=_['keys'](_0x3ce70a[_0x2dab('0x32')]);_0xf9fa02[_0x2dab('0x34')]=_[_0x2dab('0x44')](_0xf9fa02[_0x2dab('0x35')],_0xf9fa02[_0x2dab('0x32')]);_0x1fc189[_0x2dab('0x37')]=_['intersection'](_0xf9fa02['model'],qs[_0x2dab('0x36')](_0x3ce70a[_0x2dab('0x32')][_0x2dab('0x36')]));_0x1fc189[_0x2dab('0x37')]=_0x1fc189[_0x2dab('0x37')]['length']?_0x1fc189['attributes']:_0xf9fa02[_0x2dab('0x35')];_0x1fc189['order']=qs[_0x2dab('0x3a')](_0x3ce70a['query'][_0x2dab('0x3a')]);_0x1fc189[_0x2dab('0x3b')]=qs[_0x2dab('0x34')](_[_0x2dab('0x4a')](_0x3ce70a['query'],_0xf9fa02[_0x2dab('0x34')]));if(_0x3ce70a[_0x2dab('0x32')][_0x2dab('0x3c')]){_0x1fc189[_0x2dab('0x3b')]=_[_0x2dab('0x3d')](_0x1fc189['where'],{'$or':_[_0x2dab('0x2d')](_0x1fc189['attributes'],function(_0x35aea9){var _0x466c1f={};_0x466c1f[_0x35aea9]={'$like':'%'+_0x3ce70a[_0x2dab('0x32')][_0x2dab('0x3c')]+'%'};return _0x466c1f;})});}_0x1fc189=_[_0x2dab('0x3d')]({},_0x1fc189,_0x3ce70a[_0x2dab('0x4b')]);return _0x40c388[_0x2dab('0x4c')](_0x1fc189);}})[_0x2dab('0x26')](function(_0x390304){if(_0x390304){_0x48c5fb=_0x390304[_0x2dab('0x38')];if(!_0x3ce70a[_0x2dab('0x32')]['hasOwnProperty']('nolimit')){_0x1fc189['limit']=qs[_0x2dab('0x1f')](_0x3ce70a[_0x2dab('0x32')][_0x2dab('0x1f')]);_0x1fc189[_0x2dab('0x21')]=qs[_0x2dab('0x21')](_0x3ce70a[_0x2dab('0x32')][_0x2dab('0x21')]);}return _0x40c388[_0x2dab('0x4c')](_0x1fc189);}})[_0x2dab('0x26')](function(_0x4bd2c8){if(_0x4bd2c8){return _0x4bd2c8?{'count':_0x48c5fb,'rows':_0x4bd2c8}:null;}})['then'](respondWithResult(_0x2509a7,null))['catch'](handleError(_0x2509a7,null));};exports['addConfiguration']=function(_0x4cb9d4,_0x280766,_0x312ffe){if(_0x4cb9d4[_0x2dab('0x47')]['id']){delete _0x4cb9d4[_0x2dab('0x47')]['id'];}return db['Dynamics365Account'][_0x2dab('0x49')]({'where':{'id':_0x4cb9d4['params']['id']}})[_0x2dab('0x26')](handleEntityNotFound(_0x280766,null))[_0x2dab('0x26')](function(_0x3dee29){if(_0x3dee29){_0x4cb9d4[_0x2dab('0x47')][_0x2dab('0x4d')]=_0x3dee29['id'];_0x4cb9d4[_0x2dab('0x47')][_0x2dab('0x4e')]=integrations[_0x2dab('0x4f')](_0x4cb9d4[_0x2dab('0x47')]['channel'],_0x4cb9d4[_0x2dab('0x47')]['type']);_0x4cb9d4[_0x2dab('0x47')]['Descriptions']=integrations['getDescriptions'](_0x4cb9d4[_0x2dab('0x47')][_0x2dab('0x50')],_0x4cb9d4[_0x2dab('0x47')][_0x2dab('0x31')]);return db[_0x2dab('0x51')][_0x2dab('0x46')](_0x4cb9d4[_0x2dab('0x47')],{'include':[{'model':db[_0x2dab('0x52')],'as':_0x2dab('0x4e')},{'model':db[_0x2dab('0x52')],'as':_0x2dab('0x53')}]});}return null;})[_0x2dab('0x26')](respondWithResult(_0x280766,null))[_0x2dab('0x43')](handleError(_0x280766,null));};exports[_0x2dab('0x54')]=function(_0x37e372,_0x4e8094,_0x38c4db){var _0x25f45a=_0x37e372[_0x2dab('0x32')][_0x2dab('0x55')];var _0x1fe75a=_0x25f45a===_0x2dab('0x56')?'Incident':_0x2dab('0x57');var _0x1bf54e='';var _0x51e241='';var _0x3a1280='';var _0x48fd7f='';var _0x21b95b='';var _0x141489='';var _0x50ac32='';var _0x55d84f='';var _0x54cb02=['title',_0x2dab('0x58'),_0x2dab('0x59'),_0x2dab('0x5a'),'caseorigincode','subject',_0x2dab('0x5b'),'regardingobjectid',_0x2dab('0x5c'),_0x2dab('0x5d')];var _0xf089e4=[_0x2dab('0x5e'),_0x2dab('0x5f'),'actualserviceunits',_0x2dab('0x60'),_0x2dab('0x61'),'contactidyominame',_0x2dab('0x62'),'contractidname',_0x2dab('0x63'),_0x2dab('0x64'),'createdbyname','createdbyyominame','createdon',_0x2dab('0x65'),_0x2dab('0x66'),_0x2dab('0x67'),_0x2dab('0x68'),_0x2dab('0x69'),_0x2dab('0x6a'),_0x2dab('0x6b'),_0x2dab('0x6c'),_0x2dab('0x6d'),_0x2dab('0x6e'),'exchangerate','firstresponsebykpiidname',_0x2dab('0x6f'),_0x2dab('0x70'),_0x2dab('0x71'),'kbarticleidname',_0x2dab('0x72'),_0x2dab('0x73'),_0x2dab('0x74'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x2dab('0x75'),_0x2dab('0x76'),'modifiedonbehalfbyname',_0x2dab('0x77'),_0x2dab('0x78'),_0x2dab('0x79'),_0x2dab('0x7a'),_0x2dab('0x7b'),_0x2dab('0x7c'),_0x2dab('0x7d'),_0x2dab('0x7e'),'owneridyominame','parentcaseidname',_0x2dab('0x7f'),_0x2dab('0x80'),_0x2dab('0x81'),_0x2dab('0x82'),'productserialnumber',_0x2dab('0x83'),_0x2dab('0x84'),_0x2dab('0x85'),_0x2dab('0x86'),_0x2dab('0x87'),_0x2dab('0x88'),'slainvokedidname',_0x2dab('0x89'),_0x2dab('0x8a'),'statecode','statuscode',_0x2dab('0x8b'),_0x2dab('0x8c'),_0x2dab('0x8d'),'transactioncurrencyidname','traversedpath',_0x2dab('0x8e'),_0x2dab('0x8f')];var _0x54e43b=_0x54cb02[_0x2dab('0x90')](_0xf089e4);return db[_0x2dab('0x2e')][_0x2dab('0x49')]({'where':{'id':_0x37e372[_0x2dab('0x48')]['id']},'attributes':['id','username',_0x2dab('0x91'),_0x2dab('0x92'),_0x2dab('0x93'),_0x2dab('0x94'),'clientSecret']})[_0x2dab('0x26')](handleEntityNotFound(_0x4e8094,null))[_0x2dab('0x26')](function(_0x146c9d){if(_0x146c9d){_0x55d84f=_0x146c9d['remoteUri'];var _0x5d7b8f=_0x55d84f['slice'](-0x1);if(_0x5d7b8f==='/'){_0x55d84f=_0x55d84f[_0x2dab('0x95')](0x0,_0x55d84f[_0x2dab('0x96')](_0x5d7b8f));}_0x50ac32=util[_0x2dab('0x97')](_0x2dab('0x98'),_0x55d84f);var _0x5efe9c={'method':_0x2dab('0x99'),'uri':_0x2dab('0x9a')+_0x146c9d['tenantId']+'/oauth2/token','form':{'client_id':_0x146c9d[_0x2dab('0x94')],'resource':_0x55d84f,'username':_0x146c9d['username'],'password':_0x146c9d[_0x2dab('0x91')],'grant_type':_0x2dab('0x91'),'client_secret':_0x146c9d['clientSecret']},'json':!![]};return rp(_0x5efe9c);}})[_0x2dab('0x26')](function(_0x947417){_0x141489=_0x947417['access_token'];var _0x19e0fb={'method':_0x2dab('0x9b'),'uri':encodeURI(_0x50ac32+_0x2dab('0x9c')+_0x1fe75a+'\x27'),'headers':{'Authorization':_0x2dab('0x9d')+_0x141489,'If-None-Match':null,'OData-Version':_0x2dab('0x9e')},'json':!![]};return rp(_0x19e0fb);})['then'](function(_0x33d3cb){var _0x562017=_0x33d3cb[_0x2dab('0x9f')][0x0];var _0x159dd5=_0x562017[_0x2dab('0xa0')];var _0x47a503={'method':_0x2dab('0x9b'),'uri':_0x50ac32+_0x2dab('0xa1')+_0x159dd5+_0x2dab('0xa2'),'headers':{'Authorization':_0x2dab('0x9d')+_0x141489,'If-None-Match':null,'OData-Version':_0x2dab('0x9e')},'json':!![]};return rp(_0x47a503);})[_0x2dab('0x26')](function(_0x2a4ace){_0x1bf54e=_0x2a4ace;_0x51e241=_0x1bf54e['Attributes'];_0x51e241=_[_0x2dab('0xa3')](_0x51e241,function(_0x1d9708){return!_0x54e43b[_0x2dab('0xa4')](_0x1d9708['LogicalName']);});var _0x3f3e6a=[];var _0x566e15=[];_0x51e241[_0x2dab('0xa5')](function(_0x5e5585){if(_0x5e5585[_0x2dab('0xa6')]){var _0x4fad82=_0x5e5585[_0x2dab('0xa6')][_0x2dab('0x95')](_0x5e5585['@odata.type'][_0x2dab('0x96')]('.')+0x1);if(_0x4fad82===_0x2dab('0xa7')){_0x3f3e6a[_0x2dab('0xa8')](getSelectList(_0x50ac32,_0x25f45a,_0x566e15,_0x1bf54e[_0x2dab('0xa0')],_0x5e5585[_0x2dab('0xa0')],_0x141489));}}});return Promise['all'](_0x3f3e6a);})[_0x2dab('0x26')](function(_0x19cac1){_0x3a1280=_0x19cac1[0x0];var _0x2871b8=[];var _0x5a0479=[];_0x51e241[_0x2dab('0xa5')](function(_0x55bede){if(!_[_0x2dab('0xa9')](_0x55bede[_0x2dab('0xa6')])){var _0x410b29=_0x55bede[_0x2dab('0xa6')][_0x2dab('0x95')](_0x55bede[_0x2dab('0xa6')][_0x2dab('0x96')]('.')+0x1);if(_0x410b29==='BooleanAttributeMetadata'){_0x2871b8[_0x2dab('0xa8')](getBooleanList(_0x50ac32,_0x25f45a,_0x5a0479,_0x1bf54e['MetadataId'],_0x55bede['MetadataId'],_0x141489));}}});return Promise[_0x2dab('0xaa')](_0x2871b8);})['then'](function(_0x53eb86){_0x48fd7f=_0x53eb86[0x0];var _0x4921dc=[];var _0x1188cb=[];_0x51e241[_0x2dab('0xa5')](function(_0x3dbd96){if(_0x3dbd96[_0x2dab('0xa6')]){var _0x2f34cd=_0x3dbd96[_0x2dab('0xa6')][_0x2dab('0x95')](_0x3dbd96[_0x2dab('0xa6')][_0x2dab('0x96')]('.')+0x1);if(_0x2f34cd===_0x2dab('0xab')||_0x2f34cd==='DoubleAttributeMetadata'||_0x2f34cd==='BigIntAttributeMetadata'||_0x2f34cd===_0x2dab('0xac')||_0x2f34cd===_0x2dab('0xad')||_0x2f34cd===_0x2dab('0xae')||_0x2f34cd===_0x2dab('0xaf')||_0x2f34cd==='EntityNameAttributeMetadata'||_0x2f34cd===_0x2dab('0xb0')||_0x2f34cd===_0x2dab('0xb1')){_0x4921dc[_0x2dab('0xa8')](getInputList(_0x50ac32,_0x25f45a,_0x2f34cd,_0x1188cb,_0x1bf54e[_0x2dab('0xa0')],_0x3dbd96[_0x2dab('0xa0')],_0x141489));}}});return Promise[_0x2dab('0xaa')](_0x4921dc);})[_0x2dab('0x26')](function(_0x4e2f94){_0x21b95b=_0x4e2f94[0x0];var _0x3c7d45=_0x3a1280[_0x2dab('0x90')](_0x48fd7f)[_0x2dab('0x90')](_0x21b95b);var _0x3af557={'count':_0x3c7d45['length'],'rows':_0x3c7d45};return _0x3af557;})['then'](respondWithResult(_0x4e8094,null))['catch'](function(_0x328c9f){var _0x506765=_0x37e372[_0x2dab('0x32')][_0x2dab('0xb2')]?0x1f4:_0x328c9f[_0x2dab('0xb3')]||0x1f4;logger[_0x2dab('0x28')](_0x328c9f['stack']);delete _0x328c9f[_0x2dab('0x2a')];if(_0x506765===0x191){_0x506765=0x190;}_0x4e8094[_0x2dab('0x1b')](_0x506765)[_0x2dab('0x2b')](_0x37e372[_0x2dab('0x32')][_0x2dab('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0x328c9f[_0x2dab('0xb3')]}:_0x328c9f);});};function getSelectList(_0x1918ac,_0x10c174,_0x1dcb3b,_0x8f7c43,_0x2def8c,_0x47f63f){var _0x4e281a={'method':'GET','uri':_0x1918ac+'EntityDefinitions('+_0x8f7c43+_0x2dab('0xb4')+_0x2def8c+_0x2dab('0xb5')+_0x2dab('0xb6'),'headers':{'Authorization':_0x2dab('0x9d')+_0x47f63f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e281a)[_0x2dab('0x26')](function(_0x375d51){var _0x92cdc=[];var _0x230ac1=_0x375d51[_0x2dab('0xb7')]['Options'];_0x230ac1[_0x2dab('0xa5')](function(_0x86e9eb){_0x92cdc[_0x2dab('0xa8')]({'name':_0x86e9eb['Label'][_0x2dab('0xb8')]['Label'],'value':String(_0x86e9eb[_0x2dab('0xb9')])});});var _0x2f512b={'id':_0x10c174+'_'+_0x375d51['LogicalName'],'name':_0x375d51[_0x2dab('0xba')]['UserLocalizedLabel'][_0x2dab('0xbb')],'custom':![],'options':_0x92cdc};_0x1dcb3b['push'](_0x2f512b);return _0x1dcb3b;});}function getBooleanList(_0x316018,_0x56adb7,_0x8b6165,_0x1da782,_0x580cf8,_0x389c82){var _0x4135ef={'method':_0x2dab('0x9b'),'uri':_0x316018+'EntityDefinitions('+_0x1da782+_0x2dab('0xb4')+_0x580cf8+_0x2dab('0xbc'),'headers':{'Authorization':_0x2dab('0x9d')+_0x389c82,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4135ef)[_0x2dab('0x26')](function(_0x61266d){var _0xf20750=[];_0xf20750[_0x2dab('0xa8')]({'name':_0x61266d[_0x2dab('0xb7')][_0x2dab('0xbd')]['Label'][_0x2dab('0xb8')][_0x2dab('0xbb')],'value':_0x2dab('0xbe')},{'name':_0x61266d[_0x2dab('0xb7')]['FalseOption'][_0x2dab('0xbb')][_0x2dab('0xb8')][_0x2dab('0xbb')],'value':_0x2dab('0xbf')});var _0x2e1327={'id':_0x56adb7+'_'+_0x61266d['LogicalName'],'name':_0x61266d[_0x2dab('0xba')][_0x2dab('0xb8')][_0x2dab('0xbb')],'custom':![],'options':_0xf20750};_0x8b6165[_0x2dab('0xa8')](_0x2e1327);return _0x8b6165;});}function getInputList(_0x1cb9ee,_0x19a9b8,_0x1c241f,_0x3ea522,_0x3c1af3,_0x6686c6,_0x2938e6){var _0x36189b={'method':_0x2dab('0x9b'),'uri':_0x1cb9ee+_0x2dab('0xa1')+_0x3c1af3+_0x2dab('0xb4')+_0x6686c6+_0x2dab('0xc0')+_0x1c241f+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x2dab('0x9d')+_0x2938e6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x36189b)[_0x2dab('0x26')](function(_0x2d8940){var _0x12b0d0={'id':_0x19a9b8+'_'+_0x2d8940[_0x2dab('0xc1')],'name':_0x2d8940[_0x2dab('0xba')][_0x2dab('0xb8')]?_0x2d8940[_0x2dab('0xba')]['UserLocalizedLabel']['Label']:_0x2d8940[_0x2dab('0xc1')],'custom':![],'options':[]};_0x3ea522['push'](_0x12b0d0);return _0x3ea522;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b952a0b..e861b94 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1468ee,_0x8356ce){var _0x5cc2cc=function(_0x407f25){while(--_0x407f25){_0x1468ee['push'](_0x1468ee['shift']());}};_0x5cc2cc(++_0x8356ce);}(_0x757a,0xde));var _0xa757=function(_0xd57373,_0xc2fd8e){_0xd57373=_0xd57373-0x0;var _0xdea237=_0x757a[_0xd57373];return _0xdea237;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x181474,_0x619bfd){var _0x20ba09=function(_0x2ed6bb){while(--_0x2ed6bb){_0x181474['push'](_0x181474['shift']());}};_0x20ba09(++_0x619bfd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index ed6ee52..34ad271 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 _0xd73c=['limit','include','map','model','ShowDynamics365Account','find','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes'];(function(_0x2bc2b0,_0x538725){var _0x4f9699=function(_0x54cfd6){while(--_0x54cfd6){_0x2bc2b0['push'](_0x2bc2b0['shift']());}};_0x4f9699(++_0x538725);}(_0xd73c,0x76));var _0xcd73=function(_0x35a447,_0x3e1f5a){_0x35a447=_0x35a447-0x0;var _0x3eea6d=_0xd73c[_0x35a447];return _0x3eea6d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcd73('0x0'));var BPromise=require(_0xcd73('0x1'));var rs=require(_0xcd73('0x2'));var fs=require('fs');var Redis=require(_0xcd73('0x3'));var db=require(_0xcd73('0x4'))['db'];var utils=require(_0xcd73('0x5'));var logger=require('../../config/logger')(_0xcd73('0x6'));var config=require(_0xcd73('0x7'));var jayson=require(_0xcd73('0x8'));var client=jayson[_0xcd73('0x9')][_0xcd73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f596e,_0x4feaf9,_0xc51f21){return new BPromise(function(_0x5f4132,_0x2f9d17){return client[_0xcd73('0xb')](_0x4f596e,_0xc51f21)[_0xcd73('0xc')](function(_0x3476e6){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4feaf9,_0xcd73('0xd'));logger[_0xcd73('0xe')](_0xcd73('0xf'),_0x4feaf9,_0xcd73('0xd'),JSON[_0xcd73('0x10')](_0x3476e6));if(_0x3476e6[_0xcd73('0x11')]){if(_0x3476e6[_0xcd73('0x11')][_0xcd73('0x12')]===0x1f4){logger[_0xcd73('0x11')](_0xcd73('0x13'),_0x4feaf9,_0x3476e6[_0xcd73('0x11')]['message']);return _0x2f9d17(_0x3476e6[_0xcd73('0x11')][_0xcd73('0x14')]);}logger[_0xcd73('0x11')](_0xcd73('0x13'),_0x4feaf9,_0x3476e6['error'][_0xcd73('0x14')]);return _0x5f4132(_0x3476e6[_0xcd73('0x11')][_0xcd73('0x14')]);}else{logger['info'](_0xcd73('0x13'),_0x4feaf9,_0xcd73('0xd'));_0x5f4132(_0x3476e6[_0xcd73('0x15')][_0xcd73('0x14')]);}})[_0xcd73('0x16')](function(_0x27fce4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4feaf9,_0x27fce4);_0x2f9d17(_0x27fce4);});});}exports[_0xcd73('0x17')]=function(_0x5a335){var _0x5d20a9=this;return new Promise(function(_0x266025,_0xc3a011){return db[_0xcd73('0x18')][_0xcd73('0x19')]({'raw':_0x5a335[_0xcd73('0x1a')]?_0x5a335['options'][_0xcd73('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a335[_0xcd73('0x1a')]?_0x5a335[_0xcd73('0x1a')][_0xcd73('0x1c')]||null:null,'attributes':_0x5a335['options']?_0x5a335[_0xcd73('0x1a')][_0xcd73('0x1d')]||null:null,'limit':_0x5a335['options']?_0x5a335['options'][_0xcd73('0x1e')]||null:null,'include':_0x5a335['options']?_0x5a335[_0xcd73('0x1a')][_0xcd73('0x1f')]?_[_0xcd73('0x20')](_0x5a335['options'][_0xcd73('0x1f')],function(_0x26e58e){return{'model':db[_0x26e58e[_0xcd73('0x21')]],'as':_0x26e58e['as'],'attributes':_0x26e58e[_0xcd73('0x1d')],'include':_0x26e58e['include']?_[_0xcd73('0x20')](_0x26e58e['include'],function(_0x196989){return{'model':db[_0x196989['model']],'as':_0x196989['as'],'attributes':_0x196989[_0xcd73('0x1d')],'include':_0x196989['include']?_[_0xcd73('0x20')](_0x196989[_0xcd73('0x1f')],function(_0x32436e){return{'model':db[_0x32436e[_0xcd73('0x21')]],'as':_0x32436e['as'],'attributes':_0x32436e[_0xcd73('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcd73('0xc')](function(_0x14f7c6){logger['info'](_0xcd73('0x17'),_0x5a335);logger['debug']('GetDynamics365Account',_0x5a335,JSON[_0xcd73('0x10')](_0x14f7c6));_0x266025(_0x14f7c6);})[_0xcd73('0x16')](function(_0x252404){logger[_0xcd73('0x11')](_0xcd73('0x17'),_0x252404['message'],_0x5a335);_0xc3a011(_0x5d20a9[_0xcd73('0x11')](0x1f4,_0x252404[_0xcd73('0x14')]));});});};exports[_0xcd73('0x22')]=function(_0x140d7c){var _0x233fed=this;return new Promise(function(_0x4dc8fc,_0x583b15){return db[_0xcd73('0x18')][_0xcd73('0x23')]({'raw':_0x140d7c['options']?_0x140d7c[_0xcd73('0x1a')][_0xcd73('0x1b')]===undefined?!![]:![]:!![],'where':_0x140d7c[_0xcd73('0x1a')]?_0x140d7c['options']['where']||null:null,'attributes':_0x140d7c[_0xcd73('0x1a')]?_0x140d7c['options'][_0xcd73('0x1d')]||null:null,'include':_0x140d7c[_0xcd73('0x1a')]?_0x140d7c[_0xcd73('0x1a')][_0xcd73('0x1f')]?_[_0xcd73('0x20')](_0x140d7c[_0xcd73('0x1a')][_0xcd73('0x1f')],function(_0x503deb){return{'model':db[_0x503deb[_0xcd73('0x21')]],'as':_0x503deb['as'],'attributes':_0x503deb['attributes'],'include':_0x503deb[_0xcd73('0x1f')]?_[_0xcd73('0x20')](_0x503deb[_0xcd73('0x1f')],function(_0x451ddb){return{'model':db[_0x451ddb[_0xcd73('0x21')]],'as':_0x451ddb['as'],'attributes':_0x451ddb[_0xcd73('0x1d')],'include':_0x451ddb[_0xcd73('0x1f')]?_[_0xcd73('0x20')](_0x451ddb[_0xcd73('0x1f')],function(_0x26e7bc){return{'model':db[_0x26e7bc[_0xcd73('0x21')]],'as':_0x26e7bc['as'],'attributes':_0x26e7bc[_0xcd73('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcd73('0xc')](function(_0x13dec1){logger[_0xcd73('0x24')]('ShowDynamics365Account',_0x140d7c);logger[_0xcd73('0xe')](_0xcd73('0x22'),_0x140d7c,JSON[_0xcd73('0x10')](_0x13dec1));_0x4dc8fc(_0x13dec1);})['catch'](function(_0x3c6644){logger[_0xcd73('0x11')]('ShowDynamics365Account',_0x3c6644[_0xcd73('0x14')],_0x140d7c);_0x583b15(_0x233fed[_0xcd73('0x11')](0x1f4,_0x3c6644['message']));});});}; \ No newline at end of file +var _0x7a28=['Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','findAll','options','where','attributes','limit','include','model','map','find','raw','ShowDynamics365Account','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7a28,0x1a0));var _0x87a2=function(_0x2ed404,_0x1f5175){_0x2ed404=_0x2ed404-0x0;var _0x5291f4=_0x7a28[_0x2ed404];return _0x5291f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x87a2('0x0'));var BPromise=require(_0x87a2('0x1'));var rs=require(_0x87a2('0x2'));var fs=require('fs');var Redis=require(_0x87a2('0x3'));var db=require(_0x87a2('0x4'))['db'];var utils=require(_0x87a2('0x5'));var logger=require(_0x87a2('0x6'))(_0x87a2('0x7'));var config=require(_0x87a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x87a2('0x9')][_0x87a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x250759,_0x5f0029,_0x3c458a){return new BPromise(function(_0x55687d,_0x25fe38){return client[_0x87a2('0xb')](_0x250759,_0x3c458a)[_0x87a2('0xc')](function(_0x1f952f){logger['info'](_0x87a2('0xd'),_0x5f0029,_0x87a2('0xe'));logger[_0x87a2('0xf')](_0x87a2('0x10'),_0x5f0029,_0x87a2('0xe'),JSON[_0x87a2('0x11')](_0x1f952f));if(_0x1f952f['error']){if(_0x1f952f[_0x87a2('0x12')][_0x87a2('0x13')]===0x1f4){logger[_0x87a2('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x5f0029,_0x1f952f['error'][_0x87a2('0x14')]);return _0x25fe38(_0x1f952f[_0x87a2('0x12')][_0x87a2('0x14')]);}logger[_0x87a2('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x5f0029,_0x1f952f['error'][_0x87a2('0x14')]);return _0x55687d(_0x1f952f[_0x87a2('0x12')][_0x87a2('0x14')]);}else{logger[_0x87a2('0x15')](_0x87a2('0xd'),_0x5f0029,_0x87a2('0xe'));_0x55687d(_0x1f952f[_0x87a2('0x16')][_0x87a2('0x14')]);}})[_0x87a2('0x17')](function(_0xc750d1){logger['error'](_0x87a2('0xd'),_0x5f0029,_0xc750d1);_0x25fe38(_0xc750d1);});});}exports[_0x87a2('0x18')]=function(_0x5572fc){var _0x369d19=this;return new Promise(function(_0x14332d,_0x1a6061){return db['Dynamics365Account'][_0x87a2('0x19')]({'raw':_0x5572fc[_0x87a2('0x1a')]?_0x5572fc[_0x87a2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5572fc[_0x87a2('0x1a')]?_0x5572fc['options'][_0x87a2('0x1b')]||null:null,'attributes':_0x5572fc[_0x87a2('0x1a')]?_0x5572fc['options'][_0x87a2('0x1c')]||null:null,'limit':_0x5572fc[_0x87a2('0x1a')]?_0x5572fc[_0x87a2('0x1a')][_0x87a2('0x1d')]||null:null,'include':_0x5572fc[_0x87a2('0x1a')]?_0x5572fc['options']['include']?_['map'](_0x5572fc[_0x87a2('0x1a')][_0x87a2('0x1e')],function(_0x51f6a8){return{'model':db[_0x51f6a8[_0x87a2('0x1f')]],'as':_0x51f6a8['as'],'attributes':_0x51f6a8[_0x87a2('0x1c')],'include':_0x51f6a8['include']?_[_0x87a2('0x20')](_0x51f6a8[_0x87a2('0x1e')],function(_0x3da751){return{'model':db[_0x3da751[_0x87a2('0x1f')]],'as':_0x3da751['as'],'attributes':_0x3da751['attributes'],'include':_0x3da751[_0x87a2('0x1e')]?_[_0x87a2('0x20')](_0x3da751[_0x87a2('0x1e')],function(_0x36dfaa){return{'model':db[_0x36dfaa[_0x87a2('0x1f')]],'as':_0x36dfaa['as'],'attributes':_0x36dfaa[_0x87a2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x523d09){logger['info'](_0x87a2('0x18'),_0x5572fc);logger['debug'](_0x87a2('0x18'),_0x5572fc,JSON[_0x87a2('0x11')](_0x523d09));_0x14332d(_0x523d09);})['catch'](function(_0x48186b){logger['error'](_0x87a2('0x18'),_0x48186b[_0x87a2('0x14')],_0x5572fc);_0x1a6061(_0x369d19[_0x87a2('0x12')](0x1f4,_0x48186b[_0x87a2('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x31c8b9){var _0xc4424d=this;return new Promise(function(_0x141f46,_0x343c2b){return db['Dynamics365Account'][_0x87a2('0x21')]({'raw':_0x31c8b9[_0x87a2('0x1a')]?_0x31c8b9[_0x87a2('0x1a')][_0x87a2('0x22')]===undefined?!![]:![]:!![],'where':_0x31c8b9[_0x87a2('0x1a')]?_0x31c8b9[_0x87a2('0x1a')]['where']||null:null,'attributes':_0x31c8b9[_0x87a2('0x1a')]?_0x31c8b9['options']['attributes']||null:null,'include':_0x31c8b9[_0x87a2('0x1a')]?_0x31c8b9[_0x87a2('0x1a')][_0x87a2('0x1e')]?_[_0x87a2('0x20')](_0x31c8b9[_0x87a2('0x1a')][_0x87a2('0x1e')],function(_0x320404){return{'model':db[_0x320404[_0x87a2('0x1f')]],'as':_0x320404['as'],'attributes':_0x320404[_0x87a2('0x1c')],'include':_0x320404[_0x87a2('0x1e')]?_[_0x87a2('0x20')](_0x320404['include'],function(_0x3301ce){return{'model':db[_0x3301ce[_0x87a2('0x1f')]],'as':_0x3301ce['as'],'attributes':_0x3301ce[_0x87a2('0x1c')],'include':_0x3301ce[_0x87a2('0x1e')]?_[_0x87a2('0x20')](_0x3301ce[_0x87a2('0x1e')],function(_0x58ecf6){return{'model':db[_0x58ecf6['model']],'as':_0x58ecf6['as'],'attributes':_0x58ecf6[_0x87a2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25c38a){logger[_0x87a2('0x15')](_0x87a2('0x23'),_0x31c8b9);logger[_0x87a2('0xf')]('ShowDynamics365Account',_0x31c8b9,JSON[_0x87a2('0x11')](_0x25c38a));_0x141f46(_0x25c38a);})['catch'](function(_0x38eb8f){logger['error'](_0x87a2('0x23'),_0x38eb8f[_0x87a2('0x14')],_0x31c8b9);_0x343c2b(_0xc4424d[_0x87a2('0x12')](0x1f4,_0x38eb8f[_0x87a2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9f741bf..e17bcfe 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 _0xb350=['isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','post','create','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x2820f8,_0x2bdbdc){var _0x1e1413=function(_0x592e45){while(--_0x592e45){_0x2820f8['push'](_0x2820f8['shift']());}};_0x1e1413(++_0x2bdbdc);}(_0xb350,0x6f));var _0x0b35=function(_0x35e24b,_0x6eb583){_0x35e24b=_0x35e24b-0x0;var _0x193ca0=_0xb350[_0x35e24b];return _0x193ca0;};'use strict';var multer=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var path=require(_0x0b35('0x2'));var timeout=require(_0x0b35('0x3'));var express=require('express');var router=express[_0x0b35('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0b35('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0b35('0x6'));var controller=require(_0x0b35('0x7'));router[_0x0b35('0x8')]('/',auth[_0x0b35('0x9')](),controller[_0x0b35('0xa')]);router[_0x0b35('0x8')](_0x0b35('0xb'),auth[_0x0b35('0x9')](),controller[_0x0b35('0xc')]);router['get']('/:id/fields',auth[_0x0b35('0x9')](),controller[_0x0b35('0xd')]);router[_0x0b35('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x0b35('0xe')]);router[_0x0b35('0x8')](_0x0b35('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x0b35('0x10')]('/',auth['isAuthenticated'](),controller[_0x0b35('0x11')]);router['put'](_0x0b35('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0b35('0xb'),auth[_0x0b35('0x9')](),controller[_0x0b35('0x12')]);module[_0x0b35('0x13')]=router; \ No newline at end of file +var _0xa596=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','put','update'];(function(_0x450f95,_0xbaf6e4){var _0x2202f0=function(_0x4634fe){while(--_0x4634fe){_0x450f95['push'](_0x450f95['shift']());}};_0x2202f0(++_0xbaf6e4);}(_0xa596,0x7b));var _0x6a59=function(_0x153660,_0x319bdf){_0x153660=_0x153660-0x0;var _0x5b9832=_0xa596[_0x153660];return _0x5b9832;};'use strict';var multer=require(_0x6a59('0x0'));var util=require(_0x6a59('0x1'));var path=require('path');var timeout=require(_0x6a59('0x2'));var express=require(_0x6a59('0x3'));var router=express[_0x6a59('0x4')]();var fs_extra=require(_0x6a59('0x5'));var auth=require(_0x6a59('0x6'));var interaction=require(_0x6a59('0x7'));var config=require(_0x6a59('0x8'));var controller=require(_0x6a59('0x9'));router['get']('/',auth[_0x6a59('0xa')](),controller[_0x6a59('0xb')]);router[_0x6a59('0xc')](_0x6a59('0xd'),auth[_0x6a59('0xa')](),controller[_0x6a59('0xe')]);router['get'](_0x6a59('0xf'),auth['isAuthenticated'](),controller[_0x6a59('0x10')]);router['get']('/:id/subjects',auth[_0x6a59('0xa')](),controller[_0x6a59('0x11')]);router[_0x6a59('0xc')]('/:id/descriptions',auth[_0x6a59('0xa')](),controller[_0x6a59('0x12')]);router['post']('/',auth[_0x6a59('0xa')](),controller['create']);router[_0x6a59('0x13')](_0x6a59('0xd'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x14')]);router[_0x6a59('0x15')](_0x6a59('0xd'),auth[_0x6a59('0xa')](),controller[_0x6a59('0x16')]);module[_0x6a59('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 63e984a..c6945f7 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 _0x6e23=['incident','phonecall','sequelize','exports','STRING'];(function(_0x210092,_0x502813){var _0xd733b6=function(_0x10f89a){while(--_0x10f89a){_0x210092['push'](_0x210092['shift']());}};_0xd733b6(++_0x502813);}(_0x6e23,0x156));var _0x36e2=function(_0x36bd7c,_0x11c15d){_0x36bd7c=_0x36bd7c-0x0;var _0x3ea205=_0x6e23[_0x36bd7c];return _0x3ea205;};'use strict';var Sequelize=require(_0x36e2('0x0'));module[_0x36e2('0x1')]={'name':{'type':Sequelize[_0x36e2('0x2')]},'description':{'type':Sequelize[_0x36e2('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x36e2('0x3'),_0x36e2('0x4')),'defaultValue':_0x36e2('0x3')}}; \ No newline at end of file +var _0x9ded=['STRING','ENUM','phonecall','sequelize'];(function(_0x19bd44,_0x401cc5){var _0x560cc1=function(_0x3a1fb2){while(--_0x3a1fb2){_0x19bd44['push'](_0x19bd44['shift']());}};_0x560cc1(++_0x401cc5);}(_0x9ded,0x7b));var _0xd9de=function(_0x4acce9,_0x27b426){_0x4acce9=_0x4acce9-0x0;var _0x5345db=_0x9ded[_0x4acce9];return _0x5345db;};'use strict';var Sequelize=require(_0xd9de('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd9de('0x1')]},'ticketType':{'type':Sequelize[_0xd9de('0x2')]('incident',_0xd9de('0x3')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 73e751f..2065f3f 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 _0xcd81=['moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','sendStatus','error','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','find','destroy','getFields','pick','Dynamics365Field','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3522a3,_0x38acd3){var _0x2f51b1=function(_0x31a264){while(--_0x31a264){_0x3522a3['push'](_0x3522a3['shift']());}};_0x2f51b1(++_0x38acd3);}(_0xcd81,0x1f3));var _0x1cd8=function(_0x5e1dc8,_0x580e18){_0x5e1dc8=_0x5e1dc8-0x0;var _0x440553=_0xcd81[_0x5e1dc8];return _0x440553;};'use strict';var emlformat=require(_0x1cd8('0x0'));var rimraf=require(_0x1cd8('0x1'));var zipdir=require(_0x1cd8('0x2'));var jsonpatch=require(_0x1cd8('0x3'));var rp=require(_0x1cd8('0x4'));var moment=require(_0x1cd8('0x5'));var BPromise=require(_0x1cd8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1cd8('0x7'));var sox=require(_0x1cd8('0x8'));var csv=require(_0x1cd8('0x9'));var ejs=require(_0x1cd8('0xa'));var fs=require('fs');var fs_extra=require(_0x1cd8('0xb'));var _=require(_0x1cd8('0xc'));var squel=require(_0x1cd8('0xd'));var crypto=require(_0x1cd8('0xe'));var jsforce=require(_0x1cd8('0xf'));var deskjs=require(_0x1cd8('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1cd8('0x11'));var Redis=require('ioredis');var authService=require(_0x1cd8('0x12'));var qs=require(_0x1cd8('0x13'));var as=require(_0x1cd8('0x14'));var hardwareService=require(_0x1cd8('0x15'));var logger=require(_0x1cd8('0x16'))(_0x1cd8('0x17'));var utils=require('../../config/utils');var config=require(_0x1cd8('0x18'));var licenseUtil=require(_0x1cd8('0x19'));var db=require(_0x1cd8('0x1a'))['db'];function respondWithStatusCode(_0x378e93,_0x36a024){_0x36a024=_0x36a024||0xcc;return function(_0x2bcee8){if(_0x2bcee8){return _0x378e93['sendStatus'](_0x36a024);}return _0x378e93[_0x1cd8('0x1b')](_0x36a024)['end']();};}function respondWithResult(_0x26ecd5,_0x3cc70d){_0x3cc70d=_0x3cc70d||0xc8;return function(_0x31508b){if(_0x31508b){return _0x26ecd5['status'](_0x3cc70d)[_0x1cd8('0x1c')](_0x31508b);}};}function respondWithFilteredResult(_0x535c3f,_0x371a43){return function(_0x420ff4){if(_0x420ff4){var _0x33c76c=typeof _0x371a43[_0x1cd8('0x1d')]===_0x1cd8('0x1e')&&typeof _0x371a43[_0x1cd8('0x1f')]===_0x1cd8('0x1e');var _0x2ef4c4=_0x420ff4[_0x1cd8('0x20')];var _0x4e7293=_0x33c76c?0x0:_0x371a43[_0x1cd8('0x1d')];var _0x12142a=_0x33c76c?_0x420ff4[_0x1cd8('0x20')]:_0x371a43['offset']+_0x371a43['limit'];var _0x98d602;if(_0x12142a>=_0x2ef4c4){_0x12142a=_0x2ef4c4;_0x98d602=0xc8;}else{_0x98d602=0xce;}_0x535c3f[_0x1cd8('0x1b')](_0x98d602);return _0x535c3f['set'](_0x1cd8('0x21'),_0x4e7293+'-'+_0x12142a+'/'+_0x2ef4c4)[_0x1cd8('0x1c')](_0x420ff4);}return null;};}function patchUpdates(_0x33db02){return function(_0x3c228e){try{jsonpatch[_0x1cd8('0x22')](_0x3c228e,_0x33db02,!![]);}catch(_0x33a7bc){return BPromise[_0x1cd8('0x23')](_0x33a7bc);}return _0x3c228e[_0x1cd8('0x24')]();};}function saveUpdates(_0x1aa90a,_0x2e0119){return function(_0x57462d){if(_0x57462d){return _0x57462d[_0x1cd8('0x25')](_0x1aa90a)[_0x1cd8('0x26')](function(_0x5f2c33){return _0x5f2c33;});}return null;};}function removeEntity(_0x22b418,_0xc86eab){return function(_0x30633e){if(_0x30633e){return _0x30633e['destroy']()['then'](function(){_0x22b418[_0x1cd8('0x1b')](0xcc)[_0x1cd8('0x27')]();});}};}function handleEntityNotFound(_0x30ff65,_0x2223fc){return function(_0x1aeebf){if(!_0x1aeebf){_0x30ff65[_0x1cd8('0x28')](0x194);}return _0x1aeebf;};}function handleError(_0x42b03b,_0x22cd4d){_0x22cd4d=_0x22cd4d||0x1f4;return function(_0xea27f1){logger[_0x1cd8('0x29')](_0xea27f1['stack']);if(_0xea27f1[_0x1cd8('0x2a')]){delete _0xea27f1['name'];}_0x42b03b[_0x1cd8('0x1b')](_0x22cd4d)[_0x1cd8('0x2b')](_0xea27f1);};}exports[_0x1cd8('0x2c')]=function(_0x183801,_0x42cc8f){var _0x4b7e6d={},_0x2c8f27={},_0x179efa={'count':0x0,'rows':[]};var _0xc88ad5=_[_0x1cd8('0x2d')](db[_0x1cd8('0x2e')]['rawAttributes'],function(_0x3a5579){return{'name':_0x3a5579[_0x1cd8('0x2f')],'type':_0x3a5579[_0x1cd8('0x30')][_0x1cd8('0x31')]};});_0x2c8f27[_0x1cd8('0x32')]=_[_0x1cd8('0x2d')](_0xc88ad5,_0x1cd8('0x2a'));_0x2c8f27['query']=_['keys'](_0x183801['query']);_0x2c8f27[_0x1cd8('0x33')]=_[_0x1cd8('0x34')](_0x2c8f27[_0x1cd8('0x32')],_0x2c8f27[_0x1cd8('0x35')]);_0x4b7e6d[_0x1cd8('0x36')]=_[_0x1cd8('0x34')](_0x2c8f27[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x183801[_0x1cd8('0x35')][_0x1cd8('0x37')]));_0x4b7e6d['attributes']=_0x4b7e6d[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x4b7e6d[_0x1cd8('0x36')]:_0x2c8f27[_0x1cd8('0x32')];if(!_0x183801['query'][_0x1cd8('0x39')](_0x1cd8('0x3a'))){_0x4b7e6d['limit']=qs[_0x1cd8('0x1f')](_0x183801[_0x1cd8('0x35')][_0x1cd8('0x1f')]);_0x4b7e6d[_0x1cd8('0x1d')]=qs['offset'](_0x183801[_0x1cd8('0x35')][_0x1cd8('0x1d')]);}_0x4b7e6d['order']=qs[_0x1cd8('0x3b')](_0x183801[_0x1cd8('0x35')][_0x1cd8('0x3b')]);_0x4b7e6d[_0x1cd8('0x3c')]=qs[_0x1cd8('0x33')](_['pick'](_0x183801['query'],_0x2c8f27[_0x1cd8('0x33')]),_0xc88ad5);if(_0x183801['query'][_0x1cd8('0x3d')]){_0x4b7e6d[_0x1cd8('0x3c')]=_[_0x1cd8('0x3e')](_0x4b7e6d[_0x1cd8('0x3c')],{'$or':_[_0x1cd8('0x2d')](_0xc88ad5,function(_0x1924ac){if(_0x1924ac[_0x1cd8('0x30')]!==_0x1cd8('0x3f')){var _0x519582={};_0x519582[_0x1924ac[_0x1cd8('0x2a')]]={'$like':'%'+_0x183801[_0x1cd8('0x35')][_0x1cd8('0x3d')]+'%'};return _0x519582;}})});}_0x4b7e6d=_[_0x1cd8('0x3e')]({},_0x4b7e6d,_0x183801[_0x1cd8('0x40')]);var _0x2be532={'where':_0x4b7e6d[_0x1cd8('0x3c')]};return db[_0x1cd8('0x2e')][_0x1cd8('0x20')](_0x2be532)['then'](function(_0x216099){_0x179efa[_0x1cd8('0x20')]=_0x216099;if(_0x183801[_0x1cd8('0x35')][_0x1cd8('0x41')]){_0x4b7e6d[_0x1cd8('0x42')]=[{'all':!![]}];}return db[_0x1cd8('0x2e')][_0x1cd8('0x43')](_0x4b7e6d);})[_0x1cd8('0x26')](function(_0xe5eca5){_0x179efa[_0x1cd8('0x44')]=_0xe5eca5;return _0x179efa;})['then'](respondWithFilteredResult(_0x42cc8f,_0x4b7e6d))[_0x1cd8('0x45')](handleError(_0x42cc8f,null));};exports['show']=function(_0x4c9ff3,_0x599504){var _0x75036f={'raw':![],'where':{'id':_0x4c9ff3[_0x1cd8('0x46')]['id']}},_0x39a0df={};_0x39a0df[_0x1cd8('0x32')]=_[_0x1cd8('0x47')](db[_0x1cd8('0x2e')][_0x1cd8('0x48')]);_0x39a0df[_0x1cd8('0x35')]=_['keys'](_0x4c9ff3['query']);_0x39a0df[_0x1cd8('0x33')]=_[_0x1cd8('0x34')](_0x39a0df[_0x1cd8('0x32')],_0x39a0df[_0x1cd8('0x35')]);_0x75036f[_0x1cd8('0x36')]=_['intersection'](_0x39a0df[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x4c9ff3[_0x1cd8('0x35')][_0x1cd8('0x37')]));_0x75036f[_0x1cd8('0x36')]=_0x75036f[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x75036f[_0x1cd8('0x36')]:_0x39a0df[_0x1cd8('0x32')];if(_0x4c9ff3['query']['includeAll']){_0x75036f[_0x1cd8('0x42')]=[{'all':!![]}];}_0x75036f=_['merge']({},_0x75036f,_0x4c9ff3[_0x1cd8('0x40')]);return db[_0x1cd8('0x2e')]['find'](_0x75036f)['then'](handleEntityNotFound(_0x599504,null))['then'](respondWithResult(_0x599504,null))['catch'](handleError(_0x599504,null));};exports['create']=function(_0x50797c,_0x3ff802){return db[_0x1cd8('0x2e')][_0x1cd8('0x49')](_0x50797c['body'],{})[_0x1cd8('0x26')](respondWithResult(_0x3ff802,0xc9))[_0x1cd8('0x45')](handleError(_0x3ff802,null));};exports[_0x1cd8('0x25')]=function(_0x17b532,_0x37ae8d){if(_0x17b532['body']['id']){delete _0x17b532[_0x1cd8('0x4a')]['id'];}return db[_0x1cd8('0x2e')][_0x1cd8('0x4b')]({'where':{'id':_0x17b532[_0x1cd8('0x46')]['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0x37ae8d,null))[_0x1cd8('0x26')](saveUpdates(_0x17b532[_0x1cd8('0x4a')],null))['then'](respondWithResult(_0x37ae8d,null))[_0x1cd8('0x45')](handleError(_0x37ae8d,null));};exports[_0x1cd8('0x4c')]=function(_0x1fa3a3,_0x4530ee){return db['Dynamics365Configuration'][_0x1cd8('0x4b')]({'where':{'id':_0x1fa3a3['params']['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0x4530ee,null))[_0x1cd8('0x26')](removeEntity(_0x4530ee,null))[_0x1cd8('0x45')](handleError(_0x4530ee,null));};exports[_0x1cd8('0x4d')]=function(_0x3d0c5f,_0x146045,_0x1cce45){var _0x267fe5={};var _0x101e13={};var _0x484130;var _0x1b2581;return db[_0x1cd8('0x2e')]['findOne']({'where':{'id':_0x3d0c5f[_0x1cd8('0x46')]['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0x146045,null))[_0x1cd8('0x26')](function(_0x17c57e){if(_0x17c57e){_0x484130=_0x17c57e;_0x101e13[_0x1cd8('0x32')]=_[_0x1cd8('0x47')](db['Dynamics365Field'][_0x1cd8('0x48')]);_0x101e13['query']=_[_0x1cd8('0x47')](_0x3d0c5f['query']);_0x101e13['filters']=_[_0x1cd8('0x34')](_0x101e13['model'],_0x101e13[_0x1cd8('0x35')]);_0x267fe5[_0x1cd8('0x36')]=_[_0x1cd8('0x34')](_0x101e13[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x3d0c5f['query'][_0x1cd8('0x37')]));_0x267fe5[_0x1cd8('0x36')]=_0x267fe5[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x267fe5[_0x1cd8('0x36')]:_0x101e13['model'];_0x267fe5['order']=qs['sort'](_0x3d0c5f[_0x1cd8('0x35')]['sort']);_0x267fe5[_0x1cd8('0x3c')]=qs[_0x1cd8('0x33')](_[_0x1cd8('0x4e')](_0x3d0c5f[_0x1cd8('0x35')],_0x101e13[_0x1cd8('0x33')]));if(_0x3d0c5f[_0x1cd8('0x35')][_0x1cd8('0x3d')]){_0x267fe5[_0x1cd8('0x3c')]=_[_0x1cd8('0x3e')](_0x267fe5[_0x1cd8('0x3c')],{'$or':_['map'](_0x267fe5['attributes'],function(_0x252081){var _0xaa4700={};_0xaa4700[_0x252081]={'$like':'%'+_0x3d0c5f[_0x1cd8('0x35')][_0x1cd8('0x3d')]+'%'};return _0xaa4700;})});}_0x267fe5=_[_0x1cd8('0x3e')]({},_0x267fe5,_0x3d0c5f[_0x1cd8('0x40')]);return _0x484130[_0x1cd8('0x4d')](_0x267fe5);}})['then'](function(_0x2747d6){if(_0x2747d6){_0x1b2581=_0x2747d6['length'];if(!_0x3d0c5f[_0x1cd8('0x35')][_0x1cd8('0x39')](_0x1cd8('0x3a'))){_0x267fe5[_0x1cd8('0x1f')]=qs['limit'](_0x3d0c5f['query'][_0x1cd8('0x1f')]);_0x267fe5['offset']=qs[_0x1cd8('0x1d')](_0x3d0c5f['query'][_0x1cd8('0x1d')]);}return _0x484130[_0x1cd8('0x4d')](_0x267fe5);}})[_0x1cd8('0x26')](function(_0x5f09ab){if(_0x5f09ab){return _0x5f09ab?{'count':_0x1b2581,'rows':_0x5f09ab}:null;}})[_0x1cd8('0x26')](respondWithResult(_0x146045,null))['catch'](handleError(_0x146045,null));};exports['getSubjects']=function(_0x410592,_0x254e0e,_0x12f5b7){var _0x48fb72={};var _0x2769cc={};var _0x47b317;var _0x55ce64;return db[_0x1cd8('0x2e')]['findOne']({'where':{'id':_0x410592['params']['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0x254e0e,null))[_0x1cd8('0x26')](function(_0x5bd92c){if(_0x5bd92c){_0x47b317=_0x5bd92c;_0x2769cc['model']=_['keys'](db[_0x1cd8('0x4f')]['rawAttributes']);_0x2769cc[_0x1cd8('0x35')]=_[_0x1cd8('0x47')](_0x410592[_0x1cd8('0x35')]);_0x2769cc[_0x1cd8('0x33')]=_['intersection'](_0x2769cc[_0x1cd8('0x32')],_0x2769cc[_0x1cd8('0x35')]);_0x48fb72[_0x1cd8('0x36')]=_[_0x1cd8('0x34')](_0x2769cc[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x410592['query'][_0x1cd8('0x37')]));_0x48fb72[_0x1cd8('0x36')]=_0x48fb72[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x48fb72[_0x1cd8('0x36')]:_0x2769cc['model'];_0x48fb72[_0x1cd8('0x50')]=qs[_0x1cd8('0x3b')](_0x410592[_0x1cd8('0x35')][_0x1cd8('0x3b')]);_0x48fb72['where']=qs[_0x1cd8('0x33')](_[_0x1cd8('0x4e')](_0x410592[_0x1cd8('0x35')],_0x2769cc[_0x1cd8('0x33')]));if(_0x410592['query'][_0x1cd8('0x3d')]){_0x48fb72[_0x1cd8('0x3c')]=_[_0x1cd8('0x3e')](_0x48fb72[_0x1cd8('0x3c')],{'$or':_[_0x1cd8('0x2d')](_0x48fb72[_0x1cd8('0x36')],function(_0x202a84){var _0x40808c={};_0x40808c[_0x202a84]={'$like':'%'+_0x410592[_0x1cd8('0x35')]['filter']+'%'};return _0x40808c;})});}_0x48fb72=_[_0x1cd8('0x3e')]({},_0x48fb72,_0x410592[_0x1cd8('0x40')]);return _0x47b317[_0x1cd8('0x51')](_0x48fb72);}})[_0x1cd8('0x26')](function(_0x519b7b){if(_0x519b7b){_0x55ce64=_0x519b7b[_0x1cd8('0x38')];if(!_0x410592[_0x1cd8('0x35')][_0x1cd8('0x39')]('nolimit')){_0x48fb72[_0x1cd8('0x1f')]=qs[_0x1cd8('0x1f')](_0x410592[_0x1cd8('0x35')][_0x1cd8('0x1f')]);_0x48fb72[_0x1cd8('0x1d')]=qs[_0x1cd8('0x1d')](_0x410592[_0x1cd8('0x35')][_0x1cd8('0x1d')]);}return _0x47b317['getSubjects'](_0x48fb72);}})[_0x1cd8('0x26')](function(_0x221c0d){if(_0x221c0d){return _0x221c0d?{'count':_0x55ce64,'rows':_0x221c0d}:null;}})[_0x1cd8('0x26')](respondWithResult(_0x254e0e,null))[_0x1cd8('0x45')](handleError(_0x254e0e,null));};exports['getDescriptions']=function(_0x12283d,_0xb28e2f,_0x15a47b){var _0x426d68={};var _0x18f08f={};var _0x40fc9b;var _0x31604a;return db[_0x1cd8('0x2e')][_0x1cd8('0x52')]({'where':{'id':_0x12283d[_0x1cd8('0x46')]['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0xb28e2f,null))[_0x1cd8('0x26')](function(_0x97547b){if(_0x97547b){_0x40fc9b=_0x97547b;_0x18f08f['model']=_[_0x1cd8('0x47')](db[_0x1cd8('0x4f')]['rawAttributes']);_0x18f08f['query']=_[_0x1cd8('0x47')](_0x12283d['query']);_0x18f08f[_0x1cd8('0x33')]=_['intersection'](_0x18f08f[_0x1cd8('0x32')],_0x18f08f[_0x1cd8('0x35')]);_0x426d68[_0x1cd8('0x36')]=_[_0x1cd8('0x34')](_0x18f08f[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x12283d['query']['fields']));_0x426d68[_0x1cd8('0x36')]=_0x426d68[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x426d68['attributes']:_0x18f08f['model'];_0x426d68[_0x1cd8('0x50')]=qs[_0x1cd8('0x3b')](_0x12283d[_0x1cd8('0x35')][_0x1cd8('0x3b')]);_0x426d68[_0x1cd8('0x3c')]=qs[_0x1cd8('0x33')](_[_0x1cd8('0x4e')](_0x12283d[_0x1cd8('0x35')],_0x18f08f[_0x1cd8('0x33')]));if(_0x12283d[_0x1cd8('0x35')]['filter']){_0x426d68['where']=_['merge'](_0x426d68[_0x1cd8('0x3c')],{'$or':_[_0x1cd8('0x2d')](_0x426d68[_0x1cd8('0x36')],function(_0x44ac19){var _0x23198b={};_0x23198b[_0x44ac19]={'$like':'%'+_0x12283d[_0x1cd8('0x35')]['filter']+'%'};return _0x23198b;})});}_0x426d68=_[_0x1cd8('0x3e')]({},_0x426d68,_0x12283d[_0x1cd8('0x40')]);return _0x40fc9b['getDescriptions'](_0x426d68);}})['then'](function(_0x31348e){if(_0x31348e){_0x31604a=_0x31348e[_0x1cd8('0x38')];if(!_0x12283d[_0x1cd8('0x35')][_0x1cd8('0x39')](_0x1cd8('0x3a'))){_0x426d68[_0x1cd8('0x1f')]=qs['limit'](_0x12283d[_0x1cd8('0x35')][_0x1cd8('0x1f')]);_0x426d68[_0x1cd8('0x1d')]=qs[_0x1cd8('0x1d')](_0x12283d[_0x1cd8('0x35')][_0x1cd8('0x1d')]);}return _0x40fc9b[_0x1cd8('0x53')](_0x426d68);}})[_0x1cd8('0x26')](function(_0xac3e57){if(_0xac3e57){return _0xac3e57?{'count':_0x31604a,'rows':_0xac3e57}:null;}})[_0x1cd8('0x26')](respondWithResult(_0xb28e2f,null))[_0x1cd8('0x45')](handleError(_0xb28e2f,null));}; \ No newline at end of file +var _0x5ca9=['offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','destroy','getFields','length','getSubjects','Dynamics365Field','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json'];(function(_0x357cc7,_0x36ff96){var _0x1787db=function(_0x3b23f0){while(--_0x3b23f0){_0x357cc7['push'](_0x357cc7['shift']());}};_0x1787db(++_0x36ff96);}(_0x5ca9,0x1ca));var _0x95ca=function(_0x37cc1d,_0x31a81f){_0x37cc1d=_0x37cc1d-0x0;var _0x3306ec=_0x5ca9[_0x37cc1d];return _0x3306ec;};'use strict';var emlformat=require(_0x95ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x95ca('0x1'));var jsonpatch=require(_0x95ca('0x2'));var rp=require(_0x95ca('0x3'));var moment=require(_0x95ca('0x4'));var BPromise=require(_0x95ca('0x5'));var Mustache=require('mustache');var util=require(_0x95ca('0x6'));var path=require(_0x95ca('0x7'));var sox=require('sox');var csv=require(_0x95ca('0x8'));var ejs=require(_0x95ca('0x9'));var fs=require('fs');var fs_extra=require(_0x95ca('0xa'));var _=require(_0x95ca('0xb'));var squel=require(_0x95ca('0xc'));var crypto=require(_0x95ca('0xd'));var jsforce=require(_0x95ca('0xe'));var deskjs=require(_0x95ca('0xf'));var toCsv=require(_0x95ca('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x95ca('0x10'));var qs=require(_0x95ca('0x11'));var as=require(_0x95ca('0x12'));var hardwareService=require(_0x95ca('0x13'));var logger=require(_0x95ca('0x14'))(_0x95ca('0x15'));var utils=require(_0x95ca('0x16'));var config=require(_0x95ca('0x17'));var licenseUtil=require(_0x95ca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35c2ff,_0x146e19){_0x146e19=_0x146e19||0xcc;return function(_0x35ff7d){if(_0x35ff7d){return _0x35c2ff['sendStatus'](_0x146e19);}return _0x35c2ff[_0x95ca('0x19')](_0x146e19)[_0x95ca('0x1a')]();};}function respondWithResult(_0x3b8343,_0x2837c7){_0x2837c7=_0x2837c7||0xc8;return function(_0x53acf1){if(_0x53acf1){return _0x3b8343['status'](_0x2837c7)[_0x95ca('0x1b')](_0x53acf1);}};}function respondWithFilteredResult(_0x5e9496,_0x1e4601){return function(_0x28a7ef){if(_0x28a7ef){var _0x236ef4=typeof _0x1e4601[_0x95ca('0x1c')]===_0x95ca('0x1d')&&typeof _0x1e4601[_0x95ca('0x1e')]===_0x95ca('0x1d');var _0x13c95f=_0x28a7ef['count'];var _0x13dfc5=_0x236ef4?0x0:_0x1e4601['offset'];var _0x2a2e1c=_0x236ef4?_0x28a7ef[_0x95ca('0x1f')]:_0x1e4601[_0x95ca('0x1c')]+_0x1e4601[_0x95ca('0x1e')];var _0xe36e61;if(_0x2a2e1c>=_0x13c95f){_0x2a2e1c=_0x13c95f;_0xe36e61=0xc8;}else{_0xe36e61=0xce;}_0x5e9496['status'](_0xe36e61);return _0x5e9496['set'](_0x95ca('0x20'),_0x13dfc5+'-'+_0x2a2e1c+'/'+_0x13c95f)[_0x95ca('0x1b')](_0x28a7ef);}return null;};}function patchUpdates(_0x55a33c){return function(_0x5d77a0){try{jsonpatch[_0x95ca('0x21')](_0x5d77a0,_0x55a33c,!![]);}catch(_0x47a1f5){return BPromise[_0x95ca('0x22')](_0x47a1f5);}return _0x5d77a0[_0x95ca('0x23')]();};}function saveUpdates(_0x1e7770,_0x786b0b){return function(_0x33c34c){if(_0x33c34c){return _0x33c34c[_0x95ca('0x24')](_0x1e7770)[_0x95ca('0x25')](function(_0x5e9d6b){return _0x5e9d6b;});}return null;};}function removeEntity(_0x2b878e,_0x4271ae){return function(_0x318704){if(_0x318704){return _0x318704['destroy']()[_0x95ca('0x25')](function(){_0x2b878e[_0x95ca('0x19')](0xcc)[_0x95ca('0x1a')]();});}};}function handleEntityNotFound(_0x56a5e0,_0x351ca8){return function(_0x1b381a){if(!_0x1b381a){_0x56a5e0[_0x95ca('0x26')](0x194);}return _0x1b381a;};}function handleError(_0x58979b,_0x4be178){_0x4be178=_0x4be178||0x1f4;return function(_0x2cc3c6){logger[_0x95ca('0x27')](_0x2cc3c6[_0x95ca('0x28')]);if(_0x2cc3c6['name']){delete _0x2cc3c6[_0x95ca('0x29')];}_0x58979b['status'](_0x4be178)[_0x95ca('0x2a')](_0x2cc3c6);};}exports[_0x95ca('0x2b')]=function(_0x151089,_0xd379){var _0x284125={},_0x4fe6cf={},_0x2568d5={'count':0x0,'rows':[]};var _0x1908b4=_[_0x95ca('0x2c')](db[_0x95ca('0x2d')][_0x95ca('0x2e')],function(_0xf9eec7){return{'name':_0xf9eec7[_0x95ca('0x2f')],'type':_0xf9eec7[_0x95ca('0x30')][_0x95ca('0x31')]};});_0x4fe6cf[_0x95ca('0x32')]=_['map'](_0x1908b4,_0x95ca('0x29'));_0x4fe6cf[_0x95ca('0x33')]=_[_0x95ca('0x34')](_0x151089[_0x95ca('0x33')]);_0x4fe6cf[_0x95ca('0x35')]=_[_0x95ca('0x36')](_0x4fe6cf[_0x95ca('0x32')],_0x4fe6cf[_0x95ca('0x33')]);_0x284125[_0x95ca('0x37')]=_[_0x95ca('0x36')](_0x4fe6cf['model'],qs['fields'](_0x151089[_0x95ca('0x33')][_0x95ca('0x38')]));_0x284125[_0x95ca('0x37')]=_0x284125['attributes']['length']?_0x284125['attributes']:_0x4fe6cf['model'];if(!_0x151089[_0x95ca('0x33')][_0x95ca('0x39')](_0x95ca('0x3a'))){_0x284125[_0x95ca('0x1e')]=qs[_0x95ca('0x1e')](_0x151089['query'][_0x95ca('0x1e')]);_0x284125[_0x95ca('0x1c')]=qs[_0x95ca('0x1c')](_0x151089['query'][_0x95ca('0x1c')]);}_0x284125[_0x95ca('0x3b')]=qs['sort'](_0x151089[_0x95ca('0x33')][_0x95ca('0x3c')]);_0x284125[_0x95ca('0x3d')]=qs[_0x95ca('0x35')](_[_0x95ca('0x3e')](_0x151089[_0x95ca('0x33')],_0x4fe6cf[_0x95ca('0x35')]),_0x1908b4);if(_0x151089['query'][_0x95ca('0x3f')]){_0x284125[_0x95ca('0x3d')]=_[_0x95ca('0x40')](_0x284125[_0x95ca('0x3d')],{'$or':_[_0x95ca('0x2c')](_0x1908b4,function(_0x16b6ea){if(_0x16b6ea[_0x95ca('0x30')]!==_0x95ca('0x41')){var _0x50519b={};_0x50519b[_0x16b6ea[_0x95ca('0x29')]]={'$like':'%'+_0x151089['query'][_0x95ca('0x3f')]+'%'};return _0x50519b;}})});}_0x284125=_['merge']({},_0x284125,_0x151089[_0x95ca('0x42')]);var _0x12a15c={'where':_0x284125['where']};return db[_0x95ca('0x2d')]['count'](_0x12a15c)[_0x95ca('0x25')](function(_0x4e3f7c){_0x2568d5[_0x95ca('0x1f')]=_0x4e3f7c;if(_0x151089[_0x95ca('0x33')]['includeAll']){_0x284125[_0x95ca('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x95ca('0x44')](_0x284125);})['then'](function(_0x18e44c){_0x2568d5[_0x95ca('0x45')]=_0x18e44c;return _0x2568d5;})[_0x95ca('0x25')](respondWithFilteredResult(_0xd379,_0x284125))[_0x95ca('0x46')](handleError(_0xd379,null));};exports['show']=function(_0xb7d648,_0x5d16e){var _0x1d67e2={'raw':![],'where':{'id':_0xb7d648[_0x95ca('0x47')]['id']}},_0x4222ab={};_0x4222ab[_0x95ca('0x32')]=_[_0x95ca('0x34')](db[_0x95ca('0x2d')]['rawAttributes']);_0x4222ab[_0x95ca('0x33')]=_['keys'](_0xb7d648[_0x95ca('0x33')]);_0x4222ab[_0x95ca('0x35')]=_[_0x95ca('0x36')](_0x4222ab[_0x95ca('0x32')],_0x4222ab['query']);_0x1d67e2[_0x95ca('0x37')]=_[_0x95ca('0x36')](_0x4222ab[_0x95ca('0x32')],qs[_0x95ca('0x38')](_0xb7d648[_0x95ca('0x33')][_0x95ca('0x38')]));_0x1d67e2['attributes']=_0x1d67e2[_0x95ca('0x37')]['length']?_0x1d67e2[_0x95ca('0x37')]:_0x4222ab[_0x95ca('0x32')];if(_0xb7d648[_0x95ca('0x33')]['includeAll']){_0x1d67e2['include']=[{'all':!![]}];}_0x1d67e2=_[_0x95ca('0x40')]({},_0x1d67e2,_0xb7d648[_0x95ca('0x42')]);return db['Dynamics365Configuration'][_0x95ca('0x48')](_0x1d67e2)[_0x95ca('0x25')](handleEntityNotFound(_0x5d16e,null))[_0x95ca('0x25')](respondWithResult(_0x5d16e,null))['catch'](handleError(_0x5d16e,null));};exports['create']=function(_0x5518e7,_0x58952f){return db[_0x95ca('0x2d')][_0x95ca('0x49')](_0x5518e7[_0x95ca('0x4a')],{})[_0x95ca('0x25')](respondWithResult(_0x58952f,0xc9))['catch'](handleError(_0x58952f,null));};exports['update']=function(_0x2056e6,_0x3dd80c){if(_0x2056e6[_0x95ca('0x4a')]['id']){delete _0x2056e6[_0x95ca('0x4a')]['id'];}return db[_0x95ca('0x2d')][_0x95ca('0x48')]({'where':{'id':_0x2056e6['params']['id']}})[_0x95ca('0x25')](handleEntityNotFound(_0x3dd80c,null))[_0x95ca('0x25')](saveUpdates(_0x2056e6[_0x95ca('0x4a')],null))[_0x95ca('0x25')](respondWithResult(_0x3dd80c,null))[_0x95ca('0x46')](handleError(_0x3dd80c,null));};exports[_0x95ca('0x4b')]=function(_0x536155,_0xb13558){return db[_0x95ca('0x2d')][_0x95ca('0x48')]({'where':{'id':_0x536155[_0x95ca('0x47')]['id']}})[_0x95ca('0x25')](handleEntityNotFound(_0xb13558,null))[_0x95ca('0x25')](removeEntity(_0xb13558,null))[_0x95ca('0x46')](handleError(_0xb13558,null));};exports[_0x95ca('0x4c')]=function(_0x228c70,_0x28f2f4,_0x180cf8){var _0x5411a5={};var _0x587a0b={};var _0x307ac5;var _0x5a017d;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x228c70[_0x95ca('0x47')]['id']}})['then'](handleEntityNotFound(_0x28f2f4,null))[_0x95ca('0x25')](function(_0x1f6dcc){if(_0x1f6dcc){_0x307ac5=_0x1f6dcc;_0x587a0b[_0x95ca('0x32')]=_['keys'](db['Dynamics365Field'][_0x95ca('0x2e')]);_0x587a0b[_0x95ca('0x33')]=_['keys'](_0x228c70[_0x95ca('0x33')]);_0x587a0b[_0x95ca('0x35')]=_['intersection'](_0x587a0b['model'],_0x587a0b[_0x95ca('0x33')]);_0x5411a5['attributes']=_[_0x95ca('0x36')](_0x587a0b[_0x95ca('0x32')],qs['fields'](_0x228c70['query'][_0x95ca('0x38')]));_0x5411a5['attributes']=_0x5411a5[_0x95ca('0x37')]['length']?_0x5411a5['attributes']:_0x587a0b[_0x95ca('0x32')];_0x5411a5[_0x95ca('0x3b')]=qs[_0x95ca('0x3c')](_0x228c70[_0x95ca('0x33')][_0x95ca('0x3c')]);_0x5411a5[_0x95ca('0x3d')]=qs[_0x95ca('0x35')](_[_0x95ca('0x3e')](_0x228c70['query'],_0x587a0b[_0x95ca('0x35')]));if(_0x228c70[_0x95ca('0x33')][_0x95ca('0x3f')]){_0x5411a5['where']=_[_0x95ca('0x40')](_0x5411a5[_0x95ca('0x3d')],{'$or':_[_0x95ca('0x2c')](_0x5411a5[_0x95ca('0x37')],function(_0x850396){var _0x57a739={};_0x57a739[_0x850396]={'$like':'%'+_0x228c70['query']['filter']+'%'};return _0x57a739;})});}_0x5411a5=_['merge']({},_0x5411a5,_0x228c70[_0x95ca('0x42')]);return _0x307ac5[_0x95ca('0x4c')](_0x5411a5);}})['then'](function(_0x3f2ae2){if(_0x3f2ae2){_0x5a017d=_0x3f2ae2[_0x95ca('0x4d')];if(!_0x228c70[_0x95ca('0x33')][_0x95ca('0x39')]('nolimit')){_0x5411a5[_0x95ca('0x1e')]=qs['limit'](_0x228c70[_0x95ca('0x33')][_0x95ca('0x1e')]);_0x5411a5['offset']=qs[_0x95ca('0x1c')](_0x228c70[_0x95ca('0x33')][_0x95ca('0x1c')]);}return _0x307ac5[_0x95ca('0x4c')](_0x5411a5);}})['then'](function(_0x3f3837){if(_0x3f3837){return _0x3f3837?{'count':_0x5a017d,'rows':_0x3f3837}:null;}})[_0x95ca('0x25')](respondWithResult(_0x28f2f4,null))['catch'](handleError(_0x28f2f4,null));};exports[_0x95ca('0x4e')]=function(_0x4f6b12,_0xacc878,_0x2f979b){var _0x53e70a={};var _0x4b38d1={};var _0x422725;var _0x30d886;return db[_0x95ca('0x2d')]['findOne']({'where':{'id':_0x4f6b12[_0x95ca('0x47')]['id']}})[_0x95ca('0x25')](handleEntityNotFound(_0xacc878,null))[_0x95ca('0x25')](function(_0x318500){if(_0x318500){_0x422725=_0x318500;_0x4b38d1[_0x95ca('0x32')]=_[_0x95ca('0x34')](db[_0x95ca('0x4f')]['rawAttributes']);_0x4b38d1['query']=_[_0x95ca('0x34')](_0x4f6b12[_0x95ca('0x33')]);_0x4b38d1['filters']=_['intersection'](_0x4b38d1[_0x95ca('0x32')],_0x4b38d1[_0x95ca('0x33')]);_0x53e70a['attributes']=_[_0x95ca('0x36')](_0x4b38d1[_0x95ca('0x32')],qs[_0x95ca('0x38')](_0x4f6b12[_0x95ca('0x33')][_0x95ca('0x38')]));_0x53e70a[_0x95ca('0x37')]=_0x53e70a['attributes']['length']?_0x53e70a[_0x95ca('0x37')]:_0x4b38d1[_0x95ca('0x32')];_0x53e70a[_0x95ca('0x3b')]=qs[_0x95ca('0x3c')](_0x4f6b12[_0x95ca('0x33')][_0x95ca('0x3c')]);_0x53e70a[_0x95ca('0x3d')]=qs['filters'](_[_0x95ca('0x3e')](_0x4f6b12[_0x95ca('0x33')],_0x4b38d1[_0x95ca('0x35')]));if(_0x4f6b12[_0x95ca('0x33')]['filter']){_0x53e70a[_0x95ca('0x3d')]=_[_0x95ca('0x40')](_0x53e70a[_0x95ca('0x3d')],{'$or':_[_0x95ca('0x2c')](_0x53e70a[_0x95ca('0x37')],function(_0x579e4d){var _0x18cc59={};_0x18cc59[_0x579e4d]={'$like':'%'+_0x4f6b12['query'][_0x95ca('0x3f')]+'%'};return _0x18cc59;})});}_0x53e70a=_[_0x95ca('0x40')]({},_0x53e70a,_0x4f6b12['options']);return _0x422725[_0x95ca('0x4e')](_0x53e70a);}})[_0x95ca('0x25')](function(_0x4ad2ea){if(_0x4ad2ea){_0x30d886=_0x4ad2ea[_0x95ca('0x4d')];if(!_0x4f6b12[_0x95ca('0x33')]['hasOwnProperty'](_0x95ca('0x3a'))){_0x53e70a[_0x95ca('0x1e')]=qs['limit'](_0x4f6b12[_0x95ca('0x33')][_0x95ca('0x1e')]);_0x53e70a[_0x95ca('0x1c')]=qs[_0x95ca('0x1c')](_0x4f6b12['query'][_0x95ca('0x1c')]);}return _0x422725['getSubjects'](_0x53e70a);}})[_0x95ca('0x25')](function(_0x548c3a){if(_0x548c3a){return _0x548c3a?{'count':_0x30d886,'rows':_0x548c3a}:null;}})[_0x95ca('0x25')](respondWithResult(_0xacc878,null))[_0x95ca('0x46')](handleError(_0xacc878,null));};exports[_0x95ca('0x50')]=function(_0x26c4a0,_0x54a9ea,_0x389a13){var _0x3e3a70={};var _0x2b5b20={};var _0x350694;var _0x4df500;return db[_0x95ca('0x2d')]['findOne']({'where':{'id':_0x26c4a0[_0x95ca('0x47')]['id']}})[_0x95ca('0x25')](handleEntityNotFound(_0x54a9ea,null))[_0x95ca('0x25')](function(_0x118bb3){if(_0x118bb3){_0x350694=_0x118bb3;_0x2b5b20[_0x95ca('0x32')]=_[_0x95ca('0x34')](db[_0x95ca('0x4f')][_0x95ca('0x2e')]);_0x2b5b20[_0x95ca('0x33')]=_[_0x95ca('0x34')](_0x26c4a0['query']);_0x2b5b20[_0x95ca('0x35')]=_[_0x95ca('0x36')](_0x2b5b20[_0x95ca('0x32')],_0x2b5b20['query']);_0x3e3a70['attributes']=_[_0x95ca('0x36')](_0x2b5b20['model'],qs[_0x95ca('0x38')](_0x26c4a0[_0x95ca('0x33')][_0x95ca('0x38')]));_0x3e3a70['attributes']=_0x3e3a70[_0x95ca('0x37')][_0x95ca('0x4d')]?_0x3e3a70['attributes']:_0x2b5b20[_0x95ca('0x32')];_0x3e3a70[_0x95ca('0x3b')]=qs[_0x95ca('0x3c')](_0x26c4a0[_0x95ca('0x33')][_0x95ca('0x3c')]);_0x3e3a70[_0x95ca('0x3d')]=qs[_0x95ca('0x35')](_[_0x95ca('0x3e')](_0x26c4a0[_0x95ca('0x33')],_0x2b5b20[_0x95ca('0x35')]));if(_0x26c4a0[_0x95ca('0x33')][_0x95ca('0x3f')]){_0x3e3a70['where']=_[_0x95ca('0x40')](_0x3e3a70[_0x95ca('0x3d')],{'$or':_[_0x95ca('0x2c')](_0x3e3a70['attributes'],function(_0x7c7403){var _0x1c9fa3={};_0x1c9fa3[_0x7c7403]={'$like':'%'+_0x26c4a0[_0x95ca('0x33')]['filter']+'%'};return _0x1c9fa3;})});}_0x3e3a70=_[_0x95ca('0x40')]({},_0x3e3a70,_0x26c4a0[_0x95ca('0x42')]);return _0x350694['getDescriptions'](_0x3e3a70);}})['then'](function(_0x1934f5){if(_0x1934f5){_0x4df500=_0x1934f5[_0x95ca('0x4d')];if(!_0x26c4a0['query'][_0x95ca('0x39')](_0x95ca('0x3a'))){_0x3e3a70[_0x95ca('0x1e')]=qs[_0x95ca('0x1e')](_0x26c4a0[_0x95ca('0x33')]['limit']);_0x3e3a70[_0x95ca('0x1c')]=qs[_0x95ca('0x1c')](_0x26c4a0['query'][_0x95ca('0x1c')]);}return _0x350694[_0x95ca('0x50')](_0x3e3a70);}})[_0x95ca('0x25')](function(_0x5c9cb8){if(_0x5c9cb8){return _0x5c9cb8?{'count':_0x4df500,'rows':_0x5c9cb8}:null;}})[_0x95ca('0x25')](respondWithResult(_0x54a9ea,null))[_0x95ca('0x46')](handleError(_0x54a9ea,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 12f5096..97ed745 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x3dd991,_0x4bef12){var _0x251609=function(_0x371481){while(--_0x371481){_0x3dd991['push'](_0x3dd991['shift']());}};_0x251609(++_0x4bef12);}(_0x3e74,0x175));var _0x43e7=function(_0x20948c,_0x141b4e){_0x20948c=_0x20948c-0x0;var _0x18cdc8=_0x3e74[_0x20948c];return _0x18cdc8;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x147e56,_0x2efae8){var _0x40c49c=function(_0x380aaa){while(--_0x380aaa){_0x147e56['push'](_0x147e56['shift']());}};_0x40c49c(++_0x2efae8);}(_0x3e74,0x175));var _0x43e7=function(_0x30343b,_0x29dde8){_0x30343b=_0x30343b-0x0;var _0x47d427=_0x3e74[_0x30343b];return _0x47d427;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index f4c2c0e..220a3bb 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 _0x9fbd=['Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x34a284,_0x207084){var _0x2ec13b=function(_0x197011){while(--_0x197011){_0x34a284['push'](_0x34a284['shift']());}};_0x2ec13b(++_0x207084);}(_0x9fbd,0x82));var _0xd9fb=function(_0x160bef,_0x26ee0a){_0x160bef=_0x160bef-0x0;var _0x24acc6=_0x9fbd[_0x160bef];return _0x24acc6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd9fb('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9fb('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd9fb('0x2'));var config=require(_0xd9fb('0x3'));var jayson=require(_0xd9fb('0x4'));var client=jayson['client'][_0xd9fb('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x32aab5,_0x58dcbc,_0x2d7bca){return new BPromise(function(_0x2e63fd,_0x4d3723){return client[_0xd9fb('0x6')](_0x32aab5,_0x2d7bca)[_0xd9fb('0x7')](function(_0x49f4be){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x58dcbc,_0xd9fb('0x8'));logger[_0xd9fb('0x9')](_0xd9fb('0xa'),_0x58dcbc,_0xd9fb('0x8'),JSON[_0xd9fb('0xb')](_0x49f4be));if(_0x49f4be[_0xd9fb('0xc')]){if(_0x49f4be['error'][_0xd9fb('0xd')]===0x1f4){logger[_0xd9fb('0xc')](_0xd9fb('0xe'),_0x58dcbc,_0x49f4be[_0xd9fb('0xc')][_0xd9fb('0xf')]);return _0x4d3723(_0x49f4be['error'][_0xd9fb('0xf')]);}logger['error'](_0xd9fb('0xe'),_0x58dcbc,_0x49f4be['error'][_0xd9fb('0xf')]);return _0x2e63fd(_0x49f4be[_0xd9fb('0xc')][_0xd9fb('0xf')]);}else{logger['info'](_0xd9fb('0xe'),_0x58dcbc,_0xd9fb('0x8'));_0x2e63fd(_0x49f4be[_0xd9fb('0x10')]['message']);}})[_0xd9fb('0x11')](function(_0xe013ec){logger[_0xd9fb('0xc')](_0xd9fb('0xe'),_0x58dcbc,_0xe013ec);_0x4d3723(_0xe013ec);});});} \ No newline at end of file +var _0x12b7=['code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x12b7,0x115));var _0x712b=function(_0x40354e,_0x1333c){_0x40354e=_0x40354e-0x0;var _0x286665=_0x12b7[_0x40354e];return _0x286665;};'use strict';var _=require(_0x712b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x712b('0x1'));var fs=require('fs');var Redis=require(_0x712b('0x2'));var db=require(_0x712b('0x3'))['db'];var utils=require(_0x712b('0x4'));var logger=require(_0x712b('0x5'))(_0x712b('0x6'));var config=require(_0x712b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x712b('0x8')][_0x712b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6d3c98,_0x1ffd14,_0x3ba920){return new BPromise(function(_0xe4fe77,_0x3bf813){return client['request'](_0x6d3c98,_0x3ba920)[_0x712b('0xa')](function(_0x2a61e5){logger[_0x712b('0xb')](_0x712b('0xc'),_0x1ffd14,_0x712b('0xd'));logger[_0x712b('0xe')](_0x712b('0xf'),_0x1ffd14,'request\x20sent',JSON['stringify'](_0x2a61e5));if(_0x2a61e5[_0x712b('0x10')]){if(_0x2a61e5[_0x712b('0x10')][_0x712b('0x11')]===0x1f4){logger[_0x712b('0x10')](_0x712b('0xc'),_0x1ffd14,_0x2a61e5[_0x712b('0x10')]['message']);return _0x3bf813(_0x2a61e5['error'][_0x712b('0x12')]);}logger[_0x712b('0x10')](_0x712b('0xc'),_0x1ffd14,_0x2a61e5[_0x712b('0x10')]['message']);return _0xe4fe77(_0x2a61e5[_0x712b('0x10')]['message']);}else{logger[_0x712b('0xb')](_0x712b('0xc'),_0x1ffd14,_0x712b('0xd'));_0xe4fe77(_0x2a61e5[_0x712b('0x13')][_0x712b('0x12')]);}})[_0x712b('0x14')](function(_0x52f0b0){logger[_0x712b('0x10')](_0x712b('0xc'),_0x1ffd14,_0x52f0b0);_0x3bf813(_0x52f0b0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 429d0cf..b85b352 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 _0x350d=['create','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show'];(function(_0x3f7bcd,_0x12db13){var _0x331a0b=function(_0x4b7430){while(--_0x4b7430){_0x3f7bcd['push'](_0x3f7bcd['shift']());}};_0x331a0b(++_0x12db13);}(_0x350d,0xb4));var _0xd350=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x350d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd350('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd350('0x1'));var express=require('express');var router=express[_0xd350('0x2')]();var fs_extra=require(_0xd350('0x3'));var auth=require(_0xd350('0x4'));var interaction=require(_0xd350('0x5'));var config=require(_0xd350('0x6'));var controller=require(_0xd350('0x7'));router[_0xd350('0x8')]('/',auth[_0xd350('0x9')](),controller['index']);router[_0xd350('0x8')](_0xd350('0xa'),auth[_0xd350('0x9')](),controller[_0xd350('0xb')]);router['post']('/',auth[_0xd350('0x9')](),controller[_0xd350('0xc')]);router['put'](_0xd350('0xa'),auth[_0xd350('0x9')](),controller[_0xd350('0xd')]);router['delete']('/:id',auth[_0xd350('0x9')](),controller[_0xd350('0xe')]);module[_0xd350('0xf')]=router; \ No newline at end of file +var _0xe684=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x2cf67a,_0x32046e){var _0x5fbbf3=function(_0x35b401){while(--_0x35b401){_0x2cf67a['push'](_0x2cf67a['shift']());}};_0x5fbbf3(++_0x32046e);}(_0xe684,0x151));var _0x4e68=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe684[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x4e68('0x0'));var util=require(_0x4e68('0x1'));var path=require(_0x4e68('0x2'));var timeout=require(_0x4e68('0x3'));var express=require('express');var router=express[_0x4e68('0x4')]();var fs_extra=require(_0x4e68('0x5'));var auth=require(_0x4e68('0x6'));var interaction=require(_0x4e68('0x7'));var config=require(_0x4e68('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x4e68('0x9')]('/',auth[_0x4e68('0xa')](),controller[_0x4e68('0xb')]);router[_0x4e68('0x9')](_0x4e68('0xc'),auth[_0x4e68('0xa')](),controller['show']);router[_0x4e68('0xd')]('/',auth[_0x4e68('0xa')](),controller[_0x4e68('0xe')]);router[_0x4e68('0xf')](_0x4e68('0xc'),auth[_0x4e68('0xa')](),controller[_0x4e68('0x10')]);router[_0x4e68('0x11')]('/:id',auth[_0x4e68('0xa')](),controller['destroy']);module[_0x4e68('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 bbfa73e..0e1260a 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 _0x59ec=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x4261dc,_0x14919c){var _0xc81ca3=function(_0x176f65){while(--_0x176f65){_0x4261dc['push'](_0x4261dc['shift']());}};_0xc81ca3(++_0x14919c);}(_0x59ec,0x19e));var _0xc59e=function(_0x5eb408,_0x376f7e){_0x5eb408=_0x5eb408-0x0;var _0x193299=_0x59ec[_0x5eb408];return _0x193299;};'use strict';var Sequelize=require(_0xc59e('0x0'));module[_0xc59e('0x1')]={'type':{'type':Sequelize[_0xc59e('0x2')](_0xc59e('0x3'),_0xc59e('0x4'),_0xc59e('0x5'),'keyValue',_0xc59e('0x6')),'defaultValue':_0xc59e('0x3')},'content':{'type':Sequelize[_0xc59e('0x7')]},'key':{'type':Sequelize[_0xc59e('0x7')]},'keyType':{'type':Sequelize[_0xc59e('0x2')](_0xc59e('0x3'),_0xc59e('0x4'),_0xc59e('0x5'))},'keyContent':{'type':Sequelize[_0xc59e('0x7')]},'idField':{'type':Sequelize[_0xc59e('0x7')]},'nameField':{'type':Sequelize[_0xc59e('0x7')]},'customField':{'type':Sequelize[_0xc59e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc59e('0x7')]}}; \ No newline at end of file +var _0x2cbc=['picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x2aaa65,_0x42d412){var _0x4edf7e=function(_0x4b0a17){while(--_0x4b0a17){_0x2aaa65['push'](_0x2aaa65['shift']());}};_0x4edf7e(++_0x42d412);}(_0x2cbc,0x78));var _0xc2cb=function(_0x455e00,_0x29577f){_0x455e00=_0x455e00-0x0;var _0x568400=_0x2cbc[_0x455e00];return _0x568400;};'use strict';var Sequelize=require(_0xc2cb('0x0'));module[_0xc2cb('0x1')]={'type':{'type':Sequelize[_0xc2cb('0x2')]('string',_0xc2cb('0x3'),_0xc2cb('0x4'),_0xc2cb('0x5'),_0xc2cb('0x6')),'defaultValue':_0xc2cb('0x7')},'content':{'type':Sequelize[_0xc2cb('0x8')]},'key':{'type':Sequelize[_0xc2cb('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xc2cb('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xc2cb('0x8')]},'idField':{'type':Sequelize[_0xc2cb('0x8')]},'nameField':{'type':Sequelize[_0xc2cb('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc2cb('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 39bae4e..c232426 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 _0x9648=['end','json','undefined','limit','count','offset','set','apply','reject','update','then','stack','send','index','map','rawAttributes','fieldName','key','name','query','intersection','model','fields','attributes','length','nolimit','sort','where','filters','merge','options','Dynamics365Field','includeAll','findAll','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x3b39a0,_0x277194){var _0xc739e8=function(_0x2dbb3b){while(--_0x2dbb3b){_0x3b39a0['push'](_0x3b39a0['shift']());}};_0xc739e8(++_0x277194);}(_0x9648,0x142));var _0x8964=function(_0x1ca376,_0x53bbf7){_0x1ca376=_0x1ca376-0x0;var _0x4dbe51=_0x9648[_0x1ca376];return _0x4dbe51;};'use strict';var emlformat=require(_0x8964('0x0'));var rimraf=require(_0x8964('0x1'));var zipdir=require(_0x8964('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8964('0x3'));var moment=require(_0x8964('0x4'));var BPromise=require(_0x8964('0x5'));var Mustache=require(_0x8964('0x6'));var util=require(_0x8964('0x7'));var path=require(_0x8964('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8964('0x9'));var fs=require('fs');var fs_extra=require(_0x8964('0xa'));var _=require('lodash');var squel=require(_0x8964('0xb'));var crypto=require(_0x8964('0xc'));var jsforce=require(_0x8964('0xd'));var deskjs=require(_0x8964('0xe'));var toCsv=require(_0x8964('0xf'));var querystring=require(_0x8964('0x10'));var Papa=require('papaparse');var Redis=require(_0x8964('0x11'));var authService=require(_0x8964('0x12'));var qs=require(_0x8964('0x13'));var as=require(_0x8964('0x14'));var hardwareService=require(_0x8964('0x15'));var logger=require('../../config/logger')(_0x8964('0x16'));var utils=require(_0x8964('0x17'));var config=require(_0x8964('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8964('0x19'))['db'];function respondWithStatusCode(_0x25796e,_0x1d452c){_0x1d452c=_0x1d452c||0xcc;return function(_0x5989e3){if(_0x5989e3){return _0x25796e[_0x8964('0x1a')](_0x1d452c);}return _0x25796e[_0x8964('0x1b')](_0x1d452c)[_0x8964('0x1c')]();};}function respondWithResult(_0x823b86,_0x262aaa){_0x262aaa=_0x262aaa||0xc8;return function(_0x2328b3){if(_0x2328b3){return _0x823b86[_0x8964('0x1b')](_0x262aaa)[_0x8964('0x1d')](_0x2328b3);}};}function respondWithFilteredResult(_0x2cb6e7,_0x1d6d9b){return function(_0x2543b0){if(_0x2543b0){var _0x1c63cf=typeof _0x1d6d9b['offset']===_0x8964('0x1e')&&typeof _0x1d6d9b[_0x8964('0x1f')]===_0x8964('0x1e');var _0xd4be10=_0x2543b0[_0x8964('0x20')];var _0x2619f4=_0x1c63cf?0x0:_0x1d6d9b[_0x8964('0x21')];var _0x33d7c9=_0x1c63cf?_0x2543b0[_0x8964('0x20')]:_0x1d6d9b[_0x8964('0x21')]+_0x1d6d9b[_0x8964('0x1f')];var _0x42d463;if(_0x33d7c9>=_0xd4be10){_0x33d7c9=_0xd4be10;_0x42d463=0xc8;}else{_0x42d463=0xce;}_0x2cb6e7[_0x8964('0x1b')](_0x42d463);return _0x2cb6e7[_0x8964('0x22')]('Content-Range',_0x2619f4+'-'+_0x33d7c9+'/'+_0xd4be10)[_0x8964('0x1d')](_0x2543b0);}return null;};}function patchUpdates(_0x47eea7){return function(_0x320d1b){try{jsonpatch[_0x8964('0x23')](_0x320d1b,_0x47eea7,!![]);}catch(_0x503201){return BPromise[_0x8964('0x24')](_0x503201);}return _0x320d1b['save']();};}function saveUpdates(_0x4c359d,_0x45d3fa){return function(_0x31ea66){if(_0x31ea66){return _0x31ea66[_0x8964('0x25')](_0x4c359d)[_0x8964('0x26')](function(_0x485075){return _0x485075;});}return null;};}function removeEntity(_0xea6d8d,_0x4cea70){return function(_0x8cb1f0){if(_0x8cb1f0){return _0x8cb1f0['destroy']()[_0x8964('0x26')](function(){_0xea6d8d[_0x8964('0x1b')](0xcc)[_0x8964('0x1c')]();});}};}function handleEntityNotFound(_0x4e68c8,_0x9d828b){return function(_0xeb81fd){if(!_0xeb81fd){_0x4e68c8[_0x8964('0x1a')](0x194);}return _0xeb81fd;};}function handleError(_0x4fcfd6,_0x226e85){_0x226e85=_0x226e85||0x1f4;return function(_0x5b658f){logger['error'](_0x5b658f[_0x8964('0x27')]);if(_0x5b658f['name']){delete _0x5b658f['name'];}_0x4fcfd6[_0x8964('0x1b')](_0x226e85)[_0x8964('0x28')](_0x5b658f);};}exports[_0x8964('0x29')]=function(_0x40475b,_0x481828){var _0x28cf4f={},_0x2b0fdb={},_0x41009e={'count':0x0,'rows':[]};var _0x57b478=_[_0x8964('0x2a')](db['Dynamics365Field'][_0x8964('0x2b')],function(_0x2dba3e){return{'name':_0x2dba3e[_0x8964('0x2c')],'type':_0x2dba3e['type'][_0x8964('0x2d')]};});_0x2b0fdb['model']=_[_0x8964('0x2a')](_0x57b478,_0x8964('0x2e'));_0x2b0fdb[_0x8964('0x2f')]=_['keys'](_0x40475b['query']);_0x2b0fdb['filters']=_[_0x8964('0x30')](_0x2b0fdb[_0x8964('0x31')],_0x2b0fdb[_0x8964('0x2f')]);_0x28cf4f['attributes']=_['intersection'](_0x2b0fdb[_0x8964('0x31')],qs[_0x8964('0x32')](_0x40475b[_0x8964('0x2f')][_0x8964('0x32')]));_0x28cf4f[_0x8964('0x33')]=_0x28cf4f['attributes'][_0x8964('0x34')]?_0x28cf4f['attributes']:_0x2b0fdb[_0x8964('0x31')];if(!_0x40475b[_0x8964('0x2f')]['hasOwnProperty'](_0x8964('0x35'))){_0x28cf4f[_0x8964('0x1f')]=qs[_0x8964('0x1f')](_0x40475b[_0x8964('0x2f')][_0x8964('0x1f')]);_0x28cf4f[_0x8964('0x21')]=qs[_0x8964('0x21')](_0x40475b['query'][_0x8964('0x21')]);}_0x28cf4f['order']=qs[_0x8964('0x36')](_0x40475b['query'][_0x8964('0x36')]);_0x28cf4f[_0x8964('0x37')]=qs[_0x8964('0x38')](_['pick'](_0x40475b[_0x8964('0x2f')],_0x2b0fdb[_0x8964('0x38')]),_0x57b478);if(_0x40475b[_0x8964('0x2f')]['filter']){_0x28cf4f[_0x8964('0x37')]=_[_0x8964('0x39')](_0x28cf4f['where'],{'$or':_['map'](_0x57b478,function(_0x3efb61){if(_0x3efb61['type']!=='VIRTUAL'){var _0x547557={};_0x547557[_0x3efb61[_0x8964('0x2e')]]={'$like':'%'+_0x40475b['query']['filter']+'%'};return _0x547557;}})});}_0x28cf4f=_[_0x8964('0x39')]({},_0x28cf4f,_0x40475b[_0x8964('0x3a')]);var _0x42f250={'where':_0x28cf4f[_0x8964('0x37')]};return db[_0x8964('0x3b')][_0x8964('0x20')](_0x42f250)[_0x8964('0x26')](function(_0x2ff5fd){_0x41009e[_0x8964('0x20')]=_0x2ff5fd;if(_0x40475b[_0x8964('0x2f')][_0x8964('0x3c')]){_0x28cf4f['include']=[{'all':!![]}];}return db[_0x8964('0x3b')][_0x8964('0x3d')](_0x28cf4f);})[_0x8964('0x26')](function(_0x509ad5){_0x41009e['rows']=_0x509ad5;return _0x41009e;})['then'](respondWithFilteredResult(_0x481828,_0x28cf4f))[_0x8964('0x3e')](handleError(_0x481828,null));};exports[_0x8964('0x3f')]=function(_0xb9bc08,_0x20f4be){var _0x133bef={'raw':!![],'where':{'id':_0xb9bc08[_0x8964('0x40')]['id']}},_0x196f8b={};_0x196f8b[_0x8964('0x31')]=_[_0x8964('0x41')](db[_0x8964('0x3b')][_0x8964('0x2b')]);_0x196f8b['query']=_[_0x8964('0x41')](_0xb9bc08[_0x8964('0x2f')]);_0x196f8b[_0x8964('0x38')]=_['intersection'](_0x196f8b[_0x8964('0x31')],_0x196f8b[_0x8964('0x2f')]);_0x133bef[_0x8964('0x33')]=_['intersection'](_0x196f8b[_0x8964('0x31')],qs[_0x8964('0x32')](_0xb9bc08[_0x8964('0x2f')][_0x8964('0x32')]));_0x133bef[_0x8964('0x33')]=_0x133bef['attributes']['length']?_0x133bef[_0x8964('0x33')]:_0x196f8b[_0x8964('0x31')];if(_0xb9bc08[_0x8964('0x2f')][_0x8964('0x3c')]){_0x133bef[_0x8964('0x42')]=[{'all':!![]}];}_0x133bef=_['merge']({},_0x133bef,_0xb9bc08[_0x8964('0x3a')]);return db[_0x8964('0x3b')][_0x8964('0x43')](_0x133bef)[_0x8964('0x26')](handleEntityNotFound(_0x20f4be,null))[_0x8964('0x26')](respondWithResult(_0x20f4be,null))[_0x8964('0x3e')](handleError(_0x20f4be,null));};exports[_0x8964('0x44')]=function(_0xe7c997,_0x1277fa){return db[_0x8964('0x3b')][_0x8964('0x44')](_0xe7c997['body'],{})[_0x8964('0x26')](respondWithResult(_0x1277fa,0xc9))[_0x8964('0x3e')](handleError(_0x1277fa,null));};exports[_0x8964('0x25')]=function(_0x2c57b0,_0x15434b){if(_0x2c57b0[_0x8964('0x45')]['id']){delete _0x2c57b0[_0x8964('0x45')]['id'];}return db[_0x8964('0x3b')][_0x8964('0x43')]({'where':{'id':_0x2c57b0['params']['id']}})[_0x8964('0x26')](handleEntityNotFound(_0x15434b,null))[_0x8964('0x26')](saveUpdates(_0x2c57b0[_0x8964('0x45')],null))[_0x8964('0x26')](respondWithResult(_0x15434b,null))[_0x8964('0x3e')](handleError(_0x15434b,null));};exports['destroy']=function(_0x39a254,_0x9e03a9){return db[_0x8964('0x3b')][_0x8964('0x43')]({'where':{'id':_0x39a254[_0x8964('0x40')]['id']}})[_0x8964('0x26')](handleEntityNotFound(_0x9e03a9,null))[_0x8964('0x26')](removeEntity(_0x9e03a9,null))[_0x8964('0x3e')](handleError(_0x9e03a9,null));}; \ No newline at end of file +var _0xa3bb=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','name','send','index','map','Dynamics365Field','rawAttributes','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','intersection','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xa3bb,0x7f));var _0xba3b=function(_0x50f93b,_0x131ae4){_0x50f93b=_0x50f93b-0x0;var _0x4b443d=_0xa3bb[_0x50f93b];return _0x4b443d;};'use strict';var emlformat=require(_0xba3b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba3b('0x1'));var jsonpatch=require(_0xba3b('0x2'));var rp=require('request-promise');var moment=require(_0xba3b('0x3'));var BPromise=require(_0xba3b('0x4'));var Mustache=require('mustache');var util=require(_0xba3b('0x5'));var path=require(_0xba3b('0x6'));var sox=require(_0xba3b('0x7'));var csv=require(_0xba3b('0x8'));var ejs=require(_0xba3b('0x9'));var fs=require('fs');var fs_extra=require(_0xba3b('0xa'));var _=require(_0xba3b('0xb'));var squel=require('squel');var crypto=require(_0xba3b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba3b('0x8'));var querystring=require(_0xba3b('0xd'));var Papa=require(_0xba3b('0xe'));var Redis=require(_0xba3b('0xf'));var authService=require(_0xba3b('0x10'));var qs=require(_0xba3b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba3b('0x12'));var logger=require(_0xba3b('0x13'))(_0xba3b('0x14'));var utils=require(_0xba3b('0x15'));var config=require(_0xba3b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5728e4,_0x84a1ad){_0x84a1ad=_0x84a1ad||0xcc;return function(_0x1e441f){if(_0x1e441f){return _0x5728e4[_0xba3b('0x17')](_0x84a1ad);}return _0x5728e4[_0xba3b('0x18')](_0x84a1ad)[_0xba3b('0x19')]();};}function respondWithResult(_0x1c5ee9,_0x1b2c8d){_0x1b2c8d=_0x1b2c8d||0xc8;return function(_0x4a06ff){if(_0x4a06ff){return _0x1c5ee9[_0xba3b('0x18')](_0x1b2c8d)['json'](_0x4a06ff);}};}function respondWithFilteredResult(_0x56da85,_0x56f2b9){return function(_0x305e3b){if(_0x305e3b){var _0x2fb736=typeof _0x56f2b9[_0xba3b('0x1a')]===_0xba3b('0x1b')&&typeof _0x56f2b9[_0xba3b('0x1c')]===_0xba3b('0x1b');var _0x5770d7=_0x305e3b[_0xba3b('0x1d')];var _0x7f97d2=_0x2fb736?0x0:_0x56f2b9[_0xba3b('0x1a')];var _0x1eb35e=_0x2fb736?_0x305e3b[_0xba3b('0x1d')]:_0x56f2b9[_0xba3b('0x1a')]+_0x56f2b9[_0xba3b('0x1c')];var _0x1c5a3b;if(_0x1eb35e>=_0x5770d7){_0x1eb35e=_0x5770d7;_0x1c5a3b=0xc8;}else{_0x1c5a3b=0xce;}_0x56da85['status'](_0x1c5a3b);return _0x56da85[_0xba3b('0x1e')](_0xba3b('0x1f'),_0x7f97d2+'-'+_0x1eb35e+'/'+_0x5770d7)[_0xba3b('0x20')](_0x305e3b);}return null;};}function patchUpdates(_0x1bfec1){return function(_0x1110ee){try{jsonpatch[_0xba3b('0x21')](_0x1110ee,_0x1bfec1,!![]);}catch(_0x3b520f){return BPromise[_0xba3b('0x22')](_0x3b520f);}return _0x1110ee[_0xba3b('0x23')]();};}function saveUpdates(_0x4b4c68,_0x5de313){return function(_0x341424){if(_0x341424){return _0x341424[_0xba3b('0x24')](_0x4b4c68)[_0xba3b('0x25')](function(_0x3dc410){return _0x3dc410;});}return null;};}function removeEntity(_0x1b0b21,_0x23703b){return function(_0x2dd03a){if(_0x2dd03a){return _0x2dd03a['destroy']()[_0xba3b('0x25')](function(){_0x1b0b21[_0xba3b('0x18')](0xcc)[_0xba3b('0x19')]();});}};}function handleEntityNotFound(_0x1932cd,_0x5506e9){return function(_0x1d257d){if(!_0x1d257d){_0x1932cd[_0xba3b('0x17')](0x194);}return _0x1d257d;};}function handleError(_0x500709,_0x35aff2){_0x35aff2=_0x35aff2||0x1f4;return function(_0x25355f){logger['error'](_0x25355f['stack']);if(_0x25355f[_0xba3b('0x26')]){delete _0x25355f['name'];}_0x500709[_0xba3b('0x18')](_0x35aff2)[_0xba3b('0x27')](_0x25355f);};}exports[_0xba3b('0x28')]=function(_0x1946e2,_0x49779c){var _0x518f23={},_0x522b2c={},_0x4cd050={'count':0x0,'rows':[]};var _0x41dc75=_[_0xba3b('0x29')](db[_0xba3b('0x2a')][_0xba3b('0x2b')],function(_0x274f3a){return{'name':_0x274f3a['fieldName'],'type':_0x274f3a['type']['key']};});_0x522b2c['model']=_[_0xba3b('0x29')](_0x41dc75,'name');_0x522b2c[_0xba3b('0x2c')]=_[_0xba3b('0x2d')](_0x1946e2[_0xba3b('0x2c')]);_0x522b2c[_0xba3b('0x2e')]=_['intersection'](_0x522b2c[_0xba3b('0x2f')],_0x522b2c[_0xba3b('0x2c')]);_0x518f23[_0xba3b('0x30')]=_['intersection'](_0x522b2c[_0xba3b('0x2f')],qs[_0xba3b('0x31')](_0x1946e2['query'][_0xba3b('0x31')]));_0x518f23[_0xba3b('0x30')]=_0x518f23[_0xba3b('0x30')]['length']?_0x518f23[_0xba3b('0x30')]:_0x522b2c[_0xba3b('0x2f')];if(!_0x1946e2[_0xba3b('0x2c')][_0xba3b('0x32')](_0xba3b('0x33'))){_0x518f23['limit']=qs[_0xba3b('0x1c')](_0x1946e2[_0xba3b('0x2c')]['limit']);_0x518f23[_0xba3b('0x1a')]=qs['offset'](_0x1946e2[_0xba3b('0x2c')][_0xba3b('0x1a')]);}_0x518f23['order']=qs[_0xba3b('0x34')](_0x1946e2[_0xba3b('0x2c')][_0xba3b('0x34')]);_0x518f23[_0xba3b('0x35')]=qs[_0xba3b('0x2e')](_[_0xba3b('0x36')](_0x1946e2[_0xba3b('0x2c')],_0x522b2c['filters']),_0x41dc75);if(_0x1946e2[_0xba3b('0x2c')][_0xba3b('0x37')]){_0x518f23[_0xba3b('0x35')]=_[_0xba3b('0x38')](_0x518f23['where'],{'$or':_[_0xba3b('0x29')](_0x41dc75,function(_0x160b19){if(_0x160b19['type']!==_0xba3b('0x39')){var _0x41b6a4={};_0x41b6a4[_0x160b19['name']]={'$like':'%'+_0x1946e2[_0xba3b('0x2c')][_0xba3b('0x37')]+'%'};return _0x41b6a4;}})});}_0x518f23=_[_0xba3b('0x38')]({},_0x518f23,_0x1946e2[_0xba3b('0x3a')]);var _0x5ab699={'where':_0x518f23['where']};return db[_0xba3b('0x2a')][_0xba3b('0x1d')](_0x5ab699)[_0xba3b('0x25')](function(_0x5a94a9){_0x4cd050[_0xba3b('0x1d')]=_0x5a94a9;if(_0x1946e2['query']['includeAll']){_0x518f23[_0xba3b('0x3b')]=[{'all':!![]}];}return db[_0xba3b('0x2a')][_0xba3b('0x3c')](_0x518f23);})['then'](function(_0x21cb7a){_0x4cd050['rows']=_0x21cb7a;return _0x4cd050;})[_0xba3b('0x25')](respondWithFilteredResult(_0x49779c,_0x518f23))[_0xba3b('0x3d')](handleError(_0x49779c,null));};exports['show']=function(_0x4640db,_0x209251){var _0x5873f1={'raw':!![],'where':{'id':_0x4640db[_0xba3b('0x3e')]['id']}},_0x2fb01f={};_0x2fb01f[_0xba3b('0x2f')]=_[_0xba3b('0x2d')](db[_0xba3b('0x2a')][_0xba3b('0x2b')]);_0x2fb01f[_0xba3b('0x2c')]=_[_0xba3b('0x2d')](_0x4640db['query']);_0x2fb01f[_0xba3b('0x2e')]=_[_0xba3b('0x3f')](_0x2fb01f['model'],_0x2fb01f[_0xba3b('0x2c')]);_0x5873f1['attributes']=_[_0xba3b('0x3f')](_0x2fb01f['model'],qs['fields'](_0x4640db[_0xba3b('0x2c')]['fields']));_0x5873f1['attributes']=_0x5873f1[_0xba3b('0x30')]['length']?_0x5873f1[_0xba3b('0x30')]:_0x2fb01f['model'];if(_0x4640db[_0xba3b('0x2c')][_0xba3b('0x40')]){_0x5873f1[_0xba3b('0x3b')]=[{'all':!![]}];}_0x5873f1=_['merge']({},_0x5873f1,_0x4640db['options']);return db[_0xba3b('0x2a')][_0xba3b('0x41')](_0x5873f1)[_0xba3b('0x25')](handleEntityNotFound(_0x209251,null))[_0xba3b('0x25')](respondWithResult(_0x209251,null))[_0xba3b('0x3d')](handleError(_0x209251,null));};exports[_0xba3b('0x42')]=function(_0x486f47,_0x2544b3){return db[_0xba3b('0x2a')]['create'](_0x486f47['body'],{})[_0xba3b('0x25')](respondWithResult(_0x2544b3,0xc9))[_0xba3b('0x3d')](handleError(_0x2544b3,null));};exports[_0xba3b('0x24')]=function(_0x3b8453,_0x3ad877){if(_0x3b8453[_0xba3b('0x43')]['id']){delete _0x3b8453[_0xba3b('0x43')]['id'];}return db[_0xba3b('0x2a')]['find']({'where':{'id':_0x3b8453[_0xba3b('0x3e')]['id']}})[_0xba3b('0x25')](handleEntityNotFound(_0x3ad877,null))[_0xba3b('0x25')](saveUpdates(_0x3b8453[_0xba3b('0x43')],null))[_0xba3b('0x25')](respondWithResult(_0x3ad877,null))[_0xba3b('0x3d')](handleError(_0x3ad877,null));};exports['destroy']=function(_0x4ea2f1,_0x1c4ab8){return db['Dynamics365Field'][_0xba3b('0x41')]({'where':{'id':_0x4ea2f1['params']['id']}})[_0xba3b('0x25')](handleEntityNotFound(_0x1c4ab8,null))['then'](removeEntity(_0x1c4ab8,null))[_0xba3b('0x3d')](handleError(_0x1c4ab8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 759d83e..73a3dff 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 _0xa520=['int_dynamics365_fields','idField','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','define','Dynamics365Field'];(function(_0x1b860b,_0x3f1a88){var _0x36fe97=function(_0x44b17f){while(--_0x44b17f){_0x1b860b['push'](_0x1b860b['shift']());}};_0x36fe97(++_0x3f1a88);}(_0xa520,0x117));var _0x0a52=function(_0x473473,_0x127961){_0x473473=_0x473473-0x0;var _0x2dd1a0=_0xa520[_0x473473];return _0x2dd1a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0a52('0x0'))(_0x0a52('0x1'));var moment=require('moment');var BPromise=require(_0x0a52('0x2'));var rp=require(_0x0a52('0x3'));var fs=require('fs');var path=require(_0x0a52('0x4'));var rimraf=require(_0x0a52('0x5'));var config=require('../../config/environment');var attributes=require(_0x0a52('0x6'));module['exports']=function(_0x918327,_0x4b0882){return _0x918327[_0x0a52('0x7')](_0x0a52('0x8'),attributes,{'tableName':_0x0a52('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x0a52('0xa'),_0x0a52('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x87c2=['idField','lodash','util','../../config/logger','api','moment','bluebird','./intDynamics365Field.attributes','define','Dynamics365Field','dynamics365_unique_index'];(function(_0x36e8e4,_0x213a61){var _0x491ac7=function(_0x2e9e78){while(--_0x2e9e78){_0x36e8e4['push'](_0x36e8e4['shift']());}};_0x491ac7(++_0x213a61);}(_0x87c2,0x1a3));var _0x287c=function(_0x3905b7,_0xbfc295){_0x3905b7=_0x3905b7-0x0;var _0x2d2d3c=_0x87c2[_0x3905b7];return _0x2d2d3c;};'use strict';var _=require(_0x287c('0x0'));var util=require(_0x287c('0x1'));var logger=require(_0x287c('0x2'))(_0x287c('0x3'));var moment=require(_0x287c('0x4'));var BPromise=require(_0x287c('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(_0x287c('0x6'));module['exports']=function(_0x3c83b8,_0x174c0c){return _0x3c83b8[_0x287c('0x7')](_0x287c('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x287c('0x9'),'fields':[_0x287c('0xa'),'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 4130bf9..d1adc34 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 _0x642b=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x279ce8,_0xf46108){var _0x3bd98f=function(_0x9875f3){while(--_0x9875f3){_0x279ce8['push'](_0x279ce8['shift']());}};_0x3bd98f(++_0xf46108);}(_0x642b,0x85));var _0xb642=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x642b[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xb642('0x0'));var util=require(_0xb642('0x1'));var moment=require(_0xb642('0x2'));var BPromise=require(_0xb642('0x3'));var rs=require(_0xb642('0x4'));var fs=require('fs');var Redis=require(_0xb642('0x5'));var db=require(_0xb642('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb642('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb642('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x68a7fa,_0x41aea3,_0x1c50ba){return new BPromise(function(_0x3c7e89,_0x2ebc02){return client[_0xb642('0x9')](_0x68a7fa,_0x1c50ba)[_0xb642('0xa')](function(_0x48546f){logger[_0xb642('0xb')](_0xb642('0xc'),_0x41aea3,_0xb642('0xd'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x41aea3,_0xb642('0xd'),JSON[_0xb642('0xe')](_0x48546f));if(_0x48546f[_0xb642('0xf')]){if(_0x48546f['error'][_0xb642('0x10')]===0x1f4){logger['error'](_0xb642('0xc'),_0x41aea3,_0x48546f['error']['message']);return _0x2ebc02(_0x48546f[_0xb642('0xf')][_0xb642('0x11')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x41aea3,_0x48546f[_0xb642('0xf')][_0xb642('0x11')]);return _0x3c7e89(_0x48546f[_0xb642('0xf')]['message']);}else{logger[_0xb642('0xb')](_0xb642('0xc'),_0x41aea3,_0xb642('0xd'));_0x3c7e89(_0x48546f['result'][_0xb642('0x11')]);}})[_0xb642('0x12')](function(_0x370e82){logger[_0xb642('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x41aea3,_0x370e82);_0x2ebc02(_0x370e82);});});} \ No newline at end of file +var _0x9a05=['http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a05,0x14e));var _0x59a0=function(_0x3c6a1f,_0x5b1263){_0x3c6a1f=_0x3c6a1f-0x0;var _0x47daf8=_0x9a05[_0x3c6a1f];return _0x47daf8;};'use strict';var _=require(_0x59a0('0x0'));var util=require(_0x59a0('0x1'));var moment=require(_0x59a0('0x2'));var BPromise=require(_0x59a0('0x3'));var rs=require(_0x59a0('0x4'));var fs=require('fs');var Redis=require(_0x59a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x59a0('0x6'));var logger=require(_0x59a0('0x7'))(_0x59a0('0x8'));var config=require(_0x59a0('0x9'));var jayson=require(_0x59a0('0xa'));var client=jayson['client'][_0x59a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x248e02,_0x210b0a,_0x2e03e7){return new BPromise(function(_0x1d3cfb,_0x10c0cf){return client['request'](_0x248e02,_0x2e03e7)[_0x59a0('0xc')](function(_0x3a11fd){logger[_0x59a0('0xd')](_0x59a0('0xe'),_0x210b0a,_0x59a0('0xf'));logger['debug'](_0x59a0('0x10'),_0x210b0a,'request\x20sent',JSON[_0x59a0('0x11')](_0x3a11fd));if(_0x3a11fd[_0x59a0('0x12')]){if(_0x3a11fd[_0x59a0('0x12')][_0x59a0('0x13')]===0x1f4){logger[_0x59a0('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x210b0a,_0x3a11fd[_0x59a0('0x12')][_0x59a0('0x14')]);return _0x10c0cf(_0x3a11fd[_0x59a0('0x12')]['message']);}logger[_0x59a0('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x210b0a,_0x3a11fd[_0x59a0('0x12')][_0x59a0('0x14')]);return _0x1d3cfb(_0x3a11fd['error'][_0x59a0('0x14')]);}else{logger[_0x59a0('0xd')](_0x59a0('0xe'),_0x210b0a,'request\x20sent');_0x1d3cfb(_0x3a11fd[_0x59a0('0x15')][_0x59a0('0x14')]);}})[_0x59a0('0x16')](function(_0x4913d9){logger[_0x59a0('0x12')](_0x59a0('0xe'),_0x210b0a,_0x4913d9);_0x10c0cf(_0x4913d9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e2bcbcb..fdec414 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 _0xd6be=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','exports','util','path','connect-timeout'];(function(_0x5b49b5,_0xe5b574){var _0x2c87d1=function(_0x3253a6){while(--_0x3253a6){_0x5b49b5['push'](_0x5b49b5['shift']());}};_0x2c87d1(++_0xe5b574);}(_0xd6be,0x8d));var _0xed6b=function(_0x514eb5,_0x532d5e){_0x514eb5=_0x514eb5-0x0;var _0x54d9fb=_0xd6be[_0x514eb5];return _0x54d9fb;};'use strict';var multer=require('multer');var util=require(_0xed6b('0x0'));var path=require(_0xed6b('0x1'));var timeout=require(_0xed6b('0x2'));var express=require(_0xed6b('0x3'));var router=express[_0xed6b('0x4')]();var fs_extra=require(_0xed6b('0x5'));var auth=require(_0xed6b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xed6b('0x7'));var controller=require(_0xed6b('0x8'));router[_0xed6b('0x9')]('/',auth['isAuthenticated'](),controller[_0xed6b('0xa')]);router[_0xed6b('0x9')](_0xed6b('0xb'),auth[_0xed6b('0xc')](),controller[_0xed6b('0xd')]);router[_0xed6b('0x9')](_0xed6b('0xe'),auth['isAuthenticated'](),controller[_0xed6b('0xf')]);router[_0xed6b('0x9')]('/:id/fields',auth[_0xed6b('0xc')](),controller[_0xed6b('0x10')]);router['post']('/',auth[_0xed6b('0xc')](),controller[_0xed6b('0x11')]);router[_0xed6b('0x12')]('/:id/configurations',auth[_0xed6b('0xc')](),controller[_0xed6b('0x13')]);router[_0xed6b('0x14')](_0xed6b('0xb'),auth[_0xed6b('0xc')](),controller[_0xed6b('0x15')]);router[_0xed6b('0x16')]('/:id',auth[_0xed6b('0xc')](),controller['destroy']);module[_0xed6b('0x17')]=router; \ No newline at end of file +var _0x920c=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','path'];(function(_0x375bd0,_0x3fc00c){var _0xd67420=function(_0x1eb73b){while(--_0x1eb73b){_0x375bd0['push'](_0x375bd0['shift']());}};_0xd67420(++_0x3fc00c);}(_0x920c,0x1f2));var _0xc920=function(_0x938d88,_0x56ed77){_0x938d88=_0x938d88-0x0;var _0x15b05f=_0x920c[_0x938d88];return _0x15b05f;};'use strict';var multer=require(_0xc920('0x0'));var util=require('util');var path=require(_0xc920('0x1'));var timeout=require(_0xc920('0x2'));var express=require(_0xc920('0x3'));var router=express['Router']();var fs_extra=require(_0xc920('0x4'));var auth=require(_0xc920('0x5'));var interaction=require(_0xc920('0x6'));var config=require(_0xc920('0x7'));var controller=require(_0xc920('0x8'));router[_0xc920('0x9')]('/',auth[_0xc920('0xa')](),controller[_0xc920('0xb')]);router[_0xc920('0x9')](_0xc920('0xc'),auth[_0xc920('0xa')](),controller[_0xc920('0xd')]);router[_0xc920('0x9')](_0xc920('0xe'),auth[_0xc920('0xa')](),controller[_0xc920('0xf')]);router[_0xc920('0x9')](_0xc920('0x10'),auth[_0xc920('0xa')](),controller[_0xc920('0x11')]);router[_0xc920('0x12')]('/',auth[_0xc920('0xa')](),controller[_0xc920('0x13')]);router[_0xc920('0x12')](_0xc920('0xe'),auth[_0xc920('0xa')](),controller[_0xc920('0x14')]);router[_0xc920('0x15')](_0xc920('0xc'),auth[_0xc920('0xa')](),controller[_0xc920('0x16')]);router[_0xc920('0x17')](_0xc920('0xc'),auth[_0xc920('0xa')](),controller[_0xc920('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 7337cfc..9b28f75 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 _0x065e=['sequelize','STRING','username'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x065e,0x1a7));var _0xe065=function(_0x15dda2,_0x103eeb){_0x15dda2=_0x15dda2-0x0;var _0x6f6d1c=_0x065e[_0x15dda2];return _0x6f6d1c;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe065('0x1')],'unique':_0xe065('0x2')},'apiKey':{'type':Sequelize[_0xe065('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5204=['exports','STRING','username','sequelize'];(function(_0x8ca187,_0x2ca4a9){var _0x4aa094=function(_0x5c9ffb){while(--_0x5c9ffb){_0x8ca187['push'](_0x8ca187['shift']());}};_0x4aa094(++_0x2ca4a9);}(_0x5204,0xdf));var _0x4520=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0x5204[_0x29771f];return _0x279baf;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 5023ff1..e109ec5 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 _0xd49c=['api/v2/ticket_fields','Basic\x20%s','%s:X','toString','priority','source','ticket_type','group','company','remove','default','custom_text','custom_dropdown','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','offset','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','destroy','getConfigurations','order','findOne','AccountId','Subjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format'];(function(_0x51637c,_0x5bb102){var _0x6c6cd3=function(_0x50ba86){while(--_0x50ba86){_0x51637c['push'](_0x51637c['shift']());}};_0x6c6cd3(++_0x5bb102);}(_0xd49c,0x1d8));var _0xcd49=function(_0xd5b576,_0x53d48a){_0xd5b576=_0xd5b576-0x0;var _0x3bea2f=_0xd49c[_0xd5b576];return _0x3bea2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd49('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd49('0x1'));var rp=require(_0xcd49('0x2'));var moment=require('moment');var BPromise=require(_0xcd49('0x3'));var Mustache=require('mustache');var util=require(_0xcd49('0x4'));var path=require('path');var sox=require(_0xcd49('0x5'));var csv=require(_0xcd49('0x6'));var ejs=require(_0xcd49('0x7'));var fs=require('fs');var fs_extra=require(_0xcd49('0x8'));var _=require(_0xcd49('0x9'));var squel=require(_0xcd49('0xa'));var crypto=require(_0xcd49('0xb'));var jsforce=require(_0xcd49('0xc'));var deskjs=require(_0xcd49('0xd'));var toCsv=require(_0xcd49('0x6'));var querystring=require(_0xcd49('0xe'));var Papa=require('papaparse');var Redis=require(_0xcd49('0xf'));var authService=require(_0xcd49('0x10'));var qs=require(_0xcd49('0x11'));var as=require(_0xcd49('0x12'));var hardwareService=require(_0xcd49('0x13'));var logger=require(_0xcd49('0x14'))(_0xcd49('0x15'));var utils=require(_0xcd49('0x16'));var config=require(_0xcd49('0x17'));var licenseUtil=require(_0xcd49('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b8c8d,_0x2e817d){_0x2e817d=_0x2e817d||0xcc;return function(_0xfda206){if(_0xfda206){return _0x5b8c8d['sendStatus'](_0x2e817d);}return _0x5b8c8d[_0xcd49('0x19')](_0x2e817d)[_0xcd49('0x1a')]();};}function respondWithResult(_0x5c7d8c,_0x26f20){_0x26f20=_0x26f20||0xc8;return function(_0x227c38){if(_0x227c38){return _0x5c7d8c[_0xcd49('0x19')](_0x26f20)[_0xcd49('0x1b')](_0x227c38);}};}function respondWithFilteredResult(_0x1e2275,_0x328755){return function(_0x5a0c6e){if(_0x5a0c6e){var _0x4b090e=typeof _0x328755['offset']==='undefined'&&typeof _0x328755[_0xcd49('0x1c')]===_0xcd49('0x1d');var _0x43b97d=_0x5a0c6e['count'];var _0x3074a4=_0x4b090e?0x0:_0x328755[_0xcd49('0x1e')];var _0x9c7262=_0x4b090e?_0x5a0c6e['count']:_0x328755[_0xcd49('0x1e')]+_0x328755[_0xcd49('0x1c')];var _0x322add;if(_0x9c7262>=_0x43b97d){_0x9c7262=_0x43b97d;_0x322add=0xc8;}else{_0x322add=0xce;}_0x1e2275[_0xcd49('0x19')](_0x322add);return _0x1e2275[_0xcd49('0x1f')](_0xcd49('0x20'),_0x3074a4+'-'+_0x9c7262+'/'+_0x43b97d)[_0xcd49('0x1b')](_0x5a0c6e);}return null;};}function patchUpdates(_0x9475c1){return function(_0x383235){try{jsonpatch['apply'](_0x383235,_0x9475c1,!![]);}catch(_0x243f1a){return BPromise[_0xcd49('0x21')](_0x243f1a);}return _0x383235[_0xcd49('0x22')]();};}function saveUpdates(_0x5829d1,_0x4fdab7){return function(_0x5e4835){if(_0x5e4835){return _0x5e4835[_0xcd49('0x23')](_0x5829d1)[_0xcd49('0x24')](function(_0x57bc92){return _0x57bc92;});}return null;};}function removeEntity(_0x1f649c,_0x400669){return function(_0x978310){if(_0x978310){return _0x978310['destroy']()[_0xcd49('0x24')](function(){_0x1f649c[_0xcd49('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d05a,_0x22c0ed){return function(_0x58afd6){if(!_0x58afd6){_0x38d05a[_0xcd49('0x25')](0x194);}return _0x58afd6;};}function handleError(_0xc3897c,_0x77a7eb){_0x77a7eb=_0x77a7eb||0x1f4;return function(_0x42bdfd){logger[_0xcd49('0x26')](_0x42bdfd[_0xcd49('0x27')]);if(_0x42bdfd[_0xcd49('0x28')]){delete _0x42bdfd[_0xcd49('0x28')];}_0xc3897c[_0xcd49('0x19')](_0x77a7eb)[_0xcd49('0x29')](_0x42bdfd);};}exports[_0xcd49('0x2a')]=function(_0x5cb1c8,_0x3be5e6){var _0x567557={},_0x43a448={},_0x468029={'count':0x0,'rows':[]};var _0x5a43cb=_[_0xcd49('0x2b')](db[_0xcd49('0x2c')]['rawAttributes'],function(_0x339dc0){return{'name':_0x339dc0[_0xcd49('0x2d')],'type':_0x339dc0[_0xcd49('0x2e')][_0xcd49('0x2f')]};});_0x43a448[_0xcd49('0x30')]=_[_0xcd49('0x2b')](_0x5a43cb,'name');_0x43a448['query']=_[_0xcd49('0x31')](_0x5cb1c8[_0xcd49('0x32')]);_0x43a448[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x43a448[_0xcd49('0x30')],_0x43a448[_0xcd49('0x32')]);_0x567557[_0xcd49('0x35')]=_[_0xcd49('0x34')](_0x43a448[_0xcd49('0x30')],qs[_0xcd49('0x36')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x36')]));_0x567557[_0xcd49('0x35')]=_0x567557['attributes'][_0xcd49('0x37')]?_0x567557[_0xcd49('0x35')]:_0x43a448['model'];if(!_0x5cb1c8['query'][_0xcd49('0x38')](_0xcd49('0x39'))){_0x567557['limit']=qs[_0xcd49('0x1c')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x1c')]);_0x567557[_0xcd49('0x1e')]=qs[_0xcd49('0x1e')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x1e')]);}_0x567557['order']=qs[_0xcd49('0x3a')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x3a')]);_0x567557[_0xcd49('0x3b')]=qs[_0xcd49('0x33')](_[_0xcd49('0x3c')](_0x5cb1c8['query'],_0x43a448[_0xcd49('0x33')]),_0x5a43cb);if(_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x3d')]){_0x567557['where']=_[_0xcd49('0x3e')](_0x567557[_0xcd49('0x3b')],{'$or':_[_0xcd49('0x2b')](_0x5a43cb,function(_0x265fa4){if(_0x265fa4[_0xcd49('0x2e')]!==_0xcd49('0x3f')){var _0x463e2b={};_0x463e2b[_0x265fa4[_0xcd49('0x28')]]={'$like':'%'+_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x3d')]+'%'};return _0x463e2b;}})});}_0x567557=_['merge']({},_0x567557,_0x5cb1c8['options']);var _0x2e3d84={'where':_0x567557[_0xcd49('0x3b')]};return db[_0xcd49('0x2c')][_0xcd49('0x40')](_0x2e3d84)[_0xcd49('0x24')](function(_0x5124b6){_0x468029[_0xcd49('0x40')]=_0x5124b6;if(_0x5cb1c8[_0xcd49('0x32')]['includeAll']){_0x567557[_0xcd49('0x41')]=[{'all':!![]}];}return db[_0xcd49('0x2c')][_0xcd49('0x42')](_0x567557);})[_0xcd49('0x24')](function(_0x452a89){_0x468029[_0xcd49('0x43')]=_0x452a89;return _0x468029;})[_0xcd49('0x24')](respondWithFilteredResult(_0x3be5e6,_0x567557))['catch'](handleError(_0x3be5e6,null));};exports[_0xcd49('0x44')]=function(_0x4f3dd7,_0x470e4d){var _0x1a8685={'raw':![],'where':{'id':_0x4f3dd7[_0xcd49('0x45')]['id']}},_0x54631f={};_0x54631f[_0xcd49('0x30')]=_['keys'](db[_0xcd49('0x2c')]['rawAttributes']);_0x54631f[_0xcd49('0x32')]=_[_0xcd49('0x31')](_0x4f3dd7[_0xcd49('0x32')]);_0x54631f['filters']=_[_0xcd49('0x34')](_0x54631f['model'],_0x54631f['query']);_0x1a8685[_0xcd49('0x35')]=_[_0xcd49('0x34')](_0x54631f['model'],qs[_0xcd49('0x36')](_0x4f3dd7[_0xcd49('0x32')][_0xcd49('0x36')]));_0x1a8685[_0xcd49('0x35')]=_0x1a8685[_0xcd49('0x35')]['length']?_0x1a8685[_0xcd49('0x35')]:_0x54631f[_0xcd49('0x30')];if(_0x4f3dd7[_0xcd49('0x32')][_0xcd49('0x46')]){_0x1a8685['include']=[{'all':!![]}];}_0x1a8685=_[_0xcd49('0x3e')]({},_0x1a8685,_0x4f3dd7[_0xcd49('0x47')]);return db[_0xcd49('0x2c')][_0xcd49('0x48')](_0x1a8685)[_0xcd49('0x24')](handleEntityNotFound(_0x470e4d,null))[_0xcd49('0x24')](respondWithResult(_0x470e4d,null))[_0xcd49('0x49')](handleError(_0x470e4d,null));};exports[_0xcd49('0x4a')]=function(_0x38676b,_0x5b11cc){return db[_0xcd49('0x2c')]['create'](_0x38676b[_0xcd49('0x4b')],{})[_0xcd49('0x24')](respondWithResult(_0x5b11cc,0xc9))[_0xcd49('0x49')](handleError(_0x5b11cc,null));};exports[_0xcd49('0x23')]=function(_0x268cc1,_0x5cc9c5){if(_0x268cc1['body']['id']){delete _0x268cc1['body']['id'];}return db[_0xcd49('0x2c')][_0xcd49('0x48')]({'where':{'id':_0x268cc1['params']['id']}})[_0xcd49('0x24')](handleEntityNotFound(_0x5cc9c5,null))[_0xcd49('0x24')](saveUpdates(_0x268cc1[_0xcd49('0x4b')],null))['then'](respondWithResult(_0x5cc9c5,null))['catch'](handleError(_0x5cc9c5,null));};exports[_0xcd49('0x4c')]=function(_0x5b47d3,_0x440990){return db[_0xcd49('0x2c')][_0xcd49('0x48')]({'where':{'id':_0x5b47d3[_0xcd49('0x45')]['id']}})[_0xcd49('0x24')](handleEntityNotFound(_0x440990,null))['then'](removeEntity(_0x440990,null))[_0xcd49('0x49')](handleError(_0x440990,null));};exports[_0xcd49('0x4d')]=function(_0x4cbb15,_0xe4e023,_0x518428){var _0x2def45={};var _0x183f37={};var _0x5822df;var _0x1c95d1;return db[_0xcd49('0x2c')]['findOne']({'where':{'id':_0x4cbb15[_0xcd49('0x45')]['id']}})['then'](handleEntityNotFound(_0xe4e023,null))[_0xcd49('0x24')](function(_0xe6231a){if(_0xe6231a){_0x5822df=_0xe6231a;_0x183f37[_0xcd49('0x30')]=_[_0xcd49('0x31')](db['FreshdeskConfiguration']['rawAttributes']);_0x183f37[_0xcd49('0x32')]=_[_0xcd49('0x31')](_0x4cbb15[_0xcd49('0x32')]);_0x183f37[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x183f37['model'],_0x183f37[_0xcd49('0x32')]);_0x2def45['attributes']=_[_0xcd49('0x34')](_0x183f37[_0xcd49('0x30')],qs[_0xcd49('0x36')](_0x4cbb15['query'][_0xcd49('0x36')]));_0x2def45['attributes']=_0x2def45[_0xcd49('0x35')]['length']?_0x2def45['attributes']:_0x183f37[_0xcd49('0x30')];_0x2def45[_0xcd49('0x4e')]=qs[_0xcd49('0x3a')](_0x4cbb15['query'][_0xcd49('0x3a')]);_0x2def45[_0xcd49('0x3b')]=qs['filters'](_['pick'](_0x4cbb15[_0xcd49('0x32')],_0x183f37[_0xcd49('0x33')]));if(_0x4cbb15[_0xcd49('0x32')][_0xcd49('0x3d')]){_0x2def45['where']=_[_0xcd49('0x3e')](_0x2def45[_0xcd49('0x3b')],{'$or':_['map'](_0x2def45[_0xcd49('0x35')],function(_0x13d5d6){var _0x3a5ac0={};_0x3a5ac0[_0x13d5d6]={'$like':'%'+_0x4cbb15[_0xcd49('0x32')][_0xcd49('0x3d')]+'%'};return _0x3a5ac0;})});}_0x2def45=_['merge']({},_0x2def45,_0x4cbb15[_0xcd49('0x47')]);return _0x5822df[_0xcd49('0x4d')](_0x2def45);}})[_0xcd49('0x24')](function(_0x21cc84){if(_0x21cc84){_0x1c95d1=_0x21cc84[_0xcd49('0x37')];if(!_0x4cbb15[_0xcd49('0x32')]['hasOwnProperty'](_0xcd49('0x39'))){_0x2def45[_0xcd49('0x1c')]=qs['limit'](_0x4cbb15[_0xcd49('0x32')]['limit']);_0x2def45[_0xcd49('0x1e')]=qs[_0xcd49('0x1e')](_0x4cbb15[_0xcd49('0x32')]['offset']);}return _0x5822df[_0xcd49('0x4d')](_0x2def45);}})[_0xcd49('0x24')](function(_0x5002eb){if(_0x5002eb){return _0x5002eb?{'count':_0x1c95d1,'rows':_0x5002eb}:null;}})[_0xcd49('0x24')](respondWithResult(_0xe4e023,null))['catch'](handleError(_0xe4e023,null));};exports['addConfiguration']=function(_0x171e47,_0x2a22ce,_0x4f3d07){if(_0x171e47[_0xcd49('0x4b')]['id']){delete _0x171e47[_0xcd49('0x4b')]['id'];}return db[_0xcd49('0x2c')][_0xcd49('0x4f')]({'where':{'id':_0x171e47['params']['id']}})[_0xcd49('0x24')](handleEntityNotFound(_0x2a22ce,null))[_0xcd49('0x24')](function(_0x2c9584){if(_0x2c9584){_0x171e47['body'][_0xcd49('0x50')]=_0x2c9584['id'];_0x171e47['body'][_0xcd49('0x51')]=integrations['getSubjects'](_0x171e47[_0xcd49('0x4b')]['channel'],_0x171e47[_0xcd49('0x4b')][_0xcd49('0x2e')]);_0x171e47[_0xcd49('0x4b')][_0xcd49('0x52')]=integrations[_0xcd49('0x53')](_0x171e47['body']['channel'],_0x171e47[_0xcd49('0x4b')][_0xcd49('0x2e')]);return db['FreshdeskConfiguration'][_0xcd49('0x4a')](_0x171e47[_0xcd49('0x4b')],{'include':[{'model':db['FreshdeskField'],'as':_0xcd49('0x51')},{'model':db[_0xcd49('0x54')],'as':_0xcd49('0x52')}]});}return null;})['then'](respondWithResult(_0x2a22ce,null))[_0xcd49('0x49')](handleError(_0x2a22ce,null));};exports[_0xcd49('0x55')]=function(_0xad1b0e,_0x5efe18,_0x3626a4){var _0x222da2='';return db[_0xcd49('0x2c')][_0xcd49('0x4f')]({'where':{'id':_0xad1b0e[_0xcd49('0x45')]['id']},'attributes':['id',_0xcd49('0x56'),_0xcd49('0x57')]})[_0xcd49('0x24')](handleEntityNotFound(_0x5efe18,null))[_0xcd49('0x24')](function(_0x4cc4cb){if(_0x4cc4cb){_0x222da2=_0x4cc4cb[_0xcd49('0x56')];var _0x82257b=_0x222da2[_0xcd49('0x58')](-0x1);if(_0x82257b==='/'){_0x222da2=_0x222da2[_0xcd49('0x59')](0x0,_0x222da2[_0xcd49('0x5a')](_0x82257b));}return rp({'method':_0xcd49('0x5b'),'uri':util[_0xcd49('0x5c')]('%s/%s',_0x222da2,_0xcd49('0x5d')),'headers':{'Authorization':util[_0xcd49('0x5c')](_0xcd49('0x5e'),new Buffer(util['format'](_0xcd49('0x5f'),_0x4cc4cb[_0xcd49('0x57')]))[_0xcd49('0x60')]('base64'))},'json':!![]});}})[_0xcd49('0x24')](function(_0x403cab){if(_0x403cab){var _0x209e23=['requester','subject','agent','description',_0xcd49('0x19'),_0xcd49('0x61'),'group',_0xcd49('0x62'),_0xcd49('0x63'),_0xcd49('0x64'),_0xcd49('0x65')];_[_0xcd49('0x66')](_0x403cab,function(_0x3b4f32){return _0x209e23['includes'](_0x3b4f32[_0xcd49('0x28')])||!_0x3b4f32[_0xcd49('0x67')]&&_0x3b4f32[_0xcd49('0x2e')]!==_0xcd49('0x68')&&_0x3b4f32[_0xcd49('0x2e')]!==_0xcd49('0x69');});return{'count':_0x403cab[_0xcd49('0x37')],'rows':_[_0xcd49('0x2b')](_0x403cab,function(_0x3b69f7){return{'id':_0x3b69f7[_0xcd49('0x28')],'name':_0x3b69f7[_0xcd49('0x6a')],'custom':!_0x3b69f7[_0xcd49('0x67')],'options':_0x3b69f7[_0xcd49('0x6b')]?_[_0xcd49('0x2b')](_0x3b69f7[_0xcd49('0x6b')],function(_0x4f3092){return{'name':_['capitalize'](_0x4f3092),'value':_0x4f3092};}):[]};})};}})[_0xcd49('0x24')](respondWithResult(_0x5efe18,null))[_0xcd49('0x49')](function(_0x37f450){var _0x36c8a4=_0xad1b0e['query'][_0xcd49('0x6c')]?0x1f4:_0x37f450['statusCode']||0x1f4;logger[_0xcd49('0x26')](_0xcd49('0x6d'),'getFields',_0x36c8a4,JSON[_0xcd49('0x6e')](_0x37f450));delete _0x37f450['name'];if(_0x36c8a4===0x191){_0x36c8a4=0x190;}_0x5efe18[_0xcd49('0x19')](_0x36c8a4)['send'](_0xad1b0e['query'][_0xcd49('0x6c')]?{'message':_0xcd49('0x6f'),'statusCode':_0x37f450[_0xcd49('0x70')]}:_0x37f450);});}; \ No newline at end of file +var _0x135b=['rows','catch','params','length','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','remoteUri','slice','lastIndexOf','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','save','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','then','includeAll','include','findAll'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0x135b,0xaf));var _0xb135=function(_0x3bd982,_0x111b09){_0x3bd982=_0x3bd982-0x0;var _0x2f15ca=_0x135b[_0x3bd982];return _0x2f15ca;};'use strict';var emlformat=require(_0xb135('0x0'));var rimraf=require(_0xb135('0x1'));var zipdir=require(_0xb135('0x2'));var jsonpatch=require(_0xb135('0x3'));var rp=require('request-promise');var moment=require(_0xb135('0x4'));var BPromise=require(_0xb135('0x5'));var Mustache=require('mustache');var util=require(_0xb135('0x6'));var path=require(_0xb135('0x7'));var sox=require(_0xb135('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb135('0x9'));var squel=require(_0xb135('0xa'));var crypto=require(_0xb135('0xb'));var jsforce=require(_0xb135('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb135('0xd'));var querystring=require(_0xb135('0xe'));var Papa=require(_0xb135('0xf'));var Redis=require(_0xb135('0x10'));var authService=require(_0xb135('0x11'));var qs=require(_0xb135('0x12'));var as=require(_0xb135('0x13'));var hardwareService=require(_0xb135('0x14'));var logger=require(_0xb135('0x15'))(_0xb135('0x16'));var utils=require(_0xb135('0x17'));var config=require(_0xb135('0x18'));var licenseUtil=require(_0xb135('0x19'));var db=require(_0xb135('0x1a'))['db'];var integrations=require(_0xb135('0x1b'));function respondWithStatusCode(_0x11c6df,_0x13b157){_0x13b157=_0x13b157||0xcc;return function(_0x461089){if(_0x461089){return _0x11c6df[_0xb135('0x1c')](_0x13b157);}return _0x11c6df['status'](_0x13b157)[_0xb135('0x1d')]();};}function respondWithResult(_0x4de39a,_0x10770e){_0x10770e=_0x10770e||0xc8;return function(_0xd1f2f1){if(_0xd1f2f1){return _0x4de39a[_0xb135('0x1e')](_0x10770e)[_0xb135('0x1f')](_0xd1f2f1);}};}function respondWithFilteredResult(_0x37f3f2,_0x28b9d3){return function(_0x385704){if(_0x385704){var _0x35950d=typeof _0x28b9d3[_0xb135('0x20')]==='undefined'&&typeof _0x28b9d3[_0xb135('0x21')]===_0xb135('0x22');var _0x45c4ae=_0x385704['count'];var _0x5d9010=_0x35950d?0x0:_0x28b9d3[_0xb135('0x20')];var _0x47d9ef=_0x35950d?_0x385704[_0xb135('0x23')]:_0x28b9d3[_0xb135('0x20')]+_0x28b9d3[_0xb135('0x21')];var _0x33bcea;if(_0x47d9ef>=_0x45c4ae){_0x47d9ef=_0x45c4ae;_0x33bcea=0xc8;}else{_0x33bcea=0xce;}_0x37f3f2[_0xb135('0x1e')](_0x33bcea);return _0x37f3f2[_0xb135('0x24')](_0xb135('0x25'),_0x5d9010+'-'+_0x47d9ef+'/'+_0x45c4ae)[_0xb135('0x1f')](_0x385704);}return null;};}function patchUpdates(_0x24f559){return function(_0x42c960){try{jsonpatch['apply'](_0x42c960,_0x24f559,!![]);}catch(_0x180e20){return BPromise['reject'](_0x180e20);}return _0x42c960[_0xb135('0x26')]();};}function saveUpdates(_0x479372,_0x36b7a4){return function(_0x5017a1){if(_0x5017a1){return _0x5017a1['update'](_0x479372)['then'](function(_0x564583){return _0x564583;});}return null;};}function removeEntity(_0x5ba018,_0x47e22f){return function(_0x489fb9){if(_0x489fb9){return _0x489fb9[_0xb135('0x27')]()['then'](function(){_0x5ba018[_0xb135('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eea9e,_0x3dd506){return function(_0x502f84){if(!_0x502f84){_0x5eea9e['sendStatus'](0x194);}return _0x502f84;};}function handleError(_0x5c7335,_0x5cacb2){_0x5cacb2=_0x5cacb2||0x1f4;return function(_0x35cd29){logger[_0xb135('0x28')](_0x35cd29[_0xb135('0x29')]);if(_0x35cd29[_0xb135('0x2a')]){delete _0x35cd29[_0xb135('0x2a')];}_0x5c7335[_0xb135('0x1e')](_0x5cacb2)[_0xb135('0x2b')](_0x35cd29);};}exports[_0xb135('0x2c')]=function(_0x3426eb,_0x565e84){var _0x5c8de4={},_0x16f4f6={},_0x1aa887={'count':0x0,'rows':[]};var _0x380da7=_[_0xb135('0x2d')](db[_0xb135('0x2e')][_0xb135('0x2f')],function(_0x2d521c){return{'name':_0x2d521c[_0xb135('0x30')],'type':_0x2d521c['type'][_0xb135('0x31')]};});_0x16f4f6[_0xb135('0x32')]=_[_0xb135('0x2d')](_0x380da7,'name');_0x16f4f6['query']=_[_0xb135('0x33')](_0x3426eb[_0xb135('0x34')]);_0x16f4f6[_0xb135('0x35')]=_[_0xb135('0x36')](_0x16f4f6['model'],_0x16f4f6[_0xb135('0x34')]);_0x5c8de4[_0xb135('0x37')]=_[_0xb135('0x36')](_0x16f4f6[_0xb135('0x32')],qs['fields'](_0x3426eb[_0xb135('0x34')][_0xb135('0x38')]));_0x5c8de4[_0xb135('0x37')]=_0x5c8de4[_0xb135('0x37')]['length']?_0x5c8de4['attributes']:_0x16f4f6[_0xb135('0x32')];if(!_0x3426eb[_0xb135('0x34')][_0xb135('0x39')](_0xb135('0x3a'))){_0x5c8de4[_0xb135('0x21')]=qs[_0xb135('0x21')](_0x3426eb[_0xb135('0x34')][_0xb135('0x21')]);_0x5c8de4['offset']=qs['offset'](_0x3426eb[_0xb135('0x34')][_0xb135('0x20')]);}_0x5c8de4['order']=qs[_0xb135('0x3b')](_0x3426eb[_0xb135('0x34')]['sort']);_0x5c8de4[_0xb135('0x3c')]=qs[_0xb135('0x35')](_[_0xb135('0x3d')](_0x3426eb[_0xb135('0x34')],_0x16f4f6[_0xb135('0x35')]),_0x380da7);if(_0x3426eb[_0xb135('0x34')]['filter']){_0x5c8de4['where']=_[_0xb135('0x3e')](_0x5c8de4[_0xb135('0x3c')],{'$or':_[_0xb135('0x2d')](_0x380da7,function(_0x1dafe9){if(_0x1dafe9[_0xb135('0x3f')]!==_0xb135('0x40')){var _0x305f8d={};_0x305f8d[_0x1dafe9[_0xb135('0x2a')]]={'$like':'%'+_0x3426eb['query'][_0xb135('0x41')]+'%'};return _0x305f8d;}})});}_0x5c8de4=_['merge']({},_0x5c8de4,_0x3426eb[_0xb135('0x42')]);var _0x32f7d8={'where':_0x5c8de4[_0xb135('0x3c')]};return db[_0xb135('0x2e')][_0xb135('0x23')](_0x32f7d8)[_0xb135('0x43')](function(_0x5e8f02){_0x1aa887[_0xb135('0x23')]=_0x5e8f02;if(_0x3426eb[_0xb135('0x34')][_0xb135('0x44')]){_0x5c8de4[_0xb135('0x45')]=[{'all':!![]}];}return db[_0xb135('0x2e')][_0xb135('0x46')](_0x5c8de4);})[_0xb135('0x43')](function(_0x2eef22){_0x1aa887[_0xb135('0x47')]=_0x2eef22;return _0x1aa887;})['then'](respondWithFilteredResult(_0x565e84,_0x5c8de4))[_0xb135('0x48')](handleError(_0x565e84,null));};exports['show']=function(_0x1a9fa5,_0x45e711){var _0x322040={'raw':![],'where':{'id':_0x1a9fa5[_0xb135('0x49')]['id']}},_0x5cdb57={};_0x5cdb57[_0xb135('0x32')]=_['keys'](db[_0xb135('0x2e')][_0xb135('0x2f')]);_0x5cdb57[_0xb135('0x34')]=_['keys'](_0x1a9fa5['query']);_0x5cdb57['filters']=_[_0xb135('0x36')](_0x5cdb57[_0xb135('0x32')],_0x5cdb57[_0xb135('0x34')]);_0x322040[_0xb135('0x37')]=_[_0xb135('0x36')](_0x5cdb57[_0xb135('0x32')],qs[_0xb135('0x38')](_0x1a9fa5[_0xb135('0x34')]['fields']));_0x322040[_0xb135('0x37')]=_0x322040[_0xb135('0x37')][_0xb135('0x4a')]?_0x322040[_0xb135('0x37')]:_0x5cdb57['model'];if(_0x1a9fa5[_0xb135('0x34')][_0xb135('0x44')]){_0x322040['include']=[{'all':!![]}];}_0x322040=_['merge']({},_0x322040,_0x1a9fa5[_0xb135('0x42')]);return db[_0xb135('0x2e')][_0xb135('0x4b')](_0x322040)[_0xb135('0x43')](handleEntityNotFound(_0x45e711,null))[_0xb135('0x43')](respondWithResult(_0x45e711,null))[_0xb135('0x48')](handleError(_0x45e711,null));};exports[_0xb135('0x4c')]=function(_0x21839a,_0x42d07b){return db[_0xb135('0x2e')][_0xb135('0x4c')](_0x21839a[_0xb135('0x4d')],{})[_0xb135('0x43')](respondWithResult(_0x42d07b,0xc9))[_0xb135('0x48')](handleError(_0x42d07b,null));};exports[_0xb135('0x4e')]=function(_0x400088,_0x3f85f2){if(_0x400088[_0xb135('0x4d')]['id']){delete _0x400088[_0xb135('0x4d')]['id'];}return db[_0xb135('0x2e')][_0xb135('0x4b')]({'where':{'id':_0x400088[_0xb135('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f85f2,null))[_0xb135('0x43')](saveUpdates(_0x400088[_0xb135('0x4d')],null))[_0xb135('0x43')](respondWithResult(_0x3f85f2,null))['catch'](handleError(_0x3f85f2,null));};exports['destroy']=function(_0xc10bef,_0x3d422e){return db['FreshdeskAccount'][_0xb135('0x4b')]({'where':{'id':_0xc10bef[_0xb135('0x49')]['id']}})[_0xb135('0x43')](handleEntityNotFound(_0x3d422e,null))[_0xb135('0x43')](removeEntity(_0x3d422e,null))[_0xb135('0x48')](handleError(_0x3d422e,null));};exports[_0xb135('0x4f')]=function(_0x273f91,_0x4bf23e,_0x2088f1){var _0x130db4={};var _0x2aa05d={};var _0xf54761;var _0x58bd1c;return db[_0xb135('0x2e')][_0xb135('0x50')]({'where':{'id':_0x273f91[_0xb135('0x49')]['id']}})[_0xb135('0x43')](handleEntityNotFound(_0x4bf23e,null))[_0xb135('0x43')](function(_0x2a3604){if(_0x2a3604){_0xf54761=_0x2a3604;_0x2aa05d[_0xb135('0x32')]=_['keys'](db[_0xb135('0x51')][_0xb135('0x2f')]);_0x2aa05d[_0xb135('0x34')]=_[_0xb135('0x33')](_0x273f91[_0xb135('0x34')]);_0x2aa05d[_0xb135('0x35')]=_[_0xb135('0x36')](_0x2aa05d[_0xb135('0x32')],_0x2aa05d[_0xb135('0x34')]);_0x130db4[_0xb135('0x37')]=_[_0xb135('0x36')](_0x2aa05d[_0xb135('0x32')],qs[_0xb135('0x38')](_0x273f91[_0xb135('0x34')][_0xb135('0x38')]));_0x130db4[_0xb135('0x37')]=_0x130db4[_0xb135('0x37')]['length']?_0x130db4['attributes']:_0x2aa05d[_0xb135('0x32')];_0x130db4[_0xb135('0x52')]=qs[_0xb135('0x3b')](_0x273f91[_0xb135('0x34')]['sort']);_0x130db4[_0xb135('0x3c')]=qs[_0xb135('0x35')](_[_0xb135('0x3d')](_0x273f91[_0xb135('0x34')],_0x2aa05d[_0xb135('0x35')]));if(_0x273f91['query'][_0xb135('0x41')]){_0x130db4[_0xb135('0x3c')]=_[_0xb135('0x3e')](_0x130db4[_0xb135('0x3c')],{'$or':_[_0xb135('0x2d')](_0x130db4['attributes'],function(_0x31f78b){var _0x468058={};_0x468058[_0x31f78b]={'$like':'%'+_0x273f91[_0xb135('0x34')][_0xb135('0x41')]+'%'};return _0x468058;})});}_0x130db4=_[_0xb135('0x3e')]({},_0x130db4,_0x273f91[_0xb135('0x42')]);return _0xf54761[_0xb135('0x4f')](_0x130db4);}})[_0xb135('0x43')](function(_0x48ab61){if(_0x48ab61){_0x58bd1c=_0x48ab61[_0xb135('0x4a')];if(!_0x273f91[_0xb135('0x34')][_0xb135('0x39')](_0xb135('0x3a'))){_0x130db4[_0xb135('0x21')]=qs['limit'](_0x273f91[_0xb135('0x34')][_0xb135('0x21')]);_0x130db4[_0xb135('0x20')]=qs[_0xb135('0x20')](_0x273f91[_0xb135('0x34')]['offset']);}return _0xf54761[_0xb135('0x4f')](_0x130db4);}})['then'](function(_0x459c18){if(_0x459c18){return _0x459c18?{'count':_0x58bd1c,'rows':_0x459c18}:null;}})[_0xb135('0x43')](respondWithResult(_0x4bf23e,null))[_0xb135('0x48')](handleError(_0x4bf23e,null));};exports[_0xb135('0x53')]=function(_0xc11a5c,_0x55b5e4,_0x8aa744){if(_0xc11a5c[_0xb135('0x4d')]['id']){delete _0xc11a5c[_0xb135('0x4d')]['id'];}return db[_0xb135('0x2e')][_0xb135('0x50')]({'where':{'id':_0xc11a5c['params']['id']}})[_0xb135('0x43')](handleEntityNotFound(_0x55b5e4,null))[_0xb135('0x43')](function(_0x51d00b){if(_0x51d00b){_0xc11a5c[_0xb135('0x4d')][_0xb135('0x54')]=_0x51d00b['id'];_0xc11a5c[_0xb135('0x4d')][_0xb135('0x55')]=integrations[_0xb135('0x56')](_0xc11a5c[_0xb135('0x4d')][_0xb135('0x57')],_0xc11a5c[_0xb135('0x4d')]['type']);_0xc11a5c[_0xb135('0x4d')][_0xb135('0x58')]=integrations[_0xb135('0x59')](_0xc11a5c['body'][_0xb135('0x57')],_0xc11a5c[_0xb135('0x4d')][_0xb135('0x3f')]);return db[_0xb135('0x51')][_0xb135('0x4c')](_0xc11a5c[_0xb135('0x4d')],{'include':[{'model':db[_0xb135('0x5a')],'as':_0xb135('0x55')},{'model':db[_0xb135('0x5a')],'as':_0xb135('0x58')}]});}return null;})[_0xb135('0x43')](respondWithResult(_0x55b5e4,null))[_0xb135('0x48')](handleError(_0x55b5e4,null));};exports[_0xb135('0x5b')]=function(_0x35ef7b,_0x649abf,_0x286124){var _0x5e0885='';return db[_0xb135('0x2e')][_0xb135('0x50')]({'where':{'id':_0x35ef7b[_0xb135('0x49')]['id']},'attributes':['id','remoteUri',_0xb135('0x5c')]})[_0xb135('0x43')](handleEntityNotFound(_0x649abf,null))[_0xb135('0x43')](function(_0x482f69){if(_0x482f69){_0x5e0885=_0x482f69[_0xb135('0x5d')];var _0x1f78ab=_0x5e0885[_0xb135('0x5e')](-0x1);if(_0x1f78ab==='/'){_0x5e0885=_0x5e0885['substring'](0x0,_0x5e0885[_0xb135('0x5f')](_0x1f78ab));}return rp({'method':'GET','uri':util[_0xb135('0x60')](_0xb135('0x61'),_0x5e0885,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xb135('0x60')](_0xb135('0x62'),new Buffer(util[_0xb135('0x60')](_0xb135('0x63'),_0x482f69['apiKey']))[_0xb135('0x64')](_0xb135('0x65')))},'json':!![]});}})[_0xb135('0x43')](function(_0x583b53){if(_0x583b53){var _0x5a495d=[_0xb135('0x66'),_0xb135('0x67'),_0xb135('0x68'),_0xb135('0x69'),_0xb135('0x1e'),_0xb135('0x6a'),_0xb135('0x6b'),_0xb135('0x6c'),_0xb135('0x6d'),_0xb135('0x6b'),_0xb135('0x6e')];_[_0xb135('0x6f')](_0x583b53,function(_0x1bc1f3){return _0x5a495d[_0xb135('0x70')](_0x1bc1f3[_0xb135('0x2a')])||!_0x1bc1f3[_0xb135('0x71')]&&_0x1bc1f3['type']!==_0xb135('0x72')&&_0x1bc1f3[_0xb135('0x3f')]!==_0xb135('0x73');});return{'count':_0x583b53[_0xb135('0x4a')],'rows':_[_0xb135('0x2d')](_0x583b53,function(_0xcd701d){return{'id':_0xcd701d[_0xb135('0x2a')],'name':_0xcd701d[_0xb135('0x74')],'custom':!_0xcd701d['default'],'options':_0xcd701d[_0xb135('0x75')]?_[_0xb135('0x2d')](_0xcd701d[_0xb135('0x75')],function(_0x5e9e12){return{'name':_[_0xb135('0x76')](_0x5e9e12),'value':_0x5e9e12};}):[]};})};}})[_0xb135('0x43')](respondWithResult(_0x649abf,null))['catch'](function(_0x10c07b){var _0x5d4228=_0x35ef7b[_0xb135('0x34')][_0xb135('0x77')]?0x1f4:_0x10c07b['statusCode']||0x1f4;logger[_0xb135('0x28')](_0xb135('0x78'),_0xb135('0x5b'),_0x5d4228,JSON['stringify'](_0x10c07b));delete _0x10c07b['name'];if(_0x5d4228===0x191){_0x5d4228=0x190;}_0x649abf[_0xb135('0x1e')](_0x5d4228)[_0xb135('0x2b')](_0x35ef7b[_0xb135('0x34')][_0xb135('0x77')]?{'message':_0xb135('0x79'),'statusCode':_0x10c07b[_0xb135('0x7a')]}:_0x10c07b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2286d0e..c10a3f7 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 _0x7034=['../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x7034,0xc2));var _0x4703=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x7034[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x4703('0x0'));var util=require(_0x4703('0x1'));var logger=require(_0x4703('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4703('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4703('0x4'));var rimraf=require('rimraf');var config=require(_0x4703('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x4703('0x6'));module[_0x4703('0x7')]=function(_0x43de24,_0x360f1b){return _0x43de24['define'](_0x4703('0x8'),attributes,{'tableName':_0x4703('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9150=['request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2c396c,_0x4db177){var _0x26219b=function(_0x1a4a6e){while(--_0x1a4a6e){_0x2c396c['push'](_0x2c396c['shift']());}};_0x26219b(++_0x4db177);}(_0x9150,0x136));var _0x0915=function(_0x163fb2,_0x10d039){_0x163fb2=_0x163fb2-0x0;var _0x13e4b3=_0x9150[_0x163fb2];return _0x13e4b3;};'use strict';var _=require(_0x0915('0x0'));var util=require('util');var logger=require(_0x0915('0x1'))(_0x0915('0x2'));var moment=require(_0x0915('0x3'));var BPromise=require(_0x0915('0x4'));var rp=require(_0x0915('0x5'));var fs=require('fs');var path=require(_0x0915('0x6'));var rimraf=require(_0x0915('0x7'));var config=require(_0x0915('0x8'));var attributes=require(_0x0915('0x9'));var integrations=require(_0x0915('0xa'));module[_0x0915('0xb')]=function(_0x3eb527,_0x37865f){return _0x3eb527[_0x0915('0xc')](_0x0915('0xd'),attributes,{'tableName':_0x0915('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 9025d3c..8d68aa8 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 _0x19da=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','map','include','model','ShowFreshdeskAccount','raw','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x302ebe,_0x4f4943){var _0x3c7926=function(_0x462042){while(--_0x462042){_0x302ebe['push'](_0x302ebe['shift']());}};_0x3c7926(++_0x4f4943);}(_0x19da,0x9f));var _0xa19d=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x19da[_0x340380];return _0x49ce1c;};'use strict';var _=require('lodash');var util=require(_0xa19d('0x0'));var moment=require('moment');var BPromise=require(_0xa19d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19d('0x2'));var db=require(_0xa19d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa19d('0x4'))(_0xa19d('0x5'));var config=require('../../config/environment');var jayson=require(_0xa19d('0x6'));var client=jayson[_0xa19d('0x7')][_0xa19d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14dc68,_0x32da37,_0x4b4627){return new BPromise(function(_0x197c4e,_0x4e6638){return client[_0xa19d('0x9')](_0x14dc68,_0x4b4627)[_0xa19d('0xa')](function(_0x538dea){logger['info'](_0xa19d('0xb'),_0x32da37,_0xa19d('0xc'));logger[_0xa19d('0xd')](_0xa19d('0xe'),_0x32da37,_0xa19d('0xc'),JSON[_0xa19d('0xf')](_0x538dea));if(_0x538dea['error']){if(_0x538dea['error'][_0xa19d('0x10')]===0x1f4){logger[_0xa19d('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x32da37,_0x538dea['error'][_0xa19d('0x12')]);return _0x4e6638(_0x538dea[_0xa19d('0x11')]['message']);}logger[_0xa19d('0x11')](_0xa19d('0xb'),_0x32da37,_0x538dea[_0xa19d('0x11')]['message']);return _0x197c4e(_0x538dea[_0xa19d('0x11')]['message']);}else{logger[_0xa19d('0x13')](_0xa19d('0xb'),_0x32da37,_0xa19d('0xc'));_0x197c4e(_0x538dea[_0xa19d('0x14')][_0xa19d('0x12')]);}})[_0xa19d('0x15')](function(_0x2f2774){logger[_0xa19d('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x32da37,_0x2f2774);_0x4e6638(_0x2f2774);});});}exports[_0xa19d('0x16')]=function(_0x57c6e9){var _0x3d25b4=this;return new Promise(function(_0xe493f1,_0x29941f){return db[_0xa19d('0x17')][_0xa19d('0x18')]({'raw':_0x57c6e9[_0xa19d('0x19')]?_0x57c6e9[_0xa19d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x57c6e9[_0xa19d('0x19')]?_0x57c6e9[_0xa19d('0x19')][_0xa19d('0x1a')]||null:null,'attributes':_0x57c6e9[_0xa19d('0x19')]?_0x57c6e9[_0xa19d('0x19')][_0xa19d('0x1b')]||null:null,'limit':_0x57c6e9[_0xa19d('0x19')]?_0x57c6e9[_0xa19d('0x19')][_0xa19d('0x1c')]||null:null,'include':_0x57c6e9['options']?_0x57c6e9[_0xa19d('0x19')]['include']?_[_0xa19d('0x1d')](_0x57c6e9[_0xa19d('0x19')][_0xa19d('0x1e')],function(_0x206e88){return{'model':db[_0x206e88[_0xa19d('0x1f')]],'as':_0x206e88['as'],'attributes':_0x206e88[_0xa19d('0x1b')],'include':_0x206e88[_0xa19d('0x1e')]?_[_0xa19d('0x1d')](_0x206e88[_0xa19d('0x1e')],function(_0x43afdc){return{'model':db[_0x43afdc[_0xa19d('0x1f')]],'as':_0x43afdc['as'],'attributes':_0x43afdc[_0xa19d('0x1b')],'include':_0x43afdc[_0xa19d('0x1e')]?_[_0xa19d('0x1d')](_0x43afdc[_0xa19d('0x1e')],function(_0x2f4df8){return{'model':db[_0x2f4df8[_0xa19d('0x1f')]],'as':_0x2f4df8['as'],'attributes':_0x2f4df8[_0xa19d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa19d('0xa')](function(_0x45eeeb){logger[_0xa19d('0x13')]('GetFreshdeskAccount',_0x57c6e9);logger['debug']('GetFreshdeskAccount',_0x57c6e9,JSON[_0xa19d('0xf')](_0x45eeeb));_0xe493f1(_0x45eeeb);})[_0xa19d('0x15')](function(_0x387bfa){logger[_0xa19d('0x11')](_0xa19d('0x16'),_0x387bfa['message'],_0x57c6e9);_0x29941f(_0x3d25b4[_0xa19d('0x11')](0x1f4,_0x387bfa[_0xa19d('0x12')]));});});};exports[_0xa19d('0x20')]=function(_0x2cb94a){var _0x57f03e=this;return new Promise(function(_0x340ca4,_0x31c621){return db[_0xa19d('0x17')]['find']({'raw':_0x2cb94a['options']?_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x21')]===undefined?!![]:![]:!![],'where':_0x2cb94a['options']?_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x1a')]||null:null,'attributes':_0x2cb94a['options']?_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x1b')]||null:null,'include':_0x2cb94a[_0xa19d('0x19')]?_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x1e')]?_['map'](_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x1e')],function(_0x132ec2){return{'model':db[_0x132ec2[_0xa19d('0x1f')]],'as':_0x132ec2['as'],'attributes':_0x132ec2[_0xa19d('0x1b')],'include':_0x132ec2['include']?_[_0xa19d('0x1d')](_0x132ec2[_0xa19d('0x1e')],function(_0x8ece04){return{'model':db[_0x8ece04[_0xa19d('0x1f')]],'as':_0x8ece04['as'],'attributes':_0x8ece04[_0xa19d('0x1b')],'include':_0x8ece04[_0xa19d('0x1e')]?_[_0xa19d('0x1d')](_0x8ece04[_0xa19d('0x1e')],function(_0x520894){return{'model':db[_0x520894['model']],'as':_0x520894['as'],'attributes':_0x520894[_0xa19d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x392a1a){logger[_0xa19d('0x13')]('ShowFreshdeskAccount',_0x2cb94a);logger[_0xa19d('0xd')](_0xa19d('0x20'),_0x2cb94a,JSON[_0xa19d('0xf')](_0x392a1a));_0x340ca4(_0x392a1a);})['catch'](function(_0x20c3b8){logger[_0xa19d('0x11')](_0xa19d('0x20'),_0x20c3b8['message'],_0x2cb94a);_0x31c621(_0x57f03e[_0xa19d('0x11')](0x1f4,_0x20c3b8[_0xa19d('0x12')]));});});}; \ No newline at end of file +var _0x94d9=['error','code','message','catch','findAll','options','raw','where','attributes','limit','map','include','model','GetFreshdeskAccount','FreshdeskAccount','find','ShowFreshdeskAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x5d252d,_0x5c01d4){var _0x264a03=function(_0x30549c){while(--_0x30549c){_0x5d252d['push'](_0x5d252d['shift']());}};_0x264a03(++_0x5c01d4);}(_0x94d9,0x1cd));var _0x994d=function(_0x1e2dec,_0x3b2607){_0x1e2dec=_0x1e2dec-0x0;var _0x45eca5=_0x94d9[_0x1e2dec];return _0x45eca5;};'use strict';var _=require('lodash');var util=require(_0x994d('0x0'));var moment=require(_0x994d('0x1'));var BPromise=require(_0x994d('0x2'));var rs=require(_0x994d('0x3'));var fs=require('fs');var Redis=require(_0x994d('0x4'));var db=require(_0x994d('0x5'))['db'];var utils=require(_0x994d('0x6'));var logger=require(_0x994d('0x7'))(_0x994d('0x8'));var config=require(_0x994d('0x9'));var jayson=require(_0x994d('0xa'));var client=jayson[_0x994d('0xb')][_0x994d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x118304,_0x2a56ca,_0x255b4e){return new BPromise(function(_0xc6153,_0x3da425){return client[_0x994d('0xd')](_0x118304,_0x255b4e)[_0x994d('0xe')](function(_0x4ef7c3){logger[_0x994d('0xf')](_0x994d('0x10'),_0x2a56ca,'request\x20sent');logger[_0x994d('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2a56ca,_0x994d('0x12'),JSON[_0x994d('0x13')](_0x4ef7c3));if(_0x4ef7c3[_0x994d('0x14')]){if(_0x4ef7c3[_0x994d('0x14')][_0x994d('0x15')]===0x1f4){logger[_0x994d('0x14')](_0x994d('0x10'),_0x2a56ca,_0x4ef7c3['error'][_0x994d('0x16')]);return _0x3da425(_0x4ef7c3[_0x994d('0x14')]['message']);}logger[_0x994d('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x2a56ca,_0x4ef7c3['error'][_0x994d('0x16')]);return _0xc6153(_0x4ef7c3[_0x994d('0x14')][_0x994d('0x16')]);}else{logger[_0x994d('0xf')](_0x994d('0x10'),_0x2a56ca,_0x994d('0x12'));_0xc6153(_0x4ef7c3['result'][_0x994d('0x16')]);}})[_0x994d('0x17')](function(_0x8279e9){logger[_0x994d('0x14')](_0x994d('0x10'),_0x2a56ca,_0x8279e9);_0x3da425(_0x8279e9);});});}exports['GetFreshdeskAccount']=function(_0x5f0d47){var _0x45ffca=this;return new Promise(function(_0x1ab670,_0x27e10a){return db['FreshdeskAccount'][_0x994d('0x18')]({'raw':_0x5f0d47[_0x994d('0x19')]?_0x5f0d47[_0x994d('0x19')][_0x994d('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f0d47[_0x994d('0x19')]?_0x5f0d47[_0x994d('0x19')][_0x994d('0x1b')]||null:null,'attributes':_0x5f0d47['options']?_0x5f0d47[_0x994d('0x19')][_0x994d('0x1c')]||null:null,'limit':_0x5f0d47[_0x994d('0x19')]?_0x5f0d47[_0x994d('0x19')][_0x994d('0x1d')]||null:null,'include':_0x5f0d47[_0x994d('0x19')]?_0x5f0d47[_0x994d('0x19')]['include']?_[_0x994d('0x1e')](_0x5f0d47[_0x994d('0x19')][_0x994d('0x1f')],function(_0xbc18b5){return{'model':db[_0xbc18b5[_0x994d('0x20')]],'as':_0xbc18b5['as'],'attributes':_0xbc18b5['attributes'],'include':_0xbc18b5['include']?_[_0x994d('0x1e')](_0xbc18b5[_0x994d('0x1f')],function(_0x5c0269){return{'model':db[_0x5c0269[_0x994d('0x20')]],'as':_0x5c0269['as'],'attributes':_0x5c0269[_0x994d('0x1c')],'include':_0x5c0269[_0x994d('0x1f')]?_[_0x994d('0x1e')](_0x5c0269['include'],function(_0x268b4a){return{'model':db[_0x268b4a[_0x994d('0x20')]],'as':_0x268b4a['as'],'attributes':_0x268b4a['attributes']};}):[]};}):[]};}):[]:[]})[_0x994d('0xe')](function(_0x47a0fa){logger[_0x994d('0xf')]('GetFreshdeskAccount',_0x5f0d47);logger[_0x994d('0x11')](_0x994d('0x21'),_0x5f0d47,JSON[_0x994d('0x13')](_0x47a0fa));_0x1ab670(_0x47a0fa);})['catch'](function(_0x40e372){logger[_0x994d('0x14')](_0x994d('0x21'),_0x40e372[_0x994d('0x16')],_0x5f0d47);_0x27e10a(_0x45ffca['error'](0x1f4,_0x40e372['message']));});});};exports['ShowFreshdeskAccount']=function(_0x5f0b55){var _0x4563b6=this;return new Promise(function(_0x30321c,_0x407fb2){return db[_0x994d('0x22')][_0x994d('0x23')]({'raw':_0x5f0b55[_0x994d('0x19')]?_0x5f0b55[_0x994d('0x19')][_0x994d('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f0b55[_0x994d('0x19')]?_0x5f0b55[_0x994d('0x19')]['where']||null:null,'attributes':_0x5f0b55['options']?_0x5f0b55['options'][_0x994d('0x1c')]||null:null,'include':_0x5f0b55[_0x994d('0x19')]?_0x5f0b55[_0x994d('0x19')]['include']?_[_0x994d('0x1e')](_0x5f0b55[_0x994d('0x19')][_0x994d('0x1f')],function(_0x15c78e){return{'model':db[_0x15c78e[_0x994d('0x20')]],'as':_0x15c78e['as'],'attributes':_0x15c78e['attributes'],'include':_0x15c78e[_0x994d('0x1f')]?_[_0x994d('0x1e')](_0x15c78e['include'],function(_0x2ef156){return{'model':db[_0x2ef156['model']],'as':_0x2ef156['as'],'attributes':_0x2ef156[_0x994d('0x1c')],'include':_0x2ef156[_0x994d('0x1f')]?_[_0x994d('0x1e')](_0x2ef156[_0x994d('0x1f')],function(_0x3e15c9){return{'model':db[_0x3e15c9[_0x994d('0x20')]],'as':_0x3e15c9['as'],'attributes':_0x3e15c9[_0x994d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x994d('0xe')](function(_0x560ce6){logger[_0x994d('0xf')](_0x994d('0x24'),_0x5f0b55);logger[_0x994d('0x11')]('ShowFreshdeskAccount',_0x5f0b55,JSON['stringify'](_0x560ce6));_0x30321c(_0x560ce6);})[_0x994d('0x17')](function(_0x48d7ed){logger['error'](_0x994d('0x24'),_0x48d7ed[_0x994d('0x16')],_0x5f0b55);_0x407fb2(_0x4563b6['error'](0x1f4,_0x48d7ed['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7409cc3..2bec1a5 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 _0xace8=['getSubjects','/:id/descriptions','getDescriptions','getTags','create','post','/:id/tags','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id/fields','isAuthenticated','getFields','/:id/subjects'];(function(_0x9ea933,_0x565d76){var _0x4fdcd0=function(_0x1b1b59){while(--_0x1b1b59){_0x9ea933['push'](_0x9ea933['shift']());}};_0x4fdcd0(++_0x565d76);}(_0xace8,0x95));var _0x8ace=function(_0x4bfb87,_0x2ed356){_0x4bfb87=_0x4bfb87-0x0;var _0x2b4e25=_0xace8[_0x4bfb87];return _0x2b4e25;};'use strict';var multer=require(_0x8ace('0x0'));var util=require(_0x8ace('0x1'));var path=require(_0x8ace('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ace('0x3'));var router=express[_0x8ace('0x4')]();var fs_extra=require(_0x8ace('0x5'));var auth=require(_0x8ace('0x6'));var interaction=require(_0x8ace('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x8ace('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8ace('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8ace('0x9'),auth[_0x8ace('0xa')](),controller[_0x8ace('0xb')]);router['get'](_0x8ace('0xc'),auth[_0x8ace('0xa')](),controller[_0x8ace('0xd')]);router[_0x8ace('0x8')](_0x8ace('0xe'),auth[_0x8ace('0xa')](),controller[_0x8ace('0xf')]);router[_0x8ace('0x8')]('/:id/tags',auth[_0x8ace('0xa')](),controller[_0x8ace('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8ace('0x11')]);router[_0x8ace('0x12')](_0x8ace('0x13'),auth[_0x8ace('0xa')](),controller[_0x8ace('0x14')]);router[_0x8ace('0x15')](_0x8ace('0x16'),auth[_0x8ace('0xa')](),controller[_0x8ace('0x17')]);router[_0x8ace('0x18')](_0x8ace('0x16'),auth[_0x8ace('0xa')](),controller[_0x8ace('0x19')]);module[_0x8ace('0x1a')]=router; \ No newline at end of file +var _0xc72e=['getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x15bf4e,_0x5a510d){var _0x4e3565=function(_0x38a082){while(--_0x38a082){_0x15bf4e['push'](_0x15bf4e['shift']());}};_0x4e3565(++_0x5a510d);}(_0xc72e,0x14f));var _0xec72=function(_0x3daac,_0x3b5fb5){_0x3daac=_0x3daac-0x0;var _0x4877d1=_0xc72e[_0x3daac];return _0x4877d1;};'use strict';var multer=require(_0xec72('0x0'));var util=require(_0xec72('0x1'));var path=require('path');var timeout=require(_0xec72('0x2'));var express=require('express');var router=express[_0xec72('0x3')]();var fs_extra=require(_0xec72('0x4'));var auth=require(_0xec72('0x5'));var interaction=require(_0xec72('0x6'));var config=require(_0xec72('0x7'));var controller=require(_0xec72('0x8'));router[_0xec72('0x9')]('/',auth[_0xec72('0xa')](),controller['index']);router[_0xec72('0x9')](_0xec72('0xb'),auth[_0xec72('0xa')](),controller[_0xec72('0xc')]);router[_0xec72('0x9')](_0xec72('0xd'),auth[_0xec72('0xa')](),controller[_0xec72('0xe')]);router['get'](_0xec72('0xf'),auth['isAuthenticated'](),controller[_0xec72('0x10')]);router['get'](_0xec72('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xec72('0x9')](_0xec72('0x12'),auth[_0xec72('0xa')](),controller[_0xec72('0x13')]);router[_0xec72('0x14')]('/',auth[_0xec72('0xa')](),controller[_0xec72('0x15')]);router[_0xec72('0x14')]('/:id/tags',auth[_0xec72('0xa')](),controller[_0xec72('0x16')]);router[_0xec72('0x17')](_0xec72('0xb'),auth['isAuthenticated'](),controller[_0xec72('0x18')]);router['delete'](_0xec72('0xb'),auth[_0xec72('0xa')](),controller[_0xec72('0x19')]);module[_0xec72('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 8897592..a5298b5 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 _0x8a8b=['STRING','sequelize'];(function(_0x5e1c27,_0x260e92){var _0x18886d=function(_0x45a499){while(--_0x45a499){_0x5e1c27['push'](_0x5e1c27['shift']());}};_0x18886d(++_0x260e92);}(_0x8a8b,0xa5));var _0xb8a8=function(_0x3bec09,_0x50d686){_0x3bec09=_0x3bec09-0x0;var _0x4f30de=_0x8a8b[_0x3bec09];return _0x4f30de;};'use strict';var Sequelize=require(_0xb8a8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb8a8('0x1')]}}; \ No newline at end of file +var _0xde3c=['STRING','exports'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xde3c,0x1c3));var _0xcde3=function(_0x5e5e5a,_0x12db5f){_0x5e5e5a=_0x5e5e5a-0x0;var _0x2f63ca=_0xde3c[_0x5e5e5a];return _0x2f63ca;};'use strict';var Sequelize=require('sequelize');module[_0xcde3('0x0')]={'name':{'type':Sequelize[_0xcde3('0x1')]},'description':{'type':Sequelize[_0xcde3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index dc3cca2..8db2b6a 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 _0x00ee=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','catch','show','params','keys','create','body','find','findOne','FreshdeskField','sort','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','undefined','offset','count','limit','Content-Range','reject','save','update','then','destroy','end','error','stack'];(function(_0xe89cf8,_0x24a844){var _0x1d3a49=function(_0x5171cc){while(--_0x5171cc){_0xe89cf8['push'](_0xe89cf8['shift']());}};_0x1d3a49(++_0x24a844);}(_0x00ee,0x170));var _0xe00e=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x00ee[_0x4394b6];return _0x360244;};'use strict';var emlformat=require(_0xe00e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe00e('0x1'));var rp=require('request-promise');var moment=require(_0xe00e('0x2'));var BPromise=require(_0xe00e('0x3'));var Mustache=require(_0xe00e('0x4'));var util=require('util');var path=require(_0xe00e('0x5'));var sox=require(_0xe00e('0x6'));var csv=require(_0xe00e('0x7'));var ejs=require(_0xe00e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe00e('0x9'));var squel=require(_0xe00e('0xa'));var crypto=require(_0xe00e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe00e('0xc'));var toCsv=require(_0xe00e('0x7'));var querystring=require('querystring');var Papa=require(_0xe00e('0xd'));var Redis=require(_0xe00e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe00e('0xf'));var as=require(_0xe00e('0x10'));var hardwareService=require(_0xe00e('0x11'));var logger=require(_0xe00e('0x12'))('api');var utils=require(_0xe00e('0x13'));var config=require(_0xe00e('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c182,_0x144739){_0x144739=_0x144739||0xcc;return function(_0x5e66b0){if(_0x5e66b0){return _0x45c182[_0xe00e('0x15')](_0x144739);}return _0x45c182[_0xe00e('0x16')](_0x144739)['end']();};}function respondWithResult(_0x5a35e6,_0x20eba5){_0x20eba5=_0x20eba5||0xc8;return function(_0x41e27c){if(_0x41e27c){return _0x5a35e6['status'](_0x20eba5)[_0xe00e('0x17')](_0x41e27c);}};}function respondWithFilteredResult(_0x2e033d,_0x28116b){return function(_0xbe773b){if(_0xbe773b){var _0x1efc8a=typeof _0x28116b['offset']===_0xe00e('0x18')&&typeof _0x28116b['limit']===_0xe00e('0x18');var _0x42b579=_0xbe773b['count'];var _0x2714cd=_0x1efc8a?0x0:_0x28116b[_0xe00e('0x19')];var _0x7b1d96=_0x1efc8a?_0xbe773b[_0xe00e('0x1a')]:_0x28116b['offset']+_0x28116b[_0xe00e('0x1b')];var _0x414a05;if(_0x7b1d96>=_0x42b579){_0x7b1d96=_0x42b579;_0x414a05=0xc8;}else{_0x414a05=0xce;}_0x2e033d[_0xe00e('0x16')](_0x414a05);return _0x2e033d['set'](_0xe00e('0x1c'),_0x2714cd+'-'+_0x7b1d96+'/'+_0x42b579)[_0xe00e('0x17')](_0xbe773b);}return null;};}function patchUpdates(_0x10a19a){return function(_0x5ca19f){try{jsonpatch['apply'](_0x5ca19f,_0x10a19a,!![]);}catch(_0x4903bb){return BPromise[_0xe00e('0x1d')](_0x4903bb);}return _0x5ca19f[_0xe00e('0x1e')]();};}function saveUpdates(_0x2f9e06,_0x45ae78){return function(_0x4bc2f5){if(_0x4bc2f5){return _0x4bc2f5[_0xe00e('0x1f')](_0x2f9e06)[_0xe00e('0x20')](function(_0x4fa196){return _0x4fa196;});}return null;};}function removeEntity(_0x45482d,_0x43c051){return function(_0x8ac687){if(_0x8ac687){return _0x8ac687[_0xe00e('0x21')]()[_0xe00e('0x20')](function(){_0x45482d[_0xe00e('0x16')](0xcc)[_0xe00e('0x22')]();});}};}function handleEntityNotFound(_0x44e403,_0x3eb6fd){return function(_0x1266fa){if(!_0x1266fa){_0x44e403[_0xe00e('0x15')](0x194);}return _0x1266fa;};}function handleError(_0x281388,_0x2864a4){_0x2864a4=_0x2864a4||0x1f4;return function(_0x1816b1){logger[_0xe00e('0x23')](_0x1816b1[_0xe00e('0x24')]);if(_0x1816b1[_0xe00e('0x25')]){delete _0x1816b1[_0xe00e('0x25')];}_0x281388[_0xe00e('0x16')](_0x2864a4)[_0xe00e('0x26')](_0x1816b1);};}exports['index']=function(_0x3fd8bd,_0x444d00){var _0x285631={},_0x573732={},_0x4af56d={'count':0x0,'rows':[]};var _0x30395d=_[_0xe00e('0x27')](db['FreshdeskConfiguration'][_0xe00e('0x28')],function(_0x17c97b){return{'name':_0x17c97b[_0xe00e('0x29')],'type':_0x17c97b[_0xe00e('0x2a')][_0xe00e('0x2b')]};});_0x573732[_0xe00e('0x2c')]=_[_0xe00e('0x27')](_0x30395d,'name');_0x573732[_0xe00e('0x2d')]=_['keys'](_0x3fd8bd[_0xe00e('0x2d')]);_0x573732[_0xe00e('0x2e')]=_[_0xe00e('0x2f')](_0x573732[_0xe00e('0x2c')],_0x573732[_0xe00e('0x2d')]);_0x285631[_0xe00e('0x30')]=_[_0xe00e('0x2f')](_0x573732[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x3fd8bd[_0xe00e('0x2d')][_0xe00e('0x31')]));_0x285631['attributes']=_0x285631[_0xe00e('0x30')][_0xe00e('0x32')]?_0x285631[_0xe00e('0x30')]:_0x573732['model'];if(!_0x3fd8bd['query'][_0xe00e('0x33')](_0xe00e('0x34'))){_0x285631[_0xe00e('0x1b')]=qs[_0xe00e('0x1b')](_0x3fd8bd[_0xe00e('0x2d')][_0xe00e('0x1b')]);_0x285631['offset']=qs[_0xe00e('0x19')](_0x3fd8bd[_0xe00e('0x2d')][_0xe00e('0x19')]);}_0x285631[_0xe00e('0x35')]=qs['sort'](_0x3fd8bd['query']['sort']);_0x285631[_0xe00e('0x36')]=qs[_0xe00e('0x2e')](_[_0xe00e('0x37')](_0x3fd8bd['query'],_0x573732['filters']),_0x30395d);if(_0x3fd8bd['query'][_0xe00e('0x38')]){_0x285631[_0xe00e('0x36')]=_[_0xe00e('0x39')](_0x285631['where'],{'$or':_[_0xe00e('0x27')](_0x30395d,function(_0x45ecd9){if(_0x45ecd9[_0xe00e('0x2a')]!==_0xe00e('0x3a')){var _0x3cc9db={};_0x3cc9db[_0x45ecd9[_0xe00e('0x25')]]={'$like':'%'+_0x3fd8bd[_0xe00e('0x2d')][_0xe00e('0x38')]+'%'};return _0x3cc9db;}})});}_0x285631=_[_0xe00e('0x39')]({},_0x285631,_0x3fd8bd[_0xe00e('0x3b')]);var _0x46aa4e={'where':_0x285631[_0xe00e('0x36')]};return db[_0xe00e('0x3c')][_0xe00e('0x1a')](_0x46aa4e)[_0xe00e('0x20')](function(_0x5193){_0x4af56d[_0xe00e('0x1a')]=_0x5193;if(_0x3fd8bd['query'][_0xe00e('0x3d')]){_0x285631[_0xe00e('0x3e')]=[{'all':!![]}];}return db[_0xe00e('0x3c')][_0xe00e('0x3f')](_0x285631);})['then'](function(_0x15d255){_0x4af56d['rows']=_0x15d255;return _0x4af56d;})[_0xe00e('0x20')](respondWithFilteredResult(_0x444d00,_0x285631))[_0xe00e('0x40')](handleError(_0x444d00,null));};exports[_0xe00e('0x41')]=function(_0x3f065c,_0x16a3b9){var _0x231138={'raw':![],'where':{'id':_0x3f065c[_0xe00e('0x42')]['id']}},_0x111e80={};_0x111e80[_0xe00e('0x2c')]=_[_0xe00e('0x43')](db[_0xe00e('0x3c')][_0xe00e('0x28')]);_0x111e80[_0xe00e('0x2d')]=_['keys'](_0x3f065c[_0xe00e('0x2d')]);_0x111e80['filters']=_['intersection'](_0x111e80[_0xe00e('0x2c')],_0x111e80[_0xe00e('0x2d')]);_0x231138[_0xe00e('0x30')]=_[_0xe00e('0x2f')](_0x111e80[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x3f065c[_0xe00e('0x2d')][_0xe00e('0x31')]));_0x231138['attributes']=_0x231138[_0xe00e('0x30')][_0xe00e('0x32')]?_0x231138[_0xe00e('0x30')]:_0x111e80[_0xe00e('0x2c')];if(_0x3f065c[_0xe00e('0x2d')][_0xe00e('0x3d')]){_0x231138[_0xe00e('0x3e')]=[{'all':!![]}];}_0x231138=_[_0xe00e('0x39')]({},_0x231138,_0x3f065c['options']);return db['FreshdeskConfiguration']['find'](_0x231138)[_0xe00e('0x20')](handleEntityNotFound(_0x16a3b9,null))[_0xe00e('0x20')](respondWithResult(_0x16a3b9,null))[_0xe00e('0x40')](handleError(_0x16a3b9,null));};exports[_0xe00e('0x44')]=function(_0x5082ca,_0x46e718){return db[_0xe00e('0x3c')]['create'](_0x5082ca[_0xe00e('0x45')],{})['then'](respondWithResult(_0x46e718,0xc9))[_0xe00e('0x40')](handleError(_0x46e718,null));};exports[_0xe00e('0x1f')]=function(_0xd4e300,_0xa361f0){if(_0xd4e300[_0xe00e('0x45')]['id']){delete _0xd4e300[_0xe00e('0x45')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0xd4e300[_0xe00e('0x42')]['id']}})['then'](handleEntityNotFound(_0xa361f0,null))[_0xe00e('0x20')](saveUpdates(_0xd4e300[_0xe00e('0x45')],null))['then'](respondWithResult(_0xa361f0,null))['catch'](handleError(_0xa361f0,null));};exports[_0xe00e('0x21')]=function(_0xa5cd95,_0x46f2f3){return db[_0xe00e('0x3c')][_0xe00e('0x46')]({'where':{'id':_0xa5cd95[_0xe00e('0x42')]['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x46f2f3,null))[_0xe00e('0x20')](removeEntity(_0x46f2f3,null))[_0xe00e('0x40')](handleError(_0x46f2f3,null));};exports['getFields']=function(_0x5d8f4e,_0x4fef1a,_0x307404){var _0x5ab92d={};var _0x13766a={};var _0x5c2bc7;var _0xc99aad;return db[_0xe00e('0x3c')][_0xe00e('0x47')]({'where':{'id':_0x5d8f4e['params']['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x4fef1a,null))[_0xe00e('0x20')](function(_0x32bdba){if(_0x32bdba){_0x5c2bc7=_0x32bdba;_0x13766a[_0xe00e('0x2c')]=_[_0xe00e('0x43')](db[_0xe00e('0x48')][_0xe00e('0x28')]);_0x13766a[_0xe00e('0x2d')]=_[_0xe00e('0x43')](_0x5d8f4e[_0xe00e('0x2d')]);_0x13766a['filters']=_[_0xe00e('0x2f')](_0x13766a[_0xe00e('0x2c')],_0x13766a[_0xe00e('0x2d')]);_0x5ab92d[_0xe00e('0x30')]=_[_0xe00e('0x2f')](_0x13766a[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x5d8f4e[_0xe00e('0x2d')]['fields']));_0x5ab92d[_0xe00e('0x30')]=_0x5ab92d[_0xe00e('0x30')][_0xe00e('0x32')]?_0x5ab92d[_0xe00e('0x30')]:_0x13766a[_0xe00e('0x2c')];_0x5ab92d['order']=qs[_0xe00e('0x49')](_0x5d8f4e[_0xe00e('0x2d')][_0xe00e('0x49')]);_0x5ab92d[_0xe00e('0x36')]=qs[_0xe00e('0x2e')](_[_0xe00e('0x37')](_0x5d8f4e['query'],_0x13766a[_0xe00e('0x2e')]));if(_0x5d8f4e[_0xe00e('0x2d')][_0xe00e('0x38')]){_0x5ab92d[_0xe00e('0x36')]=_[_0xe00e('0x39')](_0x5ab92d[_0xe00e('0x36')],{'$or':_[_0xe00e('0x27')](_0x5ab92d['attributes'],function(_0x2dbf90){var _0x3b0494={};_0x3b0494[_0x2dbf90]={'$like':'%'+_0x5d8f4e['query']['filter']+'%'};return _0x3b0494;})});}_0x5ab92d=_[_0xe00e('0x39')]({},_0x5ab92d,_0x5d8f4e[_0xe00e('0x3b')]);return _0x5c2bc7['getFields'](_0x5ab92d);}})[_0xe00e('0x20')](function(_0x2ce671){if(_0x2ce671){_0xc99aad=_0x2ce671[_0xe00e('0x32')];if(!_0x5d8f4e[_0xe00e('0x2d')]['hasOwnProperty']('nolimit')){_0x5ab92d[_0xe00e('0x1b')]=qs[_0xe00e('0x1b')](_0x5d8f4e['query'][_0xe00e('0x1b')]);_0x5ab92d[_0xe00e('0x19')]=qs[_0xe00e('0x19')](_0x5d8f4e[_0xe00e('0x2d')][_0xe00e('0x19')]);}return _0x5c2bc7[_0xe00e('0x4a')](_0x5ab92d);}})[_0xe00e('0x20')](function(_0x3abc5a){if(_0x3abc5a){return _0x3abc5a?{'count':_0xc99aad,'rows':_0x3abc5a}:null;}})[_0xe00e('0x20')](respondWithResult(_0x4fef1a,null))[_0xe00e('0x40')](handleError(_0x4fef1a,null));};exports[_0xe00e('0x4b')]=function(_0x9926f6,_0x70b2d,_0x4cf918){var _0x40eea5={};var _0x13ebb4={};var _0x4c4dfc;var _0x5b391e;return db[_0xe00e('0x3c')][_0xe00e('0x47')]({'where':{'id':_0x9926f6[_0xe00e('0x42')]['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x70b2d,null))[_0xe00e('0x20')](function(_0x1f33a9){if(_0x1f33a9){_0x4c4dfc=_0x1f33a9;_0x13ebb4[_0xe00e('0x2c')]=_[_0xe00e('0x43')](db[_0xe00e('0x48')]['rawAttributes']);_0x13ebb4[_0xe00e('0x2d')]=_['keys'](_0x9926f6[_0xe00e('0x2d')]);_0x13ebb4['filters']=_[_0xe00e('0x2f')](_0x13ebb4[_0xe00e('0x2c')],_0x13ebb4[_0xe00e('0x2d')]);_0x40eea5[_0xe00e('0x30')]=_[_0xe00e('0x2f')](_0x13ebb4[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x9926f6['query']['fields']));_0x40eea5[_0xe00e('0x30')]=_0x40eea5[_0xe00e('0x30')][_0xe00e('0x32')]?_0x40eea5[_0xe00e('0x30')]:_0x13ebb4[_0xe00e('0x2c')];_0x40eea5[_0xe00e('0x35')]=qs['sort'](_0x9926f6[_0xe00e('0x2d')]['sort']);_0x40eea5[_0xe00e('0x36')]=qs[_0xe00e('0x2e')](_[_0xe00e('0x37')](_0x9926f6['query'],_0x13ebb4[_0xe00e('0x2e')]));if(_0x9926f6[_0xe00e('0x2d')][_0xe00e('0x38')]){_0x40eea5['where']=_[_0xe00e('0x39')](_0x40eea5[_0xe00e('0x36')],{'$or':_[_0xe00e('0x27')](_0x40eea5[_0xe00e('0x30')],function(_0x5a53ab){var _0x37092b={};_0x37092b[_0x5a53ab]={'$like':'%'+_0x9926f6['query'][_0xe00e('0x38')]+'%'};return _0x37092b;})});}_0x40eea5=_[_0xe00e('0x39')]({},_0x40eea5,_0x9926f6[_0xe00e('0x3b')]);return _0x4c4dfc['getSubjects'](_0x40eea5);}})[_0xe00e('0x20')](function(_0x50e324){if(_0x50e324){_0x5b391e=_0x50e324[_0xe00e('0x32')];if(!_0x9926f6['query'][_0xe00e('0x33')](_0xe00e('0x34'))){_0x40eea5['limit']=qs[_0xe00e('0x1b')](_0x9926f6['query'][_0xe00e('0x1b')]);_0x40eea5[_0xe00e('0x19')]=qs[_0xe00e('0x19')](_0x9926f6[_0xe00e('0x2d')][_0xe00e('0x19')]);}return _0x4c4dfc['getSubjects'](_0x40eea5);}})[_0xe00e('0x20')](function(_0x229305){if(_0x229305){return _0x229305?{'count':_0x5b391e,'rows':_0x229305}:null;}})['then'](respondWithResult(_0x70b2d,null))[_0xe00e('0x40')](handleError(_0x70b2d,null));};exports[_0xe00e('0x4c')]=function(_0x3155a9,_0x239614,_0x25d3ff){var _0x8d9c44={};var _0x21f776={};var _0x5c53f2;var _0x197a1a;return db['FreshdeskConfiguration'][_0xe00e('0x47')]({'where':{'id':_0x3155a9['params']['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x239614,null))[_0xe00e('0x20')](function(_0x4b0a72){if(_0x4b0a72){_0x5c53f2=_0x4b0a72;_0x21f776['model']=_[_0xe00e('0x43')](db[_0xe00e('0x48')][_0xe00e('0x28')]);_0x21f776['query']=_[_0xe00e('0x43')](_0x3155a9[_0xe00e('0x2d')]);_0x21f776[_0xe00e('0x2e')]=_['intersection'](_0x21f776['model'],_0x21f776[_0xe00e('0x2d')]);_0x8d9c44['attributes']=_[_0xe00e('0x2f')](_0x21f776[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x3155a9[_0xe00e('0x2d')][_0xe00e('0x31')]));_0x8d9c44[_0xe00e('0x30')]=_0x8d9c44[_0xe00e('0x30')][_0xe00e('0x32')]?_0x8d9c44['attributes']:_0x21f776[_0xe00e('0x2c')];_0x8d9c44[_0xe00e('0x35')]=qs[_0xe00e('0x49')](_0x3155a9['query']['sort']);_0x8d9c44['where']=qs['filters'](_[_0xe00e('0x37')](_0x3155a9[_0xe00e('0x2d')],_0x21f776[_0xe00e('0x2e')]));if(_0x3155a9[_0xe00e('0x2d')]['filter']){_0x8d9c44[_0xe00e('0x36')]=_['merge'](_0x8d9c44[_0xe00e('0x36')],{'$or':_['map'](_0x8d9c44[_0xe00e('0x30')],function(_0x22aaaf){var _0x50dc2e={};_0x50dc2e[_0x22aaaf]={'$like':'%'+_0x3155a9[_0xe00e('0x2d')][_0xe00e('0x38')]+'%'};return _0x50dc2e;})});}_0x8d9c44=_[_0xe00e('0x39')]({},_0x8d9c44,_0x3155a9[_0xe00e('0x3b')]);return _0x5c53f2[_0xe00e('0x4c')](_0x8d9c44);}})['then'](function(_0x5bddba){if(_0x5bddba){_0x197a1a=_0x5bddba['length'];if(!_0x3155a9['query'][_0xe00e('0x33')](_0xe00e('0x34'))){_0x8d9c44['limit']=qs[_0xe00e('0x1b')](_0x3155a9['query']['limit']);_0x8d9c44[_0xe00e('0x19')]=qs[_0xe00e('0x19')](_0x3155a9[_0xe00e('0x2d')]['offset']);}return _0x5c53f2[_0xe00e('0x4c')](_0x8d9c44);}})[_0xe00e('0x20')](function(_0x5dbe59){if(_0x5dbe59){return _0x5dbe59?{'count':_0x197a1a,'rows':_0x5dbe59}:null;}})[_0xe00e('0x20')](respondWithResult(_0x239614,null))[_0xe00e('0x40')](handleError(_0x239614,null));};exports[_0xe00e('0x4d')]=function(_0x1c91e9,_0x542f8b,_0x208644){var _0x48b6d4={};var _0x48a0f8={};var _0x3c54c2;var _0x3ae55c;return db[_0xe00e('0x3c')]['findOne']({'where':{'id':_0x1c91e9[_0xe00e('0x42')]['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x542f8b,null))[_0xe00e('0x20')](function(_0x21433a){if(_0x21433a){_0x3c54c2=_0x21433a;_0x48a0f8[_0xe00e('0x2c')]=_[_0xe00e('0x43')](db[_0xe00e('0x4e')][_0xe00e('0x28')]);_0x48a0f8['query']=_[_0xe00e('0x43')](_0x1c91e9[_0xe00e('0x2d')]);_0x48a0f8[_0xe00e('0x2e')]=_[_0xe00e('0x2f')](_0x48a0f8['model'],_0x48a0f8[_0xe00e('0x2d')]);_0x48b6d4['attributes']=_[_0xe00e('0x2f')](_0x48a0f8[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x31')]));_0x48b6d4[_0xe00e('0x30')]=_0x48b6d4[_0xe00e('0x30')]['length']?_0x48b6d4[_0xe00e('0x30')]:_0x48a0f8['model'];_0x48b6d4['order']=qs[_0xe00e('0x49')](_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x49')]);_0x48b6d4['where']=qs['filters'](_['pick'](_0x1c91e9[_0xe00e('0x2d')],_0x48a0f8[_0xe00e('0x2e')]));if(_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x38')]){_0x48b6d4[_0xe00e('0x36')]=_['merge'](_0x48b6d4[_0xe00e('0x36')],{'$or':_['map'](_0x48b6d4[_0xe00e('0x30')],function(_0x10e2f7){var _0x39b0de={};_0x39b0de[_0x10e2f7]={'$like':'%'+_0x1c91e9['query'][_0xe00e('0x38')]+'%'};return _0x39b0de;})});}_0x48b6d4=_[_0xe00e('0x39')]({},_0x48b6d4,_0x1c91e9[_0xe00e('0x3b')]);return _0x3c54c2[_0xe00e('0x4d')](_0x48b6d4);}})['then'](function(_0x342e3b){if(_0x342e3b){_0x3ae55c=_0x342e3b['length'];if(!_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x33')](_0xe00e('0x34'))){_0x48b6d4[_0xe00e('0x1b')]=qs[_0xe00e('0x1b')](_0x1c91e9['query']['limit']);_0x48b6d4[_0xe00e('0x19')]=qs[_0xe00e('0x19')](_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x19')]);}return _0x3c54c2['getTags'](_0x48b6d4);}})[_0xe00e('0x20')](function(_0x470342){if(_0x470342){return _0x470342?{'count':_0x3ae55c,'rows':_0x470342}:null;}})['then'](respondWithResult(_0x542f8b,null))[_0xe00e('0x40')](handleError(_0x542f8b,null));};exports[_0xe00e('0x4f')]=function(_0x4b8a69,_0x7ebc3b,_0x3d1141){if(_0x4b8a69[_0xe00e('0x45')]['id']){delete _0x4b8a69[_0xe00e('0x45')]['id'];}return db[_0xe00e('0x3c')][_0xe00e('0x47')]({'where':{'id':_0x4b8a69[_0xe00e('0x42')]['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x7ebc3b,null))[_0xe00e('0x20')](function(_0x1f249a){if(_0x1f249a){return _0x1f249a['setTags'](_0x4b8a69['body'][_0xe00e('0x50')]||[]);}return null;})[_0xe00e('0x20')](respondWithResult(_0x7ebc3b,null))[_0xe00e('0x40')](handleError(_0x7ebc3b,null));}; \ No newline at end of file +var _0xc358=['crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','FreshdeskConfiguration','type','key','model','keys','query','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','intersection','includeAll','include','create','body','find','params','getFields','FreshdeskField','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel'];(function(_0x50bb65,_0x998a5f){var _0x1e05b5=function(_0x1bae4b){while(--_0x1bae4b){_0x50bb65['push'](_0x50bb65['shift']());}};_0x1e05b5(++_0x998a5f);}(_0xc358,0x1ed));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8c35('0x0'));var rimraf=require(_0x8c35('0x1'));var zipdir=require(_0x8c35('0x2'));var jsonpatch=require(_0x8c35('0x3'));var rp=require(_0x8c35('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c35('0x5'));var util=require(_0x8c35('0x6'));var path=require('path');var sox=require(_0x8c35('0x7'));var csv=require('to-csv');var ejs=require(_0x8c35('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c35('0x9'));var squel=require(_0x8c35('0xa'));var crypto=require(_0x8c35('0xb'));var jsforce=require(_0x8c35('0xc'));var deskjs=require(_0x8c35('0xd'));var toCsv=require(_0x8c35('0xe'));var querystring=require(_0x8c35('0xf'));var Papa=require('papaparse');var Redis=require(_0x8c35('0x10'));var authService=require(_0x8c35('0x11'));var qs=require(_0x8c35('0x12'));var as=require(_0x8c35('0x13'));var hardwareService=require(_0x8c35('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x8c35('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8c35('0x16'));var db=require(_0x8c35('0x17'))['db'];function respondWithStatusCode(_0x384b0c,_0xdeaaba){_0xdeaaba=_0xdeaaba||0xcc;return function(_0x1b1888){if(_0x1b1888){return _0x384b0c[_0x8c35('0x18')](_0xdeaaba);}return _0x384b0c[_0x8c35('0x19')](_0xdeaaba)[_0x8c35('0x1a')]();};}function respondWithResult(_0x41ee89,_0x405277){_0x405277=_0x405277||0xc8;return function(_0x564ba3){if(_0x564ba3){return _0x41ee89[_0x8c35('0x19')](_0x405277)[_0x8c35('0x1b')](_0x564ba3);}};}function respondWithFilteredResult(_0x454c97,_0xdd7aab){return function(_0x2d5b7f){if(_0x2d5b7f){var _0x3c2d69=typeof _0xdd7aab['offset']===_0x8c35('0x1c')&&typeof _0xdd7aab['limit']===_0x8c35('0x1c');var _0x9d982c=_0x2d5b7f[_0x8c35('0x1d')];var _0x4ca067=_0x3c2d69?0x0:_0xdd7aab[_0x8c35('0x1e')];var _0x448b32=_0x3c2d69?_0x2d5b7f[_0x8c35('0x1d')]:_0xdd7aab[_0x8c35('0x1e')]+_0xdd7aab[_0x8c35('0x1f')];var _0x284a19;if(_0x448b32>=_0x9d982c){_0x448b32=_0x9d982c;_0x284a19=0xc8;}else{_0x284a19=0xce;}_0x454c97[_0x8c35('0x19')](_0x284a19);return _0x454c97[_0x8c35('0x20')](_0x8c35('0x21'),_0x4ca067+'-'+_0x448b32+'/'+_0x9d982c)[_0x8c35('0x1b')](_0x2d5b7f);}return null;};}function patchUpdates(_0xf3dac2){return function(_0x30d3b9){try{jsonpatch[_0x8c35('0x22')](_0x30d3b9,_0xf3dac2,!![]);}catch(_0x5e43fe){return BPromise['reject'](_0x5e43fe);}return _0x30d3b9[_0x8c35('0x23')]();};}function saveUpdates(_0x3696d7,_0x33b6f8){return function(_0x35256e){if(_0x35256e){return _0x35256e['update'](_0x3696d7)[_0x8c35('0x24')](function(_0x3459b9){return _0x3459b9;});}return null;};}function removeEntity(_0x4dda55,_0x5550b1){return function(_0x40b690){if(_0x40b690){return _0x40b690[_0x8c35('0x25')]()['then'](function(){_0x4dda55[_0x8c35('0x19')](0xcc)[_0x8c35('0x1a')]();});}};}function handleEntityNotFound(_0x1a3af9,_0x2bd61e){return function(_0x50f50b){if(!_0x50f50b){_0x1a3af9[_0x8c35('0x18')](0x194);}return _0x50f50b;};}function handleError(_0x481f9e,_0x128c2e){_0x128c2e=_0x128c2e||0x1f4;return function(_0x1acb67){logger[_0x8c35('0x26')](_0x1acb67['stack']);if(_0x1acb67[_0x8c35('0x27')]){delete _0x1acb67[_0x8c35('0x27')];}_0x481f9e[_0x8c35('0x19')](_0x128c2e)[_0x8c35('0x28')](_0x1acb67);};}exports[_0x8c35('0x29')]=function(_0x51e34f,_0x1882a4){var _0x50f275={},_0x46e9fb={},_0xfe9d68={'count':0x0,'rows':[]};var _0x2d962b=_[_0x8c35('0x2a')](db[_0x8c35('0x2b')]['rawAttributes'],function(_0x54d1f9){return{'name':_0x54d1f9['fieldName'],'type':_0x54d1f9[_0x8c35('0x2c')][_0x8c35('0x2d')]};});_0x46e9fb[_0x8c35('0x2e')]=_['map'](_0x2d962b,_0x8c35('0x27'));_0x46e9fb['query']=_[_0x8c35('0x2f')](_0x51e34f[_0x8c35('0x30')]);_0x46e9fb[_0x8c35('0x31')]=_['intersection'](_0x46e9fb['model'],_0x46e9fb[_0x8c35('0x30')]);_0x50f275[_0x8c35('0x32')]=_['intersection'](_0x46e9fb[_0x8c35('0x2e')],qs[_0x8c35('0x33')](_0x51e34f[_0x8c35('0x30')][_0x8c35('0x33')]));_0x50f275[_0x8c35('0x32')]=_0x50f275[_0x8c35('0x32')][_0x8c35('0x34')]?_0x50f275['attributes']:_0x46e9fb[_0x8c35('0x2e')];if(!_0x51e34f[_0x8c35('0x30')]['hasOwnProperty']('nolimit')){_0x50f275[_0x8c35('0x1f')]=qs[_0x8c35('0x1f')](_0x51e34f['query']['limit']);_0x50f275[_0x8c35('0x1e')]=qs['offset'](_0x51e34f[_0x8c35('0x30')][_0x8c35('0x1e')]);}_0x50f275[_0x8c35('0x35')]=qs[_0x8c35('0x36')](_0x51e34f['query'][_0x8c35('0x36')]);_0x50f275[_0x8c35('0x37')]=qs['filters'](_[_0x8c35('0x38')](_0x51e34f[_0x8c35('0x30')],_0x46e9fb[_0x8c35('0x31')]),_0x2d962b);if(_0x51e34f[_0x8c35('0x30')][_0x8c35('0x39')]){_0x50f275[_0x8c35('0x37')]=_[_0x8c35('0x3a')](_0x50f275[_0x8c35('0x37')],{'$or':_[_0x8c35('0x2a')](_0x2d962b,function(_0x5b1f3b){if(_0x5b1f3b[_0x8c35('0x2c')]!==_0x8c35('0x3b')){var _0x4c497e={};_0x4c497e[_0x5b1f3b[_0x8c35('0x27')]]={'$like':'%'+_0x51e34f[_0x8c35('0x30')][_0x8c35('0x39')]+'%'};return _0x4c497e;}})});}_0x50f275=_[_0x8c35('0x3a')]({},_0x50f275,_0x51e34f[_0x8c35('0x3c')]);var _0x5dc4a5={'where':_0x50f275[_0x8c35('0x37')]};return db[_0x8c35('0x2b')][_0x8c35('0x1d')](_0x5dc4a5)['then'](function(_0x559c6c){_0xfe9d68['count']=_0x559c6c;if(_0x51e34f['query']['includeAll']){_0x50f275['include']=[{'all':!![]}];}return db[_0x8c35('0x2b')][_0x8c35('0x3d')](_0x50f275);})[_0x8c35('0x24')](function(_0x384686){_0xfe9d68[_0x8c35('0x3e')]=_0x384686;return _0xfe9d68;})['then'](respondWithFilteredResult(_0x1882a4,_0x50f275))[_0x8c35('0x3f')](handleError(_0x1882a4,null));};exports[_0x8c35('0x40')]=function(_0x3bca0b,_0x52c1ee){var _0x3528b1={'raw':![],'where':{'id':_0x3bca0b['params']['id']}},_0x9894d8={};_0x9894d8['model']=_[_0x8c35('0x2f')](db['FreshdeskConfiguration'][_0x8c35('0x41')]);_0x9894d8[_0x8c35('0x30')]=_[_0x8c35('0x2f')](_0x3bca0b[_0x8c35('0x30')]);_0x9894d8[_0x8c35('0x31')]=_[_0x8c35('0x42')](_0x9894d8['model'],_0x9894d8['query']);_0x3528b1[_0x8c35('0x32')]=_[_0x8c35('0x42')](_0x9894d8[_0x8c35('0x2e')],qs['fields'](_0x3bca0b[_0x8c35('0x30')][_0x8c35('0x33')]));_0x3528b1[_0x8c35('0x32')]=_0x3528b1[_0x8c35('0x32')][_0x8c35('0x34')]?_0x3528b1['attributes']:_0x9894d8[_0x8c35('0x2e')];if(_0x3bca0b[_0x8c35('0x30')][_0x8c35('0x43')]){_0x3528b1[_0x8c35('0x44')]=[{'all':!![]}];}_0x3528b1=_[_0x8c35('0x3a')]({},_0x3528b1,_0x3bca0b['options']);return db['FreshdeskConfiguration']['find'](_0x3528b1)[_0x8c35('0x24')](handleEntityNotFound(_0x52c1ee,null))[_0x8c35('0x24')](respondWithResult(_0x52c1ee,null))['catch'](handleError(_0x52c1ee,null));};exports[_0x8c35('0x45')]=function(_0x2a70d9,_0x52b9cf){return db[_0x8c35('0x2b')][_0x8c35('0x45')](_0x2a70d9[_0x8c35('0x46')],{})[_0x8c35('0x24')](respondWithResult(_0x52b9cf,0xc9))[_0x8c35('0x3f')](handleError(_0x52b9cf,null));};exports['update']=function(_0x107aa0,_0x17b670){if(_0x107aa0[_0x8c35('0x46')]['id']){delete _0x107aa0[_0x8c35('0x46')]['id'];}return db[_0x8c35('0x2b')][_0x8c35('0x47')]({'where':{'id':_0x107aa0['params']['id']}})[_0x8c35('0x24')](handleEntityNotFound(_0x17b670,null))[_0x8c35('0x24')](saveUpdates(_0x107aa0['body'],null))[_0x8c35('0x24')](respondWithResult(_0x17b670,null))[_0x8c35('0x3f')](handleError(_0x17b670,null));};exports[_0x8c35('0x25')]=function(_0x7a9e10,_0x3ebe1d){return db[_0x8c35('0x2b')][_0x8c35('0x47')]({'where':{'id':_0x7a9e10[_0x8c35('0x48')]['id']}})[_0x8c35('0x24')](handleEntityNotFound(_0x3ebe1d,null))[_0x8c35('0x24')](removeEntity(_0x3ebe1d,null))['catch'](handleError(_0x3ebe1d,null));};exports[_0x8c35('0x49')]=function(_0x136b1a,_0x343908,_0xd42b3e){var _0x5b9edd={};var _0x4650cd={};var _0x45ab49;var _0x9b9d6c;return db[_0x8c35('0x2b')]['findOne']({'where':{'id':_0x136b1a[_0x8c35('0x48')]['id']}})[_0x8c35('0x24')](handleEntityNotFound(_0x343908,null))['then'](function(_0x105f7c){if(_0x105f7c){_0x45ab49=_0x105f7c;_0x4650cd[_0x8c35('0x2e')]=_[_0x8c35('0x2f')](db[_0x8c35('0x4a')][_0x8c35('0x41')]);_0x4650cd[_0x8c35('0x30')]=_[_0x8c35('0x2f')](_0x136b1a[_0x8c35('0x30')]);_0x4650cd[_0x8c35('0x31')]=_[_0x8c35('0x42')](_0x4650cd['model'],_0x4650cd[_0x8c35('0x30')]);_0x5b9edd[_0x8c35('0x32')]=_['intersection'](_0x4650cd[_0x8c35('0x2e')],qs[_0x8c35('0x33')](_0x136b1a['query'][_0x8c35('0x33')]));_0x5b9edd[_0x8c35('0x32')]=_0x5b9edd[_0x8c35('0x32')][_0x8c35('0x34')]?_0x5b9edd['attributes']:_0x4650cd['model'];_0x5b9edd[_0x8c35('0x35')]=qs[_0x8c35('0x36')](_0x136b1a['query'][_0x8c35('0x36')]);_0x5b9edd[_0x8c35('0x37')]=qs['filters'](_[_0x8c35('0x38')](_0x136b1a[_0x8c35('0x30')],_0x4650cd['filters']));if(_0x136b1a[_0x8c35('0x30')][_0x8c35('0x39')]){_0x5b9edd[_0x8c35('0x37')]=_[_0x8c35('0x3a')](_0x5b9edd['where'],{'$or':_[_0x8c35('0x2a')](_0x5b9edd[_0x8c35('0x32')],function(_0x5d9355){var _0x5a0c57={};_0x5a0c57[_0x5d9355]={'$like':'%'+_0x136b1a[_0x8c35('0x30')]['filter']+'%'};return _0x5a0c57;})});}_0x5b9edd=_[_0x8c35('0x3a')]({},_0x5b9edd,_0x136b1a[_0x8c35('0x3c')]);return _0x45ab49[_0x8c35('0x49')](_0x5b9edd);}})['then'](function(_0x4ee1d7){if(_0x4ee1d7){_0x9b9d6c=_0x4ee1d7[_0x8c35('0x34')];if(!_0x136b1a[_0x8c35('0x30')][_0x8c35('0x4b')](_0x8c35('0x4c'))){_0x5b9edd[_0x8c35('0x1f')]=qs[_0x8c35('0x1f')](_0x136b1a[_0x8c35('0x30')]['limit']);_0x5b9edd[_0x8c35('0x1e')]=qs[_0x8c35('0x1e')](_0x136b1a[_0x8c35('0x30')][_0x8c35('0x1e')]);}return _0x45ab49[_0x8c35('0x49')](_0x5b9edd);}})['then'](function(_0x3033dc){if(_0x3033dc){return _0x3033dc?{'count':_0x9b9d6c,'rows':_0x3033dc}:null;}})[_0x8c35('0x24')](respondWithResult(_0x343908,null))[_0x8c35('0x3f')](handleError(_0x343908,null));};exports[_0x8c35('0x4d')]=function(_0xe0aaf6,_0x25432f,_0x22ff42){var _0x186270={};var _0x41eead={};var _0x8dea37;var _0x38fb6c;return db['FreshdeskConfiguration'][_0x8c35('0x4e')]({'where':{'id':_0xe0aaf6[_0x8c35('0x48')]['id']}})[_0x8c35('0x24')](handleEntityNotFound(_0x25432f,null))[_0x8c35('0x24')](function(_0x1789f2){if(_0x1789f2){_0x8dea37=_0x1789f2;_0x41eead[_0x8c35('0x2e')]=_[_0x8c35('0x2f')](db['FreshdeskField']['rawAttributes']);_0x41eead[_0x8c35('0x30')]=_['keys'](_0xe0aaf6[_0x8c35('0x30')]);_0x41eead[_0x8c35('0x31')]=_[_0x8c35('0x42')](_0x41eead[_0x8c35('0x2e')],_0x41eead['query']);_0x186270[_0x8c35('0x32')]=_['intersection'](_0x41eead[_0x8c35('0x2e')],qs[_0x8c35('0x33')](_0xe0aaf6[_0x8c35('0x30')][_0x8c35('0x33')]));_0x186270[_0x8c35('0x32')]=_0x186270[_0x8c35('0x32')][_0x8c35('0x34')]?_0x186270[_0x8c35('0x32')]:_0x41eead[_0x8c35('0x2e')];_0x186270[_0x8c35('0x35')]=qs[_0x8c35('0x36')](_0xe0aaf6[_0x8c35('0x30')][_0x8c35('0x36')]);_0x186270['where']=qs[_0x8c35('0x31')](_[_0x8c35('0x38')](_0xe0aaf6[_0x8c35('0x30')],_0x41eead[_0x8c35('0x31')]));if(_0xe0aaf6['query'][_0x8c35('0x39')]){_0x186270[_0x8c35('0x37')]=_['merge'](_0x186270[_0x8c35('0x37')],{'$or':_[_0x8c35('0x2a')](_0x186270[_0x8c35('0x32')],function(_0x5e0623){var _0x3d9847={};_0x3d9847[_0x5e0623]={'$like':'%'+_0xe0aaf6[_0x8c35('0x30')]['filter']+'%'};return _0x3d9847;})});}_0x186270=_[_0x8c35('0x3a')]({},_0x186270,_0xe0aaf6[_0x8c35('0x3c')]);return _0x8dea37[_0x8c35('0x4d')](_0x186270);}})['then'](function(_0x22d2e2){if(_0x22d2e2){_0x38fb6c=_0x22d2e2[_0x8c35('0x34')];if(!_0xe0aaf6['query']['hasOwnProperty'](_0x8c35('0x4c'))){_0x186270[_0x8c35('0x1f')]=qs[_0x8c35('0x1f')](_0xe0aaf6[_0x8c35('0x30')][_0x8c35('0x1f')]);_0x186270[_0x8c35('0x1e')]=qs[_0x8c35('0x1e')](_0xe0aaf6['query'][_0x8c35('0x1e')]);}return _0x8dea37['getSubjects'](_0x186270);}})[_0x8c35('0x24')](function(_0x47d0b6){if(_0x47d0b6){return _0x47d0b6?{'count':_0x38fb6c,'rows':_0x47d0b6}:null;}})['then'](respondWithResult(_0x25432f,null))[_0x8c35('0x3f')](handleError(_0x25432f,null));};exports[_0x8c35('0x4f')]=function(_0x262191,_0x4fa87d,_0x4133ae){var _0x3d9b36={};var _0x3a4d0f={};var _0x41fa64;var _0x2e1f4f;return db['FreshdeskConfiguration'][_0x8c35('0x4e')]({'where':{'id':_0x262191[_0x8c35('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fa87d,null))[_0x8c35('0x24')](function(_0x119b00){if(_0x119b00){_0x41fa64=_0x119b00;_0x3a4d0f[_0x8c35('0x2e')]=_[_0x8c35('0x2f')](db[_0x8c35('0x4a')][_0x8c35('0x41')]);_0x3a4d0f[_0x8c35('0x30')]=_[_0x8c35('0x2f')](_0x262191[_0x8c35('0x30')]);_0x3a4d0f[_0x8c35('0x31')]=_[_0x8c35('0x42')](_0x3a4d0f[_0x8c35('0x2e')],_0x3a4d0f[_0x8c35('0x30')]);_0x3d9b36[_0x8c35('0x32')]=_[_0x8c35('0x42')](_0x3a4d0f['model'],qs['fields'](_0x262191[_0x8c35('0x30')][_0x8c35('0x33')]));_0x3d9b36[_0x8c35('0x32')]=_0x3d9b36[_0x8c35('0x32')][_0x8c35('0x34')]?_0x3d9b36['attributes']:_0x3a4d0f[_0x8c35('0x2e')];_0x3d9b36[_0x8c35('0x35')]=qs['sort'](_0x262191['query'][_0x8c35('0x36')]);_0x3d9b36[_0x8c35('0x37')]=qs[_0x8c35('0x31')](_['pick'](_0x262191[_0x8c35('0x30')],_0x3a4d0f[_0x8c35('0x31')]));if(_0x262191[_0x8c35('0x30')]['filter']){_0x3d9b36[_0x8c35('0x37')]=_['merge'](_0x3d9b36['where'],{'$or':_[_0x8c35('0x2a')](_0x3d9b36[_0x8c35('0x32')],function(_0x3eec40){var _0x354e61={};_0x354e61[_0x3eec40]={'$like':'%'+_0x262191['query'][_0x8c35('0x39')]+'%'};return _0x354e61;})});}_0x3d9b36=_[_0x8c35('0x3a')]({},_0x3d9b36,_0x262191[_0x8c35('0x3c')]);return _0x41fa64[_0x8c35('0x4f')](_0x3d9b36);}})[_0x8c35('0x24')](function(_0x2449fd){if(_0x2449fd){_0x2e1f4f=_0x2449fd[_0x8c35('0x34')];if(!_0x262191[_0x8c35('0x30')]['hasOwnProperty']('nolimit')){_0x3d9b36[_0x8c35('0x1f')]=qs[_0x8c35('0x1f')](_0x262191[_0x8c35('0x30')][_0x8c35('0x1f')]);_0x3d9b36[_0x8c35('0x1e')]=qs[_0x8c35('0x1e')](_0x262191[_0x8c35('0x30')][_0x8c35('0x1e')]);}return _0x41fa64[_0x8c35('0x4f')](_0x3d9b36);}})[_0x8c35('0x24')](function(_0x344464){if(_0x344464){return _0x344464?{'count':_0x2e1f4f,'rows':_0x344464}:null;}})[_0x8c35('0x24')](respondWithResult(_0x4fa87d,null))[_0x8c35('0x3f')](handleError(_0x4fa87d,null));};exports[_0x8c35('0x50')]=function(_0x19b0d1,_0x42eee4,_0x930d31){var _0x2260a0={};var _0x118b55={};var _0x16fda0;var _0x546a58;return db[_0x8c35('0x2b')][_0x8c35('0x4e')]({'where':{'id':_0x19b0d1['params']['id']}})[_0x8c35('0x24')](handleEntityNotFound(_0x42eee4,null))[_0x8c35('0x24')](function(_0x658d9d){if(_0x658d9d){_0x16fda0=_0x658d9d;_0x118b55[_0x8c35('0x2e')]=_[_0x8c35('0x2f')](db[_0x8c35('0x51')][_0x8c35('0x41')]);_0x118b55[_0x8c35('0x30')]=_[_0x8c35('0x2f')](_0x19b0d1[_0x8c35('0x30')]);_0x118b55[_0x8c35('0x31')]=_[_0x8c35('0x42')](_0x118b55[_0x8c35('0x2e')],_0x118b55[_0x8c35('0x30')]);_0x2260a0[_0x8c35('0x32')]=_[_0x8c35('0x42')](_0x118b55[_0x8c35('0x2e')],qs[_0x8c35('0x33')](_0x19b0d1[_0x8c35('0x30')]['fields']));_0x2260a0[_0x8c35('0x32')]=_0x2260a0['attributes']['length']?_0x2260a0['attributes']:_0x118b55[_0x8c35('0x2e')];_0x2260a0[_0x8c35('0x35')]=qs[_0x8c35('0x36')](_0x19b0d1[_0x8c35('0x30')][_0x8c35('0x36')]);_0x2260a0['where']=qs[_0x8c35('0x31')](_[_0x8c35('0x38')](_0x19b0d1[_0x8c35('0x30')],_0x118b55[_0x8c35('0x31')]));if(_0x19b0d1[_0x8c35('0x30')][_0x8c35('0x39')]){_0x2260a0['where']=_[_0x8c35('0x3a')](_0x2260a0[_0x8c35('0x37')],{'$or':_[_0x8c35('0x2a')](_0x2260a0[_0x8c35('0x32')],function(_0x5ee2fa){var _0x5f497b={};_0x5f497b[_0x5ee2fa]={'$like':'%'+_0x19b0d1[_0x8c35('0x30')][_0x8c35('0x39')]+'%'};return _0x5f497b;})});}_0x2260a0=_[_0x8c35('0x3a')]({},_0x2260a0,_0x19b0d1['options']);return _0x16fda0[_0x8c35('0x50')](_0x2260a0);}})['then'](function(_0x382eae){if(_0x382eae){_0x546a58=_0x382eae[_0x8c35('0x34')];if(!_0x19b0d1[_0x8c35('0x30')][_0x8c35('0x4b')](_0x8c35('0x4c'))){_0x2260a0[_0x8c35('0x1f')]=qs['limit'](_0x19b0d1[_0x8c35('0x30')][_0x8c35('0x1f')]);_0x2260a0['offset']=qs[_0x8c35('0x1e')](_0x19b0d1[_0x8c35('0x30')][_0x8c35('0x1e')]);}return _0x16fda0[_0x8c35('0x50')](_0x2260a0);}})[_0x8c35('0x24')](function(_0x39044f){if(_0x39044f){return _0x39044f?{'count':_0x546a58,'rows':_0x39044f}:null;}})['then'](respondWithResult(_0x42eee4,null))['catch'](handleError(_0x42eee4,null));};exports[_0x8c35('0x52')]=function(_0xed10f0,_0x49ace5,_0x157dea){if(_0xed10f0[_0x8c35('0x46')]['id']){delete _0xed10f0[_0x8c35('0x46')]['id'];}return db[_0x8c35('0x2b')]['findOne']({'where':{'id':_0xed10f0['params']['id']}})[_0x8c35('0x24')](handleEntityNotFound(_0x49ace5,null))['then'](function(_0x92cd45){if(_0x92cd45){return _0x92cd45[_0x8c35('0x52')](_0xed10f0[_0x8c35('0x46')][_0x8c35('0x53')]||[]);}return null;})[_0x8c35('0x24')](respondWithResult(_0x49ace5,null))[_0x8c35('0x3f')](handleError(_0x49ace5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 42e017a..f5f349b 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 _0x3b59=['../../config/environment','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x371b42,_0x3964d0){var _0x1adbe7=function(_0x1d1c18){while(--_0x1d1c18){_0x371b42['push'](_0x371b42['shift']());}};_0x1adbe7(++_0x3964d0);}(_0x3b59,0xa0));var _0x93b5=function(_0x232b8f,_0x18b3c2){_0x232b8f=_0x232b8f-0x0;var _0x3fdc20=_0x3b59[_0x232b8f];return _0x3fdc20;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var logger=require(_0x93b5('0x2'))('api');var moment=require(_0x93b5('0x3'));var BPromise=require(_0x93b5('0x4'));var rp=require(_0x93b5('0x5'));var fs=require('fs');var path=require(_0x93b5('0x6'));var rimraf=require(_0x93b5('0x7'));var config=require(_0x93b5('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x93b5('0x9')]=function(_0x54df0c,_0x5aedde){return _0x54df0c['define'](_0x93b5('0xa'),attributes,{'tableName':_0x93b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb9=['api','moment','bluebird','request-promise','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util','../../config/logger'];(function(_0x4743ed,_0x5c842f){var _0x2d547e=function(_0x564642){while(--_0x564642){_0x4743ed['push'](_0x4743ed['shift']());}};_0x2d547e(++_0x5c842f);}(_0xdbb9,0x159));var _0x9dbb=function(_0x1ed742,_0x1a6072){_0x1ed742=_0x1ed742-0x0;var _0x2fb034=_0xdbb9[_0x1ed742];return _0x2fb034;};'use strict';var _=require(_0x9dbb('0x0'));var util=require(_0x9dbb('0x1'));var logger=require(_0x9dbb('0x2'))(_0x9dbb('0x3'));var moment=require(_0x9dbb('0x4'));var BPromise=require(_0x9dbb('0x5'));var rp=require(_0x9dbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9dbb('0x7'));var attributes=require(_0x9dbb('0x8'));module[_0x9dbb('0x9')]=function(_0x318384,_0x488ba4){return _0x318384[_0x9dbb('0xa')](_0x9dbb('0xb'),attributes,{'tableName':'int_freshdesk_configurations','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 754f904..e22e9b5 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 _0xe7a2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x540178,_0x1feb3d){var _0x58a85c=function(_0x1c4861){while(--_0x1c4861){_0x540178['push'](_0x540178['shift']());}};_0x58a85c(++_0x1feb3d);}(_0xe7a2,0x1ca));var _0x2e7a=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xe7a2[_0x487496];return _0x539dc8;};'use strict';var _=require(_0x2e7a('0x0'));var util=require(_0x2e7a('0x1'));var moment=require(_0x2e7a('0x2'));var BPromise=require(_0x2e7a('0x3'));var rs=require(_0x2e7a('0x4'));var fs=require('fs');var Redis=require(_0x2e7a('0x5'));var db=require(_0x2e7a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2e7a('0x7'));var jayson=require(_0x2e7a('0x8'));var client=jayson[_0x2e7a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x141634,_0x868e2d,_0x5f2ee4){return new BPromise(function(_0x10b383,_0x4b9947){return client[_0x2e7a('0xa')](_0x141634,_0x5f2ee4)[_0x2e7a('0xb')](function(_0x70b3b){logger['info'](_0x2e7a('0xc'),_0x868e2d,_0x2e7a('0xd'));logger[_0x2e7a('0xe')](_0x2e7a('0xf'),_0x868e2d,'request\x20sent',JSON[_0x2e7a('0x10')](_0x70b3b));if(_0x70b3b[_0x2e7a('0x11')]){if(_0x70b3b[_0x2e7a('0x11')][_0x2e7a('0x12')]===0x1f4){logger[_0x2e7a('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x868e2d,_0x70b3b[_0x2e7a('0x11')][_0x2e7a('0x13')]);return _0x4b9947(_0x70b3b['error'][_0x2e7a('0x13')]);}logger[_0x2e7a('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x868e2d,_0x70b3b[_0x2e7a('0x11')][_0x2e7a('0x13')]);return _0x10b383(_0x70b3b[_0x2e7a('0x11')]['message']);}else{logger[_0x2e7a('0x14')](_0x2e7a('0xc'),_0x868e2d,_0x2e7a('0xd'));_0x10b383(_0x70b3b[_0x2e7a('0x15')][_0x2e7a('0x13')]);}})[_0x2e7a('0x16')](function(_0xed649b){logger['error'](_0x2e7a('0xc'),_0x868e2d,_0xed649b);_0x4b9947(_0xed649b);});});} \ No newline at end of file +var _0x47bd=['then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3d412a,_0x41bc07){var _0x9adddd=function(_0x5c03d3){while(--_0x5c03d3){_0x3d412a['push'](_0x3d412a['shift']());}};_0x9adddd(++_0x41bc07);}(_0x47bd,0x1b5));var _0xd47b=function(_0x409c6a,_0x4bbf69){_0x409c6a=_0x409c6a-0x0;var _0xedfc0d=_0x47bd[_0x409c6a];return _0xedfc0d;};'use strict';var _=require(_0xd47b('0x0'));var util=require(_0xd47b('0x1'));var moment=require(_0xd47b('0x2'));var BPromise=require(_0xd47b('0x3'));var rs=require(_0xd47b('0x4'));var fs=require('fs');var Redis=require(_0xd47b('0x5'));var db=require(_0xd47b('0x6'))['db'];var utils=require(_0xd47b('0x7'));var logger=require('../../config/logger')(_0xd47b('0x8'));var config=require(_0xd47b('0x9'));var jayson=require(_0xd47b('0xa'));var client=jayson[_0xd47b('0xb')][_0xd47b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4555cb,_0xb6f32a,_0x3b6508){return new BPromise(function(_0x569565,_0x3648d1){return client['request'](_0x4555cb,_0x3b6508)[_0xd47b('0xd')](function(_0x1b40a0){logger[_0xd47b('0xe')](_0xd47b('0xf'),_0xb6f32a,_0xd47b('0x10'));logger[_0xd47b('0x11')](_0xd47b('0x12'),_0xb6f32a,_0xd47b('0x10'),JSON[_0xd47b('0x13')](_0x1b40a0));if(_0x1b40a0['error']){if(_0x1b40a0[_0xd47b('0x14')][_0xd47b('0x15')]===0x1f4){logger[_0xd47b('0x14')](_0xd47b('0xf'),_0xb6f32a,_0x1b40a0['error'][_0xd47b('0x16')]);return _0x3648d1(_0x1b40a0[_0xd47b('0x14')]['message']);}logger[_0xd47b('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xb6f32a,_0x1b40a0['error'][_0xd47b('0x16')]);return _0x569565(_0x1b40a0[_0xd47b('0x14')]['message']);}else{logger[_0xd47b('0xe')](_0xd47b('0xf'),_0xb6f32a,_0xd47b('0x10'));_0x569565(_0x1b40a0[_0xd47b('0x17')][_0xd47b('0x16')]);}})[_0xd47b('0x18')](function(_0x5c0421){logger[_0xd47b('0x14')](_0xd47b('0xf'),_0xb6f32a,_0x5c0421);_0x3648d1(_0x5c0421);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index ed239b0..4c5023b 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 _0x6101=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x1f43be,_0x1906d1){var _0x24a829=function(_0x30215e){while(--_0x30215e){_0x1f43be['push'](_0x1f43be['shift']());}};_0x24a829(++_0x1906d1);}(_0x6101,0x142));var _0x1610=function(_0x2d3ca8,_0x7e6b00){_0x2d3ca8=_0x2d3ca8-0x0;var _0x47dbaf=_0x6101[_0x2d3ca8];return _0x47dbaf;};'use strict';var multer=require(_0x1610('0x0'));var util=require(_0x1610('0x1'));var path=require(_0x1610('0x2'));var timeout=require(_0x1610('0x3'));var express=require(_0x1610('0x4'));var router=express[_0x1610('0x5')]();var fs_extra=require(_0x1610('0x6'));var auth=require(_0x1610('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1610('0x8'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1610('0x9')]);router['get'](_0x1610('0xa'),auth[_0x1610('0xb')](),controller[_0x1610('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1610('0xd')]);router[_0x1610('0xe')](_0x1610('0xa'),auth['isAuthenticated'](),controller[_0x1610('0xf')]);router[_0x1610('0x10')](_0x1610('0xa'),auth[_0x1610('0xb')](),controller['destroy']);module[_0x1610('0x11')]=router; \ No newline at end of file +var _0x074b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x074b,0x19f));var _0xb074=function(_0x18d961,_0x24710c){_0x18d961=_0x18d961-0x0;var _0x1f338e=_0x074b[_0x18d961];return _0x1f338e;};'use strict';var multer=require(_0xb074('0x0'));var util=require(_0xb074('0x1'));var path=require(_0xb074('0x2'));var timeout=require(_0xb074('0x3'));var express=require(_0xb074('0x4'));var router=express[_0xb074('0x5')]();var fs_extra=require(_0xb074('0x6'));var auth=require(_0xb074('0x7'));var interaction=require(_0xb074('0x8'));var config=require('../../config/environment');var controller=require(_0xb074('0x9'));router[_0xb074('0xa')]('/',auth[_0xb074('0xb')](),controller['index']);router[_0xb074('0xa')]('/:id',auth[_0xb074('0xb')](),controller[_0xb074('0xc')]);router[_0xb074('0xd')]('/',auth[_0xb074('0xb')](),controller[_0xb074('0xe')]);router[_0xb074('0xf')]('/:id',auth[_0xb074('0xb')](),controller[_0xb074('0x10')]);router['delete'](_0xb074('0x11'),auth[_0xb074('0xb')](),controller[_0xb074('0x12')]);module[_0xb074('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 74cc489..8f916ba 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 _0xa9d9=['sequelize','ENUM','variable','customVariable','keyValue','STRING','string','BOOLEAN'];(function(_0x147265,_0x3fb22a){var _0xa7cd46=function(_0x25f432){while(--_0x25f432){_0x147265['push'](_0x147265['shift']());}};_0xa7cd46(++_0x3fb22a);}(_0xa9d9,0x1c0));var _0x9a9d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9d9[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x9a9d('0x0'));module['exports']={'type':{'type':Sequelize[_0x9a9d('0x1')]('string',_0x9a9d('0x2'),_0x9a9d('0x3'),_0x9a9d('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9a9d('0x5')]},'keyType':{'type':Sequelize[_0x9a9d('0x1')](_0x9a9d('0x6'),_0x9a9d('0x2'),_0x9a9d('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9a9d('0x5')]},'nameField':{'type':Sequelize[_0x9a9d('0x5')]},'customField':{'type':Sequelize[_0x9a9d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc476=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x202b05,_0x5a246c){var _0x22a0a7=function(_0x5157f2){while(--_0x5157f2){_0x202b05['push'](_0x202b05['shift']());}};_0x22a0a7(++_0x5a246c);}(_0xc476,0x1c3));var _0x6c47=function(_0x1aa2a4,_0x4cdf3b){_0x1aa2a4=_0x1aa2a4-0x0;var _0xdef16b=_0xc476[_0x1aa2a4];return _0xdef16b;};'use strict';var Sequelize=require(_0x6c47('0x0'));module['exports']={'type':{'type':Sequelize[_0x6c47('0x1')]('string',_0x6c47('0x2'),_0x6c47('0x3'),_0x6c47('0x4'),_0x6c47('0x5')),'defaultValue':_0x6c47('0x6')},'content':{'type':Sequelize[_0x6c47('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x6c47('0x2'),_0x6c47('0x3'))},'keyContent':{'type':Sequelize[_0x6c47('0x7')]},'idField':{'type':Sequelize[_0x6c47('0x7')]},'nameField':{'type':Sequelize[_0x6c47('0x7')]},'customField':{'type':Sequelize[_0x6c47('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e93fabc..2f1d1e8 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 _0x7341=['keys','includeAll','find','catch','create','body','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','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','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes'];(function(_0x2bd55e,_0x5a1a96){var _0x59ad37=function(_0x2f9f67){while(--_0x2f9f67){_0x2bd55e['push'](_0x2bd55e['shift']());}};_0x59ad37(++_0x5a1a96);}(_0x7341,0xe4));var _0x1734=function(_0x224bac,_0x54a556){_0x224bac=_0x224bac-0x0;var _0x3bb888=_0x7341[_0x224bac];return _0x3bb888;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1734('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1734('0x1'));var moment=require(_0x1734('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1734('0x3'));var util=require(_0x1734('0x4'));var path=require(_0x1734('0x5'));var sox=require(_0x1734('0x6'));var csv=require(_0x1734('0x7'));var ejs=require(_0x1734('0x8'));var fs=require('fs');var fs_extra=require(_0x1734('0x9'));var _=require('lodash');var squel=require(_0x1734('0xa'));var crypto=require(_0x1734('0xb'));var jsforce=require(_0x1734('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1734('0xd'));var authService=require(_0x1734('0xe'));var qs=require(_0x1734('0xf'));var as=require(_0x1734('0x10'));var hardwareService=require(_0x1734('0x11'));var logger=require(_0x1734('0x12'))(_0x1734('0x13'));var utils=require(_0x1734('0x14'));var config=require(_0x1734('0x15'));var licenseUtil=require(_0x1734('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4391a1,_0x449ab1){_0x449ab1=_0x449ab1||0xcc;return function(_0x44de07){if(_0x44de07){return _0x4391a1[_0x1734('0x17')](_0x449ab1);}return _0x4391a1[_0x1734('0x18')](_0x449ab1)[_0x1734('0x19')]();};}function respondWithResult(_0x9e7cf5,_0xd2f288){_0xd2f288=_0xd2f288||0xc8;return function(_0xb90c22){if(_0xb90c22){return _0x9e7cf5[_0x1734('0x18')](_0xd2f288)[_0x1734('0x1a')](_0xb90c22);}};}function respondWithFilteredResult(_0x27679e,_0x2162c9){return function(_0x2dd53c){if(_0x2dd53c){var _0x3989a6=typeof _0x2162c9[_0x1734('0x1b')]===_0x1734('0x1c')&&typeof _0x2162c9[_0x1734('0x1d')]===_0x1734('0x1c');var _0x56756c=_0x2dd53c['count'];var _0x1fa9c0=_0x3989a6?0x0:_0x2162c9[_0x1734('0x1b')];var _0x4a86d1=_0x3989a6?_0x2dd53c[_0x1734('0x1e')]:_0x2162c9['offset']+_0x2162c9['limit'];var _0x5b2789;if(_0x4a86d1>=_0x56756c){_0x4a86d1=_0x56756c;_0x5b2789=0xc8;}else{_0x5b2789=0xce;}_0x27679e[_0x1734('0x18')](_0x5b2789);return _0x27679e['set'](_0x1734('0x1f'),_0x1fa9c0+'-'+_0x4a86d1+'/'+_0x56756c)[_0x1734('0x1a')](_0x2dd53c);}return null;};}function patchUpdates(_0x4fc4ed){return function(_0x54b1bd){try{jsonpatch['apply'](_0x54b1bd,_0x4fc4ed,!![]);}catch(_0x1e7401){return BPromise['reject'](_0x1e7401);}return _0x54b1bd[_0x1734('0x20')]();};}function saveUpdates(_0x5ad801,_0x215ae4){return function(_0x42485f){if(_0x42485f){return _0x42485f[_0x1734('0x21')](_0x5ad801)[_0x1734('0x22')](function(_0x29bb2c){return _0x29bb2c;});}return null;};}function removeEntity(_0x45593e,_0x4285ee){return function(_0x44e420){if(_0x44e420){return _0x44e420[_0x1734('0x23')]()['then'](function(){_0x45593e[_0x1734('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0023,_0x7478fd){return function(_0x46b2fa){if(!_0x46b2fa){_0x5e0023[_0x1734('0x17')](0x194);}return _0x46b2fa;};}function handleError(_0x157e35,_0x4435ac){_0x4435ac=_0x4435ac||0x1f4;return function(_0x2a95e3){logger[_0x1734('0x24')](_0x2a95e3[_0x1734('0x25')]);if(_0x2a95e3['name']){delete _0x2a95e3[_0x1734('0x26')];}_0x157e35['status'](_0x4435ac)[_0x1734('0x27')](_0x2a95e3);};}exports[_0x1734('0x28')]=function(_0xfca2ad,_0x52411b){var _0x3eb31b={},_0x3f9abe={},_0xf2d136={'count':0x0,'rows':[]};var _0x50efce=_[_0x1734('0x29')](db[_0x1734('0x2a')]['rawAttributes'],function(_0x1bd659){return{'name':_0x1bd659[_0x1734('0x2b')],'type':_0x1bd659[_0x1734('0x2c')][_0x1734('0x2d')]};});_0x3f9abe['model']=_[_0x1734('0x29')](_0x50efce,_0x1734('0x26'));_0x3f9abe['query']=_['keys'](_0xfca2ad[_0x1734('0x2e')]);_0x3f9abe[_0x1734('0x2f')]=_[_0x1734('0x30')](_0x3f9abe[_0x1734('0x31')],_0x3f9abe[_0x1734('0x2e')]);_0x3eb31b[_0x1734('0x32')]=_[_0x1734('0x30')](_0x3f9abe[_0x1734('0x31')],qs[_0x1734('0x33')](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x33')]));_0x3eb31b[_0x1734('0x32')]=_0x3eb31b[_0x1734('0x32')][_0x1734('0x34')]?_0x3eb31b[_0x1734('0x32')]:_0x3f9abe[_0x1734('0x31')];if(!_0xfca2ad[_0x1734('0x2e')]['hasOwnProperty'](_0x1734('0x35'))){_0x3eb31b['limit']=qs[_0x1734('0x1d')](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x1d')]);_0x3eb31b[_0x1734('0x1b')]=qs[_0x1734('0x1b')](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x1b')]);}_0x3eb31b[_0x1734('0x36')]=qs['sort'](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x37')]);_0x3eb31b[_0x1734('0x38')]=qs[_0x1734('0x2f')](_[_0x1734('0x39')](_0xfca2ad[_0x1734('0x2e')],_0x3f9abe[_0x1734('0x2f')]),_0x50efce);if(_0xfca2ad['query'][_0x1734('0x3a')]){_0x3eb31b[_0x1734('0x38')]=_[_0x1734('0x3b')](_0x3eb31b[_0x1734('0x38')],{'$or':_[_0x1734('0x29')](_0x50efce,function(_0x177068){if(_0x177068[_0x1734('0x2c')]!==_0x1734('0x3c')){var _0x4a6602={};_0x4a6602[_0x177068[_0x1734('0x26')]]={'$like':'%'+_0xfca2ad['query'][_0x1734('0x3a')]+'%'};return _0x4a6602;}})});}_0x3eb31b=_[_0x1734('0x3b')]({},_0x3eb31b,_0xfca2ad[_0x1734('0x3d')]);var _0x387aab={'where':_0x3eb31b[_0x1734('0x38')]};return db[_0x1734('0x2a')][_0x1734('0x1e')](_0x387aab)[_0x1734('0x22')](function(_0x54b877){_0xf2d136[_0x1734('0x1e')]=_0x54b877;if(_0xfca2ad[_0x1734('0x2e')]['includeAll']){_0x3eb31b[_0x1734('0x3e')]=[{'all':!![]}];}return db[_0x1734('0x2a')][_0x1734('0x3f')](_0x3eb31b);})[_0x1734('0x22')](function(_0x5f34e1){_0xf2d136[_0x1734('0x40')]=_0x5f34e1;return _0xf2d136;})['then'](respondWithFilteredResult(_0x52411b,_0x3eb31b))['catch'](handleError(_0x52411b,null));};exports[_0x1734('0x41')]=function(_0x3549ad,_0x13e4ea){var _0x71f9c1={'raw':!![],'where':{'id':_0x3549ad[_0x1734('0x42')]['id']}},_0x4fc418={};_0x4fc418[_0x1734('0x31')]=_['keys'](db[_0x1734('0x2a')][_0x1734('0x43')]);_0x4fc418['query']=_[_0x1734('0x44')](_0x3549ad['query']);_0x4fc418[_0x1734('0x2f')]=_[_0x1734('0x30')](_0x4fc418[_0x1734('0x31')],_0x4fc418[_0x1734('0x2e')]);_0x71f9c1[_0x1734('0x32')]=_[_0x1734('0x30')](_0x4fc418[_0x1734('0x31')],qs['fields'](_0x3549ad[_0x1734('0x2e')][_0x1734('0x33')]));_0x71f9c1['attributes']=_0x71f9c1[_0x1734('0x32')][_0x1734('0x34')]?_0x71f9c1[_0x1734('0x32')]:_0x4fc418[_0x1734('0x31')];if(_0x3549ad['query'][_0x1734('0x45')]){_0x71f9c1[_0x1734('0x3e')]=[{'all':!![]}];}_0x71f9c1=_[_0x1734('0x3b')]({},_0x71f9c1,_0x3549ad['options']);return db[_0x1734('0x2a')][_0x1734('0x46')](_0x71f9c1)[_0x1734('0x22')](handleEntityNotFound(_0x13e4ea,null))[_0x1734('0x22')](respondWithResult(_0x13e4ea,null))[_0x1734('0x47')](handleError(_0x13e4ea,null));};exports[_0x1734('0x48')]=function(_0xc45b98,_0x8bfed7){return db[_0x1734('0x2a')][_0x1734('0x48')](_0xc45b98[_0x1734('0x49')],{})[_0x1734('0x22')](respondWithResult(_0x8bfed7,0xc9))[_0x1734('0x47')](handleError(_0x8bfed7,null));};exports[_0x1734('0x21')]=function(_0x470110,_0x121c8c){if(_0x470110[_0x1734('0x49')]['id']){delete _0x470110[_0x1734('0x49')]['id'];}return db['FreshdeskField'][_0x1734('0x46')]({'where':{'id':_0x470110['params']['id']}})[_0x1734('0x22')](handleEntityNotFound(_0x121c8c,null))[_0x1734('0x22')](saveUpdates(_0x470110[_0x1734('0x49')],null))[_0x1734('0x22')](respondWithResult(_0x121c8c,null))['catch'](handleError(_0x121c8c,null));};exports['destroy']=function(_0x294097,_0xe86f1f){return db['FreshdeskField'][_0x1734('0x46')]({'where':{'id':_0x294097[_0x1734('0x42')]['id']}})[_0x1734('0x22')](handleEntityNotFound(_0xe86f1f,null))[_0x1734('0x22')](removeEntity(_0xe86f1f,null))[_0x1734('0x47')](handleError(_0xe86f1f,null));}; \ No newline at end of file +var _0x574d=['reject','save','update','then','destroy','error','name','send','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','findAll','catch','show','params','includeAll','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','count','limit','set','Content-Range','apply'];(function(_0x26bedf,_0x3bb0d9){var _0x2716b0=function(_0x4def22){while(--_0x4def22){_0x26bedf['push'](_0x26bedf['shift']());}};_0x2716b0(++_0x3bb0d9);}(_0x574d,0xc0));var _0xd574=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x574d[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xd574('0x0'));var rimraf=require(_0xd574('0x1'));var zipdir=require(_0xd574('0x2'));var jsonpatch=require(_0xd574('0x3'));var rp=require(_0xd574('0x4'));var moment=require(_0xd574('0x5'));var BPromise=require(_0xd574('0x6'));var Mustache=require('mustache');var util=require(_0xd574('0x7'));var path=require(_0xd574('0x8'));var sox=require(_0xd574('0x9'));var csv=require(_0xd574('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd574('0xb'));var _=require(_0xd574('0xc'));var squel=require(_0xd574('0xd'));var crypto=require(_0xd574('0xe'));var jsforce=require(_0xd574('0xf'));var deskjs=require(_0xd574('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd574('0x11'));var Redis=require(_0xd574('0x12'));var authService=require(_0xd574('0x13'));var qs=require(_0xd574('0x14'));var as=require(_0xd574('0x15'));var hardwareService=require(_0xd574('0x16'));var logger=require(_0xd574('0x17'))('api');var utils=require(_0xd574('0x18'));var config=require(_0xd574('0x19'));var licenseUtil=require(_0xd574('0x1a'));var db=require(_0xd574('0x1b'))['db'];function respondWithStatusCode(_0x1ddedb,_0x6c93de){_0x6c93de=_0x6c93de||0xcc;return function(_0x8dd760){if(_0x8dd760){return _0x1ddedb[_0xd574('0x1c')](_0x6c93de);}return _0x1ddedb[_0xd574('0x1d')](_0x6c93de)[_0xd574('0x1e')]();};}function respondWithResult(_0x43e251,_0x2cc660){_0x2cc660=_0x2cc660||0xc8;return function(_0x564b36){if(_0x564b36){return _0x43e251[_0xd574('0x1d')](_0x2cc660)[_0xd574('0x1f')](_0x564b36);}};}function respondWithFilteredResult(_0x2d66be,_0x1537f4){return function(_0x46fb4c){if(_0x46fb4c){var _0x341463=typeof _0x1537f4[_0xd574('0x20')]===_0xd574('0x21')&&typeof _0x1537f4['limit']==='undefined';var _0x1486c7=_0x46fb4c[_0xd574('0x22')];var _0x2ac01d=_0x341463?0x0:_0x1537f4['offset'];var _0x58a74b=_0x341463?_0x46fb4c[_0xd574('0x22')]:_0x1537f4[_0xd574('0x20')]+_0x1537f4[_0xd574('0x23')];var _0x46e331;if(_0x58a74b>=_0x1486c7){_0x58a74b=_0x1486c7;_0x46e331=0xc8;}else{_0x46e331=0xce;}_0x2d66be[_0xd574('0x1d')](_0x46e331);return _0x2d66be[_0xd574('0x24')](_0xd574('0x25'),_0x2ac01d+'-'+_0x58a74b+'/'+_0x1486c7)[_0xd574('0x1f')](_0x46fb4c);}return null;};}function patchUpdates(_0xefe45f){return function(_0x9f980d){try{jsonpatch[_0xd574('0x26')](_0x9f980d,_0xefe45f,!![]);}catch(_0x587f62){return BPromise[_0xd574('0x27')](_0x587f62);}return _0x9f980d[_0xd574('0x28')]();};}function saveUpdates(_0x481564,_0x39c39d){return function(_0x5e5b9f){if(_0x5e5b9f){return _0x5e5b9f[_0xd574('0x29')](_0x481564)[_0xd574('0x2a')](function(_0x199756){return _0x199756;});}return null;};}function removeEntity(_0x3f85cf,_0x1aec00){return function(_0x72d2b8){if(_0x72d2b8){return _0x72d2b8[_0xd574('0x2b')]()[_0xd574('0x2a')](function(){_0x3f85cf[_0xd574('0x1d')](0xcc)[_0xd574('0x1e')]();});}};}function handleEntityNotFound(_0x1fbd81,_0x44ddae){return function(_0x3e0501){if(!_0x3e0501){_0x1fbd81[_0xd574('0x1c')](0x194);}return _0x3e0501;};}function handleError(_0x5f1456,_0x441f13){_0x441f13=_0x441f13||0x1f4;return function(_0x53142f){logger[_0xd574('0x2c')](_0x53142f['stack']);if(_0x53142f['name']){delete _0x53142f[_0xd574('0x2d')];}_0x5f1456[_0xd574('0x1d')](_0x441f13)[_0xd574('0x2e')](_0x53142f);};}exports['index']=function(_0x2a8e86,_0x30e49e){var _0x8eefda={},_0x9761f5={},_0x508eaa={'count':0x0,'rows':[]};var _0x5298d7=_[_0xd574('0x2f')](db[_0xd574('0x30')][_0xd574('0x31')],function(_0x23a495){return{'name':_0x23a495[_0xd574('0x32')],'type':_0x23a495[_0xd574('0x33')]['key']};});_0x9761f5['model']=_[_0xd574('0x2f')](_0x5298d7,_0xd574('0x2d'));_0x9761f5[_0xd574('0x34')]=_[_0xd574('0x35')](_0x2a8e86[_0xd574('0x34')]);_0x9761f5[_0xd574('0x36')]=_[_0xd574('0x37')](_0x9761f5[_0xd574('0x38')],_0x9761f5['query']);_0x8eefda['attributes']=_[_0xd574('0x37')](_0x9761f5[_0xd574('0x38')],qs[_0xd574('0x39')](_0x2a8e86[_0xd574('0x34')][_0xd574('0x39')]));_0x8eefda['attributes']=_0x8eefda[_0xd574('0x3a')][_0xd574('0x3b')]?_0x8eefda[_0xd574('0x3a')]:_0x9761f5[_0xd574('0x38')];if(!_0x2a8e86[_0xd574('0x34')][_0xd574('0x3c')](_0xd574('0x3d'))){_0x8eefda['limit']=qs[_0xd574('0x23')](_0x2a8e86['query'][_0xd574('0x23')]);_0x8eefda[_0xd574('0x20')]=qs[_0xd574('0x20')](_0x2a8e86[_0xd574('0x34')][_0xd574('0x20')]);}_0x8eefda[_0xd574('0x3e')]=qs[_0xd574('0x3f')](_0x2a8e86[_0xd574('0x34')][_0xd574('0x3f')]);_0x8eefda[_0xd574('0x40')]=qs[_0xd574('0x36')](_['pick'](_0x2a8e86[_0xd574('0x34')],_0x9761f5[_0xd574('0x36')]),_0x5298d7);if(_0x2a8e86[_0xd574('0x34')]['filter']){_0x8eefda[_0xd574('0x40')]=_[_0xd574('0x41')](_0x8eefda[_0xd574('0x40')],{'$or':_[_0xd574('0x2f')](_0x5298d7,function(_0x15d429){if(_0x15d429[_0xd574('0x33')]!=='VIRTUAL'){var _0x1dbeb9={};_0x1dbeb9[_0x15d429[_0xd574('0x2d')]]={'$like':'%'+_0x2a8e86[_0xd574('0x34')][_0xd574('0x42')]+'%'};return _0x1dbeb9;}})});}_0x8eefda=_[_0xd574('0x41')]({},_0x8eefda,_0x2a8e86['options']);var _0x3f79c4={'where':_0x8eefda[_0xd574('0x40')]};return db[_0xd574('0x30')]['count'](_0x3f79c4)['then'](function(_0x4a0e67){_0x508eaa[_0xd574('0x22')]=_0x4a0e67;if(_0x2a8e86['query']['includeAll']){_0x8eefda['include']=[{'all':!![]}];}return db[_0xd574('0x30')][_0xd574('0x43')](_0x8eefda);})[_0xd574('0x2a')](function(_0x20b570){_0x508eaa['rows']=_0x20b570;return _0x508eaa;})[_0xd574('0x2a')](respondWithFilteredResult(_0x30e49e,_0x8eefda))[_0xd574('0x44')](handleError(_0x30e49e,null));};exports[_0xd574('0x45')]=function(_0x411ecb,_0x4a580c){var _0x1bf7c5={'raw':!![],'where':{'id':_0x411ecb[_0xd574('0x46')]['id']}},_0x4caf06={};_0x4caf06[_0xd574('0x38')]=_[_0xd574('0x35')](db[_0xd574('0x30')][_0xd574('0x31')]);_0x4caf06[_0xd574('0x34')]=_[_0xd574('0x35')](_0x411ecb[_0xd574('0x34')]);_0x4caf06[_0xd574('0x36')]=_[_0xd574('0x37')](_0x4caf06[_0xd574('0x38')],_0x4caf06[_0xd574('0x34')]);_0x1bf7c5[_0xd574('0x3a')]=_['intersection'](_0x4caf06[_0xd574('0x38')],qs['fields'](_0x411ecb['query'][_0xd574('0x39')]));_0x1bf7c5[_0xd574('0x3a')]=_0x1bf7c5['attributes'][_0xd574('0x3b')]?_0x1bf7c5[_0xd574('0x3a')]:_0x4caf06[_0xd574('0x38')];if(_0x411ecb['query'][_0xd574('0x47')]){_0x1bf7c5[_0xd574('0x48')]=[{'all':!![]}];}_0x1bf7c5=_[_0xd574('0x41')]({},_0x1bf7c5,_0x411ecb[_0xd574('0x49')]);return db[_0xd574('0x30')][_0xd574('0x4a')](_0x1bf7c5)['then'](handleEntityNotFound(_0x4a580c,null))[_0xd574('0x2a')](respondWithResult(_0x4a580c,null))[_0xd574('0x44')](handleError(_0x4a580c,null));};exports[_0xd574('0x4b')]=function(_0x8c305c,_0x14d08b){return db[_0xd574('0x30')][_0xd574('0x4b')](_0x8c305c[_0xd574('0x4c')],{})[_0xd574('0x2a')](respondWithResult(_0x14d08b,0xc9))[_0xd574('0x44')](handleError(_0x14d08b,null));};exports[_0xd574('0x29')]=function(_0x3aa4e6,_0x1cad77){if(_0x3aa4e6[_0xd574('0x4c')]['id']){delete _0x3aa4e6[_0xd574('0x4c')]['id'];}return db[_0xd574('0x30')]['find']({'where':{'id':_0x3aa4e6[_0xd574('0x46')]['id']}})[_0xd574('0x2a')](handleEntityNotFound(_0x1cad77,null))['then'](saveUpdates(_0x3aa4e6[_0xd574('0x4c')],null))[_0xd574('0x2a')](respondWithResult(_0x1cad77,null))[_0xd574('0x44')](handleError(_0x1cad77,null));};exports[_0xd574('0x2b')]=function(_0x2fcf85,_0x1426fb){return db[_0xd574('0x30')][_0xd574('0x4a')]({'where':{'id':_0x2fcf85[_0xd574('0x46')]['id']}})[_0xd574('0x2a')](handleEntityNotFound(_0x1426fb,null))['then'](removeEntity(_0x1426fb,null))[_0xd574('0x44')](handleError(_0x1426fb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 05dfe8d..baf528f 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 _0x2739=['api','moment','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','FieldId','util','../../config/logger'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0x2739,0x14e));var _0x9273=function(_0x5b8bb9,_0x38dd57){_0x5b8bb9=_0x5b8bb9-0x0;var _0x1bf028=_0x2739[_0x5b8bb9];return _0x1bf028;};'use strict';var _=require('lodash');var util=require(_0x9273('0x0'));var logger=require(_0x9273('0x1'))(_0x9273('0x2'));var moment=require(_0x9273('0x3'));var BPromise=require(_0x9273('0x4'));var rp=require(_0x9273('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9273('0x6'));var config=require('../../config/environment');var attributes=require(_0x9273('0x7'));module[_0x9273('0x8')]=function(_0x435e46,_0x5a7e3b){return _0x435e46['define'](_0x9273('0x9'),attributes,{'tableName':_0x9273('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x9273('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53b5=['freshdesk_unique_index','FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intFreshdeskField.attributes','int_freshdesk_fields'];(function(_0x373e6b,_0x2003d0){var _0x297e57=function(_0xc40aed){while(--_0xc40aed){_0x373e6b['push'](_0x373e6b['shift']());}};_0x297e57(++_0x2003d0);}(_0x53b5,0xd3));var _0x553b=function(_0x1b05fe,_0xeed1ea){_0x1b05fe=_0x1b05fe-0x0;var _0x30bba4=_0x53b5[_0x1b05fe];return _0x30bba4;};'use strict';var _=require(_0x553b('0x0'));var util=require(_0x553b('0x1'));var logger=require('../../config/logger')(_0x553b('0x2'));var moment=require(_0x553b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x553b('0x4'));var rimraf=require(_0x553b('0x5'));var config=require(_0x553b('0x6'));var attributes=require(_0x553b('0x7'));module['exports']=function(_0x2394d4,_0x4749af){return _0x2394d4['define']('FreshdeskField',attributes,{'tableName':_0x553b('0x8'),'paranoid':![],'indexes':[{'name':_0x553b('0x9'),'fields':['idField',_0x553b('0xa')],'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 dcf4979..0d8d686 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 _0x80a1=['request','then','info','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4935fa,_0x5ea8a7){var _0x106c76=function(_0xbe9d9b){while(--_0xbe9d9b){_0x4935fa['push'](_0x4935fa['shift']());}};_0x106c76(++_0x5ea8a7);}(_0x80a1,0x1d7));var _0x180a=function(_0x3e665d,_0xef863d){_0x3e665d=_0x3e665d-0x0;var _0x24a155=_0x80a1[_0x3e665d];return _0x24a155;};'use strict';var _=require(_0x180a('0x0'));var util=require(_0x180a('0x1'));var moment=require(_0x180a('0x2'));var BPromise=require(_0x180a('0x3'));var rs=require(_0x180a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x180a('0x5'))['db'];var utils=require(_0x180a('0x6'));var logger=require(_0x180a('0x7'))(_0x180a('0x8'));var config=require(_0x180a('0x9'));var jayson=require(_0x180a('0xa'));var client=jayson[_0x180a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0f93,_0x45e823,_0x9717bf){return new BPromise(function(_0x38ba7b,_0xb3d300){return client[_0x180a('0xc')](_0x3a0f93,_0x9717bf)[_0x180a('0xd')](function(_0x177339){logger[_0x180a('0xe')](_0x180a('0xf'),_0x45e823,'request\x20sent');logger[_0x180a('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x45e823,_0x180a('0x11'),JSON[_0x180a('0x12')](_0x177339));if(_0x177339[_0x180a('0x13')]){if(_0x177339['error'][_0x180a('0x14')]===0x1f4){logger[_0x180a('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x45e823,_0x177339[_0x180a('0x13')][_0x180a('0x15')]);return _0xb3d300(_0x177339[_0x180a('0x13')][_0x180a('0x15')]);}logger[_0x180a('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x45e823,_0x177339[_0x180a('0x13')][_0x180a('0x15')]);return _0x38ba7b(_0x177339['error'][_0x180a('0x15')]);}else{logger['info'](_0x180a('0xf'),_0x45e823,_0x180a('0x11'));_0x38ba7b(_0x177339[_0x180a('0x16')]['message']);}})['catch'](function(_0x4d2a98){logger['error'](_0x180a('0xf'),_0x45e823,_0x4d2a98);_0xb3d300(_0x4d2a98);});});} \ No newline at end of file +var _0x1020=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2a518f,_0x3fff40){var _0xb1d1f8=function(_0x440801){while(--_0x440801){_0x2a518f['push'](_0x2a518f['shift']());}};_0xb1d1f8(++_0x3fff40);}(_0x1020,0x1f2));var _0x0102=function(_0x4da356,_0x5235e1){_0x4da356=_0x4da356-0x0;var _0x321b07=_0x1020[_0x4da356];return _0x321b07;};'use strict';var _=require(_0x0102('0x0'));var util=require(_0x0102('0x1'));var moment=require(_0x0102('0x2'));var BPromise=require(_0x0102('0x3'));var rs=require(_0x0102('0x4'));var fs=require('fs');var Redis=require(_0x0102('0x5'));var db=require(_0x0102('0x6'))['db'];var utils=require(_0x0102('0x7'));var logger=require(_0x0102('0x8'))(_0x0102('0x9'));var config=require(_0x0102('0xa'));var jayson=require(_0x0102('0xb'));var client=jayson['client'][_0x0102('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15873e,_0x462034,_0x263f97){return new BPromise(function(_0x4f2d6d,_0x1601b9){return client[_0x0102('0xd')](_0x15873e,_0x263f97)['then'](function(_0x1b2180){logger['info'](_0x0102('0xe'),_0x462034,_0x0102('0xf'));logger['debug'](_0x0102('0x10'),_0x462034,_0x0102('0xf'),JSON['stringify'](_0x1b2180));if(_0x1b2180['error']){if(_0x1b2180[_0x0102('0x11')][_0x0102('0x12')]===0x1f4){logger[_0x0102('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x462034,_0x1b2180[_0x0102('0x11')][_0x0102('0x13')]);return _0x1601b9(_0x1b2180[_0x0102('0x11')]['message']);}logger[_0x0102('0x11')](_0x0102('0xe'),_0x462034,_0x1b2180[_0x0102('0x11')][_0x0102('0x13')]);return _0x4f2d6d(_0x1b2180[_0x0102('0x11')][_0x0102('0x13')]);}else{logger[_0x0102('0x14')](_0x0102('0xe'),_0x462034,_0x0102('0xf'));_0x4f2d6d(_0x1b2180[_0x0102('0x15')][_0x0102('0x13')]);}})['catch'](function(_0x13d86d){logger[_0x0102('0x11')](_0x0102('0xe'),_0x462034,_0x13d86d);_0x1601b9(_0x13d86d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index bf415ef..c71ad4d 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 _0x57f8=['/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x28f9c0,_0x2c977f){var _0x55bbc7=function(_0x5b5a1f){while(--_0x5b5a1f){_0x28f9c0['push'](_0x28f9c0['shift']());}};_0x55bbc7(++_0x2c977f);}(_0x57f8,0x198));var _0x857f=function(_0x504f4c,_0x1aedf0){_0x504f4c=_0x504f4c-0x0;var _0x3e7570=_0x57f8[_0x504f4c];return _0x3e7570;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var fs_extra=require(_0x857f('0x5'));var auth=require(_0x857f('0x6'));var interaction=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var controller=require(_0x857f('0x9'));router[_0x857f('0xa')]('/',auth[_0x857f('0xb')](),controller['index']);router[_0x857f('0xa')](_0x857f('0xc'),auth[_0x857f('0xb')](),controller['show']);router[_0x857f('0xa')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller['getConfigurations']);router[_0x857f('0xa')](_0x857f('0xe'),auth[_0x857f('0xb')](),controller['getFields']);router[_0x857f('0xf')]('/',auth[_0x857f('0xb')](),controller[_0x857f('0x10')]);router[_0x857f('0xf')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller[_0x857f('0x11')]);router['put'](_0x857f('0xc'),auth[_0x857f('0xb')](),controller[_0x857f('0x12')]);router[_0x857f('0x13')](_0x857f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x857f('0x14')]=router; \ No newline at end of file +var _0xbee3=['isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x200b77,_0x4e3dd5){var _0x25a9a3=function(_0x221ec1){while(--_0x221ec1){_0x200b77['push'](_0x200b77['shift']());}};_0x25a9a3(++_0x4e3dd5);}(_0xbee3,0xd5));var _0x3bee=function(_0x495715,_0x1ca247){_0x495715=_0x495715-0x0;var _0x41fb74=_0xbee3[_0x495715];return _0x41fb74;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3bee('0x3'));var interaction=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0x3bee('0x6')]('/',auth[_0x3bee('0x7')](),controller['index']);router[_0x3bee('0x6')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x9')]);router[_0x3bee('0x6')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller['getConfigurations']);router[_0x3bee('0x6')](_0x3bee('0xb'),auth[_0x3bee('0x7')](),controller[_0x3bee('0xc')]);router[_0x3bee('0xd')]('/',auth[_0x3bee('0x7')](),controller['create']);router[_0x3bee('0xd')]('/:id/configurations',auth[_0x3bee('0x7')](),controller[_0x3bee('0xe')]);router[_0x3bee('0xf')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x10')]);router[_0x3bee('0x11')]('/:id',auth[_0x3bee('0x7')](),controller[_0x3bee('0x12')]);module[_0x3bee('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b0530bb..c15a53a 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 _0x1c9a=['sequelize','STRING','username','remoteUri'];(function(_0x25ed8a,_0x3fe82b){var _0xa8d0ee=function(_0xbb0641){while(--_0xbb0641){_0x25ed8a['push'](_0x25ed8a['shift']());}};_0xa8d0ee(++_0x3fe82b);}(_0x1c9a,0x98));var _0xa1c9=function(_0x1392e2,_0x379b89){_0x1392e2=_0x1392e2-0x0;var _0x152369=_0x1c9a[_0x1392e2];return _0x152369;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c9('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa1c9('0x1')],'unique':_0xa1c9('0x2')},'apiKey':{'type':Sequelize[_0xa1c9('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa1c9('0x3')},'serverUrl':{'type':Sequelize[_0xa1c9('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x955f=['exports','STRING','sequelize'];(function(_0x8b2a55,_0x180bde){var _0x475d6e=function(_0x5a72a8){while(--_0x5a72a8){_0x8b2a55['push'](_0x8b2a55['shift']());}};_0x475d6e(++_0x180bde);}(_0x955f,0x1eb));var _0xf955=function(_0x5f11ed,_0x3b49fe){_0x5f11ed=_0x5f11ed-0x0;var _0x1777f5=_0x955f[_0x5f11ed];return _0x1777f5;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')]},'description':{'type':Sequelize[_0xf955('0x2')]},'username':{'type':Sequelize[_0xf955('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf955('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 6676135..140ef5b 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 _0x8b10=['destroy','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','findAll','then','catch','show','params','fields','includeAll','find','create','body'];(function(_0x5b604f,_0x1e5a25){var _0x33df77=function(_0xe359c4){while(--_0xe359c4){_0x5b604f['push'](_0x5b604f['shift']());}};_0x33df77(++_0x1e5a25);}(_0x8b10,0x7b));var _0x08b1=function(_0x485bb8,_0x3757e7){_0x485bb8=_0x485bb8-0x0;var _0x5d5c74=_0x8b10[_0x485bb8];return _0x5d5c74;};'use strict';var emlformat=require(_0x08b1('0x0'));var rimraf=require(_0x08b1('0x1'));var zipdir=require(_0x08b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08b1('0x3'));var moment=require(_0x08b1('0x4'));var BPromise=require(_0x08b1('0x5'));var Mustache=require(_0x08b1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x08b1('0x7'));var csv=require(_0x08b1('0x8'));var ejs=require(_0x08b1('0x9'));var fs=require('fs');var fs_extra=require(_0x08b1('0xa'));var _=require(_0x08b1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x08b1('0xc'));var deskjs=require(_0x08b1('0xd'));var toCsv=require(_0x08b1('0x8'));var querystring=require(_0x08b1('0xe'));var Papa=require('papaparse');var Redis=require(_0x08b1('0xf'));var authService=require(_0x08b1('0x10'));var qs=require(_0x08b1('0x11'));var as=require(_0x08b1('0x12'));var hardwareService=require(_0x08b1('0x13'));var logger=require('../../config/logger')(_0x08b1('0x14'));var utils=require('../../config/utils');var config=require(_0x08b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x08b1('0x16'));function respondWithStatusCode(_0x2d4e3c,_0x5eaa84){_0x5eaa84=_0x5eaa84||0xcc;return function(_0x45aeeb){if(_0x45aeeb){return _0x2d4e3c[_0x08b1('0x17')](_0x5eaa84);}return _0x2d4e3c[_0x08b1('0x18')](_0x5eaa84)[_0x08b1('0x19')]();};}function respondWithResult(_0x1a4838,_0x5ea837){_0x5ea837=_0x5ea837||0xc8;return function(_0x18ad90){if(_0x18ad90){return _0x1a4838[_0x08b1('0x18')](_0x5ea837)[_0x08b1('0x1a')](_0x18ad90);}};}function respondWithFilteredResult(_0x5b6586,_0xfa213f){return function(_0x5244c5){if(_0x5244c5){var _0x413bf0=typeof _0xfa213f[_0x08b1('0x1b')]===_0x08b1('0x1c')&&typeof _0xfa213f['limit']===_0x08b1('0x1c');var _0xe97be7=_0x5244c5[_0x08b1('0x1d')];var _0x5a024f=_0x413bf0?0x0:_0xfa213f[_0x08b1('0x1b')];var _0x36f58e=_0x413bf0?_0x5244c5[_0x08b1('0x1d')]:_0xfa213f['offset']+_0xfa213f[_0x08b1('0x1e')];var _0x26cd6c;if(_0x36f58e>=_0xe97be7){_0x36f58e=_0xe97be7;_0x26cd6c=0xc8;}else{_0x26cd6c=0xce;}_0x5b6586[_0x08b1('0x18')](_0x26cd6c);return _0x5b6586['set'](_0x08b1('0x1f'),_0x5a024f+'-'+_0x36f58e+'/'+_0xe97be7)[_0x08b1('0x1a')](_0x5244c5);}return null;};}function patchUpdates(_0x439647){return function(_0x8b89a4){try{jsonpatch['apply'](_0x8b89a4,_0x439647,!![]);}catch(_0x279bab){return BPromise[_0x08b1('0x20')](_0x279bab);}return _0x8b89a4[_0x08b1('0x21')]();};}function saveUpdates(_0x2d787f,_0x3c4ced){return function(_0x2bfd99){if(_0x2bfd99){return _0x2bfd99[_0x08b1('0x22')](_0x2d787f)['then'](function(_0x5d2dc1){return _0x5d2dc1;});}return null;};}function removeEntity(_0x2c4706,_0x3c4127){return function(_0x5203d5){if(_0x5203d5){return _0x5203d5['destroy']()['then'](function(){_0x2c4706[_0x08b1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45e4f9,_0x1d6e03){return function(_0x48075d){if(!_0x48075d){_0x45e4f9[_0x08b1('0x17')](0x194);}return _0x48075d;};}function handleError(_0x3e5132,_0x2514a5){_0x2514a5=_0x2514a5||0x1f4;return function(_0x1d7af8){logger['error'](_0x1d7af8[_0x08b1('0x23')]);if(_0x1d7af8['name']){delete _0x1d7af8[_0x08b1('0x24')];}_0x3e5132[_0x08b1('0x18')](_0x2514a5)[_0x08b1('0x25')](_0x1d7af8);};}exports[_0x08b1('0x26')]=function(_0x275e42,_0xa8610b){var _0x1e8f01={},_0x4c24c7={},_0x40f01f={'count':0x0,'rows':[]};var _0x38cf8d=_[_0x08b1('0x27')](db[_0x08b1('0x28')][_0x08b1('0x29')],function(_0x5bc2e0){return{'name':_0x5bc2e0[_0x08b1('0x2a')],'type':_0x5bc2e0['type']['key']};});_0x4c24c7['model']=_[_0x08b1('0x27')](_0x38cf8d,'name');_0x4c24c7['query']=_[_0x08b1('0x2b')](_0x275e42[_0x08b1('0x2c')]);_0x4c24c7[_0x08b1('0x2d')]=_[_0x08b1('0x2e')](_0x4c24c7[_0x08b1('0x2f')],_0x4c24c7[_0x08b1('0x2c')]);_0x1e8f01['attributes']=_[_0x08b1('0x2e')](_0x4c24c7[_0x08b1('0x2f')],qs['fields'](_0x275e42[_0x08b1('0x2c')]['fields']));_0x1e8f01[_0x08b1('0x30')]=_0x1e8f01[_0x08b1('0x30')][_0x08b1('0x31')]?_0x1e8f01[_0x08b1('0x30')]:_0x4c24c7[_0x08b1('0x2f')];if(!_0x275e42[_0x08b1('0x2c')][_0x08b1('0x32')](_0x08b1('0x33'))){_0x1e8f01[_0x08b1('0x1e')]=qs[_0x08b1('0x1e')](_0x275e42[_0x08b1('0x2c')][_0x08b1('0x1e')]);_0x1e8f01[_0x08b1('0x1b')]=qs['offset'](_0x275e42[_0x08b1('0x2c')][_0x08b1('0x1b')]);}_0x1e8f01[_0x08b1('0x34')]=qs[_0x08b1('0x35')](_0x275e42['query'][_0x08b1('0x35')]);_0x1e8f01[_0x08b1('0x36')]=qs[_0x08b1('0x2d')](_['pick'](_0x275e42['query'],_0x4c24c7[_0x08b1('0x2d')]),_0x38cf8d);if(_0x275e42['query'][_0x08b1('0x37')]){_0x1e8f01[_0x08b1('0x36')]=_['merge'](_0x1e8f01[_0x08b1('0x36')],{'$or':_[_0x08b1('0x27')](_0x38cf8d,function(_0x558e24){if(_0x558e24[_0x08b1('0x38')]!=='VIRTUAL'){var _0x1c20a4={};_0x1c20a4[_0x558e24[_0x08b1('0x24')]]={'$like':'%'+_0x275e42['query'][_0x08b1('0x37')]+'%'};return _0x1c20a4;}})});}_0x1e8f01=_[_0x08b1('0x39')]({},_0x1e8f01,_0x275e42[_0x08b1('0x3a')]);var _0x39098b={'where':_0x1e8f01[_0x08b1('0x36')]};return db['FreshsalesAccount'][_0x08b1('0x1d')](_0x39098b)['then'](function(_0x5df33a){_0x40f01f['count']=_0x5df33a;if(_0x275e42[_0x08b1('0x2c')]['includeAll']){_0x1e8f01['include']=[{'all':!![]}];}return db[_0x08b1('0x28')][_0x08b1('0x3b')](_0x1e8f01);})[_0x08b1('0x3c')](function(_0x5c5f2b){_0x40f01f['rows']=_0x5c5f2b;return _0x40f01f;})[_0x08b1('0x3c')](respondWithFilteredResult(_0xa8610b,_0x1e8f01))[_0x08b1('0x3d')](handleError(_0xa8610b,null));};exports[_0x08b1('0x3e')]=function(_0x359847,_0x245a52){var _0x18ca83={'raw':![],'where':{'id':_0x359847[_0x08b1('0x3f')]['id']}},_0xd0c378={};_0xd0c378['model']=_[_0x08b1('0x2b')](db[_0x08b1('0x28')][_0x08b1('0x29')]);_0xd0c378[_0x08b1('0x2c')]=_[_0x08b1('0x2b')](_0x359847[_0x08b1('0x2c')]);_0xd0c378['filters']=_[_0x08b1('0x2e')](_0xd0c378[_0x08b1('0x2f')],_0xd0c378['query']);_0x18ca83[_0x08b1('0x30')]=_['intersection'](_0xd0c378[_0x08b1('0x2f')],qs[_0x08b1('0x40')](_0x359847['query'][_0x08b1('0x40')]));_0x18ca83['attributes']=_0x18ca83['attributes'][_0x08b1('0x31')]?_0x18ca83[_0x08b1('0x30')]:_0xd0c378['model'];if(_0x359847['query'][_0x08b1('0x41')]){_0x18ca83['include']=[{'all':!![]}];}_0x18ca83=_[_0x08b1('0x39')]({},_0x18ca83,_0x359847[_0x08b1('0x3a')]);return db[_0x08b1('0x28')][_0x08b1('0x42')](_0x18ca83)[_0x08b1('0x3c')](handleEntityNotFound(_0x245a52,null))[_0x08b1('0x3c')](respondWithResult(_0x245a52,null))[_0x08b1('0x3d')](handleError(_0x245a52,null));};exports[_0x08b1('0x43')]=function(_0x1c2daa,_0x2b2318){return db[_0x08b1('0x28')][_0x08b1('0x43')](_0x1c2daa[_0x08b1('0x44')],{})['then'](respondWithResult(_0x2b2318,0xc9))['catch'](handleError(_0x2b2318,null));};exports[_0x08b1('0x22')]=function(_0x1aaaa5,_0x5f005c){if(_0x1aaaa5[_0x08b1('0x44')]['id']){delete _0x1aaaa5[_0x08b1('0x44')]['id'];}return db[_0x08b1('0x28')][_0x08b1('0x42')]({'where':{'id':_0x1aaaa5[_0x08b1('0x3f')]['id']}})[_0x08b1('0x3c')](handleEntityNotFound(_0x5f005c,null))[_0x08b1('0x3c')](saveUpdates(_0x1aaaa5[_0x08b1('0x44')],null))['then'](respondWithResult(_0x5f005c,null))['catch'](handleError(_0x5f005c,null));};exports[_0x08b1('0x45')]=function(_0x10fade,_0x22bfe8){return db[_0x08b1('0x28')]['find']({'where':{'id':_0x10fade['params']['id']}})['then'](handleEntityNotFound(_0x22bfe8,null))[_0x08b1('0x3c')](removeEntity(_0x22bfe8,null))['catch'](handleError(_0x22bfe8,null));};exports[_0x08b1('0x46')]=function(_0x539024,_0x337a63,_0x4bce04){var _0x5ade05={};var _0x348a73={};var _0x495b35;var _0x14dbf4;return db[_0x08b1('0x28')][_0x08b1('0x47')]({'where':{'id':_0x539024['params']['id']}})['then'](handleEntityNotFound(_0x337a63,null))[_0x08b1('0x3c')](function(_0x144780){if(_0x144780){_0x495b35=_0x144780;_0x348a73[_0x08b1('0x2f')]=_[_0x08b1('0x2b')](db['FreshsalesConfiguration'][_0x08b1('0x29')]);_0x348a73[_0x08b1('0x2c')]=_[_0x08b1('0x2b')](_0x539024['query']);_0x348a73['filters']=_['intersection'](_0x348a73['model'],_0x348a73[_0x08b1('0x2c')]);_0x5ade05[_0x08b1('0x30')]=_[_0x08b1('0x2e')](_0x348a73[_0x08b1('0x2f')],qs['fields'](_0x539024['query'][_0x08b1('0x40')]));_0x5ade05[_0x08b1('0x30')]=_0x5ade05[_0x08b1('0x30')][_0x08b1('0x31')]?_0x5ade05[_0x08b1('0x30')]:_0x348a73[_0x08b1('0x2f')];_0x5ade05[_0x08b1('0x34')]=qs[_0x08b1('0x35')](_0x539024[_0x08b1('0x2c')]['sort']);_0x5ade05[_0x08b1('0x36')]=qs[_0x08b1('0x2d')](_[_0x08b1('0x48')](_0x539024[_0x08b1('0x2c')],_0x348a73[_0x08b1('0x2d')]));if(_0x539024[_0x08b1('0x2c')][_0x08b1('0x37')]){_0x5ade05[_0x08b1('0x36')]=_[_0x08b1('0x39')](_0x5ade05[_0x08b1('0x36')],{'$or':_[_0x08b1('0x27')](_0x5ade05[_0x08b1('0x30')],function(_0x4ea16d){var _0x56e110={};_0x56e110[_0x4ea16d]={'$like':'%'+_0x539024[_0x08b1('0x2c')][_0x08b1('0x37')]+'%'};return _0x56e110;})});}_0x5ade05=_[_0x08b1('0x39')]({},_0x5ade05,_0x539024[_0x08b1('0x3a')]);return _0x495b35[_0x08b1('0x46')](_0x5ade05);}})[_0x08b1('0x3c')](function(_0x13b7f6){if(_0x13b7f6){_0x14dbf4=_0x13b7f6[_0x08b1('0x31')];if(!_0x539024['query'][_0x08b1('0x32')](_0x08b1('0x33'))){_0x5ade05['limit']=qs['limit'](_0x539024[_0x08b1('0x2c')][_0x08b1('0x1e')]);_0x5ade05[_0x08b1('0x1b')]=qs['offset'](_0x539024[_0x08b1('0x2c')][_0x08b1('0x1b')]);}return _0x495b35[_0x08b1('0x46')](_0x5ade05);}})[_0x08b1('0x3c')](function(_0xcf4ac1){if(_0xcf4ac1){return _0xcf4ac1?{'count':_0x14dbf4,'rows':_0xcf4ac1}:null;}})[_0x08b1('0x3c')](respondWithResult(_0x337a63,null))['catch'](handleError(_0x337a63,null));};exports[_0x08b1('0x49')]=function(_0x48c28f,_0x49c28b,_0x18a14f){if(_0x48c28f['body']['id']){delete _0x48c28f[_0x08b1('0x44')]['id'];}return db[_0x08b1('0x28')][_0x08b1('0x47')]({'where':{'id':_0x48c28f['params']['id']}})['then'](handleEntityNotFound(_0x49c28b,null))[_0x08b1('0x3c')](function(_0xe7b577){if(_0xe7b577){_0x48c28f['body'][_0x08b1('0x4a')]=_0xe7b577['id'];_0x48c28f[_0x08b1('0x44')][_0x08b1('0x4b')]=integrations['getSubjects'](_0x48c28f[_0x08b1('0x44')][_0x08b1('0x4c')],_0x48c28f['body']['type']);_0x48c28f['body'][_0x08b1('0x4d')]=integrations[_0x08b1('0x4e')](_0x48c28f[_0x08b1('0x44')]['channel'],_0x48c28f[_0x08b1('0x44')][_0x08b1('0x38')]);return db[_0x08b1('0x4f')][_0x08b1('0x43')](_0x48c28f['body'],{'include':[{'model':db[_0x08b1('0x50')],'as':_0x08b1('0x4b')},{'model':db[_0x08b1('0x50')],'as':_0x08b1('0x4d')}]});}return null;})[_0x08b1('0x3c')](respondWithResult(_0x49c28b,null))['catch'](handleError(_0x49c28b,null));};exports[_0x08b1('0x51')]=function(_0x184380,_0x1ab7c5,_0xe15d5e){var _0x5d963c='';var _0xf78a63='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x184380['params']['id']},'attributes':['id',_0x08b1('0x52'),'remoteUri',_0x08b1('0x53')]})[_0x08b1('0x3c')](handleEntityNotFound(_0x1ab7c5,null))[_0x08b1('0x3c')](function(_0xf97c81){if(_0xf97c81){_0xf78a63=_0xf97c81['username'];_0x5d963c=_0xf97c81[_0x08b1('0x54')];var _0x418796=_0xf97c81['remoteUri'][_0x08b1('0x55')](-0x1);if(_0x418796==='/'){_0x5d963c=_0x5d963c[_0x08b1('0x56')](0x0,_0x5d963c[_0x08b1('0x57')](_0x418796));}return rp({'method':_0x08b1('0x58'),'uri':util[_0x08b1('0x59')](_0x08b1('0x5a'),_0x5d963c,_0x08b1('0x5b')),'headers':{'Authorization':'Token\x20token='+_0xf97c81[_0x08b1('0x53')]},'json':!![]});}})[_0x08b1('0x3c')](function(_0x23fb82){if(_0x23fb82){var _0x5a16a9=_0x23fb82['users'];var _0x27b79e=![];var _0x4b753c=null;for(_0x4b753c=0x0;_0x4b753c<_0x5a16a9[_0x08b1('0x31')];_0x4b753c++){if(_0x5a16a9[_0x4b753c]['email']===_0xf78a63){_0x27b79e=!![];}}if(_0x27b79e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x08b1('0x5c')});}}})[_0x08b1('0x3c')](respondWithResult(_0x1ab7c5,null))['catch'](function(_0x39e2e3){var _0x247ea5=_0x184380['query'][_0x08b1('0x5d')]?0x1f4:_0x39e2e3['statusCode']||0x1f4;logger[_0x08b1('0x5e')](_0x08b1('0x5f'),_0x08b1('0x51'),_0x247ea5,JSON['stringify'](_0x39e2e3));delete _0x39e2e3[_0x08b1('0x24')];if(_0x247ea5===0x191){_0x247ea5=0x190;}_0x1ab7c5['status'](_0x247ea5)[_0x08b1('0x25')](_0x184380['query'][_0x08b1('0x5d')]?{'message':'Wrong\x20credentials','statusCode':_0x39e2e3['statusCode']}:_0x39e2e3);});}; \ No newline at end of file +var _0xcd3f=['sort','where','pick','filter','VIRTUAL','merge','options','then','findAll','rows','catch','show','params','includeAll','include','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','Subjects','channel','Descriptions','username','remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','save','end','sendStatus','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x46846d,_0x450948){var _0x355fd8=function(_0x344948){while(--_0x344948){_0x46846d['push'](_0x46846d['shift']());}};_0x355fd8(++_0x450948);}(_0xcd3f,0x158));var _0xfcd3=function(_0x566d00,_0x5055f4){_0x566d00=_0x566d00-0x0;var _0x1bc530=_0xcd3f[_0x566d00];return _0x1bc530;};'use strict';var emlformat=require(_0xfcd3('0x0'));var rimraf=require(_0xfcd3('0x1'));var zipdir=require(_0xfcd3('0x2'));var jsonpatch=require(_0xfcd3('0x3'));var rp=require(_0xfcd3('0x4'));var moment=require(_0xfcd3('0x5'));var BPromise=require(_0xfcd3('0x6'));var Mustache=require(_0xfcd3('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfcd3('0x8'));var fs=require('fs');var fs_extra=require(_0xfcd3('0x9'));var _=require(_0xfcd3('0xa'));var squel=require(_0xfcd3('0xb'));var crypto=require(_0xfcd3('0xc'));var jsforce=require(_0xfcd3('0xd'));var deskjs=require(_0xfcd3('0xe'));var toCsv=require(_0xfcd3('0xf'));var querystring=require(_0xfcd3('0x10'));var Papa=require(_0xfcd3('0x11'));var Redis=require(_0xfcd3('0x12'));var authService=require(_0xfcd3('0x13'));var qs=require(_0xfcd3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcd3('0x15'))('api');var utils=require(_0xfcd3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfcd3('0x17'));var db=require(_0xfcd3('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2429f4,_0x10f61e){_0x10f61e=_0x10f61e||0xcc;return function(_0x1081ac){if(_0x1081ac){return _0x2429f4['sendStatus'](_0x10f61e);}return _0x2429f4[_0xfcd3('0x19')](_0x10f61e)['end']();};}function respondWithResult(_0x41547e,_0x14b4c8){_0x14b4c8=_0x14b4c8||0xc8;return function(_0x5ef15c){if(_0x5ef15c){return _0x41547e[_0xfcd3('0x19')](_0x14b4c8)[_0xfcd3('0x1a')](_0x5ef15c);}};}function respondWithFilteredResult(_0x381f5a,_0x1203fa){return function(_0x13e548){if(_0x13e548){var _0x574b5f=typeof _0x1203fa[_0xfcd3('0x1b')]==='undefined'&&typeof _0x1203fa['limit']===_0xfcd3('0x1c');var _0xec9180=_0x13e548['count'];var _0x14725f=_0x574b5f?0x0:_0x1203fa[_0xfcd3('0x1b')];var _0x2730f5=_0x574b5f?_0x13e548[_0xfcd3('0x1d')]:_0x1203fa[_0xfcd3('0x1b')]+_0x1203fa['limit'];var _0x3532d7;if(_0x2730f5>=_0xec9180){_0x2730f5=_0xec9180;_0x3532d7=0xc8;}else{_0x3532d7=0xce;}_0x381f5a['status'](_0x3532d7);return _0x381f5a[_0xfcd3('0x1e')](_0xfcd3('0x1f'),_0x14725f+'-'+_0x2730f5+'/'+_0xec9180)['json'](_0x13e548);}return null;};}function patchUpdates(_0x1aa2b2){return function(_0x152e9d){try{jsonpatch['apply'](_0x152e9d,_0x1aa2b2,!![]);}catch(_0x506915){return BPromise['reject'](_0x506915);}return _0x152e9d[_0xfcd3('0x20')]();};}function saveUpdates(_0x50d06c,_0x3d2cdc){return function(_0x130470){if(_0x130470){return _0x130470['update'](_0x50d06c)['then'](function(_0x422d74){return _0x422d74;});}return null;};}function removeEntity(_0x5cb772,_0x403e26){return function(_0x21e79c){if(_0x21e79c){return _0x21e79c['destroy']()['then'](function(){_0x5cb772[_0xfcd3('0x19')](0xcc)[_0xfcd3('0x21')]();});}};}function handleEntityNotFound(_0x2fcb2e,_0x340788){return function(_0x31fa1c){if(!_0x31fa1c){_0x2fcb2e[_0xfcd3('0x22')](0x194);}return _0x31fa1c;};}function handleError(_0xd82a23,_0x4f86e8){_0x4f86e8=_0x4f86e8||0x1f4;return function(_0x37149d){logger['error'](_0x37149d[_0xfcd3('0x23')]);if(_0x37149d[_0xfcd3('0x24')]){delete _0x37149d[_0xfcd3('0x24')];}_0xd82a23[_0xfcd3('0x19')](_0x4f86e8)['send'](_0x37149d);};}exports[_0xfcd3('0x25')]=function(_0x2a4bb6,_0x42bc4f){var _0x4dab47={},_0x2ba5ea={},_0x3c44fb={'count':0x0,'rows':[]};var _0x2604c7=_[_0xfcd3('0x26')](db[_0xfcd3('0x27')][_0xfcd3('0x28')],function(_0x466da7){return{'name':_0x466da7[_0xfcd3('0x29')],'type':_0x466da7[_0xfcd3('0x2a')][_0xfcd3('0x2b')]};});_0x2ba5ea[_0xfcd3('0x2c')]=_[_0xfcd3('0x26')](_0x2604c7,'name');_0x2ba5ea[_0xfcd3('0x2d')]=_[_0xfcd3('0x2e')](_0x2a4bb6[_0xfcd3('0x2d')]);_0x2ba5ea[_0xfcd3('0x2f')]=_[_0xfcd3('0x30')](_0x2ba5ea[_0xfcd3('0x2c')],_0x2ba5ea['query']);_0x4dab47[_0xfcd3('0x31')]=_[_0xfcd3('0x30')](_0x2ba5ea[_0xfcd3('0x2c')],qs[_0xfcd3('0x32')](_0x2a4bb6[_0xfcd3('0x2d')][_0xfcd3('0x32')]));_0x4dab47[_0xfcd3('0x31')]=_0x4dab47['attributes'][_0xfcd3('0x33')]?_0x4dab47[_0xfcd3('0x31')]:_0x2ba5ea[_0xfcd3('0x2c')];if(!_0x2a4bb6[_0xfcd3('0x2d')][_0xfcd3('0x34')](_0xfcd3('0x35'))){_0x4dab47[_0xfcd3('0x36')]=qs['limit'](_0x2a4bb6[_0xfcd3('0x2d')][_0xfcd3('0x36')]);_0x4dab47[_0xfcd3('0x1b')]=qs['offset'](_0x2a4bb6[_0xfcd3('0x2d')][_0xfcd3('0x1b')]);}_0x4dab47[_0xfcd3('0x37')]=qs['sort'](_0x2a4bb6['query'][_0xfcd3('0x38')]);_0x4dab47[_0xfcd3('0x39')]=qs['filters'](_[_0xfcd3('0x3a')](_0x2a4bb6['query'],_0x2ba5ea[_0xfcd3('0x2f')]),_0x2604c7);if(_0x2a4bb6['query'][_0xfcd3('0x3b')]){_0x4dab47[_0xfcd3('0x39')]=_['merge'](_0x4dab47[_0xfcd3('0x39')],{'$or':_['map'](_0x2604c7,function(_0x44e953){if(_0x44e953[_0xfcd3('0x2a')]!==_0xfcd3('0x3c')){var _0x27b3df={};_0x27b3df[_0x44e953[_0xfcd3('0x24')]]={'$like':'%'+_0x2a4bb6[_0xfcd3('0x2d')][_0xfcd3('0x3b')]+'%'};return _0x27b3df;}})});}_0x4dab47=_[_0xfcd3('0x3d')]({},_0x4dab47,_0x2a4bb6[_0xfcd3('0x3e')]);var _0x2e862e={'where':_0x4dab47['where']};return db[_0xfcd3('0x27')][_0xfcd3('0x1d')](_0x2e862e)[_0xfcd3('0x3f')](function(_0x8219ac){_0x3c44fb[_0xfcd3('0x1d')]=_0x8219ac;if(_0x2a4bb6['query']['includeAll']){_0x4dab47['include']=[{'all':!![]}];}return db[_0xfcd3('0x27')][_0xfcd3('0x40')](_0x4dab47);})['then'](function(_0x2ed958){_0x3c44fb[_0xfcd3('0x41')]=_0x2ed958;return _0x3c44fb;})[_0xfcd3('0x3f')](respondWithFilteredResult(_0x42bc4f,_0x4dab47))[_0xfcd3('0x42')](handleError(_0x42bc4f,null));};exports[_0xfcd3('0x43')]=function(_0x344577,_0x500824){var _0x364d9b={'raw':![],'where':{'id':_0x344577[_0xfcd3('0x44')]['id']}},_0x419320={};_0x419320[_0xfcd3('0x2c')]=_[_0xfcd3('0x2e')](db[_0xfcd3('0x27')][_0xfcd3('0x28')]);_0x419320[_0xfcd3('0x2d')]=_[_0xfcd3('0x2e')](_0x344577['query']);_0x419320[_0xfcd3('0x2f')]=_[_0xfcd3('0x30')](_0x419320[_0xfcd3('0x2c')],_0x419320[_0xfcd3('0x2d')]);_0x364d9b[_0xfcd3('0x31')]=_['intersection'](_0x419320[_0xfcd3('0x2c')],qs[_0xfcd3('0x32')](_0x344577[_0xfcd3('0x2d')][_0xfcd3('0x32')]));_0x364d9b[_0xfcd3('0x31')]=_0x364d9b[_0xfcd3('0x31')]['length']?_0x364d9b['attributes']:_0x419320['model'];if(_0x344577['query'][_0xfcd3('0x45')]){_0x364d9b[_0xfcd3('0x46')]=[{'all':!![]}];}_0x364d9b=_[_0xfcd3('0x3d')]({},_0x364d9b,_0x344577[_0xfcd3('0x3e')]);return db[_0xfcd3('0x27')][_0xfcd3('0x47')](_0x364d9b)[_0xfcd3('0x3f')](handleEntityNotFound(_0x500824,null))[_0xfcd3('0x3f')](respondWithResult(_0x500824,null))[_0xfcd3('0x42')](handleError(_0x500824,null));};exports[_0xfcd3('0x48')]=function(_0x10126b,_0x558dd2){return db[_0xfcd3('0x27')][_0xfcd3('0x48')](_0x10126b[_0xfcd3('0x49')],{})['then'](respondWithResult(_0x558dd2,0xc9))[_0xfcd3('0x42')](handleError(_0x558dd2,null));};exports[_0xfcd3('0x4a')]=function(_0x36c15d,_0x1b0f79){if(_0x36c15d[_0xfcd3('0x49')]['id']){delete _0x36c15d['body']['id'];}return db[_0xfcd3('0x27')][_0xfcd3('0x47')]({'where':{'id':_0x36c15d[_0xfcd3('0x44')]['id']}})[_0xfcd3('0x3f')](handleEntityNotFound(_0x1b0f79,null))['then'](saveUpdates(_0x36c15d['body'],null))['then'](respondWithResult(_0x1b0f79,null))[_0xfcd3('0x42')](handleError(_0x1b0f79,null));};exports['destroy']=function(_0x1b92d4,_0x19ce50){return db['FreshsalesAccount']['find']({'where':{'id':_0x1b92d4[_0xfcd3('0x44')]['id']}})[_0xfcd3('0x3f')](handleEntityNotFound(_0x19ce50,null))[_0xfcd3('0x3f')](removeEntity(_0x19ce50,null))[_0xfcd3('0x42')](handleError(_0x19ce50,null));};exports[_0xfcd3('0x4b')]=function(_0x537584,_0x20c8c9,_0x55dcda){var _0x3066ff={};var _0x9030d={};var _0x7a523;var _0x3d241b;return db[_0xfcd3('0x27')][_0xfcd3('0x4c')]({'where':{'id':_0x537584[_0xfcd3('0x44')]['id']}})['then'](handleEntityNotFound(_0x20c8c9,null))[_0xfcd3('0x3f')](function(_0x5cc6b2){if(_0x5cc6b2){_0x7a523=_0x5cc6b2;_0x9030d[_0xfcd3('0x2c')]=_[_0xfcd3('0x2e')](db[_0xfcd3('0x4d')][_0xfcd3('0x28')]);_0x9030d[_0xfcd3('0x2d')]=_[_0xfcd3('0x2e')](_0x537584[_0xfcd3('0x2d')]);_0x9030d[_0xfcd3('0x2f')]=_[_0xfcd3('0x30')](_0x9030d['model'],_0x9030d[_0xfcd3('0x2d')]);_0x3066ff[_0xfcd3('0x31')]=_[_0xfcd3('0x30')](_0x9030d[_0xfcd3('0x2c')],qs['fields'](_0x537584[_0xfcd3('0x2d')][_0xfcd3('0x32')]));_0x3066ff[_0xfcd3('0x31')]=_0x3066ff[_0xfcd3('0x31')][_0xfcd3('0x33')]?_0x3066ff[_0xfcd3('0x31')]:_0x9030d[_0xfcd3('0x2c')];_0x3066ff[_0xfcd3('0x37')]=qs[_0xfcd3('0x38')](_0x537584['query'][_0xfcd3('0x38')]);_0x3066ff[_0xfcd3('0x39')]=qs['filters'](_[_0xfcd3('0x3a')](_0x537584[_0xfcd3('0x2d')],_0x9030d[_0xfcd3('0x2f')]));if(_0x537584[_0xfcd3('0x2d')][_0xfcd3('0x3b')]){_0x3066ff[_0xfcd3('0x39')]=_[_0xfcd3('0x3d')](_0x3066ff[_0xfcd3('0x39')],{'$or':_['map'](_0x3066ff[_0xfcd3('0x31')],function(_0x5c8c49){var _0x9bb475={};_0x9bb475[_0x5c8c49]={'$like':'%'+_0x537584['query'][_0xfcd3('0x3b')]+'%'};return _0x9bb475;})});}_0x3066ff=_[_0xfcd3('0x3d')]({},_0x3066ff,_0x537584[_0xfcd3('0x3e')]);return _0x7a523[_0xfcd3('0x4b')](_0x3066ff);}})[_0xfcd3('0x3f')](function(_0x1e024a){if(_0x1e024a){_0x3d241b=_0x1e024a['length'];if(!_0x537584['query'][_0xfcd3('0x34')](_0xfcd3('0x35'))){_0x3066ff[_0xfcd3('0x36')]=qs[_0xfcd3('0x36')](_0x537584['query'][_0xfcd3('0x36')]);_0x3066ff[_0xfcd3('0x1b')]=qs[_0xfcd3('0x1b')](_0x537584[_0xfcd3('0x2d')][_0xfcd3('0x1b')]);}return _0x7a523[_0xfcd3('0x4b')](_0x3066ff);}})[_0xfcd3('0x3f')](function(_0x2a7a5b){if(_0x2a7a5b){return _0x2a7a5b?{'count':_0x3d241b,'rows':_0x2a7a5b}:null;}})[_0xfcd3('0x3f')](respondWithResult(_0x20c8c9,null))[_0xfcd3('0x42')](handleError(_0x20c8c9,null));};exports[_0xfcd3('0x4e')]=function(_0x1d055c,_0x4e2e8d,_0x4d180a){if(_0x1d055c[_0xfcd3('0x49')]['id']){delete _0x1d055c[_0xfcd3('0x49')]['id'];}return db[_0xfcd3('0x27')]['findOne']({'where':{'id':_0x1d055c[_0xfcd3('0x44')]['id']}})[_0xfcd3('0x3f')](handleEntityNotFound(_0x4e2e8d,null))['then'](function(_0x51478a){if(_0x51478a){_0x1d055c[_0xfcd3('0x49')]['AccountId']=_0x51478a['id'];_0x1d055c['body'][_0xfcd3('0x4f')]=integrations['getSubjects'](_0x1d055c[_0xfcd3('0x49')][_0xfcd3('0x50')],_0x1d055c[_0xfcd3('0x49')][_0xfcd3('0x2a')]);_0x1d055c[_0xfcd3('0x49')][_0xfcd3('0x51')]=integrations['getDescriptions'](_0x1d055c[_0xfcd3('0x49')][_0xfcd3('0x50')],_0x1d055c['body']['type']);return db[_0xfcd3('0x4d')]['create'](_0x1d055c[_0xfcd3('0x49')],{'include':[{'model':db['FreshsalesField'],'as':_0xfcd3('0x4f')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0xfcd3('0x3f')](respondWithResult(_0x4e2e8d,null))[_0xfcd3('0x42')](handleError(_0x4e2e8d,null));};exports['getFields']=function(_0x2068b9,_0x384948,_0x5e9b79){var _0x5c6e7d='';var _0x3ade83='';return db[_0xfcd3('0x27')]['findOne']({'where':{'id':_0x2068b9[_0xfcd3('0x44')]['id']},'attributes':['id',_0xfcd3('0x52'),'remoteUri','apiKey']})[_0xfcd3('0x3f')](handleEntityNotFound(_0x384948,null))[_0xfcd3('0x3f')](function(_0x528d06){if(_0x528d06){_0x3ade83=_0x528d06[_0xfcd3('0x52')];_0x5c6e7d=_0x528d06[_0xfcd3('0x53')];var _0x17f78b=_0x528d06[_0xfcd3('0x53')][_0xfcd3('0x54')](-0x1);if(_0x17f78b==='/'){_0x5c6e7d=_0x5c6e7d[_0xfcd3('0x55')](0x0,_0x5c6e7d['lastIndexOf'](_0x17f78b));}return rp({'method':_0xfcd3('0x56'),'uri':util[_0xfcd3('0x57')](_0xfcd3('0x58'),_0x5c6e7d,_0xfcd3('0x59')),'headers':{'Authorization':_0xfcd3('0x5a')+_0x528d06[_0xfcd3('0x5b')]},'json':!![]});}})['then'](function(_0x5835b3){if(_0x5835b3){var _0x394cda=_0x5835b3['users'];var _0x58fd4d=![];var _0x26b6c6=null;for(_0x26b6c6=0x0;_0x26b6c6<_0x394cda[_0xfcd3('0x33')];_0x26b6c6++){if(_0x394cda[_0x26b6c6][_0xfcd3('0x5c')]===_0x3ade83){_0x58fd4d=!![];}}if(_0x58fd4d){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xfcd3('0x3f')](respondWithResult(_0x384948,null))[_0xfcd3('0x42')](function(_0x598c39){var _0x3c38e0=_0x2068b9[_0xfcd3('0x2d')]['test']?0x1f4:_0x598c39[_0xfcd3('0x5d')]||0x1f4;logger[_0xfcd3('0x5e')](_0xfcd3('0x5f'),_0xfcd3('0x60'),_0x3c38e0,JSON[_0xfcd3('0x61')](_0x598c39));delete _0x598c39[_0xfcd3('0x24')];if(_0x3c38e0===0x191){_0x3c38e0=0x190;}_0x384948['status'](_0x3c38e0)[_0xfcd3('0x62')](_0x2068b9[_0xfcd3('0x2d')]['test']?{'message':_0xfcd3('0x63'),'statusCode':_0x598c39['statusCode']}:_0x598c39);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c599642..736e85e 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 _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define'];(function(_0x1808bb,_0x4dfa9f){var _0xd903a5=function(_0x7da710){while(--_0x7da710){_0x1808bb['push'](_0x1808bb['shift']());}};_0xd903a5(++_0x4dfa9f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x86d3('0x7')]=function(_0xfbbc15,_0x33d4aa){return _0xfbbc15[_0x86d3('0x8')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6455=['request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x6455,0x97));var _0x5645=function(_0x665dd3,_0x541e73){_0x665dd3=_0x665dd3-0x0;var _0x22d32e=_0x6455[_0x665dd3];return _0x22d32e;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));var integrations=require(_0x5645('0x9'));module[_0x5645('0xa')]=function(_0x3a635d,_0x37d672){return _0x3a635d[_0x5645('0xb')](_0x5645('0xc'),attributes,{'tableName':'int_freshsales_accounts','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 8e7d13f..2c64e37 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 _0x627e=['request','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','findAll','raw','options','where','map','model','attributes','include','then','debug','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0x627e,0x14a));var _0xe627=function(_0x235e5a,_0x518acf){_0x235e5a=_0x235e5a-0x0;var _0x56cc01=_0x627e[_0x235e5a];return _0x56cc01;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});}exports[_0xe627('0x14')]=function(_0x56559b){var _0x2fe46a=this;return new Promise(function(_0x538b22,_0x24fddd){return db['FreshsalesAccount'][_0xe627('0x15')]({'raw':_0x56559b['options']?_0x56559b['options'][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x56559b['options']?_0x56559b[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x56559b['options']?_0x56559b['options']['attributes']||null:null,'limit':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['limit']||null:null,'include':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['include']?_[_0xe627('0x19')](_0x56559b[_0xe627('0x17')]['include'],function(_0x42f3d1){return{'model':db[_0x42f3d1[_0xe627('0x1a')]],'as':_0x42f3d1['as'],'attributes':_0x42f3d1[_0xe627('0x1b')],'include':_0x42f3d1['include']?_[_0xe627('0x19')](_0x42f3d1[_0xe627('0x1c')],function(_0x1a5081){return{'model':db[_0x1a5081[_0xe627('0x1a')]],'as':_0x1a5081['as'],'attributes':_0x1a5081['attributes'],'include':_0x1a5081[_0xe627('0x1c')]?_[_0xe627('0x19')](_0x1a5081[_0xe627('0x1c')],function(_0x29eb8e){return{'model':db[_0x29eb8e[_0xe627('0x1a')]],'as':_0x29eb8e['as'],'attributes':_0x29eb8e[_0xe627('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x44c9f7){logger[_0xe627('0xb')]('GetFreshsalesAccount',_0x56559b);logger[_0xe627('0x1e')]('GetFreshsalesAccount',_0x56559b,JSON['stringify'](_0x44c9f7));_0x538b22(_0x44c9f7);})[_0xe627('0x13')](function(_0xdf63c8){logger['error'](_0xe627('0x14'),_0xdf63c8['message'],_0x56559b);_0x24fddd(_0x2fe46a[_0xe627('0x10')](0x1f4,_0xdf63c8['message']));});});};exports[_0xe627('0x1f')]=function(_0x26833a){var _0x5d8992=this;return new Promise(function(_0x33e9dd,_0x4f92c9){return db[_0xe627('0x20')][_0xe627('0x21')]({'raw':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x1b')]||null:null,'include':_0x26833a['options']?_0x26833a['options'][_0xe627('0x1c')]?_['map'](_0x26833a[_0xe627('0x17')]['include'],function(_0x56d1d7){return{'model':db[_0x56d1d7[_0xe627('0x1a')]],'as':_0x56d1d7['as'],'attributes':_0x56d1d7['attributes'],'include':_0x56d1d7['include']?_[_0xe627('0x19')](_0x56d1d7[_0xe627('0x1c')],function(_0x55f001){return{'model':db[_0x55f001['model']],'as':_0x55f001['as'],'attributes':_0x55f001['attributes'],'include':_0x55f001['include']?_[_0xe627('0x19')](_0x55f001['include'],function(_0x39338c){return{'model':db[_0x39338c[_0xe627('0x1a')]],'as':_0x39338c['as'],'attributes':_0x39338c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x35a303){logger['info'](_0xe627('0x1f'),_0x26833a);logger[_0xe627('0x1e')](_0xe627('0x1f'),_0x26833a,JSON[_0xe627('0xf')](_0x35a303));_0x33e9dd(_0x35a303);})[_0xe627('0x13')](function(_0x28fd59){logger['error'](_0xe627('0x1f'),_0x28fd59['message'],_0x26833a);_0x4f92c9(_0x5d8992[_0xe627('0x10')](0x1f4,_0x28fd59['message']));});});}; \ No newline at end of file +var _0xe5af=['ShowFreshsalesAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','include','model','map','find','raw','debug'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe5af,0x9c));var _0xfe5a=function(_0x1de6b0,_0x21f95f){_0x1de6b0=_0x1de6b0-0x0;var _0xe8fc68=_0xe5af[_0x1de6b0];return _0xe8fc68;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});}exports[_0xfe5a('0x12')]=function(_0x5bf597){var _0x20620b=this;return new Promise(function(_0x456707,_0x54d5fb){return db[_0xfe5a('0x13')][_0xfe5a('0x14')]({'raw':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x17')]||null:null,'limit':_0x5bf597['options']?_0x5bf597[_0xfe5a('0x15')]['limit']||null:null,'include':_0x5bf597[_0xfe5a('0x15')]?_0x5bf597[_0xfe5a('0x15')][_0xfe5a('0x18')]?_['map'](_0x5bf597['options'][_0xfe5a('0x18')],function(_0x3e55fd){return{'model':db[_0x3e55fd['model']],'as':_0x3e55fd['as'],'attributes':_0x3e55fd[_0xfe5a('0x17')],'include':_0x3e55fd[_0xfe5a('0x18')]?_['map'](_0x3e55fd[_0xfe5a('0x18')],function(_0x3a4f3c){return{'model':db[_0x3a4f3c[_0xfe5a('0x19')]],'as':_0x3a4f3c['as'],'attributes':_0x3a4f3c[_0xfe5a('0x17')],'include':_0x3a4f3c['include']?_[_0xfe5a('0x1a')](_0x3a4f3c[_0xfe5a('0x18')],function(_0x24481f){return{'model':db[_0x24481f[_0xfe5a('0x19')]],'as':_0x24481f['as'],'attributes':_0x24481f[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0xdbf1e0){logger[_0xfe5a('0xf')]('GetFreshsalesAccount',_0x5bf597);logger['debug'](_0xfe5a('0x12'),_0x5bf597,JSON['stringify'](_0xdbf1e0));_0x456707(_0xdbf1e0);})[_0xfe5a('0x11')](function(_0xfcb05b){logger[_0xfe5a('0xd')]('GetFreshsalesAccount',_0xfcb05b['message'],_0x5bf597);_0x54d5fb(_0x20620b['error'](0x1f4,_0xfcb05b[_0xfe5a('0xe')]));});});};exports['ShowFreshsalesAccount']=function(_0x51d1f4){var _0x498b64=this;return new Promise(function(_0x3b6e4d,_0x14c66d){return db[_0xfe5a('0x13')][_0xfe5a('0x1b')]({'raw':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x1c')]===undefined?!![]:![]:!![],'where':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x16')]||null:null,'attributes':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x17')]||null:null,'include':_0x51d1f4[_0xfe5a('0x15')]?_0x51d1f4['options'][_0xfe5a('0x18')]?_[_0xfe5a('0x1a')](_0x51d1f4[_0xfe5a('0x15')][_0xfe5a('0x18')],function(_0xe5a992){return{'model':db[_0xe5a992['model']],'as':_0xe5a992['as'],'attributes':_0xe5a992['attributes'],'include':_0xe5a992[_0xfe5a('0x18')]?_['map'](_0xe5a992[_0xfe5a('0x18')],function(_0xb31d0){return{'model':db[_0xb31d0[_0xfe5a('0x19')]],'as':_0xb31d0['as'],'attributes':_0xb31d0[_0xfe5a('0x17')],'include':_0xb31d0['include']?_[_0xfe5a('0x1a')](_0xb31d0[_0xfe5a('0x18')],function(_0x2e3a36){return{'model':db[_0x2e3a36['model']],'as':_0x2e3a36['as'],'attributes':_0x2e3a36[_0xfe5a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfe5a('0x8')](function(_0x4617f0){logger[_0xfe5a('0xf')]('ShowFreshsalesAccount',_0x51d1f4);logger[_0xfe5a('0x1d')]('ShowFreshsalesAccount',_0x51d1f4,JSON[_0xfe5a('0xc')](_0x4617f0));_0x3b6e4d(_0x4617f0);})[_0xfe5a('0x11')](function(_0x576189){logger[_0xfe5a('0xd')](_0xfe5a('0x1e'),_0x576189[_0xfe5a('0xe')],_0x51d1f4);_0x14c66d(_0x498b64[_0xfe5a('0xd')](0x1f4,_0x576189['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 78b080a..c2f2850 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 _0xc62a=['getSubjects','getDescriptions','/:id/fields','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects'];(function(_0x283791,_0x8b7a29){var _0x21d043=function(_0x46a18c){while(--_0x46a18c){_0x283791['push'](_0x283791['shift']());}};_0x21d043(++_0x8b7a29);}(_0xc62a,0xc1));var _0xac62=function(_0x3b2e91,_0x175377){_0x3b2e91=_0x3b2e91-0x0;var _0x5dc9ac=_0xc62a[_0x3b2e91];return _0x5dc9ac;};'use strict';var multer=require(_0xac62('0x0'));var util=require(_0xac62('0x1'));var path=require(_0xac62('0x2'));var timeout=require(_0xac62('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac62('0x4'));var auth=require(_0xac62('0x5'));var interaction=require(_0xac62('0x6'));var config=require(_0xac62('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xac62('0x8')]('/',auth[_0xac62('0x9')](),controller[_0xac62('0xa')]);router[_0xac62('0x8')](_0xac62('0xb'),auth[_0xac62('0x9')](),controller[_0xac62('0xc')]);router[_0xac62('0x8')](_0xac62('0xd'),auth['isAuthenticated'](),controller[_0xac62('0xe')]);router[_0xac62('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xac62('0xf')]);router['get'](_0xac62('0x10'),auth[_0xac62('0x9')](),controller['getFields']);router['post']('/',auth[_0xac62('0x9')](),controller[_0xac62('0x11')]);router[_0xac62('0x12')](_0xac62('0xb'),auth[_0xac62('0x9')](),controller[_0xac62('0x13')]);router[_0xac62('0x14')](_0xac62('0xb'),auth[_0xac62('0x9')](),controller[_0xac62('0x15')]);module[_0xac62('0x16')]=router; \ No newline at end of file +var _0xcb0b=['post','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','get','/:id','getSubjects','/:id/fields'];(function(_0x249f6e,_0x12bc0c){var _0x25a6f1=function(_0x3cb5ea){while(--_0x3cb5ea){_0x249f6e['push'](_0x249f6e['shift']());}};_0x25a6f1(++_0x12bc0c);}(_0xcb0b,0x1be));var _0xbcb0=function(_0xfe98b2,_0x34d2ce){_0xfe98b2=_0xfe98b2-0x0;var _0x108b5b=_0xcb0b[_0xfe98b2];return _0x108b5b;};'use strict';var multer=require(_0xbcb0('0x0'));var util=require(_0xbcb0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbcb0('0x2'));var router=express[_0xbcb0('0x3')]();var fs_extra=require(_0xbcb0('0x4'));var auth=require(_0xbcb0('0x5'));var interaction=require(_0xbcb0('0x6'));var config=require(_0xbcb0('0x7'));var controller=require(_0xbcb0('0x8'));router['get']('/',auth[_0xbcb0('0x9')](),controller['index']);router[_0xbcb0('0xa')](_0xbcb0('0xb'),auth[_0xbcb0('0x9')](),controller['show']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xbcb0('0xc')]);router[_0xbcb0('0xa')]('/:id/descriptions',auth[_0xbcb0('0x9')](),controller['getDescriptions']);router[_0xbcb0('0xa')](_0xbcb0('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xbcb0('0xe')]('/',auth[_0xbcb0('0x9')](),controller['create']);router[_0xbcb0('0xf')](_0xbcb0('0xb'),auth[_0xbcb0('0x9')](),controller[_0xbcb0('0x10')]);router[_0xbcb0('0x11')](_0xbcb0('0xb'),auth[_0xbcb0('0x9')](),controller[_0xbcb0('0x12')]);module[_0xbcb0('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 269d166..fb6f32e 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 _0x404e=['sequelize','exports','STRING'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x404e,0x174));var _0xe404=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0x404e[_0x47e309];return _0x2e1900;};'use strict';var Sequelize=require(_0xe404('0x0'));module[_0xe404('0x1')]={'name':{'type':Sequelize[_0xe404('0x2')]},'description':{'type':Sequelize[_0xe404('0x2')]}}; \ No newline at end of file +var _0x3233=['STRING','sequelize','exports'];(function(_0x16ac38,_0x298f83){var _0xa1c17a=function(_0x30fa2e){while(--_0x30fa2e){_0x16ac38['push'](_0x16ac38['shift']());}};_0xa1c17a(++_0x298f83);}(_0x3233,0x17b));var _0x3323=function(_0x1eb5af,_0x4647f2){_0x1eb5af=_0x1eb5af-0x0;var _0x3625f7=_0x3233[_0x1eb5af];return _0x3625f7;};'use strict';var Sequelize=require(_0x3323('0x0'));module[_0x3323('0x1')]={'name':{'type':Sequelize[_0x3323('0x2')]},'description':{'type':Sequelize[_0x3323('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9341d43..74f0c4b 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 _0x2e29=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','keys','fields','length','include','find','body','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end'];(function(_0xa1e6be,_0x54097d){var _0x5c4b82=function(_0x54ebc9){while(--_0x54ebc9){_0xa1e6be['push'](_0xa1e6be['shift']());}};_0x5c4b82(++_0x54097d);}(_0x2e29,0xc8));var _0x92e2=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x2e29[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0x92e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92e2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92e2('0x2'));var moment=require('moment');var BPromise=require(_0x92e2('0x3'));var Mustache=require('mustache');var util=require(_0x92e2('0x4'));var path=require(_0x92e2('0x5'));var sox=require(_0x92e2('0x6'));var csv=require(_0x92e2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92e2('0x8'));var _=require(_0x92e2('0x9'));var squel=require(_0x92e2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x92e2('0xb'));var toCsv=require(_0x92e2('0x7'));var querystring=require(_0x92e2('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x92e2('0xd'));var as=require(_0x92e2('0xe'));var hardwareService=require(_0x92e2('0xf'));var logger=require(_0x92e2('0x10'))(_0x92e2('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x92e2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cac70,_0x3d7687){_0x3d7687=_0x3d7687||0xcc;return function(_0x3d3709){if(_0x3d3709){return _0x5cac70[_0x92e2('0x13')](_0x3d7687);}return _0x5cac70[_0x92e2('0x14')](_0x3d7687)[_0x92e2('0x15')]();};}function respondWithResult(_0x46bc3c,_0x5aea25){_0x5aea25=_0x5aea25||0xc8;return function(_0x241ced){if(_0x241ced){return _0x46bc3c[_0x92e2('0x14')](_0x5aea25)[_0x92e2('0x16')](_0x241ced);}};}function respondWithFilteredResult(_0x25eeaf,_0x46ff2c){return function(_0x49cc95){if(_0x49cc95){var _0x2885e0=typeof _0x46ff2c[_0x92e2('0x17')]===_0x92e2('0x18')&&typeof _0x46ff2c[_0x92e2('0x19')]===_0x92e2('0x18');var _0x128a36=_0x49cc95[_0x92e2('0x1a')];var _0x5afe7b=_0x2885e0?0x0:_0x46ff2c['offset'];var _0x143e79=_0x2885e0?_0x49cc95['count']:_0x46ff2c[_0x92e2('0x17')]+_0x46ff2c['limit'];var _0x49d79c;if(_0x143e79>=_0x128a36){_0x143e79=_0x128a36;_0x49d79c=0xc8;}else{_0x49d79c=0xce;}_0x25eeaf['status'](_0x49d79c);return _0x25eeaf[_0x92e2('0x1b')](_0x92e2('0x1c'),_0x5afe7b+'-'+_0x143e79+'/'+_0x128a36)[_0x92e2('0x16')](_0x49cc95);}return null;};}function patchUpdates(_0x124588){return function(_0xde0be8){try{jsonpatch[_0x92e2('0x1d')](_0xde0be8,_0x124588,!![]);}catch(_0x307499){return BPromise['reject'](_0x307499);}return _0xde0be8[_0x92e2('0x1e')]();};}function saveUpdates(_0x25adce,_0x69698c){return function(_0x1618c0){if(_0x1618c0){return _0x1618c0[_0x92e2('0x1f')](_0x25adce)[_0x92e2('0x20')](function(_0x11d25f){return _0x11d25f;});}return null;};}function removeEntity(_0x2f1432,_0x1f7f81){return function(_0x54457b){if(_0x54457b){return _0x54457b[_0x92e2('0x21')]()[_0x92e2('0x20')](function(){_0x2f1432[_0x92e2('0x14')](0xcc)[_0x92e2('0x15')]();});}};}function handleEntityNotFound(_0x58d388,_0x59c0b4){return function(_0x36c688){if(!_0x36c688){_0x58d388[_0x92e2('0x13')](0x194);}return _0x36c688;};}function handleError(_0x149711,_0x5747fe){_0x5747fe=_0x5747fe||0x1f4;return function(_0x5edbda){logger[_0x92e2('0x22')](_0x5edbda['stack']);if(_0x5edbda[_0x92e2('0x23')]){delete _0x5edbda[_0x92e2('0x23')];}_0x149711[_0x92e2('0x14')](_0x5747fe)[_0x92e2('0x24')](_0x5edbda);};}exports[_0x92e2('0x25')]=function(_0x552ab6,_0x1ea964){var _0x285469={},_0x16b925={},_0x7de1b6={'count':0x0,'rows':[]};var _0x5bf804=_['map'](db[_0x92e2('0x26')][_0x92e2('0x27')],function(_0x1b8225){return{'name':_0x1b8225[_0x92e2('0x28')],'type':_0x1b8225[_0x92e2('0x29')][_0x92e2('0x2a')]};});_0x16b925[_0x92e2('0x2b')]=_[_0x92e2('0x2c')](_0x5bf804,_0x92e2('0x23'));_0x16b925[_0x92e2('0x2d')]=_['keys'](_0x552ab6['query']);_0x16b925['filters']=_['intersection'](_0x16b925[_0x92e2('0x2b')],_0x16b925[_0x92e2('0x2d')]);_0x285469[_0x92e2('0x2e')]=_[_0x92e2('0x2f')](_0x16b925['model'],qs['fields'](_0x552ab6[_0x92e2('0x2d')]['fields']));_0x285469[_0x92e2('0x2e')]=_0x285469[_0x92e2('0x2e')]['length']?_0x285469[_0x92e2('0x2e')]:_0x16b925[_0x92e2('0x2b')];if(!_0x552ab6['query'][_0x92e2('0x30')](_0x92e2('0x31'))){_0x285469[_0x92e2('0x19')]=qs[_0x92e2('0x19')](_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x19')]);_0x285469[_0x92e2('0x17')]=qs[_0x92e2('0x17')](_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x17')]);}_0x285469[_0x92e2('0x32')]=qs[_0x92e2('0x33')](_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x33')]);_0x285469[_0x92e2('0x34')]=qs[_0x92e2('0x35')](_[_0x92e2('0x36')](_0x552ab6['query'],_0x16b925[_0x92e2('0x35')]),_0x5bf804);if(_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x37')]){_0x285469[_0x92e2('0x34')]=_[_0x92e2('0x38')](_0x285469['where'],{'$or':_[_0x92e2('0x2c')](_0x5bf804,function(_0x7c9b6b){if(_0x7c9b6b['type']!==_0x92e2('0x39')){var _0x599f0f={};_0x599f0f[_0x7c9b6b[_0x92e2('0x23')]]={'$like':'%'+_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x37')]+'%'};return _0x599f0f;}})});}_0x285469=_[_0x92e2('0x38')]({},_0x285469,_0x552ab6[_0x92e2('0x3a')]);var _0x5592f2={'where':_0x285469[_0x92e2('0x34')]};return db['FreshsalesConfiguration'][_0x92e2('0x1a')](_0x5592f2)['then'](function(_0x3e44b8){_0x7de1b6[_0x92e2('0x1a')]=_0x3e44b8;if(_0x552ab6['query'][_0x92e2('0x3b')]){_0x285469['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x285469);})[_0x92e2('0x20')](function(_0x4b6bb8){_0x7de1b6['rows']=_0x4b6bb8;return _0x7de1b6;})[_0x92e2('0x20')](respondWithFilteredResult(_0x1ea964,_0x285469))[_0x92e2('0x3c')](handleError(_0x1ea964,null));};exports[_0x92e2('0x3d')]=function(_0x40d6b0,_0x3013de){var _0x5f379e={'raw':![],'where':{'id':_0x40d6b0[_0x92e2('0x3e')]['id']}},_0xc5775={};_0xc5775[_0x92e2('0x2b')]=_[_0x92e2('0x3f')](db[_0x92e2('0x26')]['rawAttributes']);_0xc5775[_0x92e2('0x2d')]=_[_0x92e2('0x3f')](_0x40d6b0['query']);_0xc5775[_0x92e2('0x35')]=_['intersection'](_0xc5775['model'],_0xc5775[_0x92e2('0x2d')]);_0x5f379e[_0x92e2('0x2e')]=_[_0x92e2('0x2f')](_0xc5775[_0x92e2('0x2b')],qs[_0x92e2('0x40')](_0x40d6b0['query']['fields']));_0x5f379e[_0x92e2('0x2e')]=_0x5f379e[_0x92e2('0x2e')][_0x92e2('0x41')]?_0x5f379e['attributes']:_0xc5775[_0x92e2('0x2b')];if(_0x40d6b0[_0x92e2('0x2d')][_0x92e2('0x3b')]){_0x5f379e[_0x92e2('0x42')]=[{'all':!![]}];}_0x5f379e=_['merge']({},_0x5f379e,_0x40d6b0['options']);return db[_0x92e2('0x26')][_0x92e2('0x43')](_0x5f379e)[_0x92e2('0x20')](handleEntityNotFound(_0x3013de,null))[_0x92e2('0x20')](respondWithResult(_0x3013de,null))[_0x92e2('0x3c')](handleError(_0x3013de,null));};exports['create']=function(_0x299f3a,_0x360cdd){return db[_0x92e2('0x26')]['create'](_0x299f3a['body'],{})[_0x92e2('0x20')](respondWithResult(_0x360cdd,0xc9))[_0x92e2('0x3c')](handleError(_0x360cdd,null));};exports[_0x92e2('0x1f')]=function(_0x47bc27,_0x3e523f){if(_0x47bc27[_0x92e2('0x44')]['id']){delete _0x47bc27[_0x92e2('0x44')]['id'];}return db[_0x92e2('0x26')][_0x92e2('0x43')]({'where':{'id':_0x47bc27[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x3e523f,null))[_0x92e2('0x20')](saveUpdates(_0x47bc27[_0x92e2('0x44')],null))['then'](respondWithResult(_0x3e523f,null))[_0x92e2('0x3c')](handleError(_0x3e523f,null));};exports[_0x92e2('0x21')]=function(_0x57a984,_0x4cd744){return db[_0x92e2('0x26')][_0x92e2('0x43')]({'where':{'id':_0x57a984[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x4cd744,null))[_0x92e2('0x20')](removeEntity(_0x4cd744,null))['catch'](handleError(_0x4cd744,null));};exports['getSubjects']=function(_0x2c159c,_0x23b792,_0x15cf2c){var _0x316426={};var _0x406319={};var _0x325b31;var _0x2492d3;return db['FreshsalesConfiguration'][_0x92e2('0x45')]({'where':{'id':_0x2c159c[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x23b792,null))[_0x92e2('0x20')](function(_0x4679eb){if(_0x4679eb){_0x325b31=_0x4679eb;_0x406319['model']=_[_0x92e2('0x3f')](db[_0x92e2('0x46')][_0x92e2('0x27')]);_0x406319['query']=_[_0x92e2('0x3f')](_0x2c159c['query']);_0x406319[_0x92e2('0x35')]=_[_0x92e2('0x2f')](_0x406319[_0x92e2('0x2b')],_0x406319[_0x92e2('0x2d')]);_0x316426[_0x92e2('0x2e')]=_['intersection'](_0x406319[_0x92e2('0x2b')],qs['fields'](_0x2c159c[_0x92e2('0x2d')]['fields']));_0x316426[_0x92e2('0x2e')]=_0x316426['attributes'][_0x92e2('0x41')]?_0x316426[_0x92e2('0x2e')]:_0x406319[_0x92e2('0x2b')];_0x316426['order']=qs[_0x92e2('0x33')](_0x2c159c['query']['sort']);_0x316426[_0x92e2('0x34')]=qs[_0x92e2('0x35')](_['pick'](_0x2c159c[_0x92e2('0x2d')],_0x406319[_0x92e2('0x35')]));if(_0x2c159c['query'][_0x92e2('0x37')]){_0x316426[_0x92e2('0x34')]=_[_0x92e2('0x38')](_0x316426['where'],{'$or':_['map'](_0x316426[_0x92e2('0x2e')],function(_0xfd010c){var _0x3f2e6e={};_0x3f2e6e[_0xfd010c]={'$like':'%'+_0x2c159c['query'][_0x92e2('0x37')]+'%'};return _0x3f2e6e;})});}_0x316426=_[_0x92e2('0x38')]({},_0x316426,_0x2c159c[_0x92e2('0x3a')]);return _0x325b31[_0x92e2('0x47')](_0x316426);}})['then'](function(_0x25f029){if(_0x25f029){_0x2492d3=_0x25f029['length'];if(!_0x2c159c[_0x92e2('0x2d')][_0x92e2('0x30')](_0x92e2('0x31'))){_0x316426[_0x92e2('0x19')]=qs[_0x92e2('0x19')](_0x2c159c[_0x92e2('0x2d')][_0x92e2('0x19')]);_0x316426[_0x92e2('0x17')]=qs[_0x92e2('0x17')](_0x2c159c['query']['offset']);}return _0x325b31['getSubjects'](_0x316426);}})[_0x92e2('0x20')](function(_0x5165ab){if(_0x5165ab){return _0x5165ab?{'count':_0x2492d3,'rows':_0x5165ab}:null;}})[_0x92e2('0x20')](respondWithResult(_0x23b792,null))[_0x92e2('0x3c')](handleError(_0x23b792,null));};exports[_0x92e2('0x48')]=function(_0xaf98f9,_0x44657e,_0x637792){var _0x5b7841={};var _0x280b40={};var _0x23886f;var _0x197944;return db['FreshsalesConfiguration'][_0x92e2('0x45')]({'where':{'id':_0xaf98f9[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x44657e,null))[_0x92e2('0x20')](function(_0x50beaf){if(_0x50beaf){_0x23886f=_0x50beaf;_0x280b40[_0x92e2('0x2b')]=_[_0x92e2('0x3f')](db[_0x92e2('0x46')][_0x92e2('0x27')]);_0x280b40['query']=_[_0x92e2('0x3f')](_0xaf98f9[_0x92e2('0x2d')]);_0x280b40[_0x92e2('0x35')]=_['intersection'](_0x280b40[_0x92e2('0x2b')],_0x280b40[_0x92e2('0x2d')]);_0x5b7841[_0x92e2('0x2e')]=_[_0x92e2('0x2f')](_0x280b40[_0x92e2('0x2b')],qs[_0x92e2('0x40')](_0xaf98f9[_0x92e2('0x2d')]['fields']));_0x5b7841[_0x92e2('0x2e')]=_0x5b7841[_0x92e2('0x2e')][_0x92e2('0x41')]?_0x5b7841[_0x92e2('0x2e')]:_0x280b40[_0x92e2('0x2b')];_0x5b7841[_0x92e2('0x32')]=qs[_0x92e2('0x33')](_0xaf98f9[_0x92e2('0x2d')][_0x92e2('0x33')]);_0x5b7841['where']=qs[_0x92e2('0x35')](_['pick'](_0xaf98f9[_0x92e2('0x2d')],_0x280b40['filters']));if(_0xaf98f9[_0x92e2('0x2d')][_0x92e2('0x37')]){_0x5b7841[_0x92e2('0x34')]=_[_0x92e2('0x38')](_0x5b7841[_0x92e2('0x34')],{'$or':_['map'](_0x5b7841[_0x92e2('0x2e')],function(_0x183a42){var _0x286d5c={};_0x286d5c[_0x183a42]={'$like':'%'+_0xaf98f9[_0x92e2('0x2d')][_0x92e2('0x37')]+'%'};return _0x286d5c;})});}_0x5b7841=_[_0x92e2('0x38')]({},_0x5b7841,_0xaf98f9[_0x92e2('0x3a')]);return _0x23886f[_0x92e2('0x48')](_0x5b7841);}})[_0x92e2('0x20')](function(_0x1f7341){if(_0x1f7341){_0x197944=_0x1f7341[_0x92e2('0x41')];if(!_0xaf98f9['query'][_0x92e2('0x30')](_0x92e2('0x31'))){_0x5b7841[_0x92e2('0x19')]=qs[_0x92e2('0x19')](_0xaf98f9['query'][_0x92e2('0x19')]);_0x5b7841[_0x92e2('0x17')]=qs['offset'](_0xaf98f9[_0x92e2('0x2d')][_0x92e2('0x17')]);}return _0x23886f[_0x92e2('0x48')](_0x5b7841);}})[_0x92e2('0x20')](function(_0x6fc05f){if(_0x6fc05f){return _0x6fc05f?{'count':_0x197944,'rows':_0x6fc05f}:null;}})[_0x92e2('0x20')](respondWithResult(_0x44657e,null))[_0x92e2('0x3c')](handleError(_0x44657e,null));};exports['getFields']=function(_0x425d37,_0x464476,_0x3021fa){var _0x332432={};var _0x3cff78={};var _0x1423de;var _0x51cddb;return db['FreshsalesConfiguration'][_0x92e2('0x45')]({'where':{'id':_0x425d37[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x464476,null))['then'](function(_0x527adc){if(_0x527adc){_0x1423de=_0x527adc;_0x3cff78[_0x92e2('0x2b')]=_[_0x92e2('0x3f')](db[_0x92e2('0x46')][_0x92e2('0x27')]);_0x3cff78[_0x92e2('0x2d')]=_[_0x92e2('0x3f')](_0x425d37['query']);_0x3cff78[_0x92e2('0x35')]=_[_0x92e2('0x2f')](_0x3cff78[_0x92e2('0x2b')],_0x3cff78[_0x92e2('0x2d')]);_0x332432[_0x92e2('0x2e')]=_[_0x92e2('0x2f')](_0x3cff78[_0x92e2('0x2b')],qs[_0x92e2('0x40')](_0x425d37['query'][_0x92e2('0x40')]));_0x332432['attributes']=_0x332432[_0x92e2('0x2e')]['length']?_0x332432['attributes']:_0x3cff78[_0x92e2('0x2b')];_0x332432['order']=qs['sort'](_0x425d37[_0x92e2('0x2d')]['sort']);_0x332432[_0x92e2('0x34')]=qs[_0x92e2('0x35')](_[_0x92e2('0x36')](_0x425d37['query'],_0x3cff78[_0x92e2('0x35')]));if(_0x425d37[_0x92e2('0x2d')][_0x92e2('0x37')]){_0x332432[_0x92e2('0x34')]=_[_0x92e2('0x38')](_0x332432['where'],{'$or':_['map'](_0x332432[_0x92e2('0x2e')],function(_0x14a07e){var _0x593805={};_0x593805[_0x14a07e]={'$like':'%'+_0x425d37[_0x92e2('0x2d')][_0x92e2('0x37')]+'%'};return _0x593805;})});}_0x332432=_[_0x92e2('0x38')]({},_0x332432,_0x425d37[_0x92e2('0x3a')]);return _0x1423de['getFields'](_0x332432);}})['then'](function(_0x4d418f){if(_0x4d418f){_0x51cddb=_0x4d418f[_0x92e2('0x41')];if(!_0x425d37['query'][_0x92e2('0x30')](_0x92e2('0x31'))){_0x332432['limit']=qs[_0x92e2('0x19')](_0x425d37[_0x92e2('0x2d')]['limit']);_0x332432[_0x92e2('0x17')]=qs[_0x92e2('0x17')](_0x425d37[_0x92e2('0x2d')][_0x92e2('0x17')]);}return _0x1423de[_0x92e2('0x49')](_0x332432);}})['then'](function(_0x2c487e){if(_0x2c487e){return _0x2c487e?{'count':_0x51cddb,'rows':_0x2c487e}:null;}})[_0x92e2('0x20')](respondWithResult(_0x464476,null))[_0x92e2('0x3c')](handleError(_0x464476,null));}; \ No newline at end of file +var _0xd8e3=['json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','params','includeAll','find','catch','create','update','body','getSubjects','findOne','nolimit','getDescriptions','FreshsalesField','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x1f14a8,_0x11de2f){var _0x4f5581=function(_0x2d64b2){while(--_0x2d64b2){_0x1f14a8['push'](_0x1f14a8['shift']());}};_0x4f5581(++_0x11de2f);}(_0xd8e3,0x84));var _0x3d8e=function(_0x2d165c,_0x497bcd){_0x2d165c=_0x2d165c-0x0;var _0x350e3e=_0xd8e3[_0x2d165c];return _0x350e3e;};'use strict';var emlformat=require(_0x3d8e('0x0'));var rimraf=require(_0x3d8e('0x1'));var zipdir=require(_0x3d8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d8e('0x3'));var moment=require(_0x3d8e('0x4'));var BPromise=require(_0x3d8e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d8e('0x6'));var sox=require(_0x3d8e('0x7'));var csv=require(_0x3d8e('0x8'));var ejs=require(_0x3d8e('0x9'));var fs=require('fs');var fs_extra=require(_0x3d8e('0xa'));var _=require(_0x3d8e('0xb'));var squel=require(_0x3d8e('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d8e('0xd'));var deskjs=require(_0x3d8e('0xe'));var toCsv=require(_0x3d8e('0x8'));var querystring=require(_0x3d8e('0xf'));var Papa=require('papaparse');var Redis=require(_0x3d8e('0x10'));var authService=require(_0x3d8e('0x11'));var qs=require(_0x3d8e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d8e('0x13'));var logger=require(_0x3d8e('0x14'))(_0x3d8e('0x15'));var utils=require(_0x3d8e('0x16'));var config=require(_0x3d8e('0x17'));var licenseUtil=require(_0x3d8e('0x18'));var db=require(_0x3d8e('0x19'))['db'];function respondWithStatusCode(_0x4190c1,_0xfeb2b7){_0xfeb2b7=_0xfeb2b7||0xcc;return function(_0x544eba){if(_0x544eba){return _0x4190c1['sendStatus'](_0xfeb2b7);}return _0x4190c1[_0x3d8e('0x1a')](_0xfeb2b7)[_0x3d8e('0x1b')]();};}function respondWithResult(_0x52cf7f,_0x396309){_0x396309=_0x396309||0xc8;return function(_0x2444ef){if(_0x2444ef){return _0x52cf7f[_0x3d8e('0x1a')](_0x396309)[_0x3d8e('0x1c')](_0x2444ef);}};}function respondWithFilteredResult(_0x54142c,_0x35b322){return function(_0x5cdd77){if(_0x5cdd77){var _0x500436=typeof _0x35b322['offset']===_0x3d8e('0x1d')&&typeof _0x35b322[_0x3d8e('0x1e')]===_0x3d8e('0x1d');var _0x4d6c8d=_0x5cdd77[_0x3d8e('0x1f')];var _0x4a8ced=_0x500436?0x0:_0x35b322[_0x3d8e('0x20')];var _0x3a90d4=_0x500436?_0x5cdd77['count']:_0x35b322[_0x3d8e('0x20')]+_0x35b322['limit'];var _0x52190b;if(_0x3a90d4>=_0x4d6c8d){_0x3a90d4=_0x4d6c8d;_0x52190b=0xc8;}else{_0x52190b=0xce;}_0x54142c[_0x3d8e('0x1a')](_0x52190b);return _0x54142c[_0x3d8e('0x21')]('Content-Range',_0x4a8ced+'-'+_0x3a90d4+'/'+_0x4d6c8d)['json'](_0x5cdd77);}return null;};}function patchUpdates(_0x55da7b){return function(_0x3dd0f3){try{jsonpatch[_0x3d8e('0x22')](_0x3dd0f3,_0x55da7b,!![]);}catch(_0x4b60a4){return BPromise[_0x3d8e('0x23')](_0x4b60a4);}return _0x3dd0f3[_0x3d8e('0x24')]();};}function saveUpdates(_0x43fdbe,_0x6eab80){return function(_0x7c0d27){if(_0x7c0d27){return _0x7c0d27['update'](_0x43fdbe)[_0x3d8e('0x25')](function(_0x1563bb){return _0x1563bb;});}return null;};}function removeEntity(_0x515cde,_0x5c6d4d){return function(_0x32d83e){if(_0x32d83e){return _0x32d83e[_0x3d8e('0x26')]()[_0x3d8e('0x25')](function(){_0x515cde['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x569751,_0x356453){return function(_0xee9273){if(!_0xee9273){_0x569751[_0x3d8e('0x27')](0x194);}return _0xee9273;};}function handleError(_0x2c23d1,_0x304ac8){_0x304ac8=_0x304ac8||0x1f4;return function(_0x5cdf45){logger[_0x3d8e('0x28')](_0x5cdf45[_0x3d8e('0x29')]);if(_0x5cdf45[_0x3d8e('0x2a')]){delete _0x5cdf45[_0x3d8e('0x2a')];}_0x2c23d1[_0x3d8e('0x1a')](_0x304ac8)[_0x3d8e('0x2b')](_0x5cdf45);};}exports[_0x3d8e('0x2c')]=function(_0x2ace8e,_0x181a84){var _0x222348={},_0x205706={},_0x4a7af9={'count':0x0,'rows':[]};var _0x3997df=_['map'](db[_0x3d8e('0x2d')][_0x3d8e('0x2e')],function(_0x52dee5){return{'name':_0x52dee5[_0x3d8e('0x2f')],'type':_0x52dee5[_0x3d8e('0x30')][_0x3d8e('0x31')]};});_0x205706[_0x3d8e('0x32')]=_[_0x3d8e('0x33')](_0x3997df,'name');_0x205706[_0x3d8e('0x34')]=_[_0x3d8e('0x35')](_0x2ace8e['query']);_0x205706[_0x3d8e('0x36')]=_['intersection'](_0x205706[_0x3d8e('0x32')],_0x205706[_0x3d8e('0x34')]);_0x222348[_0x3d8e('0x37')]=_[_0x3d8e('0x38')](_0x205706[_0x3d8e('0x32')],qs[_0x3d8e('0x39')](_0x2ace8e[_0x3d8e('0x34')][_0x3d8e('0x39')]));_0x222348['attributes']=_0x222348['attributes'][_0x3d8e('0x3a')]?_0x222348[_0x3d8e('0x37')]:_0x205706['model'];if(!_0x2ace8e['query'][_0x3d8e('0x3b')]('nolimit')){_0x222348[_0x3d8e('0x1e')]=qs[_0x3d8e('0x1e')](_0x2ace8e[_0x3d8e('0x34')]['limit']);_0x222348['offset']=qs['offset'](_0x2ace8e['query'][_0x3d8e('0x20')]);}_0x222348[_0x3d8e('0x3c')]=qs[_0x3d8e('0x3d')](_0x2ace8e[_0x3d8e('0x34')][_0x3d8e('0x3d')]);_0x222348[_0x3d8e('0x3e')]=qs[_0x3d8e('0x36')](_[_0x3d8e('0x3f')](_0x2ace8e[_0x3d8e('0x34')],_0x205706[_0x3d8e('0x36')]),_0x3997df);if(_0x2ace8e['query'][_0x3d8e('0x40')]){_0x222348[_0x3d8e('0x3e')]=_[_0x3d8e('0x41')](_0x222348[_0x3d8e('0x3e')],{'$or':_[_0x3d8e('0x33')](_0x3997df,function(_0x50e7c1){if(_0x50e7c1[_0x3d8e('0x30')]!=='VIRTUAL'){var _0x5d6abb={};_0x5d6abb[_0x50e7c1['name']]={'$like':'%'+_0x2ace8e[_0x3d8e('0x34')]['filter']+'%'};return _0x5d6abb;}})});}_0x222348=_[_0x3d8e('0x41')]({},_0x222348,_0x2ace8e[_0x3d8e('0x42')]);var _0x5f41c7={'where':_0x222348[_0x3d8e('0x3e')]};return db[_0x3d8e('0x2d')]['count'](_0x5f41c7)['then'](function(_0x161353){_0x4a7af9[_0x3d8e('0x1f')]=_0x161353;if(_0x2ace8e['query']['includeAll']){_0x222348[_0x3d8e('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x222348);})[_0x3d8e('0x25')](function(_0x344a4f){_0x4a7af9['rows']=_0x344a4f;return _0x4a7af9;})[_0x3d8e('0x25')](respondWithFilteredResult(_0x181a84,_0x222348))['catch'](handleError(_0x181a84,null));};exports['show']=function(_0x1b61c6,_0x57343c){var _0x621823={'raw':![],'where':{'id':_0x1b61c6[_0x3d8e('0x44')]['id']}},_0x33ebe2={};_0x33ebe2['model']=_[_0x3d8e('0x35')](db[_0x3d8e('0x2d')][_0x3d8e('0x2e')]);_0x33ebe2['query']=_[_0x3d8e('0x35')](_0x1b61c6[_0x3d8e('0x34')]);_0x33ebe2[_0x3d8e('0x36')]=_['intersection'](_0x33ebe2['model'],_0x33ebe2['query']);_0x621823[_0x3d8e('0x37')]=_[_0x3d8e('0x38')](_0x33ebe2[_0x3d8e('0x32')],qs['fields'](_0x1b61c6[_0x3d8e('0x34')][_0x3d8e('0x39')]));_0x621823['attributes']=_0x621823[_0x3d8e('0x37')][_0x3d8e('0x3a')]?_0x621823['attributes']:_0x33ebe2[_0x3d8e('0x32')];if(_0x1b61c6['query'][_0x3d8e('0x45')]){_0x621823[_0x3d8e('0x43')]=[{'all':!![]}];}_0x621823=_['merge']({},_0x621823,_0x1b61c6[_0x3d8e('0x42')]);return db[_0x3d8e('0x2d')][_0x3d8e('0x46')](_0x621823)[_0x3d8e('0x25')](handleEntityNotFound(_0x57343c,null))['then'](respondWithResult(_0x57343c,null))[_0x3d8e('0x47')](handleError(_0x57343c,null));};exports[_0x3d8e('0x48')]=function(_0x20bfca,_0x158123){return db[_0x3d8e('0x2d')]['create'](_0x20bfca['body'],{})[_0x3d8e('0x25')](respondWithResult(_0x158123,0xc9))[_0x3d8e('0x47')](handleError(_0x158123,null));};exports[_0x3d8e('0x49')]=function(_0x145222,_0x58ddfd){if(_0x145222['body']['id']){delete _0x145222['body']['id'];}return db[_0x3d8e('0x2d')][_0x3d8e('0x46')]({'where':{'id':_0x145222[_0x3d8e('0x44')]['id']}})['then'](handleEntityNotFound(_0x58ddfd,null))[_0x3d8e('0x25')](saveUpdates(_0x145222[_0x3d8e('0x4a')],null))[_0x3d8e('0x25')](respondWithResult(_0x58ddfd,null))[_0x3d8e('0x47')](handleError(_0x58ddfd,null));};exports['destroy']=function(_0xf35364,_0xdca96e){return db[_0x3d8e('0x2d')][_0x3d8e('0x46')]({'where':{'id':_0xf35364['params']['id']}})[_0x3d8e('0x25')](handleEntityNotFound(_0xdca96e,null))[_0x3d8e('0x25')](removeEntity(_0xdca96e,null))[_0x3d8e('0x47')](handleError(_0xdca96e,null));};exports[_0x3d8e('0x4b')]=function(_0x55e1f0,_0x44fbbc,_0x48d47f){var _0x4be015={};var _0x16b492={};var _0x3ac897;var _0x135c54;return db[_0x3d8e('0x2d')][_0x3d8e('0x4c')]({'where':{'id':_0x55e1f0[_0x3d8e('0x44')]['id']}})['then'](handleEntityNotFound(_0x44fbbc,null))[_0x3d8e('0x25')](function(_0x59ff85){if(_0x59ff85){_0x3ac897=_0x59ff85;_0x16b492[_0x3d8e('0x32')]=_[_0x3d8e('0x35')](db['FreshsalesField'][_0x3d8e('0x2e')]);_0x16b492[_0x3d8e('0x34')]=_[_0x3d8e('0x35')](_0x55e1f0[_0x3d8e('0x34')]);_0x16b492[_0x3d8e('0x36')]=_[_0x3d8e('0x38')](_0x16b492[_0x3d8e('0x32')],_0x16b492[_0x3d8e('0x34')]);_0x4be015[_0x3d8e('0x37')]=_[_0x3d8e('0x38')](_0x16b492[_0x3d8e('0x32')],qs[_0x3d8e('0x39')](_0x55e1f0[_0x3d8e('0x34')]['fields']));_0x4be015['attributes']=_0x4be015['attributes'][_0x3d8e('0x3a')]?_0x4be015[_0x3d8e('0x37')]:_0x16b492[_0x3d8e('0x32')];_0x4be015[_0x3d8e('0x3c')]=qs['sort'](_0x55e1f0[_0x3d8e('0x34')][_0x3d8e('0x3d')]);_0x4be015[_0x3d8e('0x3e')]=qs[_0x3d8e('0x36')](_[_0x3d8e('0x3f')](_0x55e1f0['query'],_0x16b492[_0x3d8e('0x36')]));if(_0x55e1f0[_0x3d8e('0x34')]['filter']){_0x4be015[_0x3d8e('0x3e')]=_[_0x3d8e('0x41')](_0x4be015[_0x3d8e('0x3e')],{'$or':_[_0x3d8e('0x33')](_0x4be015['attributes'],function(_0x2d2bfd){var _0xafff49={};_0xafff49[_0x2d2bfd]={'$like':'%'+_0x55e1f0['query'][_0x3d8e('0x40')]+'%'};return _0xafff49;})});}_0x4be015=_['merge']({},_0x4be015,_0x55e1f0['options']);return _0x3ac897[_0x3d8e('0x4b')](_0x4be015);}})[_0x3d8e('0x25')](function(_0x5b1aad){if(_0x5b1aad){_0x135c54=_0x5b1aad[_0x3d8e('0x3a')];if(!_0x55e1f0[_0x3d8e('0x34')]['hasOwnProperty'](_0x3d8e('0x4d'))){_0x4be015[_0x3d8e('0x1e')]=qs[_0x3d8e('0x1e')](_0x55e1f0[_0x3d8e('0x34')]['limit']);_0x4be015[_0x3d8e('0x20')]=qs[_0x3d8e('0x20')](_0x55e1f0[_0x3d8e('0x34')]['offset']);}return _0x3ac897[_0x3d8e('0x4b')](_0x4be015);}})[_0x3d8e('0x25')](function(_0x49656c){if(_0x49656c){return _0x49656c?{'count':_0x135c54,'rows':_0x49656c}:null;}})[_0x3d8e('0x25')](respondWithResult(_0x44fbbc,null))[_0x3d8e('0x47')](handleError(_0x44fbbc,null));};exports[_0x3d8e('0x4e')]=function(_0x17563f,_0x5c175a,_0x1c6fd8){var _0x96ec14={};var _0x21905e={};var _0x1ad9f0;var _0x4c95de;return db[_0x3d8e('0x2d')][_0x3d8e('0x4c')]({'where':{'id':_0x17563f[_0x3d8e('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c175a,null))[_0x3d8e('0x25')](function(_0x26c0ce){if(_0x26c0ce){_0x1ad9f0=_0x26c0ce;_0x21905e[_0x3d8e('0x32')]=_['keys'](db['FreshsalesField'][_0x3d8e('0x2e')]);_0x21905e['query']=_['keys'](_0x17563f[_0x3d8e('0x34')]);_0x21905e[_0x3d8e('0x36')]=_[_0x3d8e('0x38')](_0x21905e[_0x3d8e('0x32')],_0x21905e['query']);_0x96ec14[_0x3d8e('0x37')]=_[_0x3d8e('0x38')](_0x21905e[_0x3d8e('0x32')],qs['fields'](_0x17563f[_0x3d8e('0x34')][_0x3d8e('0x39')]));_0x96ec14[_0x3d8e('0x37')]=_0x96ec14[_0x3d8e('0x37')][_0x3d8e('0x3a')]?_0x96ec14[_0x3d8e('0x37')]:_0x21905e[_0x3d8e('0x32')];_0x96ec14[_0x3d8e('0x3c')]=qs[_0x3d8e('0x3d')](_0x17563f[_0x3d8e('0x34')][_0x3d8e('0x3d')]);_0x96ec14[_0x3d8e('0x3e')]=qs[_0x3d8e('0x36')](_[_0x3d8e('0x3f')](_0x17563f['query'],_0x21905e[_0x3d8e('0x36')]));if(_0x17563f[_0x3d8e('0x34')][_0x3d8e('0x40')]){_0x96ec14['where']=_[_0x3d8e('0x41')](_0x96ec14[_0x3d8e('0x3e')],{'$or':_[_0x3d8e('0x33')](_0x96ec14[_0x3d8e('0x37')],function(_0x515a6f){var _0x4f96d7={};_0x4f96d7[_0x515a6f]={'$like':'%'+_0x17563f['query']['filter']+'%'};return _0x4f96d7;})});}_0x96ec14=_[_0x3d8e('0x41')]({},_0x96ec14,_0x17563f[_0x3d8e('0x42')]);return _0x1ad9f0['getDescriptions'](_0x96ec14);}})[_0x3d8e('0x25')](function(_0x5395bc){if(_0x5395bc){_0x4c95de=_0x5395bc['length'];if(!_0x17563f[_0x3d8e('0x34')][_0x3d8e('0x3b')]('nolimit')){_0x96ec14[_0x3d8e('0x1e')]=qs[_0x3d8e('0x1e')](_0x17563f[_0x3d8e('0x34')][_0x3d8e('0x1e')]);_0x96ec14[_0x3d8e('0x20')]=qs[_0x3d8e('0x20')](_0x17563f['query'][_0x3d8e('0x20')]);}return _0x1ad9f0['getDescriptions'](_0x96ec14);}})[_0x3d8e('0x25')](function(_0x16b194){if(_0x16b194){return _0x16b194?{'count':_0x4c95de,'rows':_0x16b194}:null;}})[_0x3d8e('0x25')](respondWithResult(_0x5c175a,null))[_0x3d8e('0x47')](handleError(_0x5c175a,null));};exports['getFields']=function(_0x4b60e8,_0x1fdd4a,_0x56936f){var _0x1796e6={};var _0x1a7ac3={};var _0x5dce1a;var _0x278eb6;return db['FreshsalesConfiguration'][_0x3d8e('0x4c')]({'where':{'id':_0x4b60e8['params']['id']}})[_0x3d8e('0x25')](handleEntityNotFound(_0x1fdd4a,null))['then'](function(_0x10ef8c){if(_0x10ef8c){_0x5dce1a=_0x10ef8c;_0x1a7ac3['model']=_[_0x3d8e('0x35')](db[_0x3d8e('0x4f')][_0x3d8e('0x2e')]);_0x1a7ac3[_0x3d8e('0x34')]=_[_0x3d8e('0x35')](_0x4b60e8[_0x3d8e('0x34')]);_0x1a7ac3[_0x3d8e('0x36')]=_[_0x3d8e('0x38')](_0x1a7ac3[_0x3d8e('0x32')],_0x1a7ac3[_0x3d8e('0x34')]);_0x1796e6[_0x3d8e('0x37')]=_[_0x3d8e('0x38')](_0x1a7ac3[_0x3d8e('0x32')],qs[_0x3d8e('0x39')](_0x4b60e8['query'][_0x3d8e('0x39')]));_0x1796e6[_0x3d8e('0x37')]=_0x1796e6['attributes'][_0x3d8e('0x3a')]?_0x1796e6[_0x3d8e('0x37')]:_0x1a7ac3['model'];_0x1796e6[_0x3d8e('0x3c')]=qs['sort'](_0x4b60e8['query']['sort']);_0x1796e6[_0x3d8e('0x3e')]=qs[_0x3d8e('0x36')](_['pick'](_0x4b60e8[_0x3d8e('0x34')],_0x1a7ac3['filters']));if(_0x4b60e8[_0x3d8e('0x34')][_0x3d8e('0x40')]){_0x1796e6['where']=_[_0x3d8e('0x41')](_0x1796e6['where'],{'$or':_[_0x3d8e('0x33')](_0x1796e6[_0x3d8e('0x37')],function(_0x2715cf){var _0x491a91={};_0x491a91[_0x2715cf]={'$like':'%'+_0x4b60e8['query'][_0x3d8e('0x40')]+'%'};return _0x491a91;})});}_0x1796e6=_['merge']({},_0x1796e6,_0x4b60e8[_0x3d8e('0x42')]);return _0x5dce1a['getFields'](_0x1796e6);}})[_0x3d8e('0x25')](function(_0x37697d){if(_0x37697d){_0x278eb6=_0x37697d['length'];if(!_0x4b60e8[_0x3d8e('0x34')][_0x3d8e('0x3b')](_0x3d8e('0x4d'))){_0x1796e6[_0x3d8e('0x1e')]=qs[_0x3d8e('0x1e')](_0x4b60e8['query'][_0x3d8e('0x1e')]);_0x1796e6[_0x3d8e('0x20')]=qs[_0x3d8e('0x20')](_0x4b60e8[_0x3d8e('0x34')]['offset']);}return _0x5dce1a['getFields'](_0x1796e6);}})[_0x3d8e('0x25')](function(_0x3990b9){if(_0x3990b9){return _0x3990b9?{'count':_0x278eb6,'rows':_0x3990b9}:null;}})[_0x3d8e('0x25')](respondWithResult(_0x1fdd4a,null))[_0x3d8e('0x47')](handleError(_0x1fdd4a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index bcd84ca..ca8a4a2 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 _0x915b=['./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x16f899,_0x1ce7d6){var _0xfbca90=function(_0x4c7edb){while(--_0x4c7edb){_0x16f899['push'](_0x16f899['shift']());}};_0xfbca90(++_0x1ce7d6);}(_0x915b,0x1a8));var _0xb915=function(_0x5bf7ba,_0x142806){_0x5bf7ba=_0x5bf7ba-0x0;var _0x5c90d5=_0x915b[_0x5bf7ba];return _0x5c90d5;};'use strict';var _=require(_0xb915('0x0'));var util=require(_0xb915('0x1'));var logger=require(_0xb915('0x2'))(_0xb915('0x3'));var moment=require(_0xb915('0x4'));var BPromise=require(_0xb915('0x5'));var rp=require(_0xb915('0x6'));var fs=require('fs');var path=require(_0xb915('0x7'));var rimraf=require(_0xb915('0x8'));var config=require(_0xb915('0x9'));var attributes=require(_0xb915('0xa'));module['exports']=function(_0x5e30f1,_0xe73b4e){return _0x5e30f1[_0xb915('0xb')](_0xb915('0xc'),attributes,{'tableName':_0xb915('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c3c=['FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8c3c,0x1d6));var _0xc8c3=function(_0xac4876,_0x448644){_0xac4876=_0xac4876-0x0;var _0x2df664=_0x8c3c[_0xac4876];return _0x2df664;};'use strict';var _=require(_0xc8c3('0x0'));var util=require('util');var logger=require(_0xc8c3('0x1'))('api');var moment=require(_0xc8c3('0x2'));var BPromise=require(_0xc8c3('0x3'));var rp=require(_0xc8c3('0x4'));var fs=require('fs');var path=require(_0xc8c3('0x5'));var rimraf=require(_0xc8c3('0x6'));var config=require(_0xc8c3('0x7'));var attributes=require(_0xc8c3('0x8'));module[_0xc8c3('0x9')]=function(_0xc5f4d6,_0x13e4d8){return _0xc5f4d6[_0xc8c3('0xa')](_0xc8c3('0xb'),attributes,{'tableName':_0xc8c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 6f379c4..6f5d10d 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 _0x0894=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2e7027,_0x2817d6){var _0x4a6f24=function(_0x295508){while(--_0x295508){_0x2e7027['push'](_0x2e7027['shift']());}};_0x4a6f24(++_0x2817d6);}(_0x0894,0x157));var _0x4089=function(_0x2b7149,_0x428ded){_0x2b7149=_0x2b7149-0x0;var _0x2f599b=_0x0894[_0x2b7149];return _0x2f599b;};'use strict';var _=require(_0x4089('0x0'));var util=require(_0x4089('0x1'));var moment=require(_0x4089('0x2'));var BPromise=require(_0x4089('0x3'));var rs=require(_0x4089('0x4'));var fs=require('fs');var Redis=require(_0x4089('0x5'));var db=require(_0x4089('0x6'))['db'];var utils=require(_0x4089('0x7'));var logger=require(_0x4089('0x8'))(_0x4089('0x9'));var config=require('../../config/environment');var jayson=require(_0x4089('0xa'));var client=jayson[_0x4089('0xb')][_0x4089('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5745bf,_0x21b4dd,_0x3534b2){return new BPromise(function(_0x16fa58,_0x5074ec){return client[_0x4089('0xd')](_0x5745bf,_0x3534b2)['then'](function(_0x5aedbf){logger['info'](_0x4089('0xe'),_0x21b4dd,_0x4089('0xf'));logger[_0x4089('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x21b4dd,_0x4089('0xf'),JSON[_0x4089('0x11')](_0x5aedbf));if(_0x5aedbf[_0x4089('0x12')]){if(_0x5aedbf['error'][_0x4089('0x13')]===0x1f4){logger[_0x4089('0x12')](_0x4089('0xe'),_0x21b4dd,_0x5aedbf[_0x4089('0x12')][_0x4089('0x14')]);return _0x5074ec(_0x5aedbf[_0x4089('0x12')][_0x4089('0x14')]);}logger[_0x4089('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x21b4dd,_0x5aedbf['error'][_0x4089('0x14')]);return _0x16fa58(_0x5aedbf[_0x4089('0x12')]['message']);}else{logger['info'](_0x4089('0xe'),_0x21b4dd,_0x4089('0xf'));_0x16fa58(_0x5aedbf[_0x4089('0x15')]['message']);}})[_0x4089('0x16')](function(_0x5da30d){logger[_0x4089('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x21b4dd,_0x5da30d);_0x5074ec(_0x5da30d);});});} \ No newline at end of file +var _0x8bb1=['stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x343828,_0x455568){var _0x124ddf=function(_0x59067b){while(--_0x59067b){_0x343828['push'](_0x343828['shift']());}};_0x124ddf(++_0x455568);}(_0x8bb1,0x149));var _0x18bb=function(_0x5e3beb,_0x208810){_0x5e3beb=_0x5e3beb-0x0;var _0x417a75=_0x8bb1[_0x5e3beb];return _0x417a75;};'use strict';var _=require('lodash');var util=require(_0x18bb('0x0'));var moment=require('moment');var BPromise=require(_0x18bb('0x1'));var rs=require(_0x18bb('0x2'));var fs=require('fs');var Redis=require(_0x18bb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x18bb('0x4'));var logger=require(_0x18bb('0x5'))(_0x18bb('0x6'));var config=require('../../config/environment');var jayson=require(_0x18bb('0x7'));var client=jayson[_0x18bb('0x8')][_0x18bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19bf88,_0x4532ab,_0x4976a6){return new BPromise(function(_0x56d17c,_0x1081f3){return client[_0x18bb('0xa')](_0x19bf88,_0x4976a6)[_0x18bb('0xb')](function(_0x24467f){logger[_0x18bb('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4532ab,'request\x20sent');logger[_0x18bb('0xd')](_0x18bb('0xe'),_0x4532ab,_0x18bb('0xf'),JSON[_0x18bb('0x10')](_0x24467f));if(_0x24467f[_0x18bb('0x11')]){if(_0x24467f['error'][_0x18bb('0x12')]===0x1f4){logger[_0x18bb('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4532ab,_0x24467f[_0x18bb('0x11')][_0x18bb('0x13')]);return _0x1081f3(_0x24467f[_0x18bb('0x11')]['message']);}logger[_0x18bb('0x11')](_0x18bb('0x14'),_0x4532ab,_0x24467f[_0x18bb('0x11')][_0x18bb('0x13')]);return _0x56d17c(_0x24467f[_0x18bb('0x11')][_0x18bb('0x13')]);}else{logger[_0x18bb('0xc')](_0x18bb('0x14'),_0x4532ab,_0x18bb('0xf'));_0x56d17c(_0x24467f[_0x18bb('0x15')][_0x18bb('0x13')]);}})[_0x18bb('0x16')](function(_0x4ba537){logger[_0x18bb('0x11')](_0x18bb('0x14'),_0x4532ab,_0x4ba537);_0x1081f3(_0x4ba537);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 87a51b5..9a3f992 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 _0x136c=['show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated'];(function(_0x26b6f3,_0x44f01c){var _0xcbdfe0=function(_0x53f7ce){while(--_0x53f7ce){_0x26b6f3['push'](_0x26b6f3['shift']());}};_0xcbdfe0(++_0x44f01c);}(_0x136c,0x1d2));var _0xc136=function(_0x58c459,_0x2ee065){_0x58c459=_0x58c459-0x0;var _0x232780=_0x136c[_0x58c459];return _0x232780;};'use strict';var multer=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var path=require('path');var timeout=require(_0xc136('0x2'));var express=require(_0xc136('0x3'));var router=express[_0xc136('0x4')]();var fs_extra=require(_0xc136('0x5'));var auth=require(_0xc136('0x6'));var interaction=require(_0xc136('0x7'));var config=require(_0xc136('0x8'));var controller=require(_0xc136('0x9'));router[_0xc136('0xa')]('/',auth['isAuthenticated'](),controller[_0xc136('0xb')]);router['get'](_0xc136('0xc'),auth[_0xc136('0xd')](),controller[_0xc136('0xe')]);router['post']('/',auth[_0xc136('0xd')](),controller['create']);router[_0xc136('0xf')](_0xc136('0xc'),auth[_0xc136('0xd')](),controller[_0xc136('0x10')]);router[_0xc136('0x11')](_0xc136('0xc'),auth[_0xc136('0xd')](),controller[_0xc136('0x12')]);module[_0xc136('0x13')]=router; \ No newline at end of file +var _0xbb95=['Router','../../components/auth/service','get','isAuthenticated','/:id','post','create','put','update','delete','multer','util','express'];(function(_0x179922,_0x29cbea){var _0x57c9d3=function(_0x25288d){while(--_0x25288d){_0x179922['push'](_0x179922['shift']());}};_0x57c9d3(++_0x29cbea);}(_0xbb95,0x7f));var _0x5bb9=function(_0x277e28,_0x469e21){_0x277e28=_0x277e28-0x0;var _0x39b502=_0xbb95[_0x277e28];return _0x39b502;};'use strict';var multer=require(_0x5bb9('0x0'));var util=require(_0x5bb9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5bb9('0x2'));var router=express[_0x5bb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5bb9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x5bb9('0x5')]('/',auth[_0x5bb9('0x6')](),controller['index']);router[_0x5bb9('0x5')](_0x5bb9('0x7'),auth[_0x5bb9('0x6')](),controller['show']);router[_0x5bb9('0x8')]('/',auth[_0x5bb9('0x6')](),controller[_0x5bb9('0x9')]);router[_0x5bb9('0xa')](_0x5bb9('0x7'),auth[_0x5bb9('0x6')](),controller[_0x5bb9('0xb')]);router[_0x5bb9('0xc')](_0x5bb9('0x7'),auth[_0x5bb9('0x6')](),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 e3741a2..9d743d5 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 _0xd9cb=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0xd9cb,0x84));var _0xbd9c=function(_0x4345be,_0x1e1dd6){_0x4345be=_0x4345be-0x0;var _0xf851a1=_0xd9cb[_0x4345be];return _0xf851a1;};'use strict';var Sequelize=require(_0xbd9c('0x0'));module[_0xbd9c('0x1')]={'type':{'type':Sequelize[_0xbd9c('0x2')](_0xbd9c('0x3'),'variable',_0xbd9c('0x4'),_0xbd9c('0x5'),_0xbd9c('0x6')),'defaultValue':_0xbd9c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbd9c('0x7')]},'keyType':{'type':Sequelize[_0xbd9c('0x2')]('string',_0xbd9c('0x8'),_0xbd9c('0x4'))},'keyContent':{'type':Sequelize[_0xbd9c('0x7')]},'idField':{'type':Sequelize[_0xbd9c('0x7')]},'nameField':{'type':Sequelize[_0xbd9c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd9c('0x7')]}}; \ No newline at end of file +var _0xfd54=['exports','ENUM','variable','keyValue','picklist','string','STRING','customVariable','BOOLEAN','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfd54,0x15d));var _0x4fd5=function(_0x34eddf,_0x386e8a){_0x34eddf=_0x34eddf-0x0;var _0x2e87ee=_0xfd54[_0x34eddf];return _0x2e87ee;};'use strict';var Sequelize=require(_0x4fd5('0x0'));module[_0x4fd5('0x1')]={'type':{'type':Sequelize[_0x4fd5('0x2')]('string',_0x4fd5('0x3'),'customVariable',_0x4fd5('0x4'),_0x4fd5('0x5')),'defaultValue':_0x4fd5('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4fd5('0x7')]},'keyType':{'type':Sequelize[_0x4fd5('0x2')](_0x4fd5('0x6'),'variable',_0x4fd5('0x8'))},'keyContent':{'type':Sequelize[_0x4fd5('0x7')]},'idField':{'type':Sequelize[_0x4fd5('0x7')]},'nameField':{'type':Sequelize[_0x4fd5('0x7')]},'customField':{'type':Sequelize[_0x4fd5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4fd5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 43a1b95..2df8fbf 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 _0xa26f=['zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','update','find','eml-format','rimraf'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa26f,0x18a));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfa26('0x0'));var rimraf=require(_0xfa26('0x1'));var zipdir=require(_0xfa26('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa26('0x3'));var BPromise=require(_0xfa26('0x4'));var Mustache=require('mustache');var util=require(_0xfa26('0x5'));var path=require(_0xfa26('0x6'));var sox=require(_0xfa26('0x7'));var csv=require('to-csv');var ejs=require(_0xfa26('0x8'));var fs=require('fs');var fs_extra=require(_0xfa26('0x9'));var _=require(_0xfa26('0xa'));var squel=require(_0xfa26('0xb'));var crypto=require(_0xfa26('0xc'));var jsforce=require(_0xfa26('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfa26('0xe'));var querystring=require('querystring');var Papa=require(_0xfa26('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa26('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa26('0x11'));var utils=require(_0xfa26('0x12'));var config=require(_0xfa26('0x13'));var licenseUtil=require(_0xfa26('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18f588,_0x1bbde6){_0x1bbde6=_0x1bbde6||0xcc;return function(_0x2adb31){if(_0x2adb31){return _0x18f588[_0xfa26('0x15')](_0x1bbde6);}return _0x18f588[_0xfa26('0x16')](_0x1bbde6)[_0xfa26('0x17')]();};}function respondWithResult(_0x2a3aa0,_0x455ab5){_0x455ab5=_0x455ab5||0xc8;return function(_0x4fcfc9){if(_0x4fcfc9){return _0x2a3aa0['status'](_0x455ab5)['json'](_0x4fcfc9);}};}function respondWithFilteredResult(_0x4ed2f0,_0x3fdcc7){return function(_0x459119){if(_0x459119){var _0x3dd3b5=typeof _0x3fdcc7[_0xfa26('0x18')]===_0xfa26('0x19')&&typeof _0x3fdcc7[_0xfa26('0x1a')]===_0xfa26('0x19');var _0x1b0280=_0x459119[_0xfa26('0x1b')];var _0x2d4a35=_0x3dd3b5?0x0:_0x3fdcc7[_0xfa26('0x18')];var _0x336aef=_0x3dd3b5?_0x459119[_0xfa26('0x1b')]:_0x3fdcc7[_0xfa26('0x18')]+_0x3fdcc7[_0xfa26('0x1a')];var _0x339ed7;if(_0x336aef>=_0x1b0280){_0x336aef=_0x1b0280;_0x339ed7=0xc8;}else{_0x339ed7=0xce;}_0x4ed2f0[_0xfa26('0x16')](_0x339ed7);return _0x4ed2f0[_0xfa26('0x1c')](_0xfa26('0x1d'),_0x2d4a35+'-'+_0x336aef+'/'+_0x1b0280)['json'](_0x459119);}return null;};}function patchUpdates(_0x4982b9){return function(_0x459f9f){try{jsonpatch[_0xfa26('0x1e')](_0x459f9f,_0x4982b9,!![]);}catch(_0x5cf4d0){return BPromise['reject'](_0x5cf4d0);}return _0x459f9f['save']();};}function saveUpdates(_0x27eb1c,_0x3167dd){return function(_0x3e3f05){if(_0x3e3f05){return _0x3e3f05['update'](_0x27eb1c)[_0xfa26('0x1f')](function(_0x3c17c2){return _0x3c17c2;});}return null;};}function removeEntity(_0xfea9cd,_0x447989){return function(_0x12c675){if(_0x12c675){return _0x12c675[_0xfa26('0x20')]()[_0xfa26('0x1f')](function(){_0xfea9cd[_0xfa26('0x16')](0xcc)[_0xfa26('0x17')]();});}};}function handleEntityNotFound(_0x1ce0d5,_0x27f79e){return function(_0x29a5a4){if(!_0x29a5a4){_0x1ce0d5[_0xfa26('0x15')](0x194);}return _0x29a5a4;};}function handleError(_0x170abb,_0x3b2137){_0x3b2137=_0x3b2137||0x1f4;return function(_0xde5d1e){logger[_0xfa26('0x21')](_0xde5d1e[_0xfa26('0x22')]);if(_0xde5d1e[_0xfa26('0x23')]){delete _0xde5d1e['name'];}_0x170abb[_0xfa26('0x16')](_0x3b2137)[_0xfa26('0x24')](_0xde5d1e);};}exports[_0xfa26('0x25')]=function(_0x25f72f,_0x898ff7){var _0x3ae0f5={},_0x18de77={},_0x5a889b={'count':0x0,'rows':[]};var _0x5d3753=_[_0xfa26('0x26')](db[_0xfa26('0x27')][_0xfa26('0x28')],function(_0x4aa00e){return{'name':_0x4aa00e[_0xfa26('0x29')],'type':_0x4aa00e[_0xfa26('0x2a')]['key']};});_0x18de77[_0xfa26('0x2b')]=_[_0xfa26('0x26')](_0x5d3753,'name');_0x18de77[_0xfa26('0x2c')]=_[_0xfa26('0x2d')](_0x25f72f['query']);_0x18de77[_0xfa26('0x2e')]=_['intersection'](_0x18de77[_0xfa26('0x2b')],_0x18de77[_0xfa26('0x2c')]);_0x3ae0f5[_0xfa26('0x2f')]=_[_0xfa26('0x30')](_0x18de77[_0xfa26('0x2b')],qs[_0xfa26('0x31')](_0x25f72f[_0xfa26('0x2c')][_0xfa26('0x31')]));_0x3ae0f5[_0xfa26('0x2f')]=_0x3ae0f5[_0xfa26('0x2f')][_0xfa26('0x32')]?_0x3ae0f5['attributes']:_0x18de77[_0xfa26('0x2b')];if(!_0x25f72f[_0xfa26('0x2c')]['hasOwnProperty']('nolimit')){_0x3ae0f5['limit']=qs[_0xfa26('0x1a')](_0x25f72f[_0xfa26('0x2c')]['limit']);_0x3ae0f5[_0xfa26('0x18')]=qs['offset'](_0x25f72f[_0xfa26('0x2c')]['offset']);}_0x3ae0f5['order']=qs[_0xfa26('0x33')](_0x25f72f[_0xfa26('0x2c')][_0xfa26('0x33')]);_0x3ae0f5['where']=qs[_0xfa26('0x2e')](_[_0xfa26('0x34')](_0x25f72f[_0xfa26('0x2c')],_0x18de77['filters']),_0x5d3753);if(_0x25f72f[_0xfa26('0x2c')]['filter']){_0x3ae0f5[_0xfa26('0x35')]=_[_0xfa26('0x36')](_0x3ae0f5['where'],{'$or':_[_0xfa26('0x26')](_0x5d3753,function(_0x1f1396){if(_0x1f1396[_0xfa26('0x2a')]!==_0xfa26('0x37')){var _0x50245e={};_0x50245e[_0x1f1396[_0xfa26('0x23')]]={'$like':'%'+_0x25f72f[_0xfa26('0x2c')]['filter']+'%'};return _0x50245e;}})});}_0x3ae0f5=_[_0xfa26('0x36')]({},_0x3ae0f5,_0x25f72f[_0xfa26('0x38')]);var _0x1d7e9b={'where':_0x3ae0f5[_0xfa26('0x35')]};return db[_0xfa26('0x27')][_0xfa26('0x1b')](_0x1d7e9b)[_0xfa26('0x1f')](function(_0x4c2908){_0x5a889b[_0xfa26('0x1b')]=_0x4c2908;if(_0x25f72f[_0xfa26('0x2c')][_0xfa26('0x39')]){_0x3ae0f5[_0xfa26('0x3a')]=[{'all':!![]}];}return db[_0xfa26('0x27')]['findAll'](_0x3ae0f5);})['then'](function(_0x4f4d16){_0x5a889b[_0xfa26('0x3b')]=_0x4f4d16;return _0x5a889b;})['then'](respondWithFilteredResult(_0x898ff7,_0x3ae0f5))[_0xfa26('0x3c')](handleError(_0x898ff7,null));};exports['show']=function(_0x3620df,_0x417505){var _0x22edf4={'raw':!![],'where':{'id':_0x3620df[_0xfa26('0x3d')]['id']}},_0x2c740d={};_0x2c740d[_0xfa26('0x2b')]=_[_0xfa26('0x2d')](db[_0xfa26('0x27')][_0xfa26('0x28')]);_0x2c740d[_0xfa26('0x2c')]=_[_0xfa26('0x2d')](_0x3620df['query']);_0x2c740d[_0xfa26('0x2e')]=_[_0xfa26('0x30')](_0x2c740d[_0xfa26('0x2b')],_0x2c740d[_0xfa26('0x2c')]);_0x22edf4[_0xfa26('0x2f')]=_[_0xfa26('0x30')](_0x2c740d[_0xfa26('0x2b')],qs[_0xfa26('0x31')](_0x3620df['query'][_0xfa26('0x31')]));_0x22edf4[_0xfa26('0x2f')]=_0x22edf4[_0xfa26('0x2f')][_0xfa26('0x32')]?_0x22edf4[_0xfa26('0x2f')]:_0x2c740d['model'];if(_0x3620df[_0xfa26('0x2c')]['includeAll']){_0x22edf4[_0xfa26('0x3a')]=[{'all':!![]}];}_0x22edf4=_[_0xfa26('0x36')]({},_0x22edf4,_0x3620df[_0xfa26('0x38')]);return db[_0xfa26('0x27')]['find'](_0x22edf4)[_0xfa26('0x1f')](handleEntityNotFound(_0x417505,null))[_0xfa26('0x1f')](respondWithResult(_0x417505,null))[_0xfa26('0x3c')](handleError(_0x417505,null));};exports[_0xfa26('0x3e')]=function(_0x501f0b,_0x35d370){return db[_0xfa26('0x27')]['create'](_0x501f0b[_0xfa26('0x3f')],{})[_0xfa26('0x1f')](respondWithResult(_0x35d370,0xc9))[_0xfa26('0x3c')](handleError(_0x35d370,null));};exports[_0xfa26('0x40')]=function(_0x3e1ba2,_0x3f1f3a){if(_0x3e1ba2['body']['id']){delete _0x3e1ba2['body']['id'];}return db['FreshsalesField'][_0xfa26('0x41')]({'where':{'id':_0x3e1ba2[_0xfa26('0x3d')]['id']}})[_0xfa26('0x1f')](handleEntityNotFound(_0x3f1f3a,null))[_0xfa26('0x1f')](saveUpdates(_0x3e1ba2['body'],null))[_0xfa26('0x1f')](respondWithResult(_0x3f1f3a,null))['catch'](handleError(_0x3f1f3a,null));};exports[_0xfa26('0x20')]=function(_0x2ba98b,_0x1632e0){return db['FreshsalesField'][_0xfa26('0x41')]({'where':{'id':_0x2ba98b['params']['id']}})[_0xfa26('0x1f')](handleEntityNotFound(_0x1632e0,null))[_0xfa26('0x1f')](removeEntity(_0x1632e0,null))['catch'](handleError(_0x1632e0,null));}; \ No newline at end of file +var _0x623d=['create','body','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','end','error','stack','name','send','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','includeAll','include','find'];(function(_0xd4dab0,_0x58143e){var _0x1e8c6e=function(_0x1fc5eb){while(--_0x1fc5eb){_0xd4dab0['push'](_0xd4dab0['shift']());}};_0x1e8c6e(++_0x58143e);}(_0x623d,0x1f4));var _0xd623=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x623d[_0x1e3c16];return _0x47a0c9;};'use strict';var emlformat=require(_0xd623('0x0'));var rimraf=require(_0xd623('0x1'));var zipdir=require(_0xd623('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd623('0x3'));var moment=require('moment');var BPromise=require(_0xd623('0x4'));var Mustache=require(_0xd623('0x5'));var util=require(_0xd623('0x6'));var path=require(_0xd623('0x7'));var sox=require('sox');var csv=require(_0xd623('0x8'));var ejs=require(_0xd623('0x9'));var fs=require('fs');var fs_extra=require(_0xd623('0xa'));var _=require(_0xd623('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd623('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd623('0x8'));var querystring=require(_0xd623('0xd'));var Papa=require('papaparse');var Redis=require(_0xd623('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd623('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd623('0x10'));var logger=require('../../config/logger')(_0xd623('0x11'));var utils=require('../../config/utils');var config=require(_0xd623('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd623('0x13'))['db'];function respondWithStatusCode(_0x3f759e,_0x472b58){_0x472b58=_0x472b58||0xcc;return function(_0x47f62b){if(_0x47f62b){return _0x3f759e[_0xd623('0x14')](_0x472b58);}return _0x3f759e[_0xd623('0x15')](_0x472b58)['end']();};}function respondWithResult(_0x5df819,_0x4d525e){_0x4d525e=_0x4d525e||0xc8;return function(_0xedd2d4){if(_0xedd2d4){return _0x5df819[_0xd623('0x15')](_0x4d525e)[_0xd623('0x16')](_0xedd2d4);}};}function respondWithFilteredResult(_0x5a691c,_0x4bf036){return function(_0x1d7d11){if(_0x1d7d11){var _0x3c1a50=typeof _0x4bf036[_0xd623('0x17')]===_0xd623('0x18')&&typeof _0x4bf036[_0xd623('0x19')]===_0xd623('0x18');var _0x15c7f5=_0x1d7d11[_0xd623('0x1a')];var _0x1b8aa9=_0x3c1a50?0x0:_0x4bf036[_0xd623('0x17')];var _0x1f0f74=_0x3c1a50?_0x1d7d11[_0xd623('0x1a')]:_0x4bf036['offset']+_0x4bf036[_0xd623('0x19')];var _0x8c63d9;if(_0x1f0f74>=_0x15c7f5){_0x1f0f74=_0x15c7f5;_0x8c63d9=0xc8;}else{_0x8c63d9=0xce;}_0x5a691c[_0xd623('0x15')](_0x8c63d9);return _0x5a691c[_0xd623('0x1b')](_0xd623('0x1c'),_0x1b8aa9+'-'+_0x1f0f74+'/'+_0x15c7f5)[_0xd623('0x16')](_0x1d7d11);}return null;};}function patchUpdates(_0x46afb0){return function(_0x4b20b3){try{jsonpatch['apply'](_0x4b20b3,_0x46afb0,!![]);}catch(_0x1f1ac6){return BPromise[_0xd623('0x1d')](_0x1f1ac6);}return _0x4b20b3[_0xd623('0x1e')]();};}function saveUpdates(_0x14223f,_0x254d8c){return function(_0xae69d3){if(_0xae69d3){return _0xae69d3['update'](_0x14223f)['then'](function(_0x4adbf6){return _0x4adbf6;});}return null;};}function removeEntity(_0x16bd2b,_0x40e00b){return function(_0x5e0516){if(_0x5e0516){return _0x5e0516[_0xd623('0x1f')]()[_0xd623('0x20')](function(){_0x16bd2b['status'](0xcc)[_0xd623('0x21')]();});}};}function handleEntityNotFound(_0x2131de,_0x62df73){return function(_0x57f619){if(!_0x57f619){_0x2131de[_0xd623('0x14')](0x194);}return _0x57f619;};}function handleError(_0x16713d,_0x2d3808){_0x2d3808=_0x2d3808||0x1f4;return function(_0x355655){logger[_0xd623('0x22')](_0x355655[_0xd623('0x23')]);if(_0x355655[_0xd623('0x24')]){delete _0x355655['name'];}_0x16713d[_0xd623('0x15')](_0x2d3808)[_0xd623('0x25')](_0x355655);};}exports[_0xd623('0x26')]=function(_0x40f8cb,_0x18946){var _0x42d5fa={},_0x100c4f={},_0xb4cb81={'count':0x0,'rows':[]};var _0x44aece=_[_0xd623('0x27')](db[_0xd623('0x28')][_0xd623('0x29')],function(_0x26580d){return{'name':_0x26580d['fieldName'],'type':_0x26580d[_0xd623('0x2a')][_0xd623('0x2b')]};});_0x100c4f[_0xd623('0x2c')]=_[_0xd623('0x27')](_0x44aece,_0xd623('0x24'));_0x100c4f[_0xd623('0x2d')]=_[_0xd623('0x2e')](_0x40f8cb[_0xd623('0x2d')]);_0x100c4f[_0xd623('0x2f')]=_[_0xd623('0x30')](_0x100c4f[_0xd623('0x2c')],_0x100c4f['query']);_0x42d5fa[_0xd623('0x31')]=_[_0xd623('0x30')](_0x100c4f[_0xd623('0x2c')],qs[_0xd623('0x32')](_0x40f8cb[_0xd623('0x2d')][_0xd623('0x32')]));_0x42d5fa[_0xd623('0x31')]=_0x42d5fa[_0xd623('0x31')][_0xd623('0x33')]?_0x42d5fa[_0xd623('0x31')]:_0x100c4f['model'];if(!_0x40f8cb[_0xd623('0x2d')]['hasOwnProperty'](_0xd623('0x34'))){_0x42d5fa[_0xd623('0x19')]=qs[_0xd623('0x19')](_0x40f8cb[_0xd623('0x2d')][_0xd623('0x19')]);_0x42d5fa[_0xd623('0x17')]=qs['offset'](_0x40f8cb[_0xd623('0x2d')][_0xd623('0x17')]);}_0x42d5fa[_0xd623('0x35')]=qs[_0xd623('0x36')](_0x40f8cb[_0xd623('0x2d')][_0xd623('0x36')]);_0x42d5fa[_0xd623('0x37')]=qs[_0xd623('0x2f')](_[_0xd623('0x38')](_0x40f8cb[_0xd623('0x2d')],_0x100c4f[_0xd623('0x2f')]),_0x44aece);if(_0x40f8cb[_0xd623('0x2d')][_0xd623('0x39')]){_0x42d5fa[_0xd623('0x37')]=_['merge'](_0x42d5fa[_0xd623('0x37')],{'$or':_[_0xd623('0x27')](_0x44aece,function(_0x1fcef9){if(_0x1fcef9[_0xd623('0x2a')]!==_0xd623('0x3a')){var _0x58433a={};_0x58433a[_0x1fcef9[_0xd623('0x24')]]={'$like':'%'+_0x40f8cb[_0xd623('0x2d')][_0xd623('0x39')]+'%'};return _0x58433a;}})});}_0x42d5fa=_[_0xd623('0x3b')]({},_0x42d5fa,_0x40f8cb[_0xd623('0x3c')]);var _0xbb8858={'where':_0x42d5fa[_0xd623('0x37')]};return db[_0xd623('0x28')][_0xd623('0x1a')](_0xbb8858)[_0xd623('0x20')](function(_0x2f44c7){_0xb4cb81['count']=_0x2f44c7;if(_0x40f8cb[_0xd623('0x2d')]['includeAll']){_0x42d5fa['include']=[{'all':!![]}];}return db['FreshsalesField'][_0xd623('0x3d')](_0x42d5fa);})[_0xd623('0x20')](function(_0x446fa3){_0xb4cb81[_0xd623('0x3e')]=_0x446fa3;return _0xb4cb81;})[_0xd623('0x20')](respondWithFilteredResult(_0x18946,_0x42d5fa))[_0xd623('0x3f')](handleError(_0x18946,null));};exports['show']=function(_0x39135f,_0x2d390b){var _0x38ef30={'raw':!![],'where':{'id':_0x39135f[_0xd623('0x40')]['id']}},_0x40c365={};_0x40c365[_0xd623('0x2c')]=_[_0xd623('0x2e')](db['FreshsalesField'][_0xd623('0x29')]);_0x40c365[_0xd623('0x2d')]=_['keys'](_0x39135f[_0xd623('0x2d')]);_0x40c365[_0xd623('0x2f')]=_[_0xd623('0x30')](_0x40c365[_0xd623('0x2c')],_0x40c365[_0xd623('0x2d')]);_0x38ef30[_0xd623('0x31')]=_[_0xd623('0x30')](_0x40c365['model'],qs[_0xd623('0x32')](_0x39135f[_0xd623('0x2d')][_0xd623('0x32')]));_0x38ef30[_0xd623('0x31')]=_0x38ef30['attributes']['length']?_0x38ef30[_0xd623('0x31')]:_0x40c365[_0xd623('0x2c')];if(_0x39135f[_0xd623('0x2d')][_0xd623('0x41')]){_0x38ef30[_0xd623('0x42')]=[{'all':!![]}];}_0x38ef30=_[_0xd623('0x3b')]({},_0x38ef30,_0x39135f[_0xd623('0x3c')]);return db[_0xd623('0x28')][_0xd623('0x43')](_0x38ef30)[_0xd623('0x20')](handleEntityNotFound(_0x2d390b,null))[_0xd623('0x20')](respondWithResult(_0x2d390b,null))[_0xd623('0x3f')](handleError(_0x2d390b,null));};exports['create']=function(_0x1f145f,_0xd5534a){return db[_0xd623('0x28')][_0xd623('0x44')](_0x1f145f[_0xd623('0x45')],{})[_0xd623('0x20')](respondWithResult(_0xd5534a,0xc9))[_0xd623('0x3f')](handleError(_0xd5534a,null));};exports[_0xd623('0x46')]=function(_0xa9eb68,_0x584ab4){if(_0xa9eb68[_0xd623('0x45')]['id']){delete _0xa9eb68[_0xd623('0x45')]['id'];}return db[_0xd623('0x28')][_0xd623('0x43')]({'where':{'id':_0xa9eb68[_0xd623('0x40')]['id']}})[_0xd623('0x20')](handleEntityNotFound(_0x584ab4,null))[_0xd623('0x20')](saveUpdates(_0xa9eb68[_0xd623('0x45')],null))['then'](respondWithResult(_0x584ab4,null))['catch'](handleError(_0x584ab4,null));};exports[_0xd623('0x1f')]=function(_0x240f87,_0x25c1ed){return db[_0xd623('0x28')][_0xd623('0x43')]({'where':{'id':_0x240f87['params']['id']}})[_0xd623('0x20')](handleEntityNotFound(_0x25c1ed,null))[_0xd623('0x20')](removeEntity(_0x25c1ed,null))['catch'](handleError(_0x25c1ed,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 39c494d..2bd22f6 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 _0x5523=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','idField','FieldId','../../config/logger'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0x5523,0x137));var _0x3552=function(_0x19795d,_0x5f0b16){_0x19795d=_0x19795d-0x0;var _0x9a6cbb=_0x5523[_0x19795d];return _0x9a6cbb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3552('0x0'))(_0x3552('0x1'));var moment=require(_0x3552('0x2'));var BPromise=require(_0x3552('0x3'));var rp=require(_0x3552('0x4'));var fs=require('fs');var path=require(_0x3552('0x5'));var rimraf=require(_0x3552('0x6'));var config=require(_0x3552('0x7'));var attributes=require(_0x3552('0x8'));module[_0x3552('0x9')]=function(_0x3225aa,_0x58385b){return _0x3225aa['define']('FreshsalesField',attributes,{'tableName':_0x3552('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x3552('0xb'),_0x3552('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x014c=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','FieldId','util','api','moment','bluebird','rimraf'];(function(_0x4744f3,_0xfd901b){var _0x328e94=function(_0x5b840c){while(--_0x5b840c){_0x4744f3['push'](_0x4744f3['shift']());}};_0x328e94(++_0xfd901b);}(_0x014c,0x17b));var _0xc014=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0x014c[_0x503790];return _0x388092;};'use strict';var _=require('lodash');var util=require(_0xc014('0x0'));var logger=require('../../config/logger')(_0xc014('0x1'));var moment=require(_0xc014('0x2'));var BPromise=require(_0xc014('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc014('0x4'));var config=require(_0xc014('0x5'));var attributes=require(_0xc014('0x6'));module[_0xc014('0x7')]=function(_0x10f3cb,_0x5138a8){return _0x10f3cb[_0xc014('0x8')](_0xc014('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xc014('0xa'),'fields':['idField',_0xc014('0xb')],'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 ee6251b..3ff0e2d 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(_0x4cd2cd,_0x5ed519){var _0x2a764f=function(_0x355421){while(--_0x355421){_0x4cd2cd['push'](_0x4cd2cd['shift']());}};_0x2a764f(++_0x5ed519);}(_0x326f,0xd1));var _0xf326=function(_0x54e4d6,_0x1ca183){_0x54e4d6=_0x54e4d6-0x0;var _0x5654a9=_0x326f[_0x54e4d6];return _0x5654a9;};'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 _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x41e6de,_0xac3d47){var _0x1b5bed=function(_0xddcbf2){while(--_0xddcbf2){_0x41e6de['push'](_0x41e6de['shift']());}};_0x1b5bed(++_0xac3d47);}(_0xafc4,0x69));var _0x4afc=function(_0x4933ed,_0x1dcfe){_0x4933ed=_0x4933ed-0x0;var _0x44883e=_0xafc4[_0x4933ed];return _0x44883e;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9575caf..85b0af2 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(_0x3dad8c,_0x18dd6a){var _0x1a2757=function(_0xd162e7){while(--_0xd162e7){_0x3dad8c['push'](_0x3dad8c['shift']());}};_0x1a2757(++_0x18dd6a);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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(_0xaaa64f,_0x1d32d8){var _0x57ab3c=function(_0x4d47ab){while(--_0x4d47ab){_0xaaa64f['push'](_0xaaa64f['shift']());}};_0x57ab3c(++_0x1d32d8);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 3b8ea9d..303fea6 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 _0x3c85=['sequelize','exports','STRING','ENUM'];(function(_0x5dcaf7,_0x184cfa){var _0x1184ed=function(_0x3e6ff5){while(--_0x3e6ff5){_0x5dcaf7['push'](_0x5dcaf7['shift']());}};_0x1184ed(++_0x184cfa);}(_0x3c85,0x1a0));var _0x53c8=function(_0x20e142,_0x423b78){_0x20e142=_0x20e142-0x0;var _0x1dc27e=_0x3c85[_0x20e142];return _0x1dc27e;};'use strict';var Sequelize=require(_0x53c8('0x0'));module[_0x53c8('0x1')]={'name':{'type':Sequelize[_0x53c8('0x2')]},'description':{'type':Sequelize[_0x53c8('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x53c8('0x2')]},'password':{'type':Sequelize[_0x53c8('0x2')]},'clientId':{'type':Sequelize[_0x53c8('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x53c8('0x2')]},'serverUrl':{'type':Sequelize[_0x53c8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x53c8('0x3')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xafcb=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x277607,_0x345a06){var _0x15fe23=function(_0x336de7){while(--_0x336de7){_0x277607['push'](_0x277607['shift']());}};_0x15fe23(++_0x345a06);}(_0xafcb,0xb6));var _0xbafc=function(_0x143d29,_0x57a637){_0x143d29=_0x143d29-0x0;var _0x2cf5f1=_0xafcb[_0x143d29];return _0x2cf5f1;};'use strict';var Sequelize=require(_0xbafc('0x0'));module[_0xbafc('0x1')]={'name':{'type':Sequelize[_0xbafc('0x2')]},'description':{'type':Sequelize[_0xbafc('0x2')]},'username':{'type':Sequelize[_0xbafc('0x2')],'unique':_0xbafc('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbafc('0x2')]},'clientId':{'type':Sequelize[_0xbafc('0x2')]},'clientSecret':{'type':Sequelize[_0xbafc('0x2')]},'securityToken':{'type':Sequelize[_0xbafc('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbafc('0x4')](_0xbafc('0x5'),_0xbafc('0x6')),'defaultValue':_0xbafc('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index e623099..cdc0e6f 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 _0x73a2=['False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','where','type','VIRTUAL','filter','options','includeAll','include','findAll','show','keys','length','catch','body','find','params','SalesforceConfiguration','hasOwnProperty','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','login','password','concat','isNil','sobject','describe','ActivityDate','IsRecurrence','Subject','int','picklist','boolean','email','phone','remove','includes','custom','picklistValues','value','True','true'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0x73a2,0x1f3));var _0x273a=function(_0x44a02b,_0x4fbeb9){_0x44a02b=_0x44a02b-0x0;var _0x255375=_0x73a2[_0x44a02b];return _0x255375;};'use strict';var emlformat=require(_0x273a('0x0'));var rimraf=require(_0x273a('0x1'));var zipdir=require(_0x273a('0x2'));var jsonpatch=require(_0x273a('0x3'));var rp=require(_0x273a('0x4'));var moment=require(_0x273a('0x5'));var BPromise=require(_0x273a('0x6'));var Mustache=require('mustache');var util=require(_0x273a('0x7'));var path=require(_0x273a('0x8'));var sox=require(_0x273a('0x9'));var csv=require(_0x273a('0xa'));var ejs=require(_0x273a('0xb'));var fs=require('fs');var fs_extra=require(_0x273a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x273a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x273a('0xe'));var toCsv=require(_0x273a('0xa'));var querystring=require(_0x273a('0xf'));var Papa=require(_0x273a('0x10'));var Redis=require(_0x273a('0x11'));var authService=require(_0x273a('0x12'));var qs=require(_0x273a('0x13'));var as=require(_0x273a('0x14'));var hardwareService=require(_0x273a('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x273a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x273a('0x17'))['db'];var integrations=require(_0x273a('0x18'));function respondWithStatusCode(_0x2df9ba,_0x42fe2a){_0x42fe2a=_0x42fe2a||0xcc;return function(_0x1a10dc){if(_0x1a10dc){return _0x2df9ba['sendStatus'](_0x42fe2a);}return _0x2df9ba[_0x273a('0x19')](_0x42fe2a)[_0x273a('0x1a')]();};}function respondWithResult(_0x2f81f2,_0x267208){_0x267208=_0x267208||0xc8;return function(_0xeacd5e){if(_0xeacd5e){return _0x2f81f2[_0x273a('0x19')](_0x267208)[_0x273a('0x1b')](_0xeacd5e);}};}function respondWithFilteredResult(_0x51a4a8,_0x298c36){return function(_0x34ca16){if(_0x34ca16){var _0x185806=typeof _0x298c36[_0x273a('0x1c')]===_0x273a('0x1d')&&typeof _0x298c36['limit']===_0x273a('0x1d');var _0x3ee3c1=_0x34ca16[_0x273a('0x1e')];var _0x10faeb=_0x185806?0x0:_0x298c36[_0x273a('0x1c')];var _0x50e945=_0x185806?_0x34ca16['count']:_0x298c36[_0x273a('0x1c')]+_0x298c36[_0x273a('0x1f')];var _0x3ac2f2;if(_0x50e945>=_0x3ee3c1){_0x50e945=_0x3ee3c1;_0x3ac2f2=0xc8;}else{_0x3ac2f2=0xce;}_0x51a4a8[_0x273a('0x19')](_0x3ac2f2);return _0x51a4a8['set'](_0x273a('0x20'),_0x10faeb+'-'+_0x50e945+'/'+_0x3ee3c1)['json'](_0x34ca16);}return null;};}function patchUpdates(_0x304a64){return function(_0x54701b){try{jsonpatch[_0x273a('0x21')](_0x54701b,_0x304a64,!![]);}catch(_0x590bba){return BPromise[_0x273a('0x22')](_0x590bba);}return _0x54701b[_0x273a('0x23')]();};}function saveUpdates(_0x4c5e00,_0x45d06f){return function(_0x3770ec){if(_0x3770ec){return _0x3770ec['update'](_0x4c5e00)['then'](function(_0x222628){return _0x222628;});}return null;};}function removeEntity(_0x3217e9,_0x3ed61f){return function(_0x55f58f){if(_0x55f58f){return _0x55f58f[_0x273a('0x24')]()[_0x273a('0x25')](function(){_0x3217e9[_0x273a('0x19')](0xcc)[_0x273a('0x1a')]();});}};}function handleEntityNotFound(_0x4e0521,_0x59787f){return function(_0x52029a){if(!_0x52029a){_0x4e0521['sendStatus'](0x194);}return _0x52029a;};}function handleError(_0x50249a,_0x2ce6c2){_0x2ce6c2=_0x2ce6c2||0x1f4;return function(_0x16372c){logger[_0x273a('0x26')](_0x16372c[_0x273a('0x27')]);if(_0x16372c['name']){delete _0x16372c[_0x273a('0x28')];}_0x50249a['status'](_0x2ce6c2)[_0x273a('0x29')](_0x16372c);};}exports[_0x273a('0x2a')]=function(_0x37911f,_0x22acd3){var _0x5113cb={},_0x10defa={},_0x29c690={'count':0x0,'rows':[]};var _0x4f272d=_['map'](db[_0x273a('0x2b')][_0x273a('0x2c')],function(_0x3079c4){return{'name':_0x3079c4[_0x273a('0x2d')],'type':_0x3079c4['type'][_0x273a('0x2e')]};});_0x10defa['model']=_[_0x273a('0x2f')](_0x4f272d,_0x273a('0x28'));_0x10defa['query']=_['keys'](_0x37911f[_0x273a('0x30')]);_0x10defa[_0x273a('0x31')]=_[_0x273a('0x32')](_0x10defa[_0x273a('0x33')],_0x10defa[_0x273a('0x30')]);_0x5113cb[_0x273a('0x34')]=_[_0x273a('0x32')](_0x10defa[_0x273a('0x33')],qs[_0x273a('0x35')](_0x37911f[_0x273a('0x30')][_0x273a('0x35')]));_0x5113cb[_0x273a('0x34')]=_0x5113cb['attributes']['length']?_0x5113cb['attributes']:_0x10defa[_0x273a('0x33')];if(!_0x37911f[_0x273a('0x30')]['hasOwnProperty'](_0x273a('0x36'))){_0x5113cb[_0x273a('0x1f')]=qs[_0x273a('0x1f')](_0x37911f[_0x273a('0x30')][_0x273a('0x1f')]);_0x5113cb[_0x273a('0x1c')]=qs[_0x273a('0x1c')](_0x37911f['query'][_0x273a('0x1c')]);}_0x5113cb[_0x273a('0x37')]=qs['sort'](_0x37911f[_0x273a('0x30')][_0x273a('0x38')]);_0x5113cb['where']=qs[_0x273a('0x31')](_[_0x273a('0x39')](_0x37911f[_0x273a('0x30')],_0x10defa[_0x273a('0x31')]),_0x4f272d);if(_0x37911f[_0x273a('0x30')]['filter']){_0x5113cb['where']=_['merge'](_0x5113cb[_0x273a('0x3a')],{'$or':_['map'](_0x4f272d,function(_0x3f82cf){if(_0x3f82cf[_0x273a('0x3b')]!==_0x273a('0x3c')){var _0x1987b2={};_0x1987b2[_0x3f82cf[_0x273a('0x28')]]={'$like':'%'+_0x37911f[_0x273a('0x30')][_0x273a('0x3d')]+'%'};return _0x1987b2;}})});}_0x5113cb=_['merge']({},_0x5113cb,_0x37911f[_0x273a('0x3e')]);var _0x36b2ec={'where':_0x5113cb[_0x273a('0x3a')]};return db[_0x273a('0x2b')]['count'](_0x36b2ec)['then'](function(_0x464041){_0x29c690['count']=_0x464041;if(_0x37911f[_0x273a('0x30')][_0x273a('0x3f')]){_0x5113cb[_0x273a('0x40')]=[{'all':!![]}];}return db[_0x273a('0x2b')][_0x273a('0x41')](_0x5113cb);})[_0x273a('0x25')](function(_0x122621){_0x29c690['rows']=_0x122621;return _0x29c690;})[_0x273a('0x25')](respondWithFilteredResult(_0x22acd3,_0x5113cb))['catch'](handleError(_0x22acd3,null));};exports[_0x273a('0x42')]=function(_0x7e0357,_0x39f15f){var _0x843376={'raw':![],'where':{'id':_0x7e0357['params']['id']}},_0x171b25={};_0x171b25['model']=_[_0x273a('0x43')](db[_0x273a('0x2b')][_0x273a('0x2c')]);_0x171b25[_0x273a('0x30')]=_['keys'](_0x7e0357[_0x273a('0x30')]);_0x171b25[_0x273a('0x31')]=_[_0x273a('0x32')](_0x171b25[_0x273a('0x33')],_0x171b25[_0x273a('0x30')]);_0x843376['attributes']=_[_0x273a('0x32')](_0x171b25['model'],qs['fields'](_0x7e0357[_0x273a('0x30')][_0x273a('0x35')]));_0x843376['attributes']=_0x843376['attributes'][_0x273a('0x44')]?_0x843376[_0x273a('0x34')]:_0x171b25['model'];if(_0x7e0357[_0x273a('0x30')][_0x273a('0x3f')]){_0x843376[_0x273a('0x40')]=[{'all':!![]}];}_0x843376=_['merge']({},_0x843376,_0x7e0357['options']);return db[_0x273a('0x2b')]['find'](_0x843376)[_0x273a('0x25')](handleEntityNotFound(_0x39f15f,null))[_0x273a('0x25')](respondWithResult(_0x39f15f,null))[_0x273a('0x45')](handleError(_0x39f15f,null));};exports['create']=function(_0x23eb89,_0x37079c){return db[_0x273a('0x2b')]['create'](_0x23eb89[_0x273a('0x46')],{})[_0x273a('0x25')](respondWithResult(_0x37079c,0xc9))[_0x273a('0x45')](handleError(_0x37079c,null));};exports['update']=function(_0x7bd11b,_0x1f0f47){if(_0x7bd11b[_0x273a('0x46')]['id']){delete _0x7bd11b[_0x273a('0x46')]['id'];}return db[_0x273a('0x2b')][_0x273a('0x47')]({'where':{'id':_0x7bd11b[_0x273a('0x48')]['id']}})[_0x273a('0x25')](handleEntityNotFound(_0x1f0f47,null))[_0x273a('0x25')](saveUpdates(_0x7bd11b[_0x273a('0x46')],null))[_0x273a('0x25')](respondWithResult(_0x1f0f47,null))['catch'](handleError(_0x1f0f47,null));};exports[_0x273a('0x24')]=function(_0x47b4e7,_0x5f1354){return db[_0x273a('0x2b')][_0x273a('0x47')]({'where':{'id':_0x47b4e7[_0x273a('0x48')]['id']}})[_0x273a('0x25')](handleEntityNotFound(_0x5f1354,null))[_0x273a('0x25')](removeEntity(_0x5f1354,null))[_0x273a('0x45')](handleError(_0x5f1354,null));};exports['getConfigurations']=function(_0x2bd186,_0x31f287,_0x3a4366){var _0x182958={};var _0x493ece={};var _0x15f153;var _0x4dcc70;return db[_0x273a('0x2b')]['findOne']({'where':{'id':_0x2bd186['params']['id']}})[_0x273a('0x25')](handleEntityNotFound(_0x31f287,null))['then'](function(_0x22fee5){if(_0x22fee5){_0x15f153=_0x22fee5;_0x493ece[_0x273a('0x33')]=_[_0x273a('0x43')](db[_0x273a('0x49')][_0x273a('0x2c')]);_0x493ece[_0x273a('0x30')]=_[_0x273a('0x43')](_0x2bd186[_0x273a('0x30')]);_0x493ece['filters']=_[_0x273a('0x32')](_0x493ece[_0x273a('0x33')],_0x493ece[_0x273a('0x30')]);_0x182958[_0x273a('0x34')]=_[_0x273a('0x32')](_0x493ece[_0x273a('0x33')],qs[_0x273a('0x35')](_0x2bd186[_0x273a('0x30')][_0x273a('0x35')]));_0x182958[_0x273a('0x34')]=_0x182958[_0x273a('0x34')]['length']?_0x182958['attributes']:_0x493ece[_0x273a('0x33')];_0x182958[_0x273a('0x37')]=qs[_0x273a('0x38')](_0x2bd186[_0x273a('0x30')][_0x273a('0x38')]);_0x182958[_0x273a('0x3a')]=qs[_0x273a('0x31')](_[_0x273a('0x39')](_0x2bd186[_0x273a('0x30')],_0x493ece['filters']));if(_0x2bd186[_0x273a('0x30')][_0x273a('0x3d')]){_0x182958[_0x273a('0x3a')]=_['merge'](_0x182958[_0x273a('0x3a')],{'$or':_['map'](_0x182958[_0x273a('0x34')],function(_0x592070){var _0x512907={};_0x512907[_0x592070]={'$like':'%'+_0x2bd186[_0x273a('0x30')][_0x273a('0x3d')]+'%'};return _0x512907;})});}_0x182958=_['merge']({},_0x182958,_0x2bd186['options']);return _0x15f153['getConfigurations'](_0x182958);}})[_0x273a('0x25')](function(_0x6ee4ed){if(_0x6ee4ed){_0x4dcc70=_0x6ee4ed['length'];if(!_0x2bd186[_0x273a('0x30')][_0x273a('0x4a')]('nolimit')){_0x182958[_0x273a('0x1f')]=qs['limit'](_0x2bd186[_0x273a('0x30')][_0x273a('0x1f')]);_0x182958[_0x273a('0x1c')]=qs[_0x273a('0x1c')](_0x2bd186['query'][_0x273a('0x1c')]);}return _0x15f153[_0x273a('0x4b')](_0x182958);}})[_0x273a('0x25')](function(_0x20823d){if(_0x20823d){return _0x20823d?{'count':_0x4dcc70,'rows':_0x20823d}:null;}})[_0x273a('0x25')](respondWithResult(_0x31f287,null))[_0x273a('0x45')](handleError(_0x31f287,null));};exports[_0x273a('0x4c')]=function(_0x5b4b52,_0xd8ba3e,_0xdf1fa7){if(_0x5b4b52['body']['id']){delete _0x5b4b52[_0x273a('0x46')]['id'];}return db[_0x273a('0x2b')][_0x273a('0x4d')]({'where':{'id':_0x5b4b52['params']['id']}})[_0x273a('0x25')](handleEntityNotFound(_0xd8ba3e,null))['then'](function(_0x3207bd){if(_0x3207bd){_0x5b4b52[_0x273a('0x46')][_0x273a('0x4e')]=_0x3207bd['id'];_0x5b4b52['body'][_0x273a('0x4f')]=integrations[_0x273a('0x50')](_0x5b4b52['body']['channel'],_0x5b4b52['body'][_0x273a('0x3b')]);_0x5b4b52[_0x273a('0x46')][_0x273a('0x51')]=integrations[_0x273a('0x52')](_0x5b4b52['body'][_0x273a('0x53')],_0x5b4b52[_0x273a('0x46')][_0x273a('0x3b')]);return db[_0x273a('0x49')][_0x273a('0x54')](_0x5b4b52['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x273a('0x55')],'as':_0x273a('0x51')}]});}return null;})[_0x273a('0x25')](respondWithResult(_0xd8ba3e,null))['catch'](handleError(_0xd8ba3e,null));};exports[_0x273a('0x56')]=function(_0x191177,_0x45c1ee,_0x24545e){var _0x2c1ac6;var _0x3c2fea='';var _0x3f3fc3='Task';return db['SalesforceAccount'][_0x273a('0x4d')]({'where':{'id':_0x191177[_0x273a('0x48')]['id']},'attributes':['id',_0x273a('0x57'),_0x273a('0x58'),_0x273a('0x59'),_0x273a('0x5a'),'password',_0x273a('0x5b')]})['then'](handleEntityNotFound(_0x45c1ee,null))[_0x273a('0x25')](function(_0x3c2b89){if(_0x3c2b89){_0x3c2fea=_0x3c2b89['remoteUri'];var _0x21945d=_0x3c2fea[_0x273a('0x5c')](-0x1);if(_0x21945d==='/'){_0x3c2fea=_0x3c2fea[_0x273a('0x5d')](0x0,_0x3c2fea[_0x273a('0x5e')](_0x21945d));}_0x2c1ac6=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3c2fea,'clientId':_0x3c2b89[_0x273a('0x58')],'clientSecret':_0x3c2b89['clientSecret']}});return _0x2c1ac6[_0x273a('0x5f')](_0x3c2b89[_0x273a('0x5a')],_0x3c2b89[_0x273a('0x60')][_0x273a('0x61')](_0x3c2b89[_0x273a('0x5b')]));}})['then'](function(_0x6e2630){if(_0x6e2630){if(!_[_0x273a('0x62')](_0x191177[_0x273a('0x30')]['ticketType'])){_0x3f3fc3=_0x191177['query']['ticketType'];}return _0x2c1ac6[_0x273a('0x63')](_0x3f3fc3)[_0x273a('0x64')]();}})[_0x273a('0x25')](function(_0x218e98){var _0x5321c4=['OwnerId',_0x273a('0x65'),'IsReminderSet',_0x273a('0x66'),_0x273a('0x67'),'Description'];var _0x23a713=['string',_0x273a('0x68'),_0x273a('0x69'),_0x273a('0x6a'),_0x273a('0x6b'),'textarea',_0x273a('0x6c')];if(_0x218e98){_[_0x273a('0x6d')](_0x218e98[_0x273a('0x35')],function(_0x25afbb){return _0x5321c4[_0x273a('0x6e')](_0x25afbb[_0x273a('0x28')])||!_0x23a713['includes'](_0x25afbb[_0x273a('0x3b')]);});return{'count':_0x218e98[_0x273a('0x35')][_0x273a('0x44')],'rows':_[_0x273a('0x2f')](_0x218e98[_0x273a('0x35')],function(_0xee7e67){return{'id':_0xee7e67[_0x273a('0x28')],'name':_0xee7e67['label'],'custom':_0xee7e67[_0x273a('0x6f')],'options':_0xee7e67[_0x273a('0x70')][_0x273a('0x44')]>0x0?_['map'](_0xee7e67[_0x273a('0x70')],function(_0x5ea7c1){return{'name':_0x5ea7c1['label'],'value':_0x5ea7c1[_0x273a('0x71')]};}):_0xee7e67[_0x273a('0x3b')]==_0x273a('0x6a')?[{'name':_0x273a('0x72'),'value':_0x273a('0x73')},{'name':_0x273a('0x74'),'value':_0x273a('0x75')}]:[]};})};}})[_0x273a('0x25')](respondWithResult(_0x45c1ee,null))[_0x273a('0x45')](function(_0x1eb67f){var _0x306f83=_0x191177[_0x273a('0x30')][_0x273a('0x76')]?0x1f4:_0x1eb67f[_0x273a('0x77')]||0x1f4;logger[_0x273a('0x26')](_0x273a('0x78'),_0x273a('0x56'),_0x306f83,JSON[_0x273a('0x79')](_0x1eb67f));delete _0x1eb67f[_0x273a('0x28')];if(_0x306f83===0x191){_0x306f83=0x190;}_0x45c1ee[_0x273a('0x19')](_0x306f83)['send'](_0x191177['query'][_0x273a('0x76')]?{'message':_0x273a('0x7a'),'statusCode':_0x1eb67f['statusCode']}:_0x1eb67f);});}; \ No newline at end of file +var _0x49de=['type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','merge','find','create','update','body','destroy','getConfigurations','findOne','AccountId','Subjects','channel','getDescriptions','SalesforceConfiguration','SalesforceField','Descriptions','remoteUri','clientSecret','username','password','slice','lastIndexOf','Connection','clientId','login','securityToken','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','includes','custom','picklistValues','label','True','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','index','SalesforceAccount','fieldName'];(function(_0x95421,_0x376636){var _0x4ca229=function(_0x353d88){while(--_0x353d88){_0x95421['push'](_0x95421['shift']());}};_0x4ca229(++_0x376636);}(_0x49de,0x1cf));var _0xe49d=function(_0x5db0fc,_0x1702bf){_0x5db0fc=_0x5db0fc-0x0;var _0x1cdcf1=_0x49de[_0x5db0fc];return _0x1cdcf1;};'use strict';var emlformat=require(_0xe49d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe49d('0x1'));var jsonpatch=require(_0xe49d('0x2'));var rp=require(_0xe49d('0x3'));var moment=require(_0xe49d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe49d('0x5'));var util=require(_0xe49d('0x6'));var path=require(_0xe49d('0x7'));var sox=require(_0xe49d('0x8'));var csv=require(_0xe49d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe49d('0xa'));var _=require('lodash');var squel=require(_0xe49d('0xb'));var crypto=require(_0xe49d('0xc'));var jsforce=require(_0xe49d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe49d('0x9'));var querystring=require(_0xe49d('0xe'));var Papa=require(_0xe49d('0xf'));var Redis=require('ioredis');var authService=require(_0xe49d('0x10'));var qs=require(_0xe49d('0x11'));var as=require(_0xe49d('0x12'));var hardwareService=require(_0xe49d('0x13'));var logger=require('../../config/logger')(_0xe49d('0x14'));var utils=require(_0xe49d('0x15'));var config=require(_0xe49d('0x16'));var licenseUtil=require(_0xe49d('0x17'));var db=require(_0xe49d('0x18'))['db'];var integrations=require(_0xe49d('0x19'));function respondWithStatusCode(_0x4a60de,_0x3e36cd){_0x3e36cd=_0x3e36cd||0xcc;return function(_0x337f37){if(_0x337f37){return _0x4a60de[_0xe49d('0x1a')](_0x3e36cd);}return _0x4a60de[_0xe49d('0x1b')](_0x3e36cd)[_0xe49d('0x1c')]();};}function respondWithResult(_0x1611ca,_0x517d5b){_0x517d5b=_0x517d5b||0xc8;return function(_0x56eb9d){if(_0x56eb9d){return _0x1611ca['status'](_0x517d5b)[_0xe49d('0x1d')](_0x56eb9d);}};}function respondWithFilteredResult(_0x31190a,_0x4ab415){return function(_0x30bc2b){if(_0x30bc2b){var _0x3c911b=typeof _0x4ab415[_0xe49d('0x1e')]===_0xe49d('0x1f')&&typeof _0x4ab415[_0xe49d('0x20')]===_0xe49d('0x1f');var _0x41a882=_0x30bc2b['count'];var _0x2760d3=_0x3c911b?0x0:_0x4ab415['offset'];var _0x21c46c=_0x3c911b?_0x30bc2b[_0xe49d('0x21')]:_0x4ab415['offset']+_0x4ab415[_0xe49d('0x20')];var _0x341976;if(_0x21c46c>=_0x41a882){_0x21c46c=_0x41a882;_0x341976=0xc8;}else{_0x341976=0xce;}_0x31190a['status'](_0x341976);return _0x31190a[_0xe49d('0x22')](_0xe49d('0x23'),_0x2760d3+'-'+_0x21c46c+'/'+_0x41a882)['json'](_0x30bc2b);}return null;};}function patchUpdates(_0x3e02ec){return function(_0x550f09){try{jsonpatch[_0xe49d('0x24')](_0x550f09,_0x3e02ec,!![]);}catch(_0x14ebab){return BPromise[_0xe49d('0x25')](_0x14ebab);}return _0x550f09[_0xe49d('0x26')]();};}function saveUpdates(_0x194caa,_0x1bebe4){return function(_0x632f1c){if(_0x632f1c){return _0x632f1c['update'](_0x194caa)[_0xe49d('0x27')](function(_0x350dfb){return _0x350dfb;});}return null;};}function removeEntity(_0x502ed6,_0x1604e6){return function(_0x305ee9){if(_0x305ee9){return _0x305ee9['destroy']()['then'](function(){_0x502ed6['status'](0xcc)[_0xe49d('0x1c')]();});}};}function handleEntityNotFound(_0x377d69,_0x19c069){return function(_0x5dee96){if(!_0x5dee96){_0x377d69[_0xe49d('0x1a')](0x194);}return _0x5dee96;};}function handleError(_0x8a1986,_0x54c81f){_0x54c81f=_0x54c81f||0x1f4;return function(_0x2111aa){logger['error'](_0x2111aa[_0xe49d('0x28')]);if(_0x2111aa[_0xe49d('0x29')]){delete _0x2111aa[_0xe49d('0x29')];}_0x8a1986[_0xe49d('0x1b')](_0x54c81f)['send'](_0x2111aa);};}exports[_0xe49d('0x2a')]=function(_0x5f2487,_0x5a9f68){var _0x2a7277={},_0x3b2205={},_0x18c473={'count':0x0,'rows':[]};var _0x1c3e1b=_['map'](db[_0xe49d('0x2b')]['rawAttributes'],function(_0x4b64d4){return{'name':_0x4b64d4[_0xe49d('0x2c')],'type':_0x4b64d4[_0xe49d('0x2d')]['key']};});_0x3b2205[_0xe49d('0x2e')]=_[_0xe49d('0x2f')](_0x1c3e1b,_0xe49d('0x29'));_0x3b2205['query']=_[_0xe49d('0x30')](_0x5f2487[_0xe49d('0x31')]);_0x3b2205[_0xe49d('0x32')]=_[_0xe49d('0x33')](_0x3b2205[_0xe49d('0x2e')],_0x3b2205['query']);_0x2a7277[_0xe49d('0x34')]=_['intersection'](_0x3b2205[_0xe49d('0x2e')],qs[_0xe49d('0x35')](_0x5f2487['query'][_0xe49d('0x35')]));_0x2a7277['attributes']=_0x2a7277[_0xe49d('0x34')]['length']?_0x2a7277[_0xe49d('0x34')]:_0x3b2205[_0xe49d('0x2e')];if(!_0x5f2487['query'][_0xe49d('0x36')](_0xe49d('0x37'))){_0x2a7277['limit']=qs[_0xe49d('0x20')](_0x5f2487[_0xe49d('0x31')][_0xe49d('0x20')]);_0x2a7277[_0xe49d('0x1e')]=qs[_0xe49d('0x1e')](_0x5f2487[_0xe49d('0x31')][_0xe49d('0x1e')]);}_0x2a7277[_0xe49d('0x38')]=qs['sort'](_0x5f2487[_0xe49d('0x31')][_0xe49d('0x39')]);_0x2a7277[_0xe49d('0x3a')]=qs[_0xe49d('0x32')](_[_0xe49d('0x3b')](_0x5f2487[_0xe49d('0x31')],_0x3b2205[_0xe49d('0x32')]),_0x1c3e1b);if(_0x5f2487[_0xe49d('0x31')][_0xe49d('0x3c')]){_0x2a7277[_0xe49d('0x3a')]=_['merge'](_0x2a7277[_0xe49d('0x3a')],{'$or':_[_0xe49d('0x2f')](_0x1c3e1b,function(_0xe2383e){if(_0xe2383e[_0xe49d('0x2d')]!==_0xe49d('0x3d')){var _0x1afc6={};_0x1afc6[_0xe2383e[_0xe49d('0x29')]]={'$like':'%'+_0x5f2487[_0xe49d('0x31')][_0xe49d('0x3c')]+'%'};return _0x1afc6;}})});}_0x2a7277=_['merge']({},_0x2a7277,_0x5f2487[_0xe49d('0x3e')]);var _0x451312={'where':_0x2a7277[_0xe49d('0x3a')]};return db[_0xe49d('0x2b')]['count'](_0x451312)['then'](function(_0x2093d0){_0x18c473['count']=_0x2093d0;if(_0x5f2487[_0xe49d('0x31')][_0xe49d('0x3f')]){_0x2a7277['include']=[{'all':!![]}];}return db[_0xe49d('0x2b')][_0xe49d('0x40')](_0x2a7277);})['then'](function(_0x51cb48){_0x18c473[_0xe49d('0x41')]=_0x51cb48;return _0x18c473;})[_0xe49d('0x27')](respondWithFilteredResult(_0x5a9f68,_0x2a7277))[_0xe49d('0x42')](handleError(_0x5a9f68,null));};exports[_0xe49d('0x43')]=function(_0x5c671f,_0x445590){var _0x68e6c5={'raw':![],'where':{'id':_0x5c671f[_0xe49d('0x44')]['id']}},_0x4524dd={};_0x4524dd[_0xe49d('0x2e')]=_['keys'](db[_0xe49d('0x2b')][_0xe49d('0x45')]);_0x4524dd[_0xe49d('0x31')]=_[_0xe49d('0x30')](_0x5c671f[_0xe49d('0x31')]);_0x4524dd[_0xe49d('0x32')]=_[_0xe49d('0x33')](_0x4524dd['model'],_0x4524dd[_0xe49d('0x31')]);_0x68e6c5[_0xe49d('0x34')]=_[_0xe49d('0x33')](_0x4524dd['model'],qs['fields'](_0x5c671f[_0xe49d('0x31')][_0xe49d('0x35')]));_0x68e6c5[_0xe49d('0x34')]=_0x68e6c5['attributes'][_0xe49d('0x46')]?_0x68e6c5[_0xe49d('0x34')]:_0x4524dd[_0xe49d('0x2e')];if(_0x5c671f[_0xe49d('0x31')][_0xe49d('0x3f')]){_0x68e6c5[_0xe49d('0x47')]=[{'all':!![]}];}_0x68e6c5=_[_0xe49d('0x48')]({},_0x68e6c5,_0x5c671f[_0xe49d('0x3e')]);return db[_0xe49d('0x2b')][_0xe49d('0x49')](_0x68e6c5)[_0xe49d('0x27')](handleEntityNotFound(_0x445590,null))[_0xe49d('0x27')](respondWithResult(_0x445590,null))[_0xe49d('0x42')](handleError(_0x445590,null));};exports[_0xe49d('0x4a')]=function(_0x55052e,_0x4222b3){return db['SalesforceAccount']['create'](_0x55052e['body'],{})[_0xe49d('0x27')](respondWithResult(_0x4222b3,0xc9))[_0xe49d('0x42')](handleError(_0x4222b3,null));};exports[_0xe49d('0x4b')]=function(_0x154985,_0xd616c5){if(_0x154985[_0xe49d('0x4c')]['id']){delete _0x154985[_0xe49d('0x4c')]['id'];}return db['SalesforceAccount'][_0xe49d('0x49')]({'where':{'id':_0x154985[_0xe49d('0x44')]['id']}})[_0xe49d('0x27')](handleEntityNotFound(_0xd616c5,null))[_0xe49d('0x27')](saveUpdates(_0x154985[_0xe49d('0x4c')],null))[_0xe49d('0x27')](respondWithResult(_0xd616c5,null))['catch'](handleError(_0xd616c5,null));};exports[_0xe49d('0x4d')]=function(_0xb51bc7,_0x5836ed){return db[_0xe49d('0x2b')][_0xe49d('0x49')]({'where':{'id':_0xb51bc7['params']['id']}})[_0xe49d('0x27')](handleEntityNotFound(_0x5836ed,null))[_0xe49d('0x27')](removeEntity(_0x5836ed,null))[_0xe49d('0x42')](handleError(_0x5836ed,null));};exports['getConfigurations']=function(_0x5bf621,_0x2b75ea,_0x3593de){var _0x2e11f1={};var _0x313a32={};var _0x5c7962;var _0x3e4b23;return db[_0xe49d('0x2b')]['findOne']({'where':{'id':_0x5bf621[_0xe49d('0x44')]['id']}})[_0xe49d('0x27')](handleEntityNotFound(_0x2b75ea,null))[_0xe49d('0x27')](function(_0x52cadb){if(_0x52cadb){_0x5c7962=_0x52cadb;_0x313a32[_0xe49d('0x2e')]=_[_0xe49d('0x30')](db['SalesforceConfiguration'][_0xe49d('0x45')]);_0x313a32['query']=_['keys'](_0x5bf621[_0xe49d('0x31')]);_0x313a32[_0xe49d('0x32')]=_[_0xe49d('0x33')](_0x313a32['model'],_0x313a32[_0xe49d('0x31')]);_0x2e11f1[_0xe49d('0x34')]=_[_0xe49d('0x33')](_0x313a32[_0xe49d('0x2e')],qs[_0xe49d('0x35')](_0x5bf621['query'][_0xe49d('0x35')]));_0x2e11f1[_0xe49d('0x34')]=_0x2e11f1[_0xe49d('0x34')][_0xe49d('0x46')]?_0x2e11f1[_0xe49d('0x34')]:_0x313a32[_0xe49d('0x2e')];_0x2e11f1[_0xe49d('0x38')]=qs[_0xe49d('0x39')](_0x5bf621[_0xe49d('0x31')][_0xe49d('0x39')]);_0x2e11f1[_0xe49d('0x3a')]=qs[_0xe49d('0x32')](_[_0xe49d('0x3b')](_0x5bf621['query'],_0x313a32['filters']));if(_0x5bf621[_0xe49d('0x31')][_0xe49d('0x3c')]){_0x2e11f1[_0xe49d('0x3a')]=_[_0xe49d('0x48')](_0x2e11f1['where'],{'$or':_[_0xe49d('0x2f')](_0x2e11f1[_0xe49d('0x34')],function(_0x43290f){var _0x149f32={};_0x149f32[_0x43290f]={'$like':'%'+_0x5bf621['query']['filter']+'%'};return _0x149f32;})});}_0x2e11f1=_[_0xe49d('0x48')]({},_0x2e11f1,_0x5bf621[_0xe49d('0x3e')]);return _0x5c7962[_0xe49d('0x4e')](_0x2e11f1);}})[_0xe49d('0x27')](function(_0xe4636a){if(_0xe4636a){_0x3e4b23=_0xe4636a[_0xe49d('0x46')];if(!_0x5bf621[_0xe49d('0x31')][_0xe49d('0x36')](_0xe49d('0x37'))){_0x2e11f1[_0xe49d('0x20')]=qs[_0xe49d('0x20')](_0x5bf621[_0xe49d('0x31')][_0xe49d('0x20')]);_0x2e11f1[_0xe49d('0x1e')]=qs[_0xe49d('0x1e')](_0x5bf621['query'][_0xe49d('0x1e')]);}return _0x5c7962[_0xe49d('0x4e')](_0x2e11f1);}})['then'](function(_0x2f648f){if(_0x2f648f){return _0x2f648f?{'count':_0x3e4b23,'rows':_0x2f648f}:null;}})[_0xe49d('0x27')](respondWithResult(_0x2b75ea,null))[_0xe49d('0x42')](handleError(_0x2b75ea,null));};exports['addConfiguration']=function(_0x475da6,_0x18aa70,_0x26e94b){if(_0x475da6[_0xe49d('0x4c')]['id']){delete _0x475da6[_0xe49d('0x4c')]['id'];}return db[_0xe49d('0x2b')][_0xe49d('0x4f')]({'where':{'id':_0x475da6[_0xe49d('0x44')]['id']}})[_0xe49d('0x27')](handleEntityNotFound(_0x18aa70,null))[_0xe49d('0x27')](function(_0x3bc5b0){if(_0x3bc5b0){_0x475da6[_0xe49d('0x4c')][_0xe49d('0x50')]=_0x3bc5b0['id'];_0x475da6[_0xe49d('0x4c')][_0xe49d('0x51')]=integrations['getSubjects'](_0x475da6[_0xe49d('0x4c')][_0xe49d('0x52')],_0x475da6[_0xe49d('0x4c')][_0xe49d('0x2d')]);_0x475da6[_0xe49d('0x4c')]['Descriptions']=integrations[_0xe49d('0x53')](_0x475da6[_0xe49d('0x4c')][_0xe49d('0x52')],_0x475da6[_0xe49d('0x4c')][_0xe49d('0x2d')]);return db[_0xe49d('0x54')]['create'](_0x475da6[_0xe49d('0x4c')],{'include':[{'model':db[_0xe49d('0x55')],'as':'Subjects'},{'model':db[_0xe49d('0x55')],'as':_0xe49d('0x56')}]});}return null;})[_0xe49d('0x27')](respondWithResult(_0x18aa70,null))[_0xe49d('0x42')](handleError(_0x18aa70,null));};exports['getFields']=function(_0x2462cf,_0x454148,_0x5f9e86){var _0x21d9b9;var _0x4a0b6c='';var _0xe6297='Task';return db[_0xe49d('0x2b')]['findOne']({'where':{'id':_0x2462cf[_0xe49d('0x44')]['id']},'attributes':['id',_0xe49d('0x57'),'clientId',_0xe49d('0x58'),_0xe49d('0x59'),_0xe49d('0x5a'),'securityToken']})[_0xe49d('0x27')](handleEntityNotFound(_0x454148,null))['then'](function(_0x281460){if(_0x281460){_0x4a0b6c=_0x281460[_0xe49d('0x57')];var _0xeb8d43=_0x4a0b6c[_0xe49d('0x5b')](-0x1);if(_0xeb8d43==='/'){_0x4a0b6c=_0x4a0b6c['substring'](0x0,_0x4a0b6c[_0xe49d('0x5c')](_0xeb8d43));}_0x21d9b9=new jsforce[(_0xe49d('0x5d'))]({'oauth2':{'loginUrl':_0x4a0b6c,'clientId':_0x281460[_0xe49d('0x5e')],'clientSecret':_0x281460[_0xe49d('0x58')]}});return _0x21d9b9[_0xe49d('0x5f')](_0x281460[_0xe49d('0x59')],_0x281460[_0xe49d('0x5a')]['concat'](_0x281460[_0xe49d('0x60')]));}})['then'](function(_0x2489a7){if(_0x2489a7){if(!_[_0xe49d('0x61')](_0x2462cf[_0xe49d('0x31')][_0xe49d('0x62')])){_0xe6297=_0x2462cf[_0xe49d('0x31')]['ticketType'];}return _0x21d9b9[_0xe49d('0x63')](_0xe6297)['describe']();}})[_0xe49d('0x27')](function(_0x48b583){var _0x3e03f7=['OwnerId',_0xe49d('0x64'),_0xe49d('0x65'),_0xe49d('0x66'),_0xe49d('0x67'),_0xe49d('0x68')];var _0x1abe4f=[_0xe49d('0x69'),_0xe49d('0x6a'),_0xe49d('0x6b'),_0xe49d('0x6c'),_0xe49d('0x6d'),_0xe49d('0x6e'),'phone'];if(_0x48b583){_['remove'](_0x48b583[_0xe49d('0x35')],function(_0x229fea){return _0x3e03f7['includes'](_0x229fea['name'])||!_0x1abe4f[_0xe49d('0x6f')](_0x229fea[_0xe49d('0x2d')]);});return{'count':_0x48b583[_0xe49d('0x35')][_0xe49d('0x46')],'rows':_['map'](_0x48b583[_0xe49d('0x35')],function(_0x25e83c){return{'id':_0x25e83c[_0xe49d('0x29')],'name':_0x25e83c['label'],'custom':_0x25e83c[_0xe49d('0x70')],'options':_0x25e83c[_0xe49d('0x71')]['length']>0x0?_[_0xe49d('0x2f')](_0x25e83c[_0xe49d('0x71')],function(_0x332b3b){return{'name':_0x332b3b[_0xe49d('0x72')],'value':_0x332b3b['value']};}):_0x25e83c[_0xe49d('0x2d')]==_0xe49d('0x6c')?[{'name':_0xe49d('0x73'),'value':_0xe49d('0x74')},{'name':_0xe49d('0x75'),'value':_0xe49d('0x76')}]:[]};})};}})[_0xe49d('0x27')](respondWithResult(_0x454148,null))[_0xe49d('0x42')](function(_0x2d48c9){var _0x31e889=_0x2462cf['query'][_0xe49d('0x77')]?0x1f4:_0x2d48c9[_0xe49d('0x78')]||0x1f4;logger[_0xe49d('0x79')](_0xe49d('0x7a'),_0xe49d('0x7b'),_0x31e889,JSON[_0xe49d('0x7c')](_0x2d48c9));delete _0x2d48c9[_0xe49d('0x29')];if(_0x31e889===0x191){_0x31e889=0x190;}_0x454148[_0xe49d('0x1b')](_0x31e889)[_0xe49d('0x7d')](_0x2462cf[_0xe49d('0x31')][_0xe49d('0x77')]?{'message':_0xe49d('0x7e'),'statusCode':_0x2d48c9[_0xe49d('0x78')]}:_0x2d48c9);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 0f42653..7e51e7f 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 _0x667b=['moment','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0xe1677d,_0x286227){var _0x1efe72=function(_0x2a4ebd){while(--_0x2a4ebd){_0xe1677d['push'](_0xe1677d['shift']());}};_0x1efe72(++_0x286227);}(_0x667b,0x74));var _0xb667=function(_0x32b8a9,_0x59d62b){_0x32b8a9=_0x32b8a9-0x0;var _0x40105c=_0x667b[_0x32b8a9];return _0x40105c;};'use strict';var _=require(_0xb667('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb667('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb667('0x2'));var config=require(_0xb667('0x3'));var attributes=require(_0xb667('0x4'));var integrations=require('../../components/integrations/configuration');module[_0xb667('0x5')]=function(_0x1d7eb9,_0x4b1a24){return _0x1d7eb9[_0xb667('0x6')](_0xb667('0x7'),attributes,{'tableName':_0xb667('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb02a=['exports','define','util','../../config/logger','api','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x37fec7,_0x3a0912){var _0x1efff6=function(_0x4c5df9){while(--_0x4c5df9){_0x37fec7['push'](_0x37fec7['shift']());}};_0x1efff6(++_0x3a0912);}(_0xb02a,0x14c));var _0xab02=function(_0x358b7b,_0x90c0c2){_0x358b7b=_0x358b7b-0x0;var _0x5404f3=_0xb02a[_0x358b7b];return _0x5404f3;};'use strict';var _=require('lodash');var util=require(_0xab02('0x0'));var logger=require(_0xab02('0x1'))(_0xab02('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xab02('0x3'));var fs=require('fs');var path=require(_0xab02('0x4'));var rimraf=require('rimraf');var config=require(_0xab02('0x5'));var attributes=require(_0xab02('0x6'));var integrations=require(_0xab02('0x7'));module[_0xab02('0x8')]=function(_0x3c897a,_0xbee62a){return _0x3c897a[_0xab02('0x9')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index e98b002..4496b11 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 _0x9d83=['stringify','error','message','result','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','catch','find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0xfc856b,_0x508686){var _0x42b973=function(_0xf8969){while(--_0xf8969){_0xfc856b['push'](_0xfc856b['shift']());}};_0x42b973(++_0x508686);}(_0x9d83,0x1f3));var _0x39d8=function(_0x18f137,_0x5e06b4){_0x18f137=_0x18f137-0x0;var _0x147221=_0x9d83[_0x18f137];return _0x147221;};'use strict';var _=require(_0x39d8('0x0'));var util=require(_0x39d8('0x1'));var moment=require(_0x39d8('0x2'));var BPromise=require(_0x39d8('0x3'));var rs=require(_0x39d8('0x4'));var fs=require('fs');var Redis=require(_0x39d8('0x5'));var db=require(_0x39d8('0x6'))['db'];var utils=require(_0x39d8('0x7'));var logger=require(_0x39d8('0x8'))('rpc');var config=require(_0x39d8('0x9'));var jayson=require(_0x39d8('0xa'));var client=jayson[_0x39d8('0xb')][_0x39d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x365be4,_0x20b101,_0x2f8b90){return new BPromise(function(_0x56cb7d,_0x4997b2){return client[_0x39d8('0xd')](_0x365be4,_0x2f8b90)['then'](function(_0x36717c){logger[_0x39d8('0xe')](_0x39d8('0xf'),_0x20b101,_0x39d8('0x10'));logger[_0x39d8('0x11')](_0x39d8('0x12'),_0x20b101,_0x39d8('0x10'),JSON[_0x39d8('0x13')](_0x36717c));if(_0x36717c[_0x39d8('0x14')]){if(_0x36717c[_0x39d8('0x14')]['code']===0x1f4){logger[_0x39d8('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x20b101,_0x36717c[_0x39d8('0x14')]['message']);return _0x4997b2(_0x36717c[_0x39d8('0x14')]['message']);}logger[_0x39d8('0x14')](_0x39d8('0xf'),_0x20b101,_0x36717c[_0x39d8('0x14')][_0x39d8('0x15')]);return _0x56cb7d(_0x36717c[_0x39d8('0x14')][_0x39d8('0x15')]);}else{logger[_0x39d8('0xe')](_0x39d8('0xf'),_0x20b101,_0x39d8('0x10'));_0x56cb7d(_0x36717c[_0x39d8('0x16')]['message']);}})['catch'](function(_0x5ea468){logger[_0x39d8('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x20b101,_0x5ea468);_0x4997b2(_0x5ea468);});});}exports['GetSalesforceAccount']=function(_0x5ad97a){var _0x4fff0d=this;return new Promise(function(_0x592447,_0x286efc){return db[_0x39d8('0x17')][_0x39d8('0x18')]({'raw':_0x5ad97a[_0x39d8('0x19')]?_0x5ad97a[_0x39d8('0x19')][_0x39d8('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ad97a[_0x39d8('0x19')]?_0x5ad97a['options'][_0x39d8('0x1b')]||null:null,'attributes':_0x5ad97a[_0x39d8('0x19')]?_0x5ad97a['options'][_0x39d8('0x1c')]||null:null,'limit':_0x5ad97a['options']?_0x5ad97a[_0x39d8('0x19')][_0x39d8('0x1d')]||null:null,'include':_0x5ad97a['options']?_0x5ad97a[_0x39d8('0x19')][_0x39d8('0x1e')]?_[_0x39d8('0x1f')](_0x5ad97a[_0x39d8('0x19')][_0x39d8('0x1e')],function(_0x8d863e){return{'model':db[_0x8d863e['model']],'as':_0x8d863e['as'],'attributes':_0x8d863e[_0x39d8('0x1c')],'include':_0x8d863e['include']?_[_0x39d8('0x1f')](_0x8d863e[_0x39d8('0x1e')],function(_0x55db09){return{'model':db[_0x55db09[_0x39d8('0x20')]],'as':_0x55db09['as'],'attributes':_0x55db09[_0x39d8('0x1c')],'include':_0x55db09[_0x39d8('0x1e')]?_['map'](_0x55db09[_0x39d8('0x1e')],function(_0x5b42de){return{'model':db[_0x5b42de[_0x39d8('0x20')]],'as':_0x5b42de['as'],'attributes':_0x5b42de[_0x39d8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16453d){logger[_0x39d8('0xe')](_0x39d8('0x21'),_0x5ad97a);logger[_0x39d8('0x11')](_0x39d8('0x21'),_0x5ad97a,JSON[_0x39d8('0x13')](_0x16453d));_0x592447(_0x16453d);})[_0x39d8('0x22')](function(_0xe08857){logger['error']('GetSalesforceAccount',_0xe08857[_0x39d8('0x15')],_0x5ad97a);_0x286efc(_0x4fff0d[_0x39d8('0x14')](0x1f4,_0xe08857['message']));});});};exports['ShowSalesforceAccount']=function(_0x3091b7){var _0x52feeb=this;return new Promise(function(_0xd4d43e,_0x38620d){return db['SalesforceAccount'][_0x39d8('0x23')]({'raw':_0x3091b7[_0x39d8('0x19')]?_0x3091b7[_0x39d8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3091b7[_0x39d8('0x19')]?_0x3091b7['options']['where']||null:null,'attributes':_0x3091b7[_0x39d8('0x19')]?_0x3091b7[_0x39d8('0x19')]['attributes']||null:null,'include':_0x3091b7[_0x39d8('0x19')]?_0x3091b7[_0x39d8('0x19')][_0x39d8('0x1e')]?_[_0x39d8('0x1f')](_0x3091b7[_0x39d8('0x19')][_0x39d8('0x1e')],function(_0x470fcd){return{'model':db[_0x470fcd[_0x39d8('0x20')]],'as':_0x470fcd['as'],'attributes':_0x470fcd[_0x39d8('0x1c')],'include':_0x470fcd[_0x39d8('0x1e')]?_[_0x39d8('0x1f')](_0x470fcd[_0x39d8('0x1e')],function(_0x293870){return{'model':db[_0x293870[_0x39d8('0x20')]],'as':_0x293870['as'],'attributes':_0x293870[_0x39d8('0x1c')],'include':_0x293870['include']?_[_0x39d8('0x1f')](_0x293870[_0x39d8('0x1e')],function(_0x5c1e00){return{'model':db[_0x5c1e00[_0x39d8('0x20')]],'as':_0x5c1e00['as'],'attributes':_0x5c1e00[_0x39d8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2203b2){logger[_0x39d8('0xe')](_0x39d8('0x24'),_0x3091b7);logger[_0x39d8('0x11')]('ShowSalesforceAccount',_0x3091b7,JSON[_0x39d8('0x13')](_0x2203b2));_0xd4d43e(_0x2203b2);})[_0x39d8('0x22')](function(_0x28d537){logger[_0x39d8('0x14')](_0x39d8('0x24'),_0x28d537['message'],_0x3091b7);_0x38620d(_0x52feeb['error'](0x1f4,_0x28d537['message']));});});}; \ No newline at end of file +var _0xbe51=['result','catch','GetSalesforceAccount','options','raw','where','limit','include','map','model','attributes','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x44b0a6,_0x50ab99){var _0x380e75=function(_0xdd93d4){while(--_0xdd93d4){_0x44b0a6['push'](_0x44b0a6['shift']());}};_0x380e75(++_0x50ab99);}(_0xbe51,0x1e2));var _0x1be5=function(_0x209599,_0x5e1379){_0x209599=_0x209599-0x0;var _0x3b3be3=_0xbe51[_0x209599];return _0x3b3be3;};'use strict';var _=require(_0x1be5('0x0'));var util=require(_0x1be5('0x1'));var moment=require('moment');var BPromise=require(_0x1be5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1be5('0x3'));var db=require(_0x1be5('0x4'))['db'];var utils=require(_0x1be5('0x5'));var logger=require(_0x1be5('0x6'))(_0x1be5('0x7'));var config=require(_0x1be5('0x8'));var jayson=require(_0x1be5('0x9'));var client=jayson[_0x1be5('0xa')][_0x1be5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13fa3e,_0xf4a39f,_0x49e05a){return new BPromise(function(_0x484d9b,_0x1171b0){return client['request'](_0x13fa3e,_0x49e05a)[_0x1be5('0xc')](function(_0x36c7c2){logger['info'](_0x1be5('0xd'),_0xf4a39f,_0x1be5('0xe'));logger[_0x1be5('0xf')](_0x1be5('0x10'),_0xf4a39f,_0x1be5('0xe'),JSON[_0x1be5('0x11')](_0x36c7c2));if(_0x36c7c2[_0x1be5('0x12')]){if(_0x36c7c2['error'][_0x1be5('0x13')]===0x1f4){logger['error'](_0x1be5('0xd'),_0xf4a39f,_0x36c7c2[_0x1be5('0x12')][_0x1be5('0x14')]);return _0x1171b0(_0x36c7c2['error'][_0x1be5('0x14')]);}logger['error'](_0x1be5('0xd'),_0xf4a39f,_0x36c7c2[_0x1be5('0x12')][_0x1be5('0x14')]);return _0x484d9b(_0x36c7c2[_0x1be5('0x12')][_0x1be5('0x14')]);}else{logger[_0x1be5('0x15')](_0x1be5('0xd'),_0xf4a39f,'request\x20sent');_0x484d9b(_0x36c7c2[_0x1be5('0x16')][_0x1be5('0x14')]);}})[_0x1be5('0x17')](function(_0x3ca2b5){logger[_0x1be5('0x12')](_0x1be5('0xd'),_0xf4a39f,_0x3ca2b5);_0x1171b0(_0x3ca2b5);});});}exports[_0x1be5('0x18')]=function(_0x3a1fe3){var _0x4e777a=this;return new Promise(function(_0x3020fc,_0x33cf5d){return db['SalesforceAccount']['findAll']({'raw':_0x3a1fe3['options']?_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a1fe3[_0x1be5('0x19')]?_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1b')]||null:null,'attributes':_0x3a1fe3['options']?_0x3a1fe3[_0x1be5('0x19')]['attributes']||null:null,'limit':_0x3a1fe3['options']?_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1c')]||null:null,'include':_0x3a1fe3[_0x1be5('0x19')]?_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1d')]?_[_0x1be5('0x1e')](_0x3a1fe3[_0x1be5('0x19')][_0x1be5('0x1d')],function(_0x4f4db0){return{'model':db[_0x4f4db0[_0x1be5('0x1f')]],'as':_0x4f4db0['as'],'attributes':_0x4f4db0[_0x1be5('0x20')],'include':_0x4f4db0[_0x1be5('0x1d')]?_[_0x1be5('0x1e')](_0x4f4db0[_0x1be5('0x1d')],function(_0x162e7c){return{'model':db[_0x162e7c[_0x1be5('0x1f')]],'as':_0x162e7c['as'],'attributes':_0x162e7c[_0x1be5('0x20')],'include':_0x162e7c['include']?_[_0x1be5('0x1e')](_0x162e7c['include'],function(_0x3b9ddb){return{'model':db[_0x3b9ddb[_0x1be5('0x1f')]],'as':_0x3b9ddb['as'],'attributes':_0x3b9ddb[_0x1be5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1be5('0xc')](function(_0x59beb3){logger[_0x1be5('0x15')](_0x1be5('0x18'),_0x3a1fe3);logger[_0x1be5('0xf')](_0x1be5('0x18'),_0x3a1fe3,JSON[_0x1be5('0x11')](_0x59beb3));_0x3020fc(_0x59beb3);})['catch'](function(_0x39abb8){logger[_0x1be5('0x12')](_0x1be5('0x18'),_0x39abb8[_0x1be5('0x14')],_0x3a1fe3);_0x33cf5d(_0x4e777a[_0x1be5('0x12')](0x1f4,_0x39abb8['message']));});});};exports[_0x1be5('0x21')]=function(_0x303f6f){var _0x9fbfa9=this;return new Promise(function(_0x3ab053,_0x58685b){return db[_0x1be5('0x22')][_0x1be5('0x23')]({'raw':_0x303f6f['options']?_0x303f6f[_0x1be5('0x19')][_0x1be5('0x1a')]===undefined?!![]:![]:!![],'where':_0x303f6f['options']?_0x303f6f['options'][_0x1be5('0x1b')]||null:null,'attributes':_0x303f6f[_0x1be5('0x19')]?_0x303f6f[_0x1be5('0x19')][_0x1be5('0x20')]||null:null,'include':_0x303f6f['options']?_0x303f6f[_0x1be5('0x19')][_0x1be5('0x1d')]?_[_0x1be5('0x1e')](_0x303f6f[_0x1be5('0x19')][_0x1be5('0x1d')],function(_0x5b5f17){return{'model':db[_0x5b5f17[_0x1be5('0x1f')]],'as':_0x5b5f17['as'],'attributes':_0x5b5f17[_0x1be5('0x20')],'include':_0x5b5f17['include']?_[_0x1be5('0x1e')](_0x5b5f17['include'],function(_0x4d5e55){return{'model':db[_0x4d5e55[_0x1be5('0x1f')]],'as':_0x4d5e55['as'],'attributes':_0x4d5e55[_0x1be5('0x20')],'include':_0x4d5e55[_0x1be5('0x1d')]?_['map'](_0x4d5e55[_0x1be5('0x1d')],function(_0x5e030f){return{'model':db[_0x5e030f[_0x1be5('0x1f')]],'as':_0x5e030f['as'],'attributes':_0x5e030f[_0x1be5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1be5('0xc')](function(_0x783680){logger['info'](_0x1be5('0x21'),_0x303f6f);logger[_0x1be5('0xf')](_0x1be5('0x21'),_0x303f6f,JSON[_0x1be5('0x11')](_0x783680));_0x3ab053(_0x783680);})[_0x1be5('0x17')](function(_0x10eb63){logger[_0x1be5('0x12')](_0x1be5('0x21'),_0x10eb63[_0x1be5('0x14')],_0x303f6f);_0x58685b(_0x9fbfa9['error'](0x1f4,_0x10eb63['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 3e669c3..13baffd 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xdb28,0x106));var _0x8db2=function(_0x3e25ad,_0x2f625f){_0x3e25ad=_0x3e25ad-0x0;var _0x1eec87=_0xdb28[_0x3e25ad];return _0x1eec87;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xdb28,0x106));var _0x8db2=function(_0x178fa3,_0x2ed19e){_0x178fa3=_0x178fa3-0x0;var _0x5405fa=_0xdb28[_0x178fa3];return _0x5405fa;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index ffe7e28..e6f35f5 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 _0x4a73=['Case','Task','contact','lead','account','nothing','sequelize','exports','STRING','ENUM'];(function(_0x28e65b,_0x118a3c){var _0xa399a=function(_0x7ef4d1){while(--_0x7ef4d1){_0x28e65b['push'](_0x28e65b['shift']());}};_0xa399a(++_0x118a3c);}(_0x4a73,0x1d2));var _0x34a7=function(_0x2ec1a1,_0x2e6e6e){_0x2ec1a1=_0x2ec1a1-0x0;var _0x3f1ccb=_0x4a73[_0x2ec1a1];return _0x3f1ccb;};'use strict';var Sequelize=require(_0x34a7('0x0'));module[_0x34a7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x34a7('0x2')]},'ticketType':{'type':Sequelize[_0x34a7('0x3')]('Task',_0x34a7('0x4')),'defaultValue':_0x34a7('0x5')},'moduleSearch':{'type':Sequelize[_0x34a7('0x3')]('contact_lead',_0x34a7('0x6'),_0x34a7('0x7'),'account_contact_lead',_0x34a7('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x34a7('0x3')](_0x34a7('0x9'),'contact','lead',_0x34a7('0x8')),'defaultValue':_0x34a7('0x7')},'leadId':{'type':Sequelize[_0x34a7('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x34a7('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x34a7('0x2')]}}; \ No newline at end of file +var _0x7611=['STRING','Task','Case','ENUM','contact_lead','contact','lead','account_contact_lead','account','sequelize','exports'];(function(_0x1ac874,_0xa88a86){var _0x135799=function(_0x38e3cb){while(--_0x38e3cb){_0x1ac874['push'](_0x1ac874['shift']());}};_0x135799(++_0xa88a86);}(_0x7611,0x77));var _0x1761=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x7611[_0x368bba];return _0x409f8f;};'use strict';var Sequelize=require(_0x1761('0x0'));module[_0x1761('0x1')]={'name':{'type':Sequelize[_0x1761('0x2')]},'description':{'type':Sequelize[_0x1761('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x1761('0x3'),_0x1761('0x4')),'defaultValue':_0x1761('0x3')},'moduleSearch':{'type':Sequelize[_0x1761('0x5')](_0x1761('0x6'),_0x1761('0x7'),_0x1761('0x8'),_0x1761('0x9'),_0x1761('0xa')),'defaultValue':_0x1761('0x6')},'moduleCreate':{'type':Sequelize[_0x1761('0x5')]('nothing',_0x1761('0x7'),_0x1761('0x8'),_0x1761('0xa')),'defaultValue':_0x1761('0x8')},'leadId':{'type':Sequelize[_0x1761('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x1761('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x1761('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x1761('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 3634464..4347256 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 _0xd67a=['order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','length','find','create','body','params','getFields','SalesforceField','pick','options','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xd67a,0x160));var _0xad67=function(_0x2a7022,_0x1c7d4b){_0x2a7022=_0x2a7022-0x0;var _0x8c8483=_0xd67a[_0x2a7022];return _0x8c8483;};'use strict';var emlformat=require(_0xad67('0x0'));var rimraf=require(_0xad67('0x1'));var zipdir=require(_0xad67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad67('0x3'));var moment=require('moment');var BPromise=require(_0xad67('0x4'));var Mustache=require(_0xad67('0x5'));var util=require(_0xad67('0x6'));var path=require(_0xad67('0x7'));var sox=require('sox');var csv=require(_0xad67('0x8'));var ejs=require(_0xad67('0x9'));var fs=require('fs');var fs_extra=require(_0xad67('0xa'));var _=require(_0xad67('0xb'));var squel=require(_0xad67('0xc'));var crypto=require(_0xad67('0xd'));var jsforce=require(_0xad67('0xe'));var deskjs=require(_0xad67('0xf'));var toCsv=require(_0xad67('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xad67('0x10'));var authService=require(_0xad67('0x11'));var qs=require(_0xad67('0x12'));var as=require(_0xad67('0x13'));var hardwareService=require(_0xad67('0x14'));var logger=require(_0xad67('0x15'))(_0xad67('0x16'));var utils=require('../../config/utils');var config=require(_0xad67('0x17'));var licenseUtil=require(_0xad67('0x18'));var db=require(_0xad67('0x19'))['db'];function respondWithStatusCode(_0x22a6ef,_0x4f76b0){_0x4f76b0=_0x4f76b0||0xcc;return function(_0x4488ac){if(_0x4488ac){return _0x22a6ef[_0xad67('0x1a')](_0x4f76b0);}return _0x22a6ef[_0xad67('0x1b')](_0x4f76b0)[_0xad67('0x1c')]();};}function respondWithResult(_0x30a94b,_0x56d306){_0x56d306=_0x56d306||0xc8;return function(_0x1289e9){if(_0x1289e9){return _0x30a94b['status'](_0x56d306)[_0xad67('0x1d')](_0x1289e9);}};}function respondWithFilteredResult(_0x5e27cf,_0x15024a){return function(_0x374053){if(_0x374053){var _0x35e592=typeof _0x15024a[_0xad67('0x1e')]===_0xad67('0x1f')&&typeof _0x15024a[_0xad67('0x20')]===_0xad67('0x1f');var _0x569eb9=_0x374053[_0xad67('0x21')];var _0x4ffc09=_0x35e592?0x0:_0x15024a[_0xad67('0x1e')];var _0x4bb55f=_0x35e592?_0x374053['count']:_0x15024a[_0xad67('0x1e')]+_0x15024a[_0xad67('0x20')];var _0x38e7ab;if(_0x4bb55f>=_0x569eb9){_0x4bb55f=_0x569eb9;_0x38e7ab=0xc8;}else{_0x38e7ab=0xce;}_0x5e27cf['status'](_0x38e7ab);return _0x5e27cf[_0xad67('0x22')](_0xad67('0x23'),_0x4ffc09+'-'+_0x4bb55f+'/'+_0x569eb9)['json'](_0x374053);}return null;};}function patchUpdates(_0x5cc937){return function(_0xd205e7){try{jsonpatch[_0xad67('0x24')](_0xd205e7,_0x5cc937,!![]);}catch(_0x5b5f07){return BPromise[_0xad67('0x25')](_0x5b5f07);}return _0xd205e7[_0xad67('0x26')]();};}function saveUpdates(_0x459f84,_0x2212be){return function(_0x326c81){if(_0x326c81){return _0x326c81['update'](_0x459f84)[_0xad67('0x27')](function(_0x1b9b20){return _0x1b9b20;});}return null;};}function removeEntity(_0x4d3fc5,_0x190f59){return function(_0x5e37d4){if(_0x5e37d4){return _0x5e37d4['destroy']()['then'](function(){_0x4d3fc5[_0xad67('0x1b')](0xcc)[_0xad67('0x1c')]();});}};}function handleEntityNotFound(_0x5e4b92,_0x54b441){return function(_0x2195ad){if(!_0x2195ad){_0x5e4b92[_0xad67('0x1a')](0x194);}return _0x2195ad;};}function handleError(_0x181130,_0x441db5){_0x441db5=_0x441db5||0x1f4;return function(_0x5ee425){logger[_0xad67('0x28')](_0x5ee425[_0xad67('0x29')]);if(_0x5ee425[_0xad67('0x2a')]){delete _0x5ee425[_0xad67('0x2a')];}_0x181130[_0xad67('0x1b')](_0x441db5)[_0xad67('0x2b')](_0x5ee425);};}exports['index']=function(_0x426279,_0x3aeab4){var _0x3355e6={},_0x9baf27={},_0x5cd5e8={'count':0x0,'rows':[]};var _0xc182dd=_[_0xad67('0x2c')](db[_0xad67('0x2d')][_0xad67('0x2e')],function(_0x5646d6){return{'name':_0x5646d6[_0xad67('0x2f')],'type':_0x5646d6[_0xad67('0x30')][_0xad67('0x31')]};});_0x9baf27['model']=_[_0xad67('0x2c')](_0xc182dd,'name');_0x9baf27[_0xad67('0x32')]=_[_0xad67('0x33')](_0x426279[_0xad67('0x32')]);_0x9baf27[_0xad67('0x34')]=_[_0xad67('0x35')](_0x9baf27['model'],_0x9baf27['query']);_0x3355e6['attributes']=_[_0xad67('0x35')](_0x9baf27[_0xad67('0x36')],qs[_0xad67('0x37')](_0x426279[_0xad67('0x32')]['fields']));_0x3355e6[_0xad67('0x38')]=_0x3355e6['attributes']['length']?_0x3355e6['attributes']:_0x9baf27[_0xad67('0x36')];if(!_0x426279[_0xad67('0x32')]['hasOwnProperty'](_0xad67('0x39'))){_0x3355e6['limit']=qs[_0xad67('0x20')](_0x426279[_0xad67('0x32')]['limit']);_0x3355e6[_0xad67('0x1e')]=qs[_0xad67('0x1e')](_0x426279['query'][_0xad67('0x1e')]);}_0x3355e6[_0xad67('0x3a')]=qs['sort'](_0x426279[_0xad67('0x32')][_0xad67('0x3b')]);_0x3355e6[_0xad67('0x3c')]=qs['filters'](_['pick'](_0x426279[_0xad67('0x32')],_0x9baf27[_0xad67('0x34')]),_0xc182dd);if(_0x426279[_0xad67('0x32')][_0xad67('0x3d')]){_0x3355e6[_0xad67('0x3c')]=_[_0xad67('0x3e')](_0x3355e6['where'],{'$or':_[_0xad67('0x2c')](_0xc182dd,function(_0x37fc16){if(_0x37fc16[_0xad67('0x30')]!==_0xad67('0x3f')){var _0x4d359a={};_0x4d359a[_0x37fc16[_0xad67('0x2a')]]={'$like':'%'+_0x426279[_0xad67('0x32')][_0xad67('0x3d')]+'%'};return _0x4d359a;}})});}_0x3355e6=_[_0xad67('0x3e')]({},_0x3355e6,_0x426279['options']);var _0x191a8d={'where':_0x3355e6['where']};return db[_0xad67('0x2d')]['count'](_0x191a8d)['then'](function(_0x481cea){_0x5cd5e8[_0xad67('0x21')]=_0x481cea;if(_0x426279[_0xad67('0x32')][_0xad67('0x40')]){_0x3355e6[_0xad67('0x41')]=[{'all':!![]}];}return db[_0xad67('0x2d')][_0xad67('0x42')](_0x3355e6);})['then'](function(_0x1622d4){_0x5cd5e8[_0xad67('0x43')]=_0x1622d4;return _0x5cd5e8;})[_0xad67('0x27')](respondWithFilteredResult(_0x3aeab4,_0x3355e6))[_0xad67('0x44')](handleError(_0x3aeab4,null));};exports['show']=function(_0x52e33a,_0x2438ab){var _0x2413a1={'raw':![],'where':{'id':_0x52e33a['params']['id']}},_0x12b60c={};_0x12b60c[_0xad67('0x36')]=_['keys'](db[_0xad67('0x2d')][_0xad67('0x2e')]);_0x12b60c[_0xad67('0x32')]=_[_0xad67('0x33')](_0x52e33a[_0xad67('0x32')]);_0x12b60c['filters']=_[_0xad67('0x35')](_0x12b60c['model'],_0x12b60c[_0xad67('0x32')]);_0x2413a1[_0xad67('0x38')]=_['intersection'](_0x12b60c[_0xad67('0x36')],qs[_0xad67('0x37')](_0x52e33a[_0xad67('0x32')][_0xad67('0x37')]));_0x2413a1[_0xad67('0x38')]=_0x2413a1[_0xad67('0x38')][_0xad67('0x45')]?_0x2413a1[_0xad67('0x38')]:_0x12b60c['model'];if(_0x52e33a['query'][_0xad67('0x40')]){_0x2413a1[_0xad67('0x41')]=[{'all':!![]}];}_0x2413a1=_[_0xad67('0x3e')]({},_0x2413a1,_0x52e33a['options']);return db[_0xad67('0x2d')][_0xad67('0x46')](_0x2413a1)['then'](handleEntityNotFound(_0x2438ab,null))[_0xad67('0x27')](respondWithResult(_0x2438ab,null))[_0xad67('0x44')](handleError(_0x2438ab,null));};exports[_0xad67('0x47')]=function(_0x5d97cb,_0x45a6b5){return db[_0xad67('0x2d')]['create'](_0x5d97cb[_0xad67('0x48')],{})[_0xad67('0x27')](respondWithResult(_0x45a6b5,0xc9))['catch'](handleError(_0x45a6b5,null));};exports['update']=function(_0x4262aa,_0x2ea04e){if(_0x4262aa[_0xad67('0x48')]['id']){delete _0x4262aa[_0xad67('0x48')]['id'];}return db[_0xad67('0x2d')][_0xad67('0x46')]({'where':{'id':_0x4262aa[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0x2ea04e,null))[_0xad67('0x27')](saveUpdates(_0x4262aa[_0xad67('0x48')],null))['then'](respondWithResult(_0x2ea04e,null))[_0xad67('0x44')](handleError(_0x2ea04e,null));};exports['destroy']=function(_0x361de6,_0xf4c8e9){return db[_0xad67('0x2d')][_0xad67('0x46')]({'where':{'id':_0x361de6[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0xf4c8e9,null))[_0xad67('0x27')](removeEntity(_0xf4c8e9,null))[_0xad67('0x44')](handleError(_0xf4c8e9,null));};exports[_0xad67('0x4a')]=function(_0x431d60,_0x1c688f,_0x2e5300){var _0x4ff62c={};var _0x207e6e={};var _0xc20f3b;var _0x54d6e5;return db[_0xad67('0x2d')]['findOne']({'where':{'id':_0x431d60[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0x1c688f,null))[_0xad67('0x27')](function(_0x35ec25){if(_0x35ec25){_0xc20f3b=_0x35ec25;_0x207e6e['model']=_[_0xad67('0x33')](db[_0xad67('0x4b')][_0xad67('0x2e')]);_0x207e6e['query']=_[_0xad67('0x33')](_0x431d60[_0xad67('0x32')]);_0x207e6e['filters']=_[_0xad67('0x35')](_0x207e6e[_0xad67('0x36')],_0x207e6e[_0xad67('0x32')]);_0x4ff62c[_0xad67('0x38')]=_[_0xad67('0x35')](_0x207e6e['model'],qs[_0xad67('0x37')](_0x431d60[_0xad67('0x32')]['fields']));_0x4ff62c[_0xad67('0x38')]=_0x4ff62c[_0xad67('0x38')]['length']?_0x4ff62c['attributes']:_0x207e6e[_0xad67('0x36')];_0x4ff62c['order']=qs[_0xad67('0x3b')](_0x431d60['query']['sort']);_0x4ff62c[_0xad67('0x3c')]=qs[_0xad67('0x34')](_[_0xad67('0x4c')](_0x431d60[_0xad67('0x32')],_0x207e6e[_0xad67('0x34')]));if(_0x431d60[_0xad67('0x32')][_0xad67('0x3d')]){_0x4ff62c[_0xad67('0x3c')]=_[_0xad67('0x3e')](_0x4ff62c[_0xad67('0x3c')],{'$or':_['map'](_0x4ff62c['attributes'],function(_0x362812){var _0x9bd64d={};_0x9bd64d[_0x362812]={'$like':'%'+_0x431d60[_0xad67('0x32')][_0xad67('0x3d')]+'%'};return _0x9bd64d;})});}_0x4ff62c=_[_0xad67('0x3e')]({},_0x4ff62c,_0x431d60[_0xad67('0x4d')]);return _0xc20f3b[_0xad67('0x4a')](_0x4ff62c);}})[_0xad67('0x27')](function(_0x53e03a){if(_0x53e03a){_0x54d6e5=_0x53e03a['length'];if(!_0x431d60[_0xad67('0x32')][_0xad67('0x4e')](_0xad67('0x39'))){_0x4ff62c[_0xad67('0x20')]=qs[_0xad67('0x20')](_0x431d60['query'][_0xad67('0x20')]);_0x4ff62c[_0xad67('0x1e')]=qs[_0xad67('0x1e')](_0x431d60[_0xad67('0x32')]['offset']);}return _0xc20f3b['getFields'](_0x4ff62c);}})[_0xad67('0x27')](function(_0x121de0){if(_0x121de0){return _0x121de0?{'count':_0x54d6e5,'rows':_0x121de0}:null;}})[_0xad67('0x27')](respondWithResult(_0x1c688f,null))[_0xad67('0x44')](handleError(_0x1c688f,null));};exports[_0xad67('0x4f')]=function(_0x4d4c30,_0x2c280b,_0xdec7ae){var _0x2ce183={};var _0x423a7e={};var _0x4efe73;var _0x1cc92d;return db[_0xad67('0x2d')][_0xad67('0x50')]({'where':{'id':_0x4d4c30[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0x2c280b,null))[_0xad67('0x27')](function(_0x563496){if(_0x563496){_0x4efe73=_0x563496;_0x423a7e[_0xad67('0x36')]=_[_0xad67('0x33')](db[_0xad67('0x4b')][_0xad67('0x2e')]);_0x423a7e['query']=_[_0xad67('0x33')](_0x4d4c30[_0xad67('0x32')]);_0x423a7e['filters']=_[_0xad67('0x35')](_0x423a7e[_0xad67('0x36')],_0x423a7e[_0xad67('0x32')]);_0x2ce183[_0xad67('0x38')]=_['intersection'](_0x423a7e['model'],qs[_0xad67('0x37')](_0x4d4c30['query']['fields']));_0x2ce183[_0xad67('0x38')]=_0x2ce183[_0xad67('0x38')]['length']?_0x2ce183[_0xad67('0x38')]:_0x423a7e[_0xad67('0x36')];_0x2ce183[_0xad67('0x3a')]=qs[_0xad67('0x3b')](_0x4d4c30[_0xad67('0x32')][_0xad67('0x3b')]);_0x2ce183[_0xad67('0x3c')]=qs[_0xad67('0x34')](_[_0xad67('0x4c')](_0x4d4c30[_0xad67('0x32')],_0x423a7e['filters']));if(_0x4d4c30[_0xad67('0x32')][_0xad67('0x3d')]){_0x2ce183['where']=_[_0xad67('0x3e')](_0x2ce183['where'],{'$or':_[_0xad67('0x2c')](_0x2ce183[_0xad67('0x38')],function(_0xaa558b){var _0x43db2e={};_0x43db2e[_0xaa558b]={'$like':'%'+_0x4d4c30[_0xad67('0x32')]['filter']+'%'};return _0x43db2e;})});}_0x2ce183=_[_0xad67('0x3e')]({},_0x2ce183,_0x4d4c30['options']);return _0x4efe73[_0xad67('0x4f')](_0x2ce183);}})[_0xad67('0x27')](function(_0x39f5e8){if(_0x39f5e8){_0x1cc92d=_0x39f5e8[_0xad67('0x45')];if(!_0x4d4c30['query'][_0xad67('0x4e')]('nolimit')){_0x2ce183['limit']=qs['limit'](_0x4d4c30[_0xad67('0x32')]['limit']);_0x2ce183[_0xad67('0x1e')]=qs['offset'](_0x4d4c30[_0xad67('0x32')]['offset']);}return _0x4efe73['getSubjects'](_0x2ce183);}})[_0xad67('0x27')](function(_0x1ed422){if(_0x1ed422){return _0x1ed422?{'count':_0x1cc92d,'rows':_0x1ed422}:null;}})['then'](respondWithResult(_0x2c280b,null))[_0xad67('0x44')](handleError(_0x2c280b,null));};exports['getDescriptions']=function(_0x13d414,_0x52e2b9,_0xddf93c){var _0x384e6f={};var _0x40b87b={};var _0x2e2bab;var _0x200994;return db[_0xad67('0x2d')][_0xad67('0x50')]({'where':{'id':_0x13d414[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0x52e2b9,null))[_0xad67('0x27')](function(_0x1d3501){if(_0x1d3501){_0x2e2bab=_0x1d3501;_0x40b87b[_0xad67('0x36')]=_[_0xad67('0x33')](db['SalesforceField'][_0xad67('0x2e')]);_0x40b87b[_0xad67('0x32')]=_['keys'](_0x13d414[_0xad67('0x32')]);_0x40b87b[_0xad67('0x34')]=_[_0xad67('0x35')](_0x40b87b[_0xad67('0x36')],_0x40b87b['query']);_0x384e6f[_0xad67('0x38')]=_[_0xad67('0x35')](_0x40b87b[_0xad67('0x36')],qs[_0xad67('0x37')](_0x13d414[_0xad67('0x32')][_0xad67('0x37')]));_0x384e6f[_0xad67('0x38')]=_0x384e6f[_0xad67('0x38')][_0xad67('0x45')]?_0x384e6f[_0xad67('0x38')]:_0x40b87b[_0xad67('0x36')];_0x384e6f[_0xad67('0x3a')]=qs[_0xad67('0x3b')](_0x13d414[_0xad67('0x32')][_0xad67('0x3b')]);_0x384e6f[_0xad67('0x3c')]=qs['filters'](_[_0xad67('0x4c')](_0x13d414[_0xad67('0x32')],_0x40b87b[_0xad67('0x34')]));if(_0x13d414[_0xad67('0x32')][_0xad67('0x3d')]){_0x384e6f[_0xad67('0x3c')]=_[_0xad67('0x3e')](_0x384e6f[_0xad67('0x3c')],{'$or':_[_0xad67('0x2c')](_0x384e6f['attributes'],function(_0x29c2d5){var _0x504502={};_0x504502[_0x29c2d5]={'$like':'%'+_0x13d414[_0xad67('0x32')][_0xad67('0x3d')]+'%'};return _0x504502;})});}_0x384e6f=_['merge']({},_0x384e6f,_0x13d414[_0xad67('0x4d')]);return _0x2e2bab[_0xad67('0x51')](_0x384e6f);}})['then'](function(_0x3b044a){if(_0x3b044a){_0x200994=_0x3b044a[_0xad67('0x45')];if(!_0x13d414[_0xad67('0x32')][_0xad67('0x4e')](_0xad67('0x39'))){_0x384e6f[_0xad67('0x20')]=qs[_0xad67('0x20')](_0x13d414[_0xad67('0x32')]['limit']);_0x384e6f[_0xad67('0x1e')]=qs['offset'](_0x13d414[_0xad67('0x32')][_0xad67('0x1e')]);}return _0x2e2bab[_0xad67('0x51')](_0x384e6f);}})['then'](function(_0x2522b9){if(_0x2522b9){return _0x2522b9?{'count':_0x200994,'rows':_0x2522b9}:null;}})[_0xad67('0x27')](respondWithResult(_0x52e2b9,null))[_0xad67('0x44')](handleError(_0x52e2b9,null));}; \ No newline at end of file +var _0xc123=['limit','Content-Range','apply','save','update','destroy','stack','name','index','map','SalesforceConfiguration','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','then','includeAll','catch','params','keys','options','find','create','body','getFields','SalesforceField','hasOwnProperty','getSubjects','getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x35aeb8,_0x3546f8){var _0x1b63f1=function(_0x49b6da){while(--_0x49b6da){_0x35aeb8['push'](_0x35aeb8['shift']());}};_0x1b63f1(++_0x3546f8);}(_0xc123,0x193));var _0x3c12=function(_0x3865b1,_0x28b224){_0x3865b1=_0x3865b1-0x0;var _0x4e5833=_0xc123[_0x3865b1];return _0x4e5833;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c12('0x0'));var zipdir=require(_0x3c12('0x1'));var jsonpatch=require(_0x3c12('0x2'));var rp=require(_0x3c12('0x3'));var moment=require(_0x3c12('0x4'));var BPromise=require(_0x3c12('0x5'));var Mustache=require(_0x3c12('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3c12('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c12('0x8'));var squel=require(_0x3c12('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c12('0xa'));var querystring=require(_0x3c12('0xb'));var Papa=require(_0x3c12('0xc'));var Redis=require(_0x3c12('0xd'));var authService=require(_0x3c12('0xe'));var qs=require(_0x3c12('0xf'));var as=require(_0x3c12('0x10'));var hardwareService=require(_0x3c12('0x11'));var logger=require(_0x3c12('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3c12('0x13'));var licenseUtil=require(_0x3c12('0x14'));var db=require(_0x3c12('0x15'))['db'];function respondWithStatusCode(_0x11a93a,_0x2fdb3f){_0x2fdb3f=_0x2fdb3f||0xcc;return function(_0x5a5ba2){if(_0x5a5ba2){return _0x11a93a[_0x3c12('0x16')](_0x2fdb3f);}return _0x11a93a[_0x3c12('0x17')](_0x2fdb3f)[_0x3c12('0x18')]();};}function respondWithResult(_0x134c95,_0xefd39a){_0xefd39a=_0xefd39a||0xc8;return function(_0x590b62){if(_0x590b62){return _0x134c95[_0x3c12('0x17')](_0xefd39a)[_0x3c12('0x19')](_0x590b62);}};}function respondWithFilteredResult(_0x399225,_0x450c5e){return function(_0x567e2b){if(_0x567e2b){var _0x5867d0=typeof _0x450c5e[_0x3c12('0x1a')]==='undefined'&&typeof _0x450c5e['limit']===_0x3c12('0x1b');var _0xad9d1d=_0x567e2b[_0x3c12('0x1c')];var _0x50b581=_0x5867d0?0x0:_0x450c5e[_0x3c12('0x1a')];var _0x33fa52=_0x5867d0?_0x567e2b['count']:_0x450c5e[_0x3c12('0x1a')]+_0x450c5e[_0x3c12('0x1d')];var _0x55a632;if(_0x33fa52>=_0xad9d1d){_0x33fa52=_0xad9d1d;_0x55a632=0xc8;}else{_0x55a632=0xce;}_0x399225[_0x3c12('0x17')](_0x55a632);return _0x399225['set'](_0x3c12('0x1e'),_0x50b581+'-'+_0x33fa52+'/'+_0xad9d1d)['json'](_0x567e2b);}return null;};}function patchUpdates(_0x39e109){return function(_0x1be9b5){try{jsonpatch[_0x3c12('0x1f')](_0x1be9b5,_0x39e109,!![]);}catch(_0x35ec4a){return BPromise['reject'](_0x35ec4a);}return _0x1be9b5[_0x3c12('0x20')]();};}function saveUpdates(_0x48fa3f,_0x4aca31){return function(_0x385744){if(_0x385744){return _0x385744[_0x3c12('0x21')](_0x48fa3f)['then'](function(_0x417a05){return _0x417a05;});}return null;};}function removeEntity(_0x533f32,_0x515251){return function(_0x2db656){if(_0x2db656){return _0x2db656[_0x3c12('0x22')]()['then'](function(){_0x533f32[_0x3c12('0x17')](0xcc)[_0x3c12('0x18')]();});}};}function handleEntityNotFound(_0x5af0af,_0x2a1123){return function(_0x50791a){if(!_0x50791a){_0x5af0af[_0x3c12('0x16')](0x194);}return _0x50791a;};}function handleError(_0x2d5daf,_0x26bb57){_0x26bb57=_0x26bb57||0x1f4;return function(_0x30a033){logger['error'](_0x30a033[_0x3c12('0x23')]);if(_0x30a033['name']){delete _0x30a033[_0x3c12('0x24')];}_0x2d5daf[_0x3c12('0x17')](_0x26bb57)['send'](_0x30a033);};}exports[_0x3c12('0x25')]=function(_0x111907,_0x56b246){var _0x28c381={},_0x54f6d4={},_0x596361={'count':0x0,'rows':[]};var _0x428a37=_[_0x3c12('0x26')](db[_0x3c12('0x27')][_0x3c12('0x28')],function(_0x56aa9c){return{'name':_0x56aa9c['fieldName'],'type':_0x56aa9c[_0x3c12('0x29')]['key']};});_0x54f6d4['model']=_[_0x3c12('0x26')](_0x428a37,_0x3c12('0x24'));_0x54f6d4[_0x3c12('0x2a')]=_['keys'](_0x111907['query']);_0x54f6d4[_0x3c12('0x2b')]=_[_0x3c12('0x2c')](_0x54f6d4[_0x3c12('0x2d')],_0x54f6d4[_0x3c12('0x2a')]);_0x28c381[_0x3c12('0x2e')]=_[_0x3c12('0x2c')](_0x54f6d4['model'],qs[_0x3c12('0x2f')](_0x111907['query']['fields']));_0x28c381[_0x3c12('0x2e')]=_0x28c381[_0x3c12('0x2e')][_0x3c12('0x30')]?_0x28c381['attributes']:_0x54f6d4[_0x3c12('0x2d')];if(!_0x111907[_0x3c12('0x2a')]['hasOwnProperty'](_0x3c12('0x31'))){_0x28c381[_0x3c12('0x1d')]=qs[_0x3c12('0x1d')](_0x111907[_0x3c12('0x2a')][_0x3c12('0x1d')]);_0x28c381[_0x3c12('0x1a')]=qs[_0x3c12('0x1a')](_0x111907[_0x3c12('0x2a')][_0x3c12('0x1a')]);}_0x28c381[_0x3c12('0x32')]=qs['sort'](_0x111907[_0x3c12('0x2a')][_0x3c12('0x33')]);_0x28c381[_0x3c12('0x34')]=qs[_0x3c12('0x2b')](_[_0x3c12('0x35')](_0x111907[_0x3c12('0x2a')],_0x54f6d4[_0x3c12('0x2b')]),_0x428a37);if(_0x111907[_0x3c12('0x2a')]['filter']){_0x28c381[_0x3c12('0x34')]=_['merge'](_0x28c381[_0x3c12('0x34')],{'$or':_[_0x3c12('0x26')](_0x428a37,function(_0x54ff5d){if(_0x54ff5d[_0x3c12('0x29')]!==_0x3c12('0x36')){var _0x4e76fb={};_0x4e76fb[_0x54ff5d[_0x3c12('0x24')]]={'$like':'%'+_0x111907['query'][_0x3c12('0x37')]+'%'};return _0x4e76fb;}})});}_0x28c381=_[_0x3c12('0x38')]({},_0x28c381,_0x111907['options']);var _0xa70cc5={'where':_0x28c381[_0x3c12('0x34')]};return db[_0x3c12('0x27')][_0x3c12('0x1c')](_0xa70cc5)[_0x3c12('0x39')](function(_0x5381d0){_0x596361[_0x3c12('0x1c')]=_0x5381d0;if(_0x111907[_0x3c12('0x2a')][_0x3c12('0x3a')]){_0x28c381['include']=[{'all':!![]}];}return db[_0x3c12('0x27')]['findAll'](_0x28c381);})[_0x3c12('0x39')](function(_0x2c21a3){_0x596361['rows']=_0x2c21a3;return _0x596361;})[_0x3c12('0x39')](respondWithFilteredResult(_0x56b246,_0x28c381))[_0x3c12('0x3b')](handleError(_0x56b246,null));};exports['show']=function(_0xf029a0,_0x1edf2f){var _0x56fe27={'raw':![],'where':{'id':_0xf029a0[_0x3c12('0x3c')]['id']}},_0x54399b={};_0x54399b[_0x3c12('0x2d')]=_['keys'](db[_0x3c12('0x27')]['rawAttributes']);_0x54399b[_0x3c12('0x2a')]=_[_0x3c12('0x3d')](_0xf029a0[_0x3c12('0x2a')]);_0x54399b['filters']=_['intersection'](_0x54399b['model'],_0x54399b[_0x3c12('0x2a')]);_0x56fe27[_0x3c12('0x2e')]=_[_0x3c12('0x2c')](_0x54399b[_0x3c12('0x2d')],qs['fields'](_0xf029a0['query']['fields']));_0x56fe27[_0x3c12('0x2e')]=_0x56fe27['attributes'][_0x3c12('0x30')]?_0x56fe27['attributes']:_0x54399b[_0x3c12('0x2d')];if(_0xf029a0[_0x3c12('0x2a')]['includeAll']){_0x56fe27['include']=[{'all':!![]}];}_0x56fe27=_['merge']({},_0x56fe27,_0xf029a0[_0x3c12('0x3e')]);return db[_0x3c12('0x27')][_0x3c12('0x3f')](_0x56fe27)[_0x3c12('0x39')](handleEntityNotFound(_0x1edf2f,null))[_0x3c12('0x39')](respondWithResult(_0x1edf2f,null))[_0x3c12('0x3b')](handleError(_0x1edf2f,null));};exports[_0x3c12('0x40')]=function(_0x1145aa,_0x32fc7c){return db['SalesforceConfiguration'][_0x3c12('0x40')](_0x1145aa[_0x3c12('0x41')],{})[_0x3c12('0x39')](respondWithResult(_0x32fc7c,0xc9))[_0x3c12('0x3b')](handleError(_0x32fc7c,null));};exports[_0x3c12('0x21')]=function(_0x3f52df,_0x34ac39){if(_0x3f52df[_0x3c12('0x41')]['id']){delete _0x3f52df[_0x3c12('0x41')]['id'];}return db[_0x3c12('0x27')][_0x3c12('0x3f')]({'where':{'id':_0x3f52df[_0x3c12('0x3c')]['id']}})[_0x3c12('0x39')](handleEntityNotFound(_0x34ac39,null))[_0x3c12('0x39')](saveUpdates(_0x3f52df[_0x3c12('0x41')],null))[_0x3c12('0x39')](respondWithResult(_0x34ac39,null))['catch'](handleError(_0x34ac39,null));};exports[_0x3c12('0x22')]=function(_0xedfa19,_0x62a21){return db[_0x3c12('0x27')]['find']({'where':{'id':_0xedfa19[_0x3c12('0x3c')]['id']}})['then'](handleEntityNotFound(_0x62a21,null))['then'](removeEntity(_0x62a21,null))[_0x3c12('0x3b')](handleError(_0x62a21,null));};exports[_0x3c12('0x42')]=function(_0x29648c,_0x182f50,_0x122b3f){var _0x4da8cf={};var _0x1d0609={};var _0x9e5a59;var _0x53ff4e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x29648c[_0x3c12('0x3c')]['id']}})[_0x3c12('0x39')](handleEntityNotFound(_0x182f50,null))[_0x3c12('0x39')](function(_0x296e69){if(_0x296e69){_0x9e5a59=_0x296e69;_0x1d0609[_0x3c12('0x2d')]=_[_0x3c12('0x3d')](db[_0x3c12('0x43')][_0x3c12('0x28')]);_0x1d0609['query']=_[_0x3c12('0x3d')](_0x29648c['query']);_0x1d0609[_0x3c12('0x2b')]=_[_0x3c12('0x2c')](_0x1d0609[_0x3c12('0x2d')],_0x1d0609[_0x3c12('0x2a')]);_0x4da8cf[_0x3c12('0x2e')]=_[_0x3c12('0x2c')](_0x1d0609[_0x3c12('0x2d')],qs['fields'](_0x29648c[_0x3c12('0x2a')][_0x3c12('0x2f')]));_0x4da8cf[_0x3c12('0x2e')]=_0x4da8cf['attributes'][_0x3c12('0x30')]?_0x4da8cf['attributes']:_0x1d0609['model'];_0x4da8cf[_0x3c12('0x32')]=qs[_0x3c12('0x33')](_0x29648c[_0x3c12('0x2a')][_0x3c12('0x33')]);_0x4da8cf[_0x3c12('0x34')]=qs[_0x3c12('0x2b')](_['pick'](_0x29648c[_0x3c12('0x2a')],_0x1d0609[_0x3c12('0x2b')]));if(_0x29648c[_0x3c12('0x2a')]['filter']){_0x4da8cf[_0x3c12('0x34')]=_['merge'](_0x4da8cf[_0x3c12('0x34')],{'$or':_['map'](_0x4da8cf[_0x3c12('0x2e')],function(_0x150af9){var _0x5e5998={};_0x5e5998[_0x150af9]={'$like':'%'+_0x29648c[_0x3c12('0x2a')]['filter']+'%'};return _0x5e5998;})});}_0x4da8cf=_[_0x3c12('0x38')]({},_0x4da8cf,_0x29648c['options']);return _0x9e5a59['getFields'](_0x4da8cf);}})[_0x3c12('0x39')](function(_0x5a8e3a){if(_0x5a8e3a){_0x53ff4e=_0x5a8e3a[_0x3c12('0x30')];if(!_0x29648c['query'][_0x3c12('0x44')](_0x3c12('0x31'))){_0x4da8cf['limit']=qs[_0x3c12('0x1d')](_0x29648c[_0x3c12('0x2a')][_0x3c12('0x1d')]);_0x4da8cf[_0x3c12('0x1a')]=qs['offset'](_0x29648c[_0x3c12('0x2a')][_0x3c12('0x1a')]);}return _0x9e5a59[_0x3c12('0x42')](_0x4da8cf);}})['then'](function(_0x47a624){if(_0x47a624){return _0x47a624?{'count':_0x53ff4e,'rows':_0x47a624}:null;}})[_0x3c12('0x39')](respondWithResult(_0x182f50,null))[_0x3c12('0x3b')](handleError(_0x182f50,null));};exports[_0x3c12('0x45')]=function(_0x2dcb5d,_0x2e0bb6,_0x10a9fb){var _0x45c5d7={};var _0x2eb95e={};var _0xdac660;var _0x5f1283;return db[_0x3c12('0x27')]['findOne']({'where':{'id':_0x2dcb5d[_0x3c12('0x3c')]['id']}})[_0x3c12('0x39')](handleEntityNotFound(_0x2e0bb6,null))['then'](function(_0x4d8d84){if(_0x4d8d84){_0xdac660=_0x4d8d84;_0x2eb95e['model']=_[_0x3c12('0x3d')](db[_0x3c12('0x43')][_0x3c12('0x28')]);_0x2eb95e[_0x3c12('0x2a')]=_[_0x3c12('0x3d')](_0x2dcb5d['query']);_0x2eb95e[_0x3c12('0x2b')]=_['intersection'](_0x2eb95e[_0x3c12('0x2d')],_0x2eb95e[_0x3c12('0x2a')]);_0x45c5d7['attributes']=_['intersection'](_0x2eb95e[_0x3c12('0x2d')],qs[_0x3c12('0x2f')](_0x2dcb5d[_0x3c12('0x2a')][_0x3c12('0x2f')]));_0x45c5d7['attributes']=_0x45c5d7[_0x3c12('0x2e')]['length']?_0x45c5d7[_0x3c12('0x2e')]:_0x2eb95e[_0x3c12('0x2d')];_0x45c5d7[_0x3c12('0x32')]=qs[_0x3c12('0x33')](_0x2dcb5d[_0x3c12('0x2a')][_0x3c12('0x33')]);_0x45c5d7[_0x3c12('0x34')]=qs[_0x3c12('0x2b')](_[_0x3c12('0x35')](_0x2dcb5d['query'],_0x2eb95e[_0x3c12('0x2b')]));if(_0x2dcb5d[_0x3c12('0x2a')][_0x3c12('0x37')]){_0x45c5d7['where']=_[_0x3c12('0x38')](_0x45c5d7[_0x3c12('0x34')],{'$or':_[_0x3c12('0x26')](_0x45c5d7[_0x3c12('0x2e')],function(_0xcf62fb){var _0x390a8b={};_0x390a8b[_0xcf62fb]={'$like':'%'+_0x2dcb5d[_0x3c12('0x2a')][_0x3c12('0x37')]+'%'};return _0x390a8b;})});}_0x45c5d7=_[_0x3c12('0x38')]({},_0x45c5d7,_0x2dcb5d[_0x3c12('0x3e')]);return _0xdac660[_0x3c12('0x45')](_0x45c5d7);}})['then'](function(_0x4391f4){if(_0x4391f4){_0x5f1283=_0x4391f4[_0x3c12('0x30')];if(!_0x2dcb5d[_0x3c12('0x2a')][_0x3c12('0x44')]('nolimit')){_0x45c5d7[_0x3c12('0x1d')]=qs['limit'](_0x2dcb5d['query']['limit']);_0x45c5d7[_0x3c12('0x1a')]=qs[_0x3c12('0x1a')](_0x2dcb5d['query'][_0x3c12('0x1a')]);}return _0xdac660[_0x3c12('0x45')](_0x45c5d7);}})[_0x3c12('0x39')](function(_0x5a1e02){if(_0x5a1e02){return _0x5a1e02?{'count':_0x5f1283,'rows':_0x5a1e02}:null;}})[_0x3c12('0x39')](respondWithResult(_0x2e0bb6,null))['catch'](handleError(_0x2e0bb6,null));};exports[_0x3c12('0x46')]=function(_0x56d2ad,_0x42e698,_0x7e3535){var _0x32bcde={};var _0x168d2a={};var _0x41738b;var _0xab0959;return db[_0x3c12('0x27')][_0x3c12('0x47')]({'where':{'id':_0x56d2ad['params']['id']}})[_0x3c12('0x39')](handleEntityNotFound(_0x42e698,null))[_0x3c12('0x39')](function(_0x4cc013){if(_0x4cc013){_0x41738b=_0x4cc013;_0x168d2a[_0x3c12('0x2d')]=_[_0x3c12('0x3d')](db['SalesforceField'][_0x3c12('0x28')]);_0x168d2a[_0x3c12('0x2a')]=_['keys'](_0x56d2ad[_0x3c12('0x2a')]);_0x168d2a[_0x3c12('0x2b')]=_[_0x3c12('0x2c')](_0x168d2a['model'],_0x168d2a['query']);_0x32bcde[_0x3c12('0x2e')]=_[_0x3c12('0x2c')](_0x168d2a[_0x3c12('0x2d')],qs[_0x3c12('0x2f')](_0x56d2ad['query']['fields']));_0x32bcde[_0x3c12('0x2e')]=_0x32bcde[_0x3c12('0x2e')][_0x3c12('0x30')]?_0x32bcde['attributes']:_0x168d2a[_0x3c12('0x2d')];_0x32bcde[_0x3c12('0x32')]=qs[_0x3c12('0x33')](_0x56d2ad[_0x3c12('0x2a')]['sort']);_0x32bcde['where']=qs['filters'](_[_0x3c12('0x35')](_0x56d2ad[_0x3c12('0x2a')],_0x168d2a[_0x3c12('0x2b')]));if(_0x56d2ad[_0x3c12('0x2a')][_0x3c12('0x37')]){_0x32bcde[_0x3c12('0x34')]=_[_0x3c12('0x38')](_0x32bcde[_0x3c12('0x34')],{'$or':_['map'](_0x32bcde[_0x3c12('0x2e')],function(_0x15d9bb){var _0x22e279={};_0x22e279[_0x15d9bb]={'$like':'%'+_0x56d2ad[_0x3c12('0x2a')][_0x3c12('0x37')]+'%'};return _0x22e279;})});}_0x32bcde=_[_0x3c12('0x38')]({},_0x32bcde,_0x56d2ad['options']);return _0x41738b['getDescriptions'](_0x32bcde);}})[_0x3c12('0x39')](function(_0x578da5){if(_0x578da5){_0xab0959=_0x578da5[_0x3c12('0x30')];if(!_0x56d2ad[_0x3c12('0x2a')][_0x3c12('0x44')](_0x3c12('0x31'))){_0x32bcde[_0x3c12('0x1d')]=qs['limit'](_0x56d2ad['query'][_0x3c12('0x1d')]);_0x32bcde[_0x3c12('0x1a')]=qs[_0x3c12('0x1a')](_0x56d2ad[_0x3c12('0x2a')][_0x3c12('0x1a')]);}return _0x41738b[_0x3c12('0x46')](_0x32bcde);}})[_0x3c12('0x39')](function(_0x3898fd){if(_0x3898fd){return _0x3898fd?{'count':_0xab0959,'rows':_0x3898fd}:null;}})[_0x3c12('0x39')](respondWithResult(_0x42e698,null))[_0x3c12('0x3b')](handleError(_0x42e698,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2132729..402cabb 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 _0x487a=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x44a7c4,_0x1b6f84){var _0x4f1c98=function(_0x49bcc7){while(--_0x49bcc7){_0x44a7c4['push'](_0x44a7c4['shift']());}};_0x4f1c98(++_0x1b6f84);}(_0x487a,0x9d));var _0xa487=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x487a[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0xa487('0x0'));var util=require(_0xa487('0x1'));var logger=require(_0xa487('0x2'))(_0xa487('0x3'));var moment=require(_0xa487('0x4'));var BPromise=require('bluebird');var rp=require(_0xa487('0x5'));var fs=require('fs');var path=require(_0xa487('0x6'));var rimraf=require('rimraf');var config=require(_0xa487('0x7'));var attributes=require(_0xa487('0x8'));module[_0xa487('0x9')]=function(_0xe86abf,_0x16b088){return _0xe86abf[_0xa487('0xa')](_0xa487('0xb'),attributes,{'tableName':_0xa487('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf7b=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x1a4810,_0x1810a1){var _0x34e6a4=function(_0x4472d2){while(--_0x4472d2){_0x1a4810['push'](_0x1a4810['shift']());}};_0x34e6a4(++_0x1810a1);}(_0xaf7b,0x155));var _0xbaf7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaf7b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbaf7('0x0'));var util=require('util');var logger=require(_0xbaf7('0x1'))(_0xbaf7('0x2'));var moment=require('moment');var BPromise=require(_0xbaf7('0x3'));var rp=require(_0xbaf7('0x4'));var fs=require('fs');var path=require(_0xbaf7('0x5'));var rimraf=require(_0xbaf7('0x6'));var config=require(_0xbaf7('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0xa56ea5,_0x7807d8){return _0xa56ea5[_0xbaf7('0x8')](_0xbaf7('0x9'),attributes,{'tableName':_0xbaf7('0xa'),'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 f260b5d..ed66a48 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 _0x4cd8=['stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug'];(function(_0x2b9c7d,_0x43d27e){var _0x124b48=function(_0x1dcff9){while(--_0x1dcff9){_0x2b9c7d['push'](_0x2b9c7d['shift']());}};_0x124b48(++_0x43d27e);}(_0x4cd8,0x140));var _0x84cd=function(_0x5e5c4c,_0x21abba){_0x5e5c4c=_0x5e5c4c-0x0;var _0x176148=_0x4cd8[_0x5e5c4c];return _0x176148;};'use strict';var _=require(_0x84cd('0x0'));var util=require(_0x84cd('0x1'));var moment=require(_0x84cd('0x2'));var BPromise=require(_0x84cd('0x3'));var rs=require(_0x84cd('0x4'));var fs=require('fs');var Redis=require(_0x84cd('0x5'));var db=require(_0x84cd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x84cd('0x7'))(_0x84cd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x84cd('0x9')][_0x84cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c3776,_0x87bb5f,_0x1192d9){return new BPromise(function(_0x137efc,_0x335dea){return client[_0x84cd('0xb')](_0x4c3776,_0x1192d9)[_0x84cd('0xc')](function(_0x3de60e){logger[_0x84cd('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x87bb5f,_0x84cd('0xe'));logger[_0x84cd('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x87bb5f,_0x84cd('0xe'),JSON[_0x84cd('0x10')](_0x3de60e));if(_0x3de60e['error']){if(_0x3de60e[_0x84cd('0x11')][_0x84cd('0x12')]===0x1f4){logger[_0x84cd('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x87bb5f,_0x3de60e[_0x84cd('0x11')][_0x84cd('0x13')]);return _0x335dea(_0x3de60e[_0x84cd('0x11')]['message']);}logger['error'](_0x84cd('0x14'),_0x87bb5f,_0x3de60e[_0x84cd('0x11')][_0x84cd('0x13')]);return _0x137efc(_0x3de60e[_0x84cd('0x11')]['message']);}else{logger[_0x84cd('0xd')](_0x84cd('0x14'),_0x87bb5f,_0x84cd('0xe'));_0x137efc(_0x3de60e['result'][_0x84cd('0x13')]);}})['catch'](function(_0x534680){logger[_0x84cd('0x11')](_0x84cd('0x14'),_0x87bb5f,_0x534680);_0x335dea(_0x534680);});});} \ No newline at end of file +var _0x776b=['debug','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x374464,_0x29228b){var _0x42e531=function(_0xe3506e){while(--_0xe3506e){_0x374464['push'](_0x374464['shift']());}};_0x42e531(++_0x29228b);}(_0x776b,0x1a8));var _0xb776=function(_0x5bb076,_0x55227d){_0x5bb076=_0x5bb076-0x0;var _0x160b1a=_0x776b[_0x5bb076];return _0x160b1a;};'use strict';var _=require(_0xb776('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb776('0x1'));var rs=require(_0xb776('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb776('0x3'))['db'];var utils=require(_0xb776('0x4'));var logger=require(_0xb776('0x5'))(_0xb776('0x6'));var config=require(_0xb776('0x7'));var jayson=require(_0xb776('0x8'));var client=jayson[_0xb776('0x9')][_0xb776('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25762a,_0x37fa83,_0xaeee4c){return new BPromise(function(_0x5e11e3,_0x53e26f){return client[_0xb776('0xb')](_0x25762a,_0xaeee4c)[_0xb776('0xc')](function(_0x37e292){logger[_0xb776('0xd')](_0xb776('0xe'),_0x37fa83,_0xb776('0xf'));logger[_0xb776('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x37fa83,_0xb776('0xf'),JSON['stringify'](_0x37e292));if(_0x37e292[_0xb776('0x11')]){if(_0x37e292[_0xb776('0x11')][_0xb776('0x12')]===0x1f4){logger[_0xb776('0x11')](_0xb776('0xe'),_0x37fa83,_0x37e292[_0xb776('0x11')]['message']);return _0x53e26f(_0x37e292['error'][_0xb776('0x13')]);}logger[_0xb776('0x11')](_0xb776('0xe'),_0x37fa83,_0x37e292[_0xb776('0x11')][_0xb776('0x13')]);return _0x5e11e3(_0x37e292['error'][_0xb776('0x13')]);}else{logger[_0xb776('0xd')](_0xb776('0xe'),_0x37fa83,'request\x20sent');_0x5e11e3(_0x37e292[_0xb776('0x14')][_0xb776('0x13')]);}})[_0xb776('0x15')](function(_0x6b8580){logger[_0xb776('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x37fa83,_0x6b8580);_0x53e26f(_0x6b8580);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 22679fa..7149e9f 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 _0x3063=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x3063,0xf4));var _0x3306=function(_0x51b648,_0x3af80d){_0x51b648=_0x51b648-0x0;var _0x58a6e5=_0x3063[_0x51b648];return _0x58a6e5;};'use strict';var multer=require(_0x3306('0x0'));var util=require(_0x3306('0x1'));var path=require(_0x3306('0x2'));var timeout=require(_0x3306('0x3'));var express=require(_0x3306('0x4'));var router=express[_0x3306('0x5')]();var fs_extra=require(_0x3306('0x6'));var auth=require(_0x3306('0x7'));var interaction=require(_0x3306('0x8'));var config=require(_0x3306('0x9'));var controller=require(_0x3306('0xa'));router[_0x3306('0xb')]('/',auth[_0x3306('0xc')](),controller[_0x3306('0xd')]);router[_0x3306('0xb')](_0x3306('0xe'),auth[_0x3306('0xc')](),controller[_0x3306('0xf')]);router[_0x3306('0x10')]('/',auth[_0x3306('0xc')](),controller[_0x3306('0x11')]);router[_0x3306('0x12')]('/:id',auth[_0x3306('0xc')](),controller['update']);router[_0x3306('0x13')]('/:id',auth[_0x3306('0xc')](),controller[_0x3306('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc357=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc357,0xd5));var _0x7c35=function(_0x18d5fc,_0x4a24be){_0x18d5fc=_0x18d5fc-0x0;var _0x1b9af0=_0xc357[_0x18d5fc];return _0x1b9af0;};'use strict';var multer=require('multer');var util=require(_0x7c35('0x0'));var path=require(_0x7c35('0x1'));var timeout=require(_0x7c35('0x2'));var express=require(_0x7c35('0x3'));var router=express[_0x7c35('0x4')]();var fs_extra=require(_0x7c35('0x5'));var auth=require(_0x7c35('0x6'));var interaction=require(_0x7c35('0x7'));var config=require('../../config/environment');var controller=require(_0x7c35('0x8'));router[_0x7c35('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7c35('0x9')](_0x7c35('0xa'),auth[_0x7c35('0xb')](),controller[_0x7c35('0xc')]);router[_0x7c35('0xd')]('/',auth[_0x7c35('0xb')](),controller[_0x7c35('0xe')]);router[_0x7c35('0xf')](_0x7c35('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7c35('0x10')](_0x7c35('0xa'),auth[_0x7c35('0xb')](),controller[_0x7c35('0x11')]);module[_0x7c35('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 4c05173..a812364 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 _0x9727=['ENUM','customVariable','sequelize','exports','string','variable','picklist','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9727,0x13a));var _0x7972=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x9727[_0x2ddfd9];return _0x2668f0;};'use strict';var Sequelize=require(_0x7972('0x0'));module[_0x7972('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7972('0x2'),_0x7972('0x3'),'customVariable','keyValue',_0x7972('0x4')),'defaultValue':_0x7972('0x2')},'content':{'type':Sequelize[_0x7972('0x5')]},'key':{'type':Sequelize[_0x7972('0x5')]},'keyType':{'type':Sequelize[_0x7972('0x6')]('string','variable',_0x7972('0x7'))},'keyContent':{'type':Sequelize[_0x7972('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x7972('0x5')]}}; \ No newline at end of file +var _0xff44=['picklist','string','STRING','customVariable','sequelize','ENUM','variable','keyValue'];(function(_0x444ca5,_0x4581e6){var _0x53be3a=function(_0x3fdf20){while(--_0x3fdf20){_0x444ca5['push'](_0x444ca5['shift']());}};_0x53be3a(++_0x4581e6);}(_0xff44,0x13c));var _0x4ff4=function(_0x1719e4,_0x4278fe){_0x1719e4=_0x1719e4-0x0;var _0x236bac=_0xff44[_0x1719e4];return _0x236bac;};'use strict';var Sequelize=require(_0x4ff4('0x0'));module['exports']={'type':{'type':Sequelize[_0x4ff4('0x1')]('string',_0x4ff4('0x2'),'customVariable',_0x4ff4('0x3'),_0x4ff4('0x4')),'defaultValue':_0x4ff4('0x5')},'content':{'type':Sequelize[_0x4ff4('0x6')]},'key':{'type':Sequelize[_0x4ff4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4ff4('0x5'),_0x4ff4('0x2'),_0x4ff4('0x7'))},'keyContent':{'type':Sequelize[_0x4ff4('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x4ff4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 0755835..f333996 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 _0x312b=['type','options','SalesforceField','include','findAll','show','params','rawAttributes','includeAll','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','offset','undefined','limit','count','status','json','apply','reject','save','update','destroy','then','end','error','name','send','index','map','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x312b,0x1ab));var _0xb312=function(_0x417291,_0x1d64e6){_0x417291=_0x417291-0x0;var _0x5202b3=_0x312b[_0x417291];return _0x5202b3;};'use strict';var emlformat=require(_0xb312('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb312('0x1'));var jsonpatch=require(_0xb312('0x2'));var rp=require(_0xb312('0x3'));var moment=require(_0xb312('0x4'));var BPromise=require(_0xb312('0x5'));var Mustache=require(_0xb312('0x6'));var util=require(_0xb312('0x7'));var path=require(_0xb312('0x8'));var sox=require(_0xb312('0x9'));var csv=require(_0xb312('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb312('0xb'));var _=require(_0xb312('0xc'));var squel=require('squel');var crypto=require(_0xb312('0xd'));var jsforce=require(_0xb312('0xe'));var deskjs=require(_0xb312('0xf'));var toCsv=require(_0xb312('0xa'));var querystring=require('querystring');var Papa=require(_0xb312('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb312('0x11'));var as=require(_0xb312('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb312('0x13'))(_0xb312('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb312('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a064e,_0x2de5ad){_0x2de5ad=_0x2de5ad||0xcc;return function(_0x233e34){if(_0x233e34){return _0x2a064e[_0xb312('0x16')](_0x2de5ad);}return _0x2a064e['status'](_0x2de5ad)['end']();};}function respondWithResult(_0x2dc85a,_0x33b808){_0x33b808=_0x33b808||0xc8;return function(_0x475628){if(_0x475628){return _0x2dc85a['status'](_0x33b808)['json'](_0x475628);}};}function respondWithFilteredResult(_0x3781a3,_0x3918d1){return function(_0x212986){if(_0x212986){var _0x4f1cbd=typeof _0x3918d1[_0xb312('0x17')]===_0xb312('0x18')&&typeof _0x3918d1[_0xb312('0x19')]===_0xb312('0x18');var _0x3d5fe3=_0x212986[_0xb312('0x1a')];var _0xa3de0c=_0x4f1cbd?0x0:_0x3918d1['offset'];var _0x3ee589=_0x4f1cbd?_0x212986[_0xb312('0x1a')]:_0x3918d1[_0xb312('0x17')]+_0x3918d1[_0xb312('0x19')];var _0x151ed2;if(_0x3ee589>=_0x3d5fe3){_0x3ee589=_0x3d5fe3;_0x151ed2=0xc8;}else{_0x151ed2=0xce;}_0x3781a3[_0xb312('0x1b')](_0x151ed2);return _0x3781a3['set']('Content-Range',_0xa3de0c+'-'+_0x3ee589+'/'+_0x3d5fe3)[_0xb312('0x1c')](_0x212986);}return null;};}function patchUpdates(_0x2b678d){return function(_0x5e2c68){try{jsonpatch[_0xb312('0x1d')](_0x5e2c68,_0x2b678d,!![]);}catch(_0x415138){return BPromise[_0xb312('0x1e')](_0x415138);}return _0x5e2c68[_0xb312('0x1f')]();};}function saveUpdates(_0x483101,_0x489756){return function(_0x4af286){if(_0x4af286){return _0x4af286[_0xb312('0x20')](_0x483101)['then'](function(_0x1fa57e){return _0x1fa57e;});}return null;};}function removeEntity(_0x4c8bf5,_0x28421b){return function(_0x324497){if(_0x324497){return _0x324497[_0xb312('0x21')]()[_0xb312('0x22')](function(){_0x4c8bf5[_0xb312('0x1b')](0xcc)[_0xb312('0x23')]();});}};}function handleEntityNotFound(_0x204cf2,_0x4eb98d){return function(_0x4ec451){if(!_0x4ec451){_0x204cf2['sendStatus'](0x194);}return _0x4ec451;};}function handleError(_0x6329bd,_0x4310f4){_0x4310f4=_0x4310f4||0x1f4;return function(_0x3a0ec7){logger[_0xb312('0x24')](_0x3a0ec7['stack']);if(_0x3a0ec7[_0xb312('0x25')]){delete _0x3a0ec7[_0xb312('0x25')];}_0x6329bd[_0xb312('0x1b')](_0x4310f4)[_0xb312('0x26')](_0x3a0ec7);};}exports[_0xb312('0x27')]=function(_0x35f4d3,_0x1e73be){var _0x1c69ca={},_0x271822={},_0x10ff0d={'count':0x0,'rows':[]};var _0x365544=_[_0xb312('0x28')](db['SalesforceField']['rawAttributes'],function(_0x5eddaa){return{'name':_0x5eddaa[_0xb312('0x29')],'type':_0x5eddaa['type']['key']};});_0x271822[_0xb312('0x2a')]=_[_0xb312('0x28')](_0x365544,_0xb312('0x25'));_0x271822[_0xb312('0x2b')]=_[_0xb312('0x2c')](_0x35f4d3[_0xb312('0x2b')]);_0x271822[_0xb312('0x2d')]=_['intersection'](_0x271822[_0xb312('0x2a')],_0x271822[_0xb312('0x2b')]);_0x1c69ca[_0xb312('0x2e')]=_[_0xb312('0x2f')](_0x271822['model'],qs[_0xb312('0x30')](_0x35f4d3[_0xb312('0x2b')][_0xb312('0x30')]));_0x1c69ca[_0xb312('0x2e')]=_0x1c69ca[_0xb312('0x2e')][_0xb312('0x31')]?_0x1c69ca[_0xb312('0x2e')]:_0x271822[_0xb312('0x2a')];if(!_0x35f4d3[_0xb312('0x2b')][_0xb312('0x32')](_0xb312('0x33'))){_0x1c69ca[_0xb312('0x19')]=qs[_0xb312('0x19')](_0x35f4d3['query']['limit']);_0x1c69ca['offset']=qs[_0xb312('0x17')](_0x35f4d3[_0xb312('0x2b')][_0xb312('0x17')]);}_0x1c69ca['order']=qs['sort'](_0x35f4d3['query'][_0xb312('0x34')]);_0x1c69ca['where']=qs[_0xb312('0x2d')](_['pick'](_0x35f4d3[_0xb312('0x2b')],_0x271822[_0xb312('0x2d')]),_0x365544);if(_0x35f4d3[_0xb312('0x2b')][_0xb312('0x35')]){_0x1c69ca[_0xb312('0x36')]=_[_0xb312('0x37')](_0x1c69ca[_0xb312('0x36')],{'$or':_['map'](_0x365544,function(_0x25fe07){if(_0x25fe07[_0xb312('0x38')]!=='VIRTUAL'){var _0x25f60a={};_0x25f60a[_0x25fe07[_0xb312('0x25')]]={'$like':'%'+_0x35f4d3['query']['filter']+'%'};return _0x25f60a;}})});}_0x1c69ca=_['merge']({},_0x1c69ca,_0x35f4d3[_0xb312('0x39')]);var _0xc5e722={'where':_0x1c69ca[_0xb312('0x36')]};return db[_0xb312('0x3a')][_0xb312('0x1a')](_0xc5e722)[_0xb312('0x22')](function(_0x1091c2){_0x10ff0d['count']=_0x1091c2;if(_0x35f4d3[_0xb312('0x2b')]['includeAll']){_0x1c69ca[_0xb312('0x3b')]=[{'all':!![]}];}return db[_0xb312('0x3a')][_0xb312('0x3c')](_0x1c69ca);})[_0xb312('0x22')](function(_0x4c464f){_0x10ff0d['rows']=_0x4c464f;return _0x10ff0d;})[_0xb312('0x22')](respondWithFilteredResult(_0x1e73be,_0x1c69ca))['catch'](handleError(_0x1e73be,null));};exports[_0xb312('0x3d')]=function(_0xb80efc,_0x1998d8){var _0x286bc4={'raw':!![],'where':{'id':_0xb80efc[_0xb312('0x3e')]['id']}},_0x57c5a1={};_0x57c5a1['model']=_[_0xb312('0x2c')](db[_0xb312('0x3a')][_0xb312('0x3f')]);_0x57c5a1[_0xb312('0x2b')]=_[_0xb312('0x2c')](_0xb80efc[_0xb312('0x2b')]);_0x57c5a1[_0xb312('0x2d')]=_['intersection'](_0x57c5a1['model'],_0x57c5a1['query']);_0x286bc4['attributes']=_[_0xb312('0x2f')](_0x57c5a1[_0xb312('0x2a')],qs[_0xb312('0x30')](_0xb80efc[_0xb312('0x2b')][_0xb312('0x30')]));_0x286bc4[_0xb312('0x2e')]=_0x286bc4['attributes']['length']?_0x286bc4[_0xb312('0x2e')]:_0x57c5a1['model'];if(_0xb80efc[_0xb312('0x2b')][_0xb312('0x40')]){_0x286bc4['include']=[{'all':!![]}];}_0x286bc4=_[_0xb312('0x37')]({},_0x286bc4,_0xb80efc['options']);return db[_0xb312('0x3a')]['find'](_0x286bc4)[_0xb312('0x22')](handleEntityNotFound(_0x1998d8,null))['then'](respondWithResult(_0x1998d8,null))[_0xb312('0x41')](handleError(_0x1998d8,null));};exports[_0xb312('0x42')]=function(_0x1b25ce,_0x5861db){return db['SalesforceField'][_0xb312('0x42')](_0x1b25ce[_0xb312('0x43')],{})[_0xb312('0x22')](respondWithResult(_0x5861db,0xc9))['catch'](handleError(_0x5861db,null));};exports['update']=function(_0x19973d,_0x3faef3){if(_0x19973d['body']['id']){delete _0x19973d[_0xb312('0x43')]['id'];}return db['SalesforceField'][_0xb312('0x44')]({'where':{'id':_0x19973d[_0xb312('0x3e')]['id']}})[_0xb312('0x22')](handleEntityNotFound(_0x3faef3,null))[_0xb312('0x22')](saveUpdates(_0x19973d[_0xb312('0x43')],null))[_0xb312('0x22')](respondWithResult(_0x3faef3,null))[_0xb312('0x41')](handleError(_0x3faef3,null));};exports[_0xb312('0x21')]=function(_0x486d2e,_0x13d08a){return db[_0xb312('0x3a')][_0xb312('0x44')]({'where':{'id':_0x486d2e[_0xb312('0x3e')]['id']}})['then'](handleEntityNotFound(_0x13d08a,null))[_0xb312('0x22')](removeEntity(_0x13d08a,null))[_0xb312('0x41')](handleError(_0x13d08a,null));}; \ No newline at end of file +var _0xbe7b=['name','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','keys','length','include','options','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','sox','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','update','destroy','then','end','sendStatus','error','stack'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xbe7b,0x66));var _0xbbe7=function(_0x5442c2,_0x3223cc){_0x5442c2=_0x5442c2-0x0;var _0x40baac=_0xbe7b[_0x5442c2];return _0x40baac;};'use strict';var emlformat=require(_0xbbe7('0x0'));var rimraf=require(_0xbbe7('0x1'));var zipdir=require(_0xbbe7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbbe7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbbe7('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbbe7('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbe7('0x6'));var _=require(_0xbbe7('0x7'));var squel=require(_0xbbe7('0x8'));var crypto=require(_0xbbe7('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbbe7('0xa'));var Papa=require(_0xbbe7('0xb'));var Redis=require('ioredis');var authService=require(_0xbbe7('0xc'));var qs=require(_0xbbe7('0xd'));var as=require(_0xbbe7('0xe'));var hardwareService=require(_0xbbe7('0xf'));var logger=require(_0xbbe7('0x10'))(_0xbbe7('0x11'));var utils=require(_0xbbe7('0x12'));var config=require(_0xbbe7('0x13'));var licenseUtil=require(_0xbbe7('0x14'));var db=require(_0xbbe7('0x15'))['db'];function respondWithStatusCode(_0x2d8878,_0x3b7888){_0x3b7888=_0x3b7888||0xcc;return function(_0x50e835){if(_0x50e835){return _0x2d8878['sendStatus'](_0x3b7888);}return _0x2d8878[_0xbbe7('0x16')](_0x3b7888)['end']();};}function respondWithResult(_0x49c355,_0x2ed308){_0x2ed308=_0x2ed308||0xc8;return function(_0x25697e){if(_0x25697e){return _0x49c355[_0xbbe7('0x16')](_0x2ed308)[_0xbbe7('0x17')](_0x25697e);}};}function respondWithFilteredResult(_0x221fd9,_0x5d420b){return function(_0x47ea77){if(_0x47ea77){var _0xef59e4=typeof _0x5d420b[_0xbbe7('0x18')]===_0xbbe7('0x19')&&typeof _0x5d420b[_0xbbe7('0x1a')]==='undefined';var _0x47f2f4=_0x47ea77[_0xbbe7('0x1b')];var _0x36162c=_0xef59e4?0x0:_0x5d420b[_0xbbe7('0x18')];var _0x31b21e=_0xef59e4?_0x47ea77[_0xbbe7('0x1b')]:_0x5d420b['offset']+_0x5d420b[_0xbbe7('0x1a')];var _0x5e67d0;if(_0x31b21e>=_0x47f2f4){_0x31b21e=_0x47f2f4;_0x5e67d0=0xc8;}else{_0x5e67d0=0xce;}_0x221fd9['status'](_0x5e67d0);return _0x221fd9[_0xbbe7('0x1c')]('Content-Range',_0x36162c+'-'+_0x31b21e+'/'+_0x47f2f4)[_0xbbe7('0x17')](_0x47ea77);}return null;};}function patchUpdates(_0x5e9d12){return function(_0x5b9a46){try{jsonpatch['apply'](_0x5b9a46,_0x5e9d12,!![]);}catch(_0x15361d){return BPromise['reject'](_0x15361d);}return _0x5b9a46['save']();};}function saveUpdates(_0x3d4f23,_0x5b1ff4){return function(_0x5c119f){if(_0x5c119f){return _0x5c119f[_0xbbe7('0x1d')](_0x3d4f23)['then'](function(_0x1eb2f2){return _0x1eb2f2;});}return null;};}function removeEntity(_0x2c8bcf,_0x2c8c7e){return function(_0x3e5cc9){if(_0x3e5cc9){return _0x3e5cc9[_0xbbe7('0x1e')]()[_0xbbe7('0x1f')](function(){_0x2c8bcf['status'](0xcc)[_0xbbe7('0x20')]();});}};}function handleEntityNotFound(_0x4f8e31,_0x43700f){return function(_0x2ee211){if(!_0x2ee211){_0x4f8e31[_0xbbe7('0x21')](0x194);}return _0x2ee211;};}function handleError(_0x5efe26,_0x186c33){_0x186c33=_0x186c33||0x1f4;return function(_0x5b10af){logger[_0xbbe7('0x22')](_0x5b10af[_0xbbe7('0x23')]);if(_0x5b10af['name']){delete _0x5b10af[_0xbbe7('0x24')];}_0x5efe26[_0xbbe7('0x16')](_0x186c33)['send'](_0x5b10af);};}exports[_0xbbe7('0x25')]=function(_0x50410d,_0x12ecf6){var _0x18cbec={},_0x1e9be8={},_0x5a9b4c={'count':0x0,'rows':[]};var _0x40f696=_[_0xbbe7('0x26')](db[_0xbbe7('0x27')][_0xbbe7('0x28')],function(_0x53c4ed){return{'name':_0x53c4ed[_0xbbe7('0x29')],'type':_0x53c4ed[_0xbbe7('0x2a')]['key']};});_0x1e9be8[_0xbbe7('0x2b')]=_[_0xbbe7('0x26')](_0x40f696,_0xbbe7('0x24'));_0x1e9be8[_0xbbe7('0x2c')]=_['keys'](_0x50410d['query']);_0x1e9be8[_0xbbe7('0x2d')]=_[_0xbbe7('0x2e')](_0x1e9be8['model'],_0x1e9be8['query']);_0x18cbec[_0xbbe7('0x2f')]=_[_0xbbe7('0x2e')](_0x1e9be8[_0xbbe7('0x2b')],qs[_0xbbe7('0x30')](_0x50410d['query'][_0xbbe7('0x30')]));_0x18cbec[_0xbbe7('0x2f')]=_0x18cbec[_0xbbe7('0x2f')]['length']?_0x18cbec[_0xbbe7('0x2f')]:_0x1e9be8[_0xbbe7('0x2b')];if(!_0x50410d[_0xbbe7('0x2c')][_0xbbe7('0x31')]('nolimit')){_0x18cbec['limit']=qs[_0xbbe7('0x1a')](_0x50410d[_0xbbe7('0x2c')][_0xbbe7('0x1a')]);_0x18cbec[_0xbbe7('0x18')]=qs['offset'](_0x50410d['query'][_0xbbe7('0x18')]);}_0x18cbec[_0xbbe7('0x32')]=qs[_0xbbe7('0x33')](_0x50410d[_0xbbe7('0x2c')][_0xbbe7('0x33')]);_0x18cbec[_0xbbe7('0x34')]=qs[_0xbbe7('0x2d')](_[_0xbbe7('0x35')](_0x50410d[_0xbbe7('0x2c')],_0x1e9be8['filters']),_0x40f696);if(_0x50410d[_0xbbe7('0x2c')][_0xbbe7('0x36')]){_0x18cbec[_0xbbe7('0x34')]=_['merge'](_0x18cbec[_0xbbe7('0x34')],{'$or':_[_0xbbe7('0x26')](_0x40f696,function(_0x235d90){if(_0x235d90[_0xbbe7('0x2a')]!=='VIRTUAL'){var _0x470d29={};_0x470d29[_0x235d90[_0xbbe7('0x24')]]={'$like':'%'+_0x50410d['query'][_0xbbe7('0x36')]+'%'};return _0x470d29;}})});}_0x18cbec=_[_0xbbe7('0x37')]({},_0x18cbec,_0x50410d['options']);var _0x14370e={'where':_0x18cbec[_0xbbe7('0x34')]};return db[_0xbbe7('0x27')][_0xbbe7('0x1b')](_0x14370e)[_0xbbe7('0x1f')](function(_0x518d10){_0x5a9b4c[_0xbbe7('0x1b')]=_0x518d10;if(_0x50410d[_0xbbe7('0x2c')][_0xbbe7('0x38')]){_0x18cbec['include']=[{'all':!![]}];}return db[_0xbbe7('0x27')][_0xbbe7('0x39')](_0x18cbec);})[_0xbbe7('0x1f')](function(_0xc876b0){_0x5a9b4c[_0xbbe7('0x3a')]=_0xc876b0;return _0x5a9b4c;})['then'](respondWithFilteredResult(_0x12ecf6,_0x18cbec))[_0xbbe7('0x3b')](handleError(_0x12ecf6,null));};exports[_0xbbe7('0x3c')]=function(_0x5bd1ba,_0x1d41b5){var _0x219f63={'raw':!![],'where':{'id':_0x5bd1ba[_0xbbe7('0x3d')]['id']}},_0x237620={};_0x237620[_0xbbe7('0x2b')]=_[_0xbbe7('0x3e')](db['SalesforceField'][_0xbbe7('0x28')]);_0x237620['query']=_[_0xbbe7('0x3e')](_0x5bd1ba[_0xbbe7('0x2c')]);_0x237620[_0xbbe7('0x2d')]=_[_0xbbe7('0x2e')](_0x237620['model'],_0x237620[_0xbbe7('0x2c')]);_0x219f63[_0xbbe7('0x2f')]=_[_0xbbe7('0x2e')](_0x237620[_0xbbe7('0x2b')],qs['fields'](_0x5bd1ba['query'][_0xbbe7('0x30')]));_0x219f63[_0xbbe7('0x2f')]=_0x219f63['attributes'][_0xbbe7('0x3f')]?_0x219f63[_0xbbe7('0x2f')]:_0x237620[_0xbbe7('0x2b')];if(_0x5bd1ba[_0xbbe7('0x2c')]['includeAll']){_0x219f63[_0xbbe7('0x40')]=[{'all':!![]}];}_0x219f63=_['merge']({},_0x219f63,_0x5bd1ba[_0xbbe7('0x41')]);return db[_0xbbe7('0x27')][_0xbbe7('0x42')](_0x219f63)[_0xbbe7('0x1f')](handleEntityNotFound(_0x1d41b5,null))['then'](respondWithResult(_0x1d41b5,null))[_0xbbe7('0x3b')](handleError(_0x1d41b5,null));};exports[_0xbbe7('0x43')]=function(_0x1f3d1f,_0x554a1f){return db[_0xbbe7('0x27')][_0xbbe7('0x43')](_0x1f3d1f[_0xbbe7('0x44')],{})[_0xbbe7('0x1f')](respondWithResult(_0x554a1f,0xc9))[_0xbbe7('0x3b')](handleError(_0x554a1f,null));};exports['update']=function(_0x426660,_0x4c5f35){if(_0x426660[_0xbbe7('0x44')]['id']){delete _0x426660[_0xbbe7('0x44')]['id'];}return db[_0xbbe7('0x27')]['find']({'where':{'id':_0x426660['params']['id']}})[_0xbbe7('0x1f')](handleEntityNotFound(_0x4c5f35,null))[_0xbbe7('0x1f')](saveUpdates(_0x426660['body'],null))[_0xbbe7('0x1f')](respondWithResult(_0x4c5f35,null))[_0xbbe7('0x3b')](handleError(_0x4c5f35,null));};exports[_0xbbe7('0x1e')]=function(_0x527b08,_0x58629f){return db[_0xbbe7('0x27')][_0xbbe7('0x42')]({'where':{'id':_0x527b08['params']['id']}})[_0xbbe7('0x1f')](handleEntityNotFound(_0x58629f,null))[_0xbbe7('0x1f')](removeEntity(_0x58629f,null))[_0xbbe7('0x3b')](handleError(_0x58629f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1055631..2aa5bb7 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 _0xb510=['api','moment','bluebird','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x1564b7,_0x3ace72){var _0x3f552e=function(_0x354a96){while(--_0x354a96){_0x1564b7['push'](_0x1564b7['shift']());}};_0x3f552e(++_0x3ace72);}(_0xb510,0x131));var _0x0b51=function(_0x5bb26d,_0x430ece){_0x5bb26d=_0x5bb26d-0x0;var _0x202c8a=_0xb510[_0x5bb26d];return _0x202c8a;};'use strict';var _=require(_0x0b51('0x0'));var util=require(_0x0b51('0x1'));var logger=require(_0x0b51('0x2'))(_0x0b51('0x3'));var moment=require(_0x0b51('0x4'));var BPromise=require(_0x0b51('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(_0x0b51('0x6'));module[_0x0b51('0x7')]=function(_0x598387,_0x5df8da){return _0x598387[_0x0b51('0x8')](_0x0b51('0x9'),attributes,{'tableName':_0x0b51('0xa'),'paranoid':![],'indexes':[{'name':_0x0b51('0xb'),'fields':[_0x0b51('0xc'),_0x0b51('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5227=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','SalesforceField','int_salesforce_fields','idField'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x5227,0x1a0));var _0x7522=function(_0x2a1dd1,_0x3794df){_0x2a1dd1=_0x2a1dd1-0x0;var _0x132c45=_0x5227[_0x2a1dd1];return _0x132c45;};'use strict';var _=require(_0x7522('0x0'));var util=require(_0x7522('0x1'));var logger=require(_0x7522('0x2'))(_0x7522('0x3'));var moment=require(_0x7522('0x4'));var BPromise=require(_0x7522('0x5'));var rp=require(_0x7522('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7522('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x7522('0x8')]=function(_0x5006df,_0x521986){return _0x5006df[_0x7522('0x9')](_0x7522('0xa'),attributes,{'tableName':_0x7522('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x7522('0xc'),'FieldId'],'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 ce82aae..49b7cc3 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 _0x05f6=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','info'];(function(_0x2287d2,_0x21b0e3){var _0x265ed3=function(_0x4c6d86){while(--_0x4c6d86){_0x2287d2['push'](_0x2287d2['shift']());}};_0x265ed3(++_0x21b0e3);}(_0x05f6,0xd4));var _0x605f=function(_0x5ef001,_0x3cae94){_0x5ef001=_0x5ef001-0x0;var _0x18a3b4=_0x05f6[_0x5ef001];return _0x18a3b4;};'use strict';var _=require('lodash');var util=require(_0x605f('0x0'));var moment=require(_0x605f('0x1'));var BPromise=require(_0x605f('0x2'));var rs=require(_0x605f('0x3'));var fs=require('fs');var Redis=require(_0x605f('0x4'));var db=require(_0x605f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x605f('0x6'))(_0x605f('0x7'));var config=require(_0x605f('0x8'));var jayson=require(_0x605f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53aa4f,_0x4341f0,_0x370e07){return new BPromise(function(_0x5864c5,_0x566820){return client[_0x605f('0xa')](_0x53aa4f,_0x370e07)[_0x605f('0xb')](function(_0x54bed8){logger['info']('SalesforceField,\x20%s,\x20%s',_0x4341f0,_0x605f('0xc'));logger['debug'](_0x605f('0xd'),_0x4341f0,_0x605f('0xc'),JSON[_0x605f('0xe')](_0x54bed8));if(_0x54bed8[_0x605f('0xf')]){if(_0x54bed8[_0x605f('0xf')]['code']===0x1f4){logger[_0x605f('0xf')]('SalesforceField,\x20%s,\x20%s',_0x4341f0,_0x54bed8[_0x605f('0xf')]['message']);return _0x566820(_0x54bed8['error']['message']);}logger['error'](_0x605f('0x10'),_0x4341f0,_0x54bed8['error'][_0x605f('0x11')]);return _0x5864c5(_0x54bed8['error']['message']);}else{logger[_0x605f('0x12')]('SalesforceField,\x20%s,\x20%s',_0x4341f0,_0x605f('0xc'));_0x5864c5(_0x54bed8[_0x605f('0x13')][_0x605f('0x11')]);}})[_0x605f('0x14')](function(_0x566d99){logger[_0x605f('0xf')]('SalesforceField,\x20%s,\x20%s',_0x4341f0,_0x566d99);_0x566820(_0x566d99);});});} \ No newline at end of file +var _0xc0ae=['http','request','info','request\x20sent','debug','stringify','error','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2bd279,_0x1ebbe7){var _0x2dc886=function(_0x3f7943){while(--_0x3f7943){_0x2bd279['push'](_0x2bd279['shift']());}};_0x2dc886(++_0x1ebbe7);}(_0xc0ae,0x10f));var _0xec0a=function(_0x554a7e,_0x36aa3a){_0x554a7e=_0x554a7e-0x0;var _0x192aa6=_0xc0ae[_0x554a7e];return _0x192aa6;};'use strict';var _=require(_0xec0a('0x0'));var util=require(_0xec0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xec0a('0x2'));var fs=require('fs');var Redis=require(_0xec0a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec0a('0x4'))(_0xec0a('0x5'));var config=require(_0xec0a('0x6'));var jayson=require(_0xec0a('0x7'));var client=jayson[_0xec0a('0x8')][_0xec0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe475e6,_0xe15682,_0x706cca){return new BPromise(function(_0x90012b,_0x208a77){return client[_0xec0a('0xa')](_0xe475e6,_0x706cca)['then'](function(_0x3da42e){logger[_0xec0a('0xb')]('SalesforceField,\x20%s,\x20%s',_0xe15682,_0xec0a('0xc'));logger[_0xec0a('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0xe15682,_0xec0a('0xc'),JSON[_0xec0a('0xe')](_0x3da42e));if(_0x3da42e[_0xec0a('0xf')]){if(_0x3da42e[_0xec0a('0xf')]['code']===0x1f4){logger[_0xec0a('0xf')](_0xec0a('0x10'),_0xe15682,_0x3da42e[_0xec0a('0xf')][_0xec0a('0x11')]);return _0x208a77(_0x3da42e[_0xec0a('0xf')][_0xec0a('0x11')]);}logger[_0xec0a('0xf')](_0xec0a('0x10'),_0xe15682,_0x3da42e[_0xec0a('0xf')][_0xec0a('0x11')]);return _0x90012b(_0x3da42e[_0xec0a('0xf')][_0xec0a('0x11')]);}else{logger[_0xec0a('0xb')](_0xec0a('0x10'),_0xe15682,_0xec0a('0xc'));_0x90012b(_0x3da42e[_0xec0a('0x12')][_0xec0a('0x11')]);}})[_0xec0a('0x13')](function(_0x222837){logger[_0xec0a('0xf')]('SalesforceField,\x20%s,\x20%s',_0xe15682,_0x222837);_0x208a77(_0x222837);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3642037..12ac1e2 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 _0xc69e=['./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xc69e,0xfa));var _0xec69=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc69e[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xec69('0x0'));var util=require(_0xec69('0x1'));var path=require(_0xec69('0x2'));var timeout=require(_0xec69('0x3'));var express=require(_0xec69('0x4'));var router=express[_0xec69('0x5')]();var fs_extra=require(_0xec69('0x6'));var auth=require(_0xec69('0x7'));var interaction=require(_0xec69('0x8'));var config=require(_0xec69('0x9'));var controller=require(_0xec69('0xa'));router[_0xec69('0xb')]('/',auth['isAuthenticated'](),controller[_0xec69('0xc')]);router['get'](_0xec69('0xd'),auth[_0xec69('0xe')](),controller[_0xec69('0xf')]);router[_0xec69('0xb')](_0xec69('0x10'),auth[_0xec69('0xe')](),controller[_0xec69('0x11')]);router['get'](_0xec69('0x12'),auth[_0xec69('0xe')](),controller[_0xec69('0x13')]);router[_0xec69('0x14')]('/',auth[_0xec69('0xe')](),controller[_0xec69('0x15')]);router[_0xec69('0x14')](_0xec69('0x10'),auth[_0xec69('0xe')](),controller[_0xec69('0x16')]);router[_0xec69('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xec69('0x18')]);router[_0xec69('0x19')](_0xec69('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdb46=['/:id/fields','getFields','post','create','addConfiguration','/:id','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations'];(function(_0x317706,_0x4de55e){var _0x385117=function(_0x5beb8a){while(--_0x5beb8a){_0x317706['push'](_0x317706['shift']());}};_0x385117(++_0x4de55e);}(_0xdb46,0x158));var _0x6db4=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xdb46[_0x46ae5a];return _0x434986;};'use strict';var multer=require(_0x6db4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6db4('0x1'));var express=require(_0x6db4('0x2'));var router=express[_0x6db4('0x3')]();var fs_extra=require(_0x6db4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6db4('0x5'));var config=require(_0x6db4('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x6db4('0x7')]('/',auth[_0x6db4('0x8')](),controller[_0x6db4('0x9')]);router[_0x6db4('0x7')]('/:id',auth[_0x6db4('0x8')](),controller[_0x6db4('0xa')]);router[_0x6db4('0x7')](_0x6db4('0xb'),auth[_0x6db4('0x8')](),controller[_0x6db4('0xc')]);router[_0x6db4('0x7')](_0x6db4('0xd'),auth[_0x6db4('0x8')](),controller[_0x6db4('0xe')]);router[_0x6db4('0xf')]('/',auth['isAuthenticated'](),controller[_0x6db4('0x10')]);router['post'](_0x6db4('0xb'),auth[_0x6db4('0x8')](),controller[_0x6db4('0x11')]);router['put'](_0x6db4('0x12'),auth[_0x6db4('0x8')](),controller[_0x6db4('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6db4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8305c23..bb0da13 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 _0x380b=['remoteUri','sequelize','exports','STRING','username'];(function(_0x57b3a1,_0x1861aa){var _0x2d0df9=function(_0x5a43d8){while(--_0x5a43d8){_0x57b3a1['push'](_0x57b3a1['shift']());}};_0x2d0df9(++_0x1861aa);}(_0x380b,0x1dc));var _0xb380=function(_0xe8544,_0x5cde80){_0xe8544=_0xe8544-0x0;var _0x4aa279=_0x380b[_0xe8544];return _0x4aa279;};'use strict';var Sequelize=require(_0xb380('0x0'));module[_0xb380('0x1')]={'name':{'type':Sequelize[_0xb380('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb380('0x2')],'unique':_0xb380('0x3')},'password':{'type':Sequelize[_0xb380('0x2')]},'email':{'type':Sequelize[_0xb380('0x2')]},'remoteUri':{'type':Sequelize[_0xb380('0x2')],'unique':_0xb380('0x4')},'serverUrl':{'type':Sequelize[_0xb380('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa34d=['username','remoteUri','STRING'];(function(_0x51e6be,_0x1e98cc){var _0x2e99ed=function(_0x12fa57){while(--_0x12fa57){_0x51e6be['push'](_0x51e6be['shift']());}};_0x2e99ed(++_0x1e98cc);}(_0xa34d,0x1a9));var _0xda34=function(_0x57d96e,_0x1714ec){_0x57d96e=_0x57d96e-0x0;var _0x3d70cd=_0xa34d[_0x57d96e];return _0x3d70cd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xda34('0x0')]},'description':{'type':Sequelize[_0xda34('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0xda34('0x1')},'password':{'type':Sequelize[_0xda34('0x0')]},'email':{'type':Sequelize[_0xda34('0x0')]},'remoteUri':{'type':Sequelize[_0xda34('0x0')],'unique':_0xda34('0x2')},'serverUrl':{'type':Sequelize[_0xda34('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 5fb1f5f..4e5f5ab 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 _0x9b99=['false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','ServicenowAccount','count','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','getConfigurations','length','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','knowledge','subcategory','close_code','notify','incident_state','category','parent','made_sla','caused_by','upon_reject','sys_updated_on','child_incidents','hold_reason','number','resolved_by','user_input','sys_domain','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','sys_class_name','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','company','activity_due','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','email','remoteUri','substring','format','%s/api/now/table/','password','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','push','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False'];(function(_0x54551e,_0x429370){var _0x1d6913=function(_0x3c658d){while(--_0x3c658d){_0x54551e['push'](_0x54551e['shift']());}};_0x1d6913(++_0x429370);}(_0x9b99,0x15e));var _0x99b9=function(_0x468c1b,_0x3bc425){_0x468c1b=_0x468c1b-0x0;var _0x2cd0f9=_0x9b99[_0x468c1b];return _0x2cd0f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99b9('0x0'));var zipdir=require(_0x99b9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99b9('0x2'));var moment=require(_0x99b9('0x3'));var BPromise=require(_0x99b9('0x4'));var Mustache=require(_0x99b9('0x5'));var util=require('util');var path=require(_0x99b9('0x6'));var sox=require('sox');var csv=require(_0x99b9('0x7'));var ejs=require(_0x99b9('0x8'));var fs=require('fs');var fs_extra=require(_0x99b9('0x9'));var _=require(_0x99b9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x99b9('0xb'));var deskjs=require(_0x99b9('0xc'));var toCsv=require(_0x99b9('0x7'));var querystring=require('querystring');var Papa=require(_0x99b9('0xd'));var Redis=require(_0x99b9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x99b9('0xf'));var as=require(_0x99b9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x99b9('0x11'));var config=require(_0x99b9('0x12'));var licenseUtil=require(_0x99b9('0x13'));var db=require(_0x99b9('0x14'))['db'];var integrations=require(_0x99b9('0x15'));function respondWithStatusCode(_0x291b28,_0x4cbef3){_0x4cbef3=_0x4cbef3||0xcc;return function(_0x3e76d6){if(_0x3e76d6){return _0x291b28[_0x99b9('0x16')](_0x4cbef3);}return _0x291b28[_0x99b9('0x17')](_0x4cbef3)[_0x99b9('0x18')]();};}function respondWithResult(_0x2172d0,_0x45af43){_0x45af43=_0x45af43||0xc8;return function(_0x11bd4d){if(_0x11bd4d){return _0x2172d0['status'](_0x45af43)['json'](_0x11bd4d);}};}function respondWithFilteredResult(_0x20f068,_0x473964){return function(_0x411c47){if(_0x411c47){var _0x1107c1=typeof _0x473964[_0x99b9('0x19')]===_0x99b9('0x1a')&&typeof _0x473964[_0x99b9('0x1b')]===_0x99b9('0x1a');var _0x499759=_0x411c47['count'];var _0x527d35=_0x1107c1?0x0:_0x473964[_0x99b9('0x19')];var _0x1e80ad=_0x1107c1?_0x411c47['count']:_0x473964[_0x99b9('0x19')]+_0x473964[_0x99b9('0x1b')];var _0xbe5180;if(_0x1e80ad>=_0x499759){_0x1e80ad=_0x499759;_0xbe5180=0xc8;}else{_0xbe5180=0xce;}_0x20f068[_0x99b9('0x17')](_0xbe5180);return _0x20f068[_0x99b9('0x1c')]('Content-Range',_0x527d35+'-'+_0x1e80ad+'/'+_0x499759)[_0x99b9('0x1d')](_0x411c47);}return null;};}function patchUpdates(_0x560714){return function(_0x224390){try{jsonpatch[_0x99b9('0x1e')](_0x224390,_0x560714,!![]);}catch(_0x5e23e9){return BPromise[_0x99b9('0x1f')](_0x5e23e9);}return _0x224390[_0x99b9('0x20')]();};}function saveUpdates(_0x30c8f7,_0x265a55){return function(_0x2b2398){if(_0x2b2398){return _0x2b2398['update'](_0x30c8f7)[_0x99b9('0x21')](function(_0x3474d5){return _0x3474d5;});}return null;};}function removeEntity(_0x31e57d,_0x3189ac){return function(_0x108ebe){if(_0x108ebe){return _0x108ebe[_0x99b9('0x22')]()[_0x99b9('0x21')](function(){_0x31e57d[_0x99b9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a6b9b,_0x228834){return function(_0x2668f1){if(!_0x2668f1){_0x2a6b9b['sendStatus'](0x194);}return _0x2668f1;};}function handleError(_0x1e3076,_0x145fd4){_0x145fd4=_0x145fd4||0x1f4;return function(_0x186b6a){logger[_0x99b9('0x23')](_0x186b6a[_0x99b9('0x24')]);if(_0x186b6a['name']){delete _0x186b6a[_0x99b9('0x25')];}_0x1e3076['status'](_0x145fd4)[_0x99b9('0x26')](_0x186b6a);};}exports['index']=function(_0xe3482,_0x3fa10e){var _0x592906={},_0x3fefd1={},_0x584168={'count':0x0,'rows':[]};var _0x7f53a1=_[_0x99b9('0x27')](db['ServicenowAccount'][_0x99b9('0x28')],function(_0x2991c1){return{'name':_0x2991c1[_0x99b9('0x29')],'type':_0x2991c1[_0x99b9('0x2a')][_0x99b9('0x2b')]};});_0x3fefd1[_0x99b9('0x2c')]=_['map'](_0x7f53a1,_0x99b9('0x25'));_0x3fefd1[_0x99b9('0x2d')]=_[_0x99b9('0x2e')](_0xe3482['query']);_0x3fefd1[_0x99b9('0x2f')]=_[_0x99b9('0x30')](_0x3fefd1[_0x99b9('0x2c')],_0x3fefd1[_0x99b9('0x2d')]);_0x592906['attributes']=_[_0x99b9('0x30')](_0x3fefd1[_0x99b9('0x2c')],qs[_0x99b9('0x31')](_0xe3482[_0x99b9('0x2d')][_0x99b9('0x31')]));_0x592906[_0x99b9('0x32')]=_0x592906[_0x99b9('0x32')]['length']?_0x592906[_0x99b9('0x32')]:_0x3fefd1['model'];if(!_0xe3482['query'][_0x99b9('0x33')](_0x99b9('0x34'))){_0x592906[_0x99b9('0x1b')]=qs[_0x99b9('0x1b')](_0xe3482[_0x99b9('0x2d')]['limit']);_0x592906[_0x99b9('0x19')]=qs['offset'](_0xe3482[_0x99b9('0x2d')][_0x99b9('0x19')]);}_0x592906[_0x99b9('0x35')]=qs[_0x99b9('0x36')](_0xe3482[_0x99b9('0x2d')]['sort']);_0x592906[_0x99b9('0x37')]=qs['filters'](_['pick'](_0xe3482[_0x99b9('0x2d')],_0x3fefd1[_0x99b9('0x2f')]),_0x7f53a1);if(_0xe3482[_0x99b9('0x2d')]['filter']){_0x592906[_0x99b9('0x37')]=_[_0x99b9('0x38')](_0x592906[_0x99b9('0x37')],{'$or':_[_0x99b9('0x27')](_0x7f53a1,function(_0x262999){if(_0x262999['type']!==_0x99b9('0x39')){var _0x38ebd0={};_0x38ebd0[_0x262999[_0x99b9('0x25')]]={'$like':'%'+_0xe3482[_0x99b9('0x2d')][_0x99b9('0x3a')]+'%'};return _0x38ebd0;}})});}_0x592906=_[_0x99b9('0x38')]({},_0x592906,_0xe3482['options']);var _0xfaf183={'where':_0x592906[_0x99b9('0x37')]};return db[_0x99b9('0x3b')][_0x99b9('0x3c')](_0xfaf183)[_0x99b9('0x21')](function(_0x57912f){_0x584168[_0x99b9('0x3c')]=_0x57912f;if(_0xe3482['query']['includeAll']){_0x592906['include']=[{'all':!![]}];}return db[_0x99b9('0x3b')][_0x99b9('0x3d')](_0x592906);})[_0x99b9('0x21')](function(_0x489b64){_0x584168[_0x99b9('0x3e')]=_0x489b64;return _0x584168;})['then'](respondWithFilteredResult(_0x3fa10e,_0x592906))[_0x99b9('0x3f')](handleError(_0x3fa10e,null));};exports[_0x99b9('0x40')]=function(_0x44ff46,_0x3a5632){var _0x35911f={'raw':![],'where':{'id':_0x44ff46[_0x99b9('0x41')]['id']}},_0x40b079={};_0x40b079[_0x99b9('0x2c')]=_[_0x99b9('0x2e')](db[_0x99b9('0x3b')][_0x99b9('0x28')]);_0x40b079[_0x99b9('0x2d')]=_[_0x99b9('0x2e')](_0x44ff46['query']);_0x40b079[_0x99b9('0x2f')]=_[_0x99b9('0x30')](_0x40b079[_0x99b9('0x2c')],_0x40b079[_0x99b9('0x2d')]);_0x35911f[_0x99b9('0x32')]=_[_0x99b9('0x30')](_0x40b079[_0x99b9('0x2c')],qs[_0x99b9('0x31')](_0x44ff46[_0x99b9('0x2d')][_0x99b9('0x31')]));_0x35911f[_0x99b9('0x32')]=_0x35911f[_0x99b9('0x32')]['length']?_0x35911f[_0x99b9('0x32')]:_0x40b079[_0x99b9('0x2c')];if(_0x44ff46['query'][_0x99b9('0x42')]){_0x35911f['include']=[{'all':!![]}];}_0x35911f=_['merge']({},_0x35911f,_0x44ff46[_0x99b9('0x43')]);return db[_0x99b9('0x3b')][_0x99b9('0x44')](_0x35911f)[_0x99b9('0x21')](handleEntityNotFound(_0x3a5632,null))[_0x99b9('0x21')](respondWithResult(_0x3a5632,null))[_0x99b9('0x3f')](handleError(_0x3a5632,null));};exports[_0x99b9('0x45')]=function(_0x1f92dd,_0x4b3c77){return db[_0x99b9('0x3b')]['create'](_0x1f92dd[_0x99b9('0x46')],{})['then'](respondWithResult(_0x4b3c77,0xc9))[_0x99b9('0x3f')](handleError(_0x4b3c77,null));};exports[_0x99b9('0x47')]=function(_0x2daf5f,_0x26e88d){if(_0x2daf5f['body']['id']){delete _0x2daf5f['body']['id'];}return db[_0x99b9('0x3b')][_0x99b9('0x44')]({'where':{'id':_0x2daf5f[_0x99b9('0x41')]['id']}})[_0x99b9('0x21')](handleEntityNotFound(_0x26e88d,null))[_0x99b9('0x21')](saveUpdates(_0x2daf5f[_0x99b9('0x46')],null))['then'](respondWithResult(_0x26e88d,null))[_0x99b9('0x3f')](handleError(_0x26e88d,null));};exports[_0x99b9('0x22')]=function(_0x1ed855,_0x3d1b89){return db[_0x99b9('0x3b')][_0x99b9('0x44')]({'where':{'id':_0x1ed855[_0x99b9('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d1b89,null))[_0x99b9('0x21')](removeEntity(_0x3d1b89,null))[_0x99b9('0x3f')](handleError(_0x3d1b89,null));};exports[_0x99b9('0x48')]=function(_0x144d56,_0x5db915,_0x482aa6){var _0x492e8e={};var _0x46e470={};var _0x3d35a9;var _0x3ef76a;return db[_0x99b9('0x3b')]['findOne']({'where':{'id':_0x144d56['params']['id']}})[_0x99b9('0x21')](handleEntityNotFound(_0x5db915,null))[_0x99b9('0x21')](function(_0x157f12){if(_0x157f12){_0x3d35a9=_0x157f12;_0x46e470[_0x99b9('0x2c')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x46e470['query']=_[_0x99b9('0x2e')](_0x144d56[_0x99b9('0x2d')]);_0x46e470[_0x99b9('0x2f')]=_[_0x99b9('0x30')](_0x46e470[_0x99b9('0x2c')],_0x46e470['query']);_0x492e8e[_0x99b9('0x32')]=_[_0x99b9('0x30')](_0x46e470[_0x99b9('0x2c')],qs[_0x99b9('0x31')](_0x144d56[_0x99b9('0x2d')][_0x99b9('0x31')]));_0x492e8e['attributes']=_0x492e8e['attributes'][_0x99b9('0x49')]?_0x492e8e[_0x99b9('0x32')]:_0x46e470['model'];_0x492e8e[_0x99b9('0x35')]=qs[_0x99b9('0x36')](_0x144d56[_0x99b9('0x2d')]['sort']);_0x492e8e[_0x99b9('0x37')]=qs[_0x99b9('0x2f')](_['pick'](_0x144d56['query'],_0x46e470[_0x99b9('0x2f')]));if(_0x144d56[_0x99b9('0x2d')]['filter']){_0x492e8e[_0x99b9('0x37')]=_[_0x99b9('0x38')](_0x492e8e[_0x99b9('0x37')],{'$or':_[_0x99b9('0x27')](_0x492e8e[_0x99b9('0x32')],function(_0x33e6c6){var _0x36bf06={};_0x36bf06[_0x33e6c6]={'$like':'%'+_0x144d56[_0x99b9('0x2d')]['filter']+'%'};return _0x36bf06;})});}_0x492e8e=_['merge']({},_0x492e8e,_0x144d56[_0x99b9('0x43')]);return _0x3d35a9[_0x99b9('0x48')](_0x492e8e);}})[_0x99b9('0x21')](function(_0x557dc2){if(_0x557dc2){_0x3ef76a=_0x557dc2[_0x99b9('0x49')];if(!_0x144d56[_0x99b9('0x2d')][_0x99b9('0x33')](_0x99b9('0x34'))){_0x492e8e[_0x99b9('0x1b')]=qs[_0x99b9('0x1b')](_0x144d56['query'][_0x99b9('0x1b')]);_0x492e8e[_0x99b9('0x19')]=qs[_0x99b9('0x19')](_0x144d56[_0x99b9('0x2d')][_0x99b9('0x19')]);}return _0x3d35a9[_0x99b9('0x48')](_0x492e8e);}})[_0x99b9('0x21')](function(_0x36f88c){if(_0x36f88c){return _0x36f88c?{'count':_0x3ef76a,'rows':_0x36f88c}:null;}})['then'](respondWithResult(_0x5db915,null))[_0x99b9('0x3f')](handleError(_0x5db915,null));};exports[_0x99b9('0x4a')]=function(_0x43e6db,_0xd492de,_0x1862c1){if(_0x43e6db[_0x99b9('0x46')]['id']){delete _0x43e6db[_0x99b9('0x46')]['id'];}return db[_0x99b9('0x3b')][_0x99b9('0x4b')]({'where':{'id':_0x43e6db[_0x99b9('0x41')]['id']}})[_0x99b9('0x21')](handleEntityNotFound(_0xd492de,null))['then'](function(_0x7a925d){if(_0x7a925d){_0x43e6db[_0x99b9('0x46')]['AccountId']=_0x7a925d['id'];_0x43e6db['body'][_0x99b9('0x4c')]=integrations[_0x99b9('0x4d')](_0x43e6db[_0x99b9('0x46')]['channel'],_0x43e6db['body'][_0x99b9('0x2a')]);_0x43e6db[_0x99b9('0x46')][_0x99b9('0x4e')]=integrations[_0x99b9('0x4f')](_0x43e6db[_0x99b9('0x46')][_0x99b9('0x50')],_0x43e6db[_0x99b9('0x46')][_0x99b9('0x2a')]);return db['ServicenowConfiguration'][_0x99b9('0x45')](_0x43e6db['body'],{'include':[{'model':db['ServicenowField'],'as':_0x99b9('0x4c')},{'model':db[_0x99b9('0x51')],'as':_0x99b9('0x4e')}]});}return null;})['then'](respondWithResult(_0xd492de,null))['catch'](handleError(_0xd492de,null));};exports[_0x99b9('0x52')]=function(_0x1c562c,_0x1caf30,_0x2ad132){var _0x521720=['made_sla','hold_reason',_0x99b9('0x53'),_0x99b9('0x54'),_0x99b9('0x55'),_0x99b9('0x56'),_0x99b9('0x57'),'severity',_0x99b9('0x58')];var _0x190bc0=[_0x99b9('0x59'),_0x99b9('0x5a'),_0x99b9('0x5b'),'watch_list',_0x99b9('0x5c'),_0x99b9('0x5d'),_0x99b9('0x5e'),_0x99b9('0x5f'),'approval_history',_0x99b9('0x60'),_0x99b9('0x61'),'sys_updated_by','opened_by',_0x99b9('0x62'),'sys_created_on',_0x99b9('0x63'),'state','sys_created_by',_0x99b9('0x53'),_0x99b9('0x35'),_0x99b9('0x64'),_0x99b9('0x65'),'cmdb_ci',_0x99b9('0x66'),_0x99b9('0x67'),_0x99b9('0x68'),_0x99b9('0x69'),'business_service',_0x99b9('0x6a'),_0x99b9('0x6b'),_0x99b9('0x6c'),'time_worked','expected_start',_0x99b9('0x6d'),_0x99b9('0x6e'),_0x99b9('0x6f'),_0x99b9('0x70'),'reopened_time',_0x99b9('0x71'),_0x99b9('0x72'),_0x99b9('0x73'),_0x99b9('0x54'),_0x99b9('0x74'),_0x99b9('0x75'),'close_code',_0x99b9('0x76'),_0x99b9('0x77'),_0x99b9('0x78'),_0x99b9('0x79'),_0x99b9('0x7a'),'additional_assignee_list','description','calendar_duration',_0x99b9('0x56'),_0x99b9('0x7b'),'close_notes',_0x99b9('0x7c'),_0x99b9('0x7d'),_0x99b9('0x7e'),_0x99b9('0x7f'),'contact_type',_0x99b9('0x80'),_0x99b9('0x57'),_0x99b9('0x81'),'problem_id',_0x99b9('0x82'),'reassignment_count',_0x99b9('0x83'),_0x99b9('0x84'),'severity',_0x99b9('0x85'),'sla_due','approval',_0x99b9('0x86'),_0x99b9('0x87'),_0x99b9('0x88'),_0x99b9('0x89'),_0x99b9('0x8a'),_0x99b9('0x8b'),_0x99b9('0x8c'),_0x99b9('0x8d'),'location',_0x99b9('0x58')];var _0x86effa='';var _0x38fcd0='';var _0x1fb224=[];var _0x18972e='';var _0x326c58='';var _0x2a1c35=[];var _0x3dd515='';var _0x4bd539='';var _0x4552e2={};var _0x4daa0e='';return db[_0x99b9('0x3b')][_0x99b9('0x4b')]({'where':{'id':_0x1c562c[_0x99b9('0x41')]['id']},'attributes':['id',_0x99b9('0x8e'),'password',_0x99b9('0x8f'),_0x99b9('0x90'),'serverUrl']})[_0x99b9('0x21')](handleEntityNotFound(_0x1caf30,null))['then'](function(_0x460862){if(_0x460862){_0x4daa0e=_0x460862[_0x99b9('0x90')];var _0x5569a7=_0x4daa0e['slice'](-0x1);if(_0x5569a7==='/'){_0x4daa0e=_0x4daa0e[_0x99b9('0x91')](0x0,_0x4daa0e['lastIndexOf'](_0x5569a7));}_0x4bd539=util['format']('%s/api/now/doc/table/schema/',_0x4daa0e);_0x3dd515=util[_0x99b9('0x92')](_0x99b9('0x93'),_0x4daa0e);_0x4552e2={'user':_0x460862[_0x99b9('0x8e')],'pass':_0x460862[_0x99b9('0x94')]};var _0x279d55={'method':'GET','uri':_0x4bd539+_0x99b9('0x95'),'auth':_0x4552e2,'json':!![]};return rp(_0x279d55);}})[_0x99b9('0x21')](function(_0x462501){if(_0x462501[_0x99b9('0x96')][_0x99b9('0x49')]>0x0){_0x86effa=_0x462501['result'];}console[_0x99b9('0x97')](_0x99b9('0x98'),_0x86effa);_0x2a1c35=[];_0x38fcd0=Object[_0x99b9('0x99')]([],_0x86effa);_[_0x99b9('0x9a')](_0x38fcd0,function(_0xcadae){return!_0x521720[_0x99b9('0x9b')](_0xcadae['name']);});_0x38fcd0[_0x99b9('0x9c')](function(_0x3e2a62){var _0x406b03=createFieldObject(_0x3dd515,_0x4552e2,_0x3e2a62[_0x99b9('0x9d')],_0x3e2a62[_0x99b9('0x25')],_0x3e2a62[_0x99b9('0x9e')],![]);_0x2a1c35['push'](_0x406b03);});return Promise[_0x99b9('0x9f')](_0x2a1c35);})['then'](function(_0x3207e2){_0x1fb224=_0x3207e2;_0x18972e=Object[_0x99b9('0x99')]([],_0x86effa);console[_0x99b9('0x97')](_0x99b9('0xa0'),_0x86effa);_[_0x99b9('0x9a')](_0x18972e,function(_0x527f67){return _0x190bc0[_0x99b9('0x9b')](_0x527f67[_0x99b9('0x25')]);});console[_0x99b9('0x97')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x18972e);_0x2a1c35=[];_0x18972e[_0x99b9('0x9c')](function(_0xea8e9b){var _0x16d53d=createFieldObject(_0x3dd515,_0x4552e2,_0xea8e9b[_0x99b9('0x9d')],_0xea8e9b[_0x99b9('0x25')],_0xea8e9b[_0x99b9('0x9e')],!![]);_0x2a1c35[_0x99b9('0xa1')](_0x16d53d);});return Promise[_0x99b9('0x9f')](_0x2a1c35);})[_0x99b9('0x21')](function(_0x5e2269){_0x326c58=_0x5e2269;var _0x1b67cd=_0x1fb224['concat'](_0x326c58);return{'count':_0x1b67cd[_0x99b9('0x49')],'rows':_0x1b67cd};})['then'](respondWithResult(_0x1caf30,null))[_0x99b9('0x3f')](function(_0x247a68){console[_0x99b9('0x97')](_0x99b9('0xa2')+_0x247a68);var _0x408f4b=_0x1c562c['query'][_0x99b9('0xa3')]?0x1f4:_0x247a68['statusCode']||0x1f4;logger[_0x99b9('0x23')](_0x247a68['stack']);delete _0x247a68[_0x99b9('0x25')];if(_0x408f4b===0x191){_0x408f4b=0x190;}_0x1caf30[_0x99b9('0x17')](_0x408f4b)[_0x99b9('0x26')](_0x1c562c[_0x99b9('0x2d')][_0x99b9('0xa3')]?{'message':'Wrong\x20credentials','statusCode':_0x247a68[_0x99b9('0xa4')]}:_0x247a68);});};function createFieldObject(_0x5650e3,_0x25cfe3,_0x4206ca,_0x5c1690,_0x29e9e2,_0x5bbdd3){return new Promise(function(_0x42b032,_0x579191){var _0x52d447={'id':_0x5c1690,'name':_0x29e9e2,'custom':_0x5bbdd3};if(_0x4206ca===_0x99b9('0xa5')){_0x52d447[_0x99b9('0x43')]=[{'name':_0x99b9('0xa6'),'value':_0x99b9('0xa7')},{'name':_0x99b9('0xa8'),'value':_0x99b9('0xa9')}];_0x42b032(_0x52d447);}else{var _0x5bdd01={'method':_0x99b9('0xaa'),'uri':_0x5650e3+_0x99b9('0xab')+_0x5c1690,'auth':_0x25cfe3,'json':!![]};return rp(_0x5bdd01)['then'](function(_0x4e2652){var _0x5b029d=[];if(_0x4e2652[_0x99b9('0x96')][_0x99b9('0x49')]>0x0){_0x4e2652[_0x99b9('0x96')][_0x99b9('0x9c')](function(_0x2df8c9){if(_0x2df8c9[_0x99b9('0xac')]==='false'){var _0x88c4c4={'name':_0x2df8c9[_0x99b9('0x9e')],'value':_0x2df8c9['value']};_0x5b029d[_0x99b9('0xa1')](_0x88c4c4);}});}_0x52d447[_0x99b9('0x43')]=_0x5b029d;if(_0x52d447[_0x99b9('0x43')]['length']>0x0){_0x42b032(_0x52d447);}else{if(_0x5bbdd3==![]){_0x42b032();}else{_0x42b032(_0x52d447);}}});}});} \ No newline at end of file +var _0x767b=['includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','error','Wrong\x20credentials','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','rows','show','params','include','options','find','create','body','catch','update','getConfigurations','findOne','ServicenowConfiguration','order','pick','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','ServicenowField','Subjects','made_sla','hold_reason','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','expected_start','opened_at','work_end','reopened_time','resolved_at','caller_id','subcategory','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','sys_tags','correlation_id','email','remoteUri','serverUrl','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove'];(function(_0x296036,_0x27f4bb){var _0x260dd9=function(_0x2cd46a){while(--_0x2cd46a){_0x296036['push'](_0x296036['shift']());}};_0x260dd9(++_0x27f4bb);}(_0x767b,0xcc));var _0xb767=function(_0x126bd2,_0x2bab5b){_0x126bd2=_0x126bd2-0x0;var _0x3b806b=_0x767b[_0x126bd2];return _0x3b806b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb767('0x0'));var jsonpatch=require(_0xb767('0x1'));var rp=require('request-promise');var moment=require(_0xb767('0x2'));var BPromise=require(_0xb767('0x3'));var Mustache=require('mustache');var util=require(_0xb767('0x4'));var path=require(_0xb767('0x5'));var sox=require(_0xb767('0x6'));var csv=require(_0xb767('0x7'));var ejs=require(_0xb767('0x8'));var fs=require('fs');var fs_extra=require(_0xb767('0x9'));var _=require(_0xb767('0xa'));var squel=require(_0xb767('0xb'));var crypto=require(_0xb767('0xc'));var jsforce=require(_0xb767('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb767('0x7'));var querystring=require(_0xb767('0xe'));var Papa=require(_0xb767('0xf'));var Redis=require(_0xb767('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb767('0x11'));var logger=require('../../config/logger')(_0xb767('0x12'));var utils=require(_0xb767('0x13'));var config=require(_0xb767('0x14'));var licenseUtil=require(_0xb767('0x15'));var db=require(_0xb767('0x16'))['db'];var integrations=require(_0xb767('0x17'));function respondWithStatusCode(_0x1fc36c,_0x92a829){_0x92a829=_0x92a829||0xcc;return function(_0x43b5ee){if(_0x43b5ee){return _0x1fc36c[_0xb767('0x18')](_0x92a829);}return _0x1fc36c[_0xb767('0x19')](_0x92a829)[_0xb767('0x1a')]();};}function respondWithResult(_0x33f879,_0x4fb173){_0x4fb173=_0x4fb173||0xc8;return function(_0x1fa587){if(_0x1fa587){return _0x33f879[_0xb767('0x19')](_0x4fb173)[_0xb767('0x1b')](_0x1fa587);}};}function respondWithFilteredResult(_0x5d04c3,_0x5d7714){return function(_0x4ed20d){if(_0x4ed20d){var _0x196699=typeof _0x5d7714[_0xb767('0x1c')]===_0xb767('0x1d')&&typeof _0x5d7714[_0xb767('0x1e')]===_0xb767('0x1d');var _0xcaecff=_0x4ed20d['count'];var _0x3dd877=_0x196699?0x0:_0x5d7714[_0xb767('0x1c')];var _0x1f940a=_0x196699?_0x4ed20d[_0xb767('0x1f')]:_0x5d7714[_0xb767('0x1c')]+_0x5d7714[_0xb767('0x1e')];var _0x5bb14e;if(_0x1f940a>=_0xcaecff){_0x1f940a=_0xcaecff;_0x5bb14e=0xc8;}else{_0x5bb14e=0xce;}_0x5d04c3[_0xb767('0x19')](_0x5bb14e);return _0x5d04c3[_0xb767('0x20')](_0xb767('0x21'),_0x3dd877+'-'+_0x1f940a+'/'+_0xcaecff)[_0xb767('0x1b')](_0x4ed20d);}return null;};}function patchUpdates(_0x6aaec3){return function(_0x26854c){try{jsonpatch['apply'](_0x26854c,_0x6aaec3,!![]);}catch(_0x465f01){return BPromise[_0xb767('0x22')](_0x465f01);}return _0x26854c[_0xb767('0x23')]();};}function saveUpdates(_0x38ed74,_0x37bbb8){return function(_0x2686dc){if(_0x2686dc){return _0x2686dc['update'](_0x38ed74)[_0xb767('0x24')](function(_0x14f029){return _0x14f029;});}return null;};}function removeEntity(_0x5e2cde,_0x31b267){return function(_0x2bc330){if(_0x2bc330){return _0x2bc330[_0xb767('0x25')]()[_0xb767('0x24')](function(){_0x5e2cde[_0xb767('0x19')](0xcc)[_0xb767('0x1a')]();});}};}function handleEntityNotFound(_0x270865,_0x5761f7){return function(_0x4d93b7){if(!_0x4d93b7){_0x270865[_0xb767('0x18')](0x194);}return _0x4d93b7;};}function handleError(_0x18ead3,_0x575b27){_0x575b27=_0x575b27||0x1f4;return function(_0x210d48){logger['error'](_0x210d48[_0xb767('0x26')]);if(_0x210d48['name']){delete _0x210d48[_0xb767('0x27')];}_0x18ead3[_0xb767('0x19')](_0x575b27)[_0xb767('0x28')](_0x210d48);};}exports[_0xb767('0x29')]=function(_0xcc1880,_0x1ffe6c){var _0x3abb90={},_0x2c8e15={},_0x63b75d={'count':0x0,'rows':[]};var _0x41f229=_[_0xb767('0x2a')](db[_0xb767('0x2b')][_0xb767('0x2c')],function(_0x4d6792){return{'name':_0x4d6792[_0xb767('0x2d')],'type':_0x4d6792[_0xb767('0x2e')]['key']};});_0x2c8e15['model']=_[_0xb767('0x2a')](_0x41f229,'name');_0x2c8e15[_0xb767('0x2f')]=_[_0xb767('0x30')](_0xcc1880['query']);_0x2c8e15[_0xb767('0x31')]=_[_0xb767('0x32')](_0x2c8e15['model'],_0x2c8e15['query']);_0x3abb90['attributes']=_[_0xb767('0x32')](_0x2c8e15[_0xb767('0x33')],qs[_0xb767('0x34')](_0xcc1880[_0xb767('0x2f')]['fields']));_0x3abb90['attributes']=_0x3abb90[_0xb767('0x35')][_0xb767('0x36')]?_0x3abb90['attributes']:_0x2c8e15[_0xb767('0x33')];if(!_0xcc1880['query'][_0xb767('0x37')](_0xb767('0x38'))){_0x3abb90[_0xb767('0x1e')]=qs[_0xb767('0x1e')](_0xcc1880[_0xb767('0x2f')]['limit']);_0x3abb90[_0xb767('0x1c')]=qs['offset'](_0xcc1880['query'][_0xb767('0x1c')]);}_0x3abb90['order']=qs['sort'](_0xcc1880[_0xb767('0x2f')][_0xb767('0x39')]);_0x3abb90[_0xb767('0x3a')]=qs[_0xb767('0x31')](_['pick'](_0xcc1880[_0xb767('0x2f')],_0x2c8e15[_0xb767('0x31')]),_0x41f229);if(_0xcc1880['query'][_0xb767('0x3b')]){_0x3abb90['where']=_['merge'](_0x3abb90[_0xb767('0x3a')],{'$or':_[_0xb767('0x2a')](_0x41f229,function(_0x4a5b4f){if(_0x4a5b4f['type']!==_0xb767('0x3c')){var _0x2028b6={};_0x2028b6[_0x4a5b4f[_0xb767('0x27')]]={'$like':'%'+_0xcc1880[_0xb767('0x2f')][_0xb767('0x3b')]+'%'};return _0x2028b6;}})});}_0x3abb90=_[_0xb767('0x3d')]({},_0x3abb90,_0xcc1880['options']);var _0x19ca92={'where':_0x3abb90['where']};return db[_0xb767('0x2b')][_0xb767('0x1f')](_0x19ca92)['then'](function(_0x52f47d){_0x63b75d[_0xb767('0x1f')]=_0x52f47d;if(_0xcc1880[_0xb767('0x2f')][_0xb767('0x3e')]){_0x3abb90['include']=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x3abb90);})['then'](function(_0x4583b1){_0x63b75d[_0xb767('0x3f')]=_0x4583b1;return _0x63b75d;})[_0xb767('0x24')](respondWithFilteredResult(_0x1ffe6c,_0x3abb90))['catch'](handleError(_0x1ffe6c,null));};exports[_0xb767('0x40')]=function(_0x469d60,_0x25e7c4){var _0x41db12={'raw':![],'where':{'id':_0x469d60[_0xb767('0x41')]['id']}},_0x5ce556={};_0x5ce556[_0xb767('0x33')]=_[_0xb767('0x30')](db[_0xb767('0x2b')][_0xb767('0x2c')]);_0x5ce556['query']=_[_0xb767('0x30')](_0x469d60[_0xb767('0x2f')]);_0x5ce556[_0xb767('0x31')]=_['intersection'](_0x5ce556['model'],_0x5ce556['query']);_0x41db12[_0xb767('0x35')]=_[_0xb767('0x32')](_0x5ce556['model'],qs[_0xb767('0x34')](_0x469d60['query'][_0xb767('0x34')]));_0x41db12['attributes']=_0x41db12[_0xb767('0x35')][_0xb767('0x36')]?_0x41db12['attributes']:_0x5ce556['model'];if(_0x469d60[_0xb767('0x2f')]['includeAll']){_0x41db12[_0xb767('0x42')]=[{'all':!![]}];}_0x41db12=_[_0xb767('0x3d')]({},_0x41db12,_0x469d60[_0xb767('0x43')]);return db[_0xb767('0x2b')][_0xb767('0x44')](_0x41db12)['then'](handleEntityNotFound(_0x25e7c4,null))['then'](respondWithResult(_0x25e7c4,null))['catch'](handleError(_0x25e7c4,null));};exports[_0xb767('0x45')]=function(_0x5a4991,_0x438897){return db[_0xb767('0x2b')][_0xb767('0x45')](_0x5a4991[_0xb767('0x46')],{})['then'](respondWithResult(_0x438897,0xc9))[_0xb767('0x47')](handleError(_0x438897,null));};exports[_0xb767('0x48')]=function(_0x2390d0,_0x44d223){if(_0x2390d0[_0xb767('0x46')]['id']){delete _0x2390d0[_0xb767('0x46')]['id'];}return db[_0xb767('0x2b')][_0xb767('0x44')]({'where':{'id':_0x2390d0['params']['id']}})['then'](handleEntityNotFound(_0x44d223,null))['then'](saveUpdates(_0x2390d0['body'],null))['then'](respondWithResult(_0x44d223,null))[_0xb767('0x47')](handleError(_0x44d223,null));};exports[_0xb767('0x25')]=function(_0xfe9bbd,_0x4ea7d8){return db['ServicenowAccount'][_0xb767('0x44')]({'where':{'id':_0xfe9bbd[_0xb767('0x41')]['id']}})[_0xb767('0x24')](handleEntityNotFound(_0x4ea7d8,null))[_0xb767('0x24')](removeEntity(_0x4ea7d8,null))['catch'](handleError(_0x4ea7d8,null));};exports[_0xb767('0x49')]=function(_0xf11c18,_0x5d169d,_0x31a399){var _0x434bb7={};var _0x38d345={};var _0x31a61d;var _0x4c36ad;return db['ServicenowAccount'][_0xb767('0x4a')]({'where':{'id':_0xf11c18[_0xb767('0x41')]['id']}})[_0xb767('0x24')](handleEntityNotFound(_0x5d169d,null))[_0xb767('0x24')](function(_0x279ab2){if(_0x279ab2){_0x31a61d=_0x279ab2;_0x38d345['model']=_[_0xb767('0x30')](db[_0xb767('0x4b')][_0xb767('0x2c')]);_0x38d345[_0xb767('0x2f')]=_[_0xb767('0x30')](_0xf11c18['query']);_0x38d345[_0xb767('0x31')]=_[_0xb767('0x32')](_0x38d345[_0xb767('0x33')],_0x38d345[_0xb767('0x2f')]);_0x434bb7['attributes']=_[_0xb767('0x32')](_0x38d345['model'],qs[_0xb767('0x34')](_0xf11c18[_0xb767('0x2f')][_0xb767('0x34')]));_0x434bb7[_0xb767('0x35')]=_0x434bb7[_0xb767('0x35')]['length']?_0x434bb7[_0xb767('0x35')]:_0x38d345['model'];_0x434bb7[_0xb767('0x4c')]=qs[_0xb767('0x39')](_0xf11c18[_0xb767('0x2f')][_0xb767('0x39')]);_0x434bb7['where']=qs[_0xb767('0x31')](_[_0xb767('0x4d')](_0xf11c18['query'],_0x38d345[_0xb767('0x31')]));if(_0xf11c18[_0xb767('0x2f')][_0xb767('0x3b')]){_0x434bb7[_0xb767('0x3a')]=_['merge'](_0x434bb7[_0xb767('0x3a')],{'$or':_[_0xb767('0x2a')](_0x434bb7[_0xb767('0x35')],function(_0x11b225){var _0x5f28a9={};_0x5f28a9[_0x11b225]={'$like':'%'+_0xf11c18[_0xb767('0x2f')][_0xb767('0x3b')]+'%'};return _0x5f28a9;})});}_0x434bb7=_[_0xb767('0x3d')]({},_0x434bb7,_0xf11c18[_0xb767('0x43')]);return _0x31a61d[_0xb767('0x49')](_0x434bb7);}})['then'](function(_0x55f8e3){if(_0x55f8e3){_0x4c36ad=_0x55f8e3['length'];if(!_0xf11c18[_0xb767('0x2f')]['hasOwnProperty']('nolimit')){_0x434bb7[_0xb767('0x1e')]=qs[_0xb767('0x1e')](_0xf11c18[_0xb767('0x2f')]['limit']);_0x434bb7[_0xb767('0x1c')]=qs[_0xb767('0x1c')](_0xf11c18[_0xb767('0x2f')][_0xb767('0x1c')]);}return _0x31a61d[_0xb767('0x49')](_0x434bb7);}})[_0xb767('0x24')](function(_0x40b244){if(_0x40b244){return _0x40b244?{'count':_0x4c36ad,'rows':_0x40b244}:null;}})[_0xb767('0x24')](respondWithResult(_0x5d169d,null))['catch'](handleError(_0x5d169d,null));};exports[_0xb767('0x4e')]=function(_0x38d534,_0x15523b,_0x79b2b7){if(_0x38d534['body']['id']){delete _0x38d534[_0xb767('0x46')]['id'];}return db[_0xb767('0x2b')][_0xb767('0x4a')]({'where':{'id':_0x38d534[_0xb767('0x41')]['id']}})[_0xb767('0x24')](handleEntityNotFound(_0x15523b,null))['then'](function(_0x5b55dc){if(_0x5b55dc){_0x38d534[_0xb767('0x46')][_0xb767('0x4f')]=_0x5b55dc['id'];_0x38d534[_0xb767('0x46')]['Subjects']=integrations[_0xb767('0x50')](_0x38d534[_0xb767('0x46')]['channel'],_0x38d534[_0xb767('0x46')][_0xb767('0x2e')]);_0x38d534['body'][_0xb767('0x51')]=integrations[_0xb767('0x52')](_0x38d534['body']['channel'],_0x38d534['body']['type']);return db['ServicenowConfiguration'][_0xb767('0x45')](_0x38d534[_0xb767('0x46')],{'include':[{'model':db[_0xb767('0x53')],'as':_0xb767('0x54')},{'model':db['ServicenowField'],'as':_0xb767('0x51')}]});}return null;})['then'](respondWithResult(_0x15523b,null))[_0xb767('0x47')](handleError(_0x15523b,null));};exports['getFields']=function(_0x4265cf,_0x354810,_0x474612){var _0x4bb347=[_0xb767('0x55'),_0xb767('0x56'),'knowledge','subcategory',_0xb767('0x57'),_0xb767('0x58'),_0xb767('0x59'),_0xb767('0x5a'),_0xb767('0x5b')];var _0x5ed3b4=[_0xb767('0x5c'),'made_sla',_0xb767('0x5d'),_0xb767('0x5e'),_0xb767('0x5f'),'sys_updated_on',_0xb767('0x60'),_0xb767('0x56'),_0xb767('0x61'),_0xb767('0x62'),_0xb767('0x63'),_0xb767('0x64'),_0xb767('0x65'),_0xb767('0x66'),_0xb767('0x67'),_0xb767('0x68'),_0xb767('0x69'),_0xb767('0x6a'),'knowledge','order',_0xb767('0x6b'),'closed_at',_0xb767('0x6c'),_0xb767('0x6d'),_0xb767('0x6e'),_0xb767('0x6f'),_0xb767('0x70'),_0xb767('0x71'),_0xb767('0x72'),'sys_domain_path',_0xb767('0x73'),'time_worked',_0xb767('0x74'),_0xb767('0x75'),'business_duration','group_list',_0xb767('0x76'),_0xb767('0x77'),_0xb767('0x78'),_0xb767('0x79'),'approval_set',_0xb767('0x7a'),_0xb767('0x7b'),'short_description',_0xb767('0x57'),_0xb767('0x7c'),_0xb767('0x7d'),_0xb767('0x7e'),_0xb767('0x7f'),_0xb767('0x80'),'additional_assignee_list',_0xb767('0x81'),_0xb767('0x82'),_0xb767('0x58'),_0xb767('0x83'),_0xb767('0x84'),'closed_by',_0xb767('0x85'),_0xb767('0x86'),_0xb767('0x87'),_0xb767('0x88'),_0xb767('0x89'),_0xb767('0x59'),_0xb767('0x8a'),_0xb767('0x8b'),_0xb767('0x8c'),_0xb767('0x8d'),'activity_due',_0xb767('0x8e'),_0xb767('0x5a'),_0xb767('0x8f'),_0xb767('0x90'),_0xb767('0x91'),'comments_and_work_notes',_0xb767('0x92'),_0xb767('0x93'),'reopen_count',_0xb767('0x94'),'escalation','upon_approval',_0xb767('0x95'),'location','category'];var _0x3701e0='';var _0x4bcbd4='';var _0x19cabe=[];var _0xa93d3c='';var _0x5a2522='';var _0x1c3c68=[];var _0x575798='';var _0x4ec53e='';var _0x31bb7c={};var _0x4265ac='';return db['ServicenowAccount'][_0xb767('0x4a')]({'where':{'id':_0x4265cf[_0xb767('0x41')]['id']},'attributes':['id','username','password',_0xb767('0x96'),_0xb767('0x97'),_0xb767('0x98')]})['then'](handleEntityNotFound(_0x354810,null))['then'](function(_0x191787){if(_0x191787){_0x4265ac=_0x191787[_0xb767('0x97')];var _0x416820=_0x4265ac['slice'](-0x1);if(_0x416820==='/'){_0x4265ac=_0x4265ac[_0xb767('0x99')](0x0,_0x4265ac['lastIndexOf'](_0x416820));}_0x4ec53e=util[_0xb767('0x9a')](_0xb767('0x9b'),_0x4265ac);_0x575798=util[_0xb767('0x9a')](_0xb767('0x9c'),_0x4265ac);_0x31bb7c={'user':_0x191787[_0xb767('0x9d')],'pass':_0x191787[_0xb767('0x9e')]};var _0x116712={'method':_0xb767('0x9f'),'uri':_0x4ec53e+_0xb767('0xa0'),'auth':_0x31bb7c,'json':!![]};return rp(_0x116712);}})[_0xb767('0x24')](function(_0x59920a){if(_0x59920a[_0xb767('0xa1')][_0xb767('0x36')]>0x0){_0x3701e0=_0x59920a[_0xb767('0xa1')];}console[_0xb767('0xa2')](_0xb767('0xa3'),_0x3701e0);_0x1c3c68=[];_0x4bcbd4=Object[_0xb767('0xa4')]([],_0x3701e0);_[_0xb767('0xa5')](_0x4bcbd4,function(_0x249b82){return!_0x4bb347[_0xb767('0xa6')](_0x249b82[_0xb767('0x27')]);});_0x4bcbd4[_0xb767('0xa7')](function(_0x1db412){var _0x1e05af=createFieldObject(_0x575798,_0x31bb7c,_0x1db412[_0xb767('0xa8')],_0x1db412[_0xb767('0x27')],_0x1db412[_0xb767('0xa9')],![]);_0x1c3c68[_0xb767('0xaa')](_0x1e05af);});return Promise[_0xb767('0xab')](_0x1c3c68);})['then'](function(_0x1fde6c){_0x19cabe=_0x1fde6c;_0xa93d3c=Object['assign']([],_0x3701e0);console[_0xb767('0xa2')](_0xb767('0xac'),_0x3701e0);_[_0xb767('0xa5')](_0xa93d3c,function(_0x33d34a){return _0x5ed3b4[_0xb767('0xa6')](_0x33d34a[_0xb767('0x27')]);});console[_0xb767('0xa2')](_0xb767('0xad'),_0xa93d3c);_0x1c3c68=[];_0xa93d3c[_0xb767('0xa7')](function(_0x11a5dd){var _0x289c97=createFieldObject(_0x575798,_0x31bb7c,_0x11a5dd[_0xb767('0xa8')],_0x11a5dd[_0xb767('0x27')],_0x11a5dd[_0xb767('0xa9')],!![]);_0x1c3c68[_0xb767('0xaa')](_0x289c97);});return Promise[_0xb767('0xab')](_0x1c3c68);})['then'](function(_0x3f5ed0){_0x5a2522=_0x3f5ed0;var _0x3dc238=_0x19cabe[_0xb767('0xae')](_0x5a2522);return{'count':_0x3dc238['length'],'rows':_0x3dc238};})[_0xb767('0x24')](respondWithResult(_0x354810,null))[_0xb767('0x47')](function(_0x418522){console['log']('ServiceNow\x20error:\x20'+_0x418522);var _0x596bda=_0x4265cf[_0xb767('0x2f')][_0xb767('0xaf')]?0x1f4:_0x418522[_0xb767('0xb0')]||0x1f4;logger[_0xb767('0xb1')](_0x418522[_0xb767('0x26')]);delete _0x418522[_0xb767('0x27')];if(_0x596bda===0x191){_0x596bda=0x190;}_0x354810[_0xb767('0x19')](_0x596bda)[_0xb767('0x28')](_0x4265cf[_0xb767('0x2f')][_0xb767('0xaf')]?{'message':_0xb767('0xb2'),'statusCode':_0x418522[_0xb767('0xb0')]}:_0x418522);});};function createFieldObject(_0x4be273,_0xa37000,_0x2cd1d0,_0x1d2c40,_0x2f395e,_0x2176d3){return new Promise(function(_0x44fc39,_0x1e8bed){var _0x4cd6d1={'id':_0x1d2c40,'name':_0x2f395e,'custom':_0x2176d3};if(_0x2cd1d0==='boolean'){_0x4cd6d1['options']=[{'name':_0xb767('0xb3'),'value':_0xb767('0xb4')},{'name':_0xb767('0xb5'),'value':'false'}];_0x44fc39(_0x4cd6d1);}else{var _0x741ac2={'method':_0xb767('0x9f'),'uri':_0x4be273+_0xb767('0xb6')+_0x1d2c40,'auth':_0xa37000,'json':!![]};return rp(_0x741ac2)[_0xb767('0x24')](function(_0x2cc42d){var _0x4d9e59=[];if(_0x2cc42d[_0xb767('0xa1')][_0xb767('0x36')]>0x0){_0x2cc42d[_0xb767('0xa1')][_0xb767('0xa7')](function(_0x1c3cf6){if(_0x1c3cf6[_0xb767('0xb7')]==='false'){var _0x142467={'name':_0x1c3cf6[_0xb767('0xa9')],'value':_0x1c3cf6[_0xb767('0xb8')]};_0x4d9e59[_0xb767('0xaa')](_0x142467);}});}_0x4cd6d1[_0xb767('0x43')]=_0x4d9e59;if(_0x4cd6d1[_0xb767('0x43')]['length']>0x0){_0x44fc39(_0x4cd6d1);}else{if(_0x2176d3==![]){_0x44fc39();}else{_0x44fc39(_0x4cd6d1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 08f5d06..4ef5197 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 _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x425b19,_0x2dcf14){_0x425b19=_0x425b19-0x0;var _0x15ecab=_0xf2ca[_0x425b19];return _0x15ecab;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xaf2c('0x9'));module[_0xaf2c('0xa')]=function(_0x297740,_0x1f9531){return _0x297740['define'](_0xaf2c('0xb'),attributes,{'tableName':_0xaf2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4b77a,_0x5819d6){var _0x1596e9=function(_0x1ea019){while(--_0x1ea019){_0x4b77a['push'](_0x4b77a['shift']());}};_0x1596e9(++_0x5819d6);}(_0x31f0,0xb7));var _0x031f=function(_0x16dc63,_0x272a6f){_0x16dc63=_0x16dc63-0x0;var _0x211715=_0x31f0[_0x16dc63];return _0x211715;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'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 7557e8d..15ace6f 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 _0x1565=['attributes','map','include','model','stringify','ServicenowAccount','find','raw','ShowServicenowAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','findAll','options','where'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x1565,0x131));var _0x5156=function(_0x4e3879,_0x1c35aa){_0x4e3879=_0x4e3879-0x0;var _0x40a93c=_0x1565[_0x4e3879];return _0x40a93c;};'use strict';var _=require(_0x5156('0x0'));var util=require(_0x5156('0x1'));var moment=require('moment');var BPromise=require(_0x5156('0x2'));var rs=require(_0x5156('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5156('0x4'))['db'];var utils=require(_0x5156('0x5'));var logger=require(_0x5156('0x6'))(_0x5156('0x7'));var config=require(_0x5156('0x8'));var jayson=require(_0x5156('0x9'));var client=jayson[_0x5156('0xa')][_0x5156('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4afdb7,_0x5ce83a,_0x5145ec){return new BPromise(function(_0x36de5d,_0x2b85f5){return client[_0x5156('0xc')](_0x4afdb7,_0x5145ec)[_0x5156('0xd')](function(_0x567d93){logger[_0x5156('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5ce83a,_0x5156('0xf'));logger[_0x5156('0x10')](_0x5156('0x11'),_0x5ce83a,_0x5156('0xf'),JSON['stringify'](_0x567d93));if(_0x567d93[_0x5156('0x12')]){if(_0x567d93[_0x5156('0x12')][_0x5156('0x13')]===0x1f4){logger[_0x5156('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5ce83a,_0x567d93[_0x5156('0x12')][_0x5156('0x14')]);return _0x2b85f5(_0x567d93[_0x5156('0x12')]['message']);}logger[_0x5156('0x12')](_0x5156('0x15'),_0x5ce83a,_0x567d93['error'][_0x5156('0x14')]);return _0x36de5d(_0x567d93[_0x5156('0x12')][_0x5156('0x14')]);}else{logger['info'](_0x5156('0x15'),_0x5ce83a,_0x5156('0xf'));_0x36de5d(_0x567d93[_0x5156('0x16')][_0x5156('0x14')]);}})[_0x5156('0x17')](function(_0x56a6c2){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5ce83a,_0x56a6c2);_0x2b85f5(_0x56a6c2);});});}exports[_0x5156('0x18')]=function(_0x3e6f7b){var _0xbf9b09=this;return new Promise(function(_0x13584e,_0x3c9955){return db['ServicenowAccount'][_0x5156('0x19')]({'raw':_0x3e6f7b['options']?_0x3e6f7b['options']['raw']===undefined?!![]:![]:!![],'where':_0x3e6f7b[_0x5156('0x1a')]?_0x3e6f7b[_0x5156('0x1a')][_0x5156('0x1b')]||null:null,'attributes':_0x3e6f7b[_0x5156('0x1a')]?_0x3e6f7b[_0x5156('0x1a')][_0x5156('0x1c')]||null:null,'limit':_0x3e6f7b[_0x5156('0x1a')]?_0x3e6f7b['options']['limit']||null:null,'include':_0x3e6f7b[_0x5156('0x1a')]?_0x3e6f7b[_0x5156('0x1a')]['include']?_['map'](_0x3e6f7b[_0x5156('0x1a')]['include'],function(_0x888c7e){return{'model':db[_0x888c7e['model']],'as':_0x888c7e['as'],'attributes':_0x888c7e[_0x5156('0x1c')],'include':_0x888c7e['include']?_[_0x5156('0x1d')](_0x888c7e[_0x5156('0x1e')],function(_0x38ccc8){return{'model':db[_0x38ccc8[_0x5156('0x1f')]],'as':_0x38ccc8['as'],'attributes':_0x38ccc8[_0x5156('0x1c')],'include':_0x38ccc8[_0x5156('0x1e')]?_[_0x5156('0x1d')](_0x38ccc8['include'],function(_0x39837b){return{'model':db[_0x39837b[_0x5156('0x1f')]],'as':_0x39837b['as'],'attributes':_0x39837b['attributes']};}):[]};}):[]};}):[]:[]})[_0x5156('0xd')](function(_0x385de7){logger['info']('GetServicenowAccount',_0x3e6f7b);logger[_0x5156('0x10')](_0x5156('0x18'),_0x3e6f7b,JSON[_0x5156('0x20')](_0x385de7));_0x13584e(_0x385de7);})[_0x5156('0x17')](function(_0x41c0d5){logger['error']('GetServicenowAccount',_0x41c0d5['message'],_0x3e6f7b);_0x3c9955(_0xbf9b09[_0x5156('0x12')](0x1f4,_0x41c0d5['message']));});});};exports['ShowServicenowAccount']=function(_0x2611c5){var _0x27c4e7=this;return new Promise(function(_0xd7ca99,_0x103e70){return db[_0x5156('0x21')][_0x5156('0x22')]({'raw':_0x2611c5[_0x5156('0x1a')]?_0x2611c5['options'][_0x5156('0x23')]===undefined?!![]:![]:!![],'where':_0x2611c5['options']?_0x2611c5['options'][_0x5156('0x1b')]||null:null,'attributes':_0x2611c5[_0x5156('0x1a')]?_0x2611c5[_0x5156('0x1a')][_0x5156('0x1c')]||null:null,'include':_0x2611c5[_0x5156('0x1a')]?_0x2611c5[_0x5156('0x1a')][_0x5156('0x1e')]?_[_0x5156('0x1d')](_0x2611c5[_0x5156('0x1a')][_0x5156('0x1e')],function(_0x21cde2){return{'model':db[_0x21cde2[_0x5156('0x1f')]],'as':_0x21cde2['as'],'attributes':_0x21cde2[_0x5156('0x1c')],'include':_0x21cde2['include']?_[_0x5156('0x1d')](_0x21cde2['include'],function(_0x57b190){return{'model':db[_0x57b190[_0x5156('0x1f')]],'as':_0x57b190['as'],'attributes':_0x57b190[_0x5156('0x1c')],'include':_0x57b190[_0x5156('0x1e')]?_[_0x5156('0x1d')](_0x57b190['include'],function(_0x4e6f8e){return{'model':db[_0x4e6f8e[_0x5156('0x1f')]],'as':_0x4e6f8e['as'],'attributes':_0x4e6f8e[_0x5156('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5156('0xd')](function(_0x58c286){logger[_0x5156('0xe')](_0x5156('0x24'),_0x2611c5);logger[_0x5156('0x10')](_0x5156('0x24'),_0x2611c5,JSON[_0x5156('0x20')](_0x58c286));_0xd7ca99(_0x58c286);})[_0x5156('0x17')](function(_0x5cf8d8){logger[_0x5156('0x12')](_0x5156('0x24'),_0x5cf8d8[_0x5156('0x14')],_0x2611c5);_0x103e70(_0x27c4e7['error'](0x1f4,_0x5cf8d8['message']));});});}; \ No newline at end of file +var _0xa68c=['raw','where','limit','include','map','model','attributes','ShowServicenowAccount','ServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','findAll','options'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xa68c,0x121));var _0xca68=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xa68c[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xca68('0x0'));var util=require(_0xca68('0x1'));var moment=require(_0xca68('0x2'));var BPromise=require(_0xca68('0x3'));var rs=require(_0xca68('0x4'));var fs=require('fs');var Redis=require(_0xca68('0x5'));var db=require(_0xca68('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xca68('0x7'))(_0xca68('0x8'));var config=require(_0xca68('0x9'));var jayson=require(_0xca68('0xa'));var client=jayson['client'][_0xca68('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3da33d,_0x4580d9,_0x333bcb){return new BPromise(function(_0x59562f,_0x8ac5ce){return client['request'](_0x3da33d,_0x333bcb)[_0xca68('0xc')](function(_0x25860f){logger[_0xca68('0xd')](_0xca68('0xe'),_0x4580d9,_0xca68('0xf'));logger[_0xca68('0x10')](_0xca68('0x11'),_0x4580d9,_0xca68('0xf'),JSON[_0xca68('0x12')](_0x25860f));if(_0x25860f['error']){if(_0x25860f[_0xca68('0x13')][_0xca68('0x14')]===0x1f4){logger['error'](_0xca68('0xe'),_0x4580d9,_0x25860f[_0xca68('0x13')][_0xca68('0x15')]);return _0x8ac5ce(_0x25860f[_0xca68('0x13')][_0xca68('0x15')]);}logger['error'](_0xca68('0xe'),_0x4580d9,_0x25860f[_0xca68('0x13')][_0xca68('0x15')]);return _0x59562f(_0x25860f[_0xca68('0x13')]['message']);}else{logger[_0xca68('0xd')](_0xca68('0xe'),_0x4580d9,'request\x20sent');_0x59562f(_0x25860f['result'][_0xca68('0x15')]);}})[_0xca68('0x16')](function(_0x5b90d7){logger[_0xca68('0x13')](_0xca68('0xe'),_0x4580d9,_0x5b90d7);_0x8ac5ce(_0x5b90d7);});});}exports[_0xca68('0x17')]=function(_0x1a36e5){var _0x598834=this;return new Promise(function(_0x3697ec,_0x570e36){return db['ServicenowAccount'][_0xca68('0x18')]({'raw':_0x1a36e5['options']?_0x1a36e5[_0xca68('0x19')][_0xca68('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a36e5['options']?_0x1a36e5[_0xca68('0x19')][_0xca68('0x1b')]||null:null,'attributes':_0x1a36e5[_0xca68('0x19')]?_0x1a36e5[_0xca68('0x19')]['attributes']||null:null,'limit':_0x1a36e5[_0xca68('0x19')]?_0x1a36e5[_0xca68('0x19')][_0xca68('0x1c')]||null:null,'include':_0x1a36e5[_0xca68('0x19')]?_0x1a36e5[_0xca68('0x19')][_0xca68('0x1d')]?_[_0xca68('0x1e')](_0x1a36e5[_0xca68('0x19')][_0xca68('0x1d')],function(_0x3474fc){return{'model':db[_0x3474fc[_0xca68('0x1f')]],'as':_0x3474fc['as'],'attributes':_0x3474fc[_0xca68('0x20')],'include':_0x3474fc[_0xca68('0x1d')]?_[_0xca68('0x1e')](_0x3474fc[_0xca68('0x1d')],function(_0x58b8af){return{'model':db[_0x58b8af[_0xca68('0x1f')]],'as':_0x58b8af['as'],'attributes':_0x58b8af[_0xca68('0x20')],'include':_0x58b8af['include']?_[_0xca68('0x1e')](_0x58b8af[_0xca68('0x1d')],function(_0xfe7723){return{'model':db[_0xfe7723[_0xca68('0x1f')]],'as':_0xfe7723['as'],'attributes':_0xfe7723[_0xca68('0x20')]};}):[]};}):[]};}):[]:[]})[_0xca68('0xc')](function(_0x4de691){logger[_0xca68('0xd')]('GetServicenowAccount',_0x1a36e5);logger[_0xca68('0x10')]('GetServicenowAccount',_0x1a36e5,JSON['stringify'](_0x4de691));_0x3697ec(_0x4de691);})[_0xca68('0x16')](function(_0x4a2c2e){logger[_0xca68('0x13')](_0xca68('0x17'),_0x4a2c2e[_0xca68('0x15')],_0x1a36e5);_0x570e36(_0x598834[_0xca68('0x13')](0x1f4,_0x4a2c2e['message']));});});};exports[_0xca68('0x21')]=function(_0x1fcad3){var _0x5a43f8=this;return new Promise(function(_0x581b5c,_0x15afd5){return db[_0xca68('0x22')]['find']({'raw':_0x1fcad3['options']?_0x1fcad3['options'][_0xca68('0x1a')]===undefined?!![]:![]:!![],'where':_0x1fcad3['options']?_0x1fcad3[_0xca68('0x19')][_0xca68('0x1b')]||null:null,'attributes':_0x1fcad3[_0xca68('0x19')]?_0x1fcad3[_0xca68('0x19')][_0xca68('0x20')]||null:null,'include':_0x1fcad3[_0xca68('0x19')]?_0x1fcad3[_0xca68('0x19')][_0xca68('0x1d')]?_[_0xca68('0x1e')](_0x1fcad3['options'][_0xca68('0x1d')],function(_0x2de9c4){return{'model':db[_0x2de9c4[_0xca68('0x1f')]],'as':_0x2de9c4['as'],'attributes':_0x2de9c4[_0xca68('0x20')],'include':_0x2de9c4['include']?_[_0xca68('0x1e')](_0x2de9c4[_0xca68('0x1d')],function(_0x295ed8){return{'model':db[_0x295ed8['model']],'as':_0x295ed8['as'],'attributes':_0x295ed8[_0xca68('0x20')],'include':_0x295ed8['include']?_['map'](_0x295ed8[_0xca68('0x1d')],function(_0x569c22){return{'model':db[_0x569c22[_0xca68('0x1f')]],'as':_0x569c22['as'],'attributes':_0x569c22['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e42f7){logger[_0xca68('0xd')]('ShowServicenowAccount',_0x1fcad3);logger[_0xca68('0x10')]('ShowServicenowAccount',_0x1fcad3,JSON['stringify'](_0x4e42f7));_0x581b5c(_0x4e42f7);})['catch'](function(_0x3acb2f){logger[_0xca68('0x13')](_0xca68('0x21'),_0x3acb2f[_0xca68('0x15')],_0x1fcad3);_0x15afd5(_0x5a43f8[_0xca68('0x13')](0x1f4,_0x3acb2f['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 71961a6..97fce1a 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 _0x1a78=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','get','index','/:id'];(function(_0x456080,_0x5cdc22){var _0x2bd741=function(_0x30fab4){while(--_0x30fab4){_0x456080['push'](_0x456080['shift']());}};_0x2bd741(++_0x5cdc22);}(_0x1a78,0x173));var _0x81a7=function(_0x364528,_0x1baf18){_0x364528=_0x364528-0x0;var _0x2610b6=_0x1a78[_0x364528];return _0x2610b6;};'use strict';var multer=require(_0x81a7('0x0'));var util=require(_0x81a7('0x1'));var path=require(_0x81a7('0x2'));var timeout=require(_0x81a7('0x3'));var express=require(_0x81a7('0x4'));var router=express['Router']();var fs_extra=require(_0x81a7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x81a7('0x6')]('/',auth['isAuthenticated'](),controller[_0x81a7('0x7')]);router[_0x81a7('0x6')](_0x81a7('0x8'),auth[_0x81a7('0x9')](),controller[_0x81a7('0xa')]);router[_0x81a7('0x6')](_0x81a7('0xb'),auth['isAuthenticated'](),controller[_0x81a7('0xc')]);router['get'](_0x81a7('0xd'),auth[_0x81a7('0x9')](),controller[_0x81a7('0xe')]);router['get'](_0x81a7('0xf'),auth[_0x81a7('0x9')](),controller['getDescriptions']);router[_0x81a7('0x10')]('/',auth[_0x81a7('0x9')](),controller['create']);router['put'](_0x81a7('0x8'),auth[_0x81a7('0x9')](),controller['update']);router[_0x81a7('0x11')](_0x81a7('0x8'),auth[_0x81a7('0x9')](),controller[_0x81a7('0x12')]);module[_0x81a7('0x13')]=router; \ No newline at end of file +var _0xd257=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete'];(function(_0x5ac5d6,_0x51eb3e){var _0x2c8e34=function(_0x5103c7){while(--_0x5103c7){_0x5ac5d6['push'](_0x5ac5d6['shift']());}};_0x2c8e34(++_0x51eb3e);}(_0xd257,0xfb));var _0x7d25=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xd257[_0x4fc80b];return _0x119dba;};'use strict';var multer=require('multer');var util=require(_0x7d25('0x0'));var path=require(_0x7d25('0x1'));var timeout=require(_0x7d25('0x2'));var express=require(_0x7d25('0x3'));var router=express[_0x7d25('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7d25('0x5'));var interaction=require(_0x7d25('0x6'));var config=require(_0x7d25('0x7'));var controller=require(_0x7d25('0x8'));router[_0x7d25('0x9')]('/',auth[_0x7d25('0xa')](),controller[_0x7d25('0xb')]);router[_0x7d25('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7d25('0xc')]);router['get'](_0x7d25('0xd'),auth[_0x7d25('0xa')](),controller['getFields']);router[_0x7d25('0x9')](_0x7d25('0xe'),auth[_0x7d25('0xa')](),controller[_0x7d25('0xf')]);router[_0x7d25('0x9')](_0x7d25('0x10'),auth[_0x7d25('0xa')](),controller[_0x7d25('0x11')]);router[_0x7d25('0x12')]('/',auth[_0x7d25('0xa')](),controller[_0x7d25('0x13')]);router[_0x7d25('0x14')](_0x7d25('0x15'),auth[_0x7d25('0xa')](),controller[_0x7d25('0x16')]);router[_0x7d25('0x17')](_0x7d25('0x15'),auth[_0x7d25('0xa')](),controller[_0x7d25('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index ed1d22e..4e311ee 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 _0x2eb0=['STRING','sequelize','exports'];(function(_0x4a705a,_0x13c990){var _0x37e5bd=function(_0x90517f){while(--_0x90517f){_0x4a705a['push'](_0x4a705a['shift']());}};_0x37e5bd(++_0x13c990);}(_0x2eb0,0x9d));var _0x02eb=function(_0x31eaa5,_0x2c2350){_0x31eaa5=_0x31eaa5-0x0;var _0x2ca012=_0x2eb0[_0x31eaa5];return _0x2ca012;};'use strict';var Sequelize=require(_0x02eb('0x0'));module[_0x02eb('0x1')]={'name':{'type':Sequelize[_0x02eb('0x2')]},'description':{'type':Sequelize[_0x02eb('0x2')]}}; \ No newline at end of file +var _0xf74a=['sequelize','STRING'];(function(_0x41ce18,_0x3fb646){var _0x630df9=function(_0xffd4c6){while(--_0xffd4c6){_0x41ce18['push'](_0x41ce18['shift']());}};_0x630df9(++_0x3fb646);}(_0xf74a,0x110));var _0xaf74=function(_0x1738aa,_0x5a61e0){_0x1738aa=_0x1738aa-0x0;var _0x5ca83c=_0xf74a[_0x1738aa];return _0x5ca83c;};'use strict';var Sequelize=require(_0xaf74('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf74('0x1')]},'description':{'type':Sequelize[_0xaf74('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 63a9a2d..fd3cb2d 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 _0x5044=['../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','ServicenowConfiguration','includeAll','include','findAll','params','keys','options','find','create','body','catch','ServicenowField','merge','getFields','getSubjects','findOne','getDescriptions','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x491756,_0x2bd06b){var _0x269960=function(_0x592048){while(--_0x592048){_0x491756['push'](_0x491756['shift']());}};_0x269960(++_0x2bd06b);}(_0x5044,0xd5));var _0x4504=function(_0x22cd92,_0x4adef8){_0x22cd92=_0x22cd92-0x0;var _0x400cae=_0x5044[_0x22cd92];return _0x400cae;};'use strict';var emlformat=require(_0x4504('0x0'));var rimraf=require(_0x4504('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4504('0x2'));var rp=require(_0x4504('0x3'));var moment=require(_0x4504('0x4'));var BPromise=require(_0x4504('0x5'));var Mustache=require(_0x4504('0x6'));var util=require(_0x4504('0x7'));var path=require(_0x4504('0x8'));var sox=require(_0x4504('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4504('0xa'));var _=require(_0x4504('0xb'));var squel=require(_0x4504('0xc'));var crypto=require(_0x4504('0xd'));var jsforce=require(_0x4504('0xe'));var deskjs=require(_0x4504('0xf'));var toCsv=require(_0x4504('0x10'));var querystring=require(_0x4504('0x11'));var Papa=require(_0x4504('0x12'));var Redis=require(_0x4504('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4504('0x14'));var as=require(_0x4504('0x15'));var hardwareService=require(_0x4504('0x16'));var logger=require(_0x4504('0x17'))(_0x4504('0x18'));var utils=require('../../config/utils');var config=require(_0x4504('0x19'));var licenseUtil=require(_0x4504('0x1a'));var db=require(_0x4504('0x1b'))['db'];function respondWithStatusCode(_0x31d00b,_0x32a18e){_0x32a18e=_0x32a18e||0xcc;return function(_0x22185f){if(_0x22185f){return _0x31d00b[_0x4504('0x1c')](_0x32a18e);}return _0x31d00b[_0x4504('0x1d')](_0x32a18e)[_0x4504('0x1e')]();};}function respondWithResult(_0x22faed,_0x367704){_0x367704=_0x367704||0xc8;return function(_0x186602){if(_0x186602){return _0x22faed[_0x4504('0x1d')](_0x367704)[_0x4504('0x1f')](_0x186602);}};}function respondWithFilteredResult(_0x52e265,_0x31a694){return function(_0x26ad84){if(_0x26ad84){var _0x189538=typeof _0x31a694[_0x4504('0x20')]==='undefined'&&typeof _0x31a694[_0x4504('0x21')]==='undefined';var _0x4191d0=_0x26ad84['count'];var _0x32b87e=_0x189538?0x0:_0x31a694['offset'];var _0x26a341=_0x189538?_0x26ad84[_0x4504('0x22')]:_0x31a694['offset']+_0x31a694[_0x4504('0x21')];var _0x7ce0bf;if(_0x26a341>=_0x4191d0){_0x26a341=_0x4191d0;_0x7ce0bf=0xc8;}else{_0x7ce0bf=0xce;}_0x52e265[_0x4504('0x1d')](_0x7ce0bf);return _0x52e265[_0x4504('0x23')]('Content-Range',_0x32b87e+'-'+_0x26a341+'/'+_0x4191d0)['json'](_0x26ad84);}return null;};}function patchUpdates(_0x1953e3){return function(_0x90a9d){try{jsonpatch['apply'](_0x90a9d,_0x1953e3,!![]);}catch(_0xf74404){return BPromise['reject'](_0xf74404);}return _0x90a9d[_0x4504('0x24')]();};}function saveUpdates(_0x11dcf6,_0xea7b06){return function(_0x524be2){if(_0x524be2){return _0x524be2[_0x4504('0x25')](_0x11dcf6)['then'](function(_0x57ee7d){return _0x57ee7d;});}return null;};}function removeEntity(_0x2117f1,_0x26af7b){return function(_0x564aa7){if(_0x564aa7){return _0x564aa7[_0x4504('0x26')]()[_0x4504('0x27')](function(){_0x2117f1['status'](0xcc)[_0x4504('0x1e')]();});}};}function handleEntityNotFound(_0x41515b,_0x11c03d){return function(_0x229dd5){if(!_0x229dd5){_0x41515b[_0x4504('0x1c')](0x194);}return _0x229dd5;};}function handleError(_0x50a1e2,_0x4ee01a){_0x4ee01a=_0x4ee01a||0x1f4;return function(_0x365a67){logger[_0x4504('0x28')](_0x365a67[_0x4504('0x29')]);if(_0x365a67[_0x4504('0x2a')]){delete _0x365a67[_0x4504('0x2a')];}_0x50a1e2[_0x4504('0x1d')](_0x4ee01a)[_0x4504('0x2b')](_0x365a67);};}exports['index']=function(_0x15680f,_0xcecfff){var _0x5e4e6c={},_0x5908e9={},_0x1d9968={'count':0x0,'rows':[]};var _0x22ccd5=_[_0x4504('0x2c')](db['ServicenowConfiguration'][_0x4504('0x2d')],function(_0x394aa3){return{'name':_0x394aa3[_0x4504('0x2e')],'type':_0x394aa3['type']['key']};});_0x5908e9[_0x4504('0x2f')]=_[_0x4504('0x2c')](_0x22ccd5,_0x4504('0x2a'));_0x5908e9[_0x4504('0x30')]=_['keys'](_0x15680f[_0x4504('0x30')]);_0x5908e9['filters']=_[_0x4504('0x31')](_0x5908e9['model'],_0x5908e9['query']);_0x5e4e6c[_0x4504('0x32')]=_[_0x4504('0x31')](_0x5908e9[_0x4504('0x2f')],qs[_0x4504('0x33')](_0x15680f[_0x4504('0x30')]['fields']));_0x5e4e6c['attributes']=_0x5e4e6c[_0x4504('0x32')][_0x4504('0x34')]?_0x5e4e6c[_0x4504('0x32')]:_0x5908e9[_0x4504('0x2f')];if(!_0x15680f[_0x4504('0x30')][_0x4504('0x35')](_0x4504('0x36'))){_0x5e4e6c[_0x4504('0x21')]=qs[_0x4504('0x21')](_0x15680f['query']['limit']);_0x5e4e6c[_0x4504('0x20')]=qs['offset'](_0x15680f['query'][_0x4504('0x20')]);}_0x5e4e6c[_0x4504('0x37')]=qs[_0x4504('0x38')](_0x15680f['query']['sort']);_0x5e4e6c['where']=qs[_0x4504('0x39')](_[_0x4504('0x3a')](_0x15680f[_0x4504('0x30')],_0x5908e9[_0x4504('0x39')]),_0x22ccd5);if(_0x15680f[_0x4504('0x30')][_0x4504('0x3b')]){_0x5e4e6c[_0x4504('0x3c')]=_['merge'](_0x5e4e6c[_0x4504('0x3c')],{'$or':_[_0x4504('0x2c')](_0x22ccd5,function(_0x1cef20){if(_0x1cef20[_0x4504('0x3d')]!==_0x4504('0x3e')){var _0x1457f2={};_0x1457f2[_0x1cef20[_0x4504('0x2a')]]={'$like':'%'+_0x15680f[_0x4504('0x30')][_0x4504('0x3b')]+'%'};return _0x1457f2;}})});}_0x5e4e6c=_['merge']({},_0x5e4e6c,_0x15680f['options']);var _0xe6a9f2={'where':_0x5e4e6c['where']};return db[_0x4504('0x3f')]['count'](_0xe6a9f2)[_0x4504('0x27')](function(_0x55c003){_0x1d9968[_0x4504('0x22')]=_0x55c003;if(_0x15680f[_0x4504('0x30')][_0x4504('0x40')]){_0x5e4e6c[_0x4504('0x41')]=[{'all':!![]}];}return db[_0x4504('0x3f')][_0x4504('0x42')](_0x5e4e6c);})[_0x4504('0x27')](function(_0x159123){_0x1d9968['rows']=_0x159123;return _0x1d9968;})['then'](respondWithFilteredResult(_0xcecfff,_0x5e4e6c))['catch'](handleError(_0xcecfff,null));};exports['show']=function(_0x536112,_0x4580ff){var _0x3ceea4={'raw':![],'where':{'id':_0x536112[_0x4504('0x43')]['id']}},_0x201023={};_0x201023[_0x4504('0x2f')]=_['keys'](db[_0x4504('0x3f')]['rawAttributes']);_0x201023['query']=_[_0x4504('0x44')](_0x536112[_0x4504('0x30')]);_0x201023['filters']=_['intersection'](_0x201023[_0x4504('0x2f')],_0x201023['query']);_0x3ceea4[_0x4504('0x32')]=_[_0x4504('0x31')](_0x201023['model'],qs[_0x4504('0x33')](_0x536112['query'][_0x4504('0x33')]));_0x3ceea4['attributes']=_0x3ceea4[_0x4504('0x32')]['length']?_0x3ceea4[_0x4504('0x32')]:_0x201023['model'];if(_0x536112[_0x4504('0x30')][_0x4504('0x40')]){_0x3ceea4[_0x4504('0x41')]=[{'all':!![]}];}_0x3ceea4=_['merge']({},_0x3ceea4,_0x536112[_0x4504('0x45')]);return db[_0x4504('0x3f')][_0x4504('0x46')](_0x3ceea4)[_0x4504('0x27')](handleEntityNotFound(_0x4580ff,null))[_0x4504('0x27')](respondWithResult(_0x4580ff,null))['catch'](handleError(_0x4580ff,null));};exports[_0x4504('0x47')]=function(_0x19a205,_0x4c397b){return db['ServicenowConfiguration'][_0x4504('0x47')](_0x19a205[_0x4504('0x48')],{})[_0x4504('0x27')](respondWithResult(_0x4c397b,0xc9))[_0x4504('0x49')](handleError(_0x4c397b,null));};exports[_0x4504('0x25')]=function(_0x4543b6,_0x44bfb3){if(_0x4543b6[_0x4504('0x48')]['id']){delete _0x4543b6[_0x4504('0x48')]['id'];}return db['ServicenowConfiguration'][_0x4504('0x46')]({'where':{'id':_0x4543b6['params']['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x44bfb3,null))[_0x4504('0x27')](saveUpdates(_0x4543b6[_0x4504('0x48')],null))[_0x4504('0x27')](respondWithResult(_0x44bfb3,null))[_0x4504('0x49')](handleError(_0x44bfb3,null));};exports['destroy']=function(_0x551a9c,_0x38b244){return db['ServicenowConfiguration'][_0x4504('0x46')]({'where':{'id':_0x551a9c[_0x4504('0x43')]['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x38b244,null))['then'](removeEntity(_0x38b244,null))[_0x4504('0x49')](handleError(_0x38b244,null));};exports['getFields']=function(_0x4af45a,_0x5b4f4f,_0x11a024){var _0x4a5586={};var _0x40c849={};var _0x4663b3;var _0x5c3c42;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x4af45a[_0x4504('0x43')]['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x5b4f4f,null))['then'](function(_0x3ea480){if(_0x3ea480){_0x4663b3=_0x3ea480;_0x40c849[_0x4504('0x2f')]=_[_0x4504('0x44')](db[_0x4504('0x4a')][_0x4504('0x2d')]);_0x40c849[_0x4504('0x30')]=_[_0x4504('0x44')](_0x4af45a[_0x4504('0x30')]);_0x40c849[_0x4504('0x39')]=_[_0x4504('0x31')](_0x40c849[_0x4504('0x2f')],_0x40c849[_0x4504('0x30')]);_0x4a5586['attributes']=_[_0x4504('0x31')](_0x40c849[_0x4504('0x2f')],qs['fields'](_0x4af45a[_0x4504('0x30')]['fields']));_0x4a5586['attributes']=_0x4a5586[_0x4504('0x32')][_0x4504('0x34')]?_0x4a5586[_0x4504('0x32')]:_0x40c849['model'];_0x4a5586['order']=qs[_0x4504('0x38')](_0x4af45a[_0x4504('0x30')]['sort']);_0x4a5586[_0x4504('0x3c')]=qs['filters'](_[_0x4504('0x3a')](_0x4af45a['query'],_0x40c849['filters']));if(_0x4af45a[_0x4504('0x30')][_0x4504('0x3b')]){_0x4a5586[_0x4504('0x3c')]=_[_0x4504('0x4b')](_0x4a5586['where'],{'$or':_[_0x4504('0x2c')](_0x4a5586[_0x4504('0x32')],function(_0x1dbe28){var _0x3eb818={};_0x3eb818[_0x1dbe28]={'$like':'%'+_0x4af45a[_0x4504('0x30')]['filter']+'%'};return _0x3eb818;})});}_0x4a5586=_[_0x4504('0x4b')]({},_0x4a5586,_0x4af45a[_0x4504('0x45')]);return _0x4663b3[_0x4504('0x4c')](_0x4a5586);}})[_0x4504('0x27')](function(_0x22c2de){if(_0x22c2de){_0x5c3c42=_0x22c2de[_0x4504('0x34')];if(!_0x4af45a[_0x4504('0x30')][_0x4504('0x35')](_0x4504('0x36'))){_0x4a5586['limit']=qs['limit'](_0x4af45a[_0x4504('0x30')]['limit']);_0x4a5586[_0x4504('0x20')]=qs['offset'](_0x4af45a['query'][_0x4504('0x20')]);}return _0x4663b3[_0x4504('0x4c')](_0x4a5586);}})[_0x4504('0x27')](function(_0x235757){if(_0x235757){return _0x235757?{'count':_0x5c3c42,'rows':_0x235757}:null;}})['then'](respondWithResult(_0x5b4f4f,null))[_0x4504('0x49')](handleError(_0x5b4f4f,null));};exports[_0x4504('0x4d')]=function(_0x3c1bef,_0x2d86c2,_0x543a11){var _0x2a2b6c={};var _0xab16b3={};var _0x447b9e;var _0x46a1c7;return db[_0x4504('0x3f')][_0x4504('0x4e')]({'where':{'id':_0x3c1bef[_0x4504('0x43')]['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x2d86c2,null))[_0x4504('0x27')](function(_0x35dd51){if(_0x35dd51){_0x447b9e=_0x35dd51;_0xab16b3['model']=_[_0x4504('0x44')](db['ServicenowField']['rawAttributes']);_0xab16b3[_0x4504('0x30')]=_[_0x4504('0x44')](_0x3c1bef[_0x4504('0x30')]);_0xab16b3['filters']=_[_0x4504('0x31')](_0xab16b3[_0x4504('0x2f')],_0xab16b3[_0x4504('0x30')]);_0x2a2b6c[_0x4504('0x32')]=_[_0x4504('0x31')](_0xab16b3[_0x4504('0x2f')],qs[_0x4504('0x33')](_0x3c1bef['query'][_0x4504('0x33')]));_0x2a2b6c[_0x4504('0x32')]=_0x2a2b6c[_0x4504('0x32')][_0x4504('0x34')]?_0x2a2b6c[_0x4504('0x32')]:_0xab16b3['model'];_0x2a2b6c[_0x4504('0x37')]=qs[_0x4504('0x38')](_0x3c1bef[_0x4504('0x30')][_0x4504('0x38')]);_0x2a2b6c[_0x4504('0x3c')]=qs[_0x4504('0x39')](_['pick'](_0x3c1bef[_0x4504('0x30')],_0xab16b3[_0x4504('0x39')]));if(_0x3c1bef[_0x4504('0x30')][_0x4504('0x3b')]){_0x2a2b6c['where']=_[_0x4504('0x4b')](_0x2a2b6c[_0x4504('0x3c')],{'$or':_[_0x4504('0x2c')](_0x2a2b6c[_0x4504('0x32')],function(_0x1e5876){var _0x33d225={};_0x33d225[_0x1e5876]={'$like':'%'+_0x3c1bef['query'][_0x4504('0x3b')]+'%'};return _0x33d225;})});}_0x2a2b6c=_[_0x4504('0x4b')]({},_0x2a2b6c,_0x3c1bef[_0x4504('0x45')]);return _0x447b9e[_0x4504('0x4d')](_0x2a2b6c);}})[_0x4504('0x27')](function(_0xbd7948){if(_0xbd7948){_0x46a1c7=_0xbd7948[_0x4504('0x34')];if(!_0x3c1bef['query'][_0x4504('0x35')](_0x4504('0x36'))){_0x2a2b6c['limit']=qs[_0x4504('0x21')](_0x3c1bef[_0x4504('0x30')][_0x4504('0x21')]);_0x2a2b6c[_0x4504('0x20')]=qs[_0x4504('0x20')](_0x3c1bef[_0x4504('0x30')][_0x4504('0x20')]);}return _0x447b9e[_0x4504('0x4d')](_0x2a2b6c);}})['then'](function(_0x2e6ff0){if(_0x2e6ff0){return _0x2e6ff0?{'count':_0x46a1c7,'rows':_0x2e6ff0}:null;}})[_0x4504('0x27')](respondWithResult(_0x2d86c2,null))[_0x4504('0x49')](handleError(_0x2d86c2,null));};exports[_0x4504('0x4f')]=function(_0x1de346,_0x223e64,_0x3141a0){var _0x471818={};var _0x1a40d3={};var _0x248f45;var _0x2b00d2;return db[_0x4504('0x3f')][_0x4504('0x4e')]({'where':{'id':_0x1de346['params']['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x223e64,null))[_0x4504('0x27')](function(_0x31e328){if(_0x31e328){_0x248f45=_0x31e328;_0x1a40d3[_0x4504('0x2f')]=_[_0x4504('0x44')](db[_0x4504('0x4a')][_0x4504('0x2d')]);_0x1a40d3[_0x4504('0x30')]=_[_0x4504('0x44')](_0x1de346['query']);_0x1a40d3[_0x4504('0x39')]=_[_0x4504('0x31')](_0x1a40d3[_0x4504('0x2f')],_0x1a40d3['query']);_0x471818['attributes']=_[_0x4504('0x31')](_0x1a40d3[_0x4504('0x2f')],qs[_0x4504('0x33')](_0x1de346[_0x4504('0x30')][_0x4504('0x33')]));_0x471818[_0x4504('0x32')]=_0x471818[_0x4504('0x32')][_0x4504('0x34')]?_0x471818[_0x4504('0x32')]:_0x1a40d3[_0x4504('0x2f')];_0x471818[_0x4504('0x37')]=qs[_0x4504('0x38')](_0x1de346[_0x4504('0x30')][_0x4504('0x38')]);_0x471818[_0x4504('0x3c')]=qs['filters'](_[_0x4504('0x3a')](_0x1de346[_0x4504('0x30')],_0x1a40d3[_0x4504('0x39')]));if(_0x1de346[_0x4504('0x30')]['filter']){_0x471818['where']=_[_0x4504('0x4b')](_0x471818[_0x4504('0x3c')],{'$or':_[_0x4504('0x2c')](_0x471818[_0x4504('0x32')],function(_0x4e7135){var _0x162bf2={};_0x162bf2[_0x4e7135]={'$like':'%'+_0x1de346[_0x4504('0x30')][_0x4504('0x3b')]+'%'};return _0x162bf2;})});}_0x471818=_[_0x4504('0x4b')]({},_0x471818,_0x1de346[_0x4504('0x45')]);return _0x248f45[_0x4504('0x4f')](_0x471818);}})[_0x4504('0x27')](function(_0x27720b){if(_0x27720b){_0x2b00d2=_0x27720b[_0x4504('0x34')];if(!_0x1de346[_0x4504('0x30')][_0x4504('0x35')](_0x4504('0x36'))){_0x471818['limit']=qs['limit'](_0x1de346[_0x4504('0x30')][_0x4504('0x21')]);_0x471818[_0x4504('0x20')]=qs[_0x4504('0x20')](_0x1de346[_0x4504('0x30')][_0x4504('0x20')]);}return _0x248f45[_0x4504('0x4f')](_0x471818);}})[_0x4504('0x27')](function(_0x7913e5){if(_0x7913e5){return _0x7913e5?{'count':_0x2b00d2,'rows':_0x7913e5}:null;}})[_0x4504('0x27')](respondWithResult(_0x223e64,null))[_0x4504('0x49')](handleError(_0x223e64,null));}; \ No newline at end of file +var _0x4e1d=['key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','catch','show','params','rawAttributes','keys','includeAll','include','options','find','create','body','update','getFields','findOne','pick','ServicenowField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','map','ServicenowConfiguration','type'];(function(_0x242649,_0x23f4d0){var _0x539a41=function(_0x383a4c){while(--_0x383a4c){_0x242649['push'](_0x242649['shift']());}};_0x539a41(++_0x23f4d0);}(_0x4e1d,0x10c));var _0xd4e1=function(_0x5486e3,_0x586681){_0x5486e3=_0x5486e3-0x0;var _0x3e5c42=_0x4e1d[_0x5486e3];return _0x3e5c42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4e1('0x0'));var zipdir=require(_0xd4e1('0x1'));var jsonpatch=require(_0xd4e1('0x2'));var rp=require(_0xd4e1('0x3'));var moment=require('moment');var BPromise=require(_0xd4e1('0x4'));var Mustache=require(_0xd4e1('0x5'));var util=require('util');var path=require(_0xd4e1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4e1('0x7'));var fs=require('fs');var fs_extra=require(_0xd4e1('0x8'));var _=require('lodash');var squel=require(_0xd4e1('0x9'));var crypto=require(_0xd4e1('0xa'));var jsforce=require(_0xd4e1('0xb'));var deskjs=require(_0xd4e1('0xc'));var toCsv=require(_0xd4e1('0xd'));var querystring=require('querystring');var Papa=require(_0xd4e1('0xe'));var Redis=require(_0xd4e1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd4e1('0x10'));var as=require(_0xd4e1('0x11'));var hardwareService=require(_0xd4e1('0x12'));var logger=require(_0xd4e1('0x13'))(_0xd4e1('0x14'));var utils=require('../../config/utils');var config=require(_0xd4e1('0x15'));var licenseUtil=require(_0xd4e1('0x16'));var db=require(_0xd4e1('0x17'))['db'];function respondWithStatusCode(_0x3953f4,_0x21cf59){_0x21cf59=_0x21cf59||0xcc;return function(_0x4e8aea){if(_0x4e8aea){return _0x3953f4['sendStatus'](_0x21cf59);}return _0x3953f4[_0xd4e1('0x18')](_0x21cf59)[_0xd4e1('0x19')]();};}function respondWithResult(_0x33a7e3,_0x125712){_0x125712=_0x125712||0xc8;return function(_0x4a0008){if(_0x4a0008){return _0x33a7e3['status'](_0x125712)[_0xd4e1('0x1a')](_0x4a0008);}};}function respondWithFilteredResult(_0x4f4bc1,_0x1d6364){return function(_0x4a1fe1){if(_0x4a1fe1){var _0x57b627=typeof _0x1d6364[_0xd4e1('0x1b')]===_0xd4e1('0x1c')&&typeof _0x1d6364[_0xd4e1('0x1d')]===_0xd4e1('0x1c');var _0x1e8e31=_0x4a1fe1[_0xd4e1('0x1e')];var _0x1e1a9e=_0x57b627?0x0:_0x1d6364['offset'];var _0x20c28d=_0x57b627?_0x4a1fe1[_0xd4e1('0x1e')]:_0x1d6364[_0xd4e1('0x1b')]+_0x1d6364['limit'];var _0xe026be;if(_0x20c28d>=_0x1e8e31){_0x20c28d=_0x1e8e31;_0xe026be=0xc8;}else{_0xe026be=0xce;}_0x4f4bc1[_0xd4e1('0x18')](_0xe026be);return _0x4f4bc1[_0xd4e1('0x1f')](_0xd4e1('0x20'),_0x1e1a9e+'-'+_0x20c28d+'/'+_0x1e8e31)[_0xd4e1('0x1a')](_0x4a1fe1);}return null;};}function patchUpdates(_0x18258f){return function(_0x3b0ae0){try{jsonpatch['apply'](_0x3b0ae0,_0x18258f,!![]);}catch(_0x3df5de){return BPromise[_0xd4e1('0x21')](_0x3df5de);}return _0x3b0ae0['save']();};}function saveUpdates(_0x3bc499,_0x2f7975){return function(_0x50c089){if(_0x50c089){return _0x50c089['update'](_0x3bc499)[_0xd4e1('0x22')](function(_0x342718){return _0x342718;});}return null;};}function removeEntity(_0x4748e9,_0x5d53e8){return function(_0x5e7a23){if(_0x5e7a23){return _0x5e7a23[_0xd4e1('0x23')]()[_0xd4e1('0x22')](function(){_0x4748e9[_0xd4e1('0x18')](0xcc)[_0xd4e1('0x19')]();});}};}function handleEntityNotFound(_0x213bb4,_0x1dbd70){return function(_0x3e3208){if(!_0x3e3208){_0x213bb4[_0xd4e1('0x24')](0x194);}return _0x3e3208;};}function handleError(_0x24e28e,_0x53fee1){_0x53fee1=_0x53fee1||0x1f4;return function(_0x3cf1fb){logger[_0xd4e1('0x25')](_0x3cf1fb[_0xd4e1('0x26')]);if(_0x3cf1fb[_0xd4e1('0x27')]){delete _0x3cf1fb[_0xd4e1('0x27')];}_0x24e28e[_0xd4e1('0x18')](_0x53fee1)[_0xd4e1('0x28')](_0x3cf1fb);};}exports['index']=function(_0x3c1558,_0x4ed8cb){var _0x10aa40={},_0x48ff65={},_0x2c6e97={'count':0x0,'rows':[]};var _0x16de2d=_[_0xd4e1('0x29')](db[_0xd4e1('0x2a')]['rawAttributes'],function(_0x106bf4){return{'name':_0x106bf4['fieldName'],'type':_0x106bf4[_0xd4e1('0x2b')][_0xd4e1('0x2c')]};});_0x48ff65[_0xd4e1('0x2d')]=_[_0xd4e1('0x29')](_0x16de2d,'name');_0x48ff65['query']=_['keys'](_0x3c1558['query']);_0x48ff65[_0xd4e1('0x2e')]=_[_0xd4e1('0x2f')](_0x48ff65['model'],_0x48ff65[_0xd4e1('0x30')]);_0x10aa40[_0xd4e1('0x31')]=_[_0xd4e1('0x2f')](_0x48ff65[_0xd4e1('0x2d')],qs[_0xd4e1('0x32')](_0x3c1558['query'][_0xd4e1('0x32')]));_0x10aa40['attributes']=_0x10aa40[_0xd4e1('0x31')][_0xd4e1('0x33')]?_0x10aa40[_0xd4e1('0x31')]:_0x48ff65[_0xd4e1('0x2d')];if(!_0x3c1558[_0xd4e1('0x30')][_0xd4e1('0x34')](_0xd4e1('0x35'))){_0x10aa40[_0xd4e1('0x1d')]=qs[_0xd4e1('0x1d')](_0x3c1558['query'][_0xd4e1('0x1d')]);_0x10aa40[_0xd4e1('0x1b')]=qs[_0xd4e1('0x1b')](_0x3c1558[_0xd4e1('0x30')]['offset']);}_0x10aa40[_0xd4e1('0x36')]=qs[_0xd4e1('0x37')](_0x3c1558[_0xd4e1('0x30')][_0xd4e1('0x37')]);_0x10aa40['where']=qs[_0xd4e1('0x2e')](_['pick'](_0x3c1558[_0xd4e1('0x30')],_0x48ff65['filters']),_0x16de2d);if(_0x3c1558[_0xd4e1('0x30')][_0xd4e1('0x38')]){_0x10aa40[_0xd4e1('0x39')]=_[_0xd4e1('0x3a')](_0x10aa40['where'],{'$or':_[_0xd4e1('0x29')](_0x16de2d,function(_0x537ff6){if(_0x537ff6[_0xd4e1('0x2b')]!==_0xd4e1('0x3b')){var _0x2d6ea0={};_0x2d6ea0[_0x537ff6[_0xd4e1('0x27')]]={'$like':'%'+_0x3c1558[_0xd4e1('0x30')]['filter']+'%'};return _0x2d6ea0;}})});}_0x10aa40=_[_0xd4e1('0x3a')]({},_0x10aa40,_0x3c1558['options']);var _0x39a9dd={'where':_0x10aa40[_0xd4e1('0x39')]};return db['ServicenowConfiguration'][_0xd4e1('0x1e')](_0x39a9dd)['then'](function(_0x4ceedb){_0x2c6e97[_0xd4e1('0x1e')]=_0x4ceedb;if(_0x3c1558[_0xd4e1('0x30')]['includeAll']){_0x10aa40['include']=[{'all':!![]}];}return db[_0xd4e1('0x2a')]['findAll'](_0x10aa40);})[_0xd4e1('0x22')](function(_0x20d134){_0x2c6e97['rows']=_0x20d134;return _0x2c6e97;})['then'](respondWithFilteredResult(_0x4ed8cb,_0x10aa40))[_0xd4e1('0x3c')](handleError(_0x4ed8cb,null));};exports[_0xd4e1('0x3d')]=function(_0x2da08f,_0x39cabe){var _0x4a610e={'raw':![],'where':{'id':_0x2da08f[_0xd4e1('0x3e')]['id']}},_0x24fe13={};_0x24fe13[_0xd4e1('0x2d')]=_['keys'](db[_0xd4e1('0x2a')][_0xd4e1('0x3f')]);_0x24fe13['query']=_[_0xd4e1('0x40')](_0x2da08f[_0xd4e1('0x30')]);_0x24fe13['filters']=_[_0xd4e1('0x2f')](_0x24fe13['model'],_0x24fe13[_0xd4e1('0x30')]);_0x4a610e['attributes']=_[_0xd4e1('0x2f')](_0x24fe13[_0xd4e1('0x2d')],qs['fields'](_0x2da08f[_0xd4e1('0x30')][_0xd4e1('0x32')]));_0x4a610e['attributes']=_0x4a610e['attributes']['length']?_0x4a610e['attributes']:_0x24fe13[_0xd4e1('0x2d')];if(_0x2da08f[_0xd4e1('0x30')][_0xd4e1('0x41')]){_0x4a610e[_0xd4e1('0x42')]=[{'all':!![]}];}_0x4a610e=_['merge']({},_0x4a610e,_0x2da08f[_0xd4e1('0x43')]);return db[_0xd4e1('0x2a')][_0xd4e1('0x44')](_0x4a610e)[_0xd4e1('0x22')](handleEntityNotFound(_0x39cabe,null))['then'](respondWithResult(_0x39cabe,null))[_0xd4e1('0x3c')](handleError(_0x39cabe,null));};exports[_0xd4e1('0x45')]=function(_0x1c033c,_0x42d618){return db[_0xd4e1('0x2a')][_0xd4e1('0x45')](_0x1c033c[_0xd4e1('0x46')],{})[_0xd4e1('0x22')](respondWithResult(_0x42d618,0xc9))[_0xd4e1('0x3c')](handleError(_0x42d618,null));};exports[_0xd4e1('0x47')]=function(_0x484af0,_0x57d21b){if(_0x484af0['body']['id']){delete _0x484af0[_0xd4e1('0x46')]['id'];}return db['ServicenowConfiguration'][_0xd4e1('0x44')]({'where':{'id':_0x484af0[_0xd4e1('0x3e')]['id']}})[_0xd4e1('0x22')](handleEntityNotFound(_0x57d21b,null))[_0xd4e1('0x22')](saveUpdates(_0x484af0['body'],null))[_0xd4e1('0x22')](respondWithResult(_0x57d21b,null))[_0xd4e1('0x3c')](handleError(_0x57d21b,null));};exports['destroy']=function(_0x43eba8,_0x74f659){return db['ServicenowConfiguration']['find']({'where':{'id':_0x43eba8[_0xd4e1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x74f659,null))[_0xd4e1('0x22')](removeEntity(_0x74f659,null))[_0xd4e1('0x3c')](handleError(_0x74f659,null));};exports[_0xd4e1('0x48')]=function(_0x145d1d,_0x3fbdf4,_0x5615c4){var _0x3bb15d={};var _0x5f0977={};var _0x3323c8;var _0x165d7e;return db[_0xd4e1('0x2a')][_0xd4e1('0x49')]({'where':{'id':_0x145d1d[_0xd4e1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3fbdf4,null))[_0xd4e1('0x22')](function(_0x1cc03c){if(_0x1cc03c){_0x3323c8=_0x1cc03c;_0x5f0977[_0xd4e1('0x2d')]=_[_0xd4e1('0x40')](db['ServicenowField']['rawAttributes']);_0x5f0977[_0xd4e1('0x30')]=_[_0xd4e1('0x40')](_0x145d1d[_0xd4e1('0x30')]);_0x5f0977[_0xd4e1('0x2e')]=_[_0xd4e1('0x2f')](_0x5f0977['model'],_0x5f0977[_0xd4e1('0x30')]);_0x3bb15d['attributes']=_[_0xd4e1('0x2f')](_0x5f0977[_0xd4e1('0x2d')],qs['fields'](_0x145d1d['query'][_0xd4e1('0x32')]));_0x3bb15d[_0xd4e1('0x31')]=_0x3bb15d['attributes'][_0xd4e1('0x33')]?_0x3bb15d['attributes']:_0x5f0977[_0xd4e1('0x2d')];_0x3bb15d[_0xd4e1('0x36')]=qs[_0xd4e1('0x37')](_0x145d1d[_0xd4e1('0x30')][_0xd4e1('0x37')]);_0x3bb15d[_0xd4e1('0x39')]=qs['filters'](_[_0xd4e1('0x4a')](_0x145d1d[_0xd4e1('0x30')],_0x5f0977[_0xd4e1('0x2e')]));if(_0x145d1d[_0xd4e1('0x30')][_0xd4e1('0x38')]){_0x3bb15d[_0xd4e1('0x39')]=_[_0xd4e1('0x3a')](_0x3bb15d[_0xd4e1('0x39')],{'$or':_[_0xd4e1('0x29')](_0x3bb15d[_0xd4e1('0x31')],function(_0x1e6c7a){var _0x269588={};_0x269588[_0x1e6c7a]={'$like':'%'+_0x145d1d[_0xd4e1('0x30')][_0xd4e1('0x38')]+'%'};return _0x269588;})});}_0x3bb15d=_[_0xd4e1('0x3a')]({},_0x3bb15d,_0x145d1d[_0xd4e1('0x43')]);return _0x3323c8[_0xd4e1('0x48')](_0x3bb15d);}})['then'](function(_0x5aec96){if(_0x5aec96){_0x165d7e=_0x5aec96[_0xd4e1('0x33')];if(!_0x145d1d[_0xd4e1('0x30')]['hasOwnProperty'](_0xd4e1('0x35'))){_0x3bb15d[_0xd4e1('0x1d')]=qs[_0xd4e1('0x1d')](_0x145d1d['query'][_0xd4e1('0x1d')]);_0x3bb15d[_0xd4e1('0x1b')]=qs['offset'](_0x145d1d['query'][_0xd4e1('0x1b')]);}return _0x3323c8[_0xd4e1('0x48')](_0x3bb15d);}})[_0xd4e1('0x22')](function(_0x27671f){if(_0x27671f){return _0x27671f?{'count':_0x165d7e,'rows':_0x27671f}:null;}})[_0xd4e1('0x22')](respondWithResult(_0x3fbdf4,null))[_0xd4e1('0x3c')](handleError(_0x3fbdf4,null));};exports['getSubjects']=function(_0x353cf4,_0xc93c7d,_0x31aa08){var _0x1a24b6={};var _0x1a77c3={};var _0x1445df;var _0x599e55;return db[_0xd4e1('0x2a')]['findOne']({'where':{'id':_0x353cf4[_0xd4e1('0x3e')]['id']}})[_0xd4e1('0x22')](handleEntityNotFound(_0xc93c7d,null))[_0xd4e1('0x22')](function(_0x492392){if(_0x492392){_0x1445df=_0x492392;_0x1a77c3['model']=_[_0xd4e1('0x40')](db[_0xd4e1('0x4b')]['rawAttributes']);_0x1a77c3[_0xd4e1('0x30')]=_[_0xd4e1('0x40')](_0x353cf4[_0xd4e1('0x30')]);_0x1a77c3[_0xd4e1('0x2e')]=_['intersection'](_0x1a77c3[_0xd4e1('0x2d')],_0x1a77c3['query']);_0x1a24b6[_0xd4e1('0x31')]=_[_0xd4e1('0x2f')](_0x1a77c3[_0xd4e1('0x2d')],qs[_0xd4e1('0x32')](_0x353cf4[_0xd4e1('0x30')][_0xd4e1('0x32')]));_0x1a24b6[_0xd4e1('0x31')]=_0x1a24b6['attributes'][_0xd4e1('0x33')]?_0x1a24b6[_0xd4e1('0x31')]:_0x1a77c3[_0xd4e1('0x2d')];_0x1a24b6['order']=qs[_0xd4e1('0x37')](_0x353cf4[_0xd4e1('0x30')][_0xd4e1('0x37')]);_0x1a24b6['where']=qs[_0xd4e1('0x2e')](_[_0xd4e1('0x4a')](_0x353cf4[_0xd4e1('0x30')],_0x1a77c3[_0xd4e1('0x2e')]));if(_0x353cf4[_0xd4e1('0x30')]['filter']){_0x1a24b6[_0xd4e1('0x39')]=_[_0xd4e1('0x3a')](_0x1a24b6[_0xd4e1('0x39')],{'$or':_[_0xd4e1('0x29')](_0x1a24b6['attributes'],function(_0x38bdd0){var _0x2d6ace={};_0x2d6ace[_0x38bdd0]={'$like':'%'+_0x353cf4[_0xd4e1('0x30')][_0xd4e1('0x38')]+'%'};return _0x2d6ace;})});}_0x1a24b6=_[_0xd4e1('0x3a')]({},_0x1a24b6,_0x353cf4[_0xd4e1('0x43')]);return _0x1445df[_0xd4e1('0x4c')](_0x1a24b6);}})[_0xd4e1('0x22')](function(_0xe2eeff){if(_0xe2eeff){_0x599e55=_0xe2eeff[_0xd4e1('0x33')];if(!_0x353cf4[_0xd4e1('0x30')][_0xd4e1('0x34')]('nolimit')){_0x1a24b6[_0xd4e1('0x1d')]=qs['limit'](_0x353cf4['query'][_0xd4e1('0x1d')]);_0x1a24b6[_0xd4e1('0x1b')]=qs[_0xd4e1('0x1b')](_0x353cf4['query'][_0xd4e1('0x1b')]);}return _0x1445df[_0xd4e1('0x4c')](_0x1a24b6);}})[_0xd4e1('0x22')](function(_0x264dd8){if(_0x264dd8){return _0x264dd8?{'count':_0x599e55,'rows':_0x264dd8}:null;}})['then'](respondWithResult(_0xc93c7d,null))[_0xd4e1('0x3c')](handleError(_0xc93c7d,null));};exports[_0xd4e1('0x4d')]=function(_0x2e5888,_0x2d94e1,_0x4ef48f){var _0x324ad1={};var _0x5c8ecd={};var _0x5d9ae0;var _0x560d66;return db[_0xd4e1('0x2a')]['findOne']({'where':{'id':_0x2e5888['params']['id']}})[_0xd4e1('0x22')](handleEntityNotFound(_0x2d94e1,null))[_0xd4e1('0x22')](function(_0x3950a0){if(_0x3950a0){_0x5d9ae0=_0x3950a0;_0x5c8ecd['model']=_[_0xd4e1('0x40')](db[_0xd4e1('0x4b')][_0xd4e1('0x3f')]);_0x5c8ecd[_0xd4e1('0x30')]=_[_0xd4e1('0x40')](_0x2e5888['query']);_0x5c8ecd[_0xd4e1('0x2e')]=_['intersection'](_0x5c8ecd['model'],_0x5c8ecd['query']);_0x324ad1[_0xd4e1('0x31')]=_[_0xd4e1('0x2f')](_0x5c8ecd[_0xd4e1('0x2d')],qs[_0xd4e1('0x32')](_0x2e5888['query']['fields']));_0x324ad1[_0xd4e1('0x31')]=_0x324ad1[_0xd4e1('0x31')][_0xd4e1('0x33')]?_0x324ad1[_0xd4e1('0x31')]:_0x5c8ecd[_0xd4e1('0x2d')];_0x324ad1[_0xd4e1('0x36')]=qs[_0xd4e1('0x37')](_0x2e5888['query'][_0xd4e1('0x37')]);_0x324ad1[_0xd4e1('0x39')]=qs[_0xd4e1('0x2e')](_[_0xd4e1('0x4a')](_0x2e5888[_0xd4e1('0x30')],_0x5c8ecd['filters']));if(_0x2e5888[_0xd4e1('0x30')]['filter']){_0x324ad1[_0xd4e1('0x39')]=_[_0xd4e1('0x3a')](_0x324ad1['where'],{'$or':_[_0xd4e1('0x29')](_0x324ad1[_0xd4e1('0x31')],function(_0x1b8e72){var _0x2b4730={};_0x2b4730[_0x1b8e72]={'$like':'%'+_0x2e5888[_0xd4e1('0x30')][_0xd4e1('0x38')]+'%'};return _0x2b4730;})});}_0x324ad1=_['merge']({},_0x324ad1,_0x2e5888[_0xd4e1('0x43')]);return _0x5d9ae0[_0xd4e1('0x4d')](_0x324ad1);}})[_0xd4e1('0x22')](function(_0x5e2fa3){if(_0x5e2fa3){_0x560d66=_0x5e2fa3[_0xd4e1('0x33')];if(!_0x2e5888[_0xd4e1('0x30')]['hasOwnProperty'](_0xd4e1('0x35'))){_0x324ad1[_0xd4e1('0x1d')]=qs[_0xd4e1('0x1d')](_0x2e5888[_0xd4e1('0x30')][_0xd4e1('0x1d')]);_0x324ad1[_0xd4e1('0x1b')]=qs[_0xd4e1('0x1b')](_0x2e5888[_0xd4e1('0x30')]['offset']);}return _0x5d9ae0[_0xd4e1('0x4d')](_0x324ad1);}})[_0xd4e1('0x22')](function(_0x17f489){if(_0x17f489){return _0x17f489?{'count':_0x560d66,'rows':_0x17f489}:null;}})[_0xd4e1('0x22')](respondWithResult(_0x2d94e1,null))[_0xd4e1('0x3c')](handleError(_0x2d94e1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2da8181..1f83b77 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 _0xfd6f=['rimraf','../../config/environment','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x348ef5,_0x3f0dff){var _0x2ced24=function(_0x39c5e9){while(--_0x39c5e9){_0x348ef5['push'](_0x348ef5['shift']());}};_0x2ced24(++_0x3f0dff);}(_0xfd6f,0x19d));var _0xffd6=function(_0xa0a89f,_0xbf638f){_0xa0a89f=_0xa0a89f-0x0;var _0xc33e10=_0xfd6f[_0xa0a89f];return _0xc33e10;};'use strict';var _=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var logger=require(_0xffd6('0x2'))(_0xffd6('0x3'));var moment=require(_0xffd6('0x4'));var BPromise=require('bluebird');var rp=require(_0xffd6('0x5'));var fs=require('fs');var path=require(_0xffd6('0x6'));var rimraf=require(_0xffd6('0x7'));var config=require(_0xffd6('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xffd6('0x9')]=function(_0x380073,_0x3f3cd8){return _0x380073[_0xffd6('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0xffd6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4213=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0xe6217,_0x2d16e6){var _0x74bbff=function(_0xce87c0){while(--_0xce87c0){_0xe6217['push'](_0xe6217['shift']());}};_0x74bbff(++_0x2d16e6);}(_0x4213,0x77));var _0x3421=function(_0x426506,_0x480461){_0x426506=_0x426506-0x0;var _0x624afd=_0x4213[_0x426506];return _0x624afd;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var logger=require(_0x3421('0x2'))(_0x3421('0x3'));var moment=require(_0x3421('0x4'));var BPromise=require(_0x3421('0x5'));var rp=require(_0x3421('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3421('0x7'));var config=require('../../config/environment');var attributes=require(_0x3421('0x8'));module[_0x3421('0x9')]=function(_0x2155f8,_0x2a04e0){return _0x2155f8['define'](_0x3421('0xa'),attributes,{'tableName':_0x3421('0xb'),'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 a6aec78..a6610b9 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 _0x5d81=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x535963,_0x326515){var _0x3975f6=function(_0x2e624f){while(--_0x2e624f){_0x535963['push'](_0x535963['shift']());}};_0x3975f6(++_0x326515);}(_0x5d81,0x1c0));var _0x15d8=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x5d81[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0x15d8('0x0'));var util=require(_0x15d8('0x1'));var moment=require(_0x15d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x15d8('0x3'));var fs=require('fs');var Redis=require(_0x15d8('0x4'));var db=require(_0x15d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15d8('0x6'))('rpc');var config=require(_0x15d8('0x7'));var jayson=require(_0x15d8('0x8'));var client=jayson[_0x15d8('0x9')][_0x15d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df2fe,_0x24ec78,_0x1d39a9){return new BPromise(function(_0x4ffe89,_0x31f49d){return client[_0x15d8('0xb')](_0x2df2fe,_0x1d39a9)['then'](function(_0x14640b){logger['info'](_0x15d8('0xc'),_0x24ec78,_0x15d8('0xd'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x24ec78,_0x15d8('0xd'),JSON[_0x15d8('0xe')](_0x14640b));if(_0x14640b['error']){if(_0x14640b[_0x15d8('0xf')]['code']===0x1f4){logger['error'](_0x15d8('0xc'),_0x24ec78,_0x14640b['error'][_0x15d8('0x10')]);return _0x31f49d(_0x14640b[_0x15d8('0xf')][_0x15d8('0x10')]);}logger[_0x15d8('0xf')](_0x15d8('0xc'),_0x24ec78,_0x14640b['error'][_0x15d8('0x10')]);return _0x4ffe89(_0x14640b[_0x15d8('0xf')]['message']);}else{logger[_0x15d8('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x24ec78,_0x15d8('0xd'));_0x4ffe89(_0x14640b[_0x15d8('0x12')][_0x15d8('0x10')]);}})[_0x15d8('0x13')](function(_0x1598b5){logger[_0x15d8('0xf')](_0x15d8('0xc'),_0x24ec78,_0x1598b5);_0x31f49d(_0x1598b5);});});} \ No newline at end of file +var _0x7d8a=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x9ea926,_0x32b1b2){var _0x129b2a=function(_0x278c47){while(--_0x278c47){_0x9ea926['push'](_0x9ea926['shift']());}};_0x129b2a(++_0x32b1b2);}(_0x7d8a,0x1cb));var _0xa7d8=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x7d8a[_0x313c96];return _0x522f53;};'use strict';var _=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var moment=require('moment');var BPromise=require(_0xa7d8('0x2'));var rs=require(_0xa7d8('0x3'));var fs=require('fs');var Redis=require(_0xa7d8('0x4'));var db=require(_0xa7d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7d8('0x6'))('rpc');var config=require(_0xa7d8('0x7'));var jayson=require(_0xa7d8('0x8'));var client=jayson['client'][_0xa7d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x447a75,_0x10cc46,_0x31336d){return new BPromise(function(_0x29cfda,_0x3712c6){return client[_0xa7d8('0xa')](_0x447a75,_0x31336d)[_0xa7d8('0xb')](function(_0x2427a1){logger[_0xa7d8('0xc')](_0xa7d8('0xd'),_0x10cc46,_0xa7d8('0xe'));logger[_0xa7d8('0xf')](_0xa7d8('0x10'),_0x10cc46,'request\x20sent',JSON[_0xa7d8('0x11')](_0x2427a1));if(_0x2427a1[_0xa7d8('0x12')]){if(_0x2427a1[_0xa7d8('0x12')][_0xa7d8('0x13')]===0x1f4){logger[_0xa7d8('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x10cc46,_0x2427a1[_0xa7d8('0x12')][_0xa7d8('0x14')]);return _0x3712c6(_0x2427a1[_0xa7d8('0x12')][_0xa7d8('0x14')]);}logger[_0xa7d8('0x12')](_0xa7d8('0xd'),_0x10cc46,_0x2427a1[_0xa7d8('0x12')][_0xa7d8('0x14')]);return _0x29cfda(_0x2427a1['error'][_0xa7d8('0x14')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x10cc46,_0xa7d8('0xe'));_0x29cfda(_0x2427a1[_0xa7d8('0x15')]['message']);}})[_0xa7d8('0x16')](function(_0x295da2){logger[_0xa7d8('0x12')](_0xa7d8('0xd'),_0x10cc46,_0x295da2);_0x3712c6(_0x295da2);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 5755bfd..58fcad9 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 _0x90d2=['express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5baccc,_0x38dcfd){var _0x290d09=function(_0x5a63b5){while(--_0x5a63b5){_0x5baccc['push'](_0x5baccc['shift']());}};_0x290d09(++_0x38dcfd);}(_0x90d2,0x1e3));var _0x290d=function(_0x81b084,_0x3ec128){_0x81b084=_0x81b084-0x0;var _0x54df6c=_0x90d2[_0x81b084];return _0x54df6c;};'use strict';var multer=require(_0x290d('0x0'));var util=require(_0x290d('0x1'));var path=require(_0x290d('0x2'));var timeout=require('connect-timeout');var express=require(_0x290d('0x3'));var router=express[_0x290d('0x4')]();var fs_extra=require(_0x290d('0x5'));var auth=require(_0x290d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x290d('0x7')]('/',auth[_0x290d('0x8')](),controller['index']);router['get'](_0x290d('0x9'),auth[_0x290d('0x8')](),controller[_0x290d('0xa')]);router[_0x290d('0xb')]('/',auth['isAuthenticated'](),controller[_0x290d('0xc')]);router[_0x290d('0xd')](_0x290d('0x9'),auth[_0x290d('0x8')](),controller[_0x290d('0xe')]);router[_0x290d('0xf')](_0x290d('0x9'),auth[_0x290d('0x8')](),controller[_0x290d('0x10')]);module[_0x290d('0x11')]=router; \ No newline at end of file +var _0x3a24=['put','/:id','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','show'];(function(_0x50fb85,_0x52cb16){var _0x2badbb=function(_0x585f45){while(--_0x585f45){_0x50fb85['push'](_0x50fb85['shift']());}};_0x2badbb(++_0x52cb16);}(_0x3a24,0x125));var _0x43a2=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x3a24[_0xabfec4];return _0x7bafa2;};'use strict';var multer=require(_0x43a2('0x0'));var util=require(_0x43a2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x43a2('0x2'));var router=express[_0x43a2('0x3')]();var fs_extra=require(_0x43a2('0x4'));var auth=require(_0x43a2('0x5'));var interaction=require(_0x43a2('0x6'));var config=require(_0x43a2('0x7'));var controller=require(_0x43a2('0x8'));router['get']('/',auth[_0x43a2('0x9')](),controller[_0x43a2('0xa')]);router[_0x43a2('0xb')]('/:id',auth[_0x43a2('0x9')](),controller[_0x43a2('0xc')]);router['post']('/',auth[_0x43a2('0x9')](),controller['create']);router[_0x43a2('0xd')](_0x43a2('0xe'),auth[_0x43a2('0x9')](),controller[_0x43a2('0xf')]);router[_0x43a2('0x10')](_0x43a2('0xe'),auth[_0x43a2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 7fc57d9..0f6f0db 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 _0x3d20=['keyValue','STRING','customVariable','exports','ENUM','string','variable'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3d20,0x1e6));var _0x03d2=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x3d20[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require('sequelize');module[_0x03d2('0x0')]={'type':{'type':Sequelize[_0x03d2('0x1')](_0x03d2('0x2'),_0x03d2('0x3'),'customVariable',_0x03d2('0x4'),'picklist'),'defaultValue':_0x03d2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x03d2('0x5')]},'keyType':{'type':Sequelize[_0x03d2('0x1')](_0x03d2('0x2'),_0x03d2('0x3'),_0x03d2('0x6'))},'keyContent':{'type':Sequelize[_0x03d2('0x5')]},'idField':{'type':Sequelize[_0x03d2('0x5')]},'nameField':{'type':Sequelize[_0x03d2('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x03d2('0x5')]}}; \ No newline at end of file +var _0x2700=['exports','ENUM','customVariable','keyValue','STRING','string','variable','BOOLEAN','sequelize'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x2700,0x74));var _0x0270=function(_0x3eaf6b,_0x3b1ccd){_0x3eaf6b=_0x3eaf6b-0x0;var _0x5c5a97=_0x2700[_0x3eaf6b];return _0x5c5a97;};'use strict';var Sequelize=require(_0x0270('0x0'));module[_0x0270('0x1')]={'type':{'type':Sequelize[_0x0270('0x2')]('string','variable',_0x0270('0x3'),_0x0270('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x0270('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x0270('0x6'),_0x0270('0x7'),_0x0270('0x3'))},'keyContent':{'type':Sequelize[_0x0270('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0270('0x5')]},'customField':{'type':Sequelize[_0x0270('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0270('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 10bfc9e..8857ac5 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 _0xf9b4=['apply','reject','update','then','destroy','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','attributes','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x3fd737,_0x263d58){var _0x4b9e85=function(_0x2cde35){while(--_0x2cde35){_0x3fd737['push'](_0x3fd737['shift']());}};_0x4b9e85(++_0x263d58);}(_0xf9b4,0x15b));var _0x4f9b=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xf9b4[_0xd4636c];return _0x5ee17d;};'use strict';var emlformat=require(_0x4f9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f9b('0x1'));var jsonpatch=require(_0x4f9b('0x2'));var rp=require(_0x4f9b('0x3'));var moment=require(_0x4f9b('0x4'));var BPromise=require(_0x4f9b('0x5'));var Mustache=require(_0x4f9b('0x6'));var util=require(_0x4f9b('0x7'));var path=require('path');var sox=require(_0x4f9b('0x8'));var csv=require('to-csv');var ejs=require(_0x4f9b('0x9'));var fs=require('fs');var fs_extra=require(_0x4f9b('0xa'));var _=require(_0x4f9b('0xb'));var squel=require(_0x4f9b('0xc'));var crypto=require(_0x4f9b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4f9b('0xe'));var querystring=require(_0x4f9b('0xf'));var Papa=require(_0x4f9b('0x10'));var Redis=require(_0x4f9b('0x11'));var authService=require(_0x4f9b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4f9b('0x13'));var hardwareService=require(_0x4f9b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4f9b('0x15'));var licenseUtil=require(_0x4f9b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bc2bf,_0x6e94ed){_0x6e94ed=_0x6e94ed||0xcc;return function(_0x439ba8){if(_0x439ba8){return _0x4bc2bf[_0x4f9b('0x17')](_0x6e94ed);}return _0x4bc2bf[_0x4f9b('0x18')](_0x6e94ed)[_0x4f9b('0x19')]();};}function respondWithResult(_0x468cf7,_0x32820a){_0x32820a=_0x32820a||0xc8;return function(_0x29b3f7){if(_0x29b3f7){return _0x468cf7['status'](_0x32820a)[_0x4f9b('0x1a')](_0x29b3f7);}};}function respondWithFilteredResult(_0x394494,_0x4568ed){return function(_0xc819ff){if(_0xc819ff){var _0x1c20f3=typeof _0x4568ed['offset']===_0x4f9b('0x1b')&&typeof _0x4568ed[_0x4f9b('0x1c')]===_0x4f9b('0x1b');var _0x26d74d=_0xc819ff[_0x4f9b('0x1d')];var _0x1e3772=_0x1c20f3?0x0:_0x4568ed[_0x4f9b('0x1e')];var _0x3b9480=_0x1c20f3?_0xc819ff[_0x4f9b('0x1d')]:_0x4568ed[_0x4f9b('0x1e')]+_0x4568ed[_0x4f9b('0x1c')];var _0xdd26e5;if(_0x3b9480>=_0x26d74d){_0x3b9480=_0x26d74d;_0xdd26e5=0xc8;}else{_0xdd26e5=0xce;}_0x394494[_0x4f9b('0x18')](_0xdd26e5);return _0x394494[_0x4f9b('0x1f')](_0x4f9b('0x20'),_0x1e3772+'-'+_0x3b9480+'/'+_0x26d74d)[_0x4f9b('0x1a')](_0xc819ff);}return null;};}function patchUpdates(_0x303cd9){return function(_0x4c3c09){try{jsonpatch[_0x4f9b('0x21')](_0x4c3c09,_0x303cd9,!![]);}catch(_0x1ec8f1){return BPromise[_0x4f9b('0x22')](_0x1ec8f1);}return _0x4c3c09['save']();};}function saveUpdates(_0x24a8fd,_0x4f7f11){return function(_0x11dff3){if(_0x11dff3){return _0x11dff3[_0x4f9b('0x23')](_0x24a8fd)[_0x4f9b('0x24')](function(_0x4b87ff){return _0x4b87ff;});}return null;};}function removeEntity(_0x3202e8,_0x3af82c){return function(_0x578642){if(_0x578642){return _0x578642[_0x4f9b('0x25')]()[_0x4f9b('0x24')](function(){_0x3202e8[_0x4f9b('0x18')](0xcc)[_0x4f9b('0x19')]();});}};}function handleEntityNotFound(_0x2d475e,_0x526fb0){return function(_0x31ec22){if(!_0x31ec22){_0x2d475e[_0x4f9b('0x17')](0x194);}return _0x31ec22;};}function handleError(_0x19dff1,_0x32ce66){_0x32ce66=_0x32ce66||0x1f4;return function(_0x250835){logger[_0x4f9b('0x26')](_0x250835[_0x4f9b('0x27')]);if(_0x250835[_0x4f9b('0x28')]){delete _0x250835[_0x4f9b('0x28')];}_0x19dff1[_0x4f9b('0x18')](_0x32ce66)['send'](_0x250835);};}exports[_0x4f9b('0x29')]=function(_0x308363,_0x138980){var _0x7cef38={},_0x2a82d0={},_0x36a35d={'count':0x0,'rows':[]};var _0x18db96=_[_0x4f9b('0x2a')](db[_0x4f9b('0x2b')][_0x4f9b('0x2c')],function(_0x3bda8e){return{'name':_0x3bda8e[_0x4f9b('0x2d')],'type':_0x3bda8e[_0x4f9b('0x2e')][_0x4f9b('0x2f')]};});_0x2a82d0[_0x4f9b('0x30')]=_[_0x4f9b('0x2a')](_0x18db96,'name');_0x2a82d0[_0x4f9b('0x31')]=_[_0x4f9b('0x32')](_0x308363['query']);_0x2a82d0['filters']=_['intersection'](_0x2a82d0[_0x4f9b('0x30')],_0x2a82d0[_0x4f9b('0x31')]);_0x7cef38['attributes']=_[_0x4f9b('0x33')](_0x2a82d0[_0x4f9b('0x30')],qs['fields'](_0x308363[_0x4f9b('0x31')][_0x4f9b('0x34')]));_0x7cef38['attributes']=_0x7cef38['attributes'][_0x4f9b('0x35')]?_0x7cef38['attributes']:_0x2a82d0[_0x4f9b('0x30')];if(!_0x308363[_0x4f9b('0x31')][_0x4f9b('0x36')](_0x4f9b('0x37'))){_0x7cef38[_0x4f9b('0x1c')]=qs[_0x4f9b('0x1c')](_0x308363[_0x4f9b('0x31')][_0x4f9b('0x1c')]);_0x7cef38[_0x4f9b('0x1e')]=qs[_0x4f9b('0x1e')](_0x308363['query'][_0x4f9b('0x1e')]);}_0x7cef38[_0x4f9b('0x38')]=qs[_0x4f9b('0x39')](_0x308363['query']['sort']);_0x7cef38[_0x4f9b('0x3a')]=qs[_0x4f9b('0x3b')](_[_0x4f9b('0x3c')](_0x308363[_0x4f9b('0x31')],_0x2a82d0[_0x4f9b('0x3b')]),_0x18db96);if(_0x308363[_0x4f9b('0x31')][_0x4f9b('0x3d')]){_0x7cef38[_0x4f9b('0x3a')]=_['merge'](_0x7cef38['where'],{'$or':_[_0x4f9b('0x2a')](_0x18db96,function(_0x24231e){if(_0x24231e[_0x4f9b('0x2e')]!==_0x4f9b('0x3e')){var _0x5a92d5={};_0x5a92d5[_0x24231e[_0x4f9b('0x28')]]={'$like':'%'+_0x308363[_0x4f9b('0x31')]['filter']+'%'};return _0x5a92d5;}})});}_0x7cef38=_[_0x4f9b('0x3f')]({},_0x7cef38,_0x308363['options']);var _0x3d4b1b={'where':_0x7cef38[_0x4f9b('0x3a')]};return db['ServicenowField'][_0x4f9b('0x1d')](_0x3d4b1b)[_0x4f9b('0x24')](function(_0x5e1835){_0x36a35d[_0x4f9b('0x1d')]=_0x5e1835;if(_0x308363[_0x4f9b('0x31')][_0x4f9b('0x40')]){_0x7cef38[_0x4f9b('0x41')]=[{'all':!![]}];}return db[_0x4f9b('0x2b')][_0x4f9b('0x42')](_0x7cef38);})[_0x4f9b('0x24')](function(_0x499ebc){_0x36a35d[_0x4f9b('0x43')]=_0x499ebc;return _0x36a35d;})[_0x4f9b('0x24')](respondWithFilteredResult(_0x138980,_0x7cef38))[_0x4f9b('0x44')](handleError(_0x138980,null));};exports[_0x4f9b('0x45')]=function(_0x433608,_0x2edc2c){var _0x5d89a6={'raw':!![],'where':{'id':_0x433608[_0x4f9b('0x46')]['id']}},_0x440358={};_0x440358[_0x4f9b('0x30')]=_[_0x4f9b('0x32')](db[_0x4f9b('0x2b')][_0x4f9b('0x2c')]);_0x440358['query']=_[_0x4f9b('0x32')](_0x433608[_0x4f9b('0x31')]);_0x440358[_0x4f9b('0x3b')]=_[_0x4f9b('0x33')](_0x440358[_0x4f9b('0x30')],_0x440358[_0x4f9b('0x31')]);_0x5d89a6[_0x4f9b('0x47')]=_[_0x4f9b('0x33')](_0x440358[_0x4f9b('0x30')],qs[_0x4f9b('0x34')](_0x433608['query'][_0x4f9b('0x34')]));_0x5d89a6[_0x4f9b('0x47')]=_0x5d89a6[_0x4f9b('0x47')][_0x4f9b('0x35')]?_0x5d89a6['attributes']:_0x440358[_0x4f9b('0x30')];if(_0x433608[_0x4f9b('0x31')]['includeAll']){_0x5d89a6['include']=[{'all':!![]}];}_0x5d89a6=_[_0x4f9b('0x3f')]({},_0x5d89a6,_0x433608[_0x4f9b('0x48')]);return db[_0x4f9b('0x2b')][_0x4f9b('0x49')](_0x5d89a6)[_0x4f9b('0x24')](handleEntityNotFound(_0x2edc2c,null))[_0x4f9b('0x24')](respondWithResult(_0x2edc2c,null))[_0x4f9b('0x44')](handleError(_0x2edc2c,null));};exports[_0x4f9b('0x4a')]=function(_0x4af7ca,_0x3c7137){return db[_0x4f9b('0x2b')][_0x4f9b('0x4a')](_0x4af7ca[_0x4f9b('0x4b')],{})[_0x4f9b('0x24')](respondWithResult(_0x3c7137,0xc9))[_0x4f9b('0x44')](handleError(_0x3c7137,null));};exports[_0x4f9b('0x23')]=function(_0x555347,_0x3c00a0){if(_0x555347[_0x4f9b('0x4b')]['id']){delete _0x555347['body']['id'];}return db[_0x4f9b('0x2b')][_0x4f9b('0x49')]({'where':{'id':_0x555347['params']['id']}})['then'](handleEntityNotFound(_0x3c00a0,null))[_0x4f9b('0x24')](saveUpdates(_0x555347[_0x4f9b('0x4b')],null))[_0x4f9b('0x24')](respondWithResult(_0x3c00a0,null))[_0x4f9b('0x44')](handleError(_0x3c00a0,null));};exports[_0x4f9b('0x25')]=function(_0x16717e,_0x57d533){return db[_0x4f9b('0x2b')][_0x4f9b('0x49')]({'where':{'id':_0x16717e[_0x4f9b('0x46')]['id']}})[_0x4f9b('0x24')](handleEntityNotFound(_0x57d533,null))[_0x4f9b('0x24')](removeEntity(_0x57d533,null))['catch'](handleError(_0x57d533,null));}; \ No newline at end of file +var _0x1235=['rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','ServicenowField'];(function(_0x2f4d8f,_0x4aa95c){var _0x556eb7=function(_0x36748f){while(--_0x36748f){_0x2f4d8f['push'](_0x2f4d8f['shift']());}};_0x556eb7(++_0x4aa95c);}(_0x1235,0x68));var _0x5123=function(_0x3f980b,_0x13d156){_0x3f980b=_0x3f980b-0x0;var _0x1fb629=_0x1235[_0x3f980b];return _0x1fb629;};'use strict';var emlformat=require(_0x5123('0x0'));var rimraf=require(_0x5123('0x1'));var zipdir=require(_0x5123('0x2'));var jsonpatch=require(_0x5123('0x3'));var rp=require(_0x5123('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5123('0x5'));var util=require(_0x5123('0x6'));var path=require('path');var sox=require(_0x5123('0x7'));var csv=require(_0x5123('0x8'));var ejs=require(_0x5123('0x9'));var fs=require('fs');var fs_extra=require(_0x5123('0xa'));var _=require(_0x5123('0xb'));var squel=require(_0x5123('0xc'));var crypto=require(_0x5123('0xd'));var jsforce=require(_0x5123('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5123('0x8'));var querystring=require('querystring');var Papa=require(_0x5123('0xf'));var Redis=require(_0x5123('0x10'));var authService=require(_0x5123('0x11'));var qs=require(_0x5123('0x12'));var as=require(_0x5123('0x13'));var hardwareService=require(_0x5123('0x14'));var logger=require(_0x5123('0x15'))(_0x5123('0x16'));var utils=require('../../config/utils');var config=require(_0x5123('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5123('0x18'))['db'];function respondWithStatusCode(_0x45f1a2,_0x6c42d5){_0x6c42d5=_0x6c42d5||0xcc;return function(_0x305579){if(_0x305579){return _0x45f1a2[_0x5123('0x19')](_0x6c42d5);}return _0x45f1a2[_0x5123('0x1a')](_0x6c42d5)[_0x5123('0x1b')]();};}function respondWithResult(_0x4a8772,_0xcf2d06){_0xcf2d06=_0xcf2d06||0xc8;return function(_0x594d6e){if(_0x594d6e){return _0x4a8772[_0x5123('0x1a')](_0xcf2d06)['json'](_0x594d6e);}};}function respondWithFilteredResult(_0x27f316,_0x34925b){return function(_0x193509){if(_0x193509){var _0x4005b9=typeof _0x34925b[_0x5123('0x1c')]===_0x5123('0x1d')&&typeof _0x34925b[_0x5123('0x1e')]===_0x5123('0x1d');var _0x15e6da=_0x193509[_0x5123('0x1f')];var _0x49b61a=_0x4005b9?0x0:_0x34925b['offset'];var _0x221c41=_0x4005b9?_0x193509['count']:_0x34925b['offset']+_0x34925b[_0x5123('0x1e')];var _0x408f33;if(_0x221c41>=_0x15e6da){_0x221c41=_0x15e6da;_0x408f33=0xc8;}else{_0x408f33=0xce;}_0x27f316['status'](_0x408f33);return _0x27f316[_0x5123('0x20')](_0x5123('0x21'),_0x49b61a+'-'+_0x221c41+'/'+_0x15e6da)[_0x5123('0x22')](_0x193509);}return null;};}function patchUpdates(_0x35d5e5){return function(_0x40456d){try{jsonpatch['apply'](_0x40456d,_0x35d5e5,!![]);}catch(_0x3fd5da){return BPromise[_0x5123('0x23')](_0x3fd5da);}return _0x40456d[_0x5123('0x24')]();};}function saveUpdates(_0x2550f5,_0x4a9fb2){return function(_0x24b6cb){if(_0x24b6cb){return _0x24b6cb[_0x5123('0x25')](_0x2550f5)[_0x5123('0x26')](function(_0x286475){return _0x286475;});}return null;};}function removeEntity(_0x4acc58,_0x2cb630){return function(_0x51caa4){if(_0x51caa4){return _0x51caa4[_0x5123('0x27')]()['then'](function(){_0x4acc58[_0x5123('0x1a')](0xcc)[_0x5123('0x1b')]();});}};}function handleEntityNotFound(_0x21f959,_0x52c67b){return function(_0x59fc86){if(!_0x59fc86){_0x21f959[_0x5123('0x19')](0x194);}return _0x59fc86;};}function handleError(_0x12fc56,_0x51e5d5){_0x51e5d5=_0x51e5d5||0x1f4;return function(_0x37fb6a){logger[_0x5123('0x28')](_0x37fb6a['stack']);if(_0x37fb6a[_0x5123('0x29')]){delete _0x37fb6a[_0x5123('0x29')];}_0x12fc56[_0x5123('0x1a')](_0x51e5d5)[_0x5123('0x2a')](_0x37fb6a);};}exports[_0x5123('0x2b')]=function(_0x1507f7,_0xe1f91a){var _0x3f6dfe={},_0x1291ba={},_0x1c5b90={'count':0x0,'rows':[]};var _0x5177ee=_[_0x5123('0x2c')](db[_0x5123('0x2d')][_0x5123('0x2e')],function(_0x5386c5){return{'name':_0x5386c5['fieldName'],'type':_0x5386c5[_0x5123('0x2f')][_0x5123('0x30')]};});_0x1291ba[_0x5123('0x31')]=_[_0x5123('0x2c')](_0x5177ee,'name');_0x1291ba[_0x5123('0x32')]=_['keys'](_0x1507f7[_0x5123('0x32')]);_0x1291ba[_0x5123('0x33')]=_['intersection'](_0x1291ba['model'],_0x1291ba[_0x5123('0x32')]);_0x3f6dfe[_0x5123('0x34')]=_[_0x5123('0x35')](_0x1291ba[_0x5123('0x31')],qs[_0x5123('0x36')](_0x1507f7[_0x5123('0x32')][_0x5123('0x36')]));_0x3f6dfe[_0x5123('0x34')]=_0x3f6dfe[_0x5123('0x34')][_0x5123('0x37')]?_0x3f6dfe['attributes']:_0x1291ba[_0x5123('0x31')];if(!_0x1507f7[_0x5123('0x32')][_0x5123('0x38')](_0x5123('0x39'))){_0x3f6dfe[_0x5123('0x1e')]=qs[_0x5123('0x1e')](_0x1507f7['query'][_0x5123('0x1e')]);_0x3f6dfe[_0x5123('0x1c')]=qs[_0x5123('0x1c')](_0x1507f7[_0x5123('0x32')]['offset']);}_0x3f6dfe[_0x5123('0x3a')]=qs[_0x5123('0x3b')](_0x1507f7['query'][_0x5123('0x3b')]);_0x3f6dfe[_0x5123('0x3c')]=qs[_0x5123('0x33')](_[_0x5123('0x3d')](_0x1507f7['query'],_0x1291ba[_0x5123('0x33')]),_0x5177ee);if(_0x1507f7['query'][_0x5123('0x3e')]){_0x3f6dfe[_0x5123('0x3c')]=_[_0x5123('0x3f')](_0x3f6dfe[_0x5123('0x3c')],{'$or':_[_0x5123('0x2c')](_0x5177ee,function(_0x236b37){if(_0x236b37[_0x5123('0x2f')]!=='VIRTUAL'){var _0x2ebd06={};_0x2ebd06[_0x236b37['name']]={'$like':'%'+_0x1507f7['query'][_0x5123('0x3e')]+'%'};return _0x2ebd06;}})});}_0x3f6dfe=_[_0x5123('0x3f')]({},_0x3f6dfe,_0x1507f7[_0x5123('0x40')]);var _0x55013a={'where':_0x3f6dfe['where']};return db[_0x5123('0x2d')][_0x5123('0x1f')](_0x55013a)[_0x5123('0x26')](function(_0x3e1f6c){_0x1c5b90['count']=_0x3e1f6c;if(_0x1507f7['query'][_0x5123('0x41')]){_0x3f6dfe[_0x5123('0x42')]=[{'all':!![]}];}return db[_0x5123('0x2d')][_0x5123('0x43')](_0x3f6dfe);})['then'](function(_0xf1f526){_0x1c5b90['rows']=_0xf1f526;return _0x1c5b90;})[_0x5123('0x26')](respondWithFilteredResult(_0xe1f91a,_0x3f6dfe))[_0x5123('0x44')](handleError(_0xe1f91a,null));};exports[_0x5123('0x45')]=function(_0x568faa,_0x4b481e){var _0x58295d={'raw':!![],'where':{'id':_0x568faa['params']['id']}},_0x4e55de={};_0x4e55de[_0x5123('0x31')]=_[_0x5123('0x46')](db[_0x5123('0x2d')][_0x5123('0x2e')]);_0x4e55de[_0x5123('0x32')]=_['keys'](_0x568faa[_0x5123('0x32')]);_0x4e55de[_0x5123('0x33')]=_[_0x5123('0x35')](_0x4e55de[_0x5123('0x31')],_0x4e55de[_0x5123('0x32')]);_0x58295d[_0x5123('0x34')]=_[_0x5123('0x35')](_0x4e55de['model'],qs[_0x5123('0x36')](_0x568faa[_0x5123('0x32')]['fields']));_0x58295d[_0x5123('0x34')]=_0x58295d[_0x5123('0x34')][_0x5123('0x37')]?_0x58295d[_0x5123('0x34')]:_0x4e55de[_0x5123('0x31')];if(_0x568faa[_0x5123('0x32')][_0x5123('0x41')]){_0x58295d[_0x5123('0x42')]=[{'all':!![]}];}_0x58295d=_[_0x5123('0x3f')]({},_0x58295d,_0x568faa[_0x5123('0x40')]);return db[_0x5123('0x2d')][_0x5123('0x47')](_0x58295d)['then'](handleEntityNotFound(_0x4b481e,null))[_0x5123('0x26')](respondWithResult(_0x4b481e,null))[_0x5123('0x44')](handleError(_0x4b481e,null));};exports['create']=function(_0x221dbf,_0x4abba5){return db['ServicenowField'][_0x5123('0x48')](_0x221dbf['body'],{})[_0x5123('0x26')](respondWithResult(_0x4abba5,0xc9))['catch'](handleError(_0x4abba5,null));};exports[_0x5123('0x25')]=function(_0x18e6da,_0x48d3db){if(_0x18e6da['body']['id']){delete _0x18e6da[_0x5123('0x49')]['id'];}return db[_0x5123('0x2d')]['find']({'where':{'id':_0x18e6da[_0x5123('0x4a')]['id']}})[_0x5123('0x26')](handleEntityNotFound(_0x48d3db,null))['then'](saveUpdates(_0x18e6da[_0x5123('0x49')],null))['then'](respondWithResult(_0x48d3db,null))[_0x5123('0x44')](handleError(_0x48d3db,null));};exports[_0x5123('0x27')]=function(_0x5b7d24,_0x4631ef){return db[_0x5123('0x2d')][_0x5123('0x47')]({'where':{'id':_0x5b7d24['params']['id']}})[_0x5123('0x26')](handleEntityNotFound(_0x4631ef,null))[_0x5123('0x26')](removeEntity(_0x4631ef,null))[_0x5123('0x44')](handleError(_0x4631ef,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9c4bf80..2c56c15 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 _0xcfea=['bluebird','request-promise','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x59a850,_0x5ea9f5){var _0x1a6a58=function(_0x4496a2){while(--_0x4496a2){_0x59a850['push'](_0x59a850['shift']());}};_0x1a6a58(++_0x5ea9f5);}(_0xcfea,0xa3));var _0xacfe=function(_0x15dcf3,_0x24d0c1){_0x15dcf3=_0x15dcf3-0x0;var _0x4d36a5=_0xcfea[_0x15dcf3];return _0x4d36a5;};'use strict';var _=require(_0xacfe('0x0'));var util=require(_0xacfe('0x1'));var logger=require(_0xacfe('0x2'))(_0xacfe('0x3'));var moment=require(_0xacfe('0x4'));var BPromise=require(_0xacfe('0x5'));var rp=require(_0xacfe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xacfe('0x7'));module[_0xacfe('0x8')]=function(_0x24c79a,_0x18c8b8){return _0x24c79a['define'](_0xacfe('0x9'),attributes,{'tableName':_0xacfe('0xa'),'paranoid':![],'indexes':[{'name':_0xacfe('0xb'),'fields':[_0xacfe('0xc'),_0xacfe('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8de=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f7802,_0x29a4a3){var _0x29b223=function(_0x341e3b){while(--_0x341e3b){_0x2f7802['push'](_0x2f7802['shift']());}};_0x29b223(++_0x29a4a3);}(_0xc8de,0xa7));var _0xec8d=function(_0x584fc7,_0x10d149){_0x584fc7=_0x584fc7-0x0;var _0x50f21e=_0xc8de[_0x584fc7];return _0x50f21e;};'use strict';var _=require(_0xec8d('0x0'));var util=require(_0xec8d('0x1'));var logger=require(_0xec8d('0x2'))('api');var moment=require(_0xec8d('0x3'));var BPromise=require(_0xec8d('0x4'));var rp=require(_0xec8d('0x5'));var fs=require('fs');var path=require(_0xec8d('0x6'));var rimraf=require(_0xec8d('0x7'));var config=require(_0xec8d('0x8'));var attributes=require(_0xec8d('0x9'));module[_0xec8d('0xa')]=function(_0x347303,_0x379b82){return _0x347303[_0xec8d('0xb')](_0xec8d('0xc'),attributes,{'tableName':_0xec8d('0xd'),'paranoid':![],'indexes':[{'name':_0xec8d('0xe'),'fields':[_0xec8d('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 7c788e6..3f95b5e 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 _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(_0x59cb45,_0x29f0b2){var _0x2c97d3=function(_0x328a70){while(--_0x328a70){_0x59cb45['push'](_0x59cb45['shift']());}};_0x2c97d3(++_0x29f0b2);}(_0xb43b,0x1b2));var _0xbb43=function(_0x17e47d,_0x5cbb5d){_0x17e47d=_0x17e47d-0x0;var _0x1a237b=_0xb43b[_0x17e47d];return _0x1a237b;};'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 +var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x312aba,_0x2544f4){var _0x577f9f=function(_0x979593){while(--_0x979593){_0x312aba['push'](_0x312aba['shift']());}};_0x577f9f(++_0x2544f4);}(_0xe706,0xa3));var _0x6e70=function(_0x362733,_0x46e9fa){_0x362733=_0x362733-0x0;var _0x4fccca=_0xe706[_0x362733];return _0x4fccca;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index db9692f..6daa3fa 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3d97af,_0x199077){var _0x26aaf9=function(_0x180c38){while(--_0x180c38){_0x3d97af['push'](_0x3d97af['shift']());}};_0x26aaf9(++_0x199077);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _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(_0x19d67c,_0x182270){var _0x3aafad=function(_0x5298bd){while(--_0x5298bd){_0x19d67c['push'](_0x19d67c['shift']());}};_0x3aafad(++_0x182270);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 7be133b..a9feb35 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(_0xd3160c,_0x2a4dda){var _0xc5dc46=function(_0xcaf0a5){while(--_0xcaf0a5){_0xd3160c['push'](_0xd3160c['shift']());}};_0xc5dc46(++_0x2a4dda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x276b4f,_0x267edd){var _0x422784=function(_0x558892){while(--_0x558892){_0x276b4f['push'](_0x276b4f['shift']());}};_0x422784(++_0x267edd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 ef32939..4ff0e07 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 _0x7067=['status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','channel','Descriptions','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove','includes','label','endsWith','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x4eabb7,_0x546626){var _0x1cedae=function(_0x4a01ab){while(--_0x4a01ab){_0x4eabb7['push'](_0x4eabb7['shift']());}};_0x1cedae(++_0x546626);}(_0x7067,0x14e));var _0x7706=function(_0x23d109,_0x31653a){_0x23d109=_0x23d109-0x0;var _0x3cf198=_0x7067[_0x23d109];return _0x3cf198;};'use strict';var emlformat=require(_0x7706('0x0'));var rimraf=require(_0x7706('0x1'));var zipdir=require(_0x7706('0x2'));var jsonpatch=require(_0x7706('0x3'));var rp=require(_0x7706('0x4'));var moment=require('moment');var BPromise=require(_0x7706('0x5'));var Mustache=require(_0x7706('0x6'));var util=require(_0x7706('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7706('0x8'));var ejs=require(_0x7706('0x9'));var fs=require('fs');var fs_extra=require(_0x7706('0xa'));var _=require(_0x7706('0xb'));var squel=require(_0x7706('0xc'));var crypto=require(_0x7706('0xd'));var jsforce=require(_0x7706('0xe'));var deskjs=require(_0x7706('0xf'));var toCsv=require(_0x7706('0x8'));var querystring=require('querystring');var Papa=require(_0x7706('0x10'));var Redis=require(_0x7706('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7706('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7706('0x13'));var logger=require(_0x7706('0x14'))(_0x7706('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7706('0x16'));var db=require(_0x7706('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5796c4,_0xf7574f){_0xf7574f=_0xf7574f||0xcc;return function(_0x3d8991){if(_0x3d8991){return _0x5796c4[_0x7706('0x18')](_0xf7574f);}return _0x5796c4['status'](_0xf7574f)[_0x7706('0x19')]();};}function respondWithResult(_0x41f162,_0x29959a){_0x29959a=_0x29959a||0xc8;return function(_0x170571){if(_0x170571){return _0x41f162[_0x7706('0x1a')](_0x29959a)[_0x7706('0x1b')](_0x170571);}};}function respondWithFilteredResult(_0x2660e5,_0x45f697){return function(_0x4d5e69){if(_0x4d5e69){var _0x4c42f9=typeof _0x45f697[_0x7706('0x1c')]===_0x7706('0x1d')&&typeof _0x45f697[_0x7706('0x1e')]===_0x7706('0x1d');var _0x45cb42=_0x4d5e69[_0x7706('0x1f')];var _0x257e97=_0x4c42f9?0x0:_0x45f697['offset'];var _0x2bb311=_0x4c42f9?_0x4d5e69['count']:_0x45f697[_0x7706('0x1c')]+_0x45f697['limit'];var _0x214ded;if(_0x2bb311>=_0x45cb42){_0x2bb311=_0x45cb42;_0x214ded=0xc8;}else{_0x214ded=0xce;}_0x2660e5[_0x7706('0x1a')](_0x214ded);return _0x2660e5['set'](_0x7706('0x20'),_0x257e97+'-'+_0x2bb311+'/'+_0x45cb42)[_0x7706('0x1b')](_0x4d5e69);}return null;};}function patchUpdates(_0x49553a){return function(_0x29fb22){try{jsonpatch[_0x7706('0x21')](_0x29fb22,_0x49553a,!![]);}catch(_0x25b9db){return BPromise['reject'](_0x25b9db);}return _0x29fb22[_0x7706('0x22')]();};}function saveUpdates(_0x16eab4,_0x3561aa){return function(_0x1f3411){if(_0x1f3411){return _0x1f3411[_0x7706('0x23')](_0x16eab4)[_0x7706('0x24')](function(_0x4648f1){return _0x4648f1;});}return null;};}function removeEntity(_0x484b51,_0x394ece){return function(_0x2d97b3){if(_0x2d97b3){return _0x2d97b3[_0x7706('0x25')]()[_0x7706('0x24')](function(){_0x484b51[_0x7706('0x1a')](0xcc)[_0x7706('0x19')]();});}};}function handleEntityNotFound(_0xf18ccb,_0x105594){return function(_0x13766b){if(!_0x13766b){_0xf18ccb[_0x7706('0x18')](0x194);}return _0x13766b;};}function handleError(_0x26bf9e,_0x2c64cb){_0x2c64cb=_0x2c64cb||0x1f4;return function(_0x51c89a){logger[_0x7706('0x26')](_0x51c89a[_0x7706('0x27')]);if(_0x51c89a[_0x7706('0x28')]){delete _0x51c89a[_0x7706('0x28')];}_0x26bf9e[_0x7706('0x1a')](_0x2c64cb)[_0x7706('0x29')](_0x51c89a);};}exports[_0x7706('0x2a')]=function(_0x5795b4,_0x300d66){var _0x2eb452={},_0x3d1c9f={},_0x2924db={'count':0x0,'rows':[]};var _0x2218b8=_[_0x7706('0x2b')](db[_0x7706('0x2c')]['rawAttributes'],function(_0x57aa12){return{'name':_0x57aa12[_0x7706('0x2d')],'type':_0x57aa12['type'][_0x7706('0x2e')]};});_0x3d1c9f[_0x7706('0x2f')]=_[_0x7706('0x2b')](_0x2218b8,_0x7706('0x28'));_0x3d1c9f[_0x7706('0x30')]=_[_0x7706('0x31')](_0x5795b4[_0x7706('0x30')]);_0x3d1c9f[_0x7706('0x32')]=_['intersection'](_0x3d1c9f[_0x7706('0x2f')],_0x3d1c9f[_0x7706('0x30')]);_0x2eb452['attributes']=_[_0x7706('0x33')](_0x3d1c9f[_0x7706('0x2f')],qs[_0x7706('0x34')](_0x5795b4[_0x7706('0x30')]['fields']));_0x2eb452[_0x7706('0x35')]=_0x2eb452[_0x7706('0x35')][_0x7706('0x36')]?_0x2eb452['attributes']:_0x3d1c9f['model'];if(!_0x5795b4[_0x7706('0x30')][_0x7706('0x37')](_0x7706('0x38'))){_0x2eb452['limit']=qs['limit'](_0x5795b4[_0x7706('0x30')]['limit']);_0x2eb452[_0x7706('0x1c')]=qs[_0x7706('0x1c')](_0x5795b4[_0x7706('0x30')][_0x7706('0x1c')]);}_0x2eb452['order']=qs[_0x7706('0x39')](_0x5795b4['query']['sort']);_0x2eb452[_0x7706('0x3a')]=qs[_0x7706('0x32')](_[_0x7706('0x3b')](_0x5795b4[_0x7706('0x30')],_0x3d1c9f['filters']),_0x2218b8);if(_0x5795b4[_0x7706('0x30')]['filter']){_0x2eb452[_0x7706('0x3a')]=_[_0x7706('0x3c')](_0x2eb452['where'],{'$or':_[_0x7706('0x2b')](_0x2218b8,function(_0x40b7d4){if(_0x40b7d4[_0x7706('0x3d')]!==_0x7706('0x3e')){var _0x5b0a01={};_0x5b0a01[_0x40b7d4[_0x7706('0x28')]]={'$like':'%'+_0x5795b4[_0x7706('0x30')]['filter']+'%'};return _0x5b0a01;}})});}_0x2eb452=_[_0x7706('0x3c')]({},_0x2eb452,_0x5795b4[_0x7706('0x3f')]);var _0x27c24f={'where':_0x2eb452[_0x7706('0x3a')]};return db[_0x7706('0x2c')][_0x7706('0x1f')](_0x27c24f)[_0x7706('0x24')](function(_0x1ddc68){_0x2924db['count']=_0x1ddc68;if(_0x5795b4['query'][_0x7706('0x40')]){_0x2eb452[_0x7706('0x41')]=[{'all':!![]}];}return db[_0x7706('0x2c')][_0x7706('0x42')](_0x2eb452);})[_0x7706('0x24')](function(_0x420389){_0x2924db['rows']=_0x420389;return _0x2924db;})[_0x7706('0x24')](respondWithFilteredResult(_0x300d66,_0x2eb452))[_0x7706('0x43')](handleError(_0x300d66,null));};exports[_0x7706('0x44')]=function(_0x13c57e,_0x3ed077){var _0x3878c4={'raw':![],'where':{'id':_0x13c57e[_0x7706('0x45')]['id']}},_0x1650bd={};_0x1650bd[_0x7706('0x2f')]=_[_0x7706('0x31')](db[_0x7706('0x2c')][_0x7706('0x46')]);_0x1650bd['query']=_[_0x7706('0x31')](_0x13c57e[_0x7706('0x30')]);_0x1650bd['filters']=_['intersection'](_0x1650bd[_0x7706('0x2f')],_0x1650bd['query']);_0x3878c4[_0x7706('0x35')]=_[_0x7706('0x33')](_0x1650bd['model'],qs[_0x7706('0x34')](_0x13c57e['query']['fields']));_0x3878c4[_0x7706('0x35')]=_0x3878c4[_0x7706('0x35')]['length']?_0x3878c4[_0x7706('0x35')]:_0x1650bd[_0x7706('0x2f')];if(_0x13c57e[_0x7706('0x30')][_0x7706('0x40')]){_0x3878c4[_0x7706('0x41')]=[{'all':!![]}];}_0x3878c4=_[_0x7706('0x3c')]({},_0x3878c4,_0x13c57e[_0x7706('0x3f')]);return db[_0x7706('0x2c')][_0x7706('0x47')](_0x3878c4)[_0x7706('0x24')](handleEntityNotFound(_0x3ed077,null))['then'](respondWithResult(_0x3ed077,null))[_0x7706('0x43')](handleError(_0x3ed077,null));};exports[_0x7706('0x48')]=function(_0x2c05a1,_0x32a74e){return db[_0x7706('0x2c')][_0x7706('0x48')](_0x2c05a1['body'],{})[_0x7706('0x24')](respondWithResult(_0x32a74e,0xc9))[_0x7706('0x43')](handleError(_0x32a74e,null));};exports[_0x7706('0x23')]=function(_0x17a46c,_0x296b93){if(_0x17a46c[_0x7706('0x49')]['id']){delete _0x17a46c[_0x7706('0x49')]['id'];}return db[_0x7706('0x2c')]['find']({'where':{'id':_0x17a46c[_0x7706('0x45')]['id']}})[_0x7706('0x24')](handleEntityNotFound(_0x296b93,null))[_0x7706('0x24')](saveUpdates(_0x17a46c[_0x7706('0x49')],null))['then'](respondWithResult(_0x296b93,null))['catch'](handleError(_0x296b93,null));};exports[_0x7706('0x25')]=function(_0x2efb60,_0x58637f){return db[_0x7706('0x2c')][_0x7706('0x47')]({'where':{'id':_0x2efb60[_0x7706('0x45')]['id']}})[_0x7706('0x24')](handleEntityNotFound(_0x58637f,null))[_0x7706('0x24')](removeEntity(_0x58637f,null))[_0x7706('0x43')](handleError(_0x58637f,null));};exports[_0x7706('0x4a')]=function(_0x1c01ce,_0x1a245a,_0x1c7827){var _0x8ac50d={};var _0x466e99={};var _0x241941;var _0xac4188;return db['SugarcrmAccount'][_0x7706('0x4b')]({'where':{'id':_0x1c01ce[_0x7706('0x45')]['id']}})[_0x7706('0x24')](handleEntityNotFound(_0x1a245a,null))[_0x7706('0x24')](function(_0x434efc){if(_0x434efc){_0x241941=_0x434efc;_0x466e99[_0x7706('0x2f')]=_[_0x7706('0x31')](db[_0x7706('0x4c')][_0x7706('0x46')]);_0x466e99[_0x7706('0x30')]=_[_0x7706('0x31')](_0x1c01ce[_0x7706('0x30')]);_0x466e99[_0x7706('0x32')]=_[_0x7706('0x33')](_0x466e99[_0x7706('0x2f')],_0x466e99['query']);_0x8ac50d['attributes']=_[_0x7706('0x33')](_0x466e99[_0x7706('0x2f')],qs[_0x7706('0x34')](_0x1c01ce['query'][_0x7706('0x34')]));_0x8ac50d['attributes']=_0x8ac50d['attributes'][_0x7706('0x36')]?_0x8ac50d[_0x7706('0x35')]:_0x466e99[_0x7706('0x2f')];_0x8ac50d['order']=qs[_0x7706('0x39')](_0x1c01ce[_0x7706('0x30')]['sort']);_0x8ac50d[_0x7706('0x3a')]=qs[_0x7706('0x32')](_[_0x7706('0x3b')](_0x1c01ce[_0x7706('0x30')],_0x466e99['filters']));if(_0x1c01ce[_0x7706('0x30')]['filter']){_0x8ac50d[_0x7706('0x3a')]=_[_0x7706('0x3c')](_0x8ac50d[_0x7706('0x3a')],{'$or':_['map'](_0x8ac50d['attributes'],function(_0x2c6434){var _0x61b531={};_0x61b531[_0x2c6434]={'$like':'%'+_0x1c01ce[_0x7706('0x30')]['filter']+'%'};return _0x61b531;})});}_0x8ac50d=_[_0x7706('0x3c')]({},_0x8ac50d,_0x1c01ce['options']);return _0x241941[_0x7706('0x4a')](_0x8ac50d);}})['then'](function(_0x9ea9c5){if(_0x9ea9c5){_0xac4188=_0x9ea9c5['length'];if(!_0x1c01ce['query'][_0x7706('0x37')]('nolimit')){_0x8ac50d[_0x7706('0x1e')]=qs[_0x7706('0x1e')](_0x1c01ce[_0x7706('0x30')]['limit']);_0x8ac50d[_0x7706('0x1c')]=qs['offset'](_0x1c01ce[_0x7706('0x30')][_0x7706('0x1c')]);}return _0x241941[_0x7706('0x4a')](_0x8ac50d);}})[_0x7706('0x24')](function(_0x15a5d1){if(_0x15a5d1){return _0x15a5d1?{'count':_0xac4188,'rows':_0x15a5d1}:null;}})[_0x7706('0x24')](respondWithResult(_0x1a245a,null))['catch'](handleError(_0x1a245a,null));};exports['addConfiguration']=function(_0x17b10b,_0x1c0357,_0x19f6f9){if(_0x17b10b['body']['id']){delete _0x17b10b[_0x7706('0x49')]['id'];}return db[_0x7706('0x2c')][_0x7706('0x4b')]({'where':{'id':_0x17b10b['params']['id']}})['then'](handleEntityNotFound(_0x1c0357,null))[_0x7706('0x24')](function(_0x2f8d92){if(_0x2f8d92){_0x17b10b[_0x7706('0x49')][_0x7706('0x4d')]=_0x2f8d92['id'];_0x17b10b[_0x7706('0x49')][_0x7706('0x4e')]=integrations['getSubjects'](_0x17b10b['body'][_0x7706('0x4f')],_0x17b10b['body']['type']);_0x17b10b[_0x7706('0x49')][_0x7706('0x50')]=integrations['getDescriptions'](_0x17b10b[_0x7706('0x49')]['channel'],_0x17b10b['body'][_0x7706('0x3d')]);return db[_0x7706('0x4c')]['create'](_0x17b10b[_0x7706('0x49')],{'include':[{'model':db[_0x7706('0x51')],'as':_0x7706('0x4e')},{'model':db[_0x7706('0x51')],'as':_0x7706('0x50')}]});}return null;})['then'](respondWithResult(_0x1c0357,null))['catch'](handleError(_0x1c0357,null));};exports[_0x7706('0x52')]=function(_0x5d2821,_0x3051c6,_0x36caae){var _0x28d426='';var _0xb2f62f=['id',_0x7706('0x28'),'assigned_user_id',_0x7706('0x53'),_0x7706('0x54'),_0x7706('0x55'),_0x7706('0x56'),_0x7706('0x57'),'parent_id',_0x7706('0x58'),_0x7706('0x59'),_0x7706('0x5a')];return db[_0x7706('0x2c')][_0x7706('0x4b')]({'where':{'id':_0x5d2821['params']['id']},'attributes':['id',_0x7706('0x5b'),_0x7706('0x5c'),_0x7706('0x5d')]})[_0x7706('0x24')](handleEntityNotFound(_0x3051c6,null))[_0x7706('0x24')](function(_0x34711f){if(_0x34711f){_0x28d426=_0x34711f[_0x7706('0x5d')];var _0x19bb6f=_0x28d426[_0x7706('0x5e')](-0x1);if(_0x19bb6f==='/'){_0x28d426=_0x28d426[_0x7706('0x5f')](0x0,_0x28d426[_0x7706('0x60')](_0x19bb6f));}return rp({'method':_0x7706('0x61'),'uri':util[_0x7706('0x62')](_0x7706('0x63'),_0x28d426,_0x7706('0x64')),'json':!![],'form':{'method':_0x7706('0x65'),'input_type':_0x7706('0x66'),'response_type':_0x7706('0x66'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x34711f[_0x7706('0x5b')],'password':_0x34711f['password'],'encryption':_0x7706('0x67')},'application':_0x7706('0x68')})}});}})[_0x7706('0x24')](function(_0x442652){if(_0x442652&&_0x442652[_0x7706('0x28')]!==_0x7706('0x69')&&_0x442652[_0x7706('0x28')]!==_0x7706('0x6a')){return rp({'method':_0x7706('0x61'),'uri':util[_0x7706('0x62')](_0x7706('0x63'),_0x28d426,_0x7706('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x442652['id'],'module_name':_0x7706('0x6b')})}})[_0x7706('0x24')](function(_0x2fe908){if(_0x2fe908){var _0x579414=_['values'](_0x2fe908[_0x7706('0x6c')]);_[_0x7706('0x6d')](_0x579414,function(_0xa9d140){return _0xb2f62f[_0x7706('0x6e')](_0xa9d140['name']);});return{'count':_0x579414[_0x7706('0x36')],'rows':_['map'](_0x579414,function(_0x5810d5){return{'id':_0x5810d5[_0x7706('0x28')],'name':_0x5810d5[_0x7706('0x6f')],'custom':_[_0x7706('0x70')](_0x5810d5['name'],'_c')?!![]:![],'options':_0x5810d5[_0x7706('0x3f')]?_['map'](_[_0x7706('0x71')](_0x5810d5[_0x7706('0x3f')]),function(_0x2dbba5){return{'name':_0x2dbba5[_0x7706('0x72')],'value':_0x2dbba5['name']};}):[]};})};}})[_0x7706('0x24')](respondWithResult(_0x3051c6,null))[_0x7706('0x43')](function(_0x4c7e47){var _0x303ccf=_0x5d2821['query']['test']?0x1f4:_0x4c7e47[_0x7706('0x73')]||0x1f4;logger[_0x7706('0x26')](_0x7706('0x74'),_0x7706('0x52'),_0x303ccf,JSON[_0x7706('0x75')](_0x4c7e47));delete _0x4c7e47[_0x7706('0x28')];if(_0x303ccf===0x191){_0x303ccf=0x190;}_0x3051c6[_0x7706('0x1a')](_0x303ccf)[_0x7706('0x29')](_0x5d2821['query'][_0x7706('0x76')]?{'message':_0x7706('0x77'),'statusCode':_0x4c7e47[_0x7706('0x73')]}:_0x4c7e47);});}else{var _0x8c8fa2=0x1f4;_0x3051c6[_0x7706('0x1a')](_0x8c8fa2)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x5d31=['sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','remove','includes','endsWith','value','test','error','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','status','name','send','index','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x9fd126,_0x52ce45){var _0x1eaa5c=function(_0x177576){while(--_0x177576){_0x9fd126['push'](_0x9fd126['shift']());}};_0x1eaa5c(++_0x52ce45);}(_0x5d31,0xb7));var _0x15d3=function(_0x282530,_0x5a31b2){_0x282530=_0x282530-0x0;var _0x266c57=_0x5d31[_0x282530];return _0x266c57;};'use strict';var emlformat=require(_0x15d3('0x0'));var rimraf=require(_0x15d3('0x1'));var zipdir=require(_0x15d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15d3('0x3'));var moment=require(_0x15d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x15d3('0x5'));var util=require('util');var path=require('path');var sox=require(_0x15d3('0x6'));var csv=require(_0x15d3('0x7'));var ejs=require(_0x15d3('0x8'));var fs=require('fs');var fs_extra=require(_0x15d3('0x9'));var _=require(_0x15d3('0xa'));var squel=require(_0x15d3('0xb'));var crypto=require('crypto');var jsforce=require(_0x15d3('0xc'));var deskjs=require(_0x15d3('0xd'));var toCsv=require(_0x15d3('0x7'));var querystring=require('querystring');var Papa=require(_0x15d3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x15d3('0xf'));var as=require(_0x15d3('0x10'));var hardwareService=require(_0x15d3('0x11'));var logger=require(_0x15d3('0x12'))(_0x15d3('0x13'));var utils=require(_0x15d3('0x14'));var config=require(_0x15d3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x15d3('0x16'))['db'];var integrations=require(_0x15d3('0x17'));function respondWithStatusCode(_0x2b4409,_0x3721fc){_0x3721fc=_0x3721fc||0xcc;return function(_0x3cd0e3){if(_0x3cd0e3){return _0x2b4409[_0x15d3('0x18')](_0x3721fc);}return _0x2b4409['status'](_0x3721fc)[_0x15d3('0x19')]();};}function respondWithResult(_0x3ce80d,_0x466f82){_0x466f82=_0x466f82||0xc8;return function(_0x4b2f4a){if(_0x4b2f4a){return _0x3ce80d['status'](_0x466f82)[_0x15d3('0x1a')](_0x4b2f4a);}};}function respondWithFilteredResult(_0x5aa531,_0x514875){return function(_0xcbfd71){if(_0xcbfd71){var _0x382154=typeof _0x514875[_0x15d3('0x1b')]==='undefined'&&typeof _0x514875[_0x15d3('0x1c')]===_0x15d3('0x1d');var _0x25a67e=_0xcbfd71[_0x15d3('0x1e')];var _0x389bd5=_0x382154?0x0:_0x514875[_0x15d3('0x1b')];var _0xc3474d=_0x382154?_0xcbfd71['count']:_0x514875[_0x15d3('0x1b')]+_0x514875[_0x15d3('0x1c')];var _0x4146a2;if(_0xc3474d>=_0x25a67e){_0xc3474d=_0x25a67e;_0x4146a2=0xc8;}else{_0x4146a2=0xce;}_0x5aa531['status'](_0x4146a2);return _0x5aa531['set'](_0x15d3('0x1f'),_0x389bd5+'-'+_0xc3474d+'/'+_0x25a67e)[_0x15d3('0x1a')](_0xcbfd71);}return null;};}function patchUpdates(_0x1d251e){return function(_0x3d4f31){try{jsonpatch[_0x15d3('0x20')](_0x3d4f31,_0x1d251e,!![]);}catch(_0x57b3ec){return BPromise['reject'](_0x57b3ec);}return _0x3d4f31[_0x15d3('0x21')]();};}function saveUpdates(_0x7c9603,_0x28af7b){return function(_0x445192){if(_0x445192){return _0x445192['update'](_0x7c9603)[_0x15d3('0x22')](function(_0x9eb2b5){return _0x9eb2b5;});}return null;};}function removeEntity(_0x10ae1b,_0x5178e1){return function(_0x1e3fd9){if(_0x1e3fd9){return _0x1e3fd9[_0x15d3('0x23')]()[_0x15d3('0x22')](function(){_0x10ae1b[_0x15d3('0x24')](0xcc)[_0x15d3('0x19')]();});}};}function handleEntityNotFound(_0x6baf8c,_0x2a3e77){return function(_0x43351a){if(!_0x43351a){_0x6baf8c['sendStatus'](0x194);}return _0x43351a;};}function handleError(_0x5d939c,_0x4ee291){_0x4ee291=_0x4ee291||0x1f4;return function(_0x3c2d05){logger['error'](_0x3c2d05['stack']);if(_0x3c2d05[_0x15d3('0x25')]){delete _0x3c2d05['name'];}_0x5d939c[_0x15d3('0x24')](_0x4ee291)[_0x15d3('0x26')](_0x3c2d05);};}exports[_0x15d3('0x27')]=function(_0x4a4505,_0x181f56){var _0x2f39bb={},_0x590646={},_0x3ee31e={'count':0x0,'rows':[]};var _0x26329f=_['map'](db[_0x15d3('0x28')][_0x15d3('0x29')],function(_0x41e76a){return{'name':_0x41e76a['fieldName'],'type':_0x41e76a[_0x15d3('0x2a')][_0x15d3('0x2b')]};});_0x590646[_0x15d3('0x2c')]=_['map'](_0x26329f,_0x15d3('0x25'));_0x590646[_0x15d3('0x2d')]=_[_0x15d3('0x2e')](_0x4a4505[_0x15d3('0x2d')]);_0x590646[_0x15d3('0x2f')]=_[_0x15d3('0x30')](_0x590646['model'],_0x590646[_0x15d3('0x2d')]);_0x2f39bb[_0x15d3('0x31')]=_['intersection'](_0x590646[_0x15d3('0x2c')],qs[_0x15d3('0x32')](_0x4a4505[_0x15d3('0x2d')][_0x15d3('0x32')]));_0x2f39bb[_0x15d3('0x31')]=_0x2f39bb['attributes'][_0x15d3('0x33')]?_0x2f39bb[_0x15d3('0x31')]:_0x590646[_0x15d3('0x2c')];if(!_0x4a4505[_0x15d3('0x2d')][_0x15d3('0x34')]('nolimit')){_0x2f39bb[_0x15d3('0x1c')]=qs[_0x15d3('0x1c')](_0x4a4505[_0x15d3('0x2d')][_0x15d3('0x1c')]);_0x2f39bb[_0x15d3('0x1b')]=qs[_0x15d3('0x1b')](_0x4a4505['query'][_0x15d3('0x1b')]);}_0x2f39bb['order']=qs[_0x15d3('0x35')](_0x4a4505[_0x15d3('0x2d')][_0x15d3('0x35')]);_0x2f39bb[_0x15d3('0x36')]=qs[_0x15d3('0x2f')](_[_0x15d3('0x37')](_0x4a4505[_0x15d3('0x2d')],_0x590646[_0x15d3('0x2f')]),_0x26329f);if(_0x4a4505[_0x15d3('0x2d')][_0x15d3('0x38')]){_0x2f39bb['where']=_['merge'](_0x2f39bb[_0x15d3('0x36')],{'$or':_[_0x15d3('0x39')](_0x26329f,function(_0x4f544f){if(_0x4f544f[_0x15d3('0x2a')]!==_0x15d3('0x3a')){var _0x229911={};_0x229911[_0x4f544f[_0x15d3('0x25')]]={'$like':'%'+_0x4a4505['query'][_0x15d3('0x38')]+'%'};return _0x229911;}})});}_0x2f39bb=_[_0x15d3('0x3b')]({},_0x2f39bb,_0x4a4505[_0x15d3('0x3c')]);var _0x2b1213={'where':_0x2f39bb[_0x15d3('0x36')]};return db[_0x15d3('0x28')][_0x15d3('0x1e')](_0x2b1213)[_0x15d3('0x22')](function(_0x4e6bda){_0x3ee31e[_0x15d3('0x1e')]=_0x4e6bda;if(_0x4a4505[_0x15d3('0x2d')][_0x15d3('0x3d')]){_0x2f39bb[_0x15d3('0x3e')]=[{'all':!![]}];}return db[_0x15d3('0x28')]['findAll'](_0x2f39bb);})[_0x15d3('0x22')](function(_0x33a296){_0x3ee31e[_0x15d3('0x3f')]=_0x33a296;return _0x3ee31e;})[_0x15d3('0x22')](respondWithFilteredResult(_0x181f56,_0x2f39bb))[_0x15d3('0x40')](handleError(_0x181f56,null));};exports['show']=function(_0x46ed30,_0x1437dc){var _0x409ebb={'raw':![],'where':{'id':_0x46ed30[_0x15d3('0x41')]['id']}},_0x3d02c2={};_0x3d02c2[_0x15d3('0x2c')]=_[_0x15d3('0x2e')](db['SugarcrmAccount'][_0x15d3('0x29')]);_0x3d02c2[_0x15d3('0x2d')]=_[_0x15d3('0x2e')](_0x46ed30[_0x15d3('0x2d')]);_0x3d02c2[_0x15d3('0x2f')]=_[_0x15d3('0x30')](_0x3d02c2['model'],_0x3d02c2[_0x15d3('0x2d')]);_0x409ebb['attributes']=_[_0x15d3('0x30')](_0x3d02c2['model'],qs['fields'](_0x46ed30[_0x15d3('0x2d')][_0x15d3('0x32')]));_0x409ebb[_0x15d3('0x31')]=_0x409ebb['attributes'][_0x15d3('0x33')]?_0x409ebb[_0x15d3('0x31')]:_0x3d02c2[_0x15d3('0x2c')];if(_0x46ed30[_0x15d3('0x2d')][_0x15d3('0x3d')]){_0x409ebb['include']=[{'all':!![]}];}_0x409ebb=_[_0x15d3('0x3b')]({},_0x409ebb,_0x46ed30[_0x15d3('0x3c')]);return db[_0x15d3('0x28')][_0x15d3('0x42')](_0x409ebb)[_0x15d3('0x22')](handleEntityNotFound(_0x1437dc,null))['then'](respondWithResult(_0x1437dc,null))[_0x15d3('0x40')](handleError(_0x1437dc,null));};exports[_0x15d3('0x43')]=function(_0x2b66f0,_0x397966){return db[_0x15d3('0x28')]['create'](_0x2b66f0[_0x15d3('0x44')],{})[_0x15d3('0x22')](respondWithResult(_0x397966,0xc9))[_0x15d3('0x40')](handleError(_0x397966,null));};exports[_0x15d3('0x45')]=function(_0x1105fa,_0x366fe5){if(_0x1105fa[_0x15d3('0x44')]['id']){delete _0x1105fa[_0x15d3('0x44')]['id'];}return db[_0x15d3('0x28')][_0x15d3('0x42')]({'where':{'id':_0x1105fa[_0x15d3('0x41')]['id']}})[_0x15d3('0x22')](handleEntityNotFound(_0x366fe5,null))[_0x15d3('0x22')](saveUpdates(_0x1105fa[_0x15d3('0x44')],null))[_0x15d3('0x22')](respondWithResult(_0x366fe5,null))[_0x15d3('0x40')](handleError(_0x366fe5,null));};exports[_0x15d3('0x23')]=function(_0x126c56,_0x1c8546){return db[_0x15d3('0x28')]['find']({'where':{'id':_0x126c56['params']['id']}})[_0x15d3('0x22')](handleEntityNotFound(_0x1c8546,null))[_0x15d3('0x22')](removeEntity(_0x1c8546,null))['catch'](handleError(_0x1c8546,null));};exports[_0x15d3('0x46')]=function(_0x3042a,_0x5ebba6,_0x2099c2){var _0x5e3732={};var _0x294275={};var _0xf08cd0;var _0x4b08f7;return db[_0x15d3('0x28')][_0x15d3('0x47')]({'where':{'id':_0x3042a['params']['id']}})['then'](handleEntityNotFound(_0x5ebba6,null))[_0x15d3('0x22')](function(_0x27d907){if(_0x27d907){_0xf08cd0=_0x27d907;_0x294275['model']=_[_0x15d3('0x2e')](db[_0x15d3('0x48')]['rawAttributes']);_0x294275[_0x15d3('0x2d')]=_[_0x15d3('0x2e')](_0x3042a['query']);_0x294275[_0x15d3('0x2f')]=_[_0x15d3('0x30')](_0x294275[_0x15d3('0x2c')],_0x294275[_0x15d3('0x2d')]);_0x5e3732[_0x15d3('0x31')]=_['intersection'](_0x294275[_0x15d3('0x2c')],qs[_0x15d3('0x32')](_0x3042a[_0x15d3('0x2d')][_0x15d3('0x32')]));_0x5e3732['attributes']=_0x5e3732[_0x15d3('0x31')][_0x15d3('0x33')]?_0x5e3732[_0x15d3('0x31')]:_0x294275[_0x15d3('0x2c')];_0x5e3732['order']=qs[_0x15d3('0x35')](_0x3042a[_0x15d3('0x2d')]['sort']);_0x5e3732[_0x15d3('0x36')]=qs[_0x15d3('0x2f')](_[_0x15d3('0x37')](_0x3042a[_0x15d3('0x2d')],_0x294275['filters']));if(_0x3042a[_0x15d3('0x2d')][_0x15d3('0x38')]){_0x5e3732[_0x15d3('0x36')]=_[_0x15d3('0x3b')](_0x5e3732[_0x15d3('0x36')],{'$or':_['map'](_0x5e3732[_0x15d3('0x31')],function(_0x5315f8){var _0x288886={};_0x288886[_0x5315f8]={'$like':'%'+_0x3042a['query'][_0x15d3('0x38')]+'%'};return _0x288886;})});}_0x5e3732=_[_0x15d3('0x3b')]({},_0x5e3732,_0x3042a[_0x15d3('0x3c')]);return _0xf08cd0[_0x15d3('0x46')](_0x5e3732);}})[_0x15d3('0x22')](function(_0x332960){if(_0x332960){_0x4b08f7=_0x332960[_0x15d3('0x33')];if(!_0x3042a[_0x15d3('0x2d')][_0x15d3('0x34')](_0x15d3('0x49'))){_0x5e3732[_0x15d3('0x1c')]=qs[_0x15d3('0x1c')](_0x3042a[_0x15d3('0x2d')][_0x15d3('0x1c')]);_0x5e3732[_0x15d3('0x1b')]=qs[_0x15d3('0x1b')](_0x3042a[_0x15d3('0x2d')]['offset']);}return _0xf08cd0[_0x15d3('0x46')](_0x5e3732);}})[_0x15d3('0x22')](function(_0x7f4777){if(_0x7f4777){return _0x7f4777?{'count':_0x4b08f7,'rows':_0x7f4777}:null;}})[_0x15d3('0x22')](respondWithResult(_0x5ebba6,null))['catch'](handleError(_0x5ebba6,null));};exports[_0x15d3('0x4a')]=function(_0x2997b1,_0x7a025b,_0x263462){if(_0x2997b1[_0x15d3('0x44')]['id']){delete _0x2997b1['body']['id'];}return db[_0x15d3('0x28')][_0x15d3('0x47')]({'where':{'id':_0x2997b1[_0x15d3('0x41')]['id']}})['then'](handleEntityNotFound(_0x7a025b,null))[_0x15d3('0x22')](function(_0x332bb4){if(_0x332bb4){_0x2997b1['body'][_0x15d3('0x4b')]=_0x332bb4['id'];_0x2997b1[_0x15d3('0x44')][_0x15d3('0x4c')]=integrations[_0x15d3('0x4d')](_0x2997b1[_0x15d3('0x44')][_0x15d3('0x4e')],_0x2997b1['body']['type']);_0x2997b1[_0x15d3('0x44')]['Descriptions']=integrations[_0x15d3('0x4f')](_0x2997b1[_0x15d3('0x44')][_0x15d3('0x4e')],_0x2997b1[_0x15d3('0x44')][_0x15d3('0x2a')]);return db[_0x15d3('0x48')]['create'](_0x2997b1[_0x15d3('0x44')],{'include':[{'model':db[_0x15d3('0x50')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x15d3('0x51')}]});}return null;})['then'](respondWithResult(_0x7a025b,null))[_0x15d3('0x40')](handleError(_0x7a025b,null));};exports[_0x15d3('0x52')]=function(_0x513e54,_0x558dfb,_0x823f7c){var _0x5400c7='';var _0x283714=['id',_0x15d3('0x25'),_0x15d3('0x53'),_0x15d3('0x54'),_0x15d3('0x55'),_0x15d3('0x56'),_0x15d3('0x57'),'duration_minutes',_0x15d3('0x58'),_0x15d3('0x59'),'parent_name','direction'];return db[_0x15d3('0x28')][_0x15d3('0x47')]({'where':{'id':_0x513e54[_0x15d3('0x41')]['id']},'attributes':['id','username',_0x15d3('0x5a'),_0x15d3('0x5b')]})['then'](handleEntityNotFound(_0x558dfb,null))['then'](function(_0x396089){if(_0x396089){_0x5400c7=_0x396089[_0x15d3('0x5b')];var _0x431d36=_0x5400c7[_0x15d3('0x5c')](-0x1);if(_0x431d36==='/'){_0x5400c7=_0x5400c7[_0x15d3('0x5d')](0x0,_0x5400c7[_0x15d3('0x5e')](_0x431d36));}return rp({'method':_0x15d3('0x5f'),'uri':util[_0x15d3('0x60')](_0x15d3('0x61'),_0x5400c7,_0x15d3('0x62')),'json':!![],'form':{'method':_0x15d3('0x63'),'input_type':_0x15d3('0x64'),'response_type':_0x15d3('0x64'),'rest_data':JSON[_0x15d3('0x65')]({'user_auth':{'user_name':_0x396089[_0x15d3('0x66')],'password':_0x396089[_0x15d3('0x5a')],'encryption':_0x15d3('0x67')},'application':_0x15d3('0x68')})}});}})['then'](function(_0x36db6e){if(_0x36db6e&&_0x36db6e[_0x15d3('0x25')]!==_0x15d3('0x69')&&_0x36db6e[_0x15d3('0x25')]!==_0x15d3('0x6a')){return rp({'method':_0x15d3('0x5f'),'uri':util['format'](_0x15d3('0x61'),_0x5400c7,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x15d3('0x6b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x15d3('0x65')]({'session':_0x36db6e['id'],'module_name':_0x15d3('0x6c')})}})[_0x15d3('0x22')](function(_0x5df28e){if(_0x5df28e){var _0x41cf84=_[_0x15d3('0x6d')](_0x5df28e['module_fields']);_[_0x15d3('0x6e')](_0x41cf84,function(_0x148355){return _0x283714[_0x15d3('0x6f')](_0x148355['name']);});return{'count':_0x41cf84['length'],'rows':_['map'](_0x41cf84,function(_0x2a7f04){return{'id':_0x2a7f04['name'],'name':_0x2a7f04['label'],'custom':_[_0x15d3('0x70')](_0x2a7f04[_0x15d3('0x25')],'_c')?!![]:![],'options':_0x2a7f04[_0x15d3('0x3c')]?_[_0x15d3('0x39')](_[_0x15d3('0x6d')](_0x2a7f04[_0x15d3('0x3c')]),function(_0x569a5a){return{'name':_0x569a5a[_0x15d3('0x71')],'value':_0x569a5a[_0x15d3('0x25')]};}):[]};})};}})[_0x15d3('0x22')](respondWithResult(_0x558dfb,null))[_0x15d3('0x40')](function(_0x33a756){var _0x4edd8f=_0x513e54[_0x15d3('0x2d')][_0x15d3('0x72')]?0x1f4:_0x33a756['statusCode']||0x1f4;logger[_0x15d3('0x73')](_0x15d3('0x74'),_0x15d3('0x52'),_0x4edd8f,JSON[_0x15d3('0x65')](_0x33a756));delete _0x33a756[_0x15d3('0x25')];if(_0x4edd8f===0x191){_0x4edd8f=0x190;}_0x558dfb[_0x15d3('0x24')](_0x4edd8f)[_0x15d3('0x26')](_0x513e54[_0x15d3('0x2d')][_0x15d3('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x33a756[_0x15d3('0x75')]}:_0x33a756);});}else{var _0x2f2339=0x1f4;_0x558dfb['status'](_0x2f2339)['send']({'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 4f825bb..807421c 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 _0xfd14=['api','request-promise','path','../../config/environment','exports','SugarcrmAccount','../../config/logger'];(function(_0x538eba,_0x45db37){var _0x73b3c2=function(_0xb0f139){while(--_0xb0f139){_0x538eba['push'](_0x538eba['shift']());}};_0x73b3c2(++_0x45db37);}(_0xfd14,0x195));var _0x4fd1=function(_0x36a859,_0x1b1ef4){_0x36a859=_0x36a859-0x0;var _0x2ebb7d=_0xfd14[_0x36a859];return _0x2ebb7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4fd1('0x0'))(_0x4fd1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4fd1('0x2'));var fs=require('fs');var path=require(_0x4fd1('0x3'));var rimraf=require('rimraf');var config=require(_0x4fd1('0x4'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4fd1('0x5')]=function(_0x4ab501,_0x8c53bc){return _0x4ab501['define'](_0x4fd1('0x6'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97b2=['bluebird','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','lodash','util','../../config/logger','api','moment'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x97b2,0x1b7));var _0x297b=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x97b2[_0x152136];return _0x20df44;};'use strict';var _=require(_0x297b('0x0'));var util=require(_0x297b('0x1'));var logger=require(_0x297b('0x2'))(_0x297b('0x3'));var moment=require(_0x297b('0x4'));var BPromise=require(_0x297b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x297b('0x6'));var rimraf=require(_0x297b('0x7'));var config=require('../../config/environment');var attributes=require(_0x297b('0x8'));var integrations=require(_0x297b('0x9'));module['exports']=function(_0x596f9c,_0x541d7b){return _0x596f9c[_0x297b('0xa')](_0x297b('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 1596d2b..8813da0 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 _0xf7b2=['catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSugarcrmAccount','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x570990,_0x483310){var _0x2ebad9=function(_0x8271ad){while(--_0x8271ad){_0x570990['push'](_0x570990['shift']());}};_0x2ebad9(++_0x483310);}(_0xf7b2,0x6d));var _0x2f7b=function(_0xe8402,_0xb4e922){_0xe8402=_0xe8402-0x0;var _0x3e7fe9=_0xf7b2[_0xe8402];return _0x3e7fe9;};'use strict';var _=require(_0x2f7b('0x0'));var util=require(_0x2f7b('0x1'));var moment=require(_0x2f7b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f7b('0x4'));var logger=require(_0x2f7b('0x5'))('rpc');var config=require(_0x2f7b('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b9056,_0x519b4b,_0x36f858){return new BPromise(function(_0x4b8565,_0x48fd53){return client[_0x2f7b('0x7')](_0x4b9056,_0x36f858)[_0x2f7b('0x8')](function(_0x490ac8){logger['info'](_0x2f7b('0x9'),_0x519b4b,_0x2f7b('0xa'));logger[_0x2f7b('0xb')](_0x2f7b('0xc'),_0x519b4b,_0x2f7b('0xa'),JSON[_0x2f7b('0xd')](_0x490ac8));if(_0x490ac8[_0x2f7b('0xe')]){if(_0x490ac8[_0x2f7b('0xe')][_0x2f7b('0xf')]===0x1f4){logger[_0x2f7b('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x519b4b,_0x490ac8['error'][_0x2f7b('0x10')]);return _0x48fd53(_0x490ac8[_0x2f7b('0xe')][_0x2f7b('0x10')]);}logger[_0x2f7b('0xe')](_0x2f7b('0x9'),_0x519b4b,_0x490ac8[_0x2f7b('0xe')][_0x2f7b('0x10')]);return _0x4b8565(_0x490ac8[_0x2f7b('0xe')][_0x2f7b('0x10')]);}else{logger[_0x2f7b('0x11')](_0x2f7b('0x9'),_0x519b4b,'request\x20sent');_0x4b8565(_0x490ac8[_0x2f7b('0x12')][_0x2f7b('0x10')]);}})[_0x2f7b('0x13')](function(_0x21a780){logger[_0x2f7b('0xe')](_0x2f7b('0x9'),_0x519b4b,_0x21a780);_0x48fd53(_0x21a780);});});}exports[_0x2f7b('0x14')]=function(_0x3d43aa){var _0x1e7772=this;return new Promise(function(_0x53d59f,_0x2c9075){return db[_0x2f7b('0x15')][_0x2f7b('0x16')]({'raw':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa[_0x2f7b('0x17')][_0x2f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa[_0x2f7b('0x17')][_0x2f7b('0x19')]||null:null,'attributes':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa[_0x2f7b('0x17')][_0x2f7b('0x1a')]||null:null,'limit':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa['options'][_0x2f7b('0x1b')]||null:null,'include':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa['options']['include']?_['map'](_0x3d43aa[_0x2f7b('0x17')][_0x2f7b('0x1c')],function(_0x365d52){return{'model':db[_0x365d52[_0x2f7b('0x1d')]],'as':_0x365d52['as'],'attributes':_0x365d52[_0x2f7b('0x1a')],'include':_0x365d52['include']?_[_0x2f7b('0x1e')](_0x365d52[_0x2f7b('0x1c')],function(_0x22c820){return{'model':db[_0x22c820[_0x2f7b('0x1d')]],'as':_0x22c820['as'],'attributes':_0x22c820[_0x2f7b('0x1a')],'include':_0x22c820[_0x2f7b('0x1c')]?_[_0x2f7b('0x1e')](_0x22c820['include'],function(_0x476b9e){return{'model':db[_0x476b9e[_0x2f7b('0x1d')]],'as':_0x476b9e['as'],'attributes':_0x476b9e[_0x2f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2f7b('0x8')](function(_0x2b5570){logger['info'](_0x2f7b('0x14'),_0x3d43aa);logger[_0x2f7b('0xb')]('GetSugarcrmAccount',_0x3d43aa,JSON[_0x2f7b('0xd')](_0x2b5570));_0x53d59f(_0x2b5570);})[_0x2f7b('0x13')](function(_0x5bec5b){logger[_0x2f7b('0xe')](_0x2f7b('0x14'),_0x5bec5b['message'],_0x3d43aa);_0x2c9075(_0x1e7772[_0x2f7b('0xe')](0x1f4,_0x5bec5b[_0x2f7b('0x10')]));});});};exports[_0x2f7b('0x1f')]=function(_0x10004d){var _0x3563c1=this;return new Promise(function(_0x4df8ee,_0x2c03e4){return db[_0x2f7b('0x15')]['find']({'raw':_0x10004d['options']?_0x10004d[_0x2f7b('0x17')][_0x2f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x10004d[_0x2f7b('0x17')]?_0x10004d[_0x2f7b('0x17')][_0x2f7b('0x19')]||null:null,'attributes':_0x10004d['options']?_0x10004d[_0x2f7b('0x17')][_0x2f7b('0x1a')]||null:null,'include':_0x10004d[_0x2f7b('0x17')]?_0x10004d[_0x2f7b('0x17')]['include']?_[_0x2f7b('0x1e')](_0x10004d[_0x2f7b('0x17')][_0x2f7b('0x1c')],function(_0x53d0c9){return{'model':db[_0x53d0c9[_0x2f7b('0x1d')]],'as':_0x53d0c9['as'],'attributes':_0x53d0c9[_0x2f7b('0x1a')],'include':_0x53d0c9[_0x2f7b('0x1c')]?_[_0x2f7b('0x1e')](_0x53d0c9['include'],function(_0x43b1bc){return{'model':db[_0x43b1bc[_0x2f7b('0x1d')]],'as':_0x43b1bc['as'],'attributes':_0x43b1bc['attributes'],'include':_0x43b1bc[_0x2f7b('0x1c')]?_[_0x2f7b('0x1e')](_0x43b1bc[_0x2f7b('0x1c')],function(_0xbae37a){return{'model':db[_0xbae37a[_0x2f7b('0x1d')]],'as':_0xbae37a['as'],'attributes':_0xbae37a['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f7b('0x8')](function(_0x2390e2){logger[_0x2f7b('0x11')](_0x2f7b('0x1f'),_0x10004d);logger[_0x2f7b('0xb')](_0x2f7b('0x1f'),_0x10004d,JSON[_0x2f7b('0xd')](_0x2390e2));_0x4df8ee(_0x2390e2);})['catch'](function(_0x78493c){logger['error'](_0x2f7b('0x1f'),_0x78493c['message'],_0x10004d);_0x2c03e4(_0x3563c1[_0x2f7b('0xe')](0x1f4,_0x78493c[_0x2f7b('0x10')]));});});}; \ No newline at end of file +var _0x7f1c=['map','model','then','SugarcrmAccount','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x2571e2,_0x547809){var _0x29c6c7=function(_0x4c9f34){while(--_0x4c9f34){_0x2571e2['push'](_0x2571e2['shift']());}};_0x29c6c7(++_0x547809);}(_0x7f1c,0xdd));var _0xc7f1=function(_0x4db4d0,_0x43c2e2){_0x4db4d0=_0x4db4d0-0x0;var _0xe758ed=_0x7f1c[_0x4db4d0];return _0xe758ed;};'use strict';var _=require(_0xc7f1('0x0'));var util=require(_0xc7f1('0x1'));var moment=require(_0xc7f1('0x2'));var BPromise=require(_0xc7f1('0x3'));var rs=require(_0xc7f1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc7f1('0x5'));var logger=require(_0xc7f1('0x6'))(_0xc7f1('0x7'));var config=require('../../config/environment');var jayson=require(_0xc7f1('0x8'));var client=jayson[_0xc7f1('0x9')][_0xc7f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e80ce,_0xc8019c,_0x4b574e){return new BPromise(function(_0x41ee00,_0x4de35f){return client[_0xc7f1('0xb')](_0x2e80ce,_0x4b574e)['then'](function(_0x189ee0){logger[_0xc7f1('0xc')](_0xc7f1('0xd'),_0xc8019c,'request\x20sent');logger[_0xc7f1('0xe')](_0xc7f1('0xf'),_0xc8019c,_0xc7f1('0x10'),JSON[_0xc7f1('0x11')](_0x189ee0));if(_0x189ee0[_0xc7f1('0x12')]){if(_0x189ee0[_0xc7f1('0x12')][_0xc7f1('0x13')]===0x1f4){logger[_0xc7f1('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0xc8019c,_0x189ee0[_0xc7f1('0x12')][_0xc7f1('0x14')]);return _0x4de35f(_0x189ee0[_0xc7f1('0x12')]['message']);}logger[_0xc7f1('0x12')](_0xc7f1('0xd'),_0xc8019c,_0x189ee0['error'][_0xc7f1('0x14')]);return _0x41ee00(_0x189ee0[_0xc7f1('0x12')][_0xc7f1('0x14')]);}else{logger[_0xc7f1('0xc')](_0xc7f1('0xd'),_0xc8019c,_0xc7f1('0x10'));_0x41ee00(_0x189ee0[_0xc7f1('0x15')][_0xc7f1('0x14')]);}})[_0xc7f1('0x16')](function(_0x294fd9){logger[_0xc7f1('0x12')](_0xc7f1('0xd'),_0xc8019c,_0x294fd9);_0x4de35f(_0x294fd9);});});}exports[_0xc7f1('0x17')]=function(_0x4d5922){var _0x2a5037=this;return new Promise(function(_0x1e5b34,_0x5643d0){return db['SugarcrmAccount'][_0xc7f1('0x18')]({'raw':_0x4d5922[_0xc7f1('0x19')]?_0x4d5922[_0xc7f1('0x19')][_0xc7f1('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d5922[_0xc7f1('0x19')]?_0x4d5922[_0xc7f1('0x19')][_0xc7f1('0x1b')]||null:null,'attributes':_0x4d5922[_0xc7f1('0x19')]?_0x4d5922[_0xc7f1('0x19')][_0xc7f1('0x1c')]||null:null,'limit':_0x4d5922[_0xc7f1('0x19')]?_0x4d5922[_0xc7f1('0x19')][_0xc7f1('0x1d')]||null:null,'include':_0x4d5922['options']?_0x4d5922[_0xc7f1('0x19')][_0xc7f1('0x1e')]?_[_0xc7f1('0x1f')](_0x4d5922[_0xc7f1('0x19')][_0xc7f1('0x1e')],function(_0x367bce){return{'model':db[_0x367bce[_0xc7f1('0x20')]],'as':_0x367bce['as'],'attributes':_0x367bce[_0xc7f1('0x1c')],'include':_0x367bce[_0xc7f1('0x1e')]?_[_0xc7f1('0x1f')](_0x367bce[_0xc7f1('0x1e')],function(_0x461416){return{'model':db[_0x461416[_0xc7f1('0x20')]],'as':_0x461416['as'],'attributes':_0x461416['attributes'],'include':_0x461416[_0xc7f1('0x1e')]?_['map'](_0x461416[_0xc7f1('0x1e')],function(_0x5c8aa7){return{'model':db[_0x5c8aa7[_0xc7f1('0x20')]],'as':_0x5c8aa7['as'],'attributes':_0x5c8aa7[_0xc7f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc7f1('0x21')](function(_0x3874bc){logger[_0xc7f1('0xc')](_0xc7f1('0x17'),_0x4d5922);logger['debug']('GetSugarcrmAccount',_0x4d5922,JSON[_0xc7f1('0x11')](_0x3874bc));_0x1e5b34(_0x3874bc);})[_0xc7f1('0x16')](function(_0x65c3a6){logger[_0xc7f1('0x12')](_0xc7f1('0x17'),_0x65c3a6[_0xc7f1('0x14')],_0x4d5922);_0x5643d0(_0x2a5037['error'](0x1f4,_0x65c3a6[_0xc7f1('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x4acb71){var _0x17ac92=this;return new Promise(function(_0x204237,_0x1740c2){return db[_0xc7f1('0x22')]['find']({'raw':_0x4acb71[_0xc7f1('0x19')]?_0x4acb71['options']['raw']===undefined?!![]:![]:!![],'where':_0x4acb71[_0xc7f1('0x19')]?_0x4acb71[_0xc7f1('0x19')][_0xc7f1('0x1b')]||null:null,'attributes':_0x4acb71['options']?_0x4acb71[_0xc7f1('0x19')][_0xc7f1('0x1c')]||null:null,'include':_0x4acb71[_0xc7f1('0x19')]?_0x4acb71[_0xc7f1('0x19')]['include']?_['map'](_0x4acb71[_0xc7f1('0x19')][_0xc7f1('0x1e')],function(_0x5881c){return{'model':db[_0x5881c[_0xc7f1('0x20')]],'as':_0x5881c['as'],'attributes':_0x5881c['attributes'],'include':_0x5881c[_0xc7f1('0x1e')]?_[_0xc7f1('0x1f')](_0x5881c[_0xc7f1('0x1e')],function(_0x1c0aa9){return{'model':db[_0x1c0aa9[_0xc7f1('0x20')]],'as':_0x1c0aa9['as'],'attributes':_0x1c0aa9[_0xc7f1('0x1c')],'include':_0x1c0aa9['include']?_[_0xc7f1('0x1f')](_0x1c0aa9[_0xc7f1('0x1e')],function(_0x2d37b2){return{'model':db[_0x2d37b2[_0xc7f1('0x20')]],'as':_0x2d37b2['as'],'attributes':_0x2d37b2[_0xc7f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc7f1('0x21')](function(_0x2153a8){logger[_0xc7f1('0xc')](_0xc7f1('0x23'),_0x4acb71);logger['debug'](_0xc7f1('0x23'),_0x4acb71,JSON[_0xc7f1('0x11')](_0x2153a8));_0x204237(_0x2153a8);})[_0xc7f1('0x16')](function(_0x2ed1ba){logger['error']('ShowSugarcrmAccount',_0x2ed1ba[_0xc7f1('0x14')],_0x4acb71);_0x1740c2(_0x17ac92['error'](0x1f4,_0x2ed1ba[_0xc7f1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index ab2b0af..56cd680 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 _0x323d=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x15ff7e,_0x2c28ae){var _0x1dbe8c=function(_0x36d607){while(--_0x36d607){_0x15ff7e['push'](_0x15ff7e['shift']());}};_0x1dbe8c(++_0x2c28ae);}(_0x323d,0x1f0));var _0xd323=function(_0xbf7f20,_0x3f856e){_0xbf7f20=_0xbf7f20-0x0;var _0x5dc25d=_0x323d[_0xbf7f20];return _0x5dc25d;};'use strict';var multer=require(_0xd323('0x0'));var util=require(_0xd323('0x1'));var path=require(_0xd323('0x2'));var timeout=require(_0xd323('0x3'));var express=require(_0xd323('0x4'));var router=express[_0xd323('0x5')]();var fs_extra=require(_0xd323('0x6'));var auth=require(_0xd323('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd323('0x8'));var controller=require(_0xd323('0x9'));router[_0xd323('0xa')]('/',auth[_0xd323('0xb')](),controller[_0xd323('0xc')]);router[_0xd323('0xa')]('/:id',auth[_0xd323('0xb')](),controller['show']);router[_0xd323('0xa')](_0xd323('0xd'),auth['isAuthenticated'](),controller[_0xd323('0xe')]);router[_0xd323('0xa')](_0xd323('0xf'),auth[_0xd323('0xb')](),controller[_0xd323('0x10')]);router['get'](_0xd323('0x11'),auth['isAuthenticated'](),controller[_0xd323('0x12')]);router[_0xd323('0x13')]('/',auth[_0xd323('0xb')](),controller[_0xd323('0x14')]);router[_0xd323('0x15')](_0xd323('0x16'),auth['isAuthenticated'](),controller[_0xd323('0x17')]);router['delete'](_0xd323('0x16'),auth[_0xd323('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0395=['post','put','update','delete','/:id','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getDescriptions'];(function(_0x324765,_0x41cad3){var _0x5ed6a5=function(_0x44cfd3){while(--_0x44cfd3){_0x324765['push'](_0x324765['shift']());}};_0x5ed6a5(++_0x41cad3);}(_0x0395,0xd5));var _0x5039=function(_0x1e62b8,_0x5eed4c){_0x1e62b8=_0x1e62b8-0x0;var _0x2ab271=_0x0395[_0x1e62b8];return _0x2ab271;};'use strict';var multer=require(_0x5039('0x0'));var util=require(_0x5039('0x1'));var path=require(_0x5039('0x2'));var timeout=require('connect-timeout');var express=require(_0x5039('0x3'));var router=express[_0x5039('0x4')]();var fs_extra=require(_0x5039('0x5'));var auth=require(_0x5039('0x6'));var interaction=require(_0x5039('0x7'));var config=require(_0x5039('0x8'));var controller=require(_0x5039('0x9'));router[_0x5039('0xa')]('/',auth[_0x5039('0xb')](),controller[_0x5039('0xc')]);router[_0x5039('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5039('0xd')]);router[_0x5039('0xa')](_0x5039('0xe'),auth[_0x5039('0xb')](),controller[_0x5039('0xf')]);router[_0x5039('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x5039('0xa')]('/:id/descriptions',auth[_0x5039('0xb')](),controller[_0x5039('0x10')]);router[_0x5039('0x11')]('/',auth[_0x5039('0xb')](),controller['create']);router[_0x5039('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5039('0x13')]);router[_0x5039('0x14')](_0x5039('0x15'),auth[_0x5039('0xb')](),controller[_0x5039('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 3ed419c..15c30c8 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 _0x8592=['sequelize','exports','STRING'];(function(_0x22dcd0,_0x5bebb9){var _0x5bcced=function(_0x50fd31){while(--_0x50fd31){_0x22dcd0['push'](_0x22dcd0['shift']());}};_0x5bcced(++_0x5bebb9);}(_0x8592,0x114));var _0x2859=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0x8592[_0x85d5a8];return _0x20479b;};'use strict';var Sequelize=require(_0x2859('0x0'));module[_0x2859('0x1')]={'name':{'type':Sequelize[_0x2859('0x2')]},'description':{'type':Sequelize[_0x2859('0x2')]}}; \ No newline at end of file +var _0x29f7=['STRING'];(function(_0x1f0213,_0x3c3c9e){var _0x2048c4=function(_0x26d0c6){while(--_0x26d0c6){_0x1f0213['push'](_0x1f0213['shift']());}};_0x2048c4(++_0x3c3c9e);}(_0x29f7,0x1ce));var _0x729f=function(_0x5e9a07,_0x484435){_0x5e9a07=_0x5e9a07-0x0;var _0x106c85=_0x29f7[_0x5e9a07];return _0x106c85;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x729f('0x0')]},'description':{'type':Sequelize[_0x729f('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 1fbb9f1..e2864e4 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 _0x3351=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','getFields','findOne','hasOwnProperty','getSubjects','SugarcrmField','getDescriptions'];(function(_0x1e79db,_0x10a86a){var _0x3346d3=function(_0x5ce152){while(--_0x5ce152){_0x1e79db['push'](_0x1e79db['shift']());}};_0x3346d3(++_0x10a86a);}(_0x3351,0x186));var _0x1335=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x3351[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x1335('0x0'));var rimraf=require(_0x1335('0x1'));var zipdir=require(_0x1335('0x2'));var jsonpatch=require(_0x1335('0x3'));var rp=require('request-promise');var moment=require(_0x1335('0x4'));var BPromise=require(_0x1335('0x5'));var Mustache=require(_0x1335('0x6'));var util=require(_0x1335('0x7'));var path=require('path');var sox=require(_0x1335('0x8'));var csv=require('to-csv');var ejs=require(_0x1335('0x9'));var fs=require('fs');var fs_extra=require(_0x1335('0xa'));var _=require(_0x1335('0xb'));var squel=require(_0x1335('0xc'));var crypto=require(_0x1335('0xd'));var jsforce=require(_0x1335('0xe'));var deskjs=require(_0x1335('0xf'));var toCsv=require(_0x1335('0x10'));var querystring=require(_0x1335('0x11'));var Papa=require(_0x1335('0x12'));var Redis=require(_0x1335('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1335('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1335('0x15'));var logger=require(_0x1335('0x16'))(_0x1335('0x17'));var utils=require(_0x1335('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c0f81,_0x444286){_0x444286=_0x444286||0xcc;return function(_0x1dce5b){if(_0x1dce5b){return _0x4c0f81['sendStatus'](_0x444286);}return _0x4c0f81[_0x1335('0x19')](_0x444286)[_0x1335('0x1a')]();};}function respondWithResult(_0x532f7e,_0x163352){_0x163352=_0x163352||0xc8;return function(_0x1a41b9){if(_0x1a41b9){return _0x532f7e[_0x1335('0x19')](_0x163352)[_0x1335('0x1b')](_0x1a41b9);}};}function respondWithFilteredResult(_0x284b98,_0x188f7a){return function(_0x27818e){if(_0x27818e){var _0x29c8d3=typeof _0x188f7a[_0x1335('0x1c')]===_0x1335('0x1d')&&typeof _0x188f7a[_0x1335('0x1e')]==='undefined';var _0x24bf70=_0x27818e[_0x1335('0x1f')];var _0x31437b=_0x29c8d3?0x0:_0x188f7a['offset'];var _0xbe1b5e=_0x29c8d3?_0x27818e[_0x1335('0x1f')]:_0x188f7a[_0x1335('0x1c')]+_0x188f7a['limit'];var _0x2b0ae2;if(_0xbe1b5e>=_0x24bf70){_0xbe1b5e=_0x24bf70;_0x2b0ae2=0xc8;}else{_0x2b0ae2=0xce;}_0x284b98['status'](_0x2b0ae2);return _0x284b98['set'](_0x1335('0x20'),_0x31437b+'-'+_0xbe1b5e+'/'+_0x24bf70)[_0x1335('0x1b')](_0x27818e);}return null;};}function patchUpdates(_0x2df91d){return function(_0x4dd685){try{jsonpatch['apply'](_0x4dd685,_0x2df91d,!![]);}catch(_0x409b7e){return BPromise['reject'](_0x409b7e);}return _0x4dd685[_0x1335('0x21')]();};}function saveUpdates(_0x2b2310,_0x24929c){return function(_0x296c97){if(_0x296c97){return _0x296c97[_0x1335('0x22')](_0x2b2310)[_0x1335('0x23')](function(_0x5dcda6){return _0x5dcda6;});}return null;};}function removeEntity(_0x8ad9dd,_0x42ad80){return function(_0x31617b){if(_0x31617b){return _0x31617b[_0x1335('0x24')]()[_0x1335('0x23')](function(){_0x8ad9dd[_0x1335('0x19')](0xcc)[_0x1335('0x1a')]();});}};}function handleEntityNotFound(_0x5e4df6,_0x43c6b6){return function(_0x24987d){if(!_0x24987d){_0x5e4df6['sendStatus'](0x194);}return _0x24987d;};}function handleError(_0x5e34b8,_0x3be2c0){_0x3be2c0=_0x3be2c0||0x1f4;return function(_0x26500b){logger[_0x1335('0x25')](_0x26500b[_0x1335('0x26')]);if(_0x26500b['name']){delete _0x26500b['name'];}_0x5e34b8[_0x1335('0x19')](_0x3be2c0)[_0x1335('0x27')](_0x26500b);};}exports['index']=function(_0x4a2fe8,_0x143aeb){var _0x24a428={},_0x1be2bf={},_0x416f6f={'count':0x0,'rows':[]};var _0x34bc25=_[_0x1335('0x28')](db[_0x1335('0x29')][_0x1335('0x2a')],function(_0x19b1e0){return{'name':_0x19b1e0[_0x1335('0x2b')],'type':_0x19b1e0[_0x1335('0x2c')][_0x1335('0x2d')]};});_0x1be2bf[_0x1335('0x2e')]=_['map'](_0x34bc25,_0x1335('0x2f'));_0x1be2bf[_0x1335('0x30')]=_['keys'](_0x4a2fe8['query']);_0x1be2bf[_0x1335('0x31')]=_['intersection'](_0x1be2bf[_0x1335('0x2e')],_0x1be2bf[_0x1335('0x30')]);_0x24a428[_0x1335('0x32')]=_[_0x1335('0x33')](_0x1be2bf[_0x1335('0x2e')],qs[_0x1335('0x34')](_0x4a2fe8[_0x1335('0x30')]['fields']));_0x24a428['attributes']=_0x24a428['attributes'][_0x1335('0x35')]?_0x24a428[_0x1335('0x32')]:_0x1be2bf[_0x1335('0x2e')];if(!_0x4a2fe8[_0x1335('0x30')]['hasOwnProperty'](_0x1335('0x36'))){_0x24a428['limit']=qs[_0x1335('0x1e')](_0x4a2fe8[_0x1335('0x30')]['limit']);_0x24a428[_0x1335('0x1c')]=qs['offset'](_0x4a2fe8['query'][_0x1335('0x1c')]);}_0x24a428[_0x1335('0x37')]=qs[_0x1335('0x38')](_0x4a2fe8[_0x1335('0x30')][_0x1335('0x38')]);_0x24a428[_0x1335('0x39')]=qs[_0x1335('0x31')](_[_0x1335('0x3a')](_0x4a2fe8['query'],_0x1be2bf[_0x1335('0x31')]),_0x34bc25);if(_0x4a2fe8['query'][_0x1335('0x3b')]){_0x24a428[_0x1335('0x39')]=_[_0x1335('0x3c')](_0x24a428[_0x1335('0x39')],{'$or':_[_0x1335('0x28')](_0x34bc25,function(_0x5273ba){if(_0x5273ba[_0x1335('0x2c')]!=='VIRTUAL'){var _0x2631f0={};_0x2631f0[_0x5273ba[_0x1335('0x2f')]]={'$like':'%'+_0x4a2fe8[_0x1335('0x30')][_0x1335('0x3b')]+'%'};return _0x2631f0;}})});}_0x24a428=_['merge']({},_0x24a428,_0x4a2fe8[_0x1335('0x3d')]);var _0x446068={'where':_0x24a428[_0x1335('0x39')]};return db['SugarcrmConfiguration'][_0x1335('0x1f')](_0x446068)[_0x1335('0x23')](function(_0x4e9d5e){_0x416f6f[_0x1335('0x1f')]=_0x4e9d5e;if(_0x4a2fe8['query'][_0x1335('0x3e')]){_0x24a428[_0x1335('0x3f')]=[{'all':!![]}];}return db[_0x1335('0x29')][_0x1335('0x40')](_0x24a428);})[_0x1335('0x23')](function(_0x426850){_0x416f6f['rows']=_0x426850;return _0x416f6f;})[_0x1335('0x23')](respondWithFilteredResult(_0x143aeb,_0x24a428))[_0x1335('0x41')](handleError(_0x143aeb,null));};exports[_0x1335('0x42')]=function(_0x36b5e5,_0x52709c){var _0x5d599f={'raw':![],'where':{'id':_0x36b5e5[_0x1335('0x43')]['id']}},_0xcee5b={};_0xcee5b[_0x1335('0x2e')]=_['keys'](db[_0x1335('0x29')][_0x1335('0x2a')]);_0xcee5b[_0x1335('0x30')]=_[_0x1335('0x44')](_0x36b5e5[_0x1335('0x30')]);_0xcee5b[_0x1335('0x31')]=_[_0x1335('0x33')](_0xcee5b['model'],_0xcee5b[_0x1335('0x30')]);_0x5d599f[_0x1335('0x32')]=_[_0x1335('0x33')](_0xcee5b[_0x1335('0x2e')],qs['fields'](_0x36b5e5[_0x1335('0x30')][_0x1335('0x34')]));_0x5d599f['attributes']=_0x5d599f[_0x1335('0x32')]['length']?_0x5d599f[_0x1335('0x32')]:_0xcee5b[_0x1335('0x2e')];if(_0x36b5e5[_0x1335('0x30')]['includeAll']){_0x5d599f['include']=[{'all':!![]}];}_0x5d599f=_['merge']({},_0x5d599f,_0x36b5e5['options']);return db['SugarcrmConfiguration']['find'](_0x5d599f)[_0x1335('0x23')](handleEntityNotFound(_0x52709c,null))[_0x1335('0x23')](respondWithResult(_0x52709c,null))[_0x1335('0x41')](handleError(_0x52709c,null));};exports[_0x1335('0x45')]=function(_0x5576c1,_0x1a0c78){return db['SugarcrmConfiguration']['create'](_0x5576c1[_0x1335('0x46')],{})[_0x1335('0x23')](respondWithResult(_0x1a0c78,0xc9))[_0x1335('0x41')](handleError(_0x1a0c78,null));};exports[_0x1335('0x22')]=function(_0x21f829,_0x14dde5){if(_0x21f829[_0x1335('0x46')]['id']){delete _0x21f829[_0x1335('0x46')]['id'];}return db[_0x1335('0x29')][_0x1335('0x47')]({'where':{'id':_0x21f829['params']['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x14dde5,null))['then'](saveUpdates(_0x21f829['body'],null))[_0x1335('0x23')](respondWithResult(_0x14dde5,null))[_0x1335('0x41')](handleError(_0x14dde5,null));};exports[_0x1335('0x24')]=function(_0x5e2128,_0x338de3){return db['SugarcrmConfiguration'][_0x1335('0x47')]({'where':{'id':_0x5e2128['params']['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x338de3,null))[_0x1335('0x23')](removeEntity(_0x338de3,null))[_0x1335('0x41')](handleError(_0x338de3,null));};exports[_0x1335('0x48')]=function(_0x424ee6,_0x1c3d7f,_0x2d9dee){var _0xc4bd3a={};var _0x28716b={};var _0x408c74;var _0x2442c4;return db[_0x1335('0x29')][_0x1335('0x49')]({'where':{'id':_0x424ee6[_0x1335('0x43')]['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x1c3d7f,null))[_0x1335('0x23')](function(_0x16da65){if(_0x16da65){_0x408c74=_0x16da65;_0x28716b[_0x1335('0x2e')]=_[_0x1335('0x44')](db['SugarcrmField']['rawAttributes']);_0x28716b[_0x1335('0x30')]=_[_0x1335('0x44')](_0x424ee6['query']);_0x28716b[_0x1335('0x31')]=_['intersection'](_0x28716b[_0x1335('0x2e')],_0x28716b[_0x1335('0x30')]);_0xc4bd3a[_0x1335('0x32')]=_['intersection'](_0x28716b['model'],qs[_0x1335('0x34')](_0x424ee6[_0x1335('0x30')]['fields']));_0xc4bd3a['attributes']=_0xc4bd3a[_0x1335('0x32')][_0x1335('0x35')]?_0xc4bd3a['attributes']:_0x28716b[_0x1335('0x2e')];_0xc4bd3a[_0x1335('0x37')]=qs['sort'](_0x424ee6[_0x1335('0x30')][_0x1335('0x38')]);_0xc4bd3a[_0x1335('0x39')]=qs[_0x1335('0x31')](_['pick'](_0x424ee6['query'],_0x28716b['filters']));if(_0x424ee6[_0x1335('0x30')][_0x1335('0x3b')]){_0xc4bd3a[_0x1335('0x39')]=_[_0x1335('0x3c')](_0xc4bd3a[_0x1335('0x39')],{'$or':_[_0x1335('0x28')](_0xc4bd3a['attributes'],function(_0x38f2a6){var _0x4fcd7d={};_0x4fcd7d[_0x38f2a6]={'$like':'%'+_0x424ee6[_0x1335('0x30')][_0x1335('0x3b')]+'%'};return _0x4fcd7d;})});}_0xc4bd3a=_[_0x1335('0x3c')]({},_0xc4bd3a,_0x424ee6[_0x1335('0x3d')]);return _0x408c74[_0x1335('0x48')](_0xc4bd3a);}})[_0x1335('0x23')](function(_0x975fd1){if(_0x975fd1){_0x2442c4=_0x975fd1[_0x1335('0x35')];if(!_0x424ee6['query'][_0x1335('0x4a')](_0x1335('0x36'))){_0xc4bd3a[_0x1335('0x1e')]=qs[_0x1335('0x1e')](_0x424ee6[_0x1335('0x30')]['limit']);_0xc4bd3a['offset']=qs[_0x1335('0x1c')](_0x424ee6[_0x1335('0x30')][_0x1335('0x1c')]);}return _0x408c74['getFields'](_0xc4bd3a);}})[_0x1335('0x23')](function(_0x574873){if(_0x574873){return _0x574873?{'count':_0x2442c4,'rows':_0x574873}:null;}})[_0x1335('0x23')](respondWithResult(_0x1c3d7f,null))['catch'](handleError(_0x1c3d7f,null));};exports[_0x1335('0x4b')]=function(_0x31f54e,_0x35eda6,_0x3ac7f8){var _0xb012a0={};var _0xc06e={};var _0x659d5d;var _0x16754b;return db['SugarcrmConfiguration'][_0x1335('0x49')]({'where':{'id':_0x31f54e['params']['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x35eda6,null))['then'](function(_0x12a2c9){if(_0x12a2c9){_0x659d5d=_0x12a2c9;_0xc06e[_0x1335('0x2e')]=_[_0x1335('0x44')](db[_0x1335('0x4c')]['rawAttributes']);_0xc06e[_0x1335('0x30')]=_[_0x1335('0x44')](_0x31f54e[_0x1335('0x30')]);_0xc06e[_0x1335('0x31')]=_[_0x1335('0x33')](_0xc06e[_0x1335('0x2e')],_0xc06e['query']);_0xb012a0[_0x1335('0x32')]=_['intersection'](_0xc06e[_0x1335('0x2e')],qs[_0x1335('0x34')](_0x31f54e[_0x1335('0x30')]['fields']));_0xb012a0[_0x1335('0x32')]=_0xb012a0[_0x1335('0x32')][_0x1335('0x35')]?_0xb012a0[_0x1335('0x32')]:_0xc06e[_0x1335('0x2e')];_0xb012a0[_0x1335('0x37')]=qs[_0x1335('0x38')](_0x31f54e[_0x1335('0x30')][_0x1335('0x38')]);_0xb012a0[_0x1335('0x39')]=qs[_0x1335('0x31')](_[_0x1335('0x3a')](_0x31f54e[_0x1335('0x30')],_0xc06e[_0x1335('0x31')]));if(_0x31f54e[_0x1335('0x30')][_0x1335('0x3b')]){_0xb012a0[_0x1335('0x39')]=_[_0x1335('0x3c')](_0xb012a0['where'],{'$or':_[_0x1335('0x28')](_0xb012a0[_0x1335('0x32')],function(_0x5dcb61){var _0x4ca815={};_0x4ca815[_0x5dcb61]={'$like':'%'+_0x31f54e[_0x1335('0x30')][_0x1335('0x3b')]+'%'};return _0x4ca815;})});}_0xb012a0=_[_0x1335('0x3c')]({},_0xb012a0,_0x31f54e[_0x1335('0x3d')]);return _0x659d5d[_0x1335('0x4b')](_0xb012a0);}})[_0x1335('0x23')](function(_0x26e321){if(_0x26e321){_0x16754b=_0x26e321[_0x1335('0x35')];if(!_0x31f54e[_0x1335('0x30')][_0x1335('0x4a')]('nolimit')){_0xb012a0[_0x1335('0x1e')]=qs['limit'](_0x31f54e['query']['limit']);_0xb012a0[_0x1335('0x1c')]=qs[_0x1335('0x1c')](_0x31f54e[_0x1335('0x30')]['offset']);}return _0x659d5d[_0x1335('0x4b')](_0xb012a0);}})[_0x1335('0x23')](function(_0x507f1d){if(_0x507f1d){return _0x507f1d?{'count':_0x16754b,'rows':_0x507f1d}:null;}})[_0x1335('0x23')](respondWithResult(_0x35eda6,null))[_0x1335('0x41')](handleError(_0x35eda6,null));};exports['getDescriptions']=function(_0x38423b,_0x3d87d2,_0xdfc2d0){var _0x54cafd={};var _0x43ab79={};var _0x398f51;var _0x28359e;return db[_0x1335('0x29')][_0x1335('0x49')]({'where':{'id':_0x38423b[_0x1335('0x43')]['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x3d87d2,null))[_0x1335('0x23')](function(_0x5125ae){if(_0x5125ae){_0x398f51=_0x5125ae;_0x43ab79[_0x1335('0x2e')]=_[_0x1335('0x44')](db['SugarcrmField'][_0x1335('0x2a')]);_0x43ab79[_0x1335('0x30')]=_[_0x1335('0x44')](_0x38423b['query']);_0x43ab79[_0x1335('0x31')]=_['intersection'](_0x43ab79[_0x1335('0x2e')],_0x43ab79[_0x1335('0x30')]);_0x54cafd[_0x1335('0x32')]=_[_0x1335('0x33')](_0x43ab79[_0x1335('0x2e')],qs[_0x1335('0x34')](_0x38423b[_0x1335('0x30')][_0x1335('0x34')]));_0x54cafd[_0x1335('0x32')]=_0x54cafd['attributes']['length']?_0x54cafd['attributes']:_0x43ab79[_0x1335('0x2e')];_0x54cafd[_0x1335('0x37')]=qs[_0x1335('0x38')](_0x38423b[_0x1335('0x30')]['sort']);_0x54cafd[_0x1335('0x39')]=qs[_0x1335('0x31')](_[_0x1335('0x3a')](_0x38423b['query'],_0x43ab79[_0x1335('0x31')]));if(_0x38423b[_0x1335('0x30')]['filter']){_0x54cafd[_0x1335('0x39')]=_[_0x1335('0x3c')](_0x54cafd['where'],{'$or':_[_0x1335('0x28')](_0x54cafd[_0x1335('0x32')],function(_0x17420d){var _0x346caf={};_0x346caf[_0x17420d]={'$like':'%'+_0x38423b[_0x1335('0x30')]['filter']+'%'};return _0x346caf;})});}_0x54cafd=_[_0x1335('0x3c')]({},_0x54cafd,_0x38423b[_0x1335('0x3d')]);return _0x398f51[_0x1335('0x4d')](_0x54cafd);}})[_0x1335('0x23')](function(_0x1edd46){if(_0x1edd46){_0x28359e=_0x1edd46['length'];if(!_0x38423b[_0x1335('0x30')][_0x1335('0x4a')](_0x1335('0x36'))){_0x54cafd[_0x1335('0x1e')]=qs[_0x1335('0x1e')](_0x38423b['query']['limit']);_0x54cafd[_0x1335('0x1c')]=qs[_0x1335('0x1c')](_0x38423b[_0x1335('0x30')][_0x1335('0x1c')]);}return _0x398f51['getDescriptions'](_0x54cafd);}})[_0x1335('0x23')](function(_0x3348f4){if(_0x3348f4){return _0x3348f4?{'count':_0x28359e,'rows':_0x3348f4}:null;}})[_0x1335('0x23')](respondWithResult(_0x3d87d2,null))['catch'](handleError(_0x3d87d2,null));}; \ No newline at end of file +var _0xa85f=['zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','findAll','rows','catch','show','params','fields','includeAll','create','body','find','getFields','findOne','SugarcrmField','getSubjects','pick','getDescriptions','eml-format','rimraf'];(function(_0x2d279f,_0xa77f18){var _0x452e7b=function(_0x494653){while(--_0x494653){_0x2d279f['push'](_0x2d279f['shift']());}};_0x452e7b(++_0xa77f18);}(_0xa85f,0x198));var _0xfa85=function(_0x1f4e66,_0x3fcac1){_0x1f4e66=_0x1f4e66-0x0;var _0x38b741=_0xa85f[_0x1f4e66];return _0x38b741;};'use strict';var emlformat=require(_0xfa85('0x0'));var rimraf=require(_0xfa85('0x1'));var zipdir=require(_0xfa85('0x2'));var jsonpatch=require(_0xfa85('0x3'));var rp=require(_0xfa85('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa85('0x5'));var util=require('util');var path=require(_0xfa85('0x6'));var sox=require(_0xfa85('0x7'));var csv=require('to-csv');var ejs=require(_0xfa85('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa85('0x9'));var squel=require(_0xfa85('0xa'));var crypto=require(_0xfa85('0xb'));var jsforce=require(_0xfa85('0xc'));var deskjs=require(_0xfa85('0xd'));var toCsv=require(_0xfa85('0xe'));var querystring=require(_0xfa85('0xf'));var Papa=require(_0xfa85('0x10'));var Redis=require(_0xfa85('0x11'));var authService=require(_0xfa85('0x12'));var qs=require(_0xfa85('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa85('0x14'))(_0xfa85('0x15'));var utils=require(_0xfa85('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfa85('0x17'));var db=require(_0xfa85('0x18'))['db'];function respondWithStatusCode(_0x6ae59f,_0x4b5af0){_0x4b5af0=_0x4b5af0||0xcc;return function(_0x405d22){if(_0x405d22){return _0x6ae59f[_0xfa85('0x19')](_0x4b5af0);}return _0x6ae59f['status'](_0x4b5af0)['end']();};}function respondWithResult(_0x4aad80,_0x5a38ed){_0x5a38ed=_0x5a38ed||0xc8;return function(_0x45b9d2){if(_0x45b9d2){return _0x4aad80[_0xfa85('0x1a')](_0x5a38ed)[_0xfa85('0x1b')](_0x45b9d2);}};}function respondWithFilteredResult(_0x165f59,_0x194bfb){return function(_0x111f19){if(_0x111f19){var _0x5aecda=typeof _0x194bfb[_0xfa85('0x1c')]===_0xfa85('0x1d')&&typeof _0x194bfb[_0xfa85('0x1e')]==='undefined';var _0x580fb0=_0x111f19[_0xfa85('0x1f')];var _0x24a8d6=_0x5aecda?0x0:_0x194bfb[_0xfa85('0x1c')];var _0x4a4565=_0x5aecda?_0x111f19[_0xfa85('0x1f')]:_0x194bfb[_0xfa85('0x1c')]+_0x194bfb[_0xfa85('0x1e')];var _0x2c4f58;if(_0x4a4565>=_0x580fb0){_0x4a4565=_0x580fb0;_0x2c4f58=0xc8;}else{_0x2c4f58=0xce;}_0x165f59[_0xfa85('0x1a')](_0x2c4f58);return _0x165f59[_0xfa85('0x20')](_0xfa85('0x21'),_0x24a8d6+'-'+_0x4a4565+'/'+_0x580fb0)[_0xfa85('0x1b')](_0x111f19);}return null;};}function patchUpdates(_0xd3ba8f){return function(_0x1360dd){try{jsonpatch[_0xfa85('0x22')](_0x1360dd,_0xd3ba8f,!![]);}catch(_0x32592e){return BPromise[_0xfa85('0x23')](_0x32592e);}return _0x1360dd['save']();};}function saveUpdates(_0x5764aa,_0x8bfb98){return function(_0x4aebdd){if(_0x4aebdd){return _0x4aebdd[_0xfa85('0x24')](_0x5764aa)['then'](function(_0x54eb2e){return _0x54eb2e;});}return null;};}function removeEntity(_0x1966fe,_0x4a80a9){return function(_0x45be60){if(_0x45be60){return _0x45be60[_0xfa85('0x25')]()[_0xfa85('0x26')](function(){_0x1966fe[_0xfa85('0x1a')](0xcc)[_0xfa85('0x27')]();});}};}function handleEntityNotFound(_0x40a852,_0x3173a9){return function(_0x2f7487){if(!_0x2f7487){_0x40a852[_0xfa85('0x19')](0x194);}return _0x2f7487;};}function handleError(_0x110d74,_0x1b1245){_0x1b1245=_0x1b1245||0x1f4;return function(_0x25fbe8){logger[_0xfa85('0x28')](_0x25fbe8[_0xfa85('0x29')]);if(_0x25fbe8[_0xfa85('0x2a')]){delete _0x25fbe8[_0xfa85('0x2a')];}_0x110d74['status'](_0x1b1245)[_0xfa85('0x2b')](_0x25fbe8);};}exports[_0xfa85('0x2c')]=function(_0x28c9e8,_0x3c4c13){var _0x2016dd={},_0x138724={},_0x4f77d2={'count':0x0,'rows':[]};var _0x23ad6e=_[_0xfa85('0x2d')](db[_0xfa85('0x2e')][_0xfa85('0x2f')],function(_0x337108){return{'name':_0x337108[_0xfa85('0x30')],'type':_0x337108[_0xfa85('0x31')][_0xfa85('0x32')]};});_0x138724[_0xfa85('0x33')]=_[_0xfa85('0x2d')](_0x23ad6e,_0xfa85('0x2a'));_0x138724['query']=_[_0xfa85('0x34')](_0x28c9e8[_0xfa85('0x35')]);_0x138724['filters']=_[_0xfa85('0x36')](_0x138724[_0xfa85('0x33')],_0x138724['query']);_0x2016dd[_0xfa85('0x37')]=_[_0xfa85('0x36')](_0x138724[_0xfa85('0x33')],qs['fields'](_0x28c9e8[_0xfa85('0x35')]['fields']));_0x2016dd[_0xfa85('0x37')]=_0x2016dd[_0xfa85('0x37')][_0xfa85('0x38')]?_0x2016dd['attributes']:_0x138724['model'];if(!_0x28c9e8['query'][_0xfa85('0x39')](_0xfa85('0x3a'))){_0x2016dd[_0xfa85('0x1e')]=qs[_0xfa85('0x1e')](_0x28c9e8['query'][_0xfa85('0x1e')]);_0x2016dd['offset']=qs['offset'](_0x28c9e8[_0xfa85('0x35')][_0xfa85('0x1c')]);}_0x2016dd[_0xfa85('0x3b')]=qs['sort'](_0x28c9e8['query'][_0xfa85('0x3c')]);_0x2016dd[_0xfa85('0x3d')]=qs[_0xfa85('0x3e')](_['pick'](_0x28c9e8[_0xfa85('0x35')],_0x138724[_0xfa85('0x3e')]),_0x23ad6e);if(_0x28c9e8[_0xfa85('0x35')][_0xfa85('0x3f')]){_0x2016dd[_0xfa85('0x3d')]=_['merge'](_0x2016dd['where'],{'$or':_[_0xfa85('0x2d')](_0x23ad6e,function(_0x52a7a8){if(_0x52a7a8[_0xfa85('0x31')]!=='VIRTUAL'){var _0x23a1e5={};_0x23a1e5[_0x52a7a8[_0xfa85('0x2a')]]={'$like':'%'+_0x28c9e8[_0xfa85('0x35')]['filter']+'%'};return _0x23a1e5;}})});}_0x2016dd=_[_0xfa85('0x40')]({},_0x2016dd,_0x28c9e8[_0xfa85('0x41')]);var _0x25587e={'where':_0x2016dd[_0xfa85('0x3d')]};return db['SugarcrmConfiguration'][_0xfa85('0x1f')](_0x25587e)[_0xfa85('0x26')](function(_0x3afc99){_0x4f77d2['count']=_0x3afc99;if(_0x28c9e8['query']['includeAll']){_0x2016dd['include']=[{'all':!![]}];}return db[_0xfa85('0x2e')][_0xfa85('0x42')](_0x2016dd);})[_0xfa85('0x26')](function(_0x499f35){_0x4f77d2[_0xfa85('0x43')]=_0x499f35;return _0x4f77d2;})['then'](respondWithFilteredResult(_0x3c4c13,_0x2016dd))[_0xfa85('0x44')](handleError(_0x3c4c13,null));};exports[_0xfa85('0x45')]=function(_0x3c0829,_0x2ce504){var _0x563c2c={'raw':![],'where':{'id':_0x3c0829[_0xfa85('0x46')]['id']}},_0x20aeaf={};_0x20aeaf['model']=_[_0xfa85('0x34')](db['SugarcrmConfiguration'][_0xfa85('0x2f')]);_0x20aeaf[_0xfa85('0x35')]=_[_0xfa85('0x34')](_0x3c0829[_0xfa85('0x35')]);_0x20aeaf['filters']=_[_0xfa85('0x36')](_0x20aeaf[_0xfa85('0x33')],_0x20aeaf[_0xfa85('0x35')]);_0x563c2c[_0xfa85('0x37')]=_['intersection'](_0x20aeaf[_0xfa85('0x33')],qs[_0xfa85('0x47')](_0x3c0829['query'][_0xfa85('0x47')]));_0x563c2c['attributes']=_0x563c2c[_0xfa85('0x37')][_0xfa85('0x38')]?_0x563c2c['attributes']:_0x20aeaf[_0xfa85('0x33')];if(_0x3c0829['query'][_0xfa85('0x48')]){_0x563c2c['include']=[{'all':!![]}];}_0x563c2c=_['merge']({},_0x563c2c,_0x3c0829[_0xfa85('0x41')]);return db['SugarcrmConfiguration']['find'](_0x563c2c)[_0xfa85('0x26')](handleEntityNotFound(_0x2ce504,null))['then'](respondWithResult(_0x2ce504,null))['catch'](handleError(_0x2ce504,null));};exports[_0xfa85('0x49')]=function(_0x375ab0,_0x884d81){return db['SugarcrmConfiguration'][_0xfa85('0x49')](_0x375ab0[_0xfa85('0x4a')],{})['then'](respondWithResult(_0x884d81,0xc9))[_0xfa85('0x44')](handleError(_0x884d81,null));};exports['update']=function(_0x65cfc,_0x47cd6a){if(_0x65cfc[_0xfa85('0x4a')]['id']){delete _0x65cfc['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x65cfc[_0xfa85('0x46')]['id']}})[_0xfa85('0x26')](handleEntityNotFound(_0x47cd6a,null))['then'](saveUpdates(_0x65cfc[_0xfa85('0x4a')],null))[_0xfa85('0x26')](respondWithResult(_0x47cd6a,null))[_0xfa85('0x44')](handleError(_0x47cd6a,null));};exports[_0xfa85('0x25')]=function(_0x3421ae,_0x8938ea){return db[_0xfa85('0x2e')][_0xfa85('0x4b')]({'where':{'id':_0x3421ae[_0xfa85('0x46')]['id']}})[_0xfa85('0x26')](handleEntityNotFound(_0x8938ea,null))[_0xfa85('0x26')](removeEntity(_0x8938ea,null))[_0xfa85('0x44')](handleError(_0x8938ea,null));};exports[_0xfa85('0x4c')]=function(_0x3ae850,_0x5ba49f,_0x284080){var _0x51b77c={};var _0x5ed56f={};var _0x3b13a3;var _0x292482;return db[_0xfa85('0x2e')][_0xfa85('0x4d')]({'where':{'id':_0x3ae850[_0xfa85('0x46')]['id']}})[_0xfa85('0x26')](handleEntityNotFound(_0x5ba49f,null))[_0xfa85('0x26')](function(_0x3d3c89){if(_0x3d3c89){_0x3b13a3=_0x3d3c89;_0x5ed56f[_0xfa85('0x33')]=_[_0xfa85('0x34')](db[_0xfa85('0x4e')][_0xfa85('0x2f')]);_0x5ed56f['query']=_['keys'](_0x3ae850[_0xfa85('0x35')]);_0x5ed56f[_0xfa85('0x3e')]=_[_0xfa85('0x36')](_0x5ed56f[_0xfa85('0x33')],_0x5ed56f[_0xfa85('0x35')]);_0x51b77c['attributes']=_[_0xfa85('0x36')](_0x5ed56f[_0xfa85('0x33')],qs['fields'](_0x3ae850[_0xfa85('0x35')][_0xfa85('0x47')]));_0x51b77c[_0xfa85('0x37')]=_0x51b77c[_0xfa85('0x37')][_0xfa85('0x38')]?_0x51b77c[_0xfa85('0x37')]:_0x5ed56f[_0xfa85('0x33')];_0x51b77c['order']=qs[_0xfa85('0x3c')](_0x3ae850[_0xfa85('0x35')][_0xfa85('0x3c')]);_0x51b77c[_0xfa85('0x3d')]=qs['filters'](_['pick'](_0x3ae850['query'],_0x5ed56f['filters']));if(_0x3ae850[_0xfa85('0x35')]['filter']){_0x51b77c[_0xfa85('0x3d')]=_[_0xfa85('0x40')](_0x51b77c[_0xfa85('0x3d')],{'$or':_[_0xfa85('0x2d')](_0x51b77c[_0xfa85('0x37')],function(_0x523483){var _0x229aaa={};_0x229aaa[_0x523483]={'$like':'%'+_0x3ae850[_0xfa85('0x35')]['filter']+'%'};return _0x229aaa;})});}_0x51b77c=_['merge']({},_0x51b77c,_0x3ae850['options']);return _0x3b13a3[_0xfa85('0x4c')](_0x51b77c);}})[_0xfa85('0x26')](function(_0x2e9760){if(_0x2e9760){_0x292482=_0x2e9760['length'];if(!_0x3ae850['query'][_0xfa85('0x39')]('nolimit')){_0x51b77c[_0xfa85('0x1e')]=qs[_0xfa85('0x1e')](_0x3ae850[_0xfa85('0x35')][_0xfa85('0x1e')]);_0x51b77c[_0xfa85('0x1c')]=qs[_0xfa85('0x1c')](_0x3ae850[_0xfa85('0x35')]['offset']);}return _0x3b13a3[_0xfa85('0x4c')](_0x51b77c);}})[_0xfa85('0x26')](function(_0x7bbad2){if(_0x7bbad2){return _0x7bbad2?{'count':_0x292482,'rows':_0x7bbad2}:null;}})[_0xfa85('0x26')](respondWithResult(_0x5ba49f,null))[_0xfa85('0x44')](handleError(_0x5ba49f,null));};exports[_0xfa85('0x4f')]=function(_0x5c14cb,_0x45b159,_0x1becde){var _0x176466={};var _0x3288a8={};var _0xeb5dff;var _0x4953fe;return db[_0xfa85('0x2e')][_0xfa85('0x4d')]({'where':{'id':_0x5c14cb[_0xfa85('0x46')]['id']}})[_0xfa85('0x26')](handleEntityNotFound(_0x45b159,null))[_0xfa85('0x26')](function(_0x51a961){if(_0x51a961){_0xeb5dff=_0x51a961;_0x3288a8[_0xfa85('0x33')]=_['keys'](db['SugarcrmField'][_0xfa85('0x2f')]);_0x3288a8[_0xfa85('0x35')]=_['keys'](_0x5c14cb['query']);_0x3288a8[_0xfa85('0x3e')]=_[_0xfa85('0x36')](_0x3288a8[_0xfa85('0x33')],_0x3288a8[_0xfa85('0x35')]);_0x176466['attributes']=_[_0xfa85('0x36')](_0x3288a8['model'],qs['fields'](_0x5c14cb[_0xfa85('0x35')][_0xfa85('0x47')]));_0x176466[_0xfa85('0x37')]=_0x176466[_0xfa85('0x37')][_0xfa85('0x38')]?_0x176466[_0xfa85('0x37')]:_0x3288a8[_0xfa85('0x33')];_0x176466[_0xfa85('0x3b')]=qs[_0xfa85('0x3c')](_0x5c14cb['query']['sort']);_0x176466[_0xfa85('0x3d')]=qs[_0xfa85('0x3e')](_[_0xfa85('0x50')](_0x5c14cb[_0xfa85('0x35')],_0x3288a8[_0xfa85('0x3e')]));if(_0x5c14cb[_0xfa85('0x35')][_0xfa85('0x3f')]){_0x176466[_0xfa85('0x3d')]=_[_0xfa85('0x40')](_0x176466['where'],{'$or':_[_0xfa85('0x2d')](_0x176466['attributes'],function(_0x78183f){var _0x259fe5={};_0x259fe5[_0x78183f]={'$like':'%'+_0x5c14cb[_0xfa85('0x35')][_0xfa85('0x3f')]+'%'};return _0x259fe5;})});}_0x176466=_['merge']({},_0x176466,_0x5c14cb[_0xfa85('0x41')]);return _0xeb5dff['getSubjects'](_0x176466);}})[_0xfa85('0x26')](function(_0x49b2fb){if(_0x49b2fb){_0x4953fe=_0x49b2fb[_0xfa85('0x38')];if(!_0x5c14cb['query']['hasOwnProperty'](_0xfa85('0x3a'))){_0x176466[_0xfa85('0x1e')]=qs[_0xfa85('0x1e')](_0x5c14cb[_0xfa85('0x35')]['limit']);_0x176466[_0xfa85('0x1c')]=qs[_0xfa85('0x1c')](_0x5c14cb['query'][_0xfa85('0x1c')]);}return _0xeb5dff['getSubjects'](_0x176466);}})[_0xfa85('0x26')](function(_0x2e88e5){if(_0x2e88e5){return _0x2e88e5?{'count':_0x4953fe,'rows':_0x2e88e5}:null;}})[_0xfa85('0x26')](respondWithResult(_0x45b159,null))['catch'](handleError(_0x45b159,null));};exports[_0xfa85('0x51')]=function(_0x289fd5,_0x481927,_0x1977d6){var _0x487eaa={};var _0x25f5ea={};var _0x205607;var _0x41fb63;return db[_0xfa85('0x2e')]['findOne']({'where':{'id':_0x289fd5[_0xfa85('0x46')]['id']}})[_0xfa85('0x26')](handleEntityNotFound(_0x481927,null))[_0xfa85('0x26')](function(_0x15d67e){if(_0x15d67e){_0x205607=_0x15d67e;_0x25f5ea['model']=_[_0xfa85('0x34')](db['SugarcrmField'][_0xfa85('0x2f')]);_0x25f5ea[_0xfa85('0x35')]=_['keys'](_0x289fd5['query']);_0x25f5ea[_0xfa85('0x3e')]=_[_0xfa85('0x36')](_0x25f5ea[_0xfa85('0x33')],_0x25f5ea[_0xfa85('0x35')]);_0x487eaa[_0xfa85('0x37')]=_[_0xfa85('0x36')](_0x25f5ea[_0xfa85('0x33')],qs[_0xfa85('0x47')](_0x289fd5[_0xfa85('0x35')][_0xfa85('0x47')]));_0x487eaa[_0xfa85('0x37')]=_0x487eaa['attributes']['length']?_0x487eaa[_0xfa85('0x37')]:_0x25f5ea[_0xfa85('0x33')];_0x487eaa['order']=qs[_0xfa85('0x3c')](_0x289fd5['query'][_0xfa85('0x3c')]);_0x487eaa[_0xfa85('0x3d')]=qs[_0xfa85('0x3e')](_['pick'](_0x289fd5['query'],_0x25f5ea[_0xfa85('0x3e')]));if(_0x289fd5[_0xfa85('0x35')]['filter']){_0x487eaa[_0xfa85('0x3d')]=_[_0xfa85('0x40')](_0x487eaa[_0xfa85('0x3d')],{'$or':_[_0xfa85('0x2d')](_0x487eaa[_0xfa85('0x37')],function(_0x4f0a8d){var _0x26bcfd={};_0x26bcfd[_0x4f0a8d]={'$like':'%'+_0x289fd5[_0xfa85('0x35')][_0xfa85('0x3f')]+'%'};return _0x26bcfd;})});}_0x487eaa=_[_0xfa85('0x40')]({},_0x487eaa,_0x289fd5[_0xfa85('0x41')]);return _0x205607[_0xfa85('0x51')](_0x487eaa);}})[_0xfa85('0x26')](function(_0x24384f){if(_0x24384f){_0x41fb63=_0x24384f[_0xfa85('0x38')];if(!_0x289fd5['query'][_0xfa85('0x39')]('nolimit')){_0x487eaa[_0xfa85('0x1e')]=qs[_0xfa85('0x1e')](_0x289fd5[_0xfa85('0x35')][_0xfa85('0x1e')]);_0x487eaa[_0xfa85('0x1c')]=qs[_0xfa85('0x1c')](_0x289fd5[_0xfa85('0x35')][_0xfa85('0x1c')]);}return _0x205607[_0xfa85('0x51')](_0x487eaa);}})['then'](function(_0x491a8a){if(_0x491a8a){return _0x491a8a?{'count':_0x41fb63,'rows':_0x491a8a}:null;}})[_0xfa85('0x26')](respondWithResult(_0x481927,null))[_0xfa85('0x44')](handleError(_0x481927,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 40f428e..4d5a2ca 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 _0x255c=['int_sugarcrm_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x1db9e7,_0x2b8778){var _0x309f58=function(_0x362d2d){while(--_0x362d2d){_0x1db9e7['push'](_0x1db9e7['shift']());}};_0x309f58(++_0x2b8778);}(_0x255c,0x145));var _0xc255=function(_0x4c7727,_0x4c3e6b){_0x4c7727=_0x4c7727-0x0;var _0x39f3e5=_0x255c[_0x4c7727];return _0x39f3e5;};'use strict';var _=require(_0xc255('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc255('0x1'));var moment=require(_0xc255('0x2'));var BPromise=require(_0xc255('0x3'));var rp=require(_0xc255('0x4'));var fs=require('fs');var path=require(_0xc255('0x5'));var rimraf=require(_0xc255('0x6'));var config=require('../../config/environment');var attributes=require(_0xc255('0x7'));module[_0xc255('0x8')]=function(_0x1871fc,_0x374e23){return _0x1871fc[_0xc255('0x9')](_0xc255('0xa'),attributes,{'tableName':_0xc255('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ee=['rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0xa7ee,0x159));var _0xea7e=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xa7ee[_0x237da8];return _0x558825;};'use strict';var _=require(_0xea7e('0x0'));var util=require('util');var logger=require(_0xea7e('0x1'))(_0xea7e('0x2'));var moment=require(_0xea7e('0x3'));var BPromise=require(_0xea7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xea7e('0x5'));var config=require('../../config/environment');var attributes=require(_0xea7e('0x6'));module[_0xea7e('0x7')]=function(_0x3e99ef,_0x42f578){return _0x3e99ef['define'](_0xea7e('0x8'),attributes,{'tableName':_0xea7e('0x9'),'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 021c4eb..e607519 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 _0xebe9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebe9,0x73));var _0x9ebe=function(_0x27b51f,_0x23841d){_0x27b51f=_0x27b51f-0x0;var _0x10d44c=_0xebe9[_0x27b51f];return _0x10d44c;};'use strict';var _=require(_0x9ebe('0x0'));var util=require('util');var moment=require(_0x9ebe('0x1'));var BPromise=require(_0x9ebe('0x2'));var rs=require(_0x9ebe('0x3'));var fs=require('fs');var Redis=require(_0x9ebe('0x4'));var db=require(_0x9ebe('0x5'))['db'];var utils=require(_0x9ebe('0x6'));var logger=require(_0x9ebe('0x7'))(_0x9ebe('0x8'));var config=require(_0x9ebe('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9ebe('0xa')][_0x9ebe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa8397e,_0x4e9713,_0x54e275){return new BPromise(function(_0x3477d5,_0x4fb99f){return client[_0x9ebe('0xc')](_0xa8397e,_0x54e275)[_0x9ebe('0xd')](function(_0xae63a3){logger[_0x9ebe('0xe')](_0x9ebe('0xf'),_0x4e9713,'request\x20sent');logger[_0x9ebe('0x10')](_0x9ebe('0x11'),_0x4e9713,_0x9ebe('0x12'),JSON['stringify'](_0xae63a3));if(_0xae63a3[_0x9ebe('0x13')]){if(_0xae63a3[_0x9ebe('0x13')][_0x9ebe('0x14')]===0x1f4){logger['error'](_0x9ebe('0xf'),_0x4e9713,_0xae63a3[_0x9ebe('0x13')][_0x9ebe('0x15')]);return _0x4fb99f(_0xae63a3['error']['message']);}logger[_0x9ebe('0x13')](_0x9ebe('0xf'),_0x4e9713,_0xae63a3[_0x9ebe('0x13')]['message']);return _0x3477d5(_0xae63a3[_0x9ebe('0x13')][_0x9ebe('0x15')]);}else{logger['info'](_0x9ebe('0xf'),_0x4e9713,_0x9ebe('0x12'));_0x3477d5(_0xae63a3[_0x9ebe('0x16')][_0x9ebe('0x15')]);}})[_0x9ebe('0x17')](function(_0x4f0c77){logger[_0x9ebe('0x13')](_0x9ebe('0xf'),_0x4e9713,_0x4f0c77);_0x4fb99f(_0x4f0c77);});});} \ No newline at end of file +var _0xa61f=['jayson/promise','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xa61f,0x1a2));var _0xfa61=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xa61f[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xfa61('0x0'));var util=require(_0xfa61('0x1'));var moment=require('moment');var BPromise=require(_0xfa61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa61('0x3'));var db=require(_0xfa61('0x4'))['db'];var utils=require(_0xfa61('0x5'));var logger=require('../../config/logger')(_0xfa61('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa61('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x485350,_0x3c2526,_0x4f0ade){return new BPromise(function(_0xbe25c0,_0x317869){return client['request'](_0x485350,_0x4f0ade)['then'](function(_0x5b5667){logger[_0xfa61('0x8')](_0xfa61('0x9'),_0x3c2526,'request\x20sent');logger[_0xfa61('0xa')](_0xfa61('0xb'),_0x3c2526,'request\x20sent',JSON['stringify'](_0x5b5667));if(_0x5b5667[_0xfa61('0xc')]){if(_0x5b5667[_0xfa61('0xc')][_0xfa61('0xd')]===0x1f4){logger[_0xfa61('0xc')](_0xfa61('0x9'),_0x3c2526,_0x5b5667[_0xfa61('0xc')]['message']);return _0x317869(_0x5b5667[_0xfa61('0xc')][_0xfa61('0xe')]);}logger['error'](_0xfa61('0x9'),_0x3c2526,_0x5b5667['error'][_0xfa61('0xe')]);return _0xbe25c0(_0x5b5667[_0xfa61('0xc')]['message']);}else{logger[_0xfa61('0x8')](_0xfa61('0x9'),_0x3c2526,'request\x20sent');_0xbe25c0(_0x5b5667[_0xfa61('0xf')][_0xfa61('0xe')]);}})[_0xfa61('0x10')](function(_0xbc24c7){logger[_0xfa61('0xc')](_0xfa61('0x9'),_0x3c2526,_0xbc24c7);_0x317869(_0xbc24c7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 07af721..3e7f77c 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 _0xa864=['multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','destroy'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0xa864,0x198));var _0x4a86=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0xa864[_0x358806];return _0x19fdcb;};'use strict';var multer=require(_0x4a86('0x0'));var util=require('util');var path=require(_0x4a86('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a86('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4a86('0x3'));var interaction=require(_0x4a86('0x4'));var config=require(_0x4a86('0x5'));var controller=require('./intSugarcrmField.controller');router[_0x4a86('0x6')]('/',auth[_0x4a86('0x7')](),controller['index']);router[_0x4a86('0x6')](_0x4a86('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4a86('0x9')]);router[_0x4a86('0xa')](_0x4a86('0x8'),auth[_0x4a86('0x7')](),controller['update']);router['delete'](_0x4a86('0x8'),auth['isAuthenticated'](),controller[_0x4a86('0xb')]);module['exports']=router; \ No newline at end of file +var _0xf9a6=['show','post','create','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id'];(function(_0x29e7fa,_0x231b9c){var _0x93b500=function(_0x23d559){while(--_0x23d559){_0x29e7fa['push'](_0x29e7fa['shift']());}};_0x93b500(++_0x231b9c);}(_0xf9a6,0x116));var _0x6f9a=function(_0x2be3cc,_0x670acd){_0x2be3cc=_0x2be3cc-0x0;var _0x15e630=_0xf9a6[_0x2be3cc];return _0x15e630;};'use strict';var multer=require(_0x6f9a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6f9a('0x1'));var router=express[_0x6f9a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f9a('0x3'));var interaction=require(_0x6f9a('0x4'));var config=require(_0x6f9a('0x5'));var controller=require(_0x6f9a('0x6'));router[_0x6f9a('0x7')]('/',auth[_0x6f9a('0x8')](),controller['index']);router['get'](_0x6f9a('0x9'),auth[_0x6f9a('0x8')](),controller[_0x6f9a('0xa')]);router[_0x6f9a('0xb')]('/',auth[_0x6f9a('0x8')](),controller[_0x6f9a('0xc')]);router[_0x6f9a('0xd')]('/:id',auth[_0x6f9a('0x8')](),controller[_0x6f9a('0xe')]);router[_0x6f9a('0xf')](_0x6f9a('0x9'),auth[_0x6f9a('0x8')](),controller[_0x6f9a('0x10')]);module[_0x6f9a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index c12c457..231908e 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 _0xa734=['string','variable','customVariable','keyValue','picklist','STRING','exports','ENUM'];(function(_0x235fbd,_0x40807a){var _0x12adc3=function(_0x57316f){while(--_0x57316f){_0x235fbd['push'](_0x235fbd['shift']());}};_0x12adc3(++_0x40807a);}(_0xa734,0x96));var _0x4a73=function(_0x570f66,_0x1adea9){_0x570f66=_0x570f66-0x0;var _0x3d5fff=_0xa734[_0x570f66];return _0x3d5fff;};'use strict';var Sequelize=require('sequelize');module[_0x4a73('0x0')]={'type':{'type':Sequelize[_0x4a73('0x1')](_0x4a73('0x2'),_0x4a73('0x3'),_0x4a73('0x4'),_0x4a73('0x5'),_0x4a73('0x6')),'defaultValue':_0x4a73('0x2')},'content':{'type':Sequelize[_0x4a73('0x7')]},'key':{'type':Sequelize[_0x4a73('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4a73('0x2'),_0x4a73('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4a73('0x7')]},'idField':{'type':Sequelize[_0x4a73('0x7')]},'nameField':{'type':Sequelize[_0x4a73('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4a73('0x7')]}}; \ No newline at end of file +var _0x9559=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x365ef2,_0x54605a){var _0x4ab5f3=function(_0x192338){while(--_0x192338){_0x365ef2['push'](_0x365ef2['shift']());}};_0x4ab5f3(++_0x54605a);}(_0x9559,0x6a));var _0x9955=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0x9559[_0x2a4095];return _0x52eeab;};'use strict';var Sequelize=require(_0x9955('0x0'));module[_0x9955('0x1')]={'type':{'type':Sequelize[_0x9955('0x2')](_0x9955('0x3'),_0x9955('0x4'),_0x9955('0x5'),'keyValue',_0x9955('0x6')),'defaultValue':_0x9955('0x3')},'content':{'type':Sequelize[_0x9955('0x7')]},'key':{'type':Sequelize[_0x9955('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x9955('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9955('0x7')]},'nameField':{'type':Sequelize[_0x9955('0x7')]},'customField':{'type':Sequelize[_0x9955('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9955('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5c89656..cf1aefb 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 _0x354c=['intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','include','findAll','rows','catch','show','keys','fields','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmField','rawAttributes','key','model','query','filters'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x354c,0x194));var _0xc354=function(_0x1a5286,_0x436e0e){_0x1a5286=_0x1a5286-0x0;var _0xf26a99=_0x354c[_0x1a5286];return _0xf26a99;};'use strict';var emlformat=require(_0xc354('0x0'));var rimraf=require(_0xc354('0x1'));var zipdir=require(_0xc354('0x2'));var jsonpatch=require(_0xc354('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc354('0x4'));var Mustache=require('mustache');var util=require(_0xc354('0x5'));var path=require('path');var sox=require(_0xc354('0x6'));var csv=require('to-csv');var ejs=require(_0xc354('0x7'));var fs=require('fs');var fs_extra=require(_0xc354('0x8'));var _=require(_0xc354('0x9'));var squel=require(_0xc354('0xa'));var crypto=require(_0xc354('0xb'));var jsforce=require(_0xc354('0xc'));var deskjs=require(_0xc354('0xd'));var toCsv=require(_0xc354('0xe'));var querystring=require(_0xc354('0xf'));var Papa=require(_0xc354('0x10'));var Redis=require(_0xc354('0x11'));var authService=require(_0xc354('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc354('0x13'));var hardwareService=require(_0xc354('0x14'));var logger=require(_0xc354('0x15'))(_0xc354('0x16'));var utils=require(_0xc354('0x17'));var config=require(_0xc354('0x18'));var licenseUtil=require(_0xc354('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4785ea,_0x4df522){_0x4df522=_0x4df522||0xcc;return function(_0x43537d){if(_0x43537d){return _0x4785ea[_0xc354('0x1a')](_0x4df522);}return _0x4785ea[_0xc354('0x1b')](_0x4df522)[_0xc354('0x1c')]();};}function respondWithResult(_0x4e8082,_0x9b2f9b){_0x9b2f9b=_0x9b2f9b||0xc8;return function(_0x2b04e7){if(_0x2b04e7){return _0x4e8082[_0xc354('0x1b')](_0x9b2f9b)['json'](_0x2b04e7);}};}function respondWithFilteredResult(_0x2ef66f,_0x3a78e8){return function(_0x2ded6c){if(_0x2ded6c){var _0x4f890a=typeof _0x3a78e8[_0xc354('0x1d')]===_0xc354('0x1e')&&typeof _0x3a78e8[_0xc354('0x1f')]==='undefined';var _0x33c7a3=_0x2ded6c[_0xc354('0x20')];var _0x52ea81=_0x4f890a?0x0:_0x3a78e8[_0xc354('0x1d')];var _0x1a0994=_0x4f890a?_0x2ded6c[_0xc354('0x20')]:_0x3a78e8[_0xc354('0x1d')]+_0x3a78e8[_0xc354('0x1f')];var _0x565687;if(_0x1a0994>=_0x33c7a3){_0x1a0994=_0x33c7a3;_0x565687=0xc8;}else{_0x565687=0xce;}_0x2ef66f[_0xc354('0x1b')](_0x565687);return _0x2ef66f['set'](_0xc354('0x21'),_0x52ea81+'-'+_0x1a0994+'/'+_0x33c7a3)[_0xc354('0x22')](_0x2ded6c);}return null;};}function patchUpdates(_0x5e60e2){return function(_0x9dfbc){try{jsonpatch[_0xc354('0x23')](_0x9dfbc,_0x5e60e2,!![]);}catch(_0xdc31ad){return BPromise[_0xc354('0x24')](_0xdc31ad);}return _0x9dfbc[_0xc354('0x25')]();};}function saveUpdates(_0x30ac34,_0xf5bcb4){return function(_0x534e18){if(_0x534e18){return _0x534e18[_0xc354('0x26')](_0x30ac34)[_0xc354('0x27')](function(_0x5cd8e3){return _0x5cd8e3;});}return null;};}function removeEntity(_0x329058,_0x5ce511){return function(_0x2741db){if(_0x2741db){return _0x2741db[_0xc354('0x28')]()[_0xc354('0x27')](function(){_0x329058[_0xc354('0x1b')](0xcc)[_0xc354('0x1c')]();});}};}function handleEntityNotFound(_0x3e2097,_0x4af941){return function(_0x556a56){if(!_0x556a56){_0x3e2097['sendStatus'](0x194);}return _0x556a56;};}function handleError(_0x22cf34,_0x560b09){_0x560b09=_0x560b09||0x1f4;return function(_0xf065e9){logger[_0xc354('0x29')](_0xf065e9[_0xc354('0x2a')]);if(_0xf065e9[_0xc354('0x2b')]){delete _0xf065e9['name'];}_0x22cf34[_0xc354('0x1b')](_0x560b09)['send'](_0xf065e9);};}exports[_0xc354('0x2c')]=function(_0x38d1e6,_0x2961fb){var _0x38cdc5={},_0x299bcd={},_0x292169={'count':0x0,'rows':[]};var _0x4d127f=_[_0xc354('0x2d')](db[_0xc354('0x2e')][_0xc354('0x2f')],function(_0x4dac23){return{'name':_0x4dac23['fieldName'],'type':_0x4dac23['type'][_0xc354('0x30')]};});_0x299bcd[_0xc354('0x31')]=_['map'](_0x4d127f,_0xc354('0x2b'));_0x299bcd[_0xc354('0x32')]=_['keys'](_0x38d1e6['query']);_0x299bcd[_0xc354('0x33')]=_[_0xc354('0x34')](_0x299bcd[_0xc354('0x31')],_0x299bcd[_0xc354('0x32')]);_0x38cdc5[_0xc354('0x35')]=_[_0xc354('0x34')](_0x299bcd[_0xc354('0x31')],qs['fields'](_0x38d1e6[_0xc354('0x32')]['fields']));_0x38cdc5[_0xc354('0x35')]=_0x38cdc5[_0xc354('0x35')][_0xc354('0x36')]?_0x38cdc5[_0xc354('0x35')]:_0x299bcd[_0xc354('0x31')];if(!_0x38d1e6['query'][_0xc354('0x37')]('nolimit')){_0x38cdc5['limit']=qs['limit'](_0x38d1e6[_0xc354('0x32')]['limit']);_0x38cdc5[_0xc354('0x1d')]=qs[_0xc354('0x1d')](_0x38d1e6['query'][_0xc354('0x1d')]);}_0x38cdc5[_0xc354('0x38')]=qs[_0xc354('0x39')](_0x38d1e6[_0xc354('0x32')]['sort']);_0x38cdc5[_0xc354('0x3a')]=qs['filters'](_[_0xc354('0x3b')](_0x38d1e6[_0xc354('0x32')],_0x299bcd[_0xc354('0x33')]),_0x4d127f);if(_0x38d1e6['query'][_0xc354('0x3c')]){_0x38cdc5[_0xc354('0x3a')]=_[_0xc354('0x3d')](_0x38cdc5[_0xc354('0x3a')],{'$or':_[_0xc354('0x2d')](_0x4d127f,function(_0x4a789e){if(_0x4a789e[_0xc354('0x3e')]!=='VIRTUAL'){var _0x2f0924={};_0x2f0924[_0x4a789e[_0xc354('0x2b')]]={'$like':'%'+_0x38d1e6[_0xc354('0x32')][_0xc354('0x3c')]+'%'};return _0x2f0924;}})});}_0x38cdc5=_[_0xc354('0x3d')]({},_0x38cdc5,_0x38d1e6['options']);var _0x1748c2={'where':_0x38cdc5[_0xc354('0x3a')]};return db[_0xc354('0x2e')][_0xc354('0x20')](_0x1748c2)[_0xc354('0x27')](function(_0x3dae9b){_0x292169['count']=_0x3dae9b;if(_0x38d1e6[_0xc354('0x32')]['includeAll']){_0x38cdc5[_0xc354('0x3f')]=[{'all':!![]}];}return db[_0xc354('0x2e')][_0xc354('0x40')](_0x38cdc5);})['then'](function(_0x3d9e27){_0x292169[_0xc354('0x41')]=_0x3d9e27;return _0x292169;})[_0xc354('0x27')](respondWithFilteredResult(_0x2961fb,_0x38cdc5))[_0xc354('0x42')](handleError(_0x2961fb,null));};exports[_0xc354('0x43')]=function(_0x678dbf,_0xd13641){var _0x221cb3={'raw':!![],'where':{'id':_0x678dbf['params']['id']}},_0x297f39={};_0x297f39[_0xc354('0x31')]=_[_0xc354('0x44')](db['SugarcrmField'][_0xc354('0x2f')]);_0x297f39[_0xc354('0x32')]=_[_0xc354('0x44')](_0x678dbf[_0xc354('0x32')]);_0x297f39[_0xc354('0x33')]=_[_0xc354('0x34')](_0x297f39[_0xc354('0x31')],_0x297f39[_0xc354('0x32')]);_0x221cb3['attributes']=_[_0xc354('0x34')](_0x297f39[_0xc354('0x31')],qs['fields'](_0x678dbf['query'][_0xc354('0x45')]));_0x221cb3[_0xc354('0x35')]=_0x221cb3[_0xc354('0x35')][_0xc354('0x36')]?_0x221cb3[_0xc354('0x35')]:_0x297f39[_0xc354('0x31')];if(_0x678dbf[_0xc354('0x32')][_0xc354('0x46')]){_0x221cb3[_0xc354('0x3f')]=[{'all':!![]}];}_0x221cb3=_[_0xc354('0x3d')]({},_0x221cb3,_0x678dbf[_0xc354('0x47')]);return db[_0xc354('0x2e')][_0xc354('0x48')](_0x221cb3)['then'](handleEntityNotFound(_0xd13641,null))['then'](respondWithResult(_0xd13641,null))[_0xc354('0x42')](handleError(_0xd13641,null));};exports[_0xc354('0x49')]=function(_0x188029,_0x3e9e6f){return db[_0xc354('0x2e')]['create'](_0x188029[_0xc354('0x4a')],{})[_0xc354('0x27')](respondWithResult(_0x3e9e6f,0xc9))['catch'](handleError(_0x3e9e6f,null));};exports[_0xc354('0x26')]=function(_0x384e35,_0x1275d2){if(_0x384e35[_0xc354('0x4a')]['id']){delete _0x384e35[_0xc354('0x4a')]['id'];}return db['SugarcrmField'][_0xc354('0x48')]({'where':{'id':_0x384e35['params']['id']}})[_0xc354('0x27')](handleEntityNotFound(_0x1275d2,null))[_0xc354('0x27')](saveUpdates(_0x384e35[_0xc354('0x4a')],null))[_0xc354('0x27')](respondWithResult(_0x1275d2,null))[_0xc354('0x42')](handleError(_0x1275d2,null));};exports['destroy']=function(_0x237c50,_0x1ff93f){return db['SugarcrmField'][_0xc354('0x48')]({'where':{'id':_0x237c50[_0xc354('0x4b')]['id']}})[_0xc354('0x27')](handleEntityNotFound(_0x1ff93f,null))[_0xc354('0x27')](removeEntity(_0x1ff93f,null))[_0xc354('0x42')](handleError(_0x1ff93f,null));}; \ No newline at end of file +var _0x0cb5=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0cb5,0xcb));var _0x50cb=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x0cb5[_0x28d18d];return _0x470640;};'use strict';var emlformat=require(_0x50cb('0x0'));var rimraf=require(_0x50cb('0x1'));var zipdir=require(_0x50cb('0x2'));var jsonpatch=require(_0x50cb('0x3'));var rp=require('request-promise');var moment=require(_0x50cb('0x4'));var BPromise=require(_0x50cb('0x5'));var Mustache=require(_0x50cb('0x6'));var util=require(_0x50cb('0x7'));var path=require('path');var sox=require(_0x50cb('0x8'));var csv=require(_0x50cb('0x9'));var ejs=require(_0x50cb('0xa'));var fs=require('fs');var fs_extra=require(_0x50cb('0xb'));var _=require(_0x50cb('0xc'));var squel=require(_0x50cb('0xd'));var crypto=require(_0x50cb('0xe'));var jsforce=require(_0x50cb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x50cb('0x9'));var querystring=require('querystring');var Papa=require(_0x50cb('0x10'));var Redis=require(_0x50cb('0x11'));var authService=require(_0x50cb('0x12'));var qs=require(_0x50cb('0x13'));var as=require(_0x50cb('0x14'));var hardwareService=require(_0x50cb('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x50cb('0x16'));var licenseUtil=require(_0x50cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ded28,_0xe50794){_0xe50794=_0xe50794||0xcc;return function(_0x1cb14f){if(_0x1cb14f){return _0x1ded28[_0x50cb('0x18')](_0xe50794);}return _0x1ded28[_0x50cb('0x19')](_0xe50794)[_0x50cb('0x1a')]();};}function respondWithResult(_0x57b9ed,_0x5be31a){_0x5be31a=_0x5be31a||0xc8;return function(_0x1e363d){if(_0x1e363d){return _0x57b9ed[_0x50cb('0x19')](_0x5be31a)['json'](_0x1e363d);}};}function respondWithFilteredResult(_0x5846da,_0x33e2f3){return function(_0x81e26b){if(_0x81e26b){var _0x1298ba=typeof _0x33e2f3[_0x50cb('0x1b')]===_0x50cb('0x1c')&&typeof _0x33e2f3[_0x50cb('0x1d')]==='undefined';var _0x226c95=_0x81e26b[_0x50cb('0x1e')];var _0x748f03=_0x1298ba?0x0:_0x33e2f3[_0x50cb('0x1b')];var _0x4b538b=_0x1298ba?_0x81e26b[_0x50cb('0x1e')]:_0x33e2f3[_0x50cb('0x1b')]+_0x33e2f3[_0x50cb('0x1d')];var _0x1b2ecd;if(_0x4b538b>=_0x226c95){_0x4b538b=_0x226c95;_0x1b2ecd=0xc8;}else{_0x1b2ecd=0xce;}_0x5846da[_0x50cb('0x19')](_0x1b2ecd);return _0x5846da['set'](_0x50cb('0x1f'),_0x748f03+'-'+_0x4b538b+'/'+_0x226c95)[_0x50cb('0x20')](_0x81e26b);}return null;};}function patchUpdates(_0x179b4d){return function(_0x5b395c){try{jsonpatch[_0x50cb('0x21')](_0x5b395c,_0x179b4d,!![]);}catch(_0x1966d6){return BPromise[_0x50cb('0x22')](_0x1966d6);}return _0x5b395c[_0x50cb('0x23')]();};}function saveUpdates(_0x3b6593,_0x41b029){return function(_0xd94014){if(_0xd94014){return _0xd94014[_0x50cb('0x24')](_0x3b6593)[_0x50cb('0x25')](function(_0x1d577c){return _0x1d577c;});}return null;};}function removeEntity(_0x24e470,_0x528cc8){return function(_0x418ebe){if(_0x418ebe){return _0x418ebe[_0x50cb('0x26')]()[_0x50cb('0x25')](function(){_0x24e470[_0x50cb('0x19')](0xcc)[_0x50cb('0x1a')]();});}};}function handleEntityNotFound(_0x431865,_0xea6f8){return function(_0x285d13){if(!_0x285d13){_0x431865[_0x50cb('0x18')](0x194);}return _0x285d13;};}function handleError(_0x187784,_0x489f16){_0x489f16=_0x489f16||0x1f4;return function(_0x20235b){logger['error'](_0x20235b[_0x50cb('0x27')]);if(_0x20235b[_0x50cb('0x28')]){delete _0x20235b[_0x50cb('0x28')];}_0x187784[_0x50cb('0x19')](_0x489f16)[_0x50cb('0x29')](_0x20235b);};}exports['index']=function(_0x150ccf,_0x35fd7c){var _0x48200b={},_0x2623a1={},_0x35f774={'count':0x0,'rows':[]};var _0xeba961=_[_0x50cb('0x2a')](db[_0x50cb('0x2b')][_0x50cb('0x2c')],function(_0x502799){return{'name':_0x502799[_0x50cb('0x2d')],'type':_0x502799[_0x50cb('0x2e')][_0x50cb('0x2f')]};});_0x2623a1[_0x50cb('0x30')]=_[_0x50cb('0x2a')](_0xeba961,_0x50cb('0x28'));_0x2623a1['query']=_[_0x50cb('0x31')](_0x150ccf[_0x50cb('0x32')]);_0x2623a1[_0x50cb('0x33')]=_['intersection'](_0x2623a1[_0x50cb('0x30')],_0x2623a1['query']);_0x48200b[_0x50cb('0x34')]=_['intersection'](_0x2623a1[_0x50cb('0x30')],qs[_0x50cb('0x35')](_0x150ccf[_0x50cb('0x32')][_0x50cb('0x35')]));_0x48200b[_0x50cb('0x34')]=_0x48200b[_0x50cb('0x34')][_0x50cb('0x36')]?_0x48200b['attributes']:_0x2623a1[_0x50cb('0x30')];if(!_0x150ccf['query'][_0x50cb('0x37')](_0x50cb('0x38'))){_0x48200b[_0x50cb('0x1d')]=qs[_0x50cb('0x1d')](_0x150ccf[_0x50cb('0x32')][_0x50cb('0x1d')]);_0x48200b['offset']=qs['offset'](_0x150ccf[_0x50cb('0x32')][_0x50cb('0x1b')]);}_0x48200b[_0x50cb('0x39')]=qs[_0x50cb('0x3a')](_0x150ccf[_0x50cb('0x32')]['sort']);_0x48200b[_0x50cb('0x3b')]=qs[_0x50cb('0x33')](_[_0x50cb('0x3c')](_0x150ccf[_0x50cb('0x32')],_0x2623a1[_0x50cb('0x33')]),_0xeba961);if(_0x150ccf[_0x50cb('0x32')][_0x50cb('0x3d')]){_0x48200b[_0x50cb('0x3b')]=_[_0x50cb('0x3e')](_0x48200b['where'],{'$or':_['map'](_0xeba961,function(_0x2d53d9){if(_0x2d53d9['type']!==_0x50cb('0x3f')){var _0x58c6ad={};_0x58c6ad[_0x2d53d9[_0x50cb('0x28')]]={'$like':'%'+_0x150ccf[_0x50cb('0x32')][_0x50cb('0x3d')]+'%'};return _0x58c6ad;}})});}_0x48200b=_[_0x50cb('0x3e')]({},_0x48200b,_0x150ccf[_0x50cb('0x40')]);var _0xed1e9={'where':_0x48200b[_0x50cb('0x3b')]};return db[_0x50cb('0x2b')][_0x50cb('0x1e')](_0xed1e9)[_0x50cb('0x25')](function(_0x5257cb){_0x35f774[_0x50cb('0x1e')]=_0x5257cb;if(_0x150ccf[_0x50cb('0x32')][_0x50cb('0x41')]){_0x48200b[_0x50cb('0x42')]=[{'all':!![]}];}return db[_0x50cb('0x2b')][_0x50cb('0x43')](_0x48200b);})['then'](function(_0x49aac5){_0x35f774['rows']=_0x49aac5;return _0x35f774;})[_0x50cb('0x25')](respondWithFilteredResult(_0x35fd7c,_0x48200b))[_0x50cb('0x44')](handleError(_0x35fd7c,null));};exports[_0x50cb('0x45')]=function(_0x482c69,_0x3ec844){var _0x42de16={'raw':!![],'where':{'id':_0x482c69[_0x50cb('0x46')]['id']}},_0x521013={};_0x521013['model']=_['keys'](db[_0x50cb('0x2b')][_0x50cb('0x2c')]);_0x521013[_0x50cb('0x32')]=_[_0x50cb('0x31')](_0x482c69[_0x50cb('0x32')]);_0x521013[_0x50cb('0x33')]=_[_0x50cb('0x47')](_0x521013['model'],_0x521013[_0x50cb('0x32')]);_0x42de16['attributes']=_[_0x50cb('0x47')](_0x521013[_0x50cb('0x30')],qs[_0x50cb('0x35')](_0x482c69[_0x50cb('0x32')][_0x50cb('0x35')]));_0x42de16[_0x50cb('0x34')]=_0x42de16['attributes'][_0x50cb('0x36')]?_0x42de16[_0x50cb('0x34')]:_0x521013[_0x50cb('0x30')];if(_0x482c69['query'][_0x50cb('0x41')]){_0x42de16[_0x50cb('0x42')]=[{'all':!![]}];}_0x42de16=_[_0x50cb('0x3e')]({},_0x42de16,_0x482c69[_0x50cb('0x40')]);return db[_0x50cb('0x2b')]['find'](_0x42de16)[_0x50cb('0x25')](handleEntityNotFound(_0x3ec844,null))[_0x50cb('0x25')](respondWithResult(_0x3ec844,null))[_0x50cb('0x44')](handleError(_0x3ec844,null));};exports[_0x50cb('0x48')]=function(_0x248aa4,_0x4ece8c){return db[_0x50cb('0x2b')][_0x50cb('0x48')](_0x248aa4['body'],{})[_0x50cb('0x25')](respondWithResult(_0x4ece8c,0xc9))[_0x50cb('0x44')](handleError(_0x4ece8c,null));};exports[_0x50cb('0x24')]=function(_0x3ea3e0,_0x34951c){if(_0x3ea3e0[_0x50cb('0x49')]['id']){delete _0x3ea3e0['body']['id'];}return db[_0x50cb('0x2b')]['find']({'where':{'id':_0x3ea3e0[_0x50cb('0x46')]['id']}})[_0x50cb('0x25')](handleEntityNotFound(_0x34951c,null))['then'](saveUpdates(_0x3ea3e0['body'],null))[_0x50cb('0x25')](respondWithResult(_0x34951c,null))[_0x50cb('0x44')](handleError(_0x34951c,null));};exports[_0x50cb('0x26')]=function(_0x43855e,_0x53b923){return db['SugarcrmField']['find']({'where':{'id':_0x43855e[_0x50cb('0x46')]['id']}})[_0x50cb('0x25')](handleEntityNotFound(_0x53b923,null))['then'](removeEntity(_0x53b923,null))[_0x50cb('0x44')](handleError(_0x53b923,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index bfae0b6..e7d7571 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 _0xfbbd=['idField','FieldId','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x22cea3,_0x56d0ce){var _0x2fbfee=function(_0xceb636){while(--_0xceb636){_0x22cea3['push'](_0x22cea3['shift']());}};_0x2fbfee(++_0x56d0ce);}(_0xfbbd,0x179));var _0xdfbb=function(_0x46726e,_0x2fdbcf){_0x46726e=_0x46726e-0x0;var _0x41535e=_0xfbbd[_0x46726e];return _0x41535e;};'use strict';var _=require(_0xdfbb('0x0'));var util=require(_0xdfbb('0x1'));var logger=require(_0xdfbb('0x2'))(_0xdfbb('0x3'));var moment=require(_0xdfbb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdfbb('0x5'));var config=require(_0xdfbb('0x6'));var attributes=require(_0xdfbb('0x7'));module[_0xdfbb('0x8')]=function(_0x57e7ea,_0x32daa7){return _0x57e7ea[_0xdfbb('0x9')](_0xdfbb('0xa'),attributes,{'tableName':_0xdfbb('0xb'),'paranoid':![],'indexes':[{'name':_0xdfbb('0xc'),'fields':[_0xdfbb('0xd'),_0xdfbb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2868=['SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x4e0004,_0x47e0f2){var _0x15f523=function(_0x375e8c){while(--_0x375e8c){_0x4e0004['push'](_0x4e0004['shift']());}};_0x15f523(++_0x47e0f2);}(_0x2868,0xd6));var _0x8286=function(_0x46446c,_0x1f8e36){_0x46446c=_0x46446c-0x0;var _0x3fa775=_0x2868[_0x46446c];return _0x3fa775;};'use strict';var _=require(_0x8286('0x0'));var util=require(_0x8286('0x1'));var logger=require(_0x8286('0x2'))(_0x8286('0x3'));var moment=require(_0x8286('0x4'));var BPromise=require(_0x8286('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8286('0x6'));var rimraf=require(_0x8286('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x8286('0x8')]=function(_0x520cae,_0x657452){return _0x520cae[_0x8286('0x9')](_0x8286('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x8286('0xb'),'fields':[_0x8286('0xc'),_0x8286('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 87ef12a..67554a0 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 _0xff79=['../../mysqldb','../../config/environment','jayson/promise','request','then','request\x20sent','stringify','error','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x2329d7,_0x4296b6){var _0x201e8c=function(_0x3b3aac){while(--_0x3b3aac){_0x2329d7['push'](_0x2329d7['shift']());}};_0x201e8c(++_0x4296b6);}(_0xff79,0x67));var _0x9ff7=function(_0x427298,_0x248100){_0x427298=_0x427298-0x0;var _0x36d3c2=_0xff79[_0x427298];return _0x36d3c2;};'use strict';var _=require(_0x9ff7('0x0'));var util=require(_0x9ff7('0x1'));var moment=require(_0x9ff7('0x2'));var BPromise=require(_0x9ff7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ff7('0x4'));var db=require(_0x9ff7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9ff7('0x6'));var jayson=require(_0x9ff7('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b813a,_0x247947,_0x1db177){return new BPromise(function(_0x2c7980,_0x2d113f){return client[_0x9ff7('0x8')](_0x5b813a,_0x1db177)[_0x9ff7('0x9')](function(_0x271574){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x247947,'request\x20sent');logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x247947,_0x9ff7('0xa'),JSON[_0x9ff7('0xb')](_0x271574));if(_0x271574[_0x9ff7('0xc')]){if(_0x271574['error']['code']===0x1f4){logger[_0x9ff7('0xc')](_0x9ff7('0xd'),_0x247947,_0x271574[_0x9ff7('0xc')][_0x9ff7('0xe')]);return _0x2d113f(_0x271574[_0x9ff7('0xc')][_0x9ff7('0xe')]);}logger[_0x9ff7('0xc')](_0x9ff7('0xd'),_0x247947,_0x271574[_0x9ff7('0xc')][_0x9ff7('0xe')]);return _0x2c7980(_0x271574[_0x9ff7('0xc')][_0x9ff7('0xe')]);}else{logger[_0x9ff7('0xf')](_0x9ff7('0xd'),_0x247947,_0x9ff7('0xa'));_0x2c7980(_0x271574[_0x9ff7('0x10')][_0x9ff7('0xe')]);}})[_0x9ff7('0x11')](function(_0x5246d0){logger['error'](_0x9ff7('0xd'),_0x247947,_0x5246d0);_0x2d113f(_0x5246d0);});});} \ No newline at end of file +var _0xd03a=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xd03a,0x190));var _0xad03=function(_0x4b8591,_0x1f1e23){_0x4b8591=_0x4b8591-0x0;var _0x427f0f=_0xd03a[_0x4b8591];return _0x427f0f;};'use strict';var _=require(_0xad03('0x0'));var util=require(_0xad03('0x1'));var moment=require(_0xad03('0x2'));var BPromise=require(_0xad03('0x3'));var rs=require(_0xad03('0x4'));var fs=require('fs');var Redis=require(_0xad03('0x5'));var db=require(_0xad03('0x6'))['db'];var utils=require(_0xad03('0x7'));var logger=require(_0xad03('0x8'))(_0xad03('0x9'));var config=require(_0xad03('0xa'));var jayson=require(_0xad03('0xb'));var client=jayson[_0xad03('0xc')][_0xad03('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c53ea,_0x409a47,_0x4515c){return new BPromise(function(_0x126fba,_0x560445){return client[_0xad03('0xe')](_0x3c53ea,_0x4515c)[_0xad03('0xf')](function(_0x22bcd3){logger[_0xad03('0x10')](_0xad03('0x11'),_0x409a47,_0xad03('0x12'));logger[_0xad03('0x13')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x409a47,'request\x20sent',JSON[_0xad03('0x14')](_0x22bcd3));if(_0x22bcd3[_0xad03('0x15')]){if(_0x22bcd3[_0xad03('0x15')][_0xad03('0x16')]===0x1f4){logger['error'](_0xad03('0x11'),_0x409a47,_0x22bcd3['error']['message']);return _0x560445(_0x22bcd3[_0xad03('0x15')][_0xad03('0x17')]);}logger[_0xad03('0x15')](_0xad03('0x11'),_0x409a47,_0x22bcd3[_0xad03('0x15')][_0xad03('0x17')]);return _0x126fba(_0x22bcd3['error']['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x409a47,'request\x20sent');_0x126fba(_0x22bcd3[_0xad03('0x18')][_0xad03('0x17')]);}})[_0xad03('0x19')](function(_0x5b863c){logger[_0xad03('0x15')](_0xad03('0x11'),_0x409a47,_0x5b863c);_0x560445(_0x5b863c);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 45ce58b..d626660 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 _0x33a4=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33a4,0x88));var _0x433a=function(_0x401121,_0x181adb){_0x401121=_0x401121-0x0;var _0x3aef8f=_0x33a4[_0x401121];return _0x3aef8f;};'use strict';var multer=require('multer');var util=require(_0x433a('0x0'));var path=require('path');var timeout=require(_0x433a('0x1'));var express=require(_0x433a('0x2'));var router=express[_0x433a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x433a('0x4'));var controller=require(_0x433a('0x5'));router[_0x433a('0x6')]('/',auth[_0x433a('0x7')](),controller[_0x433a('0x8')]);router['get'](_0x433a('0x9'),auth['isAuthenticated'](),controller[_0x433a('0xa')]);router[_0x433a('0x6')](_0x433a('0xb'),auth[_0x433a('0x7')](),controller['getConfigurations']);router['get'](_0x433a('0xc'),auth[_0x433a('0x7')](),controller[_0x433a('0xd')]);router[_0x433a('0xe')]('/',auth[_0x433a('0x7')](),controller['create']);router['post'](_0x433a('0xb'),auth[_0x433a('0x7')](),controller[_0x433a('0xf')]);router[_0x433a('0x10')]('/:id',auth[_0x433a('0x7')](),controller[_0x433a('0x11')]);router['delete'](_0x433a('0x9'),auth['isAuthenticated'](),controller[_0x433a('0x12')]);module[_0x433a('0x13')]=router; \ No newline at end of file +var _0xe893=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','addConfiguration','put','update','delete','destroy'];(function(_0x5dd25c,_0x1cf7fe){var _0x563768=function(_0x7dc057){while(--_0x7dc057){_0x5dd25c['push'](_0x5dd25c['shift']());}};_0x563768(++_0x1cf7fe);}(_0xe893,0xbe));var _0x3e89=function(_0x39fa7e,_0x1da9b1){_0x39fa7e=_0x39fa7e-0x0;var _0x4a5408=_0xe893[_0x39fa7e];return _0x4a5408;};'use strict';var multer=require('multer');var util=require(_0x3e89('0x0'));var path=require(_0x3e89('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e89('0x2'));var router=express[_0x3e89('0x3')]();var fs_extra=require(_0x3e89('0x4'));var auth=require(_0x3e89('0x5'));var interaction=require(_0x3e89('0x6'));var config=require('../../config/environment');var controller=require(_0x3e89('0x7'));router[_0x3e89('0x8')]('/',auth[_0x3e89('0x9')](),controller['index']);router[_0x3e89('0x8')](_0x3e89('0xa'),auth[_0x3e89('0x9')](),controller[_0x3e89('0xb')]);router['get'](_0x3e89('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x3e89('0xd'),auth[_0x3e89('0x9')](),controller['getFields']);router['post']('/',auth[_0x3e89('0x9')](),controller['create']);router[_0x3e89('0xe')](_0x3e89('0xc'),auth['isAuthenticated'](),controller[_0x3e89('0xf')]);router[_0x3e89('0x10')](_0x3e89('0xa'),auth['isAuthenticated'](),controller[_0x3e89('0x11')]);router[_0x3e89('0x12')](_0x3e89('0xa'),auth[_0x3e89('0x9')](),controller[_0x3e89('0x13')]);module[_0x3e89('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index dd798dc..81f503e 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 _0xd943=['exports','STRING','sequelize'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xd943,0x11c));var _0x3d94=function(_0x510c44,_0x3ed5a0){_0x510c44=_0x510c44-0x0;var _0x52115a=_0xd943[_0x510c44];return _0x52115a;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xec44=['HelpDesk','sequelize','STRING'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xec44,0x196));var _0x4ec4=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xec44[_0x2b305c];return _0x5d8c85;};'use strict';var Sequelize=require(_0x4ec4('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ec4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4ec4('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4ec4('0x1')],'allowNull':![],'defaultValue':_0x4ec4('0x2')},'remoteUri':{'type':Sequelize[_0x4ec4('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4ec4('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index c2fc972..0766b20 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 _0x67f9=['nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','VtigerField','Descriptions','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','slice','substring','GET','getchallenge','username','success','login','describe','result','sessionName','autogenerated','owner','remove','editable','false','label','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','include','options','find','create','body','catch','params','getConfigurations','findOne','VtigerConfiguration','order','sort','hasOwnProperty'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x67f9,0x117));var _0x967f=function(_0x283bd6,_0xc85a1e){_0x283bd6=_0x283bd6-0x0;var _0x34eab0=_0x67f9[_0x283bd6];return _0x34eab0;};'use strict';var emlformat=require(_0x967f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x967f('0x1'));var jsonpatch=require(_0x967f('0x2'));var rp=require(_0x967f('0x3'));var moment=require('moment');var BPromise=require(_0x967f('0x4'));var Mustache=require(_0x967f('0x5'));var util=require('util');var path=require(_0x967f('0x6'));var sox=require(_0x967f('0x7'));var csv=require(_0x967f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x967f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x967f('0xa'));var jsforce=require(_0x967f('0xb'));var deskjs=require(_0x967f('0xc'));var toCsv=require(_0x967f('0x8'));var querystring=require(_0x967f('0xd'));var Papa=require(_0x967f('0xe'));var Redis=require(_0x967f('0xf'));var authService=require(_0x967f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x967f('0x11'));var hardwareService=require(_0x967f('0x12'));var logger=require(_0x967f('0x13'))(_0x967f('0x14'));var utils=require(_0x967f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x967f('0x16'));var db=require(_0x967f('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x35e5c3,_0x3063c5){_0x3063c5=_0x3063c5||0xcc;return function(_0x5489cc){if(_0x5489cc){return _0x35e5c3[_0x967f('0x18')](_0x3063c5);}return _0x35e5c3[_0x967f('0x19')](_0x3063c5)[_0x967f('0x1a')]();};}function respondWithResult(_0x58dc02,_0x413d8a){_0x413d8a=_0x413d8a||0xc8;return function(_0x2b71ee){if(_0x2b71ee){return _0x58dc02[_0x967f('0x19')](_0x413d8a)[_0x967f('0x1b')](_0x2b71ee);}};}function respondWithFilteredResult(_0x335f46,_0x5bce63){return function(_0x4ac93d){if(_0x4ac93d){var _0x1ac80c=typeof _0x5bce63[_0x967f('0x1c')]===_0x967f('0x1d')&&typeof _0x5bce63[_0x967f('0x1e')]===_0x967f('0x1d');var _0x465120=_0x4ac93d[_0x967f('0x1f')];var _0x244978=_0x1ac80c?0x0:_0x5bce63['offset'];var _0x11e553=_0x1ac80c?_0x4ac93d[_0x967f('0x1f')]:_0x5bce63['offset']+_0x5bce63[_0x967f('0x1e')];var _0x497a6b;if(_0x11e553>=_0x465120){_0x11e553=_0x465120;_0x497a6b=0xc8;}else{_0x497a6b=0xce;}_0x335f46[_0x967f('0x19')](_0x497a6b);return _0x335f46[_0x967f('0x20')](_0x967f('0x21'),_0x244978+'-'+_0x11e553+'/'+_0x465120)[_0x967f('0x1b')](_0x4ac93d);}return null;};}function patchUpdates(_0x839015){return function(_0x340601){try{jsonpatch['apply'](_0x340601,_0x839015,!![]);}catch(_0x1e3e5d){return BPromise[_0x967f('0x22')](_0x1e3e5d);}return _0x340601[_0x967f('0x23')]();};}function saveUpdates(_0x660307,_0x1c2e9c){return function(_0x3e1af5){if(_0x3e1af5){return _0x3e1af5[_0x967f('0x24')](_0x660307)[_0x967f('0x25')](function(_0x3b3eeb){return _0x3b3eeb;});}return null;};}function removeEntity(_0x424bb8,_0x117ffa){return function(_0x261b94){if(_0x261b94){return _0x261b94[_0x967f('0x26')]()[_0x967f('0x25')](function(){_0x424bb8['status'](0xcc)[_0x967f('0x1a')]();});}};}function handleEntityNotFound(_0x3d6aab,_0x2cf8d6){return function(_0x42ef87){if(!_0x42ef87){_0x3d6aab[_0x967f('0x18')](0x194);}return _0x42ef87;};}function handleError(_0x2864ca,_0x574a8c){_0x574a8c=_0x574a8c||0x1f4;return function(_0x1c0dbc){logger['error'](_0x1c0dbc['stack']);if(_0x1c0dbc[_0x967f('0x27')]){delete _0x1c0dbc[_0x967f('0x27')];}_0x2864ca[_0x967f('0x19')](_0x574a8c)[_0x967f('0x28')](_0x1c0dbc);};}exports[_0x967f('0x29')]=function(_0x15290e,_0x259767){var _0x4affe4={},_0x10ad0c={},_0x27edd6={'count':0x0,'rows':[]};var _0x340fa2=_['map'](db[_0x967f('0x2a')][_0x967f('0x2b')],function(_0xaf3970){return{'name':_0xaf3970[_0x967f('0x2c')],'type':_0xaf3970[_0x967f('0x2d')][_0x967f('0x2e')]};});_0x10ad0c['model']=_[_0x967f('0x2f')](_0x340fa2,_0x967f('0x27'));_0x10ad0c[_0x967f('0x30')]=_[_0x967f('0x31')](_0x15290e['query']);_0x10ad0c[_0x967f('0x32')]=_[_0x967f('0x33')](_0x10ad0c[_0x967f('0x34')],_0x10ad0c[_0x967f('0x30')]);_0x4affe4[_0x967f('0x35')]=_[_0x967f('0x33')](_0x10ad0c['model'],qs[_0x967f('0x36')](_0x15290e[_0x967f('0x30')]['fields']));_0x4affe4['attributes']=_0x4affe4['attributes'][_0x967f('0x37')]?_0x4affe4[_0x967f('0x35')]:_0x10ad0c[_0x967f('0x34')];if(!_0x15290e[_0x967f('0x30')]['hasOwnProperty']('nolimit')){_0x4affe4[_0x967f('0x1e')]=qs[_0x967f('0x1e')](_0x15290e['query']['limit']);_0x4affe4[_0x967f('0x1c')]=qs['offset'](_0x15290e['query']['offset']);}_0x4affe4['order']=qs['sort'](_0x15290e[_0x967f('0x30')]['sort']);_0x4affe4[_0x967f('0x38')]=qs['filters'](_[_0x967f('0x39')](_0x15290e[_0x967f('0x30')],_0x10ad0c[_0x967f('0x32')]),_0x340fa2);if(_0x15290e[_0x967f('0x30')][_0x967f('0x3a')]){_0x4affe4[_0x967f('0x38')]=_[_0x967f('0x3b')](_0x4affe4[_0x967f('0x38')],{'$or':_['map'](_0x340fa2,function(_0x2bc6fc){if(_0x2bc6fc[_0x967f('0x2d')]!==_0x967f('0x3c')){var _0x35a5fc={};_0x35a5fc[_0x2bc6fc[_0x967f('0x27')]]={'$like':'%'+_0x15290e[_0x967f('0x30')]['filter']+'%'};return _0x35a5fc;}})});}_0x4affe4=_[_0x967f('0x3b')]({},_0x4affe4,_0x15290e['options']);var _0x13b4a2={'where':_0x4affe4[_0x967f('0x38')]};return db[_0x967f('0x2a')][_0x967f('0x1f')](_0x13b4a2)['then'](function(_0x234601){_0x27edd6['count']=_0x234601;if(_0x15290e['query'][_0x967f('0x3d')]){_0x4affe4['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x967f('0x3e')](_0x4affe4);})[_0x967f('0x25')](function(_0x901456){_0x27edd6[_0x967f('0x3f')]=_0x901456;return _0x27edd6;})[_0x967f('0x25')](respondWithFilteredResult(_0x259767,_0x4affe4))['catch'](handleError(_0x259767,null));};exports[_0x967f('0x40')]=function(_0x56c402,_0x3b5431){var _0xd50ee9={'raw':![],'where':{'id':_0x56c402['params']['id']}},_0x4eb316={};_0x4eb316['model']=_[_0x967f('0x31')](db[_0x967f('0x2a')][_0x967f('0x2b')]);_0x4eb316['query']=_[_0x967f('0x31')](_0x56c402[_0x967f('0x30')]);_0x4eb316[_0x967f('0x32')]=_[_0x967f('0x33')](_0x4eb316[_0x967f('0x34')],_0x4eb316[_0x967f('0x30')]);_0xd50ee9['attributes']=_[_0x967f('0x33')](_0x4eb316[_0x967f('0x34')],qs['fields'](_0x56c402['query'][_0x967f('0x36')]));_0xd50ee9[_0x967f('0x35')]=_0xd50ee9[_0x967f('0x35')]['length']?_0xd50ee9[_0x967f('0x35')]:_0x4eb316['model'];if(_0x56c402['query'][_0x967f('0x3d')]){_0xd50ee9[_0x967f('0x41')]=[{'all':!![]}];}_0xd50ee9=_[_0x967f('0x3b')]({},_0xd50ee9,_0x56c402[_0x967f('0x42')]);return db[_0x967f('0x2a')][_0x967f('0x43')](_0xd50ee9)[_0x967f('0x25')](handleEntityNotFound(_0x3b5431,null))[_0x967f('0x25')](respondWithResult(_0x3b5431,null))['catch'](handleError(_0x3b5431,null));};exports[_0x967f('0x44')]=function(_0x19e135,_0x1c7351){return db[_0x967f('0x2a')][_0x967f('0x44')](_0x19e135[_0x967f('0x45')],{})[_0x967f('0x25')](respondWithResult(_0x1c7351,0xc9))[_0x967f('0x46')](handleError(_0x1c7351,null));};exports['update']=function(_0x403850,_0x416af7){if(_0x403850['body']['id']){delete _0x403850[_0x967f('0x45')]['id'];}return db[_0x967f('0x2a')]['find']({'where':{'id':_0x403850[_0x967f('0x47')]['id']}})['then'](handleEntityNotFound(_0x416af7,null))['then'](saveUpdates(_0x403850[_0x967f('0x45')],null))[_0x967f('0x25')](respondWithResult(_0x416af7,null))[_0x967f('0x46')](handleError(_0x416af7,null));};exports[_0x967f('0x26')]=function(_0xb875f,_0x22a938){return db[_0x967f('0x2a')]['find']({'where':{'id':_0xb875f[_0x967f('0x47')]['id']}})[_0x967f('0x25')](handleEntityNotFound(_0x22a938,null))[_0x967f('0x25')](removeEntity(_0x22a938,null))['catch'](handleError(_0x22a938,null));};exports[_0x967f('0x48')]=function(_0x5c3dff,_0x551bd9,_0x19c168){var _0x4cf624={};var _0x388934={};var _0xdbc5c;var _0x1f4325;return db['VtigerAccount'][_0x967f('0x49')]({'where':{'id':_0x5c3dff[_0x967f('0x47')]['id']}})['then'](handleEntityNotFound(_0x551bd9,null))[_0x967f('0x25')](function(_0x4bc022){if(_0x4bc022){_0xdbc5c=_0x4bc022;_0x388934[_0x967f('0x34')]=_['keys'](db[_0x967f('0x4a')]['rawAttributes']);_0x388934[_0x967f('0x30')]=_['keys'](_0x5c3dff['query']);_0x388934['filters']=_[_0x967f('0x33')](_0x388934[_0x967f('0x34')],_0x388934[_0x967f('0x30')]);_0x4cf624[_0x967f('0x35')]=_[_0x967f('0x33')](_0x388934[_0x967f('0x34')],qs[_0x967f('0x36')](_0x5c3dff[_0x967f('0x30')][_0x967f('0x36')]));_0x4cf624[_0x967f('0x35')]=_0x4cf624[_0x967f('0x35')]['length']?_0x4cf624[_0x967f('0x35')]:_0x388934[_0x967f('0x34')];_0x4cf624[_0x967f('0x4b')]=qs[_0x967f('0x4c')](_0x5c3dff[_0x967f('0x30')]['sort']);_0x4cf624[_0x967f('0x38')]=qs[_0x967f('0x32')](_[_0x967f('0x39')](_0x5c3dff[_0x967f('0x30')],_0x388934[_0x967f('0x32')]));if(_0x5c3dff['query'][_0x967f('0x3a')]){_0x4cf624['where']=_[_0x967f('0x3b')](_0x4cf624[_0x967f('0x38')],{'$or':_[_0x967f('0x2f')](_0x4cf624[_0x967f('0x35')],function(_0x3ccf93){var _0x3680b2={};_0x3680b2[_0x3ccf93]={'$like':'%'+_0x5c3dff[_0x967f('0x30')]['filter']+'%'};return _0x3680b2;})});}_0x4cf624=_[_0x967f('0x3b')]({},_0x4cf624,_0x5c3dff['options']);return _0xdbc5c[_0x967f('0x48')](_0x4cf624);}})[_0x967f('0x25')](function(_0xd7899f){if(_0xd7899f){_0x1f4325=_0xd7899f[_0x967f('0x37')];if(!_0x5c3dff[_0x967f('0x30')][_0x967f('0x4d')](_0x967f('0x4e'))){_0x4cf624['limit']=qs['limit'](_0x5c3dff[_0x967f('0x30')]['limit']);_0x4cf624[_0x967f('0x1c')]=qs[_0x967f('0x1c')](_0x5c3dff[_0x967f('0x30')][_0x967f('0x1c')]);}return _0xdbc5c[_0x967f('0x48')](_0x4cf624);}})['then'](function(_0x5acc1a){if(_0x5acc1a){return _0x5acc1a?{'count':_0x1f4325,'rows':_0x5acc1a}:null;}})[_0x967f('0x25')](respondWithResult(_0x551bd9,null))['catch'](handleError(_0x551bd9,null));};exports[_0x967f('0x4f')]=function(_0x5e870d,_0x3d1765,_0xdc1a57){if(_0x5e870d['body']['id']){delete _0x5e870d[_0x967f('0x45')]['id'];}return db[_0x967f('0x2a')][_0x967f('0x49')]({'where':{'id':_0x5e870d['params']['id']}})[_0x967f('0x25')](handleEntityNotFound(_0x3d1765,null))['then'](function(_0x552892){if(_0x552892){_0x5e870d[_0x967f('0x45')][_0x967f('0x50')]=_0x552892['id'];_0x5e870d['body'][_0x967f('0x51')]=integrations[_0x967f('0x52')](_0x5e870d[_0x967f('0x45')]['channel'],_0x5e870d[_0x967f('0x45')][_0x967f('0x2d')]);_0x5e870d[_0x967f('0x45')]['Descriptions']=integrations[_0x967f('0x53')](_0x5e870d['body'][_0x967f('0x54')],_0x5e870d[_0x967f('0x45')][_0x967f('0x2d')]);return db[_0x967f('0x4a')][_0x967f('0x44')](_0x5e870d[_0x967f('0x45')],{'include':[{'model':db[_0x967f('0x55')],'as':_0x967f('0x51')},{'model':db[_0x967f('0x55')],'as':_0x967f('0x56')}]});}return null;})[_0x967f('0x25')](respondWithResult(_0x3d1765,null))['catch'](handleError(_0x3d1765,null));};var md5=require(_0x967f('0x57'));exports[_0x967f('0x58')]=function(_0x442413,_0x212519,_0x43f979){var _0x14b643=null;var _0x192738=null;var _0x3b7518=null;var _0x99e67d=null;var _0xc6012e='';return db[_0x967f('0x2a')][_0x967f('0x49')]({'where':{'id':_0x442413['params']['id']},'attributes':['id',_0x967f('0x27'),'username','description',_0x967f('0x59'),_0x967f('0x5a'),_0x967f('0x5b'),_0x967f('0x5c')]})['then'](handleEntityNotFound(_0x212519,null))[_0x967f('0x25')](function(_0x3b7df0){if(_0x3b7df0){_0x14b643=_0x3b7df0['username'];_0x192738=_0x3b7df0[_0x967f('0x5c')];_0x3b7518=_0x3b7df0[_0x967f('0x59')];_0xc6012e=_0x3b7df0[_0x967f('0x5a')];var _0x5daf30=_0xc6012e[_0x967f('0x5d')](-0x1);if(_0x5daf30==='/'){_0xc6012e=_0xc6012e[_0x967f('0x5e')](0x0,_0xc6012e['lastIndexOf'](_0x5daf30));}_0x99e67d=util['format']('%s/webservice.php',_0xc6012e);var _0xa4782c={'method':_0x967f('0x5f'),'uri':_0x99e67d,'qs':{'operation':_0x967f('0x60'),'username':_0x3b7df0[_0x967f('0x61')]},'json':!![]};return rp(_0xa4782c);}})[_0x967f('0x25')](function(_0x283349){if(_0x283349[_0x967f('0x62')]){var _0x527c33={'method':'POST','uri':_0x99e67d,'form':{'operation':_0x967f('0x63'),'username':_0x14b643,'accessKey':md5(_0x283349['result']['token']+_0x192738)},'json':!![]};return rp(_0x527c33);}})[_0x967f('0x25')](function(_0x216f51){if(_0x216f51['success']){var _0x44db84={'method':_0x967f('0x5f'),'uri':_0x99e67d,'qs':{'operation':_0x967f('0x64'),'username':_0x14b643,'sessionName':_0x216f51[_0x967f('0x65')][_0x967f('0x66')],'elementType':_0x3b7518},'json':!![]};return rp(_0x44db84);}})['then'](function(_0xa1734e){if(_0xa1734e[_0x967f('0x62')]){var _0x29c6a5=[_0x967f('0x67'),'reference',_0x967f('0x68')];_[_0x967f('0x69')](_0xa1734e[_0x967f('0x65')]['fields'],function(_0x847f05){return _0x29c6a5['includes'](_0x847f05[_0x967f('0x2d')][_0x967f('0x27')]);});_['remove'](_0xa1734e[_0x967f('0x65')][_0x967f('0x36')],function(_0x3e6cb7){return _0x3e6cb7[_0x967f('0x6a')]===_0x967f('0x6b');});return{'count':_0xa1734e[_0x967f('0x65')]['fields']['length'],'rows':_[_0x967f('0x2f')](_0xa1734e[_0x967f('0x65')][_0x967f('0x36')],function(_0x469ae8){return{'id':_0x469ae8[_0x967f('0x27')],'name':_0x469ae8[_0x967f('0x6c')],'custom':_['startsWith'](_0x469ae8[_0x967f('0x27')],_0x967f('0x6d'))?!![]:![],'options':_0x469ae8[_0x967f('0x2d')][_0x967f('0x27')]===_0x967f('0x6e')&&_0x469ae8[_0x967f('0x2d')][_0x967f('0x6f')][_0x967f('0x37')]>0x0?_[_0x967f('0x2f')](_0x469ae8[_0x967f('0x2d')]['picklistValues'],function(_0x32babf){return{'name':_0x32babf[_0x967f('0x6c')],'value':_0x32babf[_0x967f('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x212519,null))[_0x967f('0x46')](function(_0x9c026d){console['log'](_0x967f('0x71')+_0x9c026d);var _0x965dd9=_0x442413['query'][_0x967f('0x72')]?0x1f4:_0x9c026d[_0x967f('0x73')]||0x1f4;logger[_0x967f('0x74')](_0x967f('0x75'),_0x967f('0x58'),_0x965dd9,JSON['stringify'](_0x9c026d));delete _0x9c026d[_0x967f('0x27')];if(_0x965dd9===0x191){_0x965dd9=0x190;}_0x212519['status'](_0x965dd9)['send'](_0x442413[_0x967f('0x30')][_0x967f('0x72')]?{'message':_0x967f('0x76'),'statusCode':_0x9c026d[_0x967f('0x73')]}:_0x9c026d);});}; \ No newline at end of file +var _0x0056=['sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','VtigerAccount','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','VtigerConfiguration','filter','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','VtigerField','Subjects','Descriptions','md5','username','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','result','sessionName','reference','owner','includes','remove','editable','false','startsWith','picklist','picklistValues','label','log','vTiger\x20error:\x20','test','statusCode','getFields','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x114c42,_0xe02074){var _0x21822e=function(_0x32573f){while(--_0x32573f){_0x114c42['push'](_0x114c42['shift']());}};_0x21822e(++_0xe02074);}(_0x0056,0x1c6));var _0x6005=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x0056[_0x3d9176];return _0x12adc5;};'use strict';var emlformat=require(_0x6005('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6005('0x1'));var jsonpatch=require(_0x6005('0x2'));var rp=require(_0x6005('0x3'));var moment=require(_0x6005('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6005('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6005('0x6'));var csv=require(_0x6005('0x7'));var ejs=require(_0x6005('0x8'));var fs=require('fs');var fs_extra=require(_0x6005('0x9'));var _=require('lodash');var squel=require(_0x6005('0xa'));var crypto=require(_0x6005('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6005('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6005('0xd'));var authService=require(_0x6005('0xe'));var qs=require(_0x6005('0xf'));var as=require(_0x6005('0x10'));var hardwareService=require(_0x6005('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6005('0x12'));var config=require(_0x6005('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6005('0x14'))['db'];var integrations=require(_0x6005('0x15'));function respondWithStatusCode(_0x127abb,_0x3ca093){_0x3ca093=_0x3ca093||0xcc;return function(_0x59311a){if(_0x59311a){return _0x127abb[_0x6005('0x16')](_0x3ca093);}return _0x127abb[_0x6005('0x17')](_0x3ca093)['end']();};}function respondWithResult(_0x1a83c1,_0x3f1684){_0x3f1684=_0x3f1684||0xc8;return function(_0x2f4eee){if(_0x2f4eee){return _0x1a83c1['status'](_0x3f1684)[_0x6005('0x18')](_0x2f4eee);}};}function respondWithFilteredResult(_0x2ee328,_0x1a5666){return function(_0x5d7f41){if(_0x5d7f41){var _0x12d421=typeof _0x1a5666['offset']===_0x6005('0x19')&&typeof _0x1a5666[_0x6005('0x1a')]===_0x6005('0x19');var _0x1afbd6=_0x5d7f41['count'];var _0x2dfcaa=_0x12d421?0x0:_0x1a5666[_0x6005('0x1b')];var _0x4d669b=_0x12d421?_0x5d7f41[_0x6005('0x1c')]:_0x1a5666[_0x6005('0x1b')]+_0x1a5666[_0x6005('0x1a')];var _0x25494d;if(_0x4d669b>=_0x1afbd6){_0x4d669b=_0x1afbd6;_0x25494d=0xc8;}else{_0x25494d=0xce;}_0x2ee328[_0x6005('0x17')](_0x25494d);return _0x2ee328['set'](_0x6005('0x1d'),_0x2dfcaa+'-'+_0x4d669b+'/'+_0x1afbd6)['json'](_0x5d7f41);}return null;};}function patchUpdates(_0x114a08){return function(_0x382ee2){try{jsonpatch[_0x6005('0x1e')](_0x382ee2,_0x114a08,!![]);}catch(_0x261c90){return BPromise['reject'](_0x261c90);}return _0x382ee2[_0x6005('0x1f')]();};}function saveUpdates(_0x4771b2,_0xafe8b3){return function(_0x4ef03c){if(_0x4ef03c){return _0x4ef03c[_0x6005('0x20')](_0x4771b2)[_0x6005('0x21')](function(_0x466e51){return _0x466e51;});}return null;};}function removeEntity(_0x458c5c,_0x278cb0){return function(_0x3e6cf1){if(_0x3e6cf1){return _0x3e6cf1[_0x6005('0x22')]()[_0x6005('0x21')](function(){_0x458c5c[_0x6005('0x17')](0xcc)[_0x6005('0x23')]();});}};}function handleEntityNotFound(_0xa26858,_0x5dccd1){return function(_0x2bb145){if(!_0x2bb145){_0xa26858[_0x6005('0x16')](0x194);}return _0x2bb145;};}function handleError(_0x232cb7,_0x3419cc){_0x3419cc=_0x3419cc||0x1f4;return function(_0x593561){logger[_0x6005('0x24')](_0x593561['stack']);if(_0x593561[_0x6005('0x25')]){delete _0x593561[_0x6005('0x25')];}_0x232cb7[_0x6005('0x17')](_0x3419cc)[_0x6005('0x26')](_0x593561);};}exports[_0x6005('0x27')]=function(_0x3e6a6e,_0x2c2c5b){var _0xada313={},_0x4ff451={},_0x3a6e39={'count':0x0,'rows':[]};var _0x43d6a8=_[_0x6005('0x28')](db['VtigerAccount'][_0x6005('0x29')],function(_0x160219){return{'name':_0x160219[_0x6005('0x2a')],'type':_0x160219[_0x6005('0x2b')]['key']};});_0x4ff451[_0x6005('0x2c')]=_[_0x6005('0x28')](_0x43d6a8,'name');_0x4ff451[_0x6005('0x2d')]=_[_0x6005('0x2e')](_0x3e6a6e[_0x6005('0x2d')]);_0x4ff451[_0x6005('0x2f')]=_['intersection'](_0x4ff451[_0x6005('0x2c')],_0x4ff451[_0x6005('0x2d')]);_0xada313[_0x6005('0x30')]=_[_0x6005('0x31')](_0x4ff451[_0x6005('0x2c')],qs['fields'](_0x3e6a6e[_0x6005('0x2d')][_0x6005('0x32')]));_0xada313['attributes']=_0xada313[_0x6005('0x30')]['length']?_0xada313[_0x6005('0x30')]:_0x4ff451[_0x6005('0x2c')];if(!_0x3e6a6e['query'][_0x6005('0x33')](_0x6005('0x34'))){_0xada313['limit']=qs['limit'](_0x3e6a6e[_0x6005('0x2d')][_0x6005('0x1a')]);_0xada313['offset']=qs['offset'](_0x3e6a6e[_0x6005('0x2d')][_0x6005('0x1b')]);}_0xada313[_0x6005('0x35')]=qs['sort'](_0x3e6a6e[_0x6005('0x2d')][_0x6005('0x36')]);_0xada313[_0x6005('0x37')]=qs[_0x6005('0x2f')](_[_0x6005('0x38')](_0x3e6a6e[_0x6005('0x2d')],_0x4ff451[_0x6005('0x2f')]),_0x43d6a8);if(_0x3e6a6e[_0x6005('0x2d')]['filter']){_0xada313[_0x6005('0x37')]=_['merge'](_0xada313[_0x6005('0x37')],{'$or':_[_0x6005('0x28')](_0x43d6a8,function(_0x5e8cd9){if(_0x5e8cd9['type']!=='VIRTUAL'){var _0x507741={};_0x507741[_0x5e8cd9[_0x6005('0x25')]]={'$like':'%'+_0x3e6a6e[_0x6005('0x2d')]['filter']+'%'};return _0x507741;}})});}_0xada313=_[_0x6005('0x39')]({},_0xada313,_0x3e6a6e[_0x6005('0x3a')]);var _0x2c0450={'where':_0xada313['where']};return db[_0x6005('0x3b')]['count'](_0x2c0450)[_0x6005('0x21')](function(_0xc88c9){_0x3a6e39[_0x6005('0x1c')]=_0xc88c9;if(_0x3e6a6e['query'][_0x6005('0x3c')]){_0xada313[_0x6005('0x3d')]=[{'all':!![]}];}return db[_0x6005('0x3b')][_0x6005('0x3e')](_0xada313);})[_0x6005('0x21')](function(_0x33ecee){_0x3a6e39[_0x6005('0x3f')]=_0x33ecee;return _0x3a6e39;})[_0x6005('0x21')](respondWithFilteredResult(_0x2c2c5b,_0xada313))[_0x6005('0x40')](handleError(_0x2c2c5b,null));};exports[_0x6005('0x41')]=function(_0x157e13,_0x40d5e8){var _0x19c0f7={'raw':![],'where':{'id':_0x157e13['params']['id']}},_0x28275a={};_0x28275a[_0x6005('0x2c')]=_[_0x6005('0x2e')](db['VtigerAccount']['rawAttributes']);_0x28275a[_0x6005('0x2d')]=_[_0x6005('0x2e')](_0x157e13['query']);_0x28275a[_0x6005('0x2f')]=_[_0x6005('0x31')](_0x28275a[_0x6005('0x2c')],_0x28275a[_0x6005('0x2d')]);_0x19c0f7[_0x6005('0x30')]=_['intersection'](_0x28275a[_0x6005('0x2c')],qs['fields'](_0x157e13[_0x6005('0x2d')][_0x6005('0x32')]));_0x19c0f7['attributes']=_0x19c0f7[_0x6005('0x30')][_0x6005('0x42')]?_0x19c0f7[_0x6005('0x30')]:_0x28275a[_0x6005('0x2c')];if(_0x157e13[_0x6005('0x2d')][_0x6005('0x3c')]){_0x19c0f7[_0x6005('0x3d')]=[{'all':!![]}];}_0x19c0f7=_[_0x6005('0x39')]({},_0x19c0f7,_0x157e13[_0x6005('0x3a')]);return db[_0x6005('0x3b')][_0x6005('0x43')](_0x19c0f7)[_0x6005('0x21')](handleEntityNotFound(_0x40d5e8,null))[_0x6005('0x21')](respondWithResult(_0x40d5e8,null))['catch'](handleError(_0x40d5e8,null));};exports[_0x6005('0x44')]=function(_0x301b38,_0xe1ab23){return db[_0x6005('0x3b')][_0x6005('0x44')](_0x301b38[_0x6005('0x45')],{})['then'](respondWithResult(_0xe1ab23,0xc9))[_0x6005('0x40')](handleError(_0xe1ab23,null));};exports[_0x6005('0x20')]=function(_0x53e3fb,_0x202d39){if(_0x53e3fb['body']['id']){delete _0x53e3fb[_0x6005('0x45')]['id'];}return db[_0x6005('0x3b')][_0x6005('0x43')]({'where':{'id':_0x53e3fb['params']['id']}})[_0x6005('0x21')](handleEntityNotFound(_0x202d39,null))[_0x6005('0x21')](saveUpdates(_0x53e3fb[_0x6005('0x45')],null))[_0x6005('0x21')](respondWithResult(_0x202d39,null))[_0x6005('0x40')](handleError(_0x202d39,null));};exports[_0x6005('0x22')]=function(_0x77750c,_0x1a3a6d){return db[_0x6005('0x3b')][_0x6005('0x43')]({'where':{'id':_0x77750c[_0x6005('0x46')]['id']}})[_0x6005('0x21')](handleEntityNotFound(_0x1a3a6d,null))[_0x6005('0x21')](removeEntity(_0x1a3a6d,null))[_0x6005('0x40')](handleError(_0x1a3a6d,null));};exports['getConfigurations']=function(_0x2dcccc,_0x1d2a66,_0x27ade8){var _0x443ea5={};var _0x502d8f={};var _0x279c9e;var _0x412b24;return db['VtigerAccount']['findOne']({'where':{'id':_0x2dcccc[_0x6005('0x46')]['id']}})[_0x6005('0x21')](handleEntityNotFound(_0x1d2a66,null))[_0x6005('0x21')](function(_0x56e5ee){if(_0x56e5ee){_0x279c9e=_0x56e5ee;_0x502d8f[_0x6005('0x2c')]=_[_0x6005('0x2e')](db[_0x6005('0x47')][_0x6005('0x29')]);_0x502d8f['query']=_[_0x6005('0x2e')](_0x2dcccc['query']);_0x502d8f[_0x6005('0x2f')]=_[_0x6005('0x31')](_0x502d8f[_0x6005('0x2c')],_0x502d8f[_0x6005('0x2d')]);_0x443ea5['attributes']=_[_0x6005('0x31')](_0x502d8f[_0x6005('0x2c')],qs[_0x6005('0x32')](_0x2dcccc[_0x6005('0x2d')][_0x6005('0x32')]));_0x443ea5[_0x6005('0x30')]=_0x443ea5[_0x6005('0x30')]['length']?_0x443ea5[_0x6005('0x30')]:_0x502d8f[_0x6005('0x2c')];_0x443ea5['order']=qs[_0x6005('0x36')](_0x2dcccc['query'][_0x6005('0x36')]);_0x443ea5['where']=qs[_0x6005('0x2f')](_[_0x6005('0x38')](_0x2dcccc[_0x6005('0x2d')],_0x502d8f[_0x6005('0x2f')]));if(_0x2dcccc[_0x6005('0x2d')][_0x6005('0x48')]){_0x443ea5[_0x6005('0x37')]=_[_0x6005('0x39')](_0x443ea5[_0x6005('0x37')],{'$or':_[_0x6005('0x28')](_0x443ea5['attributes'],function(_0x2269a8){var _0x3daf95={};_0x3daf95[_0x2269a8]={'$like':'%'+_0x2dcccc[_0x6005('0x2d')]['filter']+'%'};return _0x3daf95;})});}_0x443ea5=_['merge']({},_0x443ea5,_0x2dcccc[_0x6005('0x3a')]);return _0x279c9e['getConfigurations'](_0x443ea5);}})[_0x6005('0x21')](function(_0x100799){if(_0x100799){_0x412b24=_0x100799[_0x6005('0x42')];if(!_0x2dcccc[_0x6005('0x2d')][_0x6005('0x33')](_0x6005('0x34'))){_0x443ea5[_0x6005('0x1a')]=qs['limit'](_0x2dcccc['query'][_0x6005('0x1a')]);_0x443ea5[_0x6005('0x1b')]=qs[_0x6005('0x1b')](_0x2dcccc[_0x6005('0x2d')][_0x6005('0x1b')]);}return _0x279c9e[_0x6005('0x49')](_0x443ea5);}})[_0x6005('0x21')](function(_0x557487){if(_0x557487){return _0x557487?{'count':_0x412b24,'rows':_0x557487}:null;}})[_0x6005('0x21')](respondWithResult(_0x1d2a66,null))['catch'](handleError(_0x1d2a66,null));};exports[_0x6005('0x4a')]=function(_0x2b6e74,_0x265c6b,_0x8808f8){if(_0x2b6e74[_0x6005('0x45')]['id']){delete _0x2b6e74[_0x6005('0x45')]['id'];}return db[_0x6005('0x3b')][_0x6005('0x4b')]({'where':{'id':_0x2b6e74[_0x6005('0x46')]['id']}})[_0x6005('0x21')](handleEntityNotFound(_0x265c6b,null))['then'](function(_0x21148e){if(_0x21148e){_0x2b6e74[_0x6005('0x45')][_0x6005('0x4c')]=_0x21148e['id'];_0x2b6e74[_0x6005('0x45')]['Subjects']=integrations[_0x6005('0x4d')](_0x2b6e74[_0x6005('0x45')][_0x6005('0x4e')],_0x2b6e74[_0x6005('0x45')]['type']);_0x2b6e74[_0x6005('0x45')]['Descriptions']=integrations[_0x6005('0x4f')](_0x2b6e74[_0x6005('0x45')]['channel'],_0x2b6e74[_0x6005('0x45')][_0x6005('0x2b')]);return db[_0x6005('0x47')]['create'](_0x2b6e74[_0x6005('0x45')],{'include':[{'model':db[_0x6005('0x50')],'as':_0x6005('0x51')},{'model':db['VtigerField'],'as':_0x6005('0x52')}]});}return null;})[_0x6005('0x21')](respondWithResult(_0x265c6b,null))[_0x6005('0x40')](handleError(_0x265c6b,null));};var md5=require(_0x6005('0x53'));exports['getFields']=function(_0x85e170,_0x295d1d,_0x55a6e0){var _0x18d8bb=null;var _0xa9755f=null;var _0x2c8421=null;var _0x30b647=null;var _0x4f7ccd='';return db[_0x6005('0x3b')][_0x6005('0x4b')]({'where':{'id':_0x85e170['params']['id']},'attributes':['id',_0x6005('0x25'),_0x6005('0x54'),'description',_0x6005('0x55'),_0x6005('0x56'),_0x6005('0x57'),'accessKey']})[_0x6005('0x21')](handleEntityNotFound(_0x295d1d,null))[_0x6005('0x21')](function(_0x1b50ee){if(_0x1b50ee){_0x18d8bb=_0x1b50ee[_0x6005('0x54')];_0xa9755f=_0x1b50ee[_0x6005('0x58')];_0x2c8421=_0x1b50ee[_0x6005('0x55')];_0x4f7ccd=_0x1b50ee[_0x6005('0x56')];var _0x5ad4ca=_0x4f7ccd['slice'](-0x1);if(_0x5ad4ca==='/'){_0x4f7ccd=_0x4f7ccd[_0x6005('0x59')](0x0,_0x4f7ccd[_0x6005('0x5a')](_0x5ad4ca));}_0x30b647=util[_0x6005('0x5b')](_0x6005('0x5c'),_0x4f7ccd);var _0x6fc9e1={'method':_0x6005('0x5d'),'uri':_0x30b647,'qs':{'operation':_0x6005('0x5e'),'username':_0x1b50ee[_0x6005('0x54')]},'json':!![]};return rp(_0x6fc9e1);}})[_0x6005('0x21')](function(_0xfbce40){if(_0xfbce40[_0x6005('0x5f')]){var _0x3a5f70={'method':'POST','uri':_0x30b647,'form':{'operation':_0x6005('0x60'),'username':_0x18d8bb,'accessKey':md5(_0xfbce40[_0x6005('0x61')]['token']+_0xa9755f)},'json':!![]};return rp(_0x3a5f70);}})[_0x6005('0x21')](function(_0x335dec){if(_0x335dec[_0x6005('0x5f')]){var _0x1f93fd={'method':_0x6005('0x5d'),'uri':_0x30b647,'qs':{'operation':'describe','username':_0x18d8bb,'sessionName':_0x335dec[_0x6005('0x61')][_0x6005('0x62')],'elementType':_0x2c8421},'json':!![]};return rp(_0x1f93fd);}})[_0x6005('0x21')](function(_0x19f3de){if(_0x19f3de[_0x6005('0x5f')]){var _0x3ead58=['autogenerated',_0x6005('0x63'),_0x6005('0x64')];_['remove'](_0x19f3de[_0x6005('0x61')][_0x6005('0x32')],function(_0x3eedac){return _0x3ead58[_0x6005('0x65')](_0x3eedac['type']['name']);});_[_0x6005('0x66')](_0x19f3de[_0x6005('0x61')]['fields'],function(_0x118b3f){return _0x118b3f[_0x6005('0x67')]===_0x6005('0x68');});return{'count':_0x19f3de[_0x6005('0x61')]['fields'][_0x6005('0x42')],'rows':_[_0x6005('0x28')](_0x19f3de[_0x6005('0x61')]['fields'],function(_0x580078){return{'id':_0x580078[_0x6005('0x25')],'name':_0x580078['label'],'custom':_[_0x6005('0x69')](_0x580078[_0x6005('0x25')],'cf_')?!![]:![],'options':_0x580078[_0x6005('0x2b')]['name']===_0x6005('0x6a')&&_0x580078['type'][_0x6005('0x6b')][_0x6005('0x42')]>0x0?_['map'](_0x580078['type'][_0x6005('0x6b')],function(_0x298c48){return{'name':_0x298c48[_0x6005('0x6c')],'value':_0x298c48['value']};}):[]};})};}})['then'](respondWithResult(_0x295d1d,null))['catch'](function(_0x46870c){console[_0x6005('0x6d')](_0x6005('0x6e')+_0x46870c);var _0x32f616=_0x85e170[_0x6005('0x2d')][_0x6005('0x6f')]?0x1f4:_0x46870c[_0x6005('0x70')]||0x1f4;logger[_0x6005('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x6005('0x71'),_0x32f616,JSON[_0x6005('0x72')](_0x46870c));delete _0x46870c['name'];if(_0x32f616===0x191){_0x32f616=0x190;}_0x295d1d[_0x6005('0x17')](_0x32f616)[_0x6005('0x26')](_0x85e170[_0x6005('0x2d')][_0x6005('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x46870c[_0x6005('0x70')]}:_0x46870c);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 595744c..05eb7cb 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 _0x60ba=['../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x60ba,0x17f));var _0xa60b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x60ba[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xa60b('0x0'));var util=require(_0xa60b('0x1'));var logger=require(_0xa60b('0x2'))('api');var moment=require(_0xa60b('0x3'));var BPromise=require(_0xa60b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa60b('0x5'));var rimraf=require(_0xa60b('0x6'));var config=require(_0xa60b('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa60b('0x8'));module[_0xa60b('0x9')]=function(_0x504244,_0x460e65){return _0x504244[_0xa60b('0xa')](_0xa60b('0xb'),attributes,{'tableName':_0xa60b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa88e=['int_vtiger_accounts','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount'];(function(_0x1d46c1,_0x6775d0){var _0x4def63=function(_0x12d73b){while(--_0x12d73b){_0x1d46c1['push'](_0x1d46c1['shift']());}};_0x4def63(++_0x6775d0);}(_0xa88e,0xa9));var _0xea88=function(_0x4f2cac,_0x4acd94){_0x4f2cac=_0x4f2cac-0x0;var _0x5bd908=_0xa88e[_0x4f2cac];return _0x5bd908;};'use strict';var _=require('lodash');var util=require(_0xea88('0x0'));var logger=require(_0xea88('0x1'))('api');var moment=require(_0xea88('0x2'));var BPromise=require(_0xea88('0x3'));var rp=require(_0xea88('0x4'));var fs=require('fs');var path=require(_0xea88('0x5'));var rimraf=require('rimraf');var config=require(_0xea88('0x6'));var attributes=require(_0xea88('0x7'));var integrations=require(_0xea88('0x8'));module['exports']=function(_0x21e310,_0x5b3c6f){return _0x21e310[_0xea88('0x9')](_0xea88('0xa'),attributes,{'tableName':_0xea88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 97e7a02..08ee841 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 _0xa74f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','limit','attributes','include','map','model','ShowVtigerAccount','find','moment'];(function(_0x178c9d,_0x1bf7cf){var _0x363cd7=function(_0x23d80e){while(--_0x23d80e){_0x178c9d['push'](_0x178c9d['shift']());}};_0x363cd7(++_0x1bf7cf);}(_0xa74f,0x9a));var _0xfa74=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xa74f[_0x622035];return _0x326cf2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});}exports[_0xfa74('0x13')]=function(_0x51dda1){var _0x4928b6=this;return new Promise(function(_0x31d3c1,_0x25a36b){return db[_0xfa74('0x14')]['findAll']({'raw':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x51dda1['options']?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x51dda1[_0xfa74('0x15')]?_0x51dda1['options']['attributes']||null:null,'limit':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x18')]||null:null,'include':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')]['include']?_['map'](_0x51dda1[_0xfa74('0x15')]['include'],function(_0x48cbd3){return{'model':db[_0x48cbd3['model']],'as':_0x48cbd3['as'],'attributes':_0x48cbd3[_0xfa74('0x19')],'include':_0x48cbd3[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x48cbd3['include'],function(_0x530f99){return{'model':db[_0x530f99[_0xfa74('0x1c')]],'as':_0x530f99['as'],'attributes':_0x530f99[_0xfa74('0x19')],'include':_0x530f99['include']?_[_0xfa74('0x1b')](_0x530f99['include'],function(_0x1a8cf7){return{'model':db[_0x1a8cf7[_0xfa74('0x1c')]],'as':_0x1a8cf7['as'],'attributes':_0x1a8cf7['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1130de){logger[_0xfa74('0x8')](_0xfa74('0x13'),_0x51dda1);logger['debug'](_0xfa74('0x13'),_0x51dda1,JSON[_0xfa74('0xc')](_0x1130de));_0x31d3c1(_0x1130de);})[_0xfa74('0x12')](function(_0x57d90e){logger['error'](_0xfa74('0x13'),_0x57d90e[_0xfa74('0xf')],_0x51dda1);_0x25a36b(_0x4928b6['error'](0x1f4,_0x57d90e['message']));});});};exports[_0xfa74('0x1d')]=function(_0x564060){var _0x2238d4=this;return new Promise(function(_0x4d6d0a,_0x363173){return db[_0xfa74('0x14')][_0xfa74('0x1e')]({'raw':_0x564060[_0xfa74('0x15')]?_0x564060['options'][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x19')]||null:null,'include':_0x564060['options']?_0x564060[_0xfa74('0x15')]['include']?_[_0xfa74('0x1b')](_0x564060[_0xfa74('0x15')][_0xfa74('0x1a')],function(_0x1b5ff0){return{'model':db[_0x1b5ff0['model']],'as':_0x1b5ff0['as'],'attributes':_0x1b5ff0['attributes'],'include':_0x1b5ff0[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x1b5ff0[_0xfa74('0x1a')],function(_0x25863f){return{'model':db[_0x25863f['model']],'as':_0x25863f['as'],'attributes':_0x25863f[_0xfa74('0x19')],'include':_0x25863f[_0xfa74('0x1a')]?_['map'](_0x25863f['include'],function(_0x557510){return{'model':db[_0x557510['model']],'as':_0x557510['as'],'attributes':_0x557510['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1c3b44){logger[_0xfa74('0x8')](_0xfa74('0x1d'),_0x564060);logger[_0xfa74('0xa')](_0xfa74('0x1d'),_0x564060,JSON[_0xfa74('0xc')](_0x1c3b44));_0x4d6d0a(_0x1c3b44);})[_0xfa74('0x12')](function(_0x1a2d52){logger['error'](_0xfa74('0x1d'),_0x1a2d52[_0xfa74('0xf')],_0x564060);_0x363173(_0x2238d4[_0xfa74('0xd')](0x1f4,_0x1a2d52[_0xfa74('0xf')]));});});}; \ No newline at end of file +var _0x13f6=['debug','stringify','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','limit','include','map','model','attributes','ShowVtigerAccount','find','raw','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4605a6,_0x4ee25f){var _0x18bc7a=function(_0x2f1228){while(--_0x2f1228){_0x4605a6['push'](_0x4605a6['shift']());}};_0x18bc7a(++_0x4ee25f);}(_0x13f6,0x124));var _0x613f=function(_0x380d9a,_0x55b3e0){_0x380d9a=_0x380d9a-0x0;var _0x47ebbe=_0x13f6[_0x380d9a];return _0x47ebbe;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});}exports[_0x613f('0x15')]=function(_0x4f9dae){var _0x62ebfe=this;return new Promise(function(_0x1e5a11,_0x431266){return db[_0x613f('0x16')][_0x613f('0x17')]({'raw':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae['options']['where']||null:null,'attributes':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')]['attributes']||null:null,'limit':_0x4f9dae[_0x613f('0x18')]?_0x4f9dae[_0x613f('0x18')][_0x613f('0x19')]||null:null,'include':_0x4f9dae['options']?_0x4f9dae['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x4f9dae[_0x613f('0x18')]['include'],function(_0x41104e){return{'model':db[_0x41104e[_0x613f('0x1c')]],'as':_0x41104e['as'],'attributes':_0x41104e[_0x613f('0x1d')],'include':_0x41104e[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x41104e['include'],function(_0x30fb15){return{'model':db[_0x30fb15[_0x613f('0x1c')]],'as':_0x30fb15['as'],'attributes':_0x30fb15['attributes'],'include':_0x30fb15[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x30fb15[_0x613f('0x1a')],function(_0x4a878d){return{'model':db[_0x4a878d['model']],'as':_0x4a878d['as'],'attributes':_0x4a878d['attributes']};}):[]};}):[]};}):[]:[]})[_0x613f('0xb')](function(_0x594c28){logger[_0x613f('0x13')](_0x613f('0x15'),_0x4f9dae);logger['debug'](_0x613f('0x15'),_0x4f9dae,JSON[_0x613f('0xf')](_0x594c28));_0x1e5a11(_0x594c28);})['catch'](function(_0x4cff5d){logger['error'](_0x613f('0x15'),_0x4cff5d[_0x613f('0x12')],_0x4f9dae);_0x431266(_0x62ebfe[_0x613f('0x10')](0x1f4,_0x4cff5d['message']));});});};exports[_0x613f('0x1e')]=function(_0x439478){var _0xd335a6=this;return new Promise(function(_0x19bb8f,_0x4f8500){return db[_0x613f('0x16')][_0x613f('0x1f')]({'raw':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')][_0x613f('0x20')]===undefined?!![]:![]:!![],'where':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x21')]||null:null,'attributes':_0x439478[_0x613f('0x18')]?_0x439478[_0x613f('0x18')]['attributes']||null:null,'include':_0x439478[_0x613f('0x18')]?_0x439478['options'][_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x439478[_0x613f('0x18')][_0x613f('0x1a')],function(_0x2bceaa){return{'model':db[_0x2bceaa[_0x613f('0x1c')]],'as':_0x2bceaa['as'],'attributes':_0x2bceaa['attributes'],'include':_0x2bceaa[_0x613f('0x1a')]?_[_0x613f('0x1b')](_0x2bceaa[_0x613f('0x1a')],function(_0x25b2e4){return{'model':db[_0x25b2e4[_0x613f('0x1c')]],'as':_0x25b2e4['as'],'attributes':_0x25b2e4['attributes'],'include':_0x25b2e4['include']?_['map'](_0x25b2e4[_0x613f('0x1a')],function(_0x72c804){return{'model':db[_0x72c804[_0x613f('0x1c')]],'as':_0x72c804['as'],'attributes':_0x72c804[_0x613f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fc02e){logger[_0x613f('0x13')]('ShowVtigerAccount',_0x439478);logger[_0x613f('0xe')]('ShowVtigerAccount',_0x439478,JSON[_0x613f('0xf')](_0x2fc02e));_0x19bb8f(_0x2fc02e);})['catch'](function(_0x36dfd4){logger['error'](_0x613f('0x1e'),_0x36dfd4[_0x613f('0x12')],_0x439478);_0x4f8500(_0xd335a6[_0x613f('0x10')](0x1f4,_0x36dfd4['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 4a7b981..9631c5e 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 _0x75a3=['/:id/subjects','getSubjects','/:id/descriptions','post','create','/:id','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/fields'];(function(_0x48d7aa,_0x52349c){var _0x138fc6=function(_0x273dd9){while(--_0x273dd9){_0x48d7aa['push'](_0x48d7aa['shift']());}};_0x138fc6(++_0x52349c);}(_0x75a3,0x122));var _0x375a=function(_0xf8fe12,_0x4fbaba){_0xf8fe12=_0xf8fe12-0x0;var _0x326c2b=_0x75a3[_0xf8fe12];return _0x326c2b;};'use strict';var multer=require('multer');var util=require(_0x375a('0x0'));var path=require(_0x375a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x375a('0x2')]();var fs_extra=require(_0x375a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x375a('0x4'));var config=require(_0x375a('0x5'));var controller=require('./intVtigerConfiguration.controller');router[_0x375a('0x6')]('/',auth[_0x375a('0x7')](),controller[_0x375a('0x8')]);router[_0x375a('0x6')]('/:id',auth[_0x375a('0x7')](),controller['show']);router[_0x375a('0x6')](_0x375a('0x9'),auth[_0x375a('0x7')](),controller['getFields']);router[_0x375a('0x6')](_0x375a('0xa'),auth['isAuthenticated'](),controller[_0x375a('0xb')]);router['get'](_0x375a('0xc'),auth[_0x375a('0x7')](),controller['getDescriptions']);router[_0x375a('0xd')]('/',auth[_0x375a('0x7')](),controller[_0x375a('0xe')]);router['put'](_0x375a('0xf'),auth[_0x375a('0x7')](),controller[_0x375a('0x10')]);router[_0x375a('0x11')](_0x375a('0xf'),auth[_0x375a('0x7')](),controller[_0x375a('0x12')]);module[_0x375a('0x13')]=router; \ No newline at end of file +var _0x409d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','multer','path','express'];(function(_0x3a5946,_0x3b1110){var _0x6a8fd1=function(_0x3e0fcb){while(--_0x3e0fcb){_0x3a5946['push'](_0x3a5946['shift']());}};_0x6a8fd1(++_0x3b1110);}(_0x409d,0x11d));var _0xd409=function(_0x3e0131,_0x1d8faf){_0x3e0131=_0x3e0131-0x0;var _0x49f57b=_0x409d[_0x3e0131];return _0x49f57b;};'use strict';var multer=require(_0xd409('0x0'));var util=require('util');var path=require(_0xd409('0x1'));var timeout=require('connect-timeout');var express=require(_0xd409('0x2'));var router=express[_0xd409('0x3')]();var fs_extra=require(_0xd409('0x4'));var auth=require(_0xd409('0x5'));var interaction=require(_0xd409('0x6'));var config=require(_0xd409('0x7'));var controller=require(_0xd409('0x8'));router[_0xd409('0x9')]('/',auth[_0xd409('0xa')](),controller[_0xd409('0xb')]);router['get']('/:id',auth[_0xd409('0xa')](),controller[_0xd409('0xc')]);router[_0xd409('0x9')](_0xd409('0xd'),auth[_0xd409('0xa')](),controller[_0xd409('0xe')]);router[_0xd409('0x9')](_0xd409('0xf'),auth[_0xd409('0xa')](),controller['getSubjects']);router[_0xd409('0x9')](_0xd409('0x10'),auth[_0xd409('0xa')](),controller[_0xd409('0x11')]);router[_0xd409('0x12')]('/',auth[_0xd409('0xa')](),controller[_0xd409('0x13')]);router['put'](_0xd409('0x14'),auth[_0xd409('0xa')](),controller[_0xd409('0x15')]);router[_0xd409('0x16')](_0xd409('0x14'),auth[_0xd409('0xa')](),controller[_0xd409('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 0a87cab..e62cdad 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 _0x717a=['exports','STRING','sequelize'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x717a,0xa4));var _0xa717=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x717a[_0x261522];return _0x98a25a;};'use strict';var Sequelize=require(_0xa717('0x0'));module[_0xa717('0x1')]={'name':{'type':Sequelize[_0xa717('0x2')]},'description':{'type':Sequelize[_0xa717('0x2')]}}; \ No newline at end of file +var _0xe64a=['STRING','sequelize','exports'];(function(_0x2bfd5d,_0x460a49){var _0x359a3b=function(_0x1a859e){while(--_0x1a859e){_0x2bfd5d['push'](_0x2bfd5d['shift']());}};_0x359a3b(++_0x460a49);}(_0xe64a,0x142));var _0xae64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe64a[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xae64('0x0'));module[_0xae64('0x1')]={'name':{'type':Sequelize[_0xae64('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ea181b0..927d003 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 _0xbe5d=['undefined','limit','count','set','Content-Range','apply','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','VtigerConfiguration','then','include','findAll','rows','catch','show','params','find','create','body','update','getFields','findOne','VtigerField','options','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x542b79,_0x2fb13f){var _0x77358e=function(_0x587bb7){while(--_0x587bb7){_0x542b79['push'](_0x542b79['shift']());}};_0x77358e(++_0x2fb13f);}(_0xbe5d,0xd4));var _0xdbe5=function(_0x2bf8c6,_0x314fff){_0x2bf8c6=_0x2bf8c6-0x0;var _0x28bf19=_0xbe5d[_0x2bf8c6];return _0x28bf19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbe5('0x0'));var zipdir=require(_0xdbe5('0x1'));var jsonpatch=require(_0xdbe5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdbe5('0x3'));var util=require(_0xdbe5('0x4'));var path=require(_0xdbe5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbe5('0x6'));var _=require(_0xdbe5('0x7'));var squel=require(_0xdbe5('0x8'));var crypto=require(_0xdbe5('0x9'));var jsforce=require(_0xdbe5('0xa'));var deskjs=require(_0xdbe5('0xb'));var toCsv=require(_0xdbe5('0xc'));var querystring=require(_0xdbe5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbe5('0xe'));var qs=require(_0xdbe5('0xf'));var as=require(_0xdbe5('0x10'));var hardwareService=require(_0xdbe5('0x11'));var logger=require('../../config/logger')(_0xdbe5('0x12'));var utils=require(_0xdbe5('0x13'));var config=require(_0xdbe5('0x14'));var licenseUtil=require(_0xdbe5('0x15'));var db=require(_0xdbe5('0x16'))['db'];function respondWithStatusCode(_0x499b38,_0x5772af){_0x5772af=_0x5772af||0xcc;return function(_0x45ef45){if(_0x45ef45){return _0x499b38[_0xdbe5('0x17')](_0x5772af);}return _0x499b38['status'](_0x5772af)[_0xdbe5('0x18')]();};}function respondWithResult(_0x2604de,_0x3d5107){_0x3d5107=_0x3d5107||0xc8;return function(_0x2802ba){if(_0x2802ba){return _0x2604de[_0xdbe5('0x19')](_0x3d5107)[_0xdbe5('0x1a')](_0x2802ba);}};}function respondWithFilteredResult(_0x3ed31f,_0x3388c6){return function(_0x5b5472){if(_0x5b5472){var _0x50c748=typeof _0x3388c6[_0xdbe5('0x1b')]===_0xdbe5('0x1c')&&typeof _0x3388c6[_0xdbe5('0x1d')]===_0xdbe5('0x1c');var _0x539115=_0x5b5472[_0xdbe5('0x1e')];var _0x2033a3=_0x50c748?0x0:_0x3388c6[_0xdbe5('0x1b')];var _0x438ef4=_0x50c748?_0x5b5472[_0xdbe5('0x1e')]:_0x3388c6[_0xdbe5('0x1b')]+_0x3388c6[_0xdbe5('0x1d')];var _0x18802f;if(_0x438ef4>=_0x539115){_0x438ef4=_0x539115;_0x18802f=0xc8;}else{_0x18802f=0xce;}_0x3ed31f[_0xdbe5('0x19')](_0x18802f);return _0x3ed31f[_0xdbe5('0x1f')](_0xdbe5('0x20'),_0x2033a3+'-'+_0x438ef4+'/'+_0x539115)[_0xdbe5('0x1a')](_0x5b5472);}return null;};}function patchUpdates(_0x2831e1){return function(_0x448296){try{jsonpatch[_0xdbe5('0x21')](_0x448296,_0x2831e1,!![]);}catch(_0x58eb2d){return BPromise['reject'](_0x58eb2d);}return _0x448296[_0xdbe5('0x22')]();};}function saveUpdates(_0x2b1344,_0x552b5c){return function(_0x1ce2da){if(_0x1ce2da){return _0x1ce2da['update'](_0x2b1344)['then'](function(_0x30bcaf){return _0x30bcaf;});}return null;};}function removeEntity(_0x3639a2,_0x37c2c4){return function(_0x1fb509){if(_0x1fb509){return _0x1fb509[_0xdbe5('0x23')]()['then'](function(){_0x3639a2[_0xdbe5('0x19')](0xcc)[_0xdbe5('0x18')]();});}};}function handleEntityNotFound(_0x230ac3,_0x30c12d){return function(_0x33e838){if(!_0x33e838){_0x230ac3['sendStatus'](0x194);}return _0x33e838;};}function handleError(_0x27ee77,_0xe4ca4){_0xe4ca4=_0xe4ca4||0x1f4;return function(_0x5a7531){logger[_0xdbe5('0x24')](_0x5a7531[_0xdbe5('0x25')]);if(_0x5a7531[_0xdbe5('0x26')]){delete _0x5a7531[_0xdbe5('0x26')];}_0x27ee77[_0xdbe5('0x19')](_0xe4ca4)[_0xdbe5('0x27')](_0x5a7531);};}exports[_0xdbe5('0x28')]=function(_0x43779c,_0x53781f){var _0x2483a7={},_0x355cd8={},_0xcab060={'count':0x0,'rows':[]};var _0x71fcac=_[_0xdbe5('0x29')](db['VtigerConfiguration'][_0xdbe5('0x2a')],function(_0x4394d2){return{'name':_0x4394d2[_0xdbe5('0x2b')],'type':_0x4394d2[_0xdbe5('0x2c')][_0xdbe5('0x2d')]};});_0x355cd8[_0xdbe5('0x2e')]=_['map'](_0x71fcac,_0xdbe5('0x26'));_0x355cd8[_0xdbe5('0x2f')]=_[_0xdbe5('0x30')](_0x43779c['query']);_0x355cd8[_0xdbe5('0x31')]=_[_0xdbe5('0x32')](_0x355cd8[_0xdbe5('0x2e')],_0x355cd8[_0xdbe5('0x2f')]);_0x2483a7[_0xdbe5('0x33')]=_['intersection'](_0x355cd8[_0xdbe5('0x2e')],qs[_0xdbe5('0x34')](_0x43779c['query'][_0xdbe5('0x34')]));_0x2483a7[_0xdbe5('0x33')]=_0x2483a7[_0xdbe5('0x33')][_0xdbe5('0x35')]?_0x2483a7[_0xdbe5('0x33')]:_0x355cd8[_0xdbe5('0x2e')];if(!_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x36')]('nolimit')){_0x2483a7['limit']=qs[_0xdbe5('0x1d')](_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x1d')]);_0x2483a7[_0xdbe5('0x1b')]=qs[_0xdbe5('0x1b')](_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x1b')]);}_0x2483a7[_0xdbe5('0x37')]=qs[_0xdbe5('0x38')](_0x43779c['query']['sort']);_0x2483a7['where']=qs['filters'](_[_0xdbe5('0x39')](_0x43779c['query'],_0x355cd8[_0xdbe5('0x31')]),_0x71fcac);if(_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x3a')]){_0x2483a7[_0xdbe5('0x3b')]=_[_0xdbe5('0x3c')](_0x2483a7[_0xdbe5('0x3b')],{'$or':_[_0xdbe5('0x29')](_0x71fcac,function(_0x37794e){if(_0x37794e['type']!==_0xdbe5('0x3d')){var _0x55bcf5={};_0x55bcf5[_0x37794e['name']]={'$like':'%'+_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x3a')]+'%'};return _0x55bcf5;}})});}_0x2483a7=_['merge']({},_0x2483a7,_0x43779c['options']);var _0x182e03={'where':_0x2483a7[_0xdbe5('0x3b')]};return db[_0xdbe5('0x3e')][_0xdbe5('0x1e')](_0x182e03)[_0xdbe5('0x3f')](function(_0x15dfd0){_0xcab060[_0xdbe5('0x1e')]=_0x15dfd0;if(_0x43779c[_0xdbe5('0x2f')]['includeAll']){_0x2483a7[_0xdbe5('0x40')]=[{'all':!![]}];}return db[_0xdbe5('0x3e')][_0xdbe5('0x41')](_0x2483a7);})[_0xdbe5('0x3f')](function(_0x14d567){_0xcab060[_0xdbe5('0x42')]=_0x14d567;return _0xcab060;})['then'](respondWithFilteredResult(_0x53781f,_0x2483a7))[_0xdbe5('0x43')](handleError(_0x53781f,null));};exports[_0xdbe5('0x44')]=function(_0x97841f,_0x2307b5){var _0x3c0f9b={'raw':![],'where':{'id':_0x97841f[_0xdbe5('0x45')]['id']}},_0x2311f4={};_0x2311f4[_0xdbe5('0x2e')]=_[_0xdbe5('0x30')](db[_0xdbe5('0x3e')][_0xdbe5('0x2a')]);_0x2311f4[_0xdbe5('0x2f')]=_['keys'](_0x97841f[_0xdbe5('0x2f')]);_0x2311f4[_0xdbe5('0x31')]=_[_0xdbe5('0x32')](_0x2311f4[_0xdbe5('0x2e')],_0x2311f4[_0xdbe5('0x2f')]);_0x3c0f9b[_0xdbe5('0x33')]=_[_0xdbe5('0x32')](_0x2311f4[_0xdbe5('0x2e')],qs['fields'](_0x97841f['query']['fields']));_0x3c0f9b[_0xdbe5('0x33')]=_0x3c0f9b[_0xdbe5('0x33')]['length']?_0x3c0f9b[_0xdbe5('0x33')]:_0x2311f4[_0xdbe5('0x2e')];if(_0x97841f['query']['includeAll']){_0x3c0f9b[_0xdbe5('0x40')]=[{'all':!![]}];}_0x3c0f9b=_[_0xdbe5('0x3c')]({},_0x3c0f9b,_0x97841f['options']);return db['VtigerConfiguration'][_0xdbe5('0x46')](_0x3c0f9b)['then'](handleEntityNotFound(_0x2307b5,null))[_0xdbe5('0x3f')](respondWithResult(_0x2307b5,null))['catch'](handleError(_0x2307b5,null));};exports['create']=function(_0x3f6976,_0x439b20){return db[_0xdbe5('0x3e')][_0xdbe5('0x47')](_0x3f6976[_0xdbe5('0x48')],{})[_0xdbe5('0x3f')](respondWithResult(_0x439b20,0xc9))[_0xdbe5('0x43')](handleError(_0x439b20,null));};exports[_0xdbe5('0x49')]=function(_0x3242c4,_0x5730e6){if(_0x3242c4['body']['id']){delete _0x3242c4[_0xdbe5('0x48')]['id'];}return db[_0xdbe5('0x3e')][_0xdbe5('0x46')]({'where':{'id':_0x3242c4[_0xdbe5('0x45')]['id']}})['then'](handleEntityNotFound(_0x5730e6,null))['then'](saveUpdates(_0x3242c4[_0xdbe5('0x48')],null))[_0xdbe5('0x3f')](respondWithResult(_0x5730e6,null))[_0xdbe5('0x43')](handleError(_0x5730e6,null));};exports['destroy']=function(_0xccc985,_0x13aca1){return db[_0xdbe5('0x3e')][_0xdbe5('0x46')]({'where':{'id':_0xccc985[_0xdbe5('0x45')]['id']}})[_0xdbe5('0x3f')](handleEntityNotFound(_0x13aca1,null))[_0xdbe5('0x3f')](removeEntity(_0x13aca1,null))['catch'](handleError(_0x13aca1,null));};exports[_0xdbe5('0x4a')]=function(_0x600382,_0x4c5dc3,_0x232e95){var _0x46bce6={};var _0x328c19={};var _0x27cc2a;var _0x26b5f0;return db[_0xdbe5('0x3e')][_0xdbe5('0x4b')]({'where':{'id':_0x600382[_0xdbe5('0x45')]['id']}})[_0xdbe5('0x3f')](handleEntityNotFound(_0x4c5dc3,null))['then'](function(_0x466f79){if(_0x466f79){_0x27cc2a=_0x466f79;_0x328c19[_0xdbe5('0x2e')]=_['keys'](db[_0xdbe5('0x4c')][_0xdbe5('0x2a')]);_0x328c19[_0xdbe5('0x2f')]=_[_0xdbe5('0x30')](_0x600382[_0xdbe5('0x2f')]);_0x328c19[_0xdbe5('0x31')]=_[_0xdbe5('0x32')](_0x328c19['model'],_0x328c19[_0xdbe5('0x2f')]);_0x46bce6[_0xdbe5('0x33')]=_[_0xdbe5('0x32')](_0x328c19[_0xdbe5('0x2e')],qs[_0xdbe5('0x34')](_0x600382[_0xdbe5('0x2f')][_0xdbe5('0x34')]));_0x46bce6[_0xdbe5('0x33')]=_0x46bce6[_0xdbe5('0x33')]['length']?_0x46bce6['attributes']:_0x328c19[_0xdbe5('0x2e')];_0x46bce6[_0xdbe5('0x37')]=qs[_0xdbe5('0x38')](_0x600382[_0xdbe5('0x2f')][_0xdbe5('0x38')]);_0x46bce6['where']=qs['filters'](_[_0xdbe5('0x39')](_0x600382[_0xdbe5('0x2f')],_0x328c19[_0xdbe5('0x31')]));if(_0x600382['query']['filter']){_0x46bce6['where']=_[_0xdbe5('0x3c')](_0x46bce6['where'],{'$or':_[_0xdbe5('0x29')](_0x46bce6[_0xdbe5('0x33')],function(_0x2b5630){var _0x113022={};_0x113022[_0x2b5630]={'$like':'%'+_0x600382['query'][_0xdbe5('0x3a')]+'%'};return _0x113022;})});}_0x46bce6=_[_0xdbe5('0x3c')]({},_0x46bce6,_0x600382[_0xdbe5('0x4d')]);return _0x27cc2a[_0xdbe5('0x4a')](_0x46bce6);}})[_0xdbe5('0x3f')](function(_0x2b42eb){if(_0x2b42eb){_0x26b5f0=_0x2b42eb[_0xdbe5('0x35')];if(!_0x600382[_0xdbe5('0x2f')][_0xdbe5('0x36')]('nolimit')){_0x46bce6[_0xdbe5('0x1d')]=qs['limit'](_0x600382['query'][_0xdbe5('0x1d')]);_0x46bce6[_0xdbe5('0x1b')]=qs[_0xdbe5('0x1b')](_0x600382[_0xdbe5('0x2f')][_0xdbe5('0x1b')]);}return _0x27cc2a[_0xdbe5('0x4a')](_0x46bce6);}})[_0xdbe5('0x3f')](function(_0x55a25b){if(_0x55a25b){return _0x55a25b?{'count':_0x26b5f0,'rows':_0x55a25b}:null;}})[_0xdbe5('0x3f')](respondWithResult(_0x4c5dc3,null))['catch'](handleError(_0x4c5dc3,null));};exports[_0xdbe5('0x4e')]=function(_0x12f968,_0xbe3fb6,_0x4bddef){var _0x29ed6d={};var _0xed8fed={};var _0x1a8d3c;var _0x822196;return db[_0xdbe5('0x3e')][_0xdbe5('0x4b')]({'where':{'id':_0x12f968[_0xdbe5('0x45')]['id']}})[_0xdbe5('0x3f')](handleEntityNotFound(_0xbe3fb6,null))[_0xdbe5('0x3f')](function(_0x1385c9){if(_0x1385c9){_0x1a8d3c=_0x1385c9;_0xed8fed[_0xdbe5('0x2e')]=_[_0xdbe5('0x30')](db[_0xdbe5('0x4c')]['rawAttributes']);_0xed8fed[_0xdbe5('0x2f')]=_[_0xdbe5('0x30')](_0x12f968['query']);_0xed8fed[_0xdbe5('0x31')]=_[_0xdbe5('0x32')](_0xed8fed[_0xdbe5('0x2e')],_0xed8fed[_0xdbe5('0x2f')]);_0x29ed6d[_0xdbe5('0x33')]=_[_0xdbe5('0x32')](_0xed8fed['model'],qs['fields'](_0x12f968[_0xdbe5('0x2f')][_0xdbe5('0x34')]));_0x29ed6d[_0xdbe5('0x33')]=_0x29ed6d[_0xdbe5('0x33')]['length']?_0x29ed6d[_0xdbe5('0x33')]:_0xed8fed['model'];_0x29ed6d[_0xdbe5('0x37')]=qs['sort'](_0x12f968[_0xdbe5('0x2f')]['sort']);_0x29ed6d[_0xdbe5('0x3b')]=qs['filters'](_[_0xdbe5('0x39')](_0x12f968[_0xdbe5('0x2f')],_0xed8fed[_0xdbe5('0x31')]));if(_0x12f968[_0xdbe5('0x2f')][_0xdbe5('0x3a')]){_0x29ed6d[_0xdbe5('0x3b')]=_['merge'](_0x29ed6d[_0xdbe5('0x3b')],{'$or':_['map'](_0x29ed6d[_0xdbe5('0x33')],function(_0xbdb624){var _0x41222d={};_0x41222d[_0xbdb624]={'$like':'%'+_0x12f968[_0xdbe5('0x2f')][_0xdbe5('0x3a')]+'%'};return _0x41222d;})});}_0x29ed6d=_[_0xdbe5('0x3c')]({},_0x29ed6d,_0x12f968['options']);return _0x1a8d3c[_0xdbe5('0x4e')](_0x29ed6d);}})['then'](function(_0x42e62b){if(_0x42e62b){_0x822196=_0x42e62b[_0xdbe5('0x35')];if(!_0x12f968[_0xdbe5('0x2f')]['hasOwnProperty']('nolimit')){_0x29ed6d[_0xdbe5('0x1d')]=qs['limit'](_0x12f968['query'][_0xdbe5('0x1d')]);_0x29ed6d['offset']=qs['offset'](_0x12f968[_0xdbe5('0x2f')][_0xdbe5('0x1b')]);}return _0x1a8d3c['getSubjects'](_0x29ed6d);}})[_0xdbe5('0x3f')](function(_0x758fa6){if(_0x758fa6){return _0x758fa6?{'count':_0x822196,'rows':_0x758fa6}:null;}})[_0xdbe5('0x3f')](respondWithResult(_0xbe3fb6,null))[_0xdbe5('0x43')](handleError(_0xbe3fb6,null));};exports[_0xdbe5('0x4f')]=function(_0x441b7a,_0x325595,_0x5908e8){var _0x19149d={};var _0x2a168a={};var _0xa4ffd3;var _0x32b13f;return db['VtigerConfiguration'][_0xdbe5('0x4b')]({'where':{'id':_0x441b7a[_0xdbe5('0x45')]['id']}})[_0xdbe5('0x3f')](handleEntityNotFound(_0x325595,null))['then'](function(_0x38208b){if(_0x38208b){_0xa4ffd3=_0x38208b;_0x2a168a[_0xdbe5('0x2e')]=_['keys'](db[_0xdbe5('0x4c')][_0xdbe5('0x2a')]);_0x2a168a[_0xdbe5('0x2f')]=_['keys'](_0x441b7a[_0xdbe5('0x2f')]);_0x2a168a['filters']=_[_0xdbe5('0x32')](_0x2a168a[_0xdbe5('0x2e')],_0x2a168a['query']);_0x19149d['attributes']=_[_0xdbe5('0x32')](_0x2a168a[_0xdbe5('0x2e')],qs[_0xdbe5('0x34')](_0x441b7a[_0xdbe5('0x2f')][_0xdbe5('0x34')]));_0x19149d[_0xdbe5('0x33')]=_0x19149d[_0xdbe5('0x33')]['length']?_0x19149d[_0xdbe5('0x33')]:_0x2a168a[_0xdbe5('0x2e')];_0x19149d[_0xdbe5('0x37')]=qs[_0xdbe5('0x38')](_0x441b7a['query'][_0xdbe5('0x38')]);_0x19149d[_0xdbe5('0x3b')]=qs['filters'](_['pick'](_0x441b7a[_0xdbe5('0x2f')],_0x2a168a[_0xdbe5('0x31')]));if(_0x441b7a[_0xdbe5('0x2f')]['filter']){_0x19149d['where']=_[_0xdbe5('0x3c')](_0x19149d[_0xdbe5('0x3b')],{'$or':_[_0xdbe5('0x29')](_0x19149d[_0xdbe5('0x33')],function(_0x3db6fd){var _0x257222={};_0x257222[_0x3db6fd]={'$like':'%'+_0x441b7a[_0xdbe5('0x2f')][_0xdbe5('0x3a')]+'%'};return _0x257222;})});}_0x19149d=_[_0xdbe5('0x3c')]({},_0x19149d,_0x441b7a['options']);return _0xa4ffd3[_0xdbe5('0x4f')](_0x19149d);}})[_0xdbe5('0x3f')](function(_0x4c7306){if(_0x4c7306){_0x32b13f=_0x4c7306[_0xdbe5('0x35')];if(!_0x441b7a['query'][_0xdbe5('0x36')]('nolimit')){_0x19149d[_0xdbe5('0x1d')]=qs[_0xdbe5('0x1d')](_0x441b7a['query'][_0xdbe5('0x1d')]);_0x19149d[_0xdbe5('0x1b')]=qs[_0xdbe5('0x1b')](_0x441b7a[_0xdbe5('0x2f')][_0xdbe5('0x1b')]);}return _0xa4ffd3['getDescriptions'](_0x19149d);}})[_0xdbe5('0x3f')](function(_0x417b68){if(_0x417b68){return _0x417b68?{'count':_0x32b13f,'rows':_0x417b68}:null;}})[_0xdbe5('0x3f')](respondWithResult(_0x325595,null))[_0xdbe5('0x43')](handleError(_0x325595,null));}; \ No newline at end of file +var _0x9670=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','include','options','create','body','find','getFields','VtigerField','nolimit','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x52482e,_0x5edc49){var _0x321d74=function(_0x59b6b9){while(--_0x59b6b9){_0x52482e['push'](_0x52482e['shift']());}};_0x321d74(++_0x5edc49);}(_0x9670,0xea));var _0x0967=function(_0x51d921,_0xceb073){_0x51d921=_0x51d921-0x0;var _0x33824f=_0x9670[_0x51d921];return _0x33824f;};'use strict';var emlformat=require(_0x0967('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0967('0x1'));var jsonpatch=require(_0x0967('0x2'));var rp=require(_0x0967('0x3'));var moment=require(_0x0967('0x4'));var BPromise=require(_0x0967('0x5'));var Mustache=require(_0x0967('0x6'));var util=require(_0x0967('0x7'));var path=require(_0x0967('0x8'));var sox=require(_0x0967('0x9'));var csv=require(_0x0967('0xa'));var ejs=require(_0x0967('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0967('0xc'));var crypto=require(_0x0967('0xd'));var jsforce=require(_0x0967('0xe'));var deskjs=require(_0x0967('0xf'));var toCsv=require(_0x0967('0xa'));var querystring=require('querystring');var Papa=require(_0x0967('0x10'));var Redis=require(_0x0967('0x11'));var authService=require(_0x0967('0x12'));var qs=require(_0x0967('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0967('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0967('0x15'));var config=require(_0x0967('0x16'));var licenseUtil=require(_0x0967('0x17'));var db=require(_0x0967('0x18'))['db'];function respondWithStatusCode(_0x3f00a2,_0x5bfe8e){_0x5bfe8e=_0x5bfe8e||0xcc;return function(_0x26252b){if(_0x26252b){return _0x3f00a2[_0x0967('0x19')](_0x5bfe8e);}return _0x3f00a2[_0x0967('0x1a')](_0x5bfe8e)[_0x0967('0x1b')]();};}function respondWithResult(_0x3b9b62,_0x17a406){_0x17a406=_0x17a406||0xc8;return function(_0x176089){if(_0x176089){return _0x3b9b62[_0x0967('0x1a')](_0x17a406)[_0x0967('0x1c')](_0x176089);}};}function respondWithFilteredResult(_0x680be1,_0x2d1e1c){return function(_0xdedb0e){if(_0xdedb0e){var _0xa988e6=typeof _0x2d1e1c[_0x0967('0x1d')]===_0x0967('0x1e')&&typeof _0x2d1e1c[_0x0967('0x1f')]==='undefined';var _0x279fed=_0xdedb0e[_0x0967('0x20')];var _0x8b3a5e=_0xa988e6?0x0:_0x2d1e1c[_0x0967('0x1d')];var _0xee86f1=_0xa988e6?_0xdedb0e[_0x0967('0x20')]:_0x2d1e1c['offset']+_0x2d1e1c[_0x0967('0x1f')];var _0x3d0f05;if(_0xee86f1>=_0x279fed){_0xee86f1=_0x279fed;_0x3d0f05=0xc8;}else{_0x3d0f05=0xce;}_0x680be1[_0x0967('0x1a')](_0x3d0f05);return _0x680be1[_0x0967('0x21')](_0x0967('0x22'),_0x8b3a5e+'-'+_0xee86f1+'/'+_0x279fed)[_0x0967('0x1c')](_0xdedb0e);}return null;};}function patchUpdates(_0x39ef2a){return function(_0x440a51){try{jsonpatch[_0x0967('0x23')](_0x440a51,_0x39ef2a,!![]);}catch(_0xed5024){return BPromise[_0x0967('0x24')](_0xed5024);}return _0x440a51['save']();};}function saveUpdates(_0x57c990,_0x4c0775){return function(_0x1e7415){if(_0x1e7415){return _0x1e7415[_0x0967('0x25')](_0x57c990)['then'](function(_0x19a166){return _0x19a166;});}return null;};}function removeEntity(_0x5d7d93,_0x5522fc){return function(_0x43ca59){if(_0x43ca59){return _0x43ca59[_0x0967('0x26')]()[_0x0967('0x27')](function(){_0x5d7d93[_0x0967('0x1a')](0xcc)[_0x0967('0x1b')]();});}};}function handleEntityNotFound(_0xbb81e2,_0x13a7dc){return function(_0x11a82e){if(!_0x11a82e){_0xbb81e2[_0x0967('0x19')](0x194);}return _0x11a82e;};}function handleError(_0x2fba1a,_0x47600d){_0x47600d=_0x47600d||0x1f4;return function(_0x26a7fd){logger[_0x0967('0x28')](_0x26a7fd[_0x0967('0x29')]);if(_0x26a7fd['name']){delete _0x26a7fd[_0x0967('0x2a')];}_0x2fba1a[_0x0967('0x1a')](_0x47600d)[_0x0967('0x2b')](_0x26a7fd);};}exports[_0x0967('0x2c')]=function(_0x335dda,_0x1a4fd7){var _0xdfb57f={},_0x2bbb25={},_0x598ce4={'count':0x0,'rows':[]};var _0xdbd939=_[_0x0967('0x2d')](db[_0x0967('0x2e')][_0x0967('0x2f')],function(_0x458136){return{'name':_0x458136[_0x0967('0x30')],'type':_0x458136[_0x0967('0x31')][_0x0967('0x32')]};});_0x2bbb25['model']=_[_0x0967('0x2d')](_0xdbd939,_0x0967('0x2a'));_0x2bbb25['query']=_['keys'](_0x335dda[_0x0967('0x33')]);_0x2bbb25[_0x0967('0x34')]=_['intersection'](_0x2bbb25['model'],_0x2bbb25[_0x0967('0x33')]);_0xdfb57f[_0x0967('0x35')]=_[_0x0967('0x36')](_0x2bbb25[_0x0967('0x37')],qs[_0x0967('0x38')](_0x335dda['query']['fields']));_0xdfb57f[_0x0967('0x35')]=_0xdfb57f[_0x0967('0x35')][_0x0967('0x39')]?_0xdfb57f[_0x0967('0x35')]:_0x2bbb25[_0x0967('0x37')];if(!_0x335dda[_0x0967('0x33')][_0x0967('0x3a')]('nolimit')){_0xdfb57f[_0x0967('0x1f')]=qs[_0x0967('0x1f')](_0x335dda[_0x0967('0x33')]['limit']);_0xdfb57f[_0x0967('0x1d')]=qs[_0x0967('0x1d')](_0x335dda[_0x0967('0x33')][_0x0967('0x1d')]);}_0xdfb57f[_0x0967('0x3b')]=qs[_0x0967('0x3c')](_0x335dda[_0x0967('0x33')][_0x0967('0x3c')]);_0xdfb57f[_0x0967('0x3d')]=qs[_0x0967('0x34')](_[_0x0967('0x3e')](_0x335dda[_0x0967('0x33')],_0x2bbb25[_0x0967('0x34')]),_0xdbd939);if(_0x335dda[_0x0967('0x33')][_0x0967('0x3f')]){_0xdfb57f[_0x0967('0x3d')]=_[_0x0967('0x40')](_0xdfb57f[_0x0967('0x3d')],{'$or':_[_0x0967('0x2d')](_0xdbd939,function(_0x213b05){if(_0x213b05[_0x0967('0x31')]!==_0x0967('0x41')){var _0x3e5ca5={};_0x3e5ca5[_0x213b05[_0x0967('0x2a')]]={'$like':'%'+_0x335dda[_0x0967('0x33')][_0x0967('0x3f')]+'%'};return _0x3e5ca5;}})});}_0xdfb57f=_[_0x0967('0x40')]({},_0xdfb57f,_0x335dda['options']);var _0x45d9c2={'where':_0xdfb57f[_0x0967('0x3d')]};return db[_0x0967('0x2e')][_0x0967('0x20')](_0x45d9c2)[_0x0967('0x27')](function(_0x1c868b){_0x598ce4['count']=_0x1c868b;if(_0x335dda[_0x0967('0x33')][_0x0967('0x42')]){_0xdfb57f['include']=[{'all':!![]}];}return db[_0x0967('0x2e')]['findAll'](_0xdfb57f);})[_0x0967('0x27')](function(_0xe927b2){_0x598ce4[_0x0967('0x43')]=_0xe927b2;return _0x598ce4;})['then'](respondWithFilteredResult(_0x1a4fd7,_0xdfb57f))[_0x0967('0x44')](handleError(_0x1a4fd7,null));};exports[_0x0967('0x45')]=function(_0x16355d,_0x1a5f58){var _0x3ac813={'raw':![],'where':{'id':_0x16355d[_0x0967('0x46')]['id']}},_0x18ab0f={};_0x18ab0f[_0x0967('0x37')]=_['keys'](db[_0x0967('0x2e')]['rawAttributes']);_0x18ab0f[_0x0967('0x33')]=_[_0x0967('0x47')](_0x16355d[_0x0967('0x33')]);_0x18ab0f[_0x0967('0x34')]=_[_0x0967('0x36')](_0x18ab0f[_0x0967('0x37')],_0x18ab0f[_0x0967('0x33')]);_0x3ac813[_0x0967('0x35')]=_[_0x0967('0x36')](_0x18ab0f[_0x0967('0x37')],qs[_0x0967('0x38')](_0x16355d[_0x0967('0x33')][_0x0967('0x38')]));_0x3ac813[_0x0967('0x35')]=_0x3ac813[_0x0967('0x35')][_0x0967('0x39')]?_0x3ac813['attributes']:_0x18ab0f[_0x0967('0x37')];if(_0x16355d[_0x0967('0x33')]['includeAll']){_0x3ac813[_0x0967('0x48')]=[{'all':!![]}];}_0x3ac813=_[_0x0967('0x40')]({},_0x3ac813,_0x16355d[_0x0967('0x49')]);return db[_0x0967('0x2e')]['find'](_0x3ac813)[_0x0967('0x27')](handleEntityNotFound(_0x1a5f58,null))[_0x0967('0x27')](respondWithResult(_0x1a5f58,null))[_0x0967('0x44')](handleError(_0x1a5f58,null));};exports[_0x0967('0x4a')]=function(_0x225e41,_0x4818d0){return db['VtigerConfiguration'][_0x0967('0x4a')](_0x225e41['body'],{})['then'](respondWithResult(_0x4818d0,0xc9))['catch'](handleError(_0x4818d0,null));};exports[_0x0967('0x25')]=function(_0x2e0c87,_0xb9c961){if(_0x2e0c87[_0x0967('0x4b')]['id']){delete _0x2e0c87[_0x0967('0x4b')]['id'];}return db[_0x0967('0x2e')][_0x0967('0x4c')]({'where':{'id':_0x2e0c87['params']['id']}})[_0x0967('0x27')](handleEntityNotFound(_0xb9c961,null))[_0x0967('0x27')](saveUpdates(_0x2e0c87[_0x0967('0x4b')],null))[_0x0967('0x27')](respondWithResult(_0xb9c961,null))[_0x0967('0x44')](handleError(_0xb9c961,null));};exports[_0x0967('0x26')]=function(_0x5a5262,_0x1197ee){return db['VtigerConfiguration'][_0x0967('0x4c')]({'where':{'id':_0x5a5262['params']['id']}})[_0x0967('0x27')](handleEntityNotFound(_0x1197ee,null))[_0x0967('0x27')](removeEntity(_0x1197ee,null))[_0x0967('0x44')](handleError(_0x1197ee,null));};exports[_0x0967('0x4d')]=function(_0x3cf316,_0x17ce88,_0x4e820c){var _0x25f12d={};var _0x613d86={};var _0x3f1295;var _0x4c2114;return db[_0x0967('0x2e')]['findOne']({'where':{'id':_0x3cf316['params']['id']}})[_0x0967('0x27')](handleEntityNotFound(_0x17ce88,null))[_0x0967('0x27')](function(_0x6ab686){if(_0x6ab686){_0x3f1295=_0x6ab686;_0x613d86['model']=_[_0x0967('0x47')](db[_0x0967('0x4e')]['rawAttributes']);_0x613d86[_0x0967('0x33')]=_[_0x0967('0x47')](_0x3cf316[_0x0967('0x33')]);_0x613d86[_0x0967('0x34')]=_[_0x0967('0x36')](_0x613d86[_0x0967('0x37')],_0x613d86[_0x0967('0x33')]);_0x25f12d[_0x0967('0x35')]=_['intersection'](_0x613d86[_0x0967('0x37')],qs['fields'](_0x3cf316[_0x0967('0x33')]['fields']));_0x25f12d['attributes']=_0x25f12d[_0x0967('0x35')][_0x0967('0x39')]?_0x25f12d[_0x0967('0x35')]:_0x613d86[_0x0967('0x37')];_0x25f12d['order']=qs[_0x0967('0x3c')](_0x3cf316[_0x0967('0x33')][_0x0967('0x3c')]);_0x25f12d['where']=qs['filters'](_[_0x0967('0x3e')](_0x3cf316[_0x0967('0x33')],_0x613d86[_0x0967('0x34')]));if(_0x3cf316[_0x0967('0x33')][_0x0967('0x3f')]){_0x25f12d['where']=_[_0x0967('0x40')](_0x25f12d[_0x0967('0x3d')],{'$or':_['map'](_0x25f12d[_0x0967('0x35')],function(_0x5813e4){var _0x2080b5={};_0x2080b5[_0x5813e4]={'$like':'%'+_0x3cf316['query']['filter']+'%'};return _0x2080b5;})});}_0x25f12d=_[_0x0967('0x40')]({},_0x25f12d,_0x3cf316[_0x0967('0x49')]);return _0x3f1295[_0x0967('0x4d')](_0x25f12d);}})[_0x0967('0x27')](function(_0x1c18e4){if(_0x1c18e4){_0x4c2114=_0x1c18e4[_0x0967('0x39')];if(!_0x3cf316['query']['hasOwnProperty'](_0x0967('0x4f'))){_0x25f12d[_0x0967('0x1f')]=qs[_0x0967('0x1f')](_0x3cf316[_0x0967('0x33')][_0x0967('0x1f')]);_0x25f12d[_0x0967('0x1d')]=qs[_0x0967('0x1d')](_0x3cf316[_0x0967('0x33')]['offset']);}return _0x3f1295[_0x0967('0x4d')](_0x25f12d);}})['then'](function(_0x5a5f4f){if(_0x5a5f4f){return _0x5a5f4f?{'count':_0x4c2114,'rows':_0x5a5f4f}:null;}})[_0x0967('0x27')](respondWithResult(_0x17ce88,null))[_0x0967('0x44')](handleError(_0x17ce88,null));};exports[_0x0967('0x50')]=function(_0x185e89,_0x36ee36,_0x1c0679){var _0x14da72={};var _0x364c25={};var _0x43455a;var _0x165014;return db[_0x0967('0x2e')][_0x0967('0x51')]({'where':{'id':_0x185e89[_0x0967('0x46')]['id']}})['then'](handleEntityNotFound(_0x36ee36,null))['then'](function(_0x1ce788){if(_0x1ce788){_0x43455a=_0x1ce788;_0x364c25[_0x0967('0x37')]=_[_0x0967('0x47')](db[_0x0967('0x4e')][_0x0967('0x2f')]);_0x364c25[_0x0967('0x33')]=_[_0x0967('0x47')](_0x185e89[_0x0967('0x33')]);_0x364c25[_0x0967('0x34')]=_[_0x0967('0x36')](_0x364c25[_0x0967('0x37')],_0x364c25[_0x0967('0x33')]);_0x14da72[_0x0967('0x35')]=_[_0x0967('0x36')](_0x364c25['model'],qs[_0x0967('0x38')](_0x185e89[_0x0967('0x33')]['fields']));_0x14da72[_0x0967('0x35')]=_0x14da72[_0x0967('0x35')]['length']?_0x14da72[_0x0967('0x35')]:_0x364c25['model'];_0x14da72[_0x0967('0x3b')]=qs[_0x0967('0x3c')](_0x185e89[_0x0967('0x33')][_0x0967('0x3c')]);_0x14da72[_0x0967('0x3d')]=qs[_0x0967('0x34')](_[_0x0967('0x3e')](_0x185e89[_0x0967('0x33')],_0x364c25[_0x0967('0x34')]));if(_0x185e89[_0x0967('0x33')][_0x0967('0x3f')]){_0x14da72['where']=_[_0x0967('0x40')](_0x14da72[_0x0967('0x3d')],{'$or':_['map'](_0x14da72['attributes'],function(_0x29ab10){var _0x257ec0={};_0x257ec0[_0x29ab10]={'$like':'%'+_0x185e89[_0x0967('0x33')]['filter']+'%'};return _0x257ec0;})});}_0x14da72=_['merge']({},_0x14da72,_0x185e89[_0x0967('0x49')]);return _0x43455a['getSubjects'](_0x14da72);}})[_0x0967('0x27')](function(_0x5396e8){if(_0x5396e8){_0x165014=_0x5396e8['length'];if(!_0x185e89[_0x0967('0x33')][_0x0967('0x3a')](_0x0967('0x4f'))){_0x14da72['limit']=qs['limit'](_0x185e89[_0x0967('0x33')][_0x0967('0x1f')]);_0x14da72['offset']=qs['offset'](_0x185e89[_0x0967('0x33')][_0x0967('0x1d')]);}return _0x43455a[_0x0967('0x50')](_0x14da72);}})[_0x0967('0x27')](function(_0x3d54e5){if(_0x3d54e5){return _0x3d54e5?{'count':_0x165014,'rows':_0x3d54e5}:null;}})[_0x0967('0x27')](respondWithResult(_0x36ee36,null))['catch'](handleError(_0x36ee36,null));};exports[_0x0967('0x52')]=function(_0x6cb592,_0x1643fb,_0x17fe17){var _0x5cf9a0={};var _0x579302={};var _0xdb792e;var _0x40aef1;return db['VtigerConfiguration'][_0x0967('0x51')]({'where':{'id':_0x6cb592[_0x0967('0x46')]['id']}})[_0x0967('0x27')](handleEntityNotFound(_0x1643fb,null))[_0x0967('0x27')](function(_0x1038c6){if(_0x1038c6){_0xdb792e=_0x1038c6;_0x579302[_0x0967('0x37')]=_[_0x0967('0x47')](db[_0x0967('0x4e')][_0x0967('0x2f')]);_0x579302['query']=_['keys'](_0x6cb592['query']);_0x579302[_0x0967('0x34')]=_[_0x0967('0x36')](_0x579302[_0x0967('0x37')],_0x579302[_0x0967('0x33')]);_0x5cf9a0[_0x0967('0x35')]=_[_0x0967('0x36')](_0x579302[_0x0967('0x37')],qs[_0x0967('0x38')](_0x6cb592[_0x0967('0x33')]['fields']));_0x5cf9a0[_0x0967('0x35')]=_0x5cf9a0[_0x0967('0x35')][_0x0967('0x39')]?_0x5cf9a0[_0x0967('0x35')]:_0x579302['model'];_0x5cf9a0[_0x0967('0x3b')]=qs['sort'](_0x6cb592[_0x0967('0x33')][_0x0967('0x3c')]);_0x5cf9a0['where']=qs[_0x0967('0x34')](_[_0x0967('0x3e')](_0x6cb592[_0x0967('0x33')],_0x579302[_0x0967('0x34')]));if(_0x6cb592['query']['filter']){_0x5cf9a0['where']=_['merge'](_0x5cf9a0[_0x0967('0x3d')],{'$or':_[_0x0967('0x2d')](_0x5cf9a0[_0x0967('0x35')],function(_0x55f6a1){var _0x431a91={};_0x431a91[_0x55f6a1]={'$like':'%'+_0x6cb592['query'][_0x0967('0x3f')]+'%'};return _0x431a91;})});}_0x5cf9a0=_[_0x0967('0x40')]({},_0x5cf9a0,_0x6cb592['options']);return _0xdb792e['getDescriptions'](_0x5cf9a0);}})['then'](function(_0x4a3987){if(_0x4a3987){_0x40aef1=_0x4a3987['length'];if(!_0x6cb592[_0x0967('0x33')]['hasOwnProperty'](_0x0967('0x4f'))){_0x5cf9a0['limit']=qs['limit'](_0x6cb592['query'][_0x0967('0x1f')]);_0x5cf9a0[_0x0967('0x1d')]=qs[_0x0967('0x1d')](_0x6cb592[_0x0967('0x33')][_0x0967('0x1d')]);}return _0xdb792e[_0x0967('0x52')](_0x5cf9a0);}})[_0x0967('0x27')](function(_0x14d31b){if(_0x14d31b){return _0x14d31b?{'count':_0x40aef1,'rows':_0x14d31b}:null;}})[_0x0967('0x27')](respondWithResult(_0x1643fb,null))[_0x0967('0x44')](handleError(_0x1643fb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index c9bc4ec..cd03c4a 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 _0x4c7b=['request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c7b,0x18d));var _0xb4c7=function(_0x5a6c17,_0x4d4825){_0x5a6c17=_0x5a6c17-0x0;var _0x746f28=_0x4c7b[_0x5a6c17];return _0x746f28;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb4c7('0x0'))('api');var moment=require(_0xb4c7('0x1'));var BPromise=require(_0xb4c7('0x2'));var rp=require(_0xb4c7('0x3'));var fs=require('fs');var path=require(_0xb4c7('0x4'));var rimraf=require(_0xb4c7('0x5'));var config=require('../../config/environment');var attributes=require(_0xb4c7('0x6'));module['exports']=function(_0x317f31,_0x46a4e1){return _0x317f31[_0xb4c7('0x7')](_0xb4c7('0x8'),attributes,{'tableName':_0xb4c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4f2=['define','VtigerConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x1c9f7b,_0x2dc4b0){var _0x580a06=function(_0x2c858f){while(--_0x2c858f){_0x1c9f7b['push'](_0x1c9f7b['shift']());}};_0x580a06(++_0x2dc4b0);}(_0xe4f2,0x1af));var _0x2e4f=function(_0x469ae2,_0x24cd30){_0x469ae2=_0x469ae2-0x0;var _0x5e33e4=_0xe4f2[_0x469ae2];return _0x5e33e4;};'use strict';var _=require(_0x2e4f('0x0'));var util=require('util');var logger=require(_0x2e4f('0x1'))(_0x2e4f('0x2'));var moment=require(_0x2e4f('0x3'));var BPromise=require(_0x2e4f('0x4'));var rp=require(_0x2e4f('0x5'));var fs=require('fs');var path=require(_0x2e4f('0x6'));var rimraf=require(_0x2e4f('0x7'));var config=require(_0x2e4f('0x8'));var attributes=require(_0x2e4f('0x9'));module[_0x2e4f('0xa')]=function(_0x1fa759,_0x29e756){return _0x1fa759[_0x2e4f('0xb')](_0x2e4f('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 8690461..c495c44 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 _0xbe10=['http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x45c0fe,_0x499297){var _0x1c4d53=function(_0x2c0aad){while(--_0x2c0aad){_0x45c0fe['push'](_0x45c0fe['shift']());}};_0x1c4d53(++_0x499297);}(_0xbe10,0x1d8));var _0x0be1=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xbe10[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x0be1('0x0'));var util=require(_0x0be1('0x1'));var moment=require(_0x0be1('0x2'));var BPromise=require(_0x0be1('0x3'));var rs=require(_0x0be1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0be1('0x5'))['db'];var utils=require(_0x0be1('0x6'));var logger=require(_0x0be1('0x7'))('rpc');var config=require(_0x0be1('0x8'));var jayson=require(_0x0be1('0x9'));var client=jayson[_0x0be1('0xa')][_0x0be1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14873c,_0x2f2a47,_0x18c4d6){return new BPromise(function(_0x4869cd,_0x1e494){return client[_0x0be1('0xc')](_0x14873c,_0x18c4d6)[_0x0be1('0xd')](function(_0x350dae){logger['info'](_0x0be1('0xe'),_0x2f2a47,_0x0be1('0xf'));logger['debug'](_0x0be1('0x10'),_0x2f2a47,_0x0be1('0xf'),JSON[_0x0be1('0x11')](_0x350dae));if(_0x350dae[_0x0be1('0x12')]){if(_0x350dae[_0x0be1('0x12')]['code']===0x1f4){logger[_0x0be1('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x2f2a47,_0x350dae['error']['message']);return _0x1e494(_0x350dae['error'][_0x0be1('0x13')]);}logger[_0x0be1('0x12')](_0x0be1('0xe'),_0x2f2a47,_0x350dae[_0x0be1('0x12')][_0x0be1('0x13')]);return _0x4869cd(_0x350dae['error']['message']);}else{logger[_0x0be1('0x14')](_0x0be1('0xe'),_0x2f2a47,_0x0be1('0xf'));_0x4869cd(_0x350dae[_0x0be1('0x15')]['message']);}})[_0x0be1('0x16')](function(_0x4c5c6f){logger[_0x0be1('0x12')](_0x0be1('0xe'),_0x2f2a47,_0x4c5c6f);_0x1e494(_0x4c5c6f);});});} \ No newline at end of file +var _0xcb67=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xcb67,0xbb));var _0x7cb6=function(_0x3f4cd0,_0x303070){_0x3f4cd0=_0x3f4cd0-0x0;var _0x3f9f01=_0xcb67[_0x3f4cd0];return _0x3f9f01;};'use strict';var _=require(_0x7cb6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7cb6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cb6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cb6('0x3'));var logger=require(_0x7cb6('0x4'))('rpc');var config=require(_0x7cb6('0x5'));var jayson=require(_0x7cb6('0x6'));var client=jayson[_0x7cb6('0x7')][_0x7cb6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbf539a,_0xbcc637,_0x40c5aa){return new BPromise(function(_0xf0c507,_0x4a6011){return client[_0x7cb6('0x9')](_0xbf539a,_0x40c5aa)[_0x7cb6('0xa')](function(_0x375c88){logger[_0x7cb6('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0xbcc637,_0x7cb6('0xc'));logger[_0x7cb6('0xd')](_0x7cb6('0xe'),_0xbcc637,_0x7cb6('0xc'),JSON[_0x7cb6('0xf')](_0x375c88));if(_0x375c88['error']){if(_0x375c88[_0x7cb6('0x10')]['code']===0x1f4){logger[_0x7cb6('0x10')](_0x7cb6('0x11'),_0xbcc637,_0x375c88[_0x7cb6('0x10')][_0x7cb6('0x12')]);return _0x4a6011(_0x375c88[_0x7cb6('0x10')][_0x7cb6('0x12')]);}logger[_0x7cb6('0x10')](_0x7cb6('0x11'),_0xbcc637,_0x375c88[_0x7cb6('0x10')]['message']);return _0xf0c507(_0x375c88[_0x7cb6('0x10')][_0x7cb6('0x12')]);}else{logger[_0x7cb6('0xb')](_0x7cb6('0x11'),_0xbcc637,'request\x20sent');_0xf0c507(_0x375c88[_0x7cb6('0x13')]['message']);}})[_0x7cb6('0x14')](function(_0x17efe0){logger[_0x7cb6('0x10')](_0x7cb6('0x11'),_0xbcc637,_0x17efe0);_0x4a6011(_0x17efe0);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 9bb509a..2d09e5c 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 _0x74ba=['destroy','exports','util','express','../../components/auth/service','./intVtigerField.controller','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x2dc8ca,_0x34e003){var _0x36adf9=function(_0x5ba5d7){while(--_0x5ba5d7){_0x2dc8ca['push'](_0x2dc8ca['shift']());}};_0x36adf9(++_0x34e003);}(_0x74ba,0x136));var _0xa74b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x74ba[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xa74b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa74b('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa74b('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa74b('0x3'));router['get']('/',auth[_0xa74b('0x4')](),controller[_0xa74b('0x5')]);router['get'](_0xa74b('0x6'),auth[_0xa74b('0x4')](),controller[_0xa74b('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa74b('0x8')]);router[_0xa74b('0x9')](_0xa74b('0x6'),auth[_0xa74b('0x4')](),controller[_0xa74b('0xa')]);router[_0xa74b('0xb')]('/:id',auth[_0xa74b('0x4')](),controller[_0xa74b('0xc')]);module[_0xa74b('0xd')]=router; \ No newline at end of file +var _0x7bb6=['/:id','isAuthenticated','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x2a8c48,_0x12ee30){var _0x1887e2=function(_0x5babce){while(--_0x5babce){_0x2a8c48['push'](_0x2a8c48['shift']());}};_0x1887e2(++_0x12ee30);}(_0x7bb6,0xe7));var _0x67bb=function(_0xdcf533,_0x5743b6){_0xdcf533=_0xdcf533-0x0;var _0x805452=_0x7bb6[_0xdcf533];return _0x805452;};'use strict';var multer=require(_0x67bb('0x0'));var util=require('util');var path=require(_0x67bb('0x1'));var timeout=require(_0x67bb('0x2'));var express=require(_0x67bb('0x3'));var router=express[_0x67bb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x67bb('0x5'));var config=require(_0x67bb('0x6'));var controller=require(_0x67bb('0x7'));router[_0x67bb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x67bb('0x8')](_0x67bb('0x9'),auth[_0x67bb('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x67bb('0xb')]);router['put'](_0x67bb('0x9'),auth['isAuthenticated'](),controller[_0x67bb('0xc')]);router[_0x67bb('0xd')](_0x67bb('0x9'),auth['isAuthenticated'](),controller[_0x67bb('0xe')]);module[_0x67bb('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index e80116b..cfe9996 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 _0x1ae4=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0x1ae4,0x96));var _0x41ae=function(_0x4b40c8,_0x368ec3){_0x4b40c8=_0x4b40c8-0x0;var _0x566ec3=_0x1ae4[_0x4b40c8];return _0x566ec3;};'use strict';var Sequelize=require(_0x41ae('0x0'));module[_0x41ae('0x1')]={'type':{'type':Sequelize[_0x41ae('0x2')](_0x41ae('0x3'),'variable',_0x41ae('0x4'),_0x41ae('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x41ae('0x6')]},'key':{'type':Sequelize[_0x41ae('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x41ae('0x7'),_0x41ae('0x4'))},'keyContent':{'type':Sequelize[_0x41ae('0x6')]},'idField':{'type':Sequelize[_0x41ae('0x6')]},'nameField':{'type':Sequelize[_0x41ae('0x6')]},'customField':{'type':Sequelize[_0x41ae('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x566b=['variable','keyValue','picklist','STRING','customVariable','ENUM','string'];(function(_0x129954,_0x17b156){var _0x2b40f2=function(_0x5b3ce1){while(--_0x5b3ce1){_0x129954['push'](_0x129954['shift']());}};_0x2b40f2(++_0x17b156);}(_0x566b,0x140));var _0xb566=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x566b[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb566('0x0')](_0xb566('0x1'),_0xb566('0x2'),'customVariable',_0xb566('0x3'),_0xb566('0x4')),'defaultValue':_0xb566('0x1')},'content':{'type':Sequelize[_0xb566('0x5')]},'key':{'type':Sequelize[_0xb566('0x5')]},'keyType':{'type':Sequelize[_0xb566('0x0')](_0xb566('0x1'),_0xb566('0x2'),_0xb566('0x6'))},'keyContent':{'type':Sequelize[_0xb566('0x5')]},'idField':{'type':Sequelize[_0xb566('0x5')]},'nameField':{'type':Sequelize[_0xb566('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb566('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index cc78598..010ba91 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 _0x3fd7=['eml-format','rimraf','zip-dir','moment','bluebird','util','ejs','fs-extra','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','send','index','map','VtigerField','fieldName','type','key','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','include','findAll','rows','catch','params','model','rawAttributes','length','includeAll','options','create','body','update','find'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x3fd7,0x1a4));var _0x73fd=function(_0x132706,_0x190447){_0x132706=_0x132706-0x0;var _0x4c37cc=_0x3fd7[_0x132706];return _0x4c37cc;};'use strict';var emlformat=require(_0x73fd('0x0'));var rimraf=require(_0x73fd('0x1'));var zipdir=require(_0x73fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x73fd('0x3'));var BPromise=require(_0x73fd('0x4'));var Mustache=require('mustache');var util=require(_0x73fd('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x73fd('0x6'));var fs=require('fs');var fs_extra=require(_0x73fd('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x73fd('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73fd('0x9'));var querystring=require('querystring');var Papa=require(_0x73fd('0xa'));var Redis=require(_0x73fd('0xb'));var authService=require(_0x73fd('0xc'));var qs=require(_0x73fd('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x73fd('0xe'));var logger=require(_0x73fd('0xf'))(_0x73fd('0x10'));var utils=require(_0x73fd('0x11'));var config=require(_0x73fd('0x12'));var licenseUtil=require(_0x73fd('0x13'));var db=require(_0x73fd('0x14'))['db'];function respondWithStatusCode(_0x3cca22,_0x761424){_0x761424=_0x761424||0xcc;return function(_0x74c218){if(_0x74c218){return _0x3cca22[_0x73fd('0x15')](_0x761424);}return _0x3cca22['status'](_0x761424)[_0x73fd('0x16')]();};}function respondWithResult(_0x51236c,_0x4b88da){_0x4b88da=_0x4b88da||0xc8;return function(_0x2349dd){if(_0x2349dd){return _0x51236c[_0x73fd('0x17')](_0x4b88da)[_0x73fd('0x18')](_0x2349dd);}};}function respondWithFilteredResult(_0x4d7b31,_0x2375bc){return function(_0x59cf29){if(_0x59cf29){var _0x238de7=typeof _0x2375bc[_0x73fd('0x19')]===_0x73fd('0x1a')&&typeof _0x2375bc[_0x73fd('0x1b')]==='undefined';var _0x2b5c0d=_0x59cf29[_0x73fd('0x1c')];var _0x1108a7=_0x238de7?0x0:_0x2375bc['offset'];var _0x48a164=_0x238de7?_0x59cf29[_0x73fd('0x1c')]:_0x2375bc['offset']+_0x2375bc[_0x73fd('0x1b')];var _0x1d5e4b;if(_0x48a164>=_0x2b5c0d){_0x48a164=_0x2b5c0d;_0x1d5e4b=0xc8;}else{_0x1d5e4b=0xce;}_0x4d7b31[_0x73fd('0x17')](_0x1d5e4b);return _0x4d7b31[_0x73fd('0x1d')](_0x73fd('0x1e'),_0x1108a7+'-'+_0x48a164+'/'+_0x2b5c0d)[_0x73fd('0x18')](_0x59cf29);}return null;};}function patchUpdates(_0x3f66f2){return function(_0x142c4d){try{jsonpatch['apply'](_0x142c4d,_0x3f66f2,!![]);}catch(_0x4ad95d){return BPromise['reject'](_0x4ad95d);}return _0x142c4d['save']();};}function saveUpdates(_0x21d8d0,_0x320acf){return function(_0x4ba13e){if(_0x4ba13e){return _0x4ba13e['update'](_0x21d8d0)['then'](function(_0x4b07b1){return _0x4b07b1;});}return null;};}function removeEntity(_0x2f9b3b,_0x51db9b){return function(_0x12cc02){if(_0x12cc02){return _0x12cc02['destroy']()[_0x73fd('0x1f')](function(){_0x2f9b3b[_0x73fd('0x17')](0xcc)[_0x73fd('0x16')]();});}};}function handleEntityNotFound(_0x1ad034,_0x3a99f6){return function(_0x570487){if(!_0x570487){_0x1ad034[_0x73fd('0x15')](0x194);}return _0x570487;};}function handleError(_0x1731ca,_0x2e7274){_0x2e7274=_0x2e7274||0x1f4;return function(_0x453ea6){logger[_0x73fd('0x20')](_0x453ea6[_0x73fd('0x21')]);if(_0x453ea6[_0x73fd('0x22')]){delete _0x453ea6[_0x73fd('0x22')];}_0x1731ca['status'](_0x2e7274)[_0x73fd('0x23')](_0x453ea6);};}exports[_0x73fd('0x24')]=function(_0x10897f,_0x258b53){var _0xcf82ae={},_0x2fcebf={},_0x26891d={'count':0x0,'rows':[]};var _0xee3ab7=_[_0x73fd('0x25')](db[_0x73fd('0x26')]['rawAttributes'],function(_0x57b040){return{'name':_0x57b040[_0x73fd('0x27')],'type':_0x57b040[_0x73fd('0x28')][_0x73fd('0x29')]};});_0x2fcebf['model']=_[_0x73fd('0x25')](_0xee3ab7,_0x73fd('0x22'));_0x2fcebf[_0x73fd('0x2a')]=_[_0x73fd('0x2b')](_0x10897f[_0x73fd('0x2a')]);_0x2fcebf['filters']=_[_0x73fd('0x2c')](_0x2fcebf['model'],_0x2fcebf[_0x73fd('0x2a')]);_0xcf82ae[_0x73fd('0x2d')]=_[_0x73fd('0x2c')](_0x2fcebf['model'],qs[_0x73fd('0x2e')](_0x10897f['query']['fields']));_0xcf82ae[_0x73fd('0x2d')]=_0xcf82ae['attributes']['length']?_0xcf82ae[_0x73fd('0x2d')]:_0x2fcebf['model'];if(!_0x10897f[_0x73fd('0x2a')][_0x73fd('0x2f')](_0x73fd('0x30'))){_0xcf82ae[_0x73fd('0x1b')]=qs[_0x73fd('0x1b')](_0x10897f['query']['limit']);_0xcf82ae[_0x73fd('0x19')]=qs['offset'](_0x10897f[_0x73fd('0x2a')][_0x73fd('0x19')]);}_0xcf82ae[_0x73fd('0x31')]=qs[_0x73fd('0x32')](_0x10897f['query'][_0x73fd('0x32')]);_0xcf82ae[_0x73fd('0x33')]=qs[_0x73fd('0x34')](_[_0x73fd('0x35')](_0x10897f[_0x73fd('0x2a')],_0x2fcebf['filters']),_0xee3ab7);if(_0x10897f[_0x73fd('0x2a')][_0x73fd('0x36')]){_0xcf82ae['where']=_[_0x73fd('0x37')](_0xcf82ae['where'],{'$or':_[_0x73fd('0x25')](_0xee3ab7,function(_0x5a0957){if(_0x5a0957[_0x73fd('0x28')]!=='VIRTUAL'){var _0x5efd9d={};_0x5efd9d[_0x5a0957[_0x73fd('0x22')]]={'$like':'%'+_0x10897f[_0x73fd('0x2a')][_0x73fd('0x36')]+'%'};return _0x5efd9d;}})});}_0xcf82ae=_[_0x73fd('0x37')]({},_0xcf82ae,_0x10897f['options']);var _0x399fab={'where':_0xcf82ae[_0x73fd('0x33')]};return db[_0x73fd('0x26')][_0x73fd('0x1c')](_0x399fab)[_0x73fd('0x1f')](function(_0x3155f3){_0x26891d[_0x73fd('0x1c')]=_0x3155f3;if(_0x10897f[_0x73fd('0x2a')]['includeAll']){_0xcf82ae[_0x73fd('0x38')]=[{'all':!![]}];}return db[_0x73fd('0x26')][_0x73fd('0x39')](_0xcf82ae);})[_0x73fd('0x1f')](function(_0x143a23){_0x26891d[_0x73fd('0x3a')]=_0x143a23;return _0x26891d;})['then'](respondWithFilteredResult(_0x258b53,_0xcf82ae))[_0x73fd('0x3b')](handleError(_0x258b53,null));};exports['show']=function(_0x41713a,_0x33e762){var _0x5433d3={'raw':!![],'where':{'id':_0x41713a[_0x73fd('0x3c')]['id']}},_0x1ea0a8={};_0x1ea0a8[_0x73fd('0x3d')]=_['keys'](db[_0x73fd('0x26')][_0x73fd('0x3e')]);_0x1ea0a8[_0x73fd('0x2a')]=_[_0x73fd('0x2b')](_0x41713a['query']);_0x1ea0a8['filters']=_[_0x73fd('0x2c')](_0x1ea0a8[_0x73fd('0x3d')],_0x1ea0a8['query']);_0x5433d3[_0x73fd('0x2d')]=_[_0x73fd('0x2c')](_0x1ea0a8[_0x73fd('0x3d')],qs['fields'](_0x41713a['query'][_0x73fd('0x2e')]));_0x5433d3[_0x73fd('0x2d')]=_0x5433d3[_0x73fd('0x2d')][_0x73fd('0x3f')]?_0x5433d3[_0x73fd('0x2d')]:_0x1ea0a8[_0x73fd('0x3d')];if(_0x41713a[_0x73fd('0x2a')][_0x73fd('0x40')]){_0x5433d3[_0x73fd('0x38')]=[{'all':!![]}];}_0x5433d3=_[_0x73fd('0x37')]({},_0x5433d3,_0x41713a[_0x73fd('0x41')]);return db['VtigerField']['find'](_0x5433d3)[_0x73fd('0x1f')](handleEntityNotFound(_0x33e762,null))[_0x73fd('0x1f')](respondWithResult(_0x33e762,null))['catch'](handleError(_0x33e762,null));};exports[_0x73fd('0x42')]=function(_0x5db6c5,_0x5eeb24){return db[_0x73fd('0x26')][_0x73fd('0x42')](_0x5db6c5[_0x73fd('0x43')],{})[_0x73fd('0x1f')](respondWithResult(_0x5eeb24,0xc9))[_0x73fd('0x3b')](handleError(_0x5eeb24,null));};exports[_0x73fd('0x44')]=function(_0xed245c,_0x863a8b){if(_0xed245c[_0x73fd('0x43')]['id']){delete _0xed245c[_0x73fd('0x43')]['id'];}return db[_0x73fd('0x26')]['find']({'where':{'id':_0xed245c[_0x73fd('0x3c')]['id']}})[_0x73fd('0x1f')](handleEntityNotFound(_0x863a8b,null))['then'](saveUpdates(_0xed245c[_0x73fd('0x43')],null))[_0x73fd('0x1f')](respondWithResult(_0x863a8b,null))[_0x73fd('0x3b')](handleError(_0x863a8b,null));};exports['destroy']=function(_0x16f6aa,_0x9daa53){return db[_0x73fd('0x26')][_0x73fd('0x45')]({'where':{'id':_0x16f6aa[_0x73fd('0x3c')]['id']}})[_0x73fd('0x1f')](handleEntityNotFound(_0x9daa53,null))[_0x73fd('0x1f')](removeEntity(_0x9daa53,null))[_0x73fd('0x3b')](handleError(_0x9daa53,null));}; \ No newline at end of file +var _0xb864=['type','key','keys','query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','name','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','VtigerField','rawAttributes','fieldName'];(function(_0x428f8f,_0xfda06f){var _0x2b270e=function(_0x6d3931){while(--_0x6d3931){_0x428f8f['push'](_0x428f8f['shift']());}};_0x2b270e(++_0xfda06f);}(_0xb864,0x1bc));var _0x4b86=function(_0x29f94e,_0x4108ab){_0x29f94e=_0x29f94e-0x0;var _0x56b79c=_0xb864[_0x29f94e];return _0x56b79c;};'use strict';var emlformat=require(_0x4b86('0x0'));var rimraf=require(_0x4b86('0x1'));var zipdir=require(_0x4b86('0x2'));var jsonpatch=require(_0x4b86('0x3'));var rp=require('request-promise');var moment=require(_0x4b86('0x4'));var BPromise=require(_0x4b86('0x5'));var Mustache=require(_0x4b86('0x6'));var util=require(_0x4b86('0x7'));var path=require(_0x4b86('0x8'));var sox=require(_0x4b86('0x9'));var csv=require(_0x4b86('0xa'));var ejs=require(_0x4b86('0xb'));var fs=require('fs');var fs_extra=require(_0x4b86('0xc'));var _=require(_0x4b86('0xd'));var squel=require(_0x4b86('0xe'));var crypto=require('crypto');var jsforce=require(_0x4b86('0xf'));var deskjs=require(_0x4b86('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4b86('0x11'));var Papa=require(_0x4b86('0x12'));var Redis=require(_0x4b86('0x13'));var authService=require(_0x4b86('0x14'));var qs=require(_0x4b86('0x15'));var as=require(_0x4b86('0x16'));var hardwareService=require(_0x4b86('0x17'));var logger=require(_0x4b86('0x18'))(_0x4b86('0x19'));var utils=require(_0x4b86('0x1a'));var config=require(_0x4b86('0x1b'));var licenseUtil=require(_0x4b86('0x1c'));var db=require(_0x4b86('0x1d'))['db'];function respondWithStatusCode(_0x230a5d,_0x39432f){_0x39432f=_0x39432f||0xcc;return function(_0x1a9d75){if(_0x1a9d75){return _0x230a5d['sendStatus'](_0x39432f);}return _0x230a5d[_0x4b86('0x1e')](_0x39432f)[_0x4b86('0x1f')]();};}function respondWithResult(_0x194d15,_0x8ba129){_0x8ba129=_0x8ba129||0xc8;return function(_0xcaf538){if(_0xcaf538){return _0x194d15[_0x4b86('0x1e')](_0x8ba129)['json'](_0xcaf538);}};}function respondWithFilteredResult(_0x1897ed,_0x23f348){return function(_0x50be53){if(_0x50be53){var _0x3ab69c=typeof _0x23f348[_0x4b86('0x20')]==='undefined'&&typeof _0x23f348['limit']===_0x4b86('0x21');var _0x42c3bd=_0x50be53['count'];var _0xff97a2=_0x3ab69c?0x0:_0x23f348[_0x4b86('0x20')];var _0x24125b=_0x3ab69c?_0x50be53[_0x4b86('0x22')]:_0x23f348[_0x4b86('0x20')]+_0x23f348[_0x4b86('0x23')];var _0x507015;if(_0x24125b>=_0x42c3bd){_0x24125b=_0x42c3bd;_0x507015=0xc8;}else{_0x507015=0xce;}_0x1897ed[_0x4b86('0x1e')](_0x507015);return _0x1897ed[_0x4b86('0x24')](_0x4b86('0x25'),_0xff97a2+'-'+_0x24125b+'/'+_0x42c3bd)[_0x4b86('0x26')](_0x50be53);}return null;};}function patchUpdates(_0x208217){return function(_0x2131db){try{jsonpatch[_0x4b86('0x27')](_0x2131db,_0x208217,!![]);}catch(_0x4ead26){return BPromise[_0x4b86('0x28')](_0x4ead26);}return _0x2131db[_0x4b86('0x29')]();};}function saveUpdates(_0x589f4f,_0x12e940){return function(_0x34e412){if(_0x34e412){return _0x34e412[_0x4b86('0x2a')](_0x589f4f)[_0x4b86('0x2b')](function(_0x5baf56){return _0x5baf56;});}return null;};}function removeEntity(_0x2d7268,_0x3e7107){return function(_0x59c541){if(_0x59c541){return _0x59c541[_0x4b86('0x2c')]()[_0x4b86('0x2b')](function(){_0x2d7268['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3faa63,_0x2bb7dc){return function(_0x47ed27){if(!_0x47ed27){_0x3faa63[_0x4b86('0x2d')](0x194);}return _0x47ed27;};}function handleError(_0x5aaf65,_0xe52fee){_0xe52fee=_0xe52fee||0x1f4;return function(_0x5334d6){logger[_0x4b86('0x2e')](_0x5334d6[_0x4b86('0x2f')]);if(_0x5334d6['name']){delete _0x5334d6['name'];}_0x5aaf65[_0x4b86('0x1e')](_0xe52fee)[_0x4b86('0x30')](_0x5334d6);};}exports[_0x4b86('0x31')]=function(_0x51dd34,_0x40ec93){var _0x2b57ba={},_0x5e96a1={},_0x34363b={'count':0x0,'rows':[]};var _0x237e54=_[_0x4b86('0x32')](db[_0x4b86('0x33')][_0x4b86('0x34')],function(_0x3ad9bb){return{'name':_0x3ad9bb[_0x4b86('0x35')],'type':_0x3ad9bb[_0x4b86('0x36')][_0x4b86('0x37')]};});_0x5e96a1['model']=_[_0x4b86('0x32')](_0x237e54,'name');_0x5e96a1['query']=_[_0x4b86('0x38')](_0x51dd34[_0x4b86('0x39')]);_0x5e96a1[_0x4b86('0x3a')]=_[_0x4b86('0x3b')](_0x5e96a1['model'],_0x5e96a1[_0x4b86('0x39')]);_0x2b57ba[_0x4b86('0x3c')]=_[_0x4b86('0x3b')](_0x5e96a1[_0x4b86('0x3d')],qs[_0x4b86('0x3e')](_0x51dd34[_0x4b86('0x39')][_0x4b86('0x3e')]));_0x2b57ba[_0x4b86('0x3c')]=_0x2b57ba[_0x4b86('0x3c')]['length']?_0x2b57ba[_0x4b86('0x3c')]:_0x5e96a1[_0x4b86('0x3d')];if(!_0x51dd34[_0x4b86('0x39')]['hasOwnProperty'](_0x4b86('0x3f'))){_0x2b57ba[_0x4b86('0x23')]=qs[_0x4b86('0x23')](_0x51dd34[_0x4b86('0x39')]['limit']);_0x2b57ba[_0x4b86('0x20')]=qs[_0x4b86('0x20')](_0x51dd34[_0x4b86('0x39')][_0x4b86('0x20')]);}_0x2b57ba[_0x4b86('0x40')]=qs[_0x4b86('0x41')](_0x51dd34['query'][_0x4b86('0x41')]);_0x2b57ba[_0x4b86('0x42')]=qs['filters'](_[_0x4b86('0x43')](_0x51dd34[_0x4b86('0x39')],_0x5e96a1['filters']),_0x237e54);if(_0x51dd34[_0x4b86('0x39')][_0x4b86('0x44')]){_0x2b57ba[_0x4b86('0x42')]=_[_0x4b86('0x45')](_0x2b57ba[_0x4b86('0x42')],{'$or':_[_0x4b86('0x32')](_0x237e54,function(_0x52f140){if(_0x52f140[_0x4b86('0x36')]!=='VIRTUAL'){var _0x5a3bbc={};_0x5a3bbc[_0x52f140[_0x4b86('0x46')]]={'$like':'%'+_0x51dd34[_0x4b86('0x39')]['filter']+'%'};return _0x5a3bbc;}})});}_0x2b57ba=_[_0x4b86('0x45')]({},_0x2b57ba,_0x51dd34[_0x4b86('0x47')]);var _0xbadec8={'where':_0x2b57ba[_0x4b86('0x42')]};return db[_0x4b86('0x33')][_0x4b86('0x22')](_0xbadec8)['then'](function(_0x2f70cf){_0x34363b[_0x4b86('0x22')]=_0x2f70cf;if(_0x51dd34[_0x4b86('0x39')][_0x4b86('0x48')]){_0x2b57ba[_0x4b86('0x49')]=[{'all':!![]}];}return db[_0x4b86('0x33')][_0x4b86('0x4a')](_0x2b57ba);})[_0x4b86('0x2b')](function(_0x1458fc){_0x34363b[_0x4b86('0x4b')]=_0x1458fc;return _0x34363b;})[_0x4b86('0x2b')](respondWithFilteredResult(_0x40ec93,_0x2b57ba))[_0x4b86('0x4c')](handleError(_0x40ec93,null));};exports[_0x4b86('0x4d')]=function(_0x4be6fe,_0x2ca2e1){var _0x33528f={'raw':!![],'where':{'id':_0x4be6fe['params']['id']}},_0xee8680={};_0xee8680[_0x4b86('0x3d')]=_[_0x4b86('0x38')](db[_0x4b86('0x33')][_0x4b86('0x34')]);_0xee8680[_0x4b86('0x39')]=_[_0x4b86('0x38')](_0x4be6fe[_0x4b86('0x39')]);_0xee8680[_0x4b86('0x3a')]=_[_0x4b86('0x3b')](_0xee8680['model'],_0xee8680[_0x4b86('0x39')]);_0x33528f[_0x4b86('0x3c')]=_[_0x4b86('0x3b')](_0xee8680[_0x4b86('0x3d')],qs[_0x4b86('0x3e')](_0x4be6fe['query'][_0x4b86('0x3e')]));_0x33528f[_0x4b86('0x3c')]=_0x33528f[_0x4b86('0x3c')][_0x4b86('0x4e')]?_0x33528f[_0x4b86('0x3c')]:_0xee8680[_0x4b86('0x3d')];if(_0x4be6fe[_0x4b86('0x39')][_0x4b86('0x48')]){_0x33528f['include']=[{'all':!![]}];}_0x33528f=_[_0x4b86('0x45')]({},_0x33528f,_0x4be6fe[_0x4b86('0x47')]);return db[_0x4b86('0x33')][_0x4b86('0x4f')](_0x33528f)['then'](handleEntityNotFound(_0x2ca2e1,null))[_0x4b86('0x2b')](respondWithResult(_0x2ca2e1,null))[_0x4b86('0x4c')](handleError(_0x2ca2e1,null));};exports[_0x4b86('0x50')]=function(_0x220351,_0x1c20dd){return db[_0x4b86('0x33')][_0x4b86('0x50')](_0x220351[_0x4b86('0x51')],{})[_0x4b86('0x2b')](respondWithResult(_0x1c20dd,0xc9))[_0x4b86('0x4c')](handleError(_0x1c20dd,null));};exports['update']=function(_0xe8ba0a,_0x19c03d){if(_0xe8ba0a[_0x4b86('0x51')]['id']){delete _0xe8ba0a['body']['id'];}return db['VtigerField'][_0x4b86('0x4f')]({'where':{'id':_0xe8ba0a[_0x4b86('0x52')]['id']}})[_0x4b86('0x2b')](handleEntityNotFound(_0x19c03d,null))[_0x4b86('0x2b')](saveUpdates(_0xe8ba0a[_0x4b86('0x51')],null))[_0x4b86('0x2b')](respondWithResult(_0x19c03d,null))[_0x4b86('0x4c')](handleError(_0x19c03d,null));};exports[_0x4b86('0x2c')]=function(_0x10c304,_0x4f97cc){return db[_0x4b86('0x33')]['find']({'where':{'id':_0x10c304['params']['id']}})[_0x4b86('0x2b')](handleEntityNotFound(_0x4f97cc,null))[_0x4b86('0x2b')](removeEntity(_0x4f97cc,null))[_0x4b86('0x4c')](handleError(_0x4f97cc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 2a15627..f65f06b 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 _0x2be2=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields'];(function(_0x1d4203,_0x170e2b){var _0x33b21b=function(_0x3c9905){while(--_0x3c9905){_0x1d4203['push'](_0x1d4203['shift']());}};_0x33b21b(++_0x170e2b);}(_0x2be2,0x82));var _0x22be=function(_0x49a199,_0x169bae){_0x49a199=_0x49a199-0x0;var _0x20aaf7=_0x2be2[_0x49a199];return _0x20aaf7;};'use strict';var _=require(_0x22be('0x0'));var util=require(_0x22be('0x1'));var logger=require(_0x22be('0x2'))(_0x22be('0x3'));var moment=require('moment');var BPromise=require(_0x22be('0x4'));var rp=require(_0x22be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22be('0x6'));var config=require(_0x22be('0x7'));var attributes=require(_0x22be('0x8'));module[_0x22be('0x9')]=function(_0x16de65,_0x52d27b){return _0x16de65[_0x22be('0xa')](_0x22be('0xb'),attributes,{'tableName':_0x22be('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d3d=['int_vtiger_fields','vtiger_unique_index','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0x16cf9f,_0x570431){var _0x53965e=function(_0x3c5520){while(--_0x3c5520){_0x16cf9f['push'](_0x16cf9f['shift']());}};_0x53965e(++_0x570431);}(_0x7d3d,0xc6));var _0xd7d3=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x7d3d[_0x1db251];return _0x56685a;};'use strict';var _=require(_0xd7d3('0x0'));var util=require(_0xd7d3('0x1'));var logger=require(_0xd7d3('0x2'))(_0xd7d3('0x3'));var moment=require(_0xd7d3('0x4'));var BPromise=require('bluebird');var rp=require(_0xd7d3('0x5'));var fs=require('fs');var path=require(_0xd7d3('0x6'));var rimraf=require(_0xd7d3('0x7'));var config=require('../../config/environment');var attributes=require(_0xd7d3('0x8'));module[_0xd7d3('0x9')]=function(_0x36cfd4,_0x4b97af){return _0x36cfd4[_0xd7d3('0xa')](_0xd7d3('0xb'),attributes,{'tableName':_0xd7d3('0xc'),'paranoid':![],'indexes':[{'name':_0xd7d3('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 2b868be..b8e885e 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 _0x9d09=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x12b107,_0x1df955){var _0x1026a6=function(_0x4768de){while(--_0x4768de){_0x12b107['push'](_0x12b107['shift']());}};_0x1026a6(++_0x1df955);}(_0x9d09,0x177));var _0x99d0=function(_0x3d7852,_0x4212eb){_0x3d7852=_0x3d7852-0x0;var _0x4585c5=_0x9d09[_0x3d7852];return _0x4585c5;};'use strict';var _=require('lodash');var util=require(_0x99d0('0x0'));var moment=require(_0x99d0('0x1'));var BPromise=require(_0x99d0('0x2'));var rs=require(_0x99d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99d0('0x4'))['db'];var utils=require(_0x99d0('0x5'));var logger=require(_0x99d0('0x6'))(_0x99d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x99d0('0x8'));var client=jayson['client'][_0x99d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eaa8e,_0x525e4e,_0x26b03c){return new BPromise(function(_0x1f3437,_0x4e45f2){return client['request'](_0x5eaa8e,_0x26b03c)[_0x99d0('0xa')](function(_0x2ccc1b){logger[_0x99d0('0xb')](_0x99d0('0xc'),_0x525e4e,_0x99d0('0xd'));logger[_0x99d0('0xe')](_0x99d0('0xf'),_0x525e4e,_0x99d0('0xd'),JSON[_0x99d0('0x10')](_0x2ccc1b));if(_0x2ccc1b[_0x99d0('0x11')]){if(_0x2ccc1b['error'][_0x99d0('0x12')]===0x1f4){logger[_0x99d0('0x11')](_0x99d0('0xc'),_0x525e4e,_0x2ccc1b[_0x99d0('0x11')][_0x99d0('0x13')]);return _0x4e45f2(_0x2ccc1b[_0x99d0('0x11')][_0x99d0('0x13')]);}logger['error'](_0x99d0('0xc'),_0x525e4e,_0x2ccc1b[_0x99d0('0x11')][_0x99d0('0x13')]);return _0x1f3437(_0x2ccc1b[_0x99d0('0x11')][_0x99d0('0x13')]);}else{logger['info'](_0x99d0('0xc'),_0x525e4e,_0x99d0('0xd'));_0x1f3437(_0x2ccc1b[_0x99d0('0x14')][_0x99d0('0x13')]);}})[_0x99d0('0x15')](function(_0x52622b){logger[_0x99d0('0x11')](_0x99d0('0xc'),_0x525e4e,_0x52622b);_0x4e45f2(_0x52622b);});});} \ No newline at end of file +var _0xdcb3=['error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x53257b,_0x1be635){var _0x150442=function(_0x36e638){while(--_0x36e638){_0x53257b['push'](_0x53257b['shift']());}};_0x150442(++_0x1be635);}(_0xdcb3,0xbc));var _0x3dcb=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0xdcb3[_0x456b77];return _0x118bb6;};'use strict';var _=require(_0x3dcb('0x0'));var util=require(_0x3dcb('0x1'));var moment=require(_0x3dcb('0x2'));var BPromise=require(_0x3dcb('0x3'));var rs=require(_0x3dcb('0x4'));var fs=require('fs');var Redis=require(_0x3dcb('0x5'));var db=require(_0x3dcb('0x6'))['db'];var utils=require(_0x3dcb('0x7'));var logger=require(_0x3dcb('0x8'))(_0x3dcb('0x9'));var config=require(_0x3dcb('0xa'));var jayson=require(_0x3dcb('0xb'));var client=jayson[_0x3dcb('0xc')][_0x3dcb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2a9d42,_0x3204a1,_0x150130){return new BPromise(function(_0x5cc37a,_0x16df40){return client[_0x3dcb('0xe')](_0x2a9d42,_0x150130)['then'](function(_0x287878){logger['info'](_0x3dcb('0xf'),_0x3204a1,'request\x20sent');logger[_0x3dcb('0x10')](_0x3dcb('0x11'),_0x3204a1,_0x3dcb('0x12'),JSON['stringify'](_0x287878));if(_0x287878[_0x3dcb('0x13')]){if(_0x287878['error']['code']===0x1f4){logger[_0x3dcb('0x13')](_0x3dcb('0xf'),_0x3204a1,_0x287878[_0x3dcb('0x13')]['message']);return _0x16df40(_0x287878['error'][_0x3dcb('0x14')]);}logger[_0x3dcb('0x13')](_0x3dcb('0xf'),_0x3204a1,_0x287878[_0x3dcb('0x13')][_0x3dcb('0x14')]);return _0x5cc37a(_0x287878['error']['message']);}else{logger[_0x3dcb('0x15')](_0x3dcb('0xf'),_0x3204a1,_0x3dcb('0x12'));_0x5cc37a(_0x287878[_0x3dcb('0x16')][_0x3dcb('0x14')]);}})['catch'](function(_0x513d42){logger[_0x3dcb('0x13')](_0x3dcb('0xf'),_0x3204a1,_0x513d42);_0x16df40(_0x513d42);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6c944c5..df5ce42 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 _0x0e31=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0x0e31,0xab));var _0x10e3=function(_0x3ceab8,_0x30486f){_0x3ceab8=_0x3ceab8-0x0;var _0x3e9fe3=_0x0e31[_0x3ceab8];return _0x3e9fe3;};'use strict';var multer=require(_0x10e3('0x0'));var util=require(_0x10e3('0x1'));var path=require(_0x10e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x10e3('0x3'));var router=express['Router']();var fs_extra=require(_0x10e3('0x4'));var auth=require(_0x10e3('0x5'));var interaction=require(_0x10e3('0x6'));var config=require(_0x10e3('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x10e3('0x8')](),controller[_0x10e3('0x9')]);router[_0x10e3('0xa')](_0x10e3('0xb'),auth['isAuthenticated'](),controller[_0x10e3('0xc')]);router[_0x10e3('0xa')](_0x10e3('0xd'),auth[_0x10e3('0x8')](),controller['getConfigurations']);router['get'](_0x10e3('0xe'),auth[_0x10e3('0x8')](),controller[_0x10e3('0xf')]);router[_0x10e3('0x10')]('/',auth['isAuthenticated'](),controller[_0x10e3('0x11')]);router['post'](_0x10e3('0xd'),auth['isAuthenticated'](),controller[_0x10e3('0x12')]);router[_0x10e3('0x13')](_0x10e3('0xb'),auth[_0x10e3('0x8')](),controller[_0x10e3('0x14')]);router[_0x10e3('0x15')](_0x10e3('0xb'),auth['isAuthenticated'](),controller[_0x10e3('0x16')]);module['exports']=router; \ No newline at end of file +var _0xefd6=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xefd6,0x19d));var _0x6efd=function(_0x2c3a25,_0x37b25c){_0x2c3a25=_0x2c3a25-0x0;var _0x43699c=_0xefd6[_0x2c3a25];return _0x43699c;};'use strict';var multer=require(_0x6efd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6efd('0x1'));var express=require(_0x6efd('0x2'));var router=express[_0x6efd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6efd('0x4'));var interaction=require(_0x6efd('0x5'));var config=require(_0x6efd('0x6'));var controller=require(_0x6efd('0x7'));router[_0x6efd('0x8')]('/',auth[_0x6efd('0x9')](),controller[_0x6efd('0xa')]);router[_0x6efd('0x8')](_0x6efd('0xb'),auth[_0x6efd('0x9')](),controller[_0x6efd('0xc')]);router['get'](_0x6efd('0xd'),auth[_0x6efd('0x9')](),controller['getConfigurations']);router[_0x6efd('0x8')](_0x6efd('0xe'),auth[_0x6efd('0x9')](),controller[_0x6efd('0xf')]);router[_0x6efd('0x10')]('/',auth[_0x6efd('0x9')](),controller[_0x6efd('0x11')]);router[_0x6efd('0x10')](_0x6efd('0xd'),auth[_0x6efd('0x9')](),controller[_0x6efd('0x12')]);router[_0x6efd('0x13')](_0x6efd('0xb'),auth[_0x6efd('0x9')](),controller['update']);router[_0x6efd('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6efd('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 b49f513..33248ea 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 _0x38b8=['STRING','username','remoteUri','token','password','ENUM','integrationTab','sequelize'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x38b8,0x7f));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x838b('0x0'));module['exports']={'name':{'type':Sequelize[_0x838b('0x1')]},'description':{'type':Sequelize[_0x838b('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x838b('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x838b('0x1')],'unique':_0x838b('0x3')},'authType':{'type':Sequelize['ENUM']('password',_0x838b('0x4')),'defaultValue':_0x838b('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x838b('0x6')](_0x838b('0x7'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xfdbd=['username','ENUM','token','password','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x4c3d6e,_0x5638ea){var _0x3f0381=function(_0x3c13e0){while(--_0x3c13e0){_0x4c3d6e['push'](_0x4c3d6e['shift']());}};_0x3f0381(++_0x5638ea);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0xfdbd[_0x2db667];return _0x83ff9;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'username':{'type':Sequelize[_0xdfdb('0x2')],'unique':_0xdfdb('0x3')},'password':{'type':Sequelize[_0xdfdb('0x2')]},'token':{'type':Sequelize[_0xdfdb('0x2')]},'remoteUri':{'type':Sequelize[_0xdfdb('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xdfdb('0x4')]('password',_0xdfdb('0x5')),'defaultValue':_0xdfdb('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xdfdb('0x7')),'defaultValue':_0xdfdb('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6a0c222..001c4b4 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 _0xf7b4=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','merge','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','title','position','system_field_options','custom_field_options','test','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','mustache','util','path','sox'];(function(_0x3db20f,_0x211a2e){var _0x28c80e=function(_0x4661d0){while(--_0x4661d0){_0x3db20f['push'](_0x3db20f['shift']());}};_0x28c80e(++_0x211a2e);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5f08be,_0x12420c){_0x5f08be=_0x5f08be-0x0;var _0x5ceb02=_0xf7b4[_0x5f08be];return _0x5ceb02;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f7b('0x17'));function respondWithStatusCode(_0x2e8dd9,_0x3c55e1){_0x3c55e1=_0x3c55e1||0xcc;return function(_0x41a050){if(_0x41a050){return _0x2e8dd9['sendStatus'](_0x3c55e1);}return _0x2e8dd9[_0x4f7b('0x18')](_0x3c55e1)[_0x4f7b('0x19')]();};}function respondWithResult(_0x407cee,_0x43a51a){_0x43a51a=_0x43a51a||0xc8;return function(_0x339486){if(_0x339486){return _0x407cee[_0x4f7b('0x18')](_0x43a51a)[_0x4f7b('0x1a')](_0x339486);}};}function respondWithFilteredResult(_0x2437cc,_0x260667){return function(_0x29fdd5){if(_0x29fdd5){var _0x1a28b8=typeof _0x260667[_0x4f7b('0x1b')]==='undefined'&&typeof _0x260667[_0x4f7b('0x1c')]==='undefined';var _0x5b5ee3=_0x29fdd5[_0x4f7b('0x1d')];var _0x3813da=_0x1a28b8?0x0:_0x260667['offset'];var _0x2b34c9=_0x1a28b8?_0x29fdd5[_0x4f7b('0x1d')]:_0x260667[_0x4f7b('0x1b')]+_0x260667[_0x4f7b('0x1c')];var _0x5a5187;if(_0x2b34c9>=_0x5b5ee3){_0x2b34c9=_0x5b5ee3;_0x5a5187=0xc8;}else{_0x5a5187=0xce;}_0x2437cc[_0x4f7b('0x18')](_0x5a5187);return _0x2437cc['set'](_0x4f7b('0x1e'),_0x3813da+'-'+_0x2b34c9+'/'+_0x5b5ee3)[_0x4f7b('0x1a')](_0x29fdd5);}return null;};}function patchUpdates(_0xa2f54e){return function(_0xdb2df2){try{jsonpatch[_0x4f7b('0x1f')](_0xdb2df2,_0xa2f54e,!![]);}catch(_0x203a92){return BPromise[_0x4f7b('0x20')](_0x203a92);}return _0xdb2df2[_0x4f7b('0x21')]();};}function saveUpdates(_0x2a8b50,_0x5508bd){return function(_0x410176){if(_0x410176){return _0x410176[_0x4f7b('0x22')](_0x2a8b50)[_0x4f7b('0x23')](function(_0x5bd43f){return _0x5bd43f;});}return null;};}function removeEntity(_0x150f57,_0x4610a4){return function(_0x5d22f4){if(_0x5d22f4){return _0x5d22f4[_0x4f7b('0x24')]()['then'](function(){_0x150f57[_0x4f7b('0x18')](0xcc)[_0x4f7b('0x19')]();});}};}function handleEntityNotFound(_0x23c820,_0x278c41){return function(_0x17aa9d){if(!_0x17aa9d){_0x23c820[_0x4f7b('0x25')](0x194);}return _0x17aa9d;};}function handleError(_0x181e13,_0x3ad769){_0x3ad769=_0x3ad769||0x1f4;return function(_0x4ec9a3){logger[_0x4f7b('0x26')](_0x4ec9a3[_0x4f7b('0x27')]);if(_0x4ec9a3[_0x4f7b('0x28')]){delete _0x4ec9a3['name'];}_0x181e13[_0x4f7b('0x18')](_0x3ad769)[_0x4f7b('0x29')](_0x4ec9a3);};}exports[_0x4f7b('0x2a')]=function(_0x3a56ff,_0x1ccce0){var _0x4ebffa={},_0xac1f93={},_0x3331b2={'count':0x0,'rows':[]};var _0x9a675c=_['map'](db[_0x4f7b('0x2b')]['rawAttributes'],function(_0x4e4828){return{'name':_0x4e4828[_0x4f7b('0x2c')],'type':_0x4e4828['type'][_0x4f7b('0x2d')]};});_0xac1f93[_0x4f7b('0x2e')]=_[_0x4f7b('0x2f')](_0x9a675c,_0x4f7b('0x28'));_0xac1f93[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3a56ff[_0x4f7b('0x30')]);_0xac1f93[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],_0xac1f93[_0x4f7b('0x30')]);_0x4ebffa[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0x4ebffa[_0x4f7b('0x34')]=_0x4ebffa[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x4ebffa[_0x4f7b('0x34')]:_0xac1f93[_0x4f7b('0x2e')];if(!_0x3a56ff['query'][_0x4f7b('0x37')]('nolimit')){_0x4ebffa[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x3a56ff['query'][_0x4f7b('0x1c')]);_0x4ebffa[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x3a56ff['query'][_0x4f7b('0x1b')]);}_0x4ebffa[_0x4f7b('0x38')]=qs[_0x4f7b('0x39')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0x4ebffa[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_['pick'](_0x3a56ff[_0x4f7b('0x30')],_0xac1f93['filters']),_0x9a675c);if(_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x3b')]){_0x4ebffa[_0x4f7b('0x3a')]=_['merge'](_0x4ebffa[_0x4f7b('0x3a')],{'$or':_['map'](_0x9a675c,function(_0x2471dc){if(_0x2471dc[_0x4f7b('0x3c')]!=='VIRTUAL'){var _0x48aecc={};_0x48aecc[_0x2471dc[_0x4f7b('0x28')]]={'$like':'%'+_0x3a56ff['query'][_0x4f7b('0x3b')]+'%'};return _0x48aecc;}})});}_0x4ebffa=_[_0x4f7b('0x3d')]({},_0x4ebffa,_0x3a56ff['options']);var _0x1d0746={'where':_0x4ebffa['where']};return db['ZendeskAccount']['count'](_0x1d0746)[_0x4f7b('0x23')](function(_0x2e861d){_0x3331b2[_0x4f7b('0x1d')]=_0x2e861d;if(_0x3a56ff[_0x4f7b('0x30')]['includeAll']){_0x4ebffa[_0x4f7b('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4f7b('0x3f')](_0x4ebffa);})['then'](function(_0x3c411f){_0x3331b2['rows']=_0x3c411f;return _0x3331b2;})[_0x4f7b('0x23')](respondWithFilteredResult(_0x1ccce0,_0x4ebffa))[_0x4f7b('0x40')](handleError(_0x1ccce0,null));};exports[_0x4f7b('0x41')]=function(_0x3ab08f,_0x2986cd){var _0x325cd6={'raw':![],'where':{'id':_0x3ab08f[_0x4f7b('0x42')]['id']}},_0x3fdde2={};_0x3fdde2[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x2b')][_0x4f7b('0x43')]);_0x3fdde2[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3ab08f[_0x4f7b('0x30')]);_0x3fdde2[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],_0x3fdde2['query']);_0x325cd6['attributes']=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3ab08f[_0x4f7b('0x30')]['fields']));_0x325cd6['attributes']=_0x325cd6[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x325cd6[_0x4f7b('0x34')]:_0x3fdde2[_0x4f7b('0x2e')];if(_0x3ab08f['query']['includeAll']){_0x325cd6[_0x4f7b('0x3e')]=[{'all':!![]}];}_0x325cd6=_[_0x4f7b('0x3d')]({},_0x325cd6,_0x3ab08f[_0x4f7b('0x44')]);return db[_0x4f7b('0x2b')][_0x4f7b('0x45')](_0x325cd6)['then'](handleEntityNotFound(_0x2986cd,null))[_0x4f7b('0x23')](respondWithResult(_0x2986cd,null))[_0x4f7b('0x40')](handleError(_0x2986cd,null));};exports[_0x4f7b('0x46')]=function(_0x5df68e,_0x6c659c){return db[_0x4f7b('0x2b')][_0x4f7b('0x46')](_0x5df68e[_0x4f7b('0x47')],{})[_0x4f7b('0x23')](respondWithResult(_0x6c659c,0xc9))[_0x4f7b('0x40')](handleError(_0x6c659c,null));};exports[_0x4f7b('0x22')]=function(_0x2e563f,_0x2630ec){if(_0x2e563f[_0x4f7b('0x47')]['id']){delete _0x2e563f['body']['id'];}return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x2e563f[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2630ec,null))[_0x4f7b('0x23')](saveUpdates(_0x2e563f[_0x4f7b('0x47')],null))[_0x4f7b('0x23')](respondWithResult(_0x2630ec,null))[_0x4f7b('0x40')](handleError(_0x2630ec,null));};exports[_0x4f7b('0x24')]=function(_0x7e624,_0x144ba1){return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x7e624[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x144ba1,null))[_0x4f7b('0x23')](removeEntity(_0x144ba1,null))[_0x4f7b('0x40')](handleError(_0x144ba1,null));};exports[_0x4f7b('0x48')]=function(_0x4d1ac9,_0x2c9cee,_0x40c183){var _0xeeb227={};var _0xb92819={};var _0x3437a8;var _0x819fb3;return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x4d1ac9[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x2c9cee,null))['then'](function(_0x4017b5){if(_0x4017b5){_0x3437a8=_0x4017b5;_0xb92819[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x4a')][_0x4f7b('0x43')]);_0xb92819[_0x4f7b('0x30')]=_['keys'](_0x4d1ac9[_0x4f7b('0x30')]);_0xb92819['filters']=_['intersection'](_0xb92819['model'],_0xb92819[_0x4f7b('0x30')]);_0xeeb227[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xb92819['model'],qs['fields'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0xeeb227['attributes']=_0xeeb227[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0xeeb227[_0x4f7b('0x34')]:_0xb92819[_0x4f7b('0x2e')];_0xeeb227['order']=qs[_0x4f7b('0x39')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0xeeb227[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_[_0x4f7b('0x4b')](_0x4d1ac9[_0x4f7b('0x30')],_0xb92819['filters']));if(_0x4d1ac9['query']['filter']){_0xeeb227[_0x4f7b('0x3a')]=_['merge'](_0xeeb227['where'],{'$or':_['map'](_0xeeb227['attributes'],function(_0x4a35d1){var _0x2715b5={};_0x2715b5[_0x4a35d1]={'$like':'%'+_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x3b')]+'%'};return _0x2715b5;})});}_0xeeb227=_[_0x4f7b('0x3d')]({},_0xeeb227,_0x4d1ac9[_0x4f7b('0x44')]);return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x1d500c){if(_0x1d500c){_0x819fb3=_0x1d500c[_0x4f7b('0x36')];if(!_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x37')](_0x4f7b('0x4c'))){_0xeeb227[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1c')]);_0xeeb227[_0x4f7b('0x1b')]=qs['offset'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1b')]);}return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x321f36){if(_0x321f36){return _0x321f36?{'count':_0x819fb3,'rows':_0x321f36}:null;}})['then'](respondWithResult(_0x2c9cee,null))['catch'](handleError(_0x2c9cee,null));};exports[_0x4f7b('0x4d')]=function(_0x5a2b3d,_0x457ac5,_0x384a08){if(_0x5a2b3d[_0x4f7b('0x47')]['id']){delete _0x5a2b3d[_0x4f7b('0x47')]['id'];}return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x5a2b3d[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x457ac5,null))['then'](function(_0x4b2089){if(_0x4b2089){_0x5a2b3d['body'][_0x4f7b('0x4e')]=_0x4b2089['id'];_0x5a2b3d['body']['Subjects']=integrations['getSubjects'](_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')]['type']);_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x50')]=integrations['getDescriptions'](_0x5a2b3d['body'][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x3c')]);return db[_0x4f7b('0x4a')]['create'](_0x5a2b3d[_0x4f7b('0x47')],{'include':[{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x52')},{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x50')}]});}return null;})[_0x4f7b('0x23')](respondWithResult(_0x457ac5,null))['catch'](handleError(_0x457ac5,null));};exports[_0x4f7b('0x53')]=function(_0x79deaa,_0xa10c21,_0x220f21){var _0x1ca442='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x79deaa['params']['id']},'attributes':['id',_0x4f7b('0x54'),_0x4f7b('0x55'),_0x4f7b('0x56'),_0x4f7b('0x57'),_0x4f7b('0x58')]})['then'](handleEntityNotFound(_0xa10c21,null))[_0x4f7b('0x23')](function(_0x16dbe3){if(_0x16dbe3){_0x1ca442=_0x16dbe3[_0x4f7b('0x58')];var _0x2a09b6=_0x1ca442[_0x4f7b('0x59')](-0x1);if(_0x2a09b6==='/'){_0x1ca442=_0x1ca442[_0x4f7b('0x5a')](0x0,_0x1ca442[_0x4f7b('0x5b')](_0x2a09b6));}var _0x477077={'method':_0x4f7b('0x5c'),'uri':util[_0x4f7b('0x5d')](_0x4f7b('0x5e'),_0x1ca442,_0x4f7b('0x5f')),'json':!![]};switch(_0x16dbe3[_0x4f7b('0x57')]){case _0x4f7b('0x55'):_0x477077[_0x4f7b('0x60')]={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')]('%s:%s',_0x16dbe3['username'],_0x16dbe3[_0x4f7b('0x55')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;case _0x4f7b('0x56'):_0x477077['headers']={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')](_0x4f7b('0x64'),_0x16dbe3[_0x4f7b('0x54')],_0x16dbe3[_0x4f7b('0x56')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;default:throw new db[(_0x4f7b('0x65'))][(_0x4f7b('0x66'))](_0x4f7b('0x67'));}return rp(_0x477077);}})[_0x4f7b('0x23')](function(_0x26b5cb){if(_0x26b5cb){var _0x278d72=[_0x4f7b('0x68'),'description',_0x4f7b('0x69'),_0x4f7b('0x6a')];_['remove'](_0x26b5cb['ticket_fields'],function(_0x45aced){return _0x278d72[_0x4f7b('0x6b')](_0x45aced[_0x4f7b('0x3c')]);});return{'count':_0x26b5cb[_0x4f7b('0x5f')][_0x4f7b('0x36')],'rows':_[_0x4f7b('0x2f')](_0x26b5cb[_0x4f7b('0x5f')],function(_0x48d9c6){return{'id':_0x48d9c6['id'],'name':_0x48d9c6['position']>0x7?_0x48d9c6[_0x4f7b('0x6c')]:_0x48d9c6[_0x4f7b('0x3c')],'custom':_0x48d9c6[_0x4f7b('0x6d')]>0x7?!![]:![],'options':_0x48d9c6[_0x4f7b('0x6e')]?_0x48d9c6['system_field_options']:_0x48d9c6[_0x4f7b('0x6f')]?_0x48d9c6[_0x4f7b('0x6f')]:[]};})};}})['then'](respondWithResult(_0xa10c21,null))[_0x4f7b('0x40')](function(_0x247541){var _0x50aabe=_0x79deaa['query'][_0x4f7b('0x70')]?0x1f4:_0x247541['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4f7b('0x53'),_0x50aabe,JSON['stringify'](_0x247541));delete _0x247541[_0x4f7b('0x28')];if(_0x50aabe===0x191){_0x50aabe=0x190;}_0xa10c21[_0x4f7b('0x18')](_0x50aabe)[_0x4f7b('0x29')](_0x79deaa[_0x4f7b('0x30')][_0x4f7b('0x70')]?{'message':_0x4f7b('0x71'),'statusCode':_0x247541[_0x4f7b('0x72')]}:_0x247541);});}; \ No newline at end of file +var _0x4483=['fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','ZendeskAccount','includeAll','include','findAll','then','rows','catch','params','rawAttributes','length','merge','find','create','body','update','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','authType','remoteUri','slice','lastIndexOf','format','%s/%s','password','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','ValidationError','subject','description','group','assignee','ticket_fields','includes','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x4483,0x1a3));var _0x3448=function(_0x4432f9,_0x10eb88){_0x4432f9=_0x4432f9-0x0;var _0x5f38df=_0x4483[_0x4432f9];return _0x5f38df;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3448('0x1b'));function respondWithStatusCode(_0x38fbb1,_0x5f52bd){_0x5f52bd=_0x5f52bd||0xcc;return function(_0x2661e1){if(_0x2661e1){return _0x38fbb1[_0x3448('0x1c')](_0x5f52bd);}return _0x38fbb1[_0x3448('0x1d')](_0x5f52bd)['end']();};}function respondWithResult(_0x14104c,_0x2952a6){_0x2952a6=_0x2952a6||0xc8;return function(_0x4daf3e){if(_0x4daf3e){return _0x14104c[_0x3448('0x1d')](_0x2952a6)[_0x3448('0x1e')](_0x4daf3e);}};}function respondWithFilteredResult(_0x46784f,_0x4fc70f){return function(_0x472518){if(_0x472518){var _0x28f5b9=typeof _0x4fc70f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x4fc70f[_0x3448('0x21')]===_0x3448('0x20');var _0x247d1a=_0x472518[_0x3448('0x22')];var _0x4a348c=_0x28f5b9?0x0:_0x4fc70f[_0x3448('0x1f')];var _0x5b410d=_0x28f5b9?_0x472518['count']:_0x4fc70f['offset']+_0x4fc70f[_0x3448('0x21')];var _0x278736;if(_0x5b410d>=_0x247d1a){_0x5b410d=_0x247d1a;_0x278736=0xc8;}else{_0x278736=0xce;}_0x46784f[_0x3448('0x1d')](_0x278736);return _0x46784f['set'](_0x3448('0x23'),_0x4a348c+'-'+_0x5b410d+'/'+_0x247d1a)[_0x3448('0x1e')](_0x472518);}return null;};}function patchUpdates(_0x317de6){return function(_0x18608e){try{jsonpatch[_0x3448('0x24')](_0x18608e,_0x317de6,!![]);}catch(_0x715c3){return BPromise['reject'](_0x715c3);}return _0x18608e['save']();};}function saveUpdates(_0x4e6716,_0x1b3d5a){return function(_0x200f72){if(_0x200f72){return _0x200f72['update'](_0x4e6716)['then'](function(_0x2dcd40){return _0x2dcd40;});}return null;};}function removeEntity(_0x4371d6,_0x22ad5c){return function(_0x4368c7){if(_0x4368c7){return _0x4368c7[_0x3448('0x25')]()['then'](function(){_0x4371d6[_0x3448('0x1d')](0xcc)[_0x3448('0x26')]();});}};}function handleEntityNotFound(_0x114244,_0x2088de){return function(_0x951811){if(!_0x951811){_0x114244['sendStatus'](0x194);}return _0x951811;};}function handleError(_0x329947,_0x393081){_0x393081=_0x393081||0x1f4;return function(_0x52c163){logger[_0x3448('0x27')](_0x52c163[_0x3448('0x28')]);if(_0x52c163[_0x3448('0x29')]){delete _0x52c163[_0x3448('0x29')];}_0x329947[_0x3448('0x1d')](_0x393081)[_0x3448('0x2a')](_0x52c163);};}exports[_0x3448('0x2b')]=function(_0x95714e,_0x5911b8){var _0x3307dc={},_0x450704={},_0xcfdc5={'count':0x0,'rows':[]};var _0x52c09d=_[_0x3448('0x2c')](db['ZendeskAccount']['rawAttributes'],function(_0x493898){return{'name':_0x493898[_0x3448('0x2d')],'type':_0x493898[_0x3448('0x2e')]['key']};});_0x450704['model']=_[_0x3448('0x2c')](_0x52c09d,_0x3448('0x29'));_0x450704[_0x3448('0x2f')]=_[_0x3448('0x30')](_0x95714e['query']);_0x450704[_0x3448('0x31')]=_[_0x3448('0x32')](_0x450704[_0x3448('0x33')],_0x450704['query']);_0x3307dc[_0x3448('0x34')]=_[_0x3448('0x32')](_0x450704['model'],qs['fields'](_0x95714e[_0x3448('0x2f')][_0x3448('0x35')]));_0x3307dc[_0x3448('0x34')]=_0x3307dc[_0x3448('0x34')]['length']?_0x3307dc[_0x3448('0x34')]:_0x450704[_0x3448('0x33')];if(!_0x95714e[_0x3448('0x2f')][_0x3448('0x36')]('nolimit')){_0x3307dc[_0x3448('0x21')]=qs[_0x3448('0x21')](_0x95714e['query'][_0x3448('0x21')]);_0x3307dc[_0x3448('0x1f')]=qs[_0x3448('0x1f')](_0x95714e[_0x3448('0x2f')][_0x3448('0x1f')]);}_0x3307dc[_0x3448('0x37')]=qs[_0x3448('0x38')](_0x95714e[_0x3448('0x2f')][_0x3448('0x38')]);_0x3307dc['where']=qs['filters'](_[_0x3448('0x39')](_0x95714e['query'],_0x450704[_0x3448('0x31')]),_0x52c09d);if(_0x95714e[_0x3448('0x2f')][_0x3448('0x3a')]){_0x3307dc[_0x3448('0x3b')]=_['merge'](_0x3307dc[_0x3448('0x3b')],{'$or':_[_0x3448('0x2c')](_0x52c09d,function(_0x495d7){if(_0x495d7[_0x3448('0x2e')]!==_0x3448('0x3c')){var _0x249131={};_0x249131[_0x495d7[_0x3448('0x29')]]={'$like':'%'+_0x95714e[_0x3448('0x2f')][_0x3448('0x3a')]+'%'};return _0x249131;}})});}_0x3307dc=_['merge']({},_0x3307dc,_0x95714e[_0x3448('0x3d')]);var _0x3c92e2={'where':_0x3307dc[_0x3448('0x3b')]};return db[_0x3448('0x3e')][_0x3448('0x22')](_0x3c92e2)['then'](function(_0x18b297){_0xcfdc5[_0x3448('0x22')]=_0x18b297;if(_0x95714e[_0x3448('0x2f')][_0x3448('0x3f')]){_0x3307dc[_0x3448('0x40')]=[{'all':!![]}];}return db[_0x3448('0x3e')][_0x3448('0x41')](_0x3307dc);})[_0x3448('0x42')](function(_0x4a8f80){_0xcfdc5[_0x3448('0x43')]=_0x4a8f80;return _0xcfdc5;})[_0x3448('0x42')](respondWithFilteredResult(_0x5911b8,_0x3307dc))[_0x3448('0x44')](handleError(_0x5911b8,null));};exports['show']=function(_0x2465ff,_0x1d2a7c){var _0x21f989={'raw':![],'where':{'id':_0x2465ff[_0x3448('0x45')]['id']}},_0x26d6b8={};_0x26d6b8[_0x3448('0x33')]=_[_0x3448('0x30')](db['ZendeskAccount'][_0x3448('0x46')]);_0x26d6b8[_0x3448('0x2f')]=_[_0x3448('0x30')](_0x2465ff[_0x3448('0x2f')]);_0x26d6b8[_0x3448('0x31')]=_[_0x3448('0x32')](_0x26d6b8['model'],_0x26d6b8[_0x3448('0x2f')]);_0x21f989['attributes']=_['intersection'](_0x26d6b8[_0x3448('0x33')],qs[_0x3448('0x35')](_0x2465ff['query'][_0x3448('0x35')]));_0x21f989[_0x3448('0x34')]=_0x21f989['attributes'][_0x3448('0x47')]?_0x21f989[_0x3448('0x34')]:_0x26d6b8['model'];if(_0x2465ff[_0x3448('0x2f')][_0x3448('0x3f')]){_0x21f989[_0x3448('0x40')]=[{'all':!![]}];}_0x21f989=_[_0x3448('0x48')]({},_0x21f989,_0x2465ff[_0x3448('0x3d')]);return db[_0x3448('0x3e')][_0x3448('0x49')](_0x21f989)['then'](handleEntityNotFound(_0x1d2a7c,null))['then'](respondWithResult(_0x1d2a7c,null))[_0x3448('0x44')](handleError(_0x1d2a7c,null));};exports[_0x3448('0x4a')]=function(_0x1b82e7,_0x3f48e3){return db['ZendeskAccount'][_0x3448('0x4a')](_0x1b82e7[_0x3448('0x4b')],{})[_0x3448('0x42')](respondWithResult(_0x3f48e3,0xc9))[_0x3448('0x44')](handleError(_0x3f48e3,null));};exports[_0x3448('0x4c')]=function(_0x5d942b,_0x3edd60){if(_0x5d942b['body']['id']){delete _0x5d942b[_0x3448('0x4b')]['id'];}return db[_0x3448('0x3e')]['find']({'where':{'id':_0x5d942b[_0x3448('0x45')]['id']}})[_0x3448('0x42')](handleEntityNotFound(_0x3edd60,null))[_0x3448('0x42')](saveUpdates(_0x5d942b[_0x3448('0x4b')],null))[_0x3448('0x42')](respondWithResult(_0x3edd60,null))[_0x3448('0x44')](handleError(_0x3edd60,null));};exports[_0x3448('0x25')]=function(_0x53236c,_0x23dbda){return db[_0x3448('0x3e')]['find']({'where':{'id':_0x53236c['params']['id']}})[_0x3448('0x42')](handleEntityNotFound(_0x23dbda,null))[_0x3448('0x42')](removeEntity(_0x23dbda,null))['catch'](handleError(_0x23dbda,null));};exports['getConfigurations']=function(_0x371e8a,_0xb6c293,_0x2f795d){var _0x430e74={};var _0x176e60={};var _0x39db50;var _0x2aea70;return db['ZendeskAccount']['findOne']({'where':{'id':_0x371e8a['params']['id']}})[_0x3448('0x42')](handleEntityNotFound(_0xb6c293,null))[_0x3448('0x42')](function(_0x5cf3fe){if(_0x5cf3fe){_0x39db50=_0x5cf3fe;_0x176e60[_0x3448('0x33')]=_[_0x3448('0x30')](db['ZendeskConfiguration'][_0x3448('0x46')]);_0x176e60[_0x3448('0x2f')]=_['keys'](_0x371e8a[_0x3448('0x2f')]);_0x176e60[_0x3448('0x31')]=_[_0x3448('0x32')](_0x176e60[_0x3448('0x33')],_0x176e60[_0x3448('0x2f')]);_0x430e74[_0x3448('0x34')]=_[_0x3448('0x32')](_0x176e60[_0x3448('0x33')],qs[_0x3448('0x35')](_0x371e8a['query'][_0x3448('0x35')]));_0x430e74['attributes']=_0x430e74[_0x3448('0x34')][_0x3448('0x47')]?_0x430e74[_0x3448('0x34')]:_0x176e60[_0x3448('0x33')];_0x430e74[_0x3448('0x37')]=qs[_0x3448('0x38')](_0x371e8a['query'][_0x3448('0x38')]);_0x430e74['where']=qs[_0x3448('0x31')](_[_0x3448('0x39')](_0x371e8a[_0x3448('0x2f')],_0x176e60[_0x3448('0x31')]));if(_0x371e8a[_0x3448('0x2f')]['filter']){_0x430e74['where']=_[_0x3448('0x48')](_0x430e74[_0x3448('0x3b')],{'$or':_[_0x3448('0x2c')](_0x430e74['attributes'],function(_0x7c00fe){var _0x3eb57b={};_0x3eb57b[_0x7c00fe]={'$like':'%'+_0x371e8a[_0x3448('0x2f')][_0x3448('0x3a')]+'%'};return _0x3eb57b;})});}_0x430e74=_[_0x3448('0x48')]({},_0x430e74,_0x371e8a[_0x3448('0x3d')]);return _0x39db50[_0x3448('0x4d')](_0x430e74);}})[_0x3448('0x42')](function(_0x36a151){if(_0x36a151){_0x2aea70=_0x36a151[_0x3448('0x47')];if(!_0x371e8a[_0x3448('0x2f')][_0x3448('0x36')](_0x3448('0x4e'))){_0x430e74[_0x3448('0x21')]=qs[_0x3448('0x21')](_0x371e8a[_0x3448('0x2f')][_0x3448('0x21')]);_0x430e74[_0x3448('0x1f')]=qs['offset'](_0x371e8a[_0x3448('0x2f')]['offset']);}return _0x39db50[_0x3448('0x4d')](_0x430e74);}})['then'](function(_0x1f1e3c){if(_0x1f1e3c){return _0x1f1e3c?{'count':_0x2aea70,'rows':_0x1f1e3c}:null;}})[_0x3448('0x42')](respondWithResult(_0xb6c293,null))['catch'](handleError(_0xb6c293,null));};exports[_0x3448('0x4f')]=function(_0x2f6517,_0x54cddd,_0x4f6902){if(_0x2f6517[_0x3448('0x4b')]['id']){delete _0x2f6517['body']['id'];}return db['ZendeskAccount'][_0x3448('0x50')]({'where':{'id':_0x2f6517[_0x3448('0x45')]['id']}})['then'](handleEntityNotFound(_0x54cddd,null))['then'](function(_0x1385b9){if(_0x1385b9){_0x2f6517[_0x3448('0x4b')][_0x3448('0x51')]=_0x1385b9['id'];_0x2f6517[_0x3448('0x4b')][_0x3448('0x52')]=integrations[_0x3448('0x53')](_0x2f6517[_0x3448('0x4b')][_0x3448('0x54')],_0x2f6517[_0x3448('0x4b')][_0x3448('0x2e')]);_0x2f6517[_0x3448('0x4b')][_0x3448('0x55')]=integrations[_0x3448('0x56')](_0x2f6517[_0x3448('0x4b')]['channel'],_0x2f6517[_0x3448('0x4b')][_0x3448('0x2e')]);return db['ZendeskConfiguration'][_0x3448('0x4a')](_0x2f6517[_0x3448('0x4b')],{'include':[{'model':db['ZendeskField'],'as':_0x3448('0x52')},{'model':db[_0x3448('0x57')],'as':_0x3448('0x55')}]});}return null;})['then'](respondWithResult(_0x54cddd,null))['catch'](handleError(_0x54cddd,null));};exports[_0x3448('0x58')]=function(_0x489b70,_0x31dfc5,_0x42c146){var _0x5d952a='';return db['ZendeskAccount'][_0x3448('0x50')]({'where':{'id':_0x489b70[_0x3448('0x45')]['id']},'attributes':['id',_0x3448('0x59'),'password','token',_0x3448('0x5a'),_0x3448('0x5b')]})[_0x3448('0x42')](handleEntityNotFound(_0x31dfc5,null))[_0x3448('0x42')](function(_0x29dd31){if(_0x29dd31){_0x5d952a=_0x29dd31[_0x3448('0x5b')];var _0x526f38=_0x5d952a[_0x3448('0x5c')](-0x1);if(_0x526f38==='/'){_0x5d952a=_0x5d952a['substring'](0x0,_0x5d952a[_0x3448('0x5d')](_0x526f38));}var _0x2cca2f={'method':'GET','uri':util[_0x3448('0x5e')](_0x3448('0x5f'),_0x5d952a,'ticket_fields'),'json':!![]};switch(_0x29dd31['authType']){case _0x3448('0x60'):_0x2cca2f[_0x3448('0x61')]={'Authorization':util[_0x3448('0x5e')](_0x3448('0x62'),new Buffer(util[_0x3448('0x5e')](_0x3448('0x63'),_0x29dd31[_0x3448('0x59')],_0x29dd31[_0x3448('0x60')]))[_0x3448('0x64')](_0x3448('0x65')))};break;case _0x3448('0x66'):_0x2cca2f[_0x3448('0x61')]={'Authorization':util[_0x3448('0x5e')](_0x3448('0x62'),new Buffer(util[_0x3448('0x5e')](_0x3448('0x67'),_0x29dd31['username'],_0x29dd31['token']))[_0x3448('0x64')]('base64'))};break;default:throw new db[(_0x3448('0x68'))][(_0x3448('0x69'))]('Unknown\x20authentication\x20type');}return rp(_0x2cca2f);}})[_0x3448('0x42')](function(_0x5f4352){if(_0x5f4352){var _0x15d898=[_0x3448('0x6a'),_0x3448('0x6b'),_0x3448('0x6c'),_0x3448('0x6d')];_['remove'](_0x5f4352[_0x3448('0x6e')],function(_0x2e2b73){return _0x15d898[_0x3448('0x6f')](_0x2e2b73['type']);});return{'count':_0x5f4352[_0x3448('0x6e')][_0x3448('0x47')],'rows':_[_0x3448('0x2c')](_0x5f4352['ticket_fields'],function(_0xdb5d71){return{'id':_0xdb5d71['id'],'name':_0xdb5d71['position']>0x7?_0xdb5d71['title']:_0xdb5d71[_0x3448('0x2e')],'custom':_0xdb5d71['position']>0x7?!![]:![],'options':_0xdb5d71[_0x3448('0x70')]?_0xdb5d71['system_field_options']:_0xdb5d71[_0x3448('0x71')]?_0xdb5d71[_0x3448('0x71')]:[]};})};}})['then'](respondWithResult(_0x31dfc5,null))['catch'](function(_0x2a3e76){var _0x287e21=_0x489b70['query'][_0x3448('0x72')]?0x1f4:_0x2a3e76[_0x3448('0x73')]||0x1f4;logger['error'](_0x3448('0x74'),_0x3448('0x58'),_0x287e21,JSON[_0x3448('0x75')](_0x2a3e76));delete _0x2a3e76[_0x3448('0x29')];if(_0x287e21===0x191){_0x287e21=0x190;}_0x31dfc5['status'](_0x287e21)[_0x3448('0x2a')](_0x489b70['query'][_0x3448('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x2a3e76[_0x3448('0x73')]}:_0x2a3e76);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 51cf2de..acb85a9 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 _0xd07e=['../../config/environment','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x138ff8,_0x4a71b2){var _0x2d4a8f=function(_0x1d766d){while(--_0x1d766d){_0x138ff8['push'](_0x138ff8['shift']());}};_0x2d4a8f(++_0x4a71b2);}(_0xd07e,0x147));var _0xed07=function(_0x2ca530,_0x26f6c1){_0x2ca530=_0x2ca530-0x0;var _0x4164e2=_0xd07e[_0x2ca530];return _0x4164e2;};'use strict';var _=require(_0xed07('0x0'));var util=require(_0xed07('0x1'));var logger=require(_0xed07('0x2'))(_0xed07('0x3'));var moment=require(_0xed07('0x4'));var BPromise=require(_0xed07('0x5'));var rp=require(_0xed07('0x6'));var fs=require('fs');var path=require(_0xed07('0x7'));var rimraf=require(_0xed07('0x8'));var config=require(_0xed07('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xed07('0xa'));module[_0xed07('0xb')]=function(_0x4949c3,_0x515d0b){return _0x4949c3['define'](_0xed07('0xc'),attributes,{'tableName':_0xed07('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75fc=['request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','lodash','util','api','moment','bluebird'];(function(_0x52c5ff,_0x191a58){var _0x1250a9=function(_0x1e81cc){while(--_0x1e81cc){_0x52c5ff['push'](_0x52c5ff['shift']());}};_0x1250a9(++_0x191a58);}(_0x75fc,0x1e7));var _0xc75f=function(_0x9d5793,_0x14c01f){_0x9d5793=_0x9d5793-0x0;var _0x5de048=_0x75fc[_0x9d5793];return _0x5de048;};'use strict';var _=require(_0xc75f('0x0'));var util=require(_0xc75f('0x1'));var logger=require('../../config/logger')(_0xc75f('0x2'));var moment=require(_0xc75f('0x3'));var BPromise=require(_0xc75f('0x4'));var rp=require(_0xc75f('0x5'));var fs=require('fs');var path=require(_0xc75f('0x6'));var rimraf=require('rimraf');var config=require(_0xc75f('0x7'));var attributes=require(_0xc75f('0x8'));var integrations=require(_0xc75f('0x9'));module['exports']=function(_0x5559c6,_0x1b976b){return _0x5559c6[_0xc75f('0xa')](_0xc75f('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 7b78eb9..5af8300 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 _0xdb2f=['../../mysqldb','../../config/utils','rpc','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','catch','ShowZendeskAccount','util','moment','bluebird','ioredis'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xdb2f,0x1d8));var _0xfdb2=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xdb2f[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var util=require(_0xfdb2('0x0'));var moment=require(_0xfdb2('0x1'));var BPromise=require(_0xfdb2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdb2('0x3'));var db=require(_0xfdb2('0x4'))['db'];var utils=require(_0xfdb2('0x5'));var logger=require('../../config/logger')(_0xfdb2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfdb2('0x7')][_0xfdb2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b7763,_0x2607e8,_0x469433){return new BPromise(function(_0x50718d,_0x87e9ab){return client[_0xfdb2('0x9')](_0x5b7763,_0x469433)['then'](function(_0x4c8641){logger[_0xfdb2('0xa')](_0xfdb2('0xb'),_0x2607e8,'request\x20sent');logger[_0xfdb2('0xc')](_0xfdb2('0xd'),_0x2607e8,'request\x20sent',JSON[_0xfdb2('0xe')](_0x4c8641));if(_0x4c8641[_0xfdb2('0xf')]){if(_0x4c8641['error'][_0xfdb2('0x10')]===0x1f4){logger[_0xfdb2('0xf')](_0xfdb2('0xb'),_0x2607e8,_0x4c8641['error'][_0xfdb2('0x11')]);return _0x87e9ab(_0x4c8641[_0xfdb2('0xf')][_0xfdb2('0x11')]);}logger[_0xfdb2('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x2607e8,_0x4c8641[_0xfdb2('0xf')]['message']);return _0x50718d(_0x4c8641['error'][_0xfdb2('0x11')]);}else{logger['info'](_0xfdb2('0xb'),_0x2607e8,_0xfdb2('0x12'));_0x50718d(_0x4c8641[_0xfdb2('0x13')]['message']);}})['catch'](function(_0x2c66aa){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2607e8,_0x2c66aa);_0x87e9ab(_0x2c66aa);});});}exports[_0xfdb2('0x14')]=function(_0x3b5bab){var _0x1284a4=this;return new Promise(function(_0x56c9b8,_0x3e6f8c){return db[_0xfdb2('0x15')][_0xfdb2('0x16')]({'raw':_0x3b5bab[_0xfdb2('0x17')]?_0x3b5bab[_0xfdb2('0x17')][_0xfdb2('0x18')]===undefined?!![]:![]:!![],'where':_0x3b5bab[_0xfdb2('0x17')]?_0x3b5bab[_0xfdb2('0x17')][_0xfdb2('0x19')]||null:null,'attributes':_0x3b5bab['options']?_0x3b5bab[_0xfdb2('0x17')][_0xfdb2('0x1a')]||null:null,'limit':_0x3b5bab[_0xfdb2('0x17')]?_0x3b5bab['options'][_0xfdb2('0x1b')]||null:null,'include':_0x3b5bab[_0xfdb2('0x17')]?_0x3b5bab['options']['include']?_[_0xfdb2('0x1c')](_0x3b5bab[_0xfdb2('0x17')][_0xfdb2('0x1d')],function(_0x1809c5){return{'model':db[_0x1809c5[_0xfdb2('0x1e')]],'as':_0x1809c5['as'],'attributes':_0x1809c5[_0xfdb2('0x1a')],'include':_0x1809c5[_0xfdb2('0x1d')]?_[_0xfdb2('0x1c')](_0x1809c5[_0xfdb2('0x1d')],function(_0x552c24){return{'model':db[_0x552c24[_0xfdb2('0x1e')]],'as':_0x552c24['as'],'attributes':_0x552c24[_0xfdb2('0x1a')],'include':_0x552c24[_0xfdb2('0x1d')]?_[_0xfdb2('0x1c')](_0x552c24['include'],function(_0x4fa379){return{'model':db[_0x4fa379[_0xfdb2('0x1e')]],'as':_0x4fa379['as'],'attributes':_0x4fa379['attributes']};}):[]};}):[]};}):[]:[]})[_0xfdb2('0x1f')](function(_0x57453c){logger[_0xfdb2('0xa')]('GetZendeskAccount',_0x3b5bab);logger['debug']('GetZendeskAccount',_0x3b5bab,JSON['stringify'](_0x57453c));_0x56c9b8(_0x57453c);})[_0xfdb2('0x20')](function(_0x4a3a9b){logger[_0xfdb2('0xf')]('GetZendeskAccount',_0x4a3a9b[_0xfdb2('0x11')],_0x3b5bab);_0x3e6f8c(_0x1284a4[_0xfdb2('0xf')](0x1f4,_0x4a3a9b[_0xfdb2('0x11')]));});});};exports[_0xfdb2('0x21')]=function(_0x5a721a){var _0x1cad66=this;return new Promise(function(_0x28be18,_0xf73749){return db['ZendeskAccount']['find']({'raw':_0x5a721a[_0xfdb2('0x17')]?_0x5a721a['options'][_0xfdb2('0x18')]===undefined?!![]:![]:!![],'where':_0x5a721a[_0xfdb2('0x17')]?_0x5a721a['options'][_0xfdb2('0x19')]||null:null,'attributes':_0x5a721a[_0xfdb2('0x17')]?_0x5a721a[_0xfdb2('0x17')][_0xfdb2('0x1a')]||null:null,'include':_0x5a721a[_0xfdb2('0x17')]?_0x5a721a[_0xfdb2('0x17')][_0xfdb2('0x1d')]?_[_0xfdb2('0x1c')](_0x5a721a[_0xfdb2('0x17')][_0xfdb2('0x1d')],function(_0x4e4f41){return{'model':db[_0x4e4f41[_0xfdb2('0x1e')]],'as':_0x4e4f41['as'],'attributes':_0x4e4f41[_0xfdb2('0x1a')],'include':_0x4e4f41[_0xfdb2('0x1d')]?_['map'](_0x4e4f41[_0xfdb2('0x1d')],function(_0x14d88d){return{'model':db[_0x14d88d[_0xfdb2('0x1e')]],'as':_0x14d88d['as'],'attributes':_0x14d88d[_0xfdb2('0x1a')],'include':_0x14d88d[_0xfdb2('0x1d')]?_[_0xfdb2('0x1c')](_0x14d88d[_0xfdb2('0x1d')],function(_0x202a37){return{'model':db[_0x202a37[_0xfdb2('0x1e')]],'as':_0x202a37['as'],'attributes':_0x202a37[_0xfdb2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfdb2('0x1f')](function(_0x4f27ce){logger[_0xfdb2('0xa')](_0xfdb2('0x21'),_0x5a721a);logger[_0xfdb2('0xc')](_0xfdb2('0x21'),_0x5a721a,JSON[_0xfdb2('0xe')](_0x4f27ce));_0x28be18(_0x4f27ce);})[_0xfdb2('0x20')](function(_0x445c1f){logger['error']('ShowZendeskAccount',_0x445c1f[_0xfdb2('0x11')],_0x5a721a);_0xf73749(_0x1cad66['error'](0x1f4,_0x445c1f['message']));});});}; \ No newline at end of file +var _0x4fed=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','attributes','include','map','model','ShowZendeskAccount','where','moment'];(function(_0x1c866c,_0x38c279){var _0x574d82=function(_0x218708){while(--_0x218708){_0x1c866c['push'](_0x1c866c['shift']());}};_0x574d82(++_0x38c279);}(_0x4fed,0x107));var _0xd4fe=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x4fed[_0x288f5e];return _0x476cc9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd4fe('0x0'));var BPromise=require(_0xd4fe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4fe('0x2'));var db=require(_0xd4fe('0x3'))['db'];var utils=require(_0xd4fe('0x4'));var logger=require(_0xd4fe('0x5'))(_0xd4fe('0x6'));var config=require(_0xd4fe('0x7'));var jayson=require(_0xd4fe('0x8'));var client=jayson[_0xd4fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x334dbc,_0x2adadd,_0x13b3b0){return new BPromise(function(_0x5a0e1f,_0xe74816){return client[_0xd4fe('0xa')](_0x334dbc,_0x13b3b0)[_0xd4fe('0xb')](function(_0x25c12a){logger['info'](_0xd4fe('0xc'),_0x2adadd,_0xd4fe('0xd'));logger[_0xd4fe('0xe')](_0xd4fe('0xf'),_0x2adadd,_0xd4fe('0xd'),JSON[_0xd4fe('0x10')](_0x25c12a));if(_0x25c12a[_0xd4fe('0x11')]){if(_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x12')]===0x1f4){logger[_0xd4fe('0x11')](_0xd4fe('0xc'),_0x2adadd,_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x13')]);return _0xe74816(_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x13')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2adadd,_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x13')]);return _0x5a0e1f(_0x25c12a[_0xd4fe('0x11')][_0xd4fe('0x13')]);}else{logger[_0xd4fe('0x14')](_0xd4fe('0xc'),_0x2adadd,'request\x20sent');_0x5a0e1f(_0x25c12a[_0xd4fe('0x15')][_0xd4fe('0x13')]);}})[_0xd4fe('0x16')](function(_0x1fd111){logger[_0xd4fe('0x11')](_0xd4fe('0xc'),_0x2adadd,_0x1fd111);_0xe74816(_0x1fd111);});});}exports[_0xd4fe('0x17')]=function(_0x48b1f1){var _0xc8c39c=this;return new Promise(function(_0x7bf51e,_0x524b6d){return db[_0xd4fe('0x18')]['findAll']({'raw':_0x48b1f1[_0xd4fe('0x19')]?_0x48b1f1[_0xd4fe('0x19')][_0xd4fe('0x1a')]===undefined?!![]:![]:!![],'where':_0x48b1f1[_0xd4fe('0x19')]?_0x48b1f1[_0xd4fe('0x19')]['where']||null:null,'attributes':_0x48b1f1[_0xd4fe('0x19')]?_0x48b1f1['options'][_0xd4fe('0x1b')]||null:null,'limit':_0x48b1f1[_0xd4fe('0x19')]?_0x48b1f1['options']['limit']||null:null,'include':_0x48b1f1[_0xd4fe('0x19')]?_0x48b1f1[_0xd4fe('0x19')][_0xd4fe('0x1c')]?_[_0xd4fe('0x1d')](_0x48b1f1[_0xd4fe('0x19')][_0xd4fe('0x1c')],function(_0xe8c3e5){return{'model':db[_0xe8c3e5[_0xd4fe('0x1e')]],'as':_0xe8c3e5['as'],'attributes':_0xe8c3e5['attributes'],'include':_0xe8c3e5['include']?_[_0xd4fe('0x1d')](_0xe8c3e5['include'],function(_0x13ce7b){return{'model':db[_0x13ce7b[_0xd4fe('0x1e')]],'as':_0x13ce7b['as'],'attributes':_0x13ce7b[_0xd4fe('0x1b')],'include':_0x13ce7b[_0xd4fe('0x1c')]?_['map'](_0x13ce7b[_0xd4fe('0x1c')],function(_0x51668c){return{'model':db[_0x51668c[_0xd4fe('0x1e')]],'as':_0x51668c['as'],'attributes':_0x51668c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c37e4){logger[_0xd4fe('0x14')]('GetZendeskAccount',_0x48b1f1);logger[_0xd4fe('0xe')](_0xd4fe('0x17'),_0x48b1f1,JSON[_0xd4fe('0x10')](_0x4c37e4));_0x7bf51e(_0x4c37e4);})[_0xd4fe('0x16')](function(_0x2b2546){logger[_0xd4fe('0x11')](_0xd4fe('0x17'),_0x2b2546[_0xd4fe('0x13')],_0x48b1f1);_0x524b6d(_0xc8c39c[_0xd4fe('0x11')](0x1f4,_0x2b2546[_0xd4fe('0x13')]));});});};exports[_0xd4fe('0x1f')]=function(_0x433b16){var _0x5aa518=this;return new Promise(function(_0x1d576d,_0x18c87f){return db[_0xd4fe('0x18')]['find']({'raw':_0x433b16[_0xd4fe('0x19')]?_0x433b16[_0xd4fe('0x19')][_0xd4fe('0x1a')]===undefined?!![]:![]:!![],'where':_0x433b16['options']?_0x433b16[_0xd4fe('0x19')][_0xd4fe('0x20')]||null:null,'attributes':_0x433b16[_0xd4fe('0x19')]?_0x433b16[_0xd4fe('0x19')][_0xd4fe('0x1b')]||null:null,'include':_0x433b16[_0xd4fe('0x19')]?_0x433b16[_0xd4fe('0x19')][_0xd4fe('0x1c')]?_[_0xd4fe('0x1d')](_0x433b16[_0xd4fe('0x19')][_0xd4fe('0x1c')],function(_0x55afd9){return{'model':db[_0x55afd9[_0xd4fe('0x1e')]],'as':_0x55afd9['as'],'attributes':_0x55afd9['attributes'],'include':_0x55afd9[_0xd4fe('0x1c')]?_[_0xd4fe('0x1d')](_0x55afd9[_0xd4fe('0x1c')],function(_0xfc12b0){return{'model':db[_0xfc12b0['model']],'as':_0xfc12b0['as'],'attributes':_0xfc12b0[_0xd4fe('0x1b')],'include':_0xfc12b0[_0xd4fe('0x1c')]?_[_0xd4fe('0x1d')](_0xfc12b0[_0xd4fe('0x1c')],function(_0x44ebaf){return{'model':db[_0x44ebaf[_0xd4fe('0x1e')]],'as':_0x44ebaf['as'],'attributes':_0x44ebaf[_0xd4fe('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd4fe('0xb')](function(_0x4ad5bc){logger[_0xd4fe('0x14')](_0xd4fe('0x1f'),_0x433b16);logger[_0xd4fe('0xe')](_0xd4fe('0x1f'),_0x433b16,JSON['stringify'](_0x4ad5bc));_0x1d576d(_0x4ad5bc);})[_0xd4fe('0x16')](function(_0x2efc73){logger[_0xd4fe('0x11')](_0xd4fe('0x1f'),_0x2efc73[_0xd4fe('0x13')],_0x433b16);_0x18c87f(_0x5aa518['error'](0x1f4,_0x2efc73['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 2911ec8..4459584 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 _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x278a09,_0x3af5ef){var _0x137bc0=function(_0x1f1786){while(--_0x1f1786){_0x278a09['push'](_0x278a09['shift']());}};_0x137bc0(++_0x3af5ef);}(_0x750a,0x140));var _0xa750=function(_0x54dc7e,_0x507956){_0x54dc7e=_0x54dc7e-0x0;var _0x2114d1=_0x750a[_0x54dc7e];return _0x2114d1;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file +var _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x392e1d,_0x125aed){var _0x486d9b=function(_0x2223a4){while(--_0x2223a4){_0x392e1d['push'](_0x392e1d['shift']());}};_0x486d9b(++_0x125aed);}(_0xea28,0x13a));var _0x8ea2=function(_0x189b7b,_0x4c5041){_0x189b7b=_0x189b7b-0x0;var _0x2896b2=_0xea28[_0x189b7b];return _0x2896b2;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a1b8556..4e01512 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 _0x6840=['exports','STRING','sequelize'];(function(_0x4f7782,_0x175079){var _0x21e9aa=function(_0x1fba01){while(--_0x1fba01){_0x4f7782['push'](_0x4f7782['shift']());}};_0x21e9aa(++_0x175079);}(_0x6840,0x119));var _0x0684=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6840[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x0684('0x0'));module[_0x0684('0x1')]={'name':{'type':Sequelize[_0x0684('0x2')]},'description':{'type':Sequelize[_0x0684('0x2')]}}; \ No newline at end of file +var _0xccc4=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xccc4,0xe1));var _0x4ccc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xccc4[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x4ccc('0x0'));module[_0x4ccc('0x1')]={'name':{'type':Sequelize[_0x4ccc('0x2')]},'description':{'type':Sequelize[_0x4ccc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 77938ef..4be0fa3 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 _0x6cba=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','findOne','ZendeskField','pick','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x573722,_0x21ae1b){var _0x41dc6b=function(_0x35a035){while(--_0x35a035){_0x573722['push'](_0x573722['shift']());}};_0x41dc6b(++_0x21ae1b);}(_0x6cba,0xc4));var _0xa6cb=function(_0x2b4895,_0x20c70a){_0x2b4895=_0x2b4895-0x0;var _0x569215=_0x6cba[_0x2b4895];return _0x569215;};'use strict';var emlformat=require(_0xa6cb('0x0'));var rimraf=require(_0xa6cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6cb('0x2'));var rp=require(_0xa6cb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa6cb('0x4'));var util=require(_0xa6cb('0x5'));var path=require(_0xa6cb('0x6'));var sox=require(_0xa6cb('0x7'));var csv=require(_0xa6cb('0x8'));var ejs=require(_0xa6cb('0x9'));var fs=require('fs');var fs_extra=require(_0xa6cb('0xa'));var _=require('lodash');var squel=require(_0xa6cb('0xb'));var crypto=require(_0xa6cb('0xc'));var jsforce=require(_0xa6cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa6cb('0x8'));var querystring=require(_0xa6cb('0xe'));var Papa=require(_0xa6cb('0xf'));var Redis=require(_0xa6cb('0x10'));var authService=require(_0xa6cb('0x11'));var qs=require(_0xa6cb('0x12'));var as=require(_0xa6cb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6cb('0x14'))(_0xa6cb('0x15'));var utils=require('../../config/utils');var config=require(_0xa6cb('0x16'));var licenseUtil=require(_0xa6cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x258b03,_0x3f90d9){_0x3f90d9=_0x3f90d9||0xcc;return function(_0x164f8e){if(_0x164f8e){return _0x258b03[_0xa6cb('0x18')](_0x3f90d9);}return _0x258b03['status'](_0x3f90d9)['end']();};}function respondWithResult(_0x4d2f39,_0x505984){_0x505984=_0x505984||0xc8;return function(_0x432502){if(_0x432502){return _0x4d2f39[_0xa6cb('0x19')](_0x505984)[_0xa6cb('0x1a')](_0x432502);}};}function respondWithFilteredResult(_0x59ab8c,_0xfbc9a6){return function(_0x46ec56){if(_0x46ec56){var _0x4badc5=typeof _0xfbc9a6[_0xa6cb('0x1b')]===_0xa6cb('0x1c')&&typeof _0xfbc9a6[_0xa6cb('0x1d')]==='undefined';var _0x3b3b4c=_0x46ec56[_0xa6cb('0x1e')];var _0x2dd95c=_0x4badc5?0x0:_0xfbc9a6[_0xa6cb('0x1b')];var _0xc01230=_0x4badc5?_0x46ec56[_0xa6cb('0x1e')]:_0xfbc9a6[_0xa6cb('0x1b')]+_0xfbc9a6[_0xa6cb('0x1d')];var _0x19958e;if(_0xc01230>=_0x3b3b4c){_0xc01230=_0x3b3b4c;_0x19958e=0xc8;}else{_0x19958e=0xce;}_0x59ab8c[_0xa6cb('0x19')](_0x19958e);return _0x59ab8c[_0xa6cb('0x1f')](_0xa6cb('0x20'),_0x2dd95c+'-'+_0xc01230+'/'+_0x3b3b4c)[_0xa6cb('0x1a')](_0x46ec56);}return null;};}function patchUpdates(_0x16b7f0){return function(_0x5bbe78){try{jsonpatch[_0xa6cb('0x21')](_0x5bbe78,_0x16b7f0,!![]);}catch(_0x2e92a2){return BPromise[_0xa6cb('0x22')](_0x2e92a2);}return _0x5bbe78['save']();};}function saveUpdates(_0xcdb4af,_0x2ec474){return function(_0x1a2144){if(_0x1a2144){return _0x1a2144[_0xa6cb('0x23')](_0xcdb4af)[_0xa6cb('0x24')](function(_0x9d484d){return _0x9d484d;});}return null;};}function removeEntity(_0x3de122,_0x39e00d){return function(_0x10dc7c){if(_0x10dc7c){return _0x10dc7c[_0xa6cb('0x25')]()['then'](function(){_0x3de122[_0xa6cb('0x19')](0xcc)[_0xa6cb('0x26')]();});}};}function handleEntityNotFound(_0x3d233e,_0x2e9d2f){return function(_0x42d3c3){if(!_0x42d3c3){_0x3d233e[_0xa6cb('0x18')](0x194);}return _0x42d3c3;};}function handleError(_0x5e55b0,_0x222efc){_0x222efc=_0x222efc||0x1f4;return function(_0x2ad117){logger[_0xa6cb('0x27')](_0x2ad117['stack']);if(_0x2ad117['name']){delete _0x2ad117[_0xa6cb('0x28')];}_0x5e55b0['status'](_0x222efc)['send'](_0x2ad117);};}exports[_0xa6cb('0x29')]=function(_0x2962d7,_0x5eac0b){var _0x39a5c9={},_0x407130={},_0x4d0bef={'count':0x0,'rows':[]};var _0x4298e6=_[_0xa6cb('0x2a')](db[_0xa6cb('0x2b')][_0xa6cb('0x2c')],function(_0x189988){return{'name':_0x189988[_0xa6cb('0x2d')],'type':_0x189988[_0xa6cb('0x2e')][_0xa6cb('0x2f')]};});_0x407130[_0xa6cb('0x30')]=_[_0xa6cb('0x2a')](_0x4298e6,_0xa6cb('0x28'));_0x407130[_0xa6cb('0x31')]=_[_0xa6cb('0x32')](_0x2962d7[_0xa6cb('0x31')]);_0x407130[_0xa6cb('0x33')]=_[_0xa6cb('0x34')](_0x407130['model'],_0x407130[_0xa6cb('0x31')]);_0x39a5c9[_0xa6cb('0x35')]=_[_0xa6cb('0x34')](_0x407130[_0xa6cb('0x30')],qs[_0xa6cb('0x36')](_0x2962d7['query']['fields']));_0x39a5c9['attributes']=_0x39a5c9[_0xa6cb('0x35')][_0xa6cb('0x37')]?_0x39a5c9[_0xa6cb('0x35')]:_0x407130[_0xa6cb('0x30')];if(!_0x2962d7[_0xa6cb('0x31')]['hasOwnProperty'](_0xa6cb('0x38'))){_0x39a5c9[_0xa6cb('0x1d')]=qs['limit'](_0x2962d7[_0xa6cb('0x31')][_0xa6cb('0x1d')]);_0x39a5c9[_0xa6cb('0x1b')]=qs['offset'](_0x2962d7['query']['offset']);}_0x39a5c9[_0xa6cb('0x39')]=qs['sort'](_0x2962d7['query'][_0xa6cb('0x3a')]);_0x39a5c9[_0xa6cb('0x3b')]=qs[_0xa6cb('0x33')](_['pick'](_0x2962d7[_0xa6cb('0x31')],_0x407130['filters']),_0x4298e6);if(_0x2962d7[_0xa6cb('0x31')][_0xa6cb('0x3c')]){_0x39a5c9['where']=_[_0xa6cb('0x3d')](_0x39a5c9['where'],{'$or':_[_0xa6cb('0x2a')](_0x4298e6,function(_0x35990c){if(_0x35990c[_0xa6cb('0x2e')]!==_0xa6cb('0x3e')){var _0x4a1ee4={};_0x4a1ee4[_0x35990c[_0xa6cb('0x28')]]={'$like':'%'+_0x2962d7[_0xa6cb('0x31')]['filter']+'%'};return _0x4a1ee4;}})});}_0x39a5c9=_['merge']({},_0x39a5c9,_0x2962d7[_0xa6cb('0x3f')]);var _0x535290={'where':_0x39a5c9[_0xa6cb('0x3b')]};return db[_0xa6cb('0x2b')][_0xa6cb('0x1e')](_0x535290)['then'](function(_0x48da78){_0x4d0bef[_0xa6cb('0x1e')]=_0x48da78;if(_0x2962d7[_0xa6cb('0x31')][_0xa6cb('0x40')]){_0x39a5c9[_0xa6cb('0x41')]=[{'all':!![]}];}return db[_0xa6cb('0x2b')][_0xa6cb('0x42')](_0x39a5c9);})[_0xa6cb('0x24')](function(_0x3b9bd4){_0x4d0bef[_0xa6cb('0x43')]=_0x3b9bd4;return _0x4d0bef;})[_0xa6cb('0x24')](respondWithFilteredResult(_0x5eac0b,_0x39a5c9))[_0xa6cb('0x44')](handleError(_0x5eac0b,null));};exports[_0xa6cb('0x45')]=function(_0x41e61f,_0x2566e1){var _0xb2d6b7={'raw':![],'where':{'id':_0x41e61f['params']['id']}},_0x4bd05c={};_0x4bd05c[_0xa6cb('0x30')]=_[_0xa6cb('0x32')](db['ZendeskConfiguration'][_0xa6cb('0x2c')]);_0x4bd05c[_0xa6cb('0x31')]=_['keys'](_0x41e61f[_0xa6cb('0x31')]);_0x4bd05c[_0xa6cb('0x33')]=_['intersection'](_0x4bd05c[_0xa6cb('0x30')],_0x4bd05c['query']);_0xb2d6b7['attributes']=_[_0xa6cb('0x34')](_0x4bd05c[_0xa6cb('0x30')],qs[_0xa6cb('0x36')](_0x41e61f[_0xa6cb('0x31')][_0xa6cb('0x36')]));_0xb2d6b7[_0xa6cb('0x35')]=_0xb2d6b7['attributes'][_0xa6cb('0x37')]?_0xb2d6b7[_0xa6cb('0x35')]:_0x4bd05c[_0xa6cb('0x30')];if(_0x41e61f[_0xa6cb('0x31')]['includeAll']){_0xb2d6b7[_0xa6cb('0x41')]=[{'all':!![]}];}_0xb2d6b7=_[_0xa6cb('0x3d')]({},_0xb2d6b7,_0x41e61f[_0xa6cb('0x3f')]);return db['ZendeskConfiguration'][_0xa6cb('0x46')](_0xb2d6b7)[_0xa6cb('0x24')](handleEntityNotFound(_0x2566e1,null))[_0xa6cb('0x24')](respondWithResult(_0x2566e1,null))[_0xa6cb('0x44')](handleError(_0x2566e1,null));};exports[_0xa6cb('0x47')]=function(_0x4b8d86,_0x3c6eb9){return db['ZendeskConfiguration']['create'](_0x4b8d86[_0xa6cb('0x48')],{})[_0xa6cb('0x24')](respondWithResult(_0x3c6eb9,0xc9))[_0xa6cb('0x44')](handleError(_0x3c6eb9,null));};exports[_0xa6cb('0x23')]=function(_0x172842,_0x3006e9){if(_0x172842[_0xa6cb('0x48')]['id']){delete _0x172842[_0xa6cb('0x48')]['id'];}return db[_0xa6cb('0x2b')][_0xa6cb('0x46')]({'where':{'id':_0x172842['params']['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x3006e9,null))['then'](saveUpdates(_0x172842[_0xa6cb('0x48')],null))[_0xa6cb('0x24')](respondWithResult(_0x3006e9,null))[_0xa6cb('0x44')](handleError(_0x3006e9,null));};exports['destroy']=function(_0x4e4066,_0x31a730){return db[_0xa6cb('0x2b')]['find']({'where':{'id':_0x4e4066[_0xa6cb('0x49')]['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x31a730,null))[_0xa6cb('0x24')](removeEntity(_0x31a730,null))[_0xa6cb('0x44')](handleError(_0x31a730,null));};exports['getFields']=function(_0x59b9f4,_0x3de63a,_0x224e5c){var _0x47cab8={};var _0x101b76={};var _0x32f44a;var _0x3a03dc;return db[_0xa6cb('0x2b')][_0xa6cb('0x4a')]({'where':{'id':_0x59b9f4[_0xa6cb('0x49')]['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x3de63a,null))[_0xa6cb('0x24')](function(_0x56ccf1){if(_0x56ccf1){_0x32f44a=_0x56ccf1;_0x101b76[_0xa6cb('0x30')]=_[_0xa6cb('0x32')](db[_0xa6cb('0x4b')][_0xa6cb('0x2c')]);_0x101b76['query']=_[_0xa6cb('0x32')](_0x59b9f4[_0xa6cb('0x31')]);_0x101b76[_0xa6cb('0x33')]=_['intersection'](_0x101b76[_0xa6cb('0x30')],_0x101b76[_0xa6cb('0x31')]);_0x47cab8[_0xa6cb('0x35')]=_[_0xa6cb('0x34')](_0x101b76['model'],qs[_0xa6cb('0x36')](_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x36')]));_0x47cab8[_0xa6cb('0x35')]=_0x47cab8[_0xa6cb('0x35')]['length']?_0x47cab8[_0xa6cb('0x35')]:_0x101b76[_0xa6cb('0x30')];_0x47cab8['order']=qs[_0xa6cb('0x3a')](_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x3a')]);_0x47cab8[_0xa6cb('0x3b')]=qs[_0xa6cb('0x33')](_[_0xa6cb('0x4c')](_0x59b9f4['query'],_0x101b76[_0xa6cb('0x33')]));if(_0x59b9f4['query'][_0xa6cb('0x3c')]){_0x47cab8[_0xa6cb('0x3b')]=_[_0xa6cb('0x3d')](_0x47cab8['where'],{'$or':_['map'](_0x47cab8[_0xa6cb('0x35')],function(_0x5dd8c1){var _0x5e2daf={};_0x5e2daf[_0x5dd8c1]={'$like':'%'+_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x3c')]+'%'};return _0x5e2daf;})});}_0x47cab8=_[_0xa6cb('0x3d')]({},_0x47cab8,_0x59b9f4[_0xa6cb('0x3f')]);return _0x32f44a['getFields'](_0x47cab8);}})[_0xa6cb('0x24')](function(_0x5a42d2){if(_0x5a42d2){_0x3a03dc=_0x5a42d2[_0xa6cb('0x37')];if(!_0x59b9f4['query']['hasOwnProperty'](_0xa6cb('0x38'))){_0x47cab8['limit']=qs[_0xa6cb('0x1d')](_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x1d')]);_0x47cab8[_0xa6cb('0x1b')]=qs[_0xa6cb('0x1b')](_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x1b')]);}return _0x32f44a['getFields'](_0x47cab8);}})[_0xa6cb('0x24')](function(_0x48ad71){if(_0x48ad71){return _0x48ad71?{'count':_0x3a03dc,'rows':_0x48ad71}:null;}})[_0xa6cb('0x24')](respondWithResult(_0x3de63a,null))[_0xa6cb('0x44')](handleError(_0x3de63a,null));};exports[_0xa6cb('0x4d')]=function(_0x2536f8,_0x5a2128,_0x4aff23){var _0x34d54c={};var _0x58cb70={};var _0x24f580;var _0x371284;return db['ZendeskConfiguration'][_0xa6cb('0x4a')]({'where':{'id':_0x2536f8['params']['id']}})['then'](handleEntityNotFound(_0x5a2128,null))['then'](function(_0x49e6bc){if(_0x49e6bc){_0x24f580=_0x49e6bc;_0x58cb70[_0xa6cb('0x30')]=_[_0xa6cb('0x32')](db[_0xa6cb('0x4b')][_0xa6cb('0x2c')]);_0x58cb70[_0xa6cb('0x31')]=_[_0xa6cb('0x32')](_0x2536f8[_0xa6cb('0x31')]);_0x58cb70[_0xa6cb('0x33')]=_[_0xa6cb('0x34')](_0x58cb70['model'],_0x58cb70[_0xa6cb('0x31')]);_0x34d54c[_0xa6cb('0x35')]=_['intersection'](_0x58cb70[_0xa6cb('0x30')],qs[_0xa6cb('0x36')](_0x2536f8['query'][_0xa6cb('0x36')]));_0x34d54c[_0xa6cb('0x35')]=_0x34d54c[_0xa6cb('0x35')][_0xa6cb('0x37')]?_0x34d54c[_0xa6cb('0x35')]:_0x58cb70[_0xa6cb('0x30')];_0x34d54c[_0xa6cb('0x39')]=qs[_0xa6cb('0x3a')](_0x2536f8['query']['sort']);_0x34d54c[_0xa6cb('0x3b')]=qs[_0xa6cb('0x33')](_[_0xa6cb('0x4c')](_0x2536f8[_0xa6cb('0x31')],_0x58cb70[_0xa6cb('0x33')]));if(_0x2536f8[_0xa6cb('0x31')][_0xa6cb('0x3c')]){_0x34d54c[_0xa6cb('0x3b')]=_[_0xa6cb('0x3d')](_0x34d54c[_0xa6cb('0x3b')],{'$or':_[_0xa6cb('0x2a')](_0x34d54c['attributes'],function(_0x1ef5ef){var _0x4c8ad0={};_0x4c8ad0[_0x1ef5ef]={'$like':'%'+_0x2536f8['query']['filter']+'%'};return _0x4c8ad0;})});}_0x34d54c=_[_0xa6cb('0x3d')]({},_0x34d54c,_0x2536f8[_0xa6cb('0x3f')]);return _0x24f580[_0xa6cb('0x4d')](_0x34d54c);}})['then'](function(_0x22f5b2){if(_0x22f5b2){_0x371284=_0x22f5b2[_0xa6cb('0x37')];if(!_0x2536f8['query']['hasOwnProperty'](_0xa6cb('0x38'))){_0x34d54c['limit']=qs['limit'](_0x2536f8[_0xa6cb('0x31')][_0xa6cb('0x1d')]);_0x34d54c['offset']=qs[_0xa6cb('0x1b')](_0x2536f8[_0xa6cb('0x31')][_0xa6cb('0x1b')]);}return _0x24f580['getSubjects'](_0x34d54c);}})[_0xa6cb('0x24')](function(_0x31bb52){if(_0x31bb52){return _0x31bb52?{'count':_0x371284,'rows':_0x31bb52}:null;}})[_0xa6cb('0x24')](respondWithResult(_0x5a2128,null))[_0xa6cb('0x44')](handleError(_0x5a2128,null));};exports['getDescriptions']=function(_0x26a073,_0x127ccd,_0x19346e){var _0x36a5e0={};var _0x263013={};var _0xb49dd9;var _0x349946;return db[_0xa6cb('0x2b')][_0xa6cb('0x4a')]({'where':{'id':_0x26a073[_0xa6cb('0x49')]['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x127ccd,null))[_0xa6cb('0x24')](function(_0x2135a4){if(_0x2135a4){_0xb49dd9=_0x2135a4;_0x263013[_0xa6cb('0x30')]=_['keys'](db[_0xa6cb('0x4b')][_0xa6cb('0x2c')]);_0x263013[_0xa6cb('0x31')]=_['keys'](_0x26a073[_0xa6cb('0x31')]);_0x263013['filters']=_[_0xa6cb('0x34')](_0x263013[_0xa6cb('0x30')],_0x263013[_0xa6cb('0x31')]);_0x36a5e0[_0xa6cb('0x35')]=_[_0xa6cb('0x34')](_0x263013['model'],qs[_0xa6cb('0x36')](_0x26a073['query'][_0xa6cb('0x36')]));_0x36a5e0['attributes']=_0x36a5e0[_0xa6cb('0x35')][_0xa6cb('0x37')]?_0x36a5e0['attributes']:_0x263013[_0xa6cb('0x30')];_0x36a5e0[_0xa6cb('0x39')]=qs[_0xa6cb('0x3a')](_0x26a073[_0xa6cb('0x31')][_0xa6cb('0x3a')]);_0x36a5e0[_0xa6cb('0x3b')]=qs[_0xa6cb('0x33')](_['pick'](_0x26a073['query'],_0x263013['filters']));if(_0x26a073[_0xa6cb('0x31')]['filter']){_0x36a5e0[_0xa6cb('0x3b')]=_[_0xa6cb('0x3d')](_0x36a5e0[_0xa6cb('0x3b')],{'$or':_[_0xa6cb('0x2a')](_0x36a5e0[_0xa6cb('0x35')],function(_0x386aaf){var _0xd8a09b={};_0xd8a09b[_0x386aaf]={'$like':'%'+_0x26a073[_0xa6cb('0x31')][_0xa6cb('0x3c')]+'%'};return _0xd8a09b;})});}_0x36a5e0=_[_0xa6cb('0x3d')]({},_0x36a5e0,_0x26a073[_0xa6cb('0x3f')]);return _0xb49dd9['getDescriptions'](_0x36a5e0);}})['then'](function(_0x4c3196){if(_0x4c3196){_0x349946=_0x4c3196['length'];if(!_0x26a073['query'][_0xa6cb('0x4e')](_0xa6cb('0x38'))){_0x36a5e0[_0xa6cb('0x1d')]=qs['limit'](_0x26a073['query'][_0xa6cb('0x1d')]);_0x36a5e0[_0xa6cb('0x1b')]=qs['offset'](_0x26a073[_0xa6cb('0x31')]['offset']);}return _0xb49dd9[_0xa6cb('0x4f')](_0x36a5e0);}})[_0xa6cb('0x24')](function(_0x22542b){if(_0x22542b){return _0x22542b?{'count':_0x349946,'rows':_0x22542b}:null;}})['then'](respondWithResult(_0x127ccd,null))[_0xa6cb('0x44')](handleError(_0x127ccd,null));};exports[_0xa6cb('0x50')]=function(_0x337143,_0x3ee02a,_0x223ce9){var _0xd0905a={};var _0x2c32e5={};var _0x4c94f1;var _0x486ea8;return db[_0xa6cb('0x2b')][_0xa6cb('0x4a')]({'where':{'id':_0x337143[_0xa6cb('0x49')]['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x3ee02a,null))[_0xa6cb('0x24')](function(_0x4ea798){if(_0x4ea798){_0x4c94f1=_0x4ea798;_0x2c32e5['model']=_[_0xa6cb('0x32')](db[_0xa6cb('0x51')][_0xa6cb('0x2c')]);_0x2c32e5['query']=_[_0xa6cb('0x32')](_0x337143['query']);_0x2c32e5['filters']=_[_0xa6cb('0x34')](_0x2c32e5[_0xa6cb('0x30')],_0x2c32e5[_0xa6cb('0x31')]);_0xd0905a[_0xa6cb('0x35')]=_[_0xa6cb('0x34')](_0x2c32e5['model'],qs[_0xa6cb('0x36')](_0x337143[_0xa6cb('0x31')][_0xa6cb('0x36')]));_0xd0905a[_0xa6cb('0x35')]=_0xd0905a[_0xa6cb('0x35')][_0xa6cb('0x37')]?_0xd0905a['attributes']:_0x2c32e5[_0xa6cb('0x30')];_0xd0905a[_0xa6cb('0x39')]=qs[_0xa6cb('0x3a')](_0x337143[_0xa6cb('0x31')]['sort']);_0xd0905a[_0xa6cb('0x3b')]=qs['filters'](_[_0xa6cb('0x4c')](_0x337143[_0xa6cb('0x31')],_0x2c32e5['filters']));if(_0x337143[_0xa6cb('0x31')][_0xa6cb('0x3c')]){_0xd0905a[_0xa6cb('0x3b')]=_[_0xa6cb('0x3d')](_0xd0905a[_0xa6cb('0x3b')],{'$or':_[_0xa6cb('0x2a')](_0xd0905a['attributes'],function(_0x1e1b20){var _0x4cfa9a={};_0x4cfa9a[_0x1e1b20]={'$like':'%'+_0x337143[_0xa6cb('0x31')][_0xa6cb('0x3c')]+'%'};return _0x4cfa9a;})});}_0xd0905a=_['merge']({},_0xd0905a,_0x337143[_0xa6cb('0x3f')]);return _0x4c94f1[_0xa6cb('0x50')](_0xd0905a);}})[_0xa6cb('0x24')](function(_0x1d1bb3){if(_0x1d1bb3){_0x486ea8=_0x1d1bb3[_0xa6cb('0x37')];if(!_0x337143[_0xa6cb('0x31')][_0xa6cb('0x4e')](_0xa6cb('0x38'))){_0xd0905a[_0xa6cb('0x1d')]=qs[_0xa6cb('0x1d')](_0x337143[_0xa6cb('0x31')]['limit']);_0xd0905a[_0xa6cb('0x1b')]=qs['offset'](_0x337143[_0xa6cb('0x31')][_0xa6cb('0x1b')]);}return _0x4c94f1[_0xa6cb('0x50')](_0xd0905a);}})[_0xa6cb('0x24')](function(_0x1ae2f0){if(_0x1ae2f0){return _0x1ae2f0?{'count':_0x486ea8,'rows':_0x1ae2f0}:null;}})['then'](respondWithResult(_0x3ee02a,null))['catch'](handleError(_0x3ee02a,null));};exports['setTags']=function(_0x15483c,_0x2e2ec2,_0x4116c7){if(_0x15483c[_0xa6cb('0x48')]['id']){delete _0x15483c[_0xa6cb('0x48')]['id'];}return db[_0xa6cb('0x2b')][_0xa6cb('0x4a')]({'where':{'id':_0x15483c['params']['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x2e2ec2,null))['then'](function(_0x2e70bb){if(_0x2e70bb){return _0x2e70bb[_0xa6cb('0x52')](_0x15483c['body'][_0xa6cb('0x53')]||[]);}return null;})[_0xa6cb('0x24')](respondWithResult(_0x2e2ec2,null))['catch'](handleError(_0x2e2ec2,null));}; \ No newline at end of file +var _0x20a3=['limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','ZendeskConfiguration','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','rawAttributes','getFields','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x3415a9,_0x204e78){var _0x5f07e4=function(_0x55ed96){while(--_0x55ed96){_0x3415a9['push'](_0x3415a9['shift']());}};_0x5f07e4(++_0x204e78);}(_0x20a3,0xe8));var _0x320a=function(_0x5024c7,_0xd560bd){_0x5024c7=_0x5024c7-0x0;var _0xf2f316=_0x20a3[_0x5024c7];return _0xf2f316;};'use strict';var emlformat=require(_0x320a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x320a('0x1'));var jsonpatch=require(_0x320a('0x2'));var rp=require(_0x320a('0x3'));var moment=require(_0x320a('0x4'));var BPromise=require(_0x320a('0x5'));var Mustache=require(_0x320a('0x6'));var util=require(_0x320a('0x7'));var path=require('path');var sox=require(_0x320a('0x8'));var csv=require(_0x320a('0x9'));var ejs=require(_0x320a('0xa'));var fs=require('fs');var fs_extra=require(_0x320a('0xb'));var _=require(_0x320a('0xc'));var squel=require('squel');var crypto=require(_0x320a('0xd'));var jsforce=require(_0x320a('0xe'));var deskjs=require(_0x320a('0xf'));var toCsv=require(_0x320a('0x9'));var querystring=require('querystring');var Papa=require(_0x320a('0x10'));var Redis=require(_0x320a('0x11'));var authService=require(_0x320a('0x12'));var qs=require(_0x320a('0x13'));var as=require(_0x320a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x320a('0x15'))(_0x320a('0x16'));var utils=require(_0x320a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x320a('0x18'));var db=require(_0x320a('0x19'))['db'];function respondWithStatusCode(_0x48a162,_0x11a7e2){_0x11a7e2=_0x11a7e2||0xcc;return function(_0x4c5a7e){if(_0x4c5a7e){return _0x48a162[_0x320a('0x1a')](_0x11a7e2);}return _0x48a162[_0x320a('0x1b')](_0x11a7e2)['end']();};}function respondWithResult(_0x206a19,_0x197f38){_0x197f38=_0x197f38||0xc8;return function(_0x3fa6b5){if(_0x3fa6b5){return _0x206a19[_0x320a('0x1b')](_0x197f38)[_0x320a('0x1c')](_0x3fa6b5);}};}function respondWithFilteredResult(_0xb28e0a,_0x5e9f49){return function(_0x4b849c){if(_0x4b849c){var _0x38a408=typeof _0x5e9f49[_0x320a('0x1d')]===_0x320a('0x1e')&&typeof _0x5e9f49['limit']===_0x320a('0x1e');var _0x2c09ba=_0x4b849c[_0x320a('0x1f')];var _0x473bde=_0x38a408?0x0:_0x5e9f49['offset'];var _0x1a1d98=_0x38a408?_0x4b849c[_0x320a('0x1f')]:_0x5e9f49[_0x320a('0x1d')]+_0x5e9f49[_0x320a('0x20')];var _0x2bfdc0;if(_0x1a1d98>=_0x2c09ba){_0x1a1d98=_0x2c09ba;_0x2bfdc0=0xc8;}else{_0x2bfdc0=0xce;}_0xb28e0a[_0x320a('0x1b')](_0x2bfdc0);return _0xb28e0a[_0x320a('0x21')](_0x320a('0x22'),_0x473bde+'-'+_0x1a1d98+'/'+_0x2c09ba)[_0x320a('0x1c')](_0x4b849c);}return null;};}function patchUpdates(_0xb887ff){return function(_0x442192){try{jsonpatch[_0x320a('0x23')](_0x442192,_0xb887ff,!![]);}catch(_0x18110c){return BPromise[_0x320a('0x24')](_0x18110c);}return _0x442192['save']();};}function saveUpdates(_0x19201b,_0x2e55a4){return function(_0x3241e2){if(_0x3241e2){return _0x3241e2[_0x320a('0x25')](_0x19201b)[_0x320a('0x26')](function(_0x1223bc){return _0x1223bc;});}return null;};}function removeEntity(_0xbddb64,_0x46fc37){return function(_0x508e8c){if(_0x508e8c){return _0x508e8c[_0x320a('0x27')]()[_0x320a('0x26')](function(){_0xbddb64[_0x320a('0x1b')](0xcc)[_0x320a('0x28')]();});}};}function handleEntityNotFound(_0x2e5162,_0x563127){return function(_0x25d5de){if(!_0x25d5de){_0x2e5162[_0x320a('0x1a')](0x194);}return _0x25d5de;};}function handleError(_0x391ea3,_0x35e84f){_0x35e84f=_0x35e84f||0x1f4;return function(_0x205e90){logger[_0x320a('0x29')](_0x205e90[_0x320a('0x2a')]);if(_0x205e90[_0x320a('0x2b')]){delete _0x205e90[_0x320a('0x2b')];}_0x391ea3[_0x320a('0x1b')](_0x35e84f)['send'](_0x205e90);};}exports[_0x320a('0x2c')]=function(_0x4c592d,_0x36ce15){var _0x25c916={},_0x52da0b={},_0x3d1bd0={'count':0x0,'rows':[]};var _0x2ec74e=_[_0x320a('0x2d')](db[_0x320a('0x2e')]['rawAttributes'],function(_0x386946){return{'name':_0x386946[_0x320a('0x2f')],'type':_0x386946['type'][_0x320a('0x30')]};});_0x52da0b['model']=_[_0x320a('0x2d')](_0x2ec74e,_0x320a('0x2b'));_0x52da0b['query']=_[_0x320a('0x31')](_0x4c592d[_0x320a('0x32')]);_0x52da0b['filters']=_[_0x320a('0x33')](_0x52da0b[_0x320a('0x34')],_0x52da0b['query']);_0x25c916[_0x320a('0x35')]=_['intersection'](_0x52da0b[_0x320a('0x34')],qs[_0x320a('0x36')](_0x4c592d[_0x320a('0x32')]['fields']));_0x25c916['attributes']=_0x25c916[_0x320a('0x35')][_0x320a('0x37')]?_0x25c916[_0x320a('0x35')]:_0x52da0b[_0x320a('0x34')];if(!_0x4c592d[_0x320a('0x32')][_0x320a('0x38')](_0x320a('0x39'))){_0x25c916[_0x320a('0x20')]=qs[_0x320a('0x20')](_0x4c592d['query']['limit']);_0x25c916[_0x320a('0x1d')]=qs[_0x320a('0x1d')](_0x4c592d['query'][_0x320a('0x1d')]);}_0x25c916[_0x320a('0x3a')]=qs[_0x320a('0x3b')](_0x4c592d[_0x320a('0x32')][_0x320a('0x3b')]);_0x25c916[_0x320a('0x3c')]=qs['filters'](_[_0x320a('0x3d')](_0x4c592d['query'],_0x52da0b[_0x320a('0x3e')]),_0x2ec74e);if(_0x4c592d['query'][_0x320a('0x3f')]){_0x25c916[_0x320a('0x3c')]=_[_0x320a('0x40')](_0x25c916[_0x320a('0x3c')],{'$or':_[_0x320a('0x2d')](_0x2ec74e,function(_0x5b088d){if(_0x5b088d[_0x320a('0x41')]!==_0x320a('0x42')){var _0x1767aa={};_0x1767aa[_0x5b088d[_0x320a('0x2b')]]={'$like':'%'+_0x4c592d[_0x320a('0x32')]['filter']+'%'};return _0x1767aa;}})});}_0x25c916=_[_0x320a('0x40')]({},_0x25c916,_0x4c592d[_0x320a('0x43')]);var _0x585a97={'where':_0x25c916[_0x320a('0x3c')]};return db[_0x320a('0x2e')]['count'](_0x585a97)[_0x320a('0x26')](function(_0x7a6396){_0x3d1bd0[_0x320a('0x1f')]=_0x7a6396;if(_0x4c592d[_0x320a('0x32')]['includeAll']){_0x25c916[_0x320a('0x44')]=[{'all':!![]}];}return db[_0x320a('0x2e')][_0x320a('0x45')](_0x25c916);})[_0x320a('0x26')](function(_0x14cdc4){_0x3d1bd0[_0x320a('0x46')]=_0x14cdc4;return _0x3d1bd0;})[_0x320a('0x26')](respondWithFilteredResult(_0x36ce15,_0x25c916))[_0x320a('0x47')](handleError(_0x36ce15,null));};exports[_0x320a('0x48')]=function(_0x2f1c0c,_0x3fa98b){var _0x52a06c={'raw':![],'where':{'id':_0x2f1c0c[_0x320a('0x49')]['id']}},_0x3d8347={};_0x3d8347[_0x320a('0x34')]=_['keys'](db[_0x320a('0x2e')]['rawAttributes']);_0x3d8347[_0x320a('0x32')]=_[_0x320a('0x31')](_0x2f1c0c[_0x320a('0x32')]);_0x3d8347[_0x320a('0x3e')]=_[_0x320a('0x33')](_0x3d8347[_0x320a('0x34')],_0x3d8347[_0x320a('0x32')]);_0x52a06c['attributes']=_[_0x320a('0x33')](_0x3d8347['model'],qs[_0x320a('0x36')](_0x2f1c0c['query'][_0x320a('0x36')]));_0x52a06c['attributes']=_0x52a06c['attributes']['length']?_0x52a06c[_0x320a('0x35')]:_0x3d8347['model'];if(_0x2f1c0c['query'][_0x320a('0x4a')]){_0x52a06c['include']=[{'all':!![]}];}_0x52a06c=_[_0x320a('0x40')]({},_0x52a06c,_0x2f1c0c[_0x320a('0x43')]);return db[_0x320a('0x2e')][_0x320a('0x4b')](_0x52a06c)['then'](handleEntityNotFound(_0x3fa98b,null))[_0x320a('0x26')](respondWithResult(_0x3fa98b,null))['catch'](handleError(_0x3fa98b,null));};exports[_0x320a('0x4c')]=function(_0xd67133,_0x3c14e7){return db[_0x320a('0x2e')][_0x320a('0x4c')](_0xd67133[_0x320a('0x4d')],{})[_0x320a('0x26')](respondWithResult(_0x3c14e7,0xc9))[_0x320a('0x47')](handleError(_0x3c14e7,null));};exports[_0x320a('0x25')]=function(_0x2d1f0f,_0x5f4369){if(_0x2d1f0f['body']['id']){delete _0x2d1f0f[_0x320a('0x4d')]['id'];}return db[_0x320a('0x2e')][_0x320a('0x4b')]({'where':{'id':_0x2d1f0f[_0x320a('0x49')]['id']}})[_0x320a('0x26')](handleEntityNotFound(_0x5f4369,null))['then'](saveUpdates(_0x2d1f0f[_0x320a('0x4d')],null))[_0x320a('0x26')](respondWithResult(_0x5f4369,null))[_0x320a('0x47')](handleError(_0x5f4369,null));};exports[_0x320a('0x27')]=function(_0x4288bb,_0x518310){return db['ZendeskConfiguration'][_0x320a('0x4b')]({'where':{'id':_0x4288bb['params']['id']}})[_0x320a('0x26')](handleEntityNotFound(_0x518310,null))[_0x320a('0x26')](removeEntity(_0x518310,null))[_0x320a('0x47')](handleError(_0x518310,null));};exports['getFields']=function(_0x479938,_0x4bf6f3,_0x54e7c0){var _0x452eca={};var _0x2be80d={};var _0x3d23f2;var _0x285f66;return db[_0x320a('0x2e')][_0x320a('0x4e')]({'where':{'id':_0x479938['params']['id']}})['then'](handleEntityNotFound(_0x4bf6f3,null))[_0x320a('0x26')](function(_0x32337b){if(_0x32337b){_0x3d23f2=_0x32337b;_0x2be80d[_0x320a('0x34')]=_[_0x320a('0x31')](db['ZendeskField'][_0x320a('0x4f')]);_0x2be80d[_0x320a('0x32')]=_[_0x320a('0x31')](_0x479938[_0x320a('0x32')]);_0x2be80d['filters']=_[_0x320a('0x33')](_0x2be80d['model'],_0x2be80d[_0x320a('0x32')]);_0x452eca['attributes']=_['intersection'](_0x2be80d[_0x320a('0x34')],qs[_0x320a('0x36')](_0x479938[_0x320a('0x32')]['fields']));_0x452eca[_0x320a('0x35')]=_0x452eca[_0x320a('0x35')]['length']?_0x452eca[_0x320a('0x35')]:_0x2be80d[_0x320a('0x34')];_0x452eca[_0x320a('0x3a')]=qs['sort'](_0x479938[_0x320a('0x32')][_0x320a('0x3b')]);_0x452eca[_0x320a('0x3c')]=qs[_0x320a('0x3e')](_['pick'](_0x479938[_0x320a('0x32')],_0x2be80d[_0x320a('0x3e')]));if(_0x479938['query'][_0x320a('0x3f')]){_0x452eca[_0x320a('0x3c')]=_[_0x320a('0x40')](_0x452eca[_0x320a('0x3c')],{'$or':_[_0x320a('0x2d')](_0x452eca[_0x320a('0x35')],function(_0x5e2f56){var _0xce10ba={};_0xce10ba[_0x5e2f56]={'$like':'%'+_0x479938[_0x320a('0x32')][_0x320a('0x3f')]+'%'};return _0xce10ba;})});}_0x452eca=_[_0x320a('0x40')]({},_0x452eca,_0x479938[_0x320a('0x43')]);return _0x3d23f2['getFields'](_0x452eca);}})['then'](function(_0x5be120){if(_0x5be120){_0x285f66=_0x5be120[_0x320a('0x37')];if(!_0x479938[_0x320a('0x32')]['hasOwnProperty']('nolimit')){_0x452eca[_0x320a('0x20')]=qs['limit'](_0x479938[_0x320a('0x32')][_0x320a('0x20')]);_0x452eca[_0x320a('0x1d')]=qs[_0x320a('0x1d')](_0x479938[_0x320a('0x32')][_0x320a('0x1d')]);}return _0x3d23f2[_0x320a('0x50')](_0x452eca);}})[_0x320a('0x26')](function(_0x1da4c9){if(_0x1da4c9){return _0x1da4c9?{'count':_0x285f66,'rows':_0x1da4c9}:null;}})[_0x320a('0x26')](respondWithResult(_0x4bf6f3,null))[_0x320a('0x47')](handleError(_0x4bf6f3,null));};exports[_0x320a('0x51')]=function(_0x511f42,_0x445b13,_0x59fb1b){var _0x5502c4={};var _0x297e4c={};var _0x2632b1;var _0x31f6b0;return db[_0x320a('0x2e')][_0x320a('0x4e')]({'where':{'id':_0x511f42[_0x320a('0x49')]['id']}})[_0x320a('0x26')](handleEntityNotFound(_0x445b13,null))[_0x320a('0x26')](function(_0x3b4272){if(_0x3b4272){_0x2632b1=_0x3b4272;_0x297e4c[_0x320a('0x34')]=_[_0x320a('0x31')](db[_0x320a('0x52')][_0x320a('0x4f')]);_0x297e4c[_0x320a('0x32')]=_[_0x320a('0x31')](_0x511f42['query']);_0x297e4c[_0x320a('0x3e')]=_[_0x320a('0x33')](_0x297e4c['model'],_0x297e4c['query']);_0x5502c4[_0x320a('0x35')]=_[_0x320a('0x33')](_0x297e4c[_0x320a('0x34')],qs[_0x320a('0x36')](_0x511f42[_0x320a('0x32')][_0x320a('0x36')]));_0x5502c4['attributes']=_0x5502c4[_0x320a('0x35')][_0x320a('0x37')]?_0x5502c4[_0x320a('0x35')]:_0x297e4c[_0x320a('0x34')];_0x5502c4[_0x320a('0x3a')]=qs[_0x320a('0x3b')](_0x511f42['query']['sort']);_0x5502c4[_0x320a('0x3c')]=qs[_0x320a('0x3e')](_['pick'](_0x511f42[_0x320a('0x32')],_0x297e4c[_0x320a('0x3e')]));if(_0x511f42['query']['filter']){_0x5502c4['where']=_[_0x320a('0x40')](_0x5502c4[_0x320a('0x3c')],{'$or':_[_0x320a('0x2d')](_0x5502c4[_0x320a('0x35')],function(_0x4f4b16){var _0x1655fe={};_0x1655fe[_0x4f4b16]={'$like':'%'+_0x511f42[_0x320a('0x32')][_0x320a('0x3f')]+'%'};return _0x1655fe;})});}_0x5502c4=_['merge']({},_0x5502c4,_0x511f42[_0x320a('0x43')]);return _0x2632b1[_0x320a('0x51')](_0x5502c4);}})[_0x320a('0x26')](function(_0xd55963){if(_0xd55963){_0x31f6b0=_0xd55963[_0x320a('0x37')];if(!_0x511f42[_0x320a('0x32')][_0x320a('0x38')]('nolimit')){_0x5502c4[_0x320a('0x20')]=qs[_0x320a('0x20')](_0x511f42[_0x320a('0x32')][_0x320a('0x20')]);_0x5502c4[_0x320a('0x1d')]=qs[_0x320a('0x1d')](_0x511f42[_0x320a('0x32')][_0x320a('0x1d')]);}return _0x2632b1['getSubjects'](_0x5502c4);}})[_0x320a('0x26')](function(_0x423108){if(_0x423108){return _0x423108?{'count':_0x31f6b0,'rows':_0x423108}:null;}})[_0x320a('0x26')](respondWithResult(_0x445b13,null))[_0x320a('0x47')](handleError(_0x445b13,null));};exports[_0x320a('0x53')]=function(_0x4ff695,_0x15c74c,_0xa72a53){var _0x2e4fbc={};var _0x1ac5ac={};var _0x4886e1;var _0x3fc747;return db[_0x320a('0x2e')][_0x320a('0x4e')]({'where':{'id':_0x4ff695[_0x320a('0x49')]['id']}})[_0x320a('0x26')](handleEntityNotFound(_0x15c74c,null))[_0x320a('0x26')](function(_0x33c27d){if(_0x33c27d){_0x4886e1=_0x33c27d;_0x1ac5ac[_0x320a('0x34')]=_[_0x320a('0x31')](db[_0x320a('0x52')]['rawAttributes']);_0x1ac5ac['query']=_['keys'](_0x4ff695[_0x320a('0x32')]);_0x1ac5ac[_0x320a('0x3e')]=_[_0x320a('0x33')](_0x1ac5ac['model'],_0x1ac5ac[_0x320a('0x32')]);_0x2e4fbc[_0x320a('0x35')]=_['intersection'](_0x1ac5ac[_0x320a('0x34')],qs[_0x320a('0x36')](_0x4ff695[_0x320a('0x32')][_0x320a('0x36')]));_0x2e4fbc[_0x320a('0x35')]=_0x2e4fbc[_0x320a('0x35')][_0x320a('0x37')]?_0x2e4fbc[_0x320a('0x35')]:_0x1ac5ac[_0x320a('0x34')];_0x2e4fbc[_0x320a('0x3a')]=qs[_0x320a('0x3b')](_0x4ff695['query'][_0x320a('0x3b')]);_0x2e4fbc[_0x320a('0x3c')]=qs[_0x320a('0x3e')](_[_0x320a('0x3d')](_0x4ff695['query'],_0x1ac5ac[_0x320a('0x3e')]));if(_0x4ff695[_0x320a('0x32')][_0x320a('0x3f')]){_0x2e4fbc['where']=_['merge'](_0x2e4fbc[_0x320a('0x3c')],{'$or':_[_0x320a('0x2d')](_0x2e4fbc[_0x320a('0x35')],function(_0x2ced77){var _0x28e0b8={};_0x28e0b8[_0x2ced77]={'$like':'%'+_0x4ff695[_0x320a('0x32')][_0x320a('0x3f')]+'%'};return _0x28e0b8;})});}_0x2e4fbc=_[_0x320a('0x40')]({},_0x2e4fbc,_0x4ff695['options']);return _0x4886e1[_0x320a('0x53')](_0x2e4fbc);}})['then'](function(_0x1e5116){if(_0x1e5116){_0x3fc747=_0x1e5116['length'];if(!_0x4ff695[_0x320a('0x32')]['hasOwnProperty'](_0x320a('0x39'))){_0x2e4fbc[_0x320a('0x20')]=qs['limit'](_0x4ff695[_0x320a('0x32')]['limit']);_0x2e4fbc['offset']=qs[_0x320a('0x1d')](_0x4ff695[_0x320a('0x32')]['offset']);}return _0x4886e1[_0x320a('0x53')](_0x2e4fbc);}})[_0x320a('0x26')](function(_0x15d9ec){if(_0x15d9ec){return _0x15d9ec?{'count':_0x3fc747,'rows':_0x15d9ec}:null;}})[_0x320a('0x26')](respondWithResult(_0x15c74c,null))[_0x320a('0x47')](handleError(_0x15c74c,null));};exports[_0x320a('0x54')]=function(_0x5bfab1,_0x307231,_0x5918c5){var _0x2dfde8={};var _0x3b98d4={};var _0x48cb34;var _0x5177aa;return db[_0x320a('0x2e')][_0x320a('0x4e')]({'where':{'id':_0x5bfab1[_0x320a('0x49')]['id']}})[_0x320a('0x26')](handleEntityNotFound(_0x307231,null))[_0x320a('0x26')](function(_0x46c977){if(_0x46c977){_0x48cb34=_0x46c977;_0x3b98d4[_0x320a('0x34')]=_[_0x320a('0x31')](db[_0x320a('0x55')][_0x320a('0x4f')]);_0x3b98d4[_0x320a('0x32')]=_[_0x320a('0x31')](_0x5bfab1[_0x320a('0x32')]);_0x3b98d4[_0x320a('0x3e')]=_[_0x320a('0x33')](_0x3b98d4['model'],_0x3b98d4[_0x320a('0x32')]);_0x2dfde8[_0x320a('0x35')]=_[_0x320a('0x33')](_0x3b98d4[_0x320a('0x34')],qs[_0x320a('0x36')](_0x5bfab1[_0x320a('0x32')]['fields']));_0x2dfde8[_0x320a('0x35')]=_0x2dfde8['attributes'][_0x320a('0x37')]?_0x2dfde8['attributes']:_0x3b98d4[_0x320a('0x34')];_0x2dfde8[_0x320a('0x3a')]=qs[_0x320a('0x3b')](_0x5bfab1[_0x320a('0x32')][_0x320a('0x3b')]);_0x2dfde8['where']=qs['filters'](_['pick'](_0x5bfab1[_0x320a('0x32')],_0x3b98d4[_0x320a('0x3e')]));if(_0x5bfab1[_0x320a('0x32')][_0x320a('0x3f')]){_0x2dfde8[_0x320a('0x3c')]=_[_0x320a('0x40')](_0x2dfde8[_0x320a('0x3c')],{'$or':_[_0x320a('0x2d')](_0x2dfde8[_0x320a('0x35')],function(_0x433abf){var _0x5996a4={};_0x5996a4[_0x433abf]={'$like':'%'+_0x5bfab1[_0x320a('0x32')][_0x320a('0x3f')]+'%'};return _0x5996a4;})});}_0x2dfde8=_[_0x320a('0x40')]({},_0x2dfde8,_0x5bfab1[_0x320a('0x43')]);return _0x48cb34[_0x320a('0x54')](_0x2dfde8);}})['then'](function(_0x2ddb31){if(_0x2ddb31){_0x5177aa=_0x2ddb31['length'];if(!_0x5bfab1[_0x320a('0x32')][_0x320a('0x38')](_0x320a('0x39'))){_0x2dfde8['limit']=qs[_0x320a('0x20')](_0x5bfab1[_0x320a('0x32')][_0x320a('0x20')]);_0x2dfde8['offset']=qs[_0x320a('0x1d')](_0x5bfab1[_0x320a('0x32')][_0x320a('0x1d')]);}return _0x48cb34[_0x320a('0x54')](_0x2dfde8);}})[_0x320a('0x26')](function(_0x403def){if(_0x403def){return _0x403def?{'count':_0x5177aa,'rows':_0x403def}:null;}})[_0x320a('0x26')](respondWithResult(_0x307231,null))[_0x320a('0x47')](handleError(_0x307231,null));};exports[_0x320a('0x56')]=function(_0x14c2d1,_0x4c06c8,_0x2b6948){if(_0x14c2d1[_0x320a('0x4d')]['id']){delete _0x14c2d1[_0x320a('0x4d')]['id'];}return db['ZendeskConfiguration'][_0x320a('0x4e')]({'where':{'id':_0x14c2d1[_0x320a('0x49')]['id']}})[_0x320a('0x26')](handleEntityNotFound(_0x4c06c8,null))['then'](function(_0x101336){if(_0x101336){return _0x101336[_0x320a('0x56')](_0x14c2d1['body'][_0x320a('0x57')]||[]);}return null;})[_0x320a('0x26')](respondWithResult(_0x4c06c8,null))[_0x320a('0x47')](handleError(_0x4c06c8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 505dfb6..27987a6 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 _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x1e12ce,_0x51ebbc){var _0x194a5d=function(_0x11b10f){while(--_0x11b10f){_0x1e12ce['push'](_0x1e12ce['shift']());}};_0x194a5d(++_0x51ebbc);}(_0x14a0,0x8e));var _0x014a=function(_0xa066f8,_0x4636af){_0xa066f8=_0xa066f8-0x0;var _0x2b5cb8=_0x14a0[_0xa066f8];return _0x2b5cb8;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97c1=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x209261,_0xcd6594){var _0x95b361=function(_0x2e15e7){while(--_0x2e15e7){_0x209261['push'](_0x209261['shift']());}};_0x95b361(++_0xcd6594);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var logger=require('../../config/logger')(_0x197c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x197c('0x3'));var fs=require('fs');var path=require(_0x197c('0x4'));var rimraf=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var attributes=require(_0x197c('0x7'));module['exports']=function(_0x5cbff6,_0x1cb6e1){return _0x5cbff6[_0x197c('0x8')](_0x197c('0x9'),attributes,{'tableName':_0x197c('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 c0775fc..bd80a17 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 _0x2a5c=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4858ec,_0x5f3b82){var _0x2c06b3=function(_0x550cf7){while(--_0x550cf7){_0x4858ec['push'](_0x4858ec['shift']());}};_0x2c06b3(++_0x5f3b82);}(_0x2a5c,0x11d));var _0xc2a5=function(_0x534313,_0x1a52aa){_0x534313=_0x534313-0x0;var _0x43ffae=_0x2a5c[_0x534313];return _0x43ffae;};'use strict';var _=require(_0xc2a5('0x0'));var util=require(_0xc2a5('0x1'));var moment=require('moment');var BPromise=require(_0xc2a5('0x2'));var rs=require(_0xc2a5('0x3'));var fs=require('fs');var Redis=require(_0xc2a5('0x4'));var db=require(_0xc2a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2a5('0x6'))(_0xc2a5('0x7'));var config=require(_0xc2a5('0x8'));var jayson=require(_0xc2a5('0x9'));var client=jayson[_0xc2a5('0xa')][_0xc2a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x813a45,_0x244ab3,_0x11ac44){return new BPromise(function(_0x30b10d,_0x1d26d2){return client[_0xc2a5('0xc')](_0x813a45,_0x11ac44)[_0xc2a5('0xd')](function(_0x516b60){logger['info'](_0xc2a5('0xe'),_0x244ab3,_0xc2a5('0xf'));logger[_0xc2a5('0x10')](_0xc2a5('0x11'),_0x244ab3,_0xc2a5('0xf'),JSON['stringify'](_0x516b60));if(_0x516b60[_0xc2a5('0x12')]){if(_0x516b60[_0xc2a5('0x12')][_0xc2a5('0x13')]===0x1f4){logger[_0xc2a5('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x244ab3,_0x516b60['error']['message']);return _0x1d26d2(_0x516b60[_0xc2a5('0x12')][_0xc2a5('0x14')]);}logger[_0xc2a5('0x12')](_0xc2a5('0xe'),_0x244ab3,_0x516b60[_0xc2a5('0x12')][_0xc2a5('0x14')]);return _0x30b10d(_0x516b60['error']['message']);}else{logger['info'](_0xc2a5('0xe'),_0x244ab3,_0xc2a5('0xf'));_0x30b10d(_0x516b60[_0xc2a5('0x15')][_0xc2a5('0x14')]);}})[_0xc2a5('0x16')](function(_0x45c167){logger['error'](_0xc2a5('0xe'),_0x244ab3,_0x45c167);_0x1d26d2(_0x45c167);});});} \ No newline at end of file +var _0x5fc5=['then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x5fc5,0x120));var _0x55fc=function(_0x456fe6,_0x2114c3){_0x456fe6=_0x456fe6-0x0;var _0x539405=_0x5fc5[_0x456fe6];return _0x539405;};'use strict';var _=require('lodash');var util=require(_0x55fc('0x0'));var moment=require(_0x55fc('0x1'));var BPromise=require(_0x55fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55fc('0x3'));var db=require(_0x55fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x55fc('0x5'))(_0x55fc('0x6'));var config=require(_0x55fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x55fc('0x8')][_0x55fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59bbe2,_0x31e67a,_0x4f4d7d){return new BPromise(function(_0x50c29d,_0x18556d){return client[_0x55fc('0xa')](_0x59bbe2,_0x4f4d7d)[_0x55fc('0xb')](function(_0x42ebe5){logger[_0x55fc('0xc')](_0x55fc('0xd'),_0x31e67a,'request\x20sent');logger[_0x55fc('0xe')](_0x55fc('0xf'),_0x31e67a,'request\x20sent',JSON[_0x55fc('0x10')](_0x42ebe5));if(_0x42ebe5[_0x55fc('0x11')]){if(_0x42ebe5['error'][_0x55fc('0x12')]===0x1f4){logger['error'](_0x55fc('0xd'),_0x31e67a,_0x42ebe5['error'][_0x55fc('0x13')]);return _0x18556d(_0x42ebe5[_0x55fc('0x11')][_0x55fc('0x13')]);}logger[_0x55fc('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x31e67a,_0x42ebe5[_0x55fc('0x11')]['message']);return _0x50c29d(_0x42ebe5['error'][_0x55fc('0x13')]);}else{logger['info'](_0x55fc('0xd'),_0x31e67a,_0x55fc('0x14'));_0x50c29d(_0x42ebe5[_0x55fc('0x15')]['message']);}})[_0x55fc('0x16')](function(_0x39b1a2){logger[_0x55fc('0x11')](_0x55fc('0xd'),_0x31e67a,_0x39b1a2);_0x18556d(_0x39b1a2);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 985b54d..3cfdc8f 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 _0xbb94=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer'];(function(_0x283d2c,_0x2dca59){var _0x29d45f=function(_0x4c695a){while(--_0x4c695a){_0x283d2c['push'](_0x283d2c['shift']());}};_0x29d45f(++_0x2dca59);}(_0xbb94,0x1bf));var _0x4bb9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbb94[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x4bb9('0x0'));var util=require(_0x4bb9('0x1'));var path=require(_0x4bb9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4bb9('0x3'));var auth=require(_0x4bb9('0x4'));var interaction=require(_0x4bb9('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x4bb9('0x6')]('/',auth[_0x4bb9('0x7')](),controller[_0x4bb9('0x8')]);router[_0x4bb9('0x6')](_0x4bb9('0x9'),auth[_0x4bb9('0x7')](),controller[_0x4bb9('0xa')]);router[_0x4bb9('0xb')]('/',auth[_0x4bb9('0x7')](),controller['create']);router[_0x4bb9('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4bb9('0xd')](_0x4bb9('0x9'),auth[_0x4bb9('0x7')](),controller[_0x4bb9('0xe')]);module[_0x4bb9('0xf')]=router; \ No newline at end of file +var _0x7f58=['create','put','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x40310b,_0x2db179){var _0x1e67f3=function(_0x343f88){while(--_0x343f88){_0x40310b['push'](_0x40310b['shift']());}};_0x1e67f3(++_0x2db179);}(_0x7f58,0x15a));var _0x87f5=function(_0x16e248,_0x3acc80){_0x16e248=_0x16e248-0x0;var _0x107821=_0x7f58[_0x16e248];return _0x107821;};'use strict';var multer=require('multer');var util=require(_0x87f5('0x0'));var path=require(_0x87f5('0x1'));var timeout=require(_0x87f5('0x2'));var express=require(_0x87f5('0x3'));var router=express[_0x87f5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x87f5('0x5'));var interaction=require(_0x87f5('0x6'));var config=require(_0x87f5('0x7'));var controller=require(_0x87f5('0x8'));router[_0x87f5('0x9')]('/',auth[_0x87f5('0xa')](),controller[_0x87f5('0xb')]);router[_0x87f5('0x9')](_0x87f5('0xc'),auth[_0x87f5('0xa')](),controller[_0x87f5('0xd')]);router['post']('/',auth[_0x87f5('0xa')](),controller[_0x87f5('0xe')]);router[_0x87f5('0xf')](_0x87f5('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x87f5('0xa')](),controller[_0x87f5('0x10')]);module[_0x87f5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 3f0f91d..4373517 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 _0x774a=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x774a,0xa5));var _0xa774=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x774a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa774('0x0'));module[_0xa774('0x1')]={'type':{'type':Sequelize[_0xa774('0x2')](_0xa774('0x3'),_0xa774('0x4'),_0xa774('0x5'),_0xa774('0x6'),_0xa774('0x7')),'defaultValue':_0xa774('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa774('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xa774('0x3'),_0xa774('0x4'),_0xa774('0x5'))},'keyContent':{'type':Sequelize[_0xa774('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa774('0x8')]}}; \ No newline at end of file +var _0x58b7=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x58b7,0x9e));var _0x758b=function(_0x13b19e,_0x19f04){_0x13b19e=_0x13b19e-0x0;var _0x4dc666=_0x58b7[_0x13b19e];return _0x4dc666;};'use strict';var Sequelize=require(_0x758b('0x0'));module[_0x758b('0x1')]={'type':{'type':Sequelize[_0x758b('0x2')](_0x758b('0x3'),_0x758b('0x4'),_0x758b('0x5'),_0x758b('0x6'),_0x758b('0x7')),'defaultValue':_0x758b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x758b('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x758b('0x3'),_0x758b('0x4'),_0x758b('0x5'))},'keyContent':{'type':Sequelize[_0x758b('0x8')]},'idField':{'type':Sequelize[_0x758b('0x8')]},'nameField':{'type':Sequelize[_0x758b('0x8')]},'customField':{'type':Sequelize[_0x758b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 9cb0483..075bb3d 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 _0x111b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','send','map','ZendeskField','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x1c0cc1,_0x44c536){var _0x230b93=function(_0x55f56d){while(--_0x55f56d){_0x1c0cc1['push'](_0x1c0cc1['shift']());}};_0x230b93(++_0x44c536);}(_0x111b,0x8c));var _0xb111=function(_0x13b4d4,_0x4478c0){_0x13b4d4=_0x13b4d4-0x0;var _0x111749=_0x111b[_0x13b4d4];return _0x111749;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb111('0x0'));var zipdir=require(_0xb111('0x1'));var jsonpatch=require(_0xb111('0x2'));var rp=require(_0xb111('0x3'));var moment=require(_0xb111('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb111('0x5'));var util=require(_0xb111('0x6'));var path=require(_0xb111('0x7'));var sox=require(_0xb111('0x8'));var csv=require(_0xb111('0x9'));var ejs=require(_0xb111('0xa'));var fs=require('fs');var fs_extra=require(_0xb111('0xb'));var _=require(_0xb111('0xc'));var squel=require(_0xb111('0xd'));var crypto=require(_0xb111('0xe'));var jsforce=require(_0xb111('0xf'));var deskjs=require(_0xb111('0x10'));var toCsv=require(_0xb111('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb111('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb111('0x12'));var as=require(_0xb111('0x13'));var hardwareService=require(_0xb111('0x14'));var logger=require(_0xb111('0x15'))('api');var utils=require(_0xb111('0x16'));var config=require(_0xb111('0x17'));var licenseUtil=require(_0xb111('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x96781a,_0x4f7fe8){_0x4f7fe8=_0x4f7fe8||0xcc;return function(_0x35432e){if(_0x35432e){return _0x96781a['sendStatus'](_0x4f7fe8);}return _0x96781a[_0xb111('0x19')](_0x4f7fe8)['end']();};}function respondWithResult(_0x14f9ee,_0x2ac136){_0x2ac136=_0x2ac136||0xc8;return function(_0x7a9d33){if(_0x7a9d33){return _0x14f9ee[_0xb111('0x19')](_0x2ac136)[_0xb111('0x1a')](_0x7a9d33);}};}function respondWithFilteredResult(_0xf2e568,_0x58fd1a){return function(_0x51753e){if(_0x51753e){var _0x1e2d2b=typeof _0x58fd1a['offset']==='undefined'&&typeof _0x58fd1a['limit']===_0xb111('0x1b');var _0x4ebf87=_0x51753e[_0xb111('0x1c')];var _0x4821d8=_0x1e2d2b?0x0:_0x58fd1a[_0xb111('0x1d')];var _0x34085c=_0x1e2d2b?_0x51753e['count']:_0x58fd1a[_0xb111('0x1d')]+_0x58fd1a[_0xb111('0x1e')];var _0x175a3e;if(_0x34085c>=_0x4ebf87){_0x34085c=_0x4ebf87;_0x175a3e=0xc8;}else{_0x175a3e=0xce;}_0xf2e568[_0xb111('0x19')](_0x175a3e);return _0xf2e568[_0xb111('0x1f')](_0xb111('0x20'),_0x4821d8+'-'+_0x34085c+'/'+_0x4ebf87)[_0xb111('0x1a')](_0x51753e);}return null;};}function patchUpdates(_0x49cea1){return function(_0x77adec){try{jsonpatch[_0xb111('0x21')](_0x77adec,_0x49cea1,!![]);}catch(_0x106312){return BPromise['reject'](_0x106312);}return _0x77adec[_0xb111('0x22')]();};}function saveUpdates(_0x190c42,_0x3a169c){return function(_0x10f341){if(_0x10f341){return _0x10f341['update'](_0x190c42)[_0xb111('0x23')](function(_0x4f177d){return _0x4f177d;});}return null;};}function removeEntity(_0x45b061,_0x1760fd){return function(_0x36e559){if(_0x36e559){return _0x36e559[_0xb111('0x24')]()[_0xb111('0x23')](function(){_0x45b061['status'](0xcc)[_0xb111('0x25')]();});}};}function handleEntityNotFound(_0x404a28,_0x4802bf){return function(_0x57a2ac){if(!_0x57a2ac){_0x404a28[_0xb111('0x26')](0x194);}return _0x57a2ac;};}function handleError(_0x48d823,_0x452a92){_0x452a92=_0x452a92||0x1f4;return function(_0x3247d6){logger[_0xb111('0x27')](_0x3247d6[_0xb111('0x28')]);if(_0x3247d6[_0xb111('0x29')]){delete _0x3247d6[_0xb111('0x29')];}_0x48d823['status'](_0x452a92)[_0xb111('0x2a')](_0x3247d6);};}exports['index']=function(_0x282093,_0x51b73f){var _0x207627={},_0x5b5f80={},_0x9c8d0={'count':0x0,'rows':[]};var _0x2a5072=_[_0xb111('0x2b')](db[_0xb111('0x2c')][_0xb111('0x2d')],function(_0x14fd40){return{'name':_0x14fd40['fieldName'],'type':_0x14fd40['type'][_0xb111('0x2e')]};});_0x5b5f80[_0xb111('0x2f')]=_[_0xb111('0x2b')](_0x2a5072,_0xb111('0x29'));_0x5b5f80[_0xb111('0x30')]=_[_0xb111('0x31')](_0x282093[_0xb111('0x30')]);_0x5b5f80[_0xb111('0x32')]=_[_0xb111('0x33')](_0x5b5f80[_0xb111('0x2f')],_0x5b5f80[_0xb111('0x30')]);_0x207627['attributes']=_[_0xb111('0x33')](_0x5b5f80[_0xb111('0x2f')],qs[_0xb111('0x34')](_0x282093[_0xb111('0x30')]['fields']));_0x207627['attributes']=_0x207627[_0xb111('0x35')][_0xb111('0x36')]?_0x207627[_0xb111('0x35')]:_0x5b5f80['model'];if(!_0x282093[_0xb111('0x30')][_0xb111('0x37')](_0xb111('0x38'))){_0x207627[_0xb111('0x1e')]=qs[_0xb111('0x1e')](_0x282093[_0xb111('0x30')][_0xb111('0x1e')]);_0x207627[_0xb111('0x1d')]=qs['offset'](_0x282093[_0xb111('0x30')][_0xb111('0x1d')]);}_0x207627['order']=qs['sort'](_0x282093[_0xb111('0x30')][_0xb111('0x39')]);_0x207627[_0xb111('0x3a')]=qs[_0xb111('0x32')](_['pick'](_0x282093[_0xb111('0x30')],_0x5b5f80['filters']),_0x2a5072);if(_0x282093[_0xb111('0x30')][_0xb111('0x3b')]){_0x207627['where']=_['merge'](_0x207627['where'],{'$or':_['map'](_0x2a5072,function(_0x12b80d){if(_0x12b80d[_0xb111('0x3c')]!=='VIRTUAL'){var _0x57e317={};_0x57e317[_0x12b80d[_0xb111('0x29')]]={'$like':'%'+_0x282093['query'][_0xb111('0x3b')]+'%'};return _0x57e317;}})});}_0x207627=_[_0xb111('0x3d')]({},_0x207627,_0x282093[_0xb111('0x3e')]);var _0x5f490a={'where':_0x207627[_0xb111('0x3a')]};return db[_0xb111('0x2c')]['count'](_0x5f490a)['then'](function(_0x61b73c){_0x9c8d0['count']=_0x61b73c;if(_0x282093[_0xb111('0x30')][_0xb111('0x3f')]){_0x207627['include']=[{'all':!![]}];}return db[_0xb111('0x2c')][_0xb111('0x40')](_0x207627);})[_0xb111('0x23')](function(_0x4b86da){_0x9c8d0[_0xb111('0x41')]=_0x4b86da;return _0x9c8d0;})[_0xb111('0x23')](respondWithFilteredResult(_0x51b73f,_0x207627))[_0xb111('0x42')](handleError(_0x51b73f,null));};exports[_0xb111('0x43')]=function(_0x31d4ff,_0x22b1c5){var _0xfd5f7={'raw':!![],'where':{'id':_0x31d4ff[_0xb111('0x44')]['id']}},_0x405f7b={};_0x405f7b[_0xb111('0x2f')]=_[_0xb111('0x31')](db[_0xb111('0x2c')][_0xb111('0x2d')]);_0x405f7b[_0xb111('0x30')]=_[_0xb111('0x31')](_0x31d4ff[_0xb111('0x30')]);_0x405f7b[_0xb111('0x32')]=_['intersection'](_0x405f7b[_0xb111('0x2f')],_0x405f7b[_0xb111('0x30')]);_0xfd5f7[_0xb111('0x35')]=_[_0xb111('0x33')](_0x405f7b[_0xb111('0x2f')],qs[_0xb111('0x34')](_0x31d4ff[_0xb111('0x30')]['fields']));_0xfd5f7[_0xb111('0x35')]=_0xfd5f7[_0xb111('0x35')]['length']?_0xfd5f7[_0xb111('0x35')]:_0x405f7b['model'];if(_0x31d4ff[_0xb111('0x30')][_0xb111('0x3f')]){_0xfd5f7[_0xb111('0x45')]=[{'all':!![]}];}_0xfd5f7=_[_0xb111('0x3d')]({},_0xfd5f7,_0x31d4ff[_0xb111('0x3e')]);return db['ZendeskField'][_0xb111('0x46')](_0xfd5f7)[_0xb111('0x23')](handleEntityNotFound(_0x22b1c5,null))[_0xb111('0x23')](respondWithResult(_0x22b1c5,null))[_0xb111('0x42')](handleError(_0x22b1c5,null));};exports['create']=function(_0x1ac632,_0x363dbe){return db[_0xb111('0x2c')][_0xb111('0x47')](_0x1ac632[_0xb111('0x48')],{})[_0xb111('0x23')](respondWithResult(_0x363dbe,0xc9))[_0xb111('0x42')](handleError(_0x363dbe,null));};exports['update']=function(_0x3d313a,_0x50c81d){if(_0x3d313a[_0xb111('0x48')]['id']){delete _0x3d313a[_0xb111('0x48')]['id'];}return db[_0xb111('0x2c')][_0xb111('0x46')]({'where':{'id':_0x3d313a[_0xb111('0x44')]['id']}})[_0xb111('0x23')](handleEntityNotFound(_0x50c81d,null))[_0xb111('0x23')](saveUpdates(_0x3d313a['body'],null))[_0xb111('0x23')](respondWithResult(_0x50c81d,null))[_0xb111('0x42')](handleError(_0x50c81d,null));};exports[_0xb111('0x24')]=function(_0x2409c7,_0xfbc61c){return db['ZendeskField']['find']({'where':{'id':_0x2409c7[_0xb111('0x44')]['id']}})[_0xb111('0x23')](handleEntityNotFound(_0xfbc61c,null))[_0xb111('0x23')](removeEntity(_0xfbc61c,null))[_0xb111('0x42')](handleError(_0xfbc61c,null));}; \ No newline at end of file +var _0x8b98=['keys','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params'];(function(_0x45fa94,_0x18413b){var _0x3ebe17=function(_0x2336da){while(--_0x2336da){_0x45fa94['push'](_0x45fa94['shift']());}};_0x3ebe17(++_0x18413b);}(_0x8b98,0xe6));var _0x88b9=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8b98[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x88b9('0x0'));var rimraf=require(_0x88b9('0x1'));var zipdir=require(_0x88b9('0x2'));var jsonpatch=require(_0x88b9('0x3'));var rp=require('request-promise');var moment=require(_0x88b9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x88b9('0x5'));var sox=require(_0x88b9('0x6'));var csv=require(_0x88b9('0x7'));var ejs=require(_0x88b9('0x8'));var fs=require('fs');var fs_extra=require(_0x88b9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x88b9('0xa'));var jsforce=require(_0x88b9('0xb'));var deskjs=require(_0x88b9('0xc'));var toCsv=require(_0x88b9('0x7'));var querystring=require(_0x88b9('0xd'));var Papa=require(_0x88b9('0xe'));var Redis=require(_0x88b9('0xf'));var authService=require(_0x88b9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x88b9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88b9('0x12'))(_0x88b9('0x13'));var utils=require(_0x88b9('0x14'));var config=require(_0x88b9('0x15'));var licenseUtil=require(_0x88b9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x559fe7,_0x2fa31a){_0x2fa31a=_0x2fa31a||0xcc;return function(_0x24a1f9){if(_0x24a1f9){return _0x559fe7[_0x88b9('0x17')](_0x2fa31a);}return _0x559fe7[_0x88b9('0x18')](_0x2fa31a)[_0x88b9('0x19')]();};}function respondWithResult(_0x109792,_0x1e5992){_0x1e5992=_0x1e5992||0xc8;return function(_0x570e5f){if(_0x570e5f){return _0x109792[_0x88b9('0x18')](_0x1e5992)[_0x88b9('0x1a')](_0x570e5f);}};}function respondWithFilteredResult(_0x1afe7e,_0x58cb3c){return function(_0x2a3d00){if(_0x2a3d00){var _0x1faa12=typeof _0x58cb3c[_0x88b9('0x1b')]==='undefined'&&typeof _0x58cb3c[_0x88b9('0x1c')]===_0x88b9('0x1d');var _0xae8e1c=_0x2a3d00[_0x88b9('0x1e')];var _0x38d190=_0x1faa12?0x0:_0x58cb3c[_0x88b9('0x1b')];var _0x4eda48=_0x1faa12?_0x2a3d00[_0x88b9('0x1e')]:_0x58cb3c[_0x88b9('0x1b')]+_0x58cb3c[_0x88b9('0x1c')];var _0x294f75;if(_0x4eda48>=_0xae8e1c){_0x4eda48=_0xae8e1c;_0x294f75=0xc8;}else{_0x294f75=0xce;}_0x1afe7e[_0x88b9('0x18')](_0x294f75);return _0x1afe7e[_0x88b9('0x1f')](_0x88b9('0x20'),_0x38d190+'-'+_0x4eda48+'/'+_0xae8e1c)[_0x88b9('0x1a')](_0x2a3d00);}return null;};}function patchUpdates(_0x4beb0f){return function(_0x5c4060){try{jsonpatch[_0x88b9('0x21')](_0x5c4060,_0x4beb0f,!![]);}catch(_0x3f9f2b){return BPromise[_0x88b9('0x22')](_0x3f9f2b);}return _0x5c4060['save']();};}function saveUpdates(_0x3ee08e,_0x8b5b54){return function(_0x20de4f){if(_0x20de4f){return _0x20de4f[_0x88b9('0x23')](_0x3ee08e)[_0x88b9('0x24')](function(_0x53625a){return _0x53625a;});}return null;};}function removeEntity(_0x407926,_0x14f986){return function(_0x3a4707){if(_0x3a4707){return _0x3a4707[_0x88b9('0x25')]()[_0x88b9('0x24')](function(){_0x407926[_0x88b9('0x18')](0xcc)[_0x88b9('0x19')]();});}};}function handleEntityNotFound(_0x1ed16c,_0x11904c){return function(_0x11cc46){if(!_0x11cc46){_0x1ed16c[_0x88b9('0x17')](0x194);}return _0x11cc46;};}function handleError(_0x371b6f,_0x929ecf){_0x929ecf=_0x929ecf||0x1f4;return function(_0xde352e){logger[_0x88b9('0x26')](_0xde352e[_0x88b9('0x27')]);if(_0xde352e['name']){delete _0xde352e['name'];}_0x371b6f[_0x88b9('0x18')](_0x929ecf)[_0x88b9('0x28')](_0xde352e);};}exports[_0x88b9('0x29')]=function(_0xa9ef7c,_0x3fb669){var _0x578cb6={},_0x293624={},_0x193709={'count':0x0,'rows':[]};var _0x529ff3=_[_0x88b9('0x2a')](db[_0x88b9('0x2b')][_0x88b9('0x2c')],function(_0x92b42f){return{'name':_0x92b42f[_0x88b9('0x2d')],'type':_0x92b42f[_0x88b9('0x2e')][_0x88b9('0x2f')]};});_0x293624[_0x88b9('0x30')]=_[_0x88b9('0x2a')](_0x529ff3,_0x88b9('0x31'));_0x293624[_0x88b9('0x32')]=_['keys'](_0xa9ef7c['query']);_0x293624[_0x88b9('0x33')]=_[_0x88b9('0x34')](_0x293624[_0x88b9('0x30')],_0x293624[_0x88b9('0x32')]);_0x578cb6[_0x88b9('0x35')]=_[_0x88b9('0x34')](_0x293624['model'],qs[_0x88b9('0x36')](_0xa9ef7c['query']['fields']));_0x578cb6[_0x88b9('0x35')]=_0x578cb6[_0x88b9('0x35')][_0x88b9('0x37')]?_0x578cb6[_0x88b9('0x35')]:_0x293624['model'];if(!_0xa9ef7c[_0x88b9('0x32')]['hasOwnProperty'](_0x88b9('0x38'))){_0x578cb6[_0x88b9('0x1c')]=qs[_0x88b9('0x1c')](_0xa9ef7c[_0x88b9('0x32')]['limit']);_0x578cb6[_0x88b9('0x1b')]=qs[_0x88b9('0x1b')](_0xa9ef7c[_0x88b9('0x32')]['offset']);}_0x578cb6[_0x88b9('0x39')]=qs[_0x88b9('0x3a')](_0xa9ef7c[_0x88b9('0x32')][_0x88b9('0x3a')]);_0x578cb6['where']=qs[_0x88b9('0x33')](_[_0x88b9('0x3b')](_0xa9ef7c[_0x88b9('0x32')],_0x293624[_0x88b9('0x33')]),_0x529ff3);if(_0xa9ef7c['query'][_0x88b9('0x3c')]){_0x578cb6[_0x88b9('0x3d')]=_['merge'](_0x578cb6[_0x88b9('0x3d')],{'$or':_[_0x88b9('0x2a')](_0x529ff3,function(_0x33f1d7){if(_0x33f1d7['type']!=='VIRTUAL'){var _0x3cbf1d={};_0x3cbf1d[_0x33f1d7[_0x88b9('0x31')]]={'$like':'%'+_0xa9ef7c['query'][_0x88b9('0x3c')]+'%'};return _0x3cbf1d;}})});}_0x578cb6=_[_0x88b9('0x3e')]({},_0x578cb6,_0xa9ef7c[_0x88b9('0x3f')]);var _0x45cb61={'where':_0x578cb6[_0x88b9('0x3d')]};return db[_0x88b9('0x2b')]['count'](_0x45cb61)[_0x88b9('0x24')](function(_0x58b694){_0x193709['count']=_0x58b694;if(_0xa9ef7c[_0x88b9('0x32')][_0x88b9('0x40')]){_0x578cb6[_0x88b9('0x41')]=[{'all':!![]}];}return db[_0x88b9('0x2b')][_0x88b9('0x42')](_0x578cb6);})['then'](function(_0x1a44e4){_0x193709[_0x88b9('0x43')]=_0x1a44e4;return _0x193709;})[_0x88b9('0x24')](respondWithFilteredResult(_0x3fb669,_0x578cb6))['catch'](handleError(_0x3fb669,null));};exports[_0x88b9('0x44')]=function(_0x5e316f,_0xec6a6){var _0x52caba={'raw':!![],'where':{'id':_0x5e316f[_0x88b9('0x45')]['id']}},_0x56559d={};_0x56559d['model']=_[_0x88b9('0x46')](db[_0x88b9('0x2b')][_0x88b9('0x2c')]);_0x56559d[_0x88b9('0x32')]=_[_0x88b9('0x46')](_0x5e316f[_0x88b9('0x32')]);_0x56559d['filters']=_[_0x88b9('0x34')](_0x56559d[_0x88b9('0x30')],_0x56559d[_0x88b9('0x32')]);_0x52caba[_0x88b9('0x35')]=_[_0x88b9('0x34')](_0x56559d[_0x88b9('0x30')],qs['fields'](_0x5e316f['query'][_0x88b9('0x36')]));_0x52caba[_0x88b9('0x35')]=_0x52caba[_0x88b9('0x35')]['length']?_0x52caba[_0x88b9('0x35')]:_0x56559d['model'];if(_0x5e316f['query'][_0x88b9('0x40')]){_0x52caba[_0x88b9('0x41')]=[{'all':!![]}];}_0x52caba=_[_0x88b9('0x3e')]({},_0x52caba,_0x5e316f['options']);return db['ZendeskField'][_0x88b9('0x47')](_0x52caba)[_0x88b9('0x24')](handleEntityNotFound(_0xec6a6,null))[_0x88b9('0x24')](respondWithResult(_0xec6a6,null))[_0x88b9('0x48')](handleError(_0xec6a6,null));};exports['create']=function(_0x11e498,_0x4d9162){return db[_0x88b9('0x2b')][_0x88b9('0x49')](_0x11e498[_0x88b9('0x4a')],{})['then'](respondWithResult(_0x4d9162,0xc9))[_0x88b9('0x48')](handleError(_0x4d9162,null));};exports['update']=function(_0x32bc57,_0x59878a){if(_0x32bc57['body']['id']){delete _0x32bc57[_0x88b9('0x4a')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x32bc57['params']['id']}})[_0x88b9('0x24')](handleEntityNotFound(_0x59878a,null))[_0x88b9('0x24')](saveUpdates(_0x32bc57['body'],null))[_0x88b9('0x24')](respondWithResult(_0x59878a,null))[_0x88b9('0x48')](handleError(_0x59878a,null));};exports[_0x88b9('0x25')]=function(_0x65dd5,_0x3af89d){return db[_0x88b9('0x2b')][_0x88b9('0x47')]({'where':{'id':_0x65dd5['params']['id']}})[_0x88b9('0x24')](handleEntityNotFound(_0x3af89d,null))[_0x88b9('0x24')](removeEntity(_0x3af89d,null))[_0x88b9('0x48')](handleError(_0x3af89d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a576c38..24d763c 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 _0x8ea3=['exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x58d6b9,_0x51c3cd){var _0x13abe4=function(_0x3a831b){while(--_0x3a831b){_0x58d6b9['push'](_0x58d6b9['shift']());}};_0x13abe4(++_0x51c3cd);}(_0x8ea3,0x19b));var _0x38ea=function(_0x6b2c5c,_0x3f6949){_0x6b2c5c=_0x6b2c5c-0x0;var _0x18e3ce=_0x8ea3[_0x6b2c5c];return _0x18e3ce;};'use strict';var _=require(_0x38ea('0x0'));var util=require('util');var logger=require(_0x38ea('0x1'))(_0x38ea('0x2'));var moment=require(_0x38ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x38ea('0x4'));var fs=require('fs');var path=require(_0x38ea('0x5'));var rimraf=require(_0x38ea('0x6'));var config=require(_0x38ea('0x7'));var attributes=require(_0x38ea('0x8'));module[_0x38ea('0x9')]=function(_0x440b13,_0x290f53){return _0x440b13['define'](_0x38ea('0xa'),attributes,{'tableName':_0x38ea('0xb'),'paranoid':![],'indexes':[{'name':_0x38ea('0xc'),'fields':[_0x38ea('0xd'),_0x38ea('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c8b=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger'];(function(_0xb69d9d,_0x3635ed){var _0x2e6491=function(_0x2b08e8){while(--_0x2b08e8){_0xb69d9d['push'](_0xb69d9d['shift']());}};_0x2e6491(++_0x3635ed);}(_0x8c8b,0x75));var _0xb8c8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c8b[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xb8c8('0x0'));var util=require(_0xb8c8('0x1'));var logger=require(_0xb8c8('0x2'))(_0xb8c8('0x3'));var moment=require(_0xb8c8('0x4'));var BPromise=require(_0xb8c8('0x5'));var rp=require(_0xb8c8('0x6'));var fs=require('fs');var path=require(_0xb8c8('0x7'));var rimraf=require('rimraf');var config=require(_0xb8c8('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xb8c8('0x9')]=function(_0x5efb15,_0x56c841){return _0x5efb15[_0xb8c8('0xa')](_0xb8c8('0xb'),attributes,{'tableName':_0xb8c8('0xc'),'paranoid':![],'indexes':[{'name':_0xb8c8('0xd'),'fields':[_0xb8c8('0xe'),'FieldId'],'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 9f60257..225cd66 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 _0x41d7=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment'];(function(_0x36dc27,_0x7b681c){var _0x465998=function(_0x2a16ce){while(--_0x2a16ce){_0x36dc27['push'](_0x36dc27['shift']());}};_0x465998(++_0x7b681c);}(_0x41d7,0x129));var _0x741d=function(_0x13c2e3,_0x22ab8b){_0x13c2e3=_0x13c2e3-0x0;var _0x1bac51=_0x41d7[_0x13c2e3];return _0x1bac51;};'use strict';var _=require(_0x741d('0x0'));var util=require(_0x741d('0x1'));var moment=require(_0x741d('0x2'));var BPromise=require(_0x741d('0x3'));var rs=require(_0x741d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x741d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x741d('0x6'))(_0x741d('0x7'));var config=require(_0x741d('0x8'));var jayson=require(_0x741d('0x9'));var client=jayson[_0x741d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35cd5e,_0x3b8613,_0x4af835){return new BPromise(function(_0x59191e,_0x549216){return client[_0x741d('0xb')](_0x35cd5e,_0x4af835)[_0x741d('0xc')](function(_0x364b5e){logger['info'](_0x741d('0xd'),_0x3b8613,_0x741d('0xe'));logger['debug'](_0x741d('0xf'),_0x3b8613,_0x741d('0xe'),JSON['stringify'](_0x364b5e));if(_0x364b5e['error']){if(_0x364b5e[_0x741d('0x10')][_0x741d('0x11')]===0x1f4){logger[_0x741d('0x10')](_0x741d('0xd'),_0x3b8613,_0x364b5e[_0x741d('0x10')]['message']);return _0x549216(_0x364b5e[_0x741d('0x10')][_0x741d('0x12')]);}logger[_0x741d('0x10')]('ZendeskField,\x20%s,\x20%s',_0x3b8613,_0x364b5e['error'][_0x741d('0x12')]);return _0x59191e(_0x364b5e['error'][_0x741d('0x12')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x3b8613,_0x741d('0xe'));_0x59191e(_0x364b5e[_0x741d('0x13')][_0x741d('0x12')]);}})['catch'](function(_0x22db80){logger[_0x741d('0x10')](_0x741d('0xd'),_0x3b8613,_0x22db80);_0x549216(_0x22db80);});});} \ No newline at end of file +var _0x78ef=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis'];(function(_0x6910f7,_0x3c5e20){var _0x14503c=function(_0x3b31cf){while(--_0x3b31cf){_0x6910f7['push'](_0x6910f7['shift']());}};_0x14503c(++_0x3c5e20);}(_0x78ef,0x18c));var _0xf78e=function(_0x27264f,_0x5bf222){_0x27264f=_0x27264f-0x0;var _0x3ab747=_0x78ef[_0x27264f];return _0x3ab747;};'use strict';var _=require(_0xf78e('0x0'));var util=require('util');var moment=require(_0xf78e('0x1'));var BPromise=require(_0xf78e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf78e('0x3'));var db=require(_0xf78e('0x4'))['db'];var utils=require(_0xf78e('0x5'));var logger=require(_0xf78e('0x6'))(_0xf78e('0x7'));var config=require(_0xf78e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf78e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eecf9,_0xf0253d,_0x170659){return new BPromise(function(_0x6b1b8c,_0x2944a3){return client[_0xf78e('0xa')](_0x2eecf9,_0x170659)['then'](function(_0x44785b){logger[_0xf78e('0xb')](_0xf78e('0xc'),_0xf0253d,_0xf78e('0xd'));logger[_0xf78e('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xf0253d,_0xf78e('0xd'),JSON[_0xf78e('0xf')](_0x44785b));if(_0x44785b[_0xf78e('0x10')]){if(_0x44785b['error'][_0xf78e('0x11')]===0x1f4){logger[_0xf78e('0x10')](_0xf78e('0xc'),_0xf0253d,_0x44785b['error']['message']);return _0x2944a3(_0x44785b[_0xf78e('0x10')][_0xf78e('0x12')]);}logger[_0xf78e('0x10')](_0xf78e('0xc'),_0xf0253d,_0x44785b[_0xf78e('0x10')][_0xf78e('0x12')]);return _0x6b1b8c(_0x44785b[_0xf78e('0x10')][_0xf78e('0x12')]);}else{logger[_0xf78e('0xb')]('ZendeskField,\x20%s,\x20%s',_0xf0253d,_0xf78e('0xd'));_0x6b1b8c(_0x44785b['result'][_0xf78e('0x12')]);}})[_0xf78e('0x13')](function(_0x1a2625){logger[_0xf78e('0x10')](_0xf78e('0xc'),_0xf0253d,_0x1a2625);_0x2944a3(_0x1a2625);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index c8864e0..22e8cb9 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 _0x8648=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','multer'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8648,0x19d));var _0x8864=function(_0x437030,_0x5847bc){_0x437030=_0x437030-0x0;var _0x572db1=_0x8648[_0x437030];return _0x572db1;};'use strict';var multer=require(_0x8864('0x0'));var util=require(_0x8864('0x1'));var path=require('path');var timeout=require(_0x8864('0x2'));var express=require(_0x8864('0x3'));var router=express[_0x8864('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8864('0x5'));var interaction=require(_0x8864('0x6'));var config=require(_0x8864('0x7'));var controller=require('./intZohoAccount.controller');router[_0x8864('0x8')]('/',auth['isAuthenticated'](),controller[_0x8864('0x9')]);router[_0x8864('0x8')](_0x8864('0xa'),auth[_0x8864('0xb')](),controller[_0x8864('0xc')]);router[_0x8864('0x8')](_0x8864('0xd'),auth[_0x8864('0xb')](),controller[_0x8864('0xe')]);router['get'](_0x8864('0xf'),auth['isAuthenticated'](),controller[_0x8864('0x10')]);router[_0x8864('0x11')]('/',auth[_0x8864('0xb')](),controller[_0x8864('0x12')]);router[_0x8864('0x11')](_0x8864('0xd'),auth['isAuthenticated'](),controller[_0x8864('0x13')]);router['put'](_0x8864('0xa'),auth[_0x8864('0xb')](),controller[_0x8864('0x14')]);router['delete'](_0x8864('0xa'),auth['isAuthenticated'](),controller[_0x8864('0x15')]);module[_0x8864('0x16')]=router; \ No newline at end of file +var _0x3266=['../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','/:id','update','delete','destroy','util','path','connect-timeout'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0x3266,0x165));var _0x6326=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x3266[_0x1ebe90];return _0x447c82;};'use strict';var multer=require('multer');var util=require(_0x6326('0x0'));var path=require(_0x6326('0x1'));var timeout=require(_0x6326('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6326('0x3'));var controller=require('./intZohoAccount.controller');router[_0x6326('0x4')]('/',auth[_0x6326('0x5')](),controller[_0x6326('0x6')]);router[_0x6326('0x4')]('/:id',auth[_0x6326('0x5')](),controller[_0x6326('0x7')]);router['get'](_0x6326('0x8'),auth[_0x6326('0x5')](),controller[_0x6326('0x9')]);router[_0x6326('0x4')]('/:id/fields',auth[_0x6326('0x5')](),controller[_0x6326('0xa')]);router[_0x6326('0xb')]('/',auth[_0x6326('0x5')](),controller['create']);router[_0x6326('0xb')](_0x6326('0x8'),auth[_0x6326('0x5')](),controller[_0x6326('0xc')]);router[_0x6326('0xd')](_0x6326('0xe'),auth[_0x6326('0x5')](),controller[_0x6326('0xf')]);router[_0x6326('0x10')](_0x6326('0xe'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 2158341..acded04 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99e9=['exports','STRING'];(function(_0x1ea533,_0x1613bc){var _0x4804e8=function(_0x292cff){while(--_0x292cff){_0x1ea533['push'](_0x1ea533['shift']());}};_0x4804e8(++_0x1613bc);}(_0x99e9,0xb4));var _0x999e=function(_0x65cd03,_0x2913ee){_0x65cd03=_0x65cd03-0x0;var _0x21c579=_0x99e9[_0x65cd03];return _0x21c579;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file +var _0x2dae=['STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2dae,0xc3));var _0xe2da=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x2dae[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2da('0x1')]},'description':{'type':Sequelize[_0xe2da('0x1')]},'host':{'type':Sequelize[_0xe2da('0x1')]},'zone':{'type':Sequelize[_0xe2da('0x1')]},'clientId':{'type':Sequelize[_0xe2da('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe2da('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe2da('0x1')]},'refreshToken':{'type':Sequelize[_0xe2da('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 02902a3..1eacdc5 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 _0xa01b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','body','getConfigurations','ZohoConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','create','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','slice','substring','lastIndexOf','GET','format','Calls','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x43cf80,_0x669560){var _0x91e948=function(_0x1378d7){while(--_0x1378d7){_0x43cf80['push'](_0x43cf80['shift']());}};_0x91e948(++_0x669560);}(_0xa01b,0x6e));var _0xba01=function(_0x40e7fc,_0x469aba){_0x40e7fc=_0x40e7fc-0x0;var _0x2acfc2=_0xa01b[_0x40e7fc];return _0x2acfc2;};'use strict';var emlformat=require(_0xba01('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba01('0x1'));var rp=require(_0xba01('0x2'));var moment=require(_0xba01('0x3'));var BPromise=require(_0xba01('0x4'));var Mustache=require(_0xba01('0x5'));var util=require(_0xba01('0x6'));var path=require(_0xba01('0x7'));var sox=require(_0xba01('0x8'));var csv=require(_0xba01('0x9'));var ejs=require(_0xba01('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba01('0xb'));var squel=require(_0xba01('0xc'));var crypto=require('crypto');var jsforce=require(_0xba01('0xd'));var deskjs=require(_0xba01('0xe'));var toCsv=require(_0xba01('0x9'));var querystring=require('querystring');var Papa=require(_0xba01('0xf'));var Redis=require(_0xba01('0x10'));var authService=require(_0xba01('0x11'));var qs=require(_0xba01('0x12'));var as=require(_0xba01('0x13'));var hardwareService=require(_0xba01('0x14'));var logger=require(_0xba01('0x15'))(_0xba01('0x16'));var utils=require(_0xba01('0x17'));var config=require(_0xba01('0x18'));var licenseUtil=require(_0xba01('0x19'));var db=require(_0xba01('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x20e0b6,_0x3d5461){_0x3d5461=_0x3d5461||0xcc;return function(_0x45cd5f){if(_0x45cd5f){return _0x20e0b6[_0xba01('0x1b')](_0x3d5461);}return _0x20e0b6['status'](_0x3d5461)[_0xba01('0x1c')]();};}function respondWithResult(_0x27872e,_0x3f1929){_0x3f1929=_0x3f1929||0xc8;return function(_0x371418){if(_0x371418){return _0x27872e[_0xba01('0x1d')](_0x3f1929)[_0xba01('0x1e')](_0x371418);}};}function respondWithFilteredResult(_0x44d428,_0x5b2a6f){return function(_0x46ed63){if(_0x46ed63){var _0x5bdee4=typeof _0x5b2a6f[_0xba01('0x1f')]===_0xba01('0x20')&&typeof _0x5b2a6f[_0xba01('0x21')]==='undefined';var _0x224be6=_0x46ed63[_0xba01('0x22')];var _0x476d9d=_0x5bdee4?0x0:_0x5b2a6f[_0xba01('0x1f')];var _0x288d7a=_0x5bdee4?_0x46ed63[_0xba01('0x22')]:_0x5b2a6f[_0xba01('0x1f')]+_0x5b2a6f[_0xba01('0x21')];var _0x195168;if(_0x288d7a>=_0x224be6){_0x288d7a=_0x224be6;_0x195168=0xc8;}else{_0x195168=0xce;}_0x44d428['status'](_0x195168);return _0x44d428['set']('Content-Range',_0x476d9d+'-'+_0x288d7a+'/'+_0x224be6)[_0xba01('0x1e')](_0x46ed63);}return null;};}function patchUpdates(_0x23edc4){return function(_0x4b8970){try{jsonpatch[_0xba01('0x23')](_0x4b8970,_0x23edc4,!![]);}catch(_0x473a13){return BPromise[_0xba01('0x24')](_0x473a13);}return _0x4b8970['save']();};}function saveUpdates(_0x101625,_0x4c2f9b){return function(_0x713736){if(_0x713736){return _0x713736[_0xba01('0x25')](_0x101625)[_0xba01('0x26')](function(_0x393214){return _0x393214;});}return null;};}function removeEntity(_0x27d1b4,_0x222c13){return function(_0x5d027a){if(_0x5d027a){return _0x5d027a[_0xba01('0x27')]()[_0xba01('0x26')](function(){_0x27d1b4['status'](0xcc)[_0xba01('0x1c')]();});}};}function handleEntityNotFound(_0x2d2afa,_0x32e39d){return function(_0x5938e0){if(!_0x5938e0){_0x2d2afa[_0xba01('0x1b')](0x194);}return _0x5938e0;};}function handleError(_0xb2b7fa,_0xdc8a2d){_0xdc8a2d=_0xdc8a2d||0x1f4;return function(_0x20a55d){logger[_0xba01('0x28')](_0x20a55d['stack']);if(_0x20a55d[_0xba01('0x29')]){delete _0x20a55d[_0xba01('0x29')];}_0xb2b7fa['status'](_0xdc8a2d)[_0xba01('0x2a')](_0x20a55d);};}exports[_0xba01('0x2b')]=function(_0x59e4a2,_0x520732){var _0x42ab98={},_0x4f500e={},_0x694324={'count':0x0,'rows':[]};var _0x44955e=_['map'](db[_0xba01('0x2c')][_0xba01('0x2d')],function(_0x2294fb){return{'name':_0x2294fb[_0xba01('0x2e')],'type':_0x2294fb[_0xba01('0x2f')][_0xba01('0x30')]};});_0x4f500e['model']=_[_0xba01('0x31')](_0x44955e,_0xba01('0x29'));_0x4f500e[_0xba01('0x32')]=_[_0xba01('0x33')](_0x59e4a2[_0xba01('0x32')]);_0x4f500e['filters']=_[_0xba01('0x34')](_0x4f500e[_0xba01('0x35')],_0x4f500e[_0xba01('0x32')]);_0x42ab98[_0xba01('0x36')]=_[_0xba01('0x34')](_0x4f500e[_0xba01('0x35')],qs[_0xba01('0x37')](_0x59e4a2[_0xba01('0x32')][_0xba01('0x37')]));_0x42ab98[_0xba01('0x36')]=_0x42ab98['attributes'][_0xba01('0x38')]?_0x42ab98[_0xba01('0x36')]:_0x4f500e[_0xba01('0x35')];if(!_0x59e4a2[_0xba01('0x32')][_0xba01('0x39')]('nolimit')){_0x42ab98[_0xba01('0x21')]=qs[_0xba01('0x21')](_0x59e4a2[_0xba01('0x32')][_0xba01('0x21')]);_0x42ab98[_0xba01('0x1f')]=qs['offset'](_0x59e4a2[_0xba01('0x32')][_0xba01('0x1f')]);}_0x42ab98[_0xba01('0x3a')]=qs[_0xba01('0x3b')](_0x59e4a2[_0xba01('0x32')][_0xba01('0x3b')]);_0x42ab98[_0xba01('0x3c')]=qs['filters'](_[_0xba01('0x3d')](_0x59e4a2[_0xba01('0x32')],_0x4f500e[_0xba01('0x3e')]),_0x44955e);if(_0x59e4a2[_0xba01('0x32')][_0xba01('0x3f')]){_0x42ab98[_0xba01('0x3c')]=_[_0xba01('0x40')](_0x42ab98[_0xba01('0x3c')],{'$or':_[_0xba01('0x31')](_0x44955e,function(_0xc8fe05){if(_0xc8fe05[_0xba01('0x2f')]!==_0xba01('0x41')){var _0x549311={};_0x549311[_0xc8fe05[_0xba01('0x29')]]={'$like':'%'+_0x59e4a2['query']['filter']+'%'};return _0x549311;}})});}_0x42ab98=_['merge']({},_0x42ab98,_0x59e4a2[_0xba01('0x42')]);var _0x53366e={'where':_0x42ab98[_0xba01('0x3c')]};return db[_0xba01('0x2c')][_0xba01('0x22')](_0x53366e)[_0xba01('0x26')](function(_0xc07f18){_0x694324['count']=_0xc07f18;if(_0x59e4a2['query'][_0xba01('0x43')]){_0x42ab98['include']=[{'all':!![]}];}return db[_0xba01('0x2c')][_0xba01('0x44')](_0x42ab98);})[_0xba01('0x26')](function(_0x2627a){_0x694324[_0xba01('0x45')]=_0x2627a;return _0x694324;})[_0xba01('0x26')](respondWithFilteredResult(_0x520732,_0x42ab98))[_0xba01('0x46')](handleError(_0x520732,null));};exports[_0xba01('0x47')]=function(_0x2f7f89,_0x1608e9){var _0x120e32={'raw':![],'where':{'id':_0x2f7f89[_0xba01('0x48')]['id']}},_0x56c869={};_0x56c869['model']=_[_0xba01('0x33')](db[_0xba01('0x2c')][_0xba01('0x2d')]);_0x56c869[_0xba01('0x32')]=_[_0xba01('0x33')](_0x2f7f89[_0xba01('0x32')]);_0x56c869[_0xba01('0x3e')]=_['intersection'](_0x56c869[_0xba01('0x35')],_0x56c869[_0xba01('0x32')]);_0x120e32['attributes']=_[_0xba01('0x34')](_0x56c869[_0xba01('0x35')],qs['fields'](_0x2f7f89[_0xba01('0x32')][_0xba01('0x37')]));_0x120e32[_0xba01('0x36')]=_0x120e32[_0xba01('0x36')][_0xba01('0x38')]?_0x120e32['attributes']:_0x56c869[_0xba01('0x35')];if(_0x2f7f89[_0xba01('0x32')][_0xba01('0x43')]){_0x120e32['include']=[{'all':!![]}];}_0x120e32=_[_0xba01('0x40')]({},_0x120e32,_0x2f7f89[_0xba01('0x42')]);return db[_0xba01('0x2c')]['find'](_0x120e32)[_0xba01('0x26')](handleEntityNotFound(_0x1608e9,null))[_0xba01('0x26')](respondWithResult(_0x1608e9,null))[_0xba01('0x46')](handleError(_0x1608e9,null));};exports['create']=function(_0x3e1324,_0x5dd41e){return db[_0xba01('0x2c')]['create'](_0x3e1324[_0xba01('0x49')],{})[_0xba01('0x26')](respondWithResult(_0x5dd41e,0xc9))[_0xba01('0x46')](handleError(_0x5dd41e,null));};exports[_0xba01('0x25')]=function(_0x1adcf6,_0x5bc88a){if(_0x1adcf6['body']['id']){delete _0x1adcf6[_0xba01('0x49')]['id'];}return db[_0xba01('0x2c')]['find']({'where':{'id':_0x1adcf6['params']['id']}})['then'](handleEntityNotFound(_0x5bc88a,null))[_0xba01('0x26')](saveUpdates(_0x1adcf6[_0xba01('0x49')],null))[_0xba01('0x26')](respondWithResult(_0x5bc88a,null))[_0xba01('0x46')](handleError(_0x5bc88a,null));};exports[_0xba01('0x27')]=function(_0x5c7181,_0x14ffa2){return db[_0xba01('0x2c')]['find']({'where':{'id':_0x5c7181['params']['id']}})[_0xba01('0x26')](handleEntityNotFound(_0x14ffa2,null))[_0xba01('0x26')](removeEntity(_0x14ffa2,null))[_0xba01('0x46')](handleError(_0x14ffa2,null));};exports[_0xba01('0x4a')]=function(_0x2fd9ac,_0x3260ac,_0x3b4519){var _0x406949={};var _0x698809={};var _0x5e0f50;var _0x549427;return db[_0xba01('0x2c')]['findOne']({'where':{'id':_0x2fd9ac[_0xba01('0x48')]['id']}})['then'](handleEntityNotFound(_0x3260ac,null))[_0xba01('0x26')](function(_0x16d92a){if(_0x16d92a){_0x5e0f50=_0x16d92a;_0x698809[_0xba01('0x35')]=_[_0xba01('0x33')](db[_0xba01('0x4b')][_0xba01('0x2d')]);_0x698809[_0xba01('0x32')]=_[_0xba01('0x33')](_0x2fd9ac['query']);_0x698809[_0xba01('0x3e')]=_[_0xba01('0x34')](_0x698809[_0xba01('0x35')],_0x698809['query']);_0x406949[_0xba01('0x36')]=_[_0xba01('0x34')](_0x698809['model'],qs[_0xba01('0x37')](_0x2fd9ac[_0xba01('0x32')][_0xba01('0x37')]));_0x406949[_0xba01('0x36')]=_0x406949[_0xba01('0x36')][_0xba01('0x38')]?_0x406949['attributes']:_0x698809[_0xba01('0x35')];_0x406949[_0xba01('0x3a')]=qs['sort'](_0x2fd9ac['query'][_0xba01('0x3b')]);_0x406949[_0xba01('0x3c')]=qs[_0xba01('0x3e')](_[_0xba01('0x3d')](_0x2fd9ac[_0xba01('0x32')],_0x698809[_0xba01('0x3e')]));if(_0x2fd9ac['query'][_0xba01('0x3f')]){_0x406949[_0xba01('0x3c')]=_[_0xba01('0x40')](_0x406949[_0xba01('0x3c')],{'$or':_[_0xba01('0x31')](_0x406949['attributes'],function(_0x5c0745){var _0x371b17={};_0x371b17[_0x5c0745]={'$like':'%'+_0x2fd9ac[_0xba01('0x32')]['filter']+'%'};return _0x371b17;})});}_0x406949=_['merge']({},_0x406949,_0x2fd9ac[_0xba01('0x42')]);return _0x5e0f50[_0xba01('0x4a')](_0x406949);}})[_0xba01('0x26')](function(_0x1d6f9d){if(_0x1d6f9d){_0x549427=_0x1d6f9d['length'];if(!_0x2fd9ac[_0xba01('0x32')][_0xba01('0x39')](_0xba01('0x4c'))){_0x406949[_0xba01('0x21')]=qs[_0xba01('0x21')](_0x2fd9ac[_0xba01('0x32')]['limit']);_0x406949['offset']=qs[_0xba01('0x1f')](_0x2fd9ac[_0xba01('0x32')][_0xba01('0x1f')]);}return _0x5e0f50[_0xba01('0x4a')](_0x406949);}})['then'](function(_0x4c661a){if(_0x4c661a){return _0x4c661a?{'count':_0x549427,'rows':_0x4c661a}:null;}})[_0xba01('0x26')](respondWithResult(_0x3260ac,null))['catch'](handleError(_0x3260ac,null));};exports[_0xba01('0x4d')]=function(_0x493396,_0x48df80,_0x4cae21){if(_0x493396[_0xba01('0x49')]['id']){delete _0x493396[_0xba01('0x49')]['id'];}return db['ZohoAccount'][_0xba01('0x4e')]({'where':{'id':_0x493396[_0xba01('0x48')]['id']}})[_0xba01('0x26')](handleEntityNotFound(_0x48df80,null))[_0xba01('0x26')](function(_0x5b0a72){if(_0x5b0a72){_0x493396[_0xba01('0x49')][_0xba01('0x4f')]=_0x5b0a72['id'];_0x493396[_0xba01('0x49')][_0xba01('0x50')]=integrations[_0xba01('0x51')](_0x493396[_0xba01('0x49')][_0xba01('0x52')],_0x493396[_0xba01('0x49')][_0xba01('0x2f')]);_0x493396['body']['Descriptions']=integrations[_0xba01('0x53')](_0x493396[_0xba01('0x49')][_0xba01('0x52')],_0x493396[_0xba01('0x49')][_0xba01('0x2f')]);return db[_0xba01('0x4b')][_0xba01('0x54')](_0x493396[_0xba01('0x49')],{'include':[{'model':db[_0xba01('0x55')],'as':_0xba01('0x50')},{'model':db[_0xba01('0x55')],'as':_0xba01('0x56')}]});}return null;})[_0xba01('0x26')](respondWithResult(_0x48df80,null))[_0xba01('0x46')](handleError(_0x48df80,null));};function getAccessToken(_0x4ae8f1){return new Promise(function(_0x267fb4,_0x3dda1b){var _0x453a3e;switch(_0x4ae8f1[_0xba01('0x57')]){case'US':_0x453a3e=_0xba01('0x58');break;case'AU':_0x453a3e=_0xba01('0x59');break;case'EU':_0x453a3e='https://accounts.zoho.eu';break;case'IN':_0x453a3e=_0xba01('0x5a');break;case'CN':_0x453a3e=_0xba01('0x5b');break;default:_0x453a3e='https://accounts.zoho.eu';break;}var _0x44e520={'method':_0xba01('0x5c'),'uri':_0x453a3e+_0xba01('0x5d'),'qs':{'refresh_token':_0x4ae8f1[_0xba01('0x5e')],'client_id':_0x4ae8f1[_0xba01('0x5f')],'client_secret':_0x4ae8f1[_0xba01('0x60')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x44e520)['then'](function(_0x25a514){if(_0x25a514[_0xba01('0x61')]){_0x267fb4(_0x25a514[_0xba01('0x61')]);}else{_0x3dda1b(_0xba01('0x62'));}})[_0xba01('0x46')](function(_0x457f68){_0x3dda1b(_0x457f68);});});}exports[_0xba01('0x63')]=function(_0xb313b,_0x5811a3,_0xb93ef4){var _0xaac24e,_0x435e56,_0x348281,_0x7f9ed,_0x6ec6b8;return db[_0xba01('0x2c')]['findOne']({'where':{'id':_0xb313b[_0xba01('0x48')]['id']},'attributes':['id',_0xba01('0x64'),_0xba01('0x57'),_0xba01('0x5f'),_0xba01('0x60'),_0xba01('0x65'),'code',_0xba01('0x5e')]})['then'](handleEntityNotFound(_0x5811a3,null))['then'](function(_0x514f71){_0x6ec6b8=_0x514f71;_0xaac24e=_0x6ec6b8[_0xba01('0x64')];_0x435e56=_0xaac24e==='zoho.eu'?'eu':'com';_0x348281=_0x6ec6b8['serverUrl'];var _0xbb4625=_0x348281[_0xba01('0x66')](-0x1);if(_0xbb4625==='/'||_0xbb4625==='\x5c'||_0xbb4625===':'){_0x348281=_0x348281[_0xba01('0x67')](0x0,_0x348281[_0xba01('0x68')](_0xbb4625));}if(!_0x6ec6b8['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x6ec6b8);})['then'](function(_0x3353d5){if(_0x3353d5){return rp({'method':_0xba01('0x69'),'uri':util[_0xba01('0x6a')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x435e56),'qs':{'module':_0xba01('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3353d5},'json':!![]});}})[_0xba01('0x26')](function(_0x3b24b2){if(_0x3b24b2){if(_0x3b24b2[_0xba01('0x6c')]&&_0x3b24b2[_0xba01('0x6c')]['error']){throw new Error(_0x3b24b2[_0xba01('0x6c')][_0xba01('0x28')][_0xba01('0x6d')]);}var _0x20d8b0=[];var _0x589d2e=[];var _0x1a74fb=[_0xba01('0x6e'),'Subject',_0xba01('0x6f'),_0xba01('0x70'),_0xba01('0x71'),_0xba01('0x72'),'Call_Start_Time',_0xba01('0x73')];_0x589d2e=_[_0xba01('0x74')](_0x3b24b2['fields'],function(_0x251ff5){return _0x1a74fb['includes'](_0x251ff5['api_name']);});for(var _0x49a553=0x0;_0x49a553<_0x589d2e['length'];_0x49a553++){if(_0x589d2e[_0x49a553][_0xba01('0x75')]===![]){_0x20d8b0[_0xba01('0x76')]({'id':_0x589d2e[_0x49a553]['id'],'name':_0x589d2e[_0x49a553][_0xba01('0x77')],'custom':_0x589d2e[_0x49a553][_0xba01('0x78')],'options':_0x589d2e[_0x49a553][_0xba01('0x79')]===_0xba01('0x7a')&&_0x589d2e[_0x49a553][_0xba01('0x7b')][_0xba01('0x38')]>-0x1?_[_0xba01('0x31')](_0x589d2e[_0x49a553]['pick_list_values'],function(_0x1553e6){return{'name':_0x1553e6,'value':_0x1553e6};}):[]});}}return{'count':_0x20d8b0[_0xba01('0x38')],'rows':_0x20d8b0};}else{return{'count':0x0,'rows':[]};}})[_0xba01('0x26')](respondWithResult(_0x5811a3,null))[_0xba01('0x46')](function(_0x21782c){var _0x1062b0=_0xb313b[_0xba01('0x32')][_0xba01('0x7c')]?0x1f4:_0x21782c[_0xba01('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xba01('0x63'),_0x1062b0,JSON[_0xba01('0x7e')](_0x21782c));delete _0x21782c[_0xba01('0x29')];if(_0x1062b0===0x191){_0x1062b0=0x190;}_0x5811a3[_0xba01('0x1d')](_0x1062b0)[_0xba01('0x2a')](_0xb313b['query']['test']?{'message':_0xba01('0x7f'),'statusCode':_0x21782c[_0xba01('0x7d')]}:_0x21782c);});}; \ No newline at end of file +var _0xb530=['destroy','then','sendStatus','error','stack','name','index','ZohoAccount','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','getConfigurations','findOne','ZohoConfiguration','order','map','nolimit','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','ZohoField','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x158131,_0x5da1e3){var _0x13ab1f=function(_0x591a85){while(--_0x591a85){_0x158131['push'](_0x158131['shift']());}};_0x13ab1f(++_0x5da1e3);}(_0xb530,0xe4));var _0x0b53=function(_0x6aa97,_0xe02dd7){_0x6aa97=_0x6aa97-0x0;var _0x55865e=_0xb530[_0x6aa97];return _0x55865e;};'use strict';var emlformat=require(_0x0b53('0x0'));var rimraf=require(_0x0b53('0x1'));var zipdir=require(_0x0b53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b53('0x3'));var moment=require('moment');var BPromise=require(_0x0b53('0x4'));var Mustache=require(_0x0b53('0x5'));var util=require(_0x0b53('0x6'));var path=require(_0x0b53('0x7'));var sox=require('sox');var csv=require(_0x0b53('0x8'));var ejs=require(_0x0b53('0x9'));var fs=require('fs');var fs_extra=require(_0x0b53('0xa'));var _=require('lodash');var squel=require(_0x0b53('0xb'));var crypto=require(_0x0b53('0xc'));var jsforce=require(_0x0b53('0xd'));var deskjs=require(_0x0b53('0xe'));var toCsv=require(_0x0b53('0x8'));var querystring=require(_0x0b53('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0b53('0x10'));var qs=require(_0x0b53('0x11'));var as=require(_0x0b53('0x12'));var hardwareService=require(_0x0b53('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0b53('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0b53('0x15'))['db'];var integrations=require(_0x0b53('0x16'));function respondWithStatusCode(_0x3837df,_0x3f8b54){_0x3f8b54=_0x3f8b54||0xcc;return function(_0x303a8b){if(_0x303a8b){return _0x3837df['sendStatus'](_0x3f8b54);}return _0x3837df[_0x0b53('0x17')](_0x3f8b54)[_0x0b53('0x18')]();};}function respondWithResult(_0x3d84f5,_0x3d569b){_0x3d569b=_0x3d569b||0xc8;return function(_0x2bcf68){if(_0x2bcf68){return _0x3d84f5[_0x0b53('0x17')](_0x3d569b)[_0x0b53('0x19')](_0x2bcf68);}};}function respondWithFilteredResult(_0x45575f,_0x4742fe){return function(_0x2853c4){if(_0x2853c4){var _0x7595ab=typeof _0x4742fe[_0x0b53('0x1a')]===_0x0b53('0x1b')&&typeof _0x4742fe[_0x0b53('0x1c')]===_0x0b53('0x1b');var _0x57c2c1=_0x2853c4[_0x0b53('0x1d')];var _0x5ebc20=_0x7595ab?0x0:_0x4742fe[_0x0b53('0x1a')];var _0x38a2ad=_0x7595ab?_0x2853c4[_0x0b53('0x1d')]:_0x4742fe[_0x0b53('0x1a')]+_0x4742fe[_0x0b53('0x1c')];var _0x2e2140;if(_0x38a2ad>=_0x57c2c1){_0x38a2ad=_0x57c2c1;_0x2e2140=0xc8;}else{_0x2e2140=0xce;}_0x45575f[_0x0b53('0x17')](_0x2e2140);return _0x45575f['set'](_0x0b53('0x1e'),_0x5ebc20+'-'+_0x38a2ad+'/'+_0x57c2c1)[_0x0b53('0x19')](_0x2853c4);}return null;};}function patchUpdates(_0x56618c){return function(_0x28fd83){try{jsonpatch[_0x0b53('0x1f')](_0x28fd83,_0x56618c,!![]);}catch(_0x27ee1c){return BPromise[_0x0b53('0x20')](_0x27ee1c);}return _0x28fd83[_0x0b53('0x21')]();};}function saveUpdates(_0x1af99a,_0x10804c){return function(_0x152d5a){if(_0x152d5a){return _0x152d5a['update'](_0x1af99a)['then'](function(_0xecea5e){return _0xecea5e;});}return null;};}function removeEntity(_0x45de93,_0x1b5a23){return function(_0x4dd151){if(_0x4dd151){return _0x4dd151[_0x0b53('0x22')]()[_0x0b53('0x23')](function(){_0x45de93[_0x0b53('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171043,_0x5adf8a){return function(_0x20ed73){if(!_0x20ed73){_0x171043[_0x0b53('0x24')](0x194);}return _0x20ed73;};}function handleError(_0xa39337,_0x14e812){_0x14e812=_0x14e812||0x1f4;return function(_0x2035f1){logger[_0x0b53('0x25')](_0x2035f1[_0x0b53('0x26')]);if(_0x2035f1[_0x0b53('0x27')]){delete _0x2035f1[_0x0b53('0x27')];}_0xa39337[_0x0b53('0x17')](_0x14e812)['send'](_0x2035f1);};}exports[_0x0b53('0x28')]=function(_0x8f2d23,_0xf967c4){var _0x4fc8d8={},_0x38cdfc={},_0x5e73a7={'count':0x0,'rows':[]};var _0x11fae9=_['map'](db[_0x0b53('0x29')]['rawAttributes'],function(_0x44f9d3){return{'name':_0x44f9d3[_0x0b53('0x2a')],'type':_0x44f9d3['type'][_0x0b53('0x2b')]};});_0x38cdfc['model']=_['map'](_0x11fae9,_0x0b53('0x27'));_0x38cdfc[_0x0b53('0x2c')]=_[_0x0b53('0x2d')](_0x8f2d23['query']);_0x38cdfc[_0x0b53('0x2e')]=_[_0x0b53('0x2f')](_0x38cdfc[_0x0b53('0x30')],_0x38cdfc[_0x0b53('0x2c')]);_0x4fc8d8[_0x0b53('0x31')]=_[_0x0b53('0x2f')](_0x38cdfc[_0x0b53('0x30')],qs[_0x0b53('0x32')](_0x8f2d23[_0x0b53('0x2c')][_0x0b53('0x32')]));_0x4fc8d8[_0x0b53('0x31')]=_0x4fc8d8[_0x0b53('0x31')][_0x0b53('0x33')]?_0x4fc8d8[_0x0b53('0x31')]:_0x38cdfc[_0x0b53('0x30')];if(!_0x8f2d23[_0x0b53('0x2c')][_0x0b53('0x34')]('nolimit')){_0x4fc8d8[_0x0b53('0x1c')]=qs[_0x0b53('0x1c')](_0x8f2d23[_0x0b53('0x2c')][_0x0b53('0x1c')]);_0x4fc8d8['offset']=qs[_0x0b53('0x1a')](_0x8f2d23[_0x0b53('0x2c')][_0x0b53('0x1a')]);}_0x4fc8d8['order']=qs[_0x0b53('0x35')](_0x8f2d23[_0x0b53('0x2c')]['sort']);_0x4fc8d8[_0x0b53('0x36')]=qs[_0x0b53('0x2e')](_[_0x0b53('0x37')](_0x8f2d23['query'],_0x38cdfc['filters']),_0x11fae9);if(_0x8f2d23[_0x0b53('0x2c')][_0x0b53('0x38')]){_0x4fc8d8[_0x0b53('0x36')]=_[_0x0b53('0x39')](_0x4fc8d8[_0x0b53('0x36')],{'$or':_['map'](_0x11fae9,function(_0x476dc8){if(_0x476dc8['type']!==_0x0b53('0x3a')){var _0x2d2917={};_0x2d2917[_0x476dc8[_0x0b53('0x27')]]={'$like':'%'+_0x8f2d23[_0x0b53('0x2c')][_0x0b53('0x38')]+'%'};return _0x2d2917;}})});}_0x4fc8d8=_['merge']({},_0x4fc8d8,_0x8f2d23[_0x0b53('0x3b')]);var _0x307fa3={'where':_0x4fc8d8[_0x0b53('0x36')]};return db[_0x0b53('0x29')][_0x0b53('0x1d')](_0x307fa3)['then'](function(_0x45eca4){_0x5e73a7[_0x0b53('0x1d')]=_0x45eca4;if(_0x8f2d23[_0x0b53('0x2c')]['includeAll']){_0x4fc8d8[_0x0b53('0x3c')]=[{'all':!![]}];}return db[_0x0b53('0x29')][_0x0b53('0x3d')](_0x4fc8d8);})[_0x0b53('0x23')](function(_0x3d4de1){_0x5e73a7[_0x0b53('0x3e')]=_0x3d4de1;return _0x5e73a7;})[_0x0b53('0x23')](respondWithFilteredResult(_0xf967c4,_0x4fc8d8))[_0x0b53('0x3f')](handleError(_0xf967c4,null));};exports[_0x0b53('0x40')]=function(_0x457a7c,_0xbe34c){var _0x5b46fa={'raw':![],'where':{'id':_0x457a7c[_0x0b53('0x41')]['id']}},_0x3b8ab4={};_0x3b8ab4['model']=_[_0x0b53('0x2d')](db['ZohoAccount'][_0x0b53('0x42')]);_0x3b8ab4[_0x0b53('0x2c')]=_['keys'](_0x457a7c[_0x0b53('0x2c')]);_0x3b8ab4['filters']=_['intersection'](_0x3b8ab4[_0x0b53('0x30')],_0x3b8ab4[_0x0b53('0x2c')]);_0x5b46fa[_0x0b53('0x31')]=_[_0x0b53('0x2f')](_0x3b8ab4['model'],qs['fields'](_0x457a7c['query'][_0x0b53('0x32')]));_0x5b46fa[_0x0b53('0x31')]=_0x5b46fa[_0x0b53('0x31')][_0x0b53('0x33')]?_0x5b46fa[_0x0b53('0x31')]:_0x3b8ab4[_0x0b53('0x30')];if(_0x457a7c[_0x0b53('0x2c')][_0x0b53('0x43')]){_0x5b46fa[_0x0b53('0x3c')]=[{'all':!![]}];}_0x5b46fa=_[_0x0b53('0x39')]({},_0x5b46fa,_0x457a7c[_0x0b53('0x3b')]);return db[_0x0b53('0x29')]['find'](_0x5b46fa)[_0x0b53('0x23')](handleEntityNotFound(_0xbe34c,null))[_0x0b53('0x23')](respondWithResult(_0xbe34c,null))['catch'](handleError(_0xbe34c,null));};exports['create']=function(_0xeed9a2,_0x3d2028){return db[_0x0b53('0x29')][_0x0b53('0x44')](_0xeed9a2['body'],{})['then'](respondWithResult(_0x3d2028,0xc9))[_0x0b53('0x3f')](handleError(_0x3d2028,null));};exports['update']=function(_0x15f3b1,_0x147e99){if(_0x15f3b1[_0x0b53('0x45')]['id']){delete _0x15f3b1['body']['id'];}return db[_0x0b53('0x29')][_0x0b53('0x46')]({'where':{'id':_0x15f3b1['params']['id']}})[_0x0b53('0x23')](handleEntityNotFound(_0x147e99,null))['then'](saveUpdates(_0x15f3b1[_0x0b53('0x45')],null))[_0x0b53('0x23')](respondWithResult(_0x147e99,null))[_0x0b53('0x3f')](handleError(_0x147e99,null));};exports[_0x0b53('0x22')]=function(_0x326e1,_0x21ede7){return db[_0x0b53('0x29')][_0x0b53('0x46')]({'where':{'id':_0x326e1[_0x0b53('0x41')]['id']}})[_0x0b53('0x23')](handleEntityNotFound(_0x21ede7,null))['then'](removeEntity(_0x21ede7,null))[_0x0b53('0x3f')](handleError(_0x21ede7,null));};exports[_0x0b53('0x47')]=function(_0x362c93,_0x2d85bc,_0x3934d4){var _0x33460e={};var _0x5c5de7={};var _0x44258f;var _0x4cb2ee;return db[_0x0b53('0x29')][_0x0b53('0x48')]({'where':{'id':_0x362c93[_0x0b53('0x41')]['id']}})[_0x0b53('0x23')](handleEntityNotFound(_0x2d85bc,null))[_0x0b53('0x23')](function(_0x5a2aac){if(_0x5a2aac){_0x44258f=_0x5a2aac;_0x5c5de7[_0x0b53('0x30')]=_[_0x0b53('0x2d')](db[_0x0b53('0x49')]['rawAttributes']);_0x5c5de7[_0x0b53('0x2c')]=_['keys'](_0x362c93[_0x0b53('0x2c')]);_0x5c5de7['filters']=_['intersection'](_0x5c5de7[_0x0b53('0x30')],_0x5c5de7[_0x0b53('0x2c')]);_0x33460e[_0x0b53('0x31')]=_['intersection'](_0x5c5de7[_0x0b53('0x30')],qs[_0x0b53('0x32')](_0x362c93['query'][_0x0b53('0x32')]));_0x33460e[_0x0b53('0x31')]=_0x33460e[_0x0b53('0x31')]['length']?_0x33460e[_0x0b53('0x31')]:_0x5c5de7[_0x0b53('0x30')];_0x33460e[_0x0b53('0x4a')]=qs[_0x0b53('0x35')](_0x362c93[_0x0b53('0x2c')][_0x0b53('0x35')]);_0x33460e[_0x0b53('0x36')]=qs[_0x0b53('0x2e')](_['pick'](_0x362c93['query'],_0x5c5de7[_0x0b53('0x2e')]));if(_0x362c93['query'][_0x0b53('0x38')]){_0x33460e[_0x0b53('0x36')]=_[_0x0b53('0x39')](_0x33460e[_0x0b53('0x36')],{'$or':_[_0x0b53('0x4b')](_0x33460e[_0x0b53('0x31')],function(_0x3d46ad){var _0x435000={};_0x435000[_0x3d46ad]={'$like':'%'+_0x362c93['query'][_0x0b53('0x38')]+'%'};return _0x435000;})});}_0x33460e=_[_0x0b53('0x39')]({},_0x33460e,_0x362c93['options']);return _0x44258f[_0x0b53('0x47')](_0x33460e);}})['then'](function(_0x1e90b4){if(_0x1e90b4){_0x4cb2ee=_0x1e90b4[_0x0b53('0x33')];if(!_0x362c93[_0x0b53('0x2c')]['hasOwnProperty'](_0x0b53('0x4c'))){_0x33460e[_0x0b53('0x1c')]=qs['limit'](_0x362c93[_0x0b53('0x2c')]['limit']);_0x33460e[_0x0b53('0x1a')]=qs['offset'](_0x362c93[_0x0b53('0x2c')][_0x0b53('0x1a')]);}return _0x44258f[_0x0b53('0x47')](_0x33460e);}})[_0x0b53('0x23')](function(_0x1476ce){if(_0x1476ce){return _0x1476ce?{'count':_0x4cb2ee,'rows':_0x1476ce}:null;}})['then'](respondWithResult(_0x2d85bc,null))[_0x0b53('0x3f')](handleError(_0x2d85bc,null));};exports['addConfiguration']=function(_0x38b266,_0x11b5ec,_0x3db018){if(_0x38b266[_0x0b53('0x45')]['id']){delete _0x38b266[_0x0b53('0x45')]['id'];}return db[_0x0b53('0x29')][_0x0b53('0x48')]({'where':{'id':_0x38b266[_0x0b53('0x41')]['id']}})['then'](handleEntityNotFound(_0x11b5ec,null))[_0x0b53('0x23')](function(_0x3346b9){if(_0x3346b9){_0x38b266[_0x0b53('0x45')][_0x0b53('0x4d')]=_0x3346b9['id'];_0x38b266[_0x0b53('0x45')][_0x0b53('0x4e')]=integrations[_0x0b53('0x4f')](_0x38b266['body']['channel'],_0x38b266[_0x0b53('0x45')][_0x0b53('0x50')]);_0x38b266[_0x0b53('0x45')][_0x0b53('0x51')]=integrations[_0x0b53('0x52')](_0x38b266[_0x0b53('0x45')][_0x0b53('0x53')],_0x38b266[_0x0b53('0x45')][_0x0b53('0x50')]);return db[_0x0b53('0x49')]['create'](_0x38b266[_0x0b53('0x45')],{'include':[{'model':db[_0x0b53('0x54')],'as':'Subjects'},{'model':db[_0x0b53('0x54')],'as':_0x0b53('0x51')}]});}return null;})[_0x0b53('0x23')](respondWithResult(_0x11b5ec,null))[_0x0b53('0x3f')](handleError(_0x11b5ec,null));};function getAccessToken(_0x4bf9c2){return new Promise(function(_0x509c37,_0x2886b2){var _0x139e36;switch(_0x4bf9c2['zone']){case'US':_0x139e36=_0x0b53('0x55');break;case'AU':_0x139e36='https://accounts.zoho.com.au';break;case'EU':_0x139e36='https://accounts.zoho.eu';break;case'IN':_0x139e36=_0x0b53('0x56');break;case'CN':_0x139e36=_0x0b53('0x57');break;default:_0x139e36=_0x0b53('0x58');break;}var _0x2211c9={'method':_0x0b53('0x59'),'uri':_0x139e36+_0x0b53('0x5a'),'qs':{'refresh_token':_0x4bf9c2[_0x0b53('0x5b')],'client_id':_0x4bf9c2[_0x0b53('0x5c')],'client_secret':_0x4bf9c2[_0x0b53('0x5d')],'grant_type':_0x0b53('0x5e')},'json':!![]};return rp(_0x2211c9)[_0x0b53('0x23')](function(_0x3e8230){if(_0x3e8230[_0x0b53('0x5f')]){_0x509c37(_0x3e8230['access_token']);}else{_0x2886b2('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x0b53('0x3f')](function(_0x299b95){_0x2886b2(_0x299b95);});});}exports[_0x0b53('0x60')]=function(_0x2c1fde,_0xc70d79,_0x1d9ac0){var _0x3ebd8a,_0x51469e,_0x39ba4e,_0x4e161d,_0x295325;return db[_0x0b53('0x29')][_0x0b53('0x48')]({'where':{'id':_0x2c1fde[_0x0b53('0x41')]['id']},'attributes':['id',_0x0b53('0x61'),'zone',_0x0b53('0x5c'),_0x0b53('0x5d'),_0x0b53('0x62'),'code',_0x0b53('0x5b')]})[_0x0b53('0x23')](handleEntityNotFound(_0xc70d79,null))[_0x0b53('0x23')](function(_0x2a92c4){_0x295325=_0x2a92c4;_0x3ebd8a=_0x295325['host'];_0x51469e=_0x3ebd8a===_0x0b53('0x63')?'eu':'com';_0x39ba4e=_0x295325[_0x0b53('0x62')];var _0x5cdf31=_0x39ba4e[_0x0b53('0x64')](-0x1);if(_0x5cdf31==='/'||_0x5cdf31==='\x5c'||_0x5cdf31===':'){_0x39ba4e=_0x39ba4e[_0x0b53('0x65')](0x0,_0x39ba4e[_0x0b53('0x66')](_0x5cdf31));}if(!_0x295325[_0x0b53('0x5b')]){throw new Error(_0x0b53('0x67'));}return getAccessToken(_0x295325);})['then'](function(_0x1bcb8a){if(_0x1bcb8a){return rp({'method':'GET','uri':util['format'](_0x0b53('0x68'),_0x51469e),'qs':{'module':_0x0b53('0x69')},'headers':{'Authorization':_0x0b53('0x6a')+_0x1bcb8a},'json':!![]});}})[_0x0b53('0x23')](function(_0x2c3dbf){if(_0x2c3dbf){if(_0x2c3dbf[_0x0b53('0x6b')]&&_0x2c3dbf[_0x0b53('0x6b')]['error']){throw new Error(_0x2c3dbf[_0x0b53('0x6b')][_0x0b53('0x25')][_0x0b53('0x6c')]);}var _0x1e8bba=[];var _0x3eaecd=[];var _0x574bcd=['Owner',_0x0b53('0x6d'),_0x0b53('0x6e'),_0x0b53('0x6f'),_0x0b53('0x70'),_0x0b53('0x71'),'Call_Start_Time',_0x0b53('0x72')];_0x3eaecd=_[_0x0b53('0x73')](_0x2c3dbf[_0x0b53('0x32')],function(_0x2e4e04){return _0x574bcd[_0x0b53('0x74')](_0x2e4e04[_0x0b53('0x75')]);});for(var _0x409c84=0x0;_0x409c84<_0x3eaecd['length'];_0x409c84++){if(_0x3eaecd[_0x409c84][_0x0b53('0x76')]===![]){_0x1e8bba[_0x0b53('0x77')]({'id':_0x3eaecd[_0x409c84]['id'],'name':_0x3eaecd[_0x409c84][_0x0b53('0x78')],'custom':_0x3eaecd[_0x409c84][_0x0b53('0x79')],'options':_0x3eaecd[_0x409c84][_0x0b53('0x7a')]===_0x0b53('0x7b')&&_0x3eaecd[_0x409c84]['pick_list_values'][_0x0b53('0x33')]>-0x1?_[_0x0b53('0x4b')](_0x3eaecd[_0x409c84][_0x0b53('0x7c')],function(_0x4363ff){return{'name':_0x4363ff,'value':_0x4363ff};}):[]});}}return{'count':_0x1e8bba[_0x0b53('0x33')],'rows':_0x1e8bba};}else{return{'count':0x0,'rows':[]};}})[_0x0b53('0x23')](respondWithResult(_0xc70d79,null))[_0x0b53('0x3f')](function(_0x3fae12){var _0x4f16cf=_0x2c1fde[_0x0b53('0x2c')][_0x0b53('0x7d')]?0x1f4:_0x3fae12['statusCode']||0x1f4;logger[_0x0b53('0x25')](_0x0b53('0x7e'),'getFields',_0x4f16cf,JSON[_0x0b53('0x7f')](_0x3fae12));delete _0x3fae12[_0x0b53('0x27')];if(_0x4f16cf===0x191){_0x4f16cf=0x190;}_0xc70d79['status'](_0x4f16cf)[_0x0b53('0x80')](_0x2c1fde['query'][_0x0b53('0x7d')]?{'message':_0x0b53('0x81'),'statusCode':_0x3fae12[_0x0b53('0x82')]}:_0x3fae12);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f87023c..cf4dd3d 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 _0x164a=['../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','lastIndexOf','application/x-www-form-urlencoded','catch','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x164a,0x133));var _0xa164=function(_0x39507b,_0x3efdac){_0x39507b=_0x39507b-0x0;var _0x5e7dd4=_0x164a[_0x39507b];return _0x5e7dd4;};'use strict';var _=require('lodash');var util=require(_0xa164('0x0'));var logger=require(_0xa164('0x1'))(_0xa164('0x2'));var moment=require('moment');var BPromise=require(_0xa164('0x3'));var rp=require(_0xa164('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa164('0x5'));var attributes=require(_0xa164('0x6'));var integrations=require(_0xa164('0x7'));module['exports']=function(_0x2d3b78,_0x371844){return _0x2d3b78[_0xa164('0x8')]('ZohoAccount',attributes,{'tableName':_0xa164('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e3a38,_0x380674,_0x4f3dab){if(_0x2e3a38[_0xa164('0xa')](_0xa164('0xb'))||_0x2e3a38[_0xa164('0xa')]('serverUrl')||_0x2e3a38[_0xa164('0xa')](_0xa164('0xc'))||_0x2e3a38[_0xa164('0xa')](_0xa164('0xd'))||_0x2e3a38['changed'](_0xa164('0xe'))||_0x2e3a38[_0xa164('0xa')](_0xa164('0xf'))){var _0x34ee60,_0x5cf865;_0x34ee60=_0x2e3a38[_0xa164('0x10')];var _0x336086=_0x34ee60['slice'](-0x1);if(_0x336086==='/'||_0x336086==='\x5c'||_0x336086===':'){_0x34ee60=_0x34ee60[_0xa164('0x11')](0x0,_0x34ee60['lastIndexOf'](_0x336086));}switch(_0x2e3a38[_0xa164('0xb')]){case'US':_0x5cf865=_0xa164('0x12');break;case'AU':_0x5cf865=_0xa164('0x13');break;case'IN':_0x5cf865=_0xa164('0x14');break;case'CN':_0x5cf865=_0xa164('0x15');break;default:_0x5cf865='https://accounts.zoho.eu';break;}var _0x358352={'method':_0xa164('0x16'),'uri':_0x5cf865+_0xa164('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x2e3a38[_0xa164('0xc')],'client_secret':_0x2e3a38['clientSecret'],'redirect_uri':_0x2e3a38[_0xa164('0x10')],'code':_0x2e3a38[_0xa164('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x358352)[_0xa164('0x18')](function(_0x360eb3){var _0x15da95=JSON[_0xa164('0x19')](_0x360eb3);if(_0x15da95['refresh_token']){_0x2e3a38[_0xa164('0x1a')]=_0x15da95[_0xa164('0x1b')];logger[_0xa164('0x1c')](util[_0xa164('0x1d')](_0xa164('0x1e'),_0x2e3a38[_0xa164('0x1f')],_0x2e3a38['id']));}else{logger[_0xa164('0x20')](util['format'](_0xa164('0x21'),_0x2e3a38[_0xa164('0x1f')],_0x2e3a38['id']),util[_0xa164('0x22')](_0x15da95,{'showHidden':![],'depth':null}));}return _0x4f3dab(null,_0x380674);})['catch'](function(_0xedeee5){logger[_0xa164('0x20')](util[_0xa164('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2e3a38[_0xa164('0x1f')],_0x2e3a38['id']),util[_0xa164('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x4f3dab(_0xedeee5);});}else{return _0x4f3dab(null,_0x380674);}},'beforeUpdate':function(_0x4e7328,_0x4a70b2,_0x1d4252){if(_0x4e7328[_0xa164('0xa')](_0xa164('0xb'))||_0x4e7328[_0xa164('0xa')](_0xa164('0x10'))||_0x4e7328['changed'](_0xa164('0xc'))||_0x4e7328[_0xa164('0xa')]('clientSecret')||_0x4e7328[_0xa164('0xa')](_0xa164('0xe'))||_0x4e7328[_0xa164('0xa')](_0xa164('0xf'))){var _0x1cf512,_0x581918;_0x1cf512=_0x4e7328[_0xa164('0x10')];var _0x2eaf50=_0x1cf512[_0xa164('0x23')](-0x1);if(_0x2eaf50==='/'||_0x2eaf50==='\x5c'||_0x2eaf50===':'){_0x1cf512=_0x1cf512[_0xa164('0x11')](0x0,_0x1cf512[_0xa164('0x24')](_0x2eaf50));}switch(_0x4e7328[_0xa164('0xb')]){case'US':_0x581918=_0xa164('0x12');break;case'AU':_0x581918=_0xa164('0x13');break;case'IN':_0x581918='https://accounts.zoho.in';break;case'CN':_0x581918=_0xa164('0x15');break;default:_0x581918='https://accounts.zoho.eu';break;}var _0x37c4b1={'method':_0xa164('0x16'),'uri':_0x581918+_0xa164('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x4e7328[_0xa164('0xc')],'client_secret':_0x4e7328[_0xa164('0xd')],'redirect_uri':_0x4e7328[_0xa164('0x10')],'code':_0x4e7328[_0xa164('0xe')]},'headers':{'Content-Type':_0xa164('0x25')}};return rp(_0x37c4b1)['then'](function(_0x50005a){var _0x3946cd=JSON[_0xa164('0x19')](_0x50005a);if(_0x3946cd[_0xa164('0x1b')]){_0x4e7328['refreshToken']=_0x3946cd['refresh_token'];logger['info'](util[_0xa164('0x1d')](_0xa164('0x1e'),_0x4e7328[_0xa164('0x1f')],_0x4e7328['id']));}else{logger[_0xa164('0x20')](util[_0xa164('0x1d')](_0xa164('0x21'),_0x4e7328[_0xa164('0x1f')],_0x4e7328['id']),util[_0xa164('0x22')](_0x3946cd,{'showHidden':![],'depth':null}));}return _0x1d4252(null,_0x4a70b2);})[_0xa164('0x26')](function(_0x36753f){logger[_0xa164('0x20')](util[_0xa164('0x1d')](_0xa164('0x21'),_0x4e7328[_0xa164('0x1f')],_0x4e7328['id']),util[_0xa164('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x1d4252(_0x36753f);});}else{return _0x1d4252(null,_0x4a70b2);}}}});}; \ No newline at end of file +var _0xfd5c=['slice','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','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','host'];(function(_0x4c20f9,_0x355209){var _0x4cdb61=function(_0x9fd172){while(--_0x9fd172){_0x4c20f9['push'](_0x4c20f9['shift']());}};_0x4cdb61(++_0x355209);}(_0xfd5c,0x143));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcfd5('0x0'));var util=require(_0xcfd5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcfd5('0x2'));var BPromise=require(_0xcfd5('0x3'));var rp=require(_0xcfd5('0x4'));var fs=require('fs');var path=require(_0xcfd5('0x5'));var rimraf=require(_0xcfd5('0x6'));var config=require(_0xcfd5('0x7'));var attributes=require(_0xcfd5('0x8'));var integrations=require(_0xcfd5('0x9'));module[_0xcfd5('0xa')]=function(_0x4c32d3,_0x2ab5ae){return _0x4c32d3[_0xcfd5('0xb')](_0xcfd5('0xc'),attributes,{'tableName':_0xcfd5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4477a1,_0x5b8958,_0x839677){if(_0x4477a1['changed'](_0xcfd5('0xe'))||_0x4477a1[_0xcfd5('0xf')](_0xcfd5('0x10'))||_0x4477a1[_0xcfd5('0xf')](_0xcfd5('0x11'))||_0x4477a1[_0xcfd5('0xf')](_0xcfd5('0x12'))||_0x4477a1[_0xcfd5('0xf')](_0xcfd5('0x13'))||_0x4477a1['changed'](_0xcfd5('0x14'))){var _0x4d2e6f,_0x1717f8;_0x4d2e6f=_0x4477a1[_0xcfd5('0x10')];var _0x5c02f0=_0x4d2e6f[_0xcfd5('0x15')](-0x1);if(_0x5c02f0==='/'||_0x5c02f0==='\x5c'||_0x5c02f0===':'){_0x4d2e6f=_0x4d2e6f['substring'](0x0,_0x4d2e6f[_0xcfd5('0x16')](_0x5c02f0));}switch(_0x4477a1[_0xcfd5('0xe')]){case'US':_0x1717f8=_0xcfd5('0x17');break;case'AU':_0x1717f8=_0xcfd5('0x18');break;case'IN':_0x1717f8=_0xcfd5('0x19');break;case'CN':_0x1717f8=_0xcfd5('0x1a');break;default:_0x1717f8=_0xcfd5('0x1b');break;}var _0x162ae6={'method':_0xcfd5('0x1c'),'uri':_0x1717f8+_0xcfd5('0x1d'),'form':{'grant_type':_0xcfd5('0x1e'),'client_id':_0x4477a1[_0xcfd5('0x11')],'client_secret':_0x4477a1[_0xcfd5('0x12')],'redirect_uri':_0x4477a1[_0xcfd5('0x10')],'code':_0x4477a1[_0xcfd5('0x13')]},'headers':{'Content-Type':_0xcfd5('0x1f')}};return rp(_0x162ae6)[_0xcfd5('0x20')](function(_0x189206){var _0x690a6a=JSON[_0xcfd5('0x21')](_0x189206);if(_0x690a6a['refresh_token']){_0x4477a1['refreshToken']=_0x690a6a[_0xcfd5('0x22')];logger[_0xcfd5('0x23')](util[_0xcfd5('0x24')](_0xcfd5('0x25'),_0x4477a1[_0xcfd5('0x26')],_0x4477a1['id']));}else{logger[_0xcfd5('0x27')](util[_0xcfd5('0x24')](_0xcfd5('0x28'),_0x4477a1[_0xcfd5('0x26')],_0x4477a1['id']),util['inspect'](_0x690a6a,{'showHidden':![],'depth':null}));}return _0x839677(null,_0x5b8958);})[_0xcfd5('0x29')](function(_0x317e26){logger[_0xcfd5('0x27')](util[_0xcfd5('0x24')](_0xcfd5('0x28'),_0x4477a1['name'],_0x4477a1['id']),util[_0xcfd5('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x839677(_0x317e26);});}else{return _0x839677(null,_0x5b8958);}},'beforeUpdate':function(_0x7f669d,_0x232273,_0x108ce5){if(_0x7f669d[_0xcfd5('0xf')](_0xcfd5('0xe'))||_0x7f669d[_0xcfd5('0xf')]('serverUrl')||_0x7f669d[_0xcfd5('0xf')](_0xcfd5('0x11'))||_0x7f669d[_0xcfd5('0xf')]('clientSecret')||_0x7f669d[_0xcfd5('0xf')]('code')||_0x7f669d['changed'](_0xcfd5('0x14'))){var _0x127d86,_0x3953dd;_0x127d86=_0x7f669d[_0xcfd5('0x10')];var _0x2d6d8f=_0x127d86['slice'](-0x1);if(_0x2d6d8f==='/'||_0x2d6d8f==='\x5c'||_0x2d6d8f===':'){_0x127d86=_0x127d86['substring'](0x0,_0x127d86[_0xcfd5('0x16')](_0x2d6d8f));}switch(_0x7f669d['zone']){case'US':_0x3953dd=_0xcfd5('0x17');break;case'AU':_0x3953dd=_0xcfd5('0x18');break;case'IN':_0x3953dd=_0xcfd5('0x19');break;case'CN':_0x3953dd='https://accounts.zoho.com.cn';break;default:_0x3953dd=_0xcfd5('0x1b');break;}var _0x1f475e={'method':_0xcfd5('0x1c'),'uri':_0x3953dd+_0xcfd5('0x1d'),'form':{'grant_type':_0xcfd5('0x1e'),'client_id':_0x7f669d[_0xcfd5('0x11')],'client_secret':_0x7f669d[_0xcfd5('0x12')],'redirect_uri':_0x7f669d[_0xcfd5('0x10')],'code':_0x7f669d[_0xcfd5('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1f475e)[_0xcfd5('0x20')](function(_0x41e04c){var _0x3bc347=JSON[_0xcfd5('0x21')](_0x41e04c);if(_0x3bc347[_0xcfd5('0x22')]){_0x7f669d['refreshToken']=_0x3bc347[_0xcfd5('0x22')];logger['info'](util[_0xcfd5('0x24')](_0xcfd5('0x25'),_0x7f669d[_0xcfd5('0x26')],_0x7f669d['id']));}else{logger[_0xcfd5('0x27')](util[_0xcfd5('0x24')](_0xcfd5('0x28'),_0x7f669d['name'],_0x7f669d['id']),util[_0xcfd5('0x2a')](_0x3bc347,{'showHidden':![],'depth':null}));}return _0x108ce5(null,_0x232273);})[_0xcfd5('0x29')](function(_0x436af4){logger[_0xcfd5('0x27')](util[_0xcfd5('0x24')](_0xcfd5('0x28'),_0x7f669d[_0xcfd5('0x26')],_0x7f669d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x108ce5(_0x436af4);});}else{return _0x108ce5(null,_0x232273);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2cc972e..01dcf54 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 _0x36fe=['result','catch','ZohoAccount','findAll','options','where','limit','map','model','attributes','include','debug','GetZohoAccount','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x13a811,_0x5833e5){var _0x67c0a4=function(_0x57f867){while(--_0x57f867){_0x13a811['push'](_0x13a811['shift']());}};_0x67c0a4(++_0x5833e5);}(_0x36fe,0x127));var _0xe36f=function(_0xf64e5,_0x4a3232){_0xf64e5=_0xf64e5-0x0;var _0x5f312c=_0x36fe[_0xf64e5];return _0x5f312c;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var moment=require(_0xe36f('0x2'));var BPromise=require(_0xe36f('0x3'));var rs=require(_0xe36f('0x4'));var fs=require('fs');var Redis=require(_0xe36f('0x5'));var db=require(_0xe36f('0x6'))['db'];var utils=require(_0xe36f('0x7'));var logger=require(_0xe36f('0x8'))(_0xe36f('0x9'));var config=require(_0xe36f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe36f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349c9e,_0xdae131,_0x5a0d3c){return new BPromise(function(_0x1ecd6b,_0x21f2a5){return client['request'](_0x349c9e,_0x5a0d3c)[_0xe36f('0xc')](function(_0x386c00){logger[_0xe36f('0xd')](_0xe36f('0xe'),_0xdae131,_0xe36f('0xf'));logger['debug'](_0xe36f('0x10'),_0xdae131,'request\x20sent',JSON[_0xe36f('0x11')](_0x386c00));if(_0x386c00[_0xe36f('0x12')]){if(_0x386c00[_0xe36f('0x12')]['code']===0x1f4){logger[_0xe36f('0x12')](_0xe36f('0xe'),_0xdae131,_0x386c00['error'][_0xe36f('0x13')]);return _0x21f2a5(_0x386c00[_0xe36f('0x12')][_0xe36f('0x13')]);}logger[_0xe36f('0x12')]('ZohoAccount,\x20%s,\x20%s',_0xdae131,_0x386c00[_0xe36f('0x12')][_0xe36f('0x13')]);return _0x1ecd6b(_0x386c00[_0xe36f('0x12')]['message']);}else{logger[_0xe36f('0xd')](_0xe36f('0xe'),_0xdae131,'request\x20sent');_0x1ecd6b(_0x386c00[_0xe36f('0x14')][_0xe36f('0x13')]);}})[_0xe36f('0x15')](function(_0x3f8f9f){logger[_0xe36f('0x12')](_0xe36f('0xe'),_0xdae131,_0x3f8f9f);_0x21f2a5(_0x3f8f9f);});});}exports['GetZohoAccount']=function(_0x4d9df2){var _0x518a22=this;return new Promise(function(_0x5aed4f,_0x1c47de){return db[_0xe36f('0x16')][_0xe36f('0x17')]({'raw':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2[_0xe36f('0x18')][_0xe36f('0x19')]||null:null,'attributes':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2[_0xe36f('0x18')]['attributes']||null:null,'limit':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2['options'][_0xe36f('0x1a')]||null:null,'include':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2[_0xe36f('0x18')]['include']?_[_0xe36f('0x1b')](_0x4d9df2[_0xe36f('0x18')]['include'],function(_0xfd3899){return{'model':db[_0xfd3899[_0xe36f('0x1c')]],'as':_0xfd3899['as'],'attributes':_0xfd3899[_0xe36f('0x1d')],'include':_0xfd3899['include']?_['map'](_0xfd3899[_0xe36f('0x1e')],function(_0x35ef46){return{'model':db[_0x35ef46['model']],'as':_0x35ef46['as'],'attributes':_0x35ef46[_0xe36f('0x1d')],'include':_0x35ef46['include']?_[_0xe36f('0x1b')](_0x35ef46[_0xe36f('0x1e')],function(_0x196183){return{'model':db[_0x196183[_0xe36f('0x1c')]],'as':_0x196183['as'],'attributes':_0x196183[_0xe36f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe36f('0xc')](function(_0x403c8a){logger[_0xe36f('0xd')]('GetZohoAccount',_0x4d9df2);logger[_0xe36f('0x1f')]('GetZohoAccount',_0x4d9df2,JSON[_0xe36f('0x11')](_0x403c8a));_0x5aed4f(_0x403c8a);})[_0xe36f('0x15')](function(_0x471b91){logger[_0xe36f('0x12')](_0xe36f('0x20'),_0x471b91['message'],_0x4d9df2);_0x1c47de(_0x518a22[_0xe36f('0x12')](0x1f4,_0x471b91[_0xe36f('0x13')]));});});};exports[_0xe36f('0x21')]=function(_0x198132){var _0x17be47=this;return new Promise(function(_0x29c888,_0x4914c5){return db['ZohoAccount'][_0xe36f('0x22')]({'raw':_0x198132[_0xe36f('0x18')]?_0x198132[_0xe36f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x198132[_0xe36f('0x18')]?_0x198132['options'][_0xe36f('0x19')]||null:null,'attributes':_0x198132['options']?_0x198132[_0xe36f('0x18')]['attributes']||null:null,'include':_0x198132[_0xe36f('0x18')]?_0x198132['options'][_0xe36f('0x1e')]?_['map'](_0x198132[_0xe36f('0x18')][_0xe36f('0x1e')],function(_0x5bb1e7){return{'model':db[_0x5bb1e7[_0xe36f('0x1c')]],'as':_0x5bb1e7['as'],'attributes':_0x5bb1e7[_0xe36f('0x1d')],'include':_0x5bb1e7[_0xe36f('0x1e')]?_[_0xe36f('0x1b')](_0x5bb1e7[_0xe36f('0x1e')],function(_0x566702){return{'model':db[_0x566702['model']],'as':_0x566702['as'],'attributes':_0x566702[_0xe36f('0x1d')],'include':_0x566702[_0xe36f('0x1e')]?_[_0xe36f('0x1b')](_0x566702['include'],function(_0x251890){return{'model':db[_0x251890['model']],'as':_0x251890['as'],'attributes':_0x251890[_0xe36f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe36f('0xc')](function(_0xaf0959){logger[_0xe36f('0xd')]('ShowZohoAccount',_0x198132);logger['debug'](_0xe36f('0x21'),_0x198132,JSON['stringify'](_0xaf0959));_0x29c888(_0xaf0959);})[_0xe36f('0x15')](function(_0x8e563a){logger[_0xe36f('0x12')](_0xe36f('0x21'),_0x8e563a[_0xe36f('0x13')],_0x198132);_0x4914c5(_0x17be47[_0xe36f('0x12')](0x1f4,_0x8e563a[_0xe36f('0x13')]));});});}; \ No newline at end of file +var _0xcd2f=['GetZohoAccount','find','ShowZohoAccount','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','result','catch','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x49d473,_0x38b721){var _0x4ad491=function(_0x5e0291){while(--_0x5e0291){_0x49d473['push'](_0x49d473['shift']());}};_0x4ad491(++_0x38b721);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcd2f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfcd2('0x0'));var rs=require(_0xfcd2('0x1'));var fs=require('fs');var Redis=require(_0xfcd2('0x2'));var db=require(_0xfcd2('0x3'))['db'];var utils=require(_0xfcd2('0x4'));var logger=require(_0xfcd2('0x5'))(_0xfcd2('0x6'));var config=require(_0xfcd2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcd2('0x8')][_0xfcd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41e836,_0x20ac59,_0x467e4f){return new BPromise(function(_0x13d9fa,_0xae2219){return client[_0xfcd2('0xa')](_0x41e836,_0x467e4f)[_0xfcd2('0xb')](function(_0x358fb4){logger[_0xfcd2('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x20ac59,_0xfcd2('0xd'));logger[_0xfcd2('0xe')](_0xfcd2('0xf'),_0x20ac59,_0xfcd2('0xd'),JSON[_0xfcd2('0x10')](_0x358fb4));if(_0x358fb4['error']){if(_0x358fb4['error']['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x20ac59,_0x358fb4[_0xfcd2('0x11')][_0xfcd2('0x12')]);return _0xae2219(_0x358fb4['error'][_0xfcd2('0x12')]);}logger[_0xfcd2('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x20ac59,_0x358fb4['error'][_0xfcd2('0x12')]);return _0x13d9fa(_0x358fb4[_0xfcd2('0x11')][_0xfcd2('0x12')]);}else{logger[_0xfcd2('0xc')](_0xfcd2('0x13'),_0x20ac59,'request\x20sent');_0x13d9fa(_0x358fb4[_0xfcd2('0x14')][_0xfcd2('0x12')]);}})[_0xfcd2('0x15')](function(_0x34aa38){logger[_0xfcd2('0x11')](_0xfcd2('0x13'),_0x20ac59,_0x34aa38);_0xae2219(_0x34aa38);});});}exports['GetZohoAccount']=function(_0xba3186){var _0x268e00=this;return new Promise(function(_0x32607c,_0x2c4b8f){return db[_0xfcd2('0x16')][_0xfcd2('0x17')]({'raw':_0xba3186[_0xfcd2('0x18')]?_0xba3186[_0xfcd2('0x18')][_0xfcd2('0x19')]===undefined?!![]:![]:!![],'where':_0xba3186[_0xfcd2('0x18')]?_0xba3186[_0xfcd2('0x18')][_0xfcd2('0x1a')]||null:null,'attributes':_0xba3186['options']?_0xba3186[_0xfcd2('0x18')][_0xfcd2('0x1b')]||null:null,'limit':_0xba3186[_0xfcd2('0x18')]?_0xba3186[_0xfcd2('0x18')][_0xfcd2('0x1c')]||null:null,'include':_0xba3186[_0xfcd2('0x18')]?_0xba3186[_0xfcd2('0x18')][_0xfcd2('0x1d')]?_[_0xfcd2('0x1e')](_0xba3186['options'][_0xfcd2('0x1d')],function(_0x50c0cc){return{'model':db[_0x50c0cc[_0xfcd2('0x1f')]],'as':_0x50c0cc['as'],'attributes':_0x50c0cc[_0xfcd2('0x1b')],'include':_0x50c0cc['include']?_['map'](_0x50c0cc[_0xfcd2('0x1d')],function(_0xe7fde9){return{'model':db[_0xe7fde9[_0xfcd2('0x1f')]],'as':_0xe7fde9['as'],'attributes':_0xe7fde9[_0xfcd2('0x1b')],'include':_0xe7fde9['include']?_[_0xfcd2('0x1e')](_0xe7fde9[_0xfcd2('0x1d')],function(_0x13e447){return{'model':db[_0x13e447[_0xfcd2('0x1f')]],'as':_0x13e447['as'],'attributes':_0x13e447['attributes']};}):[]};}):[]};}):[]:[]})[_0xfcd2('0xb')](function(_0x5a2b6b){logger[_0xfcd2('0xc')](_0xfcd2('0x20'),_0xba3186);logger['debug'](_0xfcd2('0x20'),_0xba3186,JSON[_0xfcd2('0x10')](_0x5a2b6b));_0x32607c(_0x5a2b6b);})[_0xfcd2('0x15')](function(_0x4bffa9){logger[_0xfcd2('0x11')](_0xfcd2('0x20'),_0x4bffa9[_0xfcd2('0x12')],_0xba3186);_0x2c4b8f(_0x268e00['error'](0x1f4,_0x4bffa9['message']));});});};exports['ShowZohoAccount']=function(_0xfe01e3){var _0x29a44f=this;return new Promise(function(_0x59b583,_0x5b7555){return db[_0xfcd2('0x16')][_0xfcd2('0x21')]({'raw':_0xfe01e3[_0xfcd2('0x18')]?_0xfe01e3[_0xfcd2('0x18')][_0xfcd2('0x19')]===undefined?!![]:![]:!![],'where':_0xfe01e3[_0xfcd2('0x18')]?_0xfe01e3[_0xfcd2('0x18')]['where']||null:null,'attributes':_0xfe01e3['options']?_0xfe01e3[_0xfcd2('0x18')]['attributes']||null:null,'include':_0xfe01e3[_0xfcd2('0x18')]?_0xfe01e3[_0xfcd2('0x18')][_0xfcd2('0x1d')]?_[_0xfcd2('0x1e')](_0xfe01e3[_0xfcd2('0x18')][_0xfcd2('0x1d')],function(_0x2fd4c3){return{'model':db[_0x2fd4c3[_0xfcd2('0x1f')]],'as':_0x2fd4c3['as'],'attributes':_0x2fd4c3[_0xfcd2('0x1b')],'include':_0x2fd4c3['include']?_[_0xfcd2('0x1e')](_0x2fd4c3[_0xfcd2('0x1d')],function(_0x3158a6){return{'model':db[_0x3158a6[_0xfcd2('0x1f')]],'as':_0x3158a6['as'],'attributes':_0x3158a6['attributes'],'include':_0x3158a6['include']?_[_0xfcd2('0x1e')](_0x3158a6[_0xfcd2('0x1d')],function(_0x4e6db5){return{'model':db[_0x4e6db5[_0xfcd2('0x1f')]],'as':_0x4e6db5['as'],'attributes':_0x4e6db5['attributes']};}):[]};}):[]};}):[]:[]})[_0xfcd2('0xb')](function(_0x243879){logger['info'](_0xfcd2('0x22'),_0xfe01e3);logger['debug'](_0xfcd2('0x22'),_0xfe01e3,JSON['stringify'](_0x243879));_0x59b583(_0x243879);})[_0xfcd2('0x15')](function(_0x3a7d19){logger[_0xfcd2('0x11')]('ShowZohoAccount',_0x3a7d19[_0xfcd2('0x12')],_0xfe01e3);_0x5b7555(_0x29a44f[_0xfcd2('0x11')](0x1f4,_0x3a7d19[_0xfcd2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index eacee68..08c917b 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 _0xeec8=['put','/:id','update','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','index','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0xeec8,0xb7));var _0x8eec=function(_0x4ed4fe,_0x35fd46){_0x4ed4fe=_0x4ed4fe-0x0;var _0x53d41b=_0xeec8[_0x4ed4fe];return _0x53d41b;};'use strict';var multer=require(_0x8eec('0x0'));var util=require(_0x8eec('0x1'));var path=require(_0x8eec('0x2'));var timeout=require('connect-timeout');var express=require(_0x8eec('0x3'));var router=express['Router']();var fs_extra=require(_0x8eec('0x4'));var auth=require(_0x8eec('0x5'));var interaction=require(_0x8eec('0x6'));var config=require('../../config/environment');var controller=require(_0x8eec('0x7'));router[_0x8eec('0x8')]('/',auth['isAuthenticated'](),controller[_0x8eec('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth[_0x8eec('0xa')](),controller[_0x8eec('0xb')]);router[_0x8eec('0x8')](_0x8eec('0xc'),auth[_0x8eec('0xa')](),controller[_0x8eec('0xd')]);router[_0x8eec('0x8')]('/:id/descriptions',auth[_0x8eec('0xa')](),controller[_0x8eec('0xe')]);router['post']('/',auth[_0x8eec('0xa')](),controller['create']);router[_0x8eec('0xf')](_0x8eec('0x10'),auth['isAuthenticated'](),controller[_0x8eec('0x11')]);router['delete'](_0x8eec('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9bab=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','index','get','/:id','isAuthenticated'];(function(_0x1dea9a,_0x42dc04){var _0x2185d0=function(_0x5015ec){while(--_0x5015ec){_0x1dea9a['push'](_0x1dea9a['shift']());}};_0x2185d0(++_0x42dc04);}(_0x9bab,0x1ed));var _0xb9ba=function(_0x469015,_0x4411c9){_0x469015=_0x469015-0x0;var _0x1c0419=_0x9bab[_0x469015];return _0x1c0419;};'use strict';var multer=require(_0xb9ba('0x0'));var util=require(_0xb9ba('0x1'));var path=require('path');var timeout=require(_0xb9ba('0x2'));var express=require(_0xb9ba('0x3'));var router=express[_0xb9ba('0x4')]();var fs_extra=require(_0xb9ba('0x5'));var auth=require(_0xb9ba('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb9ba('0x7'));var controller=require(_0xb9ba('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb9ba('0x9')]);router[_0xb9ba('0xa')](_0xb9ba('0xb'),auth[_0xb9ba('0xc')](),controller[_0xb9ba('0xd')]);router[_0xb9ba('0xa')]('/:id/fields',auth[_0xb9ba('0xc')](),controller[_0xb9ba('0xe')]);router[_0xb9ba('0xa')](_0xb9ba('0xf'),auth[_0xb9ba('0xc')](),controller[_0xb9ba('0x10')]);router[_0xb9ba('0xa')](_0xb9ba('0x11'),auth[_0xb9ba('0xc')](),controller[_0xb9ba('0x12')]);router['post']('/',auth[_0xb9ba('0xc')](),controller[_0xb9ba('0x13')]);router[_0xb9ba('0x14')](_0xb9ba('0xb'),auth[_0xb9ba('0xc')](),controller[_0xb9ba('0x15')]);router['delete'](_0xb9ba('0xb'),auth[_0xb9ba('0xc')](),controller[_0xb9ba('0x16')]);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 e814f19..5a7f7ec 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 _0x0488=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x61009e,_0x4602f9){var _0x279684=function(_0x5ae13e){while(--_0x5ae13e){_0x61009e['push'](_0x61009e['shift']());}};_0x279684(++_0x4602f9);}(_0x0488,0x17d));var _0x8048=function(_0x263d4a,_0x1a568c){_0x263d4a=_0x263d4a-0x0;var _0x5bb3d6=_0x0488[_0x263d4a];return _0x5bb3d6;};'use strict';var Sequelize=require(_0x8048('0x0'));module[_0x8048('0x1')]={'name':{'type':Sequelize[_0x8048('0x2')]},'moduleCreate':{'type':Sequelize[_0x8048('0x3')](_0x8048('0x4'),_0x8048('0x5'),_0x8048('0x6')),'defaultValue':_0x8048('0x4')},'moduleSearch':{'type':Sequelize[_0x8048('0x3')](_0x8048('0x7'),_0x8048('0x5'),'lead'),'defaultValue':_0x8048('0x7')},'description':{'type':Sequelize[_0x8048('0x2')]}}; \ No newline at end of file +var _0x0503=['exports','STRING','lead','contact','nothing','contact_lead','sequelize'];(function(_0x4db6af,_0x79e89e){var _0x1a7240=function(_0x551b9f){while(--_0x551b9f){_0x4db6af['push'](_0x4db6af['shift']());}};_0x1a7240(++_0x79e89e);}(_0x0503,0x179));var _0x3050=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x0503[_0x1477ef];return _0x164acd;};'use strict';var Sequelize=require(_0x3050('0x0'));module[_0x3050('0x1')]={'name':{'type':Sequelize[_0x3050('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x3050('0x3'),_0x3050('0x4'),_0x3050('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x3050('0x6'),_0x3050('0x4'),_0x3050('0x3')),'defaultValue':_0x3050('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index b8089c3..28868e7 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 _0x9564=['lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','index','map','ZohoConfiguration','fieldName','type','model','query','keys','filters','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','intersection','catch','create','body','find','ZohoField','order','pick','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra'];(function(_0x2bc1fe,_0x45da98){var _0x1a47a5=function(_0x2e5053){while(--_0x2e5053){_0x2bc1fe['push'](_0x2bc1fe['shift']());}};_0x1a47a5(++_0x45da98);}(_0x9564,0x98));var _0x4956=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x9564[_0x1fc18b];return _0x16a351;};'use strict';var emlformat=require(_0x4956('0x0'));var rimraf=require(_0x4956('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4956('0x2'));var rp=require('request-promise');var moment=require(_0x4956('0x3'));var BPromise=require(_0x4956('0x4'));var Mustache=require('mustache');var util=require(_0x4956('0x5'));var path=require(_0x4956('0x6'));var sox=require(_0x4956('0x7'));var csv=require('to-csv');var ejs=require(_0x4956('0x8'));var fs=require('fs');var fs_extra=require(_0x4956('0x9'));var _=require(_0x4956('0xa'));var squel=require(_0x4956('0xb'));var crypto=require('crypto');var jsforce=require(_0x4956('0xc'));var deskjs=require(_0x4956('0xd'));var toCsv=require(_0x4956('0xe'));var querystring=require(_0x4956('0xf'));var Papa=require(_0x4956('0x10'));var Redis=require(_0x4956('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4956('0x12'));var as=require(_0x4956('0x13'));var hardwareService=require(_0x4956('0x14'));var logger=require(_0x4956('0x15'))(_0x4956('0x16'));var utils=require(_0x4956('0x17'));var config=require(_0x4956('0x18'));var licenseUtil=require(_0x4956('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51a7fb,_0x340031){_0x340031=_0x340031||0xcc;return function(_0x1273c8){if(_0x1273c8){return _0x51a7fb[_0x4956('0x1a')](_0x340031);}return _0x51a7fb[_0x4956('0x1b')](_0x340031)[_0x4956('0x1c')]();};}function respondWithResult(_0x1fc7bc,_0x59f065){_0x59f065=_0x59f065||0xc8;return function(_0x5d7873){if(_0x5d7873){return _0x1fc7bc['status'](_0x59f065)[_0x4956('0x1d')](_0x5d7873);}};}function respondWithFilteredResult(_0x4813a1,_0x3c7bfe){return function(_0x593a75){if(_0x593a75){var _0x5c2ad8=typeof _0x3c7bfe[_0x4956('0x1e')]===_0x4956('0x1f')&&typeof _0x3c7bfe[_0x4956('0x20')]===_0x4956('0x1f');var _0x13fea6=_0x593a75['count'];var _0x45d536=_0x5c2ad8?0x0:_0x3c7bfe[_0x4956('0x1e')];var _0x40b129=_0x5c2ad8?_0x593a75[_0x4956('0x21')]:_0x3c7bfe['offset']+_0x3c7bfe[_0x4956('0x20')];var _0x175e2b;if(_0x40b129>=_0x13fea6){_0x40b129=_0x13fea6;_0x175e2b=0xc8;}else{_0x175e2b=0xce;}_0x4813a1['status'](_0x175e2b);return _0x4813a1[_0x4956('0x22')](_0x4956('0x23'),_0x45d536+'-'+_0x40b129+'/'+_0x13fea6)[_0x4956('0x1d')](_0x593a75);}return null;};}function patchUpdates(_0xa42b6d){return function(_0x9596f9){try{jsonpatch[_0x4956('0x24')](_0x9596f9,_0xa42b6d,!![]);}catch(_0x1b19fa){return BPromise['reject'](_0x1b19fa);}return _0x9596f9[_0x4956('0x25')]();};}function saveUpdates(_0x1f73f7,_0x55782c){return function(_0x55e2c4){if(_0x55e2c4){return _0x55e2c4[_0x4956('0x26')](_0x1f73f7)['then'](function(_0x183d25){return _0x183d25;});}return null;};}function removeEntity(_0x4f5e47,_0x4c787d){return function(_0x5c48e9){if(_0x5c48e9){return _0x5c48e9[_0x4956('0x27')]()[_0x4956('0x28')](function(){_0x4f5e47['status'](0xcc)[_0x4956('0x1c')]();});}};}function handleEntityNotFound(_0x523d1b,_0x162a32){return function(_0x225ab8){if(!_0x225ab8){_0x523d1b[_0x4956('0x1a')](0x194);}return _0x225ab8;};}function handleError(_0x597fbb,_0x4f1163){_0x4f1163=_0x4f1163||0x1f4;return function(_0x115a4a){logger[_0x4956('0x29')](_0x115a4a[_0x4956('0x2a')]);if(_0x115a4a[_0x4956('0x2b')]){delete _0x115a4a['name'];}_0x597fbb['status'](_0x4f1163)['send'](_0x115a4a);};}exports[_0x4956('0x2c')]=function(_0x4bbf4c,_0x25a2b4){var _0x1ed506={},_0x3f1217={},_0x1bbee7={'count':0x0,'rows':[]};var _0x4c21f7=_[_0x4956('0x2d')](db[_0x4956('0x2e')]['rawAttributes'],function(_0x1ed388){return{'name':_0x1ed388[_0x4956('0x2f')],'type':_0x1ed388[_0x4956('0x30')]['key']};});_0x3f1217[_0x4956('0x31')]=_[_0x4956('0x2d')](_0x4c21f7,_0x4956('0x2b'));_0x3f1217[_0x4956('0x32')]=_[_0x4956('0x33')](_0x4bbf4c[_0x4956('0x32')]);_0x3f1217[_0x4956('0x34')]=_['intersection'](_0x3f1217[_0x4956('0x31')],_0x3f1217['query']);_0x1ed506['attributes']=_['intersection'](_0x3f1217[_0x4956('0x31')],qs[_0x4956('0x35')](_0x4bbf4c[_0x4956('0x32')]['fields']));_0x1ed506['attributes']=_0x1ed506[_0x4956('0x36')][_0x4956('0x37')]?_0x1ed506[_0x4956('0x36')]:_0x3f1217[_0x4956('0x31')];if(!_0x4bbf4c['query']['hasOwnProperty'](_0x4956('0x38'))){_0x1ed506[_0x4956('0x20')]=qs[_0x4956('0x20')](_0x4bbf4c[_0x4956('0x32')][_0x4956('0x20')]);_0x1ed506[_0x4956('0x1e')]=qs[_0x4956('0x1e')](_0x4bbf4c['query'][_0x4956('0x1e')]);}_0x1ed506['order']=qs['sort'](_0x4bbf4c[_0x4956('0x32')][_0x4956('0x39')]);_0x1ed506[_0x4956('0x3a')]=qs[_0x4956('0x34')](_['pick'](_0x4bbf4c[_0x4956('0x32')],_0x3f1217['filters']),_0x4c21f7);if(_0x4bbf4c[_0x4956('0x32')][_0x4956('0x3b')]){_0x1ed506['where']=_[_0x4956('0x3c')](_0x1ed506[_0x4956('0x3a')],{'$or':_['map'](_0x4c21f7,function(_0x49dff2){if(_0x49dff2[_0x4956('0x30')]!==_0x4956('0x3d')){var _0x44a8a7={};_0x44a8a7[_0x49dff2['name']]={'$like':'%'+_0x4bbf4c['query']['filter']+'%'};return _0x44a8a7;}})});}_0x1ed506=_[_0x4956('0x3c')]({},_0x1ed506,_0x4bbf4c[_0x4956('0x3e')]);var _0x18abdf={'where':_0x1ed506[_0x4956('0x3a')]};return db['ZohoConfiguration']['count'](_0x18abdf)[_0x4956('0x28')](function(_0x3abeda){_0x1bbee7['count']=_0x3abeda;if(_0x4bbf4c['query']['includeAll']){_0x1ed506[_0x4956('0x3f')]=[{'all':!![]}];}return db[_0x4956('0x2e')][_0x4956('0x40')](_0x1ed506);})[_0x4956('0x28')](function(_0x29c743){_0x1bbee7[_0x4956('0x41')]=_0x29c743;return _0x1bbee7;})['then'](respondWithFilteredResult(_0x25a2b4,_0x1ed506))['catch'](handleError(_0x25a2b4,null));};exports[_0x4956('0x42')]=function(_0x1f1023,_0x5e06cc){var _0x3543a8={'raw':![],'where':{'id':_0x1f1023[_0x4956('0x43')]['id']}},_0x3963c8={};_0x3963c8[_0x4956('0x31')]=_['keys'](db['ZohoConfiguration'][_0x4956('0x44')]);_0x3963c8[_0x4956('0x32')]=_[_0x4956('0x33')](_0x1f1023[_0x4956('0x32')]);_0x3963c8[_0x4956('0x34')]=_[_0x4956('0x45')](_0x3963c8['model'],_0x3963c8[_0x4956('0x32')]);_0x3543a8['attributes']=_[_0x4956('0x45')](_0x3963c8[_0x4956('0x31')],qs[_0x4956('0x35')](_0x1f1023['query'][_0x4956('0x35')]));_0x3543a8['attributes']=_0x3543a8[_0x4956('0x36')][_0x4956('0x37')]?_0x3543a8[_0x4956('0x36')]:_0x3963c8[_0x4956('0x31')];if(_0x1f1023[_0x4956('0x32')]['includeAll']){_0x3543a8['include']=[{'all':!![]}];}_0x3543a8=_[_0x4956('0x3c')]({},_0x3543a8,_0x1f1023[_0x4956('0x3e')]);return db[_0x4956('0x2e')]['find'](_0x3543a8)['then'](handleEntityNotFound(_0x5e06cc,null))[_0x4956('0x28')](respondWithResult(_0x5e06cc,null))[_0x4956('0x46')](handleError(_0x5e06cc,null));};exports['create']=function(_0x28b7e9,_0x606f6c){return db[_0x4956('0x2e')][_0x4956('0x47')](_0x28b7e9[_0x4956('0x48')],{})[_0x4956('0x28')](respondWithResult(_0x606f6c,0xc9))[_0x4956('0x46')](handleError(_0x606f6c,null));};exports['update']=function(_0x40b396,_0x27f62d){if(_0x40b396[_0x4956('0x48')]['id']){delete _0x40b396['body']['id'];}return db[_0x4956('0x2e')][_0x4956('0x49')]({'where':{'id':_0x40b396[_0x4956('0x43')]['id']}})[_0x4956('0x28')](handleEntityNotFound(_0x27f62d,null))[_0x4956('0x28')](saveUpdates(_0x40b396[_0x4956('0x48')],null))[_0x4956('0x28')](respondWithResult(_0x27f62d,null))['catch'](handleError(_0x27f62d,null));};exports[_0x4956('0x27')]=function(_0x4dc719,_0x2ecb72){return db[_0x4956('0x2e')][_0x4956('0x49')]({'where':{'id':_0x4dc719[_0x4956('0x43')]['id']}})[_0x4956('0x28')](handleEntityNotFound(_0x2ecb72,null))[_0x4956('0x28')](removeEntity(_0x2ecb72,null))[_0x4956('0x46')](handleError(_0x2ecb72,null));};exports['getFields']=function(_0x1f9187,_0x1ee4bc,_0x359c21){var _0x23ddf2={};var _0xdada57={};var _0x22e6c1;var _0x218702;return db[_0x4956('0x2e')]['findOne']({'where':{'id':_0x1f9187[_0x4956('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ee4bc,null))['then'](function(_0xade9e){if(_0xade9e){_0x22e6c1=_0xade9e;_0xdada57['model']=_[_0x4956('0x33')](db[_0x4956('0x4a')]['rawAttributes']);_0xdada57[_0x4956('0x32')]=_['keys'](_0x1f9187['query']);_0xdada57['filters']=_[_0x4956('0x45')](_0xdada57['model'],_0xdada57[_0x4956('0x32')]);_0x23ddf2[_0x4956('0x36')]=_[_0x4956('0x45')](_0xdada57[_0x4956('0x31')],qs[_0x4956('0x35')](_0x1f9187[_0x4956('0x32')]['fields']));_0x23ddf2[_0x4956('0x36')]=_0x23ddf2[_0x4956('0x36')]['length']?_0x23ddf2[_0x4956('0x36')]:_0xdada57[_0x4956('0x31')];_0x23ddf2[_0x4956('0x4b')]=qs[_0x4956('0x39')](_0x1f9187['query']['sort']);_0x23ddf2[_0x4956('0x3a')]=qs[_0x4956('0x34')](_[_0x4956('0x4c')](_0x1f9187[_0x4956('0x32')],_0xdada57['filters']));if(_0x1f9187[_0x4956('0x32')][_0x4956('0x3b')]){_0x23ddf2[_0x4956('0x3a')]=_['merge'](_0x23ddf2[_0x4956('0x3a')],{'$or':_[_0x4956('0x2d')](_0x23ddf2['attributes'],function(_0x4198eb){var _0x2ea9c6={};_0x2ea9c6[_0x4198eb]={'$like':'%'+_0x1f9187[_0x4956('0x32')]['filter']+'%'};return _0x2ea9c6;})});}_0x23ddf2=_[_0x4956('0x3c')]({},_0x23ddf2,_0x1f9187['options']);return _0x22e6c1['getFields'](_0x23ddf2);}})[_0x4956('0x28')](function(_0x3a3b45){if(_0x3a3b45){_0x218702=_0x3a3b45['length'];if(!_0x1f9187[_0x4956('0x32')][_0x4956('0x4d')](_0x4956('0x38'))){_0x23ddf2[_0x4956('0x20')]=qs[_0x4956('0x20')](_0x1f9187['query'][_0x4956('0x20')]);_0x23ddf2['offset']=qs['offset'](_0x1f9187['query'][_0x4956('0x1e')]);}return _0x22e6c1['getFields'](_0x23ddf2);}})[_0x4956('0x28')](function(_0x34656b){if(_0x34656b){return _0x34656b?{'count':_0x218702,'rows':_0x34656b}:null;}})[_0x4956('0x28')](respondWithResult(_0x1ee4bc,null))['catch'](handleError(_0x1ee4bc,null));};exports['getSubjects']=function(_0x301491,_0x4860e2,_0x31aa47){var _0x408322={};var _0x2bbfc9={};var _0x196891;var _0x1b4510;return db['ZohoConfiguration'][_0x4956('0x4e')]({'where':{'id':_0x301491[_0x4956('0x43')]['id']}})[_0x4956('0x28')](handleEntityNotFound(_0x4860e2,null))['then'](function(_0x104ee5){if(_0x104ee5){_0x196891=_0x104ee5;_0x2bbfc9[_0x4956('0x31')]=_[_0x4956('0x33')](db[_0x4956('0x4a')]['rawAttributes']);_0x2bbfc9[_0x4956('0x32')]=_['keys'](_0x301491[_0x4956('0x32')]);_0x2bbfc9['filters']=_[_0x4956('0x45')](_0x2bbfc9[_0x4956('0x31')],_0x2bbfc9[_0x4956('0x32')]);_0x408322[_0x4956('0x36')]=_[_0x4956('0x45')](_0x2bbfc9['model'],qs[_0x4956('0x35')](_0x301491[_0x4956('0x32')][_0x4956('0x35')]));_0x408322['attributes']=_0x408322['attributes'][_0x4956('0x37')]?_0x408322[_0x4956('0x36')]:_0x2bbfc9[_0x4956('0x31')];_0x408322[_0x4956('0x4b')]=qs[_0x4956('0x39')](_0x301491[_0x4956('0x32')]['sort']);_0x408322['where']=qs[_0x4956('0x34')](_[_0x4956('0x4c')](_0x301491[_0x4956('0x32')],_0x2bbfc9[_0x4956('0x34')]));if(_0x301491[_0x4956('0x32')]['filter']){_0x408322['where']=_[_0x4956('0x3c')](_0x408322[_0x4956('0x3a')],{'$or':_[_0x4956('0x2d')](_0x408322[_0x4956('0x36')],function(_0x4f5a75){var _0x29e5f0={};_0x29e5f0[_0x4f5a75]={'$like':'%'+_0x301491['query'][_0x4956('0x3b')]+'%'};return _0x29e5f0;})});}_0x408322=_[_0x4956('0x3c')]({},_0x408322,_0x301491[_0x4956('0x3e')]);return _0x196891['getSubjects'](_0x408322);}})['then'](function(_0x144644){if(_0x144644){_0x1b4510=_0x144644['length'];if(!_0x301491[_0x4956('0x32')][_0x4956('0x4d')](_0x4956('0x38'))){_0x408322['limit']=qs['limit'](_0x301491[_0x4956('0x32')][_0x4956('0x20')]);_0x408322[_0x4956('0x1e')]=qs['offset'](_0x301491[_0x4956('0x32')]['offset']);}return _0x196891[_0x4956('0x4f')](_0x408322);}})[_0x4956('0x28')](function(_0x4160e8){if(_0x4160e8){return _0x4160e8?{'count':_0x1b4510,'rows':_0x4160e8}:null;}})['then'](respondWithResult(_0x4860e2,null))['catch'](handleError(_0x4860e2,null));};exports[_0x4956('0x50')]=function(_0x2f4166,_0x236857,_0x2679ac){var _0x51f9d3={};var _0xbefe97={};var _0x264efc;var _0x1b5c86;return db['ZohoConfiguration'][_0x4956('0x4e')]({'where':{'id':_0x2f4166[_0x4956('0x43')]['id']}})['then'](handleEntityNotFound(_0x236857,null))[_0x4956('0x28')](function(_0x2f31fa){if(_0x2f31fa){_0x264efc=_0x2f31fa;_0xbefe97['model']=_[_0x4956('0x33')](db[_0x4956('0x4a')][_0x4956('0x44')]);_0xbefe97[_0x4956('0x32')]=_['keys'](_0x2f4166[_0x4956('0x32')]);_0xbefe97[_0x4956('0x34')]=_[_0x4956('0x45')](_0xbefe97[_0x4956('0x31')],_0xbefe97['query']);_0x51f9d3[_0x4956('0x36')]=_['intersection'](_0xbefe97[_0x4956('0x31')],qs[_0x4956('0x35')](_0x2f4166['query'][_0x4956('0x35')]));_0x51f9d3[_0x4956('0x36')]=_0x51f9d3[_0x4956('0x36')][_0x4956('0x37')]?_0x51f9d3[_0x4956('0x36')]:_0xbefe97['model'];_0x51f9d3[_0x4956('0x4b')]=qs['sort'](_0x2f4166[_0x4956('0x32')][_0x4956('0x39')]);_0x51f9d3[_0x4956('0x3a')]=qs[_0x4956('0x34')](_[_0x4956('0x4c')](_0x2f4166[_0x4956('0x32')],_0xbefe97[_0x4956('0x34')]));if(_0x2f4166[_0x4956('0x32')][_0x4956('0x3b')]){_0x51f9d3[_0x4956('0x3a')]=_[_0x4956('0x3c')](_0x51f9d3[_0x4956('0x3a')],{'$or':_[_0x4956('0x2d')](_0x51f9d3[_0x4956('0x36')],function(_0x2a92c9){var _0x2650b9={};_0x2650b9[_0x2a92c9]={'$like':'%'+_0x2f4166['query']['filter']+'%'};return _0x2650b9;})});}_0x51f9d3=_['merge']({},_0x51f9d3,_0x2f4166['options']);return _0x264efc[_0x4956('0x50')](_0x51f9d3);}})[_0x4956('0x28')](function(_0x2e7d9a){if(_0x2e7d9a){_0x1b5c86=_0x2e7d9a['length'];if(!_0x2f4166[_0x4956('0x32')][_0x4956('0x4d')](_0x4956('0x38'))){_0x51f9d3['limit']=qs[_0x4956('0x20')](_0x2f4166[_0x4956('0x32')][_0x4956('0x20')]);_0x51f9d3['offset']=qs[_0x4956('0x1e')](_0x2f4166[_0x4956('0x32')][_0x4956('0x1e')]);}return _0x264efc[_0x4956('0x50')](_0x51f9d3);}})[_0x4956('0x28')](function(_0x15e3a0){if(_0x15e3a0){return _0x15e3a0?{'count':_0x1b5c86,'rows':_0x15e3a0}:null;}})['then'](respondWithResult(_0x236857,null))[_0x4956('0x46')](handleError(_0x236857,null));}; \ No newline at end of file +var _0x687c=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','catch','params','length','include','find','create','body','getFields','ZohoField','getSubjects','findOne','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key'];(function(_0x287344,_0x557d5d){var _0x1ec285=function(_0x43514a){while(--_0x43514a){_0x287344['push'](_0x287344['shift']());}};_0x1ec285(++_0x557d5d);}(_0x687c,0x170));var _0xc687=function(_0x2213d7,_0x3dd33a){_0x2213d7=_0x2213d7-0x0;var _0x5bc157=_0x687c[_0x2213d7];return _0x5bc157;};'use strict';var emlformat=require(_0xc687('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc687('0x1'));var jsonpatch=require(_0xc687('0x2'));var rp=require('request-promise');var moment=require(_0xc687('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc687('0x4'));var path=require(_0xc687('0x5'));var sox=require(_0xc687('0x6'));var csv=require(_0xc687('0x7'));var ejs=require(_0xc687('0x8'));var fs=require('fs');var fs_extra=require(_0xc687('0x9'));var _=require(_0xc687('0xa'));var squel=require(_0xc687('0xb'));var crypto=require(_0xc687('0xc'));var jsforce=require(_0xc687('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc687('0x7'));var querystring=require('querystring');var Papa=require(_0xc687('0xe'));var Redis=require(_0xc687('0xf'));var authService=require(_0xc687('0x10'));var qs=require(_0xc687('0x11'));var as=require(_0xc687('0x12'));var hardwareService=require(_0xc687('0x13'));var logger=require(_0xc687('0x14'))(_0xc687('0x15'));var utils=require(_0xc687('0x16'));var config=require(_0xc687('0x17'));var licenseUtil=require(_0xc687('0x18'));var db=require(_0xc687('0x19'))['db'];function respondWithStatusCode(_0x1fa3a0,_0x5eb519){_0x5eb519=_0x5eb519||0xcc;return function(_0x13af5b){if(_0x13af5b){return _0x1fa3a0[_0xc687('0x1a')](_0x5eb519);}return _0x1fa3a0[_0xc687('0x1b')](_0x5eb519)[_0xc687('0x1c')]();};}function respondWithResult(_0x55b343,_0x47f458){_0x47f458=_0x47f458||0xc8;return function(_0x522b85){if(_0x522b85){return _0x55b343[_0xc687('0x1b')](_0x47f458)['json'](_0x522b85);}};}function respondWithFilteredResult(_0x1df625,_0x126310){return function(_0x174875){if(_0x174875){var _0x444fd1=typeof _0x126310[_0xc687('0x1d')]==='undefined'&&typeof _0x126310[_0xc687('0x1e')]===_0xc687('0x1f');var _0x4cf0fc=_0x174875[_0xc687('0x20')];var _0x4e51ec=_0x444fd1?0x0:_0x126310[_0xc687('0x1d')];var _0x4b9028=_0x444fd1?_0x174875[_0xc687('0x20')]:_0x126310[_0xc687('0x1d')]+_0x126310[_0xc687('0x1e')];var _0x4f1e9f;if(_0x4b9028>=_0x4cf0fc){_0x4b9028=_0x4cf0fc;_0x4f1e9f=0xc8;}else{_0x4f1e9f=0xce;}_0x1df625[_0xc687('0x1b')](_0x4f1e9f);return _0x1df625[_0xc687('0x21')](_0xc687('0x22'),_0x4e51ec+'-'+_0x4b9028+'/'+_0x4cf0fc)[_0xc687('0x23')](_0x174875);}return null;};}function patchUpdates(_0x28b6cd){return function(_0x226250){try{jsonpatch[_0xc687('0x24')](_0x226250,_0x28b6cd,!![]);}catch(_0x441001){return BPromise[_0xc687('0x25')](_0x441001);}return _0x226250[_0xc687('0x26')]();};}function saveUpdates(_0x418aa9,_0x2ce460){return function(_0x549707){if(_0x549707){return _0x549707[_0xc687('0x27')](_0x418aa9)[_0xc687('0x28')](function(_0x237249){return _0x237249;});}return null;};}function removeEntity(_0x5f2f80,_0x1706e9){return function(_0x3ac014){if(_0x3ac014){return _0x3ac014[_0xc687('0x29')]()['then'](function(){_0x5f2f80[_0xc687('0x1b')](0xcc)[_0xc687('0x1c')]();});}};}function handleEntityNotFound(_0x3f93f8,_0x33e441){return function(_0x5e6aa7){if(!_0x5e6aa7){_0x3f93f8[_0xc687('0x1a')](0x194);}return _0x5e6aa7;};}function handleError(_0x38083e,_0x27b391){_0x27b391=_0x27b391||0x1f4;return function(_0x1b12fd){logger[_0xc687('0x2a')](_0x1b12fd[_0xc687('0x2b')]);if(_0x1b12fd[_0xc687('0x2c')]){delete _0x1b12fd[_0xc687('0x2c')];}_0x38083e[_0xc687('0x1b')](_0x27b391)[_0xc687('0x2d')](_0x1b12fd);};}exports[_0xc687('0x2e')]=function(_0x3b67e4,_0x483db8){var _0x181837={},_0x90d8ef={},_0x10cf7b={'count':0x0,'rows':[]};var _0x4e4f7f=_['map'](db[_0xc687('0x2f')][_0xc687('0x30')],function(_0x560274){return{'name':_0x560274[_0xc687('0x31')],'type':_0x560274[_0xc687('0x32')][_0xc687('0x33')]};});_0x90d8ef[_0xc687('0x34')]=_['map'](_0x4e4f7f,'name');_0x90d8ef[_0xc687('0x35')]=_[_0xc687('0x36')](_0x3b67e4[_0xc687('0x35')]);_0x90d8ef[_0xc687('0x37')]=_[_0xc687('0x38')](_0x90d8ef[_0xc687('0x34')],_0x90d8ef[_0xc687('0x35')]);_0x181837[_0xc687('0x39')]=_[_0xc687('0x38')](_0x90d8ef['model'],qs[_0xc687('0x3a')](_0x3b67e4[_0xc687('0x35')][_0xc687('0x3a')]));_0x181837[_0xc687('0x39')]=_0x181837[_0xc687('0x39')]['length']?_0x181837['attributes']:_0x90d8ef[_0xc687('0x34')];if(!_0x3b67e4['query'][_0xc687('0x3b')]('nolimit')){_0x181837[_0xc687('0x1e')]=qs['limit'](_0x3b67e4['query'][_0xc687('0x1e')]);_0x181837[_0xc687('0x1d')]=qs[_0xc687('0x1d')](_0x3b67e4['query'][_0xc687('0x1d')]);}_0x181837[_0xc687('0x3c')]=qs['sort'](_0x3b67e4[_0xc687('0x35')][_0xc687('0x3d')]);_0x181837[_0xc687('0x3e')]=qs[_0xc687('0x37')](_[_0xc687('0x3f')](_0x3b67e4['query'],_0x90d8ef[_0xc687('0x37')]),_0x4e4f7f);if(_0x3b67e4['query'][_0xc687('0x40')]){_0x181837['where']=_[_0xc687('0x41')](_0x181837['where'],{'$or':_[_0xc687('0x42')](_0x4e4f7f,function(_0x466031){if(_0x466031[_0xc687('0x32')]!==_0xc687('0x43')){var _0x15740d={};_0x15740d[_0x466031[_0xc687('0x2c')]]={'$like':'%'+_0x3b67e4[_0xc687('0x35')][_0xc687('0x40')]+'%'};return _0x15740d;}})});}_0x181837=_[_0xc687('0x41')]({},_0x181837,_0x3b67e4[_0xc687('0x44')]);var _0x2863e1={'where':_0x181837['where']};return db['ZohoConfiguration']['count'](_0x2863e1)[_0xc687('0x28')](function(_0xf7159a){_0x10cf7b[_0xc687('0x20')]=_0xf7159a;if(_0x3b67e4[_0xc687('0x35')][_0xc687('0x45')]){_0x181837['include']=[{'all':!![]}];}return db[_0xc687('0x2f')][_0xc687('0x46')](_0x181837);})[_0xc687('0x28')](function(_0x30564a){_0x10cf7b['rows']=_0x30564a;return _0x10cf7b;})[_0xc687('0x28')](respondWithFilteredResult(_0x483db8,_0x181837))[_0xc687('0x47')](handleError(_0x483db8,null));};exports['show']=function(_0x2741ef,_0x56e0b5){var _0x54822b={'raw':![],'where':{'id':_0x2741ef[_0xc687('0x48')]['id']}},_0x341576={};_0x341576[_0xc687('0x34')]=_[_0xc687('0x36')](db[_0xc687('0x2f')][_0xc687('0x30')]);_0x341576[_0xc687('0x35')]=_[_0xc687('0x36')](_0x2741ef[_0xc687('0x35')]);_0x341576['filters']=_[_0xc687('0x38')](_0x341576[_0xc687('0x34')],_0x341576[_0xc687('0x35')]);_0x54822b[_0xc687('0x39')]=_[_0xc687('0x38')](_0x341576[_0xc687('0x34')],qs[_0xc687('0x3a')](_0x2741ef[_0xc687('0x35')][_0xc687('0x3a')]));_0x54822b[_0xc687('0x39')]=_0x54822b[_0xc687('0x39')][_0xc687('0x49')]?_0x54822b[_0xc687('0x39')]:_0x341576['model'];if(_0x2741ef[_0xc687('0x35')][_0xc687('0x45')]){_0x54822b[_0xc687('0x4a')]=[{'all':!![]}];}_0x54822b=_[_0xc687('0x41')]({},_0x54822b,_0x2741ef[_0xc687('0x44')]);return db[_0xc687('0x2f')][_0xc687('0x4b')](_0x54822b)[_0xc687('0x28')](handleEntityNotFound(_0x56e0b5,null))['then'](respondWithResult(_0x56e0b5,null))['catch'](handleError(_0x56e0b5,null));};exports['create']=function(_0x5d0ffc,_0x224702){return db[_0xc687('0x2f')][_0xc687('0x4c')](_0x5d0ffc['body'],{})[_0xc687('0x28')](respondWithResult(_0x224702,0xc9))[_0xc687('0x47')](handleError(_0x224702,null));};exports[_0xc687('0x27')]=function(_0x5859b3,_0x3b5b17){if(_0x5859b3[_0xc687('0x4d')]['id']){delete _0x5859b3[_0xc687('0x4d')]['id'];}return db[_0xc687('0x2f')][_0xc687('0x4b')]({'where':{'id':_0x5859b3[_0xc687('0x48')]['id']}})[_0xc687('0x28')](handleEntityNotFound(_0x3b5b17,null))[_0xc687('0x28')](saveUpdates(_0x5859b3[_0xc687('0x4d')],null))['then'](respondWithResult(_0x3b5b17,null))['catch'](handleError(_0x3b5b17,null));};exports['destroy']=function(_0x11513c,_0x50d650){return db[_0xc687('0x2f')][_0xc687('0x4b')]({'where':{'id':_0x11513c['params']['id']}})['then'](handleEntityNotFound(_0x50d650,null))[_0xc687('0x28')](removeEntity(_0x50d650,null))[_0xc687('0x47')](handleError(_0x50d650,null));};exports[_0xc687('0x4e')]=function(_0x3a163f,_0x5d75f6,_0x4e002f){var _0x99e833={};var _0x2d5702={};var _0x977d0c;var _0x429a2b;return db[_0xc687('0x2f')]['findOne']({'where':{'id':_0x3a163f[_0xc687('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d75f6,null))[_0xc687('0x28')](function(_0x38259f){if(_0x38259f){_0x977d0c=_0x38259f;_0x2d5702['model']=_[_0xc687('0x36')](db[_0xc687('0x4f')]['rawAttributes']);_0x2d5702[_0xc687('0x35')]=_[_0xc687('0x36')](_0x3a163f[_0xc687('0x35')]);_0x2d5702[_0xc687('0x37')]=_['intersection'](_0x2d5702['model'],_0x2d5702['query']);_0x99e833['attributes']=_[_0xc687('0x38')](_0x2d5702['model'],qs[_0xc687('0x3a')](_0x3a163f[_0xc687('0x35')][_0xc687('0x3a')]));_0x99e833['attributes']=_0x99e833[_0xc687('0x39')][_0xc687('0x49')]?_0x99e833[_0xc687('0x39')]:_0x2d5702[_0xc687('0x34')];_0x99e833[_0xc687('0x3c')]=qs[_0xc687('0x3d')](_0x3a163f[_0xc687('0x35')]['sort']);_0x99e833['where']=qs[_0xc687('0x37')](_[_0xc687('0x3f')](_0x3a163f['query'],_0x2d5702['filters']));if(_0x3a163f[_0xc687('0x35')]['filter']){_0x99e833[_0xc687('0x3e')]=_[_0xc687('0x41')](_0x99e833[_0xc687('0x3e')],{'$or':_['map'](_0x99e833[_0xc687('0x39')],function(_0x28a08c){var _0x2d4aa3={};_0x2d4aa3[_0x28a08c]={'$like':'%'+_0x3a163f[_0xc687('0x35')][_0xc687('0x40')]+'%'};return _0x2d4aa3;})});}_0x99e833=_[_0xc687('0x41')]({},_0x99e833,_0x3a163f['options']);return _0x977d0c['getFields'](_0x99e833);}})[_0xc687('0x28')](function(_0x406f0c){if(_0x406f0c){_0x429a2b=_0x406f0c[_0xc687('0x49')];if(!_0x3a163f['query']['hasOwnProperty']('nolimit')){_0x99e833[_0xc687('0x1e')]=qs['limit'](_0x3a163f[_0xc687('0x35')][_0xc687('0x1e')]);_0x99e833[_0xc687('0x1d')]=qs['offset'](_0x3a163f[_0xc687('0x35')][_0xc687('0x1d')]);}return _0x977d0c[_0xc687('0x4e')](_0x99e833);}})['then'](function(_0x436dda){if(_0x436dda){return _0x436dda?{'count':_0x429a2b,'rows':_0x436dda}:null;}})[_0xc687('0x28')](respondWithResult(_0x5d75f6,null))[_0xc687('0x47')](handleError(_0x5d75f6,null));};exports[_0xc687('0x50')]=function(_0x53b4d7,_0x237197,_0x569879){var _0x461ed5={};var _0x4a8227={};var _0x29d024;var _0x42fc57;return db[_0xc687('0x2f')][_0xc687('0x51')]({'where':{'id':_0x53b4d7[_0xc687('0x48')]['id']}})[_0xc687('0x28')](handleEntityNotFound(_0x237197,null))[_0xc687('0x28')](function(_0x1ca94b){if(_0x1ca94b){_0x29d024=_0x1ca94b;_0x4a8227[_0xc687('0x34')]=_[_0xc687('0x36')](db[_0xc687('0x4f')][_0xc687('0x30')]);_0x4a8227[_0xc687('0x35')]=_[_0xc687('0x36')](_0x53b4d7[_0xc687('0x35')]);_0x4a8227[_0xc687('0x37')]=_[_0xc687('0x38')](_0x4a8227[_0xc687('0x34')],_0x4a8227[_0xc687('0x35')]);_0x461ed5[_0xc687('0x39')]=_[_0xc687('0x38')](_0x4a8227[_0xc687('0x34')],qs[_0xc687('0x3a')](_0x53b4d7[_0xc687('0x35')][_0xc687('0x3a')]));_0x461ed5[_0xc687('0x39')]=_0x461ed5['attributes'][_0xc687('0x49')]?_0x461ed5['attributes']:_0x4a8227[_0xc687('0x34')];_0x461ed5[_0xc687('0x3c')]=qs[_0xc687('0x3d')](_0x53b4d7['query'][_0xc687('0x3d')]);_0x461ed5[_0xc687('0x3e')]=qs[_0xc687('0x37')](_[_0xc687('0x3f')](_0x53b4d7[_0xc687('0x35')],_0x4a8227[_0xc687('0x37')]));if(_0x53b4d7['query']['filter']){_0x461ed5[_0xc687('0x3e')]=_['merge'](_0x461ed5[_0xc687('0x3e')],{'$or':_['map'](_0x461ed5[_0xc687('0x39')],function(_0x199baf){var _0x51c7e6={};_0x51c7e6[_0x199baf]={'$like':'%'+_0x53b4d7[_0xc687('0x35')][_0xc687('0x40')]+'%'};return _0x51c7e6;})});}_0x461ed5=_['merge']({},_0x461ed5,_0x53b4d7[_0xc687('0x44')]);return _0x29d024[_0xc687('0x50')](_0x461ed5);}})[_0xc687('0x28')](function(_0x150757){if(_0x150757){_0x42fc57=_0x150757[_0xc687('0x49')];if(!_0x53b4d7[_0xc687('0x35')][_0xc687('0x3b')](_0xc687('0x52'))){_0x461ed5[_0xc687('0x1e')]=qs[_0xc687('0x1e')](_0x53b4d7[_0xc687('0x35')][_0xc687('0x1e')]);_0x461ed5[_0xc687('0x1d')]=qs[_0xc687('0x1d')](_0x53b4d7[_0xc687('0x35')][_0xc687('0x1d')]);}return _0x29d024[_0xc687('0x50')](_0x461ed5);}})['then'](function(_0x1ac8b8){if(_0x1ac8b8){return _0x1ac8b8?{'count':_0x42fc57,'rows':_0x1ac8b8}:null;}})['then'](respondWithResult(_0x237197,null))[_0xc687('0x47')](handleError(_0x237197,null));};exports[_0xc687('0x53')]=function(_0x2eb5d2,_0x437489,_0x4ed563){var _0x50c9d9={};var _0x33af73={};var _0x5e9fe7;var _0x3e7fab;return db[_0xc687('0x2f')][_0xc687('0x51')]({'where':{'id':_0x2eb5d2[_0xc687('0x48')]['id']}})['then'](handleEntityNotFound(_0x437489,null))[_0xc687('0x28')](function(_0x737fa9){if(_0x737fa9){_0x5e9fe7=_0x737fa9;_0x33af73[_0xc687('0x34')]=_[_0xc687('0x36')](db['ZohoField'][_0xc687('0x30')]);_0x33af73['query']=_[_0xc687('0x36')](_0x2eb5d2[_0xc687('0x35')]);_0x33af73[_0xc687('0x37')]=_[_0xc687('0x38')](_0x33af73[_0xc687('0x34')],_0x33af73[_0xc687('0x35')]);_0x50c9d9[_0xc687('0x39')]=_[_0xc687('0x38')](_0x33af73['model'],qs[_0xc687('0x3a')](_0x2eb5d2[_0xc687('0x35')][_0xc687('0x3a')]));_0x50c9d9[_0xc687('0x39')]=_0x50c9d9[_0xc687('0x39')][_0xc687('0x49')]?_0x50c9d9[_0xc687('0x39')]:_0x33af73['model'];_0x50c9d9[_0xc687('0x3c')]=qs[_0xc687('0x3d')](_0x2eb5d2[_0xc687('0x35')]['sort']);_0x50c9d9[_0xc687('0x3e')]=qs['filters'](_['pick'](_0x2eb5d2[_0xc687('0x35')],_0x33af73[_0xc687('0x37')]));if(_0x2eb5d2['query'][_0xc687('0x40')]){_0x50c9d9[_0xc687('0x3e')]=_[_0xc687('0x41')](_0x50c9d9[_0xc687('0x3e')],{'$or':_[_0xc687('0x42')](_0x50c9d9['attributes'],function(_0x5524fa){var _0x402ca5={};_0x402ca5[_0x5524fa]={'$like':'%'+_0x2eb5d2[_0xc687('0x35')]['filter']+'%'};return _0x402ca5;})});}_0x50c9d9=_[_0xc687('0x41')]({},_0x50c9d9,_0x2eb5d2[_0xc687('0x44')]);return _0x5e9fe7[_0xc687('0x53')](_0x50c9d9);}})[_0xc687('0x28')](function(_0x3c89da){if(_0x3c89da){_0x3e7fab=_0x3c89da['length'];if(!_0x2eb5d2[_0xc687('0x35')][_0xc687('0x3b')](_0xc687('0x52'))){_0x50c9d9[_0xc687('0x1e')]=qs['limit'](_0x2eb5d2[_0xc687('0x35')][_0xc687('0x1e')]);_0x50c9d9[_0xc687('0x1d')]=qs[_0xc687('0x1d')](_0x2eb5d2[_0xc687('0x35')][_0xc687('0x1d')]);}return _0x5e9fe7[_0xc687('0x53')](_0x50c9d9);}})[_0xc687('0x28')](function(_0x3a6bc4){if(_0x3a6bc4){return _0x3a6bc4?{'count':_0x3e7fab,'rows':_0x3a6bc4}:null;}})[_0xc687('0x28')](respondWithResult(_0x437489,null))['catch'](handleError(_0x437489,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index a7500b4..2960222 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 _0x9d14=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x3e46b3,_0x29d756){var _0x5eb45f=function(_0x1337dc){while(--_0x1337dc){_0x3e46b3['push'](_0x3e46b3['shift']());}};_0x5eb45f(++_0x29d756);}(_0x9d14,0x188));var _0x49d1=function(_0x50c7b9,_0x1857aa){_0x50c7b9=_0x50c7b9-0x0;var _0x2a5324=_0x9d14[_0x50c7b9];return _0x2a5324;};'use strict';var _=require(_0x49d1('0x0'));var util=require(_0x49d1('0x1'));var logger=require(_0x49d1('0x2'))(_0x49d1('0x3'));var moment=require(_0x49d1('0x4'));var BPromise=require(_0x49d1('0x5'));var rp=require(_0x49d1('0x6'));var fs=require('fs');var path=require(_0x49d1('0x7'));var rimraf=require('rimraf');var config=require(_0x49d1('0x8'));var attributes=require(_0x49d1('0x9'));module[_0x49d1('0xa')]=function(_0x5f35e1,_0x27f313){return _0x5f35e1[_0x49d1('0xb')](_0x49d1('0xc'),attributes,{'tableName':_0x49d1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe16d=['int_zoho_configurations','lodash','util','moment','path','rimraf','./intZohoConfiguration.attributes','exports','define'];(function(_0x510db4,_0x43cc2a){var _0x5c9d91=function(_0x212144){while(--_0x212144){_0x510db4['push'](_0x510db4['shift']());}};_0x5c9d91(++_0x43cc2a);}(_0xe16d,0x118));var _0xde16=function(_0x588172,_0x1540fa){_0x588172=_0x588172-0x0;var _0x5089a1=_0xe16d[_0x588172];return _0x5089a1;};'use strict';var _=require(_0xde16('0x0'));var util=require(_0xde16('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde16('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xde16('0x3'));var rimraf=require(_0xde16('0x4'));var config=require('../../config/environment');var attributes=require(_0xde16('0x5'));module[_0xde16('0x6')]=function(_0x1bd0eb,_0x26d64a){return _0x1bd0eb[_0xde16('0x7')]('ZohoConfiguration',attributes,{'tableName':_0xde16('0x8'),'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 6c00501..fdae2a7 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 _0xf135=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xf135,0x192));var _0x5f13=function(_0x5ea871,_0x45350f){_0x5ea871=_0x5ea871-0x0;var _0x58e215=_0xf135[_0x5ea871];return _0x58e215;};'use strict';var _=require('lodash');var util=require(_0x5f13('0x0'));var moment=require(_0x5f13('0x1'));var BPromise=require(_0x5f13('0x2'));var rs=require(_0x5f13('0x3'));var fs=require('fs');var Redis=require(_0x5f13('0x4'));var db=require(_0x5f13('0x5'))['db'];var utils=require(_0x5f13('0x6'));var logger=require(_0x5f13('0x7'))(_0x5f13('0x8'));var config=require(_0x5f13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5f13('0xa')][_0x5f13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2076ac,_0x539b5d,_0x491708){return new BPromise(function(_0x1e822f,_0x4ae6ce){return client[_0x5f13('0xc')](_0x2076ac,_0x491708)[_0x5f13('0xd')](function(_0x136af9){logger['info'](_0x5f13('0xe'),_0x539b5d,'request\x20sent');logger[_0x5f13('0xf')](_0x5f13('0x10'),_0x539b5d,_0x5f13('0x11'),JSON[_0x5f13('0x12')](_0x136af9));if(_0x136af9[_0x5f13('0x13')]){if(_0x136af9[_0x5f13('0x13')][_0x5f13('0x14')]===0x1f4){logger[_0x5f13('0x13')](_0x5f13('0xe'),_0x539b5d,_0x136af9[_0x5f13('0x13')]['message']);return _0x4ae6ce(_0x136af9[_0x5f13('0x13')][_0x5f13('0x15')]);}logger[_0x5f13('0x13')](_0x5f13('0xe'),_0x539b5d,_0x136af9['error'][_0x5f13('0x15')]);return _0x1e822f(_0x136af9[_0x5f13('0x13')][_0x5f13('0x15')]);}else{logger[_0x5f13('0x16')](_0x5f13('0xe'),_0x539b5d,_0x5f13('0x11'));_0x1e822f(_0x136af9[_0x5f13('0x17')][_0x5f13('0x15')]);}})[_0x5f13('0x18')](function(_0x3ff9c8){logger[_0x5f13('0x13')](_0x5f13('0xe'),_0x539b5d,_0x3ff9c8);_0x4ae6ce(_0x3ff9c8);});});} \ No newline at end of file +var _0x4175=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2fb091,_0x5c8216){var _0x4a0076=function(_0x3e601a){while(--_0x3e601a){_0x2fb091['push'](_0x2fb091['shift']());}};_0x4a0076(++_0x5c8216);}(_0x4175,0x149));var _0x5417=function(_0xb1bd08,_0x58ea43){_0xb1bd08=_0xb1bd08-0x0;var _0x5548ec=_0x4175[_0xb1bd08];return _0x5548ec;};'use strict';var _=require(_0x5417('0x0'));var util=require(_0x5417('0x1'));var moment=require(_0x5417('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5417('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5417('0x4'))(_0x5417('0x5'));var config=require(_0x5417('0x6'));var jayson=require(_0x5417('0x7'));var client=jayson[_0x5417('0x8')][_0x5417('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3742b4,_0x2e9726,_0x3c6478){return new BPromise(function(_0x820788,_0x5e3c8f){return client[_0x5417('0xa')](_0x3742b4,_0x3c6478)[_0x5417('0xb')](function(_0x4b1f97){logger[_0x5417('0xc')](_0x5417('0xd'),_0x2e9726,'request\x20sent');logger[_0x5417('0xe')](_0x5417('0xf'),_0x2e9726,'request\x20sent',JSON[_0x5417('0x10')](_0x4b1f97));if(_0x4b1f97[_0x5417('0x11')]){if(_0x4b1f97[_0x5417('0x11')][_0x5417('0x12')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2e9726,_0x4b1f97[_0x5417('0x11')][_0x5417('0x13')]);return _0x5e3c8f(_0x4b1f97[_0x5417('0x11')][_0x5417('0x13')]);}logger[_0x5417('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x2e9726,_0x4b1f97['error'][_0x5417('0x13')]);return _0x820788(_0x4b1f97[_0x5417('0x11')][_0x5417('0x13')]);}else{logger[_0x5417('0xc')](_0x5417('0xd'),_0x2e9726,_0x5417('0x14'));_0x820788(_0x4b1f97[_0x5417('0x15')]['message']);}})[_0x5417('0x16')](function(_0x271e46){logger['error'](_0x5417('0xd'),_0x2e9726,_0x271e46);_0x5e3c8f(_0x271e46);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 7d5ed67..f8be6f7 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 _0xc8ee=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xc8ee,0x160));var _0xec8e=function(_0x48f1e2,_0x21ef93){_0x48f1e2=_0x48f1e2-0x0;var _0x2724ff=_0xc8ee[_0x48f1e2];return _0x2724ff;};'use strict';var multer=require(_0xec8e('0x0'));var util=require(_0xec8e('0x1'));var path=require(_0xec8e('0x2'));var timeout=require('connect-timeout');var express=require(_0xec8e('0x3'));var router=express[_0xec8e('0x4')]();var fs_extra=require(_0xec8e('0x5'));var auth=require(_0xec8e('0x6'));var interaction=require(_0xec8e('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xec8e('0x8')]('/',auth[_0xec8e('0x9')](),controller[_0xec8e('0xa')]);router[_0xec8e('0x8')](_0xec8e('0xb'),auth[_0xec8e('0x9')](),controller[_0xec8e('0xc')]);router[_0xec8e('0xd')]('/',auth['isAuthenticated'](),controller[_0xec8e('0xe')]);router[_0xec8e('0xf')](_0xec8e('0xb'),auth['isAuthenticated'](),controller[_0xec8e('0x10')]);router[_0xec8e('0x11')](_0xec8e('0xb'),auth[_0xec8e('0x9')](),controller[_0xec8e('0x12')]);module[_0xec8e('0x13')]=router; \ No newline at end of file +var _0xb78e=['../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','multer','util','connect-timeout','Router','fs-extra'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb78e,0xa5));var _0xeb78=function(_0x52d78c,_0x264568){_0x52d78c=_0x52d78c-0x0;var _0x1ffd7c=_0xb78e[_0x52d78c];return _0x1ffd7c;};'use strict';var multer=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var path=require('path');var timeout=require(_0xeb78('0x2'));var express=require('express');var router=express[_0xeb78('0x3')]();var fs_extra=require(_0xeb78('0x4'));var auth=require(_0xeb78('0x5'));var interaction=require(_0xeb78('0x6'));var config=require('../../config/environment');var controller=require(_0xeb78('0x7'));router[_0xeb78('0x8')]('/',auth[_0xeb78('0x9')](),controller[_0xeb78('0xa')]);router[_0xeb78('0x8')]('/:id',auth[_0xeb78('0x9')](),controller[_0xeb78('0xb')]);router[_0xeb78('0xc')]('/',auth[_0xeb78('0x9')](),controller[_0xeb78('0xd')]);router[_0xeb78('0xe')](_0xeb78('0xf'),auth[_0xeb78('0x9')](),controller[_0xeb78('0x10')]);router['delete']('/:id',auth[_0xeb78('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 9213ffc..b0b20fc 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 _0xdf16=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x5c7aa8,_0xa36f10){var _0x5318ed=function(_0x5d8924){while(--_0x5d8924){_0x5c7aa8['push'](_0x5c7aa8['shift']());}};_0x5318ed(++_0xa36f10);}(_0xdf16,0x1d8));var _0x6df1=function(_0x19324e,_0x35cc43){_0x19324e=_0x19324e-0x0;var _0xcfde4c=_0xdf16[_0x19324e];return _0xcfde4c;};'use strict';var Sequelize=require('sequelize');module[_0x6df1('0x0')]={'type':{'type':Sequelize[_0x6df1('0x1')](_0x6df1('0x2'),_0x6df1('0x3'),_0x6df1('0x4'),_0x6df1('0x5'),_0x6df1('0x6')),'defaultValue':_0x6df1('0x2')},'content':{'type':Sequelize[_0x6df1('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6df1('0x1')]('string',_0x6df1('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6df1('0x7')]},'nameField':{'type':Sequelize[_0x6df1('0x7')]},'customField':{'type':Sequelize[_0x6df1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6df1('0x7')]}}; \ No newline at end of file +var _0x9dfe=['sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN'];(function(_0x2e6747,_0x3db877){var _0x154a35=function(_0x227ee0){while(--_0x227ee0){_0x2e6747['push'](_0x2e6747['shift']());}};_0x154a35(++_0x3db877);}(_0x9dfe,0xc8));var _0xe9df=function(_0x5e840c,_0xa66906){_0x5e840c=_0x5e840c-0x0;var _0x100020=_0x9dfe[_0x5e840c];return _0x100020;};'use strict';var Sequelize=require(_0xe9df('0x0'));module[_0xe9df('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xe9df('0x2'),_0xe9df('0x3'),_0xe9df('0x4'),_0xe9df('0x5')),'defaultValue':_0xe9df('0x6')},'content':{'type':Sequelize[_0xe9df('0x7')]},'key':{'type':Sequelize[_0xe9df('0x7')]},'keyType':{'type':Sequelize[_0xe9df('0x8')]('string',_0xe9df('0x2'),_0xe9df('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe9df('0x7')]},'nameField':{'type':Sequelize[_0xe9df('0x7')]},'customField':{'type':Sequelize[_0xe9df('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe9df('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 452d911..6411d39 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 _0x9645=['options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter'];(function(_0x39949a,_0x3abfc8){var _0x218fa8=function(_0x392715){while(--_0x392715){_0x39949a['push'](_0x39949a['shift']());}};_0x218fa8(++_0x3abfc8);}(_0x9645,0xf2));var _0x5964=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x9645[_0x3cb30b];return _0x2ca717;};'use strict';var emlformat=require(_0x5964('0x0'));var rimraf=require(_0x5964('0x1'));var zipdir=require(_0x5964('0x2'));var jsonpatch=require(_0x5964('0x3'));var rp=require(_0x5964('0x4'));var moment=require(_0x5964('0x5'));var BPromise=require(_0x5964('0x6'));var Mustache=require(_0x5964('0x7'));var util=require('util');var path=require(_0x5964('0x8'));var sox=require('sox');var csv=require(_0x5964('0x9'));var ejs=require(_0x5964('0xa'));var fs=require('fs');var fs_extra=require(_0x5964('0xb'));var _=require(_0x5964('0xc'));var squel=require(_0x5964('0xd'));var crypto=require(_0x5964('0xe'));var jsforce=require(_0x5964('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5964('0x9'));var querystring=require(_0x5964('0x10'));var Papa=require(_0x5964('0x11'));var Redis=require('ioredis');var authService=require(_0x5964('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5964('0x13'));var hardwareService=require(_0x5964('0x14'));var logger=require(_0x5964('0x15'))(_0x5964('0x16'));var utils=require('../../config/utils');var config=require(_0x5964('0x17'));var licenseUtil=require(_0x5964('0x18'));var db=require(_0x5964('0x19'))['db'];function respondWithStatusCode(_0x2af469,_0x3a26eb){_0x3a26eb=_0x3a26eb||0xcc;return function(_0x32c34d){if(_0x32c34d){return _0x2af469['sendStatus'](_0x3a26eb);}return _0x2af469['status'](_0x3a26eb)[_0x5964('0x1a')]();};}function respondWithResult(_0x120772,_0x2200e2){_0x2200e2=_0x2200e2||0xc8;return function(_0x4fb63c){if(_0x4fb63c){return _0x120772[_0x5964('0x1b')](_0x2200e2)[_0x5964('0x1c')](_0x4fb63c);}};}function respondWithFilteredResult(_0x27c8b5,_0x21b8d5){return function(_0x4ea2e4){if(_0x4ea2e4){var _0x5236f8=typeof _0x21b8d5[_0x5964('0x1d')]===_0x5964('0x1e')&&typeof _0x21b8d5[_0x5964('0x1f')]==='undefined';var _0x16c5d1=_0x4ea2e4[_0x5964('0x20')];var _0x5e54ee=_0x5236f8?0x0:_0x21b8d5[_0x5964('0x1d')];var _0x5afa4f=_0x5236f8?_0x4ea2e4[_0x5964('0x20')]:_0x21b8d5['offset']+_0x21b8d5[_0x5964('0x1f')];var _0x16cd5c;if(_0x5afa4f>=_0x16c5d1){_0x5afa4f=_0x16c5d1;_0x16cd5c=0xc8;}else{_0x16cd5c=0xce;}_0x27c8b5[_0x5964('0x1b')](_0x16cd5c);return _0x27c8b5[_0x5964('0x21')](_0x5964('0x22'),_0x5e54ee+'-'+_0x5afa4f+'/'+_0x16c5d1)[_0x5964('0x1c')](_0x4ea2e4);}return null;};}function patchUpdates(_0x442bf3){return function(_0x22ade4){try{jsonpatch['apply'](_0x22ade4,_0x442bf3,!![]);}catch(_0xd98d93){return BPromise[_0x5964('0x23')](_0xd98d93);}return _0x22ade4[_0x5964('0x24')]();};}function saveUpdates(_0x1022c6,_0x4eed38){return function(_0x18fdb9){if(_0x18fdb9){return _0x18fdb9[_0x5964('0x25')](_0x1022c6)[_0x5964('0x26')](function(_0x3fc12f){return _0x3fc12f;});}return null;};}function removeEntity(_0x2002e1,_0x482c3d){return function(_0x2055af){if(_0x2055af){return _0x2055af[_0x5964('0x27')]()[_0x5964('0x26')](function(){_0x2002e1[_0x5964('0x1b')](0xcc)[_0x5964('0x1a')]();});}};}function handleEntityNotFound(_0x34eb82,_0x2a257e){return function(_0x46fc39){if(!_0x46fc39){_0x34eb82['sendStatus'](0x194);}return _0x46fc39;};}function handleError(_0x3c04ad,_0x43940d){_0x43940d=_0x43940d||0x1f4;return function(_0x134b9a){logger[_0x5964('0x28')](_0x134b9a[_0x5964('0x29')]);if(_0x134b9a[_0x5964('0x2a')]){delete _0x134b9a[_0x5964('0x2a')];}_0x3c04ad[_0x5964('0x1b')](_0x43940d)[_0x5964('0x2b')](_0x134b9a);};}exports[_0x5964('0x2c')]=function(_0x10bc69,_0x4c0bc6){var _0x101ed1={},_0x2f2879={},_0x10c0d4={'count':0x0,'rows':[]};var _0x40a4c3=_[_0x5964('0x2d')](db[_0x5964('0x2e')][_0x5964('0x2f')],function(_0x3c0e6d){return{'name':_0x3c0e6d['fieldName'],'type':_0x3c0e6d['type'][_0x5964('0x30')]};});_0x2f2879[_0x5964('0x31')]=_[_0x5964('0x2d')](_0x40a4c3,_0x5964('0x2a'));_0x2f2879['query']=_[_0x5964('0x32')](_0x10bc69[_0x5964('0x33')]);_0x2f2879[_0x5964('0x34')]=_[_0x5964('0x35')](_0x2f2879['model'],_0x2f2879['query']);_0x101ed1[_0x5964('0x36')]=_[_0x5964('0x35')](_0x2f2879[_0x5964('0x31')],qs['fields'](_0x10bc69[_0x5964('0x33')][_0x5964('0x37')]));_0x101ed1['attributes']=_0x101ed1[_0x5964('0x36')][_0x5964('0x38')]?_0x101ed1[_0x5964('0x36')]:_0x2f2879[_0x5964('0x31')];if(!_0x10bc69[_0x5964('0x33')]['hasOwnProperty'](_0x5964('0x39'))){_0x101ed1[_0x5964('0x1f')]=qs['limit'](_0x10bc69['query']['limit']);_0x101ed1['offset']=qs['offset'](_0x10bc69['query'][_0x5964('0x1d')]);}_0x101ed1[_0x5964('0x3a')]=qs['sort'](_0x10bc69[_0x5964('0x33')][_0x5964('0x3b')]);_0x101ed1[_0x5964('0x3c')]=qs['filters'](_[_0x5964('0x3d')](_0x10bc69[_0x5964('0x33')],_0x2f2879[_0x5964('0x34')]),_0x40a4c3);if(_0x10bc69['query']['filter']){_0x101ed1[_0x5964('0x3c')]=_[_0x5964('0x3e')](_0x101ed1[_0x5964('0x3c')],{'$or':_[_0x5964('0x2d')](_0x40a4c3,function(_0x2a58bc){if(_0x2a58bc[_0x5964('0x3f')]!==_0x5964('0x40')){var _0x1f7ad0={};_0x1f7ad0[_0x2a58bc['name']]={'$like':'%'+_0x10bc69[_0x5964('0x33')][_0x5964('0x41')]+'%'};return _0x1f7ad0;}})});}_0x101ed1=_['merge']({},_0x101ed1,_0x10bc69[_0x5964('0x42')]);var _0x5927ac={'where':_0x101ed1[_0x5964('0x3c')]};return db[_0x5964('0x2e')][_0x5964('0x20')](_0x5927ac)[_0x5964('0x26')](function(_0x148bb7){_0x10c0d4[_0x5964('0x20')]=_0x148bb7;if(_0x10bc69[_0x5964('0x33')][_0x5964('0x43')]){_0x101ed1[_0x5964('0x44')]=[{'all':!![]}];}return db[_0x5964('0x2e')][_0x5964('0x45')](_0x101ed1);})[_0x5964('0x26')](function(_0x521ebc){_0x10c0d4[_0x5964('0x46')]=_0x521ebc;return _0x10c0d4;})[_0x5964('0x26')](respondWithFilteredResult(_0x4c0bc6,_0x101ed1))[_0x5964('0x47')](handleError(_0x4c0bc6,null));};exports[_0x5964('0x48')]=function(_0x5563bb,_0x4e2a2d){var _0x37baea={'raw':!![],'where':{'id':_0x5563bb['params']['id']}},_0x56f4fc={};_0x56f4fc[_0x5964('0x31')]=_[_0x5964('0x32')](db['ZohoField'][_0x5964('0x2f')]);_0x56f4fc[_0x5964('0x33')]=_[_0x5964('0x32')](_0x5563bb['query']);_0x56f4fc[_0x5964('0x34')]=_[_0x5964('0x35')](_0x56f4fc[_0x5964('0x31')],_0x56f4fc[_0x5964('0x33')]);_0x37baea[_0x5964('0x36')]=_[_0x5964('0x35')](_0x56f4fc['model'],qs[_0x5964('0x37')](_0x5563bb['query'][_0x5964('0x37')]));_0x37baea['attributes']=_0x37baea[_0x5964('0x36')]['length']?_0x37baea['attributes']:_0x56f4fc[_0x5964('0x31')];if(_0x5563bb['query']['includeAll']){_0x37baea[_0x5964('0x44')]=[{'all':!![]}];}_0x37baea=_[_0x5964('0x3e')]({},_0x37baea,_0x5563bb['options']);return db[_0x5964('0x2e')][_0x5964('0x49')](_0x37baea)[_0x5964('0x26')](handleEntityNotFound(_0x4e2a2d,null))[_0x5964('0x26')](respondWithResult(_0x4e2a2d,null))['catch'](handleError(_0x4e2a2d,null));};exports[_0x5964('0x4a')]=function(_0x385a5b,_0x455d89){return db[_0x5964('0x2e')][_0x5964('0x4a')](_0x385a5b[_0x5964('0x4b')],{})[_0x5964('0x26')](respondWithResult(_0x455d89,0xc9))['catch'](handleError(_0x455d89,null));};exports['update']=function(_0x3b422d,_0x579148){if(_0x3b422d[_0x5964('0x4b')]['id']){delete _0x3b422d[_0x5964('0x4b')]['id'];}return db[_0x5964('0x2e')]['find']({'where':{'id':_0x3b422d['params']['id']}})[_0x5964('0x26')](handleEntityNotFound(_0x579148,null))[_0x5964('0x26')](saveUpdates(_0x3b422d['body'],null))[_0x5964('0x26')](respondWithResult(_0x579148,null))[_0x5964('0x47')](handleError(_0x579148,null));};exports['destroy']=function(_0x2b468e,_0x244307){return db[_0x5964('0x2e')][_0x5964('0x49')]({'where':{'id':_0x2b468e[_0x5964('0x4c')]['id']}})[_0x5964('0x26')](handleEntityNotFound(_0x244307,null))[_0x5964('0x26')](removeEntity(_0x244307,null))[_0x5964('0x47')](handleError(_0x244307,null));}; \ No newline at end of file +var _0x3278=['path','sox','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','ZohoField','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','body','update','zip-dir','fast-json-patch','moment','mustache'];(function(_0x4e23ca,_0x5b12c5){var _0x49a19b=function(_0x5dc0f1){while(--_0x5dc0f1){_0x4e23ca['push'](_0x4e23ca['shift']());}};_0x49a19b(++_0x5b12c5);}(_0x3278,0x11c));var _0x8327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3278[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8327('0x0'));var jsonpatch=require(_0x8327('0x1'));var rp=require('request-promise');var moment=require(_0x8327('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8327('0x3'));var util=require('util');var path=require(_0x8327('0x4'));var sox=require(_0x8327('0x5'));var csv=require('to-csv');var ejs=require(_0x8327('0x6'));var fs=require('fs');var fs_extra=require(_0x8327('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8327('0x8'));var deskjs=require(_0x8327('0x9'));var toCsv=require('to-csv');var querystring=require(_0x8327('0xa'));var Papa=require(_0x8327('0xb'));var Redis=require(_0x8327('0xc'));var authService=require(_0x8327('0xd'));var qs=require(_0x8327('0xe'));var as=require(_0x8327('0xf'));var hardwareService=require(_0x8327('0x10'));var logger=require('../../config/logger')(_0x8327('0x11'));var utils=require(_0x8327('0x12'));var config=require(_0x8327('0x13'));var licenseUtil=require(_0x8327('0x14'));var db=require(_0x8327('0x15'))['db'];function respondWithStatusCode(_0x3ba4cf,_0x2aad8d){_0x2aad8d=_0x2aad8d||0xcc;return function(_0x27d0e6){if(_0x27d0e6){return _0x3ba4cf[_0x8327('0x16')](_0x2aad8d);}return _0x3ba4cf[_0x8327('0x17')](_0x2aad8d)[_0x8327('0x18')]();};}function respondWithResult(_0x5a8a50,_0x5032e3){_0x5032e3=_0x5032e3||0xc8;return function(_0x497d8b){if(_0x497d8b){return _0x5a8a50[_0x8327('0x17')](_0x5032e3)[_0x8327('0x19')](_0x497d8b);}};}function respondWithFilteredResult(_0x20e6eb,_0x51c155){return function(_0x311a18){if(_0x311a18){var _0x2ee302=typeof _0x51c155[_0x8327('0x1a')]===_0x8327('0x1b')&&typeof _0x51c155['limit']==='undefined';var _0x49b8d3=_0x311a18[_0x8327('0x1c')];var _0x1960e3=_0x2ee302?0x0:_0x51c155[_0x8327('0x1a')];var _0x131f43=_0x2ee302?_0x311a18[_0x8327('0x1c')]:_0x51c155[_0x8327('0x1a')]+_0x51c155[_0x8327('0x1d')];var _0x34c9d3;if(_0x131f43>=_0x49b8d3){_0x131f43=_0x49b8d3;_0x34c9d3=0xc8;}else{_0x34c9d3=0xce;}_0x20e6eb[_0x8327('0x17')](_0x34c9d3);return _0x20e6eb[_0x8327('0x1e')]('Content-Range',_0x1960e3+'-'+_0x131f43+'/'+_0x49b8d3)[_0x8327('0x19')](_0x311a18);}return null;};}function patchUpdates(_0x49cdc7){return function(_0xa33cd2){try{jsonpatch[_0x8327('0x1f')](_0xa33cd2,_0x49cdc7,!![]);}catch(_0x86047d){return BPromise[_0x8327('0x20')](_0x86047d);}return _0xa33cd2[_0x8327('0x21')]();};}function saveUpdates(_0x189aca,_0x483bee){return function(_0x1bf306){if(_0x1bf306){return _0x1bf306['update'](_0x189aca)[_0x8327('0x22')](function(_0x115e8d){return _0x115e8d;});}return null;};}function removeEntity(_0x42e76d,_0x5c6e96){return function(_0x565beb){if(_0x565beb){return _0x565beb[_0x8327('0x23')]()[_0x8327('0x22')](function(){_0x42e76d[_0x8327('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e0b1e,_0x1393b2){return function(_0x207b6b){if(!_0x207b6b){_0x2e0b1e['sendStatus'](0x194);}return _0x207b6b;};}function handleError(_0x44417b,_0x4da11a){_0x4da11a=_0x4da11a||0x1f4;return function(_0x44bd62){logger[_0x8327('0x24')](_0x44bd62[_0x8327('0x25')]);if(_0x44bd62[_0x8327('0x26')]){delete _0x44bd62[_0x8327('0x26')];}_0x44417b['status'](_0x4da11a)['send'](_0x44bd62);};}exports[_0x8327('0x27')]=function(_0x36b36f,_0x136fb8){var _0x1897f5={},_0x3c9368={},_0x1a6c33={'count':0x0,'rows':[]};var _0x1ff98d=_[_0x8327('0x28')](db['ZohoField'][_0x8327('0x29')],function(_0x2dc915){return{'name':_0x2dc915['fieldName'],'type':_0x2dc915[_0x8327('0x2a')][_0x8327('0x2b')]};});_0x3c9368[_0x8327('0x2c')]=_[_0x8327('0x28')](_0x1ff98d,_0x8327('0x26'));_0x3c9368[_0x8327('0x2d')]=_[_0x8327('0x2e')](_0x36b36f[_0x8327('0x2d')]);_0x3c9368[_0x8327('0x2f')]=_['intersection'](_0x3c9368[_0x8327('0x2c')],_0x3c9368['query']);_0x1897f5[_0x8327('0x30')]=_['intersection'](_0x3c9368[_0x8327('0x2c')],qs[_0x8327('0x31')](_0x36b36f['query'][_0x8327('0x31')]));_0x1897f5[_0x8327('0x30')]=_0x1897f5[_0x8327('0x30')]['length']?_0x1897f5[_0x8327('0x30')]:_0x3c9368['model'];if(!_0x36b36f[_0x8327('0x2d')][_0x8327('0x32')](_0x8327('0x33'))){_0x1897f5['limit']=qs[_0x8327('0x1d')](_0x36b36f[_0x8327('0x2d')][_0x8327('0x1d')]);_0x1897f5['offset']=qs[_0x8327('0x1a')](_0x36b36f[_0x8327('0x2d')][_0x8327('0x1a')]);}_0x1897f5['order']=qs[_0x8327('0x34')](_0x36b36f[_0x8327('0x2d')][_0x8327('0x34')]);_0x1897f5[_0x8327('0x35')]=qs['filters'](_['pick'](_0x36b36f['query'],_0x3c9368[_0x8327('0x2f')]),_0x1ff98d);if(_0x36b36f['query']['filter']){_0x1897f5['where']=_['merge'](_0x1897f5[_0x8327('0x35')],{'$or':_[_0x8327('0x28')](_0x1ff98d,function(_0x2d8fee){if(_0x2d8fee['type']!==_0x8327('0x36')){var _0x5ee77f={};_0x5ee77f[_0x2d8fee[_0x8327('0x26')]]={'$like':'%'+_0x36b36f[_0x8327('0x2d')][_0x8327('0x37')]+'%'};return _0x5ee77f;}})});}_0x1897f5=_[_0x8327('0x38')]({},_0x1897f5,_0x36b36f[_0x8327('0x39')]);var _0x2b472f={'where':_0x1897f5['where']};return db[_0x8327('0x3a')]['count'](_0x2b472f)[_0x8327('0x22')](function(_0x5bec83){_0x1a6c33[_0x8327('0x1c')]=_0x5bec83;if(_0x36b36f[_0x8327('0x2d')][_0x8327('0x3b')]){_0x1897f5[_0x8327('0x3c')]=[{'all':!![]}];}return db[_0x8327('0x3a')][_0x8327('0x3d')](_0x1897f5);})[_0x8327('0x22')](function(_0x5e34b4){_0x1a6c33[_0x8327('0x3e')]=_0x5e34b4;return _0x1a6c33;})[_0x8327('0x22')](respondWithFilteredResult(_0x136fb8,_0x1897f5))[_0x8327('0x3f')](handleError(_0x136fb8,null));};exports[_0x8327('0x40')]=function(_0x3b7082,_0x574329){var _0x5cebf2={'raw':!![],'where':{'id':_0x3b7082[_0x8327('0x41')]['id']}},_0x1c407e={};_0x1c407e[_0x8327('0x2c')]=_['keys'](db[_0x8327('0x3a')]['rawAttributes']);_0x1c407e[_0x8327('0x2d')]=_['keys'](_0x3b7082['query']);_0x1c407e[_0x8327('0x2f')]=_[_0x8327('0x42')](_0x1c407e[_0x8327('0x2c')],_0x1c407e[_0x8327('0x2d')]);_0x5cebf2[_0x8327('0x30')]=_[_0x8327('0x42')](_0x1c407e[_0x8327('0x2c')],qs[_0x8327('0x31')](_0x3b7082[_0x8327('0x2d')][_0x8327('0x31')]));_0x5cebf2[_0x8327('0x30')]=_0x5cebf2[_0x8327('0x30')][_0x8327('0x43')]?_0x5cebf2[_0x8327('0x30')]:_0x1c407e[_0x8327('0x2c')];if(_0x3b7082[_0x8327('0x2d')][_0x8327('0x3b')]){_0x5cebf2['include']=[{'all':!![]}];}_0x5cebf2=_[_0x8327('0x38')]({},_0x5cebf2,_0x3b7082['options']);return db[_0x8327('0x3a')][_0x8327('0x44')](_0x5cebf2)[_0x8327('0x22')](handleEntityNotFound(_0x574329,null))[_0x8327('0x22')](respondWithResult(_0x574329,null))[_0x8327('0x3f')](handleError(_0x574329,null));};exports[_0x8327('0x45')]=function(_0x48474c,_0x4380a3){return db[_0x8327('0x3a')][_0x8327('0x45')](_0x48474c[_0x8327('0x46')],{})[_0x8327('0x22')](respondWithResult(_0x4380a3,0xc9))[_0x8327('0x3f')](handleError(_0x4380a3,null));};exports[_0x8327('0x47')]=function(_0x42595b,_0x3fe354){if(_0x42595b['body']['id']){delete _0x42595b['body']['id'];}return db[_0x8327('0x3a')][_0x8327('0x44')]({'where':{'id':_0x42595b[_0x8327('0x41')]['id']}})[_0x8327('0x22')](handleEntityNotFound(_0x3fe354,null))['then'](saveUpdates(_0x42595b[_0x8327('0x46')],null))[_0x8327('0x22')](respondWithResult(_0x3fe354,null))[_0x8327('0x3f')](handleError(_0x3fe354,null));};exports[_0x8327('0x23')]=function(_0x26e9eb,_0xa539a8){return db['ZohoField'][_0x8327('0x44')]({'where':{'id':_0x26e9eb[_0x8327('0x41')]['id']}})[_0x8327('0x22')](handleEntityNotFound(_0xa539a8,null))['then'](removeEntity(_0xa539a8,null))['catch'](handleError(_0xa539a8,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 5eef623..7008684 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 _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','idField','FieldId'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x86d3('0x9'),_0x86d3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','api'];(function(_0x491919,_0x129871){var _0x21aaab=function(_0x22922d){while(--_0x22922d){_0x491919['push'](_0x491919['shift']());}};_0x21aaab(++_0x129871);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0xfcf0[_0x2e6c19];return _0x52885d;};'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':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xd'),_0x0fcf('0xe')],'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 aec17c1..3e596de 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 _0x8f54=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5f4b13,_0x2d88cb){var _0x25d567=function(_0x2e019d){while(--_0x2e019d){_0x5f4b13['push'](_0x5f4b13['shift']());}};_0x25d567(++_0x2d88cb);}(_0x8f54,0xd7));var _0x48f5=function(_0x3d9e42,_0x53bdb3){_0x3d9e42=_0x3d9e42-0x0;var _0x25b703=_0x8f54[_0x3d9e42];return _0x25b703;};'use strict';var _=require(_0x48f5('0x0'));var util=require(_0x48f5('0x1'));var moment=require(_0x48f5('0x2'));var BPromise=require(_0x48f5('0x3'));var rs=require(_0x48f5('0x4'));var fs=require('fs');var Redis=require(_0x48f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x48f5('0x6'));var logger=require(_0x48f5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x48f5('0x8'));var client=jayson[_0x48f5('0x9')][_0x48f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a74c,_0x20cee6,_0x44c243){return new BPromise(function(_0x259568,_0x2d3481){return client[_0x48f5('0xb')](_0x28a74c,_0x44c243)['then'](function(_0x364c64){logger['info'](_0x48f5('0xc'),_0x20cee6,_0x48f5('0xd'));logger[_0x48f5('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x20cee6,_0x48f5('0xd'),JSON[_0x48f5('0xf')](_0x364c64));if(_0x364c64[_0x48f5('0x10')]){if(_0x364c64[_0x48f5('0x10')][_0x48f5('0x11')]===0x1f4){logger[_0x48f5('0x10')](_0x48f5('0xc'),_0x20cee6,_0x364c64[_0x48f5('0x10')][_0x48f5('0x12')]);return _0x2d3481(_0x364c64[_0x48f5('0x10')][_0x48f5('0x12')]);}logger[_0x48f5('0x10')](_0x48f5('0xc'),_0x20cee6,_0x364c64['error'][_0x48f5('0x12')]);return _0x259568(_0x364c64[_0x48f5('0x10')][_0x48f5('0x12')]);}else{logger['info'](_0x48f5('0xc'),_0x20cee6,_0x48f5('0xd'));_0x259568(_0x364c64[_0x48f5('0x13')][_0x48f5('0x12')]);}})[_0x48f5('0x14')](function(_0x310f27){logger[_0x48f5('0x10')](_0x48f5('0xc'),_0x20cee6,_0x310f27);_0x2d3481(_0x310f27);});});} \ No newline at end of file +var _0xbe26=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x580df3,_0x5c8d33){var _0x546291=function(_0x1c0470){while(--_0x1c0470){_0x580df3['push'](_0x580df3['shift']());}};_0x546291(++_0x5c8d33);}(_0xbe26,0x94));var _0x6be2=function(_0x4a2c99,_0x296912){_0x4a2c99=_0x4a2c99-0x0;var _0x69813b=_0xbe26[_0x4a2c99];return _0x69813b;};'use strict';var _=require(_0x6be2('0x0'));var util=require(_0x6be2('0x1'));var moment=require(_0x6be2('0x2'));var BPromise=require(_0x6be2('0x3'));var rs=require(_0x6be2('0x4'));var fs=require('fs');var Redis=require(_0x6be2('0x5'));var db=require(_0x6be2('0x6'))['db'];var utils=require(_0x6be2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6be2('0x8'));var jayson=require(_0x6be2('0x9'));var client=jayson[_0x6be2('0xa')][_0x6be2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16ed60,_0x380f1b,_0x72cef0){return new BPromise(function(_0xe1c88,_0x513353){return client['request'](_0x16ed60,_0x72cef0)['then'](function(_0x1921b4){logger[_0x6be2('0xc')](_0x6be2('0xd'),_0x380f1b,_0x6be2('0xe'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x380f1b,_0x6be2('0xe'),JSON[_0x6be2('0xf')](_0x1921b4));if(_0x1921b4[_0x6be2('0x10')]){if(_0x1921b4[_0x6be2('0x10')][_0x6be2('0x11')]===0x1f4){logger['error'](_0x6be2('0xd'),_0x380f1b,_0x1921b4[_0x6be2('0x10')][_0x6be2('0x12')]);return _0x513353(_0x1921b4[_0x6be2('0x10')]['message']);}logger[_0x6be2('0x10')](_0x6be2('0xd'),_0x380f1b,_0x1921b4[_0x6be2('0x10')][_0x6be2('0x12')]);return _0xe1c88(_0x1921b4['error']['message']);}else{logger[_0x6be2('0xc')](_0x6be2('0xd'),_0x380f1b,_0x6be2('0xe'));_0xe1c88(_0x1921b4['result']['message']);}})['catch'](function(_0x129f4e){logger['error'](_0x6be2('0xd'),_0x380f1b,_0x129f4e);_0x513353(_0x129f4e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index dda2ddc..eca5404 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4dbe67,_0x1ebc59){var _0x3d7eb9=function(_0x44eecb){while(--_0x44eecb){_0x4dbe67['push'](_0x4dbe67['shift']());}};_0x3d7eb9(++_0x1ebc59);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x453a58,_0x24cc95){var _0x26212c=function(_0x429f94){while(--_0x429f94){_0x453a58['push'](_0x453a58['shift']());}};_0x26212c(++_0x24cc95);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcb91[_0x19950b];return _0x3c6b41;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index d694c6c..4b336ee 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 _0x1315=['unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x44d3d7,_0x1c6356){var _0x1886c0=function(_0x30b3ab){while(--_0x30b3ab){_0x44d3d7['push'](_0x44d3d7['shift']());}};_0x1886c0(++_0x1c6356);}(_0x1315,0x84));var _0x5131=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0x1315[_0x542d80];return _0x1f4492;};'use strict';var Sequelize=require(_0x5131('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5131('0x1')},'version':{'type':Sequelize[_0x5131('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x5131('0x2')],'defaultValue':_0x5131('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5131('0x2')]},'size':{'type':Sequelize[_0x5131('0x4')]},'active':{'type':Sequelize[_0x5131('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x5131('0x2')]},'state':{'type':Sequelize[_0x5131('0x2')],'unique':_0x5131('0x6')},'description':{'type':Sequelize[_0x5131('0x2')]},'title':{'type':Sequelize[_0x5131('0x2')]},'remoteUri':{'type':Sequelize[_0x5131('0x2')]},'link':{'type':Sequelize[_0x5131('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4bb0=['app.js','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x1720f5,_0x41fe5e){var _0x94c1a=function(_0x43d585){while(--_0x43d585){_0x1720f5['push'](_0x1720f5['shift']());}};_0x94c1a(++_0x41fe5e);}(_0x4bb0,0x73));var _0x04bb=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x4bb0[_0x1f7201];return _0x289fd2;};'use strict';var Sequelize=require(_0x04bb('0x0'));module[_0x04bb('0x1')]={'name':{'type':Sequelize[_0x04bb('0x2')],'allowNull':![],'unique':_0x04bb('0x3')},'version':{'type':Sequelize[_0x04bb('0x2')],'allowNull':![],'unique':_0x04bb('0x3')},'main':{'type':Sequelize[_0x04bb('0x2')],'defaultValue':_0x04bb('0x4')},'filename':{'type':Sequelize[_0x04bb('0x2')]},'path':{'type':Sequelize[_0x04bb('0x2')]},'type':{'type':Sequelize[_0x04bb('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x04bb('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x04bb('0x2')]},'logo':{'type':Sequelize[_0x04bb('0x2')]},'state':{'type':Sequelize[_0x04bb('0x2')],'unique':_0x04bb('0x6')},'description':{'type':Sequelize[_0x04bb('0x2')]},'title':{'type':Sequelize[_0x04bb('0x2')]},'remoteUri':{'type':Sequelize[_0x04bb('0x2')]},'link':{'type':Sequelize[_0x04bb('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 4ba81eb..415713d 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 _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x1a37,0xb4));var _0x71a3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1a37[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file +var _0x781d=['../../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','error','name','send','index','map','Integration','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','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'];(function(_0x48a992,_0x50fd86){var _0x24c3ae=function(_0x67488d){while(--_0x67488d){_0x48a992['push'](_0x48a992['shift']());}};_0x24c3ae(++_0x50fd86);}(_0x781d,0x14a));var _0xd781=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x781d[_0x501510];return _0x1e6ee5;};'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));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f5fcddd..5e7669f 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 _0xb950=['util','../../config/logger','bluebird','request-promise','rimraf','./integration.attributes','define','Integration','integrations','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb950,0x1e9));var _0x0b95=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xb950[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0b95('0x0'));var util=require(_0x0b95('0x1'));var logger=require(_0x0b95('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0b95('0x3'));var rp=require(_0x0b95('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b95('0x5'));var config=require('../../config/environment');var attributes=require(_0x0b95('0x6'));module['exports']=function(_0x5991f5,_0x302608){return _0x5991f5[_0x0b95('0x7')](_0x0b95('0x8'),attributes,{'tableName':_0x0b95('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x502f=['Integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x2a027e,_0x266cc1){var _0x2710f4=function(_0x1cfc72){while(--_0x1cfc72){_0x2a027e['push'](_0x2a027e['shift']());}};_0x2710f4(++_0x266cc1);}(_0x502f,0x1b3));var _0xf502=function(_0x1bc7bf,_0x46d717){_0x1bc7bf=_0x1bc7bf-0x0;var _0x1893f1=_0x502f[_0x1bc7bf];return _0x1893f1;};'use strict';var _=require(_0xf502('0x0'));var util=require(_0xf502('0x1'));var logger=require(_0xf502('0x2'))(_0xf502('0x3'));var moment=require(_0xf502('0x4'));var BPromise=require(_0xf502('0x5'));var rp=require(_0xf502('0x6'));var fs=require('fs');var path=require(_0xf502('0x7'));var rimraf=require(_0xf502('0x8'));var config=require(_0xf502('0x9'));var attributes=require(_0xf502('0xa'));module[_0xf502('0xb')]=function(_0x453e33,_0x46e176){return _0x453e33[_0xf502('0xc')](_0xf502('0xd'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index ff32dcf..a096e2f 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x4137,0xf8));var _0x7413=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4137[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0x0b0e,0x187));var _0xe0b0=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0x0b0e[_0x50f0a9];return _0x5a33d9;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b7cac05..b94173f 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 _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x179920,_0x47da64){var _0x3ee39c=function(_0x4ec53f){while(--_0x4ec53f){_0x179920['push'](_0x179920['shift']());}};_0x3ee39c(++_0x47da64);}(_0x1261,0x144));var _0x1126=function(_0x33ad1f,_0xfc2fc8){_0x33ad1f=_0x33ad1f-0x0;var _0x26ef22=_0x1261[_0x33ad1f];return _0x26ef22;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file +var _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0xf77528,_0x1b6f29){var _0x3d61dc=function(_0x138848){while(--_0x138848){_0xf77528['push'](_0xf77528['shift']());}};_0x3d61dc(++_0x1b6f29);}(_0x955f,0x1eb));var _0xf955=function(_0x5670e1,_0x3eded1){_0x5670e1=_0x5670e1-0x0;var _0x341c95=_0x955f[_0x5670e1];return _0x341c95;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f3bdc8f..bc6d5f1 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 _0x387d=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','TEXT','ENUM','SENT'];(function(_0x330960,_0x537c70){var _0x24a2a3=function(_0x12a5aa){while(--_0x12a5aa){_0x330960['push'](_0x330960['shift']());}};_0x24a2a3(++_0x537c70);}(_0x387d,0xd4));var _0xd387=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x387d[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0xd387('0x0'));module[_0xd387('0x1')]={'integration':{'type':Sequelize[_0xd387('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xd387('0x2')]},'integrationId':{'type':Sequelize[_0xd387('0x3')]},'contacts':{'type':Sequelize[_0xd387('0x2')]},'uniqueid':{'type':Sequelize[_0xd387('0x2')]},'calleridnum':{'type':Sequelize[_0xd387('0x2')]},'calleridname':{'type':Sequelize[_0xd387('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xd387('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd387('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd387('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd387('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd387('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd387('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd387('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd387('0x2')]},'connectedlinename':{'type':Sequelize[_0xd387('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd387('0x2')]},'context':{'type':Sequelize[_0xd387('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd387('0x2')]},'destchannel':{'type':Sequelize[_0xd387('0x2')]},'destchannelstate':{'type':Sequelize[_0xd387('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd387('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd387('0x2')]},'destaccountcode':{'type':Sequelize[_0xd387('0x2')]},'destcontext':{'type':Sequelize[_0xd387('0x2')]},'destexten':{'type':Sequelize[_0xd387('0x2')]},'destpriority':{'type':Sequelize[_0xd387('0x2')]},'destuniqueid':{'type':Sequelize[_0xd387('0x2')]},'messageId':{'type':Sequelize[_0xd387('0x2')]},'inReplyTo':{'type':Sequelize[_0xd387('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd387('0x2')]},'cc':{'type':Sequelize[_0xd387('0x2')]},'attachment':{'type':Sequelize[_0xd387('0x5')]},'html':{'type':Sequelize[_0xd387('0x5')]},'text':{'type':Sequelize[_0xd387('0x5')]},'status':{'type':Sequelize[_0xd387('0x6')](_0xd387('0x7'),'SENDING',_0xd387('0x8'),_0xd387('0x9'))},'url':{'type':Sequelize[_0xd387('0x2')]},'app':{'type':Sequelize[_0xd387('0x2')]},'appdata':{'type':Sequelize[_0xd387('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9bb2=['INTEGER','DATE','BOOLEAN','TEXT','SENT','RECEIVED','FAILED','exports','STRING'];(function(_0x5a4e48,_0x2586e0){var _0x35eddb=function(_0x28caa8){while(--_0x28caa8){_0x5a4e48['push'](_0x5a4e48['shift']());}};_0x35eddb(++_0x2586e0);}(_0x9bb2,0x154));var _0x29bb=function(_0x56bc52,_0x5f1730){_0x56bc52=_0x56bc52-0x0;var _0x3d37a6=_0x9bb2[_0x56bc52];return _0x3d37a6;};'use strict';var Sequelize=require('sequelize');module[_0x29bb('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x29bb('0x1')]},'ticketId':{'type':Sequelize[_0x29bb('0x1')]},'integrationId':{'type':Sequelize[_0x29bb('0x2')]},'contacts':{'type':Sequelize[_0x29bb('0x1')]},'uniqueid':{'type':Sequelize[_0x29bb('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x29bb('0x1')]},'queue':{'type':Sequelize[_0x29bb('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x29bb('0x1')]},'agentcalledAt':{'type':Sequelize[_0x29bb('0x3')]},'agentconnectAt':{'type':Sequelize[_0x29bb('0x3')]},'holdtime':{'type':Sequelize[_0x29bb('0x2')]},'agentcomplete':{'type':Sequelize[_0x29bb('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x29bb('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x29bb('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x29bb('0x2')]},'reason':{'type':Sequelize[_0x29bb('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x29bb('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x29bb('0x3')]},'agentdump':{'type':Sequelize[_0x29bb('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x29bb('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29bb('0x1')]},'channelstate':{'type':Sequelize[_0x29bb('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29bb('0x1')]},'connectedlinenum':{'type':Sequelize[_0x29bb('0x1')]},'connectedlinename':{'type':Sequelize[_0x29bb('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x29bb('0x1')]},'exten':{'type':Sequelize[_0x29bb('0x1')]},'priority':{'type':Sequelize[_0x29bb('0x1')]},'destchannel':{'type':Sequelize[_0x29bb('0x1')]},'destchannelstate':{'type':Sequelize[_0x29bb('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x29bb('0x1')]},'destcalleridnum':{'type':Sequelize[_0x29bb('0x1')]},'destcalleridname':{'type':Sequelize[_0x29bb('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x29bb('0x1')]},'destlanguage':{'type':Sequelize[_0x29bb('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x29bb('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x29bb('0x1')]},'messageId':{'type':Sequelize[_0x29bb('0x1')]},'inReplyTo':{'type':Sequelize[_0x29bb('0x1')]},'subject':{'type':Sequelize[_0x29bb('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x29bb('0x1')]},'cc':{'type':Sequelize[_0x29bb('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x29bb('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x29bb('0x6'),'SENDING',_0x29bb('0x7'),_0x29bb('0x8'))},'url':{'type':Sequelize[_0x29bb('0x1')]},'app':{'type':Sequelize[_0x29bb('0x1')]},'appdata':{'type':Sequelize[_0x29bb('0x1')]},'projectId':{'type':Sequelize[_0x29bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9b6b063..e47a057 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 _0x0b07=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','IntegrationReport','fieldName','type','filters','model','query'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x0b07,0xb5));var _0x70b0=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x0b07[_0x616290];return _0x453879;};'use strict';var emlformat=require(_0x70b0('0x0'));var rimraf=require(_0x70b0('0x1'));var zipdir=require(_0x70b0('0x2'));var jsonpatch=require(_0x70b0('0x3'));var rp=require(_0x70b0('0x4'));var moment=require('moment');var BPromise=require(_0x70b0('0x5'));var Mustache=require('mustache');var util=require(_0x70b0('0x6'));var path=require('path');var sox=require(_0x70b0('0x7'));var csv=require(_0x70b0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70b0('0x9'));var _=require(_0x70b0('0xa'));var squel=require(_0x70b0('0xb'));var crypto=require(_0x70b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x70b0('0xd'));var toCsv=require(_0x70b0('0x8'));var querystring=require('querystring');var Papa=require(_0x70b0('0xe'));var Redis=require('ioredis');var authService=require(_0x70b0('0xf'));var qs=require(_0x70b0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70b0('0x11'));var logger=require(_0x70b0('0x12'))(_0x70b0('0x13'));var utils=require(_0x70b0('0x14'));var config=require(_0x70b0('0x15'));var licenseUtil=require(_0x70b0('0x16'));var db=require(_0x70b0('0x17'))['db'];function respondWithStatusCode(_0x43fc50,_0x3ce99a){_0x3ce99a=_0x3ce99a||0xcc;return function(_0xd5d0ad){if(_0xd5d0ad){return _0x43fc50[_0x70b0('0x18')](_0x3ce99a);}return _0x43fc50['status'](_0x3ce99a)[_0x70b0('0x19')]();};}function respondWithResult(_0x57f635,_0x34f65c){_0x34f65c=_0x34f65c||0xc8;return function(_0x5a1995){if(_0x5a1995){return _0x57f635[_0x70b0('0x1a')](_0x34f65c)[_0x70b0('0x1b')](_0x5a1995);}};}function respondWithFilteredResult(_0xe5e135,_0x38eb23){return function(_0x281d77){if(_0x281d77){var _0x1df346=typeof _0x38eb23[_0x70b0('0x1c')]===_0x70b0('0x1d')&&typeof _0x38eb23[_0x70b0('0x1e')]===_0x70b0('0x1d');var _0x9cc9cf=_0x281d77[_0x70b0('0x1f')];var _0x39222c=_0x1df346?0x0:_0x38eb23[_0x70b0('0x1c')];var _0x3df646=_0x1df346?_0x281d77[_0x70b0('0x1f')]:_0x38eb23[_0x70b0('0x1c')]+_0x38eb23['limit'];var _0x4ad10e;if(_0x3df646>=_0x9cc9cf){_0x3df646=_0x9cc9cf;_0x4ad10e=0xc8;}else{_0x4ad10e=0xce;}_0xe5e135[_0x70b0('0x1a')](_0x4ad10e);return _0xe5e135[_0x70b0('0x20')](_0x70b0('0x21'),_0x39222c+'-'+_0x3df646+'/'+_0x9cc9cf)[_0x70b0('0x1b')](_0x281d77);}return null;};}function patchUpdates(_0x5cfd4b){return function(_0x222567){try{jsonpatch[_0x70b0('0x22')](_0x222567,_0x5cfd4b,!![]);}catch(_0x3e2fe1){return BPromise[_0x70b0('0x23')](_0x3e2fe1);}return _0x222567[_0x70b0('0x24')]();};}function saveUpdates(_0x288c27,_0x14f9c6){return function(_0x12694b){if(_0x12694b){return _0x12694b['update'](_0x288c27)[_0x70b0('0x25')](function(_0x214d6b){return _0x214d6b;});}return null;};}function removeEntity(_0x14f548,_0x730df5){return function(_0x3485a7){if(_0x3485a7){return _0x3485a7[_0x70b0('0x26')]()[_0x70b0('0x25')](function(){_0x14f548[_0x70b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x627774,_0xd04433){return function(_0x557e3f){if(!_0x557e3f){_0x627774[_0x70b0('0x18')](0x194);}return _0x557e3f;};}function handleError(_0x35be10,_0x6cce31){_0x6cce31=_0x6cce31||0x1f4;return function(_0x5b8d44){logger[_0x70b0('0x27')](_0x5b8d44[_0x70b0('0x28')]);if(_0x5b8d44[_0x70b0('0x29')]){delete _0x5b8d44['name'];}_0x35be10[_0x70b0('0x1a')](_0x6cce31)[_0x70b0('0x2a')](_0x5b8d44);};}exports['index']=function(_0x2e1fb0,_0x3cc81c){var _0x2f7566={},_0x3a9403={},_0x2216d3={'count':0x0,'rows':[]};var _0x4974f2=_[_0x70b0('0x2b')](db[_0x70b0('0x2c')]['rawAttributes'],function(_0x32cca1){return{'name':_0x32cca1[_0x70b0('0x2d')],'type':_0x32cca1[_0x70b0('0x2e')]['key']};});_0x3a9403['model']=_[_0x70b0('0x2b')](_0x4974f2,'name');_0x3a9403['query']=_['keys'](_0x2e1fb0['query']);_0x3a9403[_0x70b0('0x2f')]=_['intersection'](_0x3a9403[_0x70b0('0x30')],_0x3a9403[_0x70b0('0x31')]);_0x2f7566['attributes']=_['intersection'](_0x3a9403[_0x70b0('0x30')],qs[_0x70b0('0x32')](_0x2e1fb0['query'][_0x70b0('0x32')]));_0x2f7566[_0x70b0('0x33')]=_0x2f7566[_0x70b0('0x33')][_0x70b0('0x34')]?_0x2f7566[_0x70b0('0x33')]:_0x3a9403['model'];if(!_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x35')](_0x70b0('0x36'))){_0x2f7566['limit']=qs['limit'](_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x1e')]);_0x2f7566[_0x70b0('0x1c')]=qs[_0x70b0('0x1c')](_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x1c')]);}_0x2f7566[_0x70b0('0x37')]=qs[_0x70b0('0x38')](_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x38')]);_0x2f7566[_0x70b0('0x39')]=qs[_0x70b0('0x2f')](_[_0x70b0('0x3a')](_0x2e1fb0[_0x70b0('0x31')],_0x3a9403[_0x70b0('0x2f')]),_0x4974f2);if(_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x3b')]){_0x2f7566[_0x70b0('0x39')]=_[_0x70b0('0x3c')](_0x2f7566[_0x70b0('0x39')],{'$or':_['map'](_0x4974f2,function(_0x46081d){if(_0x46081d[_0x70b0('0x2e')]!=='VIRTUAL'){var _0x3b5611={};_0x3b5611[_0x46081d[_0x70b0('0x29')]]={'$like':'%'+_0x2e1fb0[_0x70b0('0x31')]['filter']+'%'};return _0x3b5611;}})});}_0x2f7566=_[_0x70b0('0x3c')]({},_0x2f7566,_0x2e1fb0[_0x70b0('0x3d')]);var _0x267084={'where':_0x2f7566[_0x70b0('0x39')]};return db[_0x70b0('0x2c')]['count'](_0x267084)[_0x70b0('0x25')](function(_0x127da9){_0x2216d3['count']=_0x127da9;if(_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x3e')]){_0x2f7566[_0x70b0('0x3f')]=[{'all':!![]}];}return db[_0x70b0('0x2c')][_0x70b0('0x40')](_0x2f7566);})[_0x70b0('0x25')](function(_0x49fdaa){_0x2216d3[_0x70b0('0x41')]=_0x49fdaa;return _0x2216d3;})[_0x70b0('0x25')](respondWithFilteredResult(_0x3cc81c,_0x2f7566))[_0x70b0('0x42')](handleError(_0x3cc81c,null));};exports[_0x70b0('0x43')]=function(_0x1c99b9,_0x529160){var _0x324733={'raw':![],'where':{'id':_0x1c99b9[_0x70b0('0x44')]['id']}},_0x210c73={};_0x210c73[_0x70b0('0x30')]=_[_0x70b0('0x45')](db['IntegrationReport'][_0x70b0('0x46')]);_0x210c73[_0x70b0('0x31')]=_[_0x70b0('0x45')](_0x1c99b9['query']);_0x210c73['filters']=_[_0x70b0('0x47')](_0x210c73[_0x70b0('0x30')],_0x210c73[_0x70b0('0x31')]);_0x324733[_0x70b0('0x33')]=_[_0x70b0('0x47')](_0x210c73['model'],qs[_0x70b0('0x32')](_0x1c99b9[_0x70b0('0x31')][_0x70b0('0x32')]));_0x324733[_0x70b0('0x33')]=_0x324733['attributes']['length']?_0x324733['attributes']:_0x210c73[_0x70b0('0x30')];if(_0x1c99b9['query'][_0x70b0('0x3e')]){_0x324733[_0x70b0('0x3f')]=[{'all':!![]}];}_0x324733=_[_0x70b0('0x3c')]({},_0x324733,_0x1c99b9['options']);return db[_0x70b0('0x2c')]['find'](_0x324733)[_0x70b0('0x25')](handleEntityNotFound(_0x529160,null))[_0x70b0('0x25')](respondWithResult(_0x529160,null))[_0x70b0('0x42')](handleError(_0x529160,null));};exports['create']=function(_0x3a3ba5,_0x390920){return db[_0x70b0('0x2c')][_0x70b0('0x48')](_0x3a3ba5['body'],{})[_0x70b0('0x25')](respondWithResult(_0x390920,0xc9))[_0x70b0('0x42')](handleError(_0x390920,null));};exports[_0x70b0('0x49')]=function(_0x5a572a,_0x1fb873){if(_0x5a572a['body']['id']){delete _0x5a572a[_0x70b0('0x4a')]['id'];}return db[_0x70b0('0x2c')][_0x70b0('0x4b')]({'where':{'id':_0x5a572a[_0x70b0('0x44')]['id']}})[_0x70b0('0x25')](handleEntityNotFound(_0x1fb873,null))[_0x70b0('0x25')](saveUpdates(_0x5a572a[_0x70b0('0x4a')],null))[_0x70b0('0x25')](respondWithResult(_0x1fb873,null))[_0x70b0('0x42')](handleError(_0x1fb873,null));};exports[_0x70b0('0x26')]=function(_0xa91d96,_0xf8e3c4){return db['IntegrationReport']['find']({'where':{'id':_0xa91d96[_0x70b0('0x44')]['id']}})[_0x70b0('0x25')](handleEntityNotFound(_0xf8e3c4,null))[_0x70b0('0x25')](removeEntity(_0xf8e3c4,null))['catch'](handleError(_0xf8e3c4,null));};exports[_0x70b0('0x4c')]=function(_0xadafcd,_0x382ab3){return db[_0x70b0('0x2c')][_0x70b0('0x4c')]()[_0x70b0('0x25')](respondWithResult(_0x382ab3,null))[_0x70b0('0x42')](handleError(_0x382ab3,null));}; \ No newline at end of file +var _0x9aca=['end','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy'];(function(_0xf4a519,_0x2aa0bd){var _0x3a31dd=function(_0x584e0f){while(--_0x584e0f){_0xf4a519['push'](_0xf4a519['shift']());}};_0x3a31dd(++_0x2aa0bd);}(_0x9aca,0x100));var _0xa9ac=function(_0xf7a9fe,_0x47855a){_0xf7a9fe=_0xf7a9fe-0x0;var _0x2c3da2=_0x9aca[_0xf7a9fe];return _0x2c3da2;};'use strict';var emlformat=require(_0xa9ac('0x0'));var rimraf=require(_0xa9ac('0x1'));var zipdir=require(_0xa9ac('0x2'));var jsonpatch=require(_0xa9ac('0x3'));var rp=require(_0xa9ac('0x4'));var moment=require('moment');var BPromise=require(_0xa9ac('0x5'));var Mustache=require(_0xa9ac('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa9ac('0x7'));var csv=require(_0xa9ac('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ac('0x9'));var _=require(_0xa9ac('0xa'));var squel=require('squel');var crypto=require(_0xa9ac('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa9ac('0xc'));var toCsv=require(_0xa9ac('0x8'));var querystring=require(_0xa9ac('0xd'));var Papa=require(_0xa9ac('0xe'));var Redis=require(_0xa9ac('0xf'));var authService=require(_0xa9ac('0x10'));var qs=require(_0xa9ac('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9ac('0x12'));var logger=require(_0xa9ac('0x13'))(_0xa9ac('0x14'));var utils=require('../../config/utils');var config=require(_0xa9ac('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9ac('0x16'))['db'];function respondWithStatusCode(_0x33b6f3,_0x2e4874){_0x2e4874=_0x2e4874||0xcc;return function(_0x2eeb62){if(_0x2eeb62){return _0x33b6f3[_0xa9ac('0x17')](_0x2e4874);}return _0x33b6f3['status'](_0x2e4874)['end']();};}function respondWithResult(_0x3747e0,_0x501311){_0x501311=_0x501311||0xc8;return function(_0x5e50cd){if(_0x5e50cd){return _0x3747e0['status'](_0x501311)['json'](_0x5e50cd);}};}function respondWithFilteredResult(_0x5f06e5,_0x5bd22c){return function(_0x553d8f){if(_0x553d8f){var _0x1391db=typeof _0x5bd22c[_0xa9ac('0x18')]===_0xa9ac('0x19')&&typeof _0x5bd22c[_0xa9ac('0x1a')]===_0xa9ac('0x19');var _0xbbe5bc=_0x553d8f['count'];var _0x1ac709=_0x1391db?0x0:_0x5bd22c[_0xa9ac('0x18')];var _0x49c739=_0x1391db?_0x553d8f[_0xa9ac('0x1b')]:_0x5bd22c[_0xa9ac('0x18')]+_0x5bd22c[_0xa9ac('0x1a')];var _0xa392ef;if(_0x49c739>=_0xbbe5bc){_0x49c739=_0xbbe5bc;_0xa392ef=0xc8;}else{_0xa392ef=0xce;}_0x5f06e5[_0xa9ac('0x1c')](_0xa392ef);return _0x5f06e5[_0xa9ac('0x1d')](_0xa9ac('0x1e'),_0x1ac709+'-'+_0x49c739+'/'+_0xbbe5bc)['json'](_0x553d8f);}return null;};}function patchUpdates(_0x5415e7){return function(_0x16051e){try{jsonpatch[_0xa9ac('0x1f')](_0x16051e,_0x5415e7,!![]);}catch(_0xf84492){return BPromise[_0xa9ac('0x20')](_0xf84492);}return _0x16051e['save']();};}function saveUpdates(_0x4c76cc,_0x15cf6c){return function(_0x44bd9e){if(_0x44bd9e){return _0x44bd9e[_0xa9ac('0x21')](_0x4c76cc)[_0xa9ac('0x22')](function(_0x110586){return _0x110586;});}return null;};}function removeEntity(_0x117718,_0x20e542){return function(_0x366f98){if(_0x366f98){return _0x366f98[_0xa9ac('0x23')]()[_0xa9ac('0x22')](function(){_0x117718[_0xa9ac('0x1c')](0xcc)[_0xa9ac('0x24')]();});}};}function handleEntityNotFound(_0x4ce2a4,_0x3869c8){return function(_0x1a9765){if(!_0x1a9765){_0x4ce2a4['sendStatus'](0x194);}return _0x1a9765;};}function handleError(_0x36d498,_0x4b3c07){_0x4b3c07=_0x4b3c07||0x1f4;return function(_0x354434){logger[_0xa9ac('0x25')](_0x354434[_0xa9ac('0x26')]);if(_0x354434['name']){delete _0x354434[_0xa9ac('0x27')];}_0x36d498[_0xa9ac('0x1c')](_0x4b3c07)[_0xa9ac('0x28')](_0x354434);};}exports['index']=function(_0x5bcf1c,_0x42e149){var _0x12fdc9={},_0x76567e={},_0x14a292={'count':0x0,'rows':[]};var _0x9d6e74=_['map'](db[_0xa9ac('0x29')][_0xa9ac('0x2a')],function(_0x5f0d27){return{'name':_0x5f0d27[_0xa9ac('0x2b')],'type':_0x5f0d27[_0xa9ac('0x2c')]['key']};});_0x76567e[_0xa9ac('0x2d')]=_[_0xa9ac('0x2e')](_0x9d6e74,_0xa9ac('0x27'));_0x76567e[_0xa9ac('0x2f')]=_[_0xa9ac('0x30')](_0x5bcf1c[_0xa9ac('0x2f')]);_0x76567e[_0xa9ac('0x31')]=_[_0xa9ac('0x32')](_0x76567e[_0xa9ac('0x2d')],_0x76567e[_0xa9ac('0x2f')]);_0x12fdc9[_0xa9ac('0x33')]=_[_0xa9ac('0x32')](_0x76567e['model'],qs[_0xa9ac('0x34')](_0x5bcf1c[_0xa9ac('0x2f')]['fields']));_0x12fdc9[_0xa9ac('0x33')]=_0x12fdc9[_0xa9ac('0x33')][_0xa9ac('0x35')]?_0x12fdc9['attributes']:_0x76567e[_0xa9ac('0x2d')];if(!_0x5bcf1c[_0xa9ac('0x2f')][_0xa9ac('0x36')](_0xa9ac('0x37'))){_0x12fdc9[_0xa9ac('0x1a')]=qs[_0xa9ac('0x1a')](_0x5bcf1c['query'][_0xa9ac('0x1a')]);_0x12fdc9[_0xa9ac('0x18')]=qs[_0xa9ac('0x18')](_0x5bcf1c[_0xa9ac('0x2f')][_0xa9ac('0x18')]);}_0x12fdc9[_0xa9ac('0x38')]=qs[_0xa9ac('0x39')](_0x5bcf1c[_0xa9ac('0x2f')][_0xa9ac('0x39')]);_0x12fdc9['where']=qs[_0xa9ac('0x31')](_[_0xa9ac('0x3a')](_0x5bcf1c[_0xa9ac('0x2f')],_0x76567e[_0xa9ac('0x31')]),_0x9d6e74);if(_0x5bcf1c['query'][_0xa9ac('0x3b')]){_0x12fdc9[_0xa9ac('0x3c')]=_[_0xa9ac('0x3d')](_0x12fdc9[_0xa9ac('0x3c')],{'$or':_[_0xa9ac('0x2e')](_0x9d6e74,function(_0x2c18ba){if(_0x2c18ba[_0xa9ac('0x2c')]!==_0xa9ac('0x3e')){var _0x536246={};_0x536246[_0x2c18ba[_0xa9ac('0x27')]]={'$like':'%'+_0x5bcf1c['query']['filter']+'%'};return _0x536246;}})});}_0x12fdc9=_[_0xa9ac('0x3d')]({},_0x12fdc9,_0x5bcf1c[_0xa9ac('0x3f')]);var _0x1367d7={'where':_0x12fdc9[_0xa9ac('0x3c')]};return db['IntegrationReport'][_0xa9ac('0x1b')](_0x1367d7)[_0xa9ac('0x22')](function(_0x5a9423){_0x14a292['count']=_0x5a9423;if(_0x5bcf1c[_0xa9ac('0x2f')][_0xa9ac('0x40')]){_0x12fdc9[_0xa9ac('0x41')]=[{'all':!![]}];}return db[_0xa9ac('0x29')]['findAll'](_0x12fdc9);})[_0xa9ac('0x22')](function(_0x5009cb){_0x14a292[_0xa9ac('0x42')]=_0x5009cb;return _0x14a292;})[_0xa9ac('0x22')](respondWithFilteredResult(_0x42e149,_0x12fdc9))[_0xa9ac('0x43')](handleError(_0x42e149,null));};exports[_0xa9ac('0x44')]=function(_0x20d0f8,_0x3e847b){var _0x5ac451={'raw':![],'where':{'id':_0x20d0f8['params']['id']}},_0x120f69={};_0x120f69[_0xa9ac('0x2d')]=_[_0xa9ac('0x30')](db[_0xa9ac('0x29')][_0xa9ac('0x2a')]);_0x120f69['query']=_[_0xa9ac('0x30')](_0x20d0f8[_0xa9ac('0x2f')]);_0x120f69['filters']=_[_0xa9ac('0x32')](_0x120f69[_0xa9ac('0x2d')],_0x120f69[_0xa9ac('0x2f')]);_0x5ac451[_0xa9ac('0x33')]=_['intersection'](_0x120f69['model'],qs[_0xa9ac('0x34')](_0x20d0f8[_0xa9ac('0x2f')][_0xa9ac('0x34')]));_0x5ac451['attributes']=_0x5ac451[_0xa9ac('0x33')][_0xa9ac('0x35')]?_0x5ac451[_0xa9ac('0x33')]:_0x120f69[_0xa9ac('0x2d')];if(_0x20d0f8[_0xa9ac('0x2f')][_0xa9ac('0x40')]){_0x5ac451[_0xa9ac('0x41')]=[{'all':!![]}];}_0x5ac451=_[_0xa9ac('0x3d')]({},_0x5ac451,_0x20d0f8['options']);return db[_0xa9ac('0x29')][_0xa9ac('0x45')](_0x5ac451)['then'](handleEntityNotFound(_0x3e847b,null))[_0xa9ac('0x22')](respondWithResult(_0x3e847b,null))[_0xa9ac('0x43')](handleError(_0x3e847b,null));};exports[_0xa9ac('0x46')]=function(_0x4e2910,_0x526195){return db[_0xa9ac('0x29')][_0xa9ac('0x46')](_0x4e2910[_0xa9ac('0x47')],{})['then'](respondWithResult(_0x526195,0xc9))['catch'](handleError(_0x526195,null));};exports['update']=function(_0x1a5732,_0x4ece3d){if(_0x1a5732['body']['id']){delete _0x1a5732[_0xa9ac('0x47')]['id'];}return db['IntegrationReport'][_0xa9ac('0x45')]({'where':{'id':_0x1a5732[_0xa9ac('0x48')]['id']}})[_0xa9ac('0x22')](handleEntityNotFound(_0x4ece3d,null))[_0xa9ac('0x22')](saveUpdates(_0x1a5732[_0xa9ac('0x47')],null))[_0xa9ac('0x22')](respondWithResult(_0x4ece3d,null))[_0xa9ac('0x43')](handleError(_0x4ece3d,null));};exports[_0xa9ac('0x23')]=function(_0x4e7e04,_0x2dbfe5){return db[_0xa9ac('0x29')]['find']({'where':{'id':_0x4e7e04[_0xa9ac('0x48')]['id']}})['then'](handleEntityNotFound(_0x2dbfe5,null))[_0xa9ac('0x22')](removeEntity(_0x2dbfe5,null))[_0xa9ac('0x43')](handleError(_0x2dbfe5,null));};exports['describe']=function(_0x269f57,_0x40c635){return db[_0xa9ac('0x29')]['describe']()[_0xa9ac('0x22')](respondWithResult(_0x40c635,null))[_0xa9ac('0x43')](handleError(_0x40c635,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6010594..7f12b84 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 _0xa837=['moment','bluebird','request-promise','rimraf','./integrationReport.attributes','IntegrationReport','report_integration','util'];(function(_0x11129b,_0x1713fd){var _0x43fe39=function(_0x4334e3){while(--_0x4334e3){_0x11129b['push'](_0x11129b['shift']());}};_0x43fe39(++_0x1713fd);}(_0xa837,0xb7));var _0x7a83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa837[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x7a83('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7a83('0x1'));var BPromise=require(_0x7a83('0x2'));var rp=require(_0x7a83('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a83('0x4'));var config=require('../../config/environment');var attributes=require(_0x7a83('0x5'));module['exports']=function(_0x133a12,_0x52d572){return _0x133a12['define'](_0x7a83('0x6'),attributes,{'tableName':_0x7a83('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc09e=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0xc09e,0xb4));var _0xec09=function(_0x500b53,_0x9583c0){_0x500b53=_0x500b53-0x0;var _0xca625=_0xc09e[_0x500b53];return _0xca625;};'use strict';var _=require(_0xec09('0x0'));var util=require('util');var logger=require(_0xec09('0x1'))(_0xec09('0x2'));var moment=require(_0xec09('0x3'));var BPromise=require(_0xec09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec09('0x5'));var rimraf=require('rimraf');var config=require(_0xec09('0x6'));var attributes=require(_0xec09('0x7'));module[_0xec09('0x8')]=function(_0x1a4f40,_0xd57f6e){return _0x1a4f40[_0xec09('0x9')](_0xec09('0xa'),attributes,{'tableName':_0xec09('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 60dc745..7fc20f3 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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0xe4c1fe,_0x349e2f){var _0x656756=function(_0x4922a7){while(--_0x4922a7){_0xe4c1fe['push'](_0xe4c1fe['shift']());}};_0x656756(++_0x349e2f);}(_0xba34,0x119));var _0x4ba3=function(_0x3aa1ae,_0x459174){_0x3aa1ae=_0x3aa1ae-0x0;var _0x5ba44a=_0xba34[_0x3aa1ae];return _0x5ba44a;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x1c2579,_0x592131){var _0xa37e27=function(_0x1a69be){while(--_0x1a69be){_0x1c2579['push'](_0x1c2579['shift']());}};_0xa37e27(++_0x592131);}(_0xba34,0x119));var _0x4ba3=function(_0x535fbe,_0xcc6f17){_0x535fbe=_0x535fbe-0x0;var _0xf8541e=_0xba34[_0x535fbe];return _0xf8541e;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 3f9bad9..63f522d 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 _0x8917=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3fb166,_0x4eb985){var _0x5e91be=function(_0x53f4d9){while(--_0x53f4d9){_0x3fb166['push'](_0x3fb166['shift']());}};_0x5e91be(++_0x4eb985);}(_0x8917,0x1d7));var _0x7891=function(_0x11cebb,_0x35fb57){_0x11cebb=_0x11cebb-0x0;var _0x59f302=_0x8917[_0x11cebb];return _0x59f302;};'use strict';var multer=require(_0x7891('0x0'));var util=require('util');var path=require(_0x7891('0x1'));var timeout=require(_0x7891('0x2'));var express=require(_0x7891('0x3'));var router=express[_0x7891('0x4')]();var fs_extra=require(_0x7891('0x5'));var auth=require(_0x7891('0x6'));var interaction=require(_0x7891('0x7'));var config=require(_0x7891('0x8'));var controller=require(_0x7891('0x9'));router['get']('/',auth[_0x7891('0xa')](),controller[_0x7891('0xb')]);router[_0x7891('0xc')](_0x7891('0xd'),auth[_0x7891('0xa')](),controller[_0x7891('0xe')]);router['get'](_0x7891('0xf'),auth['isAuthenticated'](),controller[_0x7891('0x10')]);router[_0x7891('0x11')]('/',auth[_0x7891('0xa')](),controller[_0x7891('0x12')]);router[_0x7891('0x11')]('/:id/sub_intervals',auth[_0x7891('0xa')](),controller[_0x7891('0x13')]);router[_0x7891('0x11')]('/:id/sub_intervals/create_many',auth[_0x7891('0xa')](),controller[_0x7891('0x14')]);router[_0x7891('0x15')](_0x7891('0xd'),auth[_0x7891('0xa')](),controller['update']);router[_0x7891('0x16')](_0x7891('0xd'),auth[_0x7891('0xa')](),controller[_0x7891('0x17')]);module[_0x7891('0x18')]=router; \ No newline at end of file +var _0xce68=['../../config/environment','./interval.controller','isAuthenticated','index','show','get','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xbfe32e,_0x1f452d){var _0x2a96cd=function(_0x20807b){while(--_0x20807b){_0xbfe32e['push'](_0xbfe32e['shift']());}};_0x2a96cd(++_0x1f452d);}(_0xce68,0x10c));var _0x8ce6=function(_0x1267ee,_0xe2c001){_0x1267ee=_0x1267ee-0x0;var _0x4b0c66=_0xce68[_0x1267ee];return _0x4b0c66;};'use strict';var multer=require(_0x8ce6('0x0'));var util=require('util');var path=require(_0x8ce6('0x1'));var timeout=require(_0x8ce6('0x2'));var express=require(_0x8ce6('0x3'));var router=express[_0x8ce6('0x4')]();var fs_extra=require(_0x8ce6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8ce6('0x6'));var config=require(_0x8ce6('0x7'));var controller=require(_0x8ce6('0x8'));router['get']('/',auth[_0x8ce6('0x9')](),controller[_0x8ce6('0xa')]);router['get']('/:id',auth[_0x8ce6('0x9')](),controller[_0x8ce6('0xb')]);router[_0x8ce6('0xc')](_0x8ce6('0xd'),auth['isAuthenticated'](),controller[_0x8ce6('0xe')]);router[_0x8ce6('0xf')]('/',auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x10')]);router[_0x8ce6('0xf')](_0x8ce6('0xd'),auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x11')]);router[_0x8ce6('0xf')](_0x8ce6('0x12'),auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x13')]);router[_0x8ce6('0x14')](_0x8ce6('0x15'),auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x16')]);router[_0x8ce6('0x17')](_0x8ce6('0x15'),auth['isAuthenticated'](),controller[_0x8ce6('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 62af027..9776469 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 _0x2af1=['sequelize','STRING'];(function(_0x1dc10e,_0x54cf82){var _0x31b3d6=function(_0xb8431d){while(--_0xb8431d){_0x1dc10e['push'](_0x1dc10e['shift']());}};_0x31b3d6(++_0x54cf82);}(_0x2af1,0x6a));var _0x12af=function(_0xbc2856,_0x9ad6a1){_0xbc2856=_0xbc2856-0x0;var _0x25ff6b=_0x2af1[_0xbc2856];return _0x25ff6b;};'use strict';var Sequelize=require(_0x12af('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x12af('0x1')]},'interval':{'type':Sequelize[_0x12af('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xb33c=['sequelize','exports','STRING'];(function(_0x582274,_0x2cbd9c){var _0x8f14d3=function(_0x1cfe08){while(--_0x1cfe08){_0x582274['push'](_0x582274['shift']());}};_0x8f14d3(++_0x2cbd9c);}(_0xb33c,0x165));var _0xcb33=function(_0x5b035c,_0x45d15e){_0x5b035c=_0x5b035c-0x0;var _0x14a362=_0xb33c[_0x5b035c];return _0x14a362;};'use strict';var Sequelize=require(_0xcb33('0x0'));module[_0xcb33('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcb33('0x2')]},'interval':{'type':Sequelize[_0xcb33('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 e55b60a..9ceb3d8 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 _0xe22c=['count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','Interval','include','findAll','rows','catch','show','includeAll','user','UserProfileSection','find','userProfileId','autoAssociation','create','body','params','IntervalId','getIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x5d4a4e,_0x3bad07){var _0x5d28db=function(_0x542fe5){while(--_0x542fe5){_0x5d4a4e['push'](_0x5d4a4e['shift']());}};_0x5d28db(++_0x3bad07);}(_0xe22c,0x92));var _0xce22=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe22c[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xce22('0x0'));var rimraf=require(_0xce22('0x1'));var zipdir=require(_0xce22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce22('0x3'));var moment=require(_0xce22('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce22('0x5'));var util=require(_0xce22('0x6'));var path=require(_0xce22('0x7'));var sox=require(_0xce22('0x8'));var csv=require(_0xce22('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce22('0xa'));var _=require('lodash');var squel=require(_0xce22('0xb'));var crypto=require(_0xce22('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce22('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce22('0xe'));var Redis=require('ioredis');var authService=require(_0xce22('0xf'));var qs=require(_0xce22('0x10'));var as=require(_0xce22('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce22('0x12'))(_0xce22('0x13'));var utils=require(_0xce22('0x14'));var config=require(_0xce22('0x15'));var licenseUtil=require(_0xce22('0x16'));var db=require(_0xce22('0x17'))['db'];var extensions=require(_0xce22('0x18'));function respondWithStatusCode(_0x44c610,_0x309bbc){_0x309bbc=_0x309bbc||0xcc;return function(_0x4336b1){if(_0x4336b1){return _0x44c610[_0xce22('0x19')](_0x309bbc);}return _0x44c610['status'](_0x309bbc)[_0xce22('0x1a')]();};}function respondWithResult(_0x3afce4,_0x513c10){_0x513c10=_0x513c10||0xc8;return function(_0xf08378){if(_0xf08378){return _0x3afce4[_0xce22('0x1b')](_0x513c10)[_0xce22('0x1c')](_0xf08378);}};}function respondWithFilteredResult(_0x26d07a,_0x1397b3){return function(_0x3b15ec){if(_0x3b15ec){var _0x266917=typeof _0x1397b3[_0xce22('0x1d')]===_0xce22('0x1e')&&typeof _0x1397b3[_0xce22('0x1f')]===_0xce22('0x1e');var _0x39b8a4=_0x3b15ec[_0xce22('0x20')];var _0x40d317=_0x266917?0x0:_0x1397b3[_0xce22('0x1d')];var _0x11efe9=_0x266917?_0x3b15ec['count']:_0x1397b3[_0xce22('0x1d')]+_0x1397b3[_0xce22('0x1f')];var _0x1cf5ba;if(_0x11efe9>=_0x39b8a4){_0x11efe9=_0x39b8a4;_0x1cf5ba=0xc8;}else{_0x1cf5ba=0xce;}_0x26d07a[_0xce22('0x1b')](_0x1cf5ba);return _0x26d07a[_0xce22('0x21')](_0xce22('0x22'),_0x40d317+'-'+_0x11efe9+'/'+_0x39b8a4)['json'](_0x3b15ec);}return null;};}function patchUpdates(_0x4bec77){return function(_0x586343){try{jsonpatch[_0xce22('0x23')](_0x586343,_0x4bec77,!![]);}catch(_0x8f631e){return BPromise[_0xce22('0x24')](_0x8f631e);}return _0x586343[_0xce22('0x25')]();};}function saveUpdates(_0x17af5d,_0x332a74){return function(_0x3e8994){if(_0x3e8994){return _0x3e8994[_0xce22('0x26')](_0x17af5d)[_0xce22('0x27')](function(_0x153e0f){return _0x153e0f;});}return null;};}function removeEntity(_0x129eee,_0x127e41){return function(_0x61c61d){if(_0x61c61d){return _0x61c61d[_0xce22('0x28')]()[_0xce22('0x27')](function(){var _0xe3c0b1=_0x61c61d[_0xce22('0x29')]({'plain':!![]});var _0x2de694=_0xce22('0x2a');return db[_0xce22('0x2b')][_0xce22('0x28')]({'where':{'type':_0x2de694,'resourceId':_0xe3c0b1['id']}})[_0xce22('0x27')](function(){return _0x61c61d;});})[_0xce22('0x27')](function(){_0x129eee[_0xce22('0x1b')](0xcc)[_0xce22('0x1a')]();});}};}function handleEntityNotFound(_0x1a3385,_0xdbba53){return function(_0x1c18ca){if(!_0x1c18ca){_0x1a3385[_0xce22('0x19')](0x194);}return _0x1c18ca;};}function handleError(_0x334108,_0x2b03e8){_0x2b03e8=_0x2b03e8||0x1f4;return function(_0x5aba26){logger[_0xce22('0x2c')](_0x5aba26[_0xce22('0x2d')]);if(_0x5aba26[_0xce22('0x2e')]){delete _0x5aba26[_0xce22('0x2e')];}_0x334108[_0xce22('0x1b')](_0x2b03e8)['send'](_0x5aba26);};}exports[_0xce22('0x2f')]=function(_0x487f2b,_0x1edeee){var _0x19721a={},_0x383d68={},_0x23ad24={'count':0x0,'rows':[]};var _0x30c626=_[_0xce22('0x30')](db['Interval'][_0xce22('0x31')],function(_0x4ea12e){return{'name':_0x4ea12e['fieldName'],'type':_0x4ea12e[_0xce22('0x32')][_0xce22('0x33')]};});_0x383d68[_0xce22('0x34')]=_[_0xce22('0x30')](_0x30c626,'name');_0x383d68[_0xce22('0x35')]=_[_0xce22('0x36')](_0x487f2b[_0xce22('0x35')]);_0x383d68[_0xce22('0x37')]=_[_0xce22('0x38')](_0x383d68[_0xce22('0x34')],_0x383d68[_0xce22('0x35')]);_0x19721a[_0xce22('0x39')]=_[_0xce22('0x38')](_0x383d68[_0xce22('0x34')],qs[_0xce22('0x3a')](_0x487f2b[_0xce22('0x35')]['fields']));_0x19721a[_0xce22('0x39')]=_0x19721a[_0xce22('0x39')][_0xce22('0x3b')]?_0x19721a[_0xce22('0x39')]:_0x383d68[_0xce22('0x34')];if(!_0x487f2b[_0xce22('0x35')][_0xce22('0x3c')](_0xce22('0x3d'))){_0x19721a[_0xce22('0x1f')]=qs[_0xce22('0x1f')](_0x487f2b[_0xce22('0x35')][_0xce22('0x1f')]);_0x19721a[_0xce22('0x1d')]=qs['offset'](_0x487f2b[_0xce22('0x35')]['offset']);}_0x19721a[_0xce22('0x3e')]=qs[_0xce22('0x3f')](_0x487f2b[_0xce22('0x35')]['sort']);_0x19721a['where']=qs['filters'](_[_0xce22('0x40')](_0x487f2b[_0xce22('0x35')],_0x383d68[_0xce22('0x37')]),_0x30c626);if(_0x487f2b[_0xce22('0x35')][_0xce22('0x41')]){_0x19721a['where']=_[_0xce22('0x42')](_0x19721a[_0xce22('0x43')],{'$or':_['map'](_0x30c626,function(_0x2b0a8d){if(_0x2b0a8d[_0xce22('0x32')]!=='VIRTUAL'){var _0xfaaf25={};_0xfaaf25[_0x2b0a8d[_0xce22('0x2e')]]={'$like':'%'+_0x487f2b[_0xce22('0x35')][_0xce22('0x41')]+'%'};return _0xfaaf25;}})});}_0x19721a=_['merge']({},_0x19721a,_0x487f2b[_0xce22('0x44')]);var _0x4259b6={'where':_0x19721a[_0xce22('0x43')]};return db[_0xce22('0x45')][_0xce22('0x20')](_0x4259b6)['then'](function(_0x2fa342){_0x23ad24['count']=_0x2fa342;if(_0x487f2b['query']['includeAll']){_0x19721a[_0xce22('0x46')]=[{'all':!![]}];}return db[_0xce22('0x45')][_0xce22('0x47')](_0x19721a);})['then'](function(_0x11eee9){_0x23ad24[_0xce22('0x48')]=_0x11eee9;return _0x23ad24;})[_0xce22('0x27')](respondWithFilteredResult(_0x1edeee,_0x19721a))[_0xce22('0x49')](handleError(_0x1edeee,null));};exports[_0xce22('0x4a')]=function(_0x44bbec,_0x4cf840){var _0x3a945d={'raw':!![],'where':{'id':_0x44bbec['params']['id']}},_0xcdcc69={};_0xcdcc69[_0xce22('0x34')]=_[_0xce22('0x36')](db[_0xce22('0x45')][_0xce22('0x31')]);_0xcdcc69['query']=_[_0xce22('0x36')](_0x44bbec['query']);_0xcdcc69['filters']=_['intersection'](_0xcdcc69[_0xce22('0x34')],_0xcdcc69[_0xce22('0x35')]);_0x3a945d[_0xce22('0x39')]=_[_0xce22('0x38')](_0xcdcc69[_0xce22('0x34')],qs['fields'](_0x44bbec[_0xce22('0x35')][_0xce22('0x3a')]));_0x3a945d[_0xce22('0x39')]=_0x3a945d[_0xce22('0x39')]['length']?_0x3a945d[_0xce22('0x39')]:_0xcdcc69[_0xce22('0x34')];if(_0x44bbec[_0xce22('0x35')][_0xce22('0x4b')]){_0x3a945d[_0xce22('0x46')]=[{'all':!![]}];}_0x3a945d=_[_0xce22('0x42')]({},_0x3a945d,_0x44bbec[_0xce22('0x44')]);return db[_0xce22('0x45')]['find'](_0x3a945d)[_0xce22('0x27')](handleEntityNotFound(_0x4cf840,null))[_0xce22('0x27')](respondWithResult(_0x4cf840,null))['catch'](handleError(_0x4cf840,null));};exports['create']=function(_0x4e3b90,_0x37336a){return db[_0xce22('0x45')]['create'](_0x4e3b90['body'],{})['then'](function(_0x1bedd6){var _0x5b343f=_0x4e3b90[_0xce22('0x4c')][_0xce22('0x29')]({'plain':!![]});if(!_0x5b343f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b343f['role']==='user'){var _0x2625cc=_0x1bedd6[_0xce22('0x29')]({'plain':!![]});var _0x1b3e4a=_0xce22('0x2a');return db[_0xce22('0x4d')][_0xce22('0x4e')]({'where':{'name':_0x1b3e4a,'userProfileId':_0x5b343f[_0xce22('0x4f')]},'raw':!![]})[_0xce22('0x27')](function(_0x56b11d){if(_0x56b11d&&_0x56b11d[_0xce22('0x50')]===0x0){return db[_0xce22('0x2b')][_0xce22('0x51')]({'name':_0x2625cc['name'],'resourceId':_0x2625cc['id'],'type':_0x56b11d[_0xce22('0x2e')],'sectionId':_0x56b11d['id']},{})[_0xce22('0x27')](function(){return _0x1bedd6;});}else{return _0x1bedd6;}})[_0xce22('0x49')](function(_0x33b008){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33b008);throw _0x33b008;});}return _0x1bedd6;})['then'](respondWithResult(_0x37336a,0xc9))[_0xce22('0x49')](handleError(_0x37336a,null));};exports[_0xce22('0x26')]=function(_0x16d80c,_0x2772e3){if(_0x16d80c[_0xce22('0x52')]['id']){delete _0x16d80c[_0xce22('0x52')]['id'];}return db[_0xce22('0x45')][_0xce22('0x4e')]({'where':{'id':_0x16d80c[_0xce22('0x53')]['id']}})[_0xce22('0x27')](handleEntityNotFound(_0x2772e3,null))['then'](saveUpdates(_0x16d80c['body'],null))[_0xce22('0x27')](respondWithResult(_0x2772e3,null))[_0xce22('0x49')](handleError(_0x2772e3,null));};exports['destroy']=function(_0x1daff2,_0x43f3f6){return db[_0xce22('0x45')][_0xce22('0x4e')]({'where':{'id':_0x1daff2[_0xce22('0x53')]['id']}})['then'](handleEntityNotFound(_0x43f3f6,null))[_0xce22('0x27')](removeEntity(_0x43f3f6,null))[_0xce22('0x49')](handleError(_0x43f3f6,null));};exports['addInterval']=function(_0x4f87d0,_0xb3c56a,_0x31edad){if(_0x4f87d0[_0xce22('0x52')]['id']){delete _0x4f87d0[_0xce22('0x52')]['id'];}return db[_0xce22('0x45')][_0xce22('0x4e')]({'where':{'id':_0x4f87d0[_0xce22('0x53')]['id']}})[_0xce22('0x27')](handleEntityNotFound(_0xb3c56a,null))[_0xce22('0x27')](function(_0x18c61d){if(_0x18c61d){_0x4f87d0[_0xce22('0x52')][_0xce22('0x54')]=_0x18c61d['id'];return db[_0xce22('0x45')]['create'](_0x4f87d0['body']);}})[_0xce22('0x27')](respondWithResult(_0xb3c56a,null))['catch'](handleError(_0xb3c56a,null));};exports[_0xce22('0x55')]=function(_0x6fe022,_0x1fef1d,_0x462fcc){var _0x3bfa04={};var _0x326745={};var _0x4a28cf;var _0x3bcd26;return db[_0xce22('0x45')]['findOne']({'where':{'id':_0x6fe022[_0xce22('0x53')]['id']}})[_0xce22('0x27')](handleEntityNotFound(_0x1fef1d,null))[_0xce22('0x27')](function(_0x2ed03c){if(_0x2ed03c){_0x4a28cf=_0x2ed03c;_0x326745[_0xce22('0x34')]=_[_0xce22('0x36')](db[_0xce22('0x45')]['rawAttributes']);_0x326745['query']=_[_0xce22('0x36')](_0x6fe022[_0xce22('0x35')]);_0x326745['filters']=_[_0xce22('0x38')](_0x326745[_0xce22('0x34')],_0x326745[_0xce22('0x35')]);_0x3bfa04[_0xce22('0x39')]=_[_0xce22('0x38')](_0x326745['model'],qs[_0xce22('0x3a')](_0x6fe022[_0xce22('0x35')][_0xce22('0x3a')]));_0x3bfa04[_0xce22('0x39')]=_0x3bfa04[_0xce22('0x39')][_0xce22('0x3b')]?_0x3bfa04['attributes']:_0x326745[_0xce22('0x34')];_0x3bfa04['order']=qs[_0xce22('0x3f')](_0x6fe022[_0xce22('0x35')][_0xce22('0x3f')]);_0x3bfa04[_0xce22('0x43')]=qs[_0xce22('0x37')](_[_0xce22('0x40')](_0x6fe022[_0xce22('0x35')],_0x326745[_0xce22('0x37')]));if(_0x6fe022[_0xce22('0x35')][_0xce22('0x41')]){_0x3bfa04[_0xce22('0x43')]=_[_0xce22('0x42')](_0x3bfa04[_0xce22('0x43')],{'$or':_[_0xce22('0x30')](_0x3bfa04[_0xce22('0x39')],function(_0x415ed1){var _0x948c22={};_0x948c22[_0x415ed1]={'$like':'%'+_0x6fe022['query'][_0xce22('0x41')]+'%'};return _0x948c22;})});}_0x3bfa04=_['merge']({},_0x3bfa04,_0x6fe022[_0xce22('0x44')]);return _0x4a28cf[_0xce22('0x55')](_0x3bfa04);}})[_0xce22('0x27')](function(_0x2204f2){if(_0x2204f2){_0x3bcd26=_0x2204f2['length'];if(!_0x6fe022[_0xce22('0x35')][_0xce22('0x3c')]('nolimit')){_0x3bfa04[_0xce22('0x1f')]=qs[_0xce22('0x1f')](_0x6fe022[_0xce22('0x35')][_0xce22('0x1f')]);_0x3bfa04[_0xce22('0x1d')]=qs[_0xce22('0x1d')](_0x6fe022[_0xce22('0x35')]['offset']);}return _0x4a28cf[_0xce22('0x55')](_0x3bfa04);}})[_0xce22('0x27')](function(_0x2b67ba){if(_0x2b67ba){return _0x2b67ba?{'count':_0x3bcd26,'rows':_0x2b67ba}:null;}})[_0xce22('0x27')](respondWithResult(_0x1fef1d,null))[_0xce22('0x49')](handleError(_0x1fef1d,null));};exports['addIntervals']=function(_0x1f119a,_0x3653d1,_0x4318a1){return db['Interval']['findOne']({'where':{'id':_0x1f119a['params']['id']}})[_0xce22('0x27')](handleEntityNotFound(_0x3653d1,null))[_0xce22('0x27')](function(_0x2327f1){if(_0x2327f1){return db[_0xce22('0x56')][_0xce22('0x57')](function(_0x476c45){return db[_0xce22('0x45')][_0xce22('0x28')]({'where':{'IntervalId':_0x1f119a['params']['id']},'transaction':_0x476c45})[_0xce22('0x27')](function(_0x1fa02c){var _0x1918a4=_[_0xce22('0x30')](_0x1f119a[_0xce22('0x52')],function(_0x6c3bd4){delete _0x6c3bd4['id'];_0x6c3bd4[_0xce22('0x54')]=_0x1f119a[_0xce22('0x53')]['id'];return _0x6c3bd4;});return db[_0xce22('0x45')][_0xce22('0x58')](_0x1918a4,{'transaction':_0x476c45});});})[_0xce22('0x27')](function(){return db[_0xce22('0x45')][_0xce22('0x47')]({'where':{'IntervalId':_0x1f119a[_0xce22('0x53')]['id']}});});}})[_0xce22('0x27')](respondWithResult(_0x3653d1,null))[_0xce22('0x49')](handleError(_0x3653d1,null));}; \ No newline at end of file +var _0x0e44=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','Intervals','UserProfileResource','error','name','send','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x20f27c,_0x36ea42){var _0x2ec2f9=function(_0x3f4108){while(--_0x3f4108){_0x20f27c['push'](_0x20f27c['shift']());}};_0x2ec2f9(++_0x36ea42);}(_0x0e44,0x1db));var _0x40e4=function(_0xfdc26,_0x139e49){_0xfdc26=_0xfdc26-0x0;var _0xa3a052=_0x0e44[_0xfdc26];return _0xa3a052;};'use strict';var emlformat=require(_0x40e4('0x0'));var rimraf=require(_0x40e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40e4('0x2'));var rp=require('request-promise');var moment=require(_0x40e4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x40e4('0x4'));var util=require('util');var path=require(_0x40e4('0x5'));var sox=require('sox');var csv=require(_0x40e4('0x6'));var ejs=require(_0x40e4('0x7'));var fs=require('fs');var fs_extra=require(_0x40e4('0x8'));var _=require('lodash');var squel=require(_0x40e4('0x9'));var crypto=require(_0x40e4('0xa'));var jsforce=require(_0x40e4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x40e4('0x6'));var querystring=require('querystring');var Papa=require(_0x40e4('0xc'));var Redis=require(_0x40e4('0xd'));var authService=require(_0x40e4('0xe'));var qs=require(_0x40e4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40e4('0x10'));var logger=require(_0x40e4('0x11'))(_0x40e4('0x12'));var utils=require('../../config/utils');var config=require(_0x40e4('0x13'));var licenseUtil=require(_0x40e4('0x14'));var db=require(_0x40e4('0x15'))['db'];var extensions=require(_0x40e4('0x16'));function respondWithStatusCode(_0x643da0,_0x2060ee){_0x2060ee=_0x2060ee||0xcc;return function(_0x585f01){if(_0x585f01){return _0x643da0[_0x40e4('0x17')](_0x2060ee);}return _0x643da0[_0x40e4('0x18')](_0x2060ee)[_0x40e4('0x19')]();};}function respondWithResult(_0x27ed46,_0x28e68c){_0x28e68c=_0x28e68c||0xc8;return function(_0x3d24fa){if(_0x3d24fa){return _0x27ed46[_0x40e4('0x18')](_0x28e68c)['json'](_0x3d24fa);}};}function respondWithFilteredResult(_0x26de8d,_0x485d90){return function(_0x217649){if(_0x217649){var _0x256039=typeof _0x485d90[_0x40e4('0x1a')]===_0x40e4('0x1b')&&typeof _0x485d90[_0x40e4('0x1c')]===_0x40e4('0x1b');var _0x24a1ab=_0x217649[_0x40e4('0x1d')];var _0x3bc5e6=_0x256039?0x0:_0x485d90[_0x40e4('0x1a')];var _0x5601eb=_0x256039?_0x217649[_0x40e4('0x1d')]:_0x485d90[_0x40e4('0x1a')]+_0x485d90['limit'];var _0x4e0d48;if(_0x5601eb>=_0x24a1ab){_0x5601eb=_0x24a1ab;_0x4e0d48=0xc8;}else{_0x4e0d48=0xce;}_0x26de8d['status'](_0x4e0d48);return _0x26de8d[_0x40e4('0x1e')](_0x40e4('0x1f'),_0x3bc5e6+'-'+_0x5601eb+'/'+_0x24a1ab)[_0x40e4('0x20')](_0x217649);}return null;};}function patchUpdates(_0x2ed0d8){return function(_0x12e418){try{jsonpatch['apply'](_0x12e418,_0x2ed0d8,!![]);}catch(_0x29161d){return BPromise[_0x40e4('0x21')](_0x29161d);}return _0x12e418[_0x40e4('0x22')]();};}function saveUpdates(_0x332028,_0xbdc639){return function(_0x49ff14){if(_0x49ff14){return _0x49ff14['update'](_0x332028)['then'](function(_0x286e5d){return _0x286e5d;});}return null;};}function removeEntity(_0x41fcae,_0x2dcd88){return function(_0xbf117b){if(_0xbf117b){return _0xbf117b[_0x40e4('0x23')]()[_0x40e4('0x24')](function(){var _0x6540aa=_0xbf117b['get']({'plain':!![]});var _0x4a0ad8=_0x40e4('0x25');return db[_0x40e4('0x26')][_0x40e4('0x23')]({'where':{'type':_0x4a0ad8,'resourceId':_0x6540aa['id']}})[_0x40e4('0x24')](function(){return _0xbf117b;});})[_0x40e4('0x24')](function(){_0x41fcae[_0x40e4('0x18')](0xcc)[_0x40e4('0x19')]();});}};}function handleEntityNotFound(_0xeea21b,_0x22f835){return function(_0x390191){if(!_0x390191){_0xeea21b[_0x40e4('0x17')](0x194);}return _0x390191;};}function handleError(_0x2dce5a,_0x18b556){_0x18b556=_0x18b556||0x1f4;return function(_0x56bff0){logger[_0x40e4('0x27')](_0x56bff0['stack']);if(_0x56bff0[_0x40e4('0x28')]){delete _0x56bff0[_0x40e4('0x28')];}_0x2dce5a[_0x40e4('0x18')](_0x18b556)[_0x40e4('0x29')](_0x56bff0);};}exports['index']=function(_0x535c1b,_0x2e881e){var _0x5a7480={},_0x44f1a6={},_0x33f3f9={'count':0x0,'rows':[]};var _0x24cdd9=_[_0x40e4('0x2a')](db[_0x40e4('0x2b')][_0x40e4('0x2c')],function(_0x52f384){return{'name':_0x52f384[_0x40e4('0x2d')],'type':_0x52f384[_0x40e4('0x2e')]['key']};});_0x44f1a6[_0x40e4('0x2f')]=_['map'](_0x24cdd9,_0x40e4('0x28'));_0x44f1a6[_0x40e4('0x30')]=_[_0x40e4('0x31')](_0x535c1b[_0x40e4('0x30')]);_0x44f1a6[_0x40e4('0x32')]=_[_0x40e4('0x33')](_0x44f1a6[_0x40e4('0x2f')],_0x44f1a6[_0x40e4('0x30')]);_0x5a7480[_0x40e4('0x34')]=_[_0x40e4('0x33')](_0x44f1a6[_0x40e4('0x2f')],qs[_0x40e4('0x35')](_0x535c1b['query'][_0x40e4('0x35')]));_0x5a7480['attributes']=_0x5a7480[_0x40e4('0x34')][_0x40e4('0x36')]?_0x5a7480[_0x40e4('0x34')]:_0x44f1a6['model'];if(!_0x535c1b[_0x40e4('0x30')][_0x40e4('0x37')](_0x40e4('0x38'))){_0x5a7480[_0x40e4('0x1c')]=qs[_0x40e4('0x1c')](_0x535c1b[_0x40e4('0x30')][_0x40e4('0x1c')]);_0x5a7480['offset']=qs[_0x40e4('0x1a')](_0x535c1b[_0x40e4('0x30')][_0x40e4('0x1a')]);}_0x5a7480[_0x40e4('0x39')]=qs[_0x40e4('0x3a')](_0x535c1b[_0x40e4('0x30')][_0x40e4('0x3a')]);_0x5a7480['where']=qs[_0x40e4('0x32')](_[_0x40e4('0x3b')](_0x535c1b[_0x40e4('0x30')],_0x44f1a6['filters']),_0x24cdd9);if(_0x535c1b[_0x40e4('0x30')][_0x40e4('0x3c')]){_0x5a7480['where']=_[_0x40e4('0x3d')](_0x5a7480[_0x40e4('0x3e')],{'$or':_[_0x40e4('0x2a')](_0x24cdd9,function(_0x3df0fd){if(_0x3df0fd[_0x40e4('0x2e')]!==_0x40e4('0x3f')){var _0x33b35e={};_0x33b35e[_0x3df0fd[_0x40e4('0x28')]]={'$like':'%'+_0x535c1b[_0x40e4('0x30')][_0x40e4('0x3c')]+'%'};return _0x33b35e;}})});}_0x5a7480=_['merge']({},_0x5a7480,_0x535c1b[_0x40e4('0x40')]);var _0x3eb3a4={'where':_0x5a7480[_0x40e4('0x3e')]};return db['Interval']['count'](_0x3eb3a4)[_0x40e4('0x24')](function(_0x19413c){_0x33f3f9['count']=_0x19413c;if(_0x535c1b[_0x40e4('0x30')]['includeAll']){_0x5a7480[_0x40e4('0x41')]=[{'all':!![]}];}return db[_0x40e4('0x2b')][_0x40e4('0x42')](_0x5a7480);})[_0x40e4('0x24')](function(_0xe29e46){_0x33f3f9[_0x40e4('0x43')]=_0xe29e46;return _0x33f3f9;})['then'](respondWithFilteredResult(_0x2e881e,_0x5a7480))[_0x40e4('0x44')](handleError(_0x2e881e,null));};exports[_0x40e4('0x45')]=function(_0xa7a13,_0x5e97b5){var _0x22a960={'raw':!![],'where':{'id':_0xa7a13[_0x40e4('0x46')]['id']}},_0x124526={};_0x124526[_0x40e4('0x2f')]=_[_0x40e4('0x31')](db[_0x40e4('0x2b')][_0x40e4('0x2c')]);_0x124526[_0x40e4('0x30')]=_[_0x40e4('0x31')](_0xa7a13['query']);_0x124526['filters']=_['intersection'](_0x124526[_0x40e4('0x2f')],_0x124526[_0x40e4('0x30')]);_0x22a960[_0x40e4('0x34')]=_[_0x40e4('0x33')](_0x124526[_0x40e4('0x2f')],qs[_0x40e4('0x35')](_0xa7a13[_0x40e4('0x30')][_0x40e4('0x35')]));_0x22a960[_0x40e4('0x34')]=_0x22a960[_0x40e4('0x34')][_0x40e4('0x36')]?_0x22a960[_0x40e4('0x34')]:_0x124526[_0x40e4('0x2f')];if(_0xa7a13[_0x40e4('0x30')][_0x40e4('0x47')]){_0x22a960[_0x40e4('0x41')]=[{'all':!![]}];}_0x22a960=_[_0x40e4('0x3d')]({},_0x22a960,_0xa7a13['options']);return db[_0x40e4('0x2b')][_0x40e4('0x48')](_0x22a960)[_0x40e4('0x24')](handleEntityNotFound(_0x5e97b5,null))[_0x40e4('0x24')](respondWithResult(_0x5e97b5,null))[_0x40e4('0x44')](handleError(_0x5e97b5,null));};exports['create']=function(_0xa539fa,_0x680fc5){return db[_0x40e4('0x2b')]['create'](_0xa539fa[_0x40e4('0x49')],{})[_0x40e4('0x24')](function(_0xb9f316){var _0x3606b3=_0xa539fa[_0x40e4('0x4a')][_0x40e4('0x4b')]({'plain':!![]});if(!_0x3606b3)throw new Error(_0x40e4('0x4c'));if(_0x3606b3['role']===_0x40e4('0x4a')){var _0x3ac064=_0xb9f316[_0x40e4('0x4b')]({'plain':!![]});var _0x11f693='Intervals';return db[_0x40e4('0x4d')][_0x40e4('0x48')]({'where':{'name':_0x11f693,'userProfileId':_0x3606b3[_0x40e4('0x4e')]},'raw':!![]})[_0x40e4('0x24')](function(_0x576ef7){if(_0x576ef7&&_0x576ef7[_0x40e4('0x4f')]===0x0){return db[_0x40e4('0x26')][_0x40e4('0x50')]({'name':_0x3ac064['name'],'resourceId':_0x3ac064['id'],'type':_0x576ef7[_0x40e4('0x28')],'sectionId':_0x576ef7['id']},{})[_0x40e4('0x24')](function(){return _0xb9f316;});}else{return _0xb9f316;}})[_0x40e4('0x44')](function(_0x57b332){logger[_0x40e4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57b332);throw _0x57b332;});}return _0xb9f316;})[_0x40e4('0x24')](respondWithResult(_0x680fc5,0xc9))['catch'](handleError(_0x680fc5,null));};exports['update']=function(_0x410e01,_0x504c87){if(_0x410e01[_0x40e4('0x49')]['id']){delete _0x410e01[_0x40e4('0x49')]['id'];}return db[_0x40e4('0x2b')]['find']({'where':{'id':_0x410e01['params']['id']}})[_0x40e4('0x24')](handleEntityNotFound(_0x504c87,null))[_0x40e4('0x24')](saveUpdates(_0x410e01[_0x40e4('0x49')],null))[_0x40e4('0x24')](respondWithResult(_0x504c87,null))[_0x40e4('0x44')](handleError(_0x504c87,null));};exports['destroy']=function(_0x2d1e12,_0x4c76ea){return db[_0x40e4('0x2b')]['find']({'where':{'id':_0x2d1e12[_0x40e4('0x46')]['id']}})[_0x40e4('0x24')](handleEntityNotFound(_0x4c76ea,null))['then'](removeEntity(_0x4c76ea,null))['catch'](handleError(_0x4c76ea,null));};exports['addInterval']=function(_0x43ed87,_0x4e7933,_0x556f97){if(_0x43ed87[_0x40e4('0x49')]['id']){delete _0x43ed87[_0x40e4('0x49')]['id'];}return db[_0x40e4('0x2b')][_0x40e4('0x48')]({'where':{'id':_0x43ed87[_0x40e4('0x46')]['id']}})[_0x40e4('0x24')](handleEntityNotFound(_0x4e7933,null))['then'](function(_0x574d12){if(_0x574d12){_0x43ed87[_0x40e4('0x49')]['IntervalId']=_0x574d12['id'];return db[_0x40e4('0x2b')][_0x40e4('0x50')](_0x43ed87[_0x40e4('0x49')]);}})['then'](respondWithResult(_0x4e7933,null))['catch'](handleError(_0x4e7933,null));};exports[_0x40e4('0x51')]=function(_0x34d064,_0x3ee180,_0x5022f1){var _0x585917={};var _0x165b0a={};var _0x5591da;var _0x2cc433;return db[_0x40e4('0x2b')][_0x40e4('0x52')]({'where':{'id':_0x34d064['params']['id']}})['then'](handleEntityNotFound(_0x3ee180,null))[_0x40e4('0x24')](function(_0x3c1d10){if(_0x3c1d10){_0x5591da=_0x3c1d10;_0x165b0a[_0x40e4('0x2f')]=_['keys'](db[_0x40e4('0x2b')]['rawAttributes']);_0x165b0a['query']=_[_0x40e4('0x31')](_0x34d064[_0x40e4('0x30')]);_0x165b0a['filters']=_['intersection'](_0x165b0a[_0x40e4('0x2f')],_0x165b0a[_0x40e4('0x30')]);_0x585917[_0x40e4('0x34')]=_['intersection'](_0x165b0a[_0x40e4('0x2f')],qs['fields'](_0x34d064[_0x40e4('0x30')][_0x40e4('0x35')]));_0x585917[_0x40e4('0x34')]=_0x585917[_0x40e4('0x34')][_0x40e4('0x36')]?_0x585917[_0x40e4('0x34')]:_0x165b0a[_0x40e4('0x2f')];_0x585917[_0x40e4('0x39')]=qs['sort'](_0x34d064['query'][_0x40e4('0x3a')]);_0x585917[_0x40e4('0x3e')]=qs[_0x40e4('0x32')](_[_0x40e4('0x3b')](_0x34d064['query'],_0x165b0a['filters']));if(_0x34d064[_0x40e4('0x30')][_0x40e4('0x3c')]){_0x585917['where']=_[_0x40e4('0x3d')](_0x585917[_0x40e4('0x3e')],{'$or':_['map'](_0x585917[_0x40e4('0x34')],function(_0x2158c1){var _0x44ec93={};_0x44ec93[_0x2158c1]={'$like':'%'+_0x34d064[_0x40e4('0x30')][_0x40e4('0x3c')]+'%'};return _0x44ec93;})});}_0x585917=_[_0x40e4('0x3d')]({},_0x585917,_0x34d064[_0x40e4('0x40')]);return _0x5591da[_0x40e4('0x51')](_0x585917);}})[_0x40e4('0x24')](function(_0x2ad916){if(_0x2ad916){_0x2cc433=_0x2ad916[_0x40e4('0x36')];if(!_0x34d064[_0x40e4('0x30')]['hasOwnProperty'](_0x40e4('0x38'))){_0x585917['limit']=qs[_0x40e4('0x1c')](_0x34d064[_0x40e4('0x30')][_0x40e4('0x1c')]);_0x585917[_0x40e4('0x1a')]=qs['offset'](_0x34d064[_0x40e4('0x30')][_0x40e4('0x1a')]);}return _0x5591da[_0x40e4('0x51')](_0x585917);}})[_0x40e4('0x24')](function(_0x2b9719){if(_0x2b9719){return _0x2b9719?{'count':_0x2cc433,'rows':_0x2b9719}:null;}})['then'](respondWithResult(_0x3ee180,null))[_0x40e4('0x44')](handleError(_0x3ee180,null));};exports[_0x40e4('0x53')]=function(_0x409573,_0x344eeb,_0x46af2c){return db['Interval'][_0x40e4('0x52')]({'where':{'id':_0x409573[_0x40e4('0x46')]['id']}})['then'](handleEntityNotFound(_0x344eeb,null))[_0x40e4('0x24')](function(_0x17ff61){if(_0x17ff61){return db[_0x40e4('0x54')][_0x40e4('0x55')](function(_0x456985){return db[_0x40e4('0x2b')]['destroy']({'where':{'IntervalId':_0x409573[_0x40e4('0x46')]['id']},'transaction':_0x456985})[_0x40e4('0x24')](function(_0x37b4b5){var _0x2cca75=_['map'](_0x409573['body'],function(_0xa19826){delete _0xa19826['id'];_0xa19826[_0x40e4('0x56')]=_0x409573['params']['id'];return _0xa19826;});return db[_0x40e4('0x2b')][_0x40e4('0x57')](_0x2cca75,{'transaction':_0x456985});});})[_0x40e4('0x24')](function(){return db[_0x40e4('0x2b')][_0x40e4('0x42')]({'where':{'IntervalId':_0x409573[_0x40e4('0x46')]['id']}});});}})[_0x40e4('0x24')](respondWithResult(_0x344eeb,null))[_0x40e4('0x44')](handleError(_0x344eeb,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index de3994e..e576562 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 _0x3be2=['rewrite','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals'];(function(_0x25acd0,_0x500a45){var _0x2e6786=function(_0x385c40){while(--_0x385c40){_0x25acd0['push'](_0x25acd0['shift']());}};_0x2e6786(++_0x500a45);}(_0x3be2,0x18d));var _0x23be=function(_0x3ac193,_0x329cd1){_0x3ac193=_0x3ac193-0x0;var _0xf05937=_0x3be2[_0x3ac193];return _0xf05937;};'use strict';var _=require(_0x23be('0x0'));var util=require('util');var logger=require(_0x23be('0x1'))(_0x23be('0x2'));var moment=require('moment');var BPromise=require(_0x23be('0x3'));var rp=require(_0x23be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x23be('0x5'));var attributes=require(_0x23be('0x6'));var extensions=require(_0x23be('0x7'));module['exports']=function(_0x6d7e2a,_0x42a8b4){return _0x6d7e2a[_0x23be('0x8')](_0x23be('0x9'),attributes,{'tableName':_0x23be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3163de,_0x57e4d6){extensions[_0x23be('0xb')](_0x6d7e2a,_0x3163de);},'afterBulkCreate':function(_0x5cc3b0,_0x38019c,_0x1dc476){_0x1dc476();extensions['rewrite'](_0x6d7e2a,_0x5cc3b0[0x0]);},'afterUpdate':function(_0x5cc1e1,_0x322630){extensions[_0x23be('0xb')](_0x6d7e2a,_0x5cc1e1);},'afterDestroy':function(_0x3f30a5,_0xa71454){extensions[_0x23be('0xb')](_0x6d7e2a,_0x3f30a5);}}});}; \ No newline at end of file +var _0x0a3c=['../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes'];(function(_0x2b7096,_0x28df3f){var _0x2c1bcc=function(_0x25c684){while(--_0x25c684){_0x2b7096['push'](_0x2b7096['shift']());}};_0x2c1bcc(++_0x28df3f);}(_0x0a3c,0x1f4));var _0xc0a3=function(_0x16a16a,_0x19be1c){_0x16a16a=_0x16a16a-0x0;var _0x1587a7=_0x0a3c[_0x16a16a];return _0x1587a7;};'use strict';var _=require(_0xc0a3('0x0'));var util=require(_0xc0a3('0x1'));var logger=require(_0xc0a3('0x2'))(_0xc0a3('0x3'));var moment=require(_0xc0a3('0x4'));var BPromise=require(_0xc0a3('0x5'));var rp=require(_0xc0a3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0a3('0x7'));var config=require(_0xc0a3('0x8'));var attributes=require(_0xc0a3('0x9'));var extensions=require(_0xc0a3('0xa'));module[_0xc0a3('0xb')]=function(_0xd463b9,_0x2fe8cb){return _0xd463b9[_0xc0a3('0xc')]('Interval',attributes,{'tableName':_0xc0a3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x13338c,_0x3f87e5){extensions[_0xc0a3('0xe')](_0xd463b9,_0x13338c);},'afterBulkCreate':function(_0x51fbd8,_0x355845,_0x3bec30){_0x3bec30();extensions[_0xc0a3('0xe')](_0xd463b9,_0x51fbd8[0x0]);},'afterUpdate':function(_0x41bec8,_0x2ce559){extensions[_0xc0a3('0xe')](_0xd463b9,_0x41bec8);},'afterDestroy':function(_0x3b7e75,_0xea5f2){extensions['rewrite'](_0xd463b9,_0x3b7e75);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 482181f..3341c3e 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(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_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);});});}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 da4f612..c511974 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x0b0e[_0x40df5f];return _0x1573f1;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x0b0e,0x187));var _0xe0b0=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x0b0e[_0x68c979];return _0x4f0001;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('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 63189f2..d5b0eda 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 _0xffb1=['parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','socket','remoteAddress','connection','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','stringify','Bug','email','fields','oldToken','newToken','customfield_11503','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','status','statusCode','json'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0xffb1,0x92));var _0x1ffb=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0xffb1[_0xfb42e6];return _0x27265b;};'use strict';var BPromise=require(_0x1ffb('0x0'));var https=require('https');var logger=require(_0x1ffb('0x1'))(_0x1ffb('0x2'));var USERNAME=_0x1ffb('0x3');var PASSWORD=_0x1ffb('0x4');function openIssue(_0x3bb754,_0x5b939c){var _0x3edc2e={'fields':{'project':{'key':_0x3bb754[_0x1ffb('0x5')]||_0x1ffb('0x6')},'summary':(_0x3bb754[_0x1ffb('0x7')]||'Report')+_0x1ffb('0x8')+_0x3bb754['ip'],'description':_0x3bb754['description']||JSON[_0x1ffb('0x9')](_0x3bb754),'issuetype':{'name':_0x3bb754['issuetype']||_0x1ffb('0xa')}}};_0x3edc2e['fields']['customfield_11500']=_0x3bb754[_0x1ffb('0xb')];_0x3edc2e[_0x1ffb('0xc')]['customfield_11501']=_0x3bb754[_0x1ffb('0xd')];_0x3edc2e[_0x1ffb('0xc')]['customfield_11502']=_0x3bb754[_0x1ffb('0xe')];_0x3edc2e[_0x1ffb('0xc')][_0x1ffb('0xf')]=_0x3bb754['name'];_0x3edc2e[_0x1ffb('0xc')]['customfield_11504']=_0x3bb754[_0x1ffb('0x10')];_0x3edc2e[_0x1ffb('0xc')][_0x1ffb('0x11')]=_0x3bb754['ip'];var _0x5c9c6f={'host':_0x1ffb('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x1ffb('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x1ffb('0x14'),'Authorization':_0x1ffb('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x1ffb('0x16'))}};var _0x4ae6fe=JSON[_0x1ffb('0x9')](_0x3edc2e);var _0x24bd47=https[_0x1ffb('0x17')](_0x5c9c6f,function(_0x1b61df){_0x1b61df[_0x1ffb('0x18')](_0x1ffb('0x19'));var _0x3f33aa='';_0x1b61df['on'](_0x1ffb('0x1a'),function(_0xf72ae4){_0x3f33aa+=_0xf72ae4;});_0x1b61df['on']('end',function(){if(_0x5b939c){return _0x5b939c[_0x1ffb('0x1b')](_0x1b61df[_0x1ffb('0x1c')])[_0x1ffb('0x1d')](JSON[_0x1ffb('0x1e')](_0x3f33aa));}});});_0x24bd47['on'](_0x1ffb('0x1f'),function(_0x371559){if(_0x5b939c){return _0x5b939c[_0x1ffb('0x1b')](0x1f4)['json']({'errors':[{'message':_0x1ffb('0x20'),'type':_0x1ffb('0x21')}]});}});_0x24bd47[_0x1ffb('0x22')](_0x4ae6fe);_0x24bd47[_0x1ffb('0x23')]();}exports[_0x1ffb('0x24')]=openIssue;exports[_0x1ffb('0x25')]=function(_0x4ec62b,_0x4f5f53){_0x4ec62b[_0x1ffb('0x26')]['ip']=_0x4ec62b[_0x1ffb('0x27')][_0x1ffb('0x28')]||_0x4ec62b['connection']['remoteAddress']||_0x4ec62b[_0x1ffb('0x29')][_0x1ffb('0x2a')]||_0x4ec62b[_0x1ffb('0x2b')][_0x1ffb('0x29')][_0x1ffb('0x2a')];return openIssue(_0x4ec62b[_0x1ffb('0x26')],_0x4f5f53);}; \ No newline at end of file +var _0x41b4=['customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','toString','base64','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','3eAmWpBVP0','key','MOTGUI','Report','description','issuetype','Bug','fields','oldToken','customfield_11502','customfield_11503','name'];(function(_0x2a3e71,_0x4ebb32){var _0x20b34e=function(_0x4c5afd){while(--_0x4c5afd){_0x2a3e71['push'](_0x2a3e71['shift']());}};_0x20b34e(++_0x4ebb32);}(_0x41b4,0xe8));var _0x441b=function(_0x49e0e5,_0x1f1f6b){_0x49e0e5=_0x49e0e5-0x0;var _0x249c90=_0x41b4[_0x49e0e5];return _0x249c90;};'use strict';var BPromise=require(_0x441b('0x0'));var https=require(_0x441b('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0x441b('0x2');function openIssue(_0x2c6587,_0x2988e4){var _0x30645d={'fields':{'project':{'key':_0x2c6587[_0x441b('0x3')]||_0x441b('0x4')},'summary':(_0x2c6587['summary']||_0x441b('0x5'))+'\x20from\x20'+_0x2c6587['ip'],'description':_0x2c6587[_0x441b('0x6')]||JSON['stringify'](_0x2c6587),'issuetype':{'name':_0x2c6587[_0x441b('0x7')]||_0x441b('0x8')}}};_0x30645d[_0x441b('0x9')]['customfield_11500']=_0x2c6587['email'];_0x30645d[_0x441b('0x9')]['customfield_11501']=_0x2c6587[_0x441b('0xa')];_0x30645d[_0x441b('0x9')][_0x441b('0xb')]=_0x2c6587['newToken'];_0x30645d[_0x441b('0x9')][_0x441b('0xc')]=_0x2c6587[_0x441b('0xd')];_0x30645d[_0x441b('0x9')][_0x441b('0xe')]=_0x2c6587[_0x441b('0xf')];_0x30645d[_0x441b('0x9')][_0x441b('0x10')]=_0x2c6587['ip'];var _0x555fde={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x441b('0x11'),'method':_0x441b('0x12'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x441b('0x13')](_0x441b('0x14'))}};var _0x2d1c94=JSON['stringify'](_0x30645d);var _0x2d679f=https[_0x441b('0x15')](_0x555fde,function(_0x540bc7){_0x540bc7[_0x441b('0x16')](_0x441b('0x17'));var _0x378d7b='';_0x540bc7['on'](_0x441b('0x18'),function(_0x5bf8ca){_0x378d7b+=_0x5bf8ca;});_0x540bc7['on'](_0x441b('0x19'),function(){if(_0x2988e4){return _0x2988e4[_0x441b('0x1a')](_0x540bc7['statusCode'])[_0x441b('0x1b')](JSON[_0x441b('0x1c')](_0x378d7b));}});});_0x2d679f['on'](_0x441b('0x1d'),function(_0x5a76f2){if(_0x2988e4){return _0x2988e4[_0x441b('0x1a')](0x1f4)[_0x441b('0x1b')]({'errors':[{'message':_0x441b('0x1e'),'type':_0x441b('0x1f')}]});}});_0x2d679f[_0x441b('0x20')](_0x2d1c94);_0x2d679f[_0x441b('0x19')]();}exports[_0x441b('0x21')]=openIssue;exports[_0x441b('0x22')]=function(_0x82e890,_0x400ee5){_0x82e890[_0x441b('0x23')]['ip']=_0x82e890[_0x441b('0x24')][_0x441b('0x25')]||_0x82e890['connection'][_0x441b('0x26')]||_0x82e890[_0x441b('0x27')]['remoteAddress']||_0x82e890[_0x441b('0x28')][_0x441b('0x27')]['remoteAddress'];return openIssue(_0x82e890[_0x441b('0x23')],_0x400ee5);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index add6a09..393ea85 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x2dae,0xc3));var _0xe2da=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x2dae[_0x2a276d];return _0x2914cd;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=router; \ No newline at end of file +var _0x91a7=['Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x49f118,_0x5138e4){var _0x3a0443=function(_0x557a45){while(--_0x557a45){_0x49f118['push'](_0x49f118['shift']());}};_0x3a0443(++_0x5138e4);}(_0x91a7,0xe7));var _0x791a=function(_0x36cd63,_0x4b56c3){_0x36cd63=_0x36cd63-0x0;var _0x548d62=_0x91a7[_0x36cd63];return _0x548d62;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0xc')]('/',auth['isAuthenticated'](),controller[_0x791a('0xd')]);router[_0x791a('0xe')]('/:id',auth[_0x791a('0x9')](),controller[_0x791a('0xf')]);router[_0x791a('0x10')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 4f8f480..be02df2 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0xfeaa0f,_0x3f2432){_0xfeaa0f=_0xfeaa0f-0x0;var _0x3f3891=_0x7a54[_0xfeaa0f];return _0x3f3891;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x18e7eb,_0x4737d3){_0x18e7eb=_0x18e7eb-0x0;var _0x37980a=_0x7a54[_0x18e7eb];return _0x37980a;};'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 c07ca99..7606bf4 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 _0x6b8f=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','filters','intersection','model'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4e644b,_0xcc9fde){_0x4e644b=_0x4e644b-0x0;var _0x551db7=_0x6b8f[_0x4e644b];return _0x551db7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6b8('0x2'));var Mustache=require(_0xf6b8('0x3'));var util=require('util');var path=require(_0xf6b8('0x4'));var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6b8('0x7'));var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xb'));var Redis=require(_0xf6b8('0xc'));var authService=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var as=require(_0xf6b8('0xf'));var hardwareService=require(_0xf6b8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x11'));var licenseUtil=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x1d96b9,_0x5a6118){_0x5a6118=_0x5a6118||0xcc;return function(_0x4e5235){if(_0x4e5235){return _0x1d96b9[_0xf6b8('0x14')](_0x5a6118);}return _0x1d96b9[_0xf6b8('0x15')](_0x5a6118)['end']();};}function respondWithResult(_0xfcecc9,_0x2db10c){_0x2db10c=_0x2db10c||0xc8;return function(_0x454d8a){if(_0x454d8a){return _0xfcecc9['status'](_0x2db10c)[_0xf6b8('0x16')](_0x454d8a);}};}function respondWithFilteredResult(_0x53d744,_0x410345){return function(_0x1ee041){if(_0x1ee041){var _0x2e1748=typeof _0x410345[_0xf6b8('0x17')]===_0xf6b8('0x18')&&typeof _0x410345['limit']==='undefined';var _0x3bb9ae=_0x1ee041['count'];var _0x3cf63c=_0x2e1748?0x0:_0x410345[_0xf6b8('0x17')];var _0x4a93a8=_0x2e1748?_0x1ee041['count']:_0x410345[_0xf6b8('0x17')]+_0x410345[_0xf6b8('0x19')];var _0x3081db;if(_0x4a93a8>=_0x3bb9ae){_0x4a93a8=_0x3bb9ae;_0x3081db=0xc8;}else{_0x3081db=0xce;}_0x53d744[_0xf6b8('0x15')](_0x3081db);return _0x53d744['set']('Content-Range',_0x3cf63c+'-'+_0x4a93a8+'/'+_0x3bb9ae)['json'](_0x1ee041);}return null;};}function patchUpdates(_0x3298a4){return function(_0x2a8195){try{jsonpatch[_0xf6b8('0x1a')](_0x2a8195,_0x3298a4,!![]);}catch(_0x56b48a){return BPromise[_0xf6b8('0x1b')](_0x56b48a);}return _0x2a8195[_0xf6b8('0x1c')]();};}function saveUpdates(_0x3d2c57,_0x9c660c){return function(_0x5dd616){if(_0x5dd616){return _0x5dd616[_0xf6b8('0x1d')](_0x3d2c57)['then'](function(_0x22c52d){return _0x22c52d;});}return null;};}function removeEntity(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(_0x4127c9){return _0x4127c9[_0xf6b8('0x1e')]()[_0xf6b8('0x1f')](function(){_0x2b5bd3['status'](0xcc)[_0xf6b8('0x20')]();});}};}function handleEntityNotFound(_0x1ebfea,_0x4815f7){return function(_0x205d6c){if(!_0x205d6c){_0x1ebfea[_0xf6b8('0x14')](0x194);}return _0x205d6c;};}function handleError(_0x324057,_0xd5ebb5){_0xd5ebb5=_0xd5ebb5||0x1f4;return function(_0x3365b8){logger['error'](_0x3365b8['stack']);if(_0x3365b8[_0xf6b8('0x21')]){delete _0x3365b8[_0xf6b8('0x21')];}_0x324057['status'](_0xd5ebb5)[_0xf6b8('0x22')](_0x3365b8);};}exports[_0xf6b8('0x23')]=function(_0x888319,_0x5a7f55){var _0x458935={},_0xc958f4={},_0x511896={'count':0x0,'rows':[]};var _0x309f04=_[_0xf6b8('0x24')](db[_0xf6b8('0x25')][_0xf6b8('0x26')],function(_0x51ffcf){return{'name':_0x51ffcf[_0xf6b8('0x27')],'type':_0x51ffcf[_0xf6b8('0x28')][_0xf6b8('0x29')]};});_0xc958f4['model']=_[_0xf6b8('0x24')](_0x309f04,_0xf6b8('0x21'));_0xc958f4[_0xf6b8('0x2a')]=_['keys'](_0x888319[_0xf6b8('0x2a')]);_0xc958f4[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],_0xc958f4['query']);_0x458935[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],qs['fields'](_0x888319['query'][_0xf6b8('0x2f')]));_0x458935[_0xf6b8('0x2e')]=_0x458935[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x458935[_0xf6b8('0x2e')]:_0xc958f4[_0xf6b8('0x2d')];if(!_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x31')](_0xf6b8('0x32'))){_0x458935[_0xf6b8('0x19')]=qs[_0xf6b8('0x19')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x19')]);_0x458935[_0xf6b8('0x17')]=qs[_0xf6b8('0x17')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x17')]);}_0x458935[_0xf6b8('0x33')]=qs['sort'](_0x888319['query'][_0xf6b8('0x34')]);_0x458935[_0xf6b8('0x35')]=qs[_0xf6b8('0x2b')](_[_0xf6b8('0x36')](_0x888319[_0xf6b8('0x2a')],_0xc958f4[_0xf6b8('0x2b')]),_0x309f04);if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]){_0x458935[_0xf6b8('0x35')]=_[_0xf6b8('0x38')](_0x458935[_0xf6b8('0x35')],{'$or':_[_0xf6b8('0x24')](_0x309f04,function(_0x4a8c49){if(_0x4a8c49[_0xf6b8('0x28')]!==_0xf6b8('0x39')){var _0x5d26ad={};_0x5d26ad[_0x4a8c49[_0xf6b8('0x21')]]={'$like':'%'+_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]+'%'};return _0x5d26ad;}})});}_0x458935=_[_0xf6b8('0x38')]({},_0x458935,_0x888319[_0xf6b8('0x3a')]);var _0x87a4ee={'where':_0x458935[_0xf6b8('0x35')]};return db[_0xf6b8('0x25')][_0xf6b8('0x3b')](_0x87a4ee)[_0xf6b8('0x1f')](function(_0x15a63b){_0x511896[_0xf6b8('0x3b')]=_0x15a63b;if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x3c')]){_0x458935['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x458935);})[_0xf6b8('0x1f')](function(_0x2c68f5){_0x511896[_0xf6b8('0x3d')]=_0x2c68f5;return _0x511896;})[_0xf6b8('0x1f')](respondWithFilteredResult(_0x5a7f55,_0x458935))[_0xf6b8('0x3e')](handleError(_0x5a7f55,null));};exports[_0xf6b8('0x3f')]=function(_0x1390dc,_0x48f4cb){var _0x1f5e72={'raw':!![],'where':{'id':_0x1390dc[_0xf6b8('0x40')]['id']}},_0x5086d9={};_0x5086d9[_0xf6b8('0x2d')]=_[_0xf6b8('0x41')](db[_0xf6b8('0x25')][_0xf6b8('0x26')]);_0x5086d9['query']=_[_0xf6b8('0x41')](_0x1390dc[_0xf6b8('0x2a')]);_0x5086d9[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],_0x5086d9['query']);_0x1f5e72[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],qs['fields'](_0x1390dc['query'][_0xf6b8('0x2f')]));_0x1f5e72[_0xf6b8('0x2e')]=_0x1f5e72[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x1f5e72['attributes']:_0x5086d9['model'];if(_0x1390dc['query'][_0xf6b8('0x3c')]){_0x1f5e72['include']=[{'all':!![]}];}_0x1f5e72=_[_0xf6b8('0x38')]({},_0x1f5e72,_0x1390dc[_0xf6b8('0x3a')]);return db[_0xf6b8('0x25')][_0xf6b8('0x42')](_0x1f5e72)[_0xf6b8('0x1f')](handleEntityNotFound(_0x48f4cb,null))[_0xf6b8('0x1f')](respondWithResult(_0x48f4cb,null))[_0xf6b8('0x3e')](handleError(_0x48f4cb,null));};exports[_0xf6b8('0x43')]=function(_0x394a34,_0x597511){return db[_0xf6b8('0x25')]['create'](_0x394a34[_0xf6b8('0x44')],{})[_0xf6b8('0x1f')](respondWithResult(_0x597511,0xc9))[_0xf6b8('0x3e')](handleError(_0x597511,null));};exports[_0xf6b8('0x1d')]=function(_0x1abf17,_0x291845){if(_0x1abf17[_0xf6b8('0x44')]['id']){delete _0x1abf17['body']['id'];}return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x1abf17[_0xf6b8('0x40')]['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x291845,null))['then'](saveUpdates(_0x1abf17[_0xf6b8('0x44')],null))[_0xf6b8('0x1f')](respondWithResult(_0x291845,null))['catch'](handleError(_0x291845,null));};exports[_0xf6b8('0x1e')]=function(_0x143164,_0x392582){return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x143164['params']['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x392582,null))[_0xf6b8('0x1f')](removeEntity(_0x392582,null))['catch'](handleError(_0x392582,null));};exports['describe']=function(_0x55c392,_0x22c1eb){return db[_0xf6b8('0x25')][_0xf6b8('0x45')]()[_0xf6b8('0x1f')](respondWithResult(_0x22c1eb,null))['catch'](handleError(_0x22c1eb,null));}; \ No newline at end of file +var _0x2caf=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName'];(function(_0x191d3f,_0x1e8398){var _0x501776=function(_0x2e3347){while(--_0x2e3347){_0x191d3f['push'](_0x191d3f['shift']());}};_0x501776(++_0x1e8398);}(_0x2caf,0x6a));var _0xf2ca=function(_0x48999f,_0xa5b2c1){_0x48999f=_0x48999f-0x0;var _0x3cd0b0=_0x2caf[_0x48999f];return _0x3cd0b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf2ca('0x0'));var rp=require('request-promise');var moment=require(_0xf2ca('0x1'));var BPromise=require(_0xf2ca('0x2'));var Mustache=require(_0xf2ca('0x3'));var util=require(_0xf2ca('0x4'));var path=require(_0xf2ca('0x5'));var sox=require(_0xf2ca('0x6'));var csv=require(_0xf2ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2ca('0x8'));var _=require(_0xf2ca('0x9'));var squel=require(_0xf2ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf2ca('0xb'));var toCsv=require(_0xf2ca('0x7'));var querystring=require(_0xf2ca('0xc'));var Papa=require(_0xf2ca('0xd'));var Redis=require(_0xf2ca('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf2ca('0xf'));var as=require(_0xf2ca('0x10'));var hardwareService=require(_0xf2ca('0x11'));var logger=require(_0xf2ca('0x12'))(_0xf2ca('0x13'));var utils=require(_0xf2ca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf2ca('0x15'));var db=require(_0xf2ca('0x16'))['db'];function respondWithStatusCode(_0x54a3cb,_0x88529f){_0x88529f=_0x88529f||0xcc;return function(_0x383112){if(_0x383112){return _0x54a3cb['sendStatus'](_0x88529f);}return _0x54a3cb['status'](_0x88529f)[_0xf2ca('0x17')]();};}function respondWithResult(_0x52a278,_0x284484){_0x284484=_0x284484||0xc8;return function(_0x3123fe){if(_0x3123fe){return _0x52a278[_0xf2ca('0x18')](_0x284484)[_0xf2ca('0x19')](_0x3123fe);}};}function respondWithFilteredResult(_0x410997,_0x2057a2){return function(_0x2ddfac){if(_0x2ddfac){var _0x5aec64=typeof _0x2057a2[_0xf2ca('0x1a')]==='undefined'&&typeof _0x2057a2[_0xf2ca('0x1b')]==='undefined';var _0x235e79=_0x2ddfac[_0xf2ca('0x1c')];var _0x59ea3c=_0x5aec64?0x0:_0x2057a2[_0xf2ca('0x1a')];var _0x160230=_0x5aec64?_0x2ddfac[_0xf2ca('0x1c')]:_0x2057a2[_0xf2ca('0x1a')]+_0x2057a2[_0xf2ca('0x1b')];var _0x1ca233;if(_0x160230>=_0x235e79){_0x160230=_0x235e79;_0x1ca233=0xc8;}else{_0x1ca233=0xce;}_0x410997[_0xf2ca('0x18')](_0x1ca233);return _0x410997[_0xf2ca('0x1d')](_0xf2ca('0x1e'),_0x59ea3c+'-'+_0x160230+'/'+_0x235e79)[_0xf2ca('0x19')](_0x2ddfac);}return null;};}function patchUpdates(_0xea662){return function(_0x55dc6a){try{jsonpatch[_0xf2ca('0x1f')](_0x55dc6a,_0xea662,!![]);}catch(_0x45a028){return BPromise[_0xf2ca('0x20')](_0x45a028);}return _0x55dc6a[_0xf2ca('0x21')]();};}function saveUpdates(_0x41cb71,_0x386c58){return function(_0x1bbd60){if(_0x1bbd60){return _0x1bbd60[_0xf2ca('0x22')](_0x41cb71)['then'](function(_0x14791b){return _0x14791b;});}return null;};}function removeEntity(_0x1767f7,_0x56ebed){return function(_0x1c032c){if(_0x1c032c){return _0x1c032c[_0xf2ca('0x23')]()[_0xf2ca('0x24')](function(){_0x1767f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbfcb0b,_0x1b3c01){return function(_0x214fa9){if(!_0x214fa9){_0xbfcb0b[_0xf2ca('0x25')](0x194);}return _0x214fa9;};}function handleError(_0x1255ba,_0x427a17){_0x427a17=_0x427a17||0x1f4;return function(_0x339e10){logger[_0xf2ca('0x26')](_0x339e10['stack']);if(_0x339e10[_0xf2ca('0x27')]){delete _0x339e10[_0xf2ca('0x27')];}_0x1255ba[_0xf2ca('0x18')](_0x427a17)[_0xf2ca('0x28')](_0x339e10);};}exports[_0xf2ca('0x29')]=function(_0x41fc04,_0x17707e){var _0xb0ae21={},_0x1b44fb={},_0x20a523={'count':0x0,'rows':[]};var _0xf92250=_[_0xf2ca('0x2a')](db[_0xf2ca('0x2b')][_0xf2ca('0x2c')],function(_0x2b0649){return{'name':_0x2b0649[_0xf2ca('0x2d')],'type':_0x2b0649[_0xf2ca('0x2e')][_0xf2ca('0x2f')]};});_0x1b44fb[_0xf2ca('0x30')]=_['map'](_0xf92250,_0xf2ca('0x27'));_0x1b44fb[_0xf2ca('0x31')]=_[_0xf2ca('0x32')](_0x41fc04[_0xf2ca('0x31')]);_0x1b44fb[_0xf2ca('0x33')]=_[_0xf2ca('0x34')](_0x1b44fb[_0xf2ca('0x30')],_0x1b44fb[_0xf2ca('0x31')]);_0xb0ae21[_0xf2ca('0x35')]=_['intersection'](_0x1b44fb[_0xf2ca('0x30')],qs[_0xf2ca('0x36')](_0x41fc04[_0xf2ca('0x31')]['fields']));_0xb0ae21[_0xf2ca('0x35')]=_0xb0ae21['attributes'][_0xf2ca('0x37')]?_0xb0ae21[_0xf2ca('0x35')]:_0x1b44fb[_0xf2ca('0x30')];if(!_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x38')]('nolimit')){_0xb0ae21['limit']=qs[_0xf2ca('0x1b')](_0x41fc04['query'][_0xf2ca('0x1b')]);_0xb0ae21[_0xf2ca('0x1a')]=qs[_0xf2ca('0x1a')](_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x1a')]);}_0xb0ae21[_0xf2ca('0x39')]=qs[_0xf2ca('0x3a')](_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3a')]);_0xb0ae21[_0xf2ca('0x3b')]=qs[_0xf2ca('0x33')](_[_0xf2ca('0x3c')](_0x41fc04[_0xf2ca('0x31')],_0x1b44fb[_0xf2ca('0x33')]),_0xf92250);if(_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3d')]){_0xb0ae21['where']=_[_0xf2ca('0x3e')](_0xb0ae21[_0xf2ca('0x3b')],{'$or':_[_0xf2ca('0x2a')](_0xf92250,function(_0x148570){if(_0x148570['type']!==_0xf2ca('0x3f')){var _0x4b0e0e={};_0x4b0e0e[_0x148570[_0xf2ca('0x27')]]={'$like':'%'+_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3d')]+'%'};return _0x4b0e0e;}})});}_0xb0ae21=_[_0xf2ca('0x3e')]({},_0xb0ae21,_0x41fc04[_0xf2ca('0x40')]);var _0x4fbaec={'where':_0xb0ae21[_0xf2ca('0x3b')]};return db[_0xf2ca('0x2b')]['count'](_0x4fbaec)[_0xf2ca('0x24')](function(_0x29ebce){_0x20a523[_0xf2ca('0x1c')]=_0x29ebce;if(_0x41fc04['query'][_0xf2ca('0x41')]){_0xb0ae21['include']=[{'all':!![]}];}return db[_0xf2ca('0x2b')][_0xf2ca('0x42')](_0xb0ae21);})[_0xf2ca('0x24')](function(_0x43b2c2){_0x20a523[_0xf2ca('0x43')]=_0x43b2c2;return _0x20a523;})[_0xf2ca('0x24')](respondWithFilteredResult(_0x17707e,_0xb0ae21))[_0xf2ca('0x44')](handleError(_0x17707e,null));};exports[_0xf2ca('0x45')]=function(_0x43b3c7,_0x128535){var _0x17de81={'raw':!![],'where':{'id':_0x43b3c7[_0xf2ca('0x46')]['id']}},_0x3360d9={};_0x3360d9[_0xf2ca('0x30')]=_[_0xf2ca('0x32')](db['JscriptyAnswerReport'][_0xf2ca('0x2c')]);_0x3360d9[_0xf2ca('0x31')]=_[_0xf2ca('0x32')](_0x43b3c7[_0xf2ca('0x31')]);_0x3360d9[_0xf2ca('0x33')]=_[_0xf2ca('0x34')](_0x3360d9[_0xf2ca('0x30')],_0x3360d9[_0xf2ca('0x31')]);_0x17de81[_0xf2ca('0x35')]=_[_0xf2ca('0x34')](_0x3360d9[_0xf2ca('0x30')],qs[_0xf2ca('0x36')](_0x43b3c7[_0xf2ca('0x31')]['fields']));_0x17de81['attributes']=_0x17de81[_0xf2ca('0x35')][_0xf2ca('0x37')]?_0x17de81['attributes']:_0x3360d9[_0xf2ca('0x30')];if(_0x43b3c7['query'][_0xf2ca('0x41')]){_0x17de81[_0xf2ca('0x47')]=[{'all':!![]}];}_0x17de81=_[_0xf2ca('0x3e')]({},_0x17de81,_0x43b3c7['options']);return db[_0xf2ca('0x2b')][_0xf2ca('0x48')](_0x17de81)['then'](handleEntityNotFound(_0x128535,null))[_0xf2ca('0x24')](respondWithResult(_0x128535,null))[_0xf2ca('0x44')](handleError(_0x128535,null));};exports[_0xf2ca('0x49')]=function(_0x3e92cf,_0x4a6439){return db[_0xf2ca('0x2b')][_0xf2ca('0x49')](_0x3e92cf[_0xf2ca('0x4a')],{})['then'](respondWithResult(_0x4a6439,0xc9))['catch'](handleError(_0x4a6439,null));};exports[_0xf2ca('0x22')]=function(_0x2f7596,_0x1a65c6){if(_0x2f7596[_0xf2ca('0x4a')]['id']){delete _0x2f7596[_0xf2ca('0x4a')]['id'];}return db[_0xf2ca('0x2b')]['find']({'where':{'id':_0x2f7596['params']['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x1a65c6,null))[_0xf2ca('0x24')](saveUpdates(_0x2f7596['body'],null))[_0xf2ca('0x24')](respondWithResult(_0x1a65c6,null))['catch'](handleError(_0x1a65c6,null));};exports[_0xf2ca('0x23')]=function(_0x59bbb8,_0x26a483){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x59bbb8[_0xf2ca('0x46')]['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x26a483,null))['then'](removeEntity(_0x26a483,null))[_0xf2ca('0x44')](handleError(_0x26a483,null));};exports[_0xf2ca('0x4b')]=function(_0x2eb8d5,_0x14850c){return db[_0xf2ca('0x2b')][_0xf2ca('0x4b')]()['then'](respondWithResult(_0x14850c,null))[_0xf2ca('0x44')](handleError(_0x14850c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index fee1cc2..a6c4d4b 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 _0x0848=['report_jscripty_answers','lodash','../../config/logger','moment','bluebird','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport'];(function(_0x1e5e85,_0xac6fd2){var _0x58d0c2=function(_0x55f975){while(--_0x55f975){_0x1e5e85['push'](_0x1e5e85['shift']());}};_0x58d0c2(++_0xac6fd2);}(_0x0848,0x184));var _0x8084=function(_0x5d8ef7,_0x5373aa){_0x5d8ef7=_0x5d8ef7-0x0;var _0x5c35d6=_0x0848[_0x5d8ef7];return _0x5c35d6;};'use strict';var _=require(_0x8084('0x0'));var util=require('util');var logger=require(_0x8084('0x1'))('api');var moment=require(_0x8084('0x2'));var BPromise=require(_0x8084('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8084('0x4'));var config=require('../../config/environment');var attributes=require(_0x8084('0x5'));module[_0x8084('0x6')]=function(_0x5760eb,_0x486c11){return _0x5760eb['define'](_0x8084('0x7'),attributes,{'tableName':_0x8084('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaad9=['JscriptyAnswerReport','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x3efc93,_0xf6ee16){var _0x4ddc41=function(_0x5339fc){while(--_0x5339fc){_0x3efc93['push'](_0x3efc93['shift']());}};_0x4ddc41(++_0xf6ee16);}(_0xaad9,0xb1));var _0x9aad=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xaad9[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9aad('0x0'))('api');var moment=require(_0x9aad('0x1'));var BPromise=require(_0x9aad('0x2'));var rp=require(_0x9aad('0x3'));var fs=require('fs');var path=require(_0x9aad('0x4'));var rimraf=require(_0x9aad('0x5'));var config=require(_0x9aad('0x6'));var attributes=require(_0x9aad('0x7'));module[_0x9aad('0x8')]=function(_0x13222b,_0x37a719){return _0x13222b[_0x9aad('0x9')](_0x9aad('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ccdf99a..004624f 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 _0x033e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0xf66454,_0x27546a){var _0x9d1fa9=function(_0x53167a){while(--_0x53167a){_0xf66454['push'](_0xf66454['shift']());}};_0x9d1fa9(++_0x27546a);}(_0x033e,0xe3));var _0xe033=function(_0x9f030,_0x4187b7){_0x9f030=_0x9f030-0x0;var _0x34e8dc=_0x033e[_0x9f030];return _0x34e8dc;};'use strict';var _=require(_0xe033('0x0'));var util=require(_0xe033('0x1'));var moment=require('moment');var BPromise=require(_0xe033('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe033('0x3'));var db=require(_0xe033('0x4'))['db'];var utils=require(_0xe033('0x5'));var logger=require(_0xe033('0x6'))(_0xe033('0x7'));var config=require(_0xe033('0x8'));var jayson=require(_0xe033('0x9'));var client=jayson[_0xe033('0xa')][_0xe033('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x532c99,_0x4505d4,_0x39e5f4){return new BPromise(function(_0x50df18,_0x3e9d09){return client[_0xe033('0xc')](_0x532c99,_0x39e5f4)['then'](function(_0x1a85f8){logger[_0xe033('0xd')](_0xe033('0xe'),_0x4505d4,'request\x20sent');logger[_0xe033('0xf')](_0xe033('0x10'),_0x4505d4,_0xe033('0x11'),JSON[_0xe033('0x12')](_0x1a85f8));if(_0x1a85f8[_0xe033('0x13')]){if(_0x1a85f8[_0xe033('0x13')][_0xe033('0x14')]===0x1f4){logger[_0xe033('0x13')](_0xe033('0xe'),_0x4505d4,_0x1a85f8['error'][_0xe033('0x15')]);return _0x3e9d09(_0x1a85f8[_0xe033('0x13')]['message']);}logger[_0xe033('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4505d4,_0x1a85f8['error'][_0xe033('0x15')]);return _0x50df18(_0x1a85f8[_0xe033('0x13')][_0xe033('0x15')]);}else{logger['info'](_0xe033('0xe'),_0x4505d4,_0xe033('0x11'));_0x50df18(_0x1a85f8['result']['message']);}})[_0xe033('0x16')](function(_0x56752f){logger[_0xe033('0x13')](_0xe033('0xe'),_0x4505d4,_0x56752f);_0x3e9d09(_0x56752f);});});} \ No newline at end of file +var _0x2028=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x4b9a48,_0x486d50){var _0x25f574=function(_0x572c78){while(--_0x572c78){_0x4b9a48['push'](_0x4b9a48['shift']());}};_0x25f574(++_0x486d50);}(_0x2028,0x64));var _0x8202=function(_0x316538,_0x5dcdf5){_0x316538=_0x316538-0x0;var _0x803c70=_0x2028[_0x316538];return _0x803c70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8202('0x0'));var BPromise=require(_0x8202('0x1'));var rs=require(_0x8202('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8202('0x3'))['db'];var utils=require(_0x8202('0x4'));var logger=require(_0x8202('0x5'))('rpc');var config=require(_0x8202('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8202('0x7')][_0x8202('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4382f2,_0x170fb4,_0x5a2b9d){return new BPromise(function(_0xe5773d,_0xaf3ee7){return client[_0x8202('0x9')](_0x4382f2,_0x5a2b9d)[_0x8202('0xa')](function(_0x304e44){logger[_0x8202('0xb')](_0x8202('0xc'),_0x170fb4,'request\x20sent');logger[_0x8202('0xd')](_0x8202('0xe'),_0x170fb4,_0x8202('0xf'),JSON[_0x8202('0x10')](_0x304e44));if(_0x304e44[_0x8202('0x11')]){if(_0x304e44[_0x8202('0x11')][_0x8202('0x12')]===0x1f4){logger[_0x8202('0x11')](_0x8202('0xc'),_0x170fb4,_0x304e44[_0x8202('0x11')][_0x8202('0x13')]);return _0xaf3ee7(_0x304e44[_0x8202('0x11')][_0x8202('0x13')]);}logger[_0x8202('0x11')](_0x8202('0xc'),_0x170fb4,_0x304e44[_0x8202('0x11')][_0x8202('0x13')]);return _0xe5773d(_0x304e44['error'][_0x8202('0x13')]);}else{logger[_0x8202('0xb')](_0x8202('0xc'),_0x170fb4,_0x8202('0xf'));_0xe5773d(_0x304e44[_0x8202('0x14')][_0x8202('0x13')]);}})[_0x8202('0x15')](function(_0x52d0ef){logger['error'](_0x8202('0xc'),_0x170fb4,_0x52d0ef);_0xaf3ee7(_0x52d0ef);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 9efc3cc..12a6631 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 _0x6a4b=['put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','post','create','/:id/clone','clone'];(function(_0x463e45,_0x1ff35f){var _0x172e49=function(_0x35f7d0){while(--_0x35f7d0){_0x463e45['push'](_0x463e45['shift']());}};_0x172e49(++_0x1ff35f);}(_0x6a4b,0xe6));var _0xb6a4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6a4b[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0xb6a4('0x0'));var path=require('path');var timeout=require(_0xb6a4('0x1'));var express=require(_0xb6a4('0x2'));var router=express[_0xb6a4('0x3')]();var fs_extra=require(_0xb6a4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb6a4('0x5'));router[_0xb6a4('0x6')]('/',auth[_0xb6a4('0x7')](),controller[_0xb6a4('0x8')]);router[_0xb6a4('0x6')](_0xb6a4('0x9'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0xa')]);router[_0xb6a4('0x6')](_0xb6a4('0xb'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0xc')]);router['get'](_0xb6a4('0xd'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0xe')]);router['get'](_0xb6a4('0xf'),auth[_0xb6a4('0x7')](),timeout('30s'),controller['getSummary']);router[_0xb6a4('0x10')]('/',auth[_0xb6a4('0x7')](),controller[_0xb6a4('0x11')]);router[_0xb6a4('0x10')](_0xb6a4('0x12'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0x13')]);router[_0xb6a4('0x14')](_0xb6a4('0x9'),auth['isAuthenticated'](),controller[_0xb6a4('0x15')]);router[_0xb6a4('0x16')](_0xb6a4('0x9'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0x17')]);module[_0xb6a4('0x18')]=router; \ No newline at end of file +var _0x535b=['update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone'];(function(_0xe75ddd,_0x452d7b){var _0x69c6b2=function(_0x367a2d){while(--_0x367a2d){_0xe75ddd['push'](_0xe75ddd['shift']());}};_0x69c6b2(++_0x452d7b);}(_0x535b,0x1c5));var _0xb535=function(_0x4b1f9b,_0x43fd65){_0x4b1f9b=_0x4b1f9b-0x0;var _0x467c9b=_0x535b[_0x4b1f9b];return _0x467c9b;};'use strict';var multer=require(_0xb535('0x0'));var util=require(_0xb535('0x1'));var path=require('path');var timeout=require(_0xb535('0x2'));var express=require(_0xb535('0x3'));var router=express[_0xb535('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb535('0x5'));var config=require(_0xb535('0x6'));var controller=require(_0xb535('0x7'));router[_0xb535('0x8')]('/',auth[_0xb535('0x9')](),controller['index']);router['get'](_0xb535('0xa'),auth[_0xb535('0x9')](),controller[_0xb535('0xb')]);router[_0xb535('0x8')](_0xb535('0xc'),auth[_0xb535('0x9')](),controller[_0xb535('0xd')]);router['get'](_0xb535('0xe'),auth[_0xb535('0x9')](),controller[_0xb535('0xf')]);router[_0xb535('0x8')](_0xb535('0x10'),auth[_0xb535('0x9')](),timeout(_0xb535('0x11')),controller[_0xb535('0x12')]);router[_0xb535('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xb535('0x14'),auth[_0xb535('0x9')](),controller[_0xb535('0x15')]);router['put'](_0xb535('0xa'),auth[_0xb535('0x9')](),controller[_0xb535('0x16')]);router['delete'](_0xb535('0xa'),auth[_0xb535('0x9')](),controller[_0xb535('0x17')]);module[_0xb535('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 3448626..cab786e 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 _0xd0c6=['getDataValue','BOOLEAN','sequelize','util','STRING','name','TEXT','isObjectLike','setDataValue','formData','format'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0xd0c6,0x1af));var _0x6d0c=function(_0x22a885,_0x3422b5){_0x22a885=_0x22a885-0x0;var _0x262f85=_0xd0c6[_0x22a885];return _0x262f85;};'use strict';var Sequelize=require(_0x6d0c('0x0'));var _=require('lodash');var util=require(_0x6d0c('0x1'));module['exports']={'name':{'type':Sequelize[_0x6d0c('0x2')],'unique':_0x6d0c('0x3')},'description':{'type':Sequelize[_0x6d0c('0x2')]},'formData':{'type':Sequelize[_0x6d0c('0x4')]('long'),'set':function(_0x1fcc5d){if(_[_0x6d0c('0x5')](_0x1fcc5d)){this[_0x6d0c('0x6')](_0x6d0c('0x7'),JSON['stringify'](_0x1fcc5d));}else if(_['isString'](_0x1fcc5d)){this['setDataValue'](_0x6d0c('0x7'),_0x1fcc5d);}else{this[_0x6d0c('0x6')]('formData',util[_0x6d0c('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x6d0c('0x3'))||'',this[_0x6d0c('0x9')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6d0c('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x981e=['lodash','exports','STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify','isString','format','getDataValue','description','BOOLEAN','sequelize'];(function(_0x5b75ad,_0x147887){var _0x3526bf=function(_0x5c5308){while(--_0x5c5308){_0x5b75ad['push'](_0x5b75ad['shift']());}};_0x3526bf(++_0x147887);}(_0x981e,0x1d0));var _0xe981=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x981e[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xe981('0x0'));var _=require(_0xe981('0x1'));var util=require('util');module[_0xe981('0x2')]={'name':{'type':Sequelize[_0xe981('0x3')],'unique':_0xe981('0x4')},'description':{'type':Sequelize[_0xe981('0x3')]},'formData':{'type':Sequelize[_0xe981('0x5')]('long'),'set':function(_0x335489){if(_[_0xe981('0x6')](_0x335489)){this[_0xe981('0x7')](_0xe981('0x8'),JSON[_0xe981('0x9')](_0x335489));}else if(_[_0xe981('0xa')](_0x335489)){this[_0xe981('0x7')](_0xe981('0x8'),_0x335489);}else{this[_0xe981('0x7')](_0xe981('0x8'),util[_0xe981('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xe981('0xc')]('name')||'',this[_0xe981('0xc')](_0xe981('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xe981('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 34edd1a..72bd568 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 _0xbe58=['name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','role','find','autoAssociation','clone','updatedAt','omit','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0xbe58,0x19f));var _0x8be5=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xbe58[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8be5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8be5('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8be5('0x2'));var util=require(_0x8be5('0x3'));var path=require(_0x8be5('0x4'));var sox=require(_0x8be5('0x5'));var csv=require(_0x8be5('0x6'));var ejs=require(_0x8be5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8be5('0x8'));var crypto=require(_0x8be5('0x9'));var jsforce=require(_0x8be5('0xa'));var deskjs=require(_0x8be5('0xb'));var toCsv=require(_0x8be5('0x6'));var querystring=require('querystring');var Papa=require(_0x8be5('0xc'));var Redis=require(_0x8be5('0xd'));var authService=require(_0x8be5('0xe'));var qs=require(_0x8be5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8be5('0x10'))('api');var utils=require(_0x8be5('0x11'));var config=require(_0x8be5('0x12'));var licenseUtil=require(_0x8be5('0x13'));var db=require(_0x8be5('0x14'))['db'];function respondWithStatusCode(_0x30532a,_0x5a84f6){_0x5a84f6=_0x5a84f6||0xcc;return function(_0x3cfa77){if(_0x3cfa77){return _0x30532a[_0x8be5('0x15')](_0x5a84f6);}return _0x30532a['status'](_0x5a84f6)[_0x8be5('0x16')]();};}function respondWithResult(_0x10d407,_0x5be1f1){_0x5be1f1=_0x5be1f1||0xc8;return function(_0x4a4988){if(_0x4a4988){return _0x10d407['status'](_0x5be1f1)[_0x8be5('0x17')](_0x4a4988);}};}function respondWithFilteredResult(_0x46e89b,_0x31650e){return function(_0x26e6f8){if(_0x26e6f8){var _0x33a470=typeof _0x31650e[_0x8be5('0x18')]===_0x8be5('0x19')&&typeof _0x31650e[_0x8be5('0x1a')]==='undefined';var _0x2e9b1e=_0x26e6f8[_0x8be5('0x1b')];var _0x526ea7=_0x33a470?0x0:_0x31650e['offset'];var _0x1d4c79=_0x33a470?_0x26e6f8[_0x8be5('0x1b')]:_0x31650e[_0x8be5('0x18')]+_0x31650e[_0x8be5('0x1a')];var _0x5b97e4;if(_0x1d4c79>=_0x2e9b1e){_0x1d4c79=_0x2e9b1e;_0x5b97e4=0xc8;}else{_0x5b97e4=0xce;}_0x46e89b[_0x8be5('0x1c')](_0x5b97e4);return _0x46e89b[_0x8be5('0x1d')]('Content-Range',_0x526ea7+'-'+_0x1d4c79+'/'+_0x2e9b1e)[_0x8be5('0x17')](_0x26e6f8);}return null;};}function patchUpdates(_0x2af8ed){return function(_0x365474){try{jsonpatch[_0x8be5('0x1e')](_0x365474,_0x2af8ed,!![]);}catch(_0x2644ed){return BPromise[_0x8be5('0x1f')](_0x2644ed);}return _0x365474[_0x8be5('0x20')]();};}function saveUpdates(_0x28afd1,_0x3c64ad){return function(_0x20edb8){if(_0x20edb8){return _0x20edb8[_0x8be5('0x21')](_0x28afd1)[_0x8be5('0x22')](function(_0xb13938){return _0xb13938;});}return null;};}function removeEntity(_0x2dbb4d,_0x26d42c){return function(_0x895c6d){if(_0x895c6d){return _0x895c6d[_0x8be5('0x23')]()[_0x8be5('0x22')](function(){var _0x52fa88=_0x895c6d[_0x8be5('0x24')]({'plain':!![]});var _0x47401e=_0x8be5('0x25');return db[_0x8be5('0x26')][_0x8be5('0x23')]({'where':{'type':_0x47401e,'resourceId':_0x52fa88['id']}})[_0x8be5('0x22')](function(){return _0x895c6d;});})[_0x8be5('0x22')](function(){_0x2dbb4d[_0x8be5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x191449,_0x4e6dd1){return function(_0x48c817){if(!_0x48c817){_0x191449['sendStatus'](0x194);}return _0x48c817;};}function handleError(_0x1649e7,_0x23cf60){_0x23cf60=_0x23cf60||0x1f4;return function(_0x332d35){logger[_0x8be5('0x27')](_0x332d35[_0x8be5('0x28')]);if(_0x332d35[_0x8be5('0x29')]){delete _0x332d35[_0x8be5('0x29')];}_0x1649e7[_0x8be5('0x1c')](_0x23cf60)[_0x8be5('0x2a')](_0x332d35);};}exports[_0x8be5('0x2b')]=function(_0x5a0902,_0x235279){var _0x1d10a9={},_0x37ce79={},_0x1eea12={'count':0x0,'rows':[]};var _0xcd3ebd=_[_0x8be5('0x2c')](db[_0x8be5('0x2d')][_0x8be5('0x2e')],function(_0x2c057c){return{'name':_0x2c057c[_0x8be5('0x2f')],'type':_0x2c057c[_0x8be5('0x30')][_0x8be5('0x31')]};});_0x37ce79[_0x8be5('0x32')]=_[_0x8be5('0x2c')](_0xcd3ebd,_0x8be5('0x29'));_0x37ce79[_0x8be5('0x33')]=_[_0x8be5('0x34')](_0x5a0902[_0x8be5('0x33')]);_0x37ce79[_0x8be5('0x35')]=_[_0x8be5('0x36')](_0x37ce79[_0x8be5('0x32')],_0x37ce79[_0x8be5('0x33')]);_0x1d10a9[_0x8be5('0x37')]=_[_0x8be5('0x36')](_0x37ce79[_0x8be5('0x32')],qs['fields'](_0x5a0902['query'][_0x8be5('0x38')]));_0x1d10a9[_0x8be5('0x37')]=_0x1d10a9['attributes']['length']?_0x1d10a9[_0x8be5('0x37')]:_0x37ce79[_0x8be5('0x32')];if(!_0x5a0902[_0x8be5('0x33')][_0x8be5('0x39')](_0x8be5('0x3a'))){_0x1d10a9[_0x8be5('0x1a')]=qs[_0x8be5('0x1a')](_0x5a0902[_0x8be5('0x33')][_0x8be5('0x1a')]);_0x1d10a9[_0x8be5('0x18')]=qs[_0x8be5('0x18')](_0x5a0902[_0x8be5('0x33')][_0x8be5('0x18')]);}_0x1d10a9[_0x8be5('0x3b')]=qs[_0x8be5('0x3c')](_0x5a0902['query'][_0x8be5('0x3c')]);_0x1d10a9[_0x8be5('0x3d')]=qs[_0x8be5('0x35')](_[_0x8be5('0x3e')](_0x5a0902[_0x8be5('0x33')],_0x37ce79[_0x8be5('0x35')]),_0xcd3ebd);if(_0x5a0902[_0x8be5('0x33')][_0x8be5('0x3f')]){_0x1d10a9[_0x8be5('0x3d')]=_[_0x8be5('0x40')](_0x1d10a9['where'],{'$or':_[_0x8be5('0x2c')](_0xcd3ebd,function(_0x3bb0ee){if(_0x3bb0ee[_0x8be5('0x30')]!==_0x8be5('0x41')){var _0x17c370={};_0x17c370[_0x3bb0ee[_0x8be5('0x29')]]={'$like':'%'+_0x5a0902[_0x8be5('0x33')][_0x8be5('0x3f')]+'%'};return _0x17c370;}})});}_0x1d10a9=_['merge']({},_0x1d10a9,_0x5a0902[_0x8be5('0x42')]);var _0x5178d9={'where':_0x1d10a9[_0x8be5('0x3d')]};return db[_0x8be5('0x2d')][_0x8be5('0x1b')](_0x5178d9)[_0x8be5('0x22')](function(_0x53ae19){_0x1eea12[_0x8be5('0x1b')]=_0x53ae19;if(_0x5a0902[_0x8be5('0x33')][_0x8be5('0x43')]){_0x1d10a9[_0x8be5('0x44')]=[{'all':!![]}];}return db[_0x8be5('0x2d')][_0x8be5('0x45')](_0x1d10a9);})[_0x8be5('0x22')](function(_0x33e2d3){_0x1eea12[_0x8be5('0x46')]=_0x33e2d3;return _0x1eea12;})['then'](respondWithFilteredResult(_0x235279,_0x1d10a9))[_0x8be5('0x47')](handleError(_0x235279,null));};exports[_0x8be5('0x48')]=function(_0x5c0eef,_0x13dfa2){var _0x5e1f63={'raw':![],'where':{'id':_0x5c0eef[_0x8be5('0x49')]['id']}},_0x55ca22={};_0x55ca22[_0x8be5('0x32')]=_['keys'](db[_0x8be5('0x2d')][_0x8be5('0x2e')]);_0x55ca22[_0x8be5('0x33')]=_[_0x8be5('0x34')](_0x5c0eef[_0x8be5('0x33')]);_0x55ca22[_0x8be5('0x35')]=_[_0x8be5('0x36')](_0x55ca22[_0x8be5('0x32')],_0x55ca22[_0x8be5('0x33')]);_0x5e1f63[_0x8be5('0x37')]=_[_0x8be5('0x36')](_0x55ca22[_0x8be5('0x32')],qs[_0x8be5('0x38')](_0x5c0eef['query'][_0x8be5('0x38')]));_0x5e1f63[_0x8be5('0x37')]=_0x5e1f63[_0x8be5('0x37')][_0x8be5('0x4a')]?_0x5e1f63['attributes']:_0x55ca22[_0x8be5('0x32')];if(_0x5c0eef[_0x8be5('0x33')][_0x8be5('0x43')]){_0x5e1f63[_0x8be5('0x44')]=[{'all':!![]}];}_0x5e1f63=_[_0x8be5('0x40')]({},_0x5e1f63,_0x5c0eef[_0x8be5('0x42')]);return db['JscriptyProject']['find'](_0x5e1f63)[_0x8be5('0x22')](handleEntityNotFound(_0x13dfa2,null))[_0x8be5('0x22')](respondWithResult(_0x13dfa2,null))[_0x8be5('0x47')](handleError(_0x13dfa2,null));};exports[_0x8be5('0x4b')]=function(_0x478e9e,_0x3b254f){return db[_0x8be5('0x2d')]['create'](_0x478e9e[_0x8be5('0x4c')],{})[_0x8be5('0x22')](function(_0x7bb32b){var _0x2ade2d=_0x478e9e[_0x8be5('0x4d')][_0x8be5('0x24')]({'plain':!![]});if(!_0x2ade2d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ade2d[_0x8be5('0x4e')]===_0x8be5('0x4d')){var _0xd51d19=_0x7bb32b[_0x8be5('0x24')]({'plain':!![]});var _0x40a495=_0x8be5('0x25');return db['UserProfileSection'][_0x8be5('0x4f')]({'where':{'name':_0x40a495,'userProfileId':_0x2ade2d['userProfileId']},'raw':!![]})[_0x8be5('0x22')](function(_0x500771){if(_0x500771&&_0x500771[_0x8be5('0x50')]===0x0){return db[_0x8be5('0x26')][_0x8be5('0x4b')]({'name':_0xd51d19[_0x8be5('0x29')],'resourceId':_0xd51d19['id'],'type':_0x500771[_0x8be5('0x29')],'sectionId':_0x500771['id']},{})[_0x8be5('0x22')](function(){return _0x7bb32b;});}else{return _0x7bb32b;}})[_0x8be5('0x47')](function(_0x5d1f51){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d1f51);throw _0x5d1f51;});}return _0x7bb32b;})[_0x8be5('0x22')](respondWithResult(_0x3b254f,0xc9))[_0x8be5('0x47')](handleError(_0x3b254f,null));};exports[_0x8be5('0x51')]=function(_0x94a226,_0x277bf7){var _0xc7f0a7={'where':{'id':_0x94a226['params']['id']}},_0x318f7d={};_0x318f7d[_0x8be5('0x32')]=_['keys'](db[_0x8be5('0x2d')][_0x8be5('0x2e')]);_0xc7f0a7[_0x8be5('0x37')]=_['intersection'](_0x318f7d[_0x8be5('0x32')],qs[_0x8be5('0x38')](_0x94a226[_0x8be5('0x33')]['fields']));_0xc7f0a7[_0x8be5('0x37')]=_0xc7f0a7[_0x8be5('0x37')][_0x8be5('0x4a')]?_0xc7f0a7[_0x8be5('0x37')]:_0x318f7d[_0x8be5('0x32')];if(_0x94a226[_0x8be5('0x33')]['includeAll']){_0xc7f0a7[_0x8be5('0x44')]=[{'all':!![]}];}_0xc7f0a7=_[_0x8be5('0x40')]({},_0xc7f0a7,_0x94a226[_0x8be5('0x42')]);return db['JscriptyProject'][_0x8be5('0x4f')](_0xc7f0a7)['then'](handleEntityNotFound(_0x277bf7,null))['then'](function(_0x3ec87b){if(_0x3ec87b){var _0xaa04c=_0x3ec87b[_0x8be5('0x24')]({'plain':!![]});_0xaa04c=qs['omit'](_0xaa04c,['id','createdAt',_0x8be5('0x52')]);_0x94a226[_0x8be5('0x4c')]=_[_0x8be5('0x53')](_0x94a226[_0x8be5('0x4c')],['id','createdAt','updatedAt']);return db[_0x8be5('0x2d')][_0x8be5('0x4b')](_['merge'](_0xaa04c,_0x94a226[_0x8be5('0x4c')]),{'include':_0x94a226[_0x8be5('0x33')][_0x8be5('0x43')]?[{'all':!![]}]:undefined})[_0x8be5('0x22')](function(_0x226701){var _0x28ee56=_0x94a226[_0x8be5('0x4d')][_0x8be5('0x24')]({'plain':!![]});if(!_0x28ee56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28ee56[_0x8be5('0x4e')]==='user'){var _0x794b70=_0x226701[_0x8be5('0x24')]({'plain':!![]});var _0x4d9e0d='Projects';return db[_0x8be5('0x54')][_0x8be5('0x4f')]({'where':{'name':_0x4d9e0d,'userProfileId':_0x28ee56[_0x8be5('0x55')]},'raw':!![]})[_0x8be5('0x22')](function(_0x31dfd8){if(_0x31dfd8&&_0x31dfd8[_0x8be5('0x50')]===0x0){return db[_0x8be5('0x26')][_0x8be5('0x4b')]({'name':_0x794b70['name'],'resourceId':_0x794b70['id'],'type':_0x31dfd8[_0x8be5('0x29')],'sectionId':_0x31dfd8['id']},{})[_0x8be5('0x22')](function(){return _0x226701;});}else{return _0x226701;}})[_0x8be5('0x47')](function(_0x339315){logger['error'](_0x8be5('0x56'),_0x339315);throw _0x339315;});}return _0x226701;});}})['then'](respondWithResult(_0x277bf7,0xc9))[_0x8be5('0x47')](handleError(_0x277bf7,null));};exports[_0x8be5('0x21')]=function(_0x351484,_0x58cf0e){if(_0x351484['body']['id']){delete _0x351484[_0x8be5('0x4c')]['id'];}return db[_0x8be5('0x2d')]['find']({'where':{'id':_0x351484[_0x8be5('0x49')]['id']}})[_0x8be5('0x22')](handleEntityNotFound(_0x58cf0e,null))[_0x8be5('0x22')](saveUpdates(_0x351484[_0x8be5('0x4c')],null))[_0x8be5('0x22')](respondWithResult(_0x58cf0e,null))['catch'](handleError(_0x58cf0e,null));};exports[_0x8be5('0x23')]=function(_0x559608,_0x3a2ca5){return db[_0x8be5('0x2d')]['find']({'where':{'id':_0x559608[_0x8be5('0x49')]['id']}})[_0x8be5('0x22')](handleEntityNotFound(_0x3a2ca5,null))['then'](removeEntity(_0x3a2ca5,null))[_0x8be5('0x47')](handleError(_0x3a2ca5,null));};exports[_0x8be5('0x57')]=function(_0x128ab7,_0x58de0d,_0x15e13b){var _0x45749a={'raw':!![],'where':{}};var _0x470eb5={};var _0x1887a4={'count':0x0,'rows':[]};return db[_0x8be5('0x2d')][_0x8be5('0x58')]({'where':{'id':_0x128ab7['params']['id']}})[_0x8be5('0x22')](handleEntityNotFound(_0x58de0d,null))[_0x8be5('0x22')](function(_0x403df8){if(_0x403df8){_0x470eb5[_0x8be5('0x32')]=_[_0x8be5('0x34')](db[_0x8be5('0x59')][_0x8be5('0x2e')]);_0x470eb5[_0x8be5('0x33')]=_[_0x8be5('0x34')](_0x128ab7[_0x8be5('0x33')]);_0x470eb5[_0x8be5('0x35')]=_[_0x8be5('0x36')](_0x470eb5[_0x8be5('0x32')],_0x470eb5[_0x8be5('0x33')]);_0x45749a[_0x8be5('0x37')]=_[_0x8be5('0x36')](_0x470eb5['model'],qs[_0x8be5('0x38')](_0x128ab7['query'][_0x8be5('0x38')]));_0x45749a[_0x8be5('0x37')]=_0x45749a['attributes'][_0x8be5('0x4a')]?_0x45749a['attributes']:_0x470eb5['model'];if(!_0x128ab7[_0x8be5('0x33')]['hasOwnProperty'](_0x8be5('0x3a'))){_0x45749a[_0x8be5('0x1a')]=qs[_0x8be5('0x1a')](_0x128ab7[_0x8be5('0x33')][_0x8be5('0x1a')]);_0x45749a[_0x8be5('0x18')]=qs[_0x8be5('0x18')](_0x128ab7[_0x8be5('0x33')][_0x8be5('0x18')]);}_0x45749a[_0x8be5('0x3b')]=qs['sort'](_0x128ab7['query']['sort']);_0x45749a[_0x8be5('0x3d')]=qs[_0x8be5('0x35')](_['pick'](_0x128ab7[_0x8be5('0x33')],_0x470eb5[_0x8be5('0x35')]));_0x45749a[_0x8be5('0x3d')][_0x8be5('0x5a')]=_0x403df8['id'];if(_0x128ab7['query']['filter']){_0x45749a[_0x8be5('0x3d')]=_[_0x8be5('0x40')](_0x45749a[_0x8be5('0x3d')],{'$or':_[_0x8be5('0x2c')](_0x45749a[_0x8be5('0x37')],function(_0x34bafc){var _0x3d72e4={};_0x3d72e4[_0x34bafc]={'$like':'%'+_0x128ab7[_0x8be5('0x33')][_0x8be5('0x3f')]+'%'};return _0x3d72e4;})});}_0x45749a=_['merge']({},_0x45749a,_0x128ab7[_0x8be5('0x42')]);return db[_0x8be5('0x59')][_0x8be5('0x1b')]({'where':_0x45749a[_0x8be5('0x3d')]})[_0x8be5('0x22')](function(_0xdeb749){_0x1887a4[_0x8be5('0x1b')]=_0xdeb749;if(_0x128ab7['query']['includeAll']){_0x45749a[_0x8be5('0x44')]=[{'all':!![]}];}return db[_0x8be5('0x59')][_0x8be5('0x45')](_0x45749a);})['then'](function(_0x39b055){_0x1887a4[_0x8be5('0x46')]=_0x39b055;return _0x1887a4;});}})[_0x8be5('0x22')](respondWithFilteredResult(_0x58de0d,_0x45749a))[_0x8be5('0x47')](handleError(_0x58de0d,null));};exports['getAnswers']=function(_0x218665,_0x5eec62,_0x7c4b3b){var _0x7d0204={'raw':!![],'where':{}};var _0x14209a={};var _0x5b71df={'count':0x0,'rows':[]};return db[_0x8be5('0x2d')]['findOne']({'where':{'id':_0x218665[_0x8be5('0x49')]['id']}})[_0x8be5('0x22')](handleEntityNotFound(_0x5eec62,null))['then'](function(_0x58e270){if(_0x58e270){_0x14209a['model']=_[_0x8be5('0x34')](db['JscriptyAnswerReport'][_0x8be5('0x2e')]);_0x14209a[_0x8be5('0x33')]=_['keys'](_0x218665['query']);_0x14209a[_0x8be5('0x35')]=_['intersection'](_0x14209a[_0x8be5('0x32')],_0x14209a['query']);_0x7d0204[_0x8be5('0x37')]=_[_0x8be5('0x36')](_0x14209a[_0x8be5('0x32')],qs[_0x8be5('0x38')](_0x218665[_0x8be5('0x33')][_0x8be5('0x38')]));_0x7d0204[_0x8be5('0x37')]=_0x7d0204[_0x8be5('0x37')]['length']?_0x7d0204[_0x8be5('0x37')]:_0x14209a[_0x8be5('0x32')];if(!_0x218665[_0x8be5('0x33')][_0x8be5('0x39')](_0x8be5('0x3a'))){_0x7d0204[_0x8be5('0x1a')]=qs[_0x8be5('0x1a')](_0x218665['query']['limit']);_0x7d0204[_0x8be5('0x18')]=qs['offset'](_0x218665[_0x8be5('0x33')][_0x8be5('0x18')]);}_0x7d0204[_0x8be5('0x3b')]=qs[_0x8be5('0x3c')](_0x218665[_0x8be5('0x33')][_0x8be5('0x3c')]);_0x7d0204[_0x8be5('0x3d')]=qs[_0x8be5('0x35')](_[_0x8be5('0x3e')](_0x218665['query'],_0x14209a[_0x8be5('0x35')]));_0x7d0204['where']['ProjectId']=_0x58e270['id'];if(_0x218665[_0x8be5('0x33')][_0x8be5('0x3f')]){_0x7d0204[_0x8be5('0x3d')]=_[_0x8be5('0x40')](_0x7d0204['where'],{'$or':_[_0x8be5('0x2c')](_0x7d0204[_0x8be5('0x37')],function(_0x4552fb){var _0x50609e={};_0x50609e[_0x4552fb]={'$like':'%'+_0x218665[_0x8be5('0x33')][_0x8be5('0x3f')]+'%'};return _0x50609e;})});}_0x7d0204=_[_0x8be5('0x40')]({},_0x7d0204,_0x218665[_0x8be5('0x42')]);return db[_0x8be5('0x5b')]['count']({'where':_0x7d0204[_0x8be5('0x3d')]})['then'](function(_0x54c9da){_0x5b71df['count']=_0x54c9da;if(_0x218665[_0x8be5('0x33')]['includeAll']){_0x7d0204[_0x8be5('0x44')]=[{'all':!![]}];}return db[_0x8be5('0x5b')][_0x8be5('0x45')](_0x7d0204);})[_0x8be5('0x22')](function(_0x160743){_0x5b71df[_0x8be5('0x46')]=_0x160743;return _0x5b71df;});}})[_0x8be5('0x22')](respondWithFilteredResult(_0x5eec62,_0x7d0204))[_0x8be5('0x47')](handleError(_0x5eec62,null));};function char(_0x2ba91d){return _0x8be5('0x5c')===typeof _0x2ba91d?String[_0x8be5('0x5d')][_0x8be5('0x1e')](null,arguments):_0x2ba91d;}function needsEncapsulation(_0x9b716b){return!!_0x9b716b&&(_0x9b716b[_0x8be5('0x5e')]()[_0x8be5('0x5f')](char(0xd))>=0x0||_0x9b716b[_0x8be5('0x5e')]()[_0x8be5('0x5f')](char(0xa))>=0x0||_0x9b716b[_0x8be5('0x5e')]()[_0x8be5('0x5f')](char(0x2c))>=0x0||_0x9b716b[_0x8be5('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4f81b2){var _0xab00de=char(0x22),_0x5f03bc='\x5c'+char(0x22),_0x52d48=_0x4f81b2[_0x8be5('0x5e')]()['replace'](new RegExp(_0xab00de,'g'),_0x5f03bc);return _0xab00de+_0x52d48+_0xab00de;}exports[_0x8be5('0x60')]=function(_0xa39da9,_0x5d70f1,_0x55b71d){var _0x2f470f,_0x4f6924;var _0x386e74={'where':{'ProjectId':_0xa39da9[_0x8be5('0x49')]['id']}};if(_0xa39da9[_0x8be5('0x33')][_0x8be5('0x61')]){_0x386e74['where'][_0x8be5('0x62')]=JSON[_0x8be5('0x63')](_0xa39da9[_0x8be5('0x33')]['startTime']);}return db[_0x8be5('0x59')]['findAll'](_0x386e74)[_0x8be5('0x22')](handleEntityNotFound(_0x5d70f1,null))[_0x8be5('0x22')](function(_0x45de75){if(_0x45de75){_0x2f470f=_0x45de75;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x8be5('0x2c')](_0x2f470f,'id')},'ProjectId':_0xa39da9[_0x8be5('0x49')]['id']},'order':_0x8be5('0x64')});}})[_0x8be5('0x22')](handleEntityNotFound(_0x5d70f1,null))[_0x8be5('0x22')](function(_0xd536d9){if(_0xd536d9){_0x4f6924=_0xd536d9;var _0xc08657={};for(var _0x280d43=0x0,_0x2d8d5c=_0x4f6924['length'];_0x280d43<_0x2d8d5c;_0x280d43++){if(!_0xc08657[_0x8be5('0x39')](_0x4f6924[_0x280d43]['questionId'])){_0xc08657[_0x4f6924[_0x280d43][_0x8be5('0x65')]]=needsEncapsulation(_0x4f6924[_0x280d43][_0x8be5('0x66')])?encapsulate(_0x4f6924[_0x280d43][_0x8be5('0x66')]):_0x4f6924[_0x280d43][_0x8be5('0x66')];}}var _0xa788e4=[],_0x2706a9={};for(var _0xecf5b6=0x0,_0x427698=_0x2f470f[_0x8be5('0x4a')];_0xecf5b6<_0x427698;_0xecf5b6++){_0x2706a9={'ProjectId':_0xa39da9[_0x8be5('0x49')]['id'],'SessionId':_0x2f470f[_0xecf5b6]['id'],'StartTime':moment(_0x2f470f[_0xecf5b6][_0x8be5('0x62')])[_0x8be5('0x67')](_0x8be5('0x68'))};for(var _0x1b5e5f=0x0,_0x38cd78=_0x4f6924[_0x8be5('0x4a')];_0x1b5e5f<_0x38cd78;_0x1b5e5f++){if(_0x4f6924[_0x1b5e5f]['SessionId']==_0x2f470f[_0xecf5b6]['id']&&_0xc08657[_0x8be5('0x39')](_0x4f6924[_0x1b5e5f][_0x8be5('0x65')])){_0x2706a9[_0xc08657[_0x4f6924[_0x1b5e5f][_0x8be5('0x65')]]]=_0x4f6924[_0x1b5e5f]['answer'];}}for(var _0x3bece5 in _0xc08657){if(!_0x2706a9['hasOwnProperty'](_0xc08657[_0x3bece5])){_0x2706a9[_0xc08657[_0x3bece5]]=null;}}_0xa788e4['push'](_0x2706a9);}return _0xa788e4;}})[_0x8be5('0x22')](function(_0x39411d){if(!_[_0x8be5('0x69')](_0x39411d)){var _0x5582cf=toCsv(_0x39411d);var _0x49dbb9=Date[_0x8be5('0x6a')]();fs[_0x8be5('0x6b')](util[_0x8be5('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xa39da9['params']['id'],_0x49dbb9),_0x5582cf);_0x5d70f1[_0x8be5('0x6c')](_0x8be5('0x6d'),_0x8be5('0x6e')+util[_0x8be5('0x67')]('Jscripty_Project_%d_Summary_%s.csv',_0xa39da9['params']['id'],_0x49dbb9));_0x5d70f1[_0x8be5('0x6c')]('Content-type',_0x8be5('0x6f'));return _0x5d70f1[_0x8be5('0x70')](util[_0x8be5('0x67')](_0x8be5('0x71'),_0xa39da9[_0x8be5('0x49')]['id'],_0x49dbb9));}else{return _0x5d70f1[_0x8be5('0x15')](0xcc);}})[_0x8be5('0x47')](handleError(_0x5d70f1,null));}; \ No newline at end of file +var _0xcdd0=['map','JscriptyProject','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','include','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','body','getSessions','order','ProjectId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcdd0,0xbd));var _0x0cdd=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xcdd0[_0x59c301];return _0x3866b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0cdd('0x0'));var zipdir=require(_0x0cdd('0x1'));var jsonpatch=require(_0x0cdd('0x2'));var rp=require(_0x0cdd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0cdd('0x4'));var util=require(_0x0cdd('0x5'));var path=require(_0x0cdd('0x6'));var sox=require(_0x0cdd('0x7'));var csv=require(_0x0cdd('0x8'));var ejs=require(_0x0cdd('0x9'));var fs=require('fs');var fs_extra=require(_0x0cdd('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0cdd('0xb'));var deskjs=require(_0x0cdd('0xc'));var toCsv=require(_0x0cdd('0x8'));var querystring=require(_0x0cdd('0xd'));var Papa=require(_0x0cdd('0xe'));var Redis=require(_0x0cdd('0xf'));var authService=require(_0x0cdd('0x10'));var qs=require(_0x0cdd('0x11'));var as=require(_0x0cdd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0cdd('0x13'));var utils=require(_0x0cdd('0x14'));var config=require(_0x0cdd('0x15'));var licenseUtil=require(_0x0cdd('0x16'));var db=require(_0x0cdd('0x17'))['db'];function respondWithStatusCode(_0x95134f,_0x5b73cf){_0x5b73cf=_0x5b73cf||0xcc;return function(_0x202d66){if(_0x202d66){return _0x95134f[_0x0cdd('0x18')](_0x5b73cf);}return _0x95134f[_0x0cdd('0x19')](_0x5b73cf)[_0x0cdd('0x1a')]();};}function respondWithResult(_0x294eb9,_0x2ee25a){_0x2ee25a=_0x2ee25a||0xc8;return function(_0x3b650e){if(_0x3b650e){return _0x294eb9[_0x0cdd('0x19')](_0x2ee25a)[_0x0cdd('0x1b')](_0x3b650e);}};}function respondWithFilteredResult(_0xd5cd92,_0x46d3f8){return function(_0x4eccdf){if(_0x4eccdf){var _0x58b910=typeof _0x46d3f8[_0x0cdd('0x1c')]==='undefined'&&typeof _0x46d3f8['limit']==='undefined';var _0x16c598=_0x4eccdf[_0x0cdd('0x1d')];var _0xa32aa6=_0x58b910?0x0:_0x46d3f8[_0x0cdd('0x1c')];var _0x172eac=_0x58b910?_0x4eccdf[_0x0cdd('0x1d')]:_0x46d3f8[_0x0cdd('0x1c')]+_0x46d3f8['limit'];var _0x1c0d45;if(_0x172eac>=_0x16c598){_0x172eac=_0x16c598;_0x1c0d45=0xc8;}else{_0x1c0d45=0xce;}_0xd5cd92['status'](_0x1c0d45);return _0xd5cd92[_0x0cdd('0x1e')](_0x0cdd('0x1f'),_0xa32aa6+'-'+_0x172eac+'/'+_0x16c598)[_0x0cdd('0x1b')](_0x4eccdf);}return null;};}function patchUpdates(_0x439013){return function(_0x3cc52a){try{jsonpatch[_0x0cdd('0x20')](_0x3cc52a,_0x439013,!![]);}catch(_0x5e636b){return BPromise[_0x0cdd('0x21')](_0x5e636b);}return _0x3cc52a[_0x0cdd('0x22')]();};}function saveUpdates(_0x301d64,_0x5eb5ad){return function(_0x55c89d){if(_0x55c89d){return _0x55c89d['update'](_0x301d64)[_0x0cdd('0x23')](function(_0x2bcb58){return _0x2bcb58;});}return null;};}function removeEntity(_0x338aef,_0x1785c6){return function(_0x233e44){if(_0x233e44){return _0x233e44[_0x0cdd('0x24')]()[_0x0cdd('0x23')](function(){var _0x122bcb=_0x233e44['get']({'plain':!![]});var _0x59a0a6='Projects';return db[_0x0cdd('0x25')][_0x0cdd('0x24')]({'where':{'type':_0x59a0a6,'resourceId':_0x122bcb['id']}})['then'](function(){return _0x233e44;});})['then'](function(){_0x338aef['status'](0xcc)[_0x0cdd('0x1a')]();});}};}function handleEntityNotFound(_0x39c489,_0x3185b8){return function(_0x34534d){if(!_0x34534d){_0x39c489['sendStatus'](0x194);}return _0x34534d;};}function handleError(_0x3021ed,_0x4aa2d0){_0x4aa2d0=_0x4aa2d0||0x1f4;return function(_0x21ad5e){logger[_0x0cdd('0x26')](_0x21ad5e[_0x0cdd('0x27')]);if(_0x21ad5e[_0x0cdd('0x28')]){delete _0x21ad5e[_0x0cdd('0x28')];}_0x3021ed['status'](_0x4aa2d0)[_0x0cdd('0x29')](_0x21ad5e);};}exports[_0x0cdd('0x2a')]=function(_0x2b6296,_0x10e09c){var _0x3c6ffd={},_0x52ce64={},_0x47300f={'count':0x0,'rows':[]};var _0x551bc4=_[_0x0cdd('0x2b')](db[_0x0cdd('0x2c')][_0x0cdd('0x2d')],function(_0x31cd52){return{'name':_0x31cd52['fieldName'],'type':_0x31cd52[_0x0cdd('0x2e')][_0x0cdd('0x2f')]};});_0x52ce64['model']=_[_0x0cdd('0x2b')](_0x551bc4,_0x0cdd('0x28'));_0x52ce64[_0x0cdd('0x30')]=_[_0x0cdd('0x31')](_0x2b6296[_0x0cdd('0x30')]);_0x52ce64[_0x0cdd('0x32')]=_[_0x0cdd('0x33')](_0x52ce64[_0x0cdd('0x34')],_0x52ce64[_0x0cdd('0x30')]);_0x3c6ffd[_0x0cdd('0x35')]=_[_0x0cdd('0x33')](_0x52ce64[_0x0cdd('0x34')],qs['fields'](_0x2b6296[_0x0cdd('0x30')][_0x0cdd('0x36')]));_0x3c6ffd[_0x0cdd('0x35')]=_0x3c6ffd['attributes'][_0x0cdd('0x37')]?_0x3c6ffd['attributes']:_0x52ce64['model'];if(!_0x2b6296[_0x0cdd('0x30')][_0x0cdd('0x38')](_0x0cdd('0x39'))){_0x3c6ffd[_0x0cdd('0x3a')]=qs['limit'](_0x2b6296['query']['limit']);_0x3c6ffd['offset']=qs[_0x0cdd('0x1c')](_0x2b6296[_0x0cdd('0x30')][_0x0cdd('0x1c')]);}_0x3c6ffd['order']=qs[_0x0cdd('0x3b')](_0x2b6296[_0x0cdd('0x30')]['sort']);_0x3c6ffd['where']=qs[_0x0cdd('0x32')](_[_0x0cdd('0x3c')](_0x2b6296[_0x0cdd('0x30')],_0x52ce64[_0x0cdd('0x32')]),_0x551bc4);if(_0x2b6296[_0x0cdd('0x30')][_0x0cdd('0x3d')]){_0x3c6ffd[_0x0cdd('0x3e')]=_[_0x0cdd('0x3f')](_0x3c6ffd[_0x0cdd('0x3e')],{'$or':_[_0x0cdd('0x2b')](_0x551bc4,function(_0x9b8ad1){if(_0x9b8ad1['type']!=='VIRTUAL'){var _0x9dc920={};_0x9dc920[_0x9b8ad1[_0x0cdd('0x28')]]={'$like':'%'+_0x2b6296['query'][_0x0cdd('0x3d')]+'%'};return _0x9dc920;}})});}_0x3c6ffd=_[_0x0cdd('0x3f')]({},_0x3c6ffd,_0x2b6296[_0x0cdd('0x40')]);var _0xc30df1={'where':_0x3c6ffd[_0x0cdd('0x3e')]};return db[_0x0cdd('0x2c')]['count'](_0xc30df1)[_0x0cdd('0x23')](function(_0x185079){_0x47300f[_0x0cdd('0x1d')]=_0x185079;if(_0x2b6296[_0x0cdd('0x30')][_0x0cdd('0x41')]){_0x3c6ffd['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x0cdd('0x42')](_0x3c6ffd);})[_0x0cdd('0x23')](function(_0x12fceb){_0x47300f[_0x0cdd('0x43')]=_0x12fceb;return _0x47300f;})[_0x0cdd('0x23')](respondWithFilteredResult(_0x10e09c,_0x3c6ffd))['catch'](handleError(_0x10e09c,null));};exports[_0x0cdd('0x44')]=function(_0x21fc5d,_0x49288e){var _0xe433b={'raw':![],'where':{'id':_0x21fc5d[_0x0cdd('0x45')]['id']}},_0x52aba3={};_0x52aba3[_0x0cdd('0x34')]=_[_0x0cdd('0x31')](db[_0x0cdd('0x2c')]['rawAttributes']);_0x52aba3[_0x0cdd('0x30')]=_['keys'](_0x21fc5d['query']);_0x52aba3[_0x0cdd('0x32')]=_['intersection'](_0x52aba3['model'],_0x52aba3[_0x0cdd('0x30')]);_0xe433b[_0x0cdd('0x35')]=_[_0x0cdd('0x33')](_0x52aba3[_0x0cdd('0x34')],qs[_0x0cdd('0x36')](_0x21fc5d[_0x0cdd('0x30')][_0x0cdd('0x36')]));_0xe433b[_0x0cdd('0x35')]=_0xe433b[_0x0cdd('0x35')][_0x0cdd('0x37')]?_0xe433b[_0x0cdd('0x35')]:_0x52aba3[_0x0cdd('0x34')];if(_0x21fc5d[_0x0cdd('0x30')]['includeAll']){_0xe433b[_0x0cdd('0x46')]=[{'all':!![]}];}_0xe433b=_[_0x0cdd('0x3f')]({},_0xe433b,_0x21fc5d['options']);return db['JscriptyProject']['find'](_0xe433b)[_0x0cdd('0x23')](handleEntityNotFound(_0x49288e,null))[_0x0cdd('0x23')](respondWithResult(_0x49288e,null))[_0x0cdd('0x47')](handleError(_0x49288e,null));};exports[_0x0cdd('0x48')]=function(_0x298204,_0x6d0518){return db[_0x0cdd('0x2c')][_0x0cdd('0x48')](_0x298204['body'],{})[_0x0cdd('0x23')](function(_0x4bd513){var _0x333678=_0x298204[_0x0cdd('0x49')][_0x0cdd('0x4a')]({'plain':!![]});if(!_0x333678)throw new Error(_0x0cdd('0x4b'));if(_0x333678[_0x0cdd('0x4c')]===_0x0cdd('0x49')){var _0x2b403a=_0x4bd513[_0x0cdd('0x4a')]({'plain':!![]});var _0x50523b=_0x0cdd('0x4d');return db[_0x0cdd('0x4e')][_0x0cdd('0x4f')]({'where':{'name':_0x50523b,'userProfileId':_0x333678[_0x0cdd('0x50')]},'raw':!![]})[_0x0cdd('0x23')](function(_0x1e514b){if(_0x1e514b&&_0x1e514b[_0x0cdd('0x51')]===0x0){return db['UserProfileResource'][_0x0cdd('0x48')]({'name':_0x2b403a['name'],'resourceId':_0x2b403a['id'],'type':_0x1e514b[_0x0cdd('0x28')],'sectionId':_0x1e514b['id']},{})[_0x0cdd('0x23')](function(){return _0x4bd513;});}else{return _0x4bd513;}})['catch'](function(_0x17c507){logger[_0x0cdd('0x26')](_0x0cdd('0x52'),_0x17c507);throw _0x17c507;});}return _0x4bd513;})[_0x0cdd('0x23')](respondWithResult(_0x6d0518,0xc9))['catch'](handleError(_0x6d0518,null));};exports['clone']=function(_0x24f4ea,_0xf80dc3){var _0x50c27c={'where':{'id':_0x24f4ea[_0x0cdd('0x45')]['id']}},_0x969106={};_0x969106[_0x0cdd('0x34')]=_[_0x0cdd('0x31')](db[_0x0cdd('0x2c')][_0x0cdd('0x2d')]);_0x50c27c['attributes']=_[_0x0cdd('0x33')](_0x969106[_0x0cdd('0x34')],qs[_0x0cdd('0x36')](_0x24f4ea['query'][_0x0cdd('0x36')]));_0x50c27c[_0x0cdd('0x35')]=_0x50c27c[_0x0cdd('0x35')][_0x0cdd('0x37')]?_0x50c27c[_0x0cdd('0x35')]:_0x969106['model'];if(_0x24f4ea[_0x0cdd('0x30')][_0x0cdd('0x41')]){_0x50c27c[_0x0cdd('0x46')]=[{'all':!![]}];}_0x50c27c=_[_0x0cdd('0x3f')]({},_0x50c27c,_0x24f4ea[_0x0cdd('0x40')]);return db[_0x0cdd('0x2c')][_0x0cdd('0x4f')](_0x50c27c)['then'](handleEntityNotFound(_0xf80dc3,null))[_0x0cdd('0x23')](function(_0x21efd4){if(_0x21efd4){var _0x1abf36=_0x21efd4[_0x0cdd('0x4a')]({'plain':!![]});_0x1abf36=qs[_0x0cdd('0x53')](_0x1abf36,['id',_0x0cdd('0x54'),'updatedAt']);_0x24f4ea[_0x0cdd('0x55')]=_[_0x0cdd('0x53')](_0x24f4ea['body'],['id',_0x0cdd('0x54'),'updatedAt']);return db['JscriptyProject'][_0x0cdd('0x48')](_[_0x0cdd('0x3f')](_0x1abf36,_0x24f4ea[_0x0cdd('0x55')]),{'include':_0x24f4ea[_0x0cdd('0x30')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x397cbb){var _0x4ac127=_0x24f4ea[_0x0cdd('0x49')]['get']({'plain':!![]});if(!_0x4ac127)throw new Error(_0x0cdd('0x4b'));if(_0x4ac127[_0x0cdd('0x4c')]==='user'){var _0x568139=_0x397cbb[_0x0cdd('0x4a')]({'plain':!![]});var _0x232838='Projects';return db[_0x0cdd('0x4e')][_0x0cdd('0x4f')]({'where':{'name':_0x232838,'userProfileId':_0x4ac127[_0x0cdd('0x50')]},'raw':!![]})[_0x0cdd('0x23')](function(_0x55db32){if(_0x55db32&&_0x55db32[_0x0cdd('0x51')]===0x0){return db[_0x0cdd('0x25')][_0x0cdd('0x48')]({'name':_0x568139[_0x0cdd('0x28')],'resourceId':_0x568139['id'],'type':_0x55db32[_0x0cdd('0x28')],'sectionId':_0x55db32['id']},{})['then'](function(){return _0x397cbb;});}else{return _0x397cbb;}})[_0x0cdd('0x47')](function(_0x41aee0){logger[_0x0cdd('0x26')](_0x0cdd('0x52'),_0x41aee0);throw _0x41aee0;});}return _0x397cbb;});}})[_0x0cdd('0x23')](respondWithResult(_0xf80dc3,0xc9))[_0x0cdd('0x47')](handleError(_0xf80dc3,null));};exports['update']=function(_0x4cea31,_0x283ff0){if(_0x4cea31[_0x0cdd('0x55')]['id']){delete _0x4cea31[_0x0cdd('0x55')]['id'];}return db[_0x0cdd('0x2c')]['find']({'where':{'id':_0x4cea31[_0x0cdd('0x45')]['id']}})[_0x0cdd('0x23')](handleEntityNotFound(_0x283ff0,null))[_0x0cdd('0x23')](saveUpdates(_0x4cea31[_0x0cdd('0x55')],null))[_0x0cdd('0x23')](respondWithResult(_0x283ff0,null))['catch'](handleError(_0x283ff0,null));};exports['destroy']=function(_0x2fa508,_0x59f8a1){return db[_0x0cdd('0x2c')][_0x0cdd('0x4f')]({'where':{'id':_0x2fa508[_0x0cdd('0x45')]['id']}})[_0x0cdd('0x23')](handleEntityNotFound(_0x59f8a1,null))[_0x0cdd('0x23')](removeEntity(_0x59f8a1,null))[_0x0cdd('0x47')](handleError(_0x59f8a1,null));};exports[_0x0cdd('0x56')]=function(_0x59a9d9,_0x3ff6d5,_0x501571){var _0x1400df={'raw':!![],'where':{}};var _0x2ae116={};var _0x4714ce={'count':0x0,'rows':[]};return db[_0x0cdd('0x2c')]['findOne']({'where':{'id':_0x59a9d9[_0x0cdd('0x45')]['id']}})[_0x0cdd('0x23')](handleEntityNotFound(_0x3ff6d5,null))['then'](function(_0x1bbd4f){if(_0x1bbd4f){_0x2ae116[_0x0cdd('0x34')]=_[_0x0cdd('0x31')](db['JscriptySessionReport'][_0x0cdd('0x2d')]);_0x2ae116[_0x0cdd('0x30')]=_[_0x0cdd('0x31')](_0x59a9d9[_0x0cdd('0x30')]);_0x2ae116[_0x0cdd('0x32')]=_[_0x0cdd('0x33')](_0x2ae116[_0x0cdd('0x34')],_0x2ae116[_0x0cdd('0x30')]);_0x1400df[_0x0cdd('0x35')]=_[_0x0cdd('0x33')](_0x2ae116[_0x0cdd('0x34')],qs[_0x0cdd('0x36')](_0x59a9d9[_0x0cdd('0x30')][_0x0cdd('0x36')]));_0x1400df[_0x0cdd('0x35')]=_0x1400df[_0x0cdd('0x35')]['length']?_0x1400df[_0x0cdd('0x35')]:_0x2ae116[_0x0cdd('0x34')];if(!_0x59a9d9[_0x0cdd('0x30')][_0x0cdd('0x38')](_0x0cdd('0x39'))){_0x1400df[_0x0cdd('0x3a')]=qs[_0x0cdd('0x3a')](_0x59a9d9[_0x0cdd('0x30')][_0x0cdd('0x3a')]);_0x1400df[_0x0cdd('0x1c')]=qs['offset'](_0x59a9d9[_0x0cdd('0x30')]['offset']);}_0x1400df[_0x0cdd('0x57')]=qs[_0x0cdd('0x3b')](_0x59a9d9[_0x0cdd('0x30')][_0x0cdd('0x3b')]);_0x1400df[_0x0cdd('0x3e')]=qs['filters'](_[_0x0cdd('0x3c')](_0x59a9d9[_0x0cdd('0x30')],_0x2ae116['filters']));_0x1400df[_0x0cdd('0x3e')][_0x0cdd('0x58')]=_0x1bbd4f['id'];if(_0x59a9d9[_0x0cdd('0x30')][_0x0cdd('0x3d')]){_0x1400df['where']=_['merge'](_0x1400df['where'],{'$or':_['map'](_0x1400df['attributes'],function(_0x2cd38c){var _0x40890a={};_0x40890a[_0x2cd38c]={'$like':'%'+_0x59a9d9[_0x0cdd('0x30')][_0x0cdd('0x3d')]+'%'};return _0x40890a;})});}_0x1400df=_[_0x0cdd('0x3f')]({},_0x1400df,_0x59a9d9['options']);return db[_0x0cdd('0x59')][_0x0cdd('0x1d')]({'where':_0x1400df['where']})[_0x0cdd('0x23')](function(_0x29321c){_0x4714ce['count']=_0x29321c;if(_0x59a9d9[_0x0cdd('0x30')][_0x0cdd('0x41')]){_0x1400df['include']=[{'all':!![]}];}return db[_0x0cdd('0x59')][_0x0cdd('0x42')](_0x1400df);})['then'](function(_0x2261c8){_0x4714ce[_0x0cdd('0x43')]=_0x2261c8;return _0x4714ce;});}})[_0x0cdd('0x23')](respondWithFilteredResult(_0x3ff6d5,_0x1400df))['catch'](handleError(_0x3ff6d5,null));};exports[_0x0cdd('0x5a')]=function(_0x368727,_0x500307,_0x58b1c9){var _0x3b51b5={'raw':!![],'where':{}};var _0x2c3aa1={};var _0x273500={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0cdd('0x5b')]({'where':{'id':_0x368727['params']['id']}})['then'](handleEntityNotFound(_0x500307,null))['then'](function(_0xf0831f){if(_0xf0831f){_0x2c3aa1['model']=_[_0x0cdd('0x31')](db[_0x0cdd('0x5c')][_0x0cdd('0x2d')]);_0x2c3aa1['query']=_[_0x0cdd('0x31')](_0x368727[_0x0cdd('0x30')]);_0x2c3aa1[_0x0cdd('0x32')]=_[_0x0cdd('0x33')](_0x2c3aa1[_0x0cdd('0x34')],_0x2c3aa1['query']);_0x3b51b5[_0x0cdd('0x35')]=_[_0x0cdd('0x33')](_0x2c3aa1[_0x0cdd('0x34')],qs[_0x0cdd('0x36')](_0x368727[_0x0cdd('0x30')]['fields']));_0x3b51b5[_0x0cdd('0x35')]=_0x3b51b5[_0x0cdd('0x35')][_0x0cdd('0x37')]?_0x3b51b5[_0x0cdd('0x35')]:_0x2c3aa1[_0x0cdd('0x34')];if(!_0x368727[_0x0cdd('0x30')][_0x0cdd('0x38')](_0x0cdd('0x39'))){_0x3b51b5[_0x0cdd('0x3a')]=qs[_0x0cdd('0x3a')](_0x368727[_0x0cdd('0x30')][_0x0cdd('0x3a')]);_0x3b51b5[_0x0cdd('0x1c')]=qs[_0x0cdd('0x1c')](_0x368727[_0x0cdd('0x30')][_0x0cdd('0x1c')]);}_0x3b51b5[_0x0cdd('0x57')]=qs['sort'](_0x368727[_0x0cdd('0x30')][_0x0cdd('0x3b')]);_0x3b51b5[_0x0cdd('0x3e')]=qs[_0x0cdd('0x32')](_[_0x0cdd('0x3c')](_0x368727[_0x0cdd('0x30')],_0x2c3aa1[_0x0cdd('0x32')]));_0x3b51b5[_0x0cdd('0x3e')][_0x0cdd('0x58')]=_0xf0831f['id'];if(_0x368727[_0x0cdd('0x30')][_0x0cdd('0x3d')]){_0x3b51b5[_0x0cdd('0x3e')]=_['merge'](_0x3b51b5['where'],{'$or':_['map'](_0x3b51b5['attributes'],function(_0x40e058){var _0x492b5b={};_0x492b5b[_0x40e058]={'$like':'%'+_0x368727[_0x0cdd('0x30')][_0x0cdd('0x3d')]+'%'};return _0x492b5b;})});}_0x3b51b5=_[_0x0cdd('0x3f')]({},_0x3b51b5,_0x368727[_0x0cdd('0x40')]);return db[_0x0cdd('0x5c')][_0x0cdd('0x1d')]({'where':_0x3b51b5[_0x0cdd('0x3e')]})[_0x0cdd('0x23')](function(_0x4474a0){_0x273500[_0x0cdd('0x1d')]=_0x4474a0;if(_0x368727[_0x0cdd('0x30')][_0x0cdd('0x41')]){_0x3b51b5[_0x0cdd('0x46')]=[{'all':!![]}];}return db[_0x0cdd('0x5c')]['findAll'](_0x3b51b5);})[_0x0cdd('0x23')](function(_0xb8fbd5){_0x273500[_0x0cdd('0x43')]=_0xb8fbd5;return _0x273500;});}})[_0x0cdd('0x23')](respondWithFilteredResult(_0x500307,_0x3b51b5))['catch'](handleError(_0x500307,null));};function char(_0x52cb64){return _0x0cdd('0x5d')===typeof _0x52cb64?String[_0x0cdd('0x5e')][_0x0cdd('0x20')](null,arguments):_0x52cb64;}function needsEncapsulation(_0x489db8){return!!_0x489db8&&(_0x489db8[_0x0cdd('0x5f')]()[_0x0cdd('0x60')](char(0xd))>=0x0||_0x489db8[_0x0cdd('0x5f')]()[_0x0cdd('0x60')](char(0xa))>=0x0||_0x489db8[_0x0cdd('0x5f')]()[_0x0cdd('0x60')](char(0x2c))>=0x0||_0x489db8[_0x0cdd('0x5f')]()[_0x0cdd('0x60')](char(0x22))>=0x0);}function encapsulate(_0x40b3c3){var _0x4a084a=char(0x22),_0x7da3b0='\x5c'+char(0x22),_0x1df0f4=_0x40b3c3[_0x0cdd('0x5f')]()['replace'](new RegExp(_0x4a084a,'g'),_0x7da3b0);return _0x4a084a+_0x1df0f4+_0x4a084a;}exports['getSummary']=function(_0x29dc44,_0xeaf0a9,_0x4fd1a4){var _0x4cc8dd,_0x127c1c;var _0x18496f={'where':{'ProjectId':_0x29dc44[_0x0cdd('0x45')]['id']}};if(_0x29dc44[_0x0cdd('0x30')][_0x0cdd('0x61')]){_0x18496f[_0x0cdd('0x3e')][_0x0cdd('0x62')]=JSON[_0x0cdd('0x63')](_0x29dc44[_0x0cdd('0x30')][_0x0cdd('0x61')]);}return db[_0x0cdd('0x59')][_0x0cdd('0x42')](_0x18496f)[_0x0cdd('0x23')](handleEntityNotFound(_0xeaf0a9,null))[_0x0cdd('0x23')](function(_0x3263e2){if(_0x3263e2){_0x4cc8dd=_0x3263e2;return db[_0x0cdd('0x64')][_0x0cdd('0x42')]({'where':{'SessionId':{'$in':_['map'](_0x4cc8dd,'id')},'ProjectId':_0x29dc44[_0x0cdd('0x45')]['id']},'order':'-createdAt'});}})[_0x0cdd('0x23')](handleEntityNotFound(_0xeaf0a9,null))[_0x0cdd('0x23')](function(_0x52b604){if(_0x52b604){_0x127c1c=_0x52b604;var _0x29b0ea={};for(var _0x1f78fc=0x0,_0x385346=_0x127c1c[_0x0cdd('0x37')];_0x1f78fc<_0x385346;_0x1f78fc++){if(!_0x29b0ea[_0x0cdd('0x38')](_0x127c1c[_0x1f78fc][_0x0cdd('0x65')])){_0x29b0ea[_0x127c1c[_0x1f78fc][_0x0cdd('0x65')]]=needsEncapsulation(_0x127c1c[_0x1f78fc]['question'])?encapsulate(_0x127c1c[_0x1f78fc][_0x0cdd('0x66')]):_0x127c1c[_0x1f78fc][_0x0cdd('0x66')];}}var _0x1b477e=[],_0x301dd0={};for(var _0x5449e4=0x0,_0xe67ea=_0x4cc8dd[_0x0cdd('0x37')];_0x5449e4<_0xe67ea;_0x5449e4++){_0x301dd0={'ProjectId':_0x29dc44['params']['id'],'SessionId':_0x4cc8dd[_0x5449e4]['id'],'StartTime':moment(_0x4cc8dd[_0x5449e4][_0x0cdd('0x62')])[_0x0cdd('0x67')](_0x0cdd('0x68'))};for(var _0x20b845=0x0,_0x31ab81=_0x127c1c[_0x0cdd('0x37')];_0x20b845<_0x31ab81;_0x20b845++){if(_0x127c1c[_0x20b845][_0x0cdd('0x69')]==_0x4cc8dd[_0x5449e4]['id']&&_0x29b0ea[_0x0cdd('0x38')](_0x127c1c[_0x20b845]['questionId'])){_0x301dd0[_0x29b0ea[_0x127c1c[_0x20b845]['questionId']]]=_0x127c1c[_0x20b845][_0x0cdd('0x6a')];}}for(var _0x1dd709 in _0x29b0ea){if(!_0x301dd0[_0x0cdd('0x38')](_0x29b0ea[_0x1dd709])){_0x301dd0[_0x29b0ea[_0x1dd709]]=null;}}_0x1b477e['push'](_0x301dd0);}return _0x1b477e;}})['then'](function(_0x5d17f7){if(!_['isEmpty'](_0x5d17f7)){var _0x284c0a=toCsv(_0x5d17f7);var _0x4f197c=Date[_0x0cdd('0x6b')]();fs[_0x0cdd('0x6c')](util[_0x0cdd('0x67')](_0x0cdd('0x6d'),_0x29dc44[_0x0cdd('0x45')]['id'],_0x4f197c),_0x284c0a);_0xeaf0a9[_0x0cdd('0x6e')](_0x0cdd('0x6f'),_0x0cdd('0x70')+util['format'](_0x0cdd('0x71'),_0x29dc44[_0x0cdd('0x45')]['id'],_0x4f197c));_0xeaf0a9[_0x0cdd('0x6e')]('Content-type',_0x0cdd('0x72'));return _0xeaf0a9[_0x0cdd('0x73')](util['format'](_0x0cdd('0x6d'),_0x29dc44[_0x0cdd('0x45')]['id'],_0x4f197c));}else{return _0xeaf0a9['sendStatus'](0xcc);}})['catch'](handleError(_0xeaf0a9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 13d37a0..43382d7 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 _0xf0ba=['jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','JscriptyProject'];(function(_0x5c58ab,_0x434a68){var _0x29622d=function(_0x29e2f8){while(--_0x29e2f8){_0x5c58ab['push'](_0x5c58ab['shift']());}};_0x29622d(++_0x434a68);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var logger=require(_0xaf0b('0x2'))(_0xaf0b('0x3'));var moment=require(_0xaf0b('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf0b('0x5'));var fs=require('fs');var path=require(_0xaf0b('0x6'));var rimraf=require('rimraf');var config=require(_0xaf0b('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xaf0b('0x8')]=function(_0x4b3b85,_0x4d1479){return _0x4b3b85[_0xaf0b('0x9')](_0xaf0b('0xa'),attributes,{'tableName':_0xaf0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x280b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util'];(function(_0x582725,_0xa72b1){var _0x23c096=function(_0x452638){while(--_0x452638){_0x582725['push'](_0x582725['shift']());}};_0x23c096(++_0xa72b1);}(_0x280b,0xce));var _0xb280=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x280b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb280('0x0'));var util=require(_0xb280('0x1'));var logger=require('../../config/logger')(_0xb280('0x2'));var moment=require(_0xb280('0x3'));var BPromise=require(_0xb280('0x4'));var rp=require(_0xb280('0x5'));var fs=require('fs');var path=require(_0xb280('0x6'));var rimraf=require(_0xb280('0x7'));var config=require(_0xb280('0x8'));var attributes=require(_0xb280('0x9'));module[_0xb280('0xa')]=function(_0x5d1991,_0x4d1b2e){return _0x5d1991[_0xb280('0xb')](_0xb280('0xc'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 96a99ea..99e13fe 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xac4a,0x13f));var _0xaac4=function(_0x8cfede,_0x3aa69b){_0x8cfede=_0x8cfede-0x0;var _0x2ecd78=_0xac4a[_0x8cfede];return _0x2ecd78;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1ed511,_0x5bd8f0){_0x1ed511=_0x1ed511-0x0;var _0x32ab7b=_0xbdb7[_0x1ed511];return _0x32ab7b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 20a8107..8f107e8 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 _0x6aa8=['show','post','create','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x20609d,_0x10a6b7){var _0x450130=function(_0x32fe7f){while(--_0x32fe7f){_0x20609d['push'](_0x20609d['shift']());}};_0x450130(++_0x10a6b7);}(_0x6aa8,0x1bb));var _0x86aa=function(_0x432ccb,_0x5cc8c8){_0x432ccb=_0x432ccb-0x0;var _0x5c0480=_0x6aa8[_0x432ccb];return _0x5c0480;};'use strict';var multer=require('multer');var util=require(_0x86aa('0x0'));var path=require(_0x86aa('0x1'));var timeout=require(_0x86aa('0x2'));var express=require('express');var router=express[_0x86aa('0x3')]();var fs_extra=require(_0x86aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x86aa('0x5'));var controller=require(_0x86aa('0x6'));router[_0x86aa('0x7')]('/',auth[_0x86aa('0x8')](),controller[_0x86aa('0x9')]);router[_0x86aa('0x7')](_0x86aa('0xa'),auth['isAuthenticated'](),controller[_0x86aa('0xb')]);router[_0x86aa('0x7')](_0x86aa('0xc'),auth['isAuthenticated'](),controller[_0x86aa('0xd')]);router[_0x86aa('0xe')]('/',auth[_0x86aa('0x8')](),controller[_0x86aa('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x86aa('0x10')]);router['delete'](_0x86aa('0xc'),auth[_0x86aa('0x8')](),controller[_0x86aa('0x11')]);module[_0x86aa('0x12')]=router; \ No newline at end of file +var _0xf32d=['get','/describe','isAuthenticated','describe','/:id','post','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2a9788,_0x4c7ffb){var _0x2c32bd=function(_0x4e3985){while(--_0x4e3985){_0x2a9788['push'](_0x2a9788['shift']());}};_0x2c32bd(++_0x4c7ffb);}(_0xf32d,0xa2));var _0xdf32=function(_0x169e97,_0x3414ef){_0x169e97=_0x169e97-0x0;var _0x41fc89=_0xf32d[_0x169e97];return _0x41fc89;};'use strict';var multer=require('multer');var util=require(_0xdf32('0x0'));var path=require(_0xdf32('0x1'));var timeout=require(_0xdf32('0x2'));var express=require(_0xdf32('0x3'));var router=express[_0xdf32('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdf32('0x5'));var interaction=require(_0xdf32('0x6'));var config=require(_0xdf32('0x7'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdf32('0x8')](_0xdf32('0x9'),auth[_0xdf32('0xa')](),controller[_0xdf32('0xb')]);router[_0xdf32('0x8')](_0xdf32('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdf32('0xd')]('/',auth[_0xdf32('0xa')](),controller['create']);router['put'](_0xdf32('0xc'),auth[_0xdf32('0xa')](),controller[_0xdf32('0xe')]);router['delete'](_0xdf32('0xc'),auth[_0xdf32('0xa')](),controller[_0xdf32('0xf')]);module[_0xdf32('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 757034e..0836198 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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x42880c,_0x106df9){_0x42880c=_0x42880c-0x0;var _0x8215aa=_0x7a54[_0x42880c];return _0x8215aa;};'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(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7a54,0x106));var _0x47a5=function(_0x241fc4,_0x1c7518){_0x241fc4=_0x241fc4-0x0;var _0x154605=_0x7a54[_0x241fc4];return _0x154605;};'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 c5c6ad4..fb02a45 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 _0x0f3e=['stack','name','index','map','JscriptyQuestionReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','error'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x0f3e,0x1d7));var _0xe0f3=function(_0x306481,_0x20527a){_0x306481=_0x306481-0x0;var _0x33d816=_0x0f3e[_0x306481];return _0x33d816;};'use strict';var emlformat=require(_0xe0f3('0x0'));var rimraf=require(_0xe0f3('0x1'));var zipdir=require(_0xe0f3('0x2'));var jsonpatch=require(_0xe0f3('0x3'));var rp=require(_0xe0f3('0x4'));var moment=require('moment');var BPromise=require(_0xe0f3('0x5'));var Mustache=require('mustache');var util=require(_0xe0f3('0x6'));var path=require(_0xe0f3('0x7'));var sox=require(_0xe0f3('0x8'));var csv=require(_0xe0f3('0x9'));var ejs=require(_0xe0f3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0f3('0xb'));var squel=require(_0xe0f3('0xc'));var crypto=require(_0xe0f3('0xd'));var jsforce=require(_0xe0f3('0xe'));var deskjs=require(_0xe0f3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe0f3('0x10'));var Papa=require('papaparse');var Redis=require(_0xe0f3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe0f3('0x12'));var hardwareService=require(_0xe0f3('0x13'));var logger=require(_0xe0f3('0x14'))('api');var utils=require(_0xe0f3('0x15'));var config=require(_0xe0f3('0x16'));var licenseUtil=require(_0xe0f3('0x17'));var db=require(_0xe0f3('0x18'))['db'];function respondWithStatusCode(_0x232594,_0x3b7fd2){_0x3b7fd2=_0x3b7fd2||0xcc;return function(_0x430174){if(_0x430174){return _0x232594[_0xe0f3('0x19')](_0x3b7fd2);}return _0x232594[_0xe0f3('0x1a')](_0x3b7fd2)[_0xe0f3('0x1b')]();};}function respondWithResult(_0x53f177,_0x4b6ee9){_0x4b6ee9=_0x4b6ee9||0xc8;return function(_0x1ad7d7){if(_0x1ad7d7){return _0x53f177[_0xe0f3('0x1a')](_0x4b6ee9)['json'](_0x1ad7d7);}};}function respondWithFilteredResult(_0x11ef86,_0x3c0aad){return function(_0x2f384b){if(_0x2f384b){var _0x547c4d=typeof _0x3c0aad[_0xe0f3('0x1c')]==='undefined'&&typeof _0x3c0aad[_0xe0f3('0x1d')]===_0xe0f3('0x1e');var _0x31ea7d=_0x2f384b[_0xe0f3('0x1f')];var _0x19a505=_0x547c4d?0x0:_0x3c0aad[_0xe0f3('0x1c')];var _0x1ca9e8=_0x547c4d?_0x2f384b[_0xe0f3('0x1f')]:_0x3c0aad[_0xe0f3('0x1c')]+_0x3c0aad['limit'];var _0x21f5ac;if(_0x1ca9e8>=_0x31ea7d){_0x1ca9e8=_0x31ea7d;_0x21f5ac=0xc8;}else{_0x21f5ac=0xce;}_0x11ef86['status'](_0x21f5ac);return _0x11ef86[_0xe0f3('0x20')](_0xe0f3('0x21'),_0x19a505+'-'+_0x1ca9e8+'/'+_0x31ea7d)[_0xe0f3('0x22')](_0x2f384b);}return null;};}function patchUpdates(_0x4b11c0){return function(_0x1e44be){try{jsonpatch['apply'](_0x1e44be,_0x4b11c0,!![]);}catch(_0x1b4974){return BPromise[_0xe0f3('0x23')](_0x1b4974);}return _0x1e44be[_0xe0f3('0x24')]();};}function saveUpdates(_0x219c44,_0xb17ade){return function(_0x579311){if(_0x579311){return _0x579311[_0xe0f3('0x25')](_0x219c44)[_0xe0f3('0x26')](function(_0xc45fd){return _0xc45fd;});}return null;};}function removeEntity(_0x3e306f,_0xa11d77){return function(_0x170413){if(_0x170413){return _0x170413['destroy']()[_0xe0f3('0x26')](function(){_0x3e306f[_0xe0f3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34dc46,_0x1f965f){return function(_0x180232){if(!_0x180232){_0x34dc46[_0xe0f3('0x19')](0x194);}return _0x180232;};}function handleError(_0x1992b8,_0x449ac3){_0x449ac3=_0x449ac3||0x1f4;return function(_0x24e410){logger[_0xe0f3('0x27')](_0x24e410[_0xe0f3('0x28')]);if(_0x24e410[_0xe0f3('0x29')]){delete _0x24e410[_0xe0f3('0x29')];}_0x1992b8[_0xe0f3('0x1a')](_0x449ac3)['send'](_0x24e410);};}exports[_0xe0f3('0x2a')]=function(_0x3189f9,_0xb7c6c5){var _0x1b8f28={},_0x337079={},_0x40b9b6={'count':0x0,'rows':[]};var _0xa2f9d8=_[_0xe0f3('0x2b')](db[_0xe0f3('0x2c')]['rawAttributes'],function(_0x28aaa5){return{'name':_0x28aaa5[_0xe0f3('0x2d')],'type':_0x28aaa5[_0xe0f3('0x2e')][_0xe0f3('0x2f')]};});_0x337079['model']=_[_0xe0f3('0x2b')](_0xa2f9d8,'name');_0x337079['query']=_[_0xe0f3('0x30')](_0x3189f9[_0xe0f3('0x31')]);_0x337079[_0xe0f3('0x32')]=_[_0xe0f3('0x33')](_0x337079[_0xe0f3('0x34')],_0x337079[_0xe0f3('0x31')]);_0x1b8f28[_0xe0f3('0x35')]=_['intersection'](_0x337079[_0xe0f3('0x34')],qs['fields'](_0x3189f9[_0xe0f3('0x31')][_0xe0f3('0x36')]));_0x1b8f28['attributes']=_0x1b8f28[_0xe0f3('0x35')]['length']?_0x1b8f28[_0xe0f3('0x35')]:_0x337079[_0xe0f3('0x34')];if(!_0x3189f9['query'][_0xe0f3('0x37')]('nolimit')){_0x1b8f28[_0xe0f3('0x1d')]=qs[_0xe0f3('0x1d')](_0x3189f9[_0xe0f3('0x31')][_0xe0f3('0x1d')]);_0x1b8f28[_0xe0f3('0x1c')]=qs['offset'](_0x3189f9['query'][_0xe0f3('0x1c')]);}_0x1b8f28['order']=qs[_0xe0f3('0x38')](_0x3189f9['query']['sort']);_0x1b8f28[_0xe0f3('0x39')]=qs[_0xe0f3('0x32')](_['pick'](_0x3189f9[_0xe0f3('0x31')],_0x337079['filters']),_0xa2f9d8);if(_0x3189f9[_0xe0f3('0x31')]['filter']){_0x1b8f28['where']=_['merge'](_0x1b8f28['where'],{'$or':_[_0xe0f3('0x2b')](_0xa2f9d8,function(_0xff7d04){if(_0xff7d04['type']!==_0xe0f3('0x3a')){var _0x757cb0={};_0x757cb0[_0xff7d04[_0xe0f3('0x29')]]={'$like':'%'+_0x3189f9[_0xe0f3('0x31')][_0xe0f3('0x3b')]+'%'};return _0x757cb0;}})});}_0x1b8f28=_[_0xe0f3('0x3c')]({},_0x1b8f28,_0x3189f9[_0xe0f3('0x3d')]);var _0x3f34ca={'where':_0x1b8f28[_0xe0f3('0x39')]};return db[_0xe0f3('0x2c')]['count'](_0x3f34ca)[_0xe0f3('0x26')](function(_0x537b07){_0x40b9b6[_0xe0f3('0x1f')]=_0x537b07;if(_0x3189f9[_0xe0f3('0x31')]['includeAll']){_0x1b8f28[_0xe0f3('0x3e')]=[{'all':!![]}];}return db[_0xe0f3('0x2c')][_0xe0f3('0x3f')](_0x1b8f28);})['then'](function(_0x2c28c1){_0x40b9b6[_0xe0f3('0x40')]=_0x2c28c1;return _0x40b9b6;})[_0xe0f3('0x26')](respondWithFilteredResult(_0xb7c6c5,_0x1b8f28))[_0xe0f3('0x41')](handleError(_0xb7c6c5,null));};exports['show']=function(_0x59d0b4,_0x26f1bd){var _0xe8e17c={'raw':!![],'where':{'id':_0x59d0b4[_0xe0f3('0x42')]['id']}},_0x2df146={};_0x2df146[_0xe0f3('0x34')]=_[_0xe0f3('0x30')](db[_0xe0f3('0x2c')][_0xe0f3('0x43')]);_0x2df146[_0xe0f3('0x31')]=_[_0xe0f3('0x30')](_0x59d0b4[_0xe0f3('0x31')]);_0x2df146[_0xe0f3('0x32')]=_[_0xe0f3('0x33')](_0x2df146['model'],_0x2df146[_0xe0f3('0x31')]);_0xe8e17c[_0xe0f3('0x35')]=_[_0xe0f3('0x33')](_0x2df146['model'],qs['fields'](_0x59d0b4['query'][_0xe0f3('0x36')]));_0xe8e17c['attributes']=_0xe8e17c[_0xe0f3('0x35')][_0xe0f3('0x44')]?_0xe8e17c[_0xe0f3('0x35')]:_0x2df146[_0xe0f3('0x34')];if(_0x59d0b4[_0xe0f3('0x31')]['includeAll']){_0xe8e17c[_0xe0f3('0x3e')]=[{'all':!![]}];}_0xe8e17c=_[_0xe0f3('0x3c')]({},_0xe8e17c,_0x59d0b4[_0xe0f3('0x3d')]);return db[_0xe0f3('0x2c')][_0xe0f3('0x45')](_0xe8e17c)[_0xe0f3('0x26')](handleEntityNotFound(_0x26f1bd,null))['then'](respondWithResult(_0x26f1bd,null))[_0xe0f3('0x41')](handleError(_0x26f1bd,null));};exports[_0xe0f3('0x46')]=function(_0x926856,_0x3e6b36){return db['JscriptyQuestionReport'][_0xe0f3('0x46')](_0x926856[_0xe0f3('0x47')],{})['then'](respondWithResult(_0x3e6b36,0xc9))[_0xe0f3('0x41')](handleError(_0x3e6b36,null));};exports['update']=function(_0x764536,_0x2b598d){if(_0x764536[_0xe0f3('0x47')]['id']){delete _0x764536[_0xe0f3('0x47')]['id'];}return db[_0xe0f3('0x2c')][_0xe0f3('0x45')]({'where':{'id':_0x764536[_0xe0f3('0x42')]['id']}})[_0xe0f3('0x26')](handleEntityNotFound(_0x2b598d,null))[_0xe0f3('0x26')](saveUpdates(_0x764536[_0xe0f3('0x47')],null))['then'](respondWithResult(_0x2b598d,null))['catch'](handleError(_0x2b598d,null));};exports['destroy']=function(_0x254fd1,_0x225bce){return db[_0xe0f3('0x2c')][_0xe0f3('0x45')]({'where':{'id':_0x254fd1[_0xe0f3('0x42')]['id']}})[_0xe0f3('0x26')](handleEntityNotFound(_0x225bce,null))[_0xe0f3('0x26')](removeEntity(_0x225bce,null))['catch'](handleError(_0x225bce,null));};exports['describe']=function(_0x5c3748,_0x33c6a8){return db[_0xe0f3('0x2c')][_0xe0f3('0x48')]()[_0xe0f3('0x26')](respondWithResult(_0x33c6a8,null))[_0xe0f3('0x41')](handleError(_0x33c6a8,null));}; \ No newline at end of file +var _0x277b=['fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','map','VIRTUAL','filter','includeAll','include','findAll','rows','params','length','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','JscriptyQuestionReport','rawAttributes'];(function(_0x3e4823,_0x4ee877){var _0x403355=function(_0x45e0a6){while(--_0x45e0a6){_0x3e4823['push'](_0x3e4823['shift']());}};_0x403355(++_0x4ee877);}(_0x277b,0x1db));var _0xb277=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x277b[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb277('0x0'));var zipdir=require(_0xb277('0x1'));var jsonpatch=require(_0xb277('0x2'));var rp=require('request-promise');var moment=require(_0xb277('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb277('0x4'));var util=require(_0xb277('0x5'));var path=require(_0xb277('0x6'));var sox=require(_0xb277('0x7'));var csv=require('to-csv');var ejs=require(_0xb277('0x8'));var fs=require('fs');var fs_extra=require(_0xb277('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb277('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb277('0xb'));var toCsv=require(_0xb277('0xc'));var querystring=require(_0xb277('0xd'));var Papa=require('papaparse');var Redis=require(_0xb277('0xe'));var authService=require(_0xb277('0xf'));var qs=require(_0xb277('0x10'));var as=require(_0xb277('0x11'));var hardwareService=require(_0xb277('0x12'));var logger=require(_0xb277('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb277('0x14'));var licenseUtil=require(_0xb277('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d26e7,_0x57923d){_0x57923d=_0x57923d||0xcc;return function(_0x294d4f){if(_0x294d4f){return _0x5d26e7[_0xb277('0x16')](_0x57923d);}return _0x5d26e7[_0xb277('0x17')](_0x57923d)[_0xb277('0x18')]();};}function respondWithResult(_0x5d74b7,_0x1cffa9){_0x1cffa9=_0x1cffa9||0xc8;return function(_0x3ae18d){if(_0x3ae18d){return _0x5d74b7[_0xb277('0x17')](_0x1cffa9)[_0xb277('0x19')](_0x3ae18d);}};}function respondWithFilteredResult(_0x14817b,_0x118ab){return function(_0xaa0404){if(_0xaa0404){var _0x247fa7=typeof _0x118ab[_0xb277('0x1a')]===_0xb277('0x1b')&&typeof _0x118ab['limit']===_0xb277('0x1b');var _0x3dfe9e=_0xaa0404[_0xb277('0x1c')];var _0x206af5=_0x247fa7?0x0:_0x118ab[_0xb277('0x1a')];var _0x159307=_0x247fa7?_0xaa0404[_0xb277('0x1c')]:_0x118ab[_0xb277('0x1a')]+_0x118ab[_0xb277('0x1d')];var _0x3c1f38;if(_0x159307>=_0x3dfe9e){_0x159307=_0x3dfe9e;_0x3c1f38=0xc8;}else{_0x3c1f38=0xce;}_0x14817b[_0xb277('0x17')](_0x3c1f38);return _0x14817b[_0xb277('0x1e')](_0xb277('0x1f'),_0x206af5+'-'+_0x159307+'/'+_0x3dfe9e)['json'](_0xaa0404);}return null;};}function patchUpdates(_0x2bca93){return function(_0x611730){try{jsonpatch[_0xb277('0x20')](_0x611730,_0x2bca93,!![]);}catch(_0x7dfe74){return BPromise[_0xb277('0x21')](_0x7dfe74);}return _0x611730[_0xb277('0x22')]();};}function saveUpdates(_0x12468a,_0x361bae){return function(_0x3a2022){if(_0x3a2022){return _0x3a2022[_0xb277('0x23')](_0x12468a)[_0xb277('0x24')](function(_0x4cd452){return _0x4cd452;});}return null;};}function removeEntity(_0x5ca6c6,_0x48d189){return function(_0x5b8cb7){if(_0x5b8cb7){return _0x5b8cb7[_0xb277('0x25')]()[_0xb277('0x24')](function(){_0x5ca6c6['status'](0xcc)[_0xb277('0x18')]();});}};}function handleEntityNotFound(_0x1b1218,_0x23b75){return function(_0xb0aa0b){if(!_0xb0aa0b){_0x1b1218['sendStatus'](0x194);}return _0xb0aa0b;};}function handleError(_0x1dbfcb,_0x4e037c){_0x4e037c=_0x4e037c||0x1f4;return function(_0x3705e2){logger[_0xb277('0x26')](_0x3705e2['stack']);if(_0x3705e2[_0xb277('0x27')]){delete _0x3705e2[_0xb277('0x27')];}_0x1dbfcb['status'](_0x4e037c)[_0xb277('0x28')](_0x3705e2);};}exports['index']=function(_0x14fd1b,_0xc95faa){var _0x1231bc={},_0x38a7bd={},_0x528e00={'count':0x0,'rows':[]};var _0xb37238=_['map'](db[_0xb277('0x29')][_0xb277('0x2a')],function(_0x5bea32){return{'name':_0x5bea32[_0xb277('0x2b')],'type':_0x5bea32[_0xb277('0x2c')][_0xb277('0x2d')]};});_0x38a7bd['model']=_['map'](_0xb37238,'name');_0x38a7bd['query']=_[_0xb277('0x2e')](_0x14fd1b[_0xb277('0x2f')]);_0x38a7bd['filters']=_[_0xb277('0x30')](_0x38a7bd[_0xb277('0x31')],_0x38a7bd[_0xb277('0x2f')]);_0x1231bc[_0xb277('0x32')]=_[_0xb277('0x30')](_0x38a7bd['model'],qs[_0xb277('0x33')](_0x14fd1b[_0xb277('0x2f')][_0xb277('0x33')]));_0x1231bc[_0xb277('0x32')]=_0x1231bc[_0xb277('0x32')]['length']?_0x1231bc[_0xb277('0x32')]:_0x38a7bd[_0xb277('0x31')];if(!_0x14fd1b[_0xb277('0x2f')][_0xb277('0x34')](_0xb277('0x35'))){_0x1231bc[_0xb277('0x1d')]=qs[_0xb277('0x1d')](_0x14fd1b[_0xb277('0x2f')][_0xb277('0x1d')]);_0x1231bc[_0xb277('0x1a')]=qs[_0xb277('0x1a')](_0x14fd1b[_0xb277('0x2f')][_0xb277('0x1a')]);}_0x1231bc[_0xb277('0x36')]=qs[_0xb277('0x37')](_0x14fd1b[_0xb277('0x2f')][_0xb277('0x37')]);_0x1231bc['where']=qs[_0xb277('0x38')](_[_0xb277('0x39')](_0x14fd1b[_0xb277('0x2f')],_0x38a7bd[_0xb277('0x38')]),_0xb37238);if(_0x14fd1b[_0xb277('0x2f')]['filter']){_0x1231bc['where']=_[_0xb277('0x3a')](_0x1231bc[_0xb277('0x3b')],{'$or':_[_0xb277('0x3c')](_0xb37238,function(_0x4fdf31){if(_0x4fdf31[_0xb277('0x2c')]!==_0xb277('0x3d')){var _0x2cb247={};_0x2cb247[_0x4fdf31[_0xb277('0x27')]]={'$like':'%'+_0x14fd1b[_0xb277('0x2f')][_0xb277('0x3e')]+'%'};return _0x2cb247;}})});}_0x1231bc=_[_0xb277('0x3a')]({},_0x1231bc,_0x14fd1b['options']);var _0x5a2064={'where':_0x1231bc['where']};return db[_0xb277('0x29')]['count'](_0x5a2064)[_0xb277('0x24')](function(_0x1fa07b){_0x528e00[_0xb277('0x1c')]=_0x1fa07b;if(_0x14fd1b[_0xb277('0x2f')][_0xb277('0x3f')]){_0x1231bc[_0xb277('0x40')]=[{'all':!![]}];}return db[_0xb277('0x29')][_0xb277('0x41')](_0x1231bc);})[_0xb277('0x24')](function(_0x3d7bda){_0x528e00[_0xb277('0x42')]=_0x3d7bda;return _0x528e00;})['then'](respondWithFilteredResult(_0xc95faa,_0x1231bc))['catch'](handleError(_0xc95faa,null));};exports['show']=function(_0x3b14c5,_0x4459e6){var _0x111ca7={'raw':!![],'where':{'id':_0x3b14c5[_0xb277('0x43')]['id']}},_0x287663={};_0x287663[_0xb277('0x31')]=_[_0xb277('0x2e')](db[_0xb277('0x29')][_0xb277('0x2a')]);_0x287663[_0xb277('0x2f')]=_[_0xb277('0x2e')](_0x3b14c5[_0xb277('0x2f')]);_0x287663['filters']=_[_0xb277('0x30')](_0x287663[_0xb277('0x31')],_0x287663[_0xb277('0x2f')]);_0x111ca7[_0xb277('0x32')]=_['intersection'](_0x287663['model'],qs[_0xb277('0x33')](_0x3b14c5[_0xb277('0x2f')][_0xb277('0x33')]));_0x111ca7[_0xb277('0x32')]=_0x111ca7['attributes'][_0xb277('0x44')]?_0x111ca7[_0xb277('0x32')]:_0x287663[_0xb277('0x31')];if(_0x3b14c5[_0xb277('0x2f')][_0xb277('0x3f')]){_0x111ca7[_0xb277('0x40')]=[{'all':!![]}];}_0x111ca7=_[_0xb277('0x3a')]({},_0x111ca7,_0x3b14c5['options']);return db[_0xb277('0x29')][_0xb277('0x45')](_0x111ca7)[_0xb277('0x24')](handleEntityNotFound(_0x4459e6,null))[_0xb277('0x24')](respondWithResult(_0x4459e6,null))['catch'](handleError(_0x4459e6,null));};exports['create']=function(_0x337b0c,_0xcde75){return db[_0xb277('0x29')][_0xb277('0x46')](_0x337b0c['body'],{})[_0xb277('0x24')](respondWithResult(_0xcde75,0xc9))[_0xb277('0x47')](handleError(_0xcde75,null));};exports['update']=function(_0x4b43fe,_0x623f1e){if(_0x4b43fe[_0xb277('0x48')]['id']){delete _0x4b43fe['body']['id'];}return db[_0xb277('0x29')][_0xb277('0x45')]({'where':{'id':_0x4b43fe['params']['id']}})['then'](handleEntityNotFound(_0x623f1e,null))['then'](saveUpdates(_0x4b43fe[_0xb277('0x48')],null))[_0xb277('0x24')](respondWithResult(_0x623f1e,null))[_0xb277('0x47')](handleError(_0x623f1e,null));};exports['destroy']=function(_0x2f5a0c,_0x2b5f6a){return db[_0xb277('0x29')][_0xb277('0x45')]({'where':{'id':_0x2f5a0c[_0xb277('0x43')]['id']}})[_0xb277('0x24')](handleEntityNotFound(_0x2b5f6a,null))[_0xb277('0x24')](removeEntity(_0x2b5f6a,null))[_0xb277('0x47')](handleError(_0x2b5f6a,null));};exports[_0xb277('0x49')]=function(_0x11344b,_0x365ef7){return db[_0xb277('0x29')][_0xb277('0x49')]()[_0xb277('0x24')](respondWithResult(_0x365ef7,null))[_0xb277('0x47')](handleError(_0x365ef7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7627142..2d63631 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 _0x118f=['moment','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','../../config/logger','api'];(function(_0x45a19a,_0x406fea){var _0x1bae6a=function(_0x413f42){while(--_0x413f42){_0x45a19a['push'](_0x45a19a['shift']());}};_0x1bae6a(++_0x406fea);}(_0x118f,0x1ce));var _0xf118=function(_0xb66f92,_0x301f99){_0xb66f92=_0xb66f92-0x0;var _0x344d2d=_0x118f[_0xb66f92];return _0x344d2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf118('0x0'))(_0xf118('0x1'));var moment=require(_0xf118('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf118('0x3'));var rimraf=require(_0xf118('0x4'));var config=require(_0xf118('0x5'));var attributes=require(_0xf118('0x6'));module['exports']=function(_0x384980,_0x468ced){return _0x384980[_0xf118('0x7')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x881b=['define','JscriptyQuestionReport','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports'];(function(_0x540c84,_0x1a68bf){var _0x569ef1=function(_0x3e7dab){while(--_0x3e7dab){_0x540c84['push'](_0x540c84['shift']());}};_0x569ef1(++_0x1a68bf);}(_0x881b,0x141));var _0xb881=function(_0x226774,_0x32f9b7){_0x226774=_0x226774-0x0;var _0x311ee0=_0x881b[_0x226774];return _0x311ee0;};'use strict';var _=require(_0xb881('0x0'));var util=require(_0xb881('0x1'));var logger=require(_0xb881('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb881('0x3'));var rp=require(_0xb881('0x4'));var fs=require('fs');var path=require(_0xb881('0x5'));var rimraf=require(_0xb881('0x6'));var config=require('../../config/environment');var attributes=require(_0xb881('0x7'));module[_0xb881('0x8')]=function(_0x12fb5d,_0x1c5113){return _0x12fb5d[_0xb881('0x9')](_0xb881('0xa'),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 56e092a..6f6d75b 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 _0xd73e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x35b809,_0x50bd5e){var _0x2b4653=function(_0x3ef5dc){while(--_0x3ef5dc){_0x35b809['push'](_0x35b809['shift']());}};_0x2b4653(++_0x50bd5e);}(_0xd73e,0xbb));var _0xed73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd73e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xed73('0x0'));var util=require(_0xed73('0x1'));var moment=require(_0xed73('0x2'));var BPromise=require(_0xed73('0x3'));var rs=require(_0xed73('0x4'));var fs=require('fs');var Redis=require(_0xed73('0x5'));var db=require(_0xed73('0x6'))['db'];var utils=require(_0xed73('0x7'));var logger=require(_0xed73('0x8'))(_0xed73('0x9'));var config=require(_0xed73('0xa'));var jayson=require(_0xed73('0xb'));var client=jayson['client'][_0xed73('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x66c862,_0x1af698,_0x1e57e2){return new BPromise(function(_0x2990ac,_0x439c26){return client['request'](_0x66c862,_0x1e57e2)[_0xed73('0xd')](function(_0x412ad9){logger[_0xed73('0xe')](_0xed73('0xf'),_0x1af698,'request\x20sent');logger[_0xed73('0x10')](_0xed73('0x11'),_0x1af698,_0xed73('0x12'),JSON[_0xed73('0x13')](_0x412ad9));if(_0x412ad9[_0xed73('0x14')]){if(_0x412ad9[_0xed73('0x14')][_0xed73('0x15')]===0x1f4){logger[_0xed73('0x14')](_0xed73('0xf'),_0x1af698,_0x412ad9['error'][_0xed73('0x16')]);return _0x439c26(_0x412ad9[_0xed73('0x14')][_0xed73('0x16')]);}logger['error'](_0xed73('0xf'),_0x1af698,_0x412ad9[_0xed73('0x14')][_0xed73('0x16')]);return _0x2990ac(_0x412ad9[_0xed73('0x14')]['message']);}else{logger[_0xed73('0xe')](_0xed73('0xf'),_0x1af698,_0xed73('0x12'));_0x2990ac(_0x412ad9['result'][_0xed73('0x16')]);}})[_0xed73('0x17')](function(_0x5aefc1){logger[_0xed73('0x14')](_0xed73('0xf'),_0x1af698,_0x5aefc1);_0x439c26(_0x5aefc1);});});} \ No newline at end of file +var _0xd655=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0xcbcd91,_0x4d2e4f){var _0x24fb59=function(_0x3744e0){while(--_0x3744e0){_0xcbcd91['push'](_0xcbcd91['shift']());}};_0x24fb59(++_0x4d2e4f);}(_0xd655,0x188));var _0x5d65=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0xd655[_0xe2c95e];return _0x42ce6f;};'use strict';var _=require(_0x5d65('0x0'));var util=require(_0x5d65('0x1'));var moment=require(_0x5d65('0x2'));var BPromise=require(_0x5d65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d65('0x4'));var db=require(_0x5d65('0x5'))['db'];var utils=require(_0x5d65('0x6'));var logger=require(_0x5d65('0x7'))(_0x5d65('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d65('0x9')][_0x5d65('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f051f,_0x2c8da4,_0x50dc98){return new BPromise(function(_0x3bf836,_0x96e237){return client[_0x5d65('0xb')](_0x1f051f,_0x50dc98)[_0x5d65('0xc')](function(_0x28160e){logger[_0x5d65('0xd')](_0x5d65('0xe'),_0x2c8da4,'request\x20sent');logger[_0x5d65('0xf')](_0x5d65('0x10'),_0x2c8da4,_0x5d65('0x11'),JSON['stringify'](_0x28160e));if(_0x28160e[_0x5d65('0x12')]){if(_0x28160e[_0x5d65('0x12')][_0x5d65('0x13')]===0x1f4){logger[_0x5d65('0x12')](_0x5d65('0xe'),_0x2c8da4,_0x28160e[_0x5d65('0x12')][_0x5d65('0x14')]);return _0x96e237(_0x28160e[_0x5d65('0x12')][_0x5d65('0x14')]);}logger[_0x5d65('0x12')](_0x5d65('0xe'),_0x2c8da4,_0x28160e[_0x5d65('0x12')]['message']);return _0x3bf836(_0x28160e[_0x5d65('0x12')][_0x5d65('0x14')]);}else{logger[_0x5d65('0xd')](_0x5d65('0xe'),_0x2c8da4,_0x5d65('0x11'));_0x3bf836(_0x28160e[_0x5d65('0x15')][_0x5d65('0x14')]);}})[_0x5d65('0x16')](function(_0x4e6591){logger[_0x5d65('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2c8da4,_0x4e6591);_0x96e237(_0x4e6591);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0bb6f12..e1cb114 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 _0xdfa1=['/:id','show','create','delete','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xdfa1,0x1e1));var _0x1dfa=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xdfa1[_0x51c819];return _0x15c5d2;};'use strict';var multer=require(_0x1dfa('0x0'));var util=require(_0x1dfa('0x1'));var path=require(_0x1dfa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1dfa('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1dfa('0x4'));var config=require(_0x1dfa('0x5'));var controller=require(_0x1dfa('0x6'));router[_0x1dfa('0x7')]('/',auth[_0x1dfa('0x8')](),controller[_0x1dfa('0x9')]);router[_0x1dfa('0x7')](_0x1dfa('0xa'),auth[_0x1dfa('0x8')](),controller[_0x1dfa('0xb')]);router[_0x1dfa('0x7')](_0x1dfa('0xc'),auth[_0x1dfa('0x8')](),controller[_0x1dfa('0xd')]);router[_0x1dfa('0x7')]('/:id/questions',auth[_0x1dfa('0x8')](),controller['getQuestions']);router['post']('/',auth[_0x1dfa('0x8')](),controller[_0x1dfa('0xe')]);router['put'](_0x1dfa('0xc'),auth[_0x1dfa('0x8')](),controller['update']);router[_0x1dfa('0xf')](_0x1dfa('0xc'),auth[_0x1dfa('0x8')](),controller['destroy']);module[_0x1dfa('0x10')]=router; \ No newline at end of file +var _0xca61=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','getQuestions','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4b4dc3,_0x2f82fc){var _0x305959=function(_0x54cb51){while(--_0x54cb51){_0x4b4dc3['push'](_0x4b4dc3['shift']());}};_0x305959(++_0x2f82fc);}(_0xca61,0xe9));var _0x1ca6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xca61[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x1ca6('0x0'));var path=require(_0x1ca6('0x1'));var timeout=require(_0x1ca6('0x2'));var express=require(_0x1ca6('0x3'));var router=express[_0x1ca6('0x4')]();var fs_extra=require(_0x1ca6('0x5'));var auth=require(_0x1ca6('0x6'));var interaction=require(_0x1ca6('0x7'));var config=require(_0x1ca6('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0x1ca6('0x9')]('/',auth[_0x1ca6('0xa')](),controller['index']);router[_0x1ca6('0x9')](_0x1ca6('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1ca6('0xc'),auth['isAuthenticated'](),controller[_0x1ca6('0xd')]);router[_0x1ca6('0x9')]('/:id/questions',auth['isAuthenticated'](),controller[_0x1ca6('0xe')]);router['post']('/',auth[_0x1ca6('0xa')](),controller[_0x1ca6('0xf')]);router[_0x1ca6('0x10')](_0x1ca6('0xc'),auth[_0x1ca6('0xa')](),controller[_0x1ca6('0x11')]);router['delete'](_0x1ca6('0xc'),auth[_0x1ca6('0xa')](),controller[_0x1ca6('0x12')]);module[_0x1ca6('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 909cc01..145a886 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 _0x3c26=['YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports','DATE','setDataValue','starttime','endtime','format'];(function(_0x2d7332,_0x15e723){var _0x5212fb=function(_0x587a93){while(--_0x587a93){_0x2d7332['push'](_0x2d7332['shift']());}};_0x5212fb(++_0x15e723);}(_0x3c26,0x122));var _0x63c2=function(_0x3f923a,_0x1d3573){_0x3f923a=_0x3f923a-0x0;var _0x446df6=_0x3c26[_0x3f923a];return _0x446df6;};'use strict';var moment=require('moment');var Sequelize=require(_0x63c2('0x0'));module[_0x63c2('0x1')]={'starttime':{'type':Sequelize[_0x63c2('0x2')],'set':function(_0x56bda5){this[_0x63c2('0x3')](_0x63c2('0x4'),_0x56bda5);this[_0x63c2('0x3')](_0x63c2('0x5'),moment()[_0x63c2('0x6')](_0x63c2('0x7')));}},'endtime':{'type':Sequelize[_0x63c2('0x2')]},'membername':{'type':Sequelize[_0x63c2('0x8')]},'projectname':{'type':Sequelize[_0x63c2('0x8')]},'queue':{'type':Sequelize[_0x63c2('0x8')]},'uniqueid':{'type':Sequelize[_0x63c2('0x8')]},'calleridname':{'type':Sequelize[_0x63c2('0x8')]},'calleridnum':{'type':Sequelize[_0x63c2('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9275=['sequelize','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x2ff252,_0x222a1b){var _0x327741=function(_0x250617){while(--_0x250617){_0x2ff252['push'](_0x2ff252['shift']());}};_0x327741(++_0x222a1b);}(_0x9275,0x170));var _0x5927=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x9275[_0xb65e77];return _0x38134b;};'use strict';var moment=require('moment');var Sequelize=require(_0x5927('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x5927('0x1')],'set':function(_0x27187d){this[_0x5927('0x2')](_0x5927('0x3'),_0x27187d);this[_0x5927('0x2')](_0x5927('0x4'),moment()['format'](_0x5927('0x5')));}},'endtime':{'type':Sequelize[_0x5927('0x1')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x5927('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5927('0x6')]},'calleridname':{'type':Sequelize[_0x5927('0x6')]},'calleridnum':{'type':Sequelize[_0x5927('0x6')]},'completed':{'type':Sequelize[_0x5927('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index b48c6e0..a05a05d 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 _0x5ae8=['length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','findAll','catch','show','params','include','merge','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rows','eml-format','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','reject','save','update','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields'];(function(_0x4a1104,_0x32530b){var _0x5af867=function(_0xbebe37){while(--_0xbebe37){_0x4a1104['push'](_0x4a1104['shift']());}};_0x5af867(++_0x32530b);}(_0x5ae8,0xb8));var _0x85ae=function(_0x20d4e7,_0x5f29f7){_0x20d4e7=_0x20d4e7-0x0;var _0x125131=_0x5ae8[_0x20d4e7];return _0x125131;};'use strict';var emlformat=require(_0x85ae('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x85ae('0x1'));var rp=require(_0x85ae('0x2'));var moment=require(_0x85ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x85ae('0x4'));var util=require('util');var path=require('path');var sox=require(_0x85ae('0x5'));var csv=require('to-csv');var ejs=require(_0x85ae('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85ae('0x7'));var squel=require(_0x85ae('0x8'));var crypto=require(_0x85ae('0x9'));var jsforce=require(_0x85ae('0xa'));var deskjs=require(_0x85ae('0xb'));var toCsv=require(_0x85ae('0xc'));var querystring=require(_0x85ae('0xd'));var Papa=require(_0x85ae('0xe'));var Redis=require(_0x85ae('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x85ae('0x10'));var hardwareService=require(_0x85ae('0x11'));var logger=require('../../config/logger')(_0x85ae('0x12'));var utils=require(_0x85ae('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x85ae('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eef83,_0x5ee774){_0x5ee774=_0x5ee774||0xcc;return function(_0x57ec9d){if(_0x57ec9d){return _0x2eef83['sendStatus'](_0x5ee774);}return _0x2eef83[_0x85ae('0x15')](_0x5ee774)[_0x85ae('0x16')]();};}function respondWithResult(_0xa026a2,_0x417fab){_0x417fab=_0x417fab||0xc8;return function(_0x5edd76){if(_0x5edd76){return _0xa026a2['status'](_0x417fab)[_0x85ae('0x17')](_0x5edd76);}};}function respondWithFilteredResult(_0x3b6e02,_0x1e540b){return function(_0x47c55c){if(_0x47c55c){var _0x6966f5=typeof _0x1e540b[_0x85ae('0x18')]===_0x85ae('0x19')&&typeof _0x1e540b[_0x85ae('0x1a')]==='undefined';var _0x2aef92=_0x47c55c[_0x85ae('0x1b')];var _0x128f91=_0x6966f5?0x0:_0x1e540b[_0x85ae('0x18')];var _0x28ba1a=_0x6966f5?_0x47c55c[_0x85ae('0x1b')]:_0x1e540b[_0x85ae('0x18')]+_0x1e540b['limit'];var _0x2a3717;if(_0x28ba1a>=_0x2aef92){_0x28ba1a=_0x2aef92;_0x2a3717=0xc8;}else{_0x2a3717=0xce;}_0x3b6e02['status'](_0x2a3717);return _0x3b6e02['set']('Content-Range',_0x128f91+'-'+_0x28ba1a+'/'+_0x2aef92)['json'](_0x47c55c);}return null;};}function patchUpdates(_0xc64b9){return function(_0x5039ac){try{jsonpatch['apply'](_0x5039ac,_0xc64b9,!![]);}catch(_0xec259){return BPromise[_0x85ae('0x1c')](_0xec259);}return _0x5039ac[_0x85ae('0x1d')]();};}function saveUpdates(_0x6af38d,_0x5ad120){return function(_0x38c04b){if(_0x38c04b){return _0x38c04b[_0x85ae('0x1e')](_0x6af38d)[_0x85ae('0x1f')](function(_0x95eaa9){return _0x95eaa9;});}return null;};}function removeEntity(_0x3e78e9,_0x454e7c){return function(_0x3427e5){if(_0x3427e5){return _0x3427e5['destroy']()['then'](function(){_0x3e78e9[_0x85ae('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525c25,_0x2cccdd){return function(_0x276539){if(!_0x276539){_0x525c25[_0x85ae('0x20')](0x194);}return _0x276539;};}function handleError(_0x51fec5,_0x35db9d){_0x35db9d=_0x35db9d||0x1f4;return function(_0x40656e){logger[_0x85ae('0x21')](_0x40656e[_0x85ae('0x22')]);if(_0x40656e['name']){delete _0x40656e[_0x85ae('0x23')];}_0x51fec5[_0x85ae('0x15')](_0x35db9d)[_0x85ae('0x24')](_0x40656e);};}exports[_0x85ae('0x25')]=function(_0x2adbb3,_0x5c0b55){var _0xad1c93={},_0x508d10={},_0x46d908={'count':0x0,'rows':[]};var _0x2155f9=_[_0x85ae('0x26')](db[_0x85ae('0x27')][_0x85ae('0x28')],function(_0x2747cf){return{'name':_0x2747cf[_0x85ae('0x29')],'type':_0x2747cf[_0x85ae('0x2a')][_0x85ae('0x2b')]};});_0x508d10[_0x85ae('0x2c')]=_[_0x85ae('0x26')](_0x2155f9,_0x85ae('0x23'));_0x508d10[_0x85ae('0x2d')]=_[_0x85ae('0x2e')](_0x2adbb3[_0x85ae('0x2d')]);_0x508d10['filters']=_['intersection'](_0x508d10['model'],_0x508d10[_0x85ae('0x2d')]);_0xad1c93[_0x85ae('0x2f')]=_[_0x85ae('0x30')](_0x508d10[_0x85ae('0x2c')],qs[_0x85ae('0x31')](_0x2adbb3['query'][_0x85ae('0x31')]));_0xad1c93[_0x85ae('0x2f')]=_0xad1c93[_0x85ae('0x2f')][_0x85ae('0x32')]?_0xad1c93[_0x85ae('0x2f')]:_0x508d10['model'];if(!_0x2adbb3[_0x85ae('0x2d')][_0x85ae('0x33')](_0x85ae('0x34'))){_0xad1c93[_0x85ae('0x1a')]=qs[_0x85ae('0x1a')](_0x2adbb3['query']['limit']);_0xad1c93[_0x85ae('0x18')]=qs[_0x85ae('0x18')](_0x2adbb3[_0x85ae('0x2d')]['offset']);}_0xad1c93[_0x85ae('0x35')]=qs[_0x85ae('0x36')](_0x2adbb3[_0x85ae('0x2d')][_0x85ae('0x36')]);_0xad1c93[_0x85ae('0x37')]=qs['filters'](_[_0x85ae('0x38')](_0x2adbb3[_0x85ae('0x2d')],_0x508d10[_0x85ae('0x39')]),_0x2155f9);if(_0x2adbb3[_0x85ae('0x2d')][_0x85ae('0x3a')]){_0xad1c93['where']=_['merge'](_0xad1c93[_0x85ae('0x37')],{'$or':_[_0x85ae('0x26')](_0x2155f9,function(_0x1227d1){if(_0x1227d1[_0x85ae('0x2a')]!==_0x85ae('0x3b')){var _0x26d7c9={};_0x26d7c9[_0x1227d1[_0x85ae('0x23')]]={'$like':'%'+_0x2adbb3[_0x85ae('0x2d')]['filter']+'%'};return _0x26d7c9;}})});}_0xad1c93=_['merge']({},_0xad1c93,_0x2adbb3[_0x85ae('0x3c')]);var _0x46ff44={'where':_0xad1c93[_0x85ae('0x37')]};return db['JscriptySessionReport'][_0x85ae('0x1b')](_0x46ff44)[_0x85ae('0x1f')](function(_0x4b60d9){_0x46d908[_0x85ae('0x1b')]=_0x4b60d9;if(_0x2adbb3['query'][_0x85ae('0x3d')]){_0xad1c93['include']=[{'all':!![]}];}return db[_0x85ae('0x27')][_0x85ae('0x3e')](_0xad1c93);})[_0x85ae('0x1f')](function(_0x30aa86){_0x46d908['rows']=_0x30aa86;return _0x46d908;})[_0x85ae('0x1f')](respondWithFilteredResult(_0x5c0b55,_0xad1c93))[_0x85ae('0x3f')](handleError(_0x5c0b55,null));};exports[_0x85ae('0x40')]=function(_0x13494b,_0x1a2108){var _0x5c6832={'raw':!![],'where':{'id':_0x13494b[_0x85ae('0x41')]['id']}},_0x132ca9={};_0x132ca9[_0x85ae('0x2c')]=_[_0x85ae('0x2e')](db['JscriptySessionReport'][_0x85ae('0x28')]);_0x132ca9[_0x85ae('0x2d')]=_[_0x85ae('0x2e')](_0x13494b['query']);_0x132ca9[_0x85ae('0x39')]=_[_0x85ae('0x30')](_0x132ca9['model'],_0x132ca9['query']);_0x5c6832[_0x85ae('0x2f')]=_[_0x85ae('0x30')](_0x132ca9[_0x85ae('0x2c')],qs[_0x85ae('0x31')](_0x13494b[_0x85ae('0x2d')][_0x85ae('0x31')]));_0x5c6832[_0x85ae('0x2f')]=_0x5c6832[_0x85ae('0x2f')][_0x85ae('0x32')]?_0x5c6832[_0x85ae('0x2f')]:_0x132ca9['model'];if(_0x13494b[_0x85ae('0x2d')]['includeAll']){_0x5c6832[_0x85ae('0x42')]=[{'all':!![]}];}_0x5c6832=_[_0x85ae('0x43')]({},_0x5c6832,_0x13494b[_0x85ae('0x3c')]);return db['JscriptySessionReport'][_0x85ae('0x44')](_0x5c6832)[_0x85ae('0x1f')](handleEntityNotFound(_0x1a2108,null))['then'](respondWithResult(_0x1a2108,null))['catch'](handleError(_0x1a2108,null));};exports[_0x85ae('0x45')]=function(_0x5310c0,_0x91687c){return db['JscriptySessionReport'][_0x85ae('0x45')](_0x5310c0['body'],{})[_0x85ae('0x1f')](respondWithResult(_0x91687c,0xc9))[_0x85ae('0x3f')](handleError(_0x91687c,null));};exports[_0x85ae('0x1e')]=function(_0x5285cc,_0x5a4e93){if(_0x5285cc[_0x85ae('0x46')]['id']){delete _0x5285cc[_0x85ae('0x46')]['id'];}return db[_0x85ae('0x27')][_0x85ae('0x44')]({'where':{'id':_0x5285cc['params']['id']}})['then'](handleEntityNotFound(_0x5a4e93,null))[_0x85ae('0x1f')](saveUpdates(_0x5285cc[_0x85ae('0x46')],null))[_0x85ae('0x1f')](respondWithResult(_0x5a4e93,null))[_0x85ae('0x3f')](handleError(_0x5a4e93,null));};exports[_0x85ae('0x47')]=function(_0x16ba0d,_0x5b5c88){return db['JscriptySessionReport'][_0x85ae('0x44')]({'where':{'id':_0x16ba0d['params']['id']}})[_0x85ae('0x1f')](handleEntityNotFound(_0x5b5c88,null))[_0x85ae('0x1f')](removeEntity(_0x5b5c88,null))[_0x85ae('0x3f')](handleError(_0x5b5c88,null));};exports[_0x85ae('0x48')]=function(_0x36f861,_0x43f12e){return db[_0x85ae('0x27')][_0x85ae('0x48')]()['then'](respondWithResult(_0x43f12e,null))[_0x85ae('0x3f')](handleError(_0x43f12e,null));};exports[_0x85ae('0x49')]=function(_0x8b26e7,_0x25dacc,_0x8e67bc){var _0x3e7a8e={'raw':!![],'where':{}};var _0x3c1c3e={};var _0x1e0701={'count':0x0,'rows':[]};return db[_0x85ae('0x27')][_0x85ae('0x4a')]({'where':{'id':_0x8b26e7[_0x85ae('0x41')]['id']}})[_0x85ae('0x1f')](handleEntityNotFound(_0x25dacc,null))[_0x85ae('0x1f')](function(_0x496121){if(_0x496121){_0x3c1c3e[_0x85ae('0x2c')]=_[_0x85ae('0x2e')](db[_0x85ae('0x4b')][_0x85ae('0x28')]);_0x3c1c3e[_0x85ae('0x2d')]=_[_0x85ae('0x2e')](_0x8b26e7[_0x85ae('0x2d')]);_0x3c1c3e[_0x85ae('0x39')]=_[_0x85ae('0x30')](_0x3c1c3e[_0x85ae('0x2c')],_0x3c1c3e[_0x85ae('0x2d')]);_0x3e7a8e[_0x85ae('0x2f')]=_[_0x85ae('0x30')](_0x3c1c3e['model'],qs[_0x85ae('0x31')](_0x8b26e7[_0x85ae('0x2d')]['fields']));_0x3e7a8e[_0x85ae('0x2f')]=_0x3e7a8e[_0x85ae('0x2f')][_0x85ae('0x32')]?_0x3e7a8e[_0x85ae('0x2f')]:_0x3c1c3e['model'];if(!_0x8b26e7['query']['hasOwnProperty'](_0x85ae('0x34'))){_0x3e7a8e[_0x85ae('0x1a')]=qs[_0x85ae('0x1a')](_0x8b26e7[_0x85ae('0x2d')][_0x85ae('0x1a')]);_0x3e7a8e['offset']=qs['offset'](_0x8b26e7['query'][_0x85ae('0x18')]);}_0x3e7a8e[_0x85ae('0x35')]=qs['sort'](_0x8b26e7[_0x85ae('0x2d')][_0x85ae('0x36')]);_0x3e7a8e[_0x85ae('0x37')]=qs[_0x85ae('0x39')](_[_0x85ae('0x38')](_0x8b26e7[_0x85ae('0x2d')],_0x3c1c3e['filters']));_0x3e7a8e['where'][_0x85ae('0x4c')]=_0x496121['id'];if(_0x8b26e7['query'][_0x85ae('0x3a')]){_0x3e7a8e[_0x85ae('0x37')]=_[_0x85ae('0x43')](_0x3e7a8e[_0x85ae('0x37')],{'$or':_[_0x85ae('0x26')](_0x3e7a8e['attributes'],function(_0x153f6a){var _0x1c508f={};_0x1c508f[_0x153f6a]={'$like':'%'+_0x8b26e7[_0x85ae('0x2d')][_0x85ae('0x3a')]+'%'};return _0x1c508f;})});}_0x3e7a8e=_['merge']({},_0x3e7a8e,_0x8b26e7[_0x85ae('0x3c')]);return db[_0x85ae('0x4b')]['count']({'where':_0x3e7a8e['where']})[_0x85ae('0x1f')](function(_0x53b741){_0x1e0701[_0x85ae('0x1b')]=_0x53b741;if(_0x8b26e7[_0x85ae('0x2d')]['includeAll']){_0x3e7a8e[_0x85ae('0x42')]=[{'all':!![]}];}return db[_0x85ae('0x4b')]['findAll'](_0x3e7a8e);})[_0x85ae('0x1f')](function(_0x49e92f){_0x1e0701[_0x85ae('0x4d')]=_0x49e92f;return _0x1e0701;});}})[_0x85ae('0x1f')](respondWithFilteredResult(_0x25dacc,_0x3e7a8e))['catch'](handleError(_0x25dacc,null));}; \ No newline at end of file +var _0x4abc=['includeAll','include','findAll','show','params','find','catch','create','body','update','getQuestions','findOne','order','JscriptyQuestionReport','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','destroy','then','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x2e7652,_0x50646a){var _0x30d0ab=function(_0x45f594){while(--_0x45f594){_0x2e7652['push'](_0x2e7652['shift']());}};_0x30d0ab(++_0x50646a);}(_0x4abc,0xad));var _0xc4ab=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x4abc[_0x476bf4];return _0x788ffe;};'use strict';var emlformat=require(_0xc4ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4ab('0x1'));var jsonpatch=require(_0xc4ab('0x2'));var rp=require(_0xc4ab('0x3'));var moment=require(_0xc4ab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc4ab('0x5'));var util=require(_0xc4ab('0x6'));var path=require(_0xc4ab('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(_0xc4ab('0x8'));var squel=require(_0xc4ab('0x9'));var crypto=require(_0xc4ab('0xa'));var jsforce=require(_0xc4ab('0xb'));var deskjs=require(_0xc4ab('0xc'));var toCsv=require(_0xc4ab('0xd'));var querystring=require(_0xc4ab('0xe'));var Papa=require(_0xc4ab('0xf'));var Redis=require('ioredis');var authService=require(_0xc4ab('0x10'));var qs=require(_0xc4ab('0x11'));var as=require(_0xc4ab('0x12'));var hardwareService=require(_0xc4ab('0x13'));var logger=require(_0xc4ab('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc4ab('0x15'));var licenseUtil=require(_0xc4ab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2671a8,_0x3dfb1c){_0x3dfb1c=_0x3dfb1c||0xcc;return function(_0x1f3007){if(_0x1f3007){return _0x2671a8[_0xc4ab('0x17')](_0x3dfb1c);}return _0x2671a8[_0xc4ab('0x18')](_0x3dfb1c)[_0xc4ab('0x19')]();};}function respondWithResult(_0x5c975e,_0x4da4b7){_0x4da4b7=_0x4da4b7||0xc8;return function(_0x2a73da){if(_0x2a73da){return _0x5c975e['status'](_0x4da4b7)[_0xc4ab('0x1a')](_0x2a73da);}};}function respondWithFilteredResult(_0x4826f0,_0x39b2e1){return function(_0x4860e4){if(_0x4860e4){var _0x72bd29=typeof _0x39b2e1[_0xc4ab('0x1b')]===_0xc4ab('0x1c')&&typeof _0x39b2e1['limit']===_0xc4ab('0x1c');var _0x52028b=_0x4860e4[_0xc4ab('0x1d')];var _0x5a6e92=_0x72bd29?0x0:_0x39b2e1[_0xc4ab('0x1b')];var _0x155a6f=_0x72bd29?_0x4860e4[_0xc4ab('0x1d')]:_0x39b2e1[_0xc4ab('0x1b')]+_0x39b2e1['limit'];var _0x382c26;if(_0x155a6f>=_0x52028b){_0x155a6f=_0x52028b;_0x382c26=0xc8;}else{_0x382c26=0xce;}_0x4826f0['status'](_0x382c26);return _0x4826f0[_0xc4ab('0x1e')](_0xc4ab('0x1f'),_0x5a6e92+'-'+_0x155a6f+'/'+_0x52028b)['json'](_0x4860e4);}return null;};}function patchUpdates(_0x2499cc){return function(_0x216593){try{jsonpatch[_0xc4ab('0x20')](_0x216593,_0x2499cc,!![]);}catch(_0x559bc3){return BPromise[_0xc4ab('0x21')](_0x559bc3);}return _0x216593['save']();};}function saveUpdates(_0x121027,_0x463d67){return function(_0x33a395){if(_0x33a395){return _0x33a395['update'](_0x121027)['then'](function(_0x2751b6){return _0x2751b6;});}return null;};}function removeEntity(_0x5c7a23,_0xc8a3cf){return function(_0x378200){if(_0x378200){return _0x378200[_0xc4ab('0x22')]()[_0xc4ab('0x23')](function(){_0x5c7a23[_0xc4ab('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524249,_0x2b18ca){return function(_0x5d3d6c){if(!_0x5d3d6c){_0x524249['sendStatus'](0x194);}return _0x5d3d6c;};}function handleError(_0x5e4089,_0x5081f5){_0x5081f5=_0x5081f5||0x1f4;return function(_0x489dcb){logger[_0xc4ab('0x24')](_0x489dcb['stack']);if(_0x489dcb[_0xc4ab('0x25')]){delete _0x489dcb['name'];}_0x5e4089[_0xc4ab('0x18')](_0x5081f5)[_0xc4ab('0x26')](_0x489dcb);};}exports[_0xc4ab('0x27')]=function(_0xf15e10,_0x123b2c){var _0x29b34d={},_0x5b70a1={},_0x4c8121={'count':0x0,'rows':[]};var _0x279f09=_[_0xc4ab('0x28')](db[_0xc4ab('0x29')][_0xc4ab('0x2a')],function(_0x5d3130){return{'name':_0x5d3130[_0xc4ab('0x2b')],'type':_0x5d3130[_0xc4ab('0x2c')][_0xc4ab('0x2d')]};});_0x5b70a1[_0xc4ab('0x2e')]=_[_0xc4ab('0x28')](_0x279f09,'name');_0x5b70a1['query']=_[_0xc4ab('0x2f')](_0xf15e10['query']);_0x5b70a1['filters']=_['intersection'](_0x5b70a1['model'],_0x5b70a1[_0xc4ab('0x30')]);_0x29b34d[_0xc4ab('0x31')]=_[_0xc4ab('0x32')](_0x5b70a1['model'],qs['fields'](_0xf15e10['query'][_0xc4ab('0x33')]));_0x29b34d[_0xc4ab('0x31')]=_0x29b34d['attributes'][_0xc4ab('0x34')]?_0x29b34d[_0xc4ab('0x31')]:_0x5b70a1[_0xc4ab('0x2e')];if(!_0xf15e10[_0xc4ab('0x30')][_0xc4ab('0x35')](_0xc4ab('0x36'))){_0x29b34d[_0xc4ab('0x37')]=qs['limit'](_0xf15e10['query']['limit']);_0x29b34d[_0xc4ab('0x1b')]=qs['offset'](_0xf15e10[_0xc4ab('0x30')]['offset']);}_0x29b34d['order']=qs[_0xc4ab('0x38')](_0xf15e10[_0xc4ab('0x30')][_0xc4ab('0x38')]);_0x29b34d[_0xc4ab('0x39')]=qs[_0xc4ab('0x3a')](_[_0xc4ab('0x3b')](_0xf15e10[_0xc4ab('0x30')],_0x5b70a1[_0xc4ab('0x3a')]),_0x279f09);if(_0xf15e10[_0xc4ab('0x30')]['filter']){_0x29b34d[_0xc4ab('0x39')]=_[_0xc4ab('0x3c')](_0x29b34d[_0xc4ab('0x39')],{'$or':_[_0xc4ab('0x28')](_0x279f09,function(_0x31fe71){if(_0x31fe71[_0xc4ab('0x2c')]!==_0xc4ab('0x3d')){var _0x5f16fb={};_0x5f16fb[_0x31fe71[_0xc4ab('0x25')]]={'$like':'%'+_0xf15e10[_0xc4ab('0x30')][_0xc4ab('0x3e')]+'%'};return _0x5f16fb;}})});}_0x29b34d=_[_0xc4ab('0x3c')]({},_0x29b34d,_0xf15e10[_0xc4ab('0x3f')]);var _0xdbd98={'where':_0x29b34d[_0xc4ab('0x39')]};return db[_0xc4ab('0x29')]['count'](_0xdbd98)[_0xc4ab('0x23')](function(_0x1a8d46){_0x4c8121[_0xc4ab('0x1d')]=_0x1a8d46;if(_0xf15e10[_0xc4ab('0x30')][_0xc4ab('0x40')]){_0x29b34d[_0xc4ab('0x41')]=[{'all':!![]}];}return db[_0xc4ab('0x29')][_0xc4ab('0x42')](_0x29b34d);})['then'](function(_0x54ad23){_0x4c8121['rows']=_0x54ad23;return _0x4c8121;})[_0xc4ab('0x23')](respondWithFilteredResult(_0x123b2c,_0x29b34d))['catch'](handleError(_0x123b2c,null));};exports[_0xc4ab('0x43')]=function(_0x2a0c96,_0x42fb0c){var _0x2223bc={'raw':!![],'where':{'id':_0x2a0c96[_0xc4ab('0x44')]['id']}},_0x5c2629={};_0x5c2629[_0xc4ab('0x2e')]=_[_0xc4ab('0x2f')](db['JscriptySessionReport'][_0xc4ab('0x2a')]);_0x5c2629['query']=_[_0xc4ab('0x2f')](_0x2a0c96['query']);_0x5c2629['filters']=_[_0xc4ab('0x32')](_0x5c2629[_0xc4ab('0x2e')],_0x5c2629[_0xc4ab('0x30')]);_0x2223bc[_0xc4ab('0x31')]=_[_0xc4ab('0x32')](_0x5c2629[_0xc4ab('0x2e')],qs[_0xc4ab('0x33')](_0x2a0c96[_0xc4ab('0x30')][_0xc4ab('0x33')]));_0x2223bc[_0xc4ab('0x31')]=_0x2223bc[_0xc4ab('0x31')][_0xc4ab('0x34')]?_0x2223bc['attributes']:_0x5c2629[_0xc4ab('0x2e')];if(_0x2a0c96[_0xc4ab('0x30')][_0xc4ab('0x40')]){_0x2223bc[_0xc4ab('0x41')]=[{'all':!![]}];}_0x2223bc=_['merge']({},_0x2223bc,_0x2a0c96[_0xc4ab('0x3f')]);return db[_0xc4ab('0x29')][_0xc4ab('0x45')](_0x2223bc)['then'](handleEntityNotFound(_0x42fb0c,null))[_0xc4ab('0x23')](respondWithResult(_0x42fb0c,null))[_0xc4ab('0x46')](handleError(_0x42fb0c,null));};exports[_0xc4ab('0x47')]=function(_0x287195,_0x2efe6a){return db['JscriptySessionReport'][_0xc4ab('0x47')](_0x287195[_0xc4ab('0x48')],{})[_0xc4ab('0x23')](respondWithResult(_0x2efe6a,0xc9))[_0xc4ab('0x46')](handleError(_0x2efe6a,null));};exports[_0xc4ab('0x49')]=function(_0x462f8f,_0x10bba5){if(_0x462f8f[_0xc4ab('0x48')]['id']){delete _0x462f8f[_0xc4ab('0x48')]['id'];}return db[_0xc4ab('0x29')][_0xc4ab('0x45')]({'where':{'id':_0x462f8f[_0xc4ab('0x44')]['id']}})['then'](handleEntityNotFound(_0x10bba5,null))['then'](saveUpdates(_0x462f8f[_0xc4ab('0x48')],null))[_0xc4ab('0x23')](respondWithResult(_0x10bba5,null))[_0xc4ab('0x46')](handleError(_0x10bba5,null));};exports[_0xc4ab('0x22')]=function(_0x49211e,_0x3d5b4a){return db[_0xc4ab('0x29')][_0xc4ab('0x45')]({'where':{'id':_0x49211e[_0xc4ab('0x44')]['id']}})[_0xc4ab('0x23')](handleEntityNotFound(_0x3d5b4a,null))[_0xc4ab('0x23')](removeEntity(_0x3d5b4a,null))[_0xc4ab('0x46')](handleError(_0x3d5b4a,null));};exports['describe']=function(_0x16ff14,_0x2655e1){return db[_0xc4ab('0x29')]['describe']()[_0xc4ab('0x23')](respondWithResult(_0x2655e1,null))['catch'](handleError(_0x2655e1,null));};exports[_0xc4ab('0x4a')]=function(_0xa8c3cf,_0x15cff3,_0x146381){var _0x268638={'raw':!![],'where':{}};var _0x32e589={};var _0x4ab6f6={'count':0x0,'rows':[]};return db[_0xc4ab('0x29')][_0xc4ab('0x4b')]({'where':{'id':_0xa8c3cf[_0xc4ab('0x44')]['id']}})[_0xc4ab('0x23')](handleEntityNotFound(_0x15cff3,null))[_0xc4ab('0x23')](function(_0x11f475){if(_0x11f475){_0x32e589[_0xc4ab('0x2e')]=_[_0xc4ab('0x2f')](db['JscriptyQuestionReport'][_0xc4ab('0x2a')]);_0x32e589[_0xc4ab('0x30')]=_[_0xc4ab('0x2f')](_0xa8c3cf['query']);_0x32e589[_0xc4ab('0x3a')]=_[_0xc4ab('0x32')](_0x32e589[_0xc4ab('0x2e')],_0x32e589[_0xc4ab('0x30')]);_0x268638['attributes']=_['intersection'](_0x32e589['model'],qs['fields'](_0xa8c3cf[_0xc4ab('0x30')][_0xc4ab('0x33')]));_0x268638[_0xc4ab('0x31')]=_0x268638['attributes']['length']?_0x268638['attributes']:_0x32e589[_0xc4ab('0x2e')];if(!_0xa8c3cf[_0xc4ab('0x30')]['hasOwnProperty'](_0xc4ab('0x36'))){_0x268638[_0xc4ab('0x37')]=qs[_0xc4ab('0x37')](_0xa8c3cf[_0xc4ab('0x30')][_0xc4ab('0x37')]);_0x268638[_0xc4ab('0x1b')]=qs[_0xc4ab('0x1b')](_0xa8c3cf[_0xc4ab('0x30')][_0xc4ab('0x1b')]);}_0x268638[_0xc4ab('0x4c')]=qs[_0xc4ab('0x38')](_0xa8c3cf[_0xc4ab('0x30')][_0xc4ab('0x38')]);_0x268638[_0xc4ab('0x39')]=qs[_0xc4ab('0x3a')](_[_0xc4ab('0x3b')](_0xa8c3cf['query'],_0x32e589[_0xc4ab('0x3a')]));_0x268638[_0xc4ab('0x39')]['SessionId']=_0x11f475['id'];if(_0xa8c3cf[_0xc4ab('0x30')][_0xc4ab('0x3e')]){_0x268638[_0xc4ab('0x39')]=_['merge'](_0x268638['where'],{'$or':_[_0xc4ab('0x28')](_0x268638[_0xc4ab('0x31')],function(_0x2d3e97){var _0x3055ab={};_0x3055ab[_0x2d3e97]={'$like':'%'+_0xa8c3cf['query'][_0xc4ab('0x3e')]+'%'};return _0x3055ab;})});}_0x268638=_['merge']({},_0x268638,_0xa8c3cf[_0xc4ab('0x3f')]);return db[_0xc4ab('0x4d')][_0xc4ab('0x1d')]({'where':_0x268638[_0xc4ab('0x39')]})[_0xc4ab('0x23')](function(_0x519357){_0x4ab6f6[_0xc4ab('0x1d')]=_0x519357;if(_0xa8c3cf[_0xc4ab('0x30')]['includeAll']){_0x268638['include']=[{'all':!![]}];}return db[_0xc4ab('0x4d')][_0xc4ab('0x42')](_0x268638);})[_0xc4ab('0x23')](function(_0x3b5def){_0x4ab6f6[_0xc4ab('0x4e')]=_0x3b5def;return _0x4ab6f6;});}})[_0xc4ab('0x23')](respondWithFilteredResult(_0x15cff3,_0x268638))[_0xc4ab('0x46')](handleError(_0x15cff3,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 6d635ab..10f7600 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 _0x1623=['lodash','api','moment','bluebird','request-promise','path','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions'];(function(_0x416f0d,_0x299fb9){var _0x2f9c17=function(_0x2f0b72){while(--_0x2f0b72){_0x416f0d['push'](_0x416f0d['shift']());}};_0x2f9c17(++_0x299fb9);}(_0x1623,0xab));var _0x3162=function(_0x51a040,_0x53766b){_0x51a040=_0x51a040-0x0;var _0x5e55dd=_0x1623[_0x51a040];return _0x5e55dd;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x233168,_0x583280){var _0x141f26=function(_0xe6ac08){while(--_0xe6ac08){_0x233168['push'](_0x233168['shift']());}};_0x141f26(++_0x583280);}(_0x4745,0x1e7));var _0x5474=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4745[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('JscriptySessionReport',attributes,{'tableName':_0x5474('0xd'),'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 fc9d308..0fc4052 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 _0xb145=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message'];(function(_0x3a8125,_0x3924d4){var _0x17123e=function(_0x3c1e45){while(--_0x3c1e45){_0x3a8125['push'](_0x3a8125['shift']());}};_0x17123e(++_0x3924d4);}(_0xb145,0xa3));var _0x5b14=function(_0x283fc9,_0x441da6){_0x283fc9=_0x283fc9-0x0;var _0x3e0e3f=_0xb145[_0x283fc9];return _0x3e0e3f;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});} \ No newline at end of file +var _0x0424=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x0424,0x159));var _0x4042=function(_0x487d0a,_0x1b7cb4){_0x487d0a=_0x487d0a-0x0;var _0x3d740c=_0x0424[_0x487d0a];return _0x3d740c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 290c9f8..4f1c0e0 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 _0x972c=['path','connect-timeout','Router','fs-extra','../../config/environment','./license.controller','get','put','isAuthenticated','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x972c,0xf2));var _0xc972=function(_0x19688b,_0x203425){_0x19688b=_0x19688b-0x0;var _0x29df75=_0x972c[_0x19688b];return _0x29df75;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc972('0x0'));var timeout=require(_0xc972('0x1'));var express=require('express');var router=express[_0xc972('0x2')]();var fs_extra=require(_0xc972('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc972('0x4'));var controller=require(_0xc972('0x5'));router[_0xc972('0x6')]('/',controller['index']);router[_0xc972('0x7')]('/:id',auth[_0xc972('0x8')](),controller[_0xc972('0x9')]);module[_0xc972('0xa')]=router; \ No newline at end of file +var _0x4ce6=['put','isAuthenticated','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index'];(function(_0x186787,_0x4a5de2){var _0x3f5a8f=function(_0x528554){while(--_0x528554){_0x186787['push'](_0x186787['shift']());}};_0x3f5a8f(++_0x4a5de2);}(_0x4ce6,0x108));var _0x64ce=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x4ce6[_0x393d69];return _0x3cee37;};'use strict';var multer=require(_0x64ce('0x0'));var util=require('util');var path=require(_0x64ce('0x1'));var timeout=require(_0x64ce('0x2'));var express=require(_0x64ce('0x3'));var router=express[_0x64ce('0x4')]();var fs_extra=require(_0x64ce('0x5'));var auth=require(_0x64ce('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x64ce('0x7'));var controller=require('./license.controller');router['get']('/',controller[_0x64ce('0x8')]);router[_0x64ce('0x9')]('/:id',auth[_0x64ce('0xa')](),controller[_0x64ce('0xb')]);module[_0x64ce('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index cd527a2..0e573f9 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 _0x571c=['INTEGER','sequelize','TEXT','STRING'];(function(_0x3d32f7,_0x2f9329){var _0x8fdde5=function(_0x347943){while(--_0x347943){_0x3d32f7['push'](_0x3d32f7['shift']());}};_0x8fdde5(++_0x2f9329);}(_0x571c,0x131));var _0xc571=function(_0x7ad7c1,_0x4b1e53){_0x7ad7c1=_0x7ad7c1-0x0;var _0x14cee5=_0x571c[_0x7ad7c1];return _0x14cee5;};'use strict';var Sequelize=require(_0xc571('0x0'));module['exports']={'license':{'type':Sequelize[_0xc571('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc571('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xc571('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc0e0=['sequelize','exports','TEXT','STRING'];(function(_0x1eb359,_0x4cda30){var _0x3fdf23=function(_0x30cc7b){while(--_0x30cc7b){_0x1eb359['push'](_0x1eb359['shift']());}};_0x3fdf23(++_0x4cda30);}(_0xc0e0,0x118));var _0x0c0e=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc0e0[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x0c0e('0x0'));module[_0x0c0e('0x1')]={'license':{'type':Sequelize[_0x0c0e('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x0c0e('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 4927ba6..d2df6da 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 _0x2ef3=['length','options','then','catch','body','params','get','checkLicense','demo','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','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x5e3d80,_0xd64712){var _0x3e7615=function(_0x49c1d2){while(--_0x49c1d2){_0x5e3d80['push'](_0x5e3d80['shift']());}};_0x3e7615(++_0xd64712);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f358c,_0x2976b0){_0x3f358c=_0x3f358c-0x0;var _0x31b804=_0x2ef3[_0x3f358c];return _0x31b804;};'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);};}var utilLicense=require('../../config/license/util');exports[_0x32ef('0x29')]=function(_0x2f5d06,_0x5a04cd){var _0x12de1a={'raw':!![],'where':{'id':0x1}},_0x3c569d={};_0x3c569d[_0x32ef('0x2a')]=_[_0x32ef('0x2b')](db['License'][_0x32ef('0x2c')]);_0x3c569d[_0x32ef('0x2d')]=_[_0x32ef('0x2b')](_0x2f5d06[_0x32ef('0x2d')]);_0x3c569d[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x3c569d[_0x32ef('0x2a')],_0x3c569d['query']);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x3c569d[_0x32ef('0x2a')],qs[_0x32ef('0x31')](_0x2f5d06['query'][_0x32ef('0x31')]));_0x12de1a[_0x32ef('0x30')]=_0x12de1a[_0x32ef('0x30')][_0x32ef('0x32')]?_0x12de1a[_0x32ef('0x30')]:_0x3c569d['model'];_0x12de1a=_['merge']({},_0x12de1a,_0x2f5d06[_0x32ef('0x33')]);return utilLicense['getLicense'](_0x12de1a)[_0x32ef('0x34')](respondWithResult(_0x5a04cd,null))[_0x32ef('0x35')](handleError(_0x5a04cd,null));};exports[_0x32ef('0x24')]=function(_0x390670,_0x389583){if(_0x390670[_0x32ef('0x36')]['id']){delete _0x390670['body']['id'];}return db['License']['find']({'where':{'id':_0x390670[_0x32ef('0x37')]['id']}})[_0x32ef('0x34')](handleEntityNotFound(_0x389583,null))[_0x32ef('0x34')](function(_0x5f2443){var _0x4fb402=_0x5f2443[_0x32ef('0x38')]({'plain':!![]});return utilLicense[_0x32ef('0x39')](_0x4fb402,_0x390670[_0x32ef('0x36')]['key']);})['then'](function(_0xcbdec8){if(!_0xcbdec8[_0x32ef('0x3a')]){return saveUpdates(_0x390670[_0x32ef('0x36')],null);}return _0xcbdec8;})[_0x32ef('0x34')](respondWithResult(_0x389583,null))[_0x32ef('0x35')](handleError(_0x389583,null));}; \ No newline at end of file +var _0x1261=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','index','model','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','params','get','key','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x162879,_0x2b0df8){var _0x52bffb=function(_0x423746){while(--_0x423746){_0x162879['push'](_0x162879['shift']());}};_0x52bffb(++_0x2b0df8);}(_0x1261,0x144));var _0x1126=function(_0x42b030,_0x252cb6){_0x42b030=_0x42b030-0x0;var _0x112303=_0x1261[_0x42b030];return _0x112303;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}var utilLicense=require('../../config/license/util');exports[_0x1126('0x29')]=function(_0x23d2bc,_0x4a334a){var _0x3fa694={'raw':!![],'where':{'id':0x1}},_0x4bf807={};_0x4bf807[_0x1126('0x2a')]=_['keys'](db[_0x1126('0x2b')]['rawAttributes']);_0x4bf807[_0x1126('0x2c')]=_['keys'](_0x23d2bc['query']);_0x4bf807['filters']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],_0x4bf807[_0x1126('0x2c')]);_0x3fa694['attributes']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],qs['fields'](_0x23d2bc[_0x1126('0x2c')][_0x1126('0x2e')]));_0x3fa694[_0x1126('0x2f')]=_0x3fa694[_0x1126('0x2f')]['length']?_0x3fa694['attributes']:_0x4bf807[_0x1126('0x2a')];_0x3fa694=_[_0x1126('0x30')]({},_0x3fa694,_0x23d2bc[_0x1126('0x31')]);return utilLicense[_0x1126('0x32')](_0x3fa694)['then'](respondWithResult(_0x4a334a,null))[_0x1126('0x33')](handleError(_0x4a334a,null));};exports[_0x1126('0x24')]=function(_0x313ebe,_0x22436c){if(_0x313ebe[_0x1126('0x34')]['id']){delete _0x313ebe['body']['id'];}return db[_0x1126('0x2b')][_0x1126('0x35')]({'where':{'id':_0x313ebe[_0x1126('0x36')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x22436c,null))['then'](function(_0x4ca51c){var _0x22827a=_0x4ca51c[_0x1126('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x22827a,_0x313ebe[_0x1126('0x34')][_0x1126('0x38')]);})[_0x1126('0x25')](function(_0x5c08b9){if(!_0x5c08b9['demo']){return saveUpdates(_0x313ebe[_0x1126('0x34')],null);}return _0x5c08b9;})[_0x1126('0x25')](respondWithResult(_0x22436c,null))[_0x1126('0x33')](handleError(_0x22436c,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f66a056..f838a77 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 _0xbcd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./license.attributes','define','lodash'];(function(_0x164059,_0xa3c4ca){var _0x816457=function(_0x5b1089){while(--_0x5b1089){_0x164059['push'](_0x164059['shift']());}};_0x816457(++_0xa3c4ca);}(_0xbcd9,0x1f3));var _0x9bcd=function(_0x291d9c,_0x35b226){_0x291d9c=_0x291d9c-0x0;var _0x1b9cbb=_0xbcd9[_0x291d9c];return _0x1b9cbb;};'use strict';var _=require(_0x9bcd('0x0'));var util=require('util');var logger=require(_0x9bcd('0x1'))(_0x9bcd('0x2'));var moment=require(_0x9bcd('0x3'));var BPromise=require(_0x9bcd('0x4'));var rp=require(_0x9bcd('0x5'));var fs=require('fs');var path=require(_0x9bcd('0x6'));var rimraf=require(_0x9bcd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9bcd('0x8'));module['exports']=function(_0xdb1c1e,_0x28d48c){return _0xdb1c1e[_0x9bcd('0x9')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7157=['exports','define','License','license','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./license.attributes'];(function(_0x56407a,_0x34ad4c){var _0x5530ff=function(_0x41eb29){while(--_0x41eb29){_0x56407a['push'](_0x56407a['shift']());}};_0x5530ff(++_0x34ad4c);}(_0x7157,0xdc));var _0x7715=function(_0x3721dd,_0x1fd293){_0x3721dd=_0x3721dd-0x0;var _0xb8b14e=_0x7157[_0x3721dd];return _0xb8b14e;};'use strict';var _=require(_0x7715('0x0'));var util=require(_0x7715('0x1'));var logger=require('../../config/logger')(_0x7715('0x2'));var moment=require(_0x7715('0x3'));var BPromise=require(_0x7715('0x4'));var rp=require(_0x7715('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7715('0x6'));var attributes=require(_0x7715('0x7'));module[_0x7715('0x8')]=function(_0x2d9ac1,_0x4fae78){return _0x2d9ac1[_0x7715('0x9')](_0x7715('0xa'),attributes,{'tableName':_0x7715('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index c5a38e7..2b07b87 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 _0x9c98=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','License,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x146ce7,_0x14b64d){var _0x56c65d=function(_0x12db3d){while(--_0x12db3d){_0x146ce7['push'](_0x146ce7['shift']());}};_0x56c65d(++_0x14b64d);}(_0x9c98,0x148));var _0x89c9=function(_0x562b3c,_0x50b4aa){_0x562b3c=_0x562b3c-0x0;var _0x3f88e6=_0x9c98[_0x562b3c];return _0x3f88e6;};'use strict';var _=require('lodash');var util=require(_0x89c9('0x0'));var moment=require(_0x89c9('0x1'));var BPromise=require(_0x89c9('0x2'));var rs=require(_0x89c9('0x3'));var fs=require('fs');var Redis=require(_0x89c9('0x4'));var db=require(_0x89c9('0x5'))['db'];var utils=require(_0x89c9('0x6'));var logger=require(_0x89c9('0x7'))(_0x89c9('0x8'));var config=require(_0x89c9('0x9'));var jayson=require(_0x89c9('0xa'));var client=jayson[_0x89c9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c3318,_0x501693,_0x415ab2){return new BPromise(function(_0x50c07a,_0x1efefe){return client[_0x89c9('0xc')](_0x1c3318,_0x415ab2)['then'](function(_0x154c2f){logger['info'](_0x89c9('0xd'),_0x501693,'request\x20sent');logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x501693,_0x89c9('0xe'),JSON[_0x89c9('0xf')](_0x154c2f));if(_0x154c2f[_0x89c9('0x10')]){if(_0x154c2f[_0x89c9('0x10')][_0x89c9('0x11')]===0x1f4){logger[_0x89c9('0x10')]('License,\x20%s,\x20%s',_0x501693,_0x154c2f[_0x89c9('0x10')][_0x89c9('0x12')]);return _0x1efefe(_0x154c2f['error']['message']);}logger[_0x89c9('0x10')](_0x89c9('0xd'),_0x501693,_0x154c2f[_0x89c9('0x10')][_0x89c9('0x12')]);return _0x50c07a(_0x154c2f['error'][_0x89c9('0x12')]);}else{logger[_0x89c9('0x13')](_0x89c9('0xd'),_0x501693,'request\x20sent');_0x50c07a(_0x154c2f[_0x89c9('0x14')][_0x89c9('0x12')]);}})[_0x89c9('0x15')](function(_0x3445ab){logger[_0x89c9('0x10')](_0x89c9('0xd'),_0x501693,_0x3445ab);_0x1efefe(_0x3445ab);});});} \ No newline at end of file +var _0x294a=['rpc','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x48add7,_0x416906){var _0x16e4c7=function(_0x4b3701){while(--_0x4b3701){_0x48add7['push'](_0x48add7['shift']());}};_0x16e4c7(++_0x416906);}(_0x294a,0xf1));var _0xa294=function(_0x1eaf9a,_0x4a10c3){_0x1eaf9a=_0x1eaf9a-0x0;var _0x1fbedb=_0x294a[_0x1eaf9a];return _0x1fbedb;};'use strict';var _=require('lodash');var util=require(_0xa294('0x0'));var moment=require(_0xa294('0x1'));var BPromise=require('bluebird');var rs=require(_0xa294('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa294('0x3'))['db'];var utils=require(_0xa294('0x4'));var logger=require(_0xa294('0x5'))(_0xa294('0x6'));var config=require('../../config/environment');var jayson=require(_0xa294('0x7'));var client=jayson['client'][_0xa294('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10013b,_0x5bf5ce,_0x3bc06b){return new BPromise(function(_0x113b2e,_0x4d4c13){return client[_0xa294('0x9')](_0x10013b,_0x3bc06b)[_0xa294('0xa')](function(_0x5c2469){logger[_0xa294('0xb')](_0xa294('0xc'),_0x5bf5ce,_0xa294('0xd'));logger['debug'](_0xa294('0xe'),_0x5bf5ce,_0xa294('0xd'),JSON[_0xa294('0xf')](_0x5c2469));if(_0x5c2469[_0xa294('0x10')]){if(_0x5c2469[_0xa294('0x10')][_0xa294('0x11')]===0x1f4){logger[_0xa294('0x10')](_0xa294('0xc'),_0x5bf5ce,_0x5c2469['error'][_0xa294('0x12')]);return _0x4d4c13(_0x5c2469[_0xa294('0x10')][_0xa294('0x12')]);}logger[_0xa294('0x10')](_0xa294('0xc'),_0x5bf5ce,_0x5c2469[_0xa294('0x10')][_0xa294('0x12')]);return _0x113b2e(_0x5c2469[_0xa294('0x10')][_0xa294('0x12')]);}else{logger['info']('License,\x20%s,\x20%s',_0x5bf5ce,_0xa294('0xd'));_0x113b2e(_0x5c2469['result'][_0xa294('0x12')]);}})['catch'](function(_0x11e73f){logger[_0xa294('0x10')](_0xa294('0xc'),_0x5bf5ce,_0x11e73f);_0x4d4c13(_0x11e73f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9018200..d64afac 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 _0x88a9=['isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','put','update','delete','removeDispositions','removeImap','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','/describe','describe','/:id'];(function(_0x5f0869,_0x2b643c){var _0x5c5ef2=function(_0x856497){while(--_0x856497){_0x5f0869['push'](_0x5f0869['shift']());}};_0x5c5ef2(++_0x2b643c);}(_0x88a9,0x10b));var _0x988a=function(_0x32f7e9,_0x2e763f){_0x32f7e9=_0x32f7e9-0x0;var _0xc147e6=_0x88a9[_0x32f7e9];return _0xc147e6;};'use strict';var multer=require('multer');var util=require(_0x988a('0x0'));var path=require(_0x988a('0x1'));var timeout=require(_0x988a('0x2'));var express=require(_0x988a('0x3'));var router=express[_0x988a('0x4')]();var fs_extra=require(_0x988a('0x5'));var auth=require(_0x988a('0x6'));var interaction=require(_0x988a('0x7'));var config=require(_0x988a('0x8'));var controller=require(_0x988a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x988a('0xa')]);router[_0x988a('0xb')](_0x988a('0xc'),auth['isAuthenticated'](),controller[_0x988a('0xd')]);router[_0x988a('0xb')](_0x988a('0xe'),auth[_0x988a('0xf')](),controller[_0x988a('0x10')]);router[_0x988a('0xb')](_0x988a('0x11'),auth[_0x988a('0xf')](),controller[_0x988a('0x12')]);router['get'](_0x988a('0x13'),auth[_0x988a('0xf')](),controller[_0x988a('0x14')]);router[_0x988a('0xb')](_0x988a('0x15'),auth[_0x988a('0xf')](),controller[_0x988a('0x16')]);router[_0x988a('0xb')]('/:id/out_servers',auth[_0x988a('0xf')](),controller['getSmtp']);router[_0x988a('0xb')](_0x988a('0x17'),auth['isAuthenticated'](),controller[_0x988a('0x18')]);router[_0x988a('0xb')](_0x988a('0x19'),auth[_0x988a('0xf')](),controller[_0x988a('0x1a')]);router['get']('/:id/messages',auth[_0x988a('0xf')](),controller[_0x988a('0x1b')]);router['get'](_0x988a('0x1c'),auth[_0x988a('0xf')](),controller[_0x988a('0x1d')]);router[_0x988a('0xb')](_0x988a('0x1e'),auth[_0x988a('0xf')](),controller[_0x988a('0x1f')]);router['post'](_0x988a('0x11'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x988a('0x20')](_0x988a('0x13'),auth[_0x988a('0xf')](),controller[_0x988a('0x21')]);router[_0x988a('0x20')]('/',auth['isAuthenticated'](),controller[_0x988a('0x22')]);router['post'](_0x988a('0x15'),auth[_0x988a('0xf')](),controller[_0x988a('0x23')]);router[_0x988a('0x20')](_0x988a('0x24'),auth[_0x988a('0xf')](),controller[_0x988a('0x25')]);router[_0x988a('0x20')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x988a('0x26')]);router[_0x988a('0x20')](_0x988a('0x19'),auth[_0x988a('0xf')](),controller['addApplications']);router['post'](_0x988a('0x27'),auth['isAuthenticated'](),controller[_0x988a('0x28')]);router['post'](_0x988a('0x1e'),auth[_0x988a('0xf')](),controller['addAgents']);router[_0x988a('0x29')]('/:id',auth['isAuthenticated'](),controller[_0x988a('0x2a')]);router[_0x988a('0x2b')](_0x988a('0x11'),auth['isAuthenticated'](),controller[_0x988a('0x2c')]);router['delete'](_0x988a('0x13'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x988a('0x2b')](_0x988a('0x15'),auth['isAuthenticated'](),controller[_0x988a('0x2d')]);router['delete'](_0x988a('0x24'),auth[_0x988a('0xf')](),controller['removeSmtp']);router[_0x988a('0x2b')]('/:id',auth[_0x988a('0xf')](),controller[_0x988a('0x2e')]);router[_0x988a('0x2b')](_0x988a('0x1e'),auth[_0x988a('0xf')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd42d=['getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','verifySmtp','/:id/users','/:id/dispositions','addDisposition','addAnswer','post','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','describe','/:id','/:id/canned_answers'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xd42d,0xcf));var _0xdd42=function(_0xe5bca,_0x56af63){_0xe5bca=_0xe5bca-0x0;var _0x32e311=_0xd42d[_0xe5bca];return _0x32e311;};'use strict';var multer=require(_0xdd42('0x0'));var util=require('util');var path=require(_0xdd42('0x1'));var timeout=require(_0xdd42('0x2'));var express=require(_0xdd42('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd42('0x4'));var interaction=require(_0xdd42('0x5'));var config=require(_0xdd42('0x6'));var controller=require(_0xdd42('0x7'));router[_0xdd42('0x8')]('/',auth[_0xdd42('0x9')](),controller['index']);router[_0xdd42('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xdd42('0xa')]);router['get'](_0xdd42('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xdd42('0x8')]('/:id/dispositions',auth[_0xdd42('0x9')](),controller['getDispositions']);router[_0xdd42('0x8')](_0xdd42('0xc'),auth[_0xdd42('0x9')](),controller[_0xdd42('0xd')]);router[_0xdd42('0x8')](_0xdd42('0xe'),auth['isAuthenticated'](),controller[_0xdd42('0xf')]);router[_0xdd42('0x8')](_0xdd42('0x10'),auth['isAuthenticated'](),controller[_0xdd42('0x11')]);router['get'](_0xdd42('0x12'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x13')]);router[_0xdd42('0x8')](_0xdd42('0x14'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x15')]);router[_0xdd42('0x8')]('/:id/messages',auth[_0xdd42('0x9')](),controller['getMessages']);router[_0xdd42('0x8')]('/:id/verify',auth[_0xdd42('0x9')](),controller[_0xdd42('0x16')]);router[_0xdd42('0x8')](_0xdd42('0x17'),auth[_0xdd42('0x9')](),controller['getAgents']);router['post'](_0xdd42('0x18'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x19')]);router['post'](_0xdd42('0xc'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x1a')]);router[_0xdd42('0x1b')]('/',auth[_0xdd42('0x9')](),controller[_0xdd42('0x1c')]);router['post'](_0xdd42('0xe'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x1d')]);router[_0xdd42('0x1b')](_0xdd42('0x10'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x1e')]);router[_0xdd42('0x1b')](_0xdd42('0x12'),auth['isAuthenticated'](),controller[_0xdd42('0x1f')]);router['post']('/:id/applications',auth[_0xdd42('0x9')](),controller[_0xdd42('0x20')]);router['post'](_0xdd42('0x21'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x22')]);router[_0xdd42('0x1b')](_0xdd42('0x17'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x23')]);router[_0xdd42('0x24')](_0xdd42('0xb'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x25')]);router[_0xdd42('0x26')](_0xdd42('0x18'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x27')]);router['delete'](_0xdd42('0xc'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x28')]);router[_0xdd42('0x26')](_0xdd42('0xe'),auth[_0xdd42('0x9')](),controller[_0xdd42('0x29')]);router[_0xdd42('0x26')]('/:id/out_servers',auth[_0xdd42('0x9')](),controller['removeSmtp']);router['delete'](_0xdd42('0xb'),auth['isAuthenticated'](),controller[_0xdd42('0x2a')]);router[_0xdd42('0x26')](_0xdd42('0x17'),auth[_0xdd42('0x9')](),controller['removeAgents']);module[_0xdd42('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 522a3c3..e591689 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 _0xa9b1=['mandatoryDisposition','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x488814,_0x3fec59){var _0x58138b=function(_0x575c59){while(--_0x575c59){_0x488814['push'](_0x488814['shift']());}};_0x58138b(++_0x3fec59);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x1a9b('0x0')]},'name':{'type':Sequelize[_0x1a9b('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x1a9b('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1a9b('0x0')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a9b('0x2')},'fontSize':{'type':Sequelize[_0x1a9b('0x3')](0x2)[_0x1a9b('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1a9b('0x5')],'defaultValue':function(){return _0x1a9b('0x6');}},'notificationSound':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![],'comment':_0x1a9b('0x7'),'set':function(_0x2c2ee4){if(!_0x2c2ee4)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x1a9b('0x8'),_0x2c2ee4);}}}; \ No newline at end of file +var _0x689c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0xf2068e,_0x59ddfd){var _0x377b35=function(_0x33cc32){while(--_0x33cc32){_0xf2068e['push'](_0xf2068e['shift']());}};_0x377b35(++_0x59ddfd);}(_0x689c,0x9e));var _0xc689=function(_0x4c83f1,_0x4d810b){_0x4c83f1=_0x4c83f1-0x0;var _0x39d555=_0x689c[_0x4c83f1];return _0x39d555;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xc689('0x0')]},'name':{'type':Sequelize[_0xc689('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0xc689('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xc689('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc689('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc689('0x0')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc689('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xc689('0x2')](0x2)[_0xc689('0x3')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc689('0x4')],'defaultValue':function(){return _0xc689('0x5');}},'notificationSound':{'type':Sequelize[_0xc689('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc689('0x2')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc689('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc689('0x2')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc689('0x2')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc689('0x2')],'allowNull':!![],'defaultValue':null,'comment':_0xc689('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xc689('0x1')],'defaultValue':![],'comment':_0xc689('0x7'),'set':function(_0x30409c){if(!_0x30409c)this[_0xc689('0x8')](_0xc689('0x9'),null);this[_0xc689('0x8')](_0xc689('0xa'),_0x30409c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index fc8860d..fc99302 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 _0x2242=['sendMail','List\x20not\x20found','List','attach','out','messageId','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./mailAccount.socket','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','name','send','index','MailServerIn','Imap','Smtp','mandatoryDispositionPause','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','rows','show','params','MailServerOut','Pause','length','body','find','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','ListId','isNil','active','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','CmList','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','basename','secure','auth','SendMail'];(function(_0x4aa2f7,_0x4edc07){var _0x50f332=function(_0xf0b475){while(--_0xf0b475){_0x4aa2f7['push'](_0x4aa2f7['shift']());}};_0x50f332(++_0x4edc07);}(_0x2242,0x1a3));var _0x2224=function(_0x4c5413,_0x21c0b7){_0x4c5413=_0x4c5413-0x0;var _0x3a0224=_0x2242[_0x4c5413];return _0x3a0224;};'use strict';var emlformat=require(_0x2224('0x0'));var rimraf=require(_0x2224('0x1'));var zipdir=require(_0x2224('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2224('0x3'));var moment=require(_0x2224('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2224('0x5'));var util=require(_0x2224('0x6'));var path=require('path');var sox=require(_0x2224('0x7'));var csv=require(_0x2224('0x8'));var ejs=require(_0x2224('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2224('0xa'));var squel=require(_0x2224('0xb'));var crypto=require(_0x2224('0xc'));var jsforce=require(_0x2224('0xd'));var deskjs=require(_0x2224('0xe'));var toCsv=require(_0x2224('0x8'));var querystring=require(_0x2224('0xf'));var Papa=require(_0x2224('0x10'));var htmlToText=require(_0x2224('0x11'));var juice=require(_0x2224('0x12'));var Redis=require(_0x2224('0x13'));var authService=require(_0x2224('0x14'));var qs=require(_0x2224('0x15'));var as=require(_0x2224('0x16'));var hardwareService=require(_0x2224('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2224('0x18'));var config=require(_0x2224('0x19'));var licenseUtil=require(_0x2224('0x1a'));var db=require(_0x2224('0x1b'))['db'];config['redis']=_[_0x2224('0x1c')](config[_0x2224('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2224('0x1d')]));require(_0x2224('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2224('0x1f')][_0x2224('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x3c1ecd,_0x28956b,_0x30d846,_0xebb5c9){return new BPromise(function(_0x34d045,_0x1327dc){var _0x5ba07d=_0xebb5c9||client;return _0x5ba07d[_0x2224('0x21')](_0x3c1ecd,_0x30d846)[_0x2224('0x22')](function(_0xffed3d){logger[_0x2224('0x23')](_0x2224('0x24'),_0x28956b,_0x2224('0x25'));logger[_0x2224('0x26')](_0x2224('0x27'),_0x28956b,_0x2224('0x25'),JSON[_0x2224('0x28')](_0xffed3d));if(_0xffed3d[_0x2224('0x29')]){if(_0xffed3d[_0x2224('0x29')][_0x2224('0x2a')]===0x1f4){logger[_0x2224('0x29')](_0x2224('0x24'),_0x28956b,_0xffed3d['error']['message']);return _0x1327dc(_0xffed3d[_0x2224('0x29')][_0x2224('0x2b')]);}logger[_0x2224('0x29')](_0x2224('0x24'),_0x28956b,_0xffed3d[_0x2224('0x29')][_0x2224('0x2b')]);return _0x34d045(_0xffed3d[_0x2224('0x29')][_0x2224('0x2b')]);}else{logger[_0x2224('0x23')](_0x2224('0x24'),_0x28956b,_0x2224('0x25'));_0x34d045(_0xffed3d[_0x2224('0x2c')]['message']);}})[_0x2224('0x2d')](function(_0x4c231a){logger['error'](_0x2224('0x24'),_0x28956b,_0x4c231a);_0x1327dc(_0x4c231a);});});}function respondWithStatusCode(_0x1e8e26,_0x4c4c64){_0x4c4c64=_0x4c4c64||0xcc;return function(_0x4da4bd){if(_0x4da4bd){return _0x1e8e26[_0x2224('0x2e')](_0x4c4c64);}return _0x1e8e26[_0x2224('0x2f')](_0x4c4c64)['end']();};}function respondWithResult(_0x408521,_0x4a17ea){_0x4a17ea=_0x4a17ea||0xc8;return function(_0x43cd3d){if(_0x43cd3d){return _0x408521[_0x2224('0x2f')](_0x4a17ea)[_0x2224('0x30')](_0x43cd3d);}};}function respondWithFilteredResult(_0x1159bf,_0x32132b){return function(_0x50058d){if(_0x50058d){var _0x3b3843=typeof _0x32132b['offset']==='undefined'&&typeof _0x32132b[_0x2224('0x31')]==='undefined';var _0x21acad=_0x50058d['count'];var _0x5ea9de=_0x3b3843?0x0:_0x32132b['offset'];var _0x1b125c=_0x3b3843?_0x50058d[_0x2224('0x32')]:_0x32132b[_0x2224('0x33')]+_0x32132b[_0x2224('0x31')];var _0x48e523;if(_0x1b125c>=_0x21acad){_0x1b125c=_0x21acad;_0x48e523=0xc8;}else{_0x48e523=0xce;}_0x1159bf[_0x2224('0x2f')](_0x48e523);return _0x1159bf['set'](_0x2224('0x34'),_0x5ea9de+'-'+_0x1b125c+'/'+_0x21acad)[_0x2224('0x30')](_0x50058d);}return null;};}function patchUpdates(_0x4506f4){return function(_0x53d0a4){try{jsonpatch[_0x2224('0x35')](_0x53d0a4,_0x4506f4,!![]);}catch(_0x356949){return BPromise[_0x2224('0x36')](_0x356949);}return _0x53d0a4[_0x2224('0x37')]();};}function saveUpdates(_0x24962d,_0x101900){return function(_0x537ae1){if(_0x537ae1){return _0x537ae1[_0x2224('0x38')](_0x24962d)[_0x2224('0x22')](function(_0x5451c9){return _0x5451c9;});}return null;};}function removeEntity(_0x3ad426,_0x14540a){return function(_0x191679){if(_0x191679){return _0x191679[_0x2224('0x39')]()[_0x2224('0x22')](function(){var _0x36f06d=_0x191679[_0x2224('0x3a')]({'plain':!![]});var _0x4b1e60=_0x2224('0x3b');return db['UserProfileResource'][_0x2224('0x39')]({'where':{'type':_0x4b1e60,'resourceId':_0x36f06d['id']}})['then'](function(){return _0x191679;});})[_0x2224('0x22')](function(){_0x3ad426[_0x2224('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0098,_0x39f819){return function(_0x52d0ea){if(!_0x52d0ea){_0x1b0098[_0x2224('0x2e')](0x194);}return _0x52d0ea;};}function handleError(_0x213899,_0x4d9007){_0x4d9007=_0x4d9007||0x1f4;return function(_0x44af45){logger[_0x2224('0x29')](_0x44af45['stack']);if(_0x44af45[_0x2224('0x3c')]){delete _0x44af45['name'];}_0x213899[_0x2224('0x2f')](_0x4d9007)[_0x2224('0x3d')](_0x44af45);};}exports[_0x2224('0x3e')]=function(_0x519631,_0x11c2a1){var _0x57c7c8={'include':[{'model':db[_0x2224('0x3f')],'as':_0x2224('0x40')},{'model':db['MailServerOut'],'as':_0x2224('0x41')},{'model':db['Pause'],'as':_0x2224('0x42')}]},_0x214b79={},_0x199100={'count':0x0,'rows':[]};var _0x20b681=_['map'](db['MailAccount'][_0x2224('0x43')],function(_0x54f8ce){return{'name':_0x54f8ce[_0x2224('0x44')],'type':_0x54f8ce[_0x2224('0x45')]['key']};});_0x214b79[_0x2224('0x46')]=_[_0x2224('0x47')](_0x20b681,_0x2224('0x3c'));_0x214b79['query']=_[_0x2224('0x48')](_0x519631[_0x2224('0x49')]);_0x214b79[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x214b79['model'],_0x214b79[_0x2224('0x49')]);_0x57c7c8[_0x2224('0x4c')]=_['intersection'](_0x214b79['model'],qs['fields'](_0x519631['query'][_0x2224('0x4d')]));_0x57c7c8['attributes']=_0x57c7c8[_0x2224('0x4c')]['length']?_0x57c7c8[_0x2224('0x4c')]:_0x214b79['model'];if(!_0x519631[_0x2224('0x49')]['hasOwnProperty'](_0x2224('0x4e'))){_0x57c7c8[_0x2224('0x31')]=qs[_0x2224('0x31')](_0x519631[_0x2224('0x49')]['limit']);_0x57c7c8[_0x2224('0x33')]=qs[_0x2224('0x33')](_0x519631['query'][_0x2224('0x33')]);}_0x57c7c8[_0x2224('0x4f')]=qs[_0x2224('0x50')](_0x519631[_0x2224('0x49')]['sort']);_0x57c7c8[_0x2224('0x51')]=qs['filters'](_[_0x2224('0x52')](_0x519631[_0x2224('0x49')],_0x214b79['filters']),_0x20b681);if(_0x519631[_0x2224('0x49')][_0x2224('0x53')]){_0x57c7c8[_0x2224('0x51')]=_[_0x2224('0x54')](_0x57c7c8['where'],{'$or':_[_0x2224('0x47')](_0x20b681,function(_0xe90eab){if(_0xe90eab[_0x2224('0x45')]!==_0x2224('0x55')){var _0x125c37={};_0x125c37[_0xe90eab[_0x2224('0x3c')]]={'$like':'%'+_0x519631['query'][_0x2224('0x53')]+'%'};return _0x125c37;}})});}_0x57c7c8=_[_0x2224('0x54')]({},_0x57c7c8,_0x519631[_0x2224('0x56')]);var _0x25b7ed={'where':_0x57c7c8[_0x2224('0x51')]};return db[_0x2224('0x57')]['count'](_0x25b7ed)[_0x2224('0x22')](function(_0x162354){_0x199100[_0x2224('0x32')]=_0x162354;if(_0x519631['query'][_0x2224('0x58')]){_0x57c7c8[_0x2224('0x59')]=[{'all':!![]}];}return db[_0x2224('0x57')]['findAll'](_0x57c7c8);})[_0x2224('0x22')](function(_0x3f1338){_0x199100[_0x2224('0x5a')]=_0x3f1338;return _0x199100;})[_0x2224('0x22')](respondWithFilteredResult(_0x11c2a1,_0x57c7c8))[_0x2224('0x2d')](handleError(_0x11c2a1,null));};exports[_0x2224('0x5b')]=function(_0x3acc39,_0x2feb21){var _0x15d074={'raw':![],'where':{'id':_0x3acc39[_0x2224('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2224('0x40')},{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41')},{'model':db[_0x2224('0x5e')],'as':_0x2224('0x42')}]},_0x19bc1e={};_0x19bc1e[_0x2224('0x46')]=_[_0x2224('0x48')](db['MailAccount'][_0x2224('0x43')]);_0x19bc1e[_0x2224('0x49')]=_[_0x2224('0x48')](_0x3acc39[_0x2224('0x49')]);_0x19bc1e[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x19bc1e[_0x2224('0x46')],_0x19bc1e[_0x2224('0x49')]);_0x15d074[_0x2224('0x4c')]=_[_0x2224('0x4b')](_0x19bc1e['model'],qs[_0x2224('0x4d')](_0x3acc39[_0x2224('0x49')][_0x2224('0x4d')]));_0x15d074['attributes']=_0x15d074[_0x2224('0x4c')][_0x2224('0x5f')]?_0x15d074[_0x2224('0x4c')]:_0x19bc1e[_0x2224('0x46')];if(_0x3acc39[_0x2224('0x49')][_0x2224('0x58')]){_0x15d074[_0x2224('0x59')]=[{'all':!![]}];}_0x15d074=_[_0x2224('0x54')]({},_0x15d074,_0x3acc39[_0x2224('0x56')]);return db[_0x2224('0x57')]['find'](_0x15d074)['then'](handleEntityNotFound(_0x2feb21,null))[_0x2224('0x22')](respondWithResult(_0x2feb21,null))[_0x2224('0x2d')](handleError(_0x2feb21,null));};exports[_0x2224('0x38')]=function(_0xfc1e2f,_0x3680ec){if(_0xfc1e2f[_0x2224('0x60')]['id']){delete _0xfc1e2f[_0x2224('0x60')]['id'];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0xfc1e2f[_0x2224('0x5c')]['id']},'include':[{'model':db[_0x2224('0x3f')],'as':'Imap'},{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41')},{'model':db[_0x2224('0x5e')],'as':'mandatoryDispositionPause'}]})[_0x2224('0x22')](handleEntityNotFound(_0x3680ec,null))[_0x2224('0x22')](saveUpdates(_0xfc1e2f[_0x2224('0x60')],null))[_0x2224('0x22')](function(_0x24959b){if(_0x24959b&&_0xfc1e2f[_0x2224('0x60')]['Imap']){return db[_0x2224('0x3f')][_0x2224('0x38')](_0xfc1e2f[_0x2224('0x60')]['Imap'],{'where':{'MailAccountId':_0x24959b['id']}})['then'](function(){return _0x24959b;});}return _0x24959b;})[_0x2224('0x22')](function(_0x4e5a2b){if(_0x4e5a2b&&_0xfc1e2f[_0x2224('0x60')]['Smtp']){return db[_0x2224('0x5d')][_0x2224('0x38')](_0xfc1e2f['body']['Smtp'],{'where':{'MailAccountId':_0x4e5a2b['id']}})['then'](function(){return _0x4e5a2b;});}return _0x4e5a2b;})[_0x2224('0x22')](respondWithResult(_0x3680ec,null))[_0x2224('0x2d')](handleError(_0x3680ec,null));};exports['describe']=function(_0x377121,_0x6082a6){return db[_0x2224('0x57')][_0x2224('0x62')]()[_0x2224('0x22')](respondWithResult(_0x6082a6,null))['catch'](handleError(_0x6082a6,null));};exports[_0x2224('0x63')]=function(_0x54986c,_0x1f6b29,_0x480fd3){if(_0x54986c[_0x2224('0x60')]['id']){delete _0x54986c['body']['id'];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x54986c[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x1f6b29,null))[_0x2224('0x22')](function(_0x33cb3f){if(_0x33cb3f){_0x54986c[_0x2224('0x60')][_0x2224('0x64')]=_0x33cb3f['id'];return db[_0x2224('0x65')][_0x2224('0x66')](_0x54986c[_0x2224('0x60')]);}})[_0x2224('0x22')](respondWithResult(_0x1f6b29,null))['catch'](handleError(_0x1f6b29,null));};exports[_0x2224('0x67')]=function(_0x14acea,_0x335458,_0x47ff5d){var _0x4568e2={'raw':![],'where':{}};var _0x2dc41f={};var _0x226bc2={'count':0x0,'rows':[]};return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x14acea['params']['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x335458,null))[_0x2224('0x22')](function(_0x4bd438){if(_0x4bd438){_0x2dc41f[_0x2224('0x46')]=_[_0x2224('0x48')](db[_0x2224('0x65')]['rawAttributes']);_0x2dc41f[_0x2224('0x49')]=_['keys'](_0x14acea[_0x2224('0x49')]);_0x2dc41f[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x2dc41f[_0x2224('0x46')],_0x2dc41f[_0x2224('0x49')]);_0x4568e2[_0x2224('0x4c')]=_[_0x2224('0x4b')](_0x2dc41f['model'],qs[_0x2224('0x4d')](_0x14acea['query'][_0x2224('0x4d')]));_0x4568e2['attributes']=_0x4568e2[_0x2224('0x4c')][_0x2224('0x5f')]?_0x4568e2[_0x2224('0x4c')]:_0x2dc41f['model'];if(!_0x14acea['query'][_0x2224('0x69')](_0x2224('0x4e'))){_0x4568e2['limit']=qs['limit'](_0x14acea[_0x2224('0x49')][_0x2224('0x31')]);_0x4568e2['offset']=qs[_0x2224('0x33')](_0x14acea[_0x2224('0x49')][_0x2224('0x33')]);}_0x4568e2[_0x2224('0x4f')]=qs['sort'](_0x14acea[_0x2224('0x49')][_0x2224('0x50')]);_0x4568e2[_0x2224('0x51')]=qs['filters'](_['pick'](_0x14acea[_0x2224('0x49')],_0x2dc41f[_0x2224('0x4a')]));_0x4568e2['where']['MailAccountId']=_0x4bd438['id'];if(_0x14acea[_0x2224('0x49')]['filter']){_0x4568e2[_0x2224('0x51')]=_[_0x2224('0x54')](_0x4568e2['where'],{'$or':_[_0x2224('0x47')](_0x4568e2['attributes'],function(_0x295fb2){var _0x11bc6e={};_0x11bc6e[_0x295fb2]={'$like':'%'+_0x14acea[_0x2224('0x49')][_0x2224('0x53')]+'%'};return _0x11bc6e;})});}_0x4568e2=_[_0x2224('0x54')]({},_0x4568e2,_0x14acea['options']);return db['Disposition'][_0x2224('0x32')]({'where':_0x4568e2[_0x2224('0x51')]})['then'](function(_0x1d362d){_0x226bc2[_0x2224('0x32')]=_0x1d362d;if(_0x14acea['query'][_0x2224('0x58')]){_0x4568e2['include']=[{'all':!![]}];}return db[_0x2224('0x65')]['findAll'](_0x4568e2);})[_0x2224('0x22')](function(_0x55db97){_0x226bc2[_0x2224('0x5a')]=_0x55db97;return _0x226bc2;});}})[_0x2224('0x22')](respondWithFilteredResult(_0x335458,_0x4568e2))[_0x2224('0x2d')](handleError(_0x335458,null));};exports[_0x2224('0x6a')]=function(_0x453d48,_0x235bc9,_0x5467fd){return db[_0x2224('0x57')]['find']({'where':{'id':_0x453d48[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x235bc9,null))[_0x2224('0x22')](function(_0x2a3a04){if(_0x2a3a04){return _0x2a3a04['removeDispositions'](_0x453d48['query']['ids']);}})['then'](respondWithStatusCode(_0x235bc9,null))['catch'](handleError(_0x235bc9,null));};exports[_0x2224('0x6b')]=function(_0x7b2af5,_0x257bf4,_0x49e089){if(_0x7b2af5[_0x2224('0x60')]['id']){delete _0x7b2af5['body']['id'];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x7b2af5[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x257bf4,null))['then'](function(_0x317713){if(_0x317713){_0x7b2af5['body'][_0x2224('0x64')]=_0x317713['id'];return db['CannedAnswer'][_0x2224('0x66')](_0x7b2af5[_0x2224('0x60')]);}})[_0x2224('0x22')](respondWithResult(_0x257bf4,null))[_0x2224('0x2d')](handleError(_0x257bf4,null));};exports['getAnswers']=function(_0x4a94c9,_0x16b36b,_0xa1df4e){var _0x14b3df={'raw':![],'where':{}};var _0x2bc317={};var _0x6cd08b={'count':0x0,'rows':[]};return db['MailAccount'][_0x2224('0x68')]({'where':{'id':_0x4a94c9['params']['id']}})['then'](handleEntityNotFound(_0x16b36b,null))[_0x2224('0x22')](function(_0x511260){if(_0x511260){_0x2bc317[_0x2224('0x46')]=_['keys'](db[_0x2224('0x6c')][_0x2224('0x43')]);_0x2bc317[_0x2224('0x49')]=_[_0x2224('0x48')](_0x4a94c9[_0x2224('0x49')]);_0x2bc317[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x2bc317['model'],_0x2bc317[_0x2224('0x49')]);_0x14b3df['attributes']=_[_0x2224('0x4b')](_0x2bc317[_0x2224('0x46')],qs[_0x2224('0x4d')](_0x4a94c9[_0x2224('0x49')]['fields']));_0x14b3df[_0x2224('0x4c')]=_0x14b3df[_0x2224('0x4c')][_0x2224('0x5f')]?_0x14b3df[_0x2224('0x4c')]:_0x2bc317[_0x2224('0x46')];if(!_0x4a94c9[_0x2224('0x49')]['hasOwnProperty'](_0x2224('0x4e'))){_0x14b3df[_0x2224('0x31')]=qs[_0x2224('0x31')](_0x4a94c9[_0x2224('0x49')]['limit']);_0x14b3df['offset']=qs['offset'](_0x4a94c9[_0x2224('0x49')][_0x2224('0x33')]);}_0x14b3df['order']=qs[_0x2224('0x50')](_0x4a94c9[_0x2224('0x49')][_0x2224('0x50')]);_0x14b3df['where']=qs[_0x2224('0x4a')](_['pick'](_0x4a94c9[_0x2224('0x49')],_0x2bc317[_0x2224('0x4a')]));_0x14b3df[_0x2224('0x51')]['MailAccountId']=_0x511260['id'];if(_0x4a94c9[_0x2224('0x49')][_0x2224('0x53')]){_0x14b3df[_0x2224('0x51')]=_[_0x2224('0x54')](_0x14b3df[_0x2224('0x51')],{'$or':_['map'](_0x14b3df[_0x2224('0x4c')],function(_0x486896){var _0x24030e={};_0x24030e[_0x486896]={'$like':'%'+_0x4a94c9[_0x2224('0x49')]['filter']+'%'};return _0x24030e;})});}_0x14b3df=_['merge']({},_0x14b3df,_0x4a94c9[_0x2224('0x56')]);return db['CannedAnswer'][_0x2224('0x32')]({'where':_0x14b3df['where']})[_0x2224('0x22')](function(_0x119a46){_0x6cd08b[_0x2224('0x32')]=_0x119a46;if(_0x4a94c9[_0x2224('0x49')]['includeAll']){_0x14b3df['include']=[{'all':!![]}];}return db[_0x2224('0x6c')]['findAll'](_0x14b3df);})[_0x2224('0x22')](function(_0x30c5b8){_0x6cd08b[_0x2224('0x5a')]=_0x30c5b8;return _0x6cd08b;});}})[_0x2224('0x22')](respondWithFilteredResult(_0x16b36b,_0x14b3df))[_0x2224('0x2d')](handleError(_0x16b36b,null));};exports['removeAnswers']=function(_0x3b050d,_0x5f1fdd,_0x2bf2b6){return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x3b050d[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x5f1fdd,null))[_0x2224('0x22')](function(_0x5203b6){if(_0x5203b6){return _0x5203b6[_0x2224('0x6d')](_0x3b050d[_0x2224('0x49')][_0x2224('0x6e')]);}})['then'](respondWithStatusCode(_0x5f1fdd,null))[_0x2224('0x2d')](handleError(_0x5f1fdd,null));};exports[_0x2224('0x66')]=function(_0x4d7092,_0x35638f){var _0x17fc8b={'name':_0x4d7092[_0x2224('0x60')][_0x2224('0x3c')],'key':_0x4d7092[_0x2224('0x60')]['key'],'email':_0x4d7092[_0x2224('0x60')]['email'],'ListId':_0x4d7092[_0x2224('0x60')][_0x2224('0x6f')],'active':!_[_0x2224('0x70')](_0x4d7092[_0x2224('0x60')][_0x2224('0x71')])?_0x4d7092[_0x2224('0x60')][_0x2224('0x71')]:!![],'description':_0x4d7092[_0x2224('0x60')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x2224('0x70')](_0x4d7092[_0x2224('0x60')][_0x2224('0x72')])){if(_0x4d7092[_0x2224('0x60')][_0x2224('0x73')]){_0x17fc8b[_0x2224('0x40')][_0x2224('0x74')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x74')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x75')];_0x17fc8b[_0x2224('0x40')][_0x2224('0x76')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x77')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x78')];}else{_0x17fc8b[_0x2224('0x40')][_0x2224('0x79')]=_0x17fc8b[_0x2224('0x41')]['authentication']=![];}_0x17fc8b['Imap'][_0x2224('0x7a')]=_0x4d7092[_0x2224('0x60')]['Imap']['host'];_0x17fc8b['Imap'][_0x2224('0x7b')]=_0x4d7092[_0x2224('0x60')]['Imap'][_0x2224('0x7b')];_0x17fc8b[_0x2224('0x41')][_0x2224('0x7a')]=_0x4d7092['body']['Smtp'][_0x2224('0x7a')];_0x17fc8b['Smtp']['port']=_0x4d7092[_0x2224('0x60')][_0x2224('0x41')][_0x2224('0x7b')];}else{_0x17fc8b[_0x2224('0x40')][_0x2224('0x7c')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x7c')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x72')];_0x17fc8b[_0x2224('0x40')][_0x2224('0x74')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x74')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x75')];_0x17fc8b[_0x2224('0x40')][_0x2224('0x76')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x77')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x78')];}return db['MailAccount'][_0x2224('0x66')](_0x17fc8b,{'include':[{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41')},{'model':db[_0x2224('0x3f')],'as':_0x2224('0x40')}]})[_0x2224('0x22')](function(_0x489758){var _0x5a1cdb=_0x4d7092[_0x2224('0x74')][_0x2224('0x3a')]({'plain':!![]});if(!_0x5a1cdb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a1cdb[_0x2224('0x7d')]===_0x2224('0x74')){var _0x13d924=_0x489758[_0x2224('0x3a')]({'plain':!![]});return db['UserProfileSection'][_0x2224('0x61')]({'where':{'name':'MailAccounts','userProfileId':_0x5a1cdb[_0x2224('0x7e')]},'raw':!![]})[_0x2224('0x22')](function(_0x13179f){if(_0x13179f&&_0x13179f[_0x2224('0x7f')]===0x0){return db[_0x2224('0x80')][_0x2224('0x66')]({'name':_0x13d924['name'],'resourceId':_0x13d924['id'],'type':_0x13179f[_0x2224('0x3c')],'sectionId':_0x13179f['id']},{})[_0x2224('0x22')](function(){return _0x489758;});}else{return _0x489758;}})[_0x2224('0x2d')](function(_0x5f2c43){logger['error'](_0x2224('0x81'),_0x5f2c43);throw _0x5f2c43;});}return _0x489758;})['then'](respondWithResult(_0x35638f,0xc9))[_0x2224('0x2d')](handleError(_0x35638f,null));};exports[_0x2224('0x82')]=function(_0x23b125,_0xdefa6a,_0x24ea49){return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x23b125['params']['id']}})[_0x2224('0x22')](handleEntityNotFound(_0xdefa6a,null))[_0x2224('0x22')](function(_0x7f9264){if(_0x7f9264){return _0x7f9264[_0x2224('0x82')]();}return null;})[_0x2224('0x22')](respondWithResult(_0xdefa6a,null))[_0x2224('0x2d')](handleError(_0xdefa6a,null));};exports[_0x2224('0x83')]=function(_0x4f6c44,_0x26257d,_0x4f59fa){if(_0x4f6c44['body']['id']){delete _0x4f6c44['body']['id'];}return db[_0x2224('0x57')]['find']({'where':{'id':_0x4f6c44['params']['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x26257d,null))['then'](function(_0x4ae1a5){if(_0x4ae1a5){_0x4f6c44[_0x2224('0x60')][_0x2224('0x64')]=_0x4ae1a5['id'];return db[_0x2224('0x3f')][_0x2224('0x66')](_0x4f6c44[_0x2224('0x60')]);}})['then'](respondWithResult(_0x26257d,null))[_0x2224('0x2d')](handleError(_0x26257d,null));};exports[_0x2224('0x84')]=function(_0x1bef9e,_0x291cc0,_0x5da57c){return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x1bef9e[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x291cc0,null))['then'](function(_0x32e373){if(_0x32e373){return _0x32e373[_0x2224('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x291cc0,null))[_0x2224('0x2d')](handleError(_0x291cc0,null));};exports[_0x2224('0x86')]=function(_0x41d30c,_0x583dfd,_0x4e75ba){return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x41d30c[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x583dfd,null))[_0x2224('0x22')](function(_0x3382a6){if(_0x3382a6){return _0x3382a6['getSmtp']();}return null;})[_0x2224('0x22')](respondWithResult(_0x583dfd,null))[_0x2224('0x2d')](handleError(_0x583dfd,null));};exports[_0x2224('0x87')]=function(_0x1b35ea,_0x131bfd,_0x463c1c){if(_0x1b35ea['body']['id']){delete _0x1b35ea[_0x2224('0x60')]['id'];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x1b35ea[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x131bfd,null))['then'](function(_0x4cf83a){if(_0x4cf83a){_0x1b35ea[_0x2224('0x60')][_0x2224('0x64')]=_0x4cf83a['id'];return db[_0x2224('0x5d')]['create'](_0x1b35ea[_0x2224('0x60')]);}})[_0x2224('0x22')](respondWithResult(_0x131bfd,null))[_0x2224('0x2d')](handleError(_0x131bfd,null));};exports[_0x2224('0x88')]=function(_0x185945,_0x5e1bed,_0x580f7c){return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x185945[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x5e1bed,null))[_0x2224('0x22')](function(_0xc38f6a){if(_0xc38f6a){return _0xc38f6a[_0x2224('0x89')](null);}return null;})[_0x2224('0x22')](respondWithStatusCode(_0x5e1bed,null))[_0x2224('0x2d')](handleError(_0x5e1bed,null));};exports[_0x2224('0x8a')]=function(_0xfeeaeb,_0x5266ba,_0x4386b3){return db[_0x2224('0x8b')]['find']({'where':{'id':_0xfeeaeb[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x5266ba,null))[_0x2224('0x22')](function(_0xc28275){if(_0xc28275){return _0xc28275[_0x2224('0x8a')](_0xfeeaeb[_0x2224('0x60')][_0x2224('0x6e')],_[_0x2224('0x8c')](_0xfeeaeb[_0x2224('0x60')],[_0x2224('0x6e'),'id'])||{});}})[_0x2224('0x22')](respondWithResult(_0x5266ba,null))[_0x2224('0x2d')](handleError(_0x5266ba,null));};exports[_0x2224('0x8d')]=function(_0x315ff9,_0x534721,_0x165e46){var _0xcb9c2c={'raw':![],'where':{}};var _0x321c8e={};var _0x29ca88={'count':0x0,'rows':[]};return db['MailAccount'][_0x2224('0x68')]({'where':{'id':_0x315ff9['params']['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x534721,null))['then'](function(_0x457e47){if(_0x457e47){_0x321c8e[_0x2224('0x46')]=_[_0x2224('0x48')](db[_0x2224('0x8b')][_0x2224('0x43')]);_0x321c8e[_0x2224('0x49')]=_[_0x2224('0x48')](_0x315ff9[_0x2224('0x49')]);_0x321c8e[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x321c8e[_0x2224('0x46')],_0x321c8e[_0x2224('0x49')]);_0xcb9c2c[_0x2224('0x4c')]=_['intersection'](_0x321c8e['model'],qs['fields'](_0x315ff9[_0x2224('0x49')][_0x2224('0x4d')]));_0xcb9c2c[_0x2224('0x4c')]=_0xcb9c2c[_0x2224('0x4c')]['length']?_0xcb9c2c[_0x2224('0x4c')]:_0x321c8e[_0x2224('0x46')];if(!_0x315ff9[_0x2224('0x49')][_0x2224('0x69')](_0x2224('0x4e'))){_0xcb9c2c[_0x2224('0x31')]=qs[_0x2224('0x31')](_0x315ff9['query'][_0x2224('0x31')]);_0xcb9c2c['offset']=qs[_0x2224('0x33')](_0x315ff9[_0x2224('0x49')]['offset']);}_0xcb9c2c['order']=qs[_0x2224('0x50')](_0x315ff9[_0x2224('0x49')][_0x2224('0x50')]);_0xcb9c2c[_0x2224('0x51')]=qs[_0x2224('0x4a')](_['pick'](_0x315ff9[_0x2224('0x49')],_0x321c8e['filters']));_0xcb9c2c[_0x2224('0x51')][_0x2224('0x64')]=_0x457e47['id'];if(_0x315ff9[_0x2224('0x49')][_0x2224('0x53')]){_0xcb9c2c[_0x2224('0x51')]=_[_0x2224('0x54')](_0xcb9c2c[_0x2224('0x51')],{'$or':_[_0x2224('0x47')](_0xcb9c2c[_0x2224('0x4c')],function(_0x7889ac){var _0x1a22a5={};_0x1a22a5[_0x7889ac]={'$like':'%'+_0x315ff9['query'][_0x2224('0x53')]+'%'};return _0x1a22a5;})});}_0xcb9c2c=_[_0x2224('0x54')]({},_0xcb9c2c,_0x315ff9[_0x2224('0x56')]);return db[_0x2224('0x8b')][_0x2224('0x32')]({'where':_0xcb9c2c[_0x2224('0x51')]})['then'](function(_0x49ad23){_0x29ca88[_0x2224('0x32')]=_0x49ad23;if(_0x315ff9[_0x2224('0x49')][_0x2224('0x58')]){_0xcb9c2c['include']=[{'model':db[_0x2224('0x8e')],'as':_0x2224('0x8f'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x2224('0x90'),_0x2224('0x91')],'required':![]},{'model':db['Tag'],'as':_0x2224('0x92'),'attributes':['id',_0x2224('0x3c'),_0x2224('0x93')],'where':_0x315ff9['query'][_0x2224('0x94')]?{'id':_0x315ff9[_0x2224('0x49')][_0x2224('0x94')]}:undefined,'required':_0x315ff9[_0x2224('0x49')]['tag']?!![]:![]}];}return db[_0x2224('0x8b')]['findAll'](_0xcb9c2c);})['then'](function(_0x219a89){_0x29ca88[_0x2224('0x5a')]=_0x219a89;return _0x29ca88;});}})[_0x2224('0x22')](respondWithFilteredResult(_0x534721,_0xcb9c2c))[_0x2224('0x2d')](handleError(_0x534721,null));};exports[_0x2224('0x95')]=function addApplications(_0x458fbf,_0x8ccef4){var _0x3e550b=_0x458fbf[_0x2224('0x5c')]['id'];var _0x6a5803=_0x458fbf['body'];var _0x330297=0xc8;var _0x3cd687=null;return db[_0x2224('0x96')][_0x2224('0x97')]({'isolationLevel':db[_0x2224('0x96')][_0x2224('0x98')][_0x2224('0x99')]['READ_COMMITTED']},function(_0x5954a6){return db['MailAccount'][_0x2224('0x68')]({'where':{'id':_0x3e550b},'transaction':_0x5954a6})[_0x2224('0x22')](function(_0x2d7aa9){if(_0x2d7aa9){return db[_0x2224('0x9a')]['destroy']({'where':{'MailAccountId':_0x3e550b},'transaction':_0x5954a6})[_0x2224('0x22')](function(){var _0x50fd2e=_[_0x2224('0x47')](_0x6a5803,function(_0x9b98a2){_0x9b98a2[_0x2224('0x64')]=_0x3e550b;return _0x9b98a2;});return db['MailApplication'][_0x2224('0x9b')](_0x50fd2e,{'transaction':_0x5954a6});});}else{_0x330297=0x194;_0x3cd687=[];}});})[_0x2224('0x22')](function(){if(_0x330297!==0x194){return db[_0x2224('0x9a')][_0x2224('0x9c')]({'where':{'MailAccountId':_0x3e550b},'order':_0x2224('0x9d')})[_0x2224('0x22')](function(_0x3f7e32){_0x3cd687=_0x3f7e32;});}})[_0x2224('0x2d')](function(_0x1f86c5){_0x330297=0x1f4;logger[_0x2224('0x29')](_0x1f86c5[_0x2224('0x9e')]);if(_0x1f86c5[_0x2224('0x3c')]){delete _0x1f86c5[_0x2224('0x3c')];}_0x3cd687=_0x1f86c5;})[_0x2224('0x9f')](function(){if(_0x3cd687===null){_0x8ccef4[_0x2224('0x2e')](_0x330297);}else{if(_0x330297===0x1f4){_0x8ccef4[_0x2224('0x2f')](_0x330297)[_0x2224('0x3d')](_0x3cd687);}else{_0x8ccef4[_0x2224('0x2f')](_0x330297)[_0x2224('0x30')](_0x3cd687);}}});};exports[_0x2224('0xa0')]=function(_0x472b12,_0x4c76f2,_0x4267d3){var _0xa3aace={};var _0x59edd8={};var _0x4ddcba;var _0x516c41;return db[_0x2224('0x57')]['findOne']({'where':{'id':_0x472b12[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x4c76f2,null))[_0x2224('0x22')](function(_0x5e27c1){if(_0x5e27c1){_0x4ddcba=_0x5e27c1;_0x59edd8[_0x2224('0x46')]=_[_0x2224('0x48')](db['MailApplication'][_0x2224('0x43')]);_0x59edd8['query']=_['keys'](_0x472b12[_0x2224('0x49')]);_0x59edd8['filters']=_[_0x2224('0x4b')](_0x59edd8['model'],_0x59edd8[_0x2224('0x49')]);_0xa3aace['attributes']=_[_0x2224('0x4b')](_0x59edd8['model'],qs[_0x2224('0x4d')](_0x472b12[_0x2224('0x49')][_0x2224('0x4d')]));_0xa3aace[_0x2224('0x4c')]=_0xa3aace[_0x2224('0x4c')]['length']?_0xa3aace['attributes']:_0x59edd8[_0x2224('0x46')];_0xa3aace['order']=qs[_0x2224('0x50')](_0x472b12[_0x2224('0x49')][_0x2224('0x50')]);_0xa3aace['where']=qs[_0x2224('0x4a')](_[_0x2224('0x52')](_0x472b12['query'],_0x59edd8['filters']));if(_0x472b12[_0x2224('0x49')][_0x2224('0x53')]){_0xa3aace['where']=_[_0x2224('0x54')](_0xa3aace[_0x2224('0x51')],{'$or':_[_0x2224('0x47')](_0xa3aace[_0x2224('0x4c')],function(_0x2246e6){var _0x19caad={};_0x19caad[_0x2246e6]={'$like':'%'+_0x472b12['query'][_0x2224('0x53')]+'%'};return _0x19caad;})});}_0xa3aace=_[_0x2224('0x54')]({},_0xa3aace,_0x472b12[_0x2224('0x56')]);return _0x4ddcba[_0x2224('0xa0')](_0xa3aace);}})[_0x2224('0x22')](function(_0x3e7c23){if(_0x3e7c23){_0x516c41=_0x3e7c23[_0x2224('0x5f')];if(!_0x472b12['query'][_0x2224('0x69')](_0x2224('0x4e'))){_0xa3aace[_0x2224('0x31')]=qs['limit'](_0x472b12[_0x2224('0x49')][_0x2224('0x31')]);_0xa3aace[_0x2224('0x33')]=qs[_0x2224('0x33')](_0x472b12['query'][_0x2224('0x33')]);}return _0x4ddcba['getApplications'](_0xa3aace);}})[_0x2224('0x22')](function(_0x3ce47a){if(_0x3ce47a){return _0x3ce47a?{'count':_0x516c41,'rows':_0x3ce47a}:null;}})['then'](respondWithResult(_0x4c76f2,null))[_0x2224('0x2d')](handleError(_0x4c76f2,null));};exports[_0x2224('0xa1')]=function(_0x3e060f,_0x3351fe,_0x2b306e){var _0x2e1f38={'raw':!![],'where':{}};var _0x41b7e6={};var _0x1dfb24={'count':0x0,'rows':[]};return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x3e060f['params']['id']}})['then'](handleEntityNotFound(_0x3351fe,null))[_0x2224('0x22')](function(_0x51a94f){if(_0x51a94f){_0x41b7e6[_0x2224('0x46')]=_[_0x2224('0x48')](db[_0x2224('0xa2')][_0x2224('0x43')]);_0x41b7e6['query']=_[_0x2224('0x48')](_0x3e060f['query']);_0x41b7e6['filters']=_[_0x2224('0x4b')](_0x41b7e6[_0x2224('0x46')],_0x41b7e6[_0x2224('0x49')]);_0x2e1f38[_0x2224('0x4c')]=_['intersection'](_0x41b7e6[_0x2224('0x46')],qs[_0x2224('0x4d')](_0x3e060f[_0x2224('0x49')][_0x2224('0x4d')]));_0x2e1f38[_0x2224('0x4c')]=_0x2e1f38[_0x2224('0x4c')][_0x2224('0x5f')]?_0x2e1f38[_0x2224('0x4c')]:_0x41b7e6[_0x2224('0x46')];if(!_0x3e060f[_0x2224('0x49')]['hasOwnProperty']('nolimit')){_0x2e1f38['limit']=qs[_0x2224('0x31')](_0x3e060f['query'][_0x2224('0x31')]);_0x2e1f38[_0x2224('0x33')]=qs['offset'](_0x3e060f['query']['offset']);}_0x2e1f38['order']=qs[_0x2224('0x50')](_0x3e060f[_0x2224('0x49')]['sort']);_0x2e1f38['where']=qs['filters'](_['pick'](_0x3e060f[_0x2224('0x49')],_0x41b7e6[_0x2224('0x4a')]));_0x2e1f38[_0x2224('0x51')][_0x2224('0x64')]=_0x51a94f['id'];if(_0x3e060f[_0x2224('0x49')]['filter']){_0x2e1f38[_0x2224('0x51')]=_['merge'](_0x2e1f38[_0x2224('0x51')],{'$or':_['map'](_0x2e1f38[_0x2224('0x4c')],function(_0x2e20c){var _0x2130cd={};_0x2130cd[_0x2e20c]={'$like':'%'+_0x3e060f[_0x2224('0x49')][_0x2224('0x53')]+'%'};return _0x2130cd;})});}if(_0x3e060f[_0x2224('0x49')][_0x2224('0xa3')]){var _0x1d8310=_0x3e060f['query'][_0x2224('0xa3')][_0x2224('0xa4')](',');var _0x286187={};_0x286187[_0x1d8310[0x0]]={'$gte':moment(_0x1d8310[0x1])[_0x2224('0xa5')](_0x2224('0xa6'))};_0x2e1f38[_0x2224('0x51')]=_[_0x2224('0x54')](_0x2e1f38['where'],_0x286187);}_0x2e1f38=_['merge']({},_0x2e1f38,_0x3e060f[_0x2224('0x56')]);return db[_0x2224('0xa2')][_0x2224('0x32')]({'where':_0x2e1f38['where']})['then'](function(_0x4b7c13){_0x1dfb24[_0x2224('0x32')]=_0x4b7c13;if(_0x3e060f['query'][_0x2224('0x58')]){_0x2e1f38[_0x2224('0x59')]=[{'all':!![]}];}return db[_0x2224('0xa2')][_0x2224('0xa7')](_0x2e1f38);})[_0x2224('0x22')](function(_0x24539c){if(_0x3e060f[_0x2224('0x49')][_0x2224('0xa8')]===_0x2224('0xa9')){for(var _0x184ca1=0x0;_0x184ca1<_0x24539c[_0x2224('0x5f')];_0x184ca1++){_0x24539c[_0x184ca1][_0x2224('0x60')]=juice(_0x24539c[_0x184ca1][_0x2224('0x60')]);}}_0x1dfb24[_0x2224('0x5a')]=_0x24539c;return _0x1dfb24;});}})[_0x2224('0x22')](respondWithFilteredResult(_0x3351fe,_0x2e1f38))['catch'](handleError(_0x3351fe,null));};exports['send']=function(_0x44ff47,_0x1acbbc,_0x4a799a){var _0x5c6c82,_0x1b73cc={},_0x11f814;if(_0x44ff47[_0x2224('0x60')]['to']){_0x11f814=_0x44ff47[_0x2224('0x60')]['to'][_0x2224('0xa4')](',')[0x0];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x44ff47[_0x2224('0x5c')]['id']},'include':[{'model':db[_0x2224('0xaa')],'as':'List','include':[{'model':db[_0x2224('0x8e')],'as':_0x2224('0xab'),'where':{'email':_0x11f814},'limit':0x1,'order':[[_0x2224('0xac'),_0x2224('0xad')]]}]},{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41'),'raw':!![]}]})['then'](handleEntityNotFound(_0x1acbbc,null))[_0x2224('0x22')](function(_0x1579e1){if(_0x1579e1){_0x5c6c82=_0x1579e1;if(_0x1579e1[_0x2224('0x41')]){if(_[_0x2224('0x70')](_0x44ff47[_0x2224('0x60')][_0x2224('0xae')])){_0x44ff47[_0x2224('0x60')][_0x2224('0xae')]=util[_0x2224('0xa5')](_0x2224('0xaf'),_0x1579e1[_0x2224('0x3c')],_0x1579e1['email']||_0x1579e1[_0x2224('0x41')][_0x2224('0x74')]);}if(_0x44ff47['body'][_0x2224('0xb0')]&&_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x2224('0x5f')]){for(var _0x11a597=0x0;_0x11a597<_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x2224('0x5f')];_0x11a597+=0x1){_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x11a597]={'filename':_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x11a597][_0x2224('0x3c')],'path':path['join'](config['root'],'server/files/attachments',_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x11a597][_0x2224('0xb1')])};}}var _0xd5022d={'tls':{'rejectUnauthorized':![]}};if(_[_0x2224('0x70')](_0x1579e1['Smtp'][_0x2224('0x7c')])){if(_0x1579e1[_0x2224('0x41')]['authentication']){_0xd5022d['auth']={'user':_0x1579e1[_0x2224('0x41')]['user'],'pass':_0x1579e1[_0x2224('0x41')][_0x2224('0x77')]};}_0xd5022d[_0x2224('0x7a')]=_0x1579e1['Smtp']['host'];_0xd5022d[_0x2224('0x7b')]=_0x1579e1[_0x2224('0x41')][_0x2224('0x7b')];_0xd5022d[_0x2224('0xb2')]=_0x1579e1['Smtp'][_0x2224('0xb2')];}else{_0xd5022d[_0x2224('0x7c')]=_0x1579e1[_0x2224('0x41')][_0x2224('0x7c')];_0xd5022d[_0x2224('0xb3')]={'user':_0x1579e1[_0x2224('0x41')]['user'],'pass':_0x1579e1[_0x2224('0x41')]['pass']};}return respondWithRpcPromise(_0x2224('0xb4'),_0x2224('0xb5'),{'account':_0xd5022d,'message':_0x44ff47[_0x2224('0x60')]});}else{throw new Error(_0x2224('0xb6'));}}})[_0x2224('0x22')](function(_0x45a40e){if(_0x45a40e){_0x1b73cc=_0x45a40e;if(_0x5c6c82[_0x2224('0xb7')]){if(_0x5c6c82[_0x2224('0xb7')][_0x2224('0xab')][_0x2224('0x5f')]){return _0x5c6c82['List'][_0x2224('0xab')][0x0];}else{return db['CmContact']['create'](_[_0x2224('0x1c')](_0x44ff47['body'],{'firstName':_0x44ff47[_0x2224('0x60')]['to'],'email':_0x44ff47[_0x2224('0x60')]['to'],'phone':_0x44ff47[_0x2224('0x60')]['to'],'ListId':_0x5c6c82['ListId']}));}}else{throw new Error(_0x2224('0xb6'));}}})['then'](function(_0x33f45e){if(_0x33f45e){var _0x61a362={'UserId':_0x44ff47['user']['id'],'ContactId':_0x33f45e['id'],'MailAccountId':_0x5c6c82['id'],'inReplyTo':_0x1b73cc['messageId'],'to':_0x44ff47['body'][_0x2224('0xae')],'cc':_0x44ff47[_0x2224('0x60')]['cc'],'subject':_0x44ff47[_0x2224('0x60')]['subject'],'attach':_0x44ff47[_0x2224('0x60')][_0x2224('0xb8')],'firstMsgDirection':_0x2224('0xb9'),'lastMsgAt':moment()[_0x2224('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x2224('0xb9'),'Messages':[_[_0x2224('0x54')](_0x44ff47[_0x2224('0x60')],{'messageId':_0x1b73cc[_0x2224('0xba')],'sentAt':moment()[_0x2224('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5c6c82['id'],'UserId':_0x44ff47[_0x2224('0x74')]['id'],'ContactId':_0x33f45e['id']})]};if(_0x44ff47[_0x2224('0x60')]['Interaction']){_0x61a362=_[_0x2224('0x54')](_0x61a362,_0x44ff47[_0x2224('0x60')][_0x2224('0xbb')]);}return db['MailInteraction'][_0x2224('0x66')](_0x61a362,{'include':[{'model':db['MailMessage'],'as':_0x2224('0xbc')}]});}})[_0x2224('0x22')](respondWithResult(_0x1acbbc,null))[_0x2224('0x2d')](handleError(_0x1acbbc,null));};exports['verifySmtp']=function(_0x2da6cc,_0x4e913f,_0xcd827e){return db[_0x2224('0x57')]['find']({'where':{'id':_0x2da6cc[_0x2224('0x5c')]['id']},'include':[{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4e913f,null))[_0x2224('0x22')](function(_0x1426e0){if(_0x1426e0&&_0x1426e0['Smtp']){var _0x286908={'id':_0x1426e0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1426e0[_0x2224('0x41')]['service']){_0x286908[_0x2224('0x7c')]=_0x1426e0[_0x2224('0x41')][_0x2224('0x7c')];}else{_0x286908[_0x2224('0x7a')]=_0x1426e0[_0x2224('0x41')][_0x2224('0x7a')];_0x286908[_0x2224('0x7b')]=_0x1426e0[_0x2224('0x41')][_0x2224('0x7b')];_0x286908[_0x2224('0xb2')]=_0x1426e0[_0x2224('0x41')][_0x2224('0xb2')];}if(_0x1426e0['Smtp']['authentication']){_0x286908[_0x2224('0xb3')]={'user':_0x1426e0[_0x2224('0x41')][_0x2224('0x74')],'pass':_0x1426e0[_0x2224('0x41')][_0x2224('0x77')]};}return respondWithRpcPromise('VerifySmtp',_0x2224('0xbd'),{'account':_0x286908});}})[_0x2224('0x22')](respondWithResult(_0x4e913f,null))[_0x2224('0x2d')](handleError(_0x4e913f,null));};exports['destroy']=function(_0x203ff7,_0x1f1106){return db['MailAccount'][_0x2224('0x61')]({'where':{'id':_0x203ff7[_0x2224('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1f1106,null))[_0x2224('0x22')](function(_0x5486a0){if(_0x5486a0&&_0x5486a0[_0x2224('0x7c')]){throw new db[(_0x2224('0xbe'))][(_0x2224('0xbf'))](_0x2224('0xc0'));}return _0x5486a0;})[_0x2224('0x22')](removeEntity(_0x1f1106,null))[_0x2224('0x2d')](handleError(_0x1f1106,null));};exports[_0x2224('0xc1')]=function(_0x4d9621,_0x170b39,_0x420d82){return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x4d9621[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x170b39,null))[_0x2224('0x22')](function(_0x3db006){if(_0x3db006){return _0x3db006[_0x2224('0xc1')](_0x4d9621[_0x2224('0x60')]['ids'],_[_0x2224('0x8c')](_0x4d9621[_0x2224('0x60')],['ids','id'])||{})['spread'](function(_0x1d08b5){for(var _0xdf25bd=0x0;_0xdf25bd<_0x4d9621[_0x2224('0x60')]['ids'][_0x2224('0x5f')];_0xdf25bd+=0x1){socket[_0x2224('0xc2')](_0x2224('0xc3'),{'UserId':Number(_0x4d9621[_0x2224('0x60')][_0x2224('0x6e')][_0xdf25bd]),'MailAccountId':Number(_0x4d9621['params']['id'])});}return _0x1d08b5;});}})['then'](respondWithResult(_0x170b39,null))[_0x2224('0x2d')](handleError(_0x170b39,null));};exports[_0x2224('0xc4')]=function(_0xc2fb97,_0x136a40,_0x1efa16){return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0xc2fb97[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x136a40,null))[_0x2224('0x22')](function(_0x1b3dd4){if(_0x1b3dd4){return _0x1b3dd4['removeAgents'](_0xc2fb97[_0x2224('0x49')]['ids'])[_0x2224('0x22')](function(){if(_[_0x2224('0xc5')](_0xc2fb97[_0x2224('0x49')][_0x2224('0x6e')])){for(var _0x36b96a=0x0;_0x36b96a<_0xc2fb97[_0x2224('0x49')][_0x2224('0x6e')][_0x2224('0x5f')];_0x36b96a+=0x1){socket[_0x2224('0xc2')]('userMailAccount:remove',{'UserId':Number(_0xc2fb97['query']['ids'][_0x36b96a]),'MailAccountId':Number(_0xc2fb97[_0x2224('0x5c')]['id'])});}}else{socket[_0x2224('0xc2')](_0x2224('0xc6'),{'UserId':Number(_0xc2fb97['query'][_0x2224('0x6e')]),'MailAccountId':Number(_0xc2fb97[_0x2224('0x5c')]['id'])});}});}})[_0x2224('0x22')](respondWithStatusCode(_0x136a40,null))[_0x2224('0x2d')](handleError(_0x136a40,null));};exports['getAgents']=function(_0x15ea87,_0x83da61,_0x7be8b){var _0x1745ce={};var _0x189dd8={};var _0x737573;var _0x4f7d03;return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x15ea87[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x83da61,null))[_0x2224('0x22')](function(_0x3ca591){if(_0x3ca591){_0x737573=_0x3ca591;_0x189dd8[_0x2224('0x46')]=_[_0x2224('0x48')](db[_0x2224('0xc7')]['rawAttributes']);_0x189dd8[_0x2224('0x49')]=_['keys'](_0x15ea87[_0x2224('0x49')]);_0x189dd8[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x189dd8[_0x2224('0x46')],_0x189dd8[_0x2224('0x49')]);_0x1745ce[_0x2224('0x4c')]=_[_0x2224('0x4b')](_0x189dd8[_0x2224('0x46')],qs[_0x2224('0x4d')](_0x15ea87[_0x2224('0x49')][_0x2224('0x4d')]));_0x1745ce[_0x2224('0x4c')]=_0x1745ce[_0x2224('0x4c')][_0x2224('0x5f')]?_0x1745ce[_0x2224('0x4c')]:_0x189dd8[_0x2224('0x46')];_0x1745ce[_0x2224('0x4f')]=qs[_0x2224('0x50')](_0x15ea87['query'][_0x2224('0x50')]);_0x1745ce[_0x2224('0x51')]=qs[_0x2224('0x4a')](_[_0x2224('0x52')](_0x15ea87['query'],_0x189dd8[_0x2224('0x4a')]));if(_0x15ea87[_0x2224('0x49')][_0x2224('0x53')]){_0x1745ce[_0x2224('0x51')]=_[_0x2224('0x54')](_0x1745ce[_0x2224('0x51')],{'$or':_['map'](_0x1745ce[_0x2224('0x4c')],function(_0x3a6f77){var _0x2d2e67={};_0x2d2e67[_0x3a6f77]={'$like':'%'+_0x15ea87[_0x2224('0x49')]['filter']+'%'};return _0x2d2e67;})});}_0x1745ce=_[_0x2224('0x54')]({},_0x1745ce,_0x15ea87['options']);return _0x737573['getAgents'](_0x1745ce);}})[_0x2224('0x22')](function(_0x4da857){if(_0x4da857){_0x4f7d03=_0x4da857[_0x2224('0x5f')];if(!_0x15ea87['query']['hasOwnProperty']('nolimit')){_0x1745ce['limit']=qs[_0x2224('0x31')](_0x15ea87['query'][_0x2224('0x31')]);_0x1745ce[_0x2224('0x33')]=qs[_0x2224('0x33')](_0x15ea87[_0x2224('0x49')][_0x2224('0x33')]);}return _0x737573['getAgents'](_0x1745ce);}})[_0x2224('0x22')](function(_0x2912f){if(_0x2912f){return _0x2912f?{'count':_0x4f7d03,'rows':_0x2912f}:null;}})['then'](respondWithResult(_0x83da61,null))[_0x2224('0x2d')](handleError(_0x83da61,null));}; \ No newline at end of file +var _0x0e89=['params','Imap','Pause','mandatoryDispositionPause','include','find','update','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','nolimit','rows','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','email','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','Owner','fullname','Tag','Tags','tag','sequelize','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','format','true','CmList','Contacts','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List','List\x20not\x20found','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Messages','verifySmtp','Sequelize','ValidationError','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','get','UserProfileResource','stack','name','index','MailServerIn','MailServerOut','Smtp','map','MailAccount','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0e89,0x69));var _0x90e8=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0e89[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x90e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90e8('0x2'));var moment=require(_0x90e8('0x3'));var BPromise=require(_0x90e8('0x4'));var Mustache=require(_0x90e8('0x5'));var util=require('util');var path=require('path');var sox=require(_0x90e8('0x6'));var csv=require(_0x90e8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90e8('0x8'));var squel=require(_0x90e8('0x9'));var crypto=require('crypto');var jsforce=require(_0x90e8('0xa'));var deskjs=require(_0x90e8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x90e8('0xc'));var Papa=require(_0x90e8('0xd'));var htmlToText=require(_0x90e8('0xe'));var juice=require('juice');var Redis=require(_0x90e8('0xf'));var authService=require(_0x90e8('0x10'));var qs=require(_0x90e8('0x11'));var as=require(_0x90e8('0x12'));var hardwareService=require(_0x90e8('0x13'));var logger=require(_0x90e8('0x14'))('api');var utils=require(_0x90e8('0x15'));var config=require(_0x90e8('0x16'));var licenseUtil=require(_0x90e8('0x17'));var db=require(_0x90e8('0x18'))['db'];config[_0x90e8('0x19')]=_[_0x90e8('0x1a')](config[_0x90e8('0x19')],{'host':_0x90e8('0x1b'),'port':0x18eb});var socket=require(_0x90e8('0x1c'))(new Redis(config['redis']));require(_0x90e8('0x1d'))[_0x90e8('0x1e')](socket);var jayson=require(_0x90e8('0x1f'));var client=jayson[_0x90e8('0x20')]['http']({'port':0x232b});function respondWithRpcPromise(_0xb3d39b,_0xadb22e,_0x296c7a,_0x5635d2){return new BPromise(function(_0x499ff3,_0x5c71d7){var _0x494a4a=_0x5635d2||client;return _0x494a4a['request'](_0xb3d39b,_0x296c7a)[_0x90e8('0x21')](function(_0x414de6){logger[_0x90e8('0x22')](_0x90e8('0x23'),_0xadb22e,_0x90e8('0x24'));logger[_0x90e8('0x25')](_0x90e8('0x26'),_0xadb22e,_0x90e8('0x24'),JSON[_0x90e8('0x27')](_0x414de6));if(_0x414de6[_0x90e8('0x28')]){if(_0x414de6[_0x90e8('0x28')][_0x90e8('0x29')]===0x1f4){logger[_0x90e8('0x28')](_0x90e8('0x23'),_0xadb22e,_0x414de6[_0x90e8('0x28')]['message']);return _0x5c71d7(_0x414de6[_0x90e8('0x28')][_0x90e8('0x2a')]);}logger[_0x90e8('0x28')]('MailAccount,\x20%s,\x20%s',_0xadb22e,_0x414de6['error']['message']);return _0x499ff3(_0x414de6[_0x90e8('0x28')][_0x90e8('0x2a')]);}else{logger['info'](_0x90e8('0x23'),_0xadb22e,_0x90e8('0x24'));_0x499ff3(_0x414de6[_0x90e8('0x2b')][_0x90e8('0x2a')]);}})[_0x90e8('0x2c')](function(_0x96b8f4){logger['error'](_0x90e8('0x23'),_0xadb22e,_0x96b8f4);_0x5c71d7(_0x96b8f4);});});}function respondWithStatusCode(_0x369836,_0x12d0b8){_0x12d0b8=_0x12d0b8||0xcc;return function(_0x20badc){if(_0x20badc){return _0x369836[_0x90e8('0x2d')](_0x12d0b8);}return _0x369836[_0x90e8('0x2e')](_0x12d0b8)[_0x90e8('0x2f')]();};}function respondWithResult(_0x593221,_0xad29f8){_0xad29f8=_0xad29f8||0xc8;return function(_0x4a2924){if(_0x4a2924){return _0x593221[_0x90e8('0x2e')](_0xad29f8)[_0x90e8('0x30')](_0x4a2924);}};}function respondWithFilteredResult(_0x1dd730,_0x2c2001){return function(_0x2acedf){if(_0x2acedf){var _0x58851b=typeof _0x2c2001[_0x90e8('0x31')]===_0x90e8('0x32')&&typeof _0x2c2001[_0x90e8('0x33')]===_0x90e8('0x32');var _0x3a6e22=_0x2acedf[_0x90e8('0x34')];var _0x18c848=_0x58851b?0x0:_0x2c2001[_0x90e8('0x31')];var _0x72bbfd=_0x58851b?_0x2acedf[_0x90e8('0x34')]:_0x2c2001[_0x90e8('0x31')]+_0x2c2001['limit'];var _0x468edf;if(_0x72bbfd>=_0x3a6e22){_0x72bbfd=_0x3a6e22;_0x468edf=0xc8;}else{_0x468edf=0xce;}_0x1dd730[_0x90e8('0x2e')](_0x468edf);return _0x1dd730[_0x90e8('0x35')](_0x90e8('0x36'),_0x18c848+'-'+_0x72bbfd+'/'+_0x3a6e22)[_0x90e8('0x30')](_0x2acedf);}return null;};}function patchUpdates(_0x28ea15){return function(_0x5ed4d1){try{jsonpatch[_0x90e8('0x37')](_0x5ed4d1,_0x28ea15,!![]);}catch(_0x567935){return BPromise['reject'](_0x567935);}return _0x5ed4d1['save']();};}function saveUpdates(_0x468ab5,_0x3f8d55){return function(_0x22276d){if(_0x22276d){return _0x22276d['update'](_0x468ab5)['then'](function(_0x2f181c){return _0x2f181c;});}return null;};}function removeEntity(_0x339c71,_0x42f551){return function(_0x51a6a2){if(_0x51a6a2){return _0x51a6a2[_0x90e8('0x38')]()[_0x90e8('0x21')](function(){var _0x2b20b2=_0x51a6a2[_0x90e8('0x39')]({'plain':!![]});var _0x1bc4d2='MailAccounts';return db[_0x90e8('0x3a')][_0x90e8('0x38')]({'where':{'type':_0x1bc4d2,'resourceId':_0x2b20b2['id']}})[_0x90e8('0x21')](function(){return _0x51a6a2;});})[_0x90e8('0x21')](function(){_0x339c71['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15d271,_0x5c4a36){return function(_0x3eae6e){if(!_0x3eae6e){_0x15d271['sendStatus'](0x194);}return _0x3eae6e;};}function handleError(_0x364837,_0x2fdf20){_0x2fdf20=_0x2fdf20||0x1f4;return function(_0x30f922){logger[_0x90e8('0x28')](_0x30f922[_0x90e8('0x3b')]);if(_0x30f922[_0x90e8('0x3c')]){delete _0x30f922[_0x90e8('0x3c')];}_0x364837['status'](_0x2fdf20)['send'](_0x30f922);};}exports[_0x90e8('0x3d')]=function(_0x3f9e0d,_0x8b7898){var _0x472247={'include':[{'model':db[_0x90e8('0x3e')],'as':'Imap'},{'model':db[_0x90e8('0x3f')],'as':_0x90e8('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xe2efcc={},_0x2f8db8={'count':0x0,'rows':[]};var _0x11ce69=_[_0x90e8('0x41')](db[_0x90e8('0x42')]['rawAttributes'],function(_0x466a2f){return{'name':_0x466a2f[_0x90e8('0x43')],'type':_0x466a2f[_0x90e8('0x44')]['key']};});_0xe2efcc['model']=_[_0x90e8('0x41')](_0x11ce69,_0x90e8('0x3c'));_0xe2efcc[_0x90e8('0x45')]=_[_0x90e8('0x46')](_0x3f9e0d[_0x90e8('0x45')]);_0xe2efcc[_0x90e8('0x47')]=_['intersection'](_0xe2efcc[_0x90e8('0x48')],_0xe2efcc[_0x90e8('0x45')]);_0x472247[_0x90e8('0x49')]=_[_0x90e8('0x4a')](_0xe2efcc['model'],qs[_0x90e8('0x4b')](_0x3f9e0d['query'][_0x90e8('0x4b')]));_0x472247[_0x90e8('0x49')]=_0x472247[_0x90e8('0x49')][_0x90e8('0x4c')]?_0x472247[_0x90e8('0x49')]:_0xe2efcc['model'];if(!_0x3f9e0d[_0x90e8('0x45')][_0x90e8('0x4d')]('nolimit')){_0x472247[_0x90e8('0x33')]=qs['limit'](_0x3f9e0d['query']['limit']);_0x472247[_0x90e8('0x31')]=qs[_0x90e8('0x31')](_0x3f9e0d[_0x90e8('0x45')][_0x90e8('0x31')]);}_0x472247[_0x90e8('0x4e')]=qs[_0x90e8('0x4f')](_0x3f9e0d['query'][_0x90e8('0x4f')]);_0x472247[_0x90e8('0x50')]=qs[_0x90e8('0x47')](_[_0x90e8('0x51')](_0x3f9e0d[_0x90e8('0x45')],_0xe2efcc[_0x90e8('0x47')]),_0x11ce69);if(_0x3f9e0d['query'][_0x90e8('0x52')]){_0x472247[_0x90e8('0x50')]=_[_0x90e8('0x53')](_0x472247[_0x90e8('0x50')],{'$or':_[_0x90e8('0x41')](_0x11ce69,function(_0x365c0a){if(_0x365c0a[_0x90e8('0x44')]!==_0x90e8('0x54')){var _0x1dbd54={};_0x1dbd54[_0x365c0a[_0x90e8('0x3c')]]={'$like':'%'+_0x3f9e0d['query'][_0x90e8('0x52')]+'%'};return _0x1dbd54;}})});}_0x472247=_[_0x90e8('0x53')]({},_0x472247,_0x3f9e0d[_0x90e8('0x55')]);var _0x2eb4a1={'where':_0x472247[_0x90e8('0x50')]};return db[_0x90e8('0x42')]['count'](_0x2eb4a1)[_0x90e8('0x21')](function(_0x3f1406){_0x2f8db8['count']=_0x3f1406;if(_0x3f9e0d[_0x90e8('0x45')][_0x90e8('0x56')]){_0x472247['include']=[{'all':!![]}];}return db[_0x90e8('0x42')][_0x90e8('0x57')](_0x472247);})[_0x90e8('0x21')](function(_0x443000){_0x2f8db8['rows']=_0x443000;return _0x2f8db8;})[_0x90e8('0x21')](respondWithFilteredResult(_0x8b7898,_0x472247))[_0x90e8('0x2c')](handleError(_0x8b7898,null));};exports['show']=function(_0x574bcb,_0x30f82b){var _0x42716f={'raw':![],'where':{'id':_0x574bcb[_0x90e8('0x58')]['id']},'include':[{'model':db[_0x90e8('0x3e')],'as':_0x90e8('0x59')},{'model':db['MailServerOut'],'as':_0x90e8('0x40')},{'model':db[_0x90e8('0x5a')],'as':_0x90e8('0x5b')}]},_0x3178a1={};_0x3178a1['model']=_[_0x90e8('0x46')](db[_0x90e8('0x42')]['rawAttributes']);_0x3178a1[_0x90e8('0x45')]=_['keys'](_0x574bcb['query']);_0x3178a1[_0x90e8('0x47')]=_[_0x90e8('0x4a')](_0x3178a1[_0x90e8('0x48')],_0x3178a1[_0x90e8('0x45')]);_0x42716f[_0x90e8('0x49')]=_['intersection'](_0x3178a1[_0x90e8('0x48')],qs[_0x90e8('0x4b')](_0x574bcb[_0x90e8('0x45')][_0x90e8('0x4b')]));_0x42716f[_0x90e8('0x49')]=_0x42716f['attributes']['length']?_0x42716f[_0x90e8('0x49')]:_0x3178a1[_0x90e8('0x48')];if(_0x574bcb[_0x90e8('0x45')][_0x90e8('0x56')]){_0x42716f[_0x90e8('0x5c')]=[{'all':!![]}];}_0x42716f=_[_0x90e8('0x53')]({},_0x42716f,_0x574bcb[_0x90e8('0x55')]);return db[_0x90e8('0x42')][_0x90e8('0x5d')](_0x42716f)[_0x90e8('0x21')](handleEntityNotFound(_0x30f82b,null))[_0x90e8('0x21')](respondWithResult(_0x30f82b,null))[_0x90e8('0x2c')](handleError(_0x30f82b,null));};exports[_0x90e8('0x5e')]=function(_0x2051c3,_0x446eb0){if(_0x2051c3[_0x90e8('0x5f')]['id']){delete _0x2051c3['body']['id'];}return db[_0x90e8('0x42')][_0x90e8('0x5d')]({'where':{'id':_0x2051c3[_0x90e8('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x90e8('0x59')},{'model':db[_0x90e8('0x3f')],'as':_0x90e8('0x40')},{'model':db[_0x90e8('0x5a')],'as':_0x90e8('0x5b')}]})[_0x90e8('0x21')](handleEntityNotFound(_0x446eb0,null))[_0x90e8('0x21')](saveUpdates(_0x2051c3[_0x90e8('0x5f')],null))[_0x90e8('0x21')](function(_0x506aba){if(_0x506aba&&_0x2051c3[_0x90e8('0x5f')][_0x90e8('0x59')]){return db[_0x90e8('0x3e')][_0x90e8('0x5e')](_0x2051c3[_0x90e8('0x5f')]['Imap'],{'where':{'MailAccountId':_0x506aba['id']}})['then'](function(){return _0x506aba;});}return _0x506aba;})[_0x90e8('0x21')](function(_0x9d6a3){if(_0x9d6a3&&_0x2051c3[_0x90e8('0x5f')][_0x90e8('0x40')]){return db[_0x90e8('0x3f')][_0x90e8('0x5e')](_0x2051c3[_0x90e8('0x5f')]['Smtp'],{'where':{'MailAccountId':_0x9d6a3['id']}})[_0x90e8('0x21')](function(){return _0x9d6a3;});}return _0x9d6a3;})[_0x90e8('0x21')](respondWithResult(_0x446eb0,null))[_0x90e8('0x2c')](handleError(_0x446eb0,null));};exports['describe']=function(_0x462de2,_0x430b7a){return db[_0x90e8('0x42')][_0x90e8('0x60')]()[_0x90e8('0x21')](respondWithResult(_0x430b7a,null))[_0x90e8('0x2c')](handleError(_0x430b7a,null));};exports[_0x90e8('0x61')]=function(_0x31e8e0,_0x47b359,_0xaec011){if(_0x31e8e0['body']['id']){delete _0x31e8e0[_0x90e8('0x5f')]['id'];}return db['MailAccount'][_0x90e8('0x5d')]({'where':{'id':_0x31e8e0[_0x90e8('0x58')]['id']}})['then'](handleEntityNotFound(_0x47b359,null))[_0x90e8('0x21')](function(_0x434ce6){if(_0x434ce6){_0x31e8e0[_0x90e8('0x5f')][_0x90e8('0x62')]=_0x434ce6['id'];return db[_0x90e8('0x63')][_0x90e8('0x64')](_0x31e8e0[_0x90e8('0x5f')]);}})[_0x90e8('0x21')](respondWithResult(_0x47b359,null))[_0x90e8('0x2c')](handleError(_0x47b359,null));};exports[_0x90e8('0x65')]=function(_0x28780d,_0x2b9340,_0x543a97){var _0x2b5b11={'raw':![],'where':{}};var _0x180dae={};var _0x55f1db={'count':0x0,'rows':[]};return db[_0x90e8('0x42')][_0x90e8('0x66')]({'where':{'id':_0x28780d['params']['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x2b9340,null))['then'](function(_0xa0420b){if(_0xa0420b){_0x180dae[_0x90e8('0x48')]=_[_0x90e8('0x46')](db['Disposition'][_0x90e8('0x67')]);_0x180dae[_0x90e8('0x45')]=_[_0x90e8('0x46')](_0x28780d['query']);_0x180dae[_0x90e8('0x47')]=_[_0x90e8('0x4a')](_0x180dae[_0x90e8('0x48')],_0x180dae[_0x90e8('0x45')]);_0x2b5b11['attributes']=_[_0x90e8('0x4a')](_0x180dae[_0x90e8('0x48')],qs['fields'](_0x28780d[_0x90e8('0x45')][_0x90e8('0x4b')]));_0x2b5b11['attributes']=_0x2b5b11[_0x90e8('0x49')][_0x90e8('0x4c')]?_0x2b5b11[_0x90e8('0x49')]:_0x180dae[_0x90e8('0x48')];if(!_0x28780d[_0x90e8('0x45')][_0x90e8('0x4d')](_0x90e8('0x68'))){_0x2b5b11['limit']=qs[_0x90e8('0x33')](_0x28780d[_0x90e8('0x45')][_0x90e8('0x33')]);_0x2b5b11[_0x90e8('0x31')]=qs[_0x90e8('0x31')](_0x28780d[_0x90e8('0x45')][_0x90e8('0x31')]);}_0x2b5b11[_0x90e8('0x4e')]=qs[_0x90e8('0x4f')](_0x28780d['query'][_0x90e8('0x4f')]);_0x2b5b11['where']=qs[_0x90e8('0x47')](_[_0x90e8('0x51')](_0x28780d[_0x90e8('0x45')],_0x180dae[_0x90e8('0x47')]));_0x2b5b11[_0x90e8('0x50')][_0x90e8('0x62')]=_0xa0420b['id'];if(_0x28780d[_0x90e8('0x45')][_0x90e8('0x52')]){_0x2b5b11['where']=_[_0x90e8('0x53')](_0x2b5b11[_0x90e8('0x50')],{'$or':_[_0x90e8('0x41')](_0x2b5b11[_0x90e8('0x49')],function(_0x4f2a11){var _0x1ad4fd={};_0x1ad4fd[_0x4f2a11]={'$like':'%'+_0x28780d[_0x90e8('0x45')]['filter']+'%'};return _0x1ad4fd;})});}_0x2b5b11=_['merge']({},_0x2b5b11,_0x28780d[_0x90e8('0x55')]);return db['Disposition'][_0x90e8('0x34')]({'where':_0x2b5b11['where']})['then'](function(_0x1c2487){_0x55f1db['count']=_0x1c2487;if(_0x28780d['query'][_0x90e8('0x56')]){_0x2b5b11[_0x90e8('0x5c')]=[{'all':!![]}];}return db[_0x90e8('0x63')][_0x90e8('0x57')](_0x2b5b11);})[_0x90e8('0x21')](function(_0xfe01f4){_0x55f1db[_0x90e8('0x69')]=_0xfe01f4;return _0x55f1db;});}})['then'](respondWithFilteredResult(_0x2b9340,_0x2b5b11))[_0x90e8('0x2c')](handleError(_0x2b9340,null));};exports['removeDispositions']=function(_0x3ccb28,_0x4262cb,_0x1c7ed6){return db['MailAccount']['find']({'where':{'id':_0x3ccb28[_0x90e8('0x58')]['id']}})['then'](handleEntityNotFound(_0x4262cb,null))[_0x90e8('0x21')](function(_0x47b0ef){if(_0x47b0ef){return _0x47b0ef[_0x90e8('0x6a')](_0x3ccb28[_0x90e8('0x45')]['ids']);}})[_0x90e8('0x21')](respondWithStatusCode(_0x4262cb,null))[_0x90e8('0x2c')](handleError(_0x4262cb,null));};exports['addAnswer']=function(_0xc18441,_0x1b310a,_0x2935ab){if(_0xc18441[_0x90e8('0x5f')]['id']){delete _0xc18441['body']['id'];}return db[_0x90e8('0x42')]['find']({'where':{'id':_0xc18441[_0x90e8('0x58')]['id']}})['then'](handleEntityNotFound(_0x1b310a,null))[_0x90e8('0x21')](function(_0x110f21){if(_0x110f21){_0xc18441[_0x90e8('0x5f')]['MailAccountId']=_0x110f21['id'];return db['CannedAnswer'][_0x90e8('0x64')](_0xc18441[_0x90e8('0x5f')]);}})[_0x90e8('0x21')](respondWithResult(_0x1b310a,null))[_0x90e8('0x2c')](handleError(_0x1b310a,null));};exports[_0x90e8('0x6b')]=function(_0x233876,_0x5157d3,_0x1f8a2b){var _0x56a463={'raw':![],'where':{}};var _0x36d007={};var _0x444652={'count':0x0,'rows':[]};return db[_0x90e8('0x42')][_0x90e8('0x66')]({'where':{'id':_0x233876[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x5157d3,null))[_0x90e8('0x21')](function(_0x4f439b){if(_0x4f439b){_0x36d007[_0x90e8('0x48')]=_[_0x90e8('0x46')](db[_0x90e8('0x6c')][_0x90e8('0x67')]);_0x36d007[_0x90e8('0x45')]=_[_0x90e8('0x46')](_0x233876[_0x90e8('0x45')]);_0x36d007[_0x90e8('0x47')]=_[_0x90e8('0x4a')](_0x36d007['model'],_0x36d007[_0x90e8('0x45')]);_0x56a463[_0x90e8('0x49')]=_[_0x90e8('0x4a')](_0x36d007[_0x90e8('0x48')],qs['fields'](_0x233876['query'][_0x90e8('0x4b')]));_0x56a463[_0x90e8('0x49')]=_0x56a463[_0x90e8('0x49')][_0x90e8('0x4c')]?_0x56a463['attributes']:_0x36d007['model'];if(!_0x233876[_0x90e8('0x45')][_0x90e8('0x4d')](_0x90e8('0x68'))){_0x56a463[_0x90e8('0x33')]=qs['limit'](_0x233876[_0x90e8('0x45')][_0x90e8('0x33')]);_0x56a463['offset']=qs[_0x90e8('0x31')](_0x233876[_0x90e8('0x45')][_0x90e8('0x31')]);}_0x56a463['order']=qs['sort'](_0x233876['query'][_0x90e8('0x4f')]);_0x56a463[_0x90e8('0x50')]=qs[_0x90e8('0x47')](_['pick'](_0x233876['query'],_0x36d007['filters']));_0x56a463[_0x90e8('0x50')][_0x90e8('0x62')]=_0x4f439b['id'];if(_0x233876['query'][_0x90e8('0x52')]){_0x56a463['where']=_[_0x90e8('0x53')](_0x56a463[_0x90e8('0x50')],{'$or':_[_0x90e8('0x41')](_0x56a463[_0x90e8('0x49')],function(_0x2fdcc8){var _0x1bb109={};_0x1bb109[_0x2fdcc8]={'$like':'%'+_0x233876['query'][_0x90e8('0x52')]+'%'};return _0x1bb109;})});}_0x56a463=_['merge']({},_0x56a463,_0x233876['options']);return db[_0x90e8('0x6c')][_0x90e8('0x34')]({'where':_0x56a463[_0x90e8('0x50')]})[_0x90e8('0x21')](function(_0x1bd332){_0x444652[_0x90e8('0x34')]=_0x1bd332;if(_0x233876[_0x90e8('0x45')]['includeAll']){_0x56a463[_0x90e8('0x5c')]=[{'all':!![]}];}return db[_0x90e8('0x6c')][_0x90e8('0x57')](_0x56a463);})['then'](function(_0x54cc2e){_0x444652[_0x90e8('0x69')]=_0x54cc2e;return _0x444652;});}})[_0x90e8('0x21')](respondWithFilteredResult(_0x5157d3,_0x56a463))[_0x90e8('0x2c')](handleError(_0x5157d3,null));};exports[_0x90e8('0x6d')]=function(_0x21d55c,_0x4521e0,_0x2e90a4){return db[_0x90e8('0x42')][_0x90e8('0x5d')]({'where':{'id':_0x21d55c[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x4521e0,null))['then'](function(_0x3e1cde){if(_0x3e1cde){return _0x3e1cde[_0x90e8('0x6d')](_0x21d55c['query'][_0x90e8('0x6e')]);}})[_0x90e8('0x21')](respondWithStatusCode(_0x4521e0,null))[_0x90e8('0x2c')](handleError(_0x4521e0,null));};exports['create']=function(_0xe74a66,_0x43e4a0){var _0x1ab84e={'name':_0xe74a66[_0x90e8('0x5f')]['name'],'key':_0xe74a66['body']['key'],'email':_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x6f')],'ListId':_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x70')],'active':!_[_0x90e8('0x71')](_0xe74a66['body']['active'])?_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x72')]:!![],'description':_0xe74a66['body'][_0x90e8('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0x90e8('0x71')](_0xe74a66['body']['cservice'])){if(_0xe74a66['body'][_0x90e8('0x74')]){_0x1ab84e[_0x90e8('0x59')]['user']=_0x1ab84e['Smtp'][_0x90e8('0x75')]=_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x76')];_0x1ab84e[_0x90e8('0x59')][_0x90e8('0x77')]=_0x1ab84e['Smtp'][_0x90e8('0x78')]=_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x79')];}else{_0x1ab84e[_0x90e8('0x59')]['authentication']=_0x1ab84e[_0x90e8('0x40')][_0x90e8('0x7a')]=![];}_0x1ab84e[_0x90e8('0x59')][_0x90e8('0x7b')]=_0xe74a66[_0x90e8('0x5f')]['Imap'][_0x90e8('0x7b')];_0x1ab84e['Imap'][_0x90e8('0x7c')]=_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x59')][_0x90e8('0x7c')];_0x1ab84e[_0x90e8('0x40')][_0x90e8('0x7b')]=_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x40')]['host'];_0x1ab84e[_0x90e8('0x40')][_0x90e8('0x7c')]=_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x40')][_0x90e8('0x7c')];}else{_0x1ab84e[_0x90e8('0x59')]['service']=_0x1ab84e['Smtp'][_0x90e8('0x7d')]=_0xe74a66[_0x90e8('0x5f')]['cservice'];_0x1ab84e[_0x90e8('0x59')][_0x90e8('0x75')]=_0x1ab84e[_0x90e8('0x40')][_0x90e8('0x75')]=_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x76')];_0x1ab84e[_0x90e8('0x59')][_0x90e8('0x77')]=_0x1ab84e[_0x90e8('0x40')][_0x90e8('0x78')]=_0xe74a66[_0x90e8('0x5f')][_0x90e8('0x79')];}return db['MailAccount']['create'](_0x1ab84e,{'include':[{'model':db[_0x90e8('0x3f')],'as':_0x90e8('0x40')},{'model':db[_0x90e8('0x3e')],'as':_0x90e8('0x59')}]})[_0x90e8('0x21')](function(_0x4665d8){var _0x386332=_0xe74a66[_0x90e8('0x75')][_0x90e8('0x39')]({'plain':!![]});if(!_0x386332)throw new Error(_0x90e8('0x7e'));if(_0x386332[_0x90e8('0x7f')]===_0x90e8('0x75')){var _0x107077=_0x4665d8[_0x90e8('0x39')]({'plain':!![]});return db[_0x90e8('0x80')][_0x90e8('0x5d')]({'where':{'name':_0x90e8('0x81'),'userProfileId':_0x386332[_0x90e8('0x82')]},'raw':!![]})['then'](function(_0x7ef338){if(_0x7ef338&&_0x7ef338[_0x90e8('0x83')]===0x0){return db['UserProfileResource']['create']({'name':_0x107077['name'],'resourceId':_0x107077['id'],'type':_0x7ef338[_0x90e8('0x3c')],'sectionId':_0x7ef338['id']},{})['then'](function(){return _0x4665d8;});}else{return _0x4665d8;}})[_0x90e8('0x2c')](function(_0x56ed6a){logger[_0x90e8('0x28')](_0x90e8('0x84'),_0x56ed6a);throw _0x56ed6a;});}return _0x4665d8;})['then'](respondWithResult(_0x43e4a0,0xc9))[_0x90e8('0x2c')](handleError(_0x43e4a0,null));};exports['getImap']=function(_0x20111b,_0x5641c6,_0x3ac5a8){return db[_0x90e8('0x42')][_0x90e8('0x66')]({'where':{'id':_0x20111b['params']['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x5641c6,null))[_0x90e8('0x21')](function(_0x2681ac){if(_0x2681ac){return _0x2681ac['getImap']();}return null;})['then'](respondWithResult(_0x5641c6,null))[_0x90e8('0x2c')](handleError(_0x5641c6,null));};exports[_0x90e8('0x85')]=function(_0x80fb07,_0x4dff02,_0x14c1ae){if(_0x80fb07[_0x90e8('0x5f')]['id']){delete _0x80fb07[_0x90e8('0x5f')]['id'];}return db[_0x90e8('0x42')][_0x90e8('0x5d')]({'where':{'id':_0x80fb07[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x4dff02,null))[_0x90e8('0x21')](function(_0x1337ad){if(_0x1337ad){_0x80fb07[_0x90e8('0x5f')][_0x90e8('0x62')]=_0x1337ad['id'];return db[_0x90e8('0x3e')][_0x90e8('0x64')](_0x80fb07[_0x90e8('0x5f')]);}})[_0x90e8('0x21')](respondWithResult(_0x4dff02,null))[_0x90e8('0x2c')](handleError(_0x4dff02,null));};exports[_0x90e8('0x86')]=function(_0x7e1b8e,_0x440615,_0x5426b1){return db[_0x90e8('0x42')][_0x90e8('0x66')]({'where':{'id':_0x7e1b8e[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x440615,null))['then'](function(_0x5305a5){if(_0x5305a5){return _0x5305a5[_0x90e8('0x87')](null);}return null;})[_0x90e8('0x21')](respondWithStatusCode(_0x440615,null))['catch'](handleError(_0x440615,null));};exports[_0x90e8('0x88')]=function(_0x142932,_0x221a8a,_0xa44ada){return db['MailAccount']['findOne']({'where':{'id':_0x142932[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x221a8a,null))['then'](function(_0x525f97){if(_0x525f97){return _0x525f97[_0x90e8('0x88')]();}return null;})[_0x90e8('0x21')](respondWithResult(_0x221a8a,null))[_0x90e8('0x2c')](handleError(_0x221a8a,null));};exports[_0x90e8('0x89')]=function(_0x2e7d46,_0x1895dd,_0x40c57e){if(_0x2e7d46[_0x90e8('0x5f')]['id']){delete _0x2e7d46[_0x90e8('0x5f')]['id'];}return db[_0x90e8('0x42')][_0x90e8('0x5d')]({'where':{'id':_0x2e7d46[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x1895dd,null))[_0x90e8('0x21')](function(_0x470948){if(_0x470948){_0x2e7d46[_0x90e8('0x5f')][_0x90e8('0x62')]=_0x470948['id'];return db[_0x90e8('0x3f')][_0x90e8('0x64')](_0x2e7d46['body']);}})[_0x90e8('0x21')](respondWithResult(_0x1895dd,null))[_0x90e8('0x2c')](handleError(_0x1895dd,null));};exports[_0x90e8('0x8a')]=function(_0x51dafd,_0x44a74d,_0x1ad118){return db[_0x90e8('0x42')][_0x90e8('0x66')]({'where':{'id':_0x51dafd[_0x90e8('0x58')]['id']}})['then'](handleEntityNotFound(_0x44a74d,null))[_0x90e8('0x21')](function(_0x374666){if(_0x374666){return _0x374666[_0x90e8('0x8b')](null);}return null;})[_0x90e8('0x21')](respondWithStatusCode(_0x44a74d,null))['catch'](handleError(_0x44a74d,null));};exports['addInteraction']=function(_0x51fc5d,_0x51b356,_0x4da054){return db[_0x90e8('0x8c')][_0x90e8('0x5d')]({'where':{'id':_0x51fc5d[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x51b356,null))[_0x90e8('0x21')](function(_0x53467a){if(_0x53467a){return _0x53467a[_0x90e8('0x8d')](_0x51fc5d[_0x90e8('0x5f')][_0x90e8('0x6e')],_[_0x90e8('0x8e')](_0x51fc5d[_0x90e8('0x5f')],[_0x90e8('0x6e'),'id'])||{});}})[_0x90e8('0x21')](respondWithResult(_0x51b356,null))[_0x90e8('0x2c')](handleError(_0x51b356,null));};exports['getInteractions']=function(_0x12af0c,_0x7b5372,_0x222919){var _0x54d4d1={'raw':![],'where':{}};var _0x3a585e={};var _0x2d8e3b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x12af0c[_0x90e8('0x58')]['id']}})['then'](handleEntityNotFound(_0x7b5372,null))[_0x90e8('0x21')](function(_0x12423a){if(_0x12423a){_0x3a585e[_0x90e8('0x48')]=_['keys'](db[_0x90e8('0x8c')][_0x90e8('0x67')]);_0x3a585e[_0x90e8('0x45')]=_['keys'](_0x12af0c[_0x90e8('0x45')]);_0x3a585e[_0x90e8('0x47')]=_['intersection'](_0x3a585e[_0x90e8('0x48')],_0x3a585e[_0x90e8('0x45')]);_0x54d4d1['attributes']=_[_0x90e8('0x4a')](_0x3a585e[_0x90e8('0x48')],qs[_0x90e8('0x4b')](_0x12af0c[_0x90e8('0x45')][_0x90e8('0x4b')]));_0x54d4d1[_0x90e8('0x49')]=_0x54d4d1[_0x90e8('0x49')]['length']?_0x54d4d1[_0x90e8('0x49')]:_0x3a585e['model'];if(!_0x12af0c[_0x90e8('0x45')][_0x90e8('0x4d')](_0x90e8('0x68'))){_0x54d4d1[_0x90e8('0x33')]=qs[_0x90e8('0x33')](_0x12af0c[_0x90e8('0x45')][_0x90e8('0x33')]);_0x54d4d1['offset']=qs[_0x90e8('0x31')](_0x12af0c['query'][_0x90e8('0x31')]);}_0x54d4d1[_0x90e8('0x4e')]=qs['sort'](_0x12af0c[_0x90e8('0x45')][_0x90e8('0x4f')]);_0x54d4d1[_0x90e8('0x50')]=qs[_0x90e8('0x47')](_[_0x90e8('0x51')](_0x12af0c['query'],_0x3a585e[_0x90e8('0x47')]));_0x54d4d1[_0x90e8('0x50')][_0x90e8('0x62')]=_0x12423a['id'];if(_0x12af0c[_0x90e8('0x45')][_0x90e8('0x52')]){_0x54d4d1[_0x90e8('0x50')]=_[_0x90e8('0x53')](_0x54d4d1[_0x90e8('0x50')],{'$or':_[_0x90e8('0x41')](_0x54d4d1['attributes'],function(_0x472c2f){var _0x5c17b6={};_0x5c17b6[_0x472c2f]={'$like':'%'+_0x12af0c['query'][_0x90e8('0x52')]+'%'};return _0x5c17b6;})});}_0x54d4d1=_[_0x90e8('0x53')]({},_0x54d4d1,_0x12af0c['options']);return db['MailInteraction']['count']({'where':_0x54d4d1[_0x90e8('0x50')]})[_0x90e8('0x21')](function(_0x1dbfc5){_0x2d8e3b[_0x90e8('0x34')]=_0x1dbfc5;if(_0x12af0c['query']['includeAll']){_0x54d4d1[_0x90e8('0x5c')]=[{'model':db[_0x90e8('0x8f')],'as':_0x90e8('0x90'),'required':![]},{'model':db['User'],'as':_0x90e8('0x91'),'attributes':['name',_0x90e8('0x92'),'internal'],'required':![]},{'model':db[_0x90e8('0x93')],'as':_0x90e8('0x94'),'attributes':['id',_0x90e8('0x3c'),'color'],'where':_0x12af0c['query']['tag']?{'id':_0x12af0c[_0x90e8('0x45')]['tag']}:undefined,'required':_0x12af0c['query'][_0x90e8('0x95')]?!![]:![]}];}return db[_0x90e8('0x8c')][_0x90e8('0x57')](_0x54d4d1);})[_0x90e8('0x21')](function(_0x37954c){_0x2d8e3b[_0x90e8('0x69')]=_0x37954c;return _0x2d8e3b;});}})[_0x90e8('0x21')](respondWithFilteredResult(_0x7b5372,_0x54d4d1))['catch'](handleError(_0x7b5372,null));};exports['addApplications']=function addApplications(_0x5343a5,_0xf3a8c){var _0x49da89=_0x5343a5[_0x90e8('0x58')]['id'];var _0x313e05=_0x5343a5[_0x90e8('0x5f')];var _0x510874=0xc8;var _0x337fb3=null;return db[_0x90e8('0x96')]['transaction']({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x90e8('0x97')]},function(_0x1414ea){return db[_0x90e8('0x42')][_0x90e8('0x66')]({'where':{'id':_0x49da89},'transaction':_0x1414ea})[_0x90e8('0x21')](function(_0x5483a2){if(_0x5483a2){return db[_0x90e8('0x98')]['destroy']({'where':{'MailAccountId':_0x49da89},'transaction':_0x1414ea})[_0x90e8('0x21')](function(){var _0x1ef905=_['map'](_0x313e05,function(_0x3f0487){_0x3f0487[_0x90e8('0x62')]=_0x49da89;return _0x3f0487;});return db[_0x90e8('0x98')][_0x90e8('0x99')](_0x1ef905,{'transaction':_0x1414ea});});}else{_0x510874=0x194;_0x337fb3=[];}});})[_0x90e8('0x21')](function(){if(_0x510874!==0x194){return db['MailApplication'][_0x90e8('0x9a')]({'where':{'MailAccountId':_0x49da89},'order':_0x90e8('0x9b')})['then'](function(_0x4f4cfe){_0x337fb3=_0x4f4cfe;});}})[_0x90e8('0x2c')](function(_0x225a4b){_0x510874=0x1f4;logger[_0x90e8('0x28')](_0x225a4b[_0x90e8('0x3b')]);if(_0x225a4b[_0x90e8('0x3c')]){delete _0x225a4b['name'];}_0x337fb3=_0x225a4b;})[_0x90e8('0x9c')](function(){if(_0x337fb3===null){_0xf3a8c[_0x90e8('0x2d')](_0x510874);}else{if(_0x510874===0x1f4){_0xf3a8c[_0x90e8('0x2e')](_0x510874)['send'](_0x337fb3);}else{_0xf3a8c[_0x90e8('0x2e')](_0x510874)[_0x90e8('0x30')](_0x337fb3);}}});};exports['getApplications']=function(_0x52cef3,_0x1e0349,_0x3c0d25){var _0x328649={};var _0x57ffb0={};var _0x2d1f84;var _0x521cb5;return db[_0x90e8('0x42')][_0x90e8('0x66')]({'where':{'id':_0x52cef3['params']['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x1e0349,null))[_0x90e8('0x21')](function(_0x35260c){if(_0x35260c){_0x2d1f84=_0x35260c;_0x57ffb0[_0x90e8('0x48')]=_[_0x90e8('0x46')](db['MailApplication']['rawAttributes']);_0x57ffb0['query']=_[_0x90e8('0x46')](_0x52cef3['query']);_0x57ffb0['filters']=_[_0x90e8('0x4a')](_0x57ffb0[_0x90e8('0x48')],_0x57ffb0[_0x90e8('0x45')]);_0x328649[_0x90e8('0x49')]=_['intersection'](_0x57ffb0['model'],qs['fields'](_0x52cef3['query'][_0x90e8('0x4b')]));_0x328649[_0x90e8('0x49')]=_0x328649[_0x90e8('0x49')][_0x90e8('0x4c')]?_0x328649[_0x90e8('0x49')]:_0x57ffb0[_0x90e8('0x48')];_0x328649[_0x90e8('0x4e')]=qs[_0x90e8('0x4f')](_0x52cef3['query'][_0x90e8('0x4f')]);_0x328649[_0x90e8('0x50')]=qs[_0x90e8('0x47')](_[_0x90e8('0x51')](_0x52cef3['query'],_0x57ffb0['filters']));if(_0x52cef3['query'][_0x90e8('0x52')]){_0x328649[_0x90e8('0x50')]=_['merge'](_0x328649[_0x90e8('0x50')],{'$or':_['map'](_0x328649[_0x90e8('0x49')],function(_0x2406c9){var _0x397991={};_0x397991[_0x2406c9]={'$like':'%'+_0x52cef3[_0x90e8('0x45')][_0x90e8('0x52')]+'%'};return _0x397991;})});}_0x328649=_[_0x90e8('0x53')]({},_0x328649,_0x52cef3['options']);return _0x2d1f84['getApplications'](_0x328649);}})[_0x90e8('0x21')](function(_0x1d64da){if(_0x1d64da){_0x521cb5=_0x1d64da['length'];if(!_0x52cef3['query'][_0x90e8('0x4d')](_0x90e8('0x68'))){_0x328649[_0x90e8('0x33')]=qs[_0x90e8('0x33')](_0x52cef3[_0x90e8('0x45')][_0x90e8('0x33')]);_0x328649['offset']=qs[_0x90e8('0x31')](_0x52cef3[_0x90e8('0x45')]['offset']);}return _0x2d1f84[_0x90e8('0x9d')](_0x328649);}})[_0x90e8('0x21')](function(_0x492c66){if(_0x492c66){return _0x492c66?{'count':_0x521cb5,'rows':_0x492c66}:null;}})['then'](respondWithResult(_0x1e0349,null))[_0x90e8('0x2c')](handleError(_0x1e0349,null));};exports[_0x90e8('0x9e')]=function(_0x339ca2,_0x55ec6a,_0x1d28ff){var _0xc70fb5={'raw':!![],'where':{}};var _0xd9f7e0={};var _0xeb48a1={'count':0x0,'rows':[]};return db[_0x90e8('0x42')][_0x90e8('0x66')]({'where':{'id':_0x339ca2['params']['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x55ec6a,null))[_0x90e8('0x21')](function(_0x22e261){if(_0x22e261){_0xd9f7e0['model']=_['keys'](db[_0x90e8('0x9f')]['rawAttributes']);_0xd9f7e0['query']=_[_0x90e8('0x46')](_0x339ca2['query']);_0xd9f7e0['filters']=_['intersection'](_0xd9f7e0['model'],_0xd9f7e0[_0x90e8('0x45')]);_0xc70fb5[_0x90e8('0x49')]=_['intersection'](_0xd9f7e0[_0x90e8('0x48')],qs[_0x90e8('0x4b')](_0x339ca2[_0x90e8('0x45')][_0x90e8('0x4b')]));_0xc70fb5[_0x90e8('0x49')]=_0xc70fb5[_0x90e8('0x49')][_0x90e8('0x4c')]?_0xc70fb5[_0x90e8('0x49')]:_0xd9f7e0['model'];if(!_0x339ca2[_0x90e8('0x45')][_0x90e8('0x4d')](_0x90e8('0x68'))){_0xc70fb5[_0x90e8('0x33')]=qs[_0x90e8('0x33')](_0x339ca2[_0x90e8('0x45')][_0x90e8('0x33')]);_0xc70fb5[_0x90e8('0x31')]=qs[_0x90e8('0x31')](_0x339ca2[_0x90e8('0x45')][_0x90e8('0x31')]);}_0xc70fb5['order']=qs[_0x90e8('0x4f')](_0x339ca2[_0x90e8('0x45')][_0x90e8('0x4f')]);_0xc70fb5[_0x90e8('0x50')]=qs[_0x90e8('0x47')](_[_0x90e8('0x51')](_0x339ca2[_0x90e8('0x45')],_0xd9f7e0['filters']));_0xc70fb5[_0x90e8('0x50')][_0x90e8('0x62')]=_0x22e261['id'];if(_0x339ca2['query'][_0x90e8('0x52')]){_0xc70fb5[_0x90e8('0x50')]=_[_0x90e8('0x53')](_0xc70fb5[_0x90e8('0x50')],{'$or':_[_0x90e8('0x41')](_0xc70fb5['attributes'],function(_0x18b8df){var _0x5528c5={};_0x5528c5[_0x18b8df]={'$like':'%'+_0x339ca2['query'][_0x90e8('0x52')]+'%'};return _0x5528c5;})});}if(_0x339ca2[_0x90e8('0x45')][_0x90e8('0xa0')]){var _0x3a3618=_0x339ca2['query'][_0x90e8('0xa0')]['split'](',');var _0x55ab02={};_0x55ab02[_0x3a3618[0x0]]={'$gte':moment(_0x3a3618[0x1])[_0x90e8('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0xc70fb5[_0x90e8('0x50')]=_[_0x90e8('0x53')](_0xc70fb5[_0x90e8('0x50')],_0x55ab02);}_0xc70fb5=_[_0x90e8('0x53')]({},_0xc70fb5,_0x339ca2[_0x90e8('0x55')]);return db[_0x90e8('0x9f')][_0x90e8('0x34')]({'where':_0xc70fb5['where']})[_0x90e8('0x21')](function(_0x15c6f4){_0xeb48a1[_0x90e8('0x34')]=_0x15c6f4;if(_0x339ca2[_0x90e8('0x45')][_0x90e8('0x56')]){_0xc70fb5[_0x90e8('0x5c')]=[{'all':!![]}];}return db[_0x90e8('0x9f')][_0x90e8('0x57')](_0xc70fb5);})['then'](function(_0x791e4c){if(_0x339ca2[_0x90e8('0x45')]['inlineCss']===_0x90e8('0xa2')){for(var _0x3553a3=0x0;_0x3553a3<_0x791e4c[_0x90e8('0x4c')];_0x3553a3++){_0x791e4c[_0x3553a3][_0x90e8('0x5f')]=juice(_0x791e4c[_0x3553a3][_0x90e8('0x5f')]);}}_0xeb48a1['rows']=_0x791e4c;return _0xeb48a1;});}})[_0x90e8('0x21')](respondWithFilteredResult(_0x55ec6a,_0xc70fb5))[_0x90e8('0x2c')](handleError(_0x55ec6a,null));};exports['send']=function(_0x5d4d3b,_0x49482d,_0x9ff81){var _0x1b6097,_0x31ae3d={},_0x32270f;if(_0x5d4d3b[_0x90e8('0x5f')]['to']){_0x32270f=_0x5d4d3b[_0x90e8('0x5f')]['to']['split'](',')[0x0];}return db[_0x90e8('0x42')]['find']({'where':{'id':_0x5d4d3b['params']['id']},'include':[{'model':db[_0x90e8('0xa3')],'as':'List','include':[{'model':db[_0x90e8('0x8f')],'as':_0x90e8('0xa4'),'where':{'email':_0x32270f},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x90e8('0x3f')],'as':_0x90e8('0x40'),'raw':!![]}]})['then'](handleEntityNotFound(_0x49482d,null))['then'](function(_0x340eca){if(_0x340eca){_0x1b6097=_0x340eca;if(_0x340eca[_0x90e8('0x40')]){if(_[_0x90e8('0x71')](_0x5d4d3b['body'][_0x90e8('0xa5')])){_0x5d4d3b[_0x90e8('0x5f')][_0x90e8('0xa5')]=util['format'](_0x90e8('0xa6'),_0x340eca[_0x90e8('0x3c')],_0x340eca['email']||_0x340eca['Smtp'][_0x90e8('0x75')]);}if(_0x5d4d3b['body'][_0x90e8('0xa7')]&&_0x5d4d3b[_0x90e8('0x5f')]['attachments']['length']){for(var _0x2d2435=0x0;_0x2d2435<_0x5d4d3b[_0x90e8('0x5f')][_0x90e8('0xa7')][_0x90e8('0x4c')];_0x2d2435+=0x1){_0x5d4d3b[_0x90e8('0x5f')]['attachments'][_0x2d2435]={'filename':_0x5d4d3b['body'][_0x90e8('0xa7')][_0x2d2435][_0x90e8('0x3c')],'path':path[_0x90e8('0xa8')](config[_0x90e8('0xa9')],_0x90e8('0xaa'),_0x5d4d3b[_0x90e8('0x5f')]['attachments'][_0x2d2435][_0x90e8('0xab')])};}}var _0xfb5cf6={'tls':{'rejectUnauthorized':![]}};if(_[_0x90e8('0x71')](_0x340eca[_0x90e8('0x40')][_0x90e8('0x7d')])){if(_0x340eca[_0x90e8('0x40')][_0x90e8('0x7a')]){_0xfb5cf6[_0x90e8('0xac')]={'user':_0x340eca[_0x90e8('0x40')][_0x90e8('0x75')],'pass':_0x340eca[_0x90e8('0x40')][_0x90e8('0x78')]};}_0xfb5cf6[_0x90e8('0x7b')]=_0x340eca[_0x90e8('0x40')][_0x90e8('0x7b')];_0xfb5cf6['port']=_0x340eca['Smtp'][_0x90e8('0x7c')];_0xfb5cf6['secure']=_0x340eca['Smtp'][_0x90e8('0xad')];}else{_0xfb5cf6[_0x90e8('0x7d')]=_0x340eca['Smtp'][_0x90e8('0x7d')];_0xfb5cf6[_0x90e8('0xac')]={'user':_0x340eca[_0x90e8('0x40')][_0x90e8('0x75')],'pass':_0x340eca[_0x90e8('0x40')][_0x90e8('0x78')]};}return respondWithRpcPromise(_0x90e8('0xae'),_0x90e8('0xaf'),{'account':_0xfb5cf6,'message':_0x5d4d3b[_0x90e8('0x5f')]});}else{throw new Error('List\x20not\x20found');}}})[_0x90e8('0x21')](function(_0x490a45){if(_0x490a45){_0x31ae3d=_0x490a45;if(_0x1b6097[_0x90e8('0xb0')]){if(_0x1b6097[_0x90e8('0xb0')][_0x90e8('0xa4')]['length']){return _0x1b6097[_0x90e8('0xb0')][_0x90e8('0xa4')][0x0];}else{return db['CmContact'][_0x90e8('0x64')](_[_0x90e8('0x1a')](_0x5d4d3b[_0x90e8('0x5f')],{'firstName':_0x5d4d3b['body']['to'],'email':_0x5d4d3b[_0x90e8('0x5f')]['to'],'phone':_0x5d4d3b[_0x90e8('0x5f')]['to'],'ListId':_0x1b6097[_0x90e8('0x70')]}));}}else{throw new Error(_0x90e8('0xb1'));}}})[_0x90e8('0x21')](function(_0x242dba){if(_0x242dba){var _0x256a8b={'UserId':_0x5d4d3b[_0x90e8('0x75')]['id'],'ContactId':_0x242dba['id'],'MailAccountId':_0x1b6097['id'],'inReplyTo':_0x31ae3d[_0x90e8('0xb2')],'to':_0x5d4d3b[_0x90e8('0x5f')]['from'],'cc':_0x5d4d3b[_0x90e8('0x5f')]['cc'],'subject':_0x5d4d3b[_0x90e8('0x5f')]['subject'],'attach':_0x5d4d3b[_0x90e8('0x5f')][_0x90e8('0xb3')],'firstMsgDirection':_0x90e8('0xb4'),'lastMsgAt':moment()[_0x90e8('0xa1')](_0x90e8('0xb5')),'lastMsgDirection':_0x90e8('0xb4'),'Messages':[_['merge'](_0x5d4d3b[_0x90e8('0x5f')],{'messageId':_0x31ae3d[_0x90e8('0xb2')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x1b6097['id'],'UserId':_0x5d4d3b[_0x90e8('0x75')]['id'],'ContactId':_0x242dba['id']})]};if(_0x5d4d3b[_0x90e8('0x5f')]['Interaction']){_0x256a8b=_[_0x90e8('0x53')](_0x256a8b,_0x5d4d3b[_0x90e8('0x5f')]['Interaction']);}return db[_0x90e8('0x8c')]['create'](_0x256a8b,{'include':[{'model':db[_0x90e8('0x9f')],'as':_0x90e8('0xb6')}]});}})[_0x90e8('0x21')](respondWithResult(_0x49482d,null))[_0x90e8('0x2c')](handleError(_0x49482d,null));};exports['verifySmtp']=function(_0xa6a42b,_0x2496b2,_0x3be54b){return db[_0x90e8('0x42')]['find']({'where':{'id':_0xa6a42b[_0x90e8('0x58')]['id']},'include':[{'model':db[_0x90e8('0x3f')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x2496b2,null))[_0x90e8('0x21')](function(_0x22d547){if(_0x22d547&&_0x22d547[_0x90e8('0x40')]){var _0x3ed24d={'id':_0x22d547['id'],'tls':{'rejectUnauthorized':![]}};if(_0x22d547['Smtp'][_0x90e8('0x7d')]){_0x3ed24d[_0x90e8('0x7d')]=_0x22d547['Smtp']['service'];}else{_0x3ed24d['host']=_0x22d547[_0x90e8('0x40')]['host'];_0x3ed24d[_0x90e8('0x7c')]=_0x22d547[_0x90e8('0x40')][_0x90e8('0x7c')];_0x3ed24d[_0x90e8('0xad')]=_0x22d547[_0x90e8('0x40')][_0x90e8('0xad')];}if(_0x22d547[_0x90e8('0x40')][_0x90e8('0x7a')]){_0x3ed24d[_0x90e8('0xac')]={'user':_0x22d547['Smtp'][_0x90e8('0x75')],'pass':_0x22d547[_0x90e8('0x40')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x90e8('0xb7'),{'account':_0x3ed24d});}})[_0x90e8('0x21')](respondWithResult(_0x2496b2,null))[_0x90e8('0x2c')](handleError(_0x2496b2,null));};exports['destroy']=function(_0x5b43e0,_0x59674a){return db['MailAccount']['find']({'where':{'id':_0x5b43e0[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x59674a,null))[_0x90e8('0x21')](function(_0x2021dd){if(_0x2021dd&&_0x2021dd[_0x90e8('0x7d')]){throw new db[(_0x90e8('0xb8'))][(_0x90e8('0xb9'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2021dd;})[_0x90e8('0x21')](removeEntity(_0x59674a,null))[_0x90e8('0x2c')](handleError(_0x59674a,null));};exports[_0x90e8('0xba')]=function(_0x2435fb,_0x596aa1,_0x336915){return db['MailAccount'][_0x90e8('0x5d')]({'where':{'id':_0x2435fb[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x596aa1,null))[_0x90e8('0x21')](function(_0x14a132){if(_0x14a132){return _0x14a132[_0x90e8('0xba')](_0x2435fb[_0x90e8('0x5f')][_0x90e8('0x6e')],_[_0x90e8('0x8e')](_0x2435fb[_0x90e8('0x5f')],[_0x90e8('0x6e'),'id'])||{})[_0x90e8('0xbb')](function(_0x63a6d7){for(var _0x471e91=0x0;_0x471e91<_0x2435fb['body']['ids']['length'];_0x471e91+=0x1){socket[_0x90e8('0xbc')]('userMailAccount:save',{'UserId':Number(_0x2435fb['body'][_0x90e8('0x6e')][_0x471e91]),'MailAccountId':Number(_0x2435fb[_0x90e8('0x58')]['id'])});}return _0x63a6d7;});}})['then'](respondWithResult(_0x596aa1,null))[_0x90e8('0x2c')](handleError(_0x596aa1,null));};exports[_0x90e8('0xbd')]=function(_0xab4052,_0x5ef54c,_0x40a3df){return db[_0x90e8('0x42')][_0x90e8('0x5d')]({'where':{'id':_0xab4052[_0x90e8('0x58')]['id']}})[_0x90e8('0x21')](handleEntityNotFound(_0x5ef54c,null))[_0x90e8('0x21')](function(_0x3c0ff4){if(_0x3c0ff4){return _0x3c0ff4[_0x90e8('0xbd')](_0xab4052['query']['ids'])[_0x90e8('0x21')](function(){if(_[_0x90e8('0xbe')](_0xab4052['query'][_0x90e8('0x6e')])){for(var _0x3b769a=0x0;_0x3b769a<_0xab4052[_0x90e8('0x45')][_0x90e8('0x6e')][_0x90e8('0x4c')];_0x3b769a+=0x1){socket['emit'](_0x90e8('0xbf'),{'UserId':Number(_0xab4052[_0x90e8('0x45')][_0x90e8('0x6e')][_0x3b769a]),'MailAccountId':Number(_0xab4052[_0x90e8('0x58')]['id'])});}}else{socket['emit'](_0x90e8('0xbf'),{'UserId':Number(_0xab4052[_0x90e8('0x45')][_0x90e8('0x6e')]),'MailAccountId':Number(_0xab4052[_0x90e8('0x58')]['id'])});}});}})[_0x90e8('0x21')](respondWithStatusCode(_0x5ef54c,null))['catch'](handleError(_0x5ef54c,null));};exports['getAgents']=function(_0x756865,_0x583c44,_0x4011da){var _0x5945e5={};var _0x37f4bd={};var _0x247e1c;var _0xc2b889;return db[_0x90e8('0x42')]['findOne']({'where':{'id':_0x756865['params']['id']}})['then'](handleEntityNotFound(_0x583c44,null))['then'](function(_0x394081){if(_0x394081){_0x247e1c=_0x394081;_0x37f4bd[_0x90e8('0x48')]=_[_0x90e8('0x46')](db['User']['rawAttributes']);_0x37f4bd[_0x90e8('0x45')]=_[_0x90e8('0x46')](_0x756865[_0x90e8('0x45')]);_0x37f4bd[_0x90e8('0x47')]=_[_0x90e8('0x4a')](_0x37f4bd['model'],_0x37f4bd[_0x90e8('0x45')]);_0x5945e5[_0x90e8('0x49')]=_[_0x90e8('0x4a')](_0x37f4bd['model'],qs[_0x90e8('0x4b')](_0x756865[_0x90e8('0x45')][_0x90e8('0x4b')]));_0x5945e5[_0x90e8('0x49')]=_0x5945e5['attributes'][_0x90e8('0x4c')]?_0x5945e5['attributes']:_0x37f4bd[_0x90e8('0x48')];_0x5945e5['order']=qs[_0x90e8('0x4f')](_0x756865['query']['sort']);_0x5945e5['where']=qs[_0x90e8('0x47')](_[_0x90e8('0x51')](_0x756865[_0x90e8('0x45')],_0x37f4bd[_0x90e8('0x47')]));if(_0x756865['query'][_0x90e8('0x52')]){_0x5945e5[_0x90e8('0x50')]=_[_0x90e8('0x53')](_0x5945e5[_0x90e8('0x50')],{'$or':_[_0x90e8('0x41')](_0x5945e5[_0x90e8('0x49')],function(_0x25bdfb){var _0x4c763f={};_0x4c763f[_0x25bdfb]={'$like':'%'+_0x756865['query'][_0x90e8('0x52')]+'%'};return _0x4c763f;})});}_0x5945e5=_[_0x90e8('0x53')]({},_0x5945e5,_0x756865['options']);return _0x247e1c[_0x90e8('0xc0')](_0x5945e5);}})['then'](function(_0xc9be6a){if(_0xc9be6a){_0xc2b889=_0xc9be6a[_0x90e8('0x4c')];if(!_0x756865[_0x90e8('0x45')][_0x90e8('0x4d')](_0x90e8('0x68'))){_0x5945e5['limit']=qs[_0x90e8('0x33')](_0x756865[_0x90e8('0x45')]['limit']);_0x5945e5[_0x90e8('0x31')]=qs[_0x90e8('0x31')](_0x756865[_0x90e8('0x45')][_0x90e8('0x31')]);}return _0x247e1c[_0x90e8('0xc0')](_0x5945e5);}})[_0x90e8('0x21')](function(_0x49339d){if(_0x49339d){return _0x49339d?{'count':_0xc2b889,'rows':_0x49339d}:null;}})[_0x90e8('0x21')](respondWithResult(_0x583c44,null))[_0x90e8('0x2c')](handleError(_0x583c44,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9f4e315..2a7b55b 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 _0x3b61=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x3b61,0x67));var _0x13b6=function(_0x186232,_0x56e14e){_0x186232=_0x186232-0x0;var _0x403a4d=_0x3b61[_0x186232];return _0x403a4d;};'use strict';var EventEmitter=require(_0x13b6('0x0'));var MailAccount=require(_0x13b6('0x1'))['db'][_0x13b6('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x13b6('0x3')](0x0);var events={'afterCreate':_0x13b6('0x4'),'afterUpdate':_0x13b6('0x5'),'afterDestroy':_0x13b6('0x6')};function emitEvent(_0x23fe0c){return function(_0x4c95f1,_0x107f9f,_0x3f7e49){MailAccountEvents[_0x13b6('0x7')](_0x23fe0c+':'+_0x4c95f1['id'],_0x4c95f1);MailAccountEvents['emit'](_0x23fe0c,_0x4c95f1);_0x3f7e49(null);};}for(var e in events){if(events[_0x13b6('0x8')](e)){var event=events[e];MailAccount[_0x13b6('0x9')](e,emitEvent(event));}}module[_0x13b6('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x090a=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x2a79ef,_0x55e7eb){var _0x566dda=function(_0x55fd31){while(--_0x55fd31){_0x2a79ef['push'](_0x2a79ef['shift']());}};_0x566dda(++_0x55e7eb);}(_0x090a,0x133));var _0xa090=function(_0x17de8d,_0x1d2970){_0x17de8d=_0x17de8d-0x0;var _0x1db0d2=_0x090a[_0x17de8d];return _0x1db0d2;};'use strict';var EventEmitter=require(_0xa090('0x0'));var MailAccount=require(_0xa090('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa090('0x2')](0x0);var events={'afterCreate':_0xa090('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3f7ae2){return function(_0x5a0530,_0x364c3b,_0x191c3a){MailAccountEvents[_0xa090('0x4')](_0x3f7ae2+':'+_0x5a0530['id'],_0x5a0530);MailAccountEvents[_0xa090('0x4')](_0x3f7ae2,_0x5a0530);_0x191c3a(null);};}for(var e in events){if(events[_0xa090('0x5')](e)){var event=events[e];MailAccount[_0xa090('0x6')](e,emitEvent(event));}}module[_0xa090('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f070803..03bc8d3 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 _0x6e6e=['request-promise','path','../../config/environment','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x3e8b17,_0x4159ca){var _0x46e83e=function(_0x21dcf7){while(--_0x21dcf7){_0x3e8b17['push'](_0x3e8b17['shift']());}};_0x46e83e(++_0x4159ca);}(_0x6e6e,0x87));var _0xe6e6=function(_0x7eba4c,_0xa58272){_0x7eba4c=_0x7eba4c-0x0;var _0x245424=_0x6e6e[_0x7eba4c];return _0x245424;};'use strict';var _=require(_0xe6e6('0x0'));var util=require(_0xe6e6('0x1'));var logger=require(_0xe6e6('0x2'))(_0xe6e6('0x3'));var moment=require('moment');var BPromise=require(_0xe6e6('0x4'));var rp=require(_0xe6e6('0x5'));var fs=require('fs');var path=require(_0xe6e6('0x6'));var rimraf=require('rimraf');var config=require(_0xe6e6('0x7'));var attributes=require('./mailAccount.attributes');module[_0xe6e6('0x8')]=function(_0x37dded,_0x211261){return _0x37dded[_0xe6e6('0x9')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc42d=['MailAccount','mail_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x2bc5f6,_0x27169f){var _0x312d1c=function(_0x1e49b2){while(--_0x1e49b2){_0x2bc5f6['push'](_0x2bc5f6['shift']());}};_0x312d1c(++_0x27169f);}(_0xc42d,0x1af));var _0xdc42=function(_0x875d56,_0x32f7ff){_0x875d56=_0x875d56-0x0;var _0x109b7b=_0xc42d[_0x875d56];return _0x109b7b;};'use strict';var _=require(_0xdc42('0x0'));var util=require('util');var logger=require(_0xdc42('0x1'))(_0xdc42('0x2'));var moment=require(_0xdc42('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc42('0x4'));var fs=require('fs');var path=require(_0xdc42('0x5'));var rimraf=require(_0xdc42('0x6'));var config=require(_0xdc42('0x7'));var attributes=require(_0xdc42('0x8'));module[_0xdc42('0x9')]=function(_0x3da162,_0x29e6e1){return _0x3da162[_0xdc42('0xa')](_0xdc42('0xb'),attributes,{'tableName':_0xdc42('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index d1a8274..007ff20 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 _0xd92e=['result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','Smtp','get','applications','list','orderBy','priority','asc','push','length','close','*,*,*,*','Contacts','defaults','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x37851e,_0x13765c){var _0x5af6be=function(_0x2777a2){while(--_0x2777a2){_0x37851e['push'](_0x37851e['shift']());}};_0x5af6be(++_0x13765c);}(_0xd92e,0xc1));var _0xed92=function(_0x102492,_0x597176){_0x102492=_0x102492-0x0;var _0x2212cd=_0xd92e[_0x102492];return _0x2212cd;};'use strict';var _=require(_0xed92('0x0'));var util=require(_0xed92('0x1'));var moment=require(_0xed92('0x2'));var BPromise=require(_0xed92('0x3'));var rs=require(_0xed92('0x4'));var fs=require('fs');var Redis=require(_0xed92('0x5'));var db=require(_0xed92('0x6'))['db'];var utils=require(_0xed92('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xed92('0x8'));var jayson=require(_0xed92('0x9'));var client=jayson[_0xed92('0xa')][_0xed92('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0xed92('0xc')],{'host':_0xed92('0xd'),'port':0x18eb});var socket=require(_0xed92('0xe'))(new Redis(config[_0xed92('0xc')]));require(_0xed92('0xf'))['register'](socket);function respondWithRpcPromise(_0x121870,_0x22cf33,_0x4d9922){return new BPromise(function(_0x27d8c7,_0x31d20){return client[_0xed92('0x10')](_0x121870,_0x4d9922)[_0xed92('0x11')](function(_0x3d04d1){logger[_0xed92('0x12')](_0xed92('0x13'),_0x22cf33,_0xed92('0x14'));logger[_0xed92('0x15')](_0xed92('0x16'),_0x22cf33,_0xed92('0x14'),JSON[_0xed92('0x17')](_0x3d04d1));if(_0x3d04d1['error']){if(_0x3d04d1[_0xed92('0x18')][_0xed92('0x19')]===0x1f4){logger[_0xed92('0x18')]('MailAccount,\x20%s,\x20%s',_0x22cf33,_0x3d04d1[_0xed92('0x18')]['message']);return _0x31d20(_0x3d04d1[_0xed92('0x18')][_0xed92('0x1a')]);}logger[_0xed92('0x18')](_0xed92('0x13'),_0x22cf33,_0x3d04d1[_0xed92('0x18')][_0xed92('0x1a')]);return _0x27d8c7(_0x3d04d1['error']['message']);}else{logger[_0xed92('0x12')]('MailAccount,\x20%s,\x20%s',_0x22cf33,_0xed92('0x14'));_0x27d8c7(_0x3d04d1[_0xed92('0x1b')][_0xed92('0x1a')]);}})[_0xed92('0x1c')](function(_0xbd5df7){logger[_0xed92('0x18')](_0xed92('0x13'),_0x22cf33,_0xbd5df7);_0x31d20(_0xbd5df7);});});}exports[_0xed92('0x1d')]=function(_0x336262){var _0x486876=this;return new Promise(function(_0x3e7337,_0x3663e0){return db[_0xed92('0x1e')]['findAll']({'raw':_0x336262[_0xed92('0x1f')]?_0x336262[_0xed92('0x1f')][_0xed92('0x20')]===undefined?!![]:![]:!![],'where':_0x336262[_0xed92('0x1f')]?_0x336262[_0xed92('0x1f')][_0xed92('0x21')]||null:null,'attributes':_0x336262[_0xed92('0x1f')]?_0x336262[_0xed92('0x1f')][_0xed92('0x22')]||null:null,'limit':_0x336262[_0xed92('0x1f')]?_0x336262['options'][_0xed92('0x23')]||null:null,'include':_0x336262[_0xed92('0x1f')]?_0x336262[_0xed92('0x1f')][_0xed92('0x24')]?_[_0xed92('0x25')](_0x336262[_0xed92('0x1f')][_0xed92('0x24')],function(_0x2ed5f2){return{'model':db[_0x2ed5f2[_0xed92('0x26')]],'as':_0x2ed5f2['as'],'attributes':_0x2ed5f2[_0xed92('0x22')],'include':_0x2ed5f2[_0xed92('0x24')]?_[_0xed92('0x25')](_0x2ed5f2[_0xed92('0x24')],function(_0xab4be1){return{'model':db[_0xab4be1['model']],'as':_0xab4be1['as'],'attributes':_0xab4be1['attributes'],'include':_0xab4be1[_0xed92('0x24')]?_['map'](_0xab4be1[_0xed92('0x24')],function(_0x43567b){return{'model':db[_0x43567b['model']],'as':_0x43567b['as'],'attributes':_0x43567b[_0xed92('0x22')]};}):[]};}):[]};}):[]:[]})[_0xed92('0x11')](function(_0x12f0df){logger[_0xed92('0x12')](_0xed92('0x1d'),_0x336262);logger[_0xed92('0x15')]('GetMailAccount',_0x336262,JSON[_0xed92('0x17')](_0x12f0df));_0x3e7337(_0x12f0df);})[_0xed92('0x1c')](function(_0x204bf6){logger[_0xed92('0x18')](_0xed92('0x1d'),_0x204bf6[_0xed92('0x1a')],_0x336262);_0x3663e0(_0x486876[_0xed92('0x18')](0x1f4,_0x204bf6[_0xed92('0x1a')]));});});};exports[_0xed92('0x27')]=function(_0x226a5e){var _0x5831f2=this;return new Promise(function(_0xdcdadc,_0x55582d){return db[_0xed92('0x1e')][_0xed92('0x28')]({'raw':_0x226a5e['options']?_0x226a5e[_0xed92('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x226a5e[_0xed92('0x1f')]?_0x226a5e[_0xed92('0x1f')][_0xed92('0x21')]||null:null,'attributes':_0x226a5e[_0xed92('0x1f')]?_0x226a5e[_0xed92('0x1f')][_0xed92('0x22')]||null:null,'include':_0x226a5e[_0xed92('0x1f')]?_0x226a5e[_0xed92('0x1f')][_0xed92('0x24')]?_[_0xed92('0x25')](_0x226a5e[_0xed92('0x1f')][_0xed92('0x24')],function(_0xd82cdd){return{'model':db[_0xd82cdd[_0xed92('0x26')]],'as':_0xd82cdd['as'],'attributes':_0xd82cdd[_0xed92('0x22')],'include':_0xd82cdd['include']?_[_0xed92('0x25')](_0xd82cdd['include'],function(_0x1c5cf7){return{'model':db[_0x1c5cf7[_0xed92('0x26')]],'as':_0x1c5cf7['as'],'attributes':_0x1c5cf7[_0xed92('0x22')],'include':_0x1c5cf7['include']?_[_0xed92('0x25')](_0x1c5cf7[_0xed92('0x24')],function(_0x134fb4){return{'model':db[_0x134fb4[_0xed92('0x26')]],'as':_0x134fb4['as'],'attributes':_0x134fb4[_0xed92('0x22')]};}):[]};}):[]};}):[]:[]})[_0xed92('0x11')](function(_0x246238){logger[_0xed92('0x12')]('ShowMailAccount',_0x226a5e);logger[_0xed92('0x15')](_0xed92('0x27'),_0x226a5e,JSON[_0xed92('0x17')](_0x246238));_0xdcdadc(_0x246238);})['catch'](function(_0x3acecd){logger['error'](_0xed92('0x27'),_0x3acecd['message'],_0x226a5e);_0x55582d(_0x5831f2['error'](0x1f4,_0x3acecd[_0xed92('0x1a')]));});});};exports[_0xed92('0x29')]=function(_0x4b7208){var _0x2bc702=this;return new Promise(function(_0x354017,_0x4d482c){var _0x35f5eb={'body':_0x4b7208[_0xed92('0x2a')],'channel':_0xed92('0x2b')};var _0x44400b=_[_0xed92('0x2c')](_[_0xed92('0x2d')](db[_0xed92('0x2e')]['rawAttributes']),[_0xed92('0x2f'),_0xed92('0x30'),_0xed92('0x31'),_0xed92('0x32')]);var _0x30fc4f=![];if(_0x4b7208[_0xed92('0x2a')]['id']){delete _0x4b7208[_0xed92('0x2a')]['id'];}if(_[_0xed92('0x33')](_0x4b7208[_0xed92('0x2a')][_0xed92('0x34')])){return _0x4d482c(_0x2bc702[_0xed92('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xed92('0x33')](_0x4b7208[_0xed92('0x2a')][_0xed92('0x2a')])||_0x4b7208['body']['body']===''){return _0x4d482c(_0x2bc702['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xed92('0x33')](_0x4b7208['body'][_0xed92('0x35')])){return _0x4d482c(_0x2bc702[_0xed92('0x18')](0x1f4,_0xed92('0x36')+_0x44400b));}if(!_[_0xed92('0x37')](_0x44400b,_0x4b7208[_0xed92('0x2a')][_0xed92('0x35')])){return _0x4d482c(_0x2bc702['error'](0x1f4,_0xed92('0x38')+_0x44400b));}var _0x2e8303={};_0x2e8303[_0x4b7208['body'][_0xed92('0x35')]]=_0x4b7208['body'][_0xed92('0x34')];return db[_0xed92('0x1e')][_0xed92('0x28')]({'where':{'id':_0x4b7208[_0xed92('0x39')]['id']},'include':[{'model':db[_0xed92('0x3a')],'as':_0xed92('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2e8303,'limit':0x1,'order':[['updatedAt',_0xed92('0x3c')]]}]},{'model':db[_0xed92('0x3d')],'as':_0xed92('0x3e')},{'model':db['MailServerOut'],'as':_0xed92('0x3f')}]})[_0xed92('0x11')](function(_0x9dcae8){if(_0x9dcae8&&_0x9dcae8[_0xed92('0x3b')]){var _0x31cc2c=_0x9dcae8[_0xed92('0x40')]({'plain':!![]});_0x35f5eb['account']=_['omit'](_0x31cc2c,[_0xed92('0x3e'),_0xed92('0x3b')]);_0x35f5eb[_0xed92('0x41')]=_0x31cc2c[_0xed92('0x3e')];_0x35f5eb[_0xed92('0x42')]=_0x31cc2c['List'];_0x35f5eb[_0xed92('0x41')]=_[_0xed92('0x43')](_0x35f5eb[_0xed92('0x41')],[_0xed92('0x44')],[_0xed92('0x45')]);if(_0x35f5eb[_0xed92('0x39')]&&_0x35f5eb[_0xed92('0x39')]['autoclose']){_0x35f5eb['applications'][_0xed92('0x46')]({'id':0x0,'priority':_0x35f5eb['applications'][_0xed92('0x47')]+0x1,'app':_0xed92('0x48'),'appdata':'autoclose','interval':_0xed92('0x49')});}if(_0x35f5eb[_0xed92('0x39')][_0xed92('0x3e')]){delete _0x35f5eb[_0xed92('0x39')][_0xed92('0x3e')];}if(_0x35f5eb[_0xed92('0x39')]['List']){delete _0x35f5eb[_0xed92('0x39')][_0xed92('0x3b')];}if(_0x31cc2c['List'][_0xed92('0x4a')][_0xed92('0x47')]){return _0x31cc2c[_0xed92('0x3b')]['Contacts'][0x0];}var _0x5950a8=_[_0xed92('0x4b')](_0x4b7208['body'],{'firstName':_0x4b7208[_0xed92('0x2a')][_0xed92('0x34')],'ListId':_0x31cc2c[_0xed92('0x32')]});_0x5950a8[_0x4b7208['body'][_0xed92('0x35')]]=_0x4b7208[_0xed92('0x2a')][_0xed92('0x34')];return db['CmContact']['create'](_0x5950a8);}else{throw new Error(_0xed92('0x4c'));}})['then'](function(_0x50db7a){_0x35f5eb[_0xed92('0x4d')]=_0x50db7a;if(_0x50db7a){if(!_0x4b7208['body'][_0xed92('0x1a')][_0xed92('0x4e')]){_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x4e')]=rs[_0xed92('0x4f')]()+'\x20'+_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x34')];}var _0x3ddda1={'ContactId':_0x50db7a['id'],'MailAccountId':_0x4b7208[_0xed92('0x39')]['id'],'inReplyTo':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x4e')],'to':_0x4b7208['body'][_0xed92('0x1a')][_0xed92('0x34')],'cc':_0x4b7208[_0xed92('0x2a')]['message']['cc'],'subject':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x50')],'attach':_0x4b7208['body'][_0xed92('0x1a')]['attach'],'lastMsgAt':moment()[_0xed92('0x51')](_0xed92('0x52')),'lastMsgDirection':'in'};return db[_0xed92('0x53')]['find']({'where':{'closed':![],'MailAccountId':_0x4b7208[_0xed92('0x39')]['id']},'include':[{'model':db[_0xed92('0x54')],'as':_0xed92('0x55'),'attributes':['messageId'],'where':{'messageId':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x56')]}}]})[_0xed92('0x11')](function(_0x1c2949){if(_0x1c2949){return[_0x1c2949,![]];}return db[_0xed92('0x53')][_0xed92('0x57')](_0x3ddda1)[_0xed92('0x11')](function(_0x2c1e9f){return[_0x2c1e9f,!![]];});});}else{throw new Error(_0xed92('0x58'));}})[_0xed92('0x59')](function(_0x177d07,_0x22218d){if(_0x177d07){_0x30fc4f=_0x22218d;if(!_0x22218d){return _0x177d07[_0xed92('0x5a')]({'inReplyTo':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x4e')],'to':_0x4b7208['body']['message']['from'],'cc':_0x4b7208[_0xed92('0x2a')]['message']['cc'],'subject':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')]['subject'],'attach':_0x177d07[_0xed92('0x5b')]?_0x177d07[_0xed92('0x5b')]:_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x5b')],'substatus':null,'substatusAt':moment()[_0xed92('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xed92('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x177d07;}}})['then'](function(_0xb2e072){_0x35f5eb[_0xed92('0x5c')]=_0xb2e072[_0xed92('0x40')]({'plain':!![]});_0x35f5eb[_0xed92('0x5c')][_0xed92('0x5d')]=_0x30fc4f;return db[_0xed92('0x54')]['create']({'body':_0x4b7208[_0xed92('0x2a')]['body'],'MailAccountId':_0x4b7208[_0xed92('0x39')]['id'],'MailInteractionId':_0xb2e072['id'],'direction':'in','ContactId':_0x35f5eb['contact']['id'],'messageId':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x4e')],'from':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x34')],'to':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')]['to'],'cc':_0x4b7208['body'][_0xed92('0x1a')]['cc'],'subject':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x50')],'attach':_0x4b7208[_0xed92('0x2a')]['message']['attach'],'Attachments':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x5e')],'originTo':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x5f')],'originCc':_0x4b7208[_0xed92('0x2a')]['message'][_0xed92('0x60')],'bcc':_0x4b7208[_0xed92('0x2a')]['message'][_0xed92('0x61')],'ChatWebsiteId':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x62')]||null,'originChannel':_0x4b7208['body'][_0xed92('0x1a')][_0xed92('0x63')]||_0xed92('0x64'),'ChatOfflineMessageId':_0x4b7208['body'][_0xed92('0x1a')][_0xed92('0x65')]||null},{'include':[{'model':db['Attachment'],'as':_0xed92('0x66')}]});})['then'](function(_0x42504c){_0x35f5eb[_0xed92('0x1a')]=_0x42504c;if(_0x35f5eb[_0xed92('0x5c')][_0xed92('0x67')]){return db['User'][_0xed92('0x28')]({'attributes':['id',_0xed92('0x68')],'where':{'id':_0x35f5eb[_0xed92('0x5c')][_0xed92('0x67')]}})[_0xed92('0x11')](function(_0x1c4e33){if(_0x1c4e33){_0x35f5eb[_0xed92('0x41')][_0xed92('0x69')]({'id':0x0,'priority':0x0,'app':_0xed92('0x6a'),'appdata':_0x1c4e33['name']+','+(_0x35f5eb['account'][_0xed92('0x6b')]||0xa),'interval':_0xed92('0x49')});}return respondWithRpcPromise('Start',_0xed92('0x6c'),_0x35f5eb);});}return respondWithRpcPromise(_0xed92('0x6d'),_0xed92('0x6c'),_0x35f5eb);})['then'](function(_0x556610){_0x354017(_0x556610);})[_0xed92('0x1c')](function(_0x2b3cd5){_0x4d482c(_0x2bc702[_0xed92('0x18')](0x1f4,_0x2b3cd5[_0xed92('0x1a')]));});});}; \ No newline at end of file +var _0x1f28=['Email','Attachment','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','request','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','MailAccount','options','raw','attributes','limit','include','map','model','GetMailAccount','stringify','ShowMailAccount','find','where','then','debug','NotifyMailAccount','body','difference','CmContact','rawAttributes','createdAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','from','List','updatedAt','DESC','Applications','MailServerOut','Smtp','get','applications','list','orderBy','priority','account','autoclose','length','close','*,*,*,*','Contacts','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','MailMessage','attachments','originTo','originCc','bcc','originChannel'];(function(_0x2866b1,_0x2025e7){var _0x47be9e=function(_0x4eaa3c){while(--_0x4eaa3c){_0x2866b1['push'](_0x2866b1['shift']());}};_0x47be9e(++_0x2025e7);}(_0x1f28,0x195));var _0x81f2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1f28[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x81f2('0x0'));var moment=require(_0x81f2('0x1'));var BPromise=require(_0x81f2('0x2'));var rs=require(_0x81f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x81f2('0x5'))(_0x81f2('0x6'));var config=require(_0x81f2('0x7'));var jayson=require(_0x81f2('0x8'));var client=jayson[_0x81f2('0x9')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x81f2('0xa')],{'host':_0x81f2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x81f2('0xa')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1e44b6,_0x4d4d6c,_0x299fc0){return new BPromise(function(_0x2fb16f,_0x1298af){return client[_0x81f2('0xc')](_0x1e44b6,_0x299fc0)['then'](function(_0x8148dc){logger['info'](_0x81f2('0xd'),_0x4d4d6c,_0x81f2('0xe'));logger['debug'](_0x81f2('0xf'),_0x4d4d6c,_0x81f2('0xe'),JSON['stringify'](_0x8148dc));if(_0x8148dc[_0x81f2('0x10')]){if(_0x8148dc[_0x81f2('0x10')][_0x81f2('0x11')]===0x1f4){logger[_0x81f2('0x10')](_0x81f2('0xd'),_0x4d4d6c,_0x8148dc[_0x81f2('0x10')][_0x81f2('0x12')]);return _0x1298af(_0x8148dc[_0x81f2('0x10')]['message']);}logger[_0x81f2('0x10')]('MailAccount,\x20%s,\x20%s',_0x4d4d6c,_0x8148dc[_0x81f2('0x10')][_0x81f2('0x12')]);return _0x2fb16f(_0x8148dc[_0x81f2('0x10')][_0x81f2('0x12')]);}else{logger[_0x81f2('0x13')]('MailAccount,\x20%s,\x20%s',_0x4d4d6c,_0x81f2('0xe'));_0x2fb16f(_0x8148dc[_0x81f2('0x14')][_0x81f2('0x12')]);}})[_0x81f2('0x15')](function(_0x2527a4){logger['error'](_0x81f2('0xd'),_0x4d4d6c,_0x2527a4);_0x1298af(_0x2527a4);});});}exports['GetMailAccount']=function(_0x28fe32){var _0x140130=this;return new Promise(function(_0x5e8d99,_0x1e0fe5){return db[_0x81f2('0x16')]['findAll']({'raw':_0x28fe32[_0x81f2('0x17')]?_0x28fe32['options'][_0x81f2('0x18')]===undefined?!![]:![]:!![],'where':_0x28fe32['options']?_0x28fe32[_0x81f2('0x17')]['where']||null:null,'attributes':_0x28fe32[_0x81f2('0x17')]?_0x28fe32[_0x81f2('0x17')][_0x81f2('0x19')]||null:null,'limit':_0x28fe32[_0x81f2('0x17')]?_0x28fe32[_0x81f2('0x17')][_0x81f2('0x1a')]||null:null,'include':_0x28fe32[_0x81f2('0x17')]?_0x28fe32[_0x81f2('0x17')][_0x81f2('0x1b')]?_[_0x81f2('0x1c')](_0x28fe32[_0x81f2('0x17')][_0x81f2('0x1b')],function(_0x1db21d){return{'model':db[_0x1db21d[_0x81f2('0x1d')]],'as':_0x1db21d['as'],'attributes':_0x1db21d[_0x81f2('0x19')],'include':_0x1db21d[_0x81f2('0x1b')]?_['map'](_0x1db21d[_0x81f2('0x1b')],function(_0x6e6b2c){return{'model':db[_0x6e6b2c[_0x81f2('0x1d')]],'as':_0x6e6b2c['as'],'attributes':_0x6e6b2c[_0x81f2('0x19')],'include':_0x6e6b2c[_0x81f2('0x1b')]?_[_0x81f2('0x1c')](_0x6e6b2c['include'],function(_0x1b2e6a){return{'model':db[_0x1b2e6a[_0x81f2('0x1d')]],'as':_0x1b2e6a['as'],'attributes':_0x1b2e6a[_0x81f2('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4652f9){logger[_0x81f2('0x13')](_0x81f2('0x1e'),_0x28fe32);logger['debug'](_0x81f2('0x1e'),_0x28fe32,JSON[_0x81f2('0x1f')](_0x4652f9));_0x5e8d99(_0x4652f9);})[_0x81f2('0x15')](function(_0x4851b3){logger[_0x81f2('0x10')](_0x81f2('0x1e'),_0x4851b3[_0x81f2('0x12')],_0x28fe32);_0x1e0fe5(_0x140130[_0x81f2('0x10')](0x1f4,_0x4851b3['message']));});});};exports[_0x81f2('0x20')]=function(_0x43c7e7){var _0x2d5ef0=this;return new Promise(function(_0x364c3d,_0x5b266c){return db[_0x81f2('0x16')][_0x81f2('0x21')]({'raw':_0x43c7e7[_0x81f2('0x17')]?_0x43c7e7[_0x81f2('0x17')][_0x81f2('0x18')]===undefined?!![]:![]:!![],'where':_0x43c7e7[_0x81f2('0x17')]?_0x43c7e7[_0x81f2('0x17')][_0x81f2('0x22')]||null:null,'attributes':_0x43c7e7[_0x81f2('0x17')]?_0x43c7e7[_0x81f2('0x17')][_0x81f2('0x19')]||null:null,'include':_0x43c7e7[_0x81f2('0x17')]?_0x43c7e7['options'][_0x81f2('0x1b')]?_[_0x81f2('0x1c')](_0x43c7e7['options'][_0x81f2('0x1b')],function(_0x377b2c){return{'model':db[_0x377b2c['model']],'as':_0x377b2c['as'],'attributes':_0x377b2c['attributes'],'include':_0x377b2c[_0x81f2('0x1b')]?_[_0x81f2('0x1c')](_0x377b2c[_0x81f2('0x1b')],function(_0x2e4cf9){return{'model':db[_0x2e4cf9[_0x81f2('0x1d')]],'as':_0x2e4cf9['as'],'attributes':_0x2e4cf9[_0x81f2('0x19')],'include':_0x2e4cf9['include']?_[_0x81f2('0x1c')](_0x2e4cf9[_0x81f2('0x1b')],function(_0x1fe1d4){return{'model':db[_0x1fe1d4[_0x81f2('0x1d')]],'as':_0x1fe1d4['as'],'attributes':_0x1fe1d4[_0x81f2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x81f2('0x23')](function(_0x18920c){logger[_0x81f2('0x13')](_0x81f2('0x20'),_0x43c7e7);logger[_0x81f2('0x24')](_0x81f2('0x20'),_0x43c7e7,JSON['stringify'](_0x18920c));_0x364c3d(_0x18920c);})['catch'](function(_0x4a2c8e){logger[_0x81f2('0x10')](_0x81f2('0x20'),_0x4a2c8e['message'],_0x43c7e7);_0x5b266c(_0x2d5ef0['error'](0x1f4,_0x4a2c8e['message']));});});};exports[_0x81f2('0x25')]=function(_0x341477){var _0x14f56c=this;return new Promise(function(_0x23e062,_0x297a4f){var _0x121b1a={'body':_0x341477[_0x81f2('0x26')],'channel':'mail'};var _0x1c01d2=_[_0x81f2('0x27')](_['keys'](db[_0x81f2('0x28')][_0x81f2('0x29')]),[_0x81f2('0x2a'),'updatedAt',_0x81f2('0x2b'),'ListId']);var _0x9251a2=![];if(_0x341477[_0x81f2('0x26')]['id']){delete _0x341477['body']['id'];}if(_[_0x81f2('0x2c')](_0x341477[_0x81f2('0x26')]['from'])){return _0x297a4f(_0x14f56c['error'](0x1f4,_0x81f2('0x2d')));}if(_[_0x81f2('0x2c')](_0x341477[_0x81f2('0x26')][_0x81f2('0x26')])||_0x341477[_0x81f2('0x26')][_0x81f2('0x26')]===''){return _0x297a4f(_0x14f56c[_0x81f2('0x10')](0x1f4,_0x81f2('0x2e')));}if(_[_0x81f2('0x2c')](_0x341477[_0x81f2('0x26')]['mapKey'])){return _0x297a4f(_0x14f56c[_0x81f2('0x10')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c01d2));}if(!_[_0x81f2('0x2f')](_0x1c01d2,_0x341477[_0x81f2('0x26')][_0x81f2('0x30')])){return _0x297a4f(_0x14f56c[_0x81f2('0x10')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c01d2));}var _0x1047af={};_0x1047af[_0x341477[_0x81f2('0x26')][_0x81f2('0x30')]]=_0x341477[_0x81f2('0x26')][_0x81f2('0x31')];return db[_0x81f2('0x16')][_0x81f2('0x21')]({'where':{'id':_0x341477['account']['id']},'include':[{'model':db['CmList'],'as':_0x81f2('0x32'),'include':[{'model':db[_0x81f2('0x28')],'as':'Contacts','where':_0x1047af,'limit':0x1,'order':[[_0x81f2('0x33'),_0x81f2('0x34')]]}]},{'model':db['MailApplication'],'as':_0x81f2('0x35')},{'model':db[_0x81f2('0x36')],'as':_0x81f2('0x37')}]})[_0x81f2('0x23')](function(_0x2bd406){if(_0x2bd406&&_0x2bd406[_0x81f2('0x32')]){var _0x5ce80a=_0x2bd406[_0x81f2('0x38')]({'plain':!![]});_0x121b1a['account']=_['omit'](_0x5ce80a,[_0x81f2('0x35'),'List']);_0x121b1a[_0x81f2('0x39')]=_0x5ce80a[_0x81f2('0x35')];_0x121b1a[_0x81f2('0x3a')]=_0x5ce80a['List'];_0x121b1a['applications']=_[_0x81f2('0x3b')](_0x121b1a['applications'],[_0x81f2('0x3c')],['asc']);if(_0x121b1a['account']&&_0x121b1a[_0x81f2('0x3d')][_0x81f2('0x3e')]){_0x121b1a['applications']['push']({'id':0x0,'priority':_0x121b1a['applications'][_0x81f2('0x3f')]+0x1,'app':_0x81f2('0x40'),'appdata':_0x81f2('0x3e'),'interval':_0x81f2('0x41')});}if(_0x121b1a[_0x81f2('0x3d')][_0x81f2('0x35')]){delete _0x121b1a[_0x81f2('0x3d')]['Applications'];}if(_0x121b1a[_0x81f2('0x3d')][_0x81f2('0x32')]){delete _0x121b1a[_0x81f2('0x3d')][_0x81f2('0x32')];}if(_0x5ce80a['List'][_0x81f2('0x42')][_0x81f2('0x3f')]){return _0x5ce80a[_0x81f2('0x32')]['Contacts'][0x0];}var _0x5d756a=_['defaults'](_0x341477['body'],{'firstName':_0x341477[_0x81f2('0x26')]['from'],'ListId':_0x5ce80a[_0x81f2('0x43')]});_0x5d756a[_0x341477['body'][_0x81f2('0x30')]]=_0x341477['body']['from'];return db[_0x81f2('0x28')][_0x81f2('0x44')](_0x5d756a);}else{throw new Error(_0x81f2('0x45'));}})[_0x81f2('0x23')](function(_0x1c5dae){_0x121b1a[_0x81f2('0x46')]=_0x1c5dae;if(_0x1c5dae){if(!_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x47')]){_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x47')]=rs[_0x81f2('0x48')]()+'\x20'+_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x31')];}var _0x199aa6={'ContactId':_0x1c5dae['id'],'MailAccountId':_0x341477[_0x81f2('0x3d')]['id'],'inReplyTo':_0x341477[_0x81f2('0x26')]['message']['messageId'],'to':_0x341477[_0x81f2('0x26')]['message'][_0x81f2('0x31')],'cc':_0x341477['body'][_0x81f2('0x12')]['cc'],'subject':_0x341477[_0x81f2('0x26')]['message'][_0x81f2('0x49')],'attach':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x4a')],'lastMsgAt':moment()[_0x81f2('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x81f2('0x4c')][_0x81f2('0x21')]({'where':{'closed':![],'MailAccountId':_0x341477[_0x81f2('0x3d')]['id']},'include':[{'model':db['MailMessage'],'as':_0x81f2('0x4d'),'attributes':[_0x81f2('0x47')],'where':{'messageId':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x4e')]}}]})[_0x81f2('0x23')](function(_0x1d6dc1){if(_0x1d6dc1){return[_0x1d6dc1,![]];}return db[_0x81f2('0x4c')]['create'](_0x199aa6)['then'](function(_0x552924){return[_0x552924,!![]];});});}else{throw new Error(_0x81f2('0x4f'));}})[_0x81f2('0x50')](function(_0x5be7eb,_0x4a0cc5){if(_0x5be7eb){_0x9251a2=_0x4a0cc5;if(!_0x4a0cc5){return _0x5be7eb[_0x81f2('0x51')]({'inReplyTo':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x47')],'to':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')]['from'],'cc':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')]['cc'],'subject':_0x341477['body'][_0x81f2('0x12')][_0x81f2('0x49')],'attach':_0x5be7eb[_0x81f2('0x4a')]?_0x5be7eb[_0x81f2('0x4a')]:_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x4a')],'substatus':null,'substatusAt':moment()[_0x81f2('0x4b')](_0x81f2('0x52')),'lastMsgAt':moment()['format'](_0x81f2('0x52')),'lastMsgDirection':'in'});}else{return _0x5be7eb;}}})[_0x81f2('0x23')](function(_0x2b4250){_0x121b1a[_0x81f2('0x53')]=_0x2b4250[_0x81f2('0x38')]({'plain':!![]});_0x121b1a['interaction']['created']=_0x9251a2;return db[_0x81f2('0x54')][_0x81f2('0x44')]({'body':_0x341477[_0x81f2('0x26')]['body'],'MailAccountId':_0x341477[_0x81f2('0x3d')]['id'],'MailInteractionId':_0x2b4250['id'],'direction':'in','ContactId':_0x121b1a['contact']['id'],'messageId':_0x341477['body'][_0x81f2('0x12')][_0x81f2('0x47')],'from':_0x341477['body']['message'][_0x81f2('0x31')],'to':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')]['to'],'cc':_0x341477['body'][_0x81f2('0x12')]['cc'],'subject':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')]['subject'],'attach':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x4a')],'Attachments':_0x341477['body'][_0x81f2('0x12')][_0x81f2('0x55')],'originTo':_0x341477[_0x81f2('0x26')]['message'][_0x81f2('0x56')],'originCc':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x57')],'bcc':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x58')],'ChatWebsiteId':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')]['ChatWebsiteId']||null,'originChannel':_0x341477[_0x81f2('0x26')][_0x81f2('0x12')][_0x81f2('0x59')]||_0x81f2('0x5a'),'ChatOfflineMessageId':_0x341477[_0x81f2('0x26')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x81f2('0x5b')],'as':'Attachments'}]});})[_0x81f2('0x23')](function(_0x50906c){_0x121b1a[_0x81f2('0x12')]=_0x50906c;if(_0x121b1a[_0x81f2('0x53')]['UserId']){return db['User'][_0x81f2('0x21')]({'attributes':['id','name'],'where':{'id':_0x121b1a[_0x81f2('0x53')][_0x81f2('0x5c')]}})['then'](function(_0x39ac9b){if(_0x39ac9b){_0x121b1a[_0x81f2('0x39')][_0x81f2('0x5d')]({'id':0x0,'priority':0x0,'app':_0x81f2('0x5e'),'appdata':_0x39ac9b[_0x81f2('0x5f')]+','+(_0x121b1a[_0x81f2('0x3d')][_0x81f2('0x60')]||0xa),'interval':_0x81f2('0x41')});}return respondWithRpcPromise(_0x81f2('0x61'),_0x81f2('0x62'),_0x121b1a);});}return respondWithRpcPromise(_0x81f2('0x61'),_0x81f2('0x62'),_0x121b1a);})[_0x81f2('0x23')](function(_0x3ff794){_0x23e062(_0x3ff794);})['catch'](function(_0x5cbe66){_0x297a4f(_0x14f56c[_0x81f2('0x10')](0x1f4,_0x5cbe66[_0x81f2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 2f490fe..49d694c 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 _0x37c8=['./mailAccount.events','save','remove','emit','removeListener','length','mailAccount:'];(function(_0x48f735,_0x509dd4){var _0x5da176=function(_0x4fa701){while(--_0x4fa701){_0x48f735['push'](_0x48f735['shift']());}};_0x5da176(++_0x509dd4);}(_0x37c8,0x69));var _0x837c=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x37c8[_0x54b062];return _0x255e41;};'use strict';var MailAccountEvents=require(_0x837c('0x0'));var events=[_0x837c('0x1'),_0x837c('0x2'),'update'];function createListener(_0x4111bc,_0x408132){return function(_0x2394b4){_0x408132[_0x837c('0x3')](_0x4111bc,_0x2394b4);};}function removeListener(_0x2a0a37,_0x496179){return function(){MailAccountEvents[_0x837c('0x4')](_0x2a0a37,_0x496179);};}exports['register']=function(_0x2a94db){for(var _0x686873=0x0,_0x6562bf=events[_0x837c('0x5')];_0x686873<_0x6562bf;_0x686873++){var _0x2571c6=events[_0x686873];var _0x17bebf=createListener(_0x837c('0x6')+_0x2571c6,_0x2a94db);MailAccountEvents['on'](_0x2571c6,_0x17bebf);}}; \ No newline at end of file +var _0x6bea=['mailAccount:','save','remove','update','emit','register'];(function(_0x111337,_0x3391cc){var _0x2d4265=function(_0x22ab2a){while(--_0x22ab2a){_0x111337['push'](_0x111337['shift']());}};_0x2d4265(++_0x3391cc);}(_0x6bea,0x85));var _0xa6be=function(_0x2f6026,_0x5c4fea){_0x2f6026=_0x2f6026-0x0;var _0x3bde8d=_0x6bea[_0x2f6026];return _0x3bde8d;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xa6be('0x0'),_0xa6be('0x1'),_0xa6be('0x2')];function createListener(_0x2c7610,_0x18c405){return function(_0x225a65){_0x18c405[_0xa6be('0x3')](_0x2c7610,_0x225a65);};}function removeListener(_0x3e0cea,_0x10f43c){return function(){MailAccountEvents['removeListener'](_0x3e0cea,_0x10f43c);};}exports[_0xa6be('0x4')]=function(_0x3751be){for(var _0x448e5b=0x0,_0x4ac1c4=events['length'];_0x448e5b<_0x4ac1c4;_0x448e5b++){var _0x4eea11=events[_0x448e5b];var _0x508a4b=createListener(_0xa6be('0x5')+_0x4eea11,_0x3751be);MailAccountEvents['on'](_0x4eea11,_0x508a4b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 055acf5..6382011 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 _0x06dd=['./mailApplication.controller','isAuthenticated','show','put','/:id','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x50b050,_0x5ded51){var _0x150e0d=function(_0x296188){while(--_0x296188){_0x50b050['push'](_0x50b050['shift']());}};_0x150e0d(++_0x5ded51);}(_0x06dd,0x77));var _0xd06d=function(_0x4cfc0f,_0xe1ba14){_0x4cfc0f=_0x4cfc0f-0x0;var _0x1d2916=_0x06dd[_0x4cfc0f];return _0x1d2916;};'use strict';var multer=require(_0xd06d('0x0'));var util=require('util');var path=require(_0xd06d('0x1'));var timeout=require(_0xd06d('0x2'));var express=require(_0xd06d('0x3'));var router=express[_0xd06d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd06d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd06d('0x6'));var controller=require(_0xd06d('0x7'));router['get']('/:id',auth[_0xd06d('0x8')](),controller[_0xd06d('0x9')]);router[_0xd06d('0xa')](_0xd06d('0xb'),auth[_0xd06d('0x8')](),controller['update']);router[_0xd06d('0xc')]('/:id',auth[_0xd06d('0x8')](),controller[_0xd06d('0xd')]);module['exports']=router; \ No newline at end of file +var _0x0d36=['show','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x598b0d,_0x19e548){var _0x4d3c41=function(_0x3d8fbc){while(--_0x3d8fbc){_0x598b0d['push'](_0x598b0d['shift']());}};_0x4d3c41(++_0x19e548);}(_0x0d36,0xd7));var _0x60d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d36[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x60d3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x60d3('0x1'));var express=require(_0x60d3('0x2'));var router=express[_0x60d3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x60d3('0x4'));var interaction=require(_0x60d3('0x5'));var config=require(_0x60d3('0x6'));var controller=require('./mailApplication.controller');router[_0x60d3('0x7')](_0x60d3('0x8'),auth[_0x60d3('0x9')](),controller[_0x60d3('0xa')]);router[_0x60d3('0xb')]('/:id',auth[_0x60d3('0x9')](),controller[_0x60d3('0xc')]);router[_0x60d3('0xd')](_0x60d3('0x8'),auth[_0x60d3('0x9')](),controller['destroy']);module[_0x60d3('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 3dedcd9..46a7c35 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 _0xa90e=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x361162,_0x348e7a){var _0x58f3b0=function(_0x49de6c){while(--_0x49de6c){_0x361162['push'](_0x361162['shift']());}};_0x58f3b0(++_0x348e7a);}(_0xa90e,0xc5));var _0xea90=function(_0x5c489b,_0x4871b9){_0x5c489b=_0x5c489b-0x0;var _0x53a9c9=_0xa90e[_0x5c489b];return _0x53a9c9;};'use strict';var Sequelize=require(_0xea90('0x0'));module['exports']={'priority':{'type':Sequelize[_0xea90('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xea90('0x2')],'allowNull':![],'defaultValue':_0xea90('0x3')},'appdata':{'type':Sequelize[_0xea90('0x4')]()},'description':{'type':Sequelize[_0xea90('0x2')]},'interval':{'type':Sequelize[_0xea90('0x2')],'defaultValue':_0xea90('0x5')}}; \ No newline at end of file +var _0x0f23=['TEXT','STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x3b8e58,_0x551528){var _0x451242=function(_0x4cb6db){while(--_0x4cb6db){_0x3b8e58['push'](_0x3b8e58['shift']());}};_0x451242(++_0x551528);}(_0x0f23,0x1bf));var _0x30f2=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x0f23[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require('sequelize');module[_0x30f2('0x0')]={'priority':{'type':Sequelize[_0x30f2('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x30f2('0x2')},'appdata':{'type':Sequelize[_0x30f2('0x3')]()},'description':{'type':Sequelize[_0x30f2('0x4')]},'interval':{'type':Sequelize[_0x30f2('0x4')],'defaultValue':_0x30f2('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 393e38e..a2de861 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 _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x283d2f,_0x201c63){var _0x193cd2=function(_0x158f61){while(--_0x158f61){_0x283d2f['push'](_0x283d2f['shift']());}};_0x193cd2(++_0x201c63);}(_0xda3f,0xec));var _0xfda3=function(_0x1b2e83,_0x1ccd55){_0x1b2e83=_0x1b2e83-0x0;var _0x569498=_0xda3f[_0x1b2e83];return _0x569498;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +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(_0x3d4860,_0x283ab0){var _0x443fe0=function(_0x2af6da){while(--_0x2af6da){_0x3d4860['push'](_0x3d4860['shift']());}};_0x443fe0(++_0x283ab0);}(_0xac4a,0x13f));var _0xaac4=function(_0x3bec2a,_0x332228){_0x3bec2a=_0x3bec2a-0x0;var _0x372bb2=_0xac4a[_0x3bec2a];return _0x372bb2;};'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 diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 4d1fc49..928540b 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 _0x19e2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5e1158,_0x5d520c){var _0x437f1b=function(_0x4699d4){while(--_0x4699d4){_0x5e1158['push'](_0x5e1158['shift']());}};_0x437f1b(++_0x5d520c);}(_0x19e2,0xed));var _0x219e=function(_0x340833,_0x3a9dda){_0x340833=_0x340833-0x0;var _0x281747=_0x19e2[_0x340833];return _0x281747;};'use strict';var _=require(_0x219e('0x0'));var util=require('util');var logger=require(_0x219e('0x1'))(_0x219e('0x2'));var moment=require(_0x219e('0x3'));var BPromise=require(_0x219e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x219e('0x5'));var rimraf=require(_0x219e('0x6'));var config=require(_0x219e('0x7'));var attributes=require(_0x219e('0x8'));module['exports']=function(_0x1bb781,_0x4d8e17){return _0x1bb781[_0x219e('0x9')](_0x219e('0xa'),attributes,{'tableName':_0x219e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x219e('0xc'),'collate':_0x219e('0xd')});}; \ No newline at end of file +var _0xb7a2=['exports','define','mail_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46f3fe,_0x142548){var _0x523989=function(_0x1ae79){while(--_0x1ae79){_0x46f3fe['push'](_0x46f3fe['shift']());}};_0x523989(++_0x142548);}(_0xb7a2,0x19a));var _0x2b7a=function(_0x13ed61,_0x51bd19){_0x13ed61=_0x13ed61-0x0;var _0x4dd613=_0xb7a2[_0x13ed61];return _0x4dd613;};'use strict';var _=require(_0x2b7a('0x0'));var util=require(_0x2b7a('0x1'));var logger=require(_0x2b7a('0x2'))(_0x2b7a('0x3'));var moment=require(_0x2b7a('0x4'));var BPromise=require(_0x2b7a('0x5'));var rp=require(_0x2b7a('0x6'));var fs=require('fs');var path=require(_0x2b7a('0x7'));var rimraf=require(_0x2b7a('0x8'));var config=require(_0x2b7a('0x9'));var attributes=require('./mailApplication.attributes');module[_0x2b7a('0xa')]=function(_0x1fb117,_0x319203){return _0x1fb117[_0x2b7a('0xb')]('MailApplication',attributes,{'tableName':_0x2b7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2b7a('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3727289..0733b48 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 _0x4a8a=['MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','UpdateMailApplication','MailApplication','body','options','raw','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','debug'];(function(_0x4453e3,_0xe3cacc){var _0x3bc69e=function(_0x4ca4d8){while(--_0x4ca4d8){_0x4453e3['push'](_0x4453e3['shift']());}};_0x3bc69e(++_0xe3cacc);}(_0x4a8a,0xf6));var _0xa4a8=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x4a8a[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require(_0xa4a8('0x0'));var util=require(_0xa4a8('0x1'));var moment=require(_0xa4a8('0x2'));var BPromise=require(_0xa4a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4a8('0x4'));var db=require(_0xa4a8('0x5'))['db'];var utils=require(_0xa4a8('0x6'));var logger=require(_0xa4a8('0x7'))(_0xa4a8('0x8'));var config=require('../../config/environment');var jayson=require(_0xa4a8('0x9'));var client=jayson['client'][_0xa4a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42e59f,_0x2fcb89,_0xeee7c5){return new BPromise(function(_0x33a4ee,_0xf9c771){return client[_0xa4a8('0xb')](_0x42e59f,_0xeee7c5)[_0xa4a8('0xc')](function(_0xa3e89c){logger['info'](_0xa4a8('0xd'),_0x2fcb89,'request\x20sent');logger[_0xa4a8('0xe')](_0xa4a8('0xf'),_0x2fcb89,_0xa4a8('0x10'),JSON[_0xa4a8('0x11')](_0xa3e89c));if(_0xa3e89c['error']){if(_0xa3e89c['error'][_0xa4a8('0x12')]===0x1f4){logger[_0xa4a8('0x13')](_0xa4a8('0xd'),_0x2fcb89,_0xa3e89c[_0xa4a8('0x13')]['message']);return _0xf9c771(_0xa3e89c[_0xa4a8('0x13')][_0xa4a8('0x14')]);}logger[_0xa4a8('0x13')]('MailApplication,\x20%s,\x20%s',_0x2fcb89,_0xa3e89c[_0xa4a8('0x13')][_0xa4a8('0x14')]);return _0x33a4ee(_0xa3e89c[_0xa4a8('0x13')]['message']);}else{logger[_0xa4a8('0x15')](_0xa4a8('0xd'),_0x2fcb89,'request\x20sent');_0x33a4ee(_0xa3e89c['result']['message']);}})[_0xa4a8('0x16')](function(_0x246c15){logger[_0xa4a8('0x13')](_0xa4a8('0xd'),_0x2fcb89,_0x246c15);_0xf9c771(_0x246c15);});});}exports[_0xa4a8('0x17')]=function(_0x3d3cce){var _0x37c0a4=this;return new Promise(function(_0x117953,_0x1f6991){return db[_0xa4a8('0x18')]['update'](_0x3d3cce[_0xa4a8('0x19')],{'raw':_0x3d3cce[_0xa4a8('0x1a')]?_0x3d3cce['options'][_0xa4a8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d3cce['options']?_0x3d3cce[_0xa4a8('0x1a')]['where']||null:null,'attributes':_0x3d3cce[_0xa4a8('0x1a')]?_0x3d3cce[_0xa4a8('0x1a')]['attributes']||null:null,'limit':_0x3d3cce['options']?_0x3d3cce[_0xa4a8('0x1a')][_0xa4a8('0x1c')]||null:null})['then'](function(_0x1e5627){logger[_0xa4a8('0x15')](_0xa4a8('0x17'),_0x3d3cce);logger[_0xa4a8('0xe')](_0xa4a8('0x17'),_0x3d3cce,JSON['stringify'](_0x1e5627));_0x117953(_0x1e5627);})[_0xa4a8('0x16')](function(_0x4d2641){logger['error'](_0xa4a8('0x17'),_0x4d2641['message'],_0x3d3cce);_0x1f6991(_0x37c0a4[_0xa4a8('0x13')](0x1f4,_0x4d2641['message']));});});}; \ No newline at end of file +var _0x2091=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','MailApplication','body','options','where','attributes','UpdateMailApplication','catch','lodash','util','moment','ioredis'];(function(_0x427dc0,_0x93c392){var _0x22c153=function(_0x909f58){while(--_0x909f58){_0x427dc0['push'](_0x427dc0['shift']());}};_0x22c153(++_0x93c392);}(_0x2091,0x130));var _0x1209=function(_0x194494,_0x57c76e){_0x194494=_0x194494-0x0;var _0x45acaf=_0x2091[_0x194494];return _0x45acaf;};'use strict';var _=require(_0x1209('0x0'));var util=require(_0x1209('0x1'));var moment=require(_0x1209('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1209('0x3'));var db=require(_0x1209('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1209('0x5'))(_0x1209('0x6'));var config=require(_0x1209('0x7'));var jayson=require(_0x1209('0x8'));var client=jayson[_0x1209('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe0e9d2,_0x571d0e,_0x131f94){return new BPromise(function(_0x32fd9c,_0x49b724){return client[_0x1209('0xa')](_0xe0e9d2,_0x131f94)[_0x1209('0xb')](function(_0x3c59a3){logger[_0x1209('0xc')](_0x1209('0xd'),_0x571d0e,_0x1209('0xe'));logger[_0x1209('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x571d0e,_0x1209('0xe'),JSON[_0x1209('0x10')](_0x3c59a3));if(_0x3c59a3[_0x1209('0x11')]){if(_0x3c59a3[_0x1209('0x11')][_0x1209('0x12')]===0x1f4){logger[_0x1209('0x11')](_0x1209('0xd'),_0x571d0e,_0x3c59a3[_0x1209('0x11')][_0x1209('0x13')]);return _0x49b724(_0x3c59a3[_0x1209('0x11')][_0x1209('0x13')]);}logger[_0x1209('0x11')](_0x1209('0xd'),_0x571d0e,_0x3c59a3[_0x1209('0x11')][_0x1209('0x13')]);return _0x32fd9c(_0x3c59a3[_0x1209('0x11')][_0x1209('0x13')]);}else{logger['info'](_0x1209('0xd'),_0x571d0e,'request\x20sent');_0x32fd9c(_0x3c59a3[_0x1209('0x14')][_0x1209('0x13')]);}})['catch'](function(_0x491ee1){logger[_0x1209('0x11')]('MailApplication,\x20%s,\x20%s',_0x571d0e,_0x491ee1);_0x49b724(_0x491ee1);});});}exports['UpdateMailApplication']=function(_0x2171bd){var _0x11c4a0=this;return new Promise(function(_0x327766,_0x52fcbe){return db[_0x1209('0x15')]['update'](_0x2171bd[_0x1209('0x16')],{'raw':_0x2171bd[_0x1209('0x17')]?_0x2171bd[_0x1209('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2171bd[_0x1209('0x17')]?_0x2171bd[_0x1209('0x17')][_0x1209('0x18')]||null:null,'attributes':_0x2171bd[_0x1209('0x17')]?_0x2171bd['options'][_0x1209('0x19')]||null:null,'limit':_0x2171bd[_0x1209('0x17')]?_0x2171bd[_0x1209('0x17')]['limit']||null:null})[_0x1209('0xb')](function(_0x2b7a0c){logger[_0x1209('0xc')](_0x1209('0x1a'),_0x2171bd);logger[_0x1209('0xf')](_0x1209('0x1a'),_0x2171bd,JSON[_0x1209('0x10')](_0x2b7a0c));_0x327766(_0x2b7a0c);})[_0x1209('0x1b')](function(_0x1fc8be){logger[_0x1209('0x11')]('UpdateMailApplication',_0x1fc8be['message'],_0x2171bd);_0x52fcbe(_0x11c4a0[_0x1209('0x11')](0x1f4,_0x1fc8be['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a7094bf..506c90b 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 _0xbc53=['destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy'];(function(_0x595b0d,_0x426843){var _0x1cdcf6=function(_0x3b4144){while(--_0x3b4144){_0x595b0d['push'](_0x595b0d['shift']());}};_0x1cdcf6(++_0x426843);}(_0xbc53,0xb6));var _0x3bc5=function(_0x107325,_0x3d3c4f){_0x107325=_0x107325-0x0;var _0x35c7b8=_0xbc53[_0x107325];return _0x35c7b8;};'use strict';var express=require(_0x3bc5('0x0'));var router=express[_0x3bc5('0x1')]();var auth=require(_0x3bc5('0x2'));var interaction=require(_0x3bc5('0x3'));var controller=require(_0x3bc5('0x4'));router[_0x3bc5('0x5')]('/',auth[_0x3bc5('0x6')](),controller['index']);router[_0x3bc5('0x5')](_0x3bc5('0x7'),auth[_0x3bc5('0x6')](),controller[_0x3bc5('0x8')]);router[_0x3bc5('0x5')](_0x3bc5('0x9'),auth['isAuthenticated'](),controller[_0x3bc5('0xa')]);router[_0x3bc5('0x5')]('/:id/messages',auth['isAuthenticated'](),controller[_0x3bc5('0xb')]);router[_0x3bc5('0x5')](_0x3bc5('0xc'),auth[_0x3bc5('0x6')](),controller[_0x3bc5('0xd')]);router[_0x3bc5('0xe')]('/',auth[_0x3bc5('0x6')](),controller[_0x3bc5('0xf')]);router[_0x3bc5('0xe')](_0x3bc5('0x10'),auth['isAuthenticated'](),controller[_0x3bc5('0x11')]);router[_0x3bc5('0xe')](_0x3bc5('0x12'),auth['isAuthenticated'](),interaction[_0x3bc5('0x13')](_0x3bc5('0x14'),_0x3bc5('0x15')),controller[_0x3bc5('0x16')]);router[_0x3bc5('0x17')](_0x3bc5('0x9'),auth['isAuthenticated'](),interaction[_0x3bc5('0x13')]('mail',_0x3bc5('0x18')),controller[_0x3bc5('0x19')]);router[_0x3bc5('0x1a')](_0x3bc5('0x9'),auth[_0x3bc5('0x6')](),interaction['tracked']('mail',_0x3bc5('0x1b')),controller[_0x3bc5('0x1c')]);router[_0x3bc5('0x1a')](_0x3bc5('0x12'),auth[_0x3bc5('0x6')](),controller[_0x3bc5('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xd386=['addMessage','tracked','addTags','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xd386,0x1a2));var _0x6d38=function(_0x575d0,_0x45eb69){_0x575d0=_0x575d0-0x0;var _0x1a6e7b=_0xd386[_0x575d0];return _0x1a6e7b;};'use strict';var express=require(_0x6d38('0x0'));var router=express[_0x6d38('0x1')]();var auth=require(_0x6d38('0x2'));var interaction=require(_0x6d38('0x3'));var controller=require(_0x6d38('0x4'));router[_0x6d38('0x5')]('/',auth[_0x6d38('0x6')](),controller[_0x6d38('0x7')]);router[_0x6d38('0x5')](_0x6d38('0x8'),auth[_0x6d38('0x6')](),controller[_0x6d38('0x9')]);router['get'](_0x6d38('0xa'),auth[_0x6d38('0x6')](),controller[_0x6d38('0xb')]);router[_0x6d38('0x5')](_0x6d38('0xc'),auth[_0x6d38('0x6')](),controller[_0x6d38('0xd')]);router[_0x6d38('0x5')](_0x6d38('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x6d38('0xf')]('/',auth[_0x6d38('0x6')](),controller[_0x6d38('0x10')]);router[_0x6d38('0xf')](_0x6d38('0xc'),auth[_0x6d38('0x6')](),controller[_0x6d38('0x11')]);router['post']('/:id/tags',auth[_0x6d38('0x6')](),interaction[_0x6d38('0x12')]('mail','mailinteraction:addtags'),controller[_0x6d38('0x13')]);router[_0x6d38('0x14')](_0x6d38('0xa'),auth[_0x6d38('0x6')](),interaction[_0x6d38('0x12')](_0x6d38('0x15'),_0x6d38('0x16')),controller[_0x6d38('0x17')]);router[_0x6d38('0x18')]('/:id',auth[_0x6d38('0x6')](),interaction[_0x6d38('0x12')](_0x6d38('0x15'),_0x6d38('0x19')),controller[_0x6d38('0x1a')]);router['delete'](_0x6d38('0x1b'),auth['isAuthenticated'](),controller['removeTags']);module[_0x6d38('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 760dcd4..b6bddd9 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 _0x88e3=['out','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x1c7626,_0x21a666){var _0x4fda7f=function(_0x315f44){while(--_0x315f44){_0x1c7626['push'](_0x1c7626['shift']());}};_0x4fda7f(++_0x21a666);}(_0x88e3,0xa3));var _0x388e=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x88e3[_0x476c7];return _0x47ae56;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x388e('0x0'));module[_0x388e('0x1')]={'closed':{'type':Sequelize[_0x388e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x388e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x388e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x388e('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x388e('0x4')]},'cc':{'type':Sequelize[_0x388e('0x5')](_0x388e('0x6'))},'subject':{'type':Sequelize[_0x388e('0x5')]()},'attach':{'type':Sequelize[_0x388e('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x388e('0x3')]},'substatus':{'type':Sequelize[_0x388e('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x388e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x388e('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x388e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x388e('0x7')]('in',_0x388e('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x388e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xff94=['TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING'];(function(_0x289f10,_0x51afc2){var _0x566c22=function(_0x469571){while(--_0x469571){_0x289f10['push'](_0x289f10['shift']());}};_0x566c22(++_0x51afc2);}(_0xff94,0x130));var _0x4ff9=function(_0x1f173e,_0x30a4b8){_0x1f173e=_0x1f173e-0x0;var _0x4790a6=_0xff94[_0x1f173e];return _0x4790a6;};'use strict';var Sequelize=require(_0x4ff9('0x0'));var iconv=require(_0x4ff9('0x1'));module[_0x4ff9('0x2')]={'closed':{'type':Sequelize[_0x4ff9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4ff9('0x4')]},'disposition':{'type':Sequelize[_0x4ff9('0x5')]},'secondDisposition':{'type':Sequelize[_0x4ff9('0x5')]},'thirdDisposition':{'type':Sequelize[_0x4ff9('0x5')]},'note':{'type':Sequelize[_0x4ff9('0x5')]},'inReplyTo':{'type':Sequelize[_0x4ff9('0x5')](0x1fe)},'to':{'type':Sequelize[_0x4ff9('0x5')]},'cc':{'type':Sequelize[_0x4ff9('0x6')](_0x4ff9('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x4ff9('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4ff9('0x4')]},'substatus':{'type':Sequelize[_0x4ff9('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4ff9('0x8')]('in',_0x4ff9('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4ff9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4ff9('0x8')]('in',_0x4ff9('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c403323..88fa0c1 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 _0x704e=['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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','text','keys','compact','isEmpty','MailAccountId','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','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','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','MailInteraction','fields','a.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.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','enableEmailPreview','all','rows','params','rawAttributes','intersection','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','bcc','subject','get','each','Messages','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','writeFileSync','message%d.eml','unlinkSync','zip-dir','util','path','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','error','stack','name','Users','map','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart','catch','index','type','key','model','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','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','unreadMessages'];(function(_0x2c09fe,_0x1ed06b){var _0xb21dca=function(_0x2e761a){while(--_0x2e761a){_0x2c09fe['push'](_0x2c09fe['shift']());}};_0xb21dca(++_0x1ed06b);}(_0x704e,0x93));var _0xe704=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x704e[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe704('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe704('0x1'));var path=require(_0xe704('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe704('0x3'));var juice=require(_0xe704('0x4'));var Redis=require(_0xe704('0x5'));var qs=require(_0xe704('0x6'));var as=require(_0xe704('0x7'));var logger=require(_0xe704('0x8'))('api');var config=require(_0xe704('0x9'));var db=require(_0xe704('0xa'))['db'];var htmlEntities=require(_0xe704('0xb'));config[_0xe704('0xc')]=_[_0xe704('0xd')](config[_0xe704('0xc')],{'host':_0xe704('0xe'),'port':0x18eb});var socket=require(_0xe704('0xf'))(new Redis(config[_0xe704('0xc')]));require(_0xe704('0x10'))['register'](socket);function respondWithStatusCode(_0xf750be,_0x245011){_0x245011=_0x245011||0xcc;return function(_0x57d481){if(_0x57d481){return _0xf750be[_0xe704('0x11')](_0x245011);}return _0xf750be[_0xe704('0x12')](_0x245011)[_0xe704('0x13')]();};}function respondWithResult(_0x1e3da3,_0x3ebabf){_0x3ebabf=_0x3ebabf||0xc8;return function(_0x525d02){if(_0x525d02){return _0x1e3da3[_0xe704('0x12')](_0x3ebabf)[_0xe704('0x14')](_0x525d02);}};}function respondWithFilteredResult(_0x3d134c,_0x2cc1c6){return function(_0x5537bc){if(_0x5537bc){var _0x1b3aa0=typeof _0x2cc1c6[_0xe704('0x15')]===_0xe704('0x16')&&typeof _0x2cc1c6['limit']===_0xe704('0x16');var _0x12ea50=_0x5537bc[_0xe704('0x17')];var _0x46a7bf=_0x1b3aa0?0x0:_0x2cc1c6[_0xe704('0x15')];var _0x3b6042=_0x1b3aa0?_0x5537bc[_0xe704('0x17')]:_0x2cc1c6[_0xe704('0x15')]+_0x2cc1c6[_0xe704('0x18')];var _0x14ed3b;if(_0x3b6042>=_0x12ea50){_0x3b6042=_0x12ea50;_0x14ed3b=0xc8;}else{_0x14ed3b=0xce;}_0x3d134c[_0xe704('0x12')](_0x14ed3b);return _0x3d134c[_0xe704('0x19')](_0xe704('0x1a'),_0x46a7bf+'-'+_0x3b6042+'/'+_0x12ea50)[_0xe704('0x14')](_0x5537bc);}return null;};}function saveUpdates(_0x48b231){return function(_0x118e17){if(_0x118e17){return _0x118e17[_0xe704('0x1b')](_0x48b231)['then'](function(_0x56e730){return _0x56e730;});}return null;};}function removeEntity(_0x532403){return function(_0x59293d){if(_0x59293d){return _0x59293d[_0xe704('0x1c')]()['then'](function(){_0x532403[_0xe704('0x12')](0xcc)[_0xe704('0x13')]();});}};}function handleEntityNotFound(_0x2a7c20){return function(_0x30e77e){if(!_0x30e77e){_0x2a7c20['sendStatus'](0x194);}return _0x30e77e;};}function handleError(_0x3af8a2,_0x3d377e){_0x3d377e=_0x3d377e||0x1f4;return function(_0x41e1af){logger[_0xe704('0x1d')](_0x41e1af[_0xe704('0x1e')]);if(_0x41e1af[_0xe704('0x1f')]){delete _0x41e1af[_0xe704('0x1f')];}_0x3af8a2[_0xe704('0x12')](_0x3d377e)['send'](_0x41e1af);};}function getInteractionUsers(_0x24550e,_0x3286e6){return new BPromise(function(_0x56f1d2,_0x49b7f1){try{if(_0x3286e6[_0x24550e['id']]){_0x24550e[_0xe704('0x20')]=_[_0xe704('0x21')](_0x3286e6[_0x24550e['id']],function(_0x395e35){return{'id':_0x395e35['id'],'fullname':_0x395e35['fullname']};});}}catch(_0x1f8d8d){_0x49b7f1(_0x1f8d8d);}_0x56f1d2(_0x24550e);});}function getInteractionTags(_0x1e4067,_0x471d96){return new BPromise(function(_0x14f5bc,_0x2b4bfd){try{if(_0x1e4067[_0xe704('0x22')]){_0x1e4067[_0xe704('0x23')]=[];_0x1e4067[_0xe704('0x22')][_0xe704('0x24')](',')[_0xe704('0x25')](function(_0x4ee9bc){_0x1e4067[_0xe704('0x23')][_0xe704('0x26')](_0x471d96[_0x4ee9bc]);});}delete _0x1e4067[_0xe704('0x22')];}catch(_0x16eae2){_0x2b4bfd(_0x16eae2);}_0x14f5bc(_0x1e4067);});}function getLastMessageText(_0x4696e8){return new BPromise(function(_0x275f32,_0xc2f1fc){return db[_0xe704('0x27')][_0xe704('0x28')]({'where':{'$and':[{'MailInteractionId':_0x4696e8['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe704('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe704('0x2a')],'order':'-id','raw':!![]})[_0xe704('0x2b')](function(_0x1ec0bf){if(_0x1ec0bf&&_0x1ec0bf[_0xe704('0x2a')]){_0x4696e8[_0xe704('0x2c')]=_[_0xe704('0x2d')](_0x1ec0bf[_0xe704('0x2a')]);}_0x275f32(_0x4696e8);})['catch'](function(_0x4d866c){_0xc2f1fc(_0x4d866c);});});}function updateMailInteraction(_0x496609,_0x1e0d37,_0x45f438,_0xbde09b){return new BPromise(function(_0x4f11d1,_0x59549d){return getInteractionUsers(_0x496609,_0x45f438)[_0xe704('0x2b')](function(_0x5db455){return getInteractionTags(_0x5db455,_0x1e0d37);})['then'](function(_0x1946da){if(_0xbde09b){_0x4f11d1(getLastMessageText(_0x1946da));}else{_0x4f11d1(_0x1946da);}})[_0xe704('0x2e')](function(_0x33768d){_0x59549d(_0x33768d);});});}exports[_0xe704('0x2f')]=function(_0x4df00f,_0x6ba7c3){var _0x1c3201={},_0xc33593={},_0x42b3c9={'count':0x0,'rows':[]};var _0x3747c8=_[_0xe704('0x21')](db['MailInteraction']['rawAttributes'],function(_0xacff06){return{'name':_0xacff06['fieldName'],'type':_0xacff06[_0xe704('0x30')][_0xe704('0x31')]};});_0xc33593[_0xe704('0x32')]=_[_0xe704('0x21')](_0x3747c8,'name');_0xc33593[_0xe704('0x33')]=_['keys'](_0x4df00f['query']);_0xc33593[_0xe704('0x34')]=_['intersection'](_0xc33593[_0xe704('0x32')],_0xc33593[_0xe704('0x33')]);_0x1c3201[_0xe704('0x35')]=_['intersection'](_0xc33593['model'],qs['fields'](_0x4df00f['query']['fields']));_0x1c3201[_0xe704('0x35')]=_0x1c3201['attributes'][_0xe704('0x36')]?_0x1c3201['attributes']:_0xc33593[_0xe704('0x32')];if(!_0x4df00f[_0xe704('0x33')][_0xe704('0x37')](_0xe704('0x38'))){_0x1c3201[_0xe704('0x18')]=qs[_0xe704('0x18')](_0x4df00f[_0xe704('0x33')]['limit']);_0x1c3201[_0xe704('0x15')]=qs[_0xe704('0x15')](_0x4df00f['query'][_0xe704('0x15')]);}_0x1c3201[_0xe704('0x39')]=qs['sort'](_0x4df00f[_0xe704('0x33')][_0xe704('0x3a')]);_0x1c3201[_0xe704('0x3b')]=qs[_0xe704('0x34')](_[_0xe704('0x3c')](_0x4df00f[_0xe704('0x33')],_0xc33593['filters']),_0x3747c8);var _0x1b6e37=[];var _0xa78582=squel[_0xe704('0x3d')]()[_0xe704('0x3e')]('id')['field'](_0xe704('0x1f'))['field']('color')[_0xe704('0x3f')](_0xe704('0x40'));var _0x5cebf0=squel[_0xe704('0x3d')]()['field'](_0xe704('0x41'))[_0xe704('0x3e')](_0xe704('0x42'))[_0xe704('0x3e')](_0xe704('0x43'))[_0xe704('0x3f')](_0xe704('0x44'),'ui')[_0xe704('0x45')](_0xe704('0x46'),'u',_0xe704('0x47'));var _0x4b3e32=squel[_0xe704('0x3d')]()[_0xe704('0x3f')]('mail_interactions','i')[_0xe704('0x45')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe704('0x45')]('users','o','o.id\x20=\x20i.UserId')[_0xe704('0x45')](_0xe704('0x48'),'a',_0xe704('0x49'))['left_join'](_0xe704('0x4a'),'me',_0xe704('0x4b'))[_0xe704('0x45')](_0xe704('0x4c'),'it',_0xe704('0x4d'))[_0xe704('0x45')](_0xe704('0x40'),'t',_0xe704('0x4e'));var _0x364f04=squel['expr']();var _0x2b9b1f=[];var _0x2d47d2=squel[_0xe704('0x4f')]();var _0x16da13;if(_0x4df00f['query'][_0xe704('0x50')]){_0x16da13=as[_0xe704('0x51')](_0x4df00f['query']['search']);var _0x1bf501=_0x16da13[_0xe704('0x52')];for(var _0x2849c2=0x0;_0x2849c2<_0x16da13[_0xe704('0x53')]['length'];_0x2849c2++){var _0x109f13=_0x16da13['conditions'][_0x2849c2];var _0x1493df='i';var _0x5926e2=_['find'](_0x3747c8,[_0xe704('0x1f'),_0x109f13[_0xe704('0x3e')]]);if(!_0x5926e2){switch(_0x109f13[_0xe704('0x3e')]){case _0xe704('0x54'):if(_0x109f13[_0xe704('0x55')]==0x1){_0x4b3e32[_0xe704('0x56')]('`'+_0x109f13[_0xe704('0x3e')]+_0xe704('0x57'));}else{_0x4b3e32['having']('`'+_0x109f13[_0xe704('0x3e')]+_0xe704('0x58'));}break;case'Contact':if(_0x109f13[_0xe704('0x59')]===_0xe704('0x5a')){if(_0x109f13['value'][_0xe704('0x24')]('\x20')[_0xe704('0x36')]>0x1){_0x364f04[_0x1bf501](_0xe704('0x5b'),qs[_0xe704('0x5c')](_0x109f13[_0xe704('0x55')]),null);}else{var _0xbaf176='%'+_0x109f13[_0xe704('0x55')]+'%';_0x364f04[_0x1bf501](_0xe704('0x5d'),_0xbaf176,_0xbaf176,_0xbaf176);}}else{_0x5926e2=_['find'](_0x3747c8,[_0xe704('0x1f'),_0xe704('0x5e')]);_0x109f13['field']=_0xe704('0x5e');_0x58212a=as[_0xe704('0x5f')](_0x1493df,_0x5926e2[_0xe704('0x30')],_0x109f13);_0x364f04[_0x1bf501](_0x58212a['text'],_0x58212a[_0xe704('0x55')][_0xe704('0x60')],_0x58212a['value'][_0xe704('0x13')]);}break;case'Tag':var _0x424088=_0x109f13[_0xe704('0x55')][_0xe704('0x24')](',')[_0xe704('0x21')](function(_0x5d80c7){return Number(_0x5d80c7);});_0x424088[_0xe704('0x25')](function(_0x5b1823){_0x2d47d2['or'](_0xe704('0x61'),'%,'+_0x5b1823+',%');});_0x2b9b1f=_[_0xe704('0x62')](_0x2b9b1f,_0x424088);break;case _0xe704('0x63'):if(_0x109f13[_0xe704('0x59')]===_0xe704('0x5a')){_0x364f04[_0x1bf501](_0xe704('0x64'),'%'+_0x109f13[_0xe704('0x55')]+'%',null);}else{_0x5926e2=_[_0xe704('0x65')](_0x3747c8,[_0xe704('0x1f'),_0xe704('0x66')]);_0x109f13[_0xe704('0x3e')]=_0xe704('0x66');_0x58212a=as[_0xe704('0x5f')](_0x1493df,_0x5926e2[_0xe704('0x30')],_0x109f13);_0x364f04[_0x1bf501](_0x58212a['text'],_0x58212a[_0xe704('0x55')][_0xe704('0x60')],_0x58212a['value'][_0xe704('0x13')]);}break;case _0xe704('0x2a'):_0x58212a=as[_0xe704('0x5f')]('me',null,_0x109f13);_0x364f04[_0x1bf501](_0x58212a[_0xe704('0x67')],_0x58212a[_0xe704('0x55')]['start'],_0x58212a[_0xe704('0x55')][_0xe704('0x13')]);break;}}else{var _0x58212a=as[_0xe704('0x5f')](_0x1493df,_0x5926e2[_0xe704('0x30')],_0x109f13);_0x364f04[_0x1bf501](_0x58212a[_0xe704('0x67')],_0x58212a[_0xe704('0x55')][_0xe704('0x60')],_0x58212a[_0xe704('0x55')][_0xe704('0x13')]);}}}else{var _0x447099=_(_0x4df00f[_0xe704('0x33')])[_0xe704('0x68')]()[_0xe704('0x21')](function(_0x101068){return _['some'](_0x3747c8,[_0xe704('0x1f'),_0x101068])?_0x101068:undefined;})[_0xe704('0x69')]()['value']();if(!_[_0xe704('0x6a')](_0x447099)){_0x447099['forEach'](function(_0x2a4638){if(_0x2a4638===_0xe704('0x6b')){_0x4b3e32[_0xe704('0x3b')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x4df00f[_0xe704('0x33')][_0x2a4638]));}else if(_0x2a4638===_0xe704('0x6c')){var _0x94cd84=JSON[_0xe704('0x6d')](_0x4df00f['query'][_0x2a4638])['$gte'];var _0x4a7cb2=JSON[_0xe704('0x6d')](_0x4df00f[_0xe704('0x33')][_0x2a4638])['$lte'];_0x4b3e32[_0xe704('0x3b')](_0xe704('0x6e'),_0x94cd84,_0x4a7cb2);}else{if(_0x4df00f[_0xe704('0x33')][_0x2a4638]===_0xe704('0x6f')){_0x4b3e32['where']('i.'+_0x2a4638+'\x20IS\x20NULL');}else{_0x4b3e32[_0xe704('0x3b')]('i.'+_0x2a4638+'\x20=\x20?',_0x4df00f[_0xe704('0x33')][_0x2a4638]);}}});}if(_0x4df00f[_0xe704('0x33')][_0xe704('0x70')]){if(_0x4df00f[_0xe704('0x33')]['read']==0x1){_0x4b3e32[_0xe704('0x56')](_0xe704('0x71'));}else{_0x4b3e32[_0xe704('0x56')](_0xe704('0x72'));}}if(_0x4df00f['query'][_0xe704('0x73')]){_0x2b9b1f=_[_0xe704('0x74')](_0x4df00f['query'][_0xe704('0x73')])?_0x4df00f['query']['tag']:new Array(_0x4df00f[_0xe704('0x33')]['tag']);_0x2b9b1f[_0xe704('0x25')](function(_0x18c622){_0x2d47d2['or'](_0xe704('0x61'),'%,'+_0x18c622+',%');});}if(_0x4df00f['query'][_0xe704('0x75')]){var _0x191422=_0x4df00f['query']['filter'][_0xe704('0x76')]('\x5c','\x5c\x5c')[_0xe704('0x76')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x191422)){_0x364f04['or'](_0xe704('0x77'),_0x191422+'%');}else if(qs[_0xe704('0x78')](_0x191422)){_0x364f04['or'](_0xe704('0x79'),_0x191422+'%');}else{_0x364f04['or'](_0xe704('0x7a'),qs[_0xe704('0x5c')](_0x191422))['or'](_0xe704('0x7b'),qs[_0xe704('0x5c')](_0x191422));}}}_0x4b3e32[_0xe704('0x3b')](_0x364f04);_0x4b3e32[_0xe704('0x7c')](_0xe704('0x7d'));var _0x46ea9c={'type':db[_0xe704('0x7e')][_0xe704('0x7f')][_0xe704('0x80')],'raw':!![]};var _0x4bc253=_0x4b3e32[_0xe704('0x81')]();_0x4bc253[_0xe704('0x3e')](_0xe704('0x7d'));_0x4bc253[_0xe704('0x3e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe704('0x54'));if(_0x1c3201[_0xe704('0x39')]){_0x1c3201[_0xe704('0x39')][_0xe704('0x25')](function(_0xdc258c){var _0x3d9b0e=_0xdc258c[0x0]===_0xe704('0x82')?_0xdc258c[0x0]:'i.'+_0xdc258c[0x0];_0x4b3e32[_0xe704('0x39')](_0x3d9b0e,_0xdc258c[0x1]===_0xe704('0x83')?![]:!![]);});}if(!_['isEmpty'](_0x2b9b1f)){_0x4b3e32[_0xe704('0x56')](_0x2d47d2);_0x4bc253['where'](_0xe704('0x84'),_0x2b9b1f);}BPromise[_0xe704('0x85')]()['then'](function(){if(!_0x16da13){if(_0x4df00f[_0xe704('0x33')][_0xe704('0x6b')])return;_0x4bc253['where'](_0xe704('0x86'));_0x4b3e32[_0xe704('0x3b')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4df00f['user'][_0xe704('0x87')]!==_0xe704('0x88'))return;return _0x4df00f[_0xe704('0x89')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xe704('0x2b')](function(_0x667a1b){if(_[_0xe704('0x6a')](_0x667a1b)){_0x4bc253[_0xe704('0x3b')](_0xe704('0x8a'));_0x4b3e32[_0xe704('0x3b')]('i.MailAccountId\x20IS\x20NULL');}else{_0x4bc253[_0xe704('0x3b')]('i.MailAccountId\x20IN\x20?',_[_0xe704('0x21')](_0x667a1b,'id'));_0x4b3e32[_0xe704('0x3b')](_0xe704('0x8b'),_[_0xe704('0x21')](_0x667a1b,'id'));}});})['then'](function(){if(_0x4df00f[_0xe704('0x89')][_0xe704('0x87')]==='agent'&&!_0x16da13&&!_0x4df00f[_0xe704('0x33')][_0xe704('0x6b')])return[];return db['sequelize']['query'](_0x4bc253['toString'](),_0x46ea9c);})[_0xe704('0x2b')](function(_0x68225f){_0x42b3c9[_0xe704('0x17')]=_0x68225f['length'];if(_0x42b3c9['count']===0x0)return[];return db[_0xe704('0x8c')][_0xe704('0x33')](_0xa78582[_0xe704('0x8d')](),_0x46ea9c)[_0xe704('0x2b')](function(_0x538ff4){_0x1b6e37=_[_0xe704('0x8e')](_0x538ff4,'id');_0x46ea9c=_['merge'](_0x46ea9c,{'model':db[_0xe704('0x8f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4df00f[_0xe704('0x33')][_0xe704('0x90')]){_0x1c3201[_0xe704('0x35')][_0xe704('0x25')](function(_0x132766){_0x4b3e32[_0xe704('0x3e')]('i.'+_0x132766);});}else{_0x4b3e32['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4b3e32[_0xe704('0x3e')](_0xe704('0x91'),'Account.key');_0x4b3e32[_0xe704('0x3e')](_0xe704('0x92'),_0xe704('0x93'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x94'),'contactName');_0x4b3e32['field'](_0xe704('0x7d'));_0x4b3e32[_0xe704('0x3e')]('i.createdAt');_0x4b3e32[_0xe704('0x3e')](_0xe704('0x95'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x96'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x97'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x98'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x99'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x9a'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x9b'));_0x4b3e32['field'](_0xe704('0x9c'));_0x4b3e32[_0xe704('0x3e')]('i.secondDisposition');_0x4b3e32[_0xe704('0x3e')](_0xe704('0x9d'));_0x4b3e32['field'](_0xe704('0x9e'));_0x4b3e32['field'](_0xe704('0x9f'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa0'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa1'));_0x4b3e32['field']('i.UserId');_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa2'),_0xe704('0xa3'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa4'),_0xe704('0xa5'));_0x4b3e32['field']('c.email',_0xe704('0xa6'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa7'),_0xe704('0xa8'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa9'),'Contact.mobile');_0x4b3e32['field'](_0xe704('0xaa'),_0xe704('0xab'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xac'),_0xe704('0xad'));_0x4b3e32['field'](_0xe704('0xae'),_0xe704('0xaf'));_0x4b3e32['field'](_0xe704('0xb0'),_0xe704('0x22'));}if(_0x1c3201['limit'])_0x4b3e32['limit'](_0x1c3201[_0xe704('0x18')]);if(_0x1c3201[_0xe704('0x15')])_0x4b3e32[_0xe704('0x15')](_0x1c3201[_0xe704('0x15')]);return db['sequelize'][_0xe704('0x33')](_0x4b3e32[_0xe704('0x8d')](),_0x46ea9c);})[_0xe704('0x2b')](function(_0xe1762f){if(_0xe1762f['length']>0x0)_0x5cebf0['where'](_0xe704('0xb1'),_['map'](_0xe1762f,'id'));return db['sequelize']['query'](_0x5cebf0[_0xe704('0x8d')](),_0x46ea9c)[_0xe704('0x2b')](function(_0x2cf359){var _0x33cedc=_[_0xe704('0xb2')](_0x2cf359,'MailInteractionId');var _0x1e85c1=[];return db['Setting'][_0xe704('0x28')]({'attributes':[_0xe704('0xb3')],'raw':!![]})[_0xe704('0x2b')](function(_0x9b9213){var _0x5a99e3=_0x9b9213['enableEmailPreview'];_0xe1762f[_0xe704('0x25')](function(_0x1447c7){_0x1e85c1[_0xe704('0x26')](updateMailInteraction(_0x1447c7,_0x1b6e37,_0x33cedc,_0x5a99e3));});return BPromise[_0xe704('0xb4')](_0x1e85c1);});});});})[_0xe704('0x2b')](function(_0x57a640){_0x42b3c9[_0xe704('0xb5')]=_0x57a640;return _0x42b3c9;})[_0xe704('0x2b')](respondWithFilteredResult(_0x6ba7c3,_0x1c3201))[_0xe704('0x2e')](handleError(_0x6ba7c3,null));};exports['show']=function(_0x5df187,_0xadb1a1){var _0x4e4019={'raw':![],'where':{'id':_0x5df187[_0xe704('0xb6')]['id']}},_0xa88a8d={};_0xa88a8d['model']=_[_0xe704('0x68')](db[_0xe704('0x8f')][_0xe704('0xb7')]);_0xa88a8d[_0xe704('0x33')]=_[_0xe704('0x68')](_0x5df187[_0xe704('0x33')]);_0xa88a8d[_0xe704('0x34')]=_[_0xe704('0xb8')](_0xa88a8d[_0xe704('0x32')],_0xa88a8d[_0xe704('0x33')]);_0x4e4019[_0xe704('0x35')]=_[_0xe704('0xb8')](_0xa88a8d[_0xe704('0x32')],qs[_0xe704('0x90')](_0x5df187['query'][_0xe704('0x90')]));_0x4e4019[_0xe704('0x35')]=_0x4e4019[_0xe704('0x35')][_0xe704('0x36')]?_0x4e4019[_0xe704('0x35')]:_0xa88a8d[_0xe704('0x32')];if(_0x5df187['query'][_0xe704('0xb9')]){_0x4e4019[_0xe704('0xba')]=[{'all':!![]}];}_0x4e4019=_[_0xe704('0xbb')]({},_0x4e4019,_0x5df187[_0xe704('0xbc')]);return db[_0xe704('0x8f')][_0xe704('0x65')](_0x4e4019)[_0xe704('0x2b')](handleEntityNotFound(_0xadb1a1,null))[_0xe704('0x2b')](respondWithResult(_0xadb1a1,null))['catch'](handleError(_0xadb1a1,null));};exports[_0xe704('0xbd')]=function(_0x132bda,_0x30e4b1){return db[_0xe704('0x8f')][_0xe704('0xbd')](_0x132bda[_0xe704('0xbe')],{})[_0xe704('0x2b')](respondWithResult(_0x30e4b1,0xc9))[_0xe704('0x2e')](handleError(_0x30e4b1,null));};exports[_0xe704('0x1b')]=function(_0x4c90ac,_0x592665){if(_0x4c90ac[_0xe704('0xbe')]['id']){delete _0x4c90ac[_0xe704('0xbe')]['id'];}return db[_0xe704('0x8f')][_0xe704('0x65')]({'where':{'id':_0x4c90ac['params']['id']}})['then'](handleEntityNotFound(_0x592665,null))[_0xe704('0x2b')](saveUpdates(_0x4c90ac[_0xe704('0xbe')],null))[_0xe704('0x2b')](respondWithResult(_0x592665,null))[_0xe704('0x2e')](handleError(_0x592665,null));};exports[_0xe704('0x1c')]=function(_0x4267ed,_0x75bc6e){return db[_0xe704('0x8f')][_0xe704('0x65')]({'where':{'id':_0x4267ed[_0xe704('0xb6')]['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0x75bc6e,null))[_0xe704('0x2b')](removeEntity(_0x75bc6e,null))[_0xe704('0x2e')](handleError(_0x75bc6e,null));};exports[_0xe704('0xbf')]=function(_0x90f1e3,_0x50bf9e){return db[_0xe704('0x8f')]['describe']()[_0xe704('0x2b')](respondWithResult(_0x50bf9e,null))[_0xe704('0x2e')](handleError(_0x50bf9e,null));};exports[_0xe704('0xc0')]=function(_0x2eae86,_0x48b5f4){return db['MailMessage'][_0xe704('0x65')]({'where':{'id':_0x2eae86['params']['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0x48b5f4,null))['then'](function(_0x10850c){if(_0x10850c){return _0x10850c['addMessage'](_0x2eae86[_0xe704('0xbe')][_0xe704('0xc1')],_[_0xe704('0xc2')](_0x2eae86[_0xe704('0xbe')],[_0xe704('0xc1'),'id'])||{});}})[_0xe704('0x2b')](respondWithResult(_0x48b5f4,null))['catch'](handleError(_0x48b5f4,null));};exports['getMessages']=function(_0x5c8d9b,_0xa1c29){var _0x5e11ba={'raw':![],'where':{}};var _0x57e41c={};var _0x20a93f={'count':0x0,'rows':[]};return db['MailInteraction'][_0xe704('0x28')]({'where':{'id':_0x5c8d9b['params']['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0xa1c29,null))[_0xe704('0x2b')](function(_0x21457a){if(_0x21457a){_0x57e41c[_0xe704('0x32')]=_[_0xe704('0x68')](db['MailMessage'][_0xe704('0xb7')]);_0x57e41c[_0xe704('0x33')]=_[_0xe704('0x68')](_0x5c8d9b[_0xe704('0x33')]);_0x57e41c[_0xe704('0x34')]=_['intersection'](_0x57e41c[_0xe704('0x32')],_0x57e41c[_0xe704('0x33')]);_0x5e11ba[_0xe704('0x35')]=_['intersection'](_0x57e41c[_0xe704('0x32')],qs[_0xe704('0x90')](_0x5c8d9b[_0xe704('0x33')][_0xe704('0x90')]));_0x5e11ba[_0xe704('0x35')]=_0x5e11ba[_0xe704('0x35')][_0xe704('0x36')]?_0x5e11ba[_0xe704('0x35')]:_0x57e41c[_0xe704('0x32')];if(!_0x5c8d9b['query'][_0xe704('0x37')](_0xe704('0x38'))){_0x5e11ba[_0xe704('0x18')]=qs[_0xe704('0x18')](_0x5c8d9b[_0xe704('0x33')][_0xe704('0x18')]);_0x5e11ba['offset']=qs['offset'](_0x5c8d9b[_0xe704('0x33')][_0xe704('0x15')]);}_0x5e11ba[_0xe704('0x39')]=qs['sort'](_0x5c8d9b[_0xe704('0x33')][_0xe704('0x3a')]);_0x5e11ba['where']=qs[_0xe704('0x34')](_[_0xe704('0x3c')](_0x5c8d9b[_0xe704('0x33')],_0x57e41c[_0xe704('0x34')]));_0x5e11ba[_0xe704('0x3b')][_0xe704('0xc3')]=_0x21457a['id'];if(_0x5c8d9b[_0xe704('0x33')][_0xe704('0x75')]){_0x5e11ba[_0xe704('0x3b')]=_['merge'](_0x5e11ba['where'],{'$or':_[_0xe704('0x21')](_0x5e11ba[_0xe704('0x35')],function(_0x1f4fad){var _0xd30098={};_0xd30098[_0x1f4fad]={'$like':'%'+_0x5c8d9b[_0xe704('0x33')]['filter']+'%'};return _0xd30098;})});}if(_0x5c8d9b['query'][_0xe704('0xc4')]){var _0x3196ff=_0x5c8d9b[_0xe704('0x33')]['$gte'][_0xe704('0x24')](',');var _0x229112={};_0x229112[_0x3196ff[0x0]]={'$gte':moment(_0x3196ff[0x1])[_0xe704('0xc5')](_0xe704('0xc6'))};_0x5e11ba[_0xe704('0x3b')]=_[_0xe704('0xbb')](_0x5e11ba['where'],_0x229112);}_0x5e11ba=_[_0xe704('0xbb')]({},_0x5e11ba,_0x5c8d9b[_0xe704('0xbc')]);return db[_0xe704('0x27')][_0xe704('0x17')]({'where':_0x5e11ba[_0xe704('0x3b')]})['then'](function(_0x3cdc8c){_0x20a93f['count']=_0x3cdc8c;if(_0x5c8d9b['query'][_0xe704('0xb9')]){_0x5e11ba[_0xe704('0xba')]=[{'all':!![]}];}return db[_0xe704('0x27')][_0xe704('0xc7')](_0x5e11ba);})[_0xe704('0x2b')](function(_0x57a88c){if(_0x5c8d9b[_0xe704('0x33')][_0xe704('0xc8')]===_0xe704('0xc9')){for(var _0x22efbb=0x0;_0x22efbb<_0x57a88c[_0xe704('0x36')];_0x22efbb++){_0x57a88c[_0x22efbb]['body']=juice(_0x57a88c[_0x22efbb]['body']);}}_0x20a93f[_0xe704('0xb5')]=_0x57a88c;return _0x20a93f;});}})[_0xe704('0x2b')](respondWithFilteredResult(_0xa1c29,_0x5e11ba))[_0xe704('0x2e')](handleError(_0xa1c29,null));};exports[_0xe704('0xca')]=function(_0x3e4ebf,_0x4dd687){return db[_0xe704('0x8f')]['find']({'where':{'id':_0x3e4ebf[_0xe704('0xb6')]['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0x4dd687,null))[_0xe704('0x2b')](function(_0x27b87d){if(_0x27b87d){return _0x27b87d[_0xe704('0xcb')](_0x3e4ebf[_0xe704('0xbe')][_0xe704('0xc1')],_[_0xe704('0xc2')](_0x3e4ebf[_0xe704('0xbe')],['ids','id'])||{})[_0xe704('0xcc')](function(){return db[_0xe704('0xcd')][_0xe704('0xc7')]({'attributes':['id','name',_0xe704('0xce')],'where':{'id':_0x3e4ebf[_0xe704('0xbe')][_0xe704('0xc1')]}});})[_0xe704('0x2b')](function(_0x3fedd0){socket[_0xe704('0xcf')]('mailInteractionTags:save',{'id':Number(_0x3e4ebf[_0xe704('0xb6')]['id']),'tags':_0x3fedd0||[]});return{'id':Number(_0x3e4ebf[_0xe704('0xb6')]['id']),'tags':_0x3fedd0||[]};});}})['then'](respondWithResult(_0x4dd687,null))['catch'](handleError(_0x4dd687,null));};exports['removeTags']=function(_0x2e9227,_0x5637e7){return db[_0xe704('0x8f')][_0xe704('0x65')]({'where':{'id':_0x2e9227[_0xe704('0xb6')]['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0x5637e7,null))['then'](function(_0x5094c3){if(_0x5094c3){return _0x5094c3[_0xe704('0xd0')](_0x2e9227[_0xe704('0x33')][_0xe704('0xc1')]);}})[_0xe704('0x2b')](respondWithStatusCode(_0x5637e7,null))[_0xe704('0x2e')](handleError(_0x5637e7,null));};exports[_0xe704('0xd1')]=function(_0x3eeea2,_0x3278bd){var _0x3a9ec8=moment()[_0xe704('0xd2')]()[_0xe704('0x8d')]();var _0x44f1a7=path[_0xe704('0xd3')](config[_0xe704('0xd4')],'server','files','tmp');var _0x38bfcd=path[_0xe704('0xd3')](config[_0xe704('0xd4')],_0xe704('0xd5'),_0xe704('0xd6'),_0xe704('0xd7'));var _0x5e2de9=path['join'](_0x44f1a7,_0x3a9ec8);var _0x44da1b=util['format'](_0xe704('0xd8'),_0x3eeea2['params']['id'],_0x3a9ec8);var _0x4a983e=path['join'](_0x44f1a7,_0x44da1b);var _0x5d89b7=[];if(_0x3eeea2[_0xe704('0x33')][_0xe704('0xd7')]){_0x5d89b7[_0xe704('0x26')]({'model':db[_0xe704('0xd9')],'as':'Attachments','raw':!![]});}var _0x4141a6=[{'model':db[_0xe704('0x27')],'as':'Messages','attributes':['id','body',_0xe704('0x3f'),'to','cc',_0xe704('0xda'),_0xe704('0xdb'),_0xe704('0x6c')],'where':{'secret':![]},'order':qs[_0xe704('0x3a')]('id'),'include':_0x5d89b7}];return db[_0xe704('0x8f')]['find']({'where':{'id':_0x3eeea2['params']['id']},'include':_0x4141a6})[_0xe704('0x2b')](handleEntityNotFound(_0x3278bd,null))[_0xe704('0x2b')](function(_0x436b10){if(_0x436b10&&_0x436b10['Messages']){var _0x5ec589=_0x436b10[_0xe704('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x5e2de9);return BPromise[_0xe704('0xdd')](_0x5ec589[_0xe704('0xde')],function(_0x577ea3,_0x333dad){var _0x27cd63={'from':_0x577ea3['from'],'to':_0x577ea3['to'],'subject':_0x577ea3[_0xe704('0xdb')],'html':htmlEntities['decode'](_0x577ea3[_0xe704('0xbe')]),'headers':{'Date':moment(_0x577ea3[_0xe704('0x6c')])[_0xe704('0xc5')](_0xe704('0xdf'))},'attachments':[]};if(_0x577ea3['cc']){_0x27cd63[_0xe704('0xe0')]['Cc']=_0x577ea3['cc'];}if(_0x577ea3[_0xe704('0xda')]){_0x27cd63[_0xe704('0xe0')][_0xe704('0xe1')]=_0x577ea3['bcc'];}return new BPromise(function(_0x5d0e1b,_0x416ae7){if(_0x577ea3['Attachments']){for(var _0x5525c9=0x0;_0x5525c9<_0x577ea3['Attachments'][_0xe704('0x36')];_0x5525c9++){var _0x3d6483=_0x577ea3[_0xe704('0xe2')][_0x5525c9];var _0x1e0aa3=path[_0xe704('0xd3')](_0x38bfcd,_0x3d6483[_0xe704('0xe3')]);if(fs[_0xe704('0xe4')](_0x1e0aa3)){_0x27cd63[_0xe704('0xd7')][_0xe704('0x26')]({'name':_0x3d6483[_0xe704('0x1f')],'contentType':_0x3d6483[_0xe704('0x30')],'data':fs['readFileSync'](_0x1e0aa3)});}}}emlformat['build'](_0x27cd63,function(_0x3cfd87,_0x22cb3e){if(_0x3cfd87)return _0x416ae7(_0x3cfd87);fs[_0xe704('0xe5')](path['join'](_0x5e2de9,util['format'](_0xe704('0xe6'),_0x333dad)),_0x22cb3e);return _0x5d0e1b(_0x22cb3e);});});})[_0xe704('0x2b')](function(){return new BPromise(function(_0x508986,_0x1e854a){zipdir(_0x5e2de9,{'saveTo':_0x4a983e},function(_0x3b2a26,_0x274359){if(_0x3b2a26)return _0x1e854a(_0x3b2a26);return _0x508986(_0x274359);});})[_0xe704('0x2b')](function(){return new BPromise(function(_0x53ad37,_0x13381c){rimraf(_0x5e2de9,function(_0x19f5d6){if(_0x19f5d6)_0x13381c(_0x19f5d6);return _0x53ad37();});});})[_0xe704('0x2b')](function(){return _0x3278bd[_0xe704('0xd1')](_0x4a983e,_0x44da1b,function(_0x54e158){if(!_0x54e158)fs[_0xe704('0xe7')](_0x4a983e);});});});}else{return _0x3278bd[_0xe704('0x11')](0xc8);}})[_0xe704('0x2e')](handleError(_0x3278bd,null));}; \ No newline at end of file +var _0xb9b2=['redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','count','Content-Range','json','update','then','error','name','Users','fullname','TagIds','split','forEach','push','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','select','field','color','from','tools_tags','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','conditions','find','unreadMessages','value','having','`\x20=\x200','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','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.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','rows','show','params','MailInteraction','merge','create','body','describe','addMessage','ids','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','include','findAll','inlineCss','true','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','moment','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../mysqldb','html-entities'];(function(_0x29ceb7,_0x464552){var _0x26e370=function(_0x44b53c){while(--_0x44b53c){_0x29ceb7['push'](_0x29ceb7['shift']());}};_0x26e370(++_0x464552);}(_0xb9b2,0xd1));var _0x2b9b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xb9b2[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require(_0x2b9b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x2b9b('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x2b9b('0x2'));var squel=require(_0x2b9b('0x3'));var juice=require(_0x2b9b('0x4'));var Redis=require(_0x2b9b('0x5'));var qs=require(_0x2b9b('0x6'));var as=require(_0x2b9b('0x7'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x2b9b('0x8'))['db'];var htmlEntities=require(_0x2b9b('0x9'));config[_0x2b9b('0xa')]=_[_0x2b9b('0xb')](config[_0x2b9b('0xa')],{'host':_0x2b9b('0xc'),'port':0x18eb});var socket=require(_0x2b9b('0xd'))(new Redis(config[_0x2b9b('0xa')]));require(_0x2b9b('0xe'))[_0x2b9b('0xf')](socket);function respondWithStatusCode(_0x1cd664,_0x23c9eb){_0x23c9eb=_0x23c9eb||0xcc;return function(_0x4c8bd1){if(_0x4c8bd1){return _0x1cd664[_0x2b9b('0x10')](_0x23c9eb);}return _0x1cd664[_0x2b9b('0x11')](_0x23c9eb)[_0x2b9b('0x12')]();};}function respondWithResult(_0x55abaa,_0x20ce4f){_0x20ce4f=_0x20ce4f||0xc8;return function(_0x1905e1){if(_0x1905e1){return _0x55abaa['status'](_0x20ce4f)['json'](_0x1905e1);}};}function respondWithFilteredResult(_0x5a7c9d,_0x3f08b8){return function(_0x2b2829){if(_0x2b2829){var _0x597e45=typeof _0x3f08b8[_0x2b9b('0x13')]===_0x2b9b('0x14')&&typeof _0x3f08b8['limit']==='undefined';var _0x30dbb2=_0x2b2829[_0x2b9b('0x15')];var _0x175cdd=_0x597e45?0x0:_0x3f08b8['offset'];var _0x1bc521=_0x597e45?_0x2b2829[_0x2b9b('0x15')]:_0x3f08b8['offset']+_0x3f08b8['limit'];var _0x3854ee;if(_0x1bc521>=_0x30dbb2){_0x1bc521=_0x30dbb2;_0x3854ee=0xc8;}else{_0x3854ee=0xce;}_0x5a7c9d[_0x2b9b('0x11')](_0x3854ee);return _0x5a7c9d['set'](_0x2b9b('0x16'),_0x175cdd+'-'+_0x1bc521+'/'+_0x30dbb2)[_0x2b9b('0x17')](_0x2b2829);}return null;};}function saveUpdates(_0x72fe9d){return function(_0x2fa93f){if(_0x2fa93f){return _0x2fa93f[_0x2b9b('0x18')](_0x72fe9d)[_0x2b9b('0x19')](function(_0x454ce6){return _0x454ce6;});}return null;};}function removeEntity(_0x1442da){return function(_0x2413b8){if(_0x2413b8){return _0x2413b8['destroy']()[_0x2b9b('0x19')](function(){_0x1442da[_0x2b9b('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x468042){return function(_0x2622a2){if(!_0x2622a2){_0x468042[_0x2b9b('0x10')](0x194);}return _0x2622a2;};}function handleError(_0x500a0c,_0x1b982b){_0x1b982b=_0x1b982b||0x1f4;return function(_0x3d8a73){logger[_0x2b9b('0x1a')](_0x3d8a73['stack']);if(_0x3d8a73[_0x2b9b('0x1b')]){delete _0x3d8a73[_0x2b9b('0x1b')];}_0x500a0c[_0x2b9b('0x11')](_0x1b982b)['send'](_0x3d8a73);};}function getInteractionUsers(_0x45c366,_0x3e69a5){return new BPromise(function(_0x41185e,_0x196c6e){try{if(_0x3e69a5[_0x45c366['id']]){_0x45c366[_0x2b9b('0x1c')]=_['map'](_0x3e69a5[_0x45c366['id']],function(_0x54f948){return{'id':_0x54f948['id'],'fullname':_0x54f948[_0x2b9b('0x1d')]};});}}catch(_0xc1b315){_0x196c6e(_0xc1b315);}_0x41185e(_0x45c366);});}function getInteractionTags(_0x28b955,_0xfacd35){return new BPromise(function(_0x388c6f,_0x1c1541){try{if(_0x28b955['TagIds']){_0x28b955['Tags']=[];_0x28b955[_0x2b9b('0x1e')][_0x2b9b('0x1f')](',')[_0x2b9b('0x20')](function(_0x4ee9de){_0x28b955['Tags'][_0x2b9b('0x21')](_0xfacd35[_0x4ee9de]);});}delete _0x28b955[_0x2b9b('0x1e')];}catch(_0x4f87a7){_0x1c1541(_0x4f87a7);}_0x388c6f(_0x28b955);});}function getLastMessageText(_0x4eae75){return new BPromise(function(_0x4a32ec,_0x2013c5){return db[_0x2b9b('0x22')][_0x2b9b('0x23')]({'where':{'$and':[{'MailInteractionId':_0x4eae75['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2b9b('0x24')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x2b9b('0x25'),'raw':!![]})[_0x2b9b('0x19')](function(_0x14f5d9){if(_0x14f5d9&&_0x14f5d9[_0x2b9b('0x26')]){_0x4eae75[_0x2b9b('0x27')]=_[_0x2b9b('0x28')](_0x14f5d9[_0x2b9b('0x26')]);}_0x4a32ec(_0x4eae75);})['catch'](function(_0xfe0fb7){_0x2013c5(_0xfe0fb7);});});}function updateMailInteraction(_0x5e176d,_0x5645c5,_0x370147,_0x2f039b){return new BPromise(function(_0x5483a5,_0x43c63c){return getInteractionUsers(_0x5e176d,_0x370147)['then'](function(_0x45004e){return getInteractionTags(_0x45004e,_0x5645c5);})[_0x2b9b('0x19')](function(_0x1fdee1){if(_0x2f039b){_0x5483a5(getLastMessageText(_0x1fdee1));}else{_0x5483a5(_0x1fdee1);}})[_0x2b9b('0x29')](function(_0x169eb6){_0x43c63c(_0x169eb6);});});}exports[_0x2b9b('0x2a')]=function(_0x4d6298,_0xecec09){var _0x40a9de={},_0xb1bf86={},_0x318d14={'count':0x0,'rows':[]};var _0x3a4bb4=_[_0x2b9b('0x2b')](db['MailInteraction'][_0x2b9b('0x2c')],function(_0x43ecde){return{'name':_0x43ecde[_0x2b9b('0x2d')],'type':_0x43ecde[_0x2b9b('0x2e')]['key']};});_0xb1bf86['model']=_[_0x2b9b('0x2b')](_0x3a4bb4,'name');_0xb1bf86[_0x2b9b('0x2f')]=_[_0x2b9b('0x30')](_0x4d6298[_0x2b9b('0x2f')]);_0xb1bf86[_0x2b9b('0x31')]=_['intersection'](_0xb1bf86[_0x2b9b('0x32')],_0xb1bf86[_0x2b9b('0x2f')]);_0x40a9de[_0x2b9b('0x33')]=_[_0x2b9b('0x34')](_0xb1bf86[_0x2b9b('0x32')],qs[_0x2b9b('0x35')](_0x4d6298['query'][_0x2b9b('0x35')]));_0x40a9de[_0x2b9b('0x33')]=_0x40a9de['attributes'][_0x2b9b('0x36')]?_0x40a9de[_0x2b9b('0x33')]:_0xb1bf86['model'];if(!_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x37')](_0x2b9b('0x38'))){_0x40a9de[_0x2b9b('0x39')]=qs[_0x2b9b('0x39')](_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x39')]);_0x40a9de[_0x2b9b('0x13')]=qs['offset'](_0x4d6298['query'][_0x2b9b('0x13')]);}_0x40a9de[_0x2b9b('0x3a')]=qs[_0x2b9b('0x3b')](_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x3b')]);_0x40a9de[_0x2b9b('0x3c')]=qs[_0x2b9b('0x31')](_['pick'](_0x4d6298[_0x2b9b('0x2f')],_0xb1bf86[_0x2b9b('0x31')]),_0x3a4bb4);var _0x24e1be=[];var _0x38c269=squel[_0x2b9b('0x3d')]()['field']('id')[_0x2b9b('0x3e')](_0x2b9b('0x1b'))['field'](_0x2b9b('0x3f'))[_0x2b9b('0x40')](_0x2b9b('0x41'));var _0x14a103=squel['select']()['field'](_0x2b9b('0x42'))[_0x2b9b('0x3e')]('u.fullname')['field'](_0x2b9b('0x43'))['from'](_0x2b9b('0x44'),'ui')[_0x2b9b('0x45')](_0x2b9b('0x46'),'u',_0x2b9b('0x47'));var _0x12db81=squel[_0x2b9b('0x3d')]()['from']('mail_interactions','i')[_0x2b9b('0x45')]('cm_contacts','c',_0x2b9b('0x48'))[_0x2b9b('0x45')](_0x2b9b('0x46'),'o',_0x2b9b('0x49'))[_0x2b9b('0x45')](_0x2b9b('0x4a'),'a',_0x2b9b('0x4b'))['left_join']('mail_messages','me',_0x2b9b('0x4c'))['left_join']('mail_interaction_has_tags','it',_0x2b9b('0x4d'))['left_join']('tools_tags','t',_0x2b9b('0x4e'));var _0x55e261=squel['expr']();var _0xed5def=[];var _0x24a9ee=squel['expr']();var _0x2d358f;if(_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x4f')]){_0x2d358f=as['parseSearch'](_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x4f')]);var _0xd68641=_0x2d358f['sqlOperator'];for(var _0x5b9e30=0x0;_0x5b9e30<_0x2d358f[_0x2b9b('0x50')][_0x2b9b('0x36')];_0x5b9e30++){var _0x4222fa=_0x2d358f[_0x2b9b('0x50')][_0x5b9e30];var _0x18d974='i';var _0x52a569=_[_0x2b9b('0x51')](_0x3a4bb4,[_0x2b9b('0x1b'),_0x4222fa['field']]);if(!_0x52a569){switch(_0x4222fa[_0x2b9b('0x3e')]){case _0x2b9b('0x52'):if(_0x4222fa[_0x2b9b('0x53')]==0x1){_0x12db81[_0x2b9b('0x54')]('`'+_0x4222fa['field']+_0x2b9b('0x55'));}else{_0x12db81[_0x2b9b('0x54')]('`'+_0x4222fa[_0x2b9b('0x3e')]+'`\x20>\x200');}break;case'Contact':if(_0x4222fa['operator']===_0x2b9b('0x56')){if(_0x4222fa[_0x2b9b('0x53')][_0x2b9b('0x1f')]('\x20')['length']>0x1){_0x55e261[_0xd68641]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4222fa['value']),null);}else{var _0x78ed8d='%'+_0x4222fa['value']+'%';_0x55e261[_0xd68641](_0x2b9b('0x57'),_0x78ed8d,_0x78ed8d,_0x78ed8d);}}else{_0x52a569=_['find'](_0x3a4bb4,[_0x2b9b('0x1b'),_0x2b9b('0x58')]);_0x4222fa['field']=_0x2b9b('0x58');_0x6898f3=as[_0x2b9b('0x59')](_0x18d974,_0x52a569[_0x2b9b('0x2e')],_0x4222fa);_0x55e261[_0xd68641](_0x6898f3['text'],_0x6898f3[_0x2b9b('0x53')][_0x2b9b('0x5a')],_0x6898f3[_0x2b9b('0x53')][_0x2b9b('0x12')]);}break;case'Tag':var _0x286c3d=_0x4222fa[_0x2b9b('0x53')][_0x2b9b('0x1f')](',')['map'](function(_0x331f26){return Number(_0x331f26);});_0x286c3d[_0x2b9b('0x20')](function(_0x2e5469){_0x24a9ee['or'](_0x2b9b('0x5b'),'%,'+_0x2e5469+',%');});_0xed5def=_[_0x2b9b('0x5c')](_0xed5def,_0x286c3d);break;case _0x2b9b('0x5d'):if(_0x4222fa[_0x2b9b('0x5e')]==='$substring'){_0x55e261[_0xd68641](_0x2b9b('0x5f'),'%'+_0x4222fa[_0x2b9b('0x53')]+'%',null);}else{_0x52a569=_[_0x2b9b('0x51')](_0x3a4bb4,[_0x2b9b('0x1b'),_0x2b9b('0x60')]);_0x4222fa[_0x2b9b('0x3e')]='UserId';_0x6898f3=as['buildExpression'](_0x18d974,_0x52a569[_0x2b9b('0x2e')],_0x4222fa);_0x55e261[_0xd68641](_0x6898f3[_0x2b9b('0x61')],_0x6898f3[_0x2b9b('0x53')][_0x2b9b('0x5a')],_0x6898f3[_0x2b9b('0x53')][_0x2b9b('0x12')]);}break;case _0x2b9b('0x26'):_0x6898f3=as[_0x2b9b('0x59')]('me',null,_0x4222fa);_0x55e261[_0xd68641](_0x6898f3[_0x2b9b('0x61')],_0x6898f3[_0x2b9b('0x53')][_0x2b9b('0x5a')],_0x6898f3[_0x2b9b('0x53')][_0x2b9b('0x12')]);break;}}else{var _0x6898f3=as[_0x2b9b('0x59')](_0x18d974,_0x52a569['type'],_0x4222fa);_0x55e261[_0xd68641](_0x6898f3[_0x2b9b('0x61')],_0x6898f3[_0x2b9b('0x53')][_0x2b9b('0x5a')],_0x6898f3[_0x2b9b('0x53')]['end']);}}}else{var _0x5c3abf=_(_0x4d6298[_0x2b9b('0x2f')])['keys']()['map'](function(_0x4df3d2){return _[_0x2b9b('0x62')](_0x3a4bb4,[_0x2b9b('0x1b'),_0x4df3d2])?_0x4df3d2:undefined;})[_0x2b9b('0x63')]()[_0x2b9b('0x53')]();if(!_[_0x2b9b('0x64')](_0x5c3abf)){_0x5c3abf[_0x2b9b('0x20')](function(_0xc50760){if(_0xc50760===_0x2b9b('0x65')){_0x12db81[_0x2b9b('0x3c')](_0x2b9b('0x66'),[][_0x2b9b('0x67')](_0x4d6298[_0x2b9b('0x2f')][_0xc50760]));}else if(_0xc50760===_0x2b9b('0x68')){var _0x5da88b=JSON[_0x2b9b('0x69')](_0x4d6298[_0x2b9b('0x2f')][_0xc50760])[_0x2b9b('0x6a')];var _0x396a0c=JSON['parse'](_0x4d6298[_0x2b9b('0x2f')][_0xc50760])[_0x2b9b('0x6b')];_0x12db81[_0x2b9b('0x3c')](_0x2b9b('0x6c'),_0x5da88b,_0x396a0c);}else{if(_0x4d6298[_0x2b9b('0x2f')][_0xc50760]===_0x2b9b('0x6d')){_0x12db81['where']('i.'+_0xc50760+_0x2b9b('0x6e'));}else{_0x12db81[_0x2b9b('0x3c')]('i.'+_0xc50760+_0x2b9b('0x6f'),_0x4d6298[_0x2b9b('0x2f')][_0xc50760]);}}});}if(_0x4d6298['query'][_0x2b9b('0x70')]){if(_0x4d6298['query']['read']==0x1){_0x12db81[_0x2b9b('0x54')]('`unreadMessages`\x20=\x200');}else{_0x12db81[_0x2b9b('0x54')]('`unreadMessages`\x20>\x200');}}if(_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x71')]){_0xed5def=_[_0x2b9b('0x72')](_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x71')])?_0x4d6298[_0x2b9b('0x2f')]['tag']:new Array(_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x71')]);_0xed5def[_0x2b9b('0x20')](function(_0xae1aac){_0x24a9ee['or'](_0x2b9b('0x5b'),'%,'+_0xae1aac+',%');});}if(_0x4d6298['query']['filter']){var _0x29291a=_0x4d6298['query'][_0x2b9b('0x73')][_0x2b9b('0x74')]('\x5c','\x5c\x5c')[_0x2b9b('0x74')](/'/g,'\x27\x27');if(qs[_0x2b9b('0x75')](_0x29291a)){_0x55e261['or']('i.id\x20LIKE\x20?',_0x29291a+'%');}else if(qs[_0x2b9b('0x76')](_0x29291a)){_0x55e261['or'](_0x2b9b('0x77'),_0x29291a+'%');}else{_0x55e261['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x29291a))['or'](_0x2b9b('0x78'),qs['getFullTextValue'](_0x29291a));}}}_0x12db81[_0x2b9b('0x3c')](_0x55e261);_0x12db81[_0x2b9b('0x79')](_0x2b9b('0x7a'));var _0x22d7f0={'type':db[_0x2b9b('0x7b')]['QueryTypes'][_0x2b9b('0x7c')],'raw':!![]};var _0x359cd2=_0x12db81['clone']();_0x359cd2[_0x2b9b('0x3e')](_0x2b9b('0x7a'));_0x359cd2[_0x2b9b('0x3e')](_0x2b9b('0x7d'),_0x2b9b('0x52'));if(_0x40a9de[_0x2b9b('0x3a')]){_0x40a9de[_0x2b9b('0x3a')]['forEach'](function(_0x473877){var _0x30c1c7=_0x473877[0x0]===_0x2b9b('0x7e')?_0x473877[0x0]:'i.'+_0x473877[0x0];_0x12db81['order'](_0x30c1c7,_0x473877[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2b9b('0x64')](_0xed5def)){_0x12db81[_0x2b9b('0x54')](_0x24a9ee);_0x359cd2['where'](_0x2b9b('0x7f'),_0xed5def);}BPromise['resolve']()['then'](function(){if(!_0x2d358f){if(_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x65')])return;_0x359cd2[_0x2b9b('0x3c')](_0x2b9b('0x80'));_0x12db81[_0x2b9b('0x3c')](_0x2b9b('0x80'));return;}if(_0x4d6298[_0x2b9b('0x81')][_0x2b9b('0x82')]!==_0x2b9b('0x83'))return;return _0x4d6298[_0x2b9b('0x81')][_0x2b9b('0x84')]({'attributes':['id'],'raw':!![]})[_0x2b9b('0x19')](function(_0x400603){if(_[_0x2b9b('0x64')](_0x400603)){_0x359cd2[_0x2b9b('0x3c')](_0x2b9b('0x85'));_0x12db81[_0x2b9b('0x3c')](_0x2b9b('0x85'));}else{_0x359cd2[_0x2b9b('0x3c')](_0x2b9b('0x66'),_[_0x2b9b('0x2b')](_0x400603,'id'));_0x12db81[_0x2b9b('0x3c')](_0x2b9b('0x66'),_[_0x2b9b('0x2b')](_0x400603,'id'));}});})[_0x2b9b('0x19')](function(){if(_0x4d6298[_0x2b9b('0x81')][_0x2b9b('0x82')]===_0x2b9b('0x83')&&!_0x2d358f&&!_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x65')])return[];return db[_0x2b9b('0x86')]['query'](_0x359cd2[_0x2b9b('0x87')](),_0x22d7f0);})[_0x2b9b('0x19')](function(_0x11e9f8){_0x318d14['count']=_0x11e9f8['length'];if(_0x318d14['count']===0x0)return[];return db[_0x2b9b('0x86')][_0x2b9b('0x2f')](_0x38c269[_0x2b9b('0x87')](),_0x22d7f0)[_0x2b9b('0x19')](function(_0x3781cc){_0x24e1be=_[_0x2b9b('0x88')](_0x3781cc,'id');_0x22d7f0=_['merge'](_0x22d7f0,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4d6298[_0x2b9b('0x2f')][_0x2b9b('0x35')]){_0x40a9de[_0x2b9b('0x33')]['forEach'](function(_0x1a1fa7){_0x12db81[_0x2b9b('0x3e')]('i.'+_0x1a1fa7);});}else{_0x12db81['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2b9b('0x52'));_0x12db81['field'](_0x2b9b('0x89'),'Account.key');_0x12db81['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x8a'),_0x2b9b('0x7e'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x7a'));_0x12db81[_0x2b9b('0x3e')]('i.createdAt');_0x12db81[_0x2b9b('0x3e')]('i.updatedAt');_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x8b'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x8c'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x8d'));_0x12db81[_0x2b9b('0x3e')]('i.lastMsgAt');_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x8e'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x8f'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x90'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x91'));_0x12db81['field']('i.thirdDisposition');_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x92'));_0x12db81[_0x2b9b('0x3e')]('i.to');_0x12db81['field'](_0x2b9b('0x93'));_0x12db81['field'](_0x2b9b('0x94'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x95'));_0x12db81['field'](_0x2b9b('0x96'),_0x2b9b('0x97'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x98'),_0x2b9b('0x99'));_0x12db81['field'](_0x2b9b('0x9a'),_0x2b9b('0x9b'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x9c'),'Contact.phone');_0x12db81['field']('c.mobile','Contact.mobile');_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x9d'),_0x2b9b('0x9e'));_0x12db81[_0x2b9b('0x3e')](_0x2b9b('0x9f'),_0x2b9b('0xa0'));_0x12db81['field'](_0x2b9b('0xa1'),_0x2b9b('0xa2'));_0x12db81['field'](_0x2b9b('0xa3'),_0x2b9b('0x1e'));}if(_0x40a9de[_0x2b9b('0x39')])_0x12db81[_0x2b9b('0x39')](_0x40a9de[_0x2b9b('0x39')]);if(_0x40a9de[_0x2b9b('0x13')])_0x12db81[_0x2b9b('0x13')](_0x40a9de[_0x2b9b('0x13')]);return db[_0x2b9b('0x86')][_0x2b9b('0x2f')](_0x12db81['toString'](),_0x22d7f0);})[_0x2b9b('0x19')](function(_0x462406){if(_0x462406['length']>0x0)_0x14a103[_0x2b9b('0x3c')](_0x2b9b('0xa4'),_[_0x2b9b('0x2b')](_0x462406,'id'));return db[_0x2b9b('0x86')][_0x2b9b('0x2f')](_0x14a103[_0x2b9b('0x87')](),_0x22d7f0)[_0x2b9b('0x19')](function(_0xb92c2d){var _0x41c52e=_[_0x2b9b('0xa5')](_0xb92c2d,_0x2b9b('0xa6'));var _0x2c74b0=[];return db['Setting']['findOne']({'attributes':['enableEmailPreview'],'raw':!![]})[_0x2b9b('0x19')](function(_0x5d7064){var _0x21ff77=_0x5d7064[_0x2b9b('0xa7')];_0x462406[_0x2b9b('0x20')](function(_0x546b93){_0x2c74b0[_0x2b9b('0x21')](updateMailInteraction(_0x546b93,_0x24e1be,_0x41c52e,_0x21ff77));});return BPromise[_0x2b9b('0xa8')](_0x2c74b0);});});});})['then'](function(_0x8d4d6d){_0x318d14[_0x2b9b('0xa9')]=_0x8d4d6d;return _0x318d14;})[_0x2b9b('0x19')](respondWithFilteredResult(_0xecec09,_0x40a9de))[_0x2b9b('0x29')](handleError(_0xecec09,null));};exports[_0x2b9b('0xaa')]=function(_0x242edd,_0x5def26){var _0x18cd5f={'raw':![],'where':{'id':_0x242edd[_0x2b9b('0xab')]['id']}},_0xa6dbe3={};_0xa6dbe3[_0x2b9b('0x32')]=_['keys'](db[_0x2b9b('0xac')][_0x2b9b('0x2c')]);_0xa6dbe3[_0x2b9b('0x2f')]=_[_0x2b9b('0x30')](_0x242edd['query']);_0xa6dbe3['filters']=_['intersection'](_0xa6dbe3['model'],_0xa6dbe3['query']);_0x18cd5f[_0x2b9b('0x33')]=_[_0x2b9b('0x34')](_0xa6dbe3[_0x2b9b('0x32')],qs[_0x2b9b('0x35')](_0x242edd[_0x2b9b('0x2f')]['fields']));_0x18cd5f[_0x2b9b('0x33')]=_0x18cd5f[_0x2b9b('0x33')][_0x2b9b('0x36')]?_0x18cd5f[_0x2b9b('0x33')]:_0xa6dbe3[_0x2b9b('0x32')];if(_0x242edd[_0x2b9b('0x2f')]['includeAll']){_0x18cd5f['include']=[{'all':!![]}];}_0x18cd5f=_[_0x2b9b('0xad')]({},_0x18cd5f,_0x242edd['options']);return db['MailInteraction'][_0x2b9b('0x51')](_0x18cd5f)[_0x2b9b('0x19')](handleEntityNotFound(_0x5def26,null))['then'](respondWithResult(_0x5def26,null))[_0x2b9b('0x29')](handleError(_0x5def26,null));};exports[_0x2b9b('0xae')]=function(_0x17c5ea,_0xde8d68){return db['MailInteraction'][_0x2b9b('0xae')](_0x17c5ea[_0x2b9b('0xaf')],{})[_0x2b9b('0x19')](respondWithResult(_0xde8d68,0xc9))[_0x2b9b('0x29')](handleError(_0xde8d68,null));};exports[_0x2b9b('0x18')]=function(_0x3b6b3e,_0x2d7c36){if(_0x3b6b3e[_0x2b9b('0xaf')]['id']){delete _0x3b6b3e['body']['id'];}return db[_0x2b9b('0xac')][_0x2b9b('0x51')]({'where':{'id':_0x3b6b3e[_0x2b9b('0xab')]['id']}})[_0x2b9b('0x19')](handleEntityNotFound(_0x2d7c36,null))[_0x2b9b('0x19')](saveUpdates(_0x3b6b3e[_0x2b9b('0xaf')],null))[_0x2b9b('0x19')](respondWithResult(_0x2d7c36,null))['catch'](handleError(_0x2d7c36,null));};exports['destroy']=function(_0x2725fd,_0x5168bf){return db[_0x2b9b('0xac')]['find']({'where':{'id':_0x2725fd[_0x2b9b('0xab')]['id']}})[_0x2b9b('0x19')](handleEntityNotFound(_0x5168bf,null))[_0x2b9b('0x19')](removeEntity(_0x5168bf,null))[_0x2b9b('0x29')](handleError(_0x5168bf,null));};exports[_0x2b9b('0xb0')]=function(_0x4d05d9,_0x265813){return db[_0x2b9b('0xac')][_0x2b9b('0xb0')]()[_0x2b9b('0x19')](respondWithResult(_0x265813,null))['catch'](handleError(_0x265813,null));};exports[_0x2b9b('0xb1')]=function(_0x25c272,_0x1bd5a7){return db[_0x2b9b('0x22')][_0x2b9b('0x51')]({'where':{'id':_0x25c272[_0x2b9b('0xab')]['id']}})['then'](handleEntityNotFound(_0x1bd5a7,null))[_0x2b9b('0x19')](function(_0xc23917){if(_0xc23917){return _0xc23917[_0x2b9b('0xb1')](_0x25c272[_0x2b9b('0xaf')][_0x2b9b('0xb2')],_['omit'](_0x25c272[_0x2b9b('0xaf')],['ids','id'])||{});}})[_0x2b9b('0x19')](respondWithResult(_0x1bd5a7,null))[_0x2b9b('0x29')](handleError(_0x1bd5a7,null));};exports['getMessages']=function(_0x2e9554,_0x30f287){var _0x434a7a={'raw':![],'where':{}};var _0x7de57f={};var _0x175156={'count':0x0,'rows':[]};return db['MailInteraction'][_0x2b9b('0x23')]({'where':{'id':_0x2e9554[_0x2b9b('0xab')]['id']}})[_0x2b9b('0x19')](handleEntityNotFound(_0x30f287,null))[_0x2b9b('0x19')](function(_0x3d7dbe){if(_0x3d7dbe){_0x7de57f[_0x2b9b('0x32')]=_['keys'](db[_0x2b9b('0x22')]['rawAttributes']);_0x7de57f[_0x2b9b('0x2f')]=_['keys'](_0x2e9554[_0x2b9b('0x2f')]);_0x7de57f[_0x2b9b('0x31')]=_[_0x2b9b('0x34')](_0x7de57f[_0x2b9b('0x32')],_0x7de57f[_0x2b9b('0x2f')]);_0x434a7a[_0x2b9b('0x33')]=_[_0x2b9b('0x34')](_0x7de57f[_0x2b9b('0x32')],qs[_0x2b9b('0x35')](_0x2e9554[_0x2b9b('0x2f')][_0x2b9b('0x35')]));_0x434a7a['attributes']=_0x434a7a[_0x2b9b('0x33')][_0x2b9b('0x36')]?_0x434a7a[_0x2b9b('0x33')]:_0x7de57f[_0x2b9b('0x32')];if(!_0x2e9554[_0x2b9b('0x2f')]['hasOwnProperty'](_0x2b9b('0x38'))){_0x434a7a[_0x2b9b('0x39')]=qs['limit'](_0x2e9554[_0x2b9b('0x2f')]['limit']);_0x434a7a[_0x2b9b('0x13')]=qs['offset'](_0x2e9554[_0x2b9b('0x2f')]['offset']);}_0x434a7a[_0x2b9b('0x3a')]=qs[_0x2b9b('0x3b')](_0x2e9554[_0x2b9b('0x2f')][_0x2b9b('0x3b')]);_0x434a7a['where']=qs[_0x2b9b('0x31')](_['pick'](_0x2e9554[_0x2b9b('0x2f')],_0x7de57f[_0x2b9b('0x31')]));_0x434a7a[_0x2b9b('0x3c')][_0x2b9b('0xa6')]=_0x3d7dbe['id'];if(_0x2e9554[_0x2b9b('0x2f')]['filter']){_0x434a7a[_0x2b9b('0x3c')]=_[_0x2b9b('0xad')](_0x434a7a[_0x2b9b('0x3c')],{'$or':_['map'](_0x434a7a[_0x2b9b('0x33')],function(_0x3d93a6){var _0x4837f9={};_0x4837f9[_0x3d93a6]={'$like':'%'+_0x2e9554[_0x2b9b('0x2f')]['filter']+'%'};return _0x4837f9;})});}if(_0x2e9554['query'][_0x2b9b('0x6a')]){var _0x13268e=_0x2e9554[_0x2b9b('0x2f')][_0x2b9b('0x6a')]['split'](',');var _0x10b267={};_0x10b267[_0x13268e[0x0]]={'$gte':moment(_0x13268e[0x1])['format'](_0x2b9b('0xb3'))};_0x434a7a[_0x2b9b('0x3c')]=_[_0x2b9b('0xad')](_0x434a7a['where'],_0x10b267);}_0x434a7a=_[_0x2b9b('0xad')]({},_0x434a7a,_0x2e9554[_0x2b9b('0xb4')]);return db['MailMessage'][_0x2b9b('0x15')]({'where':_0x434a7a[_0x2b9b('0x3c')]})['then'](function(_0x392191){_0x175156[_0x2b9b('0x15')]=_0x392191;if(_0x2e9554[_0x2b9b('0x2f')][_0x2b9b('0xb5')]){_0x434a7a[_0x2b9b('0xb6')]=[{'all':!![]}];}return db[_0x2b9b('0x22')][_0x2b9b('0xb7')](_0x434a7a);})[_0x2b9b('0x19')](function(_0x1435c6){if(_0x2e9554[_0x2b9b('0x2f')][_0x2b9b('0xb8')]===_0x2b9b('0xb9')){for(var _0x557f17=0x0;_0x557f17<_0x1435c6[_0x2b9b('0x36')];_0x557f17++){_0x1435c6[_0x557f17]['body']=juice(_0x1435c6[_0x557f17][_0x2b9b('0xaf')]);}}_0x175156['rows']=_0x1435c6;return _0x175156;});}})[_0x2b9b('0x19')](respondWithFilteredResult(_0x30f287,_0x434a7a))[_0x2b9b('0x29')](handleError(_0x30f287,null));};exports[_0x2b9b('0xba')]=function(_0x45363e,_0x17dc77){return db[_0x2b9b('0xac')][_0x2b9b('0x51')]({'where':{'id':_0x45363e[_0x2b9b('0xab')]['id']}})['then'](handleEntityNotFound(_0x17dc77,null))[_0x2b9b('0x19')](function(_0xd6af21){if(_0xd6af21){return _0xd6af21[_0x2b9b('0xbb')](_0x45363e[_0x2b9b('0xaf')][_0x2b9b('0xb2')],_['omit'](_0x45363e[_0x2b9b('0xaf')],[_0x2b9b('0xb2'),'id'])||{})[_0x2b9b('0xbc')](function(){return db[_0x2b9b('0xbd')][_0x2b9b('0xb7')]({'attributes':['id',_0x2b9b('0x1b'),_0x2b9b('0x3f')],'where':{'id':_0x45363e[_0x2b9b('0xaf')][_0x2b9b('0xb2')]}});})[_0x2b9b('0x19')](function(_0x343fe9){socket[_0x2b9b('0xbe')](_0x2b9b('0xbf'),{'id':Number(_0x45363e['params']['id']),'tags':_0x343fe9||[]});return{'id':Number(_0x45363e['params']['id']),'tags':_0x343fe9||[]};});}})[_0x2b9b('0x19')](respondWithResult(_0x17dc77,null))['catch'](handleError(_0x17dc77,null));};exports[_0x2b9b('0xc0')]=function(_0x5448e8,_0x55cfa3){return db['MailInteraction']['find']({'where':{'id':_0x5448e8[_0x2b9b('0xab')]['id']}})['then'](handleEntityNotFound(_0x55cfa3,null))[_0x2b9b('0x19')](function(_0x4b3bea){if(_0x4b3bea){return _0x4b3bea[_0x2b9b('0xc0')](_0x5448e8[_0x2b9b('0x2f')][_0x2b9b('0xb2')]);}})[_0x2b9b('0x19')](respondWithStatusCode(_0x55cfa3,null))['catch'](handleError(_0x55cfa3,null));};exports[_0x2b9b('0xc1')]=function(_0x642483,_0x1d0a7e){var _0x1afb5d=moment()[_0x2b9b('0xc2')]()['toString']();var _0x46cf28=path[_0x2b9b('0xc3')](config[_0x2b9b('0xc4')],_0x2b9b('0xc5'),'files',_0x2b9b('0xc6'));var _0x493c60=path[_0x2b9b('0xc3')](config['root'],_0x2b9b('0xc5'),_0x2b9b('0xc7'),_0x2b9b('0xc8'));var _0x4a39e8=path['join'](_0x46cf28,_0x1afb5d);var _0x42693c=util[_0x2b9b('0xc9')](_0x2b9b('0xca'),_0x642483[_0x2b9b('0xab')]['id'],_0x1afb5d);var _0x135252=path[_0x2b9b('0xc3')](_0x46cf28,_0x42693c);var _0x44514f=[];if(_0x642483[_0x2b9b('0x2f')][_0x2b9b('0xc8')]){_0x44514f[_0x2b9b('0x21')]({'model':db[_0x2b9b('0xcb')],'as':_0x2b9b('0xcc'),'raw':!![]});}var _0x2dc5da=[{'model':db[_0x2b9b('0x22')],'as':_0x2b9b('0xcd'),'attributes':['id',_0x2b9b('0xaf'),_0x2b9b('0x40'),'to','cc','bcc',_0x2b9b('0xce'),'createdAt'],'where':{'secret':![]},'order':qs[_0x2b9b('0x3b')]('id'),'include':_0x44514f}];return db[_0x2b9b('0xac')]['find']({'where':{'id':_0x642483['params']['id']},'include':_0x2dc5da})['then'](handleEntityNotFound(_0x1d0a7e,null))[_0x2b9b('0x19')](function(_0x455ebd){if(_0x455ebd&&_0x455ebd['Messages']){var _0x290418=_0x455ebd[_0x2b9b('0xcf')]({'plain':!![]});fs[_0x2b9b('0xd0')](_0x4a39e8);return BPromise[_0x2b9b('0xd1')](_0x290418[_0x2b9b('0xcd')],function(_0x4bf05c,_0x3264c5){var _0x31b058={'from':_0x4bf05c[_0x2b9b('0x40')],'to':_0x4bf05c['to'],'subject':_0x4bf05c['subject'],'html':htmlEntities['decode'](_0x4bf05c[_0x2b9b('0xaf')]),'headers':{'Date':moment(_0x4bf05c[_0x2b9b('0x68')])[_0x2b9b('0xc9')](_0x2b9b('0xd2'))},'attachments':[]};if(_0x4bf05c['cc']){_0x31b058[_0x2b9b('0xd3')]['Cc']=_0x4bf05c['cc'];}if(_0x4bf05c['bcc']){_0x31b058[_0x2b9b('0xd3')][_0x2b9b('0xd4')]=_0x4bf05c['bcc'];}return new BPromise(function(_0xd9468,_0x2334c8){if(_0x4bf05c[_0x2b9b('0xcc')]){for(var _0x2b5fef=0x0;_0x2b5fef<_0x4bf05c['Attachments'][_0x2b9b('0x36')];_0x2b5fef++){var _0x1862f2=_0x4bf05c['Attachments'][_0x2b5fef];var _0x190340=path[_0x2b9b('0xc3')](_0x493c60,_0x1862f2[_0x2b9b('0xd5')]);if(fs[_0x2b9b('0xd6')](_0x190340)){_0x31b058['attachments']['push']({'name':_0x1862f2[_0x2b9b('0x1b')],'contentType':_0x1862f2[_0x2b9b('0x2e')],'data':fs[_0x2b9b('0xd7')](_0x190340)});}}}emlformat['build'](_0x31b058,function(_0x37577e,_0x34dd21){if(_0x37577e)return _0x2334c8(_0x37577e);fs[_0x2b9b('0xd8')](path[_0x2b9b('0xc3')](_0x4a39e8,util['format'](_0x2b9b('0xd9'),_0x3264c5)),_0x34dd21);return _0xd9468(_0x34dd21);});});})[_0x2b9b('0x19')](function(){return new BPromise(function(_0x2173aa,_0x441d31){zipdir(_0x4a39e8,{'saveTo':_0x135252},function(_0x331ac2,_0x34c9c6){if(_0x331ac2)return _0x441d31(_0x331ac2);return _0x2173aa(_0x34c9c6);});})['then'](function(){return new BPromise(function(_0x184943,_0x3ac51f){rimraf(_0x4a39e8,function(_0x3b6f02){if(_0x3b6f02)_0x3ac51f(_0x3b6f02);return _0x184943();});});})['then'](function(){return _0x1d0a7e[_0x2b9b('0xc1')](_0x135252,_0x42693c,function(_0x5470cc){if(!_0x5470cc)fs[_0x2b9b('0xda')](_0x135252);});});});}else{return _0x1d0a7e[_0x2b9b('0x10')](0xc8);}})[_0x2b9b('0x29')](handleError(_0x1d0a7e,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 78d28d9..27903a4 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 _0x881e=['emit','catch','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length'];(function(_0x5abda7,_0x27e97a){var _0x48d568=function(_0xa7a425){while(--_0xa7a425){_0x5abda7['push'](_0x5abda7['shift']());}};_0x48d568(++_0x27e97a);}(_0x881e,0xa3));var _0xe881=function(_0x387db3,_0xf44bf1){_0x387db3=_0x387db3-0x0;var _0x51b263=_0x881e[_0x387db3];return _0x51b263;};'use strict';var EventEmitter=require(_0xe881('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xe881('0x1'))['db'][_0xe881('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe881('0x3')](0x0);var events={'afterCreate':_0xe881('0x4'),'afterUpdate':_0xe881('0x5'),'afterDestroy':_0xe881('0x6')};function emitEvent(_0x5c946c){return function(_0x5c0b87,_0x2eb860,_0x4dce2c){_0x5c0b87[_0xe881('0x7')]({'attributes':['id'],'raw':!![]})[_0xe881('0x8')](function(_0x12f51e){_0x5c0b87[_0xe881('0x9')]('Users',_0x12f51e[_0xe881('0xa')](function(_0x3d7e6c){return{'id':_0x3d7e6c['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5c0b87['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe881('0x8')](function(_0x56acac){_0x5c0b87[_0xe881('0x9')](_0xe881('0xb'),_0x56acac[_0xe881('0xc')]);MailInteractionEvents[_0xe881('0xd')](_0x5c946c+':'+_0x5c0b87['id'],_0x5c0b87);MailInteractionEvents[_0xe881('0xd')](_0x5c946c,_0x5c0b87);_0x4dce2c(null);})[_0xe881('0xe')](_0x4dce2c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xe881('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xea52=['hook','exports','../../mysqldb','MailInteraction','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch'];(function(_0x35ba0a,_0x57eaeb){var _0x4bddb0=function(_0x4a5600){while(--_0x4a5600){_0x35ba0a['push'](_0x35ba0a['shift']());}};_0x4bddb0(++_0x57eaeb);}(_0xea52,0x162));var _0x2ea5=function(_0x23224c,_0x482d9b){_0x23224c=_0x23224c-0x0;var _0xa86d0d=_0xea52[_0x23224c];return _0xa86d0d;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x2ea5('0x0'))['db'][_0x2ea5('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2ea5('0x2'),'afterDestroy':_0x2ea5('0x3')};function emitEvent(_0x3522ad){return function(_0x388a08,_0x25adb0,_0x526ec8){_0x388a08[_0x2ea5('0x4')]({'attributes':['id'],'raw':!![]})[_0x2ea5('0x5')](function(_0x215d34){_0x388a08[_0x2ea5('0x6')](_0x2ea5('0x7'),_0x215d34[_0x2ea5('0x8')](function(_0x589a33){return{'id':_0x589a33['id']};}));return MailMessage[_0x2ea5('0x9')]({'where':{'MailInteractionId':_0x388a08['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2ea5('0x5')](function(_0x1107ef){_0x388a08[_0x2ea5('0x6')](_0x2ea5('0xa'),_0x1107ef[_0x2ea5('0xb')]);MailInteractionEvents[_0x2ea5('0xc')](_0x3522ad+':'+_0x388a08['id'],_0x388a08);MailInteractionEvents[_0x2ea5('0xc')](_0x3522ad,_0x388a08);_0x526ec8(null);})[_0x2ea5('0xd')](_0x526ec8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x2ea5('0xe')](e,emitEvent(event));}}module[_0x2ea5('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 860bb32..fcbb9b7 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 _0x81f2=['YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x81f2,0x169));var _0x281f=function(_0x56bcff,_0x158e5f){_0x56bcff=_0x56bcff-0x0;var _0x340351=_0x81f2[_0x56bcff];return _0x340351;};'use strict';var _=require(_0x281f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x281f('0x1'));var BPromise=require(_0x281f('0x2'));var rp=require(_0x281f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x281f('0x4'));var config=require(_0x281f('0x5'));var attributes=require(_0x281f('0x6'));module[_0x281f('0x7')]=function(_0x4f076e,_0x49dc37){return _0x4f076e[_0x281f('0x8')](_0x281f('0x9'),attributes,{'tableName':_0x281f('0xa'),'paranoid':![],'indexes':[{'name':_0x281f('0xb'),'fields':[_0x281f('0xc'),'to'],'type':_0x281f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2f4497,_0xc7000c,_0x3cf8f7){if(_0x2f4497[_0x281f('0xe')]){_0x2f4497[_0x281f('0xf')]=moment()[_0x281f('0x10')](_0x281f('0x11'));}if(_0x2f4497[_0x281f('0x12')]){_0x2f4497[_0x281f('0x13')]=moment()[_0x281f('0x10')](_0x281f('0x11'));}_0x3cf8f7(null,_0xc7000c);},'beforeUpdate':function(_0x5cc278,_0xb88973,_0x7ab972){if(_0x5cc278['changed'](_0x281f('0xe'))){_0x5cc278[_0x281f('0xf')]=_0x5cc278[_0x281f('0xe')]?moment()[_0x281f('0x10')](_0x281f('0x11')):null;}if(_0x5cc278[_0x281f('0x14')](_0x281f('0x12'))){_0x5cc278[_0x281f('0x13')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5cc278[_0x281f('0xe')]=null;_0x5cc278[_0x281f('0xf')]=null;}_0x7ab972(null,_0x5cc278);},'afterUpdate':function(_0x153b6a,_0x17e9f0,_0x5c417d){var _0x52e8f9=_0x4f076e['models'];var _0x44272a=_0x153b6a[_0x281f('0x15')]({'plain':!![]});if(_0x44272a[_0x281f('0x12')]){return _0x52e8f9['MailMessage'][_0x281f('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x44272a['id']}})[_0x281f('0x17')](function(){_0x5c417d();})[_0x281f('0x18')](function(_0x23566e){_0x5c417d(_0x23566e);});}else{_0x5c417d();}}},'charset':_0x281f('0x19'),'collate':_0x281f('0x1a')});}; \ No newline at end of file +var _0x4f10=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','catch','utf8mb4_unicode_ci','lodash'];(function(_0x1e8982,_0x37bfc7){var _0x115066=function(_0x202cb1){while(--_0x202cb1){_0x1e8982['push'](_0x1e8982['shift']());}};_0x115066(++_0x37bfc7);}(_0x4f10,0xfb));var _0x04f1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4f10[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x04f1('0x0'));var util=require(_0x04f1('0x1'));var logger=require(_0x04f1('0x2'))(_0x04f1('0x3'));var moment=require(_0x04f1('0x4'));var BPromise=require(_0x04f1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04f1('0x6'));var rimraf=require(_0x04f1('0x7'));var config=require(_0x04f1('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x04f1('0x9')]=function(_0x5a5e8c,_0x1bfc59){return _0x5a5e8c['define'](_0x04f1('0xa'),attributes,{'tableName':_0x04f1('0xb'),'paranoid':![],'indexes':[{'name':_0x04f1('0xc'),'fields':[_0x04f1('0xd'),'to'],'type':_0x04f1('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59674b,_0x1e4a83,_0x26e005){if(_0x59674b[_0x04f1('0xf')]){_0x59674b[_0x04f1('0x10')]=moment()[_0x04f1('0x11')](_0x04f1('0x12'));}if(_0x59674b[_0x04f1('0x13')]){_0x59674b[_0x04f1('0x14')]=moment()[_0x04f1('0x11')](_0x04f1('0x12'));}_0x26e005(null,_0x1e4a83);},'beforeUpdate':function(_0x81b524,_0x12f128,_0x305eaa){if(_0x81b524[_0x04f1('0x15')](_0x04f1('0xf'))){_0x81b524[_0x04f1('0x10')]=_0x81b524['substatus']?moment()[_0x04f1('0x11')](_0x04f1('0x12')):null;}if(_0x81b524['changed']('closed')){_0x81b524[_0x04f1('0x14')]=moment()[_0x04f1('0x11')](_0x04f1('0x12'));_0x81b524[_0x04f1('0xf')]=null;_0x81b524['substatusAt']=null;}_0x305eaa(null,_0x81b524);},'afterUpdate':function(_0x41c279,_0x591393,_0x3e2109){var _0x34fc45=_0x5a5e8c[_0x04f1('0x16')];var _0xb4419b=_0x41c279[_0x04f1('0x17')]({'plain':!![]});if(_0xb4419b[_0x04f1('0x13')]){return _0x34fc45[_0x04f1('0x18')][_0x04f1('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0xb4419b['id']}})['then'](function(){_0x3e2109();})[_0x04f1('0x1a')](function(_0x5aace1){_0x3e2109(_0x5aace1);});}else{_0x3e2109();}}},'charset':'utf8mb4','collate':_0x04f1('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index fda49d1..578f787 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 _0x507b=['omit','ids','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToMailInteraction','addTags'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x507b,0x187));var _0xb507=function(_0x163ab5,_0x6a7dbe){_0x163ab5=_0x163ab5-0x0;var _0x17e579=_0x507b[_0x163ab5];return _0x17e579;};'use strict';var _=require('lodash');var util=require(_0xb507('0x0'));var moment=require('moment');var BPromise=require(_0xb507('0x1'));var rs=require(_0xb507('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb507('0x3'))['db'];var utils=require(_0xb507('0x4'));var logger=require(_0xb507('0x5'))(_0xb507('0x6'));var config=require(_0xb507('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb507('0x8')][_0xb507('0x9')]({'port':0x232a});config[_0xb507('0xa')]=_[_0xb507('0xb')](config[_0xb507('0xa')],{'host':_0xb507('0xc'),'port':0x18eb});var socket=require(_0xb507('0xd'))(new Redis(config[_0xb507('0xa')]));require(_0xb507('0xe'))[_0xb507('0xf')](socket);function respondWithRpcPromise(_0x24e1e2,_0x2169b1,_0xdfd8a4){return new BPromise(function(_0x17acae,_0x10470){return client[_0xb507('0x10')](_0x24e1e2,_0xdfd8a4)[_0xb507('0x11')](function(_0x4a111a){logger[_0xb507('0x12')](_0xb507('0x13'),_0x2169b1,_0xb507('0x14'));logger[_0xb507('0x15')](_0xb507('0x16'),_0x2169b1,_0xb507('0x14'),JSON['stringify'](_0x4a111a));if(_0x4a111a[_0xb507('0x17')]){if(_0x4a111a['error']['code']===0x1f4){logger['error'](_0xb507('0x13'),_0x2169b1,_0x4a111a[_0xb507('0x17')]['message']);return _0x10470(_0x4a111a[_0xb507('0x17')][_0xb507('0x18')]);}logger['error'](_0xb507('0x13'),_0x2169b1,_0x4a111a[_0xb507('0x17')][_0xb507('0x18')]);return _0x17acae(_0x4a111a[_0xb507('0x17')][_0xb507('0x18')]);}else{logger[_0xb507('0x12')](_0xb507('0x13'),_0x2169b1,_0xb507('0x14'));_0x17acae(_0x4a111a[_0xb507('0x19')][_0xb507('0x18')]);}})[_0xb507('0x1a')](function(_0x255b93){logger[_0xb507('0x17')](_0xb507('0x13'),_0x2169b1,_0x255b93);_0x10470(_0x255b93);});});}exports[_0xb507('0x1b')]=function(_0xcfe04c){var _0x5d8570=this;return new Promise(function(_0x70c8b5,_0x5a2570){return db[_0xb507('0x1c')][_0xb507('0x1d')](_0xcfe04c[_0xb507('0x1e')],{'raw':_0xcfe04c[_0xb507('0x1f')]?_0xcfe04c[_0xb507('0x1f')][_0xb507('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcfe04c[_0xb507('0x1f')]?_0xcfe04c[_0xb507('0x1f')][_0xb507('0x21')]||null:null,'attributes':_0xcfe04c[_0xb507('0x1f')]?_0xcfe04c[_0xb507('0x1f')][_0xb507('0x22')]||null:null,'limit':_0xcfe04c['options']?_0xcfe04c[_0xb507('0x1f')][_0xb507('0x23')]||null:null})[_0xb507('0x11')](function(_0x46ff83){logger[_0xb507('0x12')](_0xb507('0x1b'),_0xcfe04c);logger['debug']('UpdateMailInteraction',_0xcfe04c,JSON[_0xb507('0x24')](_0x46ff83));_0x70c8b5(_0x46ff83);})[_0xb507('0x1a')](function(_0x5f12fa){logger['error'](_0xb507('0x1b'),_0x5f12fa['message'],_0xcfe04c);_0x5a2570(_0x5d8570[_0xb507('0x17')](0x1f4,_0x5f12fa['message']));});});};exports[_0xb507('0x25')]=function(_0x3f1f72){return new Promise(function(_0x7ffa9e,_0xa018bf){return db['MailInteraction']['find']({'where':_0x3f1f72['options']?_0x3f1f72[_0xb507('0x1f')][_0xb507('0x21')]||null:null})[_0xb507('0x11')](function(_0x5ab220){if(_0x5ab220){return _0x5ab220[_0xb507('0x26')](_0x3f1f72['body']['ids'],_[_0xb507('0x27')](_0x3f1f72[_0xb507('0x1e')],[_0xb507('0x28'),'id'])||{});}})[_0xb507('0x29')](function(_0x523cb5){logger['info'](_0xb507('0x2a'),_0x3f1f72);logger['debug'](_0xb507('0x2a'),_0x3f1f72,JSON[_0xb507('0x24')](_0x523cb5));_0x7ffa9e(_0x523cb5);})[_0xb507('0x1a')](function(_0x5be766){logger[_0xb507('0x17')](_0xb507('0x2a'),_0x5be766[_0xb507('0x18')],_0x3f1f72);_0xa018bf(_this[_0xb507('0x17')](0x1f4,_0x5be766[_0xb507('0x18')]));});});}; \ No newline at end of file +var _0x7370=['../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','MailInteraction','body','options','raw','where','attributes','UpdateMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x7370,0x1e2));var _0x0737=function(_0x3c9f45,_0x80b642){_0x3c9f45=_0x3c9f45-0x0;var _0x4b6e1a=_0x7370[_0x3c9f45];return _0x4b6e1a;};'use strict';var _=require(_0x0737('0x0'));var util=require(_0x0737('0x1'));var moment=require(_0x0737('0x2'));var BPromise=require(_0x0737('0x3'));var rs=require(_0x0737('0x4'));var fs=require('fs');var Redis=require(_0x0737('0x5'));var db=require(_0x0737('0x6'))['db'];var utils=require(_0x0737('0x7'));var logger=require(_0x0737('0x8'))(_0x0737('0x9'));var config=require(_0x0737('0xa'));var jayson=require(_0x0737('0xb'));var client=jayson['client'][_0x0737('0xc')]({'port':0x232a});config[_0x0737('0xd')]=_[_0x0737('0xe')](config[_0x0737('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x0737('0xf'))(new Redis(config[_0x0737('0xd')]));require(_0x0737('0x10'))[_0x0737('0x11')](socket);function respondWithRpcPromise(_0x5663f6,_0x4fd951,_0x51c8ce){return new BPromise(function(_0x48e355,_0x2e300a){return client[_0x0737('0x12')](_0x5663f6,_0x51c8ce)[_0x0737('0x13')](function(_0x42585e){logger[_0x0737('0x14')](_0x0737('0x15'),_0x4fd951,_0x0737('0x16'));logger[_0x0737('0x17')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4fd951,'request\x20sent',JSON[_0x0737('0x18')](_0x42585e));if(_0x42585e[_0x0737('0x19')]){if(_0x42585e['error']['code']===0x1f4){logger[_0x0737('0x19')](_0x0737('0x15'),_0x4fd951,_0x42585e[_0x0737('0x19')][_0x0737('0x1a')]);return _0x2e300a(_0x42585e[_0x0737('0x19')][_0x0737('0x1a')]);}logger[_0x0737('0x19')](_0x0737('0x15'),_0x4fd951,_0x42585e[_0x0737('0x19')][_0x0737('0x1a')]);return _0x48e355(_0x42585e['error'][_0x0737('0x1a')]);}else{logger[_0x0737('0x14')](_0x0737('0x15'),_0x4fd951,_0x0737('0x16'));_0x48e355(_0x42585e[_0x0737('0x1b')]['message']);}})[_0x0737('0x1c')](function(_0x4d7296){logger[_0x0737('0x19')](_0x0737('0x15'),_0x4fd951,_0x4d7296);_0x2e300a(_0x4d7296);});});}exports['UpdateMailInteraction']=function(_0x2457cc){var _0x34093c=this;return new Promise(function(_0x315530,_0x2251e0){return db[_0x0737('0x1d')]['update'](_0x2457cc[_0x0737('0x1e')],{'raw':_0x2457cc['options']?_0x2457cc[_0x0737('0x1f')][_0x0737('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2457cc[_0x0737('0x1f')]?_0x2457cc['options'][_0x0737('0x21')]||null:null,'attributes':_0x2457cc[_0x0737('0x1f')]?_0x2457cc[_0x0737('0x1f')][_0x0737('0x22')]||null:null,'limit':_0x2457cc['options']?_0x2457cc[_0x0737('0x1f')]['limit']||null:null})[_0x0737('0x13')](function(_0x5d46e5){logger[_0x0737('0x14')](_0x0737('0x23'),_0x2457cc);logger[_0x0737('0x17')](_0x0737('0x23'),_0x2457cc,JSON[_0x0737('0x18')](_0x5d46e5));_0x315530(_0x5d46e5);})[_0x0737('0x1c')](function(_0x3ccffc){logger[_0x0737('0x19')](_0x0737('0x23'),_0x3ccffc[_0x0737('0x1a')],_0x2457cc);_0x2251e0(_0x34093c[_0x0737('0x19')](0x1f4,_0x3ccffc['message']));});});};exports['AddTagsToMailInteraction']=function(_0x555cc7){return new Promise(function(_0x4f72c5,_0x161856){return db['MailInteraction'][_0x0737('0x24')]({'where':_0x555cc7[_0x0737('0x1f')]?_0x555cc7['options']['where']||null:null})[_0x0737('0x13')](function(_0x118afb){if(_0x118afb){return _0x118afb[_0x0737('0x25')](_0x555cc7['body'][_0x0737('0x26')],_[_0x0737('0x27')](_0x555cc7['body'],['ids','id'])||{});}})['spread'](function(_0x2d0efb){logger[_0x0737('0x14')](_0x0737('0x28'),_0x555cc7);logger[_0x0737('0x17')]('AddTags',_0x555cc7,JSON[_0x0737('0x18')](_0x2d0efb));_0x4f72c5(_0x2d0efb);})[_0x0737('0x1c')](function(_0x1894dc){logger[_0x0737('0x19')]('AddTags',_0x1894dc['message'],_0x555cc7);_0x161856(_this[_0x0737('0x19')](0x1f4,_0x1894dc[_0x0737('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0ad0092..4d98def 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 _0xf58b=['mailInteraction:','./mailInteraction.events','save','update','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf58b,0x9b));var _0xbf58=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0xf58b[_0x4ada50];return _0x3d85d5;};'use strict';var MailInteractionEvents=require(_0xbf58('0x0'));var events=[_0xbf58('0x1'),'remove',_0xbf58('0x2')];function createListener(_0x9325e1,_0x58d4fe){return function(_0x4d1a5a){_0x58d4fe['emit'](_0x9325e1,_0x4d1a5a);};}function removeListener(_0x1cfd6a,_0x2f7437){return function(){MailInteractionEvents[_0xbf58('0x3')](_0x1cfd6a,_0x2f7437);};}exports[_0xbf58('0x4')]=function(_0x746b68){for(var _0x252b7a=0x0,_0x35f2a5=events[_0xbf58('0x5')];_0x252b7a<_0x35f2a5;_0x252b7a++){var _0x14a20d=events[_0x252b7a];var _0x14b6a7=createListener(_0xbf58('0x6')+_0x14a20d,_0x746b68);MailInteractionEvents['on'](_0x14a20d,_0x14b6a7);}}; \ No newline at end of file +var _0x09c4=['register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x541095,_0x582b30){var _0x5a2c40=function(_0xb7650f){while(--_0xb7650f){_0x541095['push'](_0x541095['shift']());}};_0x5a2c40(++_0x582b30);}(_0x09c4,0x123));var _0x409c=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x09c4[_0x2e913b];return _0x173899;};'use strict';var MailInteractionEvents=require(_0x409c('0x0'));var events=[_0x409c('0x1'),_0x409c('0x2'),_0x409c('0x3')];function createListener(_0x115f74,_0x57387e){return function(_0x394ae9){_0x57387e[_0x409c('0x4')](_0x115f74,_0x394ae9);};}function removeListener(_0x1e6462,_0x4c402f){return function(){MailInteractionEvents['removeListener'](_0x1e6462,_0x4c402f);};}exports[_0x409c('0x5')]=function(_0x187037){for(var _0x23e763=0x0,_0x3ef4d1=events[_0x409c('0x6')];_0x23e763<_0x3ef4d1;_0x23e763++){var _0x1ad6a3=events[_0x23e763];var _0x2a2feb=createListener(_0x409c('0x7')+_0x1ad6a3,_0x187037);MailInteractionEvents['on'](_0x1ad6a3,_0x2a2feb);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7944ca1..7e01e35 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 _0x18a9=['/:id/accept','accept','/:id/reject','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id','update'];(function(_0x5d1db0,_0x49c393){var _0x1f0d24=function(_0x48215d){while(--_0x48215d){_0x5d1db0['push'](_0x5d1db0['shift']());}};_0x1f0d24(++_0x49c393);}(_0x18a9,0x17e));var _0x918a=function(_0x6b594e,_0x271521){_0x6b594e=_0x6b594e-0x0;var _0x5d19a6=_0x18a9[_0x6b594e];return _0x5d19a6;};'use strict';var multer=require(_0x918a('0x0'));var util=require('util');var path=require(_0x918a('0x1'));var timeout=require('connect-timeout');var express=require(_0x918a('0x2'));var router=express[_0x918a('0x3')]();var fs_extra=require(_0x918a('0x4'));var auth=require(_0x918a('0x5'));var interaction=require(_0x918a('0x6'));var config=require(_0x918a('0x7'));var controller=require(_0x918a('0x8'));router[_0x918a('0x9')]('/',auth[_0x918a('0xa')](),controller[_0x918a('0xb')]);router['get'](_0x918a('0xc'),auth['isAuthenticated'](),controller[_0x918a('0xd')]);router[_0x918a('0x9')]('/:id',auth[_0x918a('0xa')](),controller['show']);router[_0x918a('0x9')](_0x918a('0xe'),auth[_0x918a('0xa')](),controller[_0x918a('0xf')]);router[_0x918a('0x10')]('/',auth['isAuthenticated'](),interaction[_0x918a('0x11')](_0x918a('0x12'),_0x918a('0x13')),controller[_0x918a('0x14')]);router['put'](_0x918a('0x15'),auth[_0x918a('0xa')](),controller[_0x918a('0x16')]);router['put'](_0x918a('0x17'),auth[_0x918a('0xa')](),controller[_0x918a('0x18')]);router['put'](_0x918a('0x19'),auth[_0x918a('0xa')](),controller['reject']);router['delete'](_0x918a('0x15'),auth[_0x918a('0xa')](),controller[_0x918a('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xdafb=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','mail','create','put','/:id','update','/:id/accept','delete','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xdafb,0x1a9));var _0xbdaf=function(_0x145eb8,_0x188471){_0x145eb8=_0x145eb8-0x0;var _0x5f57b9=_0xdafb[_0x145eb8];return _0x5f57b9;};'use strict';var multer=require(_0xbdaf('0x0'));var util=require(_0xbdaf('0x1'));var path=require(_0xbdaf('0x2'));var timeout=require(_0xbdaf('0x3'));var express=require(_0xbdaf('0x4'));var router=express[_0xbdaf('0x5')]();var fs_extra=require(_0xbdaf('0x6'));var auth=require(_0xbdaf('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xbdaf('0x8')]('/',auth[_0xbdaf('0x9')](),controller[_0xbdaf('0xa')]);router[_0xbdaf('0x8')](_0xbdaf('0xb'),auth[_0xbdaf('0x9')](),controller[_0xbdaf('0xc')]);router[_0xbdaf('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbdaf('0xd')]);router[_0xbdaf('0x8')](_0xbdaf('0xe'),auth[_0xbdaf('0x9')](),controller[_0xbdaf('0xf')]);router[_0xbdaf('0x10')]('/',auth[_0xbdaf('0x9')](),interaction['tracked'](_0xbdaf('0x11'),'mailmessage:create'),controller[_0xbdaf('0x12')]);router[_0xbdaf('0x13')](_0xbdaf('0x14'),auth[_0xbdaf('0x9')](),controller[_0xbdaf('0x15')]);router[_0xbdaf('0x13')](_0xbdaf('0x16'),auth[_0xbdaf('0x9')](),controller['accept']);router[_0xbdaf('0x13')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0xbdaf('0x17')](_0xbdaf('0x14'),auth[_0xbdaf('0x9')](),controller['destroy']);module[_0xbdaf('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 16c9494..104a72d 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 _0x2337=['long','medium','out','STRING','DATE','INTEGER','BOOLEAN','ENUM','Email','Chat','lodash','exports','TEXT'];(function(_0x5b2a5e,_0x5858d1){var _0x340630=function(_0x3cfe19){while(--_0x3cfe19){_0x5b2a5e['push'](_0x5b2a5e['shift']());}};_0x340630(++_0x5858d1);}(_0x2337,0x8c));var _0x7233=function(_0x1323e7,_0x3eebfe){_0x1323e7=_0x1323e7-0x0;var _0x1486dd=_0x2337[_0x1323e7];return _0x1486dd;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7233('0x0'));module[_0x7233('0x1')]={'body':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7233('0x5')),'defaultValue':_0x7233('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x7233('0x6')]},'to':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'cc':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'bcc':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'subject':{'type':Sequelize[_0x7233('0x2')]},'sentAt':{'type':Sequelize[_0x7233('0x7')]},'attach':{'type':Sequelize[_0x7233('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7233('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7233('0x7')]},'originTo':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'originCc':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'originChannel':{'type':Sequelize[_0x7233('0xa')](_0x7233('0xb'),_0x7233('0xc')),'defaultValue':_0x7233('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x113b=['lodash','exports','TEXT','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat','sequelize'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x113b,0x67));var _0xb113=function(_0x4e44d9,_0x22e063){_0x4e44d9=_0x4e44d9-0x0;var _0x2d6e3a=_0x113b[_0x4e44d9];return _0x2d6e3a;};'use strict';var Sequelize=require(_0xb113('0x0'));var _=require(_0xb113('0x1'));module[_0xb113('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb113('0x3')]('medium')},'read':{'type':Sequelize[_0xb113('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb113('0x5')]('in',_0xb113('0x6')),'defaultValue':_0xb113('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb113('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xb113('0x3')](_0xb113('0x8'))},'cc':{'type':Sequelize[_0xb113('0x3')](_0xb113('0x8'))},'bcc':{'type':Sequelize['TEXT'](_0xb113('0x8'))},'subject':{'type':Sequelize[_0xb113('0x3')]},'sentAt':{'type':Sequelize[_0xb113('0x9')]},'attach':{'type':Sequelize[_0xb113('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb113('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb113('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xb113('0x8'))},'originCc':{'type':Sequelize[_0xb113('0x3')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0xb113('0xb'),_0xb113('0xc')),'defaultValue':_0xb113('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index ca7e09b..7bd1d25 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 _0x3ca6=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','length','body','find','describe','create','direction','out','split','MailAccount','findOne','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','host','port','secure','authentication','auth','user','pass','service','attachments','join','root','server/files/attachments','CmContact','defaults','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','interface','rejectmessage','download','unix','tmp','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','writeFileSync','eml-format','moment','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','model','keys','query','intersection'];(function(_0x27c399,_0x55e6ea){var _0x2860eb=function(_0x31480e){while(--_0x31480e){_0x27c399['push'](_0x27c399['shift']());}};_0x2860eb(++_0x55e6ea);}(_0x3ca6,0x1c0));var _0x63ca=function(_0x32d02d,_0x2c0158){_0x32d02d=_0x32d02d-0x0;var _0x36a9c8=_0x3ca6[_0x32d02d];return _0x36a9c8;};'use strict';var emlformat=require(_0x63ca('0x0'));var moment=require(_0x63ca('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x63ca('0x2'));var fs=require('fs');var _=require(_0x63ca('0x3'));var Redis=require(_0x63ca('0x4'));var htmlToText=require('html-to-text');var qs=require(_0x63ca('0x5'));var logger=require(_0x63ca('0x6'))('api');var interaction_log=require(_0x63ca('0x6'))(_0x63ca('0x7'));var config=require(_0x63ca('0x8'));var db=require(_0x63ca('0x9'))['db'];config['redis']=_['defaults'](config[_0x63ca('0xa')],{'host':_0x63ca('0xb'),'port':0x18eb});var socket=require(_0x63ca('0xc'))(new Redis(config[_0x63ca('0xa')]));var htmlEntities=require(_0x63ca('0xd'));require(_0x63ca('0xe'))['register'](socket);var jayson=require(_0x63ca('0xf'));var client=jayson[_0x63ca('0x10')][_0x63ca('0x11')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x63ca('0x10')][_0x63ca('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4253c5,_0x162731,_0x1c551d,_0x560810){return new BPromise(function(_0x1599d4,_0x3e5360){var _0x2193f1=_0x560810||client;return _0x2193f1[_0x63ca('0x12')](_0x4253c5,_0x1c551d)[_0x63ca('0x13')](function(_0x2fc441){logger[_0x63ca('0x14')](_0x63ca('0x15'),_0x162731,_0x63ca('0x16'));logger['debug'](_0x63ca('0x17'),_0x162731,_0x63ca('0x16'),JSON['stringify'](_0x2fc441));if(_0x2fc441[_0x63ca('0x18')]){if(_0x2fc441['error'][_0x63ca('0x19')]===0x1f4){logger[_0x63ca('0x18')](_0x63ca('0x15'),_0x162731,_0x2fc441[_0x63ca('0x18')][_0x63ca('0x1a')]);return _0x3e5360(_0x2fc441[_0x63ca('0x18')][_0x63ca('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x162731,_0x2fc441[_0x63ca('0x18')][_0x63ca('0x1a')]);return _0x1599d4(_0x2fc441[_0x63ca('0x18')]['message']);}else{logger[_0x63ca('0x14')](_0x63ca('0x15'),_0x162731,_0x63ca('0x16'));_0x1599d4(_0x2fc441[_0x63ca('0x1b')][_0x63ca('0x1a')]);}})[_0x63ca('0x1c')](function(_0x473d59){logger[_0x63ca('0x18')](_0x63ca('0x15'),_0x162731,_0x473d59);_0x3e5360(_0x473d59);});});}function respondWithResult(_0x19b34a,_0x26f1c0){_0x26f1c0=_0x26f1c0||0xc8;return function(_0x4a2c29){if(_0x4a2c29){return _0x19b34a[_0x63ca('0x1d')](_0x26f1c0)[_0x63ca('0x1e')](_0x4a2c29);}};}function respondWithFilteredResult(_0x349acf,_0x1f7198){return function(_0x100f02){if(_0x100f02){var _0x247178=typeof _0x1f7198['offset']===_0x63ca('0x1f')&&typeof _0x1f7198['limit']==='undefined';var _0x23f43d=_0x100f02[_0x63ca('0x20')];var _0x5e65be=_0x247178?0x0:_0x1f7198['offset'];var _0x5ca896=_0x247178?_0x100f02[_0x63ca('0x20')]:_0x1f7198[_0x63ca('0x21')]+_0x1f7198[_0x63ca('0x22')];var _0x5d9ea5;if(_0x5ca896>=_0x23f43d){_0x5ca896=_0x23f43d;_0x5d9ea5=0xc8;}else{_0x5d9ea5=0xce;}_0x349acf[_0x63ca('0x1d')](_0x5d9ea5);return _0x349acf[_0x63ca('0x23')](_0x63ca('0x24'),_0x5e65be+'-'+_0x5ca896+'/'+_0x23f43d)[_0x63ca('0x1e')](_0x100f02);}return null;};}function saveUpdates(_0x1a8041){return function(_0x9809f0){if(_0x9809f0){return _0x9809f0[_0x63ca('0x25')](_0x1a8041)[_0x63ca('0x13')](function(_0x1e64e8){return _0x1e64e8;});}return null;};}function removeEntity(_0xf5b388){return function(_0x5bd1d2){if(_0x5bd1d2){return _0x5bd1d2[_0x63ca('0x26')]()[_0x63ca('0x13')](function(){_0xf5b388['status'](0xcc)[_0x63ca('0x27')]();});}};}function handleEntityNotFound(_0x2cf92c){return function(_0x5eb83c){if(!_0x5eb83c){_0x2cf92c[_0x63ca('0x28')](0x194);}return _0x5eb83c;};}function handleError(_0x5697cd,_0x75fd50){_0x75fd50=_0x75fd50||0x1f4;return function(_0x3c1476){logger[_0x63ca('0x18')](_0x3c1476[_0x63ca('0x29')]);if(_0x3c1476[_0x63ca('0x2a')]){delete _0x3c1476[_0x63ca('0x2a')];}_0x5697cd[_0x63ca('0x1d')](_0x75fd50)[_0x63ca('0x2b')](_0x3c1476);};}exports[_0x63ca('0x2c')]=function(_0x1562d0,_0x32a5ca){var _0x5c55c4={},_0x13a776={},_0x1f4601={'count':0x0,'rows':[]};var _0x1dc350=_[_0x63ca('0x2d')](db[_0x63ca('0x2e')]['rawAttributes'],function(_0x12f8b2){return{'name':_0x12f8b2[_0x63ca('0x2f')],'type':_0x12f8b2[_0x63ca('0x30')]['key']};});_0x13a776[_0x63ca('0x31')]=_[_0x63ca('0x2d')](_0x1dc350,_0x63ca('0x2a'));_0x13a776['query']=_[_0x63ca('0x32')](_0x1562d0[_0x63ca('0x33')]);_0x13a776['filters']=_[_0x63ca('0x34')](_0x13a776[_0x63ca('0x31')],_0x13a776[_0x63ca('0x33')]);_0x5c55c4[_0x63ca('0x35')]=_[_0x63ca('0x34')](_0x13a776[_0x63ca('0x31')],qs[_0x63ca('0x36')](_0x1562d0[_0x63ca('0x33')][_0x63ca('0x36')]));_0x5c55c4[_0x63ca('0x35')]=_0x5c55c4[_0x63ca('0x35')]['length']?_0x5c55c4[_0x63ca('0x35')]:_0x13a776['model'];if(!_0x1562d0[_0x63ca('0x33')][_0x63ca('0x37')](_0x63ca('0x38'))){_0x5c55c4[_0x63ca('0x22')]=qs[_0x63ca('0x22')](_0x1562d0[_0x63ca('0x33')][_0x63ca('0x22')]);_0x5c55c4[_0x63ca('0x21')]=qs['offset'](_0x1562d0[_0x63ca('0x33')][_0x63ca('0x21')]);}_0x5c55c4[_0x63ca('0x39')]=qs[_0x63ca('0x3a')](_0x1562d0['query'][_0x63ca('0x3a')]);_0x5c55c4[_0x63ca('0x3b')]=qs[_0x63ca('0x3c')](_[_0x63ca('0x3d')](_0x1562d0[_0x63ca('0x33')],_0x13a776[_0x63ca('0x3c')]),_0x1dc350);if(_0x1562d0['query'][_0x63ca('0x3e')]){_0x5c55c4[_0x63ca('0x3b')]=_[_0x63ca('0x3f')](_0x5c55c4[_0x63ca('0x3b')],{'$or':_[_0x63ca('0x2d')](_0x1dc350,function(_0x3c0309){if(_0x3c0309[_0x63ca('0x30')]!==_0x63ca('0x40')){var _0x329d6e={};_0x329d6e[_0x3c0309[_0x63ca('0x2a')]]={'$like':'%'+_0x1562d0['query'][_0x63ca('0x3e')]+'%'};return _0x329d6e;}})});}_0x5c55c4=_[_0x63ca('0x3f')]({},_0x5c55c4,_0x1562d0[_0x63ca('0x41')]);var _0x4cc35f={'where':_0x5c55c4[_0x63ca('0x3b')]};return db[_0x63ca('0x2e')][_0x63ca('0x20')](_0x4cc35f)[_0x63ca('0x13')](function(_0x2b1464){_0x1f4601[_0x63ca('0x20')]=_0x2b1464;if(_0x1562d0[_0x63ca('0x33')][_0x63ca('0x42')]){_0x5c55c4['include']=[{'all':!![]}];}return db[_0x63ca('0x2e')][_0x63ca('0x43')](_0x5c55c4);})[_0x63ca('0x13')](function(_0x529429){_0x1f4601[_0x63ca('0x44')]=_0x529429;return _0x1f4601;})['then'](respondWithFilteredResult(_0x32a5ca,_0x5c55c4))[_0x63ca('0x1c')](handleError(_0x32a5ca,null));};exports[_0x63ca('0x45')]=function(_0x21bea8,_0x869771){var _0x2d0927={'raw':!![],'where':{'id':_0x21bea8[_0x63ca('0x46')]['id']}},_0xa6a481={};_0xa6a481[_0x63ca('0x31')]=_[_0x63ca('0x32')](db['MailMessage'][_0x63ca('0x47')]);_0xa6a481[_0x63ca('0x33')]=_[_0x63ca('0x32')](_0x21bea8[_0x63ca('0x33')]);_0xa6a481[_0x63ca('0x3c')]=_[_0x63ca('0x34')](_0xa6a481['model'],_0xa6a481['query']);_0x2d0927['attributes']=_[_0x63ca('0x34')](_0xa6a481['model'],qs[_0x63ca('0x36')](_0x21bea8[_0x63ca('0x33')]['fields']));_0x2d0927[_0x63ca('0x35')]=_0x2d0927[_0x63ca('0x35')][_0x63ca('0x48')]?_0x2d0927[_0x63ca('0x35')]:_0xa6a481[_0x63ca('0x31')];if(_0x21bea8[_0x63ca('0x33')][_0x63ca('0x42')]){_0x2d0927['include']=[{'all':!![]}];}_0x2d0927=_[_0x63ca('0x3f')]({},_0x2d0927,_0x21bea8[_0x63ca('0x41')]);return db['MailMessage']['find'](_0x2d0927)[_0x63ca('0x13')](handleEntityNotFound(_0x869771,null))[_0x63ca('0x13')](respondWithResult(_0x869771,null))[_0x63ca('0x1c')](handleError(_0x869771,null));};exports[_0x63ca('0x25')]=function(_0x212a5a,_0x267b42){if(_0x212a5a[_0x63ca('0x49')]['id']){delete _0x212a5a['body']['id'];}return db[_0x63ca('0x2e')][_0x63ca('0x4a')]({'where':{'id':_0x212a5a[_0x63ca('0x46')]['id']}})[_0x63ca('0x13')](handleEntityNotFound(_0x267b42,null))[_0x63ca('0x13')](saveUpdates(_0x212a5a[_0x63ca('0x49')],null))['then'](respondWithResult(_0x267b42,null))[_0x63ca('0x1c')](handleError(_0x267b42,null));};exports['destroy']=function(_0x5b5a72,_0x546297){return db[_0x63ca('0x2e')][_0x63ca('0x4a')]({'where':{'id':_0x5b5a72[_0x63ca('0x46')]['id']}})[_0x63ca('0x13')](handleEntityNotFound(_0x546297,null))[_0x63ca('0x13')](removeEntity(_0x546297,null))['catch'](handleError(_0x546297,null));};exports[_0x63ca('0x4b')]=function(_0x1cf788,_0x1c1791){return db[_0x63ca('0x2e')][_0x63ca('0x4b')]()['then'](respondWithResult(_0x1c1791,null))[_0x63ca('0x1c')](handleError(_0x1c1791,null));};exports[_0x63ca('0x4c')]=function(_0x2d63ca,_0x486343){return db[_0x63ca('0x2e')][_0x63ca('0x4c')](_0x2d63ca['body'])[_0x63ca('0x13')](function(_0x5ed8ab){if(_0x5ed8ab){if(_0x5ed8ab[_0x63ca('0x4d')]===_0x63ca('0x4e')&&!_0x5ed8ab['secret']){var _0xbb74f1,_0x5ee622,_0x466704;if(_0x2d63ca[_0x63ca('0x49')]['to']){_0x5ee622=_0x2d63ca[_0x63ca('0x49')]['to'][_0x63ca('0x4f')](',')[0x0];}return db[_0x63ca('0x50')][_0x63ca('0x51')]({'where':{'id':_0x5ed8ab['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x63ca('0x52'),'include':[{'model':db['CmContact'],'as':_0x63ca('0x53'),'where':{'email':_0x5ee622},'limit':0x1,'order':[[_0x63ca('0x54'),_0x63ca('0x55')]]}]},{'model':db[_0x63ca('0x56')],'as':_0x63ca('0x57'),'raw':!![]}]})[_0x63ca('0x13')](function(_0x23f2ff){_0xbb74f1=_0x23f2ff;if(_0xbb74f1&&_0xbb74f1[_0x63ca('0x57')]){var _0x91fa1d={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0xbb74f1[_0x63ca('0x57')]['service'])){_0x91fa1d['host']=_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x58')];_0x91fa1d[_0x63ca('0x59')]=_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x59')];_0x91fa1d[_0x63ca('0x5a')]=_0xbb74f1['Smtp']['secure'];if(_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x5b')]){_0x91fa1d[_0x63ca('0x5c')]={'user':_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x5d')],'pass':_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x5e')]};}}else{_0x91fa1d[_0x63ca('0x5f')]=_0xbb74f1['Smtp'][_0x63ca('0x5f')];_0x91fa1d[_0x63ca('0x5c')]={'user':_0xbb74f1['Smtp'][_0x63ca('0x5d')],'pass':_0xbb74f1[_0x63ca('0x57')]['pass']};_0x91fa1d[_0x63ca('0x5a')]=_0xbb74f1[_0x63ca('0x57')]['secure'];}if(_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')]&&_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')][_0x63ca('0x48')]){for(var _0x5757bd=0x0;_0x5757bd<_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')]['length'];_0x5757bd+=0x1){_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')][_0x5757bd]={'filename':_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')][_0x5757bd][_0x63ca('0x2a')],'path':path[_0x63ca('0x61')](config[_0x63ca('0x62')],_0x63ca('0x63'),_0x2d63ca[_0x63ca('0x49')]['attachments'][_0x5757bd]['basename'])};}}_0x466704={'account':_0x91fa1d,'message':_0x2d63ca[_0x63ca('0x49')]};return;}})[_0x63ca('0x13')](function(){if(_0xbb74f1[_0x63ca('0x52')]){if(_0xbb74f1['List'][_0x63ca('0x53')][_0x63ca('0x48')]){return _0xbb74f1[_0x63ca('0x52')][_0x63ca('0x53')][0x0];}else{return db[_0x63ca('0x64')]['create'](_[_0x63ca('0x65')](_0x2d63ca[_0x63ca('0x49')],{'firstName':_0x2d63ca[_0x63ca('0x49')]['to'],'email':_0x2d63ca[_0x63ca('0x49')]['to'],'phone':_0x2d63ca[_0x63ca('0x49')]['to'],'ListId':_0xbb74f1[_0x63ca('0x66')]}));}}else{throw new Error(_0x63ca('0x67'));}})[_0x63ca('0x13')](function(){if(_0x466704){return respondWithRpcPromise('SendMail',_0x63ca('0x68'),_0x466704,client9003)[_0x63ca('0x13')](function(_0x391c22){return _0x5ed8ab[_0x63ca('0x25')]({'read':!![],'messageId':_0x391c22['messageId'],'sentAt':moment()[_0x63ca('0x69')](_0x63ca('0x6a'))});})['catch'](function(_0x517050){logger[_0x63ca('0x18')]('%s',JSON[_0x63ca('0x6b')](_0x517050));return _0x5ed8ab;});}return _0x5ed8ab;});}return _0x5ed8ab;}})[_0x63ca('0x13')](respondWithResult(_0x486343,0xc9))[_0x63ca('0x1c')](handleError(_0x486343,null));};exports[_0x63ca('0x6c')]=function(_0x26e159,_0x46153d){var _0x3c5154={'agent':{},'channel':_0x63ca('0x6d')};if(_0x26e159[_0x63ca('0x49')]['id']){delete _0x26e159[_0x63ca('0x49')]['id'];}_0x26e159['body'][_0x63ca('0x6e')]=!![];_0x26e159['body'][_0x63ca('0x6f')]=moment()[_0x63ca('0x69')](_0x63ca('0x6a'));_0x26e159[_0x63ca('0x49')]['UserId']=_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')]||_0x26e159[_0x63ca('0x5d')]['id'];_0x3c5154[_0x63ca('0x71')]['id']=_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')];return db['MailMessage'][_0x63ca('0x4a')]({'where':{'id':_0x26e159[_0x63ca('0x46')]['id'],'UserId':null}})[_0x63ca('0x13')](handleEntityNotFound(_0x46153d,null))[_0x63ca('0x13')](saveUpdates(_0x26e159['body'],null))[_0x63ca('0x13')](function(_0xa407ca){if(_0xa407ca){_0x3c5154[_0x63ca('0x1a')]=_0xa407ca[_0x63ca('0x72')]({'plain':!![]});return db[_0x63ca('0x73')][_0x63ca('0x4a')]({'where':{'id':_0xa407ca[_0x63ca('0x74')]}});}return null;})['then'](handleEntityNotFound(_0x46153d,null))[_0x63ca('0x13')](function(_0x39594b){if(_0x39594b){return _0x39594b['update']({'UserId':_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')],'read1stAt':_[_0x63ca('0x75')](_0x39594b[_0x63ca('0x76')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x63ca('0x13')](function(_0x5787a2){if(_0x5787a2){_0x3c5154[_0x63ca('0x77')]=_0x5787a2['get']({'plain':!![]});interaction_log['info'](_0x63ca('0x78'),_0x26e159[_0x63ca('0x5d')]['id'],_0x26e159[_0x63ca('0x5d')]['name'],_0x26e159[_0x63ca('0x5d')][_0x63ca('0x79')],_0x3c5154['interaction']['id'],_0x26e159['body']?JSON[_0x63ca('0x6b')](_0x26e159[_0x63ca('0x49')]):_0x63ca('0x7a'));return respondWithRpcPromise(_0x63ca('0x7b'),_0x63ca('0x7c'),_0x3c5154);}return null;})[_0x63ca('0x13')](function(_0x528957){var _0x59152f=_0x63ca('0x7d')+_0x528957[_0x63ca('0x1a')][_0x63ca('0x7e')];return db['sequelize']['query'](_0x59152f,{'type':db[_0x63ca('0x7f')][_0x63ca('0x80')][_0x63ca('0x81')],'raw':!![]})[_0x63ca('0x13')](function(_0x48afaf){return _0x48afaf;});})[_0x63ca('0x13')](function(_0x5bfe3a){if(_0x5bfe3a){_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x82')]=_0x5bfe3a[0x0];if(!_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')])return;return db[_0x63ca('0x83')][_0x63ca('0x4a')]({'where':{'id':_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')],'role':'agent'},'attributes':['id',_0x63ca('0x2a'),_0x63ca('0x84'),_0x63ca('0x85'),_0x63ca('0x86')],'raw':!![]});}return null;})[_0x63ca('0x13')](function(_0x29cad3){if(!_0x29cad3)return null;_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x71')]=_0x29cad3;return _0x3c5154;})[_0x63ca('0x13')](function(_0x43c220){if(_0x43c220){if(_0x26e159['body']['manual']){_0x3c5154[_0x63ca('0x1a')]['interface']=util[_0x63ca('0x69')](_0x63ca('0x87'),_0x26e159[_0x63ca('0x5d')][_0x63ca('0x2a')]);_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x88')]=_0x3c5154['channel'];_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x89')]=_0x3c5154[_0x63ca('0x88')];_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x8a')]=_0x63ca('0x6c');_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x49')]=htmlToText[_0x63ca('0x8b')](_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x49')]);return respondWithRpcPromise('EventManager',_0x63ca('0x8c'),{'event':'acceptmessage','message':_0x3c5154['message']},client9002)[_0x63ca('0x13')](function(){return _0x3c5154;});}return _0x3c5154;}return null;})[_0x63ca('0x13')](respondWithResult(_0x46153d,null))[_0x63ca('0x1c')](handleError(_0x46153d,null));};exports[_0x63ca('0x8d')]=function(_0x353156,_0x16a567){var _0x5cbd4f={'agent':{},'channel':'mail'};if(_0x353156['body']['id']){delete _0x353156[_0x63ca('0x49')]['id'];}_0x353156[_0x63ca('0x49')]['UserId']=_0x353156[_0x63ca('0x49')][_0x63ca('0x70')]||_0x353156[_0x63ca('0x5d')]['id'];_0x5cbd4f['agent']['id']=_0x353156[_0x63ca('0x49')][_0x63ca('0x70')];return db[_0x63ca('0x2e')]['find']({'where':{'id':_0x353156[_0x63ca('0x46')]['id'],'UserId':null}})[_0x63ca('0x13')](handleEntityNotFound(_0x16a567,null))['then'](function(_0x11d6ed){if(_0x11d6ed){_0x5cbd4f[_0x63ca('0x1a')]=_0x11d6ed[_0x63ca('0x72')]({'plain':!![]});return db['MailInteraction'][_0x63ca('0x4a')]({'where':{'id':_0x11d6ed[_0x63ca('0x74')]}});}return null;})['then'](handleEntityNotFound(_0x16a567,null))['then'](function(_0x21ffc5){if(_0x21ffc5){_0x5cbd4f[_0x63ca('0x77')]=_0x21ffc5[_0x63ca('0x72')]({'plain':!![]});interaction_log['info'](_0x63ca('0x8e'),_0x353156[_0x63ca('0x5d')]['id'],_0x353156[_0x63ca('0x5d')][_0x63ca('0x2a')],_0x353156[_0x63ca('0x5d')]['role'],_0x5cbd4f[_0x63ca('0x77')]['id'],_0x353156[_0x63ca('0x49')]?JSON[_0x63ca('0x6b')](_0x353156[_0x63ca('0x49')]):_0x63ca('0x7a'));return respondWithRpcPromise('RejectMessage',_0x63ca('0x8f'),_0x5cbd4f);}return null;})[_0x63ca('0x13')](function(_0xa3a72f){var _0x1211e1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa3a72f[_0x63ca('0x1a')][_0x63ca('0x7e')];return db[_0x63ca('0x90')][_0x63ca('0x33')](_0x1211e1,{'type':db['Sequelize'][_0x63ca('0x80')][_0x63ca('0x81')],'raw':!![]})[_0x63ca('0x13')](function(_0x12ab84){return _0x12ab84;});})[_0x63ca('0x13')](function(_0x2ac293){if(_0x2ac293){_0x5cbd4f[_0x63ca('0x1a')][_0x63ca('0x82')]=_0x2ac293[0x0];if(!_0x353156['body'][_0x63ca('0x70')])return;return db[_0x63ca('0x83')][_0x63ca('0x4a')]({'where':{'id':_0x353156[_0x63ca('0x49')]['UserId'],'role':'agent'},'attributes':['id',_0x63ca('0x2a'),_0x63ca('0x84'),'email',_0x63ca('0x86')],'raw':!![]});}return null;})[_0x63ca('0x13')](function(_0x20035a){if(!_0x20035a)return null;_0x5cbd4f['message'][_0x63ca('0x71')]=_0x20035a;return _0x5cbd4f;})['then'](function(_0x1f8efe){if(_0x1f8efe){_0x1f8efe[_0x63ca('0x1a')][_0x63ca('0x91')]=util[_0x63ca('0x69')]('SIP/%s',_0x353156[_0x63ca('0x5d')][_0x63ca('0x2a')]);_0x1f8efe[_0x63ca('0x1a')][_0x63ca('0x88')]=_0x5cbd4f[_0x63ca('0x88')];_0x1f8efe['message'][_0x63ca('0x89')]=_0x5cbd4f[_0x63ca('0x88')];_0x1f8efe[_0x63ca('0x1a')][_0x63ca('0x8a')]=_0x63ca('0x8d');_0x1f8efe[_0x63ca('0x1a')][_0x63ca('0x49')]=htmlToText['fromString'](_0x5cbd4f[_0x63ca('0x1a')]['body']);respondWithRpcPromise(_0x63ca('0x8c'),_0x63ca('0x8c'),{'event':_0x63ca('0x92'),'message':_0x1f8efe['message']},client9002);return _0x5cbd4f;}return null;})[_0x63ca('0x13')](respondWithResult(_0x16a567,null))[_0x63ca('0x1c')](handleError(_0x16a567,null));};exports[_0x63ca('0x93')]=function(_0x26843d,_0x56a0bc){var _0x5980e0=moment()[_0x63ca('0x94')]()['toString']();var _0x5840d2=path[_0x63ca('0x61')](config['root'],'server','files',_0x63ca('0x95'));var _0xbccce2=path[_0x63ca('0x61')](config['root'],_0x63ca('0x96'),_0x63ca('0x97'),_0x63ca('0x60'));var _0x1abb89=util[_0x63ca('0x69')](_0x63ca('0x98'),_0x5980e0);return db['MailMessage'][_0x63ca('0x4a')]({'where':{'id':_0x26843d['params']['id']},'attributes':['id',_0x63ca('0x49'),_0x63ca('0x99'),'to','cc',_0x63ca('0x9a'),_0x63ca('0x9b'),_0x63ca('0x9c')],'include':_0x26843d[_0x63ca('0x33')][_0x63ca('0x60')]?[{'model':db[_0x63ca('0x9d')],'as':_0x63ca('0x9e')}]:undefined})[_0x63ca('0x13')](handleEntityNotFound(_0x56a0bc,null))[_0x63ca('0x13')](function(_0x1b611f){if(_0x1b611f){var _0x5bd6ef=_0x1b611f;var _0xe577c9={'from':_0x5bd6ef['from'],'to':_0x5bd6ef['to'],'subject':_0x5bd6ef['subject'],'html':htmlEntities[_0x63ca('0x9f')](_0x5bd6ef[_0x63ca('0x49')]),'headers':{'Date':moment(_0x5bd6ef['createdAt'])[_0x63ca('0x69')](_0x63ca('0xa0'))},'attachments':[]};if(_0x1b611f['cc']){_0xe577c9[_0x63ca('0xa1')]['Cc']=_0x1b611f['cc'];}if(_0x1b611f[_0x63ca('0x9a')]){_0xe577c9[_0x63ca('0xa1')][_0x63ca('0xa2')]=_0x1b611f[_0x63ca('0x9a')];}return new BPromise(function(_0x1f0ba0,_0x47b34e){if(_0x1b611f[_0x63ca('0x9e')]){for(var _0x3050aa=0x0;_0x3050aa<_0x1b611f[_0x63ca('0x9e')][_0x63ca('0x48')];_0x3050aa++){var _0x45a2d6=_0x1b611f['Attachments'][_0x3050aa];var _0x54ba67=path['join'](_0xbccce2,_0x45a2d6[_0x63ca('0xa3')]);if(fs[_0x63ca('0xa4')](_0x54ba67)){_0xe577c9[_0x63ca('0x60')][_0x63ca('0xa5')]({'name':_0x45a2d6['name'],'contentType':_0x45a2d6[_0x63ca('0x30')],'data':fs['readFileSync'](_0x54ba67)});}}}emlformat['build'](_0xe577c9,function(_0x3225f4,_0x1306cf){if(_0x3225f4)return _0x47b34e(_0x3225f4);fs[_0x63ca('0xa6')](path[_0x63ca('0x61')](_0x5840d2,_0x1abb89),_0x1306cf);return _0x1f0ba0(_0x1306cf);});});}})[_0x63ca('0x13')](function(_0x42f565){if(_0x42f565){return _0x56a0bc[_0x63ca('0x93')](path[_0x63ca('0x61')](_0x5840d2,_0x1abb89),_0x1abb89,function(_0x50296b){if(!_0x50296b)fs['unlinkSync'](path[_0x63ca('0x61')](_0x5840d2,_0x1abb89));});}})[_0x63ca('0x1c')](handleError(_0x56a0bc,null));}; \ No newline at end of file +var _0x2b26=['fullname','email','interface','fromString','rejectmessage','unix','root','server','files','tmp','join','message-%s.eml','bcc','Attachment','Attachments','from','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','type','readFileSync','build','download','unlinkSync','eml-format','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','html-entities','register','jayson/promise','client','http','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','status','json','offset','undefined','limit','count','update','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','MailMessage','include','findAll','rows','show','find','body','params','describe','create','out','secret','split','MailAccount','findOne','List','Contacts','DESC','MailServerOut','Smtp','isNil','service','port','secure','authentication','auth','user','pass','attachments','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','format','accept','mail','read','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','QueryTypes','SELECT'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x2b26,0x15b));var _0x62b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b26[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x62b2('0x0'));var moment=require('moment');var BPromise=require(_0x62b2('0x1'));var util=require(_0x62b2('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x62b2('0x3'));var Redis=require(_0x62b2('0x4'));var htmlToText=require(_0x62b2('0x5'));var qs=require(_0x62b2('0x6'));var logger=require(_0x62b2('0x7'))(_0x62b2('0x8'));var interaction_log=require(_0x62b2('0x7'))(_0x62b2('0x9'));var config=require('../../config/environment');var db=require(_0x62b2('0xa'))['db'];config[_0x62b2('0xb')]=_[_0x62b2('0xc')](config[_0x62b2('0xb')],{'host':_0x62b2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62b2('0xb')]));var htmlEntities=require(_0x62b2('0xe'));require('./mailMessage.socket')[_0x62b2('0xf')](socket);var jayson=require(_0x62b2('0x10'));var client=jayson[_0x62b2('0x11')][_0x62b2('0x12')]({'port':0x232c});var client9003=jayson[_0x62b2('0x11')]['http']({'port':0x232b});var client9002=jayson[_0x62b2('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbd7d2c,_0xd5a1ec,_0x170e69,_0x42c248){return new BPromise(function(_0x47c326,_0x3790b3){var _0x2099c8=_0x42c248||client;return _0x2099c8['request'](_0xbd7d2c,_0x170e69)[_0x62b2('0x13')](function(_0x1f134c){logger['info'](_0x62b2('0x14'),_0xd5a1ec,_0x62b2('0x15'));logger[_0x62b2('0x16')](_0x62b2('0x17'),_0xd5a1ec,_0x62b2('0x15'),JSON[_0x62b2('0x18')](_0x1f134c));if(_0x1f134c['error']){if(_0x1f134c['error'][_0x62b2('0x19')]===0x1f4){logger[_0x62b2('0x1a')](_0x62b2('0x14'),_0xd5a1ec,_0x1f134c[_0x62b2('0x1a')][_0x62b2('0x1b')]);return _0x3790b3(_0x1f134c[_0x62b2('0x1a')][_0x62b2('0x1b')]);}logger[_0x62b2('0x1a')](_0x62b2('0x14'),_0xd5a1ec,_0x1f134c[_0x62b2('0x1a')][_0x62b2('0x1b')]);return _0x47c326(_0x1f134c[_0x62b2('0x1a')][_0x62b2('0x1b')]);}else{logger[_0x62b2('0x1c')](_0x62b2('0x14'),_0xd5a1ec,_0x62b2('0x15'));_0x47c326(_0x1f134c[_0x62b2('0x1d')][_0x62b2('0x1b')]);}})[_0x62b2('0x1e')](function(_0x4cf474){logger['error'](_0x62b2('0x14'),_0xd5a1ec,_0x4cf474);_0x3790b3(_0x4cf474);});});}function respondWithResult(_0x535392,_0x469d42){_0x469d42=_0x469d42||0xc8;return function(_0x1a54d3){if(_0x1a54d3){return _0x535392[_0x62b2('0x1f')](_0x469d42)[_0x62b2('0x20')](_0x1a54d3);}};}function respondWithFilteredResult(_0x55fa6a,_0x4a3f84){return function(_0x15862d){if(_0x15862d){var _0x86c81e=typeof _0x4a3f84[_0x62b2('0x21')]===_0x62b2('0x22')&&typeof _0x4a3f84[_0x62b2('0x23')]===_0x62b2('0x22');var _0xfe3a94=_0x15862d['count'];var _0x3d6427=_0x86c81e?0x0:_0x4a3f84[_0x62b2('0x21')];var _0x4da063=_0x86c81e?_0x15862d[_0x62b2('0x24')]:_0x4a3f84[_0x62b2('0x21')]+_0x4a3f84[_0x62b2('0x23')];var _0x2bed9f;if(_0x4da063>=_0xfe3a94){_0x4da063=_0xfe3a94;_0x2bed9f=0xc8;}else{_0x2bed9f=0xce;}_0x55fa6a[_0x62b2('0x1f')](_0x2bed9f);return _0x55fa6a['set']('Content-Range',_0x3d6427+'-'+_0x4da063+'/'+_0xfe3a94)[_0x62b2('0x20')](_0x15862d);}return null;};}function saveUpdates(_0x57579c){return function(_0x27c33d){if(_0x27c33d){return _0x27c33d[_0x62b2('0x25')](_0x57579c)['then'](function(_0x566735){return _0x566735;});}return null;};}function removeEntity(_0x405d47){return function(_0x188132){if(_0x188132){return _0x188132[_0x62b2('0x26')]()[_0x62b2('0x13')](function(){_0x405d47[_0x62b2('0x1f')](0xcc)[_0x62b2('0x27')]();});}};}function handleEntityNotFound(_0xcda1a0){return function(_0x52c879){if(!_0x52c879){_0xcda1a0[_0x62b2('0x28')](0x194);}return _0x52c879;};}function handleError(_0x495ed7,_0x2e4330){_0x2e4330=_0x2e4330||0x1f4;return function(_0x1deefb){logger['error'](_0x1deefb[_0x62b2('0x29')]);if(_0x1deefb[_0x62b2('0x2a')]){delete _0x1deefb[_0x62b2('0x2a')];}_0x495ed7['status'](_0x2e4330)[_0x62b2('0x2b')](_0x1deefb);};}exports['index']=function(_0x547b41,_0x184128){var _0x4d61bd={},_0x2ea254={},_0x196748={'count':0x0,'rows':[]};var _0x3cd1df=_[_0x62b2('0x2c')](db['MailMessage'][_0x62b2('0x2d')],function(_0x431a0b){return{'name':_0x431a0b[_0x62b2('0x2e')],'type':_0x431a0b['type']['key']};});_0x2ea254['model']=_['map'](_0x3cd1df,_0x62b2('0x2a'));_0x2ea254[_0x62b2('0x2f')]=_[_0x62b2('0x30')](_0x547b41[_0x62b2('0x2f')]);_0x2ea254[_0x62b2('0x31')]=_[_0x62b2('0x32')](_0x2ea254['model'],_0x2ea254[_0x62b2('0x2f')]);_0x4d61bd[_0x62b2('0x33')]=_['intersection'](_0x2ea254[_0x62b2('0x34')],qs['fields'](_0x547b41['query'][_0x62b2('0x35')]));_0x4d61bd[_0x62b2('0x33')]=_0x4d61bd[_0x62b2('0x33')][_0x62b2('0x36')]?_0x4d61bd['attributes']:_0x2ea254[_0x62b2('0x34')];if(!_0x547b41[_0x62b2('0x2f')][_0x62b2('0x37')](_0x62b2('0x38'))){_0x4d61bd[_0x62b2('0x23')]=qs[_0x62b2('0x23')](_0x547b41['query'][_0x62b2('0x23')]);_0x4d61bd[_0x62b2('0x21')]=qs[_0x62b2('0x21')](_0x547b41['query'][_0x62b2('0x21')]);}_0x4d61bd[_0x62b2('0x39')]=qs[_0x62b2('0x3a')](_0x547b41['query'][_0x62b2('0x3a')]);_0x4d61bd[_0x62b2('0x3b')]=qs[_0x62b2('0x31')](_[_0x62b2('0x3c')](_0x547b41[_0x62b2('0x2f')],_0x2ea254[_0x62b2('0x31')]),_0x3cd1df);if(_0x547b41[_0x62b2('0x2f')][_0x62b2('0x3d')]){_0x4d61bd[_0x62b2('0x3b')]=_[_0x62b2('0x3e')](_0x4d61bd[_0x62b2('0x3b')],{'$or':_['map'](_0x3cd1df,function(_0x371ade){if(_0x371ade['type']!=='VIRTUAL'){var _0x54a49c={};_0x54a49c[_0x371ade[_0x62b2('0x2a')]]={'$like':'%'+_0x547b41[_0x62b2('0x2f')][_0x62b2('0x3d')]+'%'};return _0x54a49c;}})});}_0x4d61bd=_[_0x62b2('0x3e')]({},_0x4d61bd,_0x547b41[_0x62b2('0x3f')]);var _0x4d34bd={'where':_0x4d61bd[_0x62b2('0x3b')]};return db[_0x62b2('0x40')][_0x62b2('0x24')](_0x4d34bd)[_0x62b2('0x13')](function(_0x9c89be){_0x196748[_0x62b2('0x24')]=_0x9c89be;if(_0x547b41[_0x62b2('0x2f')]['includeAll']){_0x4d61bd[_0x62b2('0x41')]=[{'all':!![]}];}return db['MailMessage'][_0x62b2('0x42')](_0x4d61bd);})['then'](function(_0x472d75){_0x196748[_0x62b2('0x43')]=_0x472d75;return _0x196748;})['then'](respondWithFilteredResult(_0x184128,_0x4d61bd))[_0x62b2('0x1e')](handleError(_0x184128,null));};exports[_0x62b2('0x44')]=function(_0x51a007,_0x15d54b){var _0x2dcb16={'raw':!![],'where':{'id':_0x51a007['params']['id']}},_0x3e3d5f={};_0x3e3d5f['model']=_['keys'](db[_0x62b2('0x40')][_0x62b2('0x2d')]);_0x3e3d5f[_0x62b2('0x2f')]=_['keys'](_0x51a007[_0x62b2('0x2f')]);_0x3e3d5f['filters']=_['intersection'](_0x3e3d5f[_0x62b2('0x34')],_0x3e3d5f[_0x62b2('0x2f')]);_0x2dcb16['attributes']=_['intersection'](_0x3e3d5f[_0x62b2('0x34')],qs[_0x62b2('0x35')](_0x51a007['query'][_0x62b2('0x35')]));_0x2dcb16[_0x62b2('0x33')]=_0x2dcb16[_0x62b2('0x33')][_0x62b2('0x36')]?_0x2dcb16[_0x62b2('0x33')]:_0x3e3d5f['model'];if(_0x51a007['query']['includeAll']){_0x2dcb16[_0x62b2('0x41')]=[{'all':!![]}];}_0x2dcb16=_[_0x62b2('0x3e')]({},_0x2dcb16,_0x51a007[_0x62b2('0x3f')]);return db[_0x62b2('0x40')][_0x62b2('0x45')](_0x2dcb16)[_0x62b2('0x13')](handleEntityNotFound(_0x15d54b,null))['then'](respondWithResult(_0x15d54b,null))[_0x62b2('0x1e')](handleError(_0x15d54b,null));};exports[_0x62b2('0x25')]=function(_0x1b7477,_0x711e6f){if(_0x1b7477[_0x62b2('0x46')]['id']){delete _0x1b7477[_0x62b2('0x46')]['id'];}return db['MailMessage'][_0x62b2('0x45')]({'where':{'id':_0x1b7477['params']['id']}})[_0x62b2('0x13')](handleEntityNotFound(_0x711e6f,null))['then'](saveUpdates(_0x1b7477[_0x62b2('0x46')],null))[_0x62b2('0x13')](respondWithResult(_0x711e6f,null))['catch'](handleError(_0x711e6f,null));};exports[_0x62b2('0x26')]=function(_0x4f8edc,_0x20edab){return db[_0x62b2('0x40')]['find']({'where':{'id':_0x4f8edc[_0x62b2('0x47')]['id']}})[_0x62b2('0x13')](handleEntityNotFound(_0x20edab,null))[_0x62b2('0x13')](removeEntity(_0x20edab,null))[_0x62b2('0x1e')](handleError(_0x20edab,null));};exports[_0x62b2('0x48')]=function(_0xddb332,_0xd67c71){return db[_0x62b2('0x40')]['describe']()['then'](respondWithResult(_0xd67c71,null))[_0x62b2('0x1e')](handleError(_0xd67c71,null));};exports[_0x62b2('0x49')]=function(_0x4a4020,_0x64f71a){return db[_0x62b2('0x40')][_0x62b2('0x49')](_0x4a4020[_0x62b2('0x46')])[_0x62b2('0x13')](function(_0x81e21a){if(_0x81e21a){if(_0x81e21a['direction']===_0x62b2('0x4a')&&!_0x81e21a[_0x62b2('0x4b')]){var _0x404b06,_0x5bb94f,_0x553aad;if(_0x4a4020[_0x62b2('0x46')]['to']){_0x5bb94f=_0x4a4020[_0x62b2('0x46')]['to'][_0x62b2('0x4c')](',')[0x0];}return db[_0x62b2('0x4d')][_0x62b2('0x4e')]({'where':{'id':_0x81e21a['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x62b2('0x4f'),'include':[{'model':db['CmContact'],'as':_0x62b2('0x50'),'where':{'email':_0x5bb94f},'limit':0x1,'order':[['updatedAt',_0x62b2('0x51')]]}]},{'model':db[_0x62b2('0x52')],'as':_0x62b2('0x53'),'raw':!![]}]})[_0x62b2('0x13')](function(_0x19941d){_0x404b06=_0x19941d;if(_0x404b06&&_0x404b06['Smtp']){var _0x3dfe2d={'tls':{'rejectUnauthorized':![]}};if(_[_0x62b2('0x54')](_0x404b06[_0x62b2('0x53')][_0x62b2('0x55')])){_0x3dfe2d['host']=_0x404b06['Smtp']['host'];_0x3dfe2d[_0x62b2('0x56')]=_0x404b06[_0x62b2('0x53')]['port'];_0x3dfe2d[_0x62b2('0x57')]=_0x404b06[_0x62b2('0x53')][_0x62b2('0x57')];if(_0x404b06[_0x62b2('0x53')][_0x62b2('0x58')]){_0x3dfe2d[_0x62b2('0x59')]={'user':_0x404b06[_0x62b2('0x53')][_0x62b2('0x5a')],'pass':_0x404b06[_0x62b2('0x53')][_0x62b2('0x5b')]};}}else{_0x3dfe2d[_0x62b2('0x55')]=_0x404b06['Smtp'][_0x62b2('0x55')];_0x3dfe2d['auth']={'user':_0x404b06[_0x62b2('0x53')][_0x62b2('0x5a')],'pass':_0x404b06[_0x62b2('0x53')][_0x62b2('0x5b')]};_0x3dfe2d[_0x62b2('0x57')]=_0x404b06[_0x62b2('0x53')][_0x62b2('0x57')];}if(_0x4a4020[_0x62b2('0x46')][_0x62b2('0x5c')]&&_0x4a4020[_0x62b2('0x46')][_0x62b2('0x5c')][_0x62b2('0x36')]){for(var _0xfdc9cb=0x0;_0xfdc9cb<_0x4a4020[_0x62b2('0x46')]['attachments'][_0x62b2('0x36')];_0xfdc9cb+=0x1){_0x4a4020[_0x62b2('0x46')][_0x62b2('0x5c')][_0xfdc9cb]={'filename':_0x4a4020[_0x62b2('0x46')][_0x62b2('0x5c')][_0xfdc9cb]['name'],'path':path['join'](config['root'],'server/files/attachments',_0x4a4020[_0x62b2('0x46')][_0x62b2('0x5c')][_0xfdc9cb][_0x62b2('0x5d')])};}}_0x553aad={'account':_0x3dfe2d,'message':_0x4a4020[_0x62b2('0x46')]};return;}})['then'](function(){if(_0x404b06[_0x62b2('0x4f')]){if(_0x404b06[_0x62b2('0x4f')][_0x62b2('0x50')]['length']){return _0x404b06[_0x62b2('0x4f')][_0x62b2('0x50')][0x0];}else{return db[_0x62b2('0x5e')][_0x62b2('0x49')](_[_0x62b2('0xc')](_0x4a4020[_0x62b2('0x46')],{'firstName':_0x4a4020[_0x62b2('0x46')]['to'],'email':_0x4a4020[_0x62b2('0x46')]['to'],'phone':_0x4a4020[_0x62b2('0x46')]['to'],'ListId':_0x404b06[_0x62b2('0x5f')]}));}}else{throw new Error(_0x62b2('0x60'));}})[_0x62b2('0x13')](function(){if(_0x553aad){return respondWithRpcPromise(_0x62b2('0x61'),_0x62b2('0x62'),_0x553aad,client9003)[_0x62b2('0x13')](function(_0x412e4e){return _0x81e21a['update']({'read':!![],'messageId':_0x412e4e['messageId'],'sentAt':moment()[_0x62b2('0x63')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x27d2ef){logger[_0x62b2('0x1a')]('%s',JSON[_0x62b2('0x18')](_0x27d2ef));return _0x81e21a;});}return _0x81e21a;});}return _0x81e21a;}})['then'](respondWithResult(_0x64f71a,0xc9))[_0x62b2('0x1e')](handleError(_0x64f71a,null));};exports[_0x62b2('0x64')]=function(_0x4a21e7,_0x21e663){var _0x34eb98={'agent':{},'channel':_0x62b2('0x65')};if(_0x4a21e7[_0x62b2('0x46')]['id']){delete _0x4a21e7['body']['id'];}_0x4a21e7['body'][_0x62b2('0x66')]=!![];_0x4a21e7[_0x62b2('0x46')]['readAt']=moment()[_0x62b2('0x63')](_0x62b2('0x67'));_0x4a21e7[_0x62b2('0x46')]['UserId']=_0x4a21e7['body']['UserId']||_0x4a21e7['user']['id'];_0x34eb98[_0x62b2('0x68')]['id']=_0x4a21e7[_0x62b2('0x46')][_0x62b2('0x69')];return db['MailMessage']['find']({'where':{'id':_0x4a21e7['params']['id'],'UserId':null}})[_0x62b2('0x13')](handleEntityNotFound(_0x21e663,null))[_0x62b2('0x13')](saveUpdates(_0x4a21e7[_0x62b2('0x46')],null))[_0x62b2('0x13')](function(_0x3a13bc){if(_0x3a13bc){_0x34eb98[_0x62b2('0x1b')]=_0x3a13bc[_0x62b2('0x6a')]({'plain':!![]});return db[_0x62b2('0x6b')]['find']({'where':{'id':_0x3a13bc[_0x62b2('0x6c')]}});}return null;})[_0x62b2('0x13')](handleEntityNotFound(_0x21e663,null))['then'](function(_0x1efe65){if(_0x1efe65){return _0x1efe65[_0x62b2('0x25')]({'UserId':_0x4a21e7['body'][_0x62b2('0x69')],'read1stAt':_[_0x62b2('0x54')](_0x1efe65[_0x62b2('0x6d')])?moment()['format'](_0x62b2('0x67')):undefined});}return null;})[_0x62b2('0x13')](function(_0x3b1153){if(_0x3b1153){_0x34eb98[_0x62b2('0x6e')]=_0x3b1153[_0x62b2('0x6a')]({'plain':!![]});interaction_log[_0x62b2('0x1c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a21e7[_0x62b2('0x5a')]['id'],_0x4a21e7[_0x62b2('0x5a')][_0x62b2('0x2a')],_0x4a21e7[_0x62b2('0x5a')][_0x62b2('0x6f')],_0x34eb98[_0x62b2('0x6e')]['id'],_0x4a21e7[_0x62b2('0x46')]?JSON[_0x62b2('0x18')](_0x4a21e7['body']):_0x62b2('0x70'));return respondWithRpcPromise(_0x62b2('0x71'),_0x62b2('0x72'),_0x34eb98);}return null;})[_0x62b2('0x13')](function(_0x3b3b55){var _0x2dfd1f=_0x62b2('0x73')+_0x3b3b55['message'][_0x62b2('0x74')];return db[_0x62b2('0x75')][_0x62b2('0x2f')](_0x2dfd1f,{'type':db[_0x62b2('0x76')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0xd949cb){return _0xd949cb;});})[_0x62b2('0x13')](function(_0x186efa){if(_0x186efa){_0x34eb98[_0x62b2('0x1b')][_0x62b2('0x77')]=_0x186efa[0x0];if(!_0x4a21e7['body'][_0x62b2('0x69')])return;return db[_0x62b2('0x78')]['find']({'where':{'id':_0x4a21e7[_0x62b2('0x46')][_0x62b2('0x69')],'role':_0x62b2('0x68')},'attributes':['id',_0x62b2('0x2a'),'fullname','email',_0x62b2('0x79')],'raw':!![]});}return null;})['then'](function(_0x7d1d3){if(!_0x7d1d3)return null;_0x34eb98[_0x62b2('0x1b')][_0x62b2('0x68')]=_0x7d1d3;return _0x34eb98;})['then'](function(_0x2417a9){if(_0x2417a9){if(_0x4a21e7[_0x62b2('0x46')]['manual']){_0x34eb98[_0x62b2('0x1b')]['interface']=util['format'](_0x62b2('0x7a'),_0x4a21e7[_0x62b2('0x5a')]['name']);_0x34eb98['message'][_0x62b2('0x7b')]=_0x34eb98[_0x62b2('0x7b')];_0x34eb98[_0x62b2('0x1b')][_0x62b2('0x7c')]=_0x34eb98[_0x62b2('0x7b')];_0x34eb98[_0x62b2('0x1b')][_0x62b2('0x7d')]=_0x62b2('0x64');_0x34eb98[_0x62b2('0x1b')][_0x62b2('0x46')]=htmlToText['fromString'](_0x34eb98['message']['body']);return respondWithRpcPromise(_0x62b2('0x7e'),_0x62b2('0x7e'),{'event':_0x62b2('0x7f'),'message':_0x34eb98[_0x62b2('0x1b')]},client9002)[_0x62b2('0x13')](function(){return _0x34eb98;});}return _0x34eb98;}return null;})['then'](respondWithResult(_0x21e663,null))[_0x62b2('0x1e')](handleError(_0x21e663,null));};exports[_0x62b2('0x80')]=function(_0x1b00a0,_0xdf7a87){var _0x5943f1={'agent':{},'channel':'mail'};if(_0x1b00a0[_0x62b2('0x46')]['id']){delete _0x1b00a0['body']['id'];}_0x1b00a0[_0x62b2('0x46')][_0x62b2('0x69')]=_0x1b00a0[_0x62b2('0x46')]['UserId']||_0x1b00a0[_0x62b2('0x5a')]['id'];_0x5943f1[_0x62b2('0x68')]['id']=_0x1b00a0[_0x62b2('0x46')][_0x62b2('0x69')];return db['MailMessage'][_0x62b2('0x45')]({'where':{'id':_0x1b00a0['params']['id'],'UserId':null}})[_0x62b2('0x13')](handleEntityNotFound(_0xdf7a87,null))[_0x62b2('0x13')](function(_0x1579f6){if(_0x1579f6){_0x5943f1[_0x62b2('0x1b')]=_0x1579f6[_0x62b2('0x6a')]({'plain':!![]});return db[_0x62b2('0x6b')][_0x62b2('0x45')]({'where':{'id':_0x1579f6['MailInteractionId']}});}return null;})[_0x62b2('0x13')](handleEntityNotFound(_0xdf7a87,null))['then'](function(_0x3bfa3d){if(_0x3bfa3d){_0x5943f1[_0x62b2('0x6e')]=_0x3bfa3d[_0x62b2('0x6a')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b00a0['user']['id'],_0x1b00a0[_0x62b2('0x5a')]['name'],_0x1b00a0[_0x62b2('0x5a')]['role'],_0x5943f1[_0x62b2('0x6e')]['id'],_0x1b00a0['body']?JSON[_0x62b2('0x18')](_0x1b00a0[_0x62b2('0x46')]):_0x62b2('0x70'));return respondWithRpcPromise(_0x62b2('0x81'),_0x62b2('0x82'),_0x5943f1);}return null;})[_0x62b2('0x13')](function(_0x524581){var _0x590726=_0x62b2('0x73')+_0x524581[_0x62b2('0x1b')][_0x62b2('0x74')];return db[_0x62b2('0x75')]['query'](_0x590726,{'type':db[_0x62b2('0x76')][_0x62b2('0x83')][_0x62b2('0x84')],'raw':!![]})['then'](function(_0x504e0e){return _0x504e0e;});})[_0x62b2('0x13')](function(_0x6b402c){if(_0x6b402c){_0x5943f1[_0x62b2('0x1b')]['contact']=_0x6b402c[0x0];if(!_0x1b00a0['body'][_0x62b2('0x69')])return;return db['User'][_0x62b2('0x45')]({'where':{'id':_0x1b00a0['body'][_0x62b2('0x69')],'role':_0x62b2('0x68')},'attributes':['id',_0x62b2('0x2a'),_0x62b2('0x85'),_0x62b2('0x86'),_0x62b2('0x79')],'raw':!![]});}return null;})[_0x62b2('0x13')](function(_0xd9241a){if(!_0xd9241a)return null;_0x5943f1[_0x62b2('0x1b')][_0x62b2('0x68')]=_0xd9241a;return _0x5943f1;})['then'](function(_0x3c75a0){if(_0x3c75a0){_0x3c75a0[_0x62b2('0x1b')][_0x62b2('0x87')]=util['format'](_0x62b2('0x7a'),_0x1b00a0[_0x62b2('0x5a')][_0x62b2('0x2a')]);_0x3c75a0[_0x62b2('0x1b')]['channel']=_0x5943f1[_0x62b2('0x7b')];_0x3c75a0[_0x62b2('0x1b')][_0x62b2('0x7c')]=_0x5943f1['channel'];_0x3c75a0['message']['event']=_0x62b2('0x80');_0x3c75a0['message'][_0x62b2('0x46')]=htmlToText[_0x62b2('0x88')](_0x5943f1['message'][_0x62b2('0x46')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0x62b2('0x89'),'message':_0x3c75a0[_0x62b2('0x1b')]},client9002);return _0x5943f1;}return null;})[_0x62b2('0x13')](respondWithResult(_0xdf7a87,null))[_0x62b2('0x1e')](handleError(_0xdf7a87,null));};exports['download']=function(_0x5b2ffd,_0x576834){var _0x304dd6=moment()[_0x62b2('0x8a')]()['toString']();var _0x368c31=path['join'](config[_0x62b2('0x8b')],_0x62b2('0x8c'),_0x62b2('0x8d'),_0x62b2('0x8e'));var _0x46350c=path[_0x62b2('0x8f')](config['root'],_0x62b2('0x8c'),'files',_0x62b2('0x5c'));var _0x5dda6c=util[_0x62b2('0x63')](_0x62b2('0x90'),_0x304dd6);return db[_0x62b2('0x40')]['find']({'where':{'id':_0x5b2ffd[_0x62b2('0x47')]['id']},'attributes':['id','body','from','to','cc',_0x62b2('0x91'),'subject','createdAt'],'include':_0x5b2ffd[_0x62b2('0x2f')][_0x62b2('0x5c')]?[{'model':db[_0x62b2('0x92')],'as':_0x62b2('0x93')}]:undefined})['then'](handleEntityNotFound(_0x576834,null))[_0x62b2('0x13')](function(_0x50b645){if(_0x50b645){var _0x4ab9b4=_0x50b645;var _0x424977={'from':_0x4ab9b4[_0x62b2('0x94')],'to':_0x4ab9b4['to'],'subject':_0x4ab9b4[_0x62b2('0x95')],'html':htmlEntities['decode'](_0x4ab9b4[_0x62b2('0x46')]),'headers':{'Date':moment(_0x4ab9b4[_0x62b2('0x96')])['format'](_0x62b2('0x97'))},'attachments':[]};if(_0x50b645['cc']){_0x424977[_0x62b2('0x98')]['Cc']=_0x50b645['cc'];}if(_0x50b645[_0x62b2('0x91')]){_0x424977[_0x62b2('0x98')]['Bcc']=_0x50b645[_0x62b2('0x91')];}return new BPromise(function(_0x4b19a2,_0x1e370c){if(_0x50b645[_0x62b2('0x93')]){for(var _0x45a424=0x0;_0x45a424<_0x50b645[_0x62b2('0x93')][_0x62b2('0x36')];_0x45a424++){var _0x45dcf8=_0x50b645[_0x62b2('0x93')][_0x45a424];var _0x3ca9d4=path[_0x62b2('0x8f')](_0x46350c,_0x45dcf8[_0x62b2('0x5d')]);if(fs[_0x62b2('0x99')](_0x3ca9d4)){_0x424977[_0x62b2('0x5c')][_0x62b2('0x9a')]({'name':_0x45dcf8[_0x62b2('0x2a')],'contentType':_0x45dcf8[_0x62b2('0x9b')],'data':fs[_0x62b2('0x9c')](_0x3ca9d4)});}}}emlformat[_0x62b2('0x9d')](_0x424977,function(_0x46f6f0,_0x3baf5a){if(_0x46f6f0)return _0x1e370c(_0x46f6f0);fs['writeFileSync'](path[_0x62b2('0x8f')](_0x368c31,_0x5dda6c),_0x3baf5a);return _0x4b19a2(_0x3baf5a);});});}})[_0x62b2('0x13')](function(_0x1a91cf){if(_0x1a91cf){return _0x576834[_0x62b2('0x9e')](path[_0x62b2('0x8f')](_0x368c31,_0x5dda6c),_0x5dda6c,function(_0x434c56){if(!_0x434c56)fs[_0x62b2('0x9f')](path[_0x62b2('0x8f')](_0x368c31,_0x5dda6c));});}})[_0x62b2('0x1e')](handleError(_0x576834,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3817eee..021980a 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 _0x28f3=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x511c1f,_0x4cf980){var _0x28a239=function(_0x4c2a03){while(--_0x4c2a03){_0x511c1f['push'](_0x511c1f['shift']());}};_0x28a239(++_0x4cf980);}(_0x28f3,0x1ae));var _0x328f=function(_0x4eec2f,_0x55a635){_0x4eec2f=_0x4eec2f-0x0;var _0x4d8b0d=_0x28f3[_0x4eec2f];return _0x4d8b0d;};'use strict';var EventEmitter=require(_0x328f('0x0'));var MailMessage=require(_0x328f('0x1'))['db'][_0x328f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x328f('0x3')](0x0);var events={'afterCreate':_0x328f('0x4'),'afterUpdate':_0x328f('0x5'),'afterDestroy':_0x328f('0x6')};function emitEvent(_0x56cfd0){return function(_0x59a89b,_0x1d2dca,_0x463abf){MailMessageEvents['emit'](_0x56cfd0+':'+_0x59a89b['id'],_0x59a89b);MailMessageEvents[_0x328f('0x7')](_0x56cfd0,_0x59a89b);_0x463abf(null);};}for(var e in events){if(events[_0x328f('0x8')](e)){var event=events[e];MailMessage[_0x328f('0x9')](e,emitEvent(event));}}module[_0x328f('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x8352=['exports','events','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3e4941,_0x43e1f7){var _0x484bb4=function(_0x80a817){while(--_0x80a817){_0x3e4941['push'](_0x3e4941['shift']());}};_0x484bb4(++_0x43e1f7);}(_0x8352,0x1f1));var _0x2835=function(_0x1cec25,_0x18cf13){_0x1cec25=_0x1cec25-0x0;var _0x323065=_0x8352[_0x1cec25];return _0x323065;};'use strict';var EventEmitter=require(_0x2835('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x2835('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2835('0x2')](0x0);var events={'afterCreate':_0x2835('0x3'),'afterUpdate':'update','afterDestroy':_0x2835('0x4')};function emitEvent(_0x318afc){return function(_0x37816d,_0x30dba4,_0x3fbf5f){MailMessageEvents[_0x2835('0x5')](_0x318afc+':'+_0x37816d['id'],_0x37816d);MailMessageEvents['emit'](_0x318afc,_0x37816d);_0x3fbf5f(null);};}for(var e in events){if(events[_0x2835('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x2835('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index cd62a9d..de39c50 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 _0x276b=['messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','get','toLowerCase','direction','secret','isNil','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','rimraf','../../config/environment','define','mail_messages'];(function(_0x48feae,_0x26d287){var _0x2649c1=function(_0x2ef4b8){while(--_0x2ef4b8){_0x48feae['push'](_0x48feae['shift']());}};_0x2649c1(++_0x26d287);}(_0x276b,0x89));var _0xb276=function(_0x1dfe7d,_0x155925){_0x1dfe7d=_0x1dfe7d-0x0;var _0x424d7d=_0x276b[_0x1dfe7d];return _0x424d7d;};'use strict';var _=require('lodash');var util=require(_0xb276('0x0'));var logger=require(_0xb276('0x1'))(_0xb276('0x2'));var moment=require(_0xb276('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xb276('0x4'));var config=require(_0xb276('0x5'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x51afc3,_0x20fda7){return _0x51afc3[_0xb276('0x6')]('MailMessage',attributes,{'tableName':_0xb276('0x7'),'paranoid':![],'indexes':[{'name':_0xb276('0x8'),'fields':[_0xb276('0x8')]},{'name':_0xb276('0x9'),'fields':[_0xb276('0xa'),'subject'],'type':_0xb276('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2885cf,_0x2eb7cb,_0x485118){if(_0x2885cf[_0xb276('0xc')]){_0x2885cf[_0xb276('0xa')]=htmlToText[_0xb276('0xd')](_0x2885cf[_0xb276('0xc')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x485118(null,_0x2eb7cb);},'afterCreate':function(_0xcfc841,_0x4611cb,_0x2f3104){var _0x31bef8=_0x51afc3['models'];var _0x348007=_0xcfc841[_0xb276('0xe')]({'plain':!![]});if(_0x348007['direction'][_0xb276('0xf')]()==='in'||_0x348007[_0xb276('0x10')][_0xb276('0xf')]()==='out'&&!_0x348007[_0xb276('0x11')]&&!_[_0xb276('0x12')](_0x348007[_0xb276('0x13')])){_0x31bef8[_0xb276('0x14')][_0xb276('0x15')]({'where':{'id':_0x348007['MailInteractionId']}})[_0xb276('0x16')](function(_0xb60e63){if(_0xb60e63){_0xb60e63[_0xb276('0x17')]({'lastMsgAt':_0x348007[_0xb276('0x18')],'lastMsgDirection':_0x348007[_0xb276('0x10')][_0xb276('0xf')]()});}})[_0xb276('0x19')](function(_0x33def1){console[_0xb276('0x1a')](_0x33def1);});}_0x2f3104();}},'charset':_0xb276('0x1b'),'collate':_0xb276('0x1c')});}; \ No newline at end of file +var _0x00e2=['MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','toLowerCase','direction','isNil','UserId'];(function(_0x248dc8,_0x10c027){var _0x15aaee=function(_0xa53979){while(--_0xa53979){_0x248dc8['push'](_0x248dc8['shift']());}};_0x15aaee(++_0x10c027);}(_0x00e2,0x6f));var _0x200e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x00e2[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0x200e('0x0'));var util=require(_0x200e('0x1'));var logger=require(_0x200e('0x2'))(_0x200e('0x3'));var moment=require(_0x200e('0x4'));var BPromise=require(_0x200e('0x5'));var rp=require(_0x200e('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x200e('0x7'));var rimraf=require(_0x200e('0x8'));var config=require('../../config/environment');var attributes=require(_0x200e('0x9'));module[_0x200e('0xa')]=function(_0x3dcd4d,_0x14c857){return _0x3dcd4d[_0x200e('0xb')](_0x200e('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x200e('0xd'),'fields':[_0x200e('0xd')]},{'name':_0x200e('0xe'),'fields':[_0x200e('0xf'),_0x200e('0x10')],'type':_0x200e('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x19bd78,_0x1ab7e3,_0x1e51fd){if(_0x19bd78[_0x200e('0x12')]){_0x19bd78[_0x200e('0xf')]=htmlToText[_0x200e('0x13')](_0x19bd78[_0x200e('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1e51fd(null,_0x1ab7e3);},'afterCreate':function(_0x5d456e,_0x5ecd84,_0x46a881){var _0x58871a=_0x3dcd4d[_0x200e('0x14')];var _0x1bb9d7=_0x5d456e['get']({'plain':!![]});if(_0x1bb9d7['direction'][_0x200e('0x15')]()==='in'||_0x1bb9d7[_0x200e('0x16')][_0x200e('0x15')]()==='out'&&!_0x1bb9d7['secret']&&!_[_0x200e('0x17')](_0x1bb9d7[_0x200e('0x18')])){_0x58871a[_0x200e('0x19')][_0x200e('0x1a')]({'where':{'id':_0x1bb9d7[_0x200e('0x1b')]}})[_0x200e('0x1c')](function(_0x349b42){if(_0x349b42){_0x349b42['update']({'lastMsgAt':_0x1bb9d7[_0x200e('0x1d')],'lastMsgDirection':_0x1bb9d7['direction']['toLowerCase']()});}})[_0x200e('0x1e')](function(_0x4dec42){console[_0x200e('0x1f')](_0x4dec42);});}_0x46a881();}},'charset':_0x200e('0x20'),'collate':_0x200e('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 51ab8f6..e22393d 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 _0x6343=['jayson/promise','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','moment','bluebird','../../config/logger','rpc'];(function(_0xe003bd,_0x3fbb70){var _0xd0eda3=function(_0x54e04f){while(--_0x54e04f){_0xe003bd['push'](_0xe003bd['shift']());}};_0xd0eda3(++_0x3fbb70);}(_0x6343,0x168));var _0x3634=function(_0x4ba929,_0x38c4f3){_0x4ba929=_0x4ba929-0x0;var _0x55c64a=_0x6343[_0x4ba929];return _0x55c64a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));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(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});config[_0x3634('0x6')]=_[_0x3634('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3634('0x8'))(new Redis(config[_0x3634('0x6')]));require(_0x3634('0x9'))[_0x3634('0xa')](socket);function respondWithRpcPromise(_0x2e8e8b,_0x43f681,_0x5e907a){return new BPromise(function(_0x4b965a,_0x31bcfc){return client[_0x3634('0xb')](_0x2e8e8b,_0x5e907a)['then'](function(_0x2bb4db){logger[_0x3634('0xc')](_0x3634('0xd'),_0x43f681,_0x3634('0xe'));logger[_0x3634('0xf')](_0x3634('0x10'),_0x43f681,_0x3634('0xe'),JSON[_0x3634('0x11')](_0x2bb4db));if(_0x2bb4db[_0x3634('0x12')]){if(_0x2bb4db[_0x3634('0x12')][_0x3634('0x13')]===0x1f4){logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')]['message']);return _0x31bcfc(_0x2bb4db[_0x3634('0x12')]['message']);}logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')][_0x3634('0x14')]);return _0x4b965a(_0x2bb4db[_0x3634('0x12')]['message']);}else{logger[_0x3634('0xc')]('MailMessage,\x20%s,\x20%s',_0x43f681,'request\x20sent');_0x4b965a(_0x2bb4db[_0x3634('0x15')]['message']);}})[_0x3634('0x16')](function(_0x32e3c6){logger[_0x3634('0x12')]('MailMessage,\x20%s,\x20%s',_0x43f681,_0x32e3c6);_0x31bcfc(_0x32e3c6);});});}exports[_0x3634('0x17')]=function(_0x4366bc){var _0x577a6c=this;return new Promise(function(_0xeb9231,_0x506281){return db[_0x3634('0x18')][_0x3634('0x19')](_0x4366bc['body'],{'raw':_0x4366bc[_0x3634('0x1a')]?_0x4366bc[_0x3634('0x1a')][_0x3634('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22b7ef){logger[_0x3634('0xc')]('CreateMailMessage',_0x4366bc);logger[_0x3634('0xf')]('CreateMailMessage',_0x4366bc,JSON['stringify'](_0x22b7ef));_0xeb9231(_0x22b7ef);})[_0x3634('0x16')](function(_0x862ab5){logger['error'](_0x3634('0x17'),_0x862ab5[_0x3634('0x14')],_0x4366bc);_0x506281(_0x577a6c[_0x3634('0x12')](0x1f4,_0x862ab5[_0x3634('0x14')]));});});}; \ No newline at end of file +var _0x7708=['info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','MailMessage','create','options','raw','catch','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7708,0x188));var _0x8770=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0x7708[_0x2a453b];return _0x132f79;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var moment=require('moment');var BPromise=require(_0x8770('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(_0x8770('0x3'))(_0x8770('0x4'));var config=require('../../config/environment');var jayson=require(_0x8770('0x5'));var client=jayson['client'][_0x8770('0x6')]({'port':0x232a});config[_0x8770('0x7')]=_[_0x8770('0x8')](config[_0x8770('0x7')],{'host':_0x8770('0x9'),'port':0x18eb});var socket=require(_0x8770('0xa'))(new Redis(config[_0x8770('0x7')]));require('./mailMessage.socket')[_0x8770('0xb')](socket);function respondWithRpcPromise(_0x2ca830,_0x3f357a,_0x4e4551){return new BPromise(function(_0x390af0,_0x10e4a3){return client[_0x8770('0xc')](_0x2ca830,_0x4e4551)[_0x8770('0xd')](function(_0x4a0ca1){logger[_0x8770('0xe')](_0x8770('0xf'),_0x3f357a,_0x8770('0x10'));logger['debug'](_0x8770('0x11'),_0x3f357a,_0x8770('0x10'),JSON[_0x8770('0x12')](_0x4a0ca1));if(_0x4a0ca1[_0x8770('0x13')]){if(_0x4a0ca1[_0x8770('0x13')][_0x8770('0x14')]===0x1f4){logger[_0x8770('0x13')](_0x8770('0xf'),_0x3f357a,_0x4a0ca1['error'][_0x8770('0x15')]);return _0x10e4a3(_0x4a0ca1[_0x8770('0x13')]['message']);}logger[_0x8770('0x13')]('MailMessage,\x20%s,\x20%s',_0x3f357a,_0x4a0ca1[_0x8770('0x13')]['message']);return _0x390af0(_0x4a0ca1['error']['message']);}else{logger[_0x8770('0xe')](_0x8770('0xf'),_0x3f357a,_0x8770('0x10'));_0x390af0(_0x4a0ca1[_0x8770('0x16')]['message']);}})['catch'](function(_0x349bd4){logger[_0x8770('0x13')](_0x8770('0xf'),_0x3f357a,_0x349bd4);_0x10e4a3(_0x349bd4);});});}exports[_0x8770('0x17')]=function(_0x4d2c7e){var _0x4e1fa6=this;return new Promise(function(_0x3e1fe7,_0x1234dd){return db[_0x8770('0x18')][_0x8770('0x19')](_0x4d2c7e['body'],{'raw':_0x4d2c7e['options']?_0x4d2c7e[_0x8770('0x1a')][_0x8770('0x1b')]===undefined?!![]:![]:!![]})[_0x8770('0xd')](function(_0x2918a7){logger[_0x8770('0xe')](_0x8770('0x17'),_0x4d2c7e);logger['debug'](_0x8770('0x17'),_0x4d2c7e,JSON[_0x8770('0x12')](_0x2918a7));_0x3e1fe7(_0x2918a7);})[_0x8770('0x1c')](function(_0x2515c5){logger['error'](_0x8770('0x17'),_0x2515c5['message'],_0x4d2c7e);_0x1234dd(_0x4e1fa6[_0x8770('0x13')](0x1f4,_0x2515c5[_0x8770('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index c79a57b..c480332 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 _0xf73a=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','update'];(function(_0x49f9fd,_0x3fe108){var _0xc4b947=function(_0x433523){while(--_0x433523){_0x49f9fd['push'](_0x49f9fd['shift']());}};_0xc4b947(++_0x3fe108);}(_0xf73a,0x115));var _0xaf73=function(_0x417280,_0x1255d0){_0x417280=_0x417280-0x0;var _0x247726=_0xf73a[_0x417280];return _0x247726;};'use strict';var MailMessageEvents=require(_0xaf73('0x0'));var events=[_0xaf73('0x1'),'remove',_0xaf73('0x2')];function createListener(_0x55fe8b,_0x3f6108){return function(_0x127ab6){_0x3f6108[_0xaf73('0x3')](_0x55fe8b,_0x127ab6);};}function removeListener(_0x3df2e0,_0x61a05a){return function(){MailMessageEvents[_0xaf73('0x4')](_0x3df2e0,_0x61a05a);};}exports[_0xaf73('0x5')]=function(_0x9aac6f){for(var _0x8b99c3=0x0,_0x409123=events[_0xaf73('0x6')];_0x8b99c3<_0x409123;_0x8b99c3++){var _0x558f06=events[_0x8b99c3];var _0x23e367=createListener(_0xaf73('0x7')+_0x558f06,_0x9aac6f);MailMessageEvents['on'](_0x558f06,_0x23e367);}}; \ No newline at end of file +var _0xe13a=['update','emit','removeListener','register','mailMessage:','save','remove'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0xe13a,0x178));var _0xae13=function(_0xe425d3,_0xe660e2){_0xe425d3=_0xe425d3-0x0;var _0x63367=_0xe13a[_0xe425d3];return _0x63367;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xae13('0x0'),_0xae13('0x1'),_0xae13('0x2')];function createListener(_0x6066c0,_0x4cf961){return function(_0x3aaf90){_0x4cf961[_0xae13('0x3')](_0x6066c0,_0x3aaf90);};}function removeListener(_0x3ebbfe,_0x10abd7){return function(){MailMessageEvents[_0xae13('0x4')](_0x3ebbfe,_0x10abd7);};}exports[_0xae13('0x5')]=function(_0x412a07){for(var _0x3379ed=0x0,_0x341ba4=events['length'];_0x3379ed<_0x341ba4;_0x3379ed++){var _0x2f6d10=events[_0x3379ed];var _0x2b2e1f=createListener(_0xae13('0x6')+_0x2f6d10,_0x412a07);MailMessageEvents['on'](_0x2f6d10,_0x2b2e1f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6dc01df..1fa69a2 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 _0xfaa0=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x3ae5c2,_0x313e3c){var _0x5a245e=function(_0x3260e7){while(--_0x3260e7){_0x3ae5c2['push'](_0x3ae5c2['shift']());}};_0x5a245e(++_0x313e3c);}(_0xfaa0,0x1e0));var _0x0faa=function(_0x3a2609,_0x75af81){_0x3a2609=_0x3a2609-0x0;var _0x6f4e5f=_0xfaa0[_0x3a2609];return _0x6f4e5f;};'use strict';var multer=require(_0x0faa('0x0'));var util=require(_0x0faa('0x1'));var path=require(_0x0faa('0x2'));var timeout=require(_0x0faa('0x3'));var express=require(_0x0faa('0x4'));var router=express['Router']();var fs_extra=require(_0x0faa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0faa('0x6'));var config=require(_0x0faa('0x7'));var controller=require(_0x0faa('0x8'));router[_0x0faa('0x9')]('/',auth[_0x0faa('0xa')](),controller[_0x0faa('0xb')]);router[_0x0faa('0x9')]('/describe',auth[_0x0faa('0xa')](),controller['describe']);router['get'](_0x0faa('0xc'),auth[_0x0faa('0xa')](),controller[_0x0faa('0xd')]);router[_0x0faa('0x9')](_0x0faa('0xe'),auth[_0x0faa('0xa')](),controller[_0x0faa('0xf')]);router[_0x0faa('0x9')](_0x0faa('0x10'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x11')]);router['get']('/:id/users',auth[_0x0faa('0xa')](),controller[_0x0faa('0x12')]);router['post']('/',auth[_0x0faa('0xa')](),controller[_0x0faa('0x13')]);router[_0x0faa('0x14')]('/:id/teams',auth[_0x0faa('0xa')](),controller[_0x0faa('0x15')]);router['post'](_0x0faa('0x16'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x17')]);router['put'](_0x0faa('0xc'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x18')]);router[_0x0faa('0x19')](_0x0faa('0xc'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x1a')]);router[_0x0faa('0x19')](_0x0faa('0x10'),auth['isAuthenticated'](),controller[_0x0faa('0x1b')]);router['delete'](_0x0faa('0x16'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x1c')]);module[_0x0faa('0x1d')]=router; \ No newline at end of file +var _0xedc5=['/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0xedc5,0x146));var _0x5edc=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xedc5[_0x175e89];return _0x2ed996;};'use strict';var multer=require('multer');var util=require(_0x5edc('0x0'));var path=require(_0x5edc('0x1'));var timeout=require(_0x5edc('0x2'));var express=require(_0x5edc('0x3'));var router=express['Router']();var fs_extra=require(_0x5edc('0x4'));var auth=require(_0x5edc('0x5'));var interaction=require(_0x5edc('0x6'));var config=require(_0x5edc('0x7'));var controller=require(_0x5edc('0x8'));router[_0x5edc('0x9')]('/',auth[_0x5edc('0xa')](),controller['index']);router['get'](_0x5edc('0xb'),auth[_0x5edc('0xa')](),controller[_0x5edc('0xc')]);router['get'](_0x5edc('0xd'),auth['isAuthenticated'](),controller[_0x5edc('0xe')]);router[_0x5edc('0x9')](_0x5edc('0xf'),auth[_0x5edc('0xa')](),controller[_0x5edc('0x10')]);router[_0x5edc('0x9')]('/:id/teams',auth[_0x5edc('0xa')](),controller[_0x5edc('0x11')]);router[_0x5edc('0x9')](_0x5edc('0x12'),auth[_0x5edc('0xa')](),controller[_0x5edc('0x13')]);router[_0x5edc('0x14')]('/',auth['isAuthenticated'](),controller[_0x5edc('0x15')]);router[_0x5edc('0x14')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x5edc('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x5edc('0x16')]);router[_0x5edc('0x17')](_0x5edc('0xd'),auth[_0x5edc('0xa')](),controller[_0x5edc('0x18')]);router[_0x5edc('0x19')]('/:id',auth[_0x5edc('0xa')](),controller[_0x5edc('0x1a')]);router[_0x5edc('0x19')](_0x5edc('0x1b'),auth[_0x5edc('0xa')](),controller[_0x5edc('0x1c')]);router[_0x5edc('0x19')](_0x5edc('0x12'),auth[_0x5edc('0xa')](),controller[_0x5edc('0x1d')]);module[_0x5edc('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 967f8dc..502f8c6 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 _0x9909=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0xdae76a,_0x25eaee){var _0x4ee449=function(_0xd98610){while(--_0xd98610){_0xdae76a['push'](_0xdae76a['shift']());}};_0x4ee449(++_0x25eaee);}(_0x9909,0x1cd));var _0x9990=function(_0x268c2f,_0x16bb95){_0x268c2f=_0x268c2f-0x0;var _0x59afce=_0x9909[_0x268c2f];return _0x59afce;};'use strict';var Sequelize=require(_0x9990('0x0'));module[_0x9990('0x1')]={'name':{'type':Sequelize[_0x9990('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9990('0x2')]},'timeout':{'type':Sequelize[_0x9990('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9990('0x4')](_0x9990('0x5'),_0x9990('0x6'),_0x9990('0x7'))}}; \ No newline at end of file +var _0xa313=['INTEGER','ENUM','beepall','exports','STRING','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa313,0x159));var _0x3a31=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xa313[_0x54a761];return _0x37d1da;};'use strict';var Sequelize=require('sequelize');module[_0x3a31('0x0')]={'name':{'type':Sequelize[_0x3a31('0x1')],'unique':_0x3a31('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3a31('0x1')]},'timeout':{'type':Sequelize[_0x3a31('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3a31('0x4')]('rrmemory',_0x3a31('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 11c4af3..033233d 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 _0x9e0d=['union','compact','value','transaction','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','MailQueue','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','filter','User','findAndCountAll','format','%s/%s','SIP','mailPause','createdAt','updatedAt','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','each','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','SELECT','every','TeamId'];(function(_0xcd3806,_0x3182ad){var _0x5e3594=function(_0x12874d){while(--_0x12874d){_0xcd3806['push'](_0xcd3806['shift']());}};_0x5e3594(++_0x3182ad);}(_0x9e0d,0x9b));var _0xd9e0=function(_0x13f77f,_0x42e2b9){_0x13f77f=_0x13f77f-0x0;var _0x23c9d0=_0x9e0d[_0x13f77f];return _0x23c9d0;};'use strict';var emlformat=require(_0xd9e0('0x0'));var rimraf=require(_0xd9e0('0x1'));var zipdir=require(_0xd9e0('0x2'));var jsonpatch=require(_0xd9e0('0x3'));var rp=require(_0xd9e0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd9e0('0x5'));var util=require(_0xd9e0('0x6'));var path=require(_0xd9e0('0x7'));var sox=require(_0xd9e0('0x8'));var csv=require('to-csv');var ejs=require(_0xd9e0('0x9'));var fs=require('fs');var fs_extra=require(_0xd9e0('0xa'));var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd9e0('0xf'));var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd9e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9e0('0x13'));var logger=require(_0xd9e0('0x14'))(_0xd9e0('0x15'));var utils=require(_0xd9e0('0x16'));var config=require(_0xd9e0('0x17'));var licenseUtil=require(_0xd9e0('0x18'));var db=require(_0xd9e0('0x19'))['db'];config['redis']=_[_0xd9e0('0x1a')](config[_0xd9e0('0x1b')],{'host':_0xd9e0('0x1c'),'port':0x18eb});var socket=require(_0xd9e0('0x1d'))(new Redis(config['redis']));require(_0xd9e0('0x1e'))[_0xd9e0('0x1f')](socket);function respondWithStatusCode(_0x39b339,_0x5cbd8c){_0x5cbd8c=_0x5cbd8c||0xcc;return function(_0x2eafee){if(_0x2eafee){return _0x39b339[_0xd9e0('0x20')](_0x5cbd8c);}return _0x39b339[_0xd9e0('0x21')](_0x5cbd8c)[_0xd9e0('0x22')]();};}function respondWithResult(_0x419f18,_0x4d9137){_0x4d9137=_0x4d9137||0xc8;return function(_0x269619){if(_0x269619){return _0x419f18[_0xd9e0('0x21')](_0x4d9137)[_0xd9e0('0x23')](_0x269619);}};}function respondWithFilteredResult(_0x53131e,_0x167bc0){return function(_0x4403e4){if(_0x4403e4){var _0x245393=typeof _0x167bc0['offset']===_0xd9e0('0x24')&&typeof _0x167bc0[_0xd9e0('0x25')]===_0xd9e0('0x24');var _0x510d7c=_0x4403e4[_0xd9e0('0x26')];var _0x25bd77=_0x245393?0x0:_0x167bc0[_0xd9e0('0x27')];var _0x53ff39=_0x245393?_0x4403e4[_0xd9e0('0x26')]:_0x167bc0['offset']+_0x167bc0[_0xd9e0('0x25')];var _0x31686d;if(_0x53ff39>=_0x510d7c){_0x53ff39=_0x510d7c;_0x31686d=0xc8;}else{_0x31686d=0xce;}_0x53131e[_0xd9e0('0x21')](_0x31686d);return _0x53131e[_0xd9e0('0x28')](_0xd9e0('0x29'),_0x25bd77+'-'+_0x53ff39+'/'+_0x510d7c)['json'](_0x4403e4);}return null;};}function patchUpdates(_0x903986){return function(_0x415270){try{jsonpatch[_0xd9e0('0x2a')](_0x415270,_0x903986,!![]);}catch(_0x1fa129){return BPromise[_0xd9e0('0x2b')](_0x1fa129);}return _0x415270[_0xd9e0('0x2c')]();};}function saveUpdates(_0x424eaa,_0x282363){return function(_0x12b06e){if(_0x12b06e){return _0x12b06e[_0xd9e0('0x2d')](_0x424eaa)[_0xd9e0('0x2e')](function(_0x340b30){return _0x340b30;});}return null;};}function removeEntity(_0x20d4a8,_0x142f2b){return function(_0x326f28){if(_0x326f28){return _0x326f28[_0xd9e0('0x2f')]()[_0xd9e0('0x2e')](function(){var _0x43314f=_0x326f28['get']({'plain':!![]});var _0x2930e9='MailQueues';return db[_0xd9e0('0x30')][_0xd9e0('0x2f')]({'where':{'type':_0x2930e9,'resourceId':_0x43314f['id']}})[_0xd9e0('0x2e')](function(){return _0x326f28;});})[_0xd9e0('0x2e')](function(){_0x20d4a8['status'](0xcc)[_0xd9e0('0x22')]();});}};}function handleEntityNotFound(_0x5b69b7,_0x27bbd1){return function(_0x2152de){if(!_0x2152de){_0x5b69b7[_0xd9e0('0x20')](0x194);}return _0x2152de;};}function handleError(_0x46dfca,_0xeeab8b){_0xeeab8b=_0xeeab8b||0x1f4;return function(_0x42935e){logger[_0xd9e0('0x31')](_0x42935e[_0xd9e0('0x32')]);if(_0x42935e[_0xd9e0('0x33')]){delete _0x42935e[_0xd9e0('0x33')];}_0x46dfca['status'](_0xeeab8b)[_0xd9e0('0x34')](_0x42935e);};}exports['index']=function(_0x1ecc36,_0x3cafe4){var _0x302ea2={},_0x2dd01e={},_0x532ee5={'count':0x0,'rows':[]};var _0x5291af=_['map'](db[_0xd9e0('0x35')]['rawAttributes'],function(_0x47b775){return{'name':_0x47b775[_0xd9e0('0x36')],'type':_0x47b775[_0xd9e0('0x37')][_0xd9e0('0x38')]};});_0x2dd01e['model']=_[_0xd9e0('0x39')](_0x5291af,_0xd9e0('0x33'));_0x2dd01e[_0xd9e0('0x3a')]=_[_0xd9e0('0x3b')](_0x1ecc36[_0xd9e0('0x3a')]);_0x2dd01e[_0xd9e0('0x3c')]=_[_0xd9e0('0x3d')](_0x2dd01e[_0xd9e0('0x3e')],_0x2dd01e[_0xd9e0('0x3a')]);_0x302ea2[_0xd9e0('0x3f')]=_[_0xd9e0('0x3d')](_0x2dd01e[_0xd9e0('0x3e')],qs['fields'](_0x1ecc36[_0xd9e0('0x3a')][_0xd9e0('0x40')]));_0x302ea2['attributes']=_0x302ea2['attributes'][_0xd9e0('0x41')]?_0x302ea2['attributes']:_0x2dd01e[_0xd9e0('0x3e')];if(!_0x1ecc36[_0xd9e0('0x3a')][_0xd9e0('0x42')]('nolimit')){_0x302ea2[_0xd9e0('0x25')]=qs['limit'](_0x1ecc36[_0xd9e0('0x3a')]['limit']);_0x302ea2[_0xd9e0('0x27')]=qs[_0xd9e0('0x27')](_0x1ecc36[_0xd9e0('0x3a')][_0xd9e0('0x27')]);}_0x302ea2[_0xd9e0('0x43')]=qs[_0xd9e0('0x44')](_0x1ecc36[_0xd9e0('0x3a')][_0xd9e0('0x44')]);_0x302ea2['where']=qs[_0xd9e0('0x3c')](_['pick'](_0x1ecc36['query'],_0x2dd01e[_0xd9e0('0x3c')]),_0x5291af);if(_0x1ecc36[_0xd9e0('0x3a')]['filter']){_0x302ea2[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x302ea2['where'],{'$or':_[_0xd9e0('0x39')](_0x5291af,function(_0x316000){if(_0x316000[_0xd9e0('0x37')]!==_0xd9e0('0x47')){var _0x13b43c={};_0x13b43c[_0x316000['name']]={'$like':'%'+_0x1ecc36['query']['filter']+'%'};return _0x13b43c;}})});}_0x302ea2=_[_0xd9e0('0x46')]({},_0x302ea2,_0x1ecc36[_0xd9e0('0x48')]);var _0x9070ed={'where':_0x302ea2[_0xd9e0('0x45')]};return db[_0xd9e0('0x35')][_0xd9e0('0x26')](_0x9070ed)['then'](function(_0x460e82){_0x532ee5[_0xd9e0('0x26')]=_0x460e82;if(_0x1ecc36['query'][_0xd9e0('0x49')]){_0x302ea2['include']=[{'all':!![]}];}return db['MailQueue'][_0xd9e0('0x4a')](_0x302ea2);})[_0xd9e0('0x2e')](function(_0x1219dc){_0x532ee5[_0xd9e0('0x4b')]=_0x1219dc;return _0x532ee5;})[_0xd9e0('0x2e')](respondWithFilteredResult(_0x3cafe4,_0x302ea2))[_0xd9e0('0x4c')](handleError(_0x3cafe4,null));};exports[_0xd9e0('0x4d')]=function(_0x13df4b,_0xf71c3b){var _0x1c2082={'raw':!![],'where':{'id':_0x13df4b[_0xd9e0('0x4e')]['id']}},_0x1cf219={};_0x1cf219[_0xd9e0('0x3e')]=_[_0xd9e0('0x3b')](db[_0xd9e0('0x35')][_0xd9e0('0x4f')]);_0x1cf219[_0xd9e0('0x3a')]=_[_0xd9e0('0x3b')](_0x13df4b[_0xd9e0('0x3a')]);_0x1cf219[_0xd9e0('0x3c')]=_['intersection'](_0x1cf219[_0xd9e0('0x3e')],_0x1cf219[_0xd9e0('0x3a')]);_0x1c2082[_0xd9e0('0x3f')]=_[_0xd9e0('0x3d')](_0x1cf219[_0xd9e0('0x3e')],qs[_0xd9e0('0x40')](_0x13df4b['query']['fields']));_0x1c2082[_0xd9e0('0x3f')]=_0x1c2082[_0xd9e0('0x3f')][_0xd9e0('0x41')]?_0x1c2082['attributes']:_0x1cf219[_0xd9e0('0x3e')];if(_0x13df4b[_0xd9e0('0x3a')]['includeAll']){_0x1c2082[_0xd9e0('0x50')]=[{'all':!![]}];}_0x1c2082=_[_0xd9e0('0x46')]({},_0x1c2082,_0x13df4b[_0xd9e0('0x48')]);return db[_0xd9e0('0x35')][_0xd9e0('0x51')](_0x1c2082)[_0xd9e0('0x2e')](handleEntityNotFound(_0xf71c3b,null))[_0xd9e0('0x2e')](respondWithResult(_0xf71c3b,null))['catch'](handleError(_0xf71c3b,null));};exports['create']=function(_0x4f0653,_0x3867ce){return db[_0xd9e0('0x35')]['create'](_0x4f0653[_0xd9e0('0x52')],{})[_0xd9e0('0x2e')](function(_0x59441e){var _0x4abb6c=_0x4f0653['user'][_0xd9e0('0x53')]({'plain':!![]});if(!_0x4abb6c)throw new Error(_0xd9e0('0x54'));if(_0x4abb6c['role']===_0xd9e0('0x55')){var _0x2da8a5=_0x59441e[_0xd9e0('0x53')]({'plain':!![]});var _0x454fe8=_0xd9e0('0x56');return db[_0xd9e0('0x57')][_0xd9e0('0x51')]({'where':{'name':_0x454fe8,'userProfileId':_0x4abb6c[_0xd9e0('0x58')]},'raw':!![]})[_0xd9e0('0x2e')](function(_0x36212d){if(_0x36212d&&_0x36212d[_0xd9e0('0x59')]===0x0){return db[_0xd9e0('0x30')][_0xd9e0('0x5a')]({'name':_0x2da8a5[_0xd9e0('0x33')],'resourceId':_0x2da8a5['id'],'type':_0x36212d['name'],'sectionId':_0x36212d['id']},{})['then'](function(){return _0x59441e;});}else{return _0x59441e;}})[_0xd9e0('0x4c')](function(_0x1a4331){logger['error'](_0xd9e0('0x5b'),_0x1a4331);throw _0x1a4331;});}return _0x59441e;})[_0xd9e0('0x2e')](respondWithResult(_0x3867ce,0xc9))[_0xd9e0('0x4c')](handleError(_0x3867ce,null));};exports[_0xd9e0('0x2d')]=function(_0x45ec6a,_0x37e394){if(_0x45ec6a['body']['id']){delete _0x45ec6a[_0xd9e0('0x52')]['id'];}return db[_0xd9e0('0x35')]['find']({'where':{'id':_0x45ec6a[_0xd9e0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x37e394,null))[_0xd9e0('0x2e')](saveUpdates(_0x45ec6a['body'],null))[_0xd9e0('0x2e')](respondWithResult(_0x37e394,null))[_0xd9e0('0x4c')](handleError(_0x37e394,null));};exports['destroy']=function(_0x59f25a,_0x28d9ee){return db[_0xd9e0('0x35')][_0xd9e0('0x51')]({'where':{'id':_0x59f25a['params']['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x28d9ee,null))['then'](removeEntity(_0x28d9ee,null))['catch'](handleError(_0x28d9ee,null));};exports[_0xd9e0('0x5c')]=function(_0x1f7c40,_0x88c165){return db[_0xd9e0('0x35')][_0xd9e0('0x5c')]()[_0xd9e0('0x2e')](respondWithResult(_0x88c165,null))[_0xd9e0('0x4c')](handleError(_0x88c165,null));};exports[_0xd9e0('0x5d')]=function(_0x30a8a4,_0x29b819,_0x584dad){var _0xf3576c={'raw':!![],'where':{}},_0x226abb={},_0x26b3ac;return db['MailQueue'][_0xd9e0('0x5e')]({'where':{'id':_0x30a8a4['params']['id']}})['then'](handleEntityNotFound(_0x29b819,null))[_0xd9e0('0x2e')](function(_0x201045){if(_0x201045){_0x26b3ac=_0x201045[_0xd9e0('0x53')]({'plain':!![]});_0x226abb[_0xd9e0('0x3e')]=_[_0xd9e0('0x3b')](db[_0xd9e0('0x5f')][_0xd9e0('0x4f')]);_0x226abb['query']=_[_0xd9e0('0x3b')](_0x30a8a4[_0xd9e0('0x3a')]);_0x226abb['filters']=_[_0xd9e0('0x3d')](_0x226abb[_0xd9e0('0x3e')],_0x226abb['query']);_0xf3576c[_0xd9e0('0x3f')]=_[_0xd9e0('0x3d')](_0x226abb[_0xd9e0('0x3e')],qs[_0xd9e0('0x40')](_0x30a8a4[_0xd9e0('0x3a')]['fields']));_0xf3576c[_0xd9e0('0x3f')]=_0xf3576c['attributes']['length']?_0xf3576c[_0xd9e0('0x3f')]:_0x226abb[_0xd9e0('0x3e')];if(!_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x42')](_0xd9e0('0x60'))){_0xf3576c[_0xd9e0('0x25')]=qs['limit'](_0x30a8a4[_0xd9e0('0x3a')]['limit']);_0xf3576c[_0xd9e0('0x27')]=qs[_0xd9e0('0x27')](_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x27')]);}_0xf3576c['order']=qs[_0xd9e0('0x44')](_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x44')]);_0xf3576c[_0xd9e0('0x45')]=qs[_0xd9e0('0x3c')](_['pick'](_0x30a8a4[_0xd9e0('0x3a')],_0x226abb[_0xd9e0('0x3c')]));_0xf3576c[_0xd9e0('0x45')][_0xd9e0('0x61')]=_0x201045['id'];if(_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x62')]){_0xf3576c[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0xf3576c[_0xd9e0('0x45')],{'$or':_[_0xd9e0('0x39')](_0xf3576c[_0xd9e0('0x3f')],function(_0x385249){var _0x308564={};_0x308564[_0x385249]={'$like':'%'+_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x62')]+'%'};return _0x308564;})});}_0xf3576c=_[_0xd9e0('0x46')]({},_0xf3576c,_0x30a8a4['options']);return db[_0xd9e0('0x5f')][_0xd9e0('0x4a')](_0xf3576c);}})['then'](function(_0x3fbbba){if(_0x3fbbba){return db[_0xd9e0('0x63')][_0xd9e0('0x64')]({'where':{'id':_['map'](_0x3fbbba,'UserId'),'role':'agent'},'attributes':['id',_0xd9e0('0x33'),'mailPause','updatedAt','createdAt']});}})[_0xd9e0('0x2e')](function(_0x1de8f2){if(_0x1de8f2){return{'count':_0x1de8f2[_0xd9e0('0x26')],'rows':_[_0xd9e0('0x39')](_0x1de8f2[_0xd9e0('0x4b')],function(_0x4250aa){return{'membername':_0x4250aa['name'],'UserId':_0x4250aa['id'],'queue_name':_0x26b3ac[_0xd9e0('0x33')],'MailQueueId':_0x26b3ac['id'],'interface':util[_0xd9e0('0x65')](_0xd9e0('0x66'),_0xd9e0('0x67'),_0x4250aa['name']),'penalty':0x0,'paused':_0x4250aa[_0xd9e0('0x68')],'createdAt':_0x4250aa[_0xd9e0('0x69')],'updatedAt':_0x4250aa[_0xd9e0('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9e0('0x2e')](respondWithFilteredResult(_0x29b819,_0xf3576c))[_0xd9e0('0x4c')](handleError(_0x29b819,null));};exports[_0xd9e0('0x6b')]=function(_0x4ee5a9,_0x3e09ce,_0x208266){var _0x1a04bc={};var _0x5592f1={};var _0x5e853f;var _0x4d7ce9;return db[_0xd9e0('0x35')]['findOne']({'where':{'id':_0x4ee5a9[_0xd9e0('0x4e')]['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x3e09ce,null))['then'](function(_0x190872){if(_0x190872){_0x5e853f=_0x190872;_0x5592f1[_0xd9e0('0x3e')]=_['keys'](db['Team'][_0xd9e0('0x4f')]);_0x5592f1[_0xd9e0('0x3a')]=_[_0xd9e0('0x3b')](_0x4ee5a9[_0xd9e0('0x3a')]);_0x5592f1[_0xd9e0('0x3c')]=_[_0xd9e0('0x3d')](_0x5592f1['model'],_0x5592f1[_0xd9e0('0x3a')]);_0x1a04bc[_0xd9e0('0x3f')]=_['intersection'](_0x5592f1[_0xd9e0('0x3e')],qs[_0xd9e0('0x40')](_0x4ee5a9[_0xd9e0('0x3a')]['fields']));_0x1a04bc['attributes']=_0x1a04bc[_0xd9e0('0x3f')][_0xd9e0('0x41')]?_0x1a04bc[_0xd9e0('0x3f')]:_0x5592f1['model'];_0x1a04bc[_0xd9e0('0x43')]=qs['sort'](_0x4ee5a9[_0xd9e0('0x3a')][_0xd9e0('0x44')]);_0x1a04bc[_0xd9e0('0x45')]=qs['filters'](_['pick'](_0x4ee5a9[_0xd9e0('0x3a')],_0x5592f1['filters']));if(_0x4ee5a9[_0xd9e0('0x3a')]['filter']){_0x1a04bc[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x1a04bc[_0xd9e0('0x45')],{'$or':_[_0xd9e0('0x39')](_0x1a04bc[_0xd9e0('0x3f')],function(_0x48e702){var _0xf6c083={};_0xf6c083[_0x48e702]={'$like':'%'+_0x4ee5a9['query']['filter']+'%'};return _0xf6c083;})});}_0x1a04bc=_[_0xd9e0('0x46')]({},_0x1a04bc,_0x4ee5a9[_0xd9e0('0x48')]);return _0x5e853f[_0xd9e0('0x6b')](_0x1a04bc);}})['then'](function(_0x18a782){if(_0x18a782){_0x4d7ce9=_0x18a782[_0xd9e0('0x41')];if(!_0x4ee5a9['query'][_0xd9e0('0x42')](_0xd9e0('0x60'))){_0x1a04bc[_0xd9e0('0x25')]=qs[_0xd9e0('0x25')](_0x4ee5a9['query'][_0xd9e0('0x25')]);_0x1a04bc['offset']=qs[_0xd9e0('0x27')](_0x4ee5a9['query'][_0xd9e0('0x27')]);}return _0x5e853f['getTeams'](_0x1a04bc);}})[_0xd9e0('0x2e')](function(_0x301eaa){if(_0x301eaa){return _0x301eaa?{'count':_0x4d7ce9,'rows':_0x301eaa}:null;}})[_0xd9e0('0x2e')](respondWithResult(_0x3e09ce,null))[_0xd9e0('0x4c')](handleError(_0x3e09ce,null));};exports[_0xd9e0('0x6c')]=function(_0x4dd18e,_0x3ec396,_0x1579ea){var _0x21a2c5=_0x4dd18e[_0xd9e0('0x52')][_0xd9e0('0x6d')];return db[_0xd9e0('0x6e')][_0xd9e0('0x4a')]({'where':{'id':_0x21a2c5},'attributes':['id'],'include':[{'model':db[_0xd9e0('0x63')],'as':_0xd9e0('0x6f'),'attributes':['id','name','online',_0xd9e0('0x70'),_0xd9e0('0x71')],'raw':!![]}]})[_0xd9e0('0x2e')](function(_0x4319e1){if(_0x4319e1){var _0x784cc7=_[_0xd9e0('0x72')](_0x4319e1,function(_0x11c828){var _0x5dc94f=_0x11c828['get']({'plain':!![]});return _0x5dc94f['Agents'];});return db[_0xd9e0('0x35')]['find']({'where':{'id':_0x4dd18e[_0xd9e0('0x4e')]['id']}})[_0xd9e0('0x2e')](function(_0x12ed8b){return db[_0xd9e0('0x73')]['transaction'](function(_0x35a797){return _0x12ed8b[_0xd9e0('0x6c')](_0x21a2c5,{'transaction':_0x35a797})['then'](function(){return BPromise[_0xd9e0('0x74')](_0x784cc7,function(_0x163b95){return db[_0xd9e0('0x5f')]['findOrCreate']({'where':{'UserId':_0x163b95['id'],'MailQueueId':_0x4dd18e[_0xd9e0('0x4e')]['id']},'transaction':_0x35a797});});})[_0xd9e0('0x2e')](function(){_0x784cc7[_0xd9e0('0x75')](function(_0x362e03){socket[_0xd9e0('0x76')](_0xd9e0('0x77'),{'UserId':_0x362e03['id'],'MailQueueId':_0x12ed8b['id']});});});});});}})['then'](respondWithStatusCode(_0x3ec396,null))['catch'](handleError(_0x3ec396,null));};exports[_0xd9e0('0x78')]=function(_0x180f40,_0x4d58ed,_0x46ac88){return db['Team']['findAll']({'where':{'id':_0x180f40[_0xd9e0('0x3a')][_0xd9e0('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xd9e0('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd9e0('0x2e')](handleEntityNotFound(_0x4d58ed,null))[_0xd9e0('0x2e')](function(_0x1a2a57){var _0x52485a=_[_0xd9e0('0x39')](_0x1a2a57,'id');var _0x36b1a7=[];var _0x286fe5=[];var _0x153d65=squel[_0xd9e0('0x79')]();_0x153d65[_0xd9e0('0x7a')](_0xd9e0('0x7b'))[_0xd9e0('0x7c')](_0xd9e0('0x7d'),'tq')[_0xd9e0('0x7e')](_0xd9e0('0x7f'),'ut',_0xd9e0('0x80'))[_0xd9e0('0x45')](_0xd9e0('0x81'),_0x180f40[_0xd9e0('0x4e')]['id']);for(var _0x121155=0x0;_0x121155<_0x1a2a57['length'];_0x121155+=0x1){let _0xfca463=_0x1a2a57[_0x121155];for(var _0x4a8986=0x0;_0x4a8986<_0xfca463[_0xd9e0('0x6f')][_0xd9e0('0x41')];_0x4a8986+=0x1){let _0x5dcf79=_0xfca463['Agents'][_0x4a8986];var _0x3b6b75=_0x153d65[_0xd9e0('0x82')]();_0x3b6b75[_0xd9e0('0x45')]('ut.UserId\x20=\x20?',_0x5dcf79['id']);_0x286fe5[_0xd9e0('0x83')](db[_0xd9e0('0x73')]['query'](_0x3b6b75['toString'](),{'type':db[_0xd9e0('0x73')]['QueryTypes'][_0xd9e0('0x84')]})[_0xd9e0('0x2e')](function(_0x20fa07){if(_0x20fa07['length']===0x1){return _0x5dcf79['id'];}else{var _0x5708e9=_[_0xd9e0('0x85')](_[_0xd9e0('0x39')](_0x20fa07,_0xd9e0('0x86')),function(_0xb221d5){return _['includes'](_0x52485a,_0xb221d5);});if(_0x5708e9){return _0x5dcf79['id'];}}}));}}return BPromise['all'](_0x286fe5)[_0xd9e0('0x2e')](function(_0x1e1ff9){_0x36b1a7=_(_0x36b1a7)[_0xd9e0('0x87')](_0x1e1ff9)[_0xd9e0('0x88')]()[_0xd9e0('0x89')]();return db[_0xd9e0('0x35')]['find']({'where':{'id':_0x180f40['params']['id']}})[_0xd9e0('0x2e')](function(_0xf43993){return db['sequelize'][_0xd9e0('0x8a')](function(_0x5a9be8){return _0xf43993[_0xd9e0('0x78')](_0x180f40[_0xd9e0('0x3a')][_0xd9e0('0x6d')],{'transaction':_0x5a9be8})['then'](function(){if(!_['isEmpty'](_0x36b1a7)){return _0xf43993[_0xd9e0('0x8b')](_0x36b1a7,{'transaction':_0x5a9be8});}})[_0xd9e0('0x2e')](function(){_0x36b1a7[_0xd9e0('0x75')](function(_0x54864c){socket[_0xd9e0('0x76')](_0xd9e0('0x8c'),{'UserId':_0x54864c,'MailQueueId':_0xf43993['id']});});});});});});})['then'](respondWithStatusCode(_0x4d58ed,null))[_0xd9e0('0x4c')](handleError(_0x4d58ed,null));};exports[_0xd9e0('0x8d')]=function(_0x393bc7,_0x134d91,_0x82e2db){return db['MailQueue'][_0xd9e0('0x51')]({'where':{'id':_0x393bc7['params']['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x134d91,null))[_0xd9e0('0x2e')](function(_0x571ed4){if(_0x571ed4){return _0x571ed4[_0xd9e0('0x8d')](_0x393bc7[_0xd9e0('0x52')][_0xd9e0('0x6d')],_['omit'](_0x393bc7['body'],['ids','id'])||{})[_0xd9e0('0x8e')](function(_0x4deeaf){for(var _0x1e4e6a=0x0;_0x1e4e6a<_0x393bc7['body'][_0xd9e0('0x6d')]['length'];_0x1e4e6a+=0x1){socket['emit'](_0xd9e0('0x77'),{'UserId':Number(_0x393bc7[_0xd9e0('0x52')][_0xd9e0('0x6d')][_0x1e4e6a]),'MailQueueId':Number(_0x393bc7[_0xd9e0('0x4e')]['id'])});}return _0x4deeaf;});}})[_0xd9e0('0x2e')](respondWithResult(_0x134d91,null))[_0xd9e0('0x4c')](handleError(_0x134d91,null));};exports[_0xd9e0('0x8b')]=function(_0x57667c,_0x384dec,_0x15a4a0){return db[_0xd9e0('0x35')][_0xd9e0('0x51')]({'where':{'id':_0x57667c['params']['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x384dec,null))[_0xd9e0('0x2e')](function(_0x30645b){if(_0x30645b){return _0x30645b[_0xd9e0('0x8b')](_0x57667c[_0xd9e0('0x3a')][_0xd9e0('0x6d')])[_0xd9e0('0x2e')](function(){if(_['isArray'](_0x57667c[_0xd9e0('0x3a')][_0xd9e0('0x6d')])){for(var _0x1bf339=0x0;_0x1bf339<_0x57667c[_0xd9e0('0x3a')]['ids'][_0xd9e0('0x41')];_0x1bf339+=0x1){socket[_0xd9e0('0x76')](_0xd9e0('0x8c'),{'UserId':Number(_0x57667c['query'][_0xd9e0('0x6d')][_0x1bf339]),'MailQueueId':Number(_0x57667c[_0xd9e0('0x4e')]['id'])});}}else{socket[_0xd9e0('0x76')](_0xd9e0('0x8c'),{'UserId':Number(_0x57667c[_0xd9e0('0x3a')][_0xd9e0('0x6d')]),'MailQueueId':Number(_0x57667c[_0xd9e0('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x384dec,null))[_0xd9e0('0x4c')](handleError(_0x384dec,null));};exports[_0xd9e0('0x8f')]=function(_0x2aff0a,_0x44c140,_0x415e02){var _0x4a6f74={};var _0x2113bf={};var _0x44df9c;var _0x457350;return db['MailQueue']['findOne']({'where':{'id':_0x2aff0a['params']['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x44c140,null))['then'](function(_0x14aad4){if(_0x14aad4){_0x44df9c=_0x14aad4;_0x2113bf['model']=_[_0xd9e0('0x3b')](db[_0xd9e0('0x63')]['rawAttributes']);_0x2113bf[_0xd9e0('0x3a')]=_[_0xd9e0('0x3b')](_0x2aff0a[_0xd9e0('0x3a')]);_0x2113bf[_0xd9e0('0x3c')]=_[_0xd9e0('0x3d')](_0x2113bf[_0xd9e0('0x3e')],_0x2113bf['query']);_0x4a6f74[_0xd9e0('0x3f')]=_['intersection'](_0x2113bf[_0xd9e0('0x3e')],qs[_0xd9e0('0x40')](_0x2aff0a['query'][_0xd9e0('0x40')]));_0x4a6f74[_0xd9e0('0x3f')]=_0x4a6f74[_0xd9e0('0x3f')][_0xd9e0('0x41')]?_0x4a6f74['attributes']:_0x2113bf[_0xd9e0('0x3e')];_0x4a6f74['order']=qs[_0xd9e0('0x44')](_0x2aff0a['query']['sort']);_0x4a6f74[_0xd9e0('0x45')]=qs[_0xd9e0('0x3c')](_[_0xd9e0('0x90')](_0x2aff0a[_0xd9e0('0x3a')],_0x2113bf[_0xd9e0('0x3c')]));if(_0x2aff0a[_0xd9e0('0x3a')][_0xd9e0('0x62')]){_0x4a6f74[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x4a6f74[_0xd9e0('0x45')],{'$or':_[_0xd9e0('0x39')](_0x4a6f74[_0xd9e0('0x3f')],function(_0x3b61e1){var _0x4cd0da={};_0x4cd0da[_0x3b61e1]={'$like':'%'+_0x2aff0a[_0xd9e0('0x3a')]['filter']+'%'};return _0x4cd0da;})});}_0x4a6f74=_['merge']({},_0x4a6f74,_0x2aff0a[_0xd9e0('0x48')]);return _0x44df9c[_0xd9e0('0x8f')](_0x4a6f74);}})[_0xd9e0('0x2e')](function(_0x31036a){if(_0x31036a){_0x457350=_0x31036a[_0xd9e0('0x41')];if(!_0x2aff0a[_0xd9e0('0x3a')][_0xd9e0('0x42')](_0xd9e0('0x60'))){_0x4a6f74[_0xd9e0('0x25')]=qs[_0xd9e0('0x25')](_0x2aff0a['query'][_0xd9e0('0x25')]);_0x4a6f74[_0xd9e0('0x27')]=qs['offset'](_0x2aff0a[_0xd9e0('0x3a')][_0xd9e0('0x27')]);}return _0x44df9c['getAgents'](_0x4a6f74);}})[_0xd9e0('0x2e')](function(_0x3f9b0b){if(_0x3f9b0b){return _0x3f9b0b?{'count':_0x457350,'rows':_0x3f9b0b}:null;}})['then'](respondWithResult(_0x44c140,null))[_0xd9e0('0x4c')](handleError(_0x44c140,null));}; \ No newline at end of file +var _0xbdb8=['MailQueues','UserProfileResource','error','name','send','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','include','rows','catch','show','params','keys','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','pick','findAll','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','localhost','register','status','end','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get'];(function(_0xcf7d1e,_0x1b00ad){var _0x42b2cb=function(_0x4c5c9b){while(--_0x4c5c9b){_0xcf7d1e['push'](_0xcf7d1e['shift']());}};_0x42b2cb(++_0x1b00ad);}(_0xbdb8,0xe2));var _0x8bdb=function(_0x242d17,_0x30a922){_0x242d17=_0x242d17-0x0;var _0x501a6d=_0xbdb8[_0x242d17];return _0x501a6d;};'use strict';var emlformat=require(_0x8bdb('0x0'));var rimraf=require(_0x8bdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bdb('0x2'));var rp=require(_0x8bdb('0x3'));var moment=require('moment');var BPromise=require(_0x8bdb('0x4'));var Mustache=require(_0x8bdb('0x5'));var util=require(_0x8bdb('0x6'));var path=require('path');var sox=require(_0x8bdb('0x7'));var csv=require(_0x8bdb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bdb('0x9'));var _=require('lodash');var squel=require(_0x8bdb('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8bdb('0xb'));var toCsv=require(_0x8bdb('0x8'));var querystring=require(_0x8bdb('0xc'));var Papa=require('papaparse');var Redis=require(_0x8bdb('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8bdb('0xe'));var hardwareService=require(_0x8bdb('0xf'));var logger=require(_0x8bdb('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x8bdb('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8bdb('0x12')](config[_0x8bdb('0x13')],{'host':_0x8bdb('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bdb('0x13')]));require('./mailQueue.socket')[_0x8bdb('0x15')](socket);function respondWithStatusCode(_0xc11f59,_0x5722cb){_0x5722cb=_0x5722cb||0xcc;return function(_0x2c685f){if(_0x2c685f){return _0xc11f59['sendStatus'](_0x5722cb);}return _0xc11f59[_0x8bdb('0x16')](_0x5722cb)[_0x8bdb('0x17')]();};}function respondWithResult(_0x3d08f4,_0x185f98){_0x185f98=_0x185f98||0xc8;return function(_0x3929e3){if(_0x3929e3){return _0x3d08f4[_0x8bdb('0x16')](_0x185f98)['json'](_0x3929e3);}};}function respondWithFilteredResult(_0x55fa92,_0x216733){return function(_0x2d417a){if(_0x2d417a){var _0x11b769=typeof _0x216733[_0x8bdb('0x18')]===_0x8bdb('0x19')&&typeof _0x216733[_0x8bdb('0x1a')]===_0x8bdb('0x19');var _0x5d41e4=_0x2d417a[_0x8bdb('0x1b')];var _0x461b0a=_0x11b769?0x0:_0x216733[_0x8bdb('0x18')];var _0x1fa3aa=_0x11b769?_0x2d417a[_0x8bdb('0x1b')]:_0x216733[_0x8bdb('0x18')]+_0x216733[_0x8bdb('0x1a')];var _0xee5a39;if(_0x1fa3aa>=_0x5d41e4){_0x1fa3aa=_0x5d41e4;_0xee5a39=0xc8;}else{_0xee5a39=0xce;}_0x55fa92['status'](_0xee5a39);return _0x55fa92[_0x8bdb('0x1c')]('Content-Range',_0x461b0a+'-'+_0x1fa3aa+'/'+_0x5d41e4)['json'](_0x2d417a);}return null;};}function patchUpdates(_0x3c28d3){return function(_0x5466ce){try{jsonpatch[_0x8bdb('0x1d')](_0x5466ce,_0x3c28d3,!![]);}catch(_0x34e41d){return BPromise[_0x8bdb('0x1e')](_0x34e41d);}return _0x5466ce[_0x8bdb('0x1f')]();};}function saveUpdates(_0x225d3f,_0x2013f3){return function(_0x88986d){if(_0x88986d){return _0x88986d[_0x8bdb('0x20')](_0x225d3f)['then'](function(_0x500e1b){return _0x500e1b;});}return null;};}function removeEntity(_0x18a923,_0x49fb53){return function(_0x1b6499){if(_0x1b6499){return _0x1b6499[_0x8bdb('0x21')]()[_0x8bdb('0x22')](function(){var _0x2f683a=_0x1b6499[_0x8bdb('0x23')]({'plain':!![]});var _0x409528=_0x8bdb('0x24');return db[_0x8bdb('0x25')][_0x8bdb('0x21')]({'where':{'type':_0x409528,'resourceId':_0x2f683a['id']}})[_0x8bdb('0x22')](function(){return _0x1b6499;});})[_0x8bdb('0x22')](function(){_0x18a923[_0x8bdb('0x16')](0xcc)[_0x8bdb('0x17')]();});}};}function handleEntityNotFound(_0x7f6b75,_0xeb5095){return function(_0x458a0b){if(!_0x458a0b){_0x7f6b75['sendStatus'](0x194);}return _0x458a0b;};}function handleError(_0x1ab1c7,_0x16bfa1){_0x16bfa1=_0x16bfa1||0x1f4;return function(_0x1b8d3c){logger[_0x8bdb('0x26')](_0x1b8d3c['stack']);if(_0x1b8d3c[_0x8bdb('0x27')]){delete _0x1b8d3c[_0x8bdb('0x27')];}_0x1ab1c7[_0x8bdb('0x16')](_0x16bfa1)[_0x8bdb('0x28')](_0x1b8d3c);};}exports['index']=function(_0xf013c,_0x2c7bf9){var _0x4d2fb7={},_0xb02c5b={},_0x2abc62={'count':0x0,'rows':[]};var _0x559162=_[_0x8bdb('0x29')](db[_0x8bdb('0x2a')][_0x8bdb('0x2b')],function(_0x372a64){return{'name':_0x372a64[_0x8bdb('0x2c')],'type':_0x372a64[_0x8bdb('0x2d')][_0x8bdb('0x2e')]};});_0xb02c5b[_0x8bdb('0x2f')]=_[_0x8bdb('0x29')](_0x559162,'name');_0xb02c5b[_0x8bdb('0x30')]=_['keys'](_0xf013c['query']);_0xb02c5b[_0x8bdb('0x31')]=_[_0x8bdb('0x32')](_0xb02c5b['model'],_0xb02c5b[_0x8bdb('0x30')]);_0x4d2fb7[_0x8bdb('0x33')]=_[_0x8bdb('0x32')](_0xb02c5b[_0x8bdb('0x2f')],qs['fields'](_0xf013c['query']['fields']));_0x4d2fb7['attributes']=_0x4d2fb7[_0x8bdb('0x33')][_0x8bdb('0x34')]?_0x4d2fb7[_0x8bdb('0x33')]:_0xb02c5b['model'];if(!_0xf013c[_0x8bdb('0x30')][_0x8bdb('0x35')](_0x8bdb('0x36'))){_0x4d2fb7[_0x8bdb('0x1a')]=qs['limit'](_0xf013c['query'][_0x8bdb('0x1a')]);_0x4d2fb7[_0x8bdb('0x18')]=qs[_0x8bdb('0x18')](_0xf013c[_0x8bdb('0x30')]['offset']);}_0x4d2fb7[_0x8bdb('0x37')]=qs[_0x8bdb('0x38')](_0xf013c[_0x8bdb('0x30')][_0x8bdb('0x38')]);_0x4d2fb7['where']=qs['filters'](_['pick'](_0xf013c['query'],_0xb02c5b[_0x8bdb('0x31')]),_0x559162);if(_0xf013c['query'][_0x8bdb('0x39')]){_0x4d2fb7['where']=_[_0x8bdb('0x3a')](_0x4d2fb7[_0x8bdb('0x3b')],{'$or':_[_0x8bdb('0x29')](_0x559162,function(_0x2ca323){if(_0x2ca323['type']!==_0x8bdb('0x3c')){var _0x16ba74={};_0x16ba74[_0x2ca323[_0x8bdb('0x27')]]={'$like':'%'+_0xf013c[_0x8bdb('0x30')]['filter']+'%'};return _0x16ba74;}})});}_0x4d2fb7=_[_0x8bdb('0x3a')]({},_0x4d2fb7,_0xf013c['options']);var _0x265948={'where':_0x4d2fb7[_0x8bdb('0x3b')]};return db['MailQueue'][_0x8bdb('0x1b')](_0x265948)[_0x8bdb('0x22')](function(_0x525d7e){_0x2abc62[_0x8bdb('0x1b')]=_0x525d7e;if(_0xf013c[_0x8bdb('0x30')][_0x8bdb('0x3d')]){_0x4d2fb7[_0x8bdb('0x3e')]=[{'all':!![]}];}return db[_0x8bdb('0x2a')]['findAll'](_0x4d2fb7);})[_0x8bdb('0x22')](function(_0x20e39f){_0x2abc62[_0x8bdb('0x3f')]=_0x20e39f;return _0x2abc62;})[_0x8bdb('0x22')](respondWithFilteredResult(_0x2c7bf9,_0x4d2fb7))[_0x8bdb('0x40')](handleError(_0x2c7bf9,null));};exports[_0x8bdb('0x41')]=function(_0xe00c46,_0x2d6e77){var _0x4ed05f={'raw':!![],'where':{'id':_0xe00c46[_0x8bdb('0x42')]['id']}},_0x35bea3={};_0x35bea3[_0x8bdb('0x2f')]=_[_0x8bdb('0x43')](db[_0x8bdb('0x2a')]['rawAttributes']);_0x35bea3[_0x8bdb('0x30')]=_[_0x8bdb('0x43')](_0xe00c46[_0x8bdb('0x30')]);_0x35bea3[_0x8bdb('0x31')]=_[_0x8bdb('0x32')](_0x35bea3[_0x8bdb('0x2f')],_0x35bea3[_0x8bdb('0x30')]);_0x4ed05f[_0x8bdb('0x33')]=_[_0x8bdb('0x32')](_0x35bea3['model'],qs[_0x8bdb('0x44')](_0xe00c46[_0x8bdb('0x30')][_0x8bdb('0x44')]));_0x4ed05f[_0x8bdb('0x33')]=_0x4ed05f[_0x8bdb('0x33')][_0x8bdb('0x34')]?_0x4ed05f[_0x8bdb('0x33')]:_0x35bea3[_0x8bdb('0x2f')];if(_0xe00c46['query'][_0x8bdb('0x3d')]){_0x4ed05f['include']=[{'all':!![]}];}_0x4ed05f=_[_0x8bdb('0x3a')]({},_0x4ed05f,_0xe00c46[_0x8bdb('0x45')]);return db['MailQueue'][_0x8bdb('0x46')](_0x4ed05f)[_0x8bdb('0x22')](handleEntityNotFound(_0x2d6e77,null))[_0x8bdb('0x22')](respondWithResult(_0x2d6e77,null))[_0x8bdb('0x40')](handleError(_0x2d6e77,null));};exports[_0x8bdb('0x47')]=function(_0x419ce3,_0x4552b7){return db['MailQueue'][_0x8bdb('0x47')](_0x419ce3[_0x8bdb('0x48')],{})[_0x8bdb('0x22')](function(_0x2d1180){var _0x3f5f20=_0x419ce3[_0x8bdb('0x49')][_0x8bdb('0x23')]({'plain':!![]});if(!_0x3f5f20)throw new Error(_0x8bdb('0x4a'));if(_0x3f5f20[_0x8bdb('0x4b')]==='user'){var _0x144824=_0x2d1180['get']({'plain':!![]});var _0x36924e='MailQueues';return db['UserProfileSection'][_0x8bdb('0x46')]({'where':{'name':_0x36924e,'userProfileId':_0x3f5f20[_0x8bdb('0x4c')]},'raw':!![]})['then'](function(_0x32d81e){if(_0x32d81e&&_0x32d81e[_0x8bdb('0x4d')]===0x0){return db[_0x8bdb('0x25')][_0x8bdb('0x47')]({'name':_0x144824[_0x8bdb('0x27')],'resourceId':_0x144824['id'],'type':_0x32d81e['name'],'sectionId':_0x32d81e['id']},{})[_0x8bdb('0x22')](function(){return _0x2d1180;});}else{return _0x2d1180;}})[_0x8bdb('0x40')](function(_0x3edcbe){logger['error'](_0x8bdb('0x4e'),_0x3edcbe);throw _0x3edcbe;});}return _0x2d1180;})[_0x8bdb('0x22')](respondWithResult(_0x4552b7,0xc9))['catch'](handleError(_0x4552b7,null));};exports[_0x8bdb('0x20')]=function(_0x3185fc,_0x5ee2b2){if(_0x3185fc['body']['id']){delete _0x3185fc[_0x8bdb('0x48')]['id'];}return db[_0x8bdb('0x2a')][_0x8bdb('0x46')]({'where':{'id':_0x3185fc[_0x8bdb('0x42')]['id']}})[_0x8bdb('0x22')](handleEntityNotFound(_0x5ee2b2,null))[_0x8bdb('0x22')](saveUpdates(_0x3185fc[_0x8bdb('0x48')],null))[_0x8bdb('0x22')](respondWithResult(_0x5ee2b2,null))[_0x8bdb('0x40')](handleError(_0x5ee2b2,null));};exports['destroy']=function(_0x1a3c55,_0x88cd66){return db[_0x8bdb('0x2a')][_0x8bdb('0x46')]({'where':{'id':_0x1a3c55[_0x8bdb('0x42')]['id']}})[_0x8bdb('0x22')](handleEntityNotFound(_0x88cd66,null))[_0x8bdb('0x22')](removeEntity(_0x88cd66,null))[_0x8bdb('0x40')](handleError(_0x88cd66,null));};exports['describe']=function(_0x55072e,_0x5e1487){return db[_0x8bdb('0x2a')][_0x8bdb('0x4f')]()[_0x8bdb('0x22')](respondWithResult(_0x5e1487,null))[_0x8bdb('0x40')](handleError(_0x5e1487,null));};exports[_0x8bdb('0x50')]=function(_0x281d88,_0x4ab4b0,_0x3cc6e7){var _0x3b75fd={'raw':!![],'where':{}},_0x138af4={},_0x5d21e1;return db[_0x8bdb('0x2a')][_0x8bdb('0x51')]({'where':{'id':_0x281d88['params']['id']}})[_0x8bdb('0x22')](handleEntityNotFound(_0x4ab4b0,null))[_0x8bdb('0x22')](function(_0x2ce4d2){if(_0x2ce4d2){_0x5d21e1=_0x2ce4d2[_0x8bdb('0x23')]({'plain':!![]});_0x138af4[_0x8bdb('0x2f')]=_[_0x8bdb('0x43')](db[_0x8bdb('0x52')][_0x8bdb('0x2b')]);_0x138af4[_0x8bdb('0x30')]=_[_0x8bdb('0x43')](_0x281d88['query']);_0x138af4['filters']=_[_0x8bdb('0x32')](_0x138af4[_0x8bdb('0x2f')],_0x138af4[_0x8bdb('0x30')]);_0x3b75fd[_0x8bdb('0x33')]=_['intersection'](_0x138af4['model'],qs[_0x8bdb('0x44')](_0x281d88['query'][_0x8bdb('0x44')]));_0x3b75fd[_0x8bdb('0x33')]=_0x3b75fd[_0x8bdb('0x33')][_0x8bdb('0x34')]?_0x3b75fd[_0x8bdb('0x33')]:_0x138af4['model'];if(!_0x281d88[_0x8bdb('0x30')][_0x8bdb('0x35')](_0x8bdb('0x36'))){_0x3b75fd[_0x8bdb('0x1a')]=qs[_0x8bdb('0x1a')](_0x281d88['query'][_0x8bdb('0x1a')]);_0x3b75fd[_0x8bdb('0x18')]=qs[_0x8bdb('0x18')](_0x281d88[_0x8bdb('0x30')][_0x8bdb('0x18')]);}_0x3b75fd['order']=qs[_0x8bdb('0x38')](_0x281d88['query'][_0x8bdb('0x38')]);_0x3b75fd[_0x8bdb('0x3b')]=qs[_0x8bdb('0x31')](_[_0x8bdb('0x53')](_0x281d88[_0x8bdb('0x30')],_0x138af4['filters']));_0x3b75fd[_0x8bdb('0x3b')]['MailQueueId']=_0x2ce4d2['id'];if(_0x281d88[_0x8bdb('0x30')]['filter']){_0x3b75fd[_0x8bdb('0x3b')]=_['merge'](_0x3b75fd['where'],{'$or':_['map'](_0x3b75fd['attributes'],function(_0x51720f){var _0x35f08b={};_0x35f08b[_0x51720f]={'$like':'%'+_0x281d88[_0x8bdb('0x30')][_0x8bdb('0x39')]+'%'};return _0x35f08b;})});}_0x3b75fd=_[_0x8bdb('0x3a')]({},_0x3b75fd,_0x281d88[_0x8bdb('0x45')]);return db[_0x8bdb('0x52')][_0x8bdb('0x54')](_0x3b75fd);}})[_0x8bdb('0x22')](function(_0x433e5b){if(_0x433e5b){return db['User']['findAndCountAll']({'where':{'id':_[_0x8bdb('0x29')](_0x433e5b,'UserId'),'role':'agent'},'attributes':['id',_0x8bdb('0x27'),_0x8bdb('0x55'),_0x8bdb('0x56'),'createdAt']});}})[_0x8bdb('0x22')](function(_0x3d1836){if(_0x3d1836){return{'count':_0x3d1836[_0x8bdb('0x1b')],'rows':_[_0x8bdb('0x29')](_0x3d1836[_0x8bdb('0x3f')],function(_0x117b61){return{'membername':_0x117b61['name'],'UserId':_0x117b61['id'],'queue_name':_0x5d21e1[_0x8bdb('0x27')],'MailQueueId':_0x5d21e1['id'],'interface':util[_0x8bdb('0x57')](_0x8bdb('0x58'),_0x8bdb('0x59'),_0x117b61['name']),'penalty':0x0,'paused':_0x117b61[_0x8bdb('0x55')],'createdAt':_0x117b61[_0x8bdb('0x5a')],'updatedAt':_0x117b61[_0x8bdb('0x56')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8bdb('0x22')](respondWithFilteredResult(_0x4ab4b0,_0x3b75fd))[_0x8bdb('0x40')](handleError(_0x4ab4b0,null));};exports[_0x8bdb('0x5b')]=function(_0x555b39,_0x5be538,_0x689aac){var _0x6438a9={};var _0xd4fa2a={};var _0x449307;var _0x5be53d;return db[_0x8bdb('0x2a')][_0x8bdb('0x51')]({'where':{'id':_0x555b39['params']['id']}})[_0x8bdb('0x22')](handleEntityNotFound(_0x5be538,null))[_0x8bdb('0x22')](function(_0x5553c0){if(_0x5553c0){_0x449307=_0x5553c0;_0xd4fa2a[_0x8bdb('0x2f')]=_[_0x8bdb('0x43')](db[_0x8bdb('0x5c')][_0x8bdb('0x2b')]);_0xd4fa2a[_0x8bdb('0x30')]=_[_0x8bdb('0x43')](_0x555b39[_0x8bdb('0x30')]);_0xd4fa2a[_0x8bdb('0x31')]=_[_0x8bdb('0x32')](_0xd4fa2a[_0x8bdb('0x2f')],_0xd4fa2a['query']);_0x6438a9[_0x8bdb('0x33')]=_[_0x8bdb('0x32')](_0xd4fa2a[_0x8bdb('0x2f')],qs[_0x8bdb('0x44')](_0x555b39[_0x8bdb('0x30')][_0x8bdb('0x44')]));_0x6438a9['attributes']=_0x6438a9[_0x8bdb('0x33')][_0x8bdb('0x34')]?_0x6438a9[_0x8bdb('0x33')]:_0xd4fa2a[_0x8bdb('0x2f')];_0x6438a9['order']=qs[_0x8bdb('0x38')](_0x555b39[_0x8bdb('0x30')][_0x8bdb('0x38')]);_0x6438a9[_0x8bdb('0x3b')]=qs[_0x8bdb('0x31')](_[_0x8bdb('0x53')](_0x555b39[_0x8bdb('0x30')],_0xd4fa2a[_0x8bdb('0x31')]));if(_0x555b39[_0x8bdb('0x30')][_0x8bdb('0x39')]){_0x6438a9['where']=_[_0x8bdb('0x3a')](_0x6438a9[_0x8bdb('0x3b')],{'$or':_[_0x8bdb('0x29')](_0x6438a9[_0x8bdb('0x33')],function(_0x35197d){var _0x588543={};_0x588543[_0x35197d]={'$like':'%'+_0x555b39['query'][_0x8bdb('0x39')]+'%'};return _0x588543;})});}_0x6438a9=_[_0x8bdb('0x3a')]({},_0x6438a9,_0x555b39['options']);return _0x449307[_0x8bdb('0x5b')](_0x6438a9);}})['then'](function(_0x337462){if(_0x337462){_0x5be53d=_0x337462[_0x8bdb('0x34')];if(!_0x555b39[_0x8bdb('0x30')][_0x8bdb('0x35')](_0x8bdb('0x36'))){_0x6438a9[_0x8bdb('0x1a')]=qs[_0x8bdb('0x1a')](_0x555b39[_0x8bdb('0x30')][_0x8bdb('0x1a')]);_0x6438a9['offset']=qs[_0x8bdb('0x18')](_0x555b39[_0x8bdb('0x30')][_0x8bdb('0x18')]);}return _0x449307['getTeams'](_0x6438a9);}})[_0x8bdb('0x22')](function(_0x5769e3){if(_0x5769e3){return _0x5769e3?{'count':_0x5be53d,'rows':_0x5769e3}:null;}})[_0x8bdb('0x22')](respondWithResult(_0x5be538,null))[_0x8bdb('0x40')](handleError(_0x5be538,null));};exports[_0x8bdb('0x5d')]=function(_0x4b6ee2,_0x3019f6,_0x589772){var _0x2b3c99=_0x4b6ee2[_0x8bdb('0x48')][_0x8bdb('0x5e')];return db['Team'][_0x8bdb('0x54')]({'where':{'id':_0x2b3c99},'attributes':['id'],'include':[{'model':db[_0x8bdb('0x5f')],'as':_0x8bdb('0x60'),'attributes':['id','name',_0x8bdb('0x61'),'voicePause',_0x8bdb('0x62')],'raw':!![]}]})['then'](function(_0x36e65d){if(_0x36e65d){var _0x2e9677=_[_0x8bdb('0x63')](_0x36e65d,function(_0x38b25d){var _0x380480=_0x38b25d['get']({'plain':!![]});return _0x380480[_0x8bdb('0x60')];});return db[_0x8bdb('0x2a')]['find']({'where':{'id':_0x4b6ee2[_0x8bdb('0x42')]['id']}})[_0x8bdb('0x22')](function(_0xc9a70d){return db['sequelize'][_0x8bdb('0x64')](function(_0xc85fae){return _0xc9a70d['addTeams'](_0x2b3c99,{'transaction':_0xc85fae})[_0x8bdb('0x22')](function(){return BPromise[_0x8bdb('0x65')](_0x2e9677,function(_0x41ab6c){return db[_0x8bdb('0x52')][_0x8bdb('0x66')]({'where':{'UserId':_0x41ab6c['id'],'MailQueueId':_0x4b6ee2[_0x8bdb('0x42')]['id']},'transaction':_0xc85fae});});})[_0x8bdb('0x22')](function(){_0x2e9677[_0x8bdb('0x67')](function(_0x4784a7){socket[_0x8bdb('0x68')](_0x8bdb('0x69'),{'UserId':_0x4784a7['id'],'MailQueueId':_0xc9a70d['id']});});});});});}})[_0x8bdb('0x22')](respondWithStatusCode(_0x3019f6,null))[_0x8bdb('0x40')](handleError(_0x3019f6,null));};exports['removeTeams']=function(_0x557149,_0x215365,_0x3090bf){return db[_0x8bdb('0x5c')][_0x8bdb('0x54')]({'where':{'id':_0x557149['query'][_0x8bdb('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x8bdb('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8bdb('0x22')](handleEntityNotFound(_0x215365,null))[_0x8bdb('0x22')](function(_0xee4d94){var _0x3226f7=_['map'](_0xee4d94,'id');var _0x37a560=[];var _0xf3f6be=[];var _0x5d01b5=squel[_0x8bdb('0x6a')]();_0x5d01b5[_0x8bdb('0x6b')](_0x8bdb('0x6c'))['from'](_0x8bdb('0x6d'),'tq')[_0x8bdb('0x6e')]('user_has_teams','ut',_0x8bdb('0x6f'))['where'](_0x8bdb('0x70'),_0x557149[_0x8bdb('0x42')]['id']);for(var _0x52789c=0x0;_0x52789c<_0xee4d94['length'];_0x52789c+=0x1){let _0x36496a=_0xee4d94[_0x52789c];for(var _0xf28763=0x0;_0xf28763<_0x36496a[_0x8bdb('0x60')][_0x8bdb('0x34')];_0xf28763+=0x1){let _0x106868=_0x36496a[_0x8bdb('0x60')][_0xf28763];var _0x120daa=_0x5d01b5[_0x8bdb('0x71')]();_0x120daa[_0x8bdb('0x3b')](_0x8bdb('0x72'),_0x106868['id']);_0xf3f6be[_0x8bdb('0x73')](db[_0x8bdb('0x74')]['query'](_0x120daa['toString'](),{'type':db[_0x8bdb('0x74')][_0x8bdb('0x75')][_0x8bdb('0x76')]})[_0x8bdb('0x22')](function(_0x275419){if(_0x275419[_0x8bdb('0x34')]===0x1){return _0x106868['id'];}else{var _0x240919=_['every'](_[_0x8bdb('0x29')](_0x275419,'TeamId'),function(_0x9a9f35){return _[_0x8bdb('0x77')](_0x3226f7,_0x9a9f35);});if(_0x240919){return _0x106868['id'];}}}));}}return BPromise['all'](_0xf3f6be)[_0x8bdb('0x22')](function(_0x18cf55){_0x37a560=_(_0x37a560)[_0x8bdb('0x78')](_0x18cf55)[_0x8bdb('0x79')]()[_0x8bdb('0x7a')]();return db[_0x8bdb('0x2a')][_0x8bdb('0x46')]({'where':{'id':_0x557149[_0x8bdb('0x42')]['id']}})['then'](function(_0x4b0a78){return db[_0x8bdb('0x74')][_0x8bdb('0x64')](function(_0x284ec1){return _0x4b0a78[_0x8bdb('0x7b')](_0x557149[_0x8bdb('0x30')][_0x8bdb('0x5e')],{'transaction':_0x284ec1})['then'](function(){if(!_[_0x8bdb('0x7c')](_0x37a560)){return _0x4b0a78[_0x8bdb('0x7d')](_0x37a560,{'transaction':_0x284ec1});}})[_0x8bdb('0x22')](function(){_0x37a560['forEach'](function(_0x5ec2a2){socket[_0x8bdb('0x68')](_0x8bdb('0x7e'),{'UserId':_0x5ec2a2,'MailQueueId':_0x4b0a78['id']});});});});});});})['then'](respondWithStatusCode(_0x215365,null))[_0x8bdb('0x40')](handleError(_0x215365,null));};exports[_0x8bdb('0x7f')]=function(_0x2e8a83,_0x102cc7,_0x1a0ddf){return db[_0x8bdb('0x2a')][_0x8bdb('0x46')]({'where':{'id':_0x2e8a83[_0x8bdb('0x42')]['id']}})[_0x8bdb('0x22')](handleEntityNotFound(_0x102cc7,null))[_0x8bdb('0x22')](function(_0x36abd2){if(_0x36abd2){return _0x36abd2[_0x8bdb('0x7f')](_0x2e8a83[_0x8bdb('0x48')][_0x8bdb('0x5e')],_['omit'](_0x2e8a83['body'],[_0x8bdb('0x5e'),'id'])||{})[_0x8bdb('0x80')](function(_0x1aea43){for(var _0x12008b=0x0;_0x12008b<_0x2e8a83[_0x8bdb('0x48')][_0x8bdb('0x5e')][_0x8bdb('0x34')];_0x12008b+=0x1){socket[_0x8bdb('0x68')](_0x8bdb('0x69'),{'UserId':Number(_0x2e8a83[_0x8bdb('0x48')]['ids'][_0x12008b]),'MailQueueId':Number(_0x2e8a83[_0x8bdb('0x42')]['id'])});}return _0x1aea43;});}})[_0x8bdb('0x22')](respondWithResult(_0x102cc7,null))[_0x8bdb('0x40')](handleError(_0x102cc7,null));};exports[_0x8bdb('0x7d')]=function(_0x1a2517,_0x3ed50c,_0x2bd0a8){return db[_0x8bdb('0x2a')][_0x8bdb('0x46')]({'where':{'id':_0x1a2517[_0x8bdb('0x42')]['id']}})[_0x8bdb('0x22')](handleEntityNotFound(_0x3ed50c,null))[_0x8bdb('0x22')](function(_0x55d698){if(_0x55d698){return _0x55d698[_0x8bdb('0x7d')](_0x1a2517[_0x8bdb('0x30')]['ids'])['then'](function(){if(_[_0x8bdb('0x81')](_0x1a2517[_0x8bdb('0x30')][_0x8bdb('0x5e')])){for(var _0x199d39=0x0;_0x199d39<_0x1a2517[_0x8bdb('0x30')]['ids'][_0x8bdb('0x34')];_0x199d39+=0x1){socket['emit'](_0x8bdb('0x7e'),{'UserId':Number(_0x1a2517[_0x8bdb('0x30')][_0x8bdb('0x5e')][_0x199d39]),'MailQueueId':Number(_0x1a2517[_0x8bdb('0x42')]['id'])});}}else{socket['emit'](_0x8bdb('0x7e'),{'UserId':Number(_0x1a2517[_0x8bdb('0x30')]['ids']),'MailQueueId':Number(_0x1a2517[_0x8bdb('0x42')]['id'])});}});}})[_0x8bdb('0x22')](respondWithStatusCode(_0x3ed50c,null))[_0x8bdb('0x40')](handleError(_0x3ed50c,null));};exports[_0x8bdb('0x82')]=function(_0x1b454d,_0x5a1ec4,_0x4e615e){var _0x4454b9={};var _0x1eb60a={};var _0x205a60;var _0x304aee;return db[_0x8bdb('0x2a')][_0x8bdb('0x51')]({'where':{'id':_0x1b454d['params']['id']}})[_0x8bdb('0x22')](handleEntityNotFound(_0x5a1ec4,null))[_0x8bdb('0x22')](function(_0x2ca0a7){if(_0x2ca0a7){_0x205a60=_0x2ca0a7;_0x1eb60a[_0x8bdb('0x2f')]=_[_0x8bdb('0x43')](db[_0x8bdb('0x5f')][_0x8bdb('0x2b')]);_0x1eb60a['query']=_[_0x8bdb('0x43')](_0x1b454d[_0x8bdb('0x30')]);_0x1eb60a['filters']=_[_0x8bdb('0x32')](_0x1eb60a[_0x8bdb('0x2f')],_0x1eb60a[_0x8bdb('0x30')]);_0x4454b9[_0x8bdb('0x33')]=_['intersection'](_0x1eb60a['model'],qs['fields'](_0x1b454d['query'][_0x8bdb('0x44')]));_0x4454b9[_0x8bdb('0x33')]=_0x4454b9[_0x8bdb('0x33')][_0x8bdb('0x34')]?_0x4454b9[_0x8bdb('0x33')]:_0x1eb60a[_0x8bdb('0x2f')];_0x4454b9[_0x8bdb('0x37')]=qs[_0x8bdb('0x38')](_0x1b454d['query'][_0x8bdb('0x38')]);_0x4454b9['where']=qs['filters'](_[_0x8bdb('0x53')](_0x1b454d[_0x8bdb('0x30')],_0x1eb60a[_0x8bdb('0x31')]));if(_0x1b454d[_0x8bdb('0x30')][_0x8bdb('0x39')]){_0x4454b9[_0x8bdb('0x3b')]=_[_0x8bdb('0x3a')](_0x4454b9[_0x8bdb('0x3b')],{'$or':_[_0x8bdb('0x29')](_0x4454b9[_0x8bdb('0x33')],function(_0x385d24){var _0x320f96={};_0x320f96[_0x385d24]={'$like':'%'+_0x1b454d[_0x8bdb('0x30')][_0x8bdb('0x39')]+'%'};return _0x320f96;})});}_0x4454b9=_[_0x8bdb('0x3a')]({},_0x4454b9,_0x1b454d[_0x8bdb('0x45')]);return _0x205a60[_0x8bdb('0x82')](_0x4454b9);}})[_0x8bdb('0x22')](function(_0x332588){if(_0x332588){_0x304aee=_0x332588[_0x8bdb('0x34')];if(!_0x1b454d[_0x8bdb('0x30')][_0x8bdb('0x35')](_0x8bdb('0x36'))){_0x4454b9[_0x8bdb('0x1a')]=qs['limit'](_0x1b454d[_0x8bdb('0x30')]['limit']);_0x4454b9[_0x8bdb('0x18')]=qs[_0x8bdb('0x18')](_0x1b454d[_0x8bdb('0x30')][_0x8bdb('0x18')]);}return _0x205a60[_0x8bdb('0x82')](_0x4454b9);}})['then'](function(_0x176983){if(_0x176983){return _0x176983?{'count':_0x304aee,'rows':_0x176983}:null;}})[_0x8bdb('0x22')](respondWithResult(_0x5a1ec4,null))[_0x8bdb('0x40')](handleError(_0x5a1ec4,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a5c6b74..20ad01d 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 _0x751b=['hook','exports','events','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x46a12b,_0xd4c43f){var _0x4f2fa1=function(_0xfa4a83){while(--_0xfa4a83){_0x46a12b['push'](_0x46a12b['shift']());}};_0x4f2fa1(++_0xd4c43f);}(_0x751b,0x66));var _0xb751=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x751b[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0xb751('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xb751('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb751('0x2')](0x0);var events={'afterCreate':_0xb751('0x3'),'afterUpdate':_0xb751('0x4'),'afterDestroy':_0xb751('0x5')};function emitEvent(_0x45c149){return function(_0x13ad2e,_0x238bb4,_0x23511d){MailQueueEvents[_0xb751('0x6')](_0x45c149+':'+_0x13ad2e['id'],_0x13ad2e);MailQueueEvents['emit'](_0x45c149,_0x13ad2e);_0x23511d(null);};}for(var e in events){if(events[_0xb751('0x7')](e)){var event=events[e];MailQueue[_0xb751('0x8')](e,emitEvent(event));}}module[_0xb751('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xdec2=['MailQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4dfccc,_0xd04a68){var _0x5c87b0=function(_0x52c4ce){while(--_0x52c4ce){_0x4dfccc['push'](_0x4dfccc['shift']());}};_0x5c87b0(++_0xd04a68);}(_0xdec2,0x13e));var _0x2dec=function(_0x541423,_0x12c464){_0x541423=_0x541423-0x0;var _0x2e644c=_0xdec2[_0x541423];return _0x2e644c;};'use strict';var EventEmitter=require(_0x2dec('0x0'));var MailQueue=require(_0x2dec('0x1'))['db'][_0x2dec('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2dec('0x3'),'afterUpdate':_0x2dec('0x4'),'afterDestroy':_0x2dec('0x5')};function emitEvent(_0x371cc0){return function(_0x59e5b7,_0x55c249,_0x23b6c4){MailQueueEvents[_0x2dec('0x6')](_0x371cc0+':'+_0x59e5b7['id'],_0x59e5b7);MailQueueEvents['emit'](_0x371cc0,_0x59e5b7);_0x23b6c4(null);};}for(var e in events){if(events[_0x2dec('0x7')](e)){var event=events[e];MailQueue[_0x2dec('0x8')](e,emitEvent(event));}}module[_0x2dec('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 933ae18..1fe6e5a 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 _0xc56a=['exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x32f78b,_0x178f58){var _0x51d847=function(_0xc010c3){while(--_0xc010c3){_0x32f78b['push'](_0x32f78b['shift']());}};_0x51d847(++_0x178f58);}(_0xc56a,0x1be));var _0xac56=function(_0x31eaca,_0x577011){_0x31eaca=_0x31eaca-0x0;var _0x3648de=_0xc56a[_0x31eaca];return _0x3648de;};'use strict';var _=require(_0xac56('0x0'));var util=require('util');var logger=require(_0xac56('0x1'))(_0xac56('0x2'));var moment=require(_0xac56('0x3'));var BPromise=require(_0xac56('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac56('0x5'));var rimraf=require(_0xac56('0x6'));var config=require(_0xac56('0x7'));var attributes=require(_0xac56('0x8'));module[_0xac56('0x9')]=function(_0x436146,_0x5455db){return _0x436146[_0xac56('0xa')](_0xac56('0xb'),attributes,{'tableName':_0xac56('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef41=['moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x47d17e,_0x532945){var _0x3c8c82=function(_0x4cbdc7){while(--_0x4cbdc7){_0x47d17e['push'](_0x47d17e['shift']());}};_0x3c8c82(++_0x532945);}(_0xef41,0x17e));var _0x1ef4=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0xef41[_0x514c15];return _0x16283e;};'use strict';var _=require(_0x1ef4('0x0'));var util=require(_0x1ef4('0x1'));var logger=require(_0x1ef4('0x2'))('api');var moment=require(_0x1ef4('0x3'));var BPromise=require(_0x1ef4('0x4'));var rp=require(_0x1ef4('0x5'));var fs=require('fs');var path=require(_0x1ef4('0x6'));var rimraf=require(_0x1ef4('0x7'));var config=require('../../config/environment');var attributes=require(_0x1ef4('0x8'));module[_0x1ef4('0x9')]=function(_0xf6789e,_0x12b31c){return _0xf6789e[_0x1ef4('0xa')]('MailQueue',attributes,{'tableName':'mail_queues','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 edfd667..0dfaad4 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 _0xbe85=['ShowMailQueue','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','map','include','attributes','model'];(function(_0x400820,_0x2a1c63){var _0x3764c1=function(_0x208cf5){while(--_0x208cf5){_0x400820['push'](_0x400820['shift']());}};_0x3764c1(++_0x2a1c63);}(_0xbe85,0x19c));var _0x5be8=function(_0x16d58f,_0x56a17b){_0x16d58f=_0x16d58f-0x0;var _0x351591=_0xbe85[_0x16d58f];return _0x351591;};'use strict';var _=require(_0x5be8('0x0'));var util=require(_0x5be8('0x1'));var moment=require(_0x5be8('0x2'));var BPromise=require('bluebird');var rs=require(_0x5be8('0x3'));var fs=require('fs');var Redis=require(_0x5be8('0x4'));var db=require(_0x5be8('0x5'))['db'];var utils=require(_0x5be8('0x6'));var logger=require(_0x5be8('0x7'))(_0x5be8('0x8'));var config=require(_0x5be8('0x9'));var jayson=require(_0x5be8('0xa'));var client=jayson[_0x5be8('0xb')][_0x5be8('0xc')]({'port':0x232a});config[_0x5be8('0xd')]=_[_0x5be8('0xe')](config[_0x5be8('0xd')],{'host':_0x5be8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5be8('0x10'))[_0x5be8('0x11')](socket);function respondWithRpcPromise(_0x1bd278,_0x40cf01,_0x182c0f){return new BPromise(function(_0x41e55d,_0x54c052){return client[_0x5be8('0x12')](_0x1bd278,_0x182c0f)[_0x5be8('0x13')](function(_0x50a107){logger['info']('MailQueue,\x20%s,\x20%s',_0x40cf01,_0x5be8('0x14'));logger['debug'](_0x5be8('0x15'),_0x40cf01,_0x5be8('0x14'),JSON[_0x5be8('0x16')](_0x50a107));if(_0x50a107[_0x5be8('0x17')]){if(_0x50a107[_0x5be8('0x17')][_0x5be8('0x18')]===0x1f4){logger[_0x5be8('0x17')](_0x5be8('0x19'),_0x40cf01,_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);return _0x54c052(_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x40cf01,_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);return _0x41e55d(_0x50a107['error'][_0x5be8('0x1a')]);}else{logger[_0x5be8('0x1b')](_0x5be8('0x19'),_0x40cf01,'request\x20sent');_0x41e55d(_0x50a107['result'][_0x5be8('0x1a')]);}})[_0x5be8('0x1c')](function(_0x29515f){logger[_0x5be8('0x17')](_0x5be8('0x19'),_0x40cf01,_0x29515f);_0x54c052(_0x29515f);});});}exports[_0x5be8('0x1d')]=function(_0x342cb9){var _0x36b4a0=this;return new Promise(function(_0x58b54a,_0x55f63b){return db[_0x5be8('0x1e')][_0x5be8('0x1f')]({'raw':_0x342cb9['options']?_0x342cb9[_0x5be8('0x20')][_0x5be8('0x21')]===undefined?!![]:![]:!![],'where':_0x342cb9[_0x5be8('0x20')]?_0x342cb9[_0x5be8('0x20')]['where']||null:null,'attributes':_0x342cb9['options']?_0x342cb9[_0x5be8('0x20')]['attributes']||null:null,'limit':_0x342cb9['options']?_0x342cb9['options'][_0x5be8('0x22')]||null:null,'include':_0x342cb9[_0x5be8('0x20')]?_0x342cb9[_0x5be8('0x20')]['include']?_[_0x5be8('0x23')](_0x342cb9[_0x5be8('0x20')][_0x5be8('0x24')],function(_0xf4fb53){return{'model':db[_0xf4fb53['model']],'as':_0xf4fb53['as'],'attributes':_0xf4fb53[_0x5be8('0x25')],'include':_0xf4fb53[_0x5be8('0x24')]?_[_0x5be8('0x23')](_0xf4fb53[_0x5be8('0x24')],function(_0x54a113){return{'model':db[_0x54a113[_0x5be8('0x26')]],'as':_0x54a113['as'],'attributes':_0x54a113['attributes'],'include':_0x54a113[_0x5be8('0x24')]?_[_0x5be8('0x23')](_0x54a113[_0x5be8('0x24')],function(_0xc23cfd){return{'model':db[_0xc23cfd[_0x5be8('0x26')]],'as':_0xc23cfd['as'],'attributes':_0xc23cfd['attributes']};}):[]};}):[]};}):[]:[]})[_0x5be8('0x13')](function(_0x58206e){logger['info']('GetMailQueue',_0x342cb9);logger['debug'](_0x5be8('0x1d'),_0x342cb9,JSON[_0x5be8('0x16')](_0x58206e));_0x58b54a(_0x58206e);})[_0x5be8('0x1c')](function(_0x179698){logger[_0x5be8('0x17')](_0x5be8('0x1d'),_0x179698[_0x5be8('0x1a')],_0x342cb9);_0x55f63b(_0x36b4a0[_0x5be8('0x17')](0x1f4,_0x179698['message']));});});};exports['ShowMailQueue']=function(_0x14f6de){var _0x40b699=this;return new Promise(function(_0x5dc0db,_0x6d0b00){return db[_0x5be8('0x1e')]['find']({'raw':_0x14f6de[_0x5be8('0x20')]?_0x14f6de['options'][_0x5be8('0x21')]===undefined?!![]:![]:!![],'where':_0x14f6de[_0x5be8('0x20')]?_0x14f6de[_0x5be8('0x20')]['where']||null:null,'attributes':_0x14f6de[_0x5be8('0x20')]?_0x14f6de[_0x5be8('0x20')]['attributes']||null:null,'include':_0x14f6de[_0x5be8('0x20')]?_0x14f6de[_0x5be8('0x20')][_0x5be8('0x24')]?_[_0x5be8('0x23')](_0x14f6de['options']['include'],function(_0x31526d){return{'model':db[_0x31526d[_0x5be8('0x26')]],'as':_0x31526d['as'],'attributes':_0x31526d[_0x5be8('0x25')],'include':_0x31526d[_0x5be8('0x24')]?_[_0x5be8('0x23')](_0x31526d['include'],function(_0x5cc9cb){return{'model':db[_0x5cc9cb[_0x5be8('0x26')]],'as':_0x5cc9cb['as'],'attributes':_0x5cc9cb[_0x5be8('0x25')],'include':_0x5cc9cb[_0x5be8('0x24')]?_['map'](_0x5cc9cb[_0x5be8('0x24')],function(_0x8319a1){return{'model':db[_0x8319a1[_0x5be8('0x26')]],'as':_0x8319a1['as'],'attributes':_0x8319a1[_0x5be8('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c430d){logger[_0x5be8('0x1b')](_0x5be8('0x27'),_0x14f6de);logger[_0x5be8('0x28')](_0x5be8('0x27'),_0x14f6de,JSON[_0x5be8('0x16')](_0x1c430d));_0x5dc0db(_0x1c430d);})['catch'](function(_0x3dc0c0){logger['error'](_0x5be8('0x27'),_0x3dc0c0[_0x5be8('0x1a')],_0x14f6de);_0x6d0b00(_0x40b699[_0x5be8('0x17')](0x1f4,_0x3dc0c0[_0x5be8('0x1a')]));});});}; \ No newline at end of file +var _0x29da=['result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','model','map','ShowMailQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message'];(function(_0x5617c6,_0x4b5d16){var _0x510091=function(_0x44f25d){while(--_0x44f25d){_0x5617c6['push'](_0x5617c6['shift']());}};_0x510091(++_0x4b5d16);}(_0x29da,0xf8));var _0xa29d=function(_0x2dcff0,_0xd6615d){_0x2dcff0=_0x2dcff0-0x0;var _0xef6efb=_0x29da[_0x2dcff0];return _0xef6efb;};'use strict';var _=require(_0xa29d('0x0'));var util=require(_0xa29d('0x1'));var moment=require('moment');var BPromise=require(_0xa29d('0x2'));var rs=require(_0xa29d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa29d('0x4'))['db'];var utils=require(_0xa29d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa29d('0x6'));var jayson=require(_0xa29d('0x7'));var client=jayson[_0xa29d('0x8')][_0xa29d('0x9')]({'port':0x232a});config[_0xa29d('0xa')]=_['defaults'](config[_0xa29d('0xa')],{'host':_0xa29d('0xb'),'port':0x18eb});var socket=require(_0xa29d('0xc'))(new Redis(config[_0xa29d('0xa')]));require(_0xa29d('0xd'))[_0xa29d('0xe')](socket);function respondWithRpcPromise(_0xf75309,_0x50cb00,_0x2931a1){return new BPromise(function(_0x547343,_0x5a176a){return client['request'](_0xf75309,_0x2931a1)[_0xa29d('0xf')](function(_0x5e6607){logger[_0xa29d('0x10')]('MailQueue,\x20%s,\x20%s',_0x50cb00,_0xa29d('0x11'));logger[_0xa29d('0x12')](_0xa29d('0x13'),_0x50cb00,_0xa29d('0x11'),JSON[_0xa29d('0x14')](_0x5e6607));if(_0x5e6607[_0xa29d('0x15')]){if(_0x5e6607[_0xa29d('0x15')][_0xa29d('0x16')]===0x1f4){logger[_0xa29d('0x15')](_0xa29d('0x17'),_0x50cb00,_0x5e6607[_0xa29d('0x15')][_0xa29d('0x18')]);return _0x5a176a(_0x5e6607[_0xa29d('0x15')][_0xa29d('0x18')]);}logger[_0xa29d('0x15')](_0xa29d('0x17'),_0x50cb00,_0x5e6607[_0xa29d('0x15')][_0xa29d('0x18')]);return _0x547343(_0x5e6607[_0xa29d('0x15')][_0xa29d('0x18')]);}else{logger['info'](_0xa29d('0x17'),_0x50cb00,_0xa29d('0x11'));_0x547343(_0x5e6607[_0xa29d('0x19')][_0xa29d('0x18')]);}})[_0xa29d('0x1a')](function(_0x5d8b11){logger['error'](_0xa29d('0x17'),_0x50cb00,_0x5d8b11);_0x5a176a(_0x5d8b11);});});}exports[_0xa29d('0x1b')]=function(_0x12b496){var _0x278382=this;return new Promise(function(_0x31a8fd,_0x3c83f6){return db[_0xa29d('0x1c')]['findAll']({'raw':_0x12b496[_0xa29d('0x1d')]?_0x12b496[_0xa29d('0x1d')][_0xa29d('0x1e')]===undefined?!![]:![]:!![],'where':_0x12b496[_0xa29d('0x1d')]?_0x12b496[_0xa29d('0x1d')][_0xa29d('0x1f')]||null:null,'attributes':_0x12b496[_0xa29d('0x1d')]?_0x12b496[_0xa29d('0x1d')][_0xa29d('0x20')]||null:null,'limit':_0x12b496[_0xa29d('0x1d')]?_0x12b496['options'][_0xa29d('0x21')]||null:null,'include':_0x12b496['options']?_0x12b496[_0xa29d('0x1d')][_0xa29d('0x22')]?_['map'](_0x12b496[_0xa29d('0x1d')][_0xa29d('0x22')],function(_0x599f7f){return{'model':db[_0x599f7f[_0xa29d('0x23')]],'as':_0x599f7f['as'],'attributes':_0x599f7f[_0xa29d('0x20')],'include':_0x599f7f[_0xa29d('0x22')]?_[_0xa29d('0x24')](_0x599f7f['include'],function(_0x5d23ae){return{'model':db[_0x5d23ae['model']],'as':_0x5d23ae['as'],'attributes':_0x5d23ae[_0xa29d('0x20')],'include':_0x5d23ae['include']?_[_0xa29d('0x24')](_0x5d23ae[_0xa29d('0x22')],function(_0x26565a){return{'model':db[_0x26565a[_0xa29d('0x23')]],'as':_0x26565a['as'],'attributes':_0x26565a[_0xa29d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa29d('0xf')](function(_0x403537){logger[_0xa29d('0x10')](_0xa29d('0x1b'),_0x12b496);logger['debug'](_0xa29d('0x1b'),_0x12b496,JSON[_0xa29d('0x14')](_0x403537));_0x31a8fd(_0x403537);})[_0xa29d('0x1a')](function(_0x487fba){logger[_0xa29d('0x15')](_0xa29d('0x1b'),_0x487fba[_0xa29d('0x18')],_0x12b496);_0x3c83f6(_0x278382[_0xa29d('0x15')](0x1f4,_0x487fba[_0xa29d('0x18')]));});});};exports[_0xa29d('0x25')]=function(_0x5c42df){var _0x11804a=this;return new Promise(function(_0x3c3953,_0x4abcd3){return db[_0xa29d('0x1c')][_0xa29d('0x26')]({'raw':_0x5c42df[_0xa29d('0x1d')]?_0x5c42df[_0xa29d('0x1d')][_0xa29d('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c42df['options']?_0x5c42df[_0xa29d('0x1d')][_0xa29d('0x1f')]||null:null,'attributes':_0x5c42df[_0xa29d('0x1d')]?_0x5c42df[_0xa29d('0x1d')]['attributes']||null:null,'include':_0x5c42df[_0xa29d('0x1d')]?_0x5c42df[_0xa29d('0x1d')][_0xa29d('0x22')]?_['map'](_0x5c42df[_0xa29d('0x1d')][_0xa29d('0x22')],function(_0x39e9d6){return{'model':db[_0x39e9d6['model']],'as':_0x39e9d6['as'],'attributes':_0x39e9d6[_0xa29d('0x20')],'include':_0x39e9d6['include']?_[_0xa29d('0x24')](_0x39e9d6['include'],function(_0x1dc685){return{'model':db[_0x1dc685[_0xa29d('0x23')]],'as':_0x1dc685['as'],'attributes':_0x1dc685['attributes'],'include':_0x1dc685[_0xa29d('0x22')]?_[_0xa29d('0x24')](_0x1dc685[_0xa29d('0x22')],function(_0x4ccb80){return{'model':db[_0x4ccb80[_0xa29d('0x23')]],'as':_0x4ccb80['as'],'attributes':_0x4ccb80[_0xa29d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa29d('0xf')](function(_0x2552b0){logger['info'](_0xa29d('0x25'),_0x5c42df);logger[_0xa29d('0x12')](_0xa29d('0x25'),_0x5c42df,JSON['stringify'](_0x2552b0));_0x3c3953(_0x2552b0);})[_0xa29d('0x1a')](function(_0x506ae2){logger[_0xa29d('0x15')]('ShowMailQueue',_0x506ae2[_0xa29d('0x18')],_0x5c42df);_0x4abcd3(_0x11804a[_0xa29d('0x15')](0x1f4,_0x506ae2[_0xa29d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8e16837..1e6bf90 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 _0x8453=['emit','removeListener','register','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x81af35,_0x3ace90){var _0x413bd2=function(_0x1c73e2){while(--_0x1c73e2){_0x81af35['push'](_0x81af35['shift']());}};_0x413bd2(++_0x3ace90);}(_0x8453,0x174));var _0x3845=function(_0x486f07,_0x39bb72){_0x486f07=_0x486f07-0x0;var _0x142200=_0x8453[_0x486f07];return _0x142200;};'use strict';var MailQueueEvents=require(_0x3845('0x0'));var events=[_0x3845('0x1'),_0x3845('0x2'),_0x3845('0x3')];function createListener(_0x557311,_0x77cf41){return function(_0x56d179){_0x77cf41[_0x3845('0x4')](_0x557311,_0x56d179);};}function removeListener(_0x227c77,_0x52b3f2){return function(){MailQueueEvents[_0x3845('0x5')](_0x227c77,_0x52b3f2);};}exports[_0x3845('0x6')]=function(_0x20ded1){for(var _0x4c3790=0x0,_0xfbfb5e=events['length'];_0x4c3790<_0xfbfb5e;_0x4c3790++){var _0x463f61=events[_0x4c3790];var _0x3de627=createListener(_0x3845('0x7')+_0x463f61,_0x20ded1);MailQueueEvents['on'](_0x463f61,_0x3de627);}}; \ No newline at end of file +var _0xf609=['save','remove','emit','removeListener','length','mailQueue:'];(function(_0x17f822,_0x3349f0){var _0x8b5d16=function(_0x1e0c26){while(--_0x1e0c26){_0x17f822['push'](_0x17f822['shift']());}};_0x8b5d16(++_0x3349f0);}(_0xf609,0x1c2));var _0x9f60=function(_0x14678e,_0x307979){_0x14678e=_0x14678e-0x0;var _0x10eb27=_0xf609[_0x14678e];return _0x10eb27;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x9f60('0x0'),_0x9f60('0x1'),'update'];function createListener(_0x5b5a6a,_0x290110){return function(_0x22f76e){_0x290110[_0x9f60('0x2')](_0x5b5a6a,_0x22f76e);};}function removeListener(_0x209b0c,_0x13afb5){return function(){MailQueueEvents[_0x9f60('0x3')](_0x209b0c,_0x13afb5);};}exports['register']=function(_0x5a3c6f){for(var _0x4ec770=0x0,_0x3e33ab=events[_0x9f60('0x4')];_0x4ec770<_0x3e33ab;_0x4ec770++){var _0x38fe1c=events[_0x4ec770];var _0x1d03d0=createListener(_0x9f60('0x5')+_0x38fe1c,_0x5a3c6f);MailQueueEvents['on'](_0x38fe1c,_0x1d03d0);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index c7b7233..5d64844 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 _0x24f2=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete'];(function(_0x48885b,_0x5b5dca){var _0x11f617=function(_0x18d8f3){while(--_0x18d8f3){_0x48885b['push'](_0x48885b['shift']());}};_0x11f617(++_0x5b5dca);}(_0x24f2,0x1cf));var _0x224f=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x24f2[_0x3f88bc];return _0x4df1c4;};'use strict';var multer=require('multer');var util=require(_0x224f('0x0'));var path=require(_0x224f('0x1'));var timeout=require(_0x224f('0x2'));var express=require(_0x224f('0x3'));var router=express[_0x224f('0x4')]();var fs_extra=require(_0x224f('0x5'));var auth=require(_0x224f('0x6'));var interaction=require(_0x224f('0x7'));var config=require(_0x224f('0x8'));var controller=require(_0x224f('0x9'));router[_0x224f('0xa')]('/',auth[_0x224f('0xb')](),controller[_0x224f('0xc')]);router[_0x224f('0xa')](_0x224f('0xd'),auth[_0x224f('0xb')](),controller[_0x224f('0xe')]);router['get'](_0x224f('0xf'),auth[_0x224f('0xb')](),controller['show']);router[_0x224f('0x10')]('/',auth[_0x224f('0xb')](),controller[_0x224f('0x11')]);router['put'](_0x224f('0xf'),auth[_0x224f('0xb')](),controller[_0x224f('0x12')]);router[_0x224f('0x13')](_0x224f('0xf'),auth[_0x224f('0xb')](),controller['destroy']);module[_0x224f('0x14')]=router; \ No newline at end of file +var _0xedb9=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','create','put','update','exports','multer'];(function(_0xc8a11,_0x347a33){var _0x55a500=function(_0x288d05){while(--_0x288d05){_0xc8a11['push'](_0xc8a11['shift']());}};_0x55a500(++_0x347a33);}(_0xedb9,0xfb));var _0x9edb=function(_0x14badb,_0x5a2579){_0x14badb=_0x14badb-0x0;var _0x543f47=_0xedb9[_0x14badb];return _0x543f47;};'use strict';var multer=require(_0x9edb('0x0'));var util=require(_0x9edb('0x1'));var path=require(_0x9edb('0x2'));var timeout=require(_0x9edb('0x3'));var express=require('express');var router=express[_0x9edb('0x4')]();var fs_extra=require(_0x9edb('0x5'));var auth=require(_0x9edb('0x6'));var interaction=require(_0x9edb('0x7'));var config=require(_0x9edb('0x8'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x9edb('0x9')](),controller['index']);router[_0x9edb('0xa')](_0x9edb('0xb'),auth[_0x9edb('0x9')](),controller[_0x9edb('0xc')]);router[_0x9edb('0xa')](_0x9edb('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9edb('0x9')](),controller[_0x9edb('0xe')]);router[_0x9edb('0xf')](_0x9edb('0xd'),auth[_0x9edb('0x9')](),controller[_0x9edb('0x10')]);router['delete'](_0x9edb('0xd'),auth[_0x9edb('0x9')](),controller['destroy']);module[_0x9edb('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 ccafb67..b13a049 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 _0x977d=['sequelize','STRING','DATE','moment'];(function(_0x472e5d,_0x2d5ab0){var _0x25f675=function(_0x582401){while(--_0x582401){_0x472e5d['push'](_0x472e5d['shift']());}};_0x25f675(++_0x2d5ab0);}(_0x977d,0xc7));var _0xd977=function(_0x5c1d3f,_0x4f2033){_0x5c1d3f=_0x5c1d3f-0x0;var _0xd2199=_0x977d[_0x5c1d3f];return _0xd2199;};'use strict';var moment=require(_0xd977('0x0'));var Sequelize=require(_0xd977('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd977('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd977('0x3')]},'acceptAt':{'type':Sequelize[_0xd977('0x3')]},'exitAt':{'type':Sequelize[_0xd977('0x3')]},'reason':{'type':Sequelize[_0xd977('0x2')]}}; \ No newline at end of file +var _0xb06c=['exports','STRING','DATE','sequelize'];(function(_0x35e109,_0x2e8a20){var _0x2210f3=function(_0x4a0e87){while(--_0x4a0e87){_0x35e109['push'](_0x35e109['shift']());}};_0x2210f3(++_0x2e8a20);}(_0xb06c,0x123));var _0xcb06=function(_0x365890,_0x4ab533){_0x365890=_0x365890-0x0;var _0x47ec50=_0xb06c[_0x365890];return _0x47ec50;};'use strict';var moment=require('moment');var Sequelize=require(_0xcb06('0x0'));module[_0xcb06('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xcb06('0x2')]},'joinAt':{'type':Sequelize[_0xcb06('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xcb06('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcb06('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 7d1f133..1d0bec9 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 _0x8f4c=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','MailQueueReport','includeAll','include','findAll','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x3831ed,_0x5e88ce){var _0x5521ce=function(_0x15fef7){while(--_0x15fef7){_0x3831ed['push'](_0x3831ed['shift']());}};_0x5521ce(++_0x5e88ce);}(_0x8f4c,0x113));var _0xc8f4=function(_0x513d80,_0x1649db){_0x513d80=_0x513d80-0x0;var _0x174463=_0x8f4c[_0x513d80];return _0x174463;};'use strict';var emlformat=require(_0xc8f4('0x0'));var rimraf=require(_0xc8f4('0x1'));var zipdir=require(_0xc8f4('0x2'));var jsonpatch=require(_0xc8f4('0x3'));var rp=require(_0xc8f4('0x4'));var moment=require(_0xc8f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8f4('0x6'));var util=require(_0xc8f4('0x7'));var path=require(_0xc8f4('0x8'));var sox=require('sox');var csv=require(_0xc8f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0x9'));var querystring=require(_0xc8f4('0xd'));var Papa=require(_0xc8f4('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f4('0xf'));var qs=require(_0xc8f4('0x10'));var as=require(_0xc8f4('0x11'));var hardwareService=require(_0xc8f4('0x12'));var logger=require('../../config/logger')(_0xc8f4('0x13'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x14'));var licenseUtil=require(_0xc8f4('0x15'));var db=require(_0xc8f4('0x16'))['db'];function respondWithStatusCode(_0x729f8f,_0x39b785){_0x39b785=_0x39b785||0xcc;return function(_0x4e31cf){if(_0x4e31cf){return _0x729f8f[_0xc8f4('0x17')](_0x39b785);}return _0x729f8f[_0xc8f4('0x18')](_0x39b785)[_0xc8f4('0x19')]();};}function respondWithResult(_0x14bc11,_0x1dcee5){_0x1dcee5=_0x1dcee5||0xc8;return function(_0x411c5c){if(_0x411c5c){return _0x14bc11['status'](_0x1dcee5)[_0xc8f4('0x1a')](_0x411c5c);}};}function respondWithFilteredResult(_0x2c7bc1,_0x1518a6){return function(_0x46ac15){if(_0x46ac15){var _0x22c08a=typeof _0x1518a6['offset']===_0xc8f4('0x1b')&&typeof _0x1518a6['limit']==='undefined';var _0x14bc02=_0x46ac15[_0xc8f4('0x1c')];var _0x108076=_0x22c08a?0x0:_0x1518a6[_0xc8f4('0x1d')];var _0x4763c1=_0x22c08a?_0x46ac15[_0xc8f4('0x1c')]:_0x1518a6[_0xc8f4('0x1d')]+_0x1518a6[_0xc8f4('0x1e')];var _0x1982bb;if(_0x4763c1>=_0x14bc02){_0x4763c1=_0x14bc02;_0x1982bb=0xc8;}else{_0x1982bb=0xce;}_0x2c7bc1[_0xc8f4('0x18')](_0x1982bb);return _0x2c7bc1[_0xc8f4('0x1f')](_0xc8f4('0x20'),_0x108076+'-'+_0x4763c1+'/'+_0x14bc02)[_0xc8f4('0x1a')](_0x46ac15);}return null;};}function patchUpdates(_0x5f3264){return function(_0x378f56){try{jsonpatch[_0xc8f4('0x21')](_0x378f56,_0x5f3264,!![]);}catch(_0x29e52d){return BPromise[_0xc8f4('0x22')](_0x29e52d);}return _0x378f56[_0xc8f4('0x23')]();};}function saveUpdates(_0x3b42ee,_0xaeee7d){return function(_0x43eb57){if(_0x43eb57){return _0x43eb57['update'](_0x3b42ee)[_0xc8f4('0x24')](function(_0x205c41){return _0x205c41;});}return null;};}function removeEntity(_0x3195ff,_0x1d159e){return function(_0x5d54a9){if(_0x5d54a9){return _0x5d54a9[_0xc8f4('0x25')]()['then'](function(){_0x3195ff[_0xc8f4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x177a44,_0x3dd717){return function(_0x5c94c6){if(!_0x5c94c6){_0x177a44[_0xc8f4('0x17')](0x194);}return _0x5c94c6;};}function handleError(_0x21062f,_0x11f766){_0x11f766=_0x11f766||0x1f4;return function(_0x2fa052){logger['error'](_0x2fa052[_0xc8f4('0x26')]);if(_0x2fa052[_0xc8f4('0x27')]){delete _0x2fa052['name'];}_0x21062f[_0xc8f4('0x18')](_0x11f766)[_0xc8f4('0x28')](_0x2fa052);};}exports[_0xc8f4('0x29')]=function(_0x1b70bc,_0x24bef0){var _0x385e41={},_0x4a25da={},_0x45f972={'count':0x0,'rows':[]};var _0x24bb78=_[_0xc8f4('0x2a')](db['MailQueueReport'][_0xc8f4('0x2b')],function(_0x3a4b1b){return{'name':_0x3a4b1b['fieldName'],'type':_0x3a4b1b['type']['key']};});_0x4a25da[_0xc8f4('0x2c')]=_[_0xc8f4('0x2a')](_0x24bb78,_0xc8f4('0x27'));_0x4a25da[_0xc8f4('0x2d')]=_[_0xc8f4('0x2e')](_0x1b70bc[_0xc8f4('0x2d')]);_0x4a25da[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x4a25da['model'],_0x4a25da[_0xc8f4('0x2d')]);_0x385e41[_0xc8f4('0x31')]=_[_0xc8f4('0x30')](_0x4a25da['model'],qs[_0xc8f4('0x32')](_0x1b70bc[_0xc8f4('0x2d')]['fields']));_0x385e41[_0xc8f4('0x31')]=_0x385e41[_0xc8f4('0x31')][_0xc8f4('0x33')]?_0x385e41['attributes']:_0x4a25da[_0xc8f4('0x2c')];if(!_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x34')]('nolimit')){_0x385e41[_0xc8f4('0x1e')]=qs[_0xc8f4('0x1e')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1e')]);_0x385e41[_0xc8f4('0x1d')]=qs[_0xc8f4('0x1d')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1d')]);}_0x385e41[_0xc8f4('0x35')]=qs[_0xc8f4('0x36')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x36')]);_0x385e41[_0xc8f4('0x37')]=qs[_0xc8f4('0x2f')](_[_0xc8f4('0x38')](_0x1b70bc[_0xc8f4('0x2d')],_0x4a25da['filters']),_0x24bb78);if(_0x1b70bc[_0xc8f4('0x2d')]['filter']){_0x385e41[_0xc8f4('0x37')]=_['merge'](_0x385e41[_0xc8f4('0x37')],{'$or':_[_0xc8f4('0x2a')](_0x24bb78,function(_0x7ef69a){if(_0x7ef69a[_0xc8f4('0x39')]!==_0xc8f4('0x3a')){var _0x724060={};_0x724060[_0x7ef69a[_0xc8f4('0x27')]]={'$like':'%'+_0x1b70bc['query'][_0xc8f4('0x3b')]+'%'};return _0x724060;}})});}_0x385e41=_[_0xc8f4('0x3c')]({},_0x385e41,_0x1b70bc[_0xc8f4('0x3d')]);var _0x14ce2e={'where':_0x385e41['where']};return db[_0xc8f4('0x3e')][_0xc8f4('0x1c')](_0x14ce2e)[_0xc8f4('0x24')](function(_0x1d0b2d){_0x45f972[_0xc8f4('0x1c')]=_0x1d0b2d;if(_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x385e41[_0xc8f4('0x40')]=[{'all':!![]}];}return db[_0xc8f4('0x3e')][_0xc8f4('0x41')](_0x385e41);})[_0xc8f4('0x24')](function(_0xd56415){_0x45f972['rows']=_0xd56415;return _0x45f972;})[_0xc8f4('0x24')](respondWithFilteredResult(_0x24bef0,_0x385e41))[_0xc8f4('0x42')](handleError(_0x24bef0,null));};exports[_0xc8f4('0x43')]=function(_0x275f4a,_0x588ff9){var _0x49da16={'raw':!![],'where':{'id':_0x275f4a[_0xc8f4('0x44')]['id']}},_0x413a55={};_0x413a55['model']=_[_0xc8f4('0x2e')](db[_0xc8f4('0x3e')]['rawAttributes']);_0x413a55['query']=_[_0xc8f4('0x2e')](_0x275f4a[_0xc8f4('0x2d')]);_0x413a55[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x413a55[_0xc8f4('0x2c')],_0x413a55[_0xc8f4('0x2d')]);_0x49da16['attributes']=_['intersection'](_0x413a55[_0xc8f4('0x2c')],qs[_0xc8f4('0x32')](_0x275f4a[_0xc8f4('0x2d')]['fields']));_0x49da16['attributes']=_0x49da16['attributes']['length']?_0x49da16['attributes']:_0x413a55[_0xc8f4('0x2c')];if(_0x275f4a[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x49da16[_0xc8f4('0x40')]=[{'all':!![]}];}_0x49da16=_[_0xc8f4('0x3c')]({},_0x49da16,_0x275f4a[_0xc8f4('0x3d')]);return db['MailQueueReport'][_0xc8f4('0x45')](_0x49da16)[_0xc8f4('0x24')](handleEntityNotFound(_0x588ff9,null))['then'](respondWithResult(_0x588ff9,null))['catch'](handleError(_0x588ff9,null));};exports[_0xc8f4('0x46')]=function(_0x82a5e,_0x3ca0d6){return db[_0xc8f4('0x3e')]['create'](_0x82a5e['body'],{})[_0xc8f4('0x24')](respondWithResult(_0x3ca0d6,0xc9))[_0xc8f4('0x42')](handleError(_0x3ca0d6,null));};exports[_0xc8f4('0x47')]=function(_0x2bc4db,_0x141f81){if(_0x2bc4db[_0xc8f4('0x48')]['id']){delete _0x2bc4db['body']['id'];}return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x2bc4db[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x141f81,null))[_0xc8f4('0x24')](saveUpdates(_0x2bc4db[_0xc8f4('0x48')],null))[_0xc8f4('0x24')](respondWithResult(_0x141f81,null))[_0xc8f4('0x42')](handleError(_0x141f81,null));};exports[_0xc8f4('0x25')]=function(_0x3d9d67,_0x5b4035){return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x3d9d67[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x5b4035,null))[_0xc8f4('0x24')](removeEntity(_0x5b4035,null))[_0xc8f4('0x42')](handleError(_0x5b4035,null));};exports[_0xc8f4('0x49')]=function(_0x4715f3,_0x36c304){return db[_0xc8f4('0x3e')][_0xc8f4('0x49')]()[_0xc8f4('0x24')](respondWithResult(_0x36c304,null))[_0xc8f4('0x42')](handleError(_0x36c304,null));}; \ No newline at end of file +var _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3d7df7,_0x4134c9){_0x3d7df7=_0x3d7df7-0x0;var _0x51e6ba=_0x9f0e[_0x3d7df7];return _0x51e6ba;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':!![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['MailQueueReport'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['MailQueueReport'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8702c08..980a52f 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 _0x25c7=['util','../../config/logger','api','bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x10c408,_0x5164f){var _0x46b4ea=function(_0x4e594e){while(--_0x4e594e){_0x10c408['push'](_0x10c408['shift']());}};_0x46b4ea(++_0x5164f);}(_0x25c7,0x9c));var _0x725c=function(_0x2ade50,_0x116bb9){_0x2ade50=_0x2ade50-0x0;var _0xa50fdb=_0x25c7[_0x2ade50];return _0xa50fdb;};'use strict';var _=require('lodash');var util=require(_0x725c('0x0'));var logger=require(_0x725c('0x1'))(_0x725c('0x2'));var moment=require('moment');var BPromise=require(_0x725c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x725c('0x4'));var rimraf=require('rimraf');var config=require(_0x725c('0x5'));var attributes=require(_0x725c('0x6'));module[_0x725c('0x7')]=function(_0x3148dc,_0x4a10fc){return _0x3148dc[_0x725c('0x8')](_0x725c('0x9'),attributes,{'tableName':_0x725c('0xa'),'paranoid':![],'indexes':[{'name':_0x725c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d65=['moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','../../config/logger'];(function(_0x50d8da,_0xe56e5b){var _0x1b55bb=function(_0x5c15eb){while(--_0x5c15eb){_0x50d8da['push'](_0x50d8da['shift']());}};_0x1b55bb(++_0xe56e5b);}(_0x4d65,0x16a));var _0x54d6=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x4d65[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x54d6('0x0'))('api');var moment=require(_0x54d6('0x1'));var BPromise=require('bluebird');var rp=require(_0x54d6('0x2'));var fs=require('fs');var path=require(_0x54d6('0x3'));var rimraf=require(_0x54d6('0x4'));var config=require(_0x54d6('0x5'));var attributes=require(_0x54d6('0x6'));module[_0x54d6('0x7')]=function(_0x48a093,_0x322837){return _0x48a093[_0x54d6('0x8')](_0x54d6('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x54d6('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 4eb2ae7..b5ba152 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x3514cb,_0x40f934){var _0x4e083d=function(_0x5df3bc){while(--_0x5df3bc){_0x3514cb['push'](_0x3514cb['shift']());}};_0x4e083d(++_0x40f934);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x6a7421,_0x20b4f5){var _0x33f5d1=function(_0x2714a4){while(--_0x2714a4){_0x6a7421['push'](_0x6a7421['shift']());}};_0x33f5d1(++_0x20b4f5);}(_0xdb28,0x106));var _0x8db2=function(_0x5b8807,_0x27a4ae){_0x5b8807=_0x5b8807-0x0;var _0x1e635c=_0xdb28[_0x5b8807];return _0x1e635c;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 815c714..29654c5 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xb09248,_0x2dd6e8){var _0x489068=function(_0x42fe3b){while(--_0x42fe3b){_0xb09248['push'](_0xb09248['shift']());}};_0x489068(++_0x2dd6e8);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ac1f5,_0xda103c){_0x4ac1f5=_0x4ac1f5-0x0;var _0x189673=_0xedd9[_0x4ac1f5];return _0x189673;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2e74ff,_0x4b53fb){var _0x3d68b8=function(_0x2fb214){while(--_0x2fb214){_0x2e74ff['push'](_0x2e74ff['shift']());}};_0x3d68b8(++_0x4b53fb);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 95f3403..d6e943c 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 _0xe130=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0xe130,0x127));var _0x0e13=function(_0x2950e8,_0x28c19b){_0x2950e8=_0x2950e8-0x0;var _0x1de7b1=_0xe130[_0x2950e8];return _0x1de7b1;};'use strict';var Sequelize=require(_0x0e13('0x0'));module[_0x0e13('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0e13('0x2')]},'authentication':{'type':Sequelize[_0x0e13('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x0e13('0x2')]},'password':{'type':Sequelize[_0x0e13('0x2')]},'port':{'type':Sequelize[_0x0e13('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0e13('0x2')],'defaultValue':_0x0e13('0x5')},'connTimeout':{'type':Sequelize[_0x0e13('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0e13('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x80ed=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x5ab602,_0x5bb797){var _0x3b7a08=function(_0x4c0e12){while(--_0x4c0e12){_0x5ab602['push'](_0x5ab602['shift']());}};_0x3b7a08(++_0x5bb797);}(_0x80ed,0x11c));var _0xd80e=function(_0x333ca4,_0x1de64f){_0x333ca4=_0x333ca4-0x0;var _0x3859e3=_0x80ed[_0x333ca4];return _0x3859e3;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'description':{'type':Sequelize[_0xd80e('0x1')]},'host':{'type':Sequelize[_0xd80e('0x1')]},'authentication':{'type':Sequelize[_0xd80e('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd80e('0x1')]},'port':{'type':Sequelize[_0xd80e('0x3')]},'tls':{'type':Sequelize[_0xd80e('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd80e('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 8043246..05d088e 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 _0x1477=['api','moment','request-promise','path','exports','define','MailServerIn','mail_servers_in','util','../../config/logger'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x1477,0x148));var _0x7147=function(_0x4d4e9c,_0x5c8437){_0x4d4e9c=_0x4d4e9c-0x0;var _0x2a6bbc=_0x1477[_0x4d4e9c];return _0x2a6bbc;};'use strict';var _=require('lodash');var util=require(_0x7147('0x0'));var logger=require(_0x7147('0x1'))(_0x7147('0x2'));var moment=require(_0x7147('0x3'));var BPromise=require('bluebird');var rp=require(_0x7147('0x4'));var fs=require('fs');var path=require(_0x7147('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x7147('0x6')]=function(_0x252284,_0x390ab2){return _0x252284[_0x7147('0x7')](_0x7147('0x8'),attributes,{'tableName':_0x7147('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3321=['./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash','util','moment','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3321,0x7b));var _0x1332=function(_0x1750a5,_0x4e2311){_0x1750a5=_0x1750a5-0x0;var _0x17c181=_0x3321[_0x1750a5];return _0x17c181;};'use strict';var _=require(_0x1332('0x0'));var util=require(_0x1332('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1332('0x2'));var BPromise=require('bluebird');var rp=require(_0x1332('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1332('0x4'));var attributes=require(_0x1332('0x5'));module['exports']=function(_0x3d8590,_0x3083bc){return _0x3d8590['define'](_0x1332('0x6'),attributes,{'tableName':_0x1332('0x7'),'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 8e885cc..66fdd38 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 _0xf008=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','MailServerIn','findAll','options','attributes','limit','map','include','model','then','GetMailServerIn','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x976ccd,_0x5511d1){var _0x5e32fc=function(_0x56ff7d){while(--_0x56ff7d){_0x976ccd['push'](_0x976ccd['shift']());}};_0x5e32fc(++_0x5511d1);}(_0xf008,0x1c8));var _0x8f00=function(_0x1b171f,_0x7f8b3d){_0x1b171f=_0x1b171f-0x0;var _0x1f8b29=_0xf008[_0x1b171f];return _0x1f8b29;};'use strict';var _=require(_0x8f00('0x0'));var util=require(_0x8f00('0x1'));var moment=require(_0x8f00('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f00('0x3'));var fs=require('fs');var Redis=require(_0x8f00('0x4'));var db=require(_0x8f00('0x5'))['db'];var utils=require(_0x8f00('0x6'));var logger=require(_0x8f00('0x7'))(_0x8f00('0x8'));var config=require(_0x8f00('0x9'));var jayson=require(_0x8f00('0xa'));var client=jayson['client'][_0x8f00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ac0b1,_0x35f900,_0xa4b452){return new BPromise(function(_0x4f2182,_0x39d6ad){return client[_0x8f00('0xc')](_0x5ac0b1,_0xa4b452)['then'](function(_0x1c53d9){logger[_0x8f00('0xd')]('MailServerIn,\x20%s,\x20%s',_0x35f900,_0x8f00('0xe'));logger[_0x8f00('0xf')](_0x8f00('0x10'),_0x35f900,'request\x20sent',JSON[_0x8f00('0x11')](_0x1c53d9));if(_0x1c53d9[_0x8f00('0x12')]){if(_0x1c53d9[_0x8f00('0x12')]['code']===0x1f4){logger[_0x8f00('0x12')](_0x8f00('0x13'),_0x35f900,_0x1c53d9[_0x8f00('0x12')][_0x8f00('0x14')]);return _0x39d6ad(_0x1c53d9['error'][_0x8f00('0x14')]);}logger[_0x8f00('0x12')](_0x8f00('0x13'),_0x35f900,_0x1c53d9[_0x8f00('0x12')]['message']);return _0x4f2182(_0x1c53d9[_0x8f00('0x12')][_0x8f00('0x14')]);}else{logger['info'](_0x8f00('0x13'),_0x35f900,_0x8f00('0xe'));_0x4f2182(_0x1c53d9[_0x8f00('0x15')][_0x8f00('0x14')]);}})[_0x8f00('0x16')](function(_0x13b411){logger[_0x8f00('0x12')]('MailServerIn,\x20%s,\x20%s',_0x35f900,_0x13b411);_0x39d6ad(_0x13b411);});});}exports['GetMailServerIn']=function(_0x521da4){var _0x15d6c9=this;return new Promise(function(_0x202ce3,_0x1e780d){return db[_0x8f00('0x17')][_0x8f00('0x18')]({'raw':_0x521da4['options']?_0x521da4[_0x8f00('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x521da4[_0x8f00('0x19')]?_0x521da4[_0x8f00('0x19')]['where']||null:null,'attributes':_0x521da4[_0x8f00('0x19')]?_0x521da4[_0x8f00('0x19')][_0x8f00('0x1a')]||null:null,'limit':_0x521da4[_0x8f00('0x19')]?_0x521da4['options'][_0x8f00('0x1b')]||null:null,'include':_0x521da4[_0x8f00('0x19')]?_0x521da4[_0x8f00('0x19')]['include']?_[_0x8f00('0x1c')](_0x521da4[_0x8f00('0x19')][_0x8f00('0x1d')],function(_0x34fdfd){return{'model':db[_0x34fdfd[_0x8f00('0x1e')]],'as':_0x34fdfd['as'],'attributes':_0x34fdfd[_0x8f00('0x1a')],'include':_0x34fdfd['include']?_['map'](_0x34fdfd[_0x8f00('0x1d')],function(_0x210ddf){return{'model':db[_0x210ddf[_0x8f00('0x1e')]],'as':_0x210ddf['as'],'attributes':_0x210ddf['attributes'],'include':_0x210ddf[_0x8f00('0x1d')]?_[_0x8f00('0x1c')](_0x210ddf[_0x8f00('0x1d')],function(_0x1a7da3){return{'model':db[_0x1a7da3['model']],'as':_0x1a7da3['as'],'attributes':_0x1a7da3['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f00('0x1f')](function(_0x109e07){logger['info'](_0x8f00('0x20'),_0x521da4);logger[_0x8f00('0xf')](_0x8f00('0x20'),_0x521da4,JSON[_0x8f00('0x11')](_0x109e07));_0x202ce3(_0x109e07);})['catch'](function(_0x303433){logger[_0x8f00('0x12')](_0x8f00('0x20'),_0x303433[_0x8f00('0x14')],_0x521da4);_0x1e780d(_0x15d6c9[_0x8f00('0x12')](0x1f4,_0x303433[_0x8f00('0x14')]));});});}; \ No newline at end of file +var _0x6838=['rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','info','GetMailServerIn','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x84096f,_0x4359d1){var _0x33c9aa=function(_0x4be22d){while(--_0x4be22d){_0x84096f['push'](_0x84096f['shift']());}};_0x33c9aa(++_0x4359d1);}(_0x6838,0xa8));var _0x8683=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x6838[_0x44cb92];return _0x56b9e6;};'use strict';var _=require(_0x8683('0x0'));var util=require(_0x8683('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8683('0x2'));var fs=require('fs');var Redis=require(_0x8683('0x3'));var db=require(_0x8683('0x4'))['db'];var utils=require(_0x8683('0x5'));var logger=require(_0x8683('0x6'))(_0x8683('0x7'));var config=require(_0x8683('0x8'));var jayson=require(_0x8683('0x9'));var client=jayson[_0x8683('0xa')][_0x8683('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x515ac4,_0x421dae,_0x1d5ee2){return new BPromise(function(_0x15561e,_0x1651a2){return client[_0x8683('0xc')](_0x515ac4,_0x1d5ee2)[_0x8683('0xd')](function(_0x9d6c78){logger['info'](_0x8683('0xe'),_0x421dae,'request\x20sent');logger[_0x8683('0xf')](_0x8683('0x10'),_0x421dae,_0x8683('0x11'),JSON[_0x8683('0x12')](_0x9d6c78));if(_0x9d6c78[_0x8683('0x13')]){if(_0x9d6c78[_0x8683('0x13')]['code']===0x1f4){logger['error'](_0x8683('0xe'),_0x421dae,_0x9d6c78['error']['message']);return _0x1651a2(_0x9d6c78['error'][_0x8683('0x14')]);}logger['error'](_0x8683('0xe'),_0x421dae,_0x9d6c78['error'][_0x8683('0x14')]);return _0x15561e(_0x9d6c78[_0x8683('0x13')][_0x8683('0x14')]);}else{logger['info'](_0x8683('0xe'),_0x421dae,_0x8683('0x11'));_0x15561e(_0x9d6c78[_0x8683('0x15')][_0x8683('0x14')]);}})[_0x8683('0x16')](function(_0x458df6){logger[_0x8683('0x13')](_0x8683('0xe'),_0x421dae,_0x458df6);_0x1651a2(_0x458df6);});});}exports['GetMailServerIn']=function(_0x2669a4){var _0x20ba75=this;return new Promise(function(_0x4ffaf4,_0x32bd6c){return db[_0x8683('0x17')][_0x8683('0x18')]({'raw':_0x2669a4[_0x8683('0x19')]?_0x2669a4[_0x8683('0x19')][_0x8683('0x1a')]===undefined?!![]:![]:!![],'where':_0x2669a4[_0x8683('0x19')]?_0x2669a4[_0x8683('0x19')][_0x8683('0x1b')]||null:null,'attributes':_0x2669a4['options']?_0x2669a4[_0x8683('0x19')]['attributes']||null:null,'limit':_0x2669a4[_0x8683('0x19')]?_0x2669a4[_0x8683('0x19')][_0x8683('0x1c')]||null:null,'include':_0x2669a4[_0x8683('0x19')]?_0x2669a4[_0x8683('0x19')][_0x8683('0x1d')]?_[_0x8683('0x1e')](_0x2669a4['options'][_0x8683('0x1d')],function(_0x4a50db){return{'model':db[_0x4a50db[_0x8683('0x1f')]],'as':_0x4a50db['as'],'attributes':_0x4a50db[_0x8683('0x20')],'include':_0x4a50db[_0x8683('0x1d')]?_[_0x8683('0x1e')](_0x4a50db[_0x8683('0x1d')],function(_0x2b22fd){return{'model':db[_0x2b22fd[_0x8683('0x1f')]],'as':_0x2b22fd['as'],'attributes':_0x2b22fd['attributes'],'include':_0x2b22fd[_0x8683('0x1d')]?_['map'](_0x2b22fd[_0x8683('0x1d')],function(_0x7a3552){return{'model':db[_0x7a3552[_0x8683('0x1f')]],'as':_0x7a3552['as'],'attributes':_0x7a3552[_0x8683('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8683('0xd')](function(_0x396351){logger[_0x8683('0x21')](_0x8683('0x22'),_0x2669a4);logger[_0x8683('0xf')]('GetMailServerIn',_0x2669a4,JSON[_0x8683('0x12')](_0x396351));_0x4ffaf4(_0x396351);})['catch'](function(_0x5cd2be){logger['error']('GetMailServerIn',_0x5cd2be[_0x8683('0x14')],_0x2669a4);_0x32bd6c(_0x20ba75[_0x8683('0x13')](0x1f4,_0x5cd2be[_0x8683('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index a9af69b..e207d8c 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _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(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7a54,0x106));var _0x47a5=function(_0x3c6438,_0x43f524){_0x3c6438=_0x3c6438-0x0;var _0x2a972e=_0x7a54[_0x3c6438];return _0x2a972e;};'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 cbf3b89..5c5cdb9 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 _0x1e11=['STRING','BOOLEAN'];(function(_0xe566c2,_0x531a3c){var _0x3c42cd=function(_0x4b80c6){while(--_0x4b80c6){_0xe566c2['push'](_0xe566c2['shift']());}};_0x3c42cd(++_0x531a3c);}(_0x1e11,0xe4));var _0x11e1=function(_0x1c5271,_0x3e1c2a){_0x1c5271=_0x1c5271-0x0;var _0x5a71e4=_0x1e11[_0x1c5271];return _0x5a71e4;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x11e1('0x0')]},'host':{'type':Sequelize[_0x11e1('0x0')]},'user':{'type':Sequelize[_0x11e1('0x0')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x11e1('0x1')],'defaultValue':![]},'service':{'type':Sequelize[_0x11e1('0x0')]},'authentication':{'type':Sequelize[_0x11e1('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x99a0=['BOOLEAN','sequelize','exports','INTEGER'];(function(_0x4486bd,_0xb3d92f){var _0xa271df=function(_0x37a04d){while(--_0x37a04d){_0x4486bd['push'](_0x4486bd['shift']());}};_0xa271df(++_0xb3d92f);}(_0x99a0,0x121));var _0x099a=function(_0x48e141,_0x50a679){_0x48e141=_0x48e141-0x0;var _0x127c0f=_0x99a0[_0x48e141];return _0x127c0f;};'use strict';var Sequelize=require(_0x099a('0x0'));module[_0x099a('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x099a('0x2')]},'secure':{'type':Sequelize[_0x099a('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x099a('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index b3bb4cf..910ef7f 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 _0x3b65=['attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','merge','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','intersection'];(function(_0xbe96a7,_0x1adac0){var _0x4769e2=function(_0x4b2f1f){while(--_0x4b2f1f){_0xbe96a7['push'](_0xbe96a7['shift']());}};_0x4769e2(++_0x1adac0);}(_0x3b65,0xef));var _0x53b6=function(_0x4667c2,_0x19811f){_0x4667c2=_0x4667c2-0x0;var _0x1cc2f6=_0x3b65[_0x4667c2];return _0x1cc2f6;};'use strict';var emlformat=require(_0x53b6('0x0'));var rimraf=require(_0x53b6('0x1'));var zipdir=require(_0x53b6('0x2'));var jsonpatch=require(_0x53b6('0x3'));var rp=require(_0x53b6('0x4'));var moment=require(_0x53b6('0x5'));var BPromise=require(_0x53b6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53b6('0x7'));var sox=require(_0x53b6('0x8'));var csv=require(_0x53b6('0x9'));var ejs=require(_0x53b6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53b6('0xb'));var squel=require(_0x53b6('0xc'));var crypto=require(_0x53b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x53b6('0xe'));var toCsv=require(_0x53b6('0x9'));var querystring=require(_0x53b6('0xf'));var Papa=require(_0x53b6('0x10'));var Redis=require('ioredis');var authService=require(_0x53b6('0x11'));var qs=require(_0x53b6('0x12'));var as=require(_0x53b6('0x13'));var hardwareService=require(_0x53b6('0x14'));var logger=require(_0x53b6('0x15'))(_0x53b6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53b6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x406bdc,_0x1d3fc8){_0x1d3fc8=_0x1d3fc8||0xcc;return function(_0xe1318f){if(_0xe1318f){return _0x406bdc[_0x53b6('0x18')](_0x1d3fc8);}return _0x406bdc[_0x53b6('0x19')](_0x1d3fc8)[_0x53b6('0x1a')]();};}function respondWithResult(_0x4251b2,_0x228319){_0x228319=_0x228319||0xc8;return function(_0x24d5d4){if(_0x24d5d4){return _0x4251b2[_0x53b6('0x19')](_0x228319)[_0x53b6('0x1b')](_0x24d5d4);}};}function respondWithFilteredResult(_0x2cb022,_0x96f85e){return function(_0x5915db){if(_0x5915db){var _0x3def1e=typeof _0x96f85e[_0x53b6('0x1c')]===_0x53b6('0x1d')&&typeof _0x96f85e[_0x53b6('0x1e')]===_0x53b6('0x1d');var _0x5870ef=_0x5915db[_0x53b6('0x1f')];var _0x5e5341=_0x3def1e?0x0:_0x96f85e[_0x53b6('0x1c')];var _0x5ac8ad=_0x3def1e?_0x5915db[_0x53b6('0x1f')]:_0x96f85e[_0x53b6('0x1c')]+_0x96f85e['limit'];var _0xfdd56f;if(_0x5ac8ad>=_0x5870ef){_0x5ac8ad=_0x5870ef;_0xfdd56f=0xc8;}else{_0xfdd56f=0xce;}_0x2cb022[_0x53b6('0x19')](_0xfdd56f);return _0x2cb022[_0x53b6('0x20')](_0x53b6('0x21'),_0x5e5341+'-'+_0x5ac8ad+'/'+_0x5870ef)[_0x53b6('0x1b')](_0x5915db);}return null;};}function patchUpdates(_0x483d00){return function(_0x3eaf5b){try{jsonpatch['apply'](_0x3eaf5b,_0x483d00,!![]);}catch(_0x515fac){return BPromise['reject'](_0x515fac);}return _0x3eaf5b['save']();};}function saveUpdates(_0x1d58b3,_0x4a5d4f){return function(_0x4d012e){if(_0x4d012e){return _0x4d012e[_0x53b6('0x22')](_0x1d58b3)[_0x53b6('0x23')](function(_0x221415){return _0x221415;});}return null;};}function removeEntity(_0x47dbbd,_0x7f7ec3){return function(_0x2939b5){if(_0x2939b5){return _0x2939b5[_0x53b6('0x24')]()[_0x53b6('0x23')](function(){_0x47dbbd[_0x53b6('0x19')](0xcc)[_0x53b6('0x1a')]();});}};}function handleEntityNotFound(_0x5bd0e9,_0x19b013){return function(_0x31dfd6){if(!_0x31dfd6){_0x5bd0e9[_0x53b6('0x18')](0x194);}return _0x31dfd6;};}function handleError(_0x4abe3e,_0x507364){_0x507364=_0x507364||0x1f4;return function(_0x21f854){logger[_0x53b6('0x25')](_0x21f854['stack']);if(_0x21f854[_0x53b6('0x26')]){delete _0x21f854[_0x53b6('0x26')];}_0x4abe3e[_0x53b6('0x19')](_0x507364)[_0x53b6('0x27')](_0x21f854);};}exports[_0x53b6('0x28')]=function(_0x3f9839,_0x40324b){var _0x159f68={},_0x4bbf07={},_0x53edff={'count':0x0,'rows':[]};var _0x403974=_[_0x53b6('0x29')](db[_0x53b6('0x2a')][_0x53b6('0x2b')],function(_0x57e47e){return{'name':_0x57e47e['fieldName'],'type':_0x57e47e[_0x53b6('0x2c')][_0x53b6('0x2d')]};});_0x4bbf07[_0x53b6('0x2e')]=_[_0x53b6('0x29')](_0x403974,_0x53b6('0x26'));_0x4bbf07[_0x53b6('0x2f')]=_['keys'](_0x3f9839[_0x53b6('0x2f')]);_0x4bbf07['filters']=_[_0x53b6('0x30')](_0x4bbf07[_0x53b6('0x2e')],_0x4bbf07[_0x53b6('0x2f')]);_0x159f68[_0x53b6('0x31')]=_['intersection'](_0x4bbf07[_0x53b6('0x2e')],qs[_0x53b6('0x32')](_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x32')]));_0x159f68[_0x53b6('0x31')]=_0x159f68[_0x53b6('0x31')][_0x53b6('0x33')]?_0x159f68[_0x53b6('0x31')]:_0x4bbf07[_0x53b6('0x2e')];if(!_0x3f9839['query']['hasOwnProperty'](_0x53b6('0x34'))){_0x159f68[_0x53b6('0x1e')]=qs['limit'](_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x1e')]);_0x159f68[_0x53b6('0x1c')]=qs[_0x53b6('0x1c')](_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x1c')]);}_0x159f68[_0x53b6('0x35')]=qs[_0x53b6('0x36')](_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x36')]);_0x159f68[_0x53b6('0x37')]=qs[_0x53b6('0x38')](_['pick'](_0x3f9839[_0x53b6('0x2f')],_0x4bbf07[_0x53b6('0x38')]),_0x403974);if(_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x39')]){_0x159f68[_0x53b6('0x37')]=_['merge'](_0x159f68[_0x53b6('0x37')],{'$or':_[_0x53b6('0x29')](_0x403974,function(_0x5725cc){if(_0x5725cc['type']!==_0x53b6('0x3a')){var _0x31aec8={};_0x31aec8[_0x5725cc[_0x53b6('0x26')]]={'$like':'%'+_0x3f9839['query']['filter']+'%'};return _0x31aec8;}})});}_0x159f68=_['merge']({},_0x159f68,_0x3f9839['options']);var _0x8ef961={'where':_0x159f68[_0x53b6('0x37')]};return db[_0x53b6('0x2a')][_0x53b6('0x1f')](_0x8ef961)[_0x53b6('0x23')](function(_0xf16a87){_0x53edff[_0x53b6('0x1f')]=_0xf16a87;if(_0x3f9839['query']['includeAll']){_0x159f68[_0x53b6('0x3b')]=[{'all':!![]}];}return db[_0x53b6('0x2a')][_0x53b6('0x3c')](_0x159f68);})[_0x53b6('0x23')](function(_0xd20f65){_0x53edff[_0x53b6('0x3d')]=_0xd20f65;return _0x53edff;})[_0x53b6('0x23')](respondWithFilteredResult(_0x40324b,_0x159f68))['catch'](handleError(_0x40324b,null));};exports[_0x53b6('0x3e')]=function(_0x420b3b,_0xfb4a1b){var _0x4b5b62={'raw':!![],'where':{'id':_0x420b3b[_0x53b6('0x3f')]['id']}},_0x5d4a72={};_0x5d4a72[_0x53b6('0x2e')]=_[_0x53b6('0x40')](db[_0x53b6('0x2a')][_0x53b6('0x2b')]);_0x5d4a72[_0x53b6('0x2f')]=_[_0x53b6('0x40')](_0x420b3b[_0x53b6('0x2f')]);_0x5d4a72[_0x53b6('0x38')]=_[_0x53b6('0x30')](_0x5d4a72[_0x53b6('0x2e')],_0x5d4a72[_0x53b6('0x2f')]);_0x4b5b62[_0x53b6('0x31')]=_[_0x53b6('0x30')](_0x5d4a72[_0x53b6('0x2e')],qs[_0x53b6('0x32')](_0x420b3b[_0x53b6('0x2f')][_0x53b6('0x32')]));_0x4b5b62[_0x53b6('0x31')]=_0x4b5b62[_0x53b6('0x31')][_0x53b6('0x33')]?_0x4b5b62[_0x53b6('0x31')]:_0x5d4a72['model'];if(_0x420b3b[_0x53b6('0x2f')][_0x53b6('0x41')]){_0x4b5b62['include']=[{'all':!![]}];}_0x4b5b62=_[_0x53b6('0x42')]({},_0x4b5b62,_0x420b3b[_0x53b6('0x43')]);return db[_0x53b6('0x2a')]['find'](_0x4b5b62)[_0x53b6('0x23')](handleEntityNotFound(_0xfb4a1b,null))[_0x53b6('0x23')](respondWithResult(_0xfb4a1b,null))[_0x53b6('0x44')](handleError(_0xfb4a1b,null));};exports['create']=function(_0x4e441d,_0x1bb0a5){return db[_0x53b6('0x2a')][_0x53b6('0x45')](_0x4e441d[_0x53b6('0x46')],{})[_0x53b6('0x23')](respondWithResult(_0x1bb0a5,0xc9))[_0x53b6('0x44')](handleError(_0x1bb0a5,null));};exports['update']=function(_0x1b50b7,_0x582a58){if(_0x1b50b7[_0x53b6('0x46')]['id']){delete _0x1b50b7[_0x53b6('0x46')]['id'];}return db['MailServerOut'][_0x53b6('0x47')]({'where':{'id':_0x1b50b7[_0x53b6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x582a58,null))[_0x53b6('0x23')](saveUpdates(_0x1b50b7['body'],null))[_0x53b6('0x23')](respondWithResult(_0x582a58,null))[_0x53b6('0x44')](handleError(_0x582a58,null));};exports[_0x53b6('0x24')]=function(_0xa3645e,_0x49092f){return db['MailServerOut'][_0x53b6('0x47')]({'where':{'id':_0xa3645e[_0x53b6('0x3f')]['id']}})[_0x53b6('0x23')](handleEntityNotFound(_0x49092f,null))['then'](removeEntity(_0x49092f,null))['catch'](handleError(_0x49092f,null));}; \ No newline at end of file +var _0x11ed=['ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','MailServerOut','rawAttributes','key','map','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','params','keys','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x11ed,0x14a));var _0xd11e=function(_0x214651,_0xdaf678){_0x214651=_0x214651-0x0;var _0x1c0783=_0x11ed[_0x214651];return _0x1c0783;};'use strict';var emlformat=require(_0xd11e('0x0'));var rimraf=require(_0xd11e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd11e('0x2'));var rp=require(_0xd11e('0x3'));var moment=require(_0xd11e('0x4'));var BPromise=require(_0xd11e('0x5'));var Mustache=require(_0xd11e('0x6'));var util=require(_0xd11e('0x7'));var path=require('path');var sox=require(_0xd11e('0x8'));var csv=require(_0xd11e('0x9'));var ejs=require(_0xd11e('0xa'));var fs=require('fs');var fs_extra=require(_0xd11e('0xb'));var _=require(_0xd11e('0xc'));var squel=require('squel');var crypto=require(_0xd11e('0xd'));var jsforce=require(_0xd11e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd11e('0xf'));var Redis=require(_0xd11e('0x10'));var authService=require(_0xd11e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd11e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd11e('0x13'));var config=require(_0xd11e('0x14'));var licenseUtil=require(_0xd11e('0x15'));var db=require(_0xd11e('0x16'))['db'];function respondWithStatusCode(_0x2f06e9,_0xb6b2d1){_0xb6b2d1=_0xb6b2d1||0xcc;return function(_0x590e28){if(_0x590e28){return _0x2f06e9[_0xd11e('0x17')](_0xb6b2d1);}return _0x2f06e9[_0xd11e('0x18')](_0xb6b2d1)[_0xd11e('0x19')]();};}function respondWithResult(_0x2e88ad,_0x48ab8b){_0x48ab8b=_0x48ab8b||0xc8;return function(_0x2e14db){if(_0x2e14db){return _0x2e88ad[_0xd11e('0x18')](_0x48ab8b)[_0xd11e('0x1a')](_0x2e14db);}};}function respondWithFilteredResult(_0x39fafd,_0x535a0e){return function(_0x14535a){if(_0x14535a){var _0x394556=typeof _0x535a0e[_0xd11e('0x1b')]===_0xd11e('0x1c')&&typeof _0x535a0e[_0xd11e('0x1d')]===_0xd11e('0x1c');var _0x2d5bf8=_0x14535a[_0xd11e('0x1e')];var _0x1167f3=_0x394556?0x0:_0x535a0e[_0xd11e('0x1b')];var _0x381ac1=_0x394556?_0x14535a[_0xd11e('0x1e')]:_0x535a0e[_0xd11e('0x1b')]+_0x535a0e[_0xd11e('0x1d')];var _0x20ad7b;if(_0x381ac1>=_0x2d5bf8){_0x381ac1=_0x2d5bf8;_0x20ad7b=0xc8;}else{_0x20ad7b=0xce;}_0x39fafd[_0xd11e('0x18')](_0x20ad7b);return _0x39fafd[_0xd11e('0x1f')]('Content-Range',_0x1167f3+'-'+_0x381ac1+'/'+_0x2d5bf8)[_0xd11e('0x1a')](_0x14535a);}return null;};}function patchUpdates(_0x275646){return function(_0x3fe61b){try{jsonpatch['apply'](_0x3fe61b,_0x275646,!![]);}catch(_0xa5c8e5){return BPromise[_0xd11e('0x20')](_0xa5c8e5);}return _0x3fe61b[_0xd11e('0x21')]();};}function saveUpdates(_0x193365,_0x2807a0){return function(_0x1740e7){if(_0x1740e7){return _0x1740e7[_0xd11e('0x22')](_0x193365)[_0xd11e('0x23')](function(_0x2a4191){return _0x2a4191;});}return null;};}function removeEntity(_0x3538a0,_0x397d85){return function(_0x4b31de){if(_0x4b31de){return _0x4b31de['destroy']()[_0xd11e('0x23')](function(){_0x3538a0[_0xd11e('0x18')](0xcc)[_0xd11e('0x19')]();});}};}function handleEntityNotFound(_0x22f2ec,_0xd1f2cc){return function(_0x19fb92){if(!_0x19fb92){_0x22f2ec[_0xd11e('0x17')](0x194);}return _0x19fb92;};}function handleError(_0x1f02ac,_0x49faeb){_0x49faeb=_0x49faeb||0x1f4;return function(_0x2f1fd4){logger[_0xd11e('0x24')](_0x2f1fd4['stack']);if(_0x2f1fd4[_0xd11e('0x25')]){delete _0x2f1fd4['name'];}_0x1f02ac[_0xd11e('0x18')](_0x49faeb)['send'](_0x2f1fd4);};}exports['index']=function(_0x3d8bed,_0x9e7209){var _0x17e900={},_0xcbe532={},_0x870f47={'count':0x0,'rows':[]};var _0x109b34=_['map'](db[_0xd11e('0x26')][_0xd11e('0x27')],function(_0x3923d7){return{'name':_0x3923d7['fieldName'],'type':_0x3923d7['type'][_0xd11e('0x28')]};});_0xcbe532['model']=_[_0xd11e('0x29')](_0x109b34,_0xd11e('0x25'));_0xcbe532[_0xd11e('0x2a')]=_['keys'](_0x3d8bed[_0xd11e('0x2a')]);_0xcbe532[_0xd11e('0x2b')]=_['intersection'](_0xcbe532[_0xd11e('0x2c')],_0xcbe532[_0xd11e('0x2a')]);_0x17e900[_0xd11e('0x2d')]=_[_0xd11e('0x2e')](_0xcbe532['model'],qs[_0xd11e('0x2f')](_0x3d8bed['query'][_0xd11e('0x2f')]));_0x17e900[_0xd11e('0x2d')]=_0x17e900[_0xd11e('0x2d')][_0xd11e('0x30')]?_0x17e900['attributes']:_0xcbe532[_0xd11e('0x2c')];if(!_0x3d8bed['query']['hasOwnProperty'](_0xd11e('0x31'))){_0x17e900[_0xd11e('0x1d')]=qs[_0xd11e('0x1d')](_0x3d8bed['query'][_0xd11e('0x1d')]);_0x17e900[_0xd11e('0x1b')]=qs[_0xd11e('0x1b')](_0x3d8bed[_0xd11e('0x2a')]['offset']);}_0x17e900[_0xd11e('0x32')]=qs[_0xd11e('0x33')](_0x3d8bed[_0xd11e('0x2a')][_0xd11e('0x33')]);_0x17e900[_0xd11e('0x34')]=qs[_0xd11e('0x2b')](_[_0xd11e('0x35')](_0x3d8bed[_0xd11e('0x2a')],_0xcbe532[_0xd11e('0x2b')]),_0x109b34);if(_0x3d8bed['query'][_0xd11e('0x36')]){_0x17e900[_0xd11e('0x34')]=_[_0xd11e('0x37')](_0x17e900['where'],{'$or':_[_0xd11e('0x29')](_0x109b34,function(_0x1c16cc){if(_0x1c16cc[_0xd11e('0x38')]!=='VIRTUAL'){var _0x1a051b={};_0x1a051b[_0x1c16cc['name']]={'$like':'%'+_0x3d8bed[_0xd11e('0x2a')][_0xd11e('0x36')]+'%'};return _0x1a051b;}})});}_0x17e900=_['merge']({},_0x17e900,_0x3d8bed[_0xd11e('0x39')]);var _0x1d8df0={'where':_0x17e900['where']};return db['MailServerOut']['count'](_0x1d8df0)[_0xd11e('0x23')](function(_0x4e7bcf){_0x870f47[_0xd11e('0x1e')]=_0x4e7bcf;if(_0x3d8bed['query'][_0xd11e('0x3a')]){_0x17e900['include']=[{'all':!![]}];}return db['MailServerOut'][_0xd11e('0x3b')](_0x17e900);})['then'](function(_0x48664c){_0x870f47[_0xd11e('0x3c')]=_0x48664c;return _0x870f47;})[_0xd11e('0x23')](respondWithFilteredResult(_0x9e7209,_0x17e900))[_0xd11e('0x3d')](handleError(_0x9e7209,null));};exports['show']=function(_0x29fc1f,_0x131d82){var _0x1e0b34={'raw':!![],'where':{'id':_0x29fc1f[_0xd11e('0x3e')]['id']}},_0x4d55a2={};_0x4d55a2[_0xd11e('0x2c')]=_[_0xd11e('0x3f')](db['MailServerOut'][_0xd11e('0x27')]);_0x4d55a2['query']=_[_0xd11e('0x3f')](_0x29fc1f['query']);_0x4d55a2[_0xd11e('0x2b')]=_[_0xd11e('0x2e')](_0x4d55a2[_0xd11e('0x2c')],_0x4d55a2[_0xd11e('0x2a')]);_0x1e0b34[_0xd11e('0x2d')]=_[_0xd11e('0x2e')](_0x4d55a2[_0xd11e('0x2c')],qs[_0xd11e('0x2f')](_0x29fc1f['query']['fields']));_0x1e0b34[_0xd11e('0x2d')]=_0x1e0b34[_0xd11e('0x2d')][_0xd11e('0x30')]?_0x1e0b34[_0xd11e('0x2d')]:_0x4d55a2[_0xd11e('0x2c')];if(_0x29fc1f[_0xd11e('0x2a')][_0xd11e('0x3a')]){_0x1e0b34['include']=[{'all':!![]}];}_0x1e0b34=_[_0xd11e('0x37')]({},_0x1e0b34,_0x29fc1f['options']);return db[_0xd11e('0x26')][_0xd11e('0x40')](_0x1e0b34)[_0xd11e('0x23')](handleEntityNotFound(_0x131d82,null))[_0xd11e('0x23')](respondWithResult(_0x131d82,null))['catch'](handleError(_0x131d82,null));};exports[_0xd11e('0x41')]=function(_0x14c2ac,_0x128702){return db[_0xd11e('0x26')][_0xd11e('0x41')](_0x14c2ac[_0xd11e('0x42')],{})[_0xd11e('0x23')](respondWithResult(_0x128702,0xc9))[_0xd11e('0x3d')](handleError(_0x128702,null));};exports[_0xd11e('0x22')]=function(_0x2e7342,_0x22c8f0){if(_0x2e7342['body']['id']){delete _0x2e7342[_0xd11e('0x42')]['id'];}return db[_0xd11e('0x26')][_0xd11e('0x40')]({'where':{'id':_0x2e7342[_0xd11e('0x3e')]['id']}})[_0xd11e('0x23')](handleEntityNotFound(_0x22c8f0,null))[_0xd11e('0x23')](saveUpdates(_0x2e7342[_0xd11e('0x42')],null))['then'](respondWithResult(_0x22c8f0,null))[_0xd11e('0x3d')](handleError(_0x22c8f0,null));};exports[_0xd11e('0x43')]=function(_0x48f700,_0x29b578){return db['MailServerOut'][_0xd11e('0x40')]({'where':{'id':_0x48f700[_0xd11e('0x3e')]['id']}})[_0xd11e('0x23')](handleEntityNotFound(_0x29b578,null))[_0xd11e('0x23')](removeEntity(_0x29b578,null))[_0xd11e('0x3d')](handleError(_0x29b578,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 311bcfc..4f89deb 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 _0x8eb6=['request-promise','rimraf','../../config/environment','exports','define','mail_servers_out','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8eb6,0x187));var _0x68eb=function(_0x38fc40,_0x59df40){_0x38fc40=_0x38fc40-0x0;var _0x3d49b9=_0x8eb6[_0x38fc40];return _0x3d49b9;};'use strict';var _=require(_0x68eb('0x0'));var util=require(_0x68eb('0x1'));var logger=require(_0x68eb('0x2'))('api');var moment=require(_0x68eb('0x3'));var BPromise=require(_0x68eb('0x4'));var rp=require(_0x68eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68eb('0x6'));var config=require(_0x68eb('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x68eb('0x8')]=function(_0x2f5dbf,_0xaa0931){return _0x2f5dbf[_0x68eb('0x9')]('MailServerOut',attributes,{'tableName':_0x68eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ae5=['request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','../../config/logger','api','bluebird'];(function(_0x4d41ec,_0x182db0){var _0xf39b9d=function(_0xe7d59a){while(--_0xe7d59a){_0x4d41ec['push'](_0x4d41ec['shift']());}};_0xf39b9d(++_0x182db0);}(_0x1ae5,0x7f));var _0x51ae=function(_0x500307,_0x2f8e3c){_0x500307=_0x500307-0x0;var _0x3c7374=_0x1ae5[_0x500307];return _0x3c7374;};'use strict';var _=require(_0x51ae('0x0'));var util=require(_0x51ae('0x1'));var logger=require(_0x51ae('0x2'))(_0x51ae('0x3'));var moment=require('moment');var BPromise=require(_0x51ae('0x4'));var rp=require(_0x51ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51ae('0x6'));var config=require(_0x51ae('0x7'));var attributes=require(_0x51ae('0x8'));module[_0x51ae('0x9')]=function(_0x984181,_0x375d88){return _0x984181[_0x51ae('0xa')]('MailServerOut',attributes,{'tableName':_0x51ae('0xb'),'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 ee426f6..b3b0f38 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x13ea30,_0x3c1416){var _0x1d7712=function(_0x43d0b4){while(--_0x43d0b4){_0x13ea30['push'](_0x13ea30['shift']());}};_0x1d7712(++_0x3c1416);}(_0xdb28,0x106));var _0x8db2=function(_0x5487b7,_0x19ac52){_0x5487b7=_0x5487b7-0x0;var _0x3b7125=_0xdb28[_0x5487b7];return _0x3b7125;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x33d431,_0xf591fb){var _0xad1bc8=function(_0x3c0b5a){while(--_0x3c0b5a){_0x33d431['push'](_0x33d431['shift']());}};_0xad1bc8(++_0xf591fb);}(_0xadb5,0xad));var _0x5adb=function(_0x78a7e9,_0x4900e9){_0x78a7e9=_0x78a7e9-0x0;var _0x4a1f90=_0xadb5[_0x78a7e9];return _0x4a1f90;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c90d5e2..84d28b0 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 _0x530a=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update'];(function(_0x1c100b,_0x5e17a0){var _0x2417fe=function(_0x4f5756){while(--_0x4f5756){_0x1c100b['push'](_0x1c100b['shift']());}};_0x2417fe(++_0x5e17a0);}(_0x530a,0x1ba));var _0xa530=function(_0xaa99e0,_0x961890){_0xaa99e0=_0xaa99e0-0x0;var _0x41a55c=_0x530a[_0xaa99e0];return _0x41a55c;};'use strict';var multer=require('multer');var util=require(_0xa530('0x0'));var path=require(_0xa530('0x1'));var timeout=require(_0xa530('0x2'));var express=require(_0xa530('0x3'));var router=express[_0xa530('0x4')]();var fs_extra=require(_0xa530('0x5'));var auth=require(_0xa530('0x6'));var interaction=require(_0xa530('0x7'));var config=require(_0xa530('0x8'));var controller=require(_0xa530('0x9'));router[_0xa530('0xa')]('/',auth[_0xa530('0xb')](),controller[_0xa530('0xc')]);router[_0xa530('0xa')](_0xa530('0xd'),auth[_0xa530('0xb')](),controller[_0xa530('0xe')]);router[_0xa530('0xa')]('/:id',auth[_0xa530('0xb')](),controller[_0xa530('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa530('0x10')]);router[_0xa530('0x11')](_0xa530('0x12'),auth[_0xa530('0xb')](),controller[_0xa530('0x13')]);router['delete']('/:id',auth[_0xa530('0xb')](),controller[_0xa530('0x14')]);module[_0xa530('0x15')]=router; \ No newline at end of file +var _0x9ee9=['delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0x9ee9,0x1a7));var _0x99ee=function(_0x2dc3b9,_0x297c1c){_0x2dc3b9=_0x2dc3b9-0x0;var _0x4041f6=_0x9ee9[_0x2dc3b9];return _0x4041f6;};'use strict';var multer=require('multer');var util=require(_0x99ee('0x0'));var path=require(_0x99ee('0x1'));var timeout=require(_0x99ee('0x2'));var express=require('express');var router=express[_0x99ee('0x3')]();var fs_extra=require(_0x99ee('0x4'));var auth=require(_0x99ee('0x5'));var interaction=require(_0x99ee('0x6'));var config=require(_0x99ee('0x7'));var controller=require(_0x99ee('0x8'));router[_0x99ee('0x9')]('/',auth['isAuthenticated'](),controller[_0x99ee('0xa')]);router[_0x99ee('0x9')](_0x99ee('0xb'),auth[_0x99ee('0xc')](),controller[_0x99ee('0xd')]);router[_0x99ee('0x9')](_0x99ee('0xe'),auth[_0x99ee('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x99ee('0xf')]);router[_0x99ee('0x10')](_0x99ee('0xe'),auth['isAuthenticated'](),controller[_0x99ee('0x11')]);router[_0x99ee('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x99ee('0x13')]);module[_0x99ee('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 902174c..a9eb9ed 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 _0x4074=['sequelize','exports','STRING'];(function(_0x507016,_0x4ee4c5){var _0x13b1cc=function(_0x1c2379){while(--_0x1c2379){_0x507016['push'](_0x507016['shift']());}};_0x13b1cc(++_0x4ee4c5);}(_0x4074,0xf0));var _0x4407=function(_0x4e6b46,_0x21220a){_0x4e6b46=_0x4e6b46-0x0;var _0x43195c=_0x4074[_0x4e6b46];return _0x43195c;};'use strict';var Sequelize=require(_0x4407('0x0'));module[_0x4407('0x1')]={'name':{'type':Sequelize[_0x4407('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4407('0x2')]}}; \ No newline at end of file +var _0x8819=['STRING','name'];(function(_0x51a885,_0x2b626a){var _0x2a49a4=function(_0x53f190){while(--_0x53f190){_0x51a885['push'](_0x51a885['shift']());}};_0x2a49a4(++_0x2b626a);}(_0x8819,0x94));var _0x9881=function(_0x3f4cd7,_0x1a1ec3){_0x3f4cd7=_0x3f4cd7-0x0;var _0x54ec94=_0x8819[_0x3f4cd7];return _0x54ec94;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9881('0x0')],'unique':_0x9881('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9881('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d19f46b..6a27471 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 _0xe9bc=['options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','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','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','name','send','index','map','MailSubstatus','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xe9bc,0x16f));var _0xce9b=function(_0x4dcd79,_0x4b9727){_0x4dcd79=_0x4dcd79-0x0;var _0x433659=_0xe9bc[_0x4dcd79];return _0x433659;};'use strict';var emlformat=require(_0xce9b('0x0'));var rimraf=require(_0xce9b('0x1'));var zipdir=require(_0xce9b('0x2'));var jsonpatch=require(_0xce9b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce9b('0x4'));var Mustache=require(_0xce9b('0x5'));var util=require(_0xce9b('0x6'));var path=require(_0xce9b('0x7'));var sox=require(_0xce9b('0x8'));var csv=require(_0xce9b('0x9'));var ejs=require(_0xce9b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce9b('0xb'));var squel=require('squel');var crypto=require(_0xce9b('0xc'));var jsforce=require(_0xce9b('0xd'));var deskjs=require(_0xce9b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xce9b('0xf'));var Papa=require('papaparse');var Redis=require(_0xce9b('0x10'));var authService=require(_0xce9b('0x11'));var qs=require(_0xce9b('0x12'));var as=require(_0xce9b('0x13'));var hardwareService=require(_0xce9b('0x14'));var logger=require(_0xce9b('0x15'))(_0xce9b('0x16'));var utils=require(_0xce9b('0x17'));var config=require(_0xce9b('0x18'));var licenseUtil=require(_0xce9b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x285bda,_0x1062f1){_0x1062f1=_0x1062f1||0xcc;return function(_0x3c3feb){if(_0x3c3feb){return _0x285bda[_0xce9b('0x1a')](_0x1062f1);}return _0x285bda[_0xce9b('0x1b')](_0x1062f1)[_0xce9b('0x1c')]();};}function respondWithResult(_0x172fd7,_0x5517e6){_0x5517e6=_0x5517e6||0xc8;return function(_0x44ece1){if(_0x44ece1){return _0x172fd7['status'](_0x5517e6)[_0xce9b('0x1d')](_0x44ece1);}};}function respondWithFilteredResult(_0x46e995,_0x3362ed){return function(_0x122488){if(_0x122488){var _0x352e56=typeof _0x3362ed[_0xce9b('0x1e')]===_0xce9b('0x1f')&&typeof _0x3362ed[_0xce9b('0x20')]===_0xce9b('0x1f');var _0x538d5c=_0x122488[_0xce9b('0x21')];var _0x280f4e=_0x352e56?0x0:_0x3362ed[_0xce9b('0x1e')];var _0x41f43c=_0x352e56?_0x122488[_0xce9b('0x21')]:_0x3362ed[_0xce9b('0x1e')]+_0x3362ed[_0xce9b('0x20')];var _0x5c1dc0;if(_0x41f43c>=_0x538d5c){_0x41f43c=_0x538d5c;_0x5c1dc0=0xc8;}else{_0x5c1dc0=0xce;}_0x46e995[_0xce9b('0x1b')](_0x5c1dc0);return _0x46e995['set']('Content-Range',_0x280f4e+'-'+_0x41f43c+'/'+_0x538d5c)[_0xce9b('0x1d')](_0x122488);}return null;};}function patchUpdates(_0x32d81a){return function(_0x2a4a82){try{jsonpatch[_0xce9b('0x22')](_0x2a4a82,_0x32d81a,!![]);}catch(_0x2ed0aa){return BPromise[_0xce9b('0x23')](_0x2ed0aa);}return _0x2a4a82['save']();};}function saveUpdates(_0x8824f0,_0x46a3cb){return function(_0x1020a5){if(_0x1020a5){return _0x1020a5[_0xce9b('0x24')](_0x8824f0)[_0xce9b('0x25')](function(_0x3f3b35){return _0x3f3b35;});}return null;};}function removeEntity(_0x3da075,_0x40398e){return function(_0xdacf4e){if(_0xdacf4e){return _0xdacf4e[_0xce9b('0x26')]()[_0xce9b('0x25')](function(){_0x3da075[_0xce9b('0x1b')](0xcc)[_0xce9b('0x1c')]();});}};}function handleEntityNotFound(_0x5df51b,_0x2a5fb3){return function(_0x34e49f){if(!_0x34e49f){_0x5df51b[_0xce9b('0x1a')](0x194);}return _0x34e49f;};}function handleError(_0x5d5d36,_0x330de6){_0x330de6=_0x330de6||0x1f4;return function(_0x565781){logger['error'](_0x565781['stack']);if(_0x565781[_0xce9b('0x27')]){delete _0x565781[_0xce9b('0x27')];}_0x5d5d36[_0xce9b('0x1b')](_0x330de6)[_0xce9b('0x28')](_0x565781);};}exports[_0xce9b('0x29')]=function(_0x2686ab,_0x59f7b8){var _0x40df37={},_0x1e03d3={},_0x231835={'count':0x0,'rows':[]};var _0x21bb2b=_[_0xce9b('0x2a')](db[_0xce9b('0x2b')]['rawAttributes'],function(_0x20d619){return{'name':_0x20d619[_0xce9b('0x2c')],'type':_0x20d619[_0xce9b('0x2d')][_0xce9b('0x2e')]};});_0x1e03d3['model']=_[_0xce9b('0x2a')](_0x21bb2b,_0xce9b('0x27'));_0x1e03d3['query']=_[_0xce9b('0x2f')](_0x2686ab[_0xce9b('0x30')]);_0x1e03d3[_0xce9b('0x31')]=_[_0xce9b('0x32')](_0x1e03d3[_0xce9b('0x33')],_0x1e03d3[_0xce9b('0x30')]);_0x40df37[_0xce9b('0x34')]=_[_0xce9b('0x32')](_0x1e03d3[_0xce9b('0x33')],qs[_0xce9b('0x35')](_0x2686ab[_0xce9b('0x30')][_0xce9b('0x35')]));_0x40df37[_0xce9b('0x34')]=_0x40df37[_0xce9b('0x34')][_0xce9b('0x36')]?_0x40df37[_0xce9b('0x34')]:_0x1e03d3['model'];if(!_0x2686ab[_0xce9b('0x30')][_0xce9b('0x37')](_0xce9b('0x38'))){_0x40df37[_0xce9b('0x20')]=qs[_0xce9b('0x20')](_0x2686ab['query'][_0xce9b('0x20')]);_0x40df37[_0xce9b('0x1e')]=qs[_0xce9b('0x1e')](_0x2686ab[_0xce9b('0x30')][_0xce9b('0x1e')]);}_0x40df37[_0xce9b('0x39')]=qs[_0xce9b('0x3a')](_0x2686ab[_0xce9b('0x30')][_0xce9b('0x3a')]);_0x40df37[_0xce9b('0x3b')]=qs[_0xce9b('0x31')](_['pick'](_0x2686ab[_0xce9b('0x30')],_0x1e03d3[_0xce9b('0x31')]),_0x21bb2b);if(_0x2686ab[_0xce9b('0x30')][_0xce9b('0x3c')]){_0x40df37[_0xce9b('0x3b')]=_[_0xce9b('0x3d')](_0x40df37['where'],{'$or':_[_0xce9b('0x2a')](_0x21bb2b,function(_0x2a368d){if(_0x2a368d[_0xce9b('0x2d')]!=='VIRTUAL'){var _0x12f1f3={};_0x12f1f3[_0x2a368d['name']]={'$like':'%'+_0x2686ab[_0xce9b('0x30')]['filter']+'%'};return _0x12f1f3;}})});}_0x40df37=_['merge']({},_0x40df37,_0x2686ab['options']);var _0x3366b6={'where':_0x40df37['where']};return db[_0xce9b('0x2b')][_0xce9b('0x21')](_0x3366b6)[_0xce9b('0x25')](function(_0xc82238){_0x231835[_0xce9b('0x21')]=_0xc82238;if(_0x2686ab['query'][_0xce9b('0x3e')]){_0x40df37[_0xce9b('0x3f')]=[{'all':!![]}];}return db[_0xce9b('0x2b')]['findAll'](_0x40df37);})[_0xce9b('0x25')](function(_0xa46d64){_0x231835[_0xce9b('0x40')]=_0xa46d64;return _0x231835;})['then'](respondWithFilteredResult(_0x59f7b8,_0x40df37))['catch'](handleError(_0x59f7b8,null));};exports['show']=function(_0x5a334d,_0x48760e){var _0xe79137={'raw':!![],'where':{'id':_0x5a334d['params']['id']}},_0x4628fd={};_0x4628fd[_0xce9b('0x33')]=_[_0xce9b('0x2f')](db[_0xce9b('0x2b')]['rawAttributes']);_0x4628fd[_0xce9b('0x30')]=_[_0xce9b('0x2f')](_0x5a334d['query']);_0x4628fd[_0xce9b('0x31')]=_['intersection'](_0x4628fd[_0xce9b('0x33')],_0x4628fd['query']);_0xe79137[_0xce9b('0x34')]=_[_0xce9b('0x32')](_0x4628fd[_0xce9b('0x33')],qs['fields'](_0x5a334d['query'][_0xce9b('0x35')]));_0xe79137[_0xce9b('0x34')]=_0xe79137[_0xce9b('0x34')][_0xce9b('0x36')]?_0xe79137[_0xce9b('0x34')]:_0x4628fd[_0xce9b('0x33')];if(_0x5a334d[_0xce9b('0x30')]['includeAll']){_0xe79137[_0xce9b('0x3f')]=[{'all':!![]}];}_0xe79137=_[_0xce9b('0x3d')]({},_0xe79137,_0x5a334d[_0xce9b('0x41')]);return db[_0xce9b('0x2b')][_0xce9b('0x42')](_0xe79137)[_0xce9b('0x25')](handleEntityNotFound(_0x48760e,null))[_0xce9b('0x25')](respondWithResult(_0x48760e,null))[_0xce9b('0x43')](handleError(_0x48760e,null));};exports[_0xce9b('0x44')]=function(_0x552de1,_0x11d4f1){return db['MailSubstatus'][_0xce9b('0x44')](_0x552de1['body'],{})[_0xce9b('0x25')](respondWithResult(_0x11d4f1,0xc9))['catch'](handleError(_0x11d4f1,null));};exports[_0xce9b('0x24')]=function(_0x226f28,_0x364bef){if(_0x226f28[_0xce9b('0x45')]['id']){delete _0x226f28[_0xce9b('0x45')]['id'];}return db[_0xce9b('0x2b')]['find']({'where':{'id':_0x226f28[_0xce9b('0x46')]['id']}})[_0xce9b('0x25')](handleEntityNotFound(_0x364bef,null))['then'](saveUpdates(_0x226f28[_0xce9b('0x45')],null))[_0xce9b('0x25')](respondWithResult(_0x364bef,null))[_0xce9b('0x43')](handleError(_0x364bef,null));};exports[_0xce9b('0x26')]=function(_0x43bb12,_0x707bc3){return db[_0xce9b('0x2b')][_0xce9b('0x42')]({'where':{'id':_0x43bb12['params']['id']}})[_0xce9b('0x25')](handleEntityNotFound(_0x707bc3,null))[_0xce9b('0x25')](removeEntity(_0x707bc3,null))['catch'](handleError(_0x707bc3,null));};exports[_0xce9b('0x47')]=function(_0x4336ac,_0x2a618d){return db[_0xce9b('0x2b')]['describe']()[_0xce9b('0x25')](respondWithResult(_0x2a618d,null))[_0xce9b('0x43')](handleError(_0x2a618d,null));}; \ No newline at end of file +var _0x422b=['VIRTUAL','MailSubstatus','includeAll','include','findAll','rows','catch','show','params','options','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x422b,0xf0));var _0xb422=function(_0x2d6b93,_0x1eb694){_0x2d6b93=_0x2d6b93-0x0;var _0x1c8eba=_0x422b[_0x2d6b93];return _0x1c8eba;};'use strict';var emlformat=require(_0xb422('0x0'));var rimraf=require(_0xb422('0x1'));var zipdir=require(_0xb422('0x2'));var jsonpatch=require(_0xb422('0x3'));var rp=require(_0xb422('0x4'));var moment=require(_0xb422('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb422('0x6'));var util=require('util');var path=require(_0xb422('0x7'));var sox=require(_0xb422('0x8'));var csv=require('to-csv');var ejs=require(_0xb422('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb422('0xa'));var squel=require(_0xb422('0xb'));var crypto=require('crypto');var jsforce=require(_0xb422('0xc'));var deskjs=require(_0xb422('0xd'));var toCsv=require(_0xb422('0xe'));var querystring=require(_0xb422('0xf'));var Papa=require(_0xb422('0x10'));var Redis=require(_0xb422('0x11'));var authService=require(_0xb422('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb422('0x13'));var hardwareService=require(_0xb422('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb422('0x15'));var config=require(_0xb422('0x16'));var licenseUtil=require(_0xb422('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57d245,_0x3e7072){_0x3e7072=_0x3e7072||0xcc;return function(_0x5b56ca){if(_0x5b56ca){return _0x57d245['sendStatus'](_0x3e7072);}return _0x57d245['status'](_0x3e7072)[_0xb422('0x18')]();};}function respondWithResult(_0x31a1c7,_0x681cba){_0x681cba=_0x681cba||0xc8;return function(_0x442d30){if(_0x442d30){return _0x31a1c7[_0xb422('0x19')](_0x681cba)[_0xb422('0x1a')](_0x442d30);}};}function respondWithFilteredResult(_0x2cd312,_0x4ee157){return function(_0x1cbc9e){if(_0x1cbc9e){var _0x5c52e5=typeof _0x4ee157[_0xb422('0x1b')]===_0xb422('0x1c')&&typeof _0x4ee157[_0xb422('0x1d')]===_0xb422('0x1c');var _0x949f04=_0x1cbc9e['count'];var _0x136a91=_0x5c52e5?0x0:_0x4ee157['offset'];var _0x17f907=_0x5c52e5?_0x1cbc9e[_0xb422('0x1e')]:_0x4ee157[_0xb422('0x1b')]+_0x4ee157[_0xb422('0x1d')];var _0x169468;if(_0x17f907>=_0x949f04){_0x17f907=_0x949f04;_0x169468=0xc8;}else{_0x169468=0xce;}_0x2cd312[_0xb422('0x19')](_0x169468);return _0x2cd312['set']('Content-Range',_0x136a91+'-'+_0x17f907+'/'+_0x949f04)['json'](_0x1cbc9e);}return null;};}function patchUpdates(_0x506fad){return function(_0x35a04f){try{jsonpatch[_0xb422('0x1f')](_0x35a04f,_0x506fad,!![]);}catch(_0x212061){return BPromise[_0xb422('0x20')](_0x212061);}return _0x35a04f[_0xb422('0x21')]();};}function saveUpdates(_0x22f44a,_0x1aa548){return function(_0x3ef2f0){if(_0x3ef2f0){return _0x3ef2f0['update'](_0x22f44a)[_0xb422('0x22')](function(_0x5400e2){return _0x5400e2;});}return null;};}function removeEntity(_0xed1845,_0x139853){return function(_0x5ebdca){if(_0x5ebdca){return _0x5ebdca[_0xb422('0x23')]()[_0xb422('0x22')](function(){_0xed1845[_0xb422('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9089e8,_0x4efbb7){return function(_0x16bb4f){if(!_0x16bb4f){_0x9089e8['sendStatus'](0x194);}return _0x16bb4f;};}function handleError(_0x63a4b3,_0x29223d){_0x29223d=_0x29223d||0x1f4;return function(_0x2d4cd9){logger['error'](_0x2d4cd9[_0xb422('0x24')]);if(_0x2d4cd9['name']){delete _0x2d4cd9[_0xb422('0x25')];}_0x63a4b3[_0xb422('0x19')](_0x29223d)[_0xb422('0x26')](_0x2d4cd9);};}exports[_0xb422('0x27')]=function(_0x13331e,_0x13380b){var _0x3a8081={},_0x2787df={},_0x228268={'count':0x0,'rows':[]};var _0x12c54b=_[_0xb422('0x28')](db['MailSubstatus'][_0xb422('0x29')],function(_0x14a8d0){return{'name':_0x14a8d0[_0xb422('0x2a')],'type':_0x14a8d0[_0xb422('0x2b')][_0xb422('0x2c')]};});_0x2787df['model']=_['map'](_0x12c54b,'name');_0x2787df[_0xb422('0x2d')]=_[_0xb422('0x2e')](_0x13331e[_0xb422('0x2d')]);_0x2787df[_0xb422('0x2f')]=_[_0xb422('0x30')](_0x2787df[_0xb422('0x31')],_0x2787df[_0xb422('0x2d')]);_0x3a8081['attributes']=_['intersection'](_0x2787df[_0xb422('0x31')],qs[_0xb422('0x32')](_0x13331e[_0xb422('0x2d')][_0xb422('0x32')]));_0x3a8081['attributes']=_0x3a8081[_0xb422('0x33')]['length']?_0x3a8081['attributes']:_0x2787df[_0xb422('0x31')];if(!_0x13331e[_0xb422('0x2d')][_0xb422('0x34')](_0xb422('0x35'))){_0x3a8081[_0xb422('0x1d')]=qs[_0xb422('0x1d')](_0x13331e[_0xb422('0x2d')][_0xb422('0x1d')]);_0x3a8081[_0xb422('0x1b')]=qs[_0xb422('0x1b')](_0x13331e[_0xb422('0x2d')][_0xb422('0x1b')]);}_0x3a8081[_0xb422('0x36')]=qs[_0xb422('0x37')](_0x13331e[_0xb422('0x2d')][_0xb422('0x37')]);_0x3a8081[_0xb422('0x38')]=qs[_0xb422('0x2f')](_[_0xb422('0x39')](_0x13331e[_0xb422('0x2d')],_0x2787df['filters']),_0x12c54b);if(_0x13331e[_0xb422('0x2d')][_0xb422('0x3a')]){_0x3a8081['where']=_[_0xb422('0x3b')](_0x3a8081[_0xb422('0x38')],{'$or':_['map'](_0x12c54b,function(_0x36c1be){if(_0x36c1be['type']!==_0xb422('0x3c')){var _0x56c971={};_0x56c971[_0x36c1be[_0xb422('0x25')]]={'$like':'%'+_0x13331e['query']['filter']+'%'};return _0x56c971;}})});}_0x3a8081=_[_0xb422('0x3b')]({},_0x3a8081,_0x13331e['options']);var _0x170128={'where':_0x3a8081[_0xb422('0x38')]};return db[_0xb422('0x3d')][_0xb422('0x1e')](_0x170128)['then'](function(_0xbb0797){_0x228268[_0xb422('0x1e')]=_0xbb0797;if(_0x13331e[_0xb422('0x2d')][_0xb422('0x3e')]){_0x3a8081[_0xb422('0x3f')]=[{'all':!![]}];}return db[_0xb422('0x3d')][_0xb422('0x40')](_0x3a8081);})['then'](function(_0x4c1fde){_0x228268[_0xb422('0x41')]=_0x4c1fde;return _0x228268;})[_0xb422('0x22')](respondWithFilteredResult(_0x13380b,_0x3a8081))[_0xb422('0x42')](handleError(_0x13380b,null));};exports[_0xb422('0x43')]=function(_0x44b9e4,_0x2aeaf1){var _0x3c2163={'raw':!![],'where':{'id':_0x44b9e4[_0xb422('0x44')]['id']}},_0x584fc3={};_0x584fc3['model']=_[_0xb422('0x2e')](db[_0xb422('0x3d')][_0xb422('0x29')]);_0x584fc3[_0xb422('0x2d')]=_['keys'](_0x44b9e4['query']);_0x584fc3[_0xb422('0x2f')]=_[_0xb422('0x30')](_0x584fc3['model'],_0x584fc3['query']);_0x3c2163[_0xb422('0x33')]=_[_0xb422('0x30')](_0x584fc3['model'],qs[_0xb422('0x32')](_0x44b9e4[_0xb422('0x2d')][_0xb422('0x32')]));_0x3c2163[_0xb422('0x33')]=_0x3c2163[_0xb422('0x33')]['length']?_0x3c2163['attributes']:_0x584fc3['model'];if(_0x44b9e4['query'][_0xb422('0x3e')]){_0x3c2163[_0xb422('0x3f')]=[{'all':!![]}];}_0x3c2163=_[_0xb422('0x3b')]({},_0x3c2163,_0x44b9e4[_0xb422('0x45')]);return db[_0xb422('0x3d')][_0xb422('0x46')](_0x3c2163)[_0xb422('0x22')](handleEntityNotFound(_0x2aeaf1,null))['then'](respondWithResult(_0x2aeaf1,null))[_0xb422('0x42')](handleError(_0x2aeaf1,null));};exports[_0xb422('0x47')]=function(_0x37bbaf,_0x1d0f5c){return db[_0xb422('0x3d')][_0xb422('0x47')](_0x37bbaf['body'],{})['then'](respondWithResult(_0x1d0f5c,0xc9))[_0xb422('0x42')](handleError(_0x1d0f5c,null));};exports[_0xb422('0x48')]=function(_0x4eaecf,_0x50d51f){if(_0x4eaecf[_0xb422('0x49')]['id']){delete _0x4eaecf[_0xb422('0x49')]['id'];}return db[_0xb422('0x3d')][_0xb422('0x46')]({'where':{'id':_0x4eaecf['params']['id']}})['then'](handleEntityNotFound(_0x50d51f,null))[_0xb422('0x22')](saveUpdates(_0x4eaecf['body'],null))['then'](respondWithResult(_0x50d51f,null))[_0xb422('0x42')](handleError(_0x50d51f,null));};exports[_0xb422('0x23')]=function(_0x532be8,_0x365384){return db[_0xb422('0x3d')][_0xb422('0x46')]({'where':{'id':_0x532be8[_0xb422('0x44')]['id']}})[_0xb422('0x22')](handleEntityNotFound(_0x365384,null))['then'](removeEntity(_0x365384,null))['catch'](handleError(_0x365384,null));};exports[_0xb422('0x4a')]=function(_0x501141,_0x44b554){return db[_0xb422('0x3d')][_0xb422('0x4a')]()[_0xb422('0x22')](respondWithResult(_0x44b554,null))['catch'](handleError(_0x44b554,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 4549920..7521bf6 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 _0x9c73=['setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb','MailSubstatus'];(function(_0x205922,_0x3c6396){var _0x474f91=function(_0x5e5244){while(--_0x5e5244){_0x205922['push'](_0x205922['shift']());}};_0x474f91(++_0x3c6396);}(_0x9c73,0x7d));var _0x39c7=function(_0x40b0e7,_0x1ef317){_0x40b0e7=_0x40b0e7-0x0;var _0x396d23=_0x9c73[_0x40b0e7];return _0x396d23;};'use strict';var EventEmitter=require(_0x39c7('0x0'));var MailSubstatus=require(_0x39c7('0x1'))['db'][_0x39c7('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x39c7('0x3')](0x0);var events={'afterUpdate':_0x39c7('0x4')};function emitEvent(_0x50b6bb){return function(_0x2e650c,_0x672e62,_0x5b42d8){MailSubstatusEvents[_0x39c7('0x5')](_0x50b6bb+':'+_0x2e650c['id'],_0x2e650c);MailSubstatusEvents['emit'](_0x50b6bb,_0x2e650c);_0x5b42d8(null);};}for(var e in events){if(events[_0x39c7('0x6')](e)){var event=events[e];MailSubstatus[_0x39c7('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x7ab9=['emit','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x10f7dd,_0x8a9841){var _0xd3104a=function(_0x28a81a){while(--_0x28a81a){_0x10f7dd['push'](_0x10f7dd['shift']());}};_0xd3104a(++_0x8a9841);}(_0x7ab9,0x14c));var _0x97ab=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0x7ab9[_0x4be8ba];return _0x1af822;};'use strict';var EventEmitter=require(_0x97ab('0x0'));var MailSubstatus=require(_0x97ab('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x97ab('0x2')](0x0);var events={'afterUpdate':_0x97ab('0x3')};function emitEvent(_0x5d4617){return function(_0x39521d,_0x487cf4,_0x5af2b5){MailSubstatusEvents[_0x97ab('0x4')](_0x5d4617+':'+_0x39521d['id'],_0x39521d);MailSubstatusEvents['emit'](_0x5d4617,_0x39521d);_0x5af2b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x97ab('0x5')](e,emitEvent(event));}}module[_0x97ab('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 f93d31b..9676b28 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 _0x562f=['then','catch','./mailSubstatus.attributes','exports','models','update','name','mailSubstatus','_previousDataValues'];(function(_0x11db28,_0x4a6d36){var _0x4700fc=function(_0xdbcc66){while(--_0xdbcc66){_0x11db28['push'](_0x11db28['shift']());}};_0x4700fc(++_0x4a6d36);}(_0x562f,0x80));var _0xf562=function(_0x2a74f5,_0x542b0b){_0x2a74f5=_0x2a74f5-0x0;var _0x358258=_0x562f[_0x2a74f5];return _0x358258;};'use strict';var attributes=require(_0xf562('0x0'));module[_0xf562('0x1')]=function(_0x846de2){var _0x21c7b4=_0x846de2[_0xf562('0x2')];return _0x846de2['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2b375b,_0x51b24b,_0x294e12){return _0x21c7b4['Condition'][_0xf562('0x3')]({'value':_0x2b375b[_0xf562('0x4')]},{'where':{'field':_0xf562('0x5'),'value':_0x2b375b[_0xf562('0x6')][_0xf562('0x4')]}})[_0xf562('0x7')](function(){_0x294e12();})[_0xf562('0x8')](function(_0x527a7c){_0x294e12(_0x527a7c);});}}});}; \ No newline at end of file +var _0x4566=['catch','./mailSubstatus.attributes','models','define','mail_substatuses','update','name','mailSubstatus','_previousDataValues','then'];(function(_0x1d98c7,_0x3ceb1b){var _0x3b05b7=function(_0xc1ef8b){while(--_0xc1ef8b){_0x1d98c7['push'](_0x1d98c7['shift']());}};_0x3b05b7(++_0x3ceb1b);}(_0x4566,0x8d));var _0x6456=function(_0x35ec65,_0x4aac52){_0x35ec65=_0x35ec65-0x0;var _0x2d65d4=_0x4566[_0x35ec65];return _0x2d65d4;};'use strict';var attributes=require(_0x6456('0x0'));module['exports']=function(_0x2cd98b){var _0x4a6c55=_0x2cd98b[_0x6456('0x1')];return _0x2cd98b[_0x6456('0x2')]('MailSubstatus',attributes,{'tableName':_0x6456('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2c9417,_0x5aaf8b,_0x3a017f){return _0x4a6c55['Condition'][_0x6456('0x4')]({'value':_0x2c9417[_0x6456('0x5')]},{'where':{'field':_0x6456('0x6'),'value':_0x2c9417[_0x6456('0x7')]['name']}})[_0x6456('0x8')](function(){_0x3a017f();})[_0x6456('0x9')](function(_0x5ba598){_0x3a017f(_0x5ba598);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index dc9be99..4b5ea4c 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 _0x004c=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x16b216,_0x5f0aa3){var _0xdbc9b9=function(_0x1f1ed8){while(--_0x1f1ed8){_0x16b216['push'](_0x16b216['shift']());}};_0xdbc9b9(++_0x5f0aa3);}(_0x004c,0x85));var _0xc004=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x004c[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xc004('0x0'));var util=require(_0xc004('0x1'));var moment=require(_0xc004('0x2'));var BPromise=require(_0xc004('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc004('0x4'));var db=require(_0xc004('0x5'))['db'];var utils=require(_0xc004('0x6'));var logger=require(_0xc004('0x7'))('rpc');var config=require(_0xc004('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc004('0x9')][_0xc004('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ef023,_0x4c12db,_0x1b5007){return new BPromise(function(_0x46dcf9,_0x40ad0c){return client[_0xc004('0xb')](_0x5ef023,_0x1b5007)['then'](function(_0x13f5c7){logger[_0xc004('0xc')](_0xc004('0xd'),_0x4c12db,_0xc004('0xe'));logger[_0xc004('0xf')](_0xc004('0x10'),_0x4c12db,_0xc004('0xe'),JSON[_0xc004('0x11')](_0x13f5c7));if(_0x13f5c7[_0xc004('0x12')]){if(_0x13f5c7[_0xc004('0x12')]['code']===0x1f4){logger[_0xc004('0x12')](_0xc004('0xd'),_0x4c12db,_0x13f5c7[_0xc004('0x12')][_0xc004('0x13')]);return _0x40ad0c(_0x13f5c7[_0xc004('0x12')][_0xc004('0x13')]);}logger[_0xc004('0x12')](_0xc004('0xd'),_0x4c12db,_0x13f5c7[_0xc004('0x12')][_0xc004('0x13')]);return _0x46dcf9(_0x13f5c7[_0xc004('0x12')][_0xc004('0x13')]);}else{logger[_0xc004('0xc')](_0xc004('0xd'),_0x4c12db,'request\x20sent');_0x46dcf9(_0x13f5c7[_0xc004('0x14')][_0xc004('0x13')]);}})[_0xc004('0x15')](function(_0x2795bb){logger[_0xc004('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x4c12db,_0x2795bb);_0x40ad0c(_0x2795bb);});});} \ No newline at end of file +var _0xe7c4=['http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x559fc3,_0xe71ab8){var _0x2ebebf=function(_0x4dc555){while(--_0x4dc555){_0x559fc3['push'](_0x559fc3['shift']());}};_0x2ebebf(++_0xe71ab8);}(_0xe7c4,0xa3));var _0x4e7c=function(_0x4d860a,_0x12c4e2){_0x4d860a=_0x4d860a-0x0;var _0xb7ddc6=_0xe7c4[_0x4d860a];return _0xb7ddc6;};'use strict';var _=require(_0x4e7c('0x0'));var util=require(_0x4e7c('0x1'));var moment=require(_0x4e7c('0x2'));var BPromise=require(_0x4e7c('0x3'));var rs=require(_0x4e7c('0x4'));var fs=require('fs');var Redis=require(_0x4e7c('0x5'));var db=require(_0x4e7c('0x6'))['db'];var utils=require(_0x4e7c('0x7'));var logger=require('../../config/logger')(_0x4e7c('0x8'));var config=require(_0x4e7c('0x9'));var jayson=require(_0x4e7c('0xa'));var client=jayson[_0x4e7c('0xb')][_0x4e7c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x123620,_0x1441a5,_0x11c183){return new BPromise(function(_0x487dcb,_0x478050){return client['request'](_0x123620,_0x11c183)[_0x4e7c('0xd')](function(_0x1d1427){logger[_0x4e7c('0xe')](_0x4e7c('0xf'),_0x1441a5,_0x4e7c('0x10'));logger[_0x4e7c('0x11')](_0x4e7c('0x12'),_0x1441a5,_0x4e7c('0x10'),JSON[_0x4e7c('0x13')](_0x1d1427));if(_0x1d1427[_0x4e7c('0x14')]){if(_0x1d1427[_0x4e7c('0x14')][_0x4e7c('0x15')]===0x1f4){logger[_0x4e7c('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x1441a5,_0x1d1427[_0x4e7c('0x14')][_0x4e7c('0x16')]);return _0x478050(_0x1d1427[_0x4e7c('0x14')][_0x4e7c('0x16')]);}logger[_0x4e7c('0x14')](_0x4e7c('0xf'),_0x1441a5,_0x1d1427['error'][_0x4e7c('0x16')]);return _0x487dcb(_0x1d1427[_0x4e7c('0x14')][_0x4e7c('0x16')]);}else{logger[_0x4e7c('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x1441a5,_0x4e7c('0x10'));_0x487dcb(_0x1d1427[_0x4e7c('0x17')][_0x4e7c('0x16')]);}})[_0x4e7c('0x18')](function(_0xdf0a29){logger[_0x4e7c('0x14')](_0x4e7c('0xf'),_0x1441a5,_0xdf0a29);_0x478050(_0xdf0a29);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index dc07596..31aec39 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 _0xd40f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','index','get','/describe','/:id','post','isAuthenticated','create','put','destroy','multer','util','express'];(function(_0x22c72a,_0x21b8ef){var _0x1c7fcf=function(_0x3a067e){while(--_0x3a067e){_0x22c72a['push'](_0x22c72a['shift']());}};_0x1c7fcf(++_0x21b8ef);}(_0xd40f,0x96));var _0xfd40=function(_0x34fbee,_0xc24eaa){_0x34fbee=_0x34fbee-0x0;var _0x289c90=_0xd40f[_0x34fbee];return _0x289c90;};'use strict';var multer=require(_0xfd40('0x0'));var util=require(_0xfd40('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfd40('0x2'));var router=express[_0xfd40('0x3')]();var fs_extra=require(_0xfd40('0x4'));var auth=require(_0xfd40('0x5'));var interaction=require(_0xfd40('0x6'));var config=require('../../config/environment');var controller=require(_0xfd40('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfd40('0x8')]);router[_0xfd40('0x9')](_0xfd40('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xfd40('0x9')](_0xfd40('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xfd40('0xc')]('/',auth[_0xfd40('0xd')](),controller[_0xfd40('0xe')]);router[_0xfd40('0xf')](_0xfd40('0xb'),auth[_0xfd40('0xd')](),controller['update']);router['delete'](_0xfd40('0xb'),auth[_0xfd40('0xd')](),controller[_0xfd40('0x10')]);module['exports']=router; \ No newline at end of file +var _0x83f7=['get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x21a11d,_0x18d8ec){var _0x474e50=function(_0x45d33b){while(--_0x45d33b){_0x21a11d['push'](_0x21a11d['shift']());}};_0x474e50(++_0x18d8ec);}(_0x83f7,0xc0));var _0x783f=function(_0x216a8a,_0x2c7bc0){_0x216a8a=_0x216a8a-0x0;var _0x2c55dd=_0x83f7[_0x216a8a];return _0x2c55dd;};'use strict';var multer=require('multer');var util=require(_0x783f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x783f('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x783f('0x2'));var interaction=require(_0x783f('0x3'));var config=require(_0x783f('0x4'));var controller=require(_0x783f('0x5'));router[_0x783f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x783f('0x6')](_0x783f('0x7'),auth[_0x783f('0x8')](),controller[_0x783f('0x9')]);router[_0x783f('0x6')](_0x783f('0xa'),auth[_0x783f('0x8')](),controller[_0x783f('0xb')]);router[_0x783f('0xc')]('/',auth[_0x783f('0x8')](),controller[_0x783f('0xd')]);router[_0x783f('0xe')](_0x783f('0xa'),auth[_0x783f('0x8')](),controller[_0x783f('0xf')]);router[_0x783f('0x10')](_0x783f('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x783f('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 7a5d7bd..e5a4613 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x5ecc00,_0xc3a378){var _0x29ac1e=function(_0x375756){while(--_0x375756){_0x5ecc00['push'](_0x5ecc00['shift']());}};_0x29ac1e(++_0xc3a378);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xcb91[_0x22c684];return _0x39fcbb;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x54a564,_0x1d054f){var _0x4b77d8=function(_0x3f8b14){while(--_0x3f8b14){_0x54a564['push'](_0x54a564['shift']());}};_0x4b77d8(++_0x1d054f);}(_0xaa88,0x137));var _0x8aa8=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0xaa88[_0x26b80e];return _0x84a8a8;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 1bc3f6f..ea09069 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 _0x87ae=['json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','MailTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','include','rows','rawAttributes','includeAll','options','find','create','body','params','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x2fc7bb,_0x399dc1){var _0x45fa5b=function(_0x58c681){while(--_0x58c681){_0x2fc7bb['push'](_0x2fc7bb['shift']());}};_0x45fa5b(++_0x399dc1);}(_0x87ae,0x15d));var _0xe87a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x87ae[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe87a('0x0'));var zipdir=require(_0xe87a('0x1'));var jsonpatch=require(_0xe87a('0x2'));var rp=require(_0xe87a('0x3'));var moment=require(_0xe87a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe87a('0x5'));var path=require(_0xe87a('0x6'));var sox=require(_0xe87a('0x7'));var csv=require('to-csv');var ejs=require(_0xe87a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe87a('0x9'));var squel=require(_0xe87a('0xa'));var crypto=require(_0xe87a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe87a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe87a('0xd'));var Papa=require(_0xe87a('0xe'));var Redis=require(_0xe87a('0xf'));var authService=require(_0xe87a('0x10'));var qs=require(_0xe87a('0x11'));var as=require(_0xe87a('0x12'));var hardwareService=require(_0xe87a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe87a('0x14'));var config=require(_0xe87a('0x15'));var licenseUtil=require(_0xe87a('0x16'));var db=require(_0xe87a('0x17'))['db'];function respondWithStatusCode(_0x5d76cd,_0x5cd0cd){_0x5cd0cd=_0x5cd0cd||0xcc;return function(_0x38e059){if(_0x38e059){return _0x5d76cd['sendStatus'](_0x5cd0cd);}return _0x5d76cd[_0xe87a('0x18')](_0x5cd0cd)[_0xe87a('0x19')]();};}function respondWithResult(_0x3bdc76,_0x1347b4){_0x1347b4=_0x1347b4||0xc8;return function(_0x19f14a){if(_0x19f14a){return _0x3bdc76[_0xe87a('0x18')](_0x1347b4)[_0xe87a('0x1a')](_0x19f14a);}};}function respondWithFilteredResult(_0x540d8c,_0xe3055c){return function(_0x31240f){if(_0x31240f){var _0x3d2d0e=typeof _0xe3055c[_0xe87a('0x1b')]===_0xe87a('0x1c')&&typeof _0xe3055c['limit']===_0xe87a('0x1c');var _0x36af63=_0x31240f[_0xe87a('0x1d')];var _0x50873b=_0x3d2d0e?0x0:_0xe3055c[_0xe87a('0x1b')];var _0x443869=_0x3d2d0e?_0x31240f[_0xe87a('0x1d')]:_0xe3055c['offset']+_0xe3055c['limit'];var _0x23318d;if(_0x443869>=_0x36af63){_0x443869=_0x36af63;_0x23318d=0xc8;}else{_0x23318d=0xce;}_0x540d8c['status'](_0x23318d);return _0x540d8c[_0xe87a('0x1e')](_0xe87a('0x1f'),_0x50873b+'-'+_0x443869+'/'+_0x36af63)[_0xe87a('0x1a')](_0x31240f);}return null;};}function patchUpdates(_0x5e89d1){return function(_0x489fc0){try{jsonpatch[_0xe87a('0x20')](_0x489fc0,_0x5e89d1,!![]);}catch(_0x657bed){return BPromise[_0xe87a('0x21')](_0x657bed);}return _0x489fc0['save']();};}function saveUpdates(_0x5f1056,_0x3b0ea2){return function(_0x445c46){if(_0x445c46){return _0x445c46[_0xe87a('0x22')](_0x5f1056)['then'](function(_0x2db219){return _0x2db219;});}return null;};}function removeEntity(_0x44005b,_0x145512){return function(_0x553537){if(_0x553537){return _0x553537[_0xe87a('0x23')]()[_0xe87a('0x24')](function(){_0x44005b[_0xe87a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f2f2,_0x262488){return function(_0x4804b9){if(!_0x4804b9){_0x40f2f2['sendStatus'](0x194);}return _0x4804b9;};}function handleError(_0x480acb,_0xea653d){_0xea653d=_0xea653d||0x1f4;return function(_0x5baa50){logger['error'](_0x5baa50[_0xe87a('0x25')]);if(_0x5baa50[_0xe87a('0x26')]){delete _0x5baa50['name'];}_0x480acb[_0xe87a('0x18')](_0xea653d)[_0xe87a('0x27')](_0x5baa50);};}exports[_0xe87a('0x28')]=function(_0xb549d2,_0x74a171){var _0x2b2365={},_0x5de635={},_0x35c38c={'count':0x0,'rows':[]};var _0x53abf7=_[_0xe87a('0x29')](db[_0xe87a('0x2a')]['rawAttributes'],function(_0x1f16f7){return{'name':_0x1f16f7[_0xe87a('0x2b')],'type':_0x1f16f7[_0xe87a('0x2c')][_0xe87a('0x2d')]};});_0x5de635[_0xe87a('0x2e')]=_[_0xe87a('0x29')](_0x53abf7,_0xe87a('0x26'));_0x5de635[_0xe87a('0x2f')]=_[_0xe87a('0x30')](_0xb549d2['query']);_0x5de635['filters']=_[_0xe87a('0x31')](_0x5de635['model'],_0x5de635[_0xe87a('0x2f')]);_0x2b2365[_0xe87a('0x32')]=_[_0xe87a('0x31')](_0x5de635[_0xe87a('0x2e')],qs[_0xe87a('0x33')](_0xb549d2[_0xe87a('0x2f')]['fields']));_0x2b2365[_0xe87a('0x32')]=_0x2b2365[_0xe87a('0x32')][_0xe87a('0x34')]?_0x2b2365[_0xe87a('0x32')]:_0x5de635['model'];if(!_0xb549d2[_0xe87a('0x2f')][_0xe87a('0x35')](_0xe87a('0x36'))){_0x2b2365['limit']=qs[_0xe87a('0x37')](_0xb549d2['query'][_0xe87a('0x37')]);_0x2b2365[_0xe87a('0x1b')]=qs[_0xe87a('0x1b')](_0xb549d2[_0xe87a('0x2f')][_0xe87a('0x1b')]);}_0x2b2365[_0xe87a('0x38')]=qs[_0xe87a('0x39')](_0xb549d2[_0xe87a('0x2f')][_0xe87a('0x39')]);_0x2b2365['where']=qs[_0xe87a('0x3a')](_[_0xe87a('0x3b')](_0xb549d2[_0xe87a('0x2f')],_0x5de635['filters']),_0x53abf7);if(_0xb549d2[_0xe87a('0x2f')][_0xe87a('0x3c')]){_0x2b2365[_0xe87a('0x3d')]=_[_0xe87a('0x3e')](_0x2b2365[_0xe87a('0x3d')],{'$or':_[_0xe87a('0x29')](_0x53abf7,function(_0x2b146a){if(_0x2b146a['type']!==_0xe87a('0x3f')){var _0x588971={};_0x588971[_0x2b146a['name']]={'$like':'%'+_0xb549d2['query'][_0xe87a('0x3c')]+'%'};return _0x588971;}})});}_0x2b2365=_[_0xe87a('0x3e')]({},_0x2b2365,_0xb549d2['options']);var _0x45044e={'where':_0x2b2365[_0xe87a('0x3d')]};return db['MailTransferReport']['count'](_0x45044e)[_0xe87a('0x24')](function(_0x345875){_0x35c38c[_0xe87a('0x1d')]=_0x345875;if(_0xb549d2['query']['includeAll']){_0x2b2365[_0xe87a('0x40')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x2b2365);})[_0xe87a('0x24')](function(_0x3cf07c){_0x35c38c[_0xe87a('0x41')]=_0x3cf07c;return _0x35c38c;})[_0xe87a('0x24')](respondWithFilteredResult(_0x74a171,_0x2b2365))['catch'](handleError(_0x74a171,null));};exports['show']=function(_0x511cd9,_0x5a4a9b){var _0x3f48b3={'raw':!![],'where':{'id':_0x511cd9['params']['id']}},_0x324463={};_0x324463['model']=_['keys'](db['MailTransferReport'][_0xe87a('0x42')]);_0x324463['query']=_[_0xe87a('0x30')](_0x511cd9[_0xe87a('0x2f')]);_0x324463['filters']=_['intersection'](_0x324463[_0xe87a('0x2e')],_0x324463[_0xe87a('0x2f')]);_0x3f48b3['attributes']=_[_0xe87a('0x31')](_0x324463['model'],qs[_0xe87a('0x33')](_0x511cd9[_0xe87a('0x2f')][_0xe87a('0x33')]));_0x3f48b3[_0xe87a('0x32')]=_0x3f48b3['attributes'][_0xe87a('0x34')]?_0x3f48b3[_0xe87a('0x32')]:_0x324463['model'];if(_0x511cd9[_0xe87a('0x2f')][_0xe87a('0x43')]){_0x3f48b3[_0xe87a('0x40')]=[{'all':!![]}];}_0x3f48b3=_[_0xe87a('0x3e')]({},_0x3f48b3,_0x511cd9[_0xe87a('0x44')]);return db[_0xe87a('0x2a')][_0xe87a('0x45')](_0x3f48b3)[_0xe87a('0x24')](handleEntityNotFound(_0x5a4a9b,null))['then'](respondWithResult(_0x5a4a9b,null))['catch'](handleError(_0x5a4a9b,null));};exports[_0xe87a('0x46')]=function(_0x4c7e06,_0x53cc2b){return db[_0xe87a('0x2a')][_0xe87a('0x46')](_0x4c7e06[_0xe87a('0x47')],{})[_0xe87a('0x24')](respondWithResult(_0x53cc2b,0xc9))['catch'](handleError(_0x53cc2b,null));};exports['update']=function(_0x5b2807,_0x448d27){if(_0x5b2807[_0xe87a('0x47')]['id']){delete _0x5b2807['body']['id'];}return db[_0xe87a('0x2a')][_0xe87a('0x45')]({'where':{'id':_0x5b2807[_0xe87a('0x48')]['id']}})[_0xe87a('0x24')](handleEntityNotFound(_0x448d27,null))[_0xe87a('0x24')](saveUpdates(_0x5b2807[_0xe87a('0x47')],null))[_0xe87a('0x24')](respondWithResult(_0x448d27,null))[_0xe87a('0x49')](handleError(_0x448d27,null));};exports['destroy']=function(_0x1aeec5,_0x320e24){return db[_0xe87a('0x2a')][_0xe87a('0x45')]({'where':{'id':_0x1aeec5[_0xe87a('0x48')]['id']}})[_0xe87a('0x24')](handleEntityNotFound(_0x320e24,null))['then'](removeEntity(_0x320e24,null))[_0xe87a('0x49')](handleError(_0x320e24,null));};exports[_0xe87a('0x4a')]=function(_0x34de1e,_0x42095b){return db[_0xe87a('0x2a')][_0xe87a('0x4a')]()[_0xe87a('0x24')](respondWithResult(_0x42095b,null))[_0xe87a('0x49')](handleError(_0x42095b,null));}; \ No newline at end of file +var _0x3da2=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','map','MailTransferReport','count','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','describe','eml-format','zip-dir'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0x3da2,0x12e));var _0x23da=function(_0x25d378,_0x410267){_0x25d378=_0x25d378-0x0;var _0x23b5b3=_0x3da2[_0x25d378];return _0x23b5b3;};'use strict';var emlformat=require(_0x23da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x23da('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23da('0x2'));var moment=require(_0x23da('0x3'));var BPromise=require(_0x23da('0x4'));var Mustache=require(_0x23da('0x5'));var util=require(_0x23da('0x6'));var path=require(_0x23da('0x7'));var sox=require(_0x23da('0x8'));var csv=require(_0x23da('0x9'));var ejs=require(_0x23da('0xa'));var fs=require('fs');var fs_extra=require(_0x23da('0xb'));var _=require('lodash');var squel=require(_0x23da('0xc'));var crypto=require(_0x23da('0xd'));var jsforce=require(_0x23da('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x23da('0x9'));var querystring=require(_0x23da('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x23da('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23da('0x11'));var logger=require(_0x23da('0x12'))(_0x23da('0x13'));var utils=require(_0x23da('0x14'));var config=require(_0x23da('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x23da('0x16'))['db'];function respondWithStatusCode(_0x27172a,_0x2c5bff){_0x2c5bff=_0x2c5bff||0xcc;return function(_0x5238dd){if(_0x5238dd){return _0x27172a[_0x23da('0x17')](_0x2c5bff);}return _0x27172a['status'](_0x2c5bff)['end']();};}function respondWithResult(_0x5569f6,_0x4ac3cd){_0x4ac3cd=_0x4ac3cd||0xc8;return function(_0x30d117){if(_0x30d117){return _0x5569f6[_0x23da('0x18')](_0x4ac3cd)[_0x23da('0x19')](_0x30d117);}};}function respondWithFilteredResult(_0x5d7762,_0x4d853f){return function(_0x4b7e69){if(_0x4b7e69){var _0x357286=typeof _0x4d853f['offset']===_0x23da('0x1a')&&typeof _0x4d853f[_0x23da('0x1b')]===_0x23da('0x1a');var _0x16a420=_0x4b7e69['count'];var _0x3fbdbc=_0x357286?0x0:_0x4d853f['offset'];var _0x5a6dfc=_0x357286?_0x4b7e69['count']:_0x4d853f['offset']+_0x4d853f[_0x23da('0x1b')];var _0xbbb31d;if(_0x5a6dfc>=_0x16a420){_0x5a6dfc=_0x16a420;_0xbbb31d=0xc8;}else{_0xbbb31d=0xce;}_0x5d7762[_0x23da('0x18')](_0xbbb31d);return _0x5d7762[_0x23da('0x1c')](_0x23da('0x1d'),_0x3fbdbc+'-'+_0x5a6dfc+'/'+_0x16a420)[_0x23da('0x19')](_0x4b7e69);}return null;};}function patchUpdates(_0x48f281){return function(_0x54ac07){try{jsonpatch[_0x23da('0x1e')](_0x54ac07,_0x48f281,!![]);}catch(_0x2d8b87){return BPromise[_0x23da('0x1f')](_0x2d8b87);}return _0x54ac07[_0x23da('0x20')]();};}function saveUpdates(_0x1b38b8,_0x3c370c){return function(_0x512297){if(_0x512297){return _0x512297['update'](_0x1b38b8)[_0x23da('0x21')](function(_0x34bf94){return _0x34bf94;});}return null;};}function removeEntity(_0xb28dc2,_0x485d31){return function(_0x27c314){if(_0x27c314){return _0x27c314[_0x23da('0x22')]()[_0x23da('0x21')](function(){_0xb28dc2[_0x23da('0x18')](0xcc)[_0x23da('0x23')]();});}};}function handleEntityNotFound(_0x512e3e,_0x120632){return function(_0x107e8c){if(!_0x107e8c){_0x512e3e[_0x23da('0x17')](0x194);}return _0x107e8c;};}function handleError(_0x31327b,_0x953403){_0x953403=_0x953403||0x1f4;return function(_0x13b1b8){logger['error'](_0x13b1b8[_0x23da('0x24')]);if(_0x13b1b8[_0x23da('0x25')]){delete _0x13b1b8[_0x23da('0x25')];}_0x31327b[_0x23da('0x18')](_0x953403)[_0x23da('0x26')](_0x13b1b8);};}exports[_0x23da('0x27')]=function(_0x4fbd1a,_0x5a4ade){var _0x43e6dc={},_0x163896={},_0x29471d={'count':0x0,'rows':[]};var _0xd40b15=_['map'](db['MailTransferReport'][_0x23da('0x28')],function(_0x4107c2){return{'name':_0x4107c2[_0x23da('0x29')],'type':_0x4107c2[_0x23da('0x2a')][_0x23da('0x2b')]};});_0x163896[_0x23da('0x2c')]=_['map'](_0xd40b15,_0x23da('0x25'));_0x163896['query']=_[_0x23da('0x2d')](_0x4fbd1a['query']);_0x163896[_0x23da('0x2e')]=_[_0x23da('0x2f')](_0x163896[_0x23da('0x2c')],_0x163896[_0x23da('0x30')]);_0x43e6dc[_0x23da('0x31')]=_[_0x23da('0x2f')](_0x163896[_0x23da('0x2c')],qs[_0x23da('0x32')](_0x4fbd1a['query'][_0x23da('0x32')]));_0x43e6dc[_0x23da('0x31')]=_0x43e6dc['attributes']['length']?_0x43e6dc[_0x23da('0x31')]:_0x163896[_0x23da('0x2c')];if(!_0x4fbd1a[_0x23da('0x30')][_0x23da('0x33')](_0x23da('0x34'))){_0x43e6dc[_0x23da('0x1b')]=qs[_0x23da('0x1b')](_0x4fbd1a['query'][_0x23da('0x1b')]);_0x43e6dc[_0x23da('0x35')]=qs[_0x23da('0x35')](_0x4fbd1a[_0x23da('0x30')]['offset']);}_0x43e6dc[_0x23da('0x36')]=qs['sort'](_0x4fbd1a['query'][_0x23da('0x37')]);_0x43e6dc['where']=qs[_0x23da('0x2e')](_[_0x23da('0x38')](_0x4fbd1a[_0x23da('0x30')],_0x163896['filters']),_0xd40b15);if(_0x4fbd1a[_0x23da('0x30')][_0x23da('0x39')]){_0x43e6dc[_0x23da('0x3a')]=_[_0x23da('0x3b')](_0x43e6dc['where'],{'$or':_[_0x23da('0x3c')](_0xd40b15,function(_0x461c23){if(_0x461c23[_0x23da('0x2a')]!=='VIRTUAL'){var _0x4941b3={};_0x4941b3[_0x461c23[_0x23da('0x25')]]={'$like':'%'+_0x4fbd1a['query'][_0x23da('0x39')]+'%'};return _0x4941b3;}})});}_0x43e6dc=_[_0x23da('0x3b')]({},_0x43e6dc,_0x4fbd1a['options']);var _0x4c0cff={'where':_0x43e6dc[_0x23da('0x3a')]};return db[_0x23da('0x3d')][_0x23da('0x3e')](_0x4c0cff)['then'](function(_0x48e4ae){_0x29471d[_0x23da('0x3e')]=_0x48e4ae;if(_0x4fbd1a['query'][_0x23da('0x3f')]){_0x43e6dc[_0x23da('0x40')]=[{'all':!![]}];}return db[_0x23da('0x3d')][_0x23da('0x41')](_0x43e6dc);})[_0x23da('0x21')](function(_0x4ffb17){_0x29471d[_0x23da('0x42')]=_0x4ffb17;return _0x29471d;})[_0x23da('0x21')](respondWithFilteredResult(_0x5a4ade,_0x43e6dc))['catch'](handleError(_0x5a4ade,null));};exports[_0x23da('0x43')]=function(_0x42e545,_0xe57069){var _0x14c22f={'raw':!![],'where':{'id':_0x42e545[_0x23da('0x44')]['id']}},_0x29d902={};_0x29d902[_0x23da('0x2c')]=_[_0x23da('0x2d')](db[_0x23da('0x3d')][_0x23da('0x28')]);_0x29d902[_0x23da('0x30')]=_[_0x23da('0x2d')](_0x42e545[_0x23da('0x30')]);_0x29d902[_0x23da('0x2e')]=_['intersection'](_0x29d902[_0x23da('0x2c')],_0x29d902[_0x23da('0x30')]);_0x14c22f[_0x23da('0x31')]=_[_0x23da('0x2f')](_0x29d902['model'],qs['fields'](_0x42e545['query'][_0x23da('0x32')]));_0x14c22f[_0x23da('0x31')]=_0x14c22f['attributes']['length']?_0x14c22f[_0x23da('0x31')]:_0x29d902[_0x23da('0x2c')];if(_0x42e545[_0x23da('0x30')][_0x23da('0x3f')]){_0x14c22f[_0x23da('0x40')]=[{'all':!![]}];}_0x14c22f=_[_0x23da('0x3b')]({},_0x14c22f,_0x42e545[_0x23da('0x45')]);return db[_0x23da('0x3d')][_0x23da('0x46')](_0x14c22f)[_0x23da('0x21')](handleEntityNotFound(_0xe57069,null))['then'](respondWithResult(_0xe57069,null))[_0x23da('0x47')](handleError(_0xe57069,null));};exports['create']=function(_0x4065d4,_0x2e1d4a){return db['MailTransferReport'][_0x23da('0x48')](_0x4065d4[_0x23da('0x49')],{})[_0x23da('0x21')](respondWithResult(_0x2e1d4a,0xc9))[_0x23da('0x47')](handleError(_0x2e1d4a,null));};exports[_0x23da('0x4a')]=function(_0x4d2d14,_0x552033){if(_0x4d2d14[_0x23da('0x49')]['id']){delete _0x4d2d14[_0x23da('0x49')]['id'];}return db[_0x23da('0x3d')]['find']({'where':{'id':_0x4d2d14[_0x23da('0x44')]['id']}})[_0x23da('0x21')](handleEntityNotFound(_0x552033,null))[_0x23da('0x21')](saveUpdates(_0x4d2d14[_0x23da('0x49')],null))['then'](respondWithResult(_0x552033,null))[_0x23da('0x47')](handleError(_0x552033,null));};exports[_0x23da('0x22')]=function(_0x3d5057,_0x3a5c54){return db[_0x23da('0x3d')]['find']({'where':{'id':_0x3d5057[_0x23da('0x44')]['id']}})[_0x23da('0x21')](handleEntityNotFound(_0x3a5c54,null))[_0x23da('0x21')](removeEntity(_0x3a5c54,null))[_0x23da('0x47')](handleError(_0x3a5c54,null));};exports[_0x23da('0x4b')]=function(_0x32422c,_0x2ca152){return db[_0x23da('0x3d')][_0x23da('0x4b')]()[_0x23da('0x21')](respondWithResult(_0x2ca152,null))['catch'](handleError(_0x2ca152,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9f86781..23aacb3 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 _0x9491=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_mail_transfer','uniqueid'];(function(_0x3da3a5,_0x43af27){var _0x1afebb=function(_0x56a176){while(--_0x56a176){_0x3da3a5['push'](_0x3da3a5['shift']());}};_0x1afebb(++_0x43af27);}(_0x9491,0xb6));var _0x1949=function(_0x2d775f,_0xe2e5d4){_0x2d775f=_0x2d775f-0x0;var _0x313c7d=_0x9491[_0x2d775f];return _0x313c7d;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var logger=require(_0x1949('0x2'))(_0x1949('0x3'));var moment=require(_0x1949('0x4'));var BPromise=require(_0x1949('0x5'));var rp=require(_0x1949('0x6'));var fs=require('fs');var path=require(_0x1949('0x7'));var rimraf=require(_0x1949('0x8'));var config=require(_0x1949('0x9'));var attributes=require('./mailTransferReport.attributes');module[_0x1949('0xa')]=function(_0x5b01b9,_0x14c30e){return _0x5b01b9[_0x1949('0xb')]('MailTransferReport',attributes,{'tableName':_0x1949('0xc'),'paranoid':![],'indexes':[{'name':_0x1949('0xd'),'fields':[_0x1949('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f9a=['../../config/logger','api','bluebird','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','lodash','util'];(function(_0x3431f1,_0x4e0e11){var _0x526f45=function(_0x27e94c){while(--_0x27e94c){_0x3431f1['push'](_0x3431f1['shift']());}};_0x526f45(++_0x4e0e11);}(_0x0f9a,0x174));var _0xa0f9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0f9a[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xa0f9('0x0'));var util=require(_0xa0f9('0x1'));var logger=require(_0xa0f9('0x2'))(_0xa0f9('0x3'));var moment=require('moment');var BPromise=require(_0xa0f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa0f9('0x5'));var config=require('../../config/environment');var attributes=require(_0xa0f9('0x6'));module[_0xa0f9('0x7')]=function(_0x16ab96,_0x34d852){return _0x16ab96[_0xa0f9('0x8')](_0xa0f9('0x9'),attributes,{'tableName':_0xa0f9('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index fb1c8b4..45b54f6 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 _0x7836=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x199a7a,_0x54449f){var _0x584ead=function(_0x36093c){while(--_0x36093c){_0x199a7a['push'](_0x199a7a['shift']());}};_0x584ead(++_0x54449f);}(_0x7836,0xfc));var _0x6783=function(_0x42a584,_0x2d9ee3){_0x42a584=_0x42a584-0x0;var _0x56be59=_0x7836[_0x42a584];return _0x56be59;};'use strict';var _=require(_0x6783('0x0'));var util=require(_0x6783('0x1'));var moment=require(_0x6783('0x2'));var BPromise=require(_0x6783('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6783('0x4'));var db=require(_0x6783('0x5'))['db'];var utils=require(_0x6783('0x6'));var logger=require(_0x6783('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6783('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c88f9,_0x4aaf4d,_0x30fc80){return new BPromise(function(_0x28ce5f,_0x12b7ab){return client[_0x6783('0x9')](_0x2c88f9,_0x30fc80)[_0x6783('0xa')](function(_0x1ba71e){logger[_0x6783('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x4aaf4d,_0x6783('0xc'));logger['debug'](_0x6783('0xd'),_0x4aaf4d,_0x6783('0xc'),JSON[_0x6783('0xe')](_0x1ba71e));if(_0x1ba71e[_0x6783('0xf')]){if(_0x1ba71e[_0x6783('0xf')][_0x6783('0x10')]===0x1f4){logger[_0x6783('0xf')](_0x6783('0x11'),_0x4aaf4d,_0x1ba71e[_0x6783('0xf')][_0x6783('0x12')]);return _0x12b7ab(_0x1ba71e[_0x6783('0xf')][_0x6783('0x12')]);}logger[_0x6783('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x4aaf4d,_0x1ba71e[_0x6783('0xf')][_0x6783('0x12')]);return _0x28ce5f(_0x1ba71e[_0x6783('0xf')][_0x6783('0x12')]);}else{logger[_0x6783('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x4aaf4d,'request\x20sent');_0x28ce5f(_0x1ba71e[_0x6783('0x13')]['message']);}})[_0x6783('0x14')](function(_0x4df4db){logger[_0x6783('0xf')](_0x6783('0x11'),_0x4aaf4d,_0x4df4db);_0x12b7ab(_0x4df4db);});});} \ No newline at end of file +var _0x9467=['http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','MailTransferReport,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9467,0xfd));var _0x7946=function(_0x5c4e29,_0x205413){_0x5c4e29=_0x5c4e29-0x0;var _0x2df565=_0x9467[_0x5c4e29];return _0x2df565;};'use strict';var _=require(_0x7946('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7946('0x1'));var rs=require(_0x7946('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7946('0x3'))['db'];var utils=require(_0x7946('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7946('0x5'));var client=jayson[_0x7946('0x6')][_0x7946('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23f906,_0x46de82,_0x2c7192){return new BPromise(function(_0x94c97a,_0x2782ff){return client[_0x7946('0x8')](_0x23f906,_0x2c7192)[_0x7946('0x9')](function(_0xf580f6){logger[_0x7946('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x46de82,_0x7946('0xb'));logger[_0x7946('0xc')](_0x7946('0xd'),_0x46de82,'request\x20sent',JSON[_0x7946('0xe')](_0xf580f6));if(_0xf580f6['error']){if(_0xf580f6[_0x7946('0xf')]['code']===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x46de82,_0xf580f6['error'][_0x7946('0x10')]);return _0x2782ff(_0xf580f6[_0x7946('0xf')][_0x7946('0x10')]);}logger[_0x7946('0xf')](_0x7946('0x11'),_0x46de82,_0xf580f6['error'][_0x7946('0x10')]);return _0x94c97a(_0xf580f6[_0x7946('0xf')][_0x7946('0x10')]);}else{logger[_0x7946('0xa')](_0x7946('0x11'),_0x46de82,_0x7946('0xb'));_0x94c97a(_0xf580f6[_0x7946('0x12')][_0x7946('0x10')]);}})[_0x7946('0x13')](function(_0x588e1b){logger['error'](_0x7946('0x11'),_0x46de82,_0x588e1b);_0x2782ff(_0x588e1b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 64430ae..455cd01 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 _0x8c52=['show','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x8c52,0x1e2));var _0x28c5=function(_0x329905,_0x13c144){_0x329905=_0x329905-0x0;var _0x3aa42=_0x8c52[_0x329905];return _0x3aa42;};'use strict';var multer=require('multer');var util=require(_0x28c5('0x0'));var path=require(_0x28c5('0x1'));var timeout=require(_0x28c5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x28c5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x28c5('0x4'));var config=require(_0x28c5('0x5'));var controller=require('./memberReport.controller');router['get']('/',auth[_0x28c5('0x6')](),controller[_0x28c5('0x7')]);router['get'](_0x28c5('0x8'),auth[_0x28c5('0x6')](),controller[_0x28c5('0x9')]);router[_0x28c5('0xa')](_0x28c5('0xb'),auth[_0x28c5('0x6')](),controller[_0x28c5('0xc')]);router['post']('/',auth[_0x28c5('0x6')](),controller[_0x28c5('0xd')]);router[_0x28c5('0xe')](_0x28c5('0xb'),auth[_0x28c5('0x6')](),controller[_0x28c5('0xf')]);router[_0x28c5('0x10')]('/:id',auth[_0x28c5('0x6')](),controller[_0x28c5('0x11')]);module[_0x28c5('0x12')]=router; \ No newline at end of file +var _0x90a2=['update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x4c7679,_0x191922){var _0x523203=function(_0x4a405c){while(--_0x4a405c){_0x4c7679['push'](_0x4c7679['shift']());}};_0x523203(++_0x191922);}(_0x90a2,0x1a0));var _0x290a=function(_0x113cc4,_0x256958){_0x113cc4=_0x113cc4-0x0;var _0x4171c2=_0x90a2[_0x113cc4];return _0x4171c2;};'use strict';var multer=require(_0x290a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x290a('0x1'));var express=require(_0x290a('0x2'));var router=express[_0x290a('0x3')]();var fs_extra=require(_0x290a('0x4'));var auth=require(_0x290a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x290a('0x6'));router[_0x290a('0x7')]('/',auth[_0x290a('0x8')](),controller[_0x290a('0x9')]);router[_0x290a('0x7')]('/describe',auth[_0x290a('0x8')](),controller[_0x290a('0xa')]);router[_0x290a('0x7')](_0x290a('0xb'),auth[_0x290a('0x8')](),controller[_0x290a('0xc')]);router[_0x290a('0xd')]('/',auth[_0x290a('0x8')](),controller[_0x290a('0xe')]);router[_0x290a('0xf')](_0x290a('0xb'),auth[_0x290a('0x8')](),controller[_0x290a('0x10')]);router['delete'](_0x290a('0xb'),auth[_0x290a('0x8')](),controller['destroy']);module[_0x290a('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 16f2888..231df6b 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 _0x04c6=['getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x5ae406,_0x3f4bf5){var _0x25f2e0=function(_0x1c709a){while(--_0x1c709a){_0x5ae406['push'](_0x5ae406['shift']());}};_0x25f2e0(++_0x3f4bf5);}(_0x04c6,0x106));var _0x604c=function(_0x25500b,_0x4dc88b){_0x25500b=_0x25500b-0x0;var _0x22665a=_0x04c6[_0x25500b];return _0x22665a;};'use strict';var Sequelize=require(_0x604c('0x0'));var moment=require(_0x604c('0x1'));module[_0x604c('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x604c('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x604c('0x4'),'comment':_0x604c('0x5')},'duration':{'type':Sequelize[_0x604c('0x6')]},'enterAt':{'type':Sequelize[_0x604c('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1e93ec){var _0x5422fd=moment(_0x1e93ec);var _0x37c895=moment(this[_0x604c('0x8')](_0x604c('0x9')));var _0x77cc5f=_0x5422fd[_0x604c('0xa')](_0x37c895,_0x604c('0xb'));this[_0x604c('0xc')](_0x604c('0xd'),_0x1e93ec);this[_0x604c('0xc')](_0x604c('0xe'),_0x77cc5f>=0x0?_0x77cc5f:null);}},'data1':{'type':Sequelize[_0x604c('0x3')],'comment':_0x604c('0xf')},'data2':{'type':Sequelize[_0x604c('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x604c('0x3')],'comment':_0x604c('0x10')},'data4':{'type':Sequelize[_0x604c('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x604c('0x3')],'comment':_0x604c('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x604c('0x3')]}}; \ No newline at end of file +var _0xbffb=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue'];(function(_0x10319c,_0x511e1d){var _0x4a808b=function(_0x510463){while(--_0x510463){_0x10319c['push'](_0x10319c['shift']());}};_0x4a808b(++_0x511e1d);}(_0xbffb,0x155));var _0xbbff=function(_0x4de2bd,_0x3c40cf){_0x4de2bd=_0x4de2bd-0x0;var _0xcbd044=_0xbffb[_0x4de2bd];return _0xcbd044;};'use strict';var Sequelize=require(_0xbbff('0x0'));var moment=require('moment');module[_0xbbff('0x1')]={'channel':{'type':Sequelize[_0xbbff('0x2')]},'membername':{'type':Sequelize[_0xbbff('0x2')]},'interface':{'type':Sequelize[_0xbbff('0x2')]},'type':{'type':Sequelize[_0xbbff('0x2')],'defaultValue':_0xbbff('0x3'),'comment':_0xbbff('0x4')},'duration':{'type':Sequelize[_0xbbff('0x5')]},'enterAt':{'type':Sequelize[_0xbbff('0x6')]},'exitAt':{'type':Sequelize[_0xbbff('0x6')],'set':function(_0x9455ff){var _0x21d92c=moment(_0x9455ff);var _0x4cee25=moment(this[_0xbbff('0x7')](_0xbbff('0x8')));var _0x3b6195=_0x21d92c['diff'](_0x4cee25,_0xbbff('0x9'));this[_0xbbff('0xa')]('exitAt',_0x9455ff);this[_0xbbff('0xa')](_0xbbff('0xb'),_0x3b6195>=0x0?_0x3b6195:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xbbff('0xc')},'data2':{'type':Sequelize[_0xbbff('0x2')],'comment':_0xbbff('0xd')},'data3':{'type':Sequelize[_0xbbff('0x2')],'comment':_0xbbff('0xe')},'data4':{'type':Sequelize[_0xbbff('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xbbff('0xf')},'role':{'type':Sequelize[_0xbbff('0x2')]},'internal':{'type':Sequelize[_0xbbff('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b998601..64bb405 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0xef0d7,_0x3ba275){var _0x3dd0a3=function(_0x3e77b3){while(--_0x3e77b3){_0xef0d7['push'](_0xef0d7['shift']());}};_0x3dd0a3(++_0x3ba275);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x34e8,0x12c));var _0x834e=function(_0x44f12f,_0x35f9c9){_0x44f12f=_0x44f12f-0x0;var _0x396752=_0x34e8[_0x44f12f];return _0x396752;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a2eb7fe..3c8ab20 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 _0x655a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','lodash','../../config/logger','api'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x655a,0xed));var _0xa655=function(_0x1c9388,_0x46087d){_0x1c9388=_0x1c9388-0x0;var _0x38e4e5=_0x655a[_0x1c9388];return _0x38e4e5;};'use strict';var _=require(_0xa655('0x0'));var util=require('util');var logger=require(_0xa655('0x1'))(_0xa655('0x2'));var moment=require(_0xa655('0x3'));var BPromise=require(_0xa655('0x4'));var rp=require(_0xa655('0x5'));var fs=require('fs');var path=require(_0xa655('0x6'));var rimraf=require(_0xa655('0x7'));var config=require(_0xa655('0x8'));var attributes=require(_0xa655('0x9'));module[_0xa655('0xa')]=function(_0x532352,_0x364cef){return _0x532352[_0xa655('0xb')](_0xa655('0xc'),attributes,{'tableName':_0xa655('0xd'),'paranoid':![],'indexes':[{'name':_0xa655('0xe'),'fields':[_0xa655('0xf'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c17=['path','rimraf','../../config/environment','define','MemberReport','report_member','membername_interface','interface','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x30375e,_0x22dce1){var _0x3fc7f8=function(_0x81bcaa){while(--_0x81bcaa){_0x30375e['push'](_0x30375e['shift']());}};_0x3fc7f8(++_0x22dce1);}(_0x2c17,0x174));var _0x72c1=function(_0x587179,_0x2704a2){_0x587179=_0x587179-0x0;var _0x3756b4=_0x2c17[_0x587179];return _0x3756b4;};'use strict';var _=require(_0x72c1('0x0'));var util=require(_0x72c1('0x1'));var logger=require(_0x72c1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x72c1('0x3'));var rp=require(_0x72c1('0x4'));var fs=require('fs');var path=require(_0x72c1('0x5'));var rimraf=require(_0x72c1('0x6'));var config=require(_0x72c1('0x7'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x285a39,_0x493967){return _0x285a39[_0x72c1('0x8')](_0x72c1('0x9'),attributes,{'tableName':_0x72c1('0xa'),'paranoid':![],'indexes':[{'name':_0x72c1('0xb'),'fields':['membername',_0x72c1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d4db275..53ec342 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 _0xdedd=['client','http','then','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateMemberReport','create','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x582262,_0x519b77){var _0x3c8343=function(_0xb6ff5d){while(--_0xb6ff5d){_0x582262['push'](_0x582262['shift']());}};_0x3c8343(++_0x519b77);}(_0xdedd,0x197));var _0xdded=function(_0x1fa1bf,_0x139739){_0x1fa1bf=_0x1fa1bf-0x0;var _0x49cbcf=_0xdedd[_0x1fa1bf];return _0x49cbcf;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var moment=require(_0xdded('0x2'));var BPromise=require(_0xdded('0x3'));var rs=require(_0xdded('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdded('0x5'))['db'];var utils=require(_0xdded('0x6'));var logger=require(_0xdded('0x7'))(_0xdded('0x8'));var config=require(_0xdded('0x9'));var jayson=require(_0xdded('0xa'));var client=jayson[_0xdded('0xb')][_0xdded('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59aa13,_0x5a43e7,_0x558cff){return new BPromise(function(_0x224a4d,_0x4a2516){return client['request'](_0x59aa13,_0x558cff)[_0xdded('0xd')](function(_0x1a183f){logger[_0xdded('0xe')](_0xdded('0xf'),_0x5a43e7,'request\x20sent');logger[_0xdded('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5a43e7,_0xdded('0x11'),JSON[_0xdded('0x12')](_0x1a183f));if(_0x1a183f[_0xdded('0x13')]){if(_0x1a183f[_0xdded('0x13')][_0xdded('0x14')]===0x1f4){logger[_0xdded('0x13')](_0xdded('0xf'),_0x5a43e7,_0x1a183f[_0xdded('0x13')][_0xdded('0x15')]);return _0x4a2516(_0x1a183f['error'][_0xdded('0x15')]);}logger[_0xdded('0x13')]('MemberReport,\x20%s,\x20%s',_0x5a43e7,_0x1a183f[_0xdded('0x13')]['message']);return _0x224a4d(_0x1a183f[_0xdded('0x13')]['message']);}else{logger[_0xdded('0xe')](_0xdded('0xf'),_0x5a43e7,_0xdded('0x11'));_0x224a4d(_0x1a183f['result'][_0xdded('0x15')]);}})[_0xdded('0x16')](function(_0x2ef523){logger[_0xdded('0x13')](_0xdded('0xf'),_0x5a43e7,_0x2ef523);_0x4a2516(_0x2ef523);});});}exports[_0xdded('0x17')]=function(_0x323c30){var _0x436ee9=this;return new Promise(function(_0x4f249e,_0x3380b7){return db[_0xdded('0x18')][_0xdded('0x19')]({'raw':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1b')]===undefined?!![]:![]:!![],'where':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1c')]||null:null,'attributes':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1d')]||null:null,'limit':_0x323c30[_0xdded('0x1a')]?_0x323c30['options'][_0xdded('0x1e')]||null:null,'include':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1f')]?_['map'](_0x323c30[_0xdded('0x1a')]['include'],function(_0x223048){return{'model':db[_0x223048[_0xdded('0x20')]],'as':_0x223048['as'],'attributes':_0x223048[_0xdded('0x1d')],'include':_0x223048[_0xdded('0x1f')]?_[_0xdded('0x21')](_0x223048['include'],function(_0x1c5025){return{'model':db[_0x1c5025[_0xdded('0x20')]],'as':_0x1c5025['as'],'attributes':_0x1c5025[_0xdded('0x1d')],'include':_0x1c5025[_0xdded('0x1f')]?_[_0xdded('0x21')](_0x1c5025['include'],function(_0x5e2dfb){return{'model':db[_0x5e2dfb[_0xdded('0x20')]],'as':_0x5e2dfb['as'],'attributes':_0x5e2dfb[_0xdded('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdded('0xd')](function(_0x4358f6){logger[_0xdded('0xe')]('GetMemberReport',_0x323c30);logger[_0xdded('0x10')](_0xdded('0x17'),_0x323c30,JSON[_0xdded('0x12')](_0x4358f6));_0x4f249e(_0x4358f6);})[_0xdded('0x16')](function(_0x560dca){logger[_0xdded('0x13')]('GetMemberReport',_0x560dca[_0xdded('0x15')],_0x323c30);_0x3380b7(_0x436ee9[_0xdded('0x13')](0x1f4,_0x560dca[_0xdded('0x15')]));});});};exports[_0xdded('0x22')]=function(_0xf193a8){var _0x3459c7=this;return new Promise(function(_0xdf0051,_0x49d098){return db[_0xdded('0x18')][_0xdded('0x23')](_0xf193a8['body'],{'raw':_0xf193a8[_0xdded('0x1a')]?_0xf193a8[_0xdded('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x48ebde){logger['info'](_0xdded('0x22'),_0xf193a8);logger[_0xdded('0x10')](_0xdded('0x22'),_0xf193a8,JSON[_0xdded('0x12')](_0x48ebde));_0xdf0051(_0x48ebde);})[_0xdded('0x16')](function(_0x3e9982){logger[_0xdded('0x13')]('CreateMemberReport',_0x3e9982[_0xdded('0x15')],_0xf193a8);_0x49d098(_0x3459c7[_0xdded('0x13')](0x1f4,_0x3e9982[_0xdded('0x15')]));});});};exports[_0xdded('0x24')]=function(_0x6f4412){var _0x11543c=this;return new Promise(function(_0x560d51,_0x23896a){return db[_0xdded('0x18')][_0xdded('0x25')](_0x6f4412['body'],{'raw':_0x6f4412[_0xdded('0x1a')]?_0x6f4412[_0xdded('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f4412[_0xdded('0x1a')]?_0x6f4412[_0xdded('0x1a')][_0xdded('0x1c')]||null:null,'attributes':_0x6f4412[_0xdded('0x1a')]?_0x6f4412[_0xdded('0x1a')][_0xdded('0x1d')]||null:null,'limit':_0x6f4412[_0xdded('0x1a')]?_0x6f4412[_0xdded('0x1a')][_0xdded('0x1e')]||null:null})[_0xdded('0xd')](function(_0x975447){logger[_0xdded('0xe')]('UpdateMemberReport',_0x6f4412);logger['debug'](_0xdded('0x24'),_0x6f4412,JSON[_0xdded('0x12')](_0x975447));_0x560d51(_0x975447);})[_0xdded('0x16')](function(_0x24ba4a){logger[_0xdded('0x13')](_0xdded('0x24'),_0x24ba4a[_0xdded('0x15')],_0x6f4412);_0x23896a(_0x11543c[_0xdded('0x13')](0x1f4,_0x24ba4a[_0xdded('0x15')]));});});}; \ No newline at end of file +var _0xc0a4=['then','CreateMemberReport','create','body','UpdateMemberReport','update','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x136234,_0x43087f){var _0x2ca434=function(_0x361dc6){while(--_0x361dc6){_0x136234['push'](_0x136234['shift']());}};_0x2ca434(++_0x43087f);}(_0xc0a4,0x147));var _0x4c0a=function(_0x51ae9a,_0x58150b){_0x51ae9a=_0x51ae9a-0x0;var _0x237422=_0xc0a4[_0x51ae9a];return _0x237422;};'use strict';var _=require('lodash');var util=require(_0x4c0a('0x0'));var moment=require(_0x4c0a('0x1'));var BPromise=require(_0x4c0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c0a('0x3'));var db=require(_0x4c0a('0x4'))['db'];var utils=require(_0x4c0a('0x5'));var logger=require(_0x4c0a('0x6'))(_0x4c0a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4c0a('0x8'));var client=jayson[_0x4c0a('0x9')][_0x4c0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x457ef9,_0x7ca892,_0x1a64e7){return new BPromise(function(_0x4093d5,_0x33aedb){return client[_0x4c0a('0xb')](_0x457ef9,_0x1a64e7)['then'](function(_0x3bfa91){logger[_0x4c0a('0xc')](_0x4c0a('0xd'),_0x7ca892,_0x4c0a('0xe'));logger[_0x4c0a('0xf')](_0x4c0a('0x10'),_0x7ca892,_0x4c0a('0xe'),JSON[_0x4c0a('0x11')](_0x3bfa91));if(_0x3bfa91[_0x4c0a('0x12')]){if(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x13')]===0x1f4){logger[_0x4c0a('0x12')]('MemberReport,\x20%s,\x20%s',_0x7ca892,_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);return _0x33aedb(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);}logger['error'](_0x4c0a('0xd'),_0x7ca892,_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);return _0x4093d5(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);}else{logger[_0x4c0a('0xc')](_0x4c0a('0xd'),_0x7ca892,_0x4c0a('0xe'));_0x4093d5(_0x3bfa91[_0x4c0a('0x15')][_0x4c0a('0x14')]);}})[_0x4c0a('0x16')](function(_0x4637a8){logger[_0x4c0a('0x12')](_0x4c0a('0xd'),_0x7ca892,_0x4637a8);_0x33aedb(_0x4637a8);});});}exports[_0x4c0a('0x17')]=function(_0x7e7d4b){var _0x4bdb26=this;return new Promise(function(_0x251c7f,_0x47e9df){return db[_0x4c0a('0x18')][_0x4c0a('0x19')]({'raw':_0x7e7d4b[_0x4c0a('0x1a')]?_0x7e7d4b[_0x4c0a('0x1a')][_0x4c0a('0x1b')]===undefined?!![]:![]:!![],'where':_0x7e7d4b['options']?_0x7e7d4b[_0x4c0a('0x1a')]['where']||null:null,'attributes':_0x7e7d4b[_0x4c0a('0x1a')]?_0x7e7d4b[_0x4c0a('0x1a')][_0x4c0a('0x1c')]||null:null,'limit':_0x7e7d4b[_0x4c0a('0x1a')]?_0x7e7d4b['options'][_0x4c0a('0x1d')]||null:null,'include':_0x7e7d4b[_0x4c0a('0x1a')]?_0x7e7d4b[_0x4c0a('0x1a')][_0x4c0a('0x1e')]?_[_0x4c0a('0x1f')](_0x7e7d4b[_0x4c0a('0x1a')][_0x4c0a('0x1e')],function(_0x5bd479){return{'model':db[_0x5bd479['model']],'as':_0x5bd479['as'],'attributes':_0x5bd479[_0x4c0a('0x1c')],'include':_0x5bd479['include']?_[_0x4c0a('0x1f')](_0x5bd479[_0x4c0a('0x1e')],function(_0x22a3ad){return{'model':db[_0x22a3ad[_0x4c0a('0x20')]],'as':_0x22a3ad['as'],'attributes':_0x22a3ad[_0x4c0a('0x1c')],'include':_0x22a3ad['include']?_[_0x4c0a('0x1f')](_0x22a3ad[_0x4c0a('0x1e')],function(_0x5b91e2){return{'model':db[_0x5b91e2['model']],'as':_0x5b91e2['as'],'attributes':_0x5b91e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c0a('0x21')](function(_0x5c7676){logger['info'](_0x4c0a('0x17'),_0x7e7d4b);logger['debug'](_0x4c0a('0x17'),_0x7e7d4b,JSON[_0x4c0a('0x11')](_0x5c7676));_0x251c7f(_0x5c7676);})[_0x4c0a('0x16')](function(_0x5baa4b){logger[_0x4c0a('0x12')](_0x4c0a('0x17'),_0x5baa4b['message'],_0x7e7d4b);_0x47e9df(_0x4bdb26[_0x4c0a('0x12')](0x1f4,_0x5baa4b[_0x4c0a('0x14')]));});});};exports[_0x4c0a('0x22')]=function(_0x2dd974){var _0x5cf3c7=this;return new Promise(function(_0x28f3ce,_0x11bdda){return db['MemberReport'][_0x4c0a('0x23')](_0x2dd974[_0x4c0a('0x24')],{'raw':_0x2dd974[_0x4c0a('0x1a')]?_0x2dd974[_0x4c0a('0x1a')][_0x4c0a('0x1b')]===undefined?!![]:![]:!![]})[_0x4c0a('0x21')](function(_0x27bec9){logger['info'](_0x4c0a('0x22'),_0x2dd974);logger[_0x4c0a('0xf')](_0x4c0a('0x22'),_0x2dd974,JSON[_0x4c0a('0x11')](_0x27bec9));_0x28f3ce(_0x27bec9);})[_0x4c0a('0x16')](function(_0x363179){logger[_0x4c0a('0x12')](_0x4c0a('0x22'),_0x363179[_0x4c0a('0x14')],_0x2dd974);_0x11bdda(_0x5cf3c7['error'](0x1f4,_0x363179[_0x4c0a('0x14')]));});});};exports[_0x4c0a('0x25')]=function(_0x555aaf){var _0x56b1dc=this;return new Promise(function(_0xd5d550,_0x48ed41){return db['MemberReport'][_0x4c0a('0x26')](_0x555aaf[_0x4c0a('0x24')],{'raw':_0x555aaf[_0x4c0a('0x1a')]?_0x555aaf[_0x4c0a('0x1a')][_0x4c0a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555aaf['options']?_0x555aaf[_0x4c0a('0x1a')][_0x4c0a('0x27')]||null:null,'attributes':_0x555aaf[_0x4c0a('0x1a')]?_0x555aaf[_0x4c0a('0x1a')][_0x4c0a('0x1c')]||null:null,'limit':_0x555aaf['options']?_0x555aaf[_0x4c0a('0x1a')][_0x4c0a('0x1d')]||null:null})['then'](function(_0x32fc59){logger[_0x4c0a('0xc')](_0x4c0a('0x25'),_0x555aaf);logger[_0x4c0a('0xf')](_0x4c0a('0x25'),_0x555aaf,JSON['stringify'](_0x32fc59));_0xd5d550(_0x32fc59);})[_0x4c0a('0x16')](function(_0xf5c47e){logger[_0x4c0a('0x12')](_0x4c0a('0x25'),_0xf5c47e['message'],_0x555aaf);_0x48ed41(_0x56b1dc[_0x4c0a('0x12')](0x1f4,_0xf5c47e[_0x4c0a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 8bd9eae..0d5e751 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 _0xf783=['Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','connect-timeout','express'];(function(_0x1f5d35,_0x13db91){var _0x27355a=function(_0x1a3932){while(--_0x1a3932){_0x1f5d35['push'](_0x1f5d35['shift']());}};_0x27355a(++_0x13db91);}(_0xf783,0x110));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f78('0x0'));var util=require(_0x3f78('0x1'));var path=require('path');var timeout=require(_0x3f78('0x2'));var express=require(_0x3f78('0x3'));var router=express[_0x3f78('0x4')]();var fs_extra=require(_0x3f78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3f78('0x6'));var config=require(_0x3f78('0x7'));var controller=require(_0x3f78('0x8'));router[_0x3f78('0x9')]('/',controller[_0x3f78('0xa')]);module[_0x3f78('0xb')]=router; \ No newline at end of file +var _0x89f2=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0x89f2,0x1e5));var _0x289f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x89f2[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x289f('0x0'));var path=require(_0x289f('0x1'));var timeout=require('connect-timeout');var express=require(_0x289f('0x2'));var router=express[_0x289f('0x3')]();var fs_extra=require(_0x289f('0x4'));var auth=require(_0x289f('0x5'));var interaction=require(_0x289f('0x6'));var config=require(_0x289f('0x7'));var controller=require('./migration.controller');router[_0x289f('0x8')]('/',controller[_0x289f('0x9')]);module[_0x289f('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index a74e272..9f6f081 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 _0x26a0=['STRING','version','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x26a0,0x12e));var _0x026a=function(_0x36852e,_0x4a95d8){_0x36852e=_0x36852e-0x0;var _0x6a859a=_0x26a0[_0x36852e];return _0x6a859a;};'use strict';var Sequelize=require('sequelize');module[_0x026a('0x0')]={'version':{'type':Sequelize[_0x026a('0x1')],'unique':_0x026a('0x2')}}; \ No newline at end of file +var _0xee6b=['version','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee6b,0x11e));var _0xbee6=function(_0x53c7a0,_0x41ece0){_0x53c7a0=_0x53c7a0-0x0;var _0x150d96=_0xee6b[_0x53c7a0];return _0x150d96;};'use strict';var Sequelize=require('sequelize');module[_0xbee6('0x0')]={'version':{'type':Sequelize[_0xbee6('0x1')],'unique':_0xbee6('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9db8f52..0f52933 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 _0x7697=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','index','Migration','rawAttributes','key','model','map','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x1e858c,_0x59d33d){var _0x4f6664=function(_0x486a76){while(--_0x486a76){_0x1e858c['push'](_0x1e858c['shift']());}};_0x4f6664(++_0x59d33d);}(_0x7697,0x164));var _0x7769=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7697[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require(_0x7769('0x0'));var rimraf=require(_0x7769('0x1'));var zipdir=require(_0x7769('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7769('0x3'));var moment=require(_0x7769('0x4'));var BPromise=require(_0x7769('0x5'));var Mustache=require('mustache');var util=require(_0x7769('0x6'));var path=require(_0x7769('0x7'));var sox=require('sox');var csv=require(_0x7769('0x8'));var ejs=require(_0x7769('0x9'));var fs=require('fs');var fs_extra=require(_0x7769('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7769('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7769('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7769('0xd'));var Redis=require(_0x7769('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7769('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7769('0x10'))(_0x7769('0x11'));var utils=require(_0x7769('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7769('0x13'));var db=require(_0x7769('0x14'))['db'];function respondWithStatusCode(_0x3edb78,_0x43af63){_0x43af63=_0x43af63||0xcc;return function(_0x3cc1be){if(_0x3cc1be){return _0x3edb78[_0x7769('0x15')](_0x43af63);}return _0x3edb78[_0x7769('0x16')](_0x43af63)[_0x7769('0x17')]();};}function respondWithResult(_0x431d77,_0x292c47){_0x292c47=_0x292c47||0xc8;return function(_0xa1bd1e){if(_0xa1bd1e){return _0x431d77[_0x7769('0x16')](_0x292c47)[_0x7769('0x18')](_0xa1bd1e);}};}function respondWithFilteredResult(_0xe4c978,_0x5ab754){return function(_0x281fad){if(_0x281fad){var _0x2acfaf=typeof _0x5ab754[_0x7769('0x19')]===_0x7769('0x1a')&&typeof _0x5ab754[_0x7769('0x1b')]===_0x7769('0x1a');var _0x436402=_0x281fad[_0x7769('0x1c')];var _0x4f5834=_0x2acfaf?0x0:_0x5ab754['offset'];var _0x22caea=_0x2acfaf?_0x281fad[_0x7769('0x1c')]:_0x5ab754[_0x7769('0x19')]+_0x5ab754[_0x7769('0x1b')];var _0x202778;if(_0x22caea>=_0x436402){_0x22caea=_0x436402;_0x202778=0xc8;}else{_0x202778=0xce;}_0xe4c978[_0x7769('0x16')](_0x202778);return _0xe4c978['set']('Content-Range',_0x4f5834+'-'+_0x22caea+'/'+_0x436402)['json'](_0x281fad);}return null;};}function patchUpdates(_0x451847){return function(_0x128901){try{jsonpatch[_0x7769('0x1d')](_0x128901,_0x451847,!![]);}catch(_0x4727e2){return BPromise[_0x7769('0x1e')](_0x4727e2);}return _0x128901[_0x7769('0x1f')]();};}function saveUpdates(_0x4202da,_0x231c84){return function(_0x26f4ac){if(_0x26f4ac){return _0x26f4ac['update'](_0x4202da)[_0x7769('0x20')](function(_0x220acd){return _0x220acd;});}return null;};}function removeEntity(_0x287c98,_0x77bb94){return function(_0x23572f){if(_0x23572f){return _0x23572f[_0x7769('0x21')]()['then'](function(){_0x287c98[_0x7769('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x160524,_0x48f215){return function(_0x191f08){if(!_0x191f08){_0x160524[_0x7769('0x15')](0x194);}return _0x191f08;};}function handleError(_0x59de96,_0x1f8c79){_0x1f8c79=_0x1f8c79||0x1f4;return function(_0x2f8343){logger[_0x7769('0x22')](_0x2f8343['stack']);if(_0x2f8343['name']){delete _0x2f8343['name'];}_0x59de96[_0x7769('0x16')](_0x1f8c79)['send'](_0x2f8343);};}exports[_0x7769('0x23')]=function(_0x5bd107,_0x1d45b4){var _0x500512={},_0x1a6a26={},_0x2a9f73={'count':0x0,'rows':[]};var _0x43da7d=_['map'](db[_0x7769('0x24')][_0x7769('0x25')],function(_0x5c0068){return{'name':_0x5c0068['fieldName'],'type':_0x5c0068['type'][_0x7769('0x26')]};});_0x1a6a26[_0x7769('0x27')]=_[_0x7769('0x28')](_0x43da7d,_0x7769('0x29'));_0x1a6a26[_0x7769('0x2a')]=_['keys'](_0x5bd107[_0x7769('0x2a')]);_0x1a6a26[_0x7769('0x2b')]=_[_0x7769('0x2c')](_0x1a6a26[_0x7769('0x27')],_0x1a6a26[_0x7769('0x2a')]);_0x500512[_0x7769('0x2d')]=_[_0x7769('0x2c')](_0x1a6a26[_0x7769('0x27')],qs['fields'](_0x5bd107[_0x7769('0x2a')][_0x7769('0x2e')]));_0x500512[_0x7769('0x2d')]=_0x500512[_0x7769('0x2d')][_0x7769('0x2f')]?_0x500512['attributes']:_0x1a6a26[_0x7769('0x27')];if(!_0x5bd107['query']['hasOwnProperty'](_0x7769('0x30'))){_0x500512[_0x7769('0x1b')]=qs[_0x7769('0x1b')](_0x5bd107[_0x7769('0x2a')]['limit']);_0x500512['offset']=qs[_0x7769('0x19')](_0x5bd107['query'][_0x7769('0x19')]);}_0x500512[_0x7769('0x31')]=qs['sort'](_0x5bd107['query'][_0x7769('0x32')]);_0x500512[_0x7769('0x33')]=qs[_0x7769('0x2b')](_[_0x7769('0x34')](_0x5bd107['query'],_0x1a6a26[_0x7769('0x2b')]),_0x43da7d);if(_0x5bd107['query'][_0x7769('0x35')]){_0x500512[_0x7769('0x33')]=_[_0x7769('0x36')](_0x500512[_0x7769('0x33')],{'$or':_[_0x7769('0x28')](_0x43da7d,function(_0xb0a7a5){if(_0xb0a7a5[_0x7769('0x37')]!==_0x7769('0x38')){var _0x353c70={};_0x353c70[_0xb0a7a5[_0x7769('0x29')]]={'$like':'%'+_0x5bd107[_0x7769('0x2a')][_0x7769('0x35')]+'%'};return _0x353c70;}})});}_0x500512=_['merge']({},_0x500512,_0x5bd107[_0x7769('0x39')]);var _0x4c7cd1={'where':_0x500512[_0x7769('0x33')]};return db['Migration'][_0x7769('0x1c')](_0x4c7cd1)['then'](function(_0x5deb5f){_0x2a9f73[_0x7769('0x1c')]=_0x5deb5f;if(_0x5bd107[_0x7769('0x2a')][_0x7769('0x3a')]){_0x500512[_0x7769('0x3b')]=[{'all':!![]}];}return db[_0x7769('0x24')][_0x7769('0x3c')](_0x500512);})[_0x7769('0x20')](function(_0x288e1c){_0x2a9f73['rows']=_0x288e1c;return _0x2a9f73;})[_0x7769('0x20')](respondWithFilteredResult(_0x1d45b4,_0x500512))[_0x7769('0x3d')](handleError(_0x1d45b4,null));}; \ No newline at end of file +var _0xfcb4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xfcb4,0x1d5));var _0x4fcb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfcb4[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4fcb('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fcb('0x1'));var moment=require(_0x4fcb('0x2'));var BPromise=require(_0x4fcb('0x3'));var Mustache=require(_0x4fcb('0x4'));var util=require(_0x4fcb('0x5'));var path=require(_0x4fcb('0x6'));var sox=require('sox');var csv=require(_0x4fcb('0x7'));var ejs=require(_0x4fcb('0x8'));var fs=require('fs');var fs_extra=require(_0x4fcb('0x9'));var _=require(_0x4fcb('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4fcb('0xb'));var deskjs=require(_0x4fcb('0xc'));var toCsv=require(_0x4fcb('0x7'));var querystring=require(_0x4fcb('0xd'));var Papa=require('papaparse');var Redis=require(_0x4fcb('0xe'));var authService=require(_0x4fcb('0xf'));var qs=require(_0x4fcb('0x10'));var as=require(_0x4fcb('0x11'));var hardwareService=require(_0x4fcb('0x12'));var logger=require(_0x4fcb('0x13'))(_0x4fcb('0x14'));var utils=require(_0x4fcb('0x15'));var config=require(_0x4fcb('0x16'));var licenseUtil=require(_0x4fcb('0x17'));var db=require(_0x4fcb('0x18'))['db'];function respondWithStatusCode(_0x37586a,_0x13dbb8){_0x13dbb8=_0x13dbb8||0xcc;return function(_0x3cdb4e){if(_0x3cdb4e){return _0x37586a[_0x4fcb('0x19')](_0x13dbb8);}return _0x37586a[_0x4fcb('0x1a')](_0x13dbb8)[_0x4fcb('0x1b')]();};}function respondWithResult(_0xe737f7,_0x1ed701){_0x1ed701=_0x1ed701||0xc8;return function(_0x5b87f6){if(_0x5b87f6){return _0xe737f7[_0x4fcb('0x1a')](_0x1ed701)[_0x4fcb('0x1c')](_0x5b87f6);}};}function respondWithFilteredResult(_0x8a4fd1,_0x1340de){return function(_0x23582b){if(_0x23582b){var _0x2446c3=typeof _0x1340de[_0x4fcb('0x1d')]===_0x4fcb('0x1e')&&typeof _0x1340de['limit']==='undefined';var _0x3d5509=_0x23582b[_0x4fcb('0x1f')];var _0x5d7595=_0x2446c3?0x0:_0x1340de[_0x4fcb('0x1d')];var _0x11d925=_0x2446c3?_0x23582b[_0x4fcb('0x1f')]:_0x1340de[_0x4fcb('0x1d')]+_0x1340de['limit'];var _0xf68b91;if(_0x11d925>=_0x3d5509){_0x11d925=_0x3d5509;_0xf68b91=0xc8;}else{_0xf68b91=0xce;}_0x8a4fd1['status'](_0xf68b91);return _0x8a4fd1['set'](_0x4fcb('0x20'),_0x5d7595+'-'+_0x11d925+'/'+_0x3d5509)['json'](_0x23582b);}return null;};}function patchUpdates(_0x3ce26b){return function(_0xd2d4f7){try{jsonpatch['apply'](_0xd2d4f7,_0x3ce26b,!![]);}catch(_0x4ea11){return BPromise[_0x4fcb('0x21')](_0x4ea11);}return _0xd2d4f7[_0x4fcb('0x22')]();};}function saveUpdates(_0x4e1e9d,_0x46dcfb){return function(_0x5c932d){if(_0x5c932d){return _0x5c932d['update'](_0x4e1e9d)[_0x4fcb('0x23')](function(_0x2a58ce){return _0x2a58ce;});}return null;};}function removeEntity(_0x511b84,_0x35ddba){return function(_0x121790){if(_0x121790){return _0x121790[_0x4fcb('0x24')]()[_0x4fcb('0x23')](function(){_0x511b84['status'](0xcc)[_0x4fcb('0x1b')]();});}};}function handleEntityNotFound(_0x5c878e,_0x26cb25){return function(_0x2604f6){if(!_0x2604f6){_0x5c878e[_0x4fcb('0x19')](0x194);}return _0x2604f6;};}function handleError(_0x2cb24a,_0x4301d4){_0x4301d4=_0x4301d4||0x1f4;return function(_0x396cc3){logger[_0x4fcb('0x25')](_0x396cc3[_0x4fcb('0x26')]);if(_0x396cc3[_0x4fcb('0x27')]){delete _0x396cc3[_0x4fcb('0x27')];}_0x2cb24a[_0x4fcb('0x1a')](_0x4301d4)[_0x4fcb('0x28')](_0x396cc3);};}exports[_0x4fcb('0x29')]=function(_0x466ce0,_0x43403b){var _0x2d94fc={},_0x4a06fc={},_0x54e4a5={'count':0x0,'rows':[]};var _0x397815=_[_0x4fcb('0x2a')](db[_0x4fcb('0x2b')][_0x4fcb('0x2c')],function(_0x29d1a0){return{'name':_0x29d1a0[_0x4fcb('0x2d')],'type':_0x29d1a0[_0x4fcb('0x2e')][_0x4fcb('0x2f')]};});_0x4a06fc[_0x4fcb('0x30')]=_[_0x4fcb('0x2a')](_0x397815,_0x4fcb('0x27'));_0x4a06fc[_0x4fcb('0x31')]=_[_0x4fcb('0x32')](_0x466ce0['query']);_0x4a06fc[_0x4fcb('0x33')]=_['intersection'](_0x4a06fc[_0x4fcb('0x30')],_0x4a06fc[_0x4fcb('0x31')]);_0x2d94fc[_0x4fcb('0x34')]=_[_0x4fcb('0x35')](_0x4a06fc[_0x4fcb('0x30')],qs[_0x4fcb('0x36')](_0x466ce0[_0x4fcb('0x31')][_0x4fcb('0x36')]));_0x2d94fc[_0x4fcb('0x34')]=_0x2d94fc[_0x4fcb('0x34')][_0x4fcb('0x37')]?_0x2d94fc[_0x4fcb('0x34')]:_0x4a06fc[_0x4fcb('0x30')];if(!_0x466ce0['query'][_0x4fcb('0x38')](_0x4fcb('0x39'))){_0x2d94fc[_0x4fcb('0x3a')]=qs[_0x4fcb('0x3a')](_0x466ce0['query'][_0x4fcb('0x3a')]);_0x2d94fc['offset']=qs[_0x4fcb('0x1d')](_0x466ce0[_0x4fcb('0x31')][_0x4fcb('0x1d')]);}_0x2d94fc[_0x4fcb('0x3b')]=qs['sort'](_0x466ce0['query'][_0x4fcb('0x3c')]);_0x2d94fc[_0x4fcb('0x3d')]=qs[_0x4fcb('0x33')](_['pick'](_0x466ce0['query'],_0x4a06fc[_0x4fcb('0x33')]),_0x397815);if(_0x466ce0['query'][_0x4fcb('0x3e')]){_0x2d94fc[_0x4fcb('0x3d')]=_[_0x4fcb('0x3f')](_0x2d94fc['where'],{'$or':_[_0x4fcb('0x2a')](_0x397815,function(_0x37fe37){if(_0x37fe37[_0x4fcb('0x2e')]!==_0x4fcb('0x40')){var _0x309a92={};_0x309a92[_0x37fe37[_0x4fcb('0x27')]]={'$like':'%'+_0x466ce0[_0x4fcb('0x31')][_0x4fcb('0x3e')]+'%'};return _0x309a92;}})});}_0x2d94fc=_[_0x4fcb('0x3f')]({},_0x2d94fc,_0x466ce0['options']);var _0x4234ef={'where':_0x2d94fc['where']};return db[_0x4fcb('0x2b')][_0x4fcb('0x1f')](_0x4234ef)[_0x4fcb('0x23')](function(_0x21e721){_0x54e4a5[_0x4fcb('0x1f')]=_0x21e721;if(_0x466ce0['query']['includeAll']){_0x2d94fc[_0x4fcb('0x41')]=[{'all':!![]}];}return db[_0x4fcb('0x2b')][_0x4fcb('0x42')](_0x2d94fc);})[_0x4fcb('0x23')](function(_0x15545b){_0x54e4a5[_0x4fcb('0x43')]=_0x15545b;return _0x54e4a5;})['then'](respondWithFilteredResult(_0x43403b,_0x2d94fc))[_0x4fcb('0x44')](handleError(_0x43403b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index cca9ffa..49e7479 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 _0xb753=['Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./migration.attributes'];(function(_0x4c4ca2,_0x30d812){var _0x17dac3=function(_0x4f07e6){while(--_0x4f07e6){_0x4c4ca2['push'](_0x4c4ca2['shift']());}};_0x17dac3(++_0x30d812);}(_0xb753,0xc8));var _0x3b75=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0xb753[_0x7a3247];return _0x1bfde5;};'use strict';var _=require(_0x3b75('0x0'));var util=require(_0x3b75('0x1'));var logger=require(_0x3b75('0x2'))(_0x3b75('0x3'));var moment=require(_0x3b75('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b75('0x5'));var fs=require('fs');var path=require(_0x3b75('0x6'));var rimraf=require(_0x3b75('0x7'));var config=require('../../config/environment');var attributes=require(_0x3b75('0x8'));module['exports']=function(_0x5bcdb4,_0x2d9894){return _0x5bcdb4['define'](_0x3b75('0x9'),attributes,{'tableName':_0x3b75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe183=['bluebird','../../config/environment','define','migrations','lodash','moment'];(function(_0x1a5d70,_0x44dae7){var _0x2ddce6=function(_0x11475d){while(--_0x11475d){_0x1a5d70['push'](_0x1a5d70['shift']());}};_0x2ddce6(++_0x44dae7);}(_0xe183,0x6a));var _0x3e18=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xe183[_0x10291b];return _0x1d5fbe;};'use strict';var _=require(_0x3e18('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3e18('0x1'));var BPromise=require(_0x3e18('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e18('0x3'));var attributes=require('./migration.attributes');module['exports']=function(_0x1b420b,_0x559bf9){return _0x1b420b[_0x3e18('0x4')]('Migration',attributes,{'tableName':_0x3e18('0x5'),'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 0c7e40e..c4e3bf5 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 _0x928c=['message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error'];(function(_0x1d13c8,_0x1554e6){var _0x3a3b03=function(_0x3d488d){while(--_0x3d488d){_0x1d13c8['push'](_0x1d13c8['shift']());}};_0x3a3b03(++_0x1554e6);}(_0x928c,0x17f));var _0xc928=function(_0x3ccf35,_0xb79a9f){_0x3ccf35=_0x3ccf35-0x0;var _0xdf004b=_0x928c[_0x3ccf35];return _0xdf004b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc928('0x0'));var BPromise=require(_0xc928('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc928('0x2'));var db=require(_0xc928('0x3'))['db'];var utils=require(_0xc928('0x4'));var logger=require(_0xc928('0x5'))(_0xc928('0x6'));var config=require('../../config/environment');var jayson=require(_0xc928('0x7'));var client=jayson[_0xc928('0x8')][_0xc928('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ff9e6,_0x4fd2a0,_0x5e433b){return new BPromise(function(_0x445248,_0x4270ab){return client[_0xc928('0xa')](_0x4ff9e6,_0x5e433b)[_0xc928('0xb')](function(_0x421f1b){logger[_0xc928('0xc')](_0xc928('0xd'),_0x4fd2a0,_0xc928('0xe'));logger['debug'](_0xc928('0xf'),_0x4fd2a0,_0xc928('0xe'),JSON['stringify'](_0x421f1b));if(_0x421f1b['error']){if(_0x421f1b[_0xc928('0x10')]['code']===0x1f4){logger[_0xc928('0x10')]('Migration,\x20%s,\x20%s',_0x4fd2a0,_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);return _0x4270ab(_0x421f1b['error'][_0xc928('0x11')]);}logger[_0xc928('0x10')]('Migration,\x20%s,\x20%s',_0x4fd2a0,_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);return _0x445248(_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);}else{logger[_0xc928('0xc')](_0xc928('0xd'),_0x4fd2a0,'request\x20sent');_0x445248(_0x421f1b[_0xc928('0x12')][_0xc928('0x11')]);}})[_0xc928('0x13')](function(_0x6cc463){logger[_0xc928('0x10')](_0xc928('0xd'),_0x4fd2a0,_0x6cc463);_0x4270ab(_0x6cc463);});});} \ No newline at end of file +var _0x9348=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x25dbd4,_0x359199){var _0x55ca7e=function(_0x4cafad){while(--_0x4cafad){_0x25dbd4['push'](_0x25dbd4['shift']());}};_0x55ca7e(++_0x359199);}(_0x9348,0x10d));var _0x8934=function(_0xa5c1c0,_0x3f85a7){_0xa5c1c0=_0xa5c1c0-0x0;var _0x5312a5=_0x9348[_0xa5c1c0];return _0x5312a5;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('Migration,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index b649600..afd92a9 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 _0x1a0e=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x4646a8,_0x41c24a){var _0x50a1aa=function(_0xf7c56){while(--_0xf7c56){_0x4646a8['push'](_0x4646a8['shift']());}};_0x50a1aa(++_0x41c24a);}(_0x1a0e,0x1c6));var _0xe1a0=function(_0x100338,_0x5cdbcc){_0x100338=_0x100338-0x0;var _0x330d32=_0x1a0e[_0x100338];return _0x330d32;};'use strict';var multer=require(_0xe1a0('0x0'));var util=require(_0xe1a0('0x1'));var path=require(_0xe1a0('0x2'));var timeout=require(_0xe1a0('0x3'));var express=require(_0xe1a0('0x4'));var router=express[_0xe1a0('0x5')]();var fs_extra=require(_0xe1a0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe1a0('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0xe1a0('0x8')](),controller[_0xe1a0('0x9')]);router[_0xe1a0('0xa')](_0xe1a0('0xb'),auth[_0xe1a0('0x8')](),controller[_0xe1a0('0xc')]);router[_0xe1a0('0xd')]('/',auth[_0xe1a0('0x8')](),controller[_0xe1a0('0xe')]);router[_0xe1a0('0xf')](_0xe1a0('0xb'),auth[_0xe1a0('0x8')](),controller[_0xe1a0('0x10')]);router['delete'](_0xe1a0('0xb'),auth['isAuthenticated'](),controller[_0xe1a0('0x11')]);module[_0xe1a0('0x12')]=router; \ No newline at end of file +var _0x598a=['util','path','connect-timeout','express','fs-extra','./network.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x598a,0xfb));var _0xa598=function(_0x4c36b4,_0x365f14){_0x4c36b4=_0x4c36b4-0x0;var _0x2fc3a7=_0x598a[_0x4c36b4];return _0x2fc3a7;};'use strict';var multer=require(_0xa598('0x0'));var util=require(_0xa598('0x1'));var path=require(_0xa598('0x2'));var timeout=require(_0xa598('0x3'));var express=require(_0xa598('0x4'));var router=express['Router']();var fs_extra=require(_0xa598('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa598('0x6'));router[_0xa598('0x7')]('/',auth[_0xa598('0x8')](),controller[_0xa598('0x9')]);router[_0xa598('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa598('0xa')]);router[_0xa598('0xb')]('/',auth[_0xa598('0x8')](),controller[_0xa598('0xc')]);router[_0xa598('0xd')](_0xa598('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xa598('0xf')](_0xa598('0xe'),auth[_0xa598('0x8')](),controller[_0xa598('0x10')]);module[_0xa598('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 05b8662..8b51f8a 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 _0x0e4e=['externip','stun','STRING','sequelize','exports','ENUM','localnet'];(function(_0x4e2059,_0x4f607f){var _0x55d599=function(_0x55c837){while(--_0x55c837){_0x4e2059['push'](_0x4e2059['shift']());}};_0x55d599(++_0x4f607f);}(_0x0e4e,0x15a));var _0xe0e4=function(_0x8ce506,_0x517f30){_0x8ce506=_0x8ce506-0x0;var _0x23c8e5=_0x0e4e[_0x8ce506];return _0x23c8e5;};'use strict';var Sequelize=require(_0xe0e4('0x0'));module[_0xe0e4('0x1')]={'type':{'type':Sequelize[_0xe0e4('0x2')](_0xe0e4('0x3'),_0xe0e4('0x4'),_0xe0e4('0x5'),'turn')},'value':{'type':Sequelize[_0xe0e4('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe0e4('0x6')]}}; \ No newline at end of file +var _0xdafd=['exports','ENUM','localnet','externip','stun','STRING','sequelize'];(function(_0x1983d1,_0x557ff1){var _0x332365=function(_0x5726c6){while(--_0x5726c6){_0x1983d1['push'](_0x1983d1['shift']());}};_0x332365(++_0x557ff1);}(_0xdafd,0xe6));var _0xddaf=function(_0x153eec,_0x3f62d4){_0x153eec=_0x153eec-0x0;var _0x38319f=_0xdafd[_0x153eec];return _0x38319f;};'use strict';var Sequelize=require(_0xddaf('0x0'));module[_0xddaf('0x1')]={'type':{'type':Sequelize[_0xddaf('0x2')](_0xddaf('0x3'),_0xddaf('0x4'),_0xddaf('0x5'),'turn')},'value':{'type':Sequelize[_0xddaf('0x6')]},'username':{'type':Sequelize[_0xddaf('0x6')]},'password':{'type':Sequelize[_0xddaf('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index cc4c3e3..33a7a1f 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 _0x63b6=['info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','Network','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','sequelize','transaction','body','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','toUpperCase','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','STUN','TURN','toLowerCase','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then'];(function(_0x5c4178,_0x11471c){var _0x384e71=function(_0x4ff0db){while(--_0x4ff0db){_0x5c4178['push'](_0x5c4178['shift']());}};_0x384e71(++_0x11471c);}(_0x63b6,0x127));var _0x663b=function(_0x2e71d6,_0x31d271){_0x2e71d6=_0x2e71d6-0x0;var _0x2b3132=_0x63b6[_0x2e71d6];return _0x2b3132;};'use strict';var emlformat=require(_0x663b('0x0'));var rimraf=require(_0x663b('0x1'));var zipdir=require(_0x663b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x663b('0x3'));var moment=require('moment');var BPromise=require(_0x663b('0x4'));var Mustache=require('mustache');var util=require(_0x663b('0x5'));var path=require(_0x663b('0x6'));var sox=require(_0x663b('0x7'));var csv=require('to-csv');var ejs=require(_0x663b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x663b('0x9'));var squel=require('squel');var crypto=require(_0x663b('0xa'));var jsforce=require(_0x663b('0xb'));var deskjs=require(_0x663b('0xc'));var toCsv=require(_0x663b('0xd'));var querystring=require(_0x663b('0xe'));var Papa=require(_0x663b('0xf'));var Redis=require('ioredis');var authService=require(_0x663b('0x10'));var qs=require(_0x663b('0x11'));var as=require(_0x663b('0x12'));var hardwareService=require(_0x663b('0x13'));var logger=require(_0x663b('0x14'))(_0x663b('0x15'));var utils=require(_0x663b('0x16'));var config=require(_0x663b('0x17'));var licenseUtil=require(_0x663b('0x18'));var db=require(_0x663b('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x663b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xa5b910,_0x3baf10,_0x9d2c68,_0x43449a){return new BPromise(function(_0x13cb09,_0x4e263a){var _0x18a6da=_0x43449a||client;return _0x18a6da[_0x663b('0x1b')](_0xa5b910,_0x9d2c68)[_0x663b('0x1c')](function(_0x1f8238){logger[_0x663b('0x1d')](_0x663b('0x1e'),_0x3baf10,_0x663b('0x1f'));logger[_0x663b('0x20')](_0x663b('0x21'),_0x3baf10,_0x663b('0x1f'),JSON[_0x663b('0x22')](_0x1f8238));if(_0x1f8238[_0x663b('0x23')]){if(_0x1f8238[_0x663b('0x23')][_0x663b('0x24')]===0x1f4){logger['error'](_0x663b('0x1e'),_0x3baf10,_0x1f8238[_0x663b('0x23')]['message']);return _0x4e263a(_0x1f8238[_0x663b('0x23')][_0x663b('0x25')]);}logger['error']('Network,\x20%s,\x20%s',_0x3baf10,_0x1f8238[_0x663b('0x23')][_0x663b('0x25')]);return _0x13cb09(_0x1f8238[_0x663b('0x23')][_0x663b('0x25')]);}else{logger['info'](_0x663b('0x1e'),_0x3baf10,_0x663b('0x1f'));_0x13cb09(_0x1f8238['result']['message']);}})['catch'](function(_0x5e1ff0){logger[_0x663b('0x23')](_0x663b('0x1e'),_0x3baf10,_0x5e1ff0);_0x4e263a(_0x5e1ff0);});});}function respondWithStatusCode(_0x2d1b52,_0xf08506){_0xf08506=_0xf08506||0xcc;return function(_0x25c295){if(_0x25c295){return _0x2d1b52[_0x663b('0x26')](_0xf08506);}return _0x2d1b52[_0x663b('0x27')](_0xf08506)[_0x663b('0x28')]();};}function respondWithResult(_0x3eab48,_0x5063b2){_0x5063b2=_0x5063b2||0xc8;return function(_0x20edcc){if(_0x20edcc){return _0x3eab48[_0x663b('0x27')](_0x5063b2)['json'](_0x20edcc);}};}function respondWithFilteredResult(_0x37a5f4,_0x54bb0d){return function(_0x1e4e97){if(_0x1e4e97){var _0x28863b=typeof _0x54bb0d[_0x663b('0x29')]==='undefined'&&typeof _0x54bb0d[_0x663b('0x2a')]===_0x663b('0x2b');var _0x3a3ebc=_0x1e4e97[_0x663b('0x2c')];var _0x5a1580=_0x28863b?0x0:_0x54bb0d['offset'];var _0x4e7486=_0x28863b?_0x1e4e97[_0x663b('0x2c')]:_0x54bb0d[_0x663b('0x29')]+_0x54bb0d['limit'];var _0x3b7286;if(_0x4e7486>=_0x3a3ebc){_0x4e7486=_0x3a3ebc;_0x3b7286=0xc8;}else{_0x3b7286=0xce;}_0x37a5f4['status'](_0x3b7286);return _0x37a5f4['set'](_0x663b('0x2d'),_0x5a1580+'-'+_0x4e7486+'/'+_0x3a3ebc)[_0x663b('0x2e')](_0x1e4e97);}return null;};}function patchUpdates(_0x31ca2e){return function(_0x588fd1){try{jsonpatch['apply'](_0x588fd1,_0x31ca2e,!![]);}catch(_0x1aa8a9){return BPromise[_0x663b('0x2f')](_0x1aa8a9);}return _0x588fd1[_0x663b('0x30')]();};}function saveUpdates(_0x38aeb3,_0x429f56){return function(_0x4398ab){if(_0x4398ab){return _0x4398ab[_0x663b('0x31')](_0x38aeb3)[_0x663b('0x1c')](function(_0x168298){return _0x168298;});}return null;};}function removeEntity(_0x28f000,_0x6e7795){return function(_0x322ed5){if(_0x322ed5){return _0x322ed5[_0x663b('0x32')]()[_0x663b('0x1c')](function(){_0x28f000['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa1dedc,_0x2740d2){return function(_0x34fbc5){if(!_0x34fbc5){_0xa1dedc['sendStatus'](0x194);}return _0x34fbc5;};}function handleError(_0x494e36,_0x507b20){_0x507b20=_0x507b20||0x1f4;return function(_0x5eb2a8){logger['error'](_0x5eb2a8[_0x663b('0x33')]);if(_0x5eb2a8[_0x663b('0x34')]){delete _0x5eb2a8[_0x663b('0x34')];}_0x494e36[_0x663b('0x27')](_0x507b20)[_0x663b('0x35')](_0x5eb2a8);};}exports[_0x663b('0x36')]=function(_0x48e9a2,_0x744be){var _0x4635db={},_0x4f8a95={},_0x4a411f={'count':0x0,'rows':[]};var _0x15139a=_[_0x663b('0x37')](db[_0x663b('0x38')]['rawAttributes'],function(_0x587ad7){return{'name':_0x587ad7[_0x663b('0x39')],'type':_0x587ad7[_0x663b('0x3a')]['key']};});_0x4f8a95[_0x663b('0x3b')]=_[_0x663b('0x37')](_0x15139a,_0x663b('0x34'));_0x4f8a95['query']=_[_0x663b('0x3c')](_0x48e9a2[_0x663b('0x3d')]);_0x4f8a95['filters']=_[_0x663b('0x3e')](_0x4f8a95[_0x663b('0x3b')],_0x4f8a95[_0x663b('0x3d')]);_0x4635db['attributes']=_[_0x663b('0x3e')](_0x4f8a95[_0x663b('0x3b')],qs[_0x663b('0x3f')](_0x48e9a2['query'][_0x663b('0x3f')]));_0x4635db[_0x663b('0x40')]=_0x4635db['attributes'][_0x663b('0x41')]?_0x4635db['attributes']:_0x4f8a95[_0x663b('0x3b')];if(!_0x48e9a2[_0x663b('0x3d')][_0x663b('0x42')](_0x663b('0x43'))){_0x4635db['limit']=qs[_0x663b('0x2a')](_0x48e9a2[_0x663b('0x3d')]['limit']);_0x4635db[_0x663b('0x29')]=qs[_0x663b('0x29')](_0x48e9a2[_0x663b('0x3d')][_0x663b('0x29')]);}_0x4635db[_0x663b('0x44')]=qs['sort'](_0x48e9a2[_0x663b('0x3d')][_0x663b('0x45')]);_0x4635db[_0x663b('0x46')]=qs[_0x663b('0x47')](_[_0x663b('0x48')](_0x48e9a2[_0x663b('0x3d')],_0x4f8a95['filters']),_0x15139a);if(_0x48e9a2[_0x663b('0x3d')][_0x663b('0x49')]){_0x4635db[_0x663b('0x46')]=_[_0x663b('0x4a')](_0x4635db[_0x663b('0x46')],{'$or':_[_0x663b('0x37')](_0x15139a,function(_0x33bc36){if(_0x33bc36[_0x663b('0x3a')]!==_0x663b('0x4b')){var _0x2ef284={};_0x2ef284[_0x33bc36[_0x663b('0x34')]]={'$like':'%'+_0x48e9a2['query'][_0x663b('0x49')]+'%'};return _0x2ef284;}})});}_0x4635db=_[_0x663b('0x4a')]({},_0x4635db,_0x48e9a2[_0x663b('0x4c')]);var _0x432d51={'where':_0x4635db[_0x663b('0x46')]};return db[_0x663b('0x38')][_0x663b('0x2c')](_0x432d51)[_0x663b('0x1c')](function(_0x17c438){_0x4a411f[_0x663b('0x2c')]=_0x17c438;if(_0x48e9a2['query'][_0x663b('0x4d')]){_0x4635db[_0x663b('0x4e')]=[{'all':!![]}];}return db['Network'][_0x663b('0x4f')](_0x4635db);})[_0x663b('0x1c')](function(_0x10ae27){_0x4a411f['rows']=_0x10ae27;return _0x4a411f;})['then'](respondWithFilteredResult(_0x744be,_0x4635db))['catch'](handleError(_0x744be,null));};exports[_0x663b('0x50')]=function(_0x5121aa,_0x1cc077){var _0x31e831={'raw':!![],'where':{'id':_0x5121aa[_0x663b('0x51')]['id']}},_0x4a05ef={};_0x4a05ef[_0x663b('0x3b')]=_[_0x663b('0x3c')](db[_0x663b('0x38')][_0x663b('0x52')]);_0x4a05ef['query']=_[_0x663b('0x3c')](_0x5121aa[_0x663b('0x3d')]);_0x4a05ef['filters']=_['intersection'](_0x4a05ef[_0x663b('0x3b')],_0x4a05ef[_0x663b('0x3d')]);_0x31e831[_0x663b('0x40')]=_[_0x663b('0x3e')](_0x4a05ef[_0x663b('0x3b')],qs[_0x663b('0x3f')](_0x5121aa['query'][_0x663b('0x3f')]));_0x31e831[_0x663b('0x40')]=_0x31e831[_0x663b('0x40')][_0x663b('0x41')]?_0x31e831[_0x663b('0x40')]:_0x4a05ef[_0x663b('0x3b')];if(_0x5121aa[_0x663b('0x3d')][_0x663b('0x4d')]){_0x31e831[_0x663b('0x4e')]=[{'all':!![]}];}_0x31e831=_[_0x663b('0x4a')]({},_0x31e831,_0x5121aa['options']);return db[_0x663b('0x38')][_0x663b('0x53')](_0x31e831)[_0x663b('0x1c')](handleEntityNotFound(_0x1cc077,null))['then'](respondWithResult(_0x1cc077,null))[_0x663b('0x54')](handleError(_0x1cc077,null));};exports[_0x663b('0x55')]=function(_0x31e618,_0x134c5a,_0x5cc317){var _0x14e079;return db[_0x663b('0x56')][_0x663b('0x57')](function(_0x5caa0d){return db[_0x663b('0x38')]['create'](_0x31e618['body'],{'raw':!![]})[_0x663b('0x1c')](function(_0x516b83){_0x14e079=_0x516b83;return db[_0x663b('0x38')][_0x663b('0x4f')]({'where':{'type':_0x31e618[_0x663b('0x58')]['type']},'raw':!![]});})['then'](function(_0x3e9214){if(_0x14e079[_0x663b('0x3a')]['toUpperCase']()=='STUN'){var _0x2c178d=fs[_0x663b('0x59')](path[_0x663b('0x5a')](config[_0x663b('0x5b')],_0x663b('0x5c')),_0x663b('0x5d'));var _0x4d8427=ejs[_0x663b('0x5e')](_0x2c178d,{'networks':_0x3e9214||[]});fs[_0x663b('0x5f')](_0x663b('0x60'),_0x4d8427);return respondWithRpcPromise('Reload',_0x663b('0x55'),{'module':_0x663b('0x61')});}else if(_0x14e079[_0x663b('0x3a')][_0x663b('0x62')]()=='TURN'){var _0xdefdac=fs['readFileSync'](path[_0x663b('0x5a')](config[_0x663b('0x5b')],'server/files/templates/turn_multiple.ejs'),_0x663b('0x5d'));var _0x35f671=ejs[_0x663b('0x5e')](_0xdefdac,{'networks':_0x3e9214||[]});fs[_0x663b('0x5f')](_0x663b('0x63'),_0x35f671);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x55'),{'module':_0x663b('0x61')});}else{var _0x34176a=fs['readFileSync'](path[_0x663b('0x5a')](config['root'],_0x663b('0x65')),_0x663b('0x5d'));var _0x2756ce=ejs[_0x663b('0x5e')](_0x34176a,{'networks':_0x3e9214||[]});fs['writeFileSync'](util[_0x663b('0x66')](_0x663b('0x67'),_0x31e618[_0x663b('0x58')][_0x663b('0x3a')]['toLowerCase']()),_0x2756ce);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x55'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x14e079;});})[_0x663b('0x1c')](respondWithResult(_0x134c5a,0xc9))[_0x663b('0x54')](handleError(_0x134c5a,null));};exports[_0x663b('0x31')]=function(_0x5bdc05,_0x4a43bf,_0x31f237){var _0x3d4377;return db[_0x663b('0x56')][_0x663b('0x57')](function(_0x2828f9){return db['Network']['find']({'where':{'id':_0x5bdc05[_0x663b('0x51')]['id']}})[_0x663b('0x1c')](handleEntityNotFound(_0x4a43bf,null))[_0x663b('0x1c')](saveUpdates(_0x5bdc05[_0x663b('0x58')],null))[_0x663b('0x1c')](function(_0x50d586){if(_0x50d586){_0x3d4377=_0x50d586;return db[_0x663b('0x38')][_0x663b('0x4f')]({'where':{'type':_0x3d4377['type']},'raw':!![]});}return null;})[_0x663b('0x1c')](function(_0x52969e){if(_0x3d4377[_0x663b('0x3a')][_0x663b('0x62')]()==_0x663b('0x68')){var _0x4fd888=fs['readFileSync'](path[_0x663b('0x5a')](config['root'],_0x663b('0x5c')),_0x663b('0x5d'));var _0x3acbbb=ejs['render'](_0x4fd888,{'networks':_0x52969e||[]});fs[_0x663b('0x5f')](_0x663b('0x60'),_0x3acbbb);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x31'),{'module':'res_stun_monitor.so'});}else if(_0x3d4377[_0x663b('0x3a')][_0x663b('0x62')]()==_0x663b('0x69')){var _0x30fdca=fs[_0x663b('0x59')](path[_0x663b('0x5a')](config[_0x663b('0x5b')],'server/files/templates/turn_multiple.ejs'),_0x663b('0x5d'));var _0x190dc4=ejs['render'](_0x30fdca,{'networks':_0x52969e||[]});fs[_0x663b('0x5f')](_0x663b('0x63'),_0x190dc4);return respondWithRpcPromise('Reload',_0x663b('0x31'),{'module':_0x663b('0x61')});}else{var _0x2bce62=fs[_0x663b('0x59')](path['join'](config[_0x663b('0x5b')],_0x663b('0x65')),_0x663b('0x5d'));var _0x2f48e9=ejs[_0x663b('0x5e')](_0x2bce62,{'networks':_0x52969e||[]});fs['writeFileSync'](util[_0x663b('0x66')](_0x663b('0x67'),_0x5bdc05[_0x663b('0x58')][_0x663b('0x3a')][_0x663b('0x6a')]()),_0x2f48e9);return respondWithRpcPromise(_0x663b('0x64'),'update',{'module':_0x663b('0x6b')});}return null;})[_0x663b('0x1c')](function(_0x3890c7){if(_0x3890c7){return _0x3d4377;}return null;});})[_0x663b('0x1c')](respondWithResult(_0x4a43bf,null))[_0x663b('0x54')](handleError(_0x4a43bf,null));};exports['destroy']=function(_0xa392d2,_0x56f146,_0xbc0f93){var _0x5b0aed;return db[_0x663b('0x38')][_0x663b('0x53')]({'where':{'id':_0xa392d2[_0x663b('0x51')]['id']}})[_0x663b('0x1c')](function(_0x1d0b3c){_0x5b0aed=_0x1d0b3c;return _0x1d0b3c;})['then'](handleEntityNotFound(_0x56f146,null))['then'](removeEntity(_0x56f146,null))[_0x663b('0x1c')](function(){if(_0x5b0aed){return db['Network'][_0x663b('0x4f')]({'where':{'type':_0x5b0aed['type']},'raw':!![]});}})[_0x663b('0x1c')](function(_0x515cf0){if(_0x5b0aed[_0x663b('0x3a')][_0x663b('0x62')]()=='STUN'){var _0x246a24=fs[_0x663b('0x59')](path['join'](config[_0x663b('0x5b')],_0x663b('0x5c')),'utf8');var _0x15ee0e=ejs[_0x663b('0x5e')](_0x246a24,{'networks':_0x515cf0||[]});fs[_0x663b('0x5f')](_0x663b('0x60'),_0x15ee0e);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x32'),{'module':_0x663b('0x61')});}else if(_0x5b0aed[_0x663b('0x3a')]['toUpperCase']()==_0x663b('0x69')){var _0x18d1f6=fs[_0x663b('0x59')](path[_0x663b('0x5a')](config[_0x663b('0x5b')],'server/files/templates/turn_multiple.ejs'),_0x663b('0x5d'));var _0x39b0ec=ejs[_0x663b('0x5e')](_0x18d1f6,{'networks':_0x515cf0||[]});fs[_0x663b('0x5f')](_0x663b('0x63'),_0x39b0ec);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x32'),{'module':'res_stun_monitor.so'});}else{var _0x12aae5=fs['readFileSync'](path[_0x663b('0x5a')](config[_0x663b('0x5b')],_0x663b('0x65')),_0x663b('0x5d'));var _0x523cdf=ejs[_0x663b('0x5e')](_0x12aae5,{'networks':_0x515cf0||[]});fs[_0x663b('0x5f')](util[_0x663b('0x66')](_0x663b('0x67'),_0xa392d2[_0x663b('0x58')][_0x663b('0x3a')]['toLowerCase']()),_0x523cdf);return respondWithRpcPromise(_0x663b('0x64'),'destroy',{'module':_0x663b('0x6b')});}return null;})[_0x663b('0x54')](handleError(_0x56f146,null));}; \ No newline at end of file +var _0x6fad=['update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','Network','findAll','rows','show','params','include','create','transaction','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','res_stun_monitor.so','writeFileSync','readFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','/etc/asterisk/stun_xcally.conf','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','code','message','error','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6fad,0x174));var _0xd6fa=function(_0xb37311,_0x180fef){_0xb37311=_0xb37311-0x0;var _0x496834=_0x6fad[_0xb37311];return _0x496834;};'use strict';var emlformat=require(_0xd6fa('0x0'));var rimraf=require(_0xd6fa('0x1'));var zipdir=require(_0xd6fa('0x2'));var jsonpatch=require(_0xd6fa('0x3'));var rp=require('request-promise');var moment=require(_0xd6fa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6fa('0x5'));var util=require(_0xd6fa('0x6'));var path=require(_0xd6fa('0x7'));var sox=require(_0xd6fa('0x8'));var csv=require('to-csv');var ejs=require(_0xd6fa('0x9'));var fs=require('fs');var fs_extra=require(_0xd6fa('0xa'));var _=require(_0xd6fa('0xb'));var squel=require(_0xd6fa('0xc'));var crypto=require('crypto');var jsforce=require(_0xd6fa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd6fa('0xe'));var querystring=require(_0xd6fa('0xf'));var Papa=require(_0xd6fa('0x10'));var Redis=require(_0xd6fa('0x11'));var authService=require(_0xd6fa('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6fa('0x13'));var logger=require(_0xd6fa('0x14'))(_0xd6fa('0x15'));var utils=require(_0xd6fa('0x16'));var config=require(_0xd6fa('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xd6fa('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33ee61,_0x11e5b5,_0x1bcecd,_0x40df7f){return new BPromise(function(_0x3cd6fa,_0x919d49){var _0x15616f=_0x40df7f||client;return _0x15616f[_0xd6fa('0x19')](_0x33ee61,_0x1bcecd)[_0xd6fa('0x1a')](function(_0x5b853a){logger[_0xd6fa('0x1b')](_0xd6fa('0x1c'),_0x11e5b5,_0xd6fa('0x1d'));logger[_0xd6fa('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x11e5b5,'request\x20sent',JSON['stringify'](_0x5b853a));if(_0x5b853a['error']){if(_0x5b853a['error'][_0xd6fa('0x1f')]===0x1f4){logger['error'](_0xd6fa('0x1c'),_0x11e5b5,_0x5b853a['error'][_0xd6fa('0x20')]);return _0x919d49(_0x5b853a[_0xd6fa('0x21')][_0xd6fa('0x20')]);}logger[_0xd6fa('0x21')](_0xd6fa('0x1c'),_0x11e5b5,_0x5b853a[_0xd6fa('0x21')][_0xd6fa('0x20')]);return _0x3cd6fa(_0x5b853a[_0xd6fa('0x21')][_0xd6fa('0x20')]);}else{logger[_0xd6fa('0x1b')](_0xd6fa('0x1c'),_0x11e5b5,_0xd6fa('0x1d'));_0x3cd6fa(_0x5b853a[_0xd6fa('0x22')][_0xd6fa('0x20')]);}})[_0xd6fa('0x23')](function(_0xd1637f){logger[_0xd6fa('0x21')](_0xd6fa('0x1c'),_0x11e5b5,_0xd1637f);_0x919d49(_0xd1637f);});});}function respondWithStatusCode(_0x3fbab3,_0x5f2088){_0x5f2088=_0x5f2088||0xcc;return function(_0x5dd144){if(_0x5dd144){return _0x3fbab3[_0xd6fa('0x24')](_0x5f2088);}return _0x3fbab3[_0xd6fa('0x25')](_0x5f2088)[_0xd6fa('0x26')]();};}function respondWithResult(_0x1eaf9a,_0x1c5af3){_0x1c5af3=_0x1c5af3||0xc8;return function(_0xa3264f){if(_0xa3264f){return _0x1eaf9a['status'](_0x1c5af3)[_0xd6fa('0x27')](_0xa3264f);}};}function respondWithFilteredResult(_0x1af27c,_0x4c7444){return function(_0x1ac83f){if(_0x1ac83f){var _0xdac7e1=typeof _0x4c7444[_0xd6fa('0x28')]==='undefined'&&typeof _0x4c7444[_0xd6fa('0x29')]===_0xd6fa('0x2a');var _0x22e6db=_0x1ac83f[_0xd6fa('0x2b')];var _0x3c7a9e=_0xdac7e1?0x0:_0x4c7444[_0xd6fa('0x28')];var _0x42f145=_0xdac7e1?_0x1ac83f['count']:_0x4c7444[_0xd6fa('0x28')]+_0x4c7444['limit'];var _0x2eaaef;if(_0x42f145>=_0x22e6db){_0x42f145=_0x22e6db;_0x2eaaef=0xc8;}else{_0x2eaaef=0xce;}_0x1af27c[_0xd6fa('0x25')](_0x2eaaef);return _0x1af27c['set'](_0xd6fa('0x2c'),_0x3c7a9e+'-'+_0x42f145+'/'+_0x22e6db)[_0xd6fa('0x27')](_0x1ac83f);}return null;};}function patchUpdates(_0x2cb3ca){return function(_0x3a2c56){try{jsonpatch[_0xd6fa('0x2d')](_0x3a2c56,_0x2cb3ca,!![]);}catch(_0x3b0bab){return BPromise[_0xd6fa('0x2e')](_0x3b0bab);}return _0x3a2c56[_0xd6fa('0x2f')]();};}function saveUpdates(_0x3d7886,_0x578ee2){return function(_0x168269){if(_0x168269){return _0x168269[_0xd6fa('0x30')](_0x3d7886)['then'](function(_0x27b9ed){return _0x27b9ed;});}return null;};}function removeEntity(_0x1454ae,_0x2dd14e){return function(_0x13f5e3){if(_0x13f5e3){return _0x13f5e3[_0xd6fa('0x31')]()[_0xd6fa('0x1a')](function(){_0x1454ae[_0xd6fa('0x25')](0xcc)[_0xd6fa('0x26')]();});}};}function handleEntityNotFound(_0x2d6058,_0x2899c2){return function(_0xd6c949){if(!_0xd6c949){_0x2d6058['sendStatus'](0x194);}return _0xd6c949;};}function handleError(_0x2d934d,_0x4979f6){_0x4979f6=_0x4979f6||0x1f4;return function(_0x38ac00){logger['error'](_0x38ac00[_0xd6fa('0x32')]);if(_0x38ac00[_0xd6fa('0x33')]){delete _0x38ac00['name'];}_0x2d934d[_0xd6fa('0x25')](_0x4979f6)['send'](_0x38ac00);};}exports[_0xd6fa('0x34')]=function(_0x1e7f70,_0x338424){var _0x55ee38={},_0x55962b={},_0x43ecc6={'count':0x0,'rows':[]};var _0x1bab9d=_[_0xd6fa('0x35')](db['Network'][_0xd6fa('0x36')],function(_0x3feb5e){return{'name':_0x3feb5e[_0xd6fa('0x37')],'type':_0x3feb5e[_0xd6fa('0x38')][_0xd6fa('0x39')]};});_0x55962b[_0xd6fa('0x3a')]=_[_0xd6fa('0x35')](_0x1bab9d,'name');_0x55962b[_0xd6fa('0x3b')]=_[_0xd6fa('0x3c')](_0x1e7f70[_0xd6fa('0x3b')]);_0x55962b[_0xd6fa('0x3d')]=_[_0xd6fa('0x3e')](_0x55962b[_0xd6fa('0x3a')],_0x55962b[_0xd6fa('0x3b')]);_0x55ee38[_0xd6fa('0x3f')]=_['intersection'](_0x55962b[_0xd6fa('0x3a')],qs[_0xd6fa('0x40')](_0x1e7f70[_0xd6fa('0x3b')][_0xd6fa('0x40')]));_0x55ee38[_0xd6fa('0x3f')]=_0x55ee38[_0xd6fa('0x3f')][_0xd6fa('0x41')]?_0x55ee38[_0xd6fa('0x3f')]:_0x55962b[_0xd6fa('0x3a')];if(!_0x1e7f70['query'][_0xd6fa('0x42')](_0xd6fa('0x43'))){_0x55ee38[_0xd6fa('0x29')]=qs[_0xd6fa('0x29')](_0x1e7f70['query'][_0xd6fa('0x29')]);_0x55ee38[_0xd6fa('0x28')]=qs[_0xd6fa('0x28')](_0x1e7f70[_0xd6fa('0x3b')][_0xd6fa('0x28')]);}_0x55ee38[_0xd6fa('0x44')]=qs[_0xd6fa('0x45')](_0x1e7f70[_0xd6fa('0x3b')][_0xd6fa('0x45')]);_0x55ee38[_0xd6fa('0x46')]=qs[_0xd6fa('0x3d')](_[_0xd6fa('0x47')](_0x1e7f70[_0xd6fa('0x3b')],_0x55962b[_0xd6fa('0x3d')]),_0x1bab9d);if(_0x1e7f70[_0xd6fa('0x3b')]['filter']){_0x55ee38[_0xd6fa('0x46')]=_[_0xd6fa('0x48')](_0x55ee38['where'],{'$or':_[_0xd6fa('0x35')](_0x1bab9d,function(_0x3d1c45){if(_0x3d1c45[_0xd6fa('0x38')]!==_0xd6fa('0x49')){var _0xb92ea2={};_0xb92ea2[_0x3d1c45['name']]={'$like':'%'+_0x1e7f70[_0xd6fa('0x3b')][_0xd6fa('0x4a')]+'%'};return _0xb92ea2;}})});}_0x55ee38=_[_0xd6fa('0x48')]({},_0x55ee38,_0x1e7f70['options']);var _0x141897={'where':_0x55ee38[_0xd6fa('0x46')]};return db[_0xd6fa('0x4b')]['count'](_0x141897)['then'](function(_0x230bfb){_0x43ecc6[_0xd6fa('0x2b')]=_0x230bfb;if(_0x1e7f70[_0xd6fa('0x3b')]['includeAll']){_0x55ee38['include']=[{'all':!![]}];}return db[_0xd6fa('0x4b')][_0xd6fa('0x4c')](_0x55ee38);})[_0xd6fa('0x1a')](function(_0x8cd0dc){_0x43ecc6[_0xd6fa('0x4d')]=_0x8cd0dc;return _0x43ecc6;})[_0xd6fa('0x1a')](respondWithFilteredResult(_0x338424,_0x55ee38))[_0xd6fa('0x23')](handleError(_0x338424,null));};exports[_0xd6fa('0x4e')]=function(_0x1ee21e,_0x3a4abd){var _0x23e950={'raw':!![],'where':{'id':_0x1ee21e[_0xd6fa('0x4f')]['id']}},_0x35ea22={};_0x35ea22[_0xd6fa('0x3a')]=_[_0xd6fa('0x3c')](db[_0xd6fa('0x4b')]['rawAttributes']);_0x35ea22[_0xd6fa('0x3b')]=_['keys'](_0x1ee21e[_0xd6fa('0x3b')]);_0x35ea22[_0xd6fa('0x3d')]=_['intersection'](_0x35ea22['model'],_0x35ea22[_0xd6fa('0x3b')]);_0x23e950[_0xd6fa('0x3f')]=_['intersection'](_0x35ea22[_0xd6fa('0x3a')],qs[_0xd6fa('0x40')](_0x1ee21e[_0xd6fa('0x3b')][_0xd6fa('0x40')]));_0x23e950[_0xd6fa('0x3f')]=_0x23e950[_0xd6fa('0x3f')][_0xd6fa('0x41')]?_0x23e950['attributes']:_0x35ea22[_0xd6fa('0x3a')];if(_0x1ee21e[_0xd6fa('0x3b')]['includeAll']){_0x23e950[_0xd6fa('0x50')]=[{'all':!![]}];}_0x23e950=_[_0xd6fa('0x48')]({},_0x23e950,_0x1ee21e['options']);return db[_0xd6fa('0x4b')]['find'](_0x23e950)['then'](handleEntityNotFound(_0x3a4abd,null))[_0xd6fa('0x1a')](respondWithResult(_0x3a4abd,null))[_0xd6fa('0x23')](handleError(_0x3a4abd,null));};exports[_0xd6fa('0x51')]=function(_0x4f8054,_0x1ed26c,_0x2e9883){var _0x5d2617;return db['sequelize'][_0xd6fa('0x52')](function(_0x5b23ad){return db[_0xd6fa('0x4b')][_0xd6fa('0x51')](_0x4f8054[_0xd6fa('0x53')],{'raw':!![]})['then'](function(_0x54a775){_0x5d2617=_0x54a775;return db['Network'][_0xd6fa('0x4c')]({'where':{'type':_0x4f8054[_0xd6fa('0x53')][_0xd6fa('0x38')]},'raw':!![]});})['then'](function(_0x57a7d5){if(_0x5d2617[_0xd6fa('0x38')][_0xd6fa('0x54')]()==_0xd6fa('0x55')){var _0x4ceb27=fs['readFileSync'](path[_0xd6fa('0x56')](config[_0xd6fa('0x57')],_0xd6fa('0x58')),_0xd6fa('0x59'));var _0x1c7e00=ejs[_0xd6fa('0x5a')](_0x4ceb27,{'networks':_0x57a7d5||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1c7e00);return respondWithRpcPromise(_0xd6fa('0x5b'),_0xd6fa('0x51'),{'module':_0xd6fa('0x5c')});}else if(_0x5d2617['type'][_0xd6fa('0x54')]()=='TURN'){var _0x348b62=fs['readFileSync'](path[_0xd6fa('0x56')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xd6fa('0x59'));var _0x335e47=ejs[_0xd6fa('0x5a')](_0x348b62,{'networks':_0x57a7d5||[]});fs[_0xd6fa('0x5d')]('/etc/asterisk/turn_xcally.conf',_0x335e47);return respondWithRpcPromise('Reload',_0xd6fa('0x51'),{'module':'res_stun_monitor.so'});}else{var _0x45694d=fs[_0xd6fa('0x5e')](path[_0xd6fa('0x56')](config[_0xd6fa('0x57')],_0xd6fa('0x5f')),_0xd6fa('0x59'));var _0x219bce=ejs[_0xd6fa('0x5a')](_0x45694d,{'networks':_0x57a7d5||[]});fs[_0xd6fa('0x5d')](util['format'](_0xd6fa('0x60'),_0x4f8054[_0xd6fa('0x53')][_0xd6fa('0x38')][_0xd6fa('0x61')]()),_0x219bce);return respondWithRpcPromise(_0xd6fa('0x5b'),_0xd6fa('0x51'),{'module':_0xd6fa('0x62')});}return null;})['then'](function(){return _0x5d2617;});})[_0xd6fa('0x1a')](respondWithResult(_0x1ed26c,0xc9))[_0xd6fa('0x23')](handleError(_0x1ed26c,null));};exports[_0xd6fa('0x30')]=function(_0x5bea05,_0x5976df,_0x4e6faf){var _0x26ebfd;return db['sequelize']['transaction'](function(_0x35d4ac){return db[_0xd6fa('0x4b')][_0xd6fa('0x63')]({'where':{'id':_0x5bea05['params']['id']}})['then'](handleEntityNotFound(_0x5976df,null))[_0xd6fa('0x1a')](saveUpdates(_0x5bea05['body'],null))[_0xd6fa('0x1a')](function(_0x369eaf){if(_0x369eaf){_0x26ebfd=_0x369eaf;return db[_0xd6fa('0x4b')][_0xd6fa('0x4c')]({'where':{'type':_0x26ebfd['type']},'raw':!![]});}return null;})[_0xd6fa('0x1a')](function(_0x33934d){if(_0x26ebfd[_0xd6fa('0x38')][_0xd6fa('0x54')]()==_0xd6fa('0x55')){var _0x1eba00=fs[_0xd6fa('0x5e')](path['join'](config[_0xd6fa('0x57')],_0xd6fa('0x58')),_0xd6fa('0x59'));var _0x3232f6=ejs[_0xd6fa('0x5a')](_0x1eba00,{'networks':_0x33934d||[]});fs[_0xd6fa('0x5d')]('/etc/asterisk/stun_xcally.conf',_0x3232f6);return respondWithRpcPromise(_0xd6fa('0x5b'),_0xd6fa('0x30'),{'module':_0xd6fa('0x5c')});}else if(_0x26ebfd['type'][_0xd6fa('0x54')]()==_0xd6fa('0x64')){var _0x3c73c1=fs[_0xd6fa('0x5e')](path[_0xd6fa('0x56')](config[_0xd6fa('0x57')],_0xd6fa('0x65')),_0xd6fa('0x59'));var _0x42332d=ejs['render'](_0x3c73c1,{'networks':_0x33934d||[]});fs['writeFileSync'](_0xd6fa('0x66'),_0x42332d);return respondWithRpcPromise(_0xd6fa('0x5b'),_0xd6fa('0x30'),{'module':_0xd6fa('0x5c')});}else{var _0x14007f=fs[_0xd6fa('0x5e')](path[_0xd6fa('0x56')](config[_0xd6fa('0x57')],'server/files/templates/network.ejs'),_0xd6fa('0x59'));var _0x6bc2a2=ejs[_0xd6fa('0x5a')](_0x14007f,{'networks':_0x33934d||[]});fs[_0xd6fa('0x5d')](util['format'](_0xd6fa('0x60'),_0x5bea05[_0xd6fa('0x53')][_0xd6fa('0x38')][_0xd6fa('0x61')]()),_0x6bc2a2);return respondWithRpcPromise(_0xd6fa('0x5b'),_0xd6fa('0x30'),{'module':_0xd6fa('0x62')});}return null;})['then'](function(_0x2c468e){if(_0x2c468e){return _0x26ebfd;}return null;});})[_0xd6fa('0x1a')](respondWithResult(_0x5976df,null))[_0xd6fa('0x23')](handleError(_0x5976df,null));};exports[_0xd6fa('0x31')]=function(_0x141423,_0x2d129d,_0x93aaad){var _0x57f11a;return db[_0xd6fa('0x4b')][_0xd6fa('0x63')]({'where':{'id':_0x141423[_0xd6fa('0x4f')]['id']}})[_0xd6fa('0x1a')](function(_0xfc04ee){_0x57f11a=_0xfc04ee;return _0xfc04ee;})[_0xd6fa('0x1a')](handleEntityNotFound(_0x2d129d,null))[_0xd6fa('0x1a')](removeEntity(_0x2d129d,null))[_0xd6fa('0x1a')](function(){if(_0x57f11a){return db[_0xd6fa('0x4b')][_0xd6fa('0x4c')]({'where':{'type':_0x57f11a[_0xd6fa('0x38')]},'raw':!![]});}})['then'](function(_0x41587e){if(_0x57f11a[_0xd6fa('0x38')][_0xd6fa('0x54')]()==_0xd6fa('0x55')){var _0x3a2743=fs[_0xd6fa('0x5e')](path['join'](config['root'],_0xd6fa('0x58')),'utf8');var _0x576cbc=ejs[_0xd6fa('0x5a')](_0x3a2743,{'networks':_0x41587e||[]});fs['writeFileSync'](_0xd6fa('0x67'),_0x576cbc);return respondWithRpcPromise(_0xd6fa('0x5b'),_0xd6fa('0x31'),{'module':_0xd6fa('0x5c')});}else if(_0x57f11a['type']['toUpperCase']()=='TURN'){var _0x2229b4=fs[_0xd6fa('0x5e')](path[_0xd6fa('0x56')](config[_0xd6fa('0x57')],_0xd6fa('0x65')),_0xd6fa('0x59'));var _0xa8df1d=ejs['render'](_0x2229b4,{'networks':_0x41587e||[]});fs[_0xd6fa('0x5d')](_0xd6fa('0x66'),_0xa8df1d);return respondWithRpcPromise(_0xd6fa('0x5b'),_0xd6fa('0x31'),{'module':'res_stun_monitor.so'});}else{var _0x3f2605=fs[_0xd6fa('0x5e')](path[_0xd6fa('0x56')](config[_0xd6fa('0x57')],_0xd6fa('0x5f')),_0xd6fa('0x59'));var _0x2bbb86=ejs[_0xd6fa('0x5a')](_0x3f2605,{'networks':_0x41587e||[]});fs[_0xd6fa('0x5d')](util[_0xd6fa('0x68')]('/etc/asterisk/sip_xcally_%s.conf',_0x141423[_0xd6fa('0x53')][_0xd6fa('0x38')][_0xd6fa('0x61')]()),_0x2bbb86);return respondWithRpcPromise(_0xd6fa('0x5b'),_0xd6fa('0x31'),{'module':'chan_sip.so'});}return null;})[_0xd6fa('0x23')](handleError(_0x2d129d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index bc9e2d6..ef48f67 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 _0xe644=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e2e40,_0x5e42ed){var _0x3cdf0a=function(_0x5ad21e){while(--_0x5ad21e){_0x3e2e40['push'](_0x3e2e40['shift']());}};_0x3cdf0a(++_0x5e42ed);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d9b=['rimraf','./network.attributes','Network','network','util','../../config/logger','moment','request-promise','path'];(function(_0x1c46e9,_0x2787bb){var _0x2e46db=function(_0x574e67){while(--_0x574e67){_0x1c46e9['push'](_0x1c46e9['shift']());}};_0x2e46db(++_0x2787bb);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x237128,_0x241bd5){_0x237128=_0x237128-0x0;var _0x533d70=_0x9d9b[_0x237128];return _0x533d70;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var logger=require(_0xb9d9('0x1'))('api');var moment=require(_0xb9d9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb9d9('0x3'));var fs=require('fs');var path=require(_0xb9d9('0x4'));var rimraf=require(_0xb9d9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb9d9('0x6'));module['exports']=function(_0x1b1f3c,_0x32cf18){return _0x1b1f3c['define'](_0xb9d9('0x7'),attributes,{'tableName':_0xb9d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 6cf9436..e9f161b 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x232740,_0x23da14){var _0x538dcb=function(_0x42afa2){while(--_0x42afa2){_0x232740['push'](_0x232740['shift']());}};_0x538dcb(++_0x23da14);}(_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 +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(_0x1adeed,_0x2b3108){var _0x270fb7=function(_0x3a5209){while(--_0x3a5209){_0x1adeed['push'](_0x1adeed['shift']());}};_0x270fb7(++_0x2b3108);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var 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 d75c28a..0785f59 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 _0xa841=['send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','addApplications','/:id/send'];(function(_0x4e93f0,_0x2755a5){var _0x468989=function(_0x48176d){while(--_0x48176d){_0x4e93f0['push'](_0x4e93f0['shift']());}};_0x468989(++_0x2755a5);}(_0xa841,0x19f));var _0x1a84=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa841[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x1a84('0x0'));var util=require(_0x1a84('0x1'));var path=require(_0x1a84('0x2'));var timeout=require(_0x1a84('0x3'));var express=require('express');var router=express[_0x1a84('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a84('0x5'));var interaction=require(_0x1a84('0x6'));var config=require(_0x1a84('0x7'));var controller=require(_0x1a84('0x8'));router[_0x1a84('0x9')]('/',auth[_0x1a84('0xa')](),controller[_0x1a84('0xb')]);router[_0x1a84('0x9')]('/describe',auth[_0x1a84('0xa')](),controller[_0x1a84('0xc')]);router[_0x1a84('0x9')](_0x1a84('0xd'),auth[_0x1a84('0xa')](),controller[_0x1a84('0xe')]);router[_0x1a84('0x9')]('/:id/dispositions',auth[_0x1a84('0xa')](),controller['getDispositions']);router[_0x1a84('0x9')](_0x1a84('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x1a84('0x9')](_0x1a84('0x10'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x11')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x1a84('0x12')]);router['get'](_0x1a84('0x13'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x14')]);router['post']('/',auth[_0x1a84('0xa')](),controller[_0x1a84('0x15')]);router[_0x1a84('0x16')](_0x1a84('0x17'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x18')]);router[_0x1a84('0x16')](_0x1a84('0xf'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x19')]);router['post'](_0x1a84('0x1a'),controller['notify']);router[_0x1a84('0x16')]('/:id/applications',auth[_0x1a84('0xa')](),controller[_0x1a84('0x1b')]);router['post'](_0x1a84('0x13'),auth[_0x1a84('0xa')](),controller['addAgents']);router[_0x1a84('0x16')](_0x1a84('0x1c'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x1d')]);router[_0x1a84('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1a84('0x1f')](_0x1a84('0xd'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x20')]);router[_0x1a84('0x1f')](_0x1a84('0x17'),auth['isAuthenticated'](),controller[_0x1a84('0x21')]);router[_0x1a84('0x1f')]('/:id/canned_answers',auth[_0x1a84('0xa')](),controller[_0x1a84('0x22')]);router[_0x1a84('0x1f')](_0x1a84('0x13'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x23')]);module[_0x1a84('0x24')]=router; \ No newline at end of file +var _0x0c62=['show','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','create','post','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','/:id','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x0c62,0xd1));var _0x20c6=function(_0x1405bf,_0x1b6018){_0x1405bf=_0x1405bf-0x0;var _0x4d9999=_0x0c62[_0x1405bf];return _0x4d9999;};'use strict';var multer=require(_0x20c6('0x0'));var util=require(_0x20c6('0x1'));var path=require(_0x20c6('0x2'));var timeout=require(_0x20c6('0x3'));var express=require(_0x20c6('0x4'));var router=express[_0x20c6('0x5')]();var fs_extra=require(_0x20c6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x20c6('0x7'));var config=require(_0x20c6('0x8'));var controller=require('./openchannelAccount.controller');router[_0x20c6('0x9')]('/',auth[_0x20c6('0xa')](),controller[_0x20c6('0xb')]);router[_0x20c6('0x9')](_0x20c6('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x20c6('0xd')]);router[_0x20c6('0x9')]('/:id/dispositions',auth[_0x20c6('0xa')](),controller['getDispositions']);router[_0x20c6('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x20c6('0xe')]);router[_0x20c6('0x9')](_0x20c6('0xf'),auth[_0x20c6('0xa')](),controller['getApplications']);router[_0x20c6('0x9')](_0x20c6('0x10'),auth['isAuthenticated'](),controller[_0x20c6('0x11')]);router[_0x20c6('0x9')](_0x20c6('0x12'),auth[_0x20c6('0xa')](),controller['getAgents']);router['post']('/',auth[_0x20c6('0xa')](),controller[_0x20c6('0x13')]);router['post']('/:id/dispositions',auth[_0x20c6('0xa')](),controller['addDisposition']);router[_0x20c6('0x14')](_0x20c6('0x15'),auth['isAuthenticated'](),controller[_0x20c6('0x16')]);router[_0x20c6('0x14')](_0x20c6('0x17'),controller[_0x20c6('0x18')]);router[_0x20c6('0x14')](_0x20c6('0xf'),auth[_0x20c6('0xa')](),controller[_0x20c6('0x19')]);router[_0x20c6('0x14')](_0x20c6('0x12'),auth['isAuthenticated'](),controller[_0x20c6('0x1a')]);router[_0x20c6('0x14')]('/:id/send',auth['isAuthenticated'](),controller[_0x20c6('0x1b')]);router[_0x20c6('0x1c')](_0x20c6('0x1d'),auth['isAuthenticated'](),controller[_0x20c6('0x1e')]);router[_0x20c6('0x1f')](_0x20c6('0x1d'),auth[_0x20c6('0xa')](),controller[_0x20c6('0x20')]);router[_0x20c6('0x1f')](_0x20c6('0x21'),auth['isAuthenticated'](),controller[_0x20c6('0x22')]);router['delete'](_0x20c6('0x15'),auth[_0x20c6('0xa')](),controller[_0x20c6('0x23')]);router[_0x20c6('0x1f')](_0x20c6('0x12'),auth[_0x20c6('0xa')](),controller[_0x20c6('0x24')]);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 cd53dc7..23782b0 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 _0x6e5b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT'];(function(_0x2f5a87,_0x471130){var _0xe6886f=function(_0x4f4cb6){while(--_0x4f4cb6){_0x2f5a87['push'](_0x2f5a87['shift']());}};_0xe6886f(++_0x471130);}(_0x6e5b,0x1a7));var _0xb6e5=function(_0x5b46eb,_0x46e6ec){_0x5b46eb=_0x5b46eb-0x0;var _0xd9b455=_0x6e5b[_0x5b46eb];return _0xd9b455;};'use strict';var Sequelize=require(_0xb6e5('0x0'));var rs=require(_0xb6e5('0x1'));module[_0xb6e5('0x2')]={'name':{'type':Sequelize[_0xb6e5('0x3')],'unique':_0xb6e5('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xb6e5('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xb6e5('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb6e5('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb6e5('0x5')],'defaultValue':function(){return _0xb6e5('0x6');}},'notificationSound':{'type':Sequelize[_0xb6e5('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb6e5('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb6e5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb6e5('0x3')]},'queueTransfer':{'type':Sequelize[_0xb6e5('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb6e5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb6e5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb6e5('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xb6e5('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xb6e5('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b0530){if(!_0x2b0530)this[_0xb6e5('0xa')](_0xb6e5('0xb'),null);this[_0xb6e5('0xa')](_0xb6e5('0xc'),_0x2b0530);}}}; \ No newline at end of file +var _0x51ca=['mandatoryDisposition','exports','STRING','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x44565b,_0x4d08e9){var _0x468a38=function(_0x48fdee){while(--_0x48fdee){_0x44565b['push'](_0x44565b['shift']());}};_0x468a38(++_0x4d08e9);}(_0x51ca,0x65));var _0xa51c=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x51ca[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xa51c('0x0')]={'name':{'type':Sequelize[_0xa51c('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa51c('0x1')],'defaultValue':function(){return rs[_0xa51c('0x2')]();}},'replyUri':{'type':Sequelize[_0xa51c('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa51c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa51c('0x3')],'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[_0xa51c('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa51c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa51c('0x1')]},'queueTransfer':{'type':Sequelize[_0xa51c('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa51c('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa51c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa51c('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xa51c('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xa51c('0x4')],'defaultValue':![],'comment':_0xa51c('0x7'),'set':function(_0x3d7395){if(!_0x3d7395)this[_0xa51c('0x8')]('mandatoryDispositionPauseId',null);this[_0xa51c('0x8')](_0xa51c('0x9'),_0x3d7395);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 9b30717..27d2e4a 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 _0xc809=['type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','OpenchannelAccount','includeAll','include','findAll','show','params','Pause','keys','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','OpenchannelAccountId','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','notify','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','OpenchannelApplication','account','list','applications','orderBy','priority','asc','Applications','defaults','ListId','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','./openchannelAccount.socket','client','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName'];(function(_0xcab3a0,_0x2a50d0){var _0x809b33=function(_0x559397){while(--_0x559397){_0xcab3a0['push'](_0xcab3a0['shift']());}};_0x809b33(++_0x2a50d0);}(_0xc809,0x13c));var _0x9c80=function(_0xddcfd0,_0x1a75aa){_0xddcfd0=_0xddcfd0-0x0;var _0x43207a=_0xc809[_0xddcfd0];return _0x43207a;};'use strict';var emlformat=require(_0x9c80('0x0'));var rimraf=require(_0x9c80('0x1'));var zipdir=require(_0x9c80('0x2'));var jsonpatch=require(_0x9c80('0x3'));var rp=require(_0x9c80('0x4'));var moment=require(_0x9c80('0x5'));var BPromise=require(_0x9c80('0x6'));var Mustache=require(_0x9c80('0x7'));var util=require(_0x9c80('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x9c80('0x9'));var ejs=require(_0x9c80('0xa'));var fs=require('fs');var fs_extra=require(_0x9c80('0xb'));var _=require(_0x9c80('0xc'));var squel=require(_0x9c80('0xd'));var crypto=require(_0x9c80('0xe'));var jsforce=require(_0x9c80('0xf'));var deskjs=require(_0x9c80('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c80('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c80('0x12'));var hardwareService=require(_0x9c80('0x13'));var logger=require('../../config/logger')(_0x9c80('0x14'));var utils=require(_0x9c80('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c80('0x16'))['db'];config[_0x9c80('0x17')]=_['defaults'](config[_0x9c80('0x17')],{'host':_0x9c80('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9c80('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9c80('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x9c80('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d436c,_0x20d745,_0xa9f9f8,_0x54486c){return new BPromise(function(_0x3f2a29,_0x414273){var _0x56e903=_0x54486c||client;return _0x56e903[_0x9c80('0x1b')](_0x2d436c,_0xa9f9f8)[_0x9c80('0x1c')](function(_0x60429b){logger[_0x9c80('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x20d745,_0x9c80('0x1e'));logger[_0x9c80('0x1f')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x20d745,_0x9c80('0x1e'),JSON[_0x9c80('0x20')](_0x60429b));if(_0x60429b[_0x9c80('0x21')]){if(_0x60429b[_0x9c80('0x21')][_0x9c80('0x22')]===0x1f4){logger[_0x9c80('0x21')](_0x9c80('0x23'),_0x20d745,_0x60429b[_0x9c80('0x21')][_0x9c80('0x24')]);return _0x414273(_0x60429b['error'][_0x9c80('0x24')]);}logger['error'](_0x9c80('0x23'),_0x20d745,_0x60429b[_0x9c80('0x21')]['message']);return _0x3f2a29(_0x60429b[_0x9c80('0x21')]['message']);}else{logger[_0x9c80('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x20d745,_0x9c80('0x1e'));_0x3f2a29(_0x60429b['result'][_0x9c80('0x24')]);}})[_0x9c80('0x25')](function(_0x47c4f4){logger[_0x9c80('0x21')](_0x9c80('0x23'),_0x20d745,_0x47c4f4);_0x414273(_0x47c4f4);});});}function respondWithStatusCode(_0x3c015e,_0x3fa317){_0x3fa317=_0x3fa317||0xcc;return function(_0x397706){if(_0x397706){return _0x3c015e[_0x9c80('0x26')](_0x3fa317);}return _0x3c015e[_0x9c80('0x27')](_0x3fa317)[_0x9c80('0x28')]();};}function respondWithResult(_0x5b2406,_0x25706c){_0x25706c=_0x25706c||0xc8;return function(_0x52e8d2){if(_0x52e8d2){return _0x5b2406[_0x9c80('0x27')](_0x25706c)['json'](_0x52e8d2);}};}function respondWithFilteredResult(_0x100738,_0x56e647){return function(_0x1fe72a){if(_0x1fe72a){var _0x36fa58=typeof _0x56e647[_0x9c80('0x29')]===_0x9c80('0x2a')&&typeof _0x56e647[_0x9c80('0x2b')]===_0x9c80('0x2a');var _0x3d219a=_0x1fe72a[_0x9c80('0x2c')];var _0xf3ce5c=_0x36fa58?0x0:_0x56e647[_0x9c80('0x29')];var _0xebc9f7=_0x36fa58?_0x1fe72a['count']:_0x56e647['offset']+_0x56e647['limit'];var _0x5123ba;if(_0xebc9f7>=_0x3d219a){_0xebc9f7=_0x3d219a;_0x5123ba=0xc8;}else{_0x5123ba=0xce;}_0x100738['status'](_0x5123ba);return _0x100738['set'](_0x9c80('0x2d'),_0xf3ce5c+'-'+_0xebc9f7+'/'+_0x3d219a)['json'](_0x1fe72a);}return null;};}function patchUpdates(_0x41a4ae){return function(_0x4c9ac5){try{jsonpatch[_0x9c80('0x2e')](_0x4c9ac5,_0x41a4ae,!![]);}catch(_0x1ec0e5){return BPromise[_0x9c80('0x2f')](_0x1ec0e5);}return _0x4c9ac5[_0x9c80('0x30')]();};}function saveUpdates(_0x3968d9,_0x191a9b){return function(_0x71e76c){if(_0x71e76c){return _0x71e76c[_0x9c80('0x31')](_0x3968d9)['then'](function(_0x3cc1d9){return _0x3cc1d9;});}return null;};}function removeEntity(_0x56b4a5,_0x38476a){return function(_0x5229f0){if(_0x5229f0){return _0x5229f0[_0x9c80('0x32')]()['then'](function(){var _0x1e926b=_0x5229f0[_0x9c80('0x33')]({'plain':!![]});var _0x5c3448=_0x9c80('0x34');return db[_0x9c80('0x35')][_0x9c80('0x32')]({'where':{'type':_0x5c3448,'resourceId':_0x1e926b['id']}})['then'](function(){return _0x5229f0;});})[_0x9c80('0x1c')](function(){_0x56b4a5[_0x9c80('0x27')](0xcc)[_0x9c80('0x28')]();});}};}function handleEntityNotFound(_0x5e4423,_0x4136f6){return function(_0x48b4de){if(!_0x48b4de){_0x5e4423[_0x9c80('0x26')](0x194);}return _0x48b4de;};}function handleError(_0x53dde8,_0x4090dd){_0x4090dd=_0x4090dd||0x1f4;return function(_0xad2be4){logger[_0x9c80('0x21')](_0xad2be4[_0x9c80('0x36')]);if(_0xad2be4[_0x9c80('0x37')]){delete _0xad2be4['name'];}_0x53dde8[_0x9c80('0x27')](_0x4090dd)[_0x9c80('0x38')](_0xad2be4);};}exports[_0x9c80('0x39')]=function(_0x4a6314,_0x35b042){var _0x3b72d3={'include':[{'model':db['Pause'],'as':_0x9c80('0x3a')}]},_0xc4357={},_0x2b81c7={'count':0x0,'rows':[]};var _0x2a7474=_[_0x9c80('0x3b')](db['OpenchannelAccount'][_0x9c80('0x3c')],function(_0x406f27){return{'name':_0x406f27[_0x9c80('0x3d')],'type':_0x406f27[_0x9c80('0x3e')][_0x9c80('0x3f')]};});_0xc4357['model']=_[_0x9c80('0x3b')](_0x2a7474,_0x9c80('0x37'));_0xc4357[_0x9c80('0x40')]=_['keys'](_0x4a6314['query']);_0xc4357[_0x9c80('0x41')]=_['intersection'](_0xc4357['model'],_0xc4357[_0x9c80('0x40')]);_0x3b72d3['attributes']=_[_0x9c80('0x42')](_0xc4357[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0x4a6314[_0x9c80('0x40')][_0x9c80('0x44')]));_0x3b72d3[_0x9c80('0x45')]=_0x3b72d3[_0x9c80('0x45')]['length']?_0x3b72d3[_0x9c80('0x45')]:_0xc4357[_0x9c80('0x43')];if(!_0x4a6314['query'][_0x9c80('0x46')](_0x9c80('0x47'))){_0x3b72d3[_0x9c80('0x2b')]=qs[_0x9c80('0x2b')](_0x4a6314[_0x9c80('0x40')][_0x9c80('0x2b')]);_0x3b72d3[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0x4a6314[_0x9c80('0x40')][_0x9c80('0x29')]);}_0x3b72d3[_0x9c80('0x48')]=qs[_0x9c80('0x49')](_0x4a6314[_0x9c80('0x40')]['sort']);_0x3b72d3[_0x9c80('0x4a')]=qs['filters'](_[_0x9c80('0x4b')](_0x4a6314[_0x9c80('0x40')],_0xc4357[_0x9c80('0x41')]),_0x2a7474);if(_0x4a6314[_0x9c80('0x40')][_0x9c80('0x4c')]){_0x3b72d3['where']=_[_0x9c80('0x4d')](_0x3b72d3[_0x9c80('0x4a')],{'$or':_['map'](_0x2a7474,function(_0x5c9524){if(_0x5c9524['type']!=='VIRTUAL'){var _0x2570f3={};_0x2570f3[_0x5c9524[_0x9c80('0x37')]]={'$like':'%'+_0x4a6314[_0x9c80('0x40')]['filter']+'%'};return _0x2570f3;}})});}_0x3b72d3=_[_0x9c80('0x4d')]({},_0x3b72d3,_0x4a6314['options']);var _0x41d13b={'where':_0x3b72d3[_0x9c80('0x4a')]};return db[_0x9c80('0x4e')][_0x9c80('0x2c')](_0x41d13b)[_0x9c80('0x1c')](function(_0x232e04){_0x2b81c7[_0x9c80('0x2c')]=_0x232e04;if(_0x4a6314['query'][_0x9c80('0x4f')]){_0x3b72d3[_0x9c80('0x50')]=[{'all':!![]}];}return db[_0x9c80('0x4e')][_0x9c80('0x51')](_0x3b72d3);})[_0x9c80('0x1c')](function(_0x788ff1){_0x2b81c7['rows']=_0x788ff1;return _0x2b81c7;})[_0x9c80('0x1c')](respondWithFilteredResult(_0x35b042,_0x3b72d3))[_0x9c80('0x25')](handleError(_0x35b042,null));};exports[_0x9c80('0x52')]=function(_0x559da1,_0x303eff){var _0x2862ac={'raw':![],'where':{'id':_0x559da1[_0x9c80('0x53')]['id']},'include':[{'model':db[_0x9c80('0x54')],'as':_0x9c80('0x3a')}]},_0x2bc898={};_0x2bc898['model']=_[_0x9c80('0x55')](db[_0x9c80('0x4e')][_0x9c80('0x3c')]);_0x2bc898[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0x559da1['query']);_0x2bc898['filters']=_[_0x9c80('0x42')](_0x2bc898[_0x9c80('0x43')],_0x2bc898[_0x9c80('0x40')]);_0x2862ac[_0x9c80('0x45')]=_[_0x9c80('0x42')](_0x2bc898[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0x559da1['query']['fields']));_0x2862ac[_0x9c80('0x45')]=_0x2862ac['attributes'][_0x9c80('0x56')]?_0x2862ac['attributes']:_0x2bc898[_0x9c80('0x43')];if(_0x559da1[_0x9c80('0x40')][_0x9c80('0x4f')]){_0x2862ac['include']=[{'all':!![]}];}_0x2862ac=_['merge']({},_0x2862ac,_0x559da1[_0x9c80('0x57')]);return db[_0x9c80('0x4e')]['find'](_0x2862ac)[_0x9c80('0x1c')](handleEntityNotFound(_0x303eff,null))['then'](respondWithResult(_0x303eff,null))[_0x9c80('0x25')](handleError(_0x303eff,null));};exports[_0x9c80('0x58')]=function(_0x32b192,_0x395ff4){return db[_0x9c80('0x4e')]['create'](_0x32b192[_0x9c80('0x59')],{})[_0x9c80('0x1c')](function(_0x1c0450){var _0x30f18a=_0x32b192[_0x9c80('0x5a')]['get']({'plain':!![]});if(!_0x30f18a)throw new Error(_0x9c80('0x5b'));if(_0x30f18a[_0x9c80('0x5c')]===_0x9c80('0x5a')){var _0x320b51=_0x1c0450['get']({'plain':!![]});var _0x23bb0f='OpenchannelAccounts';return db['UserProfileSection'][_0x9c80('0x5d')]({'where':{'name':_0x23bb0f,'userProfileId':_0x30f18a[_0x9c80('0x5e')]},'raw':!![]})['then'](function(_0x10dd36){if(_0x10dd36&&_0x10dd36[_0x9c80('0x5f')]===0x0){return db[_0x9c80('0x35')]['create']({'name':_0x320b51[_0x9c80('0x37')],'resourceId':_0x320b51['id'],'type':_0x10dd36[_0x9c80('0x37')],'sectionId':_0x10dd36['id']},{})['then'](function(){return _0x1c0450;});}else{return _0x1c0450;}})['catch'](function(_0x36ddce){logger[_0x9c80('0x21')](_0x9c80('0x60'),_0x36ddce);throw _0x36ddce;});}return _0x1c0450;})[_0x9c80('0x1c')](respondWithResult(_0x395ff4,0xc9))[_0x9c80('0x25')](handleError(_0x395ff4,null));};exports[_0x9c80('0x31')]=function(_0x2dbd8d,_0x3117ed){if(_0x2dbd8d[_0x9c80('0x59')]['id']){delete _0x2dbd8d[_0x9c80('0x59')]['id'];}return db[_0x9c80('0x4e')]['find']({'where':{'id':_0x2dbd8d['params']['id']},'include':[{'model':db[_0x9c80('0x54')],'as':'mandatoryDispositionPause'}]})[_0x9c80('0x1c')](handleEntityNotFound(_0x3117ed,null))[_0x9c80('0x1c')](saveUpdates(_0x2dbd8d[_0x9c80('0x59')],null))['then'](respondWithResult(_0x3117ed,null))['catch'](handleError(_0x3117ed,null));};exports[_0x9c80('0x32')]=function(_0x19ae44,_0x257132){return db[_0x9c80('0x4e')][_0x9c80('0x5d')]({'where':{'id':_0x19ae44[_0x9c80('0x53')]['id']}})['then'](handleEntityNotFound(_0x257132,null))['then'](removeEntity(_0x257132,null))[_0x9c80('0x25')](handleError(_0x257132,null));};exports[_0x9c80('0x61')]=function(_0x4c9b85,_0x49af9d){return db[_0x9c80('0x4e')]['describe']()[_0x9c80('0x1c')](respondWithResult(_0x49af9d,null))[_0x9c80('0x25')](handleError(_0x49af9d,null));};exports[_0x9c80('0x62')]=function(_0x1b80a7,_0x5caa94,_0x2b2e9f){if(_0x1b80a7[_0x9c80('0x59')]['id']){delete _0x1b80a7[_0x9c80('0x59')]['id'];}return db[_0x9c80('0x4e')]['find']({'where':{'id':_0x1b80a7['params']['id']}})['then'](handleEntityNotFound(_0x5caa94,null))['then'](function(_0x4e4f00){if(_0x4e4f00){_0x1b80a7[_0x9c80('0x59')]['OpenchannelAccountId']=_0x4e4f00['id'];return db['Disposition'][_0x9c80('0x58')](_0x1b80a7[_0x9c80('0x59')]);}})[_0x9c80('0x1c')](respondWithResult(_0x5caa94,null))[_0x9c80('0x25')](handleError(_0x5caa94,null));};exports[_0x9c80('0x63')]=function(_0xfe1a1f,_0xcc4cf3,_0x752169){var _0xfcacc0={'raw':![],'where':{}};var _0x19c696={};var _0x2a3d4d={'count':0x0,'rows':[]};return db[_0x9c80('0x4e')][_0x9c80('0x64')]({'where':{'id':_0xfe1a1f[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0xcc4cf3,null))[_0x9c80('0x1c')](function(_0x4b90a7){if(_0x4b90a7){_0x19c696[_0x9c80('0x43')]=_[_0x9c80('0x55')](db[_0x9c80('0x65')][_0x9c80('0x3c')]);_0x19c696[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0xfe1a1f['query']);_0x19c696[_0x9c80('0x41')]=_[_0x9c80('0x42')](_0x19c696[_0x9c80('0x43')],_0x19c696[_0x9c80('0x40')]);_0xfcacc0[_0x9c80('0x45')]=_[_0x9c80('0x42')](_0x19c696[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x44')]));_0xfcacc0[_0x9c80('0x45')]=_0xfcacc0['attributes'][_0x9c80('0x56')]?_0xfcacc0['attributes']:_0x19c696[_0x9c80('0x43')];if(!_0xfe1a1f['query']['hasOwnProperty'](_0x9c80('0x47'))){_0xfcacc0['limit']=qs[_0x9c80('0x2b')](_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x2b')]);_0xfcacc0[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x29')]);}_0xfcacc0['order']=qs[_0x9c80('0x49')](_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x49')]);_0xfcacc0[_0x9c80('0x4a')]=qs[_0x9c80('0x41')](_[_0x9c80('0x4b')](_0xfe1a1f[_0x9c80('0x40')],_0x19c696[_0x9c80('0x41')]));_0xfcacc0[_0x9c80('0x4a')][_0x9c80('0x66')]=_0x4b90a7['id'];if(_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x4c')]){_0xfcacc0[_0x9c80('0x4a')]=_[_0x9c80('0x4d')](_0xfcacc0['where'],{'$or':_['map'](_0xfcacc0[_0x9c80('0x45')],function(_0x4c0b0e){var _0x337956={};_0x337956[_0x4c0b0e]={'$like':'%'+_0xfe1a1f[_0x9c80('0x40')]['filter']+'%'};return _0x337956;})});}_0xfcacc0=_[_0x9c80('0x4d')]({},_0xfcacc0,_0xfe1a1f[_0x9c80('0x57')]);return db[_0x9c80('0x65')]['count']({'where':_0xfcacc0['where']})['then'](function(_0x4a7863){_0x2a3d4d[_0x9c80('0x2c')]=_0x4a7863;if(_0xfe1a1f['query']['includeAll']){_0xfcacc0[_0x9c80('0x50')]=[{'all':!![]}];}return db[_0x9c80('0x65')][_0x9c80('0x51')](_0xfcacc0);})[_0x9c80('0x1c')](function(_0x13f45c){_0x2a3d4d[_0x9c80('0x67')]=_0x13f45c;return _0x2a3d4d;});}})[_0x9c80('0x1c')](respondWithFilteredResult(_0xcc4cf3,_0xfcacc0))['catch'](handleError(_0xcc4cf3,null));};exports[_0x9c80('0x68')]=function(_0x5acb51,_0x1b0af2,_0x53f79f){return db['OpenchannelAccount'][_0x9c80('0x5d')]({'where':{'id':_0x5acb51[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x1b0af2,null))[_0x9c80('0x1c')](function(_0x3f0c64){if(_0x3f0c64){return _0x3f0c64['removeDispositions'](_0x5acb51['query']['ids']);}})[_0x9c80('0x1c')](respondWithStatusCode(_0x1b0af2,null))[_0x9c80('0x25')](handleError(_0x1b0af2,null));};exports[_0x9c80('0x69')]=function(_0x20fea2,_0x15d67c,_0x3deb29){if(_0x20fea2[_0x9c80('0x59')]['id']){delete _0x20fea2[_0x9c80('0x59')]['id'];}return db[_0x9c80('0x4e')][_0x9c80('0x5d')]({'where':{'id':_0x20fea2[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x15d67c,null))[_0x9c80('0x1c')](function(_0x4e51fc){if(_0x4e51fc){_0x20fea2[_0x9c80('0x59')][_0x9c80('0x66')]=_0x4e51fc['id'];return db[_0x9c80('0x6a')][_0x9c80('0x58')](_0x20fea2[_0x9c80('0x59')]);}})['then'](respondWithResult(_0x15d67c,null))[_0x9c80('0x25')](handleError(_0x15d67c,null));};exports['getAnswers']=function(_0x300d55,_0x248380,_0x475940){var _0x4f8e3b={'raw':![],'where':{}};var _0xf68b98={};var _0x3970c4={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9c80('0x64')]({'where':{'id':_0x300d55[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x248380,null))[_0x9c80('0x1c')](function(_0x4f89a2){if(_0x4f89a2){_0xf68b98[_0x9c80('0x43')]=_[_0x9c80('0x55')](db[_0x9c80('0x6a')]['rawAttributes']);_0xf68b98['query']=_[_0x9c80('0x55')](_0x300d55[_0x9c80('0x40')]);_0xf68b98['filters']=_[_0x9c80('0x42')](_0xf68b98[_0x9c80('0x43')],_0xf68b98[_0x9c80('0x40')]);_0x4f8e3b[_0x9c80('0x45')]=_['intersection'](_0xf68b98[_0x9c80('0x43')],qs['fields'](_0x300d55[_0x9c80('0x40')]['fields']));_0x4f8e3b['attributes']=_0x4f8e3b['attributes'][_0x9c80('0x56')]?_0x4f8e3b['attributes']:_0xf68b98['model'];if(!_0x300d55[_0x9c80('0x40')][_0x9c80('0x46')](_0x9c80('0x47'))){_0x4f8e3b[_0x9c80('0x2b')]=qs[_0x9c80('0x2b')](_0x300d55[_0x9c80('0x40')]['limit']);_0x4f8e3b[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0x300d55[_0x9c80('0x40')][_0x9c80('0x29')]);}_0x4f8e3b['order']=qs[_0x9c80('0x49')](_0x300d55[_0x9c80('0x40')][_0x9c80('0x49')]);_0x4f8e3b[_0x9c80('0x4a')]=qs[_0x9c80('0x41')](_[_0x9c80('0x4b')](_0x300d55['query'],_0xf68b98[_0x9c80('0x41')]));_0x4f8e3b['where'][_0x9c80('0x66')]=_0x4f89a2['id'];if(_0x300d55[_0x9c80('0x40')][_0x9c80('0x4c')]){_0x4f8e3b[_0x9c80('0x4a')]=_[_0x9c80('0x4d')](_0x4f8e3b[_0x9c80('0x4a')],{'$or':_[_0x9c80('0x3b')](_0x4f8e3b[_0x9c80('0x45')],function(_0x2c7f9c){var _0x51dffe={};_0x51dffe[_0x2c7f9c]={'$like':'%'+_0x300d55['query'][_0x9c80('0x4c')]+'%'};return _0x51dffe;})});}_0x4f8e3b=_['merge']({},_0x4f8e3b,_0x300d55[_0x9c80('0x57')]);return db[_0x9c80('0x6a')][_0x9c80('0x2c')]({'where':_0x4f8e3b[_0x9c80('0x4a')]})[_0x9c80('0x1c')](function(_0x10f5b7){_0x3970c4[_0x9c80('0x2c')]=_0x10f5b7;if(_0x300d55[_0x9c80('0x40')][_0x9c80('0x4f')]){_0x4f8e3b[_0x9c80('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9c80('0x51')](_0x4f8e3b);})['then'](function(_0x20f977){_0x3970c4[_0x9c80('0x67')]=_0x20f977;return _0x3970c4;});}})[_0x9c80('0x1c')](respondWithFilteredResult(_0x248380,_0x4f8e3b))[_0x9c80('0x25')](handleError(_0x248380,null));};exports[_0x9c80('0x6b')]=function(_0x9542b5,_0x384737,_0x5ae35e){return db[_0x9c80('0x4e')]['find']({'where':{'id':_0x9542b5[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x384737,null))[_0x9c80('0x1c')](function(_0x4114e3){if(_0x4114e3){return _0x4114e3[_0x9c80('0x6b')](_0x9542b5[_0x9c80('0x40')][_0x9c80('0x6c')]);}})['then'](respondWithStatusCode(_0x384737,null))[_0x9c80('0x25')](handleError(_0x384737,null));};exports[_0x9c80('0x6d')]=function(_0x1659eb,_0x4f5787,_0x592913){var _0x268469={'body':_0x1659eb['body'],'channel':'openchannel'};var _0x36cebd=[];var _0x49e75a=[];var _0x3e3e5f={};var _0x1f44bb=![];return db[_0x9c80('0x6e')][_0x9c80('0x61')]()[_0x9c80('0x1c')](function(_0x1e1e58){if(!_0x1e1e58){throw new db[(_0x9c80('0x6f'))][(_0x9c80('0x70'))]('no\x20available\x20attributes');}_0x36cebd=_[_0x9c80('0x71')](_['keys'](_0x1e1e58),[_0x9c80('0x72'),_0x9c80('0x73')]);_0x49e75a=_['difference'](_[_0x9c80('0x55')](_0x1e1e58),[_0x9c80('0x72'),_0x9c80('0x73'),_0x9c80('0x74'),'ListId']);if(_0x1659eb[_0x9c80('0x59')]['id']){delete _0x1659eb[_0x9c80('0x59')]['id'];}if(_[_0x9c80('0x75')](_0x1659eb[_0x9c80('0x59')][_0x9c80('0x76')])){throw new db[(_0x9c80('0x6f'))][(_0x9c80('0x70'))](_0x9c80('0x77'));}if(_['isNil'](_0x1659eb[_0x9c80('0x59')]['body'])||_0x1659eb[_0x9c80('0x59')]['body']===''){throw new db[(_0x9c80('0x6f'))][(_0x9c80('0x70'))](_0x9c80('0x78'));}if(_['isNil'](_0x1659eb[_0x9c80('0x59')][_0x9c80('0x79')])){throw new db[(_0x9c80('0x6f'))][(_0x9c80('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49e75a);}if(!_['includes'](_0x49e75a,_0x1659eb[_0x9c80('0x59')][_0x9c80('0x79')])){throw new db['Sequelize'][(_0x9c80('0x70'))](_0x9c80('0x7a')+_0x49e75a);}_0x3e3e5f[_0x1659eb[_0x9c80('0x59')][_0x9c80('0x79')]]=_0x1659eb[_0x9c80('0x59')]['from'];})[_0x9c80('0x1c')](function(){return db['OpenchannelAccount'][_0x9c80('0x5d')]({'where':{'id':_0x1659eb[_0x9c80('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x9c80('0x7b'),'include':[{'model':db[_0x9c80('0x6e')],'as':_0x9c80('0x7c'),'where':_0x3e3e5f,'limit':0x1,'order':[[_0x9c80('0x73'),'DESC']]}]},{'model':db[_0x9c80('0x7d')],'as':'Applications'}]});})[_0x9c80('0x1c')](handleEntityNotFound(_0x4f5787,null))['then'](function(_0x1263e2){if(_0x1263e2&&_0x1263e2['List']){_0x268469[_0x9c80('0x7e')]=_0x1263e2;_0x268469['applications']=_0x1263e2['Applications'];_0x268469[_0x9c80('0x7f')]=_0x1263e2[_0x9c80('0x7b')];_0x268469[_0x9c80('0x80')]=_[_0x9c80('0x81')](_0x268469['applications'],[_0x9c80('0x82')],[_0x9c80('0x83')]);if(_0x268469[_0x9c80('0x7e')][_0x9c80('0x84')]){delete _0x268469['account'][_0x9c80('0x84')];}if(_0x268469[_0x9c80('0x7e')]['List']&&_0x268469[_0x9c80('0x7e')]['List'][_0x9c80('0x7c')][_0x9c80('0x56')]){return _0x268469[_0x9c80('0x7e')][_0x9c80('0x7b')]['Contacts'][0x0];}var _0x58261b=_[_0x9c80('0x85')](_0x1659eb[_0x9c80('0x59')],{'firstName':_0x1659eb[_0x9c80('0x59')][_0x9c80('0x76')],'ListId':_0x1263e2[_0x9c80('0x86')]});_0x58261b[_0x1659eb[_0x9c80('0x59')][_0x9c80('0x79')]]=_0x1659eb[_0x9c80('0x59')][_0x9c80('0x76')];return db[_0x9c80('0x6e')][_0x9c80('0x58')](_0x58261b,{'fields':_0x36cebd,'raw':!![]});}})[_0x9c80('0x1c')](handleEntityNotFound(_0x4f5787,null))['then'](function(_0x135e01){_0x268469[_0x9c80('0x87')]=_0x135e01;if(_0x135e01){var _0x5057df={'ContactId':_0x135e01['id'],'OpenchannelAccountId':_0x1659eb['params']['id'],'from':(_0x135e01[_0x9c80('0x88')]||'')+'\x20'+(_0x135e01[_0x9c80('0x89')]||'')};var _0x3fa747={'OpenchannelAccountId':_0x1659eb['params']['id'],'closed':![]};if(_0x1659eb['body']['threadId']){_0x3fa747['threadId']=_0x1659eb[_0x9c80('0x59')]['threadId'];return db['OpenchannelInteraction']['find']({'where':_0x3fa747})[_0x9c80('0x1c')](function(_0x39f5d2){if(_0x39f5d2){return[_0x39f5d2,![]];}_0x5057df[_0x9c80('0x8a')]=_0x1659eb['body'][_0x9c80('0x8a')];_0x5057df[_0x9c80('0x8b')]=_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8b')];return db[_0x9c80('0x8c')][_0x9c80('0x58')](_0x5057df)[_0x9c80('0x1c')](function(_0x3c7a01){return[_0x3c7a01,!![]];});});}else{_0x3fa747[_0x9c80('0x8a')]=null;}_0x3fa747[_0x9c80('0x8d')]=_0x135e01['id'];return db['OpenchannelInteraction'][_0x9c80('0x5d')]({'where':_0x3fa747})['then'](function(_0x5535b7){if(_0x5535b7){return[_0x5535b7,![]];}return db[_0x9c80('0x8c')]['create'](_0x5057df)[_0x9c80('0x1c')](function(_0x236516){return[_0x236516,!![]];});});}})[_0x9c80('0x8e')](function(_0x413e86,_0x25e9cd){if(_0x413e86){_0x1f44bb=_0x25e9cd;if(!_0x25e9cd){var _0x19a6fa={'from':(_0x268469['contact']['firstName']||'')+'\x20'+(_0x268469[_0x9c80('0x87')][_0x9c80('0x89')]||'')};if(_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8a')]&&_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8f')]&&_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8a')]!=_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8f')]){_0x19a6fa['threadId']=_0x1659eb[_0x9c80('0x59')]['messageId'];}return _0x413e86[_0x9c80('0x31')](_0x19a6fa);}else{return _0x413e86;}}})[_0x9c80('0x1c')](function(_0x19672e){_0x268469[_0x9c80('0x90')]=_0x19672e[_0x9c80('0x33')]({'plain':!![]});_0x268469['interaction'][_0x9c80('0x91')]=_0x1f44bb;if(_0x268469[_0x9c80('0x90')][_0x9c80('0x91')]){if(_0x268469[_0x9c80('0x7e')][_0x9c80('0x92')]){_0x268469[_0x9c80('0x80')][_0x9c80('0x93')]({'id':0x0,'priority':_0x268469[_0x9c80('0x80')][_0x9c80('0x56')]+0x1,'app':_0x9c80('0x94'),'appdata':_0x9c80('0x95'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x9c80('0x58')]({'body':_0x1659eb[_0x9c80('0x59')]['body'],'OpenchannelAccountId':_0x1659eb[_0x9c80('0x53')]['id'],'OpenchannelInteractionId':_0x19672e['id'],'direction':'in','ContactId':_0x268469['contact']['id'],'AttachmentId':_0x1659eb['body'][_0x9c80('0x96')]});})[_0x9c80('0x1c')](function(_0x479659){_0x268469[_0x9c80('0x24')]=_0x479659;if(_0x268469['interaction']['UserId']){return db['User'][_0x9c80('0x5d')]({'attributes':['id',_0x9c80('0x37')],'where':{'id':_0x268469[_0x9c80('0x90')][_0x9c80('0x97')]}})[_0x9c80('0x1c')](function(_0x221203){if(_0x221203){_0x268469[_0x9c80('0x80')][_0x9c80('0x98')]({'id':0x0,'priority':0x0,'app':_0x9c80('0x99'),'appdata':_0x221203[_0x9c80('0x37')]+','+(_0x268469[_0x9c80('0x7e')][_0x9c80('0x9a')]||0xa),'interval':_0x9c80('0x9b')});_0x268469[_0x9c80('0x9c')]=![];}return respondWithRpcPromise(_0x9c80('0x9d'),'startRouting',_0x268469);});}return respondWithRpcPromise('Start',_0x9c80('0x9e'),_0x268469);})[_0x9c80('0x1c')](function(_0x5eb99f){respondWithRpcPromise(_0x9c80('0x9f'),_0x9c80('0x9f'),{'event':_0x9c80('0x6d'),'message':_0x5eb99f},client9002);return _0x5eb99f;})[_0x9c80('0x1c')](respondWithResult(_0x4f5787,null))[_0x9c80('0x25')](handleError(_0x4f5787,null));};exports['addApplications']=function(_0xc6fe98,_0x2f6ee4){var _0xb279bb=_0xc6fe98[_0x9c80('0x53')]['id'];var _0x3b1203=_0xc6fe98['body'];var _0x3441e2=0xc8;var _0x2301dd=null;return db[_0x9c80('0xa0')][_0x9c80('0xa1')]({'isolationLevel':db[_0x9c80('0xa0')]['Transaction'][_0x9c80('0xa2')]['READ_COMMITTED']},function(_0x26c6c0){return db[_0x9c80('0x4e')]['findOne']({'where':{'id':_0xb279bb},'transaction':_0x26c6c0})[_0x9c80('0x1c')](function(_0x40d295){if(_0x40d295){return db['OpenchannelApplication'][_0x9c80('0x32')]({'where':{'OpenchannelAccountId':_0xb279bb},'transaction':_0x26c6c0})[_0x9c80('0x1c')](function(){var _0x1fd0f5=_[_0x9c80('0x3b')](_0x3b1203,function(_0x242606){_0x242606[_0x9c80('0x66')]=_0xb279bb;return _0x242606;});return db[_0x9c80('0x7d')][_0x9c80('0xa3')](_0x1fd0f5,{'transaction':_0x26c6c0});});}else{_0x3441e2=0x194;_0x2301dd=[];}});})[_0x9c80('0x1c')](function(){if(_0x3441e2!==0x194){return db[_0x9c80('0x7d')][_0x9c80('0xa4')]({'where':{'OpenchannelAccountId':_0xb279bb},'order':_0x9c80('0x82')})[_0x9c80('0x1c')](function(_0x1b549c){_0x2301dd=_0x1b549c;});}})[_0x9c80('0x25')](function(_0x1b15ca){_0x3441e2=0x1f4;logger[_0x9c80('0x21')](_0x1b15ca[_0x9c80('0x36')]);if(_0x1b15ca[_0x9c80('0x37')]){delete _0x1b15ca[_0x9c80('0x37')];}_0x2301dd=_0x1b15ca;})[_0x9c80('0xa5')](function(){if(_0x2301dd===null){_0x2f6ee4[_0x9c80('0x26')](_0x3441e2);}else{if(_0x3441e2===0x1f4){_0x2f6ee4['status'](_0x3441e2)['send'](_0x2301dd);}else{_0x2f6ee4[_0x9c80('0x27')](_0x3441e2)['json'](_0x2301dd);}}});};exports[_0x9c80('0xa6')]=function(_0xc4e97f,_0x189e6d,_0x478564){var _0x48efe2={};var _0x5eb96b={};var _0x234eed;var _0x37a2d9;return db[_0x9c80('0x4e')][_0x9c80('0x64')]({'where':{'id':_0xc4e97f['params']['id']}})['then'](handleEntityNotFound(_0x189e6d,null))['then'](function(_0x2f1776){if(_0x2f1776){_0x234eed=_0x2f1776;_0x5eb96b['model']=_[_0x9c80('0x55')](db[_0x9c80('0x7d')]['rawAttributes']);_0x5eb96b[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0xc4e97f[_0x9c80('0x40')]);_0x5eb96b[_0x9c80('0x41')]=_[_0x9c80('0x42')](_0x5eb96b[_0x9c80('0x43')],_0x5eb96b['query']);_0x48efe2[_0x9c80('0x45')]=_[_0x9c80('0x42')](_0x5eb96b['model'],qs[_0x9c80('0x44')](_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x44')]));_0x48efe2[_0x9c80('0x45')]=_0x48efe2[_0x9c80('0x45')][_0x9c80('0x56')]?_0x48efe2[_0x9c80('0x45')]:_0x5eb96b['model'];_0x48efe2[_0x9c80('0x48')]=qs[_0x9c80('0x49')](_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x49')]);_0x48efe2[_0x9c80('0x4a')]=qs[_0x9c80('0x41')](_[_0x9c80('0x4b')](_0xc4e97f['query'],_0x5eb96b[_0x9c80('0x41')]));if(_0xc4e97f[_0x9c80('0x40')]['filter']){_0x48efe2[_0x9c80('0x4a')]=_[_0x9c80('0x4d')](_0x48efe2[_0x9c80('0x4a')],{'$or':_[_0x9c80('0x3b')](_0x48efe2[_0x9c80('0x45')],function(_0x11088f){var _0xe94f22={};_0xe94f22[_0x11088f]={'$like':'%'+_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x4c')]+'%'};return _0xe94f22;})});}_0x48efe2=_[_0x9c80('0x4d')]({},_0x48efe2,_0xc4e97f[_0x9c80('0x57')]);return _0x234eed[_0x9c80('0xa6')](_0x48efe2);}})[_0x9c80('0x1c')](function(_0x3453dd){if(_0x3453dd){_0x37a2d9=_0x3453dd['length'];if(!_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x46')]('nolimit')){_0x48efe2[_0x9c80('0x2b')]=qs['limit'](_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x2b')]);_0x48efe2[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x29')]);}return _0x234eed[_0x9c80('0xa6')](_0x48efe2);}})[_0x9c80('0x1c')](function(_0x4852cc){if(_0x4852cc){return _0x4852cc?{'count':_0x37a2d9,'rows':_0x4852cc}:null;}})[_0x9c80('0x1c')](respondWithResult(_0x189e6d,null))['catch'](handleError(_0x189e6d,null));};exports[_0x9c80('0xa7')]=function(_0xc67a43,_0x545275,_0x4b29ca){var _0x2b3862={'raw':![],'where':{}};var _0x38d500={};var _0x4efc27={'count':0x0,'rows':[]};return db[_0x9c80('0x4e')][_0x9c80('0x64')]({'where':{'id':_0xc67a43[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x545275,null))[_0x9c80('0x1c')](function(_0x3e989c){if(_0x3e989c){_0x38d500['model']=_[_0x9c80('0x55')](db['OpenchannelInteraction'][_0x9c80('0x3c')]);_0x38d500[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0xc67a43['query']);_0x38d500[_0x9c80('0x41')]=_['intersection'](_0x38d500[_0x9c80('0x43')],_0x38d500['query']);_0x2b3862[_0x9c80('0x45')]=_['intersection'](_0x38d500[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0xc67a43[_0x9c80('0x40')][_0x9c80('0x44')]));_0x2b3862['attributes']=_0x2b3862[_0x9c80('0x45')][_0x9c80('0x56')]?_0x2b3862[_0x9c80('0x45')]:_0x38d500[_0x9c80('0x43')];if(!_0xc67a43[_0x9c80('0x40')]['hasOwnProperty'](_0x9c80('0x47'))){_0x2b3862[_0x9c80('0x2b')]=qs[_0x9c80('0x2b')](_0xc67a43[_0x9c80('0x40')]['limit']);_0x2b3862[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0xc67a43[_0x9c80('0x40')][_0x9c80('0x29')]);}_0x2b3862[_0x9c80('0x48')]=qs[_0x9c80('0x49')](_0xc67a43['query']['sort']);_0x2b3862[_0x9c80('0x4a')]=qs['filters'](_['pick'](_0xc67a43[_0x9c80('0x40')],_0x38d500[_0x9c80('0x41')]));_0x2b3862[_0x9c80('0x4a')][_0x9c80('0x66')]=_0x3e989c['id'];if(_0xc67a43['query']['filter']){_0x2b3862[_0x9c80('0x4a')]=_['merge'](_0x2b3862[_0x9c80('0x4a')],{'$or':_['map'](_0x2b3862[_0x9c80('0x45')],function(_0x5c6253){var _0x59c4e5={};_0x59c4e5[_0x5c6253]={'$like':'%'+_0xc67a43[_0x9c80('0x40')][_0x9c80('0x4c')]+'%'};return _0x59c4e5;})});}_0x2b3862=_[_0x9c80('0x4d')]({},_0x2b3862,_0xc67a43[_0x9c80('0x57')]);return db[_0x9c80('0x8c')][_0x9c80('0x2c')]({'where':_0x2b3862[_0x9c80('0x4a')]})[_0x9c80('0x1c')](function(_0x46b1ba){_0x4efc27[_0x9c80('0x2c')]=_0x46b1ba;if(_0xc67a43[_0x9c80('0x40')][_0x9c80('0x4f')]){_0x2b3862[_0x9c80('0x50')]=[{'model':db[_0x9c80('0x6e')],'as':_0x9c80('0xa8'),'required':![]},{'model':db[_0x9c80('0xa9')],'as':_0x9c80('0xaa'),'attributes':[_0x9c80('0x37'),'fullname',_0x9c80('0xab')],'required':![]},{'model':db[_0x9c80('0xac')],'as':_0x9c80('0xad'),'attributes':['id',_0x9c80('0x37'),_0x9c80('0xae')],'where':_0xc67a43[_0x9c80('0x40')][_0x9c80('0xaf')]?{'id':_0xc67a43[_0x9c80('0x40')][_0x9c80('0xaf')]}:undefined,'required':_0xc67a43['query']['tag']?!![]:![]}];}return db[_0x9c80('0x8c')][_0x9c80('0x51')](_0x2b3862);})['then'](function(_0x1b0e0c){_0x4efc27[_0x9c80('0x67')]=_0x1b0e0c;return _0x4efc27;});}})[_0x9c80('0x1c')](respondWithFilteredResult(_0x545275,_0x2b3862))[_0x9c80('0x25')](handleError(_0x545275,null));};exports['addAgents']=function(_0x271740,_0x5043c7,_0x8d231c){return db[_0x9c80('0x4e')]['find']({'where':{'id':_0x271740[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x5043c7,null))[_0x9c80('0x1c')](function(_0x4509d7){if(_0x4509d7){return _0x4509d7[_0x9c80('0xb0')](_0x271740[_0x9c80('0x59')][_0x9c80('0x6c')],_[_0x9c80('0xb1')](_0x271740[_0x9c80('0x59')],[_0x9c80('0x6c'),'id'])||{})[_0x9c80('0x8e')](function(_0x179102){for(var _0x21ea8d=0x0;_0x21ea8d<_0x271740[_0x9c80('0x59')][_0x9c80('0x6c')][_0x9c80('0x56')];_0x21ea8d+=0x1){socket[_0x9c80('0xb2')](_0x9c80('0xb3'),{'UserId':Number(_0x271740[_0x9c80('0x59')]['ids'][_0x21ea8d]),'OpenchannelAccountId':Number(_0x271740[_0x9c80('0x53')]['id'])});}return _0x179102;});}})[_0x9c80('0x1c')](respondWithResult(_0x5043c7,null))['catch'](handleError(_0x5043c7,null));};exports[_0x9c80('0xb4')]=function(_0x136992,_0x3d7841,_0xf5d2c3){return db[_0x9c80('0x4e')][_0x9c80('0x5d')]({'where':{'id':_0x136992[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x3d7841,null))[_0x9c80('0x1c')](function(_0x328c54){if(_0x328c54){return _0x328c54[_0x9c80('0xb4')](_0x136992[_0x9c80('0x40')][_0x9c80('0x6c')])[_0x9c80('0x1c')](function(){if(_[_0x9c80('0xb5')](_0x136992[_0x9c80('0x40')][_0x9c80('0x6c')])){for(var _0x16c52a=0x0;_0x16c52a<_0x136992[_0x9c80('0x40')]['ids'][_0x9c80('0x56')];_0x16c52a+=0x1){socket[_0x9c80('0xb2')](_0x9c80('0xb6'),{'UserId':Number(_0x136992[_0x9c80('0x40')]['ids'][_0x16c52a]),'OpenchannelAccountId':Number(_0x136992[_0x9c80('0x53')]['id'])});}}else{socket[_0x9c80('0xb2')](_0x9c80('0xb6'),{'UserId':Number(_0x136992[_0x9c80('0x40')]['ids']),'OpenchannelAccountId':Number(_0x136992[_0x9c80('0x53')]['id'])});}});}})[_0x9c80('0x1c')](respondWithStatusCode(_0x3d7841,null))[_0x9c80('0x25')](handleError(_0x3d7841,null));};exports[_0x9c80('0xb7')]=function(_0x3a2665,_0x4bbcf4,_0x1d1a10){var _0x5a1cf4={};var _0x46bc55={};var _0x24dab9;var _0x530981;return db[_0x9c80('0x4e')]['findOne']({'where':{'id':_0x3a2665['params']['id']}})['then'](handleEntityNotFound(_0x4bbcf4,null))['then'](function(_0x38fdb8){if(_0x38fdb8){_0x24dab9=_0x38fdb8;_0x46bc55[_0x9c80('0x43')]=_[_0x9c80('0x55')](db[_0x9c80('0xa9')]['rawAttributes']);_0x46bc55[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0x3a2665[_0x9c80('0x40')]);_0x46bc55['filters']=_[_0x9c80('0x42')](_0x46bc55[_0x9c80('0x43')],_0x46bc55[_0x9c80('0x40')]);_0x5a1cf4['attributes']=_[_0x9c80('0x42')](_0x46bc55[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0x3a2665[_0x9c80('0x40')][_0x9c80('0x44')]));_0x5a1cf4['attributes']=_0x5a1cf4[_0x9c80('0x45')][_0x9c80('0x56')]?_0x5a1cf4[_0x9c80('0x45')]:_0x46bc55['model'];_0x5a1cf4['order']=qs['sort'](_0x3a2665[_0x9c80('0x40')][_0x9c80('0x49')]);_0x5a1cf4[_0x9c80('0x4a')]=qs[_0x9c80('0x41')](_['pick'](_0x3a2665[_0x9c80('0x40')],_0x46bc55[_0x9c80('0x41')]));if(_0x3a2665[_0x9c80('0x40')][_0x9c80('0x4c')]){_0x5a1cf4['where']=_[_0x9c80('0x4d')](_0x5a1cf4[_0x9c80('0x4a')],{'$or':_[_0x9c80('0x3b')](_0x5a1cf4[_0x9c80('0x45')],function(_0x65fe1b){var _0x1ca590={};_0x1ca590[_0x65fe1b]={'$like':'%'+_0x3a2665[_0x9c80('0x40')][_0x9c80('0x4c')]+'%'};return _0x1ca590;})});}_0x5a1cf4=_[_0x9c80('0x4d')]({},_0x5a1cf4,_0x3a2665[_0x9c80('0x57')]);return _0x24dab9['getAgents'](_0x5a1cf4);}})['then'](function(_0x2a1e03){if(_0x2a1e03){_0x530981=_0x2a1e03[_0x9c80('0x56')];if(!_0x3a2665[_0x9c80('0x40')][_0x9c80('0x46')](_0x9c80('0x47'))){_0x5a1cf4[_0x9c80('0x2b')]=qs[_0x9c80('0x2b')](_0x3a2665[_0x9c80('0x40')][_0x9c80('0x2b')]);_0x5a1cf4['offset']=qs[_0x9c80('0x29')](_0x3a2665['query']['offset']);}return _0x24dab9[_0x9c80('0xb7')](_0x5a1cf4);}})[_0x9c80('0x1c')](function(_0x2e53f0){if(_0x2e53f0){return _0x2e53f0?{'count':_0x530981,'rows':_0x2e53f0}:null;}})[_0x9c80('0x1c')](respondWithResult(_0x4bbcf4,null))[_0x9c80('0x25')](handleError(_0x4bbcf4,null));};exports[_0x9c80('0x38')]=function(_0x16f2ca,_0x482c8b,_0x4980b9){var _0x385b7c,_0x3230c4,_0x13ab19;if(_[_0x9c80('0x75')](_0x16f2ca[_0x9c80('0x59')]['body'])||_0x16f2ca['body'][_0x9c80('0x59')]===''){throw new db[(_0x9c80('0x6f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9c80('0x75')](_0x16f2ca[_0x9c80('0x59')]['to'])){}_0x385b7c=_0x16f2ca[_0x9c80('0x59')]['to'];return db[_0x9c80('0x4e')][_0x9c80('0x64')]({'where':{'id':_0x16f2ca[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x482c8b,null))[_0x9c80('0x1c')](function(_0x468ffb){if(_0x468ffb){return db['OpenchannelAccount'][_0x9c80('0x5d')]({'where':{'id':_0x468ffb['id']},'include':[{'model':db['CmList'],'as':_0x9c80('0x7b'),'include':[{'model':db[_0x9c80('0x6e')],'as':_0x9c80('0x7c'),'where':{[_0x468ffb[_0x9c80('0x79')]]:_0x385b7c},'limit':0x1,'order':[[_0x9c80('0x73'),_0x9c80('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x482c8b,null))['then'](function(_0x2c3f74){if(_0x2c3f74&&_0x2c3f74[_0x9c80('0x7b')]){_0x3230c4=_0x2c3f74[_0x9c80('0x33')]({'plain':!![]});if(_0x3230c4[_0x9c80('0x7b')]&&_0x3230c4[_0x9c80('0x7b')][_0x9c80('0x7c')]['length']){return _0x3230c4[_0x9c80('0x7b')][_0x9c80('0x7c')][0x0];}return db['CmContact'][_0x9c80('0x58')](_[_0x9c80('0x85')](_0x16f2ca[_0x9c80('0x59')],{'firstName':_0x385b7c,[_0x2c3f74['mapKey']]:_0x385b7c,'phone':_0x385b7c,'ListId':_0x3230c4[_0x9c80('0x86')]}));}})[_0x9c80('0x1c')](handleEntityNotFound(_0x482c8b,null))[_0x9c80('0x1c')](function(_0x30d1c8){if(_0x30d1c8){_0x13ab19=_0x30d1c8;return db[_0x9c80('0x8c')][_0x9c80('0x5d')]({'where':{'ContactId':_0x13ab19['id'],'closed':![],'OpenchannelAccountId':_0x3230c4['id']}})[_0x9c80('0x1c')](function(_0x253aff){if(_0x253aff){return[_0x253aff,![]];}return db[_0x9c80('0x8c')][_0x9c80('0x58')]({'UserId':_0x16f2ca[_0x9c80('0x5a')]['id'],'ContactId':_0x13ab19['id'],'OpenchannelAccountId':_0x3230c4['id'],'lastMsgDirection':_0x9c80('0xb9'),'Messages':[_[_0x9c80('0x4d')](_0x16f2ca[_0x9c80('0x59')],{'read':![],'body':_0x16f2ca[_0x9c80('0x59')][_0x9c80('0x59')],'OpenchannelAccountId':_0x3230c4['id'],'UserId':_0x16f2ca['user']['id'],'ContactId':_0x13ab19['id']})]},{'include':[{'model':db[_0x9c80('0xba')],'as':_0x9c80('0xbb')}]})[_0x9c80('0x1c')](function(_0x387535){return[_0x387535,!![]];});});}})[_0x9c80('0x8e')](function(_0x5545b5,_0x507f33){if(_0x507f33){return _0x5545b5;}return db['OpenchannelMessage']['create'](_['merge'](_0x16f2ca['body'],{'read':![],'body':_0x16f2ca[_0x9c80('0x59')][_0x9c80('0x59')],'OpenchannelAccountId':_0x3230c4['id'],'OpenchannelInteractionId':_0x5545b5['id'],'UserId':_0x16f2ca['user']['id'],'ContactId':_0x13ab19['id']}))['then'](function(_0x534181){_0x5545b5[_0x9c80('0xbc')][_0x9c80('0xbb')]=[];_0x5545b5[_0x9c80('0xbc')][_0x9c80('0xbb')][_0x9c80('0x93')](_0x534181[_0x9c80('0xbc')]);return _0x5545b5;});});}})[_0x9c80('0x1c')](respondWithResult(_0x482c8b,null))[_0x9c80('0x25')](handleError(_0x482c8b,null));}; \ No newline at end of file +var _0xd182=['removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','OpenchannelApplication','Applications','List','account','applications','orderBy','priority','Contacts','length','contact','lastName','threadId','OpenchannelInteraction','externalUrl','firstName','messageId','update','interaction','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','addApplications','sequelize','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','fields','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','pick','removeDispositions','ids','findOne','CannedAnswer'];(function(_0x138d2c,_0x2abba6){var _0xacae0d=function(_0x4fcfd2){while(--_0x4fcfd2){_0x138d2c['push'](_0x138d2c['shift']());}};_0xacae0d(++_0x2abba6);}(_0xd182,0x106));var _0x2d18=function(_0x48cb86,_0x3f4c4a){_0x48cb86=_0x48cb86-0x0;var _0x42234e=_0xd182[_0x48cb86];return _0x42234e;};'use strict';var emlformat=require(_0x2d18('0x0'));var rimraf=require(_0x2d18('0x1'));var zipdir=require(_0x2d18('0x2'));var jsonpatch=require(_0x2d18('0x3'));var rp=require(_0x2d18('0x4'));var moment=require('moment');var BPromise=require(_0x2d18('0x5'));var Mustache=require(_0x2d18('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2d18('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d18('0x8'));var _=require(_0x2d18('0x9'));var squel=require(_0x2d18('0xa'));var crypto=require(_0x2d18('0xb'));var jsforce=require(_0x2d18('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2d18('0x7'));var querystring=require(_0x2d18('0xd'));var Papa=require(_0x2d18('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2d18('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d18('0x10'));var logger=require(_0x2d18('0x11'))(_0x2d18('0x12'));var utils=require('../../config/utils');var config=require(_0x2d18('0x13'));var licenseUtil=require(_0x2d18('0x14'));var db=require(_0x2d18('0x15'))['db'];config['redis']=_[_0x2d18('0x16')](config['redis'],{'host':_0x2d18('0x17'),'port':0x18eb});var socket=require(_0x2d18('0x18'))(new Redis(config[_0x2d18('0x19')]));require(_0x2d18('0x1a'))[_0x2d18('0x1b')](socket);var jayson=require(_0x2d18('0x1c'));var client=jayson['client'][_0x2d18('0x1d')]({'port':0x232c});var client9002=jayson[_0x2d18('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x672d0b,_0x4dbef2,_0xfa60ac,_0xab46a0){return new BPromise(function(_0x244294,_0x4c7f62){var _0x2fccff=_0xab46a0||client;return _0x2fccff[_0x2d18('0x1f')](_0x672d0b,_0xfa60ac)[_0x2d18('0x20')](function(_0x135d5e){logger[_0x2d18('0x21')](_0x2d18('0x22'),_0x4dbef2,_0x2d18('0x23'));logger[_0x2d18('0x24')](_0x2d18('0x25'),_0x4dbef2,_0x2d18('0x23'),JSON['stringify'](_0x135d5e));if(_0x135d5e[_0x2d18('0x26')]){if(_0x135d5e['error'][_0x2d18('0x27')]===0x1f4){logger['error'](_0x2d18('0x22'),_0x4dbef2,_0x135d5e[_0x2d18('0x26')][_0x2d18('0x28')]);return _0x4c7f62(_0x135d5e[_0x2d18('0x26')][_0x2d18('0x28')]);}logger[_0x2d18('0x26')](_0x2d18('0x22'),_0x4dbef2,_0x135d5e[_0x2d18('0x26')][_0x2d18('0x28')]);return _0x244294(_0x135d5e[_0x2d18('0x26')][_0x2d18('0x28')]);}else{logger[_0x2d18('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x4dbef2,_0x2d18('0x23'));_0x244294(_0x135d5e[_0x2d18('0x29')][_0x2d18('0x28')]);}})['catch'](function(_0x296e30){logger[_0x2d18('0x26')](_0x2d18('0x22'),_0x4dbef2,_0x296e30);_0x4c7f62(_0x296e30);});});}function respondWithStatusCode(_0x3a268d,_0x1ca5f3){_0x1ca5f3=_0x1ca5f3||0xcc;return function(_0x51868c){if(_0x51868c){return _0x3a268d[_0x2d18('0x2a')](_0x1ca5f3);}return _0x3a268d[_0x2d18('0x2b')](_0x1ca5f3)[_0x2d18('0x2c')]();};}function respondWithResult(_0x552e21,_0x47b09f){_0x47b09f=_0x47b09f||0xc8;return function(_0x4883a0){if(_0x4883a0){return _0x552e21[_0x2d18('0x2b')](_0x47b09f)[_0x2d18('0x2d')](_0x4883a0);}};}function respondWithFilteredResult(_0x43f6b7,_0x237f2){return function(_0x54f783){if(_0x54f783){var _0x4d19e9=typeof _0x237f2[_0x2d18('0x2e')]==='undefined'&&typeof _0x237f2['limit']===_0x2d18('0x2f');var _0x412ce3=_0x54f783[_0x2d18('0x30')];var _0x36496e=_0x4d19e9?0x0:_0x237f2[_0x2d18('0x2e')];var _0x24a058=_0x4d19e9?_0x54f783[_0x2d18('0x30')]:_0x237f2[_0x2d18('0x2e')]+_0x237f2[_0x2d18('0x31')];var _0x3e54d6;if(_0x24a058>=_0x412ce3){_0x24a058=_0x412ce3;_0x3e54d6=0xc8;}else{_0x3e54d6=0xce;}_0x43f6b7[_0x2d18('0x2b')](_0x3e54d6);return _0x43f6b7[_0x2d18('0x32')](_0x2d18('0x33'),_0x36496e+'-'+_0x24a058+'/'+_0x412ce3)[_0x2d18('0x2d')](_0x54f783);}return null;};}function patchUpdates(_0x4cccbb){return function(_0x22a94b){try{jsonpatch[_0x2d18('0x34')](_0x22a94b,_0x4cccbb,!![]);}catch(_0x2fb909){return BPromise[_0x2d18('0x35')](_0x2fb909);}return _0x22a94b[_0x2d18('0x36')]();};}function saveUpdates(_0x54d907,_0x2bc849){return function(_0x5a5209){if(_0x5a5209){return _0x5a5209['update'](_0x54d907)[_0x2d18('0x20')](function(_0x4efcb3){return _0x4efcb3;});}return null;};}function removeEntity(_0x240762,_0x43a1e3){return function(_0x46dbe9){if(_0x46dbe9){return _0x46dbe9[_0x2d18('0x37')]()[_0x2d18('0x20')](function(){var _0x19c6a4=_0x46dbe9['get']({'plain':!![]});var _0x5d2a5a='OpenchannelAccounts';return db[_0x2d18('0x38')]['destroy']({'where':{'type':_0x5d2a5a,'resourceId':_0x19c6a4['id']}})[_0x2d18('0x20')](function(){return _0x46dbe9;});})['then'](function(){_0x240762[_0x2d18('0x2b')](0xcc)[_0x2d18('0x2c')]();});}};}function handleEntityNotFound(_0x5e8946,_0x48821e){return function(_0x241561){if(!_0x241561){_0x5e8946[_0x2d18('0x2a')](0x194);}return _0x241561;};}function handleError(_0x51103a,_0x286c7a){_0x286c7a=_0x286c7a||0x1f4;return function(_0x52f4c7){logger[_0x2d18('0x26')](_0x52f4c7[_0x2d18('0x39')]);if(_0x52f4c7[_0x2d18('0x3a')]){delete _0x52f4c7[_0x2d18('0x3a')];}_0x51103a[_0x2d18('0x2b')](_0x286c7a)[_0x2d18('0x3b')](_0x52f4c7);};}exports['index']=function(_0xd91b3a,_0x1c44d2){var _0x4d48a1={'include':[{'model':db[_0x2d18('0x3c')],'as':_0x2d18('0x3d')}]},_0xee9dc0={},_0x40ed6d={'count':0x0,'rows':[]};var _0x34cedf=_[_0x2d18('0x3e')](db[_0x2d18('0x3f')][_0x2d18('0x40')],function(_0x4c2160){return{'name':_0x4c2160[_0x2d18('0x41')],'type':_0x4c2160[_0x2d18('0x42')][_0x2d18('0x43')]};});_0xee9dc0[_0x2d18('0x44')]=_[_0x2d18('0x3e')](_0x34cedf,_0x2d18('0x3a'));_0xee9dc0[_0x2d18('0x45')]=_[_0x2d18('0x46')](_0xd91b3a[_0x2d18('0x45')]);_0xee9dc0[_0x2d18('0x47')]=_[_0x2d18('0x48')](_0xee9dc0[_0x2d18('0x44')],_0xee9dc0[_0x2d18('0x45')]);_0x4d48a1[_0x2d18('0x49')]=_[_0x2d18('0x48')](_0xee9dc0[_0x2d18('0x44')],qs['fields'](_0xd91b3a['query']['fields']));_0x4d48a1[_0x2d18('0x49')]=_0x4d48a1[_0x2d18('0x49')]['length']?_0x4d48a1[_0x2d18('0x49')]:_0xee9dc0['model'];if(!_0xd91b3a[_0x2d18('0x45')][_0x2d18('0x4a')](_0x2d18('0x4b'))){_0x4d48a1[_0x2d18('0x31')]=qs[_0x2d18('0x31')](_0xd91b3a['query'][_0x2d18('0x31')]);_0x4d48a1['offset']=qs[_0x2d18('0x2e')](_0xd91b3a[_0x2d18('0x45')][_0x2d18('0x2e')]);}_0x4d48a1[_0x2d18('0x4c')]=qs['sort'](_0xd91b3a[_0x2d18('0x45')][_0x2d18('0x4d')]);_0x4d48a1[_0x2d18('0x4e')]=qs['filters'](_['pick'](_0xd91b3a[_0x2d18('0x45')],_0xee9dc0[_0x2d18('0x47')]),_0x34cedf);if(_0xd91b3a['query'][_0x2d18('0x4f')]){_0x4d48a1[_0x2d18('0x4e')]=_[_0x2d18('0x50')](_0x4d48a1[_0x2d18('0x4e')],{'$or':_[_0x2d18('0x3e')](_0x34cedf,function(_0x36704c){if(_0x36704c['type']!==_0x2d18('0x51')){var _0x16c1e0={};_0x16c1e0[_0x36704c[_0x2d18('0x3a')]]={'$like':'%'+_0xd91b3a['query']['filter']+'%'};return _0x16c1e0;}})});}_0x4d48a1=_['merge']({},_0x4d48a1,_0xd91b3a[_0x2d18('0x52')]);var _0x3b603c={'where':_0x4d48a1['where']};return db[_0x2d18('0x3f')][_0x2d18('0x30')](_0x3b603c)[_0x2d18('0x20')](function(_0x3c2399){_0x40ed6d['count']=_0x3c2399;if(_0xd91b3a['query']['includeAll']){_0x4d48a1[_0x2d18('0x53')]=[{'all':!![]}];}return db[_0x2d18('0x3f')][_0x2d18('0x54')](_0x4d48a1);})[_0x2d18('0x20')](function(_0x15cfc1){_0x40ed6d[_0x2d18('0x55')]=_0x15cfc1;return _0x40ed6d;})[_0x2d18('0x20')](respondWithFilteredResult(_0x1c44d2,_0x4d48a1))[_0x2d18('0x56')](handleError(_0x1c44d2,null));};exports[_0x2d18('0x57')]=function(_0x1b00f9,_0x4a836b){var _0x499b65={'raw':![],'where':{'id':_0x1b00f9[_0x2d18('0x58')]['id']},'include':[{'model':db[_0x2d18('0x3c')],'as':_0x2d18('0x3d')}]},_0x299a4a={};_0x299a4a[_0x2d18('0x44')]=_[_0x2d18('0x46')](db[_0x2d18('0x3f')][_0x2d18('0x40')]);_0x299a4a[_0x2d18('0x45')]=_[_0x2d18('0x46')](_0x1b00f9['query']);_0x299a4a[_0x2d18('0x47')]=_[_0x2d18('0x48')](_0x299a4a[_0x2d18('0x44')],_0x299a4a[_0x2d18('0x45')]);_0x499b65[_0x2d18('0x49')]=_['intersection'](_0x299a4a['model'],qs[_0x2d18('0x59')](_0x1b00f9[_0x2d18('0x45')][_0x2d18('0x59')]));_0x499b65['attributes']=_0x499b65[_0x2d18('0x49')]['length']?_0x499b65[_0x2d18('0x49')]:_0x299a4a['model'];if(_0x1b00f9[_0x2d18('0x45')][_0x2d18('0x5a')]){_0x499b65['include']=[{'all':!![]}];}_0x499b65=_[_0x2d18('0x50')]({},_0x499b65,_0x1b00f9[_0x2d18('0x52')]);return db[_0x2d18('0x3f')][_0x2d18('0x5b')](_0x499b65)[_0x2d18('0x20')](handleEntityNotFound(_0x4a836b,null))[_0x2d18('0x20')](respondWithResult(_0x4a836b,null))[_0x2d18('0x56')](handleError(_0x4a836b,null));};exports[_0x2d18('0x5c')]=function(_0x1c6335,_0x3cf54b){return db['OpenchannelAccount'][_0x2d18('0x5c')](_0x1c6335[_0x2d18('0x5d')],{})['then'](function(_0x443995){var _0x23f572=_0x1c6335['user'][_0x2d18('0x5e')]({'plain':!![]});if(!_0x23f572)throw new Error(_0x2d18('0x5f'));if(_0x23f572[_0x2d18('0x60')]===_0x2d18('0x61')){var _0x2bc540=_0x443995['get']({'plain':!![]});var _0x58dcf0='OpenchannelAccounts';return db['UserProfileSection'][_0x2d18('0x5b')]({'where':{'name':_0x58dcf0,'userProfileId':_0x23f572['userProfileId']},'raw':!![]})[_0x2d18('0x20')](function(_0x2ffc8c){if(_0x2ffc8c&&_0x2ffc8c['autoAssociation']===0x0){return db[_0x2d18('0x38')][_0x2d18('0x5c')]({'name':_0x2bc540[_0x2d18('0x3a')],'resourceId':_0x2bc540['id'],'type':_0x2ffc8c['name'],'sectionId':_0x2ffc8c['id']},{})[_0x2d18('0x20')](function(){return _0x443995;});}else{return _0x443995;}})['catch'](function(_0x2c994a){logger[_0x2d18('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c994a);throw _0x2c994a;});}return _0x443995;})[_0x2d18('0x20')](respondWithResult(_0x3cf54b,0xc9))['catch'](handleError(_0x3cf54b,null));};exports['update']=function(_0x48b9b3,_0x383ec7){if(_0x48b9b3[_0x2d18('0x5d')]['id']){delete _0x48b9b3['body']['id'];}return db[_0x2d18('0x3f')]['find']({'where':{'id':_0x48b9b3[_0x2d18('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x2d18('0x3d')}]})['then'](handleEntityNotFound(_0x383ec7,null))[_0x2d18('0x20')](saveUpdates(_0x48b9b3[_0x2d18('0x5d')],null))[_0x2d18('0x20')](respondWithResult(_0x383ec7,null))[_0x2d18('0x56')](handleError(_0x383ec7,null));};exports['destroy']=function(_0xb417e5,_0x12794f){return db[_0x2d18('0x3f')][_0x2d18('0x5b')]({'where':{'id':_0xb417e5['params']['id']}})[_0x2d18('0x20')](handleEntityNotFound(_0x12794f,null))['then'](removeEntity(_0x12794f,null))[_0x2d18('0x56')](handleError(_0x12794f,null));};exports[_0x2d18('0x62')]=function(_0x164e55,_0x2479f9){return db[_0x2d18('0x3f')]['describe']()[_0x2d18('0x20')](respondWithResult(_0x2479f9,null))[_0x2d18('0x56')](handleError(_0x2479f9,null));};exports[_0x2d18('0x63')]=function(_0x36aa56,_0xfe9f91,_0x52fe72){if(_0x36aa56[_0x2d18('0x5d')]['id']){delete _0x36aa56['body']['id'];}return db[_0x2d18('0x3f')][_0x2d18('0x5b')]({'where':{'id':_0x36aa56['params']['id']}})['then'](handleEntityNotFound(_0xfe9f91,null))[_0x2d18('0x20')](function(_0x3f2799){if(_0x3f2799){_0x36aa56[_0x2d18('0x5d')][_0x2d18('0x64')]=_0x3f2799['id'];return db[_0x2d18('0x65')]['create'](_0x36aa56[_0x2d18('0x5d')]);}})['then'](respondWithResult(_0xfe9f91,null))['catch'](handleError(_0xfe9f91,null));};exports[_0x2d18('0x66')]=function(_0x3b65f9,_0x2dc2ef,_0x1a02d7){var _0x2309af={'raw':![],'where':{}};var _0x2baf78={};var _0xe7c27e={'count':0x0,'rows':[]};return db[_0x2d18('0x3f')]['findOne']({'where':{'id':_0x3b65f9[_0x2d18('0x58')]['id']}})[_0x2d18('0x20')](handleEntityNotFound(_0x2dc2ef,null))[_0x2d18('0x20')](function(_0x4d8d94){if(_0x4d8d94){_0x2baf78[_0x2d18('0x44')]=_[_0x2d18('0x46')](db[_0x2d18('0x65')][_0x2d18('0x40')]);_0x2baf78[_0x2d18('0x45')]=_[_0x2d18('0x46')](_0x3b65f9[_0x2d18('0x45')]);_0x2baf78[_0x2d18('0x47')]=_['intersection'](_0x2baf78[_0x2d18('0x44')],_0x2baf78[_0x2d18('0x45')]);_0x2309af[_0x2d18('0x49')]=_[_0x2d18('0x48')](_0x2baf78[_0x2d18('0x44')],qs[_0x2d18('0x59')](_0x3b65f9['query'][_0x2d18('0x59')]));_0x2309af['attributes']=_0x2309af[_0x2d18('0x49')]['length']?_0x2309af[_0x2d18('0x49')]:_0x2baf78[_0x2d18('0x44')];if(!_0x3b65f9[_0x2d18('0x45')]['hasOwnProperty']('nolimit')){_0x2309af[_0x2d18('0x31')]=qs[_0x2d18('0x31')](_0x3b65f9[_0x2d18('0x45')][_0x2d18('0x31')]);_0x2309af[_0x2d18('0x2e')]=qs[_0x2d18('0x2e')](_0x3b65f9[_0x2d18('0x45')][_0x2d18('0x2e')]);}_0x2309af[_0x2d18('0x4c')]=qs[_0x2d18('0x4d')](_0x3b65f9[_0x2d18('0x45')]['sort']);_0x2309af['where']=qs[_0x2d18('0x47')](_[_0x2d18('0x67')](_0x3b65f9['query'],_0x2baf78[_0x2d18('0x47')]));_0x2309af['where'][_0x2d18('0x64')]=_0x4d8d94['id'];if(_0x3b65f9['query'][_0x2d18('0x4f')]){_0x2309af[_0x2d18('0x4e')]=_['merge'](_0x2309af[_0x2d18('0x4e')],{'$or':_[_0x2d18('0x3e')](_0x2309af[_0x2d18('0x49')],function(_0x4367d6){var _0x5c5064={};_0x5c5064[_0x4367d6]={'$like':'%'+_0x3b65f9[_0x2d18('0x45')]['filter']+'%'};return _0x5c5064;})});}_0x2309af=_['merge']({},_0x2309af,_0x3b65f9['options']);return db[_0x2d18('0x65')][_0x2d18('0x30')]({'where':_0x2309af[_0x2d18('0x4e')]})['then'](function(_0x53e791){_0xe7c27e[_0x2d18('0x30')]=_0x53e791;if(_0x3b65f9['query'][_0x2d18('0x5a')]){_0x2309af['include']=[{'all':!![]}];}return db[_0x2d18('0x65')]['findAll'](_0x2309af);})[_0x2d18('0x20')](function(_0x954a21){_0xe7c27e[_0x2d18('0x55')]=_0x954a21;return _0xe7c27e;});}})[_0x2d18('0x20')](respondWithFilteredResult(_0x2dc2ef,_0x2309af))['catch'](handleError(_0x2dc2ef,null));};exports[_0x2d18('0x68')]=function(_0x293d3a,_0x42b392,_0x2e7200){return db[_0x2d18('0x3f')][_0x2d18('0x5b')]({'where':{'id':_0x293d3a[_0x2d18('0x58')]['id']}})[_0x2d18('0x20')](handleEntityNotFound(_0x42b392,null))[_0x2d18('0x20')](function(_0x3fe184){if(_0x3fe184){return _0x3fe184[_0x2d18('0x68')](_0x293d3a[_0x2d18('0x45')][_0x2d18('0x69')]);}})[_0x2d18('0x20')](respondWithStatusCode(_0x42b392,null))['catch'](handleError(_0x42b392,null));};exports['addAnswer']=function(_0x4ed4c9,_0x4eccbb,_0x1b49de){if(_0x4ed4c9[_0x2d18('0x5d')]['id']){delete _0x4ed4c9[_0x2d18('0x5d')]['id'];}return db[_0x2d18('0x3f')][_0x2d18('0x5b')]({'where':{'id':_0x4ed4c9[_0x2d18('0x58')]['id']}})[_0x2d18('0x20')](handleEntityNotFound(_0x4eccbb,null))['then'](function(_0x4a1fdf){if(_0x4a1fdf){_0x4ed4c9['body'][_0x2d18('0x64')]=_0x4a1fdf['id'];return db['CannedAnswer'][_0x2d18('0x5c')](_0x4ed4c9['body']);}})[_0x2d18('0x20')](respondWithResult(_0x4eccbb,null))['catch'](handleError(_0x4eccbb,null));};exports['getAnswers']=function(_0x15f4fe,_0x5c8ff2,_0x2e9438){var _0x53dfe5={'raw':![],'where':{}};var _0x83702f={};var _0x28cd97={'count':0x0,'rows':[]};return db[_0x2d18('0x3f')][_0x2d18('0x6a')]({'where':{'id':_0x15f4fe[_0x2d18('0x58')]['id']}})[_0x2d18('0x20')](handleEntityNotFound(_0x5c8ff2,null))[_0x2d18('0x20')](function(_0x26a8d2){if(_0x26a8d2){_0x83702f[_0x2d18('0x44')]=_[_0x2d18('0x46')](db[_0x2d18('0x6b')][_0x2d18('0x40')]);_0x83702f[_0x2d18('0x45')]=_[_0x2d18('0x46')](_0x15f4fe['query']);_0x83702f[_0x2d18('0x47')]=_[_0x2d18('0x48')](_0x83702f[_0x2d18('0x44')],_0x83702f['query']);_0x53dfe5[_0x2d18('0x49')]=_[_0x2d18('0x48')](_0x83702f['model'],qs['fields'](_0x15f4fe[_0x2d18('0x45')][_0x2d18('0x59')]));_0x53dfe5[_0x2d18('0x49')]=_0x53dfe5[_0x2d18('0x49')]['length']?_0x53dfe5['attributes']:_0x83702f[_0x2d18('0x44')];if(!_0x15f4fe[_0x2d18('0x45')][_0x2d18('0x4a')]('nolimit')){_0x53dfe5[_0x2d18('0x31')]=qs[_0x2d18('0x31')](_0x15f4fe[_0x2d18('0x45')]['limit']);_0x53dfe5['offset']=qs['offset'](_0x15f4fe['query'][_0x2d18('0x2e')]);}_0x53dfe5[_0x2d18('0x4c')]=qs['sort'](_0x15f4fe[_0x2d18('0x45')][_0x2d18('0x4d')]);_0x53dfe5[_0x2d18('0x4e')]=qs[_0x2d18('0x47')](_[_0x2d18('0x67')](_0x15f4fe['query'],_0x83702f[_0x2d18('0x47')]));_0x53dfe5[_0x2d18('0x4e')][_0x2d18('0x64')]=_0x26a8d2['id'];if(_0x15f4fe[_0x2d18('0x45')][_0x2d18('0x4f')]){_0x53dfe5['where']=_[_0x2d18('0x50')](_0x53dfe5['where'],{'$or':_[_0x2d18('0x3e')](_0x53dfe5[_0x2d18('0x49')],function(_0x34877c){var _0x35934b={};_0x35934b[_0x34877c]={'$like':'%'+_0x15f4fe['query'][_0x2d18('0x4f')]+'%'};return _0x35934b;})});}_0x53dfe5=_[_0x2d18('0x50')]({},_0x53dfe5,_0x15f4fe[_0x2d18('0x52')]);return db['CannedAnswer'][_0x2d18('0x30')]({'where':_0x53dfe5['where']})['then'](function(_0x4cb845){_0x28cd97[_0x2d18('0x30')]=_0x4cb845;if(_0x15f4fe['query'][_0x2d18('0x5a')]){_0x53dfe5[_0x2d18('0x53')]=[{'all':!![]}];}return db[_0x2d18('0x6b')]['findAll'](_0x53dfe5);})[_0x2d18('0x20')](function(_0x3f511d){_0x28cd97[_0x2d18('0x55')]=_0x3f511d;return _0x28cd97;});}})[_0x2d18('0x20')](respondWithFilteredResult(_0x5c8ff2,_0x53dfe5))[_0x2d18('0x56')](handleError(_0x5c8ff2,null));};exports['removeAnswers']=function(_0x2631c1,_0x4aec86,_0x39ab07){return db[_0x2d18('0x3f')]['find']({'where':{'id':_0x2631c1[_0x2d18('0x58')]['id']}})[_0x2d18('0x20')](handleEntityNotFound(_0x4aec86,null))[_0x2d18('0x20')](function(_0x25f6c6){if(_0x25f6c6){return _0x25f6c6[_0x2d18('0x6c')](_0x2631c1['query'][_0x2d18('0x69')]);}})['then'](respondWithStatusCode(_0x4aec86,null))['catch'](handleError(_0x4aec86,null));};exports[_0x2d18('0x6d')]=function(_0x11d686,_0x30d162,_0x3ffebc){var _0x48eb25={'body':_0x11d686['body'],'channel':'openchannel'};var _0x59ef44=[];var _0x33044a=[];var _0x36a2e0={};var _0x1112e8=![];return db[_0x2d18('0x6e')]['describe']()[_0x2d18('0x20')](function(_0x2c7c94){if(!_0x2c7c94){throw new db[(_0x2d18('0x6f'))]['ValidationError'](_0x2d18('0x70'));}_0x59ef44=_[_0x2d18('0x71')](_[_0x2d18('0x46')](_0x2c7c94),[_0x2d18('0x72'),_0x2d18('0x73')]);_0x33044a=_[_0x2d18('0x71')](_[_0x2d18('0x46')](_0x2c7c94),['createdAt',_0x2d18('0x73'),_0x2d18('0x74'),_0x2d18('0x75')]);if(_0x11d686[_0x2d18('0x5d')]['id']){delete _0x11d686[_0x2d18('0x5d')]['id'];}if(_[_0x2d18('0x76')](_0x11d686[_0x2d18('0x5d')][_0x2d18('0x77')])){throw new db[(_0x2d18('0x6f'))][(_0x2d18('0x78'))](_0x2d18('0x79'));}if(_[_0x2d18('0x76')](_0x11d686[_0x2d18('0x5d')][_0x2d18('0x5d')])||_0x11d686[_0x2d18('0x5d')][_0x2d18('0x5d')]===''){throw new db['Sequelize'][(_0x2d18('0x78'))](_0x2d18('0x7a'));}if(_[_0x2d18('0x76')](_0x11d686[_0x2d18('0x5d')][_0x2d18('0x7b')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33044a);}if(!_['includes'](_0x33044a,_0x11d686[_0x2d18('0x5d')][_0x2d18('0x7b')])){throw new db[(_0x2d18('0x6f'))][(_0x2d18('0x78'))](_0x2d18('0x7c')+_0x33044a);}_0x36a2e0[_0x11d686[_0x2d18('0x5d')][_0x2d18('0x7b')]]=_0x11d686[_0x2d18('0x5d')][_0x2d18('0x77')];})[_0x2d18('0x20')](function(){return db['OpenchannelAccount'][_0x2d18('0x5b')]({'where':{'id':_0x11d686['params']['id']},'include':[{'model':db[_0x2d18('0x7d')],'as':'List','include':[{'model':db[_0x2d18('0x6e')],'as':'Contacts','where':_0x36a2e0,'limit':0x1,'order':[[_0x2d18('0x73'),_0x2d18('0x7e')]]}]},{'model':db[_0x2d18('0x7f')],'as':_0x2d18('0x80')}]});})['then'](handleEntityNotFound(_0x30d162,null))[_0x2d18('0x20')](function(_0x35e99f){if(_0x35e99f&&_0x35e99f[_0x2d18('0x81')]){_0x48eb25[_0x2d18('0x82')]=_0x35e99f;_0x48eb25[_0x2d18('0x83')]=_0x35e99f[_0x2d18('0x80')];_0x48eb25['list']=_0x35e99f[_0x2d18('0x81')];_0x48eb25[_0x2d18('0x83')]=_[_0x2d18('0x84')](_0x48eb25[_0x2d18('0x83')],[_0x2d18('0x85')],['asc']);if(_0x48eb25[_0x2d18('0x82')][_0x2d18('0x80')]){delete _0x48eb25[_0x2d18('0x82')][_0x2d18('0x80')];}if(_0x48eb25['account'][_0x2d18('0x81')]&&_0x48eb25[_0x2d18('0x82')][_0x2d18('0x81')][_0x2d18('0x86')][_0x2d18('0x87')]){return _0x48eb25[_0x2d18('0x82')]['List'][_0x2d18('0x86')][0x0];}var _0x341a66=_[_0x2d18('0x16')](_0x11d686[_0x2d18('0x5d')],{'firstName':_0x11d686[_0x2d18('0x5d')][_0x2d18('0x77')],'ListId':_0x35e99f[_0x2d18('0x75')]});_0x341a66[_0x11d686['body'][_0x2d18('0x7b')]]=_0x11d686[_0x2d18('0x5d')][_0x2d18('0x77')];return db['CmContact'][_0x2d18('0x5c')](_0x341a66,{'fields':_0x59ef44,'raw':!![]});}})[_0x2d18('0x20')](handleEntityNotFound(_0x30d162,null))['then'](function(_0x5a0468){_0x48eb25[_0x2d18('0x88')]=_0x5a0468;if(_0x5a0468){var _0x53cd70={'ContactId':_0x5a0468['id'],'OpenchannelAccountId':_0x11d686[_0x2d18('0x58')]['id'],'from':(_0x5a0468['firstName']||'')+'\x20'+(_0x5a0468[_0x2d18('0x89')]||'')};var _0x4d557a={'OpenchannelAccountId':_0x11d686[_0x2d18('0x58')]['id'],'closed':![]};if(_0x11d686[_0x2d18('0x5d')][_0x2d18('0x8a')]){_0x4d557a[_0x2d18('0x8a')]=_0x11d686[_0x2d18('0x5d')]['threadId'];return db[_0x2d18('0x8b')][_0x2d18('0x5b')]({'where':_0x4d557a})[_0x2d18('0x20')](function(_0x2ca0b9){if(_0x2ca0b9){return[_0x2ca0b9,![]];}_0x53cd70[_0x2d18('0x8a')]=_0x11d686[_0x2d18('0x5d')][_0x2d18('0x8a')];_0x53cd70[_0x2d18('0x8c')]=_0x11d686[_0x2d18('0x5d')][_0x2d18('0x8c')];return db['OpenchannelInteraction'][_0x2d18('0x5c')](_0x53cd70)[_0x2d18('0x20')](function(_0xadf4cb){return[_0xadf4cb,!![]];});});}else{_0x4d557a['threadId']=null;}_0x4d557a['ContactId']=_0x5a0468['id'];return db[_0x2d18('0x8b')]['find']({'where':_0x4d557a})[_0x2d18('0x20')](function(_0x168455){if(_0x168455){return[_0x168455,![]];}return db['OpenchannelInteraction'][_0x2d18('0x5c')](_0x53cd70)[_0x2d18('0x20')](function(_0x4413ac){return[_0x4413ac,!![]];});});}})['spread'](function(_0x3e11da,_0x42db56){if(_0x3e11da){_0x1112e8=_0x42db56;if(!_0x42db56){var _0xfe7ac3={'from':(_0x48eb25[_0x2d18('0x88')][_0x2d18('0x8d')]||'')+'\x20'+(_0x48eb25[_0x2d18('0x88')][_0x2d18('0x89')]||'')};if(_0x11d686[_0x2d18('0x5d')][_0x2d18('0x8a')]&&_0x11d686[_0x2d18('0x5d')]['messageId']&&_0x11d686['body'][_0x2d18('0x8a')]!=_0x11d686['body'][_0x2d18('0x8e')]){_0xfe7ac3[_0x2d18('0x8a')]=_0x11d686[_0x2d18('0x5d')][_0x2d18('0x8e')];}return _0x3e11da[_0x2d18('0x8f')](_0xfe7ac3);}else{return _0x3e11da;}}})[_0x2d18('0x20')](function(_0x38b4d5){_0x48eb25[_0x2d18('0x90')]=_0x38b4d5[_0x2d18('0x5e')]({'plain':!![]});_0x48eb25['interaction'][_0x2d18('0x91')]=_0x1112e8;if(_0x48eb25[_0x2d18('0x90')][_0x2d18('0x91')]){if(_0x48eb25['account'][_0x2d18('0x92')]){_0x48eb25[_0x2d18('0x83')][_0x2d18('0x93')]({'id':0x0,'priority':_0x48eb25[_0x2d18('0x83')][_0x2d18('0x87')]+0x1,'app':'close','appdata':_0x2d18('0x94'),'interval':_0x2d18('0x95')});}}return db['OpenchannelMessage'][_0x2d18('0x5c')]({'body':_0x11d686[_0x2d18('0x5d')][_0x2d18('0x5d')],'OpenchannelAccountId':_0x11d686[_0x2d18('0x58')]['id'],'OpenchannelInteractionId':_0x38b4d5['id'],'direction':'in','ContactId':_0x48eb25[_0x2d18('0x88')]['id'],'AttachmentId':_0x11d686[_0x2d18('0x5d')][_0x2d18('0x96')]});})[_0x2d18('0x20')](function(_0x22208d){_0x48eb25['message']=_0x22208d;if(_0x48eb25[_0x2d18('0x90')][_0x2d18('0x97')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x48eb25[_0x2d18('0x90')][_0x2d18('0x97')]}})[_0x2d18('0x20')](function(_0x33a6c8){if(_0x33a6c8){_0x48eb25[_0x2d18('0x83')][_0x2d18('0x98')]({'id':0x0,'priority':0x0,'app':_0x2d18('0x99'),'appdata':_0x33a6c8[_0x2d18('0x3a')]+','+(_0x48eb25[_0x2d18('0x82')][_0x2d18('0x9a')]||0xa),'interval':'*,*,*,*'});_0x48eb25[_0x2d18('0x9b')]=![];}return respondWithRpcPromise('Start',_0x2d18('0x9c'),_0x48eb25);});}return respondWithRpcPromise('Start',_0x2d18('0x9c'),_0x48eb25);})[_0x2d18('0x20')](function(_0x3f9f3a){respondWithRpcPromise(_0x2d18('0x9d'),_0x2d18('0x9d'),{'event':_0x2d18('0x6d'),'message':_0x3f9f3a},client9002);return _0x3f9f3a;})['then'](respondWithResult(_0x30d162,null))[_0x2d18('0x56')](handleError(_0x30d162,null));};exports[_0x2d18('0x9e')]=function(_0x1241ea,_0x192275){var _0xc94aed=_0x1241ea[_0x2d18('0x58')]['id'];var _0x2aaca5=_0x1241ea[_0x2d18('0x5d')];var _0x36e6d1=0xc8;var _0x18b568=null;return db[_0x2d18('0x9f')]['transaction']({'isolationLevel':db[_0x2d18('0x9f')]['Transaction']['ISOLATION_LEVELS'][_0x2d18('0xa0')]},function(_0x59fcad){return db[_0x2d18('0x3f')][_0x2d18('0x6a')]({'where':{'id':_0xc94aed},'transaction':_0x59fcad})[_0x2d18('0x20')](function(_0x53d6ec){if(_0x53d6ec){return db[_0x2d18('0x7f')]['destroy']({'where':{'OpenchannelAccountId':_0xc94aed},'transaction':_0x59fcad})[_0x2d18('0x20')](function(){var _0x359ac3=_[_0x2d18('0x3e')](_0x2aaca5,function(_0x122c61){_0x122c61[_0x2d18('0x64')]=_0xc94aed;return _0x122c61;});return db['OpenchannelApplication'][_0x2d18('0xa1')](_0x359ac3,{'transaction':_0x59fcad});});}else{_0x36e6d1=0x194;_0x18b568=[];}});})[_0x2d18('0x20')](function(){if(_0x36e6d1!==0x194){return db[_0x2d18('0x7f')][_0x2d18('0xa2')]({'where':{'OpenchannelAccountId':_0xc94aed},'order':'priority'})[_0x2d18('0x20')](function(_0x5eb054){_0x18b568=_0x5eb054;});}})[_0x2d18('0x56')](function(_0x180e19){_0x36e6d1=0x1f4;logger[_0x2d18('0x26')](_0x180e19[_0x2d18('0x39')]);if(_0x180e19['name']){delete _0x180e19[_0x2d18('0x3a')];}_0x18b568=_0x180e19;})['finally'](function(){if(_0x18b568===null){_0x192275[_0x2d18('0x2a')](_0x36e6d1);}else{if(_0x36e6d1===0x1f4){_0x192275[_0x2d18('0x2b')](_0x36e6d1)['send'](_0x18b568);}else{_0x192275[_0x2d18('0x2b')](_0x36e6d1)[_0x2d18('0x2d')](_0x18b568);}}});};exports[_0x2d18('0xa3')]=function(_0x4866a5,_0x51c8f8,_0x5ccf97){var _0x5796be={};var _0x51da57={};var _0x435a42;var _0x5208d4;return db[_0x2d18('0x3f')][_0x2d18('0x6a')]({'where':{'id':_0x4866a5['params']['id']}})[_0x2d18('0x20')](handleEntityNotFound(_0x51c8f8,null))[_0x2d18('0x20')](function(_0x8be584){if(_0x8be584){_0x435a42=_0x8be584;_0x51da57[_0x2d18('0x44')]=_[_0x2d18('0x46')](db['OpenchannelApplication'][_0x2d18('0x40')]);_0x51da57[_0x2d18('0x45')]=_['keys'](_0x4866a5['query']);_0x51da57['filters']=_[_0x2d18('0x48')](_0x51da57['model'],_0x51da57[_0x2d18('0x45')]);_0x5796be[_0x2d18('0x49')]=_['intersection'](_0x51da57[_0x2d18('0x44')],qs[_0x2d18('0x59')](_0x4866a5[_0x2d18('0x45')][_0x2d18('0x59')]));_0x5796be[_0x2d18('0x49')]=_0x5796be[_0x2d18('0x49')][_0x2d18('0x87')]?_0x5796be[_0x2d18('0x49')]:_0x51da57[_0x2d18('0x44')];_0x5796be['order']=qs[_0x2d18('0x4d')](_0x4866a5[_0x2d18('0x45')][_0x2d18('0x4d')]);_0x5796be[_0x2d18('0x4e')]=qs[_0x2d18('0x47')](_[_0x2d18('0x67')](_0x4866a5[_0x2d18('0x45')],_0x51da57['filters']));if(_0x4866a5[_0x2d18('0x45')][_0x2d18('0x4f')]){_0x5796be['where']=_[_0x2d18('0x50')](_0x5796be['where'],{'$or':_[_0x2d18('0x3e')](_0x5796be[_0x2d18('0x49')],function(_0x23c777){var _0x1ad97e={};_0x1ad97e[_0x23c777]={'$like':'%'+_0x4866a5['query'][_0x2d18('0x4f')]+'%'};return _0x1ad97e;})});}_0x5796be=_[_0x2d18('0x50')]({},_0x5796be,_0x4866a5[_0x2d18('0x52')]);return _0x435a42[_0x2d18('0xa3')](_0x5796be);}})[_0x2d18('0x20')](function(_0x590ab3){if(_0x590ab3){_0x5208d4=_0x590ab3['length'];if(!_0x4866a5[_0x2d18('0x45')][_0x2d18('0x4a')](_0x2d18('0x4b'))){_0x5796be[_0x2d18('0x31')]=qs[_0x2d18('0x31')](_0x4866a5[_0x2d18('0x45')][_0x2d18('0x31')]);_0x5796be['offset']=qs[_0x2d18('0x2e')](_0x4866a5[_0x2d18('0x45')][_0x2d18('0x2e')]);}return _0x435a42[_0x2d18('0xa3')](_0x5796be);}})[_0x2d18('0x20')](function(_0x39fed6){if(_0x39fed6){return _0x39fed6?{'count':_0x5208d4,'rows':_0x39fed6}:null;}})['then'](respondWithResult(_0x51c8f8,null))[_0x2d18('0x56')](handleError(_0x51c8f8,null));};exports[_0x2d18('0xa4')]=function(_0x4b23f5,_0x4ece66,_0x28d5f9){var _0x5c94e5={'raw':![],'where':{}};var _0x510859={};var _0x2f81da={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2d18('0x6a')]({'where':{'id':_0x4b23f5[_0x2d18('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ece66,null))[_0x2d18('0x20')](function(_0x23b19){if(_0x23b19){_0x510859['model']=_[_0x2d18('0x46')](db[_0x2d18('0x8b')]['rawAttributes']);_0x510859[_0x2d18('0x45')]=_['keys'](_0x4b23f5['query']);_0x510859[_0x2d18('0x47')]=_['intersection'](_0x510859[_0x2d18('0x44')],_0x510859['query']);_0x5c94e5[_0x2d18('0x49')]=_['intersection'](_0x510859['model'],qs[_0x2d18('0x59')](_0x4b23f5[_0x2d18('0x45')][_0x2d18('0x59')]));_0x5c94e5[_0x2d18('0x49')]=_0x5c94e5['attributes']['length']?_0x5c94e5['attributes']:_0x510859['model'];if(!_0x4b23f5[_0x2d18('0x45')][_0x2d18('0x4a')](_0x2d18('0x4b'))){_0x5c94e5['limit']=qs[_0x2d18('0x31')](_0x4b23f5[_0x2d18('0x45')][_0x2d18('0x31')]);_0x5c94e5[_0x2d18('0x2e')]=qs[_0x2d18('0x2e')](_0x4b23f5[_0x2d18('0x45')]['offset']);}_0x5c94e5[_0x2d18('0x4c')]=qs[_0x2d18('0x4d')](_0x4b23f5['query'][_0x2d18('0x4d')]);_0x5c94e5['where']=qs[_0x2d18('0x47')](_[_0x2d18('0x67')](_0x4b23f5[_0x2d18('0x45')],_0x510859['filters']));_0x5c94e5[_0x2d18('0x4e')]['OpenchannelAccountId']=_0x23b19['id'];if(_0x4b23f5[_0x2d18('0x45')][_0x2d18('0x4f')]){_0x5c94e5[_0x2d18('0x4e')]=_[_0x2d18('0x50')](_0x5c94e5[_0x2d18('0x4e')],{'$or':_[_0x2d18('0x3e')](_0x5c94e5[_0x2d18('0x49')],function(_0x321e6f){var _0x348e0b={};_0x348e0b[_0x321e6f]={'$like':'%'+_0x4b23f5[_0x2d18('0x45')][_0x2d18('0x4f')]+'%'};return _0x348e0b;})});}_0x5c94e5=_['merge']({},_0x5c94e5,_0x4b23f5[_0x2d18('0x52')]);return db[_0x2d18('0x8b')][_0x2d18('0x30')]({'where':_0x5c94e5[_0x2d18('0x4e')]})[_0x2d18('0x20')](function(_0x12c2a3){_0x2f81da['count']=_0x12c2a3;if(_0x4b23f5[_0x2d18('0x45')]['includeAll']){_0x5c94e5['include']=[{'model':db['CmContact'],'as':_0x2d18('0xa5'),'required':![]},{'model':db[_0x2d18('0xa6')],'as':_0x2d18('0xa7'),'attributes':[_0x2d18('0x3a'),_0x2d18('0xa8'),_0x2d18('0xa9')],'required':![]},{'model':db[_0x2d18('0xaa')],'as':'Tags','attributes':['id','name','color'],'where':_0x4b23f5[_0x2d18('0x45')][_0x2d18('0xab')]?{'id':_0x4b23f5[_0x2d18('0x45')][_0x2d18('0xab')]}:undefined,'required':_0x4b23f5[_0x2d18('0x45')][_0x2d18('0xab')]?!![]:![]}];}return db[_0x2d18('0x8b')][_0x2d18('0x54')](_0x5c94e5);})[_0x2d18('0x20')](function(_0x32f719){_0x2f81da[_0x2d18('0x55')]=_0x32f719;return _0x2f81da;});}})[_0x2d18('0x20')](respondWithFilteredResult(_0x4ece66,_0x5c94e5))[_0x2d18('0x56')](handleError(_0x4ece66,null));};exports[_0x2d18('0xac')]=function(_0x3f1541,_0x9e1d1b,_0x5bb89e){return db[_0x2d18('0x3f')]['find']({'where':{'id':_0x3f1541[_0x2d18('0x58')]['id']}})['then'](handleEntityNotFound(_0x9e1d1b,null))[_0x2d18('0x20')](function(_0x324b0d){if(_0x324b0d){return _0x324b0d[_0x2d18('0xac')](_0x3f1541['body'][_0x2d18('0x69')],_[_0x2d18('0xad')](_0x3f1541[_0x2d18('0x5d')],[_0x2d18('0x69'),'id'])||{})[_0x2d18('0xae')](function(_0x56fe88){for(var _0x11dc65=0x0;_0x11dc65<_0x3f1541[_0x2d18('0x5d')][_0x2d18('0x69')][_0x2d18('0x87')];_0x11dc65+=0x1){socket[_0x2d18('0xaf')](_0x2d18('0xb0'),{'UserId':Number(_0x3f1541[_0x2d18('0x5d')][_0x2d18('0x69')][_0x11dc65]),'OpenchannelAccountId':Number(_0x3f1541['params']['id'])});}return _0x56fe88;});}})[_0x2d18('0x20')](respondWithResult(_0x9e1d1b,null))[_0x2d18('0x56')](handleError(_0x9e1d1b,null));};exports[_0x2d18('0xb1')]=function(_0x4ee5fe,_0xb444a3,_0x51873c){return db[_0x2d18('0x3f')][_0x2d18('0x5b')]({'where':{'id':_0x4ee5fe[_0x2d18('0x58')]['id']}})[_0x2d18('0x20')](handleEntityNotFound(_0xb444a3,null))['then'](function(_0x1f3837){if(_0x1f3837){return _0x1f3837[_0x2d18('0xb1')](_0x4ee5fe[_0x2d18('0x45')][_0x2d18('0x69')])['then'](function(){if(_[_0x2d18('0xb2')](_0x4ee5fe[_0x2d18('0x45')]['ids'])){for(var _0x1d67df=0x0;_0x1d67df<_0x4ee5fe[_0x2d18('0x45')][_0x2d18('0x69')][_0x2d18('0x87')];_0x1d67df+=0x1){socket[_0x2d18('0xaf')](_0x2d18('0xb3'),{'UserId':Number(_0x4ee5fe[_0x2d18('0x45')][_0x2d18('0x69')][_0x1d67df]),'OpenchannelAccountId':Number(_0x4ee5fe[_0x2d18('0x58')]['id'])});}}else{socket[_0x2d18('0xaf')](_0x2d18('0xb3'),{'UserId':Number(_0x4ee5fe[_0x2d18('0x45')][_0x2d18('0x69')]),'OpenchannelAccountId':Number(_0x4ee5fe['params']['id'])});}});}})[_0x2d18('0x20')](respondWithStatusCode(_0xb444a3,null))[_0x2d18('0x56')](handleError(_0xb444a3,null));};exports[_0x2d18('0xb4')]=function(_0x39f846,_0x1b12b0,_0x2ed154){var _0x2ca66f={};var _0x117a84={};var _0x1e7d4e;var _0x58413d;return db[_0x2d18('0x3f')]['findOne']({'where':{'id':_0x39f846[_0x2d18('0x58')]['id']}})['then'](handleEntityNotFound(_0x1b12b0,null))[_0x2d18('0x20')](function(_0x14c719){if(_0x14c719){_0x1e7d4e=_0x14c719;_0x117a84[_0x2d18('0x44')]=_[_0x2d18('0x46')](db[_0x2d18('0xa6')][_0x2d18('0x40')]);_0x117a84[_0x2d18('0x45')]=_[_0x2d18('0x46')](_0x39f846[_0x2d18('0x45')]);_0x117a84[_0x2d18('0x47')]=_[_0x2d18('0x48')](_0x117a84['model'],_0x117a84['query']);_0x2ca66f[_0x2d18('0x49')]=_[_0x2d18('0x48')](_0x117a84[_0x2d18('0x44')],qs[_0x2d18('0x59')](_0x39f846['query'][_0x2d18('0x59')]));_0x2ca66f[_0x2d18('0x49')]=_0x2ca66f[_0x2d18('0x49')][_0x2d18('0x87')]?_0x2ca66f[_0x2d18('0x49')]:_0x117a84[_0x2d18('0x44')];_0x2ca66f[_0x2d18('0x4c')]=qs['sort'](_0x39f846[_0x2d18('0x45')]['sort']);_0x2ca66f[_0x2d18('0x4e')]=qs[_0x2d18('0x47')](_['pick'](_0x39f846[_0x2d18('0x45')],_0x117a84[_0x2d18('0x47')]));if(_0x39f846[_0x2d18('0x45')][_0x2d18('0x4f')]){_0x2ca66f[_0x2d18('0x4e')]=_['merge'](_0x2ca66f['where'],{'$or':_[_0x2d18('0x3e')](_0x2ca66f['attributes'],function(_0x3bb04a){var _0x2d7da6={};_0x2d7da6[_0x3bb04a]={'$like':'%'+_0x39f846[_0x2d18('0x45')][_0x2d18('0x4f')]+'%'};return _0x2d7da6;})});}_0x2ca66f=_[_0x2d18('0x50')]({},_0x2ca66f,_0x39f846[_0x2d18('0x52')]);return _0x1e7d4e['getAgents'](_0x2ca66f);}})[_0x2d18('0x20')](function(_0x2d480e){if(_0x2d480e){_0x58413d=_0x2d480e[_0x2d18('0x87')];if(!_0x39f846[_0x2d18('0x45')][_0x2d18('0x4a')]('nolimit')){_0x2ca66f['limit']=qs[_0x2d18('0x31')](_0x39f846['query'][_0x2d18('0x31')]);_0x2ca66f[_0x2d18('0x2e')]=qs[_0x2d18('0x2e')](_0x39f846[_0x2d18('0x45')][_0x2d18('0x2e')]);}return _0x1e7d4e[_0x2d18('0xb4')](_0x2ca66f);}})[_0x2d18('0x20')](function(_0x4764ff){if(_0x4764ff){return _0x4764ff?{'count':_0x58413d,'rows':_0x4764ff}:null;}})[_0x2d18('0x20')](respondWithResult(_0x1b12b0,null))['catch'](handleError(_0x1b12b0,null));};exports[_0x2d18('0x3b')]=function(_0x3617c1,_0x3038ea,_0x3370a8){var _0x3b3d99,_0x4f441c,_0x4de4d4;if(_[_0x2d18('0x76')](_0x3617c1[_0x2d18('0x5d')]['body'])||_0x3617c1[_0x2d18('0x5d')][_0x2d18('0x5d')]===''){throw new db['Sequelize'][(_0x2d18('0x78'))](_0x2d18('0x7a'));}if(_[_0x2d18('0x76')](_0x3617c1['body']['to'])){}_0x3b3d99=_0x3617c1[_0x2d18('0x5d')]['to'];return db[_0x2d18('0x3f')][_0x2d18('0x6a')]({'where':{'id':_0x3617c1[_0x2d18('0x58')]['id']}})[_0x2d18('0x20')](handleEntityNotFound(_0x3038ea,null))[_0x2d18('0x20')](function(_0x2c7004){if(_0x2c7004){return db['OpenchannelAccount'][_0x2d18('0x5b')]({'where':{'id':_0x2c7004['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2d18('0x6e')],'as':_0x2d18('0x86'),'where':{[_0x2c7004[_0x2d18('0x7b')]]:_0x3b3d99},'limit':0x1,'order':[[_0x2d18('0x73'),_0x2d18('0x7e')]]}]}]})[_0x2d18('0x20')](handleEntityNotFound(_0x3038ea,null))[_0x2d18('0x20')](function(_0x4408ed){if(_0x4408ed&&_0x4408ed[_0x2d18('0x81')]){_0x4f441c=_0x4408ed[_0x2d18('0x5e')]({'plain':!![]});if(_0x4f441c['List']&&_0x4f441c['List'][_0x2d18('0x86')][_0x2d18('0x87')]){return _0x4f441c[_0x2d18('0x81')][_0x2d18('0x86')][0x0];}return db[_0x2d18('0x6e')][_0x2d18('0x5c')](_['defaults'](_0x3617c1[_0x2d18('0x5d')],{'firstName':_0x3b3d99,[_0x4408ed[_0x2d18('0x7b')]]:_0x3b3d99,'phone':_0x3b3d99,'ListId':_0x4f441c[_0x2d18('0x75')]}));}})['then'](handleEntityNotFound(_0x3038ea,null))[_0x2d18('0x20')](function(_0x5e3778){if(_0x5e3778){_0x4de4d4=_0x5e3778;return db[_0x2d18('0x8b')][_0x2d18('0x5b')]({'where':{'ContactId':_0x4de4d4['id'],'closed':![],'OpenchannelAccountId':_0x4f441c['id']}})[_0x2d18('0x20')](function(_0x535253){if(_0x535253){return[_0x535253,![]];}return db[_0x2d18('0x8b')]['create']({'UserId':_0x3617c1['user']['id'],'ContactId':_0x4de4d4['id'],'OpenchannelAccountId':_0x4f441c['id'],'lastMsgDirection':_0x2d18('0xb5'),'Messages':[_[_0x2d18('0x50')](_0x3617c1[_0x2d18('0x5d')],{'read':![],'body':_0x3617c1[_0x2d18('0x5d')][_0x2d18('0x5d')],'OpenchannelAccountId':_0x4f441c['id'],'UserId':_0x3617c1[_0x2d18('0x61')]['id'],'ContactId':_0x4de4d4['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x2d18('0x20')](function(_0x4d52b6){return[_0x4d52b6,!![]];});});}})['spread'](function(_0x25d83c,_0x3eaf7a){if(_0x3eaf7a){return _0x25d83c;}return db[_0x2d18('0xb6')][_0x2d18('0x5c')](_[_0x2d18('0x50')](_0x3617c1['body'],{'read':![],'body':_0x3617c1[_0x2d18('0x5d')][_0x2d18('0x5d')],'OpenchannelAccountId':_0x4f441c['id'],'OpenchannelInteractionId':_0x25d83c['id'],'UserId':_0x3617c1['user']['id'],'ContactId':_0x4de4d4['id']}))['then'](function(_0x2506df){_0x25d83c['dataValues'][_0x2d18('0xb7')]=[];_0x25d83c[_0x2d18('0xb8')][_0x2d18('0xb7')][_0x2d18('0x93')](_0x2506df[_0x2d18('0xb8')]);return _0x25d83c;});});}})[_0x2d18('0x20')](respondWithResult(_0x3038ea,null))['catch'](handleError(_0x3038ea,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b479264..de46177 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 _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0x164066,_0x1f1d40){var _0xa816f0=function(_0x17b29e){while(--_0x17b29e){_0x164066['push'](_0x164066['shift']());}};_0xa816f0(++_0x1f1d40);}(_0xe706,0xa3));var _0x6e70=function(_0x4d03d6,_0x438a06){_0x4d03d6=_0x4d03d6-0x0;var _0x22752e=_0xe706[_0x4d03d6];return _0x22752e;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','OpenchannelAccount','setMaxListeners'];(function(_0xe41288,_0x58f6f6){var _0x1ecdd9=function(_0x2ddebd){while(--_0x2ddebd){_0xe41288['push'](_0xe41288['shift']());}};_0x1ecdd9(++_0x58f6f6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0xcb91[_0x3132e8];return _0x43eb8c;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x1cb9('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){OpenchannelAccountEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);OpenchannelAccountEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];OpenchannelAccount[_0x1cb9('0x6')](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 fd5488a..7484fc9 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(_0x4103a5,_0x3286fe){var _0x5e3688=function(_0x1e447d){while(--_0x1e447d){_0x4103a5['push'](_0x4103a5['shift']());}};_0x5e3688(++_0x3286fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x2258ed,_0x3a6252){var _0x42014a=function(_0x1a452e){while(--_0x1a452e){_0x2258ed['push'](_0x2258ed['shift']());}};_0x42014a(++_0x3a6252);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 3d749e2..b699bb1 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 _0xc29b=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x55fdcc,_0x2d2dcc){var _0x352765=function(_0x25c491){while(--_0x25c491){_0x55fdcc['push'](_0x55fdcc['shift']());}};_0x352765(++_0x2d2dcc);}(_0xc29b,0x12d));var _0xbc29=function(_0x23840b,_0x79368e){_0x23840b=_0x23840b-0x0;var _0x9b6804=_0xc29b[_0x23840b];return _0x9b6804;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});config[_0xbc29('0xc')]=_[_0xbc29('0xd')](config[_0xbc29('0xc')],{'host':_0xbc29('0xe'),'port':0x18eb});var socket=require(_0xbc29('0xf'))(new Redis(config[_0xbc29('0xc')]));require(_0xbc29('0x10'))[_0xbc29('0x11')](socket);function respondWithRpcPromise(_0x36d1e3,_0x13a581,_0x2f591c){return new BPromise(function(_0x35ece9,_0x2710ad){return client['request'](_0x36d1e3,_0x2f591c)[_0xbc29('0x12')](function(_0x888953){logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));logger[_0xbc29('0x16')](_0xbc29('0x17'),_0x13a581,'request\x20sent',JSON[_0xbc29('0x18')](_0x888953));if(_0x888953[_0xbc29('0x19')]){if(_0x888953[_0xbc29('0x19')]['code']===0x1f4){logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x2710ad(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x35ece9(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}else{logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));_0x35ece9(_0x888953['result'][_0xbc29('0x1a')]);}})[_0xbc29('0x1b')](function(_0x4eadbe){logger['error'](_0xbc29('0x14'),_0x13a581,_0x4eadbe);_0x2710ad(_0x4eadbe);});});} \ No newline at end of file +var _0x8580=['http','redis','defaults','localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x1d1e2e,_0x560855){var _0x22c325=function(_0x45b3b2){while(--_0x45b3b2){_0x1d1e2e['push'](_0x1d1e2e['shift']());}};_0x22c325(++_0x560855);}(_0x8580,0x1c7));var _0x0858=function(_0x329f1e,_0x1d987b){_0x329f1e=_0x329f1e-0x0;var _0x544e90=_0x8580[_0x329f1e];return _0x544e90;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var moment=require('moment');var BPromise=require(_0x0858('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0858('0x2'))['db'];var utils=require(_0x0858('0x3'));var logger=require('../../config/logger')(_0x0858('0x4'));var config=require(_0x0858('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0858('0x6')][_0x0858('0x7')]({'port':0x232a});config[_0x0858('0x8')]=_[_0x0858('0x9')](config['redis'],{'host':_0x0858('0xa'),'port':0x18eb});var socket=require(_0x0858('0xb'))(new Redis(config[_0x0858('0x8')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x470459,_0x4b5072,_0x24996d){return new BPromise(function(_0x1c214c,_0x38371f){return client[_0x0858('0xc')](_0x470459,_0x24996d)[_0x0858('0xd')](function(_0x207cda){logger[_0x0858('0xe')](_0x0858('0xf'),_0x4b5072,'request\x20sent');logger['debug'](_0x0858('0x10'),_0x4b5072,'request\x20sent',JSON['stringify'](_0x207cda));if(_0x207cda['error']){if(_0x207cda[_0x0858('0x11')][_0x0858('0x12')]===0x1f4){logger['error'](_0x0858('0xf'),_0x4b5072,_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);return _0x38371f(_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);}logger[_0x0858('0x11')](_0x0858('0xf'),_0x4b5072,_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);return _0x1c214c(_0x207cda[_0x0858('0x11')][_0x0858('0x13')]);}else{logger[_0x0858('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b5072,_0x0858('0x14'));_0x1c214c(_0x207cda['result'][_0x0858('0x13')]);}})[_0x0858('0x15')](function(_0x3a2d96){logger[_0x0858('0x11')](_0x0858('0xf'),_0x4b5072,_0x3a2d96);_0x38371f(_0x3a2d96);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index b939bb2..38a0e59 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 _0xe706=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','emit','removeListener'];(function(_0x3510c2,_0x396bf6){var _0x191fb0=function(_0x1e3f44){while(--_0x1e3f44){_0x3510c2['push'](_0x3510c2['shift']());}};_0x191fb0(++_0x396bf6);}(_0xe706,0xa3));var _0x6e70=function(_0x52456c,_0x2bea26){_0x52456c=_0x52456c-0x0;var _0x3040d9=_0xe706[_0x52456c];return _0x3040d9;};'use strict';var OpenchannelAccountEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelAccountEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelAccountEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file +var _0xcc40=['update','register','openchannelAccount:','./openchannelAccount.events'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xcc40,0x97));var _0x0cc4=function(_0x3232b9,_0xaffa6a){_0x3232b9=_0x3232b9-0x0;var _0x11e083=_0xcc40[_0x3232b9];return _0x11e083;};'use strict';var OpenchannelAccountEvents=require(_0x0cc4('0x0'));var events=['save','remove',_0x0cc4('0x1')];function createListener(_0xe28305,_0x5cfa9a){return function(_0x19b2bd){_0x5cfa9a['emit'](_0xe28305,_0x19b2bd);};}function removeListener(_0x41e222,_0x318a65){return function(){OpenchannelAccountEvents['removeListener'](_0x41e222,_0x318a65);};}exports[_0x0cc4('0x2')]=function(_0x5bbfa7){for(var _0xbe15f4=0x0,_0x58f080=events['length'];_0xbe15f4<_0x58f080;_0xbe15f4++){var _0x349c6a=events[_0xbe15f4];var _0x2fd087=createListener(_0x0cc4('0x3')+_0x349c6a,_0x5bbfa7);OpenchannelAccountEvents['on'](_0x349c6a,_0x2fd087);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 294ecc7..0bf655b 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 _0xf65b=['index','/:id','show','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x4d5f68,_0x5a5a95){var _0x4fc254=function(_0x3a8955){while(--_0x3a8955){_0x4d5f68['push'](_0x4d5f68['shift']());}};_0x4fc254(++_0x5a5a95);}(_0xf65b,0x125));var _0xbf65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf65b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf65('0x0'));var timeout=require(_0xbf65('0x1'));var express=require(_0xbf65('0x2'));var router=express[_0xbf65('0x3')]();var fs_extra=require(_0xbf65('0x4'));var auth=require(_0xbf65('0x5'));var interaction=require(_0xbf65('0x6'));var config=require(_0xbf65('0x7'));var controller=require(_0xbf65('0x8'));router[_0xbf65('0x9')]('/',auth[_0xbf65('0xa')](),controller[_0xbf65('0xb')]);router[_0xbf65('0x9')](_0xbf65('0xc'),auth['isAuthenticated'](),controller[_0xbf65('0xd')]);router['post']('/',auth[_0xbf65('0xa')](),controller['create']);router[_0xbf65('0xe')](_0xbf65('0xc'),auth[_0xbf65('0xa')](),controller[_0xbf65('0xf')]);router[_0xbf65('0x10')](_0xbf65('0xc'),auth[_0xbf65('0xa')](),controller[_0xbf65('0x11')]);module[_0xbf65('0x12')]=router; \ No newline at end of file +var _0x8efa=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3a5edc,_0x17686a){var _0x184c4c=function(_0x972dc3){while(--_0x972dc3){_0x3a5edc['push'](_0x3a5edc['shift']());}};_0x184c4c(++_0x17686a);}(_0x8efa,0x10d));var _0xa8ef=function(_0x4c0070,_0x265943){_0x4c0070=_0x4c0070-0x0;var _0x4f3eef=_0x8efa[_0x4c0070];return _0x4f3eef;};'use strict';var multer=require('multer');var util=require(_0xa8ef('0x0'));var path=require(_0xa8ef('0x1'));var timeout=require(_0xa8ef('0x2'));var express=require(_0xa8ef('0x3'));var router=express[_0xa8ef('0x4')]();var fs_extra=require(_0xa8ef('0x5'));var auth=require(_0xa8ef('0x6'));var interaction=require(_0xa8ef('0x7'));var config=require(_0xa8ef('0x8'));var controller=require(_0xa8ef('0x9'));router[_0xa8ef('0xa')]('/',auth[_0xa8ef('0xb')](),controller[_0xa8ef('0xc')]);router['get'](_0xa8ef('0xd'),auth[_0xa8ef('0xb')](),controller[_0xa8ef('0xe')]);router[_0xa8ef('0xf')]('/',auth[_0xa8ef('0xb')](),controller[_0xa8ef('0x10')]);router[_0xa8ef('0x11')]('/:id',auth[_0xa8ef('0xb')](),controller['update']);router[_0xa8ef('0x12')](_0xa8ef('0xd'),auth[_0xa8ef('0xb')](),controller[_0xa8ef('0x13')]);module[_0xa8ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 3062e9b..c767474 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 _0x7329=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x2f546d,_0x2f6477){var _0x254ea6=function(_0x321f8a){while(--_0x321f8a){_0x2f546d['push'](_0x2f546d['shift']());}};_0x254ea6(++_0x2f6477);}(_0x7329,0x157));var _0x9732=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x7329[_0x1ff575];return _0x48fc9e;};'use strict';var Sequelize=require('sequelize');module[_0x9732('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9732('0x1')],'allowNull':![],'defaultValue':_0x9732('0x2')},'appdata':{'type':Sequelize[_0x9732('0x3')]()},'description':{'type':Sequelize[_0x9732('0x1')]},'interval':{'type':Sequelize[_0x9732('0x1')],'defaultValue':_0x9732('0x4')}}; \ No newline at end of file +var _0xb3b2=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4e69a8,_0x1c72ee){var _0x2df4c2=function(_0x4f8cf6){while(--_0x4f8cf6){_0x4e69a8['push'](_0x4e69a8['shift']());}};_0x2df4c2(++_0x1c72ee);}(_0xb3b2,0x164));var _0x2b3b=function(_0x83031,_0xee73e0){_0x83031=_0x83031-0x0;var _0x1db3af=_0xb3b2[_0x83031];return _0x1db3af;};'use strict';var Sequelize=require(_0x2b3b('0x0'));module[_0x2b3b('0x1')]={'priority':{'type':Sequelize[_0x2b3b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2b3b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2b3b('0x4')]()},'description':{'type':Sequelize[_0x2b3b('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2b3b('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 18b3d6c..8cc5fb9 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 _0x9d10=['length','options','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','reject','save','update','then','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','filters'];(function(_0x288241,_0x18063e){var _0xc3de1a=function(_0x548f30){while(--_0x548f30){_0x288241['push'](_0x288241['shift']());}};_0xc3de1a(++_0x18063e);}(_0x9d10,0x1c2));var _0x09d1=function(_0x4279e6,_0x5c118c){_0x4279e6=_0x4279e6-0x0;var _0x1dfc25=_0x9d10[_0x4279e6];return _0x1dfc25;};'use strict';var emlformat=require(_0x09d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09d1('0x1'));var jsonpatch=require(_0x09d1('0x2'));var rp=require('request-promise');var moment=require(_0x09d1('0x3'));var BPromise=require(_0x09d1('0x4'));var Mustache=require(_0x09d1('0x5'));var util=require(_0x09d1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x09d1('0x7'));var ejs=require(_0x09d1('0x8'));var fs=require('fs');var fs_extra=require(_0x09d1('0x9'));var _=require(_0x09d1('0xa'));var squel=require(_0x09d1('0xb'));var crypto=require(_0x09d1('0xc'));var jsforce=require(_0x09d1('0xd'));var deskjs=require(_0x09d1('0xe'));var toCsv=require(_0x09d1('0x7'));var querystring=require(_0x09d1('0xf'));var Papa=require(_0x09d1('0x10'));var Redis=require('ioredis');var authService=require(_0x09d1('0x11'));var qs=require(_0x09d1('0x12'));var as=require(_0x09d1('0x13'));var hardwareService=require(_0x09d1('0x14'));var logger=require(_0x09d1('0x15'))(_0x09d1('0x16'));var utils=require(_0x09d1('0x17'));var config=require(_0x09d1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x09d1('0x19'))['db'];function respondWithStatusCode(_0x27f578,_0x37b55f){_0x37b55f=_0x37b55f||0xcc;return function(_0x1ee6e2){if(_0x1ee6e2){return _0x27f578[_0x09d1('0x1a')](_0x37b55f);}return _0x27f578[_0x09d1('0x1b')](_0x37b55f)[_0x09d1('0x1c')]();};}function respondWithResult(_0x48733b,_0x382e0b){_0x382e0b=_0x382e0b||0xc8;return function(_0x59cc83){if(_0x59cc83){return _0x48733b['status'](_0x382e0b)[_0x09d1('0x1d')](_0x59cc83);}};}function respondWithFilteredResult(_0x138a0d,_0x45831c){return function(_0x19e122){if(_0x19e122){var _0x25a94e=typeof _0x45831c['offset']===_0x09d1('0x1e')&&typeof _0x45831c['limit']===_0x09d1('0x1e');var _0x3df4f3=_0x19e122[_0x09d1('0x1f')];var _0x196e90=_0x25a94e?0x0:_0x45831c['offset'];var _0xae4ea1=_0x25a94e?_0x19e122[_0x09d1('0x1f')]:_0x45831c['offset']+_0x45831c['limit'];var _0x586964;if(_0xae4ea1>=_0x3df4f3){_0xae4ea1=_0x3df4f3;_0x586964=0xc8;}else{_0x586964=0xce;}_0x138a0d[_0x09d1('0x1b')](_0x586964);return _0x138a0d['set']('Content-Range',_0x196e90+'-'+_0xae4ea1+'/'+_0x3df4f3)['json'](_0x19e122);}return null;};}function patchUpdates(_0x122b65){return function(_0x3f88cf){try{jsonpatch['apply'](_0x3f88cf,_0x122b65,!![]);}catch(_0x51a97a){return BPromise[_0x09d1('0x20')](_0x51a97a);}return _0x3f88cf[_0x09d1('0x21')]();};}function saveUpdates(_0x3aa267,_0x1ad0df){return function(_0x5944b7){if(_0x5944b7){return _0x5944b7[_0x09d1('0x22')](_0x3aa267)['then'](function(_0x5afae2){return _0x5afae2;});}return null;};}function removeEntity(_0x1a6c62,_0x4ba3b5){return function(_0xb30c92){if(_0xb30c92){return _0xb30c92['destroy']()[_0x09d1('0x23')](function(){_0x1a6c62['status'](0xcc)[_0x09d1('0x1c')]();});}};}function handleEntityNotFound(_0x4ebf97,_0x3553a2){return function(_0x4cd2eb){if(!_0x4cd2eb){_0x4ebf97['sendStatus'](0x194);}return _0x4cd2eb;};}function handleError(_0x186620,_0x3daca9){_0x3daca9=_0x3daca9||0x1f4;return function(_0x2cc971){logger['error'](_0x2cc971[_0x09d1('0x24')]);if(_0x2cc971[_0x09d1('0x25')]){delete _0x2cc971['name'];}_0x186620[_0x09d1('0x1b')](_0x3daca9)[_0x09d1('0x26')](_0x2cc971);};}exports[_0x09d1('0x27')]=function(_0x49203b,_0x34204c){var _0x7cabab={},_0x574352={},_0x21d8eb={'count':0x0,'rows':[]};var _0x1efe1e=_[_0x09d1('0x28')](db[_0x09d1('0x29')][_0x09d1('0x2a')],function(_0x54e3da){return{'name':_0x54e3da[_0x09d1('0x2b')],'type':_0x54e3da['type']['key']};});_0x574352[_0x09d1('0x2c')]=_[_0x09d1('0x28')](_0x1efe1e,'name');_0x574352[_0x09d1('0x2d')]=_[_0x09d1('0x2e')](_0x49203b['query']);_0x574352['filters']=_[_0x09d1('0x2f')](_0x574352[_0x09d1('0x2c')],_0x574352[_0x09d1('0x2d')]);_0x7cabab[_0x09d1('0x30')]=_['intersection'](_0x574352[_0x09d1('0x2c')],qs[_0x09d1('0x31')](_0x49203b[_0x09d1('0x2d')][_0x09d1('0x31')]));_0x7cabab[_0x09d1('0x30')]=_0x7cabab[_0x09d1('0x30')]['length']?_0x7cabab[_0x09d1('0x30')]:_0x574352[_0x09d1('0x2c')];if(!_0x49203b[_0x09d1('0x2d')][_0x09d1('0x32')](_0x09d1('0x33'))){_0x7cabab[_0x09d1('0x34')]=qs[_0x09d1('0x34')](_0x49203b['query']['limit']);_0x7cabab[_0x09d1('0x35')]=qs['offset'](_0x49203b[_0x09d1('0x2d')][_0x09d1('0x35')]);}_0x7cabab[_0x09d1('0x36')]=qs[_0x09d1('0x37')](_0x49203b[_0x09d1('0x2d')][_0x09d1('0x37')]);_0x7cabab[_0x09d1('0x38')]=qs['filters'](_[_0x09d1('0x39')](_0x49203b['query'],_0x574352['filters']),_0x1efe1e);if(_0x49203b[_0x09d1('0x2d')][_0x09d1('0x3a')]){_0x7cabab['where']=_['merge'](_0x7cabab[_0x09d1('0x38')],{'$or':_[_0x09d1('0x28')](_0x1efe1e,function(_0x5d9386){if(_0x5d9386['type']!==_0x09d1('0x3b')){var _0xf6761b={};_0xf6761b[_0x5d9386['name']]={'$like':'%'+_0x49203b[_0x09d1('0x2d')][_0x09d1('0x3a')]+'%'};return _0xf6761b;}})});}_0x7cabab=_[_0x09d1('0x3c')]({},_0x7cabab,_0x49203b['options']);var _0x56d003={'where':_0x7cabab[_0x09d1('0x38')]};return db[_0x09d1('0x29')][_0x09d1('0x1f')](_0x56d003)[_0x09d1('0x23')](function(_0x49673a){_0x21d8eb[_0x09d1('0x1f')]=_0x49673a;if(_0x49203b[_0x09d1('0x2d')][_0x09d1('0x3d')]){_0x7cabab[_0x09d1('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x09d1('0x3f')](_0x7cabab);})['then'](function(_0x4c8574){_0x21d8eb['rows']=_0x4c8574;return _0x21d8eb;})[_0x09d1('0x23')](respondWithFilteredResult(_0x34204c,_0x7cabab))[_0x09d1('0x40')](handleError(_0x34204c,null));};exports[_0x09d1('0x41')]=function(_0x1c5aeb,_0x1a966d){var _0x4f45eb={'raw':!![],'where':{'id':_0x1c5aeb[_0x09d1('0x42')]['id']}},_0x53ca21={};_0x53ca21[_0x09d1('0x2c')]=_[_0x09d1('0x2e')](db[_0x09d1('0x29')][_0x09d1('0x2a')]);_0x53ca21[_0x09d1('0x2d')]=_[_0x09d1('0x2e')](_0x1c5aeb['query']);_0x53ca21[_0x09d1('0x43')]=_[_0x09d1('0x2f')](_0x53ca21['model'],_0x53ca21[_0x09d1('0x2d')]);_0x4f45eb['attributes']=_['intersection'](_0x53ca21[_0x09d1('0x2c')],qs[_0x09d1('0x31')](_0x1c5aeb[_0x09d1('0x2d')]['fields']));_0x4f45eb[_0x09d1('0x30')]=_0x4f45eb['attributes'][_0x09d1('0x44')]?_0x4f45eb[_0x09d1('0x30')]:_0x53ca21[_0x09d1('0x2c')];if(_0x1c5aeb[_0x09d1('0x2d')][_0x09d1('0x3d')]){_0x4f45eb[_0x09d1('0x3e')]=[{'all':!![]}];}_0x4f45eb=_[_0x09d1('0x3c')]({},_0x4f45eb,_0x1c5aeb[_0x09d1('0x45')]);return db[_0x09d1('0x29')][_0x09d1('0x46')](_0x4f45eb)['then'](handleEntityNotFound(_0x1a966d,null))[_0x09d1('0x23')](respondWithResult(_0x1a966d,null))['catch'](handleError(_0x1a966d,null));};exports['create']=function(_0x5b425b,_0x38a5c2){return db[_0x09d1('0x29')][_0x09d1('0x47')](_0x5b425b['body'],{})['then'](respondWithResult(_0x38a5c2,0xc9))[_0x09d1('0x40')](handleError(_0x38a5c2,null));};exports[_0x09d1('0x22')]=function(_0x1676fc,_0x5c5166){if(_0x1676fc[_0x09d1('0x48')]['id']){delete _0x1676fc[_0x09d1('0x48')]['id'];}return db['OpenchannelApplication'][_0x09d1('0x46')]({'where':{'id':_0x1676fc[_0x09d1('0x42')]['id']}})[_0x09d1('0x23')](handleEntityNotFound(_0x5c5166,null))['then'](saveUpdates(_0x1676fc['body'],null))[_0x09d1('0x23')](respondWithResult(_0x5c5166,null))[_0x09d1('0x40')](handleError(_0x5c5166,null));};exports[_0x09d1('0x49')]=function(_0xb11b1d,_0x40b297){return db[_0x09d1('0x29')][_0x09d1('0x46')]({'where':{'id':_0xb11b1d[_0x09d1('0x42')]['id']}})[_0x09d1('0x23')](handleEntityNotFound(_0x40b297,null))[_0x09d1('0x23')](removeEntity(_0x40b297,null))[_0x09d1('0x40')](handleError(_0x40b297,null));}; \ No newline at end of file +var _0xd891=['index','OpenchannelApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send'];(function(_0x5c99ca,_0x490157){var _0x901b19=function(_0x5afd96){while(--_0x5afd96){_0x5c99ca['push'](_0x5c99ca['shift']());}};_0x901b19(++_0x490157);}(_0xd891,0xc0));var _0x1d89=function(_0x9a0017,_0x406cea){_0x9a0017=_0x9a0017-0x0;var _0x4da59d=_0xd891[_0x9a0017];return _0x4da59d;};'use strict';var emlformat=require(_0x1d89('0x0'));var rimraf=require(_0x1d89('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d89('0x2'));var rp=require(_0x1d89('0x3'));var moment=require(_0x1d89('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1d89('0x5'));var util=require(_0x1d89('0x6'));var path=require('path');var sox=require(_0x1d89('0x7'));var csv=require(_0x1d89('0x8'));var ejs=require(_0x1d89('0x9'));var fs=require('fs');var fs_extra=require(_0x1d89('0xa'));var _=require(_0x1d89('0xb'));var squel=require(_0x1d89('0xc'));var crypto=require(_0x1d89('0xd'));var jsforce=require(_0x1d89('0xe'));var deskjs=require(_0x1d89('0xf'));var toCsv=require(_0x1d89('0x8'));var querystring=require(_0x1d89('0x10'));var Papa=require(_0x1d89('0x11'));var Redis=require(_0x1d89('0x12'));var authService=require(_0x1d89('0x13'));var qs=require(_0x1d89('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d89('0x15'));var logger=require(_0x1d89('0x16'))(_0x1d89('0x17'));var utils=require(_0x1d89('0x18'));var config=require(_0x1d89('0x19'));var licenseUtil=require(_0x1d89('0x1a'));var db=require(_0x1d89('0x1b'))['db'];function respondWithStatusCode(_0x3a49ce,_0x1a5932){_0x1a5932=_0x1a5932||0xcc;return function(_0x108afb){if(_0x108afb){return _0x3a49ce['sendStatus'](_0x1a5932);}return _0x3a49ce[_0x1d89('0x1c')](_0x1a5932)['end']();};}function respondWithResult(_0x59a4a5,_0x4b8cbe){_0x4b8cbe=_0x4b8cbe||0xc8;return function(_0x6d7876){if(_0x6d7876){return _0x59a4a5['status'](_0x4b8cbe)['json'](_0x6d7876);}};}function respondWithFilteredResult(_0x36af15,_0x18da2e){return function(_0x4bd228){if(_0x4bd228){var _0x2db550=typeof _0x18da2e['offset']===_0x1d89('0x1d')&&typeof _0x18da2e[_0x1d89('0x1e')]===_0x1d89('0x1d');var _0x3a9c43=_0x4bd228[_0x1d89('0x1f')];var _0x281e90=_0x2db550?0x0:_0x18da2e[_0x1d89('0x20')];var _0xf62071=_0x2db550?_0x4bd228[_0x1d89('0x1f')]:_0x18da2e[_0x1d89('0x20')]+_0x18da2e[_0x1d89('0x1e')];var _0x35b7a5;if(_0xf62071>=_0x3a9c43){_0xf62071=_0x3a9c43;_0x35b7a5=0xc8;}else{_0x35b7a5=0xce;}_0x36af15[_0x1d89('0x1c')](_0x35b7a5);return _0x36af15['set']('Content-Range',_0x281e90+'-'+_0xf62071+'/'+_0x3a9c43)[_0x1d89('0x21')](_0x4bd228);}return null;};}function patchUpdates(_0x22c0b5){return function(_0x551b04){try{jsonpatch[_0x1d89('0x22')](_0x551b04,_0x22c0b5,!![]);}catch(_0x48d2dc){return BPromise[_0x1d89('0x23')](_0x48d2dc);}return _0x551b04[_0x1d89('0x24')]();};}function saveUpdates(_0x91f40d,_0x119c4c){return function(_0x4cc751){if(_0x4cc751){return _0x4cc751[_0x1d89('0x25')](_0x91f40d)[_0x1d89('0x26')](function(_0x4e3a84){return _0x4e3a84;});}return null;};}function removeEntity(_0x4f116f,_0x23d477){return function(_0x142768){if(_0x142768){return _0x142768['destroy']()['then'](function(){_0x4f116f[_0x1d89('0x1c')](0xcc)[_0x1d89('0x27')]();});}};}function handleEntityNotFound(_0x2a5d77,_0x2c140f){return function(_0x3a18ca){if(!_0x3a18ca){_0x2a5d77[_0x1d89('0x28')](0x194);}return _0x3a18ca;};}function handleError(_0x3ce262,_0x5e2f48){_0x5e2f48=_0x5e2f48||0x1f4;return function(_0x25c468){logger[_0x1d89('0x29')](_0x25c468[_0x1d89('0x2a')]);if(_0x25c468[_0x1d89('0x2b')]){delete _0x25c468[_0x1d89('0x2b')];}_0x3ce262[_0x1d89('0x1c')](_0x5e2f48)[_0x1d89('0x2c')](_0x25c468);};}exports[_0x1d89('0x2d')]=function(_0x2022d4,_0x45aa93){var _0x5007ba={},_0x12f2d8={},_0x541a07={'count':0x0,'rows':[]};var _0x8c3bb2=_['map'](db[_0x1d89('0x2e')][_0x1d89('0x2f')],function(_0xb732c4){return{'name':_0xb732c4[_0x1d89('0x30')],'type':_0xb732c4['type'][_0x1d89('0x31')]};});_0x12f2d8[_0x1d89('0x32')]=_['map'](_0x8c3bb2,_0x1d89('0x2b'));_0x12f2d8['query']=_[_0x1d89('0x33')](_0x2022d4[_0x1d89('0x34')]);_0x12f2d8[_0x1d89('0x35')]=_[_0x1d89('0x36')](_0x12f2d8[_0x1d89('0x32')],_0x12f2d8['query']);_0x5007ba[_0x1d89('0x37')]=_[_0x1d89('0x36')](_0x12f2d8[_0x1d89('0x32')],qs[_0x1d89('0x38')](_0x2022d4[_0x1d89('0x34')][_0x1d89('0x38')]));_0x5007ba[_0x1d89('0x37')]=_0x5007ba['attributes'][_0x1d89('0x39')]?_0x5007ba[_0x1d89('0x37')]:_0x12f2d8['model'];if(!_0x2022d4[_0x1d89('0x34')][_0x1d89('0x3a')]('nolimit')){_0x5007ba[_0x1d89('0x1e')]=qs[_0x1d89('0x1e')](_0x2022d4[_0x1d89('0x34')][_0x1d89('0x1e')]);_0x5007ba[_0x1d89('0x20')]=qs[_0x1d89('0x20')](_0x2022d4['query'][_0x1d89('0x20')]);}_0x5007ba[_0x1d89('0x3b')]=qs['sort'](_0x2022d4[_0x1d89('0x34')][_0x1d89('0x3c')]);_0x5007ba[_0x1d89('0x3d')]=qs['filters'](_[_0x1d89('0x3e')](_0x2022d4[_0x1d89('0x34')],_0x12f2d8['filters']),_0x8c3bb2);if(_0x2022d4[_0x1d89('0x34')]['filter']){_0x5007ba[_0x1d89('0x3d')]=_['merge'](_0x5007ba[_0x1d89('0x3d')],{'$or':_[_0x1d89('0x3f')](_0x8c3bb2,function(_0x16d806){if(_0x16d806[_0x1d89('0x40')]!==_0x1d89('0x41')){var _0x15988d={};_0x15988d[_0x16d806['name']]={'$like':'%'+_0x2022d4[_0x1d89('0x34')]['filter']+'%'};return _0x15988d;}})});}_0x5007ba=_[_0x1d89('0x42')]({},_0x5007ba,_0x2022d4[_0x1d89('0x43')]);var _0x316ad0={'where':_0x5007ba['where']};return db[_0x1d89('0x2e')]['count'](_0x316ad0)[_0x1d89('0x26')](function(_0x3f73c1){_0x541a07['count']=_0x3f73c1;if(_0x2022d4['query'][_0x1d89('0x44')]){_0x5007ba[_0x1d89('0x45')]=[{'all':!![]}];}return db[_0x1d89('0x2e')][_0x1d89('0x46')](_0x5007ba);})[_0x1d89('0x26')](function(_0xa20476){_0x541a07[_0x1d89('0x47')]=_0xa20476;return _0x541a07;})[_0x1d89('0x26')](respondWithFilteredResult(_0x45aa93,_0x5007ba))['catch'](handleError(_0x45aa93,null));};exports[_0x1d89('0x48')]=function(_0x55668a,_0x468964){var _0x55c4b5={'raw':!![],'where':{'id':_0x55668a[_0x1d89('0x49')]['id']}},_0x2103a9={};_0x2103a9['model']=_[_0x1d89('0x33')](db['OpenchannelApplication']['rawAttributes']);_0x2103a9[_0x1d89('0x34')]=_['keys'](_0x55668a[_0x1d89('0x34')]);_0x2103a9['filters']=_['intersection'](_0x2103a9['model'],_0x2103a9[_0x1d89('0x34')]);_0x55c4b5[_0x1d89('0x37')]=_[_0x1d89('0x36')](_0x2103a9[_0x1d89('0x32')],qs['fields'](_0x55668a[_0x1d89('0x34')][_0x1d89('0x38')]));_0x55c4b5[_0x1d89('0x37')]=_0x55c4b5[_0x1d89('0x37')]['length']?_0x55c4b5[_0x1d89('0x37')]:_0x2103a9[_0x1d89('0x32')];if(_0x55668a[_0x1d89('0x34')][_0x1d89('0x44')]){_0x55c4b5[_0x1d89('0x45')]=[{'all':!![]}];}_0x55c4b5=_[_0x1d89('0x42')]({},_0x55c4b5,_0x55668a[_0x1d89('0x43')]);return db[_0x1d89('0x2e')]['find'](_0x55c4b5)[_0x1d89('0x26')](handleEntityNotFound(_0x468964,null))[_0x1d89('0x26')](respondWithResult(_0x468964,null))[_0x1d89('0x4a')](handleError(_0x468964,null));};exports[_0x1d89('0x4b')]=function(_0x191f01,_0x425bf0){return db[_0x1d89('0x2e')][_0x1d89('0x4b')](_0x191f01[_0x1d89('0x4c')],{})[_0x1d89('0x26')](respondWithResult(_0x425bf0,0xc9))[_0x1d89('0x4a')](handleError(_0x425bf0,null));};exports['update']=function(_0x3db164,_0x2faa9b){if(_0x3db164[_0x1d89('0x4c')]['id']){delete _0x3db164['body']['id'];}return db[_0x1d89('0x2e')][_0x1d89('0x4d')]({'where':{'id':_0x3db164[_0x1d89('0x49')]['id']}})['then'](handleEntityNotFound(_0x2faa9b,null))['then'](saveUpdates(_0x3db164[_0x1d89('0x4c')],null))['then'](respondWithResult(_0x2faa9b,null))[_0x1d89('0x4a')](handleError(_0x2faa9b,null));};exports[_0x1d89('0x4e')]=function(_0x422556,_0xfbbc57){return db[_0x1d89('0x2e')][_0x1d89('0x4d')]({'where':{'id':_0x422556[_0x1d89('0x49')]['id']}})[_0x1d89('0x26')](handleEntityNotFound(_0xfbbc57,null))['then'](removeEntity(_0xfbbc57,null))[_0x1d89('0x4a')](handleError(_0xfbbc57,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 402ed3c..1a01760 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 _0x1e0f=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0xd75eec,_0xf6aa2c){var _0x548dc3=function(_0x50a994){while(--_0x50a994){_0xd75eec['push'](_0xd75eec['shift']());}};_0x548dc3(++_0xf6aa2c);}(_0x1e0f,0x107));var _0xf1e0=function(_0x4b509b,_0x4913a8){_0x4b509b=_0x4b509b-0x0;var _0x496ba4=_0x1e0f[_0x4b509b];return _0x496ba4;};'use strict';var _=require(_0xf1e0('0x0'));var util=require('util');var logger=require(_0xf1e0('0x1'))(_0xf1e0('0x2'));var moment=require('moment');var BPromise=require(_0xf1e0('0x3'));var rp=require(_0xf1e0('0x4'));var fs=require('fs');var path=require(_0xf1e0('0x5'));var rimraf=require(_0xf1e0('0x6'));var config=require(_0xf1e0('0x7'));var attributes=require(_0xf1e0('0x8'));module[_0xf1e0('0x9')]=function(_0x2c51ca,_0x2348a7){return _0x2c51ca[_0xf1e0('0xa')](_0xf1e0('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf1e0('0xc'),'collate':_0xf1e0('0xd')});}; \ No newline at end of file +var _0xe616=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x4dd290,_0x5c59aa){var _0x435719=function(_0x3d5885){while(--_0x3d5885){_0x4dd290['push'](_0x4dd290['shift']());}};_0x435719(++_0x5c59aa);}(_0xe616,0xb9));var _0x6e61=function(_0x4b1968,_0x32db7a){_0x4b1968=_0x4b1968-0x0;var _0x45124e=_0xe616[_0x4b1968];return _0x45124e;};'use strict';var _=require(_0x6e61('0x0'));var util=require('util');var logger=require(_0x6e61('0x1'))(_0x6e61('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e61('0x3'));var rimraf=require(_0x6e61('0x4'));var config=require(_0x6e61('0x5'));var attributes=require(_0x6e61('0x6'));module[_0x6e61('0x7')]=function(_0x39aab9,_0x525949){return _0x39aab9[_0x6e61('0x8')](_0x6e61('0x9'),attributes,{'tableName':_0x6e61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6e61('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 66617be..e85d23a 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 _0x9b6d=['request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3e3731,_0x29a0e7){var _0x3642e9=function(_0x3083bf){while(--_0x3083bf){_0x3e3731['push'](_0x3e3731['shift']());}};_0x3642e9(++_0x29a0e7);}(_0x9b6d,0x134));var _0xd9b6=function(_0x389af0,_0x55b0dd){_0x389af0=_0x389af0-0x0;var _0x42ac09=_0x9b6d[_0x389af0];return _0x42ac09;};'use strict';var _=require(_0xd9b6('0x0'));var util=require(_0xd9b6('0x1'));var moment=require(_0xd9b6('0x2'));var BPromise=require(_0xd9b6('0x3'));var rs=require(_0xd9b6('0x4'));var fs=require('fs');var Redis=require(_0xd9b6('0x5'));var db=require(_0xd9b6('0x6'))['db'];var utils=require(_0xd9b6('0x7'));var logger=require(_0xd9b6('0x8'))(_0xd9b6('0x9'));var config=require(_0xd9b6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd9b6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbe10b6,_0x52c291,_0x32786e){return new BPromise(function(_0x2c380e,_0xaae923){return client[_0xd9b6('0xc')](_0xbe10b6,_0x32786e)[_0xd9b6('0xd')](function(_0x389476){logger['info'](_0xd9b6('0xe'),_0x52c291,'request\x20sent');logger[_0xd9b6('0xf')](_0xd9b6('0x10'),_0x52c291,'request\x20sent',JSON['stringify'](_0x389476));if(_0x389476[_0xd9b6('0x11')]){if(_0x389476['error'][_0xd9b6('0x12')]===0x1f4){logger[_0xd9b6('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x52c291,_0x389476['error'][_0xd9b6('0x13')]);return _0xaae923(_0x389476[_0xd9b6('0x11')][_0xd9b6('0x13')]);}logger[_0xd9b6('0x11')](_0xd9b6('0xe'),_0x52c291,_0x389476[_0xd9b6('0x11')][_0xd9b6('0x13')]);return _0x2c380e(_0x389476[_0xd9b6('0x11')][_0xd9b6('0x13')]);}else{logger[_0xd9b6('0x14')](_0xd9b6('0xe'),_0x52c291,_0xd9b6('0x15'));_0x2c380e(_0x389476['result'][_0xd9b6('0x13')]);}})[_0xd9b6('0x16')](function(_0x5722bf){logger[_0xd9b6('0x11')](_0xd9b6('0xe'),_0x52c291,_0x5722bf);_0xaae923(_0x5722bf);});});}exports[_0xd9b6('0x17')]=function(_0xc5e544){var _0x4729c5=this;return new Promise(function(_0x4f9839,_0x41d402){return db['OpenchannelApplication'][_0xd9b6('0x18')](_0xc5e544[_0xd9b6('0x19')],{'raw':_0xc5e544['options']?_0xc5e544[_0xd9b6('0x1a')][_0xd9b6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc5e544[_0xd9b6('0x1a')]?_0xc5e544[_0xd9b6('0x1a')][_0xd9b6('0x1c')]||null:null,'attributes':_0xc5e544['options']?_0xc5e544[_0xd9b6('0x1a')][_0xd9b6('0x1d')]||null:null,'limit':_0xc5e544[_0xd9b6('0x1a')]?_0xc5e544[_0xd9b6('0x1a')][_0xd9b6('0x1e')]||null:null})[_0xd9b6('0xd')](function(_0x5e4c02){logger[_0xd9b6('0x14')]('UpdateOpenchannelApplication',_0xc5e544);logger['debug'](_0xd9b6('0x17'),_0xc5e544,JSON[_0xd9b6('0x1f')](_0x5e4c02));_0x4f9839(_0x5e4c02);})[_0xd9b6('0x16')](function(_0x33dd93){logger[_0xd9b6('0x11')]('UpdateOpenchannelApplication',_0x33dd93[_0xd9b6('0x13')],_0xc5e544);_0x41d402(_0x4729c5[_0xd9b6('0x11')](0x1f4,_0x33dd93[_0xd9b6('0x13')]));});});}; \ No newline at end of file +var _0x7e52=['lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','catch'];(function(_0x2f07c4,_0x50a530){var _0x307a5c=function(_0x296d3f){while(--_0x296d3f){_0x2f07c4['push'](_0x2f07c4['shift']());}};_0x307a5c(++_0x50a530);}(_0x7e52,0x87));var _0x27e5=function(_0x140ff9,_0x40d9f1){_0x140ff9=_0x140ff9-0x0;var _0x2f86db=_0x7e52[_0x140ff9];return _0x2f86db;};'use strict';var _=require(_0x27e5('0x0'));var util=require(_0x27e5('0x1'));var moment=require('moment');var BPromise=require(_0x27e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27e5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27e5('0x4'));var logger=require(_0x27e5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x27e5('0x6'));var client=jayson['client'][_0x27e5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d5075,_0x28c32a,_0x10112a){return new BPromise(function(_0x35aaf0,_0x267926){return client[_0x27e5('0x8')](_0x2d5075,_0x10112a)[_0x27e5('0x9')](function(_0x25b169){logger['info'](_0x27e5('0xa'),_0x28c32a,'request\x20sent');logger[_0x27e5('0xb')](_0x27e5('0xc'),_0x28c32a,'request\x20sent',JSON[_0x27e5('0xd')](_0x25b169));if(_0x25b169[_0x27e5('0xe')]){if(_0x25b169['error']['code']===0x1f4){logger[_0x27e5('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x28c32a,_0x25b169[_0x27e5('0xe')][_0x27e5('0xf')]);return _0x267926(_0x25b169[_0x27e5('0xe')][_0x27e5('0xf')]);}logger[_0x27e5('0xe')](_0x27e5('0xa'),_0x28c32a,_0x25b169['error'][_0x27e5('0xf')]);return _0x35aaf0(_0x25b169['error'][_0x27e5('0xf')]);}else{logger[_0x27e5('0x10')](_0x27e5('0xa'),_0x28c32a,'request\x20sent');_0x35aaf0(_0x25b169[_0x27e5('0x11')][_0x27e5('0xf')]);}})['catch'](function(_0x35175f){logger[_0x27e5('0xe')](_0x27e5('0xa'),_0x28c32a,_0x35175f);_0x267926(_0x35175f);});});}exports[_0x27e5('0x12')]=function(_0x7c4f5b){var _0x42b28e=this;return new Promise(function(_0x489b68,_0x31fd36){return db[_0x27e5('0x13')][_0x27e5('0x14')](_0x7c4f5b[_0x27e5('0x15')],{'raw':_0x7c4f5b[_0x27e5('0x16')]?_0x7c4f5b[_0x27e5('0x16')][_0x27e5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7c4f5b['options']?_0x7c4f5b['options'][_0x27e5('0x18')]||null:null,'attributes':_0x7c4f5b[_0x27e5('0x16')]?_0x7c4f5b[_0x27e5('0x16')][_0x27e5('0x19')]||null:null,'limit':_0x7c4f5b[_0x27e5('0x16')]?_0x7c4f5b['options']['limit']||null:null})[_0x27e5('0x9')](function(_0x2a84db){logger[_0x27e5('0x10')](_0x27e5('0x12'),_0x7c4f5b);logger[_0x27e5('0xb')](_0x27e5('0x12'),_0x7c4f5b,JSON['stringify'](_0x2a84db));_0x489b68(_0x2a84db);})[_0x27e5('0x1a')](function(_0x57e30a){logger['error'](_0x27e5('0x12'),_0x57e30a[_0x27e5('0xf')],_0x7c4f5b);_0x31fd36(_0x42b28e[_0x27e5('0xe')](0x1f4,_0x57e30a[_0x27e5('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 7dcd278..4a75ae2 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 _0x2955=['post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','removeTags','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','getMessages','/:id/download','download','create'];(function(_0x1ed514,_0x215241){var _0x1eec63=function(_0x48a69f){while(--_0x48a69f){_0x1ed514['push'](_0x1ed514['shift']());}};_0x1eec63(++_0x215241);}(_0x2955,0x94));var _0x5295=function(_0x55d97d,_0x240d36){_0x55d97d=_0x55d97d-0x0;var _0x2f43f6=_0x2955[_0x55d97d];return _0x2f43f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5295('0x0'));var timeout=require('connect-timeout');var express=require(_0x5295('0x1'));var router=express[_0x5295('0x2')]();var fs_extra=require(_0x5295('0x3'));var auth=require(_0x5295('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5295('0x5'));var controller=require('./openchannelInteraction.controller');router[_0x5295('0x6')]('/',auth[_0x5295('0x7')](),controller['index']);router[_0x5295('0x6')](_0x5295('0x8'),auth[_0x5295('0x7')](),controller['describe']);router[_0x5295('0x6')](_0x5295('0x9'),auth[_0x5295('0x7')](),controller['show']);router['get']('/:id/messages',auth[_0x5295('0x7')](),controller[_0x5295('0xa')]);router[_0x5295('0x6')](_0x5295('0xb'),auth[_0x5295('0x7')](),controller[_0x5295('0xc')]);router['post']('/',auth[_0x5295('0x7')](),controller[_0x5295('0xd')]);router[_0x5295('0xe')](_0x5295('0xf'),auth[_0x5295('0x7')](),controller[_0x5295('0x10')]);router[_0x5295('0xe')](_0x5295('0x11'),auth[_0x5295('0x7')](),interaction[_0x5295('0x12')](_0x5295('0x13'),_0x5295('0x14')),controller[_0x5295('0x15')]);router[_0x5295('0x16')](_0x5295('0x9'),auth[_0x5295('0x7')](),interaction[_0x5295('0x12')](_0x5295('0x13'),_0x5295('0x17')),controller[_0x5295('0x18')]);router[_0x5295('0x19')](_0x5295('0x9'),auth[_0x5295('0x7')](),interaction['tracked'](_0x5295('0x13'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x5295('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x5295('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x19eb=['util','path','connect-timeout','express','fs-extra','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','update','openchannelinteraction:destroy','destroy','delete','exports'];(function(_0x28509b,_0x5831ff){var _0x1e0b6=function(_0x37d8a2){while(--_0x37d8a2){_0x28509b['push'](_0x28509b['shift']());}};_0x1e0b6(++_0x5831ff);}(_0x19eb,0x1e6));var _0xb19e=function(_0x5c65ee,_0x57b017){_0x5c65ee=_0x5c65ee-0x0;var _0x4b8689=_0x19eb[_0x5c65ee];return _0x4b8689;};'use strict';var multer=require('multer');var util=require(_0xb19e('0x0'));var path=require(_0xb19e('0x1'));var timeout=require(_0xb19e('0x2'));var express=require(_0xb19e('0x3'));var router=express['Router']();var fs_extra=require(_0xb19e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xb19e('0x5')]('/',auth[_0xb19e('0x6')](),controller['index']);router[_0xb19e('0x5')](_0xb19e('0x7'),auth[_0xb19e('0x6')](),controller[_0xb19e('0x8')]);router['get'](_0xb19e('0x9'),auth[_0xb19e('0x6')](),controller['show']);router[_0xb19e('0x5')](_0xb19e('0xa'),auth['isAuthenticated'](),controller[_0xb19e('0xb')]);router[_0xb19e('0x5')](_0xb19e('0xc'),auth['isAuthenticated'](),controller[_0xb19e('0xd')]);router[_0xb19e('0xe')]('/',auth[_0xb19e('0x6')](),controller[_0xb19e('0xf')]);router[_0xb19e('0xe')](_0xb19e('0xa'),auth[_0xb19e('0x6')](),controller[_0xb19e('0x10')]);router[_0xb19e('0xe')](_0xb19e('0x11'),auth[_0xb19e('0x6')](),interaction[_0xb19e('0x12')](_0xb19e('0x13'),_0xb19e('0x14')),controller['addTags']);router[_0xb19e('0x15')](_0xb19e('0x9'),auth[_0xb19e('0x6')](),interaction[_0xb19e('0x12')](_0xb19e('0x13'),'openchannelinteraction:update'),controller[_0xb19e('0x16')]);router['delete'](_0xb19e('0x9'),auth[_0xb19e('0x6')](),interaction[_0xb19e('0x12')]('openchannel',_0xb19e('0x17')),controller[_0xb19e('0x18')]);router[_0xb19e('0x19')](_0xb19e('0x11'),auth[_0xb19e('0x6')](),controller['removeTags']);module[_0xb19e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index fb3908b..9fe21a8 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 _0xd0e7=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x2cd976,_0x302575){var _0x1f37cb=function(_0xa8f067){while(--_0xa8f067){_0x2cd976['push'](_0x2cd976['shift']());}};_0x1f37cb(++_0x302575);}(_0xd0e7,0x10d));var _0x7d0e=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0xd0e7[_0x5b8b97];return _0x1fdf84;};'use strict';var Sequelize=require(_0x7d0e('0x0'));module[_0x7d0e('0x1')]={'closed':{'type':Sequelize[_0x7d0e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d0e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7d0e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7d0e('0x4')]},'note':{'type':Sequelize[_0x7d0e('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7d0e('0x4')]},'lastMsgAt':{'type':Sequelize[_0x7d0e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7d0e('0x5')]('in',_0x7d0e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7d0e('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x7d0e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1daf=['sequelize','DATE','STRING','ENUM','BOOLEAN'];(function(_0x151583,_0x2333fb){var _0x4b0f4e=function(_0x46736d){while(--_0x46736d){_0x151583['push'](_0x151583['shift']());}};_0x4b0f4e(++_0x2333fb);}(_0x1daf,0x17c));var _0xf1da=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1daf[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xf1da('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf1da('0x1')]},'disposition':{'type':Sequelize[_0xf1da('0x2')]},'secondDisposition':{'type':Sequelize[_0xf1da('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf1da('0x2')]},'read1stAt':{'type':Sequelize[_0xf1da('0x1')]},'threadId':{'type':Sequelize[_0xf1da('0x2')]},'externalUrl':{'type':Sequelize[_0xf1da('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf1da('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xf1da('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 07db7ad..1432534 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 _0x5f15=['SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','catch','show','includeAll','options','create','body','update','params','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','include','setTags','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','join','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','threadId','Private','basename','existsSync','createReadStream','createWriteStream','out','renderFile','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','Users','map','fullname','Tags','TagIds','forEach','push','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','length','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)','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','keys','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes'];(function(_0x3ae685,_0x55dea6){var _0x57359b=function(_0x4bc7f9){while(--_0x4bc7f9){_0x3ae685['push'](_0x3ae685['shift']());}};_0x57359b(++_0x55dea6);}(_0x5f15,0x148));var _0x55f1=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5f15[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x55f1('0x0'));var rimraf=require(_0x55f1('0x1'));var zipdir=require(_0x55f1('0x2'));var jsonpatch=require(_0x55f1('0x3'));var rp=require(_0x55f1('0x4'));var moment=require('moment');var BPromise=require(_0x55f1('0x5'));var Mustache=require(_0x55f1('0x6'));var util=require(_0x55f1('0x7'));var path=require(_0x55f1('0x8'));var sox=require('sox');var csv=require(_0x55f1('0x9'));var ejs=require(_0x55f1('0xa'));var fs=require('fs');var fs_extra=require(_0x55f1('0xb'));var _=require(_0x55f1('0xc'));var squel=require(_0x55f1('0xd'));var crypto=require(_0x55f1('0xe'));var jsforce=require(_0x55f1('0xf'));var deskjs=require(_0x55f1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x55f1('0x11'));var Papa=require(_0x55f1('0x12'));var Redis=require(_0x55f1('0x13'));var authService=require(_0x55f1('0x14'));var qs=require(_0x55f1('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x55f1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55f1('0x17'))('api');var utils=require(_0x55f1('0x18'));var config=require(_0x55f1('0x19'));var licenseUtil=require(_0x55f1('0x1a'));var db=require(_0x55f1('0x1b'))['db'];config['redis']=_[_0x55f1('0x1c')](config[_0x55f1('0x1d')],{'host':_0x55f1('0x1e'),'port':0x18eb});var socket=require(_0x55f1('0x1f'))(new Redis(config[_0x55f1('0x1d')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1b52b4,_0x969f4){_0x969f4=_0x969f4||0xcc;return function(_0x39880b){if(_0x39880b){return _0x1b52b4[_0x55f1('0x20')](_0x969f4);}return _0x1b52b4[_0x55f1('0x21')](_0x969f4)[_0x55f1('0x22')]();};}function respondWithResult(_0x4d6c28,_0x3e6da1){_0x3e6da1=_0x3e6da1||0xc8;return function(_0x1f19c4){if(_0x1f19c4){return _0x4d6c28[_0x55f1('0x21')](_0x3e6da1)[_0x55f1('0x23')](_0x1f19c4);}};}function respondWithFilteredResult(_0x3e7b48,_0x44fa09){return function(_0x3fa3ad){if(_0x3fa3ad){var _0x2291d4=typeof _0x44fa09[_0x55f1('0x24')]==='undefined'&&typeof _0x44fa09[_0x55f1('0x25')]==='undefined';var _0x2617c9=_0x3fa3ad[_0x55f1('0x26')];var _0x46ea3f=_0x2291d4?0x0:_0x44fa09['offset'];var _0x5ad5da=_0x2291d4?_0x3fa3ad['count']:_0x44fa09[_0x55f1('0x24')]+_0x44fa09['limit'];var _0x15f539;if(_0x5ad5da>=_0x2617c9){_0x5ad5da=_0x2617c9;_0x15f539=0xc8;}else{_0x15f539=0xce;}_0x3e7b48[_0x55f1('0x21')](_0x15f539);return _0x3e7b48['set'](_0x55f1('0x27'),_0x46ea3f+'-'+_0x5ad5da+'/'+_0x2617c9)[_0x55f1('0x23')](_0x3fa3ad);}return null;};}function patchUpdates(_0x528f63){return function(_0x1e42b1){try{jsonpatch[_0x55f1('0x28')](_0x1e42b1,_0x528f63,!![]);}catch(_0x3fd91e){return BPromise[_0x55f1('0x29')](_0x3fd91e);}return _0x1e42b1[_0x55f1('0x2a')]();};}function saveUpdates(_0x464a4a,_0x4b8667){return function(_0x1bd3be){if(_0x1bd3be){return _0x1bd3be['update'](_0x464a4a)[_0x55f1('0x2b')](function(_0x3e50c3){return _0x3e50c3;});}return null;};}function removeEntity(_0x271130,_0x1215fb){return function(_0x5609cf){if(_0x5609cf){return _0x5609cf[_0x55f1('0x2c')]()[_0x55f1('0x2b')](function(){_0x271130['status'](0xcc)[_0x55f1('0x22')]();});}};}function handleEntityNotFound(_0x5183e6,_0x2e47ed){return function(_0x367da9){if(!_0x367da9){_0x5183e6[_0x55f1('0x20')](0x194);}return _0x367da9;};}function handleError(_0x5a2123,_0x9d996e){_0x9d996e=_0x9d996e||0x1f4;return function(_0x42cb94){logger[_0x55f1('0x2d')](_0x42cb94['stack']);if(_0x42cb94[_0x55f1('0x2e')]){delete _0x42cb94['name'];}_0x5a2123[_0x55f1('0x21')](_0x9d996e)[_0x55f1('0x2f')](_0x42cb94);};}function getInteractionUsers(_0x4a5b89,_0x5efe9c){return new BPromise(function(_0xc79d30,_0x561179){try{if(_0x5efe9c[_0x4a5b89['id']]){_0x4a5b89[_0x55f1('0x30')]=_[_0x55f1('0x31')](_0x5efe9c[_0x4a5b89['id']],function(_0xcb271f){return{'id':_0xcb271f['id'],'fullname':_0xcb271f[_0x55f1('0x32')]};});}}catch(_0x23c46c){_0x561179(_0x23c46c);}_0xc79d30(_0x4a5b89);});}function getInteractionTags(_0x3f44ad,_0x565ee8){return new BPromise(function(_0x33b6c3,_0x4fd0ef){try{if(_0x3f44ad['TagIds']){_0x3f44ad[_0x55f1('0x33')]=[];_0x3f44ad[_0x55f1('0x34')]['split'](',')[_0x55f1('0x35')](function(_0x3d66f2){_0x3f44ad[_0x55f1('0x33')][_0x55f1('0x36')](_0x565ee8[_0x3d66f2]);});}delete _0x3f44ad[_0x55f1('0x34')];}catch(_0x2a1f33){_0x4fd0ef(_0x2a1f33);}_0x33b6c3(_0x3f44ad);});}function updateOpenchannelInteraction(_0x139516,_0x2c8f33,_0x1dfa75){return new BPromise(function(_0x2058ea,_0x48ec61){return getInteractionUsers(_0x139516,_0x1dfa75)[_0x55f1('0x2b')](function(_0xfc0b5b){return getInteractionTags(_0xfc0b5b,_0x2c8f33);})[_0x55f1('0x2b')](function(_0x30865d){_0x2058ea(_0x30865d);})['catch'](function(_0x55989b){_0x48ec61(_0x55989b);});});}exports[_0x55f1('0x37')]=function(_0x49328a,_0x1db0e0){var _0x3813f7={},_0x28aee4={},_0x1cfb87={'count':0x0,'rows':[]};var _0x3eebdf=_[_0x55f1('0x31')](db[_0x55f1('0x38')][_0x55f1('0x39')],function(_0xeed462){return{'name':_0xeed462[_0x55f1('0x3a')],'type':_0xeed462[_0x55f1('0x3b')][_0x55f1('0x3c')]};});_0x28aee4[_0x55f1('0x3d')]=_[_0x55f1('0x31')](_0x3eebdf,_0x55f1('0x2e'));_0x28aee4[_0x55f1('0x3e')]=_['keys'](_0x49328a[_0x55f1('0x3e')]);_0x28aee4[_0x55f1('0x3f')]=_[_0x55f1('0x40')](_0x28aee4['model'],_0x28aee4[_0x55f1('0x3e')]);_0x3813f7[_0x55f1('0x41')]=_[_0x55f1('0x40')](_0x28aee4[_0x55f1('0x3d')],qs[_0x55f1('0x42')](_0x49328a[_0x55f1('0x3e')][_0x55f1('0x42')]));_0x3813f7[_0x55f1('0x41')]=_0x3813f7['attributes']['length']?_0x3813f7[_0x55f1('0x41')]:_0x28aee4[_0x55f1('0x3d')];if(!_0x49328a['query'][_0x55f1('0x43')](_0x55f1('0x44'))){_0x3813f7[_0x55f1('0x25')]=qs[_0x55f1('0x25')](_0x49328a['query'][_0x55f1('0x25')]);_0x3813f7['offset']=qs[_0x55f1('0x24')](_0x49328a[_0x55f1('0x3e')][_0x55f1('0x24')]);}_0x3813f7[_0x55f1('0x45')]=qs[_0x55f1('0x46')](_0x49328a['query'][_0x55f1('0x46')]);_0x3813f7['where']=qs[_0x55f1('0x3f')](_[_0x55f1('0x47')](_0x49328a[_0x55f1('0x3e')],_0x28aee4[_0x55f1('0x3f')]),_0x3eebdf);var _0x48b7c7=[];var _0x3b8344=squel[_0x55f1('0x48')]()['field']('id')[_0x55f1('0x49')]('name')[_0x55f1('0x49')](_0x55f1('0x4a'))[_0x55f1('0x4b')](_0x55f1('0x4c'));var _0x3f677a=squel[_0x55f1('0x48')]()[_0x55f1('0x49')]('u.id')[_0x55f1('0x49')](_0x55f1('0x4d'))[_0x55f1('0x49')](_0x55f1('0x4e'))[_0x55f1('0x4b')](_0x55f1('0x4f'),'ui')['left_join'](_0x55f1('0x50'),'u',_0x55f1('0x51'));var _0x3da7fe=squel[_0x55f1('0x48')]()[_0x55f1('0x4b')](_0x55f1('0x52'),'i')[_0x55f1('0x53')](_0x55f1('0x54'),'c',_0x55f1('0x55'))[_0x55f1('0x53')](_0x55f1('0x50'),'o',_0x55f1('0x56'))[_0x55f1('0x53')](_0x55f1('0x57'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x55f1('0x53')](_0x55f1('0x58'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x55f1('0x53')](_0x55f1('0x4c'),'t',_0x55f1('0x59'));var _0x34c516=squel['expr']();var _0x3038e8=[];var _0x1fac64=squel[_0x55f1('0x5a')]();var _0x14c9cc;if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x5b')]){_0x14c9cc=as['parseSearch'](_0x49328a['query'][_0x55f1('0x5b')]);var _0xc2fb31=_0x14c9cc[_0x55f1('0x5c')];for(var _0x513427=0x0;_0x513427<_0x14c9cc['conditions'][_0x55f1('0x5d')];_0x513427++){var _0xd6cb69=_0x14c9cc[_0x55f1('0x5e')][_0x513427];var _0x2e41ed='i';var _0x49d241=_[_0x55f1('0x5f')](_0x3eebdf,['name',_0xd6cb69['field']]);if(!_0x49d241){switch(_0xd6cb69[_0x55f1('0x49')]){case _0x55f1('0x60'):if(_0xd6cb69[_0x55f1('0x61')]==0x1){_0x3da7fe[_0x55f1('0x62')]('`'+_0xd6cb69['field']+_0x55f1('0x63'));}else{_0x3da7fe[_0x55f1('0x62')]('`'+_0xd6cb69['field']+_0x55f1('0x64'));}break;case _0x55f1('0x65'):if(_0xd6cb69[_0x55f1('0x66')]===_0x55f1('0x67')){if(_0xd6cb69['value']['split']('\x20')[_0x55f1('0x5d')]>0x1){_0x34c516[_0xc2fb31](_0x55f1('0x68'),qs['getFullTextValue'](_0xd6cb69[_0x55f1('0x61')]),null);}else{var _0x16bd86='%'+_0xd6cb69[_0x55f1('0x61')]+'%';_0x34c516[_0xc2fb31]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x16bd86,_0x16bd86,_0x16bd86);}}else{_0x49d241=_[_0x55f1('0x5f')](_0x3eebdf,[_0x55f1('0x2e'),_0x55f1('0x69')]);_0xd6cb69['field']=_0x55f1('0x69');_0x191e88=as['buildExpression'](_0x2e41ed,_0x49d241[_0x55f1('0x3b')],_0xd6cb69);_0x34c516[_0xc2fb31](_0x191e88[_0x55f1('0x6a')],_0x191e88[_0x55f1('0x61')][_0x55f1('0x6b')],_0x191e88[_0x55f1('0x61')]['end']);}break;case _0x55f1('0x6c'):var _0x1fbb80=_0xd6cb69['value']['split'](',')[_0x55f1('0x31')](function(_0x162aff){return Number(_0x162aff);});_0x1fbb80['forEach'](function(_0x17cdec){_0x1fac64['or'](_0x55f1('0x6d'),'%,'+_0x17cdec+',%');});_0x3038e8=_[_0x55f1('0x6e')](_0x3038e8,_0x1fbb80);break;case _0x55f1('0x6f'):if(_0xd6cb69[_0x55f1('0x66')]===_0x55f1('0x67')){_0x34c516[_0xc2fb31]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xd6cb69['value']+'%',null);}else{_0x49d241=_[_0x55f1('0x5f')](_0x3eebdf,['name','UserId']);_0xd6cb69[_0x55f1('0x49')]=_0x55f1('0x70');_0x191e88=as[_0x55f1('0x71')](_0x2e41ed,_0x49d241[_0x55f1('0x3b')],_0xd6cb69);_0x34c516[_0xc2fb31](_0x191e88['text'],_0x191e88['value'][_0x55f1('0x6b')],_0x191e88['value'][_0x55f1('0x22')]);}break;case'body':_0x191e88=as[_0x55f1('0x71')]('me',null,_0xd6cb69);_0x34c516[_0xc2fb31](_0x191e88[_0x55f1('0x6a')],_0x191e88[_0x55f1('0x61')][_0x55f1('0x6b')],_0x191e88[_0x55f1('0x61')][_0x55f1('0x22')]);break;}}else{var _0x191e88=as[_0x55f1('0x71')](_0x2e41ed,_0x49d241['type'],_0xd6cb69);_0x34c516[_0xc2fb31](_0x191e88['text'],_0x191e88[_0x55f1('0x61')]['start'],_0x191e88[_0x55f1('0x61')]['end']);}}}else{var _0x95dbe2=_(_0x49328a[_0x55f1('0x3e')])[_0x55f1('0x72')]()[_0x55f1('0x31')](function(_0x5ed330){return _[_0x55f1('0x73')](_0x3eebdf,[_0x55f1('0x2e'),_0x5ed330])?_0x5ed330:undefined;})[_0x55f1('0x74')]()['value']();if(!_[_0x55f1('0x75')](_0x95dbe2)){_0x95dbe2[_0x55f1('0x35')](function(_0x2e8f5e){if(_0x2e8f5e===_0x55f1('0x76')){_0x3da7fe['where'](_0x55f1('0x77'),[]['concat'](_0x49328a[_0x55f1('0x3e')][_0x2e8f5e]));}else if(_0x2e8f5e===_0x55f1('0x78')){var _0x11cd14=JSON[_0x55f1('0x79')](_0x49328a['query'][_0x2e8f5e])[_0x55f1('0x7a')];var _0x19c8b1=JSON['parse'](_0x49328a[_0x55f1('0x3e')][_0x2e8f5e])['$lte'];_0x3da7fe[_0x55f1('0x7b')](_0x55f1('0x7c'),_0x11cd14,_0x19c8b1);}else{if(_0x49328a[_0x55f1('0x3e')][_0x2e8f5e]===_0x55f1('0x7d')){_0x3da7fe[_0x55f1('0x7b')]('i.'+_0x2e8f5e+'\x20IS\x20NULL');}else{_0x3da7fe[_0x55f1('0x7b')]('i.'+_0x2e8f5e+_0x55f1('0x7e'),_0x49328a[_0x55f1('0x3e')][_0x2e8f5e]);}}});}if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x7f')]){if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x7f')]==0x1){_0x3da7fe[_0x55f1('0x62')](_0x55f1('0x80'));}else{_0x3da7fe['having'](_0x55f1('0x81'));}}if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x82')]){_0x3038e8=_[_0x55f1('0x83')](_0x49328a[_0x55f1('0x3e')][_0x55f1('0x82')])?_0x49328a['query'][_0x55f1('0x82')]:new Array(_0x49328a['query'][_0x55f1('0x82')]);_0x3038e8[_0x55f1('0x35')](function(_0x493a48){_0x1fac64['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x493a48+',%');});}if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x84')]){var _0x583dd0=_0x49328a[_0x55f1('0x3e')][_0x55f1('0x84')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x55f1('0x85')](_0x583dd0)){_0x34c516['or'](_0x55f1('0x86'),_0x583dd0+'%');}else{_0x34c516['or'](_0x55f1('0x87'),qs['getFullTextValue'](_0x583dd0))['or'](_0x55f1('0x88'),_0x583dd0+'%')['or'](_0x55f1('0x89'),_0x583dd0+'%');}}}_0x3da7fe[_0x55f1('0x7b')](_0x34c516);_0x3da7fe[_0x55f1('0x8a')](_0x55f1('0x8b'));var _0x5a75e6={'type':db[_0x55f1('0x8c')][_0x55f1('0x8d')]['SELECT'],'raw':!![]};var _0x491300=_0x3da7fe['clone']();_0x491300[_0x55f1('0x49')]('i.id');_0x491300[_0x55f1('0x49')](_0x55f1('0x8e'),_0x55f1('0x60'));if(_0x3813f7['order']){_0x3813f7['order'][_0x55f1('0x35')](function(_0x7b040a){var _0xca9dff=_0x7b040a[0x0]===_0x55f1('0x8f')?_0x7b040a[0x0]:'i.'+_0x7b040a[0x0];_0x3da7fe['order'](_0xca9dff,_0x7b040a[0x1]===_0x55f1('0x90')?![]:!![]);});}if(!_[_0x55f1('0x75')](_0x3038e8)){_0x3da7fe[_0x55f1('0x62')](_0x1fac64);_0x491300[_0x55f1('0x7b')](_0x55f1('0x91'),_0x3038e8);}BPromise[_0x55f1('0x92')]()[_0x55f1('0x2b')](function(){if(!_0x14c9cc){if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x76')])return;_0x491300['where'](_0x55f1('0x93'));_0x3da7fe[_0x55f1('0x7b')](_0x55f1('0x93'));return;}if(_0x49328a['user']['role']!=='agent')return;return _0x49328a[_0x55f1('0x94')][_0x55f1('0x95')]({'attributes':['id'],'raw':!![]})[_0x55f1('0x2b')](function(_0x15a628){if(_['isEmpty'](_0x15a628)){_0x491300[_0x55f1('0x7b')](_0x55f1('0x96'));_0x3da7fe['where'](_0x55f1('0x96'));}else{_0x491300['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x55f1('0x31')](_0x15a628,'id'));_0x3da7fe[_0x55f1('0x7b')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x15a628,'id'));}});})[_0x55f1('0x2b')](function(){if(_0x49328a[_0x55f1('0x94')][_0x55f1('0x97')]===_0x55f1('0x98')&&!_0x14c9cc&&!_0x49328a['query'][_0x55f1('0x76')])return[];return db[_0x55f1('0x99')][_0x55f1('0x3e')](_0x491300[_0x55f1('0x9a')](),_0x5a75e6);})['then'](function(_0x49938a){_0x1cfb87[_0x55f1('0x26')]=_0x49938a['length'];if(_0x1cfb87[_0x55f1('0x26')]===0x0)return[];return db[_0x55f1('0x99')][_0x55f1('0x3e')](_0x3b8344[_0x55f1('0x9a')](),_0x5a75e6)[_0x55f1('0x2b')](function(_0x3f22de){_0x48b7c7=_[_0x55f1('0x9b')](_0x3f22de,'id');_0x5a75e6=_[_0x55f1('0x9c')](_0x5a75e6,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x42')]){_0x3813f7[_0x55f1('0x41')]['forEach'](function(_0x39a3a1){_0x3da7fe['field']('i.'+_0x39a3a1);});}else{_0x3da7fe['field'](_0x55f1('0x8e'),'unreadMessages');_0x3da7fe[_0x55f1('0x49')]('a.key',_0x55f1('0x9d'));_0x3da7fe[_0x55f1('0x49')](_0x55f1('0x9e'),_0x55f1('0x9f'));_0x3da7fe['field'](_0x55f1('0xa0'),'contactName');_0x3da7fe[_0x55f1('0x49')]('i.*');_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xa1'),'Contact.firstName');_0x3da7fe['field'](_0x55f1('0xa2'),_0x55f1('0xa3'));_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xa4'),_0x55f1('0xa5'));_0x3da7fe['field']('c.phone','Contact.phone');_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xa6'),_0x55f1('0xa7'));_0x3da7fe['field'](_0x55f1('0xa8'),'Contact.fax');_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xa9'),'Owner.fullname');_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xaa'),_0x55f1('0xab'));_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xac'),_0x55f1('0x34'));}if(_0x3813f7[_0x55f1('0x25')])_0x3da7fe[_0x55f1('0x25')](_0x3813f7[_0x55f1('0x25')]);if(_0x3813f7[_0x55f1('0x24')])_0x3da7fe['offset'](_0x3813f7[_0x55f1('0x24')]);return db['sequelize'][_0x55f1('0x3e')](_0x3da7fe['toString'](),_0x5a75e6);})['then'](function(_0x596c4f){if(_0x596c4f['length']>0x0)_0x3f677a[_0x55f1('0x7b')](_0x55f1('0xad'),_['map'](_0x596c4f,'id'));return db['sequelize'][_0x55f1('0x3e')](_0x3f677a[_0x55f1('0x9a')](),_0x5a75e6)[_0x55f1('0x2b')](function(_0x2929f2){var _0xfac6be=_[_0x55f1('0xae')](_0x2929f2,_0x55f1('0xaf'));var _0x21f2af=[];_0x596c4f[_0x55f1('0x35')](function(_0x227e6b){_0x21f2af[_0x55f1('0x36')](updateOpenchannelInteraction(_0x227e6b,_0x48b7c7,_0xfac6be));});return BPromise['all'](_0x21f2af);});});})[_0x55f1('0x2b')](function(_0x4e381c){_0x1cfb87['rows']=_0x4e381c;return _0x1cfb87;})['then'](respondWithFilteredResult(_0x1db0e0,_0x3813f7))[_0x55f1('0xb0')](handleError(_0x1db0e0,null));};exports[_0x55f1('0xb1')]=function(_0xaf307a,_0x3b9d52){var _0x51a9f0={};if(_0xaf307a[_0x55f1('0x3e')][_0x55f1('0x3b')]&&_0xaf307a['query']['type']===_0x55f1('0x4b')){_0x51a9f0['from']=_0xaf307a['params']['id'];}else{_0x51a9f0['id']=_0xaf307a['params']['id'];}var _0x19a11b={'raw':![],'where':_0x51a9f0},_0x13e887={};_0x13e887[_0x55f1('0x3d')]=_[_0x55f1('0x72')](db[_0x55f1('0x38')][_0x55f1('0x39')]);_0x13e887[_0x55f1('0x3e')]=_[_0x55f1('0x72')](_0xaf307a[_0x55f1('0x3e')]);_0x13e887[_0x55f1('0x3f')]=_['intersection'](_0x13e887[_0x55f1('0x3d')],_0x13e887['query']);_0x19a11b[_0x55f1('0x41')]=_[_0x55f1('0x40')](_0x13e887['model'],qs[_0x55f1('0x42')](_0xaf307a[_0x55f1('0x3e')]['fields']));_0x19a11b[_0x55f1('0x41')]=_0x19a11b[_0x55f1('0x41')][_0x55f1('0x5d')]?_0x19a11b[_0x55f1('0x41')]:_0x13e887[_0x55f1('0x3d')];if(_0xaf307a[_0x55f1('0x3e')][_0x55f1('0xb2')]){_0x19a11b['include']=[{'all':!![]}];}_0x19a11b=_[_0x55f1('0x9c')]({},_0x19a11b,_0xaf307a[_0x55f1('0xb3')]);return db[_0x55f1('0x38')][_0x55f1('0x5f')](_0x19a11b)[_0x55f1('0x2b')](handleEntityNotFound(_0x3b9d52,null))['then'](respondWithResult(_0x3b9d52,null))[_0x55f1('0xb0')](handleError(_0x3b9d52,null));};exports[_0x55f1('0xb4')]=function(_0x22d9bf,_0x387bf5){return db[_0x55f1('0x38')][_0x55f1('0xb4')](_0x22d9bf[_0x55f1('0xb5')],{})[_0x55f1('0x2b')](respondWithResult(_0x387bf5,0xc9))[_0x55f1('0xb0')](handleError(_0x387bf5,null));};exports[_0x55f1('0xb6')]=function(_0x5eff8e,_0x177c0d){if(_0x5eff8e['body']['id']){delete _0x5eff8e[_0x55f1('0xb5')]['id'];}return db[_0x55f1('0x38')][_0x55f1('0x5f')]({'where':{'id':_0x5eff8e['params']['id']}})[_0x55f1('0x2b')](handleEntityNotFound(_0x177c0d,null))['then'](saveUpdates(_0x5eff8e[_0x55f1('0xb5')],null))['then'](respondWithResult(_0x177c0d,null))[_0x55f1('0xb0')](handleError(_0x177c0d,null));};exports[_0x55f1('0x2c')]=function(_0xb2201c,_0x591a51){return db[_0x55f1('0x38')]['find']({'where':{'id':_0xb2201c[_0x55f1('0xb7')]['id']}})['then'](handleEntityNotFound(_0x591a51,null))[_0x55f1('0x2b')](removeEntity(_0x591a51,null))[_0x55f1('0xb0')](handleError(_0x591a51,null));};exports['describe']=function(_0xa93b94,_0x428a4d){return db[_0x55f1('0x38')][_0x55f1('0xb8')]()[_0x55f1('0x2b')](respondWithResult(_0x428a4d,null))['catch'](handleError(_0x428a4d,null));};exports[_0x55f1('0xb9')]=function(_0x5ee46b,_0x24f829,_0x4b9750){return db[_0x55f1('0xba')][_0x55f1('0x5f')]({'where':{'id':_0x5ee46b[_0x55f1('0xb7')]['id']}})['then'](handleEntityNotFound(_0x24f829,null))['then'](function(_0xabf844){if(_0xabf844){return _0xabf844[_0x55f1('0xb9')](_0x5ee46b[_0x55f1('0xb5')][_0x55f1('0xbb')],_[_0x55f1('0xbc')](_0x5ee46b['body'],['ids','id'])||{});}})[_0x55f1('0x2b')](respondWithResult(_0x24f829,null))['catch'](handleError(_0x24f829,null));};exports[_0x55f1('0xbd')]=function(_0x9b646,_0x2a5e3a,_0x543b3c){var _0x2f490d={'raw':![],'where':{}};var _0x17125b={};var _0xc76cd6={'count':0x0,'rows':[]};return db[_0x55f1('0x38')][_0x55f1('0xbe')]({'where':{'id':_0x9b646['params']['id']}})['then'](handleEntityNotFound(_0x2a5e3a,null))[_0x55f1('0x2b')](function(_0x2ad340){if(_0x2ad340){_0x17125b[_0x55f1('0x3d')]=_[_0x55f1('0x72')](db[_0x55f1('0xba')][_0x55f1('0x39')]);_0x17125b[_0x55f1('0x3e')]=_[_0x55f1('0x72')](_0x9b646[_0x55f1('0x3e')]);_0x17125b[_0x55f1('0x3f')]=_[_0x55f1('0x40')](_0x17125b[_0x55f1('0x3d')],_0x17125b[_0x55f1('0x3e')]);_0x2f490d[_0x55f1('0x41')]=_['intersection'](_0x17125b['model'],qs['fields'](_0x9b646[_0x55f1('0x3e')][_0x55f1('0x42')]));_0x2f490d[_0x55f1('0x41')]=_0x2f490d[_0x55f1('0x41')]['length']?_0x2f490d[_0x55f1('0x41')]:_0x17125b['model'];if(!_0x9b646[_0x55f1('0x3e')][_0x55f1('0x43')](_0x55f1('0x44'))){_0x2f490d[_0x55f1('0x25')]=qs[_0x55f1('0x25')](_0x9b646['query']['limit']);_0x2f490d['offset']=qs[_0x55f1('0x24')](_0x9b646[_0x55f1('0x3e')][_0x55f1('0x24')]);}_0x2f490d[_0x55f1('0x45')]=qs[_0x55f1('0x46')](_0x9b646[_0x55f1('0x3e')]['sort']);_0x2f490d[_0x55f1('0x7b')]=qs[_0x55f1('0x3f')](_['pick'](_0x9b646[_0x55f1('0x3e')],_0x17125b[_0x55f1('0x3f')]));_0x2f490d[_0x55f1('0x7b')][_0x55f1('0xaf')]=_0x2ad340['id'];if(_0x9b646['query'][_0x55f1('0x84')]){_0x2f490d[_0x55f1('0x7b')]=_[_0x55f1('0x9c')](_0x2f490d[_0x55f1('0x7b')],{'$or':_[_0x55f1('0x31')](_0x2f490d[_0x55f1('0x41')],function(_0x11aed4){var _0x538944={};_0x538944[_0x11aed4]={'$like':'%'+_0x9b646[_0x55f1('0x3e')][_0x55f1('0x84')]+'%'};return _0x538944;})});}if(_0x9b646[_0x55f1('0x3e')][_0x55f1('0x7a')]){var _0x11cc63=_0x9b646[_0x55f1('0x3e')][_0x55f1('0x7a')]['split'](',');var _0x210b9d={};_0x210b9d[_0x11cc63[0x0]]={'$gte':moment(_0x11cc63[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2f490d['where']=_[_0x55f1('0x9c')](_0x2f490d[_0x55f1('0x7b')],_0x210b9d);}_0x2f490d=_[_0x55f1('0x9c')]({},_0x2f490d,_0x9b646[_0x55f1('0xb3')]);return db[_0x55f1('0xba')]['count']({'where':_0x2f490d[_0x55f1('0x7b')]})[_0x55f1('0x2b')](function(_0x18df35){_0xc76cd6[_0x55f1('0x26')]=_0x18df35;if(_0x9b646[_0x55f1('0x3e')][_0x55f1('0xb2')]){_0x2f490d[_0x55f1('0xbf')]=[{'all':!![]}];}return db[_0x55f1('0xba')]['findAll'](_0x2f490d);})[_0x55f1('0x2b')](function(_0x48e8f4){_0xc76cd6['rows']=_0x48e8f4;return _0xc76cd6;});}})['then'](respondWithFilteredResult(_0x2a5e3a,_0x2f490d))[_0x55f1('0xb0')](handleError(_0x2a5e3a,null));};exports['addTags']=function(_0x1359b4,_0x34e3cf,_0x438df3){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1359b4[_0x55f1('0xb7')]['id']}})['then'](handleEntityNotFound(_0x34e3cf,null))['then'](function(_0x25db3d){if(_0x25db3d){return _0x25db3d[_0x55f1('0xc0')](_0x1359b4['body'][_0x55f1('0xbb')],_[_0x55f1('0xbc')](_0x1359b4[_0x55f1('0xb5')],[_0x55f1('0xbb'),'id'])||{})['spread'](function(){return db['Tag'][_0x55f1('0xc1')]({'attributes':['id',_0x55f1('0x2e'),'color'],'where':{'id':_0x1359b4[_0x55f1('0xb5')][_0x55f1('0xbb')]}});})[_0x55f1('0x2b')](function(_0x1d062f){socket[_0x55f1('0xc2')](_0x55f1('0xc3'),{'id':Number(_0x1359b4[_0x55f1('0xb7')]['id']),'tags':_0x1d062f||[]});return{'id':Number(_0x1359b4[_0x55f1('0xb7')]['id']),'tags':_0x1d062f||[]};});}})[_0x55f1('0x2b')](respondWithResult(_0x34e3cf,null))[_0x55f1('0xb0')](handleError(_0x34e3cf,null));};exports[_0x55f1('0xc4')]=function(_0x234872,_0x251764,_0xcc288c){return db[_0x55f1('0x38')][_0x55f1('0x5f')]({'where':{'id':_0x234872[_0x55f1('0xb7')]['id']}})[_0x55f1('0x2b')](handleEntityNotFound(_0x251764,null))['then'](function(_0x176b4b){if(_0x176b4b){return _0x176b4b[_0x55f1('0xc4')](_0x234872[_0x55f1('0x3e')][_0x55f1('0xbb')]);}})[_0x55f1('0x2b')](respondWithStatusCode(_0x251764,null))[_0x55f1('0xb0')](handleError(_0x251764,null));};exports[_0x55f1('0xc5')]=function(_0x4ea521,_0x3c90f3){var _0x12b056=moment()[_0x55f1('0xc6')]()[_0x55f1('0x9a')]();var _0x7447da=path['join'](config[_0x55f1('0xc7')],_0x55f1('0xc8'),_0x55f1('0xc9'),'tmp');var _0x57eb1b=path['join'](config[_0x55f1('0xc7')],'server',_0x55f1('0xc9'),'attachments');var _0x5ef895=path[_0x55f1('0xca')](_0x7447da,_0x12b056);var _0x2baa51=util[_0x55f1('0xcb')](_0x55f1('0xcc'),_0x4ea521[_0x55f1('0xb7')]['id'],_0x12b056);var _0x2c73c4=path['join'](_0x7447da,_0x2baa51);var _0x3173b3=[];_0x3173b3[_0x55f1('0x36')]({'model':db[_0x55f1('0x6f')],'as':_0x55f1('0x6f'),'attributes':['id','fullname'],'raw':!![]});_0x3173b3[_0x55f1('0x36')]({'model':db[_0x55f1('0xcd')],'as':_0x55f1('0x65'),'attributes':['id',_0x55f1('0xce'),_0x55f1('0xcf')],'raw':!![]});if(_0x4ea521[_0x55f1('0x3e')]['attachments']){_0x3173b3[_0x55f1('0x36')]({'model':db['Attachment'],'as':_0x55f1('0xd0'),'raw':!![]});}var _0xddb795=[{'model':db['OpenchannelMessage'],'as':_0x55f1('0xd1'),'attributes':['id',_0x55f1('0xb5'),'createdAt',_0x55f1('0xd2'),_0x55f1('0xd3'),_0x55f1('0x7f')],'include':_0x3173b3}];_0xddb795[_0x55f1('0x36')]({'model':db[_0x55f1('0xd4')],'as':_0x55f1('0xd5'),'attributes':['id',_0x55f1('0x2e')]});_0xddb795[_0x55f1('0x36')]({'model':db['User'],'as':'Owner','attributes':['id',_0x55f1('0x32')]});return db['OpenchannelInteraction'][_0x55f1('0x5f')]({'where':{'id':_0x4ea521[_0x55f1('0xb7')]['id']},'include':_0xddb795})[_0x55f1('0x2b')](handleEntityNotFound(_0x3c90f3,null))['then'](function(_0x25fd4e){if(_0x25fd4e){var _0x3b1a3f=_0x25fd4e[_0x55f1('0xd6')]({'plain':!![]});fs[_0x55f1('0xd7')](_0x5ef895);var _0x5994b6={'channel':_0x55f1('0xd8'),'account':_0x3b1a3f['Account']['name'],'agent':_0x3b1a3f[_0x55f1('0xd9')]?_0x3b1a3f[_0x55f1('0xd9')][_0x55f1('0x32')]:_0x55f1('0xda'),'createdAt':moment(_0x3b1a3f[_0x55f1('0x78')])['format'](_0x55f1('0xdb'))[_0x55f1('0x9a')](),'closedAt':_0x3b1a3f['closed']?moment(_0x3b1a3f[_0x55f1('0xdc')])[_0x55f1('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3b1a3f['disposition'],'visibility':_0x3b1a3f[_0x55f1('0xdd')]?'Public':_0x55f1('0xde'),'messages':_(_0x3b1a3f[_0x55f1('0xd1')])[_0x55f1('0x84')]({'secret':![]})[_0x55f1('0x31')](function(_0x4fa42){if(_0x4fa42[_0x55f1('0xd0')]){var _0xb17b09=path['join'](_0x57eb1b,_0x4fa42['Attachment'][_0x55f1('0xdf')]);if(fs[_0x55f1('0xe0')](_0xb17b09)){fs[_0x55f1('0xe1')](_0xb17b09)['pipe'](fs[_0x55f1('0xe2')](path['join'](_0x5ef895,_0x4fa42[_0x55f1('0xd0')][_0x55f1('0xdf')])));}}return{'date':moment(_0x4fa42[_0x55f1('0x78')])[_0x55f1('0xcb')](_0x55f1('0xdb'))[_0x55f1('0x9a')](),'sender':_0x4fa42['direction']===_0x55f1('0xe3')?_0x4fa42[_0x55f1('0x6f')]?_0x4fa42[_0x55f1('0x6f')][_0x55f1('0x32')]:'System':_0x4fa42[_0x55f1('0x65')][_0x55f1('0xce')]+(_0x4fa42['Contact'][_0x55f1('0xcf')]?'\x20'+_0x4fa42[_0x55f1('0x65')][_0x55f1('0xcf')]:''),'body':_0x4fa42[_0x55f1('0xd0')]?_0x4fa42[_0x55f1('0xd0')][_0x55f1('0xdf')]:_0x4fa42[_0x55f1('0xb5')],'direction':_0x4fa42['direction']===_0x55f1('0xe3')?'A':'C','secret':_0x4fa42[_0x55f1('0xd3')],'read':_0x4fa42['read'],'attachment':_0x4fa42[_0x55f1('0xd0')]};})[_0x55f1('0x61')]()};return ejs[_0x55f1('0xe4')](path[_0x55f1('0xca')](config['root'],_0x55f1('0xc8'),'views','downloadInteraction.ejs'),{'interaction':_0x5994b6})[_0x55f1('0x2b')](function(_0x2701eb){var _0x463ea2=path[_0x55f1('0xca')](_0x5ef895,_0x55f1('0xe5')+_0x3b1a3f['id']+'-'+_0x12b056+_0x55f1('0xe6'));var _0x31191c={'path':_0x463ea2,'channel':_0x55f1('0xd8'),'interactionId':_0x3b1a3f['id']};return pdf[_0x55f1('0xe7')](_0x2701eb,_0x31191c);})['then'](function(){return new BPromise(function(_0x713620,_0x47dc55){zipdir(_0x5ef895,{'saveTo':_0x2c73c4},function(_0x4daa6d,_0x3e9de0){if(_0x4daa6d)return _0x47dc55(_0x4daa6d);return _0x713620(_0x3e9de0);});})['then'](function(){return new BPromise(function(_0x1361af,_0x44bcbc){rimraf(_0x5ef895,function(_0x314133){if(_0x314133)_0x44bcbc(_0x314133);return _0x1361af();});});})['then'](function(){return _0x3c90f3[_0x55f1('0xc5')](_0x2c73c4,_0x2baa51,function(_0x428dae){if(_0x428dae){console[_0x55f1('0xe8')](_0x55f1('0xe9'),_0x428dae);}else{fs[_0x55f1('0xea')](_0x2c73c4);}});});});}else{return _0x3c90f3['sendStatus'](0xc8);}})[_0x55f1('0xb0')](handleError(_0x3c90f3,null));}; \ No newline at end of file +var _0x4bdc=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','Users','map','fullname','Tags','TagIds','forEach','push','catch','index','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','find','value','having','`\x20=\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','replace','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','OpenchannelInteraction','unreadMessages','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.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','show','params','rawAttributes','include','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','User','CmContact','lastName','Attachment','Messages','secret','Account','Owner','Openchannel','N.A.','closed','disposition','threadId','Public','Private','basename','createReadStream','createWriteStream','direction','out','System','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync'];(function(_0xf2e588,_0x8382bf){var _0x958ed2=function(_0x1d76c8){while(--_0x1d76c8){_0xf2e588['push'](_0xf2e588['shift']());}};_0x958ed2(++_0x8382bf);}(_0x4bdc,0xe3));var _0xc4bd=function(_0x757b9a,_0x4c1dce){_0x757b9a=_0x757b9a-0x0;var _0x22015a=_0x4bdc[_0x757b9a];return _0x22015a;};'use strict';var emlformat=require(_0xc4bd('0x0'));var rimraf=require(_0xc4bd('0x1'));var zipdir=require(_0xc4bd('0x2'));var jsonpatch=require(_0xc4bd('0x3'));var rp=require('request-promise');var moment=require(_0xc4bd('0x4'));var BPromise=require(_0xc4bd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc4bd('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4bd('0x7'));var _=require(_0xc4bd('0x8'));var squel=require(_0xc4bd('0x9'));var crypto=require(_0xc4bd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc4bd('0xb'));var toCsv=require(_0xc4bd('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc4bd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc4bd('0xe'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xc4bd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc4bd('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4bd('0x11'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xc4bd('0x12')],{'host':_0xc4bd('0x13'),'port':0x18eb});var socket=require(_0xc4bd('0x14'))(new Redis(config[_0xc4bd('0x12')]));require(_0xc4bd('0x15'))[_0xc4bd('0x16')](socket);function respondWithStatusCode(_0x23f2df,_0x22b0af){_0x22b0af=_0x22b0af||0xcc;return function(_0x2aae8c){if(_0x2aae8c){return _0x23f2df[_0xc4bd('0x17')](_0x22b0af);}return _0x23f2df[_0xc4bd('0x18')](_0x22b0af)[_0xc4bd('0x19')]();};}function respondWithResult(_0xb7fddb,_0xf00461){_0xf00461=_0xf00461||0xc8;return function(_0x1d8a53){if(_0x1d8a53){return _0xb7fddb[_0xc4bd('0x18')](_0xf00461)[_0xc4bd('0x1a')](_0x1d8a53);}};}function respondWithFilteredResult(_0x52b244,_0x5976ff){return function(_0x2700f0){if(_0x2700f0){var _0x4dd4c7=typeof _0x5976ff[_0xc4bd('0x1b')]===_0xc4bd('0x1c')&&typeof _0x5976ff[_0xc4bd('0x1d')]===_0xc4bd('0x1c');var _0x51a663=_0x2700f0[_0xc4bd('0x1e')];var _0xc4172a=_0x4dd4c7?0x0:_0x5976ff[_0xc4bd('0x1b')];var _0x20c3e0=_0x4dd4c7?_0x2700f0[_0xc4bd('0x1e')]:_0x5976ff[_0xc4bd('0x1b')]+_0x5976ff[_0xc4bd('0x1d')];var _0x271e88;if(_0x20c3e0>=_0x51a663){_0x20c3e0=_0x51a663;_0x271e88=0xc8;}else{_0x271e88=0xce;}_0x52b244['status'](_0x271e88);return _0x52b244[_0xc4bd('0x1f')]('Content-Range',_0xc4172a+'-'+_0x20c3e0+'/'+_0x51a663)[_0xc4bd('0x1a')](_0x2700f0);}return null;};}function patchUpdates(_0x3a599f){return function(_0x1b5ba6){try{jsonpatch[_0xc4bd('0x20')](_0x1b5ba6,_0x3a599f,!![]);}catch(_0x1acbec){return BPromise[_0xc4bd('0x21')](_0x1acbec);}return _0x1b5ba6[_0xc4bd('0x22')]();};}function saveUpdates(_0x50a69b,_0x4f717d){return function(_0x10e8b3){if(_0x10e8b3){return _0x10e8b3[_0xc4bd('0x23')](_0x50a69b)[_0xc4bd('0x24')](function(_0x4e6a32){return _0x4e6a32;});}return null;};}function removeEntity(_0x2a5a20,_0x52b537){return function(_0x252537){if(_0x252537){return _0x252537['destroy']()[_0xc4bd('0x24')](function(){_0x2a5a20[_0xc4bd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8e6d,_0x1ea377){return function(_0x1b050d){if(!_0x1b050d){_0x4d8e6d[_0xc4bd('0x17')](0x194);}return _0x1b050d;};}function handleError(_0x5b00ff,_0x430ac9){_0x430ac9=_0x430ac9||0x1f4;return function(_0x52cc55){logger[_0xc4bd('0x25')](_0x52cc55[_0xc4bd('0x26')]);if(_0x52cc55['name']){delete _0x52cc55['name'];}_0x5b00ff[_0xc4bd('0x18')](_0x430ac9)['send'](_0x52cc55);};}function getInteractionUsers(_0x1dc51b,_0xc3a551){return new BPromise(function(_0x2ec2a7,_0x55ff09){try{if(_0xc3a551[_0x1dc51b['id']]){_0x1dc51b[_0xc4bd('0x27')]=_[_0xc4bd('0x28')](_0xc3a551[_0x1dc51b['id']],function(_0xd2989f){return{'id':_0xd2989f['id'],'fullname':_0xd2989f[_0xc4bd('0x29')]};});}}catch(_0x3dcce8){_0x55ff09(_0x3dcce8);}_0x2ec2a7(_0x1dc51b);});}function getInteractionTags(_0x1ff986,_0x1906f1){return new BPromise(function(_0x26b10e,_0xf6032c){try{if(_0x1ff986['TagIds']){_0x1ff986[_0xc4bd('0x2a')]=[];_0x1ff986[_0xc4bd('0x2b')]['split'](',')[_0xc4bd('0x2c')](function(_0x227d03){_0x1ff986[_0xc4bd('0x2a')][_0xc4bd('0x2d')](_0x1906f1[_0x227d03]);});}delete _0x1ff986[_0xc4bd('0x2b')];}catch(_0x357f50){_0xf6032c(_0x357f50);}_0x26b10e(_0x1ff986);});}function updateOpenchannelInteraction(_0x6b29de,_0x15850b,_0x5af1e1){return new BPromise(function(_0x5b42bf,_0x312ed0){return getInteractionUsers(_0x6b29de,_0x5af1e1)['then'](function(_0x1dadba){return getInteractionTags(_0x1dadba,_0x15850b);})[_0xc4bd('0x24')](function(_0x270760){_0x5b42bf(_0x270760);})[_0xc4bd('0x2e')](function(_0x35014c){_0x312ed0(_0x35014c);});});}exports[_0xc4bd('0x2f')]=function(_0xa3d9d0,_0x174749){var _0x30fe4b={},_0x443908={},_0x358542={'count':0x0,'rows':[]};var _0x17571f=_['map'](db['OpenchannelInteraction']['rawAttributes'],function(_0x2e01d7){return{'name':_0x2e01d7[_0xc4bd('0x30')],'type':_0x2e01d7[_0xc4bd('0x31')]['key']};});_0x443908[_0xc4bd('0x32')]=_[_0xc4bd('0x28')](_0x17571f,_0xc4bd('0x33'));_0x443908[_0xc4bd('0x34')]=_[_0xc4bd('0x35')](_0xa3d9d0[_0xc4bd('0x34')]);_0x443908['filters']=_[_0xc4bd('0x36')](_0x443908[_0xc4bd('0x32')],_0x443908[_0xc4bd('0x34')]);_0x30fe4b[_0xc4bd('0x37')]=_[_0xc4bd('0x36')](_0x443908[_0xc4bd('0x32')],qs[_0xc4bd('0x38')](_0xa3d9d0['query'][_0xc4bd('0x38')]));_0x30fe4b['attributes']=_0x30fe4b[_0xc4bd('0x37')][_0xc4bd('0x39')]?_0x30fe4b[_0xc4bd('0x37')]:_0x443908['model'];if(!_0xa3d9d0[_0xc4bd('0x34')][_0xc4bd('0x3a')](_0xc4bd('0x3b'))){_0x30fe4b[_0xc4bd('0x1d')]=qs[_0xc4bd('0x1d')](_0xa3d9d0[_0xc4bd('0x34')]['limit']);_0x30fe4b[_0xc4bd('0x1b')]=qs[_0xc4bd('0x1b')](_0xa3d9d0[_0xc4bd('0x34')][_0xc4bd('0x1b')]);}_0x30fe4b['order']=qs[_0xc4bd('0x3c')](_0xa3d9d0['query'][_0xc4bd('0x3c')]);_0x30fe4b['where']=qs[_0xc4bd('0x3d')](_[_0xc4bd('0x3e')](_0xa3d9d0['query'],_0x443908[_0xc4bd('0x3d')]),_0x17571f);var _0x3c64a3=[];var _0x1fae85=squel[_0xc4bd('0x3f')]()[_0xc4bd('0x40')]('id')[_0xc4bd('0x40')](_0xc4bd('0x33'))[_0xc4bd('0x40')](_0xc4bd('0x41'))[_0xc4bd('0x42')](_0xc4bd('0x43'));var _0x244b9c=squel[_0xc4bd('0x3f')]()[_0xc4bd('0x40')](_0xc4bd('0x44'))['field'](_0xc4bd('0x45'))['field']('ui.OpenchannelInteractionId')['from'](_0xc4bd('0x46'),'ui')[_0xc4bd('0x47')](_0xc4bd('0x48'),'u',_0xc4bd('0x49'));var _0x15313c=squel[_0xc4bd('0x3f')]()[_0xc4bd('0x42')](_0xc4bd('0x4a'),'i')[_0xc4bd('0x47')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc4bd('0x47')](_0xc4bd('0x48'),'o',_0xc4bd('0x4b'))[_0xc4bd('0x47')](_0xc4bd('0x4c'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xc4bd('0x47')](_0xc4bd('0x4d'),'me',_0xc4bd('0x4e'))['left_join']('openchannel_interaction_has_tags','it',_0xc4bd('0x4f'))['left_join'](_0xc4bd('0x43'),'t',_0xc4bd('0x50'));var _0x15a85b=squel[_0xc4bd('0x51')]();var _0x3d8df6=[];var _0x42e8b1=squel[_0xc4bd('0x51')]();var _0x3717f0;if(_0xa3d9d0[_0xc4bd('0x34')]['search']){_0x3717f0=as[_0xc4bd('0x52')](_0xa3d9d0[_0xc4bd('0x34')][_0xc4bd('0x53')]);var _0xafd0f0=_0x3717f0['sqlOperator'];for(var _0x551ba4=0x0;_0x551ba4<_0x3717f0['conditions'][_0xc4bd('0x39')];_0x551ba4++){var _0x130d89=_0x3717f0['conditions'][_0x551ba4];var _0x3e765a='i';var _0x2f0389=_[_0xc4bd('0x54')](_0x17571f,[_0xc4bd('0x33'),_0x130d89['field']]);if(!_0x2f0389){switch(_0x130d89[_0xc4bd('0x40')]){case'unreadMessages':if(_0x130d89[_0xc4bd('0x55')]==0x1){_0x15313c[_0xc4bd('0x56')]('`'+_0x130d89[_0xc4bd('0x40')]+_0xc4bd('0x57'));}else{_0x15313c[_0xc4bd('0x56')]('`'+_0x130d89[_0xc4bd('0x40')]+'`\x20>\x200');}break;case _0xc4bd('0x58'):if(_0x130d89[_0xc4bd('0x59')]===_0xc4bd('0x5a')){if(_0x130d89[_0xc4bd('0x55')][_0xc4bd('0x5b')]('\x20')[_0xc4bd('0x39')]>0x1){_0x15a85b[_0xafd0f0](_0xc4bd('0x5c'),qs[_0xc4bd('0x5d')](_0x130d89[_0xc4bd('0x55')]),null);}else{var _0x49e05c='%'+_0x130d89[_0xc4bd('0x55')]+'%';_0x15a85b[_0xafd0f0](_0xc4bd('0x5e'),_0x49e05c,_0x49e05c,_0x49e05c);}}else{_0x2f0389=_['find'](_0x17571f,[_0xc4bd('0x33'),_0xc4bd('0x5f')]);_0x130d89[_0xc4bd('0x40')]='ContactId';_0x471ddc=as[_0xc4bd('0x60')](_0x3e765a,_0x2f0389[_0xc4bd('0x31')],_0x130d89);_0x15a85b[_0xafd0f0](_0x471ddc[_0xc4bd('0x61')],_0x471ddc[_0xc4bd('0x55')][_0xc4bd('0x62')],_0x471ddc[_0xc4bd('0x55')][_0xc4bd('0x19')]);}break;case _0xc4bd('0x63'):var _0x3ba376=_0x130d89[_0xc4bd('0x55')][_0xc4bd('0x5b')](',')[_0xc4bd('0x28')](function(_0x195315){return Number(_0x195315);});_0x3ba376[_0xc4bd('0x2c')](function(_0x5e5a53){_0x42e8b1['or'](_0xc4bd('0x64'),'%,'+_0x5e5a53+',%');});_0x3d8df6=_['union'](_0x3d8df6,_0x3ba376);break;case'User':if(_0x130d89[_0xc4bd('0x59')]===_0xc4bd('0x5a')){_0x15a85b[_0xafd0f0](_0xc4bd('0x65'),'%'+_0x130d89[_0xc4bd('0x55')]+'%',null);}else{_0x2f0389=_[_0xc4bd('0x54')](_0x17571f,['name','UserId']);_0x130d89[_0xc4bd('0x40')]=_0xc4bd('0x66');_0x471ddc=as[_0xc4bd('0x60')](_0x3e765a,_0x2f0389[_0xc4bd('0x31')],_0x130d89);_0x15a85b[_0xafd0f0](_0x471ddc['text'],_0x471ddc[_0xc4bd('0x55')][_0xc4bd('0x62')],_0x471ddc[_0xc4bd('0x55')][_0xc4bd('0x19')]);}break;case _0xc4bd('0x67'):_0x471ddc=as[_0xc4bd('0x60')]('me',null,_0x130d89);_0x15a85b[_0xafd0f0](_0x471ddc[_0xc4bd('0x61')],_0x471ddc['value'][_0xc4bd('0x62')],_0x471ddc[_0xc4bd('0x55')][_0xc4bd('0x19')]);break;}}else{var _0x471ddc=as[_0xc4bd('0x60')](_0x3e765a,_0x2f0389['type'],_0x130d89);_0x15a85b[_0xafd0f0](_0x471ddc['text'],_0x471ddc[_0xc4bd('0x55')]['start'],_0x471ddc[_0xc4bd('0x55')][_0xc4bd('0x19')]);}}}else{var _0x19cd74=_(_0xa3d9d0['query'])[_0xc4bd('0x35')]()[_0xc4bd('0x28')](function(_0x15e062){return _[_0xc4bd('0x68')](_0x17571f,[_0xc4bd('0x33'),_0x15e062])?_0x15e062:undefined;})[_0xc4bd('0x69')]()['value']();if(!_[_0xc4bd('0x6a')](_0x19cd74)){_0x19cd74[_0xc4bd('0x2c')](function(_0x7b1f4a){if(_0x7b1f4a==='OpenchannelAccountId'){_0x15313c[_0xc4bd('0x6b')](_0xc4bd('0x6c'),[]['concat'](_0xa3d9d0[_0xc4bd('0x34')][_0x7b1f4a]));}else if(_0x7b1f4a===_0xc4bd('0x6d')){var _0x37d561=JSON[_0xc4bd('0x6e')](_0xa3d9d0[_0xc4bd('0x34')][_0x7b1f4a])[_0xc4bd('0x6f')];var _0x8a58ab=JSON[_0xc4bd('0x6e')](_0xa3d9d0[_0xc4bd('0x34')][_0x7b1f4a])['$lte'];_0x15313c[_0xc4bd('0x6b')](_0xc4bd('0x70'),_0x37d561,_0x8a58ab);}else{if(_0xa3d9d0[_0xc4bd('0x34')][_0x7b1f4a]==='null'){_0x15313c[_0xc4bd('0x6b')]('i.'+_0x7b1f4a+_0xc4bd('0x71'));}else{_0x15313c['where']('i.'+_0x7b1f4a+'\x20=\x20?',_0xa3d9d0[_0xc4bd('0x34')][_0x7b1f4a]);}}});}if(_0xa3d9d0['query'][_0xc4bd('0x72')]){if(_0xa3d9d0['query'][_0xc4bd('0x72')]==0x1){_0x15313c[_0xc4bd('0x56')](_0xc4bd('0x73'));}else{_0x15313c[_0xc4bd('0x56')](_0xc4bd('0x74'));}}if(_0xa3d9d0[_0xc4bd('0x34')]['tag']){_0x3d8df6=_[_0xc4bd('0x75')](_0xa3d9d0[_0xc4bd('0x34')][_0xc4bd('0x76')])?_0xa3d9d0[_0xc4bd('0x34')][_0xc4bd('0x76')]:new Array(_0xa3d9d0['query'][_0xc4bd('0x76')]);_0x3d8df6[_0xc4bd('0x2c')](function(_0x1e2e94){_0x42e8b1['or'](_0xc4bd('0x64'),'%,'+_0x1e2e94+',%');});}if(_0xa3d9d0[_0xc4bd('0x34')]['filter']){var _0x45473d=_0xa3d9d0['query']['filter'][_0xc4bd('0x77')]('\x5c','\x5c\x5c')[_0xc4bd('0x77')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x45473d)){_0x15a85b['or']('i.id\x20LIKE\x20?',_0x45473d+'%');}else{_0x15a85b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc4bd('0x5d')](_0x45473d))['or']('i.from\x20LIKE\x20?',_0x45473d+'%')['or'](_0xc4bd('0x78'),_0x45473d+'%');}}}_0x15313c[_0xc4bd('0x6b')](_0x15a85b);_0x15313c[_0xc4bd('0x79')](_0xc4bd('0x7a'));var _0x2f4866={'type':db[_0xc4bd('0x7b')][_0xc4bd('0x7c')][_0xc4bd('0x7d')],'raw':!![]};var _0x5d6afc=_0x15313c[_0xc4bd('0x7e')]();_0x5d6afc['field'](_0xc4bd('0x7a'));_0x5d6afc[_0xc4bd('0x40')](_0xc4bd('0x7f'),'unreadMessages');if(_0x30fe4b[_0xc4bd('0x80')]){_0x30fe4b[_0xc4bd('0x80')]['forEach'](function(_0x3ef179){var _0xbc8f33=_0x3ef179[0x0]===_0xc4bd('0x81')?_0x3ef179[0x0]:'i.'+_0x3ef179[0x0];_0x15313c[_0xc4bd('0x80')](_0xbc8f33,_0x3ef179[0x1]===_0xc4bd('0x82')?![]:!![]);});}if(!_[_0xc4bd('0x6a')](_0x3d8df6)){_0x15313c['having'](_0x42e8b1);_0x5d6afc[_0xc4bd('0x6b')]('t.id\x20IN\x20?',_0x3d8df6);}BPromise[_0xc4bd('0x83')]()['then'](function(){if(!_0x3717f0){if(_0xa3d9d0[_0xc4bd('0x34')][_0xc4bd('0x84')])return;_0x5d6afc[_0xc4bd('0x6b')](_0xc4bd('0x85'));_0x15313c['where'](_0xc4bd('0x85'));return;}if(_0xa3d9d0[_0xc4bd('0x86')][_0xc4bd('0x87')]!==_0xc4bd('0x88'))return;return _0xa3d9d0[_0xc4bd('0x86')][_0xc4bd('0x89')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3367b8){if(_[_0xc4bd('0x6a')](_0x3367b8)){_0x5d6afc[_0xc4bd('0x6b')](_0xc4bd('0x8a'));_0x15313c[_0xc4bd('0x6b')](_0xc4bd('0x8a'));}else{_0x5d6afc['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xc4bd('0x28')](_0x3367b8,'id'));_0x15313c[_0xc4bd('0x6b')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x3367b8,'id'));}});})[_0xc4bd('0x24')](function(){if(_0xa3d9d0[_0xc4bd('0x86')][_0xc4bd('0x87')]===_0xc4bd('0x88')&&!_0x3717f0&&!_0xa3d9d0['query'][_0xc4bd('0x84')])return[];return db[_0xc4bd('0x8b')][_0xc4bd('0x34')](_0x5d6afc['toString'](),_0x2f4866);})[_0xc4bd('0x24')](function(_0x44e203){_0x358542[_0xc4bd('0x1e')]=_0x44e203[_0xc4bd('0x39')];if(_0x358542[_0xc4bd('0x1e')]===0x0)return[];return db[_0xc4bd('0x8b')]['query'](_0x1fae85[_0xc4bd('0x8c')](),_0x2f4866)['then'](function(_0x5227cf){_0x3c64a3=_[_0xc4bd('0x8d')](_0x5227cf,'id');_0x2f4866=_[_0xc4bd('0x8e')](_0x2f4866,{'model':db[_0xc4bd('0x8f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xa3d9d0[_0xc4bd('0x34')]['fields']){_0x30fe4b[_0xc4bd('0x37')][_0xc4bd('0x2c')](function(_0x38bf0b){_0x15313c['field']('i.'+_0x38bf0b);});}else{_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x7f'),_0xc4bd('0x90'));_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x91'),_0xc4bd('0x92'));_0x15313c[_0xc4bd('0x40')]('a.mandatoryDisposition',_0xc4bd('0x93'));_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x94'),_0xc4bd('0x81'));_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x95'));_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x96'),'Contact.firstName');_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x97'),_0xc4bd('0x98'));_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x99'),_0xc4bd('0x9a'));_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x9b'),'Contact.phone');_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x9c'),_0xc4bd('0x9d'));_0x15313c[_0xc4bd('0x40')]('c.fax',_0xc4bd('0x9e'));_0x15313c[_0xc4bd('0x40')](_0xc4bd('0x9f'),_0xc4bd('0xa0'));_0x15313c[_0xc4bd('0x40')](_0xc4bd('0xa1'),'Owner.internal');_0x15313c[_0xc4bd('0x40')](_0xc4bd('0xa2'),_0xc4bd('0x2b'));}if(_0x30fe4b[_0xc4bd('0x1d')])_0x15313c[_0xc4bd('0x1d')](_0x30fe4b[_0xc4bd('0x1d')]);if(_0x30fe4b[_0xc4bd('0x1b')])_0x15313c[_0xc4bd('0x1b')](_0x30fe4b['offset']);return db[_0xc4bd('0x8b')][_0xc4bd('0x34')](_0x15313c[_0xc4bd('0x8c')](),_0x2f4866);})[_0xc4bd('0x24')](function(_0x1ee4da){if(_0x1ee4da['length']>0x0)_0x244b9c[_0xc4bd('0x6b')](_0xc4bd('0xa3'),_[_0xc4bd('0x28')](_0x1ee4da,'id'));return db[_0xc4bd('0x8b')][_0xc4bd('0x34')](_0x244b9c[_0xc4bd('0x8c')](),_0x2f4866)[_0xc4bd('0x24')](function(_0x52dd8d){var _0xce93b0=_[_0xc4bd('0xa4')](_0x52dd8d,_0xc4bd('0xa5'));var _0x5112c0=[];_0x1ee4da[_0xc4bd('0x2c')](function(_0x2e4761){_0x5112c0[_0xc4bd('0x2d')](updateOpenchannelInteraction(_0x2e4761,_0x3c64a3,_0xce93b0));});return BPromise[_0xc4bd('0xa6')](_0x5112c0);});});})['then'](function(_0x1a10bd){_0x358542['rows']=_0x1a10bd;return _0x358542;})['then'](respondWithFilteredResult(_0x174749,_0x30fe4b))[_0xc4bd('0x2e')](handleError(_0x174749,null));};exports[_0xc4bd('0xa7')]=function(_0xf365d4,_0x4a0540){var _0x48bc7f={};if(_0xf365d4[_0xc4bd('0x34')]['type']&&_0xf365d4[_0xc4bd('0x34')]['type']===_0xc4bd('0x42')){_0x48bc7f[_0xc4bd('0x42')]=_0xf365d4[_0xc4bd('0xa8')]['id'];}else{_0x48bc7f['id']=_0xf365d4[_0xc4bd('0xa8')]['id'];}var _0x18b846={'raw':![],'where':_0x48bc7f},_0x312330={};_0x312330[_0xc4bd('0x32')]=_[_0xc4bd('0x35')](db[_0xc4bd('0x8f')][_0xc4bd('0xa9')]);_0x312330['query']=_[_0xc4bd('0x35')](_0xf365d4[_0xc4bd('0x34')]);_0x312330['filters']=_[_0xc4bd('0x36')](_0x312330[_0xc4bd('0x32')],_0x312330[_0xc4bd('0x34')]);_0x18b846[_0xc4bd('0x37')]=_[_0xc4bd('0x36')](_0x312330['model'],qs[_0xc4bd('0x38')](_0xf365d4[_0xc4bd('0x34')]['fields']));_0x18b846[_0xc4bd('0x37')]=_0x18b846['attributes'][_0xc4bd('0x39')]?_0x18b846['attributes']:_0x312330[_0xc4bd('0x32')];if(_0xf365d4[_0xc4bd('0x34')]['includeAll']){_0x18b846[_0xc4bd('0xaa')]=[{'all':!![]}];}_0x18b846=_[_0xc4bd('0x8e')]({},_0x18b846,_0xf365d4[_0xc4bd('0xab')]);return db[_0xc4bd('0x8f')][_0xc4bd('0x54')](_0x18b846)[_0xc4bd('0x24')](handleEntityNotFound(_0x4a0540,null))[_0xc4bd('0x24')](respondWithResult(_0x4a0540,null))[_0xc4bd('0x2e')](handleError(_0x4a0540,null));};exports[_0xc4bd('0xac')]=function(_0x115d45,_0x5ad418){return db[_0xc4bd('0x8f')][_0xc4bd('0xac')](_0x115d45[_0xc4bd('0x67')],{})[_0xc4bd('0x24')](respondWithResult(_0x5ad418,0xc9))[_0xc4bd('0x2e')](handleError(_0x5ad418,null));};exports[_0xc4bd('0x23')]=function(_0x113618,_0x53e2c4){if(_0x113618['body']['id']){delete _0x113618[_0xc4bd('0x67')]['id'];}return db[_0xc4bd('0x8f')][_0xc4bd('0x54')]({'where':{'id':_0x113618[_0xc4bd('0xa8')]['id']}})[_0xc4bd('0x24')](handleEntityNotFound(_0x53e2c4,null))[_0xc4bd('0x24')](saveUpdates(_0x113618[_0xc4bd('0x67')],null))[_0xc4bd('0x24')](respondWithResult(_0x53e2c4,null))[_0xc4bd('0x2e')](handleError(_0x53e2c4,null));};exports['destroy']=function(_0x31b46c,_0x27747d){return db['OpenchannelInteraction']['find']({'where':{'id':_0x31b46c['params']['id']}})[_0xc4bd('0x24')](handleEntityNotFound(_0x27747d,null))['then'](removeEntity(_0x27747d,null))[_0xc4bd('0x2e')](handleError(_0x27747d,null));};exports[_0xc4bd('0xad')]=function(_0x412a7e,_0x32d9a7){return db[_0xc4bd('0x8f')]['describe']()[_0xc4bd('0x24')](respondWithResult(_0x32d9a7,null))[_0xc4bd('0x2e')](handleError(_0x32d9a7,null));};exports[_0xc4bd('0xae')]=function(_0x11178a,_0x5b6415,_0x36888c){return db[_0xc4bd('0xaf')][_0xc4bd('0x54')]({'where':{'id':_0x11178a[_0xc4bd('0xa8')]['id']}})['then'](handleEntityNotFound(_0x5b6415,null))[_0xc4bd('0x24')](function(_0x53dc70){if(_0x53dc70){return _0x53dc70[_0xc4bd('0xae')](_0x11178a[_0xc4bd('0x67')][_0xc4bd('0xb0')],_[_0xc4bd('0xb1')](_0x11178a['body'],[_0xc4bd('0xb0'),'id'])||{});}})[_0xc4bd('0x24')](respondWithResult(_0x5b6415,null))['catch'](handleError(_0x5b6415,null));};exports[_0xc4bd('0xb2')]=function(_0xf330b1,_0x2dcd87,_0x10ef95){var _0x1b2964={'raw':![],'where':{}};var _0x15d2ce={};var _0x3ada0b={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc4bd('0xb3')]({'where':{'id':_0xf330b1['params']['id']}})['then'](handleEntityNotFound(_0x2dcd87,null))[_0xc4bd('0x24')](function(_0x24fa15){if(_0x24fa15){_0x15d2ce[_0xc4bd('0x32')]=_[_0xc4bd('0x35')](db[_0xc4bd('0xaf')][_0xc4bd('0xa9')]);_0x15d2ce['query']=_[_0xc4bd('0x35')](_0xf330b1[_0xc4bd('0x34')]);_0x15d2ce[_0xc4bd('0x3d')]=_[_0xc4bd('0x36')](_0x15d2ce[_0xc4bd('0x32')],_0x15d2ce[_0xc4bd('0x34')]);_0x1b2964[_0xc4bd('0x37')]=_[_0xc4bd('0x36')](_0x15d2ce[_0xc4bd('0x32')],qs[_0xc4bd('0x38')](_0xf330b1['query'][_0xc4bd('0x38')]));_0x1b2964[_0xc4bd('0x37')]=_0x1b2964[_0xc4bd('0x37')]['length']?_0x1b2964[_0xc4bd('0x37')]:_0x15d2ce[_0xc4bd('0x32')];if(!_0xf330b1[_0xc4bd('0x34')][_0xc4bd('0x3a')](_0xc4bd('0x3b'))){_0x1b2964[_0xc4bd('0x1d')]=qs[_0xc4bd('0x1d')](_0xf330b1[_0xc4bd('0x34')]['limit']);_0x1b2964[_0xc4bd('0x1b')]=qs[_0xc4bd('0x1b')](_0xf330b1['query'][_0xc4bd('0x1b')]);}_0x1b2964[_0xc4bd('0x80')]=qs['sort'](_0xf330b1[_0xc4bd('0x34')][_0xc4bd('0x3c')]);_0x1b2964[_0xc4bd('0x6b')]=qs[_0xc4bd('0x3d')](_[_0xc4bd('0x3e')](_0xf330b1['query'],_0x15d2ce[_0xc4bd('0x3d')]));_0x1b2964[_0xc4bd('0x6b')][_0xc4bd('0xa5')]=_0x24fa15['id'];if(_0xf330b1[_0xc4bd('0x34')]['filter']){_0x1b2964[_0xc4bd('0x6b')]=_['merge'](_0x1b2964[_0xc4bd('0x6b')],{'$or':_[_0xc4bd('0x28')](_0x1b2964['attributes'],function(_0xed66c2){var _0x255c86={};_0x255c86[_0xed66c2]={'$like':'%'+_0xf330b1['query'][_0xc4bd('0xb4')]+'%'};return _0x255c86;})});}if(_0xf330b1['query'][_0xc4bd('0x6f')]){var _0x94914b=_0xf330b1['query'][_0xc4bd('0x6f')][_0xc4bd('0x5b')](',');var _0x3ea2ae={};_0x3ea2ae[_0x94914b[0x0]]={'$gte':moment(_0x94914b[0x1])[_0xc4bd('0xb5')](_0xc4bd('0xb6'))};_0x1b2964[_0xc4bd('0x6b')]=_[_0xc4bd('0x8e')](_0x1b2964[_0xc4bd('0x6b')],_0x3ea2ae);}_0x1b2964=_['merge']({},_0x1b2964,_0xf330b1['options']);return db[_0xc4bd('0xaf')]['count']({'where':_0x1b2964[_0xc4bd('0x6b')]})[_0xc4bd('0x24')](function(_0x2b4cd8){_0x3ada0b[_0xc4bd('0x1e')]=_0x2b4cd8;if(_0xf330b1[_0xc4bd('0x34')]['includeAll']){_0x1b2964[_0xc4bd('0xaa')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc4bd('0xb7')](_0x1b2964);})[_0xc4bd('0x24')](function(_0x5933b4){_0x3ada0b[_0xc4bd('0xb8')]=_0x5933b4;return _0x3ada0b;});}})['then'](respondWithFilteredResult(_0x2dcd87,_0x1b2964))[_0xc4bd('0x2e')](handleError(_0x2dcd87,null));};exports[_0xc4bd('0xb9')]=function(_0x375752,_0xa1147d,_0x401eae){return db[_0xc4bd('0x8f')][_0xc4bd('0x54')]({'where':{'id':_0x375752[_0xc4bd('0xa8')]['id']}})[_0xc4bd('0x24')](handleEntityNotFound(_0xa1147d,null))[_0xc4bd('0x24')](function(_0x21bec7){if(_0x21bec7){return _0x21bec7[_0xc4bd('0xba')](_0x375752['body'][_0xc4bd('0xb0')],_[_0xc4bd('0xb1')](_0x375752[_0xc4bd('0x67')],[_0xc4bd('0xb0'),'id'])||{})[_0xc4bd('0xbb')](function(){return db[_0xc4bd('0x63')][_0xc4bd('0xb7')]({'attributes':['id','name',_0xc4bd('0x41')],'where':{'id':_0x375752[_0xc4bd('0x67')][_0xc4bd('0xb0')]}});})[_0xc4bd('0x24')](function(_0x432189){socket[_0xc4bd('0xbc')](_0xc4bd('0xbd'),{'id':Number(_0x375752[_0xc4bd('0xa8')]['id']),'tags':_0x432189||[]});return{'id':Number(_0x375752[_0xc4bd('0xa8')]['id']),'tags':_0x432189||[]};});}})[_0xc4bd('0x24')](respondWithResult(_0xa1147d,null))[_0xc4bd('0x2e')](handleError(_0xa1147d,null));};exports[_0xc4bd('0xbe')]=function(_0x159ed5,_0x141f24,_0x4a9088){return db[_0xc4bd('0x8f')][_0xc4bd('0x54')]({'where':{'id':_0x159ed5[_0xc4bd('0xa8')]['id']}})[_0xc4bd('0x24')](handleEntityNotFound(_0x141f24,null))[_0xc4bd('0x24')](function(_0x112c5a){if(_0x112c5a){return _0x112c5a[_0xc4bd('0xbe')](_0x159ed5[_0xc4bd('0x34')][_0xc4bd('0xb0')]);}})[_0xc4bd('0x24')](respondWithStatusCode(_0x141f24,null))[_0xc4bd('0x2e')](handleError(_0x141f24,null));};exports[_0xc4bd('0xbf')]=function(_0x46dbed,_0x5516bd){var _0x6aca9a=moment()[_0xc4bd('0xc0')]()['toString']();var _0x146740=path[_0xc4bd('0xc1')](config[_0xc4bd('0xc2')],'server',_0xc4bd('0xc3'),_0xc4bd('0xc4'));var _0xee4632=path[_0xc4bd('0xc1')](config[_0xc4bd('0xc2')],_0xc4bd('0xc5'),_0xc4bd('0xc3'),_0xc4bd('0xc6'));var _0x38bc2a=path[_0xc4bd('0xc1')](_0x146740,_0x6aca9a);var _0x2af337=util['format']('transcript-%d-%s.zip',_0x46dbed[_0xc4bd('0xa8')]['id'],_0x6aca9a);var _0xd1468=path['join'](_0x146740,_0x2af337);var _0xd76657=[];_0xd76657[_0xc4bd('0x2d')]({'model':db[_0xc4bd('0xc7')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0xd76657[_0xc4bd('0x2d')]({'model':db[_0xc4bd('0xc8')],'as':'Contact','attributes':['id','firstName',_0xc4bd('0xc9')],'raw':!![]});if(_0x46dbed[_0xc4bd('0x34')][_0xc4bd('0xc6')]){_0xd76657['push']({'model':db[_0xc4bd('0xca')],'as':_0xc4bd('0xca'),'raw':!![]});}var _0x2b9022=[{'model':db[_0xc4bd('0xaf')],'as':_0xc4bd('0xcb'),'attributes':['id',_0xc4bd('0x67'),_0xc4bd('0x6d'),'direction',_0xc4bd('0xcc'),_0xc4bd('0x72')],'include':_0xd76657}];_0x2b9022[_0xc4bd('0x2d')]({'model':db['OpenchannelAccount'],'as':_0xc4bd('0xcd'),'attributes':['id',_0xc4bd('0x33')]});_0x2b9022[_0xc4bd('0x2d')]({'model':db[_0xc4bd('0xc7')],'as':_0xc4bd('0xce'),'attributes':['id','fullname']});return db[_0xc4bd('0x8f')]['find']({'where':{'id':_0x46dbed['params']['id']},'include':_0x2b9022})[_0xc4bd('0x24')](handleEntityNotFound(_0x5516bd,null))[_0xc4bd('0x24')](function(_0x202a3d){if(_0x202a3d){var _0x2f76f8=_0x202a3d['get']({'plain':!![]});fs['mkdirSync'](_0x38bc2a);var _0x3d8a3d={'channel':_0xc4bd('0xcf'),'account':_0x2f76f8[_0xc4bd('0xcd')][_0xc4bd('0x33')],'agent':_0x2f76f8[_0xc4bd('0xce')]?_0x2f76f8[_0xc4bd('0xce')][_0xc4bd('0x29')]:_0xc4bd('0xd0'),'createdAt':moment(_0x2f76f8[_0xc4bd('0x6d')])[_0xc4bd('0xb5')](_0xc4bd('0xb6'))['toString'](),'closedAt':_0x2f76f8[_0xc4bd('0xd1')]?moment(_0x2f76f8['closedAt'])[_0xc4bd('0xb5')](_0xc4bd('0xb6'))['toString']():'','disposition':_0x2f76f8[_0xc4bd('0xd2')],'visibility':_0x2f76f8[_0xc4bd('0xd3')]?_0xc4bd('0xd4'):_0xc4bd('0xd5'),'messages':_(_0x2f76f8['Messages'])[_0xc4bd('0xb4')]({'secret':![]})['map'](function(_0x5d3cb8){if(_0x5d3cb8[_0xc4bd('0xca')]){var _0x5dac1c=path[_0xc4bd('0xc1')](_0xee4632,_0x5d3cb8[_0xc4bd('0xca')][_0xc4bd('0xd6')]);if(fs['existsSync'](_0x5dac1c)){fs[_0xc4bd('0xd7')](_0x5dac1c)['pipe'](fs[_0xc4bd('0xd8')](path[_0xc4bd('0xc1')](_0x38bc2a,_0x5d3cb8['Attachment']['basename'])));}}return{'date':moment(_0x5d3cb8[_0xc4bd('0x6d')])['format'](_0xc4bd('0xb6'))[_0xc4bd('0x8c')](),'sender':_0x5d3cb8[_0xc4bd('0xd9')]===_0xc4bd('0xda')?_0x5d3cb8[_0xc4bd('0xc7')]?_0x5d3cb8[_0xc4bd('0xc7')]['fullname']:_0xc4bd('0xdb'):_0x5d3cb8[_0xc4bd('0x58')]['firstName']+(_0x5d3cb8[_0xc4bd('0x58')]['lastName']?'\x20'+_0x5d3cb8[_0xc4bd('0x58')]['lastName']:''),'body':_0x5d3cb8['Attachment']?_0x5d3cb8['Attachment'][_0xc4bd('0xd6')]:_0x5d3cb8[_0xc4bd('0x67')],'direction':_0x5d3cb8[_0xc4bd('0xd9')]===_0xc4bd('0xda')?'A':'C','secret':_0x5d3cb8[_0xc4bd('0xcc')],'read':_0x5d3cb8[_0xc4bd('0x72')],'attachment':_0x5d3cb8['Attachment']};})[_0xc4bd('0x55')]()};return ejs['renderFile'](path[_0xc4bd('0xc1')](config[_0xc4bd('0xc2')],_0xc4bd('0xc5'),_0xc4bd('0xdc'),'downloadInteraction.ejs'),{'interaction':_0x3d8a3d})['then'](function(_0x175841){var _0x539e9c=path[_0xc4bd('0xc1')](_0x38bc2a,_0xc4bd('0xdd')+_0x2f76f8['id']+'-'+_0x6aca9a+_0xc4bd('0xde'));var _0x16da01={'path':_0x539e9c,'channel':'Openchannel','interactionId':_0x2f76f8['id']};return pdf[_0xc4bd('0xdf')](_0x175841,_0x16da01);})[_0xc4bd('0x24')](function(){return new BPromise(function(_0x1f9455,_0x339995){zipdir(_0x38bc2a,{'saveTo':_0xd1468},function(_0x1c0396,_0x2a6319){if(_0x1c0396)return _0x339995(_0x1c0396);return _0x1f9455(_0x2a6319);});})[_0xc4bd('0x24')](function(){return new BPromise(function(_0x347b57,_0xe6377){rimraf(_0x38bc2a,function(_0x599b54){if(_0x599b54)_0xe6377(_0x599b54);return _0x347b57();});});})[_0xc4bd('0x24')](function(){return _0x5516bd[_0xc4bd('0xbf')](_0xd1468,_0x2af337,function(_0x11c753){if(_0x11c753){console[_0xc4bd('0xe0')](_0xc4bd('0xe1'),_0x11c753);}else{fs[_0xc4bd('0xe2')](_0xd1468);}});});});}else{return _0x5516bd[_0xc4bd('0x17')](0xc8);}})[_0xc4bd('0x2e')](handleError(_0x5516bd,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 52665ba..c4eca5c 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 _0x25b2=['findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map'];(function(_0x540fd5,_0x331d3a){var _0xdc2b57=function(_0x2bc3aa){while(--_0x2bc3aa){_0x540fd5['push'](_0x540fd5['shift']());}};_0xdc2b57(++_0x331d3a);}(_0x25b2,0x181));var _0x225b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x25b2[_0x110c3d];return _0x226d67;};'use strict';var EventEmitter=require(_0x225b('0x0'));var OpenchannelInteraction=require(_0x225b('0x1'))['db'][_0x225b('0x2')];var OpenchannelMessage=require(_0x225b('0x1'))['db'][_0x225b('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x225b('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x225b('0x5'),'afterDestroy':_0x225b('0x6')};function emitEvent(_0x2f2669){return function(_0x487108,_0x4744d4,_0x53731e){_0x487108[_0x225b('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3c694c){_0x487108[_0x225b('0x8')](_0x225b('0x9'),_0x3c694c[_0x225b('0xa')](function(_0x23babb){return{'id':_0x23babb['id']};}));return OpenchannelMessage[_0x225b('0xb')]({'where':{'OpenchannelInteractionId':_0x487108['id'],'direction':'in','read':![]},'raw':!![]});})[_0x225b('0xc')](function(_0x14405f){_0x487108[_0x225b('0x8')](_0x225b('0xd'),_0x14405f[_0x225b('0xe')]);OpenchannelInteractionEvents[_0x225b('0xf')](_0x2f2669+':'+_0x487108['id'],_0x487108);OpenchannelInteractionEvents[_0x225b('0xf')](_0x2f2669,_0x487108);_0x53731e(null);})[_0x225b('0x10')](_0x53731e(null));};}for(var e in events){if(events[_0x225b('0x11')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x08f4=['then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue','map','findAll'];(function(_0xcbeaa7,_0x126491){var _0x4cc172=function(_0x148762){while(--_0x148762){_0xcbeaa7['push'](_0xcbeaa7['shift']());}};_0x4cc172(++_0x126491);}(_0x08f4,0x77));var _0x408f=function(_0x37875a,_0x1f091f){_0x37875a=_0x37875a-0x0;var _0x1b43c1=_0x08f4[_0x37875a];return _0x1b43c1;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x408f('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x408f('0x0'))['db'][_0x408f('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x408f('0x2')](0x0);var events={'afterCreate':_0x408f('0x3'),'afterUpdate':_0x408f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3789f4){return function(_0x21373f,_0x5b3830,_0x3198f7){_0x21373f[_0x408f('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x160002){_0x21373f[_0x408f('0x6')]('Users',_0x160002[_0x408f('0x7')](function(_0x3a5a27){return{'id':_0x3a5a27['id']};}));return OpenchannelMessage[_0x408f('0x8')]({'where':{'OpenchannelInteractionId':_0x21373f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x408f('0x9')](function(_0x54fa69){_0x21373f[_0x408f('0x6')](_0x408f('0xa'),_0x54fa69['length']);OpenchannelInteractionEvents[_0x408f('0xb')](_0x3789f4+':'+_0x21373f['id'],_0x21373f);OpenchannelInteractionEvents[_0x408f('0xb')](_0x3789f4,_0x21373f);_0x3198f7(null);})[_0x408f('0xc')](_0x3198f7(null));};}for(var e in events){if(events[_0x408f('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x408f('0xe')](e,emitEvent(event));}}module[_0x408f('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 7f15142..68b341c 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 _0xb8cd=['api','moment','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x138385,_0x53edfd){var _0x12d1cb=function(_0x4fa61f){while(--_0x4fa61f){_0x138385['push'](_0x138385['shift']());}};_0x12d1cb(++_0x53edfd);}(_0xb8cd,0x1d9));var _0xdb8c=function(_0x45c19c,_0x5e8b36){_0x45c19c=_0x45c19c-0x0;var _0x5b1142=_0xb8cd[_0x45c19c];return _0x5b1142;};'use strict';var _=require(_0xdb8c('0x0'));var util=require(_0xdb8c('0x1'));var logger=require(_0xdb8c('0x2'))(_0xdb8c('0x3'));var moment=require(_0xdb8c('0x4'));var BPromise=require('bluebird');var rp=require(_0xdb8c('0x5'));var fs=require('fs');var path=require(_0xdb8c('0x6'));var rimraf=require('rimraf');var config=require(_0xdb8c('0x7'));var attributes=require(_0xdb8c('0x8'));module[_0xdb8c('0x9')]=function(_0x5372d1,_0x20841c){return _0x5372d1[_0xdb8c('0xa')](_0xdb8c('0xb'),attributes,{'tableName':_0xdb8c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdb8c('0xd'),'hooks':{'beforeUpdate':function(_0x5eed31,_0x6bb852,_0x2413e5){if(_0x5eed31[_0xdb8c('0xe')]('closed')){_0x5eed31[_0xdb8c('0xf')]=moment()['format'](_0xdb8c('0x10'));}_0x2413e5(null,_0x5eed31);}}});}; \ No newline at end of file +var _0xd589=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xd589,0x1a8));var _0x9d58=function(_0xb4e6e6,_0x3c3752){_0xb4e6e6=_0xb4e6e6-0x0;var _0x5db482=_0xd589[_0xb4e6e6];return _0x5db482;};'use strict';var _=require(_0x9d58('0x0'));var util=require(_0x9d58('0x1'));var logger=require(_0x9d58('0x2'))(_0x9d58('0x3'));var moment=require(_0x9d58('0x4'));var BPromise=require(_0x9d58('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9d58('0x6'));var config=require(_0x9d58('0x7'));var attributes=require(_0x9d58('0x8'));module[_0x9d58('0x9')]=function(_0x14703d,_0x561cbf){return _0x14703d['define'](_0x9d58('0xa'),attributes,{'tableName':_0x9d58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d58('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x4b2f7d,_0x54751,_0x46596e){if(_0x4b2f7d[_0x9d58('0xd')](_0x9d58('0xe'))){_0x4b2f7d[_0x9d58('0xf')]=moment()['format'](_0x9d58('0x10'));}_0x46596e(null,_0x4b2f7d);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3d96b80..025b33e 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 _0x4c72=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','update','body','options','raw','limit','then','debug','OpenchannelInteraction','find','where','addTags','ids','omit','spread','AddTags'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4c72,0x1d9));var _0x24c7=function(_0x4639f9,_0x1097bd){_0x4639f9=_0x4639f9-0x0;var _0x210add=_0x4c72[_0x4639f9];return _0x210add;};'use strict';var _=require(_0x24c7('0x0'));var util=require(_0x24c7('0x1'));var moment=require(_0x24c7('0x2'));var BPromise=require(_0x24c7('0x3'));var rs=require(_0x24c7('0x4'));var fs=require('fs');var Redis=require(_0x24c7('0x5'));var db=require(_0x24c7('0x6'))['db'];var utils=require(_0x24c7('0x7'));var logger=require(_0x24c7('0x8'))(_0x24c7('0x9'));var config=require(_0x24c7('0xa'));var jayson=require(_0x24c7('0xb'));var client=jayson[_0x24c7('0xc')]['http']({'port':0x232a});config[_0x24c7('0xd')]=_[_0x24c7('0xe')](config[_0x24c7('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x24c7('0xf'))(new Redis(config['redis']));require(_0x24c7('0x10'))['register'](socket);function respondWithRpcPromise(_0x2ae237,_0x3cfc3c,_0x41c45b){return new BPromise(function(_0xac9fe7,_0x39c6a7){return client[_0x24c7('0x11')](_0x2ae237,_0x41c45b)['then'](function(_0x522a70){logger[_0x24c7('0x12')](_0x24c7('0x13'),_0x3cfc3c,_0x24c7('0x14'));logger['debug'](_0x24c7('0x15'),_0x3cfc3c,_0x24c7('0x14'),JSON[_0x24c7('0x16')](_0x522a70));if(_0x522a70['error']){if(_0x522a70[_0x24c7('0x17')][_0x24c7('0x18')]===0x1f4){logger[_0x24c7('0x17')](_0x24c7('0x13'),_0x3cfc3c,_0x522a70[_0x24c7('0x17')]['message']);return _0x39c6a7(_0x522a70[_0x24c7('0x17')][_0x24c7('0x19')]);}logger['error'](_0x24c7('0x13'),_0x3cfc3c,_0x522a70[_0x24c7('0x17')][_0x24c7('0x19')]);return _0xac9fe7(_0x522a70[_0x24c7('0x17')][_0x24c7('0x19')]);}else{logger[_0x24c7('0x12')](_0x24c7('0x13'),_0x3cfc3c,_0x24c7('0x14'));_0xac9fe7(_0x522a70['result']['message']);}})[_0x24c7('0x1a')](function(_0x3492d7){logger[_0x24c7('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3cfc3c,_0x3492d7);_0x39c6a7(_0x3492d7);});});}exports[_0x24c7('0x1b')]=function(_0x40a7d3){var _0x1137a7=this;return new Promise(function(_0x3307f7,_0x5161ee){return db['OpenchannelInteraction'][_0x24c7('0x1c')](_0x40a7d3[_0x24c7('0x1d')],{'raw':_0x40a7d3[_0x24c7('0x1e')]?_0x40a7d3[_0x24c7('0x1e')][_0x24c7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40a7d3[_0x24c7('0x1e')]?_0x40a7d3[_0x24c7('0x1e')]['where']||null:null,'attributes':_0x40a7d3['options']?_0x40a7d3['options']['attributes']||null:null,'limit':_0x40a7d3[_0x24c7('0x1e')]?_0x40a7d3[_0x24c7('0x1e')][_0x24c7('0x20')]||null:null})[_0x24c7('0x21')](function(_0x5c14d7){logger[_0x24c7('0x12')](_0x24c7('0x1b'),_0x40a7d3);logger[_0x24c7('0x22')](_0x24c7('0x1b'),_0x40a7d3,JSON['stringify'](_0x5c14d7));_0x3307f7(_0x5c14d7);})['catch'](function(_0x294540){logger[_0x24c7('0x17')](_0x24c7('0x1b'),_0x294540[_0x24c7('0x19')],_0x40a7d3);_0x5161ee(_0x1137a7[_0x24c7('0x17')](0x1f4,_0x294540[_0x24c7('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1e3de1){return new Promise(function(_0x5db8d3,_0x4e1dae){return db[_0x24c7('0x23')][_0x24c7('0x24')]({'where':_0x1e3de1['options']?_0x1e3de1[_0x24c7('0x1e')][_0x24c7('0x25')]||null:null})[_0x24c7('0x21')](function(_0x359a66){if(_0x359a66){return _0x359a66[_0x24c7('0x26')](_0x1e3de1[_0x24c7('0x1d')][_0x24c7('0x27')],_[_0x24c7('0x28')](_0x1e3de1[_0x24c7('0x1d')],[_0x24c7('0x27'),'id'])||{});}})[_0x24c7('0x29')](function(_0x366a8b){logger[_0x24c7('0x12')](_0x24c7('0x2a'),_0x1e3de1);logger[_0x24c7('0x22')]('AddTags',_0x1e3de1,JSON['stringify'](_0x366a8b));_0x5db8d3(_0x366a8b);})[_0x24c7('0x1a')](function(_0x17816e){logger[_0x24c7('0x17')]('AddTags',_0x17816e['message'],_0x1e3de1);_0x4e1dae(_this['error'](0x1f4,_0x17816e[_0x24c7('0x19')]));});});}; \ No newline at end of file +var _0xb70d=['find','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','OpenchannelInteraction','update','body','options','where','attributes','limit','then','UpdateOpenchannelInteraction'];(function(_0x517601,_0xd0d78d){var _0x36397d=function(_0x3d19e4){while(--_0x3d19e4){_0x517601['push'](_0x517601['shift']());}};_0x36397d(++_0xd0d78d);}(_0xb70d,0x1cd));var _0xdb70=function(_0x333db6,_0x4c23bc){_0x333db6=_0x333db6-0x0;var _0x18620e=_0xb70d[_0x333db6];return _0x18620e;};'use strict';var _=require(_0xdb70('0x0'));var util=require(_0xdb70('0x1'));var moment=require(_0xdb70('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb70('0x3'));var fs=require('fs');var Redis=require(_0xdb70('0x4'));var db=require(_0xdb70('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb70('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdb70('0x7'));var client=jayson['client'][_0xdb70('0x8')]({'port':0x232a});config[_0xdb70('0x9')]=_[_0xdb70('0xa')](config[_0xdb70('0x9')],{'host':_0xdb70('0xb'),'port':0x18eb});var socket=require(_0xdb70('0xc'))(new Redis(config[_0xdb70('0x9')]));require('./openchannelInteraction.socket')[_0xdb70('0xd')](socket);function respondWithRpcPromise(_0x450315,_0x4053b7,_0x3f58bf){return new BPromise(function(_0x102a86,_0x2f3a1d){return client[_0xdb70('0xe')](_0x450315,_0x3f58bf)['then'](function(_0x54ea9f){logger[_0xdb70('0xf')](_0xdb70('0x10'),_0x4053b7,_0xdb70('0x11'));logger[_0xdb70('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4053b7,'request\x20sent',JSON[_0xdb70('0x13')](_0x54ea9f));if(_0x54ea9f['error']){if(_0x54ea9f[_0xdb70('0x14')][_0xdb70('0x15')]===0x1f4){logger['error'](_0xdb70('0x10'),_0x4053b7,_0x54ea9f['error'][_0xdb70('0x16')]);return _0x2f3a1d(_0x54ea9f[_0xdb70('0x14')][_0xdb70('0x16')]);}logger[_0xdb70('0x14')](_0xdb70('0x10'),_0x4053b7,_0x54ea9f[_0xdb70('0x14')]['message']);return _0x102a86(_0x54ea9f[_0xdb70('0x14')][_0xdb70('0x16')]);}else{logger[_0xdb70('0xf')](_0xdb70('0x10'),_0x4053b7,_0xdb70('0x11'));_0x102a86(_0x54ea9f['result'][_0xdb70('0x16')]);}})[_0xdb70('0x17')](function(_0x51343d){logger[_0xdb70('0x14')](_0xdb70('0x10'),_0x4053b7,_0x51343d);_0x2f3a1d(_0x51343d);});});}exports['UpdateOpenchannelInteraction']=function(_0x27c344){var _0x27f445=this;return new Promise(function(_0x1925a5,_0x561c37){return db[_0xdb70('0x18')][_0xdb70('0x19')](_0x27c344[_0xdb70('0x1a')],{'raw':_0x27c344['options']?_0x27c344[_0xdb70('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27c344[_0xdb70('0x1b')]?_0x27c344[_0xdb70('0x1b')][_0xdb70('0x1c')]||null:null,'attributes':_0x27c344[_0xdb70('0x1b')]?_0x27c344['options'][_0xdb70('0x1d')]||null:null,'limit':_0x27c344[_0xdb70('0x1b')]?_0x27c344[_0xdb70('0x1b')][_0xdb70('0x1e')]||null:null})[_0xdb70('0x1f')](function(_0xa35db1){logger[_0xdb70('0xf')](_0xdb70('0x20'),_0x27c344);logger[_0xdb70('0x12')](_0xdb70('0x20'),_0x27c344,JSON[_0xdb70('0x13')](_0xa35db1));_0x1925a5(_0xa35db1);})[_0xdb70('0x17')](function(_0x585bf2){logger[_0xdb70('0x14')](_0xdb70('0x20'),_0x585bf2[_0xdb70('0x16')],_0x27c344);_0x561c37(_0x27f445[_0xdb70('0x14')](0x1f4,_0x585bf2[_0xdb70('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0xcf814f){return new Promise(function(_0x304d22,_0x108bad){return db[_0xdb70('0x18')][_0xdb70('0x21')]({'where':_0xcf814f[_0xdb70('0x1b')]?_0xcf814f[_0xdb70('0x1b')][_0xdb70('0x1c')]||null:null})[_0xdb70('0x1f')](function(_0x2a1052){if(_0x2a1052){return _0x2a1052[_0xdb70('0x22')](_0xcf814f['body'][_0xdb70('0x23')],_[_0xdb70('0x24')](_0xcf814f['body'],['ids','id'])||{});}})['spread'](function(_0x525034){logger[_0xdb70('0xf')]('AddTags',_0xcf814f);logger[_0xdb70('0x12')](_0xdb70('0x25'),_0xcf814f,JSON['stringify'](_0x525034));_0x304d22(_0x525034);})['catch'](function(_0x5a411d){logger['error'](_0xdb70('0x25'),_0x5a411d[_0xdb70('0x16')],_0xcf814f);_0x108bad(_this[_0xdb70('0x14')](0x1f4,_0x5a411d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a30acbb..c53be5d 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 _0x7bb4=['save','remove','update','emit','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x4225eb,_0x2ea5ac){var _0x2ca938=function(_0x8a82a5){while(--_0x8a82a5){_0x4225eb['push'](_0x4225eb['shift']());}};_0x2ca938(++_0x2ea5ac);}(_0x7bb4,0x109));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0x47bb('0x0'));var events=[_0x47bb('0x1'),_0x47bb('0x2'),_0x47bb('0x3')];function createListener(_0xc850ab,_0x41c51a){return function(_0x1bc0a4){_0x41c51a[_0x47bb('0x4')](_0xc850ab,_0x1bc0a4);};}function removeListener(_0xe9b847,_0x104339){return function(){OpenchannelInteractionEvents['removeListener'](_0xe9b847,_0x104339);};}exports['register']=function(_0x543a3e){for(var _0x1d60c7=0x0,_0x4325da=events[_0x47bb('0x5')];_0x1d60c7<_0x4325da;_0x1d60c7++){var _0x4df80c=events[_0x1d60c7];var _0x3f7464=createListener(_0x47bb('0x6')+_0x4df80c,_0x543a3e);OpenchannelInteractionEvents['on'](_0x4df80c,_0x3f7464);}}; \ No newline at end of file +var _0xd20f=['remove','update','emit','register','length','./openchannelInteraction.events','save'];(function(_0x145f35,_0x1a100c){var _0x5b911f=function(_0x364608){while(--_0x364608){_0x145f35['push'](_0x145f35['shift']());}};_0x5b911f(++_0x1a100c);}(_0xd20f,0x140));var _0xfd20=function(_0x5986f8,_0x8dc180){_0x5986f8=_0x5986f8-0x0;var _0xa0dcd8=_0xd20f[_0x5986f8];return _0xa0dcd8;};'use strict';var OpenchannelInteractionEvents=require(_0xfd20('0x0'));var events=[_0xfd20('0x1'),_0xfd20('0x2'),_0xfd20('0x3')];function createListener(_0x241a55,_0x12795d){return function(_0x1fc901){_0x12795d[_0xfd20('0x4')](_0x241a55,_0x1fc901);};}function removeListener(_0x32c70a,_0x225683){return function(){OpenchannelInteractionEvents['removeListener'](_0x32c70a,_0x225683);};}exports[_0xfd20('0x5')]=function(_0x334bd4){for(var _0x5f35f4=0x0,_0xfc58ba=events[_0xfd20('0x6')];_0x5f35f4<_0xfc58ba;_0x5f35f4++){var _0x1ecb9e=events[_0x5f35f4];var _0x24bdf0=createListener('openchannelInteraction:'+_0x1ecb9e,_0x334bd4);OpenchannelInteractionEvents['on'](_0x1ecb9e,_0x24bdf0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index c910672..ffda7f7 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x1f0ded,_0x404ba6){var _0xc14076=function(_0x45d4e2){while(--_0x45d4e2){_0x1f0ded['push'](_0x1f0ded['shift']());}};_0xc14076(++_0x404ba6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0xcb91[_0x2b9cf5];return _0xd0cf15;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x372ef6,_0x16d74a){var _0x4cb88b=function(_0x20900d){while(--_0x20900d){_0x372ef6['push'](_0x372ef6['shift']());}};_0x4cb88b(++_0x16d74a);}(_0xedd9,0xfc));var _0x9edd=function(_0x54caa2,_0x1ac26c){_0x54caa2=_0x54caa2-0x0;var _0x167e38=_0xedd9[_0x54caa2];return _0x167e38;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a24d1ca..6c16dc6 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 _0x4c4d=['out','DATE','STRING','TEXT','sequelize','BOOLEAN'];(function(_0x855b1c,_0x131bc8){var _0x5b4c9e=function(_0x44a9a8){while(--_0x44a9a8){_0x855b1c['push'](_0x855b1c['shift']());}};_0x5b4c9e(++_0x131bc8);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x3fc476,_0x7deee8){_0x3fc476=_0x3fc476-0x0;var _0x2d73df=_0x4c4d[_0x3fc476];return _0x2d73df;};'use strict';var Sequelize=require(_0xd4c4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd4c4('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd4c4('0x2')),'defaultValue':_0xd4c4('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd4c4('0x3')]},'providerName':{'type':Sequelize[_0xd4c4('0x4')]},'providerResponse':{'type':Sequelize[_0xd4c4('0x5')]}}; \ No newline at end of file +var _0x6f59=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x835e96,_0x4bcbed){var _0x4c7156=function(_0x519338){while(--_0x519338){_0x835e96['push'](_0x835e96['shift']());}};_0x4c7156(++_0x4bcbed);}(_0x6f59,0x1be));var _0x96f5=function(_0xe021c3,_0x56c96a){_0xe021c3=_0xe021c3-0x0;var _0x206eb8=_0x6f59[_0xe021c3];return _0x206eb8;};'use strict';var Sequelize=require(_0x96f5('0x0'));module[_0x96f5('0x1')]={'body':{'type':Sequelize[_0x96f5('0x2')](_0x96f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x96f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x96f5('0x5')]('in',_0x96f5('0x6')),'defaultValue':_0x96f5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x96f5('0x7')]},'providerName':{'type':Sequelize[_0x96f5('0x8')]},'providerResponse':{'type':Sequelize[_0x96f5('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f217d60..f0170f7 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 _0x0967=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','info','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','event','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1fbde3,_0x59da39){var _0x2b092f=function(_0x18bd24){while(--_0x18bd24){_0x1fbde3['push'](_0x1fbde3['shift']());}};_0x2b092f(++_0x59da39);}(_0x0967,0x100));var _0x7096=function(_0x399dbd,_0x2dd625){_0x399dbd=_0x399dbd-0x0;var _0x346082=_0x0967[_0x399dbd];return _0x346082;};'use strict';var emlformat=require(_0x7096('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7096('0x1'));var jsonpatch=require(_0x7096('0x2'));var rp=require(_0x7096('0x3'));var moment=require(_0x7096('0x4'));var BPromise=require(_0x7096('0x5'));var Mustache=require(_0x7096('0x6'));var util=require(_0x7096('0x7'));var path=require(_0x7096('0x8'));var sox=require('sox');var csv=require(_0x7096('0x9'));var ejs=require(_0x7096('0xa'));var fs=require('fs');var fs_extra=require(_0x7096('0xb'));var _=require(_0x7096('0xc'));var squel=require(_0x7096('0xd'));var crypto=require(_0x7096('0xe'));var jsforce=require(_0x7096('0xf'));var deskjs=require(_0x7096('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7096('0x11'));var Redis=require(_0x7096('0x12'));var authService=require(_0x7096('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7096('0x14'));var logger=require(_0x7096('0x15'))(_0x7096('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7096('0x17'));var db=require(_0x7096('0x18'))['db'];config['redis']=_[_0x7096('0x19')](config['redis'],{'host':_0x7096('0x1a'),'port':0x18eb});var socket=require(_0x7096('0x1b'))(new Redis(config['redis']));require(_0x7096('0x1c'))[_0x7096('0x1d')](socket);var jayson=require(_0x7096('0x1e'));var client=jayson[_0x7096('0x1f')][_0x7096('0x20')]({'port':0x232c});var client9002=jayson[_0x7096('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x240010,_0x2c02ce,_0x138d7d,_0x41cf08){return new BPromise(function(_0x1e8514,_0x57130f){var _0x41bc1b=_0x41cf08||client;return _0x41bc1b[_0x7096('0x21')](_0x240010,_0x138d7d)[_0x7096('0x22')](function(_0x516b97){logger['info'](_0x7096('0x23'),_0x2c02ce,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2c02ce,_0x7096('0x24'),JSON[_0x7096('0x25')](_0x516b97));if(_0x516b97[_0x7096('0x26')]){if(_0x516b97[_0x7096('0x26')][_0x7096('0x27')]===0x1f4){logger[_0x7096('0x26')](_0x7096('0x23'),_0x2c02ce,_0x516b97[_0x7096('0x26')]['message']);return _0x57130f(_0x516b97[_0x7096('0x26')][_0x7096('0x28')]);}logger[_0x7096('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x2c02ce,_0x516b97[_0x7096('0x26')]['message']);return _0x1e8514(_0x516b97['error'][_0x7096('0x28')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2c02ce,_0x7096('0x24'));_0x1e8514(_0x516b97['result'][_0x7096('0x28')]);}})['catch'](function(_0x4f14f9){logger[_0x7096('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x2c02ce,_0x4f14f9);_0x57130f(_0x4f14f9);});});}function respondWithStatusCode(_0x232550,_0x4e0f0a){_0x4e0f0a=_0x4e0f0a||0xcc;return function(_0x4152d1){if(_0x4152d1){return _0x232550[_0x7096('0x29')](_0x4e0f0a);}return _0x232550['status'](_0x4e0f0a)[_0x7096('0x2a')]();};}function respondWithResult(_0x110a4f,_0x4f6d90){_0x4f6d90=_0x4f6d90||0xc8;return function(_0x53e11e){if(_0x53e11e){return _0x110a4f['status'](_0x4f6d90)[_0x7096('0x2b')](_0x53e11e);}};}function respondWithFilteredResult(_0x2a6126,_0x404697){return function(_0xc4153a){if(_0xc4153a){var _0x5b4531=typeof _0x404697[_0x7096('0x2c')]===_0x7096('0x2d')&&typeof _0x404697[_0x7096('0x2e')]===_0x7096('0x2d');var _0x3e7cd8=_0xc4153a[_0x7096('0x2f')];var _0x36ab98=_0x5b4531?0x0:_0x404697[_0x7096('0x2c')];var _0x1323ac=_0x5b4531?_0xc4153a[_0x7096('0x2f')]:_0x404697['offset']+_0x404697['limit'];var _0x582d85;if(_0x1323ac>=_0x3e7cd8){_0x1323ac=_0x3e7cd8;_0x582d85=0xc8;}else{_0x582d85=0xce;}_0x2a6126[_0x7096('0x30')](_0x582d85);return _0x2a6126[_0x7096('0x31')]('Content-Range',_0x36ab98+'-'+_0x1323ac+'/'+_0x3e7cd8)[_0x7096('0x2b')](_0xc4153a);}return null;};}function patchUpdates(_0x30f516){return function(_0x400ef8){try{jsonpatch[_0x7096('0x32')](_0x400ef8,_0x30f516,!![]);}catch(_0x52f725){return BPromise[_0x7096('0x33')](_0x52f725);}return _0x400ef8['save']();};}function saveUpdates(_0x4f0bec,_0x11a2e2){return function(_0x395517){if(_0x395517){return _0x395517[_0x7096('0x34')](_0x4f0bec)[_0x7096('0x22')](function(_0x11e49d){return _0x11e49d;});}return null;};}function removeEntity(_0x4964fb,_0xb6efd9){return function(_0x5741df){if(_0x5741df){return _0x5741df[_0x7096('0x35')]()['then'](function(){_0x4964fb[_0x7096('0x30')](0xcc)[_0x7096('0x2a')]();});}};}function handleEntityNotFound(_0x29de57,_0x423c30){return function(_0x4e09bf){if(!_0x4e09bf){_0x29de57[_0x7096('0x29')](0x194);}return _0x4e09bf;};}function handleError(_0x3f4da4,_0x42a0e4){_0x42a0e4=_0x42a0e4||0x1f4;return function(_0x693571){logger[_0x7096('0x26')](_0x693571[_0x7096('0x36')]);if(_0x693571['name']){delete _0x693571[_0x7096('0x37')];}_0x3f4da4[_0x7096('0x30')](_0x42a0e4)[_0x7096('0x38')](_0x693571);};}exports[_0x7096('0x39')]=function(_0x6dd5cf,_0x49dcab){var _0x4c4509={},_0x13cc43={},_0x3c344c={'count':0x0,'rows':[]};var _0x5185e3=_[_0x7096('0x3a')](db[_0x7096('0x3b')][_0x7096('0x3c')],function(_0x534386){return{'name':_0x534386[_0x7096('0x3d')],'type':_0x534386[_0x7096('0x3e')][_0x7096('0x3f')]};});_0x13cc43[_0x7096('0x40')]=_[_0x7096('0x3a')](_0x5185e3,_0x7096('0x37'));_0x13cc43['query']=_[_0x7096('0x41')](_0x6dd5cf['query']);_0x13cc43[_0x7096('0x42')]=_[_0x7096('0x43')](_0x13cc43[_0x7096('0x40')],_0x13cc43[_0x7096('0x44')]);_0x4c4509[_0x7096('0x45')]=_[_0x7096('0x43')](_0x13cc43[_0x7096('0x40')],qs[_0x7096('0x46')](_0x6dd5cf[_0x7096('0x44')][_0x7096('0x46')]));_0x4c4509[_0x7096('0x45')]=_0x4c4509[_0x7096('0x45')]['length']?_0x4c4509['attributes']:_0x13cc43['model'];if(!_0x6dd5cf['query'][_0x7096('0x47')](_0x7096('0x48'))){_0x4c4509['limit']=qs[_0x7096('0x2e')](_0x6dd5cf[_0x7096('0x44')][_0x7096('0x2e')]);_0x4c4509[_0x7096('0x2c')]=qs[_0x7096('0x2c')](_0x6dd5cf['query'][_0x7096('0x2c')]);}_0x4c4509['order']=qs[_0x7096('0x49')](_0x6dd5cf[_0x7096('0x44')][_0x7096('0x49')]);_0x4c4509[_0x7096('0x4a')]=qs['filters'](_['pick'](_0x6dd5cf['query'],_0x13cc43[_0x7096('0x42')]),_0x5185e3);if(_0x6dd5cf[_0x7096('0x44')]['filter']){_0x4c4509[_0x7096('0x4a')]=_[_0x7096('0x4b')](_0x4c4509[_0x7096('0x4a')],{'$or':_[_0x7096('0x3a')](_0x5185e3,function(_0x5d340b){if(_0x5d340b[_0x7096('0x3e')]!==_0x7096('0x4c')){var _0x503509={};_0x503509[_0x5d340b[_0x7096('0x37')]]={'$like':'%'+_0x6dd5cf['query'][_0x7096('0x4d')]+'%'};return _0x503509;}})});}_0x4c4509=_['merge']({},_0x4c4509,_0x6dd5cf[_0x7096('0x4e')]);var _0x2ec3f8={'where':_0x4c4509[_0x7096('0x4a')]};return db[_0x7096('0x3b')][_0x7096('0x2f')](_0x2ec3f8)[_0x7096('0x22')](function(_0x27fa1d){_0x3c344c[_0x7096('0x2f')]=_0x27fa1d;if(_0x6dd5cf['query'][_0x7096('0x4f')]){_0x4c4509[_0x7096('0x50')]=[{'all':!![]}];}return db[_0x7096('0x3b')][_0x7096('0x51')](_0x4c4509);})['then'](function(_0x5d97dc){_0x3c344c[_0x7096('0x52')]=_0x5d97dc;return _0x3c344c;})[_0x7096('0x22')](respondWithFilteredResult(_0x49dcab,_0x4c4509))[_0x7096('0x53')](handleError(_0x49dcab,null));};exports[_0x7096('0x54')]=function(_0x416cc6,_0x473a82){var _0xa92bfc={'raw':!![],'where':{'id':_0x416cc6[_0x7096('0x55')]['id']}},_0x381460={};_0x381460[_0x7096('0x40')]=_[_0x7096('0x41')](db[_0x7096('0x3b')][_0x7096('0x3c')]);_0x381460[_0x7096('0x44')]=_['keys'](_0x416cc6[_0x7096('0x44')]);_0x381460[_0x7096('0x42')]=_[_0x7096('0x43')](_0x381460['model'],_0x381460[_0x7096('0x44')]);_0xa92bfc[_0x7096('0x45')]=_[_0x7096('0x43')](_0x381460[_0x7096('0x40')],qs['fields'](_0x416cc6[_0x7096('0x44')][_0x7096('0x46')]));_0xa92bfc[_0x7096('0x45')]=_0xa92bfc[_0x7096('0x45')][_0x7096('0x56')]?_0xa92bfc[_0x7096('0x45')]:_0x381460['model'];if(_0x416cc6['query'][_0x7096('0x4f')]){_0xa92bfc['include']=[{'all':!![]}];}_0xa92bfc=_['merge']({},_0xa92bfc,_0x416cc6['options']);return db[_0x7096('0x3b')][_0x7096('0x57')](_0xa92bfc)[_0x7096('0x22')](handleEntityNotFound(_0x473a82,null))[_0x7096('0x22')](respondWithResult(_0x473a82,null))[_0x7096('0x53')](handleError(_0x473a82,null));};exports[_0x7096('0x58')]=function(_0x43427b,_0x49dc75){return db[_0x7096('0x3b')]['create'](_0x43427b[_0x7096('0x59')],{})['then'](respondWithResult(_0x49dc75,0xc9))['catch'](handleError(_0x49dc75,null));};exports['update']=function(_0x5b7cbf,_0x696271){if(_0x5b7cbf[_0x7096('0x59')]['id']){delete _0x5b7cbf[_0x7096('0x59')]['id'];}return db[_0x7096('0x3b')]['find']({'where':{'id':_0x5b7cbf[_0x7096('0x55')]['id']}})['then'](handleEntityNotFound(_0x696271,null))[_0x7096('0x22')](saveUpdates(_0x5b7cbf[_0x7096('0x59')],null))[_0x7096('0x22')](respondWithResult(_0x696271,null))[_0x7096('0x53')](handleError(_0x696271,null));};exports['destroy']=function(_0x334391,_0x5cccf9){return db[_0x7096('0x3b')][_0x7096('0x57')]({'where':{'id':_0x334391[_0x7096('0x55')]['id']}})[_0x7096('0x22')](handleEntityNotFound(_0x5cccf9,null))['then'](removeEntity(_0x5cccf9,null))['catch'](handleError(_0x5cccf9,null));};exports[_0x7096('0x5a')]=function(_0x3c5832,_0x2cc444){return db[_0x7096('0x3b')]['describe']()['then'](respondWithResult(_0x2cc444,null))[_0x7096('0x53')](handleError(_0x2cc444,null));};var interaction_log=require(_0x7096('0x15'))('openchannel-interactions');exports[_0x7096('0x5b')]=function(_0x58a3fa,_0x29826b,_0x36d4f9){var _0x52ecae={'agent':{},'channel':_0x7096('0x5c')};if(_0x58a3fa[_0x7096('0x59')]['id']){delete _0x58a3fa[_0x7096('0x59')]['id'];}_0x58a3fa[_0x7096('0x59')][_0x7096('0x5d')]=!![];_0x58a3fa[_0x7096('0x59')][_0x7096('0x5e')]=moment()[_0x7096('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x58a3fa[_0x7096('0x59')][_0x7096('0x60')]=_0x58a3fa['body'][_0x7096('0x60')]||_0x58a3fa[_0x7096('0x61')]['id'];_0x52ecae[_0x7096('0x62')]['id']=_0x58a3fa['body'][_0x7096('0x60')];return db[_0x7096('0x3b')][_0x7096('0x57')]({'where':{'id':_0x58a3fa['params']['id'],'UserId':null}})[_0x7096('0x22')](handleEntityNotFound(_0x29826b,null))[_0x7096('0x22')](saveUpdates(_0x58a3fa[_0x7096('0x59')],null))[_0x7096('0x22')](function(_0x10a9a4){if(_0x10a9a4){_0x52ecae[_0x7096('0x28')]=_0x10a9a4[_0x7096('0x63')]({'plain':!![]});return db[_0x7096('0x64')][_0x7096('0x57')]({'where':{'id':_0x10a9a4['OpenchannelInteractionId']}});}return null;})[_0x7096('0x22')](handleEntityNotFound(_0x29826b,null))['then'](function(_0x50e94f){if(_0x50e94f){return _0x50e94f[_0x7096('0x34')]({'UserId':_0x58a3fa[_0x7096('0x59')][_0x7096('0x60')],'read1stAt':_[_0x7096('0x65')](_0x50e94f[_0x7096('0x66')])?moment()[_0x7096('0x5f')](_0x7096('0x67')):undefined});}return null;})[_0x7096('0x22')](function(_0x451a9b){if(_0x451a9b){_0x52ecae['interaction']=_0x451a9b['get']({'plain':!![]});interaction_log[_0x7096('0x68')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x58a3fa[_0x7096('0x61')]['id'],_0x58a3fa[_0x7096('0x61')][_0x7096('0x37')],_0x58a3fa[_0x7096('0x61')][_0x7096('0x69')],_0x52ecae['interaction']['id'],_0x58a3fa[_0x7096('0x59')]?JSON[_0x7096('0x25')](_0x58a3fa[_0x7096('0x59')]):_0x7096('0x6a'));return respondWithRpcPromise(_0x7096('0x6b'),_0x7096('0x6c'),_0x52ecae);}return null;})[_0x7096('0x22')](function(_0x330bc0){var _0x47331f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x330bc0[_0x7096('0x28')][_0x7096('0x6d')];return db[_0x7096('0x6e')]['query'](_0x47331f,{'type':db[_0x7096('0x6f')][_0x7096('0x70')][_0x7096('0x71')],'raw':!![]})[_0x7096('0x22')](function(_0x28ec9b){return _0x28ec9b;});})[_0x7096('0x22')](function(_0x2424d9){if(_0x2424d9){_0x52ecae[_0x7096('0x28')]['contact']=_0x2424d9[0x0];if(!_0x58a3fa[_0x7096('0x59')][_0x7096('0x60')])return;return db[_0x7096('0x72')]['find']({'where':{'id':_0x58a3fa['body'][_0x7096('0x60')],'role':_0x7096('0x62')},'attributes':['id',_0x7096('0x37'),_0x7096('0x73'),'email',_0x7096('0x74')],'raw':!![]});}return null;})[_0x7096('0x22')](function(_0x5513f9){if(!_0x5513f9)return null;_0x52ecae[_0x7096('0x28')][_0x7096('0x62')]=_0x5513f9;return _0x52ecae;})['then'](function(_0xe9c835){if(_0xe9c835){if(_0x58a3fa[_0x7096('0x59')][_0x7096('0x75')]){_0x52ecae[_0x7096('0x28')][_0x7096('0x76')]=util[_0x7096('0x5f')](_0x7096('0x77'),_0x58a3fa[_0x7096('0x61')][_0x7096('0x37')]);_0x52ecae[_0x7096('0x28')][_0x7096('0x78')]=_0x52ecae[_0x7096('0x78')];_0x52ecae[_0x7096('0x28')][_0x7096('0x79')]=_0x52ecae[_0x7096('0x78')];_0x52ecae['message']['event']='accept';return respondWithRpcPromise(_0x7096('0x7a'),_0x7096('0x7a'),{'event':_0x7096('0x7b'),'message':_0x52ecae[_0x7096('0x28')]},client9002)[_0x7096('0x22')](function(){return _0x52ecae;});}return _0x52ecae;}return null;})[_0x7096('0x22')](respondWithResult(_0x29826b,null))['catch'](handleError(_0x29826b,null));};var interaction_log=require('../../config/logger')(_0x7096('0x7c'));exports['reject']=function(_0x1a5e4f,_0x80efc8,_0x32addb){var _0x4c4020={'agent':{},'channel':'openchannel'};if(_0x1a5e4f['body']['id']){delete _0x1a5e4f['body']['id'];}_0x1a5e4f[_0x7096('0x59')]['UserId']=_0x1a5e4f[_0x7096('0x59')][_0x7096('0x60')]||_0x1a5e4f[_0x7096('0x61')]['id'];_0x4c4020[_0x7096('0x62')]['id']=_0x1a5e4f['body']['UserId'];return db[_0x7096('0x3b')]['find']({'where':{'id':_0x1a5e4f['params']['id'],'UserId':null}})[_0x7096('0x22')](handleEntityNotFound(_0x80efc8,null))[_0x7096('0x22')](function(_0x33feef){if(_0x33feef){_0x4c4020[_0x7096('0x28')]=_0x33feef['get']({'plain':!![]});return db[_0x7096('0x64')][_0x7096('0x57')]({'where':{'id':_0x33feef[_0x7096('0x7d')]}});}return null;})[_0x7096('0x22')](handleEntityNotFound(_0x80efc8,null))['then'](function(_0x52ce0a){if(_0x52ce0a){_0x4c4020[_0x7096('0x7e')]=_0x52ce0a[_0x7096('0x63')]({'plain':!![]});interaction_log[_0x7096('0x68')](_0x7096('0x7f'),_0x1a5e4f[_0x7096('0x61')]['id'],_0x1a5e4f[_0x7096('0x61')][_0x7096('0x37')],_0x1a5e4f[_0x7096('0x61')][_0x7096('0x69')],_0x4c4020[_0x7096('0x7e')]['id'],_0x1a5e4f[_0x7096('0x59')]?JSON[_0x7096('0x25')](_0x1a5e4f['body']):_0x7096('0x6a'));return respondWithRpcPromise(_0x7096('0x80'),_0x7096('0x81'),_0x4c4020);}return null;})[_0x7096('0x22')](function(_0x15b6f8){var _0x3c1bc5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x15b6f8['message'][_0x7096('0x6d')];return db[_0x7096('0x6e')]['query'](_0x3c1bc5,{'type':db[_0x7096('0x6f')][_0x7096('0x70')]['SELECT'],'raw':!![]})['then'](function(_0xa7d712){return _0xa7d712;});})[_0x7096('0x22')](function(_0x183b7e){if(_0x183b7e){_0x4c4020[_0x7096('0x28')][_0x7096('0x82')]=_0x183b7e[0x0];if(!_0x1a5e4f[_0x7096('0x59')][_0x7096('0x60')])return;return db[_0x7096('0x72')][_0x7096('0x57')]({'where':{'id':_0x1a5e4f[_0x7096('0x59')]['UserId'],'role':_0x7096('0x62')},'attributes':['id','name',_0x7096('0x73'),'email',_0x7096('0x74')],'raw':!![]});}return null;})[_0x7096('0x22')](function(_0x3cbfd3){if(!_0x3cbfd3)return null;_0x4c4020[_0x7096('0x28')]['agent']=_0x3cbfd3;return _0x4c4020;})[_0x7096('0x22')](function(_0x1b0e71){if(_0x1b0e71){_0x1b0e71[_0x7096('0x28')]['interface']=util[_0x7096('0x5f')](_0x7096('0x77'),_0x1a5e4f[_0x7096('0x61')][_0x7096('0x37')]);_0x1b0e71[_0x7096('0x28')][_0x7096('0x78')]=_0x4c4020['channel'];_0x1b0e71[_0x7096('0x28')][_0x7096('0x79')]=_0x4c4020[_0x7096('0x78')];_0x1b0e71[_0x7096('0x28')][_0x7096('0x83')]='reject';respondWithRpcPromise('EventManager',_0x7096('0x7a'),{'event':'rejectmessage','message':_0x1b0e71[_0x7096('0x28')]},client9002);return _0x4c4020;}return null;})[_0x7096('0x22')](respondWithResult(_0x80efc8,null))['catch'](handleError(_0x80efc8,null));}; \ No newline at end of file +var _0xcf04=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','OpenchannelMessage','rows','catch','params','include','find','create','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','openchannel-interactions','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','SIP/%s','rejectmessage','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x16e5ce,_0x4544a1){var _0x533912=function(_0x285bc5){while(--_0x285bc5){_0x16e5ce['push'](_0x16e5ce['shift']());}};_0x533912(++_0x4544a1);}(_0xcf04,0x1f2));var _0x4cf0=function(_0x91dfbe,_0x2ad462){_0x91dfbe=_0x91dfbe-0x0;var _0x4cba47=_0xcf04[_0x91dfbe];return _0x4cba47;};'use strict';var emlformat=require(_0x4cf0('0x0'));var rimraf=require(_0x4cf0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4cf0('0x2'));var moment=require('moment');var BPromise=require(_0x4cf0('0x3'));var Mustache=require(_0x4cf0('0x4'));var util=require('util');var path=require(_0x4cf0('0x5'));var sox=require(_0x4cf0('0x6'));var csv=require(_0x4cf0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4cf0('0x8'));var _=require(_0x4cf0('0x9'));var squel=require(_0x4cf0('0xa'));var crypto=require(_0x4cf0('0xb'));var jsforce=require(_0x4cf0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4cf0('0xd'));var Papa=require(_0x4cf0('0xe'));var Redis=require(_0x4cf0('0xf'));var authService=require(_0x4cf0('0x10'));var qs=require(_0x4cf0('0x11'));var as=require(_0x4cf0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4cf0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4cf0('0x14'));var licenseUtil=require(_0x4cf0('0x15'));var db=require(_0x4cf0('0x16'))['db'];config[_0x4cf0('0x17')]=_['defaults'](config[_0x4cf0('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x4cf0('0x18'))(new Redis(config['redis']));require(_0x4cf0('0x19'))[_0x4cf0('0x1a')](socket);var jayson=require(_0x4cf0('0x1b'));var client=jayson[_0x4cf0('0x1c')][_0x4cf0('0x1d')]({'port':0x232c});var client9002=jayson[_0x4cf0('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249682,_0x4da795,_0x1cbcf1,_0x532f7c){return new BPromise(function(_0x47ff1f,_0x437aef){var _0x57aeb3=_0x532f7c||client;return _0x57aeb3[_0x4cf0('0x1e')](_0x249682,_0x1cbcf1)[_0x4cf0('0x1f')](function(_0x1a13d9){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x4da795,_0x4cf0('0x20'));logger[_0x4cf0('0x21')](_0x4cf0('0x22'),_0x4da795,_0x4cf0('0x20'),JSON[_0x4cf0('0x23')](_0x1a13d9));if(_0x1a13d9[_0x4cf0('0x24')]){if(_0x1a13d9[_0x4cf0('0x24')]['code']===0x1f4){logger[_0x4cf0('0x24')](_0x4cf0('0x25'),_0x4da795,_0x1a13d9[_0x4cf0('0x24')][_0x4cf0('0x26')]);return _0x437aef(_0x1a13d9[_0x4cf0('0x24')]['message']);}logger[_0x4cf0('0x24')](_0x4cf0('0x25'),_0x4da795,_0x1a13d9[_0x4cf0('0x24')][_0x4cf0('0x26')]);return _0x47ff1f(_0x1a13d9['error'][_0x4cf0('0x26')]);}else{logger['info'](_0x4cf0('0x25'),_0x4da795,_0x4cf0('0x20'));_0x47ff1f(_0x1a13d9[_0x4cf0('0x27')][_0x4cf0('0x26')]);}})['catch'](function(_0x5eb60f){logger[_0x4cf0('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x4da795,_0x5eb60f);_0x437aef(_0x5eb60f);});});}function respondWithStatusCode(_0x301393,_0x2d3775){_0x2d3775=_0x2d3775||0xcc;return function(_0x14d126){if(_0x14d126){return _0x301393[_0x4cf0('0x28')](_0x2d3775);}return _0x301393[_0x4cf0('0x29')](_0x2d3775)[_0x4cf0('0x2a')]();};}function respondWithResult(_0x3497f2,_0x2b4fd2){_0x2b4fd2=_0x2b4fd2||0xc8;return function(_0xa1a6d0){if(_0xa1a6d0){return _0x3497f2[_0x4cf0('0x29')](_0x2b4fd2)[_0x4cf0('0x2b')](_0xa1a6d0);}};}function respondWithFilteredResult(_0x18d43a,_0xb59e12){return function(_0x4ffe88){if(_0x4ffe88){var _0x2c88cf=typeof _0xb59e12['offset']==='undefined'&&typeof _0xb59e12[_0x4cf0('0x2c')]===_0x4cf0('0x2d');var _0x4bb028=_0x4ffe88['count'];var _0x844991=_0x2c88cf?0x0:_0xb59e12[_0x4cf0('0x2e')];var _0x486504=_0x2c88cf?_0x4ffe88[_0x4cf0('0x2f')]:_0xb59e12[_0x4cf0('0x2e')]+_0xb59e12[_0x4cf0('0x2c')];var _0xaf3916;if(_0x486504>=_0x4bb028){_0x486504=_0x4bb028;_0xaf3916=0xc8;}else{_0xaf3916=0xce;}_0x18d43a[_0x4cf0('0x29')](_0xaf3916);return _0x18d43a[_0x4cf0('0x30')](_0x4cf0('0x31'),_0x844991+'-'+_0x486504+'/'+_0x4bb028)[_0x4cf0('0x2b')](_0x4ffe88);}return null;};}function patchUpdates(_0xd819ab){return function(_0x1ad007){try{jsonpatch[_0x4cf0('0x32')](_0x1ad007,_0xd819ab,!![]);}catch(_0x8a5c8e){return BPromise[_0x4cf0('0x33')](_0x8a5c8e);}return _0x1ad007[_0x4cf0('0x34')]();};}function saveUpdates(_0x16c3bb,_0x30f410){return function(_0x2de938){if(_0x2de938){return _0x2de938[_0x4cf0('0x35')](_0x16c3bb)[_0x4cf0('0x1f')](function(_0x29957f){return _0x29957f;});}return null;};}function removeEntity(_0x505560,_0x266782){return function(_0x4033f1){if(_0x4033f1){return _0x4033f1[_0x4cf0('0x36')]()[_0x4cf0('0x1f')](function(){_0x505560[_0x4cf0('0x29')](0xcc)[_0x4cf0('0x2a')]();});}};}function handleEntityNotFound(_0x36c3a7,_0x83d444){return function(_0x49a4c9){if(!_0x49a4c9){_0x36c3a7[_0x4cf0('0x28')](0x194);}return _0x49a4c9;};}function handleError(_0x5258e3,_0x3e1c73){_0x3e1c73=_0x3e1c73||0x1f4;return function(_0x1823e4){logger[_0x4cf0('0x24')](_0x1823e4[_0x4cf0('0x37')]);if(_0x1823e4[_0x4cf0('0x38')]){delete _0x1823e4[_0x4cf0('0x38')];}_0x5258e3[_0x4cf0('0x29')](_0x3e1c73)[_0x4cf0('0x39')](_0x1823e4);};}exports[_0x4cf0('0x3a')]=function(_0x2c82aa,_0x2558bb){var _0x1233ea={},_0x5c1534={},_0x4d42ff={'count':0x0,'rows':[]};var _0x2cb7da=_[_0x4cf0('0x3b')](db['OpenchannelMessage'][_0x4cf0('0x3c')],function(_0x342750){return{'name':_0x342750[_0x4cf0('0x3d')],'type':_0x342750[_0x4cf0('0x3e')][_0x4cf0('0x3f')]};});_0x5c1534[_0x4cf0('0x40')]=_[_0x4cf0('0x3b')](_0x2cb7da,_0x4cf0('0x38'));_0x5c1534[_0x4cf0('0x41')]=_[_0x4cf0('0x42')](_0x2c82aa['query']);_0x5c1534[_0x4cf0('0x43')]=_[_0x4cf0('0x44')](_0x5c1534[_0x4cf0('0x40')],_0x5c1534['query']);_0x1233ea[_0x4cf0('0x45')]=_[_0x4cf0('0x44')](_0x5c1534[_0x4cf0('0x40')],qs[_0x4cf0('0x46')](_0x2c82aa['query'][_0x4cf0('0x46')]));_0x1233ea['attributes']=_0x1233ea[_0x4cf0('0x45')][_0x4cf0('0x47')]?_0x1233ea[_0x4cf0('0x45')]:_0x5c1534[_0x4cf0('0x40')];if(!_0x2c82aa['query']['hasOwnProperty'](_0x4cf0('0x48'))){_0x1233ea[_0x4cf0('0x2c')]=qs[_0x4cf0('0x2c')](_0x2c82aa['query'][_0x4cf0('0x2c')]);_0x1233ea['offset']=qs['offset'](_0x2c82aa[_0x4cf0('0x41')][_0x4cf0('0x2e')]);}_0x1233ea[_0x4cf0('0x49')]=qs['sort'](_0x2c82aa[_0x4cf0('0x41')][_0x4cf0('0x4a')]);_0x1233ea['where']=qs['filters'](_[_0x4cf0('0x4b')](_0x2c82aa[_0x4cf0('0x41')],_0x5c1534['filters']),_0x2cb7da);if(_0x2c82aa[_0x4cf0('0x41')][_0x4cf0('0x4c')]){_0x1233ea[_0x4cf0('0x4d')]=_[_0x4cf0('0x4e')](_0x1233ea[_0x4cf0('0x4d')],{'$or':_['map'](_0x2cb7da,function(_0x2a37af){if(_0x2a37af[_0x4cf0('0x3e')]!==_0x4cf0('0x4f')){var _0x2fcb94={};_0x2fcb94[_0x2a37af[_0x4cf0('0x38')]]={'$like':'%'+_0x2c82aa[_0x4cf0('0x41')][_0x4cf0('0x4c')]+'%'};return _0x2fcb94;}})});}_0x1233ea=_[_0x4cf0('0x4e')]({},_0x1233ea,_0x2c82aa[_0x4cf0('0x50')]);var _0x4e5143={'where':_0x1233ea[_0x4cf0('0x4d')]};return db['OpenchannelMessage'][_0x4cf0('0x2f')](_0x4e5143)[_0x4cf0('0x1f')](function(_0x529cd0){_0x4d42ff[_0x4cf0('0x2f')]=_0x529cd0;if(_0x2c82aa['query'][_0x4cf0('0x51')]){_0x1233ea['include']=[{'all':!![]}];}return db[_0x4cf0('0x52')]['findAll'](_0x1233ea);})['then'](function(_0xbb19ae){_0x4d42ff[_0x4cf0('0x53')]=_0xbb19ae;return _0x4d42ff;})[_0x4cf0('0x1f')](respondWithFilteredResult(_0x2558bb,_0x1233ea))[_0x4cf0('0x54')](handleError(_0x2558bb,null));};exports['show']=function(_0x376d02,_0x5790bb){var _0x568b54={'raw':!![],'where':{'id':_0x376d02[_0x4cf0('0x55')]['id']}},_0x394f2c={};_0x394f2c[_0x4cf0('0x40')]=_[_0x4cf0('0x42')](db[_0x4cf0('0x52')][_0x4cf0('0x3c')]);_0x394f2c[_0x4cf0('0x41')]=_[_0x4cf0('0x42')](_0x376d02['query']);_0x394f2c['filters']=_[_0x4cf0('0x44')](_0x394f2c[_0x4cf0('0x40')],_0x394f2c[_0x4cf0('0x41')]);_0x568b54['attributes']=_['intersection'](_0x394f2c[_0x4cf0('0x40')],qs[_0x4cf0('0x46')](_0x376d02[_0x4cf0('0x41')][_0x4cf0('0x46')]));_0x568b54[_0x4cf0('0x45')]=_0x568b54[_0x4cf0('0x45')][_0x4cf0('0x47')]?_0x568b54[_0x4cf0('0x45')]:_0x394f2c[_0x4cf0('0x40')];if(_0x376d02[_0x4cf0('0x41')][_0x4cf0('0x51')]){_0x568b54[_0x4cf0('0x56')]=[{'all':!![]}];}_0x568b54=_['merge']({},_0x568b54,_0x376d02[_0x4cf0('0x50')]);return db[_0x4cf0('0x52')][_0x4cf0('0x57')](_0x568b54)[_0x4cf0('0x1f')](handleEntityNotFound(_0x5790bb,null))[_0x4cf0('0x1f')](respondWithResult(_0x5790bb,null))[_0x4cf0('0x54')](handleError(_0x5790bb,null));};exports[_0x4cf0('0x58')]=function(_0x266229,_0x1da8cf){return db['OpenchannelMessage'][_0x4cf0('0x58')](_0x266229['body'],{})[_0x4cf0('0x1f')](respondWithResult(_0x1da8cf,0xc9))[_0x4cf0('0x54')](handleError(_0x1da8cf,null));};exports[_0x4cf0('0x35')]=function(_0x544380,_0x3701d3){if(_0x544380[_0x4cf0('0x59')]['id']){delete _0x544380[_0x4cf0('0x59')]['id'];}return db[_0x4cf0('0x52')]['find']({'where':{'id':_0x544380[_0x4cf0('0x55')]['id']}})[_0x4cf0('0x1f')](handleEntityNotFound(_0x3701d3,null))['then'](saveUpdates(_0x544380['body'],null))[_0x4cf0('0x1f')](respondWithResult(_0x3701d3,null))['catch'](handleError(_0x3701d3,null));};exports[_0x4cf0('0x36')]=function(_0x13deb2,_0x5eadd6){return db[_0x4cf0('0x52')][_0x4cf0('0x57')]({'where':{'id':_0x13deb2[_0x4cf0('0x55')]['id']}})[_0x4cf0('0x1f')](handleEntityNotFound(_0x5eadd6,null))[_0x4cf0('0x1f')](removeEntity(_0x5eadd6,null))[_0x4cf0('0x54')](handleError(_0x5eadd6,null));};exports[_0x4cf0('0x5a')]=function(_0x3717e4,_0x382033){return db['OpenchannelMessage'][_0x4cf0('0x5a')]()[_0x4cf0('0x1f')](respondWithResult(_0x382033,null))[_0x4cf0('0x54')](handleError(_0x382033,null));};var interaction_log=require(_0x4cf0('0x13'))('openchannel-interactions');exports[_0x4cf0('0x5b')]=function(_0x2bff01,_0x28715b,_0x1dc201){var _0x46b236={'agent':{},'channel':_0x4cf0('0x5c')};if(_0x2bff01[_0x4cf0('0x59')]['id']){delete _0x2bff01[_0x4cf0('0x59')]['id'];}_0x2bff01[_0x4cf0('0x59')][_0x4cf0('0x5d')]=!![];_0x2bff01[_0x4cf0('0x59')][_0x4cf0('0x5e')]=moment()[_0x4cf0('0x5f')](_0x4cf0('0x60'));_0x2bff01[_0x4cf0('0x59')][_0x4cf0('0x61')]=_0x2bff01[_0x4cf0('0x59')][_0x4cf0('0x61')]||_0x2bff01[_0x4cf0('0x62')]['id'];_0x46b236[_0x4cf0('0x63')]['id']=_0x2bff01['body'][_0x4cf0('0x61')];return db[_0x4cf0('0x52')]['find']({'where':{'id':_0x2bff01[_0x4cf0('0x55')]['id'],'UserId':null}})[_0x4cf0('0x1f')](handleEntityNotFound(_0x28715b,null))[_0x4cf0('0x1f')](saveUpdates(_0x2bff01[_0x4cf0('0x59')],null))[_0x4cf0('0x1f')](function(_0x216972){if(_0x216972){_0x46b236[_0x4cf0('0x26')]=_0x216972[_0x4cf0('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x4cf0('0x57')]({'where':{'id':_0x216972[_0x4cf0('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x28715b,null))[_0x4cf0('0x1f')](function(_0x2ad81d){if(_0x2ad81d){return _0x2ad81d[_0x4cf0('0x35')]({'UserId':_0x2bff01[_0x4cf0('0x59')][_0x4cf0('0x61')],'read1stAt':_[_0x4cf0('0x66')](_0x2ad81d[_0x4cf0('0x67')])?moment()[_0x4cf0('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4cf0('0x1f')](function(_0x41de6d){if(_0x41de6d){_0x46b236[_0x4cf0('0x68')]=_0x41de6d[_0x4cf0('0x64')]({'plain':!![]});interaction_log[_0x4cf0('0x69')](_0x4cf0('0x6a'),_0x2bff01[_0x4cf0('0x62')]['id'],_0x2bff01[_0x4cf0('0x62')][_0x4cf0('0x38')],_0x2bff01[_0x4cf0('0x62')][_0x4cf0('0x6b')],_0x46b236[_0x4cf0('0x68')]['id'],_0x2bff01[_0x4cf0('0x59')]?JSON[_0x4cf0('0x23')](_0x2bff01[_0x4cf0('0x59')]):_0x4cf0('0x6c'));return respondWithRpcPromise(_0x4cf0('0x6d'),_0x4cf0('0x6e'),_0x46b236);}return null;})['then'](function(_0x572efb){var _0x5c299b=_0x4cf0('0x6f')+_0x572efb[_0x4cf0('0x26')]['ContactId'];return db[_0x4cf0('0x70')][_0x4cf0('0x41')](_0x5c299b,{'type':db['Sequelize'][_0x4cf0('0x71')][_0x4cf0('0x72')],'raw':!![]})[_0x4cf0('0x1f')](function(_0x942d){return _0x942d;});})[_0x4cf0('0x1f')](function(_0x4e5dca){if(_0x4e5dca){_0x46b236[_0x4cf0('0x26')][_0x4cf0('0x73')]=_0x4e5dca[0x0];if(!_0x2bff01['body'][_0x4cf0('0x61')])return;return db[_0x4cf0('0x74')]['find']({'where':{'id':_0x2bff01[_0x4cf0('0x59')][_0x4cf0('0x61')],'role':_0x4cf0('0x63')},'attributes':['id','name',_0x4cf0('0x75'),_0x4cf0('0x76'),_0x4cf0('0x77')],'raw':!![]});}return null;})[_0x4cf0('0x1f')](function(_0x4b8851){if(!_0x4b8851)return null;_0x46b236[_0x4cf0('0x26')][_0x4cf0('0x63')]=_0x4b8851;return _0x46b236;})[_0x4cf0('0x1f')](function(_0xdcfe9b){if(_0xdcfe9b){if(_0x2bff01[_0x4cf0('0x59')][_0x4cf0('0x78')]){_0x46b236[_0x4cf0('0x26')][_0x4cf0('0x79')]=util[_0x4cf0('0x5f')]('SIP/%s',_0x2bff01[_0x4cf0('0x62')][_0x4cf0('0x38')]);_0x46b236[_0x4cf0('0x26')][_0x4cf0('0x7a')]=_0x46b236[_0x4cf0('0x7a')];_0x46b236['message'][_0x4cf0('0x7b')]=_0x46b236[_0x4cf0('0x7a')];_0x46b236['message'][_0x4cf0('0x7c')]='accept';return respondWithRpcPromise(_0x4cf0('0x7d'),_0x4cf0('0x7d'),{'event':'acceptmessage','message':_0x46b236[_0x4cf0('0x26')]},client9002)[_0x4cf0('0x1f')](function(){return _0x46b236;});}return _0x46b236;}return null;})[_0x4cf0('0x1f')](respondWithResult(_0x28715b,null))['catch'](handleError(_0x28715b,null));};var interaction_log=require(_0x4cf0('0x13'))(_0x4cf0('0x7e'));exports[_0x4cf0('0x33')]=function(_0x4fe839,_0x5249bc,_0x5af4ce){var _0x258987={'agent':{},'channel':_0x4cf0('0x5c')};if(_0x4fe839[_0x4cf0('0x59')]['id']){delete _0x4fe839[_0x4cf0('0x59')]['id'];}_0x4fe839[_0x4cf0('0x59')][_0x4cf0('0x61')]=_0x4fe839[_0x4cf0('0x59')]['UserId']||_0x4fe839['user']['id'];_0x258987[_0x4cf0('0x63')]['id']=_0x4fe839[_0x4cf0('0x59')][_0x4cf0('0x61')];return db['OpenchannelMessage'][_0x4cf0('0x57')]({'where':{'id':_0x4fe839[_0x4cf0('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5249bc,null))[_0x4cf0('0x1f')](function(_0x1b3835){if(_0x1b3835){_0x258987[_0x4cf0('0x26')]=_0x1b3835[_0x4cf0('0x64')]({'plain':!![]});return db[_0x4cf0('0x7f')][_0x4cf0('0x57')]({'where':{'id':_0x1b3835[_0x4cf0('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x5249bc,null))['then'](function(_0x5d1d66){if(_0x5d1d66){_0x258987[_0x4cf0('0x68')]=_0x5d1d66[_0x4cf0('0x64')]({'plain':!![]});interaction_log[_0x4cf0('0x69')](_0x4cf0('0x80'),_0x4fe839['user']['id'],_0x4fe839[_0x4cf0('0x62')]['name'],_0x4fe839[_0x4cf0('0x62')][_0x4cf0('0x6b')],_0x258987['interaction']['id'],_0x4fe839[_0x4cf0('0x59')]?JSON[_0x4cf0('0x23')](_0x4fe839[_0x4cf0('0x59')]):_0x4cf0('0x6c'));return respondWithRpcPromise(_0x4cf0('0x81'),'rejectMessage',_0x258987);}return null;})[_0x4cf0('0x1f')](function(_0x158f62){var _0x5460d5=_0x4cf0('0x6f')+_0x158f62[_0x4cf0('0x26')]['ContactId'];return db['sequelize'][_0x4cf0('0x41')](_0x5460d5,{'type':db[_0x4cf0('0x82')][_0x4cf0('0x71')][_0x4cf0('0x72')],'raw':!![]})[_0x4cf0('0x1f')](function(_0x45c2b0){return _0x45c2b0;});})['then'](function(_0xf941b0){if(_0xf941b0){_0x258987['message'][_0x4cf0('0x73')]=_0xf941b0[0x0];if(!_0x4fe839[_0x4cf0('0x59')][_0x4cf0('0x61')])return;return db[_0x4cf0('0x74')][_0x4cf0('0x57')]({'where':{'id':_0x4fe839[_0x4cf0('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0x4cf0('0x38'),'fullname','email',_0x4cf0('0x77')],'raw':!![]});}return null;})[_0x4cf0('0x1f')](function(_0x306be6){if(!_0x306be6)return null;_0x258987[_0x4cf0('0x26')][_0x4cf0('0x63')]=_0x306be6;return _0x258987;})[_0x4cf0('0x1f')](function(_0x51ee81){if(_0x51ee81){_0x51ee81['message'][_0x4cf0('0x79')]=util[_0x4cf0('0x5f')](_0x4cf0('0x83'),_0x4fe839['user'][_0x4cf0('0x38')]);_0x51ee81[_0x4cf0('0x26')][_0x4cf0('0x7a')]=_0x258987[_0x4cf0('0x7a')];_0x51ee81['message'][_0x4cf0('0x7b')]=_0x258987[_0x4cf0('0x7a')];_0x51ee81[_0x4cf0('0x26')][_0x4cf0('0x7c')]=_0x4cf0('0x33');respondWithRpcPromise(_0x4cf0('0x7d'),'EventManager',{'event':_0x4cf0('0x84'),'message':_0x51ee81[_0x4cf0('0x26')]},client9002);return _0x258987;}return null;})['then'](respondWithResult(_0x5249bc,null))[_0x4cf0('0x54')](handleError(_0x5249bc,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 641d24d..ba20804 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 _0x7339=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x59af24,_0x201f0e){var _0x5d79d4=function(_0x4cc3a4){while(--_0x4cc3a4){_0x59af24['push'](_0x59af24['shift']());}};_0x5d79d4(++_0x201f0e);}(_0x7339,0xbb));var _0x9733=function(_0x5a2951,_0x10fe17){_0x5a2951=_0x5a2951-0x0;var _0x4a9ded=_0x7339[_0x5a2951];return _0x4a9ded;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x9733('0x0'))['db'][_0x9733('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9733('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9733('0x3'),'afterDestroy':_0x9733('0x4')};function emitEvent(_0x1f69b7){return function(_0x34a98a,_0x11c2e0,_0x538463){OpenchannelMessageEvents[_0x9733('0x5')](_0x1f69b7+':'+_0x34a98a['id'],_0x34a98a);OpenchannelMessageEvents[_0x9733('0x5')](_0x1f69b7,_0x34a98a);_0x538463(null);};}for(var e in events){if(events[_0x9733('0x6')](e)){var event=events[e];OpenchannelMessage[_0x9733('0x7')](e,emitEvent(event));}}module[_0x9733('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x187d=['update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage','save'];(function(_0x2fcfa4,_0x2edd95){var _0x1192eb=function(_0x19ccad){while(--_0x19ccad){_0x2fcfa4['push'](_0x2fcfa4['shift']());}};_0x1192eb(++_0x2edd95);}(_0x187d,0x1ec));var _0xd187=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x187d[_0xa1e3e3];return _0xc980e9;};'use strict';var EventEmitter=require(_0xd187('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xd187('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd187('0x2'),'afterUpdate':_0xd187('0x3'),'afterDestroy':_0xd187('0x4')};function emitEvent(_0x59d739){return function(_0x3b5a02,_0x4288a4,_0x2eba79){OpenchannelMessageEvents[_0xd187('0x5')](_0x59d739+':'+_0x3b5a02['id'],_0x3b5a02);OpenchannelMessageEvents[_0xd187('0x5')](_0x59d739,_0x3b5a02);_0x2eba79(null);};}for(var e in events){if(events[_0xd187('0x6')](e)){var event=events[e];OpenchannelMessage[_0xd187('0x7')](e,emitEvent(event));}}module[_0xd187('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 2b82ba6..08e6c29 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 _0x5c00=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','OpenchannelInteraction','catch','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_messages','fti_openchannel_messages','body','models','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','direction','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get'];(function(_0x4265c5,_0x1a9a6){var _0x11c741=function(_0x4e3745){while(--_0x4e3745){_0x4265c5['push'](_0x4265c5['shift']());}};_0x11c741(++_0x1a9a6);}(_0x5c00,0x17e));var _0x05c0=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0x5c00[_0x4c2f17];return _0x20919e;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[{'name':_0x05c0('0xb'),'fields':[_0x05c0('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32a795,_0x32cdfa,_0x996d6b){var _0x321c09=_0x3521fe[_0x05c0('0xd')];var _0x1edbb=_0x32a795['get']({'plain':!![]});if(_0x1edbb['direction'][_0x05c0('0xe')]()==='in'||_0x1edbb['direction'][_0x05c0('0xe')]()===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]&&!_['isNil'](_0x1edbb[_0x05c0('0x11')])){_0x321c09['OpenchannelInteraction'][_0x05c0('0x12')]({'where':{'id':_0x1edbb[_0x05c0('0x13')]}})[_0x05c0('0x14')](function(_0x12deeb){if(_0x12deeb){_0x12deeb[_0x05c0('0x15')]({'lastMsgAt':_0x1edbb[_0x05c0('0x16')],'lastMsgDirection':_0x1edbb[_0x05c0('0x17')][_0x05c0('0xe')]()});}})['catch'](function(_0x238e25){console[_0x05c0('0x18')](_0x238e25);});}if(_0x1edbb[_0x05c0('0x17')]===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]){var _0x40153e;_0x321c09[_0x05c0('0x19')][_0x05c0('0x1a')]()[_0x05c0('0x14')](function(_0x521cbd){return _0x321c09[_0x05c0('0x1b')][_0x05c0('0x1c')]({'where':{'id':_0x1edbb[_0x05c0('0x1d')]},'include':[{'model':_0x321c09['OpenchannelInteraction'],'as':_0x05c0('0x1e'),'where':{'id':_0x1edbb[_0x05c0('0x13')]},'limit':0x1,'include':[{'model':_0x321c09[_0x05c0('0x19')],'as':_0x05c0('0x1f'),'attributes':_[_0x05c0('0x20')](_0x521cbd)}]}]});})['then'](function(_0x407c1f){_0x40153e=_0x407c1f[_0x05c0('0x21')]({'plain':!![]});if(_0x40153e&&_0x40153e['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x24'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x40153e[_0x05c0('0x1e')]&&_0x40153e[_0x05c0('0x1e')][_0x05c0('0x26')]){_0x1edbb['Interaction']=_[_0x05c0('0x27')](_0x40153e[_0x05c0('0x1e')][0x0],'Contact');_0x1edbb['Contact']=_0x40153e['Interactions'][0x0]['Contact'];}var _0x32cdfa={'method':_0x05c0('0x28'),'uri':encodeURI(_0x40153e[_0x05c0('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32cdfa['method']){case _0x05c0('0x29'):_0x32cdfa['qs']=_0x1edbb;break;case _0x05c0('0x28'):_0x32cdfa[_0x05c0('0xc')]=_0x1edbb;break;}return rp(_0x32cdfa)[_0x05c0('0x14')](function(_0x58769a){logger[_0x05c0('0x2a')](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x2c'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x58769a['body']['threadId']&&_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]!=_0x1edbb[_0x05c0('0x2e')][_0x05c0('0x2d')]){return _0x321c09[_0x05c0('0x2f')][_0x05c0('0x15')]({'threadId':_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]},{'logging':!![],'where':{'id':_0x1edbb[_0x05c0('0x2e')]['id']}});}else{return;}})[_0x05c0('0x14')](function(){return _0x32a795[_0x05c0('0x15')]({'read':!![]});})[_0x05c0('0x30')](function(_0x50f03d){logger['error'](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x31')](_0x50f03d,{'showHidden':![],'depth':null}));_0x996d6b();});}else{_0x996d6b();}})['finally'](function(){_0x996d6b();});}else{_0x996d6b();}}},'charset':_0x05c0('0x32'),'collate':_0x05c0('0x33')});}; \ No newline at end of file +var _0xda2d=['OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','out','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','replyUri','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','util','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','UserId'];(function(_0x2ac6b7,_0x949edf){var _0x312705=function(_0x18f405){while(--_0x18f405){_0x2ac6b7['push'](_0x2ac6b7['shift']());}};_0x312705(++_0x949edf);}(_0xda2d,0x102));var _0xdda2=function(_0xb37913,_0x394937){_0xb37913=_0xb37913-0x0;var _0x2d0bfa=_0xda2d[_0xb37913];return _0x2d0bfa;};'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':[{'name':_0xdda2('0xb'),'fields':[_0xdda2('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a774e,_0x22c6e5,_0x4df6b8){var _0x1c11b2=_0x39f6c9[_0xdda2('0xd')];var _0x42d990=_0x1a774e[_0xdda2('0xe')]({'plain':!![]});if(_0x42d990[_0xdda2('0xf')][_0xdda2('0x10')]()==='in'||_0x42d990[_0xdda2('0xf')][_0xdda2('0x10')]()==='out'&&!_0x42d990['secret']&&!_['isNil'](_0x42d990[_0xdda2('0x11')])){_0x1c11b2[_0xdda2('0x12')][_0xdda2('0x13')]({'where':{'id':_0x42d990[_0xdda2('0x14')]}})[_0xdda2('0x15')](function(_0x475222){if(_0x475222){_0x475222[_0xdda2('0x16')]({'lastMsgAt':_0x42d990['createdAt'],'lastMsgDirection':_0x42d990[_0xdda2('0xf')]['toLowerCase']()});}})[_0xdda2('0x17')](function(_0xb6b01e){console[_0xdda2('0x18')](_0xb6b01e);});}if(_0x42d990[_0xdda2('0xf')]===_0xdda2('0x19')&&!_0x42d990['secret']){var _0x55d674;_0x1c11b2[_0xdda2('0x1a')]['describe']()[_0xdda2('0x15')](function(_0x1a3b35){return _0x1c11b2[_0xdda2('0x1b')][_0xdda2('0x1c')]({'where':{'id':_0x42d990[_0xdda2('0x1d')]},'include':[{'model':_0x1c11b2[_0xdda2('0x12')],'as':_0xdda2('0x1e'),'where':{'id':_0x42d990[_0xdda2('0x14')]},'limit':0x1,'include':[{'model':_0x1c11b2[_0xdda2('0x1a')],'as':_0xdda2('0x1f'),'attributes':_[_0xdda2('0x20')](_0x1a3b35)}]}]});})[_0xdda2('0x15')](function(_0x4eed30){_0x55d674=_0x4eed30[_0xdda2('0xe')]({'plain':!![]});if(_0x55d674&&_0x55d674['replyUri']){logger[_0xdda2('0x21')](_0xdda2('0x22'),_0xdda2('0x23'),util['format'](_0xdda2('0x24'),_0x42d990['id'],_0x55d674['replyUri']));if(_0x55d674[_0xdda2('0x1e')]&&_0x55d674[_0xdda2('0x1e')]['length']){_0x42d990[_0xdda2('0x25')]=_[_0xdda2('0x26')](_0x55d674[_0xdda2('0x1e')][0x0],_0xdda2('0x1f'));_0x42d990[_0xdda2('0x1f')]=_0x55d674['Interactions'][0x0][_0xdda2('0x1f')];}var _0x22c6e5={'method':_0xdda2('0x27'),'uri':encodeURI(_0x55d674[_0xdda2('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x22c6e5['method']){case'GET':_0x22c6e5['qs']=_0x42d990;break;case _0xdda2('0x27'):_0x22c6e5[_0xdda2('0xc')]=_0x42d990;break;}return rp(_0x22c6e5)[_0xdda2('0x15')](function(_0x5e9e74){logger[_0xdda2('0x21')](_0xdda2('0x22'),_0xdda2('0x23'),util[_0xdda2('0x29')](_0xdda2('0x2a'),_0x42d990['id'],_0x55d674[_0xdda2('0x28')]));if(_0x5e9e74['body'][_0xdda2('0x2b')]&&_0x5e9e74[_0xdda2('0xc')]['threadId']!=_0x42d990[_0xdda2('0x25')][_0xdda2('0x2b')]){return _0x1c11b2[_0xdda2('0x12')][_0xdda2('0x16')]({'threadId':_0x5e9e74['body'][_0xdda2('0x2b')]},{'logging':!![],'where':{'id':_0x42d990[_0xdda2('0x25')]['id']}});}else{return;}})['then'](function(){return _0x1a774e[_0xdda2('0x16')]({'read':!![]});})['catch'](function(_0x2b8cd6){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xdda2('0x2c')](_0x2b8cd6,{'showHidden':![],'depth':null}));_0x4df6b8();});}else{_0x4df6b8();}})['finally'](function(){_0x4df6b8();});}else{_0x4df6b8();}}},'charset':_0xdda2('0x2d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 9923406..5ab6801 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x576d9c,_0x4b8f93){var _0x30154d=function(_0x4c187f){while(--_0x4c187f){_0x576d9c['push'](_0x576d9c['shift']());}};_0x30154d(++_0x4b8f93);}(_0x5f2f,0x73));var _0xf5f2=function(_0x322f60,_0xd6710b){_0x322f60=_0x322f60-0x0;var _0x3066ae=_0x5f2f[_0x322f60];return _0x3066ae;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0xf44df0,_0x4e396e){var _0x15c3f9=function(_0x3057cd){while(--_0x3057cd){_0xf44df0['push'](_0xf44df0['shift']());}};_0x15c3f9(++_0x4e396e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 726b6c5..e829cd3 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 _0x8289=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x310e44,_0x4a336d){var _0x1c82de=function(_0x200995){while(--_0x200995){_0x310e44['push'](_0x310e44['shift']());}};_0x1c82de(++_0x4a336d);}(_0x8289,0xf8));var _0x9828=function(_0x22aae8,_0x5922f4){_0x22aae8=_0x22aae8-0x0;var _0x13111d=_0x8289[_0x22aae8];return _0x13111d;};'use strict';var OpenchannelMessageEvents=require(_0x9828('0x0'));var events=[_0x9828('0x1'),_0x9828('0x2'),_0x9828('0x3')];function createListener(_0x28d6ee,_0x2e4fa1){return function(_0x10c220){_0x2e4fa1[_0x9828('0x4')](_0x28d6ee,_0x10c220);};}function removeListener(_0x5b5139,_0x3e5a97){return function(){OpenchannelMessageEvents[_0x9828('0x5')](_0x5b5139,_0x3e5a97);};}exports[_0x9828('0x6')]=function(_0x200696){for(var _0x182e6f=0x0,_0x1d4ea5=events[_0x9828('0x7')];_0x182e6f<_0x1d4ea5;_0x182e6f++){var _0x2eae3a=events[_0x182e6f];var _0x399a88=createListener(_0x9828('0x8')+_0x2eae3a,_0x200696);OpenchannelMessageEvents['on'](_0x2eae3a,_0x399a88);}}; \ No newline at end of file +var _0x8a03=['./openchannelMessage.events','save','emit','register','length','openchannelMessage:'];(function(_0x464aae,_0x3098d3){var _0x29fc2d=function(_0x1374d3){while(--_0x1374d3){_0x464aae['push'](_0x464aae['shift']());}};_0x29fc2d(++_0x3098d3);}(_0x8a03,0xf0));var _0x38a0=function(_0x54ddf6,_0x44562a){_0x54ddf6=_0x54ddf6-0x0;var _0x2e5b36=_0x8a03[_0x54ddf6];return _0x2e5b36;};'use strict';var OpenchannelMessageEvents=require(_0x38a0('0x0'));var events=[_0x38a0('0x1'),'remove','update'];function createListener(_0x202ae7,_0x44a27e){return function(_0x484ec6){_0x44a27e[_0x38a0('0x2')](_0x202ae7,_0x484ec6);};}function removeListener(_0x39c49f,_0x484cff){return function(){OpenchannelMessageEvents['removeListener'](_0x39c49f,_0x484cff);};}exports[_0x38a0('0x3')]=function(_0x4a99ea){for(var _0x569cc3=0x0,_0x2ea913=events[_0x38a0('0x4')];_0x569cc3<_0x2ea913;_0x569cc3++){var _0x20e38f=events[_0x569cc3];var _0x3623e8=createListener(_0x38a0('0x5')+_0x20e38f,_0x4a99ea);OpenchannelMessageEvents['on'](_0x20e38f,_0x3623e8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index d6f241c..c0f0428 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 _0xc50b=['express','../../components/auth/service','./openchannelQueue.controller','isAuthenticated','index','/describe','describe','get','show','/:id/members','getMembers','getTeams','post','create','/:id/teams','addTeams','/:id/users','/:id','update','delete','destroy','removeAgents','exports','util','path','connect-timeout'];(function(_0x8fc78,_0x39fc6b){var _0x1a1a60=function(_0xbe55dd){while(--_0xbe55dd){_0x8fc78['push'](_0x8fc78['shift']());}};_0x1a1a60(++_0x39fc6b);}(_0xc50b,0x65));var _0xbc50=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0xc50b[_0x3be7ff];return _0x186721;};'use strict';var multer=require('multer');var util=require(_0xbc50('0x0'));var path=require(_0xbc50('0x1'));var timeout=require(_0xbc50('0x2'));var express=require(_0xbc50('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbc50('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbc50('0x5'));router['get']('/',auth[_0xbc50('0x6')](),controller[_0xbc50('0x7')]);router['get'](_0xbc50('0x8'),auth[_0xbc50('0x6')](),controller[_0xbc50('0x9')]);router[_0xbc50('0xa')]('/:id',auth[_0xbc50('0x6')](),controller[_0xbc50('0xb')]);router[_0xbc50('0xa')](_0xbc50('0xc'),auth['isAuthenticated'](),controller[_0xbc50('0xd')]);router[_0xbc50('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbc50('0xe')]);router[_0xbc50('0xa')]('/:id/users',auth[_0xbc50('0x6')](),controller['getAgents']);router[_0xbc50('0xf')]('/',auth[_0xbc50('0x6')](),controller[_0xbc50('0x10')]);router[_0xbc50('0xf')](_0xbc50('0x11'),auth[_0xbc50('0x6')](),controller[_0xbc50('0x12')]);router[_0xbc50('0xf')](_0xbc50('0x13'),auth[_0xbc50('0x6')](),controller['addAgents']);router['put'](_0xbc50('0x14'),auth[_0xbc50('0x6')](),controller[_0xbc50('0x15')]);router[_0xbc50('0x16')](_0xbc50('0x14'),auth[_0xbc50('0x6')](),controller[_0xbc50('0x17')]);router[_0xbc50('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xbc50('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xbc50('0x18')]);module[_0xbc50('0x19')]=router; \ No newline at end of file +var _0xc1b3=['/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index'];(function(_0x397183,_0x2f7a88){var _0x2f8f8d=function(_0x572526){while(--_0x572526){_0x397183['push'](_0x397183['shift']());}};_0x2f8f8d(++_0x2f7a88);}(_0xc1b3,0x86));var _0x3c1b=function(_0x1964d4,_0x1cde23){_0x1964d4=_0x1964d4-0x0;var _0xb11b98=_0xc1b3[_0x1964d4];return _0xb11b98;};'use strict';var multer=require('multer');var util=require(_0x3c1b('0x0'));var path=require('path');var timeout=require(_0x3c1b('0x1'));var express=require('express');var router=express[_0x3c1b('0x2')]();var fs_extra=require(_0x3c1b('0x3'));var auth=require(_0x3c1b('0x4'));var interaction=require(_0x3c1b('0x5'));var config=require('../../config/environment');var controller=require(_0x3c1b('0x6'));router[_0x3c1b('0x7')]('/',auth[_0x3c1b('0x8')](),controller[_0x3c1b('0x9')]);router[_0x3c1b('0x7')](_0x3c1b('0xa'),auth['isAuthenticated'](),controller[_0x3c1b('0xb')]);router['get']('/:id',auth[_0x3c1b('0x8')](),controller[_0x3c1b('0xc')]);router['get']('/:id/members',auth[_0x3c1b('0x8')](),controller[_0x3c1b('0xd')]);router['get'](_0x3c1b('0xe'),auth[_0x3c1b('0x8')](),controller[_0x3c1b('0xf')]);router[_0x3c1b('0x7')](_0x3c1b('0x10'),auth[_0x3c1b('0x8')](),controller['getAgents']);router[_0x3c1b('0x11')]('/',auth[_0x3c1b('0x8')](),controller['create']);router[_0x3c1b('0x11')]('/:id/teams',auth[_0x3c1b('0x8')](),controller[_0x3c1b('0x12')]);router['post'](_0x3c1b('0x10'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x3c1b('0x8')](),controller[_0x3c1b('0x13')]);router[_0x3c1b('0x14')]('/:id',auth[_0x3c1b('0x8')](),controller[_0x3c1b('0x15')]);router[_0x3c1b('0x14')](_0x3c1b('0xe'),auth[_0x3c1b('0x8')](),controller[_0x3c1b('0x16')]);router[_0x3c1b('0x14')](_0x3c1b('0x10'),auth[_0x3c1b('0x8')](),controller['removeAgents']);module[_0x3c1b('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 7de7420..ddece00 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 _0x7a02=['beepall','roundrobin','sequelize','name','STRING','INTEGER','rrmemory'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7a02,0xdb));var _0x27a0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7a02[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x27a0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x27a0('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x27a0('0x2')]},'timeout':{'type':Sequelize[_0x27a0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x27a0('0x4'),_0x27a0('0x5'),_0x27a0('0x6'))}}; \ No newline at end of file +var _0x392f=['sequelize','STRING','INTEGER','roundrobin'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x392f,0x7c));var _0xf392=function(_0x19fccb,_0x3e95a9){_0x19fccb=_0x19fccb-0x0;var _0x3d9cd5=_0x392f[_0x19fccb];return _0x3d9cd5;};'use strict';var Sequelize=require(_0xf392('0x0'));module['exports']={'name':{'type':Sequelize[_0xf392('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf392('0x1')]},'timeout':{'type':Sequelize[_0xf392('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xf392('0x3'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 027c15b..620f024 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 _0xa8ec=['clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','forEach','addAgents','omit','spread','removeAgents','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','defaults','socket.io-emitter','redis','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','openchannelPause','updatedAt','format','createdAt','getTeams','Team','options','addTeams','Agents','online','voicePause','interface','transaction','each','emit','ids','select','field','from','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?'];(function(_0x373202,_0x1a1fd4){var _0x5e90ab=function(_0x20da9b){while(--_0x20da9b){_0x373202['push'](_0x373202['shift']());}};_0x5e90ab(++_0x1a1fd4);}(_0xa8ec,0x12d));var _0xca8e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa8ec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xca8e('0x0'));var rimraf=require(_0xca8e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca8e('0x2'));var rp=require(_0xca8e('0x3'));var moment=require(_0xca8e('0x4'));var BPromise=require(_0xca8e('0x5'));var Mustache=require(_0xca8e('0x6'));var util=require('util');var path=require(_0xca8e('0x7'));var sox=require(_0xca8e('0x8'));var csv=require(_0xca8e('0x9'));var ejs=require(_0xca8e('0xa'));var fs=require('fs');var fs_extra=require(_0xca8e('0xb'));var _=require(_0xca8e('0xc'));var squel=require(_0xca8e('0xd'));var crypto=require(_0xca8e('0xe'));var jsforce=require(_0xca8e('0xf'));var deskjs=require(_0xca8e('0x10'));var toCsv=require(_0xca8e('0x9'));var querystring=require(_0xca8e('0x11'));var Papa=require(_0xca8e('0x12'));var Redis=require(_0xca8e('0x13'));var authService=require(_0xca8e('0x14'));var qs=require(_0xca8e('0x15'));var as=require(_0xca8e('0x16'));var hardwareService=require(_0xca8e('0x17'));var logger=require(_0xca8e('0x18'))('api');var utils=require(_0xca8e('0x19'));var config=require(_0xca8e('0x1a'));var licenseUtil=require(_0xca8e('0x1b'));var db=require(_0xca8e('0x1c'))['db'];config['redis']=_[_0xca8e('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xca8e('0x1e'))(new Redis(config[_0xca8e('0x1f')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x1ee738,_0x10a886){_0x10a886=_0x10a886||0xcc;return function(_0xfd1313){if(_0xfd1313){return _0x1ee738['sendStatus'](_0x10a886);}return _0x1ee738[_0xca8e('0x20')](_0x10a886)[_0xca8e('0x21')]();};}function respondWithResult(_0x23bb0f,_0x5d6342){_0x5d6342=_0x5d6342||0xc8;return function(_0x5d62e4){if(_0x5d62e4){return _0x23bb0f['status'](_0x5d6342)[_0xca8e('0x22')](_0x5d62e4);}};}function respondWithFilteredResult(_0x305a58,_0x4525e6){return function(_0xd8f7b7){if(_0xd8f7b7){var _0x3f6c12=typeof _0x4525e6[_0xca8e('0x23')]===_0xca8e('0x24')&&typeof _0x4525e6[_0xca8e('0x25')]===_0xca8e('0x24');var _0x133ce7=_0xd8f7b7[_0xca8e('0x26')];var _0xa3bcfd=_0x3f6c12?0x0:_0x4525e6['offset'];var _0x4fe646=_0x3f6c12?_0xd8f7b7[_0xca8e('0x26')]:_0x4525e6['offset']+_0x4525e6[_0xca8e('0x25')];var _0x16ddf8;if(_0x4fe646>=_0x133ce7){_0x4fe646=_0x133ce7;_0x16ddf8=0xc8;}else{_0x16ddf8=0xce;}_0x305a58[_0xca8e('0x20')](_0x16ddf8);return _0x305a58[_0xca8e('0x27')](_0xca8e('0x28'),_0xa3bcfd+'-'+_0x4fe646+'/'+_0x133ce7)[_0xca8e('0x22')](_0xd8f7b7);}return null;};}function patchUpdates(_0x1c8be7){return function(_0x10cb56){try{jsonpatch[_0xca8e('0x29')](_0x10cb56,_0x1c8be7,!![]);}catch(_0x2a8569){return BPromise[_0xca8e('0x2a')](_0x2a8569);}return _0x10cb56[_0xca8e('0x2b')]();};}function saveUpdates(_0x465bf8,_0x73209a){return function(_0x33a380){if(_0x33a380){return _0x33a380[_0xca8e('0x2c')](_0x465bf8)[_0xca8e('0x2d')](function(_0x5aabed){return _0x5aabed;});}return null;};}function removeEntity(_0x53dcdc,_0x2af502){return function(_0x56c64d){if(_0x56c64d){return _0x56c64d[_0xca8e('0x2e')]()['then'](function(){var _0x2256ae=_0x56c64d['get']({'plain':!![]});var _0xfbee90='OpenchannelQueues';return db['UserProfileResource'][_0xca8e('0x2e')]({'where':{'type':_0xfbee90,'resourceId':_0x2256ae['id']}})[_0xca8e('0x2d')](function(){return _0x56c64d;});})[_0xca8e('0x2d')](function(){_0x53dcdc[_0xca8e('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x466b10,_0x5d8e80){return function(_0x3b5dc6){if(!_0x3b5dc6){_0x466b10[_0xca8e('0x2f')](0x194);}return _0x3b5dc6;};}function handleError(_0x1be1c9,_0x5c860b){_0x5c860b=_0x5c860b||0x1f4;return function(_0x15f1c7){logger[_0xca8e('0x30')](_0x15f1c7[_0xca8e('0x31')]);if(_0x15f1c7[_0xca8e('0x32')]){delete _0x15f1c7[_0xca8e('0x32')];}_0x1be1c9[_0xca8e('0x20')](_0x5c860b)[_0xca8e('0x33')](_0x15f1c7);};}exports[_0xca8e('0x34')]=function(_0x291456,_0x58de01){var _0x3a5dac={},_0x1918f4={},_0x348f50={'count':0x0,'rows':[]};var _0x45d8f3=_['map'](db[_0xca8e('0x35')][_0xca8e('0x36')],function(_0x4060b7){return{'name':_0x4060b7[_0xca8e('0x37')],'type':_0x4060b7['type'][_0xca8e('0x38')]};});_0x1918f4[_0xca8e('0x39')]=_['map'](_0x45d8f3,_0xca8e('0x32'));_0x1918f4['query']=_[_0xca8e('0x3a')](_0x291456['query']);_0x1918f4[_0xca8e('0x3b')]=_[_0xca8e('0x3c')](_0x1918f4['model'],_0x1918f4[_0xca8e('0x3d')]);_0x3a5dac['attributes']=_[_0xca8e('0x3c')](_0x1918f4[_0xca8e('0x39')],qs[_0xca8e('0x3e')](_0x291456[_0xca8e('0x3d')]['fields']));_0x3a5dac[_0xca8e('0x3f')]=_0x3a5dac[_0xca8e('0x3f')][_0xca8e('0x40')]?_0x3a5dac['attributes']:_0x1918f4[_0xca8e('0x39')];if(!_0x291456[_0xca8e('0x3d')][_0xca8e('0x41')]('nolimit')){_0x3a5dac[_0xca8e('0x25')]=qs[_0xca8e('0x25')](_0x291456[_0xca8e('0x3d')]['limit']);_0x3a5dac['offset']=qs[_0xca8e('0x23')](_0x291456['query'][_0xca8e('0x23')]);}_0x3a5dac[_0xca8e('0x42')]=qs[_0xca8e('0x43')](_0x291456['query'][_0xca8e('0x43')]);_0x3a5dac[_0xca8e('0x44')]=qs[_0xca8e('0x3b')](_[_0xca8e('0x45')](_0x291456[_0xca8e('0x3d')],_0x1918f4[_0xca8e('0x3b')]),_0x45d8f3);if(_0x291456['query'][_0xca8e('0x46')]){_0x3a5dac[_0xca8e('0x44')]=_[_0xca8e('0x47')](_0x3a5dac[_0xca8e('0x44')],{'$or':_[_0xca8e('0x48')](_0x45d8f3,function(_0x2a6301){if(_0x2a6301['type']!==_0xca8e('0x49')){var _0x2c66dd={};_0x2c66dd[_0x2a6301[_0xca8e('0x32')]]={'$like':'%'+_0x291456[_0xca8e('0x3d')][_0xca8e('0x46')]+'%'};return _0x2c66dd;}})});}_0x3a5dac=_['merge']({},_0x3a5dac,_0x291456['options']);var _0x270001={'where':_0x3a5dac['where']};return db[_0xca8e('0x35')]['count'](_0x270001)[_0xca8e('0x2d')](function(_0x1cf697){_0x348f50[_0xca8e('0x26')]=_0x1cf697;if(_0x291456[_0xca8e('0x3d')]['includeAll']){_0x3a5dac[_0xca8e('0x4a')]=[{'all':!![]}];}return db[_0xca8e('0x35')][_0xca8e('0x4b')](_0x3a5dac);})[_0xca8e('0x2d')](function(_0x13697d){_0x348f50[_0xca8e('0x4c')]=_0x13697d;return _0x348f50;})[_0xca8e('0x2d')](respondWithFilteredResult(_0x58de01,_0x3a5dac))['catch'](handleError(_0x58de01,null));};exports[_0xca8e('0x4d')]=function(_0x2eb4e6,_0x2323c0){var _0x397b18={'raw':!![],'where':{'id':_0x2eb4e6[_0xca8e('0x4e')]['id']}},_0x4d2282={};_0x4d2282['model']=_[_0xca8e('0x3a')](db[_0xca8e('0x35')][_0xca8e('0x36')]);_0x4d2282[_0xca8e('0x3d')]=_['keys'](_0x2eb4e6[_0xca8e('0x3d')]);_0x4d2282[_0xca8e('0x3b')]=_[_0xca8e('0x3c')](_0x4d2282['model'],_0x4d2282[_0xca8e('0x3d')]);_0x397b18[_0xca8e('0x3f')]=_[_0xca8e('0x3c')](_0x4d2282['model'],qs['fields'](_0x2eb4e6[_0xca8e('0x3d')][_0xca8e('0x3e')]));_0x397b18[_0xca8e('0x3f')]=_0x397b18[_0xca8e('0x3f')][_0xca8e('0x40')]?_0x397b18[_0xca8e('0x3f')]:_0x4d2282[_0xca8e('0x39')];if(_0x2eb4e6[_0xca8e('0x3d')]['includeAll']){_0x397b18[_0xca8e('0x4a')]=[{'all':!![]}];}_0x397b18=_['merge']({},_0x397b18,_0x2eb4e6['options']);return db[_0xca8e('0x35')]['find'](_0x397b18)['then'](handleEntityNotFound(_0x2323c0,null))[_0xca8e('0x2d')](respondWithResult(_0x2323c0,null))[_0xca8e('0x4f')](handleError(_0x2323c0,null));};exports[_0xca8e('0x50')]=function(_0x521522,_0x4d62a){return db[_0xca8e('0x35')][_0xca8e('0x50')](_0x521522[_0xca8e('0x51')],{})['then'](function(_0x3992ed){var _0x21ad23=_0x521522[_0xca8e('0x52')][_0xca8e('0x53')]({'plain':!![]});if(!_0x21ad23)throw new Error(_0xca8e('0x54'));if(_0x21ad23['role']===_0xca8e('0x52')){var _0x2123bc=_0x3992ed[_0xca8e('0x53')]({'plain':!![]});var _0x3d8902=_0xca8e('0x55');return db['UserProfileSection'][_0xca8e('0x56')]({'where':{'name':_0x3d8902,'userProfileId':_0x21ad23[_0xca8e('0x57')]},'raw':!![]})['then'](function(_0x3c119c){if(_0x3c119c&&_0x3c119c[_0xca8e('0x58')]===0x0){return db['UserProfileResource'][_0xca8e('0x50')]({'name':_0x2123bc['name'],'resourceId':_0x2123bc['id'],'type':_0x3c119c[_0xca8e('0x32')],'sectionId':_0x3c119c['id']},{})[_0xca8e('0x2d')](function(){return _0x3992ed;});}else{return _0x3992ed;}})[_0xca8e('0x4f')](function(_0x1658ba){logger[_0xca8e('0x30')](_0xca8e('0x59'),_0x1658ba);throw _0x1658ba;});}return _0x3992ed;})['then'](respondWithResult(_0x4d62a,0xc9))[_0xca8e('0x4f')](handleError(_0x4d62a,null));};exports[_0xca8e('0x2c')]=function(_0x50acb5,_0x2a76c9){if(_0x50acb5['body']['id']){delete _0x50acb5[_0xca8e('0x51')]['id'];}return db[_0xca8e('0x35')]['find']({'where':{'id':_0x50acb5[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0x2a76c9,null))[_0xca8e('0x2d')](saveUpdates(_0x50acb5['body'],null))[_0xca8e('0x2d')](respondWithResult(_0x2a76c9,null))['catch'](handleError(_0x2a76c9,null));};exports['destroy']=function(_0x1f5b27,_0xa08910){return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0x1f5b27['params']['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0xa08910,null))[_0xca8e('0x2d')](removeEntity(_0xa08910,null))[_0xca8e('0x4f')](handleError(_0xa08910,null));};exports[_0xca8e('0x5a')]=function(_0x22f655,_0x12027c){return db['OpenchannelQueue'][_0xca8e('0x5a')]()[_0xca8e('0x2d')](respondWithResult(_0x12027c,null))[_0xca8e('0x4f')](handleError(_0x12027c,null));};exports[_0xca8e('0x5b')]=function(_0x21a8d3,_0x3b3f47,_0x530c6b){var _0x33f7a1={'raw':!![],'where':{}},_0x927be1={},_0x366610;return db[_0xca8e('0x35')][_0xca8e('0x5c')]({'where':{'id':_0x21a8d3[_0xca8e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b3f47,null))[_0xca8e('0x2d')](function(_0x57b017){if(_0x57b017){_0x366610=_0x57b017[_0xca8e('0x53')]({'plain':!![]});_0x927be1[_0xca8e('0x39')]=_[_0xca8e('0x3a')](db['UserOpenchannelQueue'][_0xca8e('0x36')]);_0x927be1['query']=_[_0xca8e('0x3a')](_0x21a8d3[_0xca8e('0x3d')]);_0x927be1[_0xca8e('0x3b')]=_[_0xca8e('0x3c')](_0x927be1[_0xca8e('0x39')],_0x927be1[_0xca8e('0x3d')]);_0x33f7a1[_0xca8e('0x3f')]=_['intersection'](_0x927be1[_0xca8e('0x39')],qs[_0xca8e('0x3e')](_0x21a8d3[_0xca8e('0x3d')][_0xca8e('0x3e')]));_0x33f7a1[_0xca8e('0x3f')]=_0x33f7a1[_0xca8e('0x3f')][_0xca8e('0x40')]?_0x33f7a1['attributes']:_0x927be1[_0xca8e('0x39')];if(!_0x21a8d3[_0xca8e('0x3d')]['hasOwnProperty'](_0xca8e('0x5d'))){_0x33f7a1[_0xca8e('0x25')]=qs[_0xca8e('0x25')](_0x21a8d3[_0xca8e('0x3d')][_0xca8e('0x25')]);_0x33f7a1[_0xca8e('0x23')]=qs[_0xca8e('0x23')](_0x21a8d3[_0xca8e('0x3d')]['offset']);}_0x33f7a1[_0xca8e('0x42')]=qs[_0xca8e('0x43')](_0x21a8d3[_0xca8e('0x3d')]['sort']);_0x33f7a1[_0xca8e('0x44')]=qs['filters'](_['pick'](_0x21a8d3[_0xca8e('0x3d')],_0x927be1[_0xca8e('0x3b')]));_0x33f7a1['where'][_0xca8e('0x5e')]=_0x57b017['id'];if(_0x21a8d3[_0xca8e('0x3d')][_0xca8e('0x46')]){_0x33f7a1[_0xca8e('0x44')]=_[_0xca8e('0x47')](_0x33f7a1['where'],{'$or':_[_0xca8e('0x48')](_0x33f7a1[_0xca8e('0x3f')],function(_0x4bea92){var _0x5559f2={};_0x5559f2[_0x4bea92]={'$like':'%'+_0x21a8d3[_0xca8e('0x3d')]['filter']+'%'};return _0x5559f2;})});}_0x33f7a1=_['merge']({},_0x33f7a1,_0x21a8d3['options']);return db[_0xca8e('0x5f')][_0xca8e('0x4b')](_0x33f7a1);}})[_0xca8e('0x2d')](function(_0x1ff5e6){if(_0x1ff5e6){return db[_0xca8e('0x60')][_0xca8e('0x61')]({'where':{'id':_['map'](_0x1ff5e6,'UserId'),'role':'agent'},'attributes':['id',_0xca8e('0x32'),_0xca8e('0x62'),_0xca8e('0x63'),'createdAt']});}})['then'](function(_0x48ca89){if(_0x48ca89){return{'count':_0x48ca89[_0xca8e('0x26')],'rows':_[_0xca8e('0x48')](_0x48ca89[_0xca8e('0x4c')],function(_0x39d7d1){return{'membername':_0x39d7d1[_0xca8e('0x32')],'UserId':_0x39d7d1['id'],'queue_name':_0x366610[_0xca8e('0x32')],'OpenchannelQueueId':_0x366610['id'],'interface':util[_0xca8e('0x64')]('%s/%s','SIP',_0x39d7d1[_0xca8e('0x32')]),'penalty':0x0,'paused':_0x39d7d1[_0xca8e('0x62')],'createdAt':_0x39d7d1[_0xca8e('0x65')],'updatedAt':_0x39d7d1[_0xca8e('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xca8e('0x2d')](respondWithFilteredResult(_0x3b3f47,_0x33f7a1))[_0xca8e('0x4f')](handleError(_0x3b3f47,null));};exports[_0xca8e('0x66')]=function(_0x463356,_0xe028b4,_0x6dab85){var _0x17b97d={};var _0x451bf9={};var _0x57f594;var _0x11c864;return db['OpenchannelQueue'][_0xca8e('0x5c')]({'where':{'id':_0x463356[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0xe028b4,null))['then'](function(_0x37a8a3){if(_0x37a8a3){_0x57f594=_0x37a8a3;_0x451bf9['model']=_['keys'](db[_0xca8e('0x67')][_0xca8e('0x36')]);_0x451bf9[_0xca8e('0x3d')]=_[_0xca8e('0x3a')](_0x463356['query']);_0x451bf9['filters']=_[_0xca8e('0x3c')](_0x451bf9[_0xca8e('0x39')],_0x451bf9[_0xca8e('0x3d')]);_0x17b97d['attributes']=_['intersection'](_0x451bf9[_0xca8e('0x39')],qs[_0xca8e('0x3e')](_0x463356[_0xca8e('0x3d')][_0xca8e('0x3e')]));_0x17b97d['attributes']=_0x17b97d[_0xca8e('0x3f')][_0xca8e('0x40')]?_0x17b97d[_0xca8e('0x3f')]:_0x451bf9[_0xca8e('0x39')];_0x17b97d[_0xca8e('0x42')]=qs['sort'](_0x463356[_0xca8e('0x3d')][_0xca8e('0x43')]);_0x17b97d['where']=qs[_0xca8e('0x3b')](_[_0xca8e('0x45')](_0x463356[_0xca8e('0x3d')],_0x451bf9[_0xca8e('0x3b')]));if(_0x463356['query']['filter']){_0x17b97d[_0xca8e('0x44')]=_[_0xca8e('0x47')](_0x17b97d[_0xca8e('0x44')],{'$or':_[_0xca8e('0x48')](_0x17b97d[_0xca8e('0x3f')],function(_0x5c43d4){var _0x953f00={};_0x953f00[_0x5c43d4]={'$like':'%'+_0x463356[_0xca8e('0x3d')][_0xca8e('0x46')]+'%'};return _0x953f00;})});}_0x17b97d=_[_0xca8e('0x47')]({},_0x17b97d,_0x463356[_0xca8e('0x68')]);return _0x57f594[_0xca8e('0x66')](_0x17b97d);}})[_0xca8e('0x2d')](function(_0x7604c2){if(_0x7604c2){_0x11c864=_0x7604c2[_0xca8e('0x40')];if(!_0x463356[_0xca8e('0x3d')][_0xca8e('0x41')]('nolimit')){_0x17b97d[_0xca8e('0x25')]=qs[_0xca8e('0x25')](_0x463356[_0xca8e('0x3d')][_0xca8e('0x25')]);_0x17b97d['offset']=qs[_0xca8e('0x23')](_0x463356[_0xca8e('0x3d')]['offset']);}return _0x57f594['getTeams'](_0x17b97d);}})[_0xca8e('0x2d')](function(_0x12e3cf){if(_0x12e3cf){return _0x12e3cf?{'count':_0x11c864,'rows':_0x12e3cf}:null;}})['then'](respondWithResult(_0xe028b4,null))[_0xca8e('0x4f')](handleError(_0xe028b4,null));};exports[_0xca8e('0x69')]=function(_0x45bb23,_0x26d27e,_0x54d4bf){var _0x13cd4b=_0x45bb23[_0xca8e('0x51')]['ids'];return db[_0xca8e('0x67')]['findAll']({'where':{'id':_0x13cd4b},'attributes':['id'],'include':[{'model':db[_0xca8e('0x60')],'as':_0xca8e('0x6a'),'attributes':['id',_0xca8e('0x32'),_0xca8e('0x6b'),_0xca8e('0x6c'),_0xca8e('0x6d')],'raw':!![]}]})[_0xca8e('0x2d')](function(_0x53ce4e){if(_0x53ce4e){var _0x5d4942=_['flatMap'](_0x53ce4e,function(_0x57ec02){var _0x3b2c73=_0x57ec02[_0xca8e('0x53')]({'plain':!![]});return _0x3b2c73[_0xca8e('0x6a')];});return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0x45bb23['params']['id']}})[_0xca8e('0x2d')](function(_0x53630b){return db['sequelize'][_0xca8e('0x6e')](function(_0x494f33){return _0x53630b[_0xca8e('0x69')](_0x13cd4b,{'transaction':_0x494f33})[_0xca8e('0x2d')](function(){return BPromise[_0xca8e('0x6f')](_0x5d4942,function(_0x4df11c){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x4df11c['id'],'OpenchannelQueueId':_0x45bb23[_0xca8e('0x4e')]['id']},'transaction':_0x494f33});});})[_0xca8e('0x2d')](function(){_0x5d4942['forEach'](function(_0x19d755){socket[_0xca8e('0x70')]('userOpenchannelQueue:save',{'UserId':_0x19d755['id'],'OpenchannelQueueId':_0x53630b['id']});});});});});}})[_0xca8e('0x2d')](respondWithStatusCode(_0x26d27e,null))['catch'](handleError(_0x26d27e,null));};exports['removeTeams']=function(_0xcd055c,_0x10aecb,_0x22dcf9){return db[_0xca8e('0x67')][_0xca8e('0x4b')]({'where':{'id':_0xcd055c[_0xca8e('0x3d')][_0xca8e('0x71')]},'attributes':['id'],'include':[{'model':db[_0xca8e('0x60')],'as':_0xca8e('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10aecb,null))[_0xca8e('0x2d')](function(_0x3597b){var _0x484175=_[_0xca8e('0x48')](_0x3597b,'id');var _0x3078a8=[];var _0x3d66d1=[];var _0x2654d9=squel[_0xca8e('0x72')]();_0x2654d9[_0xca8e('0x73')]('tq.TeamId')[_0xca8e('0x74')]('team_has_openchannel_queues','tq')['join']('user_has_teams','ut',_0xca8e('0x75'))[_0xca8e('0x44')](_0xca8e('0x76'),_0xcd055c[_0xca8e('0x4e')]['id']);for(var _0x334081=0x0;_0x334081<_0x3597b[_0xca8e('0x40')];_0x334081+=0x1){let _0x3e1dc4=_0x3597b[_0x334081];for(var _0x5d87c5=0x0;_0x5d87c5<_0x3e1dc4[_0xca8e('0x6a')][_0xca8e('0x40')];_0x5d87c5+=0x1){let _0x43c17b=_0x3e1dc4[_0xca8e('0x6a')][_0x5d87c5];var _0x16d940=_0x2654d9[_0xca8e('0x77')]();_0x16d940['where'](_0xca8e('0x78'),_0x43c17b['id']);_0x3d66d1[_0xca8e('0x79')](db[_0xca8e('0x7a')][_0xca8e('0x3d')](_0x16d940[_0xca8e('0x7b')](),{'type':db[_0xca8e('0x7a')][_0xca8e('0x7c')][_0xca8e('0x7d')]})[_0xca8e('0x2d')](function(_0x1b94f9){if(_0x1b94f9[_0xca8e('0x40')]===0x1){return _0x43c17b['id'];}else{var _0x34068b=_[_0xca8e('0x7e')](_[_0xca8e('0x48')](_0x1b94f9,_0xca8e('0x7f')),function(_0x1a1e04){return _[_0xca8e('0x80')](_0x484175,_0x1a1e04);});if(_0x34068b){return _0x43c17b['id'];}}}));}}return BPromise[_0xca8e('0x81')](_0x3d66d1)['then'](function(_0x5da710){_0x3078a8=_(_0x3078a8)['union'](_0x5da710)[_0xca8e('0x82')]()[_0xca8e('0x83')]();return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0xcd055c[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](function(_0x255733){return db[_0xca8e('0x7a')][_0xca8e('0x6e')](function(_0x59870a){return _0x255733[_0xca8e('0x84')](_0xcd055c[_0xca8e('0x3d')][_0xca8e('0x71')],{'transaction':_0x59870a})['then'](function(){if(!_['isEmpty'](_0x3078a8)){return _0x255733['removeAgents'](_0x3078a8,{'transaction':_0x59870a});}})[_0xca8e('0x2d')](function(){_0x3078a8[_0xca8e('0x85')](function(_0x3e2509){socket[_0xca8e('0x70')]('userOpenchannelQueue:remove',{'UserId':_0x3e2509,'OpenchannelQueueId':_0x255733['id']});});});});});});})[_0xca8e('0x2d')](respondWithStatusCode(_0x10aecb,null))[_0xca8e('0x4f')](handleError(_0x10aecb,null));};exports[_0xca8e('0x86')]=function(_0x212748,_0xcc50e8,_0x10fe49){return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0x212748[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0xcc50e8,null))['then'](function(_0x5be4f6){if(_0x5be4f6){return _0x5be4f6[_0xca8e('0x86')](_0x212748[_0xca8e('0x51')][_0xca8e('0x71')],_[_0xca8e('0x87')](_0x212748['body'],[_0xca8e('0x71'),'id'])||{})[_0xca8e('0x88')](function(_0x22ed4f){for(var _0x3a0b29=0x0;_0x3a0b29<_0x212748['body'][_0xca8e('0x71')][_0xca8e('0x40')];_0x3a0b29+=0x1){socket[_0xca8e('0x70')]('userOpenchannelQueue:save',{'UserId':Number(_0x212748[_0xca8e('0x51')]['ids'][_0x3a0b29]),'OpenchannelQueueId':Number(_0x212748[_0xca8e('0x4e')]['id'])});}return _0x22ed4f;});}})[_0xca8e('0x2d')](respondWithResult(_0xcc50e8,null))[_0xca8e('0x4f')](handleError(_0xcc50e8,null));};exports[_0xca8e('0x89')]=function(_0x2f048a,_0x1baa16,_0x4aab79){return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0x2f048a[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0x1baa16,null))[_0xca8e('0x2d')](function(_0x2b409f){if(_0x2b409f){return _0x2b409f['removeAgents'](_0x2f048a[_0xca8e('0x3d')]['ids'])[_0xca8e('0x2d')](function(){if(_['isArray'](_0x2f048a['query'][_0xca8e('0x71')])){for(var _0x31bebf=0x0;_0x31bebf<_0x2f048a['query']['ids']['length'];_0x31bebf+=0x1){socket[_0xca8e('0x70')](_0xca8e('0x8a'),{'UserId':Number(_0x2f048a[_0xca8e('0x3d')]['ids'][_0x31bebf]),'OpenchannelQueueId':Number(_0x2f048a[_0xca8e('0x4e')]['id'])});}}else{socket[_0xca8e('0x70')](_0xca8e('0x8a'),{'UserId':Number(_0x2f048a[_0xca8e('0x3d')][_0xca8e('0x71')]),'OpenchannelQueueId':Number(_0x2f048a[_0xca8e('0x4e')]['id'])});}});}})[_0xca8e('0x2d')](respondWithStatusCode(_0x1baa16,null))[_0xca8e('0x4f')](handleError(_0x1baa16,null));};exports[_0xca8e('0x8b')]=function(_0x42bbbf,_0x59432e,_0x213317){var _0x83da6={};var _0x5c895d={};var _0x2ab66c;var _0x370512;return db[_0xca8e('0x35')][_0xca8e('0x5c')]({'where':{'id':_0x42bbbf[_0xca8e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59432e,null))[_0xca8e('0x2d')](function(_0x466df5){if(_0x466df5){_0x2ab66c=_0x466df5;_0x5c895d[_0xca8e('0x39')]=_[_0xca8e('0x3a')](db[_0xca8e('0x60')][_0xca8e('0x36')]);_0x5c895d[_0xca8e('0x3d')]=_[_0xca8e('0x3a')](_0x42bbbf[_0xca8e('0x3d')]);_0x5c895d[_0xca8e('0x3b')]=_[_0xca8e('0x3c')](_0x5c895d[_0xca8e('0x39')],_0x5c895d['query']);_0x83da6[_0xca8e('0x3f')]=_[_0xca8e('0x3c')](_0x5c895d['model'],qs['fields'](_0x42bbbf[_0xca8e('0x3d')]['fields']));_0x83da6[_0xca8e('0x3f')]=_0x83da6[_0xca8e('0x3f')]['length']?_0x83da6[_0xca8e('0x3f')]:_0x5c895d[_0xca8e('0x39')];_0x83da6['order']=qs[_0xca8e('0x43')](_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x43')]);_0x83da6['where']=qs[_0xca8e('0x3b')](_[_0xca8e('0x45')](_0x42bbbf['query'],_0x5c895d['filters']));if(_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x46')]){_0x83da6['where']=_['merge'](_0x83da6[_0xca8e('0x44')],{'$or':_[_0xca8e('0x48')](_0x83da6[_0xca8e('0x3f')],function(_0xaa9726){var _0x2915cf={};_0x2915cf[_0xaa9726]={'$like':'%'+_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x46')]+'%'};return _0x2915cf;})});}_0x83da6=_[_0xca8e('0x47')]({},_0x83da6,_0x42bbbf[_0xca8e('0x68')]);return _0x2ab66c[_0xca8e('0x8b')](_0x83da6);}})[_0xca8e('0x2d')](function(_0x252426){if(_0x252426){_0x370512=_0x252426[_0xca8e('0x40')];if(!_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x41')](_0xca8e('0x5d'))){_0x83da6[_0xca8e('0x25')]=qs[_0xca8e('0x25')](_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x25')]);_0x83da6[_0xca8e('0x23')]=qs[_0xca8e('0x23')](_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x23')]);}return _0x2ab66c[_0xca8e('0x8b')](_0x83da6);}})[_0xca8e('0x2d')](function(_0x208a22){if(_0x208a22){return _0x208a22?{'count':_0x370512,'rows':_0x208a22}:null;}})[_0xca8e('0x2d')](respondWithResult(_0x59432e,null))[_0xca8e('0x4f')](handleError(_0x59432e,null));}; \ No newline at end of file +var _0x1a61=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','OpenchannelQueues','sendStatus','error','name','send','index','map','OpenchannelQueue','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','findOne','hasOwnProperty','pick','OpenchannelQueueId','UserOpenchannelQueue','User','UserId','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','order','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','addAgents','spread','removeAgents','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','querystring'];(function(_0x428fc2,_0x43753){var _0x9d2a9a=function(_0xaaab59){while(--_0xaaab59){_0x428fc2['push'](_0x428fc2['shift']());}};_0x9d2a9a(++_0x43753);}(_0x1a61,0x194));var _0x11a6=function(_0x442cf0,_0x38679a){_0x442cf0=_0x442cf0-0x0;var _0x1ac7bd=_0x1a61[_0x442cf0];return _0x1ac7bd;};'use strict';var emlformat=require(_0x11a6('0x0'));var rimraf=require(_0x11a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x11a6('0x2'));var BPromise=require(_0x11a6('0x3'));var Mustache=require(_0x11a6('0x4'));var util=require(_0x11a6('0x5'));var path=require(_0x11a6('0x6'));var sox=require(_0x11a6('0x7'));var csv=require('to-csv');var ejs=require(_0x11a6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x11a6('0x9'));var deskjs=require(_0x11a6('0xa'));var toCsv=require(_0x11a6('0xb'));var querystring=require(_0x11a6('0xc'));var Papa=require(_0x11a6('0xd'));var Redis=require(_0x11a6('0xe'));var authService=require(_0x11a6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11a6('0x10'));var hardwareService=require(_0x11a6('0x11'));var logger=require(_0x11a6('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x11a6('0x13'))['db'];config[_0x11a6('0x14')]=_[_0x11a6('0x15')](config['redis'],{'host':_0x11a6('0x16'),'port':0x18eb});var socket=require(_0x11a6('0x17'))(new Redis(config[_0x11a6('0x14')]));require(_0x11a6('0x18'))[_0x11a6('0x19')](socket);function respondWithStatusCode(_0x3e781b,_0x1c1420){_0x1c1420=_0x1c1420||0xcc;return function(_0x4b394a){if(_0x4b394a){return _0x3e781b['sendStatus'](_0x1c1420);}return _0x3e781b[_0x11a6('0x1a')](_0x1c1420)[_0x11a6('0x1b')]();};}function respondWithResult(_0x278173,_0x26901b){_0x26901b=_0x26901b||0xc8;return function(_0x392bc1){if(_0x392bc1){return _0x278173[_0x11a6('0x1a')](_0x26901b)[_0x11a6('0x1c')](_0x392bc1);}};}function respondWithFilteredResult(_0x47b340,_0x469fcb){return function(_0x5dac16){if(_0x5dac16){var _0x519b25=typeof _0x469fcb[_0x11a6('0x1d')]===_0x11a6('0x1e')&&typeof _0x469fcb[_0x11a6('0x1f')]===_0x11a6('0x1e');var _0x408b64=_0x5dac16[_0x11a6('0x20')];var _0x5d0d8d=_0x519b25?0x0:_0x469fcb[_0x11a6('0x1d')];var _0x45f0df=_0x519b25?_0x5dac16[_0x11a6('0x20')]:_0x469fcb[_0x11a6('0x1d')]+_0x469fcb['limit'];var _0x597815;if(_0x45f0df>=_0x408b64){_0x45f0df=_0x408b64;_0x597815=0xc8;}else{_0x597815=0xce;}_0x47b340['status'](_0x597815);return _0x47b340['set'](_0x11a6('0x21'),_0x5d0d8d+'-'+_0x45f0df+'/'+_0x408b64)[_0x11a6('0x1c')](_0x5dac16);}return null;};}function patchUpdates(_0x37fab5){return function(_0x1fb025){try{jsonpatch['apply'](_0x1fb025,_0x37fab5,!![]);}catch(_0x559250){return BPromise[_0x11a6('0x22')](_0x559250);}return _0x1fb025[_0x11a6('0x23')]();};}function saveUpdates(_0x50847d,_0x38fdcf){return function(_0x321d29){if(_0x321d29){return _0x321d29[_0x11a6('0x24')](_0x50847d)[_0x11a6('0x25')](function(_0x34f553){return _0x34f553;});}return null;};}function removeEntity(_0x18b0d0,_0x16f8d6){return function(_0x446c56){if(_0x446c56){return _0x446c56[_0x11a6('0x26')]()[_0x11a6('0x25')](function(){var _0x1e8328=_0x446c56['get']({'plain':!![]});var _0x1e16b9=_0x11a6('0x27');return db['UserProfileResource'][_0x11a6('0x26')]({'where':{'type':_0x1e16b9,'resourceId':_0x1e8328['id']}})[_0x11a6('0x25')](function(){return _0x446c56;});})[_0x11a6('0x25')](function(){_0x18b0d0[_0x11a6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x155722,_0x556ea9){return function(_0x395d7b){if(!_0x395d7b){_0x155722[_0x11a6('0x28')](0x194);}return _0x395d7b;};}function handleError(_0x59123d,_0x1f114d){_0x1f114d=_0x1f114d||0x1f4;return function(_0x27ec97){logger[_0x11a6('0x29')](_0x27ec97['stack']);if(_0x27ec97[_0x11a6('0x2a')]){delete _0x27ec97[_0x11a6('0x2a')];}_0x59123d['status'](_0x1f114d)[_0x11a6('0x2b')](_0x27ec97);};}exports[_0x11a6('0x2c')]=function(_0x2ae562,_0x313737){var _0x216819={},_0x5380c9={},_0x44223f={'count':0x0,'rows':[]};var _0x43b9de=_[_0x11a6('0x2d')](db[_0x11a6('0x2e')]['rawAttributes'],function(_0x50e9b1){return{'name':_0x50e9b1[_0x11a6('0x2f')],'type':_0x50e9b1[_0x11a6('0x30')][_0x11a6('0x31')]};});_0x5380c9['model']=_['map'](_0x43b9de,_0x11a6('0x2a'));_0x5380c9['query']=_[_0x11a6('0x32')](_0x2ae562[_0x11a6('0x33')]);_0x5380c9[_0x11a6('0x34')]=_[_0x11a6('0x35')](_0x5380c9[_0x11a6('0x36')],_0x5380c9[_0x11a6('0x33')]);_0x216819[_0x11a6('0x37')]=_['intersection'](_0x5380c9[_0x11a6('0x36')],qs[_0x11a6('0x38')](_0x2ae562[_0x11a6('0x33')]['fields']));_0x216819[_0x11a6('0x37')]=_0x216819[_0x11a6('0x37')]['length']?_0x216819[_0x11a6('0x37')]:_0x5380c9[_0x11a6('0x36')];if(!_0x2ae562['query']['hasOwnProperty'](_0x11a6('0x39'))){_0x216819[_0x11a6('0x1f')]=qs[_0x11a6('0x1f')](_0x2ae562['query'][_0x11a6('0x1f')]);_0x216819[_0x11a6('0x1d')]=qs[_0x11a6('0x1d')](_0x2ae562[_0x11a6('0x33')][_0x11a6('0x1d')]);}_0x216819['order']=qs[_0x11a6('0x3a')](_0x2ae562['query'][_0x11a6('0x3a')]);_0x216819[_0x11a6('0x3b')]=qs[_0x11a6('0x34')](_['pick'](_0x2ae562[_0x11a6('0x33')],_0x5380c9[_0x11a6('0x34')]),_0x43b9de);if(_0x2ae562[_0x11a6('0x33')][_0x11a6('0x3c')]){_0x216819[_0x11a6('0x3b')]=_[_0x11a6('0x3d')](_0x216819[_0x11a6('0x3b')],{'$or':_[_0x11a6('0x2d')](_0x43b9de,function(_0xf7279){if(_0xf7279['type']!==_0x11a6('0x3e')){var _0x55ea26={};_0x55ea26[_0xf7279['name']]={'$like':'%'+_0x2ae562[_0x11a6('0x33')][_0x11a6('0x3c')]+'%'};return _0x55ea26;}})});}_0x216819=_[_0x11a6('0x3d')]({},_0x216819,_0x2ae562[_0x11a6('0x3f')]);var _0x9323fd={'where':_0x216819[_0x11a6('0x3b')]};return db[_0x11a6('0x2e')][_0x11a6('0x20')](_0x9323fd)[_0x11a6('0x25')](function(_0x1fe8cc){_0x44223f[_0x11a6('0x20')]=_0x1fe8cc;if(_0x2ae562[_0x11a6('0x33')][_0x11a6('0x40')]){_0x216819['include']=[{'all':!![]}];}return db[_0x11a6('0x2e')][_0x11a6('0x41')](_0x216819);})[_0x11a6('0x25')](function(_0x754fa4){_0x44223f[_0x11a6('0x42')]=_0x754fa4;return _0x44223f;})[_0x11a6('0x25')](respondWithFilteredResult(_0x313737,_0x216819))[_0x11a6('0x43')](handleError(_0x313737,null));};exports[_0x11a6('0x44')]=function(_0x4023f9,_0x2a25e1){var _0x249589={'raw':!![],'where':{'id':_0x4023f9[_0x11a6('0x45')]['id']}},_0x5b4a3f={};_0x5b4a3f['model']=_[_0x11a6('0x32')](db['OpenchannelQueue'][_0x11a6('0x46')]);_0x5b4a3f[_0x11a6('0x33')]=_[_0x11a6('0x32')](_0x4023f9[_0x11a6('0x33')]);_0x5b4a3f['filters']=_[_0x11a6('0x35')](_0x5b4a3f['model'],_0x5b4a3f[_0x11a6('0x33')]);_0x249589['attributes']=_['intersection'](_0x5b4a3f[_0x11a6('0x36')],qs[_0x11a6('0x38')](_0x4023f9[_0x11a6('0x33')][_0x11a6('0x38')]));_0x249589['attributes']=_0x249589[_0x11a6('0x37')][_0x11a6('0x47')]?_0x249589[_0x11a6('0x37')]:_0x5b4a3f[_0x11a6('0x36')];if(_0x4023f9[_0x11a6('0x33')][_0x11a6('0x40')]){_0x249589['include']=[{'all':!![]}];}_0x249589=_[_0x11a6('0x3d')]({},_0x249589,_0x4023f9[_0x11a6('0x3f')]);return db[_0x11a6('0x2e')]['find'](_0x249589)[_0x11a6('0x25')](handleEntityNotFound(_0x2a25e1,null))['then'](respondWithResult(_0x2a25e1,null))[_0x11a6('0x43')](handleError(_0x2a25e1,null));};exports[_0x11a6('0x48')]=function(_0x339886,_0x58d203){return db[_0x11a6('0x2e')][_0x11a6('0x48')](_0x339886['body'],{})[_0x11a6('0x25')](function(_0x713742){var _0x49305a=_0x339886['user'][_0x11a6('0x49')]({'plain':!![]});if(!_0x49305a)throw new Error(_0x11a6('0x4a'));if(_0x49305a[_0x11a6('0x4b')]===_0x11a6('0x4c')){var _0x32f8e8=_0x713742[_0x11a6('0x49')]({'plain':!![]});var _0x5ddd17=_0x11a6('0x27');return db[_0x11a6('0x4d')][_0x11a6('0x4e')]({'where':{'name':_0x5ddd17,'userProfileId':_0x49305a[_0x11a6('0x4f')]},'raw':!![]})['then'](function(_0x53afef){if(_0x53afef&&_0x53afef[_0x11a6('0x50')]===0x0){return db[_0x11a6('0x51')][_0x11a6('0x48')]({'name':_0x32f8e8['name'],'resourceId':_0x32f8e8['id'],'type':_0x53afef[_0x11a6('0x2a')],'sectionId':_0x53afef['id']},{})[_0x11a6('0x25')](function(){return _0x713742;});}else{return _0x713742;}})['catch'](function(_0x540951){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x540951);throw _0x540951;});}return _0x713742;})[_0x11a6('0x25')](respondWithResult(_0x58d203,0xc9))[_0x11a6('0x43')](handleError(_0x58d203,null));};exports[_0x11a6('0x24')]=function(_0x3ea233,_0x5eeb49){if(_0x3ea233[_0x11a6('0x52')]['id']){delete _0x3ea233[_0x11a6('0x52')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x3ea233[_0x11a6('0x45')]['id']}})[_0x11a6('0x25')](handleEntityNotFound(_0x5eeb49,null))[_0x11a6('0x25')](saveUpdates(_0x3ea233[_0x11a6('0x52')],null))[_0x11a6('0x25')](respondWithResult(_0x5eeb49,null))[_0x11a6('0x43')](handleError(_0x5eeb49,null));};exports['destroy']=function(_0x592e07,_0x39693c){return db[_0x11a6('0x2e')][_0x11a6('0x4e')]({'where':{'id':_0x592e07[_0x11a6('0x45')]['id']}})[_0x11a6('0x25')](handleEntityNotFound(_0x39693c,null))[_0x11a6('0x25')](removeEntity(_0x39693c,null))[_0x11a6('0x43')](handleError(_0x39693c,null));};exports[_0x11a6('0x53')]=function(_0x386cfc,_0x4dd527){return db[_0x11a6('0x2e')][_0x11a6('0x53')]()[_0x11a6('0x25')](respondWithResult(_0x4dd527,null))[_0x11a6('0x43')](handleError(_0x4dd527,null));};exports[_0x11a6('0x54')]=function(_0x1da773,_0x3e0319,_0x57c10a){var _0x4632b5={'raw':!![],'where':{}},_0x2580ce={},_0x16a4f6;return db['OpenchannelQueue'][_0x11a6('0x55')]({'where':{'id':_0x1da773[_0x11a6('0x45')]['id']}})[_0x11a6('0x25')](handleEntityNotFound(_0x3e0319,null))[_0x11a6('0x25')](function(_0x74b949){if(_0x74b949){_0x16a4f6=_0x74b949[_0x11a6('0x49')]({'plain':!![]});_0x2580ce[_0x11a6('0x36')]=_[_0x11a6('0x32')](db['UserOpenchannelQueue']['rawAttributes']);_0x2580ce[_0x11a6('0x33')]=_['keys'](_0x1da773[_0x11a6('0x33')]);_0x2580ce[_0x11a6('0x34')]=_[_0x11a6('0x35')](_0x2580ce['model'],_0x2580ce[_0x11a6('0x33')]);_0x4632b5['attributes']=_[_0x11a6('0x35')](_0x2580ce[_0x11a6('0x36')],qs[_0x11a6('0x38')](_0x1da773['query'][_0x11a6('0x38')]));_0x4632b5[_0x11a6('0x37')]=_0x4632b5['attributes'][_0x11a6('0x47')]?_0x4632b5['attributes']:_0x2580ce[_0x11a6('0x36')];if(!_0x1da773[_0x11a6('0x33')][_0x11a6('0x56')]('nolimit')){_0x4632b5[_0x11a6('0x1f')]=qs[_0x11a6('0x1f')](_0x1da773[_0x11a6('0x33')][_0x11a6('0x1f')]);_0x4632b5[_0x11a6('0x1d')]=qs[_0x11a6('0x1d')](_0x1da773[_0x11a6('0x33')]['offset']);}_0x4632b5['order']=qs['sort'](_0x1da773[_0x11a6('0x33')]['sort']);_0x4632b5[_0x11a6('0x3b')]=qs[_0x11a6('0x34')](_[_0x11a6('0x57')](_0x1da773['query'],_0x2580ce[_0x11a6('0x34')]));_0x4632b5['where'][_0x11a6('0x58')]=_0x74b949['id'];if(_0x1da773[_0x11a6('0x33')][_0x11a6('0x3c')]){_0x4632b5[_0x11a6('0x3b')]=_[_0x11a6('0x3d')](_0x4632b5['where'],{'$or':_[_0x11a6('0x2d')](_0x4632b5[_0x11a6('0x37')],function(_0x10c09b){var _0x222064={};_0x222064[_0x10c09b]={'$like':'%'+_0x1da773[_0x11a6('0x33')][_0x11a6('0x3c')]+'%'};return _0x222064;})});}_0x4632b5=_[_0x11a6('0x3d')]({},_0x4632b5,_0x1da773[_0x11a6('0x3f')]);return db[_0x11a6('0x59')][_0x11a6('0x41')](_0x4632b5);}})[_0x11a6('0x25')](function(_0x1409f0){if(_0x1409f0){return db[_0x11a6('0x5a')]['findAndCountAll']({'where':{'id':_[_0x11a6('0x2d')](_0x1409f0,_0x11a6('0x5b')),'role':'agent'},'attributes':['id',_0x11a6('0x2a'),_0x11a6('0x5c'),_0x11a6('0x5d'),_0x11a6('0x5e')]});}})[_0x11a6('0x25')](function(_0x1b5845){if(_0x1b5845){return{'count':_0x1b5845['count'],'rows':_[_0x11a6('0x2d')](_0x1b5845['rows'],function(_0x3941e9){return{'membername':_0x3941e9['name'],'UserId':_0x3941e9['id'],'queue_name':_0x16a4f6[_0x11a6('0x2a')],'OpenchannelQueueId':_0x16a4f6['id'],'interface':util[_0x11a6('0x5f')]('%s/%s',_0x11a6('0x60'),_0x3941e9[_0x11a6('0x2a')]),'penalty':0x0,'paused':_0x3941e9[_0x11a6('0x5c')],'createdAt':_0x3941e9[_0x11a6('0x5e')],'updatedAt':_0x3941e9[_0x11a6('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x11a6('0x25')](respondWithFilteredResult(_0x3e0319,_0x4632b5))['catch'](handleError(_0x3e0319,null));};exports[_0x11a6('0x61')]=function(_0x41c837,_0x8e9562,_0x2412f5){var _0x4ed8d0={};var _0x56dd02={};var _0x1b40b5;var _0x4ed928;return db[_0x11a6('0x2e')][_0x11a6('0x55')]({'where':{'id':_0x41c837[_0x11a6('0x45')]['id']}})[_0x11a6('0x25')](handleEntityNotFound(_0x8e9562,null))[_0x11a6('0x25')](function(_0x4d8b3b){if(_0x4d8b3b){_0x1b40b5=_0x4d8b3b;_0x56dd02[_0x11a6('0x36')]=_[_0x11a6('0x32')](db[_0x11a6('0x62')][_0x11a6('0x46')]);_0x56dd02[_0x11a6('0x33')]=_[_0x11a6('0x32')](_0x41c837[_0x11a6('0x33')]);_0x56dd02['filters']=_[_0x11a6('0x35')](_0x56dd02['model'],_0x56dd02['query']);_0x4ed8d0['attributes']=_[_0x11a6('0x35')](_0x56dd02['model'],qs[_0x11a6('0x38')](_0x41c837[_0x11a6('0x33')][_0x11a6('0x38')]));_0x4ed8d0['attributes']=_0x4ed8d0[_0x11a6('0x37')]['length']?_0x4ed8d0[_0x11a6('0x37')]:_0x56dd02[_0x11a6('0x36')];_0x4ed8d0[_0x11a6('0x63')]=qs[_0x11a6('0x3a')](_0x41c837[_0x11a6('0x33')][_0x11a6('0x3a')]);_0x4ed8d0[_0x11a6('0x3b')]=qs['filters'](_[_0x11a6('0x57')](_0x41c837['query'],_0x56dd02[_0x11a6('0x34')]));if(_0x41c837['query']['filter']){_0x4ed8d0[_0x11a6('0x3b')]=_[_0x11a6('0x3d')](_0x4ed8d0[_0x11a6('0x3b')],{'$or':_[_0x11a6('0x2d')](_0x4ed8d0[_0x11a6('0x37')],function(_0x1ba766){var _0x1a6185={};_0x1a6185[_0x1ba766]={'$like':'%'+_0x41c837[_0x11a6('0x33')][_0x11a6('0x3c')]+'%'};return _0x1a6185;})});}_0x4ed8d0=_[_0x11a6('0x3d')]({},_0x4ed8d0,_0x41c837[_0x11a6('0x3f')]);return _0x1b40b5[_0x11a6('0x61')](_0x4ed8d0);}})['then'](function(_0x280ae4){if(_0x280ae4){_0x4ed928=_0x280ae4[_0x11a6('0x47')];if(!_0x41c837[_0x11a6('0x33')][_0x11a6('0x56')](_0x11a6('0x39'))){_0x4ed8d0[_0x11a6('0x1f')]=qs[_0x11a6('0x1f')](_0x41c837[_0x11a6('0x33')][_0x11a6('0x1f')]);_0x4ed8d0[_0x11a6('0x1d')]=qs[_0x11a6('0x1d')](_0x41c837[_0x11a6('0x33')][_0x11a6('0x1d')]);}return _0x1b40b5[_0x11a6('0x61')](_0x4ed8d0);}})['then'](function(_0x45cff3){if(_0x45cff3){return _0x45cff3?{'count':_0x4ed928,'rows':_0x45cff3}:null;}})[_0x11a6('0x25')](respondWithResult(_0x8e9562,null))['catch'](handleError(_0x8e9562,null));};exports[_0x11a6('0x64')]=function(_0x240060,_0x3c5677,_0x226ccc){var _0x21fc7a=_0x240060[_0x11a6('0x52')][_0x11a6('0x65')];return db['Team']['findAll']({'where':{'id':_0x21fc7a},'attributes':['id'],'include':[{'model':db[_0x11a6('0x5a')],'as':_0x11a6('0x66'),'attributes':['id','name',_0x11a6('0x67'),_0x11a6('0x68'),'interface'],'raw':!![]}]})[_0x11a6('0x25')](function(_0x589594){if(_0x589594){var _0x10f31a=_[_0x11a6('0x69')](_0x589594,function(_0x29fccf){var _0x3b21ac=_0x29fccf[_0x11a6('0x49')]({'plain':!![]});return _0x3b21ac['Agents'];});return db[_0x11a6('0x2e')]['find']({'where':{'id':_0x240060['params']['id']}})[_0x11a6('0x25')](function(_0x35fef4){return db[_0x11a6('0x6a')][_0x11a6('0x6b')](function(_0x4168ee){return _0x35fef4[_0x11a6('0x64')](_0x21fc7a,{'transaction':_0x4168ee})[_0x11a6('0x25')](function(){return BPromise['each'](_0x10f31a,function(_0x3d7a2a){return db[_0x11a6('0x59')][_0x11a6('0x6c')]({'where':{'UserId':_0x3d7a2a['id'],'OpenchannelQueueId':_0x240060[_0x11a6('0x45')]['id']},'transaction':_0x4168ee});});})[_0x11a6('0x25')](function(){_0x10f31a[_0x11a6('0x6d')](function(_0x41ff81){socket[_0x11a6('0x6e')](_0x11a6('0x6f'),{'UserId':_0x41ff81['id'],'OpenchannelQueueId':_0x35fef4['id']});});});});});}})[_0x11a6('0x25')](respondWithStatusCode(_0x3c5677,null))[_0x11a6('0x43')](handleError(_0x3c5677,null));};exports[_0x11a6('0x70')]=function(_0x1a0386,_0x2ab833,_0x2c3471){return db[_0x11a6('0x62')][_0x11a6('0x41')]({'where':{'id':_0x1a0386[_0x11a6('0x33')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x11a6('0x25')](handleEntityNotFound(_0x2ab833,null))[_0x11a6('0x25')](function(_0xb7c1cc){var _0x3d883a=_['map'](_0xb7c1cc,'id');var _0x2a2e29=[];var _0x3d81da=[];var _0x3d2ce7=squel[_0x11a6('0x71')]();_0x3d2ce7[_0x11a6('0x72')](_0x11a6('0x73'))[_0x11a6('0x74')](_0x11a6('0x75'),'tq')[_0x11a6('0x76')](_0x11a6('0x77'),'ut',_0x11a6('0x78'))[_0x11a6('0x3b')](_0x11a6('0x79'),_0x1a0386['params']['id']);for(var _0x4a67c1=0x0;_0x4a67c1<_0xb7c1cc[_0x11a6('0x47')];_0x4a67c1+=0x1){let _0x224947=_0xb7c1cc[_0x4a67c1];for(var _0x542569=0x0;_0x542569<_0x224947[_0x11a6('0x66')]['length'];_0x542569+=0x1){let _0xd93c82=_0x224947['Agents'][_0x542569];var _0xcd5284=_0x3d2ce7['clone']();_0xcd5284[_0x11a6('0x3b')](_0x11a6('0x7a'),_0xd93c82['id']);_0x3d81da[_0x11a6('0x7b')](db['sequelize'][_0x11a6('0x33')](_0xcd5284[_0x11a6('0x7c')](),{'type':db[_0x11a6('0x6a')][_0x11a6('0x7d')][_0x11a6('0x7e')]})[_0x11a6('0x25')](function(_0x5987cc){if(_0x5987cc['length']===0x1){return _0xd93c82['id'];}else{var _0x575e8a=_[_0x11a6('0x7f')](_['map'](_0x5987cc,_0x11a6('0x80')),function(_0x16cee8){return _[_0x11a6('0x81')](_0x3d883a,_0x16cee8);});if(_0x575e8a){return _0xd93c82['id'];}}}));}}return BPromise[_0x11a6('0x82')](_0x3d81da)[_0x11a6('0x25')](function(_0x452e85){_0x2a2e29=_(_0x2a2e29)[_0x11a6('0x83')](_0x452e85)[_0x11a6('0x84')]()[_0x11a6('0x85')]();return db[_0x11a6('0x2e')][_0x11a6('0x4e')]({'where':{'id':_0x1a0386[_0x11a6('0x45')]['id']}})['then'](function(_0x3f135b){return db['sequelize']['transaction'](function(_0x5eeba3){return _0x3f135b['removeTeams'](_0x1a0386[_0x11a6('0x33')]['ids'],{'transaction':_0x5eeba3})[_0x11a6('0x25')](function(){if(!_['isEmpty'](_0x2a2e29)){return _0x3f135b['removeAgents'](_0x2a2e29,{'transaction':_0x5eeba3});}})[_0x11a6('0x25')](function(){_0x2a2e29[_0x11a6('0x6d')](function(_0x5d8fc5){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x5d8fc5,'OpenchannelQueueId':_0x3f135b['id']});});});});});});})['then'](respondWithStatusCode(_0x2ab833,null))['catch'](handleError(_0x2ab833,null));};exports[_0x11a6('0x86')]=function(_0x23bc87,_0x2ec8ab,_0x698757){return db[_0x11a6('0x2e')]['find']({'where':{'id':_0x23bc87['params']['id']}})['then'](handleEntityNotFound(_0x2ec8ab,null))[_0x11a6('0x25')](function(_0x21c0ca){if(_0x21c0ca){return _0x21c0ca[_0x11a6('0x86')](_0x23bc87[_0x11a6('0x52')][_0x11a6('0x65')],_['omit'](_0x23bc87[_0x11a6('0x52')],[_0x11a6('0x65'),'id'])||{})[_0x11a6('0x87')](function(_0x4f399a){for(var _0x104188=0x0;_0x104188<_0x23bc87[_0x11a6('0x52')]['ids'][_0x11a6('0x47')];_0x104188+=0x1){socket[_0x11a6('0x6e')](_0x11a6('0x6f'),{'UserId':Number(_0x23bc87['body'][_0x11a6('0x65')][_0x104188]),'OpenchannelQueueId':Number(_0x23bc87['params']['id'])});}return _0x4f399a;});}})[_0x11a6('0x25')](respondWithResult(_0x2ec8ab,null))[_0x11a6('0x43')](handleError(_0x2ec8ab,null));};exports[_0x11a6('0x88')]=function(_0x1452a3,_0x39c47a,_0x268f4c){return db['OpenchannelQueue'][_0x11a6('0x4e')]({'where':{'id':_0x1452a3[_0x11a6('0x45')]['id']}})['then'](handleEntityNotFound(_0x39c47a,null))[_0x11a6('0x25')](function(_0x1e1213){if(_0x1e1213){return _0x1e1213['removeAgents'](_0x1452a3[_0x11a6('0x33')][_0x11a6('0x65')])[_0x11a6('0x25')](function(){if(_['isArray'](_0x1452a3[_0x11a6('0x33')][_0x11a6('0x65')])){for(var _0x169138=0x0;_0x169138<_0x1452a3[_0x11a6('0x33')][_0x11a6('0x65')][_0x11a6('0x47')];_0x169138+=0x1){socket['emit'](_0x11a6('0x89'),{'UserId':Number(_0x1452a3[_0x11a6('0x33')][_0x11a6('0x65')][_0x169138]),'OpenchannelQueueId':Number(_0x1452a3[_0x11a6('0x45')]['id'])});}}else{socket[_0x11a6('0x6e')](_0x11a6('0x89'),{'UserId':Number(_0x1452a3[_0x11a6('0x33')][_0x11a6('0x65')]),'OpenchannelQueueId':Number(_0x1452a3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x39c47a,null))[_0x11a6('0x43')](handleError(_0x39c47a,null));};exports[_0x11a6('0x8a')]=function(_0x34e78f,_0x145d84,_0xc82840){var _0x398a24={};var _0x5cec69={};var _0x2c43ae;var _0x4b2c13;return db[_0x11a6('0x2e')]['findOne']({'where':{'id':_0x34e78f[_0x11a6('0x45')]['id']}})[_0x11a6('0x25')](handleEntityNotFound(_0x145d84,null))[_0x11a6('0x25')](function(_0x599b0c){if(_0x599b0c){_0x2c43ae=_0x599b0c;_0x5cec69[_0x11a6('0x36')]=_[_0x11a6('0x32')](db[_0x11a6('0x5a')][_0x11a6('0x46')]);_0x5cec69[_0x11a6('0x33')]=_[_0x11a6('0x32')](_0x34e78f[_0x11a6('0x33')]);_0x5cec69[_0x11a6('0x34')]=_[_0x11a6('0x35')](_0x5cec69[_0x11a6('0x36')],_0x5cec69[_0x11a6('0x33')]);_0x398a24['attributes']=_[_0x11a6('0x35')](_0x5cec69[_0x11a6('0x36')],qs['fields'](_0x34e78f[_0x11a6('0x33')]['fields']));_0x398a24[_0x11a6('0x37')]=_0x398a24['attributes'][_0x11a6('0x47')]?_0x398a24[_0x11a6('0x37')]:_0x5cec69[_0x11a6('0x36')];_0x398a24[_0x11a6('0x63')]=qs[_0x11a6('0x3a')](_0x34e78f['query'][_0x11a6('0x3a')]);_0x398a24[_0x11a6('0x3b')]=qs['filters'](_['pick'](_0x34e78f[_0x11a6('0x33')],_0x5cec69[_0x11a6('0x34')]));if(_0x34e78f[_0x11a6('0x33')][_0x11a6('0x3c')]){_0x398a24[_0x11a6('0x3b')]=_[_0x11a6('0x3d')](_0x398a24[_0x11a6('0x3b')],{'$or':_['map'](_0x398a24[_0x11a6('0x37')],function(_0x1ccbfc){var _0x17b22e={};_0x17b22e[_0x1ccbfc]={'$like':'%'+_0x34e78f[_0x11a6('0x33')][_0x11a6('0x3c')]+'%'};return _0x17b22e;})});}_0x398a24=_['merge']({},_0x398a24,_0x34e78f[_0x11a6('0x3f')]);return _0x2c43ae[_0x11a6('0x8a')](_0x398a24);}})[_0x11a6('0x25')](function(_0x2a1ebb){if(_0x2a1ebb){_0x4b2c13=_0x2a1ebb[_0x11a6('0x47')];if(!_0x34e78f[_0x11a6('0x33')]['hasOwnProperty'](_0x11a6('0x39'))){_0x398a24['limit']=qs[_0x11a6('0x1f')](_0x34e78f[_0x11a6('0x33')][_0x11a6('0x1f')]);_0x398a24[_0x11a6('0x1d')]=qs['offset'](_0x34e78f[_0x11a6('0x33')][_0x11a6('0x1d')]);}return _0x2c43ae[_0x11a6('0x8a')](_0x398a24);}})[_0x11a6('0x25')](function(_0x7e2aa0){if(_0x7e2aa0){return _0x7e2aa0?{'count':_0x4b2c13,'rows':_0x7e2aa0}:null;}})[_0x11a6('0x25')](respondWithResult(_0x145d84,null))[_0x11a6('0x43')](handleError(_0x145d84,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 388bab6..265acd8 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 _0x8068=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x157473,_0x461b43){var _0x46c842=function(_0x2087bc){while(--_0x2087bc){_0x157473['push'](_0x157473['shift']());}};_0x46c842(++_0x461b43);}(_0x8068,0x10b));var _0x8806=function(_0x4081a5,_0x27e9e2){_0x4081a5=_0x4081a5-0x0;var _0x59f5d9=_0x8068[_0x4081a5];return _0x59f5d9;};'use strict';var EventEmitter=require(_0x8806('0x0'));var OpenchannelQueue=require(_0x8806('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8806('0x2')](0x0);var events={'afterCreate':_0x8806('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2184fb){return function(_0x227a1b,_0x1e3054,_0x5dfe88){OpenchannelQueueEvents['emit'](_0x2184fb+':'+_0x227a1b['id'],_0x227a1b);OpenchannelQueueEvents[_0x8806('0x4')](_0x2184fb,_0x227a1b);_0x5dfe88(null);};}for(var e in events){if(events[_0x8806('0x5')](e)){var event=events[e];OpenchannelQueue[_0x8806('0x6')](e,emitEvent(event));}}module[_0x8806('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x5c20=['hook','exports','events','setMaxListeners','update','emit'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x5c20,0x1dc));var _0x05c2=function(_0x38ba2e,_0x557046){_0x38ba2e=_0x38ba2e-0x0;var _0x2510aa=_0x5c20[_0x38ba2e];return _0x2510aa;};'use strict';var EventEmitter=require(_0x05c2('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x05c2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x05c2('0x2'),'afterDestroy':'remove'};function emitEvent(_0x30fa7f){return function(_0x331070,_0x5eabdc,_0x4eac86){OpenchannelQueueEvents[_0x05c2('0x3')](_0x30fa7f+':'+_0x331070['id'],_0x331070);OpenchannelQueueEvents['emit'](_0x30fa7f,_0x331070);_0x4eac86(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x05c2('0x4')](e,emitEvent(event));}}module[_0x05c2('0x5')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 806df4b..12bdce5 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 _0x48a6=['util','api','moment','request-promise','path','./openchannelQueue.attributes','exports','define','openchannel_queues'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x48a6,0x17a));var _0x648a=function(_0x642029,_0xb900a){_0x642029=_0x642029-0x0;var _0x22596f=_0x48a6[_0x642029];return _0x22596f;};'use strict';var _=require('lodash');var util=require(_0x648a('0x0'));var logger=require('../../config/logger')(_0x648a('0x1'));var moment=require(_0x648a('0x2'));var BPromise=require('bluebird');var rp=require(_0x648a('0x3'));var fs=require('fs');var path=require(_0x648a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x648a('0x5'));module[_0x648a('0x6')]=function(_0x4a8f63,_0x1becdd){return _0x4a8f63[_0x648a('0x7')]('OpenchannelQueue',attributes,{'tableName':_0x648a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d0a=['openchannel_queues','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x31cdf9,_0x489e1a){var _0x5c554d=function(_0x1f30c0){while(--_0x1f30c0){_0x31cdf9['push'](_0x31cdf9['shift']());}};_0x5c554d(++_0x489e1a);}(_0x9d0a,0xdd));var _0xa9d0=function(_0x9f9816,_0x579b0e){_0x9f9816=_0x9f9816-0x0;var _0x40a913=_0x9d0a[_0x9f9816];return _0x40a913;};'use strict';var _=require(_0xa9d0('0x0'));var util=require('util');var logger=require(_0xa9d0('0x1'))('api');var moment=require(_0xa9d0('0x2'));var BPromise=require(_0xa9d0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa9d0('0x4'));var config=require(_0xa9d0('0x5'));var attributes=require(_0xa9d0('0x6'));module[_0xa9d0('0x7')]=function(_0x218a70,_0x453ea9){return _0x218a70[_0xa9d0('0x8')](_0xa9d0('0x9'),attributes,{'tableName':_0xa9d0('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 77b4e21..603ea53 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 _0x5454=['include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit'];(function(_0x5b5ffe,_0xa8bf6e){var _0x4c2fb0=function(_0x48ca31){while(--_0x48ca31){_0x5b5ffe['push'](_0x5b5ffe['shift']());}};_0x4c2fb0(++_0xa8bf6e);}(_0x5454,0xaf));var _0x4545=function(_0x263a16,_0x1ec6e4){_0x263a16=_0x263a16-0x0;var _0x488e63=_0x5454[_0x263a16];return _0x488e63;};'use strict';var _=require(_0x4545('0x0'));var util=require(_0x4545('0x1'));var moment=require(_0x4545('0x2'));var BPromise=require(_0x4545('0x3'));var rs=require(_0x4545('0x4'));var fs=require('fs');var Redis=require(_0x4545('0x5'));var db=require(_0x4545('0x6'))['db'];var utils=require(_0x4545('0x7'));var logger=require(_0x4545('0x8'))('rpc');var config=require(_0x4545('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4545('0xa')]({'port':0x232a});config[_0x4545('0xb')]=_[_0x4545('0xc')](config[_0x4545('0xb')],{'host':_0x4545('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4545('0xb')]));require(_0x4545('0xe'))[_0x4545('0xf')](socket);function respondWithRpcPromise(_0x111eec,_0x1948dd,_0x11b286){return new BPromise(function(_0x4b3edc,_0x207966){return client[_0x4545('0x10')](_0x111eec,_0x11b286)[_0x4545('0x11')](function(_0x397e5e){logger[_0x4545('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x1948dd,_0x4545('0x13'));logger['debug'](_0x4545('0x14'),_0x1948dd,_0x4545('0x13'),JSON[_0x4545('0x15')](_0x397e5e));if(_0x397e5e['error']){if(_0x397e5e[_0x4545('0x16')][_0x4545('0x17')]===0x1f4){logger[_0x4545('0x16')](_0x4545('0x18'),_0x1948dd,_0x397e5e[_0x4545('0x16')][_0x4545('0x19')]);return _0x207966(_0x397e5e[_0x4545('0x16')][_0x4545('0x19')]);}logger[_0x4545('0x16')](_0x4545('0x18'),_0x1948dd,_0x397e5e[_0x4545('0x16')][_0x4545('0x19')]);return _0x4b3edc(_0x397e5e[_0x4545('0x16')]['message']);}else{logger[_0x4545('0x12')](_0x4545('0x18'),_0x1948dd,'request\x20sent');_0x4b3edc(_0x397e5e[_0x4545('0x1a')][_0x4545('0x19')]);}})[_0x4545('0x1b')](function(_0x1e1a06){logger['error'](_0x4545('0x18'),_0x1948dd,_0x1e1a06);_0x207966(_0x1e1a06);});});}exports['GetOpenchannelQueue']=function(_0x5d87d3){var _0xe64551=this;return new Promise(function(_0x560378,_0x91c36a){return db[_0x4545('0x1c')][_0x4545('0x1d')]({'raw':_0x5d87d3[_0x4545('0x1e')]?_0x5d87d3[_0x4545('0x1e')][_0x4545('0x1f')]===undefined?!![]:![]:!![],'where':_0x5d87d3[_0x4545('0x1e')]?_0x5d87d3[_0x4545('0x1e')][_0x4545('0x20')]||null:null,'attributes':_0x5d87d3[_0x4545('0x1e')]?_0x5d87d3[_0x4545('0x1e')][_0x4545('0x21')]||null:null,'limit':_0x5d87d3[_0x4545('0x1e')]?_0x5d87d3[_0x4545('0x1e')][_0x4545('0x22')]||null:null,'include':_0x5d87d3['options']?_0x5d87d3['options'][_0x4545('0x23')]?_['map'](_0x5d87d3[_0x4545('0x1e')]['include'],function(_0x28693e){return{'model':db[_0x28693e['model']],'as':_0x28693e['as'],'attributes':_0x28693e[_0x4545('0x21')],'include':_0x28693e[_0x4545('0x23')]?_[_0x4545('0x24')](_0x28693e[_0x4545('0x23')],function(_0x323b26){return{'model':db[_0x323b26[_0x4545('0x25')]],'as':_0x323b26['as'],'attributes':_0x323b26[_0x4545('0x21')],'include':_0x323b26[_0x4545('0x23')]?_[_0x4545('0x24')](_0x323b26['include'],function(_0x5d3769){return{'model':db[_0x5d3769[_0x4545('0x25')]],'as':_0x5d3769['as'],'attributes':_0x5d3769['attributes']};}):[]};}):[]};}):[]:[]})[_0x4545('0x11')](function(_0x2cedd2){logger[_0x4545('0x12')](_0x4545('0x26'),_0x5d87d3);logger['debug']('GetOpenchannelQueue',_0x5d87d3,JSON[_0x4545('0x15')](_0x2cedd2));_0x560378(_0x2cedd2);})['catch'](function(_0x1e22bb){logger[_0x4545('0x16')](_0x4545('0x26'),_0x1e22bb[_0x4545('0x19')],_0x5d87d3);_0x91c36a(_0xe64551[_0x4545('0x16')](0x1f4,_0x1e22bb[_0x4545('0x19')]));});});};exports[_0x4545('0x27')]=function(_0x4b362b){var _0x243516=this;return new Promise(function(_0x3b0e8a,_0x43d13f){return db[_0x4545('0x1c')][_0x4545('0x28')]({'raw':_0x4b362b['options']?_0x4b362b[_0x4545('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4b362b[_0x4545('0x1e')]?_0x4b362b[_0x4545('0x1e')]['where']||null:null,'attributes':_0x4b362b[_0x4545('0x1e')]?_0x4b362b[_0x4545('0x1e')][_0x4545('0x21')]||null:null,'include':_0x4b362b[_0x4545('0x1e')]?_0x4b362b[_0x4545('0x1e')][_0x4545('0x23')]?_[_0x4545('0x24')](_0x4b362b[_0x4545('0x1e')][_0x4545('0x23')],function(_0x40d1ac){return{'model':db[_0x40d1ac[_0x4545('0x25')]],'as':_0x40d1ac['as'],'attributes':_0x40d1ac[_0x4545('0x21')],'include':_0x40d1ac[_0x4545('0x23')]?_[_0x4545('0x24')](_0x40d1ac[_0x4545('0x23')],function(_0x479ec8){return{'model':db[_0x479ec8[_0x4545('0x25')]],'as':_0x479ec8['as'],'attributes':_0x479ec8[_0x4545('0x21')],'include':_0x479ec8[_0x4545('0x23')]?_['map'](_0x479ec8['include'],function(_0xb335e5){return{'model':db[_0xb335e5['model']],'as':_0xb335e5['as'],'attributes':_0xb335e5[_0x4545('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2287b4){logger[_0x4545('0x12')]('ShowOpenchannelQueue',_0x4b362b);logger[_0x4545('0x29')](_0x4545('0x27'),_0x4b362b,JSON[_0x4545('0x15')](_0x2287b4));_0x3b0e8a(_0x2287b4);})['catch'](function(_0x39d461){logger['error'](_0x4545('0x27'),_0x39d461[_0x4545('0x19')],_0x4b362b);_0x43d13f(_0x243516[_0x4545('0x16')](0x1f4,_0x39d461[_0x4545('0x19')]));});});}; \ No newline at end of file +var _0xf263=['attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','catch','findAll','options','raw','where'];(function(_0x3e5e49,_0x4efd9c){var _0xf6394c=function(_0x34f540){while(--_0x34f540){_0x3e5e49['push'](_0x3e5e49['shift']());}};_0xf6394c(++_0x4efd9c);}(_0xf263,0x149));var _0x3f26=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0xf263[_0x5751e6];return _0x4199e4;};'use strict';var _=require(_0x3f26('0x0'));var util=require(_0x3f26('0x1'));var moment=require(_0x3f26('0x2'));var BPromise=require(_0x3f26('0x3'));var rs=require(_0x3f26('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f26('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f26('0x6'))(_0x3f26('0x7'));var config=require(_0x3f26('0x8'));var jayson=require(_0x3f26('0x9'));var client=jayson['client'][_0x3f26('0xa')]({'port':0x232a});config[_0x3f26('0xb')]=_['defaults'](config['redis'],{'host':_0x3f26('0xc'),'port':0x18eb});var socket=require(_0x3f26('0xd'))(new Redis(config[_0x3f26('0xb')]));require('./openchannelQueue.socket')[_0x3f26('0xe')](socket);function respondWithRpcPromise(_0x3407b9,_0x15b19c,_0x27ae32){return new BPromise(function(_0x33fff0,_0x4770f5){return client[_0x3f26('0xf')](_0x3407b9,_0x27ae32)[_0x3f26('0x10')](function(_0x19aed9){logger[_0x3f26('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x15b19c,'request\x20sent');logger[_0x3f26('0x12')](_0x3f26('0x13'),_0x15b19c,_0x3f26('0x14'),JSON[_0x3f26('0x15')](_0x19aed9));if(_0x19aed9['error']){if(_0x19aed9[_0x3f26('0x16')][_0x3f26('0x17')]===0x1f4){logger[_0x3f26('0x16')](_0x3f26('0x18'),_0x15b19c,_0x19aed9['error'][_0x3f26('0x19')]);return _0x4770f5(_0x19aed9[_0x3f26('0x16')][_0x3f26('0x19')]);}logger[_0x3f26('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x15b19c,_0x19aed9[_0x3f26('0x16')][_0x3f26('0x19')]);return _0x33fff0(_0x19aed9[_0x3f26('0x16')][_0x3f26('0x19')]);}else{logger[_0x3f26('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x15b19c,'request\x20sent');_0x33fff0(_0x19aed9['result'][_0x3f26('0x19')]);}})[_0x3f26('0x1a')](function(_0x54e79b){logger[_0x3f26('0x16')](_0x3f26('0x18'),_0x15b19c,_0x54e79b);_0x4770f5(_0x54e79b);});});}exports['GetOpenchannelQueue']=function(_0x4e9077){var _0x47c4b9=this;return new Promise(function(_0x3080f2,_0x20fe9c){return db['OpenchannelQueue'][_0x3f26('0x1b')]({'raw':_0x4e9077[_0x3f26('0x1c')]?_0x4e9077[_0x3f26('0x1c')][_0x3f26('0x1d')]===undefined?!![]:![]:!![],'where':_0x4e9077[_0x3f26('0x1c')]?_0x4e9077['options'][_0x3f26('0x1e')]||null:null,'attributes':_0x4e9077[_0x3f26('0x1c')]?_0x4e9077[_0x3f26('0x1c')][_0x3f26('0x1f')]||null:null,'limit':_0x4e9077[_0x3f26('0x1c')]?_0x4e9077[_0x3f26('0x1c')][_0x3f26('0x20')]||null:null,'include':_0x4e9077[_0x3f26('0x1c')]?_0x4e9077[_0x3f26('0x1c')][_0x3f26('0x21')]?_[_0x3f26('0x22')](_0x4e9077[_0x3f26('0x1c')]['include'],function(_0x42c589){return{'model':db[_0x42c589[_0x3f26('0x23')]],'as':_0x42c589['as'],'attributes':_0x42c589[_0x3f26('0x1f')],'include':_0x42c589['include']?_['map'](_0x42c589[_0x3f26('0x21')],function(_0x1eab9c){return{'model':db[_0x1eab9c[_0x3f26('0x23')]],'as':_0x1eab9c['as'],'attributes':_0x1eab9c[_0x3f26('0x1f')],'include':_0x1eab9c[_0x3f26('0x21')]?_[_0x3f26('0x22')](_0x1eab9c[_0x3f26('0x21')],function(_0x2d2c2d){return{'model':db[_0x2d2c2d[_0x3f26('0x23')]],'as':_0x2d2c2d['as'],'attributes':_0x2d2c2d[_0x3f26('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f35e9){logger[_0x3f26('0x11')](_0x3f26('0x24'),_0x4e9077);logger['debug']('GetOpenchannelQueue',_0x4e9077,JSON['stringify'](_0x1f35e9));_0x3080f2(_0x1f35e9);})[_0x3f26('0x1a')](function(_0x460927){logger[_0x3f26('0x16')]('GetOpenchannelQueue',_0x460927[_0x3f26('0x19')],_0x4e9077);_0x20fe9c(_0x47c4b9['error'](0x1f4,_0x460927[_0x3f26('0x19')]));});});};exports[_0x3f26('0x25')]=function(_0x447f62){var _0x5a3cfe=this;return new Promise(function(_0xbdfa3d,_0x4b4b16){return db[_0x3f26('0x26')][_0x3f26('0x27')]({'raw':_0x447f62['options']?_0x447f62[_0x3f26('0x1c')][_0x3f26('0x1d')]===undefined?!![]:![]:!![],'where':_0x447f62[_0x3f26('0x1c')]?_0x447f62[_0x3f26('0x1c')]['where']||null:null,'attributes':_0x447f62[_0x3f26('0x1c')]?_0x447f62[_0x3f26('0x1c')][_0x3f26('0x1f')]||null:null,'include':_0x447f62[_0x3f26('0x1c')]?_0x447f62[_0x3f26('0x1c')][_0x3f26('0x21')]?_[_0x3f26('0x22')](_0x447f62['options'][_0x3f26('0x21')],function(_0xb0ba9a){return{'model':db[_0xb0ba9a['model']],'as':_0xb0ba9a['as'],'attributes':_0xb0ba9a['attributes'],'include':_0xb0ba9a[_0x3f26('0x21')]?_['map'](_0xb0ba9a[_0x3f26('0x21')],function(_0x861a5f){return{'model':db[_0x861a5f[_0x3f26('0x23')]],'as':_0x861a5f['as'],'attributes':_0x861a5f['attributes'],'include':_0x861a5f[_0x3f26('0x21')]?_[_0x3f26('0x22')](_0x861a5f['include'],function(_0x1eeb31){return{'model':db[_0x1eeb31[_0x3f26('0x23')]],'as':_0x1eeb31['as'],'attributes':_0x1eeb31[_0x3f26('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3f26('0x10')](function(_0x2b9148){logger[_0x3f26('0x11')](_0x3f26('0x25'),_0x447f62);logger[_0x3f26('0x12')](_0x3f26('0x25'),_0x447f62,JSON[_0x3f26('0x15')](_0x2b9148));_0xbdfa3d(_0x2b9148);})[_0x3f26('0x1a')](function(_0x29212b){logger[_0x3f26('0x16')](_0x3f26('0x25'),_0x29212b[_0x3f26('0x19')],_0x447f62);_0x4b4b16(_0x5a3cfe['error'](0x1f4,_0x29212b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index fd7af36..8abfd06 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 _0x044a=['update','emit','removeListener','length','openchannelQueue:'];(function(_0x14ba97,_0x432fc9){var _0x375355=function(_0x520fc2){while(--_0x520fc2){_0x14ba97['push'](_0x14ba97['shift']());}};_0x375355(++_0x432fc9);}(_0x044a,0x1cc));var _0xa044=function(_0x4eb2a3,_0x5b8e7e){_0x4eb2a3=_0x4eb2a3-0x0;var _0x55c104=_0x044a[_0x4eb2a3];return _0x55c104;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0xa044('0x0')];function createListener(_0x1d2e0b,_0x15d8c4){return function(_0xc9a81f){_0x15d8c4[_0xa044('0x1')](_0x1d2e0b,_0xc9a81f);};}function removeListener(_0x371b10,_0x2abebd){return function(){OpenchannelQueueEvents[_0xa044('0x2')](_0x371b10,_0x2abebd);};}exports['register']=function(_0x2527fe){for(var _0x7893b4=0x0,_0x307a64=events[_0xa044('0x3')];_0x7893b4<_0x307a64;_0x7893b4++){var _0x3360cb=events[_0x7893b4];var _0x4f6e36=createListener(_0xa044('0x4')+_0x3360cb,_0x2527fe);OpenchannelQueueEvents['on'](_0x3360cb,_0x4f6e36);}}; \ No newline at end of file +var _0xc264=['remove','update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0xa61aac,_0x2ae105){var _0x3039e2=function(_0x51d389){while(--_0x51d389){_0xa61aac['push'](_0xa61aac['shift']());}};_0x3039e2(++_0x2ae105);}(_0xc264,0x1a6));var _0x4c26=function(_0x112db5,_0x38a06d){_0x112db5=_0x112db5-0x0;var _0x1d7d06=_0xc264[_0x112db5];return _0x1d7d06;};'use strict';var OpenchannelQueueEvents=require(_0x4c26('0x0'));var events=[_0x4c26('0x1'),_0x4c26('0x2'),_0x4c26('0x3')];function createListener(_0x4ba294,_0x20b3fa){return function(_0x2a7da4){_0x20b3fa[_0x4c26('0x4')](_0x4ba294,_0x2a7da4);};}function removeListener(_0x1b226c,_0x4dd12b){return function(){OpenchannelQueueEvents[_0x4c26('0x5')](_0x1b226c,_0x4dd12b);};}exports[_0x4c26('0x6')]=function(_0xe07456){for(var _0xcc60a7=0x0,_0x208947=events['length'];_0xcc60a7<_0x208947;_0xcc60a7++){var _0x3c1a8f=events[_0xcc60a7];var _0x4fabcd=createListener(_0x4c26('0x7')+_0x3c1a8f,_0xe07456);OpenchannelQueueEvents['on'](_0x3c1a8f,_0x4fabcd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f05458c..2d37d86 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 _0x1e0d=['multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','/:id','update','destroy'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x1e0d,0x186));var _0xd1e0=function(_0x21e849,_0x1c6e03){_0x21e849=_0x21e849-0x0;var _0x28585d=_0x1e0d[_0x21e849];return _0x28585d;};'use strict';var multer=require(_0xd1e0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd1e0('0x1'));var express=require(_0xd1e0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd1e0('0x3'));var interaction=require(_0xd1e0('0x4'));var config=require(_0xd1e0('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0xd1e0('0x6')]('/',auth[_0xd1e0('0x7')](),controller['index']);router['get']('/describe',auth[_0xd1e0('0x7')](),controller['describe']);router['get']('/:id',auth[_0xd1e0('0x7')](),controller['show']);router[_0xd1e0('0x8')]('/',auth[_0xd1e0('0x7')](),controller[_0xd1e0('0x9')]);router['put'](_0xd1e0('0xa'),auth[_0xd1e0('0x7')](),controller[_0xd1e0('0xb')]);router['delete']('/:id',auth[_0xd1e0('0x7')](),controller[_0xd1e0('0xc')]);module['exports']=router; \ No newline at end of file +var _0x9ba4=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','describe','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x9ba4,0x64));var _0x49ba=function(_0x1ff382,_0x3bbd66){_0x1ff382=_0x1ff382-0x0;var _0x302bc2=_0x9ba4[_0x1ff382];return _0x302bc2;};'use strict';var multer=require(_0x49ba('0x0'));var util=require(_0x49ba('0x1'));var path=require('path');var timeout=require(_0x49ba('0x2'));var express=require('express');var router=express[_0x49ba('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x49ba('0x4'));var interaction=require(_0x49ba('0x5'));var config=require(_0x49ba('0x6'));var controller=require(_0x49ba('0x7'));router['get']('/',auth[_0x49ba('0x8')](),controller[_0x49ba('0x9')]);router['get']('/describe',auth[_0x49ba('0x8')](),controller[_0x49ba('0xa')]);router[_0x49ba('0xb')](_0x49ba('0xc'),auth[_0x49ba('0x8')](),controller[_0x49ba('0xd')]);router[_0x49ba('0xe')]('/',auth[_0x49ba('0x8')](),controller[_0x49ba('0xf')]);router[_0x49ba('0x10')](_0x49ba('0xc'),auth[_0x49ba('0x8')](),controller[_0x49ba('0x11')]);router[_0x49ba('0x12')](_0x49ba('0xc'),auth['isAuthenticated'](),controller[_0x49ba('0x13')]);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 6ee8130..288cc60 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 _0x5075=['moment','sequelize','exports','STRING','DATE'];(function(_0x45c9c2,_0x94a90e){var _0x40cdc2=function(_0x272de2){while(--_0x272de2){_0x45c9c2['push'](_0x45c9c2['shift']());}};_0x40cdc2(++_0x94a90e);}(_0x5075,0x73));var _0x5507=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x5075[_0x2b4448];return _0xb4b465;};'use strict';var moment=require(_0x5507('0x0'));var Sequelize=require(_0x5507('0x1'));module[_0x5507('0x2')]={'uniqueid':{'type':Sequelize[_0x5507('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5507('0x3')]},'joinAt':{'type':Sequelize[_0x5507('0x4')]},'leaveAt':{'type':Sequelize[_0x5507('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5507('0x4')]},'reason':{'type':Sequelize[_0x5507('0x3')]}}; \ No newline at end of file +var _0xc9cb=['DATE','moment','sequelize','STRING'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xc9cb,0x199));var _0xbc9c=function(_0x3b9a2a,_0x43411e){_0x3b9a2a=_0x3b9a2a-0x0;var _0x36978b=_0xc9cb[_0x3b9a2a];return _0x36978b;};'use strict';var moment=require(_0xbc9c('0x0'));var Sequelize=require(_0xbc9c('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbc9c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbc9c('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbc9c('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 127c43b..abd6f7a 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 _0x95c0=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','OpenchannelQueueReport','type','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','findAll','catch','show','rawAttributes','length','includeAll','create','body','params','describe','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1d465b,_0x32e3c6){var _0x333804=function(_0x441bce){while(--_0x441bce){_0x1d465b['push'](_0x1d465b['shift']());}};_0x333804(++_0x32e3c6);}(_0x95c0,0x73));var _0x095c=function(_0x28c090,_0x8f39d0){_0x28c090=_0x28c090-0x0;var _0x2fbfa3=_0x95c0[_0x28c090];return _0x2fbfa3;};'use strict';var emlformat=require(_0x095c('0x0'));var rimraf=require(_0x095c('0x1'));var zipdir=require(_0x095c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x095c('0x3'));var Mustache=require(_0x095c('0x4'));var util=require('util');var path=require(_0x095c('0x5'));var sox=require('sox');var csv=require(_0x095c('0x6'));var ejs=require(_0x095c('0x7'));var fs=require('fs');var fs_extra=require(_0x095c('0x8'));var _=require(_0x095c('0x9'));var squel=require(_0x095c('0xa'));var crypto=require(_0x095c('0xb'));var jsforce=require(_0x095c('0xc'));var deskjs=require(_0x095c('0xd'));var toCsv=require(_0x095c('0x6'));var querystring=require('querystring');var Papa=require(_0x095c('0xe'));var Redis=require(_0x095c('0xf'));var authService=require(_0x095c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x095c('0x11'));var logger=require(_0x095c('0x12'))(_0x095c('0x13'));var utils=require(_0x095c('0x14'));var config=require(_0x095c('0x15'));var licenseUtil=require(_0x095c('0x16'));var db=require(_0x095c('0x17'))['db'];function respondWithStatusCode(_0x272906,_0x58fd85){_0x58fd85=_0x58fd85||0xcc;return function(_0x275614){if(_0x275614){return _0x272906[_0x095c('0x18')](_0x58fd85);}return _0x272906['status'](_0x58fd85)['end']();};}function respondWithResult(_0x595538,_0x5bba93){_0x5bba93=_0x5bba93||0xc8;return function(_0xc0db6a){if(_0xc0db6a){return _0x595538[_0x095c('0x19')](_0x5bba93)[_0x095c('0x1a')](_0xc0db6a);}};}function respondWithFilteredResult(_0x291059,_0x4a2076){return function(_0x188075){if(_0x188075){var _0x40f51c=typeof _0x4a2076[_0x095c('0x1b')]===_0x095c('0x1c')&&typeof _0x4a2076[_0x095c('0x1d')]==='undefined';var _0x4c11ba=_0x188075['count'];var _0x4a1d09=_0x40f51c?0x0:_0x4a2076[_0x095c('0x1b')];var _0x1a5b37=_0x40f51c?_0x188075[_0x095c('0x1e')]:_0x4a2076['offset']+_0x4a2076[_0x095c('0x1d')];var _0x52ee9a;if(_0x1a5b37>=_0x4c11ba){_0x1a5b37=_0x4c11ba;_0x52ee9a=0xc8;}else{_0x52ee9a=0xce;}_0x291059['status'](_0x52ee9a);return _0x291059[_0x095c('0x1f')](_0x095c('0x20'),_0x4a1d09+'-'+_0x1a5b37+'/'+_0x4c11ba)[_0x095c('0x1a')](_0x188075);}return null;};}function patchUpdates(_0x8396f){return function(_0x78a167){try{jsonpatch['apply'](_0x78a167,_0x8396f,!![]);}catch(_0x55ec4d){return BPromise['reject'](_0x55ec4d);}return _0x78a167[_0x095c('0x21')]();};}function saveUpdates(_0x46a087,_0x3f57a1){return function(_0x4eafb2){if(_0x4eafb2){return _0x4eafb2[_0x095c('0x22')](_0x46a087)[_0x095c('0x23')](function(_0x4525f8){return _0x4525f8;});}return null;};}function removeEntity(_0xc8d975,_0x36c701){return function(_0x4d9da9){if(_0x4d9da9){return _0x4d9da9['destroy']()[_0x095c('0x23')](function(){_0xc8d975[_0x095c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfef920,_0x53a12e){return function(_0x392a25){if(!_0x392a25){_0xfef920[_0x095c('0x18')](0x194);}return _0x392a25;};}function handleError(_0x5bcc7a,_0x586257){_0x586257=_0x586257||0x1f4;return function(_0x5cdd9c){logger[_0x095c('0x24')](_0x5cdd9c[_0x095c('0x25')]);if(_0x5cdd9c[_0x095c('0x26')]){delete _0x5cdd9c[_0x095c('0x26')];}_0x5bcc7a[_0x095c('0x19')](_0x586257)[_0x095c('0x27')](_0x5cdd9c);};}exports[_0x095c('0x28')]=function(_0x138352,_0x4b9ab4){var _0x3aff43={},_0x29634e={},_0x394ec2={'count':0x0,'rows':[]};var _0x581052=_['map'](db[_0x095c('0x29')]['rawAttributes'],function(_0x5813bf){return{'name':_0x5813bf['fieldName'],'type':_0x5813bf[_0x095c('0x2a')][_0x095c('0x2b')]};});_0x29634e[_0x095c('0x2c')]=_[_0x095c('0x2d')](_0x581052,_0x095c('0x26'));_0x29634e[_0x095c('0x2e')]=_[_0x095c('0x2f')](_0x138352['query']);_0x29634e[_0x095c('0x30')]=_[_0x095c('0x31')](_0x29634e['model'],_0x29634e[_0x095c('0x2e')]);_0x3aff43[_0x095c('0x32')]=_['intersection'](_0x29634e[_0x095c('0x2c')],qs[_0x095c('0x33')](_0x138352[_0x095c('0x2e')][_0x095c('0x33')]));_0x3aff43[_0x095c('0x32')]=_0x3aff43['attributes']['length']?_0x3aff43['attributes']:_0x29634e[_0x095c('0x2c')];if(!_0x138352[_0x095c('0x2e')]['hasOwnProperty']('nolimit')){_0x3aff43[_0x095c('0x1d')]=qs[_0x095c('0x1d')](_0x138352[_0x095c('0x2e')][_0x095c('0x1d')]);_0x3aff43[_0x095c('0x1b')]=qs['offset'](_0x138352['query']['offset']);}_0x3aff43[_0x095c('0x34')]=qs['sort'](_0x138352[_0x095c('0x2e')][_0x095c('0x35')]);_0x3aff43[_0x095c('0x36')]=qs[_0x095c('0x30')](_['pick'](_0x138352['query'],_0x29634e[_0x095c('0x30')]),_0x581052);if(_0x138352[_0x095c('0x2e')][_0x095c('0x37')]){_0x3aff43[_0x095c('0x36')]=_[_0x095c('0x38')](_0x3aff43[_0x095c('0x36')],{'$or':_[_0x095c('0x2d')](_0x581052,function(_0xc4723c){if(_0xc4723c[_0x095c('0x2a')]!==_0x095c('0x39')){var _0x5c7697={};_0x5c7697[_0xc4723c[_0x095c('0x26')]]={'$like':'%'+_0x138352[_0x095c('0x2e')][_0x095c('0x37')]+'%'};return _0x5c7697;}})});}_0x3aff43=_[_0x095c('0x38')]({},_0x3aff43,_0x138352[_0x095c('0x3a')]);var _0xdc72e7={'where':_0x3aff43['where']};return db[_0x095c('0x29')]['count'](_0xdc72e7)[_0x095c('0x23')](function(_0x3622f2){_0x394ec2[_0x095c('0x1e')]=_0x3622f2;if(_0x138352[_0x095c('0x2e')]['includeAll']){_0x3aff43['include']=[{'all':!![]}];}return db[_0x095c('0x29')][_0x095c('0x3b')](_0x3aff43);})['then'](function(_0x512689){_0x394ec2['rows']=_0x512689;return _0x394ec2;})[_0x095c('0x23')](respondWithFilteredResult(_0x4b9ab4,_0x3aff43))[_0x095c('0x3c')](handleError(_0x4b9ab4,null));};exports[_0x095c('0x3d')]=function(_0x1d961e,_0x2514f9){var _0x233ea9={'raw':!![],'where':{'id':_0x1d961e['params']['id']}},_0x17eabd={};_0x17eabd[_0x095c('0x2c')]=_['keys'](db['OpenchannelQueueReport'][_0x095c('0x3e')]);_0x17eabd[_0x095c('0x2e')]=_[_0x095c('0x2f')](_0x1d961e[_0x095c('0x2e')]);_0x17eabd[_0x095c('0x30')]=_[_0x095c('0x31')](_0x17eabd[_0x095c('0x2c')],_0x17eabd['query']);_0x233ea9[_0x095c('0x32')]=_[_0x095c('0x31')](_0x17eabd[_0x095c('0x2c')],qs[_0x095c('0x33')](_0x1d961e[_0x095c('0x2e')]['fields']));_0x233ea9['attributes']=_0x233ea9[_0x095c('0x32')][_0x095c('0x3f')]?_0x233ea9[_0x095c('0x32')]:_0x17eabd[_0x095c('0x2c')];if(_0x1d961e[_0x095c('0x2e')][_0x095c('0x40')]){_0x233ea9['include']=[{'all':!![]}];}_0x233ea9=_['merge']({},_0x233ea9,_0x1d961e[_0x095c('0x3a')]);return db[_0x095c('0x29')]['find'](_0x233ea9)[_0x095c('0x23')](handleEntityNotFound(_0x2514f9,null))[_0x095c('0x23')](respondWithResult(_0x2514f9,null))[_0x095c('0x3c')](handleError(_0x2514f9,null));};exports['create']=function(_0x3c1d05,_0xf80349){return db[_0x095c('0x29')][_0x095c('0x41')](_0x3c1d05['body'],{})[_0x095c('0x23')](respondWithResult(_0xf80349,0xc9))[_0x095c('0x3c')](handleError(_0xf80349,null));};exports[_0x095c('0x22')]=function(_0x3dc04a,_0x2ae2d9){if(_0x3dc04a['body']['id']){delete _0x3dc04a[_0x095c('0x42')]['id'];}return db[_0x095c('0x29')]['find']({'where':{'id':_0x3dc04a[_0x095c('0x43')]['id']}})[_0x095c('0x23')](handleEntityNotFound(_0x2ae2d9,null))[_0x095c('0x23')](saveUpdates(_0x3dc04a[_0x095c('0x42')],null))[_0x095c('0x23')](respondWithResult(_0x2ae2d9,null))[_0x095c('0x3c')](handleError(_0x2ae2d9,null));};exports['destroy']=function(_0x54013e,_0x4a7f1b){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x54013e[_0x095c('0x43')]['id']}})[_0x095c('0x23')](handleEntityNotFound(_0x4a7f1b,null))['then'](removeEntity(_0x4a7f1b,null))[_0x095c('0x3c')](handleError(_0x4a7f1b,null));};exports[_0x095c('0x44')]=function(_0x249c1c,_0x17350e){return db[_0x095c('0x29')]['describe']()[_0x095c('0x23')](respondWithResult(_0x17350e,null))[_0x095c('0x3c')](handleError(_0x17350e,null));}; \ No newline at end of file +var _0xc352=['reject','save','update','then','destroy','error','name','send','index','map','OpenchannelQueueReport','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','set','Content-Range'];(function(_0x567b77,_0x224fa4){var _0xf873ef=function(_0x3656d6){while(--_0x3656d6){_0x567b77['push'](_0x567b77['shift']());}};_0xf873ef(++_0x224fa4);}(_0xc352,0x1df));var _0x2c35=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xc352[_0x5cbf0e];return _0x1c76f8;};'use strict';var emlformat=require(_0x2c35('0x0'));var rimraf=require(_0x2c35('0x1'));var zipdir=require(_0x2c35('0x2'));var jsonpatch=require(_0x2c35('0x3'));var rp=require(_0x2c35('0x4'));var moment=require(_0x2c35('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2c35('0x6'));var util=require(_0x2c35('0x7'));var path=require(_0x2c35('0x8'));var sox=require(_0x2c35('0x9'));var csv=require(_0x2c35('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c35('0xb'));var _=require(_0x2c35('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c35('0xd'));var deskjs=require(_0x2c35('0xe'));var toCsv=require(_0x2c35('0xa'));var querystring=require(_0x2c35('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c35('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2c35('0x11'));var hardwareService=require(_0x2c35('0x12'));var logger=require(_0x2c35('0x13'))(_0x2c35('0x14'));var utils=require(_0x2c35('0x15'));var config=require(_0x2c35('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1937f0,_0x5d5f6b){_0x5d5f6b=_0x5d5f6b||0xcc;return function(_0x1ed8e1){if(_0x1ed8e1){return _0x1937f0[_0x2c35('0x17')](_0x5d5f6b);}return _0x1937f0[_0x2c35('0x18')](_0x5d5f6b)[_0x2c35('0x19')]();};}function respondWithResult(_0x397c8d,_0x3cd1bc){_0x3cd1bc=_0x3cd1bc||0xc8;return function(_0x53c9d8){if(_0x53c9d8){return _0x397c8d[_0x2c35('0x18')](_0x3cd1bc)[_0x2c35('0x1a')](_0x53c9d8);}};}function respondWithFilteredResult(_0x41c721,_0x33fee3){return function(_0xcb2464){if(_0xcb2464){var _0x9e5338=typeof _0x33fee3[_0x2c35('0x1b')]==='undefined'&&typeof _0x33fee3[_0x2c35('0x1c')]==='undefined';var _0x74f2c5=_0xcb2464[_0x2c35('0x1d')];var _0x32369e=_0x9e5338?0x0:_0x33fee3[_0x2c35('0x1b')];var _0x4413b4=_0x9e5338?_0xcb2464[_0x2c35('0x1d')]:_0x33fee3[_0x2c35('0x1b')]+_0x33fee3['limit'];var _0x558714;if(_0x4413b4>=_0x74f2c5){_0x4413b4=_0x74f2c5;_0x558714=0xc8;}else{_0x558714=0xce;}_0x41c721[_0x2c35('0x18')](_0x558714);return _0x41c721[_0x2c35('0x1e')](_0x2c35('0x1f'),_0x32369e+'-'+_0x4413b4+'/'+_0x74f2c5)[_0x2c35('0x1a')](_0xcb2464);}return null;};}function patchUpdates(_0x43da08){return function(_0x21f7de){try{jsonpatch['apply'](_0x21f7de,_0x43da08,!![]);}catch(_0xc20b35){return BPromise[_0x2c35('0x20')](_0xc20b35);}return _0x21f7de[_0x2c35('0x21')]();};}function saveUpdates(_0x2e8a5d,_0x1b6b05){return function(_0x377928){if(_0x377928){return _0x377928[_0x2c35('0x22')](_0x2e8a5d)[_0x2c35('0x23')](function(_0xb9d2df){return _0xb9d2df;});}return null;};}function removeEntity(_0x5820c6,_0x704e4d){return function(_0x1844ec){if(_0x1844ec){return _0x1844ec[_0x2c35('0x24')]()[_0x2c35('0x23')](function(){_0x5820c6['status'](0xcc)[_0x2c35('0x19')]();});}};}function handleEntityNotFound(_0x1f9091,_0x3462ef){return function(_0x459124){if(!_0x459124){_0x1f9091[_0x2c35('0x17')](0x194);}return _0x459124;};}function handleError(_0x3a58da,_0xe249d9){_0xe249d9=_0xe249d9||0x1f4;return function(_0x9c6704){logger[_0x2c35('0x25')](_0x9c6704['stack']);if(_0x9c6704[_0x2c35('0x26')]){delete _0x9c6704[_0x2c35('0x26')];}_0x3a58da[_0x2c35('0x18')](_0xe249d9)[_0x2c35('0x27')](_0x9c6704);};}exports[_0x2c35('0x28')]=function(_0x86a488,_0x23a46f){var _0x9ccd9c={},_0x4ccec7={},_0xc3c134={'count':0x0,'rows':[]};var _0x2576fd=_[_0x2c35('0x29')](db[_0x2c35('0x2a')]['rawAttributes'],function(_0x4c4dcb){return{'name':_0x4c4dcb['fieldName'],'type':_0x4c4dcb[_0x2c35('0x2b')][_0x2c35('0x2c')]};});_0x4ccec7['model']=_[_0x2c35('0x29')](_0x2576fd,_0x2c35('0x26'));_0x4ccec7[_0x2c35('0x2d')]=_[_0x2c35('0x2e')](_0x86a488[_0x2c35('0x2d')]);_0x4ccec7[_0x2c35('0x2f')]=_[_0x2c35('0x30')](_0x4ccec7[_0x2c35('0x31')],_0x4ccec7[_0x2c35('0x2d')]);_0x9ccd9c['attributes']=_[_0x2c35('0x30')](_0x4ccec7['model'],qs[_0x2c35('0x32')](_0x86a488['query'][_0x2c35('0x32')]));_0x9ccd9c[_0x2c35('0x33')]=_0x9ccd9c[_0x2c35('0x33')][_0x2c35('0x34')]?_0x9ccd9c[_0x2c35('0x33')]:_0x4ccec7['model'];if(!_0x86a488[_0x2c35('0x2d')][_0x2c35('0x35')](_0x2c35('0x36'))){_0x9ccd9c[_0x2c35('0x1c')]=qs['limit'](_0x86a488[_0x2c35('0x2d')][_0x2c35('0x1c')]);_0x9ccd9c['offset']=qs['offset'](_0x86a488[_0x2c35('0x2d')][_0x2c35('0x1b')]);}_0x9ccd9c[_0x2c35('0x37')]=qs['sort'](_0x86a488[_0x2c35('0x2d')][_0x2c35('0x38')]);_0x9ccd9c[_0x2c35('0x39')]=qs[_0x2c35('0x2f')](_[_0x2c35('0x3a')](_0x86a488[_0x2c35('0x2d')],_0x4ccec7[_0x2c35('0x2f')]),_0x2576fd);if(_0x86a488[_0x2c35('0x2d')][_0x2c35('0x3b')]){_0x9ccd9c['where']=_[_0x2c35('0x3c')](_0x9ccd9c[_0x2c35('0x39')],{'$or':_[_0x2c35('0x29')](_0x2576fd,function(_0x5eea23){if(_0x5eea23[_0x2c35('0x2b')]!==_0x2c35('0x3d')){var _0x4bd41c={};_0x4bd41c[_0x5eea23['name']]={'$like':'%'+_0x86a488['query'][_0x2c35('0x3b')]+'%'};return _0x4bd41c;}})});}_0x9ccd9c=_[_0x2c35('0x3c')]({},_0x9ccd9c,_0x86a488[_0x2c35('0x3e')]);var _0x4f99fa={'where':_0x9ccd9c[_0x2c35('0x39')]};return db[_0x2c35('0x2a')]['count'](_0x4f99fa)['then'](function(_0x589d5d){_0xc3c134[_0x2c35('0x1d')]=_0x589d5d;if(_0x86a488[_0x2c35('0x2d')]['includeAll']){_0x9ccd9c[_0x2c35('0x3f')]=[{'all':!![]}];}return db[_0x2c35('0x2a')][_0x2c35('0x40')](_0x9ccd9c);})[_0x2c35('0x23')](function(_0x42fb8f){_0xc3c134['rows']=_0x42fb8f;return _0xc3c134;})[_0x2c35('0x23')](respondWithFilteredResult(_0x23a46f,_0x9ccd9c))[_0x2c35('0x41')](handleError(_0x23a46f,null));};exports[_0x2c35('0x42')]=function(_0x554101,_0x438ea7){var _0x2806e2={'raw':!![],'where':{'id':_0x554101[_0x2c35('0x43')]['id']}},_0x54761b={};_0x54761b['model']=_['keys'](db['OpenchannelQueueReport']['rawAttributes']);_0x54761b['query']=_[_0x2c35('0x2e')](_0x554101['query']);_0x54761b[_0x2c35('0x2f')]=_[_0x2c35('0x30')](_0x54761b[_0x2c35('0x31')],_0x54761b[_0x2c35('0x2d')]);_0x2806e2['attributes']=_[_0x2c35('0x30')](_0x54761b[_0x2c35('0x31')],qs[_0x2c35('0x32')](_0x554101['query']['fields']));_0x2806e2[_0x2c35('0x33')]=_0x2806e2[_0x2c35('0x33')][_0x2c35('0x34')]?_0x2806e2[_0x2c35('0x33')]:_0x54761b['model'];if(_0x554101[_0x2c35('0x2d')][_0x2c35('0x44')]){_0x2806e2['include']=[{'all':!![]}];}_0x2806e2=_['merge']({},_0x2806e2,_0x554101['options']);return db[_0x2c35('0x2a')][_0x2c35('0x45')](_0x2806e2)[_0x2c35('0x23')](handleEntityNotFound(_0x438ea7,null))[_0x2c35('0x23')](respondWithResult(_0x438ea7,null))['catch'](handleError(_0x438ea7,null));};exports['create']=function(_0x43334e,_0x19a962){return db[_0x2c35('0x2a')][_0x2c35('0x46')](_0x43334e['body'],{})[_0x2c35('0x23')](respondWithResult(_0x19a962,0xc9))[_0x2c35('0x41')](handleError(_0x19a962,null));};exports[_0x2c35('0x22')]=function(_0x5d1864,_0x1a71d7){if(_0x5d1864[_0x2c35('0x47')]['id']){delete _0x5d1864[_0x2c35('0x47')]['id'];}return db[_0x2c35('0x2a')][_0x2c35('0x45')]({'where':{'id':_0x5d1864[_0x2c35('0x43')]['id']}})[_0x2c35('0x23')](handleEntityNotFound(_0x1a71d7,null))[_0x2c35('0x23')](saveUpdates(_0x5d1864[_0x2c35('0x47')],null))['then'](respondWithResult(_0x1a71d7,null))[_0x2c35('0x41')](handleError(_0x1a71d7,null));};exports[_0x2c35('0x24')]=function(_0x49bb6a,_0x4dcaa0){return db[_0x2c35('0x2a')][_0x2c35('0x45')]({'where':{'id':_0x49bb6a[_0x2c35('0x43')]['id']}})[_0x2c35('0x23')](handleEntityNotFound(_0x4dcaa0,null))[_0x2c35('0x23')](removeEntity(_0x4dcaa0,null))['catch'](handleError(_0x4dcaa0,null));};exports[_0x2c35('0x48')]=function(_0x2b0b4d,_0x2872d1){return db[_0x2c35('0x2a')][_0x2c35('0x48')]()[_0x2c35('0x23')](respondWithResult(_0x2872d1,null))[_0x2c35('0x41')](handleError(_0x2872d1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c4d83ae..fc2d51e 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(_0x574497,_0x278cdc){var _0xcdfb15=function(_0x395b4d){while(--_0x395b4d){_0x574497['push'](_0x574497['shift']());}};_0xcdfb15(++_0x278cdc);}(_0x326f,0xd1));var _0xf326=function(_0x4c0170,_0xd0738c){_0x4c0170=_0x4c0170-0x0;var _0x19b013=_0x326f[_0x4c0170];return _0x19b013;};'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(_0x57d5d7,_0x2a4ae0){var _0x2f598b=function(_0x4aa645){while(--_0x4aa645){_0x57d5d7['push'](_0x57d5d7['shift']());}};_0x2f598b(++_0x2a4ae0);}(_0xe14b,0x93));var _0xbe14=function(_0x1b770a,_0x2c9fb1){_0x1b770a=_0x1b770a-0x0;var _0x2a097e=_0xe14b[_0x1b770a];return _0x2a097e;};'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 ab4c573..2a45230 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 _0x49f8=['client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','then','stringify','update','raw','where','limit','UpdateOpenchannelQueueReport','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x374afe,_0x310384){var _0xdbe14c=function(_0x5b0e3e){while(--_0x5b0e3e){_0x374afe['push'](_0x374afe['shift']());}};_0xdbe14c(++_0x310384);}(_0x49f8,0xff));var _0x849f=function(_0x417538,_0x5a1ad6){_0x417538=_0x417538-0x0;var _0x3b15b1=_0x49f8[_0x417538];return _0x3b15b1;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});}exports[_0x849f('0x12')]=function(_0x20bea7){var _0x189529=this;return new Promise(function(_0x541cd6,_0x1e4017){return db[_0x849f('0x13')]['create'](_0x20bea7[_0x849f('0x14')],{'raw':_0x20bea7[_0x849f('0x15')]?_0x20bea7['options']['raw']===undefined?!![]:![]:!![]})[_0x849f('0x16')](function(_0x11d183){logger[_0x849f('0x8')](_0x849f('0x12'),_0x20bea7);logger[_0x849f('0xb')](_0x849f('0x12'),_0x20bea7,JSON[_0x849f('0x17')](_0x11d183));_0x541cd6(_0x11d183);})[_0x849f('0x11')](function(_0x4b29f1){logger[_0x849f('0xd')](_0x849f('0x12'),_0x4b29f1[_0x849f('0xf')],_0x20bea7);_0x1e4017(_0x189529[_0x849f('0xd')](0x1f4,_0x4b29f1[_0x849f('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3a5724){var _0x32be69=this;return new Promise(function(_0x15a41c,_0xe404c6){return db[_0x849f('0x13')][_0x849f('0x18')](_0x3a5724[_0x849f('0x14')],{'raw':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1a')]||null:null,'attributes':_0x3a5724['options']?_0x3a5724[_0x849f('0x15')]['attributes']||null:null,'limit':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1b')]||null:null})[_0x849f('0x16')](function(_0xf0e21f){logger[_0x849f('0x8')]('UpdateOpenchannelQueueReport',_0x3a5724);logger[_0x849f('0xb')](_0x849f('0x1c'),_0x3a5724,JSON[_0x849f('0x17')](_0xf0e21f));_0x15a41c(_0xf0e21f);})['catch'](function(_0x347c93){logger['error'](_0x849f('0x1c'),_0x347c93[_0x849f('0xf')],_0x3a5724);_0xe404c6(_0x32be69[_0x849f('0xd')](0x1f4,_0x347c93[_0x849f('0xf')]));});});}; \ No newline at end of file +var _0x14a0=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x14a0,0x8e));var _0x014a=function(_0x3aa753,_0x9337ad){_0x3aa753=_0x3aa753-0x0;var _0x4bc562=_0x14a0[_0x3aa753];return _0x4bc562;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x014a('0xa')](function(_0x109a9c){logger[_0x014a('0x12')](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x109a9c));_0x263b07(_0x109a9c);})[_0x014a('0x14')](function(_0x290b86){logger['error'](_0x014a('0x15'),_0x290b86['message'],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x290b86[_0x014a('0x11')]));});});};exports[_0x014a('0x1a')]=function(_0x36d52b){var _0x2b3c10=this;return new Promise(function(_0x113b12,_0x3fec9f){return db[_0x014a('0x16')][_0x014a('0x1b')](_0x36d52b['body'],{'raw':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options'][_0x014a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options']['where']||null:null,'attributes':_0x36d52b[_0x014a('0x19')]?_0x36d52b[_0x014a('0x19')][_0x014a('0x1d')]||null:null,'limit':_0x36d52b['options']?_0x36d52b[_0x014a('0x19')][_0x014a('0x1e')]||null:null})['then'](function(_0x31dc95){logger[_0x014a('0x12')]('UpdateOpenchannelQueueReport',_0x36d52b);logger['debug'](_0x014a('0x1a'),_0x36d52b,JSON[_0x014a('0xd')](_0x31dc95));_0x113b12(_0x31dc95);})[_0x014a('0x14')](function(_0x29fce5){logger['error'](_0x014a('0x1a'),_0x29fce5[_0x014a('0x11')],_0x36d52b);_0x3fec9f(_0x2b3c10[_0x014a('0xe')](0x1f4,_0x29fce5[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 50776ff..761c969 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 _0xbd08=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x423549,_0x242e63){var _0xdcb104=function(_0x6bff59){while(--_0x6bff59){_0x423549['push'](_0x423549['shift']());}};_0xdcb104(++_0x242e63);}(_0xbd08,0xea));var _0x8bd0=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xbd08[_0x2080a3];return _0x8d7d17;};'use strict';var multer=require(_0x8bd0('0x0'));var util=require(_0x8bd0('0x1'));var path=require('path');var timeout=require(_0x8bd0('0x2'));var express=require(_0x8bd0('0x3'));var router=express[_0x8bd0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bd0('0x5'));var config=require(_0x8bd0('0x6'));var controller=require(_0x8bd0('0x7'));router[_0x8bd0('0x8')]('/',auth[_0x8bd0('0x9')](),controller[_0x8bd0('0xa')]);router[_0x8bd0('0x8')](_0x8bd0('0xb'),auth[_0x8bd0('0x9')](),controller[_0x8bd0('0xc')]);router[_0x8bd0('0x8')](_0x8bd0('0xd'),auth[_0x8bd0('0x9')](),controller[_0x8bd0('0xe')]);router['post']('/',auth[_0x8bd0('0x9')](),controller[_0x8bd0('0xf')]);router[_0x8bd0('0x10')](_0x8bd0('0xd'),auth[_0x8bd0('0x9')](),controller[_0x8bd0('0x11')]);router['delete'](_0x8bd0('0xd'),auth[_0x8bd0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x78a3=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete'];(function(_0x30e003,_0xd117db){var _0x33c5b6=function(_0x4033fc){while(--_0x4033fc){_0x30e003['push'](_0x30e003['shift']());}};_0x33c5b6(++_0xd117db);}(_0x78a3,0x1cd));var _0x378a=function(_0x590381,_0x5c3948){_0x590381=_0x590381-0x0;var _0xe300df=_0x78a3[_0x590381];return _0xe300df;};'use strict';var multer=require(_0x378a('0x0'));var util=require(_0x378a('0x1'));var path=require(_0x378a('0x2'));var timeout=require(_0x378a('0x3'));var express=require(_0x378a('0x4'));var router=express[_0x378a('0x5')]();var fs_extra=require(_0x378a('0x6'));var auth=require(_0x378a('0x7'));var interaction=require(_0x378a('0x8'));var config=require(_0x378a('0x9'));var controller=require(_0x378a('0xa'));router[_0x378a('0xb')]('/',auth[_0x378a('0xc')](),controller[_0x378a('0xd')]);router['get'](_0x378a('0xe'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x378a('0xc')](),controller[_0x378a('0xf')]);router[_0x378a('0x10')]('/',auth[_0x378a('0xc')](),controller[_0x378a('0x11')]);router[_0x378a('0x12')](_0x378a('0x13'),auth[_0x378a('0xc')](),controller[_0x378a('0x14')]);router[_0x378a('0x15')](_0x378a('0x13'),auth[_0x378a('0xc')](),controller[_0x378a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 5e8f463..141ebb1 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x15c5b8,_0x3b670f){var _0xd45fe6=function(_0x15a775){while(--_0x15a775){_0x15c5b8['push'](_0x15c5b8['shift']());}};_0xd45fe6(++_0x3b670f);}(_0x54ef,0x112));var _0xf54e=function(_0x3ac5f5,_0x49b99f){_0x3ac5f5=_0x3ac5f5-0x0;var _0x192782=_0x54ef[_0x3ac5f5];return _0x192782;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x43a65b,_0xf6f770){var _0x201e50=function(_0x8a9718){while(--_0x8a9718){_0x43a65b['push'](_0x43a65b['shift']());}};_0x201e50(++_0xf6f770);}(_0x008c,0x188));var _0xc008=function(_0x2d16d8,_0x295ba2){_0x2d16d8=_0x2d16d8-0x0;var _0x40e2bf=_0x008c[_0x2d16d8];return _0x40e2bf;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 581f365..9e5e18b 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 _0x9856=['Content-Range','apply','reject','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','OpenchannelTransferReport','findAll','params','include','options','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set'];(function(_0x14febd,_0x40a5ec){var _0x1dc82e=function(_0x11c524){while(--_0x11c524){_0x14febd['push'](_0x14febd['shift']());}};_0x1dc82e(++_0x40a5ec);}(_0x9856,0xc7));var _0x6985=function(_0x1c1d63,_0x1d82b7){_0x1c1d63=_0x1c1d63-0x0;var _0x1e9eb4=_0x9856[_0x1c1d63];return _0x1e9eb4;};'use strict';var emlformat=require(_0x6985('0x0'));var rimraf=require(_0x6985('0x1'));var zipdir=require(_0x6985('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6985('0x3'));var moment=require(_0x6985('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6985('0x5'));var util=require(_0x6985('0x6'));var path=require(_0x6985('0x7'));var sox=require(_0x6985('0x8'));var csv=require(_0x6985('0x9'));var ejs=require(_0x6985('0xa'));var fs=require('fs');var fs_extra=require(_0x6985('0xb'));var _=require(_0x6985('0xc'));var squel=require(_0x6985('0xd'));var crypto=require('crypto');var jsforce=require(_0x6985('0xe'));var deskjs=require(_0x6985('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6985('0x10'));var Redis=require(_0x6985('0x11'));var authService=require(_0x6985('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6985('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6985('0x14'))(_0x6985('0x15'));var utils=require(_0x6985('0x16'));var config=require(_0x6985('0x17'));var licenseUtil=require(_0x6985('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9e6881,_0x462d78){_0x462d78=_0x462d78||0xcc;return function(_0x23e624){if(_0x23e624){return _0x9e6881['sendStatus'](_0x462d78);}return _0x9e6881[_0x6985('0x19')](_0x462d78)['end']();};}function respondWithResult(_0x110ac9,_0x466b82){_0x466b82=_0x466b82||0xc8;return function(_0x158d92){if(_0x158d92){return _0x110ac9[_0x6985('0x19')](_0x466b82)[_0x6985('0x1a')](_0x158d92);}};}function respondWithFilteredResult(_0x16d72a,_0x1682d9){return function(_0x591008){if(_0x591008){var _0x4697bc=typeof _0x1682d9[_0x6985('0x1b')]===_0x6985('0x1c')&&typeof _0x1682d9[_0x6985('0x1d')]===_0x6985('0x1c');var _0x1fc34c=_0x591008[_0x6985('0x1e')];var _0x538752=_0x4697bc?0x0:_0x1682d9[_0x6985('0x1b')];var _0x1604e5=_0x4697bc?_0x591008[_0x6985('0x1e')]:_0x1682d9[_0x6985('0x1b')]+_0x1682d9[_0x6985('0x1d')];var _0x30e2b4;if(_0x1604e5>=_0x1fc34c){_0x1604e5=_0x1fc34c;_0x30e2b4=0xc8;}else{_0x30e2b4=0xce;}_0x16d72a[_0x6985('0x19')](_0x30e2b4);return _0x16d72a[_0x6985('0x1f')](_0x6985('0x20'),_0x538752+'-'+_0x1604e5+'/'+_0x1fc34c)[_0x6985('0x1a')](_0x591008);}return null;};}function patchUpdates(_0x422fc8){return function(_0x3c80e2){try{jsonpatch[_0x6985('0x21')](_0x3c80e2,_0x422fc8,!![]);}catch(_0x145625){return BPromise[_0x6985('0x22')](_0x145625);}return _0x3c80e2['save']();};}function saveUpdates(_0x290d24,_0x1c2f5f){return function(_0x46b8e6){if(_0x46b8e6){return _0x46b8e6['update'](_0x290d24)[_0x6985('0x23')](function(_0x1804d5){return _0x1804d5;});}return null;};}function removeEntity(_0x5594e7,_0x489a0f){return function(_0x38c247){if(_0x38c247){return _0x38c247[_0x6985('0x24')]()[_0x6985('0x23')](function(){_0x5594e7[_0x6985('0x19')](0xcc)[_0x6985('0x25')]();});}};}function handleEntityNotFound(_0x1edeb8,_0x211b3f){return function(_0x36c8cd){if(!_0x36c8cd){_0x1edeb8[_0x6985('0x26')](0x194);}return _0x36c8cd;};}function handleError(_0x960e66,_0x553ab3){_0x553ab3=_0x553ab3||0x1f4;return function(_0x215892){logger[_0x6985('0x27')](_0x215892[_0x6985('0x28')]);if(_0x215892[_0x6985('0x29')]){delete _0x215892[_0x6985('0x29')];}_0x960e66[_0x6985('0x19')](_0x553ab3)[_0x6985('0x2a')](_0x215892);};}exports[_0x6985('0x2b')]=function(_0x2f8bf1,_0x1a2c50){var _0x45e895={},_0xd4195={},_0x329a76={'count':0x0,'rows':[]};var _0x536a46=_['map'](db['OpenchannelTransferReport'][_0x6985('0x2c')],function(_0x5a73b3){return{'name':_0x5a73b3['fieldName'],'type':_0x5a73b3['type'][_0x6985('0x2d')]};});_0xd4195[_0x6985('0x2e')]=_[_0x6985('0x2f')](_0x536a46,_0x6985('0x29'));_0xd4195[_0x6985('0x30')]=_[_0x6985('0x31')](_0x2f8bf1['query']);_0xd4195[_0x6985('0x32')]=_[_0x6985('0x33')](_0xd4195['model'],_0xd4195['query']);_0x45e895[_0x6985('0x34')]=_[_0x6985('0x33')](_0xd4195['model'],qs[_0x6985('0x35')](_0x2f8bf1['query'][_0x6985('0x35')]));_0x45e895[_0x6985('0x34')]=_0x45e895[_0x6985('0x34')][_0x6985('0x36')]?_0x45e895[_0x6985('0x34')]:_0xd4195['model'];if(!_0x2f8bf1[_0x6985('0x30')][_0x6985('0x37')](_0x6985('0x38'))){_0x45e895[_0x6985('0x1d')]=qs[_0x6985('0x1d')](_0x2f8bf1['query'][_0x6985('0x1d')]);_0x45e895[_0x6985('0x1b')]=qs[_0x6985('0x1b')](_0x2f8bf1[_0x6985('0x30')][_0x6985('0x1b')]);}_0x45e895[_0x6985('0x39')]=qs[_0x6985('0x3a')](_0x2f8bf1[_0x6985('0x30')][_0x6985('0x3a')]);_0x45e895[_0x6985('0x3b')]=qs['filters'](_[_0x6985('0x3c')](_0x2f8bf1[_0x6985('0x30')],_0xd4195[_0x6985('0x32')]),_0x536a46);if(_0x2f8bf1[_0x6985('0x30')][_0x6985('0x3d')]){_0x45e895[_0x6985('0x3b')]=_[_0x6985('0x3e')](_0x45e895[_0x6985('0x3b')],{'$or':_['map'](_0x536a46,function(_0x388312){if(_0x388312[_0x6985('0x3f')]!==_0x6985('0x40')){var _0xf54f8e={};_0xf54f8e[_0x388312[_0x6985('0x29')]]={'$like':'%'+_0x2f8bf1['query']['filter']+'%'};return _0xf54f8e;}})});}_0x45e895=_['merge']({},_0x45e895,_0x2f8bf1['options']);var _0xe8d56d={'where':_0x45e895[_0x6985('0x3b')]};return db['OpenchannelTransferReport']['count'](_0xe8d56d)[_0x6985('0x23')](function(_0x31f46c){_0x329a76[_0x6985('0x1e')]=_0x31f46c;if(_0x2f8bf1['query'][_0x6985('0x41')]){_0x45e895['include']=[{'all':!![]}];}return db[_0x6985('0x42')][_0x6985('0x43')](_0x45e895);})['then'](function(_0x115058){_0x329a76['rows']=_0x115058;return _0x329a76;})[_0x6985('0x23')](respondWithFilteredResult(_0x1a2c50,_0x45e895))['catch'](handleError(_0x1a2c50,null));};exports['show']=function(_0x441a6f,_0x43d660){var _0xaca0b2={'raw':!![],'where':{'id':_0x441a6f[_0x6985('0x44')]['id']}},_0x222f3f={};_0x222f3f[_0x6985('0x2e')]=_[_0x6985('0x31')](db['OpenchannelTransferReport'][_0x6985('0x2c')]);_0x222f3f[_0x6985('0x30')]=_[_0x6985('0x31')](_0x441a6f[_0x6985('0x30')]);_0x222f3f['filters']=_['intersection'](_0x222f3f[_0x6985('0x2e')],_0x222f3f[_0x6985('0x30')]);_0xaca0b2[_0x6985('0x34')]=_[_0x6985('0x33')](_0x222f3f[_0x6985('0x2e')],qs[_0x6985('0x35')](_0x441a6f[_0x6985('0x30')][_0x6985('0x35')]));_0xaca0b2[_0x6985('0x34')]=_0xaca0b2[_0x6985('0x34')]['length']?_0xaca0b2[_0x6985('0x34')]:_0x222f3f[_0x6985('0x2e')];if(_0x441a6f[_0x6985('0x30')][_0x6985('0x41')]){_0xaca0b2[_0x6985('0x45')]=[{'all':!![]}];}_0xaca0b2=_[_0x6985('0x3e')]({},_0xaca0b2,_0x441a6f[_0x6985('0x46')]);return db[_0x6985('0x42')][_0x6985('0x47')](_0xaca0b2)[_0x6985('0x23')](handleEntityNotFound(_0x43d660,null))['then'](respondWithResult(_0x43d660,null))[_0x6985('0x48')](handleError(_0x43d660,null));};exports['create']=function(_0x4e1582,_0x184314){return db[_0x6985('0x42')][_0x6985('0x49')](_0x4e1582['body'],{})[_0x6985('0x23')](respondWithResult(_0x184314,0xc9))[_0x6985('0x48')](handleError(_0x184314,null));};exports[_0x6985('0x4a')]=function(_0x173fff,_0x26ea30){if(_0x173fff[_0x6985('0x4b')]['id']){delete _0x173fff[_0x6985('0x4b')]['id'];}return db[_0x6985('0x42')][_0x6985('0x47')]({'where':{'id':_0x173fff[_0x6985('0x44')]['id']}})[_0x6985('0x23')](handleEntityNotFound(_0x26ea30,null))[_0x6985('0x23')](saveUpdates(_0x173fff['body'],null))[_0x6985('0x23')](respondWithResult(_0x26ea30,null))['catch'](handleError(_0x26ea30,null));};exports[_0x6985('0x24')]=function(_0x4583b0,_0x39eb65){return db[_0x6985('0x42')][_0x6985('0x47')]({'where':{'id':_0x4583b0[_0x6985('0x44')]['id']}})[_0x6985('0x23')](handleEntityNotFound(_0x39eb65,null))[_0x6985('0x23')](removeEntity(_0x39eb65,null))[_0x6985('0x48')](handleError(_0x39eb65,null));};exports[_0x6985('0x4c')]=function(_0x12b1fe,_0x361e21){return db[_0x6985('0x42')][_0x6985('0x4c')]()[_0x6985('0x23')](respondWithResult(_0x361e21,null))['catch'](handleError(_0x361e21,null));}; \ No newline at end of file +var _0x2491=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelTransferReport','include','rows','catch','show','params','find','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes'];(function(_0x7a47ae,_0x3fcc5e){var _0x303d64=function(_0x13c8ee){while(--_0x13c8ee){_0x7a47ae['push'](_0x7a47ae['shift']());}};_0x303d64(++_0x3fcc5e);}(_0x2491,0x1ca));var _0x1249=function(_0x5eac88,_0x3355c7){_0x5eac88=_0x5eac88-0x0;var _0x41701f=_0x2491[_0x5eac88];return _0x41701f;};'use strict';var emlformat=require(_0x1249('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1249('0x1'));var rp=require(_0x1249('0x2'));var moment=require(_0x1249('0x3'));var BPromise=require(_0x1249('0x4'));var Mustache=require(_0x1249('0x5'));var util=require(_0x1249('0x6'));var path=require(_0x1249('0x7'));var sox=require(_0x1249('0x8'));var csv=require(_0x1249('0x9'));var ejs=require(_0x1249('0xa'));var fs=require('fs');var fs_extra=require(_0x1249('0xb'));var _=require('lodash');var squel=require(_0x1249('0xc'));var crypto=require(_0x1249('0xd'));var jsforce=require(_0x1249('0xe'));var deskjs=require(_0x1249('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1249('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1249('0x11'));var qs=require(_0x1249('0x12'));var as=require(_0x1249('0x13'));var hardwareService=require(_0x1249('0x14'));var logger=require(_0x1249('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1249('0x16'));var licenseUtil=require(_0x1249('0x17'));var db=require(_0x1249('0x18'))['db'];function respondWithStatusCode(_0x1bde2b,_0x56f3ca){_0x56f3ca=_0x56f3ca||0xcc;return function(_0x54c4b8){if(_0x54c4b8){return _0x1bde2b[_0x1249('0x19')](_0x56f3ca);}return _0x1bde2b[_0x1249('0x1a')](_0x56f3ca)[_0x1249('0x1b')]();};}function respondWithResult(_0x107e65,_0x2f2766){_0x2f2766=_0x2f2766||0xc8;return function(_0x194871){if(_0x194871){return _0x107e65[_0x1249('0x1a')](_0x2f2766)[_0x1249('0x1c')](_0x194871);}};}function respondWithFilteredResult(_0x1fa86b,_0x503dee){return function(_0x53cab3){if(_0x53cab3){var _0x400c40=typeof _0x503dee['offset']===_0x1249('0x1d')&&typeof _0x503dee[_0x1249('0x1e')]===_0x1249('0x1d');var _0xd49acd=_0x53cab3[_0x1249('0x1f')];var _0x5158d1=_0x400c40?0x0:_0x503dee[_0x1249('0x20')];var _0x3ff1aa=_0x400c40?_0x53cab3[_0x1249('0x1f')]:_0x503dee[_0x1249('0x20')]+_0x503dee[_0x1249('0x1e')];var _0x17605f;if(_0x3ff1aa>=_0xd49acd){_0x3ff1aa=_0xd49acd;_0x17605f=0xc8;}else{_0x17605f=0xce;}_0x1fa86b[_0x1249('0x1a')](_0x17605f);return _0x1fa86b['set'](_0x1249('0x21'),_0x5158d1+'-'+_0x3ff1aa+'/'+_0xd49acd)['json'](_0x53cab3);}return null;};}function patchUpdates(_0x6d5e05){return function(_0x4b5f72){try{jsonpatch[_0x1249('0x22')](_0x4b5f72,_0x6d5e05,!![]);}catch(_0x57885a){return BPromise['reject'](_0x57885a);}return _0x4b5f72['save']();};}function saveUpdates(_0x50c8fe,_0x65eb53){return function(_0x5b4b40){if(_0x5b4b40){return _0x5b4b40[_0x1249('0x23')](_0x50c8fe)['then'](function(_0x47f97c){return _0x47f97c;});}return null;};}function removeEntity(_0x544b24,_0x18aae9){return function(_0x4d51eb){if(_0x4d51eb){return _0x4d51eb[_0x1249('0x24')]()[_0x1249('0x25')](function(){_0x544b24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x502fa9,_0x30ffe8){return function(_0x46e1d4){if(!_0x46e1d4){_0x502fa9['sendStatus'](0x194);}return _0x46e1d4;};}function handleError(_0x35083b,_0x1b3f93){_0x1b3f93=_0x1b3f93||0x1f4;return function(_0x579cbc){logger[_0x1249('0x26')](_0x579cbc[_0x1249('0x27')]);if(_0x579cbc[_0x1249('0x28')]){delete _0x579cbc['name'];}_0x35083b[_0x1249('0x1a')](_0x1b3f93)['send'](_0x579cbc);};}exports[_0x1249('0x29')]=function(_0x254dcb,_0x3000da){var _0x48cfff={},_0x51e933={},_0x5ac0b4={'count':0x0,'rows':[]};var _0x3fda98=_[_0x1249('0x2a')](db['OpenchannelTransferReport'][_0x1249('0x2b')],function(_0xd9f2d0){return{'name':_0xd9f2d0[_0x1249('0x2c')],'type':_0xd9f2d0[_0x1249('0x2d')][_0x1249('0x2e')]};});_0x51e933[_0x1249('0x2f')]=_[_0x1249('0x2a')](_0x3fda98,_0x1249('0x28'));_0x51e933['query']=_[_0x1249('0x30')](_0x254dcb['query']);_0x51e933[_0x1249('0x31')]=_[_0x1249('0x32')](_0x51e933[_0x1249('0x2f')],_0x51e933[_0x1249('0x33')]);_0x48cfff[_0x1249('0x34')]=_['intersection'](_0x51e933[_0x1249('0x2f')],qs[_0x1249('0x35')](_0x254dcb[_0x1249('0x33')][_0x1249('0x35')]));_0x48cfff[_0x1249('0x34')]=_0x48cfff[_0x1249('0x34')][_0x1249('0x36')]?_0x48cfff[_0x1249('0x34')]:_0x51e933[_0x1249('0x2f')];if(!_0x254dcb[_0x1249('0x33')][_0x1249('0x37')](_0x1249('0x38'))){_0x48cfff[_0x1249('0x1e')]=qs[_0x1249('0x1e')](_0x254dcb[_0x1249('0x33')][_0x1249('0x1e')]);_0x48cfff[_0x1249('0x20')]=qs[_0x1249('0x20')](_0x254dcb[_0x1249('0x33')][_0x1249('0x20')]);}_0x48cfff[_0x1249('0x39')]=qs[_0x1249('0x3a')](_0x254dcb[_0x1249('0x33')][_0x1249('0x3a')]);_0x48cfff[_0x1249('0x3b')]=qs['filters'](_[_0x1249('0x3c')](_0x254dcb['query'],_0x51e933[_0x1249('0x31')]),_0x3fda98);if(_0x254dcb['query'][_0x1249('0x3d')]){_0x48cfff[_0x1249('0x3b')]=_[_0x1249('0x3e')](_0x48cfff[_0x1249('0x3b')],{'$or':_[_0x1249('0x2a')](_0x3fda98,function(_0x1b291d){if(_0x1b291d['type']!=='VIRTUAL'){var _0xfd50a6={};_0xfd50a6[_0x1b291d[_0x1249('0x28')]]={'$like':'%'+_0x254dcb[_0x1249('0x33')]['filter']+'%'};return _0xfd50a6;}})});}_0x48cfff=_[_0x1249('0x3e')]({},_0x48cfff,_0x254dcb[_0x1249('0x3f')]);var _0x11c173={'where':_0x48cfff[_0x1249('0x3b')]};return db[_0x1249('0x40')][_0x1249('0x1f')](_0x11c173)['then'](function(_0x1cfd3a){_0x5ac0b4['count']=_0x1cfd3a;if(_0x254dcb['query']['includeAll']){_0x48cfff[_0x1249('0x41')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x48cfff);})[_0x1249('0x25')](function(_0x2a7f67){_0x5ac0b4[_0x1249('0x42')]=_0x2a7f67;return _0x5ac0b4;})['then'](respondWithFilteredResult(_0x3000da,_0x48cfff))[_0x1249('0x43')](handleError(_0x3000da,null));};exports[_0x1249('0x44')]=function(_0x7cd0e4,_0x5ea315){var _0x3e4bf7={'raw':!![],'where':{'id':_0x7cd0e4[_0x1249('0x45')]['id']}},_0x2fee69={};_0x2fee69['model']=_['keys'](db[_0x1249('0x40')][_0x1249('0x2b')]);_0x2fee69['query']=_['keys'](_0x7cd0e4[_0x1249('0x33')]);_0x2fee69[_0x1249('0x31')]=_[_0x1249('0x32')](_0x2fee69[_0x1249('0x2f')],_0x2fee69[_0x1249('0x33')]);_0x3e4bf7['attributes']=_[_0x1249('0x32')](_0x2fee69[_0x1249('0x2f')],qs[_0x1249('0x35')](_0x7cd0e4['query']['fields']));_0x3e4bf7[_0x1249('0x34')]=_0x3e4bf7['attributes'][_0x1249('0x36')]?_0x3e4bf7[_0x1249('0x34')]:_0x2fee69[_0x1249('0x2f')];if(_0x7cd0e4[_0x1249('0x33')]['includeAll']){_0x3e4bf7['include']=[{'all':!![]}];}_0x3e4bf7=_[_0x1249('0x3e')]({},_0x3e4bf7,_0x7cd0e4[_0x1249('0x3f')]);return db[_0x1249('0x40')][_0x1249('0x46')](_0x3e4bf7)[_0x1249('0x25')](handleEntityNotFound(_0x5ea315,null))[_0x1249('0x25')](respondWithResult(_0x5ea315,null))[_0x1249('0x43')](handleError(_0x5ea315,null));};exports['create']=function(_0x1a1d3f,_0x5d3c2f){return db[_0x1249('0x40')]['create'](_0x1a1d3f['body'],{})[_0x1249('0x25')](respondWithResult(_0x5d3c2f,0xc9))[_0x1249('0x43')](handleError(_0x5d3c2f,null));};exports[_0x1249('0x23')]=function(_0x511201,_0x49ab82){if(_0x511201['body']['id']){delete _0x511201['body']['id'];}return db[_0x1249('0x40')][_0x1249('0x46')]({'where':{'id':_0x511201[_0x1249('0x45')]['id']}})['then'](handleEntityNotFound(_0x49ab82,null))[_0x1249('0x25')](saveUpdates(_0x511201[_0x1249('0x47')],null))[_0x1249('0x25')](respondWithResult(_0x49ab82,null))[_0x1249('0x43')](handleError(_0x49ab82,null));};exports[_0x1249('0x24')]=function(_0x23ac88,_0x2d458f){return db[_0x1249('0x40')]['find']({'where':{'id':_0x23ac88[_0x1249('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d458f,null))['then'](removeEntity(_0x2d458f,null))[_0x1249('0x43')](handleError(_0x2d458f,null));};exports[_0x1249('0x48')]=function(_0x1ce613,_0x25fba4){return db[_0x1249('0x40')][_0x1249('0x48')]()[_0x1249('0x25')](respondWithResult(_0x25fba4,null))[_0x1249('0x43')](handleError(_0x25fba4,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 603a9c6..0b93952 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 _0x5be9=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x189b20,_0x4ef2e7){var _0x491140=function(_0x57ee5a){while(--_0x57ee5a){_0x189b20['push'](_0x189b20['shift']());}};_0x491140(++_0x4ef2e7);}(_0x5be9,0x13e));var _0x95be=function(_0x37e863,_0xf62299){_0x37e863=_0x37e863-0x0;var _0x8393f5=_0x5be9[_0x37e863];return _0x8393f5;};'use strict';var _=require(_0x95be('0x0'));var util=require(_0x95be('0x1'));var logger=require(_0x95be('0x2'))(_0x95be('0x3'));var moment=require('moment');var BPromise=require(_0x95be('0x4'));var rp=require(_0x95be('0x5'));var fs=require('fs');var path=require(_0x95be('0x6'));var rimraf=require(_0x95be('0x7'));var config=require(_0x95be('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x95be('0x9')]=function(_0x41ab2e,_0x3168eb){return _0x41ab2e[_0x95be('0xa')](_0x95be('0xb'),attributes,{'tableName':_0x95be('0xc'),'paranoid':![],'indexes':[{'name':_0x95be('0xd'),'fields':[_0x95be('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b6e=['api','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid'];(function(_0x587579,_0x3b4582){var _0x5e5151=function(_0x4ef5db){while(--_0x4ef5db){_0x587579['push'](_0x587579['shift']());}};_0x5e5151(++_0x3b4582);}(_0x8b6e,0x1c8));var _0xe8b6=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0x8b6e[_0x237f8b];return _0x423f94;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe8b6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8b6('0x1'));var rimraf=require('rimraf');var config=require(_0xe8b6('0x2'));var attributes=require(_0xe8b6('0x3'));module[_0xe8b6('0x4')]=function(_0x2e90de,_0x1583e1){return _0x2e90de[_0xe8b6('0x5')]('OpenchannelTransferReport',attributes,{'tableName':_0xe8b6('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe8b6('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index e76e98a..6a57152 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 _0x291c=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','code'];(function(_0x2b0126,_0x542c8d){var _0x5bd6ad=function(_0xe82a77){while(--_0xe82a77){_0x2b0126['push'](_0x2b0126['shift']());}};_0x5bd6ad(++_0x542c8d);}(_0x291c,0x137));var _0xc291=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x291c[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var moment=require(_0xc291('0x2'));var BPromise=require(_0xc291('0x3'));var rs=require(_0xc291('0x4'));var fs=require('fs');var Redis=require(_0xc291('0x5'));var db=require(_0xc291('0x6'))['db'];var utils=require(_0xc291('0x7'));var logger=require(_0xc291('0x8'))(_0xc291('0x9'));var config=require(_0xc291('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc291('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a7459,_0x40dc89,_0x2d3526){return new BPromise(function(_0x42a6ac,_0x26e775){return client['request'](_0x5a7459,_0x2d3526)[_0xc291('0xc')](function(_0x2beb3b){logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));logger[_0xc291('0x10')](_0xc291('0x11'),_0x40dc89,_0xc291('0xf'),JSON['stringify'](_0x2beb3b));if(_0x2beb3b['error']){if(_0x2beb3b['error'][_0xc291('0x12')]===0x1f4){logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b['error'][_0xc291('0x14')]);return _0x26e775(_0x2beb3b['error'][_0xc291('0x14')]);}logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);return _0x42a6ac(_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);}else{logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));_0x42a6ac(_0x2beb3b['result'][_0xc291('0x14')]);}})[_0xc291('0x15')](function(_0x5888de){logger[_0xc291('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x40dc89,_0x5888de);_0x26e775(_0x5888de);});});} \ No newline at end of file +var _0x5b20=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2bad07,_0x1ee0dc){var _0x1ad478=function(_0x29de6e){while(--_0x29de6e){_0x2bad07['push'](_0x2bad07['shift']());}};_0x1ad478(++_0x1ee0dc);}(_0x5b20,0x86));var _0x05b2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5b20[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var moment=require(_0x05b2('0x2'));var BPromise=require(_0x05b2('0x3'));var rs=require(_0x05b2('0x4'));var fs=require('fs');var Redis=require(_0x05b2('0x5'));var db=require(_0x05b2('0x6'))['db'];var utils=require(_0x05b2('0x7'));var logger=require(_0x05b2('0x8'))(_0x05b2('0x9'));var config=require(_0x05b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x05b2('0xb')][_0x05b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x541855,_0x24f11f,_0x43cd94){return new BPromise(function(_0x3be69a,_0x1b66e4){return client[_0x05b2('0xd')](_0x541855,_0x43cd94)[_0x05b2('0xe')](function(_0xfe6680){logger[_0x05b2('0xf')](_0x05b2('0x10'),_0x24f11f,_0x05b2('0x11'));logger[_0x05b2('0x12')](_0x05b2('0x13'),_0x24f11f,_0x05b2('0x11'),JSON[_0x05b2('0x14')](_0xfe6680));if(_0xfe6680[_0x05b2('0x15')]){if(_0xfe6680[_0x05b2('0x15')]['code']===0x1f4){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);return _0x1b66e4(_0xfe6680['error'][_0x05b2('0x16')]);}logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680['error']['message']);return _0x3be69a(_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x24f11f,_0x05b2('0x11'));_0x3be69a(_0xfe6680[_0x05b2('0x17')][_0x05b2('0x16')]);}})[_0x05b2('0x18')](function(_0x234843){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0x234843);_0x1b66e4(_0x234843);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 45ec937..a5a6aa9 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 _0x5e0e=['../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5e0e,0x19c));var _0xe5e0=function(_0x456919,_0x4c175d){_0x456919=_0x456919-0x0;var _0x41a512=_0x5e0e[_0x456919];return _0x41a512;};'use strict';var multer=require('multer');var util=require(_0xe5e0('0x0'));var path=require(_0xe5e0('0x1'));var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express[_0xe5e0('0x4')]();var fs_extra=require(_0xe5e0('0x5'));var auth=require(_0xe5e0('0x6'));var interaction=require(_0xe5e0('0x7'));var config=require(_0xe5e0('0x8'));var controller=require(_0xe5e0('0x9'));router[_0xe5e0('0xa')]('/',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0xc')]);router[_0xe5e0('0xa')](_0xe5e0('0xd'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0xe')]);router[_0xe5e0('0xf')]('/',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x10')]);router[_0xe5e0('0x11')](_0xe5e0('0xd'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x12')]);router[_0xe5e0('0x13')]('/:id',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc13e=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','/:id','update'];(function(_0x45587b,_0x28dae2){var _0x5bb3f0=function(_0x214a28){while(--_0x214a28){_0x45587b['push'](_0x45587b['shift']());}};_0x5bb3f0(++_0x28dae2);}(_0xc13e,0xa1));var _0xec13=function(_0x552a68,_0xb3cb5){_0x552a68=_0x552a68-0x0;var _0x1c8b8e=_0xc13e[_0x552a68];return _0x1c8b8e;};'use strict';var multer=require(_0xec13('0x0'));var util=require(_0xec13('0x1'));var path=require(_0xec13('0x2'));var timeout=require(_0xec13('0x3'));var express=require(_0xec13('0x4'));var router=express[_0xec13('0x5')]();var fs_extra=require(_0xec13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xec13('0x7'));var config=require(_0xec13('0x8'));var controller=require('./pause.controller');router[_0xec13('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xec13('0x9')]('/:id',auth[_0xec13('0xa')](),controller['show']);router[_0xec13('0xb')]('/',auth[_0xec13('0xa')](),controller[_0xec13('0xc')]);router['put'](_0xec13('0xd'),auth[_0xec13('0xa')](),controller[_0xec13('0xe')]);router[_0xec13('0xf')](_0xec13('0xd'),auth[_0xec13('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index afcd7f4..9f12893 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 _0x19ab=['sequelize','name'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x19ab,0x112));var _0xb19a=function(_0x5626bc,_0x20a82f){_0x5626bc=_0x5626bc-0x0;var _0x28d037=_0x19ab[_0x5626bc];return _0x28d037;};'use strict';var Sequelize=require(_0xb19a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb19a('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7927=['exports','STRING','name','sequelize'];(function(_0x1d8858,_0x528434){var _0x5ea3d4=function(_0x2351a9){while(--_0x2351a9){_0x1d8858['push'](_0x1d8858['shift']());}};_0x5ea3d4(++_0x528434);}(_0x7927,0x7f));var _0x7792=function(_0x34cc9a,_0xed9a16){_0x34cc9a=_0x34cc9a-0x0;var _0x2ff3c2=_0x7927[_0x34cc9a];return _0x2ff3c2;};'use strict';var Sequelize=require(_0x7792('0x0'));module[_0x7792('0x1')]={'name':{'type':Sequelize[_0x7792('0x2')],'unique':_0x7792('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 b8b0ae0..8d62d59 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 _0x80a0=['fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','Pauses','UserProfileResource','error','name','send','index','map','Pause','rawAttributes'];(function(_0x3a595a,_0x2f2d64){var _0x4721e2=function(_0x1aff1e){while(--_0x1aff1e){_0x3a595a['push'](_0x3a595a['shift']());}};_0x4721e2(++_0x2f2d64);}(_0x80a0,0x77));var _0x080a=function(_0x3da733,_0x22aac9){_0x3da733=_0x3da733-0x0;var _0x136d5b=_0x80a0[_0x3da733];return _0x136d5b;};'use strict';var emlformat=require(_0x080a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x080a('0x1'));var jsonpatch=require(_0x080a('0x2'));var rp=require('request-promise');var moment=require(_0x080a('0x3'));var BPromise=require(_0x080a('0x4'));var Mustache=require(_0x080a('0x5'));var util=require(_0x080a('0x6'));var path=require(_0x080a('0x7'));var sox=require('sox');var csv=require(_0x080a('0x8'));var ejs=require(_0x080a('0x9'));var fs=require('fs');var fs_extra=require(_0x080a('0xa'));var _=require(_0x080a('0xb'));var squel=require(_0x080a('0xc'));var crypto=require(_0x080a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x080a('0x8'));var querystring=require(_0x080a('0xe'));var Papa=require(_0x080a('0xf'));var Redis=require(_0x080a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x080a('0x11'));var as=require(_0x080a('0x12'));var hardwareService=require(_0x080a('0x13'));var logger=require(_0x080a('0x14'))(_0x080a('0x15'));var utils=require(_0x080a('0x16'));var config=require(_0x080a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x080a('0x18'))['db'];function respondWithStatusCode(_0x26496e,_0x329cfe){_0x329cfe=_0x329cfe||0xcc;return function(_0x5cd47e){if(_0x5cd47e){return _0x26496e[_0x080a('0x19')](_0x329cfe);}return _0x26496e[_0x080a('0x1a')](_0x329cfe)[_0x080a('0x1b')]();};}function respondWithResult(_0x32a77f,_0x29d711){_0x29d711=_0x29d711||0xc8;return function(_0x2bf9e8){if(_0x2bf9e8){return _0x32a77f[_0x080a('0x1a')](_0x29d711)[_0x080a('0x1c')](_0x2bf9e8);}};}function respondWithFilteredResult(_0x4ecfdf,_0x20cc98){return function(_0x273c53){if(_0x273c53){var _0x2c89d7=typeof _0x20cc98['offset']===_0x080a('0x1d')&&typeof _0x20cc98['limit']==='undefined';var _0x19ebfd=_0x273c53[_0x080a('0x1e')];var _0x11f085=_0x2c89d7?0x0:_0x20cc98['offset'];var _0x39d787=_0x2c89d7?_0x273c53[_0x080a('0x1e')]:_0x20cc98[_0x080a('0x1f')]+_0x20cc98[_0x080a('0x20')];var _0x3cef5a;if(_0x39d787>=_0x19ebfd){_0x39d787=_0x19ebfd;_0x3cef5a=0xc8;}else{_0x3cef5a=0xce;}_0x4ecfdf[_0x080a('0x1a')](_0x3cef5a);return _0x4ecfdf[_0x080a('0x21')](_0x080a('0x22'),_0x11f085+'-'+_0x39d787+'/'+_0x19ebfd)[_0x080a('0x1c')](_0x273c53);}return null;};}function patchUpdates(_0x57d9b8){return function(_0x3328fd){try{jsonpatch['apply'](_0x3328fd,_0x57d9b8,!![]);}catch(_0x8022b4){return BPromise[_0x080a('0x23')](_0x8022b4);}return _0x3328fd[_0x080a('0x24')]();};}function saveUpdates(_0x58659a,_0x5f327){return function(_0x4dd797){if(_0x4dd797){return _0x4dd797['update'](_0x58659a)[_0x080a('0x25')](function(_0x18235c){return _0x18235c;});}return null;};}function removeEntity(_0x3061a1,_0x345386){return function(_0x40281b){if(_0x40281b){return _0x40281b[_0x080a('0x26')]()[_0x080a('0x25')](function(){var _0x4655dd=_0x40281b[_0x080a('0x27')]({'plain':!![]});var _0x4bc4dc=_0x080a('0x28');return db[_0x080a('0x29')][_0x080a('0x26')]({'where':{'type':_0x4bc4dc,'resourceId':_0x4655dd['id']}})[_0x080a('0x25')](function(){return _0x40281b;});})[_0x080a('0x25')](function(){_0x3061a1[_0x080a('0x1a')](0xcc)[_0x080a('0x1b')]();});}};}function handleEntityNotFound(_0xbe178f,_0xf72d74){return function(_0xc5fad7){if(!_0xc5fad7){_0xbe178f[_0x080a('0x19')](0x194);}return _0xc5fad7;};}function handleError(_0x19746c,_0x5da6f5){_0x5da6f5=_0x5da6f5||0x1f4;return function(_0xdb8b18){logger[_0x080a('0x2a')](_0xdb8b18['stack']);if(_0xdb8b18[_0x080a('0x2b')]){delete _0xdb8b18[_0x080a('0x2b')];}_0x19746c[_0x080a('0x1a')](_0x5da6f5)[_0x080a('0x2c')](_0xdb8b18);};}exports[_0x080a('0x2d')]=function(_0x2f76ab,_0x5dd6fb){var _0x23af59={},_0x11c818={},_0x2c84b7={'count':0x0,'rows':[]};var _0x244761=_[_0x080a('0x2e')](db[_0x080a('0x2f')][_0x080a('0x30')],function(_0x59859b){return{'name':_0x59859b[_0x080a('0x31')],'type':_0x59859b[_0x080a('0x32')][_0x080a('0x33')]};});_0x11c818[_0x080a('0x34')]=_['map'](_0x244761,'name');_0x11c818[_0x080a('0x35')]=_[_0x080a('0x36')](_0x2f76ab[_0x080a('0x35')]);_0x11c818['filters']=_['intersection'](_0x11c818['model'],_0x11c818[_0x080a('0x35')]);_0x23af59[_0x080a('0x37')]=_[_0x080a('0x38')](_0x11c818[_0x080a('0x34')],qs[_0x080a('0x39')](_0x2f76ab[_0x080a('0x35')]['fields']));_0x23af59[_0x080a('0x37')]=_0x23af59[_0x080a('0x37')][_0x080a('0x3a')]?_0x23af59[_0x080a('0x37')]:_0x11c818[_0x080a('0x34')];if(!_0x2f76ab['query'][_0x080a('0x3b')](_0x080a('0x3c'))){_0x23af59[_0x080a('0x20')]=qs[_0x080a('0x20')](_0x2f76ab['query'][_0x080a('0x20')]);_0x23af59[_0x080a('0x1f')]=qs['offset'](_0x2f76ab[_0x080a('0x35')][_0x080a('0x1f')]);}_0x23af59[_0x080a('0x3d')]=qs[_0x080a('0x3e')](_0x2f76ab[_0x080a('0x35')]['sort']);_0x23af59[_0x080a('0x3f')]=qs[_0x080a('0x40')](_[_0x080a('0x41')](_0x2f76ab[_0x080a('0x35')],_0x11c818[_0x080a('0x40')]),_0x244761);if(_0x2f76ab[_0x080a('0x35')][_0x080a('0x42')]){_0x23af59[_0x080a('0x3f')]=_[_0x080a('0x43')](_0x23af59['where'],{'$or':_[_0x080a('0x2e')](_0x244761,function(_0x416c85){if(_0x416c85[_0x080a('0x32')]!==_0x080a('0x44')){var _0x59d2ca={};_0x59d2ca[_0x416c85[_0x080a('0x2b')]]={'$like':'%'+_0x2f76ab[_0x080a('0x35')][_0x080a('0x42')]+'%'};return _0x59d2ca;}})});}_0x23af59=_[_0x080a('0x43')]({},_0x23af59,_0x2f76ab[_0x080a('0x45')]);var _0x2dc77={'where':_0x23af59[_0x080a('0x3f')]};return db[_0x080a('0x2f')][_0x080a('0x1e')](_0x2dc77)[_0x080a('0x25')](function(_0x471331){_0x2c84b7[_0x080a('0x1e')]=_0x471331;if(_0x2f76ab[_0x080a('0x35')][_0x080a('0x46')]){_0x23af59[_0x080a('0x47')]=[{'all':!![]}];}return db[_0x080a('0x2f')][_0x080a('0x48')](_0x23af59);})['then'](function(_0x3dda38){_0x2c84b7[_0x080a('0x49')]=_0x3dda38;return _0x2c84b7;})[_0x080a('0x25')](respondWithFilteredResult(_0x5dd6fb,_0x23af59))['catch'](handleError(_0x5dd6fb,null));};exports['show']=function(_0x411afa,_0x520346){var _0x417a39={'raw':!![],'where':{'id':_0x411afa['params']['id']}},_0x208c70={};_0x208c70[_0x080a('0x34')]=_[_0x080a('0x36')](db[_0x080a('0x2f')][_0x080a('0x30')]);_0x208c70[_0x080a('0x35')]=_[_0x080a('0x36')](_0x411afa[_0x080a('0x35')]);_0x208c70[_0x080a('0x40')]=_[_0x080a('0x38')](_0x208c70[_0x080a('0x34')],_0x208c70['query']);_0x417a39[_0x080a('0x37')]=_[_0x080a('0x38')](_0x208c70[_0x080a('0x34')],qs[_0x080a('0x39')](_0x411afa['query'][_0x080a('0x39')]));_0x417a39['attributes']=_0x417a39[_0x080a('0x37')]['length']?_0x417a39[_0x080a('0x37')]:_0x208c70['model'];if(_0x411afa[_0x080a('0x35')][_0x080a('0x46')]){_0x417a39[_0x080a('0x47')]=[{'all':!![]}];}_0x417a39=_[_0x080a('0x43')]({},_0x417a39,_0x411afa[_0x080a('0x45')]);return db[_0x080a('0x2f')][_0x080a('0x4a')](_0x417a39)[_0x080a('0x25')](handleEntityNotFound(_0x520346,null))[_0x080a('0x25')](respondWithResult(_0x520346,null))['catch'](handleError(_0x520346,null));};exports[_0x080a('0x4b')]=function(_0x4f8be0,_0x1f6636){return db[_0x080a('0x2f')][_0x080a('0x4b')](_0x4f8be0[_0x080a('0x4c')],{})['then'](function(_0x3b488a){var _0x26c20b=_0x4f8be0[_0x080a('0x4d')]['get']({'plain':!![]});if(!_0x26c20b)throw new Error(_0x080a('0x4e'));if(_0x26c20b['role']==='user'){var _0x12d35f=_0x3b488a[_0x080a('0x27')]({'plain':!![]});var _0x3b44a3='Pauses';return db['UserProfileSection'][_0x080a('0x4a')]({'where':{'name':_0x3b44a3,'userProfileId':_0x26c20b[_0x080a('0x4f')]},'raw':!![]})[_0x080a('0x25')](function(_0x2f7f06){if(_0x2f7f06&&_0x2f7f06[_0x080a('0x50')]===0x0){return db[_0x080a('0x29')][_0x080a('0x4b')]({'name':_0x12d35f[_0x080a('0x2b')],'resourceId':_0x12d35f['id'],'type':_0x2f7f06['name'],'sectionId':_0x2f7f06['id']},{})[_0x080a('0x25')](function(){return _0x3b488a;});}else{return _0x3b488a;}})[_0x080a('0x51')](function(_0x3a95f7){logger['error'](_0x080a('0x52'),_0x3a95f7);throw _0x3a95f7;});}return _0x3b488a;})[_0x080a('0x25')](respondWithResult(_0x1f6636,0xc9))[_0x080a('0x51')](handleError(_0x1f6636,null));};exports['update']=function(_0x533eb8,_0x1aa553){if(_0x533eb8[_0x080a('0x4c')]['id']){delete _0x533eb8[_0x080a('0x4c')]['id'];}return db['Pause'][_0x080a('0x4a')]({'where':{'id':_0x533eb8['params']['id']}})[_0x080a('0x25')](handleEntityNotFound(_0x1aa553,null))[_0x080a('0x25')](saveUpdates(_0x533eb8[_0x080a('0x4c')],null))['then'](respondWithResult(_0x1aa553,null))['catch'](handleError(_0x1aa553,null));};exports[_0x080a('0x26')]=function(_0x40e52c,_0x35f7c7){return db['Pause'][_0x080a('0x4a')]({'where':{'id':_0x40e52c[_0x080a('0x53')]['id']}})[_0x080a('0x25')](handleEntityNotFound(_0x35f7c7,null))['then'](removeEntity(_0x35f7c7,null))[_0x080a('0x51')](handleError(_0x35f7c7,null));}; \ No newline at end of file +var _0xe4f4=['filter','where','type','merge','options','includeAll','findAll','rows','show','intersection','include','create','body','user','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','name','map','Pause','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x1cfacc,_0x167cca){var _0x5e8766=function(_0x49819e){while(--_0x49819e){_0x1cfacc['push'](_0x1cfacc['shift']());}};_0x5e8766(++_0x167cca);}(_0xe4f4,0x65));var _0x4e4f=function(_0x2a27eb,_0x2451c8){_0x2a27eb=_0x2a27eb-0x0;var _0x3e8594=_0xe4f4[_0x2a27eb];return _0x3e8594;};'use strict';var emlformat=require(_0x4e4f('0x0'));var rimraf=require(_0x4e4f('0x1'));var zipdir=require(_0x4e4f('0x2'));var jsonpatch=require(_0x4e4f('0x3'));var rp=require(_0x4e4f('0x4'));var moment=require(_0x4e4f('0x5'));var BPromise=require(_0x4e4f('0x6'));var Mustache=require('mustache');var util=require(_0x4e4f('0x7'));var path=require(_0x4e4f('0x8'));var sox=require(_0x4e4f('0x9'));var csv=require(_0x4e4f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e4f('0xb'));var _=require(_0x4e4f('0xc'));var squel=require('squel');var crypto=require(_0x4e4f('0xd'));var jsforce=require(_0x4e4f('0xe'));var deskjs=require(_0x4e4f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e4f('0x10'));var Redis=require(_0x4e4f('0x11'));var authService=require(_0x4e4f('0x12'));var qs=require(_0x4e4f('0x13'));var as=require(_0x4e4f('0x14'));var hardwareService=require(_0x4e4f('0x15'));var logger=require('../../config/logger')(_0x4e4f('0x16'));var utils=require('../../config/utils');var config=require(_0x4e4f('0x17'));var licenseUtil=require(_0x4e4f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6eb8fa,_0x556e61){_0x556e61=_0x556e61||0xcc;return function(_0x4785f1){if(_0x4785f1){return _0x6eb8fa[_0x4e4f('0x19')](_0x556e61);}return _0x6eb8fa[_0x4e4f('0x1a')](_0x556e61)[_0x4e4f('0x1b')]();};}function respondWithResult(_0x4843e8,_0x5cd92c){_0x5cd92c=_0x5cd92c||0xc8;return function(_0x574b73){if(_0x574b73){return _0x4843e8[_0x4e4f('0x1a')](_0x5cd92c)[_0x4e4f('0x1c')](_0x574b73);}};}function respondWithFilteredResult(_0x475151,_0x31840f){return function(_0x9c5184){if(_0x9c5184){var _0x249039=typeof _0x31840f[_0x4e4f('0x1d')]==='undefined'&&typeof _0x31840f[_0x4e4f('0x1e')]===_0x4e4f('0x1f');var _0x26f4f5=_0x9c5184[_0x4e4f('0x20')];var _0x37a401=_0x249039?0x0:_0x31840f[_0x4e4f('0x1d')];var _0x279aa0=_0x249039?_0x9c5184['count']:_0x31840f[_0x4e4f('0x1d')]+_0x31840f[_0x4e4f('0x1e')];var _0x31a2a8;if(_0x279aa0>=_0x26f4f5){_0x279aa0=_0x26f4f5;_0x31a2a8=0xc8;}else{_0x31a2a8=0xce;}_0x475151[_0x4e4f('0x1a')](_0x31a2a8);return _0x475151[_0x4e4f('0x21')](_0x4e4f('0x22'),_0x37a401+'-'+_0x279aa0+'/'+_0x26f4f5)[_0x4e4f('0x1c')](_0x9c5184);}return null;};}function patchUpdates(_0x3eb610){return function(_0x50a38f){try{jsonpatch[_0x4e4f('0x23')](_0x50a38f,_0x3eb610,!![]);}catch(_0x1f6e4b){return BPromise['reject'](_0x1f6e4b);}return _0x50a38f[_0x4e4f('0x24')]();};}function saveUpdates(_0x170465,_0x605e84){return function(_0x4cf9e8){if(_0x4cf9e8){return _0x4cf9e8[_0x4e4f('0x25')](_0x170465)[_0x4e4f('0x26')](function(_0x2c8d88){return _0x2c8d88;});}return null;};}function removeEntity(_0x1d9f11,_0x275ea3){return function(_0x542ef8){if(_0x542ef8){return _0x542ef8[_0x4e4f('0x27')]()[_0x4e4f('0x26')](function(){var _0x4e5393=_0x542ef8[_0x4e4f('0x28')]({'plain':!![]});var _0xb0d281=_0x4e4f('0x29');return db[_0x4e4f('0x2a')][_0x4e4f('0x27')]({'where':{'type':_0xb0d281,'resourceId':_0x4e5393['id']}})[_0x4e4f('0x26')](function(){return _0x542ef8;});})['then'](function(){_0x1d9f11[_0x4e4f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fad38,_0xed9357){return function(_0x2555c1){if(!_0x2555c1){_0x4fad38[_0x4e4f('0x19')](0x194);}return _0x2555c1;};}function handleError(_0x3280a0,_0x1d099a){_0x1d099a=_0x1d099a||0x1f4;return function(_0x278e17){logger[_0x4e4f('0x2b')](_0x278e17['stack']);if(_0x278e17[_0x4e4f('0x2c')]){delete _0x278e17[_0x4e4f('0x2c')];}_0x3280a0['status'](_0x1d099a)['send'](_0x278e17);};}exports['index']=function(_0x39931d,_0x4a0e2a){var _0x5313b9={},_0x5e1b0f={},_0x1cb440={'count':0x0,'rows':[]};var _0x2e73b=_[_0x4e4f('0x2d')](db[_0x4e4f('0x2e')][_0x4e4f('0x2f')],function(_0x3dab1e){return{'name':_0x3dab1e[_0x4e4f('0x30')],'type':_0x3dab1e['type'][_0x4e4f('0x31')]};});_0x5e1b0f[_0x4e4f('0x32')]=_[_0x4e4f('0x2d')](_0x2e73b,_0x4e4f('0x2c'));_0x5e1b0f[_0x4e4f('0x33')]=_[_0x4e4f('0x34')](_0x39931d[_0x4e4f('0x33')]);_0x5e1b0f[_0x4e4f('0x35')]=_['intersection'](_0x5e1b0f[_0x4e4f('0x32')],_0x5e1b0f[_0x4e4f('0x33')]);_0x5313b9[_0x4e4f('0x36')]=_['intersection'](_0x5e1b0f[_0x4e4f('0x32')],qs[_0x4e4f('0x37')](_0x39931d['query'][_0x4e4f('0x37')]));_0x5313b9[_0x4e4f('0x36')]=_0x5313b9[_0x4e4f('0x36')][_0x4e4f('0x38')]?_0x5313b9['attributes']:_0x5e1b0f[_0x4e4f('0x32')];if(!_0x39931d['query'][_0x4e4f('0x39')](_0x4e4f('0x3a'))){_0x5313b9[_0x4e4f('0x1e')]=qs[_0x4e4f('0x1e')](_0x39931d['query'][_0x4e4f('0x1e')]);_0x5313b9[_0x4e4f('0x1d')]=qs['offset'](_0x39931d[_0x4e4f('0x33')]['offset']);}_0x5313b9['order']=qs[_0x4e4f('0x3b')](_0x39931d['query'][_0x4e4f('0x3b')]);_0x5313b9['where']=qs['filters'](_[_0x4e4f('0x3c')](_0x39931d[_0x4e4f('0x33')],_0x5e1b0f[_0x4e4f('0x35')]),_0x2e73b);if(_0x39931d['query'][_0x4e4f('0x3d')]){_0x5313b9['where']=_['merge'](_0x5313b9[_0x4e4f('0x3e')],{'$or':_[_0x4e4f('0x2d')](_0x2e73b,function(_0xb31d7a){if(_0xb31d7a[_0x4e4f('0x3f')]!=='VIRTUAL'){var _0x124825={};_0x124825[_0xb31d7a[_0x4e4f('0x2c')]]={'$like':'%'+_0x39931d[_0x4e4f('0x33')]['filter']+'%'};return _0x124825;}})});}_0x5313b9=_[_0x4e4f('0x40')]({},_0x5313b9,_0x39931d[_0x4e4f('0x41')]);var _0x43cf94={'where':_0x5313b9[_0x4e4f('0x3e')]};return db[_0x4e4f('0x2e')][_0x4e4f('0x20')](_0x43cf94)[_0x4e4f('0x26')](function(_0x3dd701){_0x1cb440[_0x4e4f('0x20')]=_0x3dd701;if(_0x39931d[_0x4e4f('0x33')][_0x4e4f('0x42')]){_0x5313b9['include']=[{'all':!![]}];}return db[_0x4e4f('0x2e')][_0x4e4f('0x43')](_0x5313b9);})[_0x4e4f('0x26')](function(_0x34a789){_0x1cb440[_0x4e4f('0x44')]=_0x34a789;return _0x1cb440;})[_0x4e4f('0x26')](respondWithFilteredResult(_0x4a0e2a,_0x5313b9))['catch'](handleError(_0x4a0e2a,null));};exports[_0x4e4f('0x45')]=function(_0x47ace1,_0x329137){var _0x21a6f7={'raw':!![],'where':{'id':_0x47ace1['params']['id']}},_0x5b7cfe={};_0x5b7cfe[_0x4e4f('0x32')]=_[_0x4e4f('0x34')](db['Pause'][_0x4e4f('0x2f')]);_0x5b7cfe['query']=_[_0x4e4f('0x34')](_0x47ace1[_0x4e4f('0x33')]);_0x5b7cfe['filters']=_[_0x4e4f('0x46')](_0x5b7cfe[_0x4e4f('0x32')],_0x5b7cfe[_0x4e4f('0x33')]);_0x21a6f7['attributes']=_['intersection'](_0x5b7cfe['model'],qs[_0x4e4f('0x37')](_0x47ace1[_0x4e4f('0x33')][_0x4e4f('0x37')]));_0x21a6f7['attributes']=_0x21a6f7[_0x4e4f('0x36')][_0x4e4f('0x38')]?_0x21a6f7['attributes']:_0x5b7cfe['model'];if(_0x47ace1[_0x4e4f('0x33')][_0x4e4f('0x42')]){_0x21a6f7[_0x4e4f('0x47')]=[{'all':!![]}];}_0x21a6f7=_[_0x4e4f('0x40')]({},_0x21a6f7,_0x47ace1[_0x4e4f('0x41')]);return db['Pause']['find'](_0x21a6f7)[_0x4e4f('0x26')](handleEntityNotFound(_0x329137,null))[_0x4e4f('0x26')](respondWithResult(_0x329137,null))['catch'](handleError(_0x329137,null));};exports['create']=function(_0x368be5,_0x2cf5d7){return db['Pause'][_0x4e4f('0x48')](_0x368be5[_0x4e4f('0x49')],{})['then'](function(_0x3cf705){var _0x8ded0e=_0x368be5[_0x4e4f('0x4a')][_0x4e4f('0x28')]({'plain':!![]});if(!_0x8ded0e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8ded0e['role']===_0x4e4f('0x4a')){var _0x1d85e0=_0x3cf705['get']({'plain':!![]});var _0x72abe0=_0x4e4f('0x29');return db[_0x4e4f('0x4b')][_0x4e4f('0x4c')]({'where':{'name':_0x72abe0,'userProfileId':_0x8ded0e[_0x4e4f('0x4d')]},'raw':!![]})[_0x4e4f('0x26')](function(_0x1cb72e){if(_0x1cb72e&&_0x1cb72e['autoAssociation']===0x0){return db[_0x4e4f('0x2a')][_0x4e4f('0x48')]({'name':_0x1d85e0[_0x4e4f('0x2c')],'resourceId':_0x1d85e0['id'],'type':_0x1cb72e['name'],'sectionId':_0x1cb72e['id']},{})[_0x4e4f('0x26')](function(){return _0x3cf705;});}else{return _0x3cf705;}})[_0x4e4f('0x4e')](function(_0x1f8e4b){logger[_0x4e4f('0x2b')](_0x4e4f('0x4f'),_0x1f8e4b);throw _0x1f8e4b;});}return _0x3cf705;})['then'](respondWithResult(_0x2cf5d7,0xc9))['catch'](handleError(_0x2cf5d7,null));};exports[_0x4e4f('0x25')]=function(_0x500c6b,_0x9bc294){if(_0x500c6b['body']['id']){delete _0x500c6b[_0x4e4f('0x49')]['id'];}return db[_0x4e4f('0x2e')]['find']({'where':{'id':_0x500c6b[_0x4e4f('0x50')]['id']}})[_0x4e4f('0x26')](handleEntityNotFound(_0x9bc294,null))['then'](saveUpdates(_0x500c6b[_0x4e4f('0x49')],null))['then'](respondWithResult(_0x9bc294,null))[_0x4e4f('0x4e')](handleError(_0x9bc294,null));};exports[_0x4e4f('0x27')]=function(_0x208c25,_0x5c6698){return db[_0x4e4f('0x2e')][_0x4e4f('0x4c')]({'where':{'id':_0x208c25['params']['id']}})['then'](handleEntityNotFound(_0x5c6698,null))[_0x4e4f('0x26')](removeEntity(_0x5c6698,null))['catch'](handleError(_0x5c6698,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 283b1a5..6502e11 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x3c2a53,_0x36697f){var _0x23517f=function(_0x573d64){while(--_0x573d64){_0x3c2a53['push'](_0x3c2a53['shift']());}};_0x23517f(++_0x36697f);}(_0xe14b,0x93));var _0xbe14=function(_0x201945,_0x4b617c){_0x201945=_0x201945-0x0;var _0x4c41e2=_0xe14b[_0x201945];return _0x4c41e2;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x22965f,_0x207a53){var _0x54d743=function(_0x5d00a3){while(--_0x5d00a3){_0x22965f['push'](_0x22965f['shift']());}};_0x54d743(++_0x207a53);}(_0xabce,0x103));var _0xeabc=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xabce[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'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 5b9ba69..e1a2d74 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(_0x189810,_0x231d78){var _0xda9c35=function(_0x3163f5){while(--_0x3163f5){_0x189810['push'](_0x189810['shift']());}};_0xda9c35(++_0x231d78);}(_0xb10b,0x12a));var _0xbb10=function(_0x3710f1,_0x4d55cf){_0x3710f1=_0x3710f1-0x0;var _0x1ef269=_0xb10b[_0x3710f1];return _0x1ef269;};'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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x535920,_0x3f3e70){var _0x5b00a2=function(_0x17bcbe){while(--_0x17bcbe){_0x535920['push'](_0x535920['shift']());}};_0x5b00a2(++_0x3f3e70);}(_0x7a54,0x106));var _0x47a5=function(_0x2ef0f4,_0xdecd68){_0x2ef0f4=_0x2ef0f4-0x0;var _0x4affae=_0x7a54[_0x2ef0f4];return _0x4affae;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fe47505..ad2c5e7 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 _0x2d17=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','/webhook','put','isAuthenticated','delete','exports','multer','util'];(function(_0x2323c6,_0x566714){var _0x4a0680=function(_0x4daded){while(--_0x4daded){_0x2323c6['push'](_0x2323c6['shift']());}};_0x4a0680(++_0x566714);}(_0x2d17,0x17e));var _0x72d1=function(_0x594c61,_0x5a1800){_0x594c61=_0x594c61-0x0;var _0x2089dd=_0x2d17[_0x594c61];return _0x2089dd;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./plugin.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/webhook',controller[_0x72d1('0x9')]);router[_0x72d1('0x7')](_0x72d1('0xa'),auth['isAuthenticated'](),controller[_0x72d1('0xb')]);router[_0x72d1('0x7')](_0x72d1('0xc'),auth['isAuthenticated'](),controller[_0x72d1('0xd')]);var upload=multer({'storage':multer[_0x72d1('0xe')]({'destination':function(_0x45eb4a,_0x14a41e,_0x3cb9c2){_0x3cb9c2(null,path[_0x72d1('0xf')](config[_0x72d1('0x10')],_0x72d1('0x11')));},'filename':function(_0x273ccf,_0x2f5a78,_0x5ad4df){_0x2f5a78[_0x72d1('0x12')]=_0x2f5a78[_0x72d1('0x12')][_0x72d1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ad4df(null,util[_0x72d1('0x14')](_0x72d1('0x15'),path[_0x72d1('0x16')](_0x2f5a78[_0x72d1('0x12')],path[_0x72d1('0x17')](_0x2f5a78[_0x72d1('0x12')])),Date[_0x72d1('0x18')](),path[_0x72d1('0x17')](_0x2f5a78[_0x72d1('0x12')])));}})});router[_0x72d1('0x19')]('/',upload['single'](_0x72d1('0x1a')),controller['upload']);router[_0x72d1('0x19')](_0x72d1('0x1b'),controller['webhookPost']);router[_0x72d1('0x1c')](_0x72d1('0xa'),auth[_0x72d1('0x1d')](),controller['update']);router['delete'](_0x72d1('0xa'),auth[_0x72d1('0x1d')](),controller[_0x72d1('0x1e')]);module[_0x72d1('0x1f')]=router; \ No newline at end of file +var _0x29d4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','show','download','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','file','webhookPost','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x29d4,0x1a1));var _0x429d=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x29d4[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),controller['webhookGet']);router[_0x429d('0x9')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0xd')]);router[_0x429d('0x9')]('/:id/download',auth[_0x429d('0xa')](),controller[_0x429d('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x31ff87,_0x2fd1ca,_0x417f77){_0x417f77(null,path['join'](config[_0x429d('0xf')],_0x429d('0x10')));},'filename':function(_0x1d933b,_0x1cb1cf,_0x4843af){_0x1cb1cf[_0x429d('0x11')]=_0x1cb1cf[_0x429d('0x11')][_0x429d('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4843af(null,util['format'](_0x429d('0x13'),path[_0x429d('0x14')](_0x1cb1cf['originalname'],path[_0x429d('0x15')](_0x1cb1cf[_0x429d('0x11')])),Date[_0x429d('0x16')](),path[_0x429d('0x15')](_0x1cb1cf[_0x429d('0x11')])));}})});router[_0x429d('0x17')]('/',upload['single'](_0x429d('0x18')),controller['upload']);router[_0x429d('0x17')](_0x429d('0xc'),controller[_0x429d('0x19')]);router[_0x429d('0x1a')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0x1b')]);router[_0x429d('0x1c')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0x1c')]);module[_0x429d('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 3f2f13f..c0aea52 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 _0x4d97=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','html','script','TEXT'];(function(_0xa482b6,_0x446cef){var _0x254829=function(_0x1de4f4){while(--_0x1de4f4){_0xa482b6['push'](_0xa482b6['shift']());}};_0x254829(++_0x446cef);}(_0x4d97,0xaf));var _0x74d9=function(_0x16b4b5,_0x10f834){_0x16b4b5=_0x16b4b5-0x0;var _0x2a9bbb=_0x4d97[_0x16b4b5];return _0x2a9bbb;};'use strict';var Sequelize=require('sequelize');module[_0x74d9('0x0')]={'name':{'type':Sequelize[_0x74d9('0x1')]},'type':{'type':Sequelize['ENUM'](_0x74d9('0x2'),_0x74d9('0x3'))},'description':{'type':Sequelize[_0x74d9('0x4')]},'version':{'type':Sequelize[_0x74d9('0x4')]},'path':{'type':Sequelize[_0x74d9('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x74d9('0x5')],'defaultValue':0x0,'comment':_0x74d9('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x74d9('0x7'),_0x74d9('0x8'),_0x74d9('0x9'),_0x74d9('0xa')),'defaultValue':'always','comment':_0x74d9('0xb')},'icon':{'type':Sequelize[_0x74d9('0x1')]},'adminUrl':{'type':Sequelize[_0x74d9('0x1')]},'agentUrl':{'type':Sequelize[_0x74d9('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xec50=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xec50,0x13e));var _0x0ec5=function(_0x5c68c7,_0x54ba85){_0x5c68c7=_0x5c68c7-0x0;var _0x4a94fc=_0xec50[_0x5c68c7];return _0x4a94fc;};'use strict';var Sequelize=require(_0x0ec5('0x0'));module[_0x0ec5('0x1')]={'name':{'type':Sequelize[_0x0ec5('0x2')]},'type':{'type':Sequelize[_0x0ec5('0x3')]('html',_0x0ec5('0x4'))},'description':{'type':Sequelize[_0x0ec5('0x5')]},'version':{'type':Sequelize[_0x0ec5('0x5')]},'path':{'type':Sequelize[_0x0ec5('0x2')],'comment':_0x0ec5('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0ec5('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x0ec5('0x8'),_0x0ec5('0x9'),_0x0ec5('0xa'),_0x0ec5('0xb')),'defaultValue':_0x0ec5('0xa'),'comment':_0x0ec5('0xc')},'icon':{'type':Sequelize[_0x0ec5('0x2')]},'adminUrl':{'type':Sequelize[_0x0ec5('0x2')]},'agentUrl':{'type':Sequelize[_0x0ec5('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x0ec5('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 1bf41ca..ee087ba 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 _0x5ec0=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','send','index','Plugin','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','params','length','options','find','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','pipe','glob','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','basename','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','version','html','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','method','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x5ec0,0xa2));var _0x05ec=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5ec0[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x05ec('0x0'));var rimraf=require(_0x05ec('0x1'));var zipdir=require(_0x05ec('0x2'));var jsonpatch=require(_0x05ec('0x3'));var rp=require(_0x05ec('0x4'));var moment=require('moment');var BPromise=require(_0x05ec('0x5'));var Mustache=require(_0x05ec('0x6'));var util=require(_0x05ec('0x7'));var path=require(_0x05ec('0x8'));var sox=require(_0x05ec('0x9'));var csv=require(_0x05ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05ec('0xb'));var squel=require(_0x05ec('0xc'));var crypto=require(_0x05ec('0xd'));var jsforce=require(_0x05ec('0xe'));var deskjs=require(_0x05ec('0xf'));var toCsv=require(_0x05ec('0xa'));var querystring=require(_0x05ec('0x10'));var Papa=require(_0x05ec('0x11'));var extract=require(_0x05ec('0x12'));var rimraf=require('rimraf');var archiver=require(_0x05ec('0x13'));var Redis=require(_0x05ec('0x14'));var authService=require(_0x05ec('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05ec('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x05ec('0x17'));var licenseUtil=require(_0x05ec('0x18'));var db=require(_0x05ec('0x19'))['db'];config[_0x05ec('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x05ec('0x1b'))(new Redis(config['redis']));require(_0x05ec('0x1c'))[_0x05ec('0x1d')](socket);function respondWithStatusCode(_0x2473df,_0x36099d){_0x36099d=_0x36099d||0xcc;return function(_0x4fa4ca){if(_0x4fa4ca){return _0x2473df[_0x05ec('0x1e')](_0x36099d);}return _0x2473df[_0x05ec('0x1f')](_0x36099d)[_0x05ec('0x20')]();};}function respondWithResult(_0x2f28db,_0x53d307){_0x53d307=_0x53d307||0xc8;return function(_0xd0c203){if(_0xd0c203){return _0x2f28db[_0x05ec('0x1f')](_0x53d307)[_0x05ec('0x21')](_0xd0c203);}};}function respondWithFilteredResult(_0x467cac,_0x14c784){return function(_0x3ce3f8){if(_0x3ce3f8){var _0x2e9e9b=typeof _0x14c784[_0x05ec('0x22')]===_0x05ec('0x23')&&typeof _0x14c784[_0x05ec('0x24')]==='undefined';var _0x3294a0=_0x3ce3f8[_0x05ec('0x25')];var _0x543df0=_0x2e9e9b?0x0:_0x14c784['offset'];var _0x35ac2d=_0x2e9e9b?_0x3ce3f8[_0x05ec('0x25')]:_0x14c784[_0x05ec('0x22')]+_0x14c784[_0x05ec('0x24')];var _0x48e249;if(_0x35ac2d>=_0x3294a0){_0x35ac2d=_0x3294a0;_0x48e249=0xc8;}else{_0x48e249=0xce;}_0x467cac[_0x05ec('0x1f')](_0x48e249);return _0x467cac[_0x05ec('0x26')](_0x05ec('0x27'),_0x543df0+'-'+_0x35ac2d+'/'+_0x3294a0)[_0x05ec('0x21')](_0x3ce3f8);}return null;};}function patchUpdates(_0x1a2fcf){return function(_0x4f960f){try{jsonpatch[_0x05ec('0x28')](_0x4f960f,_0x1a2fcf,!![]);}catch(_0x447995){return BPromise[_0x05ec('0x29')](_0x447995);}return _0x4f960f[_0x05ec('0x2a')]();};}function saveUpdates(_0x702cb8,_0x50bb20){return function(_0x26481a){if(_0x26481a){return _0x26481a['update'](_0x702cb8)[_0x05ec('0x2b')](function(_0x566f48){return _0x566f48;});}return null;};}function removeEntity(_0x2a879f,_0x4a2576){return function(_0x469201){if(_0x469201){return _0x469201[_0x05ec('0x2c')]()[_0x05ec('0x2b')](function(){var _0x15c46c=_0x469201[_0x05ec('0x2d')]({'plain':!![]});var _0x45ed72='Plugins';return db['UserProfileResource'][_0x05ec('0x2c')]({'where':{'type':_0x45ed72,'resourceId':_0x15c46c['id']}})['then'](function(){return _0x469201;});})['then'](function(){_0x2a879f['status'](0xcc)[_0x05ec('0x20')]();});}};}function handleEntityNotFound(_0x48bc29,_0x3e79e3){return function(_0x3b1992){if(!_0x3b1992){_0x48bc29[_0x05ec('0x1e')](0x194);}return _0x3b1992;};}function handleError(_0xb4363b,_0x4b892f){_0x4b892f=_0x4b892f||0x1f4;return function(_0x2746ac){logger[_0x05ec('0x2e')](_0x2746ac[_0x05ec('0x2f')]);if(_0x2746ac[_0x05ec('0x30')]){delete _0x2746ac[_0x05ec('0x30')];}_0xb4363b[_0x05ec('0x1f')](_0x4b892f)[_0x05ec('0x31')](_0x2746ac);};}exports[_0x05ec('0x32')]=function(_0x17967a,_0x1a8f63){var _0x4a8ab6={},_0x2c946c={},_0x40c3a0={'count':0x0,'rows':[]};var _0x4375e7=_['map'](db[_0x05ec('0x33')][_0x05ec('0x34')],function(_0x429744){return{'name':_0x429744[_0x05ec('0x35')],'type':_0x429744['type']['key']};});_0x2c946c[_0x05ec('0x36')]=_[_0x05ec('0x37')](_0x4375e7,_0x05ec('0x30'));_0x2c946c[_0x05ec('0x38')]=_[_0x05ec('0x39')](_0x17967a['query']);_0x2c946c[_0x05ec('0x3a')]=_['intersection'](_0x2c946c[_0x05ec('0x36')],_0x2c946c['query']);_0x4a8ab6['attributes']=_[_0x05ec('0x3b')](_0x2c946c['model'],qs[_0x05ec('0x3c')](_0x17967a[_0x05ec('0x38')][_0x05ec('0x3c')]));_0x4a8ab6[_0x05ec('0x3d')]=_0x4a8ab6['attributes']['length']?_0x4a8ab6[_0x05ec('0x3d')]:_0x2c946c['model'];if(!_0x17967a['query'][_0x05ec('0x3e')]('nolimit')){_0x4a8ab6[_0x05ec('0x24')]=qs[_0x05ec('0x24')](_0x17967a[_0x05ec('0x38')]['limit']);_0x4a8ab6[_0x05ec('0x22')]=qs[_0x05ec('0x22')](_0x17967a[_0x05ec('0x38')][_0x05ec('0x22')]);}_0x4a8ab6['order']=qs['sort'](_0x17967a[_0x05ec('0x38')][_0x05ec('0x3f')]);_0x4a8ab6[_0x05ec('0x40')]=qs['filters'](_[_0x05ec('0x41')](_0x17967a[_0x05ec('0x38')],_0x2c946c[_0x05ec('0x3a')]),_0x4375e7);if(_0x17967a[_0x05ec('0x38')][_0x05ec('0x42')]){_0x4a8ab6[_0x05ec('0x40')]=_[_0x05ec('0x43')](_0x4a8ab6[_0x05ec('0x40')],{'$or':_['map'](_0x4375e7,function(_0x3150e8){if(_0x3150e8[_0x05ec('0x44')]!==_0x05ec('0x45')){var _0x2490b6={};_0x2490b6[_0x3150e8[_0x05ec('0x30')]]={'$like':'%'+_0x17967a[_0x05ec('0x38')][_0x05ec('0x42')]+'%'};return _0x2490b6;}})});}_0x4a8ab6=_[_0x05ec('0x43')]({},_0x4a8ab6,_0x17967a['options']);var _0x1e13b1={'where':_0x4a8ab6[_0x05ec('0x40')]};return db[_0x05ec('0x33')][_0x05ec('0x25')](_0x1e13b1)[_0x05ec('0x2b')](function(_0x2f8794){_0x40c3a0[_0x05ec('0x25')]=_0x2f8794;if(_0x17967a[_0x05ec('0x38')][_0x05ec('0x46')]){_0x4a8ab6[_0x05ec('0x47')]=[{'all':!![]}];}return db[_0x05ec('0x33')]['findAll'](_0x4a8ab6);})[_0x05ec('0x2b')](function(_0x3f63a5){_0x40c3a0['rows']=_0x3f63a5;return _0x40c3a0;})[_0x05ec('0x2b')](respondWithFilteredResult(_0x1a8f63,_0x4a8ab6))[_0x05ec('0x48')](handleError(_0x1a8f63,null));};exports[_0x05ec('0x49')]=function(_0x52e083,_0x4f1c31){var _0x11a52a={'raw':!![],'where':{'id':_0x52e083[_0x05ec('0x4a')]['id']}},_0x3ad28d={};_0x3ad28d[_0x05ec('0x36')]=_[_0x05ec('0x39')](db[_0x05ec('0x33')]['rawAttributes']);_0x3ad28d[_0x05ec('0x38')]=_[_0x05ec('0x39')](_0x52e083[_0x05ec('0x38')]);_0x3ad28d['filters']=_['intersection'](_0x3ad28d[_0x05ec('0x36')],_0x3ad28d['query']);_0x11a52a[_0x05ec('0x3d')]=_[_0x05ec('0x3b')](_0x3ad28d[_0x05ec('0x36')],qs[_0x05ec('0x3c')](_0x52e083[_0x05ec('0x38')][_0x05ec('0x3c')]));_0x11a52a[_0x05ec('0x3d')]=_0x11a52a['attributes'][_0x05ec('0x4b')]?_0x11a52a[_0x05ec('0x3d')]:_0x3ad28d[_0x05ec('0x36')];if(_0x52e083[_0x05ec('0x38')][_0x05ec('0x46')]){_0x11a52a[_0x05ec('0x47')]=[{'all':!![]}];}_0x11a52a=_[_0x05ec('0x43')]({},_0x11a52a,_0x52e083[_0x05ec('0x4c')]);return db[_0x05ec('0x33')][_0x05ec('0x4d')](_0x11a52a)[_0x05ec('0x2b')](handleEntityNotFound(_0x4f1c31,null))['then'](respondWithResult(_0x4f1c31,null))['catch'](handleError(_0x4f1c31,null));};exports[_0x05ec('0x4e')]=function(_0x4a8840,_0x2c4eab,_0x5f352f){return db[_0x05ec('0x33')][_0x05ec('0x4d')]({'where':{'id':_0x4a8840[_0x05ec('0x4a')]['id']},'attributes':[_0x05ec('0x30'),_0x05ec('0x8')],'raw':!![]})['then'](handleEntityNotFound(_0x2c4eab,null))['then'](function(_0x484ecc){if(_0x484ecc){var _0x338c8e=path[_0x05ec('0x4f')](config[_0x05ec('0x50')],_0x05ec('0x51'),util[_0x05ec('0x52')](_0x05ec('0x53'),path['basename'](_0x484ecc[_0x05ec('0x8')])));var _0x56ce51=fs[_0x05ec('0x54')](_0x338c8e);var _0x44f73a=archiver(_0x05ec('0x55'),{'zlib':{'level':0x9}});_0x44f73a['on'](_0x05ec('0x56'),function(_0x4066c5){if(_0x4066c5[_0x05ec('0x57')]===_0x05ec('0x58')){logger[_0x05ec('0x2e')](_0x4066c5);}else{throw new db[(_0x05ec('0x59'))][(_0x05ec('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x44f73a['on'](_0x05ec('0x2e'),function(_0x1c0a7b){throw new db['Sequelize'][(_0x05ec('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x44f73a[_0x05ec('0x5b')](_0x56ce51);_0x44f73a[_0x05ec('0x5c')]('**/*',{'cwd':path[_0x05ec('0x4f')](config['root'],_0x05ec('0x51'),path['dirname'](_0x484ecc['path'])),'ignore':[path[_0x05ec('0x4f')](path['basename'](_0x484ecc[_0x05ec('0x8')]),_0x05ec('0x5d')),path[_0x05ec('0x4f')](path['basename'](_0x484ecc['path']),_0x05ec('0x5e'))],'nodir':!![]})[_0x05ec('0x5f')]();_0x56ce51['on'](_0x05ec('0x60'),function(){if(!fs[_0x05ec('0x61')](_0x338c8e)){throw new db[(_0x05ec('0x59'))]['Error'](_0x05ec('0x62'));}return _0x2c4eab[_0x05ec('0x4e')](_0x338c8e,util[_0x05ec('0x52')](_0x05ec('0x53'),path[_0x05ec('0x63')](_0x484ecc[_0x05ec('0x8')])),function(_0x5451d7){if(_0x5451d7){throw new db[(_0x05ec('0x59'))][(_0x05ec('0x5a'))](_0x05ec('0x64'));}fs['unlinkSync'](_0x338c8e);logger[_0x05ec('0x65')](_0x05ec('0x66'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x05ec('0x48')](handleError(_0x2c4eab,null));};exports[_0x05ec('0x67')]=function(_0x5daa21,_0x100e64,_0x5cc102){var _0x3a463a=path[_0x05ec('0x63')](_0x5daa21['file'][_0x05ec('0x68')],path[_0x05ec('0x69')](_0x5daa21[_0x05ec('0x6a')][_0x05ec('0x68')]));var _0x3dd453=path[_0x05ec('0x4f')](config[_0x05ec('0x50')],_0x05ec('0x51'),_0x5daa21['file'][_0x05ec('0x68')]);var _0x32fe1f=path['join'](config['root'],_0x05ec('0x51'),_0x3a463a);logger[_0x05ec('0x65')](_0x05ec('0x6b'),_0x3dd453);logger[_0x05ec('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x32fe1f);try{fs[_0x05ec('0x6c')](_0x3dd453,parseInt('0777',0x8));extract(_0x3dd453,{'dir':_0x32fe1f},function(_0x10e44b){if(_0x10e44b){logger[_0x05ec('0x2e')](_0x10e44b);handleError(_0x10e44b,!![]);};var _0x2ee6ee=fs['readdirSync'](_0x32fe1f);if(_0x2ee6ee[_0x05ec('0x4b')]>0x1){removeReferences(_0x3dd453,_0x32fe1f);logger[_0x05ec('0x2e')](_0x05ec('0x6d'));return _0x5cc102(new Error(_0x05ec('0x6d')));}var _0x2fff10=fs[_0x05ec('0x6e')](path[_0x05ec('0x4f')](_0x32fe1f,_0x2ee6ee[0x0]));if(_0x2fff10[_0x05ec('0x6f')]()){removeReferences(_0x3dd453,_0x32fe1f);logger['error'](_0x05ec('0x6d'));return _0x5cc102(new Error(_0x05ec('0x6d')));}if(_0x2fff10[_0x05ec('0x70')]()){var _0x38da13=fs[_0x05ec('0x71')](path['join'](_0x32fe1f,_0x2ee6ee[0x0]));if(_0x38da13[_0x05ec('0x4b')]===0x0){removeReferences(_0x3dd453,_0x32fe1f);logger[_0x05ec('0x2e')](_0x05ec('0x6d'));return _0x5cc102(new Error(_0x05ec('0x6d')));}var _0x3f7790=_0x38da13['some'](function(_0xf33db){return _0xf33db===_0x05ec('0x72');});if(!_0x3f7790){return _0x5cc102(new Error('Plugin\x20manifest\x20missing'));}var _0x4b7d51=fs[_0x05ec('0x73')](path[_0x05ec('0x4f')](_0x32fe1f,_0x2ee6ee[0x0],_0x05ec('0x72')));var _0x376346=JSON[_0x05ec('0x74')](_0x4b7d51);if(_0x05ec('0x23')==typeof _0x376346[_0x05ec('0x30')]){return _0x5cc102(new Error(_0x05ec('0x75')));}if('undefined'==typeof _0x376346[_0x05ec('0x44')]){return _0x5cc102(new Error(_0x05ec('0x76')));}if(_0x05ec('0x23')==typeof _0x376346['version']){return _0x5cc102(new Error(_0x05ec('0x77')));}if(_0x05ec('0x23')==typeof _0x376346[_0x05ec('0x78')]){return _0x5cc102(new Error(_0x05ec('0x79')));}if(_0x376346[_0x05ec('0x44')]==='html'){if('undefined'==typeof _0x376346[_0x05ec('0x78')]['views']){return _0x5cc102(new Error(_0x05ec('0x7a')));}if(_0x05ec('0x23')==typeof _0x376346['parameters']['views'][_0x05ec('0x7b')]&&'undefined'==typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7d')]){return _0x5cc102(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x376346[_0x05ec('0x44')]===_0x05ec('0x7e')){if(_0x05ec('0x23')==typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x7f')]){return _0x5cc102(new Error(_0x05ec('0x80')));}if(_0x05ec('0x23')==typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x81')]){return _0x5cc102(new Error(_0x05ec('0x82')));}}else{return _0x5cc102(new Error(_0x05ec('0x83')));}var _0x55155f=_0x376346[_0x05ec('0x30')];var _0x5c710c=_0x376346['description'];var _0x35041b=_0x376346[_0x05ec('0x44')];var _0x3912a0=_0x376346[_0x05ec('0x84')]?_0x376346[_0x05ec('0x84')]:_0x05ec('0x85');var _0x436aa0=_0x376346[_0x05ec('0x86')]?_0x376346[_0x05ec('0x86')]:_0x05ec('0x87');var _0x5881aa='';var _0x159723='';var _0x415c63='';var _0x2389cc='';var _0x11c5f0=_0x376346[_0x05ec('0x88')];if(_0x35041b===_0x05ec('0x89')){if(_0x05ec('0x23')!=typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x7c')]['admin']){var _0x460a11=_0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x8a')](_0x460a11)){_0x5881aa=path[_0x05ec('0x4f')](_0x05ec('0x8b'),_0x3a463a,_0x2ee6ee[0x0],_0x460a11);}else{_0x5881aa=_0x460a11;}}else{logger[_0x05ec('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x05ec('0x23')!=typeof _0x376346['parameters'][_0x05ec('0x7c')][_0x05ec('0x7d')]){var _0xbbd5af=_0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x8a')](_0xbbd5af)){_0x159723=path[_0x05ec('0x4f')]('plugins',_0x3a463a,_0x2ee6ee[0x0],_0xbbd5af);}else{_0x159723=_0xbbd5af;}}else{logger[_0x05ec('0x65')](_0x05ec('0x8c'));}}else if(_0x35041b===_0x05ec('0x7e')){_0x415c63=_0x376346['parameters'][_0x05ec('0x7f')];_0x2389cc=_0x376346[_0x05ec('0x78')][_0x05ec('0x81')];if(_0x05ec('0x23')!=typeof _0x376346['parameters']['views']){if(_0x05ec('0x23')!=typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7b')]){var _0x460a11=_0x376346['parameters']['views'][_0x05ec('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x8a')](_0x460a11)){_0x5881aa=path[_0x05ec('0x4f')](_0x05ec('0x8b'),_0x3a463a,_0x2ee6ee[0x0],_0x460a11);}else{_0x5881aa=_0x460a11;}}if(_0x05ec('0x23')!=typeof _0x376346['parameters']['views']['agent']){var _0xbbd5af=_0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0xbbd5af)){_0x159723=path[_0x05ec('0x4f')](_0x05ec('0x8b'),_0x3a463a,_0x2ee6ee[0x0],_0xbbd5af);}else{_0x159723=_0xbbd5af;}}}}var _0x394c22={'name':_0x55155f,'description':_0x5c710c,'path':path[_0x05ec('0x4f')](_0x3a463a,_0x2ee6ee[0x0]),'type':_0x35041b,'sidebar':_0x3912a0,'icon':_0x436aa0,'adminUrl':_0x5881aa,'agentUrl':_0x159723,'scriptName':_0x415c63,'scriptPath':_0x2389cc,'version':_0x11c5f0};removeReferences(_0x3dd453,null);return db['Plugin'][_0x05ec('0x8d')](_0x394c22)[_0x05ec('0x2b')](function(_0x293115){var _0x2be2ca={'role':_0x5daa21[_0x05ec('0x8e')][_0x05ec('0x8f')],'userProfileId':_0x5daa21[_0x05ec('0x8e')][_0x05ec('0x90')]};if(!_0x2be2ca)throw new Error(_0x05ec('0x91'));if(_0x2be2ca['role']===_0x05ec('0x92')){var _0x28ce76=_0x293115[_0x05ec('0x2d')]({'plain':!![]});return db['UserProfileSection'][_0x05ec('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x2be2ca['userProfileId']},'raw':!![]})[_0x05ec('0x2b')](function(_0x1821dc){if(_0x1821dc&&_0x1821dc[_0x05ec('0x93')]===0x0){return db[_0x05ec('0x94')]['create']({'name':_0x28ce76[_0x05ec('0x30')],'resourceId':_0x28ce76['id'],'type':_0x1821dc[_0x05ec('0x30')],'sectionId':_0x1821dc['id']},{})['then'](function(){return _0x293115;});}else{return _0x293115;}})[_0x05ec('0x48')](function(_0x7d51ed){logger[_0x05ec('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7d51ed);throw _0x7d51ed;});}return _0x293115;})[_0x05ec('0x2b')](respondWithResult(_0x100e64,null))['catch'](handleError(_0x100e64,null));}});}catch(_0x3c192a){_0x100e64[_0x05ec('0x1f')](0x1f4)[_0x05ec('0x31')](_0x3c192a);}};function removeReferences(_0x16a3df,_0x2079f4){try{if(_0x16a3df){fs[_0x05ec('0x95')](_0x16a3df);logger[_0x05ec('0x65')](_0x05ec('0x96'));}if(_0x2079f4){rimraf(_0x2079f4,function(){});logger[_0x05ec('0x65')](_0x05ec('0x97'));}}catch(_0x41c35f){logger[_0x05ec('0x2e')](_0x41c35f);}}exports[_0x05ec('0x98')]=function(_0x52dfd6,_0x267edb,_0x503e76){return db[_0x05ec('0x33')][_0x05ec('0x4d')]({'where':{'id':_0x52dfd6['params']['id']}})[_0x05ec('0x2b')](handleEntityNotFound(_0x267edb,null))[_0x05ec('0x2b')](saveUpdates(_0x52dfd6['body'],null))[_0x05ec('0x2b')](respondWithResult(_0x267edb,null))[_0x05ec('0x48')](handleError(_0x267edb,null));};exports[_0x05ec('0x99')]=function(_0x1851c2,_0x3525ed,_0x51c43c){return db[_0x05ec('0x33')][_0x05ec('0x4d')]({'where':{'id':_0x1851c2['params']['id']}})[_0x05ec('0x2b')](function(_0x55d136){if(_0x55d136){return _0x55d136[_0x05ec('0x2c')]();}})[_0x05ec('0x2b')](function(_0x2875dc){rimraf(path[_0x05ec('0x4f')](config[_0x05ec('0x50')],_0x05ec('0x51'),path[_0x05ec('0x9a')](_0x2875dc[_0x05ec('0x8')])),function(){});return _0x2875dc;})[_0x05ec('0x2b')](handleEntityNotFound(_0x3525ed,null))[_0x05ec('0x2b')](respondWithStatusCode(_0x3525ed,null))[_0x05ec('0x48')](handleError(_0x3525ed,null));};exports[_0x05ec('0x9b')]=function(_0x4cb8a7,_0x37d24f,_0x4c8af6){return BPromise['resolve']()[_0x05ec('0x2b')](function(){if(!_0x4cb8a7[_0x05ec('0x38')]['path']){throw new Error(_0x05ec('0x9c'));}if(!_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xb71852=_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9e')]?_0x4cb8a7['query']['hostname']+':'+_0x4cb8a7[_0x05ec('0x38')]['port']:'http://localhost:'+_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9d')];var _0xa212e2=_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x21')]?_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x21')]:!![];var _0x5a569e=_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9f')]?_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9f')]:null;var _0x30dc63={'method':_0x4cb8a7['method'],'uri':util['format']('%s%s',_0xb71852,_0x4cb8a7[_0x05ec('0x38')]['path']),'json':_0xa212e2,'resolveWithFullResponse':!![],'encoding':_0x5a569e,'qs':_0x4cb8a7[_0x05ec('0x38')]};if(_0x4cb8a7['headers']){_0x30dc63[_0x05ec('0xa0')]=_0x4cb8a7[_0x05ec('0xa0')];if(_0x30dc63[_0x05ec('0xa0')][_0x05ec('0xa1')]){delete _0x30dc63[_0x05ec('0xa0')][_0x05ec('0xa1')];}}if(_0x30dc63[_0x05ec('0xa0')][_0x05ec('0xa2')]){delete _0x30dc63['headers'][_0x05ec('0xa2')];}return rp(_0x30dc63);})[_0x05ec('0x2b')](function(_0x351fad){if(_0x351fad){_0x37d24f['set'](_0x351fad[_0x05ec('0xa0')]);logger['info'](_0x351fad[_0x05ec('0x8e')]);if(_[_0x05ec('0xa3')](_0x4cb8a7['query'][_0x05ec('0x8')],_0x05ec('0x4e'))&&_0x351fad[_0x05ec('0xa4')]==0x1f4){return _0x37d24f[_0x05ec('0x1e')](_0x351fad['statusCode']);}else{return _0x37d24f['status'](_0x351fad['statusCode'])[_0x05ec('0x31')](_0x351fad['body']);}}else{return _0x37d24f['sendStatus'](0xc8);}})['catch'](handleError(_0x37d24f,null));};exports[_0x05ec('0xa5')]=function(_0x5c37f0,_0x41cca8,_0x2f9447){return BPromise['resolve']()[_0x05ec('0x2b')](function(){if(!_0x5c37f0['query'][_0x05ec('0x8')]){throw new Error(_0x05ec('0x9c'));}if(!_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x10d71d=_0x5c37f0['query'][_0x05ec('0x9e')]?_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x9e')]+':'+_0x5c37f0['query'][_0x05ec('0x9d')]:_0x05ec('0xa6')+_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x9d')];var _0x3982d2=_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x21')]?_0x5c37f0['query'][_0x05ec('0x21')]:!![];var _0x5e7202=_0x5c37f0['query']['encoding']?_0x5c37f0['query'][_0x05ec('0x9f')]:null;var _0xf13272={'method':_0x5c37f0[_0x05ec('0xa7')],'uri':util[_0x05ec('0x52')](_0x05ec('0xa8'),_0x10d71d,_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x8')]),'json':_0x3982d2,'resolveWithFullResponse':!![],'encoding':_0x5e7202,'body':_0x5c37f0['body']};if(_0x5c37f0[_0x05ec('0xa0')]){_0xf13272[_0x05ec('0xa0')]=_0x5c37f0[_0x05ec('0xa0')];if(_0xf13272[_0x05ec('0xa0')][_0x05ec('0xa1')]){delete _0xf13272[_0x05ec('0xa0')][_0x05ec('0xa1')];}}if(_0xf13272['headers'][_0x05ec('0xa2')]){delete _0xf13272['headers'][_0x05ec('0xa2')];}return rp(_0xf13272);})[_0x05ec('0x2b')](function(_0x50d7e1){if(_0x50d7e1){_0x41cca8[_0x05ec('0x26')](_0x50d7e1[_0x05ec('0xa0')]);logger[_0x05ec('0x65')](_0x50d7e1['body']);return _0x41cca8[_0x05ec('0x1f')](_0x50d7e1[_0x05ec('0xa4')])[_0x05ec('0x31')](_0x50d7e1[_0x05ec('0x8e')]);}else{return _0x41cca8['sendStatus'](0xc8);}})[_0x05ec('0x48')](handleError(_0x41cca8,null));}; \ No newline at end of file +var _0x14e9=['icon-apps','html','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','role','body','userProfileId','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','destroy','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','method','headers','content-length','statusCode','webhookPost','encoding','%s%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','extract-zip','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','get','UserProfileResource','stack','name','index','map','Plugin','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','join','root','format','basename','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon'];(function(_0x4e10dc,_0x3139ed){var _0x124eec=function(_0x572c2b){while(--_0x572c2b){_0x4e10dc['push'](_0x4e10dc['shift']());}};_0x124eec(++_0x3139ed);}(_0x14e9,0xcb));var _0x914e=function(_0x498885,_0x14d6dd){_0x498885=_0x498885-0x0;var _0x1dc023=_0x14e9[_0x498885];return _0x1dc023;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x914e('0x0'));var zipdir=require(_0x914e('0x1'));var jsonpatch=require(_0x914e('0x2'));var rp=require(_0x914e('0x3'));var moment=require(_0x914e('0x4'));var BPromise=require(_0x914e('0x5'));var Mustache=require(_0x914e('0x6'));var util=require(_0x914e('0x7'));var path=require(_0x914e('0x8'));var sox=require(_0x914e('0x9'));var csv=require(_0x914e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x914e('0xb'));var _=require(_0x914e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x914e('0xd'));var deskjs=require(_0x914e('0xe'));var toCsv=require(_0x914e('0xa'));var querystring=require(_0x914e('0xf'));var Papa=require(_0x914e('0x10'));var extract=require(_0x914e('0x11'));var rimraf=require(_0x914e('0x0'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x914e('0x12'));var qs=require(_0x914e('0x13'));var as=require(_0x914e('0x14'));var hardwareService=require(_0x914e('0x15'));var logger=require(_0x914e('0x16'))(_0x914e('0x17'));var utils=require(_0x914e('0x18'));var config=require(_0x914e('0x19'));var licenseUtil=require(_0x914e('0x1a'));var db=require('../../mysqldb')['db'];config[_0x914e('0x1b')]=_[_0x914e('0x1c')](config[_0x914e('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x914e('0x1d'))(new Redis(config['redis']));require(_0x914e('0x1e'))[_0x914e('0x1f')](socket);function respondWithStatusCode(_0x4f946a,_0x31a69e){_0x31a69e=_0x31a69e||0xcc;return function(_0x43bb98){if(_0x43bb98){return _0x4f946a[_0x914e('0x20')](_0x31a69e);}return _0x4f946a[_0x914e('0x21')](_0x31a69e)[_0x914e('0x22')]();};}function respondWithResult(_0x34ea46,_0xae19b){_0xae19b=_0xae19b||0xc8;return function(_0x581c63){if(_0x581c63){return _0x34ea46[_0x914e('0x21')](_0xae19b)[_0x914e('0x23')](_0x581c63);}};}function respondWithFilteredResult(_0x5bef67,_0x4150b8){return function(_0x39349a){if(_0x39349a){var _0x5d6d3c=typeof _0x4150b8[_0x914e('0x24')]===_0x914e('0x25')&&typeof _0x4150b8['limit']===_0x914e('0x25');var _0x5cc16f=_0x39349a[_0x914e('0x26')];var _0x561d21=_0x5d6d3c?0x0:_0x4150b8[_0x914e('0x24')];var _0x4ba0d0=_0x5d6d3c?_0x39349a['count']:_0x4150b8['offset']+_0x4150b8[_0x914e('0x27')];var _0x16a67f;if(_0x4ba0d0>=_0x5cc16f){_0x4ba0d0=_0x5cc16f;_0x16a67f=0xc8;}else{_0x16a67f=0xce;}_0x5bef67['status'](_0x16a67f);return _0x5bef67[_0x914e('0x28')]('Content-Range',_0x561d21+'-'+_0x4ba0d0+'/'+_0x5cc16f)[_0x914e('0x23')](_0x39349a);}return null;};}function patchUpdates(_0x1dd626){return function(_0xeffbb9){try{jsonpatch[_0x914e('0x29')](_0xeffbb9,_0x1dd626,!![]);}catch(_0x8540b1){return BPromise[_0x914e('0x2a')](_0x8540b1);}return _0xeffbb9[_0x914e('0x2b')]();};}function saveUpdates(_0x1965b5,_0x3534c5){return function(_0x6d02cc){if(_0x6d02cc){return _0x6d02cc[_0x914e('0x2c')](_0x1965b5)[_0x914e('0x2d')](function(_0x2a6876){return _0x2a6876;});}return null;};}function removeEntity(_0x36d3ea,_0xb35b0e){return function(_0x2c5009){if(_0x2c5009){return _0x2c5009['destroy']()[_0x914e('0x2d')](function(){var _0x3fdb33=_0x2c5009[_0x914e('0x2e')]({'plain':!![]});var _0x324ded='Plugins';return db[_0x914e('0x2f')]['destroy']({'where':{'type':_0x324ded,'resourceId':_0x3fdb33['id']}})['then'](function(){return _0x2c5009;});})[_0x914e('0x2d')](function(){_0x36d3ea[_0x914e('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e596,_0x5bc20c){return function(_0x6d04c6){if(!_0x6d04c6){_0x15e596['sendStatus'](0x194);}return _0x6d04c6;};}function handleError(_0x3cc63e,_0xa97981){_0xa97981=_0xa97981||0x1f4;return function(_0x531844){logger['error'](_0x531844[_0x914e('0x30')]);if(_0x531844[_0x914e('0x31')]){delete _0x531844[_0x914e('0x31')];}_0x3cc63e[_0x914e('0x21')](_0xa97981)['send'](_0x531844);};}exports[_0x914e('0x32')]=function(_0x16e2fd,_0x180887){var _0x4e0375={},_0x3d0535={},_0x14cbd0={'count':0x0,'rows':[]};var _0x5c7333=_[_0x914e('0x33')](db[_0x914e('0x34')]['rawAttributes'],function(_0x565014){return{'name':_0x565014[_0x914e('0x35')],'type':_0x565014[_0x914e('0x36')][_0x914e('0x37')]};});_0x3d0535['model']=_[_0x914e('0x33')](_0x5c7333,_0x914e('0x31'));_0x3d0535[_0x914e('0x38')]=_[_0x914e('0x39')](_0x16e2fd[_0x914e('0x38')]);_0x3d0535[_0x914e('0x3a')]=_[_0x914e('0x3b')](_0x3d0535[_0x914e('0x3c')],_0x3d0535[_0x914e('0x38')]);_0x4e0375['attributes']=_[_0x914e('0x3b')](_0x3d0535[_0x914e('0x3c')],qs['fields'](_0x16e2fd[_0x914e('0x38')][_0x914e('0x3d')]));_0x4e0375[_0x914e('0x3e')]=_0x4e0375[_0x914e('0x3e')]['length']?_0x4e0375[_0x914e('0x3e')]:_0x3d0535['model'];if(!_0x16e2fd[_0x914e('0x38')]['hasOwnProperty'](_0x914e('0x3f'))){_0x4e0375[_0x914e('0x27')]=qs['limit'](_0x16e2fd[_0x914e('0x38')]['limit']);_0x4e0375[_0x914e('0x24')]=qs[_0x914e('0x24')](_0x16e2fd[_0x914e('0x38')][_0x914e('0x24')]);}_0x4e0375[_0x914e('0x40')]=qs[_0x914e('0x41')](_0x16e2fd[_0x914e('0x38')]['sort']);_0x4e0375['where']=qs['filters'](_[_0x914e('0x42')](_0x16e2fd[_0x914e('0x38')],_0x3d0535['filters']),_0x5c7333);if(_0x16e2fd[_0x914e('0x38')][_0x914e('0x43')]){_0x4e0375['where']=_[_0x914e('0x44')](_0x4e0375[_0x914e('0x45')],{'$or':_[_0x914e('0x33')](_0x5c7333,function(_0xd9ce4c){if(_0xd9ce4c['type']!=='VIRTUAL'){var _0x3a9e34={};_0x3a9e34[_0xd9ce4c[_0x914e('0x31')]]={'$like':'%'+_0x16e2fd[_0x914e('0x38')][_0x914e('0x43')]+'%'};return _0x3a9e34;}})});}_0x4e0375=_[_0x914e('0x44')]({},_0x4e0375,_0x16e2fd[_0x914e('0x46')]);var _0x2ac627={'where':_0x4e0375[_0x914e('0x45')]};return db[_0x914e('0x34')]['count'](_0x2ac627)['then'](function(_0x35f584){_0x14cbd0[_0x914e('0x26')]=_0x35f584;if(_0x16e2fd[_0x914e('0x38')][_0x914e('0x47')]){_0x4e0375[_0x914e('0x48')]=[{'all':!![]}];}return db[_0x914e('0x34')]['findAll'](_0x4e0375);})['then'](function(_0x5dce56){_0x14cbd0[_0x914e('0x49')]=_0x5dce56;return _0x14cbd0;})[_0x914e('0x2d')](respondWithFilteredResult(_0x180887,_0x4e0375))[_0x914e('0x4a')](handleError(_0x180887,null));};exports[_0x914e('0x4b')]=function(_0x4850f0,_0x5b64e9){var _0x2f7850={'raw':!![],'where':{'id':_0x4850f0[_0x914e('0x4c')]['id']}},_0x593a49={};_0x593a49[_0x914e('0x3c')]=_[_0x914e('0x39')](db[_0x914e('0x34')][_0x914e('0x4d')]);_0x593a49[_0x914e('0x38')]=_[_0x914e('0x39')](_0x4850f0[_0x914e('0x38')]);_0x593a49[_0x914e('0x3a')]=_['intersection'](_0x593a49[_0x914e('0x3c')],_0x593a49[_0x914e('0x38')]);_0x2f7850[_0x914e('0x3e')]=_['intersection'](_0x593a49['model'],qs[_0x914e('0x3d')](_0x4850f0[_0x914e('0x38')][_0x914e('0x3d')]));_0x2f7850[_0x914e('0x3e')]=_0x2f7850[_0x914e('0x3e')][_0x914e('0x4e')]?_0x2f7850[_0x914e('0x3e')]:_0x593a49['model'];if(_0x4850f0['query'][_0x914e('0x47')]){_0x2f7850['include']=[{'all':!![]}];}_0x2f7850=_[_0x914e('0x44')]({},_0x2f7850,_0x4850f0[_0x914e('0x46')]);return db[_0x914e('0x34')][_0x914e('0x4f')](_0x2f7850)[_0x914e('0x2d')](handleEntityNotFound(_0x5b64e9,null))[_0x914e('0x2d')](respondWithResult(_0x5b64e9,null))[_0x914e('0x4a')](handleError(_0x5b64e9,null));};exports['download']=function(_0x44e7a9,_0x35ebb8,_0x449f31){return db[_0x914e('0x34')]['find']({'where':{'id':_0x44e7a9[_0x914e('0x4c')]['id']},'attributes':[_0x914e('0x31'),_0x914e('0x8')],'raw':!![]})[_0x914e('0x2d')](handleEntityNotFound(_0x35ebb8,null))[_0x914e('0x2d')](function(_0x406f90){if(_0x406f90){var _0x74a012=path[_0x914e('0x50')](config[_0x914e('0x51')],'server/files/plugins',util[_0x914e('0x52')]('%s.zip',path[_0x914e('0x53')](_0x406f90[_0x914e('0x8')])));var _0x213ddc=fs[_0x914e('0x54')](_0x74a012);var _0x16cb9b=archiver(_0x914e('0x55'),{'zlib':{'level':0x9}});_0x16cb9b['on'](_0x914e('0x56'),function(_0x2d98d4){if(_0x2d98d4[_0x914e('0x57')]===_0x914e('0x58')){logger[_0x914e('0x59')](_0x2d98d4);}else{throw new db[(_0x914e('0x5a'))][(_0x914e('0x5b'))](_0x914e('0x5c'));}});_0x16cb9b['on'](_0x914e('0x59'),function(_0x51844c){throw new db[(_0x914e('0x5a'))][(_0x914e('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x16cb9b[_0x914e('0x5d')](_0x213ddc);_0x16cb9b[_0x914e('0x5e')](_0x914e('0x5f'),{'cwd':path['join'](config[_0x914e('0x51')],_0x914e('0x60'),path[_0x914e('0x61')](_0x406f90['path'])),'ignore':[path[_0x914e('0x50')](path['basename'](_0x406f90['path']),_0x914e('0x62')),path[_0x914e('0x50')](path['basename'](_0x406f90[_0x914e('0x8')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x213ddc['on'](_0x914e('0x63'),function(){if(!fs[_0x914e('0x64')](_0x74a012)){throw new db[(_0x914e('0x5a'))][(_0x914e('0x5b'))](_0x914e('0x65'));}return _0x35ebb8[_0x914e('0x66')](_0x74a012,util['format'](_0x914e('0x67'),path[_0x914e('0x53')](_0x406f90[_0x914e('0x8')])),function(_0x481b0c){if(_0x481b0c){throw new db[(_0x914e('0x5a'))]['Error'](_0x914e('0x68'));}fs['unlinkSync'](_0x74a012);logger['info'](_0x914e('0x69'));logger[_0x914e('0x6a')](_0x914e('0x6b'));});});}return null;})['catch'](handleError(_0x35ebb8,null));};exports['upload']=function(_0x508200,_0xa4857a,_0x1c6d07){var _0x14fffe=path['basename'](_0x508200[_0x914e('0x6c')][_0x914e('0x6d')],path[_0x914e('0x6e')](_0x508200[_0x914e('0x6c')][_0x914e('0x6d')]));var _0x5cf9a2=path[_0x914e('0x50')](config[_0x914e('0x51')],_0x914e('0x60'),_0x508200[_0x914e('0x6c')][_0x914e('0x6d')]);var _0x3fc645=path[_0x914e('0x50')](config[_0x914e('0x51')],_0x914e('0x60'),_0x14fffe);logger[_0x914e('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x5cf9a2);logger[_0x914e('0x6a')](_0x914e('0x6f'),_0x3fc645);try{fs[_0x914e('0x70')](_0x5cf9a2,parseInt('0777',0x8));extract(_0x5cf9a2,{'dir':_0x3fc645},function(_0x37b607){if(_0x37b607){logger[_0x914e('0x59')](_0x37b607);handleError(_0x37b607,!![]);};var _0x1e3389=fs[_0x914e('0x71')](_0x3fc645);if(_0x1e3389['length']>0x1){removeReferences(_0x5cf9a2,_0x3fc645);logger[_0x914e('0x59')](_0x914e('0x72'));return _0x1c6d07(new Error('Invalid\x20plugin\x20structure'));}var _0x4aa308=fs[_0x914e('0x73')](path['join'](_0x3fc645,_0x1e3389[0x0]));if(_0x4aa308['isFile']()){removeReferences(_0x5cf9a2,_0x3fc645);logger[_0x914e('0x59')](_0x914e('0x72'));return _0x1c6d07(new Error(_0x914e('0x72')));}if(_0x4aa308[_0x914e('0x74')]()){var _0x343440=fs['readdirSync'](path['join'](_0x3fc645,_0x1e3389[0x0]));if(_0x343440['length']===0x0){removeReferences(_0x5cf9a2,_0x3fc645);logger['error']('Invalid\x20plugin\x20structure');return _0x1c6d07(new Error(_0x914e('0x72')));}var _0x569349=_0x343440['some'](function(_0xb63ec7){return _0xb63ec7===_0x914e('0x75');});if(!_0x569349){return _0x1c6d07(new Error(_0x914e('0x76')));}var _0x31e3f2=fs[_0x914e('0x77')](path[_0x914e('0x50')](_0x3fc645,_0x1e3389[0x0],'manifest.json'));var _0x4bc666=JSON[_0x914e('0x78')](_0x31e3f2);if(_0x914e('0x25')==typeof _0x4bc666[_0x914e('0x31')]){return _0x1c6d07(new Error(_0x914e('0x79')));}if(_0x914e('0x25')==typeof _0x4bc666[_0x914e('0x36')]){return _0x1c6d07(new Error(_0x914e('0x7a')));}if('undefined'==typeof _0x4bc666[_0x914e('0x7b')]){return _0x1c6d07(new Error(_0x914e('0x7c')));}if(_0x914e('0x25')==typeof _0x4bc666[_0x914e('0x7d')]){return _0x1c6d07(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4bc666[_0x914e('0x36')]==='html'){if('undefined'==typeof _0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')]){return _0x1c6d07(new Error(_0x914e('0x7f')));}if(_0x914e('0x25')==typeof _0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')][_0x914e('0x80')]&&_0x914e('0x25')==typeof _0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')][_0x914e('0x81')]){return _0x1c6d07(new Error(_0x914e('0x82')));}}else if(_0x4bc666['type']===_0x914e('0x83')){if(_0x914e('0x25')==typeof _0x4bc666[_0x914e('0x7d')][_0x914e('0x84')]){return _0x1c6d07(new Error(_0x914e('0x85')));}if(_0x914e('0x25')==typeof _0x4bc666['parameters'][_0x914e('0x86')]){return _0x1c6d07(new Error(_0x914e('0x87')));}}else{return _0x1c6d07(new Error(_0x914e('0x88')));}var _0x382288=_0x4bc666[_0x914e('0x31')];var _0x16684c=_0x4bc666[_0x914e('0x89')];var _0x398cd1=_0x4bc666[_0x914e('0x36')];var _0x15fb98=_0x4bc666[_0x914e('0x8a')]?_0x4bc666[_0x914e('0x8a')]:_0x914e('0x8b');var _0x2aa988=_0x4bc666[_0x914e('0x8c')]?_0x4bc666[_0x914e('0x8c')]:_0x914e('0x8d');var _0x33f895='';var _0x235828='';var _0x39aeb9='';var _0x10d004='';var _0x1b5671=_0x4bc666[_0x914e('0x7b')];if(_0x398cd1===_0x914e('0x8e')){if(_0x914e('0x25')!=typeof _0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')][_0x914e('0x80')]){var _0x252557=_0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x914e('0x8f')](_0x252557)){_0x33f895=path[_0x914e('0x50')]('plugins',_0x14fffe,_0x1e3389[0x0],_0x252557);}else{_0x33f895=_0x252557;}}else{logger['info'](_0x914e('0x90'));}if(_0x914e('0x25')!=typeof _0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')][_0x914e('0x81')]){var _0x5cc27f=_0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x914e('0x8f')](_0x5cc27f)){_0x235828=path[_0x914e('0x50')]('plugins',_0x14fffe,_0x1e3389[0x0],_0x5cc27f);}else{_0x235828=_0x5cc27f;}}else{logger[_0x914e('0x6a')](_0x914e('0x91'));}}else if(_0x398cd1===_0x914e('0x83')){_0x39aeb9=_0x4bc666['parameters']['scriptName'];_0x10d004=_0x4bc666[_0x914e('0x7d')][_0x914e('0x86')];if(_0x914e('0x25')!=typeof _0x4bc666[_0x914e('0x7d')]['views']){if('undefined'!=typeof _0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')][_0x914e('0x80')]){var _0x252557=_0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')][_0x914e('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x252557)){_0x33f895=path['join'](_0x914e('0x92'),_0x14fffe,_0x1e3389[0x0],_0x252557);}else{_0x33f895=_0x252557;}}if('undefined'!=typeof _0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')][_0x914e('0x81')]){var _0x5cc27f=_0x4bc666[_0x914e('0x7d')][_0x914e('0x7e')][_0x914e('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5cc27f)){_0x235828=path[_0x914e('0x50')](_0x914e('0x92'),_0x14fffe,_0x1e3389[0x0],_0x5cc27f);}else{_0x235828=_0x5cc27f;}}}}var _0x47a5e2={'name':_0x382288,'description':_0x16684c,'path':path[_0x914e('0x50')](_0x14fffe,_0x1e3389[0x0]),'type':_0x398cd1,'sidebar':_0x15fb98,'icon':_0x2aa988,'adminUrl':_0x33f895,'agentUrl':_0x235828,'scriptName':_0x39aeb9,'scriptPath':_0x10d004,'version':_0x1b5671};removeReferences(_0x5cf9a2,null);return db[_0x914e('0x34')][_0x914e('0x93')](_0x47a5e2)['then'](function(_0x485dff){var _0x59ed38={'role':_0x508200['body'][_0x914e('0x94')],'userProfileId':_0x508200[_0x914e('0x95')][_0x914e('0x96')]};if(!_0x59ed38)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59ed38[_0x914e('0x94')]==='user'){var _0x48c3c9=_0x485dff[_0x914e('0x2e')]({'plain':!![]});return db['UserProfileSection'][_0x914e('0x4f')]({'where':{'name':_0x914e('0x97'),'userProfileId':_0x59ed38[_0x914e('0x96')]},'raw':!![]})[_0x914e('0x2d')](function(_0x16ef1c){if(_0x16ef1c&&_0x16ef1c[_0x914e('0x98')]===0x0){return db[_0x914e('0x2f')][_0x914e('0x93')]({'name':_0x48c3c9[_0x914e('0x31')],'resourceId':_0x48c3c9['id'],'type':_0x16ef1c[_0x914e('0x31')],'sectionId':_0x16ef1c['id']},{})[_0x914e('0x2d')](function(){return _0x485dff;});}else{return _0x485dff;}})[_0x914e('0x4a')](function(_0x2c67ba){logger[_0x914e('0x59')](_0x914e('0x99'),_0x2c67ba);throw _0x2c67ba;});}return _0x485dff;})['then'](respondWithResult(_0xa4857a,null))[_0x914e('0x4a')](handleError(_0xa4857a,null));}});}catch(_0x36fe1d){_0xa4857a[_0x914e('0x21')](0x1f4)[_0x914e('0x9a')](_0x36fe1d);}};function removeReferences(_0x5c1e89,_0x2a9584){try{if(_0x5c1e89){fs[_0x914e('0x9b')](_0x5c1e89);logger[_0x914e('0x6a')](_0x914e('0x9c'));}if(_0x2a9584){rimraf(_0x2a9584,function(){});logger[_0x914e('0x6a')](_0x914e('0x9d'));}}catch(_0xdf7c8d){logger[_0x914e('0x59')](_0xdf7c8d);}}exports[_0x914e('0x2c')]=function(_0x13bdbc,_0x1ca318,_0x133b10){return db[_0x914e('0x34')][_0x914e('0x4f')]({'where':{'id':_0x13bdbc[_0x914e('0x4c')]['id']}})[_0x914e('0x2d')](handleEntityNotFound(_0x1ca318,null))['then'](saveUpdates(_0x13bdbc['body'],null))['then'](respondWithResult(_0x1ca318,null))[_0x914e('0x4a')](handleError(_0x1ca318,null));};exports[_0x914e('0x9e')]=function(_0x359906,_0x16338f,_0x311956){return db[_0x914e('0x34')]['find']({'where':{'id':_0x359906['params']['id']}})[_0x914e('0x2d')](function(_0x1d5ac7){if(_0x1d5ac7){return _0x1d5ac7[_0x914e('0x9f')]();}})['then'](function(_0x23b85d){rimraf(path[_0x914e('0x50')](config['root'],'server/files/plugins',path[_0x914e('0x61')](_0x23b85d['path'])),function(){});return _0x23b85d;})['then'](handleEntityNotFound(_0x16338f,null))[_0x914e('0x2d')](respondWithStatusCode(_0x16338f,null))[_0x914e('0x4a')](handleError(_0x16338f,null));};exports['webhookGet']=function(_0x5bec15,_0x13d2b1,_0x519a05){return BPromise[_0x914e('0xa0')]()[_0x914e('0x2d')](function(){if(!_0x5bec15[_0x914e('0x38')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5bec15[_0x914e('0x38')][_0x914e('0xa1')]){throw new Error(_0x914e('0xa2'));}var _0x33f8a0=_0x5bec15[_0x914e('0x38')][_0x914e('0xa3')]?_0x5bec15[_0x914e('0x38')][_0x914e('0xa3')]+':'+_0x5bec15['query'][_0x914e('0xa1')]:_0x914e('0xa4')+_0x5bec15[_0x914e('0x38')][_0x914e('0xa1')];var _0x1c04df=_0x5bec15[_0x914e('0x38')][_0x914e('0x23')]?_0x5bec15[_0x914e('0x38')][_0x914e('0x23')]:!![];var _0x5de03c=_0x5bec15['query']['encoding']?_0x5bec15[_0x914e('0x38')]['encoding']:null;var _0x1a39bf={'method':_0x5bec15[_0x914e('0xa5')],'uri':util[_0x914e('0x52')]('%s%s',_0x33f8a0,_0x5bec15[_0x914e('0x38')]['path']),'json':_0x1c04df,'resolveWithFullResponse':!![],'encoding':_0x5de03c,'qs':_0x5bec15[_0x914e('0x38')]};if(_0x5bec15[_0x914e('0xa6')]){_0x1a39bf['headers']=_0x5bec15['headers'];if(_0x1a39bf['headers'][_0x914e('0xa7')]){delete _0x1a39bf[_0x914e('0xa6')][_0x914e('0xa7')];}}if(_0x1a39bf[_0x914e('0xa6')]['content-type']){delete _0x1a39bf[_0x914e('0xa6')]['content-type'];}return rp(_0x1a39bf);})[_0x914e('0x2d')](function(_0x7d32fe){if(_0x7d32fe){_0x13d2b1['set'](_0x7d32fe['headers']);logger[_0x914e('0x6a')](_0x7d32fe[_0x914e('0x95')]);if(_['endsWith'](_0x5bec15[_0x914e('0x38')][_0x914e('0x8')],'download')&&_0x7d32fe[_0x914e('0xa8')]==0x1f4){return _0x13d2b1[_0x914e('0x20')](_0x7d32fe[_0x914e('0xa8')]);}else{return _0x13d2b1[_0x914e('0x21')](_0x7d32fe[_0x914e('0xa8')])[_0x914e('0x9a')](_0x7d32fe[_0x914e('0x95')]);}}else{return _0x13d2b1[_0x914e('0x20')](0xc8);}})['catch'](handleError(_0x13d2b1,null));};exports[_0x914e('0xa9')]=function(_0x758d67,_0x1265b6,_0x392f88){return BPromise['resolve']()[_0x914e('0x2d')](function(){if(!_0x758d67[_0x914e('0x38')][_0x914e('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x758d67[_0x914e('0x38')][_0x914e('0xa1')]){throw new Error(_0x914e('0xa2'));}var _0x3146c7=_0x758d67[_0x914e('0x38')][_0x914e('0xa3')]?_0x758d67[_0x914e('0x38')]['hostname']+':'+_0x758d67[_0x914e('0x38')][_0x914e('0xa1')]:_0x914e('0xa4')+_0x758d67['query'][_0x914e('0xa1')];var _0x533d77=_0x758d67[_0x914e('0x38')]['json']?_0x758d67[_0x914e('0x38')][_0x914e('0x23')]:!![];var _0x4139d2=_0x758d67['query'][_0x914e('0xaa')]?_0x758d67[_0x914e('0x38')][_0x914e('0xaa')]:null;var _0x2c3dcb={'method':_0x758d67[_0x914e('0xa5')],'uri':util['format'](_0x914e('0xab'),_0x3146c7,_0x758d67[_0x914e('0x38')][_0x914e('0x8')]),'json':_0x533d77,'resolveWithFullResponse':!![],'encoding':_0x4139d2,'body':_0x758d67[_0x914e('0x95')]};if(_0x758d67[_0x914e('0xa6')]){_0x2c3dcb[_0x914e('0xa6')]=_0x758d67[_0x914e('0xa6')];if(_0x2c3dcb[_0x914e('0xa6')][_0x914e('0xa7')]){delete _0x2c3dcb['headers'][_0x914e('0xa7')];}}if(_0x2c3dcb[_0x914e('0xa6')]['content-type']){delete _0x2c3dcb[_0x914e('0xa6')]['content-type'];}return rp(_0x2c3dcb);})['then'](function(_0x4e429a){if(_0x4e429a){_0x1265b6[_0x914e('0x28')](_0x4e429a[_0x914e('0xa6')]);logger['info'](_0x4e429a[_0x914e('0x95')]);return _0x1265b6[_0x914e('0x21')](_0x4e429a[_0x914e('0xa8')])[_0x914e('0x9a')](_0x4e429a['body']);}else{return _0x1265b6['sendStatus'](0xc8);}})[_0x914e('0x4a')](handleError(_0x1265b6,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index cac328a..944adf3 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 _0x4074=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin'];(function(_0x3b4113,_0x57170d){var _0x1f61f1=function(_0x115d45){while(--_0x115d45){_0x3b4113['push'](_0x3b4113['shift']());}};_0x1f61f1(++_0x57170d);}(_0x4074,0xf0));var _0x4407=function(_0x2ca0d7,_0x52ca78){_0x2ca0d7=_0x2ca0d7-0x0;var _0x178489=_0x4074[_0x2ca0d7];return _0x178489;};'use strict';var EventEmitter=require(_0x4407('0x0'));var Plugin=require(_0x4407('0x1'))['db'][_0x4407('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4407('0x3'),'afterUpdate':_0x4407('0x4'),'afterDestroy':_0x4407('0x5')};function emitEvent(_0x35ad38){return function(_0x188494,_0x3c9f5c,_0x445548){PluginEvents[_0x4407('0x6')](_0x35ad38+':'+_0x188494['id'],_0x188494);PluginEvents[_0x4407('0x6')](_0x35ad38,_0x188494);_0x445548(null);};}for(var e in events){if(events[_0x4407('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x4407('0x8')]=PluginEvents; \ No newline at end of file +var _0x7f05=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','save'];(function(_0x561676,_0x2c578b){var _0x565834=function(_0x1b3cf6){while(--_0x1b3cf6){_0x561676['push'](_0x561676['shift']());}};_0x565834(++_0x2c578b);}(_0x7f05,0xdc));var _0x57f0=function(_0x388de0,_0x2b36e9){_0x388de0=_0x388de0-0x0;var _0x4ae1ca=_0x7f05[_0x388de0];return _0x4ae1ca;};'use strict';var EventEmitter=require(_0x57f0('0x0'));var Plugin=require(_0x57f0('0x1'))['db'][_0x57f0('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x57f0('0x3'),'afterUpdate':'update','afterDestroy':_0x57f0('0x4')};function emitEvent(_0x3d1eec){return function(_0x52bde5,_0x25b25f,_0x615ad9){PluginEvents['emit'](_0x3d1eec+':'+_0x52bde5['id'],_0x52bde5);PluginEvents[_0x57f0('0x5')](_0x3d1eec,_0x52bde5);_0x615ad9(null);};}for(var e in events){if(events[_0x57f0('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x57f0('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 056feef..3593f79 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 _0x1fd9=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x6e3ab7,_0x4e4c80){var _0x25f2b4=function(_0x5e045a){while(--_0x5e045a){_0x6e3ab7['push'](_0x6e3ab7['shift']());}};_0x25f2b4(++_0x4e4c80);}(_0x1fd9,0x19b));var _0x91fd=function(_0x33f605,_0x3d7bbf){_0x33f605=_0x33f605-0x0;var _0x42fe6a=_0x1fd9[_0x33f605];return _0x42fe6a;};'use strict';var _=require(_0x91fd('0x0'));var util=require(_0x91fd('0x1'));var logger=require(_0x91fd('0x2'))(_0x91fd('0x3'));var moment=require(_0x91fd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x91fd('0x5'));var rimraf=require(_0x91fd('0x6'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x91fd('0x7')]=function(_0x350d75,_0x1eaa48){return _0x350d75[_0x91fd('0x8')](_0x91fd('0x9'),attributes,{'tableName':_0x91fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcae6=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./plugin.attributes','exports','define','plugins','lodash','util'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xcae6,0x1ae));var _0x6cae=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0xcae6[_0x3a0ebd];return _0x51a660;};'use strict';var _=require(_0x6cae('0x0'));var util=require(_0x6cae('0x1'));var logger=require(_0x6cae('0x2'))(_0x6cae('0x3'));var moment=require('moment');var BPromise=require(_0x6cae('0x4'));var rp=require(_0x6cae('0x5'));var fs=require('fs');var path=require(_0x6cae('0x6'));var rimraf=require('rimraf');var config=require(_0x6cae('0x7'));var attributes=require(_0x6cae('0x8'));module[_0x6cae('0x9')]=function(_0x3b97ae,_0x470cac){return _0x3b97ae[_0x6cae('0xa')]('Plugin',attributes,{'tableName':_0x6cae('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 8506fe5..2256b5a 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 _0x07f5=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','request\x20sent','debug','stringify','code','error','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','Plugin','create','options','then','lodash','util','moment','bluebird','randomstring'];(function(_0x32eecd,_0x1774f4){var _0xac7061=function(_0x3c4c07){while(--_0x3c4c07){_0x32eecd['push'](_0x32eecd['shift']());}};_0xac7061(++_0x1774f4);}(_0x07f5,0xc1));var _0x507f=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x07f5[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x507f('0x0'));var util=require(_0x507f('0x1'));var moment=require(_0x507f('0x2'));var BPromise=require(_0x507f('0x3'));var rs=require(_0x507f('0x4'));var fs=require('fs');var Redis=require(_0x507f('0x5'));var db=require(_0x507f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x507f('0x7'))(_0x507f('0x8'));var config=require(_0x507f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x507f('0xa')][_0x507f('0xb')]({'port':0x232a});config[_0x507f('0xc')]=_[_0x507f('0xd')](config[_0x507f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x507f('0xe'))(new Redis(config[_0x507f('0xc')]));require(_0x507f('0xf'))[_0x507f('0x10')](socket);function respondWithRpcPromise(_0x4fd84c,_0x6633f0,_0x48d3f3){return new BPromise(function(_0x738740,_0x54c9db){return client[_0x507f('0x11')](_0x4fd84c,_0x48d3f3)['then'](function(_0x343c93){logger['info']('Plugin,\x20%s,\x20%s',_0x6633f0,_0x507f('0x12'));logger[_0x507f('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x6633f0,_0x507f('0x12'),JSON[_0x507f('0x14')](_0x343c93));if(_0x343c93['error']){if(_0x343c93['error'][_0x507f('0x15')]===0x1f4){logger[_0x507f('0x16')](_0x507f('0x17'),_0x6633f0,_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);return _0x54c9db(_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);}logger[_0x507f('0x16')]('Plugin,\x20%s,\x20%s',_0x6633f0,_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);return _0x738740(_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);}else{logger[_0x507f('0x19')](_0x507f('0x17'),_0x6633f0,_0x507f('0x12'));_0x738740(_0x343c93[_0x507f('0x1a')][_0x507f('0x18')]);}})[_0x507f('0x1b')](function(_0x329dbd){logger[_0x507f('0x16')](_0x507f('0x17'),_0x6633f0,_0x329dbd);_0x54c9db(_0x329dbd);});});}exports[_0x507f('0x1c')]=function(_0x521884){var _0xf4190a=this;return new Promise(function(_0x167d0c,_0x59d1fe){return db[_0x507f('0x1d')][_0x507f('0x1e')](_0x521884['body'],{'raw':_0x521884[_0x507f('0x1f')]?_0x521884[_0x507f('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x507f('0x20')](function(_0x44cd8a){logger[_0x507f('0x19')]('CreatePlugin',_0x521884);logger[_0x507f('0x13')](_0x507f('0x1c'),_0x521884,JSON[_0x507f('0x14')](_0x44cd8a));_0x167d0c(_0x44cd8a);})['catch'](function(_0x5a55e6){logger[_0x507f('0x16')](_0x507f('0x1c'),_0x5a55e6['message'],_0x521884);_0x59d1fe(_0xf4190a[_0x507f('0x16')](0x1f4,_0x5a55e6[_0x507f('0x18')]));});});}; \ No newline at end of file +var _0x5620=['localhost','socket.io-emitter','./plugin.socket','register','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','Plugin','body','options','CreatePlugin','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x470b1e,_0x469d95){var _0x58d7ff=function(_0x4388e2){while(--_0x4388e2){_0x470b1e['push'](_0x470b1e['shift']());}};_0x58d7ff(++_0x469d95);}(_0x5620,0x74));var _0x0562=function(_0x1d3fdc,_0x2b5c54){_0x1d3fdc=_0x1d3fdc-0x0;var _0x128bb0=_0x5620[_0x1d3fdc];return _0x128bb0;};'use strict';var _=require(_0x0562('0x0'));var util=require(_0x0562('0x1'));var moment=require('moment');var BPromise=require(_0x0562('0x2'));var rs=require(_0x0562('0x3'));var fs=require('fs');var Redis=require(_0x0562('0x4'));var db=require(_0x0562('0x5'))['db'];var utils=require(_0x0562('0x6'));var logger=require('../../config/logger')(_0x0562('0x7'));var config=require(_0x0562('0x8'));var jayson=require(_0x0562('0x9'));var client=jayson['client'][_0x0562('0xa')]({'port':0x232a});config[_0x0562('0xb')]=_['defaults'](config[_0x0562('0xb')],{'host':_0x0562('0xc'),'port':0x18eb});var socket=require(_0x0562('0xd'))(new Redis(config[_0x0562('0xb')]));require(_0x0562('0xe'))[_0x0562('0xf')](socket);function respondWithRpcPromise(_0x2134f8,_0x369374,_0x75e1df){return new BPromise(function(_0x1f2400,_0x2e869b){return client['request'](_0x2134f8,_0x75e1df)[_0x0562('0x10')](function(_0x4b0293){logger[_0x0562('0x11')]('Plugin,\x20%s,\x20%s',_0x369374,_0x0562('0x12'));logger[_0x0562('0x13')](_0x0562('0x14'),_0x369374,_0x0562('0x12'),JSON[_0x0562('0x15')](_0x4b0293));if(_0x4b0293['error']){if(_0x4b0293[_0x0562('0x16')][_0x0562('0x17')]===0x1f4){logger[_0x0562('0x16')](_0x0562('0x18'),_0x369374,_0x4b0293['error'][_0x0562('0x19')]);return _0x2e869b(_0x4b0293['error'][_0x0562('0x19')]);}logger[_0x0562('0x16')](_0x0562('0x18'),_0x369374,_0x4b0293[_0x0562('0x16')]['message']);return _0x1f2400(_0x4b0293[_0x0562('0x16')]['message']);}else{logger[_0x0562('0x11')](_0x0562('0x18'),_0x369374,'request\x20sent');_0x1f2400(_0x4b0293[_0x0562('0x1a')]['message']);}})[_0x0562('0x1b')](function(_0x48d400){logger[_0x0562('0x16')]('Plugin,\x20%s,\x20%s',_0x369374,_0x48d400);_0x2e869b(_0x48d400);});});}exports['CreatePlugin']=function(_0x55e33e){var _0x2e7ab6=this;return new Promise(function(_0x1a162f,_0xf6a022){return db[_0x0562('0x1c')]['create'](_0x55e33e[_0x0562('0x1d')],{'raw':_0x55e33e[_0x0562('0x1e')]?_0x55e33e['options']['raw']===undefined?!![]:![]:!![]})[_0x0562('0x10')](function(_0x9d75b4){logger[_0x0562('0x11')](_0x0562('0x1f'),_0x55e33e);logger[_0x0562('0x13')](_0x0562('0x1f'),_0x55e33e,JSON[_0x0562('0x15')](_0x9d75b4));_0x1a162f(_0x9d75b4);})[_0x0562('0x1b')](function(_0x1a6ff2){logger[_0x0562('0x16')](_0x0562('0x1f'),_0x1a6ff2['message'],_0x55e33e);_0xf6a022(_0x2e7ab6[_0x0562('0x16')](0x1f4,_0x1a6ff2[_0x0562('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ef36bbc..0ce00ba 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 _0x9734=['save','emit','removeListener','register','length','./plugin.events'];(function(_0x3773a2,_0x4c0564){var _0x5aeddb=function(_0x36596e){while(--_0x36596e){_0x3773a2['push'](_0x3773a2['shift']());}};_0x5aeddb(++_0x4c0564);}(_0x9734,0x12b));var _0x4973=function(_0x259cad,_0x3dae11){_0x259cad=_0x259cad-0x0;var _0x4e6a68=_0x9734[_0x259cad];return _0x4e6a68;};'use strict';var PluginEvents=require(_0x4973('0x0'));var events=[_0x4973('0x1'),'remove','update'];function createListener(_0x4dfcb0,_0x2c53f8){return function(_0x34f774){_0x2c53f8[_0x4973('0x2')](_0x4dfcb0,_0x34f774);};}function removeListener(_0x466923,_0x10cb1e){return function(){PluginEvents[_0x4973('0x3')](_0x466923,_0x10cb1e);};}exports[_0x4973('0x4')]=function(_0x5edb0a){for(var _0x174628=0x0,_0x590672=events[_0x4973('0x5')];_0x174628<_0x590672;_0x174628++){var _0x2fe015=events[_0x174628];var _0x58d259=createListener('plugin:'+_0x2fe015,_0x5edb0a);PluginEvents['on'](_0x2fe015,_0x58d259);}}; \ No newline at end of file +var _0xf8a7=['emit','register','./plugin.events','save','remove','update'];(function(_0x48935f,_0x534032){var _0xc8e4c6=function(_0x5737b7){while(--_0x5737b7){_0x48935f['push'](_0x48935f['shift']());}};_0xc8e4c6(++_0x534032);}(_0xf8a7,0x9e));var _0x7f8a=function(_0xd37cd1,_0x26614e){_0xd37cd1=_0xd37cd1-0x0;var _0x4f5ef3=_0xf8a7[_0xd37cd1];return _0x4f5ef3;};'use strict';var PluginEvents=require(_0x7f8a('0x0'));var events=[_0x7f8a('0x1'),_0x7f8a('0x2'),_0x7f8a('0x3')];function createListener(_0x1ef033,_0x8c9972){return function(_0x44785e){_0x8c9972[_0x7f8a('0x4')](_0x1ef033,_0x44785e);};}function removeListener(_0x2002e0,_0x1ba5e7){return function(){PluginEvents['removeListener'](_0x2002e0,_0x1ba5e7);};}exports[_0x7f8a('0x5')]=function(_0x3cb975){for(var _0x5d87b5=0x0,_0x157218=events['length'];_0x5d87b5<_0x157218;_0x5d87b5++){var _0x51728f=events[_0x5d87b5];var _0x1f681c=createListener('plugin:'+_0x51728f,_0x3cb975);PluginEvents['on'](_0x51728f,_0x1f681c);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f3d195b..3c9af19 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(_0x480c74,_0x2d29b8){var _0x4a1214=function(_0x2cb75f){while(--_0x2cb75f){_0x480c74['push'](_0x480c74['shift']());}};_0x4a1214(++_0x2d29b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x5d9097,_0x34c08d){var _0x289c23=function(_0x1316fa){while(--_0x1316fa){_0x5d9097['push'](_0x5d9097['shift']());}};_0x289c23(++_0x34c08d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 4965c1e..13ea09a 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2ea=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','index','reject','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0x40f621,_0x176a06){var _0x316052=function(_0x350b86){while(--_0x350b86){_0x40f621['push'](_0x40f621['shift']());}};_0x316052(++_0x176a06);}(_0xd2ea,0x15f));var _0xad2e=function(_0x39db98,_0x28c7d9){_0x39db98=_0x39db98-0x0;var _0x5939cf=_0xd2ea[_0x39db98];return _0x5939cf;};'use strict';var _=require(_0xad2e('0x0'));var pm2=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var path=require(_0xad2e('0x4'));var exec=require('child_process')[_0xad2e('0x5')];var BPromise=require(_0xad2e('0x6'));function handleEntityNotFound(_0xcba7cb,_0x3e0741){return function(_0x2afdc4){if(!_0x2afdc4){_0xcba7cb[_0xad2e('0x7')](0x194);;}return _0x2afdc4;};}function respondWithResult(_0x29e97f,_0x592e8b){_0x592e8b=_0x592e8b||0xc8;return function(_0x3b5170){if(_0x3b5170){return _0x29e97f[_0xad2e('0x8')](_0x592e8b)[_0xad2e('0x9')](_0x3b5170);}return null;};}function handleError(_0x5710ac,_0x1e0e9e){_0x1e0e9e=_0x1e0e9e||0x1f4;return function(_0x19bb0d){logger['error'](_0x19bb0d[_0xad2e('0xa')]);if(_0x19bb0d['name']){delete _0x19bb0d[_0xad2e('0xb')];}_0x5710ac[_0xad2e('0x8')](_0x1e0e9e)[_0xad2e('0xc')](_0x19bb0d);};}function execChildProcess(){return new BPromise(function(_0x24c5da,_0x489f25){exec(_0xad2e('0xd'),function(_0x5707a5,_0x42d2ac,_0x347559){logger[_0xad2e('0xe')](_0x42d2ac);logger[_0xad2e('0xe')](_0x347559);if(_0x5707a5){logger['error'](_0x5707a5);return _0x489f25(_0x5707a5);}return _0x24c5da(_0x42d2ac);});});}exports[_0xad2e('0xf')]=function(_0x59201f,_0x1a91ce){return pm2['list']()['then'](function(_0x4a812b){if(_0x4a812b){var _0x5c96a7=_[_0xad2e('0x10')](_0x4a812b,function(_0x282780){return _0x282780[_0xad2e('0xb')]===_0xad2e('0x11')||_0x282780[_0xad2e('0xb')]===_0xad2e('0x12');});return{'rows':_0x5c96a7,'count':_0x5c96a7[_0xad2e('0x13')]};}return null;})[_0xad2e('0x14')](respondWithResult(_0x1a91ce,null))[_0xad2e('0x15')](handleError(_0x1a91ce,null));};exports[_0xad2e('0x16')]=function(_0x2af208,_0x39c5e4){return pm2[_0xad2e('0x17')](_0x2af208[_0xad2e('0x18')]['id'])[_0xad2e('0x14')](respondWithResult(_0x39c5e4,null))['then'](handleEntityNotFound(_0x39c5e4,null))[_0xad2e('0x15')](handleError(_0x39c5e4,null));};exports[_0xad2e('0x19')]=function(_0x489585,_0x50eb1a){if(_0x489585['body']['name']&&_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]){var _0x5549db=path[_0xad2e('0x1c')](__dirname,_0xad2e('0x1d'),_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]);var _0x23c0b6=process[_0xad2e('0x1e')]();process[_0xad2e('0x1f')](path[_0xad2e('0x20')](_0x5549db));return execChildProcess()[_0xad2e('0x14')](function(_0xd907a9){process[_0xad2e('0x1f')](_0x23c0b6);return pm2[_0xad2e('0x21')]({'name':_0x489585[_0xad2e('0x1a')]['name'],'script':_0x5549db});})[_0xad2e('0x14')](function(_0x2e8887){pm2[_0xad2e('0x22')]();return _0x2e8887[0x0];})[_0xad2e('0x14')](respondWithResult(_0x50eb1a,0xc9))[_0xad2e('0x15')](handleError(_0x50eb1a,null));}else{return _0x50eb1a[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x23')});}};exports[_0xad2e('0x24')]=function(_0x50d446,_0x356a19){if(_0x50d446['body']['id']){delete _0x50d446[_0xad2e('0x1a')]['id'];}var _0x28ef72={'online':_0xad2e('0x25'),'stopped':_0xad2e('0x26')};if(_0x28ef72[_0xad2e('0x27')](_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')])){return pm2[_0x28ef72[_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')]]](_0x50d446[_0xad2e('0x18')]['id'])['then'](respondWithResult(_0x356a19,0xc8))[_0xad2e('0x15')](handleError(_0x356a19,null));}else{return _0x356a19[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x28')});}};exports[_0xad2e('0x29')]=function(_0x9b4a23,_0x409f58){if(_0x9b4a23[_0xad2e('0x1a')]['id']){delete _0x9b4a23[_0xad2e('0x1a')]['id'];}if(_0x9b4a23[_0xad2e('0x18')]['id']){return pm2[_0xad2e('0x2a')](_0x9b4a23['params']['id'])[_0xad2e('0x14')](function(_0x55e1dc){pm2[_0xad2e('0x22')]();return _0x55e1dc[0x0];})[_0xad2e('0x14')](respondWithResult(_0x409f58,null))[_0xad2e('0x15')](handleError(_0x409f58,null));}else{return _0x409f58[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x4e81=['npm\x20install','info','index','then','express','length','catch','show','describe','params','create','body','script','join','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','exec','bluebird','sendStatus','status','json','error','stack','name','send'];(function(_0x1081ef,_0x5eaa11){var _0x2fd525=function(_0x5e9fa2){while(--_0x5e9fa2){_0x1081ef['push'](_0x1081ef['shift']());}};_0x2fd525(++_0x5eaa11);}(_0x4e81,0x1bc));var _0x14e8=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x4e81[_0xea35d1];return _0x1d7a7c;};'use strict';var _=require(_0x14e8('0x0'));var pm2=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var path=require('path');var exec=require('child_process')[_0x14e8('0x3')];var BPromise=require(_0x14e8('0x4'));function handleEntityNotFound(_0x224121,_0x436444){return function(_0x325325){if(!_0x325325){_0x224121[_0x14e8('0x5')](0x194);;}return _0x325325;};}function respondWithResult(_0x56a266,_0x57c79b){_0x57c79b=_0x57c79b||0xc8;return function(_0x3e73d2){if(_0x3e73d2){return _0x56a266[_0x14e8('0x6')](_0x57c79b)[_0x14e8('0x7')](_0x3e73d2);}return null;};}function handleError(_0x3c1b93,_0x11ec3b){_0x11ec3b=_0x11ec3b||0x1f4;return function(_0x20f053){logger[_0x14e8('0x8')](_0x20f053[_0x14e8('0x9')]);if(_0x20f053[_0x14e8('0xa')]){delete _0x20f053['name'];}_0x3c1b93[_0x14e8('0x6')](_0x11ec3b)[_0x14e8('0xb')](_0x20f053);};}function execChildProcess(){return new BPromise(function(_0x43bfcd,_0x2906b3){exec(_0x14e8('0xc'),function(_0x3ce648,_0x3bed91,_0x30df66){logger['info'](_0x3bed91);logger[_0x14e8('0xd')](_0x30df66);if(_0x3ce648){logger['error'](_0x3ce648);return _0x2906b3(_0x3ce648);}return _0x43bfcd(_0x3bed91);});});}exports[_0x14e8('0xe')]=function(_0x341d40,_0x32a01d){return pm2['list']()[_0x14e8('0xf')](function(_0x4e1064){if(_0x4e1064){var _0x458e4a=_['reject'](_0x4e1064,function(_0x347216){return _0x347216[_0x14e8('0xa')]===_0x14e8('0x10')||_0x347216[_0x14e8('0xa')]==='motion2';});return{'rows':_0x458e4a,'count':_0x458e4a[_0x14e8('0x11')]};}return null;})[_0x14e8('0xf')](respondWithResult(_0x32a01d,null))[_0x14e8('0x12')](handleError(_0x32a01d,null));};exports[_0x14e8('0x13')]=function(_0xd4d6b2,_0x1f1a0d){return pm2[_0x14e8('0x14')](_0xd4d6b2[_0x14e8('0x15')]['id'])['then'](respondWithResult(_0x1f1a0d,null))[_0x14e8('0xf')](handleEntityNotFound(_0x1f1a0d,null))[_0x14e8('0x12')](handleError(_0x1f1a0d,null));};exports[_0x14e8('0x16')]=function(_0x7b10f2,_0x246c5d){if(_0x7b10f2['body'][_0x14e8('0xa')]&&_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]){var _0x48e30a=path[_0x14e8('0x19')](__dirname,'../../files/plugins',_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]);var _0x3e8d5c=process[_0x14e8('0x1a')]();process[_0x14e8('0x1b')](path['dirname'](_0x48e30a));return execChildProcess()[_0x14e8('0xf')](function(_0x5b11f9){process[_0x14e8('0x1b')](_0x3e8d5c);return pm2[_0x14e8('0x1c')]({'name':_0x7b10f2['body']['name'],'script':_0x48e30a});})['then'](function(_0x4a758c){pm2[_0x14e8('0x1d')]();return _0x4a758c[0x0];})[_0x14e8('0xf')](respondWithResult(_0x246c5d,0xc9))[_0x14e8('0x12')](handleError(_0x246c5d,null));}else{return _0x246c5d[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x1e')});}};exports[_0x14e8('0x1f')]=function(_0x3c09cb,_0x2f5818){if(_0x3c09cb[_0x14e8('0x17')]['id']){delete _0x3c09cb[_0x14e8('0x17')]['id'];}var _0x2813ae={'online':'restart','stopped':_0x14e8('0x20')};if(_0x2813ae[_0x14e8('0x21')](_0x3c09cb[_0x14e8('0x17')]['status'])){return pm2[_0x2813ae[_0x3c09cb['body']['status']]](_0x3c09cb[_0x14e8('0x15')]['id'])[_0x14e8('0xf')](respondWithResult(_0x2f5818,0xc8))['catch'](handleError(_0x2f5818,null));}else{return _0x2f5818[_0x14e8('0x6')](0x1f4)[_0x14e8('0xb')]({'message':_0x14e8('0x22')});}};exports[_0x14e8('0x23')]=function(_0x5c2635,_0x1f1259){if(_0x5c2635[_0x14e8('0x17')]['id']){delete _0x5c2635[_0x14e8('0x17')]['id'];}if(_0x5c2635[_0x14e8('0x15')]['id']){return pm2[_0x14e8('0x24')](_0x5c2635['params']['id'])[_0x14e8('0xf')](function(_0x29ee7a){pm2[_0x14e8('0x1d')]();return _0x29ee7a[0x0];})[_0x14e8('0xf')](respondWithResult(_0x1f1259,null))['catch'](handleError(_0x1f1259,null));}else{return _0x1f1259[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e5b7714..00c2111 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 _0x51d6=['getAgents','isAuthenticated','express','Router','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0xc2eab2,_0x1fab89){var _0x5d75ef=function(_0x173761){while(--_0x173761){_0xc2eab2['push'](_0xc2eab2['shift']());}};_0x5d75ef(++_0x1fab89);}(_0x51d6,0x19a));var _0x651d=function(_0x55682b,_0x41209e){_0x55682b=_0x55682b-0x0;var _0x35aa84=_0x51d6[_0x55682b];return _0x35aa84;};'use strict';var express=require(_0x651d('0x0'));var router=express[_0x651d('0x1')]();var auth=require(_0x651d('0x2'));var controller=require(_0x651d('0x3'));router[_0x651d('0x4')](_0x651d('0x5'),auth['isAuthenticated'](),controller[_0x651d('0x6')]);router[_0x651d('0x4')]('/queues',auth[_0x651d('0x7')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x27c5=['express','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports'];(function(_0x3d5503,_0x16b2a9){var _0x99525a=function(_0x2b4a45){while(--_0x2b4a45){_0x3d5503['push'](_0x3d5503['shift']());}};_0x99525a(++_0x16b2a9);}(_0x27c5,0x104));var _0x527c=function(_0x4b8968,_0x5c9b44){_0x4b8968=_0x4b8968-0x0;var _0x3a0ab7=_0x27c5[_0x4b8968];return _0x3a0ab7;};'use strict';var express=require(_0x527c('0x0'));var router=express[_0x527c('0x1')]();var auth=require(_0x527c('0x2'));var controller=require('./realtime.controller');router[_0x527c('0x3')](_0x527c('0x4'),auth[_0x527c('0x5')](),controller[_0x527c('0x6')]);router[_0x527c('0x3')](_0x527c('0x7'),auth[_0x527c('0x5')](),controller[_0x527c('0x8')]);module[_0x527c('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 7efb16b..9a05743 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 _0xd8b2=['faxStatus','mailStatus','smsStatus','pause','*pause','getAgents','userpic','lastPauseAt','smsPause','whatsappPause','faxPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','rawAttributes','fieldName','type','key','query','role','agent','raw','user','userProfileId','UserProfile','getResources','findAndCountAll','rows','map','omit','globalStatus','globalStatusFilter','pauseTypeFilter','pauseType','getQueues','mail','chat','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','Queue','getOptions','QueueCampaigns','all','util','lodash','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','set','Content-Range','json','stack','name','status','send','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','catch','loggedIn','waiting','talking','voice','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','get','agents','paused','loggedInDb','available','busy','find','pick','filter','queue','connectedlinenum','internal','UserId','accountcode','online','voiceStatus','User','Pause','length','idle','unknown','unavailable','ringing','chatPause','mailPause','openchannelPause','every','voicePause','chatStatus'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd8b2,0xdb));var _0x2d8b=function(_0x4e2a70,_0xb4ab40){_0x4e2a70=_0x4e2a70-0x0;var _0x15d026=_0xd8b2[_0x4e2a70];return _0x15d026;};'use strict';var util=require(_0x2d8b('0x0'));var _=require(_0x2d8b('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x2d8b('0x2'))('api');var db=require(_0x2d8b('0x3'))['db'];var amiClient=jayson[_0x2d8b('0x4')][_0x2d8b('0x5')]({'port':0x232a});var routingClient=jayson['client'][_0x2d8b('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x2ebb58,_0x2d4793){return function(_0x3c36be){if(_0x3c36be){var _0x3a1f54=typeof _0x2d4793[_0x2d8b('0x6')]===_0x2d8b('0x7')&&typeof _0x2d4793[_0x2d8b('0x8')]==='undefined';var _0x135a6b=_0x3c36be['count'];var _0x3e4374=_0x3a1f54?0x0:_0x2d4793[_0x2d8b('0x6')];var _0x58a3af=_0x3a1f54?_0x3c36be[_0x2d8b('0x9')]:_0x2d4793[_0x2d8b('0x6')]+_0x2d4793[_0x2d8b('0x8')];var _0x352d54;if(_0x58a3af>=_0x135a6b){_0x58a3af=_0x135a6b;_0x352d54=0xc8;}else{_0x352d54=0xce;}_0x2ebb58['status'](_0x352d54);return _0x2ebb58[_0x2d8b('0xa')](_0x2d8b('0xb'),_0x3e4374+'-'+_0x58a3af+'/'+_0x135a6b)[_0x2d8b('0xc')](_0x3c36be);}return null;};}function handleError(_0x127c5e,_0x514799){_0x514799=_0x514799||0x1f4;return function(_0x54084b){logger['error'](_0x54084b[_0x2d8b('0xd')]);if(_0x54084b[_0x2d8b('0xe')]){delete _0x54084b[_0x2d8b('0xe')];}_0x127c5e[_0x2d8b('0xf')](_0x514799)[_0x2d8b('0x10')](_0x54084b);};}function getRealtimeAgents(){return new Promise(function(_0x2bf7c3,_0x245a9d){return amiClient[_0x2d8b('0x11')]('Agents',{})[_0x2d8b('0x12')](function(_0x388fbd){if(_0x388fbd[_0x2d8b('0x13')])throw new Error(_0x2d8b('0x14'));var _0x158c4f=_0x388fbd[_0x2d8b('0x15')];return routingClient[_0x2d8b('0x11')](_0x2d8b('0x16'),{})[_0x2d8b('0x12')](function(_0x40e2be){if(_0x40e2be['error'])throw new Error(_0x2d8b('0x17'));var _0x126854=_0x40e2be[_0x2d8b('0x15')];return _0x2bf7c3(_[_0x2d8b('0x18')]({},_0x158c4f,_0x126854));});})['catch'](function(_0xbc96cb){_0x245a9d(_0xbc96cb);});});}function getRealtimeQueues(_0x35b841,_0x3b590f){return new Promise(function(_0x505c1a,_0x4e0473){var _0x26652e=_0x3b590f==='voice'?amiClient:routingClient;return _0x26652e['request'](_[_0x2d8b('0x19')](_0x3b590f)+_0x2d8b('0x1a'),_0x35b841)['then'](function(_0x20e10e){if(_0x20e10e[_0x2d8b('0x13')])throw new Error(util[_0x2d8b('0x1b')](_0x2d8b('0x1c'),_0x3b590f));return _0x505c1a(_0x20e10e[_0x2d8b('0x15')]);})['catch'](function(_0x1b5b90){_0x4e0473(_0x1b5b90);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x31f77a,_0x3827fb){return amiClient['request'](_0x2d8b('0x1d'),{})[_0x2d8b('0x12')](function(_0x307010){if(_0x307010[_0x2d8b('0x13')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x31f77a(_0x307010['result']);})[_0x2d8b('0x1e')](function(_0x1093ab){_0x3827fb(_0x1093ab);});});}function initializeQueues(_0x128bb8,_0x226cf4,_0x2d38be,_0x191732){var _0x510144=[_0x2d8b('0x1f'),'available',_0x2d8b('0x20'),_0x2d8b('0x21'),'paused'];if(_0x2d38be===_0x2d8b('0x22')&&_0x191732===_0x2d8b('0x23')){_0x510144[_0x2d8b('0x24')](_0x2d8b('0x25'),_0x2d8b('0x26'),_0x2d8b('0x27'),_0x2d8b('0x28'),_0x2d8b('0x29'),_0x2d8b('0x2a'),_0x2d8b('0x2b'),'startProgressive',_0x2d8b('0x2c'),_0x2d8b('0x2d'),_0x2d8b('0x2e'),_0x2d8b('0x2f'),_0x2d8b('0x30'),_0x2d8b('0x31'),_0x2d8b('0x32'),_0x2d8b('0x33'),_0x2d8b('0x34'),'predictiveIntervalAnsweredCalls',_0x2d8b('0x35'),_0x2d8b('0x36'),'predictiveIntervalAvgHoldtime',_0x2d8b('0x37'));}return _0x128bb8['map'](function(_0x424c53){var _0x40c862=_0x424c53[_0x2d8b('0x38')]({'plain':!![]});_0x40c862[_0x2d8b('0x39')]=[];_0x40c862[_0x2d8b('0x3a')]=0x0;_0x40c862[_0x2d8b('0x3b')]=0x0;_0x40c862[_0x2d8b('0x1f')]=0x0;_0x40c862[_0x2d8b('0x3c')]=0x0;_0x40c862[_0x2d8b('0x20')]=0x0;if(_0x2d38be==='voice'){_0x40c862['talking']=0x0;_0x40c862[_0x2d8b('0x3d')]=0x0;if(_0x191732===_0x2d8b('0x23')){_0x40c862[_0x2d8b('0x25')]=0x0;_0x40c862[_0x2d8b('0x26')]=0x0;}}var _0x563ba8=_[_0x2d8b('0x3e')](_0x226cf4,['id',_0x40c862['id']]);if(_0x563ba8)_[_0x2d8b('0x18')](_0x40c862,_[_0x2d8b('0x3f')](_0x563ba8,_0x510144));return _0x40c862;});}function updateAgentVoiceStatus(_0x4754cb,_0x222b8c,_0x49a617){var _0x4865e1=_[_0x2d8b('0x40')](_0x49a617,[_0x2d8b('0x41'),_0x222b8c[_0x2d8b('0xe')]]);if(_0x4865e1['length']===0x0)return _0x4754cb[_0x2d8b('0x3d')]=!![];if(_['some'](_0x4865e1,[_0x2d8b('0x42'),_0x4754cb[_0x2d8b('0x43')]['toString']()]))return _0x4754cb['talking']=!![];if(!_0x4754cb['talking'])return _0x4754cb[_0x2d8b('0x3d')]=!![];}function getVoiceQueueAgents(_0x38bdcf,_0x124914,_0x587502,_0x4ec929){var _0x13d099=_[_0x2d8b('0x3e')](_0x124914,['id',_0x38bdcf['id']]);if(!_0x13d099)return _0x38bdcf;return _0x13d099['getMembers']({'raw':!![]})[_0x2d8b('0x12')](function(_0x3546ae){for(var _0x408a53=0x0;_0x408a53<_0x3546ae['length'];_0x408a53++){var _0x496e37=_[_0x2d8b('0x3e')](_0x587502,['id',_0x3546ae[_0x408a53][_0x2d8b('0x44')]]);if(!_0x496e37){_0x496e37={'id':_0x3546ae[_0x408a53][_0x2d8b('0x44')],'name':_0x3546ae[_0x408a53][_0x2d8b('0x44')],'accountcode':'','online':![]};}var _0x2207d3={'id':_0x496e37['id'],'name':_0x496e37[_0x2d8b('0xe')],'internal':_0x496e37[_0x2d8b('0x45')],'online':Boolean(_0x496e37[_0x2d8b('0x46')]),'paused':Boolean(_0x3546ae[_0x408a53][_0x2d8b('0x3a')])};if(_0x496e37[_0x2d8b('0x47')]===_0x2d8b('0x21'))updateAgentVoiceStatus(_0x2207d3,_0x38bdcf,_0x4ec929);if(_0x2207d3[_0x2d8b('0x46')])_0x38bdcf[_0x2d8b('0x3b')]++;if(_0x2207d3['busy'])_0x38bdcf['busy']++;if(_0x2207d3[_0x2d8b('0x3a')]&&!_0x2207d3[_0x2d8b('0x3d')]&&!_0x2207d3['talking'])_0x38bdcf[_0x2d8b('0x3a')]++;_0x38bdcf[_0x2d8b('0x39')]['push'](_0x2207d3);}return _0x38bdcf;});}function getQueueAgents(_0xdb4a53,_0x36c664,_0x24ad6c){var _0x27a0e3=_0x2d8b('0x48')+_[_0x2d8b('0x19')](_0x24ad6c)+'Queue';var _0x2b9dd3=_0x24ad6c+_0x2d8b('0x49');return db[_0x27a0e3]['findAll']({'where':{[_[_0x2d8b('0x19')](_0x24ad6c)+'QueueId']:_0xdb4a53['id']},'raw':!![]})[_0x2d8b('0x12')](function(_0x4a096e){for(var _0x3ff0a2=0x0;_0x3ff0a2<_0x4a096e[_0x2d8b('0x4a')];_0x3ff0a2++){var _0x27589d=_[_0x2d8b('0x3e')](_0x36c664,['id',_0x4a096e[_0x3ff0a2][_0x2d8b('0x44')]]);if(!_0x27589d){_0x27589d={'id':_0x4a096e[_0x3ff0a2][_0x2d8b('0x44')],'name':_0x4a096e[_0x3ff0a2][_0x2d8b('0x44')],'online':![],['pauseField']:![]};}var _0x23f282={'id':_0x27589d['id'],'name':_0x27589d[_0x2d8b('0xe')],'online':Boolean(_0x27589d[_0x2d8b('0x46')]),'paused':Boolean(_0x27589d[_0x2b9dd3])};if(_0x23f282[_0x2d8b('0x46')])_0xdb4a53[_0x2d8b('0x3b')]++;_0xdb4a53[_0x2d8b('0x39')][_0x2d8b('0x24')](_0x23f282);}return _0xdb4a53;});}function isIdle(_0x288f6b){return _0x288f6b===_0x2d8b('0x4b')||_0x288f6b===_0x2d8b('0x4c')||_0x288f6b===_0x2d8b('0x4d')||_0x288f6b===_0x2d8b('0x4e')||_['isNil'](_0x288f6b);}function isAgentPaused(_0x246345,_0x82cdde){var _0x16d6cd=[_0x246345[_0x2d8b('0x4f')],_0x246345['faxPause'],_0x246345[_0x2d8b('0x50')],_0x246345[_0x2d8b('0x51')],_0x246345['smsPause'],_0x246345['voicePause'],_0x246345['whatsappPause']];if(!_0x82cdde)return _[_0x2d8b('0x52')](_0x16d6cd);var _0x1cf21b=_[_0x2d8b('0x40')](_0x16d6cd);return _0x1cf21b[_0x2d8b('0x4a')]>0x0&&_0x1cf21b[_0x2d8b('0x4a')]<_0x16d6cd[_0x2d8b('0x4a')]?!![]:![];}function isAgentIdle(_0x148d61){if(_0x148d61[_0x2d8b('0x47')]!=='idle'&&_0x148d61[_0x2d8b('0x53')]){_0x148d61[_0x2d8b('0x47')]='pause';return![];}return _['every']([_0x148d61[_0x2d8b('0x54')],_0x148d61[_0x2d8b('0x55')],_0x148d61[_0x2d8b('0x56')],_0x148d61['openchannelStatus'],_0x148d61[_0x2d8b('0x57')],_0x148d61[_0x2d8b('0x47')],_0x148d61['whatsappStatus']],isIdle);}function getAgentStatus(_0x4976f2){var _0x194ddb=_0x2d8b('0x4c');if(isAgentPaused(_0x4976f2))_0x194ddb=_0x2d8b('0x58');else if(isAgentPaused(_0x4976f2,!![]))_0x194ddb=_0x2d8b('0x59');else if(isAgentIdle(_0x4976f2))_0x194ddb=_0x2d8b('0x4b');else _0x194ddb=_0x2d8b('0x3d');return _0x194ddb;}exports[_0x2d8b('0x5a')]=function(_0x2828e6,_0x397fa7){var _0x10ada3={'count':0x0,'rows':[]},_0x595607={},_0x1f3455,_0xb9b7a,_0x3b2f2a=[_0x2d8b('0x5b'),_0x2d8b('0x46'),'lastLoginAt',_0x2d8b('0x5c'),'pauseType',_0x2d8b('0x5c'),_0x2d8b('0x43'),'address',_0x2d8b('0x4f'),_0x2d8b('0x51'),_0x2d8b('0x50'),_0x2d8b('0x5d'),_0x2d8b('0x5e'),_0x2d8b('0x5f'),_0x2d8b('0x53'),_0x2d8b('0x60'),'openchannelCapacity',_0x2d8b('0x61'),_0x2d8b('0x62'),_0x2d8b('0x63'),_0x2d8b('0x64'),_0x2d8b('0x65'),_0x2d8b('0x66'),_0x2d8b('0x67'),_0x2d8b('0x68'),_0x2d8b('0x69'),_0x2d8b('0x6a'),_0x2d8b('0x54'),'openchannelStatus','mailStatus',_0x2d8b('0x57'),'whatsappStatus','faxStatus',_0x2d8b('0x47'),_0x2d8b('0x6b'),_0x2d8b('0x6c'),_0x2d8b('0x6d'),_0x2d8b('0x6e'),_0x2d8b('0x6f'),_0x2d8b('0x70'),'voiceStatusTime',_0x2d8b('0x41'),_0x2d8b('0x71'),'screenrecording',_0x2d8b('0x72'),_0x2d8b('0x73'),_0x2d8b('0x74')],_0x1db506=['chatPause','openchannelPause',_0x2d8b('0x50'),_0x2d8b('0x5d'),_0x2d8b('0x5e'),_0x2d8b('0x5f'),'voicePause','online'];Promise[_0x2d8b('0x75')]()['then'](function(){var _0x3c910e=_['map'](db[_0x2d8b('0x48')][_0x2d8b('0x76')],function(_0x8c8a75){return{'name':_0x8c8a75[_0x2d8b('0x77')],'type':_0x8c8a75[_0x2d8b('0x78')][_0x2d8b('0x79')]};});_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x7b')]=_0x2d8b('0x7c');_0x2828e6['query'][_0x2d8b('0x46')]=!![];_0x595607=qs['getOptions'](_0x3c910e,_0x2828e6);_0x595607[_0x2d8b('0x7d')]=!![];if(_0x2828e6['user'][_0x2d8b('0x7b')]===_0x2d8b('0x7e')){var _0x4d7654={'params':{'id':_0x2828e6['user'][_0x2d8b('0x7f')]},'query':{'section':_0x2d8b('0x16'),'role':'agent','online':!![],'nolimit':_0x2828e6[_0x2d8b('0x7a')]['nolimit'],'sort':_0x2828e6['query']['sort'],'filter':_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x40')]},'raw':!![]};return db[_0x2d8b('0x80')][_0x2d8b('0x81')](_0x4d7654);}return db['User'][_0x2d8b('0x82')](_0x595607);})['then'](function(_0x36db73){_0x10ada3[_0x2d8b('0x9')]=_0x36db73[_0x2d8b('0x9')];_0x1f3455=_0x36db73[_0x2d8b('0x83')];return getRealtimeAgents();})[_0x2d8b('0x12')](function(_0x45bb0c){_0xb9b7a=_0x45bb0c[_0x2d8b('0x83')];return _0x1f3455[_0x2d8b('0x84')](function(_0x269038){var _0x9b792a=_[_0x2d8b('0x3e')](_0xb9b7a,['id',_0x269038['id']]);if(_0x9b792a)_[_0x2d8b('0x18')](_0x269038,_[_0x2d8b('0x3f')](_[_0x2d8b('0x85')](_0x9b792a,_0x1db506),_0x3b2f2a));_0x269038[_0x2d8b('0x86')]=getAgentStatus(_0x269038);return _0x269038;});})[_0x2d8b('0x12')](function(_0x1d9ac8){if(_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x87')]){var _0x3ef3ec=_[_0x2d8b('0x40')](_0x1d9ac8,[_0x2d8b('0x86'),_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x87')]]);if(_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x88')]){_0x3ef3ec=_['filter'](_0x3ef3ec,[_0x2d8b('0x89'),_0x2828e6['query']['pauseTypeFilter']]);}}_0x10ada3[_0x2d8b('0x83')]=_0x3ef3ec||_0x1d9ac8;return _0x10ada3;})[_0x2d8b('0x12')](respondWithFilteredResult(_0x397fa7,_0x595607))[_0x2d8b('0x1e')](handleError(_0x397fa7,null));};exports[_0x2d8b('0x8a')]=function(_0x3d1940,_0x2920c2){var _0x44acf2=[_0x2d8b('0x8b'),_0x2d8b('0x8c'),_0x2d8b('0x8d'),_0x2d8b('0x8e'),_0x2d8b('0x8f'),_0x2d8b('0x90'),_0x2d8b('0x22')];var _0x2790c8={'count':0x0,'rows':[]},_0x11e85a={},_0x1581ce,_0x22bd5d,_0xb704c9,_0x56ab26,_0x164526;Promise[_0x2d8b('0x75')]()[_0x2d8b('0x12')](function(){if(_0x3d1940[_0x2d8b('0x7a')][_0x2d8b('0x91')]){if(!_[_0x2d8b('0x92')](_0x44acf2,_0x3d1940[_0x2d8b('0x7a')][_0x2d8b('0x91')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x1581ce=_0x3d1940[_0x2d8b('0x7a')]['channel'][_0x2d8b('0x93')]();}var _0x442d1b=_[_0x2d8b('0x19')](_0x1581ce)+_0x2d8b('0x94');var _0x2e7ab5=_['map'](db[_0x442d1b][_0x2d8b('0x76')],function(_0x1e338c){return{'name':_0x1e338c[_0x2d8b('0x77')],'type':_0x1e338c[_0x2d8b('0x78')]['key']};});_0x11e85a=qs[_0x2d8b('0x95')](_0x2e7ab5,_0x3d1940);if(_0x3d1940[_0x2d8b('0x7e')][_0x2d8b('0x7b')]===_0x2d8b('0x7e')){var _0x129fca={'params':{'id':_0x3d1940[_0x2d8b('0x7e')][_0x2d8b('0x7f')]},'query':{'section':_0x1581ce===_0x2d8b('0x22')&&_0x3d1940[_0x2d8b('0x7a')]['type']===_0x2d8b('0x23')?_0x2d8b('0x96'):_[_0x2d8b('0x19')](_0x1581ce)+'Queues','type':_0x3d1940[_0x2d8b('0x7a')][_0x2d8b('0x78')],'nolimit':!![],'sort':_0x2d8b('0xe'),'filter':_0x3d1940['query'][_0x2d8b('0x40')]}};return db[_0x2d8b('0x80')][_0x2d8b('0x81')](_0x129fca);}return db[_0x442d1b]['findAndCountAll'](_0x11e85a);})[_0x2d8b('0x12')](function(_0x3f7090){_0x2790c8[_0x2d8b('0x9')]=_0x3f7090[_0x2d8b('0x9')];_0x22bd5d=_0x3f7090[_0x2d8b('0x83')];return getRealtimeQueues(_0x3d1940,_0x1581ce);})['then'](function(_0x5eed81){_0x56ab26=_0x5eed81[_0x2d8b('0x83')];return getRealtimeAgents();})[_0x2d8b('0x12')](function(_0x3a70df){_0xb704c9=_0x3a70df[_0x2d8b('0x83')];if(_0x1581ce!=_0x2d8b('0x22'))return;return getRealtimeVoiceQueueChannels();})[_0x2d8b('0x12')](function(_0x263043){_0x164526=_0x263043?_0x263043[_0x2d8b('0x83')]:[];return initializeQueues(_0x22bd5d,_0x56ab26,_0x1581ce,_0x3d1940['query']['type']);})['then'](function(_0x47acea){var _0x1bd410=_0x47acea['map'](function(_0x3626bd){if(_0x1581ce==='voice')return getVoiceQueueAgents(_0x3626bd,_0x22bd5d,_0xb704c9,_0x164526);else return getQueueAgents(_0x3626bd,_0xb704c9,_0x1581ce);});return Promise[_0x2d8b('0x97')](_0x1bd410);})[_0x2d8b('0x12')](function(_0x5fb80f){_0x2790c8[_0x2d8b('0x83')]=_0x5fb80f;return _0x2790c8;})['then'](respondWithFilteredResult(_0x2920c2,_0x11e85a))[_0x2d8b('0x1e')](handleError(_0x2920c2,null));}; \ No newline at end of file +var _0x8fe3=['*pause','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','address','whatsappPause','faxPause','chatCapacity','openchannelCapacity','whatsappCapacity','faxCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','User','rawAttributes','fieldName','type','key','query','agent','getOptions','user','role','userProfileId','nolimit','sort','UserProfile','findAndCountAll','count','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','mail','sms','openchannel','fax','whatsapp','channel','toLowerCase','Invalid\x20channel','getResources','util','lodash','../../components/parsers/qs','api','../../mysqldb','http','client','offset','undefined','limit','status','json','error','stack','send','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','voice','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','message','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','busy','find','merge','pick','queue','length','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','Queue','Pause','idle','unknown','unavailable','ringing','isNil','chatPause','mailPause','smsPause','voicePause','every','filter','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus'];(function(_0x55e45c,_0x3fd637){var _0x5d304e=function(_0x419e03){while(--_0x419e03){_0x55e45c['push'](_0x55e45c['shift']());}};_0x5d304e(++_0x3fd637);}(_0x8fe3,0x163));var _0x38fe=function(_0x2529f4,_0x53f73a){_0x2529f4=_0x2529f4-0x0;var _0x1ad519=_0x8fe3[_0x2529f4];return _0x1ad519;};'use strict';var util=require(_0x38fe('0x0'));var _=require(_0x38fe('0x1'));var jayson=require('jayson/promise');var qs=require(_0x38fe('0x2'));var logger=require('../../config/logger')(_0x38fe('0x3'));var db=require(_0x38fe('0x4'))['db'];var amiClient=jayson['client'][_0x38fe('0x5')]({'port':0x232a});var routingClient=jayson[_0x38fe('0x6')]['http']({'port':0x232c});function respondWithFilteredResult(_0x28f2dc,_0x328036){return function(_0x4f0578){if(_0x4f0578){var _0x1dff64=typeof _0x328036[_0x38fe('0x7')]===_0x38fe('0x8')&&typeof _0x328036[_0x38fe('0x9')]==='undefined';var _0x17c321=_0x4f0578['count'];var _0xffba97=_0x1dff64?0x0:_0x328036[_0x38fe('0x7')];var _0x1fe915=_0x1dff64?_0x4f0578['count']:_0x328036[_0x38fe('0x7')]+_0x328036[_0x38fe('0x9')];var _0x2a3999;if(_0x1fe915>=_0x17c321){_0x1fe915=_0x17c321;_0x2a3999=0xc8;}else{_0x2a3999=0xce;}_0x28f2dc[_0x38fe('0xa')](_0x2a3999);return _0x28f2dc['set']('Content-Range',_0xffba97+'-'+_0x1fe915+'/'+_0x17c321)[_0x38fe('0xb')](_0x4f0578);}return null;};}function handleError(_0x1230e8,_0x49576e){_0x49576e=_0x49576e||0x1f4;return function(_0x25508b){logger[_0x38fe('0xc')](_0x25508b[_0x38fe('0xd')]);if(_0x25508b['name']){delete _0x25508b['name'];}_0x1230e8[_0x38fe('0xa')](_0x49576e)[_0x38fe('0xe')](_0x25508b);};}function getRealtimeAgents(){return new Promise(function(_0x57b654,_0x2e665f){return amiClient[_0x38fe('0xf')]('Agents',{})['then'](function(_0x13f3c5){if(_0x13f3c5[_0x38fe('0xc')])throw new Error(_0x38fe('0x10'));var _0x21353a=_0x13f3c5[_0x38fe('0x11')];return routingClient[_0x38fe('0xf')](_0x38fe('0x12'),{})[_0x38fe('0x13')](function(_0x347d3d){if(_0x347d3d[_0x38fe('0xc')])throw new Error(_0x38fe('0x14'));var _0x578f30=_0x347d3d[_0x38fe('0x11')];return _0x57b654(_['merge']({},_0x21353a,_0x578f30));});})[_0x38fe('0x15')](function(_0x132a4a){_0x2e665f(_0x132a4a);});});}function getRealtimeQueues(_0x21c415,_0x397eae){return new Promise(function(_0x450e8d,_0x2bfd81){var _0x42a842=_0x397eae===_0x38fe('0x16')?amiClient:routingClient;return _0x42a842[_0x38fe('0xf')](_[_0x38fe('0x17')](_0x397eae)+_0x38fe('0x18'),_0x21c415)[_0x38fe('0x13')](function(_0x3208b0){if(_0x3208b0[_0x38fe('0xc')])throw new Error(util['format'](_0x38fe('0x19'),_0x397eae));return _0x450e8d(_0x3208b0['result']);})[_0x38fe('0x15')](function(_0x4d4343){_0x2bfd81(_0x4d4343);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0xdb01f7,_0xcbf644){return amiClient[_0x38fe('0xf')]('VoiceQueuesChannels',{})[_0x38fe('0x13')](function(_0x9fb60a){if(_0x9fb60a[_0x38fe('0xc')])throw new Error(_0x38fe('0x1a'));return _0xdb01f7(_0x9fb60a[_0x38fe('0x11')]);})['catch'](function(_0x461d7c){_0xcbf644(_0x461d7c);});});}function initializeQueues(_0x2b9a05,_0x8d02f,_0x52da7e,_0x1b15ce){var _0x2be00d=[_0x38fe('0x1b'),_0x38fe('0x1c'),_0x38fe('0x1d'),_0x38fe('0x1e'),_0x38fe('0x1f')];if(_0x52da7e===_0x38fe('0x16')&&_0x1b15ce===_0x38fe('0x20')){_0x2be00d[_0x38fe('0x21')](_0x38fe('0x22'),_0x38fe('0x23'),_0x38fe('0x24'),'dialActive','dialMethod',_0x38fe('0x25'),_0x38fe('0x26'),_0x38fe('0x27'),_0x38fe('0x28'),_0x38fe('0x29'),_0x38fe('0x2a'),_0x38fe('0x2b'),_0x38fe('0x2c'),_0x38fe('0x2d'),_0x38fe('0x2e'),_0x38fe('0x2f'),_0x38fe('0x30'),_0x38fe('0x31'),'predictiveIntervalDroppedCallsTimeout',_0x38fe('0x32'),_0x38fe('0x33'),_0x38fe('0x34'));}return _0x2b9a05[_0x38fe('0x35')](function(_0x40985c){var _0x4cd4be=_0x40985c[_0x38fe('0x36')]({'plain':!![]});_0x4cd4be[_0x38fe('0x37')]=[];_0x4cd4be[_0x38fe('0x1f')]=0x0;_0x4cd4be[_0x38fe('0x38')]=0x0;_0x4cd4be[_0x38fe('0x1b')]=0x0;_0x4cd4be[_0x38fe('0x1c')]=0x0;_0x4cd4be[_0x38fe('0x1d')]=0x0;if(_0x52da7e===_0x38fe('0x16')){_0x4cd4be[_0x38fe('0x1e')]=0x0;_0x4cd4be[_0x38fe('0x39')]=0x0;if(_0x1b15ce===_0x38fe('0x20')){_0x4cd4be[_0x38fe('0x22')]=0x0;_0x4cd4be[_0x38fe('0x23')]=0x0;}}var _0x2c9284=_[_0x38fe('0x3a')](_0x8d02f,['id',_0x4cd4be['id']]);if(_0x2c9284)_[_0x38fe('0x3b')](_0x4cd4be,_[_0x38fe('0x3c')](_0x2c9284,_0x2be00d));return _0x4cd4be;});}function updateAgentVoiceStatus(_0x21b83d,_0x5520ae,_0x375f55){var _0x100d7f=_['filter'](_0x375f55,[_0x38fe('0x3d'),_0x5520ae['name']]);if(_0x100d7f[_0x38fe('0x3e')]===0x0)return _0x21b83d[_0x38fe('0x39')]=!![];if(_[_0x38fe('0x3f')](_0x100d7f,[_0x38fe('0x40'),_0x21b83d[_0x38fe('0x41')][_0x38fe('0x42')]()]))return _0x21b83d['talking']=!![];if(!_0x21b83d[_0x38fe('0x1e')])return _0x21b83d[_0x38fe('0x39')]=!![];}function getVoiceQueueAgents(_0x55696d,_0x42ef40,_0x193082,_0x30c889){var _0x4a9cf8=_[_0x38fe('0x3a')](_0x42ef40,['id',_0x55696d['id']]);if(!_0x4a9cf8)return _0x55696d;return _0x4a9cf8[_0x38fe('0x43')]({'raw':!![]})[_0x38fe('0x13')](function(_0x36d2f8){for(var _0x2b81fe=0x0;_0x2b81fe<_0x36d2f8['length'];_0x2b81fe++){var _0xa72dcf=_[_0x38fe('0x3a')](_0x193082,['id',_0x36d2f8[_0x2b81fe][_0x38fe('0x44')]]);if(!_0xa72dcf){_0xa72dcf={'id':_0x36d2f8[_0x2b81fe][_0x38fe('0x44')],'name':_0x36d2f8[_0x2b81fe][_0x38fe('0x44')],'accountcode':'','online':![]};}var _0x577b13={'id':_0xa72dcf['id'],'name':_0xa72dcf['name'],'internal':_0xa72dcf[_0x38fe('0x45')],'online':Boolean(_0xa72dcf[_0x38fe('0x46')]),'paused':Boolean(_0x36d2f8[_0x2b81fe][_0x38fe('0x1f')])};if(_0xa72dcf['voiceStatus']==='talking')updateAgentVoiceStatus(_0x577b13,_0x55696d,_0x30c889);if(_0x577b13[_0x38fe('0x46')])_0x55696d[_0x38fe('0x38')]++;if(_0x577b13[_0x38fe('0x39')])_0x55696d[_0x38fe('0x39')]++;if(_0x577b13['paused']&&!_0x577b13[_0x38fe('0x39')]&&!_0x577b13[_0x38fe('0x1e')])_0x55696d[_0x38fe('0x1f')]++;_0x55696d[_0x38fe('0x37')][_0x38fe('0x21')](_0x577b13);}return _0x55696d;});}function getQueueAgents(_0x39b50c,_0x474d65,_0x44eb8b){var _0x288acb='User'+_['startCase'](_0x44eb8b)+_0x38fe('0x47');var _0x109aa0=_0x44eb8b+_0x38fe('0x48');return db[_0x288acb]['findAll']({'where':{[_['startCase'](_0x44eb8b)+'QueueId']:_0x39b50c['id']},'raw':!![]})[_0x38fe('0x13')](function(_0x5dd571){for(var _0x271d35=0x0;_0x271d35<_0x5dd571['length'];_0x271d35++){var _0x22f65c=_[_0x38fe('0x3a')](_0x474d65,['id',_0x5dd571[_0x271d35][_0x38fe('0x44')]]);if(!_0x22f65c){_0x22f65c={'id':_0x5dd571[_0x271d35][_0x38fe('0x44')],'name':_0x5dd571[_0x271d35][_0x38fe('0x44')],'online':![],['pauseField']:![]};}var _0x420260={'id':_0x22f65c['id'],'name':_0x22f65c['name'],'online':Boolean(_0x22f65c[_0x38fe('0x46')]),'paused':Boolean(_0x22f65c[_0x109aa0])};if(_0x420260[_0x38fe('0x46')])_0x39b50c[_0x38fe('0x38')]++;_0x39b50c[_0x38fe('0x37')]['push'](_0x420260);}return _0x39b50c;});}function isIdle(_0x39dc90){return _0x39dc90===_0x38fe('0x49')||_0x39dc90===_0x38fe('0x4a')||_0x39dc90===_0x38fe('0x4b')||_0x39dc90===_0x38fe('0x4c')||_[_0x38fe('0x4d')](_0x39dc90);}function isAgentPaused(_0x2017ad,_0x14dee5){var _0x333db7=[_0x2017ad[_0x38fe('0x4e')],_0x2017ad['faxPause'],_0x2017ad[_0x38fe('0x4f')],_0x2017ad['openchannelPause'],_0x2017ad[_0x38fe('0x50')],_0x2017ad[_0x38fe('0x51')],_0x2017ad['whatsappPause']];if(!_0x14dee5)return _[_0x38fe('0x52')](_0x333db7);var _0x48e3ce=_[_0x38fe('0x53')](_0x333db7);return _0x48e3ce[_0x38fe('0x3e')]>0x0&&_0x48e3ce[_0x38fe('0x3e')]<_0x333db7['length']?!![]:![];}function isAgentIdle(_0x5f3756){if(_0x5f3756[_0x38fe('0x54')]!==_0x38fe('0x49')&&_0x5f3756[_0x38fe('0x51')]){_0x5f3756[_0x38fe('0x54')]=_0x38fe('0x55');return![];}return _[_0x38fe('0x52')]([_0x5f3756[_0x38fe('0x56')],_0x5f3756[_0x38fe('0x57')],_0x5f3756[_0x38fe('0x58')],_0x5f3756[_0x38fe('0x59')],_0x5f3756[_0x38fe('0x5a')],_0x5f3756['voiceStatus'],_0x5f3756[_0x38fe('0x5b')]],isIdle);}function getAgentStatus(_0x29cb57){var _0x45cbe9='unknown';if(isAgentPaused(_0x29cb57))_0x45cbe9=_0x38fe('0x55');else if(isAgentPaused(_0x29cb57,!![]))_0x45cbe9=_0x38fe('0x5c');else if(isAgentIdle(_0x29cb57))_0x45cbe9='idle';else _0x45cbe9=_0x38fe('0x39');return _0x45cbe9;}exports[_0x38fe('0x5d')]=function(_0x1de9ac,_0x390a6c){var _0x22ba55={'count':0x0,'rows':[]},_0x1e5de2={},_0x2ab5ae,_0x5c4e48,_0x132df9=[_0x38fe('0x5e'),_0x38fe('0x46'),_0x38fe('0x5f'),_0x38fe('0x60'),_0x38fe('0x61'),_0x38fe('0x60'),'internal',_0x38fe('0x62'),_0x38fe('0x4e'),'openchannelPause',_0x38fe('0x4f'),'smsPause',_0x38fe('0x63'),_0x38fe('0x64'),_0x38fe('0x51'),_0x38fe('0x65'),_0x38fe('0x66'),'mailCapacity','smsCapacity',_0x38fe('0x67'),_0x38fe('0x68'),'chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity',_0x38fe('0x69'),_0x38fe('0x6a'),_0x38fe('0x56'),_0x38fe('0x59'),_0x38fe('0x58'),_0x38fe('0x5a'),_0x38fe('0x5b'),_0x38fe('0x57'),_0x38fe('0x54'),_0x38fe('0x6b'),_0x38fe('0x6c'),_0x38fe('0x6d'),_0x38fe('0x6e'),_0x38fe('0x6f'),'faxStatusTime',_0x38fe('0x70'),_0x38fe('0x3d'),_0x38fe('0x71'),_0x38fe('0x72'),_0x38fe('0x73'),_0x38fe('0x74'),_0x38fe('0x75')],_0x20db76=[_0x38fe('0x4e'),'openchannelPause','mailPause',_0x38fe('0x50'),_0x38fe('0x63'),_0x38fe('0x64'),_0x38fe('0x51'),_0x38fe('0x46')];Promise[_0x38fe('0x76')]()[_0x38fe('0x13')](function(){var _0x1626c3=_['map'](db[_0x38fe('0x77')][_0x38fe('0x78')],function(_0x4b586b){return{'name':_0x4b586b[_0x38fe('0x79')],'type':_0x4b586b[_0x38fe('0x7a')][_0x38fe('0x7b')]};});_0x1de9ac[_0x38fe('0x7c')]['role']=_0x38fe('0x7d');_0x1de9ac['query'][_0x38fe('0x46')]=!![];_0x1e5de2=qs[_0x38fe('0x7e')](_0x1626c3,_0x1de9ac);_0x1e5de2['raw']=!![];if(_0x1de9ac[_0x38fe('0x7f')][_0x38fe('0x80')]===_0x38fe('0x7f')){var _0x330f8a={'params':{'id':_0x1de9ac['user'][_0x38fe('0x81')]},'query':{'section':_0x38fe('0x12'),'role':'agent','online':!![],'nolimit':_0x1de9ac[_0x38fe('0x7c')][_0x38fe('0x82')],'sort':_0x1de9ac[_0x38fe('0x7c')][_0x38fe('0x83')],'filter':_0x1de9ac[_0x38fe('0x7c')][_0x38fe('0x53')]},'raw':!![]};return db[_0x38fe('0x84')]['getResources'](_0x330f8a);}return db[_0x38fe('0x77')][_0x38fe('0x85')](_0x1e5de2);})[_0x38fe('0x13')](function(_0x5b5a91){_0x22ba55[_0x38fe('0x86')]=_0x5b5a91[_0x38fe('0x86')];_0x2ab5ae=_0x5b5a91[_0x38fe('0x87')];return getRealtimeAgents();})[_0x38fe('0x13')](function(_0x33d46f){_0x5c4e48=_0x33d46f[_0x38fe('0x87')];return _0x2ab5ae['map'](function(_0x4d5a08){var _0x23d29d=_[_0x38fe('0x3a')](_0x5c4e48,['id',_0x4d5a08['id']]);if(_0x23d29d)_['merge'](_0x4d5a08,_['pick'](_[_0x38fe('0x88')](_0x23d29d,_0x20db76),_0x132df9));_0x4d5a08[_0x38fe('0x89')]=getAgentStatus(_0x4d5a08);return _0x4d5a08;});})[_0x38fe('0x13')](function(_0x2ec29d){if(_0x1de9ac[_0x38fe('0x7c')][_0x38fe('0x8a')]){var _0x381932=_['filter'](_0x2ec29d,['globalStatus',_0x1de9ac[_0x38fe('0x7c')][_0x38fe('0x8a')]]);if(_0x1de9ac[_0x38fe('0x7c')][_0x38fe('0x8b')]){_0x381932=_[_0x38fe('0x53')](_0x381932,[_0x38fe('0x61'),_0x1de9ac[_0x38fe('0x7c')][_0x38fe('0x8b')]]);}}_0x22ba55[_0x38fe('0x87')]=_0x381932||_0x2ec29d;return _0x22ba55;})['then'](respondWithFilteredResult(_0x390a6c,_0x1e5de2))[_0x38fe('0x15')](handleError(_0x390a6c,null));};exports['getQueues']=function(_0x33bd37,_0x3b981f){var _0xdb0252=[_0x38fe('0x8c'),'chat',_0x38fe('0x8d'),_0x38fe('0x8e'),_0x38fe('0x8f'),_0x38fe('0x90'),_0x38fe('0x16')];var _0x5b496b={'count':0x0,'rows':[]},_0x10a358={},_0x32b93b,_0x433d72,_0x158f75,_0x1c7592,_0x4acc2d;Promise[_0x38fe('0x76')]()['then'](function(){if(_0x33bd37[_0x38fe('0x7c')][_0x38fe('0x91')]){if(!_['includes'](_0xdb0252,_0x33bd37[_0x38fe('0x7c')][_0x38fe('0x91')][_0x38fe('0x92')]()))throw new Error(_0x38fe('0x93'));_0x32b93b=_0x33bd37[_0x38fe('0x7c')][_0x38fe('0x91')][_0x38fe('0x92')]();}var _0x15757d=_[_0x38fe('0x17')](_0x32b93b)+_0x38fe('0x47');var _0x245120=_[_0x38fe('0x35')](db[_0x15757d]['rawAttributes'],function(_0x54884f){return{'name':_0x54884f[_0x38fe('0x79')],'type':_0x54884f[_0x38fe('0x7a')]['key']};});_0x10a358=qs[_0x38fe('0x7e')](_0x245120,_0x33bd37);if(_0x33bd37[_0x38fe('0x7f')][_0x38fe('0x80')]===_0x38fe('0x7f')){var _0x1e1d53={'params':{'id':_0x33bd37['user'][_0x38fe('0x81')]},'query':{'section':_0x32b93b==='voice'&&_0x33bd37['query'][_0x38fe('0x7a')]===_0x38fe('0x20')?'QueueCampaigns':_[_0x38fe('0x17')](_0x32b93b)+_0x38fe('0x18'),'type':_0x33bd37[_0x38fe('0x7c')][_0x38fe('0x7a')],'nolimit':!![],'sort':'name','filter':_0x33bd37['query']['filter']}};return db[_0x38fe('0x84')][_0x38fe('0x94')](_0x1e1d53);}return db[_0x15757d][_0x38fe('0x85')](_0x10a358);})['then'](function(_0x12ff72){_0x5b496b[_0x38fe('0x86')]=_0x12ff72['count'];_0x433d72=_0x12ff72[_0x38fe('0x87')];return getRealtimeQueues(_0x33bd37,_0x32b93b);})['then'](function(_0x477395){_0x1c7592=_0x477395[_0x38fe('0x87')];return getRealtimeAgents();})['then'](function(_0x192f8b){_0x158f75=_0x192f8b[_0x38fe('0x87')];if(_0x32b93b!=_0x38fe('0x16'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x3d1fda){_0x4acc2d=_0x3d1fda?_0x3d1fda[_0x38fe('0x87')]:[];return initializeQueues(_0x433d72,_0x1c7592,_0x32b93b,_0x33bd37[_0x38fe('0x7c')][_0x38fe('0x7a')]);})[_0x38fe('0x13')](function(_0x158abf){var _0x33c966=_0x158abf[_0x38fe('0x35')](function(_0x131630){if(_0x32b93b===_0x38fe('0x16'))return getVoiceQueueAgents(_0x131630,_0x433d72,_0x158f75,_0x4acc2d);else return getQueueAgents(_0x131630,_0x158f75,_0x32b93b);});return Promise['all'](_0x33c966);})[_0x38fe('0x13')](function(_0x445973){_0x5b496b['rows']=_0x445973;return _0x5b496b;})['then'](respondWithFilteredResult(_0x3b981f,_0x10a358))[_0x38fe('0x15')](handleError(_0x3b981f,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d90d101..88f2eb0 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xa519a3,_0x2efde9){var _0x5a44e0=function(_0xd6cd16){while(--_0xd6cd16){_0xa519a3['push'](_0xa519a3['shift']());}};_0x5a44e0(++_0x2efde9);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3fd995,_0x5523ce){var _0x5c664a=function(_0x24cdd7){while(--_0x24cdd7){_0x3fd995['push'](_0x3fd995['shift']());}};_0x5c664a(++_0x5523ce);}(_0x70e0,0x17b));var _0x070e=function(_0x1a2f9d,_0x20825e){_0x1a2f9d=_0x1a2f9d-0x0;var _0x51140b=_0x70e0[_0x1a2f9d];return _0x51140b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index daae435..2bb4246 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 _0xd1f9=['DATE','INTEGER','STRING'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0xd1f9,0x88));var _0x9d1f=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0xd1f9[_0x4ec3ab];return _0x229613;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x9d1f('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x9d1f('0x1')]},'scheduledat':{'type':Sequelize[_0x9d1f('0x2')]},'uniqueid':{'type':Sequelize[_0x9d1f('0x1')]},'starttime':{'type':Sequelize[_0x9d1f('0x2')]},'responsetime':{'type':Sequelize[_0x9d1f('0x2')]},'ringtime':{'type':Sequelize[_0x9d1f('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9d1f('0x1')]},'campaigntype':{'type':Sequelize[_0x9d1f('0x1')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x496e=['exports','INTEGER','STRING','DATE'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x496e,0x1a0));var _0xe496=function(_0x50d5ce,_0x414f82){_0x50d5ce=_0x50d5ce-0x0;var _0x5afbae=_0x496e[_0x50d5ce];return _0x5afbae;};'use strict';var Sequelize=require('sequelize');module[_0xe496('0x0')]={'state':{'type':Sequelize[_0xe496('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe496('0x2')]},'scheduledat':{'type':Sequelize[_0xe496('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe496('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe496('0x2')]},'membername':{'type':Sequelize[_0xe496('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 83662e9..135463e 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 _0x1fcb=['../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','util','../../config/logger','api','moment','path','rimraf'];(function(_0x1f4545,_0x4a3fdd){var _0x12b642=function(_0x28b1be){while(--_0x28b1be){_0x1f4545['push'](_0x1f4545['shift']());}};_0x12b642(++_0x4a3fdd);}(_0x1fcb,0x118));var _0xb1fc=function(_0x1d76af,_0x48451a){_0x1d76af=_0x1d76af-0x0;var _0xc79683=_0x1fcb[_0x1d76af];return _0xc79683;};'use strict';var _=require('lodash');var util=require(_0xb1fc('0x0'));var logger=require(_0xb1fc('0x1'))(_0xb1fc('0x2'));var moment=require(_0xb1fc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1fc('0x4'));var rimraf=require(_0xb1fc('0x5'));var config=require(_0xb1fc('0x6'));var attributes=require(_0xb1fc('0x7'));module[_0xb1fc('0x8')]=function(_0x44edf3,_0x5e5b99){return _0x44edf3['define'](_0xb1fc('0x9'),attributes,{'tableName':_0xb1fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd119=['../../config/logger','moment','bluebird','request-promise','rimraf','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview'];(function(_0x4a8914,_0x2fe4a5){var _0xe7740=function(_0x400623){while(--_0x400623){_0x4a8914['push'](_0x4a8914['shift']());}};_0xe7740(++_0x2fe4a5);}(_0xd119,0xab));var _0x9d11=function(_0x2e0ffa,_0x451f12){_0x2e0ffa=_0x2e0ffa-0x0;var _0x24d627=_0xd119[_0x2e0ffa];return _0x24d627;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d11('0x0'))('api');var moment=require(_0x9d11('0x1'));var BPromise=require(_0x9d11('0x2'));var rp=require(_0x9d11('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d11('0x4'));var config=require('../../config/environment');var attributes=require(_0x9d11('0x5'));module[_0x9d11('0x6')]=function(_0x20497c,_0x267d64){return _0x20497c['define'](_0x9d11('0x7'),attributes,{'tableName':_0x9d11('0x8'),'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 aa2448f..755e441 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 _0xe068=['error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0xe068,0xeb));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8e06('0x0'));var moment=require(_0x8e06('0x1'));var BPromise=require(_0x8e06('0x2'));var rs=require(_0x8e06('0x3'));var fs=require('fs');var Redis=require(_0x8e06('0x4'));var db=require(_0x8e06('0x5'))['db'];var utils=require(_0x8e06('0x6'));var logger=require(_0x8e06('0x7'))(_0x8e06('0x8'));var config=require(_0x8e06('0x9'));var jayson=require(_0x8e06('0xa'));var client=jayson['client'][_0x8e06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35b63a,_0x496e50,_0x541deb){return new BPromise(function(_0x194009,_0x2cc4af){return client['request'](_0x35b63a,_0x541deb)['then'](function(_0x35b96f){logger[_0x8e06('0xc')](_0x8e06('0xd'),_0x496e50,_0x8e06('0xe'));logger[_0x8e06('0xf')](_0x8e06('0x10'),_0x496e50,'request\x20sent',JSON['stringify'](_0x35b96f));if(_0x35b96f[_0x8e06('0x11')]){if(_0x35b96f[_0x8e06('0x11')][_0x8e06('0x12')]===0x1f4){logger[_0x8e06('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x496e50,_0x35b96f[_0x8e06('0x11')][_0x8e06('0x13')]);return _0x2cc4af(_0x35b96f[_0x8e06('0x11')]['message']);}logger[_0x8e06('0x11')](_0x8e06('0xd'),_0x496e50,_0x35b96f[_0x8e06('0x11')]['message']);return _0x194009(_0x35b96f[_0x8e06('0x11')][_0x8e06('0x13')]);}else{logger['info'](_0x8e06('0xd'),_0x496e50,_0x8e06('0xe'));_0x194009(_0x35b96f[_0x8e06('0x14')]['message']);}})[_0x8e06('0x15')](function(_0x3ea8bb){logger[_0x8e06('0x11')](_0x8e06('0xd'),_0x496e50,_0x3ea8bb);_0x2cc4af(_0x3ea8bb);});});}exports[_0x8e06('0x16')]=function(_0x5b7662){var _0x4feb1f=this;return new Promise(function(_0x249fd1,_0xaaf8af){return db[_0x8e06('0x17')][_0x8e06('0x18')](_0x5b7662[_0x8e06('0x19')],{'raw':_0x5b7662[_0x8e06('0x1a')]?_0x5b7662[_0x8e06('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2e1f40){logger[_0x8e06('0xc')]('CreateReportAgentPreview',_0x5b7662);logger[_0x8e06('0xf')]('CreateReportAgentPreview',_0x5b7662,JSON[_0x8e06('0x1b')](_0x2e1f40));_0x249fd1(_0x2e1f40);})[_0x8e06('0x15')](function(_0x2c1c19){logger[_0x8e06('0x11')]('CreateReportAgentPreview',_0x2c1c19['message'],_0x5b7662);_0xaaf8af(_0x4feb1f[_0x8e06('0x11')](0x1f4,_0x2c1c19['message']));});});}; \ No newline at end of file +var _0x997b=['../../config/logger','../../config/environment','jayson/promise','client','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','create','body','options','raw','then','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x26865f,_0x149b35){var _0x86b3e8=function(_0x270e7d){while(--_0x270e7d){_0x26865f['push'](_0x26865f['shift']());}};_0x86b3e8(++_0x149b35);}(_0x997b,0xec));var _0xb997=function(_0x49eecc,_0x51998d){_0x49eecc=_0x49eecc-0x0;var _0x515a40=_0x997b[_0x49eecc];return _0x515a40;};'use strict';var _=require(_0xb997('0x0'));var util=require(_0xb997('0x1'));var moment=require(_0xb997('0x2'));var BPromise=require(_0xb997('0x3'));var rs=require(_0xb997('0x4'));var fs=require('fs');var Redis=require(_0xb997('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb997('0x6'));var logger=require(_0xb997('0x7'))('rpc');var config=require(_0xb997('0x8'));var jayson=require(_0xb997('0x9'));var client=jayson[_0xb997('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e4b7c,_0x255a3c,_0x4c04c0){return new BPromise(function(_0x561ae8,_0x4a4dda){return client[_0xb997('0xb')](_0x2e4b7c,_0x4c04c0)['then'](function(_0x114e44){logger[_0xb997('0xc')](_0xb997('0xd'),_0x255a3c,_0xb997('0xe'));logger[_0xb997('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x255a3c,_0xb997('0xe'),JSON[_0xb997('0x10')](_0x114e44));if(_0x114e44[_0xb997('0x11')]){if(_0x114e44[_0xb997('0x11')]['code']===0x1f4){logger[_0xb997('0x11')](_0xb997('0xd'),_0x255a3c,_0x114e44[_0xb997('0x11')][_0xb997('0x12')]);return _0x4a4dda(_0x114e44[_0xb997('0x11')][_0xb997('0x12')]);}logger[_0xb997('0x11')](_0xb997('0xd'),_0x255a3c,_0x114e44[_0xb997('0x11')][_0xb997('0x12')]);return _0x561ae8(_0x114e44[_0xb997('0x11')]['message']);}else{logger[_0xb997('0xc')](_0xb997('0xd'),_0x255a3c,_0xb997('0xe'));_0x561ae8(_0x114e44[_0xb997('0x13')]['message']);}})[_0xb997('0x14')](function(_0x4d5b08){logger[_0xb997('0x11')](_0xb997('0xd'),_0x255a3c,_0x4d5b08);_0x4a4dda(_0x4d5b08);});});}exports['CreateReportAgentPreview']=function(_0x4079ce){var _0xe1867f=this;return new Promise(function(_0x229798,_0x238699){return db['ReportAgentPreview'][_0xb997('0x15')](_0x4079ce[_0xb997('0x16')],{'raw':_0x4079ce[_0xb997('0x17')]?_0x4079ce[_0xb997('0x17')][_0xb997('0x18')]===undefined?!![]:![]:!![]})[_0xb997('0x19')](function(_0x2dcf59){logger['info'](_0xb997('0x1a'),_0x4079ce);logger[_0xb997('0xf')]('CreateReportAgentPreview',_0x4079ce,JSON[_0xb997('0x10')](_0x2dcf59));_0x229798(_0x2dcf59);})[_0xb997('0x14')](function(_0x40fccf){logger['error'](_0xb997('0x1a'),_0x40fccf[_0xb997('0x12')],_0x4079ce);_0x238699(_0xe1867f[_0xb997('0x11')](0x1f4,_0x40fccf[_0xb997('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 98ef93d..891cdfd 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 _0x119e=['/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller'];(function(_0x3dfbcb,_0x431019){var _0x30ae19=function(_0x482027){while(--_0x482027){_0x3dfbcb['push'](_0x3dfbcb['shift']());}};_0x30ae19(++_0x431019);}(_0x119e,0xf9));var _0xe119=function(_0x101bea,_0xf68894){_0x101bea=_0x101bea-0x0;var _0x1db6ba=_0x119e[_0x101bea];return _0x1db6ba;};'use strict';var multer=require(_0xe119('0x0'));var util=require(_0xe119('0x1'));var path=require('path');var express=require(_0xe119('0x2'));var router=express[_0xe119('0x3')]();var auth=require(_0xe119('0x4'));var controller=require(_0xe119('0x5'));router['get'](_0xe119('0x6'),auth[_0xe119('0x7')](),controller[_0xe119('0x8')]);router[_0xe119('0x9')](_0xe119('0xa'),auth[_0xe119('0x7')](),controller[_0xe119('0xb')]);router[_0xe119('0x9')](_0xe119('0xc'),auth['isAuthenticated'](),controller[_0xe119('0xd')]);router['get'](_0xe119('0xe'),auth[_0xe119('0x7')](),controller[_0xe119('0xf')]);router['get'](_0xe119('0x10'),auth['isAuthenticated'](),controller[_0xe119('0x11')]);router[_0xe119('0x9')]('/mail/queues',auth[_0xe119('0x7')](),controller[_0xe119('0x12')]);router['get'](_0xe119('0x13'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0xe119('0x9')]('/openchannel/queues',auth[_0xe119('0x7')](),controller[_0xe119('0x14')]);router['get']('/sms/queues',auth[_0xe119('0x7')](),controller[_0xe119('0x15')]);router[_0xe119('0x9')](_0xe119('0x16'),auth[_0xe119('0x7')](),controller[_0xe119('0x17')]);router['get']('/fax/queues',auth[_0xe119('0x7')](),controller[_0xe119('0x18')]);router[_0xe119('0x9')]('/voice/queues/preview/:id',auth[_0xe119('0x7')](),controller[_0xe119('0x19')]);router[_0xe119('0x9')](_0xe119('0x1a'),auth[_0xe119('0x7')](),controller[_0xe119('0x1b')]);router['get'](_0xe119('0x1c'),auth[_0xe119('0x7')](),controller[_0xe119('0x1d')]);router['get'](_0xe119('0x1e'),auth['isAuthenticated'](),controller[_0xe119('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xe119('0x7')](),controller[_0xe119('0x20')]);router['get'](_0xe119('0x21'),auth[_0xe119('0x7')](),controller[_0xe119('0x22')]);router[_0xe119('0x23')](_0xe119('0x21'),auth[_0xe119('0x7')](),controller[_0xe119('0x24')]);router[_0xe119('0x9')]('/outbound',auth[_0xe119('0x7')](),controller[_0xe119('0x25')]);router[_0xe119('0x9')](_0xe119('0x26'),auth['isAuthenticated'](),controller[_0xe119('0x27')]);router['get'](_0xe119('0x28'),auth[_0xe119('0x7')](),controller['agents']);router[_0xe119('0x23')](_0xe119('0x29'),auth['isAuthenticated'](),controller[_0xe119('0x2a')]);router[_0xe119('0x9')](_0xe119('0x2b'),auth['isAuthenticated'](),controller[_0xe119('0x2c')]);router[_0xe119('0x9')](_0xe119('0x2d'),auth[_0xe119('0x7')](),controller[_0xe119('0x2e')]);router['get'](_0xe119('0x2f'),auth[_0xe119('0x7')](),controller[_0xe119('0x30')]);router[_0xe119('0x9')](_0xe119('0x31'),auth[_0xe119('0x7')](),controller[_0xe119('0x32')]);router['get'](_0xe119('0x33'),auth[_0xe119('0x7')](),controller['chatQueuesWaitingInteractions']);router['get'](_0xe119('0x34'),auth[_0xe119('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0xe119('0x9')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xe119('0x9')](_0xe119('0x35'),auth[_0xe119('0x7')](),controller[_0xe119('0x36')]);router[_0xe119('0x9')](_0xe119('0x37'),auth[_0xe119('0x7')](),controller[_0xe119('0x38')]);router[_0xe119('0x9')](_0xe119('0x39'),auth[_0xe119('0x7')](),controller[_0xe119('0x3a')]);router['get'](_0xe119('0x3b'),auth[_0xe119('0x7')](),controller[_0xe119('0x3c')]);router[_0xe119('0x3d')](_0xe119('0x3e'),auth[_0xe119('0x7')](),controller[_0xe119('0x3f')](_0xe119('0x40')));router[_0xe119('0x9')](_0xe119('0x41'),auth[_0xe119('0x7')](),controller[_0xe119('0x42')]);router[_0xe119('0x3d')](_0xe119('0x43'),auth['isAuthenticated'](),controller[_0xe119('0x3f')](_0xe119('0x44')));router[_0xe119('0x9')](_0xe119('0x45'),auth[_0xe119('0x7')](),controller[_0xe119('0x46')]);router[_0xe119('0x3d')](_0xe119('0x47'),auth[_0xe119('0x7')](),controller['queueNotify'](_0xe119('0x48')));router['get'](_0xe119('0x49'),auth[_0xe119('0x7')](),controller[_0xe119('0x4a')]);router[_0xe119('0x3d')](_0xe119('0x4b'),auth[_0xe119('0x7')](),controller[_0xe119('0x3f')](_0xe119('0x4c')));router[_0xe119('0x9')](_0xe119('0x4d'),auth[_0xe119('0x7')](),controller[_0xe119('0x4e')]);router[_0xe119('0x3d')]('/sms/queues/:id/notify',auth[_0xe119('0x7')](),controller['queueNotify'](_0xe119('0x4f')));router[_0xe119('0x3d')](_0xe119('0x50'),auth[_0xe119('0x7')](),controller[_0xe119('0x3f')](_0xe119('0x51')));router[_0xe119('0x9')]('/sms/queues/:id',auth[_0xe119('0x7')](),controller['showSmsQueues']);router[_0xe119('0x9')](_0xe119('0x52'),auth[_0xe119('0x7')](),controller['showWhatsappQueues']);router['post'](_0xe119('0x53'),auth['isAuthenticated'](),controller[_0xe119('0x54')]);module['exports']=router; \ No newline at end of file +var _0x6412=['/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','post','/sms/queues/:id/notify','sms'];(function(_0x4bae71,_0x2d5388){var _0xef05=function(_0x6830e1){while(--_0x6830e1){_0x4bae71['push'](_0x4bae71['shift']());}};_0xef05(++_0x2d5388);}(_0x6412,0xad));var _0x2641=function(_0x4bdd9d,_0x214d7f){_0x4bdd9d=_0x4bdd9d-0x0;var _0x4b28b2=_0x6412[_0x4bdd9d];return _0x4b28b2;};'use strict';var multer=require(_0x2641('0x0'));var util=require(_0x2641('0x1'));var path=require(_0x2641('0x2'));var express=require(_0x2641('0x3'));var router=express[_0x2641('0x4')]();var auth=require(_0x2641('0x5'));var controller=require(_0x2641('0x6'));router[_0x2641('0x7')]('/voice/channels',auth[_0x2641('0x8')](),controller[_0x2641('0x9')]);router[_0x2641('0x7')](_0x2641('0xa'),auth[_0x2641('0x8')](),controller[_0x2641('0xb')]);router[_0x2641('0x7')](_0x2641('0xc'),auth[_0x2641('0x8')](),controller[_0x2641('0xd')]);router[_0x2641('0x7')](_0x2641('0xe'),auth[_0x2641('0x8')](),controller[_0x2641('0xf')]);router[_0x2641('0x7')](_0x2641('0x10'),auth[_0x2641('0x8')](),controller[_0x2641('0x11')]);router[_0x2641('0x7')](_0x2641('0x12'),auth[_0x2641('0x8')](),controller[_0x2641('0x13')]);router[_0x2641('0x7')](_0x2641('0x14'),auth[_0x2641('0x8')](),controller['mailAccounts']);router[_0x2641('0x7')](_0x2641('0x15'),auth['isAuthenticated'](),controller[_0x2641('0x16')]);router[_0x2641('0x7')](_0x2641('0x17'),auth[_0x2641('0x8')](),controller['smsQueues']);router[_0x2641('0x7')]('/whatsapp/queues',auth[_0x2641('0x8')](),controller['whatsappQueues']);router[_0x2641('0x7')](_0x2641('0x18'),auth[_0x2641('0x8')](),controller[_0x2641('0x19')]);router[_0x2641('0x7')](_0x2641('0x1a'),auth[_0x2641('0x8')](),controller[_0x2641('0x1b')]);router['get'](_0x2641('0x1c'),auth[_0x2641('0x8')](),controller['voiceQueuesChannels']);router[_0x2641('0x7')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x2641('0x7')](_0x2641('0x1d'),auth['isAuthenticated'](),controller[_0x2641('0x1e')]);router[_0x2641('0x7')](_0x2641('0x1f'),auth[_0x2641('0x8')](),controller[_0x2641('0x20')]);router['get'](_0x2641('0x21'),auth[_0x2641('0x8')](),controller[_0x2641('0x22')]);router[_0x2641('0x23')](_0x2641('0x21'),auth[_0x2641('0x8')](),controller[_0x2641('0x24')]);router['get'](_0x2641('0x25'),auth[_0x2641('0x8')](),controller[_0x2641('0x26')]);router[_0x2641('0x7')]('/outbound/channels',auth[_0x2641('0x8')](),controller[_0x2641('0x27')]);router[_0x2641('0x7')]('/agents',auth[_0x2641('0x8')](),controller[_0x2641('0x28')]);router[_0x2641('0x23')](_0x2641('0x29'),auth[_0x2641('0x8')](),controller['agentCapacity']);router['get'](_0x2641('0x2a'),auth['isAuthenticated'](),controller[_0x2641('0x2b')]);router['get'](_0x2641('0x2c'),auth[_0x2641('0x8')](),controller[_0x2641('0x2d')]);router['get'](_0x2641('0x2e'),auth[_0x2641('0x8')](),controller[_0x2641('0x2f')]);router['get'](_0x2641('0x30'),auth['isAuthenticated'](),controller[_0x2641('0x31')]);router[_0x2641('0x7')](_0x2641('0x32'),auth[_0x2641('0x8')](),controller[_0x2641('0x33')]);router[_0x2641('0x7')](_0x2641('0x34'),auth['isAuthenticated'](),controller[_0x2641('0x35')]);router['get'](_0x2641('0x36'),auth[_0x2641('0x8')](),controller[_0x2641('0x37')]);router['get'](_0x2641('0x38'),auth[_0x2641('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x2641('0x39'),auth[_0x2641('0x8')](),controller[_0x2641('0x3a')]);router[_0x2641('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x2641('0x8')](),controller[_0x2641('0x3b')]);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x2641('0x3c')]);router['post'](_0x2641('0x3d'),auth[_0x2641('0x8')](),controller[_0x2641('0x3e')](_0x2641('0x3f')));router[_0x2641('0x7')](_0x2641('0x40'),auth[_0x2641('0x8')](),controller['showMailQueues']);router['post'](_0x2641('0x41'),auth[_0x2641('0x8')](),controller['queueNotify'](_0x2641('0x42')));router['get'](_0x2641('0x43'),auth['isAuthenticated'](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0x2641('0x8')](),controller[_0x2641('0x3e')]('fax'));router[_0x2641('0x7')](_0x2641('0x44'),auth[_0x2641('0x8')](),controller[_0x2641('0x45')]);router['post'](_0x2641('0x46'),auth[_0x2641('0x8')](),controller[_0x2641('0x3e')](_0x2641('0x47')));router[_0x2641('0x7')](_0x2641('0x48'),auth[_0x2641('0x8')](),controller['showOpenchannelQueues']);router[_0x2641('0x49')](_0x2641('0x4a'),auth[_0x2641('0x8')](),controller[_0x2641('0x3e')](_0x2641('0x4b')));router[_0x2641('0x49')](_0x2641('0x4c'),auth['isAuthenticated'](),controller['queueNotify'](_0x2641('0x4d')));router[_0x2641('0x7')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x2641('0x4e')]);router[_0x2641('0x7')]('/whatsapp/queues/:id',auth[_0x2641('0x8')](),controller[_0x2641('0x4f')]);router[_0x2641('0x49')](_0x2641('0x50'),auth[_0x2641('0x8')](),controller[_0x2641('0x51')]);module[_0x2641('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 3eaf39f..5802f8c 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 _0xac31=['MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','value','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','create','Start','queueTransferTimeout','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','catch','status','json','sendStatus','name','isNil','find','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user'];(function(_0x45619d,_0x208c32){var _0xd36de5=function(_0xa47de5){while(--_0xa47de5){_0x45619d['push'](_0x45619d['shift']());}};_0xd36de5(++_0x208c32);}(_0xac31,0xca));var _0x1ac3=function(_0x2a27d1,_0x1cc84d){_0x2a27d1=_0x2a27d1-0x0;var _0x422d56=_0xac31[_0x2a27d1];return _0x422d56;};'use strict';var BPromise=require(_0x1ac3('0x0'));var moment=require(_0x1ac3('0x1'));var _=require(_0x1ac3('0x2'));var util=require(_0x1ac3('0x3'));var db=require(_0x1ac3('0x4'))['db'];var logger=require(_0x1ac3('0x5'))(_0x1ac3('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1ac3('0x7')][_0x1ac3('0x8')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x1ac3('0x7')][_0x1ac3('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){var _0x4d7695=_0x157604?_0x157604:amiClient;return _0x4d7695[_0x1ac3('0x9')](_0x2bf9b1,_0x1be223)[_0x1ac3('0xa')](function(_0x344674){if(_0x344674['error']){if(_0x344674[_0x1ac3('0xb')][_0x1ac3('0xc')]===0x1f4){return _0x2d17de(_0x344674[_0x1ac3('0xb')][_0x1ac3('0xd')]);}return _0x57893c(_0x344674[_0x1ac3('0xb')][_0x1ac3('0xd')]);}else{_0x57893c(_0x344674['result']);}})[_0x1ac3('0xe')](function(_0x376814){_0x2d17de(_0x376814);});});}function respondWithResult(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xc8;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0xf')](_0x2338b9)[_0x1ac3('0x10')](_0x50d3b6);}return _0x2eeabf[_0x1ac3('0x11')](0x194);};}function handleError(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0x1f4;return function(_0x24bb5e){logger[_0x1ac3('0xb')](_0x24bb5e['stack']);if(_0x24bb5e[_0x1ac3('0x12')]){delete _0x24bb5e[_0x1ac3('0x12')];}_0x2def9f[_0x1ac3('0xf')](_0x53cc35)['send'](_0x24bb5e);};}function findById(_0x2f14ca){return function(_0x8590ce){if(!_[_0x1ac3('0x13')](_0x2f14ca)&&!_['isNil'](_0x8590ce)&&!_[_0x1ac3('0x13')](_0x8590ce['rows'])){return _[_0x1ac3('0x14')](_0x8590ce[_0x1ac3('0x15')],function(_0x20091d){return _0x20091d['id']==_0x2f14ca;});}return null;};}exports[_0x1ac3('0x16')]=function(_0x18b985,_0x557076){return respondWithRpcPromise(_0x1ac3('0x17'),_0x18b985[_0x1ac3('0x18')])[_0x1ac3('0xa')](respondWithResult(_0x557076,null))[_0x1ac3('0xe')](handleError(_0x557076,null));};exports['voiceChannelMixMonitor']=function(_0x48d18a,_0x2879d8){return respondWithRpcPromise(_0x1ac3('0x19'),_[_0x1ac3('0x1a')](_0x48d18a[_0x1ac3('0x18')],_0x48d18a[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x2879d8,null))[_0x1ac3('0xe')](handleError(_0x2879d8,null));};exports[_0x1ac3('0x1c')]=function(_0x3d30b8,_0x565141){return respondWithRpcPromise(_0x1ac3('0x1d'),_[_0x1ac3('0x1a')](_0x3d30b8['query'],_0x3d30b8[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x565141,null))['catch'](handleError(_0x565141,null));};exports[_0x1ac3('0x1e')]=function(_0x2f65e8,_0x145486){return respondWithRpcPromise(_0x1ac3('0x1f'),_0x2f65e8[_0x1ac3('0x18')])['then'](respondWithResult(_0x145486,null))['catch'](handleError(_0x145486,null));};exports['showVoiceQueues']=function(_0x528807,_0x52a1a5){return respondWithRpcPromise(_0x1ac3('0x1f'),_0x528807['query'])[_0x1ac3('0xa')](findById(_0x528807[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x52a1a5,null))[_0x1ac3('0xe')](handleError(_0x52a1a5,null));};exports['updateVoiceQueue']=function(_0x61441d,_0x541da0){return respondWithRpcPromise(_0x1ac3('0x20'),_[_0x1ac3('0x1a')](_0x61441d[_0x1ac3('0x21')],_0x61441d[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x541da0,null))[_0x1ac3('0xe')](handleError(_0x541da0,null));};exports[_0x1ac3('0x22')]=function(_0x5351b2,_0x2248b6){return respondWithRpcPromise(_0x1ac3('0x23'),_[_0x1ac3('0x1a')](_0x5351b2[_0x1ac3('0x18')],_0x5351b2['params']))[_0x1ac3('0xa')](respondWithResult(_0x2248b6,null))[_0x1ac3('0xe')](handleError(_0x2248b6,null));};exports[_0x1ac3('0x24')]=function(_0x294513,_0x204d78){return respondWithRpcPromise('VoiceQueuesChannels',_0x294513[_0x1ac3('0x18')])[_0x1ac3('0xa')](respondWithResult(_0x204d78,null))[_0x1ac3('0xe')](handleError(_0x204d78,null));};exports[_0x1ac3('0x25')]=function(_0x1a47d4,_0x43362a){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x1ac3('0x1a')](_0x1a47d4[_0x1ac3('0x18')],_0x1a47d4[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x43362a,null))['catch'](handleError(_0x43362a,null));};exports[_0x1ac3('0x26')]=function(_0x22404f,_0x2259f5){return respondWithRpcPromise(_0x1ac3('0x27'),_[_0x1ac3('0x1a')](_0x22404f[_0x1ac3('0x18')],_0x22404f[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x2259f5,null))[_0x1ac3('0xe')](handleError(_0x2259f5,null));};exports['voiceQueuesChannelRedirect']=function(_0xe6f9c0,_0x27b017){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x1ac3('0x1a')](_0xe6f9c0[_0x1ac3('0x18')],_0xe6f9c0[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x27b017,null))[_0x1ac3('0xe')](handleError(_0x27b017,null));};exports[_0x1ac3('0x28')]=function(_0x1c8bf5,_0xa15199){return respondWithRpcPromise('Outbound',_0x1c8bf5[_0x1ac3('0x18')])['then'](respondWithResult(_0xa15199,null))[_0x1ac3('0xe')](handleError(_0xa15199,null));};exports[_0x1ac3('0x29')]=function(_0x2d449e,_0x1e2f5e){return respondWithRpcPromise(_0x1ac3('0x2a'),_0x2d449e[_0x1ac3('0x18')])['then'](respondWithResult(_0x1e2f5e,null))[_0x1ac3('0xe')](handleError(_0x1e2f5e,null));};exports[_0x1ac3('0x2b')]=function(_0x43d15,_0x4e2442){var _0x34380d;return respondWithRpcPromise(_0x1ac3('0x2c'),_0x43d15['query'])[_0x1ac3('0xa')](function(_0x43a2ee){_0x34380d=_0x43a2ee;return respondWithRpcPromise(_0x1ac3('0x2c'),_0x43d15[_0x1ac3('0x18')],routingClient);})[_0x1ac3('0xa')](function(_0x21d8d6){return _[_0x1ac3('0x1a')]({},_0x21d8d6,_0x34380d);})[_0x1ac3('0xa')](respondWithResult(_0x4e2442,null))['catch'](handleError(_0x4e2442,null));};exports[_0x1ac3('0x2d')]=function(_0x3e606f,_0x40ea2c){if(_0x3e606f[_0x1ac3('0x21')]&&_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')]&&_0x3e606f[_0x1ac3('0x2f')]&&_0x3e606f['user']['name']){for(var _0x2c2099 in _0x3e606f[_0x1ac3('0x21')]['interaction']){if(_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')]['hasOwnProperty'](_0x2c2099)){db[_0x1ac3('0x30')]['findAll']({'where':{'channel':_0x2c2099,'membername':_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x12')],'type':_0x1ac3('0x31'),'exitAt':null,'uniqueid':_0x3e606f[_0x1ac3('0x21')]['interaction'][_0x2c2099]&&_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099][_0x1ac3('0x32')]?{'$notIn':_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099]}:{'$ne':null}}})['then'](function(_0x26b5b1){var _0x842f83=moment()[_0x1ac3('0x33')](_0x1ac3('0x34'));for(var _0x589434=0x0,_0x16d56a=_0x26b5b1[_0x1ac3('0x32')];_0x589434<_0x16d56a;_0x589434+=0x1){_0x26b5b1[_0x589434][_0x1ac3('0x35')]({'exitAt':_0x842f83});}});for(var _0x4019c6=0x0;_0x4019c6<_0x3e606f['body'][_0x1ac3('0x2e')][_0x2c2099][_0x1ac3('0x32')];_0x4019c6+=0x1){db[_0x1ac3('0x30')][_0x1ac3('0x36')]({'where':{'channel':_0x2c2099,'membername':_0x3e606f['user'][_0x1ac3('0x12')],'type':'INTERACTION','uniqueid':_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099][_0x4019c6],'exitAt':null},'defaults':{'channel':_0x2c2099,'membername':_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x12')],'interface':_[_0x1ac3('0x13')](_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x37')])?util['format']('SIP/%s',_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x12')]):_0x3e606f[_0x1ac3('0x2f')]['interface'],'type':'INTERACTION','enterAt':moment()['format'](_0x1ac3('0x34')),'role':_0x1ac3('0x38'),'internal':_0x3e606f['user'][_0x1ac3('0x39')],'uniqueid':_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099][_0x4019c6]}});}}}}return respondWithRpcPromise(_0x1ac3('0x3a'),{'id':_0x3e606f['params']['id'],'capacity':_0x3e606f['body'][_0x1ac3('0x3b')]},routingClient)[_0x1ac3('0xa')](respondWithResult(_0x40ea2c,null))['catch'](handleError(_0x40ea2c,null));};exports[_0x1ac3('0x3c')]=function(_0x5231f7,_0x4e4945){return respondWithRpcPromise(_0x1ac3('0x3d'),_0x5231f7[_0x1ac3('0x18')])['then'](respondWithResult(_0x4e4945,null))[_0x1ac3('0xe')](handleError(_0x4e4945,null));};exports['trunks']=function(_0x267541,_0x4762d3){return respondWithRpcPromise(_0x1ac3('0x3e'),_0x267541[_0x1ac3('0x18')])[_0x1ac3('0xa')](respondWithResult(_0x4762d3,null))[_0x1ac3('0xe')](handleError(_0x4762d3,null));};exports[_0x1ac3('0x3f')]=function(_0x331374,_0xeb7e49){return respondWithRpcPromise(_0x1ac3('0x40'),_0x331374[_0x1ac3('0x18')])['then'](respondWithResult(_0xeb7e49,null))['catch'](handleError(_0xeb7e49,null));};exports[_0x1ac3('0x41')]=function(_0x310eb7,_0x3bf701){return respondWithRpcPromise(_0x1ac3('0x42'),_0x310eb7[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x3bf701,null))[_0x1ac3('0xe')](handleError(_0x3bf701,null));};exports[_0x1ac3('0x43')]=function(_0xcf3bba,_0x3149f6){return respondWithRpcPromise('ChatQueues',_0xcf3bba[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](findById(_0xcf3bba[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x3149f6,null))[_0x1ac3('0xe')](handleError(_0x3149f6,null));};exports['mailQueues']=function(_0xb74cdf,_0x35895d){return respondWithRpcPromise('MailQueues',_0xb74cdf['query'],routingClient)['then'](respondWithResult(_0x35895d,null))[_0x1ac3('0xe')](handleError(_0x35895d,null));};exports[_0x1ac3('0x44')]=function(_0x2a1f66,_0x5ad546){return respondWithRpcPromise(_0x1ac3('0x45'),_0x2a1f66['query'],routingClient)['then'](findById(_0x2a1f66['params']['id']))['then'](respondWithResult(_0x5ad546,null))[_0x1ac3('0xe')](handleError(_0x5ad546,null));};exports[_0x1ac3('0x46')]=function(_0x42218b,_0x13294a){return respondWithRpcPromise(_0x1ac3('0x47'),_0x42218b['query'],mailClient)[_0x1ac3('0xa')](respondWithResult(_0x13294a,null))[_0x1ac3('0xe')](handleError(_0x13294a,null));};exports['openchannelQueues']=function(_0x2bcb4b,_0x1ffbb1){return respondWithRpcPromise(_0x1ac3('0x48'),_0x2bcb4b[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x1ffbb1,null))['catch'](handleError(_0x1ffbb1,null));};exports[_0x1ac3('0x49')]=function(_0x40907d,_0x1f4294){return respondWithRpcPromise(_0x1ac3('0x48'),_0x40907d['query'],routingClient)[_0x1ac3('0xa')](findById(_0x40907d[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x1f4294,null))[_0x1ac3('0xe')](handleError(_0x1f4294,null));};exports[_0x1ac3('0x4a')]=function(_0x1ac283,_0x5541c3){return respondWithRpcPromise('SmsQueues',_0x1ac283['query'],routingClient)['then'](respondWithResult(_0x5541c3,null))[_0x1ac3('0xe')](handleError(_0x5541c3,null));};exports['showSmsQueues']=function(_0x2a5413,_0x19359f){return respondWithRpcPromise(_0x1ac3('0x4b'),_0x2a5413[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](findById(_0x2a5413[_0x1ac3('0x1b')]['id']))['then'](respondWithResult(_0x19359f,null))[_0x1ac3('0xe')](handleError(_0x19359f,null));};exports[_0x1ac3('0x4c')]=function(_0x3597cb,_0x422b15){return respondWithRpcPromise('WhatsappQueues',_0x3597cb[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x422b15,null))[_0x1ac3('0xe')](handleError(_0x422b15,null));};exports[_0x1ac3('0x4d')]=function(_0x380ed8,_0x49ced4){return respondWithRpcPromise(_0x1ac3('0x4e'),_0x380ed8['query'],routingClient)['then'](findById(_0x380ed8[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x49ced4,null))[_0x1ac3('0xe')](handleError(_0x49ced4,null));};exports[_0x1ac3('0x4f')]=function(_0x355429,_0x3959bb){return respondWithRpcPromise(_0x1ac3('0x50'),_0x355429[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x3959bb,null))['catch'](handleError(_0x3959bb,null));};exports[_0x1ac3('0x51')]=function(_0xd36c71,_0x303d58){return respondWithRpcPromise('FaxQueues',_0xd36c71[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](findById(_0xd36c71[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x303d58,null))[_0x1ac3('0xe')](handleError(_0x303d58,null));};exports[_0x1ac3('0x52')]=function(_0x8740b4,_0x215966){return respondWithRpcPromise(_0x1ac3('0x53'),_0x8740b4[_0x1ac3('0x18')])['then'](respondWithResult(_0x215966,null))[_0x1ac3('0xe')](handleError(_0x215966,null));};exports[_0x1ac3('0x54')]=function(_0x41ffd0,_0x566ddc){return respondWithRpcPromise(_0x1ac3('0x55'),_0x41ffd0[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x566ddc,null))[_0x1ac3('0xe')](handleError(_0x566ddc,null));};exports[_0x1ac3('0x56')]=function(_0x519b80,_0x4d9d77){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x519b80[_0x1ac3('0x18')],routingClient)['then'](respondWithResult(_0x4d9d77,null))[_0x1ac3('0xe')](handleError(_0x4d9d77,null));};exports[_0x1ac3('0x57')]=function(_0x433dd0,_0x5cf974){return respondWithRpcPromise(_0x1ac3('0x58'),_0x433dd0[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x5cf974,null))[_0x1ac3('0xe')](handleError(_0x5cf974,null));};exports[_0x1ac3('0x59')]=function(_0x59def5,_0x5ec89d){return respondWithRpcPromise(_0x1ac3('0x58'),_0x59def5[_0x1ac3('0x18')],routingClient)['then'](function(_0x29b026){if(_0x59def5[_0x1ac3('0x18')][_0x1ac3('0x5a')]!==undefined){var _0x5cc2e0=_(_0x29b026[_0x1ac3('0x15')])[_0x1ac3('0x5b')]([_0x59def5['query'][_0x1ac3('0x5a')],_0x59def5['params']['id']])[_0x1ac3('0x5c')]('queue_id')['uniq']()[_0x1ac3('0x5d')]();return _0x29b026[_0x1ac3('0x15')][_0x1ac3('0x5b')](function(_0x3f5c44){return _0x5cc2e0[_0x1ac3('0x5e')](_0x3f5c44[_0x1ac3('0x5f')])>-0x1;});}else{return _0x29b026[_0x1ac3('0x15')][_0x1ac3('0x5b')](function(_0x408e3c){return _0x408e3c[_0x1ac3('0x5f')]===parseInt(_0x59def5[_0x1ac3('0x1b')]['id']);});}})[_0x1ac3('0xa')](respondWithResult(_0x5ec89d,null))['catch'](handleError(_0x5ec89d,null));};exports['smsQueuesWaitingInteractions']=function(_0x588726,_0x2ef69a){return respondWithRpcPromise(_0x1ac3('0x60'),_0x588726['query'],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x2ef69a,null))[_0x1ac3('0xe')](handleError(_0x2ef69a,null));};exports[_0x1ac3('0x61')]=function(_0x364748,_0xbadca5){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x364748[_0x1ac3('0x18')],routingClient)['then'](respondWithResult(_0xbadca5,null))[_0x1ac3('0xe')](handleError(_0xbadca5,null));};exports['faxQueuesWaitingInteractions']=function(_0x218712,_0x50278a){return respondWithRpcPromise(_0x1ac3('0x62'),_0x218712[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x50278a,null))[_0x1ac3('0xe')](handleError(_0x50278a,null));};exports[_0x1ac3('0x63')]=function(_0x5bf7f1){return function(_0x4f9822,_0x4887a5){var _0x369ed0,_0x22e88d;var _0xbadd54=_[_0x1ac3('0x64')](_0x5bf7f1);var _0x5b4e54=_0x5bf7f1===_0x1ac3('0x65')?_0x1ac3('0x66'):'Account';return db[_0xbadd54+_0x1ac3('0x67')]['findOne']({'raw':!![],'where':{'id':_0x4f9822[_0x1ac3('0x1b')]['id']}})['then'](function(_0x5524a4){if(_['isNil'](_0x5524a4)){throw new Error(_0xbadd54+_0x1ac3('0x68'));}_0x369ed0=_0x5524a4;return db[_0xbadd54+_0x1ac3('0x69')][_0x1ac3('0x6a')]({'where':{'id':_0x4f9822[_0x1ac3('0x21')][_0x1ac3('0x6b')]},'include':[{'model':db[_0xbadd54+'Interaction'],'as':_0x1ac3('0x6c')},{'model':db[_0xbadd54+_0x5b4e54],'as':_0x1ac3('0x6d')}]});})[_0x1ac3('0xa')](function(_0x34377b){if(_['isNil'](_0x34377b)){throw new Error(_0xbadd54+_0x1ac3('0x6e'));}_0x22e88d=_0x34377b;return _0x34377b[_0x1ac3('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x55d53c={'uniqueid':_0x5bf7f1+'.'+_0x22e88d['id']+'.'+_0x22e88d['Interaction']['id'],'FromUserId':_0x4f9822[_0x1ac3('0x2f')]['id'],'type':_0x1ac3('0x70')};_0x55d53c[_0xbadd54+_0x1ac3('0x71')]=_0x22e88d['id'];_0x55d53c[_0xbadd54+_0x1ac3('0x72')]=_0x22e88d['Interaction']['id'];_0x55d53c[_0x1ac3('0x73')+_0xbadd54+_0x5b4e54+'Id']=_0x22e88d[_0x1ac3('0x6d')]['id'];_0x55d53c['To'+_0xbadd54+'QueueId']=_0x369ed0['id'];return db[_0xbadd54+_0x1ac3('0x74')][_0x1ac3('0x75')](_0x55d53c);})[_0x1ac3('0xa')](function(){return respondWithRpcPromise(_0x1ac3('0x76'),{'channel':_0x5bf7f1,'interaction':_0x22e88d['Interaction'],'message':_0x22e88d,'account':_0x22e88d[_0x1ac3('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1ac3('0x70'),'appdata':_0x369ed0[_0x1ac3('0x12')]+','+(_0x22e88d[_0x1ac3('0x6d')][_0x1ac3('0x77')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x1ac3('0xa')](respondWithResult(_0x4887a5,null))[_0x1ac3('0xe')](handleError(_0x4887a5,null));};};exports['agentNotify']=function(_0x48335c,_0xfc252a){var _0x1c5f68,_0x554c7b;if(_['isNil'](_0x48335c[_0x1ac3('0x21')]['channel'])){throw new Error(_0x1ac3('0x78'));}var _0x20928f=_0x48335c['body']['channel'];var _0x3389be=_['capitalize'](_0x20928f);var _0x45faf6=_0x20928f===_0x1ac3('0x65')?_0x1ac3('0x66'):_0x1ac3('0x6d');return db[_0x1ac3('0x79')][_0x1ac3('0x6a')]({'raw':!![],'where':{'id':_0x48335c[_0x1ac3('0x1b')]['id'],'role':_0x1ac3('0x38')}})[_0x1ac3('0xa')](function(_0x588b98){if(_[_0x1ac3('0x13')](_0x588b98)){throw new Error(_0x1ac3('0x7a'));}_0x1c5f68=_0x588b98;return db[_0x3389be+'Message'][_0x1ac3('0x6a')]({'where':{'id':_0x48335c[_0x1ac3('0x21')]['messageId']},'include':[{'model':db[_0x3389be+_0x1ac3('0x6c')],'as':'Interaction'},{'model':db[_0x3389be+_0x45faf6],'as':'Account'}]});})[_0x1ac3('0xa')](function(_0x19a898){if(_[_0x1ac3('0x13')](_0x19a898)){throw new Error(_0x3389be+'\x20Message\x20not\x20found');}_0x554c7b=_0x19a898;return _0x19a898['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x1ac3('0xa')](function(){var _0x12b987={'uniqueid':_0x20928f+'.'+_0x554c7b['id']+'.'+_0x554c7b[_0x1ac3('0x6c')]['id'],'FromUserId':_0x48335c[_0x1ac3('0x2f')]['id'],'type':_0x1ac3('0x70'),'ToUserId':_0x1c5f68['id']};_0x12b987[_0x3389be+_0x1ac3('0x71')]=_0x554c7b['id'];_0x12b987[_0x3389be+_0x1ac3('0x72')]=_0x554c7b[_0x1ac3('0x6c')]['id'];_0x12b987[_0x1ac3('0x73')+_0x3389be+_0x45faf6+'Id']=_0x554c7b[_0x1ac3('0x6d')]['id'];return db[_0x3389be+_0x1ac3('0x74')][_0x1ac3('0x75')](_0x12b987);})[_0x1ac3('0xa')](function(){return respondWithRpcPromise(_0x1ac3('0x76'),{'channel':_0x20928f,'interaction':_0x554c7b[_0x1ac3('0x6c')],'message':_0x554c7b,'account':_0x554c7b[_0x1ac3('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1ac3('0x38'),'appdata':_0x1c5f68[_0x1ac3('0x12')]+','+(_0x554c7b[_0x1ac3('0x6d')][_0x1ac3('0x7b')]||0x12c),'interval':_0x1ac3('0x7c')}]},routingClient);})[_0x1ac3('0xa')](respondWithResult(_0xfc252a,null))['catch'](handleError(_0xfc252a,null));}; \ No newline at end of file +var _0x2d17=['jayson/promise','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','body','MemberReport','findAll','length','findOrCreate','INTERACTION','interface','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Website','User','agent','Agent\x20not\x20found','Message','agentTransferTimeout','bluebird','moment','util','../../mysqldb','api'];(function(_0x5c9e76,_0x3abc30){var _0x2590a5=function(_0x121fca){while(--_0x121fca){_0x5c9e76['push'](_0x5c9e76['shift']());}};_0x2590a5(++_0x3abc30);}(_0x2d17,0x17e));var _0x72d1=function(_0x59130e,_0x2b9833){_0x59130e=_0x59130e-0x0;var _0x4bc25c=_0x2d17[_0x59130e];return _0x4bc25c;};'use strict';var BPromise=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));var _=require('lodash');var util=require(_0x72d1('0x2'));var db=require(_0x72d1('0x3'))['db'];var logger=require('../../config/logger')(_0x72d1('0x4'));var jayson=require(_0x72d1('0x5'));var amiClient=jayson['client'][_0x72d1('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x72d1('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x72d1('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){var _0x4e7f3e=_0x477264?_0x477264:amiClient;return _0x4e7f3e[_0x72d1('0x7')](_0x239d1f,_0x5b40a9)[_0x72d1('0x8')](function(_0x283775){if(_0x283775['error']){if(_0x283775[_0x72d1('0x9')][_0x72d1('0xa')]===0x1f4){return _0x19e248(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}return _0x422f5a(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}else{_0x422f5a(_0x283775[_0x72d1('0xc')]);}})[_0x72d1('0xd')](function(_0x273ccf){_0x19e248(_0x273ccf);});});}function respondWithResult(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xc8;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0xe')](_0x5ad4df)[_0x72d1('0xf')](_0x3cd1ae);}return _0x2f5a78[_0x72d1('0x10')](0x194);};}function handleError(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0x1f4;return function(_0x143718){logger[_0x72d1('0x9')](_0x143718[_0x72d1('0x11')]);if(_0x143718[_0x72d1('0x12')]){delete _0x143718[_0x72d1('0x12')];}_0x22ac6f[_0x72d1('0xe')](_0x685a27)[_0x72d1('0x13')](_0x143718);};}function findById(_0x491af4){return function(_0x46fa3d){if(!_['isNil'](_0x491af4)&&!_[_0x72d1('0x14')](_0x46fa3d)&&!_[_0x72d1('0x14')](_0x46fa3d['rows'])){return _[_0x72d1('0x15')](_0x46fa3d[_0x72d1('0x16')],function(_0x1ca18d){return _0x1ca18d['id']==_0x491af4;});}return null;};}exports['voiceChannels']=function(_0x4925f6,_0x313d7b){return respondWithRpcPromise(_0x72d1('0x17'),_0x4925f6[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x313d7b,null))[_0x72d1('0xd')](handleError(_0x313d7b,null));};exports[_0x72d1('0x19')]=function(_0x1e2411,_0x5c7982){return respondWithRpcPromise(_0x72d1('0x1a'),_['merge'](_0x1e2411['query'],_0x1e2411['params']))['then'](respondWithResult(_0x5c7982,null))[_0x72d1('0xd')](handleError(_0x5c7982,null));};exports[_0x72d1('0x1b')]=function(_0x573c98,_0x2a421a){return respondWithRpcPromise(_0x72d1('0x1c'),_[_0x72d1('0x1d')](_0x573c98[_0x72d1('0x18')],_0x573c98[_0x72d1('0x1e')]))['then'](respondWithResult(_0x2a421a,null))['catch'](handleError(_0x2a421a,null));};exports[_0x72d1('0x1f')]=function(_0x36bc65,_0x2f661){return respondWithRpcPromise(_0x72d1('0x20'),_0x36bc65[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x2f661,null))[_0x72d1('0xd')](handleError(_0x2f661,null));};exports['showVoiceQueues']=function(_0x57ec9e,_0x1ba258){return respondWithRpcPromise('VoiceQueues',_0x57ec9e[_0x72d1('0x18')])[_0x72d1('0x8')](findById(_0x57ec9e[_0x72d1('0x1e')]['id']))['then'](respondWithResult(_0x1ba258,null))[_0x72d1('0xd')](handleError(_0x1ba258,null));};exports['updateVoiceQueue']=function(_0x707cd0,_0x20055f){return respondWithRpcPromise(_0x72d1('0x21'),_[_0x72d1('0x1d')](_0x707cd0['body'],_0x707cd0[_0x72d1('0x1e')]))['then'](respondWithResult(_0x20055f,null))[_0x72d1('0xd')](handleError(_0x20055f,null));};exports[_0x72d1('0x22')]=function(_0x5cec3f,_0x14d653){return respondWithRpcPromise(_0x72d1('0x23'),_[_0x72d1('0x1d')](_0x5cec3f[_0x72d1('0x18')],_0x5cec3f[_0x72d1('0x1e')]))['then'](respondWithResult(_0x14d653,null))[_0x72d1('0xd')](handleError(_0x14d653,null));};exports[_0x72d1('0x24')]=function(_0x9efc2f,_0x482033){return respondWithRpcPromise(_0x72d1('0x25'),_0x9efc2f[_0x72d1('0x18')])['then'](respondWithResult(_0x482033,null))[_0x72d1('0xd')](handleError(_0x482033,null));};exports[_0x72d1('0x26')]=function(_0x437d79,_0x5a63d9){return respondWithRpcPromise(_0x72d1('0x27'),_['merge'](_0x437d79[_0x72d1('0x18')],_0x437d79[_0x72d1('0x1e')]))[_0x72d1('0x8')](respondWithResult(_0x5a63d9,null))[_0x72d1('0xd')](handleError(_0x5a63d9,null));};exports[_0x72d1('0x28')]=function(_0xc9798a,_0x3ed5de){return respondWithRpcPromise(_0x72d1('0x29'),_[_0x72d1('0x1d')](_0xc9798a[_0x72d1('0x18')],_0xc9798a[_0x72d1('0x1e')]))['then'](respondWithResult(_0x3ed5de,null))[_0x72d1('0xd')](handleError(_0x3ed5de,null));};exports[_0x72d1('0x2a')]=function(_0x4acab,_0x325209){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x72d1('0x1d')](_0x4acab[_0x72d1('0x18')],_0x4acab[_0x72d1('0x1e')]))['then'](respondWithResult(_0x325209,null))[_0x72d1('0xd')](handleError(_0x325209,null));};exports[_0x72d1('0x2b')]=function(_0x163538,_0x5b897f){return respondWithRpcPromise(_0x72d1('0x2c'),_0x163538[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x5b897f,null))['catch'](handleError(_0x5b897f,null));};exports[_0x72d1('0x2d')]=function(_0x40cdbd,_0x1e083e){return respondWithRpcPromise(_0x72d1('0x2e'),_0x40cdbd[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x1e083e,null))[_0x72d1('0xd')](handleError(_0x1e083e,null));};exports['agents']=function(_0x12646c,_0x3ae4b5){var _0x440ac5;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c[_0x72d1('0x18')])[_0x72d1('0x8')](function(_0x2f3080){_0x440ac5=_0x2f3080;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c['query'],routingClient);})[_0x72d1('0x8')](function(_0x1a6dd4){return _[_0x72d1('0x1d')]({},_0x1a6dd4,_0x440ac5);})[_0x72d1('0x8')](respondWithResult(_0x3ae4b5,null))[_0x72d1('0xd')](handleError(_0x3ae4b5,null));};exports[_0x72d1('0x30')]=function(_0xb911fa,_0x3620df){if(_0xb911fa['body']&&_0xb911fa['body'][_0x72d1('0x31')]&&_0xb911fa[_0x72d1('0x32')]&&_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]){for(var _0x5a6bc4 in _0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')]){if(_0xb911fa['body'][_0x72d1('0x31')]['hasOwnProperty'](_0x5a6bc4)){db[_0x72d1('0x34')][_0x72d1('0x35')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa['user'][_0x72d1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0xb911fa['body']['interaction'][_0x5a6bc4]&&_0xb911fa[_0x72d1('0x33')]['interaction'][_0x5a6bc4][_0x72d1('0x36')]?{'$notIn':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4]}:{'$ne':null}}})['then'](function(_0x4a5c1c){var _0x263fcb=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2cb03d=0x0,_0x397f31=_0x4a5c1c[_0x72d1('0x36')];_0x2cb03d<_0x397f31;_0x2cb03d+=0x1){_0x4a5c1c[_0x2cb03d]['updateAttributes']({'exitAt':_0x263fcb});}});for(var _0x4f772d=0x0;_0x4f772d<_0xb911fa['body']['interaction'][_0x5a6bc4][_0x72d1('0x36')];_0x4f772d+=0x1){db[_0x72d1('0x34')][_0x72d1('0x37')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')],'type':_0x72d1('0x38'),'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d],'exitAt':null},'defaults':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')]['name'],'interface':_[_0x72d1('0x14')](_0xb911fa[_0x72d1('0x32')][_0x72d1('0x39')])?util['format'](_0x72d1('0x3a'),_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]):_0xb911fa['user'][_0x72d1('0x39')],'type':_0x72d1('0x38'),'enterAt':moment()[_0x72d1('0x3b')](_0x72d1('0x3c')),'role':'agent','internal':_0xb911fa['user'][_0x72d1('0x3d')],'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xb911fa[_0x72d1('0x1e')]['id'],'capacity':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x3e')]},routingClient)[_0x72d1('0x8')](respondWithResult(_0x3620df,null))[_0x72d1('0xd')](handleError(_0x3620df,null));};exports[_0x72d1('0x3f')]=function(_0x3146cf,_0xebe855){return respondWithRpcPromise(_0x72d1('0x40'),_0x3146cf[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0xebe855,null))['catch'](handleError(_0xebe855,null));};exports[_0x72d1('0x41')]=function(_0x50d4d4,_0x5dd7b0){return respondWithRpcPromise(_0x72d1('0x42'),_0x50d4d4['query'])[_0x72d1('0x8')](respondWithResult(_0x5dd7b0,null))[_0x72d1('0xd')](handleError(_0x5dd7b0,null));};exports[_0x72d1('0x43')]=function(_0x162248,_0x473a7b){return respondWithRpcPromise(_0x72d1('0x44'),_0x162248[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x473a7b,null))[_0x72d1('0xd')](handleError(_0x473a7b,null));};exports[_0x72d1('0x45')]=function(_0x14f9de,_0x52102e){return respondWithRpcPromise(_0x72d1('0x46'),_0x14f9de[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x52102e,null))['catch'](handleError(_0x52102e,null));};exports['showChatQueues']=function(_0x32f1ea,_0x140f0b){return respondWithRpcPromise(_0x72d1('0x46'),_0x32f1ea[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x32f1ea['params']['id']))[_0x72d1('0x8')](respondWithResult(_0x140f0b,null))['catch'](handleError(_0x140f0b,null));};exports[_0x72d1('0x47')]=function(_0x41c6a6,_0x20daf0){return respondWithRpcPromise(_0x72d1('0x48'),_0x41c6a6[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x20daf0,null))[_0x72d1('0xd')](handleError(_0x20daf0,null));};exports[_0x72d1('0x49')]=function(_0x384f0a,_0x3a2dfe){return respondWithRpcPromise(_0x72d1('0x48'),_0x384f0a[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x384f0a[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x3a2dfe,null))[_0x72d1('0xd')](handleError(_0x3a2dfe,null));};exports[_0x72d1('0x4a')]=function(_0x5e63cc,_0x1b40e8){return respondWithRpcPromise(_0x72d1('0x4b'),_0x5e63cc[_0x72d1('0x18')],mailClient)[_0x72d1('0x8')](respondWithResult(_0x1b40e8,null))[_0x72d1('0xd')](handleError(_0x1b40e8,null));};exports[_0x72d1('0x4c')]=function(_0x4e2d85,_0x1aec3d){return respondWithRpcPromise(_0x72d1('0x4d'),_0x4e2d85[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1aec3d,null))['catch'](handleError(_0x1aec3d,null));};exports[_0x72d1('0x4e')]=function(_0x5f4614,_0x28896f){return respondWithRpcPromise(_0x72d1('0x4d'),_0x5f4614[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x5f4614[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x28896f,null))[_0x72d1('0xd')](handleError(_0x28896f,null));};exports[_0x72d1('0x4f')]=function(_0x28e42b,_0x48cd1e){return respondWithRpcPromise('SmsQueues',_0x28e42b[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x48cd1e,null))[_0x72d1('0xd')](handleError(_0x48cd1e,null));};exports['showSmsQueues']=function(_0x31bfda,_0x333671){return respondWithRpcPromise('SmsQueues',_0x31bfda[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x31bfda[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x333671,null))[_0x72d1('0xd')](handleError(_0x333671,null));};exports[_0x72d1('0x50')]=function(_0x102574,_0x7925ec){return respondWithRpcPromise(_0x72d1('0x51'),_0x102574[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x7925ec,null))[_0x72d1('0xd')](handleError(_0x7925ec,null));};exports['showWhatsappQueues']=function(_0x55f49f,_0x15e0e0){return respondWithRpcPromise(_0x72d1('0x51'),_0x55f49f[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x55f49f[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x15e0e0,null))[_0x72d1('0xd')](handleError(_0x15e0e0,null));};exports[_0x72d1('0x52')]=function(_0x488a14,_0x837b6b){return respondWithRpcPromise('FaxQueues',_0x488a14[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x837b6b,null))['catch'](handleError(_0x837b6b,null));};exports['showFaxQueues']=function(_0xfd39ab,_0x14d59b){return respondWithRpcPromise(_0x72d1('0x53'),_0xfd39ab[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0xfd39ab[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x14d59b,null))['catch'](handleError(_0x14d59b,null));};exports[_0x72d1('0x54')]=function(_0x24bd82,_0x336ca3){return respondWithRpcPromise('FaxAccounts',_0x24bd82[_0x72d1('0x18')])['then'](respondWithResult(_0x336ca3,null))[_0x72d1('0xd')](handleError(_0x336ca3,null));};exports[_0x72d1('0x55')]=function(_0x5158ff,_0x3c0a7e){return respondWithRpcPromise(_0x72d1('0x56'),_0x5158ff['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3c0a7e,null))[_0x72d1('0xd')](handleError(_0x3c0a7e,null));};exports[_0x72d1('0x57')]=function(_0x132a43,_0x4a52ec){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x132a43['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x4a52ec,null))[_0x72d1('0xd')](handleError(_0x4a52ec,null));};exports[_0x72d1('0x58')]=function(_0x240159,_0x146b06){return respondWithRpcPromise(_0x72d1('0x59'),_0x240159['query'],routingClient)['then'](respondWithResult(_0x146b06,null))[_0x72d1('0xd')](handleError(_0x146b06,null));};exports[_0x72d1('0x5a')]=function(_0x36827e,_0x3ef7a3){return respondWithRpcPromise(_0x72d1('0x59'),_0x36827e[_0x72d1('0x18')],routingClient)['then'](function(_0x23f0e3){if(_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')]!==undefined){var _0x53e57b=_(_0x23f0e3[_0x72d1('0x16')])[_0x72d1('0x5c')]([_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')],_0x36827e[_0x72d1('0x1e')]['id']])[_0x72d1('0x5d')](_0x72d1('0x5e'))[_0x72d1('0x5f')]()['value']();return _0x23f0e3[_0x72d1('0x16')][_0x72d1('0x5c')](function(_0x24f5eb){return _0x53e57b[_0x72d1('0x60')](_0x24f5eb['queue_id'])>-0x1;});}else{return _0x23f0e3['rows'][_0x72d1('0x5c')](function(_0x2932bb){return _0x2932bb['queue_id']===parseInt(_0x36827e[_0x72d1('0x1e')]['id']);});}})[_0x72d1('0x8')](respondWithResult(_0x3ef7a3,null))[_0x72d1('0xd')](handleError(_0x3ef7a3,null));};exports[_0x72d1('0x61')]=function(_0x35b9bb,_0x1d1e22){return respondWithRpcPromise(_0x72d1('0x62'),_0x35b9bb[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1d1e22,null))[_0x72d1('0xd')](handleError(_0x1d1e22,null));};exports[_0x72d1('0x63')]=function(_0x38bfd3,_0x3cbe00){return respondWithRpcPromise(_0x72d1('0x64'),_0x38bfd3[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3cbe00,null))[_0x72d1('0xd')](handleError(_0x3cbe00,null));};exports['faxQueuesWaitingInteractions']=function(_0x47585e,_0x466634){return respondWithRpcPromise(_0x72d1('0x65'),_0x47585e[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x466634,null))[_0x72d1('0xd')](handleError(_0x466634,null));};exports['queueNotify']=function(_0x1c6547){return function(_0x369153,_0x4a6607){var _0x266fbc,_0x4057ec;var _0x239cdb=_[_0x72d1('0x66')](_0x1c6547);var _0x27c651=_0x1c6547===_0x72d1('0x67')?'Website':_0x72d1('0x68');return db[_0x239cdb+_0x72d1('0x69')]['findOne']({'raw':!![],'where':{'id':_0x369153['params']['id']}})[_0x72d1('0x8')](function(_0x291b67){if(_[_0x72d1('0x14')](_0x291b67)){throw new Error(_0x239cdb+_0x72d1('0x6a'));}_0x266fbc=_0x291b67;return db[_0x239cdb+'Message'][_0x72d1('0x6b')]({'where':{'id':_0x369153[_0x72d1('0x33')][_0x72d1('0x6c')]},'include':[{'model':db[_0x239cdb+_0x72d1('0x6d')],'as':_0x72d1('0x6d')},{'model':db[_0x239cdb+_0x27c651],'as':_0x72d1('0x68')}]});})[_0x72d1('0x8')](function(_0x14a215){if(_['isNil'](_0x14a215)){throw new Error(_0x239cdb+_0x72d1('0x6e'));}_0x4057ec=_0x14a215;return _0x14a215[_0x72d1('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x1b06f3={'uniqueid':_0x1c6547+'.'+_0x4057ec['id']+'.'+_0x4057ec['Interaction']['id'],'FromUserId':_0x369153[_0x72d1('0x32')]['id'],'type':_0x72d1('0x70')};_0x1b06f3[_0x239cdb+'MessageId']=_0x4057ec['id'];_0x1b06f3[_0x239cdb+_0x72d1('0x71')]=_0x4057ec['Interaction']['id'];_0x1b06f3[_0x72d1('0x72')+_0x239cdb+_0x27c651+'Id']=_0x4057ec['Account']['id'];_0x1b06f3['To'+_0x239cdb+_0x72d1('0x73')]=_0x266fbc['id'];return db[_0x239cdb+_0x72d1('0x74')][_0x72d1('0x75')](_0x1b06f3);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x1c6547,'interaction':_0x4057ec['Interaction'],'message':_0x4057ec,'account':_0x4057ec[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x70'),'appdata':_0x266fbc[_0x72d1('0x12')]+','+(_0x4057ec['Account'][_0x72d1('0x77')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x4a6607,null))[_0x72d1('0xd')](handleError(_0x4a6607,null));};};exports[_0x72d1('0x79')]=function(_0x8d4f0d,_0x5c262e){var _0x1d0db0,_0x39d961;if(_[_0x72d1('0x14')](_0x8d4f0d['body'][_0x72d1('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x38a32c=_0x8d4f0d['body'][_0x72d1('0x7a')];var _0x2d45c9=_[_0x72d1('0x66')](_0x38a32c);var _0x21ad86=_0x38a32c==='chat'?_0x72d1('0x7b'):_0x72d1('0x68');return db[_0x72d1('0x7c')][_0x72d1('0x6b')]({'raw':!![],'where':{'id':_0x8d4f0d['params']['id'],'role':_0x72d1('0x7d')}})[_0x72d1('0x8')](function(_0x430905){if(_[_0x72d1('0x14')](_0x430905)){throw new Error(_0x72d1('0x7e'));}_0x1d0db0=_0x430905;return db[_0x2d45c9+_0x72d1('0x7f')][_0x72d1('0x6b')]({'where':{'id':_0x8d4f0d['body']['messageId']},'include':[{'model':db[_0x2d45c9+'Interaction'],'as':_0x72d1('0x6d')},{'model':db[_0x2d45c9+_0x21ad86],'as':'Account'}]});})[_0x72d1('0x8')](function(_0x8f4603){if(_['isNil'](_0x8f4603)){throw new Error(_0x2d45c9+_0x72d1('0x6e'));}_0x39d961=_0x8f4603;return _0x8f4603['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x378cf0={'uniqueid':_0x38a32c+'.'+_0x39d961['id']+'.'+_0x39d961[_0x72d1('0x6d')]['id'],'FromUserId':_0x8d4f0d[_0x72d1('0x32')]['id'],'type':'queue','ToUserId':_0x1d0db0['id']};_0x378cf0[_0x2d45c9+'MessageId']=_0x39d961['id'];_0x378cf0[_0x2d45c9+_0x72d1('0x71')]=_0x39d961['Interaction']['id'];_0x378cf0['From'+_0x2d45c9+_0x21ad86+'Id']=_0x39d961['Account']['id'];return db[_0x2d45c9+_0x72d1('0x74')][_0x72d1('0x75')](_0x378cf0);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x38a32c,'interaction':_0x39d961[_0x72d1('0x6d')],'message':_0x39d961,'account':_0x39d961[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x7d'),'appdata':_0x1d0db0['name']+','+(_0x39d961['Account'][_0x72d1('0x80')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x5c262e,null))[_0x72d1('0xd')](handleError(_0x5c262e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 930ebcb..1e8232f 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 _0x1600=['/:id/run','run','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3f0b15,_0xb88473){var _0x38f95f=function(_0x3ee319){while(--_0x3ee319){_0x3f0b15['push'](_0x3f0b15['shift']());}};_0x38f95f(++_0xb88473);}(_0x1600,0x1ac));var _0x0160=function(_0x1c73b2,_0x3c1459){_0x1c73b2=_0x1c73b2-0x0;var _0x5dd717=_0x1600[_0x1c73b2];return _0x5dd717;};'use strict';var multer=require(_0x0160('0x0'));var util=require(_0x0160('0x1'));var path=require(_0x0160('0x2'));var timeout=require(_0x0160('0x3'));var express=require(_0x0160('0x4'));var router=express['Router']();var fs_extra=require(_0x0160('0x5'));var auth=require(_0x0160('0x6'));var interaction=require(_0x0160('0x7'));var config=require(_0x0160('0x8'));var controller=require('./schedule.controller');router[_0x0160('0x9')]('/',auth[_0x0160('0xa')](),controller[_0x0160('0xb')]);router[_0x0160('0x9')]('/:id',auth[_0x0160('0xa')](),controller['show']);router[_0x0160('0x9')](_0x0160('0xc'),auth['isAuthenticated'](),controller[_0x0160('0xd')]);router['post']('/',auth[_0x0160('0xa')](),controller['create']);router[_0x0160('0xe')](_0x0160('0xf'),auth[_0x0160('0xa')](),controller[_0x0160('0x10')]);router[_0x0160('0x11')](_0x0160('0xf'),auth[_0x0160('0xa')](),controller[_0x0160('0x12')]);module[_0x0160('0x13')]=router; \ No newline at end of file +var _0xb3d3=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','run','post'];(function(_0x15c618,_0x5c5af3){var _0x25f38d=function(_0x2575d1){while(--_0x2575d1){_0x15c618['push'](_0x15c618['shift']());}};_0x25f38d(++_0x5c5af3);}(_0xb3d3,0x1a4));var _0x3b3d=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0xb3d3[_0x2431d6];return _0x4d0f9b;};'use strict';var multer=require(_0x3b3d('0x0'));var util=require(_0x3b3d('0x1'));var path=require('path');var timeout=require(_0x3b3d('0x2'));var express=require(_0x3b3d('0x3'));var router=express['Router']();var fs_extra=require(_0x3b3d('0x4'));var auth=require(_0x3b3d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x3b3d('0x6')]('/',auth[_0x3b3d('0x7')](),controller[_0x3b3d('0x8')]);router[_0x3b3d('0x6')](_0x3b3d('0x9'),auth[_0x3b3d('0x7')](),controller['show']);router[_0x3b3d('0x6')]('/:id/run',auth[_0x3b3d('0x7')](),controller[_0x3b3d('0xa')]);router[_0x3b3d('0xb')]('/',auth[_0x3b3d('0x7')](),controller[_0x3b3d('0xc')]);router[_0x3b3d('0xd')](_0x3b3d('0x9'),auth[_0x3b3d('0x7')](),controller[_0x3b3d('0xe')]);router[_0x3b3d('0xf')]('/:id',auth[_0x3b3d('0x7')](),controller[_0x3b3d('0x10')]);module[_0x3b3d('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 0c4233f..9263e51 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 _0x5a8b=['TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','days','csv','pdf','custom','default'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5a8b,0x121));var _0xb5a8=function(_0x5079f6,_0x2e0e35){_0x5079f6=_0x5079f6-0x0;var _0x3c41c7=_0x5a8b[_0x5079f6];return _0x3c41c7;};'use strict';var Sequelize=require(_0xb5a8('0x0'));module[_0xb5a8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5a8('0x2')]},'active':{'type':Sequelize[_0xb5a8('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb5a8('0x2')],'allowNull':![],'defaultValue':_0xb5a8('0x4')},'startAt':{'type':Sequelize[_0xb5a8('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb5a8('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb5a8('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb5a8('0x7')]('years',_0xb5a8('0x8'),_0xb5a8('0x9'),'weeks',_0xb5a8('0xa'),'hours','minutes'),'allowNull':![],'defaultValue':_0xb5a8('0xa')},'output':{'type':Sequelize[_0xb5a8('0x7')](_0xb5a8('0xb'),_0xb5a8('0xc'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xb5a8('0x7')](_0xb5a8('0xd'),_0xb5a8('0xe')),'allowNull':![],'defaultValue':_0xb5a8('0xd')},'sendMail':{'type':Sequelize[_0xb5a8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xb5a8('0x2')]},'cc':{'type':Sequelize[_0xb5a8('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xb5a8('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1530=['weeks','days','hours','minutes','csv','pdf','xlsx','custom','BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','quarters','months'];(function(_0x2416dd,_0x40f222){var _0x5bef20=function(_0x1c3dbf){while(--_0x1c3dbf){_0x2416dd['push'](_0x2416dd['shift']());}};_0x5bef20(++_0x40f222);}(_0x1530,0x117));var _0x0153=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x1530[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x0153('0x0'));module[_0x0153('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0153('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0153('0x2')],'allowNull':![],'defaultValue':_0x0153('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0153('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0153('0x5')](_0x0153('0x6'),_0x0153('0x7'),_0x0153('0x8'),_0x0153('0x9'),_0x0153('0xa'),_0x0153('0xb'),_0x0153('0xc')),'allowNull':![],'defaultValue':_0x0153('0xa')},'output':{'type':Sequelize[_0x0153('0x5')](_0x0153('0xd'),_0x0153('0xe'),_0x0153('0xf')),'allowNull':![],'defaultValue':_0x0153('0xd')},'type':{'type':Sequelize[_0x0153('0x5')]('custom','default'),'allowNull':![],'defaultValue':_0x0153('0x10')},'sendMail':{'type':Sequelize[_0x0153('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0x0153('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x0153('0x11')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index de6054c..8dfa8fe 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 _0x0760=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','UserProfileResource','stack','name','send','map','Schedule','rawAttributes','type','key','query','keys','filters','attributes','model','fields','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','catch','params','intersection','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','error','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0xefdbdd,_0x257b38){var _0x579773=function(_0x4d0ad2){while(--_0x4d0ad2){_0xefdbdd['push'](_0xefdbdd['shift']());}};_0x579773(++_0x257b38);}(_0x0760,0x172));var _0x0076=function(_0x5c5c71,_0x3c2c8f){_0x5c5c71=_0x5c5c71-0x0;var _0x313bc4=_0x0760[_0x5c5c71];return _0x313bc4;};'use strict';var emlformat=require(_0x0076('0x0'));var rimraf=require(_0x0076('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0076('0x2'));var rp=require(_0x0076('0x3'));var moment=require(_0x0076('0x4'));var BPromise=require(_0x0076('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0076('0x6'));var csv=require('to-csv');var ejs=require(_0x0076('0x7'));var fs=require('fs');var fs_extra=require(_0x0076('0x8'));var _=require(_0x0076('0x9'));var squel=require(_0x0076('0xa'));var crypto=require('crypto');var jsforce=require(_0x0076('0xb'));var deskjs=require(_0x0076('0xc'));var toCsv=require(_0x0076('0xd'));var querystring=require(_0x0076('0xe'));var Papa=require('papaparse');var Redis=require(_0x0076('0xf'));var authService=require(_0x0076('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0076('0x11'));var hardwareService=require(_0x0076('0x12'));var logger=require(_0x0076('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0076('0x14'));var licenseUtil=require(_0x0076('0x15'));var db=require(_0x0076('0x16'))['db'];function respondWithStatusCode(_0x345341,_0x275c31){_0x275c31=_0x275c31||0xcc;return function(_0xb0827e){if(_0xb0827e){return _0x345341[_0x0076('0x17')](_0x275c31);}return _0x345341[_0x0076('0x18')](_0x275c31)[_0x0076('0x19')]();};}function respondWithResult(_0x38764b,_0x3fc373){_0x3fc373=_0x3fc373||0xc8;return function(_0x607b36){if(_0x607b36){return _0x38764b[_0x0076('0x18')](_0x3fc373)[_0x0076('0x1a')](_0x607b36);}};}function respondWithFilteredResult(_0x2a367e,_0x55d37a){return function(_0x272973){if(_0x272973){var _0x25cf70=typeof _0x55d37a[_0x0076('0x1b')]===_0x0076('0x1c')&&typeof _0x55d37a[_0x0076('0x1d')]===_0x0076('0x1c');var _0x1d5a97=_0x272973[_0x0076('0x1e')];var _0x1c330a=_0x25cf70?0x0:_0x55d37a['offset'];var _0x2ea8a2=_0x25cf70?_0x272973[_0x0076('0x1e')]:_0x55d37a[_0x0076('0x1b')]+_0x55d37a['limit'];var _0x17db86;if(_0x2ea8a2>=_0x1d5a97){_0x2ea8a2=_0x1d5a97;_0x17db86=0xc8;}else{_0x17db86=0xce;}_0x2a367e[_0x0076('0x18')](_0x17db86);return _0x2a367e[_0x0076('0x1f')](_0x0076('0x20'),_0x1c330a+'-'+_0x2ea8a2+'/'+_0x1d5a97)[_0x0076('0x1a')](_0x272973);}return null;};}function patchUpdates(_0x2e74a3){return function(_0x58bd4e){try{jsonpatch[_0x0076('0x21')](_0x58bd4e,_0x2e74a3,!![]);}catch(_0x34106d){return BPromise['reject'](_0x34106d);}return _0x58bd4e[_0x0076('0x22')]();};}function saveUpdates(_0x513ac9,_0x3b8c43){return function(_0x2ab9b5){if(_0x2ab9b5){return _0x2ab9b5[_0x0076('0x23')](_0x513ac9)['then'](function(_0x588aec){return _0x588aec;});}return null;};}function removeEntity(_0x15f2fa,_0x405ffe){return function(_0x4027cf){if(_0x4027cf){return _0x4027cf[_0x0076('0x24')]()[_0x0076('0x25')](function(){var _0x406e67=_0x4027cf['get']({'plain':!![]});var _0x3bb723='Scheduler';return db[_0x0076('0x26')][_0x0076('0x24')]({'where':{'type':_0x3bb723,'resourceId':_0x406e67['id']}})['then'](function(){return _0x4027cf;});})[_0x0076('0x25')](function(){_0x15f2fa['status'](0xcc)[_0x0076('0x19')]();});}};}function handleEntityNotFound(_0x2e68e1,_0x227bd3){return function(_0x158c4b){if(!_0x158c4b){_0x2e68e1[_0x0076('0x17')](0x194);}return _0x158c4b;};}function handleError(_0x38de79,_0x186949){_0x186949=_0x186949||0x1f4;return function(_0x4c286f){logger['error'](_0x4c286f[_0x0076('0x27')]);if(_0x4c286f[_0x0076('0x28')]){delete _0x4c286f[_0x0076('0x28')];}_0x38de79[_0x0076('0x18')](_0x186949)[_0x0076('0x29')](_0x4c286f);};}exports['index']=function(_0x42b1e5,_0x2c276c){var _0x9b732b={},_0x55a4e9={},_0x116f4f={'count':0x0,'rows':[]};var _0x11eb52=_[_0x0076('0x2a')](db[_0x0076('0x2b')][_0x0076('0x2c')],function(_0x3a7108){return{'name':_0x3a7108['fieldName'],'type':_0x3a7108[_0x0076('0x2d')][_0x0076('0x2e')]};});_0x55a4e9['model']=_['map'](_0x11eb52,_0x0076('0x28'));_0x55a4e9[_0x0076('0x2f')]=_[_0x0076('0x30')](_0x42b1e5[_0x0076('0x2f')]);_0x55a4e9[_0x0076('0x31')]=_['intersection'](_0x55a4e9['model'],_0x55a4e9[_0x0076('0x2f')]);_0x9b732b[_0x0076('0x32')]=_['intersection'](_0x55a4e9[_0x0076('0x33')],qs['fields'](_0x42b1e5['query'][_0x0076('0x34')]));_0x9b732b[_0x0076('0x32')]=_0x9b732b[_0x0076('0x32')]['length']?_0x9b732b[_0x0076('0x32')]:_0x55a4e9[_0x0076('0x33')];if(!_0x42b1e5[_0x0076('0x2f')]['hasOwnProperty'](_0x0076('0x35'))){_0x9b732b[_0x0076('0x1d')]=qs[_0x0076('0x1d')](_0x42b1e5[_0x0076('0x2f')][_0x0076('0x1d')]);_0x9b732b['offset']=qs[_0x0076('0x1b')](_0x42b1e5[_0x0076('0x2f')][_0x0076('0x1b')]);}_0x9b732b['order']=qs[_0x0076('0x36')](_0x42b1e5[_0x0076('0x2f')]['sort']);_0x9b732b['where']=qs[_0x0076('0x31')](_[_0x0076('0x37')](_0x42b1e5[_0x0076('0x2f')],_0x55a4e9[_0x0076('0x31')]),_0x11eb52);if(_0x42b1e5[_0x0076('0x2f')][_0x0076('0x38')]){_0x9b732b[_0x0076('0x39')]=_[_0x0076('0x3a')](_0x9b732b[_0x0076('0x39')],{'$or':_[_0x0076('0x2a')](_0x11eb52,function(_0x344461){if(_0x344461[_0x0076('0x2d')]!=='VIRTUAL'){var _0x363fbe={};_0x363fbe[_0x344461[_0x0076('0x28')]]={'$like':'%'+_0x42b1e5['query']['filter']+'%'};return _0x363fbe;}})});}_0x9b732b=_[_0x0076('0x3a')]({},_0x9b732b,_0x42b1e5[_0x0076('0x3b')]);var _0x1a9a13={'where':_0x9b732b[_0x0076('0x39')]};return db[_0x0076('0x2b')][_0x0076('0x1e')](_0x1a9a13)[_0x0076('0x25')](function(_0xbde489){_0x116f4f[_0x0076('0x1e')]=_0xbde489;if(_0x42b1e5[_0x0076('0x2f')]['includeAll']){_0x9b732b[_0x0076('0x3c')]=[{'all':!![]}];}return db[_0x0076('0x2b')][_0x0076('0x3d')](_0x9b732b);})['then'](function(_0x5ef3f3){_0x116f4f[_0x0076('0x3e')]=_0x5ef3f3;return _0x116f4f;})[_0x0076('0x25')](respondWithFilteredResult(_0x2c276c,_0x9b732b))[_0x0076('0x3f')](handleError(_0x2c276c,null));};exports['show']=function(_0x12cb33,_0x39456c){var _0x9c8019={'raw':![],'where':{'id':_0x12cb33[_0x0076('0x40')]['id']}},_0x315a32={};_0x315a32[_0x0076('0x33')]=_[_0x0076('0x30')](db[_0x0076('0x2b')][_0x0076('0x2c')]);_0x315a32[_0x0076('0x2f')]=_['keys'](_0x12cb33['query']);_0x315a32[_0x0076('0x31')]=_[_0x0076('0x41')](_0x315a32[_0x0076('0x33')],_0x315a32[_0x0076('0x2f')]);_0x9c8019[_0x0076('0x32')]=_[_0x0076('0x41')](_0x315a32[_0x0076('0x33')],qs['fields'](_0x12cb33[_0x0076('0x2f')]['fields']));_0x9c8019[_0x0076('0x32')]=_0x9c8019['attributes'][_0x0076('0x42')]?_0x9c8019[_0x0076('0x32')]:_0x315a32[_0x0076('0x33')];if(_0x12cb33[_0x0076('0x2f')][_0x0076('0x43')]){_0x9c8019[_0x0076('0x3c')]=[{'all':!![]}];}_0x9c8019=_['merge']({},_0x9c8019,_0x12cb33[_0x0076('0x3b')]);return db[_0x0076('0x2b')][_0x0076('0x44')](_0x9c8019)[_0x0076('0x25')](handleEntityNotFound(_0x39456c,null))[_0x0076('0x25')](respondWithResult(_0x39456c,null))['catch'](handleError(_0x39456c,null));};exports[_0x0076('0x45')]=function(_0x3bb425,_0x2c3afa){return db[_0x0076('0x2b')][_0x0076('0x45')](_0x3bb425[_0x0076('0x46')],{})['then'](function(_0x3959cf){var _0x4651f7=_0x3bb425['user'][_0x0076('0x47')]({'plain':!![]});if(!_0x4651f7)throw new Error(_0x0076('0x48'));if(_0x4651f7[_0x0076('0x49')]==='user'){var _0x2854b0=_0x3959cf['get']({'plain':!![]});var _0x123ed8=_0x0076('0x4a');return db['UserProfileSection'][_0x0076('0x44')]({'where':{'name':_0x123ed8,'userProfileId':_0x4651f7['userProfileId']},'raw':!![]})[_0x0076('0x25')](function(_0x12605e){if(_0x12605e&&_0x12605e['autoAssociation']===0x0){return db[_0x0076('0x26')]['create']({'name':_0x2854b0[_0x0076('0x28')],'resourceId':_0x2854b0['id'],'type':_0x12605e['name'],'sectionId':_0x12605e['id']},{})[_0x0076('0x25')](function(){return _0x3959cf;});}else{return _0x3959cf;}})[_0x0076('0x3f')](function(_0x333d53){logger[_0x0076('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x333d53);throw _0x333d53;});}return _0x3959cf;})[_0x0076('0x25')](respondWithResult(_0x2c3afa,0xc9))[_0x0076('0x3f')](handleError(_0x2c3afa,null));};exports['update']=function(_0x5d417e,_0x555939){if(_0x5d417e['body']['id']){delete _0x5d417e['body']['id'];}return db[_0x0076('0x2b')][_0x0076('0x44')]({'where':{'id':_0x5d417e['params']['id']}})[_0x0076('0x25')](handleEntityNotFound(_0x555939,null))[_0x0076('0x25')](saveUpdates(_0x5d417e['body'],null))[_0x0076('0x25')](respondWithResult(_0x555939,null))[_0x0076('0x3f')](handleError(_0x555939,null));};exports[_0x0076('0x24')]=function(_0x520ad3,_0xcf46f9){return db[_0x0076('0x2b')][_0x0076('0x44')]({'where':{'id':_0x520ad3[_0x0076('0x40')]['id']}})[_0x0076('0x25')](handleEntityNotFound(_0xcf46f9,null))[_0x0076('0x25')](removeEntity(_0xcf46f9,null))[_0x0076('0x3f')](handleError(_0xcf46f9,null));};exports['run']=function(_0x31c55f,_0xe57ce5,_0x5336aa){var _0x3f05e0=require(_0x0076('0x4c'));return db[_0x0076('0x2b')]['find']({'where':{'id':_0x31c55f[_0x0076('0x40')]['id']},'raw':!![]})[_0x0076('0x25')](handleEntityNotFound(_0xe57ce5,null))['then'](function(){_0x3f05e0['run'](_0x31c55f[_0x0076('0x40')]['id']);})[_0x0076('0x25')](respondWithStatusCode(_0xe57ce5,null))[_0x0076('0x3f')](handleError(_0xe57ce5,null));}; \ No newline at end of file +var _0x18ed=['include','rows','catch','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','bluebird','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','reject','save','update','destroy','then','Scheduler','UserProfileResource','end','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll'];(function(_0x108539,_0x121c19){var _0x547eea=function(_0x399211){while(--_0x399211){_0x108539['push'](_0x108539['shift']());}};_0x547eea(++_0x121c19);}(_0x18ed,0x1d6));var _0xd18e=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x18ed[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd18e('0x0'));var zipdir=require(_0xd18e('0x1'));var jsonpatch=require(_0xd18e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd18e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd18e('0x4'));var sox=require('sox');var csv=require(_0xd18e('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd18e('0x6'));var squel=require('squel');var crypto=require(_0xd18e('0x7'));var jsforce=require(_0xd18e('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xd18e('0x5'));var querystring=require(_0xd18e('0x9'));var Papa=require(_0xd18e('0xa'));var Redis=require(_0xd18e('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xd18e('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd18e('0xd'));var logger=require(_0xd18e('0xe'))(_0xd18e('0xf'));var utils=require(_0xd18e('0x10'));var config=require(_0xd18e('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xd18e('0x12'))['db'];function respondWithStatusCode(_0x42c883,_0x3c84d2){_0x3c84d2=_0x3c84d2||0xcc;return function(_0x59c6cf){if(_0x59c6cf){return _0x42c883[_0xd18e('0x13')](_0x3c84d2);}return _0x42c883[_0xd18e('0x14')](_0x3c84d2)['end']();};}function respondWithResult(_0x55a8cd,_0x58d818){_0x58d818=_0x58d818||0xc8;return function(_0x58e366){if(_0x58e366){return _0x55a8cd[_0xd18e('0x14')](_0x58d818)['json'](_0x58e366);}};}function respondWithFilteredResult(_0xae045d,_0x19e13e){return function(_0xd81734){if(_0xd81734){var _0x16006c=typeof _0x19e13e[_0xd18e('0x15')]==='undefined'&&typeof _0x19e13e['limit']===_0xd18e('0x16');var _0x315a43=_0xd81734[_0xd18e('0x17')];var _0x1a7505=_0x16006c?0x0:_0x19e13e[_0xd18e('0x15')];var _0x4088cc=_0x16006c?_0xd81734[_0xd18e('0x17')]:_0x19e13e['offset']+_0x19e13e[_0xd18e('0x18')];var _0x101bc3;if(_0x4088cc>=_0x315a43){_0x4088cc=_0x315a43;_0x101bc3=0xc8;}else{_0x101bc3=0xce;}_0xae045d[_0xd18e('0x14')](_0x101bc3);return _0xae045d[_0xd18e('0x19')]('Content-Range',_0x1a7505+'-'+_0x4088cc+'/'+_0x315a43)[_0xd18e('0x1a')](_0xd81734);}return null;};}function patchUpdates(_0x104d4f){return function(_0xa55a83){try{jsonpatch['apply'](_0xa55a83,_0x104d4f,!![]);}catch(_0x1f6c11){return BPromise[_0xd18e('0x1b')](_0x1f6c11);}return _0xa55a83[_0xd18e('0x1c')]();};}function saveUpdates(_0x52910b,_0x59ab9e){return function(_0x36b2f3){if(_0x36b2f3){return _0x36b2f3[_0xd18e('0x1d')](_0x52910b)['then'](function(_0x5237bf){return _0x5237bf;});}return null;};}function removeEntity(_0x1a9b65,_0x49b79b){return function(_0x3ee755){if(_0x3ee755){return _0x3ee755[_0xd18e('0x1e')]()[_0xd18e('0x1f')](function(){var _0x4c5c41=_0x3ee755['get']({'plain':!![]});var _0x10af20=_0xd18e('0x20');return db[_0xd18e('0x21')][_0xd18e('0x1e')]({'where':{'type':_0x10af20,'resourceId':_0x4c5c41['id']}})[_0xd18e('0x1f')](function(){return _0x3ee755;});})[_0xd18e('0x1f')](function(){_0x1a9b65[_0xd18e('0x14')](0xcc)[_0xd18e('0x22')]();});}};}function handleEntityNotFound(_0xd7d5be,_0x30c87d){return function(_0x1e025b){if(!_0x1e025b){_0xd7d5be[_0xd18e('0x13')](0x194);}return _0x1e025b;};}function handleError(_0x56c8e4,_0x532ebc){_0x532ebc=_0x532ebc||0x1f4;return function(_0x466128){logger[_0xd18e('0x23')](_0x466128['stack']);if(_0x466128[_0xd18e('0x24')]){delete _0x466128[_0xd18e('0x24')];}_0x56c8e4[_0xd18e('0x14')](_0x532ebc)[_0xd18e('0x25')](_0x466128);};}exports[_0xd18e('0x26')]=function(_0x5566cb,_0x100db1){var _0x11aafe={},_0x379789={},_0x3e7b62={'count':0x0,'rows':[]};var _0x56c4f8=_[_0xd18e('0x27')](db[_0xd18e('0x28')][_0xd18e('0x29')],function(_0x344a2d){return{'name':_0x344a2d[_0xd18e('0x2a')],'type':_0x344a2d[_0xd18e('0x2b')][_0xd18e('0x2c')]};});_0x379789[_0xd18e('0x2d')]=_[_0xd18e('0x27')](_0x56c4f8,_0xd18e('0x24'));_0x379789['query']=_[_0xd18e('0x2e')](_0x5566cb['query']);_0x379789[_0xd18e('0x2f')]=_[_0xd18e('0x30')](_0x379789[_0xd18e('0x2d')],_0x379789[_0xd18e('0x31')]);_0x11aafe[_0xd18e('0x32')]=_[_0xd18e('0x30')](_0x379789[_0xd18e('0x2d')],qs[_0xd18e('0x33')](_0x5566cb[_0xd18e('0x31')][_0xd18e('0x33')]));_0x11aafe[_0xd18e('0x32')]=_0x11aafe[_0xd18e('0x32')][_0xd18e('0x34')]?_0x11aafe[_0xd18e('0x32')]:_0x379789['model'];if(!_0x5566cb[_0xd18e('0x31')][_0xd18e('0x35')](_0xd18e('0x36'))){_0x11aafe[_0xd18e('0x18')]=qs[_0xd18e('0x18')](_0x5566cb[_0xd18e('0x31')]['limit']);_0x11aafe[_0xd18e('0x15')]=qs[_0xd18e('0x15')](_0x5566cb[_0xd18e('0x31')]['offset']);}_0x11aafe[_0xd18e('0x37')]=qs[_0xd18e('0x38')](_0x5566cb['query']['sort']);_0x11aafe[_0xd18e('0x39')]=qs[_0xd18e('0x2f')](_[_0xd18e('0x3a')](_0x5566cb[_0xd18e('0x31')],_0x379789[_0xd18e('0x2f')]),_0x56c4f8);if(_0x5566cb[_0xd18e('0x31')]['filter']){_0x11aafe[_0xd18e('0x39')]=_[_0xd18e('0x3b')](_0x11aafe[_0xd18e('0x39')],{'$or':_[_0xd18e('0x27')](_0x56c4f8,function(_0x1280c8){if(_0x1280c8[_0xd18e('0x2b')]!=='VIRTUAL'){var _0x88813c={};_0x88813c[_0x1280c8[_0xd18e('0x24')]]={'$like':'%'+_0x5566cb[_0xd18e('0x31')]['filter']+'%'};return _0x88813c;}})});}_0x11aafe=_[_0xd18e('0x3b')]({},_0x11aafe,_0x5566cb[_0xd18e('0x3c')]);var _0x5f255b={'where':_0x11aafe[_0xd18e('0x39')]};return db[_0xd18e('0x28')]['count'](_0x5f255b)[_0xd18e('0x1f')](function(_0x676092){_0x3e7b62[_0xd18e('0x17')]=_0x676092;if(_0x5566cb['query'][_0xd18e('0x3d')]){_0x11aafe[_0xd18e('0x3e')]=[{'all':!![]}];}return db[_0xd18e('0x28')]['findAll'](_0x11aafe);})['then'](function(_0x590851){_0x3e7b62[_0xd18e('0x3f')]=_0x590851;return _0x3e7b62;})[_0xd18e('0x1f')](respondWithFilteredResult(_0x100db1,_0x11aafe))[_0xd18e('0x40')](handleError(_0x100db1,null));};exports['show']=function(_0x6392d7,_0x685b89){var _0x4510ef={'raw':![],'where':{'id':_0x6392d7['params']['id']}},_0x16db15={};_0x16db15[_0xd18e('0x2d')]=_[_0xd18e('0x2e')](db[_0xd18e('0x28')][_0xd18e('0x29')]);_0x16db15[_0xd18e('0x31')]=_[_0xd18e('0x2e')](_0x6392d7['query']);_0x16db15['filters']=_[_0xd18e('0x30')](_0x16db15[_0xd18e('0x2d')],_0x16db15[_0xd18e('0x31')]);_0x4510ef['attributes']=_[_0xd18e('0x30')](_0x16db15[_0xd18e('0x2d')],qs[_0xd18e('0x33')](_0x6392d7[_0xd18e('0x31')][_0xd18e('0x33')]));_0x4510ef[_0xd18e('0x32')]=_0x4510ef[_0xd18e('0x32')][_0xd18e('0x34')]?_0x4510ef[_0xd18e('0x32')]:_0x16db15[_0xd18e('0x2d')];if(_0x6392d7[_0xd18e('0x31')]['includeAll']){_0x4510ef[_0xd18e('0x3e')]=[{'all':!![]}];}_0x4510ef=_[_0xd18e('0x3b')]({},_0x4510ef,_0x6392d7[_0xd18e('0x3c')]);return db[_0xd18e('0x28')][_0xd18e('0x41')](_0x4510ef)[_0xd18e('0x1f')](handleEntityNotFound(_0x685b89,null))[_0xd18e('0x1f')](respondWithResult(_0x685b89,null))[_0xd18e('0x40')](handleError(_0x685b89,null));};exports[_0xd18e('0x42')]=function(_0x3d6285,_0x1edf7b){return db['Schedule'][_0xd18e('0x42')](_0x3d6285['body'],{})[_0xd18e('0x1f')](function(_0x5bcfdb){var _0x2cc0a4=_0x3d6285[_0xd18e('0x43')][_0xd18e('0x44')]({'plain':!![]});if(!_0x2cc0a4)throw new Error(_0xd18e('0x45'));if(_0x2cc0a4[_0xd18e('0x46')]===_0xd18e('0x43')){var _0x20d061=_0x5bcfdb['get']({'plain':!![]});var _0x540db6=_0xd18e('0x20');return db['UserProfileSection']['find']({'where':{'name':_0x540db6,'userProfileId':_0x2cc0a4[_0xd18e('0x47')]},'raw':!![]})[_0xd18e('0x1f')](function(_0x30a3ba){if(_0x30a3ba&&_0x30a3ba[_0xd18e('0x48')]===0x0){return db['UserProfileResource'][_0xd18e('0x42')]({'name':_0x20d061[_0xd18e('0x24')],'resourceId':_0x20d061['id'],'type':_0x30a3ba[_0xd18e('0x24')],'sectionId':_0x30a3ba['id']},{})[_0xd18e('0x1f')](function(){return _0x5bcfdb;});}else{return _0x5bcfdb;}})[_0xd18e('0x40')](function(_0x608043){logger[_0xd18e('0x23')](_0xd18e('0x49'),_0x608043);throw _0x608043;});}return _0x5bcfdb;})[_0xd18e('0x1f')](respondWithResult(_0x1edf7b,0xc9))[_0xd18e('0x40')](handleError(_0x1edf7b,null));};exports[_0xd18e('0x1d')]=function(_0x3659ce,_0x3e7a3e){if(_0x3659ce[_0xd18e('0x4a')]['id']){delete _0x3659ce['body']['id'];}return db[_0xd18e('0x28')][_0xd18e('0x41')]({'where':{'id':_0x3659ce[_0xd18e('0x4b')]['id']}})[_0xd18e('0x1f')](handleEntityNotFound(_0x3e7a3e,null))[_0xd18e('0x1f')](saveUpdates(_0x3659ce['body'],null))[_0xd18e('0x1f')](respondWithResult(_0x3e7a3e,null))[_0xd18e('0x40')](handleError(_0x3e7a3e,null));};exports[_0xd18e('0x1e')]=function(_0x9bd24,_0x4525ce){return db['Schedule'][_0xd18e('0x41')]({'where':{'id':_0x9bd24[_0xd18e('0x4b')]['id']}})[_0xd18e('0x1f')](handleEntityNotFound(_0x4525ce,null))[_0xd18e('0x1f')](removeEntity(_0x4525ce,null))[_0xd18e('0x40')](handleError(_0x4525ce,null));};exports['run']=function(_0x137cf5,_0x4173de,_0x31eee0){var _0x2dc8e0=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x137cf5[_0xd18e('0x4b')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4173de,null))[_0xd18e('0x1f')](function(){_0x2dc8e0['run'](_0x137cf5['params']['id']);})['then'](respondWithStatusCode(_0x4173de,null))[_0xd18e('0x40')](handleError(_0x4173de,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ddd6496..82a487f 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 _0x126b=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules'];(function(_0x1d051e,_0xd6eb3d){var _0x46b8f2=function(_0x276912){while(--_0x276912){_0x1d051e['push'](_0x1d051e['shift']());}};_0x46b8f2(++_0xd6eb3d);}(_0x126b,0x1e1));var _0xb126=function(_0x16f77c,_0x5256b1){_0x16f77c=_0x16f77c-0x0;var _0x78986e=_0x126b[_0x16f77c];return _0x78986e;};'use strict';var _=require(_0xb126('0x0'));var util=require('util');var logger=require(_0xb126('0x1'))('api');var moment=require(_0xb126('0x2'));var BPromise=require(_0xb126('0x3'));var rp=require(_0xb126('0x4'));var fs=require('fs');var path=require(_0xb126('0x5'));var rimraf=require(_0xb126('0x6'));var config=require(_0xb126('0x7'));var attributes=require(_0xb126('0x8'));module[_0xb126('0x9')]=function(_0x17a26c,_0x228053){return _0x17a26c[_0xb126('0xa')](_0xb126('0xb'),attributes,{'tableName':_0xb126('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba47=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./schedule.attributes','exports','tools_schedules'];(function(_0xd734fb,_0x1efad){var _0x135c0d=function(_0x51f00c){while(--_0x51f00c){_0xd734fb['push'](_0xd734fb['shift']());}};_0x135c0d(++_0x1efad);}(_0xba47,0x96));var _0x7ba4=function(_0xc83823,_0x44d247){_0xc83823=_0xc83823-0x0;var _0x3402d2=_0xba47[_0xc83823];return _0x3402d2;};'use strict';var _=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var logger=require(_0x7ba4('0x2'))(_0x7ba4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7ba4('0x4'));var fs=require('fs');var path=require(_0x7ba4('0x5'));var rimraf=require(_0x7ba4('0x6'));var config=require('../../config/environment');var attributes=require(_0x7ba4('0x7'));module[_0x7ba4('0x8')]=function(_0xee9357,_0x3fcec4){return _0xee9357['define']('Schedule',attributes,{'tableName':_0x7ba4('0x9'),'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 a626132..98ee4b5 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 _0x6ec6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ec6,0x187));var _0x66ec=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x6ec6[_0xf44d98];return _0x5ebb04;};'use strict';var _=require(_0x66ec('0x0'));var util=require(_0x66ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x66ec('0x2'));var fs=require('fs');var Redis=require(_0x66ec('0x3'));var db=require(_0x66ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x66ec('0x5'))(_0x66ec('0x6'));var config=require(_0x66ec('0x7'));var jayson=require(_0x66ec('0x8'));var client=jayson[_0x66ec('0x9')][_0x66ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x361aa4,_0x3305af,_0x3bde56){return new BPromise(function(_0x2b35c2,_0x58af24){return client[_0x66ec('0xb')](_0x361aa4,_0x3bde56)[_0x66ec('0xc')](function(_0x106204){logger[_0x66ec('0xd')](_0x66ec('0xe'),_0x3305af,'request\x20sent');logger[_0x66ec('0xf')](_0x66ec('0x10'),_0x3305af,_0x66ec('0x11'),JSON['stringify'](_0x106204));if(_0x106204[_0x66ec('0x12')]){if(_0x106204['error'][_0x66ec('0x13')]===0x1f4){logger['error'](_0x66ec('0xe'),_0x3305af,_0x106204['error'][_0x66ec('0x14')]);return _0x58af24(_0x106204[_0x66ec('0x12')][_0x66ec('0x14')]);}logger[_0x66ec('0x12')](_0x66ec('0xe'),_0x3305af,_0x106204[_0x66ec('0x12')][_0x66ec('0x14')]);return _0x2b35c2(_0x106204[_0x66ec('0x12')][_0x66ec('0x14')]);}else{logger[_0x66ec('0xd')](_0x66ec('0xe'),_0x3305af,_0x66ec('0x11'));_0x2b35c2(_0x106204['result'][_0x66ec('0x14')]);}})[_0x66ec('0x15')](function(_0x395488){logger[_0x66ec('0x12')](_0x66ec('0xe'),_0x3305af,_0x395488);_0x58af24(_0x395488);});});} \ No newline at end of file +var _0x49f0=['request\x20sent','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x451e75,_0x17657a){var _0x3b709f=function(_0x5d2fa6){while(--_0x5d2fa6){_0x451e75['push'](_0x451e75['shift']());}};_0x3b709f(++_0x17657a);}(_0x49f0,0xc7));var _0x049f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x49f0[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x049f('0x0'));var moment=require(_0x049f('0x1'));var BPromise=require(_0x049f('0x2'));var rs=require(_0x049f('0x3'));var fs=require('fs');var Redis=require(_0x049f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x049f('0x5'));var logger=require(_0x049f('0x6'))(_0x049f('0x7'));var config=require(_0x049f('0x8'));var jayson=require(_0x049f('0x9'));var client=jayson[_0x049f('0xa')][_0x049f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x474623,_0x1f4ec6,_0x1b7fe0){return new BPromise(function(_0x3d141b,_0x5d9c0c){return client[_0x049f('0xc')](_0x474623,_0x1b7fe0)[_0x049f('0xd')](function(_0x20ef7d){logger['info'](_0x049f('0xe'),_0x1f4ec6,'request\x20sent');logger[_0x049f('0xf')](_0x049f('0x10'),_0x1f4ec6,_0x049f('0x11'),JSON['stringify'](_0x20ef7d));if(_0x20ef7d[_0x049f('0x12')]){if(_0x20ef7d[_0x049f('0x12')][_0x049f('0x13')]===0x1f4){logger[_0x049f('0x12')](_0x049f('0xe'),_0x1f4ec6,_0x20ef7d[_0x049f('0x12')]['message']);return _0x5d9c0c(_0x20ef7d[_0x049f('0x12')][_0x049f('0x14')]);}logger[_0x049f('0x12')]('Schedule,\x20%s,\x20%s',_0x1f4ec6,_0x20ef7d[_0x049f('0x12')][_0x049f('0x14')]);return _0x3d141b(_0x20ef7d['error']['message']);}else{logger[_0x049f('0x15')](_0x049f('0xe'),_0x1f4ec6,_0x049f('0x11'));_0x3d141b(_0x20ef7d[_0x049f('0x16')][_0x049f('0x14')]);}})[_0x049f('0x17')](function(_0x4c2f97){logger['error']('Schedule,\x20%s,\x20%s',_0x1f4ec6,_0x4c2f97);_0x5d9c0c(_0x4c2f97);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f6854f4..ef53ed9 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 _0x707d=['./screenRecording.controller','get','index','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1f84e8,_0x3e1cc8){var _0x13837a=function(_0x619e6d){while(--_0x619e6d){_0x1f84e8['push'](_0x1f84e8['shift']());}};_0x13837a(++_0x3e1cc8);}(_0x707d,0x1dc));var _0xd707=function(_0xf76e36,_0xb2bdc4){_0xf76e36=_0xf76e36-0x0;var _0x50f783=_0x707d[_0xf76e36];return _0x50f783;};'use strict';var multer=require(_0xd707('0x0'));var util=require(_0xd707('0x1'));var path=require(_0xd707('0x2'));var timeout=require(_0xd707('0x3'));var express=require('express');var router=express[_0xd707('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd707('0x5'));var interaction=require(_0xd707('0x6'));var config=require(_0xd707('0x7'));var controller=require(_0xd707('0x8'));router[_0xd707('0x9')]('/',auth['isAuthenticated'](),controller[_0xd707('0xa')]);router[_0xd707('0x9')]('/describe',auth[_0xd707('0xb')](),controller['describe']);router[_0xd707('0x9')](_0xd707('0xc'),auth[_0xd707('0xb')](),controller[_0xd707('0xd')]);router[_0xd707('0x9')](_0xd707('0xe'),auth[_0xd707('0xb')](),controller[_0xd707('0xf')]);router[_0xd707('0x10')]('/',auth['isAuthenticated'](),controller[_0xd707('0x11')]);router[_0xd707('0x12')](_0xd707('0xc'),auth[_0xd707('0xb')](),controller[_0xd707('0x13')]);router[_0xd707('0x14')](_0xd707('0xc'),auth[_0xd707('0xb')](),controller[_0xd707('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3744=['describe','show','/:id/download','download','create','put','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','get','index','isAuthenticated'];(function(_0xdde30a,_0x3e2df5){var _0x3807d9=function(_0x53d4e9){while(--_0x53d4e9){_0xdde30a['push'](_0xdde30a['shift']());}};_0x3807d9(++_0x3e2df5);}(_0x3744,0xf3));var _0x4374=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3744[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x4374('0x0'));var util=require(_0x4374('0x1'));var path=require('path');var timeout=require(_0x4374('0x2'));var express=require(_0x4374('0x3'));var router=express['Router']();var fs_extra=require(_0x4374('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4374('0x5'));var controller=require('./screenRecording.controller');router[_0x4374('0x6')]('/',auth['isAuthenticated'](),controller[_0x4374('0x7')]);router[_0x4374('0x6')]('/describe',auth[_0x4374('0x8')](),controller[_0x4374('0x9')]);router[_0x4374('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4374('0xa')]);router[_0x4374('0x6')](_0x4374('0xb'),auth[_0x4374('0x8')](),controller[_0x4374('0xc')]);router['post']('/',auth[_0x4374('0x8')](),controller[_0x4374('0xd')]);router[_0x4374('0xe')](_0x4374('0xf'),auth[_0x4374('0x8')](),controller['update']);router['delete'](_0x4374('0xf'),auth[_0x4374('0x8')](),controller[_0x4374('0x10')]);module[_0x4374('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 5db0499..37669b4 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 _0xc274=['extname','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','exports','VIRTUAL','getDataValue','value'];(function(_0x3d0a74,_0x4dcf25){var _0x1371f5=function(_0x55fd56){while(--_0x55fd56){_0x3d0a74['push'](_0x3d0a74['shift']());}};_0x1371f5(++_0x4dcf25);}(_0xc274,0x151));var _0x4c27=function(_0x5a16c8,_0x470f39){_0x5a16c8=_0x5a16c8-0x0;var _0x1feb8d=_0xc274[_0x5a16c8];return _0x1feb8d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4c27('0x0'));var path=require('path');var config=require('../../config/environment');module[_0x4c27('0x1')]={'format':{'type':Sequelize[_0x4c27('0x2')],'get':function(){return this[_0x4c27('0x3')](_0x4c27('0x4'))?path[_0x4c27('0x5')](this[_0x4c27('0x3')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x4c27('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x4c27('0x6')],'set':function(_0x18fd2c){var _0x38de2d=_0x18fd2c['replace'](/\\/g,'/');this['setDataValue'](_0x4c27('0x4'),_0x38de2d);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4c27('0x7')],'set':function(_0x2a0c76){this[_0x4c27('0x8')](_0x4c27('0x9'),moment()[_0x4c27('0xa')](_0x2a0c76,'ms'));this['setDataValue'](_0x4c27('0xb'),moment());this[_0x4c27('0x8')](_0x4c27('0xc'),_0x2a0c76);}},'startedAt':{'type':Sequelize[_0x4c27('0xd')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x4c27('0xe')](_0x4c27('0xf'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4c27('0x3')](_0x4c27('0xb')))[_0x4c27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x4c27('0x10')]();}},'createdAt':{'type':Sequelize[_0x4c27('0xd')],'get':function(){return moment(this[_0x4c27('0x3')]('createdAt'))[_0x4c27('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x4c27('0xd')],'get':function(){return moment(this[_0x4c27('0x3')](_0x4c27('0x11')))[_0x4c27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x4c27('0x10')]();}}}; \ No newline at end of file +var _0x7334=['startedAt','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','sequelize','moment','path','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER'];(function(_0x277325,_0x2420cf){var _0x4840ba=function(_0x3f0d29){while(--_0x3f0d29){_0x277325['push'](_0x277325['shift']());}};_0x4840ba(++_0x2420cf);}(_0x7334,0x184));var _0x4733=function(_0x3d40f2,_0x22634b){_0x3d40f2=_0x3d40f2-0x0;var _0x54e104=_0x7334[_0x3d40f2];return _0x54e104;};'use strict';var Sequelize=require(_0x4733('0x0'));var moment=require(_0x4733('0x1'));var path=require(_0x4733('0x2'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x4733('0x3')],'get':function(){return this['getDataValue'](_0x4733('0x4'))?path[_0x4733('0x5')](this[_0x4733('0x6')](_0x4733('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x4733('0x7')]},'channel':{'type':Sequelize[_0x4733('0x7')]},'value':{'type':Sequelize[_0x4733('0x7')],'set':function(_0x283754){var _0x12cafa=_0x283754[_0x4733('0x8')](/\\/g,'/');this[_0x4733('0x9')](_0x4733('0x4'),_0x12cafa);}},'rating':{'type':Sequelize[_0x4733('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4733('0xa')],'set':function(_0x2d5fde){this[_0x4733('0x9')](_0x4733('0xb'),moment()['subtract'](_0x2d5fde,'ms'));this[_0x4733('0x9')](_0x4733('0xc'),moment());this['setDataValue'](_0x4733('0xd'),_0x2d5fde);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4733('0x6')](_0x4733('0xb')))[_0x4733('0xe')](_0x4733('0xf'))[_0x4733('0x10')]();}},'closedAt':{'type':Sequelize[_0x4733('0x11')],'get':function(){return moment(this[_0x4733('0x6')]('closedAt'))[_0x4733('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x4733('0x10')]();}},'createdAt':{'type':Sequelize[_0x4733('0x11')],'get':function(){return moment(this[_0x4733('0x6')](_0x4733('0x12')))[_0x4733('0xe')](_0x4733('0xf'))[_0x4733('0x10')]();}},'updatedAt':{'type':Sequelize[_0x4733('0x11')],'get':function(){return moment(this[_0x4733('0x6')]('updatedAt'))[_0x4733('0xe')](_0x4733('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3d43d26..3fdac78 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 _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x5c81ae,_0x5a1391){var _0x5325a9=function(_0xd522a2){while(--_0xd522a2){_0x5c81ae['push'](_0x5c81ae['shift']());}};_0x5325a9(++_0x5a1391);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file +var _0x032e=['status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','send','rawAttributes','fieldName','type','model','differenceBy','map','format','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ScreenRecording','rows','catch','show','find','create','body','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','zip-dir','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x3eb84f,_0x5967a5){var _0x5af663=function(_0x50fa8b){while(--_0x50fa8b){_0x3eb84f['push'](_0x3eb84f['shift']());}};_0x5af663(++_0x5967a5);}(_0x032e,0x124));var _0xe032=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x032e[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xe032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe032('0x1'));var jsonpatch=require(_0xe032('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe032('0x3'));var Mustache=require(_0xe032('0x4'));var util=require(_0xe032('0x5'));var path=require(_0xe032('0x6'));var sox=require(_0xe032('0x7'));var csv=require(_0xe032('0x8'));var ejs=require(_0xe032('0x9'));var fs=require('fs');var fs_extra=require(_0xe032('0xa'));var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x8'));var querystring=require(_0xe032('0x10'));var Papa=require(_0xe032('0x11'));var Redis=require(_0xe032('0x12'));var authService=require(_0xe032('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe032('0x14'));var hardwareService=require(_0xe032('0x15'));var logger=require(_0xe032('0x16'))(_0xe032('0x17'));var utils=require(_0xe032('0x18'));var config=require(_0xe032('0x19'));var licenseUtil=require(_0xe032('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xcc;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0x1b')](_0x266d71);}return _0x646979['status'](_0x266d71)[_0xe032('0x1c')]();};}function respondWithResult(_0x2e267b,_0x176547){_0x176547=_0x176547||0xc8;return function(_0x422e96){if(_0x422e96){return _0x2e267b[_0xe032('0x1d')](_0x176547)[_0xe032('0x1e')](_0x422e96);}};}function respondWithFilteredResult(_0x2bf528,_0x4da5b7){return function(_0x231c35){if(_0x231c35){var _0x749018=typeof _0x4da5b7[_0xe032('0x1f')]===_0xe032('0x20')&&typeof _0x4da5b7[_0xe032('0x21')]===_0xe032('0x20');var _0x4cdab3=_0x231c35[_0xe032('0x22')];var _0x25cedb=_0x749018?0x0:_0x4da5b7[_0xe032('0x1f')];var _0x41d2a5=_0x749018?_0x231c35[_0xe032('0x22')]:_0x4da5b7['offset']+_0x4da5b7['limit'];var _0x484e6c;if(_0x41d2a5>=_0x4cdab3){_0x41d2a5=_0x4cdab3;_0x484e6c=0xc8;}else{_0x484e6c=0xce;}_0x2bf528[_0xe032('0x1d')](_0x484e6c);return _0x2bf528['set'](_0xe032('0x23'),_0x25cedb+'-'+_0x41d2a5+'/'+_0x4cdab3)[_0xe032('0x1e')](_0x231c35);}return null;};}function patchUpdates(_0x3f0257){return function(_0x2aa342){try{jsonpatch[_0xe032('0x24')](_0x2aa342,_0x3f0257,!![]);}catch(_0x256f71){return BPromise[_0xe032('0x25')](_0x256f71);}return _0x2aa342['save']();};}function saveUpdates(_0x32f8b6,_0x866c81){return function(_0x232e8f){if(_0x232e8f){return _0x232e8f[_0xe032('0x26')](_0x32f8b6)[_0xe032('0x27')](function(_0x33d89a){return _0x33d89a;});}return null;};}function removeEntity(_0x22831a,_0xe89aa7){return function(_0x499da5){if(_0x499da5){return _0x499da5['destroy']()['then'](function(){_0x22831a[_0xe032('0x1d')](0xcc)[_0xe032('0x1c')]();});}};}function handleEntityNotFound(_0x302559,_0x2a56e5){return function(_0x2bfe8f){if(!_0x2bfe8f){_0x302559[_0xe032('0x1b')](0x194);}return _0x2bfe8f;};}function handleError(_0x36ece7,_0x2b6ffa){_0x2b6ffa=_0x2b6ffa||0x1f4;return function(_0x4dcbf1){logger[_0xe032('0x28')](_0x4dcbf1['stack']);if(_0x4dcbf1[_0xe032('0x29')]){delete _0x4dcbf1[_0xe032('0x29')];}_0x36ece7[_0xe032('0x1d')](_0x2b6ffa)[_0xe032('0x2a')](_0x4dcbf1);};}exports['index']=function(_0x5573e4,_0x3e2575){var _0x38e7ea={},_0x469290={},_0xae116e={'count':0x0,'rows':[]};var _0x4e8b72=_['map'](db['ScreenRecording'][_0xe032('0x2b')],function(_0x1dd34f){return{'name':_0x1dd34f[_0xe032('0x2c')],'type':_0x1dd34f[_0xe032('0x2d')]['key']};});_0x469290[_0xe032('0x2e')]=_[_0xe032('0x2f')](_[_0xe032('0x30')](_0x4e8b72,_0xe032('0x29')),[_0xe032('0x31')]);_0x469290['query']=_[_0xe032('0x32')](_0x5573e4[_0xe032('0x33')]);_0x469290[_0xe032('0x34')]=_[_0xe032('0x35')](_0x469290['model'],_0x469290[_0xe032('0x33')]);_0x38e7ea['attributes']=_[_0xe032('0x35')](_0x469290['model'],qs[_0xe032('0x36')](_0x5573e4['query'][_0xe032('0x36')]));_0x38e7ea['attributes']=_0x38e7ea[_0xe032('0x37')][_0xe032('0x38')]?_0x38e7ea['attributes']:_0x469290[_0xe032('0x2e')];if(!_0x5573e4[_0xe032('0x33')][_0xe032('0x39')](_0xe032('0x3a'))){_0x38e7ea['limit']=qs[_0xe032('0x21')](_0x5573e4['query'][_0xe032('0x21')]);_0x38e7ea[_0xe032('0x1f')]=qs['offset'](_0x5573e4[_0xe032('0x33')][_0xe032('0x1f')]);}_0x38e7ea['order']=qs[_0xe032('0x3b')](_0x5573e4[_0xe032('0x33')][_0xe032('0x3b')]);_0x38e7ea[_0xe032('0x3c')]=qs[_0xe032('0x34')](_[_0xe032('0x3d')](_0x5573e4[_0xe032('0x33')],_0x469290[_0xe032('0x34')]),_0x4e8b72);if(_0x5573e4[_0xe032('0x33')][_0xe032('0x3e')]){_0x38e7ea[_0xe032('0x3c')]=_[_0xe032('0x3f')](_0x38e7ea[_0xe032('0x3c')],{'$or':_[_0xe032('0x30')](_0x4e8b72,function(_0x39af44){if(_0x39af44[_0xe032('0x2d')]!==_0xe032('0x40')){var _0x555914={};_0x555914[_0x39af44[_0xe032('0x29')]]={'$like':'%'+_0x5573e4['query'][_0xe032('0x3e')]+'%'};return _0x555914;}})});}_0x38e7ea=_[_0xe032('0x3f')]({},_0x38e7ea,_0x5573e4[_0xe032('0x41')]);var _0x119790={'where':_0x38e7ea[_0xe032('0x3c')]};return db['ScreenRecording'][_0xe032('0x22')](_0x119790)['then'](function(_0x46ea84){_0xae116e['count']=_0x46ea84;if(_0x5573e4[_0xe032('0x33')][_0xe032('0x42')]){_0x38e7ea[_0xe032('0x43')]=[{'all':!![]}];}return db[_0xe032('0x44')]['findAll'](_0x38e7ea);})[_0xe032('0x27')](function(_0x5a6450){_0xae116e[_0xe032('0x45')]=_0x5a6450;return _0xae116e;})[_0xe032('0x27')](respondWithFilteredResult(_0x3e2575,_0x38e7ea))[_0xe032('0x46')](handleError(_0x3e2575,null));};exports[_0xe032('0x47')]=function(_0x4b58eb,_0x513b0c){var _0x45345d={'raw':![],'where':{'id':_0x4b58eb['params']['id']}},_0x203021={};_0x203021[_0xe032('0x2e')]=_[_0xe032('0x32')](db[_0xe032('0x44')][_0xe032('0x2b')]);_0x203021[_0xe032('0x33')]=_['keys'](_0x4b58eb[_0xe032('0x33')]);_0x203021[_0xe032('0x34')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],_0x203021[_0xe032('0x33')]);_0x45345d[_0xe032('0x37')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],qs['fields'](_0x4b58eb['query'][_0xe032('0x36')]));_0x45345d['attributes']=_0x45345d[_0xe032('0x37')][_0xe032('0x38')]?_0x45345d[_0xe032('0x37')]:_0x203021[_0xe032('0x2e')];if(_0x4b58eb[_0xe032('0x33')][_0xe032('0x42')]){_0x45345d[_0xe032('0x43')]=[{'all':!![]}];}_0x45345d=_[_0xe032('0x3f')]({},_0x45345d,_0x4b58eb[_0xe032('0x41')]);return db['ScreenRecording'][_0xe032('0x48')](_0x45345d)['then'](handleEntityNotFound(_0x513b0c,null))['then'](respondWithResult(_0x513b0c,null))[_0xe032('0x46')](handleError(_0x513b0c,null));};exports[_0xe032('0x49')]=function(_0x62bfc8,_0x1e54d3){return db['ScreenRecording'][_0xe032('0x49')](_0x62bfc8[_0xe032('0x4a')],{})[_0xe032('0x27')](respondWithResult(_0x1e54d3,0xc9))[_0xe032('0x46')](handleError(_0x1e54d3,null));};exports[_0xe032('0x26')]=function(_0x233d9e,_0x3774bc){if(_0x233d9e['body']['id']){delete _0x233d9e[_0xe032('0x4a')]['id'];}delete _0x233d9e[_0xe032('0x4a')]['duration'];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4b')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4c')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4d')];return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x233d9e[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](handleEntityNotFound(_0x3774bc,null))[_0xe032('0x27')](saveUpdates(_0x233d9e[_0xe032('0x4a')],null))[_0xe032('0x27')](respondWithResult(_0x3774bc,null))[_0xe032('0x46')](handleError(_0x3774bc,null));};exports['describe']=function(_0x1c8b32,_0x53c8b2){return db[_0xe032('0x44')][_0xe032('0x4f')]()[_0xe032('0x27')](respondWithResult(_0x53c8b2,null))[_0xe032('0x46')](handleError(_0x53c8b2,null));};exports[_0xe032('0x50')]=function(_0x1b7a91,_0x2e29d3,_0xa98ee6){var _0x16c91e=require(_0xe032('0x51'));var _0x1b9012=![];var _0x564fe0={};if(_0x1b7a91[_0xe032('0x33')][_0xe032('0x2d')]&&_0x1b7a91['query'][_0xe032('0x2d')]==='uniqueid'){_0x564fe0[_0xe032('0x52')]=_0x1b7a91[_0xe032('0x4e')]['id'];}else{_0x564fe0['id']=_0x1b7a91[_0xe032('0x4e')]['id'];}return db[_0xe032('0x44')][_0xe032('0x48')]({'where':_0x564fe0,'attributes':['id','value'],'raw':!![]})[_0xe032('0x27')](handleEntityNotFound(_0x2e29d3,null))[_0xe032('0x27')](function(_0x1e1277){if(_0x1e1277){var _0x21a32f=path[_0xe032('0x53')](config[_0xe032('0x54')],_0xe032('0x55'),_0x1e1277['value']);var _0x3f46c0=util[_0xe032('0x31')](_0xe032('0x56'),_0x21a32f);if(fs[_0xe032('0x57')](_0x3f46c0)){_0x1b9012=!![];return _0x16c91e[_0xe032('0x58')](_0x3f46c0,_0x21a32f,config[_0xe032('0x59')][_0xe032('0x5a')])[_0xe032('0x27')](function(){return _0x1e1277;});}return _0x1e1277;}})[_0xe032('0x27')](function(_0x54c0b0){if(_0x54c0b0){var _0x795a58=path[_0xe032('0x53')](config[_0xe032('0x54')],'server/files/screen_recordings',_0x54c0b0[_0xe032('0x4d')]);if(!fs[_0xe032('0x57')](_0x795a58)){throw new db['Sequelize'][(_0xe032('0x5b'))](_0xe032('0x5c'));}if(_0x54c0b0[_0xe032('0x5d')]){return _0x2e29d3[_0xe032('0x50')](_0x795a58,_0x54c0b0[_0xe032('0x5d')]+path[_0xe032('0x5e')](_0x795a58),function(){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}else{return _0x2e29d3[_0xe032('0x50')](_0x795a58,function(_0x1aa18e){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}}})[_0xe032('0x46')](function(_0x505986){if(_0x505986[_0xe032('0x60')]===_0xe032('0x5c')){_0x2e29d3[_0xe032('0x1d')](0x194)[_0xe032('0x2a')](_0xe032('0x61'));}else{return handleError(_0x2e29d3,null);}});};exports['destroy']=function(_0x2b6ef8,_0x55e6b0){return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x2b6ef8[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](function(_0x3c5eb8){if(_[_0xe032('0x62')](_0x3c5eb8)){throw new ReferenceError(_0xe032('0x63'));}return _0x3c5eb8;})[_0xe032('0x27')](function(_0x22fd01){var _0x536510=path['join'](config['root'],_0xe032('0x55'),_0x22fd01[_0xe032('0x4d')]);logger[_0xe032('0x64')](_0xe032('0x65'),_0x536510);if(!_[_0xe032('0x62')](_0x22fd01[_0xe032('0x4d')])&&fs['existsSync'](_0x536510)){logger[_0xe032('0x64')](_0xe032('0x66')+_0x536510+_0xe032('0x67'));fs['unlinkSync'](_0x536510);}_0x536510=_0x536510+_0xe032('0x68');if(!_['isNil'](_0x22fd01[_0xe032('0x4d')])&&fs[_0xe032('0x57')](_0x536510)){logger['info']('File:\x20\x22'+_0x536510+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe032('0x69')](_0x536510);}return _0x22fd01;})['then'](function(_0x5157f7){if(!_0x5157f7)throw new InternalError();return _0x5157f7[_0xe032('0x6a')]();})[_0xe032('0x27')](function(){_0x55e6b0[_0xe032('0x1d')](0xcc)['end']();})[_0xe032('0x46')](handleError(_0x55e6b0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 5726c63..0bdb9c4 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 _0xf206=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid'];(function(_0x478ac7,_0x512396){var _0x5a5cb8=function(_0x188e58){while(--_0x188e58){_0x478ac7['push'](_0x478ac7['shift']());}};_0x5a5cb8(++_0x512396);}(_0xf206,0x79));var _0x6f20=function(_0x431086,_0x243ab9){_0x431086=_0x431086-0x0;var _0x2457fb=_0xf206[_0x431086];return _0x2457fb;};'use strict';var _=require(_0x6f20('0x0'));var util=require('util');var logger=require(_0x6f20('0x1'))('api');var moment=require(_0x6f20('0x2'));var BPromise=require(_0x6f20('0x3'));var rp=require(_0x6f20('0x4'));var fs=require('fs');var path=require(_0x6f20('0x5'));var rimraf=require('rimraf');var config=require(_0x6f20('0x6'));var attributes=require(_0x6f20('0x7'));module['exports']=function(_0x5980a9,_0x49391e){return _0x5980a9['define'](_0x6f20('0x8'),attributes,{'tableName':_0x6f20('0x9'),'paranoid':![],'indexes':[{'name':_0x6f20('0xa'),'fields':[_0x6f20('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe46b=['util','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x22a3f0,_0x4b7c5c){var _0x474ec7=function(_0x40042f){while(--_0x40042f){_0x22a3f0['push'](_0x22a3f0['shift']());}};_0x474ec7(++_0x4b7c5c);}(_0xe46b,0xe9));var _0xbe46=function(_0x488275,_0x11eb0d){_0x488275=_0x488275-0x0;var _0x5f2cbc=_0xe46b[_0x488275];return _0x5f2cbc;};'use strict';var _=require(_0xbe46('0x0'));var util=require(_0xbe46('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe46('0x2'));var BPromise=require(_0xbe46('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe46('0x4'));var rimraf=require(_0xbe46('0x5'));var config=require(_0xbe46('0x6'));var attributes=require(_0xbe46('0x7'));module[_0xbe46('0x8')]=function(_0x20f602,_0x14f160){return _0x20f602[_0xbe46('0x9')](_0xbe46('0xa'),attributes,{'tableName':_0xbe46('0xb'),'paranoid':![],'indexes':[{'name':_0xbe46('0xc'),'fields':[_0xbe46('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index d20294f..99e4e22 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 _0x4997=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x4997,0x106));var _0x7499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4997[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7499('0x0'));var util=require(_0x7499('0x1'));var moment=require(_0x7499('0x2'));var BPromise=require('bluebird');var rs=require(_0x7499('0x3'));var fs=require('fs');var Redis=require(_0x7499('0x4'));var db=require(_0x7499('0x5'))['db'];var utils=require(_0x7499('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7499('0x7'));var jayson=require(_0x7499('0x8'));var client=jayson[_0x7499('0x9')][_0x7499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5119f7,_0x40d84e,_0x42a2c7){return new BPromise(function(_0x4caed1,_0x50933b){return client[_0x7499('0xb')](_0x5119f7,_0x42a2c7)['then'](function(_0x4828a0){logger[_0x7499('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x40d84e,_0x7499('0xd'));logger[_0x7499('0xe')](_0x7499('0xf'),_0x40d84e,_0x7499('0xd'),JSON[_0x7499('0x10')](_0x4828a0));if(_0x4828a0[_0x7499('0x11')]){if(_0x4828a0[_0x7499('0x11')]['code']===0x1f4){logger['error'](_0x7499('0x12'),_0x40d84e,_0x4828a0['error'][_0x7499('0x13')]);return _0x50933b(_0x4828a0[_0x7499('0x11')][_0x7499('0x13')]);}logger['error'](_0x7499('0x12'),_0x40d84e,_0x4828a0[_0x7499('0x11')][_0x7499('0x13')]);return _0x4caed1(_0x4828a0[_0x7499('0x11')][_0x7499('0x13')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x40d84e,_0x7499('0xd'));_0x4caed1(_0x4828a0[_0x7499('0x14')][_0x7499('0x13')]);}})[_0x7499('0x15')](function(_0x94e889){logger['error'](_0x7499('0x12'),_0x40d84e,_0x94e889);_0x50933b(_0x94e889);});});} \ No newline at end of file +var _0x6ce9=['jayson/promise','http','then','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x68d93e,_0x57a06a){var _0x3a4cf2=function(_0x307223){while(--_0x307223){_0x68d93e['push'](_0x68d93e['shift']());}};_0x3a4cf2(++_0x57a06a);}(_0x6ce9,0x167));var _0x96ce=function(_0x1bf5cf,_0x5cbd5f){_0x1bf5cf=_0x1bf5cf-0x0;var _0x40600a=_0x6ce9[_0x1bf5cf];return _0x40600a;};'use strict';var _=require(_0x96ce('0x0'));var util=require(_0x96ce('0x1'));var moment=require(_0x96ce('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96ce('0x3'));var db=require(_0x96ce('0x4'))['db'];var utils=require(_0x96ce('0x5'));var logger=require(_0x96ce('0x6'))(_0x96ce('0x7'));var config=require(_0x96ce('0x8'));var jayson=require(_0x96ce('0x9'));var client=jayson['client'][_0x96ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55bf87,_0x35af5b,_0x3ff8d6){return new BPromise(function(_0x508196,_0x136567){return client['request'](_0x55bf87,_0x3ff8d6)[_0x96ce('0xb')](function(_0x5c89b2){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x35af5b,_0x96ce('0xc'));logger[_0x96ce('0xd')](_0x96ce('0xe'),_0x35af5b,_0x96ce('0xc'),JSON[_0x96ce('0xf')](_0x5c89b2));if(_0x5c89b2['error']){if(_0x5c89b2[_0x96ce('0x10')][_0x96ce('0x11')]===0x1f4){logger[_0x96ce('0x10')](_0x96ce('0x12'),_0x35af5b,_0x5c89b2[_0x96ce('0x10')][_0x96ce('0x13')]);return _0x136567(_0x5c89b2[_0x96ce('0x10')][_0x96ce('0x13')]);}logger[_0x96ce('0x10')](_0x96ce('0x12'),_0x35af5b,_0x5c89b2['error'][_0x96ce('0x13')]);return _0x508196(_0x5c89b2[_0x96ce('0x10')][_0x96ce('0x13')]);}else{logger[_0x96ce('0x14')](_0x96ce('0x12'),_0x35af5b,_0x96ce('0xc'));_0x508196(_0x5c89b2[_0x96ce('0x15')][_0x96ce('0x13')]);}})[_0x96ce('0x16')](function(_0xf7c28b){logger[_0x96ce('0x10')](_0x96ce('0x12'),_0x35af5b,_0xf7c28b);_0x136567(_0xf7c28b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 0886e96..2d8ddf0 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 _0x0560=['addLogoLogin','server/files/images/logos/','preferred','favicon','/:id/favicon','put','isAuthenticated','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','/now','/:id','show','/:id/logo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','format','%s%s','logo','originalname','file','logologin','extname','post','/:id/logo_login','single'];(function(_0xc3769a,_0x6b59a9){var _0x2cea9a=function(_0x5557e0){while(--_0x5557e0){_0xc3769a['push'](_0xc3769a['shift']());}};_0x2cea9a(++_0x6b59a9);}(_0x0560,0xa3));var _0x0056=function(_0x61c0ad,_0xe79770){_0x61c0ad=_0x61c0ad-0x0;var _0x15a50e=_0x0560[_0x61c0ad];return _0x15a50e;};'use strict';var multer=require(_0x0056('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0056('0x1'));var express=require(_0x0056('0x2'));var router=express[_0x0056('0x3')]();var fs_extra=require(_0x0056('0x4'));var auth=require(_0x0056('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0056('0x6'));var controller=require(_0x0056('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0056('0x8')](_0x0056('0x9'),controller['getDate']);router[_0x0056('0x8')](_0x0056('0xa'),controller[_0x0056('0xb')]);router[_0x0056('0x8')](_0x0056('0xc'),controller['getLogo']);router[_0x0056('0x8')]('/:id/logo_login',controller[_0x0056('0xd')]);router['get'](_0x0056('0xe'),controller[_0x0056('0xf')]);router[_0x0056('0x8')](_0x0056('0x10'),controller[_0x0056('0x11')]);router[_0x0056('0x8')]('/:id/favicon',controller[_0x0056('0x12')]);var upload=multer({'storage':multer[_0x0056('0x13')]({'destination':function(_0x1fc841,_0x3a4d3f,_0x7ec60b){_0x7ec60b(null,path[_0x0056('0x14')](config[_0x0056('0x15')],'server/files/images/logos/'));},'filename':function(_0x429d19,_0x366198,_0x832c98){_0x832c98(null,util[_0x0056('0x16')](_0x0056('0x17'),_0x0056('0x18'),path['extname'](_0x366198[_0x0056('0x19')])));}})});router['post']('/:id/logo',upload['single'](_0x0056('0x1a')),controller['addLogo']);var upload=multer({'storage':multer[_0x0056('0x13')]({'destination':function(_0x5a46d8,_0x21fdb7,_0x47ecdb){_0x47ecdb(null,path['join'](config[_0x0056('0x15')],'server/files/images/logos/'));},'filename':function(_0x17408b,_0x5ac76a,_0x4b75b6){_0x4b75b6(null,util['format'](_0x0056('0x17'),_0x0056('0x1b'),path[_0x0056('0x1c')](_0x5ac76a[_0x0056('0x19')])));}})});router[_0x0056('0x1d')](_0x0056('0x1e'),upload[_0x0056('0x1f')]('file'),controller[_0x0056('0x20')]);var upload=multer({'storage':multer[_0x0056('0x13')]({'destination':function(_0x236d71,_0x32aade,_0x5895ff){_0x5895ff(null,path[_0x0056('0x14')](config[_0x0056('0x15')],_0x0056('0x21')));},'filename':function(_0x19afe4,_0xdbb9aa,_0x416d48){_0x416d48(null,util[_0x0056('0x16')]('%s%s',_0x0056('0x22'),path[_0x0056('0x1c')](_0xdbb9aa[_0x0056('0x19')])));}})});router[_0x0056('0x1d')](_0x0056('0x10'),upload[_0x0056('0x1f')](_0x0056('0x1a')),controller['addPreferred']);var upload=multer({'storage':multer[_0x0056('0x13')]({'destination':function(_0x318900,_0x33ce79,_0x41be06){_0x41be06(null,path[_0x0056('0x14')](config[_0x0056('0x15')],_0x0056('0x21')));},'filename':function(_0x2a60d5,_0x23e3d4,_0x27ed6a){_0x27ed6a(null,util[_0x0056('0x16')](_0x0056('0x17'),_0x0056('0x23'),path[_0x0056('0x1c')](_0x23e3d4[_0x0056('0x19')])));}})});router[_0x0056('0x1d')](_0x0056('0x24'),upload[_0x0056('0x1f')]('file'),controller['addFavicon']);router[_0x0056('0x25')](_0x0056('0xa'),auth[_0x0056('0x26')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x9481=['/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','post','file','addLogoLogin','diskStorage','/:id/preferred','favicon','addFavicon','put','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo'];(function(_0x6d1142,_0x429284){var _0x553f7c=function(_0x11bcfa){while(--_0x11bcfa){_0x6d1142['push'](_0x6d1142['shift']());}};_0x553f7c(++_0x429284);}(_0x9481,0x19d));var _0x1948=function(_0x1b5c5c,_0x1935ef){_0x1b5c5c=_0x1b5c5c-0x0;var _0x43f472=_0x9481[_0x1b5c5c];return _0x43f472;};'use strict';var multer=require('multer');var util=require(_0x1948('0x0'));var path=require(_0x1948('0x1'));var timeout=require(_0x1948('0x2'));var express=require(_0x1948('0x3'));var router=express[_0x1948('0x4')]();var fs_extra=require(_0x1948('0x5'));var auth=require(_0x1948('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1948('0x7'));router[_0x1948('0x8')]('/',auth[_0x1948('0x9')](),controller[_0x1948('0xa')]);router[_0x1948('0x8')](_0x1948('0xb'),controller[_0x1948('0xc')]);router[_0x1948('0x8')](_0x1948('0xd'),controller['show']);router['get'](_0x1948('0xe'),controller[_0x1948('0xf')]);router['get'](_0x1948('0x10'),controller[_0x1948('0x11')]);router['get'](_0x1948('0x12'),controller[_0x1948('0x13')]);router['get']('/:id/preferred',controller[_0x1948('0x14')]);router['get'](_0x1948('0x15'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22c22e,_0x2f290d,_0x498c72){_0x498c72(null,path[_0x1948('0x16')](config[_0x1948('0x17')],_0x1948('0x18')));},'filename':function(_0x493850,_0x51c75a,_0xe4eb28){_0xe4eb28(null,util[_0x1948('0x19')](_0x1948('0x1a'),_0x1948('0x1b'),path[_0x1948('0x1c')](_0x51c75a[_0x1948('0x1d')])));}})});router['post']('/:id/logo',upload[_0x1948('0x1e')]('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2612be,_0x6cba25,_0x230ccc){_0x230ccc(null,path['join'](config[_0x1948('0x17')],_0x1948('0x18')));},'filename':function(_0x1f75d8,_0x45c6bd,_0x1cccf4){_0x1cccf4(null,util[_0x1948('0x19')]('%s%s','logologin',path[_0x1948('0x1c')](_0x45c6bd['originalname'])));}})});router[_0x1948('0x1f')](_0x1948('0x10'),upload[_0x1948('0x1e')](_0x1948('0x20')),controller[_0x1948('0x21')]);var upload=multer({'storage':multer[_0x1948('0x22')]({'destination':function(_0x365cf6,_0x1e0a1b,_0x5e410c){_0x5e410c(null,path['join'](config[_0x1948('0x17')],_0x1948('0x18')));},'filename':function(_0x3273ab,_0xac9513,_0x514b15){_0x514b15(null,util[_0x1948('0x19')](_0x1948('0x1a'),'preferred',path['extname'](_0xac9513[_0x1948('0x1d')])));}})});router[_0x1948('0x1f')](_0x1948('0x23'),upload[_0x1948('0x1e')](_0x1948('0x20')),controller['addPreferred']);var upload=multer({'storage':multer[_0x1948('0x22')]({'destination':function(_0x4fbf42,_0x15f102,_0x334ca6){_0x334ca6(null,path[_0x1948('0x16')](config[_0x1948('0x17')],_0x1948('0x18')));},'filename':function(_0x11ae60,_0xe21934,_0x858a83){_0x858a83(null,util[_0x1948('0x19')]('%s%s',_0x1948('0x24'),path['extname'](_0xe21934[_0x1948('0x1d')])));}})});router[_0x1948('0x1f')]('/:id/favicon',upload[_0x1948('0x1e')]('file'),controller[_0x1948('0x25')]);router[_0x1948('0x26')]('/:id',auth[_0x1948('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 1ce361a..de4b332 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 _0xcf17=['INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0xfca425,_0x2950d6){var _0x44ea89=function(_0x5c0db6){while(--_0x5c0db6){_0xfca425['push'](_0xfca425['shift']());}};_0x44ea89(++_0x2950d6);}(_0xcf17,0xaf));var _0x7cf1=function(_0x16a0ec,_0x18dbf4){_0x16a0ec=_0x16a0ec-0x0;var _0x52b1c5=_0xcf17[_0x16a0ec];return _0x52b1c5;};'use strict';var Sequelize=require(_0x7cf1('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x7cf1('0x1')](0xb),'unique':_0x7cf1('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7cf1('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x7cf1('0x3')],'defaultValue':_0x7cf1('0x4')},'logo':{'type':Sequelize[_0x7cf1('0x3')]},'defaultLogo':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7cf1('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7cf1('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x7cf1('0x3')]},'turnpassword':{'type':Sequelize[_0x7cf1('0x3')]},'pageTitle':{'type':Sequelize[_0x7cf1('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7cf1('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7cf1('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7cf1('0x3')],'defaultValue':_0x7cf1('0x6')},'chatTimeout':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7cf1('0x3')]},'defaultPreferred':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7cf1('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7cf1('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7cf1('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7cf1('0x1')](0x2)[_0x7cf1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7cf1('0x1')](0x2)[_0x7cf1('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x7cf1('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7cf1('0x1')](0x2)[_0x7cf1('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x5}}; \ No newline at end of file +var _0x497c=['sequelize','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x22ffbf,_0x16f31e){var _0x360c17=function(_0x40807f){while(--_0x40807f){_0x22ffbf['push'](_0x22ffbf['shift']());}};_0x360c17(++_0x16f31e);}(_0x497c,0x195));var _0xc497=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x497c[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0xc497('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xc497('0x1')](0xb),'unique':_0xc497('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xc497('0x1')](0xb),'unique':_0xc497('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xc497('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xc497('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xc497('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xc497('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xc497('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xc497('0x4')]},'pageTitle':{'type':Sequelize[_0xc497('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xc497('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xc497('0x6')},'enableEmailPreview':{'type':Sequelize[_0xc497('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xc497('0x4')],'defaultValue':_0xc497('0x7')},'chatTimeout':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc497('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc497('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc497('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xc497('0x4')]},'defaultFavicon':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc497('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc497('0x1')]},'transcribeRegion':{'type':Sequelize[_0xc497('0x4')]},'sentiment':{'type':Sequelize[_0xc497('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xc497('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc497('0x4')]},'bucket':{'type':Sequelize[_0xc497('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xc497('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xc497('0x1')](0x2)[_0xc497('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xc497('0x1')](0x2)[_0xc497('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xc497('0x1')](0x2)[_0xc497('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xc497('0x1')](0x2)[_0xc497('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xc497('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xc497('0x1')],'defaultValue':0x5}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index f3bd7ba..1891535 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 _0xdef6=['defaultFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','limit','count','offset','apply','reject','save','update','destroy','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','show','params','rawAttributes','find','body','addLogo','file','filename','addLogoLogin','getLogo','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','server/files/images/logos','getLicense','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','default_preferred.png','getFavicon'];(function(_0x5a76ff,_0x35b0b4){var _0x59a6e0=function(_0xd772e4){while(--_0xd772e4){_0x5a76ff['push'](_0x5a76ff['shift']());}};_0x59a6e0(++_0x35b0b4);}(_0xdef6,0x172));var _0x6def=function(_0x287a0c,_0xa5cbc5){_0x287a0c=_0x287a0c-0x0;var _0x1233eb=_0xdef6[_0x287a0c];return _0x1233eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6def('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6def('0x1'));var rp=require(_0x6def('0x2'));var moment=require(_0x6def('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6def('0x4'));var util=require('util');var path=require(_0x6def('0x5'));var sox=require(_0x6def('0x6'));var csv=require(_0x6def('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6def('0x8'));var _=require(_0x6def('0x9'));var squel=require('squel');var crypto=require(_0x6def('0xa'));var jsforce=require(_0x6def('0xb'));var deskjs=require(_0x6def('0xc'));var toCsv=require(_0x6def('0x7'));var querystring=require(_0x6def('0xd'));var Papa=require(_0x6def('0xe'));var Redis=require(_0x6def('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6def('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6def('0x11'));var logger=require('../../config/logger')(_0x6def('0x12'));var utils=require(_0x6def('0x13'));var config=require(_0x6def('0x14'));var licenseUtil=require(_0x6def('0x15'));var db=require(_0x6def('0x16'))['db'];var jayson=require(_0x6def('0x17'));var client=jayson[_0x6def('0x18')][_0x6def('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5e90fc,_0x5d8ce8,_0x27929b,_0x546bb6){return new BPromise(function(_0x2592b9,_0x475889){var _0x13765d=_0x546bb6||client;return _0x13765d['request'](_0x5e90fc,_0x27929b)[_0x6def('0x1a')](function(_0x50cffe){logger[_0x6def('0x1b')](_0x6def('0x1c'),_0x5d8ce8,_0x6def('0x1d'));logger[_0x6def('0x1e')](_0x6def('0x1f'),_0x5d8ce8,_0x6def('0x1d'),JSON[_0x6def('0x20')](_0x50cffe));if(_0x50cffe[_0x6def('0x21')]){if(_0x50cffe['error'][_0x6def('0x22')]===0x1f4){logger['error'](_0x6def('0x1c'),_0x5d8ce8,_0x50cffe[_0x6def('0x21')][_0x6def('0x23')]);return _0x475889(_0x50cffe['error'][_0x6def('0x23')]);}logger[_0x6def('0x21')](_0x6def('0x1c'),_0x5d8ce8,_0x50cffe['error'][_0x6def('0x23')]);return _0x2592b9(_0x50cffe[_0x6def('0x21')]['message']);}else{logger['info'](_0x6def('0x1c'),_0x5d8ce8,'request\x20sent');_0x2592b9(_0x50cffe[_0x6def('0x24')][_0x6def('0x23')]);}})[_0x6def('0x25')](function(_0x432794){logger['error']('Setting,\x20%s,\x20%s',_0x5d8ce8,_0x432794);_0x475889(_0x432794);});});}function respondWithStatusCode(_0x5034fb,_0x5e5fe7){_0x5e5fe7=_0x5e5fe7||0xcc;return function(_0x23b204){if(_0x23b204){return _0x5034fb[_0x6def('0x26')](_0x5e5fe7);}return _0x5034fb[_0x6def('0x27')](_0x5e5fe7)[_0x6def('0x28')]();};}function respondWithResult(_0x37f974,_0x50f16c){_0x50f16c=_0x50f16c||0xc8;return function(_0x1ed119){if(_0x1ed119){return _0x37f974[_0x6def('0x27')](_0x50f16c)['json'](_0x1ed119);}};}function respondWithFilteredResult(_0x2a1c02,_0xbdfd05){return function(_0x384afc){if(_0x384afc){var _0x5a9983=typeof _0xbdfd05['offset']==='undefined'&&typeof _0xbdfd05[_0x6def('0x29')]==='undefined';var _0x5d6856=_0x384afc[_0x6def('0x2a')];var _0x37d2d9=_0x5a9983?0x0:_0xbdfd05[_0x6def('0x2b')];var _0xcf9c9e=_0x5a9983?_0x384afc[_0x6def('0x2a')]:_0xbdfd05['offset']+_0xbdfd05['limit'];var _0x258222;if(_0xcf9c9e>=_0x5d6856){_0xcf9c9e=_0x5d6856;_0x258222=0xc8;}else{_0x258222=0xce;}_0x2a1c02[_0x6def('0x27')](_0x258222);return _0x2a1c02['set']('Content-Range',_0x37d2d9+'-'+_0xcf9c9e+'/'+_0x5d6856)['json'](_0x384afc);}return null;};}function patchUpdates(_0x4d2ed5){return function(_0x186c00){try{jsonpatch[_0x6def('0x2c')](_0x186c00,_0x4d2ed5,!![]);}catch(_0x126c69){return BPromise[_0x6def('0x2d')](_0x126c69);}return _0x186c00[_0x6def('0x2e')]();};}function saveUpdates(_0x263340,_0xfcff0e){return function(_0x35135a){if(_0x35135a){return _0x35135a[_0x6def('0x2f')](_0x263340)[_0x6def('0x1a')](function(_0x2bf56b){return _0x2bf56b;});}return null;};}function removeEntity(_0x3c5b10,_0x137dc2){return function(_0x29de9a){if(_0x29de9a){return _0x29de9a[_0x6def('0x30')]()[_0x6def('0x1a')](function(){_0x3c5b10['status'](0xcc)[_0x6def('0x28')]();});}};}function handleEntityNotFound(_0x308f88,_0x2c0741){return function(_0x42a286){if(!_0x42a286){_0x308f88['sendStatus'](0x194);}return _0x42a286;};}function handleError(_0x3b06f9,_0x2728b6){_0x2728b6=_0x2728b6||0x1f4;return function(_0x39c113){logger[_0x6def('0x21')](_0x39c113[_0x6def('0x31')]);if(_0x39c113['name']){delete _0x39c113[_0x6def('0x32')];}_0x3b06f9[_0x6def('0x27')](_0x2728b6)[_0x6def('0x33')](_0x39c113);};}exports[_0x6def('0x34')]=function(_0xd61967,_0x2339e8){var _0x3d77b2={},_0x852000={},_0x4b05c6={'count':0x0,'rows':[]};var _0x4cbe72=_[_0x6def('0x35')](db[_0x6def('0x36')]['rawAttributes'],function(_0x21b0ac){return{'name':_0x21b0ac[_0x6def('0x37')],'type':_0x21b0ac[_0x6def('0x38')][_0x6def('0x39')]};});_0x852000[_0x6def('0x3a')]=_['map'](_0x4cbe72,_0x6def('0x32'));_0x852000[_0x6def('0x3b')]=_[_0x6def('0x3c')](_0xd61967[_0x6def('0x3b')]);_0x852000['filters']=_[_0x6def('0x3d')](_0x852000[_0x6def('0x3a')],_0x852000[_0x6def('0x3b')]);_0x3d77b2[_0x6def('0x3e')]=_[_0x6def('0x3d')](_0x852000[_0x6def('0x3a')],qs[_0x6def('0x3f')](_0xd61967['query'][_0x6def('0x3f')]));_0x3d77b2[_0x6def('0x3e')]=_0x3d77b2['attributes'][_0x6def('0x40')]?_0x3d77b2[_0x6def('0x3e')]:_0x852000[_0x6def('0x3a')];if(!_0xd61967[_0x6def('0x3b')]['hasOwnProperty'](_0x6def('0x41'))){_0x3d77b2['limit']=qs['limit'](_0xd61967[_0x6def('0x3b')][_0x6def('0x29')]);_0x3d77b2[_0x6def('0x2b')]=qs[_0x6def('0x2b')](_0xd61967['query'][_0x6def('0x2b')]);}_0x3d77b2[_0x6def('0x42')]=qs[_0x6def('0x43')](_0xd61967[_0x6def('0x3b')][_0x6def('0x43')]);_0x3d77b2[_0x6def('0x44')]=qs[_0x6def('0x45')](_['pick'](_0xd61967['query'],_0x852000[_0x6def('0x45')]),_0x4cbe72);if(_0xd61967[_0x6def('0x3b')][_0x6def('0x46')]){_0x3d77b2[_0x6def('0x44')]=_['merge'](_0x3d77b2['where'],{'$or':_[_0x6def('0x35')](_0x4cbe72,function(_0x7b028d){if(_0x7b028d[_0x6def('0x38')]!==_0x6def('0x47')){var _0x4617b7={};_0x4617b7[_0x7b028d[_0x6def('0x32')]]={'$like':'%'+_0xd61967[_0x6def('0x3b')]['filter']+'%'};return _0x4617b7;}})});}_0x3d77b2=_[_0x6def('0x48')]({},_0x3d77b2,_0xd61967[_0x6def('0x49')]);var _0x34714c={'where':_0x3d77b2[_0x6def('0x44')]};return db[_0x6def('0x36')][_0x6def('0x2a')](_0x34714c)['then'](function(_0x54b66a){_0x4b05c6[_0x6def('0x2a')]=_0x54b66a;if(_0xd61967[_0x6def('0x3b')][_0x6def('0x4a')]){_0x3d77b2[_0x6def('0x4b')]=[{'all':!![]}];}return db[_0x6def('0x36')]['findAll'](_0x3d77b2);})[_0x6def('0x1a')](function(_0x5542b7){_0x4b05c6['rows']=_0x5542b7;return _0x4b05c6;})[_0x6def('0x1a')](respondWithFilteredResult(_0x2339e8,_0x3d77b2))['catch'](handleError(_0x2339e8,null));};exports[_0x6def('0x4c')]=function(_0x4b6c9c,_0x17e802){var _0x5deb33={'raw':![],'where':{'id':_0x4b6c9c[_0x6def('0x4d')]['id']}},_0x3b15b0={};_0x3b15b0[_0x6def('0x3a')]=_['keys'](db[_0x6def('0x36')][_0x6def('0x4e')]);_0x3b15b0[_0x6def('0x3b')]=_['keys'](_0x4b6c9c['query']);_0x3b15b0[_0x6def('0x45')]=_[_0x6def('0x3d')](_0x3b15b0['model'],_0x3b15b0[_0x6def('0x3b')]);_0x5deb33[_0x6def('0x3e')]=_[_0x6def('0x3d')](_0x3b15b0[_0x6def('0x3a')],qs[_0x6def('0x3f')](_0x4b6c9c[_0x6def('0x3b')]['fields']));_0x5deb33['attributes']=_0x5deb33['attributes'][_0x6def('0x40')]?_0x5deb33['attributes']:_0x3b15b0[_0x6def('0x3a')];if(_0x4b6c9c[_0x6def('0x3b')][_0x6def('0x4a')]){_0x5deb33['include']=[{'all':!![]}];}_0x5deb33=_[_0x6def('0x48')]({},_0x5deb33,_0x4b6c9c[_0x6def('0x49')]);return db['Setting'][_0x6def('0x4f')](_0x5deb33)[_0x6def('0x1a')](handleEntityNotFound(_0x17e802,null))[_0x6def('0x1a')](respondWithResult(_0x17e802,null))[_0x6def('0x25')](handleError(_0x17e802,null));};exports[_0x6def('0x2f')]=function(_0x3899a9,_0x5320fe){if(_0x3899a9[_0x6def('0x50')]['id']){delete _0x3899a9[_0x6def('0x50')]['id'];}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x3899a9['params']['id']}})[_0x6def('0x1a')](handleEntityNotFound(_0x5320fe,null))[_0x6def('0x1a')](saveUpdates(_0x3899a9[_0x6def('0x50')],null))[_0x6def('0x1a')](respondWithResult(_0x5320fe,null))[_0x6def('0x25')](handleError(_0x5320fe,null));};exports[_0x6def('0x51')]=function(_0x136424,_0x53a78b,_0x576925){if(_0x136424[_0x6def('0x52')]&&_0x136424[_0x6def('0x52')][_0x6def('0x53')]){_0x136424[_0x6def('0x50')]['logo']=_0x136424[_0x6def('0x52')]['filename'];}return db['Setting'][_0x6def('0x4f')]({'where':{'id':_0x136424['params']['id']}})[_0x6def('0x1a')](handleEntityNotFound(_0x53a78b,null))['then'](saveUpdates(_0x136424[_0x6def('0x50')],null))[_0x6def('0x1a')](respondWithResult(_0x53a78b,null))['catch'](handleError(_0x53a78b,null));};exports[_0x6def('0x54')]=function(_0x3b1389,_0x6a5fd,_0x550730){if(_0x3b1389[_0x6def('0x52')]&&_0x3b1389[_0x6def('0x52')][_0x6def('0x53')]){_0x3b1389[_0x6def('0x50')]['loginLogo']=_0x3b1389[_0x6def('0x52')][_0x6def('0x53')];}return db['Setting']['find']({'where':{'id':_0x3b1389[_0x6def('0x4d')]['id']}})['then'](handleEntityNotFound(_0x6a5fd,null))['then'](saveUpdates(_0x3b1389[_0x6def('0x50')],null))[_0x6def('0x1a')](respondWithResult(_0x6a5fd,null))['catch'](handleError(_0x6a5fd,null));};var utilLicense=require(_0x6def('0x15'));exports[_0x6def('0x55')]=function(_0x19774d,_0x276861,_0x430357){var _0x2ff06f='server/files/images/logos';var _0x23319c={'custom':![]};return utilLicense['getLicense']()[_0x6def('0x1a')](function(_0x151be2){if(_0x151be2){_0x23319c=_0x151be2;}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x19774d[_0x6def('0x4d')]['id']},'attributes':[_0x6def('0x56'),_0x6def('0x57'),_0x6def('0x58'),_0x6def('0x59'),_0x6def('0x5a'),_0x6def('0x5b'),_0x6def('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x6def('0x1a')](handleEntityNotFound(_0x276861,null))['then'](function(_0x47895e){if(_0x47895e){var _0x40ebf8=_0x47895e[_0x6def('0x56')]&&fs[_0x6def('0x5d')](path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x2ff06f,_[_0x6def('0x60')](_0x47895e['logo'])))?path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x2ff06f,_[_0x6def('0x60')](_0x47895e[_0x6def('0x56')])):path[_0x6def('0x5e')](config['root'],_0x2ff06f,_['toLower'](_0x6def('0x61')));var _0x5204b7=_0x6def('0x62')+_[_0x6def('0x63')](_0x6def('0x56'));if(_0x47895e[_0x5204b7]||!_0x23319c[_0x6def('0x64')]){_0x40ebf8=path[_0x6def('0x5e')](config['root'],_0x2ff06f,_[_0x6def('0x60')](_0x6def('0x61')));}if(!fs['existsSync'](_0x40ebf8)){throw new db[(_0x6def('0x65'))]['ValidationError'](_[_0x6def('0x63')]('logo')+_0x6def('0x66'));}return _0x276861[_0x6def('0x67')](_0x40ebf8);}})[_0x6def('0x25')](handleError(_0x276861,null));};var utilLicense=require(_0x6def('0x15'));exports[_0x6def('0x68')]=function(_0x397224,_0x3388a5,_0x1a793f){var _0x220050=_0x6def('0x69');var _0x4701d9={'custom':![]};return utilLicense[_0x6def('0x6a')]()['then'](function(_0x4bc640){if(_0x4bc640){_0x4701d9=_0x4bc640;}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x397224[_0x6def('0x4d')]['id']},'attributes':[_0x6def('0x56'),'loginLogo',_0x6def('0x58'),'favicon',_0x6def('0x5a'),_0x6def('0x5b'),_0x6def('0x5c'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3388a5,null))[_0x6def('0x1a')](function(_0x3ea54a){if(_0x3ea54a){var _0x23cba7=_0x3ea54a['loginLogo']&&fs[_0x6def('0x5d')](path['join'](config[_0x6def('0x5f')],_0x220050,_[_0x6def('0x60')](_0x3ea54a[_0x6def('0x57')])))?path['join'](config['root'],_0x220050,_[_0x6def('0x60')](_0x3ea54a['loginLogo'])):path['join'](config['root'],_0x220050,_[_0x6def('0x60')](_0x6def('0x6b')));var _0x36d92='default'+_[_0x6def('0x63')](_0x6def('0x57'));if(_0x3ea54a[_0x36d92]||!_0x4701d9[_0x6def('0x64')]){_0x23cba7=path['join'](config[_0x6def('0x5f')],_0x220050,_[_0x6def('0x60')](_0x6def('0x6b')));}if(!fs[_0x6def('0x5d')](_0x23cba7)){throw new db[(_0x6def('0x65'))][(_0x6def('0x6c'))](_['upperFirst'](_0x6def('0x57'))+'\x20not\x20found');}return _0x3388a5[_0x6def('0x67')](_0x23cba7);}})[_0x6def('0x25')](handleError(_0x3388a5,null));};exports[_0x6def('0x6d')]=function(_0x1a99c4,_0x4f7004){return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x1a99c4[_0x6def('0x4d')]['id']},'attributes':[_0x6def('0x6e')]})[_0x6def('0x1a')](respondWithResult(_0x4f7004,null))[_0x6def('0x25')](handleError(_0x4f7004,null));};exports[_0x6def('0x6f')]=function(_0x5a61f5,_0x31db07,_0x4ecd65){if(_0x5a61f5['file']&&_0x5a61f5[_0x6def('0x52')][_0x6def('0x53')]){_0x5a61f5[_0x6def('0x50')]['preferred']=_0x5a61f5['file'][_0x6def('0x53')];}return db['Setting'][_0x6def('0x4f')]({'where':{'id':_0x5a61f5[_0x6def('0x4d')]['id']}})[_0x6def('0x1a')](handleEntityNotFound(_0x31db07,null))[_0x6def('0x1a')](saveUpdates(_0x5a61f5[_0x6def('0x50')],null))[_0x6def('0x1a')](respondWithResult(_0x31db07,null))[_0x6def('0x25')](handleError(_0x31db07,null));};var utilLicense=require(_0x6def('0x15'));exports['getPreferred']=function(_0x5d6b5a,_0xb44017,_0x1bb34c){var _0x4800f9=_0x6def('0x69');var _0x29818c={'custom':![]};return utilLicense[_0x6def('0x6a')]()['then'](function(_0x39803f){if(_0x39803f){_0x29818c=_0x39803f;}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x5d6b5a['params']['id']},'attributes':[_0x6def('0x56'),_0x6def('0x57'),_0x6def('0x58'),_0x6def('0x59'),_0x6def('0x5a'),_0x6def('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x6def('0x1a')](handleEntityNotFound(_0xb44017,null))[_0x6def('0x1a')](function(_0x52669a){if(_0x52669a){var _0x1e911b=_0x52669a[_0x6def('0x58')]&&fs[_0x6def('0x5d')](path['join'](config[_0x6def('0x5f')],_0x4800f9,_[_0x6def('0x60')](_0x52669a[_0x6def('0x58')])))?path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x4800f9,_[_0x6def('0x60')](_0x52669a[_0x6def('0x58')])):path['join'](config[_0x6def('0x5f')],_0x4800f9,_['toLower'](_0x6def('0x70')));var _0x50e80f=_0x6def('0x62')+_['upperFirst'](_0x6def('0x58'));if(_0x52669a[_0x50e80f]||!_0x29818c[_0x6def('0x64')]||!_0x29818c[_0x6def('0x58')]){_0x1e911b=path[_0x6def('0x5e')](config['root'],_0x4800f9,_[_0x6def('0x60')]('default_preferred.png'));}if(!fs[_0x6def('0x5d')](_0x1e911b)){throw new db[(_0x6def('0x65'))][(_0x6def('0x6c'))](_['upperFirst'](_0x6def('0x58'))+'\x20not\x20found');}return _0xb44017['download'](_0x1e911b);}})[_0x6def('0x25')](handleError(_0xb44017,null));};exports['addFavicon']=function(_0x29d45b,_0x1d67b9,_0x2e2fd8){if(_0x29d45b[_0x6def('0x52')]&&_0x29d45b[_0x6def('0x52')]['filename']){_0x29d45b[_0x6def('0x50')]['favicon']=_0x29d45b[_0x6def('0x52')]['filename'];}return db[_0x6def('0x36')]['find']({'where':{'id':_0x29d45b[_0x6def('0x4d')]['id']}})[_0x6def('0x1a')](handleEntityNotFound(_0x1d67b9,null))['then'](saveUpdates(_0x29d45b[_0x6def('0x50')],null))['then'](respondWithResult(_0x1d67b9,null))[_0x6def('0x25')](handleError(_0x1d67b9,null));};var utilLicense=require(_0x6def('0x15'));exports[_0x6def('0x71')]=function(_0x1bf1bf,_0x59cc59,_0x43d142){var _0x21178d=_0x6def('0x69');var _0x4faa6f={'custom':![]};return utilLicense[_0x6def('0x6a')]()['then'](function(_0x5e4b53){if(_0x5e4b53){_0x4faa6f=_0x5e4b53;}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x1bf1bf['params']['id']},'attributes':[_0x6def('0x56'),'loginLogo',_0x6def('0x58'),'favicon',_0x6def('0x5a'),_0x6def('0x5b'),_0x6def('0x5c'),_0x6def('0x72')],'raw':!![]});})['then'](handleEntityNotFound(_0x59cc59,null))[_0x6def('0x1a')](function(_0x392253){if(_0x392253){var _0x2ca6b4=_0x392253['favicon']&&fs[_0x6def('0x5d')](path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x21178d,_[_0x6def('0x60')](_0x392253[_0x6def('0x59')])))?path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x21178d,_['toLower'](_0x392253[_0x6def('0x59')])):path['join'](config[_0x6def('0x5f')],_0x21178d,_[_0x6def('0x60')]('default_favicon.ico'));var _0x2e6582=_0x6def('0x62')+_[_0x6def('0x63')](_0x6def('0x59'));if(_0x392253[_0x2e6582]||!_0x4faa6f[_0x6def('0x64')]){_0x2ca6b4=path[_0x6def('0x5e')](config['root'],_0x21178d,_[_0x6def('0x60')](_0x6def('0x73')));}if(!fs[_0x6def('0x5d')](_0x2ca6b4)){throw new db['Sequelize'][(_0x6def('0x6c'))](_[_0x6def('0x63')]('favicon')+_0x6def('0x66'));}return _0x59cc59[_0x6def('0x67')](_0x2ca6b4);}})[_0x6def('0x25')](handleError(_0x59cc59,null));};exports[_0x6def('0x74')]=function(_0x3f9f05,_0x41dd6f){var _0x5f6d51={'offset':moment()[_0x6def('0x75')]()};_0x5f6d51[_0x6def('0x76')]=moment()[_0x6def('0x75')](_0x5f6d51['offset'])[_0x6def('0x77')](_0x6def('0x78'));return _0x41dd6f[_0x6def('0x27')](0xc8)[_0x6def('0x33')](_0x5f6d51);}; \ No newline at end of file +var _0x9ee6=['join','root','toLower','default_logo.svg','default','custom','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','server/files/images/logos','existsSync','default_loginLogo.svg','Sequelize','gdpr','securePassword','addPreferred','getLicense','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','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','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','name','send','index','map','Setting','fieldName','key','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','fields','find','body','addLogo','file','filename','logo','loginLogo','getLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ee6,0x94));var _0x69ee=function(_0x3cfb0d,_0x4df584){_0x3cfb0d=_0x3cfb0d-0x0;var _0x3486b4=_0x9ee6[_0x3cfb0d];return _0x3486b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69ee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x69ee('0x1'));var moment=require('moment');var BPromise=require(_0x69ee('0x2'));var Mustache=require(_0x69ee('0x3'));var util=require(_0x69ee('0x4'));var path=require(_0x69ee('0x5'));var sox=require(_0x69ee('0x6'));var csv=require('to-csv');var ejs=require(_0x69ee('0x7'));var fs=require('fs');var fs_extra=require(_0x69ee('0x8'));var _=require(_0x69ee('0x9'));var squel=require(_0x69ee('0xa'));var crypto=require(_0x69ee('0xb'));var jsforce=require(_0x69ee('0xc'));var deskjs=require(_0x69ee('0xd'));var toCsv=require(_0x69ee('0xe'));var querystring=require(_0x69ee('0xf'));var Papa=require(_0x69ee('0x10'));var Redis=require(_0x69ee('0x11'));var authService=require(_0x69ee('0x12'));var qs=require(_0x69ee('0x13'));var as=require(_0x69ee('0x14'));var hardwareService=require(_0x69ee('0x15'));var logger=require('../../config/logger')(_0x69ee('0x16'));var utils=require('../../config/utils');var config=require(_0x69ee('0x17'));var licenseUtil=require(_0x69ee('0x18'));var db=require(_0x69ee('0x19'))['db'];var jayson=require(_0x69ee('0x1a'));var client=jayson[_0x69ee('0x1b')][_0x69ee('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5b9c94,_0x244fd5,_0x2fd19d,_0x15927a){return new BPromise(function(_0x5bae3f,_0x4b6902){var _0x57da68=_0x15927a||client;return _0x57da68[_0x69ee('0x1d')](_0x5b9c94,_0x2fd19d)[_0x69ee('0x1e')](function(_0x4e39a7){logger[_0x69ee('0x1f')]('Setting,\x20%s,\x20%s',_0x244fd5,'request\x20sent');logger[_0x69ee('0x20')](_0x69ee('0x21'),_0x244fd5,_0x69ee('0x22'),JSON[_0x69ee('0x23')](_0x4e39a7));if(_0x4e39a7[_0x69ee('0x24')]){if(_0x4e39a7['error'][_0x69ee('0x25')]===0x1f4){logger[_0x69ee('0x24')](_0x69ee('0x26'),_0x244fd5,_0x4e39a7[_0x69ee('0x24')][_0x69ee('0x27')]);return _0x4b6902(_0x4e39a7['error'][_0x69ee('0x27')]);}logger[_0x69ee('0x24')](_0x69ee('0x26'),_0x244fd5,_0x4e39a7[_0x69ee('0x24')][_0x69ee('0x27')]);return _0x5bae3f(_0x4e39a7[_0x69ee('0x24')][_0x69ee('0x27')]);}else{logger[_0x69ee('0x1f')](_0x69ee('0x26'),_0x244fd5,_0x69ee('0x22'));_0x5bae3f(_0x4e39a7['result']['message']);}})[_0x69ee('0x28')](function(_0x5b8a9f){logger['error'](_0x69ee('0x26'),_0x244fd5,_0x5b8a9f);_0x4b6902(_0x5b8a9f);});});}function respondWithStatusCode(_0x319428,_0x2d9250){_0x2d9250=_0x2d9250||0xcc;return function(_0x4465ae){if(_0x4465ae){return _0x319428[_0x69ee('0x29')](_0x2d9250);}return _0x319428['status'](_0x2d9250)[_0x69ee('0x2a')]();};}function respondWithResult(_0x3281b4,_0xe8677f){_0xe8677f=_0xe8677f||0xc8;return function(_0x347f85){if(_0x347f85){return _0x3281b4[_0x69ee('0x2b')](_0xe8677f)[_0x69ee('0x2c')](_0x347f85);}};}function respondWithFilteredResult(_0x759b4f,_0xcabf09){return function(_0x300e28){if(_0x300e28){var _0x3c34f7=typeof _0xcabf09[_0x69ee('0x2d')]===_0x69ee('0x2e')&&typeof _0xcabf09['limit']===_0x69ee('0x2e');var _0x190d25=_0x300e28[_0x69ee('0x2f')];var _0x32b2a1=_0x3c34f7?0x0:_0xcabf09[_0x69ee('0x2d')];var _0x279bb1=_0x3c34f7?_0x300e28['count']:_0xcabf09['offset']+_0xcabf09[_0x69ee('0x30')];var _0x48d291;if(_0x279bb1>=_0x190d25){_0x279bb1=_0x190d25;_0x48d291=0xc8;}else{_0x48d291=0xce;}_0x759b4f['status'](_0x48d291);return _0x759b4f['set'](_0x69ee('0x31'),_0x32b2a1+'-'+_0x279bb1+'/'+_0x190d25)[_0x69ee('0x2c')](_0x300e28);}return null;};}function patchUpdates(_0x524f1a){return function(_0xa98c96){try{jsonpatch[_0x69ee('0x32')](_0xa98c96,_0x524f1a,!![]);}catch(_0x590f84){return BPromise[_0x69ee('0x33')](_0x590f84);}return _0xa98c96[_0x69ee('0x34')]();};}function saveUpdates(_0x13e8b8,_0x4236b1){return function(_0x3a633f){if(_0x3a633f){return _0x3a633f[_0x69ee('0x35')](_0x13e8b8)[_0x69ee('0x1e')](function(_0x313c58){return _0x313c58;});}return null;};}function removeEntity(_0x26722d,_0x13c5bf){return function(_0x1c4705){if(_0x1c4705){return _0x1c4705['destroy']()[_0x69ee('0x1e')](function(){_0x26722d[_0x69ee('0x2b')](0xcc)[_0x69ee('0x2a')]();});}};}function handleEntityNotFound(_0x27c112,_0x1d17fb){return function(_0x1f6443){if(!_0x1f6443){_0x27c112[_0x69ee('0x29')](0x194);}return _0x1f6443;};}function handleError(_0x206d86,_0x237d20){_0x237d20=_0x237d20||0x1f4;return function(_0x224842){logger[_0x69ee('0x24')](_0x224842['stack']);if(_0x224842[_0x69ee('0x36')]){delete _0x224842[_0x69ee('0x36')];}_0x206d86[_0x69ee('0x2b')](_0x237d20)[_0x69ee('0x37')](_0x224842);};}exports[_0x69ee('0x38')]=function(_0x581dd3,_0x484be8){var _0x5ec185={},_0x4fe081={},_0x4300c0={'count':0x0,'rows':[]};var _0x302ece=_[_0x69ee('0x39')](db[_0x69ee('0x3a')]['rawAttributes'],function(_0x3d3589){return{'name':_0x3d3589[_0x69ee('0x3b')],'type':_0x3d3589['type'][_0x69ee('0x3c')]};});_0x4fe081['model']=_[_0x69ee('0x39')](_0x302ece,_0x69ee('0x36'));_0x4fe081[_0x69ee('0x3d')]=_['keys'](_0x581dd3[_0x69ee('0x3d')]);_0x4fe081[_0x69ee('0x3e')]=_[_0x69ee('0x3f')](_0x4fe081[_0x69ee('0x40')],_0x4fe081[_0x69ee('0x3d')]);_0x5ec185[_0x69ee('0x41')]=_[_0x69ee('0x3f')](_0x4fe081[_0x69ee('0x40')],qs['fields'](_0x581dd3[_0x69ee('0x3d')]['fields']));_0x5ec185[_0x69ee('0x41')]=_0x5ec185['attributes'][_0x69ee('0x42')]?_0x5ec185[_0x69ee('0x41')]:_0x4fe081[_0x69ee('0x40')];if(!_0x581dd3[_0x69ee('0x3d')][_0x69ee('0x43')]('nolimit')){_0x5ec185[_0x69ee('0x30')]=qs['limit'](_0x581dd3[_0x69ee('0x3d')]['limit']);_0x5ec185['offset']=qs['offset'](_0x581dd3[_0x69ee('0x3d')]['offset']);}_0x5ec185[_0x69ee('0x44')]=qs[_0x69ee('0x45')](_0x581dd3[_0x69ee('0x3d')][_0x69ee('0x45')]);_0x5ec185['where']=qs['filters'](_[_0x69ee('0x46')](_0x581dd3[_0x69ee('0x3d')],_0x4fe081[_0x69ee('0x3e')]),_0x302ece);if(_0x581dd3['query'][_0x69ee('0x47')]){_0x5ec185[_0x69ee('0x48')]=_['merge'](_0x5ec185[_0x69ee('0x48')],{'$or':_['map'](_0x302ece,function(_0x3743e7){if(_0x3743e7[_0x69ee('0x49')]!==_0x69ee('0x4a')){var _0x41160e={};_0x41160e[_0x3743e7['name']]={'$like':'%'+_0x581dd3[_0x69ee('0x3d')][_0x69ee('0x47')]+'%'};return _0x41160e;}})});}_0x5ec185=_[_0x69ee('0x4b')]({},_0x5ec185,_0x581dd3[_0x69ee('0x4c')]);var _0xf5f71c={'where':_0x5ec185[_0x69ee('0x48')]};return db[_0x69ee('0x3a')][_0x69ee('0x2f')](_0xf5f71c)[_0x69ee('0x1e')](function(_0x2568cc){_0x4300c0[_0x69ee('0x2f')]=_0x2568cc;if(_0x581dd3['query'][_0x69ee('0x4d')]){_0x5ec185[_0x69ee('0x4e')]=[{'all':!![]}];}return db[_0x69ee('0x3a')][_0x69ee('0x4f')](_0x5ec185);})[_0x69ee('0x1e')](function(_0x5ba445){_0x4300c0[_0x69ee('0x50')]=_0x5ba445;return _0x4300c0;})[_0x69ee('0x1e')](respondWithFilteredResult(_0x484be8,_0x5ec185))[_0x69ee('0x28')](handleError(_0x484be8,null));};exports['show']=function(_0x25c46b,_0x41d25d){var _0x4eeca7={'raw':![],'where':{'id':_0x25c46b[_0x69ee('0x51')]['id']}},_0x4b0826={};_0x4b0826[_0x69ee('0x40')]=_[_0x69ee('0x52')](db[_0x69ee('0x3a')]['rawAttributes']);_0x4b0826['query']=_[_0x69ee('0x52')](_0x25c46b[_0x69ee('0x3d')]);_0x4b0826[_0x69ee('0x3e')]=_['intersection'](_0x4b0826[_0x69ee('0x40')],_0x4b0826['query']);_0x4eeca7[_0x69ee('0x41')]=_[_0x69ee('0x3f')](_0x4b0826[_0x69ee('0x40')],qs[_0x69ee('0x53')](_0x25c46b[_0x69ee('0x3d')][_0x69ee('0x53')]));_0x4eeca7[_0x69ee('0x41')]=_0x4eeca7[_0x69ee('0x41')][_0x69ee('0x42')]?_0x4eeca7[_0x69ee('0x41')]:_0x4b0826[_0x69ee('0x40')];if(_0x25c46b['query']['includeAll']){_0x4eeca7[_0x69ee('0x4e')]=[{'all':!![]}];}_0x4eeca7=_[_0x69ee('0x4b')]({},_0x4eeca7,_0x25c46b[_0x69ee('0x4c')]);return db[_0x69ee('0x3a')][_0x69ee('0x54')](_0x4eeca7)[_0x69ee('0x1e')](handleEntityNotFound(_0x41d25d,null))[_0x69ee('0x1e')](respondWithResult(_0x41d25d,null))['catch'](handleError(_0x41d25d,null));};exports[_0x69ee('0x35')]=function(_0x51728d,_0x22a90b){if(_0x51728d[_0x69ee('0x55')]['id']){delete _0x51728d[_0x69ee('0x55')]['id'];}return db[_0x69ee('0x3a')][_0x69ee('0x54')]({'where':{'id':_0x51728d[_0x69ee('0x51')]['id']}})['then'](handleEntityNotFound(_0x22a90b,null))['then'](saveUpdates(_0x51728d['body'],null))['then'](respondWithResult(_0x22a90b,null))[_0x69ee('0x28')](handleError(_0x22a90b,null));};exports[_0x69ee('0x56')]=function(_0xf462db,_0x17c55b,_0x2fc22b){if(_0xf462db[_0x69ee('0x57')]&&_0xf462db[_0x69ee('0x57')][_0x69ee('0x58')]){_0xf462db[_0x69ee('0x55')][_0x69ee('0x59')]=_0xf462db[_0x69ee('0x57')][_0x69ee('0x58')];}return db['Setting'][_0x69ee('0x54')]({'where':{'id':_0xf462db[_0x69ee('0x51')]['id']}})['then'](handleEntityNotFound(_0x17c55b,null))[_0x69ee('0x1e')](saveUpdates(_0xf462db[_0x69ee('0x55')],null))['then'](respondWithResult(_0x17c55b,null))[_0x69ee('0x28')](handleError(_0x17c55b,null));};exports['addLogoLogin']=function(_0x435635,_0x461256,_0x577060){if(_0x435635[_0x69ee('0x57')]&&_0x435635[_0x69ee('0x57')]['filename']){_0x435635['body'][_0x69ee('0x5a')]=_0x435635[_0x69ee('0x57')][_0x69ee('0x58')];}return db['Setting'][_0x69ee('0x54')]({'where':{'id':_0x435635['params']['id']}})[_0x69ee('0x1e')](handleEntityNotFound(_0x461256,null))[_0x69ee('0x1e')](saveUpdates(_0x435635['body'],null))['then'](respondWithResult(_0x461256,null))['catch'](handleError(_0x461256,null));};var utilLicense=require('../../config/license/util');exports[_0x69ee('0x5b')]=function(_0x55fdd0,_0x1de1fe,_0x2c8aec){var _0x302d1e='server/files/images/logos';var _0x513a30={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x35725b){if(_0x35725b){_0x513a30=_0x35725b;}return db[_0x69ee('0x3a')][_0x69ee('0x54')]({'where':{'id':_0x55fdd0[_0x69ee('0x51')]['id']},'attributes':['logo',_0x69ee('0x5a'),_0x69ee('0x5c'),_0x69ee('0x5d'),_0x69ee('0x5e'),_0x69ee('0x5f'),_0x69ee('0x60'),_0x69ee('0x61')],'raw':!![]});})[_0x69ee('0x1e')](handleEntityNotFound(_0x1de1fe,null))['then'](function(_0x16565f){if(_0x16565f){var _0x3e563b=_0x16565f['logo']&&fs['existsSync'](path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x302d1e,_[_0x69ee('0x64')](_0x16565f[_0x69ee('0x59')])))?path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x302d1e,_[_0x69ee('0x64')](_0x16565f[_0x69ee('0x59')])):path[_0x69ee('0x62')](config['root'],_0x302d1e,_['toLower'](_0x69ee('0x65')));var _0x13cff5=_0x69ee('0x66')+_['upperFirst'](_0x69ee('0x59'));if(_0x16565f[_0x13cff5]||!_0x513a30[_0x69ee('0x67')]){_0x3e563b=path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x302d1e,_[_0x69ee('0x64')](_0x69ee('0x65')));}if(!fs['existsSync'](_0x3e563b)){throw new db['Sequelize'][(_0x69ee('0x68'))](_[_0x69ee('0x69')](_0x69ee('0x59'))+_0x69ee('0x6a'));}return _0x1de1fe[_0x69ee('0x6b')](_0x3e563b);}})['catch'](handleError(_0x1de1fe,null));};var utilLicense=require('../../config/license/util');exports[_0x69ee('0x6c')]=function(_0xe9a3ab,_0x5f3d88,_0x7f217a){var _0x19bd57=_0x69ee('0x6d');var _0x22675d={'custom':![]};return utilLicense['getLicense']()[_0x69ee('0x1e')](function(_0x3cf7ca){if(_0x3cf7ca){_0x22675d=_0x3cf7ca;}return db[_0x69ee('0x3a')][_0x69ee('0x54')]({'where':{'id':_0xe9a3ab[_0x69ee('0x51')]['id']},'attributes':[_0x69ee('0x59'),_0x69ee('0x5a'),_0x69ee('0x5c'),_0x69ee('0x5d'),_0x69ee('0x5e'),_0x69ee('0x5f'),_0x69ee('0x60'),_0x69ee('0x61')],'raw':!![]});})[_0x69ee('0x1e')](handleEntityNotFound(_0x5f3d88,null))[_0x69ee('0x1e')](function(_0x37ccd0){if(_0x37ccd0){var _0x405f82=_0x37ccd0[_0x69ee('0x5a')]&&fs[_0x69ee('0x6e')](path[_0x69ee('0x62')](config['root'],_0x19bd57,_[_0x69ee('0x64')](_0x37ccd0[_0x69ee('0x5a')])))?path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x19bd57,_[_0x69ee('0x64')](_0x37ccd0[_0x69ee('0x5a')])):path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x19bd57,_[_0x69ee('0x64')]('default_loginLogo.svg'));var _0x780190=_0x69ee('0x66')+_[_0x69ee('0x69')](_0x69ee('0x5a'));if(_0x37ccd0[_0x780190]||!_0x22675d['custom']){_0x405f82=path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x19bd57,_[_0x69ee('0x64')](_0x69ee('0x6f')));}if(!fs[_0x69ee('0x6e')](_0x405f82)){throw new db[(_0x69ee('0x70'))][(_0x69ee('0x68'))](_[_0x69ee('0x69')](_0x69ee('0x5a'))+_0x69ee('0x6a'));}return _0x5f3d88['download'](_0x405f82);}})[_0x69ee('0x28')](handleError(_0x5f3d88,null));};exports[_0x69ee('0x71')]=function(_0xf90a81,_0x251669){return db[_0x69ee('0x3a')][_0x69ee('0x54')]({'where':{'id':_0xf90a81['params']['id']},'attributes':[_0x69ee('0x72')]})[_0x69ee('0x1e')](respondWithResult(_0x251669,null))['catch'](handleError(_0x251669,null));};exports[_0x69ee('0x73')]=function(_0x5c200f,_0x5b68f7,_0x3d0610){if(_0x5c200f['file']&&_0x5c200f[_0x69ee('0x57')][_0x69ee('0x58')]){_0x5c200f[_0x69ee('0x55')]['preferred']=_0x5c200f[_0x69ee('0x57')][_0x69ee('0x58')];}return db[_0x69ee('0x3a')][_0x69ee('0x54')]({'where':{'id':_0x5c200f['params']['id']}})['then'](handleEntityNotFound(_0x5b68f7,null))[_0x69ee('0x1e')](saveUpdates(_0x5c200f['body'],null))[_0x69ee('0x1e')](respondWithResult(_0x5b68f7,null))[_0x69ee('0x28')](handleError(_0x5b68f7,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x23e78b,_0x9ecc0b,_0x58af16){var _0x48b580=_0x69ee('0x6d');var _0x308cad={'custom':![]};return utilLicense[_0x69ee('0x74')]()[_0x69ee('0x1e')](function(_0x4bd5f1){if(_0x4bd5f1){_0x308cad=_0x4bd5f1;}return db[_0x69ee('0x3a')][_0x69ee('0x54')]({'where':{'id':_0x23e78b[_0x69ee('0x51')]['id']},'attributes':[_0x69ee('0x59'),'loginLogo',_0x69ee('0x5c'),_0x69ee('0x5d'),_0x69ee('0x5e'),_0x69ee('0x5f'),'defaultPreferred',_0x69ee('0x61')],'raw':!![]});})[_0x69ee('0x1e')](handleEntityNotFound(_0x9ecc0b,null))[_0x69ee('0x1e')](function(_0x2d6c30){if(_0x2d6c30){var _0x3180a2=_0x2d6c30['preferred']&&fs[_0x69ee('0x6e')](path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x48b580,_[_0x69ee('0x64')](_0x2d6c30[_0x69ee('0x5c')])))?path['join'](config[_0x69ee('0x63')],_0x48b580,_['toLower'](_0x2d6c30['preferred'])):path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x48b580,_[_0x69ee('0x64')](_0x69ee('0x75')));var _0x1620b3='default'+_[_0x69ee('0x69')](_0x69ee('0x5c'));if(_0x2d6c30[_0x1620b3]||!_0x308cad[_0x69ee('0x67')]||!_0x308cad[_0x69ee('0x5c')]){_0x3180a2=path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x48b580,_[_0x69ee('0x64')](_0x69ee('0x75')));}if(!fs[_0x69ee('0x6e')](_0x3180a2)){throw new db[(_0x69ee('0x70'))][(_0x69ee('0x68'))](_['upperFirst']('preferred')+'\x20not\x20found');}return _0x9ecc0b['download'](_0x3180a2);}})[_0x69ee('0x28')](handleError(_0x9ecc0b,null));};exports['addFavicon']=function(_0x1ed37a,_0x125ba5,_0x491801){if(_0x1ed37a[_0x69ee('0x57')]&&_0x1ed37a[_0x69ee('0x57')][_0x69ee('0x58')]){_0x1ed37a[_0x69ee('0x55')]['favicon']=_0x1ed37a[_0x69ee('0x57')]['filename'];}return db[_0x69ee('0x3a')]['find']({'where':{'id':_0x1ed37a['params']['id']}})['then'](handleEntityNotFound(_0x125ba5,null))[_0x69ee('0x1e')](saveUpdates(_0x1ed37a[_0x69ee('0x55')],null))[_0x69ee('0x1e')](respondWithResult(_0x125ba5,null))['catch'](handleError(_0x125ba5,null));};var utilLicense=require(_0x69ee('0x18'));exports[_0x69ee('0x76')]=function(_0x573638,_0x3aa96d,_0x5cf535){var _0x226b34='server/files/images/logos';var _0x100554={'custom':![]};return utilLicense[_0x69ee('0x74')]()[_0x69ee('0x1e')](function(_0x164a6e){if(_0x164a6e){_0x100554=_0x164a6e;}return db[_0x69ee('0x3a')][_0x69ee('0x54')]({'where':{'id':_0x573638[_0x69ee('0x51')]['id']},'attributes':['logo','loginLogo',_0x69ee('0x5c'),'favicon','defaultLogo',_0x69ee('0x5f'),_0x69ee('0x60'),_0x69ee('0x61')],'raw':!![]});})[_0x69ee('0x1e')](handleEntityNotFound(_0x3aa96d,null))[_0x69ee('0x1e')](function(_0x48481a){if(_0x48481a){var _0x2151f3=_0x48481a[_0x69ee('0x5d')]&&fs[_0x69ee('0x6e')](path[_0x69ee('0x62')](config[_0x69ee('0x63')],_0x226b34,_[_0x69ee('0x64')](_0x48481a[_0x69ee('0x5d')])))?path['join'](config[_0x69ee('0x63')],_0x226b34,_[_0x69ee('0x64')](_0x48481a['favicon'])):path['join'](config[_0x69ee('0x63')],_0x226b34,_[_0x69ee('0x64')](_0x69ee('0x77')));var _0x5c81b0=_0x69ee('0x66')+_['upperFirst'](_0x69ee('0x5d'));if(_0x48481a[_0x5c81b0]||!_0x100554[_0x69ee('0x67')]){_0x2151f3=path['join'](config['root'],_0x226b34,_[_0x69ee('0x64')](_0x69ee('0x77')));}if(!fs['existsSync'](_0x2151f3)){throw new db['Sequelize'][(_0x69ee('0x68'))](_[_0x69ee('0x69')](_0x69ee('0x5d'))+_0x69ee('0x6a'));}return _0x3aa96d[_0x69ee('0x6b')](_0x2151f3);}})['catch'](handleError(_0x3aa96d,null));};exports[_0x69ee('0x78')]=function(_0x53b42b,_0x5bb91d){var _0x509913={'offset':moment()[_0x69ee('0x79')]()};_0x509913['now']=moment()['utcOffset'](_0x509913[_0x69ee('0x2d')])['format'](_0x69ee('0x7a'));return _0x5bb91d[_0x69ee('0x2b')](0xc8)['send'](_0x509913);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 68822fd..e706e76 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(_0x7c9511,_0x2b4684){var _0x3d1a50=function(_0x9153fe){while(--_0x9153fe){_0x7c9511['push'](_0x7c9511['shift']());}};_0x3d1a50(++_0x2b4684);}(_0xedd9,0xfc));var _0x9edd=function(_0xb2b0eb,_0x57575c){_0xb2b0eb=_0xb2b0eb-0x0;var _0x31f77e=_0xedd9[_0xb2b0eb];return _0x31f77e;};'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(_0x8d244d,_0x49c04a){var _0x30fcd2=function(_0x167302){while(--_0x167302){_0x8d244d['push'](_0x8d244d['shift']());}};_0x30fcd2(++_0x49c04a);}(_0x008c,0x188));var _0xc008=function(_0x3bab18,_0x53d735){_0x3bab18=_0x3bab18-0x0;var _0x12585f=_0x008c[_0x3bab18];return _0x12585f;};'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 a22fa79..0faf709 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 _0xa94c=['ShowSetting','Setting','find','options','raw','attributes','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch'];(function(_0x3d92bf,_0xbf4cdf){var _0x460466=function(_0x466a10){while(--_0x466a10){_0x3d92bf['push'](_0x3d92bf['shift']());}};_0x460466(++_0xbf4cdf);}(_0xa94c,0x10f));var _0xca94=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa94c[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xca94('0x0'));var util=require(_0xca94('0x1'));var moment=require(_0xca94('0x2'));var BPromise=require(_0xca94('0x3'));var rs=require(_0xca94('0x4'));var fs=require('fs');var Redis=require(_0xca94('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xca94('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xca94('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xca94('0x8')][_0xca94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df4a0,_0x252549,_0x3dddec){return new BPromise(function(_0x1a089a,_0x32501e){return client[_0xca94('0xa')](_0x3df4a0,_0x3dddec)['then'](function(_0x39e025){logger[_0xca94('0xb')](_0xca94('0xc'),_0x252549,'request\x20sent');logger[_0xca94('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x252549,_0xca94('0xe'),JSON['stringify'](_0x39e025));if(_0x39e025[_0xca94('0xf')]){if(_0x39e025[_0xca94('0xf')]['code']===0x1f4){logger[_0xca94('0xf')]('Setting,\x20%s,\x20%s',_0x252549,_0x39e025[_0xca94('0xf')][_0xca94('0x10')]);return _0x32501e(_0x39e025[_0xca94('0xf')][_0xca94('0x10')]);}logger['error']('Setting,\x20%s,\x20%s',_0x252549,_0x39e025[_0xca94('0xf')]['message']);return _0x1a089a(_0x39e025[_0xca94('0xf')][_0xca94('0x10')]);}else{logger[_0xca94('0xb')](_0xca94('0xc'),_0x252549,'request\x20sent');_0x1a089a(_0x39e025[_0xca94('0x11')]['message']);}})[_0xca94('0x12')](function(_0x40afa1){logger['error'](_0xca94('0xc'),_0x252549,_0x40afa1);_0x32501e(_0x40afa1);});});}exports[_0xca94('0x13')]=function(_0x6fef8d){var _0x414430=this;return new Promise(function(_0x394c60,_0x36ce56){return db[_0xca94('0x14')][_0xca94('0x15')]({'raw':_0x6fef8d['options']?_0x6fef8d[_0xca94('0x16')][_0xca94('0x17')]===undefined?!![]:![]:!![],'where':_0x6fef8d[_0xca94('0x16')]?_0x6fef8d[_0xca94('0x16')]['where']||null:null,'attributes':_0x6fef8d[_0xca94('0x16')]?_0x6fef8d[_0xca94('0x16')][_0xca94('0x18')]||null:null,'include':_0x6fef8d[_0xca94('0x16')]?_0x6fef8d[_0xca94('0x16')]['include']?_[_0xca94('0x19')](_0x6fef8d['options'][_0xca94('0x1a')],function(_0x488cca){return{'model':db[_0x488cca[_0xca94('0x1b')]],'as':_0x488cca['as'],'attributes':_0x488cca[_0xca94('0x18')],'include':_0x488cca['include']?_[_0xca94('0x19')](_0x488cca['include'],function(_0x2c25c6){return{'model':db[_0x2c25c6['model']],'as':_0x2c25c6['as'],'attributes':_0x2c25c6[_0xca94('0x18')],'include':_0x2c25c6[_0xca94('0x1a')]?_[_0xca94('0x19')](_0x2c25c6['include'],function(_0x5ad9be){return{'model':db[_0x5ad9be['model']],'as':_0x5ad9be['as'],'attributes':_0x5ad9be[_0xca94('0x18')]};}):[]};}):[]};}):[]:[]})[_0xca94('0x1c')](function(_0x20c28c){logger[_0xca94('0xb')]('ShowSetting',_0x6fef8d);logger['debug']('ShowSetting',_0x6fef8d,JSON['stringify'](_0x20c28c));_0x394c60(_0x20c28c);})[_0xca94('0x12')](function(_0x13ef21){logger[_0xca94('0xf')](_0xca94('0x13'),_0x13ef21[_0xca94('0x10')],_0x6fef8d);_0x36ce56(_0x414430[_0xca94('0xf')](0x1f4,_0x13ef21[_0xca94('0x10')]));});});}; \ No newline at end of file +var _0x9480=['message','result','ShowSetting','Setting','find','options','where','attributes','include','map','model','stringify','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3b295b,_0x47d505){var _0xdca735=function(_0x4f2ada){while(--_0x4f2ada){_0x3b295b['push'](_0x3b295b['shift']());}};_0xdca735(++_0x47d505);}(_0x9480,0x143));var _0x0948=function(_0x1730e1,_0x81c0ea){_0x1730e1=_0x1730e1-0x0;var _0x2d3b5b=_0x9480[_0x1730e1];return _0x2d3b5b;};'use strict';var _=require(_0x0948('0x0'));var util=require('util');var moment=require(_0x0948('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0948('0x2'));var db=require(_0x0948('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0948('0x4'))('rpc');var config=require(_0x0948('0x5'));var jayson=require(_0x0948('0x6'));var client=jayson[_0x0948('0x7')][_0x0948('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdf916b,_0x594a1b,_0x14072b){return new BPromise(function(_0x1c7360,_0x5108d8){return client[_0x0948('0x9')](_0xdf916b,_0x14072b)[_0x0948('0xa')](function(_0x39a06e){logger[_0x0948('0xb')](_0x0948('0xc'),_0x594a1b,_0x0948('0xd'));logger[_0x0948('0xe')](_0x0948('0xf'),_0x594a1b,_0x0948('0xd'),JSON['stringify'](_0x39a06e));if(_0x39a06e['error']){if(_0x39a06e[_0x0948('0x10')][_0x0948('0x11')]===0x1f4){logger['error'](_0x0948('0xc'),_0x594a1b,_0x39a06e[_0x0948('0x10')]['message']);return _0x5108d8(_0x39a06e[_0x0948('0x10')][_0x0948('0x12')]);}logger['error'](_0x0948('0xc'),_0x594a1b,_0x39a06e['error'][_0x0948('0x12')]);return _0x1c7360(_0x39a06e['error'][_0x0948('0x12')]);}else{logger[_0x0948('0xb')]('Setting,\x20%s,\x20%s',_0x594a1b,'request\x20sent');_0x1c7360(_0x39a06e[_0x0948('0x13')]['message']);}})['catch'](function(_0x1dbb71){logger[_0x0948('0x10')](_0x0948('0xc'),_0x594a1b,_0x1dbb71);_0x5108d8(_0x1dbb71);});});}exports[_0x0948('0x14')]=function(_0x46eca5){var _0x3aec1f=this;return new Promise(function(_0x22a35c,_0x3d4c72){return db[_0x0948('0x15')][_0x0948('0x16')]({'raw':_0x46eca5[_0x0948('0x17')]?_0x46eca5[_0x0948('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x46eca5[_0x0948('0x17')]?_0x46eca5[_0x0948('0x17')][_0x0948('0x18')]||null:null,'attributes':_0x46eca5[_0x0948('0x17')]?_0x46eca5['options'][_0x0948('0x19')]||null:null,'include':_0x46eca5[_0x0948('0x17')]?_0x46eca5[_0x0948('0x17')][_0x0948('0x1a')]?_[_0x0948('0x1b')](_0x46eca5[_0x0948('0x17')][_0x0948('0x1a')],function(_0x191a38){return{'model':db[_0x191a38[_0x0948('0x1c')]],'as':_0x191a38['as'],'attributes':_0x191a38[_0x0948('0x19')],'include':_0x191a38[_0x0948('0x1a')]?_[_0x0948('0x1b')](_0x191a38[_0x0948('0x1a')],function(_0x2109a5){return{'model':db[_0x2109a5[_0x0948('0x1c')]],'as':_0x2109a5['as'],'attributes':_0x2109a5[_0x0948('0x19')],'include':_0x2109a5[_0x0948('0x1a')]?_[_0x0948('0x1b')](_0x2109a5[_0x0948('0x1a')],function(_0x231e2b){return{'model':db[_0x231e2b[_0x0948('0x1c')]],'as':_0x231e2b['as'],'attributes':_0x231e2b[_0x0948('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0948('0xa')](function(_0x42c954){logger[_0x0948('0xb')](_0x0948('0x14'),_0x46eca5);logger[_0x0948('0xe')](_0x0948('0x14'),_0x46eca5,JSON[_0x0948('0x1d')](_0x42c954));_0x22a35c(_0x42c954);})[_0x0948('0x1e')](function(_0x23e463){logger[_0x0948('0x10')](_0x0948('0x14'),_0x23e463[_0x0948('0x12')],_0x46eca5);_0x3d4c72(_0x3aec1f['error'](0x1f4,_0x23e463['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 21708b3..03d3388 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 _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(_0x56e628,_0x539cdb){var _0x225aec=function(_0x1b1406){while(--_0x1b1406){_0x56e628['push'](_0x56e628['shift']());}};_0x225aec(++_0x539cdb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5935a2,_0x36cf27){_0x5935a2=_0x5935a2-0x0;var _0x1a39a8=_0x8ef6[_0x5935a2];return _0x1a39a8;};'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 +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf494,0x1c6));var _0x4f49=function(_0x1250e7,_0x5e216d){_0x1250e7=_0x1250e7-0x0;var _0x4133f0=_0xf494[_0x1250e7];return _0x4133f0;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 14d9180..6332aa5 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 _0xf0c8=['connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','skebby'];(function(_0x19c44d,_0x3d9d02){var _0x20a79e=function(_0x22fb08){while(--_0x22fb08){_0x19c44d['push'](_0x19c44d['shift']());}};_0x20a79e(++_0x3d9d02);}(_0xf0c8,0x1dc));var _0x8f0c=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0xf0c8[_0x20f96d];return _0x9a7524;};'use strict';var Sequelize=require(_0x8f0c('0x0'));var rs=require(_0x8f0c('0x1'));module[_0x8f0c('0x2')]={'name':{'type':Sequelize[_0x8f0c('0x3')],'unique':_0x8f0c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x8f0c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x8f0c('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8f0c('0x5')]();}},'phone':{'type':Sequelize[_0x8f0c('0x3')]},'type':{'type':Sequelize[_0x8f0c('0x6')]('twilio',_0x8f0c('0x7'),_0x8f0c('0x8'),_0x8f0c('0x9'),_0x8f0c('0xa'),_0x8f0c('0xb'),_0x8f0c('0xc'),'csc',_0x8f0c('0xd'),_0x8f0c('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x8f0c('0x3')]},'authToken':{'type':Sequelize[_0x8f0c('0x3')]},'smsMethod':{'type':Sequelize[_0x8f0c('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8f0c('0x3')]},'password':{'type':Sequelize[_0x8f0c('0x3')]},'apiKey':{'type':Sequelize[_0x8f0c('0x3')]},'applicationId':{'type':Sequelize[_0x8f0c('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x8f0c('0x3')]},'deliveryReport':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8f0c('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f0c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8f0c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8f0c('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8f0c('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![],'comment':_0x8f0c('0x13'),'set':function(_0x5159f3){if(!_0x5159f3)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x8f0c('0x14')](_0x8f0c('0x15'),_0x5159f3);}}}; \ No newline at end of file +var _0x37c7=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','ENUM','twilio','skebby','connectel','plivo','clickatell','bandwidth','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x37c7,0x193));var _0x737c=function(_0x5e9d1f,_0x37c578){_0x5e9d1f=_0x5e9d1f-0x0;var _0x895bea=_0x37c7[_0x5e9d1f];return _0x895bea;};'use strict';var Sequelize=require(_0x737c('0x0'));var rs=require(_0x737c('0x1'));module['exports']={'name':{'type':Sequelize[_0x737c('0x2')],'unique':_0x737c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x737c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x737c('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x737c('0x2')]},'type':{'type':Sequelize[_0x737c('0x4')](_0x737c('0x5'),_0x737c('0x6'),_0x737c('0x7'),'clicksend',_0x737c('0x8'),_0x737c('0x9'),_0x737c('0xa'),'csc','infobip',_0x737c('0xb'))},'accountSid':{'type':Sequelize[_0x737c('0x2')]},'authId':{'type':Sequelize[_0x737c('0x2')]},'authToken':{'type':Sequelize[_0x737c('0x2')]},'smsMethod':{'type':Sequelize[_0x737c('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x737c('0x2')]},'password':{'type':Sequelize[_0x737c('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x737c('0x2')]},'accountId':{'type':Sequelize[_0x737c('0x2')]},'senderString':{'type':Sequelize[_0x737c('0x2')]},'deliveryReport':{'type':Sequelize[_0x737c('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x737c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x737c('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x737c('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x737c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x737c('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x737c('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x737c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x737c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x737c('0xe')],'comment':_0x737c('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x737c('0xc')],'defaultValue':![],'comment':_0x737c('0x10'),'set':function(_0x2321ee){if(!_0x2321ee)this[_0x737c('0x11')](_0x737c('0x12'),null);this[_0x737c('0x11')](_0x737c('0x13'),_0x2321ee);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4d262d3..a994148 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 _0xd8a0=['undefined','count','set','Content-Range','reject','save','destroy','get','SmsAccounts','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','rows','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','ids','SmsApplication','Applications','applications','orderBy','priority','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','twilio','from','From','Body','MessageSid','skebby','sender','clicksend','message_id','Text','MessageUUID','infobip','results','messageId','originatingAddress','segmentedMessage','fromNumber','text','replyMessageId','bandwidth','intelepeer','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','CmContact','Contacts','DESC','list','omit','defaults','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','send','\x0a','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','User','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','redif','error_code','groupName','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','csc','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','sendStatus','status','end','json','offset'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0xd8a0,0xb6));var _0x0d8a=function(_0x4ff5a5,_0x4e76f0){_0x4ff5a5=_0x4ff5a5-0x0;var _0x340ce7=_0xd8a0[_0x4ff5a5];return _0x340ce7;};'use strict';var emlformat=require(_0x0d8a('0x0'));var rimraf=require(_0x0d8a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8a('0x2'));var moment=require(_0x0d8a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0d8a('0x4'));var util=require(_0x0d8a('0x5'));var path=require(_0x0d8a('0x6'));var sox=require(_0x0d8a('0x7'));var csv=require(_0x0d8a('0x8'));var ejs=require(_0x0d8a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d8a('0xa'));var squel=require(_0x0d8a('0xb'));var crypto=require(_0x0d8a('0xc'));var jsforce=require(_0x0d8a('0xd'));var deskjs=require(_0x0d8a('0xe'));var toCsv=require(_0x0d8a('0x8'));var querystring=require(_0x0d8a('0xf'));var Papa=require('papaparse');var Redis=require(_0x0d8a('0x10'));var authService=require(_0x0d8a('0x11'));var qs=require(_0x0d8a('0x12'));var as=require(_0x0d8a('0x13'));var hardwareService=require(_0x0d8a('0x14'));var logger=require(_0x0d8a('0x15'))('api');var utils=require(_0x0d8a('0x16'));var config=require(_0x0d8a('0x17'));var licenseUtil=require(_0x0d8a('0x18'));var db=require(_0x0d8a('0x19'))['db'];config[_0x0d8a('0x1a')]=_['defaults'](config['redis'],{'host':_0x0d8a('0x1b'),'port':0x18eb});var socket=require(_0x0d8a('0x1c'))(new Redis(config[_0x0d8a('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x0d8a('0x1d'));var client=jayson[_0x0d8a('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1a90b8,_0x3768d6,_0x2b1f59,_0x487eb2){return new BPromise(function(_0x72ff2a,_0x4b7aa8){var _0xa7bcbd=_0x487eb2||client;return _0xa7bcbd['request'](_0x1a90b8,_0x2b1f59)[_0x0d8a('0x1f')](function(_0x4caf84){logger[_0x0d8a('0x20')](_0x0d8a('0x21'),_0x3768d6,'request\x20sent');logger['debug'](_0x0d8a('0x22'),_0x3768d6,'request\x20sent',JSON['stringify'](_0x4caf84));if(_0x4caf84[_0x0d8a('0x23')]){if(_0x4caf84[_0x0d8a('0x23')]['code']===0x1f4){logger[_0x0d8a('0x23')](_0x0d8a('0x21'),_0x3768d6,_0x4caf84['error'][_0x0d8a('0x24')]);return _0x4b7aa8(_0x4caf84['error']['message']);}logger[_0x0d8a('0x23')]('SmsAccount,\x20%s,\x20%s',_0x3768d6,_0x4caf84[_0x0d8a('0x23')][_0x0d8a('0x24')]);return _0x72ff2a(_0x4caf84[_0x0d8a('0x23')][_0x0d8a('0x24')]);}else{logger[_0x0d8a('0x20')]('SmsAccount,\x20%s,\x20%s',_0x3768d6,_0x0d8a('0x25'));_0x72ff2a(_0x4caf84['result'][_0x0d8a('0x24')]);}})[_0x0d8a('0x26')](function(_0x3ad9b9){logger[_0x0d8a('0x23')](_0x0d8a('0x21'),_0x3768d6,_0x3ad9b9);_0x4b7aa8(_0x3ad9b9);});});}function respondWithStatusCode(_0x597edd,_0x15a4c8){_0x15a4c8=_0x15a4c8||0xcc;return function(_0xfdcd9b){if(_0xfdcd9b){return _0x597edd[_0x0d8a('0x27')](_0x15a4c8);}return _0x597edd[_0x0d8a('0x28')](_0x15a4c8)[_0x0d8a('0x29')]();};}function respondWithResult(_0x59852f,_0x25e797){_0x25e797=_0x25e797||0xc8;return function(_0x341c3e){if(_0x341c3e){return _0x59852f[_0x0d8a('0x28')](_0x25e797)[_0x0d8a('0x2a')](_0x341c3e);}};}function respondWithFilteredResult(_0x255573,_0x3154bd){return function(_0x282ceb){if(_0x282ceb){var _0x23c2c2=typeof _0x3154bd[_0x0d8a('0x2b')]===_0x0d8a('0x2c')&&typeof _0x3154bd['limit']===_0x0d8a('0x2c');var _0x16f3c5=_0x282ceb[_0x0d8a('0x2d')];var _0x2f7367=_0x23c2c2?0x0:_0x3154bd[_0x0d8a('0x2b')];var _0x3e439d=_0x23c2c2?_0x282ceb[_0x0d8a('0x2d')]:_0x3154bd[_0x0d8a('0x2b')]+_0x3154bd['limit'];var _0x38f48c;if(_0x3e439d>=_0x16f3c5){_0x3e439d=_0x16f3c5;_0x38f48c=0xc8;}else{_0x38f48c=0xce;}_0x255573['status'](_0x38f48c);return _0x255573[_0x0d8a('0x2e')](_0x0d8a('0x2f'),_0x2f7367+'-'+_0x3e439d+'/'+_0x16f3c5)[_0x0d8a('0x2a')](_0x282ceb);}return null;};}function patchUpdates(_0x40870e){return function(_0x370a2f){try{jsonpatch['apply'](_0x370a2f,_0x40870e,!![]);}catch(_0x1a6177){return BPromise[_0x0d8a('0x30')](_0x1a6177);}return _0x370a2f[_0x0d8a('0x31')]();};}function saveUpdates(_0x475643,_0x46a229){return function(_0x441971){if(_0x441971){return _0x441971['update'](_0x475643)['then'](function(_0x46c04e){return _0x46c04e;});}return null;};}function removeEntity(_0x4dbd85,_0x516aef){return function(_0x50fd73){if(_0x50fd73){return _0x50fd73[_0x0d8a('0x32')]()['then'](function(){var _0x1b78ac=_0x50fd73[_0x0d8a('0x33')]({'plain':!![]});var _0x1a0ab8=_0x0d8a('0x34');return db['UserProfileResource'][_0x0d8a('0x32')]({'where':{'type':_0x1a0ab8,'resourceId':_0x1b78ac['id']}})['then'](function(){return _0x50fd73;});})[_0x0d8a('0x1f')](function(){_0x4dbd85[_0x0d8a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f4b8c,_0x29cadf){return function(_0x46a41e){if(!_0x46a41e){_0x5f4b8c[_0x0d8a('0x27')](0x194);}return _0x46a41e;};}function handleError(_0x54fc2e,_0x2fde7c){_0x2fde7c=_0x2fde7c||0x1f4;return function(_0x4ff51f){logger[_0x0d8a('0x23')](_0x4ff51f['stack']);if(_0x4ff51f[_0x0d8a('0x35')]){delete _0x4ff51f[_0x0d8a('0x35')];}_0x54fc2e[_0x0d8a('0x28')](_0x2fde7c)['send'](_0x4ff51f);};}exports[_0x0d8a('0x36')]=function(_0x320281,_0x1ff72b){var _0x3a82dd={'include':[{'model':db[_0x0d8a('0x37')],'as':_0x0d8a('0x38')}]},_0x117887={},_0x1f9207={'count':0x0,'rows':[]};var _0x4d2bda=_[_0x0d8a('0x39')](db[_0x0d8a('0x3a')][_0x0d8a('0x3b')],function(_0x4c5960){return{'name':_0x4c5960['fieldName'],'type':_0x4c5960['type'][_0x0d8a('0x3c')]};});_0x117887[_0x0d8a('0x3d')]=_['map'](_0x4d2bda,_0x0d8a('0x35'));_0x117887[_0x0d8a('0x3e')]=_[_0x0d8a('0x3f')](_0x320281[_0x0d8a('0x3e')]);_0x117887[_0x0d8a('0x40')]=_[_0x0d8a('0x41')](_0x117887[_0x0d8a('0x3d')],_0x117887[_0x0d8a('0x3e')]);_0x3a82dd['attributes']=_[_0x0d8a('0x41')](_0x117887[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x320281['query']['fields']));_0x3a82dd[_0x0d8a('0x43')]=_0x3a82dd['attributes'][_0x0d8a('0x44')]?_0x3a82dd[_0x0d8a('0x43')]:_0x117887[_0x0d8a('0x3d')];if(!_0x320281[_0x0d8a('0x3e')][_0x0d8a('0x45')]('nolimit')){_0x3a82dd['limit']=qs[_0x0d8a('0x46')](_0x320281[_0x0d8a('0x3e')]['limit']);_0x3a82dd[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x320281[_0x0d8a('0x3e')]['offset']);}_0x3a82dd['order']=qs[_0x0d8a('0x47')](_0x320281[_0x0d8a('0x3e')][_0x0d8a('0x47')]);_0x3a82dd['where']=qs[_0x0d8a('0x40')](_[_0x0d8a('0x48')](_0x320281[_0x0d8a('0x3e')],_0x117887['filters']),_0x4d2bda);if(_0x320281['query'][_0x0d8a('0x49')]){_0x3a82dd[_0x0d8a('0x4a')]=_['merge'](_0x3a82dd[_0x0d8a('0x4a')],{'$or':_['map'](_0x4d2bda,function(_0xe72d67){if(_0xe72d67[_0x0d8a('0x4b')]!==_0x0d8a('0x4c')){var _0x5d6522={};_0x5d6522[_0xe72d67[_0x0d8a('0x35')]]={'$like':'%'+_0x320281['query'][_0x0d8a('0x49')]+'%'};return _0x5d6522;}})});}_0x3a82dd=_[_0x0d8a('0x4d')]({},_0x3a82dd,_0x320281['options']);var _0x4a593e={'where':_0x3a82dd[_0x0d8a('0x4a')]};return db[_0x0d8a('0x3a')]['count'](_0x4a593e)[_0x0d8a('0x1f')](function(_0x5ba41c){_0x1f9207[_0x0d8a('0x2d')]=_0x5ba41c;if(_0x320281['query'][_0x0d8a('0x4e')]){_0x3a82dd[_0x0d8a('0x4f')]=[{'all':!![]}];}return db[_0x0d8a('0x3a')]['findAll'](_0x3a82dd);})[_0x0d8a('0x1f')](function(_0x403dc7){_0x1f9207[_0x0d8a('0x50')]=_0x403dc7;return _0x1f9207;})['then'](respondWithFilteredResult(_0x1ff72b,_0x3a82dd))[_0x0d8a('0x26')](handleError(_0x1ff72b,null));};exports[_0x0d8a('0x51')]=function(_0x54df0a,_0xcf57ef){var _0x3b85f6={'raw':![],'where':{'id':_0x54df0a[_0x0d8a('0x52')]['id']},'include':[{'model':db[_0x0d8a('0x37')],'as':_0x0d8a('0x38')}]},_0xf96be0={};_0xf96be0[_0x0d8a('0x3d')]=_[_0x0d8a('0x3f')](db['SmsAccount']['rawAttributes']);_0xf96be0[_0x0d8a('0x3e')]=_['keys'](_0x54df0a[_0x0d8a('0x3e')]);_0xf96be0['filters']=_[_0x0d8a('0x41')](_0xf96be0[_0x0d8a('0x3d')],_0xf96be0[_0x0d8a('0x3e')]);_0x3b85f6[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0xf96be0[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x54df0a['query'][_0x0d8a('0x42')]));_0x3b85f6[_0x0d8a('0x43')]=_0x3b85f6[_0x0d8a('0x43')]['length']?_0x3b85f6[_0x0d8a('0x43')]:_0xf96be0[_0x0d8a('0x3d')];if(_0x54df0a['query'][_0x0d8a('0x4e')]){_0x3b85f6[_0x0d8a('0x4f')]=[{'all':!![]}];}_0x3b85f6=_['merge']({},_0x3b85f6,_0x54df0a[_0x0d8a('0x53')]);return db['SmsAccount'][_0x0d8a('0x54')](_0x3b85f6)[_0x0d8a('0x1f')](handleEntityNotFound(_0xcf57ef,null))[_0x0d8a('0x1f')](respondWithResult(_0xcf57ef,null))['catch'](handleError(_0xcf57ef,null));};exports[_0x0d8a('0x55')]=function(_0x37032a,_0x2dc8e9){return db['SmsAccount'][_0x0d8a('0x55')](_0x37032a['body'],{})['then'](function(_0x2cef66){var _0xa8897c=_0x37032a[_0x0d8a('0x56')]['get']({'plain':!![]});if(!_0xa8897c)throw new Error(_0x0d8a('0x57'));if(_0xa8897c[_0x0d8a('0x58')]===_0x0d8a('0x56')){var _0x39f041=_0x2cef66[_0x0d8a('0x33')]({'plain':!![]});var _0x59bdca=_0x0d8a('0x34');return db[_0x0d8a('0x59')][_0x0d8a('0x54')]({'where':{'name':_0x59bdca,'userProfileId':_0xa8897c[_0x0d8a('0x5a')]},'raw':!![]})[_0x0d8a('0x1f')](function(_0x146f34){if(_0x146f34&&_0x146f34[_0x0d8a('0x5b')]===0x0){return db[_0x0d8a('0x5c')][_0x0d8a('0x55')]({'name':_0x39f041[_0x0d8a('0x35')],'resourceId':_0x39f041['id'],'type':_0x146f34[_0x0d8a('0x35')],'sectionId':_0x146f34['id']},{})['then'](function(){return _0x2cef66;});}else{return _0x2cef66;}})[_0x0d8a('0x26')](function(_0x1f1039){logger[_0x0d8a('0x23')](_0x0d8a('0x5d'),_0x1f1039);throw _0x1f1039;});}return _0x2cef66;})[_0x0d8a('0x1f')](respondWithResult(_0x2dc8e9,0xc9))[_0x0d8a('0x26')](handleError(_0x2dc8e9,null));};exports[_0x0d8a('0x5e')]=function(_0x5a27fc,_0x47cc20){if(_0x5a27fc[_0x0d8a('0x5f')]['id']){delete _0x5a27fc[_0x0d8a('0x5f')]['id'];}return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x5a27fc[_0x0d8a('0x52')]['id']},'include':[{'model':db[_0x0d8a('0x37')],'as':_0x0d8a('0x38')}]})[_0x0d8a('0x1f')](handleEntityNotFound(_0x47cc20,null))[_0x0d8a('0x1f')](saveUpdates(_0x5a27fc[_0x0d8a('0x5f')],null))['then'](respondWithResult(_0x47cc20,null))[_0x0d8a('0x26')](handleError(_0x47cc20,null));};exports[_0x0d8a('0x32')]=function(_0x47b47d,_0x59d2df){return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x47b47d[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x59d2df,null))[_0x0d8a('0x1f')](removeEntity(_0x59d2df,null))[_0x0d8a('0x26')](handleError(_0x59d2df,null));};exports[_0x0d8a('0x60')]=function(_0x366bc1,_0x41a5c7){return db[_0x0d8a('0x3a')][_0x0d8a('0x60')]()['then'](respondWithResult(_0x41a5c7,null))[_0x0d8a('0x26')](handleError(_0x41a5c7,null));};exports[_0x0d8a('0x61')]=function(_0x2d0e3b,_0x3a3d88,_0x53cb37){if(_0x2d0e3b['body']['id']){delete _0x2d0e3b[_0x0d8a('0x5f')]['id'];}return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x2d0e3b[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x3a3d88,null))[_0x0d8a('0x1f')](function(_0x5dbee6){if(_0x5dbee6){_0x2d0e3b[_0x0d8a('0x5f')][_0x0d8a('0x62')]=_0x5dbee6['id'];return db[_0x0d8a('0x63')][_0x0d8a('0x55')](_0x2d0e3b['body']);}})['then'](respondWithResult(_0x3a3d88,null))['catch'](handleError(_0x3a3d88,null));};exports[_0x0d8a('0x64')]=function(_0x1fb4e3,_0x503b6e,_0x5d03ce){var _0x1fcaa1={'raw':![],'where':{}};var _0x189bed={};var _0x3a10d8={'count':0x0,'rows':[]};return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x1fb4e3[_0x0d8a('0x52')]['id']}})['then'](handleEntityNotFound(_0x503b6e,null))[_0x0d8a('0x1f')](function(_0x5441de){if(_0x5441de){_0x189bed[_0x0d8a('0x3d')]=_['keys'](db[_0x0d8a('0x63')]['rawAttributes']);_0x189bed[_0x0d8a('0x3e')]=_['keys'](_0x1fb4e3[_0x0d8a('0x3e')]);_0x189bed['filters']=_[_0x0d8a('0x41')](_0x189bed[_0x0d8a('0x3d')],_0x189bed['query']);_0x1fcaa1[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0x189bed[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x1fb4e3['query'][_0x0d8a('0x42')]));_0x1fcaa1[_0x0d8a('0x43')]=_0x1fcaa1['attributes'][_0x0d8a('0x44')]?_0x1fcaa1[_0x0d8a('0x43')]:_0x189bed[_0x0d8a('0x3d')];if(!_0x1fb4e3['query'][_0x0d8a('0x45')](_0x0d8a('0x66'))){_0x1fcaa1[_0x0d8a('0x46')]=qs['limit'](_0x1fb4e3[_0x0d8a('0x3e')][_0x0d8a('0x46')]);_0x1fcaa1[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x1fb4e3['query']['offset']);}_0x1fcaa1['order']=qs[_0x0d8a('0x47')](_0x1fb4e3[_0x0d8a('0x3e')]['sort']);_0x1fcaa1[_0x0d8a('0x4a')]=qs[_0x0d8a('0x40')](_[_0x0d8a('0x48')](_0x1fb4e3['query'],_0x189bed[_0x0d8a('0x40')]));_0x1fcaa1['where'][_0x0d8a('0x62')]=_0x5441de['id'];if(_0x1fb4e3[_0x0d8a('0x3e')]['filter']){_0x1fcaa1[_0x0d8a('0x4a')]=_['merge'](_0x1fcaa1[_0x0d8a('0x4a')],{'$or':_[_0x0d8a('0x39')](_0x1fcaa1[_0x0d8a('0x43')],function(_0x118f6d){var _0x204568={};_0x204568[_0x118f6d]={'$like':'%'+_0x1fb4e3[_0x0d8a('0x3e')][_0x0d8a('0x49')]+'%'};return _0x204568;})});}_0x1fcaa1=_[_0x0d8a('0x4d')]({},_0x1fcaa1,_0x1fb4e3[_0x0d8a('0x53')]);return db[_0x0d8a('0x63')][_0x0d8a('0x2d')]({'where':_0x1fcaa1[_0x0d8a('0x4a')]})[_0x0d8a('0x1f')](function(_0x198fb8){_0x3a10d8['count']=_0x198fb8;if(_0x1fb4e3[_0x0d8a('0x3e')][_0x0d8a('0x4e')]){_0x1fcaa1['include']=[{'all':!![]}];}return db[_0x0d8a('0x63')][_0x0d8a('0x67')](_0x1fcaa1);})[_0x0d8a('0x1f')](function(_0x190779){_0x3a10d8['rows']=_0x190779;return _0x3a10d8;});}})[_0x0d8a('0x1f')](respondWithFilteredResult(_0x503b6e,_0x1fcaa1))[_0x0d8a('0x26')](handleError(_0x503b6e,null));};exports[_0x0d8a('0x68')]=function(_0x7f9b3b,_0x5e657a,_0x5b7962){return db[_0x0d8a('0x3a')]['find']({'where':{'id':_0x7f9b3b[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x5e657a,null))[_0x0d8a('0x1f')](function(_0x3b7318){if(_0x3b7318){return _0x3b7318['removeDispositions'](_0x7f9b3b[_0x0d8a('0x3e')]['ids']);}})[_0x0d8a('0x1f')](respondWithStatusCode(_0x5e657a,null))[_0x0d8a('0x26')](handleError(_0x5e657a,null));};exports[_0x0d8a('0x69')]=function(_0x3c3edc,_0x4b79e8,_0x13f360){if(_0x3c3edc[_0x0d8a('0x5f')]['id']){delete _0x3c3edc[_0x0d8a('0x5f')]['id'];}return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x3c3edc[_0x0d8a('0x52')]['id']}})['then'](handleEntityNotFound(_0x4b79e8,null))[_0x0d8a('0x1f')](function(_0x93c7a0){if(_0x93c7a0){_0x3c3edc[_0x0d8a('0x5f')][_0x0d8a('0x62')]=_0x93c7a0['id'];return db[_0x0d8a('0x6a')]['create'](_0x3c3edc[_0x0d8a('0x5f')]);}})['then'](respondWithResult(_0x4b79e8,null))[_0x0d8a('0x26')](handleError(_0x4b79e8,null));};exports[_0x0d8a('0x6b')]=function(_0x4febc8,_0x4704ed,_0x23b0bf){var _0x368c9f={'raw':![],'where':{}};var _0x1b3bc8={};var _0x1e9c7a={'count':0x0,'rows':[]};return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x4febc8[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x4704ed,null))[_0x0d8a('0x1f')](function(_0x4bc885){if(_0x4bc885){_0x1b3bc8[_0x0d8a('0x3d')]=_[_0x0d8a('0x3f')](db[_0x0d8a('0x6a')][_0x0d8a('0x3b')]);_0x1b3bc8[_0x0d8a('0x3e')]=_[_0x0d8a('0x3f')](_0x4febc8[_0x0d8a('0x3e')]);_0x1b3bc8[_0x0d8a('0x40')]=_[_0x0d8a('0x41')](_0x1b3bc8['model'],_0x1b3bc8[_0x0d8a('0x3e')]);_0x368c9f[_0x0d8a('0x43')]=_['intersection'](_0x1b3bc8['model'],qs['fields'](_0x4febc8[_0x0d8a('0x3e')]['fields']));_0x368c9f['attributes']=_0x368c9f[_0x0d8a('0x43')][_0x0d8a('0x44')]?_0x368c9f[_0x0d8a('0x43')]:_0x1b3bc8['model'];if(!_0x4febc8[_0x0d8a('0x3e')][_0x0d8a('0x45')](_0x0d8a('0x66'))){_0x368c9f[_0x0d8a('0x46')]=qs[_0x0d8a('0x46')](_0x4febc8[_0x0d8a('0x3e')][_0x0d8a('0x46')]);_0x368c9f[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x4febc8[_0x0d8a('0x3e')]['offset']);}_0x368c9f[_0x0d8a('0x6c')]=qs[_0x0d8a('0x47')](_0x4febc8[_0x0d8a('0x3e')]['sort']);_0x368c9f[_0x0d8a('0x4a')]=qs[_0x0d8a('0x40')](_[_0x0d8a('0x48')](_0x4febc8[_0x0d8a('0x3e')],_0x1b3bc8['filters']));_0x368c9f[_0x0d8a('0x4a')][_0x0d8a('0x62')]=_0x4bc885['id'];if(_0x4febc8[_0x0d8a('0x3e')][_0x0d8a('0x49')]){_0x368c9f['where']=_[_0x0d8a('0x4d')](_0x368c9f[_0x0d8a('0x4a')],{'$or':_['map'](_0x368c9f[_0x0d8a('0x43')],function(_0x10c55f){var _0x345ca6={};_0x345ca6[_0x10c55f]={'$like':'%'+_0x4febc8[_0x0d8a('0x3e')][_0x0d8a('0x49')]+'%'};return _0x345ca6;})});}_0x368c9f=_[_0x0d8a('0x4d')]({},_0x368c9f,_0x4febc8[_0x0d8a('0x53')]);return db[_0x0d8a('0x6a')][_0x0d8a('0x2d')]({'where':_0x368c9f[_0x0d8a('0x4a')]})[_0x0d8a('0x1f')](function(_0x247a71){_0x1e9c7a[_0x0d8a('0x2d')]=_0x247a71;if(_0x4febc8['query']['includeAll']){_0x368c9f[_0x0d8a('0x4f')]=[{'all':!![]}];}return db[_0x0d8a('0x6a')][_0x0d8a('0x67')](_0x368c9f);})[_0x0d8a('0x1f')](function(_0x51d4f4){_0x1e9c7a[_0x0d8a('0x50')]=_0x51d4f4;return _0x1e9c7a;});}})[_0x0d8a('0x1f')](respondWithFilteredResult(_0x4704ed,_0x368c9f))[_0x0d8a('0x26')](handleError(_0x4704ed,null));};exports['removeAnswers']=function(_0x1f472a,_0x3e9b25,_0x3b5f82){return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x1f472a[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x3e9b25,null))[_0x0d8a('0x1f')](function(_0x1165c3){if(_0x1165c3){return _0x1165c3[_0x0d8a('0x6d')](_0x1f472a[_0x0d8a('0x3e')][_0x0d8a('0x6e')]);}})[_0x0d8a('0x1f')](respondWithStatusCode(_0x3e9b25,null))[_0x0d8a('0x26')](handleError(_0x3e9b25,null));};exports['notify']=function(_0x186981,_0x45b827,_0x2e335a){var _0xc0e3d5={'channel':'sms'};var _0x370ac6=[];var _0x514e6d=[];var _0x603287={};return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x186981['params']['id']},'include':[{'model':db[_0x0d8a('0x6f')],'as':_0x0d8a('0x70')}]})[_0x0d8a('0x1f')](handleEntityNotFound(_0x45b827,null))['then'](function(_0x3602c3){_0xc0e3d5['account']=_0x3602c3;_0xc0e3d5[_0x0d8a('0x71')]=_[_0x0d8a('0x72')](_0x3602c3[_0x0d8a('0x70')],[_0x0d8a('0x73')],[_0x0d8a('0x74')]);if(_0xc0e3d5['account'][_0x0d8a('0x70')]){delete _0xc0e3d5[_0x0d8a('0x75')][_0x0d8a('0x70')];}return db['CmContact'][_0x0d8a('0x60')]();})[_0x0d8a('0x1f')](function(_0x3c5383){if(!_0x3c5383){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x78'));}_0x370ac6=_['difference'](_['keys'](_0x3c5383),[_0x0d8a('0x79'),'updatedAt']);_0x514e6d=_[_0x0d8a('0x7a')](_['keys'](_0x3c5383),[_0x0d8a('0x79'),_0x0d8a('0x7b'),'CompanyId','ListId']);_0xc0e3d5[_0x0d8a('0x5f')]={'mapKey':'mobile'};if(_0xc0e3d5[_0x0d8a('0x75')]['type']){switch(_0xc0e3d5['account'][_0x0d8a('0x4b')]){case _0x0d8a('0x7c'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x7e')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x7f')];_0xc0e3d5['body']['messageId']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x80')];break;case _0x0d8a('0x81'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]='+'+_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x82')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')]['text'];break;case'connectel':_0xc0e3d5[_0x0d8a('0x5f')]['from']=_0x186981[_0x0d8a('0x5f')]['from'];_0xc0e3d5[_0x0d8a('0x5f')]['body']=_0x186981['body'][_0x0d8a('0x24')];break;case _0x0d8a('0x83'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')]['from'];_0xc0e3d5['body'][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x5f')];_0xc0e3d5['body']['messageId']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x84')];break;case'plivo':_0xc0e3d5['body'][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x7e')];_0xc0e3d5['body'][_0x0d8a('0x5f')]=_0x186981['body'][_0x0d8a('0x85')];_0xc0e3d5[_0x0d8a('0x5f')]['messageId']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x86')];break;case _0x0d8a('0x87'):_0xc0e3d5[_0x0d8a('0x5f')]['from']='+'+_0x186981['body'][_0x0d8a('0x88')][0x0][_0x0d8a('0x7d')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x88')][0x0]['text'];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x89')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x88')][0x0][_0x0d8a('0x89')];break;case'csc':_0xc0e3d5['body'][_0x0d8a('0x7d')]=_0x186981['body'][_0x0d8a('0x8a')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x8b')][_0x0d8a('0x24')];break;case'clickatell':_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x8c')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981['body'][_0x0d8a('0x8d')];_0xc0e3d5['body']['messageId']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x8e')];break;case _0x0d8a('0x8f'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x89')]=_0x186981[_0x0d8a('0x5f')][0x0][_0x0d8a('0x24')]['id'];_0xc0e3d5[_0x0d8a('0x5f')]['from']=_0x186981[_0x0d8a('0x5f')][0x0][_0x0d8a('0x24')]['from'];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][0x0][_0x0d8a('0x24')]['text'];break;case _0x0d8a('0x90'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x7d')];_0xc0e3d5['body']['body']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x24')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x89')]=_0x186981['body']['refid'];break;}}if(_0xc0e3d5[_0x0d8a('0x5f')]['id']){delete _0xc0e3d5[_0x0d8a('0x5f')]['id'];}if(_['isNil'](_0xc0e3d5['body'][_0x0d8a('0x7d')])){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x91'));}if(_['isNil'](_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')])||_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]===''){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x92'));}if(_[_0x0d8a('0x93')](_0xc0e3d5['body'][_0x0d8a('0x94')])){throw new db['Sequelize']['ValidationError'](_0x0d8a('0x95')+_0x514e6d);}if(!_[_0x0d8a('0x96')](_0x514e6d,_0xc0e3d5[_0x0d8a('0x5f')]['mapKey'])){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x97')+_0x514e6d);}_0x603287[_0xc0e3d5['body'][_0x0d8a('0x94')]]=_0xc0e3d5['body']['from'];return db['CmList'][_0x0d8a('0x54')]({'where':{'id':_0xc0e3d5[_0x0d8a('0x75')][_0x0d8a('0x98')]},'include':[{'model':db[_0x0d8a('0x99')],'as':_0x0d8a('0x9a'),'where':_0x603287,'limit':0x1,'order':[['updatedAt',_0x0d8a('0x9b')]]}]});})[_0x0d8a('0x1f')](handleEntityNotFound(_0x45b827,null))[_0x0d8a('0x1f')](function(_0x529ba2){if(_0x529ba2){_0xc0e3d5[_0x0d8a('0x9c')]=_[_0x0d8a('0x9d')](_0x529ba2,[_0x0d8a('0x9a')]);if(_0x529ba2[_0x0d8a('0x9a')][_0x0d8a('0x44')]){return _0x529ba2[_0x0d8a('0x9a')][0x0];}var _0x3bfac1=_[_0x0d8a('0x9e')](_0xc0e3d5[_0x0d8a('0x5f')],{'firstName':_0xc0e3d5['body'][_0x0d8a('0x7d')],'ListId':_0x529ba2['id']});_0x3bfac1[_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x94')]]=_0xc0e3d5[_0x0d8a('0x5f')]['from'];return db[_0x0d8a('0x99')][_0x0d8a('0x55')](_0x3bfac1,{'fields':_0x370ac6,'raw':!![]});}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x45b827,null))[_0x0d8a('0x1f')](function(_0x40348f){if(_0x40348f){_0xc0e3d5['contact']=_0x40348f;var _0x47b9d1={'ContactId':_0x40348f['id'],'phone':_0xc0e3d5[_0x0d8a('0x5f')]['from'],'SmsAccountId':_0x186981[_0x0d8a('0x52')]['id']};var _0x1bc5a2={'ContactId':_0x40348f['id'],'SmsAccountId':_0x186981[_0x0d8a('0x52')]['id'],'closed':![]};return db[_0x0d8a('0x9f')][_0x0d8a('0x54')]({'where':_0x1bc5a2})[_0x0d8a('0x1f')](function(_0x1d2f7c){if(_0x1d2f7c){return[_0x1d2f7c,![]];}return db[_0x0d8a('0x9f')]['create'](_0x47b9d1)[_0x0d8a('0x1f')](function(_0x5b0fd0){return[_0x5b0fd0,!![]];});});}})[_0x0d8a('0xa0')](function(_0x4905f7,_0x511f00){_0xc0e3d5[_0x0d8a('0xa1')]=_0x4905f7['get']({'plain':!![]});_0xc0e3d5[_0x0d8a('0xa1')][_0x0d8a('0xa2')]=![];if(_0x511f00){if(_0xc0e3d5['account'][_0x0d8a('0xa3')]){_0xc0e3d5[_0x0d8a('0x71')][_0x0d8a('0xa4')]({'id':0x0,'priority':_0xc0e3d5['applications'][_0x0d8a('0x44')]+0x1,'app':_0x0d8a('0xa5'),'appdata':_0x0d8a('0xa6'),'interval':'*,*,*,*'});}_0xc0e3d5[_0x0d8a('0xa1')][_0x0d8a('0xa2')]=!![];}return db['SmsMessage'][_0x0d8a('0x55')]({'phone':_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')],'messageId':_0xc0e3d5[_0x0d8a('0x5f')]['messageId'],'body':_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')],'SmsAccountId':_0x186981['params']['id'],'SmsInteractionId':_0x4905f7['id'],'direction':'in','ContactId':_0x4905f7[_0x0d8a('0xa7')],'AttachmentId':_0xc0e3d5['body'][_0x0d8a('0xa8')]});})['then'](function(_0x577d48){_0xc0e3d5[_0x0d8a('0x24')]=_0x577d48;if(_0xc0e3d5['interaction']['UserId']){return db['User'][_0x0d8a('0x54')]({'attributes':['id',_0x0d8a('0x35')],'where':{'id':_0xc0e3d5[_0x0d8a('0xa1')][_0x0d8a('0xa9')]}})[_0x0d8a('0x1f')](function(_0x27b251){if(_0x27b251){_0xc0e3d5[_0x0d8a('0x71')][_0x0d8a('0xaa')]({'id':0x0,'priority':0x0,'app':_0x0d8a('0xab'),'appdata':_0x27b251[_0x0d8a('0x35')]+','+(_0xc0e3d5[_0x0d8a('0x75')]['waitForTheAssignedAgent']||0xa),'interval':_0x0d8a('0xac')});}return respondWithRpcPromise(_0x0d8a('0xad'),_0x0d8a('0xae'),_0xc0e3d5);});}return respondWithRpcPromise(_0x0d8a('0xad'),_0x0d8a('0xae'),_0xc0e3d5);})[_0x0d8a('0x1f')](function(_0x515fcb){if(_0x515fcb){var _0x3bde17=0xc8;var _0x39cc98=_0x0d8a('0xaf');logger[_0x0d8a('0x20')](_0x0d8a('0x22'),_0x39cc98,_0x3bde17,_0x0d8a('0xb0'));logger['debug'](_0x0d8a('0xb1'),_0x39cc98,_0x3bde17,'entity\x20found',JSON[_0x0d8a('0xb2')](_0x515fcb));if(_0xc0e3d5[_0x0d8a('0x75')][_0x0d8a('0x4b')]===_0x0d8a('0x7c')){return _0x45b827[_0x0d8a('0x28')](_0x3bde17)[_0x0d8a('0x2e')]('Content-Type','text/xml')[_0x0d8a('0xb3')](_0x0d8a('0xb4'));}else{return _0x45b827[_0x0d8a('0x28')](_0x3bde17)[_0x0d8a('0x2a')](_0x515fcb);}}})[_0x0d8a('0x26')](handleError(_0x45b827,null));};exports['addApplications']=function(_0x1ea347,_0x467eca){var _0x10e38a=_0x1ea347[_0x0d8a('0x52')]['id'];var _0x1ad1e2=_0x1ea347[_0x0d8a('0x5f')];var _0x5ef1a5=0xc8;var _0x370c5a=null;return db['sequelize'][_0x0d8a('0xb5')]({'isolationLevel':db['sequelize'][_0x0d8a('0xb6')][_0x0d8a('0xb7')][_0x0d8a('0xb8')]},function(_0x516167){return db['SmsAccount'][_0x0d8a('0x65')]({'where':{'id':_0x10e38a},'transaction':_0x516167})[_0x0d8a('0x1f')](function(_0x3373a5){if(_0x3373a5){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x10e38a},'transaction':_0x516167})[_0x0d8a('0x1f')](function(){var _0x481074=_['map'](_0x1ad1e2,function(_0x201573){_0x201573[_0x0d8a('0x62')]=_0x10e38a;return _0x201573;});return db[_0x0d8a('0x6f')][_0x0d8a('0xb9')](_0x481074,{'transaction':_0x516167});});}else{_0x5ef1a5=0x194;_0x370c5a=[];}});})[_0x0d8a('0x1f')](function(){if(_0x5ef1a5!==0x194){return db[_0x0d8a('0x6f')]['findAndCountAll']({'where':{'SmsAccountId':_0x10e38a},'order':'priority'})[_0x0d8a('0x1f')](function(_0x345000){_0x370c5a=_0x345000;});}})[_0x0d8a('0x26')](function(_0x255da5){_0x5ef1a5=0x1f4;logger[_0x0d8a('0x23')](_0x255da5['stack']);if(_0x255da5[_0x0d8a('0x35')]){delete _0x255da5['name'];}_0x370c5a=_0x255da5;})['finally'](function(){if(_0x370c5a===null){_0x467eca[_0x0d8a('0x27')](_0x5ef1a5);}else{if(_0x5ef1a5===0x1f4){_0x467eca[_0x0d8a('0x28')](_0x5ef1a5)[_0x0d8a('0xb3')](_0x370c5a);}else{_0x467eca[_0x0d8a('0x28')](_0x5ef1a5)[_0x0d8a('0x2a')](_0x370c5a);}}});};exports[_0x0d8a('0xba')]=function(_0x123610,_0x2cc86b,_0x40c1fa){var _0x37a070={};var _0x996b5d={};var _0x5ea85a;var _0xf109d6;return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x123610['params']['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x2cc86b,null))['then'](function(_0x139eb5){if(_0x139eb5){_0x5ea85a=_0x139eb5;_0x996b5d['model']=_['keys'](db[_0x0d8a('0x6f')][_0x0d8a('0x3b')]);_0x996b5d[_0x0d8a('0x3e')]=_['keys'](_0x123610['query']);_0x996b5d['filters']=_[_0x0d8a('0x41')](_0x996b5d[_0x0d8a('0x3d')],_0x996b5d[_0x0d8a('0x3e')]);_0x37a070[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0x996b5d[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x123610[_0x0d8a('0x3e')]['fields']));_0x37a070[_0x0d8a('0x43')]=_0x37a070[_0x0d8a('0x43')][_0x0d8a('0x44')]?_0x37a070[_0x0d8a('0x43')]:_0x996b5d['model'];_0x37a070[_0x0d8a('0x6c')]=qs[_0x0d8a('0x47')](_0x123610[_0x0d8a('0x3e')][_0x0d8a('0x47')]);_0x37a070[_0x0d8a('0x4a')]=qs['filters'](_['pick'](_0x123610[_0x0d8a('0x3e')],_0x996b5d['filters']));if(_0x123610[_0x0d8a('0x3e')][_0x0d8a('0x49')]){_0x37a070['where']=_[_0x0d8a('0x4d')](_0x37a070[_0x0d8a('0x4a')],{'$or':_[_0x0d8a('0x39')](_0x37a070['attributes'],function(_0x3553d7){var _0xcbb19c={};_0xcbb19c[_0x3553d7]={'$like':'%'+_0x123610[_0x0d8a('0x3e')]['filter']+'%'};return _0xcbb19c;})});}_0x37a070=_[_0x0d8a('0x4d')]({},_0x37a070,_0x123610[_0x0d8a('0x53')]);return _0x5ea85a[_0x0d8a('0xba')](_0x37a070);}})[_0x0d8a('0x1f')](function(_0x5a988b){if(_0x5a988b){_0xf109d6=_0x5a988b[_0x0d8a('0x44')];if(!_0x123610['query'][_0x0d8a('0x45')](_0x0d8a('0x66'))){_0x37a070['limit']=qs[_0x0d8a('0x46')](_0x123610['query'][_0x0d8a('0x46')]);_0x37a070['offset']=qs['offset'](_0x123610[_0x0d8a('0x3e')][_0x0d8a('0x2b')]);}return _0x5ea85a[_0x0d8a('0xba')](_0x37a070);}})[_0x0d8a('0x1f')](function(_0x2df094){if(_0x2df094){return _0x2df094?{'count':_0xf109d6,'rows':_0x2df094}:null;}})[_0x0d8a('0x1f')](respondWithResult(_0x2cc86b,null))['catch'](handleError(_0x2cc86b,null));};exports['getInteractions']=function(_0x3bb950,_0x26595c,_0x42f33d){var _0x3efcbc={'raw':![],'where':{}};var _0x22a5ce={};var _0x529068={'count':0x0,'rows':[]};return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x3bb950[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x26595c,null))[_0x0d8a('0x1f')](function(_0x6c5ea3){if(_0x6c5ea3){_0x22a5ce[_0x0d8a('0x3d')]=_[_0x0d8a('0x3f')](db[_0x0d8a('0x9f')][_0x0d8a('0x3b')]);_0x22a5ce['query']=_[_0x0d8a('0x3f')](_0x3bb950[_0x0d8a('0x3e')]);_0x22a5ce[_0x0d8a('0x40')]=_[_0x0d8a('0x41')](_0x22a5ce[_0x0d8a('0x3d')],_0x22a5ce[_0x0d8a('0x3e')]);_0x3efcbc[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0x22a5ce[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x42')]));_0x3efcbc[_0x0d8a('0x43')]=_0x3efcbc[_0x0d8a('0x43')]['length']?_0x3efcbc[_0x0d8a('0x43')]:_0x22a5ce['model'];if(!_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x45')]('nolimit')){_0x3efcbc['limit']=qs[_0x0d8a('0x46')](_0x3bb950['query'][_0x0d8a('0x46')]);_0x3efcbc[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x3bb950['query'][_0x0d8a('0x2b')]);}_0x3efcbc['order']=qs['sort'](_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x47')]);_0x3efcbc[_0x0d8a('0x4a')]=qs['filters'](_[_0x0d8a('0x48')](_0x3bb950[_0x0d8a('0x3e')],_0x22a5ce[_0x0d8a('0x40')]));_0x3efcbc[_0x0d8a('0x4a')][_0x0d8a('0x62')]=_0x6c5ea3['id'];if(_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x49')]){_0x3efcbc[_0x0d8a('0x4a')]=_['merge'](_0x3efcbc[_0x0d8a('0x4a')],{'$or':_[_0x0d8a('0x39')](_0x3efcbc[_0x0d8a('0x43')],function(_0x18ebd2){var _0xee884f={};_0xee884f[_0x18ebd2]={'$like':'%'+_0x3bb950[_0x0d8a('0x3e')]['filter']+'%'};return _0xee884f;})});}_0x3efcbc=_[_0x0d8a('0x4d')]({},_0x3efcbc,_0x3bb950[_0x0d8a('0x53')]);return db[_0x0d8a('0x9f')]['count']({'where':_0x3efcbc['where']})['then'](function(_0x408b41){_0x529068[_0x0d8a('0x2d')]=_0x408b41;if(_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x4e')]){_0x3efcbc['include']=[{'model':db[_0x0d8a('0x99')],'as':'Contact','required':![]},{'model':db[_0x0d8a('0xbb')],'as':'Owner','attributes':[_0x0d8a('0x35'),_0x0d8a('0xbc'),_0x0d8a('0xbd')],'required':![]},{'model':db[_0x0d8a('0xbe')],'as':_0x0d8a('0xbf'),'attributes':['id',_0x0d8a('0x35'),_0x0d8a('0xc0')],'where':_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0xc1')]?{'id':_0x3bb950['query']['tag']}:undefined,'required':_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0xc1')]?!![]:![]}];}return db[_0x0d8a('0x9f')]['findAll'](_0x3efcbc);})[_0x0d8a('0x1f')](function(_0xce9479){_0x529068['rows']=_0xce9479;return _0x529068;});}})['then'](respondWithFilteredResult(_0x26595c,_0x3efcbc))['catch'](handleError(_0x26595c,null));};exports[_0x0d8a('0xb3')]=function(_0x27593a,_0xd59828,_0x2f91e1){var _0x159d7a,_0x43742f,_0x4762fe;if(_[_0x0d8a('0x93')](_0x27593a[_0x0d8a('0x5f')][_0x0d8a('0x5f')])||_0x27593a[_0x0d8a('0x5f')]['body']===''){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x92'));}if(_['isNil'](_0x27593a[_0x0d8a('0x5f')]['to'])){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0xc2'));}_0x159d7a=_0x27593a[_0x0d8a('0x5f')]['to'];return db['SmsAccount'][_0x0d8a('0x54')]({'where':{'id':_0x27593a['params']['id']},'include':[{'model':db['CmList'],'as':_0x0d8a('0xc3'),'include':[{'model':db[_0x0d8a('0x99')],'as':_0x0d8a('0x9a'),'where':{'mobile':_0x159d7a},'limit':0x1,'order':[['updatedAt',_0x0d8a('0x9b')]]}]}]})['then'](handleEntityNotFound(_0xd59828,null))[_0x0d8a('0x1f')](function(_0x1aea2f){if(_0x1aea2f&&_0x1aea2f['List']){_0x43742f=_0x1aea2f[_0x0d8a('0x33')]({'plain':!![]});if(_0x43742f[_0x0d8a('0xc3')]&&_0x43742f[_0x0d8a('0xc3')]['Contacts']['length']){return _0x43742f[_0x0d8a('0xc3')][_0x0d8a('0x9a')][0x0];}return db[_0x0d8a('0x99')][_0x0d8a('0x55')](_['defaults'](_0x27593a[_0x0d8a('0x5f')],{'firstName':_0x159d7a,'mobile':_0x159d7a,'phone':_0x159d7a,'ListId':_0x43742f['ListId']}));}})[_0x0d8a('0x1f')](handleEntityNotFound(_0xd59828,null))[_0x0d8a('0x1f')](function(_0x56fad4){if(_0x56fad4){_0x4762fe=_0x56fad4;return db[_0x0d8a('0x9f')][_0x0d8a('0x54')]({'where':{'ContactId':_0x4762fe['id'],'closed':![],'SmsAccountId':_0x43742f['id']}})['then'](function(_0x20e54d){if(_0x20e54d){return[_0x20e54d,![]];}return db['SmsInteraction'][_0x0d8a('0x55')]({'UserId':_0x27593a[_0x0d8a('0x56')]['id'],'ContactId':_0x4762fe['id'],'SmsAccountId':_0x43742f['id'],'phone':_0x159d7a,'firstMsgDirection':_0x0d8a('0xc4'),'Messages':[_[_0x0d8a('0x4d')](_0x27593a[_0x0d8a('0x5f')],{'read':![],'body':_0x27593a['body']['body'],'phone':_0x159d7a,'SmsAccountId':_0x43742f['id'],'UserId':_0x27593a['user']['id'],'ContactId':_0x4762fe['id']})]},{'include':[{'model':db[_0x0d8a('0xc5')],'as':_0x0d8a('0xc6')}]})[_0x0d8a('0x1f')](function(_0x105ad4){return[_0x105ad4,!![]];});});}})[_0x0d8a('0xa0')](function(_0x30decb,_0x4af313){if(_0x4af313){return _0x30decb;}return db[_0x0d8a('0xc5')]['create'](_[_0x0d8a('0x4d')](_0x27593a[_0x0d8a('0x5f')],{'read':![],'body':_0x27593a[_0x0d8a('0x5f')]['body'],'phone':_0x159d7a,'SmsAccountId':_0x43742f['id'],'SmsInteractionId':_0x30decb['id'],'UserId':_0x27593a[_0x0d8a('0x56')]['id'],'ContactId':_0x4762fe['id']}))['then'](function(_0x131348){_0x30decb[_0x0d8a('0xc7')]['Messages']=[];_0x30decb['dataValues'][_0x0d8a('0xc6')][_0x0d8a('0xa4')](_0x131348[_0x0d8a('0xc7')]);return _0x30decb;});})[_0x0d8a('0x1f')](respondWithResult(_0xd59828,null))['catch'](handleError(_0xd59828,null));};exports['status']=function(_0x5ec690,_0x37e5de,_0x301712){if(_0x5ec690['body']['id']){delete _0x5ec690[_0x0d8a('0x5f')]['id'];}var _0x131937,_0x3a9902,_0x2f7964;return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x5ec690[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x37e5de,null))['then'](function(_0x35692a){if(_0x35692a){_0x2f7964=_0x35692a;logger[_0x0d8a('0xc8')](_0x0d8a('0x22'),'status',_0x0d8a('0xc9'),_0x35692a[_0x0d8a('0x4b')],util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));switch(_0x35692a['type']){case _0x0d8a('0x81'):if(_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0xcb')]&&_0x5ec690['body'][_0x0d8a('0x28')]){_0x3a9902=_0x5ec690['body'][_0x0d8a('0x28')];return db[_0x0d8a('0xc5')][_0x0d8a('0x54')]({'where':{'messageId':_0x5ec690['body'][_0x0d8a('0xcb')]}});}break;case _0x0d8a('0xcc'):if(_0x5ec690['body'][_0x0d8a('0xcd')]&&_0x5ec690['body'][_0x0d8a('0xce')]){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')]['statusInt'];return db['SmsMessage']['find']({'where':{'messageId':_0x5ec690['body'][_0x0d8a('0xcd')]}});}break;case _0x0d8a('0x83'):if(_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x84')]&&_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0xcf')]){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')]['status_code'];return db[_0x0d8a('0xc5')]['find']({'where':{'messageId':_0x5ec690[_0x0d8a('0x5f')]['message_id']}});}break;case _0x0d8a('0x87'):var _0x209e73=_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x88')][0x0];if(_0x209e73[_0x0d8a('0x89')]&&_0x209e73[_0x0d8a('0x28')]['groupName']===_0x0d8a('0xd0')){_0x3a9902=_0x209e73['status']['groupName'];return db[_0x0d8a('0xc5')][_0x0d8a('0x54')]({'where':{'messageId':_0x209e73[_0x0d8a('0x89')]}});}break;case'clickatell':if(_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x89')]&&_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x28')]){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x28')];return db['SmsMessage'][_0x0d8a('0x54')]({'where':{'messageId':_0x5ec690['body']['messageId']}});}break;case'bandwidth':if(_0x5ec690[_0x0d8a('0x5f')][0x0]['message']['id']){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')][0x0][_0x0d8a('0x4b')];return db['SmsMessage'][_0x0d8a('0x54')]({'where':{'messageId':_0x5ec690[_0x0d8a('0x5f')][0x0][_0x0d8a('0x24')]['id']}});}break;case'intelepeer':if(_0x5ec690[_0x0d8a('0x5f')]['redif']&&_0x5ec690[_0x0d8a('0x5f')]['status']){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x28')];return db[_0x0d8a('0xc5')][_0x0d8a('0x54')]({'where':{'messageId':_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0xd1')]}});}break;}}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x37e5de,null))['then'](function(_0x1900b0){if(_0x1900b0){_0x131937=_0x1900b0;switch(_0x2f7964['type']){case _0x0d8a('0x81'):if(_0x3a9902===_0x0d8a('0xd0')){return _0x131937['update']({'read':!![]});}else{logger[_0x0d8a('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0d8a('0x28'),_0x0d8a('0x81'),util[_0x0d8a('0xca')](_0x5ec690['body'],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0xcc'):if(_0x3a9902==='1'){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger[_0x0d8a('0x23')](_0x0d8a('0x22'),_0x0d8a('0x28'),'skebby',util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0x83'):if(!_0x5ec690['body'][_0x0d8a('0xd2')]&&_0x3a9902>=0xc8&&_0x3a9902<=0xce){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger['error'](_0x0d8a('0x22'),'status','clicksend',util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x418a69=_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x88')][0x0];if(_0x418a69[_0x0d8a('0x28')][_0x0d8a('0xd3')]===_0x0d8a('0xd0')){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger['error'](_0x0d8a('0x22'),'status',_0x0d8a('0x87'),util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0xd4'):if(_0x3a9902==_0x0d8a('0xd5')||_0x3a9902==_0x0d8a('0xd6')){return _0x131937['update']({'read':!![]});}else{logger[_0x0d8a('0x23')](_0x0d8a('0x22'),_0x0d8a('0x28'),_0x0d8a('0xd4'),util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0x8f'):if(_0x3a9902==_0x0d8a('0xd7')){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger[_0x0d8a('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0d8a('0x8f'),util['inspect'](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0x90'):if(_0x3a9902===_0x0d8a('0xd8')||_0x3a9902==='ACCEPTD'){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger['error'](_0x0d8a('0x22'),'status','intelepeer',util[_0x0d8a('0xca')](_0x5ec690['body'],{'showHidden':![],'depth':null}));}break;}return _0x131937;}})['then'](respondWithResult(_0x37e5de,null))[_0x0d8a('0x26')](handleError(_0x37e5de,null));};exports['statusGet']=function(_0x2922e4,_0x503f32,_0x3a4d7d){var _0x21ffa6,_0x5a59d5,_0x4388ba;return db[_0x0d8a('0x3a')]['find']({'where':{'id':_0x2922e4[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x503f32,null))[_0x0d8a('0x1f')](function(_0x5ee23e){if(_0x5ee23e){_0x4388ba=_0x5ee23e;logger[_0x0d8a('0xc8')](_0x0d8a('0x22'),_0x0d8a('0x28'),_0x0d8a('0xc9'),_0x5ee23e[_0x0d8a('0x4b')],util[_0x0d8a('0xca')](_0x2922e4[_0x0d8a('0x3e')],{'showHidden':![],'depth':null}));switch(_0x5ee23e[_0x0d8a('0x4b')]){case'csc':if(_0x2922e4[_0x0d8a('0x3e')][_0x0d8a('0xd9')]&&_0x2922e4['query'][_0x0d8a('0xda')]){_0x5a59d5=_0x2922e4[_0x0d8a('0x3e')][_0x0d8a('0xda')];return db[_0x0d8a('0xc5')][_0x0d8a('0x54')]({'where':{'messageId':_0x2922e4[_0x0d8a('0x3e')][_0x0d8a('0xd9')]}});}break;}}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x503f32,null))[_0x0d8a('0x1f')](function(_0x12077c){if(_0x12077c){_0x21ffa6=_0x12077c;switch(_0x4388ba['type']){case _0x0d8a('0xdb'):if(_0x5a59d5==='2'||_0x5a59d5==='6'){return _0x21ffa6[_0x0d8a('0x5e')]({'read':!![]});}else{logger[_0x0d8a('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0d8a('0x28'),_0x0d8a('0xdb'),util[_0x0d8a('0xca')](_0x2922e4[_0x0d8a('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x21ffa6;}})[_0x0d8a('0x1f')](respondWithResult(_0x503f32,null))['catch'](handleError(_0x503f32,null));};exports['addAgents']=function(_0x2b8d38,_0x309c3a,_0x49e68d){return db['SmsAccount'][_0x0d8a('0x54')]({'where':{'id':_0x2b8d38['params']['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x309c3a,null))[_0x0d8a('0x1f')](function(_0x5478fb){if(_0x5478fb){return _0x5478fb['addAgents'](_0x2b8d38[_0x0d8a('0x5f')][_0x0d8a('0x6e')],_[_0x0d8a('0x9d')](_0x2b8d38[_0x0d8a('0x5f')],['ids','id'])||{})['spread'](function(_0x17ba8b){for(var _0x4f5b9d=0x0;_0x4f5b9d<_0x2b8d38['body'][_0x0d8a('0x6e')][_0x0d8a('0x44')];_0x4f5b9d+=0x1){socket[_0x0d8a('0xdc')](_0x0d8a('0xdd'),{'UserId':Number(_0x2b8d38[_0x0d8a('0x5f')][_0x0d8a('0x6e')][_0x4f5b9d]),'SmsAccountId':Number(_0x2b8d38[_0x0d8a('0x52')]['id'])});}return _0x17ba8b;});}})['then'](respondWithResult(_0x309c3a,null))[_0x0d8a('0x26')](handleError(_0x309c3a,null));};exports[_0x0d8a('0xde')]=function(_0x3bf85f,_0x10635b,_0x54f7b0){return db['SmsAccount']['find']({'where':{'id':_0x3bf85f[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x10635b,null))[_0x0d8a('0x1f')](function(_0x41c946){if(_0x41c946){return _0x41c946[_0x0d8a('0xde')](_0x3bf85f[_0x0d8a('0x3e')][_0x0d8a('0x6e')])['then'](function(){if(_[_0x0d8a('0xdf')](_0x3bf85f[_0x0d8a('0x3e')][_0x0d8a('0x6e')])){for(var _0x485237=0x0;_0x485237<_0x3bf85f[_0x0d8a('0x3e')][_0x0d8a('0x6e')][_0x0d8a('0x44')];_0x485237+=0x1){socket[_0x0d8a('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x3bf85f['query'][_0x0d8a('0x6e')][_0x485237]),'SmsAccountId':Number(_0x3bf85f[_0x0d8a('0x52')]['id'])});}}else{socket['emit'](_0x0d8a('0xe0'),{'UserId':Number(_0x3bf85f[_0x0d8a('0x3e')][_0x0d8a('0x6e')]),'SmsAccountId':Number(_0x3bf85f['params']['id'])});}});}})[_0x0d8a('0x1f')](respondWithStatusCode(_0x10635b,null))['catch'](handleError(_0x10635b,null));};exports[_0x0d8a('0xe1')]=function(_0x49e682,_0x20567f,_0x15abf0){var _0x34291b={};var _0x55402a={};var _0x58c812;var _0x1c8f62;return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x49e682[_0x0d8a('0x52')]['id']}})['then'](handleEntityNotFound(_0x20567f,null))[_0x0d8a('0x1f')](function(_0xe3670f){if(_0xe3670f){_0x58c812=_0xe3670f;_0x55402a[_0x0d8a('0x3d')]=_[_0x0d8a('0x3f')](db[_0x0d8a('0xbb')]['rawAttributes']);_0x55402a[_0x0d8a('0x3e')]=_[_0x0d8a('0x3f')](_0x49e682['query']);_0x55402a['filters']=_['intersection'](_0x55402a['model'],_0x55402a['query']);_0x34291b[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0x55402a[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x49e682['query'][_0x0d8a('0x42')]));_0x34291b[_0x0d8a('0x43')]=_0x34291b[_0x0d8a('0x43')][_0x0d8a('0x44')]?_0x34291b['attributes']:_0x55402a[_0x0d8a('0x3d')];_0x34291b[_0x0d8a('0x6c')]=qs['sort'](_0x49e682[_0x0d8a('0x3e')][_0x0d8a('0x47')]);_0x34291b[_0x0d8a('0x4a')]=qs[_0x0d8a('0x40')](_[_0x0d8a('0x48')](_0x49e682[_0x0d8a('0x3e')],_0x55402a[_0x0d8a('0x40')]));if(_0x49e682['query']['filter']){_0x34291b[_0x0d8a('0x4a')]=_[_0x0d8a('0x4d')](_0x34291b[_0x0d8a('0x4a')],{'$or':_[_0x0d8a('0x39')](_0x34291b['attributes'],function(_0x4964dd){var _0x10aeff={};_0x10aeff[_0x4964dd]={'$like':'%'+_0x49e682['query']['filter']+'%'};return _0x10aeff;})});}_0x34291b=_[_0x0d8a('0x4d')]({},_0x34291b,_0x49e682['options']);return _0x58c812[_0x0d8a('0xe1')](_0x34291b);}})[_0x0d8a('0x1f')](function(_0x243712){if(_0x243712){_0x1c8f62=_0x243712['length'];if(!_0x49e682[_0x0d8a('0x3e')][_0x0d8a('0x45')](_0x0d8a('0x66'))){_0x34291b[_0x0d8a('0x46')]=qs[_0x0d8a('0x46')](_0x49e682[_0x0d8a('0x3e')][_0x0d8a('0x46')]);_0x34291b[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x49e682[_0x0d8a('0x3e')][_0x0d8a('0x2b')]);}return _0x58c812['getAgents'](_0x34291b);}})['then'](function(_0x3967a0){if(_0x3967a0){return _0x3967a0?{'count':_0x1c8f62,'rows':_0x3967a0}:null;}})[_0x0d8a('0x1f')](respondWithResult(_0x20567f,null))[_0x0d8a('0x26')](handleError(_0x20567f,null));}; \ No newline at end of file +var _0xdf39=['describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','Applications','account','applications','priority','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','Body','messageId','MessageSid','skebby','from','sender','text','connectel','clicksend','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','unmanaged','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','color','tag','to\x20is\x20mandatory','CmList','List','SmsMessage','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','DELIVERED','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','ids','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','SmsAccounts','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','map','name','filters','intersection','query','attributes','model','fields','length','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','rows','keys','include','SmsAccount','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xdf39,0x84));var _0x9df3=function(_0x1312f9,_0x38b964){_0x1312f9=_0x1312f9-0x0;var _0x3e0d7a=_0xdf39[_0x1312f9];return _0x3e0d7a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9df3('0x0'));var jsonpatch=require(_0x9df3('0x1'));var rp=require('request-promise');var moment=require(_0x9df3('0x2'));var BPromise=require(_0x9df3('0x3'));var Mustache=require(_0x9df3('0x4'));var util=require(_0x9df3('0x5'));var path=require(_0x9df3('0x6'));var sox=require(_0x9df3('0x7'));var csv=require('to-csv');var ejs=require(_0x9df3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9df3('0x9'));var squel=require('squel');var crypto=require(_0x9df3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9df3('0xb'));var Papa=require(_0x9df3('0xc'));var Redis=require(_0x9df3('0xd'));var authService=require(_0x9df3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9df3('0xf'));var hardwareService=require(_0x9df3('0x10'));var logger=require(_0x9df3('0x11'))('api');var utils=require(_0x9df3('0x12'));var config=require(_0x9df3('0x13'));var licenseUtil=require(_0x9df3('0x14'));var db=require(_0x9df3('0x15'))['db'];config[_0x9df3('0x16')]=_[_0x9df3('0x17')](config[_0x9df3('0x16')],{'host':_0x9df3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9df3('0x16')]));require(_0x9df3('0x19'))[_0x9df3('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9df3('0x1b')][_0x9df3('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x3fbf78,_0x2a39d9,_0x225466,_0x54ba56){return new BPromise(function(_0x7d8d46,_0x1d54eb){var _0x4714c2=_0x54ba56||client;return _0x4714c2['request'](_0x3fbf78,_0x225466)[_0x9df3('0x1d')](function(_0x22d4e2){logger[_0x9df3('0x1e')](_0x9df3('0x1f'),_0x2a39d9,_0x9df3('0x20'));logger[_0x9df3('0x21')](_0x9df3('0x22'),_0x2a39d9,_0x9df3('0x20'),JSON[_0x9df3('0x23')](_0x22d4e2));if(_0x22d4e2['error']){if(_0x22d4e2[_0x9df3('0x24')][_0x9df3('0x25')]===0x1f4){logger[_0x9df3('0x24')](_0x9df3('0x1f'),_0x2a39d9,_0x22d4e2['error'][_0x9df3('0x26')]);return _0x1d54eb(_0x22d4e2[_0x9df3('0x24')][_0x9df3('0x26')]);}logger[_0x9df3('0x24')](_0x9df3('0x1f'),_0x2a39d9,_0x22d4e2[_0x9df3('0x24')][_0x9df3('0x26')]);return _0x7d8d46(_0x22d4e2['error'][_0x9df3('0x26')]);}else{logger[_0x9df3('0x1e')](_0x9df3('0x1f'),_0x2a39d9,_0x9df3('0x20'));_0x7d8d46(_0x22d4e2[_0x9df3('0x27')]['message']);}})[_0x9df3('0x28')](function(_0x543640){logger[_0x9df3('0x24')](_0x9df3('0x1f'),_0x2a39d9,_0x543640);_0x1d54eb(_0x543640);});});}function respondWithStatusCode(_0xfaa242,_0x507f8d){_0x507f8d=_0x507f8d||0xcc;return function(_0x4baa3f){if(_0x4baa3f){return _0xfaa242[_0x9df3('0x29')](_0x507f8d);}return _0xfaa242[_0x9df3('0x2a')](_0x507f8d)[_0x9df3('0x2b')]();};}function respondWithResult(_0x10aa15,_0x4211ba){_0x4211ba=_0x4211ba||0xc8;return function(_0x528ed6){if(_0x528ed6){return _0x10aa15[_0x9df3('0x2a')](_0x4211ba)[_0x9df3('0x2c')](_0x528ed6);}};}function respondWithFilteredResult(_0x255c53,_0x3e2d6e){return function(_0x19c357){if(_0x19c357){var _0x4afc38=typeof _0x3e2d6e['offset']===_0x9df3('0x2d')&&typeof _0x3e2d6e[_0x9df3('0x2e')]===_0x9df3('0x2d');var _0x2a96b7=_0x19c357['count'];var _0x54cb15=_0x4afc38?0x0:_0x3e2d6e['offset'];var _0x120f69=_0x4afc38?_0x19c357[_0x9df3('0x2f')]:_0x3e2d6e['offset']+_0x3e2d6e[_0x9df3('0x2e')];var _0x9a4bc9;if(_0x120f69>=_0x2a96b7){_0x120f69=_0x2a96b7;_0x9a4bc9=0xc8;}else{_0x9a4bc9=0xce;}_0x255c53[_0x9df3('0x2a')](_0x9a4bc9);return _0x255c53[_0x9df3('0x30')](_0x9df3('0x31'),_0x54cb15+'-'+_0x120f69+'/'+_0x2a96b7)[_0x9df3('0x2c')](_0x19c357);}return null;};}function patchUpdates(_0x53f523){return function(_0x2c1574){try{jsonpatch[_0x9df3('0x32')](_0x2c1574,_0x53f523,!![]);}catch(_0x11c2f4){return BPromise[_0x9df3('0x33')](_0x11c2f4);}return _0x2c1574[_0x9df3('0x34')]();};}function saveUpdates(_0xbdc7c,_0x4fab09){return function(_0x27c112){if(_0x27c112){return _0x27c112['update'](_0xbdc7c)['then'](function(_0x419ad0){return _0x419ad0;});}return null;};}function removeEntity(_0x2f9e21,_0x4eb100){return function(_0x45f267){if(_0x45f267){return _0x45f267[_0x9df3('0x35')]()[_0x9df3('0x1d')](function(){var _0x2786ce=_0x45f267['get']({'plain':!![]});var _0x660be2=_0x9df3('0x36');return db['UserProfileResource'][_0x9df3('0x35')]({'where':{'type':_0x660be2,'resourceId':_0x2786ce['id']}})[_0x9df3('0x1d')](function(){return _0x45f267;});})[_0x9df3('0x1d')](function(){_0x2f9e21[_0x9df3('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59834e,_0x3db922){return function(_0x55ec64){if(!_0x55ec64){_0x59834e['sendStatus'](0x194);}return _0x55ec64;};}function handleError(_0x5dad2d,_0x3dc4f6){_0x3dc4f6=_0x3dc4f6||0x1f4;return function(_0x42f225){logger[_0x9df3('0x24')](_0x42f225['stack']);if(_0x42f225['name']){delete _0x42f225['name'];}_0x5dad2d[_0x9df3('0x2a')](_0x3dc4f6)[_0x9df3('0x37')](_0x42f225);};}exports[_0x9df3('0x38')]=function(_0x358e28,_0x4e570e){var _0x2d3129={'include':[{'model':db[_0x9df3('0x39')],'as':_0x9df3('0x3a')}]},_0x2319aa={},_0x30cd82={'count':0x0,'rows':[]};var _0x538572=_['map'](db['SmsAccount'][_0x9df3('0x3b')],function(_0x3782a3){return{'name':_0x3782a3[_0x9df3('0x3c')],'type':_0x3782a3[_0x9df3('0x3d')][_0x9df3('0x3e')]};});_0x2319aa['model']=_[_0x9df3('0x3f')](_0x538572,_0x9df3('0x40'));_0x2319aa['query']=_['keys'](_0x358e28['query']);_0x2319aa[_0x9df3('0x41')]=_[_0x9df3('0x42')](_0x2319aa['model'],_0x2319aa[_0x9df3('0x43')]);_0x2d3129[_0x9df3('0x44')]=_['intersection'](_0x2319aa[_0x9df3('0x45')],qs[_0x9df3('0x46')](_0x358e28['query'][_0x9df3('0x46')]));_0x2d3129[_0x9df3('0x44')]=_0x2d3129[_0x9df3('0x44')][_0x9df3('0x47')]?_0x2d3129['attributes']:_0x2319aa[_0x9df3('0x45')];if(!_0x358e28[_0x9df3('0x43')]['hasOwnProperty']('nolimit')){_0x2d3129[_0x9df3('0x2e')]=qs[_0x9df3('0x2e')](_0x358e28[_0x9df3('0x43')][_0x9df3('0x2e')]);_0x2d3129[_0x9df3('0x48')]=qs[_0x9df3('0x48')](_0x358e28[_0x9df3('0x43')][_0x9df3('0x48')]);}_0x2d3129[_0x9df3('0x49')]=qs[_0x9df3('0x4a')](_0x358e28[_0x9df3('0x43')][_0x9df3('0x4a')]);_0x2d3129['where']=qs['filters'](_[_0x9df3('0x4b')](_0x358e28[_0x9df3('0x43')],_0x2319aa[_0x9df3('0x41')]),_0x538572);if(_0x358e28['query'][_0x9df3('0x4c')]){_0x2d3129['where']=_[_0x9df3('0x4d')](_0x2d3129[_0x9df3('0x4e')],{'$or':_[_0x9df3('0x3f')](_0x538572,function(_0x5b1a4e){if(_0x5b1a4e[_0x9df3('0x3d')]!==_0x9df3('0x4f')){var _0x4982bd={};_0x4982bd[_0x5b1a4e[_0x9df3('0x40')]]={'$like':'%'+_0x358e28['query']['filter']+'%'};return _0x4982bd;}})});}_0x2d3129=_[_0x9df3('0x4d')]({},_0x2d3129,_0x358e28[_0x9df3('0x50')]);var _0x20a78f={'where':_0x2d3129['where']};return db['SmsAccount'][_0x9df3('0x2f')](_0x20a78f)[_0x9df3('0x1d')](function(_0x330461){_0x30cd82[_0x9df3('0x2f')]=_0x330461;if(_0x358e28[_0x9df3('0x43')][_0x9df3('0x51')]){_0x2d3129['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x2d3129);})[_0x9df3('0x1d')](function(_0x207488){_0x30cd82[_0x9df3('0x52')]=_0x207488;return _0x30cd82;})[_0x9df3('0x1d')](respondWithFilteredResult(_0x4e570e,_0x2d3129))[_0x9df3('0x28')](handleError(_0x4e570e,null));};exports['show']=function(_0x2410be,_0x313646){var _0x1dc0ec={'raw':![],'where':{'id':_0x2410be['params']['id']},'include':[{'model':db[_0x9df3('0x39')],'as':_0x9df3('0x3a')}]},_0x20c1ca={};_0x20c1ca[_0x9df3('0x45')]=_[_0x9df3('0x53')](db['SmsAccount'][_0x9df3('0x3b')]);_0x20c1ca['query']=_[_0x9df3('0x53')](_0x2410be['query']);_0x20c1ca[_0x9df3('0x41')]=_[_0x9df3('0x42')](_0x20c1ca['model'],_0x20c1ca['query']);_0x1dc0ec['attributes']=_[_0x9df3('0x42')](_0x20c1ca['model'],qs['fields'](_0x2410be[_0x9df3('0x43')]['fields']));_0x1dc0ec[_0x9df3('0x44')]=_0x1dc0ec[_0x9df3('0x44')]['length']?_0x1dc0ec['attributes']:_0x20c1ca[_0x9df3('0x45')];if(_0x2410be[_0x9df3('0x43')][_0x9df3('0x51')]){_0x1dc0ec[_0x9df3('0x54')]=[{'all':!![]}];}_0x1dc0ec=_[_0x9df3('0x4d')]({},_0x1dc0ec,_0x2410be[_0x9df3('0x50')]);return db[_0x9df3('0x55')][_0x9df3('0x56')](_0x1dc0ec)[_0x9df3('0x1d')](handleEntityNotFound(_0x313646,null))[_0x9df3('0x1d')](respondWithResult(_0x313646,null))['catch'](handleError(_0x313646,null));};exports['create']=function(_0x22ce98,_0x4e7a09){return db[_0x9df3('0x55')][_0x9df3('0x57')](_0x22ce98['body'],{})[_0x9df3('0x1d')](function(_0x3ef939){var _0x4840fa=_0x22ce98[_0x9df3('0x58')]['get']({'plain':!![]});if(!_0x4840fa)throw new Error(_0x9df3('0x59'));if(_0x4840fa[_0x9df3('0x5a')]===_0x9df3('0x58')){var _0x1c10e2=_0x3ef939[_0x9df3('0x5b')]({'plain':!![]});var _0x4ead6f='SmsAccounts';return db[_0x9df3('0x5c')][_0x9df3('0x56')]({'where':{'name':_0x4ead6f,'userProfileId':_0x4840fa[_0x9df3('0x5d')]},'raw':!![]})[_0x9df3('0x1d')](function(_0x499669){if(_0x499669&&_0x499669[_0x9df3('0x5e')]===0x0){return db[_0x9df3('0x5f')]['create']({'name':_0x1c10e2[_0x9df3('0x40')],'resourceId':_0x1c10e2['id'],'type':_0x499669[_0x9df3('0x40')],'sectionId':_0x499669['id']},{})[_0x9df3('0x1d')](function(){return _0x3ef939;});}else{return _0x3ef939;}})[_0x9df3('0x28')](function(_0x286919){logger['error'](_0x9df3('0x60'),_0x286919);throw _0x286919;});}return _0x3ef939;})[_0x9df3('0x1d')](respondWithResult(_0x4e7a09,0xc9))['catch'](handleError(_0x4e7a09,null));};exports[_0x9df3('0x61')]=function(_0x35aeba,_0x441dc7){if(_0x35aeba[_0x9df3('0x62')]['id']){delete _0x35aeba[_0x9df3('0x62')]['id'];}return db[_0x9df3('0x55')][_0x9df3('0x56')]({'where':{'id':_0x35aeba[_0x9df3('0x63')]['id']},'include':[{'model':db[_0x9df3('0x39')],'as':_0x9df3('0x3a')}]})['then'](handleEntityNotFound(_0x441dc7,null))[_0x9df3('0x1d')](saveUpdates(_0x35aeba[_0x9df3('0x62')],null))[_0x9df3('0x1d')](respondWithResult(_0x441dc7,null))['catch'](handleError(_0x441dc7,null));};exports['destroy']=function(_0x51636f,_0x19146c){return db[_0x9df3('0x55')][_0x9df3('0x56')]({'where':{'id':_0x51636f['params']['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0x19146c,null))['then'](removeEntity(_0x19146c,null))['catch'](handleError(_0x19146c,null));};exports[_0x9df3('0x64')]=function(_0xb85468,_0x12fdce){return db['SmsAccount'][_0x9df3('0x64')]()[_0x9df3('0x1d')](respondWithResult(_0x12fdce,null))[_0x9df3('0x28')](handleError(_0x12fdce,null));};exports[_0x9df3('0x65')]=function(_0x353305,_0xec68a3,_0x4c05a6){if(_0x353305[_0x9df3('0x62')]['id']){delete _0x353305[_0x9df3('0x62')]['id'];}return db[_0x9df3('0x55')][_0x9df3('0x56')]({'where':{'id':_0x353305['params']['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0xec68a3,null))[_0x9df3('0x1d')](function(_0x57d3e3){if(_0x57d3e3){_0x353305[_0x9df3('0x62')][_0x9df3('0x66')]=_0x57d3e3['id'];return db[_0x9df3('0x67')]['create'](_0x353305[_0x9df3('0x62')]);}})[_0x9df3('0x1d')](respondWithResult(_0xec68a3,null))[_0x9df3('0x28')](handleError(_0xec68a3,null));};exports[_0x9df3('0x68')]=function(_0x2fd578,_0x3d265b,_0x6d6da0){var _0x4ad842={'raw':![],'where':{}};var _0x3a29c5={};var _0x209504={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9df3('0x69')]({'where':{'id':_0x2fd578[_0x9df3('0x63')]['id']}})['then'](handleEntityNotFound(_0x3d265b,null))['then'](function(_0x50ed88){if(_0x50ed88){_0x3a29c5[_0x9df3('0x45')]=_[_0x9df3('0x53')](db[_0x9df3('0x67')][_0x9df3('0x3b')]);_0x3a29c5[_0x9df3('0x43')]=_[_0x9df3('0x53')](_0x2fd578['query']);_0x3a29c5[_0x9df3('0x41')]=_[_0x9df3('0x42')](_0x3a29c5[_0x9df3('0x45')],_0x3a29c5[_0x9df3('0x43')]);_0x4ad842[_0x9df3('0x44')]=_[_0x9df3('0x42')](_0x3a29c5['model'],qs[_0x9df3('0x46')](_0x2fd578[_0x9df3('0x43')][_0x9df3('0x46')]));_0x4ad842[_0x9df3('0x44')]=_0x4ad842[_0x9df3('0x44')]['length']?_0x4ad842['attributes']:_0x3a29c5[_0x9df3('0x45')];if(!_0x2fd578[_0x9df3('0x43')][_0x9df3('0x6a')](_0x9df3('0x6b'))){_0x4ad842[_0x9df3('0x2e')]=qs[_0x9df3('0x2e')](_0x2fd578[_0x9df3('0x43')]['limit']);_0x4ad842[_0x9df3('0x48')]=qs[_0x9df3('0x48')](_0x2fd578[_0x9df3('0x43')]['offset']);}_0x4ad842[_0x9df3('0x49')]=qs[_0x9df3('0x4a')](_0x2fd578[_0x9df3('0x43')][_0x9df3('0x4a')]);_0x4ad842['where']=qs[_0x9df3('0x41')](_[_0x9df3('0x4b')](_0x2fd578[_0x9df3('0x43')],_0x3a29c5['filters']));_0x4ad842['where']['SmsAccountId']=_0x50ed88['id'];if(_0x2fd578[_0x9df3('0x43')][_0x9df3('0x4c')]){_0x4ad842['where']=_[_0x9df3('0x4d')](_0x4ad842['where'],{'$or':_[_0x9df3('0x3f')](_0x4ad842[_0x9df3('0x44')],function(_0x5ec3e0){var _0x320bce={};_0x320bce[_0x5ec3e0]={'$like':'%'+_0x2fd578[_0x9df3('0x43')][_0x9df3('0x4c')]+'%'};return _0x320bce;})});}_0x4ad842=_[_0x9df3('0x4d')]({},_0x4ad842,_0x2fd578[_0x9df3('0x50')]);return db['Disposition']['count']({'where':_0x4ad842[_0x9df3('0x4e')]})[_0x9df3('0x1d')](function(_0x1e7af4){_0x209504[_0x9df3('0x2f')]=_0x1e7af4;if(_0x2fd578[_0x9df3('0x43')][_0x9df3('0x51')]){_0x4ad842[_0x9df3('0x54')]=[{'all':!![]}];}return db[_0x9df3('0x67')][_0x9df3('0x6c')](_0x4ad842);})['then'](function(_0x3b7135){_0x209504['rows']=_0x3b7135;return _0x209504;});}})[_0x9df3('0x1d')](respondWithFilteredResult(_0x3d265b,_0x4ad842))[_0x9df3('0x28')](handleError(_0x3d265b,null));};exports['removeDispositions']=function(_0x573582,_0x126aac,_0x51ae2b){return db[_0x9df3('0x55')][_0x9df3('0x56')]({'where':{'id':_0x573582[_0x9df3('0x63')]['id']}})['then'](handleEntityNotFound(_0x126aac,null))['then'](function(_0x3bdae7){if(_0x3bdae7){return _0x3bdae7[_0x9df3('0x6d')](_0x573582[_0x9df3('0x43')]['ids']);}})[_0x9df3('0x1d')](respondWithStatusCode(_0x126aac,null))[_0x9df3('0x28')](handleError(_0x126aac,null));};exports[_0x9df3('0x6e')]=function(_0x1997be,_0xb2582a,_0x37ce30){if(_0x1997be[_0x9df3('0x62')]['id']){delete _0x1997be['body']['id'];}return db[_0x9df3('0x55')]['find']({'where':{'id':_0x1997be[_0x9df3('0x63')]['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0xb2582a,null))[_0x9df3('0x1d')](function(_0x4bed8f){if(_0x4bed8f){_0x1997be[_0x9df3('0x62')][_0x9df3('0x66')]=_0x4bed8f['id'];return db[_0x9df3('0x6f')][_0x9df3('0x57')](_0x1997be[_0x9df3('0x62')]);}})[_0x9df3('0x1d')](respondWithResult(_0xb2582a,null))[_0x9df3('0x28')](handleError(_0xb2582a,null));};exports[_0x9df3('0x70')]=function(_0x3992ce,_0x340f53,_0x49b8d8){var _0x54ce33={'raw':![],'where':{}};var _0x117d2e={};var _0x478862={'count':0x0,'rows':[]};return db[_0x9df3('0x55')][_0x9df3('0x69')]({'where':{'id':_0x3992ce[_0x9df3('0x63')]['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0x340f53,null))[_0x9df3('0x1d')](function(_0x2a2f91){if(_0x2a2f91){_0x117d2e['model']=_[_0x9df3('0x53')](db[_0x9df3('0x6f')][_0x9df3('0x3b')]);_0x117d2e[_0x9df3('0x43')]=_[_0x9df3('0x53')](_0x3992ce[_0x9df3('0x43')]);_0x117d2e[_0x9df3('0x41')]=_[_0x9df3('0x42')](_0x117d2e[_0x9df3('0x45')],_0x117d2e[_0x9df3('0x43')]);_0x54ce33[_0x9df3('0x44')]=_[_0x9df3('0x42')](_0x117d2e['model'],qs[_0x9df3('0x46')](_0x3992ce[_0x9df3('0x43')][_0x9df3('0x46')]));_0x54ce33['attributes']=_0x54ce33['attributes'][_0x9df3('0x47')]?_0x54ce33[_0x9df3('0x44')]:_0x117d2e[_0x9df3('0x45')];if(!_0x3992ce[_0x9df3('0x43')][_0x9df3('0x6a')](_0x9df3('0x6b'))){_0x54ce33[_0x9df3('0x2e')]=qs['limit'](_0x3992ce[_0x9df3('0x43')][_0x9df3('0x2e')]);_0x54ce33[_0x9df3('0x48')]=qs[_0x9df3('0x48')](_0x3992ce[_0x9df3('0x43')][_0x9df3('0x48')]);}_0x54ce33[_0x9df3('0x49')]=qs['sort'](_0x3992ce[_0x9df3('0x43')][_0x9df3('0x4a')]);_0x54ce33[_0x9df3('0x4e')]=qs[_0x9df3('0x41')](_[_0x9df3('0x4b')](_0x3992ce['query'],_0x117d2e[_0x9df3('0x41')]));_0x54ce33['where'][_0x9df3('0x66')]=_0x2a2f91['id'];if(_0x3992ce[_0x9df3('0x43')][_0x9df3('0x4c')]){_0x54ce33[_0x9df3('0x4e')]=_[_0x9df3('0x4d')](_0x54ce33['where'],{'$or':_['map'](_0x54ce33[_0x9df3('0x44')],function(_0xe163ea){var _0x4282a3={};_0x4282a3[_0xe163ea]={'$like':'%'+_0x3992ce[_0x9df3('0x43')]['filter']+'%'};return _0x4282a3;})});}_0x54ce33=_[_0x9df3('0x4d')]({},_0x54ce33,_0x3992ce[_0x9df3('0x50')]);return db[_0x9df3('0x6f')][_0x9df3('0x2f')]({'where':_0x54ce33[_0x9df3('0x4e')]})[_0x9df3('0x1d')](function(_0x3f0446){_0x478862[_0x9df3('0x2f')]=_0x3f0446;if(_0x3992ce['query']['includeAll']){_0x54ce33[_0x9df3('0x54')]=[{'all':!![]}];}return db[_0x9df3('0x6f')][_0x9df3('0x6c')](_0x54ce33);})[_0x9df3('0x1d')](function(_0x18f4ce){_0x478862[_0x9df3('0x52')]=_0x18f4ce;return _0x478862;});}})[_0x9df3('0x1d')](respondWithFilteredResult(_0x340f53,_0x54ce33))[_0x9df3('0x28')](handleError(_0x340f53,null));};exports[_0x9df3('0x71')]=function(_0x54b7cd,_0x4f1c4c,_0x1d752d){return db[_0x9df3('0x55')][_0x9df3('0x56')]({'where':{'id':_0x54b7cd[_0x9df3('0x63')]['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0x4f1c4c,null))[_0x9df3('0x1d')](function(_0x14fa0c){if(_0x14fa0c){return _0x14fa0c[_0x9df3('0x71')](_0x54b7cd[_0x9df3('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x4f1c4c,null))[_0x9df3('0x28')](handleError(_0x4f1c4c,null));};exports['notify']=function(_0x2c00c0,_0x1bfa5f,_0xbcf59c){var _0x2b0a25={'channel':_0x9df3('0x72')};var _0x50d997=[];var _0x4a64ae=[];var _0x314120={};return db[_0x9df3('0x55')][_0x9df3('0x56')]({'where':{'id':_0x2c00c0['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x9df3('0x73')}]})[_0x9df3('0x1d')](handleEntityNotFound(_0x1bfa5f,null))[_0x9df3('0x1d')](function(_0x1d094e){_0x2b0a25[_0x9df3('0x74')]=_0x1d094e;_0x2b0a25[_0x9df3('0x75')]=_['orderBy'](_0x1d094e['Applications'],[_0x9df3('0x76')],['asc']);if(_0x2b0a25[_0x9df3('0x74')][_0x9df3('0x73')]){delete _0x2b0a25[_0x9df3('0x74')][_0x9df3('0x73')];}return db[_0x9df3('0x77')][_0x9df3('0x64')]();})[_0x9df3('0x1d')](function(_0x2d22e9){if(!_0x2d22e9){throw new db['Sequelize'][(_0x9df3('0x78'))](_0x9df3('0x79'));}_0x50d997=_[_0x9df3('0x7a')](_[_0x9df3('0x53')](_0x2d22e9),['createdAt','updatedAt']);_0x4a64ae=_[_0x9df3('0x7a')](_['keys'](_0x2d22e9),[_0x9df3('0x7b'),_0x9df3('0x7c'),_0x9df3('0x7d'),_0x9df3('0x7e')]);_0x2b0a25[_0x9df3('0x62')]={'mapKey':_0x9df3('0x7f')};if(_0x2b0a25['account'][_0x9df3('0x3d')]){switch(_0x2b0a25[_0x9df3('0x74')][_0x9df3('0x3d')]){case'twilio':_0x2b0a25[_0x9df3('0x62')]['from']=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x80')];_0x2b0a25['body']['body']=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x81')];_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x82')]=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x83')];break;case _0x9df3('0x84'):_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x85')]='+'+_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x86')];_0x2b0a25[_0x9df3('0x62')]['body']=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x87')];break;case _0x9df3('0x88'):_0x2b0a25['body'][_0x9df3('0x85')]=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x85')];_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x62')]=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x26')];break;case _0x9df3('0x89'):_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x85')]=_0x2c00c0[_0x9df3('0x62')]['from'];_0x2b0a25['body'][_0x9df3('0x62')]=_0x2c00c0[_0x9df3('0x62')]['body'];_0x2b0a25['body']['messageId']=_0x2c00c0['body']['message_id'];break;case'plivo':_0x2b0a25[_0x9df3('0x62')]['from']=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x80')];_0x2b0a25['body'][_0x9df3('0x62')]=_0x2c00c0['body'][_0x9df3('0x8a')];_0x2b0a25['body'][_0x9df3('0x82')]=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x8b')];break;case _0x9df3('0x8c'):_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x85')]='+'+_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x8d')][0x0][_0x9df3('0x85')];_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x62')]=_0x2c00c0[_0x9df3('0x62')]['results'][0x0][_0x9df3('0x87')];_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x82')]=_0x2c00c0[_0x9df3('0x62')]['results'][0x0][_0x9df3('0x82')];break;case _0x9df3('0x8e'):_0x2b0a25['body'][_0x9df3('0x85')]=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x8f')];_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x62')]=_0x2c00c0['body'][_0x9df3('0x90')][_0x9df3('0x26')];break;case _0x9df3('0x91'):_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x85')]=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x92')];_0x2b0a25['body']['body']=_0x2c00c0[_0x9df3('0x62')]['text'];_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x82')]=_0x2c00c0['body'][_0x9df3('0x93')];break;case _0x9df3('0x94'):_0x2b0a25['body'][_0x9df3('0x82')]=_0x2c00c0['body'][0x0][_0x9df3('0x26')]['id'];_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x85')]=_0x2c00c0['body'][0x0]['message'][_0x9df3('0x85')];_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x62')]=_0x2c00c0['body'][0x0][_0x9df3('0x26')][_0x9df3('0x87')];break;case _0x9df3('0x95'):_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x85')]=_0x2c00c0['body'][_0x9df3('0x85')];_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x62')]=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x26')];_0x2b0a25['body'][_0x9df3('0x82')]=_0x2c00c0[_0x9df3('0x62')][_0x9df3('0x96')];break;}}if(_0x2b0a25[_0x9df3('0x62')]['id']){delete _0x2b0a25[_0x9df3('0x62')]['id'];}if(_[_0x9df3('0x97')](_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x85')])){throw new db['Sequelize'][(_0x9df3('0x78'))](_0x9df3('0x98'));}if(_['isNil'](_0x2b0a25['body']['body'])||_0x2b0a25['body']['body']===''){throw new db[(_0x9df3('0x99'))][(_0x9df3('0x78'))](_0x9df3('0x9a'));}if(_[_0x9df3('0x97')](_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x9b')])){throw new db[(_0x9df3('0x99'))][(_0x9df3('0x78'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a64ae);}if(!_[_0x9df3('0x9c')](_0x4a64ae,_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x9b')])){throw new db[(_0x9df3('0x99'))][(_0x9df3('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a64ae);}_0x314120[_0x2b0a25[_0x9df3('0x62')]['mapKey']]=_0x2b0a25[_0x9df3('0x62')]['from'];return db['CmList'][_0x9df3('0x56')]({'where':{'id':_0x2b0a25[_0x9df3('0x74')][_0x9df3('0x7e')]},'include':[{'model':db[_0x9df3('0x77')],'as':_0x9df3('0x9d'),'where':_0x314120,'limit':0x1,'order':[[_0x9df3('0x7c'),_0x9df3('0x9e')]]}]});})[_0x9df3('0x1d')](handleEntityNotFound(_0x1bfa5f,null))[_0x9df3('0x1d')](function(_0x4c926e){if(_0x4c926e){_0x2b0a25[_0x9df3('0x9f')]=_[_0x9df3('0xa0')](_0x4c926e,[_0x9df3('0x9d')]);if(_0x4c926e['Contacts'][_0x9df3('0x47')]){return _0x4c926e[_0x9df3('0x9d')][0x0];}var _0x1737ea=_[_0x9df3('0x17')](_0x2b0a25[_0x9df3('0x62')],{'firstName':_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x85')],'ListId':_0x4c926e['id']});_0x1737ea[_0x2b0a25['body'][_0x9df3('0x9b')]]=_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x85')];return db[_0x9df3('0x77')][_0x9df3('0x57')](_0x1737ea,{'fields':_0x50d997,'raw':!![]});}})[_0x9df3('0x1d')](handleEntityNotFound(_0x1bfa5f,null))[_0x9df3('0x1d')](function(_0x2f10bc){if(_0x2f10bc){_0x2b0a25['contact']=_0x2f10bc;var _0x42a0ab={'ContactId':_0x2f10bc['id'],'phone':_0x2b0a25['body'][_0x9df3('0x85')],'SmsAccountId':_0x2c00c0['params']['id']};var _0xf5d139={'ContactId':_0x2f10bc['id'],'SmsAccountId':_0x2c00c0[_0x9df3('0x63')]['id'],'closed':![]};return db['SmsInteraction'][_0x9df3('0x56')]({'where':_0xf5d139})['then'](function(_0x194566){if(_0x194566){return[_0x194566,![]];}return db[_0x9df3('0xa1')][_0x9df3('0x57')](_0x42a0ab)[_0x9df3('0x1d')](function(_0x39cc7c){return[_0x39cc7c,!![]];});});}})[_0x9df3('0xa2')](function(_0x321c0b,_0x48be16){_0x2b0a25[_0x9df3('0xa3')]=_0x321c0b[_0x9df3('0x5b')]({'plain':!![]});_0x2b0a25[_0x9df3('0xa3')][_0x9df3('0xa4')]=![];if(_0x48be16){if(_0x2b0a25[_0x9df3('0x74')][_0x9df3('0xa5')]){_0x2b0a25['applications']['push']({'id':0x0,'priority':_0x2b0a25[_0x9df3('0x75')][_0x9df3('0x47')]+0x1,'app':'close','appdata':_0x9df3('0xa6'),'interval':'*,*,*,*'});}_0x2b0a25[_0x9df3('0xa3')]['created']=!![];}return db['SmsMessage'][_0x9df3('0x57')]({'phone':_0x2b0a25[_0x9df3('0x62')]['from'],'messageId':_0x2b0a25[_0x9df3('0x62')][_0x9df3('0x82')],'body':_0x2b0a25['body'][_0x9df3('0x62')],'SmsAccountId':_0x2c00c0[_0x9df3('0x63')]['id'],'SmsInteractionId':_0x321c0b['id'],'direction':'in','ContactId':_0x321c0b[_0x9df3('0xa7')],'AttachmentId':_0x2b0a25[_0x9df3('0x62')][_0x9df3('0xa8')]});})[_0x9df3('0x1d')](function(_0x943313){_0x2b0a25[_0x9df3('0x26')]=_0x943313;if(_0x2b0a25['interaction'][_0x9df3('0xa9')]){return db[_0x9df3('0xaa')][_0x9df3('0x56')]({'attributes':['id',_0x9df3('0x40')],'where':{'id':_0x2b0a25[_0x9df3('0xa3')][_0x9df3('0xa9')]}})[_0x9df3('0x1d')](function(_0x5dc875){if(_0x5dc875){_0x2b0a25[_0x9df3('0x75')][_0x9df3('0xab')]({'id':0x0,'priority':0x0,'app':_0x9df3('0xac'),'appdata':_0x5dc875[_0x9df3('0x40')]+','+(_0x2b0a25[_0x9df3('0x74')][_0x9df3('0xad')]||0xa),'interval':_0x9df3('0xae')});}return respondWithRpcPromise(_0x9df3('0xaf'),_0x9df3('0xb0'),_0x2b0a25);});}return respondWithRpcPromise(_0x9df3('0xaf'),_0x9df3('0xb0'),_0x2b0a25);})['then'](function(_0x2cd273){if(_0x2cd273){var _0x455bfc=0xc8;var _0x3f292b=_0x9df3('0xb1');logger['info'](_0x9df3('0x22'),_0x3f292b,_0x455bfc,_0x9df3('0xb2'));logger[_0x9df3('0x21')](_0x9df3('0xb3'),_0x3f292b,_0x455bfc,_0x9df3('0xb2'),JSON[_0x9df3('0x23')](_0x2cd273));if(_0x2b0a25[_0x9df3('0x74')][_0x9df3('0x3d')]==='twilio'){return _0x1bfa5f[_0x9df3('0x2a')](_0x455bfc)['set'](_0x9df3('0xb4'),_0x9df3('0xb5'))[_0x9df3('0x37')](_0x9df3('0xb6'));}else{return _0x1bfa5f[_0x9df3('0x2a')](_0x455bfc)['json'](_0x2cd273);}}})[_0x9df3('0x28')](handleError(_0x1bfa5f,null));};exports['addApplications']=function(_0x168641,_0x3555c7){var _0xd9d1=_0x168641['params']['id'];var _0x41c818=_0x168641['body'];var _0x2cd533=0xc8;var _0x3f3f5a=null;return db[_0x9df3('0xb7')][_0x9df3('0xb8')]({'isolationLevel':db[_0x9df3('0xb7')][_0x9df3('0xb9')][_0x9df3('0xba')][_0x9df3('0xbb')]},function(_0x4bf797){return db[_0x9df3('0x55')][_0x9df3('0x69')]({'where':{'id':_0xd9d1},'transaction':_0x4bf797})[_0x9df3('0x1d')](function(_0x371b4d){if(_0x371b4d){return db[_0x9df3('0xbc')][_0x9df3('0x35')]({'where':{'SmsAccountId':_0xd9d1},'transaction':_0x4bf797})[_0x9df3('0x1d')](function(){var _0xd5552c=_['map'](_0x41c818,function(_0x134ffd){_0x134ffd['SmsAccountId']=_0xd9d1;return _0x134ffd;});return db[_0x9df3('0xbc')]['bulkCreate'](_0xd5552c,{'transaction':_0x4bf797});});}else{_0x2cd533=0x194;_0x3f3f5a=[];}});})[_0x9df3('0x1d')](function(){if(_0x2cd533!==0x194){return db['SmsApplication'][_0x9df3('0xbd')]({'where':{'SmsAccountId':_0xd9d1},'order':_0x9df3('0x76')})[_0x9df3('0x1d')](function(_0x59e2e7){_0x3f3f5a=_0x59e2e7;});}})[_0x9df3('0x28')](function(_0x2864fa){_0x2cd533=0x1f4;logger[_0x9df3('0x24')](_0x2864fa[_0x9df3('0xbe')]);if(_0x2864fa['name']){delete _0x2864fa['name'];}_0x3f3f5a=_0x2864fa;})[_0x9df3('0xbf')](function(){if(_0x3f3f5a===null){_0x3555c7[_0x9df3('0x29')](_0x2cd533);}else{if(_0x2cd533===0x1f4){_0x3555c7[_0x9df3('0x2a')](_0x2cd533)[_0x9df3('0x37')](_0x3f3f5a);}else{_0x3555c7['status'](_0x2cd533)[_0x9df3('0x2c')](_0x3f3f5a);}}});};exports[_0x9df3('0xc0')]=function(_0x3ca839,_0x28a801,_0xb3ff51){var _0x297cc8={};var _0x4207f7={};var _0x1166d0;var _0x3fd0c3;return db[_0x9df3('0x55')][_0x9df3('0x69')]({'where':{'id':_0x3ca839['params']['id']}})['then'](handleEntityNotFound(_0x28a801,null))['then'](function(_0x46e4ae){if(_0x46e4ae){_0x1166d0=_0x46e4ae;_0x4207f7['model']=_[_0x9df3('0x53')](db[_0x9df3('0xbc')][_0x9df3('0x3b')]);_0x4207f7[_0x9df3('0x43')]=_[_0x9df3('0x53')](_0x3ca839[_0x9df3('0x43')]);_0x4207f7[_0x9df3('0x41')]=_['intersection'](_0x4207f7[_0x9df3('0x45')],_0x4207f7['query']);_0x297cc8[_0x9df3('0x44')]=_[_0x9df3('0x42')](_0x4207f7[_0x9df3('0x45')],qs[_0x9df3('0x46')](_0x3ca839[_0x9df3('0x43')]['fields']));_0x297cc8['attributes']=_0x297cc8[_0x9df3('0x44')]['length']?_0x297cc8[_0x9df3('0x44')]:_0x4207f7[_0x9df3('0x45')];_0x297cc8[_0x9df3('0x49')]=qs[_0x9df3('0x4a')](_0x3ca839['query'][_0x9df3('0x4a')]);_0x297cc8[_0x9df3('0x4e')]=qs[_0x9df3('0x41')](_['pick'](_0x3ca839[_0x9df3('0x43')],_0x4207f7['filters']));if(_0x3ca839[_0x9df3('0x43')][_0x9df3('0x4c')]){_0x297cc8[_0x9df3('0x4e')]=_[_0x9df3('0x4d')](_0x297cc8[_0x9df3('0x4e')],{'$or':_[_0x9df3('0x3f')](_0x297cc8[_0x9df3('0x44')],function(_0xb55ec9){var _0x3a42a6={};_0x3a42a6[_0xb55ec9]={'$like':'%'+_0x3ca839[_0x9df3('0x43')]['filter']+'%'};return _0x3a42a6;})});}_0x297cc8=_['merge']({},_0x297cc8,_0x3ca839[_0x9df3('0x50')]);return _0x1166d0[_0x9df3('0xc0')](_0x297cc8);}})[_0x9df3('0x1d')](function(_0x7c62e5){if(_0x7c62e5){_0x3fd0c3=_0x7c62e5[_0x9df3('0x47')];if(!_0x3ca839[_0x9df3('0x43')][_0x9df3('0x6a')](_0x9df3('0x6b'))){_0x297cc8[_0x9df3('0x2e')]=qs[_0x9df3('0x2e')](_0x3ca839['query'][_0x9df3('0x2e')]);_0x297cc8[_0x9df3('0x48')]=qs[_0x9df3('0x48')](_0x3ca839[_0x9df3('0x43')][_0x9df3('0x48')]);}return _0x1166d0['getApplications'](_0x297cc8);}})[_0x9df3('0x1d')](function(_0x39632d){if(_0x39632d){return _0x39632d?{'count':_0x3fd0c3,'rows':_0x39632d}:null;}})[_0x9df3('0x1d')](respondWithResult(_0x28a801,null))[_0x9df3('0x28')](handleError(_0x28a801,null));};exports[_0x9df3('0xc1')]=function(_0x32ee87,_0x56434e,_0x400317){var _0x3b3c83={'raw':![],'where':{}};var _0x3b4b9e={};var _0x2344fd={'count':0x0,'rows':[]};return db[_0x9df3('0x55')][_0x9df3('0x69')]({'where':{'id':_0x32ee87[_0x9df3('0x63')]['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0x56434e,null))['then'](function(_0x3efeef){if(_0x3efeef){_0x3b4b9e[_0x9df3('0x45')]=_[_0x9df3('0x53')](db['SmsInteraction']['rawAttributes']);_0x3b4b9e[_0x9df3('0x43')]=_[_0x9df3('0x53')](_0x32ee87[_0x9df3('0x43')]);_0x3b4b9e[_0x9df3('0x41')]=_[_0x9df3('0x42')](_0x3b4b9e['model'],_0x3b4b9e['query']);_0x3b3c83[_0x9df3('0x44')]=_['intersection'](_0x3b4b9e['model'],qs[_0x9df3('0x46')](_0x32ee87[_0x9df3('0x43')]['fields']));_0x3b3c83[_0x9df3('0x44')]=_0x3b3c83[_0x9df3('0x44')][_0x9df3('0x47')]?_0x3b3c83[_0x9df3('0x44')]:_0x3b4b9e[_0x9df3('0x45')];if(!_0x32ee87['query'][_0x9df3('0x6a')](_0x9df3('0x6b'))){_0x3b3c83['limit']=qs[_0x9df3('0x2e')](_0x32ee87['query']['limit']);_0x3b3c83[_0x9df3('0x48')]=qs[_0x9df3('0x48')](_0x32ee87[_0x9df3('0x43')][_0x9df3('0x48')]);}_0x3b3c83[_0x9df3('0x49')]=qs['sort'](_0x32ee87[_0x9df3('0x43')][_0x9df3('0x4a')]);_0x3b3c83[_0x9df3('0x4e')]=qs[_0x9df3('0x41')](_[_0x9df3('0x4b')](_0x32ee87['query'],_0x3b4b9e['filters']));_0x3b3c83[_0x9df3('0x4e')][_0x9df3('0x66')]=_0x3efeef['id'];if(_0x32ee87[_0x9df3('0x43')]['filter']){_0x3b3c83['where']=_[_0x9df3('0x4d')](_0x3b3c83['where'],{'$or':_['map'](_0x3b3c83[_0x9df3('0x44')],function(_0x56963c){var _0x358735={};_0x358735[_0x56963c]={'$like':'%'+_0x32ee87[_0x9df3('0x43')][_0x9df3('0x4c')]+'%'};return _0x358735;})});}_0x3b3c83=_[_0x9df3('0x4d')]({},_0x3b3c83,_0x32ee87['options']);return db['SmsInteraction'][_0x9df3('0x2f')]({'where':_0x3b3c83[_0x9df3('0x4e')]})[_0x9df3('0x1d')](function(_0x1b9466){_0x2344fd[_0x9df3('0x2f')]=_0x1b9466;if(_0x32ee87[_0x9df3('0x43')][_0x9df3('0x51')]){_0x3b3c83[_0x9df3('0x54')]=[{'model':db[_0x9df3('0x77')],'as':_0x9df3('0xc2'),'required':![]},{'model':db[_0x9df3('0xaa')],'as':_0x9df3('0xc3'),'attributes':['name','fullname',_0x9df3('0xc4')],'required':![]},{'model':db[_0x9df3('0xc5')],'as':'Tags','attributes':['id','name',_0x9df3('0xc6')],'where':_0x32ee87[_0x9df3('0x43')]['tag']?{'id':_0x32ee87['query']['tag']}:undefined,'required':_0x32ee87[_0x9df3('0x43')][_0x9df3('0xc7')]?!![]:![]}];}return db[_0x9df3('0xa1')]['findAll'](_0x3b3c83);})['then'](function(_0x43551d){_0x2344fd[_0x9df3('0x52')]=_0x43551d;return _0x2344fd;});}})['then'](respondWithFilteredResult(_0x56434e,_0x3b3c83))[_0x9df3('0x28')](handleError(_0x56434e,null));};exports[_0x9df3('0x37')]=function(_0x22cd53,_0x47edc9,_0xd2ba42){var _0x36ce36,_0x353f5f,_0x41f9aa;if(_['isNil'](_0x22cd53[_0x9df3('0x62')][_0x9df3('0x62')])||_0x22cd53[_0x9df3('0x62')][_0x9df3('0x62')]===''){throw new db[(_0x9df3('0x99'))][(_0x9df3('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9df3('0x97')](_0x22cd53[_0x9df3('0x62')]['to'])){throw new db[(_0x9df3('0x99'))][(_0x9df3('0x78'))](_0x9df3('0xc8'));}_0x36ce36=_0x22cd53[_0x9df3('0x62')]['to'];return db[_0x9df3('0x55')][_0x9df3('0x56')]({'where':{'id':_0x22cd53['params']['id']},'include':[{'model':db[_0x9df3('0xc9')],'as':_0x9df3('0xca'),'include':[{'model':db[_0x9df3('0x77')],'as':'Contacts','where':{'mobile':_0x36ce36},'limit':0x1,'order':[[_0x9df3('0x7c'),_0x9df3('0x9e')]]}]}]})[_0x9df3('0x1d')](handleEntityNotFound(_0x47edc9,null))['then'](function(_0x533776){if(_0x533776&&_0x533776['List']){_0x353f5f=_0x533776[_0x9df3('0x5b')]({'plain':!![]});if(_0x353f5f['List']&&_0x353f5f[_0x9df3('0xca')]['Contacts']['length']){return _0x353f5f[_0x9df3('0xca')]['Contacts'][0x0];}return db[_0x9df3('0x77')][_0x9df3('0x57')](_[_0x9df3('0x17')](_0x22cd53[_0x9df3('0x62')],{'firstName':_0x36ce36,'mobile':_0x36ce36,'phone':_0x36ce36,'ListId':_0x353f5f[_0x9df3('0x7e')]}));}})[_0x9df3('0x1d')](handleEntityNotFound(_0x47edc9,null))[_0x9df3('0x1d')](function(_0xa5b60){if(_0xa5b60){_0x41f9aa=_0xa5b60;return db[_0x9df3('0xa1')][_0x9df3('0x56')]({'where':{'ContactId':_0x41f9aa['id'],'closed':![],'SmsAccountId':_0x353f5f['id']}})['then'](function(_0x21f64e){if(_0x21f64e){return[_0x21f64e,![]];}return db['SmsInteraction'][_0x9df3('0x57')]({'UserId':_0x22cd53[_0x9df3('0x58')]['id'],'ContactId':_0x41f9aa['id'],'SmsAccountId':_0x353f5f['id'],'phone':_0x36ce36,'firstMsgDirection':'out','Messages':[_[_0x9df3('0x4d')](_0x22cd53[_0x9df3('0x62')],{'read':![],'body':_0x22cd53[_0x9df3('0x62')][_0x9df3('0x62')],'phone':_0x36ce36,'SmsAccountId':_0x353f5f['id'],'UserId':_0x22cd53[_0x9df3('0x58')]['id'],'ContactId':_0x41f9aa['id']})]},{'include':[{'model':db[_0x9df3('0xcb')],'as':_0x9df3('0xcc')}]})['then'](function(_0xe871d7){return[_0xe871d7,!![]];});});}})[_0x9df3('0xa2')](function(_0x166e4a,_0x33c4ab){if(_0x33c4ab){return _0x166e4a;}return db[_0x9df3('0xcb')]['create'](_[_0x9df3('0x4d')](_0x22cd53[_0x9df3('0x62')],{'read':![],'body':_0x22cd53[_0x9df3('0x62')][_0x9df3('0x62')],'phone':_0x36ce36,'SmsAccountId':_0x353f5f['id'],'SmsInteractionId':_0x166e4a['id'],'UserId':_0x22cd53[_0x9df3('0x58')]['id'],'ContactId':_0x41f9aa['id']}))[_0x9df3('0x1d')](function(_0x5e8e67){_0x166e4a['dataValues']['Messages']=[];_0x166e4a[_0x9df3('0xcd')]['Messages'][_0x9df3('0xce')](_0x5e8e67['dataValues']);return _0x166e4a;});})[_0x9df3('0x1d')](respondWithResult(_0x47edc9,null))['catch'](handleError(_0x47edc9,null));};exports[_0x9df3('0x2a')]=function(_0x4ba265,_0x5ef30f,_0x4a5543){if(_0x4ba265[_0x9df3('0x62')]['id']){delete _0x4ba265['body']['id'];}var _0x2e6893,_0x8fb2fc,_0x220e18;return db['SmsAccount'][_0x9df3('0x56')]({'where':{'id':_0x4ba265[_0x9df3('0x63')]['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0x5ef30f,null))[_0x9df3('0x1d')](function(_0x29481f){if(_0x29481f){_0x220e18=_0x29481f;logger['debug'](_0x9df3('0x22'),_0x9df3('0x2a'),_0x9df3('0xcf'),_0x29481f['type'],util[_0x9df3('0xd0')](_0x4ba265['body'],{'showHidden':![],'depth':null}));switch(_0x29481f[_0x9df3('0x3d')]){case _0x9df3('0x84'):if(_0x4ba265[_0x9df3('0x62')][_0x9df3('0xd1')]&&_0x4ba265[_0x9df3('0x62')][_0x9df3('0x2a')]){_0x8fb2fc=_0x4ba265[_0x9df3('0x62')]['status'];return db['SmsMessage'][_0x9df3('0x56')]({'where':{'messageId':_0x4ba265['body'][_0x9df3('0xd1')]}});}break;case _0x9df3('0x88'):if(_0x4ba265[_0x9df3('0x62')][_0x9df3('0xd2')]&&_0x4ba265[_0x9df3('0x62')]['statusInt']){_0x8fb2fc=_0x4ba265[_0x9df3('0x62')][_0x9df3('0xd3')];return db[_0x9df3('0xcb')][_0x9df3('0x56')]({'where':{'messageId':_0x4ba265['body']['requestid']}});}break;case _0x9df3('0x89'):if(_0x4ba265[_0x9df3('0x62')][_0x9df3('0xd4')]&&_0x4ba265[_0x9df3('0x62')]['status_code']){_0x8fb2fc=_0x4ba265['body'][_0x9df3('0xd5')];return db[_0x9df3('0xcb')][_0x9df3('0x56')]({'where':{'messageId':_0x4ba265[_0x9df3('0x62')][_0x9df3('0xd4')]}});}break;case'infobip':var _0x40b5a6=_0x4ba265[_0x9df3('0x62')][_0x9df3('0x8d')][0x0];if(_0x40b5a6[_0x9df3('0x82')]&&_0x40b5a6['status']['groupName']===_0x9df3('0xd6')){_0x8fb2fc=_0x40b5a6[_0x9df3('0x2a')][_0x9df3('0xd7')];return db['SmsMessage'][_0x9df3('0x56')]({'where':{'messageId':_0x40b5a6[_0x9df3('0x82')]}});}break;case _0x9df3('0x91'):if(_0x4ba265['body'][_0x9df3('0x82')]&&_0x4ba265[_0x9df3('0x62')][_0x9df3('0x2a')]){_0x8fb2fc=_0x4ba265[_0x9df3('0x62')][_0x9df3('0x2a')];return db[_0x9df3('0xcb')][_0x9df3('0x56')]({'where':{'messageId':_0x4ba265[_0x9df3('0x62')][_0x9df3('0x82')]}});}break;case _0x9df3('0x94'):if(_0x4ba265['body'][0x0][_0x9df3('0x26')]['id']){_0x8fb2fc=_0x4ba265['body'][0x0][_0x9df3('0x3d')];return db['SmsMessage'][_0x9df3('0x56')]({'where':{'messageId':_0x4ba265['body'][0x0][_0x9df3('0x26')]['id']}});}break;case _0x9df3('0x95'):if(_0x4ba265['body']['redif']&&_0x4ba265['body'][_0x9df3('0x2a')]){_0x8fb2fc=_0x4ba265[_0x9df3('0x62')]['status'];return db[_0x9df3('0xcb')][_0x9df3('0x56')]({'where':{'messageId':_0x4ba265[_0x9df3('0x62')]['redif']}});}break;}}})[_0x9df3('0x1d')](handleEntityNotFound(_0x5ef30f,null))[_0x9df3('0x1d')](function(_0x140a75){if(_0x140a75){_0x2e6893=_0x140a75;switch(_0x220e18[_0x9df3('0x3d')]){case'skebby':if(_0x8fb2fc===_0x9df3('0xd6')){return _0x2e6893[_0x9df3('0x61')]({'read':!![]});}else{logger['error'](_0x9df3('0x22'),_0x9df3('0x2a'),_0x9df3('0x84'),util[_0x9df3('0xd0')](_0x4ba265[_0x9df3('0x62')],{'showHidden':![],'depth':null}));}break;case _0x9df3('0x88'):if(_0x8fb2fc==='1'){return _0x2e6893[_0x9df3('0x61')]({'read':!![]});}else{logger[_0x9df3('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9df3('0x84'),util[_0x9df3('0xd0')](_0x4ba265['body'],{'showHidden':![],'depth':null}));}break;case _0x9df3('0x89'):if(!_0x4ba265[_0x9df3('0x62')]['error_code']&&_0x8fb2fc>=0xc8&&_0x8fb2fc<=0xce){return _0x2e6893[_0x9df3('0x61')]({'read':!![]});}else{logger[_0x9df3('0x24')](_0x9df3('0x22'),_0x9df3('0x2a'),_0x9df3('0x89'),util['inspect'](_0x4ba265[_0x9df3('0x62')],{'showHidden':![],'depth':null}));}break;case _0x9df3('0x8c'):var _0xa012a6=_0x4ba265['body'][_0x9df3('0x8d')][0x0];if(_0xa012a6['status'][_0x9df3('0xd7')]==='DELIVERED'){return _0x2e6893[_0x9df3('0x61')]({'read':!![]});}else{logger[_0x9df3('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9df3('0x2a'),_0x9df3('0x8c'),util[_0x9df3('0xd0')](_0x4ba265[_0x9df3('0x62')],{'showHidden':![],'depth':null}));}break;case _0x9df3('0x91'):if(_0x8fb2fc==_0x9df3('0xd8')||_0x8fb2fc==_0x9df3('0xd9')){return _0x2e6893[_0x9df3('0x61')]({'read':!![]});}else{logger['error'](_0x9df3('0x22'),'status',_0x9df3('0x91'),util[_0x9df3('0xd0')](_0x4ba265[_0x9df3('0x62')],{'showHidden':![],'depth':null}));}break;case _0x9df3('0x94'):if(_0x8fb2fc==_0x9df3('0xda')){return _0x2e6893[_0x9df3('0x61')]({'read':!![]});}else{logger[_0x9df3('0x24')](_0x9df3('0x22'),_0x9df3('0x2a'),_0x9df3('0x94'),util[_0x9df3('0xd0')](_0x4ba265['body'],{'showHidden':![],'depth':null}));}break;case _0x9df3('0x95'):if(_0x8fb2fc===_0x9df3('0xdb')||_0x8fb2fc===_0x9df3('0xdc')){return _0x2e6893[_0x9df3('0x61')]({'read':!![]});}else{logger[_0x9df3('0x24')](_0x9df3('0x22'),_0x9df3('0x2a'),_0x9df3('0x95'),util[_0x9df3('0xd0')](_0x4ba265['body'],{'showHidden':![],'depth':null}));}break;}return _0x2e6893;}})[_0x9df3('0x1d')](respondWithResult(_0x5ef30f,null))[_0x9df3('0x28')](handleError(_0x5ef30f,null));};exports[_0x9df3('0xdd')]=function(_0x224b14,_0x4f5682,_0x57203c){var _0x2fddb7,_0x3d25d0,_0x576531;return db[_0x9df3('0x55')][_0x9df3('0x56')]({'where':{'id':_0x224b14[_0x9df3('0x63')]['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0x4f5682,null))[_0x9df3('0x1d')](function(_0x530957){if(_0x530957){_0x576531=_0x530957;logger['debug'](_0x9df3('0x22'),_0x9df3('0x2a'),_0x9df3('0xcf'),_0x530957[_0x9df3('0x3d')],util['inspect'](_0x224b14[_0x9df3('0x43')],{'showHidden':![],'depth':null}));switch(_0x530957[_0x9df3('0x3d')]){case _0x9df3('0x8e'):if(_0x224b14[_0x9df3('0x43')]['message-id']&&_0x224b14['query'][_0x9df3('0xde')]){_0x3d25d0=_0x224b14[_0x9df3('0x43')]['state'];return db[_0x9df3('0xcb')][_0x9df3('0x56')]({'where':{'messageId':_0x224b14[_0x9df3('0x43')][_0x9df3('0xdf')]}});}break;}}})['then'](handleEntityNotFound(_0x4f5682,null))[_0x9df3('0x1d')](function(_0x17efa8){if(_0x17efa8){_0x2fddb7=_0x17efa8;switch(_0x576531['type']){case _0x9df3('0x8e'):if(_0x3d25d0==='2'||_0x3d25d0==='6'){return _0x2fddb7['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9df3('0x2a'),_0x9df3('0x8e'),util['inspect'](_0x224b14[_0x9df3('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x2fddb7;}})[_0x9df3('0x1d')](respondWithResult(_0x4f5682,null))[_0x9df3('0x28')](handleError(_0x4f5682,null));};exports[_0x9df3('0xe0')]=function(_0x335ca4,_0x2e227d,_0x240266){return db[_0x9df3('0x55')]['find']({'where':{'id':_0x335ca4[_0x9df3('0x63')]['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0x2e227d,null))[_0x9df3('0x1d')](function(_0x4fc06f){if(_0x4fc06f){return _0x4fc06f['addAgents'](_0x335ca4[_0x9df3('0x62')]['ids'],_[_0x9df3('0xa0')](_0x335ca4[_0x9df3('0x62')],[_0x9df3('0xe1'),'id'])||{})[_0x9df3('0xa2')](function(_0x56bd1a){for(var _0x25c4c0=0x0;_0x25c4c0<_0x335ca4['body'][_0x9df3('0xe1')][_0x9df3('0x47')];_0x25c4c0+=0x1){socket['emit'](_0x9df3('0xe2'),{'UserId':Number(_0x335ca4[_0x9df3('0x62')][_0x9df3('0xe1')][_0x25c4c0]),'SmsAccountId':Number(_0x335ca4[_0x9df3('0x63')]['id'])});}return _0x56bd1a;});}})[_0x9df3('0x1d')](respondWithResult(_0x2e227d,null))[_0x9df3('0x28')](handleError(_0x2e227d,null));};exports['removeAgents']=function(_0x554e71,_0x20621e,_0x30f836){return db[_0x9df3('0x55')]['find']({'where':{'id':_0x554e71[_0x9df3('0x63')]['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0x20621e,null))[_0x9df3('0x1d')](function(_0x6b95b){if(_0x6b95b){return _0x6b95b[_0x9df3('0xe3')](_0x554e71[_0x9df3('0x43')]['ids'])[_0x9df3('0x1d')](function(){if(_[_0x9df3('0xe4')](_0x554e71[_0x9df3('0x43')]['ids'])){for(var _0x460594=0x0;_0x460594<_0x554e71[_0x9df3('0x43')][_0x9df3('0xe1')][_0x9df3('0x47')];_0x460594+=0x1){socket[_0x9df3('0xe5')](_0x9df3('0xe6'),{'UserId':Number(_0x554e71[_0x9df3('0x43')]['ids'][_0x460594]),'SmsAccountId':Number(_0x554e71['params']['id'])});}}else{socket[_0x9df3('0xe5')](_0x9df3('0xe6'),{'UserId':Number(_0x554e71[_0x9df3('0x43')]['ids']),'SmsAccountId':Number(_0x554e71[_0x9df3('0x63')]['id'])});}});}})[_0x9df3('0x1d')](respondWithStatusCode(_0x20621e,null))[_0x9df3('0x28')](handleError(_0x20621e,null));};exports[_0x9df3('0xe7')]=function(_0x332723,_0x109717,_0x2ee0fd){var _0x145a72={};var _0x300027={};var _0x13254e;var _0x2bef3b;return db['SmsAccount']['findOne']({'where':{'id':_0x332723[_0x9df3('0x63')]['id']}})[_0x9df3('0x1d')](handleEntityNotFound(_0x109717,null))[_0x9df3('0x1d')](function(_0x3e3f4e){if(_0x3e3f4e){_0x13254e=_0x3e3f4e;_0x300027[_0x9df3('0x45')]=_[_0x9df3('0x53')](db[_0x9df3('0xaa')][_0x9df3('0x3b')]);_0x300027[_0x9df3('0x43')]=_[_0x9df3('0x53')](_0x332723[_0x9df3('0x43')]);_0x300027[_0x9df3('0x41')]=_[_0x9df3('0x42')](_0x300027[_0x9df3('0x45')],_0x300027['query']);_0x145a72[_0x9df3('0x44')]=_[_0x9df3('0x42')](_0x300027[_0x9df3('0x45')],qs[_0x9df3('0x46')](_0x332723[_0x9df3('0x43')][_0x9df3('0x46')]));_0x145a72[_0x9df3('0x44')]=_0x145a72[_0x9df3('0x44')][_0x9df3('0x47')]?_0x145a72[_0x9df3('0x44')]:_0x300027['model'];_0x145a72[_0x9df3('0x49')]=qs[_0x9df3('0x4a')](_0x332723[_0x9df3('0x43')][_0x9df3('0x4a')]);_0x145a72['where']=qs[_0x9df3('0x41')](_[_0x9df3('0x4b')](_0x332723[_0x9df3('0x43')],_0x300027[_0x9df3('0x41')]));if(_0x332723[_0x9df3('0x43')][_0x9df3('0x4c')]){_0x145a72[_0x9df3('0x4e')]=_[_0x9df3('0x4d')](_0x145a72[_0x9df3('0x4e')],{'$or':_['map'](_0x145a72[_0x9df3('0x44')],function(_0x367e58){var _0x1d6238={};_0x1d6238[_0x367e58]={'$like':'%'+_0x332723[_0x9df3('0x43')]['filter']+'%'};return _0x1d6238;})});}_0x145a72=_[_0x9df3('0x4d')]({},_0x145a72,_0x332723['options']);return _0x13254e[_0x9df3('0xe7')](_0x145a72);}})[_0x9df3('0x1d')](function(_0x3e5f2b){if(_0x3e5f2b){_0x2bef3b=_0x3e5f2b[_0x9df3('0x47')];if(!_0x332723[_0x9df3('0x43')][_0x9df3('0x6a')]('nolimit')){_0x145a72['limit']=qs[_0x9df3('0x2e')](_0x332723['query'][_0x9df3('0x2e')]);_0x145a72[_0x9df3('0x48')]=qs[_0x9df3('0x48')](_0x332723['query'][_0x9df3('0x48')]);}return _0x13254e[_0x9df3('0xe7')](_0x145a72);}})[_0x9df3('0x1d')](function(_0x36578b){if(_0x36578b){return _0x36578b?{'count':_0x2bef3b,'rows':_0x36578b}:null;}})[_0x9df3('0x1d')](respondWithResult(_0x109717,null))['catch'](handleError(_0x109717,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3ad1675..ee3946c 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 _0xdcb5=['events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x1e2165,_0x481c36){var _0x4b08d3=function(_0x3baeaf){while(--_0x3baeaf){_0x1e2165['push'](_0x1e2165['shift']());}};_0x4b08d3(++_0x481c36);}(_0xdcb5,0x1dd));var _0x5dcb=function(_0xb518e0,_0x241866){_0xb518e0=_0xb518e0-0x0;var _0xf96fb8=_0xdcb5[_0xb518e0];return _0xf96fb8;};'use strict';var EventEmitter=require(_0x5dcb('0x0'));var SmsAccount=require(_0x5dcb('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5dcb('0x2')](0x0);var events={'afterCreate':_0x5dcb('0x3'),'afterUpdate':_0x5dcb('0x4'),'afterDestroy':_0x5dcb('0x5')};function emitEvent(_0x9066a6){return function(_0x5cc54a,_0x295c9d,_0x4b8c4f){SmsAccountEvents['emit'](_0x9066a6+':'+_0x5cc54a['id'],_0x5cc54a);SmsAccountEvents['emit'](_0x9066a6,_0x5cc54a);_0x4b8c4f(null);};}for(var e in events){if(events[_0x5dcb('0x6')](e)){var event=events[e];SmsAccount[_0x5dcb('0x7')](e,emitEvent(event));}}module[_0x5dcb('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x16ab=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x2415ab,_0x53b507){var _0x52a230=function(_0x1357c2){while(--_0x1357c2){_0x2415ab['push'](_0x2415ab['shift']());}};_0x52a230(++_0x53b507);}(_0x16ab,0x75));var _0xb16a=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x16ab[_0x2b9b7f];return _0x4ed19a;};'use strict';var EventEmitter=require(_0xb16a('0x0'));var SmsAccount=require(_0xb16a('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb16a('0x2'),'afterUpdate':_0xb16a('0x3'),'afterDestroy':_0xb16a('0x4')};function emitEvent(_0x10bc29){return function(_0x55e5ee,_0x28a6cb,_0x24f7c7){SmsAccountEvents['emit'](_0x10bc29+':'+_0x55e5ee['id'],_0x55e5ee);SmsAccountEvents[_0xb16a('0x5')](_0x10bc29,_0x55e5ee);_0x24f7c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xb16a('0x6')](e,emitEvent(event));}}module[_0xb16a('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 782eda4..2c1a508 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 _0xa5fd=['rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x179c97,_0x2b3b86){var _0x405e78=function(_0x494f5c){while(--_0x494f5c){_0x179c97['push'](_0x179c97['shift']());}};_0x405e78(++_0x2b3b86);}(_0xa5fd,0x186));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda5f('0x0'));var util=require('util');var logger=require(_0xda5f('0x1'))(_0xda5f('0x2'));var moment=require(_0xda5f('0x3'));var BPromise=require(_0xda5f('0x4'));var rp=require(_0xda5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda5f('0x6'));var config=require('../../config/environment');var attributes=require(_0xda5f('0x7'));module[_0xda5f('0x8')]=function(_0x5316a0,_0x4954fc){return _0x5316a0[_0xda5f('0x9')](_0xda5f('0xa'),attributes,{'tableName':_0xda5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e82=['bluebird','request-promise','path','../../config/environment','exports','define','sms_accounts','util','../../config/logger','moment'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x3e82,0xed));var _0x23e8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3e82[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x23e8('0x0'));var logger=require(_0x23e8('0x1'))('api');var moment=require(_0x23e8('0x2'));var BPromise=require(_0x23e8('0x3'));var rp=require(_0x23e8('0x4'));var fs=require('fs');var path=require(_0x23e8('0x5'));var rimraf=require('rimraf');var config=require(_0x23e8('0x6'));var attributes=require('./smsAccount.attributes');module[_0x23e8('0x7')]=function(_0x224ce8,_0x1dceb2){return _0x224ce8[_0x23e8('0x8')]('SmsAccount',attributes,{'tableName':_0x23e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index e81c73a..304721e 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 _0xe8d3=['find','options','raw','where','include','map','attributes','debug','stringify','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','code','message','ShowSmsAccount','SmsAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe8d3,0x92));var _0x3e8d=function(_0x25606c,_0x46c895){_0x25606c=_0x25606c-0x0;var _0x14b9b8=_0xe8d3[_0x25606c];return _0x14b9b8;};'use strict';var _=require(_0x3e8d('0x0'));var util=require('util');var moment=require(_0x3e8d('0x1'));var BPromise=require(_0x3e8d('0x2'));var rs=require(_0x3e8d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e8d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e8d('0x5'))(_0x3e8d('0x6'));var config=require(_0x3e8d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3e8d('0x8')][_0x3e8d('0x9')]({'port':0x232a});config[_0x3e8d('0xa')]=_[_0x3e8d('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3e8d('0xc'))(new Redis(config['redis']));require(_0x3e8d('0xd'))[_0x3e8d('0xe')](socket);function respondWithRpcPromise(_0x1797b1,_0xca26b1,_0x564cb1){return new BPromise(function(_0x1bc71b,_0x56124a){return client['request'](_0x1797b1,_0x564cb1)[_0x3e8d('0xf')](function(_0x5e6c30){logger[_0x3e8d('0x10')](_0x3e8d('0x11'),_0xca26b1,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xca26b1,_0x3e8d('0x12'),JSON['stringify'](_0x5e6c30));if(_0x5e6c30['error']){if(_0x5e6c30[_0x3e8d('0x13')][_0x3e8d('0x14')]===0x1f4){logger['error'](_0x3e8d('0x11'),_0xca26b1,_0x5e6c30[_0x3e8d('0x13')]['message']);return _0x56124a(_0x5e6c30[_0x3e8d('0x13')][_0x3e8d('0x15')]);}logger['error'](_0x3e8d('0x11'),_0xca26b1,_0x5e6c30['error'][_0x3e8d('0x15')]);return _0x1bc71b(_0x5e6c30[_0x3e8d('0x13')][_0x3e8d('0x15')]);}else{logger[_0x3e8d('0x10')](_0x3e8d('0x11'),_0xca26b1,_0x3e8d('0x12'));_0x1bc71b(_0x5e6c30['result'][_0x3e8d('0x15')]);}})['catch'](function(_0x48ad9e){logger[_0x3e8d('0x13')]('SmsAccount,\x20%s,\x20%s',_0xca26b1,_0x48ad9e);_0x56124a(_0x48ad9e);});});}exports[_0x3e8d('0x16')]=function(_0x10d10f){var _0x1533a1=this;return new Promise(function(_0x30d00e,_0x247958){return db[_0x3e8d('0x17')][_0x3e8d('0x18')]({'raw':_0x10d10f[_0x3e8d('0x19')]?_0x10d10f[_0x3e8d('0x19')][_0x3e8d('0x1a')]===undefined?!![]:![]:!![],'where':_0x10d10f[_0x3e8d('0x19')]?_0x10d10f[_0x3e8d('0x19')][_0x3e8d('0x1b')]||null:null,'attributes':_0x10d10f[_0x3e8d('0x19')]?_0x10d10f[_0x3e8d('0x19')]['attributes']||null:null,'include':_0x10d10f['options']?_0x10d10f['options'][_0x3e8d('0x1c')]?_[_0x3e8d('0x1d')](_0x10d10f[_0x3e8d('0x19')][_0x3e8d('0x1c')],function(_0x2eeaae){return{'model':db[_0x2eeaae['model']],'as':_0x2eeaae['as'],'attributes':_0x2eeaae[_0x3e8d('0x1e')],'include':_0x2eeaae[_0x3e8d('0x1c')]?_[_0x3e8d('0x1d')](_0x2eeaae[_0x3e8d('0x1c')],function(_0x2db1f1){return{'model':db[_0x2db1f1['model']],'as':_0x2db1f1['as'],'attributes':_0x2db1f1['attributes'],'include':_0x2db1f1[_0x3e8d('0x1c')]?_[_0x3e8d('0x1d')](_0x2db1f1[_0x3e8d('0x1c')],function(_0x4191df){return{'model':db[_0x4191df['model']],'as':_0x4191df['as'],'attributes':_0x4191df[_0x3e8d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d1d26){logger['info']('ShowSmsAccount',_0x10d10f);logger[_0x3e8d('0x1f')]('ShowSmsAccount',_0x10d10f,JSON[_0x3e8d('0x20')](_0x4d1d26));_0x30d00e(_0x4d1d26);})[_0x3e8d('0x21')](function(_0x4743e2){logger[_0x3e8d('0x13')](_0x3e8d('0x16'),_0x4743e2[_0x3e8d('0x15')],_0x10d10f);_0x247958(_0x1533a1[_0x3e8d('0x13')](0x1f4,_0x4743e2[_0x3e8d('0x15')]));});});}; \ No newline at end of file +var _0xee55=['ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','model','include','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5bdc92,_0x1caed3){var _0x4e2bd2=function(_0xb4ef3c){while(--_0xb4ef3c){_0x5bdc92['push'](_0x5bdc92['shift']());}};_0x4e2bd2(++_0x1caed3);}(_0xee55,0x13c));var _0x5ee5=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0xee55[_0x38b14f];return _0x22a324;};'use strict';var _=require(_0x5ee5('0x0'));var util=require(_0x5ee5('0x1'));var moment=require(_0x5ee5('0x2'));var BPromise=require(_0x5ee5('0x3'));var rs=require(_0x5ee5('0x4'));var fs=require('fs');var Redis=require(_0x5ee5('0x5'));var db=require(_0x5ee5('0x6'))['db'];var utils=require(_0x5ee5('0x7'));var logger=require(_0x5ee5('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5ee5('0x9')][_0x5ee5('0xa')]({'port':0x232a});config[_0x5ee5('0xb')]=_[_0x5ee5('0xc')](config[_0x5ee5('0xb')],{'host':_0x5ee5('0xd'),'port':0x18eb});var socket=require(_0x5ee5('0xe'))(new Redis(config[_0x5ee5('0xb')]));require(_0x5ee5('0xf'))['register'](socket);function respondWithRpcPromise(_0x6b4ae3,_0x482f07,_0x50b6c5){return new BPromise(function(_0xa00580,_0x26d0e5){return client['request'](_0x6b4ae3,_0x50b6c5)['then'](function(_0x15b8c7){logger['info']('SmsAccount,\x20%s,\x20%s',_0x482f07,_0x5ee5('0x10'));logger['debug'](_0x5ee5('0x11'),_0x482f07,'request\x20sent',JSON[_0x5ee5('0x12')](_0x15b8c7));if(_0x15b8c7[_0x5ee5('0x13')]){if(_0x15b8c7[_0x5ee5('0x13')][_0x5ee5('0x14')]===0x1f4){logger['error'](_0x5ee5('0x15'),_0x482f07,_0x15b8c7[_0x5ee5('0x13')]['message']);return _0x26d0e5(_0x15b8c7[_0x5ee5('0x13')][_0x5ee5('0x16')]);}logger[_0x5ee5('0x13')]('SmsAccount,\x20%s,\x20%s',_0x482f07,_0x15b8c7[_0x5ee5('0x13')][_0x5ee5('0x16')]);return _0xa00580(_0x15b8c7[_0x5ee5('0x13')][_0x5ee5('0x16')]);}else{logger[_0x5ee5('0x17')](_0x5ee5('0x15'),_0x482f07,_0x5ee5('0x10'));_0xa00580(_0x15b8c7[_0x5ee5('0x18')][_0x5ee5('0x16')]);}})[_0x5ee5('0x19')](function(_0x6330d2){logger[_0x5ee5('0x13')]('SmsAccount,\x20%s,\x20%s',_0x482f07,_0x6330d2);_0x26d0e5(_0x6330d2);});});}exports[_0x5ee5('0x1a')]=function(_0x228eea){var _0x381172=this;return new Promise(function(_0xa76505,_0x4cb832){return db[_0x5ee5('0x1b')][_0x5ee5('0x1c')]({'raw':_0x228eea[_0x5ee5('0x1d')]?_0x228eea[_0x5ee5('0x1d')][_0x5ee5('0x1e')]===undefined?!![]:![]:!![],'where':_0x228eea[_0x5ee5('0x1d')]?_0x228eea[_0x5ee5('0x1d')][_0x5ee5('0x1f')]||null:null,'attributes':_0x228eea[_0x5ee5('0x1d')]?_0x228eea[_0x5ee5('0x1d')][_0x5ee5('0x20')]||null:null,'include':_0x228eea[_0x5ee5('0x1d')]?_0x228eea['options']['include']?_[_0x5ee5('0x21')](_0x228eea[_0x5ee5('0x1d')]['include'],function(_0x256fa4){return{'model':db[_0x256fa4[_0x5ee5('0x22')]],'as':_0x256fa4['as'],'attributes':_0x256fa4[_0x5ee5('0x20')],'include':_0x256fa4[_0x5ee5('0x23')]?_[_0x5ee5('0x21')](_0x256fa4[_0x5ee5('0x23')],function(_0x350013){return{'model':db[_0x350013[_0x5ee5('0x22')]],'as':_0x350013['as'],'attributes':_0x350013[_0x5ee5('0x20')],'include':_0x350013[_0x5ee5('0x23')]?_[_0x5ee5('0x21')](_0x350013[_0x5ee5('0x23')],function(_0x4761e8){return{'model':db[_0x4761e8[_0x5ee5('0x22')]],'as':_0x4761e8['as'],'attributes':_0x4761e8[_0x5ee5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5ee5('0x24')](function(_0x4b2fdb){logger[_0x5ee5('0x17')](_0x5ee5('0x1a'),_0x228eea);logger[_0x5ee5('0x25')]('ShowSmsAccount',_0x228eea,JSON[_0x5ee5('0x12')](_0x4b2fdb));_0xa76505(_0x4b2fdb);})[_0x5ee5('0x19')](function(_0x4b6ddc){logger[_0x5ee5('0x13')](_0x5ee5('0x1a'),_0x4b6ddc[_0x5ee5('0x16')],_0x228eea);_0x4cb832(_0x381172[_0x5ee5('0x13')](0x1f4,_0x4b6ddc['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0f0044f..f8862ce 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 6ed7495..7d95694 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x572bea,_0x22f551){var _0x1bff8d=function(_0x16d3f3){while(--_0x16d3f3){_0x572bea['push'](_0x572bea['shift']());}};_0x1bff8d(++_0x22f551);}(_0x55ca,0x126));var _0xa55c=function(_0x13a102,_0x7f6c67){_0x13a102=_0x13a102-0x0;var _0x3a37d2=_0x55ca[_0x13a102];return _0x3a37d2;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x154f1d,_0x4c19cd){var _0x250c93=function(_0x37712c){while(--_0x37712c){_0x154f1d['push'](_0x154f1d['shift']());}};_0x250c93(++_0x4c19cd);}(_0x34e8,0x12c));var _0x834e=function(_0x2dab70,_0xe2d8a0){_0x2dab70=_0x2dab70-0x0;var _0xecc48a=_0x34e8[_0x2dab70];return _0xecc48a;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index edec792..ed33548 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 _0x064a=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3f7a0d,_0x29e65b){var _0x2f9129=function(_0x291172){while(--_0x291172){_0x3f7a0d['push'](_0x3f7a0d['shift']());}};_0x2f9129(++_0x29e65b);}(_0x064a,0xff));var _0xa064=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x064a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa064('0x0'));module[_0xa064('0x1')]={'priority':{'type':Sequelize[_0xa064('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa064('0x3')],'allowNull':![],'defaultValue':_0xa064('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa064('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa064('0x5')}}; \ No newline at end of file +var _0xc8df=['exports','INTEGER','STRING','noop','TEXT'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0xc8df,0x14f));var _0xfc8d=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xc8df[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require('sequelize');module[_0xfc8d('0x0')]={'priority':{'type':Sequelize[_0xfc8d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfc8d('0x2')],'allowNull':![],'defaultValue':_0xfc8d('0x3')},'appdata':{'type':Sequelize[_0xfc8d('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfc8d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a10f786..eef0b97 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 _0x5599=['sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','json','apply','reject','save','destroy','then','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x5599,0x1c0));var _0x9559=function(_0xaf7e20,_0x45ca1c){_0xaf7e20=_0xaf7e20-0x0;var _0x507439=_0x5599[_0xaf7e20];return _0x507439;};'use strict';var emlformat=require(_0x9559('0x0'));var rimraf=require(_0x9559('0x1'));var zipdir=require(_0x9559('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9559('0x3'));var BPromise=require(_0x9559('0x4'));var Mustache=require(_0x9559('0x5'));var util=require(_0x9559('0x6'));var path=require(_0x9559('0x7'));var sox=require(_0x9559('0x8'));var csv=require('to-csv');var ejs=require(_0x9559('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9559('0xa'));var squel=require(_0x9559('0xb'));var crypto=require(_0x9559('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9559('0xd'));var toCsv=require(_0x9559('0xe'));var querystring=require(_0x9559('0xf'));var Papa=require(_0x9559('0x10'));var Redis=require(_0x9559('0x11'));var authService=require(_0x9559('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9559('0x13'))(_0x9559('0x14'));var utils=require(_0x9559('0x15'));var config=require(_0x9559('0x16'));var licenseUtil=require(_0x9559('0x17'));var db=require(_0x9559('0x18'))['db'];function respondWithStatusCode(_0x1fd7d9,_0x181576){_0x181576=_0x181576||0xcc;return function(_0x1d5a6a){if(_0x1d5a6a){return _0x1fd7d9[_0x9559('0x19')](_0x181576);}return _0x1fd7d9[_0x9559('0x1a')](_0x181576)[_0x9559('0x1b')]();};}function respondWithResult(_0x11d58f,_0x14bfb2){_0x14bfb2=_0x14bfb2||0xc8;return function(_0x51b5df){if(_0x51b5df){return _0x11d58f[_0x9559('0x1a')](_0x14bfb2)['json'](_0x51b5df);}};}function respondWithFilteredResult(_0x5d4d6e,_0x323510){return function(_0x1d4eb9){if(_0x1d4eb9){var _0x32911f=typeof _0x323510[_0x9559('0x1c')]==='undefined'&&typeof _0x323510['limit']==='undefined';var _0x5e711a=_0x1d4eb9[_0x9559('0x1d')];var _0x45c333=_0x32911f?0x0:_0x323510[_0x9559('0x1c')];var _0x5256ec=_0x32911f?_0x1d4eb9['count']:_0x323510[_0x9559('0x1c')]+_0x323510[_0x9559('0x1e')];var _0x5974c1;if(_0x5256ec>=_0x5e711a){_0x5256ec=_0x5e711a;_0x5974c1=0xc8;}else{_0x5974c1=0xce;}_0x5d4d6e[_0x9559('0x1a')](_0x5974c1);return _0x5d4d6e[_0x9559('0x1f')]('Content-Range',_0x45c333+'-'+_0x5256ec+'/'+_0x5e711a)[_0x9559('0x20')](_0x1d4eb9);}return null;};}function patchUpdates(_0x1a7dcf){return function(_0x2486bb){try{jsonpatch[_0x9559('0x21')](_0x2486bb,_0x1a7dcf,!![]);}catch(_0x1cf54d){return BPromise[_0x9559('0x22')](_0x1cf54d);}return _0x2486bb[_0x9559('0x23')]();};}function saveUpdates(_0xc45084,_0x5c3e05){return function(_0x5b0ccb){if(_0x5b0ccb){return _0x5b0ccb['update'](_0xc45084)['then'](function(_0x186217){return _0x186217;});}return null;};}function removeEntity(_0x26d233,_0xb8b188){return function(_0x4b4020){if(_0x4b4020){return _0x4b4020[_0x9559('0x24')]()[_0x9559('0x25')](function(){_0x26d233['status'](0xcc)[_0x9559('0x1b')]();});}};}function handleEntityNotFound(_0x3ecb3e,_0x12845b){return function(_0x21d49c){if(!_0x21d49c){_0x3ecb3e[_0x9559('0x19')](0x194);}return _0x21d49c;};}function handleError(_0x1d8dcc,_0x39a65a){_0x39a65a=_0x39a65a||0x1f4;return function(_0x45201b){logger[_0x9559('0x26')](_0x45201b[_0x9559('0x27')]);if(_0x45201b[_0x9559('0x28')]){delete _0x45201b[_0x9559('0x28')];}_0x1d8dcc[_0x9559('0x1a')](_0x39a65a)['send'](_0x45201b);};}exports[_0x9559('0x29')]=function(_0x1ace12,_0x1f1ff0){var _0x1eab04={},_0x1a068d={},_0xe4e0b7={'count':0x0,'rows':[]};var _0x3629a7=_[_0x9559('0x2a')](db[_0x9559('0x2b')][_0x9559('0x2c')],function(_0x57ab8c){return{'name':_0x57ab8c[_0x9559('0x2d')],'type':_0x57ab8c[_0x9559('0x2e')][_0x9559('0x2f')]};});_0x1a068d[_0x9559('0x30')]=_['map'](_0x3629a7,_0x9559('0x28'));_0x1a068d[_0x9559('0x31')]=_[_0x9559('0x32')](_0x1ace12[_0x9559('0x31')]);_0x1a068d[_0x9559('0x33')]=_['intersection'](_0x1a068d['model'],_0x1a068d[_0x9559('0x31')]);_0x1eab04['attributes']=_[_0x9559('0x34')](_0x1a068d['model'],qs[_0x9559('0x35')](_0x1ace12[_0x9559('0x31')][_0x9559('0x35')]));_0x1eab04['attributes']=_0x1eab04[_0x9559('0x36')][_0x9559('0x37')]?_0x1eab04[_0x9559('0x36')]:_0x1a068d[_0x9559('0x30')];if(!_0x1ace12[_0x9559('0x31')][_0x9559('0x38')]('nolimit')){_0x1eab04[_0x9559('0x1e')]=qs[_0x9559('0x1e')](_0x1ace12['query'][_0x9559('0x1e')]);_0x1eab04[_0x9559('0x1c')]=qs[_0x9559('0x1c')](_0x1ace12['query'][_0x9559('0x1c')]);}_0x1eab04[_0x9559('0x39')]=qs[_0x9559('0x3a')](_0x1ace12[_0x9559('0x31')]['sort']);_0x1eab04[_0x9559('0x3b')]=qs['filters'](_[_0x9559('0x3c')](_0x1ace12['query'],_0x1a068d[_0x9559('0x33')]),_0x3629a7);if(_0x1ace12[_0x9559('0x31')]['filter']){_0x1eab04['where']=_[_0x9559('0x3d')](_0x1eab04[_0x9559('0x3b')],{'$or':_['map'](_0x3629a7,function(_0x180129){if(_0x180129[_0x9559('0x2e')]!==_0x9559('0x3e')){var _0xad7fac={};_0xad7fac[_0x180129[_0x9559('0x28')]]={'$like':'%'+_0x1ace12['query'][_0x9559('0x3f')]+'%'};return _0xad7fac;}})});}_0x1eab04=_[_0x9559('0x3d')]({},_0x1eab04,_0x1ace12[_0x9559('0x40')]);var _0x36cf2c={'where':_0x1eab04[_0x9559('0x3b')]};return db['SmsApplication'][_0x9559('0x1d')](_0x36cf2c)[_0x9559('0x25')](function(_0x174b4e){_0xe4e0b7[_0x9559('0x1d')]=_0x174b4e;if(_0x1ace12[_0x9559('0x31')]['includeAll']){_0x1eab04[_0x9559('0x41')]=[{'all':!![]}];}return db[_0x9559('0x2b')][_0x9559('0x42')](_0x1eab04);})[_0x9559('0x25')](function(_0x5a1aac){_0xe4e0b7[_0x9559('0x43')]=_0x5a1aac;return _0xe4e0b7;})[_0x9559('0x25')](respondWithFilteredResult(_0x1f1ff0,_0x1eab04))[_0x9559('0x44')](handleError(_0x1f1ff0,null));};exports[_0x9559('0x45')]=function(_0x381962,_0x4cccf1){var _0x3987a9={'raw':!![],'where':{'id':_0x381962[_0x9559('0x46')]['id']}},_0x18fad9={};_0x18fad9[_0x9559('0x30')]=_[_0x9559('0x32')](db[_0x9559('0x2b')][_0x9559('0x2c')]);_0x18fad9[_0x9559('0x31')]=_[_0x9559('0x32')](_0x381962['query']);_0x18fad9[_0x9559('0x33')]=_[_0x9559('0x34')](_0x18fad9[_0x9559('0x30')],_0x18fad9[_0x9559('0x31')]);_0x3987a9[_0x9559('0x36')]=_[_0x9559('0x34')](_0x18fad9['model'],qs[_0x9559('0x35')](_0x381962[_0x9559('0x31')][_0x9559('0x35')]));_0x3987a9[_0x9559('0x36')]=_0x3987a9[_0x9559('0x36')][_0x9559('0x37')]?_0x3987a9[_0x9559('0x36')]:_0x18fad9[_0x9559('0x30')];if(_0x381962[_0x9559('0x31')][_0x9559('0x47')]){_0x3987a9[_0x9559('0x41')]=[{'all':!![]}];}_0x3987a9=_[_0x9559('0x3d')]({},_0x3987a9,_0x381962[_0x9559('0x40')]);return db['SmsApplication'][_0x9559('0x48')](_0x3987a9)[_0x9559('0x25')](handleEntityNotFound(_0x4cccf1,null))[_0x9559('0x25')](respondWithResult(_0x4cccf1,null))['catch'](handleError(_0x4cccf1,null));};exports['create']=function(_0x123d77,_0x50db6c){return db[_0x9559('0x2b')][_0x9559('0x49')](_0x123d77['body'],{})[_0x9559('0x25')](respondWithResult(_0x50db6c,0xc9))[_0x9559('0x44')](handleError(_0x50db6c,null));};exports[_0x9559('0x4a')]=function(_0x518d97,_0x551c5e){if(_0x518d97[_0x9559('0x4b')]['id']){delete _0x518d97[_0x9559('0x4b')]['id'];}return db[_0x9559('0x2b')]['find']({'where':{'id':_0x518d97[_0x9559('0x46')]['id']}})[_0x9559('0x25')](handleEntityNotFound(_0x551c5e,null))[_0x9559('0x25')](saveUpdates(_0x518d97[_0x9559('0x4b')],null))['then'](respondWithResult(_0x551c5e,null))[_0x9559('0x44')](handleError(_0x551c5e,null));};exports[_0x9559('0x24')]=function(_0x2c4f0a,_0x254875){return db['SmsApplication']['find']({'where':{'id':_0x2c4f0a[_0x9559('0x46')]['id']}})[_0x9559('0x25')](handleEntityNotFound(_0x254875,null))['then'](removeEntity(_0x254875,null))[_0x9559('0x44')](handleError(_0x254875,null));}; \ No newline at end of file +var _0xbf54=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf54,0xf7));var _0x4bf5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbf54[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x4bf5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4bf5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4bf5('0x2'));var BPromise=require(_0x4bf5('0x3'));var Mustache=require(_0x4bf5('0x4'));var util=require(_0x4bf5('0x5'));var path=require(_0x4bf5('0x6'));var sox=require(_0x4bf5('0x7'));var csv=require(_0x4bf5('0x8'));var ejs=require(_0x4bf5('0x9'));var fs=require('fs');var fs_extra=require(_0x4bf5('0xa'));var _=require(_0x4bf5('0xb'));var squel=require(_0x4bf5('0xc'));var crypto=require(_0x4bf5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4bf5('0x8'));var querystring=require('querystring');var Papa=require(_0x4bf5('0xe'));var Redis=require(_0x4bf5('0xf'));var authService=require(_0x4bf5('0x10'));var qs=require(_0x4bf5('0x11'));var as=require(_0x4bf5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bf5('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4bf5('0x14'));var db=require(_0x4bf5('0x15'))['db'];function respondWithStatusCode(_0xce19a9,_0xb7ff3d){_0xb7ff3d=_0xb7ff3d||0xcc;return function(_0x4cb465){if(_0x4cb465){return _0xce19a9[_0x4bf5('0x16')](_0xb7ff3d);}return _0xce19a9['status'](_0xb7ff3d)[_0x4bf5('0x17')]();};}function respondWithResult(_0x2f53ba,_0x41d8cb){_0x41d8cb=_0x41d8cb||0xc8;return function(_0x16b0ba){if(_0x16b0ba){return _0x2f53ba['status'](_0x41d8cb)[_0x4bf5('0x18')](_0x16b0ba);}};}function respondWithFilteredResult(_0x36ca19,_0x176637){return function(_0x2b57ae){if(_0x2b57ae){var _0x51f033=typeof _0x176637[_0x4bf5('0x19')]===_0x4bf5('0x1a')&&typeof _0x176637[_0x4bf5('0x1b')]===_0x4bf5('0x1a');var _0x494a06=_0x2b57ae[_0x4bf5('0x1c')];var _0x322b9b=_0x51f033?0x0:_0x176637['offset'];var _0x38678a=_0x51f033?_0x2b57ae['count']:_0x176637['offset']+_0x176637['limit'];var _0x408457;if(_0x38678a>=_0x494a06){_0x38678a=_0x494a06;_0x408457=0xc8;}else{_0x408457=0xce;}_0x36ca19[_0x4bf5('0x1d')](_0x408457);return _0x36ca19[_0x4bf5('0x1e')]('Content-Range',_0x322b9b+'-'+_0x38678a+'/'+_0x494a06)['json'](_0x2b57ae);}return null;};}function patchUpdates(_0x5e1947){return function(_0x887f09){try{jsonpatch[_0x4bf5('0x1f')](_0x887f09,_0x5e1947,!![]);}catch(_0x4a89a4){return BPromise[_0x4bf5('0x20')](_0x4a89a4);}return _0x887f09[_0x4bf5('0x21')]();};}function saveUpdates(_0x5c44a8,_0x36d9d7){return function(_0x37a171){if(_0x37a171){return _0x37a171[_0x4bf5('0x22')](_0x5c44a8)[_0x4bf5('0x23')](function(_0x54b74e){return _0x54b74e;});}return null;};}function removeEntity(_0x37fd8d,_0x2218ec){return function(_0x5a12c6){if(_0x5a12c6){return _0x5a12c6[_0x4bf5('0x24')]()['then'](function(){_0x37fd8d[_0x4bf5('0x1d')](0xcc)[_0x4bf5('0x17')]();});}};}function handleEntityNotFound(_0x3cec34,_0x392241){return function(_0x444d85){if(!_0x444d85){_0x3cec34[_0x4bf5('0x16')](0x194);}return _0x444d85;};}function handleError(_0x36ebc5,_0x1ced70){_0x1ced70=_0x1ced70||0x1f4;return function(_0x30d2c7){logger['error'](_0x30d2c7[_0x4bf5('0x25')]);if(_0x30d2c7[_0x4bf5('0x26')]){delete _0x30d2c7[_0x4bf5('0x26')];}_0x36ebc5[_0x4bf5('0x1d')](_0x1ced70)[_0x4bf5('0x27')](_0x30d2c7);};}exports[_0x4bf5('0x28')]=function(_0x29c4c8,_0x29b48a){var _0x44858d={},_0x1a6c3d={},_0x45142f={'count':0x0,'rows':[]};var _0x5c777b=_[_0x4bf5('0x29')](db[_0x4bf5('0x2a')][_0x4bf5('0x2b')],function(_0x113aab){return{'name':_0x113aab[_0x4bf5('0x2c')],'type':_0x113aab[_0x4bf5('0x2d')][_0x4bf5('0x2e')]};});_0x1a6c3d['model']=_[_0x4bf5('0x29')](_0x5c777b,_0x4bf5('0x26'));_0x1a6c3d[_0x4bf5('0x2f')]=_['keys'](_0x29c4c8[_0x4bf5('0x2f')]);_0x1a6c3d[_0x4bf5('0x30')]=_[_0x4bf5('0x31')](_0x1a6c3d[_0x4bf5('0x32')],_0x1a6c3d[_0x4bf5('0x2f')]);_0x44858d['attributes']=_[_0x4bf5('0x31')](_0x1a6c3d['model'],qs['fields'](_0x29c4c8[_0x4bf5('0x2f')][_0x4bf5('0x33')]));_0x44858d[_0x4bf5('0x34')]=_0x44858d[_0x4bf5('0x34')][_0x4bf5('0x35')]?_0x44858d[_0x4bf5('0x34')]:_0x1a6c3d['model'];if(!_0x29c4c8[_0x4bf5('0x2f')][_0x4bf5('0x36')](_0x4bf5('0x37'))){_0x44858d[_0x4bf5('0x1b')]=qs[_0x4bf5('0x1b')](_0x29c4c8['query'][_0x4bf5('0x1b')]);_0x44858d[_0x4bf5('0x19')]=qs[_0x4bf5('0x19')](_0x29c4c8['query'][_0x4bf5('0x19')]);}_0x44858d[_0x4bf5('0x38')]=qs[_0x4bf5('0x39')](_0x29c4c8['query'][_0x4bf5('0x39')]);_0x44858d[_0x4bf5('0x3a')]=qs['filters'](_[_0x4bf5('0x3b')](_0x29c4c8[_0x4bf5('0x2f')],_0x1a6c3d['filters']),_0x5c777b);if(_0x29c4c8['query']['filter']){_0x44858d['where']=_[_0x4bf5('0x3c')](_0x44858d['where'],{'$or':_[_0x4bf5('0x29')](_0x5c777b,function(_0x478102){if(_0x478102['type']!==_0x4bf5('0x3d')){var _0xe14210={};_0xe14210[_0x478102[_0x4bf5('0x26')]]={'$like':'%'+_0x29c4c8[_0x4bf5('0x2f')][_0x4bf5('0x3e')]+'%'};return _0xe14210;}})});}_0x44858d=_['merge']({},_0x44858d,_0x29c4c8[_0x4bf5('0x3f')]);var _0x2a8fd2={'where':_0x44858d['where']};return db[_0x4bf5('0x2a')][_0x4bf5('0x1c')](_0x2a8fd2)[_0x4bf5('0x23')](function(_0x11dfd5){_0x45142f[_0x4bf5('0x1c')]=_0x11dfd5;if(_0x29c4c8[_0x4bf5('0x2f')][_0x4bf5('0x40')]){_0x44858d[_0x4bf5('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0x4bf5('0x42')](_0x44858d);})[_0x4bf5('0x23')](function(_0x35e142){_0x45142f[_0x4bf5('0x43')]=_0x35e142;return _0x45142f;})[_0x4bf5('0x23')](respondWithFilteredResult(_0x29b48a,_0x44858d))[_0x4bf5('0x44')](handleError(_0x29b48a,null));};exports[_0x4bf5('0x45')]=function(_0x187071,_0x14e7c8){var _0xab5439={'raw':!![],'where':{'id':_0x187071[_0x4bf5('0x46')]['id']}},_0xddc347={};_0xddc347['model']=_[_0x4bf5('0x47')](db['SmsApplication'][_0x4bf5('0x2b')]);_0xddc347[_0x4bf5('0x2f')]=_[_0x4bf5('0x47')](_0x187071[_0x4bf5('0x2f')]);_0xddc347[_0x4bf5('0x30')]=_[_0x4bf5('0x31')](_0xddc347[_0x4bf5('0x32')],_0xddc347[_0x4bf5('0x2f')]);_0xab5439['attributes']=_['intersection'](_0xddc347['model'],qs[_0x4bf5('0x33')](_0x187071[_0x4bf5('0x2f')][_0x4bf5('0x33')]));_0xab5439[_0x4bf5('0x34')]=_0xab5439[_0x4bf5('0x34')][_0x4bf5('0x35')]?_0xab5439[_0x4bf5('0x34')]:_0xddc347[_0x4bf5('0x32')];if(_0x187071[_0x4bf5('0x2f')]['includeAll']){_0xab5439['include']=[{'all':!![]}];}_0xab5439=_[_0x4bf5('0x3c')]({},_0xab5439,_0x187071[_0x4bf5('0x3f')]);return db[_0x4bf5('0x2a')][_0x4bf5('0x48')](_0xab5439)[_0x4bf5('0x23')](handleEntityNotFound(_0x14e7c8,null))['then'](respondWithResult(_0x14e7c8,null))['catch'](handleError(_0x14e7c8,null));};exports['create']=function(_0x2fc20f,_0x3f4900){return db['SmsApplication']['create'](_0x2fc20f[_0x4bf5('0x49')],{})[_0x4bf5('0x23')](respondWithResult(_0x3f4900,0xc9))[_0x4bf5('0x44')](handleError(_0x3f4900,null));};exports[_0x4bf5('0x22')]=function(_0x1bd796,_0x3f1655){if(_0x1bd796[_0x4bf5('0x49')]['id']){delete _0x1bd796['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x1bd796[_0x4bf5('0x46')]['id']}})[_0x4bf5('0x23')](handleEntityNotFound(_0x3f1655,null))['then'](saveUpdates(_0x1bd796[_0x4bf5('0x49')],null))['then'](respondWithResult(_0x3f1655,null))[_0x4bf5('0x44')](handleError(_0x3f1655,null));};exports['destroy']=function(_0x49e504,_0x7852f1){return db[_0x4bf5('0x2a')][_0x4bf5('0x48')]({'where':{'id':_0x49e504['params']['id']}})[_0x4bf5('0x23')](handleEntityNotFound(_0x7852f1,null))[_0x4bf5('0x23')](removeEntity(_0x7852f1,null))[_0x4bf5('0x44')](handleError(_0x7852f1,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0a6124b..6bb6546 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 _0x1bba=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define'];(function(_0x254dd6,_0x6040da){var _0x5a7eca=function(_0x2266ae){while(--_0x2266ae){_0x254dd6['push'](_0x254dd6['shift']());}};_0x5a7eca(++_0x6040da);}(_0x1bba,0xe4));var _0xa1bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa1bb('0x0'));var logger=require(_0xa1bb('0x1'))('api');var moment=require(_0xa1bb('0x2'));var BPromise=require(_0xa1bb('0x3'));var rp=require(_0xa1bb('0x4'));var fs=require('fs');var path=require(_0xa1bb('0x5'));var rimraf=require('rimraf');var config=require(_0xa1bb('0x6'));var attributes=require(_0xa1bb('0x7'));module[_0xa1bb('0x8')]=function(_0x27c2b3,_0xe2f624){return _0x27c2b3[_0xa1bb('0x9')](_0xa1bb('0xa'),attributes,{'tableName':_0xa1bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1bb('0xc'),'collate':_0xa1bb('0xd')});}; \ No newline at end of file +var _0x21a5=['define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4b1e1f,_0x3b4477){var _0x41a007=function(_0x4c7686){while(--_0x4c7686){_0x4b1e1f['push'](_0x4b1e1f['shift']());}};_0x41a007(++_0x3b4477);}(_0x21a5,0x12b));var _0x521a=function(_0xc36d01,_0x3bf1a6){_0xc36d01=_0xc36d01-0x0;var _0xecb231=_0x21a5[_0xc36d01];return _0xecb231;};'use strict';var _=require('lodash');var util=require(_0x521a('0x0'));var logger=require(_0x521a('0x1'))('api');var moment=require(_0x521a('0x2'));var BPromise=require(_0x521a('0x3'));var rp=require(_0x521a('0x4'));var fs=require('fs');var path=require(_0x521a('0x5'));var rimraf=require(_0x521a('0x6'));var config=require(_0x521a('0x7'));var attributes=require('./smsApplication.attributes');module[_0x521a('0x8')]=function(_0x4eec9a,_0x3d2c68){return _0x4eec9a[_0x521a('0x9')](_0x521a('0xa'),attributes,{'tableName':_0x521a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x521a('0xc'),'collate':_0x521a('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index f19c6b9..c827d41 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 _0xa5dd=['request','then','request\x20sent','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x32e167,_0x2159bf){var _0x1b5c16=function(_0x1bd7f2){while(--_0x1bd7f2){_0x32e167['push'](_0x32e167['shift']());}};_0x1b5c16(++_0x2159bf);}(_0xa5dd,0x101));var _0xda5d=function(_0x45246b,_0x8b0e7b){_0x45246b=_0x45246b-0x0;var _0x38d1d5=_0xa5dd[_0x45246b];return _0x38d1d5;};'use strict';var _=require(_0xda5d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda5d('0x1'));var rs=require(_0xda5d('0x2'));var fs=require('fs');var Redis=require(_0xda5d('0x3'));var db=require(_0xda5d('0x4'))['db'];var utils=require(_0xda5d('0x5'));var logger=require('../../config/logger')(_0xda5d('0x6'));var config=require(_0xda5d('0x7'));var jayson=require(_0xda5d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x461283,_0x91cf4e,_0x432097){return new BPromise(function(_0x402aa8,_0x1c1e2d){return client[_0xda5d('0x9')](_0x461283,_0x432097)[_0xda5d('0xa')](function(_0x3d5c69){logger['info']('SmsApplication,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'),JSON[_0xda5d('0xc')](_0x3d5c69));if(_0x3d5c69['error']){if(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xe')]===0x1f4){logger[_0xda5d('0xd')]('SmsApplication,\x20%s,\x20%s',_0x91cf4e,_0x3d5c69['error'][_0xda5d('0xf')]);return _0x1c1e2d(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);}logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);return _0x402aa8(_0x3d5c69['error']['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x91cf4e,'request\x20sent');_0x402aa8(_0x3d5c69[_0xda5d('0x11')][_0xda5d('0xf')]);}})[_0xda5d('0x12')](function(_0x388f40){logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x388f40);_0x1c1e2d(_0x388f40);});});} \ No newline at end of file +var _0xd98a=['client','http','then','info','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x24a6bb,_0x198044){var _0x54b440=function(_0x5bfc45){while(--_0x5bfc45){_0x24a6bb['push'](_0x24a6bb['shift']());}};_0x54b440(++_0x198044);}(_0xd98a,0xfc));var _0xad98=function(_0xac3b85,_0x8ec831){_0xac3b85=_0xac3b85-0x0;var _0x301fff=_0xd98a[_0xac3b85];return _0x301fff;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad98('0x1'));var rs=require(_0xad98('0x2'));var fs=require('fs');var Redis=require(_0xad98('0x3'));var db=require(_0xad98('0x4'))['db'];var utils=require(_0xad98('0x5'));var logger=require(_0xad98('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad98('0x7'));var client=jayson[_0xad98('0x8')][_0xad98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cd316,_0x2bf76c,_0x480c93){return new BPromise(function(_0x20712b,_0x34eb2d){return client['request'](_0x2cd316,_0x480c93)[_0xad98('0xa')](function(_0x5016b4){logger[_0xad98('0xb')]('SmsApplication,\x20%s,\x20%s',_0x2bf76c,'request\x20sent');logger['debug'](_0xad98('0xc'),_0x2bf76c,_0xad98('0xd'),JSON[_0xad98('0xe')](_0x5016b4));if(_0x5016b4[_0xad98('0xf')]){if(_0x5016b4['error']['code']===0x1f4){logger[_0xad98('0xf')](_0xad98('0x10'),_0x2bf76c,_0x5016b4[_0xad98('0xf')][_0xad98('0x11')]);return _0x34eb2d(_0x5016b4[_0xad98('0xf')][_0xad98('0x11')]);}logger[_0xad98('0xf')](_0xad98('0x10'),_0x2bf76c,_0x5016b4[_0xad98('0xf')]['message']);return _0x20712b(_0x5016b4[_0xad98('0xf')][_0xad98('0x11')]);}else{logger[_0xad98('0xb')](_0xad98('0x10'),_0x2bf76c,_0xad98('0xd'));_0x20712b(_0x5016b4[_0xad98('0x12')][_0xad98('0x11')]);}})[_0xad98('0x13')](function(_0x1c98e7){logger['error']('SmsApplication,\x20%s,\x20%s',_0x2bf76c,_0x1c98e7);_0x34eb2d(_0x1c98e7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 953f311..445ead5 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 _0x8603=['sms','addTags','put','/:id','smsinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','get','/describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x2a7812,_0x1ce83a){var _0x3e1342=function(_0x3ff9fb){while(--_0x3ff9fb){_0x2a7812['push'](_0x2a7812['shift']());}};_0x3e1342(++_0x1ce83a);}(_0x8603,0x190));var _0x3860=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x8603[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['describe']);router['get']('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xb')]);router['get'](_0x3860('0xc'),auth[_0x3860('0x7')](),controller['getMessages']);router[_0x3860('0x9')](_0x3860('0xd'),auth['isAuthenticated'](),controller[_0x3860('0xe')]);router[_0x3860('0xf')]('/',auth['isAuthenticated'](),controller[_0x3860('0x10')]);router[_0x3860('0xf')](_0x3860('0xc'),auth[_0x3860('0x7')](),controller[_0x3860('0x11')]);router[_0x3860('0xf')](_0x3860('0x12'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')](_0x3860('0x14'),'smsinteraction:addtags'),controller[_0x3860('0x15')]);router[_0x3860('0x16')](_0x3860('0x17'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')](_0x3860('0x14'),_0x3860('0x18')),controller[_0x3860('0x19')]);router[_0x3860('0x1a')](_0x3860('0x17'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')]('sms','smsinteraction:destroy'),controller[_0x3860('0x1b')]);router[_0x3860('0x1a')](_0x3860('0x12'),auth['isAuthenticated'](),controller[_0x3860('0x1c')]);module[_0x3860('0x1d')]=router; \ No newline at end of file +var _0x4fc2=['removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy'];(function(_0x4f4e58,_0x502463){var _0xc338e8=function(_0x1a1a6a){while(--_0x1a1a6a){_0x4f4e58['push'](_0x4f4e58['shift']());}};_0xc338e8(++_0x502463);}(_0x4fc2,0x111));var _0x24fc=function(_0x38037a,_0x196abc){_0x38037a=_0x38037a-0x0;var _0x1a1246=_0x4fc2[_0x38037a];return _0x1a1246;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['show']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['post']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['post'](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x18')),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/:id',auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x1b')),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1d')](_0x24fc('0xe'),auth['isAuthenticated'](),interaction[_0x24fc('0x1e')](_0x24fc('0x17'),_0x24fc('0x1f')),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x16'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f5ad64e..b9aa556 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 _0x737d=['moment','STRING','DATE','ENUM','out','BOOLEAN','sequelize'];(function(_0x5cb366,_0x5d8049){var _0x20e854=function(_0x3386d7){while(--_0x3386d7){_0x5cb366['push'](_0x5cb366['shift']());}};_0x20e854(++_0x5d8049);}(_0x737d,0xbc));var _0xd737=function(_0x1ba727,_0x496181){_0x1ba727=_0x1ba727-0x0;var _0x289816=_0x737d[_0x1ba727];return _0x289816;};'use strict';var Sequelize=require(_0xd737('0x0'));var moment=require(_0xd737('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd737('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd737('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd737('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd737('0x4')]('in',_0xd737('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd737('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd737('0x4')]('in',_0xd737('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd737('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x78b7=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x48da99,_0xe7e25f){var _0x612e05=function(_0xb9d67b){while(--_0xb9d67b){_0x48da99['push'](_0x48da99['shift']());}};_0x612e05(++_0xe7e25f);}(_0x78b7,0x194));var _0x778b=function(_0x179c6f,_0x1c0f22){_0x179c6f=_0x179c6f-0x0;var _0x2ea129=_0x78b7[_0x179c6f];return _0x2ea129;};'use strict';var Sequelize=require(_0x778b('0x0'));var moment=require(_0x778b('0x1'));module['exports']={'closed':{'type':Sequelize[_0x778b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x778b('0x3')]},'disposition':{'type':Sequelize[_0x778b('0x4')]},'secondDisposition':{'type':Sequelize[_0x778b('0x4')]},'thirdDisposition':{'type':Sequelize[_0x778b('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x778b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x778b('0x5')]('in',_0x778b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x778b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x778b('0x5')]('in',_0x778b('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 c67e6a2..dd48b4d 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 _0x4aa8=['contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','i.*','Contact.lastName','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','params','include','options','create','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','$gte','format','merge','findAll','rows','addTags','setTags','color','emit','smsInteractionTags:save','removeTags','download','join','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','get','Sms','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','out','System','renderFile','root','views','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','SmsInteraction','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','field','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','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','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','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','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','body','some','isEmpty','SmsAccountId','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`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)','getFullTextValue','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4aa8,0x13d));var _0x84aa=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x4aa8[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x84aa('0x0'));var rimraf=require(_0x84aa('0x1'));var zipdir=require(_0x84aa('0x2'));var jsonpatch=require(_0x84aa('0x3'));var rp=require(_0x84aa('0x4'));var moment=require('moment');var BPromise=require(_0x84aa('0x5'));var Mustache=require('mustache');var util=require(_0x84aa('0x6'));var path=require('path');var sox=require(_0x84aa('0x7'));var csv=require(_0x84aa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84aa('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x84aa('0xa'));var jsforce=require(_0x84aa('0xb'));var deskjs=require(_0x84aa('0xc'));var toCsv=require(_0x84aa('0x8'));var querystring=require(_0x84aa('0xd'));var Papa=require(_0x84aa('0xe'));var Redis=require('ioredis');var authService=require(_0x84aa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x84aa('0x10'));var pdf=require(_0x84aa('0x11'));var hardwareService=require(_0x84aa('0x12'));var logger=require(_0x84aa('0x13'))(_0x84aa('0x14'));var utils=require(_0x84aa('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x84aa('0x16'))['db'];config[_0x84aa('0x17')]=_[_0x84aa('0x18')](config[_0x84aa('0x17')],{'host':_0x84aa('0x19'),'port':0x18eb});var socket=require(_0x84aa('0x1a'))(new Redis(config[_0x84aa('0x17')]));require('./smsInteraction.socket')[_0x84aa('0x1b')](socket);function respondWithStatusCode(_0x36dfae,_0x5c808e){_0x5c808e=_0x5c808e||0xcc;return function(_0x1dfd47){if(_0x1dfd47){return _0x36dfae[_0x84aa('0x1c')](_0x5c808e);}return _0x36dfae[_0x84aa('0x1d')](_0x5c808e)['end']();};}function respondWithResult(_0x2fb30f,_0x6908af){_0x6908af=_0x6908af||0xc8;return function(_0x44dde8){if(_0x44dde8){return _0x2fb30f[_0x84aa('0x1d')](_0x6908af)['json'](_0x44dde8);}};}function respondWithFilteredResult(_0x595087,_0xdb9754){return function(_0x434f74){if(_0x434f74){var _0x5ca283=typeof _0xdb9754[_0x84aa('0x1e')]===_0x84aa('0x1f')&&typeof _0xdb9754[_0x84aa('0x20')]===_0x84aa('0x1f');var _0x5ecdbc=_0x434f74[_0x84aa('0x21')];var _0x2832e5=_0x5ca283?0x0:_0xdb9754['offset'];var _0x5320ae=_0x5ca283?_0x434f74[_0x84aa('0x21')]:_0xdb9754[_0x84aa('0x1e')]+_0xdb9754[_0x84aa('0x20')];var _0x21d9cf;if(_0x5320ae>=_0x5ecdbc){_0x5320ae=_0x5ecdbc;_0x21d9cf=0xc8;}else{_0x21d9cf=0xce;}_0x595087[_0x84aa('0x1d')](_0x21d9cf);return _0x595087[_0x84aa('0x22')]('Content-Range',_0x2832e5+'-'+_0x5320ae+'/'+_0x5ecdbc)['json'](_0x434f74);}return null;};}function patchUpdates(_0x3fb177){return function(_0x31488e){try{jsonpatch[_0x84aa('0x23')](_0x31488e,_0x3fb177,!![]);}catch(_0x491301){return BPromise[_0x84aa('0x24')](_0x491301);}return _0x31488e[_0x84aa('0x25')]();};}function saveUpdates(_0x371d8e,_0x3de8d2){return function(_0x31e815){if(_0x31e815){return _0x31e815[_0x84aa('0x26')](_0x371d8e)[_0x84aa('0x27')](function(_0x140c40){return _0x140c40;});}return null;};}function removeEntity(_0x17bda6,_0x3944a5){return function(_0x284175){if(_0x284175){return _0x284175['destroy']()[_0x84aa('0x27')](function(){_0x17bda6[_0x84aa('0x1d')](0xcc)[_0x84aa('0x28')]();});}};}function handleEntityNotFound(_0x1d842d,_0x540bb0){return function(_0x5d20e9){if(!_0x5d20e9){_0x1d842d[_0x84aa('0x1c')](0x194);}return _0x5d20e9;};}function handleError(_0x3f4f37,_0xfecffc){_0xfecffc=_0xfecffc||0x1f4;return function(_0x2e7a47){logger[_0x84aa('0x29')](_0x2e7a47[_0x84aa('0x2a')]);if(_0x2e7a47[_0x84aa('0x2b')]){delete _0x2e7a47['name'];}_0x3f4f37['status'](_0xfecffc)[_0x84aa('0x2c')](_0x2e7a47);};}function getInteractionUsers(_0x34e3e8,_0x2f288e){return new BPromise(function(_0x5e79cd,_0x311cf9){try{if(_0x2f288e[_0x34e3e8['id']]){_0x34e3e8[_0x84aa('0x2d')]=_[_0x84aa('0x2e')](_0x2f288e[_0x34e3e8['id']],function(_0x68d1bb){return{'id':_0x68d1bb['id'],'fullname':_0x68d1bb[_0x84aa('0x2f')]};});}}catch(_0x3e7ce8){_0x311cf9(_0x3e7ce8);}_0x5e79cd(_0x34e3e8);});}function getInteractionTags(_0x1a1222,_0x12891a){return new BPromise(function(_0x45cce4,_0x120c09){try{if(_0x1a1222[_0x84aa('0x30')]){_0x1a1222[_0x84aa('0x31')]=[];_0x1a1222[_0x84aa('0x30')][_0x84aa('0x32')](',')['forEach'](function(_0x24da62){_0x1a1222['Tags'][_0x84aa('0x33')](_0x12891a[_0x24da62]);});}delete _0x1a1222[_0x84aa('0x30')];}catch(_0x2e0d90){_0x120c09(_0x2e0d90);}_0x45cce4(_0x1a1222);});}function updateSmsInteraction(_0x30d9bd,_0x3cbc73,_0x1df1a9){return new BPromise(function(_0x4dd6e5,_0x1683d7){return getInteractionUsers(_0x30d9bd,_0x1df1a9)['then'](function(_0x4e8eec){return getInteractionTags(_0x4e8eec,_0x3cbc73);})[_0x84aa('0x27')](function(_0x1e4f77){_0x4dd6e5(_0x1e4f77);})[_0x84aa('0x34')](function(_0x1f63eb){_0x1683d7(_0x1f63eb);});});}exports[_0x84aa('0x35')]=function(_0x1fabcf,_0x53e186){var _0x3e42b9={},_0x31ce3b={},_0x5b45fe={'count':0x0,'rows':[]};var _0xc2ba5b=_[_0x84aa('0x2e')](db[_0x84aa('0x36')][_0x84aa('0x37')],function(_0x43a37e){return{'name':_0x43a37e['fieldName'],'type':_0x43a37e[_0x84aa('0x38')][_0x84aa('0x39')]};});_0x31ce3b[_0x84aa('0x3a')]=_[_0x84aa('0x2e')](_0xc2ba5b,_0x84aa('0x2b'));_0x31ce3b[_0x84aa('0x3b')]=_[_0x84aa('0x3c')](_0x1fabcf[_0x84aa('0x3b')]);_0x31ce3b['filters']=_[_0x84aa('0x3d')](_0x31ce3b[_0x84aa('0x3a')],_0x31ce3b['query']);_0x3e42b9[_0x84aa('0x3e')]=_[_0x84aa('0x3d')](_0x31ce3b[_0x84aa('0x3a')],qs[_0x84aa('0x3f')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x3f')]));_0x3e42b9[_0x84aa('0x3e')]=_0x3e42b9[_0x84aa('0x3e')][_0x84aa('0x40')]?_0x3e42b9[_0x84aa('0x3e')]:_0x31ce3b[_0x84aa('0x3a')];if(!_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x41')]('nolimit')){_0x3e42b9['limit']=qs[_0x84aa('0x20')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x20')]);_0x3e42b9['offset']=qs[_0x84aa('0x1e')](_0x1fabcf['query'][_0x84aa('0x1e')]);}_0x3e42b9[_0x84aa('0x42')]=qs[_0x84aa('0x43')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x43')]);_0x3e42b9[_0x84aa('0x44')]=qs[_0x84aa('0x45')](_[_0x84aa('0x46')](_0x1fabcf[_0x84aa('0x3b')],_0x31ce3b[_0x84aa('0x45')]),_0xc2ba5b);var _0x1c77c0=[];var _0x40f6f5=squel['select']()['field']('id')['field'](_0x84aa('0x2b'))[_0x84aa('0x47')]('color')[_0x84aa('0x48')](_0x84aa('0x49'));var _0x51c8a5=squel[_0x84aa('0x4a')]()[_0x84aa('0x47')](_0x84aa('0x4b'))[_0x84aa('0x47')](_0x84aa('0x4c'))[_0x84aa('0x47')](_0x84aa('0x4d'))['from'](_0x84aa('0x4e'),'ui')[_0x84aa('0x4f')](_0x84aa('0x50'),'u',_0x84aa('0x51'));var _0x3f4078=squel['select']()['from'](_0x84aa('0x52'),'i')[_0x84aa('0x4f')](_0x84aa('0x53'),'c',_0x84aa('0x54'))[_0x84aa('0x4f')](_0x84aa('0x50'),'o','o.id\x20=\x20i.UserId')[_0x84aa('0x4f')](_0x84aa('0x55'),'a',_0x84aa('0x56'))[_0x84aa('0x4f')]('sms_messages','me',_0x84aa('0x57'))[_0x84aa('0x4f')](_0x84aa('0x58'),'it',_0x84aa('0x59'))['left_join'](_0x84aa('0x49'),'t',_0x84aa('0x5a'));var _0x3441a7=squel[_0x84aa('0x5b')]();var _0xcc6b4a=[];var _0x1433bd=squel[_0x84aa('0x5b')]();var _0x1d9da3;if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x5c')]){_0x1d9da3=as[_0x84aa('0x5d')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x5c')]);var _0x2148bb=_0x1d9da3[_0x84aa('0x5e')];for(var _0x39c361=0x0;_0x39c361<_0x1d9da3['conditions'][_0x84aa('0x40')];_0x39c361++){var _0x35527b=_0x1d9da3[_0x84aa('0x5f')][_0x39c361];var _0x490059='i';var _0x1a0825=_[_0x84aa('0x60')](_0xc2ba5b,[_0x84aa('0x2b'),_0x35527b['field']]);if(!_0x1a0825){switch(_0x35527b[_0x84aa('0x47')]){case _0x84aa('0x61'):if(_0x35527b[_0x84aa('0x62')]==0x1){_0x3f4078['having']('`'+_0x35527b[_0x84aa('0x47')]+_0x84aa('0x63'));}else{_0x3f4078[_0x84aa('0x64')]('`'+_0x35527b[_0x84aa('0x47')]+_0x84aa('0x65'));}break;case _0x84aa('0x66'):if(_0x35527b[_0x84aa('0x67')]===_0x84aa('0x68')){if(_0x35527b[_0x84aa('0x62')]['split']('\x20')[_0x84aa('0x40')]>0x1){_0x3441a7[_0x2148bb](_0x84aa('0x69'),qs['getFullTextValue'](_0x35527b[_0x84aa('0x62')]),null);}else{var _0x2cdec2='%'+_0x35527b['value']+'%';_0x3441a7[_0x2148bb](_0x84aa('0x6a'),_0x2cdec2,_0x2cdec2,_0x2cdec2);}}else{_0x1a0825=_['find'](_0xc2ba5b,['name',_0x84aa('0x6b')]);_0x35527b['field']=_0x84aa('0x6b');_0x53b496=as[_0x84aa('0x6c')](_0x490059,_0x1a0825[_0x84aa('0x38')],_0x35527b);_0x3441a7[_0x2148bb](_0x53b496['text'],_0x53b496['value'][_0x84aa('0x6d')],_0x53b496[_0x84aa('0x62')][_0x84aa('0x28')]);}break;case _0x84aa('0x6e'):var _0x1741de=_0x35527b['value'][_0x84aa('0x32')](',')[_0x84aa('0x2e')](function(_0x3d8d32){return Number(_0x3d8d32);});_0x1741de[_0x84aa('0x6f')](function(_0x10786b){_0x1433bd['or'](_0x84aa('0x70'),'%,'+_0x10786b+',%');});_0xcc6b4a=_[_0x84aa('0x71')](_0xcc6b4a,_0x1741de);break;case _0x84aa('0x72'):if(_0x35527b['operator']===_0x84aa('0x68')){_0x3441a7[_0x2148bb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x35527b[_0x84aa('0x62')]+'%',null);}else{_0x1a0825=_[_0x84aa('0x60')](_0xc2ba5b,['name','UserId']);_0x35527b[_0x84aa('0x47')]=_0x84aa('0x73');_0x53b496=as[_0x84aa('0x6c')](_0x490059,_0x1a0825[_0x84aa('0x38')],_0x35527b);_0x3441a7[_0x2148bb](_0x53b496[_0x84aa('0x74')],_0x53b496[_0x84aa('0x62')][_0x84aa('0x6d')],_0x53b496['value'][_0x84aa('0x28')]);}break;case _0x84aa('0x75'):_0x53b496=as[_0x84aa('0x6c')]('me',null,_0x35527b);_0x3441a7[_0x2148bb](_0x53b496[_0x84aa('0x74')],_0x53b496['value'][_0x84aa('0x6d')],_0x53b496['value'][_0x84aa('0x28')]);break;}}else{var _0x53b496=as[_0x84aa('0x6c')](_0x490059,_0x1a0825[_0x84aa('0x38')],_0x35527b);_0x3441a7[_0x2148bb](_0x53b496[_0x84aa('0x74')],_0x53b496[_0x84aa('0x62')][_0x84aa('0x6d')],_0x53b496[_0x84aa('0x62')][_0x84aa('0x28')]);}}}else{var _0x3ef8b7=_(_0x1fabcf['query'])[_0x84aa('0x3c')]()[_0x84aa('0x2e')](function(_0x41b312){return _[_0x84aa('0x76')](_0xc2ba5b,['name',_0x41b312])?_0x41b312:undefined;})['compact']()[_0x84aa('0x62')]();if(!_[_0x84aa('0x77')](_0x3ef8b7)){_0x3ef8b7[_0x84aa('0x6f')](function(_0x11411){if(_0x11411===_0x84aa('0x78')){_0x3f4078['where']('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x1fabcf[_0x84aa('0x3b')][_0x11411]));}else if(_0x11411==='createdAt'){var _0x231a9e=JSON[_0x84aa('0x79')](_0x1fabcf[_0x84aa('0x3b')][_0x11411])['$gte'];var _0x1e72eb=JSON[_0x84aa('0x79')](_0x1fabcf[_0x84aa('0x3b')][_0x11411])[_0x84aa('0x7a')];_0x3f4078[_0x84aa('0x44')](_0x84aa('0x7b'),_0x231a9e,_0x1e72eb);}else{if(_0x1fabcf['query'][_0x11411]===_0x84aa('0x7c')){_0x3f4078[_0x84aa('0x44')]('i.'+_0x11411+_0x84aa('0x7d'));}else{_0x3f4078['where']('i.'+_0x11411+'\x20=\x20?',_0x1fabcf['query'][_0x11411]);}}});}if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x7e')]){if(_0x1fabcf['query'][_0x84aa('0x7e')]==0x1){_0x3f4078[_0x84aa('0x64')](_0x84aa('0x7f'));}else{_0x3f4078[_0x84aa('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x1fabcf['query'][_0x84aa('0x80')]){_0xcc6b4a=_[_0x84aa('0x81')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x80')])?_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x80')]:new Array(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x80')]);_0xcc6b4a[_0x84aa('0x6f')](function(_0x436131){_0x1433bd['or'](_0x84aa('0x70'),'%,'+_0x436131+',%');});}if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x82')]){var _0x3a1d9f=_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x82')]['replace']('\x5c','\x5c\x5c')[_0x84aa('0x83')](/'/g,'\x27\x27');if(qs[_0x84aa('0x84')](_0x3a1d9f)){_0x3441a7['or'](_0x84aa('0x85'),_0x3a1d9f+'%')['or'](_0x84aa('0x86'),_0x3a1d9f+'%');}else{_0x3441a7['or'](_0x84aa('0x87'),qs[_0x84aa('0x88')](_0x3a1d9f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3a1d9f+'%');}}}_0x3f4078[_0x84aa('0x44')](_0x3441a7);_0x3f4078[_0x84aa('0x89')](_0x84aa('0x8a'));var _0x452410={'type':db[_0x84aa('0x8b')][_0x84aa('0x8c')]['SELECT'],'raw':!![]};var _0x27c0ab=_0x3f4078[_0x84aa('0x8d')]();_0x27c0ab[_0x84aa('0x47')](_0x84aa('0x8a'));_0x27c0ab[_0x84aa('0x47')](_0x84aa('0x8e'),_0x84aa('0x61'));if(_0x3e42b9[_0x84aa('0x42')]){_0x3e42b9['order'][_0x84aa('0x6f')](function(_0x3dccd2){var _0x413a41=_0x3dccd2[0x0]===_0x84aa('0x8f')?_0x3dccd2[0x0]:'i.'+_0x3dccd2[0x0];_0x3f4078[_0x84aa('0x42')](_0x413a41,_0x3dccd2[0x1]===_0x84aa('0x90')?![]:!![]);});}if(!_[_0x84aa('0x77')](_0xcc6b4a)){_0x3f4078[_0x84aa('0x64')](_0x1433bd);_0x27c0ab['where'](_0x84aa('0x91'),_0xcc6b4a);}BPromise[_0x84aa('0x92')]()[_0x84aa('0x27')](function(){if(!_0x1d9da3){if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x78')])return;_0x27c0ab[_0x84aa('0x44')](_0x84aa('0x93'));_0x3f4078['where'](_0x84aa('0x93'));return;}if(_0x1fabcf['user'][_0x84aa('0x94')]!==_0x84aa('0x95'))return;return _0x1fabcf[_0x84aa('0x96')][_0x84aa('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59afe1){if(_[_0x84aa('0x77')](_0x59afe1)){_0x27c0ab[_0x84aa('0x44')](_0x84aa('0x98'));_0x3f4078['where'](_0x84aa('0x98'));}else{_0x27c0ab[_0x84aa('0x44')](_0x84aa('0x99'),_[_0x84aa('0x2e')](_0x59afe1,'id'));_0x3f4078['where'](_0x84aa('0x99'),_[_0x84aa('0x2e')](_0x59afe1,'id'));}});})[_0x84aa('0x27')](function(){if(_0x1fabcf['user'][_0x84aa('0x94')]==='agent'&&!_0x1d9da3&&!_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x78')])return[];return db[_0x84aa('0x9a')][_0x84aa('0x3b')](_0x27c0ab[_0x84aa('0x9b')](),_0x452410);})[_0x84aa('0x27')](function(_0x2514c3){_0x5b45fe[_0x84aa('0x21')]=_0x2514c3['length'];if(_0x5b45fe[_0x84aa('0x21')]===0x0)return[];return db['sequelize'][_0x84aa('0x3b')](_0x40f6f5[_0x84aa('0x9b')](),_0x452410)['then'](function(_0x617ac6){_0x1c77c0=_[_0x84aa('0x9c')](_0x617ac6,'id');_0x452410=_['merge'](_0x452410,{'model':db[_0x84aa('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x3f')]){_0x3e42b9[_0x84aa('0x3e')]['forEach'](function(_0x4aece6){_0x3f4078[_0x84aa('0x47')]('i.'+_0x4aece6);});}else{_0x3f4078[_0x84aa('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x84aa('0x61'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0x9d'),_0x84aa('0x9e'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0x9f'),'Account.mandatoryDisposition');_0x3f4078[_0x84aa('0x47')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x84aa('0x8f'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0xa0'));_0x3f4078[_0x84aa('0x47')]('c.firstName','Contact.firstName');_0x3f4078['field']('c.lastName',_0x84aa('0xa1'));_0x3f4078[_0x84aa('0x47')]('c.email','Contact.email');_0x3f4078['field']('c.phone',_0x84aa('0xa2'));_0x3f4078['field'](_0x84aa('0xa3'),_0x84aa('0xa4'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0xa5'),_0x84aa('0xa6'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0xa7'),'Owner.fullname');_0x3f4078[_0x84aa('0x47')](_0x84aa('0xa8'),_0x84aa('0xa9'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0xaa'),_0x84aa('0x30'));}if(_0x3e42b9[_0x84aa('0x20')])_0x3f4078[_0x84aa('0x20')](_0x3e42b9[_0x84aa('0x20')]);if(_0x3e42b9['offset'])_0x3f4078[_0x84aa('0x1e')](_0x3e42b9[_0x84aa('0x1e')]);return db[_0x84aa('0x9a')]['query'](_0x3f4078[_0x84aa('0x9b')](),_0x452410);})['then'](function(_0xefc6b1){if(_0xefc6b1[_0x84aa('0x40')]>0x0)_0x51c8a5['where'](_0x84aa('0xab'),_['map'](_0xefc6b1,'id'));return db[_0x84aa('0x9a')]['query'](_0x51c8a5[_0x84aa('0x9b')](),_0x452410)[_0x84aa('0x27')](function(_0x220ca6){var _0x2405e8=_[_0x84aa('0xac')](_0x220ca6,_0x84aa('0xad'));var _0x19342f=[];_0xefc6b1['forEach'](function(_0x42918c){_0x19342f[_0x84aa('0x33')](updateSmsInteraction(_0x42918c,_0x1c77c0,_0x2405e8));});return BPromise[_0x84aa('0xae')](_0x19342f);});});})[_0x84aa('0x27')](function(_0x4e9cee){_0x5b45fe['rows']=_0x4e9cee;return _0x5b45fe;})[_0x84aa('0x27')](respondWithFilteredResult(_0x53e186,_0x3e42b9))[_0x84aa('0x34')](handleError(_0x53e186,null));};exports['show']=function(_0x40bdfb,_0x54f0ab){var _0x4a8c69={'raw':![],'where':{'id':_0x40bdfb[_0x84aa('0xaf')]['id']}},_0x4539ce={};_0x4539ce['model']=_[_0x84aa('0x3c')](db[_0x84aa('0x36')][_0x84aa('0x37')]);_0x4539ce['query']=_[_0x84aa('0x3c')](_0x40bdfb['query']);_0x4539ce['filters']=_['intersection'](_0x4539ce[_0x84aa('0x3a')],_0x4539ce[_0x84aa('0x3b')]);_0x4a8c69[_0x84aa('0x3e')]=_[_0x84aa('0x3d')](_0x4539ce['model'],qs[_0x84aa('0x3f')](_0x40bdfb['query'][_0x84aa('0x3f')]));_0x4a8c69[_0x84aa('0x3e')]=_0x4a8c69[_0x84aa('0x3e')][_0x84aa('0x40')]?_0x4a8c69[_0x84aa('0x3e')]:_0x4539ce[_0x84aa('0x3a')];if(_0x40bdfb['query']['includeAll']){_0x4a8c69[_0x84aa('0xb0')]=[{'all':!![]}];}_0x4a8c69=_['merge']({},_0x4a8c69,_0x40bdfb[_0x84aa('0xb1')]);return db[_0x84aa('0x36')][_0x84aa('0x60')](_0x4a8c69)['then'](handleEntityNotFound(_0x54f0ab,null))['then'](respondWithResult(_0x54f0ab,null))[_0x84aa('0x34')](handleError(_0x54f0ab,null));};exports[_0x84aa('0xb2')]=function(_0x39faf8,_0x30de35){return db[_0x84aa('0x36')]['create'](_0x39faf8[_0x84aa('0x75')],{})[_0x84aa('0x27')](respondWithResult(_0x30de35,0xc9))[_0x84aa('0x34')](handleError(_0x30de35,null));};exports[_0x84aa('0x26')]=function(_0x1c2a15,_0x2c03dd){if(_0x1c2a15[_0x84aa('0x75')]['id']){delete _0x1c2a15[_0x84aa('0x75')]['id'];}return db[_0x84aa('0x36')]['find']({'where':{'id':_0x1c2a15[_0x84aa('0xaf')]['id']}})['then'](handleEntityNotFound(_0x2c03dd,null))[_0x84aa('0x27')](saveUpdates(_0x1c2a15['body'],null))['then'](respondWithResult(_0x2c03dd,null))['catch'](handleError(_0x2c03dd,null));};exports[_0x84aa('0xb3')]=function(_0x3094d1,_0x16e365){return db[_0x84aa('0x36')][_0x84aa('0x60')]({'where':{'id':_0x3094d1[_0x84aa('0xaf')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x16e365,null))[_0x84aa('0x27')](removeEntity(_0x16e365,null))['catch'](handleError(_0x16e365,null));};exports[_0x84aa('0xb4')]=function(_0x10cdb3,_0x561417){return db[_0x84aa('0x36')][_0x84aa('0xb4')]()[_0x84aa('0x27')](respondWithResult(_0x561417,null))[_0x84aa('0x34')](handleError(_0x561417,null));};exports[_0x84aa('0xb5')]=function(_0x4723d8,_0x347625,_0x3e1bad){return db[_0x84aa('0xb6')][_0x84aa('0x60')]({'where':{'id':_0x4723d8[_0x84aa('0xaf')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x347625,null))[_0x84aa('0x27')](function(_0x29a4a3){if(_0x29a4a3){return _0x29a4a3[_0x84aa('0xb5')](_0x4723d8[_0x84aa('0x75')][_0x84aa('0xb7')],_[_0x84aa('0xb8')](_0x4723d8[_0x84aa('0x75')],[_0x84aa('0xb7'),'id'])||{});}})[_0x84aa('0x27')](respondWithResult(_0x347625,null))[_0x84aa('0x34')](handleError(_0x347625,null));};exports[_0x84aa('0xb9')]=function(_0xf96f8e,_0x9b45e2,_0x34c89e){var _0x30dc78={'raw':![],'where':{}};var _0xe721a7={};var _0x591166={'count':0x0,'rows':[]};return db[_0x84aa('0x36')][_0x84aa('0xba')]({'where':{'id':_0xf96f8e[_0x84aa('0xaf')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x9b45e2,null))[_0x84aa('0x27')](function(_0x3e9aa5){if(_0x3e9aa5){_0xe721a7[_0x84aa('0x3a')]=_[_0x84aa('0x3c')](db[_0x84aa('0xb6')][_0x84aa('0x37')]);_0xe721a7['query']=_['keys'](_0xf96f8e[_0x84aa('0x3b')]);_0xe721a7[_0x84aa('0x45')]=_[_0x84aa('0x3d')](_0xe721a7['model'],_0xe721a7['query']);_0x30dc78[_0x84aa('0x3e')]=_[_0x84aa('0x3d')](_0xe721a7['model'],qs[_0x84aa('0x3f')](_0xf96f8e['query'][_0x84aa('0x3f')]));_0x30dc78[_0x84aa('0x3e')]=_0x30dc78[_0x84aa('0x3e')][_0x84aa('0x40')]?_0x30dc78[_0x84aa('0x3e')]:_0xe721a7[_0x84aa('0x3a')];if(!_0xf96f8e['query'][_0x84aa('0x41')]('nolimit')){_0x30dc78[_0x84aa('0x20')]=qs[_0x84aa('0x20')](_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0x20')]);_0x30dc78[_0x84aa('0x1e')]=qs[_0x84aa('0x1e')](_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0x1e')]);}_0x30dc78['order']=qs[_0x84aa('0x43')](_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0x43')]);_0x30dc78['where']=qs[_0x84aa('0x45')](_['pick'](_0xf96f8e[_0x84aa('0x3b')],_0xe721a7[_0x84aa('0x45')]));_0x30dc78[_0x84aa('0x44')][_0x84aa('0xad')]=_0x3e9aa5['id'];if(_0xf96f8e[_0x84aa('0x3b')]['filter']){_0x30dc78[_0x84aa('0x44')]=_['merge'](_0x30dc78[_0x84aa('0x44')],{'$or':_[_0x84aa('0x2e')](_0x30dc78[_0x84aa('0x3e')],function(_0x3f3bcb){var _0x1ea394={};_0x1ea394[_0x3f3bcb]={'$like':'%'+_0xf96f8e[_0x84aa('0x3b')]['filter']+'%'};return _0x1ea394;})});}if(_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0xbb')]){var _0x1953df=_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0xbb')]['split'](',');var _0x185e34={};_0x185e34[_0x1953df[0x0]]={'$gte':moment(_0x1953df[0x1])[_0x84aa('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30dc78[_0x84aa('0x44')]=_['merge'](_0x30dc78[_0x84aa('0x44')],_0x185e34);}_0x30dc78=_[_0x84aa('0xbd')]({},_0x30dc78,_0xf96f8e['options']);return db[_0x84aa('0xb6')][_0x84aa('0x21')]({'where':_0x30dc78[_0x84aa('0x44')]})[_0x84aa('0x27')](function(_0x3380f2){_0x591166['count']=_0x3380f2;if(_0xf96f8e[_0x84aa('0x3b')]['includeAll']){_0x30dc78[_0x84aa('0xb0')]=[{'all':!![]}];}return db[_0x84aa('0xb6')][_0x84aa('0xbe')](_0x30dc78);})[_0x84aa('0x27')](function(_0x4ee4b4){_0x591166[_0x84aa('0xbf')]=_0x4ee4b4;return _0x591166;});}})[_0x84aa('0x27')](respondWithFilteredResult(_0x9b45e2,_0x30dc78))[_0x84aa('0x34')](handleError(_0x9b45e2,null));};exports[_0x84aa('0xc0')]=function(_0x5572b4,_0x58e8ea,_0x3966c9){return db[_0x84aa('0x36')][_0x84aa('0x60')]({'where':{'id':_0x5572b4[_0x84aa('0xaf')]['id']}})['then'](handleEntityNotFound(_0x58e8ea,null))[_0x84aa('0x27')](function(_0x43572f){if(_0x43572f){return _0x43572f[_0x84aa('0xc1')](_0x5572b4[_0x84aa('0x75')][_0x84aa('0xb7')],_[_0x84aa('0xb8')](_0x5572b4['body'],[_0x84aa('0xb7'),'id'])||{})['spread'](function(){return db['Tag'][_0x84aa('0xbe')]({'attributes':['id',_0x84aa('0x2b'),_0x84aa('0xc2')],'where':{'id':_0x5572b4[_0x84aa('0x75')][_0x84aa('0xb7')]}});})[_0x84aa('0x27')](function(_0x57406f){socket[_0x84aa('0xc3')](_0x84aa('0xc4'),{'id':Number(_0x5572b4['params']['id']),'tags':_0x57406f||[]});return{'id':Number(_0x5572b4[_0x84aa('0xaf')]['id']),'tags':_0x57406f||[]};});}})[_0x84aa('0x27')](respondWithResult(_0x58e8ea,null))[_0x84aa('0x34')](handleError(_0x58e8ea,null));};exports[_0x84aa('0xc5')]=function(_0x4f3b66,_0x50e336,_0x31b5af){return db['SmsInteraction'][_0x84aa('0x60')]({'where':{'id':_0x4f3b66[_0x84aa('0xaf')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x50e336,null))[_0x84aa('0x27')](function(_0x1e198a){if(_0x1e198a){return _0x1e198a[_0x84aa('0xc5')](_0x4f3b66[_0x84aa('0x3b')]['ids']);}})[_0x84aa('0x27')](respondWithStatusCode(_0x50e336,null))[_0x84aa('0x34')](handleError(_0x50e336,null));};exports[_0x84aa('0xc6')]=function(_0x3a93d,_0x22a300){var _0x8450e1=moment()['unix']()[_0x84aa('0x9b')]();var _0x2ec211=path[_0x84aa('0xc7')](config['root'],'server',_0x84aa('0xc8'),_0x84aa('0xc9'));var _0x3c9949=path['join'](config['root'],_0x84aa('0xca'),_0x84aa('0xc8'),_0x84aa('0xcb'));var _0x4197b2=path[_0x84aa('0xc7')](_0x2ec211,_0x8450e1);var _0x241e02=util[_0x84aa('0xbc')](_0x84aa('0xcc'),_0x3a93d[_0x84aa('0xaf')]['id'],_0x8450e1);var _0x49a29e=path[_0x84aa('0xc7')](_0x2ec211,_0x241e02);var _0x5b00ba=[];_0x5b00ba[_0x84aa('0x33')]({'model':db[_0x84aa('0x72')],'as':'User','attributes':['id',_0x84aa('0x2f')],'raw':!![]});_0x5b00ba[_0x84aa('0x33')]({'model':db[_0x84aa('0xcd')],'as':_0x84aa('0x66'),'attributes':['id',_0x84aa('0xce'),_0x84aa('0xcf')],'raw':!![]});var _0x331237=[{'model':db[_0x84aa('0xb6')],'as':_0x84aa('0xd0'),'attributes':['id',_0x84aa('0x75'),_0x84aa('0xd1'),_0x84aa('0xd2'),_0x84aa('0xd3'),_0x84aa('0x7e')],'include':_0x5b00ba}];_0x331237['push']({'model':db[_0x84aa('0xd4')],'as':_0x84aa('0xd5'),'attributes':['id','name']});_0x331237[_0x84aa('0x33')]({'model':db[_0x84aa('0x72')],'as':_0x84aa('0xd6'),'attributes':['id',_0x84aa('0x2f')]});return db[_0x84aa('0x36')][_0x84aa('0x60')]({'where':{'id':_0x3a93d[_0x84aa('0xaf')]['id']},'include':_0x331237})[_0x84aa('0x27')](handleEntityNotFound(_0x22a300,null))[_0x84aa('0x27')](function(_0x2fbe05){if(_0x2fbe05){var _0x81a396=_0x2fbe05[_0x84aa('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x4197b2);var _0x5d199e={'channel':_0x84aa('0xd8'),'account':_0x81a396[_0x84aa('0xd5')]['name'],'agent':_0x81a396[_0x84aa('0xd6')]?_0x81a396[_0x84aa('0xd6')][_0x84aa('0x2f')]:_0x84aa('0xd9'),'createdAt':moment(_0x81a396[_0x84aa('0xd1')])[_0x84aa('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x84aa('0x9b')](),'closedAt':_0x81a396[_0x84aa('0xda')]?moment(_0x81a396[_0x84aa('0xdb')])[_0x84aa('0xbc')](_0x84aa('0xdc'))[_0x84aa('0x9b')]():'','disposition':_0x81a396['disposition'],'messages':_(_0x81a396[_0x84aa('0xd0')])[_0x84aa('0x82')]({'secret':![]})[_0x84aa('0x2e')](function(_0x3c197d){return{'date':moment(_0x3c197d[_0x84aa('0xd1')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x84aa('0x9b')](),'sender':_0x3c197d[_0x84aa('0xd2')]===_0x84aa('0xdd')?_0x3c197d[_0x84aa('0x72')]?_0x3c197d['User'][_0x84aa('0x2f')]:_0x84aa('0xde'):_0x3c197d[_0x84aa('0x66')][_0x84aa('0xce')]+(_0x3c197d[_0x84aa('0x66')]['lastName']?'\x20'+_0x3c197d['Contact'][_0x84aa('0xcf')]:''),'body':_0x3c197d[_0x84aa('0x75')],'direction':_0x3c197d[_0x84aa('0xd2')]==='out'?'A':'C','secret':_0x3c197d[_0x84aa('0xd3')],'read':_0x3c197d[_0x84aa('0x7e')]};})[_0x84aa('0x62')]()};return ejs[_0x84aa('0xdf')](path['join'](config[_0x84aa('0xe0')],'server',_0x84aa('0xe1'),'downloadInteraction.ejs'),{'interaction':_0x5d199e})[_0x84aa('0x27')](function(_0x341304){var _0x32c9d1=path[_0x84aa('0xc7')](_0x4197b2,'transcript-'+_0x81a396['id']+'-'+_0x8450e1+_0x84aa('0xe2'));var _0x4bae01={'path':_0x32c9d1,'channel':_0x84aa('0xd8'),'interactionId':_0x81a396['id']};return pdf[_0x84aa('0xe3')](_0x341304,_0x4bae01);})[_0x84aa('0x27')](function(){return new BPromise(function(_0x442776,_0x20428c){zipdir(_0x4197b2,{'saveTo':_0x49a29e},function(_0x2bba5b,_0x17bdb5){if(_0x2bba5b)return _0x20428c(_0x2bba5b);return _0x442776(_0x17bdb5);});})[_0x84aa('0x27')](function(){return new BPromise(function(_0x2172cf,_0x298c04){rimraf(_0x4197b2,function(_0x39b94d){if(_0x39b94d)_0x298c04(_0x39b94d);return _0x2172cf();});});})[_0x84aa('0x27')](function(){return _0x22a300['download'](_0x49a29e,_0x241e02,function(_0xf1fcf4){if(_0xf1fcf4){console['log'](_0x84aa('0xe4'),_0xf1fcf4);}else{fs[_0x84aa('0xe5')](_0x49a29e);}});});});}else{return _0x22a300[_0x84aa('0x1c')](0xc8);}})['catch'](handleError(_0x22a300,null));}; \ No newline at end of file +var _0x0e6c=['isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','SmsAccountId','toString','keyBy','merge','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','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','sequelize','groupBy','all','rows','catch','show','include','options','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','sort','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Messages','secret','read','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','closedAt','disposition','direction','out','System','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','json','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','fullname','TagIds','Tags','split','forEach','push','SmsInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','hasOwnProperty','limit','order','where','filters','pick','select','field','color','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','text','start','keys','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace'];(function(_0x4d16ea,_0x1ea872){var _0x556cf5=function(_0x4b7a68){while(--_0x4b7a68){_0x4d16ea['push'](_0x4d16ea['shift']());}};_0x556cf5(++_0x1ea872);}(_0x0e6c,0x6b));var _0xc0e6=function(_0x1eeb14,_0x320a8e){_0x1eeb14=_0x1eeb14-0x0;var _0x4422c9=_0x0e6c[_0x1eeb14];return _0x4422c9;};'use strict';var emlformat=require(_0xc0e6('0x0'));var rimraf=require(_0xc0e6('0x1'));var zipdir=require(_0xc0e6('0x2'));var jsonpatch=require(_0xc0e6('0x3'));var rp=require(_0xc0e6('0x4'));var moment=require('moment');var BPromise=require(_0xc0e6('0x5'));var Mustache=require(_0xc0e6('0x6'));var util=require(_0xc0e6('0x7'));var path=require(_0xc0e6('0x8'));var sox=require(_0xc0e6('0x9'));var csv=require(_0xc0e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0e6('0xb'));var _=require(_0xc0e6('0xc'));var squel=require(_0xc0e6('0xd'));var crypto=require(_0xc0e6('0xe'));var jsforce=require(_0xc0e6('0xf'));var deskjs=require(_0xc0e6('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc0e6('0x11'));var Redis=require(_0xc0e6('0x12'));var authService=require(_0xc0e6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc0e6('0x14'));var pdf=require(_0xc0e6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0e6('0x16'))(_0xc0e6('0x17'));var utils=require(_0xc0e6('0x18'));var config=require(_0xc0e6('0x19'));var licenseUtil=require(_0xc0e6('0x1a'));var db=require(_0xc0e6('0x1b'))['db'];config[_0xc0e6('0x1c')]=_[_0xc0e6('0x1d')](config[_0xc0e6('0x1c')],{'host':_0xc0e6('0x1e'),'port':0x18eb});var socket=require(_0xc0e6('0x1f'))(new Redis(config[_0xc0e6('0x1c')]));require(_0xc0e6('0x20'))['register'](socket);function respondWithStatusCode(_0x1a7630,_0x377b5c){_0x377b5c=_0x377b5c||0xcc;return function(_0x2f5aed){if(_0x2f5aed){return _0x1a7630[_0xc0e6('0x21')](_0x377b5c);}return _0x1a7630[_0xc0e6('0x22')](_0x377b5c)['end']();};}function respondWithResult(_0x5a9c81,_0x2fd3d2){_0x2fd3d2=_0x2fd3d2||0xc8;return function(_0x3f62be){if(_0x3f62be){return _0x5a9c81[_0xc0e6('0x22')](_0x2fd3d2)[_0xc0e6('0x23')](_0x3f62be);}};}function respondWithFilteredResult(_0x4987cb,_0x1578ce){return function(_0x67bdea){if(_0x67bdea){var _0x25434b=typeof _0x1578ce['offset']===_0xc0e6('0x24')&&typeof _0x1578ce['limit']===_0xc0e6('0x24');var _0x3f9dd0=_0x67bdea['count'];var _0x370ea9=_0x25434b?0x0:_0x1578ce[_0xc0e6('0x25')];var _0x159fc8=_0x25434b?_0x67bdea[_0xc0e6('0x26')]:_0x1578ce[_0xc0e6('0x25')]+_0x1578ce['limit'];var _0x5bf42a;if(_0x159fc8>=_0x3f9dd0){_0x159fc8=_0x3f9dd0;_0x5bf42a=0xc8;}else{_0x5bf42a=0xce;}_0x4987cb[_0xc0e6('0x22')](_0x5bf42a);return _0x4987cb[_0xc0e6('0x27')](_0xc0e6('0x28'),_0x370ea9+'-'+_0x159fc8+'/'+_0x3f9dd0)[_0xc0e6('0x23')](_0x67bdea);}return null;};}function patchUpdates(_0x3f73aa){return function(_0x17548c){try{jsonpatch['apply'](_0x17548c,_0x3f73aa,!![]);}catch(_0x1ad67a){return BPromise[_0xc0e6('0x29')](_0x1ad67a);}return _0x17548c[_0xc0e6('0x2a')]();};}function saveUpdates(_0x4a55d4,_0x24b290){return function(_0x23e4b6){if(_0x23e4b6){return _0x23e4b6[_0xc0e6('0x2b')](_0x4a55d4)[_0xc0e6('0x2c')](function(_0x47d72f){return _0x47d72f;});}return null;};}function removeEntity(_0x3bec62,_0x2782ba){return function(_0x3bab25){if(_0x3bab25){return _0x3bab25[_0xc0e6('0x2d')]()[_0xc0e6('0x2c')](function(){_0x3bec62[_0xc0e6('0x22')](0xcc)[_0xc0e6('0x2e')]();});}};}function handleEntityNotFound(_0x18253e,_0x3c5a8c){return function(_0x403df4){if(!_0x403df4){_0x18253e[_0xc0e6('0x21')](0x194);}return _0x403df4;};}function handleError(_0x3aee4e,_0x4bb7f6){_0x4bb7f6=_0x4bb7f6||0x1f4;return function(_0x424d61){logger[_0xc0e6('0x2f')](_0x424d61[_0xc0e6('0x30')]);if(_0x424d61[_0xc0e6('0x31')]){delete _0x424d61['name'];}_0x3aee4e[_0xc0e6('0x22')](_0x4bb7f6)['send'](_0x424d61);};}function getInteractionUsers(_0x20630d,_0x2d8ecc){return new BPromise(function(_0x5e0c60,_0x111b07){try{if(_0x2d8ecc[_0x20630d['id']]){_0x20630d['Users']=_['map'](_0x2d8ecc[_0x20630d['id']],function(_0x406f3e){return{'id':_0x406f3e['id'],'fullname':_0x406f3e[_0xc0e6('0x32')]};});}}catch(_0x14f7ce){_0x111b07(_0x14f7ce);}_0x5e0c60(_0x20630d);});}function getInteractionTags(_0x35dc53,_0x44c49e){return new BPromise(function(_0x119b4b,_0x473dc1){try{if(_0x35dc53[_0xc0e6('0x33')]){_0x35dc53[_0xc0e6('0x34')]=[];_0x35dc53[_0xc0e6('0x33')][_0xc0e6('0x35')](',')[_0xc0e6('0x36')](function(_0x4ae80f){_0x35dc53[_0xc0e6('0x34')][_0xc0e6('0x37')](_0x44c49e[_0x4ae80f]);});}delete _0x35dc53[_0xc0e6('0x33')];}catch(_0x16774b){_0x473dc1(_0x16774b);}_0x119b4b(_0x35dc53);});}function updateSmsInteraction(_0x271ef5,_0x22d36b,_0x1a6ed3){return new BPromise(function(_0x37cb2f,_0x27d627){return getInteractionUsers(_0x271ef5,_0x1a6ed3)[_0xc0e6('0x2c')](function(_0x283c7e){return getInteractionTags(_0x283c7e,_0x22d36b);})[_0xc0e6('0x2c')](function(_0x2e5fce){_0x37cb2f(_0x2e5fce);})['catch'](function(_0x5428ea){_0x27d627(_0x5428ea);});});}exports['index']=function(_0x54551,_0x271d2a){var _0x1d1c31={},_0x837076={},_0x444532={'count':0x0,'rows':[]};var _0x2e3184=_['map'](db[_0xc0e6('0x38')][_0xc0e6('0x39')],function(_0x21c3e4){return{'name':_0x21c3e4[_0xc0e6('0x3a')],'type':_0x21c3e4['type'][_0xc0e6('0x3b')]};});_0x837076[_0xc0e6('0x3c')]=_[_0xc0e6('0x3d')](_0x2e3184,_0xc0e6('0x31'));_0x837076[_0xc0e6('0x3e')]=_['keys'](_0x54551['query']);_0x837076['filters']=_[_0xc0e6('0x3f')](_0x837076[_0xc0e6('0x3c')],_0x837076[_0xc0e6('0x3e')]);_0x1d1c31[_0xc0e6('0x40')]=_[_0xc0e6('0x3f')](_0x837076[_0xc0e6('0x3c')],qs['fields'](_0x54551[_0xc0e6('0x3e')][_0xc0e6('0x41')]));_0x1d1c31[_0xc0e6('0x40')]=_0x1d1c31['attributes']['length']?_0x1d1c31[_0xc0e6('0x40')]:_0x837076[_0xc0e6('0x3c')];if(!_0x54551[_0xc0e6('0x3e')][_0xc0e6('0x42')]('nolimit')){_0x1d1c31[_0xc0e6('0x43')]=qs[_0xc0e6('0x43')](_0x54551[_0xc0e6('0x3e')]['limit']);_0x1d1c31[_0xc0e6('0x25')]=qs[_0xc0e6('0x25')](_0x54551[_0xc0e6('0x3e')][_0xc0e6('0x25')]);}_0x1d1c31[_0xc0e6('0x44')]=qs['sort'](_0x54551['query']['sort']);_0x1d1c31[_0xc0e6('0x45')]=qs[_0xc0e6('0x46')](_[_0xc0e6('0x47')](_0x54551[_0xc0e6('0x3e')],_0x837076[_0xc0e6('0x46')]),_0x2e3184);var _0x294813=[];var _0xbf5e8b=squel[_0xc0e6('0x48')]()[_0xc0e6('0x49')]('id')['field'](_0xc0e6('0x31'))[_0xc0e6('0x49')](_0xc0e6('0x4a'))['from']('tools_tags');var _0x124b50=squel[_0xc0e6('0x48')]()[_0xc0e6('0x49')](_0xc0e6('0x4b'))[_0xc0e6('0x49')](_0xc0e6('0x4c'))[_0xc0e6('0x49')](_0xc0e6('0x4d'))[_0xc0e6('0x4e')](_0xc0e6('0x4f'),'ui')['left_join'](_0xc0e6('0x50'),'u',_0xc0e6('0x51'));var _0x120316=squel[_0xc0e6('0x48')]()['from']('sms_interactions','i')[_0xc0e6('0x52')](_0xc0e6('0x53'),'c',_0xc0e6('0x54'))['left_join']('users','o',_0xc0e6('0x55'))[_0xc0e6('0x52')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0xc0e6('0x52')](_0xc0e6('0x56'),'me',_0xc0e6('0x57'))[_0xc0e6('0x52')](_0xc0e6('0x58'),'it',_0xc0e6('0x59'))['left_join'](_0xc0e6('0x5a'),'t',_0xc0e6('0x5b'));var _0xbf27ea=squel[_0xc0e6('0x5c')]();var _0x189fd9=[];var _0x3791f3=squel[_0xc0e6('0x5c')]();var _0x4d8339;if(_0x54551['query'][_0xc0e6('0x5d')]){_0x4d8339=as['parseSearch'](_0x54551[_0xc0e6('0x3e')][_0xc0e6('0x5d')]);var _0x15adcc=_0x4d8339[_0xc0e6('0x5e')];for(var _0x53e8ef=0x0;_0x53e8ef<_0x4d8339[_0xc0e6('0x5f')][_0xc0e6('0x60')];_0x53e8ef++){var _0x69d06=_0x4d8339[_0xc0e6('0x5f')][_0x53e8ef];var _0x266ce6='i';var _0x4dcd4b=_[_0xc0e6('0x61')](_0x2e3184,[_0xc0e6('0x31'),_0x69d06['field']]);if(!_0x4dcd4b){switch(_0x69d06[_0xc0e6('0x49')]){case _0xc0e6('0x62'):if(_0x69d06[_0xc0e6('0x63')]==0x1){_0x120316[_0xc0e6('0x64')]('`'+_0x69d06[_0xc0e6('0x49')]+'`\x20=\x200');}else{_0x120316[_0xc0e6('0x64')]('`'+_0x69d06['field']+_0xc0e6('0x65'));}break;case _0xc0e6('0x66'):if(_0x69d06[_0xc0e6('0x67')]===_0xc0e6('0x68')){if(_0x69d06[_0xc0e6('0x63')][_0xc0e6('0x35')]('\x20')[_0xc0e6('0x60')]>0x1){_0xbf27ea[_0x15adcc](_0xc0e6('0x69'),qs[_0xc0e6('0x6a')](_0x69d06[_0xc0e6('0x63')]),null);}else{var _0x44da04='%'+_0x69d06[_0xc0e6('0x63')]+'%';_0xbf27ea[_0x15adcc](_0xc0e6('0x6b'),_0x44da04,_0x44da04,_0x44da04);}}else{_0x4dcd4b=_[_0xc0e6('0x61')](_0x2e3184,[_0xc0e6('0x31'),_0xc0e6('0x6c')]);_0x69d06[_0xc0e6('0x49')]='ContactId';_0x2906cb=as[_0xc0e6('0x6d')](_0x266ce6,_0x4dcd4b[_0xc0e6('0x6e')],_0x69d06);_0xbf27ea[_0x15adcc](_0x2906cb['text'],_0x2906cb['value']['start'],_0x2906cb[_0xc0e6('0x63')][_0xc0e6('0x2e')]);}break;case _0xc0e6('0x6f'):var _0x1f73ee=_0x69d06[_0xc0e6('0x63')][_0xc0e6('0x35')](',')[_0xc0e6('0x3d')](function(_0x23928b){return Number(_0x23928b);});_0x1f73ee[_0xc0e6('0x36')](function(_0x1bd4a0){_0x3791f3['or'](_0xc0e6('0x70'),'%,'+_0x1bd4a0+',%');});_0x189fd9=_['union'](_0x189fd9,_0x1f73ee);break;case _0xc0e6('0x71'):if(_0x69d06[_0xc0e6('0x67')]===_0xc0e6('0x68')){_0xbf27ea[_0x15adcc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x69d06[_0xc0e6('0x63')]+'%',null);}else{_0x4dcd4b=_['find'](_0x2e3184,[_0xc0e6('0x31'),_0xc0e6('0x72')]);_0x69d06['field']=_0xc0e6('0x72');_0x2906cb=as[_0xc0e6('0x6d')](_0x266ce6,_0x4dcd4b['type'],_0x69d06);_0xbf27ea[_0x15adcc](_0x2906cb[_0xc0e6('0x73')],_0x2906cb[_0xc0e6('0x63')]['start'],_0x2906cb[_0xc0e6('0x63')]['end']);}break;case'body':_0x2906cb=as[_0xc0e6('0x6d')]('me',null,_0x69d06);_0xbf27ea[_0x15adcc](_0x2906cb[_0xc0e6('0x73')],_0x2906cb['value'][_0xc0e6('0x74')],_0x2906cb[_0xc0e6('0x63')][_0xc0e6('0x2e')]);break;}}else{var _0x2906cb=as[_0xc0e6('0x6d')](_0x266ce6,_0x4dcd4b[_0xc0e6('0x6e')],_0x69d06);_0xbf27ea[_0x15adcc](_0x2906cb['text'],_0x2906cb['value'][_0xc0e6('0x74')],_0x2906cb[_0xc0e6('0x63')][_0xc0e6('0x2e')]);}}}else{var _0xaf00f9=_(_0x54551['query'])[_0xc0e6('0x75')]()[_0xc0e6('0x3d')](function(_0x55aceb){return _[_0xc0e6('0x76')](_0x2e3184,[_0xc0e6('0x31'),_0x55aceb])?_0x55aceb:undefined;})[_0xc0e6('0x77')]()[_0xc0e6('0x63')]();if(!_[_0xc0e6('0x78')](_0xaf00f9)){_0xaf00f9['forEach'](function(_0x4a6b73){if(_0x4a6b73==='SmsAccountId'){_0x120316[_0xc0e6('0x45')](_0xc0e6('0x79'),[][_0xc0e6('0x7a')](_0x54551['query'][_0x4a6b73]));}else if(_0x4a6b73===_0xc0e6('0x7b')){var _0x267bbc=JSON[_0xc0e6('0x7c')](_0x54551[_0xc0e6('0x3e')][_0x4a6b73])[_0xc0e6('0x7d')];var _0x35b631=JSON[_0xc0e6('0x7c')](_0x54551[_0xc0e6('0x3e')][_0x4a6b73])[_0xc0e6('0x7e')];_0x120316[_0xc0e6('0x45')](_0xc0e6('0x7f'),_0x267bbc,_0x35b631);}else{if(_0x54551[_0xc0e6('0x3e')][_0x4a6b73]===_0xc0e6('0x80')){_0x120316[_0xc0e6('0x45')]('i.'+_0x4a6b73+'\x20IS\x20NULL');}else{_0x120316['where']('i.'+_0x4a6b73+_0xc0e6('0x81'),_0x54551[_0xc0e6('0x3e')][_0x4a6b73]);}}});}if(_0x54551['query']['read']){if(_0x54551[_0xc0e6('0x3e')]['read']==0x1){_0x120316[_0xc0e6('0x64')](_0xc0e6('0x82'));}else{_0x120316['having'](_0xc0e6('0x83'));}}if(_0x54551[_0xc0e6('0x3e')]['tag']){_0x189fd9=_['isArray'](_0x54551[_0xc0e6('0x3e')][_0xc0e6('0x84')])?_0x54551[_0xc0e6('0x3e')][_0xc0e6('0x84')]:new Array(_0x54551[_0xc0e6('0x3e')]['tag']);_0x189fd9[_0xc0e6('0x36')](function(_0x3e45d4){_0x3791f3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3e45d4+',%');});}if(_0x54551['query'][_0xc0e6('0x85')]){var _0x2be142=_0x54551[_0xc0e6('0x3e')][_0xc0e6('0x85')][_0xc0e6('0x86')]('\x5c','\x5c\x5c')[_0xc0e6('0x86')](/'/g,'\x27\x27');if(qs[_0xc0e6('0x87')](_0x2be142)){_0xbf27ea['or'](_0xc0e6('0x88'),_0x2be142+'%')['or'](_0xc0e6('0x89'),_0x2be142+'%');}else{_0xbf27ea['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc0e6('0x6a')](_0x2be142))['or'](_0xc0e6('0x8a'),_0x2be142+'%');}}}_0x120316[_0xc0e6('0x45')](_0xbf27ea);_0x120316[_0xc0e6('0x8b')]('i.id');var _0x1a93ba={'type':db[_0xc0e6('0x8c')][_0xc0e6('0x8d')][_0xc0e6('0x8e')],'raw':!![]};var _0x40262d=_0x120316['clone']();_0x40262d[_0xc0e6('0x49')](_0xc0e6('0x8f'));_0x40262d[_0xc0e6('0x49')](_0xc0e6('0x90'),_0xc0e6('0x62'));if(_0x1d1c31['order']){_0x1d1c31[_0xc0e6('0x44')][_0xc0e6('0x36')](function(_0x15ae4a){var _0x482895=_0x15ae4a[0x0]==='contactName'?_0x15ae4a[0x0]:'i.'+_0x15ae4a[0x0];_0x120316[_0xc0e6('0x44')](_0x482895,_0x15ae4a[0x1]===_0xc0e6('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x189fd9)){_0x120316[_0xc0e6('0x64')](_0x3791f3);_0x40262d['where'](_0xc0e6('0x92'),_0x189fd9);}BPromise[_0xc0e6('0x93')]()[_0xc0e6('0x2c')](function(){if(!_0x4d8339){if(_0x54551[_0xc0e6('0x3e')]['SmsAccountId'])return;_0x40262d['where'](_0xc0e6('0x94'));_0x120316['where'](_0xc0e6('0x94'));return;}if(_0x54551[_0xc0e6('0x95')][_0xc0e6('0x96')]!==_0xc0e6('0x97'))return;return _0x54551['user'][_0xc0e6('0x98')]({'attributes':['id'],'raw':!![]})[_0xc0e6('0x2c')](function(_0x20601d){if(_[_0xc0e6('0x78')](_0x20601d)){_0x40262d[_0xc0e6('0x45')](_0xc0e6('0x99'));_0x120316[_0xc0e6('0x45')](_0xc0e6('0x99'));}else{_0x40262d[_0xc0e6('0x45')](_0xc0e6('0x79'),_[_0xc0e6('0x3d')](_0x20601d,'id'));_0x120316[_0xc0e6('0x45')]('i.SmsAccountId\x20IN\x20?',_[_0xc0e6('0x3d')](_0x20601d,'id'));}});})[_0xc0e6('0x2c')](function(){if(_0x54551[_0xc0e6('0x95')][_0xc0e6('0x96')]===_0xc0e6('0x97')&&!_0x4d8339&&!_0x54551['query'][_0xc0e6('0x9a')])return[];return db['sequelize'][_0xc0e6('0x3e')](_0x40262d[_0xc0e6('0x9b')](),_0x1a93ba);})[_0xc0e6('0x2c')](function(_0x1828a6){_0x444532[_0xc0e6('0x26')]=_0x1828a6['length'];if(_0x444532[_0xc0e6('0x26')]===0x0)return[];return db['sequelize'][_0xc0e6('0x3e')](_0xbf5e8b['toString'](),_0x1a93ba)[_0xc0e6('0x2c')](function(_0xe9cd9d){_0x294813=_[_0xc0e6('0x9c')](_0xe9cd9d,'id');_0x1a93ba=_[_0xc0e6('0x9d')](_0x1a93ba,{'model':db[_0xc0e6('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54551[_0xc0e6('0x3e')][_0xc0e6('0x41')]){_0x1d1c31[_0xc0e6('0x40')][_0xc0e6('0x36')](function(_0x150a65){_0x120316[_0xc0e6('0x49')]('i.'+_0x150a65);});}else{_0x120316['field'](_0xc0e6('0x90'),_0xc0e6('0x62'));_0x120316[_0xc0e6('0x49')]('a.key',_0xc0e6('0x9e'));_0x120316[_0xc0e6('0x49')](_0xc0e6('0x9f'),_0xc0e6('0xa0'));_0x120316['field'](_0xc0e6('0xa1'),_0xc0e6('0xa2'));_0x120316[_0xc0e6('0x49')]('i.*');_0x120316[_0xc0e6('0x49')](_0xc0e6('0xa3'),_0xc0e6('0xa4'));_0x120316['field'](_0xc0e6('0xa5'),_0xc0e6('0xa6'));_0x120316[_0xc0e6('0x49')](_0xc0e6('0xa7'),_0xc0e6('0xa8'));_0x120316[_0xc0e6('0x49')](_0xc0e6('0xa9'),_0xc0e6('0xaa'));_0x120316[_0xc0e6('0x49')](_0xc0e6('0xab'),'Contact.mobile');_0x120316['field'](_0xc0e6('0xac'),_0xc0e6('0xad'));_0x120316[_0xc0e6('0x49')](_0xc0e6('0xae'),_0xc0e6('0xaf'));_0x120316[_0xc0e6('0x49')]('o.internal',_0xc0e6('0xb0'));_0x120316['field'](_0xc0e6('0xb1'),_0xc0e6('0x33'));}if(_0x1d1c31[_0xc0e6('0x43')])_0x120316['limit'](_0x1d1c31['limit']);if(_0x1d1c31['offset'])_0x120316[_0xc0e6('0x25')](_0x1d1c31[_0xc0e6('0x25')]);return db['sequelize'][_0xc0e6('0x3e')](_0x120316[_0xc0e6('0x9b')](),_0x1a93ba);})[_0xc0e6('0x2c')](function(_0x1ade95){if(_0x1ade95[_0xc0e6('0x60')]>0x0)_0x124b50[_0xc0e6('0x45')](_0xc0e6('0xb2'),_[_0xc0e6('0x3d')](_0x1ade95,'id'));return db[_0xc0e6('0xb3')]['query'](_0x124b50[_0xc0e6('0x9b')](),_0x1a93ba)[_0xc0e6('0x2c')](function(_0x15f4cf){var _0xc397be=_[_0xc0e6('0xb4')](_0x15f4cf,'SmsInteractionId');var _0x12e2e0=[];_0x1ade95['forEach'](function(_0x1354f5){_0x12e2e0['push'](updateSmsInteraction(_0x1354f5,_0x294813,_0xc397be));});return BPromise[_0xc0e6('0xb5')](_0x12e2e0);});});})[_0xc0e6('0x2c')](function(_0x3316e6){_0x444532[_0xc0e6('0xb6')]=_0x3316e6;return _0x444532;})[_0xc0e6('0x2c')](respondWithFilteredResult(_0x271d2a,_0x1d1c31))[_0xc0e6('0xb7')](handleError(_0x271d2a,null));};exports[_0xc0e6('0xb8')]=function(_0x9cc1ca,_0x4f0b03){var _0x9a6ee8={'raw':![],'where':{'id':_0x9cc1ca['params']['id']}},_0x4a7148={};_0x4a7148[_0xc0e6('0x3c')]=_[_0xc0e6('0x75')](db[_0xc0e6('0x38')]['rawAttributes']);_0x4a7148[_0xc0e6('0x3e')]=_[_0xc0e6('0x75')](_0x9cc1ca['query']);_0x4a7148[_0xc0e6('0x46')]=_[_0xc0e6('0x3f')](_0x4a7148[_0xc0e6('0x3c')],_0x4a7148[_0xc0e6('0x3e')]);_0x9a6ee8[_0xc0e6('0x40')]=_[_0xc0e6('0x3f')](_0x4a7148[_0xc0e6('0x3c')],qs[_0xc0e6('0x41')](_0x9cc1ca[_0xc0e6('0x3e')][_0xc0e6('0x41')]));_0x9a6ee8[_0xc0e6('0x40')]=_0x9a6ee8['attributes'][_0xc0e6('0x60')]?_0x9a6ee8[_0xc0e6('0x40')]:_0x4a7148[_0xc0e6('0x3c')];if(_0x9cc1ca['query']['includeAll']){_0x9a6ee8[_0xc0e6('0xb9')]=[{'all':!![]}];}_0x9a6ee8=_[_0xc0e6('0x9d')]({},_0x9a6ee8,_0x9cc1ca[_0xc0e6('0xba')]);return db['SmsInteraction'][_0xc0e6('0x61')](_0x9a6ee8)[_0xc0e6('0x2c')](handleEntityNotFound(_0x4f0b03,null))[_0xc0e6('0x2c')](respondWithResult(_0x4f0b03,null))[_0xc0e6('0xb7')](handleError(_0x4f0b03,null));};exports[_0xc0e6('0xbb')]=function(_0x595c97,_0x55f584){return db['SmsInteraction'][_0xc0e6('0xbb')](_0x595c97['body'],{})[_0xc0e6('0x2c')](respondWithResult(_0x55f584,0xc9))[_0xc0e6('0xb7')](handleError(_0x55f584,null));};exports[_0xc0e6('0x2b')]=function(_0x23a914,_0x1d5833){if(_0x23a914[_0xc0e6('0xbc')]['id']){delete _0x23a914[_0xc0e6('0xbc')]['id'];}return db[_0xc0e6('0x38')][_0xc0e6('0x61')]({'where':{'id':_0x23a914[_0xc0e6('0xbd')]['id']}})[_0xc0e6('0x2c')](handleEntityNotFound(_0x1d5833,null))[_0xc0e6('0x2c')](saveUpdates(_0x23a914['body'],null))['then'](respondWithResult(_0x1d5833,null))[_0xc0e6('0xb7')](handleError(_0x1d5833,null));};exports[_0xc0e6('0x2d')]=function(_0x2abe6b,_0x594c90){return db[_0xc0e6('0x38')][_0xc0e6('0x61')]({'where':{'id':_0x2abe6b[_0xc0e6('0xbd')]['id']}})[_0xc0e6('0x2c')](handleEntityNotFound(_0x594c90,null))[_0xc0e6('0x2c')](removeEntity(_0x594c90,null))[_0xc0e6('0xb7')](handleError(_0x594c90,null));};exports[_0xc0e6('0xbe')]=function(_0x18e423,_0x2f3c66){return db[_0xc0e6('0x38')][_0xc0e6('0xbe')]()[_0xc0e6('0x2c')](respondWithResult(_0x2f3c66,null))[_0xc0e6('0xb7')](handleError(_0x2f3c66,null));};exports[_0xc0e6('0xbf')]=function(_0x14fcc9,_0x3942f5,_0xd9c818){return db[_0xc0e6('0xc0')]['find']({'where':{'id':_0x14fcc9[_0xc0e6('0xbd')]['id']}})[_0xc0e6('0x2c')](handleEntityNotFound(_0x3942f5,null))[_0xc0e6('0x2c')](function(_0x1b16c5){if(_0x1b16c5){return _0x1b16c5[_0xc0e6('0xbf')](_0x14fcc9[_0xc0e6('0xbc')][_0xc0e6('0xc1')],_[_0xc0e6('0xc2')](_0x14fcc9['body'],['ids','id'])||{});}})[_0xc0e6('0x2c')](respondWithResult(_0x3942f5,null))[_0xc0e6('0xb7')](handleError(_0x3942f5,null));};exports[_0xc0e6('0xc3')]=function(_0xdfa688,_0x554fc6,_0x287582){var _0x1b4b72={'raw':![],'where':{}};var _0x1f0575={};var _0x132544={'count':0x0,'rows':[]};return db[_0xc0e6('0x38')][_0xc0e6('0xc4')]({'where':{'id':_0xdfa688[_0xc0e6('0xbd')]['id']}})['then'](handleEntityNotFound(_0x554fc6,null))[_0xc0e6('0x2c')](function(_0x465c6f){if(_0x465c6f){_0x1f0575[_0xc0e6('0x3c')]=_['keys'](db[_0xc0e6('0xc0')][_0xc0e6('0x39')]);_0x1f0575[_0xc0e6('0x3e')]=_['keys'](_0xdfa688['query']);_0x1f0575[_0xc0e6('0x46')]=_[_0xc0e6('0x3f')](_0x1f0575['model'],_0x1f0575[_0xc0e6('0x3e')]);_0x1b4b72[_0xc0e6('0x40')]=_[_0xc0e6('0x3f')](_0x1f0575[_0xc0e6('0x3c')],qs[_0xc0e6('0x41')](_0xdfa688[_0xc0e6('0x3e')][_0xc0e6('0x41')]));_0x1b4b72[_0xc0e6('0x40')]=_0x1b4b72[_0xc0e6('0x40')][_0xc0e6('0x60')]?_0x1b4b72[_0xc0e6('0x40')]:_0x1f0575[_0xc0e6('0x3c')];if(!_0xdfa688[_0xc0e6('0x3e')]['hasOwnProperty'](_0xc0e6('0xc5'))){_0x1b4b72[_0xc0e6('0x43')]=qs[_0xc0e6('0x43')](_0xdfa688['query'][_0xc0e6('0x43')]);_0x1b4b72['offset']=qs[_0xc0e6('0x25')](_0xdfa688[_0xc0e6('0x3e')][_0xc0e6('0x25')]);}_0x1b4b72[_0xc0e6('0x44')]=qs['sort'](_0xdfa688[_0xc0e6('0x3e')][_0xc0e6('0xc6')]);_0x1b4b72[_0xc0e6('0x45')]=qs[_0xc0e6('0x46')](_[_0xc0e6('0x47')](_0xdfa688[_0xc0e6('0x3e')],_0x1f0575[_0xc0e6('0x46')]));_0x1b4b72[_0xc0e6('0x45')][_0xc0e6('0xc7')]=_0x465c6f['id'];if(_0xdfa688[_0xc0e6('0x3e')][_0xc0e6('0x85')]){_0x1b4b72['where']=_[_0xc0e6('0x9d')](_0x1b4b72[_0xc0e6('0x45')],{'$or':_['map'](_0x1b4b72[_0xc0e6('0x40')],function(_0xa7957f){var _0x2bec3d={};_0x2bec3d[_0xa7957f]={'$like':'%'+_0xdfa688['query'][_0xc0e6('0x85')]+'%'};return _0x2bec3d;})});}if(_0xdfa688[_0xc0e6('0x3e')][_0xc0e6('0x7d')]){var _0x2f86bf=_0xdfa688[_0xc0e6('0x3e')][_0xc0e6('0x7d')][_0xc0e6('0x35')](',');var _0x1ad8f5={};_0x1ad8f5[_0x2f86bf[0x0]]={'$gte':moment(_0x2f86bf[0x1])[_0xc0e6('0xc8')](_0xc0e6('0xc9'))};_0x1b4b72[_0xc0e6('0x45')]=_[_0xc0e6('0x9d')](_0x1b4b72['where'],_0x1ad8f5);}_0x1b4b72=_['merge']({},_0x1b4b72,_0xdfa688[_0xc0e6('0xba')]);return db[_0xc0e6('0xc0')][_0xc0e6('0x26')]({'where':_0x1b4b72[_0xc0e6('0x45')]})[_0xc0e6('0x2c')](function(_0x3a6f63){_0x132544[_0xc0e6('0x26')]=_0x3a6f63;if(_0xdfa688[_0xc0e6('0x3e')][_0xc0e6('0xca')]){_0x1b4b72[_0xc0e6('0xb9')]=[{'all':!![]}];}return db[_0xc0e6('0xc0')][_0xc0e6('0xcb')](_0x1b4b72);})[_0xc0e6('0x2c')](function(_0x24931a){_0x132544[_0xc0e6('0xb6')]=_0x24931a;return _0x132544;});}})[_0xc0e6('0x2c')](respondWithFilteredResult(_0x554fc6,_0x1b4b72))[_0xc0e6('0xb7')](handleError(_0x554fc6,null));};exports['addTags']=function(_0x4a91cd,_0x126b31,_0x37061e){return db['SmsInteraction']['find']({'where':{'id':_0x4a91cd[_0xc0e6('0xbd')]['id']}})[_0xc0e6('0x2c')](handleEntityNotFound(_0x126b31,null))[_0xc0e6('0x2c')](function(_0x35084b){if(_0x35084b){return _0x35084b[_0xc0e6('0xcc')](_0x4a91cd['body']['ids'],_[_0xc0e6('0xc2')](_0x4a91cd[_0xc0e6('0xbc')],[_0xc0e6('0xc1'),'id'])||{})[_0xc0e6('0xcd')](function(){return db['Tag']['findAll']({'attributes':['id',_0xc0e6('0x31'),_0xc0e6('0x4a')],'where':{'id':_0x4a91cd[_0xc0e6('0xbc')][_0xc0e6('0xc1')]}});})[_0xc0e6('0x2c')](function(_0x518443){socket[_0xc0e6('0xce')](_0xc0e6('0xcf'),{'id':Number(_0x4a91cd[_0xc0e6('0xbd')]['id']),'tags':_0x518443||[]});return{'id':Number(_0x4a91cd[_0xc0e6('0xbd')]['id']),'tags':_0x518443||[]};});}})[_0xc0e6('0x2c')](respondWithResult(_0x126b31,null))[_0xc0e6('0xb7')](handleError(_0x126b31,null));};exports[_0xc0e6('0xd0')]=function(_0x55b57c,_0x2f25a3,_0x31568){return db[_0xc0e6('0x38')]['find']({'where':{'id':_0x55b57c[_0xc0e6('0xbd')]['id']}})[_0xc0e6('0x2c')](handleEntityNotFound(_0x2f25a3,null))[_0xc0e6('0x2c')](function(_0x4ed408){if(_0x4ed408){return _0x4ed408[_0xc0e6('0xd0')](_0x55b57c['query']['ids']);}})['then'](respondWithStatusCode(_0x2f25a3,null))[_0xc0e6('0xb7')](handleError(_0x2f25a3,null));};exports[_0xc0e6('0xd1')]=function(_0x1047c6,_0x74abee){var _0x22b178=moment()[_0xc0e6('0xd2')]()[_0xc0e6('0x9b')]();var _0x5293d3=path[_0xc0e6('0xd3')](config[_0xc0e6('0xd4')],_0xc0e6('0xd5'),_0xc0e6('0xd6'),_0xc0e6('0xd7'));var _0x45e965=path[_0xc0e6('0xd3')](config['root'],'server','files',_0xc0e6('0xd8'));var _0x372430=path[_0xc0e6('0xd3')](_0x5293d3,_0x22b178);var _0x40cc90=util['format'](_0xc0e6('0xd9'),_0x1047c6[_0xc0e6('0xbd')]['id'],_0x22b178);var _0x30cd13=path['join'](_0x5293d3,_0x40cc90);var _0x5110f7=[];_0x5110f7[_0xc0e6('0x37')]({'model':db[_0xc0e6('0x71')],'as':_0xc0e6('0x71'),'attributes':['id',_0xc0e6('0x32')],'raw':!![]});_0x5110f7[_0xc0e6('0x37')]({'model':db['CmContact'],'as':_0xc0e6('0x66'),'attributes':['id',_0xc0e6('0xda'),_0xc0e6('0xdb')],'raw':!![]});var _0x2988e3=[{'model':db[_0xc0e6('0xc0')],'as':_0xc0e6('0xdc'),'attributes':['id','body',_0xc0e6('0x7b'),'direction',_0xc0e6('0xdd'),_0xc0e6('0xde')],'include':_0x5110f7}];_0x2988e3[_0xc0e6('0x37')]({'model':db[_0xc0e6('0xdf')],'as':_0xc0e6('0xe0'),'attributes':['id',_0xc0e6('0x31')]});_0x2988e3[_0xc0e6('0x37')]({'model':db[_0xc0e6('0x71')],'as':'Owner','attributes':['id',_0xc0e6('0x32')]});return db['SmsInteraction'][_0xc0e6('0x61')]({'where':{'id':_0x1047c6[_0xc0e6('0xbd')]['id']},'include':_0x2988e3})[_0xc0e6('0x2c')](handleEntityNotFound(_0x74abee,null))[_0xc0e6('0x2c')](function(_0x49e929){if(_0x49e929){var _0x5a541e=_0x49e929[_0xc0e6('0xe1')]({'plain':!![]});fs[_0xc0e6('0xe2')](_0x372430);var _0xebdd96={'channel':_0xc0e6('0xe3'),'account':_0x5a541e['Account'][_0xc0e6('0x31')],'agent':_0x5a541e[_0xc0e6('0xe4')]?_0x5a541e[_0xc0e6('0xe4')][_0xc0e6('0x32')]:_0xc0e6('0xe5'),'createdAt':moment(_0x5a541e[_0xc0e6('0x7b')])['format'](_0xc0e6('0xc9'))[_0xc0e6('0x9b')](),'closedAt':_0x5a541e['closed']?moment(_0x5a541e[_0xc0e6('0xe6')])['format'](_0xc0e6('0xc9'))['toString']():'','disposition':_0x5a541e[_0xc0e6('0xe7')],'messages':_(_0x5a541e['Messages'])['filter']({'secret':![]})[_0xc0e6('0x3d')](function(_0x7dc716){return{'date':moment(_0x7dc716['createdAt'])[_0xc0e6('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc0e6('0x9b')](),'sender':_0x7dc716[_0xc0e6('0xe8')]===_0xc0e6('0xe9')?_0x7dc716[_0xc0e6('0x71')]?_0x7dc716['User'][_0xc0e6('0x32')]:_0xc0e6('0xea'):_0x7dc716['Contact'][_0xc0e6('0xda')]+(_0x7dc716[_0xc0e6('0x66')][_0xc0e6('0xdb')]?'\x20'+_0x7dc716['Contact'][_0xc0e6('0xdb')]:''),'body':_0x7dc716[_0xc0e6('0xbc')],'direction':_0x7dc716[_0xc0e6('0xe8')]===_0xc0e6('0xe9')?'A':'C','secret':_0x7dc716['secret'],'read':_0x7dc716[_0xc0e6('0xde')]};})['value']()};return ejs[_0xc0e6('0xeb')](path[_0xc0e6('0xd3')](config[_0xc0e6('0xd4')],_0xc0e6('0xd5'),_0xc0e6('0xec'),_0xc0e6('0xed')),{'interaction':_0xebdd96})[_0xc0e6('0x2c')](function(_0x5e3e2d){var _0x372d89=path['join'](_0x372430,_0xc0e6('0xee')+_0x5a541e['id']+'-'+_0x22b178+'.pdf');var _0x411c1d={'path':_0x372d89,'channel':'Sms','interactionId':_0x5a541e['id']};return pdf[_0xc0e6('0xef')](_0x5e3e2d,_0x411c1d);})[_0xc0e6('0x2c')](function(){return new BPromise(function(_0x5b67ac,_0xfe9ec){zipdir(_0x372430,{'saveTo':_0x30cd13},function(_0x3b59a3,_0x736c73){if(_0x3b59a3)return _0xfe9ec(_0x3b59a3);return _0x5b67ac(_0x736c73);});})[_0xc0e6('0x2c')](function(){return new BPromise(function(_0x3ca564,_0x35b21f){rimraf(_0x372430,function(_0x137f92){if(_0x137f92)_0x35b21f(_0x137f92);return _0x3ca564();});});})[_0xc0e6('0x2c')](function(){return _0x74abee[_0xc0e6('0xd1')](_0x30cd13,_0x40cc90,function(_0x410781){if(_0x410781){console[_0xc0e6('0xf0')]('err',_0x410781);}else{fs[_0xc0e6('0xf1')](_0x30cd13);}});});});}else{return _0x74abee[_0xc0e6('0x21')](0xc8);}})['catch'](handleError(_0x74abee,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 0a4db9f..2922a48 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 _0x4cf8=['unreadMessages','length','emit','catch','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll'];(function(_0xd12371,_0x59e049){var _0x217ba0=function(_0x3d3fb2){while(--_0x3d3fb2){_0xd12371['push'](_0xd12371['shift']());}};_0x217ba0(++_0x59e049);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x55257d,_0x3998ec){_0x55257d=_0x55257d-0x0;var _0x4d296d=_0x4cf8[_0x55257d];return _0x4d296d;};'use strict';var EventEmitter=require(_0x84cf('0x0'));var SmsInteraction=require(_0x84cf('0x1'))['db'][_0x84cf('0x2')];var SmsMessage=require(_0x84cf('0x1'))['db'][_0x84cf('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x84cf('0x4')](0x0);var events={'afterCreate':_0x84cf('0x5'),'afterUpdate':_0x84cf('0x6'),'afterDestroy':_0x84cf('0x7')};function emitEvent(_0x2d38c0){return function(_0x5844d7,_0x2c613d,_0x50ade2){_0x5844d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x84cf('0x8')](function(_0x56c5cc){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xa'),_0x56c5cc['map'](function(_0x2e0b79){return{'id':_0x2e0b79['id']};}));return SmsMessage[_0x84cf('0xb')]({'where':{'SmsInteractionId':_0x5844d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfb5398){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xc'),_0xfb5398[_0x84cf('0xd')]);SmsInteractionEvents['emit'](_0x2d38c0+':'+_0x5844d7['id'],_0x5844d7);SmsInteractionEvents[_0x84cf('0xe')](_0x2d38c0,_0x5844d7);_0x50ade2(null);})[_0x84cf('0xf')](_0x50ade2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x84cf('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xc2c7=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then'];(function(_0x4b78ec,_0x3615a5){var _0x480e49=function(_0x26baf4){while(--_0x26baf4){_0x4b78ec['push'](_0x4b78ec['shift']());}};_0x480e49(++_0x3615a5);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2bfc2a,_0x500723){_0x2bfc2a=_0x2bfc2a-0x0;var _0x5fd267=_0xc2c7[_0x2bfc2a];return _0x5fd267;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x7c2c('0x0'))['db'][_0x7c2c('0x1')];var SmsMessage=require(_0x7c2c('0x0'))['db'][_0x7c2c('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7c2c('0x3')](0x0);var events={'afterCreate':_0x7c2c('0x4'),'afterUpdate':_0x7c2c('0x5'),'afterDestroy':_0x7c2c('0x6')};function emitEvent(_0x4bbc14){return function(_0x59f346,_0x31dc4e,_0x42ecc9){_0x59f346[_0x7c2c('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4abe93){_0x59f346['setDataValue'](_0x7c2c('0x8'),_0x4abe93[_0x7c2c('0x9')](function(_0x3e668f){return{'id':_0x3e668f['id']};}));return SmsMessage[_0x7c2c('0xa')]({'where':{'SmsInteractionId':_0x59f346['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c2c('0xb')](function(_0x57b107){_0x59f346[_0x7c2c('0xc')](_0x7c2c('0xd'),_0x57b107[_0x7c2c('0xe')]);SmsInteractionEvents[_0x7c2c('0xf')](_0x4bbc14+':'+_0x59f346['id'],_0x59f346);SmsInteractionEvents[_0x7c2c('0xf')](_0x4bbc14,_0x59f346);_0x42ecc9(null);})[_0x7c2c('0x10')](_0x42ecc9(null));};}for(var e in events){if(events[_0x7c2c('0x11')](e)){var event=events[e];SmsInteraction[_0x7c2c('0x12')](e,emitEvent(event));}}module[_0x7c2c('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 06343c1..663da8c 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 _0xdda6=['YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','changed','closed'];(function(_0x5ea22f,_0x128142){var _0x4d878c=function(_0x334e3c){while(--_0x334e3c){_0x5ea22f['push'](_0x5ea22f['shift']());}};_0x4d878c(++_0x128142);}(_0xdda6,0x199));var _0x6dda=function(_0x3def1b,_0x56f748){_0x3def1b=_0x3def1b-0x0;var _0x57340e=_0xdda6[_0x3def1b];return _0x57340e;};'use strict';var _=require('lodash');var util=require(_0x6dda('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6dda('0x1'));var BPromise=require(_0x6dda('0x2'));var rp=require(_0x6dda('0x3'));var fs=require('fs');var path=require(_0x6dda('0x4'));var rimraf=require('rimraf');var config=require(_0x6dda('0x5'));var attributes=require(_0x6dda('0x6'));module[_0x6dda('0x7')]=function(_0x1332e8,_0x472013){return _0x1332e8[_0x6dda('0x8')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a5a3c,_0x1a7a9f,_0x16a4ed){if(_0x5a5a3c[_0x6dda('0x9')](_0x6dda('0xa'))){_0x5a5a3c['closedAt']=moment()['format'](_0x6dda('0xb'));}_0x16a4ed(null,_0x5a5a3c);}}});}; \ No newline at end of file +var _0xd45a=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd45a,0x118));var _0xad45=function(_0x3fa062,_0x50fd08){_0x3fa062=_0x3fa062-0x0;var _0x480869=_0xd45a[_0x3fa062];return _0x480869;};'use strict';var _=require('lodash');var util=require(_0xad45('0x0'));var logger=require(_0xad45('0x1'))('api');var moment=require(_0xad45('0x2'));var BPromise=require(_0xad45('0x3'));var rp=require(_0xad45('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad45('0x5'));var config=require('../../config/environment');var attributes=require(_0xad45('0x6'));module[_0xad45('0x7')]=function(_0xa3f4f0,_0x55bfb8){return _0xa3f4f0['define'](_0xad45('0x8'),attributes,{'tableName':_0xad45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2303ee,_0x57ada0,_0x7ac24f){if(_0x2303ee[_0xad45('0xa')](_0xad45('0xb'))){_0x2303ee[_0xad45('0xc')]=moment()[_0xad45('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x7ac24f(null,_0x2303ee);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index dff229e..20045f5 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 _0xbe50=['result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsInteraction,\x20%s,\x20%s','message'];(function(_0x5ad778,_0x410a27){var _0x15f4f4=function(_0x18e295){while(--_0x18e295){_0x5ad778['push'](_0x5ad778['shift']());}};_0x15f4f4(++_0x410a27);}(_0xbe50,0x144));var _0x0be5=function(_0x4364bf,_0x266759){_0x4364bf=_0x4364bf-0x0;var _0x13b177=_0xbe50[_0x4364bf];return _0x13b177;};'use strict';var _=require(_0x0be5('0x0'));var util=require(_0x0be5('0x1'));var moment=require(_0x0be5('0x2'));var BPromise=require(_0x0be5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0be5('0x4'));var db=require(_0x0be5('0x5'))['db'];var utils=require(_0x0be5('0x6'));var logger=require(_0x0be5('0x7'))(_0x0be5('0x8'));var config=require(_0x0be5('0x9'));var jayson=require(_0x0be5('0xa'));var client=jayson[_0x0be5('0xb')][_0x0be5('0xc')]({'port':0x232a});config[_0x0be5('0xd')]=_[_0x0be5('0xe')](config[_0x0be5('0xd')],{'host':_0x0be5('0xf'),'port':0x18eb});var socket=require(_0x0be5('0x10'))(new Redis(config[_0x0be5('0xd')]));require('./smsInteraction.socket')[_0x0be5('0x11')](socket);function respondWithRpcPromise(_0x2ceb9e,_0x380050,_0x501bba){return new BPromise(function(_0x488d17,_0x48e5ca){return client[_0x0be5('0x12')](_0x2ceb9e,_0x501bba)[_0x0be5('0x13')](function(_0x26c8ff){logger[_0x0be5('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x380050,'request\x20sent');logger[_0x0be5('0x15')](_0x0be5('0x16'),_0x380050,_0x0be5('0x17'),JSON[_0x0be5('0x18')](_0x26c8ff));if(_0x26c8ff['error']){if(_0x26c8ff[_0x0be5('0x19')]['code']===0x1f4){logger[_0x0be5('0x19')](_0x0be5('0x1a'),_0x380050,_0x26c8ff[_0x0be5('0x19')]['message']);return _0x48e5ca(_0x26c8ff[_0x0be5('0x19')]['message']);}logger['error'](_0x0be5('0x1a'),_0x380050,_0x26c8ff[_0x0be5('0x19')][_0x0be5('0x1b')]);return _0x488d17(_0x26c8ff[_0x0be5('0x19')]['message']);}else{logger[_0x0be5('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x380050,_0x0be5('0x17'));_0x488d17(_0x26c8ff[_0x0be5('0x1c')][_0x0be5('0x1b')]);}})[_0x0be5('0x1d')](function(_0x4e9597){logger[_0x0be5('0x19')](_0x0be5('0x1a'),_0x380050,_0x4e9597);_0x48e5ca(_0x4e9597);});});}exports[_0x0be5('0x1e')]=function(_0x481507){var _0x42ac19=this;return new Promise(function(_0x522376,_0x46e238){return db[_0x0be5('0x1f')][_0x0be5('0x20')](_0x481507[_0x0be5('0x21')],{'raw':_0x481507[_0x0be5('0x22')]?_0x481507[_0x0be5('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x481507[_0x0be5('0x22')]?_0x481507[_0x0be5('0x22')][_0x0be5('0x23')]||null:null,'attributes':_0x481507['options']?_0x481507[_0x0be5('0x22')]['attributes']||null:null,'limit':_0x481507['options']?_0x481507[_0x0be5('0x22')][_0x0be5('0x24')]||null:null})['then'](function(_0x3ed88d){logger[_0x0be5('0x14')](_0x0be5('0x1e'),_0x481507);logger[_0x0be5('0x15')](_0x0be5('0x1e'),_0x481507,JSON[_0x0be5('0x18')](_0x3ed88d));_0x522376(_0x3ed88d);})[_0x0be5('0x1d')](function(_0x4d5494){logger[_0x0be5('0x19')](_0x0be5('0x1e'),_0x4d5494[_0x0be5('0x1b')],_0x481507);_0x46e238(_0x42ac19['error'](0x1f4,_0x4d5494[_0x0be5('0x1b')]));});});};exports[_0x0be5('0x25')]=function(_0x4ff07f){return new Promise(function(_0x1080f9,_0x715715){return db[_0x0be5('0x1f')][_0x0be5('0x26')]({'where':_0x4ff07f[_0x0be5('0x22')]?_0x4ff07f['options'][_0x0be5('0x23')]||null:null})[_0x0be5('0x13')](function(_0x4aeed1){if(_0x4aeed1){return _0x4aeed1[_0x0be5('0x27')](_0x4ff07f['body'][_0x0be5('0x28')],_[_0x0be5('0x29')](_0x4ff07f[_0x0be5('0x21')],[_0x0be5('0x28'),'id'])||{});}})[_0x0be5('0x2a')](function(_0x35232c){logger['info'](_0x0be5('0x2b'),_0x4ff07f);logger[_0x0be5('0x15')](_0x0be5('0x2b'),_0x4ff07f,JSON['stringify'](_0x35232c));_0x1080f9(_0x35232c);})[_0x0be5('0x1d')](function(_0x5e9d33){logger[_0x0be5('0x19')]('AddTags',_0x5e9d33[_0x0be5('0x1b')],_0x4ff07f);_0x715715(_this[_0x0be5('0x19')](0x1f4,_0x5e9d33[_0x0be5('0x1b')]));});});}; \ No newline at end of file +var _0xb1c3=['AddTagsToSmsInteraction','find','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsInteraction','update','body','options','raw','attributes','limit','UpdateSmsInteraction'];(function(_0x153d29,_0x1eb9d9){var _0x55c71b=function(_0x4c7d3e){while(--_0x4c7d3e){_0x153d29['push'](_0x153d29['shift']());}};_0x55c71b(++_0x1eb9d9);}(_0xb1c3,0x80));var _0x3b1c=function(_0x4ee6c8,_0x14109c){_0x4ee6c8=_0x4ee6c8-0x0;var _0x574067=_0xb1c3[_0x4ee6c8];return _0x574067;};'use strict';var _=require(_0x3b1c('0x0'));var util=require(_0x3b1c('0x1'));var moment=require('moment');var BPromise=require(_0x3b1c('0x2'));var rs=require(_0x3b1c('0x3'));var fs=require('fs');var Redis=require(_0x3b1c('0x4'));var db=require(_0x3b1c('0x5'))['db'];var utils=require(_0x3b1c('0x6'));var logger=require(_0x3b1c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3b1c('0x8'));var client=jayson[_0x3b1c('0x9')][_0x3b1c('0xa')]({'port':0x232a});config[_0x3b1c('0xb')]=_[_0x3b1c('0xc')](config[_0x3b1c('0xb')],{'host':_0x3b1c('0xd'),'port':0x18eb});var socket=require(_0x3b1c('0xe'))(new Redis(config[_0x3b1c('0xb')]));require(_0x3b1c('0xf'))['register'](socket);function respondWithRpcPromise(_0x2c6555,_0x1812f1,_0x5919d7){return new BPromise(function(_0x18e749,_0x179769){return client[_0x3b1c('0x10')](_0x2c6555,_0x5919d7)[_0x3b1c('0x11')](function(_0x73cf84){logger[_0x3b1c('0x12')](_0x3b1c('0x13'),_0x1812f1,_0x3b1c('0x14'));logger[_0x3b1c('0x15')](_0x3b1c('0x16'),_0x1812f1,_0x3b1c('0x14'),JSON[_0x3b1c('0x17')](_0x73cf84));if(_0x73cf84[_0x3b1c('0x18')]){if(_0x73cf84[_0x3b1c('0x18')]['code']===0x1f4){logger[_0x3b1c('0x18')](_0x3b1c('0x13'),_0x1812f1,_0x73cf84[_0x3b1c('0x18')]['message']);return _0x179769(_0x73cf84[_0x3b1c('0x18')][_0x3b1c('0x19')]);}logger['error'](_0x3b1c('0x13'),_0x1812f1,_0x73cf84[_0x3b1c('0x18')][_0x3b1c('0x19')]);return _0x18e749(_0x73cf84[_0x3b1c('0x18')][_0x3b1c('0x19')]);}else{logger[_0x3b1c('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x1812f1,_0x3b1c('0x14'));_0x18e749(_0x73cf84[_0x3b1c('0x1a')]['message']);}})[_0x3b1c('0x1b')](function(_0x51c32c){logger[_0x3b1c('0x18')](_0x3b1c('0x13'),_0x1812f1,_0x51c32c);_0x179769(_0x51c32c);});});}exports['UpdateSmsInteraction']=function(_0x4e5415){var _0x1a4633=this;return new Promise(function(_0x18592d,_0x26d9f6){return db[_0x3b1c('0x1c')][_0x3b1c('0x1d')](_0x4e5415[_0x3b1c('0x1e')],{'raw':_0x4e5415[_0x3b1c('0x1f')]?_0x4e5415[_0x3b1c('0x1f')][_0x3b1c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5415[_0x3b1c('0x1f')]?_0x4e5415[_0x3b1c('0x1f')]['where']||null:null,'attributes':_0x4e5415[_0x3b1c('0x1f')]?_0x4e5415[_0x3b1c('0x1f')][_0x3b1c('0x21')]||null:null,'limit':_0x4e5415[_0x3b1c('0x1f')]?_0x4e5415[_0x3b1c('0x1f')][_0x3b1c('0x22')]||null:null})['then'](function(_0x35cf63){logger[_0x3b1c('0x12')](_0x3b1c('0x23'),_0x4e5415);logger[_0x3b1c('0x15')](_0x3b1c('0x23'),_0x4e5415,JSON['stringify'](_0x35cf63));_0x18592d(_0x35cf63);})[_0x3b1c('0x1b')](function(_0x13fa81){logger[_0x3b1c('0x18')](_0x3b1c('0x23'),_0x13fa81[_0x3b1c('0x19')],_0x4e5415);_0x26d9f6(_0x1a4633[_0x3b1c('0x18')](0x1f4,_0x13fa81['message']));});});};exports[_0x3b1c('0x24')]=function(_0xd61760){return new Promise(function(_0x538d93,_0x4aa1da){return db['SmsInteraction'][_0x3b1c('0x25')]({'where':_0xd61760['options']?_0xd61760[_0x3b1c('0x1f')]['where']||null:null})['then'](function(_0x3f7e2a){if(_0x3f7e2a){return _0x3f7e2a['addTags'](_0xd61760[_0x3b1c('0x1e')][_0x3b1c('0x26')],_['omit'](_0xd61760[_0x3b1c('0x1e')],[_0x3b1c('0x26'),'id'])||{});}})[_0x3b1c('0x27')](function(_0x57457a){logger[_0x3b1c('0x12')](_0x3b1c('0x28'),_0xd61760);logger[_0x3b1c('0x15')](_0x3b1c('0x28'),_0xd61760,JSON[_0x3b1c('0x17')](_0x57457a));_0x538d93(_0x57457a);})['catch'](function(_0x53a90f){logger[_0x3b1c('0x18')](_0x3b1c('0x28'),_0x53a90f['message'],_0xd61760);_0x4aa1da(_this[_0x3b1c('0x18')](0x1f4,_0x53a90f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 349de5c..ada2237 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 _0xc754=['length','./smsInteraction.events','save','remove','update','removeListener','register'];(function(_0x186710,_0x2605b2){var _0x5d50bc=function(_0x51a6b5){while(--_0x51a6b5){_0x186710['push'](_0x186710['shift']());}};_0x5d50bc(++_0x2605b2);}(_0xc754,0x174));var _0x4c75=function(_0x5d1b2c,_0x198dd2){_0x5d1b2c=_0x5d1b2c-0x0;var _0x409067=_0xc754[_0x5d1b2c];return _0x409067;};'use strict';var SmsInteractionEvents=require(_0x4c75('0x0'));var events=[_0x4c75('0x1'),_0x4c75('0x2'),_0x4c75('0x3')];function createListener(_0x1f616f,_0x1e59cf){return function(_0x857e8c){_0x1e59cf['emit'](_0x1f616f,_0x857e8c);};}function removeListener(_0x1cbaba,_0x58eb83){return function(){SmsInteractionEvents[_0x4c75('0x4')](_0x1cbaba,_0x58eb83);};}exports[_0x4c75('0x5')]=function(_0x53f4d9){for(var _0x187385=0x0,_0x6bb444=events[_0x4c75('0x6')];_0x187385<_0x6bb444;_0x187385++){var _0x14872a=events[_0x187385];var _0x3d0d49=createListener('smsInteraction:'+_0x14872a,_0x53f4d9);SmsInteractionEvents['on'](_0x14872a,_0x3d0d49);}}; \ No newline at end of file +var _0x228c=['update','removeListener','register','length','smsInteraction:','remove'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x228c,0x1d3));var _0xc228=function(_0x55f480,_0x256438){_0x55f480=_0x55f480-0x0;var _0x13dfa1=_0x228c[_0x55f480];return _0x13dfa1;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0xc228('0x0'),_0xc228('0x1')];function createListener(_0x398aaa,_0x1565b9){return function(_0x335321){_0x1565b9['emit'](_0x398aaa,_0x335321);};}function removeListener(_0x9d033b,_0x30aaa0){return function(){SmsInteractionEvents[_0xc228('0x2')](_0x9d033b,_0x30aaa0);};}exports[_0xc228('0x3')]=function(_0x46bc74){for(var _0x279f6f=0x0,_0x3c99b5=events[_0xc228('0x4')];_0x279f6f<_0x3c99b5;_0x279f6f++){var _0x4da05e=events[_0x279f6f];var _0x111a72=createListener(_0xc228('0x5')+_0x4da05e,_0x46bc74);SmsInteractionEvents['on'](_0x4da05e,_0x111a72);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c635963..48e9c0d 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 _0x9036=['/:id','post','tracked','smsmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5c8760,_0x1a9110){var _0x23eba4=function(_0x36ce47){while(--_0x36ce47){_0x5c8760['push'](_0x5c8760['shift']());}};_0x23eba4(++_0x1a9110);}(_0x9036,0x151));var _0x6903=function(_0x4959fd,_0x186515){_0x4959fd=_0x4959fd-0x0;var _0x97de01=_0x9036[_0x4959fd];return _0x97de01;};'use strict';var multer=require(_0x6903('0x0'));var util=require(_0x6903('0x1'));var path=require(_0x6903('0x2'));var timeout=require('connect-timeout');var express=require(_0x6903('0x3'));var router=express[_0x6903('0x4')]();var fs_extra=require(_0x6903('0x5'));var auth=require(_0x6903('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6903('0x7'));router[_0x6903('0x8')]('/',auth[_0x6903('0x9')](),controller[_0x6903('0xa')]);router['get'](_0x6903('0xb'),auth[_0x6903('0x9')](),controller[_0x6903('0xc')]);router[_0x6903('0x8')](_0x6903('0xd'),auth[_0x6903('0x9')](),controller['show']);router[_0x6903('0xe')]('/',auth[_0x6903('0x9')](),interaction[_0x6903('0xf')]('sms',_0x6903('0x10')),controller[_0x6903('0x11')]);router['post']('/:id/status',controller['status']);router[_0x6903('0x12')](_0x6903('0xd'),auth[_0x6903('0x9')](),controller[_0x6903('0x13')]);router[_0x6903('0x12')](_0x6903('0x14'),auth[_0x6903('0x9')](),controller[_0x6903('0x15')]);router[_0x6903('0x12')](_0x6903('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x6903('0x17')]('/:id',auth[_0x6903('0x9')](),controller[_0x6903('0x18')]);module['exports']=router; \ No newline at end of file +var _0x6169=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','index','isAuthenticated','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x1fac7a,_0xdd326){var _0x27f2d3=function(_0x536e43){while(--_0x536e43){_0x1fac7a['push'](_0x1fac7a['shift']());}};_0x27f2d3(++_0xdd326);}(_0x6169,0x162));var _0x9616=function(_0x11eb92,_0x22f483){_0x11eb92=_0x11eb92-0x0;var _0x141953=_0x6169[_0x11eb92];return _0x141953;};'use strict';var multer=require(_0x9616('0x0'));var util=require(_0x9616('0x1'));var path=require('path');var timeout=require(_0x9616('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9616('0x3'));var auth=require(_0x9616('0x4'));var interaction=require(_0x9616('0x5'));var config=require('../../config/environment');var controller=require(_0x9616('0x6'));router[_0x9616('0x7')]('/',auth['isAuthenticated'](),controller[_0x9616('0x8')]);router[_0x9616('0x7')]('/describe',auth[_0x9616('0x9')](),controller['describe']);router[_0x9616('0x7')](_0x9616('0xa'),auth[_0x9616('0x9')](),controller[_0x9616('0xb')]);router[_0x9616('0xc')]('/',auth['isAuthenticated'](),interaction[_0x9616('0xd')](_0x9616('0xe'),_0x9616('0xf')),controller[_0x9616('0x10')]);router[_0x9616('0xc')](_0x9616('0x11'),controller[_0x9616('0x12')]);router[_0x9616('0x13')](_0x9616('0xa'),auth[_0x9616('0x9')](),controller[_0x9616('0x14')]);router[_0x9616('0x13')](_0x9616('0x15'),auth[_0x9616('0x9')](),controller[_0x9616('0x16')]);router[_0x9616('0x13')](_0x9616('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x9616('0x18')](_0x9616('0xa'),auth['isAuthenticated'](),controller[_0x9616('0x19')]);module[_0x9616('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2010d79..83fa04b 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 _0xc213=['ENUM','out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc213,0x19b));var _0x3c21=function(_0x352af9,_0x16f858){_0x352af9=_0x352af9-0x0;var _0x4d05c8=_0xc213[_0x352af9];return _0x4d05c8;};'use strict';var Sequelize=require(_0x3c21('0x0'));module[_0x3c21('0x1')]={'body':{'type':Sequelize[_0x3c21('0x2')](_0x3c21('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3c21('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3c21('0x5')]('in',_0x3c21('0x6')),'defaultValue':_0x3c21('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3c21('0x7')](0xbe)},'phone':{'type':Sequelize[_0x3c21('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3c21('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3c21('0x7')]},'providerResponse':{'type':Sequelize[_0x3c21('0x2')]}}; \ No newline at end of file +var _0x5341=['ENUM','out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x5341,0xbb));var _0x1534=function(_0x1dd0a3,_0x38da90){_0x1dd0a3=_0x1dd0a3-0x0;var _0x3dc2e8=_0x5341[_0x1dd0a3];return _0x3dc2e8;};'use strict';var Sequelize=require(_0x1534('0x0'));module[_0x1534('0x1')]={'body':{'type':Sequelize[_0x1534('0x2')](_0x1534('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1534('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1534('0x5')]('in',_0x1534('0x6')),'defaultValue':_0x1534('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x1534('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1534('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1534('0x7')]},'providerResponse':{'type':Sequelize[_0x1534('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 710e51b..ab7a011 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 _0x26bd=['messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','manual','interface','channel','motionChannel','event','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','fullname','SIP/%s','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x26bd,0xaa));var _0xd26b=function(_0x4ec873,_0x53db6d){_0x4ec873=_0x4ec873-0x0;var _0xbfde4c=_0x26bd[_0x4ec873];return _0xbfde4c;};'use strict';var emlformat=require(_0xd26b('0x0'));var rimraf=require(_0xd26b('0x1'));var zipdir=require(_0xd26b('0x2'));var jsonpatch=require(_0xd26b('0x3'));var rp=require(_0xd26b('0x4'));var moment=require(_0xd26b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd26b('0x6'));var util=require(_0xd26b('0x7'));var path=require(_0xd26b('0x8'));var sox=require(_0xd26b('0x9'));var csv=require('to-csv');var ejs=require(_0xd26b('0xa'));var fs=require('fs');var fs_extra=require(_0xd26b('0xb'));var _=require(_0xd26b('0xc'));var squel=require(_0xd26b('0xd'));var crypto=require('crypto');var jsforce=require(_0xd26b('0xe'));var deskjs=require(_0xd26b('0xf'));var toCsv=require(_0xd26b('0x10'));var querystring=require(_0xd26b('0x11'));var Papa=require(_0xd26b('0x12'));var Redis=require(_0xd26b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd26b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd26b('0x15'));var logger=require(_0xd26b('0x16'))(_0xd26b('0x17'));var utils=require(_0xd26b('0x18'));var config=require(_0xd26b('0x19'));var licenseUtil=require(_0xd26b('0x1a'));var db=require(_0xd26b('0x1b'))['db'];config[_0xd26b('0x1c')]=_[_0xd26b('0x1d')](config['redis'],{'host':_0xd26b('0x1e'),'port':0x18eb});var socket=require(_0xd26b('0x1f'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xd26b('0x20')](socket);var jayson=require(_0xd26b('0x21'));var client=jayson[_0xd26b('0x22')][_0xd26b('0x23')]({'port':0x232c});var client9002=jayson[_0xd26b('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c658a,_0x4b55d3,_0xdbdf12,_0x252bed){return new BPromise(function(_0x81ccdc,_0x18ac83){var _0x4ee711=_0x252bed||client;return _0x4ee711[_0xd26b('0x24')](_0x1c658a,_0xdbdf12)[_0xd26b('0x25')](function(_0x360b8c){logger[_0xd26b('0x26')](_0xd26b('0x27'),_0x4b55d3,_0xd26b('0x28'));logger['debug'](_0xd26b('0x29'),_0x4b55d3,_0xd26b('0x28'),JSON[_0xd26b('0x2a')](_0x360b8c));if(_0x360b8c[_0xd26b('0x2b')]){if(_0x360b8c[_0xd26b('0x2b')][_0xd26b('0x2c')]===0x1f4){logger[_0xd26b('0x2b')](_0xd26b('0x27'),_0x4b55d3,_0x360b8c['error'][_0xd26b('0x2d')]);return _0x18ac83(_0x360b8c['error'][_0xd26b('0x2d')]);}logger[_0xd26b('0x2b')](_0xd26b('0x27'),_0x4b55d3,_0x360b8c[_0xd26b('0x2b')][_0xd26b('0x2d')]);return _0x81ccdc(_0x360b8c['error']['message']);}else{logger[_0xd26b('0x26')](_0xd26b('0x27'),_0x4b55d3,_0xd26b('0x28'));_0x81ccdc(_0x360b8c[_0xd26b('0x2e')][_0xd26b('0x2d')]);}})[_0xd26b('0x2f')](function(_0xd91bca){logger[_0xd26b('0x2b')](_0xd26b('0x27'),_0x4b55d3,_0xd91bca);_0x18ac83(_0xd91bca);});});}function respondWithStatusCode(_0x3ae1f0,_0x23a64e){_0x23a64e=_0x23a64e||0xcc;return function(_0x42a2c0){if(_0x42a2c0){return _0x3ae1f0[_0xd26b('0x30')](_0x23a64e);}return _0x3ae1f0['status'](_0x23a64e)[_0xd26b('0x31')]();};}function respondWithResult(_0x14609a,_0x1c38c8){_0x1c38c8=_0x1c38c8||0xc8;return function(_0x5611d6){if(_0x5611d6){return _0x14609a[_0xd26b('0x32')](_0x1c38c8)[_0xd26b('0x33')](_0x5611d6);}};}function respondWithFilteredResult(_0x5ed45f,_0x20530f){return function(_0x51d842){if(_0x51d842){var _0x395bc8=typeof _0x20530f[_0xd26b('0x34')]===_0xd26b('0x35')&&typeof _0x20530f['limit']===_0xd26b('0x35');var _0x19e48c=_0x51d842[_0xd26b('0x36')];var _0x1aab0f=_0x395bc8?0x0:_0x20530f[_0xd26b('0x34')];var _0x374220=_0x395bc8?_0x51d842[_0xd26b('0x36')]:_0x20530f[_0xd26b('0x34')]+_0x20530f[_0xd26b('0x37')];var _0x3a86f7;if(_0x374220>=_0x19e48c){_0x374220=_0x19e48c;_0x3a86f7=0xc8;}else{_0x3a86f7=0xce;}_0x5ed45f[_0xd26b('0x32')](_0x3a86f7);return _0x5ed45f[_0xd26b('0x38')](_0xd26b('0x39'),_0x1aab0f+'-'+_0x374220+'/'+_0x19e48c)[_0xd26b('0x33')](_0x51d842);}return null;};}function patchUpdates(_0x58cd89){return function(_0x3851f3){try{jsonpatch[_0xd26b('0x3a')](_0x3851f3,_0x58cd89,!![]);}catch(_0x51924c){return BPromise[_0xd26b('0x3b')](_0x51924c);}return _0x3851f3[_0xd26b('0x3c')]();};}function saveUpdates(_0x4460b1,_0x35cbad){return function(_0x46d486){if(_0x46d486){return _0x46d486['update'](_0x4460b1)[_0xd26b('0x25')](function(_0x48bb5f){return _0x48bb5f;});}return null;};}function removeEntity(_0xe2af03,_0x279829){return function(_0x58996){if(_0x58996){return _0x58996[_0xd26b('0x3d')]()[_0xd26b('0x25')](function(){_0xe2af03[_0xd26b('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b7b6c,_0x10e2d6){return function(_0x3a41f6){if(!_0x3a41f6){_0x3b7b6c[_0xd26b('0x30')](0x194);}return _0x3a41f6;};}function handleError(_0x2eada3,_0x79f33c){_0x79f33c=_0x79f33c||0x1f4;return function(_0x55315c){logger[_0xd26b('0x2b')](_0x55315c[_0xd26b('0x3e')]);if(_0x55315c[_0xd26b('0x3f')]){delete _0x55315c[_0xd26b('0x3f')];}_0x2eada3[_0xd26b('0x32')](_0x79f33c)[_0xd26b('0x40')](_0x55315c);};}exports['index']=function(_0x30773a,_0x583f36){var _0x18f518={},_0x12f585={},_0x48bdbb={'count':0x0,'rows':[]};var _0x382d57=_['map'](db[_0xd26b('0x41')][_0xd26b('0x42')],function(_0x325f05){return{'name':_0x325f05[_0xd26b('0x43')],'type':_0x325f05[_0xd26b('0x44')][_0xd26b('0x45')]};});_0x12f585[_0xd26b('0x46')]=_['map'](_0x382d57,_0xd26b('0x3f'));_0x12f585[_0xd26b('0x47')]=_[_0xd26b('0x48')](_0x30773a[_0xd26b('0x47')]);_0x12f585[_0xd26b('0x49')]=_[_0xd26b('0x4a')](_0x12f585['model'],_0x12f585[_0xd26b('0x47')]);_0x18f518[_0xd26b('0x4b')]=_['intersection'](_0x12f585[_0xd26b('0x46')],qs[_0xd26b('0x4c')](_0x30773a[_0xd26b('0x47')][_0xd26b('0x4c')]));_0x18f518[_0xd26b('0x4b')]=_0x18f518['attributes']['length']?_0x18f518[_0xd26b('0x4b')]:_0x12f585[_0xd26b('0x46')];if(!_0x30773a['query'][_0xd26b('0x4d')](_0xd26b('0x4e'))){_0x18f518[_0xd26b('0x37')]=qs['limit'](_0x30773a['query'][_0xd26b('0x37')]);_0x18f518[_0xd26b('0x34')]=qs[_0xd26b('0x34')](_0x30773a[_0xd26b('0x47')]['offset']);}_0x18f518[_0xd26b('0x4f')]=qs['sort'](_0x30773a[_0xd26b('0x47')][_0xd26b('0x50')]);_0x18f518[_0xd26b('0x51')]=qs[_0xd26b('0x49')](_[_0xd26b('0x52')](_0x30773a['query'],_0x12f585[_0xd26b('0x49')]),_0x382d57);if(_0x30773a[_0xd26b('0x47')][_0xd26b('0x53')]){_0x18f518[_0xd26b('0x51')]=_[_0xd26b('0x54')](_0x18f518[_0xd26b('0x51')],{'$or':_['map'](_0x382d57,function(_0xa73764){if(_0xa73764[_0xd26b('0x44')]!==_0xd26b('0x55')){var _0x108fbc={};_0x108fbc[_0xa73764['name']]={'$like':'%'+_0x30773a['query'][_0xd26b('0x53')]+'%'};return _0x108fbc;}})});}_0x18f518=_[_0xd26b('0x54')]({},_0x18f518,_0x30773a[_0xd26b('0x56')]);var _0x20fb85={'where':_0x18f518[_0xd26b('0x51')]};return db[_0xd26b('0x41')]['count'](_0x20fb85)[_0xd26b('0x25')](function(_0x46f270){_0x48bdbb[_0xd26b('0x36')]=_0x46f270;if(_0x30773a[_0xd26b('0x47')][_0xd26b('0x57')]){_0x18f518[_0xd26b('0x58')]=[{'all':!![]}];}return db['SmsMessage'][_0xd26b('0x59')](_0x18f518);})[_0xd26b('0x25')](function(_0x42ff5e){_0x48bdbb[_0xd26b('0x5a')]=_0x42ff5e;return _0x48bdbb;})[_0xd26b('0x25')](respondWithFilteredResult(_0x583f36,_0x18f518))[_0xd26b('0x2f')](handleError(_0x583f36,null));};exports[_0xd26b('0x5b')]=function(_0x81ffc0,_0x4e4e69){var _0x5ca800={'raw':!![],'where':{'id':_0x81ffc0[_0xd26b('0x5c')]['id']}},_0x525dd2={};_0x525dd2['model']=_[_0xd26b('0x48')](db[_0xd26b('0x41')]['rawAttributes']);_0x525dd2[_0xd26b('0x47')]=_[_0xd26b('0x48')](_0x81ffc0[_0xd26b('0x47')]);_0x525dd2[_0xd26b('0x49')]=_[_0xd26b('0x4a')](_0x525dd2[_0xd26b('0x46')],_0x525dd2['query']);_0x5ca800['attributes']=_[_0xd26b('0x4a')](_0x525dd2[_0xd26b('0x46')],qs[_0xd26b('0x4c')](_0x81ffc0[_0xd26b('0x47')]['fields']));_0x5ca800[_0xd26b('0x4b')]=_0x5ca800['attributes']['length']?_0x5ca800['attributes']:_0x525dd2[_0xd26b('0x46')];if(_0x81ffc0['query'][_0xd26b('0x57')]){_0x5ca800[_0xd26b('0x58')]=[{'all':!![]}];}_0x5ca800=_[_0xd26b('0x54')]({},_0x5ca800,_0x81ffc0[_0xd26b('0x56')]);return db['SmsMessage'][_0xd26b('0x5d')](_0x5ca800)[_0xd26b('0x25')](handleEntityNotFound(_0x4e4e69,null))['then'](respondWithResult(_0x4e4e69,null))[_0xd26b('0x2f')](handleError(_0x4e4e69,null));};exports[_0xd26b('0x5e')]=function(_0x29dcbd,_0x55ded0){return db[_0xd26b('0x41')][_0xd26b('0x5e')](_0x29dcbd[_0xd26b('0x5f')],{})[_0xd26b('0x25')](respondWithResult(_0x55ded0,0xc9))[_0xd26b('0x2f')](handleError(_0x55ded0,null));};exports[_0xd26b('0x60')]=function(_0xdfe8f9,_0x165262){if(_0xdfe8f9[_0xd26b('0x5f')]['id']){delete _0xdfe8f9[_0xd26b('0x5f')]['id'];}return db[_0xd26b('0x41')][_0xd26b('0x5d')]({'where':{'id':_0xdfe8f9['params']['id']}})[_0xd26b('0x25')](handleEntityNotFound(_0x165262,null))[_0xd26b('0x25')](saveUpdates(_0xdfe8f9[_0xd26b('0x5f')],null))[_0xd26b('0x25')](respondWithResult(_0x165262,null))[_0xd26b('0x2f')](handleError(_0x165262,null));};exports['destroy']=function(_0x285e16,_0x4ec0bc){return db[_0xd26b('0x41')]['find']({'where':{'id':_0x285e16[_0xd26b('0x5c')]['id']}})[_0xd26b('0x25')](handleEntityNotFound(_0x4ec0bc,null))[_0xd26b('0x25')](removeEntity(_0x4ec0bc,null))[_0xd26b('0x2f')](handleError(_0x4ec0bc,null));};exports[_0xd26b('0x61')]=function(_0x17ecbb,_0xcdd8b2){return db[_0xd26b('0x41')]['describe']()[_0xd26b('0x25')](respondWithResult(_0xcdd8b2,null))[_0xd26b('0x2f')](handleError(_0xcdd8b2,null));};var interaction_log=require('../../config/logger')(_0xd26b('0x62'));exports[_0xd26b('0x63')]=function(_0x2a9e85,_0x1f19a0,_0x41ec1c){var _0x498061={'agent':{},'channel':'sms'};if(_0x2a9e85[_0xd26b('0x5f')]['id']){delete _0x2a9e85[_0xd26b('0x5f')]['id'];}_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x64')]=!![];_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x65')]=moment()[_0xd26b('0x66')](_0xd26b('0x67'));_0x2a9e85[_0xd26b('0x5f')]['UserId']=_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x68')]||_0x2a9e85[_0xd26b('0x69')]['id'];_0x498061[_0xd26b('0x6a')]['id']=_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x68')];return db[_0xd26b('0x41')]['find']({'where':{'id':_0x2a9e85[_0xd26b('0x5c')]['id'],'UserId':null}})[_0xd26b('0x25')](handleEntityNotFound(_0x1f19a0,null))[_0xd26b('0x25')](saveUpdates(_0x2a9e85[_0xd26b('0x5f')],null))[_0xd26b('0x25')](function(_0xc3124d){if(_0xc3124d){_0x498061[_0xd26b('0x2d')]=_0xc3124d[_0xd26b('0x6b')]({'plain':!![]});return db[_0xd26b('0x6c')]['find']({'where':{'id':_0xc3124d[_0xd26b('0x6d')]}});}return null;})[_0xd26b('0x25')](handleEntityNotFound(_0x1f19a0,null))['then'](function(_0x5be066){if(_0x5be066){return _0x5be066[_0xd26b('0x60')]({'UserId':_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x68')],'read1stAt':_[_0xd26b('0x6e')](_0x5be066[_0xd26b('0x6f')])?moment()[_0xd26b('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd26b('0x25')](function(_0x260714){if(_0x260714){_0x498061[_0xd26b('0x70')]=_0x260714['get']({'plain':!![]});interaction_log[_0xd26b('0x26')](_0xd26b('0x71'),_0x2a9e85['user']['id'],_0x2a9e85[_0xd26b('0x69')][_0xd26b('0x3f')],_0x2a9e85['user'][_0xd26b('0x72')],_0x498061[_0xd26b('0x70')]['id'],_0x2a9e85[_0xd26b('0x5f')]?JSON[_0xd26b('0x2a')](_0x2a9e85['body']):_0xd26b('0x73'));return respondWithRpcPromise(_0xd26b('0x74'),'acceptMessage',_0x498061);}return null;})[_0xd26b('0x25')](function(_0x2d36d1){var _0x1e9955=_0xd26b('0x75')+_0x2d36d1[_0xd26b('0x2d')][_0xd26b('0x76')];return db[_0xd26b('0x77')][_0xd26b('0x47')](_0x1e9955,{'type':db[_0xd26b('0x78')]['QueryTypes'][_0xd26b('0x79')],'raw':!![]})['then'](function(_0x5cdea4){return _0x5cdea4;});})['then'](function(_0x45aaa3){if(_0x45aaa3){_0x498061[_0xd26b('0x2d')][_0xd26b('0x7a')]=_0x45aaa3[0x0];if(!_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x68')])return;return db[_0xd26b('0x7b')]['find']({'where':{'id':_0x2a9e85['body'][_0xd26b('0x68')],'role':_0xd26b('0x6a')},'attributes':['id','name','fullname',_0xd26b('0x7c'),_0xd26b('0x7d')],'raw':!![]});}return null;})[_0xd26b('0x25')](function(_0x1167c6){if(!_0x1167c6)return null;_0x498061[_0xd26b('0x2d')][_0xd26b('0x6a')]=_0x1167c6;return _0x498061;})['then'](function(_0x76d62b){if(_0x76d62b){if(_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x7e')]){_0x498061[_0xd26b('0x2d')][_0xd26b('0x7f')]=util['format']('SIP/%s',_0x2a9e85[_0xd26b('0x69')]['name']);_0x498061[_0xd26b('0x2d')][_0xd26b('0x80')]=_0x498061[_0xd26b('0x80')];_0x498061['message'][_0xd26b('0x81')]=_0x498061[_0xd26b('0x80')];_0x498061[_0xd26b('0x2d')][_0xd26b('0x82')]=_0xd26b('0x63');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xd26b('0x83'),'message':_0x498061[_0xd26b('0x2d')]},client9002)[_0xd26b('0x25')](function(){return _0x498061;});}return _0x498061;}return null;})['then'](respondWithResult(_0x1f19a0,null))['catch'](handleError(_0x1f19a0,null));};var interaction_log=require('../../config/logger')(_0xd26b('0x62'));exports[_0xd26b('0x3b')]=function(_0x566e53,_0x3b089a,_0x7ff5c8){var _0x21ec3a={'agent':{},'channel':_0xd26b('0x84')};if(_0x566e53[_0xd26b('0x5f')]['id']){delete _0x566e53['body']['id'];}_0x566e53[_0xd26b('0x5f')][_0xd26b('0x68')]=_0x566e53['body']['UserId']||_0x566e53[_0xd26b('0x69')]['id'];_0x21ec3a['agent']['id']=_0x566e53['body'][_0xd26b('0x68')];return db[_0xd26b('0x41')][_0xd26b('0x5d')]({'where':{'id':_0x566e53[_0xd26b('0x5c')]['id'],'UserId':null}})[_0xd26b('0x25')](handleEntityNotFound(_0x3b089a,null))[_0xd26b('0x25')](function(_0x52d244){if(_0x52d244){_0x21ec3a[_0xd26b('0x2d')]=_0x52d244[_0xd26b('0x6b')]({'plain':!![]});return db[_0xd26b('0x6c')][_0xd26b('0x5d')]({'where':{'id':_0x52d244['SmsInteractionId']}});}return null;})[_0xd26b('0x25')](handleEntityNotFound(_0x3b089a,null))[_0xd26b('0x25')](function(_0x178069){if(_0x178069){_0x21ec3a['interaction']=_0x178069[_0xd26b('0x6b')]({'plain':!![]});interaction_log['info'](_0xd26b('0x85'),_0x566e53[_0xd26b('0x69')]['id'],_0x566e53[_0xd26b('0x69')][_0xd26b('0x3f')],_0x566e53[_0xd26b('0x69')]['role'],_0x21ec3a[_0xd26b('0x70')]['id'],_0x566e53['body']?JSON[_0xd26b('0x2a')](_0x566e53[_0xd26b('0x5f')]):_0xd26b('0x73'));return respondWithRpcPromise(_0xd26b('0x86'),_0xd26b('0x87'),_0x21ec3a);}return null;})['then'](function(_0x1ea4df){var _0x4c28e3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ea4df['message'][_0xd26b('0x76')];return db[_0xd26b('0x77')][_0xd26b('0x47')](_0x4c28e3,{'type':db['Sequelize'][_0xd26b('0x88')]['SELECT'],'raw':!![]})[_0xd26b('0x25')](function(_0x3d6617){return _0x3d6617;});})[_0xd26b('0x25')](function(_0x691427){if(_0x691427){_0x21ec3a['message'][_0xd26b('0x7a')]=_0x691427[0x0];if(!_0x566e53[_0xd26b('0x5f')][_0xd26b('0x68')])return;return db[_0xd26b('0x7b')][_0xd26b('0x5d')]({'where':{'id':_0x566e53['body'][_0xd26b('0x68')],'role':_0xd26b('0x6a')},'attributes':['id','name',_0xd26b('0x89'),'email',_0xd26b('0x7d')],'raw':!![]});}return null;})[_0xd26b('0x25')](function(_0x376fc9){if(!_0x376fc9)return null;_0x21ec3a[_0xd26b('0x2d')]['agent']=_0x376fc9;return _0x21ec3a;})[_0xd26b('0x25')](function(_0x2b7db4){if(_0x2b7db4){_0x2b7db4[_0xd26b('0x2d')][_0xd26b('0x7f')]=util['format'](_0xd26b('0x8a'),_0x566e53[_0xd26b('0x69')][_0xd26b('0x3f')]);_0x2b7db4[_0xd26b('0x2d')]['channel']=_0x21ec3a[_0xd26b('0x80')];_0x2b7db4[_0xd26b('0x2d')][_0xd26b('0x81')]=_0x21ec3a['channel'];_0x2b7db4['message'][_0xd26b('0x82')]=_0xd26b('0x3b');respondWithRpcPromise(_0xd26b('0x8b'),_0xd26b('0x8b'),{'event':_0xd26b('0x8c'),'message':_0x2b7db4['message']},client9002);return _0x21ec3a;}return null;})['then'](respondWithResult(_0x3b089a,null))[_0xd26b('0x2f')](handleError(_0x3b089a,null));};exports['status']=function(_0x48cdac,_0x51c1d2,_0x1327cc){if(_0x48cdac[_0xd26b('0x5f')]['id']){delete _0x48cdac[_0xd26b('0x5f')]['id'];}var _0x4bf39c;return db[_0xd26b('0x41')]['find']({'where':{'id':_0x48cdac['params']['id']}})['then'](handleEntityNotFound(_0x51c1d2,null))[_0xd26b('0x25')](function(_0x414c44){if(_0x414c44){_0x4bf39c=_0x414c44;return db[_0xd26b('0x8d')]['find']({'where':{'id':_0x414c44[_0xd26b('0x8e')]}});}})['then'](handleEntityNotFound(_0x51c1d2,null))[_0xd26b('0x25')](function(_0x11bfe7){if(_0x11bfe7){logger[_0xd26b('0x8f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd26b('0x32'),_0xd26b('0x90'),_0x11bfe7['type'],util[_0xd26b('0x91')](_0x48cdac[_0xd26b('0x5f')],{'showHidden':![],'depth':null}));switch(_0x11bfe7[_0xd26b('0x44')]){case _0xd26b('0x92'):if(_0x48cdac[_0xd26b('0x5f')]['MessageSid']&&_0x48cdac[_0xd26b('0x5f')][_0xd26b('0x93')]===_0x4bf39c[_0xd26b('0x94')]){return _0x4bf39c[_0xd26b('0x60')]({'read':!![]});}else{logger[_0xd26b('0x2b')](_0xd26b('0x95'),_0xd26b('0x32'),_0xd26b('0x92'),util[_0xd26b('0x91')](_0x48cdac['body'],{'showHidden':![],'depth':null}));}break;case _0xd26b('0x96'):if(_0x48cdac['body'][_0xd26b('0x97')]&&_0x48cdac[_0xd26b('0x5f')][_0xd26b('0x97')]===_0x4bf39c[_0xd26b('0x94')]&&_[_0xd26b('0x98')]([_0xd26b('0x99'),_0xd26b('0x9a')],_0x48cdac[_0xd26b('0x5f')]['Status'])>=0x0){return _0x4bf39c[_0xd26b('0x60')]({'read':!![]});}else{logger['error'](_0xd26b('0x95'),'status',_0xd26b('0x9b'),util[_0xd26b('0x91')](_0x48cdac[_0xd26b('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x60bc97=_0x48cdac[_0xd26b('0x5f')][_0xd26b('0x9c')][0x0];if(_0x60bc97['status'][_0xd26b('0x9d')]===_0xd26b('0x9e')){return _0x4bf39c[_0xd26b('0x60')]({'read':!![]});}else{logger[_0xd26b('0x2b')](_0xd26b('0x95'),_0xd26b('0x32'),'infobip',util[_0xd26b('0x91')](_0x48cdac[_0xd26b('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x4bf39c;}})[_0xd26b('0x25')](respondWithResult(_0x51c1d2,null))['catch'](handleError(_0x51c1d2,null));}; \ No newline at end of file +var _0x94ff=['read1stAt','format','[SMSMESSAGE: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','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','role','RejectMessage','rejectMessage','ContactId','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','eml-format','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','SmsMessage','rawAttributes','type','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','rows','show','params','keys','fields','options','find','catch','body','describe','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil'];(function(_0x2a2271,_0xa408cc){var _0x1a4782=function(_0x2a083f){while(--_0x2a083f){_0x2a2271['push'](_0x2a2271['shift']());}};_0x1a4782(++_0xa408cc);}(_0x94ff,0xc3));var _0xf94f=function(_0x4a3494,_0x5ec817){_0x4a3494=_0x4a3494-0x0;var _0xf21e44=_0x94ff[_0x4a3494];return _0xf21e44;};'use strict';var emlformat=require(_0xf94f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf94f('0x1'));var moment=require(_0xf94f('0x2'));var BPromise=require(_0xf94f('0x3'));var Mustache=require('mustache');var util=require(_0xf94f('0x4'));var path=require(_0xf94f('0x5'));var sox=require('sox');var csv=require(_0xf94f('0x6'));var ejs=require(_0xf94f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf94f('0x8'));var squel=require('squel');var crypto=require(_0xf94f('0x9'));var jsforce=require(_0xf94f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf94f('0x6'));var querystring=require(_0xf94f('0xb'));var Papa=require(_0xf94f('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf94f('0xd'));var as=require(_0xf94f('0xe'));var hardwareService=require(_0xf94f('0xf'));var logger=require(_0xf94f('0x10'))(_0xf94f('0x11'));var utils=require(_0xf94f('0x12'));var config=require(_0xf94f('0x13'));var licenseUtil=require(_0xf94f('0x14'));var db=require(_0xf94f('0x15'))['db'];config['redis']=_[_0xf94f('0x16')](config[_0xf94f('0x17')],{'host':_0xf94f('0x18'),'port':0x18eb});var socket=require(_0xf94f('0x19'))(new Redis(config['redis']));require(_0xf94f('0x1a'))[_0xf94f('0x1b')](socket);var jayson=require(_0xf94f('0x1c'));var client=jayson[_0xf94f('0x1d')][_0xf94f('0x1e')]({'port':0x232c});var client9002=jayson[_0xf94f('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x275e3c,_0x5924da,_0x2d7acd,_0x346c76){return new BPromise(function(_0x4f8fb8,_0x591f17){var _0x55944e=_0x346c76||client;return _0x55944e[_0xf94f('0x1f')](_0x275e3c,_0x2d7acd)['then'](function(_0x4e43d1){logger[_0xf94f('0x20')]('SmsMessage,\x20%s,\x20%s',_0x5924da,_0xf94f('0x21'));logger['debug'](_0xf94f('0x22'),_0x5924da,'request\x20sent',JSON[_0xf94f('0x23')](_0x4e43d1));if(_0x4e43d1[_0xf94f('0x24')]){if(_0x4e43d1['error'][_0xf94f('0x25')]===0x1f4){logger[_0xf94f('0x24')]('SmsMessage,\x20%s,\x20%s',_0x5924da,_0x4e43d1[_0xf94f('0x24')][_0xf94f('0x26')]);return _0x591f17(_0x4e43d1['error'][_0xf94f('0x26')]);}logger[_0xf94f('0x24')]('SmsMessage,\x20%s,\x20%s',_0x5924da,_0x4e43d1[_0xf94f('0x24')][_0xf94f('0x26')]);return _0x4f8fb8(_0x4e43d1[_0xf94f('0x24')][_0xf94f('0x26')]);}else{logger[_0xf94f('0x20')]('SmsMessage,\x20%s,\x20%s',_0x5924da,_0xf94f('0x21'));_0x4f8fb8(_0x4e43d1[_0xf94f('0x27')][_0xf94f('0x26')]);}})['catch'](function(_0x26b0dd){logger[_0xf94f('0x24')]('SmsMessage,\x20%s,\x20%s',_0x5924da,_0x26b0dd);_0x591f17(_0x26b0dd);});});}function respondWithStatusCode(_0x1cb6e5,_0x56eca2){_0x56eca2=_0x56eca2||0xcc;return function(_0x494a9d){if(_0x494a9d){return _0x1cb6e5[_0xf94f('0x28')](_0x56eca2);}return _0x1cb6e5[_0xf94f('0x29')](_0x56eca2)['end']();};}function respondWithResult(_0x55e414,_0x9cdeeb){_0x9cdeeb=_0x9cdeeb||0xc8;return function(_0xd64892){if(_0xd64892){return _0x55e414['status'](_0x9cdeeb)[_0xf94f('0x2a')](_0xd64892);}};}function respondWithFilteredResult(_0x2be1e1,_0x341cac){return function(_0x5939dd){if(_0x5939dd){var _0x18b013=typeof _0x341cac['offset']===_0xf94f('0x2b')&&typeof _0x341cac[_0xf94f('0x2c')]===_0xf94f('0x2b');var _0x599e64=_0x5939dd[_0xf94f('0x2d')];var _0xe3e35=_0x18b013?0x0:_0x341cac[_0xf94f('0x2e')];var _0x3adb65=_0x18b013?_0x5939dd[_0xf94f('0x2d')]:_0x341cac[_0xf94f('0x2e')]+_0x341cac[_0xf94f('0x2c')];var _0x57716c;if(_0x3adb65>=_0x599e64){_0x3adb65=_0x599e64;_0x57716c=0xc8;}else{_0x57716c=0xce;}_0x2be1e1[_0xf94f('0x29')](_0x57716c);return _0x2be1e1[_0xf94f('0x2f')](_0xf94f('0x30'),_0xe3e35+'-'+_0x3adb65+'/'+_0x599e64)[_0xf94f('0x2a')](_0x5939dd);}return null;};}function patchUpdates(_0x27e391){return function(_0x499d11){try{jsonpatch[_0xf94f('0x31')](_0x499d11,_0x27e391,!![]);}catch(_0x3a3edc){return BPromise[_0xf94f('0x32')](_0x3a3edc);}return _0x499d11[_0xf94f('0x33')]();};}function saveUpdates(_0xaf06eb,_0x5d571c){return function(_0x11022c){if(_0x11022c){return _0x11022c[_0xf94f('0x34')](_0xaf06eb)[_0xf94f('0x35')](function(_0x4f9ef2){return _0x4f9ef2;});}return null;};}function removeEntity(_0x1b8aad,_0x2ad886){return function(_0xd8afe0){if(_0xd8afe0){return _0xd8afe0[_0xf94f('0x36')]()[_0xf94f('0x35')](function(){_0x1b8aad[_0xf94f('0x29')](0xcc)[_0xf94f('0x37')]();});}};}function handleEntityNotFound(_0x52ddfd,_0x1c46a2){return function(_0x239ba9){if(!_0x239ba9){_0x52ddfd['sendStatus'](0x194);}return _0x239ba9;};}function handleError(_0x591792,_0x141c36){_0x141c36=_0x141c36||0x1f4;return function(_0x22fc77){logger[_0xf94f('0x24')](_0x22fc77[_0xf94f('0x38')]);if(_0x22fc77[_0xf94f('0x39')]){delete _0x22fc77[_0xf94f('0x39')];}_0x591792['status'](_0x141c36)[_0xf94f('0x3a')](_0x22fc77);};}exports['index']=function(_0x588c59,_0x58c24f){var _0x212e82={},_0x248632={},_0x19e42a={'count':0x0,'rows':[]};var _0x5b825d=_['map'](db[_0xf94f('0x3b')][_0xf94f('0x3c')],function(_0x441235){return{'name':_0x441235['fieldName'],'type':_0x441235[_0xf94f('0x3d')]['key']};});_0x248632['model']=_[_0xf94f('0x3e')](_0x5b825d,_0xf94f('0x39'));_0x248632[_0xf94f('0x3f')]=_['keys'](_0x588c59['query']);_0x248632[_0xf94f('0x40')]=_[_0xf94f('0x41')](_0x248632[_0xf94f('0x42')],_0x248632[_0xf94f('0x3f')]);_0x212e82[_0xf94f('0x43')]=_[_0xf94f('0x41')](_0x248632['model'],qs['fields'](_0x588c59[_0xf94f('0x3f')]['fields']));_0x212e82[_0xf94f('0x43')]=_0x212e82[_0xf94f('0x43')][_0xf94f('0x44')]?_0x212e82[_0xf94f('0x43')]:_0x248632['model'];if(!_0x588c59[_0xf94f('0x3f')][_0xf94f('0x45')](_0xf94f('0x46'))){_0x212e82[_0xf94f('0x2c')]=qs[_0xf94f('0x2c')](_0x588c59[_0xf94f('0x3f')][_0xf94f('0x2c')]);_0x212e82['offset']=qs['offset'](_0x588c59[_0xf94f('0x3f')][_0xf94f('0x2e')]);}_0x212e82[_0xf94f('0x47')]=qs[_0xf94f('0x48')](_0x588c59[_0xf94f('0x3f')][_0xf94f('0x48')]);_0x212e82['where']=qs[_0xf94f('0x40')](_[_0xf94f('0x49')](_0x588c59['query'],_0x248632[_0xf94f('0x40')]),_0x5b825d);if(_0x588c59[_0xf94f('0x3f')][_0xf94f('0x4a')]){_0x212e82[_0xf94f('0x4b')]=_[_0xf94f('0x4c')](_0x212e82[_0xf94f('0x4b')],{'$or':_[_0xf94f('0x3e')](_0x5b825d,function(_0x1e70b6){if(_0x1e70b6[_0xf94f('0x3d')]!=='VIRTUAL'){var _0x4cd00c={};_0x4cd00c[_0x1e70b6[_0xf94f('0x39')]]={'$like':'%'+_0x588c59[_0xf94f('0x3f')][_0xf94f('0x4a')]+'%'};return _0x4cd00c;}})});}_0x212e82=_[_0xf94f('0x4c')]({},_0x212e82,_0x588c59['options']);var _0xb7fd7e={'where':_0x212e82[_0xf94f('0x4b')]};return db[_0xf94f('0x3b')]['count'](_0xb7fd7e)[_0xf94f('0x35')](function(_0x171dc5){_0x19e42a['count']=_0x171dc5;if(_0x588c59[_0xf94f('0x3f')][_0xf94f('0x4d')]){_0x212e82[_0xf94f('0x4e')]=[{'all':!![]}];}return db[_0xf94f('0x3b')]['findAll'](_0x212e82);})[_0xf94f('0x35')](function(_0x544306){_0x19e42a[_0xf94f('0x4f')]=_0x544306;return _0x19e42a;})[_0xf94f('0x35')](respondWithFilteredResult(_0x58c24f,_0x212e82))['catch'](handleError(_0x58c24f,null));};exports[_0xf94f('0x50')]=function(_0x20dec0,_0x4887b3){var _0x4ba41b={'raw':!![],'where':{'id':_0x20dec0[_0xf94f('0x51')]['id']}},_0x4fd15b={};_0x4fd15b[_0xf94f('0x42')]=_[_0xf94f('0x52')](db[_0xf94f('0x3b')][_0xf94f('0x3c')]);_0x4fd15b[_0xf94f('0x3f')]=_[_0xf94f('0x52')](_0x20dec0[_0xf94f('0x3f')]);_0x4fd15b[_0xf94f('0x40')]=_[_0xf94f('0x41')](_0x4fd15b['model'],_0x4fd15b[_0xf94f('0x3f')]);_0x4ba41b[_0xf94f('0x43')]=_['intersection'](_0x4fd15b[_0xf94f('0x42')],qs[_0xf94f('0x53')](_0x20dec0['query'][_0xf94f('0x53')]));_0x4ba41b[_0xf94f('0x43')]=_0x4ba41b[_0xf94f('0x43')]['length']?_0x4ba41b[_0xf94f('0x43')]:_0x4fd15b[_0xf94f('0x42')];if(_0x20dec0['query'][_0xf94f('0x4d')]){_0x4ba41b['include']=[{'all':!![]}];}_0x4ba41b=_[_0xf94f('0x4c')]({},_0x4ba41b,_0x20dec0[_0xf94f('0x54')]);return db['SmsMessage'][_0xf94f('0x55')](_0x4ba41b)[_0xf94f('0x35')](handleEntityNotFound(_0x4887b3,null))[_0xf94f('0x35')](respondWithResult(_0x4887b3,null))[_0xf94f('0x56')](handleError(_0x4887b3,null));};exports['create']=function(_0x21311d,_0x207da5){return db[_0xf94f('0x3b')]['create'](_0x21311d[_0xf94f('0x57')],{})[_0xf94f('0x35')](respondWithResult(_0x207da5,0xc9))[_0xf94f('0x56')](handleError(_0x207da5,null));};exports[_0xf94f('0x34')]=function(_0x1f1fc2,_0x1b2bb6){if(_0x1f1fc2['body']['id']){delete _0x1f1fc2[_0xf94f('0x57')]['id'];}return db[_0xf94f('0x3b')][_0xf94f('0x55')]({'where':{'id':_0x1f1fc2[_0xf94f('0x51')]['id']}})['then'](handleEntityNotFound(_0x1b2bb6,null))[_0xf94f('0x35')](saveUpdates(_0x1f1fc2[_0xf94f('0x57')],null))[_0xf94f('0x35')](respondWithResult(_0x1b2bb6,null))[_0xf94f('0x56')](handleError(_0x1b2bb6,null));};exports[_0xf94f('0x36')]=function(_0x4d99ec,_0x3730af){return db['SmsMessage'][_0xf94f('0x55')]({'where':{'id':_0x4d99ec[_0xf94f('0x51')]['id']}})[_0xf94f('0x35')](handleEntityNotFound(_0x3730af,null))[_0xf94f('0x35')](removeEntity(_0x3730af,null))[_0xf94f('0x56')](handleError(_0x3730af,null));};exports[_0xf94f('0x58')]=function(_0x29527e,_0x28ba4a){return db[_0xf94f('0x3b')][_0xf94f('0x58')]()[_0xf94f('0x35')](respondWithResult(_0x28ba4a,null))[_0xf94f('0x56')](handleError(_0x28ba4a,null));};var interaction_log=require(_0xf94f('0x10'))('sms-interactions');exports[_0xf94f('0x59')]=function(_0x399065,_0x560196,_0x2a0f28){var _0x32fe07={'agent':{},'channel':'sms'};if(_0x399065[_0xf94f('0x57')]['id']){delete _0x399065[_0xf94f('0x57')]['id'];}_0x399065[_0xf94f('0x57')]['read']=!![];_0x399065[_0xf94f('0x57')][_0xf94f('0x5a')]=moment()['format'](_0xf94f('0x5b'));_0x399065[_0xf94f('0x57')]['UserId']=_0x399065[_0xf94f('0x57')][_0xf94f('0x5c')]||_0x399065[_0xf94f('0x5d')]['id'];_0x32fe07[_0xf94f('0x5e')]['id']=_0x399065['body'][_0xf94f('0x5c')];return db[_0xf94f('0x3b')][_0xf94f('0x55')]({'where':{'id':_0x399065[_0xf94f('0x51')]['id'],'UserId':null}})[_0xf94f('0x35')](handleEntityNotFound(_0x560196,null))[_0xf94f('0x35')](saveUpdates(_0x399065[_0xf94f('0x57')],null))['then'](function(_0x4d9d75){if(_0x4d9d75){_0x32fe07[_0xf94f('0x26')]=_0x4d9d75[_0xf94f('0x5f')]({'plain':!![]});return db[_0xf94f('0x60')]['find']({'where':{'id':_0x4d9d75[_0xf94f('0x61')]}});}return null;})[_0xf94f('0x35')](handleEntityNotFound(_0x560196,null))[_0xf94f('0x35')](function(_0xd1bccf){if(_0xd1bccf){return _0xd1bccf[_0xf94f('0x34')]({'UserId':_0x399065[_0xf94f('0x57')][_0xf94f('0x5c')],'read1stAt':_[_0xf94f('0x62')](_0xd1bccf[_0xf94f('0x63')])?moment()[_0xf94f('0x64')](_0xf94f('0x5b')):undefined});}return null;})[_0xf94f('0x35')](function(_0x429789){if(_0x429789){_0x32fe07['interaction']=_0x429789[_0xf94f('0x5f')]({'plain':!![]});interaction_log[_0xf94f('0x20')](_0xf94f('0x65'),_0x399065[_0xf94f('0x5d')]['id'],_0x399065[_0xf94f('0x5d')][_0xf94f('0x39')],_0x399065['user']['role'],_0x32fe07[_0xf94f('0x66')]['id'],_0x399065[_0xf94f('0x57')]?JSON[_0xf94f('0x23')](_0x399065[_0xf94f('0x57')]):_0xf94f('0x67'));return respondWithRpcPromise(_0xf94f('0x68'),_0xf94f('0x69'),_0x32fe07);}return null;})[_0xf94f('0x35')](function(_0x3b8ee0){var _0x27b599=_0xf94f('0x6a')+_0x3b8ee0[_0xf94f('0x26')]['ContactId'];return db[_0xf94f('0x6b')][_0xf94f('0x3f')](_0x27b599,{'type':db[_0xf94f('0x6c')][_0xf94f('0x6d')][_0xf94f('0x6e')],'raw':!![]})[_0xf94f('0x35')](function(_0x40460a){return _0x40460a;});})[_0xf94f('0x35')](function(_0x18d59f){if(_0x18d59f){_0x32fe07[_0xf94f('0x26')][_0xf94f('0x6f')]=_0x18d59f[0x0];if(!_0x399065[_0xf94f('0x57')]['UserId'])return;return db[_0xf94f('0x70')]['find']({'where':{'id':_0x399065[_0xf94f('0x57')]['UserId'],'role':_0xf94f('0x5e')},'attributes':['id',_0xf94f('0x39'),_0xf94f('0x71'),_0xf94f('0x72'),_0xf94f('0x73')],'raw':!![]});}return null;})[_0xf94f('0x35')](function(_0x549051){if(!_0x549051)return null;_0x32fe07[_0xf94f('0x26')][_0xf94f('0x5e')]=_0x549051;return _0x32fe07;})[_0xf94f('0x35')](function(_0x26165b){if(_0x26165b){if(_0x399065['body'][_0xf94f('0x74')]){_0x32fe07[_0xf94f('0x26')][_0xf94f('0x75')]=util[_0xf94f('0x64')](_0xf94f('0x76'),_0x399065[_0xf94f('0x5d')]['name']);_0x32fe07[_0xf94f('0x26')][_0xf94f('0x77')]=_0x32fe07['channel'];_0x32fe07[_0xf94f('0x26')][_0xf94f('0x78')]=_0x32fe07[_0xf94f('0x77')];_0x32fe07[_0xf94f('0x26')][_0xf94f('0x79')]=_0xf94f('0x59');return respondWithRpcPromise(_0xf94f('0x7a'),_0xf94f('0x7a'),{'event':_0xf94f('0x7b'),'message':_0x32fe07[_0xf94f('0x26')]},client9002)[_0xf94f('0x35')](function(){return _0x32fe07;});}return _0x32fe07;}return null;})[_0xf94f('0x35')](respondWithResult(_0x560196,null))[_0xf94f('0x56')](handleError(_0x560196,null));};var interaction_log=require(_0xf94f('0x10'))('sms-interactions');exports['reject']=function(_0x7a7d01,_0x59fa19,_0x58d565){var _0x59d66c={'agent':{},'channel':_0xf94f('0x7c')};if(_0x7a7d01[_0xf94f('0x57')]['id']){delete _0x7a7d01['body']['id'];}_0x7a7d01[_0xf94f('0x57')][_0xf94f('0x5c')]=_0x7a7d01['body']['UserId']||_0x7a7d01[_0xf94f('0x5d')]['id'];_0x59d66c[_0xf94f('0x5e')]['id']=_0x7a7d01[_0xf94f('0x57')]['UserId'];return db[_0xf94f('0x3b')][_0xf94f('0x55')]({'where':{'id':_0x7a7d01[_0xf94f('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x59fa19,null))[_0xf94f('0x35')](function(_0x45d71d){if(_0x45d71d){_0x59d66c[_0xf94f('0x26')]=_0x45d71d[_0xf94f('0x5f')]({'plain':!![]});return db[_0xf94f('0x60')][_0xf94f('0x55')]({'where':{'id':_0x45d71d[_0xf94f('0x61')]}});}return null;})[_0xf94f('0x35')](handleEntityNotFound(_0x59fa19,null))[_0xf94f('0x35')](function(_0x1c16aa){if(_0x1c16aa){_0x59d66c[_0xf94f('0x66')]=_0x1c16aa[_0xf94f('0x5f')]({'plain':!![]});interaction_log[_0xf94f('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7a7d01[_0xf94f('0x5d')]['id'],_0x7a7d01[_0xf94f('0x5d')][_0xf94f('0x39')],_0x7a7d01['user'][_0xf94f('0x7d')],_0x59d66c[_0xf94f('0x66')]['id'],_0x7a7d01[_0xf94f('0x57')]?JSON['stringify'](_0x7a7d01[_0xf94f('0x57')]):_0xf94f('0x67'));return respondWithRpcPromise(_0xf94f('0x7e'),_0xf94f('0x7f'),_0x59d66c);}return null;})[_0xf94f('0x35')](function(_0x5bf133){var _0x57347a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5bf133[_0xf94f('0x26')][_0xf94f('0x80')];return db[_0xf94f('0x6b')][_0xf94f('0x3f')](_0x57347a,{'type':db['Sequelize']['QueryTypes'][_0xf94f('0x6e')],'raw':!![]})[_0xf94f('0x35')](function(_0x3b569d){return _0x3b569d;});})[_0xf94f('0x35')](function(_0x119518){if(_0x119518){_0x59d66c[_0xf94f('0x26')][_0xf94f('0x6f')]=_0x119518[0x0];if(!_0x7a7d01[_0xf94f('0x57')][_0xf94f('0x5c')])return;return db[_0xf94f('0x70')][_0xf94f('0x55')]({'where':{'id':_0x7a7d01[_0xf94f('0x57')][_0xf94f('0x5c')],'role':_0xf94f('0x5e')},'attributes':['id','name',_0xf94f('0x71'),_0xf94f('0x72'),_0xf94f('0x73')],'raw':!![]});}return null;})[_0xf94f('0x35')](function(_0x5d2a82){if(!_0x5d2a82)return null;_0x59d66c[_0xf94f('0x26')][_0xf94f('0x5e')]=_0x5d2a82;return _0x59d66c;})['then'](function(_0x936f56){if(_0x936f56){_0x936f56['message']['interface']=util[_0xf94f('0x64')](_0xf94f('0x76'),_0x7a7d01[_0xf94f('0x5d')][_0xf94f('0x39')]);_0x936f56[_0xf94f('0x26')][_0xf94f('0x77')]=_0x59d66c[_0xf94f('0x77')];_0x936f56['message'][_0xf94f('0x78')]=_0x59d66c['channel'];_0x936f56[_0xf94f('0x26')][_0xf94f('0x79')]=_0xf94f('0x32');respondWithRpcPromise('EventManager',_0xf94f('0x7a'),{'event':_0xf94f('0x81'),'message':_0x936f56[_0xf94f('0x26')]},client9002);return _0x59d66c;}return null;})[_0xf94f('0x35')](respondWithResult(_0x59fa19,null))[_0xf94f('0x56')](handleError(_0x59fa19,null));};exports['status']=function(_0x2e90e0,_0x50ed3a,_0x577fb6){if(_0x2e90e0['body']['id']){delete _0x2e90e0[_0xf94f('0x57')]['id'];}var _0x2724aa;return db[_0xf94f('0x3b')][_0xf94f('0x55')]({'where':{'id':_0x2e90e0['params']['id']}})[_0xf94f('0x35')](handleEntityNotFound(_0x50ed3a,null))[_0xf94f('0x35')](function(_0x5c8ba6){if(_0x5c8ba6){_0x2724aa=_0x5c8ba6;return db[_0xf94f('0x82')][_0xf94f('0x55')]({'where':{'id':_0x5c8ba6[_0xf94f('0x83')]}});}})['then'](handleEntityNotFound(_0x50ed3a,null))[_0xf94f('0x35')](function(_0x1a59bf){if(_0x1a59bf){logger[_0xf94f('0x84')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf94f('0x29'),_0xf94f('0x85'),_0x1a59bf[_0xf94f('0x3d')],util['inspect'](_0x2e90e0[_0xf94f('0x57')],{'showHidden':![],'depth':null}));switch(_0x1a59bf['type']){case _0xf94f('0x86'):if(_0x2e90e0[_0xf94f('0x57')]['MessageSid']&&_0x2e90e0[_0xf94f('0x57')]['MessageSid']===_0x2724aa[_0xf94f('0x87')]){return _0x2724aa[_0xf94f('0x34')]({'read':!![]});}else{logger['error'](_0xf94f('0x88'),_0xf94f('0x29'),_0xf94f('0x86'),util[_0xf94f('0x89')](_0x2e90e0[_0xf94f('0x57')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x2e90e0[_0xf94f('0x57')][_0xf94f('0x8a')]&&_0x2e90e0[_0xf94f('0x57')][_0xf94f('0x8a')]===_0x2724aa[_0xf94f('0x87')]&&_[_0xf94f('0x8b')]([_0xf94f('0x8c'),_0xf94f('0x8d')],_0x2e90e0[_0xf94f('0x57')]['Status'])>=0x0){return _0x2724aa[_0xf94f('0x34')]({'read':!![]});}else{logger[_0xf94f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf94f('0x29'),_0xf94f('0x8e'),util[_0xf94f('0x89')](_0x2e90e0[_0xf94f('0x57')],{'showHidden':![],'depth':null}));}break;case _0xf94f('0x8f'):var _0x635e33=_0x2e90e0[_0xf94f('0x57')][_0xf94f('0x90')][0x0];if(_0x635e33[_0xf94f('0x29')][_0xf94f('0x91')]===_0xf94f('0x92')){return _0x2724aa[_0xf94f('0x34')]({'read':!![]});}else{logger[_0xf94f('0x24')](_0xf94f('0x88'),'status',_0xf94f('0x8f'),util[_0xf94f('0x89')](_0x2e90e0['body'],{'showHidden':![],'depth':null}));}break;}return _0x2724aa;}})['then'](respondWithResult(_0x50ed3a,null))[_0xf94f('0x56')](handleError(_0x50ed3a,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0ad6467..960938c 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 _0x567b=['hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x28f6e6,_0x31f4dc){var _0x4b3933=function(_0x5d00f1){while(--_0x5d00f1){_0x28f6e6['push'](_0x28f6e6['shift']());}};_0x4b3933(++_0x31f4dc);}(_0x567b,0x9b));var _0xb567=function(_0x2d8ad9,_0x50ec51){_0x2d8ad9=_0x2d8ad9-0x0;var _0x1bd0fe=_0x567b[_0x2d8ad9];return _0x1bd0fe;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xb567('0x0'))['db'][_0xb567('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb567('0x2')](0x0);var events={'afterCreate':_0xb567('0x3'),'afterUpdate':_0xb567('0x4'),'afterDestroy':_0xb567('0x5')};function emitEvent(_0x2d4cfb){return function(_0x15df04,_0x3e430b,_0x15e93b){SmsMessageEvents['emit'](_0x2d4cfb+':'+_0x15df04['id'],_0x15df04);SmsMessageEvents[_0xb567('0x6')](_0x2d4cfb,_0x15df04);_0x15e93b(null);};}for(var e in events){if(events[_0xb567('0x7')](e)){var event=events[e];SmsMessage[_0xb567('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x16f0=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x16f0,0x1e2));var _0x016f=function(_0x2a433d,_0x594b54){_0x2a433d=_0x2a433d-0x0;var _0x1fc3ca=_0x16f0[_0x2a433d];return _0x1fc3ca;};'use strict';var EventEmitter=require(_0x016f('0x0'));var SmsMessage=require(_0x016f('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x016f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x016f('0x3'),'afterDestroy':_0x016f('0x4')};function emitEvent(_0x9701ca){return function(_0x55d28b,_0x55cb5d,_0x2b4400){SmsMessageEvents['emit'](_0x9701ca+':'+_0x55d28b['id'],_0x55d28b);SmsMessageEvents[_0x016f('0x5')](_0x9701ca,_0x55d28b);_0x2b4400(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x016f('0x6')](e,emitEvent(event));}}module[_0x016f('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ec39ca5..2647f69 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 _0xce9a=['findOne','then','createdAt','catch','error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','create','phone','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','smsMethod','sender','login?username=','username','&password=','GET','split','sms','user_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','password','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','data','queued_count','head','message_id','clickSend','plivo','authId','remote','format','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','sms_messages','messageId','body','FULLTEXT','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xce9a,0x66));var _0xace9=function(_0x59c797,_0x2d62b7){_0x59c797=_0x59c797-0x0;var _0x44c474=_0xce9a[_0x59c797];return _0x44c474;};'use strict';var _=require(_0xace9('0x0'));var util=require(_0xace9('0x1'));var logger=require(_0xace9('0x2'))(_0xace9('0x3'));var moment=require(_0xace9('0x4'));var BPromise=require('bluebird');var rp=require(_0xace9('0x5'));var fs=require('fs');var path=require(_0xace9('0x6'));var rimraf=require(_0xace9('0x7'));var config=require(_0xace9('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x31d6fc,_0x374134){return _0x31d6fc[_0xace9('0x9')]('SmsMessage',attributes,{'tableName':_0xace9('0xa'),'paranoid':![],'indexes':[{'name':_0xace9('0xb'),'fields':[_0xace9('0xb')]},{'name':'fti_sms_messages','fields':[_0xace9('0xc')],'type':_0xace9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x251a8a,_0x55c089,_0x538512){var _0x4accc6=_0x31d6fc['models'];var _0x1a9e58=_0x251a8a['get']({'plain':!![]});if(_0x1a9e58[_0xace9('0xe')][_0xace9('0xf')]()==='in'||_0x1a9e58['direction'][_0xace9('0xf')]()===_0xace9('0x10')&&!_0x1a9e58['secret']&&!_[_0xace9('0x11')](_0x1a9e58[_0xace9('0x12')])&&!_[_0xace9('0x11')](_0x1a9e58[_0xace9('0x13')])){_0x4accc6[_0xace9('0x14')][_0xace9('0x15')]({'where':{'id':_0x1a9e58['SmsInteractionId']}})[_0xace9('0x16')](function(_0x234cd1){if(_0x234cd1){_0x234cd1['update']({'lastMsgAt':_0x1a9e58[_0xace9('0x17')],'lastMsgDirection':_0x1a9e58[_0xace9('0xe')][_0xace9('0xf')]()});}})[_0xace9('0x18')](function(_0x25e5fc){console[_0xace9('0x19')](_0x25e5fc);});}if(_0x1a9e58[_0xace9('0xe')]===_0xace9('0x10')&&!_0x1a9e58[_0xace9('0x1a')]){var _0x49b8a3;_0x4accc6['SmsAccount'][_0xace9('0x1b')]({'where':{'id':_0x1a9e58[_0xace9('0x1c')]},'raw':!![]})[_0xace9('0x16')](function(_0x5f37c2){_0x49b8a3=_0x5f37c2;if(_0x49b8a3&&_0x49b8a3[_0xace9('0x1d')]){switch(_0x49b8a3[_0xace9('0x1d')]){case'twilio':var _0x2f9429=require(_0xace9('0x1e'));if(_0x49b8a3[_0xace9('0x1f')]&&_0x49b8a3[_0xace9('0x20')]&&_0x49b8a3['phone']){var _0x3b17b3=new _0x2f9429(_0x49b8a3[_0xace9('0x1f')],_0x49b8a3[_0xace9('0x20')]);_0x3b17b3['messages'][_0xace9('0x21')]({'body':_0x1a9e58[_0xace9('0xc')],'to':_0x1a9e58[_0xace9('0x22')],'from':_0x49b8a3['phone'],'statusCallback':_0x49b8a3['remote']+_0xace9('0x23')+_0x1a9e58['id']+_0xace9('0x24')+_0x49b8a3[_0xace9('0x25')]})[_0xace9('0x16')](function(_0x6d8581){if(_0x6d8581[_0xace9('0x26')]){return _0x251a8a[_0xace9('0x27')]({'messageId':_0x6d8581[_0xace9('0x26')]});}})['catch'](function(_0x358fb1){logger[_0xace9('0x19')](_0xace9('0x28'),'afterCreate',_0xace9('0x1e'),util[_0xace9('0x29')](_0x358fb1,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),'afterCreate',_0xace9('0x1e'),_0xace9('0x2a'));}break;case _0xace9('0x2b'):var _0xf458f9='https://api.skebby.it/API/v1.0/REST/';if(_0x49b8a3['username']&&_0x49b8a3['password']){var _0x576c58={'recipient':[_0x1a9e58[_0xace9('0x22')]],'message':_0x1a9e58['body'],'message_type':_0x49b8a3[_0xace9('0x2c')]};if(_0x49b8a3[_0xace9('0x2c')]&&_0x49b8a3[_0xace9('0x2c')]!=='SI'){_0x576c58[_0xace9('0x2d')]=_0x49b8a3[_0xace9('0x22')];}var _0x271ff1={'url':_0xf458f9+_0xace9('0x2e')+_0x49b8a3[_0xace9('0x2f')]+_0xace9('0x30')+_0x49b8a3['password'],'method':_0xace9('0x31')};rp(_0x271ff1)[_0xace9('0x16')](function(_0x590511){var _0x5a7bd2=_0x590511[_0xace9('0x32')](';');var _0x50354a={'user_key':_0x5a7bd2[0x0],'session_key':_0x5a7bd2[0x1]};_0x271ff1={'url':_0xf458f9+_0xace9('0x33'),'method':'POST','headers':{'user_key':_0x50354a[_0xace9('0x34')],'Session_key':_0x50354a['session_key']},'json':!![],'body':_0x576c58};return rp(_0x271ff1);})[_0xace9('0x16')](function(_0x121b68){if(_0x121b68[_0xace9('0x35')]>=0x1){var _0x1a0b9e={'messageId':_0x121b68[_0xace9('0x36')]};if(_0x49b8a3[_0xace9('0x2c')]!=='GP'||!_0x49b8a3[_0xace9('0x37')]){_0x1a0b9e[_0xace9('0x38')]=!![];}return _0x251a8a[_0xace9('0x27')](_0x1a0b9e);}else{return logger['error'](_0xace9('0x28'),'afterCreate',_0xace9('0x2b'),util['inspect'](_0x121b68,{'showHidden':![],'depth':null}));}})['catch'](function(_0x64d384){return logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x2b'),util[_0xace9('0x29')](_0x64d384,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x2b'),_0xace9('0x3a'));}break;case _0xace9('0x3b'):if(_0x49b8a3[_0xace9('0x20')]){var _0x2a84fe={'recipient':_0x1a9e58[_0xace9('0x22')],'message':_0x1a9e58[_0xace9('0xc')],'sender':_0x49b8a3[_0xace9('0x3c')]||_0x49b8a3[_0xace9('0x22')],'authorization':_0x49b8a3[_0xace9('0x20')]};var _0x55c089={'method':_0xace9('0x3d'),'uri':_0xace9('0x3e'),'body':_0x2a84fe,'json':!![]};rp(_0x55c089)['then'](function(_0x43aec5){var _0x5eff4c={'messageId':_0x43aec5[_0xace9('0x3f')]};if(!_0x49b8a3[_0xace9('0x37')]){_0x5eff4c[_0xace9('0x38')]=!![];}return _0x251a8a['update'](_0x5eff4c);})[_0xace9('0x18')](function(_0x59aecf){logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x3b'),util[_0xace9('0x29')](_0x59aecf,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),'afterCreate',_0xace9('0x3b'),_0xace9('0x40'));}break;case'clicksend':if(_0x49b8a3[_0xace9('0x2f')]&&_0x49b8a3[_0xace9('0x41')]){var _0x2a84fe={'messages':[{'source':_0xace9('0x42'),'to':_0x1a9e58[_0xace9('0x22')],'body':_0x1a9e58['body'],'from':_0x49b8a3[_0xace9('0x3c')]||_0x49b8a3[_0xace9('0x22')]}]};var _0x3444b6=util['format'](_0xace9('0x43'),_0x49b8a3['username'],_0x49b8a3[_0xace9('0x41')]);var _0x55c089={'method':_0xace9('0x3d'),'uri':_0xace9('0x44'),'body':_0x2a84fe,'headers':{'Authorization':util['format'](_0xace9('0x45'),new Buffer(_0x3444b6)[_0xace9('0x46')](_0xace9('0x47')))},'json':!![]};rp(_0x55c089)[_0xace9('0x16')](function(_0x2e141f){if(_0x2e141f['http_code']>=0xc8&&_0x2e141f['http_code']<=0xce){if(_0x2e141f[_0xace9('0x48')]&&_0x2e141f[_0xace9('0x48')][_0xace9('0x49')]>0x0){var _0x574b43=_[_0xace9('0x4a')](_0x2e141f[_0xace9('0x48')]['messages']);var _0x4bb183={'messageId':_0x574b43[_0xace9('0x4b')]};if(!_0x49b8a3['deliveryReport']){_0x4bb183[_0xace9('0x38')]=!![];}return _0x251a8a[_0xace9('0x27')](_0x4bb183);}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x4c'),util[_0xace9('0x29')](_0x2e141f,{'showHidden':![],'depth':null}));}}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x4c'),util[_0xace9('0x29')](_0x2e141f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2df681){logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xace9('0x4c'),util[_0xace9('0x29')](_0x2df681,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xace9('0x4c'),_0xace9('0x3a'));}break;case _0xace9('0x4d'):if(_0x49b8a3[_0xace9('0x4e')]&&_0x49b8a3[_0xace9('0x20')]){var _0x2a84fe={'dst':_0x1a9e58[_0xace9('0x22')],'text':_0x1a9e58[_0xace9('0xc')],'src':_0x49b8a3[_0xace9('0x3c')]||_0x49b8a3[_0xace9('0x22')],'url':_0x49b8a3[_0xace9('0x4f')]+'/api/sms/messages/'+_0x1a9e58['id']+_0xace9('0x24')+_0x49b8a3[_0xace9('0x25')]};var _0x3444b6=util[_0xace9('0x50')](_0xace9('0x43'),_0x49b8a3[_0xace9('0x4e')],_0x49b8a3[_0xace9('0x20')]);var _0x55c089={'method':_0xace9('0x3d'),'uri':util[_0xace9('0x50')]('https://api.plivo.com/v1/Account/%s/Message/',_0x49b8a3['authId']),'body':_0x2a84fe,'headers':{'Authorization':util[_0xace9('0x50')](_0xace9('0x45'),new Buffer(_0x3444b6)[_0xace9('0x46')](_0xace9('0x47')))},'json':!![]};rp(_0x55c089)[_0xace9('0x16')](function(_0x3ae8d1){var _0x3aa7cb={'messageId':_0x3ae8d1[_0xace9('0x51')][0x0]};return _0x251a8a[_0xace9('0x27')](_0x3aa7cb);})['catch'](function(_0x667c71){logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x4d'),util[_0xace9('0x29')](_0x667c71,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x4d'),_0xace9('0x52'));}break;case _0xace9('0x53'):if(_0x49b8a3[_0xace9('0x2f')]&&_0x49b8a3[_0xace9('0x41')]){if(_0x49b8a3[_0xace9('0x54')]){var _0x30daad={'method':_0xace9('0x3d'),'uri':_0x49b8a3[_0xace9('0x54')]+'/auth/1/session','body':{'username':_0x49b8a3[_0xace9('0x2f')],'password':_0x49b8a3[_0xace9('0x41')]},'json':!![]};return rp(_0x30daad)[_0xace9('0x16')](function(_0x384772){var _0x38e964={'method':_0xace9('0x3d'),'uri':_0x49b8a3['baseUrl']+_0xace9('0x55'),'body':{'messages':[{'from':_0x49b8a3['phone'],'destinations':[{'to':_0x1a9e58['phone']}],'text':_0x1a9e58[_0xace9('0xc')],'notifyUrl':_0x49b8a3['remote']+'/api/sms/messages/'+_0x1a9e58['id']+'/status?token='+_0x49b8a3['token'],'notifyContentType':_0xace9('0x56'),'callbackData':_0x49b8a3[_0xace9('0x22')]+';'+_0x1a9e58['body']}]},'headers':{'Authorization':_0xace9('0x57')+_0x384772['token']},'json':!![]};return rp(_0x38e964)[_0xace9('0x16')](function(_0x5a7636){if(_0x5a7636[_0xace9('0x58')]){var _0x5671ff={'messageId':_0x5a7636[_0xace9('0x58')][0x0][_0xace9('0xb')]};if(!_0x49b8a3[_0xace9('0x37')]){_0x5671ff[_0xace9('0x38')]=!![];}return _0x251a8a[_0xace9('0x27')](_0x5671ff);}else{return logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x53'),util[_0xace9('0x29')](_0x5a7636,{'showHidden':![],'depth':null}));}});})[_0xace9('0x18')](function(_0x44af30){return logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xace9('0x53'),util[_0xace9('0x29')](_0x44af30,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x53'),_0xace9('0x59'));}}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x53'),_0xace9('0x3a'));}break;case _0xace9('0x5a'):var _0x1a442d=require(_0xace9('0x5b'));if(_0x49b8a3[_0xace9('0x5c')]){var _0x38ff54={};_0x38ff54[_0xace9('0x5d')]=_0x49b8a3[_0xace9('0x2f')];_0x38ff54[_0xace9('0x22')]=_0x1a9e58[_0xace9('0x22')];_0x38ff54[_0xace9('0x2d')]=_0x49b8a3[_0xace9('0x22')];_0x38ff54[_0xace9('0x5e')]=_0x1a9e58[_0xace9('0xc')];_0x38ff54[_0xace9('0x5f')]=+new Date();var _0x19452e='';var _0x32b6e4='';var _0xcda2fc=Object[_0xace9('0x60')](_0x38ff54);_0xcda2fc[_0xace9('0x61')]();for(var _0x48e180=0x0;_0x48e180<_0xcda2fc[_0xace9('0x62')];_0x48e180++){if(_0x19452e!=''){_0x19452e+='&';}_0x19452e+=_0xcda2fc[_0x48e180]+'='+encodeURIComponent(_0x38ff54[_0xcda2fc[_0x48e180]]);_0x32b6e4+=_0x38ff54[_0xcda2fc[_0x48e180]];}_0x32b6e4+=_0x49b8a3[_0xace9('0x5c')];_0x32b6e4=_0x1a442d[_0xace9('0x63')](_0xace9('0x64'))['update'](_0x32b6e4)[_0xace9('0x65')]('hex');if(_0x19452e!==''){_0x19452e+='&';}_0x19452e+=_0xace9('0x66')+_0x32b6e4;var _0x271ff1={'method':_0xace9('0x31'),'uri':_0x49b8a3[_0xace9('0x54')]+_0xace9('0x67')+_0x19452e,'json':!![]};return rp(_0x271ff1)[_0xace9('0x16')](function(_0x1f0249){var _0x824d64=Object[_0xace9('0x60')](_0x1f0249);if(_0x1f0249[_0x824d64[0x0]][_0xace9('0x19')]&&parseInt(_0x1f0249[_0x824d64[0x0]][_0xace9('0x19')])===0x0){var _0x26d8d5={'messageId':_0x1f0249[_0x824d64[0x0]]['id_sms']};if(!_0x49b8a3[_0xace9('0x37')]){_0x26d8d5['read']=!![];}return _0x251a8a['update'](_0x26d8d5);}else{return logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xace9('0x5a'),util[_0xace9('0x29')](_0x1f0249[_0xace9('0x19')],{'showHidden':![],'depth':null}));}})[_0xace9('0x18')](function(_0x4c2b0e){return logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x5a'),util[_0xace9('0x29')](_0x4c2b0e,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x5a'),_0xace9('0x68'));}break;case _0xace9('0x69'):if(_0x49b8a3[_0xace9('0x5c')]){var _0x2c3b33={'method':_0xace9('0x3d'),'uri':_0xace9('0x6a'),'headers':{'Authorization':_0x49b8a3['apiKey']},'body':{'content':_0x1a9e58[_0xace9('0xc')],'to':[_0x1a9e58['phone']],'from':_0x49b8a3[_0xace9('0x22')],'binary':![],'clientMessageId':_0xace9('0x6b'),'charset':'UTF-8'},'json':!![]};rp(_0x2c3b33)[_0xace9('0x16')](function(_0x458129){if(!_0x458129[_0xace9('0x19')]){var _0x49517d={'messageId':_0x458129[_0xace9('0x58')][0x0][_0xace9('0x6c')]};if(!_0x49b8a3[_0xace9('0x37')]){_0x49517d['read']=!![];}return _0x251a8a[_0xace9('0x27')](_0x49517d);}else{return logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x69'),util[_0xace9('0x29')](_0x458129[_0xace9('0x19')],{'showHidden':![],'depth':null}));}})[_0xace9('0x18')](function(_0x32123c){return logger[_0xace9('0x19')](_0xace9('0x28'),'afterCreate',_0xace9('0x69'),util[_0xace9('0x29')](_0x32123c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x69'),_0xace9('0x68'));}break;case'bandwidth':if(_0x49b8a3[_0xace9('0x2f')]&&_0x49b8a3[_0xace9('0x41')]){var _0x3444b6=util[_0xace9('0x50')](_0xace9('0x43'),_0x49b8a3['username'],_0x49b8a3[_0xace9('0x41')]);var _0x55c089={'method':_0xace9('0x3d'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x49b8a3[_0xace9('0x6d')]+_0xace9('0x6e'),'body':{'to':[_0x1a9e58[_0xace9('0x22')]],'text':_0x1a9e58['body'],'from':_0x49b8a3[_0xace9('0x22')],'applicationId':_0x49b8a3[_0xace9('0x6f')]},'headers':{'Authorization':util[_0xace9('0x50')](_0xace9('0x45'),new Buffer(_0x3444b6)[_0xace9('0x46')](_0xace9('0x47')))},'json':!![]};rp(_0x55c089)[_0xace9('0x16')](function(_0x1b7366){if(_0x1b7366['id']){var _0xfdc1a6={'messageId':_0x1b7366['id']};return _0x251a8a[_0xace9('0x27')](_0xfdc1a6);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x70'),util['inspect'](_0x1b7366,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5e730b){logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x70'),util['inspect'](_0x5e730b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xace9('0x28'),'afterCreate','bandwidth',_0xace9('0x3a'));}break;case _0xace9('0x71'):if(_0x49b8a3['apiKey']){var _0x4b4e21={};var _0x271ff1={'method':'POST','uri':_0xace9('0x72'),'headers':{'Authorization':_0xace9('0x73')+_0x49b8a3[_0xace9('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x49b8a3[_0xace9('0x22')],'to':_0x1a9e58['phone'],'text':_0x1a9e58[_0xace9('0xc')]},'json':!![]};return rp(_0x271ff1)[_0xace9('0x16')](function(_0xf1d646){if(_0xf1d646['code']==0xca){_0x4b4e21[_0xace9('0x74')]=_0xf1d646;var _0x363396={'method':'POST','uri':_0xace9('0x75'),'headers':{'Authorization':_0xace9('0x73')+_0x49b8a3[_0xace9('0x5c')],'Content-Type':_0xace9('0x56')},'body':{'refid':_0x4b4e21['message'][_0xace9('0x76')]},'json':!![]};return rp(_0x363396)[_0xace9('0x16')](function(_0x525171){_0x4b4e21[_0xace9('0x77')]=_0x525171;var _0x37d07b={'messageId':_0x4b4e21[_0xace9('0x74')][_0xace9('0x76')],'read':!![]};return _0x251a8a[_0xace9('0x27')](_0x37d07b);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x71'),util[_0xace9('0x29')](_0xf1d646,{'showHidden':![],'depth':null}));}})[_0xace9('0x18')](function(_0x4f6487){return logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x71'),util[_0xace9('0x29')](_0x4f6487,{'showHidden':![],'depth':null}));});}else{return logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x71'),_0xace9('0x78'));}break;}}})[_0xace9('0x79')](function(){_0x538512();});}else{_0x538512();}}},'charset':_0xace9('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe9fb=['GET','csc','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','base64','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','messageId','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','findOne','catch','error','out','find','then','type','twilio','phone','accountSid','authToken','messages','create','/api/sms/messages/','update','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','sender','login?username=','&password=','sms','user_key','total_sent','internal_order_id','deliveryReport','read','skebby','connectel','senderString','clicksend','xCALLY\x20Motion','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','token','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','timestamp','keys','length','createHash','md5','signature='];(function(_0x5395a1,_0x4f0a00){var _0x474bf9=function(_0xae31e3){while(--_0xae31e3){_0x5395a1['push'](_0x5395a1['shift']());}};_0x474bf9(++_0x4f0a00);}(_0xe9fb,0x8d));var _0xbe9f=function(_0x15f497,_0x54af54){_0x15f497=_0x15f497-0x0;var _0x1d9894=_0xe9fb[_0x15f497];return _0x1d9894;};'use strict';var _=require(_0xbe9f('0x0'));var util=require(_0xbe9f('0x1'));var logger=require(_0xbe9f('0x2'))(_0xbe9f('0x3'));var moment=require(_0xbe9f('0x4'));var BPromise=require(_0xbe9f('0x5'));var rp=require(_0xbe9f('0x6'));var fs=require('fs');var path=require(_0xbe9f('0x7'));var rimraf=require(_0xbe9f('0x8'));var config=require(_0xbe9f('0x9'));var attributes=require('./smsMessage.attributes');module[_0xbe9f('0xa')]=function(_0x2d9250,_0x4dde53){return _0x2d9250['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xbe9f('0xb'),'fields':[_0xbe9f('0xb')]},{'name':'fti_sms_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bb133,_0x15b2e4,_0x4cac22){var _0x22d05f=_0x2d9250[_0xbe9f('0xc')];var _0x41a6ab=_0x5bb133[_0xbe9f('0xd')]({'plain':!![]});if(_0x41a6ab[_0xbe9f('0xe')][_0xbe9f('0xf')]()==='in'||_0x41a6ab[_0xbe9f('0xe')][_0xbe9f('0xf')]()==='out'&&!_0x41a6ab[_0xbe9f('0x10')]&&!_[_0xbe9f('0x11')](_0x41a6ab[_0xbe9f('0x12')])&&!_[_0xbe9f('0x11')](_0x41a6ab[_0xbe9f('0x13')])){_0x22d05f['SmsInteraction'][_0xbe9f('0x14')]({'where':{'id':_0x41a6ab[_0xbe9f('0x13')]}})['then'](function(_0x4b22b8){if(_0x4b22b8){_0x4b22b8['update']({'lastMsgAt':_0x41a6ab['createdAt'],'lastMsgDirection':_0x41a6ab[_0xbe9f('0xe')][_0xbe9f('0xf')]()});}})[_0xbe9f('0x15')](function(_0x1d33e2){console[_0xbe9f('0x16')](_0x1d33e2);});}if(_0x41a6ab[_0xbe9f('0xe')]===_0xbe9f('0x17')&&!_0x41a6ab[_0xbe9f('0x10')]){var _0x46cc40;_0x22d05f['SmsAccount'][_0xbe9f('0x18')]({'where':{'id':_0x41a6ab['SmsAccountId']},'raw':!![]})[_0xbe9f('0x19')](function(_0x1858ce){_0x46cc40=_0x1858ce;if(_0x46cc40&&_0x46cc40[_0xbe9f('0x1a')]){switch(_0x46cc40[_0xbe9f('0x1a')]){case _0xbe9f('0x1b'):var _0x3560fe=require(_0xbe9f('0x1b'));if(_0x46cc40['accountSid']&&_0x46cc40['authToken']&&_0x46cc40[_0xbe9f('0x1c')]){var _0x31e88b=new _0x3560fe(_0x46cc40[_0xbe9f('0x1d')],_0x46cc40[_0xbe9f('0x1e')]);_0x31e88b[_0xbe9f('0x1f')][_0xbe9f('0x20')]({'body':_0x41a6ab['body'],'to':_0x41a6ab['phone'],'from':_0x46cc40[_0xbe9f('0x1c')],'statusCallback':_0x46cc40['remote']+_0xbe9f('0x21')+_0x41a6ab['id']+'/status?token='+_0x46cc40['token']})['then'](function(_0x3002d0){if(_0x3002d0['sid']){return _0x5bb133[_0xbe9f('0x22')]({'messageId':_0x3002d0[_0xbe9f('0x23')]});}})['catch'](function(_0x283113){logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x1b'),util[_0xbe9f('0x26')](_0x283113,{'showHidden':![],'depth':null}));});}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),'afterCreate',_0xbe9f('0x1b'),_0xbe9f('0x27'));}break;case'skebby':var _0x3703f7=_0xbe9f('0x28');if(_0x46cc40[_0xbe9f('0x29')]&&_0x46cc40[_0xbe9f('0x2a')]){var _0x207c6c={'recipient':[_0x41a6ab[_0xbe9f('0x1c')]],'message':_0x41a6ab[_0xbe9f('0x2b')],'message_type':_0x46cc40[_0xbe9f('0x2c')]};if(_0x46cc40['smsMethod']&&_0x46cc40[_0xbe9f('0x2c')]!=='SI'){_0x207c6c[_0xbe9f('0x2d')]=_0x46cc40[_0xbe9f('0x1c')];}var _0x16c727={'url':_0x3703f7+_0xbe9f('0x2e')+_0x46cc40[_0xbe9f('0x29')]+_0xbe9f('0x2f')+_0x46cc40[_0xbe9f('0x2a')],'method':'GET'};rp(_0x16c727)[_0xbe9f('0x19')](function(_0x1ba822){var _0x4ac8a8=_0x1ba822['split'](';');var _0xaf282c={'user_key':_0x4ac8a8[0x0],'session_key':_0x4ac8a8[0x1]};_0x16c727={'url':_0x3703f7+_0xbe9f('0x30'),'method':'POST','headers':{'user_key':_0xaf282c[_0xbe9f('0x31')],'Session_key':_0xaf282c['session_key']},'json':!![],'body':_0x207c6c};return rp(_0x16c727);})['then'](function(_0x47a8ac){if(_0x47a8ac[_0xbe9f('0x32')]>=0x1){var _0x32c3e3={'messageId':_0x47a8ac[_0xbe9f('0x33')]};if(_0x46cc40[_0xbe9f('0x2c')]!=='GP'||!_0x46cc40[_0xbe9f('0x34')]){_0x32c3e3[_0xbe9f('0x35')]=!![];}return _0x5bb133[_0xbe9f('0x22')](_0x32c3e3);}else{return logger[_0xbe9f('0x16')](_0xbe9f('0x24'),'afterCreate',_0xbe9f('0x36'),util[_0xbe9f('0x26')](_0x47a8ac,{'showHidden':![],'depth':null}));}})['catch'](function(_0x27a748){return logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x36'),util[_0xbe9f('0x26')](_0x27a748,{'showHidden':![],'depth':null}));});}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),'afterCreate',_0xbe9f('0x36'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xbe9f('0x37'):if(_0x46cc40['authToken']){var _0x2d27a4={'recipient':_0x41a6ab['phone'],'message':_0x41a6ab['body'],'sender':_0x46cc40[_0xbe9f('0x38')]||_0x46cc40[_0xbe9f('0x1c')],'authorization':_0x46cc40[_0xbe9f('0x1e')]};var _0x15b2e4={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x2d27a4,'json':!![]};rp(_0x15b2e4)[_0xbe9f('0x19')](function(_0x5f4bef){var _0x4aeebd={'messageId':_0x5f4bef['requestid']};if(!_0x46cc40['deliveryReport']){_0x4aeebd[_0xbe9f('0x35')]=!![];}return _0x5bb133[_0xbe9f('0x22')](_0x4aeebd);})['catch'](function(_0x5936f2){logger[_0xbe9f('0x16')](_0xbe9f('0x24'),'afterCreate',_0xbe9f('0x37'),util[_0xbe9f('0x26')](_0x5936f2,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe9f('0x25'),_0xbe9f('0x37'),'Missing\x20parameters:\x20authToken');}break;case _0xbe9f('0x39'):if(_0x46cc40[_0xbe9f('0x29')]&&_0x46cc40[_0xbe9f('0x2a')]){var _0x2d27a4={'messages':[{'source':_0xbe9f('0x3a'),'to':_0x41a6ab['phone'],'body':_0x41a6ab[_0xbe9f('0x2b')],'from':_0x46cc40[_0xbe9f('0x38')]||_0x46cc40['phone']}]};var _0x5b360b=util[_0xbe9f('0x3b')](_0xbe9f('0x3c'),_0x46cc40['username'],_0x46cc40[_0xbe9f('0x2a')]);var _0x15b2e4={'method':_0xbe9f('0x3d'),'uri':_0xbe9f('0x3e'),'body':_0x2d27a4,'headers':{'Authorization':util[_0xbe9f('0x3b')](_0xbe9f('0x3f'),new Buffer(_0x5b360b)[_0xbe9f('0x40')]('base64'))},'json':!![]};rp(_0x15b2e4)['then'](function(_0x1e66b4){if(_0x1e66b4[_0xbe9f('0x41')]>=0xc8&&_0x1e66b4[_0xbe9f('0x41')]<=0xce){if(_0x1e66b4['data']&&_0x1e66b4[_0xbe9f('0x42')][_0xbe9f('0x43')]>0x0){var _0x398f44=_[_0xbe9f('0x44')](_0x1e66b4[_0xbe9f('0x42')][_0xbe9f('0x1f')]);var _0x58d756={'messageId':_0x398f44[_0xbe9f('0x45')]};if(!_0x46cc40[_0xbe9f('0x34')]){_0x58d756[_0xbe9f('0x35')]=!![];}return _0x5bb133['update'](_0x58d756);}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),'clickSend',util['inspect'](_0x1e66b4,{'showHidden':![],'depth':null}));}}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x46'),util[_0xbe9f('0x26')](_0x1e66b4,{'showHidden':![],'depth':null}));}})[_0xbe9f('0x15')](function(_0x2b9773){logger['error'](_0xbe9f('0x24'),'afterCreate',_0xbe9f('0x46'),util[_0xbe9f('0x26')](_0x2b9773,{'showHidden':![],'depth':null}));});}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),'clickSend',_0xbe9f('0x47'));}break;case'plivo':if(_0x46cc40[_0xbe9f('0x48')]&&_0x46cc40['authToken']){var _0x2d27a4={'dst':_0x41a6ab[_0xbe9f('0x1c')],'text':_0x41a6ab[_0xbe9f('0x2b')],'src':_0x46cc40[_0xbe9f('0x38')]||_0x46cc40[_0xbe9f('0x1c')],'url':_0x46cc40['remote']+_0xbe9f('0x21')+_0x41a6ab['id']+_0xbe9f('0x49')+_0x46cc40['token']};var _0x5b360b=util[_0xbe9f('0x3b')](_0xbe9f('0x3c'),_0x46cc40[_0xbe9f('0x48')],_0x46cc40[_0xbe9f('0x1e')]);var _0x15b2e4={'method':_0xbe9f('0x3d'),'uri':util['format'](_0xbe9f('0x4a'),_0x46cc40['authId']),'body':_0x2d27a4,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x5b360b)[_0xbe9f('0x40')]('base64'))},'json':!![]};rp(_0x15b2e4)[_0xbe9f('0x19')](function(_0x3b7b11){var _0x59ce7b={'messageId':_0x3b7b11[_0xbe9f('0x4b')][0x0]};return _0x5bb133[_0xbe9f('0x22')](_0x59ce7b);})[_0xbe9f('0x15')](function(_0x486d00){logger[_0xbe9f('0x16')](_0xbe9f('0x24'),'afterCreate',_0xbe9f('0x4c'),util[_0xbe9f('0x26')](_0x486d00,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe9f('0x25'),_0xbe9f('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xbe9f('0x4d'):if(_0x46cc40[_0xbe9f('0x29')]&&_0x46cc40[_0xbe9f('0x2a')]){if(_0x46cc40[_0xbe9f('0x4e')]){var _0x1b138a={'method':_0xbe9f('0x3d'),'uri':_0x46cc40[_0xbe9f('0x4e')]+_0xbe9f('0x4f'),'body':{'username':_0x46cc40[_0xbe9f('0x29')],'password':_0x46cc40[_0xbe9f('0x2a')]},'json':!![]};return rp(_0x1b138a)['then'](function(_0x2c99f9){var _0x1c7f86={'method':_0xbe9f('0x3d'),'uri':_0x46cc40[_0xbe9f('0x4e')]+_0xbe9f('0x50'),'body':{'messages':[{'from':_0x46cc40[_0xbe9f('0x1c')],'destinations':[{'to':_0x41a6ab['phone']}],'text':_0x41a6ab[_0xbe9f('0x2b')],'notifyUrl':_0x46cc40[_0xbe9f('0x51')]+_0xbe9f('0x21')+_0x41a6ab['id']+_0xbe9f('0x49')+_0x46cc40[_0xbe9f('0x52')],'notifyContentType':_0xbe9f('0x53'),'callbackData':_0x46cc40[_0xbe9f('0x1c')]+';'+_0x41a6ab['body']}]},'headers':{'Authorization':_0xbe9f('0x54')+_0x2c99f9['token']},'json':!![]};return rp(_0x1c7f86)[_0xbe9f('0x19')](function(_0x4630ed){if(_0x4630ed[_0xbe9f('0x1f')]){var _0x3db689={'messageId':_0x4630ed[_0xbe9f('0x1f')][0x0][_0xbe9f('0xb')]};if(!_0x46cc40[_0xbe9f('0x34')]){_0x3db689[_0xbe9f('0x35')]=!![];}return _0x5bb133[_0xbe9f('0x22')](_0x3db689);}else{return logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x4d'),util[_0xbe9f('0x26')](_0x4630ed,{'showHidden':![],'depth':null}));}});})[_0xbe9f('0x15')](function(_0x2952e3){return logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x4d'),util['inspect'](_0x2952e3,{'showHidden':![],'depth':null}));});}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),'infobip',_0xbe9f('0x55'));}}else{logger['error'](_0xbe9f('0x24'),'afterCreate',_0xbe9f('0x4d'),_0xbe9f('0x47'));}break;case'csc':var _0x32a070=require(_0xbe9f('0x56'));if(_0x46cc40[_0xbe9f('0x57')]){var _0x232835={};_0x232835[_0xbe9f('0x58')]=_0x46cc40[_0xbe9f('0x29')];_0x232835[_0xbe9f('0x1c')]=_0x41a6ab[_0xbe9f('0x1c')];_0x232835['sender']=_0x46cc40['phone'];_0x232835['text']=_0x41a6ab['body'];_0x232835[_0xbe9f('0x59')]=+new Date();var _0x56cae2='';var _0x1ccb40='';var _0x25bd63=Object[_0xbe9f('0x5a')](_0x232835);_0x25bd63['sort']();for(var _0x496847=0x0;_0x496847<_0x25bd63[_0xbe9f('0x5b')];_0x496847++){if(_0x56cae2!=''){_0x56cae2+='&';}_0x56cae2+=_0x25bd63[_0x496847]+'='+encodeURIComponent(_0x232835[_0x25bd63[_0x496847]]);_0x1ccb40+=_0x232835[_0x25bd63[_0x496847]];}_0x1ccb40+=_0x46cc40[_0xbe9f('0x57')];_0x1ccb40=_0x32a070[_0xbe9f('0x5c')](_0xbe9f('0x5d'))[_0xbe9f('0x22')](_0x1ccb40)['digest']('hex');if(_0x56cae2!==''){_0x56cae2+='&';}_0x56cae2+=_0xbe9f('0x5e')+_0x1ccb40;var _0x16c727={'method':_0xbe9f('0x5f'),'uri':_0x46cc40[_0xbe9f('0x4e')]+'/external/get/send.php?'+_0x56cae2,'json':!![]};return rp(_0x16c727)[_0xbe9f('0x19')](function(_0x20b889){var _0x31dd03=Object[_0xbe9f('0x5a')](_0x20b889);if(_0x20b889[_0x31dd03[0x0]][_0xbe9f('0x16')]&&parseInt(_0x20b889[_0x31dd03[0x0]][_0xbe9f('0x16')])===0x0){var _0x3d3b3b={'messageId':_0x20b889[_0x31dd03[0x0]]['id_sms']};if(!_0x46cc40[_0xbe9f('0x34')]){_0x3d3b3b[_0xbe9f('0x35')]=!![];}return _0x5bb133[_0xbe9f('0x22')](_0x3d3b3b);}else{return logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x60'),util['inspect'](_0x20b889['error'],{'showHidden':![],'depth':null}));}})[_0xbe9f('0x15')](function(_0x44d2dc){return logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x60'),util[_0xbe9f('0x26')](_0x44d2dc,{'showHidden':![],'depth':null}));});}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x60'),'Missing\x20parameters:\x20apiKey');}break;case _0xbe9f('0x61'):if(_0x46cc40[_0xbe9f('0x57')]){var _0x2c2fda={'method':_0xbe9f('0x3d'),'uri':_0xbe9f('0x62'),'headers':{'Authorization':_0x46cc40[_0xbe9f('0x57')]},'body':{'content':_0x41a6ab[_0xbe9f('0x2b')],'to':[_0x41a6ab['phone']],'from':_0x46cc40[_0xbe9f('0x1c')],'binary':![],'clientMessageId':'uuid','charset':_0xbe9f('0x63')},'json':!![]};rp(_0x2c2fda)[_0xbe9f('0x19')](function(_0x1a0ac3){if(!_0x1a0ac3['error']){var _0x487430={'messageId':_0x1a0ac3[_0xbe9f('0x1f')][0x0][_0xbe9f('0x64')]};if(!_0x46cc40['deliveryReport']){_0x487430['read']=!![];}return _0x5bb133['update'](_0x487430);}else{return logger[_0xbe9f('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe9f('0x25'),_0xbe9f('0x61'),util[_0xbe9f('0x26')](_0x1a0ac3[_0xbe9f('0x16')],{'showHidden':![],'depth':null}));}})[_0xbe9f('0x15')](function(_0x332bbd){return logger['error'](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x61'),util[_0xbe9f('0x26')](_0x332bbd,{'showHidden':![],'depth':null}));});}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x61'),_0xbe9f('0x65'));}break;case _0xbe9f('0x66'):if(_0x46cc40[_0xbe9f('0x29')]&&_0x46cc40['password']){var _0x5b360b=util['format']('%s:%s',_0x46cc40[_0xbe9f('0x29')],_0x46cc40[_0xbe9f('0x2a')]);var _0x15b2e4={'method':_0xbe9f('0x3d'),'uri':_0xbe9f('0x67')+_0x46cc40[_0xbe9f('0x68')]+'/messages','body':{'to':[_0x41a6ab[_0xbe9f('0x1c')]],'text':_0x41a6ab['body'],'from':_0x46cc40[_0xbe9f('0x1c')],'applicationId':_0x46cc40[_0xbe9f('0x69')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x5b360b)[_0xbe9f('0x40')](_0xbe9f('0x6a')))},'json':!![]};rp(_0x15b2e4)[_0xbe9f('0x19')](function(_0x5e7e62){if(_0x5e7e62['id']){var _0x2452e5={'messageId':_0x5e7e62['id']};return _0x5bb133['update'](_0x2452e5);}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),'bandwidth',util['inspect'](_0x5e7e62,{'showHidden':![],'depth':null}));}})[_0xbe9f('0x15')](function(_0xaa5a26){logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),_0xbe9f('0x66'),util[_0xbe9f('0x26')](_0xaa5a26,{'showHidden':![],'depth':null}));});}else{logger[_0xbe9f('0x16')](_0xbe9f('0x24'),'afterCreate',_0xbe9f('0x66'),_0xbe9f('0x47'));}break;case _0xbe9f('0x6b'):if(_0x46cc40[_0xbe9f('0x57')]){var _0x3e1ec5={};var _0x16c727={'method':_0xbe9f('0x3d'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xbe9f('0x6c')+_0x46cc40['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x46cc40[_0xbe9f('0x1c')],'to':_0x41a6ab['phone'],'text':_0x41a6ab[_0xbe9f('0x2b')]},'json':!![]};return rp(_0x16c727)['then'](function(_0x4b87f0){if(_0x4b87f0[_0xbe9f('0x6d')]==0xca){_0x3e1ec5['message']=_0x4b87f0;var _0x1fb48e={'method':'POST','uri':_0xbe9f('0x6e'),'headers':{'Authorization':_0xbe9f('0x6c')+_0x46cc40[_0xbe9f('0x57')],'Content-Type':_0xbe9f('0x53')},'body':{'refid':_0x3e1ec5[_0xbe9f('0x6f')][_0xbe9f('0x70')]},'json':!![]};return rp(_0x1fb48e)['then'](function(_0x3cc5ba){_0x3e1ec5[_0xbe9f('0x71')]=_0x3cc5ba;var _0x33a5d6={'messageId':_0x3e1ec5[_0xbe9f('0x6f')][_0xbe9f('0x70')],'read':!![]};return _0x5bb133['update'](_0x33a5d6);});}else{return logger[_0xbe9f('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe9f('0x25'),_0xbe9f('0x6b'),util['inspect'](_0x4b87f0,{'showHidden':![],'depth':null}));}})[_0xbe9f('0x15')](function(_0xa754c6){return logger[_0xbe9f('0x16')](_0xbe9f('0x24'),_0xbe9f('0x25'),'intelepeer',util[_0xbe9f('0x26')](_0xa754c6,{'showHidden':![],'depth':null}));});}else{return logger[_0xbe9f('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe9f('0x25'),'intelepeer',_0xbe9f('0x72'));}break;}}})[_0xbe9f('0x73')](function(){_0x4cac22();});}else{_0x4cac22();}}},'charset':_0xbe9f('0x74'),'collate':_0xbe9f('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e5fb264..e391ca6 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 _0xcbd7=['catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','register','then','request\x20sent','debug','error','code','SmsMessage,\x20%s,\x20%s','message','CreateSmsMessage','create','body','options','raw','info','stringify'];(function(_0x5a1d58,_0x42ab8d){var _0x5911a9=function(_0x3769a4){while(--_0x3769a4){_0x5a1d58['push'](_0x5a1d58['shift']());}};_0x5911a9(++_0x42ab8d);}(_0xcbd7,0x10f));var _0x7cbd=function(_0x1be47b,_0x3a0916){_0x1be47b=_0x1be47b-0x0;var _0x58eb35=_0xcbd7[_0x1be47b];return _0x58eb35;};'use strict';var _=require(_0x7cbd('0x0'));var util=require(_0x7cbd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7cbd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cbd('0x3'))['db'];var utils=require(_0x7cbd('0x4'));var logger=require('../../config/logger')(_0x7cbd('0x5'));var config=require('../../config/environment');var jayson=require(_0x7cbd('0x6'));var client=jayson[_0x7cbd('0x7')][_0x7cbd('0x8')]({'port':0x232a});config[_0x7cbd('0x9')]=_['defaults'](config[_0x7cbd('0x9')],{'host':_0x7cbd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x7cbd('0xb')](socket);function respondWithRpcPromise(_0x18d300,_0x170a2d,_0x5e7eb3){return new BPromise(function(_0x3e9252,_0x100dd7){return client['request'](_0x18d300,_0x5e7eb3)[_0x7cbd('0xc')](function(_0x55dabf){logger['info']('SmsMessage,\x20%s,\x20%s',_0x170a2d,_0x7cbd('0xd'));logger[_0x7cbd('0xe')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x170a2d,'request\x20sent',JSON['stringify'](_0x55dabf));if(_0x55dabf[_0x7cbd('0xf')]){if(_0x55dabf[_0x7cbd('0xf')][_0x7cbd('0x10')]===0x1f4){logger['error'](_0x7cbd('0x11'),_0x170a2d,_0x55dabf[_0x7cbd('0xf')][_0x7cbd('0x12')]);return _0x100dd7(_0x55dabf[_0x7cbd('0xf')]['message']);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x170a2d,_0x55dabf[_0x7cbd('0xf')][_0x7cbd('0x12')]);return _0x3e9252(_0x55dabf['error'][_0x7cbd('0x12')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x170a2d,'request\x20sent');_0x3e9252(_0x55dabf['result'][_0x7cbd('0x12')]);}})['catch'](function(_0x4d64db){logger[_0x7cbd('0xf')](_0x7cbd('0x11'),_0x170a2d,_0x4d64db);_0x100dd7(_0x4d64db);});});}exports[_0x7cbd('0x13')]=function(_0x5df136){var _0x32d1c4=this;return new Promise(function(_0x3126cb,_0x5f37a7){return db['SmsMessage'][_0x7cbd('0x14')](_0x5df136[_0x7cbd('0x15')],{'raw':_0x5df136[_0x7cbd('0x16')]?_0x5df136[_0x7cbd('0x16')][_0x7cbd('0x17')]===undefined?!![]:![]:!![]})[_0x7cbd('0xc')](function(_0x4c6182){logger[_0x7cbd('0x18')](_0x7cbd('0x13'),_0x5df136);logger['debug'](_0x7cbd('0x13'),_0x5df136,JSON[_0x7cbd('0x19')](_0x4c6182));_0x3126cb(_0x4c6182);})[_0x7cbd('0x1a')](function(_0x562c8d){logger[_0x7cbd('0xf')](_0x7cbd('0x13'),_0x562c8d[_0x7cbd('0x12')],_0x5df136);_0x5f37a7(_0x32d1c4[_0x7cbd('0xf')](0x1f4,_0x562c8d[_0x7cbd('0x12')]));});});}; \ No newline at end of file +var _0x383a=['defaults','socket.io-emitter','register','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','body','options','raw','then','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3e2a63,_0x2b32f8){var _0xdac019=function(_0x395816){while(--_0x395816){_0x3e2a63['push'](_0x3e2a63['shift']());}};_0xdac019(++_0x2b32f8);}(_0x383a,0x8f));var _0xa383=function(_0x213f3d,_0x31c31f){_0x213f3d=_0x213f3d-0x0;var _0x238251=_0x383a[_0x213f3d];return _0x238251;};'use strict';var _=require(_0xa383('0x0'));var util=require(_0xa383('0x1'));var moment=require('moment');var BPromise=require(_0xa383('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa383('0x3'));var db=require(_0xa383('0x4'))['db'];var utils=require(_0xa383('0x5'));var logger=require('../../config/logger')(_0xa383('0x6'));var config=require(_0xa383('0x7'));var jayson=require(_0xa383('0x8'));var client=jayson[_0xa383('0x9')][_0xa383('0xa')]({'port':0x232a});config[_0xa383('0xb')]=_[_0xa383('0xc')](config[_0xa383('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa383('0xd'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xa383('0xe')](socket);function respondWithRpcPromise(_0xb012af,_0x3ae5e1,_0x3b470c){return new BPromise(function(_0x472e68,_0x4bbc50){return client['request'](_0xb012af,_0x3b470c)['then'](function(_0x2e7e09){logger[_0xa383('0xf')](_0xa383('0x10'),_0x3ae5e1,_0xa383('0x11'));logger['debug'](_0xa383('0x12'),_0x3ae5e1,_0xa383('0x11'),JSON[_0xa383('0x13')](_0x2e7e09));if(_0x2e7e09[_0xa383('0x14')]){if(_0x2e7e09[_0xa383('0x14')][_0xa383('0x15')]===0x1f4){logger[_0xa383('0x14')](_0xa383('0x10'),_0x3ae5e1,_0x2e7e09[_0xa383('0x14')][_0xa383('0x16')]);return _0x4bbc50(_0x2e7e09['error'][_0xa383('0x16')]);}logger[_0xa383('0x14')](_0xa383('0x10'),_0x3ae5e1,_0x2e7e09[_0xa383('0x14')][_0xa383('0x16')]);return _0x472e68(_0x2e7e09['error'][_0xa383('0x16')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x3ae5e1,_0xa383('0x11'));_0x472e68(_0x2e7e09[_0xa383('0x17')][_0xa383('0x16')]);}})[_0xa383('0x18')](function(_0x44a223){logger[_0xa383('0x14')](_0xa383('0x10'),_0x3ae5e1,_0x44a223);_0x4bbc50(_0x44a223);});});}exports[_0xa383('0x19')]=function(_0xf0a688){var _0x72aaaa=this;return new Promise(function(_0x477f29,_0x45b915){return db['SmsMessage']['create'](_0xf0a688[_0xa383('0x1a')],{'raw':_0xf0a688['options']?_0xf0a688[_0xa383('0x1b')][_0xa383('0x1c')]===undefined?!![]:![]:!![]})[_0xa383('0x1d')](function(_0x4a5f6f){logger[_0xa383('0xf')](_0xa383('0x19'),_0xf0a688);logger[_0xa383('0x1e')](_0xa383('0x19'),_0xf0a688,JSON[_0xa383('0x13')](_0x4a5f6f));_0x477f29(_0x4a5f6f);})[_0xa383('0x18')](function(_0x241082){logger['error']('CreateSmsMessage',_0x241082[_0xa383('0x16')],_0xf0a688);_0x45b915(_0x72aaaa['error'](0x1f4,_0x241082[_0xa383('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 4f345fe..027d024 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 _0xab69=['emit','removeListener','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab69,0x123));var _0x9ab6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xab69[_0xa464c9];return _0x3d73c4;};'use strict';var SmsMessageEvents=require(_0x9ab6('0x0'));var events=['save',_0x9ab6('0x1'),_0x9ab6('0x2')];function createListener(_0x4ad34d,_0x598313){return function(_0x2064fd){_0x598313[_0x9ab6('0x3')](_0x4ad34d,_0x2064fd);};}function removeListener(_0x5e7a7c,_0x4c0671){return function(){SmsMessageEvents[_0x9ab6('0x4')](_0x5e7a7c,_0x4c0671);};}exports['register']=function(_0x1cff78){for(var _0x4636a3=0x0,_0x461ca6=events[_0x9ab6('0x5')];_0x4636a3<_0x461ca6;_0x4636a3++){var _0x151b1c=events[_0x4636a3];var _0x280bf3=createListener(_0x9ab6('0x6')+_0x151b1c,_0x1cff78);SmsMessageEvents['on'](_0x151b1c,_0x280bf3);}}; \ No newline at end of file +var _0x629d=['remove','emit','removeListener','register','length','smsMessage:'];(function(_0x5ea908,_0x576fdf){var _0x39a6cb=function(_0x39e2ea){while(--_0x39e2ea){_0x5ea908['push'](_0x5ea908['shift']());}};_0x39a6cb(++_0x576fdf);}(_0x629d,0xcc));var _0xd629=function(_0x275293,_0x31bf61){_0x275293=_0x275293-0x0;var _0x539b28=_0x629d[_0x275293];return _0x539b28;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xd629('0x0'),'update'];function createListener(_0x4ff639,_0x25276d){return function(_0x5f2870){_0x25276d[_0xd629('0x1')](_0x4ff639,_0x5f2870);};}function removeListener(_0x4f914b,_0x2bf640){return function(){SmsMessageEvents[_0xd629('0x2')](_0x4f914b,_0x2bf640);};}exports[_0xd629('0x3')]=function(_0x1927bc){for(var _0x2f9fb2=0x0,_0x233a98=events[_0xd629('0x4')];_0x2f9fb2<_0x233a98;_0x2f9fb2++){var _0x2952b0=events[_0x2f9fb2];var _0x2ca52c=createListener(_0xd629('0x5')+_0x2952b0,_0x1927bc);SmsMessageEvents['on'](_0x2952b0,_0x2ca52c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index c4a720c..206238e 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 _0x4d80=['fs-extra','../../config/environment','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','get','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','path','express','Router'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x4d80,0x100));var _0x04d8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4d80[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x04d8('0x0'));var util=require(_0x04d8('0x1'));var path=require(_0x04d8('0x2'));var timeout=require('connect-timeout');var express=require(_0x04d8('0x3'));var router=express[_0x04d8('0x4')]();var fs_extra=require(_0x04d8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x04d8('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x04d8('0x7')](),controller[_0x04d8('0x8')]);router['get'](_0x04d8('0x9'),auth['isAuthenticated'](),controller[_0x04d8('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x04d8('0xb')]);router['get'](_0x04d8('0xc'),auth[_0x04d8('0x7')](),controller[_0x04d8('0xd')]);router[_0x04d8('0xe')](_0x04d8('0xf'),auth['isAuthenticated'](),controller[_0x04d8('0x10')]);router['get'](_0x04d8('0x11'),auth[_0x04d8('0x7')](),controller[_0x04d8('0x12')]);router[_0x04d8('0x13')]('/',auth['isAuthenticated'](),controller[_0x04d8('0x14')]);router['post'](_0x04d8('0xf'),auth[_0x04d8('0x7')](),controller[_0x04d8('0x15')]);router[_0x04d8('0x13')](_0x04d8('0x11'),auth[_0x04d8('0x7')](),controller[_0x04d8('0x16')]);router[_0x04d8('0x17')](_0x04d8('0x18'),auth['isAuthenticated'](),controller['update']);router[_0x04d8('0x19')](_0x04d8('0x18'),auth[_0x04d8('0x7')](),controller[_0x04d8('0x1a')]);router[_0x04d8('0x19')]('/:id/teams',auth[_0x04d8('0x7')](),controller['removeTeams']);router[_0x04d8('0x19')]('/:id/users',auth[_0x04d8('0x7')](),controller[_0x04d8('0x1b')]);module[_0x04d8('0x1c')]=router; \ No newline at end of file +var _0x9021=['/describe','isAuthenticated','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','index','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9021,0x87));var _0x1902=function(_0x27f157,_0x5055df){_0x27f157=_0x27f157-0x0;var _0x3d765=_0x9021[_0x27f157];return _0x3d765;};'use strict';var multer=require(_0x1902('0x0'));var util=require(_0x1902('0x1'));var path=require(_0x1902('0x2'));var timeout=require(_0x1902('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1902('0x4'));var interaction=require(_0x1902('0x5'));var config=require(_0x1902('0x6'));var controller=require(_0x1902('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1902('0x8')]);router[_0x1902('0x9')](_0x1902('0xa'),auth[_0x1902('0xb')](),controller['describe']);router[_0x1902('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1902('0xc')]);router[_0x1902('0x9')](_0x1902('0xd'),auth[_0x1902('0xb')](),controller[_0x1902('0xe')]);router[_0x1902('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1902('0xf')]);router[_0x1902('0x9')](_0x1902('0x10'),auth[_0x1902('0xb')](),controller[_0x1902('0x11')]);router[_0x1902('0x12')]('/',auth[_0x1902('0xb')](),controller['create']);router['post'](_0x1902('0x13'),auth[_0x1902('0xb')](),controller[_0x1902('0x14')]);router[_0x1902('0x12')](_0x1902('0x10'),auth[_0x1902('0xb')](),controller[_0x1902('0x15')]);router['put'](_0x1902('0x16'),auth[_0x1902('0xb')](),controller[_0x1902('0x17')]);router['delete'](_0x1902('0x16'),auth['isAuthenticated'](),controller[_0x1902('0x18')]);router[_0x1902('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1902('0x1a')]);router[_0x1902('0x19')]('/:id/users',auth[_0x1902('0xb')](),controller[_0x1902('0x1b')]);module[_0x1902('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 72bc5ea..684e0e7 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 _0xa8f4=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3a4095,_0x5abe9c){var _0xabb176=function(_0x3301c5){while(--_0x3301c5){_0x3a4095['push'](_0x3a4095['shift']());}};_0xabb176(++_0x5abe9c);}(_0xa8f4,0x18d));var _0x4a8f=function(_0x164d6f,_0x22f05e){_0x164d6f=_0x164d6f-0x0;var _0x5a17e6=_0xa8f4[_0x164d6f];return _0x5a17e6;};'use strict';var Sequelize=require(_0x4a8f('0x0'));module[_0x4a8f('0x1')]={'name':{'type':Sequelize[_0x4a8f('0x2')],'unique':_0x4a8f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4a8f('0x2')]},'timeout':{'type':Sequelize[_0x4a8f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4a8f('0x5')](_0x4a8f('0x6'),_0x4a8f('0x7'),_0x4a8f('0x8'))}}; \ No newline at end of file +var _0x913a=['STRING','rrmemory','roundrobin','sequelize'];(function(_0x1ea4bc,_0x43f85a){var _0x2e5990=function(_0x5d2d7a){while(--_0x5d2d7a){_0x1ea4bc['push'](_0x1ea4bc['shift']());}};_0x2e5990(++_0x43f85a);}(_0x913a,0x18f));var _0xa913=function(_0x4a7623,_0x5f37d6){_0x4a7623=_0x4a7623-0x0;var _0x5cf46c=_0x913a[_0x4a7623];return _0x5cf46c;};'use strict';var Sequelize=require(_0xa913('0x0'));module['exports']={'name':{'type':Sequelize[_0xa913('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa913('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa913('0x2'),'beepall',_0xa913('0x3'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0e4ac0f..377c79f 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 _0xa671=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','describe','getMembers','UserSmsQueue','length','SmsQueueId','User','UserId','smsPause','updatedAt','createdAt','SIP','getTeams','findOne','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userSmsQueue:save','removeTeams','Team','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','value','transaction','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./smsQueue.socket','register','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','end','sendStatus','error','name','send','index','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','SmsQueue','findAll','rows','catch','show','params','create','body'];(function(_0x47b8bd,_0x43d93a){var _0x5022da=function(_0x362b45){while(--_0x362b45){_0x47b8bd['push'](_0x47b8bd['shift']());}};_0x5022da(++_0x43d93a);}(_0xa671,0x153));var _0x1a67=function(_0x1d524d,_0x3cdf11){_0x1d524d=_0x1d524d-0x0;var _0x552dfb=_0xa671[_0x1d524d];return _0x552dfb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a67('0x0'));var zipdir=require(_0x1a67('0x1'));var jsonpatch=require(_0x1a67('0x2'));var rp=require(_0x1a67('0x3'));var moment=require(_0x1a67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a67('0x5'));var util=require(_0x1a67('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1a67('0x7'));var ejs=require(_0x1a67('0x8'));var fs=require('fs');var fs_extra=require(_0x1a67('0x9'));var _=require(_0x1a67('0xa'));var squel=require(_0x1a67('0xb'));var crypto=require(_0x1a67('0xc'));var jsforce=require(_0x1a67('0xd'));var deskjs=require(_0x1a67('0xe'));var toCsv=require(_0x1a67('0x7'));var querystring=require('querystring');var Papa=require(_0x1a67('0xf'));var Redis=require(_0x1a67('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1a67('0x11'));var as=require(_0x1a67('0x12'));var hardwareService=require(_0x1a67('0x13'));var logger=require(_0x1a67('0x14'))('api');var utils=require(_0x1a67('0x15'));var config=require(_0x1a67('0x16'));var licenseUtil=require(_0x1a67('0x17'));var db=require('../../mysqldb')['db'];config[_0x1a67('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1a67('0x19'))(new Redis(config[_0x1a67('0x18')]));require(_0x1a67('0x1a'))[_0x1a67('0x1b')](socket);function respondWithStatusCode(_0x1d4294,_0x1e69f6){_0x1e69f6=_0x1e69f6||0xcc;return function(_0x220a46){if(_0x220a46){return _0x1d4294['sendStatus'](_0x1e69f6);}return _0x1d4294[_0x1a67('0x1c')](_0x1e69f6)['end']();};}function respondWithResult(_0x23f20e,_0x5b1957){_0x5b1957=_0x5b1957||0xc8;return function(_0x411d1b){if(_0x411d1b){return _0x23f20e['status'](_0x5b1957)[_0x1a67('0x1d')](_0x411d1b);}};}function respondWithFilteredResult(_0x1fb246,_0x2f12e7){return function(_0x32019a){if(_0x32019a){var _0x2f0e4d=typeof _0x2f12e7[_0x1a67('0x1e')]==='undefined'&&typeof _0x2f12e7[_0x1a67('0x1f')]===_0x1a67('0x20');var _0x347e40=_0x32019a['count'];var _0x258146=_0x2f0e4d?0x0:_0x2f12e7[_0x1a67('0x1e')];var _0x1baf8f=_0x2f0e4d?_0x32019a[_0x1a67('0x21')]:_0x2f12e7['offset']+_0x2f12e7[_0x1a67('0x1f')];var _0x5290d1;if(_0x1baf8f>=_0x347e40){_0x1baf8f=_0x347e40;_0x5290d1=0xc8;}else{_0x5290d1=0xce;}_0x1fb246['status'](_0x5290d1);return _0x1fb246['set'](_0x1a67('0x22'),_0x258146+'-'+_0x1baf8f+'/'+_0x347e40)[_0x1a67('0x1d')](_0x32019a);}return null;};}function patchUpdates(_0x4e119a){return function(_0x3b2047){try{jsonpatch[_0x1a67('0x23')](_0x3b2047,_0x4e119a,!![]);}catch(_0x39d2a0){return BPromise[_0x1a67('0x24')](_0x39d2a0);}return _0x3b2047[_0x1a67('0x25')]();};}function saveUpdates(_0x3d07aa,_0x4e0164){return function(_0x3eb054){if(_0x3eb054){return _0x3eb054[_0x1a67('0x26')](_0x3d07aa)[_0x1a67('0x27')](function(_0x113beb){return _0x113beb;});}return null;};}function removeEntity(_0x5b4239,_0x19e145){return function(_0x213825){if(_0x213825){return _0x213825[_0x1a67('0x28')]()[_0x1a67('0x27')](function(){var _0xdd4929=_0x213825['get']({'plain':!![]});var _0x3b7a16=_0x1a67('0x29');return db[_0x1a67('0x2a')][_0x1a67('0x28')]({'where':{'type':_0x3b7a16,'resourceId':_0xdd4929['id']}})[_0x1a67('0x27')](function(){return _0x213825;});})[_0x1a67('0x27')](function(){_0x5b4239[_0x1a67('0x1c')](0xcc)[_0x1a67('0x2b')]();});}};}function handleEntityNotFound(_0x62e27,_0x2d9ea9){return function(_0x474e07){if(!_0x474e07){_0x62e27[_0x1a67('0x2c')](0x194);}return _0x474e07;};}function handleError(_0xe5b0da,_0x79bbbc){_0x79bbbc=_0x79bbbc||0x1f4;return function(_0x230adc){logger[_0x1a67('0x2d')](_0x230adc['stack']);if(_0x230adc[_0x1a67('0x2e')]){delete _0x230adc['name'];}_0xe5b0da[_0x1a67('0x1c')](_0x79bbbc)[_0x1a67('0x2f')](_0x230adc);};}exports[_0x1a67('0x30')]=function(_0x5b6eb9,_0x5a1475){var _0x26b0d2={},_0x51aafd={},_0x3fd7b0={'count':0x0,'rows':[]};var _0x19292d=_['map'](db['SmsQueue'][_0x1a67('0x31')],function(_0x302027){return{'name':_0x302027['fieldName'],'type':_0x302027[_0x1a67('0x32')][_0x1a67('0x33')]};});_0x51aafd[_0x1a67('0x34')]=_['map'](_0x19292d,_0x1a67('0x2e'));_0x51aafd[_0x1a67('0x35')]=_[_0x1a67('0x36')](_0x5b6eb9[_0x1a67('0x35')]);_0x51aafd['filters']=_[_0x1a67('0x37')](_0x51aafd['model'],_0x51aafd[_0x1a67('0x35')]);_0x26b0d2['attributes']=_[_0x1a67('0x37')](_0x51aafd[_0x1a67('0x34')],qs[_0x1a67('0x38')](_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x38')]));_0x26b0d2['attributes']=_0x26b0d2[_0x1a67('0x39')]['length']?_0x26b0d2['attributes']:_0x51aafd['model'];if(!_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x3a')](_0x1a67('0x3b'))){_0x26b0d2[_0x1a67('0x1f')]=qs['limit'](_0x5b6eb9[_0x1a67('0x35')]['limit']);_0x26b0d2[_0x1a67('0x1e')]=qs[_0x1a67('0x1e')](_0x5b6eb9[_0x1a67('0x35')]['offset']);}_0x26b0d2[_0x1a67('0x3c')]=qs[_0x1a67('0x3d')](_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x3d')]);_0x26b0d2[_0x1a67('0x3e')]=qs[_0x1a67('0x3f')](_[_0x1a67('0x40')](_0x5b6eb9['query'],_0x51aafd['filters']),_0x19292d);if(_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x41')]){_0x26b0d2[_0x1a67('0x3e')]=_[_0x1a67('0x42')](_0x26b0d2['where'],{'$or':_[_0x1a67('0x43')](_0x19292d,function(_0x334e60){if(_0x334e60[_0x1a67('0x32')]!==_0x1a67('0x44')){var _0x38cb1e={};_0x38cb1e[_0x334e60['name']]={'$like':'%'+_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x41')]+'%'};return _0x38cb1e;}})});}_0x26b0d2=_['merge']({},_0x26b0d2,_0x5b6eb9[_0x1a67('0x45')]);var _0x335d2d={'where':_0x26b0d2[_0x1a67('0x3e')]};return db[_0x1a67('0x46')][_0x1a67('0x21')](_0x335d2d)['then'](function(_0x360bb1){_0x3fd7b0[_0x1a67('0x21')]=_0x360bb1;if(_0x5b6eb9[_0x1a67('0x35')]['includeAll']){_0x26b0d2['include']=[{'all':!![]}];}return db['SmsQueue'][_0x1a67('0x47')](_0x26b0d2);})[_0x1a67('0x27')](function(_0x117489){_0x3fd7b0[_0x1a67('0x48')]=_0x117489;return _0x3fd7b0;})[_0x1a67('0x27')](respondWithFilteredResult(_0x5a1475,_0x26b0d2))[_0x1a67('0x49')](handleError(_0x5a1475,null));};exports[_0x1a67('0x4a')]=function(_0x52c87e,_0x3e2304){var _0x9d5d60={'raw':!![],'where':{'id':_0x52c87e[_0x1a67('0x4b')]['id']}},_0x4984f5={};_0x4984f5[_0x1a67('0x34')]=_[_0x1a67('0x36')](db[_0x1a67('0x46')][_0x1a67('0x31')]);_0x4984f5['query']=_['keys'](_0x52c87e[_0x1a67('0x35')]);_0x4984f5[_0x1a67('0x3f')]=_[_0x1a67('0x37')](_0x4984f5[_0x1a67('0x34')],_0x4984f5['query']);_0x9d5d60[_0x1a67('0x39')]=_[_0x1a67('0x37')](_0x4984f5[_0x1a67('0x34')],qs[_0x1a67('0x38')](_0x52c87e[_0x1a67('0x35')][_0x1a67('0x38')]));_0x9d5d60[_0x1a67('0x39')]=_0x9d5d60[_0x1a67('0x39')]['length']?_0x9d5d60[_0x1a67('0x39')]:_0x4984f5[_0x1a67('0x34')];if(_0x52c87e[_0x1a67('0x35')]['includeAll']){_0x9d5d60['include']=[{'all':!![]}];}_0x9d5d60=_[_0x1a67('0x42')]({},_0x9d5d60,_0x52c87e[_0x1a67('0x45')]);return db[_0x1a67('0x46')]['find'](_0x9d5d60)[_0x1a67('0x27')](handleEntityNotFound(_0x3e2304,null))[_0x1a67('0x27')](respondWithResult(_0x3e2304,null))[_0x1a67('0x49')](handleError(_0x3e2304,null));};exports[_0x1a67('0x4c')]=function(_0x2aceff,_0x93cba4){return db['SmsQueue'][_0x1a67('0x4c')](_0x2aceff[_0x1a67('0x4d')],{})[_0x1a67('0x27')](function(_0x4edaa){var _0x5c8712=_0x2aceff['user'][_0x1a67('0x4e')]({'plain':!![]});if(!_0x5c8712)throw new Error(_0x1a67('0x4f'));if(_0x5c8712[_0x1a67('0x50')]===_0x1a67('0x51')){var _0x13f9c2=_0x4edaa[_0x1a67('0x4e')]({'plain':!![]});var _0xf55168=_0x1a67('0x29');return db[_0x1a67('0x52')][_0x1a67('0x53')]({'where':{'name':_0xf55168,'userProfileId':_0x5c8712['userProfileId']},'raw':!![]})[_0x1a67('0x27')](function(_0x16377d){if(_0x16377d&&_0x16377d[_0x1a67('0x54')]===0x0){return db[_0x1a67('0x2a')]['create']({'name':_0x13f9c2['name'],'resourceId':_0x13f9c2['id'],'type':_0x16377d[_0x1a67('0x2e')],'sectionId':_0x16377d['id']},{})[_0x1a67('0x27')](function(){return _0x4edaa;});}else{return _0x4edaa;}})[_0x1a67('0x49')](function(_0x96146f){logger[_0x1a67('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x96146f);throw _0x96146f;});}return _0x4edaa;})[_0x1a67('0x27')](respondWithResult(_0x93cba4,0xc9))['catch'](handleError(_0x93cba4,null));};exports[_0x1a67('0x26')]=function(_0x2f9821,_0x33da94){if(_0x2f9821[_0x1a67('0x4d')]['id']){delete _0x2f9821['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x2f9821['params']['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x33da94,null))[_0x1a67('0x27')](saveUpdates(_0x2f9821[_0x1a67('0x4d')],null))[_0x1a67('0x27')](respondWithResult(_0x33da94,null))[_0x1a67('0x49')](handleError(_0x33da94,null));};exports[_0x1a67('0x28')]=function(_0x46de77,_0x43b4f1){return db[_0x1a67('0x46')]['find']({'where':{'id':_0x46de77['params']['id']}})['then'](handleEntityNotFound(_0x43b4f1,null))[_0x1a67('0x27')](removeEntity(_0x43b4f1,null))[_0x1a67('0x49')](handleError(_0x43b4f1,null));};exports[_0x1a67('0x55')]=function(_0x340c0d,_0x1a092b){return db[_0x1a67('0x46')]['describe']()[_0x1a67('0x27')](respondWithResult(_0x1a092b,null))['catch'](handleError(_0x1a092b,null));};exports[_0x1a67('0x56')]=function(_0x9cf5a2,_0x4c3f85,_0x58105b){var _0xd07e8a={'raw':!![],'where':{}},_0x12a6e4={},_0x333dcc;return db['SmsQueue']['findOne']({'where':{'id':_0x9cf5a2[_0x1a67('0x4b')]['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x4c3f85,null))[_0x1a67('0x27')](function(_0x4aa98c){if(_0x4aa98c){_0x333dcc=_0x4aa98c[_0x1a67('0x4e')]({'plain':!![]});_0x12a6e4[_0x1a67('0x34')]=_['keys'](db[_0x1a67('0x57')][_0x1a67('0x31')]);_0x12a6e4[_0x1a67('0x35')]=_[_0x1a67('0x36')](_0x9cf5a2[_0x1a67('0x35')]);_0x12a6e4[_0x1a67('0x3f')]=_[_0x1a67('0x37')](_0x12a6e4[_0x1a67('0x34')],_0x12a6e4[_0x1a67('0x35')]);_0xd07e8a[_0x1a67('0x39')]=_[_0x1a67('0x37')](_0x12a6e4[_0x1a67('0x34')],qs[_0x1a67('0x38')](_0x9cf5a2[_0x1a67('0x35')][_0x1a67('0x38')]));_0xd07e8a[_0x1a67('0x39')]=_0xd07e8a['attributes'][_0x1a67('0x58')]?_0xd07e8a[_0x1a67('0x39')]:_0x12a6e4[_0x1a67('0x34')];if(!_0x9cf5a2[_0x1a67('0x35')][_0x1a67('0x3a')]('nolimit')){_0xd07e8a[_0x1a67('0x1f')]=qs[_0x1a67('0x1f')](_0x9cf5a2[_0x1a67('0x35')]['limit']);_0xd07e8a[_0x1a67('0x1e')]=qs[_0x1a67('0x1e')](_0x9cf5a2[_0x1a67('0x35')]['offset']);}_0xd07e8a[_0x1a67('0x3c')]=qs[_0x1a67('0x3d')](_0x9cf5a2[_0x1a67('0x35')][_0x1a67('0x3d')]);_0xd07e8a[_0x1a67('0x3e')]=qs['filters'](_[_0x1a67('0x40')](_0x9cf5a2[_0x1a67('0x35')],_0x12a6e4[_0x1a67('0x3f')]));_0xd07e8a[_0x1a67('0x3e')][_0x1a67('0x59')]=_0x4aa98c['id'];if(_0x9cf5a2[_0x1a67('0x35')][_0x1a67('0x41')]){_0xd07e8a['where']=_[_0x1a67('0x42')](_0xd07e8a['where'],{'$or':_['map'](_0xd07e8a['attributes'],function(_0x447e29){var _0x381065={};_0x381065[_0x447e29]={'$like':'%'+_0x9cf5a2['query'][_0x1a67('0x41')]+'%'};return _0x381065;})});}_0xd07e8a=_[_0x1a67('0x42')]({},_0xd07e8a,_0x9cf5a2[_0x1a67('0x45')]);return db[_0x1a67('0x57')][_0x1a67('0x47')](_0xd07e8a);}})[_0x1a67('0x27')](function(_0x484109){if(_0x484109){return db[_0x1a67('0x5a')]['findAndCountAll']({'where':{'id':_[_0x1a67('0x43')](_0x484109,_0x1a67('0x5b')),'role':'agent'},'attributes':['id',_0x1a67('0x2e'),_0x1a67('0x5c'),_0x1a67('0x5d'),_0x1a67('0x5e')]});}})[_0x1a67('0x27')](function(_0x10f0cf){if(_0x10f0cf){return{'count':_0x10f0cf['count'],'rows':_[_0x1a67('0x43')](_0x10f0cf[_0x1a67('0x48')],function(_0x47a842){return{'membername':_0x47a842['name'],'UserId':_0x47a842['id'],'queue_name':_0x333dcc[_0x1a67('0x2e')],'SmsQueueId':_0x333dcc['id'],'interface':util['format']('%s/%s',_0x1a67('0x5f'),_0x47a842[_0x1a67('0x2e')]),'penalty':0x0,'paused':_0x47a842['smsPause'],'createdAt':_0x47a842['createdAt'],'updatedAt':_0x47a842[_0x1a67('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1a67('0x27')](respondWithFilteredResult(_0x4c3f85,_0xd07e8a))[_0x1a67('0x49')](handleError(_0x4c3f85,null));};exports[_0x1a67('0x60')]=function(_0x33b5de,_0x2c3670,_0xadb5f){var _0x33bc35={};var _0x2f791d={};var _0x53b6f7;var _0x5a2a15;return db[_0x1a67('0x46')][_0x1a67('0x61')]({'where':{'id':_0x33b5de['params']['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x2c3670,null))[_0x1a67('0x27')](function(_0x2c6edc){if(_0x2c6edc){_0x53b6f7=_0x2c6edc;_0x2f791d[_0x1a67('0x34')]=_['keys'](db['Team'][_0x1a67('0x31')]);_0x2f791d[_0x1a67('0x35')]=_['keys'](_0x33b5de['query']);_0x2f791d[_0x1a67('0x3f')]=_[_0x1a67('0x37')](_0x2f791d[_0x1a67('0x34')],_0x2f791d['query']);_0x33bc35[_0x1a67('0x39')]=_[_0x1a67('0x37')](_0x2f791d[_0x1a67('0x34')],qs['fields'](_0x33b5de[_0x1a67('0x35')][_0x1a67('0x38')]));_0x33bc35[_0x1a67('0x39')]=_0x33bc35['attributes'][_0x1a67('0x58')]?_0x33bc35[_0x1a67('0x39')]:_0x2f791d[_0x1a67('0x34')];_0x33bc35['order']=qs['sort'](_0x33b5de[_0x1a67('0x35')][_0x1a67('0x3d')]);_0x33bc35[_0x1a67('0x3e')]=qs[_0x1a67('0x3f')](_[_0x1a67('0x40')](_0x33b5de[_0x1a67('0x35')],_0x2f791d[_0x1a67('0x3f')]));if(_0x33b5de['query'][_0x1a67('0x41')]){_0x33bc35[_0x1a67('0x3e')]=_['merge'](_0x33bc35[_0x1a67('0x3e')],{'$or':_[_0x1a67('0x43')](_0x33bc35[_0x1a67('0x39')],function(_0x3e742d){var _0x406da9={};_0x406da9[_0x3e742d]={'$like':'%'+_0x33b5de[_0x1a67('0x35')][_0x1a67('0x41')]+'%'};return _0x406da9;})});}_0x33bc35=_[_0x1a67('0x42')]({},_0x33bc35,_0x33b5de[_0x1a67('0x45')]);return _0x53b6f7['getTeams'](_0x33bc35);}})['then'](function(_0x2ae026){if(_0x2ae026){_0x5a2a15=_0x2ae026[_0x1a67('0x58')];if(!_0x33b5de['query'][_0x1a67('0x3a')]('nolimit')){_0x33bc35[_0x1a67('0x1f')]=qs[_0x1a67('0x1f')](_0x33b5de[_0x1a67('0x35')][_0x1a67('0x1f')]);_0x33bc35[_0x1a67('0x1e')]=qs['offset'](_0x33b5de[_0x1a67('0x35')][_0x1a67('0x1e')]);}return _0x53b6f7[_0x1a67('0x60')](_0x33bc35);}})['then'](function(_0x21e20a){if(_0x21e20a){return _0x21e20a?{'count':_0x5a2a15,'rows':_0x21e20a}:null;}})['then'](respondWithResult(_0x2c3670,null))['catch'](handleError(_0x2c3670,null));};exports[_0x1a67('0x62')]=function(_0xaee5b2,_0x37fe11,_0x5e0183){var _0x326466=_0xaee5b2[_0x1a67('0x4d')][_0x1a67('0x63')];return db['Team']['findAll']({'where':{'id':_0x326466},'attributes':['id'],'include':[{'model':db[_0x1a67('0x5a')],'as':_0x1a67('0x64'),'attributes':['id',_0x1a67('0x2e'),_0x1a67('0x65'),_0x1a67('0x66'),_0x1a67('0x67')],'raw':!![]}]})[_0x1a67('0x27')](function(_0xa2ead9){if(_0xa2ead9){var _0x3d3454=_[_0x1a67('0x68')](_0xa2ead9,function(_0x484a56){var _0x5dd3d2=_0x484a56[_0x1a67('0x4e')]({'plain':!![]});return _0x5dd3d2[_0x1a67('0x64')];});return db[_0x1a67('0x46')][_0x1a67('0x53')]({'where':{'id':_0xaee5b2[_0x1a67('0x4b')]['id']}})[_0x1a67('0x27')](function(_0x3667a0){return db[_0x1a67('0x69')]['transaction'](function(_0x1f8aee){return _0x3667a0[_0x1a67('0x62')](_0x326466,{'transaction':_0x1f8aee})[_0x1a67('0x27')](function(){return BPromise[_0x1a67('0x6a')](_0x3d3454,function(_0x46facc){return db['UserSmsQueue'][_0x1a67('0x6b')]({'where':{'UserId':_0x46facc['id'],'SmsQueueId':_0xaee5b2[_0x1a67('0x4b')]['id']},'transaction':_0x1f8aee});});})['then'](function(){_0x3d3454['forEach'](function(_0x1db76c){socket[_0x1a67('0x6c')](_0x1a67('0x6d'),{'UserId':_0x1db76c['id'],'SmsQueueId':_0x3667a0['id']});});});});});}})[_0x1a67('0x27')](respondWithStatusCode(_0x37fe11,null))[_0x1a67('0x49')](handleError(_0x37fe11,null));};exports[_0x1a67('0x6e')]=function(_0x13cf17,_0x12bf18,_0x564d66){return db[_0x1a67('0x6f')]['findAll']({'where':{'id':_0x13cf17[_0x1a67('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1a67('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x12bf18,null))[_0x1a67('0x27')](function(_0x3e447b){var _0x4410a9=_[_0x1a67('0x43')](_0x3e447b,'id');var _0x41ff70=[];var _0x451372=[];var _0x48a907=squel[_0x1a67('0x70')]();_0x48a907[_0x1a67('0x71')](_0x1a67('0x72'))['from']('team_has_sms_queues','tq')[_0x1a67('0x73')](_0x1a67('0x74'),'ut',_0x1a67('0x75'))[_0x1a67('0x3e')](_0x1a67('0x76'),_0x13cf17[_0x1a67('0x4b')]['id']);for(var _0x4b6804=0x0;_0x4b6804<_0x3e447b[_0x1a67('0x58')];_0x4b6804+=0x1){let _0x1bab3a=_0x3e447b[_0x4b6804];for(var _0x3b9ecc=0x0;_0x3b9ecc<_0x1bab3a['Agents'][_0x1a67('0x58')];_0x3b9ecc+=0x1){let _0x16c6b2=_0x1bab3a[_0x1a67('0x64')][_0x3b9ecc];var _0x37b477=_0x48a907[_0x1a67('0x77')]();_0x37b477[_0x1a67('0x3e')](_0x1a67('0x78'),_0x16c6b2['id']);_0x451372[_0x1a67('0x79')](db[_0x1a67('0x69')][_0x1a67('0x35')](_0x37b477[_0x1a67('0x7a')](),{'type':db[_0x1a67('0x69')]['QueryTypes'][_0x1a67('0x7b')]})[_0x1a67('0x27')](function(_0x2991ba){if(_0x2991ba[_0x1a67('0x58')]===0x1){return _0x16c6b2['id'];}else{var _0x5e0407=_[_0x1a67('0x7c')](_[_0x1a67('0x43')](_0x2991ba,_0x1a67('0x7d')),function(_0x1477aa){return _['includes'](_0x4410a9,_0x1477aa);});if(_0x5e0407){return _0x16c6b2['id'];}}}));}}return BPromise[_0x1a67('0x7e')](_0x451372)[_0x1a67('0x27')](function(_0x4a9a36){_0x41ff70=_(_0x41ff70)[_0x1a67('0x7f')](_0x4a9a36)['compact']()[_0x1a67('0x80')]();return db['SmsQueue'][_0x1a67('0x53')]({'where':{'id':_0x13cf17[_0x1a67('0x4b')]['id']}})['then'](function(_0x5693fe){return db['sequelize'][_0x1a67('0x81')](function(_0x565394){return _0x5693fe[_0x1a67('0x6e')](_0x13cf17[_0x1a67('0x35')][_0x1a67('0x63')],{'transaction':_0x565394})[_0x1a67('0x27')](function(){if(!_[_0x1a67('0x82')](_0x41ff70)){return _0x5693fe[_0x1a67('0x83')](_0x41ff70,{'transaction':_0x565394});}})[_0x1a67('0x27')](function(){_0x41ff70[_0x1a67('0x84')](function(_0x3ba0f7){socket[_0x1a67('0x6c')](_0x1a67('0x85'),{'UserId':_0x3ba0f7,'SmsQueueId':_0x5693fe['id']});});});});});});})[_0x1a67('0x27')](respondWithStatusCode(_0x12bf18,null))['catch'](handleError(_0x12bf18,null));};exports['addAgents']=function(_0x3552b1,_0x9de296,_0x148b36){return db['SmsQueue'][_0x1a67('0x53')]({'where':{'id':_0x3552b1[_0x1a67('0x4b')]['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x9de296,null))[_0x1a67('0x27')](function(_0x1c8714){if(_0x1c8714){return _0x1c8714[_0x1a67('0x86')](_0x3552b1[_0x1a67('0x4d')]['ids'],_[_0x1a67('0x87')](_0x3552b1[_0x1a67('0x4d')],['ids','id'])||{})[_0x1a67('0x88')](function(_0x43defa){for(var _0x336945=0x0;_0x336945<_0x3552b1[_0x1a67('0x4d')][_0x1a67('0x63')][_0x1a67('0x58')];_0x336945+=0x1){socket[_0x1a67('0x6c')](_0x1a67('0x6d'),{'UserId':Number(_0x3552b1['body']['ids'][_0x336945]),'SmsQueueId':Number(_0x3552b1[_0x1a67('0x4b')]['id'])});}return _0x43defa;});}})[_0x1a67('0x27')](respondWithResult(_0x9de296,null))[_0x1a67('0x49')](handleError(_0x9de296,null));};exports['removeAgents']=function(_0xe81592,_0x156930,_0x3855cb){return db['SmsQueue'][_0x1a67('0x53')]({'where':{'id':_0xe81592['params']['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x156930,null))[_0x1a67('0x27')](function(_0x4aabdb){if(_0x4aabdb){return _0x4aabdb[_0x1a67('0x83')](_0xe81592[_0x1a67('0x35')][_0x1a67('0x63')])[_0x1a67('0x27')](function(){if(_[_0x1a67('0x89')](_0xe81592[_0x1a67('0x35')][_0x1a67('0x63')])){for(var _0x2c974d=0x0;_0x2c974d<_0xe81592[_0x1a67('0x35')]['ids'][_0x1a67('0x58')];_0x2c974d+=0x1){socket['emit'](_0x1a67('0x85'),{'UserId':Number(_0xe81592[_0x1a67('0x35')][_0x1a67('0x63')][_0x2c974d]),'SmsQueueId':Number(_0xe81592['params']['id'])});}}else{socket[_0x1a67('0x6c')](_0x1a67('0x85'),{'UserId':Number(_0xe81592['query'][_0x1a67('0x63')]),'SmsQueueId':Number(_0xe81592[_0x1a67('0x4b')]['id'])});}});}})[_0x1a67('0x27')](respondWithStatusCode(_0x156930,null))[_0x1a67('0x49')](handleError(_0x156930,null));};exports[_0x1a67('0x8a')]=function(_0x4708cb,_0x206d1e,_0x5ee39d){var _0x4011da={};var _0x343a48={};var _0x32b4e5;var _0x588e32;return db[_0x1a67('0x46')][_0x1a67('0x61')]({'where':{'id':_0x4708cb[_0x1a67('0x4b')]['id']}})['then'](handleEntityNotFound(_0x206d1e,null))[_0x1a67('0x27')](function(_0xab9514){if(_0xab9514){_0x32b4e5=_0xab9514;_0x343a48['model']=_[_0x1a67('0x36')](db['User'][_0x1a67('0x31')]);_0x343a48[_0x1a67('0x35')]=_[_0x1a67('0x36')](_0x4708cb['query']);_0x343a48[_0x1a67('0x3f')]=_[_0x1a67('0x37')](_0x343a48[_0x1a67('0x34')],_0x343a48['query']);_0x4011da[_0x1a67('0x39')]=_[_0x1a67('0x37')](_0x343a48[_0x1a67('0x34')],qs[_0x1a67('0x38')](_0x4708cb[_0x1a67('0x35')][_0x1a67('0x38')]));_0x4011da[_0x1a67('0x39')]=_0x4011da[_0x1a67('0x39')][_0x1a67('0x58')]?_0x4011da['attributes']:_0x343a48[_0x1a67('0x34')];_0x4011da['order']=qs['sort'](_0x4708cb[_0x1a67('0x35')][_0x1a67('0x3d')]);_0x4011da[_0x1a67('0x3e')]=qs['filters'](_[_0x1a67('0x40')](_0x4708cb[_0x1a67('0x35')],_0x343a48[_0x1a67('0x3f')]));if(_0x4708cb[_0x1a67('0x35')]['filter']){_0x4011da[_0x1a67('0x3e')]=_[_0x1a67('0x42')](_0x4011da['where'],{'$or':_[_0x1a67('0x43')](_0x4011da[_0x1a67('0x39')],function(_0xd135c9){var _0x21a5c1={};_0x21a5c1[_0xd135c9]={'$like':'%'+_0x4708cb[_0x1a67('0x35')][_0x1a67('0x41')]+'%'};return _0x21a5c1;})});}_0x4011da=_[_0x1a67('0x42')]({},_0x4011da,_0x4708cb[_0x1a67('0x45')]);return _0x32b4e5['getAgents'](_0x4011da);}})[_0x1a67('0x27')](function(_0x13eaf0){if(_0x13eaf0){_0x588e32=_0x13eaf0[_0x1a67('0x58')];if(!_0x4708cb['query'][_0x1a67('0x3a')](_0x1a67('0x3b'))){_0x4011da[_0x1a67('0x1f')]=qs['limit'](_0x4708cb[_0x1a67('0x35')][_0x1a67('0x1f')]);_0x4011da[_0x1a67('0x1e')]=qs[_0x1a67('0x1e')](_0x4708cb[_0x1a67('0x35')][_0x1a67('0x1e')]);}return _0x32b4e5[_0x1a67('0x8a')](_0x4011da);}})['then'](function(_0x12b1e5){if(_0x12b1e5){return _0x12b1e5?{'count':_0x588e32,'rows':_0x12b1e5}:null;}})[_0x1a67('0x27')](respondWithResult(_0x206d1e,null))[_0x1a67('0x49')](handleError(_0x206d1e,null));}; \ No newline at end of file +var _0xc496=['rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','order','sort','where','pick','VIRTUAL','filter','options','include','findAll','rows','catch','params','length','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserSmsQueue','hasOwnProperty','nolimit','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','User','online','flatMap','Agents','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','TeamId','all','union','compact','value','transaction','removeTeams','isEmpty','addAgents','omit','spread','removeAgents','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue'];(function(_0x4989fe,_0x201e34){var _0x4afd24=function(_0x3bb870){while(--_0x3bb870){_0x4989fe['push'](_0x4989fe['shift']());}};_0x4afd24(++_0x201e34);}(_0xc496,0x170));var _0x6c49=function(_0x2a6d45,_0x3c9321){_0x2a6d45=_0x2a6d45-0x0;var _0x295253=_0xc496[_0x2a6d45];return _0x295253;};'use strict';var emlformat=require(_0x6c49('0x0'));var rimraf=require(_0x6c49('0x1'));var zipdir=require(_0x6c49('0x2'));var jsonpatch=require(_0x6c49('0x3'));var rp=require(_0x6c49('0x4'));var moment=require(_0x6c49('0x5'));var BPromise=require(_0x6c49('0x6'));var Mustache=require('mustache');var util=require(_0x6c49('0x7'));var path=require(_0x6c49('0x8'));var sox=require(_0x6c49('0x9'));var csv=require(_0x6c49('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c49('0xb'));var _=require('lodash');var squel=require(_0x6c49('0xc'));var crypto=require(_0x6c49('0xd'));var jsforce=require(_0x6c49('0xe'));var deskjs=require(_0x6c49('0xf'));var toCsv=require(_0x6c49('0xa'));var querystring=require(_0x6c49('0x10'));var Papa=require('papaparse');var Redis=require(_0x6c49('0x11'));var authService=require(_0x6c49('0x12'));var qs=require(_0x6c49('0x13'));var as=require(_0x6c49('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c49('0x15'))('api');var utils=require(_0x6c49('0x16'));var config=require(_0x6c49('0x17'));var licenseUtil=require(_0x6c49('0x18'));var db=require(_0x6c49('0x19'))['db'];config[_0x6c49('0x1a')]=_[_0x6c49('0x1b')](config[_0x6c49('0x1a')],{'host':_0x6c49('0x1c'),'port':0x18eb});var socket=require(_0x6c49('0x1d'))(new Redis(config[_0x6c49('0x1a')]));require('./smsQueue.socket')[_0x6c49('0x1e')](socket);function respondWithStatusCode(_0x52fc4d,_0x281adf){_0x281adf=_0x281adf||0xcc;return function(_0x4b2dc9){if(_0x4b2dc9){return _0x52fc4d[_0x6c49('0x1f')](_0x281adf);}return _0x52fc4d[_0x6c49('0x20')](_0x281adf)[_0x6c49('0x21')]();};}function respondWithResult(_0x8d3bd7,_0xce5c04){_0xce5c04=_0xce5c04||0xc8;return function(_0x567519){if(_0x567519){return _0x8d3bd7[_0x6c49('0x20')](_0xce5c04)[_0x6c49('0x22')](_0x567519);}};}function respondWithFilteredResult(_0x16b565,_0x1a048e){return function(_0x276ed8){if(_0x276ed8){var _0x5651c1=typeof _0x1a048e['offset']==='undefined'&&typeof _0x1a048e['limit']===_0x6c49('0x23');var _0x588a25=_0x276ed8[_0x6c49('0x24')];var _0x9c288c=_0x5651c1?0x0:_0x1a048e[_0x6c49('0x25')];var _0x1f7405=_0x5651c1?_0x276ed8[_0x6c49('0x24')]:_0x1a048e[_0x6c49('0x25')]+_0x1a048e[_0x6c49('0x26')];var _0x48e343;if(_0x1f7405>=_0x588a25){_0x1f7405=_0x588a25;_0x48e343=0xc8;}else{_0x48e343=0xce;}_0x16b565[_0x6c49('0x20')](_0x48e343);return _0x16b565[_0x6c49('0x27')](_0x6c49('0x28'),_0x9c288c+'-'+_0x1f7405+'/'+_0x588a25)[_0x6c49('0x22')](_0x276ed8);}return null;};}function patchUpdates(_0x3a70ed){return function(_0x19d8d0){try{jsonpatch[_0x6c49('0x29')](_0x19d8d0,_0x3a70ed,!![]);}catch(_0x24caec){return BPromise['reject'](_0x24caec);}return _0x19d8d0[_0x6c49('0x2a')]();};}function saveUpdates(_0x4e7c4a,_0x3d1d06){return function(_0x57c679){if(_0x57c679){return _0x57c679[_0x6c49('0x2b')](_0x4e7c4a)[_0x6c49('0x2c')](function(_0x2831bd){return _0x2831bd;});}return null;};}function removeEntity(_0x15b700,_0x3a4ed1){return function(_0xe39411){if(_0xe39411){return _0xe39411['destroy']()[_0x6c49('0x2c')](function(){var _0x79654a=_0xe39411[_0x6c49('0x2d')]({'plain':!![]});var _0x355af8=_0x6c49('0x2e');return db[_0x6c49('0x2f')][_0x6c49('0x30')]({'where':{'type':_0x355af8,'resourceId':_0x79654a['id']}})[_0x6c49('0x2c')](function(){return _0xe39411;});})[_0x6c49('0x2c')](function(){_0x15b700[_0x6c49('0x20')](0xcc)[_0x6c49('0x21')]();});}};}function handleEntityNotFound(_0x3524b0,_0x50fabb){return function(_0x3ad056){if(!_0x3ad056){_0x3524b0['sendStatus'](0x194);}return _0x3ad056;};}function handleError(_0x47b21a,_0x2c4cee){_0x2c4cee=_0x2c4cee||0x1f4;return function(_0x41dfc3){logger[_0x6c49('0x31')](_0x41dfc3['stack']);if(_0x41dfc3[_0x6c49('0x32')]){delete _0x41dfc3[_0x6c49('0x32')];}_0x47b21a['status'](_0x2c4cee)[_0x6c49('0x33')](_0x41dfc3);};}exports[_0x6c49('0x34')]=function(_0x55cbad,_0x1b3d22){var _0x3387ad={},_0x5a18bd={},_0x3da911={'count':0x0,'rows':[]};var _0x3e0ca4=_[_0x6c49('0x35')](db[_0x6c49('0x36')][_0x6c49('0x37')],function(_0x19e349){return{'name':_0x19e349[_0x6c49('0x38')],'type':_0x19e349[_0x6c49('0x39')][_0x6c49('0x3a')]};});_0x5a18bd['model']=_[_0x6c49('0x35')](_0x3e0ca4,_0x6c49('0x32'));_0x5a18bd['query']=_[_0x6c49('0x3b')](_0x55cbad[_0x6c49('0x3c')]);_0x5a18bd[_0x6c49('0x3d')]=_['intersection'](_0x5a18bd[_0x6c49('0x3e')],_0x5a18bd[_0x6c49('0x3c')]);_0x3387ad[_0x6c49('0x3f')]=_[_0x6c49('0x40')](_0x5a18bd['model'],qs['fields'](_0x55cbad['query'][_0x6c49('0x41')]));_0x3387ad['attributes']=_0x3387ad[_0x6c49('0x3f')]['length']?_0x3387ad['attributes']:_0x5a18bd[_0x6c49('0x3e')];if(!_0x55cbad['query']['hasOwnProperty']('nolimit')){_0x3387ad[_0x6c49('0x26')]=qs[_0x6c49('0x26')](_0x55cbad[_0x6c49('0x3c')][_0x6c49('0x26')]);_0x3387ad[_0x6c49('0x25')]=qs['offset'](_0x55cbad[_0x6c49('0x3c')][_0x6c49('0x25')]);}_0x3387ad[_0x6c49('0x42')]=qs[_0x6c49('0x43')](_0x55cbad[_0x6c49('0x3c')][_0x6c49('0x43')]);_0x3387ad[_0x6c49('0x44')]=qs[_0x6c49('0x3d')](_[_0x6c49('0x45')](_0x55cbad[_0x6c49('0x3c')],_0x5a18bd[_0x6c49('0x3d')]),_0x3e0ca4);if(_0x55cbad['query']['filter']){_0x3387ad[_0x6c49('0x44')]=_['merge'](_0x3387ad[_0x6c49('0x44')],{'$or':_[_0x6c49('0x35')](_0x3e0ca4,function(_0x8c45d7){if(_0x8c45d7['type']!==_0x6c49('0x46')){var _0x17c8f2={};_0x17c8f2[_0x8c45d7[_0x6c49('0x32')]]={'$like':'%'+_0x55cbad[_0x6c49('0x3c')][_0x6c49('0x47')]+'%'};return _0x17c8f2;}})});}_0x3387ad=_['merge']({},_0x3387ad,_0x55cbad[_0x6c49('0x48')]);var _0xfc80d={'where':_0x3387ad[_0x6c49('0x44')]};return db['SmsQueue'][_0x6c49('0x24')](_0xfc80d)[_0x6c49('0x2c')](function(_0xeb8186){_0x3da911[_0x6c49('0x24')]=_0xeb8186;if(_0x55cbad['query']['includeAll']){_0x3387ad[_0x6c49('0x49')]=[{'all':!![]}];}return db[_0x6c49('0x36')][_0x6c49('0x4a')](_0x3387ad);})[_0x6c49('0x2c')](function(_0x32cd1a){_0x3da911[_0x6c49('0x4b')]=_0x32cd1a;return _0x3da911;})['then'](respondWithFilteredResult(_0x1b3d22,_0x3387ad))[_0x6c49('0x4c')](handleError(_0x1b3d22,null));};exports['show']=function(_0xd53463,_0x51ebfe){var _0x417e63={'raw':!![],'where':{'id':_0xd53463[_0x6c49('0x4d')]['id']}},_0x55836c={};_0x55836c['model']=_[_0x6c49('0x3b')](db['SmsQueue']['rawAttributes']);_0x55836c[_0x6c49('0x3c')]=_['keys'](_0xd53463[_0x6c49('0x3c')]);_0x55836c[_0x6c49('0x3d')]=_['intersection'](_0x55836c[_0x6c49('0x3e')],_0x55836c[_0x6c49('0x3c')]);_0x417e63['attributes']=_[_0x6c49('0x40')](_0x55836c[_0x6c49('0x3e')],qs[_0x6c49('0x41')](_0xd53463['query'][_0x6c49('0x41')]));_0x417e63['attributes']=_0x417e63[_0x6c49('0x3f')][_0x6c49('0x4e')]?_0x417e63['attributes']:_0x55836c[_0x6c49('0x3e')];if(_0xd53463[_0x6c49('0x3c')][_0x6c49('0x4f')]){_0x417e63['include']=[{'all':!![]}];}_0x417e63=_[_0x6c49('0x50')]({},_0x417e63,_0xd53463[_0x6c49('0x48')]);return db[_0x6c49('0x36')]['find'](_0x417e63)[_0x6c49('0x2c')](handleEntityNotFound(_0x51ebfe,null))[_0x6c49('0x2c')](respondWithResult(_0x51ebfe,null))[_0x6c49('0x4c')](handleError(_0x51ebfe,null));};exports[_0x6c49('0x51')]=function(_0x239f3f,_0x1d1507){return db['SmsQueue'][_0x6c49('0x51')](_0x239f3f[_0x6c49('0x52')],{})['then'](function(_0x4e4ef6){var _0x4c3b17=_0x239f3f[_0x6c49('0x53')][_0x6c49('0x2d')]({'plain':!![]});if(!_0x4c3b17)throw new Error(_0x6c49('0x54'));if(_0x4c3b17[_0x6c49('0x55')]===_0x6c49('0x53')){var _0x298f12=_0x4e4ef6[_0x6c49('0x2d')]({'plain':!![]});var _0x237855='SmsQueues';return db[_0x6c49('0x56')]['find']({'where':{'name':_0x237855,'userProfileId':_0x4c3b17[_0x6c49('0x57')]},'raw':!![]})[_0x6c49('0x2c')](function(_0x33619a){if(_0x33619a&&_0x33619a[_0x6c49('0x58')]===0x0){return db[_0x6c49('0x2f')]['create']({'name':_0x298f12[_0x6c49('0x32')],'resourceId':_0x298f12['id'],'type':_0x33619a[_0x6c49('0x32')],'sectionId':_0x33619a['id']},{})[_0x6c49('0x2c')](function(){return _0x4e4ef6;});}else{return _0x4e4ef6;}})[_0x6c49('0x4c')](function(_0x384332){logger[_0x6c49('0x31')](_0x6c49('0x59'),_0x384332);throw _0x384332;});}return _0x4e4ef6;})[_0x6c49('0x2c')](respondWithResult(_0x1d1507,0xc9))['catch'](handleError(_0x1d1507,null));};exports[_0x6c49('0x2b')]=function(_0x153afd,_0x412c81){if(_0x153afd[_0x6c49('0x52')]['id']){delete _0x153afd['body']['id'];}return db['SmsQueue'][_0x6c49('0x5a')]({'where':{'id':_0x153afd[_0x6c49('0x4d')]['id']}})['then'](handleEntityNotFound(_0x412c81,null))[_0x6c49('0x2c')](saveUpdates(_0x153afd['body'],null))[_0x6c49('0x2c')](respondWithResult(_0x412c81,null))['catch'](handleError(_0x412c81,null));};exports[_0x6c49('0x30')]=function(_0x5d7f82,_0xad6f7){return db['SmsQueue'][_0x6c49('0x5a')]({'where':{'id':_0x5d7f82[_0x6c49('0x4d')]['id']}})[_0x6c49('0x2c')](handleEntityNotFound(_0xad6f7,null))[_0x6c49('0x2c')](removeEntity(_0xad6f7,null))[_0x6c49('0x4c')](handleError(_0xad6f7,null));};exports['describe']=function(_0x461e54,_0x315cee){return db['SmsQueue'][_0x6c49('0x5b')]()[_0x6c49('0x2c')](respondWithResult(_0x315cee,null))['catch'](handleError(_0x315cee,null));};exports[_0x6c49('0x5c')]=function(_0x5380de,_0x812c4c,_0x17ba65){var _0x4f23bf={'raw':!![],'where':{}},_0x5c913f={},_0x25d6d7;return db[_0x6c49('0x36')]['findOne']({'where':{'id':_0x5380de[_0x6c49('0x4d')]['id']}})[_0x6c49('0x2c')](handleEntityNotFound(_0x812c4c,null))['then'](function(_0x33bef7){if(_0x33bef7){_0x25d6d7=_0x33bef7[_0x6c49('0x2d')]({'plain':!![]});_0x5c913f[_0x6c49('0x3e')]=_[_0x6c49('0x3b')](db[_0x6c49('0x5d')]['rawAttributes']);_0x5c913f['query']=_[_0x6c49('0x3b')](_0x5380de[_0x6c49('0x3c')]);_0x5c913f[_0x6c49('0x3d')]=_[_0x6c49('0x40')](_0x5c913f['model'],_0x5c913f[_0x6c49('0x3c')]);_0x4f23bf[_0x6c49('0x3f')]=_[_0x6c49('0x40')](_0x5c913f[_0x6c49('0x3e')],qs[_0x6c49('0x41')](_0x5380de['query'][_0x6c49('0x41')]));_0x4f23bf['attributes']=_0x4f23bf[_0x6c49('0x3f')][_0x6c49('0x4e')]?_0x4f23bf['attributes']:_0x5c913f[_0x6c49('0x3e')];if(!_0x5380de['query'][_0x6c49('0x5e')](_0x6c49('0x5f'))){_0x4f23bf[_0x6c49('0x26')]=qs[_0x6c49('0x26')](_0x5380de[_0x6c49('0x3c')][_0x6c49('0x26')]);_0x4f23bf['offset']=qs['offset'](_0x5380de[_0x6c49('0x3c')]['offset']);}_0x4f23bf[_0x6c49('0x42')]=qs[_0x6c49('0x43')](_0x5380de[_0x6c49('0x3c')][_0x6c49('0x43')]);_0x4f23bf['where']=qs[_0x6c49('0x3d')](_[_0x6c49('0x45')](_0x5380de[_0x6c49('0x3c')],_0x5c913f[_0x6c49('0x3d')]));_0x4f23bf['where'][_0x6c49('0x60')]=_0x33bef7['id'];if(_0x5380de['query']['filter']){_0x4f23bf['where']=_[_0x6c49('0x50')](_0x4f23bf[_0x6c49('0x44')],{'$or':_[_0x6c49('0x35')](_0x4f23bf[_0x6c49('0x3f')],function(_0x4ab594){var _0x2ec9ad={};_0x2ec9ad[_0x4ab594]={'$like':'%'+_0x5380de[_0x6c49('0x3c')][_0x6c49('0x47')]+'%'};return _0x2ec9ad;})});}_0x4f23bf=_['merge']({},_0x4f23bf,_0x5380de[_0x6c49('0x48')]);return db[_0x6c49('0x5d')][_0x6c49('0x4a')](_0x4f23bf);}})['then'](function(_0x2b9728){if(_0x2b9728){return db['User'][_0x6c49('0x61')]({'where':{'id':_[_0x6c49('0x35')](_0x2b9728,_0x6c49('0x62')),'role':_0x6c49('0x63')},'attributes':['id','name',_0x6c49('0x64'),_0x6c49('0x65'),_0x6c49('0x66')]});}})[_0x6c49('0x2c')](function(_0x46e12d){if(_0x46e12d){return{'count':_0x46e12d[_0x6c49('0x24')],'rows':_['map'](_0x46e12d[_0x6c49('0x4b')],function(_0x38bcea){return{'membername':_0x38bcea[_0x6c49('0x32')],'UserId':_0x38bcea['id'],'queue_name':_0x25d6d7['name'],'SmsQueueId':_0x25d6d7['id'],'interface':util['format'](_0x6c49('0x67'),_0x6c49('0x68'),_0x38bcea[_0x6c49('0x32')]),'penalty':0x0,'paused':_0x38bcea[_0x6c49('0x64')],'createdAt':_0x38bcea[_0x6c49('0x66')],'updatedAt':_0x38bcea['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6c49('0x2c')](respondWithFilteredResult(_0x812c4c,_0x4f23bf))[_0x6c49('0x4c')](handleError(_0x812c4c,null));};exports[_0x6c49('0x69')]=function(_0x30310d,_0x51d1d5,_0x5987f6){var _0x593155={};var _0x476f0c={};var _0xc1ffc6;var _0x97fe9d;return db[_0x6c49('0x36')]['findOne']({'where':{'id':_0x30310d['params']['id']}})['then'](handleEntityNotFound(_0x51d1d5,null))['then'](function(_0x32a23b){if(_0x32a23b){_0xc1ffc6=_0x32a23b;_0x476f0c[_0x6c49('0x3e')]=_[_0x6c49('0x3b')](db['Team'][_0x6c49('0x37')]);_0x476f0c[_0x6c49('0x3c')]=_[_0x6c49('0x3b')](_0x30310d[_0x6c49('0x3c')]);_0x476f0c['filters']=_[_0x6c49('0x40')](_0x476f0c[_0x6c49('0x3e')],_0x476f0c[_0x6c49('0x3c')]);_0x593155[_0x6c49('0x3f')]=_['intersection'](_0x476f0c[_0x6c49('0x3e')],qs[_0x6c49('0x41')](_0x30310d[_0x6c49('0x3c')][_0x6c49('0x41')]));_0x593155[_0x6c49('0x3f')]=_0x593155[_0x6c49('0x3f')]['length']?_0x593155[_0x6c49('0x3f')]:_0x476f0c[_0x6c49('0x3e')];_0x593155['order']=qs[_0x6c49('0x43')](_0x30310d[_0x6c49('0x3c')][_0x6c49('0x43')]);_0x593155[_0x6c49('0x44')]=qs[_0x6c49('0x3d')](_[_0x6c49('0x45')](_0x30310d[_0x6c49('0x3c')],_0x476f0c[_0x6c49('0x3d')]));if(_0x30310d[_0x6c49('0x3c')][_0x6c49('0x47')]){_0x593155[_0x6c49('0x44')]=_[_0x6c49('0x50')](_0x593155[_0x6c49('0x44')],{'$or':_[_0x6c49('0x35')](_0x593155[_0x6c49('0x3f')],function(_0x26dcb5){var _0x5b4817={};_0x5b4817[_0x26dcb5]={'$like':'%'+_0x30310d[_0x6c49('0x3c')]['filter']+'%'};return _0x5b4817;})});}_0x593155=_['merge']({},_0x593155,_0x30310d[_0x6c49('0x48')]);return _0xc1ffc6['getTeams'](_0x593155);}})[_0x6c49('0x2c')](function(_0x7791d0){if(_0x7791d0){_0x97fe9d=_0x7791d0['length'];if(!_0x30310d['query']['hasOwnProperty'](_0x6c49('0x5f'))){_0x593155[_0x6c49('0x26')]=qs['limit'](_0x30310d[_0x6c49('0x3c')][_0x6c49('0x26')]);_0x593155[_0x6c49('0x25')]=qs['offset'](_0x30310d[_0x6c49('0x3c')]['offset']);}return _0xc1ffc6[_0x6c49('0x69')](_0x593155);}})[_0x6c49('0x2c')](function(_0x1071a4){if(_0x1071a4){return _0x1071a4?{'count':_0x97fe9d,'rows':_0x1071a4}:null;}})[_0x6c49('0x2c')](respondWithResult(_0x51d1d5,null))[_0x6c49('0x4c')](handleError(_0x51d1d5,null));};exports[_0x6c49('0x6a')]=function(_0x43fff2,_0x1e63ce,_0x26a7fa){var _0x8bae0f=_0x43fff2['body'][_0x6c49('0x6b')];return db[_0x6c49('0x6c')][_0x6c49('0x4a')]({'where':{'id':_0x8bae0f},'attributes':['id'],'include':[{'model':db[_0x6c49('0x6d')],'as':'Agents','attributes':['id',_0x6c49('0x32'),_0x6c49('0x6e'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x3b2fdd){if(_0x3b2fdd){var _0x2e692e=_[_0x6c49('0x6f')](_0x3b2fdd,function(_0x22837e){var _0x2d1ea7=_0x22837e[_0x6c49('0x2d')]({'plain':!![]});return _0x2d1ea7[_0x6c49('0x70')];});return db[_0x6c49('0x36')][_0x6c49('0x5a')]({'where':{'id':_0x43fff2[_0x6c49('0x4d')]['id']}})[_0x6c49('0x2c')](function(_0xf4b46){return db['sequelize']['transaction'](function(_0x3710e3){return _0xf4b46[_0x6c49('0x6a')](_0x8bae0f,{'transaction':_0x3710e3})[_0x6c49('0x2c')](function(){return BPromise[_0x6c49('0x71')](_0x2e692e,function(_0x79197d){return db['UserSmsQueue'][_0x6c49('0x72')]({'where':{'UserId':_0x79197d['id'],'SmsQueueId':_0x43fff2[_0x6c49('0x4d')]['id']},'transaction':_0x3710e3});});})['then'](function(){_0x2e692e[_0x6c49('0x73')](function(_0x148418){socket[_0x6c49('0x74')](_0x6c49('0x75'),{'UserId':_0x148418['id'],'SmsQueueId':_0xf4b46['id']});});});});});}})[_0x6c49('0x2c')](respondWithStatusCode(_0x1e63ce,null))[_0x6c49('0x4c')](handleError(_0x1e63ce,null));};exports['removeTeams']=function(_0x4a8bca,_0x3bf263,_0x1c266f){return db[_0x6c49('0x6c')][_0x6c49('0x4a')]({'where':{'id':_0x4a8bca['query'][_0x6c49('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x6c49('0x6d')],'as':_0x6c49('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3bf263,null))['then'](function(_0x269c55){var _0x675ff9=_['map'](_0x269c55,'id');var _0x15ca30=[];var _0xe8130=[];var _0x3bca55=squel[_0x6c49('0x76')]();_0x3bca55[_0x6c49('0x77')](_0x6c49('0x78'))[_0x6c49('0x79')]('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x4a8bca[_0x6c49('0x4d')]['id']);for(var _0xe80f90=0x0;_0xe80f90<_0x269c55[_0x6c49('0x4e')];_0xe80f90+=0x1){let _0x59aa95=_0x269c55[_0xe80f90];for(var _0x5f2e75=0x0;_0x5f2e75<_0x59aa95[_0x6c49('0x70')][_0x6c49('0x4e')];_0x5f2e75+=0x1){let _0x19b606=_0x59aa95[_0x6c49('0x70')][_0x5f2e75];var _0x14b5fe=_0x3bca55[_0x6c49('0x7a')]();_0x14b5fe[_0x6c49('0x44')](_0x6c49('0x7b'),_0x19b606['id']);_0xe8130['push'](db[_0x6c49('0x7c')][_0x6c49('0x3c')](_0x14b5fe['toString'](),{'type':db['sequelize'][_0x6c49('0x7d')][_0x6c49('0x7e')]})[_0x6c49('0x2c')](function(_0x408b87){if(_0x408b87[_0x6c49('0x4e')]===0x1){return _0x19b606['id'];}else{var _0x469a11=_['every'](_['map'](_0x408b87,_0x6c49('0x7f')),function(_0x2bc42f){return _['includes'](_0x675ff9,_0x2bc42f);});if(_0x469a11){return _0x19b606['id'];}}}));}}return BPromise[_0x6c49('0x80')](_0xe8130)['then'](function(_0x3b3550){_0x15ca30=_(_0x15ca30)[_0x6c49('0x81')](_0x3b3550)[_0x6c49('0x82')]()[_0x6c49('0x83')]();return db[_0x6c49('0x36')]['find']({'where':{'id':_0x4a8bca[_0x6c49('0x4d')]['id']}})['then'](function(_0x534afb){return db[_0x6c49('0x7c')][_0x6c49('0x84')](function(_0x10958a){return _0x534afb[_0x6c49('0x85')](_0x4a8bca[_0x6c49('0x3c')]['ids'],{'transaction':_0x10958a})[_0x6c49('0x2c')](function(){if(!_[_0x6c49('0x86')](_0x15ca30)){return _0x534afb['removeAgents'](_0x15ca30,{'transaction':_0x10958a});}})['then'](function(){_0x15ca30[_0x6c49('0x73')](function(_0x58973f){socket[_0x6c49('0x74')]('userSmsQueue:remove',{'UserId':_0x58973f,'SmsQueueId':_0x534afb['id']});});});});});});})[_0x6c49('0x2c')](respondWithStatusCode(_0x3bf263,null))[_0x6c49('0x4c')](handleError(_0x3bf263,null));};exports['addAgents']=function(_0xae06d8,_0xc74709,_0x3916db){return db[_0x6c49('0x36')][_0x6c49('0x5a')]({'where':{'id':_0xae06d8[_0x6c49('0x4d')]['id']}})['then'](handleEntityNotFound(_0xc74709,null))[_0x6c49('0x2c')](function(_0x48e147){if(_0x48e147){return _0x48e147[_0x6c49('0x87')](_0xae06d8[_0x6c49('0x52')][_0x6c49('0x6b')],_[_0x6c49('0x88')](_0xae06d8[_0x6c49('0x52')],[_0x6c49('0x6b'),'id'])||{})[_0x6c49('0x89')](function(_0x56f1ec){for(var _0x2ba9a7=0x0;_0x2ba9a7<_0xae06d8[_0x6c49('0x52')][_0x6c49('0x6b')]['length'];_0x2ba9a7+=0x1){socket[_0x6c49('0x74')](_0x6c49('0x75'),{'UserId':Number(_0xae06d8[_0x6c49('0x52')][_0x6c49('0x6b')][_0x2ba9a7]),'SmsQueueId':Number(_0xae06d8[_0x6c49('0x4d')]['id'])});}return _0x56f1ec;});}})[_0x6c49('0x2c')](respondWithResult(_0xc74709,null))[_0x6c49('0x4c')](handleError(_0xc74709,null));};exports[_0x6c49('0x8a')]=function(_0x13dc8b,_0x4d9338,_0x572f5){return db['SmsQueue'][_0x6c49('0x5a')]({'where':{'id':_0x13dc8b['params']['id']}})['then'](handleEntityNotFound(_0x4d9338,null))['then'](function(_0xb6d6fa){if(_0xb6d6fa){return _0xb6d6fa['removeAgents'](_0x13dc8b['query'][_0x6c49('0x6b')])[_0x6c49('0x2c')](function(){if(_['isArray'](_0x13dc8b[_0x6c49('0x3c')][_0x6c49('0x6b')])){for(var _0x5e2c72=0x0;_0x5e2c72<_0x13dc8b[_0x6c49('0x3c')][_0x6c49('0x6b')][_0x6c49('0x4e')];_0x5e2c72+=0x1){socket[_0x6c49('0x74')](_0x6c49('0x8b'),{'UserId':Number(_0x13dc8b[_0x6c49('0x3c')][_0x6c49('0x6b')][_0x5e2c72]),'SmsQueueId':Number(_0x13dc8b[_0x6c49('0x4d')]['id'])});}}else{socket[_0x6c49('0x74')]('userSmsQueue:remove',{'UserId':Number(_0x13dc8b[_0x6c49('0x3c')][_0x6c49('0x6b')]),'SmsQueueId':Number(_0x13dc8b[_0x6c49('0x4d')]['id'])});}});}})[_0x6c49('0x2c')](respondWithStatusCode(_0x4d9338,null))['catch'](handleError(_0x4d9338,null));};exports[_0x6c49('0x8c')]=function(_0x3dc4f8,_0x2a51d3,_0x46c7cd){var _0x5e0788={};var _0x2c24cc={};var _0x468f7e;var _0x1de256;return db[_0x6c49('0x36')]['findOne']({'where':{'id':_0x3dc4f8[_0x6c49('0x4d')]['id']}})[_0x6c49('0x2c')](handleEntityNotFound(_0x2a51d3,null))[_0x6c49('0x2c')](function(_0x5f475e){if(_0x5f475e){_0x468f7e=_0x5f475e;_0x2c24cc[_0x6c49('0x3e')]=_[_0x6c49('0x3b')](db[_0x6c49('0x6d')][_0x6c49('0x37')]);_0x2c24cc[_0x6c49('0x3c')]=_[_0x6c49('0x3b')](_0x3dc4f8[_0x6c49('0x3c')]);_0x2c24cc[_0x6c49('0x3d')]=_[_0x6c49('0x40')](_0x2c24cc[_0x6c49('0x3e')],_0x2c24cc[_0x6c49('0x3c')]);_0x5e0788[_0x6c49('0x3f')]=_[_0x6c49('0x40')](_0x2c24cc[_0x6c49('0x3e')],qs[_0x6c49('0x41')](_0x3dc4f8[_0x6c49('0x3c')]['fields']));_0x5e0788['attributes']=_0x5e0788[_0x6c49('0x3f')][_0x6c49('0x4e')]?_0x5e0788['attributes']:_0x2c24cc[_0x6c49('0x3e')];_0x5e0788[_0x6c49('0x42')]=qs[_0x6c49('0x43')](_0x3dc4f8[_0x6c49('0x3c')][_0x6c49('0x43')]);_0x5e0788[_0x6c49('0x44')]=qs[_0x6c49('0x3d')](_[_0x6c49('0x45')](_0x3dc4f8[_0x6c49('0x3c')],_0x2c24cc['filters']));if(_0x3dc4f8[_0x6c49('0x3c')]['filter']){_0x5e0788[_0x6c49('0x44')]=_[_0x6c49('0x50')](_0x5e0788[_0x6c49('0x44')],{'$or':_[_0x6c49('0x35')](_0x5e0788[_0x6c49('0x3f')],function(_0x10155d){var _0x473f73={};_0x473f73[_0x10155d]={'$like':'%'+_0x3dc4f8['query'][_0x6c49('0x47')]+'%'};return _0x473f73;})});}_0x5e0788=_[_0x6c49('0x50')]({},_0x5e0788,_0x3dc4f8[_0x6c49('0x48')]);return _0x468f7e[_0x6c49('0x8c')](_0x5e0788);}})[_0x6c49('0x2c')](function(_0x40f502){if(_0x40f502){_0x1de256=_0x40f502[_0x6c49('0x4e')];if(!_0x3dc4f8[_0x6c49('0x3c')]['hasOwnProperty'](_0x6c49('0x5f'))){_0x5e0788[_0x6c49('0x26')]=qs[_0x6c49('0x26')](_0x3dc4f8[_0x6c49('0x3c')]['limit']);_0x5e0788[_0x6c49('0x25')]=qs['offset'](_0x3dc4f8[_0x6c49('0x3c')][_0x6c49('0x25')]);}return _0x468f7e[_0x6c49('0x8c')](_0x5e0788);}})[_0x6c49('0x2c')](function(_0x70ad3f){if(_0x70ad3f){return _0x70ad3f?{'count':_0x1de256,'rows':_0x70ad3f}:null;}})[_0x6c49('0x2c')](respondWithResult(_0x2a51d3,null))['catch'](handleError(_0x2a51d3,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index e75c5e4..c27b1f8 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 _0x5e75=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0xb31f13,_0x5beeb0){var _0x1b601c=function(_0x5f4041){while(--_0x5f4041){_0xb31f13['push'](_0xb31f13['shift']());}};_0x1b601c(++_0x5beeb0);}(_0x5e75,0xcb));var _0x55e7=function(_0x4d56e1,_0x32816e){_0x4d56e1=_0x4d56e1-0x0;var _0x281c2b=_0x5e75[_0x4d56e1];return _0x281c2b;};'use strict';var EventEmitter=require(_0x55e7('0x0'));var SmsQueue=require(_0x55e7('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x55e7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x55e7('0x3')};function emitEvent(_0x15709a){return function(_0x2a94c7,_0x3d0fb0,_0x85a16){SmsQueueEvents['emit'](_0x15709a+':'+_0x2a94c7['id'],_0x2a94c7);SmsQueueEvents[_0x55e7('0x4')](_0x15709a,_0x2a94c7);_0x85a16(null);};}for(var e in events){if(events[_0x55e7('0x5')](e)){var event=events[e];SmsQueue[_0x55e7('0x6')](e,emitEvent(event));}}module[_0x55e7('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xfbb1=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','save','update','emit'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0xfbb1,0x17d));var _0x1fbb=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xfbb1[_0x54ccd7];return _0x4e667b;};'use strict';var EventEmitter=require(_0x1fbb('0x0'));var SmsQueue=require(_0x1fbb('0x1'))['db'][_0x1fbb('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1fbb('0x3'),'afterUpdate':_0x1fbb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x364835){return function(_0x59de70,_0xe443ec,_0x1bdfee){SmsQueueEvents[_0x1fbb('0x5')](_0x364835+':'+_0x59de70['id'],_0x59de70);SmsQueueEvents['emit'](_0x364835,_0x59de70);_0x1bdfee(null);};}for(var e in events){if(events[_0x1fbb('0x6')](e)){var event=events[e];SmsQueue[_0x1fbb('0x7')](e,emitEvent(event));}}module[_0x1fbb('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 1da9388..6831940 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 _0x8bb3=['util','../../config/logger','api','moment','bluebird','path','rimraf','./smsQueue.attributes','exports','define','lodash'];(function(_0x412405,_0x77dd05){var _0x889e80=function(_0x328a35){while(--_0x328a35){_0x412405['push'](_0x412405['shift']());}};_0x889e80(++_0x77dd05);}(_0x8bb3,0xf1));var _0x38bb=function(_0x2c9520,_0x3200db){_0x2c9520=_0x2c9520-0x0;var _0x19c800=_0x8bb3[_0x2c9520];return _0x19c800;};'use strict';var _=require(_0x38bb('0x0'));var util=require(_0x38bb('0x1'));var logger=require(_0x38bb('0x2'))(_0x38bb('0x3'));var moment=require(_0x38bb('0x4'));var BPromise=require(_0x38bb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38bb('0x6'));var rimraf=require(_0x38bb('0x7'));var config=require('../../config/environment');var attributes=require(_0x38bb('0x8'));module[_0x38bb('0x9')]=function(_0x5d6955,_0x49a4ea){return _0x5d6955[_0x38bb('0xa')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x426d=['../../config/logger','api','moment','bluebird','request-promise','path','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0x45f399,_0x2886a7){var _0xaa903d=function(_0x1f463b){while(--_0x1f463b){_0x45f399['push'](_0x45f399['shift']());}};_0xaa903d(++_0x2886a7);}(_0x426d,0x136));var _0xd426=function(_0x35db48,_0x1d15ab){_0x35db48=_0x35db48-0x0;var _0x37a11d=_0x426d[_0x35db48];return _0x37a11d;};'use strict';var _=require(_0xd426('0x0'));var util=require(_0xd426('0x1'));var logger=require(_0xd426('0x2'))(_0xd426('0x3'));var moment=require(_0xd426('0x4'));var BPromise=require(_0xd426('0x5'));var rp=require(_0xd426('0x6'));var fs=require('fs');var path=require(_0xd426('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd426('0x8'));module[_0xd426('0x9')]=function(_0x1401cf,_0x138004){return _0x1401cf[_0xd426('0xa')](_0xd426('0xb'),attributes,{'tableName':_0xd426('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 e0b1a19..99e83f4 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 _0x7066=['ShowSmsQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','attributes','limit','map','include','model','stringify','find','where'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x7066,0xa1));var _0x6706=function(_0x374a29,_0x1a972f){_0x374a29=_0x374a29-0x0;var _0x59c59a=_0x7066[_0x374a29];return _0x59c59a;};'use strict';var _=require(_0x6706('0x0'));var util=require(_0x6706('0x1'));var moment=require(_0x6706('0x2'));var BPromise=require(_0x6706('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6706('0x4'))['db'];var utils=require(_0x6706('0x5'));var logger=require(_0x6706('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6706('0x7'));var client=jayson[_0x6706('0x8')][_0x6706('0x9')]({'port':0x232a});config[_0x6706('0xa')]=_[_0x6706('0xb')](config[_0x6706('0xa')],{'host':_0x6706('0xc'),'port':0x18eb});var socket=require(_0x6706('0xd'))(new Redis(config[_0x6706('0xa')]));require('./smsQueue.socket')[_0x6706('0xe')](socket);function respondWithRpcPromise(_0x321409,_0x67646b,_0x39f0ac){return new BPromise(function(_0x2a1e95,_0x350b44){return client[_0x6706('0xf')](_0x321409,_0x39f0ac)[_0x6706('0x10')](function(_0x46dbc2){logger[_0x6706('0x11')](_0x6706('0x12'),_0x67646b,'request\x20sent');logger[_0x6706('0x13')](_0x6706('0x14'),_0x67646b,_0x6706('0x15'),JSON['stringify'](_0x46dbc2));if(_0x46dbc2[_0x6706('0x16')]){if(_0x46dbc2[_0x6706('0x16')][_0x6706('0x17')]===0x1f4){logger[_0x6706('0x16')]('SmsQueue,\x20%s,\x20%s',_0x67646b,_0x46dbc2[_0x6706('0x16')][_0x6706('0x18')]);return _0x350b44(_0x46dbc2[_0x6706('0x16')][_0x6706('0x18')]);}logger[_0x6706('0x16')](_0x6706('0x12'),_0x67646b,_0x46dbc2['error']['message']);return _0x2a1e95(_0x46dbc2[_0x6706('0x16')][_0x6706('0x18')]);}else{logger[_0x6706('0x11')](_0x6706('0x12'),_0x67646b,_0x6706('0x15'));_0x2a1e95(_0x46dbc2[_0x6706('0x19')][_0x6706('0x18')]);}})[_0x6706('0x1a')](function(_0x3291fe){logger[_0x6706('0x16')](_0x6706('0x12'),_0x67646b,_0x3291fe);_0x350b44(_0x3291fe);});});}exports[_0x6706('0x1b')]=function(_0x40fc14){var _0x4919d3=this;return new Promise(function(_0x1573d6,_0x280978){return db[_0x6706('0x1c')][_0x6706('0x1d')]({'raw':_0x40fc14[_0x6706('0x1e')]?_0x40fc14['options']['raw']===undefined?!![]:![]:!![],'where':_0x40fc14['options']?_0x40fc14['options']['where']||null:null,'attributes':_0x40fc14[_0x6706('0x1e')]?_0x40fc14[_0x6706('0x1e')][_0x6706('0x1f')]||null:null,'limit':_0x40fc14[_0x6706('0x1e')]?_0x40fc14[_0x6706('0x1e')][_0x6706('0x20')]||null:null,'include':_0x40fc14[_0x6706('0x1e')]?_0x40fc14[_0x6706('0x1e')]['include']?_[_0x6706('0x21')](_0x40fc14[_0x6706('0x1e')][_0x6706('0x22')],function(_0x25b453){return{'model':db[_0x25b453[_0x6706('0x23')]],'as':_0x25b453['as'],'attributes':_0x25b453[_0x6706('0x1f')],'include':_0x25b453[_0x6706('0x22')]?_[_0x6706('0x21')](_0x25b453['include'],function(_0x867332){return{'model':db[_0x867332[_0x6706('0x23')]],'as':_0x867332['as'],'attributes':_0x867332[_0x6706('0x1f')],'include':_0x867332[_0x6706('0x22')]?_[_0x6706('0x21')](_0x867332[_0x6706('0x22')],function(_0x303f99){return{'model':db[_0x303f99[_0x6706('0x23')]],'as':_0x303f99['as'],'attributes':_0x303f99[_0x6706('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6706('0x10')](function(_0x50f295){logger[_0x6706('0x11')](_0x6706('0x1b'),_0x40fc14);logger[_0x6706('0x13')](_0x6706('0x1b'),_0x40fc14,JSON[_0x6706('0x24')](_0x50f295));_0x1573d6(_0x50f295);})['catch'](function(_0x169fd1){logger[_0x6706('0x16')](_0x6706('0x1b'),_0x169fd1[_0x6706('0x18')],_0x40fc14);_0x280978(_0x4919d3['error'](0x1f4,_0x169fd1[_0x6706('0x18')]));});});};exports['ShowSmsQueue']=function(_0x4e6918){var _0xa5514=this;return new Promise(function(_0x32f0e6,_0x22e6b9){return db[_0x6706('0x1c')][_0x6706('0x25')]({'raw':_0x4e6918[_0x6706('0x1e')]?_0x4e6918[_0x6706('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4e6918[_0x6706('0x1e')]?_0x4e6918[_0x6706('0x1e')][_0x6706('0x26')]||null:null,'attributes':_0x4e6918[_0x6706('0x1e')]?_0x4e6918[_0x6706('0x1e')][_0x6706('0x1f')]||null:null,'include':_0x4e6918[_0x6706('0x1e')]?_0x4e6918[_0x6706('0x1e')][_0x6706('0x22')]?_[_0x6706('0x21')](_0x4e6918['options'][_0x6706('0x22')],function(_0x4cf5c9){return{'model':db[_0x4cf5c9['model']],'as':_0x4cf5c9['as'],'attributes':_0x4cf5c9['attributes'],'include':_0x4cf5c9[_0x6706('0x22')]?_[_0x6706('0x21')](_0x4cf5c9['include'],function(_0x2c8037){return{'model':db[_0x2c8037['model']],'as':_0x2c8037['as'],'attributes':_0x2c8037[_0x6706('0x1f')],'include':_0x2c8037['include']?_['map'](_0x2c8037[_0x6706('0x22')],function(_0x570728){return{'model':db[_0x570728[_0x6706('0x23')]],'as':_0x570728['as'],'attributes':_0x570728[_0x6706('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6706('0x10')](function(_0x3d9efa){logger[_0x6706('0x11')](_0x6706('0x27'),_0x4e6918);logger[_0x6706('0x13')](_0x6706('0x27'),_0x4e6918,JSON[_0x6706('0x24')](_0x3d9efa));_0x32f0e6(_0x3d9efa);})[_0x6706('0x1a')](function(_0x4caa59){logger[_0x6706('0x16')](_0x6706('0x27'),_0x4caa59[_0x6706('0x18')],_0x4e6918);_0x22e6b9(_0xa5514[_0x6706('0x16')](0x1f4,_0x4caa59[_0x6706('0x18')]));});});}; \ No newline at end of file +var _0xb04a=['client','http','localhost','socket.io-emitter','redis','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','ShowSmsQueue','find','raw','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0xb04a,0x17d));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab04('0x0'));var util=require(_0xab04('0x1'));var moment=require(_0xab04('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xab04('0x4'));var logger=require(_0xab04('0x5'))(_0xab04('0x6'));var config=require(_0xab04('0x7'));var jayson=require(_0xab04('0x8'));var client=jayson[_0xab04('0x9')][_0xab04('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xab04('0xb'),'port':0x18eb});var socket=require(_0xab04('0xc'))(new Redis(config[_0xab04('0xd')]));require('./smsQueue.socket')[_0xab04('0xe')](socket);function respondWithRpcPromise(_0x214de0,_0x1b1e72,_0x1fa05c){return new BPromise(function(_0x48df38,_0xf51316){return client[_0xab04('0xf')](_0x214de0,_0x1fa05c)[_0xab04('0x10')](function(_0x2fd952){logger[_0xab04('0x11')](_0xab04('0x12'),_0x1b1e72,_0xab04('0x13'));logger[_0xab04('0x14')](_0xab04('0x15'),_0x1b1e72,_0xab04('0x13'),JSON[_0xab04('0x16')](_0x2fd952));if(_0x2fd952[_0xab04('0x17')]){if(_0x2fd952[_0xab04('0x17')]['code']===0x1f4){logger[_0xab04('0x17')](_0xab04('0x12'),_0x1b1e72,_0x2fd952[_0xab04('0x17')][_0xab04('0x18')]);return _0xf51316(_0x2fd952['error'][_0xab04('0x18')]);}logger['error'](_0xab04('0x12'),_0x1b1e72,_0x2fd952[_0xab04('0x17')][_0xab04('0x18')]);return _0x48df38(_0x2fd952[_0xab04('0x17')][_0xab04('0x18')]);}else{logger[_0xab04('0x11')](_0xab04('0x12'),_0x1b1e72,_0xab04('0x13'));_0x48df38(_0x2fd952['result']['message']);}})[_0xab04('0x19')](function(_0x185c31){logger[_0xab04('0x17')](_0xab04('0x12'),_0x1b1e72,_0x185c31);_0xf51316(_0x185c31);});});}exports[_0xab04('0x1a')]=function(_0x54514e){var _0x283e29=this;return new Promise(function(_0x5035ff,_0x5ac4a3){return db[_0xab04('0x1b')][_0xab04('0x1c')]({'raw':_0x54514e[_0xab04('0x1d')]?_0x54514e['options']['raw']===undefined?!![]:![]:!![],'where':_0x54514e['options']?_0x54514e['options'][_0xab04('0x1e')]||null:null,'attributes':_0x54514e[_0xab04('0x1d')]?_0x54514e[_0xab04('0x1d')][_0xab04('0x1f')]||null:null,'limit':_0x54514e[_0xab04('0x1d')]?_0x54514e[_0xab04('0x1d')][_0xab04('0x20')]||null:null,'include':_0x54514e[_0xab04('0x1d')]?_0x54514e['options'][_0xab04('0x21')]?_[_0xab04('0x22')](_0x54514e[_0xab04('0x1d')][_0xab04('0x21')],function(_0x3a4c99){return{'model':db[_0x3a4c99[_0xab04('0x23')]],'as':_0x3a4c99['as'],'attributes':_0x3a4c99[_0xab04('0x1f')],'include':_0x3a4c99['include']?_['map'](_0x3a4c99[_0xab04('0x21')],function(_0xf29cf7){return{'model':db[_0xf29cf7[_0xab04('0x23')]],'as':_0xf29cf7['as'],'attributes':_0xf29cf7[_0xab04('0x1f')],'include':_0xf29cf7['include']?_['map'](_0xf29cf7[_0xab04('0x21')],function(_0x4b5809){return{'model':db[_0x4b5809[_0xab04('0x23')]],'as':_0x4b5809['as'],'attributes':_0x4b5809[_0xab04('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xab04('0x10')](function(_0x413b20){logger[_0xab04('0x11')](_0xab04('0x1a'),_0x54514e);logger[_0xab04('0x14')](_0xab04('0x1a'),_0x54514e,JSON['stringify'](_0x413b20));_0x5035ff(_0x413b20);})[_0xab04('0x19')](function(_0x10321a){logger[_0xab04('0x17')](_0xab04('0x1a'),_0x10321a[_0xab04('0x18')],_0x54514e);_0x5ac4a3(_0x283e29['error'](0x1f4,_0x10321a[_0xab04('0x18')]));});});};exports[_0xab04('0x24')]=function(_0x299a5d){var _0x32eee1=this;return new Promise(function(_0x421277,_0x28fea8){return db[_0xab04('0x1b')][_0xab04('0x25')]({'raw':_0x299a5d[_0xab04('0x1d')]?_0x299a5d[_0xab04('0x1d')][_0xab04('0x26')]===undefined?!![]:![]:!![],'where':_0x299a5d[_0xab04('0x1d')]?_0x299a5d[_0xab04('0x1d')][_0xab04('0x1e')]||null:null,'attributes':_0x299a5d[_0xab04('0x1d')]?_0x299a5d['options']['attributes']||null:null,'include':_0x299a5d[_0xab04('0x1d')]?_0x299a5d[_0xab04('0x1d')][_0xab04('0x21')]?_[_0xab04('0x22')](_0x299a5d[_0xab04('0x1d')][_0xab04('0x21')],function(_0x1557c7){return{'model':db[_0x1557c7['model']],'as':_0x1557c7['as'],'attributes':_0x1557c7[_0xab04('0x1f')],'include':_0x1557c7[_0xab04('0x21')]?_[_0xab04('0x22')](_0x1557c7['include'],function(_0x290c1a){return{'model':db[_0x290c1a[_0xab04('0x23')]],'as':_0x290c1a['as'],'attributes':_0x290c1a[_0xab04('0x1f')],'include':_0x290c1a[_0xab04('0x21')]?_[_0xab04('0x22')](_0x290c1a[_0xab04('0x21')],function(_0x1b2e2c){return{'model':db[_0x1b2e2c['model']],'as':_0x1b2e2c['as'],'attributes':_0x1b2e2c[_0xab04('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xab04('0x10')](function(_0x119c75){logger[_0xab04('0x11')](_0xab04('0x24'),_0x299a5d);logger['debug'](_0xab04('0x24'),_0x299a5d,JSON[_0xab04('0x16')](_0x119c75));_0x421277(_0x119c75);})[_0xab04('0x19')](function(_0x2a845d){logger[_0xab04('0x17')](_0xab04('0x24'),_0x2a845d[_0xab04('0x18')],_0x299a5d);_0x28fea8(_0x32eee1[_0xab04('0x17')](0x1f4,_0x2a845d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index d80bf6c..8065da3 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 _0x0689=['update','register','smsQueue:'];(function(_0x1fdee4,_0x3d15e8){var _0x1e4a62=function(_0x2d1cdb){while(--_0x2d1cdb){_0x1fdee4['push'](_0x1fdee4['shift']());}};_0x1e4a62(++_0x3d15e8);}(_0x0689,0x17a));var _0x9068=function(_0x3a8b9b,_0x4b1728){_0x3a8b9b=_0x3a8b9b-0x0;var _0x1a3bba=_0x0689[_0x3a8b9b];return _0x1a3bba;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove',_0x9068('0x0')];function createListener(_0x16bf63,_0x298db2){return function(_0x575eca){_0x298db2['emit'](_0x16bf63,_0x575eca);};}function removeListener(_0x3cb631,_0x1024fd){return function(){SmsQueueEvents['removeListener'](_0x3cb631,_0x1024fd);};}exports[_0x9068('0x1')]=function(_0x2e15e3){for(var _0xe7a44c=0x0,_0xea8fd6=events['length'];_0xe7a44c<_0xea8fd6;_0xe7a44c++){var _0x1f29f7=events[_0xe7a44c];var _0xe17d59=createListener(_0x9068('0x2')+_0x1f29f7,_0x2e15e3);SmsQueueEvents['on'](_0x1f29f7,_0xe17d59);}}; \ No newline at end of file +var _0xcaad=['emit','removeListener','register','length','remove','update'];(function(_0x718b21,_0x165be5){var _0x3bf745=function(_0xa42b52){while(--_0xa42b52){_0x718b21['push'](_0x718b21['shift']());}};_0x3bf745(++_0x165be5);}(_0xcaad,0x16c));var _0xdcaa=function(_0x3aca5a,_0x365012){_0x3aca5a=_0x3aca5a-0x0;var _0x5174c6=_0xcaad[_0x3aca5a];return _0x5174c6;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0xdcaa('0x0'),_0xdcaa('0x1')];function createListener(_0x3900de,_0x518427){return function(_0x13f5b1){_0x518427[_0xdcaa('0x2')](_0x3900de,_0x13f5b1);};}function removeListener(_0x483324,_0x4172e9){return function(){SmsQueueEvents[_0xdcaa('0x3')](_0x483324,_0x4172e9);};}exports[_0xdcaa('0x4')]=function(_0x5442a5){for(var _0x346405=0x0,_0xe186bc=events[_0xdcaa('0x5')];_0x346405<_0xe186bc;_0x346405++){var _0x19741c=events[_0x346405];var _0x5eaef9=createListener('smsQueue:'+_0x19741c,_0x5442a5);SmsQueueEvents['on'](_0x19741c,_0x5eaef9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d915d57..9d1bfdf 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 _0x89a1=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x89a1,0x1db));var _0x189a=function(_0x5cfb8d,_0x656a13){_0x5cfb8d=_0x5cfb8d-0x0;var _0x530819=_0x89a1[_0x5cfb8d];return _0x530819;};'use strict';var multer=require(_0x189a('0x0'));var util=require(_0x189a('0x1'));var path=require(_0x189a('0x2'));var timeout=require(_0x189a('0x3'));var express=require(_0x189a('0x4'));var router=express[_0x189a('0x5')]();var fs_extra=require(_0x189a('0x6'));var auth=require(_0x189a('0x7'));var interaction=require(_0x189a('0x8'));var config=require(_0x189a('0x9'));var controller=require(_0x189a('0xa'));router[_0x189a('0xb')]('/',auth[_0x189a('0xc')](),controller[_0x189a('0xd')]);router[_0x189a('0xb')](_0x189a('0xe'),auth[_0x189a('0xc')](),controller[_0x189a('0xf')]);router[_0x189a('0xb')](_0x189a('0x10'),auth['isAuthenticated'](),controller[_0x189a('0x11')]);router[_0x189a('0x12')]('/',auth[_0x189a('0xc')](),controller[_0x189a('0x13')]);router['put'](_0x189a('0x10'),auth[_0x189a('0xc')](),controller[_0x189a('0x14')]);router[_0x189a('0x15')](_0x189a('0x10'),auth[_0x189a('0xc')](),controller[_0x189a('0x16')]);module['exports']=router; \ No newline at end of file +var _0xab60=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xab60,0xea));var _0x0ab6=function(_0x54b2c9,_0x5750f2){_0x54b2c9=_0x54b2c9-0x0;var _0x4defc7=_0xab60[_0x54b2c9];return _0x4defc7;};'use strict';var multer=require(_0x0ab6('0x0'));var util=require(_0x0ab6('0x1'));var path=require(_0x0ab6('0x2'));var timeout=require(_0x0ab6('0x3'));var express=require(_0x0ab6('0x4'));var router=express['Router']();var fs_extra=require(_0x0ab6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0ab6('0x6'));var controller=require(_0x0ab6('0x7'));router[_0x0ab6('0x8')]('/',auth[_0x0ab6('0x9')](),controller[_0x0ab6('0xa')]);router[_0x0ab6('0x8')](_0x0ab6('0xb'),auth[_0x0ab6('0x9')](),controller[_0x0ab6('0xc')]);router['get'](_0x0ab6('0xd'),auth[_0x0ab6('0x9')](),controller['show']);router['post']('/',auth[_0x0ab6('0x9')](),controller[_0x0ab6('0xe')]);router['put'](_0x0ab6('0xd'),auth[_0x0ab6('0x9')](),controller['update']);router['delete'](_0x0ab6('0xd'),auth[_0x0ab6('0x9')](),controller[_0x0ab6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3fa8ec3..b3d9422 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 _0x714a=['sequelize','STRING','DATE'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x714a,0xd8));var _0xa714=function(_0x4ec95d,_0x3bdedc){_0x4ec95d=_0x4ec95d-0x0;var _0x7ff9b0=_0x714a[_0x4ec95d];return _0x7ff9b0;};'use strict';var moment=require('moment');var Sequelize=require(_0xa714('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa714('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xa714('0x1')]},'joinAt':{'type':Sequelize[_0xa714('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa714('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa714('0x1')]}}; \ No newline at end of file +var _0xbf98=['STRING','DATE'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbf98,0x132));var _0x8bf9=function(_0x37ceed,_0x3cbecc){_0x37ceed=_0x37ceed-0x0;var _0x145741=_0xbf98[_0x37ceed];return _0x145741;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8bf9('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x8bf9('0x0')]},'joinAt':{'type':Sequelize[_0x8bf9('0x1')]},'leaveAt':{'type':Sequelize[_0x8bf9('0x1')]},'acceptAt':{'type':Sequelize[_0x8bf9('0x1')]},'exitAt':{'type':Sequelize[_0x8bf9('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 2d4dcd0..87448fd 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 _0xf880=['update','then','destroy','error','stack','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x5e8595,_0x102fa6){var _0x4a8de7=function(_0x137309){while(--_0x137309){_0x5e8595['push'](_0x5e8595['shift']());}};_0x4a8de7(++_0x102fa6);}(_0xf880,0x117));var _0x0f88=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0xf880[_0x5c883f];return _0x4210cc;};'use strict';var emlformat=require(_0x0f88('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0f88('0x1'));var rp=require(_0x0f88('0x2'));var moment=require(_0x0f88('0x3'));var BPromise=require(_0x0f88('0x4'));var Mustache=require(_0x0f88('0x5'));var util=require(_0x0f88('0x6'));var path=require('path');var sox=require(_0x0f88('0x7'));var csv=require('to-csv');var ejs=require(_0x0f88('0x8'));var fs=require('fs');var fs_extra=require(_0x0f88('0x9'));var _=require(_0x0f88('0xa'));var squel=require(_0x0f88('0xb'));var crypto=require(_0x0f88('0xc'));var jsforce=require(_0x0f88('0xd'));var deskjs=require(_0x0f88('0xe'));var toCsv=require(_0x0f88('0xf'));var querystring=require(_0x0f88('0x10'));var Papa=require('papaparse');var Redis=require(_0x0f88('0x11'));var authService=require(_0x0f88('0x12'));var qs=require(_0x0f88('0x13'));var as=require(_0x0f88('0x14'));var hardwareService=require(_0x0f88('0x15'));var logger=require('../../config/logger')(_0x0f88('0x16'));var utils=require(_0x0f88('0x17'));var config=require(_0x0f88('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50f1c8,_0x52af7a){_0x52af7a=_0x52af7a||0xcc;return function(_0x39fdac){if(_0x39fdac){return _0x50f1c8[_0x0f88('0x19')](_0x52af7a);}return _0x50f1c8[_0x0f88('0x1a')](_0x52af7a)[_0x0f88('0x1b')]();};}function respondWithResult(_0x293976,_0x2842b5){_0x2842b5=_0x2842b5||0xc8;return function(_0x13e7bd){if(_0x13e7bd){return _0x293976[_0x0f88('0x1a')](_0x2842b5)[_0x0f88('0x1c')](_0x13e7bd);}};}function respondWithFilteredResult(_0x17b83a,_0x1b08cb){return function(_0x67dc68){if(_0x67dc68){var _0x3d3711=typeof _0x1b08cb[_0x0f88('0x1d')]===_0x0f88('0x1e')&&typeof _0x1b08cb[_0x0f88('0x1f')]===_0x0f88('0x1e');var _0x4e8561=_0x67dc68[_0x0f88('0x20')];var _0xdf30c7=_0x3d3711?0x0:_0x1b08cb[_0x0f88('0x1d')];var _0x6cfcb6=_0x3d3711?_0x67dc68[_0x0f88('0x20')]:_0x1b08cb[_0x0f88('0x1d')]+_0x1b08cb[_0x0f88('0x1f')];var _0x56b5f1;if(_0x6cfcb6>=_0x4e8561){_0x6cfcb6=_0x4e8561;_0x56b5f1=0xc8;}else{_0x56b5f1=0xce;}_0x17b83a[_0x0f88('0x1a')](_0x56b5f1);return _0x17b83a[_0x0f88('0x21')]('Content-Range',_0xdf30c7+'-'+_0x6cfcb6+'/'+_0x4e8561)[_0x0f88('0x1c')](_0x67dc68);}return null;};}function patchUpdates(_0x432f18){return function(_0x27fd2f){try{jsonpatch[_0x0f88('0x22')](_0x27fd2f,_0x432f18,!![]);}catch(_0x449987){return BPromise[_0x0f88('0x23')](_0x449987);}return _0x27fd2f[_0x0f88('0x24')]();};}function saveUpdates(_0x9182f9,_0x558404){return function(_0x2f8d79){if(_0x2f8d79){return _0x2f8d79[_0x0f88('0x25')](_0x9182f9)[_0x0f88('0x26')](function(_0x2e035b){return _0x2e035b;});}return null;};}function removeEntity(_0x31af85,_0x3a0e6c){return function(_0x5840e7){if(_0x5840e7){return _0x5840e7[_0x0f88('0x27')]()['then'](function(){_0x31af85[_0x0f88('0x1a')](0xcc)[_0x0f88('0x1b')]();});}};}function handleEntityNotFound(_0x1bd655,_0x3da0d2){return function(_0x147472){if(!_0x147472){_0x1bd655['sendStatus'](0x194);}return _0x147472;};}function handleError(_0x3c824f,_0x5a1525){_0x5a1525=_0x5a1525||0x1f4;return function(_0x1961b3){logger[_0x0f88('0x28')](_0x1961b3[_0x0f88('0x29')]);if(_0x1961b3['name']){delete _0x1961b3[_0x0f88('0x2a')];}_0x3c824f['status'](_0x5a1525)[_0x0f88('0x2b')](_0x1961b3);};}exports[_0x0f88('0x2c')]=function(_0x24c8d8,_0x418c68){var _0x35dd61={},_0x46ab72={},_0x22c4c4={'count':0x0,'rows':[]};var _0x2d4541=_[_0x0f88('0x2d')](db['SmsQueueReport']['rawAttributes'],function(_0x125c5a){return{'name':_0x125c5a['fieldName'],'type':_0x125c5a[_0x0f88('0x2e')][_0x0f88('0x2f')]};});_0x46ab72[_0x0f88('0x30')]=_[_0x0f88('0x2d')](_0x2d4541,_0x0f88('0x2a'));_0x46ab72[_0x0f88('0x31')]=_['keys'](_0x24c8d8[_0x0f88('0x31')]);_0x46ab72[_0x0f88('0x32')]=_[_0x0f88('0x33')](_0x46ab72[_0x0f88('0x30')],_0x46ab72[_0x0f88('0x31')]);_0x35dd61['attributes']=_[_0x0f88('0x33')](_0x46ab72[_0x0f88('0x30')],qs[_0x0f88('0x34')](_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x34')]));_0x35dd61[_0x0f88('0x35')]=_0x35dd61['attributes'][_0x0f88('0x36')]?_0x35dd61[_0x0f88('0x35')]:_0x46ab72[_0x0f88('0x30')];if(!_0x24c8d8['query'][_0x0f88('0x37')](_0x0f88('0x38'))){_0x35dd61[_0x0f88('0x1f')]=qs['limit'](_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x1f')]);_0x35dd61[_0x0f88('0x1d')]=qs[_0x0f88('0x1d')](_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x1d')]);}_0x35dd61[_0x0f88('0x39')]=qs[_0x0f88('0x3a')](_0x24c8d8['query']['sort']);_0x35dd61[_0x0f88('0x3b')]=qs[_0x0f88('0x32')](_[_0x0f88('0x3c')](_0x24c8d8[_0x0f88('0x31')],_0x46ab72['filters']),_0x2d4541);if(_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x3d')]){_0x35dd61[_0x0f88('0x3b')]=_[_0x0f88('0x3e')](_0x35dd61[_0x0f88('0x3b')],{'$or':_['map'](_0x2d4541,function(_0x332938){if(_0x332938['type']!==_0x0f88('0x3f')){var _0x13897f={};_0x13897f[_0x332938[_0x0f88('0x2a')]]={'$like':'%'+_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x3d')]+'%'};return _0x13897f;}})});}_0x35dd61=_[_0x0f88('0x3e')]({},_0x35dd61,_0x24c8d8['options']);var _0x3e325b={'where':_0x35dd61[_0x0f88('0x3b')]};return db[_0x0f88('0x40')]['count'](_0x3e325b)[_0x0f88('0x26')](function(_0x5b88f9){_0x22c4c4[_0x0f88('0x20')]=_0x5b88f9;if(_0x24c8d8['query'][_0x0f88('0x41')]){_0x35dd61[_0x0f88('0x42')]=[{'all':!![]}];}return db[_0x0f88('0x40')][_0x0f88('0x43')](_0x35dd61);})[_0x0f88('0x26')](function(_0x3427f9){_0x22c4c4[_0x0f88('0x44')]=_0x3427f9;return _0x22c4c4;})[_0x0f88('0x26')](respondWithFilteredResult(_0x418c68,_0x35dd61))[_0x0f88('0x45')](handleError(_0x418c68,null));};exports[_0x0f88('0x46')]=function(_0x2c10e4,_0x577674){var _0x48ac3c={'raw':!![],'where':{'id':_0x2c10e4[_0x0f88('0x47')]['id']}},_0x395bb9={};_0x395bb9[_0x0f88('0x30')]=_[_0x0f88('0x48')](db[_0x0f88('0x40')][_0x0f88('0x49')]);_0x395bb9[_0x0f88('0x31')]=_[_0x0f88('0x48')](_0x2c10e4[_0x0f88('0x31')]);_0x395bb9['filters']=_['intersection'](_0x395bb9[_0x0f88('0x30')],_0x395bb9[_0x0f88('0x31')]);_0x48ac3c[_0x0f88('0x35')]=_[_0x0f88('0x33')](_0x395bb9[_0x0f88('0x30')],qs[_0x0f88('0x34')](_0x2c10e4[_0x0f88('0x31')]['fields']));_0x48ac3c['attributes']=_0x48ac3c[_0x0f88('0x35')][_0x0f88('0x36')]?_0x48ac3c[_0x0f88('0x35')]:_0x395bb9[_0x0f88('0x30')];if(_0x2c10e4[_0x0f88('0x31')][_0x0f88('0x41')]){_0x48ac3c['include']=[{'all':!![]}];}_0x48ac3c=_[_0x0f88('0x3e')]({},_0x48ac3c,_0x2c10e4[_0x0f88('0x4a')]);return db[_0x0f88('0x40')][_0x0f88('0x4b')](_0x48ac3c)[_0x0f88('0x26')](handleEntityNotFound(_0x577674,null))[_0x0f88('0x26')](respondWithResult(_0x577674,null))[_0x0f88('0x45')](handleError(_0x577674,null));};exports[_0x0f88('0x4c')]=function(_0x211de0,_0xf3c95e){return db['SmsQueueReport'][_0x0f88('0x4c')](_0x211de0[_0x0f88('0x4d')],{})[_0x0f88('0x26')](respondWithResult(_0xf3c95e,0xc9))['catch'](handleError(_0xf3c95e,null));};exports['update']=function(_0x38ae5d,_0x1ff624){if(_0x38ae5d['body']['id']){delete _0x38ae5d[_0x0f88('0x4d')]['id'];}return db[_0x0f88('0x40')][_0x0f88('0x4b')]({'where':{'id':_0x38ae5d[_0x0f88('0x47')]['id']}})[_0x0f88('0x26')](handleEntityNotFound(_0x1ff624,null))['then'](saveUpdates(_0x38ae5d['body'],null))['then'](respondWithResult(_0x1ff624,null))[_0x0f88('0x45')](handleError(_0x1ff624,null));};exports[_0x0f88('0x27')]=function(_0x18e74b,_0x4429ba){return db[_0x0f88('0x40')][_0x0f88('0x4b')]({'where':{'id':_0x18e74b[_0x0f88('0x47')]['id']}})[_0x0f88('0x26')](handleEntityNotFound(_0x4429ba,null))['then'](removeEntity(_0x4429ba,null))['catch'](handleError(_0x4429ba,null));};exports[_0x0f88('0x4e')]=function(_0x36cf04,_0x63aaf8){return db['SmsQueueReport']['describe']()[_0x0f88('0x26')](respondWithResult(_0x63aaf8,null))[_0x0f88('0x45')](handleError(_0x63aaf8,null));}; \ No newline at end of file +var _0x5714=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra'];(function(_0x3c22db,_0x3a85d7){var _0x22662a=function(_0x540bce){while(--_0x540bce){_0x3c22db['push'](_0x3c22db['shift']());}};_0x22662a(++_0x3a85d7);}(_0x5714,0x1da));var _0x4571=function(_0x580a08,_0x4a601a){_0x580a08=_0x580a08-0x0;var _0x1eb93f=_0x5714[_0x580a08];return _0x1eb93f;};'use strict';var emlformat=require(_0x4571('0x0'));var rimraf=require(_0x4571('0x1'));var zipdir=require(_0x4571('0x2'));var jsonpatch=require(_0x4571('0x3'));var rp=require(_0x4571('0x4'));var moment=require(_0x4571('0x5'));var BPromise=require(_0x4571('0x6'));var Mustache=require('mustache');var util=require(_0x4571('0x7'));var path=require('path');var sox=require(_0x4571('0x8'));var csv=require(_0x4571('0x9'));var ejs=require(_0x4571('0xa'));var fs=require('fs');var fs_extra=require(_0x4571('0xb'));var _=require(_0x4571('0xc'));var squel=require(_0x4571('0xd'));var crypto=require(_0x4571('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4571('0xf'));var toCsv=require(_0x4571('0x9'));var querystring=require(_0x4571('0x10'));var Papa=require('papaparse');var Redis=require(_0x4571('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4571('0x12'));var as=require(_0x4571('0x13'));var hardwareService=require(_0x4571('0x14'));var logger=require(_0x4571('0x15'))(_0x4571('0x16'));var utils=require(_0x4571('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4571('0x18'));var db=require(_0x4571('0x19'))['db'];function respondWithStatusCode(_0x5ad24f,_0x15e553){_0x15e553=_0x15e553||0xcc;return function(_0x255618){if(_0x255618){return _0x5ad24f[_0x4571('0x1a')](_0x15e553);}return _0x5ad24f[_0x4571('0x1b')](_0x15e553)[_0x4571('0x1c')]();};}function respondWithResult(_0x586dc5,_0x3e332f){_0x3e332f=_0x3e332f||0xc8;return function(_0x300fc5){if(_0x300fc5){return _0x586dc5[_0x4571('0x1b')](_0x3e332f)['json'](_0x300fc5);}};}function respondWithFilteredResult(_0x4cb383,_0x31012d){return function(_0x22f544){if(_0x22f544){var _0x1b904d=typeof _0x31012d[_0x4571('0x1d')]==='undefined'&&typeof _0x31012d[_0x4571('0x1e')]===_0x4571('0x1f');var _0x221860=_0x22f544['count'];var _0x16097e=_0x1b904d?0x0:_0x31012d[_0x4571('0x1d')];var _0x1e5258=_0x1b904d?_0x22f544[_0x4571('0x20')]:_0x31012d[_0x4571('0x1d')]+_0x31012d['limit'];var _0x5d0ca6;if(_0x1e5258>=_0x221860){_0x1e5258=_0x221860;_0x5d0ca6=0xc8;}else{_0x5d0ca6=0xce;}_0x4cb383[_0x4571('0x1b')](_0x5d0ca6);return _0x4cb383[_0x4571('0x21')](_0x4571('0x22'),_0x16097e+'-'+_0x1e5258+'/'+_0x221860)[_0x4571('0x23')](_0x22f544);}return null;};}function patchUpdates(_0x1bcc4a){return function(_0x404a12){try{jsonpatch[_0x4571('0x24')](_0x404a12,_0x1bcc4a,!![]);}catch(_0x921298){return BPromise[_0x4571('0x25')](_0x921298);}return _0x404a12[_0x4571('0x26')]();};}function saveUpdates(_0x434981,_0x48855f){return function(_0x469137){if(_0x469137){return _0x469137[_0x4571('0x27')](_0x434981)[_0x4571('0x28')](function(_0x599acc){return _0x599acc;});}return null;};}function removeEntity(_0x21441b,_0x2207f1){return function(_0x5c0640){if(_0x5c0640){return _0x5c0640['destroy']()['then'](function(){_0x21441b[_0x4571('0x1b')](0xcc)[_0x4571('0x1c')]();});}};}function handleEntityNotFound(_0x3231e5,_0x193923){return function(_0x26588a){if(!_0x26588a){_0x3231e5[_0x4571('0x1a')](0x194);}return _0x26588a;};}function handleError(_0x2d3fb5,_0x432a0d){_0x432a0d=_0x432a0d||0x1f4;return function(_0x126aee){logger[_0x4571('0x29')](_0x126aee[_0x4571('0x2a')]);if(_0x126aee[_0x4571('0x2b')]){delete _0x126aee[_0x4571('0x2b')];}_0x2d3fb5[_0x4571('0x1b')](_0x432a0d)[_0x4571('0x2c')](_0x126aee);};}exports[_0x4571('0x2d')]=function(_0x4d03e2,_0x4c2616){var _0x5649f0={},_0x250f9d={},_0x2fc271={'count':0x0,'rows':[]};var _0x1835bb=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x390ece){return{'name':_0x390ece[_0x4571('0x2e')],'type':_0x390ece[_0x4571('0x2f')][_0x4571('0x30')]};});_0x250f9d[_0x4571('0x31')]=_[_0x4571('0x32')](_0x1835bb,_0x4571('0x2b'));_0x250f9d[_0x4571('0x33')]=_[_0x4571('0x34')](_0x4d03e2[_0x4571('0x33')]);_0x250f9d[_0x4571('0x35')]=_[_0x4571('0x36')](_0x250f9d[_0x4571('0x31')],_0x250f9d[_0x4571('0x33')]);_0x5649f0['attributes']=_[_0x4571('0x36')](_0x250f9d[_0x4571('0x31')],qs[_0x4571('0x37')](_0x4d03e2[_0x4571('0x33')][_0x4571('0x37')]));_0x5649f0[_0x4571('0x38')]=_0x5649f0['attributes']['length']?_0x5649f0['attributes']:_0x250f9d[_0x4571('0x31')];if(!_0x4d03e2[_0x4571('0x33')][_0x4571('0x39')](_0x4571('0x3a'))){_0x5649f0[_0x4571('0x1e')]=qs[_0x4571('0x1e')](_0x4d03e2[_0x4571('0x33')][_0x4571('0x1e')]);_0x5649f0[_0x4571('0x1d')]=qs[_0x4571('0x1d')](_0x4d03e2['query']['offset']);}_0x5649f0[_0x4571('0x3b')]=qs[_0x4571('0x3c')](_0x4d03e2[_0x4571('0x33')][_0x4571('0x3c')]);_0x5649f0[_0x4571('0x3d')]=qs[_0x4571('0x35')](_[_0x4571('0x3e')](_0x4d03e2['query'],_0x250f9d['filters']),_0x1835bb);if(_0x4d03e2[_0x4571('0x33')][_0x4571('0x3f')]){_0x5649f0[_0x4571('0x3d')]=_[_0x4571('0x40')](_0x5649f0[_0x4571('0x3d')],{'$or':_[_0x4571('0x32')](_0x1835bb,function(_0x3cc77f){if(_0x3cc77f[_0x4571('0x2f')]!==_0x4571('0x41')){var _0x427ab8={};_0x427ab8[_0x3cc77f[_0x4571('0x2b')]]={'$like':'%'+_0x4d03e2['query'][_0x4571('0x3f')]+'%'};return _0x427ab8;}})});}_0x5649f0=_[_0x4571('0x40')]({},_0x5649f0,_0x4d03e2[_0x4571('0x42')]);var _0x2ca03b={'where':_0x5649f0[_0x4571('0x3d')]};return db[_0x4571('0x43')][_0x4571('0x20')](_0x2ca03b)[_0x4571('0x28')](function(_0x223b0e){_0x2fc271[_0x4571('0x20')]=_0x223b0e;if(_0x4d03e2[_0x4571('0x33')][_0x4571('0x44')]){_0x5649f0[_0x4571('0x45')]=[{'all':!![]}];}return db[_0x4571('0x43')][_0x4571('0x46')](_0x5649f0);})[_0x4571('0x28')](function(_0xe181f2){_0x2fc271[_0x4571('0x47')]=_0xe181f2;return _0x2fc271;})[_0x4571('0x28')](respondWithFilteredResult(_0x4c2616,_0x5649f0))[_0x4571('0x48')](handleError(_0x4c2616,null));};exports[_0x4571('0x49')]=function(_0x177446,_0x52326f){var _0x161cdc={'raw':!![],'where':{'id':_0x177446[_0x4571('0x4a')]['id']}},_0x5134f3={};_0x5134f3[_0x4571('0x31')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x5134f3[_0x4571('0x33')]=_[_0x4571('0x34')](_0x177446[_0x4571('0x33')]);_0x5134f3[_0x4571('0x35')]=_[_0x4571('0x36')](_0x5134f3['model'],_0x5134f3[_0x4571('0x33')]);_0x161cdc[_0x4571('0x38')]=_[_0x4571('0x36')](_0x5134f3['model'],qs[_0x4571('0x37')](_0x177446['query'][_0x4571('0x37')]));_0x161cdc['attributes']=_0x161cdc[_0x4571('0x38')][_0x4571('0x4b')]?_0x161cdc[_0x4571('0x38')]:_0x5134f3['model'];if(_0x177446[_0x4571('0x33')][_0x4571('0x44')]){_0x161cdc['include']=[{'all':!![]}];}_0x161cdc=_['merge']({},_0x161cdc,_0x177446[_0x4571('0x42')]);return db[_0x4571('0x43')][_0x4571('0x4c')](_0x161cdc)['then'](handleEntityNotFound(_0x52326f,null))[_0x4571('0x28')](respondWithResult(_0x52326f,null))[_0x4571('0x48')](handleError(_0x52326f,null));};exports[_0x4571('0x4d')]=function(_0x4a2e24,_0xc6aaef){return db[_0x4571('0x43')][_0x4571('0x4d')](_0x4a2e24['body'],{})[_0x4571('0x28')](respondWithResult(_0xc6aaef,0xc9))[_0x4571('0x48')](handleError(_0xc6aaef,null));};exports[_0x4571('0x27')]=function(_0x1a84d5,_0xb48e2){if(_0x1a84d5[_0x4571('0x4e')]['id']){delete _0x1a84d5['body']['id'];}return db[_0x4571('0x43')][_0x4571('0x4c')]({'where':{'id':_0x1a84d5[_0x4571('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb48e2,null))[_0x4571('0x28')](saveUpdates(_0x1a84d5['body'],null))[_0x4571('0x28')](respondWithResult(_0xb48e2,null))[_0x4571('0x48')](handleError(_0xb48e2,null));};exports[_0x4571('0x4f')]=function(_0x36e525,_0xc8d035){return db[_0x4571('0x43')][_0x4571('0x4c')]({'where':{'id':_0x36e525['params']['id']}})['then'](handleEntityNotFound(_0xc8d035,null))[_0x4571('0x28')](removeEntity(_0xc8d035,null))['catch'](handleError(_0xc8d035,null));};exports[_0x4571('0x50')]=function(_0x3177a0,_0x61325f){return db[_0x4571('0x43')][_0x4571('0x50')]()[_0x4571('0x28')](respondWithResult(_0x61325f,null))[_0x4571('0x48')](handleError(_0x61325f,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index f37c72b..bd521e4 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x39c4ba,_0x192f1f){var _0x1c9c76=function(_0x415c51){while(--_0x415c51){_0x39c4ba['push'](_0x39c4ba['shift']());}};_0x1c9c76(++_0x192f1f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_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 b6d4beb..0f5c7ef 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 _0x18e8=['../../config/utils','rpc','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','attributes','limit','stringify','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x31d7b3,_0x382ac4){var _0x5cbc20=function(_0x521d0a){while(--_0x521d0a){_0x31d7b3['push'](_0x31d7b3['shift']());}};_0x5cbc20(++_0x382ac4);}(_0x18e8,0x77));var _0x818e=function(_0x1bfe7f,_0x569199){_0x1bfe7f=_0x1bfe7f-0x0;var _0x2d569f=_0x18e8[_0x1bfe7f];return _0x2d569f;};'use strict';var _=require(_0x818e('0x0'));var util=require(_0x818e('0x1'));var moment=require('moment');var BPromise=require(_0x818e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x818e('0x3'));var db=require(_0x818e('0x4'))['db'];var utils=require(_0x818e('0x5'));var logger=require('../../config/logger')(_0x818e('0x6'));var config=require('../../config/environment');var jayson=require(_0x818e('0x7'));var client=jayson[_0x818e('0x8')][_0x818e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf02c5,_0x4583f2,_0x4d6923){return new BPromise(function(_0x5d3a85,_0x1e2fe8){return client[_0x818e('0xa')](_0xf02c5,_0x4d6923)['then'](function(_0x30d981){logger[_0x818e('0xb')](_0x818e('0xc'),_0x4583f2,_0x818e('0xd'));logger[_0x818e('0xe')](_0x818e('0xf'),_0x4583f2,_0x818e('0xd'),JSON['stringify'](_0x30d981));if(_0x30d981['error']){if(_0x30d981[_0x818e('0x10')][_0x818e('0x11')]===0x1f4){logger[_0x818e('0x10')](_0x818e('0xc'),_0x4583f2,_0x30d981[_0x818e('0x10')][_0x818e('0x12')]);return _0x1e2fe8(_0x30d981[_0x818e('0x10')]['message']);}logger[_0x818e('0x10')](_0x818e('0xc'),_0x4583f2,_0x30d981[_0x818e('0x10')][_0x818e('0x12')]);return _0x5d3a85(_0x30d981['error'][_0x818e('0x12')]);}else{logger['info'](_0x818e('0xc'),_0x4583f2,_0x818e('0xd'));_0x5d3a85(_0x30d981[_0x818e('0x13')][_0x818e('0x12')]);}})[_0x818e('0x14')](function(_0x40e6e5){logger[_0x818e('0x10')](_0x818e('0xc'),_0x4583f2,_0x40e6e5);_0x1e2fe8(_0x40e6e5);});});}exports['CreateSmsQueueReport']=function(_0x1f0007){var _0x1b9fc4=this;return new Promise(function(_0x2eef40,_0x1ede55){return db['SmsQueueReport'][_0x818e('0x15')](_0x1f0007['body'],{'raw':_0x1f0007[_0x818e('0x16')]?_0x1f0007['options'][_0x818e('0x17')]===undefined?!![]:![]:!![]})[_0x818e('0x18')](function(_0x117a6e){logger[_0x818e('0xb')](_0x818e('0x19'),_0x1f0007);logger[_0x818e('0xe')]('CreateSmsQueueReport',_0x1f0007,JSON['stringify'](_0x117a6e));_0x2eef40(_0x117a6e);})[_0x818e('0x14')](function(_0x17862e){logger[_0x818e('0x10')](_0x818e('0x19'),_0x17862e[_0x818e('0x12')],_0x1f0007);_0x1ede55(_0x1b9fc4[_0x818e('0x10')](0x1f4,_0x17862e[_0x818e('0x12')]));});});};exports[_0x818e('0x1a')]=function(_0x1a1290){var _0x243980=this;return new Promise(function(_0x13d6d6,_0xe318bb){return db[_0x818e('0x1b')]['update'](_0x1a1290['body'],{'raw':_0x1a1290[_0x818e('0x16')]?_0x1a1290[_0x818e('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a1290[_0x818e('0x16')]?_0x1a1290['options']['where']||null:null,'attributes':_0x1a1290['options']?_0x1a1290['options'][_0x818e('0x1c')]||null:null,'limit':_0x1a1290[_0x818e('0x16')]?_0x1a1290[_0x818e('0x16')][_0x818e('0x1d')]||null:null})[_0x818e('0x18')](function(_0x4e4589){logger[_0x818e('0xb')](_0x818e('0x1a'),_0x1a1290);logger['debug'](_0x818e('0x1a'),_0x1a1290,JSON[_0x818e('0x1e')](_0x4e4589));_0x13d6d6(_0x4e4589);})[_0x818e('0x14')](function(_0x3d4d5e){logger['error'](_0x818e('0x1a'),_0x3d4d5e[_0x818e('0x12')],_0x1a1290);_0xe318bb(_0x243980['error'](0x1f4,_0x3d4d5e['message']));});});}; \ No newline at end of file +var _0xa3b2=['request\x20sent','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','debug','UpdateSmsQueueReport','body','where','attributes','stringify','lodash','util','moment','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x1cda23,_0x225664){var _0x58a15d=function(_0x9630a1){while(--_0x9630a1){_0x1cda23['push'](_0x1cda23['shift']());}};_0x58a15d(++_0x225664);}(_0xa3b2,0xb3));var _0x2a3b=function(_0x261bbf,_0x567f53){_0x261bbf=_0x261bbf-0x0;var _0x3434e5=_0xa3b2[_0x261bbf];return _0x3434e5;};'use strict';var _=require(_0x2a3b('0x0'));var util=require(_0x2a3b('0x1'));var moment=require(_0x2a3b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2a3b('0x3'));var logger=require('../../config/logger')(_0x2a3b('0x4'));var config=require(_0x2a3b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2a3b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5000fb,_0x1ef6a5,_0x146830){return new BPromise(function(_0x286fe1,_0x315f60){return client[_0x2a3b('0x7')](_0x5000fb,_0x146830)[_0x2a3b('0x8')](function(_0x27914d){logger[_0x2a3b('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x1ef6a5,_0x2a3b('0xa'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1ef6a5,'request\x20sent',JSON['stringify'](_0x27914d));if(_0x27914d[_0x2a3b('0xb')]){if(_0x27914d[_0x2a3b('0xb')]['code']===0x1f4){logger[_0x2a3b('0xb')](_0x2a3b('0xc'),_0x1ef6a5,_0x27914d[_0x2a3b('0xb')][_0x2a3b('0xd')]);return _0x315f60(_0x27914d[_0x2a3b('0xb')]['message']);}logger['error'](_0x2a3b('0xc'),_0x1ef6a5,_0x27914d[_0x2a3b('0xb')][_0x2a3b('0xd')]);return _0x286fe1(_0x27914d[_0x2a3b('0xb')][_0x2a3b('0xd')]);}else{logger[_0x2a3b('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x1ef6a5,'request\x20sent');_0x286fe1(_0x27914d[_0x2a3b('0xe')][_0x2a3b('0xd')]);}})[_0x2a3b('0xf')](function(_0x242cba){logger[_0x2a3b('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x1ef6a5,_0x242cba);_0x315f60(_0x242cba);});});}exports[_0x2a3b('0x10')]=function(_0x4b0e2b){var _0x44a501=this;return new Promise(function(_0x168aca,_0x407997){return db[_0x2a3b('0x11')][_0x2a3b('0x12')](_0x4b0e2b['body'],{'raw':_0x4b0e2b[_0x2a3b('0x13')]?_0x4b0e2b[_0x2a3b('0x13')][_0x2a3b('0x14')]===undefined?!![]:![]:!![]})[_0x2a3b('0x8')](function(_0x3e61cc){logger[_0x2a3b('0x9')](_0x2a3b('0x10'),_0x4b0e2b);logger[_0x2a3b('0x15')](_0x2a3b('0x10'),_0x4b0e2b,JSON['stringify'](_0x3e61cc));_0x168aca(_0x3e61cc);})[_0x2a3b('0xf')](function(_0x56571d){logger[_0x2a3b('0xb')](_0x2a3b('0x10'),_0x56571d[_0x2a3b('0xd')],_0x4b0e2b);_0x407997(_0x44a501['error'](0x1f4,_0x56571d[_0x2a3b('0xd')]));});});};exports[_0x2a3b('0x16')]=function(_0x125486){var _0x5b7426=this;return new Promise(function(_0xb31584,_0x38470a){return db[_0x2a3b('0x11')]['update'](_0x125486[_0x2a3b('0x17')],{'raw':_0x125486['options']?_0x125486[_0x2a3b('0x13')][_0x2a3b('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x125486[_0x2a3b('0x13')]?_0x125486[_0x2a3b('0x13')][_0x2a3b('0x18')]||null:null,'attributes':_0x125486[_0x2a3b('0x13')]?_0x125486[_0x2a3b('0x13')][_0x2a3b('0x19')]||null:null,'limit':_0x125486[_0x2a3b('0x13')]?_0x125486[_0x2a3b('0x13')]['limit']||null:null})[_0x2a3b('0x8')](function(_0x306bd5){logger['info']('UpdateSmsQueueReport',_0x125486);logger[_0x2a3b('0x15')](_0x2a3b('0x16'),_0x125486,JSON[_0x2a3b('0x1a')](_0x306bd5));_0xb31584(_0x306bd5);})[_0x2a3b('0xf')](function(_0x55063a){logger['error']('UpdateSmsQueueReport',_0x55063a[_0x2a3b('0xd')],_0x125486);_0x38470a(_0x5b7426['error'](0x1f4,_0x55063a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d9aac80..4e189d7 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 _0x9957=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x26826e,_0x4926fb){var _0x410b33=function(_0x542106){while(--_0x542106){_0x26826e['push'](_0x26826e['shift']());}};_0x410b33(++_0x4926fb);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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('0xf')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')](_0x7995('0x12'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);module[_0x7995('0x16')]=router; \ No newline at end of file +var _0xca9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0xca9e,0x136));var _0xeca9=function(_0xa45c69,_0x2b66e9){_0xa45c69=_0xa45c69-0x0;var _0x308a51=_0xca9e[_0xa45c69];return _0x308a51;};'use strict';var multer=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var path=require(_0xeca9('0x2'));var timeout=require(_0xeca9('0x3'));var express=require(_0xeca9('0x4'));var router=express[_0xeca9('0x5')]();var fs_extra=require(_0xeca9('0x6'));var auth=require(_0xeca9('0x7'));var interaction=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var controller=require(_0xeca9('0xa'));router[_0xeca9('0xb')]('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0xd')]);router['get'](_0xeca9('0xe'),auth[_0xeca9('0xc')](),controller['describe']);router['get'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x10')]);router['post']('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0x11')]);router[_0xeca9('0x12')](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x13')]);router['delete'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller['destroy']);module[_0xeca9('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 7dd8186..1f54d2c 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2c0c8d,_0x4a86c7){var _0x114e7a=function(_0x5ef296){while(--_0x5ef296){_0x2c0c8d['push'](_0x2c0c8d['shift']());}};_0x114e7a(++_0x4a86c7);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x40e657,_0x2fa79f){var _0x3bfde1=function(_0xb82c48){while(--_0xb82c48){_0x40e657['push'](_0x40e657['shift']());}};_0x3bfde1(++_0x2fa79f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5b9565,_0x3a38c7){_0x5b9565=_0x5b9565-0x0;var _0x34328b=_0xf4eb[_0x5b9565];return _0x34328b;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 089fdfa..7bcd4e6 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 _0x03e9=['fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','include','findAll','catch','params','includeAll','options','find','body','destroy','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','json','reject','save','update','then','status','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','key','map','keys','filters','intersection','model','query','attributes'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0x03e9,0x1cb));var _0x903e=function(_0x5add15,_0x2e6e1d){_0x5add15=_0x5add15-0x0;var _0xd863b8=_0x03e9[_0x5add15];return _0xd863b8;};'use strict';var emlformat=require(_0x903e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x903e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x903e('0x2'));var BPromise=require(_0x903e('0x3'));var Mustache=require(_0x903e('0x4'));var util=require(_0x903e('0x5'));var path=require(_0x903e('0x6'));var sox=require('sox');var csv=require(_0x903e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x903e('0x8'));var _=require(_0x903e('0x9'));var squel=require(_0x903e('0xa'));var crypto=require(_0x903e('0xb'));var jsforce=require(_0x903e('0xc'));var deskjs=require(_0x903e('0xd'));var toCsv=require(_0x903e('0x7'));var querystring=require('querystring');var Papa=require(_0x903e('0xe'));var Redis=require(_0x903e('0xf'));var authService=require(_0x903e('0x10'));var qs=require(_0x903e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x903e('0x12'))(_0x903e('0x13'));var utils=require(_0x903e('0x14'));var config=require(_0x903e('0x15'));var licenseUtil=require(_0x903e('0x16'));var db=require(_0x903e('0x17'))['db'];function respondWithStatusCode(_0x1d71c9,_0xd89f9c){_0xd89f9c=_0xd89f9c||0xcc;return function(_0x376fcf){if(_0x376fcf){return _0x1d71c9[_0x903e('0x18')](_0xd89f9c);}return _0x1d71c9['status'](_0xd89f9c)[_0x903e('0x19')]();};}function respondWithResult(_0x2155df,_0x11db3a){_0x11db3a=_0x11db3a||0xc8;return function(_0x29da43){if(_0x29da43){return _0x2155df['status'](_0x11db3a)['json'](_0x29da43);}};}function respondWithFilteredResult(_0x4aea75,_0x14a3b0){return function(_0x3aa31d){if(_0x3aa31d){var _0x3935ac=typeof _0x14a3b0[_0x903e('0x1a')]===_0x903e('0x1b')&&typeof _0x14a3b0[_0x903e('0x1c')]===_0x903e('0x1b');var _0x4f90f5=_0x3aa31d['count'];var _0x3d9234=_0x3935ac?0x0:_0x14a3b0['offset'];var _0x2a651c=_0x3935ac?_0x3aa31d[_0x903e('0x1d')]:_0x14a3b0[_0x903e('0x1a')]+_0x14a3b0[_0x903e('0x1c')];var _0x755e03;if(_0x2a651c>=_0x4f90f5){_0x2a651c=_0x4f90f5;_0x755e03=0xc8;}else{_0x755e03=0xce;}_0x4aea75['status'](_0x755e03);return _0x4aea75[_0x903e('0x1e')]('Content-Range',_0x3d9234+'-'+_0x2a651c+'/'+_0x4f90f5)[_0x903e('0x1f')](_0x3aa31d);}return null;};}function patchUpdates(_0x4ef771){return function(_0x23746b){try{jsonpatch['apply'](_0x23746b,_0x4ef771,!![]);}catch(_0x1bf285){return BPromise[_0x903e('0x20')](_0x1bf285);}return _0x23746b[_0x903e('0x21')]();};}function saveUpdates(_0x46d913,_0x563960){return function(_0xa84100){if(_0xa84100){return _0xa84100[_0x903e('0x22')](_0x46d913)[_0x903e('0x23')](function(_0x5da45d){return _0x5da45d;});}return null;};}function removeEntity(_0xca12d4,_0x512269){return function(_0xcb386d){if(_0xcb386d){return _0xcb386d['destroy']()[_0x903e('0x23')](function(){_0xca12d4[_0x903e('0x24')](0xcc)[_0x903e('0x19')]();});}};}function handleEntityNotFound(_0x443cf0,_0x552787){return function(_0x3ceccb){if(!_0x3ceccb){_0x443cf0[_0x903e('0x18')](0x194);}return _0x3ceccb;};}function handleError(_0x530bb4,_0x30702b){_0x30702b=_0x30702b||0x1f4;return function(_0x2e7b73){logger['error'](_0x2e7b73[_0x903e('0x25')]);if(_0x2e7b73[_0x903e('0x26')]){delete _0x2e7b73[_0x903e('0x26')];}_0x530bb4[_0x903e('0x24')](_0x30702b)[_0x903e('0x27')](_0x2e7b73);};}exports[_0x903e('0x28')]=function(_0x54b74e,_0x514e3d){var _0x541894={},_0x2a5e80={},_0x525b53={'count':0x0,'rows':[]};var _0x4bda4c=_['map'](db[_0x903e('0x29')][_0x903e('0x2a')],function(_0x880344){return{'name':_0x880344[_0x903e('0x2b')],'type':_0x880344['type'][_0x903e('0x2c')]};});_0x2a5e80['model']=_[_0x903e('0x2d')](_0x4bda4c,_0x903e('0x26'));_0x2a5e80['query']=_[_0x903e('0x2e')](_0x54b74e['query']);_0x2a5e80[_0x903e('0x2f')]=_[_0x903e('0x30')](_0x2a5e80[_0x903e('0x31')],_0x2a5e80[_0x903e('0x32')]);_0x541894[_0x903e('0x33')]=_['intersection'](_0x2a5e80[_0x903e('0x31')],qs[_0x903e('0x34')](_0x54b74e['query'][_0x903e('0x34')]));_0x541894[_0x903e('0x33')]=_0x541894[_0x903e('0x33')][_0x903e('0x35')]?_0x541894[_0x903e('0x33')]:_0x2a5e80['model'];if(!_0x54b74e[_0x903e('0x32')][_0x903e('0x36')](_0x903e('0x37'))){_0x541894[_0x903e('0x1c')]=qs[_0x903e('0x1c')](_0x54b74e[_0x903e('0x32')][_0x903e('0x1c')]);_0x541894[_0x903e('0x1a')]=qs[_0x903e('0x1a')](_0x54b74e[_0x903e('0x32')][_0x903e('0x1a')]);}_0x541894[_0x903e('0x38')]=qs[_0x903e('0x39')](_0x54b74e['query'][_0x903e('0x39')]);_0x541894[_0x903e('0x3a')]=qs['filters'](_['pick'](_0x54b74e['query'],_0x2a5e80[_0x903e('0x2f')]),_0x4bda4c);if(_0x54b74e[_0x903e('0x32')]['filter']){_0x541894[_0x903e('0x3a')]=_[_0x903e('0x3b')](_0x541894[_0x903e('0x3a')],{'$or':_[_0x903e('0x2d')](_0x4bda4c,function(_0x628424){if(_0x628424[_0x903e('0x3c')]!==_0x903e('0x3d')){var _0x579da7={};_0x579da7[_0x628424['name']]={'$like':'%'+_0x54b74e['query'][_0x903e('0x3e')]+'%'};return _0x579da7;}})});}_0x541894=_[_0x903e('0x3b')]({},_0x541894,_0x54b74e['options']);var _0x44e9b0={'where':_0x541894['where']};return db[_0x903e('0x29')][_0x903e('0x1d')](_0x44e9b0)[_0x903e('0x23')](function(_0xf6bb94){_0x525b53[_0x903e('0x1d')]=_0xf6bb94;if(_0x54b74e[_0x903e('0x32')]['includeAll']){_0x541894[_0x903e('0x3f')]=[{'all':!![]}];}return db[_0x903e('0x29')][_0x903e('0x40')](_0x541894);})[_0x903e('0x23')](function(_0x4682ab){_0x525b53['rows']=_0x4682ab;return _0x525b53;})[_0x903e('0x23')](respondWithFilteredResult(_0x514e3d,_0x541894))[_0x903e('0x41')](handleError(_0x514e3d,null));};exports['show']=function(_0x168971,_0x5e8997){var _0x3c366a={'raw':!![],'where':{'id':_0x168971[_0x903e('0x42')]['id']}},_0x21b54={};_0x21b54[_0x903e('0x31')]=_[_0x903e('0x2e')](db[_0x903e('0x29')][_0x903e('0x2a')]);_0x21b54['query']=_['keys'](_0x168971['query']);_0x21b54['filters']=_[_0x903e('0x30')](_0x21b54['model'],_0x21b54[_0x903e('0x32')]);_0x3c366a['attributes']=_['intersection'](_0x21b54[_0x903e('0x31')],qs[_0x903e('0x34')](_0x168971[_0x903e('0x32')]['fields']));_0x3c366a[_0x903e('0x33')]=_0x3c366a[_0x903e('0x33')][_0x903e('0x35')]?_0x3c366a[_0x903e('0x33')]:_0x21b54[_0x903e('0x31')];if(_0x168971['query'][_0x903e('0x43')]){_0x3c366a['include']=[{'all':!![]}];}_0x3c366a=_[_0x903e('0x3b')]({},_0x3c366a,_0x168971[_0x903e('0x44')]);return db[_0x903e('0x29')][_0x903e('0x45')](_0x3c366a)[_0x903e('0x23')](handleEntityNotFound(_0x5e8997,null))[_0x903e('0x23')](respondWithResult(_0x5e8997,null))[_0x903e('0x41')](handleError(_0x5e8997,null));};exports['create']=function(_0x2b4119,_0x7416f5){return db['SmsTransferReport']['create'](_0x2b4119[_0x903e('0x46')],{})[_0x903e('0x23')](respondWithResult(_0x7416f5,0xc9))[_0x903e('0x41')](handleError(_0x7416f5,null));};exports[_0x903e('0x22')]=function(_0x40b349,_0x1ca5ae){if(_0x40b349[_0x903e('0x46')]['id']){delete _0x40b349[_0x903e('0x46')]['id'];}return db[_0x903e('0x29')][_0x903e('0x45')]({'where':{'id':_0x40b349[_0x903e('0x42')]['id']}})[_0x903e('0x23')](handleEntityNotFound(_0x1ca5ae,null))[_0x903e('0x23')](saveUpdates(_0x40b349[_0x903e('0x46')],null))[_0x903e('0x23')](respondWithResult(_0x1ca5ae,null))[_0x903e('0x41')](handleError(_0x1ca5ae,null));};exports[_0x903e('0x47')]=function(_0x334b22,_0x51cef3){return db[_0x903e('0x29')][_0x903e('0x45')]({'where':{'id':_0x334b22[_0x903e('0x42')]['id']}})[_0x903e('0x23')](handleEntityNotFound(_0x51cef3,null))[_0x903e('0x23')](removeEntity(_0x51cef3,null))['catch'](handleError(_0x51cef3,null));};exports[_0x903e('0x48')]=function(_0xa72874,_0x28d1e4){return db[_0x903e('0x29')]['describe']()[_0x903e('0x23')](respondWithResult(_0x28d1e4,null))[_0x903e('0x41')](handleError(_0x28d1e4,null));}; \ No newline at end of file +var _0xa2f1=['name','send','index','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','end','error','stack'];(function(_0x1f278c,_0x39ad3b){var _0x30feef=function(_0x1fc46d){while(--_0x1fc46d){_0x1f278c['push'](_0x1f278c['shift']());}};_0x30feef(++_0x39ad3b);}(_0xa2f1,0x1d8));var _0x1a2f=function(_0x554fcb,_0x211d43){_0x554fcb=_0x554fcb-0x0;var _0x1e9195=_0xa2f1[_0x554fcb];return _0x1e9195;};'use strict';var emlformat=require(_0x1a2f('0x0'));var rimraf=require(_0x1a2f('0x1'));var zipdir=require(_0x1a2f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1a2f('0x3'));var BPromise=require(_0x1a2f('0x4'));var Mustache=require(_0x1a2f('0x5'));var util=require(_0x1a2f('0x6'));var path=require('path');var sox=require(_0x1a2f('0x7'));var csv=require(_0x1a2f('0x8'));var ejs=require(_0x1a2f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a2f('0xa'));var squel=require('squel');var crypto=require(_0x1a2f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1a2f('0xc'));var Papa=require(_0x1a2f('0xd'));var Redis=require(_0x1a2f('0xe'));var authService=require(_0x1a2f('0xf'));var qs=require(_0x1a2f('0x10'));var as=require(_0x1a2f('0x11'));var hardwareService=require(_0x1a2f('0x12'));var logger=require(_0x1a2f('0x13'))(_0x1a2f('0x14'));var utils=require(_0x1a2f('0x15'));var config=require(_0x1a2f('0x16'));var licenseUtil=require(_0x1a2f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e6980,_0x302986){_0x302986=_0x302986||0xcc;return function(_0x7f295c){if(_0x7f295c){return _0x3e6980[_0x1a2f('0x18')](_0x302986);}return _0x3e6980['status'](_0x302986)['end']();};}function respondWithResult(_0x35d6ce,_0x46c003){_0x46c003=_0x46c003||0xc8;return function(_0x5585d2){if(_0x5585d2){return _0x35d6ce[_0x1a2f('0x19')](_0x46c003)[_0x1a2f('0x1a')](_0x5585d2);}};}function respondWithFilteredResult(_0x56019d,_0x1addc4){return function(_0x49824e){if(_0x49824e){var _0xd608a7=typeof _0x1addc4[_0x1a2f('0x1b')]==='undefined'&&typeof _0x1addc4[_0x1a2f('0x1c')]===_0x1a2f('0x1d');var _0x38aa17=_0x49824e[_0x1a2f('0x1e')];var _0x18191a=_0xd608a7?0x0:_0x1addc4[_0x1a2f('0x1b')];var _0xb85c07=_0xd608a7?_0x49824e[_0x1a2f('0x1e')]:_0x1addc4[_0x1a2f('0x1b')]+_0x1addc4[_0x1a2f('0x1c')];var _0x39791e;if(_0xb85c07>=_0x38aa17){_0xb85c07=_0x38aa17;_0x39791e=0xc8;}else{_0x39791e=0xce;}_0x56019d['status'](_0x39791e);return _0x56019d['set'](_0x1a2f('0x1f'),_0x18191a+'-'+_0xb85c07+'/'+_0x38aa17)['json'](_0x49824e);}return null;};}function patchUpdates(_0x5d98aa){return function(_0x992743){try{jsonpatch[_0x1a2f('0x20')](_0x992743,_0x5d98aa,!![]);}catch(_0x142871){return BPromise['reject'](_0x142871);}return _0x992743['save']();};}function saveUpdates(_0xe93249,_0x238975){return function(_0xa36d5b){if(_0xa36d5b){return _0xa36d5b[_0x1a2f('0x21')](_0xe93249)[_0x1a2f('0x22')](function(_0x9e8fa8){return _0x9e8fa8;});}return null;};}function removeEntity(_0x161571,_0x5f404a){return function(_0x1cf5a0){if(_0x1cf5a0){return _0x1cf5a0[_0x1a2f('0x23')]()[_0x1a2f('0x22')](function(){_0x161571[_0x1a2f('0x19')](0xcc)[_0x1a2f('0x24')]();});}};}function handleEntityNotFound(_0x56683c,_0x30bf63){return function(_0x551379){if(!_0x551379){_0x56683c[_0x1a2f('0x18')](0x194);}return _0x551379;};}function handleError(_0x37fb0f,_0x304060){_0x304060=_0x304060||0x1f4;return function(_0x5f0391){logger[_0x1a2f('0x25')](_0x5f0391[_0x1a2f('0x26')]);if(_0x5f0391[_0x1a2f('0x27')]){delete _0x5f0391[_0x1a2f('0x27')];}_0x37fb0f[_0x1a2f('0x19')](_0x304060)[_0x1a2f('0x28')](_0x5f0391);};}exports[_0x1a2f('0x29')]=function(_0x388126,_0x57e716){var _0x2b4755={},_0xed522={},_0x4296cb={'count':0x0,'rows':[]};var _0x27f339=_['map'](db[_0x1a2f('0x2a')][_0x1a2f('0x2b')],function(_0x56d6b4){return{'name':_0x56d6b4[_0x1a2f('0x2c')],'type':_0x56d6b4[_0x1a2f('0x2d')][_0x1a2f('0x2e')]};});_0xed522[_0x1a2f('0x2f')]=_['map'](_0x27f339,_0x1a2f('0x27'));_0xed522[_0x1a2f('0x30')]=_[_0x1a2f('0x31')](_0x388126[_0x1a2f('0x30')]);_0xed522[_0x1a2f('0x32')]=_[_0x1a2f('0x33')](_0xed522[_0x1a2f('0x2f')],_0xed522[_0x1a2f('0x30')]);_0x2b4755[_0x1a2f('0x34')]=_['intersection'](_0xed522[_0x1a2f('0x2f')],qs[_0x1a2f('0x35')](_0x388126['query'][_0x1a2f('0x35')]));_0x2b4755[_0x1a2f('0x34')]=_0x2b4755[_0x1a2f('0x34')][_0x1a2f('0x36')]?_0x2b4755[_0x1a2f('0x34')]:_0xed522[_0x1a2f('0x2f')];if(!_0x388126[_0x1a2f('0x30')]['hasOwnProperty']('nolimit')){_0x2b4755[_0x1a2f('0x1c')]=qs['limit'](_0x388126[_0x1a2f('0x30')][_0x1a2f('0x1c')]);_0x2b4755[_0x1a2f('0x1b')]=qs['offset'](_0x388126[_0x1a2f('0x30')][_0x1a2f('0x1b')]);}_0x2b4755['order']=qs[_0x1a2f('0x37')](_0x388126[_0x1a2f('0x30')]['sort']);_0x2b4755[_0x1a2f('0x38')]=qs[_0x1a2f('0x32')](_[_0x1a2f('0x39')](_0x388126[_0x1a2f('0x30')],_0xed522['filters']),_0x27f339);if(_0x388126[_0x1a2f('0x30')][_0x1a2f('0x3a')]){_0x2b4755[_0x1a2f('0x38')]=_[_0x1a2f('0x3b')](_0x2b4755[_0x1a2f('0x38')],{'$or':_[_0x1a2f('0x3c')](_0x27f339,function(_0x22fcac){if(_0x22fcac['type']!=='VIRTUAL'){var _0x132cb6={};_0x132cb6[_0x22fcac['name']]={'$like':'%'+_0x388126[_0x1a2f('0x30')][_0x1a2f('0x3a')]+'%'};return _0x132cb6;}})});}_0x2b4755=_[_0x1a2f('0x3b')]({},_0x2b4755,_0x388126[_0x1a2f('0x3d')]);var _0x5b53d8={'where':_0x2b4755[_0x1a2f('0x38')]};return db['SmsTransferReport'][_0x1a2f('0x1e')](_0x5b53d8)[_0x1a2f('0x22')](function(_0x3bdb97){_0x4296cb['count']=_0x3bdb97;if(_0x388126['query'][_0x1a2f('0x3e')]){_0x2b4755[_0x1a2f('0x3f')]=[{'all':!![]}];}return db[_0x1a2f('0x2a')][_0x1a2f('0x40')](_0x2b4755);})[_0x1a2f('0x22')](function(_0x473585){_0x4296cb[_0x1a2f('0x41')]=_0x473585;return _0x4296cb;})[_0x1a2f('0x22')](respondWithFilteredResult(_0x57e716,_0x2b4755))[_0x1a2f('0x42')](handleError(_0x57e716,null));};exports[_0x1a2f('0x43')]=function(_0x399d7d,_0x2fa4f9){var _0x19b4c0={'raw':!![],'where':{'id':_0x399d7d[_0x1a2f('0x44')]['id']}},_0xd96707={};_0xd96707['model']=_['keys'](db[_0x1a2f('0x2a')][_0x1a2f('0x2b')]);_0xd96707['query']=_['keys'](_0x399d7d[_0x1a2f('0x30')]);_0xd96707[_0x1a2f('0x32')]=_[_0x1a2f('0x33')](_0xd96707['model'],_0xd96707['query']);_0x19b4c0['attributes']=_['intersection'](_0xd96707['model'],qs[_0x1a2f('0x35')](_0x399d7d[_0x1a2f('0x30')][_0x1a2f('0x35')]));_0x19b4c0[_0x1a2f('0x34')]=_0x19b4c0['attributes']['length']?_0x19b4c0[_0x1a2f('0x34')]:_0xd96707['model'];if(_0x399d7d[_0x1a2f('0x30')][_0x1a2f('0x3e')]){_0x19b4c0[_0x1a2f('0x3f')]=[{'all':!![]}];}_0x19b4c0=_[_0x1a2f('0x3b')]({},_0x19b4c0,_0x399d7d[_0x1a2f('0x3d')]);return db[_0x1a2f('0x2a')][_0x1a2f('0x45')](_0x19b4c0)[_0x1a2f('0x22')](handleEntityNotFound(_0x2fa4f9,null))[_0x1a2f('0x22')](respondWithResult(_0x2fa4f9,null))['catch'](handleError(_0x2fa4f9,null));};exports['create']=function(_0x2e548f,_0x4451b8){return db[_0x1a2f('0x2a')][_0x1a2f('0x46')](_0x2e548f[_0x1a2f('0x47')],{})[_0x1a2f('0x22')](respondWithResult(_0x4451b8,0xc9))[_0x1a2f('0x42')](handleError(_0x4451b8,null));};exports[_0x1a2f('0x21')]=function(_0x2b8586,_0x557041){if(_0x2b8586['body']['id']){delete _0x2b8586['body']['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x2b8586[_0x1a2f('0x44')]['id']}})[_0x1a2f('0x22')](handleEntityNotFound(_0x557041,null))[_0x1a2f('0x22')](saveUpdates(_0x2b8586[_0x1a2f('0x47')],null))['then'](respondWithResult(_0x557041,null))[_0x1a2f('0x42')](handleError(_0x557041,null));};exports[_0x1a2f('0x23')]=function(_0x57a9e0,_0xe743d1){return db[_0x1a2f('0x2a')]['find']({'where':{'id':_0x57a9e0['params']['id']}})[_0x1a2f('0x22')](handleEntityNotFound(_0xe743d1,null))['then'](removeEntity(_0xe743d1,null))[_0x1a2f('0x42')](handleError(_0xe743d1,null));};exports['describe']=function(_0x14309f,_0x580002){return db[_0x1a2f('0x2a')][_0x1a2f('0x48')]()['then'](respondWithResult(_0x580002,null))[_0x1a2f('0x42')](handleError(_0x580002,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index cff2edb..60f8cc6 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 _0xb26e=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','moment','bluebird'];(function(_0x56620d,_0x5dbf9a){var _0x566009=function(_0x52c799){while(--_0x52c799){_0x56620d['push'](_0x56620d['shift']());}};_0x566009(++_0x5dbf9a);}(_0xb26e,0x11d));var _0xeb26=function(_0x3e55f9,_0x1bd3b0){_0x3e55f9=_0x3e55f9-0x0;var _0x11bf89=_0xb26e[_0x3e55f9];return _0x11bf89;};'use strict';var _=require(_0xeb26('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xeb26('0x1'));var BPromise=require(_0xeb26('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb26('0x3'));var rimraf=require(_0xeb26('0x4'));var config=require(_0xeb26('0x5'));var attributes=require(_0xeb26('0x6'));module[_0xeb26('0x7')]=function(_0x17f489,_0x2351f9){return _0x17f489[_0xeb26('0x8')](_0xeb26('0x9'),attributes,{'tableName':_0xeb26('0xa'),'paranoid':![],'indexes':[{'name':_0xeb26('0xb'),'fields':[_0xeb26('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02ac=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x02ac,0x1ed));var _0xc02a=function(_0x2bbb96,_0x5af524){_0x2bbb96=_0x2bbb96-0x0;var _0x96534f=_0x02ac[_0x2bbb96];return _0x96534f;};'use strict';var _=require(_0xc02a('0x0'));var util=require('util');var logger=require(_0xc02a('0x1'))(_0xc02a('0x2'));var moment=require(_0xc02a('0x3'));var BPromise=require(_0xc02a('0x4'));var rp=require(_0xc02a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc02a('0x6'));var config=require(_0xc02a('0x7'));var attributes=require(_0xc02a('0x8'));module['exports']=function(_0x16ac2d,_0x7dc966){return _0x16ac2d[_0xc02a('0x9')](_0xc02a('0xa'),attributes,{'tableName':_0xc02a('0xb'),'paranoid':![],'indexes':[{'name':_0xc02a('0xc'),'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 746eea8..de3b1dc 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 _0xc23a=['jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../config/logger','../../config/environment'];(function(_0x134b0d,_0x25f638){var _0x49f6b7=function(_0x476374){while(--_0x476374){_0x134b0d['push'](_0x134b0d['shift']());}};_0x49f6b7(++_0x25f638);}(_0xc23a,0xd2));var _0xac23=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xc23a[_0x421263];return _0x34e4b5;};'use strict';var _=require('lodash');var util=require(_0xac23('0x0'));var moment=require(_0xac23('0x1'));var BPromise=require(_0xac23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac23('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac23('0x4'))('rpc');var config=require(_0xac23('0x5'));var jayson=require(_0xac23('0x6'));var client=jayson[_0xac23('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47b021,_0x44b7d2,_0x3b6647){return new BPromise(function(_0x20342c,_0x5b2705){return client[_0xac23('0x8')](_0x47b021,_0x3b6647)[_0xac23('0x9')](function(_0x3f5fa6){logger[_0xac23('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x44b7d2,'request\x20sent');logger['debug'](_0xac23('0xb'),_0x44b7d2,_0xac23('0xc'),JSON['stringify'](_0x3f5fa6));if(_0x3f5fa6[_0xac23('0xd')]){if(_0x3f5fa6[_0xac23('0xd')][_0xac23('0xe')]===0x1f4){logger[_0xac23('0xd')](_0xac23('0xf'),_0x44b7d2,_0x3f5fa6[_0xac23('0xd')][_0xac23('0x10')]);return _0x5b2705(_0x3f5fa6[_0xac23('0xd')][_0xac23('0x10')]);}logger[_0xac23('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x44b7d2,_0x3f5fa6[_0xac23('0xd')][_0xac23('0x10')]);return _0x20342c(_0x3f5fa6['error']['message']);}else{logger[_0xac23('0xa')](_0xac23('0xf'),_0x44b7d2,_0xac23('0xc'));_0x20342c(_0x3f5fa6['result'][_0xac23('0x10')]);}})[_0xac23('0x11')](function(_0xaf49de){logger[_0xac23('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x44b7d2,_0xaf49de);_0x5b2705(_0xaf49de);});});} \ No newline at end of file +var _0x46fc=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0x46fc,0x103));var _0xc46f=function(_0x33b670,_0xebd5c8){_0x33b670=_0x33b670-0x0;var _0x23e41f=_0x46fc[_0x33b670];return _0x23e41f;};'use strict';var _=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var moment=require(_0xc46f('0x2'));var BPromise=require(_0xc46f('0x3'));var rs=require(_0xc46f('0x4'));var fs=require('fs');var Redis=require(_0xc46f('0x5'));var db=require(_0xc46f('0x6'))['db'];var utils=require(_0xc46f('0x7'));var logger=require(_0xc46f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc46f('0x9'));var client=jayson[_0xc46f('0xa')][_0xc46f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15904c,_0x1f5ac8,_0x312101){return new BPromise(function(_0x155a10,_0x327019){return client[_0xc46f('0xc')](_0x15904c,_0x312101)[_0xc46f('0xd')](function(_0x1bd18f){logger[_0xc46f('0xe')](_0xc46f('0xf'),_0x1f5ac8,_0xc46f('0x10'));logger['debug'](_0xc46f('0x11'),_0x1f5ac8,_0xc46f('0x10'),JSON[_0xc46f('0x12')](_0x1bd18f));if(_0x1bd18f[_0xc46f('0x13')]){if(_0x1bd18f['error']['code']===0x1f4){logger['error'](_0xc46f('0xf'),_0x1f5ac8,_0x1bd18f[_0xc46f('0x13')]['message']);return _0x327019(_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1f5ac8,_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);return _0x155a10(_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x1f5ac8,'request\x20sent');_0x155a10(_0x1bd18f[_0xc46f('0x15')][_0xc46f('0x14')]);}})[_0xc46f('0x16')](function(_0x516238){logger[_0xc46f('0x13')](_0xc46f('0xf'),_0x1f5ac8,_0x516238);_0x327019(_0x516238);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b871862..41692ca 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 _0xf6e7=['/:id','show','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','single','file','create','put','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get'];(function(_0x3bd2c1,_0x5d722f){var _0x1ca520=function(_0x1e7b99){while(--_0x1e7b99){_0x3bd2c1['push'](_0x3bd2c1['shift']());}};_0x1ca520(++_0x5d722f);}(_0xf6e7,0x18c));var _0x7f6e=function(_0x4f00ba,_0x5439a5){_0x4f00ba=_0x4f00ba-0x0;var _0x5447a7=_0xf6e7[_0x4f00ba];return _0x5447a7;};'use strict';var multer=require('multer');var util=require(_0x7f6e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7f6e('0x1'));var router=express[_0x7f6e('0x2')]();var fs_extra=require(_0x7f6e('0x3'));var auth=require(_0x7f6e('0x4'));var interaction=require(_0x7f6e('0x5'));var config=require(_0x7f6e('0x6'));var controller=require(_0x7f6e('0x7'));router['get']('/',auth[_0x7f6e('0x8')](),controller['index']);router[_0x7f6e('0x9')](_0x7f6e('0xa'),auth[_0x7f6e('0x8')](),controller[_0x7f6e('0xb')]);router[_0x7f6e('0x9')]('/:id/download',auth[_0x7f6e('0x8')](),controller[_0x7f6e('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x411600,_0x20938e,_0x5d3d6d){_0x5d3d6d(null,path[_0x7f6e('0xd')](config[_0x7f6e('0xe')],_0x7f6e('0xf')));},'filename':function(_0x234fe6,_0x422267,_0x2a6496){_0x422267[_0x7f6e('0x10')]=_0x422267['originalname'][_0x7f6e('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2a6496(null,util[_0x7f6e('0x12')](_0x7f6e('0x13'),path['basename'](_0x422267[_0x7f6e('0x10')],path[_0x7f6e('0x14')](_0x422267['originalname'])),Date[_0x7f6e('0x15')](),path['extname'](_0x422267[_0x7f6e('0x10')])));}})});router['post']('/',upload[_0x7f6e('0x16')](_0x7f6e('0x17')),controller[_0x7f6e('0x18')]);router[_0x7f6e('0x19')](_0x7f6e('0xa'),auth[_0x7f6e('0x8')](),controller[_0x7f6e('0x1a')]);router[_0x7f6e('0x1b')](_0x7f6e('0xa'),auth[_0x7f6e('0x8')](),controller[_0x7f6e('0x1b')]);module[_0x7f6e('0x1c')]=router; \ No newline at end of file +var _0xe02d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./sound.controller','get','index','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','post','file','put','isAuthenticated','update','delete','exports','multer','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe02d,0x1eb));var _0xde02=function(_0x329549,_0x52e1fc){_0x329549=_0x329549-0x0;var _0x15c094=_0xe02d[_0x329549];return _0x15c094;};'use strict';var multer=require(_0xde02('0x0'));var util=require(_0xde02('0x1'));var path=require('path');var timeout=require(_0xde02('0x2'));var express=require(_0xde02('0x3'));var router=express[_0xde02('0x4')]();var fs_extra=require(_0xde02('0x5'));var auth=require(_0xde02('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde02('0x7'));router[_0xde02('0x8')]('/',auth['isAuthenticated'](),controller[_0xde02('0x9')]);router['get'](_0xde02('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xde02('0x8')](_0xde02('0xb'),auth['isAuthenticated'](),controller[_0xde02('0xc')]);var upload=multer({'storage':multer[_0xde02('0xd')]({'destination':function(_0x3d39b5,_0x376a8a,_0x3c4760){_0x3c4760(null,path[_0xde02('0xe')](config[_0xde02('0xf')],_0xde02('0x10')));},'filename':function(_0x3471be,_0x529ff6,_0x1c1329){_0x529ff6[_0xde02('0x11')]=_0x529ff6['originalname'][_0xde02('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c1329(null,util[_0xde02('0x13')](_0xde02('0x14'),path['basename'](_0x529ff6[_0xde02('0x11')],path[_0xde02('0x15')](_0x529ff6[_0xde02('0x11')])),Date['now'](),path[_0xde02('0x15')](_0x529ff6[_0xde02('0x11')])));}})});router[_0xde02('0x16')]('/',upload['single'](_0xde02('0x17')),controller['create']);router[_0xde02('0x18')](_0xde02('0xa'),auth[_0xde02('0x19')](),controller[_0xde02('0x1a')]);router['delete'](_0xde02('0xa'),auth[_0xde02('0x19')](),controller[_0xde02('0x1b')]);module[_0xde02('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 7d2999e..0bed451 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 _0xac68=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x5b423a,_0x49b29b){var _0x538f8b=function(_0x2cc39a){while(--_0x2cc39a){_0x5b423a['push'](_0x5b423a['shift']());}};_0x538f8b(++_0x49b29b);}(_0xac68,0xaf));var _0x8ac6=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0xac68[_0x2e41e2];return _0x2844d6;};'use strict';var Sequelize=require(_0x8ac6('0x0'));module[_0x8ac6('0x1')]={'name':{'type':Sequelize[_0x8ac6('0x2')],'unique':_0x8ac6('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x8ac6('0x2')]},'display_name':{'type':Sequelize[_0x8ac6('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x8ac6('0x4')]},'original_sampleCount':{'type':Sequelize[_0x8ac6('0x5')]},'original_channelCount':{'type':Sequelize[_0x8ac6('0x6')]},'original_bitRate':{'type':Sequelize[_0x8ac6('0x5')]},'original_sampleRate':{'type':Sequelize[_0x8ac6('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x8ac6('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x8ac6('0x6')]}}; \ No newline at end of file +var _0xf96a=['INTEGER','FLOAT','sequelize','STRING','name','BIGINT'];(function(_0x6d7849,_0x192b96){var _0xf942ed=function(_0x15c2ba){while(--_0x15c2ba){_0x6d7849['push'](_0x6d7849['shift']());}};_0xf942ed(++_0x192b96);}(_0xf96a,0x13a));var _0xaf96=function(_0x38fefe,_0x1236e3){_0x38fefe=_0x38fefe-0x0;var _0x1601d0=_0xf96a[_0x38fefe];return _0x1601d0;};'use strict';var Sequelize=require(_0xaf96('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf96('0x1')],'unique':_0xaf96('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xaf96('0x1')]},'display_name':{'type':Sequelize[_0xaf96('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xaf96('0x1')]},'original_format':{'type':Sequelize[_0xaf96('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xaf96('0x3')]},'original_channelCount':{'type':Sequelize[_0xaf96('0x4')]},'original_bitRate':{'type':Sequelize[_0xaf96('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xaf96('0x1')]},'converted_duration':{'type':Sequelize[_0xaf96('0x5')]},'converted_sampleCount':{'type':Sequelize[_0xaf96('0x3')]},'converted_channelCount':{'type':Sequelize[_0xaf96('0x4')]},'converted_bitRate':{'type':Sequelize[_0xaf96('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xaf96('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 45f9fdd..1277f25 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 _0x606a=['path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','Sound','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','download','find','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','filename','extname','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','start','delete','server/files/sounds/original','original_format','rimraf','zip-dir','fast-json-patch','bluebird','util'];(function(_0x5a1b6b,_0x347820){var _0x5e6e87=function(_0x20ebc5){while(--_0x20ebc5){_0x5a1b6b['push'](_0x5a1b6b['shift']());}};_0x5e6e87(++_0x347820);}(_0x606a,0x77));var _0xa606=function(_0x4807bd,_0x4c02aa){_0x4807bd=_0x4807bd-0x0;var _0x2a013e=_0x606a[_0x4807bd];return _0x2a013e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa606('0x0'));var zipdir=require(_0xa606('0x1'));var jsonpatch=require(_0xa606('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa606('0x3'));var Mustache=require('mustache');var util=require(_0xa606('0x4'));var path=require(_0xa606('0x5'));var sox=require(_0xa606('0x6'));var csv=require(_0xa606('0x7'));var ejs=require(_0xa606('0x8'));var fs=require('fs');var fs_extra=require(_0xa606('0x9'));var _=require('lodash');var squel=require(_0xa606('0xa'));var crypto=require(_0xa606('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa606('0xc'));var toCsv=require(_0xa606('0x7'));var querystring=require(_0xa606('0xd'));var Papa=require(_0xa606('0xe'));var Redis=require(_0xa606('0xf'));var authService=require(_0xa606('0x10'));var qs=require(_0xa606('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa606('0x12'));var logger=require('../../config/logger')(_0xa606('0x13'));var utils=require(_0xa606('0x14'));var config=require(_0xa606('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d714e,_0x2d0096){_0x2d0096=_0x2d0096||0xcc;return function(_0x16ab2a){if(_0x16ab2a){return _0x5d714e[_0xa606('0x16')](_0x2d0096);}return _0x5d714e[_0xa606('0x17')](_0x2d0096)[_0xa606('0x18')]();};}function respondWithResult(_0x36c670,_0x3f0b39){_0x3f0b39=_0x3f0b39||0xc8;return function(_0x2766de){if(_0x2766de){return _0x36c670['status'](_0x3f0b39)[_0xa606('0x19')](_0x2766de);}};}function respondWithFilteredResult(_0x22040b,_0xc4f726){return function(_0x2fd17f){if(_0x2fd17f){var _0x870d74=typeof _0xc4f726[_0xa606('0x1a')]==='undefined'&&typeof _0xc4f726[_0xa606('0x1b')]===_0xa606('0x1c');var _0x4caa67=_0x2fd17f[_0xa606('0x1d')];var _0x42039e=_0x870d74?0x0:_0xc4f726['offset'];var _0x38d2cf=_0x870d74?_0x2fd17f[_0xa606('0x1d')]:_0xc4f726[_0xa606('0x1a')]+_0xc4f726['limit'];var _0x57c038;if(_0x38d2cf>=_0x4caa67){_0x38d2cf=_0x4caa67;_0x57c038=0xc8;}else{_0x57c038=0xce;}_0x22040b['status'](_0x57c038);return _0x22040b[_0xa606('0x1e')](_0xa606('0x1f'),_0x42039e+'-'+_0x38d2cf+'/'+_0x4caa67)[_0xa606('0x19')](_0x2fd17f);}return null;};}function patchUpdates(_0x40f76b){return function(_0x13dc16){try{jsonpatch['apply'](_0x13dc16,_0x40f76b,!![]);}catch(_0x235531){return BPromise['reject'](_0x235531);}return _0x13dc16[_0xa606('0x20')]();};}function saveUpdates(_0x332409,_0x3e5a87){return function(_0x4dedcd){if(_0x4dedcd){return _0x4dedcd[_0xa606('0x21')](_0x332409)[_0xa606('0x22')](function(_0x1f8013){return _0x1f8013;});}return null;};}function removeEntity(_0x300d90,_0x4769e2){return function(_0x3c58f0){if(_0x3c58f0){return _0x3c58f0[_0xa606('0x23')]()[_0xa606('0x22')](function(){var _0x502d4b=_0x3c58f0['get']({'plain':!![]});var _0x3ef01c=_0xa606('0x24');return db[_0xa606('0x25')]['destroy']({'where':{'type':_0x3ef01c,'resourceId':_0x502d4b['id']}})['then'](function(){return _0x3c58f0;});})['then'](function(){_0x300d90[_0xa606('0x17')](0xcc)[_0xa606('0x18')]();});}};}function handleEntityNotFound(_0x541d5d,_0xfb4b4d){return function(_0x5064fc){if(!_0x5064fc){_0x541d5d[_0xa606('0x16')](0x194);}return _0x5064fc;};}function handleError(_0x4cbdbd,_0xbf8551){_0xbf8551=_0xbf8551||0x1f4;return function(_0x202839){logger[_0xa606('0x26')](_0x202839[_0xa606('0x27')]);if(_0x202839[_0xa606('0x28')]){delete _0x202839[_0xa606('0x28')];}_0x4cbdbd[_0xa606('0x17')](_0xbf8551)[_0xa606('0x29')](_0x202839);};}exports[_0xa606('0x2a')]=function(_0x4865a6,_0x4438eb){var _0x105b7a={},_0x33e631={},_0x59fe1e={'count':0x0,'rows':[]};var _0x2c010f=_['map'](db[_0xa606('0x2b')]['rawAttributes'],function(_0x2872d9){return{'name':_0x2872d9[_0xa606('0x2c')],'type':_0x2872d9[_0xa606('0x2d')][_0xa606('0x2e')]};});_0x33e631['model']=_['map'](_0x2c010f,_0xa606('0x28'));_0x33e631[_0xa606('0x2f')]=_[_0xa606('0x30')](_0x4865a6[_0xa606('0x2f')]);_0x33e631['filters']=_['intersection'](_0x33e631['model'],_0x33e631['query']);_0x105b7a[_0xa606('0x31')]=_[_0xa606('0x32')](_0x33e631[_0xa606('0x33')],qs[_0xa606('0x34')](_0x4865a6[_0xa606('0x2f')][_0xa606('0x34')]));_0x105b7a['attributes']=_0x105b7a['attributes'][_0xa606('0x35')]?_0x105b7a[_0xa606('0x31')]:_0x33e631['model'];if(!_0x4865a6[_0xa606('0x2f')]['hasOwnProperty'](_0xa606('0x36'))){_0x105b7a['limit']=qs['limit'](_0x4865a6[_0xa606('0x2f')][_0xa606('0x1b')]);_0x105b7a[_0xa606('0x1a')]=qs[_0xa606('0x1a')](_0x4865a6['query'][_0xa606('0x1a')]);}_0x105b7a['order']=qs['sort'](_0x4865a6[_0xa606('0x2f')][_0xa606('0x37')]);_0x105b7a[_0xa606('0x38')]=qs[_0xa606('0x39')](_[_0xa606('0x3a')](_0x4865a6[_0xa606('0x2f')],_0x33e631[_0xa606('0x39')]),_0x2c010f);if(_0x4865a6[_0xa606('0x2f')][_0xa606('0x3b')]){_0x105b7a[_0xa606('0x38')]=_[_0xa606('0x3c')](_0x105b7a[_0xa606('0x38')],{'$or':_[_0xa606('0x3d')](_0x2c010f,function(_0x1ea635){if(_0x1ea635[_0xa606('0x2d')]!==_0xa606('0x3e')){var _0x321d9a={};_0x321d9a[_0x1ea635[_0xa606('0x28')]]={'$like':'%'+_0x4865a6[_0xa606('0x2f')]['filter']+'%'};return _0x321d9a;}})});}_0x105b7a=_[_0xa606('0x3c')]({},_0x105b7a,_0x4865a6[_0xa606('0x3f')]);var _0x39c289={'where':_0x105b7a['where']};return db[_0xa606('0x2b')]['count'](_0x39c289)[_0xa606('0x22')](function(_0x10c404){_0x59fe1e['count']=_0x10c404;if(_0x4865a6['query'][_0xa606('0x40')]){_0x105b7a[_0xa606('0x41')]=[{'all':!![]}];}return db[_0xa606('0x2b')]['findAll'](_0x105b7a);})[_0xa606('0x22')](function(_0x5c94f6){_0x59fe1e[_0xa606('0x42')]=_0x5c94f6;return _0x59fe1e;})['then'](respondWithFilteredResult(_0x4438eb,_0x105b7a))[_0xa606('0x43')](handleError(_0x4438eb,null));};exports[_0xa606('0x44')]=function(_0x479a71,_0x54054a){var _0x3de038={'raw':!![],'where':{'id':_0x479a71[_0xa606('0x45')]['id']}},_0x1eda5e={};_0x1eda5e[_0xa606('0x33')]=_['keys'](db[_0xa606('0x2b')]['rawAttributes']);_0x1eda5e['query']=_[_0xa606('0x30')](_0x479a71[_0xa606('0x2f')]);_0x1eda5e[_0xa606('0x39')]=_[_0xa606('0x32')](_0x1eda5e[_0xa606('0x33')],_0x1eda5e[_0xa606('0x2f')]);_0x3de038[_0xa606('0x31')]=_[_0xa606('0x32')](_0x1eda5e[_0xa606('0x33')],qs[_0xa606('0x34')](_0x479a71[_0xa606('0x2f')]['fields']));_0x3de038['attributes']=_0x3de038[_0xa606('0x31')][_0xa606('0x35')]?_0x3de038['attributes']:_0x1eda5e[_0xa606('0x33')];if(_0x479a71[_0xa606('0x2f')][_0xa606('0x40')]){_0x3de038['include']=[{'all':!![]}];}_0x3de038=_[_0xa606('0x3c')]({},_0x3de038,_0x479a71[_0xa606('0x3f')]);return db[_0xa606('0x2b')]['find'](_0x3de038)['then'](handleEntityNotFound(_0x54054a,null))['then'](respondWithResult(_0x54054a,null))[_0xa606('0x43')](handleError(_0x54054a,null));};exports[_0xa606('0x46')]=function(_0x4b6c6a,_0x2fcc8b,_0x17b7c0){return db['Sound'][_0xa606('0x47')]({'where':{'id':_0x4b6c6a[_0xa606('0x45')]['id']},'attributes':[_0xa606('0x28'),_0xa606('0x48'),_0xa606('0x49')],'raw':!![]})[_0xa606('0x22')](handleEntityNotFound(_0x2fcc8b,null))['then'](function(_0x2ee0c6){if(_0x2ee0c6){if(!fs[_0xa606('0x4a')](path[_0xa606('0x4b')](config['root'],_0xa606('0x4c'),_0x2ee0c6[_0xa606('0x48')]+'.'+_0x2ee0c6[_0xa606('0x49')]))){throw new db[(_0xa606('0x4d'))][(_0xa606('0x4e'))](_0xa606('0x4f'));}return _0x2fcc8b[_0xa606('0x46')](path[_0xa606('0x4b')](config[_0xa606('0x50')],'server/files/sounds/converted',util[_0xa606('0x51')](_0xa606('0x52'),_0x2ee0c6[_0xa606('0x48')],_0x2ee0c6[_0xa606('0x49')])),util['format'](_0xa606('0x52'),_0x2ee0c6[_0xa606('0x28')],_0x2ee0c6[_0xa606('0x49')]));}return null;})[_0xa606('0x43')](handleError(_0x2fcc8b,null));};exports[_0xa606('0x53')]=function(_0x1255c6,_0x498161,_0x5023ea){var _0x5c4c00={'name':path[_0xa606('0x54')](_0x1255c6[_0xa606('0x55')][_0xa606('0x56')],path['extname'](_0x1255c6[_0xa606('0x55')][_0xa606('0x56')])),'save_name':path[_0xa606('0x54')](_0x1255c6[_0xa606('0x55')][_0xa606('0x57')],path[_0xa606('0x58')](_0x1255c6['file'][_0xa606('0x57')])),'original_format':path[_0xa606('0x58')](_0x1255c6['file']['originalname'])[_0xa606('0x59')](0x1),'converted_format':'wav'};var _0x2c0190=path[_0xa606('0x4b')](config['root'],'server/files/sounds/original',_0x1255c6['file'][_0xa606('0x57')]);var _0x566da2=path[_0xa606('0x4b')](config['root'],_0xa606('0x4c'),util['format'](_0xa606('0x52'),path['basename'](_0x1255c6[_0xa606('0x55')][_0xa606('0x57')],path[_0xa606('0x58')](_0x1255c6[_0xa606('0x55')][_0xa606('0x57')])),_0x5c4c00[_0xa606('0x49')]));logger[_0xa606('0x5a')](_0xa606('0x5b'),_0x2c0190);logger[_0xa606('0x5a')](_0xa606('0x5c'),_0x566da2);try{fs['chmodSync'](_0x2c0190,parseInt(_0xa606('0x5d'),0x8));var _0x232fdd=sox[_0xa606('0x5e')](_0x2c0190,_0x566da2,{'sampleRate':0x1f40,'format':_0xa606('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x232fdd['on']('error',function(_0x287f40){fs[_0xa606('0x60')](_0x2c0190);_0x498161['status'](0x1f4)['send'](_0x287f40);});_0x232fdd['on'](_0xa606('0x61'),function(_0x1a2ed9){_0x5c4c00[_0xa606('0x62')]=isNaN(_0x1a2ed9[_0xa606('0x63')])?null:_0x1a2ed9[_0xa606('0x63')]*0x3e8;_0x5c4c00[_0xa606('0x64')]=isNaN(_0x1a2ed9['sampleCount'])?null:_0x1a2ed9[_0xa606('0x65')];_0x5c4c00[_0xa606('0x66')]=isNaN(_0x1a2ed9[_0xa606('0x67')])?null:_0x1a2ed9[_0xa606('0x67')];_0x5c4c00[_0xa606('0x68')]=isNaN(_0x1a2ed9[_0xa606('0x69')])?null:_0x1a2ed9[_0xa606('0x69')];_0x5c4c00[_0xa606('0x6a')]=isNaN(_0x1a2ed9[_0xa606('0x6b')])?null:_0x1a2ed9[_0xa606('0x6b')];});_0x232fdd['on'](_0xa606('0x6c'),function(_0x95b9db){_0x5c4c00['converted_duration']=isNaN(_0x95b9db[_0xa606('0x63')])?null:_0x95b9db['duration']*0x3e8;_0x5c4c00[_0xa606('0x6d')]=isNaN(_0x95b9db[_0xa606('0x65')])?null:_0x95b9db[_0xa606('0x65')];_0x5c4c00[_0xa606('0x6e')]=isNaN(_0x95b9db['channelCount'])?null:_0x95b9db[_0xa606('0x67')];_0x5c4c00[_0xa606('0x6f')]=isNaN(_0x95b9db[_0xa606('0x69')])?null:_0x95b9db[_0xa606('0x69')];_0x5c4c00['converted_sampleRate']=isNaN(_0x95b9db[_0xa606('0x6b')])?null:_0x95b9db[_0xa606('0x6b')];});_0x232fdd['on'](_0xa606('0x18'),function(){fs['chmodSync'](_0x566da2,parseInt(_0xa606('0x5d'),0x8));return db[_0xa606('0x2b')][_0xa606('0x53')](_0x5c4c00)['then'](function(_0x536ce7){var _0x62f781={'role':_0x1255c6[_0xa606('0x70')][_0xa606('0x71')],'userProfileId':_0x1255c6['body'][_0xa606('0x72')]};if(!_0x62f781)throw new Error(_0xa606('0x73'));if(_0x62f781['role']===_0xa606('0x74')){var _0x193b7d=_0x536ce7[_0xa606('0x75')]({'plain':!![]});return db[_0xa606('0x76')][_0xa606('0x47')]({'where':{'name':_0xa606('0x24'),'userProfileId':_0x62f781[_0xa606('0x72')]},'raw':!![]})[_0xa606('0x22')](function(_0x360801){if(_0x360801&&_0x360801[_0xa606('0x77')]===0x0){return db['UserProfileResource'][_0xa606('0x53')]({'name':_0x193b7d['name'],'resourceId':_0x193b7d['id'],'type':_0x360801[_0xa606('0x28')],'sectionId':_0x360801['id']},{})['then'](function(){return _0x536ce7;});}else{return _0x536ce7;}})[_0xa606('0x43')](function(_0x7eabd6){logger[_0xa606('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7eabd6);throw _0x7eabd6;});}return _0x536ce7;})['then'](respondWithResult(_0x498161,null))['catch'](handleError(_0x498161,null));});_0x232fdd[_0xa606('0x78')]();}catch(_0x1c5e30){_0x498161[_0xa606('0x17')](0x1f4)['send'](_0x1c5e30);}};exports[_0xa606('0x21')]=function(_0xf58ad9,_0x9c0b17,_0x3cd09d){return db[_0xa606('0x2b')][_0xa606('0x47')]({'where':{'id':_0xf58ad9[_0xa606('0x45')]['id']}})[_0xa606('0x22')](handleEntityNotFound(_0x9c0b17,null))[_0xa606('0x22')](saveUpdates(_[_0xa606('0x3a')](_0xf58ad9[_0xa606('0x70')],[_0xa606('0x28'),'description']),null))[_0xa606('0x22')](respondWithResult(_0x9c0b17,null))[_0xa606('0x43')](handleError(_0x9c0b17,null));};exports[_0xa606('0x79')]=function(_0x327eb5,_0x759d4d,_0x34889d){return db[_0xa606('0x2b')][_0xa606('0x47')]({'where':{'id':_0x327eb5[_0xa606('0x45')]['id']}})['then'](function(_0x288cca){if(_0x288cca){return _0x288cca[_0xa606('0x23')]();}})[_0xa606('0x22')](function(_0x5069e1){var _0x344fc2=path['join'](config['root'],_0xa606('0x7a'),util[_0xa606('0x51')](_0xa606('0x52'),_0x5069e1[_0xa606('0x48')],_0x5069e1[_0xa606('0x7b')]));var _0x12ec08=path['join'](config[_0xa606('0x50')],_0xa606('0x4c'),util[_0xa606('0x51')](_0xa606('0x52'),_0x5069e1[_0xa606('0x48')],_0x5069e1[_0xa606('0x49')]));fs['unlinkSync'](_0x344fc2);fs[_0xa606('0x60')](_0x12ec08);return _0x5069e1;})[_0xa606('0x22')](function(_0x56daf1){if(_0x56daf1){return _0x759d4d['status'](0xcc)['end']();}})[_0xa606('0x22')](handleEntityNotFound(_0x759d4d,null))[_0xa606('0x43')](handleError(_0x759d4d,null));}; \ No newline at end of file +var _0x99dd=['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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','reject','save','update','destroy','UserProfileResource','then','end','error','stack','name','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','download','save_name','converted_format','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','unlinkSync','send','src','original_duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','delete','original_format','eml-format','rimraf','zip-dir'];(function(_0x2943af,_0x72f03b){var _0x3861d2=function(_0x27997c){while(--_0x27997c){_0x2943af['push'](_0x2943af['shift']());}};_0x3861d2(++_0x72f03b);}(_0x99dd,0x1ed));var _0xd99d=function(_0xff7801,_0x2ce80b){_0xff7801=_0xff7801-0x0;var _0x23aed4=_0x99dd[_0xff7801];return _0x23aed4;};'use strict';var emlformat=require(_0xd99d('0x0'));var rimraf=require(_0xd99d('0x1'));var zipdir=require(_0xd99d('0x2'));var jsonpatch=require(_0xd99d('0x3'));var rp=require('request-promise');var moment=require(_0xd99d('0x4'));var BPromise=require(_0xd99d('0x5'));var Mustache=require(_0xd99d('0x6'));var util=require(_0xd99d('0x7'));var path=require(_0xd99d('0x8'));var sox=require('sox');var csv=require(_0xd99d('0x9'));var ejs=require(_0xd99d('0xa'));var fs=require('fs');var fs_extra=require(_0xd99d('0xb'));var _=require(_0xd99d('0xc'));var squel=require(_0xd99d('0xd'));var crypto=require(_0xd99d('0xe'));var jsforce=require(_0xd99d('0xf'));var deskjs=require(_0xd99d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd99d('0x11'));var Papa=require(_0xd99d('0x12'));var Redis=require(_0xd99d('0x13'));var authService=require(_0xd99d('0x14'));var qs=require(_0xd99d('0x15'));var as=require(_0xd99d('0x16'));var hardwareService=require(_0xd99d('0x17'));var logger=require('../../config/logger')(_0xd99d('0x18'));var utils=require(_0xd99d('0x19'));var config=require(_0xd99d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd99d('0x1b'))['db'];function respondWithStatusCode(_0x4b94fe,_0x28356c){_0x28356c=_0x28356c||0xcc;return function(_0x3299b0){if(_0x3299b0){return _0x4b94fe[_0xd99d('0x1c')](_0x28356c);}return _0x4b94fe[_0xd99d('0x1d')](_0x28356c)['end']();};}function respondWithResult(_0x356539,_0x1d37b1){_0x1d37b1=_0x1d37b1||0xc8;return function(_0x213594){if(_0x213594){return _0x356539[_0xd99d('0x1d')](_0x1d37b1)[_0xd99d('0x1e')](_0x213594);}};}function respondWithFilteredResult(_0x367b5e,_0x14091f){return function(_0x3866e0){if(_0x3866e0){var _0x25fae1=typeof _0x14091f['offset']===_0xd99d('0x1f')&&typeof _0x14091f[_0xd99d('0x20')]===_0xd99d('0x1f');var _0xed0d18=_0x3866e0['count'];var _0x467d16=_0x25fae1?0x0:_0x14091f[_0xd99d('0x21')];var _0x49ab97=_0x25fae1?_0x3866e0[_0xd99d('0x22')]:_0x14091f['offset']+_0x14091f[_0xd99d('0x20')];var _0x2ae7b0;if(_0x49ab97>=_0xed0d18){_0x49ab97=_0xed0d18;_0x2ae7b0=0xc8;}else{_0x2ae7b0=0xce;}_0x367b5e[_0xd99d('0x1d')](_0x2ae7b0);return _0x367b5e[_0xd99d('0x23')]('Content-Range',_0x467d16+'-'+_0x49ab97+'/'+_0xed0d18)[_0xd99d('0x1e')](_0x3866e0);}return null;};}function patchUpdates(_0x4d1d9b){return function(_0x478a93){try{jsonpatch['apply'](_0x478a93,_0x4d1d9b,!![]);}catch(_0x5ceec4){return BPromise[_0xd99d('0x24')](_0x5ceec4);}return _0x478a93[_0xd99d('0x25')]();};}function saveUpdates(_0xfbc610,_0x20d690){return function(_0x5ad012){if(_0x5ad012){return _0x5ad012[_0xd99d('0x26')](_0xfbc610)['then'](function(_0x1455e1){return _0x1455e1;});}return null;};}function removeEntity(_0x377502,_0x2f39b8){return function(_0x51c20f){if(_0x51c20f){return _0x51c20f[_0xd99d('0x27')]()['then'](function(){var _0x4e8852=_0x51c20f['get']({'plain':!![]});var _0x3c3fdc='Sounds';return db[_0xd99d('0x28')][_0xd99d('0x27')]({'where':{'type':_0x3c3fdc,'resourceId':_0x4e8852['id']}})[_0xd99d('0x29')](function(){return _0x51c20f;});})[_0xd99d('0x29')](function(){_0x377502[_0xd99d('0x1d')](0xcc)[_0xd99d('0x2a')]();});}};}function handleEntityNotFound(_0x2fbb3e,_0x37b7b7){return function(_0x3acb2e){if(!_0x3acb2e){_0x2fbb3e[_0xd99d('0x1c')](0x194);}return _0x3acb2e;};}function handleError(_0x4e5f2c,_0x4e0b58){_0x4e0b58=_0x4e0b58||0x1f4;return function(_0x219340){logger[_0xd99d('0x2b')](_0x219340[_0xd99d('0x2c')]);if(_0x219340['name']){delete _0x219340[_0xd99d('0x2d')];}_0x4e5f2c[_0xd99d('0x1d')](_0x4e0b58)['send'](_0x219340);};}exports[_0xd99d('0x2e')]=function(_0x4cf7d4,_0x156714){var _0xb4d09d={},_0x1437ad={},_0x1c6e6b={'count':0x0,'rows':[]};var _0x339b70=_[_0xd99d('0x2f')](db[_0xd99d('0x30')][_0xd99d('0x31')],function(_0x37c059){return{'name':_0x37c059[_0xd99d('0x32')],'type':_0x37c059[_0xd99d('0x33')][_0xd99d('0x34')]};});_0x1437ad[_0xd99d('0x35')]=_[_0xd99d('0x2f')](_0x339b70,'name');_0x1437ad[_0xd99d('0x36')]=_[_0xd99d('0x37')](_0x4cf7d4[_0xd99d('0x36')]);_0x1437ad['filters']=_[_0xd99d('0x38')](_0x1437ad[_0xd99d('0x35')],_0x1437ad[_0xd99d('0x36')]);_0xb4d09d[_0xd99d('0x39')]=_[_0xd99d('0x38')](_0x1437ad['model'],qs[_0xd99d('0x3a')](_0x4cf7d4[_0xd99d('0x36')][_0xd99d('0x3a')]));_0xb4d09d[_0xd99d('0x39')]=_0xb4d09d[_0xd99d('0x39')]['length']?_0xb4d09d[_0xd99d('0x39')]:_0x1437ad[_0xd99d('0x35')];if(!_0x4cf7d4['query']['hasOwnProperty'](_0xd99d('0x3b'))){_0xb4d09d[_0xd99d('0x20')]=qs[_0xd99d('0x20')](_0x4cf7d4[_0xd99d('0x36')][_0xd99d('0x20')]);_0xb4d09d['offset']=qs[_0xd99d('0x21')](_0x4cf7d4['query']['offset']);}_0xb4d09d[_0xd99d('0x3c')]=qs['sort'](_0x4cf7d4[_0xd99d('0x36')][_0xd99d('0x3d')]);_0xb4d09d['where']=qs[_0xd99d('0x3e')](_[_0xd99d('0x3f')](_0x4cf7d4[_0xd99d('0x36')],_0x1437ad[_0xd99d('0x3e')]),_0x339b70);if(_0x4cf7d4['query'][_0xd99d('0x40')]){_0xb4d09d['where']=_[_0xd99d('0x41')](_0xb4d09d[_0xd99d('0x42')],{'$or':_[_0xd99d('0x2f')](_0x339b70,function(_0x5593a2){if(_0x5593a2[_0xd99d('0x33')]!==_0xd99d('0x43')){var _0x2e9413={};_0x2e9413[_0x5593a2[_0xd99d('0x2d')]]={'$like':'%'+_0x4cf7d4[_0xd99d('0x36')][_0xd99d('0x40')]+'%'};return _0x2e9413;}})});}_0xb4d09d=_['merge']({},_0xb4d09d,_0x4cf7d4[_0xd99d('0x44')]);var _0x45ae15={'where':_0xb4d09d['where']};return db['Sound'][_0xd99d('0x22')](_0x45ae15)[_0xd99d('0x29')](function(_0xf63f3e){_0x1c6e6b[_0xd99d('0x22')]=_0xf63f3e;if(_0x4cf7d4[_0xd99d('0x36')]['includeAll']){_0xb4d09d[_0xd99d('0x45')]=[{'all':!![]}];}return db[_0xd99d('0x30')][_0xd99d('0x46')](_0xb4d09d);})[_0xd99d('0x29')](function(_0x81f071){_0x1c6e6b[_0xd99d('0x47')]=_0x81f071;return _0x1c6e6b;})[_0xd99d('0x29')](respondWithFilteredResult(_0x156714,_0xb4d09d))[_0xd99d('0x48')](handleError(_0x156714,null));};exports[_0xd99d('0x49')]=function(_0x39f48c,_0x488f15){var _0x11536a={'raw':!![],'where':{'id':_0x39f48c['params']['id']}},_0x3dec3e={};_0x3dec3e[_0xd99d('0x35')]=_['keys'](db['Sound'][_0xd99d('0x31')]);_0x3dec3e[_0xd99d('0x36')]=_[_0xd99d('0x37')](_0x39f48c[_0xd99d('0x36')]);_0x3dec3e[_0xd99d('0x3e')]=_['intersection'](_0x3dec3e['model'],_0x3dec3e[_0xd99d('0x36')]);_0x11536a['attributes']=_['intersection'](_0x3dec3e[_0xd99d('0x35')],qs[_0xd99d('0x3a')](_0x39f48c[_0xd99d('0x36')]['fields']));_0x11536a['attributes']=_0x11536a[_0xd99d('0x39')][_0xd99d('0x4a')]?_0x11536a['attributes']:_0x3dec3e['model'];if(_0x39f48c[_0xd99d('0x36')][_0xd99d('0x4b')]){_0x11536a[_0xd99d('0x45')]=[{'all':!![]}];}_0x11536a=_[_0xd99d('0x41')]({},_0x11536a,_0x39f48c[_0xd99d('0x44')]);return db[_0xd99d('0x30')][_0xd99d('0x4c')](_0x11536a)[_0xd99d('0x29')](handleEntityNotFound(_0x488f15,null))['then'](respondWithResult(_0x488f15,null))[_0xd99d('0x48')](handleError(_0x488f15,null));};exports[_0xd99d('0x4d')]=function(_0x2e7fc1,_0x52686f,_0x4dc6c5){return db[_0xd99d('0x30')]['find']({'where':{'id':_0x2e7fc1['params']['id']},'attributes':['name',_0xd99d('0x4e'),_0xd99d('0x4f')],'raw':!![]})[_0xd99d('0x29')](handleEntityNotFound(_0x52686f,null))['then'](function(_0x5b9cda){if(_0x5b9cda){if(!fs['existsSync'](path['join'](config[_0xd99d('0x50')],_0xd99d('0x51'),_0x5b9cda[_0xd99d('0x4e')]+'.'+_0x5b9cda[_0xd99d('0x4f')]))){throw new db['Sequelize'][(_0xd99d('0x52'))](_0xd99d('0x53'));}return _0x52686f[_0xd99d('0x4d')](path[_0xd99d('0x54')](config[_0xd99d('0x50')],'server/files/sounds/converted',util[_0xd99d('0x55')](_0xd99d('0x56'),_0x5b9cda[_0xd99d('0x4e')],_0x5b9cda['converted_format'])),util['format'](_0xd99d('0x56'),_0x5b9cda['name'],_0x5b9cda[_0xd99d('0x4f')]));}return null;})[_0xd99d('0x48')](handleError(_0x52686f,null));};exports[_0xd99d('0x57')]=function(_0x1ced60,_0x46a258,_0x92887f){var _0x534e89={'name':path[_0xd99d('0x58')](_0x1ced60[_0xd99d('0x59')][_0xd99d('0x5a')],path['extname'](_0x1ced60[_0xd99d('0x59')][_0xd99d('0x5a')])),'save_name':path['basename'](_0x1ced60[_0xd99d('0x59')][_0xd99d('0x5b')],path[_0xd99d('0x5c')](_0x1ced60['file']['filename'])),'original_format':path[_0xd99d('0x5c')](_0x1ced60[_0xd99d('0x59')][_0xd99d('0x5a')])[_0xd99d('0x5d')](0x1),'converted_format':'wav'};var _0x3ada3b=path[_0xd99d('0x54')](config[_0xd99d('0x50')],_0xd99d('0x5e'),_0x1ced60[_0xd99d('0x59')][_0xd99d('0x5b')]);var _0x360e33=path[_0xd99d('0x54')](config[_0xd99d('0x50')],_0xd99d('0x51'),util[_0xd99d('0x55')](_0xd99d('0x56'),path['basename'](_0x1ced60[_0xd99d('0x59')][_0xd99d('0x5b')],path[_0xd99d('0x5c')](_0x1ced60['file']['filename'])),_0x534e89[_0xd99d('0x4f')]));logger[_0xd99d('0x5f')](_0xd99d('0x60'),_0x3ada3b);logger[_0xd99d('0x5f')](_0xd99d('0x61'),_0x360e33);try{fs[_0xd99d('0x62')](_0x3ada3b,parseInt('0777',0x8));var _0x1d3684=sox[_0xd99d('0x63')](_0x3ada3b,_0x360e33,{'sampleRate':0x1f40,'format':_0xd99d('0x64'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1d3684['on'](_0xd99d('0x2b'),function(_0x289e12){fs[_0xd99d('0x65')](_0x3ada3b);_0x46a258['status'](0x1f4)[_0xd99d('0x66')](_0x289e12);});_0x1d3684['on'](_0xd99d('0x67'),function(_0x4265eb){_0x534e89[_0xd99d('0x68')]=isNaN(_0x4265eb['duration'])?null:_0x4265eb['duration']*0x3e8;_0x534e89[_0xd99d('0x69')]=isNaN(_0x4265eb[_0xd99d('0x6a')])?null:_0x4265eb[_0xd99d('0x6a')];_0x534e89['original_channelCount']=isNaN(_0x4265eb[_0xd99d('0x6b')])?null:_0x4265eb[_0xd99d('0x6b')];_0x534e89[_0xd99d('0x6c')]=isNaN(_0x4265eb[_0xd99d('0x6d')])?null:_0x4265eb['bitRate'];_0x534e89[_0xd99d('0x6e')]=isNaN(_0x4265eb[_0xd99d('0x6f')])?null:_0x4265eb[_0xd99d('0x6f')];});_0x1d3684['on']('dest',function(_0x560b02){_0x534e89['converted_duration']=isNaN(_0x560b02['duration'])?null:_0x560b02[_0xd99d('0x70')]*0x3e8;_0x534e89[_0xd99d('0x71')]=isNaN(_0x560b02['sampleCount'])?null:_0x560b02['sampleCount'];_0x534e89[_0xd99d('0x72')]=isNaN(_0x560b02[_0xd99d('0x6b')])?null:_0x560b02[_0xd99d('0x6b')];_0x534e89[_0xd99d('0x73')]=isNaN(_0x560b02['bitRate'])?null:_0x560b02[_0xd99d('0x6d')];_0x534e89[_0xd99d('0x74')]=isNaN(_0x560b02[_0xd99d('0x6f')])?null:_0x560b02[_0xd99d('0x6f')];});_0x1d3684['on'](_0xd99d('0x2a'),function(){fs['chmodSync'](_0x360e33,parseInt('0777',0x8));return db['Sound'][_0xd99d('0x57')](_0x534e89)['then'](function(_0x6764c4){var _0x4ce5f2={'role':_0x1ced60[_0xd99d('0x75')]['role'],'userProfileId':_0x1ced60[_0xd99d('0x75')]['userProfileId']};if(!_0x4ce5f2)throw new Error(_0xd99d('0x76'));if(_0x4ce5f2['role']==='user'){var _0x1e3797=_0x6764c4[_0xd99d('0x77')]({'plain':!![]});return db['UserProfileSection'][_0xd99d('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x4ce5f2['userProfileId']},'raw':!![]})[_0xd99d('0x29')](function(_0x403976){if(_0x403976&&_0x403976['autoAssociation']===0x0){return db[_0xd99d('0x28')]['create']({'name':_0x1e3797[_0xd99d('0x2d')],'resourceId':_0x1e3797['id'],'type':_0x403976['name'],'sectionId':_0x403976['id']},{})['then'](function(){return _0x6764c4;});}else{return _0x6764c4;}})[_0xd99d('0x48')](function(_0x538760){logger[_0xd99d('0x2b')](_0xd99d('0x78'),_0x538760);throw _0x538760;});}return _0x6764c4;})['then'](respondWithResult(_0x46a258,null))[_0xd99d('0x48')](handleError(_0x46a258,null));});_0x1d3684['start']();}catch(_0x43206e){_0x46a258['status'](0x1f4)[_0xd99d('0x66')](_0x43206e);}};exports[_0xd99d('0x26')]=function(_0x2c2c3e,_0x32e351,_0x450e57){return db[_0xd99d('0x30')][_0xd99d('0x4c')]({'where':{'id':_0x2c2c3e[_0xd99d('0x79')]['id']}})['then'](handleEntityNotFound(_0x32e351,null))[_0xd99d('0x29')](saveUpdates(_[_0xd99d('0x3f')](_0x2c2c3e[_0xd99d('0x75')],[_0xd99d('0x2d'),'description']),null))[_0xd99d('0x29')](respondWithResult(_0x32e351,null))[_0xd99d('0x48')](handleError(_0x32e351,null));};exports[_0xd99d('0x7a')]=function(_0x3d5fc1,_0x49a1f7,_0x532b28){return db[_0xd99d('0x30')][_0xd99d('0x4c')]({'where':{'id':_0x3d5fc1[_0xd99d('0x79')]['id']}})['then'](function(_0x52521b){if(_0x52521b){return _0x52521b[_0xd99d('0x27')]();}})[_0xd99d('0x29')](function(_0x1df510){var _0x418468=path['join'](config[_0xd99d('0x50')],'server/files/sounds/original',util[_0xd99d('0x55')](_0xd99d('0x56'),_0x1df510[_0xd99d('0x4e')],_0x1df510[_0xd99d('0x7b')]));var _0xdf06fe=path[_0xd99d('0x54')](config[_0xd99d('0x50')],_0xd99d('0x51'),util[_0xd99d('0x55')](_0xd99d('0x56'),_0x1df510[_0xd99d('0x4e')],_0x1df510[_0xd99d('0x4f')]));fs[_0xd99d('0x65')](_0x418468);fs[_0xd99d('0x65')](_0xdf06fe);return _0x1df510;})[_0xd99d('0x29')](function(_0x1af41b){if(_0x1af41b){return _0x49a1f7[_0xd99d('0x1d')](0xcc)[_0xd99d('0x2a')]();}})[_0xd99d('0x29')](handleEntityNotFound(_0x49a1f7,null))['catch'](handleError(_0x49a1f7,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 5dbcb98..93bc540 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 _0xc9ac=['Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x126acb,_0x55ddec){var _0x58853a=function(_0x2c8fe1){while(--_0x2c8fe1){_0x126acb['push'](_0x126acb['shift']());}};_0x58853a(++_0x55ddec);}(_0xc9ac,0x1db));var _0xcc9a=function(_0xb03acb,_0x2e9075){_0xb03acb=_0xb03acb-0x0;var _0x2e3fff=_0xc9ac[_0xb03acb];return _0x2e3fff;};'use strict';var _=require(_0xcc9a('0x0'));var util=require(_0xcc9a('0x1'));var logger=require(_0xcc9a('0x2'))('api');var moment=require(_0xcc9a('0x3'));var BPromise=require(_0xcc9a('0x4'));var rp=require(_0xcc9a('0x5'));var fs=require('fs');var path=require(_0xcc9a('0x6'));var rimraf=require('rimraf');var config=require(_0xcc9a('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x43e212,_0x202df4){return _0x43e212[_0xcc9a('0x8')](_0xcc9a('0x9'),attributes,{'tableName':_0xcc9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25c1=['exports','define','Sound','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x25c1,0x157));var _0x125c=function(_0x54b265,_0x272d36){_0x54b265=_0x54b265-0x0;var _0x1c7987=_0x25c1[_0x54b265];return _0x1c7987;};'use strict';var _=require(_0x125c('0x0'));var util=require(_0x125c('0x1'));var logger=require(_0x125c('0x2'))(_0x125c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x125c('0x4'));var fs=require('fs');var path=require(_0x125c('0x5'));var rimraf=require(_0x125c('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x125c('0x7')]=function(_0x426f99,_0x433e42){return _0x426f99[_0x125c('0x8')](_0x125c('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 431e99c..1a73292 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 _0x83a6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSound','options','raw','where','attributes','include','map','model','then','stringify','lodash','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x83a6,0x153));var _0x683a=function(_0x4a8e35,_0x1613b5){_0x4a8e35=_0x4a8e35-0x0;var _0x2c38d9=_0x83a6[_0x4a8e35];return _0x2c38d9;};'use strict';var _=require(_0x683a('0x0'));var util=require(_0x683a('0x1'));var moment=require(_0x683a('0x2'));var BPromise=require(_0x683a('0x3'));var rs=require(_0x683a('0x4'));var fs=require('fs');var Redis=require(_0x683a('0x5'));var db=require(_0x683a('0x6'))['db'];var utils=require(_0x683a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x683a('0x8'));var jayson=require(_0x683a('0x9'));var client=jayson['client'][_0x683a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x264217,_0x3d0c36,_0x2437d8){return new BPromise(function(_0x128bbc,_0x1ce389){return client[_0x683a('0xb')](_0x264217,_0x2437d8)['then'](function(_0x8b84f4){logger[_0x683a('0xc')](_0x683a('0xd'),_0x3d0c36,_0x683a('0xe'));logger[_0x683a('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x3d0c36,_0x683a('0xe'),JSON['stringify'](_0x8b84f4));if(_0x8b84f4['error']){if(_0x8b84f4[_0x683a('0x10')][_0x683a('0x11')]===0x1f4){logger[_0x683a('0x10')](_0x683a('0xd'),_0x3d0c36,_0x8b84f4[_0x683a('0x10')]['message']);return _0x1ce389(_0x8b84f4['error'][_0x683a('0x12')]);}logger[_0x683a('0x10')](_0x683a('0xd'),_0x3d0c36,_0x8b84f4[_0x683a('0x10')]['message']);return _0x128bbc(_0x8b84f4['error'][_0x683a('0x12')]);}else{logger['info'](_0x683a('0xd'),_0x3d0c36,_0x683a('0xe'));_0x128bbc(_0x8b84f4[_0x683a('0x13')][_0x683a('0x12')]);}})[_0x683a('0x14')](function(_0x3fde53){logger[_0x683a('0x10')]('Sound,\x20%s,\x20%s',_0x3d0c36,_0x3fde53);_0x1ce389(_0x3fde53);});});}exports[_0x683a('0x15')]=function(_0x379425){var _0x41b97a=this;return new Promise(function(_0xd2173e,_0x3bafaa){return db['Sound']['find']({'raw':_0x379425[_0x683a('0x16')]?_0x379425[_0x683a('0x16')][_0x683a('0x17')]===undefined?!![]:![]:!![],'where':_0x379425['options']?_0x379425['options'][_0x683a('0x18')]||null:null,'attributes':_0x379425[_0x683a('0x16')]?_0x379425[_0x683a('0x16')][_0x683a('0x19')]||null:null,'include':_0x379425[_0x683a('0x16')]?_0x379425[_0x683a('0x16')][_0x683a('0x1a')]?_[_0x683a('0x1b')](_0x379425['options'][_0x683a('0x1a')],function(_0x3f1d04){return{'model':db[_0x3f1d04[_0x683a('0x1c')]],'as':_0x3f1d04['as'],'attributes':_0x3f1d04['attributes'],'include':_0x3f1d04[_0x683a('0x1a')]?_[_0x683a('0x1b')](_0x3f1d04[_0x683a('0x1a')],function(_0x434d0a){return{'model':db[_0x434d0a[_0x683a('0x1c')]],'as':_0x434d0a['as'],'attributes':_0x434d0a[_0x683a('0x19')],'include':_0x434d0a['include']?_[_0x683a('0x1b')](_0x434d0a[_0x683a('0x1a')],function(_0x17f4eb){return{'model':db[_0x17f4eb[_0x683a('0x1c')]],'as':_0x17f4eb['as'],'attributes':_0x17f4eb[_0x683a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x683a('0x1d')](function(_0x4e0069){logger[_0x683a('0xc')](_0x683a('0x15'),_0x379425);logger[_0x683a('0xf')](_0x683a('0x15'),_0x379425,JSON[_0x683a('0x1e')](_0x4e0069));_0xd2173e(_0x4e0069);})[_0x683a('0x14')](function(_0x11bd89){logger['error'](_0x683a('0x15'),_0x11bd89[_0x683a('0x12')],_0x379425);_0x3bafaa(_0x41b97a['error'](0x1f4,_0x11bd89[_0x683a('0x12')]));});});}; \ No newline at end of file +var _0xaf93=['then','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','catch','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x53456e,_0x574468){var _0x18bdfe=function(_0x4907f8){while(--_0x4907f8){_0x53456e['push'](_0x53456e['shift']());}};_0x18bdfe(++_0x574468);}(_0xaf93,0x195));var _0x3af9=function(_0x5e55a8,_0x2578e5){_0x5e55a8=_0x5e55a8-0x0;var _0x38e2b6=_0xaf93[_0x5e55a8];return _0x38e2b6;};'use strict';var _=require(_0x3af9('0x0'));var util=require('util');var moment=require(_0x3af9('0x1'));var BPromise=require('bluebird');var rs=require(_0x3af9('0x2'));var fs=require('fs');var Redis=require(_0x3af9('0x3'));var db=require(_0x3af9('0x4'))['db'];var utils=require(_0x3af9('0x5'));var logger=require(_0x3af9('0x6'))(_0x3af9('0x7'));var config=require(_0x3af9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3af9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d534,_0x4df9d1,_0x525746){return new BPromise(function(_0x493ae0,_0x331822){return client[_0x3af9('0xa')](_0x31d534,_0x525746)[_0x3af9('0xb')](function(_0x40b6fb){logger['info']('Sound,\x20%s,\x20%s',_0x4df9d1,_0x3af9('0xc'));logger[_0x3af9('0xd')](_0x3af9('0xe'),_0x4df9d1,_0x3af9('0xc'),JSON[_0x3af9('0xf')](_0x40b6fb));if(_0x40b6fb[_0x3af9('0x10')]){if(_0x40b6fb[_0x3af9('0x10')][_0x3af9('0x11')]===0x1f4){logger[_0x3af9('0x10')](_0x3af9('0x12'),_0x4df9d1,_0x40b6fb['error']['message']);return _0x331822(_0x40b6fb[_0x3af9('0x10')][_0x3af9('0x13')]);}logger['error'](_0x3af9('0x12'),_0x4df9d1,_0x40b6fb['error'][_0x3af9('0x13')]);return _0x493ae0(_0x40b6fb[_0x3af9('0x10')][_0x3af9('0x13')]);}else{logger[_0x3af9('0x14')](_0x3af9('0x12'),_0x4df9d1,_0x3af9('0xc'));_0x493ae0(_0x40b6fb[_0x3af9('0x15')]['message']);}})[_0x3af9('0x16')](function(_0x3be8f7){logger[_0x3af9('0x10')](_0x3af9('0x12'),_0x4df9d1,_0x3be8f7);_0x331822(_0x3be8f7);});});}exports['ShowSound']=function(_0x310250){var _0x20b85c=this;return new Promise(function(_0x4f3391,_0x1a162f){return db['Sound'][_0x3af9('0x17')]({'raw':_0x310250[_0x3af9('0x18')]?_0x310250[_0x3af9('0x18')][_0x3af9('0x19')]===undefined?!![]:![]:!![],'where':_0x310250[_0x3af9('0x18')]?_0x310250[_0x3af9('0x18')][_0x3af9('0x1a')]||null:null,'attributes':_0x310250[_0x3af9('0x18')]?_0x310250[_0x3af9('0x18')][_0x3af9('0x1b')]||null:null,'include':_0x310250['options']?_0x310250[_0x3af9('0x18')][_0x3af9('0x1c')]?_[_0x3af9('0x1d')](_0x310250[_0x3af9('0x18')]['include'],function(_0xcfb518){return{'model':db[_0xcfb518['model']],'as':_0xcfb518['as'],'attributes':_0xcfb518[_0x3af9('0x1b')],'include':_0xcfb518[_0x3af9('0x1c')]?_[_0x3af9('0x1d')](_0xcfb518[_0x3af9('0x1c')],function(_0x3102e6){return{'model':db[_0x3102e6[_0x3af9('0x1e')]],'as':_0x3102e6['as'],'attributes':_0x3102e6['attributes'],'include':_0x3102e6[_0x3af9('0x1c')]?_[_0x3af9('0x1d')](_0x3102e6[_0x3af9('0x1c')],function(_0x4a3726){return{'model':db[_0x4a3726[_0x3af9('0x1e')]],'as':_0x4a3726['as'],'attributes':_0x4a3726[_0x3af9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3af9('0xb')](function(_0x545504){logger[_0x3af9('0x14')](_0x3af9('0x1f'),_0x310250);logger[_0x3af9('0xd')](_0x3af9('0x1f'),_0x310250,JSON['stringify'](_0x545504));_0x4f3391(_0x545504);})[_0x3af9('0x16')](function(_0x30b483){logger['error'](_0x3af9('0x1f'),_0x30b483[_0x3af9('0x13')],_0x310250);_0x1a162f(_0x20b85c[_0x3af9('0x10')](0x1f4,_0x30b483[_0x3af9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e90a1ad..068b3c9 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 _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x8603,0x190));var _0x3860=function(_0x1237b4,_0x32f157){_0x1237b4=_0x1237b4-0x0;var _0x44ccc7=_0x8603[_0x1237b4];return _0x44ccc7;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0x8603,0x190));var _0x3860=function(_0x3d03cf,_0x4b8f22){_0x3d03cf=_0x3d03cf-0x0;var _0x31ca3a=_0x8603[_0x3d03cf];return _0x31ca3a;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f886b65..141eeaf 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 _0xe692=['medium','ENUM','out','exports','STRING','TEXT'];(function(_0x37e9a5,_0x3c7758){var _0x2e8999=function(_0x338a01){while(--_0x338a01){_0x37e9a5['push'](_0x37e9a5['shift']());}};_0x2e8999(++_0x3c7758);}(_0xe692,0x18f));var _0x2e69=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe692[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require('sequelize');module[_0x2e69('0x0')]={'uniqueid':{'type':Sequelize[_0x2e69('0x1')]},'body':{'type':Sequelize[_0x2e69('0x2')](_0x2e69('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x2e69('0x4')]('in','out'),'defaultValue':_0x2e69('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x2e69('0x1')]},'providerResponse':{'type':Sequelize[_0x2e69('0x2')]}}; \ No newline at end of file +var _0x2ec8=['TEXT','ENUM','sequelize','exports','STRING'];(function(_0x172cb2,_0x5928a6){var _0x3be5bc=function(_0x53e3b4){while(--_0x53e3b4){_0x172cb2['push'](_0x172cb2['shift']());}};_0x3be5bc(++_0x5928a6);}(_0x2ec8,0x188));var _0x82ec=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2ec8[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x82ec('0x0'));module[_0x82ec('0x1')]={'uniqueid':{'type':Sequelize[_0x82ec('0x2')]},'body':{'type':Sequelize[_0x82ec('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x82ec('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x82ec('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 093717c..e5fb75a 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 _0x4742=['key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','fields','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','SquareMessage','rawAttributes','fieldName','type'];(function(_0x3093dd,_0x163caa){var _0x9448a3=function(_0x78bfde){while(--_0x78bfde){_0x3093dd['push'](_0x3093dd['shift']());}};_0x9448a3(++_0x163caa);}(_0x4742,0x64));var _0x2474=function(_0x3f1637,_0x5916c2){_0x3f1637=_0x3f1637-0x0;var _0x4db4=_0x4742[_0x3f1637];return _0x4db4;};'use strict';var emlformat=require(_0x2474('0x0'));var rimraf=require(_0x2474('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2474('0x2'));var rp=require(_0x2474('0x3'));var moment=require(_0x2474('0x4'));var BPromise=require(_0x2474('0x5'));var Mustache=require(_0x2474('0x6'));var util=require('util');var path=require(_0x2474('0x7'));var sox=require(_0x2474('0x8'));var csv=require('to-csv');var ejs=require(_0x2474('0x9'));var fs=require('fs');var fs_extra=require(_0x2474('0xa'));var _=require('lodash');var squel=require(_0x2474('0xb'));var crypto=require('crypto');var jsforce=require(_0x2474('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2474('0xd'));var querystring=require(_0x2474('0xe'));var Papa=require('papaparse');var Redis=require(_0x2474('0xf'));var authService=require(_0x2474('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2474('0x11'));var hardwareService=require(_0x2474('0x12'));var logger=require(_0x2474('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2474('0x14'));var licenseUtil=require(_0x2474('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33e5f9,_0x2eeceb){_0x2eeceb=_0x2eeceb||0xcc;return function(_0x1e23fd){if(_0x1e23fd){return _0x33e5f9[_0x2474('0x16')](_0x2eeceb);}return _0x33e5f9[_0x2474('0x17')](_0x2eeceb)['end']();};}function respondWithResult(_0x17763e,_0x3905b2){_0x3905b2=_0x3905b2||0xc8;return function(_0x329a89){if(_0x329a89){return _0x17763e[_0x2474('0x17')](_0x3905b2)[_0x2474('0x18')](_0x329a89);}};}function respondWithFilteredResult(_0x5cee25,_0x1c41d7){return function(_0x1a48a0){if(_0x1a48a0){var _0x2d605a=typeof _0x1c41d7[_0x2474('0x19')]===_0x2474('0x1a')&&typeof _0x1c41d7['limit']===_0x2474('0x1a');var _0x4886b8=_0x1a48a0[_0x2474('0x1b')];var _0x110522=_0x2d605a?0x0:_0x1c41d7['offset'];var _0x16e3d6=_0x2d605a?_0x1a48a0[_0x2474('0x1b')]:_0x1c41d7['offset']+_0x1c41d7[_0x2474('0x1c')];var _0x4388ad;if(_0x16e3d6>=_0x4886b8){_0x16e3d6=_0x4886b8;_0x4388ad=0xc8;}else{_0x4388ad=0xce;}_0x5cee25[_0x2474('0x17')](_0x4388ad);return _0x5cee25[_0x2474('0x1d')](_0x2474('0x1e'),_0x110522+'-'+_0x16e3d6+'/'+_0x4886b8)[_0x2474('0x18')](_0x1a48a0);}return null;};}function patchUpdates(_0x4d1adc){return function(_0x3aa449){try{jsonpatch[_0x2474('0x1f')](_0x3aa449,_0x4d1adc,!![]);}catch(_0x424a1c){return BPromise[_0x2474('0x20')](_0x424a1c);}return _0x3aa449[_0x2474('0x21')]();};}function saveUpdates(_0xd00d45,_0x1b55ab){return function(_0x368f27){if(_0x368f27){return _0x368f27['update'](_0xd00d45)[_0x2474('0x22')](function(_0x17dd44){return _0x17dd44;});}return null;};}function removeEntity(_0xb97dfb,_0xbaf175){return function(_0x203632){if(_0x203632){return _0x203632[_0x2474('0x23')]()[_0x2474('0x22')](function(){_0xb97dfb[_0x2474('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d677,_0x7a7d02){return function(_0x222d64){if(!_0x222d64){_0x16d677[_0x2474('0x16')](0x194);}return _0x222d64;};}function handleError(_0x47f860,_0x3f821b){_0x3f821b=_0x3f821b||0x1f4;return function(_0x6524d){logger[_0x2474('0x24')](_0x6524d['stack']);if(_0x6524d['name']){delete _0x6524d[_0x2474('0x25')];}_0x47f860['status'](_0x3f821b)[_0x2474('0x26')](_0x6524d);};}exports[_0x2474('0x27')]=function(_0x6420d3,_0x3ac946){var _0x21cc0b={},_0x1fec79={},_0x30a54d={'count':0x0,'rows':[]};var _0x43d81f=_['map'](db[_0x2474('0x28')][_0x2474('0x29')],function(_0x4ef11d){return{'name':_0x4ef11d[_0x2474('0x2a')],'type':_0x4ef11d[_0x2474('0x2b')][_0x2474('0x2c')]};});_0x1fec79[_0x2474('0x2d')]=_['map'](_0x43d81f,_0x2474('0x25'));_0x1fec79[_0x2474('0x2e')]=_[_0x2474('0x2f')](_0x6420d3[_0x2474('0x2e')]);_0x1fec79[_0x2474('0x30')]=_[_0x2474('0x31')](_0x1fec79['model'],_0x1fec79[_0x2474('0x2e')]);_0x21cc0b[_0x2474('0x32')]=_[_0x2474('0x31')](_0x1fec79[_0x2474('0x2d')],qs['fields'](_0x6420d3['query']['fields']));_0x21cc0b['attributes']=_0x21cc0b[_0x2474('0x32')][_0x2474('0x33')]?_0x21cc0b['attributes']:_0x1fec79[_0x2474('0x2d')];if(!_0x6420d3[_0x2474('0x2e')][_0x2474('0x34')](_0x2474('0x35'))){_0x21cc0b[_0x2474('0x1c')]=qs['limit'](_0x6420d3[_0x2474('0x2e')][_0x2474('0x1c')]);_0x21cc0b[_0x2474('0x19')]=qs[_0x2474('0x19')](_0x6420d3[_0x2474('0x2e')]['offset']);}_0x21cc0b[_0x2474('0x36')]=qs[_0x2474('0x37')](_0x6420d3[_0x2474('0x2e')][_0x2474('0x37')]);_0x21cc0b['where']=qs[_0x2474('0x30')](_[_0x2474('0x38')](_0x6420d3[_0x2474('0x2e')],_0x1fec79[_0x2474('0x30')]),_0x43d81f);if(_0x6420d3['query'][_0x2474('0x39')]){_0x21cc0b[_0x2474('0x3a')]=_['merge'](_0x21cc0b[_0x2474('0x3a')],{'$or':_['map'](_0x43d81f,function(_0x11790c){if(_0x11790c['type']!==_0x2474('0x3b')){var _0x4ac3e2={};_0x4ac3e2[_0x11790c[_0x2474('0x25')]]={'$like':'%'+_0x6420d3[_0x2474('0x2e')][_0x2474('0x39')]+'%'};return _0x4ac3e2;}})});}_0x21cc0b=_[_0x2474('0x3c')]({},_0x21cc0b,_0x6420d3[_0x2474('0x3d')]);var _0x341ce0={'where':_0x21cc0b[_0x2474('0x3a')]};return db[_0x2474('0x28')][_0x2474('0x1b')](_0x341ce0)[_0x2474('0x22')](function(_0x377bc1){_0x30a54d[_0x2474('0x1b')]=_0x377bc1;if(_0x6420d3[_0x2474('0x2e')][_0x2474('0x3e')]){_0x21cc0b[_0x2474('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0x2474('0x40')](_0x21cc0b);})[_0x2474('0x22')](function(_0x5e3866){_0x30a54d[_0x2474('0x41')]=_0x5e3866;return _0x30a54d;})['then'](respondWithFilteredResult(_0x3ac946,_0x21cc0b))[_0x2474('0x42')](handleError(_0x3ac946,null));};exports['show']=function(_0x3278c6,_0x478ccf){var _0x1092b6={'raw':!![],'where':{'id':_0x3278c6[_0x2474('0x43')]['id']}},_0x4f3b45={};_0x4f3b45['model']=_[_0x2474('0x2f')](db['SquareMessage'][_0x2474('0x29')]);_0x4f3b45[_0x2474('0x2e')]=_[_0x2474('0x2f')](_0x3278c6[_0x2474('0x2e')]);_0x4f3b45[_0x2474('0x30')]=_[_0x2474('0x31')](_0x4f3b45[_0x2474('0x2d')],_0x4f3b45[_0x2474('0x2e')]);_0x1092b6[_0x2474('0x32')]=_[_0x2474('0x31')](_0x4f3b45[_0x2474('0x2d')],qs[_0x2474('0x44')](_0x3278c6[_0x2474('0x2e')][_0x2474('0x44')]));_0x1092b6[_0x2474('0x32')]=_0x1092b6['attributes'][_0x2474('0x33')]?_0x1092b6[_0x2474('0x32')]:_0x4f3b45[_0x2474('0x2d')];if(_0x3278c6[_0x2474('0x2e')][_0x2474('0x3e')]){_0x1092b6['include']=[{'all':!![]}];}_0x1092b6=_[_0x2474('0x3c')]({},_0x1092b6,_0x3278c6[_0x2474('0x3d')]);return db[_0x2474('0x28')]['find'](_0x1092b6)[_0x2474('0x22')](handleEntityNotFound(_0x478ccf,null))[_0x2474('0x22')](respondWithResult(_0x478ccf,null))[_0x2474('0x42')](handleError(_0x478ccf,null));};exports[_0x2474('0x45')]=function(_0xac677,_0x490d05){return db[_0x2474('0x28')][_0x2474('0x45')](_0xac677[_0x2474('0x46')],{})['then'](respondWithResult(_0x490d05,0xc9))['catch'](handleError(_0x490d05,null));};exports['update']=function(_0x24d2e6,_0x5e6d0c){if(_0x24d2e6['body']['id']){delete _0x24d2e6[_0x2474('0x46')]['id'];}return db['SquareMessage'][_0x2474('0x47')]({'where':{'id':_0x24d2e6['params']['id']}})[_0x2474('0x22')](handleEntityNotFound(_0x5e6d0c,null))['then'](saveUpdates(_0x24d2e6['body'],null))[_0x2474('0x22')](respondWithResult(_0x5e6d0c,null))[_0x2474('0x42')](handleError(_0x5e6d0c,null));};exports[_0x2474('0x23')]=function(_0x5c4965,_0x51c93d){return db[_0x2474('0x28')][_0x2474('0x47')]({'where':{'id':_0x5c4965[_0x2474('0x43')]['id']}})[_0x2474('0x22')](handleEntityNotFound(_0x51c93d,null))[_0x2474('0x22')](removeEntity(_0x51c93d,null))[_0x2474('0x42')](handleError(_0x51c93d,null));}; \ No newline at end of file +var _0x07ef=['json','reject','save','update','destroy','then','error','name','index','SquareMessage','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x209ea2,_0x53e08d){var _0x577a51=function(_0x305fbc){while(--_0x305fbc){_0x209ea2['push'](_0x209ea2['shift']());}};_0x577a51(++_0x53e08d);}(_0x07ef,0x70));var _0xf07e=function(_0x4ee3df,_0x1939e5){_0x4ee3df=_0x4ee3df-0x0;var _0x10a525=_0x07ef[_0x4ee3df];return _0x10a525;};'use strict';var emlformat=require(_0xf07e('0x0'));var rimraf=require(_0xf07e('0x1'));var zipdir=require(_0xf07e('0x2'));var jsonpatch=require(_0xf07e('0x3'));var rp=require('request-promise');var moment=require(_0xf07e('0x4'));var BPromise=require(_0xf07e('0x5'));var Mustache=require(_0xf07e('0x6'));var util=require(_0xf07e('0x7'));var path=require(_0xf07e('0x8'));var sox=require(_0xf07e('0x9'));var csv=require(_0xf07e('0xa'));var ejs=require(_0xf07e('0xb'));var fs=require('fs');var fs_extra=require(_0xf07e('0xc'));var _=require(_0xf07e('0xd'));var squel=require(_0xf07e('0xe'));var crypto=require(_0xf07e('0xf'));var jsforce=require(_0xf07e('0x10'));var deskjs=require(_0xf07e('0x11'));var toCsv=require(_0xf07e('0xa'));var querystring=require(_0xf07e('0x12'));var Papa=require(_0xf07e('0x13'));var Redis=require(_0xf07e('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf07e('0x15'));var as=require(_0xf07e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf07e('0x17'));var utils=require(_0xf07e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf07e('0x19'));var db=require(_0xf07e('0x1a'))['db'];function respondWithStatusCode(_0x169f85,_0x273bab){_0x273bab=_0x273bab||0xcc;return function(_0x4e1ccf){if(_0x4e1ccf){return _0x169f85[_0xf07e('0x1b')](_0x273bab);}return _0x169f85[_0xf07e('0x1c')](_0x273bab)[_0xf07e('0x1d')]();};}function respondWithResult(_0x22b355,_0x877067){_0x877067=_0x877067||0xc8;return function(_0x41cd6b){if(_0x41cd6b){return _0x22b355[_0xf07e('0x1c')](_0x877067)['json'](_0x41cd6b);}};}function respondWithFilteredResult(_0xce56dc,_0x16fcf1){return function(_0x585697){if(_0x585697){var _0x360ca9=typeof _0x16fcf1[_0xf07e('0x1e')]===_0xf07e('0x1f')&&typeof _0x16fcf1[_0xf07e('0x20')]===_0xf07e('0x1f');var _0x22b2e1=_0x585697[_0xf07e('0x21')];var _0x332bbc=_0x360ca9?0x0:_0x16fcf1[_0xf07e('0x1e')];var _0x580e4e=_0x360ca9?_0x585697['count']:_0x16fcf1[_0xf07e('0x1e')]+_0x16fcf1[_0xf07e('0x20')];var _0x3caee3;if(_0x580e4e>=_0x22b2e1){_0x580e4e=_0x22b2e1;_0x3caee3=0xc8;}else{_0x3caee3=0xce;}_0xce56dc[_0xf07e('0x1c')](_0x3caee3);return _0xce56dc[_0xf07e('0x22')](_0xf07e('0x23'),_0x332bbc+'-'+_0x580e4e+'/'+_0x22b2e1)[_0xf07e('0x24')](_0x585697);}return null;};}function patchUpdates(_0x23d8e0){return function(_0x5198cb){try{jsonpatch['apply'](_0x5198cb,_0x23d8e0,!![]);}catch(_0x237fee){return BPromise[_0xf07e('0x25')](_0x237fee);}return _0x5198cb[_0xf07e('0x26')]();};}function saveUpdates(_0x197a64,_0x1955bf){return function(_0x3e3d31){if(_0x3e3d31){return _0x3e3d31[_0xf07e('0x27')](_0x197a64)['then'](function(_0x4d8880){return _0x4d8880;});}return null;};}function removeEntity(_0x14f313,_0x458b0b){return function(_0x597489){if(_0x597489){return _0x597489[_0xf07e('0x28')]()[_0xf07e('0x29')](function(){_0x14f313[_0xf07e('0x1c')](0xcc)[_0xf07e('0x1d')]();});}};}function handleEntityNotFound(_0x44b380,_0x27b83c){return function(_0x6b75a2){if(!_0x6b75a2){_0x44b380['sendStatus'](0x194);}return _0x6b75a2;};}function handleError(_0x449d0d,_0x6dcf50){_0x6dcf50=_0x6dcf50||0x1f4;return function(_0x149d45){logger[_0xf07e('0x2a')](_0x149d45['stack']);if(_0x149d45[_0xf07e('0x2b')]){delete _0x149d45[_0xf07e('0x2b')];}_0x449d0d[_0xf07e('0x1c')](_0x6dcf50)['send'](_0x149d45);};}exports[_0xf07e('0x2c')]=function(_0x585071,_0x333a42){var _0x29a8a2={},_0x47b61f={},_0x1e4814={'count':0x0,'rows':[]};var _0x2c4b59=_['map'](db[_0xf07e('0x2d')][_0xf07e('0x2e')],function(_0x45587a){return{'name':_0x45587a['fieldName'],'type':_0x45587a['type'][_0xf07e('0x2f')]};});_0x47b61f[_0xf07e('0x30')]=_[_0xf07e('0x31')](_0x2c4b59,_0xf07e('0x2b'));_0x47b61f[_0xf07e('0x32')]=_[_0xf07e('0x33')](_0x585071['query']);_0x47b61f[_0xf07e('0x34')]=_[_0xf07e('0x35')](_0x47b61f[_0xf07e('0x30')],_0x47b61f[_0xf07e('0x32')]);_0x29a8a2[_0xf07e('0x36')]=_[_0xf07e('0x35')](_0x47b61f[_0xf07e('0x30')],qs[_0xf07e('0x37')](_0x585071[_0xf07e('0x32')][_0xf07e('0x37')]));_0x29a8a2['attributes']=_0x29a8a2[_0xf07e('0x36')]['length']?_0x29a8a2[_0xf07e('0x36')]:_0x47b61f['model'];if(!_0x585071[_0xf07e('0x32')][_0xf07e('0x38')](_0xf07e('0x39'))){_0x29a8a2[_0xf07e('0x20')]=qs[_0xf07e('0x20')](_0x585071['query'][_0xf07e('0x20')]);_0x29a8a2[_0xf07e('0x1e')]=qs[_0xf07e('0x1e')](_0x585071[_0xf07e('0x32')][_0xf07e('0x1e')]);}_0x29a8a2[_0xf07e('0x3a')]=qs['sort'](_0x585071[_0xf07e('0x32')][_0xf07e('0x3b')]);_0x29a8a2['where']=qs['filters'](_['pick'](_0x585071[_0xf07e('0x32')],_0x47b61f[_0xf07e('0x34')]),_0x2c4b59);if(_0x585071[_0xf07e('0x32')]['filter']){_0x29a8a2[_0xf07e('0x3c')]=_['merge'](_0x29a8a2[_0xf07e('0x3c')],{'$or':_[_0xf07e('0x31')](_0x2c4b59,function(_0x142dc4){if(_0x142dc4['type']!==_0xf07e('0x3d')){var _0x4c1ef9={};_0x4c1ef9[_0x142dc4['name']]={'$like':'%'+_0x585071[_0xf07e('0x32')][_0xf07e('0x3e')]+'%'};return _0x4c1ef9;}})});}_0x29a8a2=_[_0xf07e('0x3f')]({},_0x29a8a2,_0x585071[_0xf07e('0x40')]);var _0x172954={'where':_0x29a8a2[_0xf07e('0x3c')]};return db['SquareMessage']['count'](_0x172954)[_0xf07e('0x29')](function(_0x1ffa85){_0x1e4814['count']=_0x1ffa85;if(_0x585071[_0xf07e('0x32')]['includeAll']){_0x29a8a2[_0xf07e('0x41')]=[{'all':!![]}];}return db[_0xf07e('0x2d')]['findAll'](_0x29a8a2);})[_0xf07e('0x29')](function(_0x4fda1e){_0x1e4814['rows']=_0x4fda1e;return _0x1e4814;})[_0xf07e('0x29')](respondWithFilteredResult(_0x333a42,_0x29a8a2))[_0xf07e('0x42')](handleError(_0x333a42,null));};exports[_0xf07e('0x43')]=function(_0x5ad08c,_0x281abc){var _0x2963f3={'raw':!![],'where':{'id':_0x5ad08c[_0xf07e('0x44')]['id']}},_0x962b53={};_0x962b53[_0xf07e('0x30')]=_[_0xf07e('0x33')](db[_0xf07e('0x2d')][_0xf07e('0x2e')]);_0x962b53['query']=_[_0xf07e('0x33')](_0x5ad08c[_0xf07e('0x32')]);_0x962b53[_0xf07e('0x34')]=_[_0xf07e('0x35')](_0x962b53[_0xf07e('0x30')],_0x962b53['query']);_0x2963f3['attributes']=_['intersection'](_0x962b53[_0xf07e('0x30')],qs[_0xf07e('0x37')](_0x5ad08c[_0xf07e('0x32')]['fields']));_0x2963f3['attributes']=_0x2963f3[_0xf07e('0x36')][_0xf07e('0x45')]?_0x2963f3[_0xf07e('0x36')]:_0x962b53['model'];if(_0x5ad08c['query'][_0xf07e('0x46')]){_0x2963f3[_0xf07e('0x41')]=[{'all':!![]}];}_0x2963f3=_[_0xf07e('0x3f')]({},_0x2963f3,_0x5ad08c[_0xf07e('0x40')]);return db[_0xf07e('0x2d')][_0xf07e('0x47')](_0x2963f3)[_0xf07e('0x29')](handleEntityNotFound(_0x281abc,null))[_0xf07e('0x29')](respondWithResult(_0x281abc,null))[_0xf07e('0x42')](handleError(_0x281abc,null));};exports[_0xf07e('0x48')]=function(_0x54727d,_0x4aaa20){return db[_0xf07e('0x2d')]['create'](_0x54727d[_0xf07e('0x49')],{})[_0xf07e('0x29')](respondWithResult(_0x4aaa20,0xc9))[_0xf07e('0x42')](handleError(_0x4aaa20,null));};exports['update']=function(_0x87975f,_0x3ad014){if(_0x87975f[_0xf07e('0x49')]['id']){delete _0x87975f[_0xf07e('0x49')]['id'];}return db[_0xf07e('0x2d')][_0xf07e('0x47')]({'where':{'id':_0x87975f[_0xf07e('0x44')]['id']}})[_0xf07e('0x29')](handleEntityNotFound(_0x3ad014,null))[_0xf07e('0x29')](saveUpdates(_0x87975f[_0xf07e('0x49')],null))[_0xf07e('0x29')](respondWithResult(_0x3ad014,null))[_0xf07e('0x42')](handleError(_0x3ad014,null));};exports[_0xf07e('0x28')]=function(_0x3aa5b2,_0x3e4200){return db[_0xf07e('0x2d')][_0xf07e('0x47')]({'where':{'id':_0x3aa5b2[_0xf07e('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e4200,null))[_0xf07e('0x29')](removeEntity(_0x3e4200,null))['catch'](handleError(_0x3e4200,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 909f8e8..5a71933 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 _0xe130=['SquareMessage','square_messages','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0xe130,0x12b));var _0x0e13=function(_0x4d633b,_0x10b08d){_0x4d633b=_0x4d633b-0x0;var _0x5bafa5=_0xe130[_0x4d633b];return _0x5bafa5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0e13('0x0'))(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e13('0x3'));var rimraf=require(_0x0e13('0x4'));var config=require(_0x0e13('0x5'));var attributes=require('./squareMessage.attributes');module[_0x0e13('0x6')]=function(_0x91a6ea,_0x101d30){return _0x91a6ea['define'](_0x0e13('0x7'),attributes,{'tableName':_0x0e13('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6af0=['../../config/logger','api','moment','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','util'];(function(_0x2b8fc2,_0x2f15e8){var _0xf9df21=function(_0x16e18f){while(--_0x16e18f){_0x2b8fc2['push'](_0x2b8fc2['shift']());}};_0xf9df21(++_0x2f15e8);}(_0x6af0,0x133));var _0x06af=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x6af0[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require(_0x06af('0x0'));var logger=require(_0x06af('0x1'))(_0x06af('0x2'));var moment=require(_0x06af('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x06af('0x4'));var rimraf=require(_0x06af('0x5'));var config=require(_0x06af('0x6'));var attributes=require(_0x06af('0x7'));module[_0x06af('0x8')]=function(_0x2aa222,_0x3dcc78){return _0x2aa222[_0x06af('0x9')](_0x06af('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 31abb8c..0afc2df 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 _0x2a66=['result','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','info'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2a66,0xbd));var _0x62a6=function(_0x5ee71e,_0x28e6bf){_0x5ee71e=_0x5ee71e-0x0;var _0x1675b1=_0x2a66[_0x5ee71e];return _0x1675b1;};'use strict';var _=require(_0x62a6('0x0'));var util=require(_0x62a6('0x1'));var moment=require('moment');var BPromise=require(_0x62a6('0x2'));var rs=require(_0x62a6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62a6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x62a6('0x5'));var jayson=require(_0x62a6('0x6'));var client=jayson[_0x62a6('0x7')][_0x62a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bbae2,_0x2c87eb,_0x506a4d){return new BPromise(function(_0x3d9cfb,_0x25d552){return client[_0x62a6('0x9')](_0x1bbae2,_0x506a4d)[_0x62a6('0xa')](function(_0x55ed00){logger['info']('SquareMessage,\x20%s,\x20%s',_0x2c87eb,_0x62a6('0xb'));logger[_0x62a6('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x2c87eb,_0x62a6('0xb'),JSON[_0x62a6('0xd')](_0x55ed00));if(_0x55ed00[_0x62a6('0xe')]){if(_0x55ed00[_0x62a6('0xe')][_0x62a6('0xf')]===0x1f4){logger[_0x62a6('0xe')]('SquareMessage,\x20%s,\x20%s',_0x2c87eb,_0x55ed00[_0x62a6('0xe')][_0x62a6('0x10')]);return _0x25d552(_0x55ed00[_0x62a6('0xe')][_0x62a6('0x10')]);}logger[_0x62a6('0xe')](_0x62a6('0x11'),_0x2c87eb,_0x55ed00[_0x62a6('0xe')][_0x62a6('0x10')]);return _0x3d9cfb(_0x55ed00[_0x62a6('0xe')]['message']);}else{logger[_0x62a6('0x12')](_0x62a6('0x11'),_0x2c87eb,'request\x20sent');_0x3d9cfb(_0x55ed00[_0x62a6('0x13')][_0x62a6('0x10')]);}})[_0x62a6('0x14')](function(_0x4de54d){logger[_0x62a6('0xe')](_0x62a6('0x11'),_0x2c87eb,_0x4de54d);_0x25d552(_0x4de54d);});});}exports[_0x62a6('0x15')]=function(_0x27c32a){var _0x35026b=this;return new Promise(function(_0x2ea155,_0x1e30ff){return db[_0x62a6('0x16')][_0x62a6('0x17')](_0x27c32a[_0x62a6('0x18')],{'raw':_0x27c32a[_0x62a6('0x19')]?_0x27c32a[_0x62a6('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x54a6ac){logger[_0x62a6('0x12')](_0x62a6('0x15'),_0x27c32a);logger[_0x62a6('0xc')](_0x62a6('0x15'),_0x27c32a,JSON[_0x62a6('0xd')](_0x54a6ac));_0x2ea155(_0x54a6ac);})[_0x62a6('0x14')](function(_0xe19046){logger[_0x62a6('0xe')](_0x62a6('0x15'),_0xe19046[_0x62a6('0x10')],_0x27c32a);_0x1e30ff(_0x35026b[_0x62a6('0xe')](0x1f4,_0xe19046[_0x62a6('0x10')]));});});}; \ No newline at end of file +var _0xe85e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','CreateSquareMessage','SquareMessage','create','options','raw','stringify','catch'];(function(_0x3521ea,_0x51b479){var _0x2aabb8=function(_0xbbfd54){while(--_0xbbfd54){_0x3521ea['push'](_0x3521ea['shift']());}};_0x2aabb8(++_0x51b479);}(_0xe85e,0x186));var _0xee85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee85('0x0'));var util=require(_0xee85('0x1'));var moment=require(_0xee85('0x2'));var BPromise=require(_0xee85('0x3'));var rs=require(_0xee85('0x4'));var fs=require('fs');var Redis=require(_0xee85('0x5'));var db=require(_0xee85('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xee85('0x7'))(_0xee85('0x8'));var config=require(_0xee85('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x384446,_0x5a2e54,_0x3d7f10){return new BPromise(function(_0x10ef08,_0x54d0b2){return client[_0xee85('0xa')](_0x384446,_0x3d7f10)[_0xee85('0xb')](function(_0xb3e0e8){logger[_0xee85('0xc')](_0xee85('0xd'),_0x5a2e54,_0xee85('0xe'));logger[_0xee85('0xf')](_0xee85('0x10'),_0x5a2e54,_0xee85('0xe'),JSON['stringify'](_0xb3e0e8));if(_0xb3e0e8['error']){if(_0xb3e0e8[_0xee85('0x11')]['code']===0x1f4){logger[_0xee85('0x11')](_0xee85('0xd'),_0x5a2e54,_0xb3e0e8[_0xee85('0x11')][_0xee85('0x12')]);return _0x54d0b2(_0xb3e0e8[_0xee85('0x11')][_0xee85('0x12')]);}logger[_0xee85('0x11')]('SquareMessage,\x20%s,\x20%s',_0x5a2e54,_0xb3e0e8[_0xee85('0x11')]['message']);return _0x10ef08(_0xb3e0e8[_0xee85('0x11')][_0xee85('0x12')]);}else{logger[_0xee85('0xc')](_0xee85('0xd'),_0x5a2e54,'request\x20sent');_0x10ef08(_0xb3e0e8['result'][_0xee85('0x12')]);}})['catch'](function(_0x1c478f){logger['error']('SquareMessage,\x20%s,\x20%s',_0x5a2e54,_0x1c478f);_0x54d0b2(_0x1c478f);});});}exports[_0xee85('0x13')]=function(_0x555cad){var _0x3b3b1b=this;return new Promise(function(_0x1e3f4a,_0x23f257){return db[_0xee85('0x14')][_0xee85('0x15')](_0x555cad['body'],{'raw':_0x555cad[_0xee85('0x16')]?_0x555cad['options'][_0xee85('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x234bc8){logger['info'](_0xee85('0x13'),_0x555cad);logger[_0xee85('0xf')](_0xee85('0x13'),_0x555cad,JSON[_0xee85('0x18')](_0x234bc8));_0x1e3f4a(_0x234bc8);})[_0xee85('0x19')](function(_0x2c46e6){logger[_0xee85('0x11')](_0xee85('0x13'),_0x2c46e6[_0xee85('0x12')],_0x555cad);_0x23f257(_0x3b3b1b['error'](0x1f4,_0x2c46e6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 6ad40ff..c5a7a36 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 _0xee23=['isAuthenticated','show','15s','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x45f04e,_0x535592){var _0xe3ac6=function(_0x5f4d8f){while(--_0x5f4d8f){_0x45f04e['push'](_0x45f04e['shift']());}};_0xe3ac6(++_0x535592);}(_0xee23,0x129));var _0x3ee2=function(_0x2d0ef2,_0x194a92){_0x2d0ef2=_0x2d0ef2-0x0;var _0xf8937d=_0xee23[_0x2d0ef2];return _0xf8937d;};'use strict';var multer=require('multer');var util=require(_0x3ee2('0x0'));var path=require(_0x3ee2('0x1'));var timeout=require(_0x3ee2('0x2'));var express=require(_0x3ee2('0x3'));var router=express[_0x3ee2('0x4')]();var fs_extra=require(_0x3ee2('0x5'));var auth=require(_0x3ee2('0x6'));var interaction=require(_0x3ee2('0x7'));var config=require(_0x3ee2('0x8'));var controller=require(_0x3ee2('0x9'));router[_0x3ee2('0xa')]('/',auth[_0x3ee2('0xb')](),controller['index']);router['get']('/:id',auth[_0x3ee2('0xb')](),controller[_0x3ee2('0xc')]);router[_0x3ee2('0xa')]('/:id/test',auth[_0x3ee2('0xb')](),timeout(_0x3ee2('0xd')),controller['test']);router[_0x3ee2('0xe')]('/',auth[_0x3ee2('0xb')](),controller[_0x3ee2('0xf')]);router[_0x3ee2('0x10')](_0x3ee2('0x11'),auth[_0x3ee2('0xb')](),controller[_0x3ee2('0x12')]);router[_0x3ee2('0x13')](_0x3ee2('0x11'),auth[_0x3ee2('0xb')](),controller[_0x3ee2('0x14')]);module[_0x3ee2('0x15')]=router; \ No newline at end of file +var _0x968f=['15s','test','create','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/test'];(function(_0x5d82c0,_0x3fcc7f){var _0x67604b=function(_0x247df2){while(--_0x247df2){_0x5d82c0['push'](_0x5d82c0['shift']());}};_0x67604b(++_0x3fcc7f);}(_0x968f,0x1aa));var _0xf968=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x968f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf968('0x0'));var util=require(_0xf968('0x1'));var path=require(_0xf968('0x2'));var timeout=require(_0xf968('0x3'));var express=require(_0xf968('0x4'));var router=express['Router']();var fs_extra=require(_0xf968('0x5'));var auth=require(_0xf968('0x6'));var interaction=require(_0xf968('0x7'));var config=require(_0xf968('0x8'));var controller=require('./squareOdbc.controller');router[_0xf968('0x9')]('/',auth[_0xf968('0xa')](),controller['index']);router[_0xf968('0x9')](_0xf968('0xb'),auth[_0xf968('0xa')](),controller[_0xf968('0xc')]);router['get'](_0xf968('0xd'),auth['isAuthenticated'](),timeout(_0xf968('0xe')),controller[_0xf968('0xf')]);router['post']('/',auth[_0xf968('0xa')](),controller[_0xf968('0x10')]);router[_0xf968('0x11')](_0xf968('0xb'),auth[_0xf968('0xa')](),controller[_0xf968('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf968('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 9ce1c31..13f11f9 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 _0xa0a9=['STRING','name','sequelize'];(function(_0x4c6840,_0x97fe36){var _0x23e354=function(_0x5de5d7){while(--_0x5de5d7){_0x4c6840['push'](_0x4c6840['shift']());}};_0x23e354(++_0x97fe36);}(_0xa0a9,0x131));var _0x9a0a=function(_0x546e07,_0x383502){_0x546e07=_0x546e07-0x0;var _0x2463e2=_0xa0a9[_0x546e07];return _0x2463e2;};'use strict';var Sequelize=require(_0x9a0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a0a('0x1')],'unique':_0x9a0a('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfbd5=['STRING','name','sequelize','exports'];(function(_0x35f520,_0x51cca2){var _0x6c79ca=function(_0x248d6b){while(--_0x248d6b){_0x35f520['push'](_0x35f520['shift']());}};_0x6c79ca(++_0x51cca2);}(_0xfbd5,0x1ea));var _0x5fbd=function(_0x4f39b4,_0x3b5a51){_0x4f39b4=_0x4f39b4-0x0;var _0x3a5ec8=_0xfbd5[_0x4f39b4];return _0x3a5ec8;};'use strict';var Sequelize=require(_0x5fbd('0x0'));module[_0x5fbd('0x1')]={'name':{'type':Sequelize[_0x5fbd('0x2')],'unique':_0x5fbd('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5fbd('0x2')]},'description':{'type':Sequelize[_0x5fbd('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index c631ce5..2a2bbd7 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 _0x02df=['find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','error','name','send','index','map','SquareOdbc','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','create','user','role','ODBC'];(function(_0x4d3258,_0x3ccb47){var _0x27b67d=function(_0x5471e3){while(--_0x5471e3){_0x4d3258['push'](_0x4d3258['shift']());}};_0x27b67d(++_0x3ccb47);}(_0x02df,0x102));var _0xf02d=function(_0x55ddcd,_0x55a94a){_0x55ddcd=_0x55ddcd-0x0;var _0x2ab88e=_0x02df[_0x55ddcd];return _0x2ab88e;};'use strict';var emlformat=require(_0xf02d('0x0'));var rimraf=require(_0xf02d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf02d('0x2'));var rp=require(_0xf02d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf02d('0x4'));var path=require('path');var sox=require(_0xf02d('0x5'));var csv=require(_0xf02d('0x6'));var ejs=require(_0xf02d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf02d('0x8'));var crypto=require('crypto');var jsforce=require(_0xf02d('0x9'));var deskjs=require(_0xf02d('0xa'));var toCsv=require(_0xf02d('0x6'));var querystring=require(_0xf02d('0xb'));var Papa=require(_0xf02d('0xc'));var Redis=require('ioredis');var authService=require(_0xf02d('0xd'));var qs=require(_0xf02d('0xe'));var as=require(_0xf02d('0xf'));var hardwareService=require(_0xf02d('0x10'));var logger=require(_0xf02d('0x11'))(_0xf02d('0x12'));var utils=require(_0xf02d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf02d('0x14'));var db=require(_0xf02d('0x15'))['db'];function respondWithStatusCode(_0x58c69c,_0x94a08){_0x94a08=_0x94a08||0xcc;return function(_0x502604){if(_0x502604){return _0x58c69c[_0xf02d('0x16')](_0x94a08);}return _0x58c69c['status'](_0x94a08)[_0xf02d('0x17')]();};}function respondWithResult(_0x3c2c4e,_0x4e159f){_0x4e159f=_0x4e159f||0xc8;return function(_0x1c264d){if(_0x1c264d){return _0x3c2c4e[_0xf02d('0x18')](_0x4e159f)[_0xf02d('0x19')](_0x1c264d);}};}function respondWithFilteredResult(_0x57bb38,_0xa26cd){return function(_0x34c81d){if(_0x34c81d){var _0x938630=typeof _0xa26cd[_0xf02d('0x1a')]===_0xf02d('0x1b')&&typeof _0xa26cd[_0xf02d('0x1c')]===_0xf02d('0x1b');var _0x227ac3=_0x34c81d[_0xf02d('0x1d')];var _0xaa7707=_0x938630?0x0:_0xa26cd[_0xf02d('0x1a')];var _0x4b775e=_0x938630?_0x34c81d[_0xf02d('0x1d')]:_0xa26cd[_0xf02d('0x1a')]+_0xa26cd['limit'];var _0x1179e2;if(_0x4b775e>=_0x227ac3){_0x4b775e=_0x227ac3;_0x1179e2=0xc8;}else{_0x1179e2=0xce;}_0x57bb38['status'](_0x1179e2);return _0x57bb38[_0xf02d('0x1e')](_0xf02d('0x1f'),_0xaa7707+'-'+_0x4b775e+'/'+_0x227ac3)[_0xf02d('0x19')](_0x34c81d);}return null;};}function patchUpdates(_0x4b3ba8){return function(_0x495e64){try{jsonpatch[_0xf02d('0x20')](_0x495e64,_0x4b3ba8,!![]);}catch(_0x4fd6ed){return BPromise[_0xf02d('0x21')](_0x4fd6ed);}return _0x495e64[_0xf02d('0x22')]();};}function saveUpdates(_0x5c58e2,_0x4ede35){return function(_0x1fb845){if(_0x1fb845){return _0x1fb845[_0xf02d('0x23')](_0x5c58e2)[_0xf02d('0x24')](function(_0x5e8de7){return _0x5e8de7;});}return null;};}function removeEntity(_0x4fefe2,_0x16f6a5){return function(_0x1f3b06){if(_0x1f3b06){return _0x1f3b06['destroy']()['then'](function(){var _0x421fdc=_0x1f3b06['get']({'plain':!![]});var _0x2e0f47='ODBC';return db[_0xf02d('0x25')][_0xf02d('0x26')]({'where':{'type':_0x2e0f47,'resourceId':_0x421fdc['id']}})['then'](function(){return _0x1f3b06;});})[_0xf02d('0x24')](function(){_0x4fefe2[_0xf02d('0x18')](0xcc)[_0xf02d('0x17')]();});}};}function handleEntityNotFound(_0xf60c43,_0x33195f){return function(_0x17bc46){if(!_0x17bc46){_0xf60c43[_0xf02d('0x16')](0x194);}return _0x17bc46;};}function handleError(_0x38b567,_0x59f5d4){_0x59f5d4=_0x59f5d4||0x1f4;return function(_0x1c7970){logger[_0xf02d('0x27')](_0x1c7970['stack']);if(_0x1c7970[_0xf02d('0x28')]){delete _0x1c7970[_0xf02d('0x28')];}_0x38b567[_0xf02d('0x18')](_0x59f5d4)[_0xf02d('0x29')](_0x1c7970);};}exports[_0xf02d('0x2a')]=function(_0x1cd888,_0xd48c02){var _0x59a1cb={},_0x158699={},_0x9da443={'count':0x0,'rows':[]};var _0x498672=_[_0xf02d('0x2b')](db[_0xf02d('0x2c')]['rawAttributes'],function(_0x44acde){return{'name':_0x44acde[_0xf02d('0x2d')],'type':_0x44acde[_0xf02d('0x2e')][_0xf02d('0x2f')]};});_0x158699[_0xf02d('0x30')]=_[_0xf02d('0x2b')](_0x498672,'name');_0x158699['query']=_[_0xf02d('0x31')](_0x1cd888[_0xf02d('0x32')]);_0x158699[_0xf02d('0x33')]=_[_0xf02d('0x34')](_0x158699[_0xf02d('0x30')],_0x158699[_0xf02d('0x32')]);_0x59a1cb[_0xf02d('0x35')]=_[_0xf02d('0x34')](_0x158699[_0xf02d('0x30')],qs[_0xf02d('0x36')](_0x1cd888['query'][_0xf02d('0x36')]));_0x59a1cb['attributes']=_0x59a1cb['attributes'][_0xf02d('0x37')]?_0x59a1cb[_0xf02d('0x35')]:_0x158699[_0xf02d('0x30')];if(!_0x1cd888['query']['hasOwnProperty'](_0xf02d('0x38'))){_0x59a1cb[_0xf02d('0x1c')]=qs[_0xf02d('0x1c')](_0x1cd888[_0xf02d('0x32')][_0xf02d('0x1c')]);_0x59a1cb[_0xf02d('0x1a')]=qs[_0xf02d('0x1a')](_0x1cd888[_0xf02d('0x32')][_0xf02d('0x1a')]);}_0x59a1cb[_0xf02d('0x39')]=qs[_0xf02d('0x3a')](_0x1cd888[_0xf02d('0x32')]['sort']);_0x59a1cb[_0xf02d('0x3b')]=qs[_0xf02d('0x33')](_[_0xf02d('0x3c')](_0x1cd888[_0xf02d('0x32')],_0x158699[_0xf02d('0x33')]),_0x498672);if(_0x1cd888[_0xf02d('0x32')][_0xf02d('0x3d')]){_0x59a1cb[_0xf02d('0x3b')]=_[_0xf02d('0x3e')](_0x59a1cb[_0xf02d('0x3b')],{'$or':_[_0xf02d('0x2b')](_0x498672,function(_0x42c195){if(_0x42c195[_0xf02d('0x2e')]!=='VIRTUAL'){var _0x489797={};_0x489797[_0x42c195[_0xf02d('0x28')]]={'$like':'%'+_0x1cd888[_0xf02d('0x32')][_0xf02d('0x3d')]+'%'};return _0x489797;}})});}_0x59a1cb=_['merge']({},_0x59a1cb,_0x1cd888[_0xf02d('0x3f')]);var _0x427ff2={'where':_0x59a1cb[_0xf02d('0x3b')]};return db['SquareOdbc'][_0xf02d('0x1d')](_0x427ff2)[_0xf02d('0x24')](function(_0x13c0cc){_0x9da443['count']=_0x13c0cc;if(_0x1cd888[_0xf02d('0x32')][_0xf02d('0x40')]){_0x59a1cb[_0xf02d('0x41')]=[{'all':!![]}];}return db[_0xf02d('0x2c')][_0xf02d('0x42')](_0x59a1cb);})[_0xf02d('0x24')](function(_0x28cd79){_0x9da443['rows']=_0x28cd79;return _0x9da443;})[_0xf02d('0x24')](respondWithFilteredResult(_0xd48c02,_0x59a1cb))['catch'](handleError(_0xd48c02,null));};exports[_0xf02d('0x43')]=function(_0x5a0cd2,_0x53b243){var _0x108572={'raw':!![],'where':{'id':_0x5a0cd2[_0xf02d('0x44')]['id']}},_0xd0a3e4={};_0xd0a3e4[_0xf02d('0x30')]=_[_0xf02d('0x31')](db['SquareOdbc'][_0xf02d('0x45')]);_0xd0a3e4[_0xf02d('0x32')]=_[_0xf02d('0x31')](_0x5a0cd2['query']);_0xd0a3e4['filters']=_[_0xf02d('0x34')](_0xd0a3e4[_0xf02d('0x30')],_0xd0a3e4[_0xf02d('0x32')]);_0x108572[_0xf02d('0x35')]=_[_0xf02d('0x34')](_0xd0a3e4[_0xf02d('0x30')],qs[_0xf02d('0x36')](_0x5a0cd2[_0xf02d('0x32')][_0xf02d('0x36')]));_0x108572[_0xf02d('0x35')]=_0x108572['attributes'][_0xf02d('0x37')]?_0x108572['attributes']:_0xd0a3e4['model'];if(_0x5a0cd2['query'][_0xf02d('0x40')]){_0x108572[_0xf02d('0x41')]=[{'all':!![]}];}_0x108572=_[_0xf02d('0x3e')]({},_0x108572,_0x5a0cd2['options']);return db[_0xf02d('0x2c')]['find'](_0x108572)[_0xf02d('0x24')](handleEntityNotFound(_0x53b243,null))['then'](respondWithResult(_0x53b243,null))['catch'](handleError(_0x53b243,null));};exports[_0xf02d('0x46')]=function(_0x300232,_0x24a7a9){return db[_0xf02d('0x2c')][_0xf02d('0x46')](_0x300232['body'],{})[_0xf02d('0x24')](function(_0x48a306){var _0x5ba894=_0x300232[_0xf02d('0x47')]['get']({'plain':!![]});if(!_0x5ba894)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ba894[_0xf02d('0x48')]==='user'){var _0x35c4a4=_0x48a306['get']({'plain':!![]});var _0x15ac54=_0xf02d('0x49');return db['UserProfileSection'][_0xf02d('0x4a')]({'where':{'name':_0x15ac54,'userProfileId':_0x5ba894['userProfileId']},'raw':!![]})[_0xf02d('0x24')](function(_0x1e6d19){if(_0x1e6d19&&_0x1e6d19[_0xf02d('0x4b')]===0x0){return db[_0xf02d('0x25')]['create']({'name':_0x35c4a4[_0xf02d('0x28')],'resourceId':_0x35c4a4['id'],'type':_0x1e6d19['name'],'sectionId':_0x1e6d19['id']},{})[_0xf02d('0x24')](function(){return _0x48a306;});}else{return _0x48a306;}})[_0xf02d('0x4c')](function(_0x3597be){logger[_0xf02d('0x27')](_0xf02d('0x4d'),_0x3597be);throw _0x3597be;});}return _0x48a306;})['then'](respondWithResult(_0x24a7a9,0xc9))[_0xf02d('0x4c')](handleError(_0x24a7a9,null));};exports['update']=function(_0x4ce3ac,_0x1b8a2e){if(_0x4ce3ac[_0xf02d('0x4e')]['id']){delete _0x4ce3ac['body']['id'];}return db['SquareOdbc'][_0xf02d('0x4a')]({'where':{'id':_0x4ce3ac[_0xf02d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b8a2e,null))['then'](saveUpdates(_0x4ce3ac['body'],null))[_0xf02d('0x24')](respondWithResult(_0x1b8a2e,null))[_0xf02d('0x4c')](handleError(_0x1b8a2e,null));};exports['destroy']=function(_0x232bba,_0x322d7b){return db[_0xf02d('0x2c')]['find']({'where':{'id':_0x232bba[_0xf02d('0x44')]['id']}})[_0xf02d('0x24')](handleEntityNotFound(_0x322d7b,null))['then'](removeEntity(_0x322d7b,null))[_0xf02d('0x4c')](handleError(_0x322d7b,null));};exports[_0xf02d('0x4f')]=function(_0x2b5883,_0x84abd6,_0xc8f1df){var _0x33ac31;return db['SquareOdbc'][_0xf02d('0x4a')]({'where':{'id':_0x2b5883[_0xf02d('0x44')]['id']},'attributes':['id',_0xf02d('0x50')]})[_0xf02d('0x24')](handleEntityNotFound(_0x84abd6,null))['then'](function(_0x34770a){if(_0x34770a){var _0x3cf106=require('odbc')();_0x3cf106[_0xf02d('0x51')](_0x34770a[_0xf02d('0x50')]);_0x3cf106[_0xf02d('0x52')]();return _0x34770a;}})[_0xf02d('0x24')](respondWithResult(_0x84abd6,null))[_0xf02d('0x4c')](handleError(_0x84abd6,null));}; \ No newline at end of file +var _0x610c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','ODBC','error','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x506859,_0x24b589){var _0x31c601=function(_0x8d814){while(--_0x8d814){_0x506859['push'](_0x506859['shift']());}};_0x31c601(++_0x24b589);}(_0x610c,0x19d));var _0xc610=function(_0x261b08,_0x563d91){_0x261b08=_0x261b08-0x0;var _0xeeaf84=_0x610c[_0x261b08];return _0xeeaf84;};'use strict';var emlformat=require(_0xc610('0x0'));var rimraf=require(_0xc610('0x1'));var zipdir=require(_0xc610('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc610('0x3'));var moment=require('moment');var BPromise=require(_0xc610('0x4'));var Mustache=require(_0xc610('0x5'));var util=require('util');var path=require(_0xc610('0x6'));var sox=require('sox');var csv=require(_0xc610('0x7'));var ejs=require(_0xc610('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc610('0x9'));var crypto=require(_0xc610('0xa'));var jsforce=require(_0xc610('0xb'));var deskjs=require(_0xc610('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc610('0xd'));var Papa=require(_0xc610('0xe'));var Redis=require(_0xc610('0xf'));var authService=require(_0xc610('0x10'));var qs=require(_0xc610('0x11'));var as=require(_0xc610('0x12'));var hardwareService=require(_0xc610('0x13'));var logger=require(_0xc610('0x14'))(_0xc610('0x15'));var utils=require('../../config/utils');var config=require(_0xc610('0x16'));var licenseUtil=require(_0xc610('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x128ca5,_0x59e90d){_0x59e90d=_0x59e90d||0xcc;return function(_0x44da64){if(_0x44da64){return _0x128ca5[_0xc610('0x18')](_0x59e90d);}return _0x128ca5[_0xc610('0x19')](_0x59e90d)[_0xc610('0x1a')]();};}function respondWithResult(_0x4e3e39,_0x3cb89d){_0x3cb89d=_0x3cb89d||0xc8;return function(_0x573666){if(_0x573666){return _0x4e3e39[_0xc610('0x19')](_0x3cb89d)[_0xc610('0x1b')](_0x573666);}};}function respondWithFilteredResult(_0x202821,_0xe1a6d3){return function(_0x2480ec){if(_0x2480ec){var _0x32b28f=typeof _0xe1a6d3[_0xc610('0x1c')]==='undefined'&&typeof _0xe1a6d3[_0xc610('0x1d')]===_0xc610('0x1e');var _0x51e7f4=_0x2480ec[_0xc610('0x1f')];var _0x140bb2=_0x32b28f?0x0:_0xe1a6d3[_0xc610('0x1c')];var _0x3730d8=_0x32b28f?_0x2480ec[_0xc610('0x1f')]:_0xe1a6d3['offset']+_0xe1a6d3[_0xc610('0x1d')];var _0x23b68c;if(_0x3730d8>=_0x51e7f4){_0x3730d8=_0x51e7f4;_0x23b68c=0xc8;}else{_0x23b68c=0xce;}_0x202821[_0xc610('0x19')](_0x23b68c);return _0x202821['set'](_0xc610('0x20'),_0x140bb2+'-'+_0x3730d8+'/'+_0x51e7f4)[_0xc610('0x1b')](_0x2480ec);}return null;};}function patchUpdates(_0x10cffe){return function(_0x4f82b4){try{jsonpatch[_0xc610('0x21')](_0x4f82b4,_0x10cffe,!![]);}catch(_0xdd1801){return BPromise[_0xc610('0x22')](_0xdd1801);}return _0x4f82b4[_0xc610('0x23')]();};}function saveUpdates(_0x1bf8d0,_0x340ee2){return function(_0xcd469){if(_0xcd469){return _0xcd469[_0xc610('0x24')](_0x1bf8d0)['then'](function(_0x345ac2){return _0x345ac2;});}return null;};}function removeEntity(_0x4a5889,_0x146018){return function(_0x16ca8b){if(_0x16ca8b){return _0x16ca8b['destroy']()[_0xc610('0x25')](function(){var _0x139023=_0x16ca8b[_0xc610('0x26')]({'plain':!![]});var _0x10f6eb=_0xc610('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x10f6eb,'resourceId':_0x139023['id']}})[_0xc610('0x25')](function(){return _0x16ca8b;});})[_0xc610('0x25')](function(){_0x4a5889[_0xc610('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x379122,_0x4cde77){return function(_0x1268cf){if(!_0x1268cf){_0x379122[_0xc610('0x18')](0x194);}return _0x1268cf;};}function handleError(_0x562174,_0x18a85e){_0x18a85e=_0x18a85e||0x1f4;return function(_0x3cc319){logger[_0xc610('0x28')](_0x3cc319[_0xc610('0x29')]);if(_0x3cc319['name']){delete _0x3cc319[_0xc610('0x2a')];}_0x562174['status'](_0x18a85e)[_0xc610('0x2b')](_0x3cc319);};}exports[_0xc610('0x2c')]=function(_0x71d2ec,_0x3dd0f7){var _0x43b1d3={},_0x5af7c7={},_0x505551={'count':0x0,'rows':[]};var _0x5439b9=_[_0xc610('0x2d')](db[_0xc610('0x2e')][_0xc610('0x2f')],function(_0x21bd52){return{'name':_0x21bd52['fieldName'],'type':_0x21bd52[_0xc610('0x30')][_0xc610('0x31')]};});_0x5af7c7[_0xc610('0x32')]=_['map'](_0x5439b9,_0xc610('0x2a'));_0x5af7c7[_0xc610('0x33')]=_[_0xc610('0x34')](_0x71d2ec['query']);_0x5af7c7[_0xc610('0x35')]=_[_0xc610('0x36')](_0x5af7c7['model'],_0x5af7c7[_0xc610('0x33')]);_0x43b1d3['attributes']=_[_0xc610('0x36')](_0x5af7c7[_0xc610('0x32')],qs[_0xc610('0x37')](_0x71d2ec['query'][_0xc610('0x37')]));_0x43b1d3['attributes']=_0x43b1d3['attributes'][_0xc610('0x38')]?_0x43b1d3[_0xc610('0x39')]:_0x5af7c7[_0xc610('0x32')];if(!_0x71d2ec[_0xc610('0x33')][_0xc610('0x3a')]('nolimit')){_0x43b1d3[_0xc610('0x1d')]=qs[_0xc610('0x1d')](_0x71d2ec[_0xc610('0x33')]['limit']);_0x43b1d3['offset']=qs['offset'](_0x71d2ec[_0xc610('0x33')]['offset']);}_0x43b1d3[_0xc610('0x3b')]=qs[_0xc610('0x3c')](_0x71d2ec[_0xc610('0x33')][_0xc610('0x3c')]);_0x43b1d3['where']=qs[_0xc610('0x35')](_['pick'](_0x71d2ec[_0xc610('0x33')],_0x5af7c7[_0xc610('0x35')]),_0x5439b9);if(_0x71d2ec[_0xc610('0x33')]['filter']){_0x43b1d3[_0xc610('0x3d')]=_[_0xc610('0x3e')](_0x43b1d3['where'],{'$or':_[_0xc610('0x2d')](_0x5439b9,function(_0x420263){if(_0x420263[_0xc610('0x30')]!==_0xc610('0x3f')){var _0x5230be={};_0x5230be[_0x420263[_0xc610('0x2a')]]={'$like':'%'+_0x71d2ec[_0xc610('0x33')][_0xc610('0x40')]+'%'};return _0x5230be;}})});}_0x43b1d3=_[_0xc610('0x3e')]({},_0x43b1d3,_0x71d2ec[_0xc610('0x41')]);var _0x56ffa7={'where':_0x43b1d3[_0xc610('0x3d')]};return db['SquareOdbc'][_0xc610('0x1f')](_0x56ffa7)['then'](function(_0x499873){_0x505551[_0xc610('0x1f')]=_0x499873;if(_0x71d2ec['query']['includeAll']){_0x43b1d3[_0xc610('0x42')]=[{'all':!![]}];}return db[_0xc610('0x2e')][_0xc610('0x43')](_0x43b1d3);})[_0xc610('0x25')](function(_0x2b3c79){_0x505551[_0xc610('0x44')]=_0x2b3c79;return _0x505551;})[_0xc610('0x25')](respondWithFilteredResult(_0x3dd0f7,_0x43b1d3))[_0xc610('0x45')](handleError(_0x3dd0f7,null));};exports[_0xc610('0x46')]=function(_0x32ac09,_0x15f0aa){var _0x416319={'raw':!![],'where':{'id':_0x32ac09['params']['id']}},_0x73ca26={};_0x73ca26[_0xc610('0x32')]=_[_0xc610('0x34')](db[_0xc610('0x2e')][_0xc610('0x2f')]);_0x73ca26[_0xc610('0x33')]=_['keys'](_0x32ac09['query']);_0x73ca26[_0xc610('0x35')]=_['intersection'](_0x73ca26[_0xc610('0x32')],_0x73ca26[_0xc610('0x33')]);_0x416319[_0xc610('0x39')]=_[_0xc610('0x36')](_0x73ca26[_0xc610('0x32')],qs[_0xc610('0x37')](_0x32ac09['query'][_0xc610('0x37')]));_0x416319['attributes']=_0x416319['attributes'][_0xc610('0x38')]?_0x416319[_0xc610('0x39')]:_0x73ca26[_0xc610('0x32')];if(_0x32ac09['query'][_0xc610('0x47')]){_0x416319[_0xc610('0x42')]=[{'all':!![]}];}_0x416319=_['merge']({},_0x416319,_0x32ac09[_0xc610('0x41')]);return db['SquareOdbc'][_0xc610('0x48')](_0x416319)[_0xc610('0x25')](handleEntityNotFound(_0x15f0aa,null))[_0xc610('0x25')](respondWithResult(_0x15f0aa,null))[_0xc610('0x45')](handleError(_0x15f0aa,null));};exports[_0xc610('0x49')]=function(_0x5cb055,_0x3b4579){return db[_0xc610('0x2e')][_0xc610('0x49')](_0x5cb055['body'],{})[_0xc610('0x25')](function(_0x4655ae){var _0x43a058=_0x5cb055[_0xc610('0x4a')][_0xc610('0x26')]({'plain':!![]});if(!_0x43a058)throw new Error(_0xc610('0x4b'));if(_0x43a058[_0xc610('0x4c')]===_0xc610('0x4a')){var _0x59d478=_0x4655ae[_0xc610('0x26')]({'plain':!![]});var _0x246e53=_0xc610('0x27');return db['UserProfileSection'][_0xc610('0x48')]({'where':{'name':_0x246e53,'userProfileId':_0x43a058[_0xc610('0x4d')]},'raw':!![]})[_0xc610('0x25')](function(_0x189353){if(_0x189353&&_0x189353['autoAssociation']===0x0){return db[_0xc610('0x4e')][_0xc610('0x49')]({'name':_0x59d478[_0xc610('0x2a')],'resourceId':_0x59d478['id'],'type':_0x189353[_0xc610('0x2a')],'sectionId':_0x189353['id']},{})['then'](function(){return _0x4655ae;});}else{return _0x4655ae;}})['catch'](function(_0x594fcf){logger[_0xc610('0x28')](_0xc610('0x4f'),_0x594fcf);throw _0x594fcf;});}return _0x4655ae;})[_0xc610('0x25')](respondWithResult(_0x3b4579,0xc9))[_0xc610('0x45')](handleError(_0x3b4579,null));};exports[_0xc610('0x24')]=function(_0xef6228,_0x48c6fa){if(_0xef6228[_0xc610('0x50')]['id']){delete _0xef6228[_0xc610('0x50')]['id'];}return db[_0xc610('0x2e')][_0xc610('0x48')]({'where':{'id':_0xef6228[_0xc610('0x51')]['id']}})[_0xc610('0x25')](handleEntityNotFound(_0x48c6fa,null))[_0xc610('0x25')](saveUpdates(_0xef6228[_0xc610('0x50')],null))[_0xc610('0x25')](respondWithResult(_0x48c6fa,null))[_0xc610('0x45')](handleError(_0x48c6fa,null));};exports[_0xc610('0x52')]=function(_0x2394df,_0x428079){return db[_0xc610('0x2e')][_0xc610('0x48')]({'where':{'id':_0x2394df[_0xc610('0x51')]['id']}})[_0xc610('0x25')](handleEntityNotFound(_0x428079,null))[_0xc610('0x25')](removeEntity(_0x428079,null))[_0xc610('0x45')](handleError(_0x428079,null));};exports['test']=function(_0x2801cf,_0x12bb87,_0x3c6a3e){var _0x54bbf0;return db['SquareOdbc'][_0xc610('0x48')]({'where':{'id':_0x2801cf[_0xc610('0x51')]['id']},'attributes':['id',_0xc610('0x53')]})[_0xc610('0x25')](handleEntityNotFound(_0x12bb87,null))['then'](function(_0x174d3f){if(_0x174d3f){var _0x37f7e5=require('odbc')();_0x37f7e5[_0xc610('0x54')](_0x174d3f[_0xc610('0x53')]);_0x37f7e5[_0xc610('0x55')]();return _0x174d3f;}})[_0xc610('0x25')](respondWithResult(_0x12bb87,null))[_0xc610('0x45')](handleError(_0x12bb87,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ea43024..f9fbdeb 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 _0xd72b=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x247941,_0x7c4677){var _0x47ee6c=function(_0x133c6d){while(--_0x133c6d){_0x247941['push'](_0x247941['shift']());}};_0x47ee6c(++_0x7c4677);}(_0xd72b,0xc6));var _0xbd72=function(_0x3bd528,_0x5cdaeb){_0x3bd528=_0x3bd528-0x0;var _0x963c7c=_0xd72b[_0x3bd528];return _0x963c7c;};'use strict';var _=require(_0xbd72('0x0'));var util=require(_0xbd72('0x1'));var logger=require(_0xbd72('0x2'))(_0xbd72('0x3'));var moment=require(_0xbd72('0x4'));var BPromise=require(_0xbd72('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbd72('0x6'));var attributes=require(_0xbd72('0x7'));module[_0xbd72('0x8')]=function(_0x597af6,_0x3c105a){return _0x597af6[_0xbd72('0x9')](_0xbd72('0xa'),attributes,{'tableName':_0xbd72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa59d=['bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','api'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0xa59d,0xc9));var _0xda59=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa59d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xda59('0x0'));var util=require(_0xda59('0x1'));var logger=require('../../config/logger')(_0xda59('0x2'));var moment=require('moment');var BPromise=require(_0xda59('0x3'));var rp=require(_0xda59('0x4'));var fs=require('fs');var path=require(_0xda59('0x5'));var rimraf=require(_0xda59('0x6'));var config=require('../../config/environment');var attributes=require(_0xda59('0x7'));module[_0xda59('0x8')]=function(_0x58dd91,_0x367660){return _0x58dd91[_0xda59('0x9')](_0xda59('0xa'),attributes,{'tableName':_0xda59('0xb'),'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 1625acd..a3c048a 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 _0x8a82=['include','model','debug','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','catch','ShowSquareOdbc','SquareOdbc','options','raw','attributes','map'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8a82,0x1ce));var _0x28a8=function(_0x5dd0f3,_0x2292b5){_0x5dd0f3=_0x5dd0f3-0x0;var _0x54358a=_0x8a82[_0x5dd0f3];return _0x54358a;};'use strict';var _=require(_0x28a8('0x0'));var util=require(_0x28a8('0x1'));var moment=require(_0x28a8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x28a8('0x4'))(_0x28a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x28a8('0x6'));var client=jayson['client'][_0x28a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x383862,_0x1677f8,_0xd2ddda){return new BPromise(function(_0x4bcf1a,_0xff0fce){return client['request'](_0x383862,_0xd2ddda)[_0x28a8('0x8')](function(_0x52ba40){logger[_0x28a8('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x1677f8,_0x28a8('0xa'));logger['debug'](_0x28a8('0xb'),_0x1677f8,_0x28a8('0xa'),JSON[_0x28a8('0xc')](_0x52ba40));if(_0x52ba40[_0x28a8('0xd')]){if(_0x52ba40[_0x28a8('0xd')][_0x28a8('0xe')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1677f8,_0x52ba40[_0x28a8('0xd')][_0x28a8('0xf')]);return _0xff0fce(_0x52ba40[_0x28a8('0xd')][_0x28a8('0xf')]);}logger['error'](_0x28a8('0x10'),_0x1677f8,_0x52ba40[_0x28a8('0xd')][_0x28a8('0xf')]);return _0x4bcf1a(_0x52ba40[_0x28a8('0xd')][_0x28a8('0xf')]);}else{logger[_0x28a8('0x9')](_0x28a8('0x10'),_0x1677f8,_0x28a8('0xa'));_0x4bcf1a(_0x52ba40['result'][_0x28a8('0xf')]);}})[_0x28a8('0x11')](function(_0x2fdc8d){logger[_0x28a8('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x1677f8,_0x2fdc8d);_0xff0fce(_0x2fdc8d);});});}exports[_0x28a8('0x12')]=function(_0x4203eb){var _0x5546e1=this;return new Promise(function(_0x4345cb,_0x55a9f8){return db[_0x28a8('0x13')]['find']({'raw':_0x4203eb[_0x28a8('0x14')]?_0x4203eb[_0x28a8('0x14')][_0x28a8('0x15')]===undefined?!![]:![]:!![],'where':_0x4203eb['options']?_0x4203eb[_0x28a8('0x14')]['where']||null:null,'attributes':_0x4203eb[_0x28a8('0x14')]?_0x4203eb[_0x28a8('0x14')][_0x28a8('0x16')]||null:null,'include':_0x4203eb[_0x28a8('0x14')]?_0x4203eb[_0x28a8('0x14')]['include']?_[_0x28a8('0x17')](_0x4203eb[_0x28a8('0x14')][_0x28a8('0x18')],function(_0xf933fc){return{'model':db[_0xf933fc[_0x28a8('0x19')]],'as':_0xf933fc['as'],'attributes':_0xf933fc[_0x28a8('0x16')],'include':_0xf933fc['include']?_[_0x28a8('0x17')](_0xf933fc[_0x28a8('0x18')],function(_0xee7823){return{'model':db[_0xee7823[_0x28a8('0x19')]],'as':_0xee7823['as'],'attributes':_0xee7823['attributes'],'include':_0xee7823['include']?_[_0x28a8('0x17')](_0xee7823['include'],function(_0x1e3a3b){return{'model':db[_0x1e3a3b['model']],'as':_0x1e3a3b['as'],'attributes':_0x1e3a3b[_0x28a8('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x167717){logger[_0x28a8('0x9')](_0x28a8('0x12'),_0x4203eb);logger[_0x28a8('0x1a')](_0x28a8('0x12'),_0x4203eb,JSON['stringify'](_0x167717));_0x4345cb(_0x167717);})[_0x28a8('0x11')](function(_0x1680cc){logger[_0x28a8('0xd')](_0x28a8('0x12'),_0x1680cc[_0x28a8('0xf')],_0x4203eb);_0x55a9f8(_0x5546e1[_0x28a8('0xd')](0x1f4,_0x1680cc['message']));});});}; \ No newline at end of file +var _0xd241=['catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x53d2d4,_0x1f63eb){var _0x2128d2=function(_0x5e9f21){while(--_0x5e9f21){_0x53d2d4['push'](_0x53d2d4['shift']());}};_0x2128d2(++_0x1f63eb);}(_0xd241,0x1cb));var _0x1d24=function(_0x43d642,_0x50e354){_0x43d642=_0x43d642-0x0;var _0x440361=_0xd241[_0x43d642];return _0x440361;};'use strict';var _=require('lodash');var util=require(_0x1d24('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d24('0x1'));var fs=require('fs');var Redis=require(_0x1d24('0x2'));var db=require(_0x1d24('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d24('0x4'))(_0x1d24('0x5'));var config=require(_0x1d24('0x6'));var jayson=require(_0x1d24('0x7'));var client=jayson[_0x1d24('0x8')][_0x1d24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151c65,_0x1185d6,_0x3dceae){return new BPromise(function(_0x14a8b2,_0x20c1c4){return client['request'](_0x151c65,_0x3dceae)[_0x1d24('0xa')](function(_0x3eb9d9){logger['info'](_0x1d24('0xb'),_0x1185d6,'request\x20sent');logger[_0x1d24('0xc')](_0x1d24('0xd'),_0x1185d6,_0x1d24('0xe'),JSON[_0x1d24('0xf')](_0x3eb9d9));if(_0x3eb9d9[_0x1d24('0x10')]){if(_0x3eb9d9[_0x1d24('0x10')][_0x1d24('0x11')]===0x1f4){logger[_0x1d24('0x10')](_0x1d24('0xb'),_0x1185d6,_0x3eb9d9['error'][_0x1d24('0x12')]);return _0x20c1c4(_0x3eb9d9[_0x1d24('0x10')]['message']);}logger[_0x1d24('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x1185d6,_0x3eb9d9[_0x1d24('0x10')]['message']);return _0x14a8b2(_0x3eb9d9[_0x1d24('0x10')][_0x1d24('0x12')]);}else{logger[_0x1d24('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x1185d6,'request\x20sent');_0x14a8b2(_0x3eb9d9[_0x1d24('0x14')][_0x1d24('0x12')]);}})[_0x1d24('0x15')](function(_0x3f5371){logger[_0x1d24('0x10')](_0x1d24('0xb'),_0x1185d6,_0x3f5371);_0x20c1c4(_0x3f5371);});});}exports[_0x1d24('0x16')]=function(_0x19ddb4){var _0x547b47=this;return new Promise(function(_0x1880ae,_0x9c8078){return db[_0x1d24('0x17')][_0x1d24('0x18')]({'raw':_0x19ddb4[_0x1d24('0x19')]?_0x19ddb4['options'][_0x1d24('0x1a')]===undefined?!![]:![]:!![],'where':_0x19ddb4[_0x1d24('0x19')]?_0x19ddb4[_0x1d24('0x19')][_0x1d24('0x1b')]||null:null,'attributes':_0x19ddb4[_0x1d24('0x19')]?_0x19ddb4['options'][_0x1d24('0x1c')]||null:null,'include':_0x19ddb4['options']?_0x19ddb4['options'][_0x1d24('0x1d')]?_[_0x1d24('0x1e')](_0x19ddb4['options']['include'],function(_0x5ea360){return{'model':db[_0x5ea360[_0x1d24('0x1f')]],'as':_0x5ea360['as'],'attributes':_0x5ea360[_0x1d24('0x1c')],'include':_0x5ea360[_0x1d24('0x1d')]?_[_0x1d24('0x1e')](_0x5ea360['include'],function(_0x27e04a){return{'model':db[_0x27e04a[_0x1d24('0x1f')]],'as':_0x27e04a['as'],'attributes':_0x27e04a[_0x1d24('0x1c')],'include':_0x27e04a['include']?_[_0x1d24('0x1e')](_0x27e04a['include'],function(_0x14d4d3){return{'model':db[_0x14d4d3['model']],'as':_0x14d4d3['as'],'attributes':_0x14d4d3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x582fa4){logger[_0x1d24('0x13')](_0x1d24('0x16'),_0x19ddb4);logger[_0x1d24('0xc')]('ShowSquareOdbc',_0x19ddb4,JSON[_0x1d24('0xf')](_0x582fa4));_0x1880ae(_0x582fa4);})['catch'](function(_0x568d11){logger[_0x1d24('0x10')](_0x1d24('0x16'),_0x568d11[_0x1d24('0x12')],_0x19ddb4);_0x9c8078(_0x547b47[_0x1d24('0x10')](0x1f4,_0x568d11[_0x1d24('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 6c40a9a..194baea 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 _0xc900=['delete','removeUsers','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','getUsers','post','create','addUsers','/:id','update','destroy'];(function(_0x5dc155,_0x4dc627){var _0x291762=function(_0x11c584){while(--_0x11c584){_0x5dc155['push'](_0x5dc155['shift']());}};_0x291762(++_0x4dc627);}(_0xc900,0xb3));var _0x0c90=function(_0x5c2f75,_0xefea71){_0x5c2f75=_0x5c2f75-0x0;var _0x4f46ac=_0xc900[_0x5c2f75];return _0x4f46ac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0xd')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xd')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xf')]);router['put'](_0x0c90('0x10'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['delete'](_0x0c90('0x10'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x12')]);router[_0x0c90('0x13')](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x14')]);module[_0x0c90('0x15')]=router; \ No newline at end of file +var _0xde80=['/:id/users','getUsers','post','create','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xde80,0x1d1));var _0x0de8=function(_0x4f031d,_0x407851){_0x4f031d=_0x4f031d-0x0;var _0x175dab=_0xde80[_0x4f031d];return _0x175dab;};'use strict';var multer=require(_0x0de8('0x0'));var util=require(_0x0de8('0x1'));var path=require(_0x0de8('0x2'));var timeout=require(_0x0de8('0x3'));var express=require(_0x0de8('0x4'));var router=express[_0x0de8('0x5')]();var fs_extra=require(_0x0de8('0x6'));var auth=require(_0x0de8('0x7'));var interaction=require(_0x0de8('0x8'));var config=require(_0x0de8('0x9'));var controller=require('./squareProject.controller');router[_0x0de8('0xa')]('/',auth[_0x0de8('0xb')](),controller[_0x0de8('0xc')]);router['get'](_0x0de8('0xd'),auth[_0x0de8('0xb')](),controller[_0x0de8('0xe')]);router[_0x0de8('0xa')](_0x0de8('0xf'),auth[_0x0de8('0xb')](),controller[_0x0de8('0x10')]);router[_0x0de8('0x11')]('/',auth['isAuthenticated'](),controller[_0x0de8('0x12')]);router[_0x0de8('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addUsers']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0de8('0x13')]);router[_0x0de8('0x14')]('/:id',auth[_0x0de8('0xb')](),controller[_0x0de8('0x15')]);router['delete'](_0x0de8('0xf'),auth['isAuthenticated'](),controller[_0x0de8('0x16')]);module[_0x0de8('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index e54bd49..4c8ece5 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 _0x4a03=['preproduction','getDataValue','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB','long'];(function(_0x567097,_0x345516){var _0x5e84f8=function(_0x290ebc){while(--_0x290ebc){_0x567097['push'](_0x567097['shift']());}};_0x5e84f8(++_0x345516);}(_0x4a03,0x16e));var _0x34a0=function(_0xf7d89b,_0x362b7c){_0xf7d89b=_0xf7d89b-0x0;var _0x2485cb=_0x4a03[_0xf7d89b];return _0x2485cb;};'use strict';var Sequelize=require('sequelize');module[_0x34a0('0x0')]={'name':{'type':Sequelize[_0x34a0('0x1')],'unique':_0x34a0('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x34a0('0x3')]},'preproduction':{'type':Sequelize[_0x34a0('0x4')](_0x34a0('0x5')),'get':function(){if(this['getDataValue'](_0x34a0('0x6'))){return this[_0x34a0('0x7')]('preproduction')[_0x34a0('0x8')](_0x34a0('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x34a0('0x5')),'get':function(){if(this[_0x34a0('0x7')]('production')){return this[_0x34a0('0x7')](_0x34a0('0xa'))[_0x34a0('0x8')](_0x34a0('0x9'));}}},'savedAt':{'type':Sequelize[_0x34a0('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2ff5=['long','getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING','TEXT','BLOB'];(function(_0x2b3f99,_0x37d079){var _0x369a96=function(_0x1ba09e){while(--_0x1ba09e){_0x2b3f99['push'](_0x2b3f99['shift']());}};_0x369a96(++_0x37d079);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x10eb38,_0x270821){_0x10eb38=_0x10eb38-0x0;var _0x17afaf=_0x2ff5[_0x10eb38];return _0x17afaf;};'use strict';var Sequelize=require('sequelize');module[_0x52ff('0x0')]={'name':{'type':Sequelize[_0x52ff('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x52ff('0x1')]},'notes':{'type':Sequelize[_0x52ff('0x2')]},'preproduction':{'type':Sequelize[_0x52ff('0x3')](_0x52ff('0x4')),'get':function(){if(this[_0x52ff('0x5')](_0x52ff('0x6'))){return this['getDataValue'](_0x52ff('0x6'))[_0x52ff('0x7')](_0x52ff('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x52ff('0x4')),'get':function(){if(this[_0x52ff('0x5')](_0x52ff('0x9'))){return this[_0x52ff('0x5')](_0x52ff('0x9'))[_0x52ff('0x7')](_0x52ff('0x8'));}}},'savedAt':{'type':Sequelize[_0x52ff('0xa')]},'publishedAt':{'type':Sequelize[_0x52ff('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 35739be..ff0faa0 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 _0x80a4=['jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','SquareProject','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x80a4,0x118));var _0x480a=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x80a4[_0xfedc72];return _0x2c7c78;};'use strict';var emlformat=require(_0x480a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x480a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x480a('0x2'));var moment=require(_0x480a('0x3'));var BPromise=require(_0x480a('0x4'));var Mustache=require(_0x480a('0x5'));var util=require(_0x480a('0x6'));var path=require(_0x480a('0x7'));var sox=require(_0x480a('0x8'));var csv=require(_0x480a('0x9'));var ejs=require(_0x480a('0xa'));var fs=require('fs');var fs_extra=require(_0x480a('0xb'));var _=require(_0x480a('0xc'));var squel=require('squel');var crypto=require(_0x480a('0xd'));var jsforce=require(_0x480a('0xe'));var deskjs=require(_0x480a('0xf'));var toCsv=require(_0x480a('0x9'));var querystring=require(_0x480a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x480a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x480a('0x12'))(_0x480a('0x13'));var utils=require(_0x480a('0x14'));var config=require(_0x480a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x480a('0x16'))['db'];config[_0x480a('0x17')]=_[_0x480a('0x18')](config[_0x480a('0x17')],{'host':_0x480a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x480a('0x17')]));require(_0x480a('0x1a'))[_0x480a('0x1b')](socket);function respondWithStatusCode(_0xef322,_0x54400d){_0x54400d=_0x54400d||0xcc;return function(_0x4a605a){if(_0x4a605a){return _0xef322['sendStatus'](_0x54400d);}return _0xef322[_0x480a('0x1c')](_0x54400d)[_0x480a('0x1d')]();};}function respondWithResult(_0x2e7d35,_0x156f31){_0x156f31=_0x156f31||0xc8;return function(_0x841c17){if(_0x841c17){return _0x2e7d35[_0x480a('0x1c')](_0x156f31)[_0x480a('0x1e')](_0x841c17);}};}function respondWithFilteredResult(_0x287a6b,_0x430ac4){return function(_0xff5f39){if(_0xff5f39){var _0x2db834=typeof _0x430ac4[_0x480a('0x1f')]===_0x480a('0x20')&&typeof _0x430ac4[_0x480a('0x21')]===_0x480a('0x20');var _0xfa62c5=_0xff5f39[_0x480a('0x22')];var _0x33a877=_0x2db834?0x0:_0x430ac4[_0x480a('0x1f')];var _0x212480=_0x2db834?_0xff5f39[_0x480a('0x22')]:_0x430ac4[_0x480a('0x1f')]+_0x430ac4['limit'];var _0x52b36c;if(_0x212480>=_0xfa62c5){_0x212480=_0xfa62c5;_0x52b36c=0xc8;}else{_0x52b36c=0xce;}_0x287a6b['status'](_0x52b36c);return _0x287a6b[_0x480a('0x23')](_0x480a('0x24'),_0x33a877+'-'+_0x212480+'/'+_0xfa62c5)[_0x480a('0x1e')](_0xff5f39);}return null;};}function patchUpdates(_0x3d6802){return function(_0x58f80d){try{jsonpatch[_0x480a('0x25')](_0x58f80d,_0x3d6802,!![]);}catch(_0x12a2f0){return BPromise[_0x480a('0x26')](_0x12a2f0);}return _0x58f80d[_0x480a('0x27')]();};}function saveUpdates(_0x3e5c54,_0x2b8638){return function(_0x46430a){if(_0x46430a){return _0x46430a['update'](_0x3e5c54)[_0x480a('0x28')](function(_0x44aa71){return _0x44aa71;});}return null;};}function removeEntity(_0x466da5,_0x13a8c0){return function(_0x5b8483){if(_0x5b8483){return _0x5b8483['destroy']()[_0x480a('0x28')](function(){var _0x4330c3=_0x5b8483['get']({'plain':!![]});var _0x585dc9='SquareProjects';return db['UserProfileResource'][_0x480a('0x29')]({'where':{'type':_0x585dc9,'resourceId':_0x4330c3['id']}})[_0x480a('0x28')](function(){return _0x5b8483;});})[_0x480a('0x28')](function(){_0x466da5['status'](0xcc)[_0x480a('0x1d')]();});}};}function handleEntityNotFound(_0x541241,_0x4e0416){return function(_0x1f085b){if(!_0x1f085b){_0x541241['sendStatus'](0x194);}return _0x1f085b;};}function handleError(_0x34308d,_0x55cdf3){_0x55cdf3=_0x55cdf3||0x1f4;return function(_0x24da2c){logger[_0x480a('0x2a')](_0x24da2c[_0x480a('0x2b')]);if(_0x24da2c[_0x480a('0x2c')]){delete _0x24da2c[_0x480a('0x2c')];}_0x34308d['status'](_0x55cdf3)[_0x480a('0x2d')](_0x24da2c);};}exports[_0x480a('0x2e')]=function(_0x3a2f2c,_0x52b742){var _0x105f85={},_0x3b0c42={},_0x1448bf={'count':0x0,'rows':[]};var _0x5a7166=_['map'](db[_0x480a('0x2f')]['rawAttributes'],function(_0x598ec7){return{'name':_0x598ec7[_0x480a('0x30')],'type':_0x598ec7[_0x480a('0x31')][_0x480a('0x32')]};});_0x3b0c42[_0x480a('0x33')]=_['map'](_0x5a7166,_0x480a('0x2c'));_0x3b0c42['query']=_[_0x480a('0x34')](_0x3a2f2c['query']);_0x3b0c42[_0x480a('0x35')]=_['intersection'](_0x3b0c42[_0x480a('0x33')],_0x3b0c42[_0x480a('0x36')]);_0x105f85[_0x480a('0x37')]=_[_0x480a('0x38')](_0x3b0c42['model'],qs['fields'](_0x3a2f2c[_0x480a('0x36')][_0x480a('0x39')]));_0x105f85[_0x480a('0x37')]=_0x105f85[_0x480a('0x37')]['length']?_0x105f85[_0x480a('0x37')]:_0x3b0c42[_0x480a('0x33')];if(!_0x3a2f2c[_0x480a('0x36')][_0x480a('0x3a')](_0x480a('0x3b'))){_0x105f85[_0x480a('0x21')]=qs['limit'](_0x3a2f2c[_0x480a('0x36')][_0x480a('0x21')]);_0x105f85[_0x480a('0x1f')]=qs[_0x480a('0x1f')](_0x3a2f2c[_0x480a('0x36')][_0x480a('0x1f')]);}_0x105f85[_0x480a('0x3c')]=qs[_0x480a('0x3d')](_0x3a2f2c[_0x480a('0x36')][_0x480a('0x3d')]);_0x105f85[_0x480a('0x3e')]=qs[_0x480a('0x35')](_[_0x480a('0x3f')](_0x3a2f2c[_0x480a('0x36')],_0x3b0c42[_0x480a('0x35')]),_0x5a7166);if(_0x3a2f2c[_0x480a('0x36')][_0x480a('0x40')]){_0x105f85[_0x480a('0x3e')]=_[_0x480a('0x41')](_0x105f85[_0x480a('0x3e')],{'$or':_[_0x480a('0x42')](_0x5a7166,function(_0x469db1){if(_0x469db1['type']!==_0x480a('0x43')){var _0x56bd5a={};_0x56bd5a[_0x469db1['name']]={'$like':'%'+_0x3a2f2c[_0x480a('0x36')][_0x480a('0x40')]+'%'};return _0x56bd5a;}})});}_0x105f85=_[_0x480a('0x41')]({},_0x105f85,_0x3a2f2c[_0x480a('0x44')]);var _0x10dfbb={'where':_0x105f85[_0x480a('0x3e')]};return db[_0x480a('0x2f')][_0x480a('0x22')](_0x10dfbb)[_0x480a('0x28')](function(_0x257f8c){_0x1448bf[_0x480a('0x22')]=_0x257f8c;if(_0x3a2f2c[_0x480a('0x36')][_0x480a('0x45')]){_0x105f85[_0x480a('0x46')]=[{'all':!![]}];}return db[_0x480a('0x2f')]['findAll'](_0x105f85);})[_0x480a('0x28')](function(_0x49d2d2){_0x1448bf[_0x480a('0x47')]=_0x49d2d2;return _0x1448bf;})['then'](respondWithFilteredResult(_0x52b742,_0x105f85))['catch'](handleError(_0x52b742,null));};exports[_0x480a('0x48')]=function(_0x202eff,_0x16218d){var _0x33712f={'raw':![],'where':{'id':_0x202eff[_0x480a('0x49')]['id']}},_0x87114d={};_0x87114d[_0x480a('0x33')]=_['keys'](db[_0x480a('0x2f')][_0x480a('0x4a')]);_0x87114d[_0x480a('0x36')]=_[_0x480a('0x34')](_0x202eff[_0x480a('0x36')]);_0x87114d[_0x480a('0x35')]=_[_0x480a('0x38')](_0x87114d[_0x480a('0x33')],_0x87114d[_0x480a('0x36')]);_0x33712f[_0x480a('0x37')]=_['intersection'](_0x87114d[_0x480a('0x33')],qs[_0x480a('0x39')](_0x202eff[_0x480a('0x36')][_0x480a('0x39')]));_0x33712f[_0x480a('0x37')]=_0x33712f[_0x480a('0x37')][_0x480a('0x4b')]?_0x33712f[_0x480a('0x37')]:_0x87114d[_0x480a('0x33')];if(_0x202eff['query']['includeAll']){_0x33712f[_0x480a('0x46')]=[{'all':!![]}];}_0x33712f=_['merge']({},_0x33712f,_0x202eff[_0x480a('0x44')]);return db[_0x480a('0x2f')][_0x480a('0x4c')](_0x33712f)[_0x480a('0x28')](handleEntityNotFound(_0x16218d,null))[_0x480a('0x28')](respondWithResult(_0x16218d,null))[_0x480a('0x4d')](handleError(_0x16218d,null));};exports[_0x480a('0x4e')]=function(_0x13edb7,_0x2333ff){return db[_0x480a('0x2f')]['create'](_0x13edb7['body'],{})[_0x480a('0x28')](function(_0x3b4d83){var _0x235080=_0x13edb7[_0x480a('0x4f')][_0x480a('0x50')]({'plain':!![]});if(!_0x235080)throw new Error(_0x480a('0x51'));if(_0x235080[_0x480a('0x52')]===_0x480a('0x4f')){var _0x412cfd=_0x3b4d83['get']({'plain':!![]});var _0xd9f0b1=_0x480a('0x53');return db[_0x480a('0x54')][_0x480a('0x4c')]({'where':{'name':_0xd9f0b1,'userProfileId':_0x235080[_0x480a('0x55')]},'raw':!![]})[_0x480a('0x28')](function(_0x5572f6){if(_0x5572f6&&_0x5572f6['autoAssociation']===0x0){return db[_0x480a('0x56')]['create']({'name':_0x412cfd[_0x480a('0x2c')],'resourceId':_0x412cfd['id'],'type':_0x5572f6[_0x480a('0x2c')],'sectionId':_0x5572f6['id']},{})['then'](function(){return _0x3b4d83;});}else{return _0x3b4d83;}})[_0x480a('0x4d')](function(_0x11670f){logger[_0x480a('0x2a')](_0x480a('0x57'),_0x11670f);throw _0x11670f;});}return _0x3b4d83;})[_0x480a('0x28')](respondWithResult(_0x2333ff,0xc9))['catch'](handleError(_0x2333ff,null));};exports[_0x480a('0x58')]=function(_0x22407f,_0x56ed26){if(_0x22407f[_0x480a('0x59')]['id']){delete _0x22407f[_0x480a('0x59')]['id'];}return db[_0x480a('0x2f')]['find']({'where':{'id':_0x22407f[_0x480a('0x49')]['id']}})[_0x480a('0x28')](handleEntityNotFound(_0x56ed26,null))[_0x480a('0x28')](saveUpdates(_0x22407f[_0x480a('0x59')],null))['then'](respondWithResult(_0x56ed26,null))['catch'](handleError(_0x56ed26,null));};exports[_0x480a('0x29')]=function(_0x5b278e,_0x5a7dc1){return db[_0x480a('0x2f')][_0x480a('0x4c')]({'where':{'id':_0x5b278e[_0x480a('0x49')]['id']}})[_0x480a('0x28')](handleEntityNotFound(_0x5a7dc1,null))['then'](removeEntity(_0x5a7dc1,null))[_0x480a('0x4d')](handleError(_0x5a7dc1,null));};exports[_0x480a('0x5a')]=function(_0x4a389c,_0x1478a8,_0x4ae435){return db[_0x480a('0x2f')][_0x480a('0x4c')]({'where':{'id':_0x4a389c[_0x480a('0x49')]['id']}})[_0x480a('0x28')](handleEntityNotFound(_0x1478a8,null))[_0x480a('0x28')](function(_0x8ea0df){if(_0x8ea0df){return _0x8ea0df[_0x480a('0x5a')](_0x4a389c[_0x480a('0x59')][_0x480a('0x5b')],_['omit'](_0x4a389c[_0x480a('0x59')],[_0x480a('0x5b'),'id'])||{});}})[_0x480a('0x28')](respondWithResult(_0x1478a8,null))[_0x480a('0x4d')](handleError(_0x1478a8,null));};exports[_0x480a('0x5c')]=function(_0x7a4662,_0x1d24ae,_0x11301f){return db['SquareProject'][_0x480a('0x4c')]({'where':{'id':_0x7a4662[_0x480a('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d24ae,null))[_0x480a('0x28')](function(_0x24a43a){if(_0x24a43a){return _0x24a43a[_0x480a('0x5c')](_0x7a4662[_0x480a('0x36')][_0x480a('0x5b')])['then'](function(){if(_[_0x480a('0x5d')](_0x7a4662[_0x480a('0x36')]['ids'])){for(var _0x1f0902=0x0;_0x1f0902<_0x7a4662[_0x480a('0x36')][_0x480a('0x5b')]['length'];_0x1f0902+=0x1){socket[_0x480a('0x5e')](_0x480a('0x5f'),{'UserId':Number(_0x7a4662[_0x480a('0x36')][_0x480a('0x5b')][_0x1f0902]),'SquareProjectId':Number(_0x7a4662[_0x480a('0x49')]['id'])});}}else{socket['emit'](_0x480a('0x5f'),{'UserId':Number(_0x7a4662['query'][_0x480a('0x5b')]),'SquareProjectId':Number(_0x7a4662['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1d24ae,null))['catch'](handleError(_0x1d24ae,null));};exports[_0x480a('0x60')]=function(_0x53efb5,_0x2ad5c0,_0x1dfef3){var _0xe96583={};var _0x357e8c={};var _0x481050;var _0x210511;return db[_0x480a('0x2f')]['findOne']({'where':{'id':_0x53efb5[_0x480a('0x49')]['id']}})[_0x480a('0x28')](handleEntityNotFound(_0x2ad5c0,null))[_0x480a('0x28')](function(_0x47c7ae){if(_0x47c7ae){_0x481050=_0x47c7ae;_0x357e8c[_0x480a('0x33')]=_[_0x480a('0x34')](db[_0x480a('0x61')][_0x480a('0x4a')]);_0x357e8c[_0x480a('0x36')]=_[_0x480a('0x34')](_0x53efb5[_0x480a('0x36')]);_0x357e8c[_0x480a('0x35')]=_[_0x480a('0x38')](_0x357e8c[_0x480a('0x33')],_0x357e8c[_0x480a('0x36')]);_0xe96583[_0x480a('0x37')]=_[_0x480a('0x38')](_0x357e8c['model'],qs[_0x480a('0x39')](_0x53efb5[_0x480a('0x36')][_0x480a('0x39')]));_0xe96583[_0x480a('0x37')]=_0xe96583[_0x480a('0x37')][_0x480a('0x4b')]?_0xe96583[_0x480a('0x37')]:_0x357e8c[_0x480a('0x33')];_0xe96583['order']=qs[_0x480a('0x3d')](_0x53efb5[_0x480a('0x36')][_0x480a('0x3d')]);_0xe96583[_0x480a('0x3e')]=qs['filters'](_['pick'](_0x53efb5[_0x480a('0x36')],_0x357e8c[_0x480a('0x35')]));if(_0x53efb5[_0x480a('0x36')]['filter']){_0xe96583[_0x480a('0x3e')]=_[_0x480a('0x41')](_0xe96583[_0x480a('0x3e')],{'$or':_[_0x480a('0x42')](_0xe96583[_0x480a('0x37')],function(_0x3d1f89){var _0x37de6b={};_0x37de6b[_0x3d1f89]={'$like':'%'+_0x53efb5[_0x480a('0x36')][_0x480a('0x40')]+'%'};return _0x37de6b;})});}_0xe96583=_[_0x480a('0x41')]({},_0xe96583,_0x53efb5[_0x480a('0x44')]);return _0x481050[_0x480a('0x60')](_0xe96583);}})[_0x480a('0x28')](function(_0x1cb7f3){if(_0x1cb7f3){_0x210511=_0x1cb7f3[_0x480a('0x4b')];if(!_0x53efb5[_0x480a('0x36')]['hasOwnProperty'](_0x480a('0x3b'))){_0xe96583[_0x480a('0x21')]=qs['limit'](_0x53efb5[_0x480a('0x36')][_0x480a('0x21')]);_0xe96583['offset']=qs['offset'](_0x53efb5[_0x480a('0x36')][_0x480a('0x1f')]);}return _0x481050[_0x480a('0x60')](_0xe96583);}})[_0x480a('0x28')](function(_0x514f5c){if(_0x514f5c){return _0x514f5c?{'count':_0x210511,'rows':_0x514f5c}:null;}})[_0x480a('0x28')](respondWithResult(_0x2ad5c0,null))['catch'](handleError(_0x2ad5c0,null));}; \ No newline at end of file +var _0xb293=['destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','SquareProject','includeAll','include','findAll','catch','params','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','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','length','pick','nolimit','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','SquareProjects','UserProfileResource'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0xb293,0x15c));var _0x3b29=function(_0x2d5d32,_0x24595c){_0x2d5d32=_0x2d5d32-0x0;var _0x1d387c=_0xb293[_0x2d5d32];return _0x1d387c;};'use strict';var emlformat=require(_0x3b29('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3b29('0x1'));var rp=require(_0x3b29('0x2'));var moment=require(_0x3b29('0x3'));var BPromise=require(_0x3b29('0x4'));var Mustache=require(_0x3b29('0x5'));var util=require(_0x3b29('0x6'));var path=require('path');var sox=require(_0x3b29('0x7'));var csv=require(_0x3b29('0x8'));var ejs=require(_0x3b29('0x9'));var fs=require('fs');var fs_extra=require(_0x3b29('0xa'));var _=require('lodash');var squel=require(_0x3b29('0xb'));var crypto=require('crypto');var jsforce=require(_0x3b29('0xc'));var deskjs=require(_0x3b29('0xd'));var toCsv=require(_0x3b29('0x8'));var querystring=require(_0x3b29('0xe'));var Papa=require(_0x3b29('0xf'));var Redis=require(_0x3b29('0x10'));var authService=require(_0x3b29('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3b29('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3b29('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3b29('0x14'));var db=require(_0x3b29('0x15'))['db'];config[_0x3b29('0x16')]=_[_0x3b29('0x17')](config[_0x3b29('0x16')],{'host':_0x3b29('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3b29('0x19'))[_0x3b29('0x1a')](socket);function respondWithStatusCode(_0x46efd5,_0x5ab232){_0x5ab232=_0x5ab232||0xcc;return function(_0x10eeff){if(_0x10eeff){return _0x46efd5[_0x3b29('0x1b')](_0x5ab232);}return _0x46efd5[_0x3b29('0x1c')](_0x5ab232)[_0x3b29('0x1d')]();};}function respondWithResult(_0x2ce092,_0xe402ef){_0xe402ef=_0xe402ef||0xc8;return function(_0x19f1c0){if(_0x19f1c0){return _0x2ce092[_0x3b29('0x1c')](_0xe402ef)['json'](_0x19f1c0);}};}function respondWithFilteredResult(_0x25965e,_0x974431){return function(_0x3a7e47){if(_0x3a7e47){var _0x437674=typeof _0x974431[_0x3b29('0x1e')]===_0x3b29('0x1f')&&typeof _0x974431[_0x3b29('0x20')]===_0x3b29('0x1f');var _0x518f88=_0x3a7e47[_0x3b29('0x21')];var _0xbbf44c=_0x437674?0x0:_0x974431[_0x3b29('0x1e')];var _0x216880=_0x437674?_0x3a7e47['count']:_0x974431[_0x3b29('0x1e')]+_0x974431['limit'];var _0x45b59e;if(_0x216880>=_0x518f88){_0x216880=_0x518f88;_0x45b59e=0xc8;}else{_0x45b59e=0xce;}_0x25965e['status'](_0x45b59e);return _0x25965e['set'](_0x3b29('0x22'),_0xbbf44c+'-'+_0x216880+'/'+_0x518f88)[_0x3b29('0x23')](_0x3a7e47);}return null;};}function patchUpdates(_0x59abb8){return function(_0x412f36){try{jsonpatch[_0x3b29('0x24')](_0x412f36,_0x59abb8,!![]);}catch(_0x462a8a){return BPromise[_0x3b29('0x25')](_0x462a8a);}return _0x412f36[_0x3b29('0x26')]();};}function saveUpdates(_0x400c96,_0xf66ff4){return function(_0x38fa5f){if(_0x38fa5f){return _0x38fa5f[_0x3b29('0x27')](_0x400c96)[_0x3b29('0x28')](function(_0x34f033){return _0x34f033;});}return null;};}function removeEntity(_0x4d4d6e,_0x267dd0){return function(_0x11a8ce){if(_0x11a8ce){return _0x11a8ce['destroy']()[_0x3b29('0x28')](function(){var _0x3ea30e=_0x11a8ce[_0x3b29('0x29')]({'plain':!![]});var _0x1fdebb=_0x3b29('0x2a');return db[_0x3b29('0x2b')][_0x3b29('0x2c')]({'where':{'type':_0x1fdebb,'resourceId':_0x3ea30e['id']}})[_0x3b29('0x28')](function(){return _0x11a8ce;});})[_0x3b29('0x28')](function(){_0x4d4d6e[_0x3b29('0x1c')](0xcc)[_0x3b29('0x1d')]();});}};}function handleEntityNotFound(_0x16f176,_0x3fbcc7){return function(_0x505174){if(!_0x505174){_0x16f176[_0x3b29('0x1b')](0x194);}return _0x505174;};}function handleError(_0x4aead3,_0x1a4b47){_0x1a4b47=_0x1a4b47||0x1f4;return function(_0x4f2b97){logger['error'](_0x4f2b97[_0x3b29('0x2d')]);if(_0x4f2b97['name']){delete _0x4f2b97[_0x3b29('0x2e')];}_0x4aead3['status'](_0x1a4b47)[_0x3b29('0x2f')](_0x4f2b97);};}exports[_0x3b29('0x30')]=function(_0x5adee7,_0x341c1f){var _0xb1fa98={},_0x5bc7b2={},_0x190ccc={'count':0x0,'rows':[]};var _0xa6e1f5=_['map'](db['SquareProject'][_0x3b29('0x31')],function(_0x18c943){return{'name':_0x18c943[_0x3b29('0x32')],'type':_0x18c943[_0x3b29('0x33')][_0x3b29('0x34')]};});_0x5bc7b2[_0x3b29('0x35')]=_[_0x3b29('0x36')](_0xa6e1f5,_0x3b29('0x2e'));_0x5bc7b2['query']=_[_0x3b29('0x37')](_0x5adee7[_0x3b29('0x38')]);_0x5bc7b2[_0x3b29('0x39')]=_[_0x3b29('0x3a')](_0x5bc7b2[_0x3b29('0x35')],_0x5bc7b2[_0x3b29('0x38')]);_0xb1fa98[_0x3b29('0x3b')]=_[_0x3b29('0x3a')](_0x5bc7b2[_0x3b29('0x35')],qs[_0x3b29('0x3c')](_0x5adee7[_0x3b29('0x38')][_0x3b29('0x3c')]));_0xb1fa98[_0x3b29('0x3b')]=_0xb1fa98[_0x3b29('0x3b')]['length']?_0xb1fa98[_0x3b29('0x3b')]:_0x5bc7b2['model'];if(!_0x5adee7[_0x3b29('0x38')][_0x3b29('0x3d')]('nolimit')){_0xb1fa98['limit']=qs[_0x3b29('0x20')](_0x5adee7[_0x3b29('0x38')][_0x3b29('0x20')]);_0xb1fa98['offset']=qs[_0x3b29('0x1e')](_0x5adee7[_0x3b29('0x38')][_0x3b29('0x1e')]);}_0xb1fa98[_0x3b29('0x3e')]=qs[_0x3b29('0x3f')](_0x5adee7[_0x3b29('0x38')][_0x3b29('0x3f')]);_0xb1fa98['where']=qs[_0x3b29('0x39')](_['pick'](_0x5adee7['query'],_0x5bc7b2[_0x3b29('0x39')]),_0xa6e1f5);if(_0x5adee7[_0x3b29('0x38')][_0x3b29('0x40')]){_0xb1fa98[_0x3b29('0x41')]=_[_0x3b29('0x42')](_0xb1fa98[_0x3b29('0x41')],{'$or':_['map'](_0xa6e1f5,function(_0x12eeea){if(_0x12eeea[_0x3b29('0x33')]!==_0x3b29('0x43')){var _0x508927={};_0x508927[_0x12eeea[_0x3b29('0x2e')]]={'$like':'%'+_0x5adee7[_0x3b29('0x38')][_0x3b29('0x40')]+'%'};return _0x508927;}})});}_0xb1fa98=_[_0x3b29('0x42')]({},_0xb1fa98,_0x5adee7[_0x3b29('0x44')]);var _0x2efe4b={'where':_0xb1fa98[_0x3b29('0x41')]};return db[_0x3b29('0x45')][_0x3b29('0x21')](_0x2efe4b)[_0x3b29('0x28')](function(_0x4b312a){_0x190ccc[_0x3b29('0x21')]=_0x4b312a;if(_0x5adee7[_0x3b29('0x38')][_0x3b29('0x46')]){_0xb1fa98[_0x3b29('0x47')]=[{'all':!![]}];}return db[_0x3b29('0x45')][_0x3b29('0x48')](_0xb1fa98);})['then'](function(_0x5beeb2){_0x190ccc['rows']=_0x5beeb2;return _0x190ccc;})[_0x3b29('0x28')](respondWithFilteredResult(_0x341c1f,_0xb1fa98))[_0x3b29('0x49')](handleError(_0x341c1f,null));};exports['show']=function(_0x3f81a5,_0x30a4b4){var _0x419bad={'raw':![],'where':{'id':_0x3f81a5[_0x3b29('0x4a')]['id']}},_0xe9137c={};_0xe9137c[_0x3b29('0x35')]=_[_0x3b29('0x37')](db[_0x3b29('0x45')][_0x3b29('0x31')]);_0xe9137c[_0x3b29('0x38')]=_[_0x3b29('0x37')](_0x3f81a5[_0x3b29('0x38')]);_0xe9137c[_0x3b29('0x39')]=_[_0x3b29('0x3a')](_0xe9137c[_0x3b29('0x35')],_0xe9137c['query']);_0x419bad[_0x3b29('0x3b')]=_[_0x3b29('0x3a')](_0xe9137c[_0x3b29('0x35')],qs['fields'](_0x3f81a5[_0x3b29('0x38')][_0x3b29('0x3c')]));_0x419bad[_0x3b29('0x3b')]=_0x419bad[_0x3b29('0x3b')]['length']?_0x419bad[_0x3b29('0x3b')]:_0xe9137c[_0x3b29('0x35')];if(_0x3f81a5[_0x3b29('0x38')][_0x3b29('0x46')]){_0x419bad[_0x3b29('0x47')]=[{'all':!![]}];}_0x419bad=_['merge']({},_0x419bad,_0x3f81a5[_0x3b29('0x44')]);return db[_0x3b29('0x45')][_0x3b29('0x4b')](_0x419bad)['then'](handleEntityNotFound(_0x30a4b4,null))[_0x3b29('0x28')](respondWithResult(_0x30a4b4,null))[_0x3b29('0x49')](handleError(_0x30a4b4,null));};exports[_0x3b29('0x4c')]=function(_0xbbc369,_0xb9b96b){return db[_0x3b29('0x45')][_0x3b29('0x4c')](_0xbbc369[_0x3b29('0x4d')],{})['then'](function(_0x2b47ba){var _0x8629d2=_0xbbc369[_0x3b29('0x4e')][_0x3b29('0x29')]({'plain':!![]});if(!_0x8629d2)throw new Error(_0x3b29('0x4f'));if(_0x8629d2[_0x3b29('0x50')]===_0x3b29('0x4e')){var _0x4ccb42=_0x2b47ba[_0x3b29('0x29')]({'plain':!![]});var _0x2af2c8=_0x3b29('0x2a');return db[_0x3b29('0x51')][_0x3b29('0x4b')]({'where':{'name':_0x2af2c8,'userProfileId':_0x8629d2[_0x3b29('0x52')]},'raw':!![]})['then'](function(_0x505bc0){if(_0x505bc0&&_0x505bc0['autoAssociation']===0x0){return db[_0x3b29('0x2b')][_0x3b29('0x4c')]({'name':_0x4ccb42[_0x3b29('0x2e')],'resourceId':_0x4ccb42['id'],'type':_0x505bc0[_0x3b29('0x2e')],'sectionId':_0x505bc0['id']},{})[_0x3b29('0x28')](function(){return _0x2b47ba;});}else{return _0x2b47ba;}})[_0x3b29('0x49')](function(_0x38a245){logger[_0x3b29('0x53')](_0x3b29('0x54'),_0x38a245);throw _0x38a245;});}return _0x2b47ba;})[_0x3b29('0x28')](respondWithResult(_0xb9b96b,0xc9))['catch'](handleError(_0xb9b96b,null));};exports[_0x3b29('0x27')]=function(_0x26cc12,_0x2d55ab){if(_0x26cc12['body']['id']){delete _0x26cc12[_0x3b29('0x4d')]['id'];}return db[_0x3b29('0x45')][_0x3b29('0x4b')]({'where':{'id':_0x26cc12['params']['id']}})['then'](handleEntityNotFound(_0x2d55ab,null))[_0x3b29('0x28')](saveUpdates(_0x26cc12[_0x3b29('0x4d')],null))[_0x3b29('0x28')](respondWithResult(_0x2d55ab,null))[_0x3b29('0x49')](handleError(_0x2d55ab,null));};exports[_0x3b29('0x2c')]=function(_0x5ad056,_0x23b0cc){return db['SquareProject'][_0x3b29('0x4b')]({'where':{'id':_0x5ad056['params']['id']}})[_0x3b29('0x28')](handleEntityNotFound(_0x23b0cc,null))[_0x3b29('0x28')](removeEntity(_0x23b0cc,null))[_0x3b29('0x49')](handleError(_0x23b0cc,null));};exports[_0x3b29('0x55')]=function(_0x28461e,_0x4966c4,_0x460674){return db[_0x3b29('0x45')][_0x3b29('0x4b')]({'where':{'id':_0x28461e[_0x3b29('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4966c4,null))[_0x3b29('0x28')](function(_0x1593f2){if(_0x1593f2){return _0x1593f2[_0x3b29('0x55')](_0x28461e['body'][_0x3b29('0x56')],_[_0x3b29('0x57')](_0x28461e[_0x3b29('0x4d')],[_0x3b29('0x56'),'id'])||{});}})[_0x3b29('0x28')](respondWithResult(_0x4966c4,null))[_0x3b29('0x49')](handleError(_0x4966c4,null));};exports['removeUsers']=function(_0x5ee53a,_0x3a25c7,_0x501d07){return db['SquareProject']['find']({'where':{'id':_0x5ee53a[_0x3b29('0x4a')]['id']}})[_0x3b29('0x28')](handleEntityNotFound(_0x3a25c7,null))[_0x3b29('0x28')](function(_0x9d1536){if(_0x9d1536){return _0x9d1536[_0x3b29('0x58')](_0x5ee53a[_0x3b29('0x38')][_0x3b29('0x56')])[_0x3b29('0x28')](function(){if(_[_0x3b29('0x59')](_0x5ee53a[_0x3b29('0x38')][_0x3b29('0x56')])){for(var _0x30e931=0x0;_0x30e931<_0x5ee53a[_0x3b29('0x38')][_0x3b29('0x56')]['length'];_0x30e931+=0x1){socket['emit'](_0x3b29('0x5a'),{'UserId':Number(_0x5ee53a['query'][_0x3b29('0x56')][_0x30e931]),'SquareProjectId':Number(_0x5ee53a[_0x3b29('0x4a')]['id'])});}}else{socket[_0x3b29('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x5ee53a['query'][_0x3b29('0x56')]),'SquareProjectId':Number(_0x5ee53a['params']['id'])});}});}})[_0x3b29('0x28')](respondWithStatusCode(_0x3a25c7,null))[_0x3b29('0x49')](handleError(_0x3a25c7,null));};exports[_0x3b29('0x5c')]=function(_0x4bf417,_0x5a6549,_0x20a684){var _0x5819df={};var _0x15900c={};var _0x1247eb;var _0x4dcf40;return db['SquareProject'][_0x3b29('0x5d')]({'where':{'id':_0x4bf417['params']['id']}})['then'](handleEntityNotFound(_0x5a6549,null))[_0x3b29('0x28')](function(_0x4af3e4){if(_0x4af3e4){_0x1247eb=_0x4af3e4;_0x15900c[_0x3b29('0x35')]=_['keys'](db[_0x3b29('0x5e')][_0x3b29('0x31')]);_0x15900c['query']=_[_0x3b29('0x37')](_0x4bf417['query']);_0x15900c['filters']=_[_0x3b29('0x3a')](_0x15900c['model'],_0x15900c[_0x3b29('0x38')]);_0x5819df['attributes']=_[_0x3b29('0x3a')](_0x15900c[_0x3b29('0x35')],qs[_0x3b29('0x3c')](_0x4bf417[_0x3b29('0x38')][_0x3b29('0x3c')]));_0x5819df[_0x3b29('0x3b')]=_0x5819df[_0x3b29('0x3b')][_0x3b29('0x5f')]?_0x5819df[_0x3b29('0x3b')]:_0x15900c[_0x3b29('0x35')];_0x5819df[_0x3b29('0x3e')]=qs[_0x3b29('0x3f')](_0x4bf417[_0x3b29('0x38')][_0x3b29('0x3f')]);_0x5819df[_0x3b29('0x41')]=qs['filters'](_[_0x3b29('0x60')](_0x4bf417[_0x3b29('0x38')],_0x15900c[_0x3b29('0x39')]));if(_0x4bf417[_0x3b29('0x38')][_0x3b29('0x40')]){_0x5819df['where']=_[_0x3b29('0x42')](_0x5819df[_0x3b29('0x41')],{'$or':_[_0x3b29('0x36')](_0x5819df['attributes'],function(_0x364ba9){var _0x375d5d={};_0x375d5d[_0x364ba9]={'$like':'%'+_0x4bf417[_0x3b29('0x38')][_0x3b29('0x40')]+'%'};return _0x375d5d;})});}_0x5819df=_[_0x3b29('0x42')]({},_0x5819df,_0x4bf417[_0x3b29('0x44')]);return _0x1247eb[_0x3b29('0x5c')](_0x5819df);}})['then'](function(_0x5a5014){if(_0x5a5014){_0x4dcf40=_0x5a5014[_0x3b29('0x5f')];if(!_0x4bf417[_0x3b29('0x38')][_0x3b29('0x3d')](_0x3b29('0x61'))){_0x5819df['limit']=qs['limit'](_0x4bf417['query'][_0x3b29('0x20')]);_0x5819df[_0x3b29('0x1e')]=qs[_0x3b29('0x1e')](_0x4bf417['query']['offset']);}return _0x1247eb['getUsers'](_0x5819df);}})['then'](function(_0x244f7a){if(_0x244f7a){return _0x244f7a?{'count':_0x4dcf40,'rows':_0x244f7a}:null;}})[_0x3b29('0x28')](respondWithResult(_0x5a6549,null))[_0x3b29('0x49')](handleError(_0x5a6549,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d84563c..a23b9f1 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 _0x2ab8=['remove','emit','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x2f3b86,_0x1fffad){var _0x9741a0=function(_0x654b64){while(--_0x654b64){_0x2f3b86['push'](_0x2f3b86['shift']());}};_0x9741a0(++_0x1fffad);}(_0x2ab8,0x9a));var _0x82ab=function(_0x163f15,_0x4cf917){_0x163f15=_0x163f15-0x0;var _0x3a463f=_0x2ab8[_0x163f15];return _0x3a463f;};'use strict';var EventEmitter=require(_0x82ab('0x0'));var SquareProject=require(_0x82ab('0x1'))['db'][_0x82ab('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x82ab('0x3')](0x0);var events={'afterCreate':_0x82ab('0x4'),'afterUpdate':_0x82ab('0x5'),'afterDestroy':_0x82ab('0x6')};function emitEvent(_0x21995a){return function(_0x3d45f0,_0x5b9071,_0x31322c){SquareProjectEvents[_0x82ab('0x7')](_0x21995a+':'+_0x3d45f0['id'],_0x3d45f0);SquareProjectEvents[_0x82ab('0x7')](_0x21995a,_0x3d45f0);_0x31322c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x82ab('0x8')](e,emitEvent(event));}}module[_0x82ab('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xed84=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hook','exports'];(function(_0x5a7611,_0x39b162){var _0x1847cf=function(_0x96af0c){while(--_0x96af0c){_0x5a7611['push'](_0x5a7611['shift']());}};_0x1847cf(++_0x39b162);}(_0xed84,0x18c));var _0x4ed8=function(_0x4ea214,_0x2ba973){_0x4ea214=_0x4ea214-0x0;var _0x34ada2=_0xed84[_0x4ea214];return _0x34ada2;};'use strict';var EventEmitter=require(_0x4ed8('0x0'));var SquareProject=require(_0x4ed8('0x1'))['db'][_0x4ed8('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4ed8('0x3')](0x0);var events={'afterCreate':_0x4ed8('0x4'),'afterUpdate':_0x4ed8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x956eeb){return function(_0x21e09a,_0x3d40d8,_0x2086c6){SquareProjectEvents[_0x4ed8('0x6')](_0x956eeb+':'+_0x21e09a['id'],_0x21e09a);SquareProjectEvents[_0x4ed8('0x6')](_0x956eeb,_0x21e09a);_0x2086c6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x4ed8('0x7')](e,emitEvent(event));}}module[_0x4ed8('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index d0af5a2..248a464 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 _0x38c0=['production','publishedAt','format','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x32c81b,_0x2945f7){var _0x54fd24=function(_0x3749ed){while(--_0x3749ed){_0x32c81b['push'](_0x32c81b['shift']());}};_0x54fd24(++_0x2945f7);}(_0x38c0,0x147));var _0x038c=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x38c0[_0x3a7a9c];return _0x59156e;};'use strict';var _=require(_0x038c('0x0'));var util=require(_0x038c('0x1'));var logger=require(_0x038c('0x2'))(_0x038c('0x3'));var moment=require(_0x038c('0x4'));var BPromise=require('bluebird');var rp=require(_0x038c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x038c('0x6'));var config=require(_0x038c('0x7'));var attributes=require(_0x038c('0x8'));module[_0x038c('0x9')]=function(_0x531474,_0x23236d){return _0x531474['define'](_0x038c('0xa'),attributes,{'tableName':_0x038c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ccdbf,_0x3f5d77,_0x110442){if(_0x3ccdbf[_0x038c('0xc')]('preproduction')){_0x3ccdbf[_0x038c('0xd')]=moment()['format'](_0x038c('0xe'));}if(_0x3ccdbf[_0x038c('0xc')](_0x038c('0xf'))){_0x3ccdbf[_0x038c('0x10')]=moment()[_0x038c('0x11')](_0x038c('0xe'));}_0x110442(null,_0x3ccdbf);}}});}; \ No newline at end of file +var _0xef8b=['changed','production','publishedAt','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','savedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xef8b,0x192));var _0xbef8=function(_0x599d7f,_0xc586e8){_0x599d7f=_0x599d7f-0x0;var _0x3346d3=_0xef8b[_0x599d7f];return _0x3346d3;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var BPromise=require(_0xbef8('0x4'));var rp=require(_0xbef8('0x5'));var fs=require('fs');var path=require(_0xbef8('0x6'));var rimraf=require(_0xbef8('0x7'));var config=require(_0xbef8('0x8'));var attributes=require(_0xbef8('0x9'));module[_0xbef8('0xa')]=function(_0x550cb1,_0x1dd4a3){return _0x550cb1[_0xbef8('0xb')](_0xbef8('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22d84e,_0x1a6d83,_0x4826c6){if(_0x22d84e['changed']('preproduction')){_0x22d84e[_0xbef8('0xd')]=moment()[_0xbef8('0xe')](_0xbef8('0xf'));}if(_0x22d84e[_0xbef8('0x10')](_0xbef8('0x11'))){_0x22d84e[_0xbef8('0x12')]=moment()[_0xbef8('0xe')](_0xbef8('0xf'));}_0x4826c6(null,_0x22d84e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6208f3e..19ff909 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 _0x4efd=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareProject','options','raw','attributes','map','model','include','ShowSquareProject','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4f9aff,_0x48e7e4){var _0x5292b5=function(_0x5b9183){while(--_0x5b9183){_0x4f9aff['push'](_0x4f9aff['shift']());}};_0x5292b5(++_0x48e7e4);}(_0x4efd,0xd8));var _0xd4ef=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0x4efd[_0x466247];return _0x4b352e;};'use strict';var _=require(_0xd4ef('0x0'));var util=require('util');var moment=require(_0xd4ef('0x1'));var BPromise=require(_0xd4ef('0x2'));var rs=require(_0xd4ef('0x3'));var fs=require('fs');var Redis=require(_0xd4ef('0x4'));var db=require(_0xd4ef('0x5'))['db'];var utils=require(_0xd4ef('0x6'));var logger=require(_0xd4ef('0x7'))(_0xd4ef('0x8'));var config=require(_0xd4ef('0x9'));var jayson=require(_0xd4ef('0xa'));var client=jayson[_0xd4ef('0xb')]['http']({'port':0x232a});config['redis']=_[_0xd4ef('0xc')](config[_0xd4ef('0xd')],{'host':_0xd4ef('0xe'),'port':0x18eb});var socket=require(_0xd4ef('0xf'))(new Redis(config['redis']));require(_0xd4ef('0x10'))['register'](socket);function respondWithRpcPromise(_0x48461b,_0x1e22f1,_0x5adb06){return new BPromise(function(_0x4adf4c,_0x13caab){return client['request'](_0x48461b,_0x5adb06)[_0xd4ef('0x11')](function(_0x53ee28){logger[_0xd4ef('0x12')](_0xd4ef('0x13'),_0x1e22f1,_0xd4ef('0x14'));logger[_0xd4ef('0x15')](_0xd4ef('0x16'),_0x1e22f1,_0xd4ef('0x14'),JSON[_0xd4ef('0x17')](_0x53ee28));if(_0x53ee28[_0xd4ef('0x18')]){if(_0x53ee28[_0xd4ef('0x18')][_0xd4ef('0x19')]===0x1f4){logger[_0xd4ef('0x18')](_0xd4ef('0x13'),_0x1e22f1,_0x53ee28[_0xd4ef('0x18')]['message']);return _0x13caab(_0x53ee28['error'][_0xd4ef('0x1a')]);}logger[_0xd4ef('0x18')](_0xd4ef('0x13'),_0x1e22f1,_0x53ee28[_0xd4ef('0x18')]['message']);return _0x4adf4c(_0x53ee28['error']['message']);}else{logger['info'](_0xd4ef('0x13'),_0x1e22f1,_0xd4ef('0x14'));_0x4adf4c(_0x53ee28[_0xd4ef('0x1b')][_0xd4ef('0x1a')]);}})[_0xd4ef('0x1c')](function(_0x514596){logger[_0xd4ef('0x18')](_0xd4ef('0x13'),_0x1e22f1,_0x514596);_0x13caab(_0x514596);});});}exports['ShowSquareProject']=function(_0x3ce125){var _0x1413cd=this;return new Promise(function(_0x37752c,_0x1e997a){return db[_0xd4ef('0x1d')]['find']({'raw':_0x3ce125['options']?_0x3ce125[_0xd4ef('0x1e')][_0xd4ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ce125[_0xd4ef('0x1e')]?_0x3ce125['options']['where']||null:null,'attributes':_0x3ce125[_0xd4ef('0x1e')]?_0x3ce125[_0xd4ef('0x1e')][_0xd4ef('0x20')]||null:null,'include':_0x3ce125[_0xd4ef('0x1e')]?_0x3ce125['options']['include']?_[_0xd4ef('0x21')](_0x3ce125[_0xd4ef('0x1e')]['include'],function(_0x4c776a){return{'model':db[_0x4c776a[_0xd4ef('0x22')]],'as':_0x4c776a['as'],'attributes':_0x4c776a[_0xd4ef('0x20')],'include':_0x4c776a[_0xd4ef('0x23')]?_[_0xd4ef('0x21')](_0x4c776a[_0xd4ef('0x23')],function(_0x4e2498){return{'model':db[_0x4e2498['model']],'as':_0x4e2498['as'],'attributes':_0x4e2498[_0xd4ef('0x20')],'include':_0x4e2498['include']?_[_0xd4ef('0x21')](_0x4e2498[_0xd4ef('0x23')],function(_0x3c5f71){return{'model':db[_0x3c5f71[_0xd4ef('0x22')]],'as':_0x3c5f71['as'],'attributes':_0x3c5f71[_0xd4ef('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x109075){logger[_0xd4ef('0x12')](_0xd4ef('0x24'),_0x3ce125);logger[_0xd4ef('0x15')]('ShowSquareProject',_0x3ce125,JSON['stringify'](_0x109075));_0x37752c(_0x109075);})[_0xd4ef('0x1c')](function(_0x337b5d){logger[_0xd4ef('0x18')](_0xd4ef('0x24'),_0x337b5d[_0xd4ef('0x1a')],_0x3ce125);_0x1e997a(_0x1413cd[_0xd4ef('0x18')](0x1f4,_0x337b5d[_0xd4ef('0x1a')]));});});}; \ No newline at end of file +var _0xa112=['options','where','attributes','include','map','model','lodash','util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0xa112,0x1e2));var _0x2a11=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xa112[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x2a11('0x0'));var util=require(_0x2a11('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2a11('0x2'));var fs=require('fs');var Redis=require(_0x2a11('0x3'));var db=require(_0x2a11('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a11('0x5'));var config=require('../../config/environment');var jayson=require(_0x2a11('0x6'));var client=jayson[_0x2a11('0x7')]['http']({'port':0x232a});config[_0x2a11('0x8')]=_[_0x2a11('0x9')](config[_0x2a11('0x8')],{'host':_0x2a11('0xa'),'port':0x18eb});var socket=require(_0x2a11('0xb'))(new Redis(config[_0x2a11('0x8')]));require('./squareProject.socket')[_0x2a11('0xc')](socket);function respondWithRpcPromise(_0x339718,_0x2e8414,_0x3a909a){return new BPromise(function(_0x42b7d2,_0x317cca){return client[_0x2a11('0xd')](_0x339718,_0x3a909a)[_0x2a11('0xe')](function(_0x26af59){logger['info'](_0x2a11('0xf'),_0x2e8414,_0x2a11('0x10'));logger[_0x2a11('0x11')](_0x2a11('0x12'),_0x2e8414,_0x2a11('0x10'),JSON[_0x2a11('0x13')](_0x26af59));if(_0x26af59[_0x2a11('0x14')]){if(_0x26af59['error'][_0x2a11('0x15')]===0x1f4){logger[_0x2a11('0x14')](_0x2a11('0xf'),_0x2e8414,_0x26af59[_0x2a11('0x14')]['message']);return _0x317cca(_0x26af59[_0x2a11('0x14')]['message']);}logger['error'](_0x2a11('0xf'),_0x2e8414,_0x26af59[_0x2a11('0x14')][_0x2a11('0x16')]);return _0x42b7d2(_0x26af59[_0x2a11('0x14')][_0x2a11('0x16')]);}else{logger['info'](_0x2a11('0xf'),_0x2e8414,_0x2a11('0x10'));_0x42b7d2(_0x26af59[_0x2a11('0x17')]['message']);}})[_0x2a11('0x18')](function(_0x5d0ef7){logger['error'](_0x2a11('0xf'),_0x2e8414,_0x5d0ef7);_0x317cca(_0x5d0ef7);});});}exports[_0x2a11('0x19')]=function(_0x1ca102){var _0x30aa73=this;return new Promise(function(_0x796da5,_0x1c8773){return db[_0x2a11('0x1a')][_0x2a11('0x1b')]({'raw':_0x1ca102[_0x2a11('0x1c')]?_0x1ca102[_0x2a11('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1ca102['options']?_0x1ca102[_0x2a11('0x1c')][_0x2a11('0x1d')]||null:null,'attributes':_0x1ca102[_0x2a11('0x1c')]?_0x1ca102[_0x2a11('0x1c')][_0x2a11('0x1e')]||null:null,'include':_0x1ca102['options']?_0x1ca102[_0x2a11('0x1c')][_0x2a11('0x1f')]?_[_0x2a11('0x20')](_0x1ca102[_0x2a11('0x1c')][_0x2a11('0x1f')],function(_0x41b339){return{'model':db[_0x41b339[_0x2a11('0x21')]],'as':_0x41b339['as'],'attributes':_0x41b339[_0x2a11('0x1e')],'include':_0x41b339['include']?_[_0x2a11('0x20')](_0x41b339[_0x2a11('0x1f')],function(_0x45aa0e){return{'model':db[_0x45aa0e[_0x2a11('0x21')]],'as':_0x45aa0e['as'],'attributes':_0x45aa0e[_0x2a11('0x1e')],'include':_0x45aa0e['include']?_[_0x2a11('0x20')](_0x45aa0e['include'],function(_0x1f2c2f){return{'model':db[_0x1f2c2f[_0x2a11('0x21')]],'as':_0x1f2c2f['as'],'attributes':_0x1f2c2f[_0x2a11('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2a11('0xe')](function(_0x49a0d2){logger['info'](_0x2a11('0x19'),_0x1ca102);logger[_0x2a11('0x11')](_0x2a11('0x19'),_0x1ca102,JSON[_0x2a11('0x13')](_0x49a0d2));_0x796da5(_0x49a0d2);})['catch'](function(_0x365a94){logger['error']('ShowSquareProject',_0x365a94[_0x2a11('0x16')],_0x1ca102);_0x1c8773(_0x30aa73[_0x2a11('0x14')](0x1f4,_0x365a94[_0x2a11('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 8aa2195..8df44e1 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 _0x0393=['emit','removeListener','register','length','squareProject:','save','update'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x0393,0x75));var _0x3039=function(_0x3ff7d2,_0x4584d3){_0x3ff7d2=_0x3ff7d2-0x0;var _0xe3f7ec=_0x0393[_0x3ff7d2];return _0xe3f7ec;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x3039('0x0'),'remove',_0x3039('0x1')];function createListener(_0x17c031,_0x291288){return function(_0x4e023c){_0x291288[_0x3039('0x2')](_0x17c031,_0x4e023c);};}function removeListener(_0x25fc58,_0x3f5bd0){return function(){SquareProjectEvents[_0x3039('0x3')](_0x25fc58,_0x3f5bd0);};}exports[_0x3039('0x4')]=function(_0x3b42c5){for(var _0x4bc701=0x0,_0x51e456=events[_0x3039('0x5')];_0x4bc701<_0x51e456;_0x4bc701++){var _0x5b1a7f=events[_0x4bc701];var _0x56a1a3=createListener(_0x3039('0x6')+_0x5b1a7f,_0x3b42c5);SquareProjectEvents['on'](_0x5b1a7f,_0x56a1a3);}}; \ No newline at end of file +var _0x4c68=['squareProject:','./squareProject.events','save','remove','emit','removeListener','register','length'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0x4c68,0xc1));var _0x84c6=function(_0x30a528,_0x1d04f2){_0x30a528=_0x30a528-0x0;var _0x3e029c=_0x4c68[_0x30a528];return _0x3e029c;};'use strict';var SquareProjectEvents=require(_0x84c6('0x0'));var events=[_0x84c6('0x1'),_0x84c6('0x2'),'update'];function createListener(_0x331406,_0x4948c5){return function(_0xd81ee0){_0x4948c5[_0x84c6('0x3')](_0x331406,_0xd81ee0);};}function removeListener(_0x20b1a5,_0x2cff15){return function(){SquareProjectEvents[_0x84c6('0x4')](_0x20b1a5,_0x2cff15);};}exports[_0x84c6('0x5')]=function(_0x352d80){for(var _0xc0b910=0x0,_0x412803=events[_0x84c6('0x6')];_0xc0b910<_0x412803;_0xc0b910++){var _0x2cb1d0=events[_0xc0b910];var _0x4fdd2d=createListener(_0x84c6('0x7')+_0x2cb1d0,_0x352d80);SquareProjectEvents['on'](_0x2cb1d0,_0x4fdd2d);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1e3449c..b86cacb 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x33f4bf,_0x47e924){var _0x828f1f=function(_0x5ef84b){while(--_0x5ef84b){_0x33f4bf['push'](_0x33f4bf['shift']());}};_0x828f1f(++_0x47e924);}(_0x326f,0xd1));var _0xf326=function(_0x118d2a,_0x50f179){_0x118d2a=_0x118d2a-0x0;var _0x26f7de=_0x326f[_0x118d2a];return _0x26f7de;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x17ec25,_0x2544fb){var _0x14be02=function(_0x45d002){while(--_0x45d002){_0x17ec25['push'](_0x17ec25['shift']());}};_0x14be02(++_0x2544fb);}(_0x1261,0x144));var _0x1126=function(_0x161f03,_0x5d141b){_0x161f03=_0x161f03-0x0;var _0x2f396f=_0x1261[_0x161f03];return _0x2f396f;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9a3be45..579739a 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 _0x9957=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x38f67c,_0x19f763){var _0x57166d=function(_0x2d15c9){while(--_0x2d15c9){_0x38f67c['push'](_0x38f67c['shift']());}};_0x57166d(++_0x19f763);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7995('0x2')]},'extension':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7995('0x2')]},'saveName':{'type':Sequelize[_0x7995('0x2')]},'filename':{'type':Sequelize[_0x7995('0x2')]},'savePath':{'type':Sequelize[_0x7995('0x2')]},'format':{'type':Sequelize[_0x7995('0x3')],'get':function(){var _0x326741='';var _0x4996ca=this[_0x7995('0x4')](_0x7995('0x5'));if(_0x4996ca){_0x326741=_0x4996ca['substring'](_0x4996ca[_0x7995('0x6')]('.'));}return _0x326741;}}}; \ No newline at end of file +var _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x4ae6c6,_0x22ca46){var _0x3ba4cf=function(_0x4bc188){while(--_0x4bc188){_0x4ae6c6['push'](_0x4ae6c6['shift']());}};_0x3ba4cf(++_0x22ca46);}(_0x032e,0x124));var _0xe032=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x032e[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8ac1cbd..c26f203 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 _0x2cd2=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','SquareRecording','findAll','rows','catch','show','params','include','find','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','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','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x1ef02d,_0x1f7b1a){var _0x3e59c7=function(_0x3804e2){while(--_0x3804e2){_0x1ef02d['push'](_0x1ef02d['shift']());}};_0x3e59c7(++_0x1f7b1a);}(_0x2cd2,0xeb));var _0x22cd=function(_0x23ecfd,_0x181f8c){_0x23ecfd=_0x23ecfd-0x0;var _0x1f5091=_0x2cd2[_0x23ecfd];return _0x1f5091;};'use strict';var emlformat=require(_0x22cd('0x0'));var rimraf=require(_0x22cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22cd('0x2'));var rp=require(_0x22cd('0x3'));var moment=require(_0x22cd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x22cd('0x5'));var path=require(_0x22cd('0x6'));var sox=require(_0x22cd('0x7'));var csv=require(_0x22cd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22cd('0x9'));var _=require(_0x22cd('0xa'));var squel=require(_0x22cd('0xb'));var crypto=require(_0x22cd('0xc'));var jsforce=require(_0x22cd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x22cd('0xe'));var Papa=require('papaparse');var Redis=require(_0x22cd('0xf'));var authService=require(_0x22cd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x22cd('0x11'));var hardwareService=require(_0x22cd('0x12'));var logger=require(_0x22cd('0x13'))(_0x22cd('0x14'));var utils=require(_0x22cd('0x15'));var config=require(_0x22cd('0x16'));var licenseUtil=require(_0x22cd('0x17'));var db=require(_0x22cd('0x18'))['db'];function respondWithStatusCode(_0x33eefa,_0x40af50){_0x40af50=_0x40af50||0xcc;return function(_0x3b1bc2){if(_0x3b1bc2){return _0x33eefa[_0x22cd('0x19')](_0x40af50);}return _0x33eefa[_0x22cd('0x1a')](_0x40af50)[_0x22cd('0x1b')]();};}function respondWithResult(_0x377ec4,_0xc54c11){_0xc54c11=_0xc54c11||0xc8;return function(_0x51efd0){if(_0x51efd0){return _0x377ec4['status'](_0xc54c11)[_0x22cd('0x1c')](_0x51efd0);}};}function respondWithFilteredResult(_0x4fdc89,_0xed3505){return function(_0x575f4b){if(_0x575f4b){var _0x214aff=typeof _0xed3505['offset']===_0x22cd('0x1d')&&typeof _0xed3505[_0x22cd('0x1e')]==='undefined';var _0x460e19=_0x575f4b[_0x22cd('0x1f')];var _0x262a74=_0x214aff?0x0:_0xed3505[_0x22cd('0x20')];var _0x38d754=_0x214aff?_0x575f4b['count']:_0xed3505[_0x22cd('0x20')]+_0xed3505[_0x22cd('0x1e')];var _0x5deef1;if(_0x38d754>=_0x460e19){_0x38d754=_0x460e19;_0x5deef1=0xc8;}else{_0x5deef1=0xce;}_0x4fdc89[_0x22cd('0x1a')](_0x5deef1);return _0x4fdc89[_0x22cd('0x21')]('Content-Range',_0x262a74+'-'+_0x38d754+'/'+_0x460e19)['json'](_0x575f4b);}return null;};}function patchUpdates(_0x35ce16){return function(_0x3ca771){try{jsonpatch[_0x22cd('0x22')](_0x3ca771,_0x35ce16,!![]);}catch(_0x255b34){return BPromise[_0x22cd('0x23')](_0x255b34);}return _0x3ca771[_0x22cd('0x24')]();};}function saveUpdates(_0x233877,_0x153041){return function(_0x194992){if(_0x194992){return _0x194992[_0x22cd('0x25')](_0x233877)[_0x22cd('0x26')](function(_0x1b1b3f){return _0x1b1b3f;});}return null;};}function removeEntity(_0x22860e,_0x10a1b2){return function(_0x186922){if(_0x186922){return _0x186922[_0x22cd('0x27')]()[_0x22cd('0x26')](function(){_0x22860e[_0x22cd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54bbbe,_0x116cb5){return function(_0x13b7d2){if(!_0x13b7d2){_0x54bbbe[_0x22cd('0x19')](0x194);}return _0x13b7d2;};}function handleError(_0x1c714b,_0x3142b3){_0x3142b3=_0x3142b3||0x1f4;return function(_0x342de6){logger['error'](_0x342de6[_0x22cd('0x28')]);if(_0x342de6[_0x22cd('0x29')]){delete _0x342de6['name'];}_0x1c714b[_0x22cd('0x1a')](_0x3142b3)[_0x22cd('0x2a')](_0x342de6);};}exports[_0x22cd('0x2b')]=function(_0x374489,_0x5b58c2){var _0x1108bb={},_0x2af8a1={},_0x275744={'count':0x0,'rows':[]};var _0x22cec5=_[_0x22cd('0x2c')](db['SquareRecording'][_0x22cd('0x2d')],function(_0x125d45){return{'name':_0x125d45[_0x22cd('0x2e')],'type':_0x125d45[_0x22cd('0x2f')][_0x22cd('0x30')]};});_0x2af8a1[_0x22cd('0x31')]=_[_0x22cd('0x2c')](_0x22cec5,_0x22cd('0x29'));_0x2af8a1[_0x22cd('0x32')]=_[_0x22cd('0x33')](_0x374489[_0x22cd('0x32')]);_0x2af8a1[_0x22cd('0x34')]=_['intersection'](_0x2af8a1[_0x22cd('0x31')],_0x2af8a1[_0x22cd('0x32')]);_0x1108bb['attributes']=_[_0x22cd('0x35')](_0x2af8a1[_0x22cd('0x31')],qs[_0x22cd('0x36')](_0x374489[_0x22cd('0x32')][_0x22cd('0x36')]));_0x1108bb['attributes']=_0x1108bb[_0x22cd('0x37')][_0x22cd('0x38')]?_0x1108bb[_0x22cd('0x37')]:_0x2af8a1[_0x22cd('0x31')];if(!_0x374489[_0x22cd('0x32')][_0x22cd('0x39')]('nolimit')){_0x1108bb[_0x22cd('0x1e')]=qs[_0x22cd('0x1e')](_0x374489[_0x22cd('0x32')]['limit']);_0x1108bb['offset']=qs[_0x22cd('0x20')](_0x374489[_0x22cd('0x32')][_0x22cd('0x20')]);}_0x1108bb[_0x22cd('0x3a')]=qs[_0x22cd('0x3b')](_0x374489[_0x22cd('0x32')][_0x22cd('0x3b')]);_0x1108bb[_0x22cd('0x3c')]=qs[_0x22cd('0x34')](_[_0x22cd('0x3d')](_0x374489['query'],_0x2af8a1[_0x22cd('0x34')]),_0x22cec5);if(_0x374489[_0x22cd('0x32')][_0x22cd('0x3e')]){_0x1108bb[_0x22cd('0x3c')]=_[_0x22cd('0x3f')](_0x1108bb[_0x22cd('0x3c')],{'$or':_[_0x22cd('0x2c')](_0x22cec5,function(_0x53a616){if(_0x53a616[_0x22cd('0x2f')]!=='VIRTUAL'){var _0x1c0eb9={};_0x1c0eb9[_0x53a616[_0x22cd('0x29')]]={'$like':'%'+_0x374489[_0x22cd('0x32')][_0x22cd('0x3e')]+'%'};return _0x1c0eb9;}})});}_0x1108bb=_['merge']({},_0x1108bb,_0x374489[_0x22cd('0x40')]);var _0x473dce={'where':_0x1108bb[_0x22cd('0x3c')]};return db['SquareRecording'][_0x22cd('0x1f')](_0x473dce)[_0x22cd('0x26')](function(_0x5b9349){_0x275744[_0x22cd('0x1f')]=_0x5b9349;if(_0x374489[_0x22cd('0x32')][_0x22cd('0x41')]){_0x1108bb['include']=[{'all':!![]}];}return db[_0x22cd('0x42')][_0x22cd('0x43')](_0x1108bb);})[_0x22cd('0x26')](function(_0x341bd2){_0x275744[_0x22cd('0x44')]=_0x341bd2;return _0x275744;})['then'](respondWithFilteredResult(_0x5b58c2,_0x1108bb))[_0x22cd('0x45')](handleError(_0x5b58c2,null));};exports[_0x22cd('0x46')]=function(_0x2da244,_0x15ffd0){var _0x5d17b2={'raw':!![],'where':{'id':_0x2da244[_0x22cd('0x47')]['id']}},_0x291c49={};_0x291c49['model']=_[_0x22cd('0x33')](db['SquareRecording'][_0x22cd('0x2d')]);_0x291c49[_0x22cd('0x32')]=_[_0x22cd('0x33')](_0x2da244['query']);_0x291c49['filters']=_[_0x22cd('0x35')](_0x291c49[_0x22cd('0x31')],_0x291c49['query']);_0x5d17b2[_0x22cd('0x37')]=_[_0x22cd('0x35')](_0x291c49['model'],qs[_0x22cd('0x36')](_0x2da244[_0x22cd('0x32')][_0x22cd('0x36')]));_0x5d17b2[_0x22cd('0x37')]=_0x5d17b2[_0x22cd('0x37')]['length']?_0x5d17b2[_0x22cd('0x37')]:_0x291c49[_0x22cd('0x31')];if(_0x2da244['query'][_0x22cd('0x41')]){_0x5d17b2[_0x22cd('0x48')]=[{'all':!![]}];}_0x5d17b2=_[_0x22cd('0x3f')]({},_0x5d17b2,_0x2da244[_0x22cd('0x40')]);return db['SquareRecording'][_0x22cd('0x49')](_0x5d17b2)['then'](handleEntityNotFound(_0x15ffd0,null))[_0x22cd('0x26')](respondWithResult(_0x15ffd0,null))['catch'](handleError(_0x15ffd0,null));};exports['create']=function(_0x2d53e2,_0x306671){return db['SquareRecording']['create'](_0x2d53e2['body'],{})[_0x22cd('0x26')](respondWithResult(_0x306671,0xc9))['catch'](handleError(_0x306671,null));};exports[_0x22cd('0x25')]=function(_0x5426d9,_0x49b078){if(_0x5426d9['body']['id']){delete _0x5426d9[_0x22cd('0x4a')]['id'];}return db[_0x22cd('0x42')][_0x22cd('0x49')]({'where':{'id':_0x5426d9['params']['id']}})[_0x22cd('0x26')](handleEntityNotFound(_0x49b078,null))['then'](saveUpdates(_0x5426d9[_0x22cd('0x4a')],null))['then'](respondWithResult(_0x49b078,null))[_0x22cd('0x45')](handleError(_0x49b078,null));};exports[_0x22cd('0x4b')]=function(_0x20ad86,_0xc0cd73,_0x329510){var _0x181a7d=require('../../components/encryptor');var _0x3c6040=![];var _0x57ed71={};if(_0x20ad86[_0x22cd('0x32')][_0x22cd('0x2f')]&&_0x20ad86[_0x22cd('0x32')]['type']===_0x22cd('0x4c')){_0x57ed71['uniqueid']=_0x20ad86[_0x22cd('0x47')]['id'];}else{_0x57ed71['id']=_0x20ad86['params']['id'];}return db[_0x22cd('0x42')][_0x22cd('0x49')]({'where':_0x57ed71,'attributes':['id',_0x22cd('0x4d'),_0x22cd('0x4e')],'raw':!![]})[_0x22cd('0x26')](handleEntityNotFound(_0xc0cd73,null))[_0x22cd('0x26')](function(_0x4a2be1){if(_0x4a2be1){var _0x579ed9=_0x4a2be1[_0x22cd('0x4d')];var _0x24cd14=util[_0x22cd('0x4f')](_0x22cd('0x50'),_0x579ed9);if(fs[_0x22cd('0x51')](_0x24cd14)){_0x3c6040=!![];return _0x181a7d[_0x22cd('0x52')](_0x24cd14,_0x579ed9,config['secrets']['recording'])[_0x22cd('0x26')](function(){return _0x4a2be1;});}return _0x4a2be1;}})[_0x22cd('0x26')](function(_0x5e1b88){if(_0x5e1b88){var _0x518596=_0x5e1b88[_0x22cd('0x4d')];if(!fs['existsSync'](_0x518596)){throw new db['Sequelize'][(_0x22cd('0x53'))](_0x22cd('0x54'));}if(_0x5e1b88[_0x22cd('0x4e')]){return _0xc0cd73[_0x22cd('0x4b')](_0x518596,_0x5e1b88[_0x22cd('0x4e')]+path[_0x22cd('0x55')](_0x518596),function(){if(_0x3c6040){fs[_0x22cd('0x56')](_0x518596);}});}else{return _0xc0cd73[_0x22cd('0x4b')](_0x518596,function(_0x566fbf){if(_0x3c6040){fs[_0x22cd('0x56')](_0x518596);}});}}})[_0x22cd('0x45')](function(_0x2c0dbd){if(_0x2c0dbd['message']===_0x22cd('0x54')){_0xc0cd73[_0x22cd('0x1a')](0x194)[_0x22cd('0x2a')](_0x22cd('0x57'));}else{return handleError(_0xc0cd73,null);}});};exports['destroy']=function(_0x24cd36,_0x136404){return db[_0x22cd('0x42')][_0x22cd('0x49')]({'where':{'id':_0x24cd36[_0x22cd('0x47')]['id']}})[_0x22cd('0x26')](function(_0x1c8dd0){if(_['isNil'](_0x1c8dd0)){throw new ReferenceError(_0x22cd('0x58'));}return _0x1c8dd0;})['then'](function(_0x267ec8){var _0x4443a7=_0x267ec8[_0x22cd('0x4d')];logger[_0x22cd('0x59')](_0x22cd('0x5a'),_0x4443a7);if(!_['isNil'](_0x267ec8[_0x22cd('0x4d')])&&fs['existsSync'](_0x4443a7)){logger[_0x22cd('0x59')](_0x22cd('0x5b')+_0x4443a7+_0x22cd('0x5c'));fs['unlinkSync'](_0x4443a7);}_0x4443a7=_0x4443a7+_0x22cd('0x5d');if(!_[_0x22cd('0x5e')](_0x267ec8[_0x22cd('0x4d')])&&fs[_0x22cd('0x51')](_0x4443a7)){logger[_0x22cd('0x59')](_0x22cd('0x5b')+_0x4443a7+_0x22cd('0x5c'));fs['unlinkSync'](_0x4443a7);}return _0x267ec8;})[_0x22cd('0x26')](function(_0xd83e89){if(!_0xd83e89)throw new InternalError();return _0xd83e89['destroy']();})[_0x22cd('0x26')](function(){_0x136404['status'](0xcc)[_0x22cd('0x1b')]();})[_0x22cd('0x45')](handleError(_0x136404,null));}; \ No newline at end of file +var _0xa728=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','length','options','create','body','find','download','../../components/encryptor','savePath','filename','format','%s.cypher','existsSync','decryptFile','recording','ValidationError','SquareRecording\x20not\x20found','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa728,0x176));var _0x8a72=function(_0x5e32f3,_0x3386c1){_0x5e32f3=_0x5e32f3-0x0;var _0x4d4e03=_0xa728[_0x5e32f3];return _0x4d4e03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a72('0x0'));var zipdir=require(_0x8a72('0x1'));var jsonpatch=require(_0x8a72('0x2'));var rp=require('request-promise');var moment=require(_0x8a72('0x3'));var BPromise=require(_0x8a72('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8a72('0x5'));var sox=require(_0x8a72('0x6'));var csv=require(_0x8a72('0x7'));var ejs=require(_0x8a72('0x8'));var fs=require('fs');var fs_extra=require(_0x8a72('0x9'));var _=require(_0x8a72('0xa'));var squel=require(_0x8a72('0xb'));var crypto=require(_0x8a72('0xc'));var jsforce=require(_0x8a72('0xd'));var deskjs=require(_0x8a72('0xe'));var toCsv=require(_0x8a72('0x7'));var querystring=require(_0x8a72('0xf'));var Papa=require(_0x8a72('0x10'));var Redis=require('ioredis');var authService=require(_0x8a72('0x11'));var qs=require(_0x8a72('0x12'));var as=require(_0x8a72('0x13'));var hardwareService=require(_0x8a72('0x14'));var logger=require(_0x8a72('0x15'))(_0x8a72('0x16'));var utils=require(_0x8a72('0x17'));var config=require(_0x8a72('0x18'));var licenseUtil=require(_0x8a72('0x19'));var db=require(_0x8a72('0x1a'))['db'];function respondWithStatusCode(_0x557de9,_0x2b0b85){_0x2b0b85=_0x2b0b85||0xcc;return function(_0x54ea0a){if(_0x54ea0a){return _0x557de9['sendStatus'](_0x2b0b85);}return _0x557de9[_0x8a72('0x1b')](_0x2b0b85)['end']();};}function respondWithResult(_0xfa7149,_0x1ee2c0){_0x1ee2c0=_0x1ee2c0||0xc8;return function(_0x220480){if(_0x220480){return _0xfa7149[_0x8a72('0x1b')](_0x1ee2c0)['json'](_0x220480);}};}function respondWithFilteredResult(_0x3338b7,_0x1d1b35){return function(_0x4aa1f6){if(_0x4aa1f6){var _0x24695a=typeof _0x1d1b35[_0x8a72('0x1c')]===_0x8a72('0x1d')&&typeof _0x1d1b35[_0x8a72('0x1e')]==='undefined';var _0x2330c5=_0x4aa1f6['count'];var _0xcd9a7e=_0x24695a?0x0:_0x1d1b35[_0x8a72('0x1c')];var _0x23448e=_0x24695a?_0x4aa1f6[_0x8a72('0x1f')]:_0x1d1b35[_0x8a72('0x1c')]+_0x1d1b35['limit'];var _0x382d88;if(_0x23448e>=_0x2330c5){_0x23448e=_0x2330c5;_0x382d88=0xc8;}else{_0x382d88=0xce;}_0x3338b7['status'](_0x382d88);return _0x3338b7[_0x8a72('0x20')](_0x8a72('0x21'),_0xcd9a7e+'-'+_0x23448e+'/'+_0x2330c5)['json'](_0x4aa1f6);}return null;};}function patchUpdates(_0x5e549b){return function(_0x3039f9){try{jsonpatch[_0x8a72('0x22')](_0x3039f9,_0x5e549b,!![]);}catch(_0x5c1332){return BPromise[_0x8a72('0x23')](_0x5c1332);}return _0x3039f9['save']();};}function saveUpdates(_0x170edc,_0x11a2db){return function(_0x11732f){if(_0x11732f){return _0x11732f[_0x8a72('0x24')](_0x170edc)['then'](function(_0x1a3667){return _0x1a3667;});}return null;};}function removeEntity(_0x2e71a4,_0x20add7){return function(_0x42ff00){if(_0x42ff00){return _0x42ff00[_0x8a72('0x25')]()[_0x8a72('0x26')](function(){_0x2e71a4[_0x8a72('0x1b')](0xcc)[_0x8a72('0x27')]();});}};}function handleEntityNotFound(_0x5c61c0,_0x543ea0){return function(_0x5122f2){if(!_0x5122f2){_0x5c61c0['sendStatus'](0x194);}return _0x5122f2;};}function handleError(_0x2d1b16,_0x23e48b){_0x23e48b=_0x23e48b||0x1f4;return function(_0x161e2c){logger[_0x8a72('0x28')](_0x161e2c['stack']);if(_0x161e2c['name']){delete _0x161e2c[_0x8a72('0x29')];}_0x2d1b16['status'](_0x23e48b)[_0x8a72('0x2a')](_0x161e2c);};}exports[_0x8a72('0x2b')]=function(_0x19a246,_0x2f8c94){var _0x46e24f={},_0xa467e0={},_0x17f479={'count':0x0,'rows':[]};var _0x326bfa=_['map'](db[_0x8a72('0x2c')][_0x8a72('0x2d')],function(_0x42306f){return{'name':_0x42306f[_0x8a72('0x2e')],'type':_0x42306f[_0x8a72('0x2f')][_0x8a72('0x30')]};});_0xa467e0[_0x8a72('0x31')]=_[_0x8a72('0x32')](_0x326bfa,_0x8a72('0x29'));_0xa467e0[_0x8a72('0x33')]=_['keys'](_0x19a246['query']);_0xa467e0[_0x8a72('0x34')]=_['intersection'](_0xa467e0[_0x8a72('0x31')],_0xa467e0[_0x8a72('0x33')]);_0x46e24f[_0x8a72('0x35')]=_[_0x8a72('0x36')](_0xa467e0['model'],qs['fields'](_0x19a246['query'][_0x8a72('0x37')]));_0x46e24f[_0x8a72('0x35')]=_0x46e24f[_0x8a72('0x35')]['length']?_0x46e24f[_0x8a72('0x35')]:_0xa467e0['model'];if(!_0x19a246[_0x8a72('0x33')][_0x8a72('0x38')](_0x8a72('0x39'))){_0x46e24f[_0x8a72('0x1e')]=qs[_0x8a72('0x1e')](_0x19a246[_0x8a72('0x33')]['limit']);_0x46e24f['offset']=qs['offset'](_0x19a246[_0x8a72('0x33')][_0x8a72('0x1c')]);}_0x46e24f[_0x8a72('0x3a')]=qs[_0x8a72('0x3b')](_0x19a246[_0x8a72('0x33')][_0x8a72('0x3b')]);_0x46e24f['where']=qs[_0x8a72('0x34')](_[_0x8a72('0x3c')](_0x19a246[_0x8a72('0x33')],_0xa467e0[_0x8a72('0x34')]),_0x326bfa);if(_0x19a246[_0x8a72('0x33')][_0x8a72('0x3d')]){_0x46e24f[_0x8a72('0x3e')]=_['merge'](_0x46e24f[_0x8a72('0x3e')],{'$or':_[_0x8a72('0x32')](_0x326bfa,function(_0x16b8ce){if(_0x16b8ce[_0x8a72('0x2f')]!==_0x8a72('0x3f')){var _0x46835f={};_0x46835f[_0x16b8ce[_0x8a72('0x29')]]={'$like':'%'+_0x19a246['query'][_0x8a72('0x3d')]+'%'};return _0x46835f;}})});}_0x46e24f=_[_0x8a72('0x40')]({},_0x46e24f,_0x19a246['options']);var _0x56f3f4={'where':_0x46e24f[_0x8a72('0x3e')]};return db[_0x8a72('0x2c')][_0x8a72('0x1f')](_0x56f3f4)[_0x8a72('0x26')](function(_0x2b3a38){_0x17f479[_0x8a72('0x1f')]=_0x2b3a38;if(_0x19a246['query']['includeAll']){_0x46e24f[_0x8a72('0x41')]=[{'all':!![]}];}return db['SquareRecording'][_0x8a72('0x42')](_0x46e24f);})['then'](function(_0x5dfda9){_0x17f479[_0x8a72('0x43')]=_0x5dfda9;return _0x17f479;})[_0x8a72('0x26')](respondWithFilteredResult(_0x2f8c94,_0x46e24f))[_0x8a72('0x44')](handleError(_0x2f8c94,null));};exports[_0x8a72('0x45')]=function(_0x2b044a,_0x569e6e){var _0x4c4818={'raw':!![],'where':{'id':_0x2b044a[_0x8a72('0x46')]['id']}},_0x2ab840={};_0x2ab840[_0x8a72('0x31')]=_[_0x8a72('0x47')](db[_0x8a72('0x2c')]['rawAttributes']);_0x2ab840[_0x8a72('0x33')]=_[_0x8a72('0x47')](_0x2b044a[_0x8a72('0x33')]);_0x2ab840[_0x8a72('0x34')]=_[_0x8a72('0x36')](_0x2ab840[_0x8a72('0x31')],_0x2ab840[_0x8a72('0x33')]);_0x4c4818[_0x8a72('0x35')]=_[_0x8a72('0x36')](_0x2ab840[_0x8a72('0x31')],qs[_0x8a72('0x37')](_0x2b044a[_0x8a72('0x33')][_0x8a72('0x37')]));_0x4c4818[_0x8a72('0x35')]=_0x4c4818['attributes'][_0x8a72('0x48')]?_0x4c4818[_0x8a72('0x35')]:_0x2ab840[_0x8a72('0x31')];if(_0x2b044a[_0x8a72('0x33')]['includeAll']){_0x4c4818[_0x8a72('0x41')]=[{'all':!![]}];}_0x4c4818=_[_0x8a72('0x40')]({},_0x4c4818,_0x2b044a[_0x8a72('0x49')]);return db[_0x8a72('0x2c')]['find'](_0x4c4818)[_0x8a72('0x26')](handleEntityNotFound(_0x569e6e,null))['then'](respondWithResult(_0x569e6e,null))[_0x8a72('0x44')](handleError(_0x569e6e,null));};exports[_0x8a72('0x4a')]=function(_0xe7cd1f,_0x5eb040){return db[_0x8a72('0x2c')][_0x8a72('0x4a')](_0xe7cd1f[_0x8a72('0x4b')],{})[_0x8a72('0x26')](respondWithResult(_0x5eb040,0xc9))[_0x8a72('0x44')](handleError(_0x5eb040,null));};exports['update']=function(_0x2aa75a,_0x29e39f){if(_0x2aa75a[_0x8a72('0x4b')]['id']){delete _0x2aa75a[_0x8a72('0x4b')]['id'];}return db[_0x8a72('0x2c')][_0x8a72('0x4c')]({'where':{'id':_0x2aa75a[_0x8a72('0x46')]['id']}})[_0x8a72('0x26')](handleEntityNotFound(_0x29e39f,null))[_0x8a72('0x26')](saveUpdates(_0x2aa75a[_0x8a72('0x4b')],null))[_0x8a72('0x26')](respondWithResult(_0x29e39f,null))[_0x8a72('0x44')](handleError(_0x29e39f,null));};exports[_0x8a72('0x4d')]=function(_0x120802,_0x10b3fa,_0x696528){var _0x5008f1=require(_0x8a72('0x4e'));var _0x3b5a03=![];var _0x59823a={};if(_0x120802['query'][_0x8a72('0x2f')]&&_0x120802['query'][_0x8a72('0x2f')]==='uniqueid'){_0x59823a['uniqueid']=_0x120802[_0x8a72('0x46')]['id'];}else{_0x59823a['id']=_0x120802['params']['id'];}return db[_0x8a72('0x2c')][_0x8a72('0x4c')]({'where':_0x59823a,'attributes':['id',_0x8a72('0x4f'),_0x8a72('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x10b3fa,null))[_0x8a72('0x26')](function(_0x56fd59){if(_0x56fd59){var _0x42c63e=_0x56fd59[_0x8a72('0x4f')];var _0x24019a=util[_0x8a72('0x51')](_0x8a72('0x52'),_0x42c63e);if(fs[_0x8a72('0x53')](_0x24019a)){_0x3b5a03=!![];return _0x5008f1[_0x8a72('0x54')](_0x24019a,_0x42c63e,config['secrets'][_0x8a72('0x55')])[_0x8a72('0x26')](function(){return _0x56fd59;});}return _0x56fd59;}})['then'](function(_0x3df38a){if(_0x3df38a){var _0x4a1e87=_0x3df38a[_0x8a72('0x4f')];if(!fs[_0x8a72('0x53')](_0x4a1e87)){throw new db['Sequelize'][(_0x8a72('0x56'))](_0x8a72('0x57'));}if(_0x3df38a['filename']){return _0x10b3fa[_0x8a72('0x4d')](_0x4a1e87,_0x3df38a['filename']+path['extname'](_0x4a1e87),function(){if(_0x3b5a03){fs['unlink'](_0x4a1e87);}});}else{return _0x10b3fa['download'](_0x4a1e87,function(_0x466428){if(_0x3b5a03){fs[_0x8a72('0x58')](_0x4a1e87);}});}}})[_0x8a72('0x44')](function(_0x30fea8){if(_0x30fea8['message']===_0x8a72('0x57')){_0x10b3fa[_0x8a72('0x1b')](0x194)[_0x8a72('0x2a')](_0x8a72('0x59'));}else{return handleError(_0x10b3fa,null);}});};exports[_0x8a72('0x25')]=function(_0x192b5c,_0x554896){return db[_0x8a72('0x2c')][_0x8a72('0x4c')]({'where':{'id':_0x192b5c['params']['id']}})[_0x8a72('0x26')](function(_0x408ab3){if(_[_0x8a72('0x5a')](_0x408ab3)){throw new ReferenceError(_0x8a72('0x5b'));}return _0x408ab3;})[_0x8a72('0x26')](function(_0x44f9ee){var _0x2acf32=_0x44f9ee[_0x8a72('0x4f')];logger[_0x8a72('0x5c')](_0x8a72('0x5d'),_0x2acf32);if(!_['isNil'](_0x44f9ee[_0x8a72('0x4f')])&&fs[_0x8a72('0x53')](_0x2acf32)){logger[_0x8a72('0x5c')](_0x8a72('0x5e')+_0x2acf32+_0x8a72('0x5f'));fs['unlinkSync'](_0x2acf32);}_0x2acf32=_0x2acf32+_0x8a72('0x60');if(!_['isNil'](_0x44f9ee['savePath'])&&fs[_0x8a72('0x53')](_0x2acf32)){logger[_0x8a72('0x5c')](_0x8a72('0x5e')+_0x2acf32+_0x8a72('0x5f'));fs[_0x8a72('0x61')](_0x2acf32);}return _0x44f9ee;})['then'](function(_0x3cc491){if(!_0x3cc491)throw new InternalError();return _0x3cc491[_0x8a72('0x25')]();})['then'](function(){_0x554896[_0x8a72('0x1b')](0xcc)[_0x8a72('0x27')]();})[_0x8a72('0x44')](handleError(_0x554896,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 47728d6..167dbfc 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 _0x8ce1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings'];(function(_0x205a28,_0x1fa8ab){var _0x10ba00=function(_0x30096f){while(--_0x30096f){_0x205a28['push'](_0x205a28['shift']());}};_0x10ba00(++_0x1fa8ab);}(_0x8ce1,0x152));var _0x18ce=function(_0x3e073a,_0x1a6fad){_0x3e073a=_0x3e073a-0x0;var _0x40c1f7=_0x8ce1[_0x3e073a];return _0x40c1f7;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var attributes=require(_0x18ce('0x9'));module[_0x18ce('0xa')]=function(_0x532604,_0x17d12a){return _0x532604[_0x18ce('0xb')]('SquareRecording',attributes,{'tableName':_0x18ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf105=['define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./squareRecording.attributes','exports'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0xf105,0x1b0));var _0x5f10=function(_0x55d457,_0x45b6fe){_0x55d457=_0x55d457-0x0;var _0x58d6a6=_0xf105[_0x55d457];return _0x58d6a6;};'use strict';var _=require(_0x5f10('0x0'));var util=require(_0x5f10('0x1'));var logger=require(_0x5f10('0x2'))(_0x5f10('0x3'));var moment=require(_0x5f10('0x4'));var BPromise=require(_0x5f10('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f10('0x6'));var rimraf=require('rimraf');var config=require(_0x5f10('0x7'));var attributes=require(_0x5f10('0x8'));module[_0x5f10('0x9')]=function(_0x1b7489,_0x46b6f2){return _0x1b7489[_0x5f10('0xa')](_0x5f10('0xb'),attributes,{'tableName':_0x5f10('0xc'),'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 d19ce51..30e7320 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 _0x5911=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareRecording','create','body','options','CreateSquareRecording','lodash'];(function(_0x284b21,_0x1e95ec){var _0xde2265=function(_0x40d4c6){while(--_0x40d4c6){_0x284b21['push'](_0x284b21['shift']());}};_0xde2265(++_0x1e95ec);}(_0x5911,0x1bf));var _0x1591=function(_0x599e6b,_0x33bc56){_0x599e6b=_0x599e6b-0x0;var _0x32e01a=_0x5911[_0x599e6b];return _0x32e01a;};'use strict';var _=require(_0x1591('0x0'));var util=require('util');var moment=require(_0x1591('0x1'));var BPromise=require(_0x1591('0x2'));var rs=require(_0x1591('0x3'));var fs=require('fs');var Redis=require(_0x1591('0x4'));var db=require(_0x1591('0x5'))['db'];var utils=require(_0x1591('0x6'));var logger=require('../../config/logger')(_0x1591('0x7'));var config=require(_0x1591('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1591('0x9')][_0x1591('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46cfdf,_0x108fd5,_0x108484){return new BPromise(function(_0x5c628a,_0x48d7f5){return client[_0x1591('0xb')](_0x46cfdf,_0x108484)[_0x1591('0xc')](function(_0x3d8a9c){logger[_0x1591('0xd')](_0x1591('0xe'),_0x108fd5,_0x1591('0xf'));logger[_0x1591('0x10')](_0x1591('0x11'),_0x108fd5,_0x1591('0xf'),JSON[_0x1591('0x12')](_0x3d8a9c));if(_0x3d8a9c[_0x1591('0x13')]){if(_0x3d8a9c['error'][_0x1591('0x14')]===0x1f4){logger[_0x1591('0x13')](_0x1591('0xe'),_0x108fd5,_0x3d8a9c[_0x1591('0x13')][_0x1591('0x15')]);return _0x48d7f5(_0x3d8a9c['error'][_0x1591('0x15')]);}logger['error'](_0x1591('0xe'),_0x108fd5,_0x3d8a9c[_0x1591('0x13')]['message']);return _0x5c628a(_0x3d8a9c[_0x1591('0x13')][_0x1591('0x15')]);}else{logger[_0x1591('0xd')](_0x1591('0xe'),_0x108fd5,_0x1591('0xf'));_0x5c628a(_0x3d8a9c['result'][_0x1591('0x15')]);}})[_0x1591('0x16')](function(_0x5033df){logger[_0x1591('0x13')](_0x1591('0xe'),_0x108fd5,_0x5033df);_0x48d7f5(_0x5033df);});});}exports['CreateSquareRecording']=function(_0x4d491f){var _0x2e2529=this;return new Promise(function(_0x17d908,_0x325562){return db[_0x1591('0x17')][_0x1591('0x18')](_0x4d491f[_0x1591('0x19')],{'raw':_0x4d491f[_0x1591('0x1a')]?_0x4d491f[_0x1591('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3a3730){logger[_0x1591('0xd')](_0x1591('0x1b'),_0x4d491f);logger[_0x1591('0x10')](_0x1591('0x1b'),_0x4d491f,JSON['stringify'](_0x3a3730));_0x17d908(_0x3a3730);})['catch'](function(_0x32f6bd){logger[_0x1591('0x13')](_0x1591('0x1b'),_0x32f6bd[_0x1591('0x15')],_0x4d491f);_0x325562(_0x2e2529[_0x1591('0x13')](0x1f4,_0x32f6bd['message']));});});}; \ No newline at end of file +var _0x20ce=['options','stringify','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body'];(function(_0x3214aa,_0x51d6ad){var _0x250197=function(_0x4167d6){while(--_0x4167d6){_0x3214aa['push'](_0x3214aa['shift']());}};_0x250197(++_0x51d6ad);}(_0x20ce,0x6a));var _0xe20c=function(_0x122360,_0x4e3c5b){_0x122360=_0x122360-0x0;var _0x3394ce=_0x20ce[_0x122360];return _0x3394ce;};'use strict';var _=require('lodash');var util=require(_0xe20c('0x0'));var moment=require(_0xe20c('0x1'));var BPromise=require(_0xe20c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe20c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe20c('0x4'));var logger=require('../../config/logger')(_0xe20c('0x5'));var config=require(_0xe20c('0x6'));var jayson=require(_0xe20c('0x7'));var client=jayson[_0xe20c('0x8')][_0xe20c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45ac96,_0x1bca6f,_0x377e11){return new BPromise(function(_0x27e7f,_0xe2ce5e){return client['request'](_0x45ac96,_0x377e11)[_0xe20c('0xa')](function(_0xa6d9ff){logger[_0xe20c('0xb')](_0xe20c('0xc'),_0x1bca6f,_0xe20c('0xd'));logger[_0xe20c('0xe')](_0xe20c('0xf'),_0x1bca6f,_0xe20c('0xd'),JSON['stringify'](_0xa6d9ff));if(_0xa6d9ff['error']){if(_0xa6d9ff[_0xe20c('0x10')][_0xe20c('0x11')]===0x1f4){logger['error'](_0xe20c('0xc'),_0x1bca6f,_0xa6d9ff['error'][_0xe20c('0x12')]);return _0xe2ce5e(_0xa6d9ff[_0xe20c('0x10')]['message']);}logger['error'](_0xe20c('0xc'),_0x1bca6f,_0xa6d9ff[_0xe20c('0x10')]['message']);return _0x27e7f(_0xa6d9ff['error'][_0xe20c('0x12')]);}else{logger[_0xe20c('0xb')](_0xe20c('0xc'),_0x1bca6f,_0xe20c('0xd'));_0x27e7f(_0xa6d9ff['result']['message']);}})[_0xe20c('0x13')](function(_0xe21c99){logger[_0xe20c('0x10')](_0xe20c('0xc'),_0x1bca6f,_0xe21c99);_0xe2ce5e(_0xe21c99);});});}exports[_0xe20c('0x14')]=function(_0x40a1d1){var _0x21f6cb=this;return new Promise(function(_0x40e119,_0x44bf22){return db[_0xe20c('0x15')][_0xe20c('0x16')](_0x40a1d1[_0xe20c('0x17')],{'raw':_0x40a1d1['options']?_0x40a1d1[_0xe20c('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xe20c('0xa')](function(_0x154b7b){logger[_0xe20c('0xb')]('CreateSquareRecording',_0x40a1d1);logger['debug'](_0xe20c('0x14'),_0x40a1d1,JSON[_0xe20c('0x19')](_0x154b7b));_0x40e119(_0x154b7b);})[_0xe20c('0x13')](function(_0x38211a){logger[_0xe20c('0x10')](_0xe20c('0x14'),_0x38211a['message'],_0x40a1d1);_0x44bf22(_0x21f6cb[_0xe20c('0x10')](0x1f4,_0x38211a[_0xe20c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 3fd6f91..339fdc7 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x18bd60,_0x288c37){var _0x286d92=function(_0x4e1ce3){while(--_0x4e1ce3){_0x18bd60['push'](_0x18bd60['shift']());}};_0x286d92(++_0x288c37);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 2ac5984..4f5940e 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 _0x75d4=['DATE','sequelize','exports','STRING'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x75d4,0x169));var _0x475d=function(_0x314cff,_0x20a36a){_0x314cff=_0x314cff-0x0;var _0xb50bc5=_0x75d4[_0x314cff];return _0xb50bc5;};'use strict';var Sequelize=require(_0x475d('0x0'));module[_0x475d('0x1')]={'network':{'type':Sequelize[_0x475d('0x2')]},'network_script':{'type':Sequelize[_0x475d('0x2')]},'request':{'type':Sequelize[_0x475d('0x2')]},'channel':{'type':Sequelize[_0x475d('0x2')]},'language':{'type':Sequelize[_0x475d('0x2')]},'type':{'type':Sequelize[_0x475d('0x2')]},'uniqueid':{'type':Sequelize[_0x475d('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x475d('0x2')]},'callingpres':{'type':Sequelize[_0x475d('0x2')]},'callingani2':{'type':Sequelize[_0x475d('0x2')]},'callington':{'type':Sequelize[_0x475d('0x2')]},'callingtns':{'type':Sequelize[_0x475d('0x2')]},'dnid':{'type':Sequelize[_0x475d('0x2')]},'rdnis':{'type':Sequelize[_0x475d('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x475d('0x2')]},'priority':{'type':Sequelize[_0x475d('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x475d('0x2')]},'project_name':{'type':Sequelize[_0x475d('0x2')]},'joinAt':{'type':Sequelize[_0x475d('0x3')]},'leaveAt':{'type':Sequelize[_0x475d('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa52c=['DATE','BOOLEAN','sequelize','STRING'];(function(_0xc69f39,_0x2ce0cf){var _0x93be41=function(_0xd66056){while(--_0xd66056){_0xc69f39['push'](_0xc69f39['shift']());}};_0x93be41(++_0x2ce0cf);}(_0xa52c,0x96));var _0xca52=function(_0x179d7b,_0x24ddb){_0x179d7b=_0x179d7b-0x0;var _0xfefedc=_0xa52c[_0x179d7b];return _0xfefedc;};'use strict';var Sequelize=require(_0xca52('0x0'));module['exports']={'network':{'type':Sequelize[_0xca52('0x1')]},'network_script':{'type':Sequelize[_0xca52('0x1')]},'request':{'type':Sequelize[_0xca52('0x1')]},'channel':{'type':Sequelize[_0xca52('0x1')]},'language':{'type':Sequelize[_0xca52('0x1')]},'type':{'type':Sequelize[_0xca52('0x1')]},'uniqueid':{'type':Sequelize[_0xca52('0x1')]},'version':{'type':Sequelize[_0xca52('0x1')]},'callerid':{'type':Sequelize[_0xca52('0x1')]},'calleridname':{'type':Sequelize[_0xca52('0x1')]},'callingpres':{'type':Sequelize[_0xca52('0x1')]},'callingani2':{'type':Sequelize[_0xca52('0x1')]},'callington':{'type':Sequelize[_0xca52('0x1')]},'callingtns':{'type':Sequelize[_0xca52('0x1')]},'dnid':{'type':Sequelize[_0xca52('0x1')]},'rdnis':{'type':Sequelize[_0xca52('0x1')]},'context':{'type':Sequelize[_0xca52('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xca52('0x1')]},'enhanced':{'type':Sequelize[_0xca52('0x1')]},'accountcode':{'type':Sequelize[_0xca52('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xca52('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xca52('0x2')]},'bot':{'type':Sequelize[_0xca52('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 4fe3dc1..320f890 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 _0x8511=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','SquareReport','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x3494e8,_0x4111ea){var _0x20bd8c=function(_0x2f8fcd){while(--_0x2f8fcd){_0x3494e8['push'](_0x3494e8['shift']());}};_0x20bd8c(++_0x4111ea);}(_0x8511,0x102));var _0x1851=function(_0xae2acd,_0x2a0481){_0xae2acd=_0xae2acd-0x0;var _0x3e3307=_0x8511[_0xae2acd];return _0x3e3307;};'use strict';var emlformat=require(_0x1851('0x0'));var rimraf=require(_0x1851('0x1'));var zipdir=require(_0x1851('0x2'));var jsonpatch=require(_0x1851('0x3'));var rp=require(_0x1851('0x4'));var moment=require(_0x1851('0x5'));var BPromise=require(_0x1851('0x6'));var Mustache=require('mustache');var util=require(_0x1851('0x7'));var path=require(_0x1851('0x8'));var sox=require('sox');var csv=require(_0x1851('0x9'));var ejs=require(_0x1851('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1851('0xb'));var squel=require(_0x1851('0xc'));var crypto=require(_0x1851('0xd'));var jsforce=require(_0x1851('0xe'));var deskjs=require(_0x1851('0xf'));var toCsv=require(_0x1851('0x9'));var querystring=require(_0x1851('0x10'));var Papa=require(_0x1851('0x11'));var Redis=require('ioredis');var authService=require(_0x1851('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1851('0x13'));var hardwareService=require(_0x1851('0x14'));var logger=require(_0x1851('0x15'))('api');var utils=require(_0x1851('0x16'));var config=require(_0x1851('0x17'));var licenseUtil=require(_0x1851('0x18'));var db=require(_0x1851('0x19'))['db'];function respondWithStatusCode(_0x480ae6,_0x3b8fe3){_0x3b8fe3=_0x3b8fe3||0xcc;return function(_0x238c61){if(_0x238c61){return _0x480ae6[_0x1851('0x1a')](_0x3b8fe3);}return _0x480ae6[_0x1851('0x1b')](_0x3b8fe3)[_0x1851('0x1c')]();};}function respondWithResult(_0x36a974,_0x238ba7){_0x238ba7=_0x238ba7||0xc8;return function(_0x5c96a5){if(_0x5c96a5){return _0x36a974[_0x1851('0x1b')](_0x238ba7)[_0x1851('0x1d')](_0x5c96a5);}};}function respondWithFilteredResult(_0x25abbe,_0x4e060d){return function(_0x4d1f50){if(_0x4d1f50){var _0x8d2b84=typeof _0x4e060d[_0x1851('0x1e')]===_0x1851('0x1f')&&typeof _0x4e060d[_0x1851('0x20')]===_0x1851('0x1f');var _0x80aa80=_0x4d1f50[_0x1851('0x21')];var _0x1a1462=_0x8d2b84?0x0:_0x4e060d[_0x1851('0x1e')];var _0x24272b=_0x8d2b84?_0x4d1f50['count']:_0x4e060d[_0x1851('0x1e')]+_0x4e060d[_0x1851('0x20')];var _0x15d4f2;if(_0x24272b>=_0x80aa80){_0x24272b=_0x80aa80;_0x15d4f2=0xc8;}else{_0x15d4f2=0xce;}_0x25abbe[_0x1851('0x1b')](_0x15d4f2);return _0x25abbe[_0x1851('0x22')](_0x1851('0x23'),_0x1a1462+'-'+_0x24272b+'/'+_0x80aa80)['json'](_0x4d1f50);}return null;};}function patchUpdates(_0x83a5ed){return function(_0xe4ab06){try{jsonpatch[_0x1851('0x24')](_0xe4ab06,_0x83a5ed,!![]);}catch(_0x23165d){return BPromise[_0x1851('0x25')](_0x23165d);}return _0xe4ab06[_0x1851('0x26')]();};}function saveUpdates(_0x59bd26,_0x415acd){return function(_0x9ba0d4){if(_0x9ba0d4){return _0x9ba0d4[_0x1851('0x27')](_0x59bd26)[_0x1851('0x28')](function(_0x4e1c1c){return _0x4e1c1c;});}return null;};}function removeEntity(_0x57c8e0,_0x474143){return function(_0x330ba1){if(_0x330ba1){return _0x330ba1[_0x1851('0x29')]()[_0x1851('0x28')](function(){_0x57c8e0[_0x1851('0x1b')](0xcc)[_0x1851('0x1c')]();});}};}function handleEntityNotFound(_0x22184a,_0x50c692){return function(_0x259891){if(!_0x259891){_0x22184a[_0x1851('0x1a')](0x194);}return _0x259891;};}function handleError(_0x1517fa,_0x590a2a){_0x590a2a=_0x590a2a||0x1f4;return function(_0x292732){logger['error'](_0x292732[_0x1851('0x2a')]);if(_0x292732[_0x1851('0x2b')]){delete _0x292732[_0x1851('0x2b')];}_0x1517fa[_0x1851('0x1b')](_0x590a2a)['send'](_0x292732);};}exports[_0x1851('0x2c')]=function(_0x2f0db1,_0x451ecb){var _0x1728aa={},_0x4cfeb7={},_0x40a743={'count':0x0,'rows':[]};var _0x2af52a=_[_0x1851('0x2d')](db['SquareReport']['rawAttributes'],function(_0x407169){return{'name':_0x407169[_0x1851('0x2e')],'type':_0x407169[_0x1851('0x2f')][_0x1851('0x30')]};});_0x4cfeb7[_0x1851('0x31')]=_['map'](_0x2af52a,_0x1851('0x2b'));_0x4cfeb7['query']=_[_0x1851('0x32')](_0x2f0db1[_0x1851('0x33')]);_0x4cfeb7[_0x1851('0x34')]=_[_0x1851('0x35')](_0x4cfeb7[_0x1851('0x31')],_0x4cfeb7[_0x1851('0x33')]);_0x1728aa['attributes']=_['intersection'](_0x4cfeb7[_0x1851('0x31')],qs['fields'](_0x2f0db1[_0x1851('0x33')][_0x1851('0x36')]));_0x1728aa[_0x1851('0x37')]=_0x1728aa[_0x1851('0x37')][_0x1851('0x38')]?_0x1728aa['attributes']:_0x4cfeb7[_0x1851('0x31')];if(!_0x2f0db1['query'][_0x1851('0x39')](_0x1851('0x3a'))){_0x1728aa[_0x1851('0x20')]=qs['limit'](_0x2f0db1[_0x1851('0x33')][_0x1851('0x20')]);_0x1728aa[_0x1851('0x1e')]=qs[_0x1851('0x1e')](_0x2f0db1[_0x1851('0x33')][_0x1851('0x1e')]);}_0x1728aa[_0x1851('0x3b')]=qs['sort'](_0x2f0db1['query'][_0x1851('0x3c')]);_0x1728aa[_0x1851('0x3d')]=qs[_0x1851('0x34')](_['pick'](_0x2f0db1[_0x1851('0x33')],_0x4cfeb7['filters']),_0x2af52a);if(_0x2f0db1[_0x1851('0x33')][_0x1851('0x3e')]){_0x1728aa[_0x1851('0x3d')]=_['merge'](_0x1728aa['where'],{'$or':_['map'](_0x2af52a,function(_0xd026f4){if(_0xd026f4[_0x1851('0x2f')]!==_0x1851('0x3f')){var _0x5770e1={};_0x5770e1[_0xd026f4[_0x1851('0x2b')]]={'$like':'%'+_0x2f0db1[_0x1851('0x33')][_0x1851('0x3e')]+'%'};return _0x5770e1;}})});}_0x1728aa=_[_0x1851('0x40')]({},_0x1728aa,_0x2f0db1['options']);var _0x2d7778={'where':_0x1728aa[_0x1851('0x3d')]};return db[_0x1851('0x41')][_0x1851('0x21')](_0x2d7778)[_0x1851('0x28')](function(_0x58eaee){_0x40a743['count']=_0x58eaee;if(_0x2f0db1[_0x1851('0x33')][_0x1851('0x42')]){_0x1728aa[_0x1851('0x43')]=[{'all':!![]}];}return db[_0x1851('0x41')][_0x1851('0x44')](_0x1728aa);})[_0x1851('0x28')](function(_0xa2609a){_0x40a743[_0x1851('0x45')]=_0xa2609a;return _0x40a743;})['then'](respondWithFilteredResult(_0x451ecb,_0x1728aa))[_0x1851('0x46')](handleError(_0x451ecb,null));};exports[_0x1851('0x47')]=function(_0x1bb911,_0x1bc704){var _0x5a229e={'raw':!![],'where':{'id':_0x1bb911[_0x1851('0x48')]['id']}},_0x45f2c3={};_0x45f2c3[_0x1851('0x31')]=_[_0x1851('0x32')](db[_0x1851('0x41')]['rawAttributes']);_0x45f2c3[_0x1851('0x33')]=_[_0x1851('0x32')](_0x1bb911['query']);_0x45f2c3['filters']=_['intersection'](_0x45f2c3[_0x1851('0x31')],_0x45f2c3[_0x1851('0x33')]);_0x5a229e[_0x1851('0x37')]=_[_0x1851('0x35')](_0x45f2c3[_0x1851('0x31')],qs[_0x1851('0x36')](_0x1bb911[_0x1851('0x33')][_0x1851('0x36')]));_0x5a229e[_0x1851('0x37')]=_0x5a229e[_0x1851('0x37')][_0x1851('0x38')]?_0x5a229e[_0x1851('0x37')]:_0x45f2c3['model'];if(_0x1bb911['query']['includeAll']){_0x5a229e['include']=[{'all':!![]}];}_0x5a229e=_[_0x1851('0x40')]({},_0x5a229e,_0x1bb911[_0x1851('0x49')]);return db['SquareReport']['find'](_0x5a229e)[_0x1851('0x28')](handleEntityNotFound(_0x1bc704,null))[_0x1851('0x28')](respondWithResult(_0x1bc704,null))[_0x1851('0x46')](handleError(_0x1bc704,null));};exports[_0x1851('0x4a')]=function(_0x3a7058,_0x166e7a){return db[_0x1851('0x41')]['create'](_0x3a7058[_0x1851('0x4b')],{})['then'](respondWithResult(_0x166e7a,0xc9))[_0x1851('0x46')](handleError(_0x166e7a,null));};exports[_0x1851('0x27')]=function(_0x47e194,_0x2dfcd0){if(_0x47e194['body']['id']){delete _0x47e194['body']['id'];}return db[_0x1851('0x41')][_0x1851('0x4c')]({'where':{'id':_0x47e194['params']['id']}})['then'](handleEntityNotFound(_0x2dfcd0,null))[_0x1851('0x28')](saveUpdates(_0x47e194[_0x1851('0x4b')],null))[_0x1851('0x28')](respondWithResult(_0x2dfcd0,null))[_0x1851('0x46')](handleError(_0x2dfcd0,null));};exports['destroy']=function(_0x318a0b,_0x328c72){return db['SquareReport'][_0x1851('0x4c')]({'where':{'id':_0x318a0b['params']['id']}})[_0x1851('0x28')](handleEntityNotFound(_0x328c72,null))[_0x1851('0x28')](removeEntity(_0x328c72,null))[_0x1851('0x46')](handleError(_0x328c72,null));};exports[_0x1851('0x4d')]=function(_0x4a36c8,_0x5d9d37){return db[_0x1851('0x41')]['describe']()[_0x1851('0x28')](respondWithResult(_0x5d9d37,null))[_0x1851('0x46')](handleError(_0x5d9d37,null));}; \ No newline at end of file +var _0x36c8=['keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','name','send','map','SquareReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x2fb696,_0x323b20){var _0x52424c=function(_0x530537){while(--_0x530537){_0x2fb696['push'](_0x2fb696['shift']());}};_0x52424c(++_0x323b20);}(_0x36c8,0x1d6));var _0x836c=function(_0x299f5c,_0x5f4687){_0x299f5c=_0x299f5c-0x0;var _0x15a3e9=_0x36c8[_0x299f5c];return _0x15a3e9;};'use strict';var emlformat=require(_0x836c('0x0'));var rimraf=require(_0x836c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x836c('0x2'));var rp=require(_0x836c('0x3'));var moment=require(_0x836c('0x4'));var BPromise=require(_0x836c('0x5'));var Mustache=require(_0x836c('0x6'));var util=require(_0x836c('0x7'));var path=require('path');var sox=require(_0x836c('0x8'));var csv=require(_0x836c('0x9'));var ejs=require(_0x836c('0xa'));var fs=require('fs');var fs_extra=require(_0x836c('0xb'));var _=require('lodash');var squel=require(_0x836c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x836c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x836c('0xe'));var Papa=require(_0x836c('0xf'));var Redis=require(_0x836c('0x10'));var authService=require(_0x836c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x836c('0x12'));var hardwareService=require(_0x836c('0x13'));var logger=require(_0x836c('0x14'))('api');var utils=require(_0x836c('0x15'));var config=require(_0x836c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x836c('0x17'))['db'];function respondWithStatusCode(_0x269783,_0x5ecb34){_0x5ecb34=_0x5ecb34||0xcc;return function(_0x444d6f){if(_0x444d6f){return _0x269783[_0x836c('0x18')](_0x5ecb34);}return _0x269783[_0x836c('0x19')](_0x5ecb34)[_0x836c('0x1a')]();};}function respondWithResult(_0x280628,_0x395cb0){_0x395cb0=_0x395cb0||0xc8;return function(_0x2bea0e){if(_0x2bea0e){return _0x280628[_0x836c('0x19')](_0x395cb0)[_0x836c('0x1b')](_0x2bea0e);}};}function respondWithFilteredResult(_0x547d43,_0x4a28e3){return function(_0x35c32f){if(_0x35c32f){var _0x10d765=typeof _0x4a28e3[_0x836c('0x1c')]===_0x836c('0x1d')&&typeof _0x4a28e3[_0x836c('0x1e')]===_0x836c('0x1d');var _0x18fce4=_0x35c32f[_0x836c('0x1f')];var _0x405dc0=_0x10d765?0x0:_0x4a28e3[_0x836c('0x1c')];var _0x1c002f=_0x10d765?_0x35c32f[_0x836c('0x1f')]:_0x4a28e3['offset']+_0x4a28e3[_0x836c('0x1e')];var _0x23a01d;if(_0x1c002f>=_0x18fce4){_0x1c002f=_0x18fce4;_0x23a01d=0xc8;}else{_0x23a01d=0xce;}_0x547d43['status'](_0x23a01d);return _0x547d43['set'](_0x836c('0x20'),_0x405dc0+'-'+_0x1c002f+'/'+_0x18fce4)[_0x836c('0x1b')](_0x35c32f);}return null;};}function patchUpdates(_0x3c418d){return function(_0x415477){try{jsonpatch['apply'](_0x415477,_0x3c418d,!![]);}catch(_0x53088f){return BPromise[_0x836c('0x21')](_0x53088f);}return _0x415477[_0x836c('0x22')]();};}function saveUpdates(_0x29cd26,_0xb454b8){return function(_0x152536){if(_0x152536){return _0x152536['update'](_0x29cd26)[_0x836c('0x23')](function(_0x18a929){return _0x18a929;});}return null;};}function removeEntity(_0x4841d7,_0x37bced){return function(_0x45d822){if(_0x45d822){return _0x45d822[_0x836c('0x24')]()['then'](function(){_0x4841d7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530485,_0x5c86f9){return function(_0x3a99d8){if(!_0x3a99d8){_0x530485[_0x836c('0x18')](0x194);}return _0x3a99d8;};}function handleError(_0x2a0e74,_0x4cfe3d){_0x4cfe3d=_0x4cfe3d||0x1f4;return function(_0x1ea8ae){logger[_0x836c('0x25')](_0x1ea8ae['stack']);if(_0x1ea8ae[_0x836c('0x26')]){delete _0x1ea8ae[_0x836c('0x26')];}_0x2a0e74[_0x836c('0x19')](_0x4cfe3d)[_0x836c('0x27')](_0x1ea8ae);};}exports['index']=function(_0x38d401,_0x430472){var _0x4a370a={},_0x48fe73={},_0x13b13e={'count':0x0,'rows':[]};var _0x5c42b2=_[_0x836c('0x28')](db[_0x836c('0x29')][_0x836c('0x2a')],function(_0x5ce15a){return{'name':_0x5ce15a[_0x836c('0x2b')],'type':_0x5ce15a[_0x836c('0x2c')][_0x836c('0x2d')]};});_0x48fe73[_0x836c('0x2e')]=_[_0x836c('0x28')](_0x5c42b2,_0x836c('0x26'));_0x48fe73[_0x836c('0x2f')]=_[_0x836c('0x30')](_0x38d401[_0x836c('0x2f')]);_0x48fe73['filters']=_[_0x836c('0x31')](_0x48fe73['model'],_0x48fe73['query']);_0x4a370a['attributes']=_['intersection'](_0x48fe73[_0x836c('0x2e')],qs['fields'](_0x38d401[_0x836c('0x2f')][_0x836c('0x32')]));_0x4a370a[_0x836c('0x33')]=_0x4a370a[_0x836c('0x33')][_0x836c('0x34')]?_0x4a370a['attributes']:_0x48fe73[_0x836c('0x2e')];if(!_0x38d401[_0x836c('0x2f')][_0x836c('0x35')](_0x836c('0x36'))){_0x4a370a['limit']=qs['limit'](_0x38d401[_0x836c('0x2f')][_0x836c('0x1e')]);_0x4a370a[_0x836c('0x1c')]=qs[_0x836c('0x1c')](_0x38d401[_0x836c('0x2f')][_0x836c('0x1c')]);}_0x4a370a[_0x836c('0x37')]=qs[_0x836c('0x38')](_0x38d401[_0x836c('0x2f')][_0x836c('0x38')]);_0x4a370a[_0x836c('0x39')]=qs[_0x836c('0x3a')](_[_0x836c('0x3b')](_0x38d401['query'],_0x48fe73[_0x836c('0x3a')]),_0x5c42b2);if(_0x38d401[_0x836c('0x2f')][_0x836c('0x3c')]){_0x4a370a['where']=_[_0x836c('0x3d')](_0x4a370a[_0x836c('0x39')],{'$or':_[_0x836c('0x28')](_0x5c42b2,function(_0x2735fe){if(_0x2735fe[_0x836c('0x2c')]!=='VIRTUAL'){var _0x37e637={};_0x37e637[_0x2735fe['name']]={'$like':'%'+_0x38d401[_0x836c('0x2f')][_0x836c('0x3c')]+'%'};return _0x37e637;}})});}_0x4a370a=_[_0x836c('0x3d')]({},_0x4a370a,_0x38d401[_0x836c('0x3e')]);var _0x5426b3={'where':_0x4a370a[_0x836c('0x39')]};return db[_0x836c('0x29')]['count'](_0x5426b3)['then'](function(_0x220088){_0x13b13e[_0x836c('0x1f')]=_0x220088;if(_0x38d401[_0x836c('0x2f')]['includeAll']){_0x4a370a[_0x836c('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0x836c('0x40')](_0x4a370a);})[_0x836c('0x23')](function(_0x367b69){_0x13b13e[_0x836c('0x41')]=_0x367b69;return _0x13b13e;})[_0x836c('0x23')](respondWithFilteredResult(_0x430472,_0x4a370a))[_0x836c('0x42')](handleError(_0x430472,null));};exports['show']=function(_0x146d95,_0x15bbec){var _0x33c805={'raw':!![],'where':{'id':_0x146d95[_0x836c('0x43')]['id']}},_0x52d9e3={};_0x52d9e3[_0x836c('0x2e')]=_[_0x836c('0x30')](db[_0x836c('0x29')][_0x836c('0x2a')]);_0x52d9e3[_0x836c('0x2f')]=_[_0x836c('0x30')](_0x146d95[_0x836c('0x2f')]);_0x52d9e3[_0x836c('0x3a')]=_[_0x836c('0x31')](_0x52d9e3[_0x836c('0x2e')],_0x52d9e3[_0x836c('0x2f')]);_0x33c805['attributes']=_['intersection'](_0x52d9e3['model'],qs[_0x836c('0x32')](_0x146d95[_0x836c('0x2f')][_0x836c('0x32')]));_0x33c805[_0x836c('0x33')]=_0x33c805[_0x836c('0x33')][_0x836c('0x34')]?_0x33c805['attributes']:_0x52d9e3[_0x836c('0x2e')];if(_0x146d95[_0x836c('0x2f')][_0x836c('0x44')]){_0x33c805[_0x836c('0x3f')]=[{'all':!![]}];}_0x33c805=_[_0x836c('0x3d')]({},_0x33c805,_0x146d95[_0x836c('0x3e')]);return db[_0x836c('0x29')][_0x836c('0x45')](_0x33c805)[_0x836c('0x23')](handleEntityNotFound(_0x15bbec,null))[_0x836c('0x23')](respondWithResult(_0x15bbec,null))[_0x836c('0x42')](handleError(_0x15bbec,null));};exports[_0x836c('0x46')]=function(_0x33b785,_0x10b2c1){return db[_0x836c('0x29')]['create'](_0x33b785['body'],{})[_0x836c('0x23')](respondWithResult(_0x10b2c1,0xc9))[_0x836c('0x42')](handleError(_0x10b2c1,null));};exports[_0x836c('0x47')]=function(_0x4e8f12,_0x2bcfb7){if(_0x4e8f12[_0x836c('0x48')]['id']){delete _0x4e8f12[_0x836c('0x48')]['id'];}return db[_0x836c('0x29')]['find']({'where':{'id':_0x4e8f12[_0x836c('0x43')]['id']}})[_0x836c('0x23')](handleEntityNotFound(_0x2bcfb7,null))[_0x836c('0x23')](saveUpdates(_0x4e8f12[_0x836c('0x48')],null))[_0x836c('0x23')](respondWithResult(_0x2bcfb7,null))[_0x836c('0x42')](handleError(_0x2bcfb7,null));};exports[_0x836c('0x24')]=function(_0x53cccb,_0x536b4c){return db[_0x836c('0x29')][_0x836c('0x45')]({'where':{'id':_0x53cccb[_0x836c('0x43')]['id']}})[_0x836c('0x23')](handleEntityNotFound(_0x536b4c,null))[_0x836c('0x23')](removeEntity(_0x536b4c,null))[_0x836c('0x42')](handleError(_0x536b4c,null));};exports[_0x836c('0x49')]=function(_0x45daf4,_0x3b1185){return db[_0x836c('0x29')][_0x836c('0x49')]()[_0x836c('0x23')](respondWithResult(_0x3b1185,null))[_0x836c('0x42')](handleError(_0x3b1185,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 686cdf4..c9a0e2c 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 _0x2f34=['../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','rimraf'];(function(_0x4ba17b,_0x55f724){var _0x1f0669=function(_0x424ce2){while(--_0x424ce2){_0x4ba17b['push'](_0x4ba17b['shift']());}};_0x1f0669(++_0x55f724);}(_0x2f34,0x1a9));var _0x42f3=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x2f34[_0x30c649];return _0x3edfb9;};'use strict';var _=require(_0x42f3('0x0'));var util=require(_0x42f3('0x1'));var logger=require(_0x42f3('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(_0x42f3('0x3'));var config=require(_0x42f3('0x4'));var attributes=require(_0x42f3('0x5'));module[_0x42f3('0x6')]=function(_0x11c0f0,_0x48c76e){return _0x11c0f0[_0x42f3('0x7')]('SquareReport',attributes,{'tableName':_0x42f3('0x8'),'paranoid':![],'indexes':[{'name':_0x42f3('0x9'),'fields':[_0x42f3('0xa'),_0x42f3('0xb')]},{'name':_0x42f3('0xc'),'fields':[_0x42f3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5210=['bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','util','api','moment'];(function(_0x2122e6,_0x2fcedb){var _0x40826a=function(_0x428748){while(--_0x428748){_0x2122e6['push'](_0x2122e6['shift']());}};_0x40826a(++_0x2fcedb);}(_0x5210,0x1ec));var _0x0521=function(_0x3139f6,_0xc7350){_0x3139f6=_0x3139f6-0x0;var _0x28f13b=_0x5210[_0x3139f6];return _0x28f13b;};'use strict';var _=require(_0x0521('0x0'));var util=require(_0x0521('0x1'));var logger=require('../../config/logger')(_0x0521('0x2'));var moment=require(_0x0521('0x3'));var BPromise=require(_0x0521('0x4'));var rp=require(_0x0521('0x5'));var fs=require('fs');var path=require(_0x0521('0x6'));var rimraf=require('rimraf');var config=require(_0x0521('0x7'));var attributes=require(_0x0521('0x8'));module[_0x0521('0x9')]=function(_0x500771,_0x26fcf9){return _0x500771[_0x0521('0xa')](_0x0521('0xb'),attributes,{'tableName':_0x0521('0xc'),'paranoid':![],'indexes':[{'name':_0x0521('0xd'),'fields':[_0x0521('0xe'),'project_name']},{'name':_0x0521('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d40e0e8..8fed2c3 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 _0x8517=['debug','stringify','error','message','result','SquareReport','body','options','raw','CreateSquareReport','catch','UpdateSquareReport','update','where','attributes','lodash','util','ioredis','../../mysqldb','rpc','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x356127,_0x4873ac){var _0x5d4c75=function(_0x4fe60c){while(--_0x4fe60c){_0x356127['push'](_0x356127['shift']());}};_0x5d4c75(++_0x4873ac);}(_0x8517,0x138));var _0x7851=function(_0x24931b,_0x54f6bb){_0x24931b=_0x24931b-0x0;var _0x2bd66f=_0x8517[_0x24931b];return _0x2bd66f;};'use strict';var _=require(_0x7851('0x0'));var util=require(_0x7851('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7851('0x2'));var db=require(_0x7851('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7851('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7851('0x5')][_0x7851('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x310097,_0x1b4f53,_0x57b86b){return new BPromise(function(_0xb25cf9,_0x131181){return client[_0x7851('0x7')](_0x310097,_0x57b86b)[_0x7851('0x8')](function(_0x595345){logger[_0x7851('0x9')](_0x7851('0xa'),_0x1b4f53,_0x7851('0xb'));logger[_0x7851('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x1b4f53,_0x7851('0xb'),JSON[_0x7851('0xd')](_0x595345));if(_0x595345[_0x7851('0xe')]){if(_0x595345[_0x7851('0xe')]['code']===0x1f4){logger['error'](_0x7851('0xa'),_0x1b4f53,_0x595345['error'][_0x7851('0xf')]);return _0x131181(_0x595345[_0x7851('0xe')][_0x7851('0xf')]);}logger[_0x7851('0xe')](_0x7851('0xa'),_0x1b4f53,_0x595345[_0x7851('0xe')][_0x7851('0xf')]);return _0xb25cf9(_0x595345[_0x7851('0xe')][_0x7851('0xf')]);}else{logger[_0x7851('0x9')]('SquareReport,\x20%s,\x20%s',_0x1b4f53,'request\x20sent');_0xb25cf9(_0x595345[_0x7851('0x10')]['message']);}})['catch'](function(_0x29d609){logger[_0x7851('0xe')]('SquareReport,\x20%s,\x20%s',_0x1b4f53,_0x29d609);_0x131181(_0x29d609);});});}exports['CreateSquareReport']=function(_0x309fa0){var _0x351995=this;return new Promise(function(_0x5bf919,_0x24bfd5){return db[_0x7851('0x11')]['create'](_0x309fa0[_0x7851('0x12')],{'raw':_0x309fa0[_0x7851('0x13')]?_0x309fa0[_0x7851('0x13')][_0x7851('0x14')]===undefined?!![]:![]:!![]})[_0x7851('0x8')](function(_0x2b6151){logger[_0x7851('0x9')](_0x7851('0x15'),_0x309fa0);logger['debug'](_0x7851('0x15'),_0x309fa0,JSON[_0x7851('0xd')](_0x2b6151));_0x5bf919(_0x2b6151);})[_0x7851('0x16')](function(_0x244986){logger[_0x7851('0xe')](_0x7851('0x15'),_0x244986[_0x7851('0xf')],_0x309fa0);_0x24bfd5(_0x351995[_0x7851('0xe')](0x1f4,_0x244986['message']));});});};exports[_0x7851('0x17')]=function(_0x586350){var _0x255c06=this;return new Promise(function(_0x180c69,_0x44b02c){return db['SquareReport'][_0x7851('0x18')](_0x586350[_0x7851('0x12')],{'raw':_0x586350[_0x7851('0x13')]?_0x586350[_0x7851('0x13')][_0x7851('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x586350[_0x7851('0x13')]?_0x586350['options'][_0x7851('0x19')]||null:null,'attributes':_0x586350[_0x7851('0x13')]?_0x586350[_0x7851('0x13')][_0x7851('0x1a')]||null:null,'limit':_0x586350[_0x7851('0x13')]?_0x586350[_0x7851('0x13')]['limit']||null:null})[_0x7851('0x8')](function(_0x2b7dc8){logger[_0x7851('0x9')](_0x7851('0x17'),_0x586350);logger[_0x7851('0xc')](_0x7851('0x17'),_0x586350,JSON['stringify'](_0x2b7dc8));_0x180c69(_0x2b7dc8);})[_0x7851('0x16')](function(_0xe839f3){logger['error']('UpdateSquareReport',_0xe839f3[_0x7851('0xf')],_0x586350);_0x44b02c(_0x255c06[_0x7851('0xe')](0x1f4,_0xe839f3[_0x7851('0xf')]));});});}; \ No newline at end of file +var _0x5795=['SquareReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','stringify','attributes','UpdateSquareReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2bc295,_0x34d992){var _0x5d4c21=function(_0x2d76aa){while(--_0x2d76aa){_0x2bc295['push'](_0x2bc295['shift']());}};_0x5d4c21(++_0x34d992);}(_0x5795,0x72));var _0x5579=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x5795[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0x5579('0x0'));var moment=require(_0x5579('0x1'));var BPromise=require(_0x5579('0x2'));var rs=require(_0x5579('0x3'));var fs=require('fs');var Redis=require(_0x5579('0x4'));var db=require(_0x5579('0x5'))['db'];var utils=require(_0x5579('0x6'));var logger=require(_0x5579('0x7'))(_0x5579('0x8'));var config=require(_0x5579('0x9'));var jayson=require(_0x5579('0xa'));var client=jayson[_0x5579('0xb')][_0x5579('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45f0ea,_0x307938,_0x22acf1){return new BPromise(function(_0x4540e8,_0x3990ee){return client['request'](_0x45f0ea,_0x22acf1)[_0x5579('0xd')](function(_0x2a783e){logger[_0x5579('0xe')](_0x5579('0xf'),_0x307938,_0x5579('0x10'));logger[_0x5579('0x11')](_0x5579('0x12'),_0x307938,_0x5579('0x10'),JSON['stringify'](_0x2a783e));if(_0x2a783e['error']){if(_0x2a783e['error'][_0x5579('0x13')]===0x1f4){logger[_0x5579('0x14')]('SquareReport,\x20%s,\x20%s',_0x307938,_0x2a783e[_0x5579('0x14')][_0x5579('0x15')]);return _0x3990ee(_0x2a783e[_0x5579('0x14')][_0x5579('0x15')]);}logger[_0x5579('0x14')](_0x5579('0xf'),_0x307938,_0x2a783e['error']['message']);return _0x4540e8(_0x2a783e['error'][_0x5579('0x15')]);}else{logger['info'](_0x5579('0xf'),_0x307938,'request\x20sent');_0x4540e8(_0x2a783e[_0x5579('0x16')][_0x5579('0x15')]);}})[_0x5579('0x17')](function(_0x245e33){logger[_0x5579('0x14')](_0x5579('0xf'),_0x307938,_0x245e33);_0x3990ee(_0x245e33);});});}exports[_0x5579('0x18')]=function(_0x1a1075){var _0x33704c=this;return new Promise(function(_0xd00586,_0x145a99){return db[_0x5579('0x19')][_0x5579('0x1a')](_0x1a1075[_0x5579('0x1b')],{'raw':_0x1a1075[_0x5579('0x1c')]?_0x1a1075[_0x5579('0x1c')][_0x5579('0x1d')]===undefined?!![]:![]:!![]})[_0x5579('0xd')](function(_0x3a61b8){logger[_0x5579('0xe')](_0x5579('0x18'),_0x1a1075);logger['debug']('CreateSquareReport',_0x1a1075,JSON[_0x5579('0x1e')](_0x3a61b8));_0xd00586(_0x3a61b8);})[_0x5579('0x17')](function(_0x5a8f89){logger[_0x5579('0x14')]('CreateSquareReport',_0x5a8f89[_0x5579('0x15')],_0x1a1075);_0x145a99(_0x33704c[_0x5579('0x14')](0x1f4,_0x5a8f89[_0x5579('0x15')]));});});};exports['UpdateSquareReport']=function(_0x33c5b6){var _0x542795=this;return new Promise(function(_0x152446,_0x35014f){return db[_0x5579('0x19')]['update'](_0x33c5b6[_0x5579('0x1b')],{'raw':_0x33c5b6[_0x5579('0x1c')]?_0x33c5b6[_0x5579('0x1c')][_0x5579('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33c5b6[_0x5579('0x1c')]?_0x33c5b6[_0x5579('0x1c')]['where']||null:null,'attributes':_0x33c5b6['options']?_0x33c5b6[_0x5579('0x1c')][_0x5579('0x1f')]||null:null,'limit':_0x33c5b6[_0x5579('0x1c')]?_0x33c5b6['options']['limit']||null:null})['then'](function(_0xc9669){logger['info'](_0x5579('0x20'),_0x33c5b6);logger[_0x5579('0x11')](_0x5579('0x20'),_0x33c5b6,JSON['stringify'](_0xc9669));_0x152446(_0xc9669);})[_0x5579('0x17')](function(_0xe566b5){logger[_0x5579('0x14')](_0x5579('0x20'),_0xe566b5['message'],_0x33c5b6);_0x35014f(_0x542795['error'](0x1f4,_0xe566b5[_0x5579('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 56bccf3..6787d81 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 _0xc26a=['/:id','isAuthenticated','show','post','create','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe'];(function(_0x4a049d,_0x5df213){var _0x28a322=function(_0x7febd7){while(--_0x7febd7){_0x4a049d['push'](_0x4a049d['shift']());}};_0x28a322(++_0x5df213);}(_0xc26a,0x1ac));var _0xac26=function(_0x577f71,_0x3a8951){_0x577f71=_0x577f71-0x0;var _0xfec7c2=_0xc26a[_0x577f71];return _0xfec7c2;};'use strict';var multer=require(_0xac26('0x0'));var util=require(_0xac26('0x1'));var path=require(_0xac26('0x2'));var timeout=require(_0xac26('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac26('0x4'));var auth=require(_0xac26('0x5'));var interaction=require(_0xac26('0x6'));var config=require(_0xac26('0x7'));var controller=require(_0xac26('0x8'));router[_0xac26('0x9')]('/',auth['isAuthenticated'](),controller[_0xac26('0xa')]);router[_0xac26('0x9')](_0xac26('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xac26('0x9')](_0xac26('0xc'),auth[_0xac26('0xd')](),controller[_0xac26('0xe')]);router[_0xac26('0xf')]('/',auth['isAuthenticated'](),controller[_0xac26('0x10')]);router[_0xac26('0x11')](_0xac26('0xc'),auth[_0xac26('0xd')](),controller[_0xac26('0x12')]);router['delete'](_0xac26('0xc'),auth[_0xac26('0xd')](),controller['destroy']);module[_0xac26('0x13')]=router; \ No newline at end of file +var _0x0588=['index','/describe','describe','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x11c4fa,_0x3d68f0){var _0x12e9aa=function(_0x417aa1){while(--_0x417aa1){_0x11c4fa['push'](_0x11c4fa['shift']());}};_0x12e9aa(++_0x3d68f0);}(_0x0588,0xba));var _0x8058=function(_0x483c0d,_0x1f41f7){_0x483c0d=_0x483c0d-0x0;var _0x2403e8=_0x0588[_0x483c0d];return _0x2403e8;};'use strict';var multer=require(_0x8058('0x0'));var util=require(_0x8058('0x1'));var path=require(_0x8058('0x2'));var timeout=require(_0x8058('0x3'));var express=require(_0x8058('0x4'));var router=express['Router']();var fs_extra=require(_0x8058('0x5'));var auth=require(_0x8058('0x6'));var interaction=require(_0x8058('0x7'));var config=require(_0x8058('0x8'));var controller=require(_0x8058('0x9'));router[_0x8058('0xa')]('/',auth[_0x8058('0xb')](),controller[_0x8058('0xc')]);router[_0x8058('0xa')](_0x8058('0xd'),auth[_0x8058('0xb')](),controller[_0x8058('0xe')]);router[_0x8058('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x8058('0xf')]);router[_0x8058('0x10')]('/',auth[_0x8058('0xb')](),controller[_0x8058('0x11')]);router[_0x8058('0x12')](_0x8058('0x13'),auth[_0x8058('0xb')](),controller['update']);router['delete'](_0x8058('0x13'),auth['isAuthenticated'](),controller[_0x8058('0x14')]);module[_0x8058('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 fa1e664..1b83968 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 _0xed9c=['STRING','TEXT','sequelize'];(function(_0x5aadc8,_0x9467d8){var _0x5ab6dc=function(_0x57e4d8){while(--_0x57e4d8){_0x5aadc8['push'](_0x5aadc8['shift']());}};_0x5ab6dc(++_0x9467d8);}(_0xed9c,0x1c7));var _0xced9=function(_0x8a66ca,_0x16ff63){_0x8a66ca=_0x8a66ca-0x0;var _0x4e75f6=_0xed9c[_0x8a66ca];return _0x4e75f6;};'use strict';var Sequelize=require(_0xced9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xced9('0x1')]},'node':{'type':Sequelize[_0xced9('0x1')]},'application':{'type':Sequelize[_0xced9('0x1')]},'data':{'type':Sequelize[_0xced9('0x2')]},'project_name':{'type':Sequelize[_0xced9('0x1')]},'callerid':{'type':Sequelize[_0xced9('0x1')]}}; \ No newline at end of file +var _0xd293=['sequelize','STRING','TEXT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd293,0x10e));var _0x3d29=function(_0xd7e831,_0x2d9b2c){_0xd7e831=_0xd7e831-0x0;var _0x59a2ba=_0xd293[_0xd7e831];return _0x59a2ba;};'use strict';var Sequelize=require(_0x3d29('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x3d29('0x1')]},'data':{'type':Sequelize[_0x3d29('0x2')]},'project_name':{'type':Sequelize[_0x3d29('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 0ddab48..e800056 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 _0xeb40=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','SquareDetailsReport','includeAll','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0xeb40,0x7c));var _0x0eb4=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xeb40[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x0eb4('0x0'));var rimraf=require(_0x0eb4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0eb4('0x2'));var rp=require(_0x0eb4('0x3'));var moment=require(_0x0eb4('0x4'));var BPromise=require(_0x0eb4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0eb4('0x6'));var sox=require(_0x0eb4('0x7'));var csv=require(_0x0eb4('0x8'));var ejs=require(_0x0eb4('0x9'));var fs=require('fs');var fs_extra=require(_0x0eb4('0xa'));var _=require(_0x0eb4('0xb'));var squel=require(_0x0eb4('0xc'));var crypto=require('crypto');var jsforce=require(_0x0eb4('0xd'));var deskjs=require(_0x0eb4('0xe'));var toCsv=require(_0x0eb4('0x8'));var querystring=require(_0x0eb4('0xf'));var Papa=require(_0x0eb4('0x10'));var Redis=require(_0x0eb4('0x11'));var authService=require(_0x0eb4('0x12'));var qs=require(_0x0eb4('0x13'));var as=require(_0x0eb4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0eb4('0x15'))(_0x0eb4('0x16'));var utils=require(_0x0eb4('0x17'));var config=require(_0x0eb4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0eb4('0x19'))['db'];function respondWithStatusCode(_0x1b77ab,_0x17dcf8){_0x17dcf8=_0x17dcf8||0xcc;return function(_0x5b8929){if(_0x5b8929){return _0x1b77ab[_0x0eb4('0x1a')](_0x17dcf8);}return _0x1b77ab[_0x0eb4('0x1b')](_0x17dcf8)[_0x0eb4('0x1c')]();};}function respondWithResult(_0x440f4d,_0x1ddb72){_0x1ddb72=_0x1ddb72||0xc8;return function(_0x3a43a7){if(_0x3a43a7){return _0x440f4d[_0x0eb4('0x1b')](_0x1ddb72)[_0x0eb4('0x1d')](_0x3a43a7);}};}function respondWithFilteredResult(_0x5834fa,_0x44c1bd){return function(_0x36b3df){if(_0x36b3df){var _0x4e8a4c=typeof _0x44c1bd[_0x0eb4('0x1e')]===_0x0eb4('0x1f')&&typeof _0x44c1bd[_0x0eb4('0x20')]===_0x0eb4('0x1f');var _0xe4f309=_0x36b3df[_0x0eb4('0x21')];var _0x1b44b8=_0x4e8a4c?0x0:_0x44c1bd['offset'];var _0xb802a4=_0x4e8a4c?_0x36b3df['count']:_0x44c1bd[_0x0eb4('0x1e')]+_0x44c1bd[_0x0eb4('0x20')];var _0x2d31df;if(_0xb802a4>=_0xe4f309){_0xb802a4=_0xe4f309;_0x2d31df=0xc8;}else{_0x2d31df=0xce;}_0x5834fa[_0x0eb4('0x1b')](_0x2d31df);return _0x5834fa[_0x0eb4('0x22')](_0x0eb4('0x23'),_0x1b44b8+'-'+_0xb802a4+'/'+_0xe4f309)[_0x0eb4('0x1d')](_0x36b3df);}return null;};}function patchUpdates(_0x3acd73){return function(_0x440cae){try{jsonpatch[_0x0eb4('0x24')](_0x440cae,_0x3acd73,!![]);}catch(_0x1a5846){return BPromise[_0x0eb4('0x25')](_0x1a5846);}return _0x440cae[_0x0eb4('0x26')]();};}function saveUpdates(_0x488e90,_0x6836d3){return function(_0x3e0c87){if(_0x3e0c87){return _0x3e0c87[_0x0eb4('0x27')](_0x488e90)['then'](function(_0xd73634){return _0xd73634;});}return null;};}function removeEntity(_0x4160b1,_0x81a73c){return function(_0x81bd19){if(_0x81bd19){return _0x81bd19[_0x0eb4('0x28')]()[_0x0eb4('0x29')](function(){_0x4160b1[_0x0eb4('0x1b')](0xcc)[_0x0eb4('0x1c')]();});}};}function handleEntityNotFound(_0x4c3aee,_0x400dfe){return function(_0x503b44){if(!_0x503b44){_0x4c3aee['sendStatus'](0x194);}return _0x503b44;};}function handleError(_0x37d0cc,_0x3f0eb2){_0x3f0eb2=_0x3f0eb2||0x1f4;return function(_0xfe7ec9){logger[_0x0eb4('0x2a')](_0xfe7ec9[_0x0eb4('0x2b')]);if(_0xfe7ec9[_0x0eb4('0x2c')]){delete _0xfe7ec9[_0x0eb4('0x2c')];}_0x37d0cc[_0x0eb4('0x1b')](_0x3f0eb2)[_0x0eb4('0x2d')](_0xfe7ec9);};}exports['index']=function(_0x44ab11,_0xe5036f){var _0x30c376={},_0x2cc8c8={},_0x21d08a={'count':0x0,'rows':[]};var _0x12b101=_[_0x0eb4('0x2e')](db['SquareDetailsReport']['rawAttributes'],function(_0x4fa46c){return{'name':_0x4fa46c[_0x0eb4('0x2f')],'type':_0x4fa46c['type'][_0x0eb4('0x30')]};});_0x2cc8c8[_0x0eb4('0x31')]=_[_0x0eb4('0x2e')](_0x12b101,_0x0eb4('0x2c'));_0x2cc8c8[_0x0eb4('0x32')]=_[_0x0eb4('0x33')](_0x44ab11[_0x0eb4('0x32')]);_0x2cc8c8[_0x0eb4('0x34')]=_[_0x0eb4('0x35')](_0x2cc8c8[_0x0eb4('0x31')],_0x2cc8c8[_0x0eb4('0x32')]);_0x30c376['attributes']=_[_0x0eb4('0x35')](_0x2cc8c8[_0x0eb4('0x31')],qs[_0x0eb4('0x36')](_0x44ab11[_0x0eb4('0x32')][_0x0eb4('0x36')]));_0x30c376[_0x0eb4('0x37')]=_0x30c376[_0x0eb4('0x37')][_0x0eb4('0x38')]?_0x30c376[_0x0eb4('0x37')]:_0x2cc8c8[_0x0eb4('0x31')];if(!_0x44ab11[_0x0eb4('0x32')][_0x0eb4('0x39')](_0x0eb4('0x3a'))){_0x30c376[_0x0eb4('0x20')]=qs[_0x0eb4('0x20')](_0x44ab11[_0x0eb4('0x32')][_0x0eb4('0x20')]);_0x30c376[_0x0eb4('0x1e')]=qs['offset'](_0x44ab11[_0x0eb4('0x32')]['offset']);}_0x30c376['order']=qs[_0x0eb4('0x3b')](_0x44ab11[_0x0eb4('0x32')][_0x0eb4('0x3b')]);_0x30c376[_0x0eb4('0x3c')]=qs[_0x0eb4('0x34')](_[_0x0eb4('0x3d')](_0x44ab11[_0x0eb4('0x32')],_0x2cc8c8[_0x0eb4('0x34')]),_0x12b101);if(_0x44ab11[_0x0eb4('0x32')]['filter']){_0x30c376[_0x0eb4('0x3c')]=_['merge'](_0x30c376[_0x0eb4('0x3c')],{'$or':_[_0x0eb4('0x2e')](_0x12b101,function(_0x3e53f6){if(_0x3e53f6[_0x0eb4('0x3e')]!==_0x0eb4('0x3f')){var _0x1bcd8c={};_0x1bcd8c[_0x3e53f6[_0x0eb4('0x2c')]]={'$like':'%'+_0x44ab11['query'][_0x0eb4('0x40')]+'%'};return _0x1bcd8c;}})});}_0x30c376=_[_0x0eb4('0x41')]({},_0x30c376,_0x44ab11[_0x0eb4('0x42')]);var _0x35b130={'where':_0x30c376[_0x0eb4('0x3c')]};return db[_0x0eb4('0x43')][_0x0eb4('0x21')](_0x35b130)[_0x0eb4('0x29')](function(_0x19b7d3){_0x21d08a[_0x0eb4('0x21')]=_0x19b7d3;if(_0x44ab11['query'][_0x0eb4('0x44')]){_0x30c376['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x0eb4('0x45')](_0x30c376);})[_0x0eb4('0x29')](function(_0x36d373){_0x21d08a['rows']=_0x36d373;return _0x21d08a;})[_0x0eb4('0x29')](respondWithFilteredResult(_0xe5036f,_0x30c376))[_0x0eb4('0x46')](handleError(_0xe5036f,null));};exports['show']=function(_0x43dab7,_0x1014e6){var _0x6ddf45={'raw':!![],'where':{'id':_0x43dab7[_0x0eb4('0x47')]['id']}},_0x195ee9={};_0x195ee9[_0x0eb4('0x31')]=_[_0x0eb4('0x33')](db[_0x0eb4('0x43')][_0x0eb4('0x48')]);_0x195ee9[_0x0eb4('0x32')]=_['keys'](_0x43dab7[_0x0eb4('0x32')]);_0x195ee9[_0x0eb4('0x34')]=_[_0x0eb4('0x35')](_0x195ee9[_0x0eb4('0x31')],_0x195ee9[_0x0eb4('0x32')]);_0x6ddf45[_0x0eb4('0x37')]=_[_0x0eb4('0x35')](_0x195ee9['model'],qs[_0x0eb4('0x36')](_0x43dab7[_0x0eb4('0x32')]['fields']));_0x6ddf45['attributes']=_0x6ddf45[_0x0eb4('0x37')]['length']?_0x6ddf45[_0x0eb4('0x37')]:_0x195ee9[_0x0eb4('0x31')];if(_0x43dab7[_0x0eb4('0x32')][_0x0eb4('0x44')]){_0x6ddf45['include']=[{'all':!![]}];}_0x6ddf45=_[_0x0eb4('0x41')]({},_0x6ddf45,_0x43dab7[_0x0eb4('0x42')]);return db[_0x0eb4('0x43')][_0x0eb4('0x49')](_0x6ddf45)[_0x0eb4('0x29')](handleEntityNotFound(_0x1014e6,null))[_0x0eb4('0x29')](respondWithResult(_0x1014e6,null))[_0x0eb4('0x46')](handleError(_0x1014e6,null));};exports[_0x0eb4('0x4a')]=function(_0x4256e9,_0x34251e){return db[_0x0eb4('0x43')][_0x0eb4('0x4a')](_0x4256e9[_0x0eb4('0x4b')],{})[_0x0eb4('0x29')](respondWithResult(_0x34251e,0xc9))[_0x0eb4('0x46')](handleError(_0x34251e,null));};exports[_0x0eb4('0x27')]=function(_0x29d512,_0x2f8ad3){if(_0x29d512[_0x0eb4('0x4b')]['id']){delete _0x29d512[_0x0eb4('0x4b')]['id'];}return db[_0x0eb4('0x43')]['find']({'where':{'id':_0x29d512[_0x0eb4('0x47')]['id']}})[_0x0eb4('0x29')](handleEntityNotFound(_0x2f8ad3,null))[_0x0eb4('0x29')](saveUpdates(_0x29d512[_0x0eb4('0x4b')],null))[_0x0eb4('0x29')](respondWithResult(_0x2f8ad3,null))[_0x0eb4('0x46')](handleError(_0x2f8ad3,null));};exports[_0x0eb4('0x28')]=function(_0x2b8583,_0x54741d){return db['SquareDetailsReport'][_0x0eb4('0x49')]({'where':{'id':_0x2b8583[_0x0eb4('0x47')]['id']}})[_0x0eb4('0x29')](handleEntityNotFound(_0x54741d,null))['then'](removeEntity(_0x54741d,null))[_0x0eb4('0x46')](handleError(_0x54741d,null));};exports[_0x0eb4('0x4c')]=function(_0x164c16,_0x149014){return db[_0x0eb4('0x43')][_0x0eb4('0x4c')]()['then'](respondWithResult(_0x149014,null))[_0x0eb4('0x46')](handleError(_0x149014,null));}; \ No newline at end of file +var _0xbac2=['send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','merge','where','options','includeAll','rows','show','params','include','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x5e3882,_0x4743db){var _0x4935cf=function(_0x3e2301){while(--_0x3e2301){_0x5e3882['push'](_0x5e3882['shift']());}};_0x4935cf(++_0x4743db);}(_0xbac2,0x107));var _0x2bac=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0xbac2[_0x307086];return _0x699043;};'use strict';var emlformat=require(_0x2bac('0x0'));var rimraf=require(_0x2bac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2bac('0x2'));var rp=require(_0x2bac('0x3'));var moment=require(_0x2bac('0x4'));var BPromise=require(_0x2bac('0x5'));var Mustache=require(_0x2bac('0x6'));var util=require('util');var path=require(_0x2bac('0x7'));var sox=require(_0x2bac('0x8'));var csv=require(_0x2bac('0x9'));var ejs=require(_0x2bac('0xa'));var fs=require('fs');var fs_extra=require(_0x2bac('0xb'));var _=require('lodash');var squel=require(_0x2bac('0xc'));var crypto=require(_0x2bac('0xd'));var jsforce=require(_0x2bac('0xe'));var deskjs=require(_0x2bac('0xf'));var toCsv=require(_0x2bac('0x9'));var querystring=require(_0x2bac('0x10'));var Papa=require(_0x2bac('0x11'));var Redis=require(_0x2bac('0x12'));var authService=require(_0x2bac('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2bac('0x14'));var hardwareService=require(_0x2bac('0x15'));var logger=require(_0x2bac('0x16'))(_0x2bac('0x17'));var utils=require(_0x2bac('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2bac('0x19'));var db=require(_0x2bac('0x1a'))['db'];function respondWithStatusCode(_0x2f8916,_0x52c05d){_0x52c05d=_0x52c05d||0xcc;return function(_0x6e27a8){if(_0x6e27a8){return _0x2f8916[_0x2bac('0x1b')](_0x52c05d);}return _0x2f8916[_0x2bac('0x1c')](_0x52c05d)[_0x2bac('0x1d')]();};}function respondWithResult(_0x2cd422,_0x1a71f2){_0x1a71f2=_0x1a71f2||0xc8;return function(_0x592a43){if(_0x592a43){return _0x2cd422[_0x2bac('0x1c')](_0x1a71f2)[_0x2bac('0x1e')](_0x592a43);}};}function respondWithFilteredResult(_0x13db3b,_0x26f3c3){return function(_0xd9dfe3){if(_0xd9dfe3){var _0x4df844=typeof _0x26f3c3[_0x2bac('0x1f')]==='undefined'&&typeof _0x26f3c3['limit']===_0x2bac('0x20');var _0x3fbdcd=_0xd9dfe3['count'];var _0x110214=_0x4df844?0x0:_0x26f3c3['offset'];var _0x335e71=_0x4df844?_0xd9dfe3[_0x2bac('0x21')]:_0x26f3c3['offset']+_0x26f3c3[_0x2bac('0x22')];var _0x464fd6;if(_0x335e71>=_0x3fbdcd){_0x335e71=_0x3fbdcd;_0x464fd6=0xc8;}else{_0x464fd6=0xce;}_0x13db3b[_0x2bac('0x1c')](_0x464fd6);return _0x13db3b[_0x2bac('0x23')]('Content-Range',_0x110214+'-'+_0x335e71+'/'+_0x3fbdcd)[_0x2bac('0x1e')](_0xd9dfe3);}return null;};}function patchUpdates(_0x203594){return function(_0x40bf10){try{jsonpatch[_0x2bac('0x24')](_0x40bf10,_0x203594,!![]);}catch(_0x389786){return BPromise[_0x2bac('0x25')](_0x389786);}return _0x40bf10[_0x2bac('0x26')]();};}function saveUpdates(_0x1bbf36,_0x4ec1e7){return function(_0x5ef765){if(_0x5ef765){return _0x5ef765[_0x2bac('0x27')](_0x1bbf36)[_0x2bac('0x28')](function(_0xc0d447){return _0xc0d447;});}return null;};}function removeEntity(_0x548912,_0xdf4b6f){return function(_0x575f32){if(_0x575f32){return _0x575f32[_0x2bac('0x29')]()[_0x2bac('0x28')](function(){_0x548912[_0x2bac('0x1c')](0xcc)[_0x2bac('0x1d')]();});}};}function handleEntityNotFound(_0xd679cb,_0x31d6c4){return function(_0x4a6bf8){if(!_0x4a6bf8){_0xd679cb[_0x2bac('0x1b')](0x194);}return _0x4a6bf8;};}function handleError(_0x14c4ba,_0x3ce33f){_0x3ce33f=_0x3ce33f||0x1f4;return function(_0xfed6fd){logger[_0x2bac('0x2a')](_0xfed6fd[_0x2bac('0x2b')]);if(_0xfed6fd[_0x2bac('0x2c')]){delete _0xfed6fd[_0x2bac('0x2c')];}_0x14c4ba[_0x2bac('0x1c')](_0x3ce33f)[_0x2bac('0x2d')](_0xfed6fd);};}exports[_0x2bac('0x2e')]=function(_0x367860,_0x5ee9cf){var _0x4228ba={},_0x44bc49={},_0x159844={'count':0x0,'rows':[]};var _0x403175=_[_0x2bac('0x2f')](db[_0x2bac('0x30')][_0x2bac('0x31')],function(_0x11a8e8){return{'name':_0x11a8e8[_0x2bac('0x32')],'type':_0x11a8e8[_0x2bac('0x33')][_0x2bac('0x34')]};});_0x44bc49[_0x2bac('0x35')]=_[_0x2bac('0x2f')](_0x403175,_0x2bac('0x2c'));_0x44bc49[_0x2bac('0x36')]=_[_0x2bac('0x37')](_0x367860[_0x2bac('0x36')]);_0x44bc49[_0x2bac('0x38')]=_[_0x2bac('0x39')](_0x44bc49['model'],_0x44bc49[_0x2bac('0x36')]);_0x4228ba[_0x2bac('0x3a')]=_[_0x2bac('0x39')](_0x44bc49[_0x2bac('0x35')],qs['fields'](_0x367860[_0x2bac('0x36')][_0x2bac('0x3b')]));_0x4228ba[_0x2bac('0x3a')]=_0x4228ba[_0x2bac('0x3a')][_0x2bac('0x3c')]?_0x4228ba[_0x2bac('0x3a')]:_0x44bc49['model'];if(!_0x367860['query']['hasOwnProperty']('nolimit')){_0x4228ba[_0x2bac('0x22')]=qs[_0x2bac('0x22')](_0x367860[_0x2bac('0x36')][_0x2bac('0x22')]);_0x4228ba[_0x2bac('0x1f')]=qs[_0x2bac('0x1f')](_0x367860[_0x2bac('0x36')][_0x2bac('0x1f')]);}_0x4228ba[_0x2bac('0x3d')]=qs['sort'](_0x367860[_0x2bac('0x36')][_0x2bac('0x3e')]);_0x4228ba['where']=qs[_0x2bac('0x38')](_[_0x2bac('0x3f')](_0x367860['query'],_0x44bc49['filters']),_0x403175);if(_0x367860['query']['filter']){_0x4228ba['where']=_[_0x2bac('0x40')](_0x4228ba[_0x2bac('0x41')],{'$or':_[_0x2bac('0x2f')](_0x403175,function(_0x553abd){if(_0x553abd[_0x2bac('0x33')]!=='VIRTUAL'){var _0x2040ab={};_0x2040ab[_0x553abd[_0x2bac('0x2c')]]={'$like':'%'+_0x367860['query']['filter']+'%'};return _0x2040ab;}})});}_0x4228ba=_[_0x2bac('0x40')]({},_0x4228ba,_0x367860[_0x2bac('0x42')]);var _0x32aea7={'where':_0x4228ba['where']};return db[_0x2bac('0x30')][_0x2bac('0x21')](_0x32aea7)[_0x2bac('0x28')](function(_0x187338){_0x159844[_0x2bac('0x21')]=_0x187338;if(_0x367860[_0x2bac('0x36')][_0x2bac('0x43')]){_0x4228ba['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x4228ba);})[_0x2bac('0x28')](function(_0x3a6cb4){_0x159844[_0x2bac('0x44')]=_0x3a6cb4;return _0x159844;})['then'](respondWithFilteredResult(_0x5ee9cf,_0x4228ba))['catch'](handleError(_0x5ee9cf,null));};exports[_0x2bac('0x45')]=function(_0x9e447c,_0x576bc9){var _0x1ee710={'raw':!![],'where':{'id':_0x9e447c[_0x2bac('0x46')]['id']}},_0x577443={};_0x577443[_0x2bac('0x35')]=_[_0x2bac('0x37')](db[_0x2bac('0x30')][_0x2bac('0x31')]);_0x577443['query']=_[_0x2bac('0x37')](_0x9e447c['query']);_0x577443['filters']=_[_0x2bac('0x39')](_0x577443[_0x2bac('0x35')],_0x577443['query']);_0x1ee710[_0x2bac('0x3a')]=_[_0x2bac('0x39')](_0x577443['model'],qs['fields'](_0x9e447c[_0x2bac('0x36')][_0x2bac('0x3b')]));_0x1ee710['attributes']=_0x1ee710[_0x2bac('0x3a')]['length']?_0x1ee710['attributes']:_0x577443[_0x2bac('0x35')];if(_0x9e447c[_0x2bac('0x36')][_0x2bac('0x43')]){_0x1ee710[_0x2bac('0x47')]=[{'all':!![]}];}_0x1ee710=_['merge']({},_0x1ee710,_0x9e447c[_0x2bac('0x42')]);return db[_0x2bac('0x30')]['find'](_0x1ee710)['then'](handleEntityNotFound(_0x576bc9,null))[_0x2bac('0x28')](respondWithResult(_0x576bc9,null))[_0x2bac('0x48')](handleError(_0x576bc9,null));};exports[_0x2bac('0x49')]=function(_0x3eba23,_0x91eaec){return db[_0x2bac('0x30')][_0x2bac('0x49')](_0x3eba23[_0x2bac('0x4a')],{})[_0x2bac('0x28')](respondWithResult(_0x91eaec,0xc9))[_0x2bac('0x48')](handleError(_0x91eaec,null));};exports[_0x2bac('0x27')]=function(_0x1cc59c,_0x2d8de8){if(_0x1cc59c['body']['id']){delete _0x1cc59c[_0x2bac('0x4a')]['id'];}return db[_0x2bac('0x30')][_0x2bac('0x4b')]({'where':{'id':_0x1cc59c[_0x2bac('0x46')]['id']}})[_0x2bac('0x28')](handleEntityNotFound(_0x2d8de8,null))[_0x2bac('0x28')](saveUpdates(_0x1cc59c[_0x2bac('0x4a')],null))[_0x2bac('0x28')](respondWithResult(_0x2d8de8,null))[_0x2bac('0x48')](handleError(_0x2d8de8,null));};exports[_0x2bac('0x29')]=function(_0x382e08,_0x547cbc){return db['SquareDetailsReport']['find']({'where':{'id':_0x382e08[_0x2bac('0x46')]['id']}})[_0x2bac('0x28')](handleEntityNotFound(_0x547cbc,null))[_0x2bac('0x28')](removeEntity(_0x547cbc,null))[_0x2bac('0x48')](handleError(_0x547cbc,null));};exports[_0x2bac('0x4c')]=function(_0x30a65f,_0x5cd896){return db[_0x2bac('0x30')][_0x2bac('0x4c')]()[_0x2bac('0x28')](respondWithResult(_0x5cd896,null))[_0x2bac('0x48')](handleError(_0x5cd896,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 94439d4..b7fe64f 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 _0xd4a1=['exports','define','report_square_details','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x582df7,_0x3d02cf){var _0x5081fd=function(_0x3f197c){while(--_0x3f197c){_0x582df7['push'](_0x582df7['shift']());}};_0x5081fd(++_0x3d02cf);}(_0xd4a1,0x147));var _0x1d4a=function(_0x511b97,_0x51f31b){_0x511b97=_0x511b97-0x0;var _0x39f660=_0xd4a1[_0x511b97];return _0x39f660;};'use strict';var _=require(_0x1d4a('0x0'));var util=require(_0x1d4a('0x1'));var logger=require('../../config/logger')(_0x1d4a('0x2'));var moment=require('moment');var BPromise=require(_0x1d4a('0x3'));var rp=require(_0x1d4a('0x4'));var fs=require('fs');var path=require(_0x1d4a('0x5'));var rimraf=require(_0x1d4a('0x6'));var config=require(_0x1d4a('0x7'));var attributes=require(_0x1d4a('0x8'));module[_0x1d4a('0x9')]=function(_0x55afbc,_0x2b0017){return _0x55afbc[_0x1d4a('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x1d4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1f5=['../../config/environment','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x318093,_0x423b61){var _0x5ef51f=function(_0x34f51b){while(--_0x34f51b){_0x318093['push'](_0x318093['shift']());}};_0x5ef51f(++_0x423b61);}(_0xe1f5,0x122));var _0x5e1f=function(_0x3525d8,_0x34b8b5){_0x3525d8=_0x3525d8-0x0;var _0x1a01fb=_0xe1f5[_0x3525d8];return _0x1a01fb;};'use strict';var _=require(_0x5e1f('0x0'));var util=require(_0x5e1f('0x1'));var logger=require(_0x5e1f('0x2'))(_0x5e1f('0x3'));var moment=require(_0x5e1f('0x4'));var BPromise=require(_0x5e1f('0x5'));var rp=require(_0x5e1f('0x6'));var fs=require('fs');var path=require(_0x5e1f('0x7'));var rimraf=require(_0x5e1f('0x8'));var config=require(_0x5e1f('0x9'));var attributes=require('./squareReportDetail.attributes');module[_0x5e1f('0xa')]=function(_0x11cbe7,_0x1825bd){return _0x11cbe7[_0x5e1f('0xb')](_0x5e1f('0xc'),attributes,{'tableName':'report_square_details','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 c887e69..36cb865 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcbb=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a27f3,_0x1c082d){var _0x3ce222=function(_0x3f93e1){while(--_0x3f93e1){_0x1a27f3['push'](_0x1a27f3['shift']());}};_0x3ce222(++_0x1c082d);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x355bae,_0x3020eb){_0x355bae=_0x355bae-0x0;var _0x124de7=_0xfcbb[_0x355bae];return _0x124de7;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateSquareDetailsReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0x7fea=['options','raw','then','debug','stringify','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x404734,_0x364cb0){var _0x421433=function(_0x32a2fa){while(--_0x32a2fa){_0x404734['push'](_0x404734['shift']());}};_0x421433(++_0x364cb0);}(_0x7fea,0x149));var _0xa7fe=function(_0x2f58ed,_0x44eef7){_0x2f58ed=_0x2f58ed-0x0;var _0x1758ed=_0x7fea[_0x2f58ed];return _0x1758ed;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa7fe('0x1'));var fs=require('fs');var Redis=require(_0xa7fe('0x2'));var db=require(_0xa7fe('0x3'))['db'];var utils=require(_0xa7fe('0x4'));var logger=require(_0xa7fe('0x5'))(_0xa7fe('0x6'));var config=require('../../config/environment');var jayson=require(_0xa7fe('0x7'));var client=jayson[_0xa7fe('0x8')][_0xa7fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1132f1,_0x45f967,_0x3597b0){return new BPromise(function(_0x4668f0,_0x3d9135){return client['request'](_0x1132f1,_0x3597b0)['then'](function(_0x1db10e){logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,_0xa7fe('0xc'));logger['debug'](_0xa7fe('0xd'),_0x45f967,_0xa7fe('0xc'),JSON['stringify'](_0x1db10e));if(_0x1db10e[_0xa7fe('0xe')]){if(_0x1db10e['error'][_0xa7fe('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x45f967,_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);return _0x3d9135(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}logger[_0xa7fe('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x45f967,_0x1db10e['error'][_0xa7fe('0x10')]);return _0x4668f0(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}else{logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,'request\x20sent');_0x4668f0(_0x1db10e[_0xa7fe('0x11')][_0xa7fe('0x10')]);}})[_0xa7fe('0x12')](function(_0x253293){logger[_0xa7fe('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x45f967,_0x253293);_0x3d9135(_0x253293);});});}exports[_0xa7fe('0x13')]=function(_0x1e4966){var _0x2bf8db=this;return new Promise(function(_0x2ef53c,_0x179b9e){return db[_0xa7fe('0x14')][_0xa7fe('0x15')](_0x1e4966['body'],{'raw':_0x1e4966['options']?_0x1e4966[_0xa7fe('0x16')][_0xa7fe('0x17')]===undefined?!![]:![]:!![]})[_0xa7fe('0x18')](function(_0x529990){logger[_0xa7fe('0xa')](_0xa7fe('0x13'),_0x1e4966);logger[_0xa7fe('0x19')]('CreateSquareDetailsReport',_0x1e4966,JSON[_0xa7fe('0x1a')](_0x529990));_0x2ef53c(_0x529990);})[_0xa7fe('0x12')](function(_0x1619c1){logger[_0xa7fe('0xe')](_0xa7fe('0x13'),_0x1619c1[_0xa7fe('0x10')],_0x1e4966);_0x179b9e(_0x2bf8db[_0xa7fe('0xe')](0x1f4,_0x1619c1[_0xa7fe('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1ab15d2..cbf817f 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 _0xc79d=['../../components/auth/service','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','Router'];(function(_0x19c2a4,_0x4df9da){var _0x42ca01=function(_0x2df3ee){while(--_0x2df3ee){_0x19c2a4['push'](_0x19c2a4['shift']());}};_0x42ca01(++_0x4df9da);}(_0xc79d,0x177));var _0xdc79=function(_0x11a16a,_0x3fdbda){_0x11a16a=_0x11a16a-0x0;var _0x729648=_0xc79d[_0x11a16a];return _0x729648;};'use strict';var express=require('express');var router=express[_0xdc79('0x0')]();var auth=require(_0xdc79('0x1'));var controller=require('./system.controller');router[_0xdc79('0x2')]('/',auth['isAuthenticated'](),controller[_0xdc79('0x3')]);router[_0xdc79('0x2')](_0xdc79('0x4'),auth[_0xdc79('0x5')](),controller[_0xdc79('0x6')]);module[_0xdc79('0x7')]=router; \ No newline at end of file +var _0xb94d=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','isAuthenticated','index','get'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0xb94d,0x16b));var _0xdb94=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xb94d[_0x934425];return _0x31d596;};'use strict';var express=require(_0xdb94('0x0'));var router=express[_0xdb94('0x1')]();var auth=require(_0xdb94('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0xdb94('0x3')](),controller[_0xdb94('0x4')]);router[_0xdb94('0x5')](_0xdb94('0x6'),auth[_0xdb94('0x3')](),controller[_0xdb94('0x7')]);module[_0xdb94('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 9bd30d5..96f842a 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 _0xd51a=['send','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x5f0627,_0x72504a){var _0x490fe6=function(_0x421e95){while(--_0x421e95){_0x5f0627['push'](_0x5f0627['shift']());}};_0x490fe6(++_0x72504a);}(_0xd51a,0x1b5));var _0xad51=function(_0x509caf,_0x3baf64){_0x509caf=_0x509caf-0x0;var _0x511d7d=_0xd51a[_0x509caf];return _0x511d7d;};'use strict';var info=require(_0xad51('0x0'));var exec=require('child_process')[_0xad51('0x1')];var logger=require('../../config/logger')(_0xad51('0x2'));var util=require(_0xad51('0x3'));var BPromise=require(_0xad51('0x4'));var _=require(_0xad51('0x5'));function handleError(_0x36ce1f,_0x529b5e,_0x124cab){_0x529b5e=_0x529b5e||0x1f4;return function(_0x34e3d1){logger[_0xad51('0x6')](_0xad51('0x7'),_0x124cab,_0x529b5e,util[_0xad51('0x8')](_0x34e3d1,{'showHidden':![],'depth':null}));delete _0x34e3d1[_0xad51('0x9')];_0x36ce1f[_0xad51('0xa')](_0x529b5e)[_0xad51('0xb')](_0x34e3d1);};}exports[_0xad51('0xc')]=function(_0x424e88,_0xf93dd6){return info[_0xad51('0xd')]()[_0xad51('0xe')](function(_0x3a47cd){return _0xf93dd6[_0xad51('0xa')](0xc8)[_0xad51('0xf')](_0x3a47cd);})['catch'](function(_0x585843){return _0xf93dd6['status'](0x1f4)[_0xad51('0xf')](_0x585843);});};exports[_0xad51('0x10')]=function(_0x1587f0,_0x12fe29){var _0xaaad8=[_0xad51('0x11')];return new BPromise(function(_0x1cc8f8,_0x327634){return exec(util[_0xad51('0x12')](_0xad51('0x13'),_0x1587f0['params'][_0xad51('0x14')]),function(_0x238009,_0x2e36d3,_0x31ea9b){if(_0x238009){return _0x327634(_0x238009);}return _0x1cc8f8(_0x2e36d3);});})[_0xad51('0xe')](function(_0x31a0a9){var _0x409100=![];var _0x54f98a=_0x31a0a9[_0xad51('0x15')](/\n/);for(var _0x1b71e7=0x0,_0x48d9a8=_0xaaad8[_0xad51('0x16')];_0x1b71e7<_0x48d9a8,_0x409100===![];_0x1b71e7+=0x1){if(_0x31a0a9[_0xad51('0x17')](_0xaaad8[_0x1b71e7])>=0x0){_0x409100=!![];}}if(!_0x409100){throw new Error(util[_0xad51('0x12')](_0xad51('0x18'),_0x1587f0['params']['pid']));}process['kill'](_0x1587f0[_0xad51('0x19')][_0xad51('0x14')],_0xad51('0x1a'));return _0x12fe29[_0xad51('0xa')](0xc8)['json']({'message':util[_0xad51('0x12')](_0xad51('0x1b'),_0x1587f0['params'][_0xad51('0x14')])});})['catch'](handleError(_0x12fe29,null,'killProcess'));}; \ No newline at end of file +var _0x7422=['format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','status','send','index','getAllData','catch','components/import/cm'];(function(_0x53c340,_0x4121da){var _0x140ea5=function(_0x7663d1){while(--_0x7663d1){_0x53c340['push'](_0x53c340['shift']());}};_0x140ea5(++_0x4121da);}(_0x7422,0x82));var _0x2742=function(_0x2cda09,_0x287a40){_0x2cda09=_0x2cda09-0x0;var _0x4c19b5=_0x7422[_0x2cda09];return _0x4c19b5;};'use strict';var info=require(_0x2742('0x0'));var exec=require(_0x2742('0x1'))['exec'];var logger=require(_0x2742('0x2'))(_0x2742('0x3'));var util=require(_0x2742('0x4'));var BPromise=require(_0x2742('0x5'));var _=require(_0x2742('0x6'));function handleError(_0x151d58,_0x52bdbd,_0x56eb52){_0x52bdbd=_0x52bdbd||0x1f4;return function(_0x5e16ac){logger[_0x2742('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x56eb52,_0x52bdbd,util['inspect'](_0x5e16ac,{'showHidden':![],'depth':null}));delete _0x5e16ac['name'];_0x151d58[_0x2742('0x8')](_0x52bdbd)[_0x2742('0x9')](_0x5e16ac);};}exports[_0x2742('0xa')]=function(_0x56319a,_0x235eab){return info[_0x2742('0xb')]()['then'](function(_0x5e0bee){return _0x235eab[_0x2742('0x8')](0xc8)['json'](_0x5e0bee);})[_0x2742('0xc')](function(_0x3477b7){return _0x235eab[_0x2742('0x8')](0x1f4)['json'](_0x3477b7);});};exports['killProcess']=function(_0x30a160,_0x2ba6ea){var _0xac93d5=[_0x2742('0xd')];return new BPromise(function(_0x19683f,_0x5c7ca1){return exec(util[_0x2742('0xe')](_0x2742('0xf'),_0x30a160[_0x2742('0x10')][_0x2742('0x11')]),function(_0x7c2a29,_0x3ad125,_0x4f5bb1){if(_0x7c2a29){return _0x5c7ca1(_0x7c2a29);}return _0x19683f(_0x3ad125);});})['then'](function(_0x2115b5){var _0x15652c=![];var _0x4c24df=_0x2115b5[_0x2742('0x12')](/\n/);for(var _0x19a7b2=0x0,_0x2a3a21=_0xac93d5['length'];_0x19a7b2<_0x2a3a21,_0x15652c===![];_0x19a7b2+=0x1){if(_0x2115b5[_0x2742('0x13')](_0xac93d5[_0x19a7b2])>=0x0){_0x15652c=!![];}}if(!_0x15652c){throw new Error(util['format'](_0x2742('0x14'),_0x30a160[_0x2742('0x10')][_0x2742('0x11')]));}process['kill'](_0x30a160[_0x2742('0x10')][_0x2742('0x11')],_0x2742('0x15'));return _0x2ba6ea[_0x2742('0x8')](0xc8)['json']({'message':util['format'](_0x2742('0x16'),_0x30a160[_0x2742('0x10')][_0x2742('0x11')])});})[_0x2742('0xc')](handleError(_0x2ba6ea,null,_0x2742('0x17')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6095e4e..d49f5f2 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 _0xb6a6=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','/:id','show','post','create','update','destroy'];(function(_0x242b8f,_0xb7845e){var _0x73a85b=function(_0xf89d0){while(--_0xf89d0){_0x242b8f['push'](_0x242b8f['shift']());}};_0x73a85b(++_0xb7845e);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0xf97648,_0x3c2d9c){_0xf97648=_0xf97648-0x0;var _0x2d2321=_0xb6a6[_0xf97648];return _0x2d2321;};'use strict';var multer=require(_0x6b6a('0x0'));var util=require(_0x6b6a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b6a('0x2'));var router=express[_0x6b6a('0x3')]();var fs_extra=require(_0x6b6a('0x4'));var auth=require(_0x6b6a('0x5'));var interaction=require(_0x6b6a('0x6'));var config=require('../../config/environment');var controller=require(_0x6b6a('0x7'));router[_0x6b6a('0x8')]('/',auth[_0x6b6a('0x9')](),controller['index']);router[_0x6b6a('0x8')](_0x6b6a('0xa'),auth['isAuthenticated'](),controller[_0x6b6a('0xb')]);router[_0x6b6a('0xc')]('/',auth['isAuthenticated'](),controller[_0x6b6a('0xd')]);router['put'](_0x6b6a('0xa'),auth[_0x6b6a('0x9')](),controller[_0x6b6a('0xe')]);router['delete']('/:id',auth[_0x6b6a('0x9')](),controller[_0x6b6a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb3c3=['./tag.controller','get','index','/:id','isAuthenticated','show','create','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb1dcdd,_0x27702c){var _0x1ff423=function(_0x57aec6){while(--_0x57aec6){_0xb1dcdd['push'](_0xb1dcdd['shift']());}};_0x1ff423(++_0x27702c);}(_0xb3c3,0x1ce));var _0x3b3c=function(_0x5c66b9,_0x22e906){_0x5c66b9=_0x5c66b9-0x0;var _0xf92eb2=_0xb3c3[_0x5c66b9];return _0xf92eb2;};'use strict';var multer=require(_0x3b3c('0x0'));var util=require('util');var path=require(_0x3b3c('0x1'));var timeout=require('connect-timeout');var express=require(_0x3b3c('0x2'));var router=express['Router']();var fs_extra=require(_0x3b3c('0x3'));var auth=require(_0x3b3c('0x4'));var interaction=require(_0x3b3c('0x5'));var config=require('../../config/environment');var controller=require(_0x3b3c('0x6'));router[_0x3b3c('0x7')]('/',auth['isAuthenticated'](),controller[_0x3b3c('0x8')]);router['get'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller[_0x3b3c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b3c('0xc')]);router['put'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller['update']);router['delete'](_0x3b3c('0x9'),auth[_0x3b3c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 1316443..3f8071b 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 _0xa45c=['STRING','sequelize','exports'];(function(_0x46b2a7,_0x10048e){var _0x19ec73=function(_0x2f5c40){while(--_0x2f5c40){_0x46b2a7['push'](_0x46b2a7['shift']());}};_0x19ec73(++_0x10048e);}(_0xa45c,0x6d));var _0xca45=function(_0x5707f7,_0x2f8459){_0x5707f7=_0x5707f7-0x0;var _0x6ea94=_0xa45c[_0x5707f7];return _0x6ea94;};'use strict';var Sequelize=require(_0xca45('0x0'));module[_0xca45('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xca45('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xca45('0x2')]}}; \ No newline at end of file +var _0x3176=['name','#0091EA','sequelize','exports','STRING'];(function(_0x36965d,_0x5bcd40){var _0x142442=function(_0x25429a){while(--_0x25429a){_0x36965d['push'](_0x36965d['shift']());}};_0x142442(++_0x5bcd40);}(_0x3176,0x1d8));var _0x6317=function(_0x479fc0,_0x1fa07a){_0x479fc0=_0x479fc0-0x0;var _0x1f8e91=_0x3176[_0x479fc0];return _0x1f8e91;};'use strict';var Sequelize=require(_0x6317('0x0'));module[_0x6317('0x1')]={'name':{'type':Sequelize[_0x6317('0x2')],'unique':_0x6317('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6317('0x2')],'defaultValue':_0x6317('0x4')},'description':{'type':Sequelize[_0x6317('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index decac64..1a5b4b0 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 _0x073e=['save','update','then','destroy','stack','name','send','index','Tag','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','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','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject'];(function(_0x369b1b,_0x1a0416){var _0x331879=function(_0xb821c3){while(--_0xb821c3){_0x369b1b['push'](_0x369b1b['shift']());}};_0x331879(++_0x1a0416);}(_0x073e,0x181));var _0xe073=function(_0x27ee81,_0x336e7a){_0x27ee81=_0x27ee81-0x0;var _0x267182=_0x073e[_0x27ee81];return _0x267182;};'use strict';var emlformat=require(_0xe073('0x0'));var rimraf=require(_0xe073('0x1'));var zipdir=require(_0xe073('0x2'));var jsonpatch=require(_0xe073('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe073('0x4'));var util=require(_0xe073('0x5'));var path=require(_0xe073('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe073('0x7'));var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe073('0x17'))['db'];function respondWithStatusCode(_0x56e3f5,_0x3dedf7){_0x3dedf7=_0x3dedf7||0xcc;return function(_0x5d2f2f){if(_0x5d2f2f){return _0x56e3f5[_0xe073('0x18')](_0x3dedf7);}return _0x56e3f5['status'](_0x3dedf7)[_0xe073('0x19')]();};}function respondWithResult(_0x27d34,_0x47828d){_0x47828d=_0x47828d||0xc8;return function(_0x2ce92d){if(_0x2ce92d){return _0x27d34[_0xe073('0x1a')](_0x47828d)[_0xe073('0x1b')](_0x2ce92d);}};}function respondWithFilteredResult(_0x2f4b36,_0xfb28f5){return function(_0x208f2e){if(_0x208f2e){var _0x26f3d3=typeof _0xfb28f5[_0xe073('0x1c')]==='undefined'&&typeof _0xfb28f5['limit']==='undefined';var _0x4c578c=_0x208f2e[_0xe073('0x1d')];var _0x10486c=_0x26f3d3?0x0:_0xfb28f5[_0xe073('0x1c')];var _0x4f9c8e=_0x26f3d3?_0x208f2e[_0xe073('0x1d')]:_0xfb28f5[_0xe073('0x1c')]+_0xfb28f5[_0xe073('0x1e')];var _0x54c10e;if(_0x4f9c8e>=_0x4c578c){_0x4f9c8e=_0x4c578c;_0x54c10e=0xc8;}else{_0x54c10e=0xce;}_0x2f4b36[_0xe073('0x1a')](_0x54c10e);return _0x2f4b36[_0xe073('0x1f')](_0xe073('0x20'),_0x10486c+'-'+_0x4f9c8e+'/'+_0x4c578c)[_0xe073('0x1b')](_0x208f2e);}return null;};}function patchUpdates(_0x43668e){return function(_0x17dd4b){try{jsonpatch[_0xe073('0x21')](_0x17dd4b,_0x43668e,!![]);}catch(_0x1d7a13){return BPromise[_0xe073('0x22')](_0x1d7a13);}return _0x17dd4b[_0xe073('0x23')]();};}function saveUpdates(_0x5143fa,_0x4405fd){return function(_0x21f9c2){if(_0x21f9c2){return _0x21f9c2[_0xe073('0x24')](_0x5143fa)[_0xe073('0x25')](function(_0x39bcb4){return _0x39bcb4;});}return null;};}function removeEntity(_0x275aa8,_0x504c26){return function(_0x4c76ef){if(_0x4c76ef){return _0x4c76ef[_0xe073('0x26')]()['then'](function(){var _0x5e3b16=_0x4c76ef['get']({'plain':!![]});var _0x5c4137='Tags';return db['UserProfileResource'][_0xe073('0x26')]({'where':{'type':_0x5c4137,'resourceId':_0x5e3b16['id']}})[_0xe073('0x25')](function(){return _0x4c76ef;});})['then'](function(){_0x275aa8[_0xe073('0x1a')](0xcc)[_0xe073('0x19')]();});}};}function handleEntityNotFound(_0x436c34,_0x5a5b2b){return function(_0x10f5ba){if(!_0x10f5ba){_0x436c34['sendStatus'](0x194);}return _0x10f5ba;};}function handleError(_0x255d91,_0x2e5fac){_0x2e5fac=_0x2e5fac||0x1f4;return function(_0x599972){logger['error'](_0x599972[_0xe073('0x27')]);if(_0x599972[_0xe073('0x28')]){delete _0x599972[_0xe073('0x28')];}_0x255d91[_0xe073('0x1a')](_0x2e5fac)[_0xe073('0x29')](_0x599972);};}exports[_0xe073('0x2a')]=function(_0x4f60dd,_0x2a206a){var _0x5c04fe={},_0x1baa0a={},_0x1cdcb0={'count':0x0,'rows':[]};var _0x4a6884=_['map'](db[_0xe073('0x2b')]['rawAttributes'],function(_0x3f6564){return{'name':_0x3f6564[_0xe073('0x2c')],'type':_0x3f6564[_0xe073('0x2d')]['key']};});_0x1baa0a['model']=_[_0xe073('0x2e')](_0x4a6884,_0xe073('0x28'));_0x1baa0a['query']=_[_0xe073('0x2f')](_0x4f60dd[_0xe073('0x30')]);_0x1baa0a[_0xe073('0x31')]=_['intersection'](_0x1baa0a[_0xe073('0x32')],_0x1baa0a['query']);_0x5c04fe['attributes']=_[_0xe073('0x33')](_0x1baa0a[_0xe073('0x32')],qs[_0xe073('0x34')](_0x4f60dd['query'][_0xe073('0x34')]));_0x5c04fe[_0xe073('0x35')]=_0x5c04fe[_0xe073('0x35')]['length']?_0x5c04fe[_0xe073('0x35')]:_0x1baa0a[_0xe073('0x32')];if(!_0x4f60dd[_0xe073('0x30')][_0xe073('0x36')](_0xe073('0x37'))){_0x5c04fe[_0xe073('0x1e')]=qs['limit'](_0x4f60dd[_0xe073('0x30')][_0xe073('0x1e')]);_0x5c04fe[_0xe073('0x1c')]=qs['offset'](_0x4f60dd[_0xe073('0x30')][_0xe073('0x1c')]);}_0x5c04fe[_0xe073('0x38')]=qs[_0xe073('0x39')](_0x4f60dd[_0xe073('0x30')]['sort']);_0x5c04fe[_0xe073('0x3a')]=qs['filters'](_[_0xe073('0x3b')](_0x4f60dd[_0xe073('0x30')],_0x1baa0a[_0xe073('0x31')]),_0x4a6884);if(_0x4f60dd[_0xe073('0x30')][_0xe073('0x3c')]){_0x5c04fe[_0xe073('0x3a')]=_[_0xe073('0x3d')](_0x5c04fe[_0xe073('0x3a')],{'$or':_[_0xe073('0x2e')](_0x4a6884,function(_0x3d29e5){if(_0x3d29e5[_0xe073('0x2d')]!==_0xe073('0x3e')){var _0x16be1a={};_0x16be1a[_0x3d29e5['name']]={'$like':'%'+_0x4f60dd[_0xe073('0x30')]['filter']+'%'};return _0x16be1a;}})});}_0x5c04fe=_[_0xe073('0x3d')]({},_0x5c04fe,_0x4f60dd[_0xe073('0x3f')]);var _0x5a4e19={'where':_0x5c04fe[_0xe073('0x3a')]};return db['Tag'][_0xe073('0x1d')](_0x5a4e19)[_0xe073('0x25')](function(_0x93852a){_0x1cdcb0[_0xe073('0x1d')]=_0x93852a;if(_0x4f60dd[_0xe073('0x30')]['includeAll']){_0x5c04fe[_0xe073('0x40')]=[{'all':!![]}];}return db['Tag'][_0xe073('0x41')](_0x5c04fe);})[_0xe073('0x25')](function(_0x125d1f){_0x1cdcb0[_0xe073('0x42')]=_0x125d1f;return _0x1cdcb0;})[_0xe073('0x25')](respondWithFilteredResult(_0x2a206a,_0x5c04fe))[_0xe073('0x43')](handleError(_0x2a206a,null));};exports[_0xe073('0x44')]=function(_0x2f4939,_0x1b50c5){var _0x2d3ffe={'raw':!![],'where':{'id':_0x2f4939['params']['id']}},_0x2c312b={};_0x2c312b['model']=_[_0xe073('0x2f')](db[_0xe073('0x2b')][_0xe073('0x45')]);_0x2c312b[_0xe073('0x30')]=_[_0xe073('0x2f')](_0x2f4939['query']);_0x2c312b[_0xe073('0x31')]=_[_0xe073('0x33')](_0x2c312b[_0xe073('0x32')],_0x2c312b[_0xe073('0x30')]);_0x2d3ffe[_0xe073('0x35')]=_['intersection'](_0x2c312b[_0xe073('0x32')],qs['fields'](_0x2f4939['query'][_0xe073('0x34')]));_0x2d3ffe[_0xe073('0x35')]=_0x2d3ffe['attributes']['length']?_0x2d3ffe[_0xe073('0x35')]:_0x2c312b[_0xe073('0x32')];if(_0x2f4939[_0xe073('0x30')][_0xe073('0x46')]){_0x2d3ffe[_0xe073('0x40')]=[{'all':!![]}];}_0x2d3ffe=_[_0xe073('0x3d')]({},_0x2d3ffe,_0x2f4939[_0xe073('0x3f')]);return db['Tag'][_0xe073('0x47')](_0x2d3ffe)['then'](handleEntityNotFound(_0x1b50c5,null))[_0xe073('0x25')](respondWithResult(_0x1b50c5,null))[_0xe073('0x43')](handleError(_0x1b50c5,null));};exports[_0xe073('0x48')]=function(_0x4e1f1d,_0x4d5bcd){return db[_0xe073('0x2b')][_0xe073('0x48')](_0x4e1f1d[_0xe073('0x49')],{})['then'](function(_0x151035){var _0x338557=_0x4e1f1d[_0xe073('0x4a')][_0xe073('0x4b')]({'plain':!![]});if(!_0x338557)throw new Error(_0xe073('0x4c'));if(_0x338557[_0xe073('0x4d')]===_0xe073('0x4a')){var _0x307541=_0x151035[_0xe073('0x4b')]({'plain':!![]});var _0x5626d4=_0xe073('0x4e');return db['UserProfileSection'][_0xe073('0x47')]({'where':{'name':_0x5626d4,'userProfileId':_0x338557['userProfileId']},'raw':!![]})[_0xe073('0x25')](function(_0x202687){if(_0x202687&&_0x202687[_0xe073('0x4f')]===0x0){return db[_0xe073('0x50')]['create']({'name':_0x307541[_0xe073('0x28')],'resourceId':_0x307541['id'],'type':_0x202687[_0xe073('0x28')],'sectionId':_0x202687['id']},{})[_0xe073('0x25')](function(){return _0x151035;});}else{return _0x151035;}})['catch'](function(_0x5503c2){logger[_0xe073('0x51')](_0xe073('0x52'),_0x5503c2);throw _0x5503c2;});}return _0x151035;})[_0xe073('0x25')](respondWithResult(_0x4d5bcd,0xc9))[_0xe073('0x43')](handleError(_0x4d5bcd,null));};exports[_0xe073('0x24')]=function(_0x5212d5,_0x197c42){if(_0x5212d5[_0xe073('0x49')]['id']){delete _0x5212d5[_0xe073('0x49')]['id'];}return db[_0xe073('0x2b')][_0xe073('0x47')]({'where':{'id':_0x5212d5[_0xe073('0x53')]['id']}})[_0xe073('0x25')](handleEntityNotFound(_0x197c42,null))[_0xe073('0x25')](saveUpdates(_0x5212d5[_0xe073('0x49')],null))[_0xe073('0x25')](respondWithResult(_0x197c42,null))['catch'](handleError(_0x197c42,null));};exports[_0xe073('0x26')]=function(_0x582007,_0x5825eb){return db[_0xe073('0x2b')][_0xe073('0x47')]({'where':{'id':_0x582007[_0xe073('0x53')]['id']}})['then'](handleEntityNotFound(_0x5825eb,null))[_0xe073('0x25')](removeEntity(_0x5825eb,null))[_0xe073('0x43')](handleError(_0x5825eb,null));}; \ No newline at end of file +var _0xb49a=['UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','destroy','get','Tags','UserProfileResource','then','stack','name','send','map','Tag','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x55945d,_0x3ebe03){var _0xa48ce2=function(_0x4a2330){while(--_0x4a2330){_0x55945d['push'](_0x55945d['shift']());}};_0xa48ce2(++_0x3ebe03);}(_0xb49a,0xfb));var _0xab49=function(_0x36f47e,_0x1d85cd){_0x36f47e=_0x36f47e-0x0;var _0x4e6a98=_0xb49a[_0x36f47e];return _0x4e6a98;};'use strict';var emlformat=require(_0xab49('0x0'));var rimraf=require(_0xab49('0x1'));var zipdir=require(_0xab49('0x2'));var jsonpatch=require(_0xab49('0x3'));var rp=require(_0xab49('0x4'));var moment=require('moment');var BPromise=require(_0xab49('0x5'));var Mustache=require(_0xab49('0x6'));var util=require('util');var path=require('path');var sox=require(_0xab49('0x7'));var csv=require(_0xab49('0x8'));var ejs=require(_0xab49('0x9'));var fs=require('fs');var fs_extra=require(_0xab49('0xa'));var _=require(_0xab49('0xb'));var squel=require(_0xab49('0xc'));var crypto=require(_0xab49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab49('0xe'));var toCsv=require(_0xab49('0x8'));var querystring=require(_0xab49('0xf'));var Papa=require(_0xab49('0x10'));var Redis=require(_0xab49('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab49('0x12'));var hardwareService=require(_0xab49('0x13'));var logger=require(_0xab49('0x14'))(_0xab49('0x15'));var utils=require(_0xab49('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xab49('0x17'));var db=require(_0xab49('0x18'))['db'];function respondWithStatusCode(_0x34af0d,_0x207d79){_0x207d79=_0x207d79||0xcc;return function(_0x394c1e){if(_0x394c1e){return _0x34af0d[_0xab49('0x19')](_0x207d79);}return _0x34af0d[_0xab49('0x1a')](_0x207d79)[_0xab49('0x1b')]();};}function respondWithResult(_0x24b4ad,_0x389ebb){_0x389ebb=_0x389ebb||0xc8;return function(_0x40f465){if(_0x40f465){return _0x24b4ad['status'](_0x389ebb)[_0xab49('0x1c')](_0x40f465);}};}function respondWithFilteredResult(_0x38ee23,_0x205b09){return function(_0x9c59e1){if(_0x9c59e1){var _0x14d8b8=typeof _0x205b09['offset']===_0xab49('0x1d')&&typeof _0x205b09[_0xab49('0x1e')]===_0xab49('0x1d');var _0xcaa6ca=_0x9c59e1[_0xab49('0x1f')];var _0x47f977=_0x14d8b8?0x0:_0x205b09[_0xab49('0x20')];var _0x24cb8f=_0x14d8b8?_0x9c59e1[_0xab49('0x1f')]:_0x205b09['offset']+_0x205b09['limit'];var _0x31da6b;if(_0x24cb8f>=_0xcaa6ca){_0x24cb8f=_0xcaa6ca;_0x31da6b=0xc8;}else{_0x31da6b=0xce;}_0x38ee23[_0xab49('0x1a')](_0x31da6b);return _0x38ee23['set'](_0xab49('0x21'),_0x47f977+'-'+_0x24cb8f+'/'+_0xcaa6ca)[_0xab49('0x1c')](_0x9c59e1);}return null;};}function patchUpdates(_0x49b716){return function(_0x3662b2){try{jsonpatch['apply'](_0x3662b2,_0x49b716,!![]);}catch(_0x34211e){return BPromise[_0xab49('0x22')](_0x34211e);}return _0x3662b2['save']();};}function saveUpdates(_0x5802db,_0x333506){return function(_0x4fa8d2){if(_0x4fa8d2){return _0x4fa8d2[_0xab49('0x23')](_0x5802db)['then'](function(_0x35682a){return _0x35682a;});}return null;};}function removeEntity(_0x2faeca,_0x2ba18a){return function(_0x579039){if(_0x579039){return _0x579039[_0xab49('0x24')]()['then'](function(){var _0x322153=_0x579039[_0xab49('0x25')]({'plain':!![]});var _0x5c3d71=_0xab49('0x26');return db[_0xab49('0x27')]['destroy']({'where':{'type':_0x5c3d71,'resourceId':_0x322153['id']}})['then'](function(){return _0x579039;});})[_0xab49('0x28')](function(){_0x2faeca[_0xab49('0x1a')](0xcc)[_0xab49('0x1b')]();});}};}function handleEntityNotFound(_0x5b7c22,_0x1b1fed){return function(_0x237273){if(!_0x237273){_0x5b7c22['sendStatus'](0x194);}return _0x237273;};}function handleError(_0x894724,_0x169fd7){_0x169fd7=_0x169fd7||0x1f4;return function(_0x342fdf){logger['error'](_0x342fdf[_0xab49('0x29')]);if(_0x342fdf['name']){delete _0x342fdf[_0xab49('0x2a')];}_0x894724['status'](_0x169fd7)[_0xab49('0x2b')](_0x342fdf);};}exports['index']=function(_0x134a03,_0x24bd0f){var _0x1c48ef={},_0x211be2={},_0x49f122={'count':0x0,'rows':[]};var _0x6e83f6=_[_0xab49('0x2c')](db[_0xab49('0x2d')]['rawAttributes'],function(_0x2b18b9){return{'name':_0x2b18b9['fieldName'],'type':_0x2b18b9[_0xab49('0x2e')]['key']};});_0x211be2['model']=_['map'](_0x6e83f6,_0xab49('0x2a'));_0x211be2['query']=_[_0xab49('0x2f')](_0x134a03[_0xab49('0x30')]);_0x211be2[_0xab49('0x31')]=_['intersection'](_0x211be2[_0xab49('0x32')],_0x211be2[_0xab49('0x30')]);_0x1c48ef[_0xab49('0x33')]=_[_0xab49('0x34')](_0x211be2[_0xab49('0x32')],qs['fields'](_0x134a03[_0xab49('0x30')][_0xab49('0x35')]));_0x1c48ef['attributes']=_0x1c48ef['attributes'][_0xab49('0x36')]?_0x1c48ef[_0xab49('0x33')]:_0x211be2[_0xab49('0x32')];if(!_0x134a03[_0xab49('0x30')][_0xab49('0x37')](_0xab49('0x38'))){_0x1c48ef[_0xab49('0x1e')]=qs[_0xab49('0x1e')](_0x134a03[_0xab49('0x30')][_0xab49('0x1e')]);_0x1c48ef[_0xab49('0x20')]=qs[_0xab49('0x20')](_0x134a03[_0xab49('0x30')]['offset']);}_0x1c48ef[_0xab49('0x39')]=qs[_0xab49('0x3a')](_0x134a03[_0xab49('0x30')][_0xab49('0x3a')]);_0x1c48ef[_0xab49('0x3b')]=qs['filters'](_[_0xab49('0x3c')](_0x134a03['query'],_0x211be2['filters']),_0x6e83f6);if(_0x134a03[_0xab49('0x30')][_0xab49('0x3d')]){_0x1c48ef[_0xab49('0x3b')]=_[_0xab49('0x3e')](_0x1c48ef[_0xab49('0x3b')],{'$or':_['map'](_0x6e83f6,function(_0x37b9cb){if(_0x37b9cb[_0xab49('0x2e')]!==_0xab49('0x3f')){var _0x46e02f={};_0x46e02f[_0x37b9cb[_0xab49('0x2a')]]={'$like':'%'+_0x134a03['query']['filter']+'%'};return _0x46e02f;}})});}_0x1c48ef=_[_0xab49('0x3e')]({},_0x1c48ef,_0x134a03[_0xab49('0x40')]);var _0x24a628={'where':_0x1c48ef['where']};return db[_0xab49('0x2d')]['count'](_0x24a628)['then'](function(_0x597e1c){_0x49f122['count']=_0x597e1c;if(_0x134a03[_0xab49('0x30')][_0xab49('0x41')]){_0x1c48ef[_0xab49('0x42')]=[{'all':!![]}];}return db[_0xab49('0x2d')][_0xab49('0x43')](_0x1c48ef);})[_0xab49('0x28')](function(_0x162841){_0x49f122[_0xab49('0x44')]=_0x162841;return _0x49f122;})[_0xab49('0x28')](respondWithFilteredResult(_0x24bd0f,_0x1c48ef))[_0xab49('0x45')](handleError(_0x24bd0f,null));};exports['show']=function(_0x158042,_0x1ea64d){var _0x523dd2={'raw':!![],'where':{'id':_0x158042[_0xab49('0x46')]['id']}},_0x20ecfb={};_0x20ecfb[_0xab49('0x32')]=_[_0xab49('0x2f')](db[_0xab49('0x2d')][_0xab49('0x47')]);_0x20ecfb[_0xab49('0x30')]=_[_0xab49('0x2f')](_0x158042['query']);_0x20ecfb[_0xab49('0x31')]=_[_0xab49('0x34')](_0x20ecfb[_0xab49('0x32')],_0x20ecfb['query']);_0x523dd2[_0xab49('0x33')]=_[_0xab49('0x34')](_0x20ecfb[_0xab49('0x32')],qs[_0xab49('0x35')](_0x158042[_0xab49('0x30')][_0xab49('0x35')]));_0x523dd2['attributes']=_0x523dd2[_0xab49('0x33')][_0xab49('0x36')]?_0x523dd2[_0xab49('0x33')]:_0x20ecfb[_0xab49('0x32')];if(_0x158042[_0xab49('0x30')][_0xab49('0x41')]){_0x523dd2['include']=[{'all':!![]}];}_0x523dd2=_[_0xab49('0x3e')]({},_0x523dd2,_0x158042[_0xab49('0x40')]);return db[_0xab49('0x2d')][_0xab49('0x48')](_0x523dd2)[_0xab49('0x28')](handleEntityNotFound(_0x1ea64d,null))[_0xab49('0x28')](respondWithResult(_0x1ea64d,null))[_0xab49('0x45')](handleError(_0x1ea64d,null));};exports[_0xab49('0x49')]=function(_0x2ae9dc,_0xfb7d69){return db[_0xab49('0x2d')][_0xab49('0x49')](_0x2ae9dc['body'],{})[_0xab49('0x28')](function(_0x130b06){var _0x2d7072=_0x2ae9dc[_0xab49('0x4a')][_0xab49('0x25')]({'plain':!![]});if(!_0x2d7072)throw new Error(_0xab49('0x4b'));if(_0x2d7072[_0xab49('0x4c')]==='user'){var _0x3b7f1e=_0x130b06['get']({'plain':!![]});var _0x36ed09='Tags';return db[_0xab49('0x4d')][_0xab49('0x48')]({'where':{'name':_0x36ed09,'userProfileId':_0x2d7072['userProfileId']},'raw':!![]})[_0xab49('0x28')](function(_0x2a26ff){if(_0x2a26ff&&_0x2a26ff[_0xab49('0x4e')]===0x0){return db[_0xab49('0x27')][_0xab49('0x49')]({'name':_0x3b7f1e[_0xab49('0x2a')],'resourceId':_0x3b7f1e['id'],'type':_0x2a26ff[_0xab49('0x2a')],'sectionId':_0x2a26ff['id']},{})[_0xab49('0x28')](function(){return _0x130b06;});}else{return _0x130b06;}})[_0xab49('0x45')](function(_0x24c03c){logger[_0xab49('0x4f')](_0xab49('0x50'),_0x24c03c);throw _0x24c03c;});}return _0x130b06;})[_0xab49('0x28')](respondWithResult(_0xfb7d69,0xc9))[_0xab49('0x45')](handleError(_0xfb7d69,null));};exports[_0xab49('0x23')]=function(_0x474761,_0x487e52){if(_0x474761['body']['id']){delete _0x474761[_0xab49('0x51')]['id'];}return db[_0xab49('0x2d')][_0xab49('0x48')]({'where':{'id':_0x474761[_0xab49('0x46')]['id']}})[_0xab49('0x28')](handleEntityNotFound(_0x487e52,null))['then'](saveUpdates(_0x474761[_0xab49('0x51')],null))[_0xab49('0x28')](respondWithResult(_0x487e52,null))[_0xab49('0x45')](handleError(_0x487e52,null));};exports[_0xab49('0x24')]=function(_0x3cf211,_0x122850){return db['Tag'][_0xab49('0x48')]({'where':{'id':_0x3cf211[_0xab49('0x46')]['id']}})[_0xab49('0x28')](handleEntityNotFound(_0x122850,null))[_0xab49('0x28')](removeEntity(_0x122850,null))['catch'](handleError(_0x122850,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e362795..e3aa61e 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 _0xcddb=['api','bluebird','path','rimraf','exports','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xcddb,0x168));var _0xbcdd=function(_0x2d90f5,_0x309b75){_0x2d90f5=_0x2d90f5-0x0;var _0x438757=_0xcddb[_0x2d90f5];return _0x438757;};'use strict';var _=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var logger=require(_0xbcdd('0x2'))(_0xbcdd('0x3'));var moment=require('moment');var BPromise=require(_0xbcdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcdd('0x5'));var rimraf=require(_0xbcdd('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xbcdd('0x7')]=function(_0xf8cf0a,_0x3a23a2){return _0xf8cf0a[_0xbcdd('0x8')](_0xbcdd('0x9'),attributes,{'tableName':_0xbcdd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x590b=['./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x53e372,_0x2ded4f){var _0x5e4139=function(_0x1e7801){while(--_0x1e7801){_0x53e372['push'](_0x53e372['shift']());}};_0x5e4139(++_0x2ded4f);}(_0x590b,0x1cc));var _0xb590=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0x590b[_0x11a962];return _0x55d423;};'use strict';var _=require(_0xb590('0x0'));var util=require(_0xb590('0x1'));var logger=require(_0xb590('0x2'))(_0xb590('0x3'));var moment=require(_0xb590('0x4'));var BPromise=require(_0xb590('0x5'));var rp=require(_0xb590('0x6'));var fs=require('fs');var path=require(_0xb590('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb590('0x8'));module[_0xb590('0x9')]=function(_0x201e66,_0x3bd40e){return _0x201e66[_0xb590('0xa')](_0xb590('0xb'),attributes,{'tableName':_0xb590('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index f827532..86dc10e 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 _0x5ad3=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x492e80,_0x2c18c2){var _0x2ecd0a=function(_0x22083d){while(--_0x22083d){_0x492e80['push'](_0x492e80['shift']());}};_0x2ecd0a(++_0x2c18c2);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0x5ad3[_0x483e3a];return _0x43fca9;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));var BPromise=require(_0x35ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ad('0x4'));var db=require(_0x35ad('0x5'))['db'];var utils=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var jayson=require(_0x35ad('0xa'));var client=jayson[_0x35ad('0xb')][_0x35ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31cc6a,_0x4edc59,_0x292521){return new BPromise(function(_0x3cec3e,_0x3f1f55){return client['request'](_0x31cc6a,_0x292521)[_0x35ad('0xd')](function(_0x487107){logger['info'](_0x35ad('0xe'),_0x4edc59,_0x35ad('0xf'));logger['debug'](_0x35ad('0x10'),_0x4edc59,_0x35ad('0xf'),JSON['stringify'](_0x487107));if(_0x487107['error']){if(_0x487107[_0x35ad('0x11')][_0x35ad('0x12')]===0x1f4){logger['error'](_0x35ad('0xe'),_0x4edc59,_0x487107[_0x35ad('0x11')]['message']);return _0x3f1f55(_0x487107['error'][_0x35ad('0x13')]);}logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x487107['error'][_0x35ad('0x13')]);return _0x3cec3e(_0x487107[_0x35ad('0x11')]['message']);}else{logger[_0x35ad('0x14')]('Tag,\x20%s,\x20%s',_0x4edc59,'request\x20sent');_0x3cec3e(_0x487107[_0x35ad('0x15')][_0x35ad('0x13')]);}})[_0x35ad('0x16')](function(_0x56cb8e){logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x56cb8e);_0x3f1f55(_0x56cb8e);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Tag,\x20%s,\x20%s','message','catch','util'];(function(_0x279f8c,_0x5544d2){var _0x34a987=function(_0x35cb9c){while(--_0x35cb9c){_0x279f8c['push'](_0x279f8c['shift']());}};_0x34a987(++_0x5544d2);}(_0xedd9,0xfc));var _0x9edd=function(_0x47d6b5,_0x1abfb8){_0x47d6b5=_0x47d6b5-0x0;var _0xc7e7f6=_0xedd9[_0x47d6b5];return _0xc7e7f6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('Tag,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 2b6708e..c0319a3 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 32a28d1..5c09ab7 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x1a1062,_0x58c79d){var _0x3e21d8=function(_0x53b7ce){while(--_0x53b7ce){_0x1a1062['push'](_0x1a1062['shift']());}};_0x3e21d8(++_0x58c79d);}(_0x2032,0xd9));var _0x2203=function(_0x458172,_0x273c27){_0x458172=_0x458172-0x0;var _0x41c6fd=_0x2032[_0x458172];return _0x41c6fd;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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 e789419..bc491fd 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 _0xa31b=['rawAttributes','fields','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','end','send','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','emit','Queue:save','User','online','upsert','interface','voicePause','all','VoicePrefixId','spread','removeAgents','Fax','Queue:remove','UserVoiceQueueRt','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','error','stack','name','index','Team','type','key','map','keys','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','params'];(function(_0x1f6616,_0x223d01){var _0xda893b=function(_0x2bced5){while(--_0x2bced5){_0x1f6616['push'](_0x1f6616['shift']());}};_0xda893b(++_0x223d01);}(_0xa31b,0xee));var _0xba31=function(_0x225d7e,_0x206329){_0x225d7e=_0x225d7e-0x0;var _0x3d1998=_0xa31b[_0x225d7e];return _0x3d1998;};'use strict';var emlformat=require(_0xba31('0x0'));var rimraf=require(_0xba31('0x1'));var zipdir=require(_0xba31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba31('0x3'));var moment=require('moment');var BPromise=require(_0xba31('0x4'));var Mustache=require(_0xba31('0x5'));var util=require(_0xba31('0x6'));var path=require(_0xba31('0x7'));var sox=require(_0xba31('0x8'));var csv=require(_0xba31('0x9'));var ejs=require(_0xba31('0xa'));var fs=require('fs');var fs_extra=require(_0xba31('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xba31('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba31('0xd'));var authService=require(_0xba31('0xe'));var qs=require(_0xba31('0xf'));var as=require(_0xba31('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba31('0x11'))(_0xba31('0x12'));var utils=require(_0xba31('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xba31('0x14'));var db=require('../../mysqldb')['db'];config[_0xba31('0x15')]=_[_0xba31('0x16')](config[_0xba31('0x15')],{'host':_0xba31('0x17'),'port':0x18eb});var socket=require(_0xba31('0x18'))(new Redis(config[_0xba31('0x15')]));require(_0xba31('0x19'))[_0xba31('0x1a')](socket);function respondWithStatusCode(_0x4a4c84,_0x33d480){_0x33d480=_0x33d480||0xcc;return function(_0x3af610){if(_0x3af610){return _0x4a4c84[_0xba31('0x1b')](_0x33d480);}return _0x4a4c84[_0xba31('0x1c')](_0x33d480)['end']();};}function respondWithResult(_0x196cf0,_0x3bcdb2){_0x3bcdb2=_0x3bcdb2||0xc8;return function(_0x15a9cb){if(_0x15a9cb){return _0x196cf0[_0xba31('0x1c')](_0x3bcdb2)[_0xba31('0x1d')](_0x15a9cb);}};}function respondWithFilteredResult(_0xa4e4d1,_0x473648){return function(_0x52700e){if(_0x52700e){var _0x58bd6c=typeof _0x473648[_0xba31('0x1e')]===_0xba31('0x1f')&&typeof _0x473648[_0xba31('0x20')]===_0xba31('0x1f');var _0x39e664=_0x52700e['count'];var _0x702636=_0x58bd6c?0x0:_0x473648[_0xba31('0x1e')];var _0x30a000=_0x58bd6c?_0x52700e[_0xba31('0x21')]:_0x473648[_0xba31('0x1e')]+_0x473648[_0xba31('0x20')];var _0x1ec53a;if(_0x30a000>=_0x39e664){_0x30a000=_0x39e664;_0x1ec53a=0xc8;}else{_0x1ec53a=0xce;}_0xa4e4d1[_0xba31('0x1c')](_0x1ec53a);return _0xa4e4d1['set'](_0xba31('0x22'),_0x702636+'-'+_0x30a000+'/'+_0x39e664)['json'](_0x52700e);}return null;};}function patchUpdates(_0x41e2b9){return function(_0x12b300){try{jsonpatch[_0xba31('0x23')](_0x12b300,_0x41e2b9,!![]);}catch(_0x467604){return BPromise['reject'](_0x467604);}return _0x12b300[_0xba31('0x24')]();};}function saveUpdates(_0x60fcf,_0x5ddd13){return function(_0x5c8086){if(_0x5c8086){return _0x5c8086[_0xba31('0x25')](_0x60fcf)['then'](function(_0x5b1a85){return _0x5b1a85;});}return null;};}function handleEntityNotFound(_0x492cf0,_0x1c7a3){return function(_0x467068){if(!_0x467068){_0x492cf0['sendStatus'](0x194);}return _0x467068;};}function handleError(_0x5ed52a,_0x4d9985){_0x4d9985=_0x4d9985||0x1f4;return function(_0x581658){logger[_0xba31('0x26')](_0x581658[_0xba31('0x27')]);if(_0x581658['name']){delete _0x581658[_0xba31('0x28')];}_0x5ed52a[_0xba31('0x1c')](_0x4d9985)['send'](_0x581658);};}exports[_0xba31('0x29')]=function(_0xc299a2,_0x41bc6d){var _0x31906e={},_0x1739af={},_0x657630={'count':0x0,'rows':[]};var _0x3c28de=_['map'](db[_0xba31('0x2a')]['rawAttributes'],function(_0x1558d7){return{'name':_0x1558d7['fieldName'],'type':_0x1558d7[_0xba31('0x2b')][_0xba31('0x2c')]};});_0x1739af['model']=_[_0xba31('0x2d')](_0x3c28de,'name');_0x1739af['query']=_[_0xba31('0x2e')](_0xc299a2[_0xba31('0x2f')]);_0x1739af[_0xba31('0x30')]=_[_0xba31('0x31')](_0x1739af[_0xba31('0x32')],_0x1739af[_0xba31('0x2f')]);_0x31906e[_0xba31('0x33')]=_[_0xba31('0x31')](_0x1739af[_0xba31('0x32')],qs['fields'](_0xc299a2[_0xba31('0x2f')]['fields']));_0x31906e[_0xba31('0x33')]=_0x31906e[_0xba31('0x33')][_0xba31('0x34')]?_0x31906e['attributes']:_0x1739af[_0xba31('0x32')];if(!_0xc299a2[_0xba31('0x2f')]['hasOwnProperty'](_0xba31('0x35'))){_0x31906e['limit']=qs[_0xba31('0x20')](_0xc299a2[_0xba31('0x2f')][_0xba31('0x20')]);_0x31906e[_0xba31('0x1e')]=qs[_0xba31('0x1e')](_0xc299a2[_0xba31('0x2f')]['offset']);}_0x31906e[_0xba31('0x36')]=qs[_0xba31('0x37')](_0xc299a2['query'][_0xba31('0x37')]);_0x31906e[_0xba31('0x38')]=qs[_0xba31('0x30')](_[_0xba31('0x39')](_0xc299a2[_0xba31('0x2f')],_0x1739af[_0xba31('0x30')]),_0x3c28de);if(_0xc299a2[_0xba31('0x2f')][_0xba31('0x3a')]){_0x31906e[_0xba31('0x38')]=_['merge'](_0x31906e[_0xba31('0x38')],{'$or':_[_0xba31('0x2d')](_0x3c28de,function(_0x33855f){if(_0x33855f['type']!==_0xba31('0x3b')){var _0xd11559={};_0xd11559[_0x33855f['name']]={'$like':'%'+_0xc299a2['query']['filter']+'%'};return _0xd11559;}})});}_0x31906e=_[_0xba31('0x3c')]({},_0x31906e,_0xc299a2[_0xba31('0x3d')]);var _0x29a557={'where':_0x31906e[_0xba31('0x38')]};return db[_0xba31('0x2a')]['count'](_0x29a557)[_0xba31('0x3e')](function(_0x125d01){_0x657630[_0xba31('0x21')]=_0x125d01;if(_0xc299a2[_0xba31('0x2f')]['includeAll']){_0x31906e[_0xba31('0x3f')]=[{'all':!![]}];}return db[_0xba31('0x2a')][_0xba31('0x40')](_0x31906e);})[_0xba31('0x3e')](function(_0x118c58){_0x657630[_0xba31('0x41')]=_0x118c58;return _0x657630;})['then'](respondWithFilteredResult(_0x41bc6d,_0x31906e))[_0xba31('0x42')](handleError(_0x41bc6d,null));};exports['show']=function(_0x1dc3a9,_0x22accd){var _0xa13d1e={'raw':![],'where':{'id':_0x1dc3a9[_0xba31('0x43')]['id']}},_0x2f6439={};_0x2f6439[_0xba31('0x32')]=_['keys'](db[_0xba31('0x2a')][_0xba31('0x44')]);_0x2f6439['query']=_['keys'](_0x1dc3a9[_0xba31('0x2f')]);_0x2f6439[_0xba31('0x30')]=_[_0xba31('0x31')](_0x2f6439[_0xba31('0x32')],_0x2f6439[_0xba31('0x2f')]);_0xa13d1e[_0xba31('0x33')]=_[_0xba31('0x31')](_0x2f6439[_0xba31('0x32')],qs[_0xba31('0x45')](_0x1dc3a9[_0xba31('0x2f')][_0xba31('0x45')]));_0xa13d1e[_0xba31('0x33')]=_0xa13d1e[_0xba31('0x33')][_0xba31('0x34')]?_0xa13d1e[_0xba31('0x33')]:_0x2f6439['model'];if(_0x1dc3a9[_0xba31('0x2f')]['includeAll']){_0xa13d1e[_0xba31('0x3f')]=[{'all':!![]}];}_0xa13d1e=_[_0xba31('0x3c')]({},_0xa13d1e,_0x1dc3a9[_0xba31('0x3d')]);return db['Team']['find'](_0xa13d1e)[_0xba31('0x3e')](handleEntityNotFound(_0x22accd,null))[_0xba31('0x3e')](respondWithResult(_0x22accd,null))['catch'](handleError(_0x22accd,null));};exports['create']=function(_0x320ab1,_0x4cdcc9){return db['Team'][_0xba31('0x46')](_0x320ab1[_0xba31('0x47')],{})[_0xba31('0x3e')](function(_0x25e44e){var _0x36f21a=_0x320ab1['user'][_0xba31('0x48')]({'plain':!![]});if(!_0x36f21a)throw new Error(_0xba31('0x49'));if(_0x36f21a[_0xba31('0x4a')]===_0xba31('0x4b')){var _0x372049=_0x25e44e[_0xba31('0x48')]({'plain':!![]});var _0x411fa7=_0xba31('0x4c');return db[_0xba31('0x4d')][_0xba31('0x4e')]({'where':{'name':_0x411fa7,'userProfileId':_0x36f21a[_0xba31('0x4f')]},'raw':!![]})['then'](function(_0x102cc6){if(_0x102cc6&&_0x102cc6['autoAssociation']===0x0){return db[_0xba31('0x50')][_0xba31('0x46')]({'name':_0x372049[_0xba31('0x28')],'resourceId':_0x372049['id'],'type':_0x102cc6[_0xba31('0x28')],'sectionId':_0x102cc6['id']},{})[_0xba31('0x3e')](function(){return _0x25e44e;});}else{return _0x25e44e;}})['catch'](function(_0x4e00fe){logger[_0xba31('0x26')](_0xba31('0x51'),_0x4e00fe);throw _0x4e00fe;});}return _0x25e44e;})[_0xba31('0x3e')](respondWithResult(_0x4cdcc9,0xc9))[_0xba31('0x42')](handleError(_0x4cdcc9,null));};exports[_0xba31('0x25')]=function(_0x2adacd,_0x1cd523){if(_0x2adacd['body']['id']){delete _0x2adacd[_0xba31('0x47')]['id'];}return db['Team'][_0xba31('0x4e')]({'where':{'id':_0x2adacd['params']['id']}})[_0xba31('0x3e')](handleEntityNotFound(_0x1cd523,null))[_0xba31('0x3e')](saveUpdates(_0x2adacd['body'],null))[_0xba31('0x3e')](respondWithResult(_0x1cd523,null))[_0xba31('0x42')](handleError(_0x1cd523,null));};exports['destroy']=function(_0x1d3a7d,_0x58e779){var _0x2b9333=_0x1d3a7d[_0xba31('0x43')]['id'];var _0x1252e0=[];return db[_0xba31('0x52')][_0xba31('0x53')](function(_0x2f088d){var _0x45aa57=_0xba31('0x54')+_0x2b9333;return db['sequelize']['query'](_0x45aa57,{'type':db['Sequelize'][_0xba31('0x55')][_0xba31('0x56')],'raw':!![],'transaction':_0x2f088d})[_0xba31('0x3e')](function(_0x4f7452){_0x1252e0=_[_0xba31('0x2d')](_0x4f7452,function(_0x47e5b5){return Number(_0x47e5b5['UserId']);});})[_0xba31('0x3e')](function(){var _0x538d05=_0xba31('0x57')+_0x2b9333;return db['sequelize'][_0xba31('0x2f')](_0x538d05,{'type':db[_0xba31('0x58')][_0xba31('0x55')]['SELECT'],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x310f63){var _0x5727f1=_[_0xba31('0x2d')](_0x310f63,function(_0x9433e7){return Number(_0x9433e7[_0xba31('0x59')]);});return db[_0xba31('0x5a')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'VoiceQueueId':{'$in':_0x5727f1}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x2baf25='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2b9333;return db[_0xba31('0x52')][_0xba31('0x2f')](_0x2baf25,{'type':db[_0xba31('0x58')][_0xba31('0x55')]['SELECT'],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x339548){var _0x153c5a=_[_0xba31('0x2d')](_0x339548,function(_0x30dcdb){return Number(_0x30dcdb[_0xba31('0x5c')]);});return db[_0xba31('0x5d')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'MailQueueId':{'$in':_0x153c5a}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x13e3d8=_0xba31('0x5e')+_0x2b9333;return db[_0xba31('0x52')][_0xba31('0x2f')](_0x13e3d8,{'type':db[_0xba31('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x5c06bc){var _0x1874b9=_[_0xba31('0x2d')](_0x5c06bc,function(_0x52e19a){return Number(_0x52e19a[_0xba31('0x5f')]);});return db[_0xba31('0x60')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'SmsQueueId':{'$in':_0x1874b9}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x405260=_0xba31('0x61')+_0x2b9333;return db['sequelize'][_0xba31('0x2f')](_0x405260,{'type':db[_0xba31('0x58')]['QueryTypes'][_0xba31('0x56')],'raw':!![],'transaction':_0x2f088d});})['then'](function(_0x54cf68){var _0x5596af=_[_0xba31('0x2d')](_0x54cf68,function(_0x4e8195){return Number(_0x4e8195[_0xba31('0x62')]);});return db[_0xba31('0x63')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'ChatQueueId':{'$in':_0x5596af}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x4fe801=_0xba31('0x64')+_0x2b9333;return db['sequelize'][_0xba31('0x2f')](_0x4fe801,{'type':db[_0xba31('0x58')][_0xba31('0x55')]['SELECT'],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x74409){var _0xc2975d=_['map'](_0x74409,function(_0x2f9796){return Number(_0x2f9796[_0xba31('0x65')]);});return db[_0xba31('0x66')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'FaxQueueId':{'$in':_0xc2975d}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x5c102d=_0xba31('0x67')+_0x2b9333;return db[_0xba31('0x52')][_0xba31('0x2f')](_0x5c102d,{'type':db[_0xba31('0x58')]['QueryTypes'][_0xba31('0x56')],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x49851c){var _0x365538=_['map'](_0x49851c,function(_0xa02af9){return Number(_0xa02af9[_0xba31('0x68')]);});return db[_0xba31('0x69')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'OpenchannelQueueId':{'$in':_0x365538}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x269aaa=_0xba31('0x6a')+_0x2b9333;return db[_0xba31('0x52')][_0xba31('0x2f')](_0x269aaa,{'type':db[_0xba31('0x58')][_0xba31('0x55')]['SELECT'],'raw':!![],'transaction':_0x2f088d});})['then'](function(_0x8568c9){var _0x546458=_[_0xba31('0x2d')](_0x8568c9,function(_0x2216e9){return Number(_0x2216e9[_0xba31('0x6b')]);});return db[_0xba31('0x6c')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'WhatsappQueueId':{'$in':_0x546458}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){return db[_0xba31('0x6d')][_0xba31('0x4e')]({'where':{'TeamId':_0x2b9333}});})['then'](function(_0x10aa17){if(_0x10aa17===null){return;}return db[_0xba31('0x6e')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'VoicePrefixId':_0x10aa17['VoicePrefixId']},'transaction':_0x2f088d});})['then'](function(){return db[_0xba31('0x2a')][_0xba31('0x5b')]({'where':{'id':_0x2b9333},'cascade':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x38835a){if(_0x38835a===0x0){_0x58e779[_0xba31('0x1b')](0x194);}else{return db[_0xba31('0x50')][_0xba31('0x5b')]({'where':{'type':_0xba31('0x4c'),'resourceId':_0x2b9333},'cascade':!![],'transaction':_0x2f088d})['then'](function(){_0x58e779[_0xba31('0x1c')](0xcc)[_0xba31('0x6f')]();});}})[_0xba31('0x42')](function(_0x7f6f25){_0x58e779[_0xba31('0x1c')](0x1f4)[_0xba31('0x70')](_0x7f6f25);});});};exports['getQueues']=function(_0x4c91f2,_0x537312,_0x3f0b50){return db['Team'][_0xba31('0x71')]({'where':{'id':_0x4c91f2[_0xba31('0x43')]['id']}})[_0xba31('0x3e')](handleEntityNotFound(_0x537312,null))[_0xba31('0x3e')](function(_0x476e38){if(!_0x4c91f2[_0xba31('0x2f')][_0xba31('0x72')]||!utils[_0xba31('0x73')](_0x4c91f2[_0xba31('0x2f')]['channel'])){throw new db[(_0xba31('0x58'))]['ValidationError'](_0xba31('0x74'));}var _0x25ea47={};var _0x522eb2={};_0x522eb2[_0xba31('0x32')]=_[_0xba31('0x2e')](db[_[_0xba31('0x75')](_0x4c91f2[_0xba31('0x2f')][_0xba31('0x72')][_0xba31('0x76')]())+_0xba31('0x77')][_0xba31('0x44')]);_0x522eb2[_0xba31('0x2f')]=_['keys'](_0x4c91f2['query']);_0x522eb2[_0xba31('0x30')]=_[_0xba31('0x31')](_0x522eb2[_0xba31('0x32')],_0x522eb2['query']);_0x25ea47['attributes']=_[_0xba31('0x31')](_0x522eb2['model'],qs[_0xba31('0x45')](_0x4c91f2[_0xba31('0x2f')]['fields']));_0x25ea47[_0xba31('0x33')]=_0x25ea47[_0xba31('0x33')][_0xba31('0x34')]?_0x25ea47['attributes']:_0x522eb2[_0xba31('0x32')];_0x25ea47[_0xba31('0x20')]=qs[_0xba31('0x20')](_0x4c91f2[_0xba31('0x2f')][_0xba31('0x20')]);_0x25ea47[_0xba31('0x1e')]=qs[_0xba31('0x1e')](_0x4c91f2[_0xba31('0x2f')][_0xba31('0x1e')]);_0x25ea47[_0xba31('0x36')]=qs[_0xba31('0x37')](_0x4c91f2[_0xba31('0x2f')]['sort']);_0x25ea47[_0xba31('0x38')]=qs[_0xba31('0x30')](_[_0xba31('0x39')](_0x4c91f2[_0xba31('0x2f')],_0x522eb2['filters']));_0x25ea47=_[_0xba31('0x3c')]({},_0x25ea47,_0x4c91f2['options']);return _0x476e38['get'+_['capitalize'](_0x4c91f2[_0xba31('0x2f')][_0xba31('0x72')]['toLowerCase']())+_0xba31('0x78')](_0x25ea47);})[_0xba31('0x3e')](respondWithResult(_0x537312,null))['catch'](handleError(_0x537312,null));};exports[_0xba31('0x79')]=function(_0x419c8c,_0x12f8b2,_0x34077a){return db[_0xba31('0x2a')][_0xba31('0x71')]({'where':{'id':_0x419c8c[_0xba31('0x43')]['id']}})[_0xba31('0x3e')](function(_0x29b2ad){if(_0x29b2ad){if(!_0x419c8c[_0xba31('0x47')]['channel']||!utils['isValidChannel'](_0x419c8c['body']['channel'])){throw new db[(_0xba31('0x58'))]['ValidationError'](_0xba31('0x74'));}return _0x29b2ad[_0xba31('0x7a')+_[_0xba31('0x75')](_0x419c8c['body'][_0xba31('0x72')][_0xba31('0x76')]())+_0xba31('0x78')](_0x419c8c['body'][_0xba31('0x7b')]);}return null;})[_0xba31('0x3e')](handleEntityNotFound(_0x12f8b2,null))[_0xba31('0x3e')](respondWithStatusCode(_0x12f8b2,null))[_0xba31('0x42')](handleError(_0x12f8b2,null));};exports[_0xba31('0x7c')]=function(_0x12382e,_0x5d719e,_0x4cbf00){return db[_0xba31('0x2a')][_0xba31('0x71')]({'where':{'id':_0x12382e[_0xba31('0x43')]['id']}})[_0xba31('0x3e')](function(_0x72018b){if(_0x72018b){if(!_0x12382e[_0xba31('0x2f')][_0xba31('0x72')]||!utils['isValidChannel'](_0x12382e[_0xba31('0x2f')]['channel'])){throw new db[(_0xba31('0x58'))]['ValidationError'](_0xba31('0x74'));}return _0x72018b[_0xba31('0x7d')+_[_0xba31('0x75')](_0x12382e[_0xba31('0x2f')][_0xba31('0x72')][_0xba31('0x76')]())+_0xba31('0x78')](_0x12382e[_0xba31('0x2f')]['ids']);}return null;})[_0xba31('0x3e')](handleEntityNotFound(_0x5d719e,null))['then'](respondWithStatusCode(_0x5d719e,null))['catch'](handleError(_0x5d719e,null));};exports[_0xba31('0x7e')]=function(_0x333652,_0x128c1){var _0x2fd54d=_[_0xba31('0x7f')](_0x333652[_0xba31('0x47')][_0xba31('0x7b')])?_0x333652['body']['ids']:[_0x333652[_0xba31('0x47')][_0xba31('0x7b')]];var _0x5d782a=_0x333652[_0xba31('0x43')]['id'];return db[_0xba31('0x2a')][_0xba31('0x4e')]({'where':{'id':_0x5d782a}})['then'](handleEntityNotFound(_0x128c1,null))[_0xba31('0x3e')](function(_0x4f51b7){if(_0x4f51b7){var _0x23ea18=[_0xba31('0x80'),_0xba31('0x81'),_0xba31('0x82'),_0xba31('0x83'),'Fax','Openchannel',_0xba31('0x84')];return db[_0xba31('0x52')][_0xba31('0x53')](function(_0x486548){var _0x379038=_[_0xba31('0x2d')](_0x23ea18,function(_0x1426a4){var _0x57a011={'attributes':['id',_0xba31('0x28')]};if(_0x1426a4==='Voice'){_0x57a011[_0xba31('0x85')]={'attributes':['penalty']};}return _0x4f51b7[_0xba31('0x48')+_0x1426a4+_0xba31('0x78')](_0x57a011)[_0xba31('0x3e')](function(_0x5dbbd2){var _0x52944b=_[_0xba31('0x2d')](_0x5dbbd2,function(_0x2c7702){var _0x1c8116=_[_0xba31('0x2d')](_0x2fd54d,function(_0xcac6cf){var _0x447260={'where':{'UserId':_0xcac6cf,[_0x1426a4+_0xba31('0x86')]:_0x2c7702['id']},'transaction':_0x486548};if(_0x1426a4===_0xba31('0x80')){_0x447260[_0xba31('0x16')]={'penalty':_0x2c7702[_0xba31('0x87')][_0xba31('0x88')]};}return db['User'+_0x1426a4+_0xba31('0x77')]['findOrCreate'](_0x447260)['then'](function(){socket[_0xba31('0x89')]('user'+_0x1426a4+_0xba31('0x8a'),{'UserId':_0xcac6cf,[_0x1426a4+_0xba31('0x86')]:_0x2c7702['id']});if(_0x1426a4!=='Voice'){return;}return db[_0xba31('0x8b')][_0xba31('0x40')]({'where':{'id':_0x2fd54d,'online':0x1},'attributes':['id',_0xba31('0x28'),_0xba31('0x8c'),'voicePause','interface'],'raw':!![]})[_0xba31('0x3e')](function(_0x308ebd){var _0x2300dc=_[_0xba31('0x2d')](_0x308ebd,function(_0x4e5841){return db['UserVoiceQueueRt'][_0xba31('0x8d')]({'membername':_0x4e5841[_0xba31('0x28')],'UserId':_0x4e5841['id'],'queue_name':_0x2c7702[_0xba31('0x28')],'VoiceQueueId':_0x2c7702['id'],'interface':_['isNil'](_0x4e5841[_0xba31('0x8e')])?util['format']('SIP/%s',_0x4e5841[_0xba31('0x28')]):_0x4e5841['interface'],'paused':_0x4e5841[_0xba31('0x8f')]||![],'penalty':_0x2c7702[_0xba31('0x87')]['penalty']},{'transaction':_0x486548});});return Promise[_0xba31('0x90')](_0x2300dc);});});});return Promise[_0xba31('0x90')](_0x1c8116);});return Promise[_0xba31('0x90')](_0x52944b);})[_0xba31('0x3e')](function(){return db[_0xba31('0x6d')][_0xba31('0x71')]({'where':{'teamId':_0x5d782a}})[_0xba31('0x3e')](function(_0x4da121){if(_0x4da121){var _0x24f195=_['map'](_0x2fd54d,function(_0x5c7517){db[_0xba31('0x6e')][_0xba31('0x8d')]({'UserId':_0x5c7517,'VoicePrefixId':_0x4da121[_0xba31('0x91')]});});return Promise['all'](_0x24f195);}});});});return Promise['all'](_0x379038)[_0xba31('0x3e')](function(){return _0x4f51b7[_0xba31('0x7e')](_0x2fd54d,{'transaction':_0x486548})[_0xba31('0x92')](function(_0x498430){return _0x498430;});});});}})[_0xba31('0x3e')](respondWithResult(_0x128c1,null))[_0xba31('0x42')](handleError(_0x128c1,null));};exports[_0xba31('0x93')]=function(_0x2dfe38,_0x484c45){var _0x547d91=_[_0xba31('0x7f')](_0x2dfe38[_0xba31('0x2f')]['ids'])?_0x2dfe38[_0xba31('0x2f')][_0xba31('0x7b')]:[_0x2dfe38['query'][_0xba31('0x7b')]];var _0x9748ea=_0x2dfe38[_0xba31('0x43')]['id'];return db[_0xba31('0x2a')][_0xba31('0x4e')]({'where':{'id':_0x9748ea}})['then'](handleEntityNotFound(_0x484c45,null))[_0xba31('0x3e')](function(_0x377177){if(_0x377177){var _0x3e146b=[_0xba31('0x80'),_0xba31('0x81'),_0xba31('0x82'),_0xba31('0x83'),_0xba31('0x94'),'Openchannel',_0xba31('0x84')];return db[_0xba31('0x52')][_0xba31('0x53')](function(_0x3c0b51){var _0x447021=_['map'](_0x3e146b,function(_0x44739e){var _0xc20888={'attributes':['id',_0xba31('0x28')]};return _0x377177[_0xba31('0x48')+_0x44739e+_0xba31('0x78')](_0xc20888)[_0xba31('0x3e')](function(_0x37f74d){var _0x31d1bc=_[_0xba31('0x2d')](_0x37f74d,function(_0x470054){return _0x470054[_0xba31('0x93')](_0x547d91,{'transaction':_0x3c0b51})[_0xba31('0x3e')](function(){var _0x4d6903=_[_0xba31('0x2d')](_0x547d91,function(_0x351a93){socket[_0xba31('0x89')](_0xba31('0x4b')+_0x44739e+_0xba31('0x95'),{'UserId':Number(_0x351a93),[_0x44739e+'QueueId']:_0x470054['id']});if(_0x44739e!==_0xba31('0x80')){return;}return db[_0xba31('0x96')][_0xba31('0x5b')]({'where':{'VoiceQueueId':_0x470054['id'],'UserId':_0x351a93},'transaction':_0x3c0b51});});return Promise[_0xba31('0x90')](_0x4d6903);});});return Promise[_0xba31('0x90')](_0x31d1bc);});});return Promise[_0xba31('0x90')](_0x447021)[_0xba31('0x3e')](function(){return _0x377177[_0xba31('0x93')](_0x547d91,{'transaction':_0x3c0b51});})[_0xba31('0x3e')](function(){return db[_0xba31('0x6d')]['findOne']({'where':{'teamId':_0x9748ea}})['then'](function(_0x2b34e1){if(_0x2b34e1){var _0x3e5cc6=_[_0xba31('0x2d')](_0x547d91,function(_0x59c47f){db[_0xba31('0x6e')][_0xba31('0x5b')]({'where':{'UserId':_0x59c47f,'VoicePrefixId':_0x2b34e1[_0xba31('0x91')]}});});return Promise[_0xba31('0x90')](_0x3e5cc6);}});});});}})['then'](respondWithStatusCode(_0x484c45,null))[_0xba31('0x42')](handleError(_0x484c45,null));};exports[_0xba31('0x97')]=function(_0x22884a,_0x1ac3b5,_0x4f102c){var _0x5748a0={};var _0x246b6f={};var _0x187696;var _0x302135;return db[_0xba31('0x2a')]['findOne']({'where':{'id':_0x22884a[_0xba31('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ac3b5,null))[_0xba31('0x3e')](function(_0x513e16){if(_0x513e16){_0x187696=_0x513e16;_0x246b6f[_0xba31('0x32')]=_[_0xba31('0x2e')](db[_0xba31('0x8b')]['rawAttributes']);_0x246b6f[_0xba31('0x2f')]=_[_0xba31('0x2e')](_0x22884a[_0xba31('0x2f')]);_0x246b6f[_0xba31('0x30')]=_['intersection'](_0x246b6f[_0xba31('0x32')],_0x246b6f['query']);_0x5748a0[_0xba31('0x33')]=_[_0xba31('0x31')](_0x246b6f[_0xba31('0x32')],qs[_0xba31('0x45')](_0x22884a[_0xba31('0x2f')][_0xba31('0x45')]));_0x5748a0[_0xba31('0x33')]=_0x5748a0[_0xba31('0x33')][_0xba31('0x34')]?_0x5748a0[_0xba31('0x33')]:_0x246b6f[_0xba31('0x32')];_0x5748a0[_0xba31('0x36')]=qs[_0xba31('0x37')](_0x22884a[_0xba31('0x2f')][_0xba31('0x37')]);_0x5748a0[_0xba31('0x38')]=qs[_0xba31('0x30')](_[_0xba31('0x39')](_0x22884a[_0xba31('0x2f')],_0x246b6f[_0xba31('0x30')]));if(_0x22884a[_0xba31('0x2f')][_0xba31('0x3a')]){_0x5748a0[_0xba31('0x38')]=_['merge'](_0x5748a0[_0xba31('0x38')],{'$or':_[_0xba31('0x2d')](_0x5748a0['attributes'],function(_0x14fe9d){var _0x2f9661={};_0x2f9661[_0x14fe9d]={'$like':'%'+_0x22884a[_0xba31('0x2f')][_0xba31('0x3a')]+'%'};return _0x2f9661;})});}_0x5748a0=_[_0xba31('0x3c')]({},_0x5748a0,_0x22884a[_0xba31('0x3d')]);return _0x187696[_0xba31('0x97')](_0x5748a0);}})['then'](function(_0x4a8967){if(_0x4a8967){_0x302135=_0x4a8967['length'];if(!_0x22884a[_0xba31('0x2f')][_0xba31('0x98')](_0xba31('0x35'))){_0x5748a0[_0xba31('0x20')]=qs[_0xba31('0x20')](_0x22884a[_0xba31('0x2f')]['limit']);_0x5748a0['offset']=qs['offset'](_0x22884a[_0xba31('0x2f')][_0xba31('0x1e')]);}return _0x187696[_0xba31('0x97')](_0x5748a0);}})[_0xba31('0x3e')](function(_0x50349d){if(_0x50349d){return _0x50349d?{'count':_0x302135,'rows':_0x50349d}:null;}})[_0xba31('0x3e')](respondWithResult(_0x1ac3b5,null))[_0xba31('0x42')](handleError(_0x1ac3b5,null));}; \ No newline at end of file +var _0x4fdc=['Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','all','VoicePrefixId','spread','removeAgents','isArray','UserVoicePrefix','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','send','map','Team','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','sequelize','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','QueryTypes','SmsQueueId','ChatQueueId','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','Queues','ids','remove','addAgents','Voice'];(function(_0x110f31,_0xb6d7e6){var _0x4b308a=function(_0x198b16){while(--_0x198b16){_0x110f31['push'](_0x110f31['shift']());}};_0x4b308a(++_0xb6d7e6);}(_0x4fdc,0xba));var _0xc4fd=function(_0x2a7036,_0x572e22){_0x2a7036=_0x2a7036-0x0;var _0x47ae53=_0x4fdc[_0x2a7036];return _0x47ae53;};'use strict';var emlformat=require(_0xc4fd('0x0'));var rimraf=require(_0xc4fd('0x1'));var zipdir=require(_0xc4fd('0x2'));var jsonpatch=require(_0xc4fd('0x3'));var rp=require(_0xc4fd('0x4'));var moment=require(_0xc4fd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4fd('0x6'));var util=require(_0xc4fd('0x7'));var path=require(_0xc4fd('0x8'));var sox=require('sox');var csv=require(_0xc4fd('0x9'));var ejs=require(_0xc4fd('0xa'));var fs=require('fs');var fs_extra=require(_0xc4fd('0xb'));var _=require(_0xc4fd('0xc'));var squel=require(_0xc4fd('0xd'));var crypto=require(_0xc4fd('0xe'));var jsforce=require(_0xc4fd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc4fd('0x9'));var querystring=require(_0xc4fd('0x10'));var Papa=require(_0xc4fd('0x11'));var Redis=require(_0xc4fd('0x12'));var authService=require(_0xc4fd('0x13'));var qs=require(_0xc4fd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4fd('0x15'));var logger=require(_0xc4fd('0x16'))('api');var utils=require(_0xc4fd('0x17'));var config=require(_0xc4fd('0x18'));var licenseUtil=require(_0xc4fd('0x19'));var db=require(_0xc4fd('0x1a'))['db'];config[_0xc4fd('0x1b')]=_['defaults'](config[_0xc4fd('0x1b')],{'host':_0xc4fd('0x1c'),'port':0x18eb});var socket=require(_0xc4fd('0x1d'))(new Redis(config['redis']));require(_0xc4fd('0x1e'))[_0xc4fd('0x1f')](socket);function respondWithStatusCode(_0x261c63,_0x4591fc){_0x4591fc=_0x4591fc||0xcc;return function(_0x287a2f){if(_0x287a2f){return _0x261c63[_0xc4fd('0x20')](_0x4591fc);}return _0x261c63['status'](_0x4591fc)[_0xc4fd('0x21')]();};}function respondWithResult(_0x333dc1,_0x369d02){_0x369d02=_0x369d02||0xc8;return function(_0x41a452){if(_0x41a452){return _0x333dc1[_0xc4fd('0x22')](_0x369d02)[_0xc4fd('0x23')](_0x41a452);}};}function respondWithFilteredResult(_0x2276c0,_0x5a86dc){return function(_0x39c789){if(_0x39c789){var _0x155229=typeof _0x5a86dc[_0xc4fd('0x24')]===_0xc4fd('0x25')&&typeof _0x5a86dc[_0xc4fd('0x26')]===_0xc4fd('0x25');var _0x451f5c=_0x39c789[_0xc4fd('0x27')];var _0x488061=_0x155229?0x0:_0x5a86dc[_0xc4fd('0x24')];var _0x2048e0=_0x155229?_0x39c789[_0xc4fd('0x27')]:_0x5a86dc[_0xc4fd('0x24')]+_0x5a86dc[_0xc4fd('0x26')];var _0x58b538;if(_0x2048e0>=_0x451f5c){_0x2048e0=_0x451f5c;_0x58b538=0xc8;}else{_0x58b538=0xce;}_0x2276c0[_0xc4fd('0x22')](_0x58b538);return _0x2276c0[_0xc4fd('0x28')](_0xc4fd('0x29'),_0x488061+'-'+_0x2048e0+'/'+_0x451f5c)['json'](_0x39c789);}return null;};}function patchUpdates(_0x52c654){return function(_0x489f18){try{jsonpatch[_0xc4fd('0x2a')](_0x489f18,_0x52c654,!![]);}catch(_0x2aaddf){return BPromise[_0xc4fd('0x2b')](_0x2aaddf);}return _0x489f18['save']();};}function saveUpdates(_0x34b31c,_0x5b631c){return function(_0x45160e){if(_0x45160e){return _0x45160e['update'](_0x34b31c)[_0xc4fd('0x2c')](function(_0x1f8207){return _0x1f8207;});}return null;};}function handleEntityNotFound(_0x329735,_0x3899f2){return function(_0x34fdde){if(!_0x34fdde){_0x329735[_0xc4fd('0x20')](0x194);}return _0x34fdde;};}function handleError(_0xb9bab4,_0x589442){_0x589442=_0x589442||0x1f4;return function(_0x55b1ac){logger['error'](_0x55b1ac[_0xc4fd('0x2d')]);if(_0x55b1ac[_0xc4fd('0x2e')]){delete _0x55b1ac[_0xc4fd('0x2e')];}_0xb9bab4[_0xc4fd('0x22')](_0x589442)[_0xc4fd('0x2f')](_0x55b1ac);};}exports['index']=function(_0x4f8f4f,_0x79ff3d){var _0x4d6ede={},_0x4d7c41={},_0x156f57={'count':0x0,'rows':[]};var _0x45f6d7=_[_0xc4fd('0x30')](db[_0xc4fd('0x31')][_0xc4fd('0x32')],function(_0xa08092){return{'name':_0xa08092[_0xc4fd('0x33')],'type':_0xa08092[_0xc4fd('0x34')][_0xc4fd('0x35')]};});_0x4d7c41['model']=_[_0xc4fd('0x30')](_0x45f6d7,_0xc4fd('0x2e'));_0x4d7c41[_0xc4fd('0x36')]=_['keys'](_0x4f8f4f[_0xc4fd('0x36')]);_0x4d7c41[_0xc4fd('0x37')]=_['intersection'](_0x4d7c41[_0xc4fd('0x38')],_0x4d7c41['query']);_0x4d6ede[_0xc4fd('0x39')]=_[_0xc4fd('0x3a')](_0x4d7c41[_0xc4fd('0x38')],qs[_0xc4fd('0x3b')](_0x4f8f4f[_0xc4fd('0x36')][_0xc4fd('0x3b')]));_0x4d6ede[_0xc4fd('0x39')]=_0x4d6ede[_0xc4fd('0x39')][_0xc4fd('0x3c')]?_0x4d6ede[_0xc4fd('0x39')]:_0x4d7c41['model'];if(!_0x4f8f4f[_0xc4fd('0x36')][_0xc4fd('0x3d')](_0xc4fd('0x3e'))){_0x4d6ede[_0xc4fd('0x26')]=qs['limit'](_0x4f8f4f[_0xc4fd('0x36')][_0xc4fd('0x26')]);_0x4d6ede[_0xc4fd('0x24')]=qs[_0xc4fd('0x24')](_0x4f8f4f[_0xc4fd('0x36')][_0xc4fd('0x24')]);}_0x4d6ede[_0xc4fd('0x3f')]=qs[_0xc4fd('0x40')](_0x4f8f4f[_0xc4fd('0x36')]['sort']);_0x4d6ede[_0xc4fd('0x41')]=qs[_0xc4fd('0x37')](_[_0xc4fd('0x42')](_0x4f8f4f[_0xc4fd('0x36')],_0x4d7c41[_0xc4fd('0x37')]),_0x45f6d7);if(_0x4f8f4f[_0xc4fd('0x36')][_0xc4fd('0x43')]){_0x4d6ede[_0xc4fd('0x41')]=_[_0xc4fd('0x44')](_0x4d6ede[_0xc4fd('0x41')],{'$or':_[_0xc4fd('0x30')](_0x45f6d7,function(_0x98dd9){if(_0x98dd9[_0xc4fd('0x34')]!=='VIRTUAL'){var _0x35e346={};_0x35e346[_0x98dd9[_0xc4fd('0x2e')]]={'$like':'%'+_0x4f8f4f['query']['filter']+'%'};return _0x35e346;}})});}_0x4d6ede=_[_0xc4fd('0x44')]({},_0x4d6ede,_0x4f8f4f['options']);var _0x33e155={'where':_0x4d6ede['where']};return db[_0xc4fd('0x31')][_0xc4fd('0x27')](_0x33e155)[_0xc4fd('0x2c')](function(_0x5a35a4){_0x156f57['count']=_0x5a35a4;if(_0x4f8f4f[_0xc4fd('0x36')][_0xc4fd('0x45')]){_0x4d6ede[_0xc4fd('0x46')]=[{'all':!![]}];}return db[_0xc4fd('0x31')][_0xc4fd('0x47')](_0x4d6ede);})[_0xc4fd('0x2c')](function(_0x55523e){_0x156f57[_0xc4fd('0x48')]=_0x55523e;return _0x156f57;})['then'](respondWithFilteredResult(_0x79ff3d,_0x4d6ede))[_0xc4fd('0x49')](handleError(_0x79ff3d,null));};exports[_0xc4fd('0x4a')]=function(_0xe52a47,_0x1cdbba){var _0x147a5f={'raw':![],'where':{'id':_0xe52a47[_0xc4fd('0x4b')]['id']}},_0x3f1172={};_0x3f1172['model']=_[_0xc4fd('0x4c')](db[_0xc4fd('0x31')][_0xc4fd('0x32')]);_0x3f1172[_0xc4fd('0x36')]=_[_0xc4fd('0x4c')](_0xe52a47[_0xc4fd('0x36')]);_0x3f1172[_0xc4fd('0x37')]=_[_0xc4fd('0x3a')](_0x3f1172['model'],_0x3f1172[_0xc4fd('0x36')]);_0x147a5f[_0xc4fd('0x39')]=_[_0xc4fd('0x3a')](_0x3f1172[_0xc4fd('0x38')],qs['fields'](_0xe52a47[_0xc4fd('0x36')][_0xc4fd('0x3b')]));_0x147a5f[_0xc4fd('0x39')]=_0x147a5f[_0xc4fd('0x39')]['length']?_0x147a5f['attributes']:_0x3f1172['model'];if(_0xe52a47['query'][_0xc4fd('0x45')]){_0x147a5f['include']=[{'all':!![]}];}_0x147a5f=_[_0xc4fd('0x44')]({},_0x147a5f,_0xe52a47[_0xc4fd('0x4d')]);return db['Team'][_0xc4fd('0x4e')](_0x147a5f)[_0xc4fd('0x2c')](handleEntityNotFound(_0x1cdbba,null))[_0xc4fd('0x2c')](respondWithResult(_0x1cdbba,null))[_0xc4fd('0x49')](handleError(_0x1cdbba,null));};exports[_0xc4fd('0x4f')]=function(_0x982fe0,_0x4f2bab){return db[_0xc4fd('0x31')][_0xc4fd('0x4f')](_0x982fe0['body'],{})[_0xc4fd('0x2c')](function(_0xfc2307){var _0x3e5666=_0x982fe0[_0xc4fd('0x50')][_0xc4fd('0x51')]({'plain':!![]});if(!_0x3e5666)throw new Error(_0xc4fd('0x52'));if(_0x3e5666[_0xc4fd('0x53')]===_0xc4fd('0x50')){var _0x186613=_0xfc2307[_0xc4fd('0x51')]({'plain':!![]});var _0x158de2=_0xc4fd('0x54');return db[_0xc4fd('0x55')][_0xc4fd('0x4e')]({'where':{'name':_0x158de2,'userProfileId':_0x3e5666[_0xc4fd('0x56')]},'raw':!![]})[_0xc4fd('0x2c')](function(_0xac2bae){if(_0xac2bae&&_0xac2bae['autoAssociation']===0x0){return db[_0xc4fd('0x57')]['create']({'name':_0x186613[_0xc4fd('0x2e')],'resourceId':_0x186613['id'],'type':_0xac2bae[_0xc4fd('0x2e')],'sectionId':_0xac2bae['id']},{})[_0xc4fd('0x2c')](function(){return _0xfc2307;});}else{return _0xfc2307;}})['catch'](function(_0x2ebd85){logger[_0xc4fd('0x58')](_0xc4fd('0x59'),_0x2ebd85);throw _0x2ebd85;});}return _0xfc2307;})[_0xc4fd('0x2c')](respondWithResult(_0x4f2bab,0xc9))['catch'](handleError(_0x4f2bab,null));};exports[_0xc4fd('0x5a')]=function(_0x635bfa,_0xe1337d){if(_0x635bfa[_0xc4fd('0x5b')]['id']){delete _0x635bfa[_0xc4fd('0x5b')]['id'];}return db['Team'][_0xc4fd('0x4e')]({'where':{'id':_0x635bfa['params']['id']}})['then'](handleEntityNotFound(_0xe1337d,null))[_0xc4fd('0x2c')](saveUpdates(_0x635bfa[_0xc4fd('0x5b')],null))['then'](respondWithResult(_0xe1337d,null))[_0xc4fd('0x49')](handleError(_0xe1337d,null));};exports[_0xc4fd('0x5c')]=function(_0xcac3f9,_0x1ffd57){var _0x21223c=_0xcac3f9[_0xc4fd('0x4b')]['id'];var _0x44f828=[];return db[_0xc4fd('0x5d')]['transaction'](function(_0x50189d){var _0x1b4288='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x21223c;return db[_0xc4fd('0x5d')][_0xc4fd('0x36')](_0x1b4288,{'type':db[_0xc4fd('0x5e')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x50189d})['then'](function(_0x68062){_0x44f828=_[_0xc4fd('0x30')](_0x68062,function(_0x5365f6){return Number(_0x5365f6[_0xc4fd('0x5f')]);});})[_0xc4fd('0x2c')](function(){var _0x199f1e=_0xc4fd('0x60')+_0x21223c;return db[_0xc4fd('0x5d')]['query'](_0x199f1e,{'type':db['Sequelize']['QueryTypes'][_0xc4fd('0x61')],'raw':!![],'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(_0x423f22){var _0x505661=_[_0xc4fd('0x30')](_0x423f22,function(_0x105859){return Number(_0x105859[_0xc4fd('0x62')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x44f828},'VoiceQueueId':{'$in':_0x505661}},'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(){var _0x29d806=_0xc4fd('0x63')+_0x21223c;return db[_0xc4fd('0x5d')][_0xc4fd('0x36')](_0x29d806,{'type':db[_0xc4fd('0x5e')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(_0x1f8cb9){var _0x130423=_[_0xc4fd('0x30')](_0x1f8cb9,function(_0x5f1d59){return Number(_0x5f1d59[_0xc4fd('0x64')]);});return db[_0xc4fd('0x65')][_0xc4fd('0x5c')]({'where':{'UserId':{'$in':_0x44f828},'MailQueueId':{'$in':_0x130423}},'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(){var _0x55d9f5='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21223c;return db[_0xc4fd('0x5d')][_0xc4fd('0x36')](_0x55d9f5,{'type':db['Sequelize'][_0xc4fd('0x66')][_0xc4fd('0x61')],'raw':!![],'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(_0x3bfc1d){var _0x3c0216=_['map'](_0x3bfc1d,function(_0x5e3ebb){return Number(_0x5e3ebb[_0xc4fd('0x67')]);});return db['UserSmsQueue'][_0xc4fd('0x5c')]({'where':{'UserId':{'$in':_0x44f828},'SmsQueueId':{'$in':_0x3c0216}},'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(){var _0x517106='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21223c;return db[_0xc4fd('0x5d')]['query'](_0x517106,{'type':db[_0xc4fd('0x5e')][_0xc4fd('0x66')][_0xc4fd('0x61')],'raw':!![],'transaction':_0x50189d});})['then'](function(_0x972b97){var _0x241238=_[_0xc4fd('0x30')](_0x972b97,function(_0x4160a5){return Number(_0x4160a5[_0xc4fd('0x68')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x44f828},'ChatQueueId':{'$in':_0x241238}},'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(){var _0x65d11c='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21223c;return db['sequelize'][_0xc4fd('0x36')](_0x65d11c,{'type':db[_0xc4fd('0x5e')][_0xc4fd('0x66')]['SELECT'],'raw':!![],'transaction':_0x50189d});})['then'](function(_0x4edb70){var _0x25afcf=_[_0xc4fd('0x30')](_0x4edb70,function(_0x1f165a){return Number(_0x1f165a[_0xc4fd('0x69')]);});return db['UserFaxQueue'][_0xc4fd('0x5c')]({'where':{'UserId':{'$in':_0x44f828},'FaxQueueId':{'$in':_0x25afcf}},'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(){var _0x26fb00=_0xc4fd('0x6a')+_0x21223c;return db['sequelize']['query'](_0x26fb00,{'type':db[_0xc4fd('0x5e')][_0xc4fd('0x66')][_0xc4fd('0x61')],'raw':!![],'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(_0x9529d4){var _0x185744=_[_0xc4fd('0x30')](_0x9529d4,function(_0x4ae3ac){return Number(_0x4ae3ac[_0xc4fd('0x6b')]);});return db[_0xc4fd('0x6c')][_0xc4fd('0x5c')]({'where':{'UserId':{'$in':_0x44f828},'OpenchannelQueueId':{'$in':_0x185744}},'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(){var _0x399bfd=_0xc4fd('0x6d')+_0x21223c;return db[_0xc4fd('0x5d')][_0xc4fd('0x36')](_0x399bfd,{'type':db[_0xc4fd('0x5e')][_0xc4fd('0x66')][_0xc4fd('0x61')],'raw':!![],'transaction':_0x50189d});})['then'](function(_0x3fa0db){var _0x521c26=_[_0xc4fd('0x30')](_0x3fa0db,function(_0x6f47d1){return Number(_0x6f47d1['WhatsappQueueId']);});return db[_0xc4fd('0x6e')][_0xc4fd('0x5c')]({'where':{'UserId':{'$in':_0x44f828},'WhatsappQueueId':{'$in':_0x521c26}},'transaction':_0x50189d});})[_0xc4fd('0x2c')](function(){return db[_0xc4fd('0x6f')][_0xc4fd('0x4e')]({'where':{'TeamId':_0x21223c}});})[_0xc4fd('0x2c')](function(_0x55df48){if(_0x55df48===null){return;}return db['UserVoicePrefix'][_0xc4fd('0x5c')]({'where':{'UserId':{'$in':_0x44f828},'VoicePrefixId':_0x55df48['VoicePrefixId']},'transaction':_0x50189d});})['then'](function(){return db['Team'][_0xc4fd('0x5c')]({'where':{'id':_0x21223c},'cascade':!![],'transaction':_0x50189d});})['then'](function(_0x5051b4){if(_0x5051b4===0x0){_0x1ffd57[_0xc4fd('0x20')](0x194);}else{return db['UserProfileResource'][_0xc4fd('0x5c')]({'where':{'type':'Teams','resourceId':_0x21223c},'cascade':!![],'transaction':_0x50189d})[_0xc4fd('0x2c')](function(){_0x1ffd57['status'](0xcc)['end']();});}})[_0xc4fd('0x49')](function(_0x1b4619){_0x1ffd57[_0xc4fd('0x22')](0x1f4)[_0xc4fd('0x2f')](_0x1b4619);});});};exports[_0xc4fd('0x70')]=function(_0x96d0d4,_0xfe6f84,_0x4a9cf2){return db[_0xc4fd('0x31')][_0xc4fd('0x71')]({'where':{'id':_0x96d0d4[_0xc4fd('0x4b')]['id']}})['then'](handleEntityNotFound(_0xfe6f84,null))[_0xc4fd('0x2c')](function(_0x6b9b1d){if(!_0x96d0d4[_0xc4fd('0x36')][_0xc4fd('0x72')]||!utils[_0xc4fd('0x73')](_0x96d0d4['query'][_0xc4fd('0x72')])){throw new db['Sequelize'][(_0xc4fd('0x74'))](_0xc4fd('0x75'));}var _0x1e60d2={};var _0xc6088c={};_0xc6088c['model']=_[_0xc4fd('0x4c')](db[_[_0xc4fd('0x76')](_0x96d0d4[_0xc4fd('0x36')][_0xc4fd('0x72')][_0xc4fd('0x77')]())+_0xc4fd('0x78')]['rawAttributes']);_0xc6088c[_0xc4fd('0x36')]=_[_0xc4fd('0x4c')](_0x96d0d4[_0xc4fd('0x36')]);_0xc6088c[_0xc4fd('0x37')]=_['intersection'](_0xc6088c[_0xc4fd('0x38')],_0xc6088c[_0xc4fd('0x36')]);_0x1e60d2[_0xc4fd('0x39')]=_[_0xc4fd('0x3a')](_0xc6088c[_0xc4fd('0x38')],qs[_0xc4fd('0x3b')](_0x96d0d4['query']['fields']));_0x1e60d2[_0xc4fd('0x39')]=_0x1e60d2[_0xc4fd('0x39')][_0xc4fd('0x3c')]?_0x1e60d2[_0xc4fd('0x39')]:_0xc6088c[_0xc4fd('0x38')];_0x1e60d2[_0xc4fd('0x26')]=qs[_0xc4fd('0x26')](_0x96d0d4['query']['limit']);_0x1e60d2[_0xc4fd('0x24')]=qs[_0xc4fd('0x24')](_0x96d0d4[_0xc4fd('0x36')][_0xc4fd('0x24')]);_0x1e60d2[_0xc4fd('0x3f')]=qs[_0xc4fd('0x40')](_0x96d0d4[_0xc4fd('0x36')][_0xc4fd('0x40')]);_0x1e60d2[_0xc4fd('0x41')]=qs[_0xc4fd('0x37')](_[_0xc4fd('0x42')](_0x96d0d4[_0xc4fd('0x36')],_0xc6088c[_0xc4fd('0x37')]));_0x1e60d2=_[_0xc4fd('0x44')]({},_0x1e60d2,_0x96d0d4['options']);return _0x6b9b1d[_0xc4fd('0x51')+_[_0xc4fd('0x76')](_0x96d0d4['query'][_0xc4fd('0x72')][_0xc4fd('0x77')]())+'Queues'](_0x1e60d2);})[_0xc4fd('0x2c')](respondWithResult(_0xfe6f84,null))[_0xc4fd('0x49')](handleError(_0xfe6f84,null));};exports[_0xc4fd('0x79')]=function(_0x2a52cc,_0x300038,_0x5db243){return db['Team'][_0xc4fd('0x71')]({'where':{'id':_0x2a52cc[_0xc4fd('0x4b')]['id']}})[_0xc4fd('0x2c')](function(_0x385207){if(_0x385207){if(!_0x2a52cc['body'][_0xc4fd('0x72')]||!utils['isValidChannel'](_0x2a52cc['body'][_0xc4fd('0x72')])){throw new db[(_0xc4fd('0x5e'))][(_0xc4fd('0x74'))]('Unknown\x20channel');}return _0x385207[_0xc4fd('0x7a')+_['capitalize'](_0x2a52cc[_0xc4fd('0x5b')][_0xc4fd('0x72')][_0xc4fd('0x77')]())+_0xc4fd('0x7b')](_0x2a52cc['body'][_0xc4fd('0x7c')]);}return null;})[_0xc4fd('0x2c')](handleEntityNotFound(_0x300038,null))[_0xc4fd('0x2c')](respondWithStatusCode(_0x300038,null))[_0xc4fd('0x49')](handleError(_0x300038,null));};exports['removeQueues']=function(_0x5f0591,_0x27148c,_0x473844){return db[_0xc4fd('0x31')][_0xc4fd('0x71')]({'where':{'id':_0x5f0591['params']['id']}})[_0xc4fd('0x2c')](function(_0x416c37){if(_0x416c37){if(!_0x5f0591[_0xc4fd('0x36')][_0xc4fd('0x72')]||!utils[_0xc4fd('0x73')](_0x5f0591['query']['channel'])){throw new db[(_0xc4fd('0x5e'))]['ValidationError'](_0xc4fd('0x75'));}return _0x416c37[_0xc4fd('0x7d')+_[_0xc4fd('0x76')](_0x5f0591[_0xc4fd('0x36')][_0xc4fd('0x72')][_0xc4fd('0x77')]())+'Queues'](_0x5f0591[_0xc4fd('0x36')]['ids']);}return null;})[_0xc4fd('0x2c')](handleEntityNotFound(_0x27148c,null))[_0xc4fd('0x2c')](respondWithStatusCode(_0x27148c,null))[_0xc4fd('0x49')](handleError(_0x27148c,null));};exports[_0xc4fd('0x7e')]=function(_0x3f9184,_0x4e0616){var _0x9af1b2=_['isArray'](_0x3f9184['body'][_0xc4fd('0x7c')])?_0x3f9184['body'][_0xc4fd('0x7c')]:[_0x3f9184[_0xc4fd('0x5b')][_0xc4fd('0x7c')]];var _0x4b1adb=_0x3f9184[_0xc4fd('0x4b')]['id'];return db[_0xc4fd('0x31')]['find']({'where':{'id':_0x4b1adb}})[_0xc4fd('0x2c')](handleEntityNotFound(_0x4e0616,null))[_0xc4fd('0x2c')](function(_0x3b4a82){if(_0x3b4a82){var _0x210bba=[_0xc4fd('0x7f'),_0xc4fd('0x80'),_0xc4fd('0x81'),_0xc4fd('0x82'),_0xc4fd('0x83'),_0xc4fd('0x84'),_0xc4fd('0x85')];return db[_0xc4fd('0x5d')][_0xc4fd('0x86')](function(_0x31d66f){var _0x196ddc=_[_0xc4fd('0x30')](_0x210bba,function(_0x5b18e4){var _0x4c2b81={'attributes':['id',_0xc4fd('0x2e')]};if(_0x5b18e4===_0xc4fd('0x7f')){_0x4c2b81['through']={'attributes':[_0xc4fd('0x87')]};}return _0x3b4a82[_0xc4fd('0x51')+_0x5b18e4+_0xc4fd('0x7b')](_0x4c2b81)[_0xc4fd('0x2c')](function(_0x5efb33){var _0x5ec1cd=_['map'](_0x5efb33,function(_0x1a8707){var _0x5d9bb6=_[_0xc4fd('0x30')](_0x9af1b2,function(_0x2d93cd){var _0x5eb420={'where':{'UserId':_0x2d93cd,[_0x5b18e4+_0xc4fd('0x88')]:_0x1a8707['id']},'transaction':_0x31d66f};if(_0x5b18e4==='Voice'){_0x5eb420[_0xc4fd('0x89')]={'penalty':_0x1a8707[_0xc4fd('0x8a')]['penalty']};}return db[_0xc4fd('0x8b')+_0x5b18e4+_0xc4fd('0x78')][_0xc4fd('0x8c')](_0x5eb420)[_0xc4fd('0x2c')](function(){socket[_0xc4fd('0x8d')](_0xc4fd('0x50')+_0x5b18e4+_0xc4fd('0x8e'),{'UserId':_0x2d93cd,[_0x5b18e4+_0xc4fd('0x88')]:_0x1a8707['id']});if(_0x5b18e4!=='Voice'){return;}return db[_0xc4fd('0x8b')]['findAll']({'where':{'id':_0x9af1b2,'online':0x1},'attributes':['id',_0xc4fd('0x2e'),_0xc4fd('0x8f'),'voicePause',_0xc4fd('0x90')],'raw':!![]})[_0xc4fd('0x2c')](function(_0x5c60a){var _0x52ee57=_[_0xc4fd('0x30')](_0x5c60a,function(_0x382883){return db[_0xc4fd('0x91')][_0xc4fd('0x92')]({'membername':_0x382883[_0xc4fd('0x2e')],'UserId':_0x382883['id'],'queue_name':_0x1a8707[_0xc4fd('0x2e')],'VoiceQueueId':_0x1a8707['id'],'interface':_['isNil'](_0x382883[_0xc4fd('0x90')])?util[_0xc4fd('0x93')](_0xc4fd('0x94'),_0x382883[_0xc4fd('0x2e')]):_0x382883[_0xc4fd('0x90')],'paused':_0x382883[_0xc4fd('0x95')]||![],'penalty':_0x1a8707['TeamVoiceQueue'][_0xc4fd('0x87')]},{'transaction':_0x31d66f});});return Promise[_0xc4fd('0x96')](_0x52ee57);});});});return Promise[_0xc4fd('0x96')](_0x5d9bb6);});return Promise[_0xc4fd('0x96')](_0x5ec1cd);})[_0xc4fd('0x2c')](function(){return db[_0xc4fd('0x6f')]['findOne']({'where':{'teamId':_0x4b1adb}})['then'](function(_0x169a1c){if(_0x169a1c){var _0x342f7e=_[_0xc4fd('0x30')](_0x9af1b2,function(_0x1e4fce){db['UserVoicePrefix'][_0xc4fd('0x92')]({'UserId':_0x1e4fce,'VoicePrefixId':_0x169a1c[_0xc4fd('0x97')]});});return Promise['all'](_0x342f7e);}});});});return Promise[_0xc4fd('0x96')](_0x196ddc)[_0xc4fd('0x2c')](function(){return _0x3b4a82['addAgents'](_0x9af1b2,{'transaction':_0x31d66f})[_0xc4fd('0x98')](function(_0x5a3b93){return _0x5a3b93;});});});}})[_0xc4fd('0x2c')](respondWithResult(_0x4e0616,null))[_0xc4fd('0x49')](handleError(_0x4e0616,null));};exports[_0xc4fd('0x99')]=function(_0x21b8fc,_0x488f73){var _0x49768d=_[_0xc4fd('0x9a')](_0x21b8fc[_0xc4fd('0x36')][_0xc4fd('0x7c')])?_0x21b8fc[_0xc4fd('0x36')][_0xc4fd('0x7c')]:[_0x21b8fc[_0xc4fd('0x36')][_0xc4fd('0x7c')]];var _0x43a150=_0x21b8fc[_0xc4fd('0x4b')]['id'];return db[_0xc4fd('0x31')]['find']({'where':{'id':_0x43a150}})['then'](handleEntityNotFound(_0x488f73,null))[_0xc4fd('0x2c')](function(_0x3caf83){if(_0x3caf83){var _0xa3237c=[_0xc4fd('0x7f'),_0xc4fd('0x80'),_0xc4fd('0x81'),'Sms',_0xc4fd('0x83'),'Openchannel','Whatsapp'];return db[_0xc4fd('0x5d')][_0xc4fd('0x86')](function(_0x45a9cd){var _0x2dc9d1=_[_0xc4fd('0x30')](_0xa3237c,function(_0x1248bb){var _0x385abe={'attributes':['id',_0xc4fd('0x2e')]};return _0x3caf83[_0xc4fd('0x51')+_0x1248bb+_0xc4fd('0x7b')](_0x385abe)[_0xc4fd('0x2c')](function(_0x324270){var _0x55e7c5=_['map'](_0x324270,function(_0x180610){return _0x180610[_0xc4fd('0x99')](_0x49768d,{'transaction':_0x45a9cd})['then'](function(){var _0x40932b=_[_0xc4fd('0x30')](_0x49768d,function(_0x439a0f){socket[_0xc4fd('0x8d')](_0xc4fd('0x50')+_0x1248bb+'Queue:remove',{'UserId':Number(_0x439a0f),[_0x1248bb+_0xc4fd('0x88')]:_0x180610['id']});if(_0x1248bb!==_0xc4fd('0x7f')){return;}return db[_0xc4fd('0x91')][_0xc4fd('0x5c')]({'where':{'VoiceQueueId':_0x180610['id'],'UserId':_0x439a0f},'transaction':_0x45a9cd});});return Promise['all'](_0x40932b);});});return Promise[_0xc4fd('0x96')](_0x55e7c5);});});return Promise[_0xc4fd('0x96')](_0x2dc9d1)['then'](function(){return _0x3caf83['removeAgents'](_0x49768d,{'transaction':_0x45a9cd});})[_0xc4fd('0x2c')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x43a150}})[_0xc4fd('0x2c')](function(_0x4bff31){if(_0x4bff31){var _0x23a466=_[_0xc4fd('0x30')](_0x49768d,function(_0x4b22ce){db[_0xc4fd('0x9b')][_0xc4fd('0x5c')]({'where':{'UserId':_0x4b22ce,'VoicePrefixId':_0x4bff31['VoicePrefixId']}});});return Promise[_0xc4fd('0x96')](_0x23a466);}});});});}})['then'](respondWithStatusCode(_0x488f73,null))[_0xc4fd('0x49')](handleError(_0x488f73,null));};exports[_0xc4fd('0x9c')]=function(_0x572e44,_0x1bf3c1,_0x386b6d){var _0x53e20d={};var _0x445374={};var _0x4646cb;var _0x27c8c9;return db[_0xc4fd('0x31')]['findOne']({'where':{'id':_0x572e44[_0xc4fd('0x4b')]['id']}})[_0xc4fd('0x2c')](handleEntityNotFound(_0x1bf3c1,null))['then'](function(_0x10883c){if(_0x10883c){_0x4646cb=_0x10883c;_0x445374[_0xc4fd('0x38')]=_['keys'](db[_0xc4fd('0x8b')][_0xc4fd('0x32')]);_0x445374[_0xc4fd('0x36')]=_[_0xc4fd('0x4c')](_0x572e44[_0xc4fd('0x36')]);_0x445374[_0xc4fd('0x37')]=_[_0xc4fd('0x3a')](_0x445374[_0xc4fd('0x38')],_0x445374[_0xc4fd('0x36')]);_0x53e20d[_0xc4fd('0x39')]=_['intersection'](_0x445374[_0xc4fd('0x38')],qs[_0xc4fd('0x3b')](_0x572e44[_0xc4fd('0x36')][_0xc4fd('0x3b')]));_0x53e20d[_0xc4fd('0x39')]=_0x53e20d[_0xc4fd('0x39')]['length']?_0x53e20d[_0xc4fd('0x39')]:_0x445374[_0xc4fd('0x38')];_0x53e20d['order']=qs[_0xc4fd('0x40')](_0x572e44['query'][_0xc4fd('0x40')]);_0x53e20d[_0xc4fd('0x41')]=qs[_0xc4fd('0x37')](_[_0xc4fd('0x42')](_0x572e44[_0xc4fd('0x36')],_0x445374[_0xc4fd('0x37')]));if(_0x572e44['query'][_0xc4fd('0x43')]){_0x53e20d[_0xc4fd('0x41')]=_['merge'](_0x53e20d[_0xc4fd('0x41')],{'$or':_['map'](_0x53e20d['attributes'],function(_0x22198e){var _0x2c4707={};_0x2c4707[_0x22198e]={'$like':'%'+_0x572e44[_0xc4fd('0x36')][_0xc4fd('0x43')]+'%'};return _0x2c4707;})});}_0x53e20d=_[_0xc4fd('0x44')]({},_0x53e20d,_0x572e44[_0xc4fd('0x4d')]);return _0x4646cb['getAgents'](_0x53e20d);}})[_0xc4fd('0x2c')](function(_0x354d9b){if(_0x354d9b){_0x27c8c9=_0x354d9b['length'];if(!_0x572e44['query']['hasOwnProperty']('nolimit')){_0x53e20d['limit']=qs['limit'](_0x572e44[_0xc4fd('0x36')]['limit']);_0x53e20d['offset']=qs[_0xc4fd('0x24')](_0x572e44['query'][_0xc4fd('0x24')]);}return _0x4646cb['getAgents'](_0x53e20d);}})[_0xc4fd('0x2c')](function(_0x390922){if(_0x390922){return _0x390922?{'count':_0x27c8c9,'rows':_0x390922}:null;}})[_0xc4fd('0x2c')](respondWithResult(_0x1bf3c1,null))[_0xc4fd('0x49')](handleError(_0x1bf3c1,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index db1412d..6ccfcbd 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 _0xd949=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1b91cf,_0x3342b4){var _0x138c71=function(_0xfe49fa){while(--_0xfe49fa){_0x1b91cf['push'](_0x1b91cf['shift']());}};_0x138c71(++_0x3342b4);}(_0xd949,0x1b7));var _0x9d94=function(_0x2c5a2e,_0x126964){_0x2c5a2e=_0x2c5a2e-0x0;var _0x2fca86=_0xd949[_0x2c5a2e];return _0x2fca86;};'use strict';var EventEmitter=require(_0x9d94('0x0'));var Team=require(_0x9d94('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x9d94('0x2')](0x0);var events={'afterCreate':_0x9d94('0x3'),'afterUpdate':_0x9d94('0x4'),'afterDestroy':_0x9d94('0x5')};function emitEvent(_0x58c2e5){return function(_0x2bdb06,_0x24b506,_0x2f699f){TeamEvents[_0x9d94('0x6')](_0x58c2e5+':'+_0x2bdb06['id'],_0x2bdb06);TeamEvents[_0x9d94('0x6')](_0x58c2e5,_0x2bdb06);_0x2f699f(null);};}for(var e in events){if(events[_0x9d94('0x7')](e)){var event=events[e];Team[_0x9d94('0x8')](e,emitEvent(event));}}module[_0x9d94('0x9')]=TeamEvents; \ No newline at end of file +var _0x49d1=['hasOwnProperty','hook','exports','../../mysqldb','Team','setMaxListeners','save','remove','emit'];(function(_0x5163ae,_0x22908e){var _0x22c58d=function(_0x19f31c){while(--_0x19f31c){_0x5163ae['push'](_0x5163ae['shift']());}};_0x22c58d(++_0x22908e);}(_0x49d1,0xb7));var _0x149d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x49d1[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var Team=require(_0x149d('0x0'))['db'][_0x149d('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x149d('0x2')](0x0);var events={'afterCreate':_0x149d('0x3'),'afterUpdate':'update','afterDestroy':_0x149d('0x4')};function emitEvent(_0x58173d){return function(_0x575f1b,_0x3e9ce1,_0x188fde){TeamEvents[_0x149d('0x5')](_0x58173d+':'+_0x575f1b['id'],_0x575f1b);TeamEvents[_0x149d('0x5')](_0x58173d,_0x575f1b);_0x188fde(null);};}for(var e in events){if(events[_0x149d('0x6')](e)){var event=events[e];Team[_0x149d('0x7')](e,emitEvent(event));}}module[_0x149d('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d01db32..745bf9b 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 _0x9049=['moment','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','Team','teams','lodash','api'];(function(_0x36dbb3,_0x5d84e8){var _0x27dd6f=function(_0x4e4506){while(--_0x4e4506){_0x36dbb3['push'](_0x36dbb3['shift']());}};_0x27dd6f(++_0x5d84e8);}(_0x9049,0x15c));var _0x9904=function(_0x576b66,_0x157b99){_0x576b66=_0x576b66-0x0;var _0x3a068b=_0x9049[_0x576b66];return _0x3a068b;};'use strict';var _=require(_0x9904('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9904('0x1'));var moment=require(_0x9904('0x2'));var BPromise=require(_0x9904('0x3'));var rp=require(_0x9904('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9904('0x5'));var config=require(_0x9904('0x6'));var attributes=require(_0x9904('0x7'));module['exports']=function(_0x3d5cb5,_0x31da79){return _0x3d5cb5['define'](_0x9904('0x8'),attributes,{'tableName':_0x9904('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8be3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','Team','util','../../config/logger','api'];(function(_0x39e15b,_0x555185){var _0x4e5766=function(_0x45ef45){while(--_0x45ef45){_0x39e15b['push'](_0x39e15b['shift']());}};_0x4e5766(++_0x555185);}(_0x8be3,0x1b9));var _0x38be=function(_0x50181f,_0x5f1a02){_0x50181f=_0x50181f-0x0;var _0x5c4e9a=_0x8be3[_0x50181f];return _0x5c4e9a;};'use strict';var _=require('lodash');var util=require(_0x38be('0x0'));var logger=require(_0x38be('0x1'))(_0x38be('0x2'));var moment=require(_0x38be('0x3'));var BPromise=require(_0x38be('0x4'));var rp=require(_0x38be('0x5'));var fs=require('fs');var path=require(_0x38be('0x6'));var rimraf=require(_0x38be('0x7'));var config=require(_0x38be('0x8'));var attributes=require(_0x38be('0x9'));module[_0x38be('0xa')]=function(_0x231ec4,_0x3a9e0f){return _0x231ec4['define'](_0x38be('0xb'),attributes,{'tableName':'teams','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 5250618..20d01c7 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 _0xcbf0=['./team.socket','register','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Team,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x10f875,_0x51f8cf){var _0x3accfa=function(_0x1918ea){while(--_0x1918ea){_0x10f875['push'](_0x10f875['shift']());}};_0x3accfa(++_0x51f8cf);}(_0xcbf0,0x112));var _0x0cbf=function(_0x514ec7,_0x2fc3f7){_0x514ec7=_0x514ec7-0x0;var _0x2024d2=_0xcbf0[_0x514ec7];return _0x2024d2;};'use strict';var _=require('lodash');var util=require(_0x0cbf('0x0'));var moment=require('moment');var BPromise=require(_0x0cbf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cbf('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0cbf('0x3'))('rpc');var config=require(_0x0cbf('0x4'));var jayson=require(_0x0cbf('0x5'));var client=jayson[_0x0cbf('0x6')][_0x0cbf('0x7')]({'port':0x232a});config[_0x0cbf('0x8')]=_[_0x0cbf('0x9')](config[_0x0cbf('0x8')],{'host':_0x0cbf('0xa'),'port':0x18eb});var socket=require(_0x0cbf('0xb'))(new Redis(config[_0x0cbf('0x8')]));require(_0x0cbf('0xc'))[_0x0cbf('0xd')](socket);function respondWithRpcPromise(_0x3ea876,_0x2bded9,_0xda5928){return new BPromise(function(_0x27c541,_0x24e242){return client['request'](_0x3ea876,_0xda5928)[_0x0cbf('0xe')](function(_0x21b9fd){logger[_0x0cbf('0xf')]('Team,\x20%s,\x20%s',_0x2bded9,'request\x20sent');logger[_0x0cbf('0x10')](_0x0cbf('0x11'),_0x2bded9,_0x0cbf('0x12'),JSON[_0x0cbf('0x13')](_0x21b9fd));if(_0x21b9fd[_0x0cbf('0x14')]){if(_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x15')]===0x1f4){logger[_0x0cbf('0x14')]('Team,\x20%s,\x20%s',_0x2bded9,_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x16')]);return _0x24e242(_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x16')]);}logger['error'](_0x0cbf('0x17'),_0x2bded9,_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x16')]);return _0x27c541(_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x16')]);}else{logger[_0x0cbf('0xf')](_0x0cbf('0x17'),_0x2bded9,_0x0cbf('0x12'));_0x27c541(_0x21b9fd[_0x0cbf('0x18')][_0x0cbf('0x16')]);}})[_0x0cbf('0x19')](function(_0x4e3fc2){logger['error']('Team,\x20%s,\x20%s',_0x2bded9,_0x4e3fc2);_0x24e242(_0x4e3fc2);});});} \ No newline at end of file +var _0x0bdb=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0x0bdb,0x162));var _0xb0bd=function(_0x4a8812,_0x430080){_0x4a8812=_0x4a8812-0x0;var _0x55a784=_0x0bdb[_0x4a8812];return _0x55a784;};'use strict';var _=require(_0xb0bd('0x0'));var util=require(_0xb0bd('0x1'));var moment=require(_0xb0bd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0bd('0x3'));var db=require(_0xb0bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0bd('0x5'))('rpc');var config=require(_0xb0bd('0x6'));var jayson=require(_0xb0bd('0x7'));var client=jayson[_0xb0bd('0x8')]['http']({'port':0x232a});config[_0xb0bd('0x9')]=_['defaults'](config[_0xb0bd('0x9')],{'host':_0xb0bd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0bd('0x9')]));require('./team.socket')[_0xb0bd('0xb')](socket);function respondWithRpcPromise(_0x4b5f64,_0x39ff69,_0x72de4d){return new BPromise(function(_0x30c8ec,_0x34d343){return client[_0xb0bd('0xc')](_0x4b5f64,_0x72de4d)[_0xb0bd('0xd')](function(_0x3a9294){logger[_0xb0bd('0xe')](_0xb0bd('0xf'),_0x39ff69,_0xb0bd('0x10'));logger['debug'](_0xb0bd('0x11'),_0x39ff69,_0xb0bd('0x10'),JSON[_0xb0bd('0x12')](_0x3a9294));if(_0x3a9294['error']){if(_0x3a9294['error']['code']===0x1f4){logger[_0xb0bd('0x13')](_0xb0bd('0xf'),_0x39ff69,_0x3a9294['error']['message']);return _0x34d343(_0x3a9294[_0xb0bd('0x13')][_0xb0bd('0x14')]);}logger[_0xb0bd('0x13')](_0xb0bd('0xf'),_0x39ff69,_0x3a9294[_0xb0bd('0x13')][_0xb0bd('0x14')]);return _0x30c8ec(_0x3a9294[_0xb0bd('0x13')][_0xb0bd('0x14')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x39ff69,_0xb0bd('0x10'));_0x30c8ec(_0x3a9294['result'][_0xb0bd('0x14')]);}})['catch'](function(_0x110f30){logger[_0xb0bd('0x13')](_0xb0bd('0xf'),_0x39ff69,_0x110f30);_0x34d343(_0x110f30);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a9976b0..a3c66c4 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 _0xfc0c=['remove','emit','removeListener','register','save'];(function(_0x375419,_0x3cae73){var _0x51e737=function(_0x3682e3){while(--_0x3682e3){_0x375419['push'](_0x375419['shift']());}};_0x51e737(++_0x3cae73);}(_0xfc0c,0x103));var _0xcfc0=function(_0x3992bc,_0x4c9712){_0x3992bc=_0x3992bc-0x0;var _0x316268=_0xfc0c[_0x3992bc];return _0x316268;};'use strict';var TeamEvents=require('./team.events');var events=[_0xcfc0('0x0'),_0xcfc0('0x1'),'update'];function createListener(_0x1e6de7,_0x55cb4e){return function(_0x4d8cb9){_0x55cb4e[_0xcfc0('0x2')](_0x1e6de7,_0x4d8cb9);};}function removeListener(_0x360ca4,_0x252d72){return function(){TeamEvents[_0xcfc0('0x3')](_0x360ca4,_0x252d72);};}exports[_0xcfc0('0x4')]=function(_0x5396d3){for(var _0xae6edc=0x0,_0xad2070=events['length'];_0xae6edc<_0xad2070;_0xae6edc++){var _0x3aa2b3=events[_0xae6edc];var _0xe1e48e=createListener('team:'+_0x3aa2b3,_0x5396d3);TeamEvents['on'](_0x3aa2b3,_0xe1e48e);}}; \ No newline at end of file +var _0xb5c6=['team:','save','remove','update','removeListener','length'];(function(_0x2deb9d,_0x4cf531){var _0x2dabda=function(_0x36ba63){while(--_0x36ba63){_0x2deb9d['push'](_0x2deb9d['shift']());}};_0x2dabda(++_0x4cf531);}(_0xb5c6,0xe5));var _0x6b5c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb5c6[_0x2dafbe];return _0x58a45a;};'use strict';var TeamEvents=require('./team.events');var events=[_0x6b5c('0x0'),_0x6b5c('0x1'),_0x6b5c('0x2')];function createListener(_0x432853,_0x5c24d9){return function(_0x4f3679){_0x5c24d9['emit'](_0x432853,_0x4f3679);};}function removeListener(_0x4b5455,_0x4728b6){return function(){TeamEvents[_0x6b5c('0x3')](_0x4b5455,_0x4728b6);};}exports['register']=function(_0x36904a){for(var _0x34daed=0x0,_0x4c93ca=events[_0x6b5c('0x4')];_0x34daed<_0x4c93ca;_0x34daed++){var _0x45cdf1=events[_0x34daed];var _0x2a13d0=createListener(_0x6b5c('0x5')+_0x45cdf1,_0x36904a);TeamEvents['on'](_0x45cdf1,_0x2a13d0);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index a20dd91..5b84386 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 _0x4b96=['exports','INTEGER','sequelize'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x4b96,0x12e));var _0x64b9=function(_0x199e1b,_0x1e701d){_0x199e1b=_0x199e1b-0x0;var _0x5a9087=_0x4b96[_0x199e1b];return _0x5a9087;};'use strict';var Sequelize=require(_0x64b9('0x0'));module[_0x64b9('0x1')]={'TeamId':{'type':Sequelize[_0x64b9('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5668=['INTEGER','sequelize','exports'];(function(_0x2f90e1,_0x5c05ef){var _0x11f421=function(_0x2aee3f){while(--_0x2aee3f){_0x2f90e1['push'](_0x2f90e1['shift']());}};_0x11f421(++_0x5c05ef);}(_0x5668,0x8b));var _0x8566=function(_0x351d30,_0x4d6d90){_0x351d30=_0x351d30-0x0;var _0x4974b=_0x5668[_0x351d30];return _0x4974b;};'use strict';var Sequelize=require(_0x8566('0x0'));module[_0x8566('0x1')]={'TeamId':{'type':Sequelize[_0x8566('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8566('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 5514fa4..923f2b7 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 _0x38c9=['../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2464bb,_0xc0ea6){var _0x18716c=function(_0x4e01e4){while(--_0x4e01e4){_0x2464bb['push'](_0x2464bb['shift']());}};_0x18716c(++_0xc0ea6);}(_0x38c9,0x199));var _0x938c=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x38c9[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var logger=require(_0x938c('0x2'))('api');var moment=require(_0x938c('0x3'));var BPromise=require(_0x938c('0x4'));var rp=require(_0x938c('0x5'));var fs=require('fs');var path=require(_0x938c('0x6'));var rimraf=require('rimraf');var config=require(_0x938c('0x7'));var attributes=require(_0x938c('0x8'));module[_0x938c('0x9')]=function(_0x15a858,_0x4dae36){return _0x15a858[_0x938c('0xa')](_0x938c('0xb'),attributes,{'tableName':_0x938c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf767=['exports','define','TeamVoicePrefix','../../config/logger','api','moment','bluebird','./teamVoicePrefix.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf767,0x183));var _0x7f76=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xf767[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f76('0x0'))(_0x7f76('0x1'));var moment=require(_0x7f76('0x2'));var BPromise=require(_0x7f76('0x3'));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(_0x7f76('0x4'));module[_0x7f76('0x5')]=function(_0x5e8527,_0x509376){return _0x5e8527[_0x7f76('0x6')](_0x7f76('0x7'),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 7bdc907..730bd77 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x592e8e,_0x182f70){var _0x59fcfa=function(_0x1717be){while(--_0x1717be){_0x592e8e['push'](_0x592e8e['shift']());}};_0x59fcfa(++_0x182f70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 5ed8e91..172f36d 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 _0xd334=['exports','INTEGER'];(function(_0x5ea53e,_0x19a0dc){var _0xec9350=function(_0x34ee93){while(--_0x34ee93){_0x5ea53e['push'](_0x5ea53e['shift']());}};_0xec9350(++_0x19a0dc);}(_0xd334,0x1b8));var _0x4d33=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xd334[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require('sequelize');module[_0x4d33('0x0')]={'penalty':{'type':Sequelize[_0x4d33('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf08f=['exports','INTEGER','sequelize'];(function(_0x20eacd,_0x2394e2){var _0x57942a=function(_0xd86eda){while(--_0xd86eda){_0x20eacd['push'](_0x20eacd['shift']());}};_0x57942a(++_0x2394e2);}(_0xf08f,0x143));var _0xff08=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xf08f[_0x4a9beb];return _0x2d4c58;};'use strict';var Sequelize=require(_0xff08('0x0'));module[_0xff08('0x1')]={'penalty':{'type':Sequelize[_0xff08('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 252620b..6841fd3 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 _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','team_has_voice_queues','lodash','util','api'];(function(_0x2a2edd,_0x217b41){var _0x370173=function(_0x2f6196){while(--_0x2f6196){_0x2a2edd['push'](_0x2a2edd['shift']());}};_0x370173(++_0x217b41);}(_0xa41a,0x6b));var _0xaa41=function(_0x24332d,_0x1d36f7){_0x24332d=_0x24332d-0x0;var _0x26e3e2=_0xa41a[_0x24332d];return _0x26e3e2;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('TeamVoiceQueue',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa2f=['bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','../../config/logger','moment'];(function(_0x3c3602,_0x13b7b3){var _0x2fdbcc=function(_0x354284){while(--_0x354284){_0x3c3602['push'](_0x3c3602['shift']());}};_0x2fdbcc(++_0x13b7b3);}(_0xfa2f,0xe8));var _0xffa2=function(_0x1ad852,_0x17053b){_0x1ad852=_0x1ad852-0x0;var _0x2ed4f0=_0xfa2f[_0x1ad852];return _0x2ed4f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xffa2('0x0'))('api');var moment=require(_0xffa2('0x1'));var BPromise=require(_0xffa2('0x2'));var rp=require(_0xffa2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffa2('0x4'));var config=require(_0xffa2('0x5'));var attributes=require(_0xffa2('0x6'));module[_0xffa2('0x7')]=function(_0x25fd81,_0x2c7708){return _0x25fd81[_0xffa2('0x8')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index f01382c..2185fb7 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 _0xbacf=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xbacf,0xf9));var _0xfbac=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xbacf[_0x25248b];return _0x509939;};'use strict';var _=require('lodash');var util=require(_0xfbac('0x0'));var moment=require(_0xfbac('0x1'));var BPromise=require(_0xfbac('0x2'));var rs=require(_0xfbac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbac('0x4'))(_0xfbac('0x5'));var config=require(_0xfbac('0x6'));var jayson=require(_0xfbac('0x7'));var client=jayson[_0xfbac('0x8')][_0xfbac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a173,_0x31ff42,_0x5880c9){return new BPromise(function(_0x38c928,_0x35d67f){return client[_0xfbac('0xa')](_0x32a173,_0x5880c9)[_0xfbac('0xb')](function(_0x1b91a6){logger[_0xfbac('0xc')](_0xfbac('0xd'),_0x31ff42,'request\x20sent');logger[_0xfbac('0xe')](_0xfbac('0xf'),_0x31ff42,_0xfbac('0x10'),JSON[_0xfbac('0x11')](_0x1b91a6));if(_0x1b91a6[_0xfbac('0x12')]){if(_0x1b91a6[_0xfbac('0x12')]['code']===0x1f4){logger[_0xfbac('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x31ff42,_0x1b91a6[_0xfbac('0x12')][_0xfbac('0x13')]);return _0x35d67f(_0x1b91a6['error'][_0xfbac('0x13')]);}logger['error'](_0xfbac('0xd'),_0x31ff42,_0x1b91a6[_0xfbac('0x12')]['message']);return _0x38c928(_0x1b91a6[_0xfbac('0x12')][_0xfbac('0x13')]);}else{logger[_0xfbac('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x31ff42,_0xfbac('0x10'));_0x38c928(_0x1b91a6[_0xfbac('0x14')][_0xfbac('0x13')]);}})[_0xfbac('0x15')](function(_0x2b316a){logger[_0xfbac('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x31ff42,_0x2b316a);_0x35d67f(_0x2b316a);});});} \ No newline at end of file +var _0x8ec3=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x8ec3,0x19c));var _0x38ec=function(_0x4ed3e3,_0x4078d){_0x4ed3e3=_0x4ed3e3-0x0;var _0x441094=_0x8ec3[_0x4ed3e3];return _0x441094;};'use strict';var _=require(_0x38ec('0x0'));var util=require('util');var moment=require(_0x38ec('0x1'));var BPromise=require(_0x38ec('0x2'));var rs=require(_0x38ec('0x3'));var fs=require('fs');var Redis=require(_0x38ec('0x4'));var db=require(_0x38ec('0x5'))['db'];var utils=require(_0x38ec('0x6'));var logger=require('../../config/logger')(_0x38ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x38ec('0x8'));var client=jayson[_0x38ec('0x9')][_0x38ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24c713,_0x219bf2,_0x327d39){return new BPromise(function(_0x8ac564,_0xb7e8b){return client[_0x38ec('0xb')](_0x24c713,_0x327d39)[_0x38ec('0xc')](function(_0x575dd1){logger[_0x38ec('0xd')](_0x38ec('0xe'),_0x219bf2,_0x38ec('0xf'));logger[_0x38ec('0x10')](_0x38ec('0x11'),_0x219bf2,_0x38ec('0xf'),JSON[_0x38ec('0x12')](_0x575dd1));if(_0x575dd1[_0x38ec('0x13')]){if(_0x575dd1[_0x38ec('0x13')][_0x38ec('0x14')]===0x1f4){logger[_0x38ec('0x13')](_0x38ec('0xe'),_0x219bf2,_0x575dd1[_0x38ec('0x13')]['message']);return _0xb7e8b(_0x575dd1[_0x38ec('0x13')][_0x38ec('0x15')]);}logger[_0x38ec('0x13')](_0x38ec('0xe'),_0x219bf2,_0x575dd1[_0x38ec('0x13')][_0x38ec('0x15')]);return _0x8ac564(_0x575dd1[_0x38ec('0x13')][_0x38ec('0x15')]);}else{logger['info'](_0x38ec('0xe'),_0x219bf2,_0x38ec('0xf'));_0x8ac564(_0x575dd1[_0x38ec('0x16')][_0x38ec('0x15')]);}})[_0x38ec('0x17')](function(_0x60bf77){logger[_0x38ec('0x13')](_0x38ec('0xe'),_0x219bf2,_0x60bf77);_0xb7e8b(_0x60bf77);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index cb3c60c..12e952e 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 _0x2ace=['create','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0x2ace,0x17e));var _0xe2ac=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x2ace[_0x4fe19c];return _0x952ac7;};'use strict';var multer=require('multer');var util=require(_0xe2ac('0x0'));var path=require(_0xe2ac('0x1'));var timeout=require(_0xe2ac('0x2'));var express=require('express');var router=express[_0xe2ac('0x3')]();var fs_extra=require(_0xe2ac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe2ac('0x5'));var config=require(_0xe2ac('0x6'));var controller=require(_0xe2ac('0x7'));router[_0xe2ac('0x8')]('/',auth[_0xe2ac('0x9')](),controller[_0xe2ac('0xa')]);router[_0xe2ac('0x8')](_0xe2ac('0xb'),auth[_0xe2ac('0x9')](),controller[_0xe2ac('0xc')]);router[_0xe2ac('0xd')]('/',auth[_0xe2ac('0x9')](),controller[_0xe2ac('0xe')]);router['put']('/:id',auth[_0xe2ac('0x9')](),controller['update']);router[_0xe2ac('0xf')](_0xe2ac('0xb'),auth['isAuthenticated'](),controller[_0xe2ac('0x10')]);module[_0xe2ac('0x11')]=router; \ No newline at end of file +var _0x85de=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','index','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x416aeb,_0x25532d){var _0x1694d4=function(_0x4716ac){while(--_0x4716ac){_0x416aeb['push'](_0x416aeb['shift']());}};_0x1694d4(++_0x25532d);}(_0x85de,0x65));var _0xe85d=function(_0x4c5677,_0x368c4c){_0x4c5677=_0x4c5677-0x0;var _0x1f4911=_0x85de[_0x4c5677];return _0x1f4911;};'use strict';var multer=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var path=require(_0xe85d('0x2'));var timeout=require(_0xe85d('0x3'));var express=require(_0xe85d('0x4'));var router=express[_0xe85d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe85d('0x6'));var interaction=require(_0xe85d('0x7'));var config=require(_0xe85d('0x8'));var controller=require(_0xe85d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe85d('0xa')]);router[_0xe85d('0xb')](_0xe85d('0xc'),auth[_0xe85d('0xd')](),controller['show']);router[_0xe85d('0xe')]('/',auth[_0xe85d('0xd')](),controller[_0xe85d('0xf')]);router[_0xe85d('0x10')](_0xe85d('0xc'),auth[_0xe85d('0xd')](),controller[_0xe85d('0x11')]);router[_0xe85d('0x12')](_0xe85d('0xc'),auth[_0xe85d('0xd')](),controller[_0xe85d('0x13')]);module[_0xe85d('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index aa29c41..2145bad 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 _0x5a03=['STRING','TEXT','sequelize','exports'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x5a03,0x19e));var _0x35a0=function(_0x4c7006,_0x40d35b){_0x4c7006=_0x4c7006-0x0;var _0x408ca2=_0x5a03[_0x4c7006];return _0x408ca2;};'use strict';var Sequelize=require(_0x35a0('0x0'));module[_0x35a0('0x1')]={'name':{'type':Sequelize[_0x35a0('0x2')]},'description':{'type':Sequelize[_0x35a0('0x2')]},'html':{'type':Sequelize[_0x35a0('0x3')]}}; \ No newline at end of file +var _0x0758=['sequelize','exports','STRING','TEXT'];(function(_0x352cc7,_0x202916){var _0x2eb52b=function(_0x4568ee){while(--_0x4568ee){_0x352cc7['push'](_0x352cc7['shift']());}};_0x2eb52b(++_0x202916);}(_0x0758,0xd8));var _0x8075=function(_0x45f670,_0x4226fd){_0x45f670=_0x45f670-0x0;var _0x300d18=_0x0758[_0x45f670];return _0x300d18;};'use strict';var Sequelize=require(_0x8075('0x0'));module[_0x8075('0x1')]={'name':{'type':Sequelize[_0x8075('0x2')]},'description':{'type':Sequelize[_0x8075('0x2')]},'html':{'type':Sequelize[_0x8075('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8d4d0dd..82ba1ab 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 _0x5d29=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','Templates','UserProfileResource','error','send','index','map','Template','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x5d29,0x187));var _0x95d2=function(_0x2d1610,_0x463b9b){_0x2d1610=_0x2d1610-0x0;var _0x5bb4ca=_0x5d29[_0x2d1610];return _0x5bb4ca;};'use strict';var emlformat=require(_0x95d2('0x0'));var rimraf=require(_0x95d2('0x1'));var zipdir=require(_0x95d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95d2('0x3'));var moment=require('moment');var BPromise=require(_0x95d2('0x4'));var Mustache=require(_0x95d2('0x5'));var util=require(_0x95d2('0x6'));var path=require('path');var sox=require(_0x95d2('0x7'));var csv=require(_0x95d2('0x8'));var ejs=require(_0x95d2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x95d2('0xa'));var crypto=require('crypto');var jsforce=require(_0x95d2('0xb'));var deskjs=require(_0x95d2('0xc'));var toCsv=require(_0x95d2('0x8'));var querystring=require(_0x95d2('0xd'));var Papa=require(_0x95d2('0xe'));var Redis=require(_0x95d2('0xf'));var authService=require(_0x95d2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x95d2('0x11'));var hardwareService=require(_0x95d2('0x12'));var logger=require(_0x95d2('0x13'))(_0x95d2('0x14'));var utils=require('../../config/utils');var config=require(_0x95d2('0x15'));var licenseUtil=require(_0x95d2('0x16'));var db=require(_0x95d2('0x17'))['db'];function respondWithStatusCode(_0x33cf2c,_0x252b08){_0x252b08=_0x252b08||0xcc;return function(_0xb8eb94){if(_0xb8eb94){return _0x33cf2c[_0x95d2('0x18')](_0x252b08);}return _0x33cf2c[_0x95d2('0x19')](_0x252b08)[_0x95d2('0x1a')]();};}function respondWithResult(_0x20735f,_0x4f92a8){_0x4f92a8=_0x4f92a8||0xc8;return function(_0x7d959){if(_0x7d959){return _0x20735f[_0x95d2('0x19')](_0x4f92a8)['json'](_0x7d959);}};}function respondWithFilteredResult(_0x53c16f,_0x3f5dc1){return function(_0x954f4d){if(_0x954f4d){var _0x342682=typeof _0x3f5dc1[_0x95d2('0x1b')]==='undefined'&&typeof _0x3f5dc1['limit']===_0x95d2('0x1c');var _0x299947=_0x954f4d['count'];var _0x469a3f=_0x342682?0x0:_0x3f5dc1[_0x95d2('0x1b')];var _0x24db7f=_0x342682?_0x954f4d['count']:_0x3f5dc1[_0x95d2('0x1b')]+_0x3f5dc1[_0x95d2('0x1d')];var _0x491a58;if(_0x24db7f>=_0x299947){_0x24db7f=_0x299947;_0x491a58=0xc8;}else{_0x491a58=0xce;}_0x53c16f[_0x95d2('0x19')](_0x491a58);return _0x53c16f[_0x95d2('0x1e')](_0x95d2('0x1f'),_0x469a3f+'-'+_0x24db7f+'/'+_0x299947)['json'](_0x954f4d);}return null;};}function patchUpdates(_0x1bcd8a){return function(_0x5f28fc){try{jsonpatch[_0x95d2('0x20')](_0x5f28fc,_0x1bcd8a,!![]);}catch(_0x379beb){return BPromise[_0x95d2('0x21')](_0x379beb);}return _0x5f28fc[_0x95d2('0x22')]();};}function saveUpdates(_0x19c37e,_0x389f88){return function(_0x43d984){if(_0x43d984){return _0x43d984['update'](_0x19c37e)[_0x95d2('0x23')](function(_0x3223b0){return _0x3223b0;});}return null;};}function removeEntity(_0x2f2003,_0x5ad5a2){return function(_0x361667){if(_0x361667){return _0x361667[_0x95d2('0x24')]()[_0x95d2('0x23')](function(){var _0x1628e2=_0x361667['get']({'plain':!![]});var _0x110e4d=_0x95d2('0x25');return db[_0x95d2('0x26')][_0x95d2('0x24')]({'where':{'type':_0x110e4d,'resourceId':_0x1628e2['id']}})[_0x95d2('0x23')](function(){return _0x361667;});})['then'](function(){_0x2f2003['status'](0xcc)[_0x95d2('0x1a')]();});}};}function handleEntityNotFound(_0x23a8d7,_0x30b203){return function(_0x161946){if(!_0x161946){_0x23a8d7[_0x95d2('0x18')](0x194);}return _0x161946;};}function handleError(_0x486a5a,_0x1261a1){_0x1261a1=_0x1261a1||0x1f4;return function(_0x14b6cf){logger[_0x95d2('0x27')](_0x14b6cf['stack']);if(_0x14b6cf['name']){delete _0x14b6cf['name'];}_0x486a5a[_0x95d2('0x19')](_0x1261a1)[_0x95d2('0x28')](_0x14b6cf);};}exports[_0x95d2('0x29')]=function(_0x1b7d0d,_0x38a321){var _0x167a5b={},_0x95d52e={},_0x4bd3d0={'count':0x0,'rows':[]};var _0x32438a=_[_0x95d2('0x2a')](db[_0x95d2('0x2b')][_0x95d2('0x2c')],function(_0x330185){return{'name':_0x330185[_0x95d2('0x2d')],'type':_0x330185[_0x95d2('0x2e')][_0x95d2('0x2f')]};});_0x95d52e[_0x95d2('0x30')]=_[_0x95d2('0x2a')](_0x32438a,_0x95d2('0x31'));_0x95d52e[_0x95d2('0x32')]=_[_0x95d2('0x33')](_0x1b7d0d['query']);_0x95d52e[_0x95d2('0x34')]=_['intersection'](_0x95d52e[_0x95d2('0x30')],_0x95d52e[_0x95d2('0x32')]);_0x167a5b[_0x95d2('0x35')]=_['intersection'](_0x95d52e[_0x95d2('0x30')],qs['fields'](_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x36')]));_0x167a5b[_0x95d2('0x35')]=_0x167a5b[_0x95d2('0x35')][_0x95d2('0x37')]?_0x167a5b['attributes']:_0x95d52e['model'];if(!_0x1b7d0d[_0x95d2('0x32')]['hasOwnProperty']('nolimit')){_0x167a5b[_0x95d2('0x1d')]=qs[_0x95d2('0x1d')](_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x1d')]);_0x167a5b['offset']=qs[_0x95d2('0x1b')](_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x1b')]);}_0x167a5b[_0x95d2('0x38')]=qs[_0x95d2('0x39')](_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x39')]);_0x167a5b[_0x95d2('0x3a')]=qs[_0x95d2('0x34')](_[_0x95d2('0x3b')](_0x1b7d0d['query'],_0x95d52e['filters']),_0x32438a);if(_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x3c')]){_0x167a5b[_0x95d2('0x3a')]=_[_0x95d2('0x3d')](_0x167a5b['where'],{'$or':_[_0x95d2('0x2a')](_0x32438a,function(_0x3900fd){if(_0x3900fd[_0x95d2('0x2e')]!==_0x95d2('0x3e')){var _0xfbb09b={};_0xfbb09b[_0x3900fd[_0x95d2('0x31')]]={'$like':'%'+_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x3c')]+'%'};return _0xfbb09b;}})});}_0x167a5b=_[_0x95d2('0x3d')]({},_0x167a5b,_0x1b7d0d[_0x95d2('0x3f')]);var _0x2c1f4a={'where':_0x167a5b[_0x95d2('0x3a')]};return db[_0x95d2('0x2b')][_0x95d2('0x40')](_0x2c1f4a)[_0x95d2('0x23')](function(_0x1af320){_0x4bd3d0[_0x95d2('0x40')]=_0x1af320;if(_0x1b7d0d['query'][_0x95d2('0x41')]){_0x167a5b[_0x95d2('0x42')]=[{'all':!![]}];}return db[_0x95d2('0x2b')]['findAll'](_0x167a5b);})[_0x95d2('0x23')](function(_0x43122f){_0x4bd3d0['rows']=_0x43122f;return _0x4bd3d0;})[_0x95d2('0x23')](respondWithFilteredResult(_0x38a321,_0x167a5b))[_0x95d2('0x43')](handleError(_0x38a321,null));};exports[_0x95d2('0x44')]=function(_0x11e468,_0x1637dc){var _0x31627a={'raw':!![],'where':{'id':_0x11e468[_0x95d2('0x45')]['id']}},_0xcc4576={};_0xcc4576[_0x95d2('0x30')]=_[_0x95d2('0x33')](db['Template'][_0x95d2('0x2c')]);_0xcc4576[_0x95d2('0x32')]=_[_0x95d2('0x33')](_0x11e468[_0x95d2('0x32')]);_0xcc4576[_0x95d2('0x34')]=_['intersection'](_0xcc4576[_0x95d2('0x30')],_0xcc4576[_0x95d2('0x32')]);_0x31627a['attributes']=_[_0x95d2('0x46')](_0xcc4576[_0x95d2('0x30')],qs[_0x95d2('0x36')](_0x11e468[_0x95d2('0x32')][_0x95d2('0x36')]));_0x31627a['attributes']=_0x31627a['attributes'][_0x95d2('0x37')]?_0x31627a[_0x95d2('0x35')]:_0xcc4576['model'];if(_0x11e468[_0x95d2('0x32')][_0x95d2('0x41')]){_0x31627a['include']=[{'all':!![]}];}_0x31627a=_[_0x95d2('0x3d')]({},_0x31627a,_0x11e468[_0x95d2('0x3f')]);return db[_0x95d2('0x2b')]['find'](_0x31627a)[_0x95d2('0x23')](handleEntityNotFound(_0x1637dc,null))['then'](respondWithResult(_0x1637dc,null))[_0x95d2('0x43')](handleError(_0x1637dc,null));};exports['create']=function(_0x49a3a4,_0x16bdef){return db[_0x95d2('0x2b')][_0x95d2('0x47')](_0x49a3a4['body'],{})[_0x95d2('0x23')](function(_0x572f65){var _0x1f9098=_0x49a3a4[_0x95d2('0x48')]['get']({'plain':!![]});if(!_0x1f9098)throw new Error(_0x95d2('0x49'));if(_0x1f9098[_0x95d2('0x4a')]===_0x95d2('0x48')){var _0x23c416=_0x572f65[_0x95d2('0x4b')]({'plain':!![]});var _0x4e72d3=_0x95d2('0x25');return db['UserProfileSection'][_0x95d2('0x4c')]({'where':{'name':_0x4e72d3,'userProfileId':_0x1f9098[_0x95d2('0x4d')]},'raw':!![]})[_0x95d2('0x23')](function(_0x431ee6){if(_0x431ee6&&_0x431ee6[_0x95d2('0x4e')]===0x0){return db[_0x95d2('0x26')][_0x95d2('0x47')]({'name':_0x23c416[_0x95d2('0x31')],'resourceId':_0x23c416['id'],'type':_0x431ee6[_0x95d2('0x31')],'sectionId':_0x431ee6['id']},{})['then'](function(){return _0x572f65;});}else{return _0x572f65;}})[_0x95d2('0x43')](function(_0x393d1e){logger['error'](_0x95d2('0x4f'),_0x393d1e);throw _0x393d1e;});}return _0x572f65;})[_0x95d2('0x23')](respondWithResult(_0x16bdef,0xc9))[_0x95d2('0x43')](handleError(_0x16bdef,null));};exports[_0x95d2('0x50')]=function(_0x41f758,_0x5cd336){if(_0x41f758['body']['id']){delete _0x41f758[_0x95d2('0x51')]['id'];}return db['Template']['find']({'where':{'id':_0x41f758[_0x95d2('0x45')]['id']}})[_0x95d2('0x23')](handleEntityNotFound(_0x5cd336,null))['then'](saveUpdates(_0x41f758[_0x95d2('0x51')],null))[_0x95d2('0x23')](respondWithResult(_0x5cd336,null))[_0x95d2('0x43')](handleError(_0x5cd336,null));};exports[_0x95d2('0x24')]=function(_0x37f109,_0x232722){return db[_0x95d2('0x2b')][_0x95d2('0x4c')]({'where':{'id':_0x37f109[_0x95d2('0x45')]['id']}})[_0x95d2('0x23')](handleEntityNotFound(_0x232722,null))[_0x95d2('0x23')](removeEntity(_0x232722,null))['catch'](handleError(_0x232722,null));}; \ No newline at end of file +var _0xf394=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Templates','UserProfileResource','destroy','error','stack','name','send','index','Template','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x3c395e,_0x57638c){var _0x1c966e=function(_0x2180ed){while(--_0x2180ed){_0x3c395e['push'](_0x3c395e['shift']());}};_0x1c966e(++_0x57638c);}(_0xf394,0x180));var _0x4f39=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf394[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x4f39('0x0'));var rimraf=require(_0x4f39('0x1'));var zipdir=require(_0x4f39('0x2'));var jsonpatch=require(_0x4f39('0x3'));var rp=require('request-promise');var moment=require(_0x4f39('0x4'));var BPromise=require(_0x4f39('0x5'));var Mustache=require(_0x4f39('0x6'));var util=require(_0x4f39('0x7'));var path=require(_0x4f39('0x8'));var sox=require(_0x4f39('0x9'));var csv=require('to-csv');var ejs=require(_0x4f39('0xa'));var fs=require('fs');var fs_extra=require(_0x4f39('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f39('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4f39('0xd'));var Papa=require('papaparse');var Redis=require(_0x4f39('0xe'));var authService=require(_0x4f39('0xf'));var qs=require(_0x4f39('0x10'));var as=require(_0x4f39('0x11'));var hardwareService=require(_0x4f39('0x12'));var logger=require(_0x4f39('0x13'))(_0x4f39('0x14'));var utils=require(_0x4f39('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4f39('0x16'));var db=require(_0x4f39('0x17'))['db'];function respondWithStatusCode(_0x3c8383,_0x1d5921){_0x1d5921=_0x1d5921||0xcc;return function(_0x259ef7){if(_0x259ef7){return _0x3c8383[_0x4f39('0x18')](_0x1d5921);}return _0x3c8383[_0x4f39('0x19')](_0x1d5921)[_0x4f39('0x1a')]();};}function respondWithResult(_0x5236f1,_0x58c416){_0x58c416=_0x58c416||0xc8;return function(_0x17a24f){if(_0x17a24f){return _0x5236f1[_0x4f39('0x19')](_0x58c416)[_0x4f39('0x1b')](_0x17a24f);}};}function respondWithFilteredResult(_0x2286fc,_0x13100c){return function(_0x44e3d2){if(_0x44e3d2){var _0x5a4b60=typeof _0x13100c[_0x4f39('0x1c')]===_0x4f39('0x1d')&&typeof _0x13100c[_0x4f39('0x1e')]===_0x4f39('0x1d');var _0x3d48f3=_0x44e3d2[_0x4f39('0x1f')];var _0x475a41=_0x5a4b60?0x0:_0x13100c[_0x4f39('0x1c')];var _0x123c76=_0x5a4b60?_0x44e3d2[_0x4f39('0x1f')]:_0x13100c[_0x4f39('0x1c')]+_0x13100c[_0x4f39('0x1e')];var _0x197262;if(_0x123c76>=_0x3d48f3){_0x123c76=_0x3d48f3;_0x197262=0xc8;}else{_0x197262=0xce;}_0x2286fc[_0x4f39('0x19')](_0x197262);return _0x2286fc[_0x4f39('0x20')](_0x4f39('0x21'),_0x475a41+'-'+_0x123c76+'/'+_0x3d48f3)[_0x4f39('0x1b')](_0x44e3d2);}return null;};}function patchUpdates(_0x308719){return function(_0x211c7a){try{jsonpatch[_0x4f39('0x22')](_0x211c7a,_0x308719,!![]);}catch(_0x359bf4){return BPromise['reject'](_0x359bf4);}return _0x211c7a[_0x4f39('0x23')]();};}function saveUpdates(_0x28bf65,_0xb372e3){return function(_0x358178){if(_0x358178){return _0x358178[_0x4f39('0x24')](_0x28bf65)[_0x4f39('0x25')](function(_0x16fe95){return _0x16fe95;});}return null;};}function removeEntity(_0x28c8f7,_0x1777b9){return function(_0x2874a9){if(_0x2874a9){return _0x2874a9['destroy']()[_0x4f39('0x25')](function(){var _0x58a7fc=_0x2874a9[_0x4f39('0x26')]({'plain':!![]});var _0x441cab=_0x4f39('0x27');return db[_0x4f39('0x28')][_0x4f39('0x29')]({'where':{'type':_0x441cab,'resourceId':_0x58a7fc['id']}})[_0x4f39('0x25')](function(){return _0x2874a9;});})[_0x4f39('0x25')](function(){_0x28c8f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc6d3,_0x50ca0a){return function(_0x1b2a9d){if(!_0x1b2a9d){_0x5cc6d3[_0x4f39('0x18')](0x194);}return _0x1b2a9d;};}function handleError(_0x29ecd1,_0x4cf47e){_0x4cf47e=_0x4cf47e||0x1f4;return function(_0x3652ea){logger[_0x4f39('0x2a')](_0x3652ea[_0x4f39('0x2b')]);if(_0x3652ea[_0x4f39('0x2c')]){delete _0x3652ea['name'];}_0x29ecd1['status'](_0x4cf47e)[_0x4f39('0x2d')](_0x3652ea);};}exports[_0x4f39('0x2e')]=function(_0x388f75,_0x1dfcfe){var _0x56dc77={},_0x4900b7={},_0x3d412c={'count':0x0,'rows':[]};var _0x3b1a53=_['map'](db[_0x4f39('0x2f')][_0x4f39('0x30')],function(_0x1220b9){return{'name':_0x1220b9['fieldName'],'type':_0x1220b9[_0x4f39('0x31')][_0x4f39('0x32')]};});_0x4900b7[_0x4f39('0x33')]=_[_0x4f39('0x34')](_0x3b1a53,'name');_0x4900b7[_0x4f39('0x35')]=_[_0x4f39('0x36')](_0x388f75[_0x4f39('0x35')]);_0x4900b7[_0x4f39('0x37')]=_[_0x4f39('0x38')](_0x4900b7[_0x4f39('0x33')],_0x4900b7[_0x4f39('0x35')]);_0x56dc77[_0x4f39('0x39')]=_['intersection'](_0x4900b7[_0x4f39('0x33')],qs[_0x4f39('0x3a')](_0x388f75[_0x4f39('0x35')][_0x4f39('0x3a')]));_0x56dc77[_0x4f39('0x39')]=_0x56dc77[_0x4f39('0x39')][_0x4f39('0x3b')]?_0x56dc77[_0x4f39('0x39')]:_0x4900b7['model'];if(!_0x388f75[_0x4f39('0x35')]['hasOwnProperty']('nolimit')){_0x56dc77[_0x4f39('0x1e')]=qs[_0x4f39('0x1e')](_0x388f75[_0x4f39('0x35')][_0x4f39('0x1e')]);_0x56dc77[_0x4f39('0x1c')]=qs[_0x4f39('0x1c')](_0x388f75[_0x4f39('0x35')][_0x4f39('0x1c')]);}_0x56dc77['order']=qs[_0x4f39('0x3c')](_0x388f75['query'][_0x4f39('0x3c')]);_0x56dc77[_0x4f39('0x3d')]=qs[_0x4f39('0x37')](_['pick'](_0x388f75[_0x4f39('0x35')],_0x4900b7[_0x4f39('0x37')]),_0x3b1a53);if(_0x388f75[_0x4f39('0x35')][_0x4f39('0x3e')]){_0x56dc77[_0x4f39('0x3d')]=_['merge'](_0x56dc77[_0x4f39('0x3d')],{'$or':_[_0x4f39('0x34')](_0x3b1a53,function(_0xbcb0b9){if(_0xbcb0b9[_0x4f39('0x31')]!==_0x4f39('0x3f')){var _0x2ba22e={};_0x2ba22e[_0xbcb0b9['name']]={'$like':'%'+_0x388f75[_0x4f39('0x35')][_0x4f39('0x3e')]+'%'};return _0x2ba22e;}})});}_0x56dc77=_[_0x4f39('0x40')]({},_0x56dc77,_0x388f75[_0x4f39('0x41')]);var _0x235a26={'where':_0x56dc77[_0x4f39('0x3d')]};return db[_0x4f39('0x2f')][_0x4f39('0x1f')](_0x235a26)[_0x4f39('0x25')](function(_0x5333a8){_0x3d412c[_0x4f39('0x1f')]=_0x5333a8;if(_0x388f75[_0x4f39('0x35')][_0x4f39('0x42')]){_0x56dc77[_0x4f39('0x43')]=[{'all':!![]}];}return db[_0x4f39('0x2f')][_0x4f39('0x44')](_0x56dc77);})['then'](function(_0x130d5d){_0x3d412c['rows']=_0x130d5d;return _0x3d412c;})[_0x4f39('0x25')](respondWithFilteredResult(_0x1dfcfe,_0x56dc77))['catch'](handleError(_0x1dfcfe,null));};exports[_0x4f39('0x45')]=function(_0x272ef2,_0x5ddb1f){var _0x10956c={'raw':!![],'where':{'id':_0x272ef2[_0x4f39('0x46')]['id']}},_0x52b1a5={};_0x52b1a5[_0x4f39('0x33')]=_[_0x4f39('0x36')](db[_0x4f39('0x2f')][_0x4f39('0x30')]);_0x52b1a5[_0x4f39('0x35')]=_[_0x4f39('0x36')](_0x272ef2[_0x4f39('0x35')]);_0x52b1a5[_0x4f39('0x37')]=_['intersection'](_0x52b1a5[_0x4f39('0x33')],_0x52b1a5['query']);_0x10956c[_0x4f39('0x39')]=_[_0x4f39('0x38')](_0x52b1a5[_0x4f39('0x33')],qs[_0x4f39('0x3a')](_0x272ef2[_0x4f39('0x35')][_0x4f39('0x3a')]));_0x10956c['attributes']=_0x10956c[_0x4f39('0x39')][_0x4f39('0x3b')]?_0x10956c[_0x4f39('0x39')]:_0x52b1a5['model'];if(_0x272ef2[_0x4f39('0x35')]['includeAll']){_0x10956c[_0x4f39('0x43')]=[{'all':!![]}];}_0x10956c=_[_0x4f39('0x40')]({},_0x10956c,_0x272ef2[_0x4f39('0x41')]);return db[_0x4f39('0x2f')][_0x4f39('0x47')](_0x10956c)[_0x4f39('0x25')](handleEntityNotFound(_0x5ddb1f,null))[_0x4f39('0x25')](respondWithResult(_0x5ddb1f,null))[_0x4f39('0x48')](handleError(_0x5ddb1f,null));};exports['create']=function(_0x4897cc,_0x5800aa){return db[_0x4f39('0x2f')][_0x4f39('0x49')](_0x4897cc[_0x4f39('0x4a')],{})[_0x4f39('0x25')](function(_0x506de9){var _0x1a464e=_0x4897cc[_0x4f39('0x4b')][_0x4f39('0x26')]({'plain':!![]});if(!_0x1a464e)throw new Error(_0x4f39('0x4c'));if(_0x1a464e[_0x4f39('0x4d')]===_0x4f39('0x4b')){var _0x1fd74a=_0x506de9['get']({'plain':!![]});var _0x4747b3='Templates';return db[_0x4f39('0x4e')][_0x4f39('0x47')]({'where':{'name':_0x4747b3,'userProfileId':_0x1a464e['userProfileId']},'raw':!![]})[_0x4f39('0x25')](function(_0x55ea61){if(_0x55ea61&&_0x55ea61[_0x4f39('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1fd74a[_0x4f39('0x2c')],'resourceId':_0x1fd74a['id'],'type':_0x55ea61[_0x4f39('0x2c')],'sectionId':_0x55ea61['id']},{})[_0x4f39('0x25')](function(){return _0x506de9;});}else{return _0x506de9;}})[_0x4f39('0x48')](function(_0x16615b){logger[_0x4f39('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16615b);throw _0x16615b;});}return _0x506de9;})['then'](respondWithResult(_0x5800aa,0xc9))[_0x4f39('0x48')](handleError(_0x5800aa,null));};exports[_0x4f39('0x24')]=function(_0x34936f,_0x21f5f7){if(_0x34936f[_0x4f39('0x4a')]['id']){delete _0x34936f[_0x4f39('0x4a')]['id'];}return db[_0x4f39('0x2f')]['find']({'where':{'id':_0x34936f['params']['id']}})['then'](handleEntityNotFound(_0x21f5f7,null))[_0x4f39('0x25')](saveUpdates(_0x34936f['body'],null))[_0x4f39('0x25')](respondWithResult(_0x21f5f7,null))[_0x4f39('0x48')](handleError(_0x21f5f7,null));};exports[_0x4f39('0x29')]=function(_0x5c909b,_0x4e3672){return db['Template']['find']({'where':{'id':_0x5c909b['params']['id']}})[_0x4f39('0x25')](handleEntityNotFound(_0x4e3672,null))[_0x4f39('0x25')](removeEntity(_0x4e3672,null))['catch'](handleError(_0x4e3672,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index eb9fd49..aec485b 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 _0x74d4=['./template.attributes','exports','define','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2a5406,_0x3087ea){var _0x309791=function(_0x4fba8c){while(--_0x4fba8c){_0x2a5406['push'](_0x2a5406['shift']());}};_0x309791(++_0x3087ea);}(_0x74d4,0x116));var _0x474d=function(_0x4fb4be,_0x1dc24d){_0x4fb4be=_0x4fb4be-0x0;var _0x9eaa4e=_0x74d4[_0x4fb4be];return _0x9eaa4e;};'use strict';var _=require(_0x474d('0x0'));var util=require('util');var logger=require(_0x474d('0x1'))(_0x474d('0x2'));var moment=require(_0x474d('0x3'));var BPromise=require(_0x474d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x474d('0x5'));var rimraf=require(_0x474d('0x6'));var config=require(_0x474d('0x7'));var attributes=require(_0x474d('0x8'));module[_0x474d('0x9')]=function(_0x345f34,_0x2518d3){return _0x345f34[_0x474d('0xa')](_0x474d('0xb'),attributes,{'tableName':_0x474d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15e3=['define','tools_templates','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./template.attributes','exports'];(function(_0x1fd4b4,_0x380617){var _0x2c4425=function(_0x33ad78){while(--_0x33ad78){_0x1fd4b4['push'](_0x1fd4b4['shift']());}};_0x2c4425(++_0x380617);}(_0x15e3,0x1e2));var _0x315e=function(_0x240297,_0x3ee590){_0x240297=_0x240297-0x0;var _0x359060=_0x15e3[_0x240297];return _0x359060;};'use strict';var _=require(_0x315e('0x0'));var util=require(_0x315e('0x1'));var logger=require(_0x315e('0x2'))(_0x315e('0x3'));var moment=require('moment');var BPromise=require(_0x315e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x315e('0x5'));var rimraf=require(_0x315e('0x6'));var config=require(_0x315e('0x7'));var attributes=require(_0x315e('0x8'));module[_0x315e('0x9')]=function(_0xab3995,_0x20ebf0){return _0xab3995[_0x315e('0xa')]('Template',attributes,{'tableName':_0x315e('0xb'),'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 dab04dd..5b8dbe4 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 _0xeae4=['code','message','info','catch','GetTemplate','Template','findAll','options','raw','where','limit','map','include','model','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x276acd,_0x5bae4d){var _0x512e58=function(_0x2576a7){while(--_0x2576a7){_0x276acd['push'](_0x276acd['shift']());}};_0x512e58(++_0x5bae4d);}(_0xeae4,0x13b));var _0x4eae=function(_0xc7f92d,_0x147594){_0xc7f92d=_0xc7f92d-0x0;var _0x1e03b0=_0xeae4[_0xc7f92d];return _0x1e03b0;};'use strict';var _=require('lodash');var util=require(_0x4eae('0x0'));var moment=require(_0x4eae('0x1'));var BPromise=require(_0x4eae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4eae('0x3'));var db=require(_0x4eae('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4eae('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4eae('0x6')][_0x4eae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a9eb2,_0x18f5f0,_0x573b43){return new BPromise(function(_0x488f8d,_0x34e2cb){return client['request'](_0x2a9eb2,_0x573b43)[_0x4eae('0x8')](function(_0x3fe84a){logger['info'](_0x4eae('0x9'),_0x18f5f0,_0x4eae('0xa'));logger[_0x4eae('0xb')](_0x4eae('0xc'),_0x18f5f0,_0x4eae('0xa'),JSON[_0x4eae('0xd')](_0x3fe84a));if(_0x3fe84a[_0x4eae('0xe')]){if(_0x3fe84a[_0x4eae('0xe')][_0x4eae('0xf')]===0x1f4){logger[_0x4eae('0xe')](_0x4eae('0x9'),_0x18f5f0,_0x3fe84a['error']['message']);return _0x34e2cb(_0x3fe84a[_0x4eae('0xe')][_0x4eae('0x10')]);}logger[_0x4eae('0xe')](_0x4eae('0x9'),_0x18f5f0,_0x3fe84a[_0x4eae('0xe')]['message']);return _0x488f8d(_0x3fe84a['error'][_0x4eae('0x10')]);}else{logger[_0x4eae('0x11')](_0x4eae('0x9'),_0x18f5f0,'request\x20sent');_0x488f8d(_0x3fe84a['result'][_0x4eae('0x10')]);}})[_0x4eae('0x12')](function(_0x19ad93){logger['error'](_0x4eae('0x9'),_0x18f5f0,_0x19ad93);_0x34e2cb(_0x19ad93);});});}exports[_0x4eae('0x13')]=function(_0x163be7){var _0x15d7b7=this;return new Promise(function(_0xf8a600,_0x462209){return db[_0x4eae('0x14')][_0x4eae('0x15')]({'raw':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')][_0x4eae('0x17')]===undefined?!![]:![]:!![],'where':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')][_0x4eae('0x18')]||null:null,'attributes':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')]['attributes']||null:null,'limit':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')][_0x4eae('0x19')]||null:null,'include':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')]['include']?_[_0x4eae('0x1a')](_0x163be7[_0x4eae('0x16')][_0x4eae('0x1b')],function(_0x3590bc){return{'model':db[_0x3590bc[_0x4eae('0x1c')]],'as':_0x3590bc['as'],'attributes':_0x3590bc['attributes'],'include':_0x3590bc['include']?_[_0x4eae('0x1a')](_0x3590bc['include'],function(_0x55a698){return{'model':db[_0x55a698['model']],'as':_0x55a698['as'],'attributes':_0x55a698[_0x4eae('0x1d')],'include':_0x55a698[_0x4eae('0x1b')]?_['map'](_0x55a698['include'],function(_0x230d7f){return{'model':db[_0x230d7f[_0x4eae('0x1c')]],'as':_0x230d7f['as'],'attributes':_0x230d7f[_0x4eae('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x252004){logger[_0x4eae('0x11')]('GetTemplate',_0x163be7);logger[_0x4eae('0xb')]('GetTemplate',_0x163be7,JSON['stringify'](_0x252004));_0xf8a600(_0x252004);})[_0x4eae('0x12')](function(_0x173e97){logger[_0x4eae('0xe')]('GetTemplate',_0x173e97[_0x4eae('0x10')],_0x163be7);_0x462209(_0x15d7b7[_0x4eae('0xe')](0x1f4,_0x173e97[_0x4eae('0x10')]));});});}; \ No newline at end of file +var _0x988c=['client','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','Template','findAll','raw','options','where','attributes','include','map','model','lodash','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x551b29,_0x41c813){var _0x8af06a=function(_0x133e8f){while(--_0x133e8f){_0x551b29['push'](_0x551b29['shift']());}};_0x8af06a(++_0x41c813);}(_0x988c,0x19e));var _0xc988=function(_0x3527bc,_0x26c047){_0x3527bc=_0x3527bc-0x0;var _0x3f4de0=_0x988c[_0x3527bc];return _0x3f4de0;};'use strict';var _=require(_0xc988('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc988('0x1'));var fs=require('fs');var Redis=require(_0xc988('0x2'));var db=require(_0xc988('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc988('0x4'));var jayson=require(_0xc988('0x5'));var client=jayson[_0xc988('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e109,_0x14b586,_0x4e6f38){return new BPromise(function(_0x4e48db,_0x2a96ab){return client[_0xc988('0x7')](_0x26e109,_0x4e6f38)[_0xc988('0x8')](function(_0x271d0f){logger[_0xc988('0x9')]('Template,\x20%s,\x20%s',_0x14b586,_0xc988('0xa'));logger[_0xc988('0xb')](_0xc988('0xc'),_0x14b586,_0xc988('0xa'),JSON[_0xc988('0xd')](_0x271d0f));if(_0x271d0f['error']){if(_0x271d0f[_0xc988('0xe')][_0xc988('0xf')]===0x1f4){logger[_0xc988('0xe')]('Template,\x20%s,\x20%s',_0x14b586,_0x271d0f[_0xc988('0xe')]['message']);return _0x2a96ab(_0x271d0f[_0xc988('0xe')]['message']);}logger[_0xc988('0xe')](_0xc988('0x10'),_0x14b586,_0x271d0f[_0xc988('0xe')][_0xc988('0x11')]);return _0x4e48db(_0x271d0f['error'][_0xc988('0x11')]);}else{logger[_0xc988('0x9')](_0xc988('0x10'),_0x14b586,_0xc988('0xa'));_0x4e48db(_0x271d0f[_0xc988('0x12')][_0xc988('0x11')]);}})[_0xc988('0x13')](function(_0x35aebb){logger[_0xc988('0xe')](_0xc988('0x10'),_0x14b586,_0x35aebb);_0x2a96ab(_0x35aebb);});});}exports[_0xc988('0x14')]=function(_0x49738a){var _0x314a24=this;return new Promise(function(_0x23677f,_0x32319c){return db[_0xc988('0x15')][_0xc988('0x16')]({'raw':_0x49738a['options']?_0x49738a['options'][_0xc988('0x17')]===undefined?!![]:![]:!![],'where':_0x49738a['options']?_0x49738a[_0xc988('0x18')][_0xc988('0x19')]||null:null,'attributes':_0x49738a['options']?_0x49738a['options'][_0xc988('0x1a')]||null:null,'limit':_0x49738a[_0xc988('0x18')]?_0x49738a[_0xc988('0x18')]['limit']||null:null,'include':_0x49738a[_0xc988('0x18')]?_0x49738a[_0xc988('0x18')][_0xc988('0x1b')]?_['map'](_0x49738a[_0xc988('0x18')][_0xc988('0x1b')],function(_0x188685){return{'model':db[_0x188685['model']],'as':_0x188685['as'],'attributes':_0x188685['attributes'],'include':_0x188685[_0xc988('0x1b')]?_[_0xc988('0x1c')](_0x188685[_0xc988('0x1b')],function(_0x2e8351){return{'model':db[_0x2e8351[_0xc988('0x1d')]],'as':_0x2e8351['as'],'attributes':_0x2e8351[_0xc988('0x1a')],'include':_0x2e8351[_0xc988('0x1b')]?_[_0xc988('0x1c')](_0x2e8351['include'],function(_0x4098da){return{'model':db[_0x4098da[_0xc988('0x1d')]],'as':_0x4098da['as'],'attributes':_0x4098da[_0xc988('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc988('0x8')](function(_0x38bcee){logger[_0xc988('0x9')](_0xc988('0x14'),_0x49738a);logger[_0xc988('0xb')]('GetTemplate',_0x49738a,JSON[_0xc988('0xd')](_0x38bcee));_0x23677f(_0x38bcee);})[_0xc988('0x13')](function(_0x31a42b){logger[_0xc988('0xe')]('GetTemplate',_0x31a42b['message'],_0x49738a);_0x32319c(_0x314a24[_0xc988('0xe')](0x1f4,_0x31a42b[_0xc988('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index aa8ea1d..ab5c755 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 _0xaf90=['post','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','/:id','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','isAuthenticated','show','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf90,0x1e3));var _0x0af9=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xaf90[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0af9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0af9('0x1'));var express=require(_0x0af9('0x2'));var router=express[_0x0af9('0x3')]();var fs_extra=require(_0x0af9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0af9('0x5'));var config=require(_0x0af9('0x6'));var controller=require(_0x0af9('0x7'));router[_0x0af9('0x8')]('/',auth['isAuthenticated'](),controller[_0x0af9('0x9')]);router[_0x0af9('0x8')]('/:id',auth[_0x0af9('0xa')](),controller[_0x0af9('0xb')]);router[_0x0af9('0x8')](_0x0af9('0xc'),auth[_0x0af9('0xa')](),controller['getAllConditions']);router[_0x0af9('0x8')]('/:id/any_conditions',auth[_0x0af9('0xa')](),controller[_0x0af9('0xd')]);router[_0x0af9('0x8')](_0x0af9('0xe'),auth['isAuthenticated'](),controller[_0x0af9('0xf')]);router['post']('/',auth[_0x0af9('0xa')](),controller[_0x0af9('0x10')]);router[_0x0af9('0x11')](_0x0af9('0xc'),auth['isAuthenticated'](),controller[_0x0af9('0x12')]);router[_0x0af9('0x11')](_0x0af9('0x13'),auth[_0x0af9('0xa')](),controller[_0x0af9('0x14')]);router[_0x0af9('0x11')](_0x0af9('0xe'),auth[_0x0af9('0xa')](),controller[_0x0af9('0x15')]);router['put'](_0x0af9('0x16'),auth['isAuthenticated'](),controller[_0x0af9('0x17')]);router['delete'](_0x0af9('0x16'),auth[_0x0af9('0xa')](),controller['destroy']);module[_0x0af9('0x18')]=router; \ No newline at end of file +var _0x59d8=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAction','put','delete'];(function(_0xf48e32,_0x5193b1){var _0x65b3a4=function(_0x1db8ab){while(--_0x1db8ab){_0xf48e32['push'](_0xf48e32['shift']());}};_0x65b3a4(++_0x5193b1);}(_0x59d8,0x95));var _0x859d=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x59d8[_0x2d61ac];return _0x3f7d3c;};'use strict';var multer=require(_0x859d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x859d('0x1'));var express=require(_0x859d('0x2'));var router=express[_0x859d('0x3')]();var fs_extra=require(_0x859d('0x4'));var auth=require(_0x859d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x859d('0x6')]('/',auth[_0x859d('0x7')](),controller[_0x859d('0x8')]);router[_0x859d('0x6')](_0x859d('0x9'),auth[_0x859d('0x7')](),controller[_0x859d('0xa')]);router['get']('/:id/all_conditions',auth[_0x859d('0x7')](),controller['getAllConditions']);router['get'](_0x859d('0xb'),auth['isAuthenticated'](),controller[_0x859d('0xc')]);router[_0x859d('0x6')](_0x859d('0xd'),auth['isAuthenticated'](),controller['getActions']);router[_0x859d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x859d('0xe')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x859d('0xf')]);router[_0x859d('0xe')]('/:id/any_conditions',auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x859d('0xe')](_0x859d('0xd'),auth[_0x859d('0x7')](),controller[_0x859d('0x10')]);router[_0x859d('0x11')](_0x859d('0x9'),auth[_0x859d('0x7')](),controller['update']);router[_0x859d('0x12')](_0x859d('0x9'),auth[_0x859d('0x7')](),controller[_0x859d('0x13')]);module[_0x859d('0x14')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 62613c3..c7bf273 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 _0xdb8b=['STRING','BOOLEAN','exports'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0xdb8b,0x1d6));var _0xbdb8=function(_0x41eb8b,_0x396d7a){_0x41eb8b=_0x41eb8b-0x0;var _0x249ad1=_0xdb8b[_0x41eb8b];return _0x249ad1;};'use strict';var Sequelize=require('sequelize');module[_0xbdb8('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbdb8('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xbdb8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x84f7=['sequelize','STRING'];(function(_0x4d438d,_0x26dc9b){var _0x1bbeef=function(_0xba59e8){while(--_0xba59e8){_0x4d438d['push'](_0x4d438d['shift']());}};_0x1bbeef(++_0x26dc9b);}(_0x84f7,0x1e0));var _0x784f=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0x84f7[_0x2e2681];return _0x368a64;};'use strict';var Sequelize=require(_0x784f('0x0'));module['exports']={'name':{'type':Sequelize[_0x784f('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x784f('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index a5def1c..fbc72cc 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 _0xf61a=['lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','error','stack','name','send','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','pick','getAnyConditions','findOne','hasOwnProperty','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xf61a,0xb0));var _0xaf61=function(_0x18746a,_0x3ff3bf){_0x18746a=_0x18746a-0x0;var _0x1b851d=_0xf61a[_0x18746a];return _0x1b851d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf61('0x0'));var zipdir=require(_0xaf61('0x1'));var jsonpatch=require(_0xaf61('0x2'));var rp=require(_0xaf61('0x3'));var moment=require(_0xaf61('0x4'));var BPromise=require(_0xaf61('0x5'));var Mustache=require(_0xaf61('0x6'));var util=require(_0xaf61('0x7'));var path=require(_0xaf61('0x8'));var sox=require('sox');var csv=require(_0xaf61('0x9'));var ejs=require(_0xaf61('0xa'));var fs=require('fs');var fs_extra=require(_0xaf61('0xb'));var _=require(_0xaf61('0xc'));var squel=require(_0xaf61('0xd'));var crypto=require(_0xaf61('0xe'));var jsforce=require(_0xaf61('0xf'));var deskjs=require(_0xaf61('0x10'));var toCsv=require(_0xaf61('0x9'));var querystring=require('querystring');var Papa=require(_0xaf61('0x11'));var Redis=require('ioredis');var authService=require(_0xaf61('0x12'));var qs=require(_0xaf61('0x13'));var as=require(_0xaf61('0x14'));var hardwareService=require(_0xaf61('0x15'));var logger=require(_0xaf61('0x16'))('api');var utils=require(_0xaf61('0x17'));var config=require(_0xaf61('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf61('0x19'))['db'];function respondWithStatusCode(_0x59c569,_0x823e2d){_0x823e2d=_0x823e2d||0xcc;return function(_0x33c590){if(_0x33c590){return _0x59c569[_0xaf61('0x1a')](_0x823e2d);}return _0x59c569['status'](_0x823e2d)[_0xaf61('0x1b')]();};}function respondWithResult(_0x5baac4,_0x55557e){_0x55557e=_0x55557e||0xc8;return function(_0x2c65f6){if(_0x2c65f6){return _0x5baac4[_0xaf61('0x1c')](_0x55557e)[_0xaf61('0x1d')](_0x2c65f6);}};}function respondWithFilteredResult(_0x569a6b,_0x92fb45){return function(_0x47b2a1){if(_0x47b2a1){var _0x42ba29=typeof _0x92fb45['offset']===_0xaf61('0x1e')&&typeof _0x92fb45[_0xaf61('0x1f')]===_0xaf61('0x1e');var _0x724655=_0x47b2a1[_0xaf61('0x20')];var _0x41f004=_0x42ba29?0x0:_0x92fb45['offset'];var _0x340ed1=_0x42ba29?_0x47b2a1[_0xaf61('0x20')]:_0x92fb45[_0xaf61('0x21')]+_0x92fb45[_0xaf61('0x1f')];var _0x310ee6;if(_0x340ed1>=_0x724655){_0x340ed1=_0x724655;_0x310ee6=0xc8;}else{_0x310ee6=0xce;}_0x569a6b[_0xaf61('0x1c')](_0x310ee6);return _0x569a6b[_0xaf61('0x22')]('Content-Range',_0x41f004+'-'+_0x340ed1+'/'+_0x724655)[_0xaf61('0x1d')](_0x47b2a1);}return null;};}function patchUpdates(_0xcc38a){return function(_0x27d05b){try{jsonpatch[_0xaf61('0x23')](_0x27d05b,_0xcc38a,!![]);}catch(_0x14a6c6){return BPromise[_0xaf61('0x24')](_0x14a6c6);}return _0x27d05b[_0xaf61('0x25')]();};}function saveUpdates(_0x2e19dd,_0x29af46){return function(_0x403b0d){if(_0x403b0d){return _0x403b0d[_0xaf61('0x26')](_0x2e19dd)[_0xaf61('0x27')](function(_0x3ddc8e){return _0x3ddc8e;});}return null;};}function removeEntity(_0x27c47c,_0x26af0d){return function(_0x811a81){if(_0x811a81){return _0x811a81[_0xaf61('0x28')]()[_0xaf61('0x27')](function(){var _0x5ba0a2=_0x811a81['get']({'plain':!![]});var _0x155e56=_0xaf61('0x29');return db[_0xaf61('0x2a')][_0xaf61('0x28')]({'where':{'type':_0x155e56,'resourceId':_0x5ba0a2['id']}})[_0xaf61('0x27')](function(){return _0x811a81;});})[_0xaf61('0x27')](function(){_0x27c47c[_0xaf61('0x1c')](0xcc)[_0xaf61('0x1b')]();});}};}function handleEntityNotFound(_0x2f3efb,_0x399683){return function(_0x2d7af1){if(!_0x2d7af1){_0x2f3efb[_0xaf61('0x1a')](0x194);}return _0x2d7af1;};}function handleError(_0x279a72,_0xbb7c19){_0xbb7c19=_0xbb7c19||0x1f4;return function(_0x213693){logger[_0xaf61('0x2b')](_0x213693[_0xaf61('0x2c')]);if(_0x213693[_0xaf61('0x2d')]){delete _0x213693[_0xaf61('0x2d')];}_0x279a72[_0xaf61('0x1c')](_0xbb7c19)[_0xaf61('0x2e')](_0x213693);};}exports['index']=function(_0x5c8125,_0x2ee117){var _0x59c62f={},_0x19aee4={},_0x3ce220={'count':0x0,'rows':[]};var _0x3b29be=_[_0xaf61('0x2f')](db[_0xaf61('0x30')][_0xaf61('0x31')],function(_0x3bb0ec){return{'name':_0x3bb0ec[_0xaf61('0x32')],'type':_0x3bb0ec[_0xaf61('0x33')]['key']};});_0x19aee4[_0xaf61('0x34')]=_['map'](_0x3b29be,'name');_0x19aee4[_0xaf61('0x35')]=_[_0xaf61('0x36')](_0x5c8125[_0xaf61('0x35')]);_0x19aee4[_0xaf61('0x37')]=_[_0xaf61('0x38')](_0x19aee4[_0xaf61('0x34')],_0x19aee4[_0xaf61('0x35')]);_0x59c62f[_0xaf61('0x39')]=_[_0xaf61('0x38')](_0x19aee4[_0xaf61('0x34')],qs[_0xaf61('0x3a')](_0x5c8125[_0xaf61('0x35')][_0xaf61('0x3a')]));_0x59c62f['attributes']=_0x59c62f[_0xaf61('0x39')][_0xaf61('0x3b')]?_0x59c62f[_0xaf61('0x39')]:_0x19aee4[_0xaf61('0x34')];if(!_0x5c8125[_0xaf61('0x35')]['hasOwnProperty'](_0xaf61('0x3c'))){_0x59c62f[_0xaf61('0x1f')]=qs[_0xaf61('0x1f')](_0x5c8125[_0xaf61('0x35')]['limit']);_0x59c62f[_0xaf61('0x21')]=qs['offset'](_0x5c8125[_0xaf61('0x35')][_0xaf61('0x21')]);}_0x59c62f[_0xaf61('0x3d')]=qs[_0xaf61('0x3e')](_0x5c8125['query'][_0xaf61('0x3e')]);_0x59c62f[_0xaf61('0x3f')]=qs['filters'](_['pick'](_0x5c8125[_0xaf61('0x35')],_0x19aee4[_0xaf61('0x37')]),_0x3b29be);if(_0x5c8125[_0xaf61('0x35')][_0xaf61('0x40')]){_0x59c62f['where']=_[_0xaf61('0x41')](_0x59c62f[_0xaf61('0x3f')],{'$or':_[_0xaf61('0x2f')](_0x3b29be,function(_0x3f1dbf){if(_0x3f1dbf[_0xaf61('0x33')]!=='VIRTUAL'){var _0x9e7f2d={};_0x9e7f2d[_0x3f1dbf['name']]={'$like':'%'+_0x5c8125[_0xaf61('0x35')]['filter']+'%'};return _0x9e7f2d;}})});}_0x59c62f=_[_0xaf61('0x41')]({},_0x59c62f,_0x5c8125['options']);var _0x237f2b={'where':_0x59c62f[_0xaf61('0x3f')]};return db[_0xaf61('0x30')][_0xaf61('0x20')](_0x237f2b)[_0xaf61('0x27')](function(_0x331851){_0x3ce220[_0xaf61('0x20')]=_0x331851;if(_0x5c8125[_0xaf61('0x35')][_0xaf61('0x42')]){_0x59c62f[_0xaf61('0x43')]=[{'all':!![]}];}return db[_0xaf61('0x30')][_0xaf61('0x44')](_0x59c62f);})[_0xaf61('0x27')](function(_0xb345ae){_0x3ce220['rows']=_0xb345ae;return _0x3ce220;})[_0xaf61('0x27')](respondWithFilteredResult(_0x2ee117,_0x59c62f))['catch'](handleError(_0x2ee117,null));};exports['show']=function(_0x2fc56a,_0x171ddf){var _0x5308e9={'raw':![],'where':{'id':_0x2fc56a['params']['id']}},_0x39a04c={};_0x39a04c[_0xaf61('0x34')]=_[_0xaf61('0x36')](db[_0xaf61('0x30')][_0xaf61('0x31')]);_0x39a04c[_0xaf61('0x35')]=_[_0xaf61('0x36')](_0x2fc56a['query']);_0x39a04c[_0xaf61('0x37')]=_['intersection'](_0x39a04c['model'],_0x39a04c[_0xaf61('0x35')]);_0x5308e9[_0xaf61('0x39')]=_[_0xaf61('0x38')](_0x39a04c['model'],qs[_0xaf61('0x3a')](_0x2fc56a[_0xaf61('0x35')][_0xaf61('0x3a')]));_0x5308e9[_0xaf61('0x39')]=_0x5308e9[_0xaf61('0x39')][_0xaf61('0x3b')]?_0x5308e9['attributes']:_0x39a04c[_0xaf61('0x34')];if(_0x2fc56a[_0xaf61('0x35')][_0xaf61('0x42')]){_0x5308e9[_0xaf61('0x43')]=[{'all':!![]}];}_0x5308e9=_[_0xaf61('0x41')]({},_0x5308e9,_0x2fc56a[_0xaf61('0x45')]);return db['Trigger'][_0xaf61('0x46')](_0x5308e9)[_0xaf61('0x27')](handleEntityNotFound(_0x171ddf,null))[_0xaf61('0x27')](respondWithResult(_0x171ddf,null))[_0xaf61('0x47')](handleError(_0x171ddf,null));};exports[_0xaf61('0x48')]=function(_0x375bb5,_0x15d0b1){return db['Trigger'][_0xaf61('0x48')](_0x375bb5[_0xaf61('0x49')],{})['then'](function(_0x53b1d1){var _0x43860c=_0x375bb5['user'][_0xaf61('0x4a')]({'plain':!![]});if(!_0x43860c)throw new Error(_0xaf61('0x4b'));if(_0x43860c[_0xaf61('0x4c')]===_0xaf61('0x4d')){var _0x3566b3=_0x53b1d1['get']({'plain':!![]});var _0x2abfa2=_0xaf61('0x29');return db[_0xaf61('0x4e')]['find']({'where':{'name':_0x2abfa2,'userProfileId':_0x43860c[_0xaf61('0x4f')]},'raw':!![]})[_0xaf61('0x27')](function(_0x220db6){if(_0x220db6&&_0x220db6[_0xaf61('0x50')]===0x0){return db[_0xaf61('0x2a')][_0xaf61('0x48')]({'name':_0x3566b3[_0xaf61('0x2d')],'resourceId':_0x3566b3['id'],'type':_0x220db6[_0xaf61('0x2d')],'sectionId':_0x220db6['id']},{})['then'](function(){return _0x53b1d1;});}else{return _0x53b1d1;}})['catch'](function(_0x13036f){logger[_0xaf61('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13036f);throw _0x13036f;});}return _0x53b1d1;})[_0xaf61('0x27')](respondWithResult(_0x15d0b1,0xc9))['catch'](handleError(_0x15d0b1,null));};exports[_0xaf61('0x26')]=function(_0x545799,_0x24b78){if(_0x545799[_0xaf61('0x49')]['id']){delete _0x545799['body']['id'];}return db[_0xaf61('0x30')][_0xaf61('0x46')]({'where':{'id':_0x545799['params']['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x24b78,null))['then'](saveUpdates(_0x545799['body'],null))[_0xaf61('0x27')](respondWithResult(_0x24b78,null))['catch'](handleError(_0x24b78,null));};exports[_0xaf61('0x28')]=function(_0x249d94,_0x4524a4){return db[_0xaf61('0x30')][_0xaf61('0x46')]({'where':{'id':_0x249d94[_0xaf61('0x51')]['id']}})['then'](handleEntityNotFound(_0x4524a4,null))[_0xaf61('0x27')](removeEntity(_0x4524a4,null))[_0xaf61('0x47')](handleError(_0x4524a4,null));};exports['addAllCondition']=function(_0x599e5f,_0x2caa7e,_0x1621de){if(_0x599e5f[_0xaf61('0x49')]['id']){delete _0x599e5f[_0xaf61('0x49')]['id'];}return db[_0xaf61('0x30')][_0xaf61('0x46')]({'where':{'id':_0x599e5f[_0xaf61('0x51')]['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x2caa7e,null))['then'](function(_0x22781d){if(_0x22781d){_0x599e5f[_0xaf61('0x49')][_0xaf61('0x52')]=_0x22781d['id'];return db[_0xaf61('0x53')][_0xaf61('0x48')](_0x599e5f[_0xaf61('0x49')]);}})[_0xaf61('0x27')](respondWithResult(_0x2caa7e,null))['catch'](handleError(_0x2caa7e,null));};exports[_0xaf61('0x54')]=function(_0x2ca557,_0x5ce704,_0x583896){if(_0x2ca557[_0xaf61('0x49')]['id']){delete _0x2ca557[_0xaf61('0x49')]['id'];}return db[_0xaf61('0x30')][_0xaf61('0x46')]({'where':{'id':_0x2ca557['params']['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x5ce704,null))[_0xaf61('0x27')](function(_0x1d9ebd){if(_0x1d9ebd){_0x2ca557[_0xaf61('0x49')][_0xaf61('0x55')]=_0x1d9ebd['id'];return db[_0xaf61('0x53')][_0xaf61('0x48')](_0x2ca557[_0xaf61('0x49')]);}})[_0xaf61('0x27')](respondWithResult(_0x5ce704,null))[_0xaf61('0x47')](handleError(_0x5ce704,null));};exports[_0xaf61('0x56')]=function(_0x177c18,_0xc6adf,_0x2f4f8b){var _0x26dcd1={};var _0x4d7c71={};var _0x5ed485;var _0x12d81b;return db[_0xaf61('0x30')]['findOne']({'where':{'id':_0x177c18[_0xaf61('0x51')]['id']}})['then'](handleEntityNotFound(_0xc6adf,null))[_0xaf61('0x27')](function(_0x524dc1){if(_0x524dc1){_0x5ed485=_0x524dc1;_0x4d7c71[_0xaf61('0x34')]=_[_0xaf61('0x36')](db[_0xaf61('0x53')][_0xaf61('0x31')]);_0x4d7c71[_0xaf61('0x35')]=_[_0xaf61('0x36')](_0x177c18[_0xaf61('0x35')]);_0x4d7c71[_0xaf61('0x37')]=_['intersection'](_0x4d7c71['model'],_0x4d7c71[_0xaf61('0x35')]);_0x26dcd1[_0xaf61('0x39')]=_[_0xaf61('0x38')](_0x4d7c71[_0xaf61('0x34')],qs['fields'](_0x177c18[_0xaf61('0x35')][_0xaf61('0x3a')]));_0x26dcd1[_0xaf61('0x39')]=_0x26dcd1[_0xaf61('0x39')]['length']?_0x26dcd1[_0xaf61('0x39')]:_0x4d7c71['model'];_0x26dcd1['order']=qs[_0xaf61('0x3e')](_0x177c18[_0xaf61('0x35')][_0xaf61('0x3e')]);_0x26dcd1[_0xaf61('0x3f')]=qs['filters'](_[_0xaf61('0x57')](_0x177c18['query'],_0x4d7c71['filters']));if(_0x177c18[_0xaf61('0x35')][_0xaf61('0x40')]){_0x26dcd1['where']=_[_0xaf61('0x41')](_0x26dcd1[_0xaf61('0x3f')],{'$or':_[_0xaf61('0x2f')](_0x26dcd1['attributes'],function(_0x1caa69){var _0x2f8ce1={};_0x2f8ce1[_0x1caa69]={'$like':'%'+_0x177c18[_0xaf61('0x35')]['filter']+'%'};return _0x2f8ce1;})});}_0x26dcd1=_['merge']({},_0x26dcd1,_0x177c18[_0xaf61('0x45')]);return _0x5ed485['getAllConditions'](_0x26dcd1);}})['then'](function(_0x5a104a){if(_0x5a104a){_0x12d81b=_0x5a104a[_0xaf61('0x3b')];if(!_0x177c18[_0xaf61('0x35')]['hasOwnProperty'](_0xaf61('0x3c'))){_0x26dcd1[_0xaf61('0x1f')]=qs[_0xaf61('0x1f')](_0x177c18['query'][_0xaf61('0x1f')]);_0x26dcd1[_0xaf61('0x21')]=qs[_0xaf61('0x21')](_0x177c18[_0xaf61('0x35')][_0xaf61('0x21')]);}return _0x5ed485['getAllConditions'](_0x26dcd1);}})['then'](function(_0x43f9bd){if(_0x43f9bd){return _0x43f9bd?{'count':_0x12d81b,'rows':_0x43f9bd}:null;}})[_0xaf61('0x27')](respondWithResult(_0xc6adf,null))['catch'](handleError(_0xc6adf,null));};exports[_0xaf61('0x58')]=function(_0xdcd537,_0x13d5bc,_0x58fd3b){var _0x5f3cc5={};var _0x318863={};var _0x3e81bf;var _0x5ee2cc;return db[_0xaf61('0x30')][_0xaf61('0x59')]({'where':{'id':_0xdcd537[_0xaf61('0x51')]['id']}})['then'](handleEntityNotFound(_0x13d5bc,null))['then'](function(_0x570e1f){if(_0x570e1f){_0x3e81bf=_0x570e1f;_0x318863[_0xaf61('0x34')]=_[_0xaf61('0x36')](db['Condition'][_0xaf61('0x31')]);_0x318863['query']=_['keys'](_0xdcd537[_0xaf61('0x35')]);_0x318863[_0xaf61('0x37')]=_[_0xaf61('0x38')](_0x318863[_0xaf61('0x34')],_0x318863[_0xaf61('0x35')]);_0x5f3cc5[_0xaf61('0x39')]=_['intersection'](_0x318863[_0xaf61('0x34')],qs[_0xaf61('0x3a')](_0xdcd537[_0xaf61('0x35')][_0xaf61('0x3a')]));_0x5f3cc5[_0xaf61('0x39')]=_0x5f3cc5['attributes']['length']?_0x5f3cc5[_0xaf61('0x39')]:_0x318863[_0xaf61('0x34')];_0x5f3cc5[_0xaf61('0x3d')]=qs[_0xaf61('0x3e')](_0xdcd537[_0xaf61('0x35')][_0xaf61('0x3e')]);_0x5f3cc5['where']=qs[_0xaf61('0x37')](_[_0xaf61('0x57')](_0xdcd537[_0xaf61('0x35')],_0x318863[_0xaf61('0x37')]));if(_0xdcd537[_0xaf61('0x35')]['filter']){_0x5f3cc5[_0xaf61('0x3f')]=_[_0xaf61('0x41')](_0x5f3cc5[_0xaf61('0x3f')],{'$or':_['map'](_0x5f3cc5[_0xaf61('0x39')],function(_0x54303f){var _0xc660d7={};_0xc660d7[_0x54303f]={'$like':'%'+_0xdcd537[_0xaf61('0x35')]['filter']+'%'};return _0xc660d7;})});}_0x5f3cc5=_[_0xaf61('0x41')]({},_0x5f3cc5,_0xdcd537[_0xaf61('0x45')]);return _0x3e81bf[_0xaf61('0x58')](_0x5f3cc5);}})['then'](function(_0x2a0bc4){if(_0x2a0bc4){_0x5ee2cc=_0x2a0bc4['length'];if(!_0xdcd537['query'][_0xaf61('0x5a')](_0xaf61('0x3c'))){_0x5f3cc5[_0xaf61('0x1f')]=qs[_0xaf61('0x1f')](_0xdcd537['query']['limit']);_0x5f3cc5[_0xaf61('0x21')]=qs[_0xaf61('0x21')](_0xdcd537[_0xaf61('0x35')][_0xaf61('0x21')]);}return _0x3e81bf[_0xaf61('0x58')](_0x5f3cc5);}})['then'](function(_0x3038e8){if(_0x3038e8){return _0x3038e8?{'count':_0x5ee2cc,'rows':_0x3038e8}:null;}})[_0xaf61('0x27')](respondWithResult(_0x13d5bc,null))['catch'](handleError(_0x13d5bc,null));};exports['addAction']=function(_0x170f37,_0x456e10,_0x3c9558){if(_0x170f37['body']['id']){delete _0x170f37[_0xaf61('0x49')]['id'];}return db[_0xaf61('0x30')]['find']({'where':{'id':_0x170f37['params']['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x456e10,null))[_0xaf61('0x27')](function(_0x3ae13f){if(_0x3ae13f){_0x170f37[_0xaf61('0x49')][_0xaf61('0x5b')]=_0x3ae13f['id'];return db[_0xaf61('0x5c')][_0xaf61('0x48')](_0x170f37[_0xaf61('0x49')]);}})[_0xaf61('0x27')](respondWithResult(_0x456e10,null))[_0xaf61('0x47')](handleError(_0x456e10,null));};exports[_0xaf61('0x5d')]=function(_0x41f14a,_0x37ca5d,_0x1351da){var _0xef648c={};var _0x52b8ce={};var _0x90661c;var _0x169e09;return db[_0xaf61('0x30')][_0xaf61('0x59')]({'where':{'id':_0x41f14a[_0xaf61('0x51')]['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x37ca5d,null))[_0xaf61('0x27')](function(_0x54be5d){if(_0x54be5d){_0x90661c=_0x54be5d;_0x52b8ce['model']=_[_0xaf61('0x36')](db[_0xaf61('0x5c')][_0xaf61('0x31')]);_0x52b8ce[_0xaf61('0x35')]=_['keys'](_0x41f14a[_0xaf61('0x35')]);_0x52b8ce[_0xaf61('0x37')]=_[_0xaf61('0x38')](_0x52b8ce['model'],_0x52b8ce[_0xaf61('0x35')]);_0xef648c[_0xaf61('0x39')]=_['intersection'](_0x52b8ce['model'],qs[_0xaf61('0x3a')](_0x41f14a[_0xaf61('0x35')][_0xaf61('0x3a')]));_0xef648c[_0xaf61('0x39')]=_0xef648c[_0xaf61('0x39')][_0xaf61('0x3b')]?_0xef648c[_0xaf61('0x39')]:_0x52b8ce['model'];_0xef648c[_0xaf61('0x3d')]=qs[_0xaf61('0x3e')](_0x41f14a[_0xaf61('0x35')]['sort']);_0xef648c['where']=qs[_0xaf61('0x37')](_[_0xaf61('0x57')](_0x41f14a[_0xaf61('0x35')],_0x52b8ce['filters']));if(_0x41f14a[_0xaf61('0x35')][_0xaf61('0x40')]){_0xef648c['where']=_[_0xaf61('0x41')](_0xef648c[_0xaf61('0x3f')],{'$or':_[_0xaf61('0x2f')](_0xef648c[_0xaf61('0x39')],function(_0x464c63){var _0x175e7e={};_0x175e7e[_0x464c63]={'$like':'%'+_0x41f14a['query'][_0xaf61('0x40')]+'%'};return _0x175e7e;})});}_0xef648c=_[_0xaf61('0x41')]({},_0xef648c,_0x41f14a[_0xaf61('0x45')]);return _0x90661c[_0xaf61('0x5d')](_0xef648c);}})[_0xaf61('0x27')](function(_0x22f7e6){if(_0x22f7e6){_0x169e09=_0x22f7e6['length'];if(!_0x41f14a[_0xaf61('0x35')][_0xaf61('0x5a')](_0xaf61('0x3c'))){_0xef648c[_0xaf61('0x1f')]=qs[_0xaf61('0x1f')](_0x41f14a[_0xaf61('0x35')][_0xaf61('0x1f')]);_0xef648c[_0xaf61('0x21')]=qs[_0xaf61('0x21')](_0x41f14a[_0xaf61('0x35')][_0xaf61('0x21')]);}return _0x90661c['getActions'](_0xef648c);}})['then'](function(_0x41e863){if(_0x41e863){return _0x41e863?{'count':_0x169e09,'rows':_0x41e863}:null;}})['then'](respondWithResult(_0x37ca5d,null))[_0xaf61('0x47')](handleError(_0x37ca5d,null));}; \ No newline at end of file +var _0xd4f2=['fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Trigger','rawAttributes','type','key','model','query','filters','intersection','attributes'];(function(_0x7f0ba,_0x446914){var _0x467ef5=function(_0x31785b){while(--_0x31785b){_0x7f0ba['push'](_0x7f0ba['shift']());}};_0x467ef5(++_0x446914);}(_0xd4f2,0x146));var _0x2d4f=function(_0x3c6d40,_0x2187a0){_0x3c6d40=_0x3c6d40-0x0;var _0x5c13f5=_0xd4f2[_0x3c6d40];return _0x5c13f5;};'use strict';var emlformat=require(_0x2d4f('0x0'));var rimraf=require(_0x2d4f('0x1'));var zipdir=require(_0x2d4f('0x2'));var jsonpatch=require(_0x2d4f('0x3'));var rp=require(_0x2d4f('0x4'));var moment=require('moment');var BPromise=require(_0x2d4f('0x5'));var Mustache=require(_0x2d4f('0x6'));var util=require(_0x2d4f('0x7'));var path=require('path');var sox=require(_0x2d4f('0x8'));var csv=require(_0x2d4f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d4f('0xa'));var _=require(_0x2d4f('0xb'));var squel=require('squel');var crypto=require(_0x2d4f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2d4f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2d4f('0xe'));var Papa=require(_0x2d4f('0xf'));var Redis=require(_0x2d4f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2d4f('0x11'));var as=require(_0x2d4f('0x12'));var hardwareService=require(_0x2d4f('0x13'));var logger=require(_0x2d4f('0x14'))(_0x2d4f('0x15'));var utils=require(_0x2d4f('0x16'));var config=require(_0x2d4f('0x17'));var licenseUtil=require(_0x2d4f('0x18'));var db=require(_0x2d4f('0x19'))['db'];function respondWithStatusCode(_0x13193b,_0x4cb2c5){_0x4cb2c5=_0x4cb2c5||0xcc;return function(_0x4b0111){if(_0x4b0111){return _0x13193b[_0x2d4f('0x1a')](_0x4cb2c5);}return _0x13193b[_0x2d4f('0x1b')](_0x4cb2c5)[_0x2d4f('0x1c')]();};}function respondWithResult(_0x228622,_0x5c06c1){_0x5c06c1=_0x5c06c1||0xc8;return function(_0x9aa19f){if(_0x9aa19f){return _0x228622[_0x2d4f('0x1b')](_0x5c06c1)['json'](_0x9aa19f);}};}function respondWithFilteredResult(_0x12b810,_0x5ad421){return function(_0x4ca278){if(_0x4ca278){var _0xdbbf6c=typeof _0x5ad421['offset']===_0x2d4f('0x1d')&&typeof _0x5ad421['limit']===_0x2d4f('0x1d');var _0x1ca40b=_0x4ca278[_0x2d4f('0x1e')];var _0x2552a0=_0xdbbf6c?0x0:_0x5ad421[_0x2d4f('0x1f')];var _0x4eafc7=_0xdbbf6c?_0x4ca278['count']:_0x5ad421[_0x2d4f('0x1f')]+_0x5ad421[_0x2d4f('0x20')];var _0x37fd9a;if(_0x4eafc7>=_0x1ca40b){_0x4eafc7=_0x1ca40b;_0x37fd9a=0xc8;}else{_0x37fd9a=0xce;}_0x12b810['status'](_0x37fd9a);return _0x12b810[_0x2d4f('0x21')](_0x2d4f('0x22'),_0x2552a0+'-'+_0x4eafc7+'/'+_0x1ca40b)[_0x2d4f('0x23')](_0x4ca278);}return null;};}function patchUpdates(_0x3a4fe7){return function(_0x2d57dc){try{jsonpatch[_0x2d4f('0x24')](_0x2d57dc,_0x3a4fe7,!![]);}catch(_0x2994e3){return BPromise[_0x2d4f('0x25')](_0x2994e3);}return _0x2d57dc[_0x2d4f('0x26')]();};}function saveUpdates(_0x37e271,_0x16d2e7){return function(_0x1d6322){if(_0x1d6322){return _0x1d6322[_0x2d4f('0x27')](_0x37e271)[_0x2d4f('0x28')](function(_0x259ece){return _0x259ece;});}return null;};}function removeEntity(_0x432674,_0x1d506a){return function(_0x19b95e){if(_0x19b95e){return _0x19b95e[_0x2d4f('0x29')]()[_0x2d4f('0x28')](function(){var _0x3d210c=_0x19b95e[_0x2d4f('0x2a')]({'plain':!![]});var _0x5f0974='Triggers';return db[_0x2d4f('0x2b')][_0x2d4f('0x29')]({'where':{'type':_0x5f0974,'resourceId':_0x3d210c['id']}})['then'](function(){return _0x19b95e;});})[_0x2d4f('0x28')](function(){_0x432674[_0x2d4f('0x1b')](0xcc)[_0x2d4f('0x1c')]();});}};}function handleEntityNotFound(_0x143992,_0x3f54cb){return function(_0x3eccdc){if(!_0x3eccdc){_0x143992[_0x2d4f('0x1a')](0x194);}return _0x3eccdc;};}function handleError(_0x43d076,_0x4336d4){_0x4336d4=_0x4336d4||0x1f4;return function(_0x12ac4d){logger[_0x2d4f('0x2c')](_0x12ac4d['stack']);if(_0x12ac4d[_0x2d4f('0x2d')]){delete _0x12ac4d['name'];}_0x43d076[_0x2d4f('0x1b')](_0x4336d4)[_0x2d4f('0x2e')](_0x12ac4d);};}exports[_0x2d4f('0x2f')]=function(_0x3f6d7c,_0x650ebf){var _0x2af9c8={},_0x270c45={},_0x55e41f={'count':0x0,'rows':[]};var _0x4098de=_[_0x2d4f('0x30')](db[_0x2d4f('0x31')][_0x2d4f('0x32')],function(_0x25bc0d){return{'name':_0x25bc0d['fieldName'],'type':_0x25bc0d[_0x2d4f('0x33')][_0x2d4f('0x34')]};});_0x270c45[_0x2d4f('0x35')]=_[_0x2d4f('0x30')](_0x4098de,_0x2d4f('0x2d'));_0x270c45[_0x2d4f('0x36')]=_['keys'](_0x3f6d7c[_0x2d4f('0x36')]);_0x270c45[_0x2d4f('0x37')]=_[_0x2d4f('0x38')](_0x270c45[_0x2d4f('0x35')],_0x270c45[_0x2d4f('0x36')]);_0x2af9c8[_0x2d4f('0x39')]=_[_0x2d4f('0x38')](_0x270c45[_0x2d4f('0x35')],qs[_0x2d4f('0x3a')](_0x3f6d7c['query'][_0x2d4f('0x3a')]));_0x2af9c8['attributes']=_0x2af9c8[_0x2d4f('0x39')][_0x2d4f('0x3b')]?_0x2af9c8[_0x2d4f('0x39')]:_0x270c45[_0x2d4f('0x35')];if(!_0x3f6d7c['query'][_0x2d4f('0x3c')](_0x2d4f('0x3d'))){_0x2af9c8[_0x2d4f('0x20')]=qs[_0x2d4f('0x20')](_0x3f6d7c[_0x2d4f('0x36')][_0x2d4f('0x20')]);_0x2af9c8[_0x2d4f('0x1f')]=qs[_0x2d4f('0x1f')](_0x3f6d7c['query'][_0x2d4f('0x1f')]);}_0x2af9c8[_0x2d4f('0x3e')]=qs[_0x2d4f('0x3f')](_0x3f6d7c[_0x2d4f('0x36')][_0x2d4f('0x3f')]);_0x2af9c8['where']=qs[_0x2d4f('0x37')](_[_0x2d4f('0x40')](_0x3f6d7c[_0x2d4f('0x36')],_0x270c45['filters']),_0x4098de);if(_0x3f6d7c[_0x2d4f('0x36')]['filter']){_0x2af9c8[_0x2d4f('0x41')]=_[_0x2d4f('0x42')](_0x2af9c8[_0x2d4f('0x41')],{'$or':_['map'](_0x4098de,function(_0x1976be){if(_0x1976be[_0x2d4f('0x33')]!==_0x2d4f('0x43')){var _0x5b471b={};_0x5b471b[_0x1976be[_0x2d4f('0x2d')]]={'$like':'%'+_0x3f6d7c[_0x2d4f('0x36')][_0x2d4f('0x44')]+'%'};return _0x5b471b;}})});}_0x2af9c8=_[_0x2d4f('0x42')]({},_0x2af9c8,_0x3f6d7c[_0x2d4f('0x45')]);var _0x4512c3={'where':_0x2af9c8[_0x2d4f('0x41')]};return db[_0x2d4f('0x31')][_0x2d4f('0x1e')](_0x4512c3)['then'](function(_0x41f3f7){_0x55e41f[_0x2d4f('0x1e')]=_0x41f3f7;if(_0x3f6d7c['query'][_0x2d4f('0x46')]){_0x2af9c8[_0x2d4f('0x47')]=[{'all':!![]}];}return db[_0x2d4f('0x31')][_0x2d4f('0x48')](_0x2af9c8);})[_0x2d4f('0x28')](function(_0x42b926){_0x55e41f[_0x2d4f('0x49')]=_0x42b926;return _0x55e41f;})[_0x2d4f('0x28')](respondWithFilteredResult(_0x650ebf,_0x2af9c8))[_0x2d4f('0x4a')](handleError(_0x650ebf,null));};exports['show']=function(_0x1b68c7,_0x53618f){var _0x5731bb={'raw':![],'where':{'id':_0x1b68c7['params']['id']}},_0x17ef53={};_0x17ef53['model']=_[_0x2d4f('0x4b')](db[_0x2d4f('0x31')]['rawAttributes']);_0x17ef53['query']=_['keys'](_0x1b68c7['query']);_0x17ef53[_0x2d4f('0x37')]=_[_0x2d4f('0x38')](_0x17ef53['model'],_0x17ef53[_0x2d4f('0x36')]);_0x5731bb[_0x2d4f('0x39')]=_[_0x2d4f('0x38')](_0x17ef53['model'],qs[_0x2d4f('0x3a')](_0x1b68c7['query'][_0x2d4f('0x3a')]));_0x5731bb['attributes']=_0x5731bb[_0x2d4f('0x39')]['length']?_0x5731bb['attributes']:_0x17ef53['model'];if(_0x1b68c7['query'][_0x2d4f('0x46')]){_0x5731bb[_0x2d4f('0x47')]=[{'all':!![]}];}_0x5731bb=_[_0x2d4f('0x42')]({},_0x5731bb,_0x1b68c7['options']);return db['Trigger']['find'](_0x5731bb)['then'](handleEntityNotFound(_0x53618f,null))[_0x2d4f('0x28')](respondWithResult(_0x53618f,null))[_0x2d4f('0x4a')](handleError(_0x53618f,null));};exports[_0x2d4f('0x4c')]=function(_0x1306ce,_0x5c7433){return db[_0x2d4f('0x31')][_0x2d4f('0x4c')](_0x1306ce[_0x2d4f('0x4d')],{})[_0x2d4f('0x28')](function(_0x5505db){var _0x257c3d=_0x1306ce['user']['get']({'plain':!![]});if(!_0x257c3d)throw new Error(_0x2d4f('0x4e'));if(_0x257c3d[_0x2d4f('0x4f')]==='user'){var _0x3fd2ea=_0x5505db[_0x2d4f('0x2a')]({'plain':!![]});var _0x15091d=_0x2d4f('0x50');return db[_0x2d4f('0x51')][_0x2d4f('0x52')]({'where':{'name':_0x15091d,'userProfileId':_0x257c3d['userProfileId']},'raw':!![]})[_0x2d4f('0x28')](function(_0x130847){if(_0x130847&&_0x130847[_0x2d4f('0x53')]===0x0){return db[_0x2d4f('0x2b')][_0x2d4f('0x4c')]({'name':_0x3fd2ea[_0x2d4f('0x2d')],'resourceId':_0x3fd2ea['id'],'type':_0x130847[_0x2d4f('0x2d')],'sectionId':_0x130847['id']},{})[_0x2d4f('0x28')](function(){return _0x5505db;});}else{return _0x5505db;}})[_0x2d4f('0x4a')](function(_0xe8a674){logger[_0x2d4f('0x2c')](_0x2d4f('0x54'),_0xe8a674);throw _0xe8a674;});}return _0x5505db;})['then'](respondWithResult(_0x5c7433,0xc9))[_0x2d4f('0x4a')](handleError(_0x5c7433,null));};exports[_0x2d4f('0x27')]=function(_0x36d0be,_0x3c7861){if(_0x36d0be[_0x2d4f('0x4d')]['id']){delete _0x36d0be[_0x2d4f('0x4d')]['id'];}return db[_0x2d4f('0x31')]['find']({'where':{'id':_0x36d0be[_0x2d4f('0x55')]['id']}})[_0x2d4f('0x28')](handleEntityNotFound(_0x3c7861,null))[_0x2d4f('0x28')](saveUpdates(_0x36d0be[_0x2d4f('0x4d')],null))['then'](respondWithResult(_0x3c7861,null))[_0x2d4f('0x4a')](handleError(_0x3c7861,null));};exports[_0x2d4f('0x29')]=function(_0x4ef6ae,_0x30993d){return db['Trigger'][_0x2d4f('0x52')]({'where':{'id':_0x4ef6ae[_0x2d4f('0x55')]['id']}})[_0x2d4f('0x28')](handleEntityNotFound(_0x30993d,null))[_0x2d4f('0x28')](removeEntity(_0x30993d,null))[_0x2d4f('0x4a')](handleError(_0x30993d,null));};exports[_0x2d4f('0x56')]=function(_0x275810,_0x444d97,_0x596332){if(_0x275810[_0x2d4f('0x4d')]['id']){delete _0x275810[_0x2d4f('0x4d')]['id'];}return db[_0x2d4f('0x31')]['find']({'where':{'id':_0x275810[_0x2d4f('0x55')]['id']}})[_0x2d4f('0x28')](handleEntityNotFound(_0x444d97,null))['then'](function(_0x596997){if(_0x596997){_0x275810[_0x2d4f('0x4d')][_0x2d4f('0x57')]=_0x596997['id'];return db[_0x2d4f('0x58')][_0x2d4f('0x4c')](_0x275810[_0x2d4f('0x4d')]);}})[_0x2d4f('0x28')](respondWithResult(_0x444d97,null))['catch'](handleError(_0x444d97,null));};exports['addAnyCondition']=function(_0x29f180,_0x17919b,_0x5467a0){if(_0x29f180[_0x2d4f('0x4d')]['id']){delete _0x29f180[_0x2d4f('0x4d')]['id'];}return db['Trigger'][_0x2d4f('0x52')]({'where':{'id':_0x29f180[_0x2d4f('0x55')]['id']}})[_0x2d4f('0x28')](handleEntityNotFound(_0x17919b,null))[_0x2d4f('0x28')](function(_0xfdf69e){if(_0xfdf69e){_0x29f180['body']['TriggerAnyId']=_0xfdf69e['id'];return db[_0x2d4f('0x58')][_0x2d4f('0x4c')](_0x29f180['body']);}})[_0x2d4f('0x28')](respondWithResult(_0x17919b,null))[_0x2d4f('0x4a')](handleError(_0x17919b,null));};exports[_0x2d4f('0x59')]=function(_0x3f6391,_0x3290a8,_0x350e14){var _0x3dacad={};var _0x2dac1d={};var _0x115749;var _0x5a0b78;return db['Trigger'][_0x2d4f('0x5a')]({'where':{'id':_0x3f6391[_0x2d4f('0x55')]['id']}})[_0x2d4f('0x28')](handleEntityNotFound(_0x3290a8,null))[_0x2d4f('0x28')](function(_0x1a278f){if(_0x1a278f){_0x115749=_0x1a278f;_0x2dac1d[_0x2d4f('0x35')]=_[_0x2d4f('0x4b')](db[_0x2d4f('0x58')][_0x2d4f('0x32')]);_0x2dac1d['query']=_['keys'](_0x3f6391[_0x2d4f('0x36')]);_0x2dac1d[_0x2d4f('0x37')]=_['intersection'](_0x2dac1d[_0x2d4f('0x35')],_0x2dac1d[_0x2d4f('0x36')]);_0x3dacad['attributes']=_[_0x2d4f('0x38')](_0x2dac1d[_0x2d4f('0x35')],qs[_0x2d4f('0x3a')](_0x3f6391['query'][_0x2d4f('0x3a')]));_0x3dacad[_0x2d4f('0x39')]=_0x3dacad[_0x2d4f('0x39')][_0x2d4f('0x3b')]?_0x3dacad[_0x2d4f('0x39')]:_0x2dac1d[_0x2d4f('0x35')];_0x3dacad[_0x2d4f('0x3e')]=qs[_0x2d4f('0x3f')](_0x3f6391[_0x2d4f('0x36')]['sort']);_0x3dacad[_0x2d4f('0x41')]=qs[_0x2d4f('0x37')](_[_0x2d4f('0x40')](_0x3f6391[_0x2d4f('0x36')],_0x2dac1d[_0x2d4f('0x37')]));if(_0x3f6391[_0x2d4f('0x36')][_0x2d4f('0x44')]){_0x3dacad[_0x2d4f('0x41')]=_['merge'](_0x3dacad[_0x2d4f('0x41')],{'$or':_[_0x2d4f('0x30')](_0x3dacad[_0x2d4f('0x39')],function(_0x5aa46e){var _0x404923={};_0x404923[_0x5aa46e]={'$like':'%'+_0x3f6391['query'][_0x2d4f('0x44')]+'%'};return _0x404923;})});}_0x3dacad=_[_0x2d4f('0x42')]({},_0x3dacad,_0x3f6391[_0x2d4f('0x45')]);return _0x115749[_0x2d4f('0x59')](_0x3dacad);}})[_0x2d4f('0x28')](function(_0x15c77b){if(_0x15c77b){_0x5a0b78=_0x15c77b[_0x2d4f('0x3b')];if(!_0x3f6391[_0x2d4f('0x36')]['hasOwnProperty'](_0x2d4f('0x3d'))){_0x3dacad[_0x2d4f('0x20')]=qs[_0x2d4f('0x20')](_0x3f6391['query']['limit']);_0x3dacad[_0x2d4f('0x1f')]=qs[_0x2d4f('0x1f')](_0x3f6391[_0x2d4f('0x36')][_0x2d4f('0x1f')]);}return _0x115749[_0x2d4f('0x59')](_0x3dacad);}})['then'](function(_0x5a0aa9){if(_0x5a0aa9){return _0x5a0aa9?{'count':_0x5a0b78,'rows':_0x5a0aa9}:null;}})[_0x2d4f('0x28')](respondWithResult(_0x3290a8,null))['catch'](handleError(_0x3290a8,null));};exports[_0x2d4f('0x5b')]=function(_0x21f00b,_0x4356b6,_0x3c8c71){var _0x37b371={};var _0x4c82a7={};var _0x140477;var _0x338430;return db['Trigger'][_0x2d4f('0x5a')]({'where':{'id':_0x21f00b[_0x2d4f('0x55')]['id']}})['then'](handleEntityNotFound(_0x4356b6,null))[_0x2d4f('0x28')](function(_0x59ae2e){if(_0x59ae2e){_0x140477=_0x59ae2e;_0x4c82a7[_0x2d4f('0x35')]=_[_0x2d4f('0x4b')](db[_0x2d4f('0x58')]['rawAttributes']);_0x4c82a7[_0x2d4f('0x36')]=_[_0x2d4f('0x4b')](_0x21f00b[_0x2d4f('0x36')]);_0x4c82a7[_0x2d4f('0x37')]=_[_0x2d4f('0x38')](_0x4c82a7[_0x2d4f('0x35')],_0x4c82a7[_0x2d4f('0x36')]);_0x37b371[_0x2d4f('0x39')]=_['intersection'](_0x4c82a7[_0x2d4f('0x35')],qs[_0x2d4f('0x3a')](_0x21f00b[_0x2d4f('0x36')][_0x2d4f('0x3a')]));_0x37b371[_0x2d4f('0x39')]=_0x37b371[_0x2d4f('0x39')]['length']?_0x37b371[_0x2d4f('0x39')]:_0x4c82a7['model'];_0x37b371[_0x2d4f('0x3e')]=qs[_0x2d4f('0x3f')](_0x21f00b[_0x2d4f('0x36')][_0x2d4f('0x3f')]);_0x37b371[_0x2d4f('0x41')]=qs[_0x2d4f('0x37')](_[_0x2d4f('0x40')](_0x21f00b[_0x2d4f('0x36')],_0x4c82a7[_0x2d4f('0x37')]));if(_0x21f00b[_0x2d4f('0x36')][_0x2d4f('0x44')]){_0x37b371[_0x2d4f('0x41')]=_[_0x2d4f('0x42')](_0x37b371['where'],{'$or':_['map'](_0x37b371[_0x2d4f('0x39')],function(_0x1ac8d4){var _0x4a22c4={};_0x4a22c4[_0x1ac8d4]={'$like':'%'+_0x21f00b[_0x2d4f('0x36')][_0x2d4f('0x44')]+'%'};return _0x4a22c4;})});}_0x37b371=_['merge']({},_0x37b371,_0x21f00b[_0x2d4f('0x45')]);return _0x140477[_0x2d4f('0x5b')](_0x37b371);}})['then'](function(_0x23e258){if(_0x23e258){_0x338430=_0x23e258[_0x2d4f('0x3b')];if(!_0x21f00b['query'][_0x2d4f('0x3c')](_0x2d4f('0x3d'))){_0x37b371[_0x2d4f('0x20')]=qs[_0x2d4f('0x20')](_0x21f00b[_0x2d4f('0x36')][_0x2d4f('0x20')]);_0x37b371['offset']=qs[_0x2d4f('0x1f')](_0x21f00b[_0x2d4f('0x36')][_0x2d4f('0x1f')]);}return _0x140477[_0x2d4f('0x5b')](_0x37b371);}})['then'](function(_0x49020e){if(_0x49020e){return _0x49020e?{'count':_0x338430,'rows':_0x49020e}:null;}})['then'](respondWithResult(_0x4356b6,null))[_0x2d4f('0x4a')](handleError(_0x4356b6,null));};exports[_0x2d4f('0x5c')]=function(_0x586b3c,_0xe1e57,_0x9928cd){if(_0x586b3c[_0x2d4f('0x4d')]['id']){delete _0x586b3c[_0x2d4f('0x4d')]['id'];}return db[_0x2d4f('0x31')][_0x2d4f('0x52')]({'where':{'id':_0x586b3c[_0x2d4f('0x55')]['id']}})['then'](handleEntityNotFound(_0xe1e57,null))[_0x2d4f('0x28')](function(_0xaf494f){if(_0xaf494f){_0x586b3c[_0x2d4f('0x4d')][_0x2d4f('0x5d')]=_0xaf494f['id'];return db[_0x2d4f('0x5e')][_0x2d4f('0x4c')](_0x586b3c[_0x2d4f('0x4d')]);}})[_0x2d4f('0x28')](respondWithResult(_0xe1e57,null))[_0x2d4f('0x4a')](handleError(_0xe1e57,null));};exports['getActions']=function(_0x5bac35,_0x1ae272,_0x3ead2a){var _0x30e37a={};var _0x7ae421={};var _0x1a2cd4;var _0x3f3751;return db['Trigger'][_0x2d4f('0x5a')]({'where':{'id':_0x5bac35[_0x2d4f('0x55')]['id']}})[_0x2d4f('0x28')](handleEntityNotFound(_0x1ae272,null))[_0x2d4f('0x28')](function(_0x325b9c){if(_0x325b9c){_0x1a2cd4=_0x325b9c;_0x7ae421[_0x2d4f('0x35')]=_[_0x2d4f('0x4b')](db['Action'][_0x2d4f('0x32')]);_0x7ae421[_0x2d4f('0x36')]=_[_0x2d4f('0x4b')](_0x5bac35[_0x2d4f('0x36')]);_0x7ae421[_0x2d4f('0x37')]=_[_0x2d4f('0x38')](_0x7ae421[_0x2d4f('0x35')],_0x7ae421[_0x2d4f('0x36')]);_0x30e37a[_0x2d4f('0x39')]=_[_0x2d4f('0x38')](_0x7ae421[_0x2d4f('0x35')],qs[_0x2d4f('0x3a')](_0x5bac35[_0x2d4f('0x36')]['fields']));_0x30e37a[_0x2d4f('0x39')]=_0x30e37a[_0x2d4f('0x39')]['length']?_0x30e37a[_0x2d4f('0x39')]:_0x7ae421[_0x2d4f('0x35')];_0x30e37a[_0x2d4f('0x3e')]=qs['sort'](_0x5bac35['query'][_0x2d4f('0x3f')]);_0x30e37a[_0x2d4f('0x41')]=qs[_0x2d4f('0x37')](_['pick'](_0x5bac35['query'],_0x7ae421[_0x2d4f('0x37')]));if(_0x5bac35[_0x2d4f('0x36')][_0x2d4f('0x44')]){_0x30e37a['where']=_[_0x2d4f('0x42')](_0x30e37a[_0x2d4f('0x41')],{'$or':_['map'](_0x30e37a[_0x2d4f('0x39')],function(_0x3e4497){var _0x4b9109={};_0x4b9109[_0x3e4497]={'$like':'%'+_0x5bac35['query'][_0x2d4f('0x44')]+'%'};return _0x4b9109;})});}_0x30e37a=_[_0x2d4f('0x42')]({},_0x30e37a,_0x5bac35['options']);return _0x1a2cd4['getActions'](_0x30e37a);}})[_0x2d4f('0x28')](function(_0x2a1576){if(_0x2a1576){_0x3f3751=_0x2a1576['length'];if(!_0x5bac35[_0x2d4f('0x36')][_0x2d4f('0x3c')](_0x2d4f('0x3d'))){_0x30e37a[_0x2d4f('0x20')]=qs['limit'](_0x5bac35['query'][_0x2d4f('0x20')]);_0x30e37a[_0x2d4f('0x1f')]=qs[_0x2d4f('0x1f')](_0x5bac35[_0x2d4f('0x36')][_0x2d4f('0x1f')]);}return _0x1a2cd4[_0x2d4f('0x5f')](_0x30e37a);}})['then'](function(_0x2be9c2){if(_0x2be9c2){return _0x2be9c2?{'count':_0x3f3751,'rows':_0x2be9c2}:null;}})[_0x2d4f('0x28')](respondWithResult(_0x1ae272,null))[_0x2d4f('0x4a')](handleError(_0x1ae272,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 2f879f7..25a31fa 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 _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trigger.attributes','Trigger','tools_triggers'];(function(_0x4dc25f,_0x2f84fb){var _0x168e49=function(_0x118039){while(--_0x118039){_0x4dc25f['push'](_0x4dc25f['shift']());}};_0x168e49(++_0x2f84fb);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x146e79,_0x45c82a){_0x146e79=_0x146e79-0x0;var _0x17971a=_0x4fdb[_0x146e79];return _0x17971a;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dfa=['Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','exports','define'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x6dfa,0x7b));var _0xa6df=function(_0x1f0186,_0x1114c1){_0x1f0186=_0x1f0186-0x0;var _0x17a24b=_0x6dfa[_0x1f0186];return _0x17a24b;};'use strict';var _=require(_0xa6df('0x0'));var util=require(_0xa6df('0x1'));var logger=require(_0xa6df('0x2'))(_0xa6df('0x3'));var moment=require(_0xa6df('0x4'));var BPromise=require('bluebird');var rp=require(_0xa6df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6df('0x6'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xa6df('0x7')]=function(_0x273081,_0x3299a2){return _0x273081[_0xa6df('0x8')](_0xa6df('0x9'),attributes,{'tableName':_0xa6df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 761ce9c..e88cf81 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 _0xe893=['attributes','include','model','map','then','debug','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe893,0x11f));var _0x3e89=function(_0x16fe4c,_0x2421e8){_0x16fe4c=_0x16fe4c-0x0;var _0x9999d=_0xe893[_0x16fe4c];return _0x9999d;};'use strict';var _=require(_0x3e89('0x0'));var util=require(_0x3e89('0x1'));var moment=require(_0x3e89('0x2'));var BPromise=require(_0x3e89('0x3'));var rs=require(_0x3e89('0x4'));var fs=require('fs');var Redis=require(_0x3e89('0x5'));var db=require(_0x3e89('0x6'))['db'];var utils=require(_0x3e89('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3e89('0x8'));var jayson=require(_0x3e89('0x9'));var client=jayson[_0x3e89('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33a90a,_0x5e0a7a,_0xf66edc){return new BPromise(function(_0x52065e,_0x3ba244){return client[_0x3e89('0xb')](_0x33a90a,_0xf66edc)['then'](function(_0x20f5ae){logger[_0x3e89('0xc')](_0x3e89('0xd'),_0x5e0a7a,_0x3e89('0xe'));logger['debug'](_0x3e89('0xf'),_0x5e0a7a,_0x3e89('0xe'),JSON[_0x3e89('0x10')](_0x20f5ae));if(_0x20f5ae['error']){if(_0x20f5ae[_0x3e89('0x11')][_0x3e89('0x12')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x5e0a7a,_0x20f5ae[_0x3e89('0x11')][_0x3e89('0x13')]);return _0x3ba244(_0x20f5ae['error'][_0x3e89('0x13')]);}logger['error'](_0x3e89('0xd'),_0x5e0a7a,_0x20f5ae[_0x3e89('0x11')][_0x3e89('0x13')]);return _0x52065e(_0x20f5ae[_0x3e89('0x11')][_0x3e89('0x13')]);}else{logger['info'](_0x3e89('0xd'),_0x5e0a7a,_0x3e89('0xe'));_0x52065e(_0x20f5ae[_0x3e89('0x14')][_0x3e89('0x13')]);}})[_0x3e89('0x15')](function(_0x33ef5d){logger[_0x3e89('0x11')](_0x3e89('0xd'),_0x5e0a7a,_0x33ef5d);_0x3ba244(_0x33ef5d);});});}exports[_0x3e89('0x16')]=function(_0x238f17){var _0x1eb666=this;return new Promise(function(_0x5cc628,_0x4b2e62){return db[_0x3e89('0x17')][_0x3e89('0x18')]({'raw':_0x238f17[_0x3e89('0x19')]?_0x238f17['options'][_0x3e89('0x1a')]===undefined?!![]:![]:!![],'where':_0x238f17[_0x3e89('0x19')]?_0x238f17[_0x3e89('0x19')][_0x3e89('0x1b')]||null:null,'attributes':_0x238f17[_0x3e89('0x19')]?_0x238f17[_0x3e89('0x19')][_0x3e89('0x1c')]||null:null,'limit':_0x238f17[_0x3e89('0x19')]?_0x238f17[_0x3e89('0x19')]['limit']||null:null,'include':_0x238f17[_0x3e89('0x19')]?_0x238f17[_0x3e89('0x19')][_0x3e89('0x1d')]?_['map'](_0x238f17[_0x3e89('0x19')][_0x3e89('0x1d')],function(_0x43654b){return{'model':db[_0x43654b[_0x3e89('0x1e')]],'as':_0x43654b['as'],'attributes':_0x43654b[_0x3e89('0x1c')],'include':_0x43654b[_0x3e89('0x1d')]?_['map'](_0x43654b[_0x3e89('0x1d')],function(_0x4c577c){return{'model':db[_0x4c577c[_0x3e89('0x1e')]],'as':_0x4c577c['as'],'attributes':_0x4c577c['attributes'],'include':_0x4c577c['include']?_[_0x3e89('0x1f')](_0x4c577c[_0x3e89('0x1d')],function(_0x14e834){return{'model':db[_0x14e834[_0x3e89('0x1e')]],'as':_0x14e834['as'],'attributes':_0x14e834[_0x3e89('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e89('0x20')](function(_0x51e93a){logger['info']('GetTrigger',_0x238f17);logger[_0x3e89('0x21')](_0x3e89('0x16'),_0x238f17,JSON[_0x3e89('0x10')](_0x51e93a));_0x5cc628(_0x51e93a);})['catch'](function(_0x44b190){logger[_0x3e89('0x11')](_0x3e89('0x16'),_0x44b190['message'],_0x238f17);_0x4b2e62(_0x1eb666[_0x3e89('0x11')](0x1f4,_0x44b190[_0x3e89('0x13')]));});});};exports[_0x3e89('0x22')]=function(_0x445a77){var _0x55450a=this;return new Promise(function(_0x129076,_0x598b5b){return db['Trigger']['find']({'raw':_0x445a77[_0x3e89('0x19')]?_0x445a77[_0x3e89('0x19')][_0x3e89('0x1a')]===undefined?!![]:![]:!![],'where':_0x445a77['options']?_0x445a77['options']['where']||null:null,'attributes':_0x445a77[_0x3e89('0x19')]?_0x445a77[_0x3e89('0x19')][_0x3e89('0x1c')]||null:null,'include':_0x445a77[_0x3e89('0x19')]?_0x445a77['options'][_0x3e89('0x1d')]?_[_0x3e89('0x1f')](_0x445a77['options'][_0x3e89('0x1d')],function(_0x5bf8a2){return{'model':db[_0x5bf8a2[_0x3e89('0x1e')]],'as':_0x5bf8a2['as'],'attributes':_0x5bf8a2[_0x3e89('0x1c')],'include':_0x5bf8a2[_0x3e89('0x1d')]?_['map'](_0x5bf8a2[_0x3e89('0x1d')],function(_0x19c3cd){return{'model':db[_0x19c3cd[_0x3e89('0x1e')]],'as':_0x19c3cd['as'],'attributes':_0x19c3cd['attributes'],'include':_0x19c3cd['include']?_['map'](_0x19c3cd[_0x3e89('0x1d')],function(_0x2f3e5d){return{'model':db[_0x2f3e5d[_0x3e89('0x1e')]],'as':_0x2f3e5d['as'],'attributes':_0x2f3e5d[_0x3e89('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e89('0x20')](function(_0x5bb0ac){logger[_0x3e89('0xc')](_0x3e89('0x22'),_0x445a77);logger['debug']('ShowTrigger',_0x445a77,JSON[_0x3e89('0x10')](_0x5bb0ac));_0x129076(_0x5bb0ac);})['catch'](function(_0x1524af){logger['error'](_0x3e89('0x22'),_0x1524af[_0x3e89('0x13')],_0x445a77);_0x598b5b(_0x55450a['error'](0x1f4,_0x1524af['message']));});});}; \ No newline at end of file +var _0xe9dc=['rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trigger','findAll','options','raw','where','attributes','include','map','model','info','debug','GetTrigger','ShowTrigger','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x22f135,_0x2cc381){var _0x18507=function(_0x4999a2){while(--_0x4999a2){_0x22f135['push'](_0x22f135['shift']());}};_0x18507(++_0x2cc381);}(_0xe9dc,0x1d6));var _0xce9d=function(_0x3b6482,_0xbb0afc){_0x3b6482=_0x3b6482-0x0;var _0x195839=_0xe9dc[_0x3b6482];return _0x195839;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xce9d('0x0'));var BPromise=require('bluebird');var rs=require(_0xce9d('0x1'));var fs=require('fs');var Redis=require(_0xce9d('0x2'));var db=require(_0xce9d('0x3'))['db'];var utils=require(_0xce9d('0x4'));var logger=require(_0xce9d('0x5'))(_0xce9d('0x6'));var config=require(_0xce9d('0x7'));var jayson=require(_0xce9d('0x8'));var client=jayson[_0xce9d('0x9')][_0xce9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c3e34,_0x1ab2fd,_0x513827){return new BPromise(function(_0x5cb4ed,_0x454b9f){return client[_0xce9d('0xb')](_0x2c3e34,_0x513827)[_0xce9d('0xc')](function(_0x5a6dbb){logger['info'](_0xce9d('0xd'),_0x1ab2fd,'request\x20sent');logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x1ab2fd,'request\x20sent',JSON[_0xce9d('0xe')](_0x5a6dbb));if(_0x5a6dbb[_0xce9d('0xf')]){if(_0x5a6dbb['error'][_0xce9d('0x10')]===0x1f4){logger['error'](_0xce9d('0xd'),_0x1ab2fd,_0x5a6dbb[_0xce9d('0xf')][_0xce9d('0x11')]);return _0x454b9f(_0x5a6dbb['error'][_0xce9d('0x11')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x1ab2fd,_0x5a6dbb['error'][_0xce9d('0x11')]);return _0x5cb4ed(_0x5a6dbb['error'][_0xce9d('0x11')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x1ab2fd,'request\x20sent');_0x5cb4ed(_0x5a6dbb[_0xce9d('0x12')][_0xce9d('0x11')]);}})[_0xce9d('0x13')](function(_0x55dcb8){logger[_0xce9d('0xf')](_0xce9d('0xd'),_0x1ab2fd,_0x55dcb8);_0x454b9f(_0x55dcb8);});});}exports['GetTrigger']=function(_0x3b0c8d){var _0xa11b26=this;return new Promise(function(_0x3b49d4,_0x140318){return db[_0xce9d('0x14')][_0xce9d('0x15')]({'raw':_0x3b0c8d[_0xce9d('0x16')]?_0x3b0c8d['options'][_0xce9d('0x17')]===undefined?!![]:![]:!![],'where':_0x3b0c8d['options']?_0x3b0c8d[_0xce9d('0x16')][_0xce9d('0x18')]||null:null,'attributes':_0x3b0c8d[_0xce9d('0x16')]?_0x3b0c8d['options'][_0xce9d('0x19')]||null:null,'limit':_0x3b0c8d['options']?_0x3b0c8d[_0xce9d('0x16')]['limit']||null:null,'include':_0x3b0c8d[_0xce9d('0x16')]?_0x3b0c8d[_0xce9d('0x16')][_0xce9d('0x1a')]?_[_0xce9d('0x1b')](_0x3b0c8d[_0xce9d('0x16')][_0xce9d('0x1a')],function(_0xce1166){return{'model':db[_0xce1166[_0xce9d('0x1c')]],'as':_0xce1166['as'],'attributes':_0xce1166[_0xce9d('0x19')],'include':_0xce1166[_0xce9d('0x1a')]?_['map'](_0xce1166['include'],function(_0x3e2388){return{'model':db[_0x3e2388[_0xce9d('0x1c')]],'as':_0x3e2388['as'],'attributes':_0x3e2388[_0xce9d('0x19')],'include':_0x3e2388[_0xce9d('0x1a')]?_[_0xce9d('0x1b')](_0x3e2388[_0xce9d('0x1a')],function(_0x599688){return{'model':db[_0x599688[_0xce9d('0x1c')]],'as':_0x599688['as'],'attributes':_0x599688[_0xce9d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xce9d('0xc')](function(_0x5dc08a){logger[_0xce9d('0x1d')]('GetTrigger',_0x3b0c8d);logger[_0xce9d('0x1e')](_0xce9d('0x1f'),_0x3b0c8d,JSON['stringify'](_0x5dc08a));_0x3b49d4(_0x5dc08a);})[_0xce9d('0x13')](function(_0x23f601){logger[_0xce9d('0xf')]('GetTrigger',_0x23f601[_0xce9d('0x11')],_0x3b0c8d);_0x140318(_0xa11b26[_0xce9d('0xf')](0x1f4,_0x23f601[_0xce9d('0x11')]));});});};exports[_0xce9d('0x20')]=function(_0x31dfd8){var _0x313ff3=this;return new Promise(function(_0x11f59c,_0x53577c){return db[_0xce9d('0x14')][_0xce9d('0x21')]({'raw':_0x31dfd8[_0xce9d('0x16')]?_0x31dfd8['options'][_0xce9d('0x17')]===undefined?!![]:![]:!![],'where':_0x31dfd8[_0xce9d('0x16')]?_0x31dfd8[_0xce9d('0x16')][_0xce9d('0x18')]||null:null,'attributes':_0x31dfd8[_0xce9d('0x16')]?_0x31dfd8['options'][_0xce9d('0x19')]||null:null,'include':_0x31dfd8[_0xce9d('0x16')]?_0x31dfd8['options'][_0xce9d('0x1a')]?_['map'](_0x31dfd8[_0xce9d('0x16')][_0xce9d('0x1a')],function(_0x4b4f97){return{'model':db[_0x4b4f97[_0xce9d('0x1c')]],'as':_0x4b4f97['as'],'attributes':_0x4b4f97[_0xce9d('0x19')],'include':_0x4b4f97[_0xce9d('0x1a')]?_[_0xce9d('0x1b')](_0x4b4f97['include'],function(_0x28a2d4){return{'model':db[_0x28a2d4['model']],'as':_0x28a2d4['as'],'attributes':_0x28a2d4[_0xce9d('0x19')],'include':_0x28a2d4[_0xce9d('0x1a')]?_[_0xce9d('0x1b')](_0x28a2d4[_0xce9d('0x1a')],function(_0x5930b8){return{'model':db[_0x5930b8['model']],'as':_0x5930b8['as'],'attributes':_0x5930b8[_0xce9d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xce9d('0xc')](function(_0x3812a0){logger[_0xce9d('0x1d')](_0xce9d('0x20'),_0x31dfd8);logger['debug']('ShowTrigger',_0x31dfd8,JSON[_0xce9d('0xe')](_0x3812a0));_0x11f59c(_0x3812a0);})['catch'](function(_0x21db4a){logger[_0xce9d('0xf')](_0xce9d('0x20'),_0x21db4a[_0xce9d('0x11')],_0x31dfd8);_0x53577c(_0x313ff3['error'](0x1f4,_0x21db4a[_0xce9d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5536792..05506d5 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 _0x11d9=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','clone','create','put','update','delete','/:id'];(function(_0x5b4d16,_0x1c71b5){var _0x1ad075=function(_0x236666){while(--_0x236666){_0x5b4d16['push'](_0x5b4d16['shift']());}};_0x1ad075(++_0x1c71b5);}(_0x11d9,0x16b));var _0x911d=function(_0xe36193,_0x5bbd3d){_0xe36193=_0xe36193-0x0;var _0x5c6451=_0x11d9[_0xe36193];return _0x5c6451;};'use strict';var multer=require(_0x911d('0x0'));var util=require(_0x911d('0x1'));var path=require(_0x911d('0x2'));var timeout=require(_0x911d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x911d('0x4'));var auth=require(_0x911d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x911d('0x6'));var controller=require('./trunk.controller');router[_0x911d('0x7')]('/',auth[_0x911d('0x8')](),controller[_0x911d('0x9')]);router[_0x911d('0x7')]('/:id',auth[_0x911d('0x8')](),controller[_0x911d('0xa')]);router['post']('/:id/clone',auth[_0x911d('0x8')](),controller[_0x911d('0xb')]);router['post']('/',auth[_0x911d('0x8')](),controller[_0x911d('0xc')]);router[_0x911d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x911d('0xe')]);router[_0x911d('0xf')](_0x911d('0x10'),auth[_0x911d('0x8')](),controller[_0x911d('0x11')]);module[_0x911d('0x12')]=router; \ No newline at end of file +var _0xb5f2=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','clone','create','put','update','delete'];(function(_0x912b19,_0x5a8890){var _0x4f1d91=function(_0x55edd7){while(--_0x55edd7){_0x912b19['push'](_0x912b19['shift']());}};_0x4f1d91(++_0x5a8890);}(_0xb5f2,0x1a5));var _0x2b5f=function(_0x4c0abc,_0x49ba32){_0x4c0abc=_0x4c0abc-0x0;var _0x1c39a0=_0xb5f2[_0x4c0abc];return _0x1c39a0;};'use strict';var multer=require('multer');var util=require(_0x2b5f('0x0'));var path=require(_0x2b5f('0x1'));var timeout=require(_0x2b5f('0x2'));var express=require(_0x2b5f('0x3'));var router=express['Router']();var fs_extra=require(_0x2b5f('0x4'));var auth=require(_0x2b5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2b5f('0x6'));var controller=require(_0x2b5f('0x7'));router[_0x2b5f('0x8')]('/',auth['isAuthenticated'](),controller[_0x2b5f('0x9')]);router['get'](_0x2b5f('0xa'),auth[_0x2b5f('0xb')](),controller[_0x2b5f('0xc')]);router[_0x2b5f('0xd')]('/:id/clone',auth[_0x2b5f('0xb')](),controller[_0x2b5f('0xe')]);router[_0x2b5f('0xd')]('/',auth[_0x2b5f('0xb')](),controller[_0x2b5f('0xf')]);router[_0x2b5f('0x10')](_0x2b5f('0xa'),auth['isAuthenticated'](),controller[_0x2b5f('0x11')]);router[_0x2b5f('0x12')](_0x2b5f('0xa'),auth[_0x2b5f('0xb')](),controller['destroy']);module[_0x2b5f('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index bc36d74..833ae44 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 _0xe8e2=['STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','nonat','outgoing','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports'];(function(_0x28dcaf,_0x27bfa1){var _0x49a38f=function(_0x1c288e){while(--_0x1c288e){_0x28dcaf['push'](_0x28dcaf['shift']());}};_0x49a38f(++_0x27bfa1);}(_0xe8e2,0x107));var _0x2e8e=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xe8e2[_0x5cb1af];return _0x8d7940;};'use strict';var Sequelize=require(_0x2e8e('0x0'));module[_0x2e8e('0x1')]={'name':{'type':Sequelize[_0x2e8e('0x2')],'allowNull':![],'unique':_0x2e8e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x5'),_0x2e8e('0x6'),_0x2e8e('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x2e8e('0x2')],'allowNull':![],'defaultValue':_0x2e8e('0x8')},'callingpres':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x9'),_0x2e8e('0xa'),_0x2e8e('0xb'),_0x2e8e('0xc'),_0x2e8e('0xd'),'PROHIB_PASSED_SCREEN',_0x2e8e('0xe'),_0x2e8e('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2e8e('0x2')]},'secret':{'type':Sequelize[_0x2e8e('0x2')]},'md5secret':{'type':Sequelize[_0x2e8e('0x2')]},'remotesecret':{'type':Sequelize[_0x2e8e('0x2')]},'transport':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':_0x2e8e('0x10'),'set':function(_0x505528){this['setDataValue'](_0x2e8e('0x11'),_0x505528?_0x505528[_0x2e8e('0x12')](','):null);},'get':function(){return this[_0x2e8e('0x13')](_0x2e8e('0x11'))?this[_0x2e8e('0x13')](_0x2e8e('0x11'))['split'](','):null;},'comment':_0x2e8e('0x14')},'dtmfmode':{'type':Sequelize[_0x2e8e('0x4')]('rfc2833',_0x2e8e('0x15'),_0x2e8e('0x16'),'inband',_0x2e8e('0x17')),'defaultValue':_0x2e8e('0x18')},'directmedia':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no',_0x2e8e('0x1a'),'update',_0x2e8e('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2e8e('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2e8e('0x2')]},'nat':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':'force_rport,comedia','set':function(_0xb8d04){this[_0x2e8e('0x1c')]('nat',_0xb8d04?_0xb8d04[_0x2e8e('0x12')](','):null);},'get':function(){return this[_0x2e8e('0x13')](_0x2e8e('0x1d'))?this[_0x2e8e('0x13')](_0x2e8e('0x1d'))['split'](','):null;},'comment':_0x2e8e('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2e8e('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2e8e('0x2')]},'language':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2e8e('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':_0x2e8e('0x1f')},'allow':{'type':Sequelize[_0x2e8e('0x2')],'allowNull':![],'defaultValue':_0x2e8e('0x20'),'set':function(_0x17318d){this[_0x2e8e('0x1c')](_0x2e8e('0x21'),_0x17318d?_0x17318d[_0x2e8e('0x12')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x2e8e('0x13')]('allow')?this[_0x2e8e('0x13')](_0x2e8e('0x21'))['split'](';'):null;},'comment':_0x2e8e('0x22')},'autoframing':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'insecure':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':'port,invite','set':function(_0x5126c6){this[_0x2e8e('0x1c')](_0x2e8e('0x23'),_0x5126c6?_0x5126c6[_0x2e8e('0x12')](','):null);},'get':function(){return this[_0x2e8e('0x13')]('insecure')?this[_0x2e8e('0x13')](_0x2e8e('0x23'))[_0x2e8e('0x24')](','):null;},'comment':_0x2e8e('0x25')},'trustrpid':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no',_0x2e8e('0x26'))},'promiscredir':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'accountcode':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'setvar':{'type':Sequelize[_0x2e8e('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x2e8e('0x2')]},'callcounter':{'type':Sequelize[_0x2e8e('0x4')]('yes','no'),'defaultValue':_0x2e8e('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x2e8e('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no',_0x2e8e('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'mailbox':{'type':Sequelize[_0x2e8e('0x2')]},'session_timers':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x29'),_0x2e8e('0x2a'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x2b'),_0x2e8e('0x2c')),'defaultValue':_0x2e8e('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x2e8e('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2e8e('0x2')]},'fromuser':{'type':Sequelize[_0x2e8e('0x2')]},'port':{'type':Sequelize[_0x2e8e('0x27')](0x5)},'qualify':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no'),'defaultValue':_0x2e8e('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x2e8e('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no',_0x2e8e('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2e8e('0x2')]},'callbackextension':{'type':Sequelize[_0x2e8e('0x2')]},'timert1':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'timerb':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x2e8e('0x2')]},'contactdeny':{'type':Sequelize[_0x2e8e('0x2')]},'contactacl':{'type':Sequelize[_0x2e8e('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2e8e('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'encryption':{'type':Sequelize[_0x2e8e('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2e8e('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'icesupport':{'type':Sequelize[_0x2e8e('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x2e8e('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no',_0x2e8e('0x2e'),_0x2e8e('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2e8e('0x2')]},'dtlscapath':{'type':Sequelize[_0x2e8e('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2e8e('0x30'),_0x2e8e('0x31'),_0x2e8e('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2e8e('0x2')]},'call_limit':{'type':Sequelize[_0x2e8e('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x2e8e('0x2')]},'mohinterpret':{'type':Sequelize[_0x2e8e('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2e8e('0x2')]},'description':{'type':Sequelize[_0x2e8e('0x2')]},'host':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':_0x2e8e('0x33')},'canreinvite':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no',_0x2e8e('0x1a'),'update',_0x2e8e('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2e8e('0x2')]},'otherFields':{'type':Sequelize[_0x2e8e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2f89=['actpass','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','refuse','originate','uac','uas','certificate','active'];(function(_0x1e498c,_0x417ed2){var _0x9a25df=function(_0x3454d7){while(--_0x3454d7){_0x1e498c['push'](_0x1e498c['shift']());}};_0x9a25df(++_0x417ed2);}(_0x2f89,0xc3));var _0x92f8=function(_0x4d7e92,_0x26d327){_0x4d7e92=_0x4d7e92-0x0;var _0x4e0c7a=_0x2f89[_0x4d7e92];return _0x4e0c7a;};'use strict';var Sequelize=require(_0x92f8('0x0'));module[_0x92f8('0x1')]={'name':{'type':Sequelize[_0x92f8('0x2')],'allowNull':![],'unique':_0x92f8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x5'),'user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x92f8('0x2')],'allowNull':![],'defaultValue':_0x92f8('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x92f8('0x7'),_0x92f8('0x8'),_0x92f8('0x9'),_0x92f8('0xa'),_0x92f8('0xb'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x92f8('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x92f8('0x2')]},'secret':{'type':Sequelize[_0x92f8('0x2')]},'md5secret':{'type':Sequelize[_0x92f8('0x2')]},'remotesecret':{'type':Sequelize[_0x92f8('0x2')]},'transport':{'type':Sequelize[_0x92f8('0x2')],'defaultValue':_0x92f8('0xd'),'set':function(_0xee4b6b){this[_0x92f8('0xe')](_0x92f8('0xf'),_0xee4b6b?_0xee4b6b[_0x92f8('0x10')](','):null);},'get':function(){return this[_0x92f8('0x11')](_0x92f8('0xf'))?this[_0x92f8('0x11')](_0x92f8('0xf'))[_0x92f8('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x13'),_0x92f8('0x14'),_0x92f8('0x15'),_0x92f8('0x16'),_0x92f8('0x17')),'defaultValue':_0x92f8('0x13')},'directmedia':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no',_0x92f8('0x19'),_0x92f8('0x1a'),_0x92f8('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x92f8('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x92f8('0x2')],'defaultValue':_0x92f8('0x1c'),'set':function(_0x30b122){this[_0x92f8('0xe')](_0x92f8('0x1d'),_0x30b122?_0x30b122['join'](','):null);},'get':function(){return this[_0x92f8('0x11')]('nat')?this['getDataValue'](_0x92f8('0x1d'))['split'](','):null;},'comment':_0x92f8('0x1e')},'callgroup':{'type':Sequelize[_0x92f8('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x92f8('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x92f8('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x92f8('0x2')],'allowNull':![],'defaultValue':_0x92f8('0x1f'),'set':function(_0x5de097){this['setDataValue'](_0x92f8('0x20'),_0x5de097?_0x5de097[_0x92f8('0x10')](';'):_0x92f8('0x1f'));},'get':function(){return this['getDataValue'](_0x92f8('0x20'))?this[_0x92f8('0x11')](_0x92f8('0x20'))[_0x92f8('0x12')](';'):null;},'comment':_0x92f8('0x21')},'autoframing':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no')},'insecure':{'type':Sequelize[_0x92f8('0x2')],'defaultValue':'port,invite','set':function(_0x41c9f1){this[_0x92f8('0xe')](_0x92f8('0x22'),_0x41c9f1?_0x41c9f1['join'](','):null);},'get':function(){return this[_0x92f8('0x11')](_0x92f8('0x22'))?this[_0x92f8('0x11')](_0x92f8('0x22'))[_0x92f8('0x12')](','):null;},'comment':_0x92f8('0x23')},'trustrpid':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x92f8('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x92f8('0x18'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x92f8('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x92f8('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x92f8('0x2')]},'callerid':{'type':Sequelize[_0x92f8('0x2')],'defaultValue':_0x92f8('0x24')},'amaflags':{'type':Sequelize[_0x92f8('0x2')]},'callcounter':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no'),'defaultValue':_0x92f8('0x18')},'busylevel':{'type':Sequelize[_0x92f8('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x92f8('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x92f8('0x2')]},'template':{'type':Sequelize[_0x92f8('0x2')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x92f8('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x92f8('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM']('accept',_0x92f8('0x27'),_0x92f8('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x92f8('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x29'),_0x92f8('0x2a')),'defaultValue':_0x92f8('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x92f8('0x2')]},'regexten':{'type':Sequelize[_0x92f8('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x92f8('0x2')]},'port':{'type':Sequelize[_0x92f8('0x25')](0x5)},'qualify':{'type':Sequelize[_0x92f8('0x4')]('yes','no'),'defaultValue':_0x92f8('0x18')},'keepalive':{'type':Sequelize[_0x92f8('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x92f8('0x2')]},'defaultuser':{'type':Sequelize[_0x92f8('0x2')]},'rtptimeout':{'type':Sequelize[_0x92f8('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x92f8('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x92f8('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x92f8('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x92f8('0x2')]},'callbackextension':{'type':Sequelize[_0x92f8('0x2')]},'timert1':{'type':Sequelize[_0x92f8('0x25')](0xb)},'timerb':{'type':Sequelize[_0x92f8('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x92f8('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x92f8('0x2')]},'contactdeny':{'type':Sequelize[_0x92f8('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x92f8('0x2')]},'use_q850_reason':{'type':Sequelize[_0x92f8('0x2')]},'maxforwards':{'type':Sequelize[_0x92f8('0x25')](0xb)},'encryption':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x92f8('0x18'),'no')},'icesupport':{'type':Sequelize[_0x92f8('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no','fingerprint',_0x92f8('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x92f8('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x92f8('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x92f8('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x92f8('0x2')]},'dtlscapath':{'type':Sequelize[_0x92f8('0x2')]},'dtlssetup':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x2c'),'passive',_0x92f8('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x92f8('0x2')]},'usereqphone':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x92f8('0x2')]},'recordofffeature':{'type':Sequelize[_0x92f8('0x2')]},'call_limit':{'type':Sequelize[_0x92f8('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x92f8('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no')},'vmexten':{'type':Sequelize[_0x92f8('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x92f8('0x2')]},'description':{'type':Sequelize[_0x92f8('0x2')]},'host':{'type':Sequelize[_0x92f8('0x2')],'defaultValue':_0x92f8('0x2e')},'canreinvite':{'type':Sequelize[_0x92f8('0x4')](_0x92f8('0x18'),'no','nonat',_0x92f8('0x1a'),_0x92f8('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x92f8('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x92f8('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 9ca15cf..aab4872 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x1107f1,_0x112a19){var _0x5dae0e=function(_0x5b85c6){while(--_0x5b85c6){_0x1107f1['push'](_0x1107f1['shift']());}};_0x5dae0e(++_0x112a19);}(_0x8ef6,0xf2));var _0x68ef=function(_0x16326e,_0x1ac2ff){_0x16326e=_0x16326e-0x0;var _0x2c6066=_0x8ef6[_0x16326e];return _0x2c6066;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file +var _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0xe1fffe,_0xd6da85){var _0x4e51fc=function(_0x19f32a){while(--_0x19f32a){_0xe1fffe['push'](_0xe1fffe['shift']());}};_0x4e51fc(++_0xd6da85);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1ade10,_0x24c28f){_0x1ade10=_0x1ade10-0x0;var _0x5c06e3=_0x6f0d[_0x1ade10];return _0x5c06e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 601c3fd..929e96c 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 _0x6e14=['api','moment','request-promise','path','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x6e14,0x1a3));var _0x46e1=function(_0x462d4b,_0x597689){_0x462d4b=_0x462d4b-0x0;var _0x606afe=_0x6e14[_0x462d4b];return _0x606afe;};'use strict';var _=require(_0x46e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x46e1('0x1'));var moment=require(_0x46e1('0x2'));var BPromise=require('bluebird');var rp=require(_0x46e1('0x3'));var fs=require('fs');var path=require(_0x46e1('0x4'));var rimraf=require('rimraf');var config=require(_0x46e1('0x5'));var attributes=require(_0x46e1('0x6'));module[_0x46e1('0x7')]=function(_0x2ec55b,_0x28f9e5){return _0x2ec55b[_0x46e1('0x8')](_0x46e1('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1482=['../../config/logger','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1482,0x1ad));var _0x2148=function(_0x229ae9,_0x51925c){_0x229ae9=_0x229ae9-0x0;var _0x1caa18=_0x1482[_0x229ae9];return _0x1caa18;};'use strict';var _=require('lodash');var util=require(_0x2148('0x0'));var logger=require(_0x2148('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2148('0x2'));var fs=require('fs');var path=require(_0x2148('0x3'));var rimraf=require(_0x2148('0x4'));var config=require(_0x2148('0x5'));var attributes=require(_0x2148('0x6'));module[_0x2148('0x7')]=function(_0x341ea9,_0x25027f){return _0x341ea9['define'](_0x2148('0x8'),attributes,{'tableName':_0x2148('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 b37ab6c..eb662cb 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 _0x6a99=['bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','request','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','options','where','attributes','limit','include','model','map','then','ShowTrunk','find','raw','lodash','util'];(function(_0x25aaec,_0x159e5b){var _0x293c2f=function(_0x3cd42a){while(--_0x3cd42a){_0x25aaec['push'](_0x25aaec['shift']());}};_0x293c2f(++_0x159e5b);}(_0x6a99,0x148));var _0x96a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6a99[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x96a9('0x0'));var util=require(_0x96a9('0x1'));var moment=require('moment');var BPromise=require(_0x96a9('0x2'));var rs=require(_0x96a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x96a9('0x4'));var logger=require(_0x96a9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x96a9('0x6'));var client=jayson['client'][_0x96a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b7fbf,_0x473d2d,_0xe271d5){return new BPromise(function(_0x394893,_0x4e0caf){return client[_0x96a9('0x8')](_0x4b7fbf,_0xe271d5)['then'](function(_0x5bf927){logger['info']('Trunk,\x20%s,\x20%s',_0x473d2d,_0x96a9('0x9'));logger[_0x96a9('0xa')](_0x96a9('0xb'),_0x473d2d,'request\x20sent',JSON[_0x96a9('0xc')](_0x5bf927));if(_0x5bf927['error']){if(_0x5bf927['error'][_0x96a9('0xd')]===0x1f4){logger[_0x96a9('0xe')](_0x96a9('0xf'),_0x473d2d,_0x5bf927[_0x96a9('0xe')]['message']);return _0x4e0caf(_0x5bf927[_0x96a9('0xe')][_0x96a9('0x10')]);}logger['error'](_0x96a9('0xf'),_0x473d2d,_0x5bf927[_0x96a9('0xe')][_0x96a9('0x10')]);return _0x394893(_0x5bf927['error']['message']);}else{logger[_0x96a9('0x11')]('Trunk,\x20%s,\x20%s',_0x473d2d,'request\x20sent');_0x394893(_0x5bf927[_0x96a9('0x12')]['message']);}})[_0x96a9('0x13')](function(_0x29b778){logger[_0x96a9('0xe')](_0x96a9('0xf'),_0x473d2d,_0x29b778);_0x4e0caf(_0x29b778);});});}exports[_0x96a9('0x14')]=function(_0x1a7ac6){var _0x28bc59=this;return new Promise(function(_0x11af03,_0x36d1e2){return db[_0x96a9('0x15')]['findAll']({'raw':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6[_0x96a9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6['options'][_0x96a9('0x17')]||null:null,'attributes':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6[_0x96a9('0x16')][_0x96a9('0x18')]||null:null,'limit':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6[_0x96a9('0x16')][_0x96a9('0x19')]||null:null,'include':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6['options'][_0x96a9('0x1a')]?_['map'](_0x1a7ac6[_0x96a9('0x16')][_0x96a9('0x1a')],function(_0x1c462b){return{'model':db[_0x1c462b[_0x96a9('0x1b')]],'as':_0x1c462b['as'],'attributes':_0x1c462b[_0x96a9('0x18')],'include':_0x1c462b[_0x96a9('0x1a')]?_['map'](_0x1c462b[_0x96a9('0x1a')],function(_0xf09e76){return{'model':db[_0xf09e76[_0x96a9('0x1b')]],'as':_0xf09e76['as'],'attributes':_0xf09e76[_0x96a9('0x18')],'include':_0xf09e76['include']?_[_0x96a9('0x1c')](_0xf09e76['include'],function(_0x42a0a0){return{'model':db[_0x42a0a0[_0x96a9('0x1b')]],'as':_0x42a0a0['as'],'attributes':_0x42a0a0[_0x96a9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x96a9('0x1d')](function(_0x5a3659){logger['info'](_0x96a9('0x14'),_0x1a7ac6);logger[_0x96a9('0xa')](_0x96a9('0x14'),_0x1a7ac6,JSON[_0x96a9('0xc')](_0x5a3659));_0x11af03(_0x5a3659);})['catch'](function(_0x120b79){logger[_0x96a9('0xe')](_0x96a9('0x14'),_0x120b79[_0x96a9('0x10')],_0x1a7ac6);_0x36d1e2(_0x28bc59['error'](0x1f4,_0x120b79['message']));});});};exports[_0x96a9('0x1e')]=function(_0x210c82){var _0x3b977f=this;return new Promise(function(_0x2b8ac3,_0x2afe37){return db[_0x96a9('0x15')][_0x96a9('0x1f')]({'raw':_0x210c82[_0x96a9('0x16')]?_0x210c82['options'][_0x96a9('0x20')]===undefined?!![]:![]:!![],'where':_0x210c82[_0x96a9('0x16')]?_0x210c82[_0x96a9('0x16')][_0x96a9('0x17')]||null:null,'attributes':_0x210c82[_0x96a9('0x16')]?_0x210c82[_0x96a9('0x16')][_0x96a9('0x18')]||null:null,'include':_0x210c82['options']?_0x210c82['options'][_0x96a9('0x1a')]?_[_0x96a9('0x1c')](_0x210c82[_0x96a9('0x16')]['include'],function(_0x1c0319){return{'model':db[_0x1c0319[_0x96a9('0x1b')]],'as':_0x1c0319['as'],'attributes':_0x1c0319[_0x96a9('0x18')],'include':_0x1c0319[_0x96a9('0x1a')]?_[_0x96a9('0x1c')](_0x1c0319['include'],function(_0x4c42ab){return{'model':db[_0x4c42ab['model']],'as':_0x4c42ab['as'],'attributes':_0x4c42ab[_0x96a9('0x18')],'include':_0x4c42ab['include']?_[_0x96a9('0x1c')](_0x4c42ab[_0x96a9('0x1a')],function(_0x233920){return{'model':db[_0x233920['model']],'as':_0x233920['as'],'attributes':_0x233920['attributes']};}):[]};}):[]};}):[]:[]})[_0x96a9('0x1d')](function(_0xc516c9){logger[_0x96a9('0x11')](_0x96a9('0x1e'),_0x210c82);logger[_0x96a9('0xa')]('ShowTrunk',_0x210c82,JSON[_0x96a9('0xc')](_0xc516c9));_0x2b8ac3(_0xc516c9);})[_0x96a9('0x13')](function(_0x5a448d){logger[_0x96a9('0xe')]('ShowTrunk',_0x5a448d[_0x96a9('0x10')],_0x210c82);_0x2afe37(_0x3b977f[_0x96a9('0xe')](0x1f4,_0x5a448d[_0x96a9('0x10')]));});});}; \ No newline at end of file +var _0xc177=['then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','options','where','attributes','include','map','model','ShowTrunk','Trunk','find','raw','debug','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc177,0x1c4));var _0x7c17=function(_0x1821a1,_0x1a2a0f){_0x1821a1=_0x1821a1-0x0;var _0x32f2a0=_0xc177[_0x1821a1];return _0x32f2a0;};'use strict';var _=require('lodash');var util=require(_0x7c17('0x0'));var moment=require(_0x7c17('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c17('0x2'))['db'];var utils=require(_0x7c17('0x3'));var logger=require('../../config/logger')(_0x7c17('0x4'));var config=require(_0x7c17('0x5'));var jayson=require(_0x7c17('0x6'));var client=jayson[_0x7c17('0x7')][_0x7c17('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fe1bf,_0x5e1878,_0x97acf5){return new BPromise(function(_0x19ab1b,_0x5ce5cd){return client[_0x7c17('0x9')](_0x3fe1bf,_0x97acf5)[_0x7c17('0xa')](function(_0x21330f){logger[_0x7c17('0xb')](_0x7c17('0xc'),_0x5e1878,_0x7c17('0xd'));logger['debug'](_0x7c17('0xe'),_0x5e1878,_0x7c17('0xd'),JSON[_0x7c17('0xf')](_0x21330f));if(_0x21330f[_0x7c17('0x10')]){if(_0x21330f[_0x7c17('0x10')][_0x7c17('0x11')]===0x1f4){logger[_0x7c17('0x10')](_0x7c17('0xc'),_0x5e1878,_0x21330f[_0x7c17('0x10')][_0x7c17('0x12')]);return _0x5ce5cd(_0x21330f['error'][_0x7c17('0x12')]);}logger[_0x7c17('0x10')](_0x7c17('0xc'),_0x5e1878,_0x21330f[_0x7c17('0x10')][_0x7c17('0x12')]);return _0x19ab1b(_0x21330f[_0x7c17('0x10')][_0x7c17('0x12')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x5e1878,_0x7c17('0xd'));_0x19ab1b(_0x21330f[_0x7c17('0x13')][_0x7c17('0x12')]);}})[_0x7c17('0x14')](function(_0x421be8){logger['error']('Trunk,\x20%s,\x20%s',_0x5e1878,_0x421be8);_0x5ce5cd(_0x421be8);});});}exports[_0x7c17('0x15')]=function(_0x539387){var _0x50f91a=this;return new Promise(function(_0xb0bb7e,_0x527849){return db['Trunk']['findAll']({'raw':_0x539387['options']?_0x539387[_0x7c17('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x539387[_0x7c17('0x16')]?_0x539387[_0x7c17('0x16')][_0x7c17('0x17')]||null:null,'attributes':_0x539387[_0x7c17('0x16')]?_0x539387[_0x7c17('0x16')][_0x7c17('0x18')]||null:null,'limit':_0x539387['options']?_0x539387[_0x7c17('0x16')]['limit']||null:null,'include':_0x539387[_0x7c17('0x16')]?_0x539387[_0x7c17('0x16')][_0x7c17('0x19')]?_[_0x7c17('0x1a')](_0x539387[_0x7c17('0x16')]['include'],function(_0x26b4b2){return{'model':db[_0x26b4b2[_0x7c17('0x1b')]],'as':_0x26b4b2['as'],'attributes':_0x26b4b2[_0x7c17('0x18')],'include':_0x26b4b2[_0x7c17('0x19')]?_[_0x7c17('0x1a')](_0x26b4b2[_0x7c17('0x19')],function(_0x2bb030){return{'model':db[_0x2bb030[_0x7c17('0x1b')]],'as':_0x2bb030['as'],'attributes':_0x2bb030[_0x7c17('0x18')],'include':_0x2bb030[_0x7c17('0x19')]?_['map'](_0x2bb030[_0x7c17('0x19')],function(_0x16d28c){return{'model':db[_0x16d28c['model']],'as':_0x16d28c['as'],'attributes':_0x16d28c[_0x7c17('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7c17('0xa')](function(_0x565174){logger[_0x7c17('0xb')](_0x7c17('0x15'),_0x539387);logger['debug']('GetTrunk',_0x539387,JSON[_0x7c17('0xf')](_0x565174));_0xb0bb7e(_0x565174);})[_0x7c17('0x14')](function(_0x3e16c0){logger[_0x7c17('0x10')](_0x7c17('0x15'),_0x3e16c0[_0x7c17('0x12')],_0x539387);_0x527849(_0x50f91a[_0x7c17('0x10')](0x1f4,_0x3e16c0['message']));});});};exports[_0x7c17('0x1c')]=function(_0xaeff45){var _0x56dc01=this;return new Promise(function(_0x790892,_0x4b6264){return db[_0x7c17('0x1d')][_0x7c17('0x1e')]({'raw':_0xaeff45['options']?_0xaeff45[_0x7c17('0x16')][_0x7c17('0x1f')]===undefined?!![]:![]:!![],'where':_0xaeff45[_0x7c17('0x16')]?_0xaeff45[_0x7c17('0x16')][_0x7c17('0x17')]||null:null,'attributes':_0xaeff45[_0x7c17('0x16')]?_0xaeff45[_0x7c17('0x16')][_0x7c17('0x18')]||null:null,'include':_0xaeff45[_0x7c17('0x16')]?_0xaeff45['options'][_0x7c17('0x19')]?_[_0x7c17('0x1a')](_0xaeff45['options'][_0x7c17('0x19')],function(_0x2a8e90){return{'model':db[_0x2a8e90[_0x7c17('0x1b')]],'as':_0x2a8e90['as'],'attributes':_0x2a8e90['attributes'],'include':_0x2a8e90[_0x7c17('0x19')]?_[_0x7c17('0x1a')](_0x2a8e90[_0x7c17('0x19')],function(_0x318f07){return{'model':db[_0x318f07[_0x7c17('0x1b')]],'as':_0x318f07['as'],'attributes':_0x318f07[_0x7c17('0x18')],'include':_0x318f07[_0x7c17('0x19')]?_[_0x7c17('0x1a')](_0x318f07[_0x7c17('0x19')],function(_0x377897){return{'model':db[_0x377897[_0x7c17('0x1b')]],'as':_0x377897['as'],'attributes':_0x377897[_0x7c17('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7c17('0xa')](function(_0xd85e9a){logger[_0x7c17('0xb')](_0x7c17('0x1c'),_0xaeff45);logger[_0x7c17('0x20')](_0x7c17('0x1c'),_0xaeff45,JSON[_0x7c17('0xf')](_0xd85e9a));_0x790892(_0xd85e9a);})[_0x7c17('0x14')](function(_0x47d8b3){logger['error']('ShowTrunk',_0x47d8b3[_0x7c17('0x12')],_0xaeff45);_0x4b6264(_0x56dc01[_0x7c17('0x10')](0x1f4,_0x47d8b3['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 0bbf7da..297f3e0 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 _0xa887=['/presence','getPresence','/:id','show','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/sms_accounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','post','create','bulkCreate','diskStorage','join','server/files/images/','format','now','originalname','/:id/avatar','single','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','update','put','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami'];(function(_0x3f726b,_0x232c64){var _0x5defdc=function(_0x4528fe){while(--_0x4528fe){_0x3f726b['push'](_0x3f726b['shift']());}};_0x5defdc(++_0x232c64);}(_0xa887,0xd0));var _0x7a88=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa887[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7a88('0x0'));var util=require(_0x7a88('0x1'));var path=require(_0x7a88('0x2'));var timeout=require(_0x7a88('0x3'));var express=require('express');var router=express[_0x7a88('0x4')]();var fs_extra=require(_0x7a88('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7a88('0x6'));var config=require(_0x7a88('0x7'));var controller=require(_0x7a88('0x8'));router[_0x7a88('0x9')]('/',auth[_0x7a88('0xa')](),controller['index']);router[_0x7a88('0x9')](_0x7a88('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7a88('0xc'),auth[_0x7a88('0xa')](),controller[_0x7a88('0xd')]);router[_0x7a88('0x9')](_0x7a88('0xe'),auth[_0x7a88('0xa')](),controller[_0x7a88('0xf')]);router['get'](_0x7a88('0x10'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x11')]);router[_0x7a88('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x7a88('0x9')](_0x7a88('0x12'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x13')]);router[_0x7a88('0x9')](_0x7a88('0x14'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x15')]);router['get'](_0x7a88('0x16'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x17')]);router[_0x7a88('0x9')](_0x7a88('0x18'),auth['isAuthenticated'](),controller[_0x7a88('0x19')]);router[_0x7a88('0x9')]('/:id/groups',auth[_0x7a88('0xa')](),controller['getGroups']);router[_0x7a88('0x9')]('/:id/recordings',auth[_0x7a88('0xa')](),controller[_0x7a88('0x1a')]);router[_0x7a88('0x9')](_0x7a88('0x1b'),auth[_0x7a88('0xa')](),controller['getScreenRecordings']);router[_0x7a88('0x9')](_0x7a88('0x1c'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x1d')]);router[_0x7a88('0x9')](_0x7a88('0x1e'),auth[_0x7a88('0xa')](),controller['getOpenchannelInteractions']);router[_0x7a88('0x9')](_0x7a88('0x1f'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x20')]);router['get'](_0x7a88('0x21'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x7a88('0x9')]('/:id/fax/interactions',auth[_0x7a88('0xa')](),controller['getFaxInteractions']);router[_0x7a88('0x9')](_0x7a88('0x22'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x23')]);router[_0x7a88('0x9')](_0x7a88('0x24'),auth['isAuthenticated'](),controller['getTeams']);router[_0x7a88('0x9')](_0x7a88('0x25'),auth['isAuthenticated'](),controller[_0x7a88('0x26')]);router[_0x7a88('0x9')](_0x7a88('0x27'),auth['isAuthenticated'](),controller[_0x7a88('0x28')]);router[_0x7a88('0x9')](_0x7a88('0x29'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x2a')]);router[_0x7a88('0x9')](_0x7a88('0x2b'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x2c')]);router[_0x7a88('0x9')](_0x7a88('0x2d'),auth[_0x7a88('0xa')](),controller['getMailAccounts']);router[_0x7a88('0x9')]('/:id/openchannel_accounts',auth[_0x7a88('0xa')](),controller['getOpenchannelAccounts']);router['get'](_0x7a88('0x2e'),auth[_0x7a88('0xa')](),controller['getSmsAccounts']);router[_0x7a88('0x9')]('/:id/chat_websites',auth[_0x7a88('0xa')](),controller[_0x7a88('0x2f')]);router['get']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x7a88('0x30')]);router[_0x7a88('0x9')](_0x7a88('0x31'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x32')]);router[_0x7a88('0x9')](_0x7a88('0x33'),auth['isAuthenticated'](),controller['getScheduledCalls']);router['get'](_0x7a88('0x34'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x35')]);router['post'](_0x7a88('0x14'),auth['isAuthenticated'](),controller[_0x7a88('0x36')]);router[_0x7a88('0x37')]('/',auth[_0x7a88('0xa')](),controller[_0x7a88('0x38')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x7a88('0x39')]);router[_0x7a88('0x37')]('/:id/queues',auth[_0x7a88('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x7a88('0x3a')]({'destination':function(_0x17d63b,_0x5d84db,_0x245c55){_0x245c55(null,path[_0x7a88('0x3b')](config['root'],_0x7a88('0x3c')));},'filename':function(_0x19733f,_0x5684d5,_0x253b68){_0x253b68(null,util[_0x7a88('0x3d')]('%s-%s',Date[_0x7a88('0x3e')](),_0x5684d5[_0x7a88('0x3f')]));}})});router[_0x7a88('0x37')](_0x7a88('0x40'),upload[_0x7a88('0x41')]('file'),controller[_0x7a88('0x42')]);router['post'](_0x7a88('0x43'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x44')]);router[_0x7a88('0x37')](_0x7a88('0x45'),auth['isAuthenticated'](),controller['logout']);router[_0x7a88('0x37')](_0x7a88('0x46'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x47')]);router['post']('/:id/unpause',auth[_0x7a88('0xa')](),controller['unpause']);router['post']('/:id/teams',auth[_0x7a88('0xa')](),controller[_0x7a88('0x48')]);router[_0x7a88('0x37')]('/:id/chat_interactions',auth[_0x7a88('0xa')](),controller[_0x7a88('0x49')]);router['post'](_0x7a88('0x4a'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x4b')]);router['post'](_0x7a88('0x4c'),auth['isAuthenticated'](),controller[_0x7a88('0x4d')]);router['post'](_0x7a88('0x4e'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x7a88('0x37')](_0x7a88('0x4f'),auth[_0x7a88('0xa')](),controller['addOpenchannelInteractions']);router['post'](_0x7a88('0x50'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x51')]);router[_0x7a88('0x37')](_0x7a88('0x2b'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x52')]);router[_0x7a88('0x37')](_0x7a88('0x2d'),auth['isAuthenticated'](),controller[_0x7a88('0x53')]);router[_0x7a88('0x37')](_0x7a88('0x54'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x55')]);router[_0x7a88('0x37')](_0x7a88('0x2e'),auth['isAuthenticated'](),controller[_0x7a88('0x56')]);router[_0x7a88('0x37')](_0x7a88('0x57'),auth['isAuthenticated'](),controller[_0x7a88('0x58')]);router[_0x7a88('0x37')](_0x7a88('0x59'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x5a')]);router[_0x7a88('0x37')](_0x7a88('0x31'),auth['isAuthenticated'](),controller[_0x7a88('0x5b')]);router[_0x7a88('0x37')](_0x7a88('0x34'),auth[_0x7a88('0xa')](),controller['createApiKey']);router['put']('/:id',auth[_0x7a88('0xa')](),controller[_0x7a88('0x5c')]);router[_0x7a88('0x5d')](_0x7a88('0x5e'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x5f')]);router['delete'](_0x7a88('0x16'),auth[_0x7a88('0xa')](),controller['removeQueues']);router[_0x7a88('0x60')](_0x7a88('0x24'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x61')]);router[_0x7a88('0x60')](_0x7a88('0x10'),auth['isAuthenticated'](),controller[_0x7a88('0x62')]);router[_0x7a88('0x60')](_0x7a88('0x63'),auth['isAuthenticated'](),controller[_0x7a88('0x64')]);router[_0x7a88('0x60')](_0x7a88('0x4a'),auth[_0x7a88('0xa')](),controller['removeMailInteractions']);router[_0x7a88('0x60')]('/:id/fax_interactions',auth[_0x7a88('0xa')](),controller[_0x7a88('0x65')]);router[_0x7a88('0x60')](_0x7a88('0x4e'),auth['isAuthenticated'](),controller[_0x7a88('0x66')]);router[_0x7a88('0x60')](_0x7a88('0x4f'),auth['isAuthenticated'](),controller[_0x7a88('0x67')]);router[_0x7a88('0x60')](_0x7a88('0x50'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x68')]);router['delete'](_0x7a88('0x2b'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x69')]);router[_0x7a88('0x60')](_0x7a88('0x2d'),auth[_0x7a88('0xa')](),controller['removeMailAccounts']);router[_0x7a88('0x60')]('/:id/openchannel_accounts',auth[_0x7a88('0xa')](),controller[_0x7a88('0x6a')]);router[_0x7a88('0x60')](_0x7a88('0x2e'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x6b')]);router[_0x7a88('0x60')](_0x7a88('0x57'),auth[_0x7a88('0xa')](),controller['removeChatWebsites']);router[_0x7a88('0x60')]('/:id/whatsapp_accounts',auth[_0x7a88('0xa')](),controller[_0x7a88('0x6c')]);router['delete'](_0x7a88('0x31'),auth['isAuthenticated'](),controller[_0x7a88('0x6d')]);router[_0x7a88('0x60')](_0x7a88('0x34'),auth[_0x7a88('0xa')](),controller['removeApiKey']);module[_0x7a88('0x6e')]=router; \ No newline at end of file +var _0xcfdf=['getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeQueues','/:id/chat_interactions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','/whoami','/presence','show','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xcfdf,0x13c));var _0xfcfd=function(_0x418840,_0x459b01){_0x418840=_0x418840-0x0;var _0x5c5b6c=_0xcfdf[_0x418840];return _0x5c5b6c;};'use strict';var multer=require(_0xfcfd('0x0'));var util=require('util');var path=require(_0xfcfd('0x1'));var timeout=require('connect-timeout');var express=require(_0xfcfd('0x2'));var router=express[_0xfcfd('0x3')]();var fs_extra=require(_0xfcfd('0x4'));var auth=require(_0xfcfd('0x5'));var interaction=require(_0xfcfd('0x6'));var config=require('../../config/environment');var controller=require('./user.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfcfd('0x7')]);router[_0xfcfd('0x8')]('/describe',auth[_0xfcfd('0x9')](),controller['describe']);router[_0xfcfd('0x8')](_0xfcfd('0xa'),auth[_0xfcfd('0x9')](),controller['whoami']);router[_0xfcfd('0x8')](_0xfcfd('0xb'),auth['isAuthenticated'](),controller['getPresence']);router[_0xfcfd('0x8')]('/:id',auth[_0xfcfd('0x9')](),controller[_0xfcfd('0xc')]);router[_0xfcfd('0x8')](_0xfcfd('0xd'),controller['getAvatar']);router['get']('/:id/open_tabs',auth[_0xfcfd('0x9')](),controller[_0xfcfd('0xe')]);router[_0xfcfd('0x8')](_0xfcfd('0xf'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x10')]);router[_0xfcfd('0x8')](_0xfcfd('0x11'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x12')]);router[_0xfcfd('0x8')](_0xfcfd('0x13'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x14')]);router[_0xfcfd('0x8')](_0xfcfd('0x15'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x16')]);router[_0xfcfd('0x8')](_0xfcfd('0x17'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x18')]);router[_0xfcfd('0x8')](_0xfcfd('0x19'),auth['isAuthenticated'](),controller[_0xfcfd('0x1a')]);router[_0xfcfd('0x8')](_0xfcfd('0x1b'),auth[_0xfcfd('0x9')](),controller['getChatInteractions']);router[_0xfcfd('0x8')](_0xfcfd('0x1c'),auth[_0xfcfd('0x9')](),controller['getOpenchannelInteractions']);router['get']('/:id/mail/interactions',auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x1d')]);router[_0xfcfd('0x8')](_0xfcfd('0x1e'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x1f')]);router[_0xfcfd('0x8')](_0xfcfd('0x20'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x21')]);router[_0xfcfd('0x8')](_0xfcfd('0x22'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x23')]);router[_0xfcfd('0x8')](_0xfcfd('0x24'),auth['isAuthenticated'](),controller[_0xfcfd('0x25')]);router[_0xfcfd('0x8')](_0xfcfd('0x26'),auth['isAuthenticated'](),controller[_0xfcfd('0x27')]);router['get'](_0xfcfd('0x28'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x29')]);router[_0xfcfd('0x8')]('/:id/prefixes',auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x2a')]);router['get'](_0xfcfd('0x2b'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x2c')]);router['get'](_0xfcfd('0x2d'),auth[_0xfcfd('0x9')](),controller['getMailAccounts']);router[_0xfcfd('0x8')](_0xfcfd('0x2e'),auth[_0xfcfd('0x9')](),controller['getOpenchannelAccounts']);router[_0xfcfd('0x8')](_0xfcfd('0x2f'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x30')]);router[_0xfcfd('0x8')](_0xfcfd('0x31'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x32')]);router['get'](_0xfcfd('0x33'),auth[_0xfcfd('0x9')](),controller['getWhatsappAccounts']);router[_0xfcfd('0x8')](_0xfcfd('0x34'),auth[_0xfcfd('0x9')](),controller['getSquareProjects']);router[_0xfcfd('0x8')](_0xfcfd('0x35'),auth[_0xfcfd('0x9')](),controller['getScheduledCalls']);router[_0xfcfd('0x8')](_0xfcfd('0x36'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x37')]);router[_0xfcfd('0x38')]('/:id/contacts',auth[_0xfcfd('0x9')](),controller['addContacts']);router['post']('/',auth[_0xfcfd('0x9')](),controller['create']);router[_0xfcfd('0x38')](_0xfcfd('0x39'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x3a')]);router[_0xfcfd('0x38')](_0xfcfd('0x11'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x3b')]);var upload=multer({'storage':multer[_0xfcfd('0x3c')]({'destination':function(_0x5728a5,_0x146fa7,_0x24e1ae){_0x24e1ae(null,path[_0xfcfd('0x3d')](config[_0xfcfd('0x3e')],_0xfcfd('0x3f')));},'filename':function(_0x5859f7,_0x36f8b4,_0x2d48f9){_0x2d48f9(null,util[_0xfcfd('0x40')](_0xfcfd('0x41'),Date['now'](),_0x36f8b4[_0xfcfd('0x42')]));}})});router[_0xfcfd('0x38')](_0xfcfd('0xd'),upload[_0xfcfd('0x43')](_0xfcfd('0x44')),controller[_0xfcfd('0x45')]);router[_0xfcfd('0x38')](_0xfcfd('0x46'),auth['isAuthenticated'](),controller['login']);router[_0xfcfd('0x38')](_0xfcfd('0x47'),auth['isAuthenticated'](),controller[_0xfcfd('0x48')]);router[_0xfcfd('0x38')](_0xfcfd('0x49'),auth['isAuthenticated'](),controller['pause']);router[_0xfcfd('0x38')](_0xfcfd('0x4a'),auth['isAuthenticated'](),controller[_0xfcfd('0x4b')]);router[_0xfcfd('0x38')](_0xfcfd('0x24'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x4c')]);router[_0xfcfd('0x38')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xfcfd('0x4d')]);router[_0xfcfd('0x38')]('/:id/mail_interactions',auth[_0xfcfd('0x9')](),controller['addMailInteractions']);router[_0xfcfd('0x38')](_0xfcfd('0x4e'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x4f')]);router[_0xfcfd('0x38')]('/:id/sms_interactions',auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x50')]);router[_0xfcfd('0x38')](_0xfcfd('0x51'),auth[_0xfcfd('0x9')](),controller['addOpenchannelInteractions']);router[_0xfcfd('0x38')](_0xfcfd('0x52'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x53')]);router[_0xfcfd('0x38')](_0xfcfd('0x2b'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x54')]);router[_0xfcfd('0x38')](_0xfcfd('0x2d'),auth['isAuthenticated'](),controller[_0xfcfd('0x55')]);router['post'](_0xfcfd('0x2e'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x56')]);router[_0xfcfd('0x38')](_0xfcfd('0x2f'),auth['isAuthenticated'](),controller[_0xfcfd('0x57')]);router[_0xfcfd('0x38')](_0xfcfd('0x31'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x58')]);router['post'](_0xfcfd('0x33'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x59')]);router[_0xfcfd('0x38')](_0xfcfd('0x34'),auth['isAuthenticated'](),controller[_0xfcfd('0x5a')]);router[_0xfcfd('0x38')](_0xfcfd('0x36'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x5b')]);router[_0xfcfd('0x5c')](_0xfcfd('0x5d'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x5e')]);router['put'](_0xfcfd('0x5f'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x60')]);router[_0xfcfd('0x61')]('/:id/queues',auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x62')]);router[_0xfcfd('0x61')](_0xfcfd('0x24'),auth[_0xfcfd('0x9')](),controller['removeTeams']);router[_0xfcfd('0x61')]('/:id',auth[_0xfcfd('0x9')](),controller['destroy']);router['delete'](_0xfcfd('0x63'),auth[_0xfcfd('0x9')](),controller['removeChatInteractions']);router[_0xfcfd('0x61')](_0xfcfd('0x64'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x65')]);router[_0xfcfd('0x61')](_0xfcfd('0x4e'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x66')]);router[_0xfcfd('0x61')](_0xfcfd('0x67'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x68')]);router[_0xfcfd('0x61')](_0xfcfd('0x51'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router['delete'](_0xfcfd('0x52'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x69')]);router['delete'](_0xfcfd('0x2b'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x6a')]);router[_0xfcfd('0x61')](_0xfcfd('0x2d'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x6b')]);router[_0xfcfd('0x61')]('/:id/openchannel_accounts',auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x6c')]);router[_0xfcfd('0x61')](_0xfcfd('0x2f'),auth['isAuthenticated'](),controller[_0xfcfd('0x6d')]);router[_0xfcfd('0x61')](_0xfcfd('0x31'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x6e')]);router[_0xfcfd('0x61')](_0xfcfd('0x33'),auth['isAuthenticated'](),controller[_0xfcfd('0x6f')]);router[_0xfcfd('0x61')](_0xfcfd('0x34'),auth[_0xfcfd('0x9')](),controller['removeSquareProjects']);router['delete'](_0xfcfd('0x36'),auth[_0xfcfd('0x9')](),controller[_0xfcfd('0x70')]);module[_0xfcfd('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index f1be9e9..c369339 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 _0x3ae9=['auto','yes','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','passive','actpass','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','force_avp','dtlscertfile','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','name','setDataValue','defaultuser','STRING','fullname','callerid','\x22%s\x22\x20<%s>','email','toLowerCase','user','agent','INTEGER','internal','accountcode','getDataValue','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','from-sip','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband'];(function(_0x4224df,_0x48d1a5){var _0x573fe0=function(_0x220a00){while(--_0x220a00){_0x4224df['push'](_0x4224df['shift']());}};_0x573fe0(++_0x48d1a5);}(_0x3ae9,0xdb));var _0x93ae=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x3ae9[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x93ae('0x0'));var _=require(_0x93ae('0x1'));module[_0x93ae('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x93ae('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x228854){this[_0x93ae('0x4')](_0x93ae('0x3'),_0x228854);this['setDataValue'](_0x93ae('0x5'),_0x228854);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x93ae('0x6')],'allowNull':![],'set':function(_0x32564c){this[_0x93ae('0x4')](_0x93ae('0x7'),_0x32564c);this[_0x93ae('0x4')](_0x93ae('0x8'),util['format'](_0x93ae('0x9'),_0x32564c,this['getDataValue']('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x93ae('0x6')],'allowNull':![],'unique':_0x93ae('0xa'),'validate':{'isEmail':!![]},'set':function(_0x2d0afa){if(_0x2d0afa){this[_0x93ae('0x4')](_0x93ae('0xa'),_0x2d0afa[_0x93ae('0xb')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0x93ae('0xc'),_0x93ae('0xd'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x93ae('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':![],'unique':_0x93ae('0xf'),'set':function(_0x5b4ea1){this[_0x93ae('0x4')](_0x93ae('0xf'),_0x5b4ea1);this[_0x93ae('0x4')](_0x93ae('0x10'),_0x5b4ea1);this[_0x93ae('0x4')](_0x93ae('0x8'),util['format'](_0x93ae('0x9'),this[_0x93ae('0x11')](_0x93ae('0x7')),_0x5b4ea1));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x93ae('0x6')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x93ae('0x6')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x93ae('0x6')]},'country':{'type':Sequelize[_0x93ae('0x6')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x93ae('0x12')]},'voicePause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x93ae('0x6')],'defaultValue':_0x93ae('0x14')},'lastPauseAt':{'type':Sequelize[_0x93ae('0x12')]},'chatCapacity':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':_0x93ae('0x15')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x17'),'user','peer'),'allowNull':!![],'defaultValue':_0x93ae('0x17')},'context':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':_0x93ae('0x18')},'callingpres':{'type':Sequelize[_0x93ae('0x16')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x93ae('0x19'),'PROHIB_NOT_SCREENED',_0x93ae('0x1a'),_0x93ae('0x1b'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':_0x93ae('0x1c'),'set':function(_0x371c53){this['setDataValue'](_0x93ae('0x1d'),_0x371c53?_0x371c53[_0x93ae('0x1e')](','):null);},'get':function(){return this[_0x93ae('0x11')](_0x93ae('0x1d'))?this[_0x93ae('0x11')](_0x93ae('0x1d'))[_0x93ae('0x1f')](','):null;},'comment':_0x93ae('0x20')},'dtmfmode':{'type':Sequelize['ENUM'](_0x93ae('0x21'),'info',_0x93ae('0x22'),_0x93ae('0x23'),_0x93ae('0x24')),'allowNull':!![],'defaultValue':_0x93ae('0x21')},'directmedia':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no','nonat',_0x93ae('0x26'),_0x93ae('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x588916){this[_0x93ae('0x4')](_0x93ae('0x28'),_0x588916?_0x588916[_0x93ae('0x1e')](','):null);},'get':function(){return this[_0x93ae('0x11')](_0x93ae('0x28'))?this[_0x93ae('0x11')](_0x93ae('0x28'))[_0x93ae('0x1f')](','):null;},'comment':_0x93ae('0x29')},'callgroup':{'type':Sequelize[_0x93ae('0x6')]},'namedcallgroup':{'type':Sequelize[_0x93ae('0x6')]},'pickupgroup':{'type':Sequelize[_0x93ae('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x93ae('0x6')]},'language':{'type':Sequelize[_0x93ae('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x93ae('0x6')],'allowNull':![],'defaultValue':_0x93ae('0x2a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x93ae('0x2b'),'set':function(_0x5d6cd6){this['setDataValue'](_0x93ae('0x2c'),_0x5d6cd6?_0x5d6cd6['join'](';'):_0x93ae('0x2b'));},'get':function(){return this[_0x93ae('0x11')](_0x93ae('0x2c'))?this[_0x93ae('0x11')](_0x93ae('0x2c'))[_0x93ae('0x1f')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'set':function(_0x1a8bee){this[_0x93ae('0x4')](_0x93ae('0x2d'),_0x1a8bee?_0x1a8bee[_0x93ae('0x1e')](','):null);},'get':function(){return this[_0x93ae('0x11')](_0x93ae('0x2d'))?this[_0x93ae('0x11')](_0x93ae('0x2d'))['split'](','):null;},'comment':_0x93ae('0x2e')},'trustrpid':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x93ae('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no',_0x93ae('0x2f')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':_0x93ae('0x30')},'amaflags':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x93ae('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x93ae('0x16')]('yes','no',_0x93ae('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x93ae('0x25'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x32'),'refuse',_0x93ae('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x34'),_0x93ae('0x35')),'allowNull':!![],'defaultValue':_0x93ae('0x35')},'t38pt_usertpsource':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x93ae('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x93ae('0x16')]('yes','no','fingerprint',_0x93ae('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x37'),_0x93ae('0x38'),_0x93ae('0x39')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no','nonat',_0x93ae('0x26'),_0x93ae('0x3a')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x93ae('0x12')]},'passwordResetAt':{'type':Sequelize[_0x93ae('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0,'set':function(_0x45ff85){this[_0x93ae('0x4')](_0x93ae('0x3b'),_0x45ff85);var _0xb38655=this[_0x93ae('0x3c')]({'plain':!![]});switch(_0x45ff85){case 0x0:case 0x1:var _0x339459=_0xb38655['transport']?_[_0x93ae('0x3d')](_0xb38655['transport'])?_0xb38655['transport'][_0x93ae('0x1e')]():_0xb38655[_0x93ae('0x1d')]:'udp';if(_0x339459===_0x93ae('0x3e')){_0x339459=_0x93ae('0x1c');}this[_0x93ae('0x4')](_0x93ae('0x1d'),_0x339459);this[_0x93ae('0x4')](_0x93ae('0x3f'),'no');this[_0x93ae('0x4')](_0x93ae('0x40'),null);this[_0x93ae('0x4')]('force_avp',null);this['setDataValue'](_0x93ae('0x41'),null);this[_0x93ae('0x4')](_0x93ae('0x42'),null);this[_0x93ae('0x4')](_0x93ae('0x43'),null);this[_0x93ae('0x4')](_0x93ae('0x44'),null);this['setDataValue']('dtlscertfile',null);this[_0x93ae('0x4')](_0x93ae('0x45'),null);this[_0x93ae('0x4')](_0x93ae('0x46'),'no');break;case 0x2:this[_0x93ae('0x4')](_0x93ae('0x1d'),_0x93ae('0x3e'));this[_0x93ae('0x4')](_0x93ae('0x3f'),'yes');this[_0x93ae('0x4')]('avpf','yes');this[_0x93ae('0x4')](_0x93ae('0x47'),_0x93ae('0x25'));this[_0x93ae('0x4')](_0x93ae('0x41'),_0x93ae('0x25'));this[_0x93ae('0x4')](_0x93ae('0x42'),_0x93ae('0x25'));this[_0x93ae('0x4')](_0x93ae('0x43'),'no');this[_0x93ae('0x4')]('dtlssetup','actpass');this[_0x93ae('0x4')](_0x93ae('0x48'),_0xb38655[_0x93ae('0x48')]||'/etc/pki/tls/certs/motion.crt');this[_0x93ae('0x4')](_0x93ae('0x45'),_0xb38655[_0x93ae('0x45')]||'/etc/pki/tls/private/motion.key');this[_0x93ae('0x4')](_0x93ae('0x46'),_0x93ae('0x25'));break;default:}}},'permissions':{'type':Sequelize[_0x93ae('0x49')],'set':function(_0x119be3){this['setDataValue'](_0x93ae('0x4a'),_0x119be3?_0x119be3[_0x93ae('0x1e')](','):[]);},'get':function(){return this[_0x93ae('0x11')]('permissions')?_[_0x93ae('0x4b')](this[_0x93ae('0x11')]('permissions')[_0x93ae('0x1f')](','),function(_0x239921){return parseInt(_0x239921,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x93ae('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x93ae('0x6')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x93ae('0x6')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x93ae('0x4c')],'get':function(){return this['getDataValue'](_0x93ae('0x4d'))?this[_0x93ae('0x11')](_0x93ae('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x93ae('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4d0b28){if(typeof _0x4d0b28===_0x93ae('0x4e')){var _0x470662=_0x4d0b28==='1'?!![]:_0x4d0b28==='0'?![]:_0x4d0b28===_0x93ae('0x4f')?!![]:_0x4d0b28===_0x93ae('0x50')?![]:![];this[_0x93ae('0x4')]('screenrecording',_0x470662);}else{this[_0x93ae('0x4')](_0x93ae('0x51'),_0x4d0b28);}}},'blocked':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![],'set':function(_0x4355cc){this['setDataValue']('blocked',_0x4355cc);if(_0x4355cc===!![]){this['setDataValue'](_0x93ae('0x52'),moment());this['setDataValue'](_0x93ae('0x53'),0x0);}else{this[_0x93ae('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x93ae('0x12')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x93ae('0xe')](0x5)[_0x93ae('0x54')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]}}; \ No newline at end of file +var _0x7764=['toLowerCase','ENUM','admin','user','agent','telephone','accountcode','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','force_rport,comedia','nat','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','active','passive','actpass','update,nonat','DATE','TEXT','get','isArray','wss','encryption','avpf','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','format','getDataValue','internal','email'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x7764,0xa4));var _0x4776=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7764[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x4776('0x0'));var moment=require(_0x4776('0x1'));var util=require(_0x4776('0x2'));var _=require(_0x4776('0x3'));module[_0x4776('0x4')]={'name':{'type':Sequelize[_0x4776('0x5')],'allowNull':![],'unique':_0x4776('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x424a79){this[_0x4776('0x7')](_0x4776('0x6'),_0x424a79);this['setDataValue']('defaultuser',_0x424a79);},'comment':_0x4776('0x8')},'fullname':{'type':Sequelize[_0x4776('0x5')],'allowNull':![],'set':function(_0x52f59e){this[_0x4776('0x7')](_0x4776('0x9'),_0x52f59e);this['setDataValue']('callerid',util[_0x4776('0xa')]('\x22%s\x22\x20<%s>',_0x52f59e,this[_0x4776('0xb')](_0x4776('0xc'))));}},'alias':{'type':Sequelize[_0x4776('0x5')]},'email':{'type':Sequelize[_0x4776('0x5')],'allowNull':![],'unique':_0x4776('0xd'),'validate':{'isEmail':!![]},'set':function(_0x3a12da){if(_0x3a12da){this[_0x4776('0x7')](_0x4776('0xd'),_0x3a12da[_0x4776('0xe')]());}}},'role':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x10'),_0x4776('0x11'),_0x4776('0x12'),_0x4776('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x4776('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x4776('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x4776('0xc'),'set':function(_0x46429e){this[_0x4776('0x7')](_0x4776('0xc'),_0x46429e);this[_0x4776('0x7')](_0x4776('0x14'),_0x46429e);this[_0x4776('0x7')](_0x4776('0x15'),util[_0x4776('0xa')](_0x4776('0x16'),this['getDataValue'](_0x4776('0x9')),_0x46429e));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4776('0x5')]},'mobile':{'type':Sequelize[_0x4776('0x5')]},'address':{'type':Sequelize[_0x4776('0x5')]},'zipcode':{'type':Sequelize[_0x4776('0x5')]},'userpic':{'type':Sequelize[_0x4776('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4776('0x5')]},'online':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4776('0x5')],'defaultValue':_0x4776('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x4776('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4776('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x4776('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x4776('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x4776('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x4776('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x4776('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x1a'),_0x4776('0x11'),_0x4776('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4776('0x1c')},'callingpres':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x1d'),'ALLOWED_PASSED_SCREEN',_0x4776('0x1e'),'ALLOWED',_0x4776('0x1f'),'PROHIB_PASSED_SCREEN',_0x4776('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![],'defaultValue':_0x4776('0x21'),'set':function(_0x951984){this[_0x4776('0x7')](_0x4776('0x22'),_0x951984?_0x951984[_0x4776('0x23')](','):null);},'get':function(){return this[_0x4776('0xb')]('transport')?this[_0x4776('0xb')](_0x4776('0x22'))[_0x4776('0x24')](','):null;},'comment':_0x4776('0x25')},'dtmfmode':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x26'),_0x4776('0x27'),_0x4776('0x28'),'inband',_0x4776('0x29')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no',_0x4776('0x2b'),_0x4776('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x4776('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![],'defaultValue':_0x4776('0x2d'),'set':function(_0x4fbba6){this['setDataValue'](_0x4776('0x2e'),_0x4fbba6?_0x4fbba6[_0x4776('0x23')](','):null);},'get':function(){return this[_0x4776('0xb')](_0x4776('0x2e'))?this[_0x4776('0xb')](_0x4776('0x2e'))[_0x4776('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4776('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x4776('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x4776('0x5')]},'language':{'type':Sequelize[_0x4776('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4776('0x5')]},'disallow':{'type':Sequelize[_0x4776('0x5')],'allowNull':![],'defaultValue':_0x4776('0x2f')},'allow':{'type':Sequelize[_0x4776('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xd95447){this[_0x4776('0x7')]('allow',_0xd95447?_0xd95447[_0x4776('0x23')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x4776('0xb')]('allow')?this[_0x4776('0xb')](_0x4776('0x30'))['split'](';'):null;},'comment':_0x4776('0x31')},'autoframing':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![],'set':function(_0x8970ae){this[_0x4776('0x7')](_0x4776('0x32'),_0x8970ae?_0x8970ae[_0x4776('0x23')](','):null);},'get':function(){return this[_0x4776('0xb')](_0x4776('0x32'))?this[_0x4776('0xb')](_0x4776('0x32'))[_0x4776('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x4776('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x4776('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x4776('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![],'defaultValue':_0x4776('0x34')},'amaflags':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x4776('0x2a')},'busylevel':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x4776('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no',_0x4776('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4776('0xf')]('accept',_0x4776('0x36'),_0x4776('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x38'),_0x4776('0x39')),'allowNull':!![],'defaultValue':_0x4776('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x4776('0x2a')},'keepalive':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4776('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x4776('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x4776('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x4776('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no',_0x4776('0x3a'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4776('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x3b'),_0x4776('0x3c'),_0x4776('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x4776('0x2a'),'no','nonat','update',_0x4776('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4776('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x4776('0x3f')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x4776('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x51668f){this[_0x4776('0x7')]('showWebBar',_0x51668f);var _0x273714=this[_0x4776('0x41')]({'plain':!![]});switch(_0x51668f){case 0x0:case 0x1:var _0x512ef4=_0x273714['transport']?_[_0x4776('0x42')](_0x273714['transport'])?_0x273714[_0x4776('0x22')][_0x4776('0x23')]():_0x273714[_0x4776('0x22')]:_0x4776('0x21');if(_0x512ef4===_0x4776('0x43')){_0x512ef4=_0x4776('0x21');}this[_0x4776('0x7')](_0x4776('0x22'),_0x512ef4);this['setDataValue'](_0x4776('0x44'),'no');this['setDataValue'](_0x4776('0x45'),null);this[_0x4776('0x7')]('force_avp',null);this[_0x4776('0x7')](_0x4776('0x46'),null);this[_0x4776('0x7')]('dtlsenable',null);this[_0x4776('0x7')](_0x4776('0x47'),null);this[_0x4776('0x7')](_0x4776('0x48'),null);this[_0x4776('0x7')](_0x4776('0x49'),null);this['setDataValue'](_0x4776('0x4a'),null);this[_0x4776('0x7')](_0x4776('0x4b'),'no');break;case 0x2:this[_0x4776('0x7')]('transport',_0x4776('0x43'));this[_0x4776('0x7')]('encryption',_0x4776('0x2a'));this[_0x4776('0x7')]('avpf',_0x4776('0x2a'));this[_0x4776('0x7')](_0x4776('0x4c'),_0x4776('0x2a'));this[_0x4776('0x7')](_0x4776('0x46'),_0x4776('0x2a'));this[_0x4776('0x7')]('dtlsenable',_0x4776('0x2a'));this[_0x4776('0x7')]('dtlsverify','no');this[_0x4776('0x7')](_0x4776('0x48'),_0x4776('0x3d'));this[_0x4776('0x7')](_0x4776('0x49'),_0x273714[_0x4776('0x49')]||_0x4776('0x4d'));this[_0x4776('0x7')](_0x4776('0x4a'),_0x273714[_0x4776('0x4a')]||_0x4776('0x4e'));this[_0x4776('0x7')](_0x4776('0x4b'),_0x4776('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x4776('0x40')],'set':function(_0x206db1){this[_0x4776('0x7')](_0x4776('0x4f'),_0x206db1?_0x206db1['join'](','):[]);},'get':function(){return this[_0x4776('0xb')](_0x4776('0x4f'))?_[_0x4776('0x50')](this[_0x4776('0xb')](_0x4776('0x4f'))[_0x4776('0x24')](','),function(_0x29271f){return parseInt(_0x29271f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x4776('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x4776('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x4776('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x4776('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x4776('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4776('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4776('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4776('0xb')](_0x4776('0x51'))?this[_0x4776('0xb')](_0x4776('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4776('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5cbac1){if(typeof _0x5cbac1==='string'){var _0x37504b=_0x5cbac1==='1'?!![]:_0x5cbac1==='0'?![]:_0x5cbac1===_0x4776('0x52')?!![]:_0x5cbac1===_0x4776('0x53')?![]:![];this[_0x4776('0x7')]('screenrecording',_0x37504b);}else{this['setDataValue'](_0x4776('0x54'),_0x5cbac1);}}},'blocked':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![],'set':function(_0x298971){this[_0x4776('0x7')](_0x4776('0x55'),_0x298971);if(_0x298971===!![]){this['setDataValue'](_0x4776('0x56'),moment());this[_0x4776('0x7')](_0x4776('0x57'),0x0);}else{this[_0x4776('0x7')](_0x4776('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x4776('0x3f')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x4776('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x4776('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4776('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4776('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x4776('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index dd42825..d4fe955 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 _0x4c60=['order','pick','UserVoiceQueueRt','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','login','mobile','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','device','PAUSE','LOGININPAUSE','YYYY-MM-DD\x20HH:mm:ss','logout','pause','QueuePause','updateAttributes','getChannels','forEach','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','manual','%s%s','Pause','getTeams','addTeams','getVoiceQueues','setDataValue','getChatQueues','getMailQueues','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','removeTeams','Chat','Mail','Sms','removeAgent','Queue:remove','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$like','$overlap','$contains','$any','firstName','phone','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','token','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','resolve','queues','teams','inbound','isEmpty','lower','col','toString','desc','asc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unavailable','voiceStatus','QueryTypes','SELECT','select','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','path','squel','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','http','request','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','role','Users','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','send','rawAttributes','fieldName','password','getOptions','where','User','query','include','attributes','push','findAll','rows','length','dataValues','sms','mail','openchannel','whatsapp','all','show','params','differenceBy','keys','salt','intersection','model','fields','includeAll','options','openTabs','true','chat','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','103','113','110','104','105','107','109','111','114','115','create','user','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','previousPasswords','validatePasswordHistory','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','emit','Queue:save','voice','VoiceQueue','get','SIP/%s','voicePause','upsert','remove','isArray','addAvatar','userpic','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','getOpenTabs','fax','ChatOpenTabs','CHAT','FaxOpenTabs','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','filters','sort','merge','hasOwnProperty','CmList','List','Tag','Tags','nolimit','getQueues','Queue'];(function(_0x512cd0,_0x4dcad3){var _0x21a02a=function(_0x47a5c5){while(--_0x47a5c5){_0x512cd0['push'](_0x512cd0['shift']());}};_0x21a02a(++_0x4dcad3);}(_0x4c60,0xc1));var _0x04c6=function(_0x1d01a0,_0x41ad0e){_0x1d01a0=_0x1d01a0-0x0;var _0x1e5a7a=_0x4c60[_0x1d01a0];return _0x1e5a7a;};'use strict';var moment=require(_0x04c6('0x0'));var BPromise=require(_0x04c6('0x1'));var util=require(_0x04c6('0x2'));var path=require(_0x04c6('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x04c6('0x4'));var jayson=require('jayson/promise');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var logger=require(_0x04c6('0x5'))(_0x04c6('0x6'));var utils=require(_0x04c6('0x7'));var config=require(_0x04c6('0x8'));var licenseUtil=require(_0x04c6('0x9'));var db=require(_0x04c6('0xa'))['db'];var socket=require(_0x04c6('0xb'))(new Redis(config['redis']));require(_0x04c6('0xc'))[_0x04c6('0xd')](socket);config[_0x04c6('0xe')]=_[_0x04c6('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var client=jayson['client'][_0x04c6('0x10')]({'port':0x232a});var values;function respondWithRpcPromise(_0x5584cd,_0x15d31a,_0x2772fa,_0x5236c8){return new BPromise(function(_0x4316f8,_0x19eb01){var _0x119187=_0x5236c8||client;return _0x119187[_0x04c6('0x11')](_0x5584cd,_0x2772fa)['then'](function(_0x257a0a){logger[_0x04c6('0x12')](_0x04c6('0x13'),_0x15d31a,'request\x20sent');logger[_0x04c6('0x14')](_0x04c6('0x15'),_0x15d31a,_0x04c6('0x16'),JSON[_0x04c6('0x17')](_0x257a0a));if(_0x257a0a[_0x04c6('0x18')]){if(_0x257a0a[_0x04c6('0x18')][_0x04c6('0x19')]===0x1f4){logger[_0x04c6('0x18')]('User,\x20%s,\x20%s',_0x15d31a,_0x257a0a[_0x04c6('0x18')][_0x04c6('0x1a')]);return _0x19eb01(_0x257a0a[_0x04c6('0x18')][_0x04c6('0x1a')]);}logger[_0x04c6('0x18')](_0x04c6('0x13'),_0x15d31a,_0x257a0a[_0x04c6('0x18')][_0x04c6('0x1a')]);return _0x4316f8(_0x257a0a['error'][_0x04c6('0x1a')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x13'),_0x15d31a,'request\x20sent');_0x4316f8(_0x257a0a['result']['message']);}})[_0x04c6('0x1b')](function(_0xb997e0){logger['error']('User,\x20%s,\x20%s',_0x15d31a,_0xb997e0);_0x19eb01(_0xb997e0);});});}function respondWithStatusCode(_0x1e6854,_0x2eed94){_0x2eed94=_0x2eed94||0xcc;return function(_0x3cd448){if(_0x3cd448){return _0x1e6854['sendStatus'](_0x2eed94);}return _0x1e6854[_0x04c6('0x1c')](_0x2eed94)[_0x04c6('0x1d')]();};}function respondWithResult(_0x9d41f8,_0x49c179){_0x49c179=_0x49c179||0xc8;return function(_0x2d3277){if(_0x2d3277){return _0x9d41f8[_0x04c6('0x1c')](_0x49c179)['json'](_0x2d3277);}};}function respondWithFilteredResult(_0x54a8b0,_0x4c8d72){return function(_0x348ea3){if(_0x348ea3){var _0x3a2014=typeof _0x4c8d72[_0x04c6('0x1e')]===_0x04c6('0x1f')&&typeof _0x4c8d72[_0x04c6('0x20')]==='undefined';var _0x562952=_0x348ea3[_0x04c6('0x21')];var _0x2ab1d2=_0x3a2014?0x0:_0x4c8d72[_0x04c6('0x1e')];var _0x3233d7=_0x3a2014?_0x348ea3[_0x04c6('0x21')]:_0x4c8d72[_0x04c6('0x1e')]+_0x4c8d72['limit'];var _0x1d0d3f;if(_0x3233d7>=_0x562952){_0x3233d7=_0x562952;_0x1d0d3f=0xc8;}else{_0x1d0d3f=0xce;}_0x54a8b0[_0x04c6('0x1c')](_0x1d0d3f);return _0x54a8b0['set'](_0x04c6('0x22'),_0x2ab1d2+'-'+_0x3233d7+'/'+_0x562952)[_0x04c6('0x23')](_0x348ea3);}return null;};}function saveUpdates(_0x5f1331){return function(_0x5c9003){if(_0x5c9003){return _0x5c9003[_0x04c6('0x24')](_0x5f1331)[_0x04c6('0x25')](function(_0x2a191f){return _0x2a191f;});}return null;};}function removeEntity(_0xbb9e81){return function(_0x23c500){if(_0x23c500){return _0x23c500[_0x04c6('0x26')]()['then'](function(){var _0x5d8c88=_0x23c500['get']({'plain':!![]});if(_0x5d8c88[_0x04c6('0x27')]==='admin')return;var _0x1e76e2=[{'name':_0x04c6('0x28'),'value':'user','ignore':!![]},{'name':_0x04c6('0x29'),'value':_0x04c6('0x2a'),'ignore':![]},{'name':_0x04c6('0x2b'),'value':_0x04c6('0x2c'),'ignore':![]}];var _0x5b2056=_(_0x1e76e2)[_0x04c6('0x2d')](_0x04c6('0x2e'))[_0x04c6('0x2f')](_0x04c6('0x30'))[_0x04c6('0x30')]();if(_[_0x04c6('0x31')](_0x5b2056,_0x5d8c88[_0x04c6('0x27')])){return;}var _0x46380e=_[_0x04c6('0x32')](_0x1e76e2,[_0x04c6('0x30'),_0x5d8c88[_0x04c6('0x27')]])[_0x04c6('0x33')];return db[_0x04c6('0x34')][_0x04c6('0x26')]({'where':{'type':_0x46380e,'resourceId':_0x5d8c88['id']}})[_0x04c6('0x25')](function(){return _0x23c500;});})['then'](function(){_0xbb9e81[_0x04c6('0x1c')](0xcc)[_0x04c6('0x1d')]();});}};}function handleEntityNotFound(_0x332811){return function(_0x206e32){if(!_0x206e32){_0x332811['sendStatus'](0x194);}return _0x206e32;};}function handleError(_0x181736,_0x31de0f){_0x31de0f=_0x31de0f||0x1f4;return function(_0x4e1cfa){logger['error'](_0x4e1cfa['stack']);if(_0x4e1cfa[_0x04c6('0x33')]){delete _0x4e1cfa[_0x04c6('0x33')];}_0x181736['status'](_0x31de0f)[_0x04c6('0x35')](_0x4e1cfa);};}exports['index']=function(_0x15c270,_0x1373ca){var _0x3806ea={},_0x2b28cd={'count':0x0,'rows':[]};var _0x5144f5=_(db['User'][_0x04c6('0x36')])[_0x04c6('0x2f')](function(_0x50041f){return{'name':_0x50041f[_0x04c6('0x37')],'type':_0x50041f['type']['key']};})[_0x04c6('0x2d')](function(_0x5aede6){return!_[_0x04c6('0x31')]([_0x04c6('0x38'),'salt'],_0x5aede6[_0x04c6('0x33')]);})['value']();_0x3806ea=qs[_0x04c6('0x39')](_0x5144f5,_0x15c270);var _0x39513d={'where':_0x3806ea[_0x04c6('0x3a')]};return db[_0x04c6('0x3b')][_0x04c6('0x21')](_0x39513d)['then'](function(_0x297b25){_0x2b28cd['count']=_0x297b25;if(_0x15c270[_0x04c6('0x3c')]['includeAll']){_0x3806ea[_0x04c6('0x3d')]=[{'all':!![]}];}if(!_[_0x04c6('0x31')](_0x3806ea[_0x04c6('0x3e')],'id')){_0x3806ea[_0x04c6('0x3e')][_0x04c6('0x3f')]('id');}return db[_0x04c6('0x3b')][_0x04c6('0x40')](_0x3806ea);})['then'](function(_0xdfdc34){_0x2b28cd['rows']=_0xdfdc34;if(_0x15c270[_0x04c6('0x3c')]['openTabs']==='true'){var _0x463222=[];for(var _0x58a9ad=0x0;_0x58a9ad<_0x2b28cd[_0x04c6('0x41')][_0x04c6('0x42')];_0x58a9ad++){_0x463222[_0x04c6('0x3f')](get_open_tabs('chat',_0x2b28cd[_0x04c6('0x41')][_0x58a9ad][_0x04c6('0x43')]));_0x463222[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x44'),_0x2b28cd[_0x04c6('0x41')][_0x58a9ad][_0x04c6('0x43')]));_0x463222[_0x04c6('0x3f')](get_open_tabs('fax',_0x2b28cd['rows'][_0x58a9ad][_0x04c6('0x43')]));_0x463222[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x45'),_0x2b28cd['rows'][_0x58a9ad][_0x04c6('0x43')]));_0x463222[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x46'),_0x2b28cd['rows'][_0x58a9ad]['dataValues']));_0x463222['push'](get_open_tabs(_0x04c6('0x47'),_0x2b28cd[_0x04c6('0x41')][_0x58a9ad]['dataValues']));}return BPromise[_0x04c6('0x48')](_0x463222)[_0x04c6('0x25')](function(_0x2bd045){return _0x2b28cd;});}else{return _0x2b28cd;}})['then'](respondWithFilteredResult(_0x1373ca,_0x3806ea))[_0x04c6('0x1b')](handleError(_0x1373ca,null));};exports[_0x04c6('0x49')]=function(_0x5e68e0,_0x25a6fc){var _0x203943={'raw':![],'where':{'id':_0x5e68e0[_0x04c6('0x4a')]['id']}},_0x2472ed={};_0x2472ed['model']=_[_0x04c6('0x4b')](_[_0x04c6('0x4c')](db[_0x04c6('0x3b')][_0x04c6('0x36')]),['password',_0x04c6('0x4d')]);_0x2472ed[_0x04c6('0x3c')]=_[_0x04c6('0x4c')](_0x5e68e0[_0x04c6('0x3c')]);_0x2472ed['filters']=_[_0x04c6('0x4e')](_0x2472ed[_0x04c6('0x4f')],_0x2472ed[_0x04c6('0x3c')]);_0x203943['attributes']=_[_0x04c6('0x4e')](_0x2472ed[_0x04c6('0x4f')],qs[_0x04c6('0x50')](_0x5e68e0[_0x04c6('0x3c')][_0x04c6('0x50')]));_0x203943[_0x04c6('0x3e')]=_0x203943[_0x04c6('0x3e')][_0x04c6('0x42')]?_0x203943[_0x04c6('0x3e')]:_0x2472ed[_0x04c6('0x4f')];if(_0x5e68e0[_0x04c6('0x3c')][_0x04c6('0x51')]){_0x203943[_0x04c6('0x3d')]=[{'all':!![]}];}_0x203943=_['merge']({},_0x203943,_0x5e68e0[_0x04c6('0x52')]);if(!_[_0x04c6('0x31')](_0x203943[_0x04c6('0x3e')],'id')){_0x203943[_0x04c6('0x3e')][_0x04c6('0x3f')]('id');}return db['User'][_0x04c6('0x32')](_0x203943)[_0x04c6('0x25')](handleEntityNotFound(_0x25a6fc,null))[_0x04c6('0x25')](function(_0x32d5e8){var _0x28dfd0=[];values=_0x32d5e8;if(_0x5e68e0[_0x04c6('0x3c')][_0x04c6('0x53')]===_0x04c6('0x54')){_0x28dfd0[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x55'),_0x32d5e8['dataValues']));_0x28dfd0['push'](get_open_tabs('sms',_0x32d5e8['dataValues']));_0x28dfd0[_0x04c6('0x3f')](get_open_tabs('openchannel',_0x32d5e8[_0x04c6('0x43')]));_0x28dfd0['push'](get_open_tabs(_0x04c6('0x47'),_0x32d5e8[_0x04c6('0x43')]));_0x28dfd0['push'](get_open_tabs('fax',_0x32d5e8[_0x04c6('0x43')]));_0x28dfd0[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x45'),_0x32d5e8[_0x04c6('0x43')]));return BPromise['all'](_0x28dfd0);}else{return values;}})[_0x04c6('0x25')](function(_0xf4e9d6){return values;})[_0x04c6('0x25')](respondWithResult(_0x25a6fc,null))[_0x04c6('0x1b')](handleError(_0x25a6fc,null));};exports[_0x04c6('0x24')]=function(_0x29c72f,_0x145854){if(_0x29c72f['body']['id']){delete _0x29c72f[_0x04c6('0x56')]['id'];}delete _0x29c72f['body'][_0x04c6('0x27')];return db[_0x04c6('0x3b')]['find']({'where':{'id':_0x29c72f[_0x04c6('0x4a')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x145854,null))[_0x04c6('0x25')](saveUpdates(_0x29c72f[_0x04c6('0x56')],null))[_0x04c6('0x25')](respondWithResult(_0x145854,null))[_0x04c6('0x1b')](handleError(_0x145854,null));};exports[_0x04c6('0x57')]=function(_0x3333a4,_0x5c51dc){return db[_0x04c6('0x3b')]['describe']()[_0x04c6('0x25')](respondWithResult(_0x5c51dc,null))[_0x04c6('0x1b')](handleError(_0x5c51dc,null));};exports['addContacts']=function(_0x503426,_0x2e649d){return db['User'][_0x04c6('0x32')]({'where':{'id':_0x503426[_0x04c6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e649d,null))[_0x04c6('0x25')](function(_0x4520f0){if(_0x4520f0){return _0x4520f0[_0x04c6('0x58')](_0x503426[_0x04c6('0x56')][_0x04c6('0x59')],_[_0x04c6('0x5a')](_0x503426[_0x04c6('0x56')],[_0x04c6('0x59'),'id'])||{});}})[_0x04c6('0x25')](respondWithResult(_0x2e649d,null))[_0x04c6('0x1b')](handleError(_0x2e649d,null));};function validateUser(_0x2c9c36){return new BPromise(function(_0x52413f,_0x3aaa1e){if(_0x2c9c36[_0x04c6('0x5b')])return _0x52413f(_0x2c9c36);return db[_0x04c6('0x5c')][_0x04c6('0x5d')](0x1)['then'](function(_0x1598f0){if(_0x1598f0[_0x04c6('0x5e')])authService[_0x04c6('0x5f')](_0x2c9c36['password']);db['User'][_0x04c6('0x60')](_0x04c6('0x5b'))[_0x04c6('0x25')](function(_0x396f79){if(_[_0x04c6('0x61')](_0x396f79)){_0x2c9c36[_0x04c6('0x5b')]=_0x1598f0['min_internal']||0x1;return;}if(_[_0x04c6('0x61')](_0x1598f0[_0x04c6('0x62')])||_0x1598f0[_0x04c6('0x62')]===_0x396f79){_0x2c9c36['internal']=_0x396f79+0x1;return;}if(_0x1598f0['min_internal']>_0x396f79){_0x2c9c36[_0x04c6('0x5b')]=_0x1598f0[_0x04c6('0x62')];return;}return db[_0x04c6('0x63')][_0x04c6('0x3c')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x04c6('0x63')]['QueryTypes']['SELECT']})[_0x04c6('0x25')](function(_0xe178dd){if(_0xe178dd&&_0xe178dd[_0x04c6('0x42')]){for(var _0x1904d4=0x0,_0x43260e=_0xe178dd[_0x04c6('0x42')];_0x1904d4<_0x43260e&&_[_0x04c6('0x61')](_0x2c9c36['internal']);_0x1904d4++){if(_0x1598f0[_0x04c6('0x62')]<=_0xe178dd[_0x1904d4][_0x04c6('0x64')]){_0x2c9c36[_0x04c6('0x5b')]=_0xe178dd[_0x1904d4][_0x04c6('0x64')];}else if(_0x1598f0[_0x04c6('0x62')]>_0xe178dd[_0x1904d4]['from']&&_0x1598f0['min_internal']<=_0xe178dd[_0x1904d4]['to']){_0x2c9c36[_0x04c6('0x5b')]=_0x1598f0[_0x04c6('0x62')];}}}if(_[_0x04c6('0x61')](_0x2c9c36['internal'])){_0x2c9c36[_0x04c6('0x5b')]=_0x396f79+0x1;}return _0x52413f(_0x2c9c36);});});})[_0x04c6('0x1b')](function(_0x4c9507){_0x3aaa1e(_0x4c9507);});});}function updateUser(_0x12d92e){return new BPromise(function(_0x866829,_0x152a00){try{if(_0x12d92e[_0x04c6('0x65')]){_0x12d92e[_0x04c6('0x66')]=_0x12d92e[_0x04c6('0x5b')];_0x12d92e[_0x04c6('0x67')]={'mailbox':_0x12d92e[_0x04c6('0x5b')],'password':_0x12d92e[_0x04c6('0x38')],'fullname':_0x12d92e[_0x04c6('0x68')],'email':_0x12d92e[_0x04c6('0x69')]};}if(_0x12d92e[_0x04c6('0x27')]===_0x04c6('0x2a')){if(!_0x12d92e['permissions'])_0x12d92e[_0x04c6('0x6a')]=[_0x04c6('0x6b'),'102',_0x04c6('0x6c'),_0x04c6('0x6d'),_0x04c6('0x6e'),_0x04c6('0x6f'),_0x04c6('0x70'),'106',_0x04c6('0x71'),'108',_0x04c6('0x72'),'100',_0x04c6('0x73'),_0x04c6('0x74'),_0x04c6('0x75')];}_0x866829(_0x12d92e);}catch(_0x23ce75){_0x152a00(_0x23ce75);}});}exports[_0x04c6('0x76')]=function(_0x150639,_0x34f7a6){if(_0x150639[_0x04c6('0x77')][_0x04c6('0x27')]==='agent')throw new Error(_0x04c6('0x78'));if(_0x150639[_0x04c6('0x56')]['role']===_0x04c6('0x77')&&_0x150639['user'][_0x04c6('0x27')]!==_0x04c6('0x79')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x150639[_0x04c6('0x56')][_0x04c6('0x27')]==='admin'&&_0x150639[_0x04c6('0x77')][_0x04c6('0x27')]!=='admin'){throw new Error(_0x04c6('0x7a'));}return licenseUtil[_0x04c6('0x7b')]([_0x150639['body']])[_0x04c6('0x25')](function(){return validateUser(_0x150639[_0x04c6('0x56')]);})['then'](function(_0x5314ee){return updateUser(_0x5314ee)['then'](function(_0x37d3e0){if(_0x37d3e0[_0x04c6('0x27')]===_0x04c6('0x79')){_0x37d3e0[_0x04c6('0x7c')]=_0x150639[_0x04c6('0x77')]['settingsEnabled'];delete _0x37d3e0[_0x04c6('0x7d')];}return _0x37d3e0;});})[_0x04c6('0x25')](function(_0x1a5356){return db[_0x04c6('0x3b')][_0x04c6('0x76')](_0x1a5356,{'include':[{'model':db[_0x04c6('0x67')],'as':_0x04c6('0x67')}]});})['then'](function(_0x22e182){if(_0x150639['body'][_0x04c6('0x27')]==='user')return _0x22e182;if(_0x150639['user'][_0x04c6('0x27')]!=='user')return _0x22e182;return db[_0x04c6('0x7e')][_0x04c6('0x32')]({'where':{'name':_0x22e182[_0x04c6('0x27')]===_0x04c6('0x2a')?_0x04c6('0x29'):'Telephones','userProfileId':_0x150639['user'][_0x04c6('0x7d')]},'raw':!![]})[_0x04c6('0x25')](function(_0x38d8b2){if(!_0x38d8b2||_0x38d8b2[_0x04c6('0x7f')]!=0x0)return _0x22e182;return db[_0x04c6('0x34')][_0x04c6('0x76')]({'name':_0x22e182['name'],'resourceId':_0x22e182['id'],'type':_0x38d8b2[_0x04c6('0x33')],'sectionId':_0x38d8b2['id']},{})['then'](function(){return _0x22e182;});})['catch'](function(_0x866f47){logger[_0x04c6('0x18')](_0x04c6('0x80'),_0x866f47);throw _0x866f47;});})[_0x04c6('0x25')](respondWithResult(_0x34f7a6,0xc9))[_0x04c6('0x1b')](handleError(_0x34f7a6,null));};exports[_0x04c6('0x81')]=function(_0x2e65f0,_0x243553){var _0x338e58=_0x2e65f0[_0x04c6('0x56')];var _0x21dc7c=[];if(_0x2e65f0['user'][_0x04c6('0x27')]==='agent')throw new Error('Unauthorized');if(_[_0x04c6('0x82')](_0x338e58,[_0x04c6('0x27'),_0x04c6('0x77')])&&_0x2e65f0[_0x04c6('0x77')][_0x04c6('0x27')]!==_0x04c6('0x79')){throw new Error(_0x04c6('0x83'));}if(_[_0x04c6('0x82')](_0x338e58,[_0x04c6('0x27'),_0x04c6('0x79')])&&_0x2e65f0[_0x04c6('0x77')]['role']!=='admin'){throw new Error(_0x04c6('0x84'));}return licenseUtil[_0x04c6('0x7b')](_0x338e58)['then'](function(){return validateUser(_0x338e58[0x0]);})[_0x04c6('0x25')](function(){for(var _0x3addb1=0x1;_0x3addb1<_0x338e58['length'];_0x3addb1++){var _0x4504fc=_0x338e58[_0x3addb1-0x1][_0x04c6('0x5b')];if(!_0x338e58[_0x3addb1][_0x04c6('0x5b')])_0x338e58[_0x3addb1][_0x04c6('0x5b')]=_0x4504fc+0x1;_0x21dc7c[_0x04c6('0x3f')](validateUser(_0x338e58[_0x3addb1]));}return BPromise[_0x04c6('0x48')](_0x21dc7c);})[_0x04c6('0x25')](function(){_0x21dc7c=[];for(var _0x5efcc8=0x0;_0x5efcc8<_0x338e58['length'];_0x5efcc8++){_0x21dc7c[_0x04c6('0x3f')](updateUser(_0x338e58[_0x5efcc8]));}return BPromise['all'](_0x21dc7c);})[_0x04c6('0x25')](function(){return BPromise[_0x04c6('0x85')](_0x338e58,function(_0x23b79a){return db[_0x04c6('0x3b')][_0x04c6('0x76')](_0x23b79a,{'include':[{'model':db[_0x04c6('0x67')],'as':'VoiceMail'}]})[_0x04c6('0x25')](function(_0x1b7cec){_0x23b79a['id']=_0x1b7cec['id'];return _0x23b79a;});});})[_0x04c6('0x25')](function(_0x54fe47){if(_0x2e65f0['body']['role']===_0x04c6('0x77'))return _0x54fe47;if(_0x2e65f0[_0x04c6('0x77')]['role']!==_0x04c6('0x77'))return _0x54fe47;var _0x29461e=_[_0x04c6('0x82')](_0x54fe47,function(_0x5c47a4){return _0x5c47a4[_0x04c6('0x27')]==='agent'||_0x5c47a4[_0x04c6('0x27')]===_0x04c6('0x2c');});if(!_0x29461e)return _0x54fe47;return db[_0x04c6('0x7e')]['findAll']({'where':{'name':{'$or':['Agents',_0x04c6('0x2b')]},'userProfileId':_0x2e65f0[_0x04c6('0x77')][_0x04c6('0x7d')]},'raw':!![]})[_0x04c6('0x25')](function(_0x546f5d){if(_['isEmpty'](_0x546f5d)||!_[_0x04c6('0x82')](_0x546f5d,[_0x04c6('0x7f'),0x0]))return _0x54fe47;_0x21dc7c=[];var _0x91f883=_(_0x546f5d)['map'](function(_0x2c1536){if(_0x2c1536[_0x04c6('0x7f')]===0x1)return;return _0x2c1536[_0x04c6('0x33')]===_0x04c6('0x29')?_0x04c6('0x2a'):_0x04c6('0x2c');})[_0x04c6('0x86')]()[_0x04c6('0x30')]();for(var _0x2192ff=0x0;_0x2192ff<_0x54fe47[_0x04c6('0x42')];_0x2192ff++){if(!_['includes'](_0x91f883,_0x54fe47[_0x2192ff][_0x04c6('0x27')]))return;var _0x388811=_0x54fe47[_0x2192ff][_0x04c6('0x27')]===_0x04c6('0x2a')?_0x04c6('0x29'):_0x04c6('0x2b');_0x21dc7c[_0x04c6('0x3f')](db['UserProfileResource'][_0x04c6('0x76')]({'name':_0x54fe47[_0x2192ff][_0x04c6('0x33')],'resourceId':_0x54fe47[_0x2192ff]['id'],'type':_0x388811,'sectionId':_[_0x04c6('0x32')](_0x546f5d,[_0x04c6('0x33'),_0x388811])['id']},{}));}return BPromise[_0x04c6('0x48')](_0x21dc7c);});})[_0x04c6('0x25')](respondWithResult(_0x243553,0xc9))[_0x04c6('0x1b')](handleError(_0x243553,null));};exports[_0x04c6('0x87')]=function(_0x4bfb6c,_0x203630){if(_0x4bfb6c[_0x04c6('0x56')]['id']){delete _0x4bfb6c['body']['id'];}return db[_0x04c6('0x3b')][_0x04c6('0x32')]({'where':{'id':_0x4bfb6c[_0x04c6('0x4a')]['id']}})[_0x04c6('0x25')](function(_0x29b5f2){if(!_0x29b5f2)return null;if(_0x29b5f2['id']===_0x4bfb6c['user']['id']){if(!_0x4bfb6c['body'][_0x04c6('0x88')]||!_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x89')]){throw new db['Sequelize'][(_0x04c6('0x8a'))](_0x04c6('0x8b'));}if(!_0x29b5f2['authenticate'](_0x4bfb6c['body'][_0x04c6('0x88')])){throw new db[(_0x04c6('0x8c'))]['ValidationError'](_0x04c6('0x8d'));}if(_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x88')]===_0x4bfb6c[_0x04c6('0x56')]['newPassword']){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x8e'));}}else if(_0x4bfb6c[_0x04c6('0x77')][_0x04c6('0x27')]===_0x04c6('0x79')){if(!_0x4bfb6c['body'][_0x04c6('0x89')]){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x8f'));}}else if(_0x4bfb6c[_0x04c6('0x77')][_0x04c6('0x27')]===_0x04c6('0x77')){if(!_0x4bfb6c[_0x04c6('0x56')]['newPassword']){throw new db['Sequelize'][(_0x04c6('0x8a'))](_0x04c6('0x8f'));}if(_0x29b5f2[_0x04c6('0x27')]!=='agent'){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x78'));}}else{throw new db['Sequelize']['ValidationError'](_0x04c6('0x78'));}return _0x29b5f2;})[_0x04c6('0x25')](handleEntityNotFound(_0x203630,null))[_0x04c6('0x25')](function(_0x414e80){return db[_0x04c6('0x5c')][_0x04c6('0x90')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})[_0x04c6('0x25')](function(_0x531c75){if(_0x531c75['securePassword'])authService[_0x04c6('0x5f')](_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x89')]);if(!_0x531c75['enforcePasswordHistory']||!_0x414e80[_0x04c6('0x91')])return _0x414e80;authService[_0x04c6('0x92')](_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x89')],_0x414e80['previousPasswords'],_0x531c75['passwordHistoryLimit']);return _0x414e80;})['then'](saveUpdates({'password':_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x89')],'passwordResetAt':_0x4bfb6c['user']['id']==_0x4bfb6c['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4bfb6c[_0x04c6('0x56')]['newPassword'],_0x414e80[_0x04c6('0x91')])},null));})[_0x04c6('0x25')](respondWithResult(_0x203630,null))[_0x04c6('0x1b')](handleError(_0x203630,null));};exports[_0x04c6('0x93')]=function(_0x3906b2,_0x410bc2){var _0x59a97f=_0x3906b2[_0x04c6('0x56')][_0x04c6('0x94')];return db[_0x04c6('0x3b')][_0x04c6('0x32')]({'where':{'id':_0x3906b2[_0x04c6('0x4a')]['id']},'attributes':['id','name',_0x04c6('0x27'),_0x04c6('0x95'),_0x04c6('0x96'),'voicePause',_0x04c6('0x97')]})[_0x04c6('0x25')](handleEntityNotFound(_0x410bc2,null))[_0x04c6('0x25')](function(_0x5ee1d3){if(_0x5ee1d3){if(!utils[_0x04c6('0x98')](_0x59a97f)){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x99'));}return _0x5ee1d3[_0x04c6('0x9a')+_[_0x04c6('0x9b')](_0x59a97f[_0x04c6('0x9c')]())+_0x04c6('0x9d')](_0x3906b2['body'][_0x04c6('0x59')],{'penalty':_0x3906b2[_0x04c6('0x56')][_0x04c6('0x9e')]||0x0})['spread'](function(_0x55f0b9){for(var _0x4dfaa4=0x0;_0x4dfaa4<_0x3906b2[_0x04c6('0x56')][_0x04c6('0x59')][_0x04c6('0x42')];_0x4dfaa4+=0x1){var _0x579168={'UserId':Number(_0x3906b2[_0x04c6('0x4a')]['id'])};_0x579168[_[_0x04c6('0x9b')](_0x59a97f[_0x04c6('0x9c')]())+_0x04c6('0x9f')]=Number(_0x3906b2['body'][_0x04c6('0x59')][_0x4dfaa4]);socket[_0x04c6('0xa0')](_0x04c6('0x77')+_[_0x04c6('0x9b')](_0x59a97f['toLowerCase']())+_0x04c6('0xa1'),_0x579168);}return _0x55f0b9;})['then'](function(){if(_0x59a97f===_0x04c6('0xa2')){return db[_0x04c6('0xa3')]['findAll']({'where':{'id':_0x3906b2[_0x04c6('0x56')][_0x04c6('0x59')]||[]},'raw':!![],'attributes':['id',_0x04c6('0x33')]});}})['then'](function(_0x39985f){var _0x2e71fa=_0x5ee1d3[_0x04c6('0xa4')]({'plain':!![]});var _0x4fb402=[];if(_0x59a97f===_0x04c6('0xa2')&&_0x2e71fa[_0x04c6('0x27')]==='agent'&&_0x2e71fa['online']){for(var _0x487c2a=0x0;_0x487c2a<_0x39985f['length'];_0x487c2a+=0x1){_0x4fb402[_0x04c6('0x3f')]({'membername':_0x2e71fa[_0x04c6('0x33')],'UserId':_0x2e71fa['id'],'queue_name':_0x39985f[_0x487c2a]['name'],'VoiceQueueId':_0x39985f[_0x487c2a]['id'],'interface':_[_0x04c6('0x61')](_0x2e71fa[_0x04c6('0x97')])?util['format'](_0x04c6('0xa5'),_0x2e71fa[_0x04c6('0x33')]):_0x2e71fa['interface'],'paused':_0x2e71fa[_0x04c6('0xa6')]||![],'penalty':_0x3906b2[_0x04c6('0x56')][_0x04c6('0x9e')]||0x0});}return BPromise['each'](_0x4fb402,function(_0x4c616d){return db['UserVoiceQueueRt'][_0x04c6('0xa7')](_0x4c616d);});}return _0x5ee1d3;});}})[_0x04c6('0x25')](respondWithStatusCode(_0x410bc2,null))[_0x04c6('0x1b')](handleError(_0x410bc2,null));};exports['removeQueues']=function(_0x4ed0a4,_0x55c939){var _0x29e5b4;return db['User']['find']({'where':{'id':_0x4ed0a4[_0x04c6('0x4a')]['id']},'attributes':['id','name',_0x04c6('0x27')]})[_0x04c6('0x25')](handleEntityNotFound(_0x55c939,null))[_0x04c6('0x25')](function(_0x287fa8){if(_0x287fa8){_0x29e5b4=_0x287fa8;if(!_0x4ed0a4[_0x04c6('0x3c')]['channel']||!utils['isValidChannel'](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')])){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x99'));}return _0x287fa8[_0x04c6('0xa8')+_['capitalize'](_0x4ed0a4['query'][_0x04c6('0x94')][_0x04c6('0x9c')]())+'Queues'](_0x4ed0a4[_0x04c6('0x3c')]['ids']);}})['then'](function(_0x3a9b88){if(_[_0x04c6('0xa9')](_0x4ed0a4['query'][_0x04c6('0x59')])){for(var _0x314e68=0x0;_0x314e68<_0x4ed0a4[_0x04c6('0x3c')]['ids'][_0x04c6('0x42')];_0x314e68+=0x1){var _0x7b32e6={'UserId':Number(_0x4ed0a4[_0x04c6('0x4a')]['id'])};_0x7b32e6[_[_0x04c6('0x9b')](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')][_0x04c6('0x9c')]())+_0x04c6('0x9f')]=Number(_0x4ed0a4['query'][_0x04c6('0x59')][_0x314e68]);socket['emit'](_0x04c6('0x77')+_[_0x04c6('0x9b')](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')][_0x04c6('0x9c')]())+'Queue:remove',_0x7b32e6);}}else{var _0x7b32e6={'UserId':Number(_0x4ed0a4[_0x04c6('0x4a')]['id'])};_0x7b32e6[_['capitalize'](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')][_0x04c6('0x9c')]())+'QueueId']=Number(_0x4ed0a4[_0x04c6('0x3c')]['ids']);socket['emit'](_0x04c6('0x77')+_['capitalize'](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')][_0x04c6('0x9c')]())+'Queue:remove',_0x7b32e6);}return _0x3a9b88;})[_0x04c6('0x25')](function(){if(_0x4ed0a4['query'][_0x04c6('0x94')]==='voice'){return db['UserVoiceQueueRt'][_0x04c6('0x26')]({'where':{'UserId':_0x4ed0a4['params']['id'],'VoiceQueueId':_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x59')]},'individualHooks':!![]})[_0x04c6('0x25')](function(){return _0x29e5b4;});}return _0x29e5b4;})[_0x04c6('0x25')](respondWithStatusCode(_0x55c939,null))[_0x04c6('0x1b')](handleError(_0x55c939,null));};exports[_0x04c6('0xaa')]=function(_0x257524,_0x81e27b){_0x257524[_0x04c6('0x56')][_0x04c6('0xab')]=_0x257524['file']['filename'];return db[_0x04c6('0x3b')][_0x04c6('0x32')]({'where':{'id':_0x257524[_0x04c6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x81e27b,null))[_0x04c6('0x25')](saveUpdates(_0x257524['body'],null))['then'](respondWithResult(_0x81e27b,null))[_0x04c6('0x1b')](handleError(_0x81e27b,null));};exports[_0x04c6('0xac')]=function(_0x3a3d48,_0xeca2d9){var _0x4bf86a=path['join'](config[_0x04c6('0xad')],_0x04c6('0xae'));return db['User'][_0x04c6('0x32')]({'where':{'id':_0x3a3d48[_0x04c6('0x4a')]['id']},'attributes':['id',_0x04c6('0xab')],'raw':!![]})['then'](handleEntityNotFound(_0xeca2d9,null))['then'](function(_0x37fbde){if(_0x37fbde){if(_[_0x04c6('0x61')](_0x37fbde[_0x04c6('0xab')])){return _0xeca2d9[_0x04c6('0xaf')](_0x4bf86a);}else{if(!fs[_0x04c6('0xb0')](path[_0x04c6('0xb1')](config[_0x04c6('0xad')],_0x04c6('0xb2'),_0x37fbde['userpic']))){return _0xeca2d9['download'](_0x4bf86a);}return _0xeca2d9['download'](path[_0x04c6('0xb1')](config[_0x04c6('0xad')],_0x04c6('0xb2'),_0x37fbde[_0x04c6('0xab')]));}}})[_0x04c6('0x1b')](handleError(_0xeca2d9,null));};exports[_0x04c6('0xb3')]=function(_0xc7dfe5,_0x53982d){return db[_0x04c6('0x3b')]['find']({'where':{'id':_0xc7dfe5['params']['id']},'attributes':['id']})[_0x04c6('0x25')](handleEntityNotFound(_0x53982d,null))[_0x04c6('0x25')](function(_0x3eac1f){var _0x10a9ae=[];values=_0x3eac1f[_0x04c6('0x43')];_0x10a9ae[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x55'),_0x3eac1f['dataValues']));_0x10a9ae['push'](get_open_tabs(_0x04c6('0x44'),_0x3eac1f[_0x04c6('0x43')]));_0x10a9ae[_0x04c6('0x3f')](get_open_tabs('openchannel',_0x3eac1f[_0x04c6('0x43')]));_0x10a9ae[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x47'),_0x3eac1f[_0x04c6('0x43')]));_0x10a9ae['push'](get_open_tabs(_0x04c6('0xb4'),_0x3eac1f[_0x04c6('0x43')]));_0x10a9ae[_0x04c6('0x3f')](get_open_tabs('mail',_0x3eac1f[_0x04c6('0x43')]));return BPromise[_0x04c6('0x48')](_0x10a9ae);})[_0x04c6('0x25')](function(_0x2cc0d2){var _0x3d6281=[];if(_0x2cc0d2){for(var _0x24e786=0x0;_0x24e786=_0x36054a){_0x215a31=_0x36054a;_0x20202c=0xc8;}else{_0x20202c=0xce;}_0x4d2d6c['status'](_0x20202c);return _0x4d2d6c[_0xac4a('0x26')](_0xac4a('0x27'),_0x3bc318+'-'+_0x215a31+'/'+_0x36054a)[_0xac4a('0x21')](_0x2503d8);}return null;};}function saveUpdates(_0x2772fe){return function(_0x116700){if(_0x116700){return _0x116700['update'](_0x2772fe)['then'](function(_0xdb7e){return _0xdb7e;});}return null;};}function removeEntity(_0x7a948b){return function(_0x1f12d5){if(_0x1f12d5){return _0x1f12d5['destroy']()['then'](function(){var _0x355755=_0x1f12d5[_0xac4a('0x28')]({'plain':!![]});if(_0x355755[_0xac4a('0x29')]===_0xac4a('0x2a'))return;var _0x17118e=[{'name':'Users','value':_0xac4a('0x2b'),'ignore':!![]},{'name':'Agents','value':_0xac4a('0x2c'),'ignore':![]},{'name':'Telephones','value':_0xac4a('0x2d'),'ignore':![]}];var _0xfbe355=_(_0x17118e)[_0xac4a('0x2e')](_0xac4a('0x2f'))[_0xac4a('0x30')](_0xac4a('0x31'))[_0xac4a('0x31')]();if(_[_0xac4a('0x32')](_0xfbe355,_0x355755[_0xac4a('0x29')])){return;}var _0xfd7c16=_[_0xac4a('0x33')](_0x17118e,[_0xac4a('0x31'),_0x355755[_0xac4a('0x29')]])[_0xac4a('0x34')];return db['UserProfileResource'][_0xac4a('0x35')]({'where':{'type':_0xfd7c16,'resourceId':_0x355755['id']}})[_0xac4a('0x36')](function(){return _0x1f12d5;});})['then'](function(){_0x7a948b[_0xac4a('0x1f')](0xcc)[_0xac4a('0x20')]();});}};}function handleEntityNotFound(_0x565164){return function(_0x58804b){if(!_0x58804b){_0x565164[_0xac4a('0x37')](0x194);}return _0x58804b;};}function handleError(_0x1ba096,_0x1b42b6){_0x1b42b6=_0x1b42b6||0x1f4;return function(_0x3de9e2){logger['error'](_0x3de9e2[_0xac4a('0x38')]);if(_0x3de9e2[_0xac4a('0x34')]){delete _0x3de9e2['name'];}_0x1ba096[_0xac4a('0x1f')](_0x1b42b6)[_0xac4a('0x39')](_0x3de9e2);};}exports[_0xac4a('0x3a')]=function(_0x5f0eb8,_0x121328){var _0x357f06={},_0x1b5427={'count':0x0,'rows':[]};var _0x4e0445=_(db[_0xac4a('0x3b')][_0xac4a('0x3c')])['map'](function(_0x59bebf){return{'name':_0x59bebf[_0xac4a('0x3d')],'type':_0x59bebf['type']['key']};})['filter'](function(_0x4fee3a){return!_[_0xac4a('0x32')]([_0xac4a('0x3e'),_0xac4a('0x3f')],_0x4fee3a[_0xac4a('0x34')]);})[_0xac4a('0x31')]();_0x357f06=qs[_0xac4a('0x40')](_0x4e0445,_0x5f0eb8);var _0x4220e2={'where':_0x357f06[_0xac4a('0x41')]};return db[_0xac4a('0x3b')][_0xac4a('0x25')](_0x4220e2)[_0xac4a('0x36')](function(_0x1c2a87){_0x1b5427['count']=_0x1c2a87;if(_0x5f0eb8['query']['includeAll']){_0x357f06[_0xac4a('0x42')]=[{'all':!![]}];}if(!_[_0xac4a('0x32')](_0x357f06[_0xac4a('0x43')],'id')){_0x357f06[_0xac4a('0x43')][_0xac4a('0x44')]('id');}return db[_0xac4a('0x3b')][_0xac4a('0x45')](_0x357f06);})[_0xac4a('0x36')](function(_0x3e9973){_0x1b5427[_0xac4a('0x46')]=_0x3e9973;if(_0x5f0eb8['query'][_0xac4a('0x47')]===_0xac4a('0x48')){var _0x3d9595=[];for(var _0x3f24a1=0x0;_0x3f24a1<_0x1b5427[_0xac4a('0x46')]['length'];_0x3f24a1++){_0x3d9595[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x49'),_0x1b5427['rows'][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595['push'](get_open_tabs(_0xac4a('0x4b'),_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4c'),_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4d'),_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs('openchannel',_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs('whatsapp',_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));}return BPromise['all'](_0x3d9595)[_0xac4a('0x36')](function(_0x5a7f6e){return _0x1b5427;});}else{return _0x1b5427;}})[_0xac4a('0x36')](respondWithFilteredResult(_0x121328,_0x357f06))[_0xac4a('0x1e')](handleError(_0x121328,null));};exports[_0xac4a('0x4e')]=function(_0x5e3581,_0x588374){var _0x42fd9d={'raw':![],'where':{'id':_0x5e3581[_0xac4a('0x4f')]['id']}},_0x4aaeff={};_0x4aaeff['model']=_[_0xac4a('0x50')](_['keys'](db[_0xac4a('0x3b')][_0xac4a('0x3c')]),[_0xac4a('0x3e'),_0xac4a('0x3f')]);_0x4aaeff['query']=_[_0xac4a('0x51')](_0x5e3581[_0xac4a('0x52')]);_0x4aaeff[_0xac4a('0x53')]=_[_0xac4a('0x54')](_0x4aaeff[_0xac4a('0x55')],_0x4aaeff[_0xac4a('0x52')]);_0x42fd9d[_0xac4a('0x43')]=_['intersection'](_0x4aaeff[_0xac4a('0x55')],qs[_0xac4a('0x56')](_0x5e3581['query'][_0xac4a('0x56')]));_0x42fd9d[_0xac4a('0x43')]=_0x42fd9d[_0xac4a('0x43')][_0xac4a('0x57')]?_0x42fd9d['attributes']:_0x4aaeff[_0xac4a('0x55')];if(_0x5e3581[_0xac4a('0x52')][_0xac4a('0x58')]){_0x42fd9d[_0xac4a('0x42')]=[{'all':!![]}];}_0x42fd9d=_[_0xac4a('0x59')]({},_0x42fd9d,_0x5e3581['options']);if(!_[_0xac4a('0x32')](_0x42fd9d['attributes'],'id')){_0x42fd9d[_0xac4a('0x43')][_0xac4a('0x44')]('id');}return db['User']['find'](_0x42fd9d)[_0xac4a('0x36')](handleEntityNotFound(_0x588374,null))[_0xac4a('0x36')](function(_0x4d448f){var _0x18d29c=[];values=_0x4d448f;if(_0x5e3581[_0xac4a('0x52')][_0xac4a('0x47')]===_0xac4a('0x48')){_0x18d29c['push'](get_open_tabs(_0xac4a('0x49'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4b'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x5a'),_0x4d448f['dataValues']));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x5b'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4c'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4d'),_0x4d448f[_0xac4a('0x4a')]));return BPromise[_0xac4a('0x5c')](_0x18d29c);}else{return values;}})[_0xac4a('0x36')](function(_0x38dd4f){return values;})[_0xac4a('0x36')](respondWithResult(_0x588374,null))[_0xac4a('0x1e')](handleError(_0x588374,null));};exports[_0xac4a('0x5d')]=function(_0x11c753,_0x492aae){if(_0x11c753[_0xac4a('0x5e')]['id']){delete _0x11c753['body']['id'];}delete _0x11c753[_0xac4a('0x5e')]['role'];return db[_0xac4a('0x3b')]['find']({'where':{'id':_0x11c753[_0xac4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x492aae,null))['then'](saveUpdates(_0x11c753[_0xac4a('0x5e')],null))[_0xac4a('0x36')](respondWithResult(_0x492aae,null))[_0xac4a('0x1e')](handleError(_0x492aae,null));};exports[_0xac4a('0x5f')]=function(_0x2f9940,_0xb7b884){return db['User'][_0xac4a('0x5f')]()['then'](respondWithResult(_0xb7b884,null))[_0xac4a('0x1e')](handleError(_0xb7b884,null));};exports['addContacts']=function(_0x347880,_0x19ce2c){return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x347880[_0xac4a('0x4f')]['id']}})[_0xac4a('0x36')](handleEntityNotFound(_0x19ce2c,null))[_0xac4a('0x36')](function(_0xe3e375){if(_0xe3e375){return _0xe3e375[_0xac4a('0x60')](_0x347880[_0xac4a('0x5e')][_0xac4a('0x61')],_[_0xac4a('0x62')](_0x347880[_0xac4a('0x5e')],[_0xac4a('0x61'),'id'])||{});}})[_0xac4a('0x36')](respondWithResult(_0x19ce2c,null))[_0xac4a('0x1e')](handleError(_0x19ce2c,null));};function validateUser(_0x38cb4f){return new BPromise(function(_0x4a0156,_0xa90d71){if(_0x38cb4f[_0xac4a('0x63')])return _0x4a0156(_0x38cb4f);return db['Setting'][_0xac4a('0x64')](0x1)[_0xac4a('0x36')](function(_0x2d24c7){if(_0x2d24c7[_0xac4a('0x65')])authService[_0xac4a('0x66')](_0x38cb4f['password']);db['User'][_0xac4a('0x67')](_0xac4a('0x63'))[_0xac4a('0x36')](function(_0x148288){if(_[_0xac4a('0x68')](_0x148288)){_0x38cb4f[_0xac4a('0x63')]=_0x2d24c7[_0xac4a('0x69')]||0x1;return;}if(_[_0xac4a('0x68')](_0x2d24c7[_0xac4a('0x69')])||_0x2d24c7[_0xac4a('0x69')]===_0x148288){_0x38cb4f[_0xac4a('0x63')]=_0x148288+0x1;return;}if(_0x2d24c7['min_internal']>_0x148288){_0x38cb4f['internal']=_0x2d24c7[_0xac4a('0x69')];return;}return db[_0xac4a('0x6a')][_0xac4a('0x52')](_0xac4a('0x6b'),{'type':db[_0xac4a('0x6a')][_0xac4a('0x6c')][_0xac4a('0x6d')]})[_0xac4a('0x36')](function(_0x453d62){if(_0x453d62&&_0x453d62[_0xac4a('0x57')]){for(var _0xb09b89=0x0,_0xb12cc5=_0x453d62['length'];_0xb09b89<_0xb12cc5&&_[_0xac4a('0x68')](_0x38cb4f[_0xac4a('0x63')]);_0xb09b89++){if(_0x2d24c7[_0xac4a('0x69')]<=_0x453d62[_0xb09b89][_0xac4a('0x6e')]){_0x38cb4f['internal']=_0x453d62[_0xb09b89][_0xac4a('0x6e')];}else if(_0x2d24c7['min_internal']>_0x453d62[_0xb09b89][_0xac4a('0x6e')]&&_0x2d24c7[_0xac4a('0x69')]<=_0x453d62[_0xb09b89]['to']){_0x38cb4f['internal']=_0x2d24c7['min_internal'];}}}if(_[_0xac4a('0x68')](_0x38cb4f[_0xac4a('0x63')])){_0x38cb4f[_0xac4a('0x63')]=_0x148288+0x1;}return _0x4a0156(_0x38cb4f);});});})['catch'](function(_0x3a0cf8){_0xa90d71(_0x3a0cf8);});});}function updateUser(_0x4d067d){return new BPromise(function(_0x114b11,_0x4a88c7){try{if(_0x4d067d['voicemail']){_0x4d067d[_0xac4a('0x6f')]=_0x4d067d['internal'];_0x4d067d[_0xac4a('0x70')]={'mailbox':_0x4d067d['internal'],'password':_0x4d067d[_0xac4a('0x3e')],'fullname':_0x4d067d[_0xac4a('0x71')],'email':_0x4d067d['email']};}if(_0x4d067d[_0xac4a('0x29')]==='agent'){if(!_0x4d067d[_0xac4a('0x72')])_0x4d067d[_0xac4a('0x72')]=['101',_0xac4a('0x73'),'103','113',_0xac4a('0x74'),'104',_0xac4a('0x75'),'106','107',_0xac4a('0x76'),_0xac4a('0x77'),_0xac4a('0x78'),'111','114',_0xac4a('0x79')];}_0x114b11(_0x4d067d);}catch(_0x9c0fa1){_0x4a88c7(_0x9c0fa1);}});}exports['create']=function(_0x4e93f5,_0x3824a2){if(_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x29')]===_0xac4a('0x2c'))throw new Error(_0xac4a('0x7a'));if(_0x4e93f5[_0xac4a('0x5e')][_0xac4a('0x29')]===_0xac4a('0x2b')&&_0x4e93f5[_0xac4a('0x2b')]['role']!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x7b'));}if(_0x4e93f5[_0xac4a('0x5e')]['role']===_0xac4a('0x2a')&&_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x29')]!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x7c'));}return licenseUtil['checkUserLimits']([_0x4e93f5[_0xac4a('0x5e')]])[_0xac4a('0x36')](function(){return validateUser(_0x4e93f5[_0xac4a('0x5e')]);})[_0xac4a('0x36')](function(_0x72c90c){return updateUser(_0x72c90c)[_0xac4a('0x36')](function(_0xd7bdd6){if(_0xd7bdd6['role']===_0xac4a('0x2a')){_0xd7bdd6[_0xac4a('0x7d')]=_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x7d')];delete _0xd7bdd6[_0xac4a('0x7e')];}return _0xd7bdd6;});})[_0xac4a('0x36')](function(_0x547eec){return db[_0xac4a('0x3b')][_0xac4a('0x7f')](_0x547eec,{'include':[{'model':db[_0xac4a('0x70')],'as':_0xac4a('0x70')}]});})['then'](function(_0x21a384){if(_0x4e93f5['body'][_0xac4a('0x29')]===_0xac4a('0x2b'))return _0x21a384;if(_0x4e93f5['user']['role']!==_0xac4a('0x2b'))return _0x21a384;return db[_0xac4a('0x80')][_0xac4a('0x33')]({'where':{'name':_0x21a384['role']===_0xac4a('0x2c')?'Agents':_0xac4a('0x81'),'userProfileId':_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x7e')]},'raw':!![]})[_0xac4a('0x36')](function(_0x2e2c92){if(!_0x2e2c92||_0x2e2c92['autoAssociation']!=0x0)return _0x21a384;return db['UserProfileResource'][_0xac4a('0x7f')]({'name':_0x21a384[_0xac4a('0x34')],'resourceId':_0x21a384['id'],'type':_0x2e2c92[_0xac4a('0x34')],'sectionId':_0x2e2c92['id']},{})[_0xac4a('0x36')](function(){return _0x21a384;});})[_0xac4a('0x1e')](function(_0x3c5bbc){logger[_0xac4a('0x1b')](_0xac4a('0x82'),_0x3c5bbc);throw _0x3c5bbc;});})['then'](respondWithResult(_0x3824a2,0xc9))['catch'](handleError(_0x3824a2,null));};exports[_0xac4a('0x83')]=function(_0x31cc9a,_0x247eee){var _0x950e60=_0x31cc9a[_0xac4a('0x5e')];var _0x2ea4a4=[];if(_0x31cc9a[_0xac4a('0x2b')][_0xac4a('0x29')]==='agent')throw new Error('Unauthorized');if(_[_0xac4a('0x84')](_0x950e60,[_0xac4a('0x29'),_0xac4a('0x2b')])&&_0x31cc9a[_0xac4a('0x2b')][_0xac4a('0x29')]!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x7b'));}if(_['some'](_0x950e60,[_0xac4a('0x29'),_0xac4a('0x2a')])&&_0x31cc9a[_0xac4a('0x2b')]['role']!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x85'));}return licenseUtil[_0xac4a('0x86')](_0x950e60)[_0xac4a('0x36')](function(){return validateUser(_0x950e60[0x0]);})[_0xac4a('0x36')](function(){for(var _0x27d023=0x1;_0x27d023<_0x950e60[_0xac4a('0x57')];_0x27d023++){var _0x2ef42a=_0x950e60[_0x27d023-0x1][_0xac4a('0x63')];if(!_0x950e60[_0x27d023]['internal'])_0x950e60[_0x27d023][_0xac4a('0x63')]=_0x2ef42a+0x1;_0x2ea4a4['push'](validateUser(_0x950e60[_0x27d023]));}return BPromise[_0xac4a('0x5c')](_0x2ea4a4);})[_0xac4a('0x36')](function(){_0x2ea4a4=[];for(var _0x3184b3=0x0;_0x3184b3<_0x950e60[_0xac4a('0x57')];_0x3184b3++){_0x2ea4a4[_0xac4a('0x44')](updateUser(_0x950e60[_0x3184b3]));}return BPromise[_0xac4a('0x5c')](_0x2ea4a4);})[_0xac4a('0x36')](function(){return BPromise['each'](_0x950e60,function(_0x2b883a){return db[_0xac4a('0x3b')][_0xac4a('0x7f')](_0x2b883a,{'include':[{'model':db[_0xac4a('0x70')],'as':_0xac4a('0x70')}]})['then'](function(_0x1b37d9){_0x2b883a['id']=_0x1b37d9['id'];return _0x2b883a;});});})[_0xac4a('0x36')](function(_0x4f2b19){if(_0x31cc9a['body'][_0xac4a('0x29')]===_0xac4a('0x2b'))return _0x4f2b19;if(_0x31cc9a['user'][_0xac4a('0x29')]!==_0xac4a('0x2b'))return _0x4f2b19;var _0x6afaba=_[_0xac4a('0x84')](_0x4f2b19,function(_0x31df2d){return _0x31df2d[_0xac4a('0x29')]==='agent'||_0x31df2d[_0xac4a('0x29')]===_0xac4a('0x2d');});if(!_0x6afaba)return _0x4f2b19;return db[_0xac4a('0x80')]['findAll']({'where':{'name':{'$or':[_0xac4a('0x87'),_0xac4a('0x81')]},'userProfileId':_0x31cc9a[_0xac4a('0x2b')][_0xac4a('0x7e')]},'raw':!![]})[_0xac4a('0x36')](function(_0x23d635){if(_['isEmpty'](_0x23d635)||!_[_0xac4a('0x84')](_0x23d635,[_0xac4a('0x88'),0x0]))return _0x4f2b19;_0x2ea4a4=[];var _0x5ab83b=_(_0x23d635)[_0xac4a('0x30')](function(_0x55054a){if(_0x55054a[_0xac4a('0x88')]===0x1)return;return _0x55054a[_0xac4a('0x34')]==='Agents'?_0xac4a('0x2c'):'telephone';})[_0xac4a('0x89')]()['value']();for(var _0x3c601e=0x0;_0x3c601e<_0x4f2b19[_0xac4a('0x57')];_0x3c601e++){if(!_[_0xac4a('0x32')](_0x5ab83b,_0x4f2b19[_0x3c601e][_0xac4a('0x29')]))return;var _0xc38492=_0x4f2b19[_0x3c601e][_0xac4a('0x29')]===_0xac4a('0x2c')?_0xac4a('0x87'):_0xac4a('0x81');_0x2ea4a4[_0xac4a('0x44')](db[_0xac4a('0x8a')][_0xac4a('0x7f')]({'name':_0x4f2b19[_0x3c601e][_0xac4a('0x34')],'resourceId':_0x4f2b19[_0x3c601e]['id'],'type':_0xc38492,'sectionId':_[_0xac4a('0x33')](_0x23d635,['name',_0xc38492])['id']},{}));}return BPromise[_0xac4a('0x5c')](_0x2ea4a4);});})[_0xac4a('0x36')](respondWithResult(_0x247eee,0xc9))['catch'](handleError(_0x247eee,null));};exports[_0xac4a('0x8b')]=function(_0x31d190,_0x1b10ad){if(_0x31d190[_0xac4a('0x5e')]['id']){delete _0x31d190[_0xac4a('0x5e')]['id'];}return db['User'][_0xac4a('0x33')]({'where':{'id':_0x31d190['params']['id']}})[_0xac4a('0x36')](function(_0x28ae76){if(!_0x28ae76)return null;if(_0x28ae76['id']===_0x31d190[_0xac4a('0x2b')]['id']){if(!_0x31d190[_0xac4a('0x5e')]['oldPassword']||!_0x31d190[_0xac4a('0x5e')]['newPassword']){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x8e'));}if(!_0x28ae76['authenticate'](_0x31d190[_0xac4a('0x5e')][_0xac4a('0x8f')])){throw new db[(_0xac4a('0x8c'))]['ValidationError'](_0xac4a('0x90'));}if(_0x31d190[_0xac4a('0x5e')][_0xac4a('0x8f')]===_0x31d190[_0xac4a('0x5e')][_0xac4a('0x91')]){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x92'));}}else if(_0x31d190['user'][_0xac4a('0x29')]==='admin'){if(!_0x31d190['body']['newPassword']){throw new db['Sequelize']['ValidationError'](_0xac4a('0x93'));}}else if(_0x31d190[_0xac4a('0x2b')][_0xac4a('0x29')]===_0xac4a('0x2b')){if(!_0x31d190[_0xac4a('0x5e')]['newPassword']){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x93'));}if(_0x28ae76[_0xac4a('0x29')]!==_0xac4a('0x2c')){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x7a'));}}else{throw new db['Sequelize'][(_0xac4a('0x8d'))](_0xac4a('0x7a'));}return _0x28ae76;})[_0xac4a('0x36')](handleEntityNotFound(_0x1b10ad,null))[_0xac4a('0x36')](function(_0x303d5d){return db[_0xac4a('0x94')][_0xac4a('0x95')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xac4a('0x96')]})[_0xac4a('0x36')](function(_0x51993a){if(_0x51993a[_0xac4a('0x65')])authService[_0xac4a('0x66')](_0x31d190['body']['newPassword']);if(!_0x51993a[_0xac4a('0x97')]||!_0x303d5d[_0xac4a('0x98')])return _0x303d5d;authService[_0xac4a('0x99')](_0x31d190[_0xac4a('0x5e')][_0xac4a('0x91')],_0x303d5d['previousPasswords'],_0x51993a[_0xac4a('0x96')]);return _0x303d5d;})['then'](saveUpdates({'password':_0x31d190['body']['newPassword'],'passwordResetAt':_0x31d190[_0xac4a('0x2b')]['id']==_0x31d190[_0xac4a('0x4f')]['id']?moment():null,'previousPasswords':authService[_0xac4a('0x9a')](_0x31d190[_0xac4a('0x5e')][_0xac4a('0x91')],_0x303d5d[_0xac4a('0x98')])},null));})[_0xac4a('0x36')](respondWithResult(_0x1b10ad,null))[_0xac4a('0x1e')](handleError(_0x1b10ad,null));};exports['addQueues']=function(_0x5e1662,_0x53bcbc){var _0x3305a5=_0x5e1662[_0xac4a('0x5e')][_0xac4a('0x9b')];return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x5e1662[_0xac4a('0x4f')]['id']},'attributes':['id',_0xac4a('0x34'),_0xac4a('0x29'),_0xac4a('0x9c'),_0xac4a('0x9d'),_0xac4a('0x9e'),_0xac4a('0x9f')]})[_0xac4a('0x36')](handleEntityNotFound(_0x53bcbc,null))[_0xac4a('0x36')](function(_0x356a6b){if(_0x356a6b){if(!utils[_0xac4a('0xa0')](_0x3305a5)){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0xa1'));}return _0x356a6b[_0xac4a('0xa2')+_[_0xac4a('0xa3')](_0x3305a5[_0xac4a('0xa4')]())+_0xac4a('0xa5')](_0x5e1662['body'][_0xac4a('0x61')],{'penalty':_0x5e1662[_0xac4a('0x5e')][_0xac4a('0xa6')]||0x0})[_0xac4a('0xa7')](function(_0x237312){for(var _0x31afd2=0x0;_0x31afd2<_0x5e1662[_0xac4a('0x5e')][_0xac4a('0x61')]['length'];_0x31afd2+=0x1){var _0x5127ea={'UserId':Number(_0x5e1662[_0xac4a('0x4f')]['id'])};_0x5127ea[_[_0xac4a('0xa3')](_0x3305a5[_0xac4a('0xa4')]())+'QueueId']=Number(_0x5e1662['body']['ids'][_0x31afd2]);socket[_0xac4a('0xa8')]('user'+_[_0xac4a('0xa3')](_0x3305a5[_0xac4a('0xa4')]())+'Queue:save',_0x5127ea);}return _0x237312;})[_0xac4a('0x36')](function(){if(_0x3305a5==='voice'){return db[_0xac4a('0xa9')][_0xac4a('0x45')]({'where':{'id':_0x5e1662[_0xac4a('0x5e')][_0xac4a('0x61')]||[]},'raw':!![],'attributes':['id',_0xac4a('0x34')]});}})[_0xac4a('0x36')](function(_0x5e0602){var _0x25bf23=_0x356a6b[_0xac4a('0x28')]({'plain':!![]});var _0x2c03a1=[];if(_0x3305a5==='voice'&&_0x25bf23[_0xac4a('0x29')]===_0xac4a('0x2c')&&_0x25bf23[_0xac4a('0x9c')]){for(var _0x247856=0x0;_0x247856<_0x5e0602['length'];_0x247856+=0x1){_0x2c03a1[_0xac4a('0x44')]({'membername':_0x25bf23[_0xac4a('0x34')],'UserId':_0x25bf23['id'],'queue_name':_0x5e0602[_0x247856][_0xac4a('0x34')],'VoiceQueueId':_0x5e0602[_0x247856]['id'],'interface':_[_0xac4a('0x68')](_0x25bf23[_0xac4a('0x9f')])?util[_0xac4a('0xaa')]('SIP/%s',_0x25bf23['name']):_0x25bf23[_0xac4a('0x9f')],'paused':_0x25bf23[_0xac4a('0x9e')]||![],'penalty':_0x5e1662[_0xac4a('0x5e')][_0xac4a('0xa6')]||0x0});}return BPromise[_0xac4a('0xab')](_0x2c03a1,function(_0x1a12a2){return db['UserVoiceQueueRt'][_0xac4a('0xac')](_0x1a12a2);});}return _0x356a6b;});}})['then'](respondWithStatusCode(_0x53bcbc,null))[_0xac4a('0x1e')](handleError(_0x53bcbc,null));};exports['removeQueues']=function(_0xa1df14,_0x13b938){var _0x15f35a;return db[_0xac4a('0x3b')]['find']({'where':{'id':_0xa1df14[_0xac4a('0x4f')]['id']},'attributes':['id',_0xac4a('0x34'),_0xac4a('0x29')]})[_0xac4a('0x36')](handleEntityNotFound(_0x13b938,null))[_0xac4a('0x36')](function(_0x520001){if(_0x520001){_0x15f35a=_0x520001;if(!_0xa1df14[_0xac4a('0x52')][_0xac4a('0x9b')]||!utils[_0xac4a('0xa0')](_0xa1df14[_0xac4a('0x52')][_0xac4a('0x9b')])){throw new db['Sequelize'][(_0xac4a('0x8d'))](_0xac4a('0xa1'));}return _0x520001[_0xac4a('0xad')+_[_0xac4a('0xa3')](_0xa1df14[_0xac4a('0x52')]['channel']['toLowerCase']())+'Queues'](_0xa1df14['query'][_0xac4a('0x61')]);}})[_0xac4a('0x36')](function(_0x17f815){if(_[_0xac4a('0xae')](_0xa1df14[_0xac4a('0x52')]['ids'])){for(var _0x293d49=0x0;_0x293d49<_0xa1df14[_0xac4a('0x52')]['ids'][_0xac4a('0x57')];_0x293d49+=0x1){var _0x11faad={'UserId':Number(_0xa1df14[_0xac4a('0x4f')]['id'])};_0x11faad[_['capitalize'](_0xa1df14[_0xac4a('0x52')][_0xac4a('0x9b')][_0xac4a('0xa4')]())+_0xac4a('0xaf')]=Number(_0xa1df14[_0xac4a('0x52')][_0xac4a('0x61')][_0x293d49]);socket[_0xac4a('0xa8')](_0xac4a('0x2b')+_[_0xac4a('0xa3')](_0xa1df14['query'][_0xac4a('0x9b')][_0xac4a('0xa4')]())+'Queue:remove',_0x11faad);}}else{var _0x11faad={'UserId':Number(_0xa1df14['params']['id'])};_0x11faad[_[_0xac4a('0xa3')](_0xa1df14[_0xac4a('0x52')]['channel'][_0xac4a('0xa4')]())+_0xac4a('0xaf')]=Number(_0xa1df14[_0xac4a('0x52')][_0xac4a('0x61')]);socket[_0xac4a('0xa8')](_0xac4a('0x2b')+_[_0xac4a('0xa3')](_0xa1df14[_0xac4a('0x52')]['channel']['toLowerCase']())+_0xac4a('0xb0'),_0x11faad);}return _0x17f815;})['then'](function(){if(_0xa1df14['query'][_0xac4a('0x9b')]===_0xac4a('0xb1')){return db[_0xac4a('0xb2')]['destroy']({'where':{'UserId':_0xa1df14[_0xac4a('0x4f')]['id'],'VoiceQueueId':_0xa1df14[_0xac4a('0x52')]['ids']},'individualHooks':!![]})['then'](function(){return _0x15f35a;});}return _0x15f35a;})[_0xac4a('0x36')](respondWithStatusCode(_0x13b938,null))[_0xac4a('0x1e')](handleError(_0x13b938,null));};exports[_0xac4a('0xb3')]=function(_0x368546,_0x4fadd1){_0x368546[_0xac4a('0x5e')][_0xac4a('0xb4')]=_0x368546[_0xac4a('0xb5')]['filename'];return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x368546[_0xac4a('0x4f')]['id']}})[_0xac4a('0x36')](handleEntityNotFound(_0x4fadd1,null))[_0xac4a('0x36')](saveUpdates(_0x368546['body'],null))['then'](respondWithResult(_0x4fadd1,null))[_0xac4a('0x1e')](handleError(_0x4fadd1,null));};exports[_0xac4a('0xb6')]=function(_0x1774e5,_0x110e16){var _0x14ca03=path[_0xac4a('0xb7')](config[_0xac4a('0xb8')],_0xac4a('0xb9'));return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x1774e5[_0xac4a('0x4f')]['id']},'attributes':['id',_0xac4a('0xb4')],'raw':!![]})[_0xac4a('0x36')](handleEntityNotFound(_0x110e16,null))['then'](function(_0x3ef9b2){if(_0x3ef9b2){if(_['isNil'](_0x3ef9b2['userpic'])){return _0x110e16[_0xac4a('0xba')](_0x14ca03);}else{if(!fs[_0xac4a('0xbb')](path[_0xac4a('0xb7')](config[_0xac4a('0xb8')],_0xac4a('0xbc'),_0x3ef9b2[_0xac4a('0xb4')]))){return _0x110e16[_0xac4a('0xba')](_0x14ca03);}return _0x110e16[_0xac4a('0xba')](path[_0xac4a('0xb7')](config['root'],_0xac4a('0xbc'),_0x3ef9b2[_0xac4a('0xb4')]));}}})[_0xac4a('0x1e')](handleError(_0x110e16,null));};exports[_0xac4a('0xbd')]=function(_0x5c0bb8,_0x5b1934){return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x5c0bb8[_0xac4a('0x4f')]['id']},'attributes':['id']})[_0xac4a('0x36')](handleEntityNotFound(_0x5b1934,null))[_0xac4a('0x36')](function(_0x254de8){var _0x1c7ea7=[];values=_0x254de8[_0xac4a('0x4a')];_0x1c7ea7[_0xac4a('0x44')](get_open_tabs('chat',_0x254de8[_0xac4a('0x4a')]));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4b'),_0x254de8[_0xac4a('0x4a')]));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x5a'),_0x254de8['dataValues']));_0x1c7ea7['push'](get_open_tabs('whatsapp',_0x254de8[_0xac4a('0x4a')]));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs('fax',_0x254de8['dataValues']));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs('mail',_0x254de8[_0xac4a('0x4a')]));return BPromise['all'](_0x1c7ea7);})[_0xac4a('0x36')](function(_0x2abd82){var _0x1888c3=[];if(_0x2abd82){for(var _0x27e640=0x0;_0x27e640=_0x2396f0[_0xa54f('0x54')]){throw new Error(_0xa54f('0x55'));}})[_0xa54f('0x25')](function(){if(_0x5ed39b){return db[_0xa54f('0x2e')][_0xa54f('0x4d')]({'where':{'membername':_0x5ed39b[_0xa54f('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x5ed39b){return _0x5ed39b[_0xa54f('0x56')]({'raw':!![]});}})[_0xa54f('0x25')](function(_0x1f5653){if(_0x5ed39b){if(_0x1f5653){var _0x322485=[];_0x497179=_0x1f5653;if(_0x497179[_0xa54f('0x32')]){for(var _0x4e739b=0x0;_0x4e739b<_0x497179['length'];_0x4e739b++){_0x322485[_0xa54f('0x36')](db[_0xa54f('0x2e')]['upsert']({'membername':_0x5ed39b[_0xa54f('0x2a')],'UserId':_0x5ed39b['id'],'queue_name':_0x497179[_0x4e739b][_0xa54f('0x2a')],'VoiceQueueId':_0x497179[_0x4e739b]['id'],'interface':_0x3762b6,'paused':_0x5ed39b[_0xa54f('0x57')]||![],'penalty':_0x497179[_0x4e739b][_0xa54f('0x58')]||0x0}));}return BPromise[_0xa54f('0x4b')](_0x322485);}}}})['then'](function(){if(_0x5ed39b){return db[_0xa54f('0x30')][_0xa54f('0x49')]({'where':{'membername':_0x5ed39b[_0xa54f('0x2a')],'exitAt':null}});}})[_0xa54f('0x25')](function(_0x332e8d){if(_0x5ed39b){if(_0x332e8d&&_0x332e8d[_0xa54f('0x32')]){var _0x518005=[];_0x332e8d[_0xa54f('0x4a')](function(_0x5c31d5){_0x518005[_0xa54f('0x36')](_0x5c31d5[_0xa54f('0x2f')]({'exitAt':moment()[_0xa54f('0x37')](_0xa54f('0x33'))}));});return BPromise['all'](_0x518005);}}})['then'](function(_0x35df6b){if(_0x5ed39b){var _0x4f5877=[];var _0x5473a2=[];var _0x1b67ad=utils[_0xa54f('0x35')]();var _0x5e3e41={'membername':_0x5ed39b[_0xa54f('0x2a')],'interface':_0x3762b6,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5ed39b[_0xa54f('0x2b')],'internal':_0x5ed39b['internal']};_0x1b67ad[_0xa54f('0x4a')](function(_0x360581){_0x4f5877[_0xa54f('0x36')](_[_0xa54f('0x59')]({'channel':_0x360581,'type':_0xa54f('0x5a'),'data1':'callysquare','data2':_0x3762b6},_0x5e3e41));if(_0x5ed39b[_0xa54f('0x57')]){_0x5473a2['push'](_[_0xa54f('0x59')]({'channel':_0x360581,'type':_0xa54f('0x31'),'data1':'LOGININPAUSE'},_0x5e3e41));}});return db[_0xa54f('0x30')]['bulkCreate'](_0x4f5877['concat'](_0x5473a2),{'individualHooks':!![]});}})[_0xa54f('0x25')](function(){if(_0x5ed39b){return _0x5ed39b['update']({'online':!![],'lastLoginAt':moment()[_0xa54f('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5ed39b[_0xa54f('0x57')]||![],'mailPause':_0x5ed39b[_0xa54f('0x57')]||![],'chatPause':_0x5ed39b[_0xa54f('0x57')]||![],'faxPause':_0x5ed39b['loginInPause']||![],'smsPause':_0x5ed39b[_0xa54f('0x57')]||![],'openchannelPause':_0x5ed39b[_0xa54f('0x57')]||![],'pauseType':_0x5ed39b[_0xa54f('0x57')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xa54f('0x37')](_0xa54f('0x33')),'interface':_0x3762b6});}})[_0xa54f('0x25')](function(_0x1ae35c){_0x2773bb(_0x1ae35c);})[_0xa54f('0x1a')](function(_0x3e0867){_0x5c6401(_0x74026f[_0xa54f('0x16')](0x1f4,_0x3e0867[_0xa54f('0x18')]));});});}; \ No newline at end of file +var _0x9821=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./user.socket','then','info','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetUser','User','findAll','options','raw','where','include','map','attributes','model','find','ShowUser','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','bulkCreate','UnpauseUser','channel','isValidChannel','Unknown\x20channel','voice','mail','chat','fax','sms','openchannel','system','set','%s%s','Pause','LogoutUser','findOne','all','LoginUser','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','randomstring'];(function(_0x1b0290,_0x33405a){var _0x5eba04=function(_0x41d58a){while(--_0x41d58a){_0x1b0290['push'](_0x1b0290['shift']());}};_0x5eba04(++_0x33405a);}(_0x9821,0x10c));var _0x1982=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x9821[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x1982('0x0'));var util=require(_0x1982('0x1'));var moment=require(_0x1982('0x2'));var BPromise=require(_0x1982('0x3'));var rs=require(_0x1982('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1982('0x5'))['db'];var utils=require(_0x1982('0x6'));var logger=require('../../config/logger')(_0x1982('0x7'));var config=require('../../config/environment');var jayson=require(_0x1982('0x8'));var client=jayson[_0x1982('0x9')]['http']({'port':0x232a});config[_0x1982('0xa')]=_[_0x1982('0xb')](config[_0x1982('0xa')],{'host':_0x1982('0xc'),'port':0x18eb});var socket=require(_0x1982('0xd'))(new Redis(config[_0x1982('0xa')]));require(_0x1982('0xe'))['register'](socket);function respondWithRpcPromise(_0x2a60e7,_0x5cb438,_0xb3828a){return new BPromise(function(_0x682b76,_0x3dc74a){return client['request'](_0x2a60e7,_0xb3828a)[_0x1982('0xf')](function(_0x3bcfca){logger[_0x1982('0x10')](_0x1982('0x11'),_0x5cb438,'request\x20sent');logger[_0x1982('0x12')]('User,\x20%s,\x20%s,\x20%s',_0x5cb438,_0x1982('0x13'),JSON[_0x1982('0x14')](_0x3bcfca));if(_0x3bcfca[_0x1982('0x15')]){if(_0x3bcfca[_0x1982('0x15')][_0x1982('0x16')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x5cb438,_0x3bcfca[_0x1982('0x15')][_0x1982('0x17')]);return _0x3dc74a(_0x3bcfca[_0x1982('0x15')][_0x1982('0x17')]);}logger[_0x1982('0x15')](_0x1982('0x11'),_0x5cb438,_0x3bcfca[_0x1982('0x15')]['message']);return _0x682b76(_0x3bcfca[_0x1982('0x15')][_0x1982('0x17')]);}else{logger['info']('User,\x20%s,\x20%s',_0x5cb438,'request\x20sent');_0x682b76(_0x3bcfca[_0x1982('0x18')]['message']);}})[_0x1982('0x19')](function(_0x4e5957){logger[_0x1982('0x15')]('User,\x20%s,\x20%s',_0x5cb438,_0x4e5957);_0x3dc74a(_0x4e5957);});});}exports[_0x1982('0x1a')]=function(_0x5c16ce){var _0x58724a=this;return new Promise(function(_0x5da5cc,_0x1d4346){return db[_0x1982('0x1b')][_0x1982('0x1c')]({'raw':_0x5c16ce['options']?_0x5c16ce[_0x1982('0x1d')][_0x1982('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c16ce[_0x1982('0x1d')]?_0x5c16ce[_0x1982('0x1d')][_0x1982('0x1f')]||null:null,'attributes':_0x5c16ce[_0x1982('0x1d')]?_0x5c16ce[_0x1982('0x1d')]['attributes']||null:null,'limit':_0x5c16ce[_0x1982('0x1d')]?_0x5c16ce[_0x1982('0x1d')]['limit']||null:null,'include':_0x5c16ce['options']?_0x5c16ce[_0x1982('0x1d')][_0x1982('0x20')]?_[_0x1982('0x21')](_0x5c16ce[_0x1982('0x1d')][_0x1982('0x20')],function(_0x157cd8){return{'model':db[_0x157cd8['model']],'as':_0x157cd8['as'],'attributes':_0x157cd8[_0x1982('0x22')],'include':_0x157cd8['include']?_[_0x1982('0x21')](_0x157cd8[_0x1982('0x20')],function(_0x1100f1){return{'model':db[_0x1100f1[_0x1982('0x23')]],'as':_0x1100f1['as'],'attributes':_0x1100f1[_0x1982('0x22')],'include':_0x1100f1[_0x1982('0x20')]?_[_0x1982('0x21')](_0x1100f1[_0x1982('0x20')],function(_0xff7d4a){return{'model':db[_0xff7d4a[_0x1982('0x23')]],'as':_0xff7d4a['as'],'attributes':_0xff7d4a[_0x1982('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1982('0xf')](function(_0x287c6b){logger[_0x1982('0x10')](_0x1982('0x1a'),_0x5c16ce);logger['debug']('GetUser',_0x5c16ce,JSON[_0x1982('0x14')](_0x287c6b));_0x5da5cc(_0x287c6b);})['catch'](function(_0x54e284){logger['error']('GetUser',_0x54e284['message'],_0x5c16ce);_0x1d4346(_0x58724a[_0x1982('0x15')](0x1f4,_0x54e284[_0x1982('0x17')]));});});};exports['ShowUser']=function(_0x303eef){var _0x501aec=this;return new Promise(function(_0x1f4799,_0x58d2cf){return db[_0x1982('0x1b')][_0x1982('0x24')]({'raw':_0x303eef[_0x1982('0x1d')]?_0x303eef[_0x1982('0x1d')][_0x1982('0x1e')]===undefined?!![]:![]:!![],'where':_0x303eef[_0x1982('0x1d')]?_0x303eef[_0x1982('0x1d')][_0x1982('0x1f')]||null:null,'attributes':_0x303eef[_0x1982('0x1d')]?_0x303eef['options'][_0x1982('0x22')]||null:null,'include':_0x303eef[_0x1982('0x1d')]?_0x303eef[_0x1982('0x1d')][_0x1982('0x20')]?_[_0x1982('0x21')](_0x303eef[_0x1982('0x1d')][_0x1982('0x20')],function(_0x342bb0){return{'model':db[_0x342bb0[_0x1982('0x23')]],'as':_0x342bb0['as'],'attributes':_0x342bb0[_0x1982('0x22')],'include':_0x342bb0[_0x1982('0x20')]?_['map'](_0x342bb0['include'],function(_0x188636){return{'model':db[_0x188636[_0x1982('0x23')]],'as':_0x188636['as'],'attributes':_0x188636[_0x1982('0x22')],'include':_0x188636[_0x1982('0x20')]?_[_0x1982('0x21')](_0x188636[_0x1982('0x20')],function(_0x4ddcec){return{'model':db[_0x4ddcec[_0x1982('0x23')]],'as':_0x4ddcec['as'],'attributes':_0x4ddcec[_0x1982('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1982('0xf')](function(_0x34edba){logger['info'](_0x1982('0x25'),_0x303eef);logger[_0x1982('0x12')](_0x1982('0x25'),_0x303eef,JSON[_0x1982('0x14')](_0x34edba));_0x1f4799(_0x34edba);})['catch'](function(_0x3830f4){logger[_0x1982('0x15')](_0x1982('0x25'),_0x3830f4[_0x1982('0x17')],_0x303eef);_0x58d2cf(_0x501aec[_0x1982('0x15')](0x1f4,_0x3830f4['message']));});});};exports[_0x1982('0x26')]=function(_0x114a0b){var _0x375534=this;return new Promise(function(_0x1b5e50,_0x4505db){var _0x378a8e;return db[_0x1982('0x1b')]['find']({'where':_0x114a0b[_0x1982('0x1d')]['where']||{},'attributes':['id',_0x1982('0x27'),_0x1982('0x28'),_0x1982('0x29'),_0x1982('0x2a')]})['then'](function(_0x465d9b){if(_0x465d9b){_0x378a8e=_0x465d9b;return db[_0x1982('0x2b')][_0x1982('0x2c')]({'paused':0x1},{'where':{'UserId':_0x378a8e['id']},'individualHooks':!![]});}})['then'](function(){if(_0x378a8e){return db[_0x1982('0x2d')][_0x1982('0x1c')]({'where':{'membername':_0x378a8e[_0x1982('0x27')],'type':'PAUSE','exitAt':null}});}})[_0x1982('0xf')](function(_0x9bf7be){if(_0x378a8e){if(_0x9bf7be&&_0x9bf7be[_0x1982('0x2e')]){var _0x27711e=moment()[_0x1982('0x2f')](_0x1982('0x30'));for(var _0x4e32da=0x0,_0x30b5a9=_0x9bf7be['length'];_0x4e32da<_0x30b5a9;_0x4e32da++){_0x9bf7be[_0x4e32da]['updateAttributes']({'exitAt':_0x27711e});}}}})[_0x1982('0xf')](function(){if(_0x378a8e){var _0x1453eb=[];var _0x9126e4=utils[_0x1982('0x31')]();_0x9126e4[_0x1982('0x32')](function(_0xf333b5){_0x1453eb[_0x1982('0x33')]({'channel':_0xf333b5,'membername':_0x378a8e[_0x1982('0x27')],'interface':_['isNil'](_0x378a8e[_0x1982('0x2a')])?util[_0x1982('0x2f')](_0x1982('0x34'),_0x378a8e['name']):_0x378a8e[_0x1982('0x2a')],'type':_0x1982('0x35'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x114a0b[_0x1982('0x36')][_0x1982('0x37')]||_0x1982('0x38'),'role':_0x378a8e[_0x1982('0x28')],'internal':_0x378a8e[_0x1982('0x29')],'uniqueid':_0x114a0b[_0x1982('0x36')]['uniqueid']||null});});return db['MemberReport'][_0x1982('0x39')](_0x1453eb,{'individualHooks':!![]});}})[_0x1982('0xf')](function(){if(_0x378a8e){return _0x378a8e[_0x1982('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x114a0b[_0x1982('0x36')]['type']||_0x1982('0x38'),'lastPauseAt':moment()[_0x1982('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x1982('0xf')](function(_0x27e52a){_0x1b5e50(_0x27e52a);})[_0x1982('0x19')](function(_0x211925){_0x4505db(_0x375534[_0x1982('0x15')](0x1f4,_0x211925['message']));});});};exports[_0x1982('0x3a')]=function(_0x3c2c9a){var _0x25effa=this;return new Promise(function(_0x43290c,_0x2df381){var _0x26b8c0;return db['User']['findOne']({'where':_0x3c2c9a[_0x1982('0x1d')]['where']||{},'attributes':['id',_0x1982('0x27')]})[_0x1982('0xf')](function(_0x14f3a5){if(_0x14f3a5){_0x26b8c0=_0x14f3a5;if(_0x3c2c9a['body'][_0x1982('0x3b')]&&!utils[_0x1982('0x3c')](_0x3c2c9a[_0x1982('0x36')]['channel'])){throw new Error(_0x1982('0x3d'));}switch(_0x3c2c9a[_0x1982('0x36')][_0x1982('0x3b')]){case _0x1982('0x3e'):return db[_0x1982('0x2b')][_0x1982('0x2c')]({'paused':0x0},{'where':{'UserId':_0x26b8c0['id']}})[_0x1982('0xf')](function(){return db[_0x1982('0x2d')][_0x1982('0x24')]({'where':{'channel':_0x3c2c9a[_0x1982('0x36')][_0x1982('0x3b')],'membername':_0x26b8c0[_0x1982('0x27')],'type':_0x1982('0x35'),'exitAt':null}});})[_0x1982('0xf')](function(_0x28706e){if(_0x28706e){return _0x28706e[_0x1982('0x2c')]({'exitAt':moment()['format'](_0x1982('0x30')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x1982('0xf')](function(){return _0x26b8c0[_0x1982('0x2c')]({'voicePause':![]});});case _0x1982('0x3f'):case _0x1982('0x40'):case _0x1982('0x41'):case _0x1982('0x42'):case _0x1982('0x43'):case'whatsapp':return db['MemberReport'][_0x1982('0x24')]({'where':{'channel':_0x3c2c9a['body'][_0x1982('0x3b')],'membername':_0x26b8c0['name'],'type':'PAUSE','exitAt':null}})[_0x1982('0xf')](function(_0x29c759){return _0x29c759[_0x1982('0x2c')]({'exitAt':moment()[_0x1982('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x1982('0x44')},{'individualHooks':!![]});})[_0x1982('0xf')](function(){var _0xc646bc={};_[_0x1982('0x45')](_0xc646bc,util[_0x1982('0x2f')](_0x1982('0x46'),_0x3c2c9a[_0x1982('0x36')][_0x1982('0x3b')],_0x1982('0x47')),![]);return _0x26b8c0[_0x1982('0x2c')](_0xc646bc);});default:return db[_0x1982('0x2b')][_0x1982('0x2c')]({'paused':0x0},{'where':{'UserId':_0x26b8c0['id']}})[_0x1982('0xf')](function(){return db[_0x1982('0x2d')][_0x1982('0x1c')]({'where':{'membername':_0x26b8c0[_0x1982('0x27')],'type':_0x1982('0x35'),'exitAt':null}});})[_0x1982('0xf')](function(_0x23130e){var _0x52a2ea=[];_0x23130e[_0x1982('0x32')](function(_0x2fdb45){_0x52a2ea['push'](_0x2fdb45[_0x1982('0x2c')]({'exitAt':moment()[_0x1982('0x2f')](_0x1982('0x30')),'data2':'system'}));});return BPromise['all'](_0x52a2ea);})['then'](function(){return _0x26b8c0['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x1982('0xf')](function(_0x4a6888){_0x43290c(_0x4a6888);})[_0x1982('0x19')](function(_0x472027){_0x2df381(_0x25effa[_0x1982('0x15')](0x1f4,_0x472027[_0x1982('0x17')]));});});};exports[_0x1982('0x48')]=function(_0xe77172){var _0x17a8e4=this;return new Promise(function(_0x3ffd45,_0x35e687){var _0x15a6c6;return db['User'][_0x1982('0x49')]({'where':_0xe77172[_0x1982('0x1d')][_0x1982('0x1f')]||{},'attributes':['id',_0x1982('0x27')]})[_0x1982('0xf')](function(_0x3b50fe){if(_0x3b50fe){_0x15a6c6=_0x3b50fe;return db[_0x1982('0x2b')]['destroy']({'where':{'membername':_0x15a6c6[_0x1982('0x27')]},'individualHooks':!![]});}})[_0x1982('0xf')](function(){if(_0x15a6c6){return db['MemberReport'][_0x1982('0x1c')]({'where':{'membername':_0x15a6c6[_0x1982('0x27')],'exitAt':null}});}})[_0x1982('0xf')](function(_0x4f9e90){if(_0x15a6c6){if(_0x4f9e90&&_0x4f9e90[_0x1982('0x2e')]){var _0x2a3597=[];_0x4f9e90['forEach'](function(_0x89562f){_0x2a3597[_0x1982('0x33')](_0x89562f[_0x1982('0x2c')]({'exitAt':moment()[_0x1982('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x1982('0x4a')](_0x2a3597);}}})[_0x1982('0xf')](function(){if(_0x15a6c6){return _0x15a6c6[_0x1982('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1982('0xf')](function(_0x480c91){_0x3ffd45(_0x480c91);})[_0x1982('0x19')](function(_0x2aa657){_0x35e687(_0x17a8e4['error'](0x1f4,_0x2aa657[_0x1982('0x17')]));});});};exports[_0x1982('0x4b')]=function(_0x34df0b){var _0x1a7723=this;return new Promise(function(_0x40d12f,_0x2289e2){var _0x2aefb2;var _0x580714;var _0x4b1396;var _0x34da3d;return db[_0x1982('0x1b')][_0x1982('0x49')]({'where':_0x34df0b[_0x1982('0x1d')][_0x1982('0x1f')]||{},'attributes':['id',_0x1982('0x27'),_0x1982('0x28'),'mobile',_0x1982('0x4c'),'internal',_0x1982('0x4d'),_0x1982('0x2a')]})[_0x1982('0xf')](function(_0x43cdd6){if(_0x43cdd6){_0x2aefb2=_0x43cdd6;_0x34da3d=_0x34df0b[_0x1982('0x36')][_0x1982('0x2a')]?_0x34df0b[_0x1982('0x36')][_0x1982('0x2a')]:util[_0x1982('0x2f')](_0x1982('0x34'),_0x2aefb2['name']);return db[_0x1982('0x1b')][_0x1982('0x4e')]({'where':{'role':_0x1982('0x4f'),'online':!![],'id':{'$ne':_0x2aefb2['id']}}});}})[_0x1982('0xf')](function(_0x22dc12){if(_0x22dc12){_0x4b1396=_0x22dc12;return require(_0x1982('0x50'))[_0x1982('0x51')]();}})[_0x1982('0xf')](function(_0x130e96){if(_0x130e96&&_0x130e96[_0x1982('0x52')]&&_0x4b1396>=_0x130e96[_0x1982('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x2aefb2){return db[_0x1982('0x2b')][_0x1982('0x53')]({'where':{'membername':_0x2aefb2[_0x1982('0x27')]},'individualHooks':!![]});}})[_0x1982('0xf')](function(){if(_0x2aefb2){return _0x2aefb2[_0x1982('0x54')]({'raw':!![]});}})[_0x1982('0xf')](function(_0x490fa7){if(_0x2aefb2){if(_0x490fa7){var _0x3dba6d=[];_0x580714=_0x490fa7;if(_0x580714[_0x1982('0x2e')]){for(var _0x884a8d=0x0;_0x884a8d<_0x580714[_0x1982('0x2e')];_0x884a8d++){_0x3dba6d[_0x1982('0x33')](db[_0x1982('0x2b')][_0x1982('0x55')]({'membername':_0x2aefb2[_0x1982('0x27')],'UserId':_0x2aefb2['id'],'queue_name':_0x580714[_0x884a8d][_0x1982('0x27')],'VoiceQueueId':_0x580714[_0x884a8d]['id'],'interface':_0x34da3d,'paused':_0x2aefb2[_0x1982('0x4d')]||![],'penalty':_0x580714[_0x884a8d][_0x1982('0x56')]||0x0}));}return BPromise[_0x1982('0x4a')](_0x3dba6d);}}}})[_0x1982('0xf')](function(){if(_0x2aefb2){return db[_0x1982('0x2d')][_0x1982('0x1c')]({'where':{'membername':_0x2aefb2[_0x1982('0x27')],'exitAt':null}});}})[_0x1982('0xf')](function(_0x5bfd4e){if(_0x2aefb2){if(_0x5bfd4e&&_0x5bfd4e['length']){var _0x76f249=[];_0x5bfd4e[_0x1982('0x32')](function(_0x25203e){_0x76f249['push'](_0x25203e[_0x1982('0x2c')]({'exitAt':moment()[_0x1982('0x2f')](_0x1982('0x30'))}));});return BPromise[_0x1982('0x4a')](_0x76f249);}}})[_0x1982('0xf')](function(_0x32d7ba){if(_0x2aefb2){var _0x48e7f7=[];var _0x1a9545=[];var _0x330848=utils[_0x1982('0x31')]();var _0x178c25={'membername':_0x2aefb2[_0x1982('0x27')],'interface':_0x34da3d,'enterAt':moment()['format'](_0x1982('0x30')),'role':_0x2aefb2['role'],'internal':_0x2aefb2[_0x1982('0x29')]};_0x330848[_0x1982('0x32')](function(_0x5840b2){_0x48e7f7['push'](_[_0x1982('0x57')]({'channel':_0x5840b2,'type':_0x1982('0x58'),'data1':_0x1982('0x59'),'data2':_0x34da3d},_0x178c25));if(_0x2aefb2['loginInPause']){_0x1a9545[_0x1982('0x33')](_[_0x1982('0x57')]({'channel':_0x5840b2,'type':_0x1982('0x35'),'data1':'LOGININPAUSE'},_0x178c25));}});return db['MemberReport'][_0x1982('0x39')](_0x48e7f7['concat'](_0x1a9545),{'individualHooks':!![]});}})[_0x1982('0xf')](function(){if(_0x2aefb2){return _0x2aefb2[_0x1982('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0x1982('0x30')),'voicePause':_0x2aefb2[_0x1982('0x4d')]||![],'mailPause':_0x2aefb2[_0x1982('0x4d')]||![],'chatPause':_0x2aefb2[_0x1982('0x4d')]||![],'faxPause':_0x2aefb2[_0x1982('0x4d')]||![],'smsPause':_0x2aefb2[_0x1982('0x4d')]||![],'openchannelPause':_0x2aefb2[_0x1982('0x4d')]||![],'pauseType':_0x2aefb2['loginInPause']?_0x1982('0x5a'):null,'lastPauseAt':moment()[_0x1982('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x34da3d});}})[_0x1982('0xf')](function(_0x20aea4){_0x40d12f(_0x20aea4);})[_0x1982('0x19')](function(_0x1eb3ff){_0x2289e2(_0x1a7723['error'](0x1f4,_0x1eb3ff['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index eee68bb..7968312 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 _0x6420=['./user.events','save','update','removeListener','register','length'];(function(_0x15ed84,_0x589521){var _0x426d2b=function(_0x5d294a){while(--_0x5d294a){_0x15ed84['push'](_0x15ed84['shift']());}};_0x426d2b(++_0x589521);}(_0x6420,0xe4));var _0x0642=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x6420[_0x9729d7];return _0x3c4ac6;};'use strict';var UserEvents=require(_0x0642('0x0'));var events=[_0x0642('0x1'),'remove',_0x0642('0x2')];function createListener(_0xf9df62,_0x20a20d){return function(_0x3b44a3){_0x20a20d['emit'](_0xf9df62,_0x3b44a3);};}function removeListener(_0x151d3e,_0x664471){return function(){UserEvents[_0x0642('0x3')](_0x151d3e,_0x664471);};}exports[_0x0642('0x4')]=function(_0x47f0fa){for(var _0x47a6de=0x0,_0x19bc86=events[_0x0642('0x5')];_0x47a6de<_0x19bc86;_0x47a6de++){var _0x5684e9=events[_0x47a6de];var _0x1d72b6=createListener('user:'+_0x5684e9,_0x47f0fa);UserEvents['on'](_0x5684e9,_0x1d72b6);}}; \ No newline at end of file +var _0xf1eb=['length','user:','./user.events','save','remove','update','emit','register'];(function(_0x201284,_0x512432){var _0x59758e=function(_0x478fb1){while(--_0x478fb1){_0x201284['push'](_0x201284['shift']());}};_0x59758e(++_0x512432);}(_0xf1eb,0x112));var _0xbf1e=function(_0x45175c,_0x27f36c){_0x45175c=_0x45175c-0x0;var _0x203bd5=_0xf1eb[_0x45175c];return _0x203bd5;};'use strict';var UserEvents=require(_0xbf1e('0x0'));var events=[_0xbf1e('0x1'),_0xbf1e('0x2'),_0xbf1e('0x3')];function createListener(_0x389dfe,_0x3c7cd0){return function(_0x62172){_0x3c7cd0[_0xbf1e('0x4')](_0x389dfe,_0x62172);};}function removeListener(_0x25d692,_0x53ebaa){return function(){UserEvents['removeListener'](_0x25d692,_0x53ebaa);};}exports[_0xbf1e('0x5')]=function(_0x79776c){for(var _0x1f2e62=0x0,_0x4e26a9=events[_0xbf1e('0x6')];_0x1f2e62<_0x4e26a9;_0x1f2e62++){var _0x3d7876=events[_0x1f2e62];var _0x2eddd0=createListener(_0xbf1e('0x7')+_0x3d7876,_0x79776c);UserEvents['on'](_0x3d7876,_0x2eddd0);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 72125cc..d513f85 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x36923f,_0x3caad1){var _0x56bab1=function(_0x46ab96){while(--_0x46ab96){_0x36923f['push'](_0x36923f['shift']());}};_0x56bab1(++_0x3caad1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1c9721,_0x3f83a4){var _0x5b1a4c=function(_0x44f048){while(--_0x44f048){_0x1c9721['push'](_0x1c9721['shift']());}};_0x5b1a4c(++_0x3f83a4);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d2ab47d..16a5e14 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 _0xc439=['sequelize','exports','INTEGER'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0xc439,0x174));var _0x9c43=function(_0x5da7db,_0x23d34c){_0x5da7db=_0x5da7db-0x0;var _0x2c3f2d=_0xc439[_0x5da7db];return _0x2c3f2d;};'use strict';var Sequelize=require(_0x9c43('0x0'));module[_0x9c43('0x1')]={'penalty':{'type':Sequelize[_0x9c43('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf768=['sequelize','INTEGER'];(function(_0x3fd13d,_0x3303e0){var _0x545f04=function(_0x22dc29){while(--_0x22dc29){_0x3fd13d['push'](_0x3fd13d['shift']());}};_0x545f04(++_0x3303e0);}(_0xf768,0x1dc));var _0x8f76=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf768[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x8f76('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8f76('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 319e694..3a7f9b3 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 _0xcbc0=['user_has_chat_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x14a396,_0x8f50d2){var _0x100c25=function(_0x2a90cd){while(--_0x2a90cd){_0x14a396['push'](_0x14a396['shift']());}};_0x100c25(++_0x8f50d2);}(_0xcbc0,0x1b9));var _0x0cbc=function(_0x101aea,_0x5d0370){_0x101aea=_0x101aea-0x0;var _0x14d8d6=_0xcbc0[_0x101aea];return _0x14d8d6;};'use strict';var _=require('lodash');var util=require(_0x0cbc('0x0'));var logger=require(_0x0cbc('0x1'))(_0x0cbc('0x2'));var moment=require('moment');var BPromise=require(_0x0cbc('0x3'));var rp=require(_0x0cbc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cbc('0x5'));var config=require(_0x0cbc('0x6'));var attributes=require(_0x0cbc('0x7'));module[_0x0cbc('0x8')]=function(_0x4f71b1,_0x345042){return _0x4f71b1[_0x0cbc('0x9')]('UserChatQueue',attributes,{'tableName':_0x0cbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9bd=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x492191,_0x56038b){var _0x34ba8f=function(_0x1ba94c){while(--_0x1ba94c){_0x492191['push'](_0x492191['shift']());}};_0x34ba8f(++_0x56038b);}(_0xf9bd,0x13c));var _0xdf9b=function(_0x4b8b5b,_0x246ff5){_0x4b8b5b=_0x4b8b5b-0x0;var _0x7f9fb7=_0xf9bd[_0x4b8b5b];return _0x7f9fb7;};'use strict';var _=require(_0xdf9b('0x0'));var util=require(_0xdf9b('0x1'));var logger=require(_0xdf9b('0x2'))(_0xdf9b('0x3'));var moment=require(_0xdf9b('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf9b('0x5'));var fs=require('fs');var path=require(_0xdf9b('0x6'));var rimraf=require(_0xdf9b('0x7'));var config=require(_0xdf9b('0x8'));var attributes=require(_0xdf9b('0x9'));module[_0xdf9b('0xa')]=function(_0x419b18,_0x454828){return _0x419b18[_0xdf9b('0xb')](_0xdf9b('0xc'),attributes,{'tableName':_0xdf9b('0xd'),'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 e287843..b4e4da9 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 _0x6d96=['error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x29cb64,_0x53cb46){var _0x4e6010=function(_0x2a885d){while(--_0x2a885d){_0x29cb64['push'](_0x29cb64['shift']());}};_0x4e6010(++_0x53cb46);}(_0x6d96,0x10e));var _0x66d9=function(_0x3a3d83,_0x419a5a){_0x3a3d83=_0x3a3d83-0x0;var _0x2b9c43=_0x6d96[_0x3a3d83];return _0x2b9c43;};'use strict';var _=require(_0x66d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x66d9('0x1'));var fs=require('fs');var Redis=require(_0x66d9('0x2'));var db=require(_0x66d9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x66d9('0x4'))(_0x66d9('0x5'));var config=require(_0x66d9('0x6'));var jayson=require(_0x66d9('0x7'));var client=jayson[_0x66d9('0x8')][_0x66d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30dde2,_0x10e90e,_0x465f5a){return new BPromise(function(_0x61ffbd,_0x366d75){return client['request'](_0x30dde2,_0x465f5a)[_0x66d9('0xa')](function(_0x4a7199){logger[_0x66d9('0xb')](_0x66d9('0xc'),_0x10e90e,_0x66d9('0xd'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x10e90e,_0x66d9('0xd'),JSON[_0x66d9('0xe')](_0x4a7199));if(_0x4a7199[_0x66d9('0xf')]){if(_0x4a7199[_0x66d9('0xf')]['code']===0x1f4){logger[_0x66d9('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x10e90e,_0x4a7199['error'][_0x66d9('0x10')]);return _0x366d75(_0x4a7199[_0x66d9('0xf')][_0x66d9('0x10')]);}logger[_0x66d9('0xf')](_0x66d9('0xc'),_0x10e90e,_0x4a7199['error'][_0x66d9('0x10')]);return _0x61ffbd(_0x4a7199[_0x66d9('0xf')][_0x66d9('0x10')]);}else{logger[_0x66d9('0xb')](_0x66d9('0xc'),_0x10e90e,_0x66d9('0xd'));_0x61ffbd(_0x4a7199[_0x66d9('0x11')][_0x66d9('0x10')]);}})[_0x66d9('0x12')](function(_0x2607c8){logger['error'](_0x66d9('0xc'),_0x10e90e,_0x2607c8);_0x366d75(_0x2607c8);});});} \ No newline at end of file +var _0xcd1a=['ioredis','rpc','../../config/environment','jayson/promise','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcd1a,0x1c7));var _0xacd1=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xcd1a[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xacd1('0x0'));var util=require(_0xacd1('0x1'));var moment=require('moment');var BPromise=require(_0xacd1('0x2'));var rs=require(_0xacd1('0x3'));var fs=require('fs');var Redis=require(_0xacd1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xacd1('0x5'));var config=require(_0xacd1('0x6'));var jayson=require(_0xacd1('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ed1f1,_0x1c8e60,_0x5960b9){return new BPromise(function(_0x43194d,_0x3ca4a4){return client['request'](_0x5ed1f1,_0x5960b9)[_0xacd1('0x8')](function(_0x310a98){logger[_0xacd1('0x9')](_0xacd1('0xa'),_0x1c8e60,_0xacd1('0xb'));logger[_0xacd1('0xc')](_0xacd1('0xd'),_0x1c8e60,_0xacd1('0xb'),JSON['stringify'](_0x310a98));if(_0x310a98['error']){if(_0x310a98[_0xacd1('0xe')][_0xacd1('0xf')]===0x1f4){logger[_0xacd1('0xe')](_0xacd1('0xa'),_0x1c8e60,_0x310a98['error'][_0xacd1('0x10')]);return _0x3ca4a4(_0x310a98[_0xacd1('0xe')]['message']);}logger[_0xacd1('0xe')](_0xacd1('0xa'),_0x1c8e60,_0x310a98[_0xacd1('0xe')][_0xacd1('0x10')]);return _0x43194d(_0x310a98[_0xacd1('0xe')][_0xacd1('0x10')]);}else{logger[_0xacd1('0x9')]('UserChatQueue,\x20%s,\x20%s',_0x1c8e60,_0xacd1('0xb'));_0x43194d(_0x310a98['result'][_0xacd1('0x10')]);}})['catch'](function(_0x389742){logger[_0xacd1('0xe')](_0xacd1('0xa'),_0x1c8e60,_0x389742);_0x3ca4a4(_0x389742);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 6809681..9a51b54 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3bbb66,_0x280aa2){var _0x872225=function(_0x1725e6){while(--_0x1725e6){_0x3bbb66['push'](_0x3bbb66['shift']());}};_0x872225(++_0x280aa2);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5d6ad9,_0x3b16f1){var _0x59dcad=function(_0x51a824){while(--_0x51a824){_0x5d6ad9['push'](_0x5d6ad9['shift']());}};_0x59dcad(++_0x3b16f1);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 507629f..46f830a 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 _0xa99a=['exports','INTEGER','STRING','sequelize'];(function(_0x4aeab5,_0x9e37c4){var _0xcd3269=function(_0x1c671a){while(--_0x1c671a){_0x4aeab5['push'](_0x4aeab5['shift']());}};_0xcd3269(++_0x9e37c4);}(_0xa99a,0xd3));var _0xaa99=function(_0x566ad2,_0x32c79){_0x566ad2=_0x566ad2-0x0;var _0x5aa2f4=_0xa99a[_0x566ad2];return _0x5aa2f4;};'use strict';var Sequelize=require(_0xaa99('0x0'));module[_0xaa99('0x1')]={'penalty':{'type':Sequelize[_0xaa99('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaa99('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaa99('0x3')]}}; \ No newline at end of file +var _0x565b=['INTEGER','STRING','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x565b,0x98));var _0xb565=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x565b[_0x2f87cd];return _0x5d7eda;};'use strict';var Sequelize=require('sequelize');module[_0xb565('0x0')]={'penalty':{'type':Sequelize[_0xb565('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb565('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb565('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 1afe412..ca6eb63 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 _0xd1e8=['../../config/logger','moment','path','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x267ced,_0x4ed942){var _0x2dc8aa=function(_0x16bf91){while(--_0x16bf91){_0x267ced['push'](_0x267ced['shift']());}};_0x2dc8aa(++_0x4ed942);}(_0xd1e8,0x1d2));var _0x8d1e=function(_0x4d04d6,_0x38ae19){_0x4d04d6=_0x4d04d6-0x0;var _0x2e937a=_0xd1e8[_0x4d04d6];return _0x2e937a;};'use strict';var _=require(_0x8d1e('0x0'));var util=require(_0x8d1e('0x1'));var logger=require(_0x8d1e('0x2'))('api');var moment=require(_0x8d1e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d1e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8d1e('0x5'));module[_0x8d1e('0x6')]=function(_0xf02f43,_0x5a1ce3){return _0xf02f43['define'](_0x8d1e('0x7'),attributes,{'tableName':_0x8d1e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec25=['path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','api','request-promise'];(function(_0x5455a5,_0x32e2a6){var _0x57abd9=function(_0x28bffd){while(--_0x28bffd){_0x5455a5['push'](_0x5455a5['shift']());}};_0x57abd9(++_0x32e2a6);}(_0xec25,0x8e));var _0x5ec2=function(_0x1a69e5,_0x5a97d7){_0x1a69e5=_0x1a69e5-0x0;var _0x293d43=_0xec25[_0x1a69e5];return _0x293d43;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5ec2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ec2('0x1'));var fs=require('fs');var path=require(_0x5ec2('0x2'));var rimraf=require(_0x5ec2('0x3'));var config=require(_0x5ec2('0x4'));var attributes=require(_0x5ec2('0x5'));module[_0x5ec2('0x6')]=function(_0x5d8f11,_0x266313){return _0x5d8f11[_0x5ec2('0x7')]('UserFaxQueue',attributes,{'tableName':_0x5ec2('0x8'),'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 05c8225..f864d4f 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 _0x611d=['rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils'];(function(_0x4ad4cc,_0x1f991e){var _0xb92c35=function(_0x2c9366){while(--_0x2c9366){_0x4ad4cc['push'](_0x4ad4cc['shift']());}};_0xb92c35(++_0x1f991e);}(_0x611d,0x1f0));var _0xd611=function(_0xcb1e6d,_0x50f22e){_0xcb1e6d=_0xcb1e6d-0x0;var _0x621f25=_0x611d[_0xcb1e6d];return _0x621f25;};'use strict';var _=require(_0xd611('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd611('0x1'));var rs=require(_0xd611('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd611('0x3'));var logger=require('../../config/logger')(_0xd611('0x4'));var config=require(_0xd611('0x5'));var jayson=require(_0xd611('0x6'));var client=jayson[_0xd611('0x7')][_0xd611('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56654c,_0x3c1f63,_0x1a8821){return new BPromise(function(_0x2d4d89,_0x5d7d1f){return client[_0xd611('0x9')](_0x56654c,_0x1a8821)['then'](function(_0x5d96db){logger[_0xd611('0xa')](_0xd611('0xb'),_0x3c1f63,_0xd611('0xc'));logger[_0xd611('0xd')](_0xd611('0xe'),_0x3c1f63,_0xd611('0xc'),JSON[_0xd611('0xf')](_0x5d96db));if(_0x5d96db[_0xd611('0x10')]){if(_0x5d96db[_0xd611('0x10')]['code']===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3c1f63,_0x5d96db['error'][_0xd611('0x11')]);return _0x5d7d1f(_0x5d96db[_0xd611('0x10')]['message']);}logger[_0xd611('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x3c1f63,_0x5d96db[_0xd611('0x10')][_0xd611('0x11')]);return _0x2d4d89(_0x5d96db[_0xd611('0x10')][_0xd611('0x11')]);}else{logger[_0xd611('0xa')](_0xd611('0xb'),_0x3c1f63,'request\x20sent');_0x2d4d89(_0x5d96db[_0xd611('0x12')]['message']);}})[_0xd611('0x13')](function(_0x2c21bb){logger['error'](_0xd611('0xb'),_0x3c1f63,_0x2c21bb);_0x5d7d1f(_0x2c21bb);});});} \ No newline at end of file +var _0x45c0=['message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0x45c0,0xdc));var _0x045c=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x45c0[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0x045c('0x0'));var util=require(_0x045c('0x1'));var moment=require(_0x045c('0x2'));var BPromise=require('bluebird');var rs=require(_0x045c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x045c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x045c('0x5'))(_0x045c('0x6'));var config=require(_0x045c('0x7'));var jayson=require(_0x045c('0x8'));var client=jayson[_0x045c('0x9')][_0x045c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18b1e3,_0x29cdc5,_0xa9a26f){return new BPromise(function(_0x1459e2,_0x524226){return client[_0x045c('0xb')](_0x18b1e3,_0xa9a26f)[_0x045c('0xc')](function(_0xdf4514){logger['info'](_0x045c('0xd'),_0x29cdc5,_0x045c('0xe'));logger[_0x045c('0xf')](_0x045c('0x10'),_0x29cdc5,_0x045c('0xe'),JSON[_0x045c('0x11')](_0xdf4514));if(_0xdf4514[_0x045c('0x12')]){if(_0xdf4514[_0x045c('0x12')][_0x045c('0x13')]===0x1f4){logger[_0x045c('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x29cdc5,_0xdf4514[_0x045c('0x12')]['message']);return _0x524226(_0xdf4514[_0x045c('0x12')][_0x045c('0x14')]);}logger['error'](_0x045c('0xd'),_0x29cdc5,_0xdf4514[_0x045c('0x12')][_0x045c('0x14')]);return _0x1459e2(_0xdf4514[_0x045c('0x12')]['message']);}else{logger[_0x045c('0x15')](_0x045c('0xd'),_0x29cdc5,_0x045c('0xe'));_0x1459e2(_0xdf4514[_0x045c('0x16')][_0x045c('0x14')]);}})[_0x045c('0x17')](function(_0x35f7ec){logger[_0x045c('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x29cdc5,_0x35f7ec);_0x524226(_0x35f7ec);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 49cb899..92b18b9 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4ea17a,_0x4b9c83){var _0x58e65f=function(_0x46ad6d){while(--_0x46ad6d){_0x4ea17a['push'](_0x4ea17a['shift']());}};_0x58e65f(++_0x4b9c83);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x264bfe,_0x508ca0){var _0x437b4a=function(_0x4aed4a){while(--_0x4aed4a){_0x264bfe['push'](_0x264bfe['shift']());}};_0x437b4a(++_0x508ca0);}(_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 4b74088..f547e75 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 _0xb005=['sequelize','exports','INTEGER'];(function(_0x3f0786,_0x33449e){var _0x259401=function(_0x4d0dee){while(--_0x4d0dee){_0x3f0786['push'](_0x3f0786['shift']());}};_0x259401(++_0x33449e);}(_0xb005,0x159));var _0x5b00=function(_0x25c692,_0x170ddc){_0x25c692=_0x25c692-0x0;var _0x44f341=_0xb005[_0x25c692];return _0x44f341;};'use strict';var Sequelize=require(_0x5b00('0x0'));module[_0x5b00('0x1')]={'penalty':{'type':Sequelize[_0x5b00('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8024=['exports','INTEGER'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x8024,0xd4));var _0x4802=function(_0x1f2f7c,_0x5c6232){_0x1f2f7c=_0x1f2f7c-0x0;var _0x22b754=_0x8024[_0x1f2f7c];return _0x22b754;};'use strict';var Sequelize=require('sequelize');module[_0x4802('0x0')]={'penalty':{'type':Sequelize[_0x4802('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 4b858a1..27715c6 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 _0x8704=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x587300,_0x1da910){var _0x558b95=function(_0x40e531){while(--_0x40e531){_0x587300['push'](_0x587300['shift']());}};_0x558b95(++_0x1da910);}(_0x8704,0x180));var _0x4870=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x8704[_0x44a64f];return _0x52024b;};'use strict';var _=require(_0x4870('0x0'));var util=require(_0x4870('0x1'));var logger=require(_0x4870('0x2'))(_0x4870('0x3'));var moment=require(_0x4870('0x4'));var BPromise=require(_0x4870('0x5'));var rp=require(_0x4870('0x6'));var fs=require('fs');var path=require(_0x4870('0x7'));var rimraf=require(_0x4870('0x8'));var config=require(_0x4870('0x9'));var attributes=require(_0x4870('0xa'));module[_0x4870('0xb')]=function(_0x42e52b,_0xf40ed5){return _0x42e52b[_0x4870('0xc')](_0x4870('0xd'),attributes,{'tableName':_0x4870('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x783b=['lodash','util','path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0x783b,0x1cb));var _0xb783=function(_0x2fcf17,_0x3f7eca){_0x2fcf17=_0x2fcf17-0x0;var _0x13176c=_0x783b[_0x2fcf17];return _0x13176c;};'use strict';var _=require(_0xb783('0x0'));var util=require(_0xb783('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(_0xb783('0x2'));var rimraf=require('rimraf');var config=require(_0xb783('0x3'));var attributes=require(_0xb783('0x4'));module[_0xb783('0x5')]=function(_0x206084,_0x266d4a){return _0x206084[_0xb783('0x6')](_0xb783('0x7'),attributes,{'tableName':_0xb783('0x8'),'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 588d963..5269759 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3f501d,_0x3ec339){var _0x2ddd08=function(_0x1966fd){while(--_0x1966fd){_0x3f501d['push'](_0x3f501d['shift']());}};_0x2ddd08(++_0x3ec339);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var 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']('UserMailQueue,\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/userNotification/index.js b/server/api/userNotification/index.js index aa0adc8..77430cd 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 _0x722d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','sendUserNotification','exports','multer','util','path','express'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0x722d,0xc8));var _0xd722=function(_0xe5b3e1,_0x57a645){_0xe5b3e1=_0xe5b3e1-0x0;var _0x121dad=_0x722d[_0xe5b3e1];return _0x121dad;};'use strict';var multer=require(_0xd722('0x0'));var util=require(_0xd722('0x1'));var path=require(_0xd722('0x2'));var timeout=require('connect-timeout');var express=require(_0xd722('0x3'));var router=express[_0xd722('0x4')]();var fs_extra=require(_0xd722('0x5'));var auth=require(_0xd722('0x6'));var interaction=require(_0xd722('0x7'));var config=require(_0xd722('0x8'));var controller=require('./userNotification.controller');router[_0xd722('0x9')]('/',auth['isAuthenticated'](),controller[_0xd722('0xa')]);module[_0xd722('0xb')]=router; \ No newline at end of file +var _0x0d81=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','sendUserNotification','exports','path'];(function(_0x3a6894,_0x9f7a96){var _0x4094e5=function(_0x5b8b20){while(--_0x5b8b20){_0x3a6894['push'](_0x3a6894['shift']());}};_0x4094e5(++_0x9f7a96);}(_0x0d81,0xf9));var _0x10d8=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x0d81[_0x9aada2];return _0x196dff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x10d8('0x0'));var timeout=require('connect-timeout');var express=require(_0x10d8('0x1'));var router=express[_0x10d8('0x2')]();var fs_extra=require(_0x10d8('0x3'));var auth=require(_0x10d8('0x4'));var interaction=require(_0x10d8('0x5'));var config=require(_0x10d8('0x6'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x10d8('0x7')](),controller[_0x10d8('0x8')]);module[_0x10d8('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 63e0046..35b4db1 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 _0x5868=['TEXT','STRING','sequelize'];(function(_0x4eb1c9,_0x5d20c7){var _0x3a7511=function(_0x54ce39){while(--_0x54ce39){_0x4eb1c9['push'](_0x4eb1c9['shift']());}};_0x3a7511(++_0x5d20c7);}(_0x5868,0xcb));var _0x8586=function(_0x3c635e,_0x2569fe){_0x3c635e=_0x3c635e-0x0;var _0x52a6e8=_0x5868[_0x3c635e];return _0x52a6e8;};'use strict';var Sequelize=require(_0x8586('0x0'));module['exports']={'body':{'type':Sequelize[_0x8586('0x1')]},'senderName':{'type':Sequelize[_0x8586('0x2')]},'recipientsId':{'type':Sequelize[_0x8586('0x1')]},'recipientsDescription':{'type':Sequelize[_0x8586('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x973b=['TEXT','BOOLEAN','exports'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x973b,0xef));var _0xb973=function(_0x596fc5,_0x3883f9){_0x596fc5=_0x596fc5-0x0;var _0x329b0b=_0x973b[_0x596fc5];return _0x329b0b;};'use strict';var Sequelize=require('sequelize');module[_0xb973('0x0')]={'body':{'type':Sequelize[_0xb973('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xb973('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xb973('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 97ed947..090a358 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 _0x5f66=['body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','catch','Template','findOne','html','render','startCase','toLowerCase','User','union','ids','queue','all','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification'];(function(_0x2ddf2d,_0x272b8a){var _0x53dd02=function(_0x5a889c){while(--_0x5a889c){_0x2ddf2d['push'](_0x2ddf2d['shift']());}};_0x53dd02(++_0x272b8a);}(_0x5f66,0x1dc));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require('moment');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(_0x65f6('0x9'));var _=require(_0x65f6('0xa'));var squel=require(_0x65f6('0xb'));var crypto=require(_0x65f6('0xc'));var jsforce=require(_0x65f6('0xd'));var deskjs=require(_0x65f6('0xe'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xf'));var Papa=require(_0x65f6('0x10'));var Redis=require(_0x65f6('0x11'));var authService=require(_0x65f6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x65f6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65f6('0x14'))('api');var utils=require(_0x65f6('0x15'));var config=require(_0x65f6('0x16'));var licenseUtil=require(_0x65f6('0x17'));var db=require(_0x65f6('0x18'))['db'];config[_0x65f6('0x19')]=_[_0x65f6('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x65f6('0x1b'))(new Redis(config[_0x65f6('0x19')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x3ef914,_0x326e17){_0x326e17=_0x326e17||0xcc;return function(_0x3cdc71){if(_0x3cdc71){return _0x3ef914[_0x65f6('0x1c')](_0x326e17);}return _0x3ef914[_0x65f6('0x1d')](_0x326e17)[_0x65f6('0x1e')]();};}function respondWithResult(_0x214921,_0x1fee96){_0x1fee96=_0x1fee96||0xc8;return function(_0x369269){if(_0x369269){return _0x214921['status'](_0x1fee96)[_0x65f6('0x1f')](_0x369269);}};}function respondWithFilteredResult(_0x39a3e5,_0x14a5ec){return function(_0x598c41){if(_0x598c41){var _0x4e3650=typeof _0x14a5ec['offset']===_0x65f6('0x20')&&typeof _0x14a5ec[_0x65f6('0x21')]===_0x65f6('0x20');var _0x47caff=_0x598c41[_0x65f6('0x22')];var _0x2eb276=_0x4e3650?0x0:_0x14a5ec[_0x65f6('0x23')];var _0x2be908=_0x4e3650?_0x598c41[_0x65f6('0x22')]:_0x14a5ec[_0x65f6('0x23')]+_0x14a5ec['limit'];var _0x182c0c;if(_0x2be908>=_0x47caff){_0x2be908=_0x47caff;_0x182c0c=0xc8;}else{_0x182c0c=0xce;}_0x39a3e5[_0x65f6('0x1d')](_0x182c0c);return _0x39a3e5[_0x65f6('0x24')](_0x65f6('0x25'),_0x2eb276+'-'+_0x2be908+'/'+_0x47caff)[_0x65f6('0x1f')](_0x598c41);}return null;};}function patchUpdates(_0x57b1e2){return function(_0x1c2bcc){try{jsonpatch[_0x65f6('0x26')](_0x1c2bcc,_0x57b1e2,!![]);}catch(_0x6476cd){return BPromise[_0x65f6('0x27')](_0x6476cd);}return _0x1c2bcc[_0x65f6('0x28')]();};}function saveUpdates(_0x419e0d,_0x164409){return function(_0x1837b3){if(_0x1837b3){return _0x1837b3[_0x65f6('0x29')](_0x419e0d)[_0x65f6('0x2a')](function(_0x533954){return _0x533954;});}return null;};}function removeEntity(_0x39f7ab,_0x373553){return function(_0x2e392e){if(_0x2e392e){return _0x2e392e[_0x65f6('0x2b')]()[_0x65f6('0x2a')](function(){_0x39f7ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54aa2f,_0x4a7493){return function(_0x3877b6){if(!_0x3877b6){_0x54aa2f[_0x65f6('0x1c')](0x194);}return _0x3877b6;};}function handleError(_0x1471f8,_0x6c8cc1){_0x6c8cc1=_0x6c8cc1||0x1f4;return function(_0x48fa98){logger[_0x65f6('0x2c')](_0x48fa98[_0x65f6('0x2d')]);if(_0x48fa98[_0x65f6('0x2e')]){delete _0x48fa98[_0x65f6('0x2e')];}_0x1471f8['status'](_0x6c8cc1)[_0x65f6('0x2f')](_0x48fa98);};}exports[_0x65f6('0x30')]=function(_0x496fc8,_0x5f52d5,_0x39af72){if(!_0x496fc8[_0x65f6('0x31')]['hasOwnProperty'](_0x65f6('0x32'))&&!_0x496fc8['body'][_0x65f6('0x33')](_0x65f6('0x34'))){throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x37'));}else{if(_0x496fc8[_0x65f6('0x31')][_0x65f6('0x33')]('TemplateId')&&!_0x496fc8[_0x65f6('0x31')][_0x65f6('0x33')](_0x65f6('0x38'))){throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x39'));}if(!_0x496fc8[_0x65f6('0x31')]['hasOwnProperty'](_0x65f6('0x3a'))){throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x3b'));}else{try{var _0x67bed2=JSON[_0x65f6('0x3c')](_0x496fc8[_0x65f6('0x31')]['recipients']);}catch(_0x45c9fe){logger[_0x65f6('0x2c')](_0x45c9fe);throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x3d'));}var _0x239bbc=[_0x65f6('0x3e'),_0x65f6('0x3f'),_0x65f6('0x40'),_0x65f6('0x41'),_0x65f6('0x42'),_0x65f6('0x43'),_0x65f6('0x44'),_0x65f6('0x45'),_0x65f6('0x46')];if(_[_0x65f6('0x47')](_0x67bed2,function(_0x58e653){return!_[_0x65f6('0x48')](_0x239bbc,_0x58e653[_0x65f6('0x49')]['toLowerCase']());})){throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x4a'));}}}var _0x45ffad={};_0x45ffad[_0x65f6('0x4b')]=_0x496fc8[_0x65f6('0x31')][_0x65f6('0x33')](_0x65f6('0x4b'))?_0x496fc8[_0x65f6('0x31')]['senderName']:_0x496fc8[_0x65f6('0x46')][_0x65f6('0x4c')];_0x45ffad[_0x65f6('0x4d')]=_[_0x65f6('0x4e')](_0x496fc8[_0x65f6('0x31')][_0x65f6('0x4d')])?null:_0x496fc8[_0x65f6('0x31')][_0x65f6('0x4d')];_0x45ffad[_0x65f6('0x4f')]=_0x496fc8['body'][_0x65f6('0x4f')]||![];_0x45ffad[_0x65f6('0x50')]=_0x496fc8[_0x65f6('0x46')]['id'];return getContent(_0x496fc8['body'])[_0x65f6('0x2a')](function(_0x15628a){_0x45ffad[_0x65f6('0x31')]=_0x15628a;return getRecipients(_0x67bed2);})['then'](function(_0x4520ac){_0x45ffad[_0x65f6('0x51')]=_[_0x65f6('0x52')](_0x4520ac)[_0x65f6('0x53')](',');return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x2f9247){return db['UserNotification'][_0x65f6('0x56')](_0x45ffad,{'raw':!![],'transaction':_0x2f9247})[_0x65f6('0x2a')](function(_0x5b4f67){var _0x41208c={'sender':_0x45ffad['senderName'],'description':_0x45ffad['recipientsDescription'],'content':_0x45ffad[_0x65f6('0x31')],'beep':_0x45ffad[_0x65f6('0x4f')]};_0x4520ac[_0x65f6('0x57')](function(_0x1a0b2f){_0x41208c[_0x65f6('0x58')]=_0x1a0b2f;socket[_0x65f6('0x59')]('userNotification:send',_0x41208c);});return _0x5b4f67;});});})[_0x65f6('0x2a')](respondWithResult(_0x5f52d5,0xc9))[_0x65f6('0x5a')](handleError(_0x5f52d5,null));};function getContent(_0x8186d5){return new BPromise(function(_0x262abd,_0x449a29){if(_0x8186d5[_0x65f6('0x32')]){_0x262abd(_0x8186d5[_0x65f6('0x32')]);return;}return db[_0x65f6('0x5b')][_0x65f6('0x5c')]({'attributes':[_0x65f6('0x5d')],'where':{'id':_0x8186d5[_0x65f6('0x34')]},'raw':!![]})[_0x65f6('0x2a')](function(_0x3a5873){if(!_0x3a5873)throw new db['Sequelize'][(_0x65f6('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4ceb0e=Mustache[_0x65f6('0x5e')](_0x3a5873[_0x65f6('0x5d')],_0x8186d5[_0x65f6('0x38')]);_0x262abd(_0x4ceb0e);})['catch'](function(_0x5dd793){_0x449a29(_0x5dd793);});});}function getRecipients(_0x57a38c){return new BPromise(function(_0x969d7b,_0x5692d6){var _0x1c6787=[];var _0x917e48=[];_0x57a38c['forEach'](function(_0x24fe43){var _0x46d61c=_[_0x65f6('0x5f')](_0x24fe43[_0x65f6('0x49')][_0x65f6('0x60')]());if(_0x46d61c===_0x65f6('0x61')){_0x1c6787=_[_0x65f6('0x62')](_0x1c6787,_0x24fe43[_0x65f6('0x63')]);}else{if(_[_0x65f6('0x48')](_0x46d61c,'queue'))_0x46d61c=_0x46d61c['replace'](_0x65f6('0x64'),'Queue');_0x24fe43[_0x65f6('0x63')]['forEach'](function(_0x12f71a){_0x917e48['push'](getAgents(_0x46d61c,_0x12f71a));});}});return BPromise[_0x65f6('0x65')](_0x917e48)['then'](function(_0x3c1f48){_0x1c6787=_[_0x65f6('0x62')](_0x1c6787,_[_0x65f6('0x66')](_0x3c1f48));_0x969d7b(_0x1c6787);})['catch'](function(_0x189e83){_0x5692d6(_0x189e83);});});}function getAgents(_0x43002b,_0x15bead){return new BPromise(function(_0x269b6f,_0x580b67){return db[_0x43002b][_0x65f6('0x5c')]({'where':{'id':_0x15bead}})[_0x65f6('0x2a')](function(_0x3a6e19){return _0x3a6e19[_0x65f6('0x67')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1a9848){var _0x202a04=_[_0x65f6('0x68')](_0x1a9848,'id');_0x269b6f(_0x202a04);});})[_0x65f6('0x5a')](function(_0x2d7c3d){_0x580b67(_0x2d7c3d);});});} \ No newline at end of file +var _0x9e79=['catch','startCase','union','ids','queue','Queue','push','flatten','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','forEach','emit','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9e79,0x135));var _0x99e7=function(_0x54e547,_0x4bbf7c){_0x54e547=_0x54e547-0x0;var _0x209dd5=_0x9e79[_0x54e547];return _0x209dd5;};'use strict';var emlformat=require(_0x99e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99e7('0x1'));var jsonpatch=require(_0x99e7('0x2'));var rp=require(_0x99e7('0x3'));var moment=require(_0x99e7('0x4'));var BPromise=require(_0x99e7('0x5'));var Mustache=require(_0x99e7('0x6'));var util=require(_0x99e7('0x7'));var path=require(_0x99e7('0x8'));var sox=require('sox');var csv=require(_0x99e7('0x9'));var ejs=require(_0x99e7('0xa'));var fs=require('fs');var fs_extra=require(_0x99e7('0xb'));var _=require(_0x99e7('0xc'));var squel=require(_0x99e7('0xd'));var crypto=require(_0x99e7('0xe'));var jsforce=require(_0x99e7('0xf'));var deskjs=require(_0x99e7('0x10'));var toCsv=require(_0x99e7('0x9'));var querystring=require(_0x99e7('0x11'));var Papa=require(_0x99e7('0x12'));var Redis=require(_0x99e7('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x99e7('0x14'));var as=require(_0x99e7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99e7('0x16'))(_0x99e7('0x17'));var utils=require(_0x99e7('0x18'));var config=require(_0x99e7('0x19'));var licenseUtil=require(_0x99e7('0x1a'));var db=require(_0x99e7('0x1b'))['db'];config[_0x99e7('0x1c')]=_[_0x99e7('0x1d')](config[_0x99e7('0x1c')],{'host':_0x99e7('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x99e7('0x1f'))[_0x99e7('0x20')](socket);function respondWithStatusCode(_0x108891,_0x281e88){_0x281e88=_0x281e88||0xcc;return function(_0x2d7a69){if(_0x2d7a69){return _0x108891['sendStatus'](_0x281e88);}return _0x108891[_0x99e7('0x21')](_0x281e88)[_0x99e7('0x22')]();};}function respondWithResult(_0x165149,_0x55e7dc){_0x55e7dc=_0x55e7dc||0xc8;return function(_0x31dd4f){if(_0x31dd4f){return _0x165149[_0x99e7('0x21')](_0x55e7dc)[_0x99e7('0x23')](_0x31dd4f);}};}function respondWithFilteredResult(_0x3e3b8d,_0x38c821){return function(_0x13ab35){if(_0x13ab35){var _0x14feab=typeof _0x38c821[_0x99e7('0x24')]===_0x99e7('0x25')&&typeof _0x38c821['limit']===_0x99e7('0x25');var _0x4fe21c=_0x13ab35[_0x99e7('0x26')];var _0x409ffc=_0x14feab?0x0:_0x38c821[_0x99e7('0x24')];var _0x206925=_0x14feab?_0x13ab35[_0x99e7('0x26')]:_0x38c821[_0x99e7('0x24')]+_0x38c821[_0x99e7('0x27')];var _0x2abf55;if(_0x206925>=_0x4fe21c){_0x206925=_0x4fe21c;_0x2abf55=0xc8;}else{_0x2abf55=0xce;}_0x3e3b8d[_0x99e7('0x21')](_0x2abf55);return _0x3e3b8d[_0x99e7('0x28')](_0x99e7('0x29'),_0x409ffc+'-'+_0x206925+'/'+_0x4fe21c)[_0x99e7('0x23')](_0x13ab35);}return null;};}function patchUpdates(_0x19247f){return function(_0x1da4f6){try{jsonpatch[_0x99e7('0x2a')](_0x1da4f6,_0x19247f,!![]);}catch(_0x1e9910){return BPromise[_0x99e7('0x2b')](_0x1e9910);}return _0x1da4f6[_0x99e7('0x2c')]();};}function saveUpdates(_0x4b16cd,_0x300434){return function(_0x3e7345){if(_0x3e7345){return _0x3e7345['update'](_0x4b16cd)[_0x99e7('0x2d')](function(_0x1cc125){return _0x1cc125;});}return null;};}function removeEntity(_0x2c2996,_0x1f5585){return function(_0x73e3ba){if(_0x73e3ba){return _0x73e3ba['destroy']()[_0x99e7('0x2d')](function(){_0x2c2996[_0x99e7('0x21')](0xcc)[_0x99e7('0x22')]();});}};}function handleEntityNotFound(_0x375a39,_0x115d12){return function(_0x245bef){if(!_0x245bef){_0x375a39['sendStatus'](0x194);}return _0x245bef;};}function handleError(_0x245733,_0x5fa121){_0x5fa121=_0x5fa121||0x1f4;return function(_0x2f364c){logger[_0x99e7('0x2e')](_0x2f364c[_0x99e7('0x2f')]);if(_0x2f364c[_0x99e7('0x30')]){delete _0x2f364c[_0x99e7('0x30')];}_0x245733[_0x99e7('0x21')](_0x5fa121)[_0x99e7('0x31')](_0x2f364c);};}exports['sendUserNotification']=function(_0x3d761e,_0x53fe04,_0x5f4fb3){if(!_0x3d761e[_0x99e7('0x32')][_0x99e7('0x33')](_0x99e7('0x34'))&&!_0x3d761e['body']['hasOwnProperty'](_0x99e7('0x35'))){throw new db[(_0x99e7('0x36'))][(_0x99e7('0x37'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3d761e[_0x99e7('0x32')][_0x99e7('0x33')](_0x99e7('0x35'))&&!_0x3d761e[_0x99e7('0x32')][_0x99e7('0x33')](_0x99e7('0x38'))){throw new db[(_0x99e7('0x36'))]['ValidationError'](_0x99e7('0x39'));}if(!_0x3d761e['body'][_0x99e7('0x33')]('recipients')){throw new db[(_0x99e7('0x36'))][(_0x99e7('0x37'))](_0x99e7('0x3a'));}else{try{var _0x143e23=JSON[_0x99e7('0x3b')](_0x3d761e[_0x99e7('0x32')][_0x99e7('0x3c')]);}catch(_0xd85e3b){logger[_0x99e7('0x2e')](_0xd85e3b);throw new db[(_0x99e7('0x36'))][(_0x99e7('0x37'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x341eca=[_0x99e7('0x3d'),_0x99e7('0x3e'),_0x99e7('0x3f'),'openchannelqueue',_0x99e7('0x40'),_0x99e7('0x41'),_0x99e7('0x42'),_0x99e7('0x43'),_0x99e7('0x44')];if(_[_0x99e7('0x45')](_0x143e23,function(_0x3c409d){return!_[_0x99e7('0x46')](_0x341eca,_0x3c409d[_0x99e7('0x47')]['toLowerCase']());})){throw new db[(_0x99e7('0x36'))][(_0x99e7('0x37'))](_0x99e7('0x48'));}}}var _0x527ce1={};_0x527ce1['senderName']=_0x3d761e['body']['hasOwnProperty'](_0x99e7('0x49'))?_0x3d761e[_0x99e7('0x32')]['senderName']:_0x3d761e[_0x99e7('0x44')]['fullname'];_0x527ce1[_0x99e7('0x4a')]=_[_0x99e7('0x4b')](_0x3d761e[_0x99e7('0x32')][_0x99e7('0x4a')])?null:_0x3d761e[_0x99e7('0x32')][_0x99e7('0x4a')];_0x527ce1[_0x99e7('0x4c')]=_0x3d761e[_0x99e7('0x32')][_0x99e7('0x4c')]||![];_0x527ce1[_0x99e7('0x4d')]=_0x3d761e[_0x99e7('0x44')]['id'];return getContent(_0x3d761e['body'])[_0x99e7('0x2d')](function(_0x2be1ca){_0x527ce1[_0x99e7('0x32')]=_0x2be1ca;return getRecipients(_0x143e23);})[_0x99e7('0x2d')](function(_0x3cf2ab){_0x527ce1[_0x99e7('0x4e')]=_[_0x99e7('0x4f')](_0x3cf2ab)[_0x99e7('0x50')](',');return db[_0x99e7('0x51')]['transaction'](function(_0x5c2aa2){return db[_0x99e7('0x52')]['create'](_0x527ce1,{'raw':!![],'transaction':_0x5c2aa2})[_0x99e7('0x2d')](function(_0x460b1d){var _0x4e7fb7={'sender':_0x527ce1[_0x99e7('0x49')],'description':_0x527ce1['recipientsDescription'],'content':_0x527ce1['body'],'beep':_0x527ce1['beep']};_0x3cf2ab[_0x99e7('0x53')](function(_0x368250){_0x4e7fb7['recipient']=_0x368250;socket[_0x99e7('0x54')](_0x99e7('0x55'),_0x4e7fb7);});return _0x460b1d;});});})['then'](respondWithResult(_0x53fe04,0xc9))['catch'](handleError(_0x53fe04,null));};function getContent(_0x1cb56a){return new BPromise(function(_0x5d3428,_0x226e4f){if(_0x1cb56a[_0x99e7('0x34')]){_0x5d3428(_0x1cb56a[_0x99e7('0x34')]);return;}return db[_0x99e7('0x56')][_0x99e7('0x57')]({'attributes':[_0x99e7('0x58')],'where':{'id':_0x1cb56a['TemplateId']},'raw':!![]})[_0x99e7('0x2d')](function(_0x5d2ca9){if(!_0x5d2ca9)throw new db[(_0x99e7('0x36'))]['ValidationError'](_0x99e7('0x59'));var _0x284be8=Mustache[_0x99e7('0x5a')](_0x5d2ca9['html'],_0x1cb56a[_0x99e7('0x38')]);_0x5d3428(_0x284be8);})[_0x99e7('0x5b')](function(_0x3384ec){_0x226e4f(_0x3384ec);});});}function getRecipients(_0x2ee66d){return new BPromise(function(_0x4a6f59,_0x2580d7){var _0x3ca41a=[];var _0x315b1a=[];_0x2ee66d['forEach'](function(_0xa5a58a){var _0x54885b=_[_0x99e7('0x5c')](_0xa5a58a[_0x99e7('0x47')]['toLowerCase']());if(_0x54885b==='User'){_0x3ca41a=_[_0x99e7('0x5d')](_0x3ca41a,_0xa5a58a[_0x99e7('0x5e')]);}else{if(_['includes'](_0x54885b,_0x99e7('0x5f')))_0x54885b=_0x54885b['replace']('queue',_0x99e7('0x60'));_0xa5a58a[_0x99e7('0x5e')][_0x99e7('0x53')](function(_0x1f2927){_0x315b1a[_0x99e7('0x61')](getAgents(_0x54885b,_0x1f2927));});}});return BPromise['all'](_0x315b1a)['then'](function(_0x32f285){_0x3ca41a=_['union'](_0x3ca41a,_[_0x99e7('0x62')](_0x32f285));_0x4a6f59(_0x3ca41a);})[_0x99e7('0x5b')](function(_0x15892b){_0x2580d7(_0x15892b);});});}function getAgents(_0x5f5877,_0x1e8e4f){return new BPromise(function(_0x397668,_0x1e9e57){return db[_0x5f5877]['findOne']({'where':{'id':_0x1e8e4f}})[_0x99e7('0x2d')](function(_0x2aa35b){return _0x2aa35b['getAgents']({'attributes':['id'],'raw':!![]})[_0x99e7('0x2d')](function(_0x5362a1){var _0x589cda=_[_0x99e7('0x63')](_0x5362a1,'id');_0x397668(_0x589cda);});})[_0x99e7('0x5b')](function(_0x950635){_0x1e9e57(_0x950635);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 3f1648a..f223f51 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 _0xed1f=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','emit'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0xed1f,0x1c2));var _0xfed1=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xed1f[_0x12f688];return _0x59c3de;};'use strict';var EventEmitter=require(_0xfed1('0x0'));var UserNotification=require(_0xfed1('0x1'))['db'][_0xfed1('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfed1('0x3')](0x0);var events={'afterCreate':_0xfed1('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e3cdb){return function(_0x52d4e8,_0x4f3ba,_0x51bd46){UserNotificationEvents[_0xfed1('0x5')](_0x3e3cdb+':'+_0x52d4e8['id'],_0x52d4e8);UserNotificationEvents['emit'](_0x3e3cdb,_0x52d4e8);_0x51bd46(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xfed1('0x6')](e,emitEvent(event));}}module[_0xfed1('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x1fe8=['emit','hasOwnProperty','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove'];(function(_0x13b9aa,_0x43e410){var _0x3e7d46=function(_0xd20ee7){while(--_0xd20ee7){_0x13b9aa['push'](_0x13b9aa['shift']());}};_0x3e7d46(++_0x43e410);}(_0x1fe8,0xad));var _0x81fe=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1fe8[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require(_0x81fe('0x0'));var UserNotification=require(_0x81fe('0x1'))['db'][_0x81fe('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x81fe('0x3')](0x0);var events={'afterCreate':_0x81fe('0x4'),'afterUpdate':_0x81fe('0x5'),'afterDestroy':_0x81fe('0x6')};function emitEvent(_0x1a36da){return function(_0x444de9,_0x31a1f8,_0x3b2d26){UserNotificationEvents[_0x81fe('0x7')](_0x1a36da+':'+_0x444de9['id'],_0x444de9);UserNotificationEvents[_0x81fe('0x7')](_0x1a36da,_0x444de9);_0x3b2d26(null);};}for(var e in events){if(events[_0x81fe('0x8')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index d8c99ea..170e618 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 _0x3107=['rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','path'];(function(_0x1017c3,_0x7127ba){var _0x335335=function(_0x26a87e){while(--_0x26a87e){_0x1017c3['push'](_0x1017c3['shift']());}};_0x335335(++_0x7127ba);}(_0x3107,0x1b8));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7310('0x0'))(_0x7310('0x1'));var moment=require('moment');var BPromise=require(_0x7310('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7310('0x3'));var rimraf=require(_0x7310('0x4'));var config=require(_0x7310('0x5'));var attributes=require(_0x7310('0x6'));module[_0x7310('0x7')]=function(_0x11338c,_0xcb315f){return _0x11338c[_0x7310('0x8')](_0x7310('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7310('0xa'),'collate':_0x7310('0xb')});}; \ No newline at end of file +var _0x878f=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util'];(function(_0x486ea0,_0x454bcd){var _0x3a8f6c=function(_0x14012d){while(--_0x14012d){_0x486ea0['push'](_0x486ea0['shift']());}};_0x3a8f6c(++_0x454bcd);}(_0x878f,0x124));var _0xf878=function(_0x1d5089,_0x1a0043){_0x1d5089=_0x1d5089-0x0;var _0x54a318=_0x878f[_0x1d5089];return _0x54a318;};'use strict';var _=require(_0xf878('0x0'));var util=require(_0xf878('0x1'));var logger=require(_0xf878('0x2'))(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var rp=require(_0xf878('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf878('0x7'));var attributes=require(_0xf878('0x8'));module[_0xf878('0x9')]=function(_0x505f2c,_0x19c79b){return _0x505f2c[_0xf878('0xa')](_0xf878('0xb'),attributes,{'tableName':_0xf878('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf878('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 501c057..57a1e98 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 _0xb83f=['message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x16e9db,_0x548630){var _0x133a3e=function(_0x27ddfb){while(--_0x27ddfb){_0x16e9db['push'](_0x16e9db['shift']());}};_0x133a3e(++_0x548630);}(_0xb83f,0x64));var _0xfb83=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb83f[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xfb83('0x0'));var util=require(_0xfb83('0x1'));var moment=require(_0xfb83('0x2'));var BPromise=require(_0xfb83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb83('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfb83('0x5'));var config=require(_0xfb83('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb83('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfb83('0x8')],{'host':_0xfb83('0x9'),'port':0x18eb});var socket=require(_0xfb83('0xa'))(new Redis(config['redis']));require(_0xfb83('0xb'))[_0xfb83('0xc')](socket);function respondWithRpcPromise(_0x1b9ce3,_0x1ab903,_0x511610){return new BPromise(function(_0xea70e6,_0x23b3ad){return client[_0xfb83('0xd')](_0x1b9ce3,_0x511610)[_0xfb83('0xe')](function(_0x7d74bf){logger['info'](_0xfb83('0xf'),_0x1ab903,'request\x20sent');logger[_0xfb83('0x10')](_0xfb83('0x11'),_0x1ab903,_0xfb83('0x12'),JSON['stringify'](_0x7d74bf));if(_0x7d74bf[_0xfb83('0x13')]){if(_0x7d74bf[_0xfb83('0x13')]['code']===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x1ab903,_0x7d74bf[_0xfb83('0x13')]['message']);return _0x23b3ad(_0x7d74bf[_0xfb83('0x13')][_0xfb83('0x14')]);}logger[_0xfb83('0x13')](_0xfb83('0xf'),_0x1ab903,_0x7d74bf[_0xfb83('0x13')][_0xfb83('0x14')]);return _0xea70e6(_0x7d74bf[_0xfb83('0x13')][_0xfb83('0x14')]);}else{logger[_0xfb83('0x15')](_0xfb83('0xf'),_0x1ab903,_0xfb83('0x12'));_0xea70e6(_0x7d74bf[_0xfb83('0x16')][_0xfb83('0x14')]);}})[_0xfb83('0x17')](function(_0x306560){logger['error'](_0xfb83('0xf'),_0x1ab903,_0x306560);_0x23b3ad(_0x306560);});});} \ No newline at end of file +var _0xc96e=['register','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./userNotification.socket'];(function(_0x1ae0ea,_0x5c0919){var _0x404277=function(_0x2c04c4){while(--_0x2c04c4){_0x1ae0ea['push'](_0x1ae0ea['shift']());}};_0x404277(++_0x5c0919);}(_0xc96e,0x181));var _0xec96=function(_0xa80850,_0x538229){_0xa80850=_0xa80850-0x0;var _0x37e8de=_0xc96e[_0xa80850];return _0x37e8de;};'use strict';var _=require(_0xec96('0x0'));var util=require(_0xec96('0x1'));var moment=require(_0xec96('0x2'));var BPromise=require('bluebird');var rs=require(_0xec96('0x3'));var fs=require('fs');var Redis=require(_0xec96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec96('0x5'));var logger=require(_0xec96('0x6'))(_0xec96('0x7'));var config=require(_0xec96('0x8'));var jayson=require(_0xec96('0x9'));var client=jayson[_0xec96('0xa')][_0xec96('0xb')]({'port':0x232a});config['redis']=_[_0xec96('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xec96('0xd'))(new Redis(config['redis']));require(_0xec96('0xe'))[_0xec96('0xf')](socket);function respondWithRpcPromise(_0x2df863,_0x215c3e,_0x3b9b89){return new BPromise(function(_0x11a319,_0x5a1069){return client['request'](_0x2df863,_0x3b9b89)['then'](function(_0x5c309d){logger[_0xec96('0x10')](_0xec96('0x11'),_0x215c3e,_0xec96('0x12'));logger['debug'](_0xec96('0x13'),_0x215c3e,'request\x20sent',JSON[_0xec96('0x14')](_0x5c309d));if(_0x5c309d['error']){if(_0x5c309d[_0xec96('0x15')]['code']===0x1f4){logger[_0xec96('0x15')](_0xec96('0x11'),_0x215c3e,_0x5c309d[_0xec96('0x15')]['message']);return _0x5a1069(_0x5c309d[_0xec96('0x15')][_0xec96('0x16')]);}logger[_0xec96('0x15')]('UserNotification,\x20%s,\x20%s',_0x215c3e,_0x5c309d[_0xec96('0x15')][_0xec96('0x16')]);return _0x11a319(_0x5c309d[_0xec96('0x15')][_0xec96('0x16')]);}else{logger[_0xec96('0x10')](_0xec96('0x11'),_0x215c3e,_0xec96('0x12'));_0x11a319(_0x5c309d[_0xec96('0x17')]['message']);}})[_0xec96('0x18')](function(_0x5480f9){logger[_0xec96('0x15')](_0xec96('0x11'),_0x215c3e,_0x5480f9);_0x5a1069(_0x5480f9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index d844ad7..d55df42 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 _0xc388=['./userNotification.events','remove','emit','removeListener','register','userNotification:'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc388,0x198));var _0x8c38=function(_0x33db25,_0x2b1e8b){_0x33db25=_0x33db25-0x0;var _0x3aac0f=_0xc388[_0x33db25];return _0x3aac0f;};'use strict';var UserNotificationEvents=require(_0x8c38('0x0'));var events=['save',_0x8c38('0x1'),'update'];function createListener(_0x20b154,_0x48836e){return function(_0x35ccb6){_0x48836e[_0x8c38('0x2')](_0x20b154,_0x35ccb6);};}function removeListener(_0x5d19ab,_0x583e6b){return function(){UserNotificationEvents[_0x8c38('0x3')](_0x5d19ab,_0x583e6b);};}exports[_0x8c38('0x4')]=function(_0x18bac8){for(var _0x9ca034=0x0,_0x19e6d7=events['length'];_0x9ca034<_0x19e6d7;_0x9ca034++){var _0x5c26b9=events[_0x9ca034];var _0x550baf=createListener(_0x8c38('0x5')+_0x5c26b9,_0x18bac8);UserNotificationEvents['on'](_0x5c26b9,_0x550baf);}}; \ No newline at end of file +var _0x275d=['remove','update','emit','removeListener','length','userNotification:','./userNotification.events','save'];(function(_0x17ebb6,_0x465af7){var _0x32ec22=function(_0x160ff0){while(--_0x160ff0){_0x17ebb6['push'](_0x17ebb6['shift']());}};_0x32ec22(++_0x465af7);}(_0x275d,0x166));var _0xd275=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x275d[_0xa4c85];return _0x172c1f;};'use strict';var UserNotificationEvents=require(_0xd275('0x0'));var events=[_0xd275('0x1'),_0xd275('0x2'),_0xd275('0x3')];function createListener(_0x2546ff,_0x4b976f){return function(_0x394dd1){_0x4b976f[_0xd275('0x4')](_0x2546ff,_0x394dd1);};}function removeListener(_0x4ee882,_0x1c86e5){return function(){UserNotificationEvents[_0xd275('0x5')](_0x4ee882,_0x1c86e5);};}exports['register']=function(_0x5a3c0a){for(var _0x37aaae=0x0,_0x4e120c=events[_0xd275('0x6')];_0x37aaae<_0x4e120c;_0x37aaae++){var _0x47d006=events[_0x37aaae];var _0x5662c4=createListener(_0xd275('0x7')+_0x47d006,_0x5a3c0a);UserNotificationEvents['on'](_0x47d006,_0x5662c4);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index bf1408d..f7492a7 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2bf846,_0x455687){var _0x2e62ee=function(_0x444881){while(--_0x444881){_0x2bf846['push'](_0x2bf846['shift']());}};_0x2e62ee(++_0x455687);}(_0xedd9,0xfc));var _0x9edd=function(_0x50f241,_0x5c2b5f){_0x50f241=_0x50f241-0x0;var _0xa594ee=_0xedd9[_0x50f241];return _0xa594ee;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x106126,_0x1a23f5){var _0xb620d7=function(_0x2dcdbc){while(--_0x2dcdbc){_0x106126['push'](_0x106126['shift']());}};_0xb620d7(++_0x1a23f5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xcb91[_0x52e0ee];return _0x32534c;};'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 e0d2516..a488f56 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 _0x1755=['exports','INTEGER','sequelize'];(function(_0x475265,_0xb6a2a6){var _0x18328e=function(_0x3e886d){while(--_0x3e886d){_0x475265['push'](_0x475265['shift']());}};_0x18328e(++_0xb6a2a6);}(_0x1755,0xce));var _0x5175=function(_0x46867c,_0x2ad9de){_0x46867c=_0x46867c-0x0;var _0x5af482=_0x1755[_0x46867c];return _0x5af482;};'use strict';var Sequelize=require(_0x5175('0x0'));module[_0x5175('0x1')]={'penalty':{'type':Sequelize[_0x5175('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb23c=['sequelize'];(function(_0x19f5b2,_0x186275){var _0x2c5e85=function(_0x315486){while(--_0x315486){_0x19f5b2['push'](_0x19f5b2['shift']());}};_0x2c5e85(++_0x186275);}(_0xb23c,0x80));var _0xcb23=function(_0x294e8c,_0x22b0cc){_0x294e8c=_0x294e8c-0x0;var _0x2669be=_0xb23c[_0x294e8c];return _0x2669be;};'use strict';var Sequelize=require(_0xcb23('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index bd8dad5..541aed7 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 _0x603e=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x603e,0x16a));var _0xe603=function(_0xc80b2b,_0x5a12e9){_0xc80b2b=_0xc80b2b-0x0;var _0x22af6f=_0x603e[_0xc80b2b];return _0x22af6f;};'use strict';var _=require(_0xe603('0x0'));var util=require(_0xe603('0x1'));var logger=require(_0xe603('0x2'))('api');var moment=require(_0xe603('0x3'));var BPromise=require('bluebird');var rp=require(_0xe603('0x4'));var fs=require('fs');var path=require(_0xe603('0x5'));var rimraf=require(_0xe603('0x6'));var config=require(_0xe603('0x7'));var attributes=require(_0xe603('0x8'));module[_0xe603('0x9')]=function(_0x123276,_0x459c86){return _0x123276[_0xe603('0xa')](_0xe603('0xb'),attributes,{'tableName':_0xe603('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9811=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','moment'];(function(_0x334982,_0x2eba37){var _0x28ca61=function(_0xd84e42){while(--_0xd84e42){_0x334982['push'](_0x334982['shift']());}};_0x28ca61(++_0x2eba37);}(_0x9811,0x1b6));var _0x1981=function(_0x24fae8,_0x335683){_0x24fae8=_0x24fae8-0x0;var _0x123071=_0x9811[_0x24fae8];return _0x123071;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1981('0x0'))('api');var moment=require(_0x1981('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1981('0x2'));var rimraf=require(_0x1981('0x3'));var config=require(_0x1981('0x4'));var attributes=require(_0x1981('0x5'));module[_0x1981('0x6')]=function(_0x126974,_0x273fc2){return _0x126974[_0x1981('0x7')](_0x1981('0x8'),attributes,{'tableName':_0x1981('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 e82d0ba..6c9193f 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 _0xd5a1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x1d8472,_0x4e1392){var _0x27a1a3=function(_0x230256){while(--_0x230256){_0x1d8472['push'](_0x1d8472['shift']());}};_0x27a1a3(++_0x4e1392);}(_0xd5a1,0x164));var _0x1d5a=function(_0x1982c5,_0x5e4fbf){_0x1982c5=_0x1982c5-0x0;var _0x38d139=_0xd5a1[_0x1982c5];return _0x38d139;};'use strict';var _=require('lodash');var util=require(_0x1d5a('0x0'));var moment=require('moment');var BPromise=require(_0x1d5a('0x1'));var rs=require(_0x1d5a('0x2'));var fs=require('fs');var Redis=require(_0x1d5a('0x3'));var db=require(_0x1d5a('0x4'))['db'];var utils=require(_0x1d5a('0x5'));var logger=require(_0x1d5a('0x6'))(_0x1d5a('0x7'));var config=require(_0x1d5a('0x8'));var jayson=require(_0x1d5a('0x9'));var client=jayson[_0x1d5a('0xa')][_0x1d5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10bc60,_0x31841f,_0x361a08){return new BPromise(function(_0x2ecadc,_0x2d0594){return client['request'](_0x10bc60,_0x361a08)[_0x1d5a('0xc')](function(_0x5f512d){logger[_0x1d5a('0xd')](_0x1d5a('0xe'),_0x31841f,_0x1d5a('0xf'));logger[_0x1d5a('0x10')](_0x1d5a('0x11'),_0x31841f,'request\x20sent',JSON[_0x1d5a('0x12')](_0x5f512d));if(_0x5f512d[_0x1d5a('0x13')]){if(_0x5f512d[_0x1d5a('0x13')][_0x1d5a('0x14')]===0x1f4){logger[_0x1d5a('0x13')](_0x1d5a('0xe'),_0x31841f,_0x5f512d[_0x1d5a('0x13')][_0x1d5a('0x15')]);return _0x2d0594(_0x5f512d[_0x1d5a('0x13')]['message']);}logger['error'](_0x1d5a('0xe'),_0x31841f,_0x5f512d[_0x1d5a('0x13')][_0x1d5a('0x15')]);return _0x2ecadc(_0x5f512d[_0x1d5a('0x13')][_0x1d5a('0x15')]);}else{logger['info'](_0x1d5a('0xe'),_0x31841f,'request\x20sent');_0x2ecadc(_0x5f512d[_0x1d5a('0x16')]['message']);}})[_0x1d5a('0x17')](function(_0x4ee9f0){logger['error'](_0x1d5a('0xe'),_0x31841f,_0x4ee9f0);_0x2d0594(_0x4ee9f0);});});} \ No newline at end of file +var _0x6be5=['client','http','request','then','info','debug','request\x20sent','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x546cac,_0x19ed07){var _0x1ee76e=function(_0x4f8cc0){while(--_0x4f8cc0){_0x546cac['push'](_0x546cac['shift']());}};_0x1ee76e(++_0x19ed07);}(_0x6be5,0x10a));var _0x56be=function(_0x3d6353,_0x54668d){_0x3d6353=_0x3d6353-0x0;var _0x3bfb2a=_0x6be5[_0x3d6353];return _0x3bfb2a;};'use strict';var _=require('lodash');var util=require(_0x56be('0x0'));var moment=require('moment');var BPromise=require(_0x56be('0x1'));var rs=require(_0x56be('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56be('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56be('0x4'));var config=require(_0x56be('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x56be('0x6')][_0x56be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a9867,_0x8e5874,_0x2f8b38){return new BPromise(function(_0x746615,_0x2eab55){return client[_0x56be('0x8')](_0x3a9867,_0x2f8b38)[_0x56be('0x9')](function(_0x576e89){logger[_0x56be('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x8e5874,'request\x20sent');logger[_0x56be('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x8e5874,_0x56be('0xc'),JSON['stringify'](_0x576e89));if(_0x576e89['error']){if(_0x576e89[_0x56be('0xd')][_0x56be('0xe')]===0x1f4){logger[_0x56be('0xd')](_0x56be('0xf'),_0x8e5874,_0x576e89['error'][_0x56be('0x10')]);return _0x2eab55(_0x576e89[_0x56be('0xd')][_0x56be('0x10')]);}logger[_0x56be('0xd')](_0x56be('0xf'),_0x8e5874,_0x576e89['error']['message']);return _0x746615(_0x576e89[_0x56be('0xd')][_0x56be('0x10')]);}else{logger[_0x56be('0xa')](_0x56be('0xf'),_0x8e5874,_0x56be('0xc'));_0x746615(_0x576e89['result'][_0x56be('0x10')]);}})['catch'](function(_0x28c7be){logger[_0x56be('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x8e5874,_0x28c7be);_0x2eab55(_0x28c7be);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ecfdfc9..22710df 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 _0xc172=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','delete','removeSections','removeResources','multer','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc172,0x1bd));var _0x2c17=function(_0x7ac660,_0x5937e1){_0x7ac660=_0x7ac660-0x0;var _0x1bbb8d=_0xc172[_0x7ac660];return _0x1bbb8d;};'use strict';var multer=require(_0x2c17('0x0'));var util=require(_0x2c17('0x1'));var path=require(_0x2c17('0x2'));var timeout=require(_0x2c17('0x3'));var express=require(_0x2c17('0x4'));var router=express[_0x2c17('0x5')]();var fs_extra=require(_0x2c17('0x6'));var auth=require(_0x2c17('0x7'));var interaction=require(_0x2c17('0x8'));var config=require(_0x2c17('0x9'));var controller=require(_0x2c17('0xa'));router[_0x2c17('0xb')]('/',auth['isAuthenticated'](),controller[_0x2c17('0xc')]);router[_0x2c17('0xb')](_0x2c17('0xd'),auth[_0x2c17('0xe')](),controller[_0x2c17('0xf')]);router[_0x2c17('0xb')](_0x2c17('0x10'),auth[_0x2c17('0xe')](),controller['show']);router['get'](_0x2c17('0x11'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x12')]);router[_0x2c17('0xb')](_0x2c17('0x13'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x14')]);router['post']('/',auth[_0x2c17('0xe')](),controller[_0x2c17('0x15')]);router[_0x2c17('0x16')](_0x2c17('0x17'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x18')]);router[_0x2c17('0x16')](_0x2c17('0x11'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x19')]);router['post']('/:id/resources',auth[_0x2c17('0xe')](),controller[_0x2c17('0x1a')]);router[_0x2c17('0x1b')](_0x2c17('0x10'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x1c')]);router[_0x2c17('0x1d')](_0x2c17('0x10'),auth[_0x2c17('0xe')](),controller['destroy']);router[_0x2c17('0x1d')]('/:id/sections',auth[_0x2c17('0xe')](),controller[_0x2c17('0x1e')]);router[_0x2c17('0x1d')](_0x2c17('0x13'),auth['isAuthenticated'](),controller[_0x2c17('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x3442=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','describe','/:id','isAuthenticated','getResources','post','create','/:id/clone','/:id/sections','addSections','addResources','put','update','delete','destroy','removeSections','/:id/resources','removeResources'];(function(_0x570c38,_0x24fa95){var _0x2091b9=function(_0x1d2f46){while(--_0x1d2f46){_0x570c38['push'](_0x570c38['shift']());}};_0x2091b9(++_0x24fa95);}(_0x3442,0x118));var _0x2344=function(_0x47affd,_0x2560fe){_0x47affd=_0x47affd-0x0;var _0x158961=_0x3442[_0x47affd];return _0x158961;};'use strict';var multer=require(_0x2344('0x0'));var util=require(_0x2344('0x1'));var path=require('path');var timeout=require(_0x2344('0x2'));var express=require(_0x2344('0x3'));var router=express[_0x2344('0x4')]();var fs_extra=require(_0x2344('0x5'));var auth=require(_0x2344('0x6'));var interaction=require(_0x2344('0x7'));var config=require(_0x2344('0x8'));var controller=require(_0x2344('0x9'));router[_0x2344('0xa')]('/',auth['isAuthenticated'](),controller[_0x2344('0xb')]);router['get'](_0x2344('0xc'),auth['isAuthenticated'](),controller[_0x2344('0xd')]);router[_0x2344('0xa')](_0x2344('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2344('0xa')]('/:id/sections',auth['isAuthenticated'](),controller['getSections']);router[_0x2344('0xa')]('/:id/resources',auth[_0x2344('0xf')](),controller[_0x2344('0x10')]);router[_0x2344('0x11')]('/',auth['isAuthenticated'](),controller[_0x2344('0x12')]);router[_0x2344('0x11')](_0x2344('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0x2344('0x11')](_0x2344('0x14'),auth[_0x2344('0xf')](),controller[_0x2344('0x15')]);router[_0x2344('0x11')]('/:id/resources',auth[_0x2344('0xf')](),controller[_0x2344('0x16')]);router[_0x2344('0x17')](_0x2344('0xe'),auth['isAuthenticated'](),controller[_0x2344('0x18')]);router[_0x2344('0x19')]('/:id',auth[_0x2344('0xf')](),controller[_0x2344('0x1a')]);router[_0x2344('0x19')]('/:id/sections',auth[_0x2344('0xf')](),controller[_0x2344('0x1b')]);router[_0x2344('0x19')](_0x2344('0x1c'),auth['isAuthenticated'](),controller[_0x2344('0x1d')]);module[_0x2344('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 3f2bc9b..92e158b 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 _0x4132=['exports','STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x52d4c1,_0x4a106e){var _0x592a16=function(_0x43cba9){while(--_0x43cba9){_0x52d4c1['push'](_0x52d4c1['shift']());}};_0x592a16(++_0x4a106e);}(_0x4132,0xaa));var _0x2413=function(_0x30e94a,_0x35ecf){_0x30e94a=_0x30e94a-0x0;var _0x275fcb=_0x4132[_0x30e94a];return _0x275fcb;};'use strict';var Sequelize=require(_0x2413('0x0'));module[_0x2413('0x1')]={'name':{'type':Sequelize[_0x2413('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x2413('0x2')],'set':function(_0x54a170){this[_0x2413('0x3')](_0x2413('0x4'),_0x54a170?_0x54a170[_0x2413('0x5')](''):[]);},'get':function(){return this[_0x2413('0x6')](_0x2413('0x4'))?this[_0x2413('0x6')](_0x2413('0x4'))[_0x2413('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2413('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2413('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd54a=['split','BOOLEAN','exports','name','STRING','setDataValue','crudPermissions','getDataValue'];(function(_0x182594,_0x18b7d1){var _0x4ec8e7=function(_0x49e624){while(--_0x49e624){_0x182594['push'](_0x182594['shift']());}};_0x4ec8e7(++_0x18b7d1);}(_0xd54a,0x19a));var _0xad54=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xd54a[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');module[_0xad54('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xad54('0x1')},'crudPermissions':{'type':Sequelize[_0xad54('0x2')],'set':function(_0x18acf6){this[_0xad54('0x3')]('crudPermissions',_0x18acf6?_0x18acf6['join'](''):[]);},'get':function(){return this['getDataValue'](_0xad54('0x4'))?this[_0xad54('0x5')](_0xad54('0x4'))[_0xad54('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xad54('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xad54('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xad54('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xad54('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xad54('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xad54('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xad54('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 7c13e76..ef4f948 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 _0x1775=['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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','UserProfile','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','include','params','includeAll','find','catch','create','clone','rawAttributes','options','get','updatedAt','crudPermissions','body','omit','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','transaction','userProfileId','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','push','findOne','Dashboard','resourceId','forEach','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x408de5,_0x24fa7b){var _0x2015a1=function(_0x13082c){while(--_0x13082c){_0x408de5['push'](_0x408de5['shift']());}};_0x2015a1(++_0x24fa7b);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];config[_0x5177('0x1c')]=_[_0x5177('0x1d')](config[_0x5177('0x1c')],{'host':_0x5177('0x1e'),'port':0x18eb});var socket=require(_0x5177('0x1f'))(new Redis(config[_0x5177('0x1c')]));require(_0x5177('0x20'))[_0x5177('0x21')](socket);function respondWithStatusCode(_0x41bef4,_0x2bf5bb){_0x2bf5bb=_0x2bf5bb||0xcc;return function(_0x29cd2c){if(_0x29cd2c){return _0x41bef4[_0x5177('0x22')](_0x2bf5bb);}return _0x41bef4[_0x5177('0x23')](_0x2bf5bb)[_0x5177('0x24')]();};}function respondWithResult(_0x2ab5e5,_0x7dba6f){_0x7dba6f=_0x7dba6f||0xc8;return function(_0xe6dcf6){if(_0xe6dcf6){return _0x2ab5e5['status'](_0x7dba6f)[_0x5177('0x25')](_0xe6dcf6);}};}function respondWithFilteredResult(_0x41e687,_0x3f5ab5){return function(_0x1b4102){if(_0x1b4102){var _0x5f5bd4=typeof _0x3f5ab5[_0x5177('0x26')]===_0x5177('0x27')&&typeof _0x3f5ab5[_0x5177('0x28')]==='undefined';var _0x86f5f8=_0x1b4102['count'];var _0xc2b2b5=_0x5f5bd4?0x0:_0x3f5ab5[_0x5177('0x26')];var _0x219744=_0x5f5bd4?_0x1b4102[_0x5177('0x29')]:_0x3f5ab5[_0x5177('0x26')]+_0x3f5ab5[_0x5177('0x28')];var _0x174c4f;if(_0x219744>=_0x86f5f8){_0x219744=_0x86f5f8;_0x174c4f=0xc8;}else{_0x174c4f=0xce;}_0x41e687[_0x5177('0x23')](_0x174c4f);return _0x41e687[_0x5177('0x2a')](_0x5177('0x2b'),_0xc2b2b5+'-'+_0x219744+'/'+_0x86f5f8)[_0x5177('0x25')](_0x1b4102);}return null;};}function patchUpdates(_0x3b0c37){return function(_0x5d9a9c){try{jsonpatch[_0x5177('0x2c')](_0x5d9a9c,_0x3b0c37,!![]);}catch(_0x556f96){return BPromise[_0x5177('0x2d')](_0x556f96);}return _0x5d9a9c[_0x5177('0x2e')]();};}function saveUpdates(_0x3b39b5,_0x2d51d0){return function(_0x4bc8e2){if(_0x4bc8e2){return _0x4bc8e2[_0x5177('0x2f')](_0x3b39b5)['then'](function(_0x564139){return _0x564139;});}return null;};}function removeEntity(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(_0x577bf7){return _0x577bf7[_0x5177('0x30')]()['then'](function(){_0x19a0c2[_0x5177('0x23')](0xcc)[_0x5177('0x24')]();});}};}function handleEntityNotFound(_0x58846c,_0x3e021a){return function(_0x2554ec){if(!_0x2554ec){_0x58846c[_0x5177('0x22')](0x194);}return _0x2554ec;};}function handleError(_0x7f86e,_0xe98ff1){_0xe98ff1=_0xe98ff1||0x1f4;return function(_0x1cef5d){logger['error'](_0x1cef5d['stack']);if(_0x1cef5d[_0x5177('0x31')]){delete _0x1cef5d[_0x5177('0x31')];}_0x7f86e[_0x5177('0x23')](_0xe98ff1)[_0x5177('0x32')](_0x1cef5d);};}exports[_0x5177('0x33')]=function(_0x8134f9,_0x31eb9f){var _0x72dced={},_0x49f6f1={},_0x42e1db={'count':0x0,'rows':[]};var _0x2233a2=_['map'](db[_0x5177('0x34')]['rawAttributes'],function(_0x172b36){return{'name':_0x172b36[_0x5177('0x35')],'type':_0x172b36[_0x5177('0x36')]['key']};});_0x49f6f1['model']=_[_0x5177('0x37')](_0x2233a2,_0x5177('0x31'));_0x49f6f1[_0x5177('0x38')]=_[_0x5177('0x39')](_0x8134f9[_0x5177('0x38')]);_0x49f6f1[_0x5177('0x3a')]=_[_0x5177('0x3b')](_0x49f6f1[_0x5177('0x3c')],_0x49f6f1['query']);_0x72dced[_0x5177('0x3d')]=_[_0x5177('0x3b')](_0x49f6f1['model'],qs[_0x5177('0x3e')](_0x8134f9[_0x5177('0x38')][_0x5177('0x3e')]));_0x72dced[_0x5177('0x3d')]=_0x72dced[_0x5177('0x3d')][_0x5177('0x3f')]?_0x72dced['attributes']:_0x49f6f1[_0x5177('0x3c')];if(!_0x8134f9[_0x5177('0x38')][_0x5177('0x40')](_0x5177('0x41'))){_0x72dced[_0x5177('0x28')]=qs[_0x5177('0x28')](_0x8134f9[_0x5177('0x38')]['limit']);_0x72dced[_0x5177('0x26')]=qs[_0x5177('0x26')](_0x8134f9['query']['offset']);}_0x72dced[_0x5177('0x42')]=qs[_0x5177('0x43')](_0x8134f9[_0x5177('0x38')][_0x5177('0x43')]);_0x72dced[_0x5177('0x44')]=qs[_0x5177('0x3a')](_[_0x5177('0x45')](_0x8134f9[_0x5177('0x38')],_0x49f6f1[_0x5177('0x3a')]),_0x2233a2);if(_0x8134f9[_0x5177('0x38')][_0x5177('0x46')]){_0x72dced[_0x5177('0x44')]=_[_0x5177('0x47')](_0x72dced['where'],{'$or':_[_0x5177('0x37')](_0x2233a2,function(_0x2a4db1){if(_0x2a4db1['type']!==_0x5177('0x48')){var _0x56f297={};_0x56f297[_0x2a4db1[_0x5177('0x31')]]={'$like':'%'+_0x8134f9[_0x5177('0x38')][_0x5177('0x46')]+'%'};return _0x56f297;}})});}_0x72dced=_['merge']({},_0x72dced,_0x8134f9['options']);var _0x210510={'where':_0x72dced[_0x5177('0x44')]};return db[_0x5177('0x34')][_0x5177('0x29')](_0x210510)[_0x5177('0x49')](function(_0x3e710d){_0x42e1db[_0x5177('0x29')]=_0x3e710d;if(_0x8134f9[_0x5177('0x38')]['includeAll']){_0x72dced[_0x5177('0x4a')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x72dced);})[_0x5177('0x49')](function(_0x17dc98){_0x42e1db['rows']=_0x17dc98;return _0x42e1db;})[_0x5177('0x49')](respondWithFilteredResult(_0x31eb9f,_0x72dced))['catch'](handleError(_0x31eb9f,null));};exports['show']=function(_0x46c833,_0x1769cd){var _0x262c71={'raw':![],'where':{'id':_0x46c833[_0x5177('0x4b')]['id']}},_0x3776b8={};_0x3776b8[_0x5177('0x3c')]=_[_0x5177('0x39')](db['UserProfile']['rawAttributes']);_0x3776b8[_0x5177('0x38')]=_['keys'](_0x46c833[_0x5177('0x38')]);_0x3776b8[_0x5177('0x3a')]=_[_0x5177('0x3b')](_0x3776b8[_0x5177('0x3c')],_0x3776b8['query']);_0x262c71[_0x5177('0x3d')]=_[_0x5177('0x3b')](_0x3776b8[_0x5177('0x3c')],qs[_0x5177('0x3e')](_0x46c833[_0x5177('0x38')][_0x5177('0x3e')]));_0x262c71[_0x5177('0x3d')]=_0x262c71[_0x5177('0x3d')][_0x5177('0x3f')]?_0x262c71[_0x5177('0x3d')]:_0x3776b8[_0x5177('0x3c')];if(_0x46c833['query'][_0x5177('0x4c')]){_0x262c71['include']=[{'all':!![]}];}_0x262c71=_['merge']({},_0x262c71,_0x46c833['options']);return db[_0x5177('0x34')][_0x5177('0x4d')](_0x262c71)['then'](handleEntityNotFound(_0x1769cd,null))[_0x5177('0x49')](respondWithResult(_0x1769cd,null))[_0x5177('0x4e')](handleError(_0x1769cd,null));};exports[_0x5177('0x4f')]=function(_0x4891fe,_0x1d4ae4){return db['UserProfile']['create'](_0x4891fe['body'],{})[_0x5177('0x49')](respondWithResult(_0x1d4ae4,0xc9))[_0x5177('0x4e')](handleError(_0x1d4ae4,null));};exports[_0x5177('0x50')]=function(_0x5a1f8b,_0x4e53e4){var _0x42b827={'where':{'id':_0x5a1f8b[_0x5177('0x4b')]['id']}},_0x5be355={};_0x5be355[_0x5177('0x3c')]=_[_0x5177('0x39')](db[_0x5177('0x34')][_0x5177('0x51')]);_0x42b827[_0x5177('0x3d')]=_[_0x5177('0x3b')](_0x5be355[_0x5177('0x3c')],qs[_0x5177('0x3e')](_0x5a1f8b[_0x5177('0x38')][_0x5177('0x3e')]));_0x42b827[_0x5177('0x3d')]=_0x42b827[_0x5177('0x3d')]['length']?_0x42b827['attributes']:_0x5be355[_0x5177('0x3c')];if(_0x5a1f8b['query'][_0x5177('0x4c')]){_0x42b827['include']=[{'all':!![]}];}_0x42b827=_[_0x5177('0x47')]({},_0x42b827,_0x5a1f8b[_0x5177('0x52')]);return db[_0x5177('0x34')]['find'](_0x42b827)['then'](handleEntityNotFound(_0x4e53e4,null))[_0x5177('0x49')](function(_0x43b5b9){if(_0x43b5b9){var _0x2eb560=_0x43b5b9[_0x5177('0x53')]({'plain':!![]});_0x2eb560=qs['omit'](_0x2eb560,['id','createdAt',_0x5177('0x54'),_0x5177('0x55')]);_0x5a1f8b[_0x5177('0x56')]=_[_0x5177('0x57')](_0x5a1f8b['body'],['id',_0x5177('0x58'),_0x5177('0x54')]);return db[_0x5177('0x59')]['transaction'](function(_0x2b39ba){return db[_0x5177('0x34')][_0x5177('0x4f')](_['merge'](_0x2eb560,_0x5a1f8b[_0x5177('0x56')]),{'include':_0x5a1f8b['query'][_0x5177('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x2b39ba})[_0x5177('0x49')](function(_0x3268bd){var _0x5101fc=_0x3268bd[_0x5177('0x53')]({'plain':!![]});return db[_0x5177('0x5a')][_0x5177('0x5b')]({'where':{'userProfileId':_0x5a1f8b[_0x5177('0x4b')]['id']},'raw':!![]})[_0x5177('0x49')](function(_0x74589e){if(_0x74589e){return BPromise[_0x5177('0x5c')](_0x74589e,function(_0x267599){return new BPromise(function(_0x5ceed2,_0x5d96ce){if(_0x267599['autoAssociation']===null||_0x267599[_0x5177('0x5d')]===0x1)_0x5ceed2(null);return db[_0x5177('0x5e')][_0x5177('0x5b')]({'where':{'sectionId':_0x267599['id']},'raw':!![]})[_0x5177('0x49')](function(_0x2472e9){var _0x62a68a=_['map'](_0x2472e9,function(_0x523531){return qs[_0x5177('0x57')](_0x523531,['id',_0x5177('0x58'),_0x5177('0x54'),_0x5177('0x5f')]);});_0x5ceed2(_0x62a68a);})[_0x5177('0x4e')](function(_0x1b1778){_0x5d96ce(_0x1b1778);});})[_0x5177('0x49')](function(_0xd9c1db){var _0xbfb3d7=qs['omit'](_0x267599,['id',_0x5177('0x58'),_0x5177('0x54')]);_0xbfb3d7['userProfileId']=_0x5101fc['id'];if(_0xd9c1db)_0xbfb3d7[_0x5177('0x60')]=_0xd9c1db;return _0xbfb3d7;})[_0x5177('0x49')](function(_0x4edebc){return db[_0x5177('0x5a')][_0x5177('0x4f')](_0x4edebc,{'include':[{'model':db[_0x5177('0x5e')],'as':'Resources'}],'raw':!![],'transaction':_0x2b39ba});});})[_0x5177('0x49')](function(){return _0x5101fc;});}});});});}})[_0x5177('0x49')](respondWithResult(_0x4e53e4,0xc9))['catch'](handleError(_0x4e53e4,null));};exports['update']=function(_0x102c27,_0x4f76d7){if(_0x102c27[_0x5177('0x56')]['id']){delete _0x102c27['body']['id'];}return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0x102c27['params']['id']}})[_0x5177('0x49')](handleEntityNotFound(_0x4f76d7,null))[_0x5177('0x49')](saveUpdates(_0x102c27[_0x5177('0x56')],null))[_0x5177('0x49')](respondWithResult(_0x4f76d7,null))[_0x5177('0x4e')](handleError(_0x4f76d7,null));};exports[_0x5177('0x30')]=function(_0x20d476,_0x58ebdd){return db[_0x5177('0x34')]['find']({'where':{'id':_0x20d476['params']['id']}})[_0x5177('0x49')](handleEntityNotFound(_0x58ebdd,null))[_0x5177('0x49')](removeEntity(_0x58ebdd,null))['catch'](handleError(_0x58ebdd,null));};exports[_0x5177('0x61')]=function(_0xa889bd,_0x43abdd){return db[_0x5177('0x34')][_0x5177('0x61')]()[_0x5177('0x49')](respondWithResult(_0x43abdd,null))[_0x5177('0x4e')](handleError(_0x43abdd,null));};exports[_0x5177('0x62')]=function(_0x478d5e,_0x54b28f){var _0xee5f8b=_0x478d5e[_0x5177('0x56')];return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0x478d5e[_0x5177('0x4b')]['id']}})[_0x5177('0x49')](handleEntityNotFound(_0x54b28f,null))['then'](function(_0x3692b2){if(_0x3692b2){return db[_0x5177('0x59')][_0x5177('0x63')](function(_0x46d72e){return db['UserProfileSection'][_0x5177('0x30')]({'where':{'userProfileId':_0x478d5e[_0x5177('0x4b')]['id'],'sectionId':_[_0x5177('0x37')](_0xee5f8b,function(_0x22da9d){return _0x22da9d[_0x5177('0x5f')];})},'transaction':_0x46d72e})['then'](function(){var _0x2734fc=_['map'](_0xee5f8b,function(_0x1a6499){_0x1a6499[_0x5177('0x64')]=_0x478d5e['params']['id'];return _0x1a6499;});var _0x67d605=[];return BPromise[_0x5177('0x5c')](_0x2734fc,function(_0x367784){return db[_0x5177('0x5a')]['create'](_0x367784,{'include':[{'model':db[_0x5177('0x5e')],'as':_0x5177('0x60')}],'raw':!![],'transaction':_0x46d72e})[_0x5177('0x49')](function(_0x20fc85){_0x67d605['push'](_0x20fc85[_0x5177('0x53')]({'plain':!![]}));});})[_0x5177('0x49')](function(){return _0x67d605;});});});}})[_0x5177('0x49')](function(_0x4c8a15){return _0x4c8a15;})['then'](respondWithResult(_0x54b28f,null))[_0x5177('0x4e')](handleError(_0x54b28f,null));};exports[_0x5177('0x65')]=function(_0x3f42a5,_0x170e25){var _0xb2aca2;return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0x3f42a5[_0x5177('0x4b')]['id']},'attributes':['id',_0x5177('0x31')]})['then'](handleEntityNotFound(_0x170e25,null))['then'](function(_0x597a84){if(_0x597a84){_0xb2aca2=_0x597a84;return db[_0x5177('0x5a')]['destroy']({'where':{'userProfileId':_0x3f42a5[_0x5177('0x4b')]['id'],'sectionId':_0x3f42a5[_0x5177('0x38')][_0x5177('0x66')]}});}})[_0x5177('0x49')](function(){return _0xb2aca2;})[_0x5177('0x49')](respondWithStatusCode(_0x170e25,null))['catch'](handleError(_0x170e25,null));};exports[_0x5177('0x67')]=function(_0x10247,_0x41a7fa){var _0x4fce32=[];var _0x3d845e=[];return db['UserProfileSection'][_0x5177('0x5b')]({'where':{'userProfileId':_0x10247[_0x5177('0x4b')]['id']},'raw':!![]})['then'](function(_0xe5a705){_0x4fce32=_[_0x5177('0x46')](_0xe5a705,function(_0x53ccd8){return _0x53ccd8['enabled']===0x1||_[_0x5177('0x68')]([0x3eb,0x709],_0x53ccd8['sectionId']);});if(!_[_0x5177('0x69')](_0x4fce32)){return _[_0x5177('0x37')](_0x4fce32,function(_0x5a9bc8){return _0x5a9bc8[_0x5177('0x5f')];});}else{return;}})[_0x5177('0x49')](function(_0xcbbb73){if(_0xcbbb73)_0x3d845e=_0xcbbb73;if(_[_0x5177('0x68')](_0x3d845e,0x64)){var _0x43a584=_[_0x5177('0x4d')](_0x4fce32,{'sectionId':0x64});return hasDefaultDashboard(_0x43a584)[_0x5177('0x49')](function(_0x10b062){return _['map'](_0x4fce32,function(_0x2c9025){if(_0x2c9025['sectionId']===0x64){_0x2c9025[_0x5177('0x6a')]=_0x10b062;}return _0x2c9025;});});}else{return;}})[_0x5177('0x49')](function(_0x46d726){if(_0x46d726)_0x4fce32=_0x46d726;if(_[_0x5177('0x68')](_0x3d845e,0x3eb)){var _0x4ea67b=_[_0x5177('0x4d')](_0x4fce32,{'sectionId':0x3eb});return getCustomDashboards(_0x4ea67b)[_0x5177('0x49')](function(_0x52f8ca){return _[_0x5177('0x37')](_0x4fce32,function(_0x30c2dc){if(_0x4ea67b['enabled']){if(_0x30c2dc[_0x5177('0x5f')]===0x3eb){_0x30c2dc['subsections']=_0x52f8ca;}}else{if(_0x30c2dc[_0x5177('0x5f')]===0x64){_0x30c2dc['subsections']=_0x52f8ca;}}return _0x30c2dc;});});}else{return;}})['then'](function(_0x5cd8a1){if(_0x5cd8a1)_0x4fce32=_0x5cd8a1;if(_[_0x5177('0x68')](_0x3d845e,0x709)){var _0x348da7=_[_0x5177('0x4d')](_0x4fce32,{'sectionId':0x709});return getPlugins(_0x348da7)['then'](function(_0x34f74c){if(_0x348da7[_0x5177('0x6b')]){return _[_0x5177('0x37')](_0x4fce32,function(_0x3b68b2){if(_0x3b68b2[_0x5177('0x5f')]===0x709){_0x3b68b2['subsections']=_0x34f74c;}return _0x3b68b2;});}else{var _0x346d91={'sectionId':0x76c,'enabled':0x1,'subsections':_0x34f74c};var _0x1dccb4=_['map'](_0x4fce32);_0x1dccb4[_0x5177('0x6c')](_0x346d91);return _0x1dccb4;}});}else{return;}})['then'](function(_0x5b8953){if(_0x5b8953)_0x4fce32=_0x5b8953;return _['filter'](_0x4fce32,[_0x5177('0x6b'),0x1]);})[_0x5177('0x49')](respondWithResult(_0x41a7fa,null))[_0x5177('0x4e')](handleError(_0x41a7fa,null));};function hasDefaultDashboard(_0x11cce2){var _0x3447b9=[0x65];return new BPromise(function(_0x2d4619,_0x4ba911){try{if(_0x11cce2['autoAssociation']){_0x2d4619(_0x3447b9);}else{return db[_0x5177('0x5e')][_0x5177('0x6d')]({'where':{'sectionId':_0x11cce2['id']},'raw':!![]})[_0x5177('0x49')](function(_0x550197){_0x550197?_0x2d4619(_0x3447b9):_0x2d4619();});}}catch(_0x405b03){_0x4ba911(_0x405b03);}});}function getCustomDashboards(_0x2f2939){var _0x4ee41d=[];return new BPromise(function(_0x43e2ee,_0x568174){try{if(_0x2f2939[_0x5177('0x5d')]){return db[_0x5177('0x6e')][_0x5177('0x5b')]({'raw':!![]})['then'](function(_0x33b82b){_0x33b82b['forEach'](function(_0x11dbd1){_0x4ee41d[_0x5177('0x6c')](_0x11dbd1['id']+0x1869f);});_0x43e2ee(_0x4ee41d);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2f2939['id']},'raw':!![]})['then'](function(_0x249b0f){_0x249b0f['forEach'](function(_0x34b17e){_0x4ee41d[_0x5177('0x6c')](_0x34b17e[_0x5177('0x6f')]+0x1869f);});_0x43e2ee(_0x4ee41d);});}}catch(_0x57adf4){_0x568174(_0x57adf4);}});}function getPlugins(_0x5e4963){var _0x5e870f=[];return new BPromise(function(_0x10ad1c,_0x3a9b08){try{if(_0x5e4963[_0x5177('0x5d')]){return db['Plugin'][_0x5177('0x5b')]({'raw':!![]})[_0x5177('0x49')](function(_0x5225a4){_0x5225a4[_0x5177('0x70')](function(_0x526459){_0x5e870f[_0x5177('0x6c')](_0x526459['id']+0x15b38);});_0x10ad1c(_0x5e870f);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x5e4963['id']},'raw':!![]})['then'](function(_0x3940dd){_0x3940dd['forEach'](function(_0x16426e){_0x5e870f[_0x5177('0x6c')](_0x16426e[_0x5177('0x6f')]+0x15b38);});_0x10ad1c(_0x5e870f);});}}catch(_0x1372ad){_0x3a9b08(_0x1372ad);}});}exports[_0x5177('0x71')]=function(_0x197377,_0x580d34){return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0x197377['params']['id']}})[_0x5177('0x49')](handleEntityNotFound(_0x580d34,null))[_0x5177('0x49')](function(_0x1e64fa){if(_0x1e64fa){return db['sequelize']['transaction'](function(_0x5de7f4){return db[_0x5177('0x5a')][_0x5177('0x5b')]({'where':{'userProfileId':_0x197377[_0x5177('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x5177('0x49')](function(_0x10dc41){if(_0x10dc41){return db[_0x5177('0x5a')][_0x5177('0x30')]({'where':{'userProfileId':_0x197377[_0x5177('0x4b')]['id'],'id':_[_0x5177('0x37')](_0x10dc41,function(_0x107705){return _0x107705['id'];})},'transaction':_0x5de7f4});}})[_0x5177('0x49')](function(_0x39f1db){var _0x59930d=_[_0x5177('0x37')](_0x197377['body'],function(_0x2f254e){_0x2f254e[_0x5177('0x64')]=_0x197377[_0x5177('0x4b')]['id'];return _0x2f254e;});return db['UserProfileSection'][_0x5177('0x72')](_0x59930d,{'raw':!![],'transaction':_0x5de7f4});})[_0x5177('0x49')](function(_0x3867c9){var _0x221a4e=_[_0x5177('0x46')](_[_0x5177('0x37')](_0x3867c9,function(_0x2c9c12){return _0x2c9c12[_0x5177('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x221a4e){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x197377[_0x5177('0x4b')]['id'],'sectionId':_['map'](_0x221a4e,function(_0x2e8e26){return _0x2e8e26[_0x5177('0x5f')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x5177('0x49')](function(_0x1fb680){var _0x54efd0=_[_0x5177('0x37')](_0x197377[_0x5177('0x56')],function(_0x2458a9){_0x2458a9[_0x5177('0x64')]=_0x197377[_0x5177('0x4b')]['id'];return _0x2458a9;});return db[_0x5177('0x5e')][_0x5177('0x72')](_0x54efd0,{'raw':!![],'transaction':_0x5de7f4});});}})[_0x5177('0x4e')](handleError(_0x580d34,null));});}})[_0x5177('0x49')](function(_0x8c0153){var _0x3cd09d=_[_0x5177('0x37')](_0x8c0153,function(_0xf2635c){return _0xf2635c['get']({'plain':!![]});});})[_0x5177('0x49')](respondWithResult(_0x580d34,null))[_0x5177('0x4e')](handleError(_0x580d34,null));};exports[_0x5177('0x73')]=function(_0x4e5ee8,_0x363010,_0xa08446){return db['UserProfile'][_0x5177('0x4d')]({'where':{'id':_0x4e5ee8['params']['id']}})['then'](handleEntityNotFound(_0x363010,null))[_0x5177('0x49')](function(_0x1eaea0){if(_0x1eaea0){return _0x1eaea0[_0x5177('0x73')](_0x4e5ee8[_0x5177('0x38')][_0x5177('0x66')]);}})[_0x5177('0x49')](respondWithStatusCode(_0x363010,null))['catch'](handleError(_0x363010,null));};exports[_0x5177('0x74')]=function(_0xcb831c,_0x48c814){var _0x1aa8ca={};if(!_0xcb831c[_0x5177('0x38')][_0x5177('0x75')])throw new Error(_0x5177('0x76'));if(!_0xcb831c[_0x5177('0x38')][_0x5177('0x40')](_0x5177('0x41'))){_0x1aa8ca[_0x5177('0x28')]=qs['limit'](_0xcb831c[_0x5177('0x38')]['limit']);_0x1aa8ca[_0x5177('0x26')]=qs['offset'](_0xcb831c[_0x5177('0x38')][_0x5177('0x26')]);}return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0xcb831c['params']['id']}})[_0x5177('0x49')](function(_0x1b7c52){if(!_0x1b7c52)throw new Error(_0x5177('0x77')+_0xcb831c[_0x5177('0x4b')]['id']);return db['UserProfile']['getResources'](_0xcb831c);})['then'](respondWithFilteredResult(_0x48c814,_0x1aa8ca))['catch'](handleError(_0x48c814,null));}; \ No newline at end of file +var _0xf3e2=['removeSections','ids','findAll','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','send','map','UserProfile','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','name','options','include','catch','show','params','includeAll','find','create','body','clone','rawAttributes','get','omit','updatedAt','crudPermissions','createdAt','sequelize','UserProfileSection','autoAssociation','userProfileId','Resources','UserProfileResource','update','describe','addSections','transaction','destroy','sectionId','push'];(function(_0x2b03bf,_0x49f64e){var _0x3d31e6=function(_0x4c7a3d){while(--_0x4c7a3d){_0x2b03bf['push'](_0x2b03bf['shift']());}};_0x3d31e6(++_0x49f64e);}(_0xf3e2,0x168));var _0x2f3e=function(_0x552c9e,_0x221cf5){_0x552c9e=_0x552c9e-0x0;var _0x4c8401=_0xf3e2[_0x552c9e];return _0x4c8401;};'use strict';var emlformat=require(_0x2f3e('0x0'));var rimraf=require(_0x2f3e('0x1'));var zipdir=require(_0x2f3e('0x2'));var jsonpatch=require(_0x2f3e('0x3'));var rp=require(_0x2f3e('0x4'));var moment=require(_0x2f3e('0x5'));var BPromise=require(_0x2f3e('0x6'));var Mustache=require(_0x2f3e('0x7'));var util=require('util');var path=require(_0x2f3e('0x8'));var sox=require('sox');var csv=require(_0x2f3e('0x9'));var ejs=require(_0x2f3e('0xa'));var fs=require('fs');var fs_extra=require(_0x2f3e('0xb'));var _=require(_0x2f3e('0xc'));var squel=require(_0x2f3e('0xd'));var crypto=require(_0x2f3e('0xe'));var jsforce=require(_0x2f3e('0xf'));var deskjs=require(_0x2f3e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f3e('0x11'));var Papa=require('papaparse');var Redis=require(_0x2f3e('0x12'));var authService=require(_0x2f3e('0x13'));var qs=require(_0x2f3e('0x14'));var as=require(_0x2f3e('0x15'));var hardwareService=require(_0x2f3e('0x16'));var logger=require(_0x2f3e('0x17'))(_0x2f3e('0x18'));var utils=require(_0x2f3e('0x19'));var config=require(_0x2f3e('0x1a'));var licenseUtil=require(_0x2f3e('0x1b'));var db=require(_0x2f3e('0x1c'))['db'];config[_0x2f3e('0x1d')]=_['defaults'](config[_0x2f3e('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f3e('0x1e'))(new Redis(config[_0x2f3e('0x1d')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x1ad130,_0x2ecb10){_0x2ecb10=_0x2ecb10||0xcc;return function(_0x341fff){if(_0x341fff){return _0x1ad130[_0x2f3e('0x1f')](_0x2ecb10);}return _0x1ad130[_0x2f3e('0x20')](_0x2ecb10)[_0x2f3e('0x21')]();};}function respondWithResult(_0x4ecd41,_0x10aa3e){_0x10aa3e=_0x10aa3e||0xc8;return function(_0x32f26f){if(_0x32f26f){return _0x4ecd41[_0x2f3e('0x20')](_0x10aa3e)[_0x2f3e('0x22')](_0x32f26f);}};}function respondWithFilteredResult(_0x52ab9c,_0x127ebe){return function(_0x480aa4){if(_0x480aa4){var _0x18dc6=typeof _0x127ebe[_0x2f3e('0x23')]===_0x2f3e('0x24')&&typeof _0x127ebe[_0x2f3e('0x25')]===_0x2f3e('0x24');var _0x3f0cd1=_0x480aa4[_0x2f3e('0x26')];var _0x1e6987=_0x18dc6?0x0:_0x127ebe[_0x2f3e('0x23')];var _0x22ac6c=_0x18dc6?_0x480aa4[_0x2f3e('0x26')]:_0x127ebe[_0x2f3e('0x23')]+_0x127ebe[_0x2f3e('0x25')];var _0x44404a;if(_0x22ac6c>=_0x3f0cd1){_0x22ac6c=_0x3f0cd1;_0x44404a=0xc8;}else{_0x44404a=0xce;}_0x52ab9c[_0x2f3e('0x20')](_0x44404a);return _0x52ab9c[_0x2f3e('0x27')](_0x2f3e('0x28'),_0x1e6987+'-'+_0x22ac6c+'/'+_0x3f0cd1)[_0x2f3e('0x22')](_0x480aa4);}return null;};}function patchUpdates(_0x22dd45){return function(_0x226b5a){try{jsonpatch[_0x2f3e('0x29')](_0x226b5a,_0x22dd45,!![]);}catch(_0x3bd446){return BPromise[_0x2f3e('0x2a')](_0x3bd446);}return _0x226b5a[_0x2f3e('0x2b')]();};}function saveUpdates(_0x5b4d8d,_0x2b56c3){return function(_0x356b0c){if(_0x356b0c){return _0x356b0c['update'](_0x5b4d8d)[_0x2f3e('0x2c')](function(_0x43a4c8){return _0x43a4c8;});}return null;};}function removeEntity(_0x146cf0,_0x6a2c1f){return function(_0x59231b){if(_0x59231b){return _0x59231b['destroy']()[_0x2f3e('0x2c')](function(){_0x146cf0[_0x2f3e('0x20')](0xcc)[_0x2f3e('0x21')]();});}};}function handleEntityNotFound(_0x192edf,_0x1699bf){return function(_0x5bce49){if(!_0x5bce49){_0x192edf[_0x2f3e('0x1f')](0x194);}return _0x5bce49;};}function handleError(_0x4aa4a0,_0x593181){_0x593181=_0x593181||0x1f4;return function(_0x13d8a7){logger['error'](_0x13d8a7[_0x2f3e('0x2d')]);if(_0x13d8a7['name']){delete _0x13d8a7['name'];}_0x4aa4a0[_0x2f3e('0x20')](_0x593181)[_0x2f3e('0x2e')](_0x13d8a7);};}exports['index']=function(_0x3f5735,_0x290ec7){var _0x2e9e39={},_0x3760c4={},_0x3ab758={'count':0x0,'rows':[]};var _0x52f2f1=_[_0x2f3e('0x2f')](db[_0x2f3e('0x30')]['rawAttributes'],function(_0xd166ef){return{'name':_0xd166ef[_0x2f3e('0x31')],'type':_0xd166ef[_0x2f3e('0x32')][_0x2f3e('0x33')]};});_0x3760c4[_0x2f3e('0x34')]=_['map'](_0x52f2f1,'name');_0x3760c4[_0x2f3e('0x35')]=_[_0x2f3e('0x36')](_0x3f5735[_0x2f3e('0x35')]);_0x3760c4[_0x2f3e('0x37')]=_[_0x2f3e('0x38')](_0x3760c4[_0x2f3e('0x34')],_0x3760c4['query']);_0x2e9e39[_0x2f3e('0x39')]=_['intersection'](_0x3760c4[_0x2f3e('0x34')],qs[_0x2f3e('0x3a')](_0x3f5735[_0x2f3e('0x35')][_0x2f3e('0x3a')]));_0x2e9e39[_0x2f3e('0x39')]=_0x2e9e39[_0x2f3e('0x39')][_0x2f3e('0x3b')]?_0x2e9e39[_0x2f3e('0x39')]:_0x3760c4['model'];if(!_0x3f5735[_0x2f3e('0x35')][_0x2f3e('0x3c')]('nolimit')){_0x2e9e39[_0x2f3e('0x25')]=qs['limit'](_0x3f5735['query'][_0x2f3e('0x25')]);_0x2e9e39[_0x2f3e('0x23')]=qs['offset'](_0x3f5735[_0x2f3e('0x35')][_0x2f3e('0x23')]);}_0x2e9e39['order']=qs['sort'](_0x3f5735[_0x2f3e('0x35')][_0x2f3e('0x3d')]);_0x2e9e39[_0x2f3e('0x3e')]=qs[_0x2f3e('0x37')](_[_0x2f3e('0x3f')](_0x3f5735[_0x2f3e('0x35')],_0x3760c4[_0x2f3e('0x37')]),_0x52f2f1);if(_0x3f5735[_0x2f3e('0x35')][_0x2f3e('0x40')]){_0x2e9e39[_0x2f3e('0x3e')]=_[_0x2f3e('0x41')](_0x2e9e39[_0x2f3e('0x3e')],{'$or':_[_0x2f3e('0x2f')](_0x52f2f1,function(_0x436e13){if(_0x436e13[_0x2f3e('0x32')]!=='VIRTUAL'){var _0x3f7676={};_0x3f7676[_0x436e13[_0x2f3e('0x42')]]={'$like':'%'+_0x3f5735[_0x2f3e('0x35')]['filter']+'%'};return _0x3f7676;}})});}_0x2e9e39=_[_0x2f3e('0x41')]({},_0x2e9e39,_0x3f5735[_0x2f3e('0x43')]);var _0x98bf0b={'where':_0x2e9e39[_0x2f3e('0x3e')]};return db[_0x2f3e('0x30')][_0x2f3e('0x26')](_0x98bf0b)[_0x2f3e('0x2c')](function(_0x326493){_0x3ab758[_0x2f3e('0x26')]=_0x326493;if(_0x3f5735[_0x2f3e('0x35')]['includeAll']){_0x2e9e39[_0x2f3e('0x44')]=[{'all':!![]}];}return db[_0x2f3e('0x30')]['findAll'](_0x2e9e39);})[_0x2f3e('0x2c')](function(_0x16d83b){_0x3ab758['rows']=_0x16d83b;return _0x3ab758;})[_0x2f3e('0x2c')](respondWithFilteredResult(_0x290ec7,_0x2e9e39))[_0x2f3e('0x45')](handleError(_0x290ec7,null));};exports[_0x2f3e('0x46')]=function(_0x51d89f,_0xf48c39){var _0x14f230={'raw':![],'where':{'id':_0x51d89f[_0x2f3e('0x47')]['id']}},_0x3d878c={};_0x3d878c['model']=_[_0x2f3e('0x36')](db[_0x2f3e('0x30')]['rawAttributes']);_0x3d878c[_0x2f3e('0x35')]=_['keys'](_0x51d89f[_0x2f3e('0x35')]);_0x3d878c[_0x2f3e('0x37')]=_[_0x2f3e('0x38')](_0x3d878c[_0x2f3e('0x34')],_0x3d878c[_0x2f3e('0x35')]);_0x14f230[_0x2f3e('0x39')]=_[_0x2f3e('0x38')](_0x3d878c[_0x2f3e('0x34')],qs['fields'](_0x51d89f['query']['fields']));_0x14f230['attributes']=_0x14f230[_0x2f3e('0x39')][_0x2f3e('0x3b')]?_0x14f230[_0x2f3e('0x39')]:_0x3d878c[_0x2f3e('0x34')];if(_0x51d89f['query'][_0x2f3e('0x48')]){_0x14f230[_0x2f3e('0x44')]=[{'all':!![]}];}_0x14f230=_['merge']({},_0x14f230,_0x51d89f['options']);return db[_0x2f3e('0x30')][_0x2f3e('0x49')](_0x14f230)[_0x2f3e('0x2c')](handleEntityNotFound(_0xf48c39,null))[_0x2f3e('0x2c')](respondWithResult(_0xf48c39,null))[_0x2f3e('0x45')](handleError(_0xf48c39,null));};exports[_0x2f3e('0x4a')]=function(_0x45cf90,_0x12b9a8){return db['UserProfile'][_0x2f3e('0x4a')](_0x45cf90[_0x2f3e('0x4b')],{})[_0x2f3e('0x2c')](respondWithResult(_0x12b9a8,0xc9))[_0x2f3e('0x45')](handleError(_0x12b9a8,null));};exports[_0x2f3e('0x4c')]=function(_0x320808,_0xf71c43){var _0x4bcfc0={'where':{'id':_0x320808[_0x2f3e('0x47')]['id']}},_0xb79a26={};_0xb79a26['model']=_[_0x2f3e('0x36')](db[_0x2f3e('0x30')][_0x2f3e('0x4d')]);_0x4bcfc0[_0x2f3e('0x39')]=_[_0x2f3e('0x38')](_0xb79a26[_0x2f3e('0x34')],qs['fields'](_0x320808['query'][_0x2f3e('0x3a')]));_0x4bcfc0[_0x2f3e('0x39')]=_0x4bcfc0[_0x2f3e('0x39')][_0x2f3e('0x3b')]?_0x4bcfc0[_0x2f3e('0x39')]:_0xb79a26['model'];if(_0x320808['query'][_0x2f3e('0x48')]){_0x4bcfc0[_0x2f3e('0x44')]=[{'all':!![]}];}_0x4bcfc0=_[_0x2f3e('0x41')]({},_0x4bcfc0,_0x320808[_0x2f3e('0x43')]);return db['UserProfile']['find'](_0x4bcfc0)['then'](handleEntityNotFound(_0xf71c43,null))['then'](function(_0x513eb0){if(_0x513eb0){var _0x2f2643=_0x513eb0[_0x2f3e('0x4e')]({'plain':!![]});_0x2f2643=qs[_0x2f3e('0x4f')](_0x2f2643,['id','createdAt',_0x2f3e('0x50'),_0x2f3e('0x51')]);_0x320808[_0x2f3e('0x4b')]=_['omit'](_0x320808[_0x2f3e('0x4b')],['id',_0x2f3e('0x52'),_0x2f3e('0x50')]);return db[_0x2f3e('0x53')]['transaction'](function(_0x20997c){return db[_0x2f3e('0x30')][_0x2f3e('0x4a')](_[_0x2f3e('0x41')](_0x2f2643,_0x320808['body']),{'include':_0x320808['query'][_0x2f3e('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x20997c})[_0x2f3e('0x2c')](function(_0x13ad58){var _0x31538d=_0x13ad58[_0x2f3e('0x4e')]({'plain':!![]});return db[_0x2f3e('0x54')]['findAll']({'where':{'userProfileId':_0x320808[_0x2f3e('0x47')]['id']},'raw':!![]})[_0x2f3e('0x2c')](function(_0x46237e){if(_0x46237e){return BPromise['each'](_0x46237e,function(_0x116b53){return new BPromise(function(_0x2ccd3e,_0x5f41cf){if(_0x116b53['autoAssociation']===null||_0x116b53[_0x2f3e('0x55')]===0x1)_0x2ccd3e(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x116b53['id']},'raw':!![]})[_0x2f3e('0x2c')](function(_0xcb5aea){var _0x1fbebe=_[_0x2f3e('0x2f')](_0xcb5aea,function(_0x5ef17d){return qs[_0x2f3e('0x4f')](_0x5ef17d,['id',_0x2f3e('0x52'),'updatedAt','sectionId']);});_0x2ccd3e(_0x1fbebe);})[_0x2f3e('0x45')](function(_0x4a1c76){_0x5f41cf(_0x4a1c76);});})[_0x2f3e('0x2c')](function(_0x147879){var _0x5d6852=qs[_0x2f3e('0x4f')](_0x116b53,['id',_0x2f3e('0x52'),_0x2f3e('0x50')]);_0x5d6852[_0x2f3e('0x56')]=_0x31538d['id'];if(_0x147879)_0x5d6852[_0x2f3e('0x57')]=_0x147879;return _0x5d6852;})[_0x2f3e('0x2c')](function(_0x30de27){return db[_0x2f3e('0x54')][_0x2f3e('0x4a')](_0x30de27,{'include':[{'model':db[_0x2f3e('0x58')],'as':_0x2f3e('0x57')}],'raw':!![],'transaction':_0x20997c});});})[_0x2f3e('0x2c')](function(){return _0x31538d;});}});});});}})[_0x2f3e('0x2c')](respondWithResult(_0xf71c43,0xc9))['catch'](handleError(_0xf71c43,null));};exports[_0x2f3e('0x59')]=function(_0x36886e,_0x349037){if(_0x36886e['body']['id']){delete _0x36886e[_0x2f3e('0x4b')]['id'];}return db[_0x2f3e('0x30')][_0x2f3e('0x49')]({'where':{'id':_0x36886e[_0x2f3e('0x47')]['id']}})[_0x2f3e('0x2c')](handleEntityNotFound(_0x349037,null))[_0x2f3e('0x2c')](saveUpdates(_0x36886e[_0x2f3e('0x4b')],null))[_0x2f3e('0x2c')](respondWithResult(_0x349037,null))[_0x2f3e('0x45')](handleError(_0x349037,null));};exports['destroy']=function(_0x1fb078,_0x68325c){return db[_0x2f3e('0x30')][_0x2f3e('0x49')]({'where':{'id':_0x1fb078[_0x2f3e('0x47')]['id']}})[_0x2f3e('0x2c')](handleEntityNotFound(_0x68325c,null))[_0x2f3e('0x2c')](removeEntity(_0x68325c,null))[_0x2f3e('0x45')](handleError(_0x68325c,null));};exports['describe']=function(_0x5cbfe5,_0x53d3d1){return db[_0x2f3e('0x30')][_0x2f3e('0x5a')]()[_0x2f3e('0x2c')](respondWithResult(_0x53d3d1,null))['catch'](handleError(_0x53d3d1,null));};exports[_0x2f3e('0x5b')]=function(_0x3d7b09,_0x1fb565){var _0x5b58e9=_0x3d7b09[_0x2f3e('0x4b')];return db[_0x2f3e('0x30')]['find']({'where':{'id':_0x3d7b09['params']['id']}})['then'](handleEntityNotFound(_0x1fb565,null))[_0x2f3e('0x2c')](function(_0x476e22){if(_0x476e22){return db['sequelize'][_0x2f3e('0x5c')](function(_0x19e16c){return db[_0x2f3e('0x54')][_0x2f3e('0x5d')]({'where':{'userProfileId':_0x3d7b09['params']['id'],'sectionId':_[_0x2f3e('0x2f')](_0x5b58e9,function(_0x1a6253){return _0x1a6253[_0x2f3e('0x5e')];})},'transaction':_0x19e16c})['then'](function(){var _0x5bd59f=_[_0x2f3e('0x2f')](_0x5b58e9,function(_0x2b3151){_0x2b3151[_0x2f3e('0x56')]=_0x3d7b09[_0x2f3e('0x47')]['id'];return _0x2b3151;});var _0x285213=[];return BPromise['each'](_0x5bd59f,function(_0x175e69){return db[_0x2f3e('0x54')][_0x2f3e('0x4a')](_0x175e69,{'include':[{'model':db[_0x2f3e('0x58')],'as':_0x2f3e('0x57')}],'raw':!![],'transaction':_0x19e16c})[_0x2f3e('0x2c')](function(_0x439114){_0x285213[_0x2f3e('0x5f')](_0x439114[_0x2f3e('0x4e')]({'plain':!![]}));});})[_0x2f3e('0x2c')](function(){return _0x285213;});});});}})[_0x2f3e('0x2c')](function(_0x516a72){return _0x516a72;})[_0x2f3e('0x2c')](respondWithResult(_0x1fb565,null))['catch'](handleError(_0x1fb565,null));};exports[_0x2f3e('0x60')]=function(_0x50efac,_0x114cb6){var _0xa6e9d9;return db[_0x2f3e('0x30')]['find']({'where':{'id':_0x50efac[_0x2f3e('0x47')]['id']},'attributes':['id',_0x2f3e('0x42')]})[_0x2f3e('0x2c')](handleEntityNotFound(_0x114cb6,null))[_0x2f3e('0x2c')](function(_0x5a1f8f){if(_0x5a1f8f){_0xa6e9d9=_0x5a1f8f;return db[_0x2f3e('0x54')][_0x2f3e('0x5d')]({'where':{'userProfileId':_0x50efac[_0x2f3e('0x47')]['id'],'sectionId':_0x50efac[_0x2f3e('0x35')][_0x2f3e('0x61')]}});}})[_0x2f3e('0x2c')](function(){return _0xa6e9d9;})[_0x2f3e('0x2c')](respondWithStatusCode(_0x114cb6,null))[_0x2f3e('0x45')](handleError(_0x114cb6,null));};exports['getSections']=function(_0x3cd1d0,_0x1c3ca6){var _0x12fff9=[];var _0x266128=[];return db[_0x2f3e('0x54')][_0x2f3e('0x62')]({'where':{'userProfileId':_0x3cd1d0[_0x2f3e('0x47')]['id']},'raw':!![]})[_0x2f3e('0x2c')](function(_0x259e99){_0x12fff9=_[_0x2f3e('0x40')](_0x259e99,function(_0x244050){return _0x244050[_0x2f3e('0x63')]===0x1||_[_0x2f3e('0x64')]([0x3eb,0x709],_0x244050[_0x2f3e('0x5e')]);});if(!_[_0x2f3e('0x65')](_0x12fff9)){return _['map'](_0x12fff9,function(_0x16d4d0){return _0x16d4d0['sectionId'];});}else{return;}})['then'](function(_0x1b0b70){if(_0x1b0b70)_0x266128=_0x1b0b70;if(_[_0x2f3e('0x64')](_0x266128,0x64)){var _0x5b19ea=_['find'](_0x12fff9,{'sectionId':0x64});return hasDefaultDashboard(_0x5b19ea)['then'](function(_0x386dee){return _[_0x2f3e('0x2f')](_0x12fff9,function(_0x2787e4){if(_0x2787e4[_0x2f3e('0x5e')]===0x64){_0x2787e4[_0x2f3e('0x66')]=_0x386dee;}return _0x2787e4;});});}else{return;}})[_0x2f3e('0x2c')](function(_0x4a1f48){if(_0x4a1f48)_0x12fff9=_0x4a1f48;if(_[_0x2f3e('0x64')](_0x266128,0x3eb)){var _0x29f4bb=_['find'](_0x12fff9,{'sectionId':0x3eb});return getCustomDashboards(_0x29f4bb)[_0x2f3e('0x2c')](function(_0x930381){return _[_0x2f3e('0x2f')](_0x12fff9,function(_0x322a83){if(_0x29f4bb[_0x2f3e('0x63')]){if(_0x322a83[_0x2f3e('0x5e')]===0x3eb){_0x322a83[_0x2f3e('0x66')]=_0x930381;}}else{if(_0x322a83[_0x2f3e('0x5e')]===0x64){_0x322a83['subsections']=_0x930381;}}return _0x322a83;});});}else{return;}})['then'](function(_0x464063){if(_0x464063)_0x12fff9=_0x464063;if(_['includes'](_0x266128,0x709)){var _0x4ad306=_[_0x2f3e('0x49')](_0x12fff9,{'sectionId':0x709});return getPlugins(_0x4ad306)[_0x2f3e('0x2c')](function(_0x3466b7){if(_0x4ad306[_0x2f3e('0x63')]){return _[_0x2f3e('0x2f')](_0x12fff9,function(_0x1d9089){if(_0x1d9089[_0x2f3e('0x5e')]===0x709){_0x1d9089['subsections']=_0x3466b7;}return _0x1d9089;});}else{var _0x5ee955={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3466b7};var _0x3053bf=_['map'](_0x12fff9);_0x3053bf[_0x2f3e('0x5f')](_0x5ee955);return _0x3053bf;}});}else{return;}})[_0x2f3e('0x2c')](function(_0x5ce3fb){if(_0x5ce3fb)_0x12fff9=_0x5ce3fb;return _[_0x2f3e('0x40')](_0x12fff9,['enabled',0x1]);})['then'](respondWithResult(_0x1c3ca6,null))[_0x2f3e('0x45')](handleError(_0x1c3ca6,null));};function hasDefaultDashboard(_0x28305d){var _0x14a96f=[0x65];return new BPromise(function(_0x550a57,_0x4c0588){try{if(_0x28305d[_0x2f3e('0x55')]){_0x550a57(_0x14a96f);}else{return db[_0x2f3e('0x58')][_0x2f3e('0x67')]({'where':{'sectionId':_0x28305d['id']},'raw':!![]})[_0x2f3e('0x2c')](function(_0x4ca829){_0x4ca829?_0x550a57(_0x14a96f):_0x550a57();});}}catch(_0xd5999a){_0x4c0588(_0xd5999a);}});}function getCustomDashboards(_0x51d75e){var _0x419584=[];return new BPromise(function(_0x44985f,_0x28d6e6){try{if(_0x51d75e[_0x2f3e('0x55')]){return db['Dashboard'][_0x2f3e('0x62')]({'raw':!![]})[_0x2f3e('0x2c')](function(_0x131312){_0x131312[_0x2f3e('0x68')](function(_0xfcf8dc){_0x419584['push'](_0xfcf8dc['id']+0x1869f);});_0x44985f(_0x419584);});}else{return db['UserProfileResource'][_0x2f3e('0x62')]({'where':{'sectionId':_0x51d75e['id']},'raw':!![]})[_0x2f3e('0x2c')](function(_0xef63f9){_0xef63f9[_0x2f3e('0x68')](function(_0x5044d4){_0x419584[_0x2f3e('0x5f')](_0x5044d4['resourceId']+0x1869f);});_0x44985f(_0x419584);});}}catch(_0xe866fd){_0x28d6e6(_0xe866fd);}});}function getPlugins(_0x1b3fdd){var _0x213c1e=[];return new BPromise(function(_0x143568,_0x59a0cb){try{if(_0x1b3fdd[_0x2f3e('0x55')]){return db['Plugin'][_0x2f3e('0x62')]({'raw':!![]})['then'](function(_0x510b07){_0x510b07[_0x2f3e('0x68')](function(_0x5a50cb){_0x213c1e['push'](_0x5a50cb['id']+0x15b38);});_0x143568(_0x213c1e);});}else{return db['UserProfileResource'][_0x2f3e('0x62')]({'where':{'sectionId':_0x1b3fdd['id']},'raw':!![]})[_0x2f3e('0x2c')](function(_0x59ae3e){_0x59ae3e[_0x2f3e('0x68')](function(_0x40a63){_0x213c1e[_0x2f3e('0x5f')](_0x40a63[_0x2f3e('0x69')]+0x15b38);});_0x143568(_0x213c1e);});}}catch(_0x3c9933){_0x59a0cb(_0x3c9933);}});}exports[_0x2f3e('0x6a')]=function(_0x254ba8,_0x2c3a2b){return db[_0x2f3e('0x30')]['find']({'where':{'id':_0x254ba8['params']['id']}})['then'](handleEntityNotFound(_0x2c3a2b,null))[_0x2f3e('0x2c')](function(_0x267ca7){if(_0x267ca7){return db[_0x2f3e('0x53')]['transaction'](function(_0x4f9657){return db[_0x2f3e('0x54')][_0x2f3e('0x62')]({'where':{'userProfileId':_0x254ba8[_0x2f3e('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x2f3e('0x2c')](function(_0x2afcd3){if(_0x2afcd3){return db[_0x2f3e('0x54')][_0x2f3e('0x5d')]({'where':{'userProfileId':_0x254ba8[_0x2f3e('0x47')]['id'],'id':_[_0x2f3e('0x2f')](_0x2afcd3,function(_0x470e8b){return _0x470e8b['id'];})},'transaction':_0x4f9657});}})[_0x2f3e('0x2c')](function(_0x5b7d3f){var _0x2baf2f=_[_0x2f3e('0x2f')](_0x254ba8['body'],function(_0x38e7ab){_0x38e7ab[_0x2f3e('0x56')]=_0x254ba8[_0x2f3e('0x47')]['id'];return _0x38e7ab;});return db[_0x2f3e('0x54')]['bulkCreate'](_0x2baf2f,{'raw':!![],'transaction':_0x4f9657});})[_0x2f3e('0x2c')](function(_0x1ce7a8){var _0x5b2f52=_[_0x2f3e('0x40')](_[_0x2f3e('0x2f')](_0x1ce7a8,function(_0x17bc42){return _0x17bc42[_0x2f3e('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x5b2f52){return db[_0x2f3e('0x54')][_0x2f3e('0x62')]({'where':{'userProfileId':_0x254ba8[_0x2f3e('0x47')]['id'],'sectionId':_[_0x2f3e('0x2f')](_0x5b2f52,function(_0x4b1eb8){return _0x4b1eb8[_0x2f3e('0x5e')];})},'attributes':['id',_0x2f3e('0x5e')],'raw':!![]})[_0x2f3e('0x2c')](function(_0x5a23e0){var _0x35eafd=_['map'](_0x254ba8[_0x2f3e('0x4b')],function(_0x59a91f){_0x59a91f[_0x2f3e('0x56')]=_0x254ba8['params']['id'];return _0x59a91f;});return db['UserProfileResource'][_0x2f3e('0x6b')](_0x35eafd,{'raw':!![],'transaction':_0x4f9657});});}})[_0x2f3e('0x45')](handleError(_0x2c3a2b,null));});}})[_0x2f3e('0x2c')](function(_0x26fa61){var _0x224aca=_[_0x2f3e('0x2f')](_0x26fa61,function(_0x49bd95){return _0x49bd95[_0x2f3e('0x4e')]({'plain':!![]});});})[_0x2f3e('0x2c')](respondWithResult(_0x2c3a2b,null))[_0x2f3e('0x45')](handleError(_0x2c3a2b,null));};exports['removeResources']=function(_0x2cca1e,_0x55d6b2,_0x74d434){return db[_0x2f3e('0x30')][_0x2f3e('0x49')]({'where':{'id':_0x2cca1e[_0x2f3e('0x47')]['id']}})[_0x2f3e('0x2c')](handleEntityNotFound(_0x55d6b2,null))[_0x2f3e('0x2c')](function(_0x2c98b3){if(_0x2c98b3){return _0x2c98b3[_0x2f3e('0x6c')](_0x2cca1e[_0x2f3e('0x35')][_0x2f3e('0x61')]);}})[_0x2f3e('0x2c')](respondWithStatusCode(_0x55d6b2,null))['catch'](handleError(_0x55d6b2,null));};exports[_0x2f3e('0x6d')]=function(_0x147dfc,_0x4b64ee){var _0x345214={};if(!_0x147dfc[_0x2f3e('0x35')][_0x2f3e('0x6e')])throw new Error(_0x2f3e('0x6f'));if(!_0x147dfc[_0x2f3e('0x35')][_0x2f3e('0x3c')](_0x2f3e('0x70'))){_0x345214[_0x2f3e('0x25')]=qs['limit'](_0x147dfc[_0x2f3e('0x35')][_0x2f3e('0x25')]);_0x345214[_0x2f3e('0x23')]=qs['offset'](_0x147dfc[_0x2f3e('0x35')][_0x2f3e('0x23')]);}return db[_0x2f3e('0x30')][_0x2f3e('0x49')]({'where':{'id':_0x147dfc[_0x2f3e('0x47')]['id']}})[_0x2f3e('0x2c')](function(_0x849844){if(!_0x849844)throw new Error(_0x2f3e('0x71')+_0x147dfc['params']['id']);return db[_0x2f3e('0x30')][_0x2f3e('0x6d')](_0x147dfc);})['then'](respondWithFilteredResult(_0x4b64ee,_0x345214))[_0x2f3e('0x45')](handleError(_0x4b64ee,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7a29f2c..b73646e 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 _0x33af=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x374f9c,_0x43fef3){var _0x317f18=function(_0x42b4c5){while(--_0x42b4c5){_0x374f9c['push'](_0x374f9c['shift']());}};_0x317f18(++_0x43fef3);}(_0x33af,0xec));var _0xf33a=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x33af[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf33a('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf33a('0x1')](0x0);var events={'afterCreate':_0xf33a('0x2'),'afterUpdate':_0xf33a('0x3'),'afterDestroy':_0xf33a('0x4')};function emitEvent(_0x169f02){return function(_0x25f156,_0x4c734e,_0x433e25){UserProfileEvents[_0xf33a('0x5')](_0x169f02+':'+_0x25f156['id'],_0x25f156);UserProfileEvents['emit'](_0x169f02,_0x25f156);_0x433e25(null);};}for(var e in events){if(events[_0xf33a('0x6')](e)){var event=events[e];UserProfile[_0xf33a('0x7')](e,emitEvent(event));}}module[_0xf33a('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xe1d3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x3898e6,_0x43fc3c){var _0x1c5e50=function(_0x585da3){while(--_0x585da3){_0x3898e6['push'](_0x3898e6['shift']());}};_0x1c5e50(++_0x43fc3c);}(_0xe1d3,0x159));var _0x3e1d=function(_0x5764cc,_0x26774f){_0x5764cc=_0x5764cc-0x0;var _0x5ce377=_0xe1d3[_0x5764cc];return _0x5ce377;};'use strict';var EventEmitter=require(_0x3e1d('0x0'));var UserProfile=require(_0x3e1d('0x1'))['db'][_0x3e1d('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3e1d('0x3')](0x0);var events={'afterCreate':_0x3e1d('0x4'),'afterUpdate':'update','afterDestroy':_0x3e1d('0x5')};function emitEvent(_0x4a0768){return function(_0x23f59b,_0x38df15,_0x4f6337){UserProfileEvents['emit'](_0x4a0768+':'+_0x23f59b['id'],_0x23f59b);UserProfileEvents[_0x3e1d('0x6')](_0x4a0768,_0x23f59b);_0x4f6337(null);};}for(var e in events){if(events[_0x3e1d('0x7')](e)){var event=events[e];UserProfile[_0x3e1d('0x8')](e,emitEvent(event));}}module[_0x3e1d('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 8c8939f..e9d4922 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 _0x5430=['Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','forEach','options','includeAll','reportType','default','reportId','custom','CustomReports','rows','count','include','Tags','color','tag','ThroughTags','openTabs','true','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','value','findAll','then','associatedResources','catch','field','model','name','resolve','UserProfileResource','map','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','queue','VoiceQueue','inbound','QueueCampaigns','type','outbound','musiconholds','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','Team','queuecampaigns','users','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','Plugin','extractedreports','AnalyticExtractedReport','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice'];(function(_0x1d17ae,_0x55682e){var _0x4dcf07=function(_0x33fc1e){while(--_0x33fc1e){_0x1d17ae['push'](_0x1d17ae['shift']());}};_0x4dcf07(++_0x55682e);}(_0x5430,0x10c));var _0x0543=function(_0x4879f3,_0x54a581){_0x4879f3=_0x4879f3-0x0;var _0x331642=_0x5430[_0x4879f3];return _0x331642;};'use strict';var _=require(_0x0543('0x0'));var attributes=require(_0x0543('0x1'));var qs=require(_0x0543('0x2'));var squel=require(_0x0543('0x3'));module[_0x0543('0x4')]=function(_0x3b93d7){var _0x5518f8=_0x3b93d7['models'];function _0x1c5ab7(_0x4ee416,_0x523f3d){return new Promise(function(_0xce0b65,_0x45b909){if(!_0x523f3d)return _0xce0b65(null);var _0x9754ba=_0x523f3d[_0x0543('0x5')]?{[_0x523f3d[_0x0543('0x5')]['field']]:_0x523f3d[_0x0543('0x5')][_0x0543('0x6')]}:undefined;return _0x5518f8[_0x4ee416][_0x0543('0x7')]({'where':_0x9754ba,'raw':!![]})[_0x0543('0x8')](function(_0x2fb723){_0x523f3d[_0x0543('0x9')]=_['map'](_0x2fb723,'id');_0xce0b65(_0x523f3d);})[_0x0543('0xa')](function(_0x1ac048){_0x45b909(_0x1ac048);});});}function _0x52c9b7(_0x46bbc1,_0x20a264){return new Promise(function(_0x2bb810,_0x43b934){var _0x3f74f8=_0x46bbc1[_0x0543('0x5')]?{[_0x46bbc1[_0x0543('0x5')][_0x0543('0xb')]]:_0x46bbc1[_0x0543('0x5')][_0x0543('0x6')]}:undefined;return _0x5518f8[_0x46bbc1[_0x0543('0xc')]][_0x0543('0x7')]({'where':_0x3f74f8,'raw':!![]})['then'](function(_0x4f1f2a){_0x20a264[_0x0543('0x9')]=_['map'](_0x4f1f2a,function(_0x4c4763){return _0x4c4763[_0x0543('0xd')];});_0x2bb810(_0x20a264);})[_0x0543('0xa')](function(_0x1dff7d){_0x43b934(_0x1dff7d);});});}function _0x1cfadf(_0x38a32e,_0x50d504,_0xe69a3d){if(!_0x50d504)return Promise[_0x0543('0xe')](null);return new Promise(function(_0x2dd5cb,_0x25254e){return _0x5518f8[_0x0543('0xf')][_0x0543('0x7')]({'where':{'sectionId':_0x50d504['id']},'raw':!![]})[_0x0543('0x8')](function(_0x5eb03e){if(_0x38a32e[_0x0543('0xb')]&&_0x38a32e['field']!=='id'){_0x50d504['associatedResources']=_[_0x0543('0x10')](_0x5eb03e,function(_0x419913){return _0x419913[_0x38a32e[_0x0543('0xb')]];});}else{if(_0xe69a3d==='AnalyticExtractedReport'){_0x50d504[_0x0543('0x9')]=_['map'](_0x5eb03e,function(_0x401da5){return{'id':_0x401da5[_0x0543('0x11')],'type':_0x401da5['type']};});}else{_0x50d504[_0x0543('0x9')]=_[_0x0543('0x10')](_0x5eb03e,function(_0x427919){return _0x427919[_0x0543('0x11')];});}}_0x2dd5cb(_0x50d504);})[_0x0543('0xa')](function(_0xe14f94){_0x25254e(_0xe14f94);});});}function _0x4adba7(_0x5979d2,_0x59f1b2){var _0xbfe5dc={'parentSections':[]};switch(_0x5979d2[_0x0543('0x12')]()){case _0x0543('0x13'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x15');break;case _0x0543('0x16'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x17');break;case _0x0543('0x18'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x19');_0xbfe5dc[_0x0543('0x1a')]=[{'name':'SquareProjects','field':_0x0543('0xd'),'foreignKey':_0x0543('0x1b')}];break;case _0x0543('0x1c'):_0xbfe5dc['childModel']=_0x0543('0x1d');break;case _0x0543('0x1e'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x1f');_0xbfe5dc['parentSections']=[{'name':_0x0543('0x20'),'field':'id','foreignKey':_0x0543('0x21')}];break;case'lists':_0xbfe5dc['childModel']=_0x0543('0x22');break;case _0x0543('0x23'):_0xbfe5dc['childModel']=_0x0543('0x24');break;case _0x0543('0x25'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x26');break;case _0x0543('0x27'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x28');break;case'chatwebsites':_0xbfe5dc[_0x0543('0x14')]='ChatWebsite';break;case _0x0543('0x29'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x2a');break;case _0x0543('0x2b'):_0xbfe5dc[_0x0543('0x14')]='FaxAccount';break;case _0x0543('0x2c'):case'internalroutes':case _0x0543('0x2d'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x2e');break;case _0x0543('0x2f'):_0xbfe5dc['childModel']=_0x0543('0x30');break;case'voicemails':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x31');break;case _0x0543('0x32'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x33');_0xbfe5dc[_0x0543('0x1a')]=[{'name':_0x0543('0x34'),'field':_0x0543('0xd'),'foreignKey':_0x0543('0x35'),'model':_0x0543('0x36'),'filter':{'field':'role','value':[_0x0543('0x37')]}},{'name':_0x0543('0x38'),'field':'name','foreignKey':_0x0543('0x35'),'model':'User','filter':{'field':_0x0543('0x39'),'value':[_0x0543('0x3a')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x0543('0x3b'),'model':_0x0543('0x3c'),'filter':{'field':'type','value':[_0x0543('0x3d')]}},{'name':_0x0543('0x3e'),'field':'name','foreignKey':_0x0543('0x3b'),'model':_0x0543('0x3c'),'filter':{'field':_0x0543('0x3f'),'value':[_0x0543('0x40')]}}];break;case _0x0543('0x41'):_0xbfe5dc['childModel']='VoiceMusicOnHold';break;case'chanspies':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x42');break;case _0x0543('0x43'):_0xbfe5dc[_0x0543('0x14')]='VoicePrefix';break;case _0x0543('0x44'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x45');break;case _0x0543('0x46'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x47');break;case _0x0543('0x48'):_0xbfe5dc['childModel']=_0x0543('0x49');break;case _0x0543('0x4a'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x4b');break;case _0x0543('0x4c'):_0xbfe5dc[_0x0543('0x14')]='OpenchannelQueue';break;case'openchannelaccounts':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x4d');break;case _0x0543('0x4e'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x4f');break;case _0x0543('0x50'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x51');break;case _0x0543('0x52'):_0xbfe5dc['childModel']='WhatsappQueue';break;case _0x0543('0x53'):_0xbfe5dc[_0x0543('0x14')]='WhatsappAccount';break;case'teams':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x54');break;case'voicequeues':case _0x0543('0x55'):_0xbfe5dc['childModel']=_0x0543('0x3c');if(_0x59f1b2){_0xbfe5dc[_0x0543('0x1a')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x0543('0x56'):case'agents':case _0x0543('0x57'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x36');if(_0x59f1b2){_0xbfe5dc[_0x0543('0x1a')]=[{'name':_0x0543('0x58'),'filter':{'field':_0x0543('0x39'),'value':['admin',_0x0543('0x59')]},'ignore':!![]},{'name':_0x0543('0x34')},{'name':_0x0543('0x38')}];}break;case _0x0543('0x5a'):_0xbfe5dc[_0x0543('0x14')]='ZendeskAccount';break;case _0x0543('0x5b'):_0xbfe5dc['childModel']=_0x0543('0x5c');break;case _0x0543('0x5d'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x5e');break;case _0x0543('0x5f'):_0xbfe5dc[_0x0543('0x14')]='SugarcrmAccount';break;case'deskaccounts':_0xbfe5dc['childModel']=_0x0543('0x60');break;case _0x0543('0x61'):_0xbfe5dc['childModel']=_0x0543('0x62');break;case _0x0543('0x63'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x36');break;case _0x0543('0x64'):_0xbfe5dc[_0x0543('0x14')]='CannedAnswer';break;case _0x0543('0x65'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x66');break;case _0x0543('0x67'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x68');break;case _0x0543('0x69'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x6a');break;case _0x0543('0x6b'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x6c');break;case _0x0543('0x6d'):_0xbfe5dc[_0x0543('0x14')]='Schedule';break;case _0x0543('0x6e'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x6f');break;case _0x0543('0x70'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x71');break;case _0x0543('0x72'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x73');break;case _0x0543('0x74'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x75');break;case _0x0543('0x76'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x77');break;case'variables':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x78');break;case'plugins':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x79');break;case _0x0543('0x7a'):_0xbfe5dc['childModel']=_0x0543('0x7b');_0xbfe5dc['parentSections']=[{'name':_0x0543('0x7c'),'field':'id','foreignKey':'reportId'}];break;case _0x0543('0x7d'):_0xbfe5dc['childModel']=_0x0543('0x7e');break;}return _0xbfe5dc;}function _0x2496d3(_0x1e6786,_0x5e6b95){var _0x117466=_0x1e6786[_0x0543('0x7f')](0x0)[_0x0543('0x80')]()+_0x1e6786[_0x0543('0x81')](0x1);var _0x313937={'type':_0x5518f8[_0x0543('0x82')][_0x0543('0x83')][_0x0543('0x84')],'raw':!![]};return new Promise(function(_0x2bf1f9,_0x21ec88){var _0x8a3879=squel[_0x0543('0x85')]()[_0x0543('0xb')](_0x0543('0x86')+_0x117466+_0x0543('0x87'),'id')['field']('ui.createdAt')[_0x0543('0x88')](_0x0543('0x89')+_0x1e6786+_0x0543('0x8a'),'ui')[_0x0543('0x8b')](_0x0543('0x8c'),_0x5e6b95['id']);return _0x5518f8[_0x0543('0x8d')][_0x0543('0x8e')](_0x8a3879[_0x0543('0x8f')](),_0x313937)[_0x0543('0x8')](function(_0x51e4e2){_0x5e6b95[_0x117466+_0x0543('0x90')]=_0x51e4e2;_0x2bf1f9(_0x51e4e2);})[_0x0543('0xa')](function(_0x42f644){_0x21ec88(_0x42f644);});});}return _0x3b93d7[_0x0543('0x91')]('UserProfile',attributes,{'tableName':_0x0543('0x92'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1cbb25){var _0x1bd8d3={'raw':![],'where':{}};var _0x5f08ce={};var _0x5c140c={'count':0x0,'rows':[]};var _0x2f4d15=_0x1cbb25[_0x0543('0x8e')][_0x0543('0x93')];var _0x5311b7=_0x1cbb25[_0x0543('0x8e')][_0x0543('0x94')]||![];var _0x29b72c=_0x4adba7(_0x2f4d15,_0x5311b7);if(!_0x29b72c['childModel'])throw new Error(_0x0543('0x95')+_0x2f4d15+'\x27');var _0x180082=[{'name':_0x2f4d15}];if(!_[_0x0543('0x96')](_0x29b72c[_0x0543('0x1a')]))_0x180082=_0x29b72c[_0x0543('0x1a')];var _0x1e694e=[];for(var _0x16da76=0x0;_0x16da76<_0x180082[_0x0543('0x97')];_0x16da76++){_0x1e694e[_0x0543('0x98')](_0x5518f8[_0x0543('0x99')][_0x0543('0x9a')]({'where':{'userProfileId':_0x1cbb25[_0x0543('0x9b')]['id'],'name':_0x180082[_0x16da76][_0x0543('0xd')]},'raw':!![]}));}return Promise[_0x0543('0x9c')](_0x1e694e)['then'](function(_0x50abbb){var _0x41f0f2=_[_0x0543('0x5')](_0x50abbb,function(_0x3a6d64){return _0x3a6d64?_0x3a6d64:undefined;});var _0x2ee541=_['filter'](_0x180082,[_0x0543('0x9d'),!![]]);var _0x49516c=_[_0x0543('0x96')](_0x41f0f2)&&_[_0x0543('0x96')](_0x2ee541)?null:_[_0x0543('0x9e')](_0x2ee541,_0x41f0f2);if(!_0x49516c)return null;var _0x5bd53d=[];for(var _0x5cb8ce=0x0;_0x5cb8ce<_0x49516c[_0x0543('0x97')];_0x5cb8ce++){var _0x537b7d=_['find'](_0x180082,function(_0x30ee35){return _0x49516c[_0x5cb8ce]?_0x30ee35[_0x0543('0xd')]===_0x49516c[_0x5cb8ce][_0x0543('0xd')]:null;});if(_0x537b7d){if(_0x49516c[_0x5cb8ce][_0x0543('0x9d')]){_0x5bd53d[_0x0543('0x98')](_0x1c5ab7(_0x29b72c[_0x0543('0x14')],_0x49516c[_0x5cb8ce]));}else{if(!_0x49516c[_0x5cb8ce][_0x0543('0x9f')]){_0x5bd53d[_0x0543('0x98')](_0x1cfadf(_0x537b7d,_0x49516c[_0x5cb8ce],_0x29b72c[_0x0543('0x14')]));}else{if(_0x537b7d['model']){_0x5bd53d[_0x0543('0x98')](_0x52c9b7(_0x537b7d,_0x49516c[_0x5cb8ce]));}}}}}return Promise[_0x0543('0x9c')](_0x5bd53d);})[_0x0543('0x8')](function(_0x2e081e){var _0x3d918d=_0x2e081e;var _0x53f0f3=null;if(_0x3d918d){_0x53f0f3=_0x3d918d[_0x0543('0x97')]===0x1?_0x3d918d[0x0]:null;}if(!_0x53f0f3&&!_0x3d918d)return _0x5c140c;var _0x5738de=_0x5518f8[_0x29b72c[_0x0543('0x14')]][_0x0543('0xa0')];_0x5f08ce[_0x0543('0xc')]=_[_0x0543('0xa1')](_0x5738de);_0x5f08ce['query']=_[_0x0543('0xa1')](_0x1cbb25[_0x0543('0x8e')]);_0x5f08ce[_0x0543('0xa2')]=_['intersection'](_0x5f08ce[_0x0543('0xc')],_0x5f08ce['query']);_0x1bd8d3[_0x0543('0xa3')]=_[_0x0543('0xa4')](_0x5f08ce[_0x0543('0xc')],qs[_0x0543('0xa5')](_0x1cbb25[_0x0543('0x8e')][_0x0543('0xa5')]));_0x1bd8d3['attributes']=_0x1bd8d3['attributes']['length']?_0x1bd8d3[_0x0543('0xa3')]:_0x5f08ce[_0x0543('0xc')];if(!_0x1cbb25[_0x0543('0x8e')][_0x0543('0xa6')](_0x0543('0xa7'))){_0x1bd8d3[_0x0543('0xa8')]=qs[_0x0543('0xa8')](_0x1cbb25[_0x0543('0x8e')]['limit']);_0x1bd8d3['offset']=qs[_0x0543('0xa9')](_0x1cbb25[_0x0543('0x8e')]['offset']);}_0x1bd8d3[_0x0543('0xaa')]=qs['sort'](_0x1cbb25[_0x0543('0x8e')][_0x0543('0xab')]);_0x1bd8d3[_0x0543('0x8b')]=qs[_0x0543('0xa2')](_[_0x0543('0xac')](_0x1cbb25['query'],_0x5f08ce[_0x0543('0xa2')]));if(_0x1cbb25[_0x0543('0x8e')]['filter']){_0x1bd8d3[_0x0543('0x8b')]=_[_0x0543('0xad')](_0x1bd8d3[_0x0543('0x8b')],{'$or':_['map'](_0x5738de,function(_0xf5c02c){if(_0xf5c02c[_0x0543('0x3f')][_0x0543('0xae')]!=='VIRTUAL'){var _0x18d597={};_0x18d597[_0xf5c02c[_0x0543('0xb')]]={'$like':'%'+_0x1cbb25[_0x0543('0x8e')][_0x0543('0x5')]+'%'};return _0x18d597;}})});}var _0x553023=[];var _0x27fc39=null;var _0x9ede99={};if(_0x53f0f3){_0x27fc39=_[_0x0543('0x9a')](_0x180082,[_0x0543('0xd'),_0x53f0f3[_0x0543('0xd')]]);if(_0x27fc39[_0x0543('0xb')]){_0x9ede99={};if(_0x29b72c[_0x0543('0x14')]===_0x0543('0x7b')){_0x9ede99[_0x27fc39[_0x0543('0xaf')]]=_[_0x0543('0x10')](_0x53f0f3[_0x0543('0x9')],'id');}else{_0x9ede99[_0x27fc39[_0x0543('0xaf')]]=_0x53f0f3[_0x0543('0x9')];}_0x553023[_0x0543('0x98')](_0x9ede99);}else{_0x1bd8d3[_0x0543('0x8b')]['id']=_0x53f0f3[_0x0543('0x9')];}}else{for(var _0x1bbba9=0x0;_0x1bbba9<_0x3d918d['length'];_0x1bbba9++){_0x27fc39=_[_0x0543('0x9a')](_0x180082,[_0x0543('0xd'),_0x3d918d[_0x1bbba9][_0x0543('0xd')]]);if(_0x27fc39[_0x0543('0xb')]){_0x9ede99={};_0x9ede99[_0x27fc39[_0x0543('0xaf')]]=_0x3d918d[_0x1bbba9][_0x0543('0x9')];_0x553023[_0x0543('0x98')](_0x9ede99);}else{if(!_0x1bd8d3[_0x0543('0x8b')]['id'])_0x1bd8d3[_0x0543('0x8b')]['id']=[];_0x3d918d[_0x1bbba9][_0x0543('0x9')][_0x0543('0xb0')](function(_0x4bb8ea){_0x1bd8d3[_0x0543('0x8b')]['id'][_0x0543('0x98')](_0x4bb8ea);});}}}if(!_[_0x0543('0x96')](_0x553023)){_0x1bd8d3['where']=_[_0x0543('0xad')](_0x1bd8d3['where'],{'$and':{'$or':_0x553023}});}_0x1bd8d3=_['merge']({},_0x1bd8d3,_0x1cbb25[_0x0543('0xb1')]);if(_0x53f0f3&&!_0x53f0f3['autoAssociation']&&_0x29b72c[_0x0543('0x14')]===_0x0543('0x7b')){if(_0x1cbb25[_0x0543('0x8e')][_0x0543('0xb2')]){_0x1bd8d3['include']=[{'all':!![]}];}return _0x5518f8[_0x29b72c['childModel']][_0x0543('0x7')](_0x1bd8d3)[_0x0543('0x8')](function(_0x7eafcf){var _0x5ef577=[];_0x7eafcf[_0x0543('0xb0')](function(_0xdfd945){var _0x4cf0ca;switch(_0xdfd945[_0x0543('0xb3')]){case _0x0543('0xb4'):_0x4cf0ca=_['find'](_0x53f0f3['associatedResources'],function(_0x22e8fa){return _0x22e8fa['id']===_0xdfd945[_0x0543('0xb5')]&&_0x22e8fa[_0x0543('0x3f')]==='DefaultReports';});break;case _0x0543('0xb6'):_0x4cf0ca=_[_0x0543('0x9a')](_0x53f0f3[_0x0543('0x9')],function(_0x55952a){return _0x55952a['id']===_0xdfd945['reportId']&&_0x55952a[_0x0543('0x3f')]===_0x0543('0xb7');});break;}if(_0x4cf0ca)_0x5ef577[_0x0543('0x98')](_0xdfd945);});_0x5c140c['count']=_0x5ef577[_0x0543('0x97')];_0x5c140c[_0x0543('0xb8')]=_0x5ef577;return _0x5c140c;});}else{return _0x5518f8[_0x29b72c[_0x0543('0x14')]][_0x0543('0xb9')]({'where':_0x1bd8d3[_0x0543('0x8b')]})[_0x0543('0x8')](function(_0x190b81){_0x5c140c[_0x0543('0xb9')]=_0x190b81;if(_0x1cbb25[_0x0543('0x8e')][_0x0543('0xb2')]){if(_0x29b72c[_0x0543('0x14')]===_0x0543('0x1f')){_0x1bd8d3[_0x0543('0xba')]=[{'model':_0x5518f8[_0x0543('0x71')],'as':_0x0543('0xbb'),'attributes':['id',_0x0543('0xd'),_0x0543('0xbc')],'required':_0x1cbb25['query'][_0x0543('0xbd')]?!![]:![]},{'model':_0x5518f8[_0x0543('0x71')],'as':_0x0543('0xbe'),'attributes':['id',_0x0543('0xd'),'color'],'through':_0x1cbb25[_0x0543('0x8e')][_0x0543('0xbd')]?{'attributes':[],'where':{'TagId':_0x1cbb25[_0x0543('0x8e')][_0x0543('0xbd')]||undefined}}:{},'required':_0x1cbb25['query'][_0x0543('0xbd')]?!![]:![]}];}else{_0x1bd8d3[_0x0543('0xba')]=[{'all':!![]}];}}return _0x5518f8[_0x29b72c['childModel']][_0x0543('0x7')](_0x1bd8d3);})[_0x0543('0x8')](function(_0x34f06a){_0x5c140c[_0x0543('0xb8')]=_0x34f06a;if(_0x2f4d15==='Agents'&&_0x1cbb25[_0x0543('0x8e')][_0x0543('0xbf')]===_0x0543('0xc0')){var _0x24fca2=[];for(var _0x2d7617=0x0;_0x2d7617<_0x5c140c['rows'][_0x0543('0x97')];_0x2d7617++){_0x24fca2[_0x0543('0x98')](_0x2496d3('chat',_0x5c140c[_0x0543('0xb8')][_0x2d7617]['dataValues']));_0x24fca2[_0x0543('0x98')](_0x2496d3(_0x0543('0xc1'),_0x5c140c[_0x0543('0xb8')][_0x2d7617][_0x0543('0xc2')]));_0x24fca2['push'](_0x2496d3(_0x0543('0xc3'),_0x5c140c['rows'][_0x2d7617][_0x0543('0xc2')]));_0x24fca2[_0x0543('0x98')](_0x2496d3(_0x0543('0xc4'),_0x5c140c[_0x0543('0xb8')][_0x2d7617][_0x0543('0xc2')]));_0x24fca2[_0x0543('0x98')](_0x2496d3(_0x0543('0xc5'),_0x5c140c[_0x0543('0xb8')][_0x2d7617][_0x0543('0xc2')]));_0x24fca2[_0x0543('0x98')](_0x2496d3(_0x0543('0xc6'),_0x5c140c['rows'][_0x2d7617][_0x0543('0xc2')]));}return Promise[_0x0543('0x9c')](_0x24fca2)[_0x0543('0x8')](function(){return _0x5c140c;});}return _0x5c140c;});}});}}});}; \ No newline at end of file +var _0x71ab=['whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','dispositions','Disposition','customdashboards','intervals','Interval','pauses','scheduler','Sound','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','ui.','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','user_profiles','section','mergeResources','isEmpty','length','find','params','all','union','autoAssociation','push','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','merge','key','forEach','options','include','DefaultReports','CustomReports','count','rows','includeAll','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','squel','models','filter','field','value','findAll','then','associatedResources','catch','model','map','name','UserProfileResource','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','User','agent','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue'];(function(_0x1e90f6,_0x4c729c){var _0x2b46c4=function(_0x2d6e36){while(--_0x2d6e36){_0x1e90f6['push'](_0x1e90f6['shift']());}};_0x2b46c4(++_0x4c729c);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var attributes=require(_0xb71a('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0xb71a('0x1'));module['exports']=function(_0x3e985a){var _0x3f0529=_0x3e985a[_0xb71a('0x2')];function _0x4094b2(_0x37ce74,_0x3c6438){return new Promise(function(_0x2192e8,_0x38d931){if(!_0x3c6438)return _0x2192e8(null);var _0x22c072=_0x3c6438[_0xb71a('0x3')]?{[_0x3c6438[_0xb71a('0x3')][_0xb71a('0x4')]]:_0x3c6438[_0xb71a('0x3')][_0xb71a('0x5')]}:undefined;return _0x3f0529[_0x37ce74][_0xb71a('0x6')]({'where':_0x22c072,'raw':!![]})[_0xb71a('0x7')](function(_0x378c96){_0x3c6438[_0xb71a('0x8')]=_['map'](_0x378c96,'id');_0x2192e8(_0x3c6438);})[_0xb71a('0x9')](function(_0x58956d){_0x38d931(_0x58956d);});});}function _0x3d7bd7(_0x343d2f,_0x24f5fd){return new Promise(function(_0x591311,_0x3909b4){var _0x4c167a=_0x343d2f[_0xb71a('0x3')]?{[_0x343d2f['filter']['field']]:_0x343d2f[_0xb71a('0x3')][_0xb71a('0x5')]}:undefined;return _0x3f0529[_0x343d2f[_0xb71a('0xa')]][_0xb71a('0x6')]({'where':_0x4c167a,'raw':!![]})['then'](function(_0x47ee48){_0x24f5fd['associatedResources']=_[_0xb71a('0xb')](_0x47ee48,function(_0xc189cd){return _0xc189cd[_0xb71a('0xc')];});_0x591311(_0x24f5fd);})[_0xb71a('0x9')](function(_0x3cd0f0){_0x3909b4(_0x3cd0f0);});});}function _0x1e9363(_0x31def2,_0x2ec64a,_0x7710a8){if(!_0x2ec64a)return Promise['resolve'](null);return new Promise(function(_0x1ca65e,_0x2d6369){return _0x3f0529[_0xb71a('0xd')][_0xb71a('0x6')]({'where':{'sectionId':_0x2ec64a['id']},'raw':!![]})[_0xb71a('0x7')](function(_0xf83e73){if(_0x31def2[_0xb71a('0x4')]&&_0x31def2[_0xb71a('0x4')]!=='id'){_0x2ec64a[_0xb71a('0x8')]=_[_0xb71a('0xb')](_0xf83e73,function(_0x16394a){return _0x16394a[_0x31def2['field']];});}else{if(_0x7710a8==='AnalyticExtractedReport'){_0x2ec64a[_0xb71a('0x8')]=_[_0xb71a('0xb')](_0xf83e73,function(_0x4a4f4e){return{'id':_0x4a4f4e['resourceId'],'type':_0x4a4f4e[_0xb71a('0xe')]};});}else{_0x2ec64a['associatedResources']=_[_0xb71a('0xb')](_0xf83e73,function(_0x4227c7){return _0x4227c7[_0xb71a('0xf')];});}}_0x1ca65e(_0x2ec64a);})[_0xb71a('0x9')](function(_0x38a728){_0x2d6369(_0x38a728);});});}function _0x14b2a1(_0x2f4fac,_0x14aac7){var _0x5f3f19={'parentSections':[]};switch(_0x2f4fac[_0xb71a('0x10')]()){case _0xb71a('0x11'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x13');break;case _0xb71a('0x14'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x15');break;case _0xb71a('0x16'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x17');_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x19'),'field':_0xb71a('0xc'),'foreignKey':'projectName'}];break;case _0xb71a('0x1a'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x1b');break;case _0xb71a('0x1c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x1d');_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x1e'),'field':'id','foreignKey':_0xb71a('0x1f')}];break;case _0xb71a('0x20'):_0x5f3f19[_0xb71a('0x12')]='CmList';break;case'companies':_0x5f3f19[_0xb71a('0x12')]='CmCompany';break;case _0xb71a('0x21'):_0x5f3f19[_0xb71a('0x12')]='CmCustomField';break;case _0xb71a('0x22'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x23');break;case _0xb71a('0x24'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x25');break;case'faxqueues':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x26');break;case _0xb71a('0x27'):_0x5f3f19[_0xb71a('0x12')]='FaxAccount';break;case _0xb71a('0x28'):case _0xb71a('0x29'):case _0xb71a('0x2a'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x2b');break;case _0xb71a('0x2c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x2d');break;case _0xb71a('0x2e'):_0x5f3f19[_0xb71a('0x12')]='VoiceMail';break;case'voicerecordings':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x2f');_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x30'),'field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x31'),'model':_0xb71a('0x32'),'filter':{'field':'role','value':[_0xb71a('0x33')]}},{'name':'Telephones','field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x31'),'model':_0xb71a('0x32'),'filter':{'field':_0xb71a('0x34'),'value':['telephone']}},{'name':_0xb71a('0x35'),'field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x36'),'model':_0xb71a('0x37'),'filter':{'field':_0xb71a('0xe'),'value':[_0xb71a('0x38')]}},{'name':_0xb71a('0x39'),'field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x36'),'model':'VoiceQueue','filter':{'field':_0xb71a('0xe'),'value':['outbound']}}];break;case _0xb71a('0x3a'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x3b');break;case _0xb71a('0x3c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x3d');break;case'voiceprefixes':_0x5f3f19['childModel']='VoicePrefix';break;case _0xb71a('0x3e'):_0x5f3f19['childModel']=_0xb71a('0x3f');break;case _0xb71a('0x40'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x41');break;case _0xb71a('0x42'):_0x5f3f19[_0xb71a('0x12')]='MailAccount';break;case _0xb71a('0x43'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x44');break;case _0xb71a('0x45'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x46');break;case'openchannelaccounts':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x47');break;case _0xb71a('0x48'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x49');break;case _0xb71a('0x4a'):_0x5f3f19[_0xb71a('0x12')]='SmsAccount';break;case'whatsappqueues':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x4b');break;case _0xb71a('0x4c'):_0x5f3f19[_0xb71a('0x12')]='WhatsappAccount';break;case _0xb71a('0x4d'):_0x5f3f19['childModel']=_0xb71a('0x4e');break;case _0xb71a('0x4f'):case'queuecampaigns':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x37');if(_0x14aac7){_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x35')},{'name':'QueueCampaigns'}];}break;case _0xb71a('0x50'):case _0xb71a('0x51'):case _0xb71a('0x52'):_0x5f3f19['childModel']=_0xb71a('0x32');if(_0x14aac7){_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x53'),'filter':{'field':'role','value':[_0xb71a('0x54'),_0xb71a('0x55')]},'ignore':!![]},{'name':_0xb71a('0x30')},{'name':_0xb71a('0x56')}];}break;case _0xb71a('0x57'):_0x5f3f19['childModel']=_0xb71a('0x58');break;case _0xb71a('0x59'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x5a');break;case'freshdeskaccounts':_0x5f3f19['childModel']=_0xb71a('0x5b');break;case _0xb71a('0x5c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x5d');break;case _0xb71a('0x5e'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x5f');break;case _0xb71a('0x60'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x61');break;case'vtigeraccounts':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x32');break;case'cannedanswers':_0x5f3f19[_0xb71a('0x12')]='CannedAnswer';break;case _0xb71a('0x62'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x63');break;case _0xb71a('0x64'):_0x5f3f19[_0xb71a('0x12')]='Dashboard';break;case _0xb71a('0x65'):_0x5f3f19['childModel']=_0xb71a('0x66');break;case _0xb71a('0x67'):_0x5f3f19['childModel']='Pause';break;case _0xb71a('0x68'):_0x5f3f19[_0xb71a('0x12')]='Schedule';break;case'sounds':_0x5f3f19['childModel']=_0xb71a('0x69');break;case'tags':_0x5f3f19['childModel']=_0xb71a('0x6a');break;case _0xb71a('0x6b'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x6c');break;case'triggers':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x6d');break;case _0xb71a('0x6e'):_0x5f3f19['childModel']=_0xb71a('0x6f');break;case _0xb71a('0x70'):_0x5f3f19['childModel']=_0xb71a('0x71');break;case _0xb71a('0x72'):_0x5f3f19[_0xb71a('0x12')]='Plugin';break;case _0xb71a('0x73'):_0x5f3f19['childModel']=_0xb71a('0x74');_0x5f3f19[_0xb71a('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0xb71a('0x75')}];break;case _0xb71a('0x76'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x77');break;}return _0x5f3f19;}function _0x41a1fc(_0x3b6762,_0x3dfd97){var _0x535ab6=_0x3b6762['charAt'](0x0)[_0xb71a('0x78')]()+_0x3b6762[_0xb71a('0x79')](0x1);var _0x2cf6a3={'type':_0x3f0529[_0xb71a('0x7a')][_0xb71a('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x5a45df,_0x6ceada){var _0xc931ab=squel['select']()[_0xb71a('0x4')](_0xb71a('0x7c')+_0x535ab6+'InteractionId','id')[_0xb71a('0x4')](_0xb71a('0x7d'))[_0xb71a('0x7e')](_0xb71a('0x7f')+_0x3b6762+'_interactions','ui')[_0xb71a('0x80')](_0xb71a('0x81'),_0x3dfd97['id']);return _0x3f0529['sequelize'][_0xb71a('0x82')](_0xc931ab[_0xb71a('0x83')](),_0x2cf6a3)[_0xb71a('0x7')](function(_0x2881a3){_0x3dfd97[_0x535ab6+_0xb71a('0x84')]=_0x2881a3;_0x5a45df(_0x2881a3);})[_0xb71a('0x9')](function(_0x288862){_0x6ceada(_0x288862);});});}return _0x3e985a[_0xb71a('0x85')]('UserProfile',attributes,{'tableName':_0xb71a('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3a5431){var _0x526065={'raw':![],'where':{}};var _0x41fe0c={};var _0x2dbaa2={'count':0x0,'rows':[]};var _0x52fac6=_0x3a5431[_0xb71a('0x82')][_0xb71a('0x87')];var _0x10b715=_0x3a5431[_0xb71a('0x82')][_0xb71a('0x88')]||![];var _0x1c4160=_0x14b2a1(_0x52fac6,_0x10b715);if(!_0x1c4160['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x52fac6+'\x27');var _0x248c74=[{'name':_0x52fac6}];if(!_[_0xb71a('0x89')](_0x1c4160[_0xb71a('0x18')]))_0x248c74=_0x1c4160['parentSections'];var _0xe93fd=[];for(var _0x5e58f7=0x0;_0x5e58f7<_0x248c74[_0xb71a('0x8a')];_0x5e58f7++){_0xe93fd['push'](_0x3f0529['UserProfileSection'][_0xb71a('0x8b')]({'where':{'userProfileId':_0x3a5431[_0xb71a('0x8c')]['id'],'name':_0x248c74[_0x5e58f7][_0xb71a('0xc')]},'raw':!![]}));}return Promise[_0xb71a('0x8d')](_0xe93fd)[_0xb71a('0x7')](function(_0x4eca80){var _0x2b758b=_['filter'](_0x4eca80,function(_0x1adf18){return _0x1adf18?_0x1adf18:undefined;});var _0x312e46=_[_0xb71a('0x3')](_0x248c74,['ignore',!![]]);var _0x4d9dc8=_[_0xb71a('0x89')](_0x2b758b)&&_[_0xb71a('0x89')](_0x312e46)?null:_[_0xb71a('0x8e')](_0x312e46,_0x2b758b);if(!_0x4d9dc8)return null;var _0x3e2c72=[];for(var _0x9eff28=0x0;_0x9eff28<_0x4d9dc8['length'];_0x9eff28++){var _0x210fa0=_[_0xb71a('0x8b')](_0x248c74,function(_0x1063ab){return _0x4d9dc8[_0x9eff28]?_0x1063ab[_0xb71a('0xc')]===_0x4d9dc8[_0x9eff28][_0xb71a('0xc')]:null;});if(_0x210fa0){if(_0x4d9dc8[_0x9eff28]['ignore']){_0x3e2c72['push'](_0x4094b2(_0x1c4160[_0xb71a('0x12')],_0x4d9dc8[_0x9eff28]));}else{if(!_0x4d9dc8[_0x9eff28][_0xb71a('0x8f')]){_0x3e2c72[_0xb71a('0x90')](_0x1e9363(_0x210fa0,_0x4d9dc8[_0x9eff28],_0x1c4160[_0xb71a('0x12')]));}else{if(_0x210fa0[_0xb71a('0xa')]){_0x3e2c72[_0xb71a('0x90')](_0x3d7bd7(_0x210fa0,_0x4d9dc8[_0x9eff28]));}}}}}return Promise[_0xb71a('0x8d')](_0x3e2c72);})['then'](function(_0x45f4b2){var _0x27c15e=_0x45f4b2;var _0x55d263=null;if(_0x27c15e){_0x55d263=_0x27c15e[_0xb71a('0x8a')]===0x1?_0x27c15e[0x0]:null;}if(!_0x55d263&&!_0x27c15e)return _0x2dbaa2;var _0x20dc19=_0x3f0529[_0x1c4160[_0xb71a('0x12')]]['rawAttributes'];_0x41fe0c[_0xb71a('0xa')]=_[_0xb71a('0x91')](_0x20dc19);_0x41fe0c[_0xb71a('0x82')]=_['keys'](_0x3a5431[_0xb71a('0x82')]);_0x41fe0c[_0xb71a('0x92')]=_[_0xb71a('0x93')](_0x41fe0c[_0xb71a('0xa')],_0x41fe0c[_0xb71a('0x82')]);_0x526065[_0xb71a('0x94')]=_[_0xb71a('0x93')](_0x41fe0c[_0xb71a('0xa')],qs['fields'](_0x3a5431[_0xb71a('0x82')][_0xb71a('0x95')]));_0x526065[_0xb71a('0x94')]=_0x526065[_0xb71a('0x94')][_0xb71a('0x8a')]?_0x526065[_0xb71a('0x94')]:_0x41fe0c[_0xb71a('0xa')];if(!_0x3a5431['query'][_0xb71a('0x96')]('nolimit')){_0x526065[_0xb71a('0x97')]=qs[_0xb71a('0x97')](_0x3a5431['query'][_0xb71a('0x97')]);_0x526065['offset']=qs[_0xb71a('0x98')](_0x3a5431['query'][_0xb71a('0x98')]);}_0x526065[_0xb71a('0x99')]=qs[_0xb71a('0x9a')](_0x3a5431[_0xb71a('0x82')]['sort']);_0x526065[_0xb71a('0x80')]=qs[_0xb71a('0x92')](_['pick'](_0x3a5431[_0xb71a('0x82')],_0x41fe0c['filters']));if(_0x3a5431['query']['filter']){_0x526065['where']=_[_0xb71a('0x9b')](_0x526065[_0xb71a('0x80')],{'$or':_[_0xb71a('0xb')](_0x20dc19,function(_0x5554e8){if(_0x5554e8[_0xb71a('0xe')][_0xb71a('0x9c')]!=='VIRTUAL'){var _0x299349={};_0x299349[_0x5554e8[_0xb71a('0x4')]]={'$like':'%'+_0x3a5431[_0xb71a('0x82')][_0xb71a('0x3')]+'%'};return _0x299349;}})});}var _0x3209d3=[];var _0x16fbc1=null;var _0x537d00={};if(_0x55d263){_0x16fbc1=_[_0xb71a('0x8b')](_0x248c74,[_0xb71a('0xc'),_0x55d263[_0xb71a('0xc')]]);if(_0x16fbc1[_0xb71a('0x4')]){_0x537d00={};if(_0x1c4160[_0xb71a('0x12')]===_0xb71a('0x74')){_0x537d00[_0x16fbc1['foreignKey']]=_[_0xb71a('0xb')](_0x55d263[_0xb71a('0x8')],'id');}else{_0x537d00[_0x16fbc1['foreignKey']]=_0x55d263[_0xb71a('0x8')];}_0x3209d3[_0xb71a('0x90')](_0x537d00);}else{_0x526065[_0xb71a('0x80')]['id']=_0x55d263['associatedResources'];}}else{for(var _0x3ab7f5=0x0;_0x3ab7f5<_0x27c15e[_0xb71a('0x8a')];_0x3ab7f5++){_0x16fbc1=_[_0xb71a('0x8b')](_0x248c74,['name',_0x27c15e[_0x3ab7f5][_0xb71a('0xc')]]);if(_0x16fbc1[_0xb71a('0x4')]){_0x537d00={};_0x537d00[_0x16fbc1['foreignKey']]=_0x27c15e[_0x3ab7f5][_0xb71a('0x8')];_0x3209d3[_0xb71a('0x90')](_0x537d00);}else{if(!_0x526065[_0xb71a('0x80')]['id'])_0x526065[_0xb71a('0x80')]['id']=[];_0x27c15e[_0x3ab7f5]['associatedResources'][_0xb71a('0x9d')](function(_0x20cb10){_0x526065[_0xb71a('0x80')]['id'][_0xb71a('0x90')](_0x20cb10);});}}}if(!_['isEmpty'](_0x3209d3)){_0x526065[_0xb71a('0x80')]=_[_0xb71a('0x9b')](_0x526065['where'],{'$and':{'$or':_0x3209d3}});}_0x526065=_[_0xb71a('0x9b')]({},_0x526065,_0x3a5431[_0xb71a('0x9e')]);if(_0x55d263&&!_0x55d263['autoAssociation']&&_0x1c4160[_0xb71a('0x12')]===_0xb71a('0x74')){if(_0x3a5431[_0xb71a('0x82')]['includeAll']){_0x526065[_0xb71a('0x9f')]=[{'all':!![]}];}return _0x3f0529[_0x1c4160[_0xb71a('0x12')]][_0xb71a('0x6')](_0x526065)[_0xb71a('0x7')](function(_0x397e34){var _0xc552ac=[];_0x397e34[_0xb71a('0x9d')](function(_0x2e087e){var _0x19d364;switch(_0x2e087e['reportType']){case'default':_0x19d364=_[_0xb71a('0x8b')](_0x55d263[_0xb71a('0x8')],function(_0x4158ff){return _0x4158ff['id']===_0x2e087e[_0xb71a('0x75')]&&_0x4158ff[_0xb71a('0xe')]===_0xb71a('0xa0');});break;case'custom':_0x19d364=_[_0xb71a('0x8b')](_0x55d263['associatedResources'],function(_0x123323){return _0x123323['id']===_0x2e087e['reportId']&&_0x123323[_0xb71a('0xe')]===_0xb71a('0xa1');});break;}if(_0x19d364)_0xc552ac['push'](_0x2e087e);});_0x2dbaa2[_0xb71a('0xa2')]=_0xc552ac[_0xb71a('0x8a')];_0x2dbaa2[_0xb71a('0xa3')]=_0xc552ac;return _0x2dbaa2;});}else{return _0x3f0529[_0x1c4160[_0xb71a('0x12')]][_0xb71a('0xa2')]({'where':_0x526065['where']})[_0xb71a('0x7')](function(_0x3807e6){_0x2dbaa2['count']=_0x3807e6;if(_0x3a5431[_0xb71a('0x82')][_0xb71a('0xa4')]){if(_0x1c4160['childModel']===_0xb71a('0x1d')){_0x526065[_0xb71a('0x9f')]=[{'model':_0x3f0529[_0xb71a('0x6a')],'as':'Tags','attributes':['id',_0xb71a('0xc'),_0xb71a('0xa5')],'required':_0x3a5431[_0xb71a('0x82')]['tag']?!![]:![]},{'model':_0x3f0529[_0xb71a('0x6a')],'as':_0xb71a('0xa6'),'attributes':['id',_0xb71a('0xc'),_0xb71a('0xa5')],'through':_0x3a5431[_0xb71a('0x82')]['tag']?{'attributes':[],'where':{'TagId':_0x3a5431[_0xb71a('0x82')]['tag']||undefined}}:{},'required':_0x3a5431[_0xb71a('0x82')][_0xb71a('0xa7')]?!![]:![]}];}else{_0x526065[_0xb71a('0x9f')]=[{'all':!![]}];}}return _0x3f0529[_0x1c4160['childModel']]['findAll'](_0x526065);})[_0xb71a('0x7')](function(_0x13d2e0){_0x2dbaa2[_0xb71a('0xa3')]=_0x13d2e0;if(_0x52fac6===_0xb71a('0x30')&&_0x3a5431[_0xb71a('0x82')][_0xb71a('0xa8')]===_0xb71a('0xa9')){var _0x442ec0=[];for(var _0x24efc1=0x0;_0x24efc1<_0x2dbaa2[_0xb71a('0xa3')][_0xb71a('0x8a')];_0x24efc1++){_0x442ec0[_0xb71a('0x90')](_0x41a1fc(_0xb71a('0xaa'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));_0x442ec0['push'](_0x41a1fc(_0xb71a('0xac'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));_0x442ec0['push'](_0x41a1fc('fax',_0x2dbaa2['rows'][_0x24efc1][_0xb71a('0xab')]));_0x442ec0['push'](_0x41a1fc(_0xb71a('0xad'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1]['dataValues']));_0x442ec0['push'](_0x41a1fc(_0xb71a('0xae'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));_0x442ec0[_0xb71a('0x90')](_0x41a1fc(_0xb71a('0xaf'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));}return Promise[_0xb71a('0x8d')](_0x442ec0)[_0xb71a('0x7')](function(){return _0x2dbaa2;});}return _0x2dbaa2;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 80315bb..25b1ae8 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 _0x044a=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x38be8f,_0x58f8d2){var _0x532dcf=function(_0x357ebc){while(--_0x357ebc){_0x38be8f['push'](_0x38be8f['shift']());}};_0x532dcf(++_0x58f8d2);}(_0x044a,0x173));var _0xa044=function(_0x33e4b5,_0x16da83){_0x33e4b5=_0x33e4b5-0x0;var _0x5c6a78=_0x044a[_0x33e4b5];return _0x5c6a78;};'use strict';var _=require(_0xa044('0x0'));var util=require(_0xa044('0x1'));var moment=require(_0xa044('0x2'));var BPromise=require(_0xa044('0x3'));var rs=require(_0xa044('0x4'));var fs=require('fs');var Redis=require(_0xa044('0x5'));var db=require(_0xa044('0x6'))['db'];var utils=require(_0xa044('0x7'));var logger=require(_0xa044('0x8'))(_0xa044('0x9'));var config=require('../../config/environment');var jayson=require(_0xa044('0xa'));var client=jayson[_0xa044('0xb')][_0xa044('0xc')]({'port':0x232a});config[_0xa044('0xd')]=_['defaults'](config[_0xa044('0xd')],{'host':_0xa044('0xe'),'port':0x18eb});var socket=require(_0xa044('0xf'))(new Redis(config[_0xa044('0xd')]));require('./userProfile.socket')[_0xa044('0x10')](socket);function respondWithRpcPromise(_0x9dec14,_0x3f170b,_0x47a9dc){return new BPromise(function(_0xdf14f6,_0xa3b07f){return client[_0xa044('0x11')](_0x9dec14,_0x47a9dc)[_0xa044('0x12')](function(_0x5e203d){logger[_0xa044('0x13')]('UserProfile,\x20%s,\x20%s',_0x3f170b,'request\x20sent');logger[_0xa044('0x14')](_0xa044('0x15'),_0x3f170b,_0xa044('0x16'),JSON[_0xa044('0x17')](_0x5e203d));if(_0x5e203d[_0xa044('0x18')]){if(_0x5e203d[_0xa044('0x18')][_0xa044('0x19')]===0x1f4){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error'][_0xa044('0x1b')]);return _0xa3b07f(_0x5e203d[_0xa044('0x18')][_0xa044('0x1b')]);}logger[_0xa044('0x18')](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error']['message']);return _0xdf14f6(_0x5e203d[_0xa044('0x18')]['message']);}else{logger[_0xa044('0x13')](_0xa044('0x1a'),_0x3f170b,_0xa044('0x16'));_0xdf14f6(_0x5e203d[_0xa044('0x1c')][_0xa044('0x1b')]);}})['catch'](function(_0x567124){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x567124);_0xa3b07f(_0x567124);});});} \ No newline at end of file +var _0x3fc6=['request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s'];(function(_0x4c9d94,_0x1c14eb){var _0x275282=function(_0x1c8a9d){while(--_0x1c8a9d){_0x4c9d94['push'](_0x4c9d94['shift']());}};_0x275282(++_0x1c14eb);}(_0x3fc6,0x115));var _0x63fc=function(_0x41f567,_0x59e62b){_0x41f567=_0x41f567-0x0;var _0x482d25=_0x3fc6[_0x41f567];return _0x482d25;};'use strict';var _=require(_0x63fc('0x0'));var util=require('util');var moment=require(_0x63fc('0x1'));var BPromise=require(_0x63fc('0x2'));var rs=require(_0x63fc('0x3'));var fs=require('fs');var Redis=require(_0x63fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63fc('0x5'));var logger=require(_0x63fc('0x6'))(_0x63fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x63fc('0x8'));var client=jayson['client'][_0x63fc('0x9')]({'port':0x232a});config[_0x63fc('0xa')]=_[_0x63fc('0xb')](config['redis'],{'host':_0x63fc('0xc'),'port':0x18eb});var socket=require(_0x63fc('0xd'))(new Redis(config[_0x63fc('0xa')]));require(_0x63fc('0xe'))[_0x63fc('0xf')](socket);function respondWithRpcPromise(_0x5f328c,_0x319f1e,_0x544f22){return new BPromise(function(_0x5ad9a0,_0x6b8e8f){return client[_0x63fc('0x10')](_0x5f328c,_0x544f22)[_0x63fc('0x11')](function(_0x4445ba){logger[_0x63fc('0x12')](_0x63fc('0x13'),_0x319f1e,_0x63fc('0x14'));logger[_0x63fc('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x319f1e,_0x63fc('0x14'),JSON[_0x63fc('0x16')](_0x4445ba));if(_0x4445ba[_0x63fc('0x17')]){if(_0x4445ba['error'][_0x63fc('0x18')]===0x1f4){logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x4445ba['error'][_0x63fc('0x19')]);return _0x6b8e8f(_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);}logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);return _0x5ad9a0(_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);}else{logger[_0x63fc('0x12')](_0x63fc('0x13'),_0x319f1e,_0x63fc('0x14'));_0x5ad9a0(_0x4445ba[_0x63fc('0x1a')][_0x63fc('0x19')]);}})['catch'](function(_0x225c93){logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x225c93);_0x6b8e8f(_0x225c93);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c858413..101494e 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 _0x64c7=['length','remove','update','emit','register'];(function(_0x45c712,_0x2e68b2){var _0xb612e0=function(_0x51b7fe){while(--_0x51b7fe){_0x45c712['push'](_0x45c712['shift']());}};_0xb612e0(++_0x2e68b2);}(_0x64c7,0x1dc));var _0x764c=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x64c7[_0x5dfc2a];return _0x3f1a71;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x764c('0x0'),_0x764c('0x1')];function createListener(_0x33ff53,_0x491659){return function(_0x2940c1){_0x491659[_0x764c('0x2')](_0x33ff53,_0x2940c1);};}function removeListener(_0x4ed892,_0x4813af){return function(){UserProfileEvents['removeListener'](_0x4ed892,_0x4813af);};}exports[_0x764c('0x3')]=function(_0x4bf70e){for(var _0x1d94dd=0x0,_0x4ea75c=events[_0x764c('0x4')];_0x1d94dd<_0x4ea75c;_0x1d94dd++){var _0x5397a5=events[_0x1d94dd];var _0x3b0f53=createListener('userProfile:'+_0x5397a5,_0x4bf70e);UserProfileEvents['on'](_0x5397a5,_0x3b0f53);}}; \ No newline at end of file +var _0xe767=['userProfile:','./userProfile.events','save','remove','update','removeListener','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe767,0xa9));var _0x7e76=function(_0x35cd80,_0x210eff){_0x35cd80=_0x35cd80-0x0;var _0x2d11a3=_0xe767[_0x35cd80];return _0x2d11a3;};'use strict';var UserProfileEvents=require(_0x7e76('0x0'));var events=[_0x7e76('0x1'),_0x7e76('0x2'),_0x7e76('0x3')];function createListener(_0x127f89,_0x3d6e09){return function(_0x54778b){_0x3d6e09['emit'](_0x127f89,_0x54778b);};}function removeListener(_0x3ff73a,_0x46f4d7){return function(){UserProfileEvents[_0x7e76('0x4')](_0x3ff73a,_0x46f4d7);};}exports['register']=function(_0x2d8a52){for(var _0x2d7ad1=0x0,_0x30c30d=events[_0x7e76('0x5')];_0x2d7ad1<_0x30c30d;_0x2d7ad1++){var _0xaaa71b=events[_0x2d7ad1];var _0x5de31f=createListener(_0x7e76('0x6')+_0xaaa71b,_0x2d8a52);UserProfileEvents['on'](_0xaaa71b,_0x5de31f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index dabfa3a..6ad5229 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 _0xaf3f=['show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xaf3f,0x182));var _0xfaf3=function(_0x129170,_0x5110dc){_0x129170=_0x129170-0x0;var _0x523b0a=_0xaf3f[_0x129170];return _0x523b0a;};'use strict';var multer=require(_0xfaf3('0x0'));var util=require(_0xfaf3('0x1'));var path=require(_0xfaf3('0x2'));var timeout=require(_0xfaf3('0x3'));var express=require(_0xfaf3('0x4'));var router=express['Router']();var fs_extra=require(_0xfaf3('0x5'));var auth=require(_0xfaf3('0x6'));var interaction=require(_0xfaf3('0x7'));var config=require('../../config/environment');var controller=require(_0xfaf3('0x8'));router[_0xfaf3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaf3('0xa')]);router[_0xfaf3('0x9')]('/describe',auth[_0xfaf3('0xb')](),controller[_0xfaf3('0xc')]);router[_0xfaf3('0x9')](_0xfaf3('0xd'),auth['isAuthenticated'](),controller[_0xfaf3('0xe')]);router[_0xfaf3('0xf')]('/',auth['isAuthenticated'](),controller[_0xfaf3('0x10')]);router['put']('/:id',auth[_0xfaf3('0xb')](),controller['update']);router[_0xfaf3('0x11')](_0xfaf3('0xd'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x12')]);module[_0xfaf3('0x13')]=router; \ No newline at end of file +var _0xe211=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','delete','destroy','exports','path','express'];(function(_0x13ebb2,_0x8317c6){var _0x4fb9d3=function(_0x3282b1){while(--_0x3282b1){_0x13ebb2['push'](_0x13ebb2['shift']());}};_0x4fb9d3(++_0x8317c6);}(_0xe211,0x166));var _0x1e21=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe211[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e21('0x0'));var timeout=require('connect-timeout');var express=require(_0x1e21('0x1'));var router=express[_0x1e21('0x2')]();var fs_extra=require(_0x1e21('0x3'));var auth=require(_0x1e21('0x4'));var interaction=require(_0x1e21('0x5'));var config=require('../../config/environment');var controller=require(_0x1e21('0x6'));router[_0x1e21('0x7')]('/',auth[_0x1e21('0x8')](),controller[_0x1e21('0x9')]);router[_0x1e21('0x7')]('/describe',auth[_0x1e21('0x8')](),controller[_0x1e21('0xa')]);router[_0x1e21('0x7')](_0x1e21('0xb'),auth[_0x1e21('0x8')](),controller[_0x1e21('0xc')]);router[_0x1e21('0xd')]('/',auth['isAuthenticated'](),controller[_0x1e21('0xe')]);router['put'](_0x1e21('0xb'),auth[_0x1e21('0x8')](),controller['update']);router[_0x1e21('0xf')]('/:id',auth[_0x1e21('0x8')](),controller[_0x1e21('0x10')]);module[_0x1e21('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f69767b..5cbab48 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 _0x545c=['INTEGER','STRING','sequelize','exports'];(function(_0x490702,_0x590e55){var _0x31f197=function(_0x125300){while(--_0x125300){_0x490702['push'](_0x490702['shift']());}};_0x31f197(++_0x590e55);}(_0x545c,0x1c6));var _0xc545=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x545c[_0x36ed3c];return _0x52a2e0;};'use strict';var Sequelize=require(_0xc545('0x0'));module[_0xc545('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc545('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc545('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x6105=['exports','STRING','INTEGER','sequelize'];(function(_0x4f05ff,_0x2174dc){var _0x243f65=function(_0x280cfb){while(--_0x280cfb){_0x4f05ff['push'](_0x4f05ff['shift']());}};_0x243f65(++_0x2174dc);}(_0x6105,0xa7));var _0x5610=function(_0x19a0e4,_0x1d92b9){_0x19a0e4=_0x19a0e4-0x0;var _0x43d520=_0x6105[_0x19a0e4];return _0x43d520;};'use strict';var Sequelize=require(_0x5610('0x0'));module[_0x5610('0x1')]={'name':{'type':Sequelize[_0x5610('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5610('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5610('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 21ceb05..835324b 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 _0x01d9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','UserProfileResource'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['UserProfileResource'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['UserProfileResource'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));};exports[_0x901d('0x4d')]=function(_0x52aa2d,_0x3a3ea6){return db[_0x901d('0x2f')][_0x901d('0x4d')]()[_0x901d('0x28')](respondWithResult(_0x3a3ea6,null))[_0x901d('0x46')](handleError(_0x3a3ea6,null));}; \ No newline at end of file +var _0x5fab=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x5fab,0x177));var _0xb5fa=function(_0x8e2d4d,_0x310930){_0x8e2d4d=_0x8e2d4d-0x0;var _0x5e3047=_0x5fab[_0x8e2d4d];return _0x5e3047;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['UserProfileResource'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')](_0x33eb2c[_0xb5fa('0x4d')],{})[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,0xc9))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x3a39f2,_0x52f5d8){if(_0x3a39f2['body']['id']){delete _0x3a39f2[_0xb5fa('0x4d')]['id'];}return db['UserProfileResource'][_0xb5fa('0x4a')]({'where':{'id':_0x3a39f2[_0xb5fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x43')](saveUpdates(_0x3a39f2[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x52f5d8,null))[_0xb5fa('0x4b')](handleError(_0x52f5d8,null));};exports[_0xb5fa('0x26')]=function(_0x3ffee0,_0x51d5f7){return db[_0xb5fa('0x2d')]['find']({'where':{'id':_0x3ffee0[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x51d5f7,null))[_0xb5fa('0x43')](removeEntity(_0x51d5f7,null))['catch'](handleError(_0x51d5f7,null));};exports[_0xb5fa('0x4e')]=function(_0x130a0d,_0x4dea87){return db['UserProfileResource'][_0xb5fa('0x4e')]()[_0xb5fa('0x43')](respondWithResult(_0x4dea87,null))[_0xb5fa('0x4b')](handleError(_0x4dea87,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1627be6..a89bf19 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 _0x1932=['resourceId','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','compositeIndex'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1932,0x6d));var _0x2193=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x1932[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x2193('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2193('0x1'));var moment=require(_0x2193('0x2'));var BPromise=require(_0x2193('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2193('0x4'));var rimraf=require(_0x2193('0x5'));var config=require(_0x2193('0x6'));var attributes=require(_0x2193('0x7'));module['exports']=function(_0x5e1e43,_0x47ea94){return _0x5e1e43[_0x2193('0x8')](_0x2193('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2193('0xa'),'fields':[_0x2193('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa214=['bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment'];(function(_0x20ea49,_0x4d8dd4){var _0x40a867=function(_0x1eddd6){while(--_0x1eddd6){_0x20ea49['push'](_0x20ea49['shift']());}};_0x40a867(++_0x4d8dd4);}(_0xa214,0xd8));var _0x4a21=function(_0x40be59,_0x752493){_0x40be59=_0x40be59-0x0;var _0x3f6047=_0xa214[_0x40be59];return _0x3f6047;};'use strict';var _=require(_0x4a21('0x0'));var util=require(_0x4a21('0x1'));var logger=require(_0x4a21('0x2'))(_0x4a21('0x3'));var moment=require(_0x4a21('0x4'));var BPromise=require(_0x4a21('0x5'));var rp=require(_0x4a21('0x6'));var fs=require('fs');var path=require(_0x4a21('0x7'));var rimraf=require(_0x4a21('0x8'));var config=require('../../config/environment');var attributes=require(_0x4a21('0x9'));module[_0x4a21('0xa')]=function(_0x596845,_0x5bda43){return _0x596845[_0x4a21('0xb')](_0x4a21('0xc'),attributes,{'tableName':_0x4a21('0xd'),'paranoid':![],'indexes':[{'name':_0x4a21('0xe'),'fields':[_0x4a21('0xf'),_0x4a21('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e18ddc4..1c30029 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 _0x18b8=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x29de5d,_0x318caf){var _0x975265=function(_0x27e955){while(--_0x27e955){_0x29de5d['push'](_0x29de5d['shift']());}};_0x975265(++_0x318caf);}(_0x18b8,0xba));var _0x818b=function(_0x1962d2,_0x2f1ab7){_0x1962d2=_0x1962d2-0x0;var _0x110efe=_0x18b8[_0x1962d2];return _0x110efe;};'use strict';var _=require(_0x818b('0x0'));var util=require(_0x818b('0x1'));var moment=require(_0x818b('0x2'));var BPromise=require('bluebird');var rs=require(_0x818b('0x3'));var fs=require('fs');var Redis=require(_0x818b('0x4'));var db=require(_0x818b('0x5'))['db'];var utils=require(_0x818b('0x6'));var logger=require(_0x818b('0x7'))('rpc');var config=require(_0x818b('0x8'));var jayson=require(_0x818b('0x9'));var client=jayson[_0x818b('0xa')][_0x818b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x291bb6,_0x3b4530,_0x2bb2c9){return new BPromise(function(_0x593292,_0x2e5478){return client[_0x818b('0xc')](_0x291bb6,_0x2bb2c9)[_0x818b('0xd')](function(_0x6a04b0){logger[_0x818b('0xe')](_0x818b('0xf'),_0x3b4530,_0x818b('0x10'));logger[_0x818b('0x11')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3b4530,_0x818b('0x10'),JSON[_0x818b('0x12')](_0x6a04b0));if(_0x6a04b0[_0x818b('0x13')]){if(_0x6a04b0[_0x818b('0x13')][_0x818b('0x14')]===0x1f4){logger[_0x818b('0x13')](_0x818b('0xf'),_0x3b4530,_0x6a04b0[_0x818b('0x13')][_0x818b('0x15')]);return _0x2e5478(_0x6a04b0[_0x818b('0x13')][_0x818b('0x15')]);}logger[_0x818b('0x13')](_0x818b('0xf'),_0x3b4530,_0x6a04b0[_0x818b('0x13')]['message']);return _0x593292(_0x6a04b0[_0x818b('0x13')][_0x818b('0x15')]);}else{logger[_0x818b('0xe')](_0x818b('0xf'),_0x3b4530,_0x818b('0x10'));_0x593292(_0x6a04b0['result'][_0x818b('0x15')]);}})[_0x818b('0x16')](function(_0x127027){logger[_0x818b('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x3b4530,_0x127027);_0x2e5478(_0x127027);});});} \ No newline at end of file +var _0xa8b6=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x16195d,_0x361f73){var _0x5a104f=function(_0x2cab9a){while(--_0x2cab9a){_0x16195d['push'](_0x16195d['shift']());}};_0x5a104f(++_0x361f73);}(_0xa8b6,0x106));var _0x6a8b=function(_0x2d85d7,_0x4a0165){_0x2d85d7=_0x2d85d7-0x0;var _0x2429b2=_0xa8b6[_0x2d85d7];return _0x2429b2;};'use strict';var _=require(_0x6a8b('0x0'));var util=require(_0x6a8b('0x1'));var moment=require(_0x6a8b('0x2'));var BPromise=require(_0x6a8b('0x3'));var rs=require(_0x6a8b('0x4'));var fs=require('fs');var Redis=require(_0x6a8b('0x5'));var db=require(_0x6a8b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a8b('0x7'))(_0x6a8b('0x8'));var config=require(_0x6a8b('0x9'));var jayson=require(_0x6a8b('0xa'));var client=jayson[_0x6a8b('0xb')][_0x6a8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x476cab,_0xb1001f,_0x5f56d8){return new BPromise(function(_0x417d26,_0x83f2e8){return client[_0x6a8b('0xd')](_0x476cab,_0x5f56d8)[_0x6a8b('0xe')](function(_0x1e7b29){logger[_0x6a8b('0xf')](_0x6a8b('0x10'),_0xb1001f,_0x6a8b('0x11'));logger[_0x6a8b('0x12')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0xb1001f,_0x6a8b('0x11'),JSON[_0x6a8b('0x13')](_0x1e7b29));if(_0x1e7b29[_0x6a8b('0x14')]){if(_0x1e7b29['error'][_0x6a8b('0x15')]===0x1f4){logger['error'](_0x6a8b('0x10'),_0xb1001f,_0x1e7b29[_0x6a8b('0x14')][_0x6a8b('0x16')]);return _0x83f2e8(_0x1e7b29['error'][_0x6a8b('0x16')]);}logger[_0x6a8b('0x14')](_0x6a8b('0x10'),_0xb1001f,_0x1e7b29[_0x6a8b('0x14')]['message']);return _0x417d26(_0x1e7b29[_0x6a8b('0x14')]['message']);}else{logger[_0x6a8b('0xf')]('UserProfileResource,\x20%s,\x20%s',_0xb1001f,_0x6a8b('0x11'));_0x417d26(_0x1e7b29[_0x6a8b('0x17')][_0x6a8b('0x16')]);}})[_0x6a8b('0x18')](function(_0x3fc466){logger[_0x6a8b('0x14')]('UserProfileResource,\x20%s,\x20%s',_0xb1001f,_0x3fc466);_0x83f2e8(_0x3fc466);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7da5081..597924d 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 _0x44f3=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x44f3,0x122));var _0x344f=function(_0x3275fb,_0x19f753){_0x3275fb=_0x3275fb-0x0;var _0x1323d4=_0x44f3[_0x3275fb];return _0x1323d4;};'use strict';var multer=require(_0x344f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x344f('0x1'));var express=require(_0x344f('0x2'));var router=express['Router']();var fs_extra=require(_0x344f('0x3'));var auth=require(_0x344f('0x4'));var interaction=require(_0x344f('0x5'));var config=require(_0x344f('0x6'));var controller=require('./userProfileSection.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x344f('0x7')]);router['get'](_0x344f('0x8'),auth[_0x344f('0x9')](),controller[_0x344f('0xa')]);router[_0x344f('0xb')]('/:id',auth[_0x344f('0x9')](),controller[_0x344f('0xc')]);router[_0x344f('0xd')]('/',auth[_0x344f('0x9')](),controller[_0x344f('0xe')]);router[_0x344f('0xf')](_0x344f('0x10'),auth[_0x344f('0x9')](),controller[_0x344f('0x11')]);router[_0x344f('0x12')](_0x344f('0x10'),auth[_0x344f('0x9')](),controller[_0x344f('0x13')]);module[_0x344f('0x14')]=router; \ No newline at end of file +var _0xbb04=['index','get','/describe','describe','show','create','put','update','delete','/:id','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','isAuthenticated'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xbb04,0x1ad));var _0x4bb0=function(_0x45d9bb,_0x2c0350){_0x45d9bb=_0x45d9bb-0x0;var _0x1a36e9=_0xbb04[_0x45d9bb];return _0x1a36e9;};'use strict';var multer=require(_0x4bb0('0x0'));var util=require(_0x4bb0('0x1'));var path=require(_0x4bb0('0x2'));var timeout=require('connect-timeout');var express=require(_0x4bb0('0x3'));var router=express[_0x4bb0('0x4')]();var fs_extra=require(_0x4bb0('0x5'));var auth=require(_0x4bb0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x4bb0('0x7')](),controller[_0x4bb0('0x8')]);router[_0x4bb0('0x9')](_0x4bb0('0xa'),auth[_0x4bb0('0x7')](),controller[_0x4bb0('0xb')]);router[_0x4bb0('0x9')]('/:id',auth[_0x4bb0('0x7')](),controller[_0x4bb0('0xc')]);router['post']('/',auth[_0x4bb0('0x7')](),controller[_0x4bb0('0xd')]);router[_0x4bb0('0xe')]('/:id',auth[_0x4bb0('0x7')](),controller[_0x4bb0('0xf')]);router[_0x4bb0('0x10')](_0x4bb0('0x11'),auth['isAuthenticated'](),controller[_0x4bb0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3107a8a..84e2656 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x1fe100,_0x2694f0){var _0x22b013=function(_0x39193a){while(--_0x39193a){_0x1fe100['push'](_0x1fe100['shift']());}};_0x22b013(++_0x2694f0);}(_0xb9a7,0x112));var _0x7b9a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb9a7[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file +var _0xbfcc=['split','sequelize','STRING','INTEGER','BOOLEAN','join','getDataValue'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0xbfcc[_0x355ce8];return _0x1db8b8;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xcbfc('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xcbfc('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xcbfc('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xcbfc('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x59b1de){this['setDataValue']('crudPermissions',_0x59b1de?_0x59b1de[_0xcbfc('0x4')](''):[]);},'get':function(){return this[_0xcbfc('0x5')]('crudPermissions')?this[_0xcbfc('0x5')]('crudPermissions')[_0xcbfc('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 91604fd..d83579e 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 _0xcf99=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','sendStatus','error','name','send','index','rawAttributes','type','model','map','query','keys','filters','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','UserProfileSection','intersection','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x13b84b,_0x5ab566){var _0x111501=function(_0x4b5967){while(--_0x4b5967){_0x13b84b['push'](_0x13b84b['shift']());}};_0x111501(++_0x5ab566);}(_0xcf99,0x11d));var _0x9cf9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf99[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9cf9('0x0'));var rimraf=require(_0x9cf9('0x1'));var zipdir=require(_0x9cf9('0x2'));var jsonpatch=require(_0x9cf9('0x3'));var rp=require(_0x9cf9('0x4'));var moment=require(_0x9cf9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cf9('0x6'));var util=require(_0x9cf9('0x7'));var path=require(_0x9cf9('0x8'));var sox=require('sox');var csv=require(_0x9cf9('0x9'));var ejs=require(_0x9cf9('0xa'));var fs=require('fs');var fs_extra=require(_0x9cf9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9cf9('0xc'));var jsforce=require(_0x9cf9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9cf9('0x9'));var querystring=require(_0x9cf9('0xe'));var Papa=require('papaparse');var Redis=require(_0x9cf9('0xf'));var authService=require(_0x9cf9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9cf9('0x11'));var hardwareService=require(_0x9cf9('0x12'));var logger=require(_0x9cf9('0x13'))(_0x9cf9('0x14'));var utils=require(_0x9cf9('0x15'));var config=require(_0x9cf9('0x16'));var licenseUtil=require(_0x9cf9('0x17'));var db=require(_0x9cf9('0x18'))['db'];function respondWithStatusCode(_0x2330c8,_0x3dd1e8){_0x3dd1e8=_0x3dd1e8||0xcc;return function(_0x4c3345){if(_0x4c3345){return _0x2330c8['sendStatus'](_0x3dd1e8);}return _0x2330c8[_0x9cf9('0x19')](_0x3dd1e8)[_0x9cf9('0x1a')]();};}function respondWithResult(_0x224e1a,_0x2c6dae){_0x2c6dae=_0x2c6dae||0xc8;return function(_0x5609af){if(_0x5609af){return _0x224e1a[_0x9cf9('0x19')](_0x2c6dae)[_0x9cf9('0x1b')](_0x5609af);}};}function respondWithFilteredResult(_0x2f051c,_0xae38c6){return function(_0x2c2632){if(_0x2c2632){var _0x218000=typeof _0xae38c6['offset']===_0x9cf9('0x1c')&&typeof _0xae38c6[_0x9cf9('0x1d')]==='undefined';var _0x1ea2d6=_0x2c2632[_0x9cf9('0x1e')];var _0x78da88=_0x218000?0x0:_0xae38c6['offset'];var _0x174638=_0x218000?_0x2c2632[_0x9cf9('0x1e')]:_0xae38c6[_0x9cf9('0x1f')]+_0xae38c6['limit'];var _0x12b7b8;if(_0x174638>=_0x1ea2d6){_0x174638=_0x1ea2d6;_0x12b7b8=0xc8;}else{_0x12b7b8=0xce;}_0x2f051c[_0x9cf9('0x19')](_0x12b7b8);return _0x2f051c[_0x9cf9('0x20')](_0x9cf9('0x21'),_0x78da88+'-'+_0x174638+'/'+_0x1ea2d6)['json'](_0x2c2632);}return null;};}function patchUpdates(_0x489689){return function(_0x4af9b3){try{jsonpatch[_0x9cf9('0x22')](_0x4af9b3,_0x489689,!![]);}catch(_0x502e67){return BPromise['reject'](_0x502e67);}return _0x4af9b3[_0x9cf9('0x23')]();};}function saveUpdates(_0x571e7c,_0x13f372){return function(_0x181b9a){if(_0x181b9a){return _0x181b9a['update'](_0x571e7c)[_0x9cf9('0x24')](function(_0x16e6dc){return _0x16e6dc;});}return null;};}function removeEntity(_0x18a0c1,_0x48bfd6){return function(_0x533096){if(_0x533096){return _0x533096['destroy']()[_0x9cf9('0x24')](function(){_0x18a0c1[_0x9cf9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da26a,_0x50583b){return function(_0x2449b6){if(!_0x2449b6){_0x3da26a[_0x9cf9('0x25')](0x194);}return _0x2449b6;};}function handleError(_0x59331a,_0x5cfb11){_0x5cfb11=_0x5cfb11||0x1f4;return function(_0x1319bf){logger[_0x9cf9('0x26')](_0x1319bf['stack']);if(_0x1319bf[_0x9cf9('0x27')]){delete _0x1319bf[_0x9cf9('0x27')];}_0x59331a[_0x9cf9('0x19')](_0x5cfb11)[_0x9cf9('0x28')](_0x1319bf);};}exports[_0x9cf9('0x29')]=function(_0x3a463c,_0x18f31b){var _0x2a8901={},_0x381a64={},_0x1b6dec={'count':0x0,'rows':[]};var _0x23cb51=_['map'](db['UserProfileSection'][_0x9cf9('0x2a')],function(_0x3769d7){return{'name':_0x3769d7['fieldName'],'type':_0x3769d7[_0x9cf9('0x2b')]['key']};});_0x381a64[_0x9cf9('0x2c')]=_[_0x9cf9('0x2d')](_0x23cb51,_0x9cf9('0x27'));_0x381a64[_0x9cf9('0x2e')]=_[_0x9cf9('0x2f')](_0x3a463c[_0x9cf9('0x2e')]);_0x381a64[_0x9cf9('0x30')]=_['intersection'](_0x381a64['model'],_0x381a64['query']);_0x2a8901['attributes']=_['intersection'](_0x381a64[_0x9cf9('0x2c')],qs['fields'](_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x31')]));_0x2a8901[_0x9cf9('0x32')]=_0x2a8901[_0x9cf9('0x32')][_0x9cf9('0x33')]?_0x2a8901[_0x9cf9('0x32')]:_0x381a64[_0x9cf9('0x2c')];if(!_0x3a463c[_0x9cf9('0x2e')]['hasOwnProperty'](_0x9cf9('0x34'))){_0x2a8901[_0x9cf9('0x1d')]=qs[_0x9cf9('0x1d')](_0x3a463c['query'][_0x9cf9('0x1d')]);_0x2a8901[_0x9cf9('0x1f')]=qs[_0x9cf9('0x1f')](_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x1f')]);}_0x2a8901['order']=qs[_0x9cf9('0x35')](_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x35')]);_0x2a8901[_0x9cf9('0x36')]=qs[_0x9cf9('0x30')](_[_0x9cf9('0x37')](_0x3a463c[_0x9cf9('0x2e')],_0x381a64[_0x9cf9('0x30')]),_0x23cb51);if(_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x38')]){_0x2a8901[_0x9cf9('0x36')]=_[_0x9cf9('0x39')](_0x2a8901[_0x9cf9('0x36')],{'$or':_[_0x9cf9('0x2d')](_0x23cb51,function(_0x147a57){if(_0x147a57[_0x9cf9('0x2b')]!==_0x9cf9('0x3a')){var _0x79e07d={};_0x79e07d[_0x147a57[_0x9cf9('0x27')]]={'$like':'%'+_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x38')]+'%'};return _0x79e07d;}})});}_0x2a8901=_[_0x9cf9('0x39')]({},_0x2a8901,_0x3a463c[_0x9cf9('0x3b')]);var _0x2c1c80={'where':_0x2a8901['where']};return db['UserProfileSection']['count'](_0x2c1c80)[_0x9cf9('0x24')](function(_0x266910){_0x1b6dec[_0x9cf9('0x1e')]=_0x266910;if(_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x3c')]){_0x2a8901[_0x9cf9('0x3d')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x2a8901);})['then'](function(_0x3b21b2){_0x1b6dec[_0x9cf9('0x3e')]=_0x3b21b2;return _0x1b6dec;})[_0x9cf9('0x24')](respondWithFilteredResult(_0x18f31b,_0x2a8901))[_0x9cf9('0x3f')](handleError(_0x18f31b,null));};exports[_0x9cf9('0x40')]=function(_0x451264,_0x346dce){var _0x4600a5={'raw':![],'where':{'id':_0x451264[_0x9cf9('0x41')]['id']}},_0x32e134={};_0x32e134[_0x9cf9('0x2c')]=_[_0x9cf9('0x2f')](db[_0x9cf9('0x42')][_0x9cf9('0x2a')]);_0x32e134[_0x9cf9('0x2e')]=_['keys'](_0x451264[_0x9cf9('0x2e')]);_0x32e134[_0x9cf9('0x30')]=_[_0x9cf9('0x43')](_0x32e134[_0x9cf9('0x2c')],_0x32e134[_0x9cf9('0x2e')]);_0x4600a5['attributes']=_[_0x9cf9('0x43')](_0x32e134[_0x9cf9('0x2c')],qs[_0x9cf9('0x31')](_0x451264['query'][_0x9cf9('0x31')]));_0x4600a5[_0x9cf9('0x32')]=_0x4600a5[_0x9cf9('0x32')][_0x9cf9('0x33')]?_0x4600a5[_0x9cf9('0x32')]:_0x32e134[_0x9cf9('0x2c')];if(_0x451264[_0x9cf9('0x2e')]['includeAll']){_0x4600a5[_0x9cf9('0x3d')]=[{'all':!![]}];}_0x4600a5=_[_0x9cf9('0x39')]({},_0x4600a5,_0x451264[_0x9cf9('0x3b')]);return db['UserProfileSection']['find'](_0x4600a5)[_0x9cf9('0x24')](handleEntityNotFound(_0x346dce,null))['then'](respondWithResult(_0x346dce,null))[_0x9cf9('0x3f')](handleError(_0x346dce,null));};exports[_0x9cf9('0x44')]=function(_0x131347,_0x24c42d){return db[_0x9cf9('0x42')][_0x9cf9('0x44')](_0x131347[_0x9cf9('0x45')],{})[_0x9cf9('0x24')](respondWithResult(_0x24c42d,0xc9))[_0x9cf9('0x3f')](handleError(_0x24c42d,null));};exports[_0x9cf9('0x46')]=function(_0xcb7e54,_0x106c06){if(_0xcb7e54['body']['id']){delete _0xcb7e54[_0x9cf9('0x45')]['id'];}return db['UserProfileSection'][_0x9cf9('0x47')]({'where':{'id':_0xcb7e54[_0x9cf9('0x41')]['id']}})[_0x9cf9('0x24')](handleEntityNotFound(_0x106c06,null))[_0x9cf9('0x24')](saveUpdates(_0xcb7e54[_0x9cf9('0x45')],null))['then'](respondWithResult(_0x106c06,null))[_0x9cf9('0x3f')](handleError(_0x106c06,null));};exports[_0x9cf9('0x48')]=function(_0x29101c,_0x3f04cb){return db[_0x9cf9('0x42')][_0x9cf9('0x47')]({'where':{'id':_0x29101c[_0x9cf9('0x41')]['id']}})[_0x9cf9('0x24')](handleEntityNotFound(_0x3f04cb,null))['then'](removeEntity(_0x3f04cb,null))[_0x9cf9('0x3f')](handleError(_0x3f04cb,null));};exports['describe']=function(_0x136b6a,_0x555750){return db[_0x9cf9('0x42')]['describe']()['then'](respondWithResult(_0x555750,null))[_0x9cf9('0x3f')](handleError(_0x555750,null));}; \ No newline at end of file +var _0x38f0=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','index','map','UserProfileSection','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','catch','show','params','keys','rawAttributes','includeAll','options','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x76b4d,_0x342f35){var _0x364096=function(_0x326ac9){while(--_0x326ac9){_0x76b4d['push'](_0x76b4d['shift']());}};_0x364096(++_0x342f35);}(_0x38f0,0x1dc));var _0x038f=function(_0x374afc,_0x54a8ba){_0x374afc=_0x374afc-0x0;var _0x2ad429=_0x38f0[_0x374afc];return _0x2ad429;};'use strict';var emlformat=require(_0x038f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x038f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x038f('0x2'));var moment=require(_0x038f('0x3'));var BPromise=require(_0x038f('0x4'));var Mustache=require(_0x038f('0x5'));var util=require(_0x038f('0x6'));var path=require('path');var sox=require(_0x038f('0x7'));var csv=require(_0x038f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x038f('0x9'));var _=require(_0x038f('0xa'));var squel=require(_0x038f('0xb'));var crypto=require(_0x038f('0xc'));var jsforce=require(_0x038f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x038f('0x8'));var querystring=require(_0x038f('0xe'));var Papa=require(_0x038f('0xf'));var Redis=require('ioredis');var authService=require(_0x038f('0x10'));var qs=require(_0x038f('0x11'));var as=require(_0x038f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x038f('0x13'))('api');var utils=require(_0x038f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x038f('0x15'))['db'];function respondWithStatusCode(_0x4d8ae1,_0x4e002d){_0x4e002d=_0x4e002d||0xcc;return function(_0x1fc013){if(_0x1fc013){return _0x4d8ae1[_0x038f('0x16')](_0x4e002d);}return _0x4d8ae1[_0x038f('0x17')](_0x4e002d)['end']();};}function respondWithResult(_0x219091,_0x155fcb){_0x155fcb=_0x155fcb||0xc8;return function(_0x1c20d5){if(_0x1c20d5){return _0x219091['status'](_0x155fcb)[_0x038f('0x18')](_0x1c20d5);}};}function respondWithFilteredResult(_0x4ec73a,_0x545d55){return function(_0x4efed1){if(_0x4efed1){var _0x532671=typeof _0x545d55[_0x038f('0x19')]==='undefined'&&typeof _0x545d55[_0x038f('0x1a')]===_0x038f('0x1b');var _0x4bc10c=_0x4efed1['count'];var _0x54ea29=_0x532671?0x0:_0x545d55['offset'];var _0x57cf45=_0x532671?_0x4efed1[_0x038f('0x1c')]:_0x545d55[_0x038f('0x19')]+_0x545d55[_0x038f('0x1a')];var _0x45253e;if(_0x57cf45>=_0x4bc10c){_0x57cf45=_0x4bc10c;_0x45253e=0xc8;}else{_0x45253e=0xce;}_0x4ec73a['status'](_0x45253e);return _0x4ec73a['set'](_0x038f('0x1d'),_0x54ea29+'-'+_0x57cf45+'/'+_0x4bc10c)[_0x038f('0x18')](_0x4efed1);}return null;};}function patchUpdates(_0x40ddcb){return function(_0x413590){try{jsonpatch['apply'](_0x413590,_0x40ddcb,!![]);}catch(_0x2e96f0){return BPromise[_0x038f('0x1e')](_0x2e96f0);}return _0x413590[_0x038f('0x1f')]();};}function saveUpdates(_0x484c56,_0xa7a914){return function(_0x3e8646){if(_0x3e8646){return _0x3e8646['update'](_0x484c56)[_0x038f('0x20')](function(_0x57672b){return _0x57672b;});}return null;};}function removeEntity(_0xfaf2fb,_0x515bf6){return function(_0x3d85ab){if(_0x3d85ab){return _0x3d85ab[_0x038f('0x21')]()[_0x038f('0x20')](function(){_0xfaf2fb[_0x038f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34848d,_0x58d9c5){return function(_0x5784d0){if(!_0x5784d0){_0x34848d['sendStatus'](0x194);}return _0x5784d0;};}function handleError(_0x5ce945,_0x129a1d){_0x129a1d=_0x129a1d||0x1f4;return function(_0x242c3d){logger[_0x038f('0x22')](_0x242c3d[_0x038f('0x23')]);if(_0x242c3d[_0x038f('0x24')]){delete _0x242c3d[_0x038f('0x24')];}_0x5ce945['status'](_0x129a1d)['send'](_0x242c3d);};}exports[_0x038f('0x25')]=function(_0x24edaa,_0x43694e){var _0x3adbdb={},_0x2613ca={},_0x188e56={'count':0x0,'rows':[]};var _0x5e1e86=_[_0x038f('0x26')](db[_0x038f('0x27')]['rawAttributes'],function(_0x36105e){return{'name':_0x36105e['fieldName'],'type':_0x36105e[_0x038f('0x28')]['key']};});_0x2613ca[_0x038f('0x29')]=_['map'](_0x5e1e86,_0x038f('0x24'));_0x2613ca[_0x038f('0x2a')]=_['keys'](_0x24edaa[_0x038f('0x2a')]);_0x2613ca[_0x038f('0x2b')]=_['intersection'](_0x2613ca[_0x038f('0x29')],_0x2613ca[_0x038f('0x2a')]);_0x3adbdb[_0x038f('0x2c')]=_[_0x038f('0x2d')](_0x2613ca[_0x038f('0x29')],qs[_0x038f('0x2e')](_0x24edaa[_0x038f('0x2a')][_0x038f('0x2e')]));_0x3adbdb[_0x038f('0x2c')]=_0x3adbdb[_0x038f('0x2c')][_0x038f('0x2f')]?_0x3adbdb['attributes']:_0x2613ca[_0x038f('0x29')];if(!_0x24edaa['query'][_0x038f('0x30')]('nolimit')){_0x3adbdb[_0x038f('0x1a')]=qs['limit'](_0x24edaa[_0x038f('0x2a')][_0x038f('0x1a')]);_0x3adbdb[_0x038f('0x19')]=qs['offset'](_0x24edaa[_0x038f('0x2a')][_0x038f('0x19')]);}_0x3adbdb[_0x038f('0x31')]=qs[_0x038f('0x32')](_0x24edaa['query'][_0x038f('0x32')]);_0x3adbdb[_0x038f('0x33')]=qs['filters'](_[_0x038f('0x34')](_0x24edaa[_0x038f('0x2a')],_0x2613ca[_0x038f('0x2b')]),_0x5e1e86);if(_0x24edaa[_0x038f('0x2a')]['filter']){_0x3adbdb[_0x038f('0x33')]=_[_0x038f('0x35')](_0x3adbdb[_0x038f('0x33')],{'$or':_[_0x038f('0x26')](_0x5e1e86,function(_0x1ab17c){if(_0x1ab17c[_0x038f('0x28')]!==_0x038f('0x36')){var _0x46a377={};_0x46a377[_0x1ab17c[_0x038f('0x24')]]={'$like':'%'+_0x24edaa[_0x038f('0x2a')][_0x038f('0x37')]+'%'};return _0x46a377;}})});}_0x3adbdb=_[_0x038f('0x35')]({},_0x3adbdb,_0x24edaa['options']);var _0x1f65d3={'where':_0x3adbdb[_0x038f('0x33')]};return db[_0x038f('0x27')]['count'](_0x1f65d3)['then'](function(_0x292bfe){_0x188e56[_0x038f('0x1c')]=_0x292bfe;if(_0x24edaa['query']['includeAll']){_0x3adbdb[_0x038f('0x38')]=[{'all':!![]}];}return db['UserProfileSection'][_0x038f('0x39')](_0x3adbdb);})[_0x038f('0x20')](function(_0x220478){_0x188e56['rows']=_0x220478;return _0x188e56;})[_0x038f('0x20')](respondWithFilteredResult(_0x43694e,_0x3adbdb))[_0x038f('0x3a')](handleError(_0x43694e,null));};exports[_0x038f('0x3b')]=function(_0x2b97ac,_0x2012e0){var _0x31dc67={'raw':![],'where':{'id':_0x2b97ac[_0x038f('0x3c')]['id']}},_0x2257aa={};_0x2257aa[_0x038f('0x29')]=_[_0x038f('0x3d')](db['UserProfileSection'][_0x038f('0x3e')]);_0x2257aa[_0x038f('0x2a')]=_[_0x038f('0x3d')](_0x2b97ac[_0x038f('0x2a')]);_0x2257aa[_0x038f('0x2b')]=_[_0x038f('0x2d')](_0x2257aa[_0x038f('0x29')],_0x2257aa[_0x038f('0x2a')]);_0x31dc67[_0x038f('0x2c')]=_['intersection'](_0x2257aa[_0x038f('0x29')],qs['fields'](_0x2b97ac['query'][_0x038f('0x2e')]));_0x31dc67[_0x038f('0x2c')]=_0x31dc67[_0x038f('0x2c')][_0x038f('0x2f')]?_0x31dc67[_0x038f('0x2c')]:_0x2257aa['model'];if(_0x2b97ac[_0x038f('0x2a')][_0x038f('0x3f')]){_0x31dc67[_0x038f('0x38')]=[{'all':!![]}];}_0x31dc67=_[_0x038f('0x35')]({},_0x31dc67,_0x2b97ac[_0x038f('0x40')]);return db['UserProfileSection']['find'](_0x31dc67)[_0x038f('0x20')](handleEntityNotFound(_0x2012e0,null))[_0x038f('0x20')](respondWithResult(_0x2012e0,null))['catch'](handleError(_0x2012e0,null));};exports[_0x038f('0x41')]=function(_0x22ded5,_0x516b92){return db[_0x038f('0x27')][_0x038f('0x41')](_0x22ded5[_0x038f('0x42')],{})[_0x038f('0x20')](respondWithResult(_0x516b92,0xc9))[_0x038f('0x3a')](handleError(_0x516b92,null));};exports['update']=function(_0x2ffacc,_0x573a41){if(_0x2ffacc[_0x038f('0x42')]['id']){delete _0x2ffacc[_0x038f('0x42')]['id'];}return db[_0x038f('0x27')][_0x038f('0x43')]({'where':{'id':_0x2ffacc[_0x038f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x573a41,null))['then'](saveUpdates(_0x2ffacc[_0x038f('0x42')],null))['then'](respondWithResult(_0x573a41,null))['catch'](handleError(_0x573a41,null));};exports[_0x038f('0x21')]=function(_0x3610e5,_0x3b5c1d){return db[_0x038f('0x27')][_0x038f('0x43')]({'where':{'id':_0x3610e5[_0x038f('0x3c')]['id']}})[_0x038f('0x20')](handleEntityNotFound(_0x3b5c1d,null))[_0x038f('0x20')](removeEntity(_0x3b5c1d,null))['catch'](handleError(_0x3b5c1d,null));};exports['describe']=function(_0x32c7b2,_0x19ed77){return db[_0x038f('0x27')][_0x038f('0x44')]()[_0x038f('0x20')](respondWithResult(_0x19ed77,null))[_0x038f('0x3a')](handleError(_0x19ed77,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index c57fb82..79677ef 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 _0x734c=['./userProfileSection.attributes','exports','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x6523e4,_0x5b02f2){var _0x39317e=function(_0x534685){while(--_0x534685){_0x6523e4['push'](_0x6523e4['shift']());}};_0x39317e(++_0x5b02f2);}(_0x734c,0xe2));var _0xc734=function(_0x2c7fcd,_0x5977ae){_0x2c7fcd=_0x2c7fcd-0x0;var _0x204929=_0x734c[_0x2c7fcd];return _0x204929;};'use strict';var _=require(_0xc734('0x0'));var util=require(_0xc734('0x1'));var logger=require(_0xc734('0x2'))(_0xc734('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc734('0x4'));var fs=require('fs');var path=require(_0xc734('0x5'));var rimraf=require(_0xc734('0x6'));var config=require(_0xc734('0x7'));var attributes=require(_0xc734('0x8'));module[_0xc734('0x9')]=function(_0x5487fc,_0x373873){return _0x5487fc['define']('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xc734('0xa'),'fields':[_0xc734('0xb'),_0xc734('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1122=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','UserProfileSection'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2112('0x0'));var util=require('util');var logger=require(_0x2112('0x1'))(_0x2112('0x2'));var moment=require(_0x2112('0x3'));var BPromise=require(_0x2112('0x4'));var rp=require(_0x2112('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2112('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x2112('0x7')]=function(_0x224776,_0x4c7ac4){return _0x224776[_0x2112('0x8')](_0x2112('0x9'),attributes,{'tableName':_0x2112('0xa'),'paranoid':![],'indexes':[{'name':_0x2112('0xb'),'fields':[_0x2112('0xc'),_0x2112('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 20c217f..fa8d517 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 _0xb719=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x494f4d,_0x2807fa){var _0x3e7dfc=function(_0x14f2d2){while(--_0x14f2d2){_0x494f4d['push'](_0x494f4d['shift']());}};_0x3e7dfc(++_0x2807fa);}(_0xb719,0x1f4));var _0x9b71=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0xb719[_0x364cf8];return _0x6a59ee;};'use strict';var _=require(_0x9b71('0x0'));var util=require(_0x9b71('0x1'));var moment=require(_0x9b71('0x2'));var BPromise=require(_0x9b71('0x3'));var rs=require(_0x9b71('0x4'));var fs=require('fs');var Redis=require(_0x9b71('0x5'));var db=require(_0x9b71('0x6'))['db'];var utils=require(_0x9b71('0x7'));var logger=require('../../config/logger')(_0x9b71('0x8'));var config=require(_0x9b71('0x9'));var jayson=require(_0x9b71('0xa'));var client=jayson['client'][_0x9b71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39e280,_0x2d9fcb,_0x4cd350){return new BPromise(function(_0x5e3951,_0x2a4d12){return client[_0x9b71('0xc')](_0x39e280,_0x4cd350)[_0x9b71('0xd')](function(_0x18bc6c){logger[_0x9b71('0xe')](_0x9b71('0xf'),_0x2d9fcb,_0x9b71('0x10'));logger[_0x9b71('0x11')](_0x9b71('0x12'),_0x2d9fcb,'request\x20sent',JSON[_0x9b71('0x13')](_0x18bc6c));if(_0x18bc6c[_0x9b71('0x14')]){if(_0x18bc6c[_0x9b71('0x14')][_0x9b71('0x15')]===0x1f4){logger[_0x9b71('0x14')](_0x9b71('0xf'),_0x2d9fcb,_0x18bc6c[_0x9b71('0x14')][_0x9b71('0x16')]);return _0x2a4d12(_0x18bc6c[_0x9b71('0x14')]['message']);}logger[_0x9b71('0x14')](_0x9b71('0xf'),_0x2d9fcb,_0x18bc6c[_0x9b71('0x14')]['message']);return _0x5e3951(_0x18bc6c[_0x9b71('0x14')]['message']);}else{logger[_0x9b71('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2d9fcb,_0x9b71('0x10'));_0x5e3951(_0x18bc6c[_0x9b71('0x17')][_0x9b71('0x16')]);}})[_0x9b71('0x18')](function(_0x10b0cc){logger['error'](_0x9b71('0xf'),_0x2d9fcb,_0x10b0cc);_0x2a4d12(_0x10b0cc);});});} \ No newline at end of file +var _0xefa0=['stringify','error','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x3112ca,_0x4c83ed){var _0x16ea91=function(_0x44b168){while(--_0x44b168){_0x3112ca['push'](_0x3112ca['shift']());}};_0x16ea91(++_0x4c83ed);}(_0xefa0,0xb0));var _0x0efa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xefa0[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x0efa('0x0'));var util=require('util');var moment=require(_0x0efa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0efa('0x2'));var db=require(_0x0efa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0efa('0x4'))(_0x0efa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0efa('0x6')][_0x0efa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a5518,_0x121618,_0x2b05ad){return new BPromise(function(_0x24a7f9,_0x128d01){return client[_0x0efa('0x8')](_0x4a5518,_0x2b05ad)[_0x0efa('0x9')](function(_0x446cf7){logger[_0x0efa('0xa')](_0x0efa('0xb'),_0x121618,'request\x20sent');logger[_0x0efa('0xc')](_0x0efa('0xd'),_0x121618,'request\x20sent',JSON[_0x0efa('0xe')](_0x446cf7));if(_0x446cf7[_0x0efa('0xf')]){if(_0x446cf7[_0x0efa('0xf')]['code']===0x1f4){logger['error'](_0x0efa('0xb'),_0x121618,_0x446cf7[_0x0efa('0xf')][_0x0efa('0x10')]);return _0x128d01(_0x446cf7[_0x0efa('0xf')][_0x0efa('0x10')]);}logger[_0x0efa('0xf')](_0x0efa('0xb'),_0x121618,_0x446cf7['error'][_0x0efa('0x10')]);return _0x24a7f9(_0x446cf7['error'][_0x0efa('0x10')]);}else{logger[_0x0efa('0xa')](_0x0efa('0xb'),_0x121618,'request\x20sent');_0x24a7f9(_0x446cf7[_0x0efa('0x11')][_0x0efa('0x10')]);}})[_0x0efa('0x12')](function(_0xcc21ad){logger[_0x0efa('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x121618,_0xcc21ad);_0x128d01(_0xcc21ad);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9f36602..9f278bb 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2418bd,_0x1ddd5){var _0x12d19c=function(_0x3fc285){while(--_0x3fc285){_0x2418bd['push'](_0x2418bd['shift']());}};_0x12d19c(++_0x1ddd5);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2fcebb,_0x5601ba){var _0x4e60c9=function(_0x406015){while(--_0x406015){_0x2fcebb['push'](_0x2fcebb['shift']());}};_0x4e60c9(++_0x5601ba);}(_0x70e0,0x17b));var _0x070e=function(_0x3d39c8,_0x21a78a){_0x3d39c8=_0x3d39c8-0x0;var _0x5a8d79=_0x70e0[_0x3d39c8];return _0x5a8d79;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 318a298..0bed8ef 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 _0xd5b1=['sequelize'];(function(_0x517b8d,_0x40e01d){var _0x416b3c=function(_0xee87aa){while(--_0xee87aa){_0x517b8d['push'](_0x517b8d['shift']());}};_0x416b3c(++_0x40e01d);}(_0xd5b1,0x116));var _0x1d5b=function(_0x2ede20,_0x15ead9){_0x2ede20=_0x2ede20-0x0;var _0x1743a8=_0xd5b1[_0x2ede20];return _0x1743a8;};'use strict';var Sequelize=require(_0x1d5b('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdb1b=['INTEGER','sequelize','exports'];(function(_0xf59d5e,_0x217d67){var _0x2cd3d6=function(_0x153ae8){while(--_0x153ae8){_0xf59d5e['push'](_0xf59d5e['shift']());}};_0x2cd3d6(++_0x217d67);}(_0xdb1b,0x139));var _0xbdb1=function(_0x543898,_0x3db589){_0x543898=_0x543898-0x0;var _0x385b3f=_0xdb1b[_0x543898];return _0x385b3f;};'use strict';var Sequelize=require(_0xbdb1('0x0'));module[_0xbdb1('0x1')]={'penalty':{'type':Sequelize[_0xbdb1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 1710a4d..a09fa8b 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 _0x7ee1=['user_has_sms_queues','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0x469a8b,_0x50fa2c){var _0x59ffbb=function(_0x6f120b){while(--_0x6f120b){_0x469a8b['push'](_0x469a8b['shift']());}};_0x59ffbb(++_0x50fa2c);}(_0x7ee1,0x8d));var _0x17ee=function(_0x2f7281,_0x3a81fc){_0x2f7281=_0x2f7281-0x0;var _0x25abf7=_0x7ee1[_0x2f7281];return _0x25abf7;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('UserSmsQueue',attributes,{'tableName':_0x17ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4317=['./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x329834,_0x422cc3){var _0x2ff0a6=function(_0x2b4942){while(--_0x2b4942){_0x329834['push'](_0x329834['shift']());}};_0x2ff0a6(++_0x422cc3);}(_0x4317,0x7c));var _0x7431=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4317[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'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 acf8aa6..2c0447e 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 _0x3a72=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment'];(function(_0x213441,_0x323ba4){var _0x55f6a0=function(_0x4eb95e){while(--_0x4eb95e){_0x213441['push'](_0x213441['shift']());}};_0x55f6a0(++_0x323ba4);}(_0x3a72,0x91));var _0x23a7=function(_0x24734d,_0x1faa70){_0x24734d=_0x24734d-0x0;var _0x657c5a=_0x3a72[_0x24734d];return _0x657c5a;};'use strict';var _=require('lodash');var util=require(_0x23a7('0x0'));var moment=require(_0x23a7('0x1'));var BPromise=require(_0x23a7('0x2'));var rs=require(_0x23a7('0x3'));var fs=require('fs');var Redis=require(_0x23a7('0x4'));var db=require(_0x23a7('0x5'))['db'];var utils=require(_0x23a7('0x6'));var logger=require(_0x23a7('0x7'))(_0x23a7('0x8'));var config=require(_0x23a7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x23a7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa9104e,_0x79a8fc,_0x10e567){return new BPromise(function(_0xe23891,_0x33be3e){return client[_0x23a7('0xb')](_0xa9104e,_0x10e567)['then'](function(_0x3662c5){logger[_0x23a7('0xc')](_0x23a7('0xd'),_0x79a8fc,'request\x20sent');logger[_0x23a7('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x79a8fc,_0x23a7('0xf'),JSON[_0x23a7('0x10')](_0x3662c5));if(_0x3662c5[_0x23a7('0x11')]){if(_0x3662c5[_0x23a7('0x11')]['code']===0x1f4){logger[_0x23a7('0x11')](_0x23a7('0xd'),_0x79a8fc,_0x3662c5[_0x23a7('0x11')][_0x23a7('0x12')]);return _0x33be3e(_0x3662c5['error'][_0x23a7('0x12')]);}logger[_0x23a7('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x79a8fc,_0x3662c5['error'][_0x23a7('0x12')]);return _0xe23891(_0x3662c5[_0x23a7('0x11')][_0x23a7('0x12')]);}else{logger[_0x23a7('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x79a8fc,_0x23a7('0xf'));_0xe23891(_0x3662c5[_0x23a7('0x13')][_0x23a7('0x12')]);}})[_0x23a7('0x14')](function(_0x2c4c6e){logger[_0x23a7('0x11')](_0x23a7('0xd'),_0x79a8fc,_0x2c4c6e);_0x33be3e(_0x2c4c6e);});});} \ No newline at end of file +var _0xfdaf=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x5d18a3,_0x1806c7){var _0x37759a=function(_0x316981){while(--_0x316981){_0x5d18a3['push'](_0x5d18a3['shift']());}};_0x37759a(++_0x1806c7);}(_0xfdaf,0x1ec));var _0xffda=function(_0x453acd,_0x9f4a10){_0x453acd=_0x453acd-0x0;var _0x4db88e=_0xfdaf[_0x453acd];return _0x4db88e;};'use strict';var _=require(_0xffda('0x0'));var util=require(_0xffda('0x1'));var moment=require(_0xffda('0x2'));var BPromise=require(_0xffda('0x3'));var rs=require(_0xffda('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffda('0x5'))['db'];var utils=require(_0xffda('0x6'));var logger=require(_0xffda('0x7'))('rpc');var config=require(_0xffda('0x8'));var jayson=require(_0xffda('0x9'));var client=jayson[_0xffda('0xa')][_0xffda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xeb6a60,_0xa652c2,_0xf62543){return new BPromise(function(_0x130605,_0x3d755a){return client['request'](_0xeb6a60,_0xf62543)[_0xffda('0xc')](function(_0x3718d3){logger[_0xffda('0xd')](_0xffda('0xe'),_0xa652c2,_0xffda('0xf'));logger[_0xffda('0x10')](_0xffda('0x11'),_0xa652c2,_0xffda('0xf'),JSON[_0xffda('0x12')](_0x3718d3));if(_0x3718d3[_0xffda('0x13')]){if(_0x3718d3[_0xffda('0x13')]['code']===0x1f4){logger[_0xffda('0x13')](_0xffda('0xe'),_0xa652c2,_0x3718d3[_0xffda('0x13')][_0xffda('0x14')]);return _0x3d755a(_0x3718d3[_0xffda('0x13')][_0xffda('0x14')]);}logger[_0xffda('0x13')](_0xffda('0xe'),_0xa652c2,_0x3718d3[_0xffda('0x13')]['message']);return _0x130605(_0x3718d3[_0xffda('0x13')][_0xffda('0x14')]);}else{logger['info'](_0xffda('0xe'),_0xa652c2,_0xffda('0xf'));_0x130605(_0x3718d3[_0xffda('0x15')][_0xffda('0x14')]);}})[_0xffda('0x16')](function(_0x5a53ab){logger[_0xffda('0x13')](_0xffda('0xe'),_0xa652c2,_0x5a53ab);_0x3d755a(_0x5a53ab);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 7d0f504..28ca059 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 _0x4ec9=['exports','INTEGER','sequelize'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x4ec9,0x98));var _0x94ec=function(_0x3a1b90,_0x3c0158){_0x3a1b90=_0x3a1b90-0x0;var _0xf6de77=_0x4ec9[_0x3a1b90];return _0xf6de77;};'use strict';var Sequelize=require(_0x94ec('0x0'));module[_0x94ec('0x1')]={'UserId':{'type':Sequelize[_0x94ec('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x94ec('0x2')]}}; \ No newline at end of file +var _0xd02c=['sequelize','exports','INTEGER'];(function(_0x2ca410,_0x55e6e6){var _0x2da137=function(_0xc18638){while(--_0xc18638){_0x2ca410['push'](_0x2ca410['shift']());}};_0x2da137(++_0x55e6e6);}(_0xd02c,0x96));var _0xcd02=function(_0x4dd8ed,_0x395ac0){_0x4dd8ed=_0x4dd8ed-0x0;var _0x32a3a7=_0xd02c[_0x4dd8ed];return _0x32a3a7;};'use strict';var Sequelize=require(_0xcd02('0x0'));module[_0xcd02('0x1')]={'UserId':{'type':Sequelize[_0xcd02('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xcd02('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 6959a67..71b19c2 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(_0x43efc8,_0x5b3af2){var _0x2cd5cc=function(_0x2c0405){while(--_0x2c0405){_0x43efc8['push'](_0x43efc8['shift']());}};_0x2cd5cc(++_0x5b3af2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0xa838bb,_0x32a4f1){var _0x1ae24b=function(_0x12034b){while(--_0x12034b){_0xa838bb['push'](_0xa838bb['shift']());}};_0x1ae24b(++_0x32a4f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 266a5ab..508d10a 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3c3caf,_0x2560d8){var _0x3fb5df=function(_0x116326){while(--_0x116326){_0x3c3caf['push'](_0x3c3caf['shift']());}};_0x3fb5df(++_0x2560d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0xcb91[_0x59616b];return _0x5c4523;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xe649fb,_0x4d6c26){var _0x43c986=function(_0x111a20){while(--_0x111a20){_0xe649fb['push'](_0xe649fb['shift']());}};_0x43c986(++_0x4d6c26);}(_0xedd9,0xfc));var _0x9edd=function(_0x549a7c,_0x27b454){_0x549a7c=_0x549a7c-0x0;var _0x1c17f9=_0xedd9[_0x549a7c];return _0x1c17f9;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index fbfb9a2..17978c1 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 _0xb09b=['exports'];(function(_0x764397,_0x13654c){var _0x138255=function(_0x4d75d0){while(--_0x4d75d0){_0x764397['push'](_0x764397['shift']());}};_0x138255(++_0x13654c);}(_0xb09b,0x1af));var _0xbb09=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xb09b[_0x2bcb75];return _0x175345;};'use strict';var Sequelize=require('sequelize');module[_0xbb09('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7543=['exports','INTEGER'];(function(_0x40f511,_0x3d49ec){var _0x3b3782=function(_0x36f4c9){while(--_0x36f4c9){_0x40f511['push'](_0x40f511['shift']());}};_0x3b3782(++_0x3d49ec);}(_0x7543,0x148));var _0x3754=function(_0x1f176d,_0x4dc649){_0x1f176d=_0x1f176d-0x0;var _0x5b46fd=_0x7543[_0x1f176d];return _0x5b46fd;};'use strict';var Sequelize=require('sequelize');module[_0x3754('0x0')]={'penalty':{'type':Sequelize[_0x3754('0x1')],'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 e3125fb..e468679 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 _0x6078=['user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','UserVoiceQueue'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x6078,0x11f));var _0x8607=function(_0x2acb7a,_0x18bbb3){_0x2acb7a=_0x2acb7a-0x0;var _0x51850e=_0x6078[_0x2acb7a];return _0x51850e;};'use strict';var _=require(_0x8607('0x0'));var util=require(_0x8607('0x1'));var logger=require(_0x8607('0x2'))(_0x8607('0x3'));var moment=require('moment');var BPromise=require(_0x8607('0x4'));var rp=require(_0x8607('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8607('0x6'));var config=require(_0x8607('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x8607('0x8')]=function(_0x143778,_0x4eec57){return _0x143778['define'](_0x8607('0x9'),attributes,{'tableName':_0x8607('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x480a=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x480a,0x93));var _0xa480=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x480a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa480('0x0'));var util=require(_0xa480('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa480('0x2'));var rp=require(_0xa480('0x3'));var fs=require('fs');var path=require(_0xa480('0x4'));var rimraf=require(_0xa480('0x5'));var config=require(_0xa480('0x6'));var attributes=require(_0xa480('0x7'));module[_0xa480('0x8')]=function(_0x2f5fbc,_0x3230fb){return _0x2f5fbc[_0xa480('0x9')](_0xa480('0xa'),attributes,{'tableName':_0xa480('0xb'),'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 9d97328..d8cd5e2 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 _0x8c00=['client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x189579,_0x791321){var _0x5d55a8=function(_0x51ea37){while(--_0x51ea37){_0x189579['push'](_0x189579['shift']());}};_0x5d55a8(++_0x791321);}(_0x8c00,0x110));var _0x08c0=function(_0x48d3f8,_0x502a1b){_0x48d3f8=_0x48d3f8-0x0;var _0x3f6498=_0x8c00[_0x48d3f8];return _0x3f6498;};'use strict';var _=require('lodash');var util=require(_0x08c0('0x0'));var moment=require('moment');var BPromise=require(_0x08c0('0x1'));var rs=require(_0x08c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08c0('0x3'))['db'];var utils=require(_0x08c0('0x4'));var logger=require(_0x08c0('0x5'))(_0x08c0('0x6'));var config=require('../../config/environment');var jayson=require(_0x08c0('0x7'));var client=jayson[_0x08c0('0x8')][_0x08c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x389121,_0x7ee27,_0x5be9b5){return new BPromise(function(_0x56c98f,_0x5381af){return client[_0x08c0('0xa')](_0x389121,_0x5be9b5)[_0x08c0('0xb')](function(_0x5a094f){logger[_0x08c0('0xc')](_0x08c0('0xd'),_0x7ee27,_0x08c0('0xe'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x7ee27,'request\x20sent',JSON[_0x08c0('0xf')](_0x5a094f));if(_0x5a094f[_0x08c0('0x10')]){if(_0x5a094f[_0x08c0('0x10')]['code']===0x1f4){logger[_0x08c0('0x10')](_0x08c0('0xd'),_0x7ee27,_0x5a094f['error'][_0x08c0('0x11')]);return _0x5381af(_0x5a094f['error'][_0x08c0('0x11')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x7ee27,_0x5a094f[_0x08c0('0x10')][_0x08c0('0x11')]);return _0x56c98f(_0x5a094f[_0x08c0('0x10')][_0x08c0('0x11')]);}else{logger[_0x08c0('0xc')](_0x08c0('0xd'),_0x7ee27,_0x08c0('0xe'));_0x56c98f(_0x5a094f[_0x08c0('0x12')][_0x08c0('0x11')]);}})[_0x08c0('0x13')](function(_0x2886f3){logger[_0x08c0('0x10')](_0x08c0('0xd'),_0x7ee27,_0x2886f3);_0x5381af(_0x2886f3);});});} \ No newline at end of file +var _0x72e1=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x72e1,0x106));var _0x172e=function(_0x47caa9,_0x31ae41){_0x47caa9=_0x47caa9-0x0;var _0x2dbe3e=_0x72e1[_0x47caa9];return _0x2dbe3e;};'use strict';var _=require(_0x172e('0x0'));var util=require(_0x172e('0x1'));var moment=require(_0x172e('0x2'));var BPromise=require('bluebird');var rs=require(_0x172e('0x3'));var fs=require('fs');var Redis=require(_0x172e('0x4'));var db=require(_0x172e('0x5'))['db'];var utils=require(_0x172e('0x6'));var logger=require(_0x172e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x172e('0x8'));var client=jayson['client'][_0x172e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x479989,_0x134573,_0x28fa23){return new BPromise(function(_0x520a1c,_0x2d3fa1){return client[_0x172e('0xa')](_0x479989,_0x28fa23)[_0x172e('0xb')](function(_0x5c9dad){logger[_0x172e('0xc')](_0x172e('0xd'),_0x134573,_0x172e('0xe'));logger[_0x172e('0xf')](_0x172e('0x10'),_0x134573,_0x172e('0xe'),JSON[_0x172e('0x11')](_0x5c9dad));if(_0x5c9dad[_0x172e('0x12')]){if(_0x5c9dad[_0x172e('0x12')][_0x172e('0x13')]===0x1f4){logger[_0x172e('0x12')](_0x172e('0xd'),_0x134573,_0x5c9dad['error'][_0x172e('0x14')]);return _0x2d3fa1(_0x5c9dad[_0x172e('0x12')]['message']);}logger[_0x172e('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x134573,_0x5c9dad['error']['message']);return _0x520a1c(_0x5c9dad['error']['message']);}else{logger[_0x172e('0xc')](_0x172e('0xd'),_0x134573,_0x172e('0xe'));_0x520a1c(_0x5c9dad['result'][_0x172e('0x14')]);}})[_0x172e('0x15')](function(_0x4fccd3){logger['error'](_0x172e('0xd'),_0x134573,_0x4fccd3);_0x2d3fa1(_0x4fccd3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0b9d89b..3bbf39b 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xc93161,_0x347e90){var _0x13c4f0=function(_0x5c552e){while(--_0x5c552e){_0xc93161['push'](_0xc93161['shift']());}};_0x13c4f0(++_0x347e90);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x491826,_0x58f5c0){var _0x47cbd8=function(_0x2fa0ad){while(--_0x2fa0ad){_0x491826['push'](_0x491826['shift']());}};_0x47cbd8(++_0x58f5c0);}(_0xedd9,0xfc));var _0x9edd=function(_0x154b23,_0x441adb){_0x154b23=_0x154b23-0x0;var _0x5d47f4=_0xedd9[_0x154b23];return _0x5d47f4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 874ac89..e2dc357 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 _0xa008=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0xa008,0x64));var _0x8a00=function(_0x2e583f,_0x5af3d0){_0x2e583f=_0x2e583f-0x0;var _0x1370e7=_0xa008[_0x2e583f];return _0x1370e7;};'use strict';var Sequelize=require(_0x8a00('0x0'));module[_0x8a00('0x1')]={'uniqueid':{'type':Sequelize[_0x8a00('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8a00('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8a00('0x4')],'allowNull':![],'unique':_0x8a00('0x5'),'comment':_0x8a00('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8a00('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x8a00('0x4')],'allowNull':![],'unique':_0x8a00('0x5'),'comment':_0x8a00('0x3')},'penalty':{'type':Sequelize[_0x8a00('0x2')](0xb),'defaultValue':0x0,'comment':_0x8a00('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x39b5=['Required\x20by\x20Asterisk','queue_interface','INTEGER','STRING'];(function(_0x1bfb23,_0x72c4ee){var _0x1e18be=function(_0x451f55){while(--_0x451f55){_0x1bfb23['push'](_0x1bfb23['shift']());}};_0x1e18be(++_0x72c4ee);}(_0x39b5,0x1ba));var _0x539b=function(_0x251596,_0x5acacc){_0x251596=_0x251596-0x0;var _0x18a65c=_0x39b5[_0x251596];return _0x18a65c;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x539b('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x539b('0x1')],'allowNull':![],'comment':_0x539b('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x539b('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x539b('0x0')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x539b('0x3'),'comment':_0x539b('0x2')},'penalty':{'type':Sequelize[_0x539b('0x0')](0xb),'defaultValue':0x0,'comment':_0x539b('0x2')},'paused':{'type':Sequelize[_0x539b('0x0')](0xb),'defaultValue':0x0,'comment':_0x539b('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 329cae1..fc73b63 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 _0xd651=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','remove','emit'];(function(_0x27fbe2,_0x3e5f9a){var _0x560ef2=function(_0x467140){while(--_0x467140){_0x27fbe2['push'](_0x27fbe2['shift']());}};_0x560ef2(++_0x3e5f9a);}(_0xd651,0x172));var _0x1d65=function(_0x37803f,_0x26ba8f){_0x37803f=_0x37803f-0x0;var _0x480480=_0xd651[_0x37803f];return _0x480480;};'use strict';var EventEmitter=require(_0x1d65('0x0'));var UserVoiceQueueRt=require(_0x1d65('0x1'))['db'][_0x1d65('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1d65('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1d65('0x4')};function emitEvent(_0x49082c){return function(_0x184745,_0x70893c,_0xa61444){UserVoiceQueueRtEvents['emit'](_0x49082c+':'+_0x184745['id'],_0x184745);UserVoiceQueueRtEvents[_0x1d65('0x5')](_0x49082c,_0x184745);_0xa61444(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x1d65('0x6')](e,emitEvent(event));}}module[_0x1d65('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x60fa=['remove','emit','hook','exports','events','../../mysqldb','save','update'];(function(_0xc65834,_0x5df6fb){var _0x5da298=function(_0x30fbc2){while(--_0x30fbc2){_0xc65834['push'](_0xc65834['shift']());}};_0x5da298(++_0x5df6fb);}(_0x60fa,0x1d4));var _0xa60f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x60fa[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa60f('0x0'));var UserVoiceQueueRt=require(_0xa60f('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa60f('0x2'),'afterUpdate':_0xa60f('0x3'),'afterDestroy':_0xa60f('0x4')};function emitEvent(_0x1fbf1b){return function(_0xb557c7,_0x1a7399,_0x54aa5f){UserVoiceQueueRtEvents['emit'](_0x1fbf1b+':'+_0xb557c7['id'],_0xb557c7);UserVoiceQueueRtEvents[_0xa60f('0x5')](_0x1fbf1b,_0xb557c7);_0x54aa5f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xa60f('0x6')](e,emitEvent(event));}}module[_0xa60f('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 2b52617..31fea80 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 _0x9b6e=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1049f0,_0x10622b){var _0x40961b=function(_0xcd2952){while(--_0xcd2952){_0x1049f0['push'](_0x1049f0['shift']());}};_0x40961b(++_0x10622b);}(_0x9b6e,0x7d));var _0xe9b6=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x9b6e[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xe9b6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe9b6('0x1'));var moment=require(_0xe9b6('0x2'));var BPromise=require(_0xe9b6('0x3'));var rp=require(_0xe9b6('0x4'));var fs=require('fs');var path=require(_0xe9b6('0x5'));var rimraf=require('rimraf');var config=require(_0xe9b6('0x6'));var attributes=require(_0xe9b6('0x7'));module[_0xe9b6('0x8')]=function(_0x7d3afc,_0xefb380){return _0x7d3afc[_0xe9b6('0x9')](_0xe9b6('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebab=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x49365d,_0x227a7c){var _0x508eaa=function(_0x4c4464){while(--_0x4c4464){_0x49365d['push'](_0x49365d['shift']());}};_0x508eaa(++_0x227a7c);}(_0xebab,0x96));var _0xbeba=function(_0xb8d6b3,_0x3d434a){_0xb8d6b3=_0xb8d6b3-0x0;var _0x1d5b8d=_0xebab[_0xb8d6b3];return _0x1d5b8d;};'use strict';var _=require('lodash');var util=require(_0xbeba('0x0'));var logger=require(_0xbeba('0x1'))(_0xbeba('0x2'));var moment=require(_0xbeba('0x3'));var BPromise=require(_0xbeba('0x4'));var rp=require(_0xbeba('0x5'));var fs=require('fs');var path=require(_0xbeba('0x6'));var rimraf=require(_0xbeba('0x7'));var config=require(_0xbeba('0x8'));var attributes=require(_0xbeba('0x9'));module[_0xbeba('0xa')]=function(_0x44e9c4,_0x7ad5b1){return _0x44e9c4[_0xbeba('0xb')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 6a94d3b..384ca4d 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 _0xd266=['info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then'];(function(_0x93d3c7,_0x26a78c){var _0xe283b4=function(_0x255928){while(--_0x255928){_0x93d3c7['push'](_0x93d3c7['shift']());}};_0xe283b4(++_0x26a78c);}(_0xd266,0x18f));var _0x6d26=function(_0x157c2b,_0x2e593){_0x157c2b=_0x157c2b-0x0;var _0x5df6b8=_0xd266[_0x157c2b];return _0x5df6b8;};'use strict';var _=require(_0x6d26('0x0'));var util=require(_0x6d26('0x1'));var moment=require(_0x6d26('0x2'));var BPromise=require(_0x6d26('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d26('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d26('0x5'));var logger=require(_0x6d26('0x6'))(_0x6d26('0x7'));var config=require(_0x6d26('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d26('0x9')][_0x6d26('0xa')]({'port':0x232a});config[_0x6d26('0xb')]=_[_0x6d26('0xc')](config[_0x6d26('0xb')],{'host':_0x6d26('0xd'),'port':0x18eb});var socket=require(_0x6d26('0xe'))(new Redis(config['redis']));require(_0x6d26('0xf'))[_0x6d26('0x10')](socket);function respondWithRpcPromise(_0x2e1bd2,_0x42d74a,_0x12d808){return new BPromise(function(_0x133633,_0x1cbcb7){return client[_0x6d26('0x11')](_0x2e1bd2,_0x12d808)[_0x6d26('0x12')](function(_0x2a9ebe){logger[_0x6d26('0x13')](_0x6d26('0x14'),_0x42d74a,_0x6d26('0x15'));logger[_0x6d26('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x42d74a,'request\x20sent',JSON[_0x6d26('0x17')](_0x2a9ebe));if(_0x2a9ebe[_0x6d26('0x18')]){if(_0x2a9ebe['error'][_0x6d26('0x19')]===0x1f4){logger[_0x6d26('0x18')](_0x6d26('0x14'),_0x42d74a,_0x2a9ebe['error'][_0x6d26('0x1a')]);return _0x1cbcb7(_0x2a9ebe[_0x6d26('0x18')]['message']);}logger[_0x6d26('0x18')](_0x6d26('0x14'),_0x42d74a,_0x2a9ebe[_0x6d26('0x18')][_0x6d26('0x1a')]);return _0x133633(_0x2a9ebe[_0x6d26('0x18')][_0x6d26('0x1a')]);}else{logger[_0x6d26('0x13')](_0x6d26('0x14'),_0x42d74a,_0x6d26('0x15'));_0x133633(_0x2a9ebe[_0x6d26('0x1b')][_0x6d26('0x1a')]);}})[_0x6d26('0x1c')](function(_0x12ec61){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x42d74a,_0x12ec61);_0x1cbcb7(_0x12ec61);});});}exports[_0x6d26('0x1d')]=function(_0x34a570){var _0x11f15d=this;return new Promise(function(_0x4f3938,_0x1980d2){return db[_0x6d26('0x1e')][_0x6d26('0x1f')]({'raw':_0x34a570[_0x6d26('0x20')]?_0x34a570[_0x6d26('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x34a570[_0x6d26('0x20')]?_0x34a570[_0x6d26('0x20')][_0x6d26('0x21')]||null:null,'attributes':[[db[_0x6d26('0x22')]['fn'](_0x6d26('0x23'),db[_0x6d26('0x22')]['fn']('IF',db[_0x6d26('0x22')][_0x6d26('0x24')]('`paused`\x20=\x201,\x201,\x20null'))),_0x6d26('0x25')]]})[_0x6d26('0x12')](function(_0x550033){logger[_0x6d26('0x13')](_0x6d26('0x1d'),_0x34a570);logger[_0x6d26('0x16')](_0x6d26('0x1d'),_0x34a570,JSON[_0x6d26('0x17')](_0x550033));_0x4f3938(_0x550033);})[_0x6d26('0x1c')](function(_0x1e5f19){logger[_0x6d26('0x18')]('GetVoiceQueueRtPauses',_0x1e5f19[_0x6d26('0x1a')],_0x34a570);_0x1980d2(_0x11f15d[_0x6d26('0x18')](0x1f4,_0x1e5f19[_0x6d26('0x1a')]));});});}; \ No newline at end of file +var _0x7fd4=['rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4612b4,_0x428881){var _0x49d6ea=function(_0x3acfd9){while(--_0x3acfd9){_0x4612b4['push'](_0x4612b4['shift']());}};_0x49d6ea(++_0x428881);}(_0x7fd4,0xee));var _0x47fd=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x7fd4[_0x186d17];return _0x5d4b89;};'use strict';var _=require(_0x47fd('0x0'));var util=require('util');var moment=require(_0x47fd('0x1'));var BPromise=require(_0x47fd('0x2'));var rs=require(_0x47fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47fd('0x4'))['db'];var utils=require(_0x47fd('0x5'));var logger=require(_0x47fd('0x6'))(_0x47fd('0x7'));var config=require(_0x47fd('0x8'));var jayson=require(_0x47fd('0x9'));var client=jayson[_0x47fd('0xa')]['http']({'port':0x232a});config[_0x47fd('0xb')]=_['defaults'](config[_0x47fd('0xb')],{'host':_0x47fd('0xc'),'port':0x18eb});var socket=require(_0x47fd('0xd'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x487ad9,_0x35e326,_0x408967){return new BPromise(function(_0x2139cf,_0x5b6d3a){return client[_0x47fd('0xe')](_0x487ad9,_0x408967)[_0x47fd('0xf')](function(_0x48cd1d){logger[_0x47fd('0x10')](_0x47fd('0x11'),_0x35e326,_0x47fd('0x12'));logger[_0x47fd('0x13')](_0x47fd('0x14'),_0x35e326,_0x47fd('0x12'),JSON['stringify'](_0x48cd1d));if(_0x48cd1d[_0x47fd('0x15')]){if(_0x48cd1d[_0x47fd('0x15')]['code']===0x1f4){logger[_0x47fd('0x15')](_0x47fd('0x11'),_0x35e326,_0x48cd1d[_0x47fd('0x15')][_0x47fd('0x16')]);return _0x5b6d3a(_0x48cd1d[_0x47fd('0x15')]['message']);}logger[_0x47fd('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x35e326,_0x48cd1d['error']['message']);return _0x2139cf(_0x48cd1d['error'][_0x47fd('0x16')]);}else{logger[_0x47fd('0x10')](_0x47fd('0x11'),_0x35e326,_0x47fd('0x12'));_0x2139cf(_0x48cd1d['result']['message']);}})[_0x47fd('0x17')](function(_0x1cc557){logger[_0x47fd('0x15')](_0x47fd('0x11'),_0x35e326,_0x1cc557);_0x5b6d3a(_0x1cc557);});});}exports[_0x47fd('0x18')]=function(_0x4cfaf6){var _0x374ea1=this;return new Promise(function(_0x152e11,_0x572a1c){return db[_0x47fd('0x19')][_0x47fd('0x1a')]({'raw':_0x4cfaf6[_0x47fd('0x1b')]?_0x4cfaf6[_0x47fd('0x1b')][_0x47fd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4cfaf6[_0x47fd('0x1b')]?_0x4cfaf6['options']['where']||null:null,'attributes':[[db[_0x47fd('0x1d')]['fn'](_0x47fd('0x1e'),db['sequelize']['fn']('IF',db[_0x47fd('0x1d')][_0x47fd('0x1f')](_0x47fd('0x20')))),_0x47fd('0x21')]]})[_0x47fd('0xf')](function(_0x12c012){logger[_0x47fd('0x10')](_0x47fd('0x18'),_0x4cfaf6);logger[_0x47fd('0x13')](_0x47fd('0x18'),_0x4cfaf6,JSON[_0x47fd('0x22')](_0x12c012));_0x152e11(_0x12c012);})[_0x47fd('0x17')](function(_0x52f222){logger[_0x47fd('0x15')](_0x47fd('0x18'),_0x52f222[_0x47fd('0x16')],_0x4cfaf6);_0x572a1c(_0x374ea1['error'](0x1f4,_0x52f222['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 3090ad6..a5ca29f 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 _0x102b=['length','userVoiceQueueRt:','save','update','emit','removeListener'];(function(_0x25c8a8,_0x47e7ea){var _0x404c1b=function(_0x1abad3){while(--_0x1abad3){_0x25c8a8['push'](_0x25c8a8['shift']());}};_0x404c1b(++_0x47e7ea);}(_0x102b,0x1be));var _0xb102=function(_0xb82164,_0x2d6ebb){_0xb82164=_0xb82164-0x0;var _0x1a68de=_0x102b[_0xb82164];return _0x1a68de;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb102('0x0'),'remove',_0xb102('0x1')];function createListener(_0x3e1311,_0x42172c){return function(_0x1be904){_0x42172c[_0xb102('0x2')](_0x3e1311,_0x1be904);};}function removeListener(_0x1402fb,_0x19e35d){return function(){UserVoiceQueueRtEvents[_0xb102('0x3')](_0x1402fb,_0x19e35d);};}exports['register']=function(_0x3325b7){for(var _0x370baa=0x0,_0xd131eb=events[_0xb102('0x4')];_0x370baa<_0xd131eb;_0x370baa++){var _0x1ee0c0=events[_0x370baa];var _0x5879bb=createListener(_0xb102('0x5')+_0x1ee0c0,_0x3325b7);UserVoiceQueueRtEvents['on'](_0x1ee0c0,_0x5879bb);}}; \ No newline at end of file +var _0x0967=['emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update'];(function(_0xd7bb0b,_0x3e7cd5){var _0x116565=function(_0x423ee2){while(--_0x423ee2){_0xd7bb0b['push'](_0xd7bb0b['shift']());}};_0x116565(++_0x3e7cd5);}(_0x0967,0x100));var _0x7096=function(_0x167c6c,_0x680503){_0x167c6c=_0x167c6c-0x0;var _0x32136b=_0x0967[_0x167c6c];return _0x32136b;};'use strict';var UserVoiceQueueRtEvents=require(_0x7096('0x0'));var events=['save',_0x7096('0x1'),_0x7096('0x2')];function createListener(_0x29b2ba,_0xc0c6b1){return function(_0x31f0b1){_0xc0c6b1[_0x7096('0x3')](_0x29b2ba,_0x31f0b1);};}function removeListener(_0x4106a2,_0x2a50e2){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4106a2,_0x2a50e2);};}exports[_0x7096('0x4')]=function(_0x10181c){for(var _0xadd502=0x0,_0x1344c3=events[_0x7096('0x5')];_0xadd502<_0x1344c3;_0xadd502++){var _0x20f7ef=events[_0xadd502];var _0x2832fc=createListener(_0x7096('0x6')+_0x20f7ef,_0x10181c);UserVoiceQueueRtEvents['on'](_0x20f7ef,_0x2832fc);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 8e1bf39..23a4914 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x95a8a0,_0x16f119){var _0x36a8fd=function(_0x49588a){while(--_0x49588a){_0x95a8a0['push'](_0x95a8a0['shift']());}};_0x36a8fd(++_0x16f119);}(_0xe706,0xa3));var _0x6e70=function(_0x12fec1,_0x20be9c){_0x12fec1=_0x12fec1-0x0;var _0x26c3af=_0xe706[_0x12fec1];return _0x26c3af;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x52e2a4,_0x7f936b){var _0x5b6140=function(_0x39cc95){while(--_0x39cc95){_0x52e2a4['push'](_0x52e2a4['shift']());}};_0x5b6140(++_0x7f936b);}(_0xe706,0xa3));var _0x6e70=function(_0x248d46,_0xba08ec){_0x248d46=_0x248d46-0x0;var _0x354942=_0xe706[_0x248d46];return _0x354942;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6447f07..b60a99d 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 _0x3efe=['INTEGER','sequelize','exports'];(function(_0x62396d,_0x1ad1ba){var _0x49db3e=function(_0x4ef041){while(--_0x4ef041){_0x62396d['push'](_0x62396d['shift']());}};_0x49db3e(++_0x1ad1ba);}(_0x3efe,0x136));var _0xe3ef=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3efe[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xe3ef('0x0'));module[_0xe3ef('0x1')]={'penalty':{'type':Sequelize[_0xe3ef('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b5e=['sequelize','exports'];(function(_0x113e4b,_0x36ed8b){var _0x3a9ef9=function(_0x3412d7){while(--_0x3412d7){_0x113e4b['push'](_0x113e4b['shift']());}};_0x3a9ef9(++_0x36ed8b);}(_0x2b5e,0xf4));var _0xe2b5=function(_0x459c7d,_0x1771b5){_0x459c7d=_0x459c7d-0x0;var _0x2e676f=_0x2b5e[_0x459c7d];return _0x2e676f;};'use strict';var Sequelize=require(_0xe2b5('0x0'));module[_0xe2b5('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 6fb307a..68f9b1d 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 _0xe215=['api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','util','../../config/logger'];(function(_0x14415e,_0x4daea0){var _0x1c7933=function(_0x53c68e){while(--_0x53c68e){_0x14415e['push'](_0x14415e['shift']());}};_0x1c7933(++_0x4daea0);}(_0xe215,0x1de));var _0x5e21=function(_0x5d01ec,_0x17d179){_0x5d01ec=_0x5d01ec-0x0;var _0x10112e=_0xe215[_0x5d01ec];return _0x10112e;};'use strict';var _=require(_0x5e21('0x0'));var util=require(_0x5e21('0x1'));var logger=require(_0x5e21('0x2'))(_0x5e21('0x3'));var moment=require(_0x5e21('0x4'));var BPromise=require(_0x5e21('0x5'));var rp=require(_0x5e21('0x6'));var fs=require('fs');var path=require(_0x5e21('0x7'));var rimraf=require('rimraf');var config=require(_0x5e21('0x8'));var attributes=require(_0x5e21('0x9'));module[_0x5e21('0xa')]=function(_0x82e68f,_0x3e86f9){return _0x82e68f[_0x5e21('0xb')](_0x5e21('0xc'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cfe=['define','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x51d538,_0x418eca){var _0x4eea2e=function(_0x43c34f){while(--_0x43c34f){_0x51d538['push'](_0x51d538['shift']());}};_0x4eea2e(++_0x418eca);}(_0x8cfe,0x1a3));var _0xe8cf=function(_0x2772dd,_0x40cba3){_0x2772dd=_0x2772dd-0x0;var _0x58227a=_0x8cfe[_0x2772dd];return _0x58227a;};'use strict';var _=require(_0xe8cf('0x0'));var util=require(_0xe8cf('0x1'));var logger=require(_0xe8cf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe8cf('0x3'));var rp=require(_0xe8cf('0x4'));var fs=require('fs');var path=require(_0xe8cf('0x5'));var rimraf=require(_0xe8cf('0x6'));var config=require(_0xe8cf('0x7'));var attributes=require(_0xe8cf('0x8'));module[_0xe8cf('0x9')]=function(_0x13f3c6,_0x2b3568){return _0x13f3c6[_0xe8cf('0xa')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 079e9b3..09b1370 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 _0x0afb=['request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0xc758e3,_0x290d9f){var _0x1190ea=function(_0x43365d){while(--_0x43365d){_0xc758e3['push'](_0xc758e3['shift']());}};_0x1190ea(++_0x290d9f);}(_0x0afb,0x1d4));var _0xb0af=function(_0x491bd2,_0x55f078){_0x491bd2=_0x491bd2-0x0;var _0x5f1d55=_0x0afb[_0x491bd2];return _0x5f1d55;};'use strict';var _=require(_0xb0af('0x0'));var util=require('util');var moment=require(_0xb0af('0x1'));var BPromise=require(_0xb0af('0x2'));var rs=require(_0xb0af('0x3'));var fs=require('fs');var Redis=require(_0xb0af('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0af('0x5'))(_0xb0af('0x6'));var config=require(_0xb0af('0x7'));var jayson=require(_0xb0af('0x8'));var client=jayson['client'][_0xb0af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23b5bf,_0x1c7007,_0x5beb8d){return new BPromise(function(_0x398094,_0x451c6b){return client[_0xb0af('0xa')](_0x23b5bf,_0x5beb8d)[_0xb0af('0xb')](function(_0x282331){logger[_0xb0af('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1c7007,'request\x20sent');logger[_0xb0af('0xd')](_0xb0af('0xe'),_0x1c7007,_0xb0af('0xf'),JSON[_0xb0af('0x10')](_0x282331));if(_0x282331[_0xb0af('0x11')]){if(_0x282331['error'][_0xb0af('0x12')]===0x1f4){logger[_0xb0af('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1c7007,_0x282331['error']['message']);return _0x451c6b(_0x282331[_0xb0af('0x11')]['message']);}logger[_0xb0af('0x11')](_0xb0af('0x13'),_0x1c7007,_0x282331['error']['message']);return _0x398094(_0x282331[_0xb0af('0x11')][_0xb0af('0x14')]);}else{logger[_0xb0af('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1c7007,_0xb0af('0xf'));_0x398094(_0x282331[_0xb0af('0x15')]['message']);}})[_0xb0af('0x16')](function(_0x2d1761){logger['error'](_0xb0af('0x13'),_0x1c7007,_0x2d1761);_0x451c6b(_0x2d1761);});});} \ No newline at end of file +var _0x17f8=['then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xd0a17d,_0x4414a7){var _0x129f82=function(_0x5d664c){while(--_0x5d664c){_0xd0a17d['push'](_0xd0a17d['shift']());}};_0x129f82(++_0x4414a7);}(_0x17f8,0x145));var _0x817f=function(_0x339123,_0x13cf39){_0x339123=_0x339123-0x0;var _0x510cdb=_0x17f8[_0x339123];return _0x510cdb;};'use strict';var _=require('lodash');var util=require(_0x817f('0x0'));var moment=require(_0x817f('0x1'));var BPromise=require('bluebird');var rs=require(_0x817f('0x2'));var fs=require('fs');var Redis=require(_0x817f('0x3'));var db=require(_0x817f('0x4'))['db'];var utils=require(_0x817f('0x5'));var logger=require('../../config/logger')(_0x817f('0x6'));var config=require(_0x817f('0x7'));var jayson=require(_0x817f('0x8'));var client=jayson[_0x817f('0x9')][_0x817f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cb8af,_0x337ed8,_0x5a376c){return new BPromise(function(_0x4e3231,_0x400ab4){return client['request'](_0x2cb8af,_0x5a376c)[_0x817f('0xb')](function(_0x193fff){logger[_0x817f('0xc')](_0x817f('0xd'),_0x337ed8,_0x817f('0xe'));logger[_0x817f('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x337ed8,_0x817f('0xe'),JSON['stringify'](_0x193fff));if(_0x193fff[_0x817f('0x10')]){if(_0x193fff[_0x817f('0x10')][_0x817f('0x11')]===0x1f4){logger[_0x817f('0x10')](_0x817f('0xd'),_0x337ed8,_0x193fff[_0x817f('0x10')][_0x817f('0x12')]);return _0x400ab4(_0x193fff[_0x817f('0x10')][_0x817f('0x12')]);}logger[_0x817f('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x337ed8,_0x193fff[_0x817f('0x10')]['message']);return _0x4e3231(_0x193fff[_0x817f('0x10')]['message']);}else{logger['info'](_0x817f('0xd'),_0x337ed8,_0x817f('0xe'));_0x4e3231(_0x193fff[_0x817f('0x13')]['message']);}})[_0x817f('0x14')](function(_0x4ba0a0){logger[_0x817f('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x337ed8,_0x4ba0a0);_0x400ab4(_0x4ba0a0);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 4e8af0e..26cfdb7 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 _0x61a1=['fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0xc5e294,_0x8a5012){var _0x4a86f0=function(_0x39be23){while(--_0x39be23){_0xc5e294['push'](_0xc5e294['shift']());}};_0x4a86f0(++_0x8a5012);}(_0x61a1,0x127));var _0x161a=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0x61a1[_0xed5f9c];return _0x3a1c43;};'use strict';var multer=require(_0x161a('0x0'));var util=require(_0x161a('0x1'));var path=require(_0x161a('0x2'));var timeout=require(_0x161a('0x3'));var express=require(_0x161a('0x4'));var router=express['Router']();var fs_extra=require(_0x161a('0x5'));var auth=require(_0x161a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x161a('0x7'));var controller=require(_0x161a('0x8'));router[_0x161a('0x9')]('/',auth[_0x161a('0xa')](),controller[_0x161a('0xb')]);router[_0x161a('0x9')](_0x161a('0xc'),auth[_0x161a('0xa')](),controller[_0x161a('0xd')]);router[_0x161a('0xe')]('/',auth[_0x161a('0xa')](),controller[_0x161a('0xf')]);router[_0x161a('0x10')](_0x161a('0xc'),auth[_0x161a('0xa')](),controller[_0x161a('0x11')]);router[_0x161a('0x12')](_0x161a('0xc'),auth[_0x161a('0xa')](),controller[_0x161a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2a3a=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path'];(function(_0x47bb19,_0x17a096){var _0x4ef57a=function(_0x9f35cd){while(--_0x9f35cd){_0x47bb19['push'](_0x47bb19['shift']());}};_0x4ef57a(++_0x17a096);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x123310,_0x297fb1){_0x123310=_0x123310-0x0;var _0xee1a1a=_0x2a3a[_0x123310];return _0xee1a1a;};'use strict';var multer=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var path=require(_0xa2a3('0x2'));var timeout=require(_0xa2a3('0x3'));var express=require(_0xa2a3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa2a3('0x5'));var interaction=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var controller=require(_0xa2a3('0x8'));router[_0xa2a3('0x9')]('/',auth[_0xa2a3('0xa')](),controller[_0xa2a3('0xb')]);router['get'](_0xa2a3('0xc'),auth[_0xa2a3('0xa')](),controller[_0xa2a3('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa2a3('0xe')](_0xa2a3('0xc'),auth[_0xa2a3('0xa')](),controller['update']);router[_0xa2a3('0xf')](_0xa2a3('0xc'),auth[_0xa2a3('0xa')](),controller[_0xa2a3('0x10')]);module[_0xa2a3('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index db9d036..30635c7 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 _0xffc1=['name','sequelize','STRING'];(function(_0x3bbe5b,_0xfb4c3e){var _0x1f529d=function(_0x2cfe4a){while(--_0x2cfe4a){_0x3bbe5b['push'](_0x3bbe5b['shift']());}};_0x1f529d(++_0xfb4c3e);}(_0xffc1,0x1b4));var _0x1ffc=function(_0x2947f3,_0x1fabe9){_0x2947f3=_0x2947f3-0x0;var _0x19bf35=_0xffc1[_0x2947f3];return _0x19bf35;};'use strict';var Sequelize=require(_0x1ffc('0x0'));module['exports']={'name':{'type':Sequelize[_0x1ffc('0x1')],'unique':_0x1ffc('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1ffc('0x1')]}}; \ No newline at end of file +var _0x01a3=['STRING','name','sequelize','exports'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x01a3,0x13a));var _0x301a=function(_0x515801,_0x42f55c){_0x515801=_0x515801-0x0;var _0x193e64=_0x01a3[_0x515801];return _0x193e64;};'use strict';var Sequelize=require(_0x301a('0x0'));module[_0x301a('0x1')]={'name':{'type':Sequelize[_0x301a('0x2')],'unique':_0x301a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x301a('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 7156fbf..729faa5 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 _0x2e45=['path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','stack','name','send','index','Variable','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x51be8b,_0x5670b5){var _0x4d5518=function(_0x1e0612){while(--_0x1e0612){_0x51be8b['push'](_0x51be8b['shift']());}};_0x4d5518(++_0x5670b5);}(_0x2e45,0x149));var _0x52e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e45[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x52e4('0x0'));var rimraf=require(_0x52e4('0x1'));var zipdir=require(_0x52e4('0x2'));var jsonpatch=require(_0x52e4('0x3'));var rp=require(_0x52e4('0x4'));var moment=require('moment');var BPromise=require(_0x52e4('0x5'));var Mustache=require(_0x52e4('0x6'));var util=require('util');var path=require(_0x52e4('0x7'));var sox=require(_0x52e4('0x8'));var csv=require(_0x52e4('0x9'));var ejs=require(_0x52e4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x52e4('0xb'));var crypto=require(_0x52e4('0xc'));var jsforce=require(_0x52e4('0xd'));var deskjs=require(_0x52e4('0xe'));var toCsv=require(_0x52e4('0x9'));var querystring=require(_0x52e4('0xf'));var Papa=require(_0x52e4('0x10'));var Redis=require(_0x52e4('0x11'));var authService=require(_0x52e4('0x12'));var qs=require(_0x52e4('0x13'));var as=require(_0x52e4('0x14'));var hardwareService=require(_0x52e4('0x15'));var logger=require(_0x52e4('0x16'))(_0x52e4('0x17'));var utils=require('../../config/utils');var config=require(_0x52e4('0x18'));var licenseUtil=require(_0x52e4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305b42,_0x2b1908){_0x2b1908=_0x2b1908||0xcc;return function(_0x2f4c28){if(_0x2f4c28){return _0x305b42[_0x52e4('0x1a')](_0x2b1908);}return _0x305b42[_0x52e4('0x1b')](_0x2b1908)[_0x52e4('0x1c')]();};}function respondWithResult(_0x4e3da8,_0x3bf2ef){_0x3bf2ef=_0x3bf2ef||0xc8;return function(_0x45deae){if(_0x45deae){return _0x4e3da8['status'](_0x3bf2ef)[_0x52e4('0x1d')](_0x45deae);}};}function respondWithFilteredResult(_0x511a7,_0x27ce08){return function(_0x5e1aac){if(_0x5e1aac){var _0x1b034c=typeof _0x27ce08[_0x52e4('0x1e')]===_0x52e4('0x1f')&&typeof _0x27ce08['limit']==='undefined';var _0x5e58e8=_0x5e1aac['count'];var _0xe1232d=_0x1b034c?0x0:_0x27ce08[_0x52e4('0x1e')];var _0x17622e=_0x1b034c?_0x5e1aac[_0x52e4('0x20')]:_0x27ce08[_0x52e4('0x1e')]+_0x27ce08[_0x52e4('0x21')];var _0x47628b;if(_0x17622e>=_0x5e58e8){_0x17622e=_0x5e58e8;_0x47628b=0xc8;}else{_0x47628b=0xce;}_0x511a7['status'](_0x47628b);return _0x511a7['set'](_0x52e4('0x22'),_0xe1232d+'-'+_0x17622e+'/'+_0x5e58e8)[_0x52e4('0x1d')](_0x5e1aac);}return null;};}function patchUpdates(_0x2ec84d){return function(_0x14b6ad){try{jsonpatch[_0x52e4('0x23')](_0x14b6ad,_0x2ec84d,!![]);}catch(_0x51fc5d){return BPromise[_0x52e4('0x24')](_0x51fc5d);}return _0x14b6ad[_0x52e4('0x25')]();};}function saveUpdates(_0x3c454a,_0x353570){return function(_0x52af28){if(_0x52af28){return _0x52af28[_0x52e4('0x26')](_0x3c454a)['then'](function(_0xf8a13a){return _0xf8a13a;});}return null;};}function removeEntity(_0x3e6dda,_0x2c2139){return function(_0x2f8515){if(_0x2f8515){return _0x2f8515[_0x52e4('0x27')]()[_0x52e4('0x28')](function(){var _0x4cf0c0=_0x2f8515[_0x52e4('0x29')]({'plain':!![]});var _0x5f3c6a=_0x52e4('0x2a');return db[_0x52e4('0x2b')]['destroy']({'where':{'type':_0x5f3c6a,'resourceId':_0x4cf0c0['id']}})[_0x52e4('0x28')](function(){return _0x2f8515;});})['then'](function(){_0x3e6dda[_0x52e4('0x1b')](0xcc)[_0x52e4('0x1c')]();});}};}function handleEntityNotFound(_0x20fbb2,_0x4f50c0){return function(_0x60be5){if(!_0x60be5){_0x20fbb2[_0x52e4('0x1a')](0x194);}return _0x60be5;};}function handleError(_0x3c14c6,_0x26686c){_0x26686c=_0x26686c||0x1f4;return function(_0x1090ca){logger['error'](_0x1090ca[_0x52e4('0x2c')]);if(_0x1090ca['name']){delete _0x1090ca[_0x52e4('0x2d')];}_0x3c14c6['status'](_0x26686c)[_0x52e4('0x2e')](_0x1090ca);};}exports[_0x52e4('0x2f')]=function(_0x4a18de,_0x50c579){var _0x3daf82={},_0x49df2a={},_0x2faddc={'count':0x0,'rows':[]};var _0x47cf92=_['map'](db[_0x52e4('0x30')][_0x52e4('0x31')],function(_0x447b3a){return{'name':_0x447b3a[_0x52e4('0x32')],'type':_0x447b3a['type']['key']};});_0x49df2a[_0x52e4('0x33')]=_[_0x52e4('0x34')](_0x47cf92,_0x52e4('0x2d'));_0x49df2a[_0x52e4('0x35')]=_[_0x52e4('0x36')](_0x4a18de[_0x52e4('0x35')]);_0x49df2a['filters']=_[_0x52e4('0x37')](_0x49df2a['model'],_0x49df2a[_0x52e4('0x35')]);_0x3daf82[_0x52e4('0x38')]=_[_0x52e4('0x37')](_0x49df2a[_0x52e4('0x33')],qs[_0x52e4('0x39')](_0x4a18de[_0x52e4('0x35')][_0x52e4('0x39')]));_0x3daf82[_0x52e4('0x38')]=_0x3daf82[_0x52e4('0x38')][_0x52e4('0x3a')]?_0x3daf82['attributes']:_0x49df2a[_0x52e4('0x33')];if(!_0x4a18de[_0x52e4('0x35')][_0x52e4('0x3b')](_0x52e4('0x3c'))){_0x3daf82['limit']=qs[_0x52e4('0x21')](_0x4a18de['query'][_0x52e4('0x21')]);_0x3daf82['offset']=qs[_0x52e4('0x1e')](_0x4a18de[_0x52e4('0x35')][_0x52e4('0x1e')]);}_0x3daf82[_0x52e4('0x3d')]=qs[_0x52e4('0x3e')](_0x4a18de['query'][_0x52e4('0x3e')]);_0x3daf82[_0x52e4('0x3f')]=qs['filters'](_['pick'](_0x4a18de['query'],_0x49df2a[_0x52e4('0x40')]),_0x47cf92);if(_0x4a18de['query'][_0x52e4('0x41')]){_0x3daf82[_0x52e4('0x3f')]=_[_0x52e4('0x42')](_0x3daf82['where'],{'$or':_[_0x52e4('0x34')](_0x47cf92,function(_0x54d037){if(_0x54d037['type']!==_0x52e4('0x43')){var _0x1371f8={};_0x1371f8[_0x54d037[_0x52e4('0x2d')]]={'$like':'%'+_0x4a18de[_0x52e4('0x35')][_0x52e4('0x41')]+'%'};return _0x1371f8;}})});}_0x3daf82=_['merge']({},_0x3daf82,_0x4a18de['options']);var _0x1402c5={'where':_0x3daf82[_0x52e4('0x3f')]};return db[_0x52e4('0x30')]['count'](_0x1402c5)[_0x52e4('0x28')](function(_0xa29f51){_0x2faddc['count']=_0xa29f51;if(_0x4a18de['query'][_0x52e4('0x44')]){_0x3daf82[_0x52e4('0x45')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x3daf82);})[_0x52e4('0x28')](function(_0x10fdbe){_0x2faddc[_0x52e4('0x46')]=_0x10fdbe;return _0x2faddc;})['then'](respondWithFilteredResult(_0x50c579,_0x3daf82))[_0x52e4('0x47')](handleError(_0x50c579,null));};exports[_0x52e4('0x48')]=function(_0x3d25a8,_0x12f48b){var _0x15fcd7={'raw':!![],'where':{'id':_0x3d25a8['params']['id']}},_0x5b6d44={};_0x5b6d44['model']=_['keys'](db['Variable'][_0x52e4('0x31')]);_0x5b6d44[_0x52e4('0x35')]=_[_0x52e4('0x36')](_0x3d25a8[_0x52e4('0x35')]);_0x5b6d44[_0x52e4('0x40')]=_[_0x52e4('0x37')](_0x5b6d44[_0x52e4('0x33')],_0x5b6d44['query']);_0x15fcd7[_0x52e4('0x38')]=_[_0x52e4('0x37')](_0x5b6d44['model'],qs[_0x52e4('0x39')](_0x3d25a8['query']['fields']));_0x15fcd7[_0x52e4('0x38')]=_0x15fcd7[_0x52e4('0x38')][_0x52e4('0x3a')]?_0x15fcd7[_0x52e4('0x38')]:_0x5b6d44[_0x52e4('0x33')];if(_0x3d25a8[_0x52e4('0x35')][_0x52e4('0x44')]){_0x15fcd7['include']=[{'all':!![]}];}_0x15fcd7=_[_0x52e4('0x42')]({},_0x15fcd7,_0x3d25a8['options']);return db[_0x52e4('0x30')][_0x52e4('0x49')](_0x15fcd7)['then'](handleEntityNotFound(_0x12f48b,null))['then'](respondWithResult(_0x12f48b,null))['catch'](handleError(_0x12f48b,null));};exports['create']=function(_0x41ca06,_0x3ed44a){return db[_0x52e4('0x30')][_0x52e4('0x4a')](_0x41ca06['body'],{})['then'](function(_0x213daf){var _0x4e85ab=_0x41ca06[_0x52e4('0x4b')][_0x52e4('0x29')]({'plain':!![]});if(!_0x4e85ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e85ab[_0x52e4('0x4c')]===_0x52e4('0x4b')){var _0x1af47d=_0x213daf[_0x52e4('0x29')]({'plain':!![]});var _0x48a3f4='Variables';return db[_0x52e4('0x4d')][_0x52e4('0x49')]({'where':{'name':_0x48a3f4,'userProfileId':_0x4e85ab[_0x52e4('0x4e')]},'raw':!![]})['then'](function(_0x52c588){if(_0x52c588&&_0x52c588[_0x52e4('0x4f')]===0x0){return db[_0x52e4('0x2b')]['create']({'name':_0x1af47d[_0x52e4('0x2d')],'resourceId':_0x1af47d['id'],'type':_0x52c588[_0x52e4('0x2d')],'sectionId':_0x52c588['id']},{})['then'](function(){return _0x213daf;});}else{return _0x213daf;}})[_0x52e4('0x47')](function(_0xf57d82){logger[_0x52e4('0x50')](_0x52e4('0x51'),_0xf57d82);throw _0xf57d82;});}return _0x213daf;})['then'](respondWithResult(_0x3ed44a,0xc9))[_0x52e4('0x47')](handleError(_0x3ed44a,null));};exports[_0x52e4('0x26')]=function(_0x5aeacc,_0x548c33){if(_0x5aeacc['body']['id']){delete _0x5aeacc[_0x52e4('0x52')]['id'];}return db[_0x52e4('0x30')][_0x52e4('0x49')]({'where':{'id':_0x5aeacc[_0x52e4('0x53')]['id']}})[_0x52e4('0x28')](handleEntityNotFound(_0x548c33,null))[_0x52e4('0x28')](saveUpdates(_0x5aeacc['body'],null))[_0x52e4('0x28')](respondWithResult(_0x548c33,null))[_0x52e4('0x47')](handleError(_0x548c33,null));};exports['destroy']=function(_0x23a555,_0x550aa1){return db[_0x52e4('0x30')][_0x52e4('0x49')]({'where':{'id':_0x23a555[_0x52e4('0x53')]['id']}})[_0x52e4('0x28')](handleEntityNotFound(_0x550aa1,null))[_0x52e4('0x28')](removeEntity(_0x550aa1,null))[_0x52e4('0x47')](handleError(_0x550aa1,null));}; \ No newline at end of file +var _0xfc9b=['rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','index','Variable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfc9b,0x80));var _0xbfc9=function(_0x476e78,_0x50b5f5){_0x476e78=_0x476e78-0x0;var _0x523292=_0xfc9b[_0x476e78];return _0x523292;};'use strict';var emlformat=require(_0xbfc9('0x0'));var rimraf=require(_0xbfc9('0x1'));var zipdir=require(_0xbfc9('0x2'));var jsonpatch=require(_0xbfc9('0x3'));var rp=require(_0xbfc9('0x4'));var moment=require(_0xbfc9('0x5'));var BPromise=require(_0xbfc9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbfc9('0x7'));var sox=require(_0xbfc9('0x8'));var csv=require(_0xbfc9('0x9'));var ejs=require(_0xbfc9('0xa'));var fs=require('fs');var fs_extra=require(_0xbfc9('0xb'));var _=require(_0xbfc9('0xc'));var squel=require(_0xbfc9('0xd'));var crypto=require('crypto');var jsforce=require(_0xbfc9('0xe'));var deskjs=require(_0xbfc9('0xf'));var toCsv=require(_0xbfc9('0x9'));var querystring=require(_0xbfc9('0x10'));var Papa=require(_0xbfc9('0x11'));var Redis=require(_0xbfc9('0x12'));var authService=require(_0xbfc9('0x13'));var qs=require(_0xbfc9('0x14'));var as=require(_0xbfc9('0x15'));var hardwareService=require(_0xbfc9('0x16'));var logger=require(_0xbfc9('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xbfc9('0x18'));var licenseUtil=require(_0xbfc9('0x19'));var db=require(_0xbfc9('0x1a'))['db'];function respondWithStatusCode(_0xdacc07,_0x197054){_0x197054=_0x197054||0xcc;return function(_0x33d611){if(_0x33d611){return _0xdacc07[_0xbfc9('0x1b')](_0x197054);}return _0xdacc07[_0xbfc9('0x1c')](_0x197054)[_0xbfc9('0x1d')]();};}function respondWithResult(_0x1661e2,_0x31d0f5){_0x31d0f5=_0x31d0f5||0xc8;return function(_0x164575){if(_0x164575){return _0x1661e2[_0xbfc9('0x1c')](_0x31d0f5)[_0xbfc9('0x1e')](_0x164575);}};}function respondWithFilteredResult(_0x8528f2,_0x4b42e5){return function(_0x3ee3ff){if(_0x3ee3ff){var _0x1892d2=typeof _0x4b42e5['offset']==='undefined'&&typeof _0x4b42e5[_0xbfc9('0x1f')]==='undefined';var _0x5313ef=_0x3ee3ff['count'];var _0x2864bc=_0x1892d2?0x0:_0x4b42e5['offset'];var _0x3a0495=_0x1892d2?_0x3ee3ff[_0xbfc9('0x20')]:_0x4b42e5[_0xbfc9('0x21')]+_0x4b42e5[_0xbfc9('0x1f')];var _0x1bc60e;if(_0x3a0495>=_0x5313ef){_0x3a0495=_0x5313ef;_0x1bc60e=0xc8;}else{_0x1bc60e=0xce;}_0x8528f2[_0xbfc9('0x1c')](_0x1bc60e);return _0x8528f2[_0xbfc9('0x22')](_0xbfc9('0x23'),_0x2864bc+'-'+_0x3a0495+'/'+_0x5313ef)['json'](_0x3ee3ff);}return null;};}function patchUpdates(_0x489c18){return function(_0x268d82){try{jsonpatch[_0xbfc9('0x24')](_0x268d82,_0x489c18,!![]);}catch(_0x430127){return BPromise[_0xbfc9('0x25')](_0x430127);}return _0x268d82[_0xbfc9('0x26')]();};}function saveUpdates(_0x4dad88,_0x53b120){return function(_0x5db6e7){if(_0x5db6e7){return _0x5db6e7['update'](_0x4dad88)['then'](function(_0x1ef89c){return _0x1ef89c;});}return null;};}function removeEntity(_0x4b9308,_0x1c3bc7){return function(_0x3f1c99){if(_0x3f1c99){return _0x3f1c99[_0xbfc9('0x27')]()[_0xbfc9('0x28')](function(){var _0x2c2ffc=_0x3f1c99[_0xbfc9('0x29')]({'plain':!![]});var _0x271e8e=_0xbfc9('0x2a');return db[_0xbfc9('0x2b')][_0xbfc9('0x27')]({'where':{'type':_0x271e8e,'resourceId':_0x2c2ffc['id']}})['then'](function(){return _0x3f1c99;});})[_0xbfc9('0x28')](function(){_0x4b9308[_0xbfc9('0x1c')](0xcc)[_0xbfc9('0x1d')]();});}};}function handleEntityNotFound(_0x40b2ba,_0x3ed551){return function(_0xd411eb){if(!_0xd411eb){_0x40b2ba[_0xbfc9('0x1b')](0x194);}return _0xd411eb;};}function handleError(_0x4743ae,_0x25258a){_0x25258a=_0x25258a||0x1f4;return function(_0x47bf38){logger[_0xbfc9('0x2c')](_0x47bf38[_0xbfc9('0x2d')]);if(_0x47bf38[_0xbfc9('0x2e')]){delete _0x47bf38['name'];}_0x4743ae[_0xbfc9('0x1c')](_0x25258a)[_0xbfc9('0x2f')](_0x47bf38);};}exports[_0xbfc9('0x30')]=function(_0x5db001,_0x249fc3){var _0x27e91d={},_0x2db94b={},_0x41aad2={'count':0x0,'rows':[]};var _0x33e291=_['map'](db[_0xbfc9('0x31')][_0xbfc9('0x32')],function(_0x575fb6){return{'name':_0x575fb6['fieldName'],'type':_0x575fb6[_0xbfc9('0x33')][_0xbfc9('0x34')]};});_0x2db94b[_0xbfc9('0x35')]=_['map'](_0x33e291,_0xbfc9('0x2e'));_0x2db94b['query']=_[_0xbfc9('0x36')](_0x5db001['query']);_0x2db94b[_0xbfc9('0x37')]=_[_0xbfc9('0x38')](_0x2db94b[_0xbfc9('0x35')],_0x2db94b[_0xbfc9('0x39')]);_0x27e91d[_0xbfc9('0x3a')]=_[_0xbfc9('0x38')](_0x2db94b[_0xbfc9('0x35')],qs[_0xbfc9('0x3b')](_0x5db001[_0xbfc9('0x39')]['fields']));_0x27e91d[_0xbfc9('0x3a')]=_0x27e91d[_0xbfc9('0x3a')][_0xbfc9('0x3c')]?_0x27e91d['attributes']:_0x2db94b[_0xbfc9('0x35')];if(!_0x5db001[_0xbfc9('0x39')][_0xbfc9('0x3d')](_0xbfc9('0x3e'))){_0x27e91d[_0xbfc9('0x1f')]=qs[_0xbfc9('0x1f')](_0x5db001[_0xbfc9('0x39')][_0xbfc9('0x1f')]);_0x27e91d[_0xbfc9('0x21')]=qs[_0xbfc9('0x21')](_0x5db001[_0xbfc9('0x39')][_0xbfc9('0x21')]);}_0x27e91d[_0xbfc9('0x3f')]=qs[_0xbfc9('0x40')](_0x5db001[_0xbfc9('0x39')][_0xbfc9('0x40')]);_0x27e91d[_0xbfc9('0x41')]=qs['filters'](_[_0xbfc9('0x42')](_0x5db001[_0xbfc9('0x39')],_0x2db94b[_0xbfc9('0x37')]),_0x33e291);if(_0x5db001[_0xbfc9('0x39')][_0xbfc9('0x43')]){_0x27e91d['where']=_[_0xbfc9('0x44')](_0x27e91d[_0xbfc9('0x41')],{'$or':_[_0xbfc9('0x45')](_0x33e291,function(_0x519ce0){if(_0x519ce0[_0xbfc9('0x33')]!=='VIRTUAL'){var _0x588192={};_0x588192[_0x519ce0['name']]={'$like':'%'+_0x5db001['query'][_0xbfc9('0x43')]+'%'};return _0x588192;}})});}_0x27e91d=_['merge']({},_0x27e91d,_0x5db001[_0xbfc9('0x46')]);var _0x5baf31={'where':_0x27e91d['where']};return db['Variable'][_0xbfc9('0x20')](_0x5baf31)[_0xbfc9('0x28')](function(_0x190c81){_0x41aad2['count']=_0x190c81;if(_0x5db001[_0xbfc9('0x39')][_0xbfc9('0x47')]){_0x27e91d[_0xbfc9('0x48')]=[{'all':!![]}];}return db[_0xbfc9('0x31')][_0xbfc9('0x49')](_0x27e91d);})['then'](function(_0x1024b0){_0x41aad2[_0xbfc9('0x4a')]=_0x1024b0;return _0x41aad2;})[_0xbfc9('0x28')](respondWithFilteredResult(_0x249fc3,_0x27e91d))[_0xbfc9('0x4b')](handleError(_0x249fc3,null));};exports[_0xbfc9('0x4c')]=function(_0x4dae16,_0x29c5f7){var _0x2e0756={'raw':!![],'where':{'id':_0x4dae16[_0xbfc9('0x4d')]['id']}},_0x1f1a90={};_0x1f1a90['model']=_[_0xbfc9('0x36')](db[_0xbfc9('0x31')][_0xbfc9('0x32')]);_0x1f1a90['query']=_['keys'](_0x4dae16['query']);_0x1f1a90[_0xbfc9('0x37')]=_[_0xbfc9('0x38')](_0x1f1a90['model'],_0x1f1a90[_0xbfc9('0x39')]);_0x2e0756[_0xbfc9('0x3a')]=_[_0xbfc9('0x38')](_0x1f1a90[_0xbfc9('0x35')],qs[_0xbfc9('0x3b')](_0x4dae16[_0xbfc9('0x39')][_0xbfc9('0x3b')]));_0x2e0756[_0xbfc9('0x3a')]=_0x2e0756['attributes'][_0xbfc9('0x3c')]?_0x2e0756[_0xbfc9('0x3a')]:_0x1f1a90['model'];if(_0x4dae16[_0xbfc9('0x39')][_0xbfc9('0x47')]){_0x2e0756['include']=[{'all':!![]}];}_0x2e0756=_[_0xbfc9('0x44')]({},_0x2e0756,_0x4dae16[_0xbfc9('0x46')]);return db[_0xbfc9('0x31')][_0xbfc9('0x4e')](_0x2e0756)['then'](handleEntityNotFound(_0x29c5f7,null))[_0xbfc9('0x28')](respondWithResult(_0x29c5f7,null))['catch'](handleError(_0x29c5f7,null));};exports[_0xbfc9('0x4f')]=function(_0x7210cf,_0x33f03b){return db[_0xbfc9('0x31')][_0xbfc9('0x4f')](_0x7210cf['body'],{})['then'](function(_0x4def8e){var _0x432675=_0x7210cf[_0xbfc9('0x50')]['get']({'plain':!![]});if(!_0x432675)throw new Error(_0xbfc9('0x51'));if(_0x432675[_0xbfc9('0x52')]===_0xbfc9('0x50')){var _0xf3309c=_0x4def8e[_0xbfc9('0x29')]({'plain':!![]});var _0x4f0c2d=_0xbfc9('0x2a');return db[_0xbfc9('0x53')][_0xbfc9('0x4e')]({'where':{'name':_0x4f0c2d,'userProfileId':_0x432675[_0xbfc9('0x54')]},'raw':!![]})[_0xbfc9('0x28')](function(_0x2e6ef8){if(_0x2e6ef8&&_0x2e6ef8[_0xbfc9('0x55')]===0x0){return db[_0xbfc9('0x2b')][_0xbfc9('0x4f')]({'name':_0xf3309c['name'],'resourceId':_0xf3309c['id'],'type':_0x2e6ef8[_0xbfc9('0x2e')],'sectionId':_0x2e6ef8['id']},{})['then'](function(){return _0x4def8e;});}else{return _0x4def8e;}})[_0xbfc9('0x4b')](function(_0x401355){logger['error'](_0xbfc9('0x56'),_0x401355);throw _0x401355;});}return _0x4def8e;})[_0xbfc9('0x28')](respondWithResult(_0x33f03b,0xc9))[_0xbfc9('0x4b')](handleError(_0x33f03b,null));};exports[_0xbfc9('0x57')]=function(_0x570e54,_0x4601aa){if(_0x570e54[_0xbfc9('0x58')]['id']){delete _0x570e54['body']['id'];}return db[_0xbfc9('0x31')][_0xbfc9('0x4e')]({'where':{'id':_0x570e54[_0xbfc9('0x4d')]['id']}})[_0xbfc9('0x28')](handleEntityNotFound(_0x4601aa,null))[_0xbfc9('0x28')](saveUpdates(_0x570e54[_0xbfc9('0x58')],null))[_0xbfc9('0x28')](respondWithResult(_0x4601aa,null))['catch'](handleError(_0x4601aa,null));};exports[_0xbfc9('0x27')]=function(_0x25eb29,_0x14442f){return db['Variable'][_0xbfc9('0x4e')]({'where':{'id':_0x25eb29['params']['id']}})[_0xbfc9('0x28')](handleEntityNotFound(_0x14442f,null))['then'](removeEntity(_0x14442f,null))['catch'](handleError(_0x14442f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 4957fa6..a6caa70 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 _0xb5a3=['define','Variable','tools_variables','util','api','moment','bluebird','path','rimraf','exports'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb5a3,0x111));var _0x3b5a=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0xb5a3[_0x418549];return _0x288826;};'use strict';var _=require('lodash');var util=require(_0x3b5a('0x0'));var logger=require('../../config/logger')(_0x3b5a('0x1'));var moment=require(_0x3b5a('0x2'));var BPromise=require(_0x3b5a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b5a('0x4'));var rimraf=require(_0x3b5a('0x5'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x3b5a('0x6')]=function(_0x3c5bfb,_0x1af818){return _0x3c5bfb[_0x3b5a('0x7')](_0x3b5a('0x8'),attributes,{'tableName':_0x3b5a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb270=['request-promise','rimraf','../../config/environment','define','Variable','tools_variables','lodash','api'];(function(_0x4de79b,_0x555d01){var _0x2afab1=function(_0xdf94f1){while(--_0xdf94f1){_0x4de79b['push'](_0x4de79b['shift']());}};_0x2afab1(++_0x555d01);}(_0xb270,0x146));var _0x0b27=function(_0x1b8d1c,_0x395b3b){_0x1b8d1c=_0x1b8d1c-0x0;var _0x159a0b=_0xb270[_0x1b8d1c];return _0x159a0b;};'use strict';var _=require(_0x0b27('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0b27('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b27('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b27('0x3'));var config=require(_0x0b27('0x4'));var attributes=require('./variable.attributes');module['exports']=function(_0x299bdf,_0x7cae92){return _0x299bdf[_0x0b27('0x5')](_0x0b27('0x6'),attributes,{'tableName':_0x0b27('0x7'),'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 d534704..9508268 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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x2c59fd,_0x48cec3){var _0x3258e8=function(_0x5cdd50){while(--_0x5cdd50){_0x2c59fd['push'](_0x2c59fd['shift']());}};_0x3258e8(++_0x48cec3);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0xb93836,_0x2e7941){var _0x2b3e5b=function(_0x56d0a4){while(--_0x56d0a4){_0xb93836['push'](_0xb93836['shift']());}};_0x2b3e5b(++_0x2e7941);}(_0x55ca,0x126));var _0xa55c=function(_0xfcdda0,_0x32479b){_0xfcdda0=_0xfcdda0-0x0;var _0x17ebe3=_0x55ca[_0xfcdda0];return _0x17ebe3;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f36fe64..8b4e48d 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 _0xcb93=['isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0xa61fd8,_0x17b182){var _0x49d410=function(_0x48fadb){while(--_0x48fadb){_0xa61fd8['push'](_0xa61fd8['shift']());}};_0x49d410(++_0x17b182);}(_0xcb93,0x1c4));var _0x3cb9=function(_0x38b4b8,_0x52ee16){_0x38b4b8=_0x38b4b8-0x0;var _0x39db0e=_0xcb93[_0x38b4b8];return _0x39db0e;};'use strict';var express=require(_0x3cb9('0x0'));var router=express[_0x3cb9('0x1')]();var auth=require(_0x3cb9('0x2'));var controller=require(_0x3cb9('0x3'));router[_0x3cb9('0x4')]('/',controller[_0x3cb9('0x5')]);router[_0x3cb9('0x4')](_0x3cb9('0x6'),auth[_0x3cb9('0x7')](),auth[_0x3cb9('0x8')](),controller[_0x3cb9('0x9')]);router[_0x3cb9('0x4')](_0x3cb9('0xa'),auth[_0x3cb9('0x7')](),auth['canUpdate'](),controller[_0x3cb9('0xb')]);router[_0x3cb9('0x4')]('/pull',auth[_0x3cb9('0x7')](),auth[_0x3cb9('0x8')](),controller[_0x3cb9('0xc')]);router[_0x3cb9('0x4')](_0x3cb9('0xd'),auth['isAuthenticated'](),controller[_0x3cb9('0xe')]);router[_0x3cb9('0x4')](_0x3cb9('0xf'),controller['migrations']);module[_0x3cb9('0x10')]=router; \ No newline at end of file +var _0x5643=['Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','/restart','migrations','express'];(function(_0x47ee44,_0x1c121d){var _0xaef8c3=function(_0x21373b){while(--_0x21373b){_0x47ee44['push'](_0x47ee44['shift']());}};_0xaef8c3(++_0x1c121d);}(_0x5643,0x1bf));var _0x3564=function(_0xfeea7f,_0x1b5760){_0xfeea7f=_0xfeea7f-0x0;var _0x1f2ec9=_0x5643[_0xfeea7f];return _0x1f2ec9;};'use strict';var express=require(_0x3564('0x0'));var router=express[_0x3564('0x1')]();var auth=require(_0x3564('0x2'));var controller=require(_0x3564('0x3'));router[_0x3564('0x4')]('/',controller[_0x3564('0x5')]);router[_0x3564('0x4')](_0x3564('0x6'),auth[_0x3564('0x7')](),auth['canUpdate'](),controller[_0x3564('0x8')]);router[_0x3564('0x4')](_0x3564('0x9'),auth[_0x3564('0x7')](),auth[_0x3564('0xa')](),controller[_0x3564('0xb')]);router[_0x3564('0x4')](_0x3564('0xc'),auth[_0x3564('0x7')](),auth['canUpdate'](),controller[_0x3564('0xd')]);router[_0x3564('0x4')](_0x3564('0xe'),auth['isAuthenticated'](),controller['restart']);router[_0x3564('0x4')]('/migrations',controller[_0x3564('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8f7703f..23df430 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 _0x6f0e=['simple-git','root','exports','query','latest','fetch','tags','2.0.0','json','status','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','umzug','path','lodash','pkginfo','version','child_process','exec','../../config/pm2','../../config/logger','update'];(function(_0x5bcafc,_0x322f20){var _0x57c9f2=function(_0x115a27){while(--_0x115a27){_0x5bcafc['push'](_0x5bcafc['shift']());}};_0x57c9f2(++_0x322f20);}(_0x6f0e,0xa1));var _0xe6f0=function(_0x4a5a60,_0x4dd8a4){_0x4a5a60=_0x4a5a60-0x0;var _0x5ed5b3=_0x6f0e[_0x4a5a60];return _0x5ed5b3;};'use strict';var Umzug=require(_0xe6f0('0x0'));var path=require(_0xe6f0('0x1'));var fs=require('fs');var _=require(_0xe6f0('0x2'));var pkginfo=require(_0xe6f0('0x3'))(module,_0xe6f0('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xe6f0('0x5'))[_0xe6f0('0x6')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xe6f0('0x7'));var logger=require(_0xe6f0('0x8'))(_0xe6f0('0x9'));var git=require(_0xe6f0('0xa'))(config[_0xe6f0('0xb')]);exports['index']=function(_0x41292e,_0x232c93){var _0x5d9d68={'current':module[_0xe6f0('0xc')][_0xe6f0('0x4')],'phonebar':0x2};if(_0x41292e[_0xe6f0('0xd')]&&_0x41292e[_0xe6f0('0xd')][_0xe6f0('0xe')]){return git[_0xe6f0('0xf')]()[_0xe6f0('0x10')](function(_0x3f4207,_0x1ab712){_0x5d9d68['latest']=(_0x3f4207?module[_0xe6f0('0xc')][_0xe6f0('0x4')]:_0x1ab712[_0xe6f0('0xe')])||_0xe6f0('0x11');return _0x232c93['status'](0xc8)[_0xe6f0('0x12')](_0x5d9d68);});}else{return _0x232c93[_0xe6f0('0x13')](0xc8)[_0xe6f0('0x12')](_0x5d9d68);}};exports['fetch']=function(_0x2f794d,_0x4adcbf){return git[_0xe6f0('0xf')]([_0xe6f0('0x14'),_0xe6f0('0x15')],function(_0x228f6c){if(_0x228f6c){logger[_0xe6f0('0x16')](_0x228f6c);return _0x4adcbf[_0xe6f0('0x13')](0x1f4)[_0xe6f0('0x12')](_0x228f6c);}logger[_0xe6f0('0x17')](_0xe6f0('0x18'));return _0x4adcbf[_0xe6f0('0x13')](0xc8)['json']({'output':_0xe6f0('0x19')});});};exports[_0xe6f0('0x1a')]=function(_0x3451b8,_0x4ed380){return git[_0xe6f0('0x1a')]([_0xe6f0('0x1b'),_0xe6f0('0x1c')],function(_0x59a649){if(_0x59a649){logger['error'](_0x59a649);return _0x4ed380[_0xe6f0('0x13')](0x1f4)[_0xe6f0('0x12')](_0x59a649);}logger[_0xe6f0('0x17')](_0xe6f0('0x1d'));return _0x4ed380['status'](0xc8)[_0xe6f0('0x12')]({'output':_0xe6f0('0x1e')});});};exports['pull']=function(_0xadc895,_0x19e1d5){exec(_0xe6f0('0x1f'),function(_0x3956b1,_0x5d8ab7,_0x5aa4fa){logger[_0xe6f0('0x17')](_0x5d8ab7);logger['info'](_0x5aa4fa);if(_0x3956b1){logger[_0xe6f0('0x16')](_0x3956b1);return _0x19e1d5[_0xe6f0('0x13')](0x1f4)[_0xe6f0('0x12')](_0x3956b1);}return _0x19e1d5[_0xe6f0('0x13')](0xc8)['json']({'output':_0x5d8ab7});});};exports[_0xe6f0('0x20')]=function(_0x7c6289,_0x450e69){return pm2[_0xe6f0('0x20')](_0xe6f0('0x21'))['then'](function(_0x536ec1){logger['info'](_0xe6f0('0x22'),_0x536ec1);return _0x450e69['status'](0xc8)['json']({'output':_0xe6f0('0x23')});})[_0xe6f0('0x24')](function(_0x1de9ef){logger[_0xe6f0('0x16')](_0x1de9ef);return _0x450e69[_0xe6f0('0x13')](0x1f4)['json'](_0x1de9ef);});};exports['migrations']=function(_0xe20fe5,_0x5caaa9){var _0xd67c17=fs[_0xe6f0('0x25')](path[_0xe6f0('0x26')](config[_0xe6f0('0xb')],_0xe6f0('0x27'),_0xe6f0('0x28')));var _0xb0dabf=[];for(var _0x2c441f=0x0;_0x2c441f<_0xd67c17['length'];_0x2c441f++){var _0x349fda=_0xd67c17[_0x2c441f][_0xe6f0('0x29')](_0xe6f0('0x2a'),'');if(compareVersions(module['exports'][_0xe6f0('0x4')],_0x349fda)===-0x1){_0xb0dabf[_0xe6f0('0x2b')](_0x349fda);}}if(_0xb0dabf[_0xe6f0('0x2c')]){var _0x38e910=_0xb0dabf[_0xe6f0('0x2d')](compareVersions);var _0x3876c7=new Umzug({'storage':_0xe6f0('0x2e'),'storageOptions':{'model':db['Migration'],'modelName':_0xe6f0('0x2f'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0xe6f0('0x30')](),db['sequelize'][_0xe6f0('0x31')],function(){throw new Error(_0xe6f0('0x32'));}],'path':path[_0xe6f0('0x26')](config[_0xe6f0('0xb')],'server',_0xe6f0('0x28')),'pattern':/\.js$/}});_0x3876c7['up']({'migrations':_[_0xe6f0('0x33')](_0x38e910,function(_0x3b62fa){return _0x3b62fa+_0xe6f0('0x2a');})})[_0xe6f0('0x34')](function(){return _0x5caaa9[_0xe6f0('0x13')](0xc8)[_0xe6f0('0x12')]({'output':_0xe6f0('0x35')+module[_0xe6f0('0xc')][_0xe6f0('0x4')]+_0xe6f0('0x36')+_[_0xe6f0('0x37')](_0x38e910),'migrations':_[_0xe6f0('0x26')](_0x38e910)});})[_0xe6f0('0x24')](function(_0x304eaf){if(_0x304eaf instanceof db['sequelize'][_0xe6f0('0x38')]){return _0x5caaa9[_0xe6f0('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x5caaa9[_0xe6f0('0x13')](0x1f4)['json'](_0x304eaf);}});}else{return _0x5caaa9[_0xe6f0('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xbde9=['../../config/logger','update','simple-git','version','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','root','server','migrations','length','replace','.js','exports','push','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','compare-versions','child_process','../../config/environment','../../config/pm2'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xbde9,0x1a1));var _0x9bde=function(_0x5aca5d,_0x3cb8a4){_0x5aca5d=_0x5aca5d-0x0;var _0x2d8b86=_0xbde9[_0x5aca5d];return _0x2d8b86;};'use strict';var Umzug=require('umzug');var path=require(_0x9bde('0x0'));var fs=require('fs');var _=require(_0x9bde('0x1'));var pkginfo=require(_0x9bde('0x2'))(module,'version');var compareVersions=require(_0x9bde('0x3'));var exec=require(_0x9bde('0x4'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x9bde('0x5'));var pm2=require(_0x9bde('0x6'));var logger=require(_0x9bde('0x7'))(_0x9bde('0x8'));var git=require(_0x9bde('0x9'))(config['root']);exports['index']=function(_0x2a0eb8,_0xa98402){var _0x5f63f4={'current':module['exports'][_0x9bde('0xa')],'phonebar':0x2};if(_0x2a0eb8[_0x9bde('0xb')]&&_0x2a0eb8[_0x9bde('0xb')][_0x9bde('0xc')]){return git[_0x9bde('0xd')]()[_0x9bde('0xe')](function(_0x5a4d8b,_0x5960b0){_0x5f63f4[_0x9bde('0xc')]=(_0x5a4d8b?module['exports'][_0x9bde('0xa')]:_0x5960b0['latest'])||_0x9bde('0xf');return _0xa98402[_0x9bde('0x10')](0xc8)[_0x9bde('0x11')](_0x5f63f4);});}else{return _0xa98402[_0x9bde('0x10')](0xc8)[_0x9bde('0x11')](_0x5f63f4);}};exports[_0x9bde('0xd')]=function(_0x251bff,_0x2bfccf){return git[_0x9bde('0xd')]([_0x9bde('0x12'),_0x9bde('0x13')],function(_0x1f1bbb){if(_0x1f1bbb){logger[_0x9bde('0x14')](_0x1f1bbb);return _0x2bfccf[_0x9bde('0x10')](0x1f4)['json'](_0x1f1bbb);}logger[_0x9bde('0x15')]('git\x20fetch');return _0x2bfccf[_0x9bde('0x10')](0xc8)[_0x9bde('0x11')]({'output':_0x9bde('0x16')});});};exports[_0x9bde('0x17')]=function(_0x4063bd,_0x21437d){return git[_0x9bde('0x17')]([_0x9bde('0x18'),_0x9bde('0x19')],function(_0x595eed){if(_0x595eed){logger[_0x9bde('0x14')](_0x595eed);return _0x21437d[_0x9bde('0x10')](0x1f4)[_0x9bde('0x11')](_0x595eed);}logger[_0x9bde('0x15')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x21437d[_0x9bde('0x10')](0xc8)[_0x9bde('0x11')]({'output':_0x9bde('0x1a')});});};exports[_0x9bde('0x1b')]=function(_0x442feb,_0x34c1ab){exec(_0x9bde('0x1c'),function(_0x18d35,_0x1258ec,_0x442881){logger['info'](_0x1258ec);logger['info'](_0x442881);if(_0x18d35){logger['error'](_0x18d35);return _0x34c1ab[_0x9bde('0x10')](0x1f4)['json'](_0x18d35);}return _0x34c1ab['status'](0xc8)[_0x9bde('0x11')]({'output':_0x1258ec});});};exports[_0x9bde('0x1d')]=function(_0x3f614f,_0x21b92a){return pm2[_0x9bde('0x1d')](_0x9bde('0x1e'))[_0x9bde('0x1f')](function(_0x5bd03b){logger[_0x9bde('0x15')]('pm2\x20restart\x20motion\x20%s',_0x5bd03b);return _0x21b92a[_0x9bde('0x10')](0xc8)[_0x9bde('0x11')]({'output':_0x9bde('0x20')});})['catch'](function(_0x318c48){logger['error'](_0x318c48);return _0x21b92a['status'](0x1f4)[_0x9bde('0x11')](_0x318c48);});};exports['migrations']=function(_0x531fd9,_0x12c979){var _0x236056=fs[_0x9bde('0x21')](path['join'](config[_0x9bde('0x22')],_0x9bde('0x23'),_0x9bde('0x24')));var _0x19b741=[];for(var _0xce593e=0x0;_0xce593e<_0x236056[_0x9bde('0x25')];_0xce593e++){var _0x43a611=_0x236056[_0xce593e][_0x9bde('0x26')](_0x9bde('0x27'),'');if(compareVersions(module[_0x9bde('0x28')]['version'],_0x43a611)===-0x1){_0x19b741[_0x9bde('0x29')](_0x43a611);}}if(_0x19b741[_0x9bde('0x25')]){var _0x5ce54f=_0x19b741['sort'](compareVersions);var _0x5f44b9=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x9bde('0x2a')],'modelName':_0x9bde('0x2a'),'columnName':_0x9bde('0xa')},'migrations':{'params':[db[_0x9bde('0x2b')][_0x9bde('0x2c')](),db[_0x9bde('0x2b')][_0x9bde('0x2d')],function(){throw new Error(_0x9bde('0x2e'));}],'path':path[_0x9bde('0x2f')](config[_0x9bde('0x22')],_0x9bde('0x23'),_0x9bde('0x24')),'pattern':/\.js$/}});_0x5f44b9['up']({'migrations':_['map'](_0x5ce54f,function(_0x1e6930){return _0x1e6930+_0x9bde('0x27');})})['then'](function(){return _0x12c979[_0x9bde('0x10')](0xc8)[_0x9bde('0x11')]({'output':_0x9bde('0x30')+module[_0x9bde('0x28')][_0x9bde('0xa')]+_0x9bde('0x31')+_[_0x9bde('0x32')](_0x5ce54f),'migrations':_[_0x9bde('0x2f')](_0x5ce54f)});})['catch'](function(_0x17af94){if(_0x17af94 instanceof db[_0x9bde('0x2b')][_0x9bde('0x33')]){return _0x12c979[_0x9bde('0x10')](0xc8)['json']({'output':_0x9bde('0x34')});}else{return _0x12c979['status'](0x1f4)[_0x9bde('0x11')](_0x17af94);}});}else{return _0x12c979[_0x9bde('0x10')](0xc8)[_0x9bde('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ff8580e..2835c10 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 _0x6a49=['multer','util','express','Router','fs-extra','get','isAuthenticated','index','describe','/:id','show','post','update','exports'];(function(_0x5efd67,_0xac2b40){var _0x1bc565=function(_0x1f166c){while(--_0x1f166c){_0x5efd67['push'](_0x5efd67['shift']());}};_0x1bc565(++_0xac2b40);}(_0x6a49,0xb6));var _0x96a4=function(_0x34e250,_0x2ef7fb){_0x34e250=_0x34e250-0x0;var _0x26ef2b=_0x6a49[_0x34e250];return _0x26ef2b;};'use strict';var multer=require(_0x96a4('0x0'));var util=require(_0x96a4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x96a4('0x2'));var router=express[_0x96a4('0x3')]();var fs_extra=require(_0x96a4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x96a4('0x5')]('/',auth[_0x96a4('0x6')](),controller[_0x96a4('0x7')]);router[_0x96a4('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x96a4('0x8')]);router['get'](_0x96a4('0x9'),auth[_0x96a4('0x6')](),controller[_0x96a4('0xa')]);router[_0x96a4('0xb')]('/',auth[_0x96a4('0x6')](),controller['create']);router['put'](_0x96a4('0x9'),auth[_0x96a4('0x6')](),controller[_0x96a4('0xc')]);router['delete']('/:id',auth[_0x96a4('0x6')](),controller['destroy']);module[_0x96a4('0xd')]=router; \ No newline at end of file +var _0x3295=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xe65ba1,_0x3d97f9){var _0x26dfad=function(_0x5adbbc){while(--_0x5adbbc){_0xe65ba1['push'](_0xe65ba1['shift']());}};_0x26dfad(++_0x3d97f9);}(_0x3295,0x1b1));var _0x5329=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x3295[_0xbb9dbf];return _0x30223c;};'use strict';var multer=require(_0x5329('0x0'));var util=require(_0x5329('0x1'));var path=require(_0x5329('0x2'));var timeout=require(_0x5329('0x3'));var express=require(_0x5329('0x4'));var router=express[_0x5329('0x5')]();var fs_extra=require(_0x5329('0x6'));var auth=require(_0x5329('0x7'));var interaction=require(_0x5329('0x8'));var config=require(_0x5329('0x9'));var controller=require('./voiceAgentReport.controller');router[_0x5329('0xa')]('/',auth[_0x5329('0xb')](),controller[_0x5329('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x5329('0xd')]);router['get'](_0x5329('0xe'),auth['isAuthenticated'](),controller[_0x5329('0xf')]);router[_0x5329('0x10')]('/',auth[_0x5329('0xb')](),controller[_0x5329('0x11')]);router[_0x5329('0x12')](_0x5329('0xe'),auth[_0x5329('0xb')](),controller[_0x5329('0x13')]);router[_0x5329('0x14')](_0x5329('0xe'),auth[_0x5329('0xb')](),controller[_0x5329('0x15')]);module[_0x5329('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 6dd68e4..3fcfc91 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 _0x8cda=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x33f1a3,_0x1557a5){var _0x1f3d03=function(_0xfc6e8b){while(--_0xfc6e8b){_0x33f1a3['push'](_0x33f1a3['shift']());}};_0x1f3d03(++_0x1557a5);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xa8cd('0x0')]={'type':{'type':Sequelize[_0xa8cd('0x1')]},'uniqueid':{'type':Sequelize[_0xa8cd('0x1')]},'calleridnum':{'type':Sequelize[_0xa8cd('0x1')]},'calleridname':{'type':Sequelize[_0xa8cd('0x1')]},'queue':{'type':Sequelize[_0xa8cd('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa8cd('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa8cd('0x2')]},'agentconnectAt':{'type':Sequelize[_0xa8cd('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xa8cd('0x2')]},'agentdumpAt':{'type':Sequelize[_0xa8cd('0x2')]},'holdtime':{'type':Sequelize[_0xa8cd('0x3')]},'agentcomplete':{'type':Sequelize[_0xa8cd('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa8cd('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa8cd('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa8cd('0x3')]},'agentacw':{'type':Sequelize[_0xa8cd('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa8cd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa8cd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa8cd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa8cd('0x1')]},'accountcode':{'type':Sequelize[_0xa8cd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa8cd('0x1')]},'destchannel':{'type':Sequelize[_0xa8cd('0x1')]},'destchannelstate':{'type':Sequelize[_0xa8cd('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xa8cd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa8cd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa8cd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xa8cd('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa8cd('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa8cd('0x1')]},'destuniqueid':{'type':Sequelize[_0xa8cd('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa8cd('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa8cd('0x1')],'comment':_0xa8cd('0x5')},'transferexten':{'type':Sequelize[_0xa8cd('0x1')]},'transferuniqueid':{'type':Sequelize[_0xa8cd('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x96f2=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','INTEGER'];(function(_0x28d271,_0x1422be){var _0x145897=function(_0xfe84b0){while(--_0xfe84b0){_0x28d271['push'](_0x28d271['shift']());}};_0x145897(++_0x1422be);}(_0x96f2,0xb0));var _0x296f=function(_0x80228,_0x4adfaa){_0x80228=_0x80228-0x0;var _0x4f4ba5=_0x96f2[_0x80228];return _0x4f4ba5;};'use strict';var Sequelize=require(_0x296f('0x0'));module['exports']={'type':{'type':Sequelize[_0x296f('0x1')]},'uniqueid':{'type':Sequelize[_0x296f('0x1')]},'calleridnum':{'type':Sequelize[_0x296f('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x296f('0x1')]},'interface':{'type':Sequelize[_0x296f('0x1')]},'membername':{'type':Sequelize[_0x296f('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x296f('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x296f('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x296f('0x3')]},'agentcomplete':{'type':Sequelize[_0x296f('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x296f('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x296f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x296f('0x3')]},'agentacw':{'type':Sequelize[_0x296f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x296f('0x3')]},'reason':{'type':Sequelize[_0x296f('0x1')]},'lastevent':{'type':Sequelize[_0x296f('0x1')]},'channel':{'type':Sequelize[_0x296f('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x296f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x296f('0x1')]},'connectedlinename':{'type':Sequelize[_0x296f('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x296f('0x1')]},'context':{'type':Sequelize[_0x296f('0x1')]},'exten':{'type':Sequelize[_0x296f('0x1')]},'priority':{'type':Sequelize[_0x296f('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x296f('0x1')]},'destcalleridname':{'type':Sequelize[_0x296f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x296f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x296f('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x296f('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x296f('0x1')]},'destuniqueid':{'type':Sequelize[_0x296f('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x296f('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x296f('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x296f('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x296f('0x1')]},'agententerreason':{'type':Sequelize[_0x296f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 90cb36b..6e53fc2 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(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index c3207c5..9629c6b 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 _0xfd7b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid','util','../../config/logger'];(function(_0x9bd22a,_0x4e6cf0){var _0x25c3dd=function(_0x3701f7){while(--_0x3701f7){_0x9bd22a['push'](_0x9bd22a['shift']());}};_0x25c3dd(++_0x4e6cf0);}(_0xfd7b,0x1df));var _0xbfd7=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xfd7b[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var logger=require(_0xbfd7('0x1'))(_0xbfd7('0x2'));var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require(_0xbfd7('0x6'));var rimraf=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var attributes=require(_0xbfd7('0x9'));module[_0xbfd7('0xa')]=function(_0x2ad158,_0x639dd4){return _0x2ad158['define'](_0xbfd7('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xbfd7('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bac=['lodash','../../config/logger','api','moment','bluebird','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x43c7a0,_0x302a63){var _0x56ac52=function(_0x26930b){while(--_0x26930b){_0x43c7a0['push'](_0x43c7a0['shift']());}};_0x56ac52(++_0x302a63);}(_0x6bac,0xa5));var _0xc6ba=function(_0x1c80f9,_0x30e8ce){_0x1c80f9=_0x1c80f9-0x0;var _0x3ff5d5=_0x6bac[_0x1c80f9];return _0x3ff5d5;};'use strict';var _=require(_0xc6ba('0x0'));var util=require('util');var logger=require(_0xc6ba('0x1'))(_0xc6ba('0x2'));var moment=require(_0xc6ba('0x3'));var BPromise=require(_0xc6ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6ba('0x5'));var attributes=require(_0xc6ba('0x6'));module['exports']=function(_0x222f20,_0x2a16af){return _0x222f20[_0xc6ba('0x7')](_0xc6ba('0x8'),attributes,{'tableName':_0xc6ba('0x9'),'paranoid':![],'indexes':[{'fields':[_0xc6ba('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1c0173a..42c7647 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 _0x8c02=['raw','where','attributes','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','catch'];(function(_0x131590,_0x5e6254){var _0x7decaf=function(_0x196132){while(--_0x196132){_0x131590['push'](_0x131590['shift']());}};_0x7decaf(++_0x5e6254);}(_0x8c02,0x1e4));var _0x28c0=function(_0x385674,_0x314442){_0x385674=_0x385674-0x0;var _0x256638=_0x8c02[_0x385674];return _0x256638;};'use strict';var _=require(_0x28c0('0x0'));var util=require(_0x28c0('0x1'));var moment=require(_0x28c0('0x2'));var BPromise=require(_0x28c0('0x3'));var rs=require(_0x28c0('0x4'));var fs=require('fs');var Redis=require(_0x28c0('0x5'));var db=require(_0x28c0('0x6'))['db'];var utils=require(_0x28c0('0x7'));var logger=require(_0x28c0('0x8'))(_0x28c0('0x9'));var config=require(_0x28c0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x28c0('0xb')][_0x28c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b83c5,_0x39b27e,_0x44d5c6){return new BPromise(function(_0x1db428,_0x573652){return client['request'](_0x4b83c5,_0x44d5c6)[_0x28c0('0xd')](function(_0x593f1e){logger[_0x28c0('0xe')](_0x28c0('0xf'),_0x39b27e,_0x28c0('0x10'));logger[_0x28c0('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x39b27e,_0x28c0('0x10'),JSON[_0x28c0('0x12')](_0x593f1e));if(_0x593f1e[_0x28c0('0x13')]){if(_0x593f1e[_0x28c0('0x13')]['code']===0x1f4){logger['error'](_0x28c0('0xf'),_0x39b27e,_0x593f1e['error'][_0x28c0('0x14')]);return _0x573652(_0x593f1e[_0x28c0('0x13')]['message']);}logger[_0x28c0('0x13')](_0x28c0('0xf'),_0x39b27e,_0x593f1e[_0x28c0('0x13')][_0x28c0('0x14')]);return _0x1db428(_0x593f1e[_0x28c0('0x13')][_0x28c0('0x14')]);}else{logger[_0x28c0('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x39b27e,_0x28c0('0x10'));_0x1db428(_0x593f1e[_0x28c0('0x15')][_0x28c0('0x14')]);}})['catch'](function(_0x4ceb47){logger[_0x28c0('0x13')](_0x28c0('0xf'),_0x39b27e,_0x4ceb47);_0x573652(_0x4ceb47);});});}exports[_0x28c0('0x16')]=function(_0x54de65){var _0x15b92=this;return new Promise(function(_0x5a25a6,_0x5f1c5b){return db[_0x28c0('0x17')][_0x28c0('0x18')](_0x54de65[_0x28c0('0x19')],{'raw':_0x54de65[_0x28c0('0x1a')]?_0x54de65[_0x28c0('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x28c0('0xd')](function(_0x392f87){logger['info'](_0x28c0('0x16'),_0x54de65);logger['debug'](_0x28c0('0x16'),_0x54de65,JSON[_0x28c0('0x12')](_0x392f87));_0x5a25a6(_0x392f87);})[_0x28c0('0x1b')](function(_0x367297){logger[_0x28c0('0x13')](_0x28c0('0x16'),_0x367297[_0x28c0('0x14')],_0x54de65);_0x5f1c5b(_0x15b92[_0x28c0('0x13')](0x1f4,_0x367297[_0x28c0('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x346010){var _0xc2d917=this;return new Promise(function(_0x5361f7,_0x5e9ba9){return db[_0x28c0('0x17')]['update'](_0x346010[_0x28c0('0x19')],{'raw':_0x346010[_0x28c0('0x1a')]?_0x346010[_0x28c0('0x1a')][_0x28c0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x346010[_0x28c0('0x1a')]?_0x346010[_0x28c0('0x1a')][_0x28c0('0x1d')]||null:null,'attributes':_0x346010[_0x28c0('0x1a')]?_0x346010[_0x28c0('0x1a')][_0x28c0('0x1e')]||null:null,'limit':_0x346010[_0x28c0('0x1a')]?_0x346010[_0x28c0('0x1a')]['limit']||null:null})[_0x28c0('0xd')](function(_0x3d9cbb){logger[_0x28c0('0xe')](_0x28c0('0x1f'),_0x346010);logger[_0x28c0('0x11')](_0x28c0('0x1f'),_0x346010,JSON[_0x28c0('0x12')](_0x3d9cbb));_0x5361f7(_0x3d9cbb);})[_0x28c0('0x1b')](function(_0x34e440){logger[_0x28c0('0x13')](_0x28c0('0x1f'),_0x34e440['message'],_0x346010);_0x5e9ba9(_0xc2d917[_0x28c0('0x13')](0x1f4,_0x34e440['message']));});});}; \ No newline at end of file +var _0xd498=['info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x4c971f,_0x4e69d4){var _0x5ad49e=function(_0x4ab50e){while(--_0x4ab50e){_0x4c971f['push'](_0x4c971f['shift']());}};_0x5ad49e(++_0x4e69d4);}(_0xd498,0x13f));var _0x8d49=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xd498[_0x427352];return _0x23e0e6;};'use strict';var _=require('lodash');var util=require(_0x8d49('0x0'));var moment=require(_0x8d49('0x1'));var BPromise=require(_0x8d49('0x2'));var rs=require(_0x8d49('0x3'));var fs=require('fs');var Redis=require(_0x8d49('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d49('0x5'));var logger=require('../../config/logger')(_0x8d49('0x6'));var config=require('../../config/environment');var jayson=require(_0x8d49('0x7'));var client=jayson[_0x8d49('0x8')][_0x8d49('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21b2a1,_0xf1a253,_0xd26733){return new BPromise(function(_0x144c56,_0x284f1c){return client[_0x8d49('0xa')](_0x21b2a1,_0xd26733)['then'](function(_0x528534){logger[_0x8d49('0xb')](_0x8d49('0xc'),_0xf1a253,'request\x20sent');logger[_0x8d49('0xd')](_0x8d49('0xe'),_0xf1a253,_0x8d49('0xf'),JSON[_0x8d49('0x10')](_0x528534));if(_0x528534[_0x8d49('0x11')]){if(_0x528534['error'][_0x8d49('0x12')]===0x1f4){logger[_0x8d49('0x11')](_0x8d49('0xc'),_0xf1a253,_0x528534[_0x8d49('0x11')]['message']);return _0x284f1c(_0x528534[_0x8d49('0x11')][_0x8d49('0x13')]);}logger[_0x8d49('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0xf1a253,_0x528534['error'][_0x8d49('0x13')]);return _0x144c56(_0x528534[_0x8d49('0x11')][_0x8d49('0x13')]);}else{logger[_0x8d49('0xb')](_0x8d49('0xc'),_0xf1a253,_0x8d49('0xf'));_0x144c56(_0x528534['result'][_0x8d49('0x13')]);}})[_0x8d49('0x14')](function(_0x2262ef){logger[_0x8d49('0x11')](_0x8d49('0xc'),_0xf1a253,_0x2262ef);_0x284f1c(_0x2262ef);});});}exports[_0x8d49('0x15')]=function(_0x18c97b){var _0x1336c6=this;return new Promise(function(_0x4b3dbd,_0x4d43d7){return db[_0x8d49('0x16')][_0x8d49('0x17')](_0x18c97b[_0x8d49('0x18')],{'raw':_0x18c97b[_0x8d49('0x19')]?_0x18c97b[_0x8d49('0x19')][_0x8d49('0x1a')]===undefined?!![]:![]:!![]})[_0x8d49('0x1b')](function(_0x415960){logger[_0x8d49('0xb')]('CreateVoiceAgentReport',_0x18c97b);logger[_0x8d49('0xd')](_0x8d49('0x15'),_0x18c97b,JSON[_0x8d49('0x10')](_0x415960));_0x4b3dbd(_0x415960);})['catch'](function(_0x542862){logger[_0x8d49('0x11')](_0x8d49('0x15'),_0x542862[_0x8d49('0x13')],_0x18c97b);_0x4d43d7(_0x1336c6[_0x8d49('0x11')](0x1f4,_0x542862[_0x8d49('0x13')]));});});};exports[_0x8d49('0x1c')]=function(_0x4c4e6a){var _0x48ae18=this;return new Promise(function(_0x3d56c2,_0x55dcc5){return db[_0x8d49('0x16')][_0x8d49('0x1d')](_0x4c4e6a[_0x8d49('0x18')],{'raw':_0x4c4e6a[_0x8d49('0x19')]?_0x4c4e6a['options'][_0x8d49('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c4e6a[_0x8d49('0x19')]?_0x4c4e6a[_0x8d49('0x19')][_0x8d49('0x1e')]||null:null,'attributes':_0x4c4e6a[_0x8d49('0x19')]?_0x4c4e6a[_0x8d49('0x19')][_0x8d49('0x1f')]||null:null,'limit':_0x4c4e6a[_0x8d49('0x19')]?_0x4c4e6a['options'][_0x8d49('0x20')]||null:null})[_0x8d49('0x1b')](function(_0x45a67f){logger['info'](_0x8d49('0x1c'),_0x4c4e6a);logger['debug'](_0x8d49('0x1c'),_0x4c4e6a,JSON['stringify'](_0x45a67f));_0x3d56c2(_0x45a67f);})['catch'](function(_0x29b46b){logger[_0x8d49('0x11')](_0x8d49('0x1c'),_0x29b46b[_0x8d49('0x13')],_0x4c4e6a);_0x55dcc5(_0x48ae18[_0x8d49('0x11')](0x1f4,_0x29b46b[_0x8d49('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b5a1c05..a312821 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 _0x7fbe=['/describe','describe','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x343ddd,_0x1bb27f){var _0x1298f0=function(_0x1d22d7){while(--_0x1d22d7){_0x343ddd['push'](_0x343ddd['shift']());}};_0x1298f0(++_0x1bb27f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xb3d48d,_0xa90785){_0xb3d48d=_0xb3d48d-0x0;var _0x501bad=_0x7fbe[_0xb3d48d];return _0x501bad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x0e85=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x7a84f2,_0x1e1e67){var _0x2822f0=function(_0x5eac00){while(--_0x5eac00){_0x7a84f2['push'](_0x7a84f2['shift']());}};_0x2822f0(++_0x1e1e67);}(_0x0e85,0x7c));var _0x50e8=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0e85[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['show']);router[_0x50e8('0xc')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0xd')]);router[_0x50e8('0xe')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x50e8('0x11')]);module[_0x50e8('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 2361b4d..973c7ae 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 _0xedca=['INTEGER','sequelize','exports','inbound','outbound','inbound-fax','outbound-fax','dialer','STRING','DATE'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0xedca,0xc9));var _0xaedc=function(_0x538a12,_0x5c95b0){_0x538a12=_0x538a12-0x0;var _0x2e9260=_0xedca[_0x538a12];return _0x2e9260;};'use strict';var Sequelize=require(_0xaedc('0x0'));module[_0xaedc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xaedc('0x2'),'internal',_0xaedc('0x3'),_0xaedc('0x4'),_0xaedc('0x5'),_0xaedc('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaedc('0x7')]},'source':{'type':Sequelize[_0xaedc('0x7')]},'destination':{'type':Sequelize[_0xaedc('0x7')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xaedc('0x7')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xaedc('0x8')]},'systemanswertime':{'type':Sequelize[_0xaedc('0x8')]},'answertime':{'type':Sequelize[_0xaedc('0x8')]},'endtime':{'type':Sequelize[_0xaedc('0x8')]},'duration':{'type':Sequelize[_0xaedc('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xaedc('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xaedc('0x7')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xaedc('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xaedc('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xaedc('0x7')]},'note':{'type':Sequelize[_0xaedc('0x7')]},'prefix':{'type':Sequelize[_0xaedc('0x7')]},'routeid':{'type':Sequelize[_0xaedc('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x20e8=['exports','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0xc7fd4d,_0x244b0c){var _0x52aded=function(_0x25abb4){while(--_0x25abb4){_0xc7fd4d['push'](_0xc7fd4d['shift']());}};_0x52aded(++_0x244b0c);}(_0x20e8,0x6b));var _0x820e=function(_0x1c5da1,_0x3ff58d){_0x1c5da1=_0x1c5da1-0x0;var _0xe7300b=_0x20e8[_0x1c5da1];return _0xe7300b;};'use strict';var Sequelize=require(_0x820e('0x0'));module[_0x820e('0x1')]={'uniqueid':{'type':Sequelize[_0x820e('0x2')]},'type':{'type':Sequelize[_0x820e('0x3')](_0x820e('0x4'),_0x820e('0x5'),'outbound',_0x820e('0x6'),_0x820e('0x7'),_0x820e('0x8'))},'tag':{'type':Sequelize[_0x820e('0x2')]},'accountcode':{'type':Sequelize[_0x820e('0x2')]},'source':{'type':Sequelize[_0x820e('0x2')]},'destination':{'type':Sequelize[_0x820e('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x820e('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x820e('0x9')]},'starttime':{'type':Sequelize[_0x820e('0xa')]},'systemanswertime':{'type':Sequelize[_0x820e('0xa')]},'answertime':{'type':Sequelize[_0x820e('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x820e('0xb')]},'billableseconds':{'type':Sequelize[_0x820e('0xb')]},'mohtime':{'type':Sequelize[_0x820e('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x820e('0x2')]},'amaflags':{'type':Sequelize[_0x820e('0x2')]},'userfield':{'type':Sequelize[_0x820e('0x2')]},'userDisposition':{'type':Sequelize[_0x820e('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x820e('0x2')]},'note':{'type':Sequelize[_0x820e('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x820e('0xb')]},'sipcallid':{'type':Sequelize[_0x820e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index a82fa21..92602a1 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x5e8989,_0x5e0933){_0x5e8989=_0x5e8989-0x0;var _0x44b1c1=_0x2032[_0x5e8989];return _0x44b1c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','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','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xadb5,0xad));var _0x5adb=function(_0x52acfd,_0x46c981){_0x52acfd=_0x52acfd-0x0;var _0x363ae6=_0xadb5[_0x52acfd];return _0x363ae6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index ce33474..e1e5e6b 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 _0x48f1=['uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf','exports','VoiceCallReport','report_call'];(function(_0x37a45b,_0x1056ef){var _0x35f3bb=function(_0x5d73cd){while(--_0x5d73cd){_0x37a45b['push'](_0x37a45b['shift']());}};_0x35f3bb(++_0x1056ef);}(_0x48f1,0x1eb));var _0x148f=function(_0x1c2a60,_0x12f45a){_0x1c2a60=_0x1c2a60-0x0;var _0x578eb8=_0x48f1[_0x1c2a60];return _0x578eb8;};'use strict';var _=require(_0x148f('0x0'));var util=require('util');var logger=require(_0x148f('0x1'))(_0x148f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x148f('0x3'));var fs=require('fs');var path=require(_0x148f('0x4'));var rimraf=require(_0x148f('0x5'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x148f('0x6')]=function(_0x4f1cd7,_0xe71fa7){return _0x4f1cd7['define'](_0x148f('0x7'),attributes,{'tableName':_0x148f('0x8'),'paranoid':![],'indexes':[{'fields':[_0x148f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4302=['./voiceCallReport.attributes','exports','define','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1e5ecc,_0x25889c){var _0x339063=function(_0x588323){while(--_0x588323){_0x1e5ecc['push'](_0x1e5ecc['shift']());}};_0x339063(++_0x25889c);}(_0x4302,0xa3));var _0x2430=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x4302[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x2430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2430('0x1'));var moment=require(_0x2430('0x2'));var BPromise=require(_0x2430('0x3'));var rp=require(_0x2430('0x4'));var fs=require('fs');var path=require(_0x2430('0x5'));var rimraf=require('rimraf');var config=require(_0x2430('0x6'));var attributes=require(_0x2430('0x7'));module[_0x2430('0x8')]=function(_0x504fd3,_0x5952cf){return _0x504fd3[_0x2430('0x9')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ea94f6c..e3b8152 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 _0x6502=['raw','where','attributes','limit','map','include','model','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options'];(function(_0x44674e,_0x347237){var _0x5aba7e=function(_0x2da505){while(--_0x2da505){_0x44674e['push'](_0x44674e['shift']());}};_0x5aba7e(++_0x347237);}(_0x6502,0xf6));var _0x2650=function(_0x1f77cc,_0xacb2df){_0x1f77cc=_0x1f77cc-0x0;var _0x1da892=_0x6502[_0x1f77cc];return _0x1da892;};'use strict';var _=require('lodash');var util=require(_0x2650('0x0'));var moment=require(_0x2650('0x1'));var BPromise=require(_0x2650('0x2'));var rs=require(_0x2650('0x3'));var fs=require('fs');var Redis=require(_0x2650('0x4'));var db=require(_0x2650('0x5'))['db'];var utils=require(_0x2650('0x6'));var logger=require(_0x2650('0x7'))(_0x2650('0x8'));var config=require('../../config/environment');var jayson=require(_0x2650('0x9'));var client=jayson[_0x2650('0xa')][_0x2650('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e1413,_0x546315,_0x14b10e){return new BPromise(function(_0x198108,_0x28df19){return client['request'](_0x5e1413,_0x14b10e)[_0x2650('0xc')](function(_0x2ac506){logger[_0x2650('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x546315,'request\x20sent');logger['debug'](_0x2650('0xe'),_0x546315,_0x2650('0xf'),JSON[_0x2650('0x10')](_0x2ac506));if(_0x2ac506[_0x2650('0x11')]){if(_0x2ac506[_0x2650('0x11')][_0x2650('0x12')]===0x1f4){logger[_0x2650('0x11')](_0x2650('0x13'),_0x546315,_0x2ac506[_0x2650('0x11')][_0x2650('0x14')]);return _0x28df19(_0x2ac506[_0x2650('0x11')][_0x2650('0x14')]);}logger['error'](_0x2650('0x13'),_0x546315,_0x2ac506['error'][_0x2650('0x14')]);return _0x198108(_0x2ac506[_0x2650('0x11')]['message']);}else{logger[_0x2650('0xd')](_0x2650('0x13'),_0x546315,_0x2650('0xf'));_0x198108(_0x2ac506[_0x2650('0x15')]['message']);}})[_0x2650('0x16')](function(_0x298799){logger['error'](_0x2650('0x13'),_0x546315,_0x298799);_0x28df19(_0x298799);});});}exports[_0x2650('0x17')]=function(_0x14f75a){var _0x5a4dbf=this;return new Promise(function(_0x1c5086,_0x3071dc){return db[_0x2650('0x18')][_0x2650('0x19')]({'raw':_0x14f75a[_0x2650('0x1a')]?_0x14f75a[_0x2650('0x1a')][_0x2650('0x1b')]===undefined?!![]:![]:!![],'where':_0x14f75a[_0x2650('0x1a')]?_0x14f75a[_0x2650('0x1a')][_0x2650('0x1c')]||null:null,'attributes':_0x14f75a[_0x2650('0x1a')]?_0x14f75a[_0x2650('0x1a')][_0x2650('0x1d')]||null:null,'limit':_0x14f75a[_0x2650('0x1a')]?_0x14f75a[_0x2650('0x1a')][_0x2650('0x1e')]||null:null,'include':_0x14f75a['options']?_0x14f75a[_0x2650('0x1a')]['include']?_[_0x2650('0x1f')](_0x14f75a[_0x2650('0x1a')][_0x2650('0x20')],function(_0x453792){return{'model':db[_0x453792[_0x2650('0x21')]],'as':_0x453792['as'],'attributes':_0x453792[_0x2650('0x1d')],'include':_0x453792[_0x2650('0x20')]?_[_0x2650('0x1f')](_0x453792['include'],function(_0x3552d2){return{'model':db[_0x3552d2['model']],'as':_0x3552d2['as'],'attributes':_0x3552d2[_0x2650('0x1d')],'include':_0x3552d2[_0x2650('0x20')]?_['map'](_0x3552d2[_0x2650('0x20')],function(_0x238b87){return{'model':db[_0x238b87[_0x2650('0x21')]],'as':_0x238b87['as'],'attributes':_0x238b87['attributes']};}):[]};}):[]};}):[]:[]})[_0x2650('0xc')](function(_0x207da1){logger[_0x2650('0xd')](_0x2650('0x17'),_0x14f75a);logger[_0x2650('0x22')](_0x2650('0x17'),_0x14f75a,JSON['stringify'](_0x207da1));_0x1c5086(_0x207da1);})[_0x2650('0x16')](function(_0x3a0bc5){logger[_0x2650('0x11')](_0x2650('0x17'),_0x3a0bc5['message'],_0x14f75a);_0x3071dc(_0x5a4dbf[_0x2650('0x11')](0x1f4,_0x3a0bc5[_0x2650('0x14')]));});});};exports[_0x2650('0x23')]=function(_0x1e4d06){var _0x3a8234=this;return new Promise(function(_0x106b6d,_0xa206ef){return db['VoiceCallReport'][_0x2650('0x24')](_0x1e4d06[_0x2650('0x25')],{'raw':_0x1e4d06['options']?_0x1e4d06['options']['raw']===undefined?!![]:![]:!![]})[_0x2650('0xc')](function(_0x381887){logger[_0x2650('0xd')](_0x2650('0x23'),_0x1e4d06);logger['debug'](_0x2650('0x23'),_0x1e4d06,JSON[_0x2650('0x10')](_0x381887));_0x106b6d(_0x381887);})['catch'](function(_0x18b11d){logger[_0x2650('0x11')](_0x2650('0x23'),_0x18b11d[_0x2650('0x14')],_0x1e4d06);_0xa206ef(_0x3a8234['error'](0x1f4,_0x18b11d[_0x2650('0x14')]));});});};exports[_0x2650('0x26')]=function(_0x1ea69e){var _0x20ac4f=this;return new Promise(function(_0x4b0a23,_0x4dc0ec){return db[_0x2650('0x18')]['update'](_0x1ea69e['body'],{'raw':_0x1ea69e[_0x2650('0x1a')]?_0x1ea69e['options'][_0x2650('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ea69e[_0x2650('0x1a')]?_0x1ea69e[_0x2650('0x1a')][_0x2650('0x1c')]||null:null,'attributes':_0x1ea69e[_0x2650('0x1a')]?_0x1ea69e[_0x2650('0x1a')][_0x2650('0x1d')]||null:null,'limit':_0x1ea69e['options']?_0x1ea69e[_0x2650('0x1a')][_0x2650('0x1e')]||null:null})[_0x2650('0xc')](function(_0x386e3f){logger[_0x2650('0xd')](_0x2650('0x26'),_0x1ea69e);logger[_0x2650('0x22')](_0x2650('0x26'),_0x1ea69e,JSON[_0x2650('0x10')](_0x386e3f));_0x4b0a23(_0x386e3f);})[_0x2650('0x16')](function(_0x4a641c){logger[_0x2650('0x11')](_0x2650('0x26'),_0x4a641c[_0x2650('0x14')],_0x1ea69e);_0x4dc0ec(_0x20ac4f[_0x2650('0x11')](0x1f4,_0x4a641c[_0x2650('0x14')]));});});}; \ No newline at end of file +var _0xfd6e=['then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','model','map','attributes','info','CreateVoiceCallReport','body','catch','UpdateVoiceCallReport','update','lodash','moment','randomstring','ioredis','rpc','client','http','request'];(function(_0x30381e,_0x2a1f30){var _0x9fb2f3=function(_0x467138){while(--_0x467138){_0x30381e['push'](_0x30381e['shift']());}};_0x9fb2f3(++_0x2a1f30);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xefd6('0x0'));var util=require('util');var moment=require(_0xefd6('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd6('0x2'));var fs=require('fs');var Redis=require(_0xefd6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xefd6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xefd6('0x5')][_0xefd6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x26e108,_0xe477f9,_0x340765){return new BPromise(function(_0x5da399,_0x59c636){return client[_0xefd6('0x7')](_0x26e108,_0x340765)[_0xefd6('0x8')](function(_0x3c941a){logger['info'](_0xefd6('0x9'),_0xe477f9,_0xefd6('0xa'));logger[_0xefd6('0xb')](_0xefd6('0xc'),_0xe477f9,'request\x20sent',JSON[_0xefd6('0xd')](_0x3c941a));if(_0x3c941a[_0xefd6('0xe')]){if(_0x3c941a[_0xefd6('0xe')][_0xefd6('0xf')]===0x1f4){logger[_0xefd6('0xe')](_0xefd6('0x9'),_0xe477f9,_0x3c941a[_0xefd6('0xe')][_0xefd6('0x10')]);return _0x59c636(_0x3c941a['error'][_0xefd6('0x10')]);}logger[_0xefd6('0xe')](_0xefd6('0x9'),_0xe477f9,_0x3c941a[_0xefd6('0xe')][_0xefd6('0x10')]);return _0x5da399(_0x3c941a['error'][_0xefd6('0x10')]);}else{logger['info'](_0xefd6('0x9'),_0xe477f9,'request\x20sent');_0x5da399(_0x3c941a[_0xefd6('0x11')][_0xefd6('0x10')]);}})['catch'](function(_0x17bf20){logger[_0xefd6('0xe')](_0xefd6('0x9'),_0xe477f9,_0x17bf20);_0x59c636(_0x17bf20);});});}exports[_0xefd6('0x12')]=function(_0xd59458){var _0x306ad1=this;return new Promise(function(_0x469c17,_0x137e6d){return db[_0xefd6('0x13')][_0xefd6('0x14')]({'raw':_0xd59458[_0xefd6('0x15')]?_0xd59458['options'][_0xefd6('0x16')]===undefined?!![]:![]:!![],'where':_0xd59458[_0xefd6('0x15')]?_0xd59458[_0xefd6('0x15')][_0xefd6('0x17')]||null:null,'attributes':_0xd59458[_0xefd6('0x15')]?_0xd59458[_0xefd6('0x15')]['attributes']||null:null,'limit':_0xd59458[_0xefd6('0x15')]?_0xd59458[_0xefd6('0x15')]['limit']||null:null,'include':_0xd59458[_0xefd6('0x15')]?_0xd59458[_0xefd6('0x15')][_0xefd6('0x18')]?_['map'](_0xd59458['options'][_0xefd6('0x18')],function(_0x1b1d41){return{'model':db[_0x1b1d41[_0xefd6('0x19')]],'as':_0x1b1d41['as'],'attributes':_0x1b1d41['attributes'],'include':_0x1b1d41[_0xefd6('0x18')]?_[_0xefd6('0x1a')](_0x1b1d41[_0xefd6('0x18')],function(_0x5347fd){return{'model':db[_0x5347fd[_0xefd6('0x19')]],'as':_0x5347fd['as'],'attributes':_0x5347fd[_0xefd6('0x1b')],'include':_0x5347fd['include']?_[_0xefd6('0x1a')](_0x5347fd[_0xefd6('0x18')],function(_0x43ffbc){return{'model':db[_0x43ffbc['model']],'as':_0x43ffbc['as'],'attributes':_0x43ffbc[_0xefd6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xefd6('0x8')](function(_0x174fbf){logger[_0xefd6('0x1c')](_0xefd6('0x12'),_0xd59458);logger[_0xefd6('0xb')](_0xefd6('0x12'),_0xd59458,JSON[_0xefd6('0xd')](_0x174fbf));_0x469c17(_0x174fbf);})['catch'](function(_0xca6bad){logger[_0xefd6('0xe')](_0xefd6('0x12'),_0xca6bad[_0xefd6('0x10')],_0xd59458);_0x137e6d(_0x306ad1[_0xefd6('0xe')](0x1f4,_0xca6bad['message']));});});};exports[_0xefd6('0x1d')]=function(_0x2feac2){var _0x171fe7=this;return new Promise(function(_0x15c67e,_0x3225e7){return db[_0xefd6('0x13')]['create'](_0x2feac2[_0xefd6('0x1e')],{'raw':_0x2feac2[_0xefd6('0x15')]?_0x2feac2[_0xefd6('0x15')][_0xefd6('0x16')]===undefined?!![]:![]:!![]})[_0xefd6('0x8')](function(_0x2c9fb3){logger[_0xefd6('0x1c')]('CreateVoiceCallReport',_0x2feac2);logger[_0xefd6('0xb')](_0xefd6('0x1d'),_0x2feac2,JSON[_0xefd6('0xd')](_0x2c9fb3));_0x15c67e(_0x2c9fb3);})[_0xefd6('0x1f')](function(_0x4aa07e){logger[_0xefd6('0xe')](_0xefd6('0x1d'),_0x4aa07e['message'],_0x2feac2);_0x3225e7(_0x171fe7[_0xefd6('0xe')](0x1f4,_0x4aa07e[_0xefd6('0x10')]));});});};exports[_0xefd6('0x20')]=function(_0x474e1c){var _0x806e0e=this;return new Promise(function(_0x3cce59,_0x351ca5){return db[_0xefd6('0x13')][_0xefd6('0x21')](_0x474e1c['body'],{'raw':_0x474e1c[_0xefd6('0x15')]?_0x474e1c[_0xefd6('0x15')][_0xefd6('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x474e1c[_0xefd6('0x15')]?_0x474e1c[_0xefd6('0x15')][_0xefd6('0x17')]||null:null,'attributes':_0x474e1c['options']?_0x474e1c[_0xefd6('0x15')][_0xefd6('0x1b')]||null:null,'limit':_0x474e1c[_0xefd6('0x15')]?_0x474e1c[_0xefd6('0x15')]['limit']||null:null})[_0xefd6('0x8')](function(_0x1c34b3){logger['info'](_0xefd6('0x20'),_0x474e1c);logger[_0xefd6('0xb')]('UpdateVoiceCallReport',_0x474e1c,JSON[_0xefd6('0xd')](_0x1c34b3));_0x3cce59(_0x1c34b3);})[_0xefd6('0x1f')](function(_0x33ccc5){logger[_0xefd6('0xe')](_0xefd6('0x20'),_0x33ccc5[_0xefd6('0x10')],_0x474e1c);_0x351ca5(_0x806e0e['error'](0x1f4,_0x33ccc5[_0xefd6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 0e4ea24..2bc0021 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 _0x701d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x382f34,_0x34347e){var _0x231ecc=function(_0x36915b){while(--_0x36915b){_0x382f34['push'](_0x382f34['shift']());}};_0x231ecc(++_0x34347e);}(_0x701d,0x126));var _0xd701=function(_0x102a36,_0x576780){_0x102a36=_0x102a36-0x0;var _0x4e11e6=_0x701d[_0x102a36];return _0x4e11e6;};'use strict';var multer=require(_0xd701('0x0'));var util=require(_0xd701('0x1'));var path=require(_0xd701('0x2'));var timeout=require(_0xd701('0x3'));var express=require(_0xd701('0x4'));var router=express[_0xd701('0x5')]();var fs_extra=require(_0xd701('0x6'));var auth=require(_0xd701('0x7'));var interaction=require(_0xd701('0x8'));var config=require(_0xd701('0x9'));var controller=require(_0xd701('0xa'));router['get']('/',auth[_0xd701('0xb')](),controller[_0xd701('0xc')]);router[_0xd701('0xd')]('/:id',auth[_0xd701('0xb')](),controller[_0xd701('0xe')]);router[_0xd701('0xf')]('/',auth[_0xd701('0xb')](),controller['create']);router[_0xd701('0x10')](_0xd701('0x11'),auth[_0xd701('0xb')](),controller[_0xd701('0x12')]);router[_0xd701('0x13')](_0xd701('0x11'),auth[_0xd701('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfc1d=['put','update','delete','destroy','exports','multer','express','Router','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x9551ed,_0xd03150){var _0x513324=function(_0x21f466){while(--_0x21f466){_0x9551ed['push'](_0x9551ed['shift']());}};_0x513324(++_0xd03150);}(_0xfc1d,0x1d0));var _0xdfc1=function(_0x47b8b5,_0x41fd9b){_0x47b8b5=_0x47b8b5-0x0;var _0x1ee44a=_0xfc1d[_0x47b8b5];return _0x1ee44a;};'use strict';var multer=require(_0xdfc1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdfc1('0x1'));var router=express[_0xdfc1('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdfc1('0x3'));var config=require('../../config/environment');var controller=require(_0xdfc1('0x4'));router[_0xdfc1('0x5')]('/',auth[_0xdfc1('0x6')](),controller[_0xdfc1('0x7')]);router[_0xdfc1('0x5')](_0xdfc1('0x8'),auth[_0xdfc1('0x6')](),controller[_0xdfc1('0x9')]);router[_0xdfc1('0xa')]('/',auth['isAuthenticated'](),controller[_0xdfc1('0xb')]);router[_0xdfc1('0xc')](_0xdfc1('0x8'),auth[_0xdfc1('0x6')](),controller[_0xdfc1('0xd')]);router[_0xdfc1('0xe')]('/:id',auth[_0xdfc1('0x6')](),controller[_0xdfc1('0xf')]);module[_0xdfc1('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 18a2079..12e79bc 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 _0x8d85=['exports','STRING','name','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8d85,0x187));var _0x58d8=function(_0x265c0e,_0x2277d6){_0x265c0e=_0x265c0e-0x0;var _0xd8a413=_0x8d85[_0x265c0e];return _0xd8a413;};'use strict';var Sequelize=require(_0x58d8('0x0'));module[_0x58d8('0x1')]={'name':{'type':Sequelize[_0x58d8('0x2')]},'prefix':{'type':Sequelize[_0x58d8('0x2')],'unique':_0x58d8('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x58d8('0x2')],'set':function(_0x51d7ad){this['setDataValue']('options',_0x51d7ad?_0x51d7ad['join'](''):[]);},'get':function(){return this[_0x58d8('0x4')]('options')?this['getDataValue'](_0x58d8('0x5'))[_0x58d8('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x58d8('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x58d8('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb3fc=['split','sequelize','exports','STRING','name','setDataValue','options','getDataValue'];(function(_0x61fdd3,_0x48f8f7){var _0x500b16=function(_0x37724f){while(--_0x37724f){_0x61fdd3['push'](_0x61fdd3['shift']());}};_0x500b16(++_0x48f8f7);}(_0xb3fc,0x141));var _0xcb3f=function(_0x4a782b,_0x55584a){_0x4a782b=_0x4a782b-0x0;var _0x5cb5a0=_0xb3fc[_0x4a782b];return _0x5cb5a0;};'use strict';var Sequelize=require(_0xcb3f('0x0'));module[_0xcb3f('0x1')]={'name':{'type':Sequelize[_0xcb3f('0x2')]},'prefix':{'type':Sequelize[_0xcb3f('0x2')],'unique':_0xcb3f('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xcb3f('0x2')],'set':function(_0x2ef350){this[_0xcb3f('0x4')](_0xcb3f('0x5'),_0x2ef350?_0x2ef350['join'](''):[]);},'get':function(){return this['getDataValue'](_0xcb3f('0x5'))?this[_0xcb3f('0x6')](_0xcb3f('0x5'))[_0xcb3f('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcb3f('0x2')]},'description':{'type':Sequelize[_0xcb3f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 66ed248..c902f26 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 _0xe80c=['model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','count','limit','Content-Range','reject','save','then','destroy','get','UserProfileResource','status','sendStatus','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0xe80c,0x1c2));var _0xce80=function(_0x52e0b4,_0x99d4e1){_0x52e0b4=_0x52e0b4-0x0;var _0x57e02b=_0xe80c[_0x52e0b4];return _0x57e02b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce80('0x0'));var zipdir=require(_0xce80('0x1'));var jsonpatch=require(_0xce80('0x2'));var rp=require(_0xce80('0x3'));var moment=require(_0xce80('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce80('0x5'));var util=require(_0xce80('0x6'));var path=require(_0xce80('0x7'));var sox=require(_0xce80('0x8'));var csv=require('to-csv');var ejs=require(_0xce80('0x9'));var fs=require('fs');var fs_extra=require(_0xce80('0xa'));var _=require(_0xce80('0xb'));var squel=require('squel');var crypto=require(_0xce80('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce80('0xd'));var toCsv=require('to-csv');var querystring=require(_0xce80('0xe'));var Papa=require(_0xce80('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce80('0x10'));var as=require(_0xce80('0x11'));var hardwareService=require(_0xce80('0x12'));var logger=require(_0xce80('0x13'))(_0xce80('0x14'));var utils=require(_0xce80('0x15'));var config=require(_0xce80('0x16'));var licenseUtil=require(_0xce80('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45a9b7,_0x37561b){_0x37561b=_0x37561b||0xcc;return function(_0x12d8c7){if(_0x12d8c7){return _0x45a9b7['sendStatus'](_0x37561b);}return _0x45a9b7['status'](_0x37561b)[_0xce80('0x18')]();};}function respondWithResult(_0x1903ec,_0x15f870){_0x15f870=_0x15f870||0xc8;return function(_0x3cac82){if(_0x3cac82){return _0x1903ec['status'](_0x15f870)[_0xce80('0x19')](_0x3cac82);}};}function respondWithFilteredResult(_0x5d134e,_0x9402b9){return function(_0x48796f){if(_0x48796f){var _0x24efa3=typeof _0x9402b9[_0xce80('0x1a')]==='undefined'&&typeof _0x9402b9['limit']==='undefined';var _0x35b40d=_0x48796f[_0xce80('0x1b')];var _0x148d57=_0x24efa3?0x0:_0x9402b9[_0xce80('0x1a')];var _0x4375b7=_0x24efa3?_0x48796f['count']:_0x9402b9[_0xce80('0x1a')]+_0x9402b9[_0xce80('0x1c')];var _0x4d4345;if(_0x4375b7>=_0x35b40d){_0x4375b7=_0x35b40d;_0x4d4345=0xc8;}else{_0x4d4345=0xce;}_0x5d134e['status'](_0x4d4345);return _0x5d134e['set'](_0xce80('0x1d'),_0x148d57+'-'+_0x4375b7+'/'+_0x35b40d)[_0xce80('0x19')](_0x48796f);}return null;};}function patchUpdates(_0x468b61){return function(_0x44f399){try{jsonpatch['apply'](_0x44f399,_0x468b61,!![]);}catch(_0x259a0b){return BPromise[_0xce80('0x1e')](_0x259a0b);}return _0x44f399[_0xce80('0x1f')]();};}function saveUpdates(_0x5315eb,_0x4df9bb){return function(_0x116b5e){if(_0x116b5e){return _0x116b5e['update'](_0x5315eb)[_0xce80('0x20')](function(_0x348d2d){return _0x348d2d;});}return null;};}function removeEntity(_0x2c5d01,_0x34f511){return function(_0x4fc91c){if(_0x4fc91c){return _0x4fc91c[_0xce80('0x21')]()['then'](function(){var _0x42a1dd=_0x4fc91c[_0xce80('0x22')]({'plain':!![]});var _0x4cd1f5='ChanSpies';return db[_0xce80('0x23')]['destroy']({'where':{'type':_0x4cd1f5,'resourceId':_0x42a1dd['id']}})[_0xce80('0x20')](function(){return _0x4fc91c;});})[_0xce80('0x20')](function(){_0x2c5d01[_0xce80('0x24')](0xcc)[_0xce80('0x18')]();});}};}function handleEntityNotFound(_0x4c3e8a,_0x8fd32c){return function(_0x148e90){if(!_0x148e90){_0x4c3e8a[_0xce80('0x25')](0x194);}return _0x148e90;};}function handleError(_0x3d7c49,_0x2e19da){_0x2e19da=_0x2e19da||0x1f4;return function(_0x4792fe){logger[_0xce80('0x26')](_0x4792fe[_0xce80('0x27')]);if(_0x4792fe['name']){delete _0x4792fe[_0xce80('0x28')];}_0x3d7c49[_0xce80('0x24')](_0x2e19da)[_0xce80('0x29')](_0x4792fe);};}exports[_0xce80('0x2a')]=function(_0x279931,_0x2f445c){var _0x3b8b30={},_0x50da6e={},_0x52e1bb={'count':0x0,'rows':[]};var _0x58e8d0=_['map'](db[_0xce80('0x2b')][_0xce80('0x2c')],function(_0x39c1c0){return{'name':_0x39c1c0[_0xce80('0x2d')],'type':_0x39c1c0[_0xce80('0x2e')][_0xce80('0x2f')]};});_0x50da6e[_0xce80('0x30')]=_[_0xce80('0x31')](_0x58e8d0,'name');_0x50da6e[_0xce80('0x32')]=_['keys'](_0x279931[_0xce80('0x32')]);_0x50da6e[_0xce80('0x33')]=_[_0xce80('0x34')](_0x50da6e[_0xce80('0x30')],_0x50da6e[_0xce80('0x32')]);_0x3b8b30[_0xce80('0x35')]=_['intersection'](_0x50da6e[_0xce80('0x30')],qs[_0xce80('0x36')](_0x279931[_0xce80('0x32')][_0xce80('0x36')]));_0x3b8b30[_0xce80('0x35')]=_0x3b8b30[_0xce80('0x35')]['length']?_0x3b8b30['attributes']:_0x50da6e[_0xce80('0x30')];if(!_0x279931[_0xce80('0x32')][_0xce80('0x37')](_0xce80('0x38'))){_0x3b8b30[_0xce80('0x1c')]=qs['limit'](_0x279931[_0xce80('0x32')][_0xce80('0x1c')]);_0x3b8b30[_0xce80('0x1a')]=qs[_0xce80('0x1a')](_0x279931[_0xce80('0x32')][_0xce80('0x1a')]);}_0x3b8b30[_0xce80('0x39')]=qs[_0xce80('0x3a')](_0x279931[_0xce80('0x32')][_0xce80('0x3a')]);_0x3b8b30['where']=qs[_0xce80('0x33')](_['pick'](_0x279931[_0xce80('0x32')],_0x50da6e[_0xce80('0x33')]),_0x58e8d0);if(_0x279931[_0xce80('0x32')][_0xce80('0x3b')]){_0x3b8b30[_0xce80('0x3c')]=_['merge'](_0x3b8b30[_0xce80('0x3c')],{'$or':_[_0xce80('0x31')](_0x58e8d0,function(_0x5d0b1b){if(_0x5d0b1b['type']!==_0xce80('0x3d')){var _0x4908c8={};_0x4908c8[_0x5d0b1b[_0xce80('0x28')]]={'$like':'%'+_0x279931[_0xce80('0x32')][_0xce80('0x3b')]+'%'};return _0x4908c8;}})});}_0x3b8b30=_[_0xce80('0x3e')]({},_0x3b8b30,_0x279931[_0xce80('0x3f')]);var _0xbdd463={'where':_0x3b8b30['where']};return db[_0xce80('0x2b')][_0xce80('0x1b')](_0xbdd463)[_0xce80('0x20')](function(_0x12bb2c){_0x52e1bb['count']=_0x12bb2c;if(_0x279931[_0xce80('0x32')]['includeAll']){_0x3b8b30[_0xce80('0x40')]=[{'all':!![]}];}return db[_0xce80('0x2b')][_0xce80('0x41')](_0x3b8b30);})[_0xce80('0x20')](function(_0x338393){_0x52e1bb[_0xce80('0x42')]=_0x338393;return _0x52e1bb;})[_0xce80('0x20')](respondWithFilteredResult(_0x2f445c,_0x3b8b30))[_0xce80('0x43')](handleError(_0x2f445c,null));};exports[_0xce80('0x44')]=function(_0x5ef5a2,_0x268516){var _0x1a2bf2={'raw':![],'where':{'id':_0x5ef5a2['params']['id']}},_0x215d8f={};_0x215d8f[_0xce80('0x30')]=_[_0xce80('0x45')](db[_0xce80('0x2b')]['rawAttributes']);_0x215d8f[_0xce80('0x32')]=_['keys'](_0x5ef5a2[_0xce80('0x32')]);_0x215d8f[_0xce80('0x33')]=_[_0xce80('0x34')](_0x215d8f['model'],_0x215d8f[_0xce80('0x32')]);_0x1a2bf2[_0xce80('0x35')]=_[_0xce80('0x34')](_0x215d8f['model'],qs[_0xce80('0x36')](_0x5ef5a2['query']['fields']));_0x1a2bf2[_0xce80('0x35')]=_0x1a2bf2[_0xce80('0x35')][_0xce80('0x46')]?_0x1a2bf2[_0xce80('0x35')]:_0x215d8f[_0xce80('0x30')];if(_0x5ef5a2[_0xce80('0x32')][_0xce80('0x47')]){_0x1a2bf2[_0xce80('0x40')]=[{'all':!![]}];}_0x1a2bf2=_['merge']({},_0x1a2bf2,_0x5ef5a2[_0xce80('0x3f')]);return db['VoiceChanSpy'][_0xce80('0x48')](_0x1a2bf2)[_0xce80('0x20')](handleEntityNotFound(_0x268516,null))[_0xce80('0x20')](respondWithResult(_0x268516,null))[_0xce80('0x43')](handleError(_0x268516,null));};exports[_0xce80('0x49')]=function(_0x118583,_0x595662){return db[_0xce80('0x2b')]['create'](_0x118583[_0xce80('0x4a')],{})['then'](function(_0x58a336){var _0x28d4e6=_0x118583[_0xce80('0x4b')][_0xce80('0x22')]({'plain':!![]});if(!_0x28d4e6)throw new Error(_0xce80('0x4c'));if(_0x28d4e6['role']===_0xce80('0x4b')){var _0xc420ef=_0x58a336['get']({'plain':!![]});var _0x300901=_0xce80('0x4d');return db[_0xce80('0x4e')][_0xce80('0x48')]({'where':{'name':_0x300901,'userProfileId':_0x28d4e6['userProfileId']},'raw':!![]})['then'](function(_0x4a1ce1){if(_0x4a1ce1&&_0x4a1ce1[_0xce80('0x4f')]===0x0){return db[_0xce80('0x23')][_0xce80('0x49')]({'name':_0xc420ef['name'],'resourceId':_0xc420ef['id'],'type':_0x4a1ce1['name'],'sectionId':_0x4a1ce1['id']},{})[_0xce80('0x20')](function(){return _0x58a336;});}else{return _0x58a336;}})['catch'](function(_0x10d90a){logger[_0xce80('0x26')](_0xce80('0x50'),_0x10d90a);throw _0x10d90a;});}return _0x58a336;})[_0xce80('0x20')](respondWithResult(_0x595662,0xc9))[_0xce80('0x43')](handleError(_0x595662,null));};exports[_0xce80('0x51')]=function(_0x2869cf,_0x3884d8){if(_0x2869cf[_0xce80('0x4a')]['id']){delete _0x2869cf[_0xce80('0x4a')]['id'];}return db[_0xce80('0x2b')]['find']({'where':{'id':_0x2869cf[_0xce80('0x52')]['id']}})[_0xce80('0x20')](handleEntityNotFound(_0x3884d8,null))[_0xce80('0x20')](saveUpdates(_0x2869cf[_0xce80('0x4a')],null))['then'](respondWithResult(_0x3884d8,null))[_0xce80('0x43')](handleError(_0x3884d8,null));};exports['destroy']=function(_0x46a4ad,_0x1cc190){return db[_0xce80('0x2b')][_0xce80('0x48')]({'where':{'id':_0x46a4ad[_0xce80('0x52')]['id']}})[_0xce80('0x20')](handleEntityNotFound(_0x1cc190,null))[_0xce80('0x20')](removeEntity(_0x1cc190,null))[_0xce80('0x43')](handleError(_0x1cc190,null));}; \ No newline at end of file +var _0xb11e=['limit','count','then','destroy','ChanSpies','UserProfileResource','sendStatus','error','name','send','index','VoiceChanSpy','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xb11e,0x7d));var _0xeb11=function(_0x5134e2,_0x1b45c3){_0x5134e2=_0x5134e2-0x0;var _0x12522d=_0xb11e[_0x5134e2];return _0x12522d;};'use strict';var emlformat=require(_0xeb11('0x0'));var rimraf=require(_0xeb11('0x1'));var zipdir=require(_0xeb11('0x2'));var jsonpatch=require(_0xeb11('0x3'));var rp=require(_0xeb11('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb11('0x5'));var util=require(_0xeb11('0x6'));var path=require(_0xeb11('0x7'));var sox=require(_0xeb11('0x8'));var csv=require('to-csv');var ejs=require(_0xeb11('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb11('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb11('0xb'));var toCsv=require(_0xeb11('0xc'));var querystring=require(_0xeb11('0xd'));var Papa=require('papaparse');var Redis=require(_0xeb11('0xe'));var authService=require(_0xeb11('0xf'));var qs=require(_0xeb11('0x10'));var as=require(_0xeb11('0x11'));var hardwareService=require(_0xeb11('0x12'));var logger=require(_0xeb11('0x13'))(_0xeb11('0x14'));var utils=require(_0xeb11('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeb11('0x16'));var db=require(_0xeb11('0x17'))['db'];function respondWithStatusCode(_0x15b1e4,_0x517962){_0x517962=_0x517962||0xcc;return function(_0x44b192){if(_0x44b192){return _0x15b1e4['sendStatus'](_0x517962);}return _0x15b1e4[_0xeb11('0x18')](_0x517962)['end']();};}function respondWithResult(_0x5d183d,_0x146cfa){_0x146cfa=_0x146cfa||0xc8;return function(_0x2e0d2c){if(_0x2e0d2c){return _0x5d183d[_0xeb11('0x18')](_0x146cfa)[_0xeb11('0x19')](_0x2e0d2c);}};}function respondWithFilteredResult(_0x4c6a67,_0x58d276){return function(_0x200730){if(_0x200730){var _0xd1a9bf=typeof _0x58d276[_0xeb11('0x1a')]==='undefined'&&typeof _0x58d276[_0xeb11('0x1b')]==='undefined';var _0x33a996=_0x200730[_0xeb11('0x1c')];var _0x139ff8=_0xd1a9bf?0x0:_0x58d276['offset'];var _0xf36770=_0xd1a9bf?_0x200730[_0xeb11('0x1c')]:_0x58d276['offset']+_0x58d276['limit'];var _0x1906db;if(_0xf36770>=_0x33a996){_0xf36770=_0x33a996;_0x1906db=0xc8;}else{_0x1906db=0xce;}_0x4c6a67[_0xeb11('0x18')](_0x1906db);return _0x4c6a67['set']('Content-Range',_0x139ff8+'-'+_0xf36770+'/'+_0x33a996)[_0xeb11('0x19')](_0x200730);}return null;};}function patchUpdates(_0xf057c){return function(_0x4dfe03){try{jsonpatch['apply'](_0x4dfe03,_0xf057c,!![]);}catch(_0x17af28){return BPromise['reject'](_0x17af28);}return _0x4dfe03['save']();};}function saveUpdates(_0x5779df,_0xeeb427){return function(_0x1caf4f){if(_0x1caf4f){return _0x1caf4f['update'](_0x5779df)[_0xeb11('0x1d')](function(_0x40a4cb){return _0x40a4cb;});}return null;};}function removeEntity(_0x53e48d,_0x1c526d){return function(_0x3b2e1a){if(_0x3b2e1a){return _0x3b2e1a[_0xeb11('0x1e')]()['then'](function(){var _0x640c79=_0x3b2e1a['get']({'plain':!![]});var _0x5b97b5=_0xeb11('0x1f');return db[_0xeb11('0x20')][_0xeb11('0x1e')]({'where':{'type':_0x5b97b5,'resourceId':_0x640c79['id']}})['then'](function(){return _0x3b2e1a;});})['then'](function(){_0x53e48d[_0xeb11('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39c0da,_0x45eeba){return function(_0x377abf){if(!_0x377abf){_0x39c0da[_0xeb11('0x21')](0x194);}return _0x377abf;};}function handleError(_0x289121,_0x4a0501){_0x4a0501=_0x4a0501||0x1f4;return function(_0x1d9bf7){logger[_0xeb11('0x22')](_0x1d9bf7['stack']);if(_0x1d9bf7[_0xeb11('0x23')]){delete _0x1d9bf7['name'];}_0x289121[_0xeb11('0x18')](_0x4a0501)[_0xeb11('0x24')](_0x1d9bf7);};}exports[_0xeb11('0x25')]=function(_0x6adeaa,_0x22e3d2){var _0x80f0d9={},_0x26ca49={},_0x2b7f14={'count':0x0,'rows':[]};var _0x322797=_['map'](db[_0xeb11('0x26')]['rawAttributes'],function(_0x10089d){return{'name':_0x10089d[_0xeb11('0x27')],'type':_0x10089d[_0xeb11('0x28')]['key']};});_0x26ca49['model']=_[_0xeb11('0x29')](_0x322797,_0xeb11('0x23'));_0x26ca49[_0xeb11('0x2a')]=_[_0xeb11('0x2b')](_0x6adeaa['query']);_0x26ca49[_0xeb11('0x2c')]=_[_0xeb11('0x2d')](_0x26ca49[_0xeb11('0x2e')],_0x26ca49['query']);_0x80f0d9[_0xeb11('0x2f')]=_['intersection'](_0x26ca49[_0xeb11('0x2e')],qs['fields'](_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x30')]));_0x80f0d9[_0xeb11('0x2f')]=_0x80f0d9[_0xeb11('0x2f')][_0xeb11('0x31')]?_0x80f0d9[_0xeb11('0x2f')]:_0x26ca49[_0xeb11('0x2e')];if(!_0x6adeaa['query'][_0xeb11('0x32')]('nolimit')){_0x80f0d9[_0xeb11('0x1b')]=qs['limit'](_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x1b')]);_0x80f0d9[_0xeb11('0x1a')]=qs[_0xeb11('0x1a')](_0x6adeaa['query'][_0xeb11('0x1a')]);}_0x80f0d9[_0xeb11('0x33')]=qs[_0xeb11('0x34')](_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x34')]);_0x80f0d9[_0xeb11('0x35')]=qs[_0xeb11('0x2c')](_[_0xeb11('0x36')](_0x6adeaa[_0xeb11('0x2a')],_0x26ca49[_0xeb11('0x2c')]),_0x322797);if(_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x37')]){_0x80f0d9[_0xeb11('0x35')]=_[_0xeb11('0x38')](_0x80f0d9[_0xeb11('0x35')],{'$or':_['map'](_0x322797,function(_0x16637b){if(_0x16637b['type']!==_0xeb11('0x39')){var _0xcdf358={};_0xcdf358[_0x16637b['name']]={'$like':'%'+_0x6adeaa['query'][_0xeb11('0x37')]+'%'};return _0xcdf358;}})});}_0x80f0d9=_[_0xeb11('0x38')]({},_0x80f0d9,_0x6adeaa[_0xeb11('0x3a')]);var _0x211ead={'where':_0x80f0d9['where']};return db[_0xeb11('0x26')][_0xeb11('0x1c')](_0x211ead)[_0xeb11('0x1d')](function(_0xffa000){_0x2b7f14['count']=_0xffa000;if(_0x6adeaa['query'][_0xeb11('0x3b')]){_0x80f0d9['include']=[{'all':!![]}];}return db[_0xeb11('0x26')][_0xeb11('0x3c')](_0x80f0d9);})[_0xeb11('0x1d')](function(_0xdf32e7){_0x2b7f14[_0xeb11('0x3d')]=_0xdf32e7;return _0x2b7f14;})[_0xeb11('0x1d')](respondWithFilteredResult(_0x22e3d2,_0x80f0d9))['catch'](handleError(_0x22e3d2,null));};exports['show']=function(_0x9a9daa,_0x1fd33c){var _0x28f8b4={'raw':![],'where':{'id':_0x9a9daa[_0xeb11('0x3e')]['id']}},_0x54023c={};_0x54023c[_0xeb11('0x2e')]=_[_0xeb11('0x2b')](db[_0xeb11('0x26')][_0xeb11('0x3f')]);_0x54023c['query']=_['keys'](_0x9a9daa[_0xeb11('0x2a')]);_0x54023c['filters']=_[_0xeb11('0x2d')](_0x54023c[_0xeb11('0x2e')],_0x54023c[_0xeb11('0x2a')]);_0x28f8b4[_0xeb11('0x2f')]=_[_0xeb11('0x2d')](_0x54023c[_0xeb11('0x2e')],qs['fields'](_0x9a9daa[_0xeb11('0x2a')][_0xeb11('0x30')]));_0x28f8b4[_0xeb11('0x2f')]=_0x28f8b4[_0xeb11('0x2f')][_0xeb11('0x31')]?_0x28f8b4['attributes']:_0x54023c[_0xeb11('0x2e')];if(_0x9a9daa[_0xeb11('0x2a')]['includeAll']){_0x28f8b4[_0xeb11('0x40')]=[{'all':!![]}];}_0x28f8b4=_[_0xeb11('0x38')]({},_0x28f8b4,_0x9a9daa[_0xeb11('0x3a')]);return db[_0xeb11('0x26')][_0xeb11('0x41')](_0x28f8b4)['then'](handleEntityNotFound(_0x1fd33c,null))['then'](respondWithResult(_0x1fd33c,null))[_0xeb11('0x42')](handleError(_0x1fd33c,null));};exports['create']=function(_0x355251,_0x2307ff){return db[_0xeb11('0x26')][_0xeb11('0x43')](_0x355251['body'],{})[_0xeb11('0x1d')](function(_0x12c628){var _0xdc38a1=_0x355251[_0xeb11('0x44')][_0xeb11('0x45')]({'plain':!![]});if(!_0xdc38a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xdc38a1['role']==='user'){var _0x315f87=_0x12c628[_0xeb11('0x45')]({'plain':!![]});var _0x49cfac='ChanSpies';return db[_0xeb11('0x46')]['find']({'where':{'name':_0x49cfac,'userProfileId':_0xdc38a1[_0xeb11('0x47')]},'raw':!![]})[_0xeb11('0x1d')](function(_0x362909){if(_0x362909&&_0x362909[_0xeb11('0x48')]===0x0){return db[_0xeb11('0x20')][_0xeb11('0x43')]({'name':_0x315f87[_0xeb11('0x23')],'resourceId':_0x315f87['id'],'type':_0x362909[_0xeb11('0x23')],'sectionId':_0x362909['id']},{})[_0xeb11('0x1d')](function(){return _0x12c628;});}else{return _0x12c628;}})[_0xeb11('0x42')](function(_0x3a4543){logger[_0xeb11('0x22')](_0xeb11('0x49'),_0x3a4543);throw _0x3a4543;});}return _0x12c628;})[_0xeb11('0x1d')](respondWithResult(_0x2307ff,0xc9))[_0xeb11('0x42')](handleError(_0x2307ff,null));};exports[_0xeb11('0x4a')]=function(_0x6ec5de,_0x45f413){if(_0x6ec5de['body']['id']){delete _0x6ec5de[_0xeb11('0x4b')]['id'];}return db[_0xeb11('0x26')][_0xeb11('0x41')]({'where':{'id':_0x6ec5de['params']['id']}})[_0xeb11('0x1d')](handleEntityNotFound(_0x45f413,null))[_0xeb11('0x1d')](saveUpdates(_0x6ec5de[_0xeb11('0x4b')],null))[_0xeb11('0x1d')](respondWithResult(_0x45f413,null))['catch'](handleError(_0x45f413,null));};exports[_0xeb11('0x1e')]=function(_0x6813d2,_0x1d769d){return db['VoiceChanSpy']['find']({'where':{'id':_0x6813d2[_0xeb11('0x3e')]['id']}})[_0xeb11('0x1d')](handleEntityNotFound(_0x1d769d,null))[_0xeb11('0x1d')](removeEntity(_0x1d769d,null))['catch'](handleError(_0x1d769d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d7d21be..4090bb9 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 _0x08fa=['record','StopMixMonitor','concat','internal','name','User','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','destroy','bluebird','from-sip','system','merge','Set','CDR(type)=%s','push','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','SIP/%s,%s','options','join'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x08fa,0x90));var _0xa08f=function(_0x1db5de,_0x37c0ef){_0x1db5de=_0x1db5de-0x0;var _0x4b165e=_0x08fa[_0x1db5de];return _0x4b165e;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xa08f('0x0'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3a9df3,_0x27d565,_0x3d0928){var _0x384931=0x1;var _0x1ffaaa=[];var _0xc44669={'context':_0x27d565['context']||_0xa08f('0x1'),'exten':util['format']('%s%s',_0x3a9df3['prefix'],_0x3d0928),'type':_0xa08f('0x2'),'isApp':![],'ChanSpyId':_0x3a9df3['id'],'UserId':_0x27d565['id']};_0x1ffaaa['push'](_[_0xa08f('0x3')]({'app':_0xa08f('0x4'),'appdata':util['format'](_0xa08f('0x5'),'chanspy'),'priority':_0x384931++},_0xc44669));if(_0x3a9df3['record']){_0x1ffaaa[_0xa08f('0x6')](_['merge']({'app':_0xa08f('0x7'),'appdata':util[_0xa08f('0x8')](_0xa08f('0x9'),_0x3a9df3[_0xa08f('0xa')]),'priority':_0x384931++},_0xc44669));}if(_0x3a9df3['auth']){_0x1ffaaa[_0xa08f('0x6')](_[_0xa08f('0x3')]({'app':'Authenticate','appdata':_0x3a9df3[_0xa08f('0xb')],'priority':_0x384931++},_0xc44669));}_0x1ffaaa[_0xa08f('0x6')](_[_0xa08f('0x3')]({'app':_0xa08f('0xc'),'appdata':util[_0xa08f('0x8')](_0xa08f('0xd'),_0x27d565['name'],_0x3a9df3[_0xa08f('0xe')]?_0x3a9df3['options'][_0xa08f('0xf')](''):''),'priority':_0x384931++},_0xc44669));if(_0x3a9df3[_0xa08f('0x10')]){_0x1ffaaa['push'](_['merge']({'app':_0xa08f('0x11'),'priority':_0x384931++},_0xc44669));}return _0x1ffaaa;};var getChanSpyApplications=function(_0x1e7c7c,_0xbf4fe2){var _0x587844=[];for(var _0xd5a9e9=0x0,_0xfc1a36=0x1;_0xd5a9e9<_0xbf4fe2['length'];_0xd5a9e9++,_0xfc1a36=0x1){_0x587844=_0x587844[_0xa08f('0x12')](getUserApplications(_0x1e7c7c,_0xbf4fe2[_0xd5a9e9],_0xbf4fe2[_0xd5a9e9][_0xa08f('0x13')]));if(_0xbf4fe2[_0xd5a9e9][_0xa08f('0x13')]!=_0xbf4fe2[_0xd5a9e9]['name']){_0x587844=_0x587844['concat'](getUserApplications(_0x1e7c7c,_0xbf4fe2[_0xd5a9e9],_0xbf4fe2[_0xd5a9e9][_0xa08f('0x14')]));}}return _0x587844;};var getChanSpyPromise=function(_0x295631,_0x32a7f9){return new BPromise(function(_0x5c6391,_0x24b0b8){return _0x295631[_0xa08f('0x15')]['findAll']({'attributes':['id',_0xa08f('0x14'),_0xa08f('0x13')],'where':{'role':_0xa08f('0x16'),'chanspy':!![]},'raw':!![]})[_0xa08f('0x17')](function(_0x2c62d1){if(_0x2c62d1){return _0x5c6391(getChanSpyApplications(_0x32a7f9,_0x2c62d1));}return _0x5c6391([]);})[_0xa08f('0x18')](function(_0x2b79ca){_0x24b0b8(_0x2b79ca);});});};module[_0xa08f('0x19')]=function(_0x20f551,_0x3384e8){var _0x207bec=_0x20f551[_0xa08f('0x1a')];return _0x20f551['define'](_0xa08f('0x1b'),attributes,{'tableName':_0xa08f('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x18b23d,_0x3952,_0x21a223){return getChanSpyPromise(_0x207bec,_0x18b23d)[_0xa08f('0x17')](function(_0x42cd52){if(_0x42cd52&&_0x42cd52[_0xa08f('0x1d')]){return _0x207bec[_0xa08f('0x1e')]['bulkCreate'](_0x42cd52);}})[_0xa08f('0x17')](function(){_0x21a223();})[_0xa08f('0x18')](function(_0x330eba){_0x21a223(_0x330eba);});},'afterUpdate':function(_0x1479f6,_0x5d7acf,_0x518817){return _0x207bec[_0xa08f('0x1e')][_0xa08f('0x1f')]({'where':{'ChanSpyId':_0x1479f6['id']}})[_0xa08f('0x17')](function(){return getChanSpyPromise(_0x207bec,_0x1479f6);})[_0xa08f('0x17')](function(_0x2835ae){if(_0x2835ae&&_0x2835ae[_0xa08f('0x1d')]){return _0x207bec[_0xa08f('0x1e')]['bulkCreate'](_0x2835ae);}})[_0xa08f('0x17')](function(){_0x518817();})['catch'](function(_0x29ff20){_0x518817(_0x29ff20);});},'afterDestroy':function(_0x2edb3b,_0x3d0f2d,_0x3a2188){return _0x207bec[_0xa08f('0x1e')][_0xa08f('0x1f')]({'where':{'ChanSpyId':_0x2edb3b['id']}})[_0xa08f('0x17')](function(){_0x3a2188();})['catch'](function(_0x4d3f02){_0x3a2188(_0x4d3f02);});}}});}; \ No newline at end of file +var _0x32ed=['agent','catch','exports','models','define','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','bluebird','context','from-sip','format','prefix','system','push','merge','Set','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll'];(function(_0x72d025,_0x352955){var _0x3ba96e=function(_0x294f2d){while(--_0x294f2d){_0x72d025['push'](_0x72d025['shift']());}};_0x3ba96e(++_0x352955);}(_0x32ed,0x79));var _0xd32e=function(_0x512d0f,_0x941d4b){_0x512d0f=_0x512d0f-0x0;var _0xfd4668=_0x32ed[_0x512d0f];return _0xfd4668;};'use strict';var _=require(_0xd32e('0x0'));var util=require('util');var BPromise=require(_0xd32e('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5ea2ba,_0x17930e,_0x201337){var _0x302273=0x1;var _0x383d35=[];var _0x5128e8={'context':_0x17930e[_0xd32e('0x2')]||_0xd32e('0x3'),'exten':util[_0xd32e('0x4')]('%s%s',_0x5ea2ba[_0xd32e('0x5')],_0x201337),'type':_0xd32e('0x6'),'isApp':![],'ChanSpyId':_0x5ea2ba['id'],'UserId':_0x17930e['id']};_0x383d35[_0xd32e('0x7')](_[_0xd32e('0x8')]({'app':_0xd32e('0x9'),'appdata':util[_0xd32e('0x4')]('CDR(type)=%s',_0xd32e('0xa')),'priority':_0x302273++},_0x5128e8));if(_0x5ea2ba[_0xd32e('0xb')]){_0x383d35['push'](_[_0xd32e('0x8')]({'app':'MixMonitor','appdata':util[_0xd32e('0x4')](_0xd32e('0xc'),_0x5ea2ba[_0xd32e('0xd')]),'priority':_0x302273++},_0x5128e8));}if(_0x5ea2ba[_0xd32e('0xe')]){_0x383d35[_0xd32e('0x7')](_[_0xd32e('0x8')]({'app':_0xd32e('0xf'),'appdata':_0x5ea2ba['password'],'priority':_0x302273++},_0x5128e8));}_0x383d35[_0xd32e('0x7')](_[_0xd32e('0x8')]({'app':_0xd32e('0x10'),'appdata':util['format'](_0xd32e('0x11'),_0x17930e[_0xd32e('0x12')],_0x5ea2ba[_0xd32e('0x13')]?_0x5ea2ba[_0xd32e('0x13')][_0xd32e('0x14')](''):''),'priority':_0x302273++},_0x5128e8));if(_0x5ea2ba[_0xd32e('0xb')]){_0x383d35[_0xd32e('0x7')](_[_0xd32e('0x8')]({'app':_0xd32e('0x15'),'priority':_0x302273++},_0x5128e8));}return _0x383d35;};var getChanSpyApplications=function(_0x2ef413,_0x55dfe8){var _0x1ebaa2=[];for(var _0x2456e8=0x0,_0x355e97=0x1;_0x2456e8<_0x55dfe8[_0xd32e('0x16')];_0x2456e8++,_0x355e97=0x1){_0x1ebaa2=_0x1ebaa2['concat'](getUserApplications(_0x2ef413,_0x55dfe8[_0x2456e8],_0x55dfe8[_0x2456e8][_0xd32e('0x17')]));if(_0x55dfe8[_0x2456e8][_0xd32e('0x17')]!=_0x55dfe8[_0x2456e8][_0xd32e('0x12')]){_0x1ebaa2=_0x1ebaa2[_0xd32e('0x18')](getUserApplications(_0x2ef413,_0x55dfe8[_0x2456e8],_0x55dfe8[_0x2456e8][_0xd32e('0x12')]));}}return _0x1ebaa2;};var getChanSpyPromise=function(_0x4f5012,_0x5c7a96){return new BPromise(function(_0x3329a6,_0x1e39d4){return _0x4f5012[_0xd32e('0x19')][_0xd32e('0x1a')]({'attributes':['id',_0xd32e('0x12'),_0xd32e('0x17')],'where':{'role':_0xd32e('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x93da78){if(_0x93da78){return _0x3329a6(getChanSpyApplications(_0x5c7a96,_0x93da78));}return _0x3329a6([]);})[_0xd32e('0x1c')](function(_0x446f6f){_0x1e39d4(_0x446f6f);});});};module[_0xd32e('0x1d')]=function(_0x513832,_0x815069){var _0x5ce29b=_0x513832[_0xd32e('0x1e')];return _0x513832[_0xd32e('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0xd32e('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4434c2,_0x598991,_0x59c3ee){return getChanSpyPromise(_0x5ce29b,_0x4434c2)[_0xd32e('0x21')](function(_0x4f6f8d){if(_0x4f6f8d&&_0x4f6f8d[_0xd32e('0x16')]){return _0x5ce29b[_0xd32e('0x22')][_0xd32e('0x23')](_0x4f6f8d);}})[_0xd32e('0x21')](function(){_0x59c3ee();})[_0xd32e('0x1c')](function(_0x3db962){_0x59c3ee(_0x3db962);});},'afterUpdate':function(_0x53fc01,_0x2f4919,_0x56ded5){return _0x5ce29b[_0xd32e('0x22')][_0xd32e('0x24')]({'where':{'ChanSpyId':_0x53fc01['id']}})[_0xd32e('0x21')](function(){return getChanSpyPromise(_0x5ce29b,_0x53fc01);})[_0xd32e('0x21')](function(_0x104c1b){if(_0x104c1b&&_0x104c1b['length']){return _0x5ce29b['VoiceExtension'][_0xd32e('0x23')](_0x104c1b);}})[_0xd32e('0x21')](function(){_0x56ded5();})[_0xd32e('0x1c')](function(_0x329f29){_0x56ded5(_0x329f29);});},'afterDestroy':function(_0xc5dd18,_0x1d3d40,_0xe936d7){return _0x5ce29b[_0xd32e('0x22')][_0xd32e('0x24')]({'where':{'ChanSpyId':_0xc5dd18['id']}})[_0xd32e('0x21')](function(){_0xe936d7();})[_0xd32e('0x1c')](function(_0x1e0d3a){_0xe936d7(_0x1e0d3a);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index ad1dd59..eebb352 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 _0xc788=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','VoiceChanSpy,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc788,0xc4));var _0x8c78=function(_0x380b8f,_0x32271d){_0x380b8f=_0x380b8f-0x0;var _0x646c69=_0xc788[_0x380b8f];return _0x646c69;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});} \ No newline at end of file +var _0x0bb5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4f842b,_0x190f61){var _0x678dbf=function(_0x1660da){while(--_0x1660da){_0x4f842b['push'](_0x4f842b['shift']());}};_0x678dbf(++_0x190f61);}(_0x0bb5,0x148));var _0x50bb=function(_0x346793,_0x576407){_0x346793=_0x346793-0x0;var _0x592145=_0x0bb5[_0x346793];return _0x592145;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d67c5dd..78113e1 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 _0xbad8=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x51806f,_0x53dad6){var _0x424bea=function(_0x54da82){while(--_0x54da82){_0x51806f['push'](_0x51806f['shift']());}};_0x424bea(++_0x53dad6);}(_0xbad8,0x18b));var _0x8bad=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0xbad8[_0x571c1d];return _0x33c609;};'use strict';var multer=require(_0x8bad('0x0'));var util=require(_0x8bad('0x1'));var path=require(_0x8bad('0x2'));var timeout=require(_0x8bad('0x3'));var express=require(_0x8bad('0x4'));var router=express[_0x8bad('0x5')]();var fs_extra=require(_0x8bad('0x6'));var auth=require(_0x8bad('0x7'));var interaction=require(_0x8bad('0x8'));var config=require('../../config/environment');var controller=require(_0x8bad('0x9'));router['get']('/',auth[_0x8bad('0xa')](),controller[_0x8bad('0xb')]);router[_0x8bad('0xc')](_0x8bad('0xd'),auth[_0x8bad('0xa')](),controller[_0x8bad('0xe')]);router[_0x8bad('0xf')]('/',auth[_0x8bad('0xa')](),controller[_0x8bad('0x10')]);router[_0x8bad('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8bad('0x12')]);router[_0x8bad('0x13')](_0x8bad('0xd'),auth[_0x8bad('0xa')](),controller[_0x8bad('0x14')]);module[_0x8bad('0x15')]=router; \ No newline at end of file +var _0x9390=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','post','/:id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9390,0x1f2));var _0x0939=function(_0x52e5c4,_0x560503){_0x52e5c4=_0x52e5c4-0x0;var _0x542343=_0x9390[_0x52e5c4];return _0x542343;};'use strict';var multer=require(_0x0939('0x0'));var util=require(_0x0939('0x1'));var path=require(_0x0939('0x2'));var timeout=require(_0x0939('0x3'));var express=require(_0x0939('0x4'));var router=express[_0x0939('0x5')]();var fs_extra=require(_0x0939('0x6'));var auth=require(_0x0939('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0939('0x8'));var controller=require(_0x0939('0x9'));router[_0x0939('0xa')]('/',auth[_0x0939('0xb')](),controller[_0x0939('0xc')]);router[_0x0939('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0939('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0939('0xe'),auth[_0x0939('0xb')](),controller[_0x0939('0xf')]);router[_0x0939('0x10')](_0x0939('0xe'),auth[_0x0939('0xb')](),controller[_0x0939('0x11')]);module[_0x0939('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f3184fa..6b0a2df 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 _0xab4f=['STRING','name','exports'];(function(_0x5608b1,_0x5772e3){var _0x19fb2d=function(_0x46515e){while(--_0x46515e){_0x5608b1['push'](_0x5608b1['shift']());}};_0x19fb2d(++_0x5772e3);}(_0xab4f,0x95));var _0xfab4=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xab4f[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');module[_0xfab4('0x0')]={'name':{'type':Sequelize[_0xfab4('0x1')],'unique':_0xfab4('0x2')},'description':{'type':Sequelize[_0xfab4('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5b3c=['name','BOOLEAN','STRING'];(function(_0x42eaff,_0x1f3d11){var _0x55c4bd=function(_0x3656f2){while(--_0x3656f2){_0x42eaff['push'](_0x42eaff['shift']());}};_0x55c4bd(++_0x1f3d11);}(_0x5b3c,0x1df));var _0xc5b3=function(_0xeac5c1,_0x31fc3f){_0xeac5c1=_0xeac5c1-0x0;var _0x5836bc=_0x5b3c[_0xeac5c1];return _0x5836bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc5b3('0x0')],'unique':_0xc5b3('0x1')},'description':{'type':Sequelize[_0xc5b3('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc5b3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 679c9f2..485251b 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 _0x0889=['save','update','then','Contexts','UserProfileResource','end','stack','name','index','map','VoiceContext','fieldName','key','keys','query','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','intersection','create','findAll','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','utf8','writeFileSync','chan_sip.so','destroy','readFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply'];(function(_0x5ae2c,_0x216476){var _0x3962fd=function(_0x4941e7){while(--_0x4941e7){_0x5ae2c['push'](_0x5ae2c['shift']());}};_0x3962fd(++_0x216476);}(_0x0889,0x9a));var _0x9088=function(_0x5a4c64,_0x4d4138){_0x5a4c64=_0x5a4c64-0x0;var _0xed35d2=_0x0889[_0x5a4c64];return _0xed35d2;};'use strict';var emlformat=require(_0x9088('0x0'));var rimraf=require(_0x9088('0x1'));var zipdir=require(_0x9088('0x2'));var jsonpatch=require(_0x9088('0x3'));var rp=require(_0x9088('0x4'));var moment=require(_0x9088('0x5'));var BPromise=require(_0x9088('0x6'));var Mustache=require(_0x9088('0x7'));var util=require(_0x9088('0x8'));var path=require(_0x9088('0x9'));var sox=require(_0x9088('0xa'));var csv=require(_0x9088('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9088('0xc'));var crypto=require(_0x9088('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9088('0xe'));var toCsv=require(_0x9088('0xb'));var querystring=require('querystring');var Papa=require(_0x9088('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9088('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9088('0x11'));var logger=require(_0x9088('0x12'))('api');var utils=require(_0x9088('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9088('0x14'))['db'];var jayson=require(_0x9088('0x15'));var client=jayson[_0x9088('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b9393,_0x556550,_0x16b7a8,_0x1967bf){return new BPromise(function(_0x46d652,_0x473dff){var _0xabc9db=_0x1967bf||client;return _0xabc9db[_0x9088('0x17')](_0x3b9393,_0x16b7a8)['then'](function(_0x5bfc7b){logger[_0x9088('0x18')]('VoiceContext,\x20%s,\x20%s',_0x556550,_0x9088('0x19'));logger[_0x9088('0x1a')](_0x9088('0x1b'),_0x556550,_0x9088('0x19'),JSON['stringify'](_0x5bfc7b));if(_0x5bfc7b[_0x9088('0x1c')]){if(_0x5bfc7b[_0x9088('0x1c')][_0x9088('0x1d')]===0x1f4){logger[_0x9088('0x1c')](_0x9088('0x1e'),_0x556550,_0x5bfc7b[_0x9088('0x1c')][_0x9088('0x1f')]);return _0x473dff(_0x5bfc7b[_0x9088('0x1c')]['message']);}logger[_0x9088('0x1c')](_0x9088('0x1e'),_0x556550,_0x5bfc7b[_0x9088('0x1c')][_0x9088('0x1f')]);return _0x46d652(_0x5bfc7b[_0x9088('0x1c')][_0x9088('0x1f')]);}else{logger['info'](_0x9088('0x1e'),_0x556550,'request\x20sent');_0x46d652(_0x5bfc7b[_0x9088('0x20')]['message']);}})['catch'](function(_0x10d454){logger[_0x9088('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x556550,_0x10d454);_0x473dff(_0x10d454);});});}function respondWithStatusCode(_0xb36d78,_0x48106c){_0x48106c=_0x48106c||0xcc;return function(_0x16eb4e){if(_0x16eb4e){return _0xb36d78[_0x9088('0x21')](_0x48106c);}return _0xb36d78[_0x9088('0x22')](_0x48106c)['end']();};}function respondWithResult(_0x51a3a4,_0x1d6e65){_0x1d6e65=_0x1d6e65||0xc8;return function(_0x3157af){if(_0x3157af){return _0x51a3a4[_0x9088('0x22')](_0x1d6e65)['json'](_0x3157af);}};}function respondWithFilteredResult(_0x2d54b4,_0x61dde7){return function(_0x538863){if(_0x538863){var _0x23584c=typeof _0x61dde7[_0x9088('0x23')]===_0x9088('0x24')&&typeof _0x61dde7['limit']===_0x9088('0x24');var _0xac5356=_0x538863[_0x9088('0x25')];var _0x136069=_0x23584c?0x0:_0x61dde7[_0x9088('0x23')];var _0x289bcc=_0x23584c?_0x538863[_0x9088('0x25')]:_0x61dde7[_0x9088('0x23')]+_0x61dde7[_0x9088('0x26')];var _0x4b306b;if(_0x289bcc>=_0xac5356){_0x289bcc=_0xac5356;_0x4b306b=0xc8;}else{_0x4b306b=0xce;}_0x2d54b4[_0x9088('0x22')](_0x4b306b);return _0x2d54b4['set'](_0x9088('0x27'),_0x136069+'-'+_0x289bcc+'/'+_0xac5356)[_0x9088('0x28')](_0x538863);}return null;};}function patchUpdates(_0x7fcd8a){return function(_0x5d462a){try{jsonpatch[_0x9088('0x29')](_0x5d462a,_0x7fcd8a,!![]);}catch(_0x7074c3){return BPromise['reject'](_0x7074c3);}return _0x5d462a[_0x9088('0x2a')]();};}function saveUpdates(_0x3134ff,_0x5ea317){return function(_0x46ad6d){if(_0x46ad6d){return _0x46ad6d[_0x9088('0x2b')](_0x3134ff)[_0x9088('0x2c')](function(_0x4b0c63){return _0x4b0c63;});}return null;};}function removeEntity(_0x1129e0,_0xbc2793){return function(_0x5d73e6){if(_0x5d73e6){return _0x5d73e6['destroy']()[_0x9088('0x2c')](function(){var _0x3f0230=_0x5d73e6['get']({'plain':!![]});var _0x2db6b4=_0x9088('0x2d');return db[_0x9088('0x2e')]['destroy']({'where':{'type':_0x2db6b4,'resourceId':_0x3f0230['id']}})['then'](function(){return _0x5d73e6;});})[_0x9088('0x2c')](function(){_0x1129e0[_0x9088('0x22')](0xcc)[_0x9088('0x2f')]();});}};}function handleEntityNotFound(_0x5ecab4,_0x1262e2){return function(_0x53afb8){if(!_0x53afb8){_0x5ecab4['sendStatus'](0x194);}return _0x53afb8;};}function handleError(_0x4d5dbf,_0x174845){_0x174845=_0x174845||0x1f4;return function(_0x2da0d6){logger[_0x9088('0x1c')](_0x2da0d6[_0x9088('0x30')]);if(_0x2da0d6[_0x9088('0x31')]){delete _0x2da0d6[_0x9088('0x31')];}_0x4d5dbf['status'](_0x174845)['send'](_0x2da0d6);};}exports[_0x9088('0x32')]=function(_0xb69b3,_0x234da7){var _0xae6745={},_0x31d769={},_0x5da2d3={'count':0x0,'rows':[]};var _0x4d4c40=_[_0x9088('0x33')](db[_0x9088('0x34')]['rawAttributes'],function(_0x27a9fd){return{'name':_0x27a9fd[_0x9088('0x35')],'type':_0x27a9fd['type'][_0x9088('0x36')]};});_0x31d769['model']=_[_0x9088('0x33')](_0x4d4c40,'name');_0x31d769['query']=_[_0x9088('0x37')](_0xb69b3[_0x9088('0x38')]);_0x31d769['filters']=_['intersection'](_0x31d769[_0x9088('0x39')],_0x31d769['query']);_0xae6745[_0x9088('0x3a')]=_['intersection'](_0x31d769[_0x9088('0x39')],qs[_0x9088('0x3b')](_0xb69b3[_0x9088('0x38')][_0x9088('0x3b')]));_0xae6745[_0x9088('0x3a')]=_0xae6745[_0x9088('0x3a')]['length']?_0xae6745['attributes']:_0x31d769[_0x9088('0x39')];if(!_0xb69b3[_0x9088('0x38')][_0x9088('0x3c')]('nolimit')){_0xae6745['limit']=qs[_0x9088('0x26')](_0xb69b3[_0x9088('0x38')][_0x9088('0x26')]);_0xae6745[_0x9088('0x23')]=qs['offset'](_0xb69b3[_0x9088('0x38')][_0x9088('0x23')]);}_0xae6745['order']=qs[_0x9088('0x3d')](_0xb69b3[_0x9088('0x38')][_0x9088('0x3d')]);_0xae6745[_0x9088('0x3e')]=qs[_0x9088('0x3f')](_[_0x9088('0x40')](_0xb69b3[_0x9088('0x38')],_0x31d769[_0x9088('0x3f')]),_0x4d4c40);if(_0xb69b3[_0x9088('0x38')][_0x9088('0x41')]){_0xae6745[_0x9088('0x3e')]=_[_0x9088('0x42')](_0xae6745[_0x9088('0x3e')],{'$or':_[_0x9088('0x33')](_0x4d4c40,function(_0x4bf522){if(_0x4bf522['type']!==_0x9088('0x43')){var _0x4ce006={};_0x4ce006[_0x4bf522[_0x9088('0x31')]]={'$like':'%'+_0xb69b3[_0x9088('0x38')][_0x9088('0x41')]+'%'};return _0x4ce006;}})});}_0xae6745=_[_0x9088('0x42')]({},_0xae6745,_0xb69b3[_0x9088('0x44')]);var _0x402e2d={'where':_0xae6745[_0x9088('0x3e')]};return db[_0x9088('0x34')][_0x9088('0x25')](_0x402e2d)[_0x9088('0x2c')](function(_0x549385){_0x5da2d3[_0x9088('0x25')]=_0x549385;if(_0xb69b3[_0x9088('0x38')][_0x9088('0x45')]){_0xae6745[_0x9088('0x46')]=[{'all':!![]}];}return db[_0x9088('0x34')]['findAll'](_0xae6745);})[_0x9088('0x2c')](function(_0x350378){_0x5da2d3['rows']=_0x350378;return _0x5da2d3;})[_0x9088('0x2c')](respondWithFilteredResult(_0x234da7,_0xae6745))[_0x9088('0x47')](handleError(_0x234da7,null));};exports['show']=function(_0x5753a0,_0x192bbc){var _0x1d7eb9={'raw':![],'where':{'id':_0x5753a0[_0x9088('0x48')]['id']}},_0x55a225={};_0x55a225[_0x9088('0x39')]=_[_0x9088('0x37')](db['VoiceContext'][_0x9088('0x49')]);_0x55a225['query']=_[_0x9088('0x37')](_0x5753a0[_0x9088('0x38')]);_0x55a225[_0x9088('0x3f')]=_[_0x9088('0x4a')](_0x55a225[_0x9088('0x39')],_0x55a225[_0x9088('0x38')]);_0x1d7eb9[_0x9088('0x3a')]=_[_0x9088('0x4a')](_0x55a225['model'],qs[_0x9088('0x3b')](_0x5753a0[_0x9088('0x38')]['fields']));_0x1d7eb9[_0x9088('0x3a')]=_0x1d7eb9[_0x9088('0x3a')]['length']?_0x1d7eb9['attributes']:_0x55a225[_0x9088('0x39')];if(_0x5753a0[_0x9088('0x38')][_0x9088('0x45')]){_0x1d7eb9[_0x9088('0x46')]=[{'all':!![]}];}_0x1d7eb9=_['merge']({},_0x1d7eb9,_0x5753a0['options']);return db[_0x9088('0x34')]['find'](_0x1d7eb9)['then'](handleEntityNotFound(_0x192bbc,null))[_0x9088('0x2c')](respondWithResult(_0x192bbc,null))['catch'](handleError(_0x192bbc,null));};exports[_0x9088('0x4b')]=function(_0x346339,_0x5a2299,_0x4e88fb){var _0x17104a;return db[_0x9088('0x34')][_0x9088('0x4b')](_0x346339['body'],{'raw':!![]})[_0x9088('0x2c')](function(_0x11abf0){_0x17104a=_0x11abf0;return db[_0x9088('0x34')][_0x9088('0x4c')]({'raw':!![]});})['then'](function(_0x59f352){var _0x2d02e9=fs['readFileSync'](path[_0x9088('0x4d')](config[_0x9088('0x4e')],_0x9088('0x4f')),'utf8');var _0x43e0ed=ejs[_0x9088('0x50')](_0x2d02e9,{'contexts':_0x59f352||[]});fs['writeFileSync'](_0x9088('0x51'),_0x43e0ed);})[_0x9088('0x2c')](function(){return respondWithRpcPromise(_0x9088('0x52'),_0x9088('0x4b'),{'module':'chan_sip.so'});})[_0x9088('0x2c')](function(){var _0x2dae59=_0x346339['user'][_0x9088('0x53')]({'plain':!![]});if(!_0x2dae59)throw new Error(_0x9088('0x54'));if(_0x2dae59[_0x9088('0x55')]===_0x9088('0x56')){var _0x36b27f=_0x17104a['get']({'plain':!![]});return db[_0x9088('0x57')][_0x9088('0x58')]({'where':{'name':_0x9088('0x2d'),'userProfileId':_0x2dae59[_0x9088('0x59')]},'raw':!![]})['then'](function(_0x4341ce){if(_0x4341ce&&_0x4341ce[_0x9088('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x36b27f[_0x9088('0x31')],'resourceId':_0x36b27f['id'],'type':_0x4341ce['name'],'sectionId':_0x4341ce['id']},{})[_0x9088('0x2c')](function(){return _0x17104a;});}else{return _0x17104a;}})[_0x9088('0x47')](function(_0x267879){logger[_0x9088('0x1c')](_0x9088('0x5b'),_0x267879);throw _0x267879;});}return _0x17104a;})[_0x9088('0x2c')](respondWithResult(_0x5a2299,0xc9))[_0x9088('0x47')](handleError(_0x5a2299,null));};exports[_0x9088('0x2b')]=function(_0x54f601,_0x260f8a,_0x185621){var _0x2e6058;return db[_0x9088('0x34')][_0x9088('0x58')]({'where':{'id':_0x54f601[_0x9088('0x48')]['id']}})[_0x9088('0x2c')](handleEntityNotFound(_0x260f8a,null))[_0x9088('0x2c')](saveUpdates(_0x54f601[_0x9088('0x5c')],null))[_0x9088('0x2c')](function(_0x3cd3ec){if(_0x3cd3ec){_0x2e6058=_0x3cd3ec;return db[_0x9088('0x34')][_0x9088('0x4c')]({'raw':!![]});}})[_0x9088('0x2c')](function(_0x166e2b){var _0x5ed281=fs['readFileSync'](path['join'](config[_0x9088('0x4e')],_0x9088('0x4f')),_0x9088('0x5d'));var _0x32cc37=ejs['render'](_0x5ed281,{'contexts':_0x166e2b||[]});fs[_0x9088('0x5e')](_0x9088('0x51'),_0x32cc37);})[_0x9088('0x2c')](function(){return respondWithRpcPromise(_0x9088('0x52'),_0x9088('0x2b'),{'module':_0x9088('0x5f')});})[_0x9088('0x2c')](function(){return _0x2e6058;})[_0x9088('0x2c')](respondWithResult(_0x260f8a,null))['catch'](handleError(_0x260f8a,null));};exports[_0x9088('0x60')]=function(_0x437b76,_0x4c13d1,_0x5d5a29){var _0x1971ba;return db['VoiceContext'][_0x9088('0x58')]({'where':{'id':_0x437b76[_0x9088('0x48')]['id']}})[_0x9088('0x2c')](handleEntityNotFound(_0x4c13d1,null))[_0x9088('0x2c')](removeEntity(_0x4c13d1,null))[_0x9088('0x2c')](function(){return db[_0x9088('0x34')][_0x9088('0x4c')]({'raw':!![]});})[_0x9088('0x2c')](function(_0x26ea51){var _0x4b2cce=fs[_0x9088('0x61')](path['join'](config['root'],_0x9088('0x4f')),_0x9088('0x5d'));var _0x1a48be=ejs[_0x9088('0x50')](_0x4b2cce,{'contexts':_0x26ea51});fs[_0x9088('0x5e')](_0x9088('0x51'),_0x1a48be);return respondWithRpcPromise(_0x9088('0x52'),_0x9088('0x60'),{'module':_0x9088('0x5f')});})['catch'](handleError(_0x4c13d1,null));}; \ No newline at end of file +var _0xb033=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xb033,0xbe));var _0x3b03=function(_0x4c3a5b,_0x3d5a83){_0x4c3a5b=_0x4c3a5b-0x0;var _0x2f592e=_0xb033[_0x4c3a5b];return _0x2f592e;};'use strict';var emlformat=require(_0x3b03('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3b03('0x1'));var rp=require(_0x3b03('0x2'));var moment=require('moment');var BPromise=require(_0x3b03('0x3'));var Mustache=require(_0x3b03('0x4'));var util=require(_0x3b03('0x5'));var path=require('path');var sox=require(_0x3b03('0x6'));var csv=require('to-csv');var ejs=require(_0x3b03('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b03('0x8'));var squel=require(_0x3b03('0x9'));var crypto=require(_0x3b03('0xa'));var jsforce=require(_0x3b03('0xb'));var deskjs=require(_0x3b03('0xc'));var toCsv=require(_0x3b03('0xd'));var querystring=require(_0x3b03('0xe'));var Papa=require(_0x3b03('0xf'));var Redis=require(_0x3b03('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b03('0x11'));var as=require(_0x3b03('0x12'));var hardwareService=require(_0x3b03('0x13'));var logger=require(_0x3b03('0x14'))(_0x3b03('0x15'));var utils=require(_0x3b03('0x16'));var config=require(_0x3b03('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b03('0x18'))['db'];var jayson=require(_0x3b03('0x19'));var client=jayson['client'][_0x3b03('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5e857f,_0x339b2d,_0x577c43,_0x4a25e9){return new BPromise(function(_0x35fda5,_0x280d37){var _0x221379=_0x4a25e9||client;return _0x221379[_0x3b03('0x1b')](_0x5e857f,_0x577c43)[_0x3b03('0x1c')](function(_0x55b215){logger[_0x3b03('0x1d')](_0x3b03('0x1e'),_0x339b2d,_0x3b03('0x1f'));logger[_0x3b03('0x20')](_0x3b03('0x21'),_0x339b2d,_0x3b03('0x1f'),JSON[_0x3b03('0x22')](_0x55b215));if(_0x55b215['error']){if(_0x55b215[_0x3b03('0x23')]['code']===0x1f4){logger[_0x3b03('0x23')](_0x3b03('0x1e'),_0x339b2d,_0x55b215[_0x3b03('0x23')][_0x3b03('0x24')]);return _0x280d37(_0x55b215[_0x3b03('0x23')][_0x3b03('0x24')]);}logger[_0x3b03('0x23')](_0x3b03('0x1e'),_0x339b2d,_0x55b215['error'][_0x3b03('0x24')]);return _0x35fda5(_0x55b215[_0x3b03('0x23')]['message']);}else{logger['info'](_0x3b03('0x1e'),_0x339b2d,_0x3b03('0x1f'));_0x35fda5(_0x55b215[_0x3b03('0x25')][_0x3b03('0x24')]);}})[_0x3b03('0x26')](function(_0x277394){logger[_0x3b03('0x23')]('VoiceContext,\x20%s,\x20%s',_0x339b2d,_0x277394);_0x280d37(_0x277394);});});}function respondWithStatusCode(_0xe6adfe,_0x4516e6){_0x4516e6=_0x4516e6||0xcc;return function(_0x3641e9){if(_0x3641e9){return _0xe6adfe[_0x3b03('0x27')](_0x4516e6);}return _0xe6adfe[_0x3b03('0x28')](_0x4516e6)[_0x3b03('0x29')]();};}function respondWithResult(_0x2d7bdb,_0x2fa8ea){_0x2fa8ea=_0x2fa8ea||0xc8;return function(_0x3d6c63){if(_0x3d6c63){return _0x2d7bdb[_0x3b03('0x28')](_0x2fa8ea)[_0x3b03('0x2a')](_0x3d6c63);}};}function respondWithFilteredResult(_0x151ac4,_0x28437f){return function(_0xdf717c){if(_0xdf717c){var _0x252314=typeof _0x28437f[_0x3b03('0x2b')]===_0x3b03('0x2c')&&typeof _0x28437f[_0x3b03('0x2d')]==='undefined';var _0x489c8f=_0xdf717c['count'];var _0x339e72=_0x252314?0x0:_0x28437f[_0x3b03('0x2b')];var _0x2981ed=_0x252314?_0xdf717c[_0x3b03('0x2e')]:_0x28437f['offset']+_0x28437f['limit'];var _0x51530f;if(_0x2981ed>=_0x489c8f){_0x2981ed=_0x489c8f;_0x51530f=0xc8;}else{_0x51530f=0xce;}_0x151ac4[_0x3b03('0x28')](_0x51530f);return _0x151ac4['set'](_0x3b03('0x2f'),_0x339e72+'-'+_0x2981ed+'/'+_0x489c8f)['json'](_0xdf717c);}return null;};}function patchUpdates(_0x27d0a4){return function(_0x1ce3ed){try{jsonpatch[_0x3b03('0x30')](_0x1ce3ed,_0x27d0a4,!![]);}catch(_0x162bf3){return BPromise['reject'](_0x162bf3);}return _0x1ce3ed[_0x3b03('0x31')]();};}function saveUpdates(_0x55d680,_0x528e38){return function(_0x499d1a){if(_0x499d1a){return _0x499d1a['update'](_0x55d680)[_0x3b03('0x1c')](function(_0x207c31){return _0x207c31;});}return null;};}function removeEntity(_0xfd2e60,_0x37adff){return function(_0x43f4ce){if(_0x43f4ce){return _0x43f4ce[_0x3b03('0x32')]()[_0x3b03('0x1c')](function(){var _0x56d1c9=_0x43f4ce[_0x3b03('0x33')]({'plain':!![]});var _0x76d436=_0x3b03('0x34');return db[_0x3b03('0x35')][_0x3b03('0x32')]({'where':{'type':_0x76d436,'resourceId':_0x56d1c9['id']}})[_0x3b03('0x1c')](function(){return _0x43f4ce;});})[_0x3b03('0x1c')](function(){_0xfd2e60[_0x3b03('0x28')](0xcc)[_0x3b03('0x29')]();});}};}function handleEntityNotFound(_0x5cd710,_0x236fa7){return function(_0x400e50){if(!_0x400e50){_0x5cd710[_0x3b03('0x27')](0x194);}return _0x400e50;};}function handleError(_0x1b199b,_0x1fa46d){_0x1fa46d=_0x1fa46d||0x1f4;return function(_0x22bdf1){logger[_0x3b03('0x23')](_0x22bdf1[_0x3b03('0x36')]);if(_0x22bdf1[_0x3b03('0x37')]){delete _0x22bdf1[_0x3b03('0x37')];}_0x1b199b[_0x3b03('0x28')](_0x1fa46d)[_0x3b03('0x38')](_0x22bdf1);};}exports[_0x3b03('0x39')]=function(_0x396977,_0x51ea13){var _0x2d10ac={},_0x5643f2={},_0x394de5={'count':0x0,'rows':[]};var _0x3fec3f=_[_0x3b03('0x3a')](db[_0x3b03('0x3b')][_0x3b03('0x3c')],function(_0x17fba7){return{'name':_0x17fba7[_0x3b03('0x3d')],'type':_0x17fba7[_0x3b03('0x3e')]['key']};});_0x5643f2[_0x3b03('0x3f')]=_[_0x3b03('0x3a')](_0x3fec3f,_0x3b03('0x37'));_0x5643f2[_0x3b03('0x40')]=_[_0x3b03('0x41')](_0x396977['query']);_0x5643f2[_0x3b03('0x42')]=_[_0x3b03('0x43')](_0x5643f2[_0x3b03('0x3f')],_0x5643f2[_0x3b03('0x40')]);_0x2d10ac['attributes']=_['intersection'](_0x5643f2[_0x3b03('0x3f')],qs[_0x3b03('0x44')](_0x396977[_0x3b03('0x40')][_0x3b03('0x44')]));_0x2d10ac[_0x3b03('0x45')]=_0x2d10ac[_0x3b03('0x45')][_0x3b03('0x46')]?_0x2d10ac[_0x3b03('0x45')]:_0x5643f2[_0x3b03('0x3f')];if(!_0x396977[_0x3b03('0x40')]['hasOwnProperty'](_0x3b03('0x47'))){_0x2d10ac[_0x3b03('0x2d')]=qs[_0x3b03('0x2d')](_0x396977['query'][_0x3b03('0x2d')]);_0x2d10ac['offset']=qs['offset'](_0x396977[_0x3b03('0x40')][_0x3b03('0x2b')]);}_0x2d10ac[_0x3b03('0x48')]=qs[_0x3b03('0x49')](_0x396977[_0x3b03('0x40')][_0x3b03('0x49')]);_0x2d10ac[_0x3b03('0x4a')]=qs['filters'](_[_0x3b03('0x4b')](_0x396977[_0x3b03('0x40')],_0x5643f2['filters']),_0x3fec3f);if(_0x396977[_0x3b03('0x40')][_0x3b03('0x4c')]){_0x2d10ac[_0x3b03('0x4a')]=_[_0x3b03('0x4d')](_0x2d10ac[_0x3b03('0x4a')],{'$or':_[_0x3b03('0x3a')](_0x3fec3f,function(_0x3d44ca){if(_0x3d44ca[_0x3b03('0x3e')]!==_0x3b03('0x4e')){var _0x1fc65c={};_0x1fc65c[_0x3d44ca['name']]={'$like':'%'+_0x396977[_0x3b03('0x40')]['filter']+'%'};return _0x1fc65c;}})});}_0x2d10ac=_[_0x3b03('0x4d')]({},_0x2d10ac,_0x396977['options']);var _0x155600={'where':_0x2d10ac[_0x3b03('0x4a')]};return db[_0x3b03('0x3b')][_0x3b03('0x2e')](_0x155600)[_0x3b03('0x1c')](function(_0xc8aa0c){_0x394de5[_0x3b03('0x2e')]=_0xc8aa0c;if(_0x396977[_0x3b03('0x40')][_0x3b03('0x4f')]){_0x2d10ac[_0x3b03('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x3b03('0x51')](_0x2d10ac);})[_0x3b03('0x1c')](function(_0x1b531f){_0x394de5[_0x3b03('0x52')]=_0x1b531f;return _0x394de5;})[_0x3b03('0x1c')](respondWithFilteredResult(_0x51ea13,_0x2d10ac))['catch'](handleError(_0x51ea13,null));};exports[_0x3b03('0x53')]=function(_0x35128c,_0x4c6117){var _0x48d368={'raw':![],'where':{'id':_0x35128c[_0x3b03('0x54')]['id']}},_0x155046={};_0x155046[_0x3b03('0x3f')]=_['keys'](db[_0x3b03('0x3b')][_0x3b03('0x3c')]);_0x155046[_0x3b03('0x40')]=_[_0x3b03('0x41')](_0x35128c[_0x3b03('0x40')]);_0x155046['filters']=_['intersection'](_0x155046['model'],_0x155046[_0x3b03('0x40')]);_0x48d368['attributes']=_[_0x3b03('0x43')](_0x155046['model'],qs['fields'](_0x35128c[_0x3b03('0x40')]['fields']));_0x48d368[_0x3b03('0x45')]=_0x48d368[_0x3b03('0x45')][_0x3b03('0x46')]?_0x48d368[_0x3b03('0x45')]:_0x155046[_0x3b03('0x3f')];if(_0x35128c['query']['includeAll']){_0x48d368['include']=[{'all':!![]}];}_0x48d368=_[_0x3b03('0x4d')]({},_0x48d368,_0x35128c[_0x3b03('0x55')]);return db[_0x3b03('0x3b')][_0x3b03('0x56')](_0x48d368)[_0x3b03('0x1c')](handleEntityNotFound(_0x4c6117,null))['then'](respondWithResult(_0x4c6117,null))[_0x3b03('0x26')](handleError(_0x4c6117,null));};exports[_0x3b03('0x57')]=function(_0x169ef4,_0x5d4379,_0xa4acb){var _0x1ad4b7;return db[_0x3b03('0x3b')][_0x3b03('0x57')](_0x169ef4[_0x3b03('0x58')],{'raw':!![]})[_0x3b03('0x1c')](function(_0x223036){_0x1ad4b7=_0x223036;return db['VoiceContext'][_0x3b03('0x51')]({'raw':!![]});})[_0x3b03('0x1c')](function(_0x3033b5){var _0x32ae78=fs[_0x3b03('0x59')](path[_0x3b03('0x5a')](config[_0x3b03('0x5b')],_0x3b03('0x5c')),_0x3b03('0x5d'));var _0x336bbb=ejs[_0x3b03('0x5e')](_0x32ae78,{'contexts':_0x3033b5||[]});fs[_0x3b03('0x5f')](_0x3b03('0x60'),_0x336bbb);})[_0x3b03('0x1c')](function(){return respondWithRpcPromise(_0x3b03('0x61'),'create',{'module':_0x3b03('0x62')});})['then'](function(){var _0x2a78a9=_0x169ef4['user'][_0x3b03('0x33')]({'plain':!![]});if(!_0x2a78a9)throw new Error(_0x3b03('0x63'));if(_0x2a78a9[_0x3b03('0x64')]===_0x3b03('0x65')){var _0x982415=_0x1ad4b7[_0x3b03('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x3b03('0x56')]({'where':{'name':_0x3b03('0x34'),'userProfileId':_0x2a78a9[_0x3b03('0x66')]},'raw':!![]})[_0x3b03('0x1c')](function(_0xd04de8){if(_0xd04de8&&_0xd04de8['autoAssociation']===0x0){return db[_0x3b03('0x35')]['create']({'name':_0x982415[_0x3b03('0x37')],'resourceId':_0x982415['id'],'type':_0xd04de8[_0x3b03('0x37')],'sectionId':_0xd04de8['id']},{})[_0x3b03('0x1c')](function(){return _0x1ad4b7;});}else{return _0x1ad4b7;}})[_0x3b03('0x26')](function(_0x18bb91){logger[_0x3b03('0x23')](_0x3b03('0x67'),_0x18bb91);throw _0x18bb91;});}return _0x1ad4b7;})['then'](respondWithResult(_0x5d4379,0xc9))['catch'](handleError(_0x5d4379,null));};exports[_0x3b03('0x68')]=function(_0x5cdcf9,_0x2dfae6,_0x518f1d){var _0x241044;return db[_0x3b03('0x3b')]['find']({'where':{'id':_0x5cdcf9[_0x3b03('0x54')]['id']}})[_0x3b03('0x1c')](handleEntityNotFound(_0x2dfae6,null))[_0x3b03('0x1c')](saveUpdates(_0x5cdcf9[_0x3b03('0x58')],null))[_0x3b03('0x1c')](function(_0x10ad4d){if(_0x10ad4d){_0x241044=_0x10ad4d;return db['VoiceContext'][_0x3b03('0x51')]({'raw':!![]});}})[_0x3b03('0x1c')](function(_0x589027){var _0x4b1855=fs[_0x3b03('0x59')](path[_0x3b03('0x5a')](config[_0x3b03('0x5b')],_0x3b03('0x5c')),_0x3b03('0x5d'));var _0x2007d4=ejs['render'](_0x4b1855,{'contexts':_0x589027||[]});fs[_0x3b03('0x5f')](_0x3b03('0x60'),_0x2007d4);})[_0x3b03('0x1c')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x3b03('0x62')});})[_0x3b03('0x1c')](function(){return _0x241044;})[_0x3b03('0x1c')](respondWithResult(_0x2dfae6,null))[_0x3b03('0x26')](handleError(_0x2dfae6,null));};exports[_0x3b03('0x32')]=function(_0x1de790,_0x21437a,_0x5db636){var _0x1d71ab;return db[_0x3b03('0x3b')][_0x3b03('0x56')]({'where':{'id':_0x1de790['params']['id']}})[_0x3b03('0x1c')](handleEntityNotFound(_0x21437a,null))[_0x3b03('0x1c')](removeEntity(_0x21437a,null))[_0x3b03('0x1c')](function(){return db['VoiceContext'][_0x3b03('0x51')]({'raw':!![]});})[_0x3b03('0x1c')](function(_0x56e506){var _0x228ebc=fs[_0x3b03('0x59')](path['join'](config[_0x3b03('0x5b')],'server/files/templates/context.ejs'),_0x3b03('0x5d'));var _0x5a01f8=ejs['render'](_0x228ebc,{'contexts':_0x56e506});fs[_0x3b03('0x5f')](_0x3b03('0x60'),_0x5a01f8);return respondWithRpcPromise('Reload',_0x3b03('0x32'),{'module':_0x3b03('0x62')});})[_0x3b03('0x26')](handleError(_0x21437a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index a266b07..25bd16d 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 _0x832c=['../../config/environment','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','bluebird'];(function(_0x5565d9,_0xd96730){var _0x2ad4f0=function(_0x1950ad){while(--_0x1950ad){_0x5565d9['push'](_0x5565d9['shift']());}};_0x2ad4f0(++_0xd96730);}(_0x832c,0x1e5));var _0xc832=function(_0x7f681f,_0x59759a){_0x7f681f=_0x7f681f-0x0;var _0x141025=_0x832c[_0x7f681f];return _0x141025;};'use strict';var _=require(_0xc832('0x0'));var util=require(_0xc832('0x1'));var logger=require(_0xc832('0x2'))(_0xc832('0x3'));var moment=require('moment');var BPromise=require(_0xc832('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc832('0x5'));var attributes=require('./voiceContext.attributes');module[_0xc832('0x6')]=function(_0x367089,_0x152a12){return _0x367089[_0xc832('0x7')](_0xc832('0x8'),attributes,{'tableName':_0xc832('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bac=['path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','lodash','api'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x7bac,0x1ce));var _0xc7ba=function(_0x5f1681,_0x46dd7e){_0x5f1681=_0x5f1681-0x0;var _0x2c85b4=_0x7bac[_0x5f1681];return _0x2c85b4;};'use strict';var _=require(_0xc7ba('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc7ba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7ba('0x2'));var rimraf=require(_0xc7ba('0x3'));var config=require('../../config/environment');var attributes=require(_0xc7ba('0x4'));module[_0xc7ba('0x5')]=function(_0x2dc66e,_0x71b6ee){return _0x2dc66e[_0xc7ba('0x6')](_0xc7ba('0x7'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 1456f50..702cdf4 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 _0x15f9=['stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0xe6b037,_0x6ef873){var _0x2d1dcb=function(_0x34e554){while(--_0x34e554){_0xe6b037['push'](_0xe6b037['shift']());}};_0x2d1dcb(++_0x6ef873);}(_0x15f9,0xf7));var _0x915f=function(_0x1614c9,_0x1b6f1f){_0x1614c9=_0x1614c9-0x0;var _0x27ed63=_0x15f9[_0x1614c9];return _0x27ed63;};'use strict';var _=require(_0x915f('0x0'));var util=require(_0x915f('0x1'));var moment=require(_0x915f('0x2'));var BPromise=require(_0x915f('0x3'));var rs=require(_0x915f('0x4'));var fs=require('fs');var Redis=require(_0x915f('0x5'));var db=require(_0x915f('0x6'))['db'];var utils=require(_0x915f('0x7'));var logger=require(_0x915f('0x8'))('rpc');var config=require(_0x915f('0x9'));var jayson=require(_0x915f('0xa'));var client=jayson[_0x915f('0xb')][_0x915f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59aea6,_0x45d20c,_0x17f4d7){return new BPromise(function(_0x130699,_0x301a66){return client['request'](_0x59aea6,_0x17f4d7)[_0x915f('0xd')](function(_0x139b5c){logger['info']('VoiceContext,\x20%s,\x20%s',_0x45d20c,_0x915f('0xe'));logger[_0x915f('0xf')](_0x915f('0x10'),_0x45d20c,_0x915f('0xe'),JSON[_0x915f('0x11')](_0x139b5c));if(_0x139b5c[_0x915f('0x12')]){if(_0x139b5c[_0x915f('0x12')][_0x915f('0x13')]===0x1f4){logger[_0x915f('0x12')](_0x915f('0x14'),_0x45d20c,_0x139b5c[_0x915f('0x12')][_0x915f('0x15')]);return _0x301a66(_0x139b5c['error'][_0x915f('0x15')]);}logger[_0x915f('0x12')](_0x915f('0x14'),_0x45d20c,_0x139b5c[_0x915f('0x12')]['message']);return _0x130699(_0x139b5c[_0x915f('0x12')]['message']);}else{logger[_0x915f('0x16')](_0x915f('0x14'),_0x45d20c,'request\x20sent');_0x130699(_0x139b5c[_0x915f('0x17')][_0x915f('0x15')]);}})['catch'](function(_0x23e0c2){logger[_0x915f('0x12')](_0x915f('0x14'),_0x45d20c,_0x23e0c2);_0x301a66(_0x23e0c2);});});} \ No newline at end of file +var _0x3192=['message','VoiceContext,\x20%s,\x20%s','request\x20sent','result','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x133b60,_0x5233ee){var _0x15de19=function(_0x33b81f){while(--_0x33b81f){_0x133b60['push'](_0x133b60['shift']());}};_0x15de19(++_0x5233ee);}(_0x3192,0x147));var _0x2319=function(_0x36a03d,_0x195d12){_0x36a03d=_0x36a03d-0x0;var _0x387bb5=_0x3192[_0x36a03d];return _0x387bb5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2319('0x0'));var BPromise=require(_0x2319('0x1'));var rs=require(_0x2319('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2319('0x3'));var logger=require(_0x2319('0x4'))(_0x2319('0x5'));var config=require(_0x2319('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13c4cd,_0x32697d,_0x4f9695){return new BPromise(function(_0x10690c,_0x12ece0){return client[_0x2319('0x7')](_0x13c4cd,_0x4f9695)[_0x2319('0x8')](function(_0x406aa7){logger['info']('VoiceContext,\x20%s,\x20%s',_0x32697d,'request\x20sent');logger['debug'](_0x2319('0x9'),_0x32697d,'request\x20sent',JSON[_0x2319('0xa')](_0x406aa7));if(_0x406aa7[_0x2319('0xb')]){if(_0x406aa7['error'][_0x2319('0xc')]===0x1f4){logger[_0x2319('0xb')]('VoiceContext,\x20%s,\x20%s',_0x32697d,_0x406aa7[_0x2319('0xb')][_0x2319('0xd')]);return _0x12ece0(_0x406aa7[_0x2319('0xb')][_0x2319('0xd')]);}logger[_0x2319('0xb')](_0x2319('0xe'),_0x32697d,_0x406aa7[_0x2319('0xb')][_0x2319('0xd')]);return _0x10690c(_0x406aa7['error']['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x32697d,_0x2319('0xf'));_0x10690c(_0x406aa7[_0x2319('0x10')][_0x2319('0xd')]);}})['catch'](function(_0x3a1e74){logger[_0x2319('0xb')](_0x2319('0xe'),_0x32697d,_0x3a1e74);_0x12ece0(_0x3a1e74);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 3d74a2a..4274a6e 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 _0x45e4=['path','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x45e4,0x18e));var _0x445e=function(_0x42e223,_0x36df9b){_0x42e223=_0x42e223-0x0;var _0x571f9d=_0x45e4[_0x42e223];return _0x571f9d;};'use strict';var multer=require(_0x445e('0x0'));var util=require(_0x445e('0x1'));var path=require(_0x445e('0x2'));var timeout=require('connect-timeout');var express=require(_0x445e('0x3'));var router=express[_0x445e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x445e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x445e('0x6'));var controller=require(_0x445e('0x7'));router[_0x445e('0x8')]('/',auth[_0x445e('0x9')](),controller[_0x445e('0xa')]);router['get'](_0x445e('0xb'),auth['isAuthenticated'](),controller[_0x445e('0xc')]);router[_0x445e('0x8')](_0x445e('0xd'),auth[_0x445e('0x9')](),controller['show']);router[_0x445e('0xe')]('/',auth[_0x445e('0x9')](),controller[_0x445e('0xf')]);router[_0x445e('0x10')](_0x445e('0xd'),auth[_0x445e('0x9')](),controller['update']);router[_0x445e('0x11')](_0x445e('0xd'),auth['isAuthenticated'](),controller[_0x445e('0x12')]);module[_0x445e('0x13')]=router; \ No newline at end of file +var _0x8723=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','describe','/:id','show','post','create','delete'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x8723,0x106));var _0x3872=function(_0x496063,_0x4d49f6){_0x496063=_0x496063-0x0;var _0x310700=_0x8723[_0x496063];return _0x310700;};'use strict';var multer=require(_0x3872('0x0'));var util=require(_0x3872('0x1'));var path=require(_0x3872('0x2'));var timeout=require(_0x3872('0x3'));var express=require(_0x3872('0x4'));var router=express[_0x3872('0x5')]();var fs_extra=require(_0x3872('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3872('0x7'));var config=require(_0x3872('0x8'));var controller=require(_0x3872('0x9'));router['get']('/',auth[_0x3872('0xa')](),controller['index']);router[_0x3872('0xb')]('/describe',auth[_0x3872('0xa')](),controller[_0x3872('0xc')]);router[_0x3872('0xb')](_0x3872('0xd'),auth[_0x3872('0xa')](),controller[_0x3872('0xe')]);router[_0x3872('0xf')]('/',auth['isAuthenticated'](),controller[_0x3872('0x10')]);router['put'](_0x3872('0xd'),auth[_0x3872('0xa')](),controller['update']);router[_0x3872('0x11')](_0x3872('0xd'),auth[_0x3872('0xa')](),controller[_0x3872('0x12')]);module[_0x3872('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f46dad2..3910159 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 _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x25e7da,_0x20e853){var _0x310d03=function(_0x575faa){while(--_0x575faa){_0x25e7da['push'](_0x25e7da['shift']());}};_0x310d03(++_0x20e853);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x4b84[_0x3e8cae];return _0x45c4d6;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0xb447df,_0x4e4429){var _0x3288bd=function(_0x4c5639){while(--_0x4c5639){_0xb447df['push'](_0xb447df['shift']());}};_0x3288bd(++_0x4e4429);}(_0xbec5,0xe5));var _0x5bec=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0xbec5[_0x40927b];return _0x2635e8;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e0919dd..5e323d2 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 _0x1c35=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','VoiceDialReport','fieldName','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x2d0d68,_0x11e7ab){var _0xb8b405=function(_0x505fe6){while(--_0x505fe6){_0x2d0d68['push'](_0x2d0d68['shift']());}};_0xb8b405(++_0x11e7ab);}(_0x1c35,0x1ae));var _0x51c3=function(_0x5e27e3,_0x3f477f){_0x5e27e3=_0x5e27e3-0x0;var _0x299dfd=_0x1c35[_0x5e27e3];return _0x299dfd;};'use strict';var emlformat=require(_0x51c3('0x0'));var rimraf=require(_0x51c3('0x1'));var zipdir=require(_0x51c3('0x2'));var jsonpatch=require(_0x51c3('0x3'));var rp=require(_0x51c3('0x4'));var moment=require(_0x51c3('0x5'));var BPromise=require(_0x51c3('0x6'));var Mustache=require(_0x51c3('0x7'));var util=require(_0x51c3('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x51c3('0x9'));var ejs=require(_0x51c3('0xa'));var fs=require('fs');var fs_extra=require(_0x51c3('0xb'));var _=require(_0x51c3('0xc'));var squel=require(_0x51c3('0xd'));var crypto=require(_0x51c3('0xe'));var jsforce=require(_0x51c3('0xf'));var deskjs=require(_0x51c3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x51c3('0x11'));var Papa=require(_0x51c3('0x12'));var Redis=require(_0x51c3('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x51c3('0x14'));var hardwareService=require(_0x51c3('0x15'));var logger=require(_0x51c3('0x16'))(_0x51c3('0x17'));var utils=require(_0x51c3('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x51c3('0x19'))['db'];function respondWithStatusCode(_0x2a7825,_0x32269d){_0x32269d=_0x32269d||0xcc;return function(_0x46184e){if(_0x46184e){return _0x2a7825[_0x51c3('0x1a')](_0x32269d);}return _0x2a7825[_0x51c3('0x1b')](_0x32269d)['end']();};}function respondWithResult(_0x456f97,_0x12c0c7){_0x12c0c7=_0x12c0c7||0xc8;return function(_0x4ad6b4){if(_0x4ad6b4){return _0x456f97[_0x51c3('0x1b')](_0x12c0c7)[_0x51c3('0x1c')](_0x4ad6b4);}};}function respondWithFilteredResult(_0xa12a4d,_0x203f42){return function(_0x227d25){if(_0x227d25){var _0x50e7aa=typeof _0x203f42[_0x51c3('0x1d')]===_0x51c3('0x1e')&&typeof _0x203f42['limit']===_0x51c3('0x1e');var _0x787947=_0x227d25[_0x51c3('0x1f')];var _0x314de0=_0x50e7aa?0x0:_0x203f42[_0x51c3('0x1d')];var _0x349d03=_0x50e7aa?_0x227d25[_0x51c3('0x1f')]:_0x203f42[_0x51c3('0x1d')]+_0x203f42[_0x51c3('0x20')];var _0x3d736d;if(_0x349d03>=_0x787947){_0x349d03=_0x787947;_0x3d736d=0xc8;}else{_0x3d736d=0xce;}_0xa12a4d[_0x51c3('0x1b')](_0x3d736d);return _0xa12a4d[_0x51c3('0x21')](_0x51c3('0x22'),_0x314de0+'-'+_0x349d03+'/'+_0x787947)[_0x51c3('0x1c')](_0x227d25);}return null;};}function patchUpdates(_0x44eaf8){return function(_0x4eb94b){try{jsonpatch[_0x51c3('0x23')](_0x4eb94b,_0x44eaf8,!![]);}catch(_0x49fa4b){return BPromise[_0x51c3('0x24')](_0x49fa4b);}return _0x4eb94b[_0x51c3('0x25')]();};}function saveUpdates(_0x520634,_0x21cf38){return function(_0x4b44ac){if(_0x4b44ac){return _0x4b44ac[_0x51c3('0x26')](_0x520634)[_0x51c3('0x27')](function(_0x4b80e6){return _0x4b80e6;});}return null;};}function removeEntity(_0x55c152,_0x5bc063){return function(_0x3417ff){if(_0x3417ff){return _0x3417ff[_0x51c3('0x28')]()[_0x51c3('0x27')](function(){_0x55c152[_0x51c3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c0b3a,_0x464ec0){return function(_0x5dd5e3){if(!_0x5dd5e3){_0x4c0b3a[_0x51c3('0x1a')](0x194);}return _0x5dd5e3;};}function handleError(_0x4ab84d,_0x55a43b){_0x55a43b=_0x55a43b||0x1f4;return function(_0x3e7159){logger[_0x51c3('0x29')](_0x3e7159[_0x51c3('0x2a')]);if(_0x3e7159['name']){delete _0x3e7159['name'];}_0x4ab84d['status'](_0x55a43b)[_0x51c3('0x2b')](_0x3e7159);};}exports[_0x51c3('0x2c')]=function(_0x21010a,_0x3f91fb){var _0x45080f={},_0x27ae77={},_0x21c761={'count':0x0,'rows':[]};var _0x49de02=_[_0x51c3('0x2d')](db[_0x51c3('0x2e')]['rawAttributes'],function(_0x102d04){return{'name':_0x102d04[_0x51c3('0x2f')],'type':_0x102d04['type'][_0x51c3('0x30')]};});_0x27ae77[_0x51c3('0x31')]=_[_0x51c3('0x2d')](_0x49de02,_0x51c3('0x32'));_0x27ae77[_0x51c3('0x33')]=_[_0x51c3('0x34')](_0x21010a[_0x51c3('0x33')]);_0x27ae77['filters']=_[_0x51c3('0x35')](_0x27ae77[_0x51c3('0x31')],_0x27ae77[_0x51c3('0x33')]);_0x45080f[_0x51c3('0x36')]=_[_0x51c3('0x35')](_0x27ae77['model'],qs['fields'](_0x21010a['query'][_0x51c3('0x37')]));_0x45080f['attributes']=_0x45080f[_0x51c3('0x36')]['length']?_0x45080f[_0x51c3('0x36')]:_0x27ae77[_0x51c3('0x31')];if(!_0x21010a[_0x51c3('0x33')][_0x51c3('0x38')]('nolimit')){_0x45080f[_0x51c3('0x20')]=qs[_0x51c3('0x20')](_0x21010a[_0x51c3('0x33')][_0x51c3('0x20')]);_0x45080f[_0x51c3('0x1d')]=qs[_0x51c3('0x1d')](_0x21010a[_0x51c3('0x33')][_0x51c3('0x1d')]);}_0x45080f[_0x51c3('0x39')]=qs[_0x51c3('0x3a')](_0x21010a[_0x51c3('0x33')]['sort']);_0x45080f[_0x51c3('0x3b')]=qs['filters'](_[_0x51c3('0x3c')](_0x21010a[_0x51c3('0x33')],_0x27ae77[_0x51c3('0x3d')]),_0x49de02);if(_0x21010a[_0x51c3('0x33')][_0x51c3('0x3e')]){_0x45080f['where']=_[_0x51c3('0x3f')](_0x45080f[_0x51c3('0x3b')],{'$or':_[_0x51c3('0x2d')](_0x49de02,function(_0x7a70c){if(_0x7a70c[_0x51c3('0x40')]!==_0x51c3('0x41')){var _0x523ebe={};_0x523ebe[_0x7a70c['name']]={'$like':'%'+_0x21010a['query'][_0x51c3('0x3e')]+'%'};return _0x523ebe;}})});}_0x45080f=_[_0x51c3('0x3f')]({},_0x45080f,_0x21010a[_0x51c3('0x42')]);var _0x3aa4ab={'where':_0x45080f['where']};return db[_0x51c3('0x2e')][_0x51c3('0x1f')](_0x3aa4ab)[_0x51c3('0x27')](function(_0x30099c){_0x21c761[_0x51c3('0x1f')]=_0x30099c;if(_0x21010a[_0x51c3('0x33')][_0x51c3('0x43')]){_0x45080f[_0x51c3('0x44')]=[{'all':!![]}];}return db[_0x51c3('0x2e')][_0x51c3('0x45')](_0x45080f);})[_0x51c3('0x27')](function(_0x32a1e1){_0x21c761['rows']=_0x32a1e1;return _0x21c761;})[_0x51c3('0x27')](respondWithFilteredResult(_0x3f91fb,_0x45080f))[_0x51c3('0x46')](handleError(_0x3f91fb,null));};exports['show']=function(_0x245ea8,_0x57d262){var _0x3980af={'raw':!![],'where':{'id':_0x245ea8[_0x51c3('0x47')]['id']}},_0x35a8ff={};_0x35a8ff[_0x51c3('0x31')]=_['keys'](db[_0x51c3('0x2e')][_0x51c3('0x48')]);_0x35a8ff[_0x51c3('0x33')]=_[_0x51c3('0x34')](_0x245ea8['query']);_0x35a8ff[_0x51c3('0x3d')]=_[_0x51c3('0x35')](_0x35a8ff['model'],_0x35a8ff[_0x51c3('0x33')]);_0x3980af[_0x51c3('0x36')]=_[_0x51c3('0x35')](_0x35a8ff[_0x51c3('0x31')],qs['fields'](_0x245ea8[_0x51c3('0x33')]['fields']));_0x3980af[_0x51c3('0x36')]=_0x3980af[_0x51c3('0x36')]['length']?_0x3980af[_0x51c3('0x36')]:_0x35a8ff['model'];if(_0x245ea8[_0x51c3('0x33')][_0x51c3('0x43')]){_0x3980af[_0x51c3('0x44')]=[{'all':!![]}];}_0x3980af=_[_0x51c3('0x3f')]({},_0x3980af,_0x245ea8[_0x51c3('0x42')]);return db[_0x51c3('0x2e')][_0x51c3('0x49')](_0x3980af)[_0x51c3('0x27')](handleEntityNotFound(_0x57d262,null))[_0x51c3('0x27')](respondWithResult(_0x57d262,null))[_0x51c3('0x46')](handleError(_0x57d262,null));};exports[_0x51c3('0x4a')]=function(_0x3c58c3,_0x3c32fa){return db[_0x51c3('0x2e')][_0x51c3('0x4a')](_0x3c58c3[_0x51c3('0x4b')],{})[_0x51c3('0x27')](respondWithResult(_0x3c32fa,0xc9))[_0x51c3('0x46')](handleError(_0x3c32fa,null));};exports[_0x51c3('0x26')]=function(_0x261fa4,_0x45f722){if(_0x261fa4[_0x51c3('0x4b')]['id']){delete _0x261fa4[_0x51c3('0x4b')]['id'];}return db['VoiceDialReport'][_0x51c3('0x49')]({'where':{'id':_0x261fa4[_0x51c3('0x47')]['id']}})['then'](handleEntityNotFound(_0x45f722,null))[_0x51c3('0x27')](saveUpdates(_0x261fa4['body'],null))[_0x51c3('0x27')](respondWithResult(_0x45f722,null))[_0x51c3('0x46')](handleError(_0x45f722,null));};exports['destroy']=function(_0x3bde0d,_0x190aa5){return db[_0x51c3('0x2e')]['find']({'where':{'id':_0x3bde0d['params']['id']}})['then'](handleEntityNotFound(_0x190aa5,null))[_0x51c3('0x27')](removeEntity(_0x190aa5,null))[_0x51c3('0x46')](handleError(_0x190aa5,null));};exports[_0x51c3('0x4c')]=function(_0x135d9f,_0x5466ff){return db['VoiceDialReport']['describe']()['then'](respondWithResult(_0x5466ff,null))[_0x51c3('0x46')](handleError(_0x5466ff,null));}; \ No newline at end of file +var _0x97bc=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','catch','body','describe','eml-format','fast-json-patch','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/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','send','VoiceDialReport','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x11dd75,_0x340f1c){var _0x21bd9b=function(_0x22f10f){while(--_0x22f10f){_0x11dd75['push'](_0x11dd75['shift']());}};_0x21bd9b(++_0x340f1c);}(_0x97bc,0x1bc));var _0xc97b=function(_0x11e857,_0x44d6cd){_0x11e857=_0x11e857-0x0;var _0x10508c=_0x97bc[_0x11e857];return _0x10508c;};'use strict';var emlformat=require(_0xc97b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc97b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc97b('0x2'));var Mustache=require('mustache');var util=require(_0xc97b('0x3'));var path=require(_0xc97b('0x4'));var sox=require(_0xc97b('0x5'));var csv=require(_0xc97b('0x6'));var ejs=require(_0xc97b('0x7'));var fs=require('fs');var fs_extra=require(_0xc97b('0x8'));var _=require(_0xc97b('0x9'));var squel=require(_0xc97b('0xa'));var crypto=require(_0xc97b('0xb'));var jsforce=require(_0xc97b('0xc'));var deskjs=require(_0xc97b('0xd'));var toCsv=require(_0xc97b('0x6'));var querystring=require('querystring');var Papa=require(_0xc97b('0xe'));var Redis=require(_0xc97b('0xf'));var authService=require(_0xc97b('0x10'));var qs=require(_0xc97b('0x11'));var as=require(_0xc97b('0x12'));var hardwareService=require(_0xc97b('0x13'));var logger=require(_0xc97b('0x14'))(_0xc97b('0x15'));var utils=require('../../config/utils');var config=require(_0xc97b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x474190,_0x114c43){_0x114c43=_0x114c43||0xcc;return function(_0x4c2f1e){if(_0x4c2f1e){return _0x474190[_0xc97b('0x17')](_0x114c43);}return _0x474190[_0xc97b('0x18')](_0x114c43)[_0xc97b('0x19')]();};}function respondWithResult(_0x1d599d,_0x211e1b){_0x211e1b=_0x211e1b||0xc8;return function(_0x41c5f0){if(_0x41c5f0){return _0x1d599d['status'](_0x211e1b)[_0xc97b('0x1a')](_0x41c5f0);}};}function respondWithFilteredResult(_0x586782,_0x26a066){return function(_0x31a48c){if(_0x31a48c){var _0x2c4c93=typeof _0x26a066[_0xc97b('0x1b')]===_0xc97b('0x1c')&&typeof _0x26a066[_0xc97b('0x1d')]===_0xc97b('0x1c');var _0x38a449=_0x31a48c['count'];var _0x312b34=_0x2c4c93?0x0:_0x26a066['offset'];var _0x201461=_0x2c4c93?_0x31a48c[_0xc97b('0x1e')]:_0x26a066[_0xc97b('0x1b')]+_0x26a066[_0xc97b('0x1d')];var _0x48705b;if(_0x201461>=_0x38a449){_0x201461=_0x38a449;_0x48705b=0xc8;}else{_0x48705b=0xce;}_0x586782[_0xc97b('0x18')](_0x48705b);return _0x586782[_0xc97b('0x1f')]('Content-Range',_0x312b34+'-'+_0x201461+'/'+_0x38a449)[_0xc97b('0x1a')](_0x31a48c);}return null;};}function patchUpdates(_0x3774e9){return function(_0x4d102e){try{jsonpatch[_0xc97b('0x20')](_0x4d102e,_0x3774e9,!![]);}catch(_0x237691){return BPromise[_0xc97b('0x21')](_0x237691);}return _0x4d102e[_0xc97b('0x22')]();};}function saveUpdates(_0x46d2a2,_0x9af89c){return function(_0x22a4a0){if(_0x22a4a0){return _0x22a4a0[_0xc97b('0x23')](_0x46d2a2)[_0xc97b('0x24')](function(_0x4b7160){return _0x4b7160;});}return null;};}function removeEntity(_0x234ef9,_0x29acaa){return function(_0x2d2055){if(_0x2d2055){return _0x2d2055[_0xc97b('0x25')]()[_0xc97b('0x24')](function(){_0x234ef9[_0xc97b('0x18')](0xcc)[_0xc97b('0x19')]();});}};}function handleEntityNotFound(_0x213b82,_0x47098f){return function(_0x1ec0c6){if(!_0x1ec0c6){_0x213b82[_0xc97b('0x17')](0x194);}return _0x1ec0c6;};}function handleError(_0x58649a,_0x49155b){_0x49155b=_0x49155b||0x1f4;return function(_0x271630){logger['error'](_0x271630['stack']);if(_0x271630[_0xc97b('0x26')]){delete _0x271630['name'];}_0x58649a[_0xc97b('0x18')](_0x49155b)[_0xc97b('0x27')](_0x271630);};}exports['index']=function(_0x5b1b7a,_0x30a2ac){var _0x27fabc={},_0x3b6115={},_0x28248c={'count':0x0,'rows':[]};var _0x225ba0=_['map'](db[_0xc97b('0x28')]['rawAttributes'],function(_0x25da17){return{'name':_0x25da17[_0xc97b('0x29')],'type':_0x25da17['type'][_0xc97b('0x2a')]};});_0x3b6115[_0xc97b('0x2b')]=_[_0xc97b('0x2c')](_0x225ba0,'name');_0x3b6115[_0xc97b('0x2d')]=_[_0xc97b('0x2e')](_0x5b1b7a['query']);_0x3b6115[_0xc97b('0x2f')]=_['intersection'](_0x3b6115[_0xc97b('0x2b')],_0x3b6115[_0xc97b('0x2d')]);_0x27fabc[_0xc97b('0x30')]=_[_0xc97b('0x31')](_0x3b6115[_0xc97b('0x2b')],qs[_0xc97b('0x32')](_0x5b1b7a['query'][_0xc97b('0x32')]));_0x27fabc[_0xc97b('0x30')]=_0x27fabc[_0xc97b('0x30')][_0xc97b('0x33')]?_0x27fabc[_0xc97b('0x30')]:_0x3b6115['model'];if(!_0x5b1b7a['query'][_0xc97b('0x34')]('nolimit')){_0x27fabc[_0xc97b('0x1d')]=qs[_0xc97b('0x1d')](_0x5b1b7a['query'][_0xc97b('0x1d')]);_0x27fabc['offset']=qs[_0xc97b('0x1b')](_0x5b1b7a[_0xc97b('0x2d')][_0xc97b('0x1b')]);}_0x27fabc[_0xc97b('0x35')]=qs['sort'](_0x5b1b7a[_0xc97b('0x2d')][_0xc97b('0x36')]);_0x27fabc[_0xc97b('0x37')]=qs[_0xc97b('0x2f')](_[_0xc97b('0x38')](_0x5b1b7a['query'],_0x3b6115[_0xc97b('0x2f')]),_0x225ba0);if(_0x5b1b7a[_0xc97b('0x2d')][_0xc97b('0x39')]){_0x27fabc['where']=_['merge'](_0x27fabc[_0xc97b('0x37')],{'$or':_[_0xc97b('0x2c')](_0x225ba0,function(_0x5783fb){if(_0x5783fb['type']!==_0xc97b('0x3a')){var _0xf24f26={};_0xf24f26[_0x5783fb[_0xc97b('0x26')]]={'$like':'%'+_0x5b1b7a[_0xc97b('0x2d')][_0xc97b('0x39')]+'%'};return _0xf24f26;}})});}_0x27fabc=_[_0xc97b('0x3b')]({},_0x27fabc,_0x5b1b7a[_0xc97b('0x3c')]);var _0x13cddb={'where':_0x27fabc[_0xc97b('0x37')]};return db[_0xc97b('0x28')][_0xc97b('0x1e')](_0x13cddb)[_0xc97b('0x24')](function(_0x1fa0a2){_0x28248c['count']=_0x1fa0a2;if(_0x5b1b7a[_0xc97b('0x2d')][_0xc97b('0x3d')]){_0x27fabc[_0xc97b('0x3e')]=[{'all':!![]}];}return db[_0xc97b('0x28')][_0xc97b('0x3f')](_0x27fabc);})[_0xc97b('0x24')](function(_0x27ec14){_0x28248c['rows']=_0x27ec14;return _0x28248c;})[_0xc97b('0x24')](respondWithFilteredResult(_0x30a2ac,_0x27fabc))['catch'](handleError(_0x30a2ac,null));};exports[_0xc97b('0x40')]=function(_0xef7ef5,_0x2b5006){var _0x4675fe={'raw':!![],'where':{'id':_0xef7ef5[_0xc97b('0x41')]['id']}},_0xefdf={};_0xefdf[_0xc97b('0x2b')]=_[_0xc97b('0x2e')](db[_0xc97b('0x28')]['rawAttributes']);_0xefdf[_0xc97b('0x2d')]=_[_0xc97b('0x2e')](_0xef7ef5[_0xc97b('0x2d')]);_0xefdf[_0xc97b('0x2f')]=_[_0xc97b('0x31')](_0xefdf[_0xc97b('0x2b')],_0xefdf['query']);_0x4675fe[_0xc97b('0x30')]=_[_0xc97b('0x31')](_0xefdf[_0xc97b('0x2b')],qs[_0xc97b('0x32')](_0xef7ef5[_0xc97b('0x2d')][_0xc97b('0x32')]));_0x4675fe[_0xc97b('0x30')]=_0x4675fe[_0xc97b('0x30')][_0xc97b('0x33')]?_0x4675fe[_0xc97b('0x30')]:_0xefdf['model'];if(_0xef7ef5[_0xc97b('0x2d')]['includeAll']){_0x4675fe[_0xc97b('0x3e')]=[{'all':!![]}];}_0x4675fe=_['merge']({},_0x4675fe,_0xef7ef5[_0xc97b('0x3c')]);return db['VoiceDialReport'][_0xc97b('0x42')](_0x4675fe)[_0xc97b('0x24')](handleEntityNotFound(_0x2b5006,null))[_0xc97b('0x24')](respondWithResult(_0x2b5006,null))['catch'](handleError(_0x2b5006,null));};exports[_0xc97b('0x43')]=function(_0x167ecd,_0xec9db3){return db[_0xc97b('0x28')][_0xc97b('0x43')](_0x167ecd['body'],{})[_0xc97b('0x24')](respondWithResult(_0xec9db3,0xc9))[_0xc97b('0x44')](handleError(_0xec9db3,null));};exports[_0xc97b('0x23')]=function(_0x5a5410,_0x1a9c7a){if(_0x5a5410[_0xc97b('0x45')]['id']){delete _0x5a5410[_0xc97b('0x45')]['id'];}return db[_0xc97b('0x28')][_0xc97b('0x42')]({'where':{'id':_0x5a5410['params']['id']}})[_0xc97b('0x24')](handleEntityNotFound(_0x1a9c7a,null))[_0xc97b('0x24')](saveUpdates(_0x5a5410[_0xc97b('0x45')],null))[_0xc97b('0x24')](respondWithResult(_0x1a9c7a,null))[_0xc97b('0x44')](handleError(_0x1a9c7a,null));};exports[_0xc97b('0x25')]=function(_0x1c51c6,_0x4f6aea){return db['VoiceDialReport'][_0xc97b('0x42')]({'where':{'id':_0x1c51c6[_0xc97b('0x41')]['id']}})[_0xc97b('0x24')](handleEntityNotFound(_0x4f6aea,null))['then'](removeEntity(_0x4f6aea,null))[_0xc97b('0x44')](handleError(_0x4f6aea,null));};exports[_0xc97b('0x46')]=function(_0x5662f3,_0x531857){return db['VoiceDialReport']['describe']()[_0xc97b('0x24')](respondWithResult(_0x531857,null))[_0xc97b('0x44')](handleError(_0x531857,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c6886ec..6f292ba 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 _0x412d=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','../../config/logger','api'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0x412d,0xe7));var _0xd412=function(_0x1fb6da,_0x28ddde){_0x1fb6da=_0x1fb6da-0x0;var _0x5ceb98=_0x412d[_0x1fb6da];return _0x5ceb98;};'use strict';var _=require(_0xd412('0x0'));var util=require('util');var logger=require(_0xd412('0x1'))(_0xd412('0x2'));var moment=require(_0xd412('0x3'));var BPromise=require(_0xd412('0x4'));var rp=require(_0xd412('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd412('0x6'));var config=require(_0xd412('0x7'));var attributes=require(_0xd412('0x8'));module[_0xd412('0x9')]=function(_0x3f4e92,_0xb03909){return _0x3f4e92[_0xd412('0xa')](_0xd412('0xb'),attributes,{'tableName':_0xd412('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e0c=['moment','bluebird','request-promise','../../config/environment','exports','report_dial','uniqueid','lodash','util','../../config/logger'];(function(_0x33b83e,_0x59dd9d){var _0xa38715=function(_0x5cb6fc){while(--_0x5cb6fc){_0x33b83e['push'](_0x33b83e['shift']());}};_0xa38715(++_0x59dd9d);}(_0x8e0c,0x1e7));var _0xc8e0=function(_0x33520f,_0x5106a8){_0x33520f=_0x33520f-0x0;var _0x37b13f=_0x8e0c[_0x33520f];return _0x37b13f;};'use strict';var _=require(_0xc8e0('0x0'));var util=require(_0xc8e0('0x1'));var logger=require(_0xc8e0('0x2'))('api');var moment=require(_0xc8e0('0x3'));var BPromise=require(_0xc8e0('0x4'));var rp=require(_0xc8e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc8e0('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0xc8e0('0x7')]=function(_0x5bd21e,_0x1488bc){return _0x5bd21e['define']('VoiceDialReport',attributes,{'tableName':_0xc8e0('0x8'),'paranoid':![],'indexes':[{'fields':[_0xc8e0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 32f5bff..469d979 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 _0x9cb1=['bluebird','randomstring','ioredis','../../config/utils','../../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','stringify','error','message','info','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','catch','attributes','limit','UpdateVoiceDialReport','lodash','util','moment'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x9cb1,0x105));var _0x19cb=function(_0xd66dfa,_0xcc9c84){_0xd66dfa=_0xd66dfa-0x0;var _0x26b033=_0x9cb1[_0xd66dfa];return _0x26b033;};'use strict';var _=require(_0x19cb('0x0'));var util=require(_0x19cb('0x1'));var moment=require(_0x19cb('0x2'));var BPromise=require(_0x19cb('0x3'));var rs=require(_0x19cb('0x4'));var fs=require('fs');var Redis=require(_0x19cb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x19cb('0x6'));var logger=require(_0x19cb('0x7'))(_0x19cb('0x8'));var config=require(_0x19cb('0x9'));var jayson=require(_0x19cb('0xa'));var client=jayson[_0x19cb('0xb')][_0x19cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x61edbf,_0x1c49e8,_0x38e146){return new BPromise(function(_0x308c6d,_0x19b168){return client['request'](_0x61edbf,_0x38e146)[_0x19cb('0xd')](function(_0x25eace){logger['info'](_0x19cb('0xe'),_0x1c49e8,_0x19cb('0xf'));logger[_0x19cb('0x10')](_0x19cb('0x11'),_0x1c49e8,_0x19cb('0xf'),JSON[_0x19cb('0x12')](_0x25eace));if(_0x25eace[_0x19cb('0x13')]){if(_0x25eace[_0x19cb('0x13')]['code']===0x1f4){logger[_0x19cb('0x13')](_0x19cb('0xe'),_0x1c49e8,_0x25eace[_0x19cb('0x13')][_0x19cb('0x14')]);return _0x19b168(_0x25eace[_0x19cb('0x13')][_0x19cb('0x14')]);}logger[_0x19cb('0x13')](_0x19cb('0xe'),_0x1c49e8,_0x25eace[_0x19cb('0x13')][_0x19cb('0x14')]);return _0x308c6d(_0x25eace[_0x19cb('0x13')]['message']);}else{logger[_0x19cb('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x1c49e8,_0x19cb('0xf'));_0x308c6d(_0x25eace[_0x19cb('0x16')]['message']);}})['catch'](function(_0x1caee9){logger[_0x19cb('0x13')](_0x19cb('0xe'),_0x1c49e8,_0x1caee9);_0x19b168(_0x1caee9);});});}exports['CreateVoiceDialReport']=function(_0x316d28){var _0x4d584f=this;return new Promise(function(_0x46cd90,_0x45802d){return db[_0x19cb('0x17')][_0x19cb('0x18')](_0x316d28[_0x19cb('0x19')],{'raw':_0x316d28[_0x19cb('0x1a')]?_0x316d28[_0x19cb('0x1a')][_0x19cb('0x1b')]===undefined?!![]:![]:!![]})[_0x19cb('0xd')](function(_0x3823c7){logger['info'](_0x19cb('0x1c'),_0x316d28);logger['debug']('CreateVoiceDialReport',_0x316d28,JSON[_0x19cb('0x12')](_0x3823c7));_0x46cd90(_0x3823c7);})[_0x19cb('0x1d')](function(_0x42cb25){logger['error'](_0x19cb('0x1c'),_0x42cb25['message'],_0x316d28);_0x45802d(_0x4d584f[_0x19cb('0x13')](0x1f4,_0x42cb25['message']));});});};exports['UpdateVoiceDialReport']=function(_0x10c2d9){var _0xeeb669=this;return new Promise(function(_0x1da08c,_0x5cdb8b){return db[_0x19cb('0x17')]['update'](_0x10c2d9[_0x19cb('0x19')],{'raw':_0x10c2d9[_0x19cb('0x1a')]?_0x10c2d9[_0x19cb('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10c2d9[_0x19cb('0x1a')]?_0x10c2d9[_0x19cb('0x1a')]['where']||null:null,'attributes':_0x10c2d9[_0x19cb('0x1a')]?_0x10c2d9[_0x19cb('0x1a')][_0x19cb('0x1e')]||null:null,'limit':_0x10c2d9[_0x19cb('0x1a')]?_0x10c2d9[_0x19cb('0x1a')][_0x19cb('0x1f')]||null:null})[_0x19cb('0xd')](function(_0x33e8e9){logger[_0x19cb('0x15')]('UpdateVoiceDialReport',_0x10c2d9);logger[_0x19cb('0x10')](_0x19cb('0x20'),_0x10c2d9,JSON[_0x19cb('0x12')](_0x33e8e9));_0x1da08c(_0x33e8e9);})['catch'](function(_0x3351c8){logger[_0x19cb('0x13')]('UpdateVoiceDialReport',_0x3351c8[_0x19cb('0x14')],_0x10c2d9);_0x5cdb8b(_0xeeb669['error'](0x1f4,_0x3351c8[_0x19cb('0x14')]));});});}; \ No newline at end of file +var _0x02ac=['UpdateVoiceDialReport','VoiceDialReport','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','body','options','raw','CreateVoiceDialReport'];(function(_0x1153aa,_0x19afab){var _0x18ed6f=function(_0x3b5779){while(--_0x3b5779){_0x1153aa['push'](_0x1153aa['shift']());}};_0x18ed6f(++_0x19afab);}(_0x02ac,0xd0));var _0xc02a=function(_0x49f0fc,_0x156cc5){_0x49f0fc=_0x49f0fc-0x0;var _0x23be70=_0x02ac[_0x49f0fc];return _0x23be70;};'use strict';var _=require('lodash');var util=require(_0xc02a('0x0'));var moment=require(_0xc02a('0x1'));var BPromise=require(_0xc02a('0x2'));var rs=require(_0xc02a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc02a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc02a('0x5'))(_0xc02a('0x6'));var config=require(_0xc02a('0x7'));var jayson=require(_0xc02a('0x8'));var client=jayson[_0xc02a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11bb07,_0x5eeb61,_0x1f6358){return new BPromise(function(_0x3ed3e5,_0x450dfb){return client[_0xc02a('0xa')](_0x11bb07,_0x1f6358)[_0xc02a('0xb')](function(_0x45f032){logger[_0xc02a('0xc')](_0xc02a('0xd'),_0x5eeb61,_0xc02a('0xe'));logger[_0xc02a('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x5eeb61,_0xc02a('0xe'),JSON[_0xc02a('0x10')](_0x45f032));if(_0x45f032[_0xc02a('0x11')]){if(_0x45f032[_0xc02a('0x11')]['code']===0x1f4){logger['error'](_0xc02a('0xd'),_0x5eeb61,_0x45f032['error'][_0xc02a('0x12')]);return _0x450dfb(_0x45f032[_0xc02a('0x11')][_0xc02a('0x12')]);}logger['error'](_0xc02a('0xd'),_0x5eeb61,_0x45f032['error'][_0xc02a('0x12')]);return _0x3ed3e5(_0x45f032['error'][_0xc02a('0x12')]);}else{logger['info'](_0xc02a('0xd'),_0x5eeb61,_0xc02a('0xe'));_0x3ed3e5(_0x45f032[_0xc02a('0x13')][_0xc02a('0x12')]);}})['catch'](function(_0x53c593){logger[_0xc02a('0x11')](_0xc02a('0xd'),_0x5eeb61,_0x53c593);_0x450dfb(_0x53c593);});});}exports['CreateVoiceDialReport']=function(_0x5ad7e8){var _0x13cbb7=this;return new Promise(function(_0x3f64e3,_0x826c61){return db['VoiceDialReport']['create'](_0x5ad7e8[_0xc02a('0x14')],{'raw':_0x5ad7e8[_0xc02a('0x15')]?_0x5ad7e8[_0xc02a('0x15')][_0xc02a('0x16')]===undefined?!![]:![]:!![]})[_0xc02a('0xb')](function(_0xe4dafb){logger['info'](_0xc02a('0x17'),_0x5ad7e8);logger[_0xc02a('0xf')](_0xc02a('0x17'),_0x5ad7e8,JSON[_0xc02a('0x10')](_0xe4dafb));_0x3f64e3(_0xe4dafb);})['catch'](function(_0x352659){logger[_0xc02a('0x11')](_0xc02a('0x17'),_0x352659[_0xc02a('0x12')],_0x5ad7e8);_0x826c61(_0x13cbb7[_0xc02a('0x11')](0x1f4,_0x352659[_0xc02a('0x12')]));});});};exports[_0xc02a('0x18')]=function(_0x5477f7){var _0x23c880=this;return new Promise(function(_0x1bf7a5,_0x2397e9){return db[_0xc02a('0x19')]['update'](_0x5477f7[_0xc02a('0x14')],{'raw':_0x5477f7[_0xc02a('0x15')]?_0x5477f7[_0xc02a('0x15')][_0xc02a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5477f7[_0xc02a('0x15')]?_0x5477f7['options'][_0xc02a('0x1a')]||null:null,'attributes':_0x5477f7[_0xc02a('0x15')]?_0x5477f7[_0xc02a('0x15')][_0xc02a('0x1b')]||null:null,'limit':_0x5477f7[_0xc02a('0x15')]?_0x5477f7[_0xc02a('0x15')][_0xc02a('0x1c')]||null:null})['then'](function(_0x1f6b87){logger[_0xc02a('0xc')]('UpdateVoiceDialReport',_0x5477f7);logger[_0xc02a('0xf')]('UpdateVoiceDialReport',_0x5477f7,JSON[_0xc02a('0x10')](_0x1f6b87));_0x1bf7a5(_0x1f6b87);})['catch'](function(_0x9a9b07){logger['error'](_0xc02a('0x18'),_0x9a9b07[_0xc02a('0x12')],_0x5477f7);_0x2397e9(_0x23c880[_0xc02a('0x11')](0x1f4,_0x9a9b07['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 584976f..927d5f6 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 _0x67f6=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','get','show','create','post','/:id/applications','addApplications','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x67f6,0x19e));var _0x667f=function(_0x13c72e,_0x52d828){_0x13c72e=_0x13c72e-0x0;var _0x998314=_0x67f6[_0x13c72e];return _0x998314;};'use strict';var multer=require(_0x667f('0x0'));var util=require(_0x667f('0x1'));var path=require(_0x667f('0x2'));var timeout=require(_0x667f('0x3'));var express=require(_0x667f('0x4'));var router=express[_0x667f('0x5')]();var fs_extra=require(_0x667f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x667f('0x7'));var config=require(_0x667f('0x8'));var controller=require(_0x667f('0x9'));router['get']('/',auth[_0x667f('0xa')](),controller['index']);router[_0x667f('0xb')]('/:id',auth[_0x667f('0xa')](),controller[_0x667f('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x667f('0xd')]);router[_0x667f('0xe')](_0x667f('0xf'),auth[_0x667f('0xa')](),controller[_0x667f('0x10')]);router[_0x667f('0x11')](_0x667f('0x12'),auth[_0x667f('0xa')](),controller['update']);router[_0x667f('0x13')](_0x667f('0x12'),auth[_0x667f('0xa')](),controller[_0x667f('0x14')]);module[_0x667f('0x15')]=router; \ No newline at end of file +var _0xb6b8=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put'];(function(_0x2b3dfe,_0x2e9db2){var _0xe18ef1=function(_0x109e43){while(--_0x109e43){_0x2b3dfe['push'](_0x2b3dfe['shift']());}};_0xe18ef1(++_0x2e9db2);}(_0xb6b8,0xca));var _0x8b6b=function(_0x406fa6,_0x4f21a5){_0x406fa6=_0x406fa6-0x0;var _0x204456=_0xb6b8[_0x406fa6];return _0x204456;};'use strict';var multer=require(_0x8b6b('0x0'));var util=require(_0x8b6b('0x1'));var path=require(_0x8b6b('0x2'));var timeout=require(_0x8b6b('0x3'));var express=require(_0x8b6b('0x4'));var router=express[_0x8b6b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8b6b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b6b('0x7'));var controller=require('./voiceExtension.controller');router[_0x8b6b('0x8')]('/',auth[_0x8b6b('0x9')](),controller[_0x8b6b('0xa')]);router[_0x8b6b('0x8')](_0x8b6b('0xb'),auth[_0x8b6b('0x9')](),controller[_0x8b6b('0xc')]);router[_0x8b6b('0xd')]('/',auth['isAuthenticated'](),controller[_0x8b6b('0xe')]);router[_0x8b6b('0xd')](_0x8b6b('0xf'),auth[_0x8b6b('0x9')](),controller[_0x8b6b('0x10')]);router[_0x8b6b('0x11')]('/:id',auth[_0x8b6b('0x9')](),controller[_0x8b6b('0x12')]);router[_0x8b6b('0x13')]('/:id',auth[_0x8b6b('0x9')](),controller[_0x8b6b('0x14')]);module[_0x8b6b('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 5cf6b32..dcb83d5 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 _0x8287=['inbound-fax','outbound-fax','system','any','BOOLEAN','INTEGER','sequelize','exports','STRING','compositeIndex','ENUM','inbound'];(function(_0x74c6c6,_0x54d54e){var _0x56ba8b=function(_0x2c885f){while(--_0x2c885f){_0x74c6c6['push'](_0x74c6c6['shift']());}};_0x56ba8b(++_0x54d54e);}(_0x8287,0x1b6));var _0x7828=function(_0x2aeca6,_0x565154){_0x2aeca6=_0x2aeca6-0x0;var _0x48c8c9=_0x8287[_0x2aeca6];return _0x48c8c9;};'use strict';var Sequelize=require(_0x7828('0x0'));module[_0x7828('0x1')]={'context':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'unique':_0x7828('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'unique':_0x7828('0x3')},'priority':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x7828('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x7828('0x4')](_0x7828('0x5'),'outbound','internal',_0x7828('0x6'),_0x7828('0x7'),_0x7828('0x8'),_0x7828('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x7828('0x2')]},'interval':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x7828('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7828('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7828('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x7828('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7828('0xb')]},'recordingFormat':{'type':Sequelize[_0x7828('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4d4395){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x7828('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x741b=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','wav','BOOLEAN'];(function(_0x2e0c6e,_0x35afa2){var _0x479579=function(_0x31295c){while(--_0x31295c){_0x2e0c6e['push'](_0x2e0c6e['shift']());}};_0x479579(++_0x35afa2);}(_0x741b,0x133));var _0xb741=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x741b[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0xb741('0x0'));module[_0xb741('0x1')]={'context':{'type':Sequelize[_0xb741('0x2')],'allowNull':![],'unique':_0xb741('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb741('0x3')},'priority':{'type':Sequelize[_0xb741('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xb741('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb741('0x2')],'allowNull':![],'defaultValue':_0xb741('0x4')},'appdata':{'type':Sequelize[_0xb741('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb741('0x5')]('inbound',_0xb741('0x6'),_0xb741('0x7'),_0xb741('0x8'),_0xb741('0x9'),_0xb741('0xa'),_0xb741('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xb741('0x2')]},'interval':{'type':Sequelize[_0xb741('0x2')],'allowNull':![],'defaultValue':_0xb741('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb741('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb741('0xd')]},'recordingFormat':{'type':Sequelize[_0xb741('0x2')],'defaultValue':_0xb741('0xe')},'answer':{'type':Sequelize[_0xb741('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb741('0x10')],'get':function(_0x32c12b){return this[_0xb741('0x11')](_0xb741('0x12'));}},'alias':{'type':Sequelize[_0xb741('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 028159a..7f4ecf4 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 _0xa3b9=['register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','find','value','type','end','error','stack','name','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','inbound','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','destroy','VoiceExtensionId','isApp','createRouting','findAndCountAll','priority','finally','lodash','ioredis','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket'];(function(_0x18cae7,_0x4bce2d){var _0x44d7cc=function(_0xf1e74e){while(--_0xf1e74e){_0x18cae7['push'](_0x18cae7['shift']());}};_0x44d7cc(++_0x4bce2d);}(_0xa3b9,0x10e));var _0x9a3b=function(_0x4108f0,_0xf11c7c){_0x4108f0=_0x4108f0-0x0;var _0xf538b4=_0xa3b9[_0x4108f0];return _0xf538b4;};'use strict';var _=require(_0x9a3b('0x0'));var Redis=require(_0x9a3b('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x9a3b('0x2'))(_0x9a3b('0x3'));var config=require(_0x9a3b('0x4'));var db=require('../../mysqldb')['db'];config[_0x9a3b('0x5')]=_['defaults'](config[_0x9a3b('0x5')],{'host':_0x9a3b('0x6'),'port':0x18eb});var socket=require(_0x9a3b('0x7'))(new Redis(config['redis']));require(_0x9a3b('0x8'))[_0x9a3b('0x9')](socket);function respondWithStatusCode(_0x4b9e99,_0x4528b1){_0x4528b1=_0x4528b1||0xcc;return function(_0x3a849a){if(_0x3a849a){return _0x4b9e99[_0x9a3b('0xa')](_0x4528b1);}return _0x4b9e99[_0x9a3b('0xb')](_0x4528b1)['end']();};}function respondWithResult(_0x3bb0e6,_0x4b5104){_0x4b5104=_0x4b5104||0xc8;return function(_0x36ef98){if(_0x36ef98){return _0x3bb0e6[_0x9a3b('0xb')](_0x4b5104)[_0x9a3b('0xc')](_0x36ef98);}};}function respondWithFilteredResult(_0xf3f47e,_0x3e9530){return function(_0x450bd7){if(_0x450bd7){var _0x257bfb=typeof _0x3e9530['offset']===_0x9a3b('0xd')&&typeof _0x3e9530[_0x9a3b('0xe')]==='undefined';var _0x50a824=_0x450bd7[_0x9a3b('0xf')];var _0x367ada=_0x257bfb?0x0:_0x3e9530['offset'];var _0x5db8cb=_0x257bfb?_0x450bd7[_0x9a3b('0xf')]:_0x3e9530[_0x9a3b('0x10')]+_0x3e9530['limit'];var _0x4cd464;if(_0x5db8cb>=_0x50a824){_0x5db8cb=_0x50a824;_0x4cd464=0xc8;}else{_0x4cd464=0xce;}_0xf3f47e[_0x9a3b('0xb')](_0x4cd464);return _0xf3f47e[_0x9a3b('0x11')](_0x9a3b('0x12'),_0x367ada+'-'+_0x5db8cb+'/'+_0x50a824)['json'](_0x450bd7);}return null;};}function removeEntity(_0x3d4441){return function(_0x557a3d){if(_0x557a3d){return _0x557a3d['destroy']()[_0x9a3b('0x13')](function(){var _0x44b843=_0x557a3d['get']({'plain':!![]});var _0x82d9a2=[{'name':_0x9a3b('0x14'),'value':'inbound','ignore':![]},{'name':_0x9a3b('0x15'),'value':_0x9a3b('0x16'),'ignore':![]},{'name':_0x9a3b('0x17'),'value':_0x9a3b('0x18'),'ignore':![]}];var _0x29a264=_(_0x82d9a2)[_0x9a3b('0x19')](_0x9a3b('0x1a'))[_0x9a3b('0x1b')]('value')['value']();if(_['includes'](_0x29a264,_0x44b843['type'])){return;}var _0x4b5201=_[_0x9a3b('0x1c')](_0x82d9a2,[_0x9a3b('0x1d'),_0x44b843[_0x9a3b('0x1e')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x4b5201,'resourceId':_0x44b843['id']}})[_0x9a3b('0x13')](function(){return _0x557a3d;});})['then'](function(){_0x3d4441[_0x9a3b('0xb')](0xcc)[_0x9a3b('0x1f')]();});}};}function handleEntityNotFound(_0x5129db){return function(_0x3d0be3){if(!_0x3d0be3){_0x5129db[_0x9a3b('0xa')](0x194);}return _0x3d0be3;};}function handleError(_0x23935e,_0x4c263e){_0x4c263e=_0x4c263e||0x1f4;return function(_0x30f4d4){logger[_0x9a3b('0x20')](_0x30f4d4[_0x9a3b('0x21')]);if(_0x30f4d4[_0x9a3b('0x22')]){delete _0x30f4d4['name'];}_0x23935e['status'](_0x4c263e)['send'](_0x30f4d4);};}exports['index']=function(_0x201b35,_0x49f6a2){var _0x5b4a26={},_0x43c69a={},_0x209332={'count':0x0,'rows':[]};var _0x410fe3=_['map'](db[_0x9a3b('0x23')][_0x9a3b('0x24')],function(_0x12020e){return{'name':_0x12020e[_0x9a3b('0x25')],'type':_0x12020e[_0x9a3b('0x1e')][_0x9a3b('0x26')]};});_0x43c69a[_0x9a3b('0x27')]=_[_0x9a3b('0x1b')](_0x410fe3,_0x9a3b('0x22'));_0x43c69a[_0x9a3b('0x28')]=_[_0x9a3b('0x29')](_0x201b35[_0x9a3b('0x28')]);_0x43c69a[_0x9a3b('0x2a')]=_[_0x9a3b('0x2b')](_0x43c69a['model'],_0x43c69a[_0x9a3b('0x28')]);_0x5b4a26[_0x9a3b('0x2c')]=_[_0x9a3b('0x2b')](_0x43c69a[_0x9a3b('0x27')],qs[_0x9a3b('0x2d')](_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x2d')]));_0x5b4a26['attributes']=_0x5b4a26[_0x9a3b('0x2c')][_0x9a3b('0x2e')]?_0x5b4a26[_0x9a3b('0x2c')]:_0x43c69a[_0x9a3b('0x27')];if(!_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x2f')]('nolimit')){_0x5b4a26[_0x9a3b('0xe')]=qs[_0x9a3b('0xe')](_0x201b35[_0x9a3b('0x28')][_0x9a3b('0xe')]);_0x5b4a26[_0x9a3b('0x10')]=qs['offset'](_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x10')]);}_0x5b4a26[_0x9a3b('0x30')]=qs[_0x9a3b('0x31')](_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x31')]);_0x5b4a26[_0x9a3b('0x32')]=qs['filters'](_[_0x9a3b('0x33')](_0x201b35[_0x9a3b('0x28')],_0x43c69a[_0x9a3b('0x2a')]),_0x410fe3);if(_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x19')]){_0x5b4a26[_0x9a3b('0x32')]=_[_0x9a3b('0x34')](_0x5b4a26[_0x9a3b('0x32')],{'$or':_[_0x9a3b('0x1b')](_0x410fe3,function(_0x54da4e){if(_0x54da4e['type']!==_0x9a3b('0x35')){var _0x47b8e4={};_0x47b8e4[_0x54da4e[_0x9a3b('0x22')]]={'$like':'%'+_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x19')]+'%'};return _0x47b8e4;}})});}_0x5b4a26=_[_0x9a3b('0x34')]({},_0x5b4a26,_0x201b35[_0x9a3b('0x36')]);var _0x360a3f={'where':_0x5b4a26['where']};return db[_0x9a3b('0x23')][_0x9a3b('0xf')](_0x360a3f)[_0x9a3b('0x13')](function(_0x4d63e2){_0x209332[_0x9a3b('0xf')]=_0x4d63e2;if(_0x201b35[_0x9a3b('0x28')]['includeAll']){_0x5b4a26[_0x9a3b('0x37')]=[{'all':!![]}];}return db[_0x9a3b('0x23')][_0x9a3b('0x38')](_0x5b4a26);})[_0x9a3b('0x13')](function(_0x2fe32e){_0x209332[_0x9a3b('0x39')]=_0x2fe32e;return _0x209332;})['then'](respondWithFilteredResult(_0x49f6a2,_0x5b4a26))[_0x9a3b('0x3a')](handleError(_0x49f6a2,null));};exports[_0x9a3b('0x3b')]=function(_0x4c1004,_0x3ad43c){var _0x368a33={'raw':![],'where':{'id':_0x4c1004['params']['id']}},_0x924bf={};_0x924bf[_0x9a3b('0x27')]=_[_0x9a3b('0x29')](db[_0x9a3b('0x23')][_0x9a3b('0x24')]);_0x924bf[_0x9a3b('0x28')]=_[_0x9a3b('0x29')](_0x4c1004[_0x9a3b('0x28')]);_0x924bf[_0x9a3b('0x2a')]=_[_0x9a3b('0x2b')](_0x924bf[_0x9a3b('0x27')],_0x924bf[_0x9a3b('0x28')]);_0x368a33['attributes']=_[_0x9a3b('0x2b')](_0x924bf[_0x9a3b('0x27')],qs[_0x9a3b('0x2d')](_0x4c1004[_0x9a3b('0x28')][_0x9a3b('0x2d')]));_0x368a33['attributes']=_0x368a33['attributes'][_0x9a3b('0x2e')]?_0x368a33['attributes']:_0x924bf[_0x9a3b('0x27')];if(_0x4c1004['query']['includeAll']){_0x368a33[_0x9a3b('0x37')]=[{'all':!![]}];}_0x368a33=_['merge']({},_0x368a33,_0x4c1004['options']);return db[_0x9a3b('0x23')][_0x9a3b('0x1c')](_0x368a33)[_0x9a3b('0x13')](handleEntityNotFound(_0x3ad43c,null))[_0x9a3b('0x13')](respondWithResult(_0x3ad43c,null))['catch'](handleError(_0x3ad43c,null));};exports['destroy']=function(_0x30e9a1,_0x39baf2){return db[_0x9a3b('0x23')][_0x9a3b('0x1c')]({'where':{'id':_0x30e9a1[_0x9a3b('0x3c')]['id']}})[_0x9a3b('0x13')](handleEntityNotFound(_0x39baf2,null))[_0x9a3b('0x13')](removeEntity(_0x39baf2,null))[_0x9a3b('0x3a')](handleError(_0x39baf2,null));};exports[_0x9a3b('0x3d')]=function(_0x5520bd,_0x59c71){if(_0x5520bd[_0x9a3b('0x3e')]['type']==='outbound'&&!_[_0x9a3b('0x3f')](_0x5520bd[_0x9a3b('0x3e')][_0x9a3b('0x40')],'_')){_0x5520bd[_0x9a3b('0x3e')][_0x9a3b('0x40')]='_'[_0x9a3b('0x41')](_0x5520bd['body'][_0x9a3b('0x40')]);}return db[_0x9a3b('0x23')][_0x9a3b('0x3d')](_0x5520bd[_0x9a3b('0x3e')],{'raw':![]})['then'](function(_0x4cf2a0){var _0x476092=_0x5520bd[_0x9a3b('0x42')]['get']({'plain':!![]});if(!_0x476092)throw new Error(_0x9a3b('0x43'));if(_0x476092[_0x9a3b('0x44')]===_0x9a3b('0x42')){var _0x4c13da=_0x4cf2a0[_0x9a3b('0x45')]({'plain':!![]});var _0x12ef16=[{'name':_0x9a3b('0x14'),'value':_0x9a3b('0x46')},{'name':_0x9a3b('0x15'),'value':_0x9a3b('0x16')},{'name':'InternalRoutes','value':_0x9a3b('0x18')}];var _0x11428d=_['find'](_0x12ef16,[_0x9a3b('0x1d'),_0x4c13da[_0x9a3b('0x1e')]])[_0x9a3b('0x22')];return db[_0x9a3b('0x47')][_0x9a3b('0x1c')]({'where':{'name':_0x11428d,'userProfileId':_0x476092[_0x9a3b('0x48')]},'raw':!![]})[_0x9a3b('0x13')](function(_0x6be382){if(_0x6be382&&_0x6be382['autoAssociation']===0x0){return db[_0x9a3b('0x49')][_0x9a3b('0x3d')]({'name':_0x4c13da[_0x9a3b('0x22')],'resourceId':_0x4c13da['id'],'type':_0x6be382['name'],'sectionId':_0x6be382['id']},{})[_0x9a3b('0x13')](function(){return _0x4cf2a0;});}else{return _0x4cf2a0;}})[_0x9a3b('0x3a')](function(_0x6ec944){logger[_0x9a3b('0x20')](_0x9a3b('0x4a'),_0x6ec944);throw _0x6ec944;});}return _0x4cf2a0;})[_0x9a3b('0x13')](respondWithResult(_0x59c71,0xc9))[_0x9a3b('0x3a')](handleError(_0x59c71,null));};exports[_0x9a3b('0x4b')]=function(_0x30ffb1,_0x3b6bca){if(_0x30ffb1[_0x9a3b('0x3e')]['id']){delete _0x30ffb1[_0x9a3b('0x3e')]['id'];}return db[_0x9a3b('0x23')][_0x9a3b('0x1c')]({'where':{'id':_0x30ffb1[_0x9a3b('0x3c')]['id']}})[_0x9a3b('0x13')](handleEntityNotFound(_0x3b6bca,null))[_0x9a3b('0x13')](function(_0x5eb9f8){if(_0x5eb9f8){return db[_0x9a3b('0x23')][_0x9a3b('0x4b')](_[_0x9a3b('0x33')](_0x30ffb1['body'],['exten',_0x9a3b('0x4c'),_0x9a3b('0x4d'),_0x9a3b('0x4e'),'cutdigits',_0x9a3b('0x4f'),_0x9a3b('0x50')]),{'where':{'context':_0x5eb9f8[_0x9a3b('0x4c')],'exten':_0x5eb9f8[_0x9a3b('0x40')]},'individualHooks':!![]})[_0x9a3b('0x13')](function(_0x50900a){return _0x50900a;});}return null;})[_0x9a3b('0x13')](respondWithStatusCode(_0x3b6bca,null))['catch'](handleError(_0x3b6bca,null));};exports['addApplications']=function(_0x3c3c4e,_0x4ab8e0){var _0x3af095=_0x3c3c4e[_0x9a3b('0x3c')]['id'];var _0x1f2d86=_0x3c3c4e['body'];var _0x4a790c=0xc8;var _0x3159f3=null;return db['sequelize'][_0x9a3b('0x51')]({'isolationLevel':db[_0x9a3b('0x52')]['Transaction'][_0x9a3b('0x53')][_0x9a3b('0x54')]},function(_0x5eddfa){return db[_0x9a3b('0x23')][_0x9a3b('0x55')]({'where':{'id':_0x3af095},'transaction':_0x5eddfa})[_0x9a3b('0x13')](function(_0x2a25a7){if(_0x2a25a7){return db['VoiceExtension'][_0x9a3b('0x56')]({'where':{'VoiceExtensionId':_0x3af095},'transaction':_0x5eddfa})[_0x9a3b('0x13')](function(){var _0x75055f=_[_0x9a3b('0x1b')](_0x1f2d86,function(_0x2770c5){_0x2770c5[_0x9a3b('0x57')]=_0x3af095;_0x2770c5[_0x9a3b('0x58')]=!![];return _0x2770c5;});return _0x2a25a7[_0x9a3b('0x59')](_0x75055f);})['then'](function(_0x3cab47){return db[_0x9a3b('0x23')]['bulkCreate'](_0x3cab47,{'transaction':_0x5eddfa});});}else{_0x4a790c=0x194;_0x3159f3=[];}});})[_0x9a3b('0x13')](function(){if(_0x4a790c!==0x194){return db[_0x9a3b('0x23')][_0x9a3b('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3af095},'order':_0x9a3b('0x5b')})['then'](function(_0x444a35){_0x3159f3=_0x444a35;});}})[_0x9a3b('0x3a')](function(_0x390592){_0x4a790c=0x1f4;logger[_0x9a3b('0x20')](_0x390592[_0x9a3b('0x21')]);if(_0x390592[_0x9a3b('0x22')]){delete _0x390592[_0x9a3b('0x22')];}_0x3159f3=_0x390592;})[_0x9a3b('0x5c')](function(){if(_0x3159f3===null){_0x4ab8e0['sendStatus'](_0x4a790c);}else{if(_0x4a790c===0x1f4){_0x4ab8e0[_0x9a3b('0xb')](_0x4a790c)['send'](_0x3159f3);}else{_0x4ab8e0[_0x9a3b('0xb')](_0x4a790c)['json'](_0x3159f3);}}});}; \ No newline at end of file +var _0x1ad9=['model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','create','body','exten','concat','user','role','inbound','userProfileId','autoAssociation','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','finally','send','lodash','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','status','end','json','limit','undefined','offset','count','Content-Range','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','ignore','value','includes','type','find','name','UserProfileResource','then','sendStatus','error','stack','index','map','VoiceExtension','rawAttributes','fieldName','key'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x1ad9,0x1e8));var _0x91ad=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x1ad9[_0x1e4a8e];return _0x5408f9;};'use strict';var _=require(_0x91ad('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x91ad('0x1'));var db=require(_0x91ad('0x2'))['db'];config[_0x91ad('0x3')]=_[_0x91ad('0x4')](config[_0x91ad('0x3')],{'host':_0x91ad('0x5'),'port':0x18eb});var socket=require(_0x91ad('0x6'))(new Redis(config[_0x91ad('0x3')]));require(_0x91ad('0x7'))['register'](socket);function respondWithStatusCode(_0x1cfc34,_0x1d3b0d){_0x1d3b0d=_0x1d3b0d||0xcc;return function(_0x17f468){if(_0x17f468){return _0x1cfc34['sendStatus'](_0x1d3b0d);}return _0x1cfc34[_0x91ad('0x8')](_0x1d3b0d)[_0x91ad('0x9')]();};}function respondWithResult(_0x42e761,_0x43d477){_0x43d477=_0x43d477||0xc8;return function(_0x13d4f6){if(_0x13d4f6){return _0x42e761[_0x91ad('0x8')](_0x43d477)[_0x91ad('0xa')](_0x13d4f6);}};}function respondWithFilteredResult(_0x1dd610,_0x2fa731){return function(_0x19de0f){if(_0x19de0f){var _0x1a6501=typeof _0x2fa731['offset']==='undefined'&&typeof _0x2fa731[_0x91ad('0xb')]===_0x91ad('0xc');var _0x1ac69a=_0x19de0f['count'];var _0x1569a7=_0x1a6501?0x0:_0x2fa731[_0x91ad('0xd')];var _0x583ab3=_0x1a6501?_0x19de0f[_0x91ad('0xe')]:_0x2fa731['offset']+_0x2fa731[_0x91ad('0xb')];var _0x19febb;if(_0x583ab3>=_0x1ac69a){_0x583ab3=_0x1ac69a;_0x19febb=0xc8;}else{_0x19febb=0xce;}_0x1dd610['status'](_0x19febb);return _0x1dd610['set'](_0x91ad('0xf'),_0x1569a7+'-'+_0x583ab3+'/'+_0x1ac69a)[_0x91ad('0xa')](_0x19de0f);}return null;};}function removeEntity(_0x3e6f18){return function(_0x394e75){if(_0x394e75){return _0x394e75[_0x91ad('0x10')]()['then'](function(){var _0x4fcae7=_0x394e75[_0x91ad('0x11')]({'plain':!![]});var _0x50acec=[{'name':_0x91ad('0x12'),'value':'inbound','ignore':![]},{'name':_0x91ad('0x13'),'value':_0x91ad('0x14'),'ignore':![]},{'name':_0x91ad('0x15'),'value':_0x91ad('0x16'),'ignore':![]}];var _0x1a3f88=_(_0x50acec)['filter'](_0x91ad('0x17'))['map']('value')[_0x91ad('0x18')]();if(_[_0x91ad('0x19')](_0x1a3f88,_0x4fcae7[_0x91ad('0x1a')])){return;}var _0x33a178=_[_0x91ad('0x1b')](_0x50acec,[_0x91ad('0x18'),_0x4fcae7['type']])[_0x91ad('0x1c')];return db[_0x91ad('0x1d')][_0x91ad('0x10')]({'where':{'type':_0x33a178,'resourceId':_0x4fcae7['id']}})[_0x91ad('0x1e')](function(){return _0x394e75;});})[_0x91ad('0x1e')](function(){_0x3e6f18[_0x91ad('0x8')](0xcc)[_0x91ad('0x9')]();});}};}function handleEntityNotFound(_0xbf1148){return function(_0x41ad50){if(!_0x41ad50){_0xbf1148[_0x91ad('0x1f')](0x194);}return _0x41ad50;};}function handleError(_0x1d3d58,_0x489b79){_0x489b79=_0x489b79||0x1f4;return function(_0x4f2930){logger[_0x91ad('0x20')](_0x4f2930[_0x91ad('0x21')]);if(_0x4f2930['name']){delete _0x4f2930[_0x91ad('0x1c')];}_0x1d3d58[_0x91ad('0x8')](_0x489b79)['send'](_0x4f2930);};}exports[_0x91ad('0x22')]=function(_0x59f5ed,_0x5973eb){var _0x153aa6={},_0x55d0af={},_0x1744e4={'count':0x0,'rows':[]};var _0x288a03=_[_0x91ad('0x23')](db[_0x91ad('0x24')][_0x91ad('0x25')],function(_0x51e9b8){return{'name':_0x51e9b8[_0x91ad('0x26')],'type':_0x51e9b8['type'][_0x91ad('0x27')]};});_0x55d0af[_0x91ad('0x28')]=_['map'](_0x288a03,'name');_0x55d0af['query']=_[_0x91ad('0x29')](_0x59f5ed[_0x91ad('0x2a')]);_0x55d0af[_0x91ad('0x2b')]=_[_0x91ad('0x2c')](_0x55d0af['model'],_0x55d0af['query']);_0x153aa6[_0x91ad('0x2d')]=_[_0x91ad('0x2c')](_0x55d0af[_0x91ad('0x28')],qs[_0x91ad('0x2e')](_0x59f5ed[_0x91ad('0x2a')][_0x91ad('0x2e')]));_0x153aa6[_0x91ad('0x2d')]=_0x153aa6[_0x91ad('0x2d')]['length']?_0x153aa6['attributes']:_0x55d0af[_0x91ad('0x28')];if(!_0x59f5ed[_0x91ad('0x2a')]['hasOwnProperty'](_0x91ad('0x2f'))){_0x153aa6[_0x91ad('0xb')]=qs['limit'](_0x59f5ed[_0x91ad('0x2a')][_0x91ad('0xb')]);_0x153aa6[_0x91ad('0xd')]=qs['offset'](_0x59f5ed[_0x91ad('0x2a')][_0x91ad('0xd')]);}_0x153aa6[_0x91ad('0x30')]=qs['sort'](_0x59f5ed['query'][_0x91ad('0x31')]);_0x153aa6[_0x91ad('0x32')]=qs[_0x91ad('0x2b')](_[_0x91ad('0x33')](_0x59f5ed['query'],_0x55d0af[_0x91ad('0x2b')]),_0x288a03);if(_0x59f5ed['query'][_0x91ad('0x34')]){_0x153aa6[_0x91ad('0x32')]=_[_0x91ad('0x35')](_0x153aa6[_0x91ad('0x32')],{'$or':_[_0x91ad('0x23')](_0x288a03,function(_0x5edf5d){if(_0x5edf5d['type']!==_0x91ad('0x36')){var _0x4f7723={};_0x4f7723[_0x5edf5d['name']]={'$like':'%'+_0x59f5ed['query'][_0x91ad('0x34')]+'%'};return _0x4f7723;}})});}_0x153aa6=_[_0x91ad('0x35')]({},_0x153aa6,_0x59f5ed[_0x91ad('0x37')]);var _0x3e812f={'where':_0x153aa6[_0x91ad('0x32')]};return db[_0x91ad('0x24')]['count'](_0x3e812f)[_0x91ad('0x1e')](function(_0x4232ce){_0x1744e4[_0x91ad('0xe')]=_0x4232ce;if(_0x59f5ed[_0x91ad('0x2a')]['includeAll']){_0x153aa6[_0x91ad('0x38')]=[{'all':!![]}];}return db['VoiceExtension'][_0x91ad('0x39')](_0x153aa6);})[_0x91ad('0x1e')](function(_0x475e15){_0x1744e4['rows']=_0x475e15;return _0x1744e4;})[_0x91ad('0x1e')](respondWithFilteredResult(_0x5973eb,_0x153aa6))[_0x91ad('0x3a')](handleError(_0x5973eb,null));};exports[_0x91ad('0x3b')]=function(_0x2519ac,_0x2aa572){var _0x4a75c4={'raw':![],'where':{'id':_0x2519ac[_0x91ad('0x3c')]['id']}},_0x200f8c={};_0x200f8c[_0x91ad('0x28')]=_[_0x91ad('0x29')](db[_0x91ad('0x24')]['rawAttributes']);_0x200f8c['query']=_[_0x91ad('0x29')](_0x2519ac[_0x91ad('0x2a')]);_0x200f8c[_0x91ad('0x2b')]=_[_0x91ad('0x2c')](_0x200f8c[_0x91ad('0x28')],_0x200f8c['query']);_0x4a75c4[_0x91ad('0x2d')]=_[_0x91ad('0x2c')](_0x200f8c[_0x91ad('0x28')],qs[_0x91ad('0x2e')](_0x2519ac[_0x91ad('0x2a')][_0x91ad('0x2e')]));_0x4a75c4[_0x91ad('0x2d')]=_0x4a75c4['attributes'][_0x91ad('0x3d')]?_0x4a75c4[_0x91ad('0x2d')]:_0x200f8c[_0x91ad('0x28')];if(_0x2519ac[_0x91ad('0x2a')][_0x91ad('0x3e')]){_0x4a75c4[_0x91ad('0x38')]=[{'all':!![]}];}_0x4a75c4=_[_0x91ad('0x35')]({},_0x4a75c4,_0x2519ac[_0x91ad('0x37')]);return db[_0x91ad('0x24')][_0x91ad('0x1b')](_0x4a75c4)[_0x91ad('0x1e')](handleEntityNotFound(_0x2aa572,null))['then'](respondWithResult(_0x2aa572,null))[_0x91ad('0x3a')](handleError(_0x2aa572,null));};exports[_0x91ad('0x10')]=function(_0x1bc2be,_0x13a62f){return db['VoiceExtension'][_0x91ad('0x1b')]({'where':{'id':_0x1bc2be['params']['id']}})[_0x91ad('0x1e')](handleEntityNotFound(_0x13a62f,null))[_0x91ad('0x1e')](removeEntity(_0x13a62f,null))[_0x91ad('0x3a')](handleError(_0x13a62f,null));};exports[_0x91ad('0x3f')]=function(_0x1e492f,_0x16718e){if(_0x1e492f[_0x91ad('0x40')][_0x91ad('0x1a')]===_0x91ad('0x14')&&!_['startsWith'](_0x1e492f[_0x91ad('0x40')][_0x91ad('0x41')],'_')){_0x1e492f[_0x91ad('0x40')]['exten']='_'[_0x91ad('0x42')](_0x1e492f[_0x91ad('0x40')][_0x91ad('0x41')]);}return db[_0x91ad('0x24')][_0x91ad('0x3f')](_0x1e492f[_0x91ad('0x40')],{'raw':![]})[_0x91ad('0x1e')](function(_0x1688c4){var _0x12c569=_0x1e492f[_0x91ad('0x43')][_0x91ad('0x11')]({'plain':!![]});if(!_0x12c569)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12c569[_0x91ad('0x44')]===_0x91ad('0x43')){var _0x3edda2=_0x1688c4['get']({'plain':!![]});var _0x3a07df=[{'name':_0x91ad('0x12'),'value':_0x91ad('0x45')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x91ad('0x16')}];var _0x49f47c=_['find'](_0x3a07df,[_0x91ad('0x18'),_0x3edda2[_0x91ad('0x1a')]])[_0x91ad('0x1c')];return db['UserProfileSection'][_0x91ad('0x1b')]({'where':{'name':_0x49f47c,'userProfileId':_0x12c569[_0x91ad('0x46')]},'raw':!![]})[_0x91ad('0x1e')](function(_0x3af373){if(_0x3af373&&_0x3af373[_0x91ad('0x47')]===0x0){return db[_0x91ad('0x1d')][_0x91ad('0x3f')]({'name':_0x3edda2[_0x91ad('0x1c')],'resourceId':_0x3edda2['id'],'type':_0x3af373[_0x91ad('0x1c')],'sectionId':_0x3af373['id']},{})[_0x91ad('0x1e')](function(){return _0x1688c4;});}else{return _0x1688c4;}})[_0x91ad('0x3a')](function(_0x37c917){logger[_0x91ad('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37c917);throw _0x37c917;});}return _0x1688c4;})[_0x91ad('0x1e')](respondWithResult(_0x16718e,0xc9))[_0x91ad('0x3a')](handleError(_0x16718e,null));};exports[_0x91ad('0x48')]=function(_0x4ac13d,_0x4905bd){if(_0x4ac13d['body']['id']){delete _0x4ac13d[_0x91ad('0x40')]['id'];}return db[_0x91ad('0x24')][_0x91ad('0x1b')]({'where':{'id':_0x4ac13d['params']['id']}})['then'](handleEntityNotFound(_0x4905bd,null))[_0x91ad('0x1e')](function(_0xde8870){if(_0xde8870){return db[_0x91ad('0x24')][_0x91ad('0x48')](_[_0x91ad('0x33')](_0x4ac13d[_0x91ad('0x40')],[_0x91ad('0x41'),_0x91ad('0x49'),'description',_0x91ad('0x4a'),_0x91ad('0x4b'),_0x91ad('0x4c'),_0x91ad('0x4d')]),{'where':{'context':_0xde8870[_0x91ad('0x49')],'exten':_0xde8870[_0x91ad('0x41')]},'individualHooks':!![]})['then'](function(_0x1c5e69){return _0x1c5e69;});}return null;})['then'](respondWithStatusCode(_0x4905bd,null))[_0x91ad('0x3a')](handleError(_0x4905bd,null));};exports['addApplications']=function(_0x436254,_0xe916e5){var _0x11d5e2=_0x436254[_0x91ad('0x3c')]['id'];var _0x24140e=_0x436254['body'];var _0x2bebc6=0xc8;var _0x2075f9=null;return db[_0x91ad('0x4e')][_0x91ad('0x4f')]({'isolationLevel':db[_0x91ad('0x4e')]['Transaction']['ISOLATION_LEVELS'][_0x91ad('0x50')]},function(_0x17fc9d){return db[_0x91ad('0x24')][_0x91ad('0x51')]({'where':{'id':_0x11d5e2},'transaction':_0x17fc9d})['then'](function(_0x2c1978){if(_0x2c1978){return db[_0x91ad('0x24')][_0x91ad('0x10')]({'where':{'VoiceExtensionId':_0x11d5e2},'transaction':_0x17fc9d})[_0x91ad('0x1e')](function(){var _0xf92a88=_[_0x91ad('0x23')](_0x24140e,function(_0x1c92e2){_0x1c92e2[_0x91ad('0x52')]=_0x11d5e2;_0x1c92e2[_0x91ad('0x53')]=!![];return _0x1c92e2;});return _0x2c1978[_0x91ad('0x54')](_0xf92a88);})[_0x91ad('0x1e')](function(_0xe11510){return db['VoiceExtension'][_0x91ad('0x55')](_0xe11510,{'transaction':_0x17fc9d});});}else{_0x2bebc6=0x194;_0x2075f9=[];}});})[_0x91ad('0x1e')](function(){if(_0x2bebc6!==0x194){return db[_0x91ad('0x24')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x11d5e2},'order':'priority'})[_0x91ad('0x1e')](function(_0x576a1c){_0x2075f9=_0x576a1c;});}})[_0x91ad('0x3a')](function(_0x1ddc91){_0x2bebc6=0x1f4;logger[_0x91ad('0x20')](_0x1ddc91[_0x91ad('0x21')]);if(_0x1ddc91['name']){delete _0x1ddc91['name'];}_0x2075f9=_0x1ddc91;})[_0x91ad('0x56')](function(){if(_0x2075f9===null){_0xe916e5['sendStatus'](_0x2bebc6);}else{if(_0x2bebc6===0x1f4){_0xe916e5[_0x91ad('0x8')](_0x2bebc6)[_0x91ad('0x57')](_0x2075f9);}else{_0xe916e5[_0x91ad('0x8')](_0x2bebc6)[_0x91ad('0xa')](_0x2075f9);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 0d8a432..3ad7abd 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 _0x04b1=['events','../../mysqldb','VoiceExtension','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x04b1,0x129));var _0x104b=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x04b1[_0x4dcc2d];return _0x1bbd79;};'use strict';var EventEmitter=require(_0x104b('0x0'));var VoiceExtension=require(_0x104b('0x1'))['db'][_0x104b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x104b('0x3'),'afterUpdate':'update','afterDestroy':_0x104b('0x4')};function emitEvent(_0x5ad2c6){return function(_0x5aa386,_0x5191ee,_0x68a38c){VoiceExtensionEvents['emit'](_0x5ad2c6+':'+_0x5aa386['id'],_0x5aa386);VoiceExtensionEvents[_0x104b('0x5')](_0x5ad2c6,_0x5aa386);_0x68a38c(null);};}for(var e in events){if(events[_0x104b('0x6')](e)){var event=events[e];VoiceExtension[_0x104b('0x7')](e,emitEvent(event));}}module[_0x104b('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x4cec=['../../mysqldb','VoiceExtension','save','update','remove','emit','hasOwnProperty'];(function(_0x4a049f,_0x1ec161){var _0x2da74f=function(_0x33c8fd){while(--_0x33c8fd){_0x4a049f['push'](_0x4a049f['shift']());}};_0x2da74f(++_0x1ec161);}(_0x4cec,0xaf));var _0xc4ce=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4cec[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xc4ce('0x0'))['db'][_0xc4ce('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc4ce('0x2'),'afterUpdate':_0xc4ce('0x3'),'afterDestroy':_0xc4ce('0x4')};function emitEvent(_0x571a09){return function(_0x321835,_0x7e5481,_0x15a411){VoiceExtensionEvents[_0xc4ce('0x5')](_0x571a09+':'+_0x321835['id'],_0x321835);VoiceExtensionEvents[_0xc4ce('0x5')](_0x571a09,_0x321835);_0x15a411(null);};}for(var e in events){if(events[_0xc4ce('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 506cb7e..ae88653 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 _0x35c8=['lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','alias','CDR(routeAlias)=','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','timeout','url','split','name','param','prefix','phone','${EXTEN:','SIP','join','options','indexOf','replace','isEmpty','Interval','interval','IntervalId','then','length','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','get','Hangup'];(function(_0x485ae4,_0x139ea9){var _0x2c2cd4=function(_0x500ec2){while(--_0x500ec2){_0x485ae4['push'](_0x485ae4['shift']());}};_0x2c2cd4(++_0x139ea9);}(_0x35c8,0xa6));var _0x835c=function(_0x51345b,_0x25625c){_0x51345b=_0x51345b-0x0;var _0xdaad61=_0x35c8[_0x51345b];return _0xdaad61;};'use strict';var _=require(_0x835c('0x0'));var attributes=require(_0x835c('0x1'));module[_0x835c('0x2')]=function(_0x1763c3){var _0x306f59=_0x1763c3['models'];function _0x5a9764(_0xbb7e9f){var _0x1339d3=0x2;var _0x10c49b=[{'type':_0xbb7e9f[_0x835c('0x3')],'app':_0x835c('0x4'),'appdata':_0x835c('0x5')+_0xbb7e9f[_0x835c('0x3')],'context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f['exten'],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']},{'type':_0xbb7e9f[_0x835c('0x3')],'app':_0xbb7e9f[_0x835c('0x7')]?_0x835c('0x4'):'NoOp','appdata':_0xbb7e9f[_0x835c('0x7')]?_0x835c('0x8')+_0xbb7e9f[_0x835c('0x7')]:'No\x20alias\x20set','context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f[_0x835c('0x9')],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']}];if(_0xbb7e9f[_0x835c('0x3')]===_0x835c('0xa')){_0x10c49b[_0x835c('0xb')]({'type':'inbound','app':'Set','appdata':_0x835c('0xc')+_0xbb7e9f['id'],'context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f[_0x835c('0x9')],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']});}_0x10c49b['push']({'type':_0xbb7e9f[_0x835c('0x3')],'app':_0x835c('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xbb7e9f['context'],'exten':_0xbb7e9f[_0x835c('0x9')],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']},{'type':_0xbb7e9f[_0x835c('0x3')],'app':_0x835c('0x4'),'appdata':_0x835c('0xd'),'context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f['exten'],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']},{'type':_0xbb7e9f[_0x835c('0x3')],'app':_0x835c('0x4'),'appdata':_0x835c('0xe'),'context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f[_0x835c('0x9')],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']});return _0x10c49b;}function _0x202aa9(_0x44b26c){var _0x30002a=0x2;var _0x9dfe14=[{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':_0x835c('0x10'),'context':_0x44b26c['context'],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x44b26c[_0x835c('0x7')]?_0x835c('0x4'):'NoOp','appdata':_0x44b26c['alias']?_0x835c('0x8')+_0x44b26c[_0x835c('0x7')]:_0x835c('0x11'),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c['exten'],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':'outbound','app':_0x835c('0x4'),'appdata':_0x835c('0x12')+(_0x44b26c['cutdigits']?'${EXTEN:'+_0x44b26c['cutdigits']+'}':_0x835c('0x13')),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':'Set','appdata':_0x835c('0xc')+_0x44b26c['id'],'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x14'),'appdata':_0x835c('0x15')+(_0x30002a+0x2)+_0x835c('0x16')+(_0x30002a+0x1)+')','context':_0x44b26c['context'],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':_0x44b26c[_0x835c('0x17')]?_0x835c('0x18')+_0x44b26c['cutdigits']+'}':_0x835c('0x19'),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':'outbound','app':_0x835c('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x44b26c['context'],'exten':_0x44b26c['exten'],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':'Set','appdata':_0x835c('0xe'),'context':_0x44b26c['context'],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':'outboundrouteid='+_0x44b26c['id'],'context':_0x44b26c['context'],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']}];if(_0x44b26c[_0x835c('0x1a')]('recordingFormat')&&_0x44b26c['recordingFormat']!==_0x835c('0x1b')){_0x9dfe14[_0x835c('0xb')]({'type':'outbound','app':_0x835c('0x4'),'appdata':_0x835c('0x1c'),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c['exten'],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':_0x835c('0x1d')+_0x44b26c[_0x835c('0x1e')]||_0x835c('0x1f'),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']});}return _0x9dfe14;}function _0x1ed24d(_0x3d1c10,_0x2a25a1){var _0x1f5b31=[{'name':'trunk','param':0x0},{'name':_0x835c('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0x835c('0x21'),'param':0x3}];var _0x1f6822={};var _0x20ca5b=_0x2a25a1[_0x835c('0x22')](',');var _0x1bebc9=[];for(var _0x142090=0x0;_0x142090<_0x1f5b31['length'];_0x142090++){switch(_0x1f5b31[_0x142090][_0x835c('0x23')]){case'trunk':_0x1f6822['trunk']=_0x20ca5b[_0x1f5b31[_0x142090][_0x835c('0x24')]][_0x835c('0x22')]('/')[0x1];_0x1f6822['phone']=_0x20ca5b[_0x1f5b31[_0x142090][_0x835c('0x24')]][_0x835c('0x22')]('/')[0x2];_0x1f6822[_0x835c('0x25')]=_0x1f6822[_0x835c('0x26')]?_0x1f6822[_0x835c('0x26')][_0x835c('0x22')]('$')[0x0]:undefined;_0x1f6822[_0x835c('0x26')]=_0x3d1c10['cutdigits']?(_0x1f6822[_0x835c('0x25')]||'')+_0x835c('0x27')+_0x3d1c10['cutdigits']+'}':(_0x1f6822[_0x835c('0x25')]||'')+_0x835c('0x13');_0x1bebc9[_0x1f5b31[_0x142090][_0x835c('0x24')]]=[_0x835c('0x28'),_0x1f6822['trunk'],_0x1f6822[_0x835c('0x26')]][_0x835c('0x29')]('/');break;case'options':_0x1f6822[_0x835c('0x2a')]=_0x20ca5b[_0x1f5b31[_0x142090][_0x835c('0x24')]];if(_0x3d1c10['recordingFormat']!==_0x835c('0x1b')){if(_0x1f6822[_0x835c('0x2a')][_0x835c('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x1f6822[_0x835c('0x2a')]+='U(xcally-mixmonitor-context)';}}else{_0x1f6822[_0x835c('0x2a')]=_0x1f6822[_0x835c('0x2a')][_0x835c('0x2c')]('U(xcally-mixmonitor-context)','');}_0x1bebc9[_0x1f5b31[_0x142090][_0x835c('0x24')]]=_0x1f6822['options'];break;default:_0x1bebc9[_0x1f5b31[_0x142090][_0x835c('0x24')]]=_0x20ca5b[_0x1f5b31[_0x142090]['param']];}}return _0x1bebc9[_0x835c('0x29')](',');}function _0x182ba5(_0x4f038f,_0x40334b,_0x555718){return new Promise(function(_0xdf39ef,_0x5b2a81){var _0x2153d8=[];if(_[_0x835c('0x2d')](_0x40334b))return _0xdf39ef(_0x2153d8);_0x306f59[_0x835c('0x2e')]['findAll']({'attributes':['id',_0x835c('0x2f'),_0x835c('0x30')],'raw':!![]})[_0x835c('0x31')](function(_0x3721df){for(var _0x344a3d=0x0,_0x25f8bc=0x0;_0x344a3d<_0x40334b[_0x835c('0x32')];_0x344a3d++,_0x25f8bc=0x0){var _0xf2b9c2=_0x40334b[_0x344a3d];var _0x33729d=[];var _0x22b9ad=[];delete _0xf2b9c2['id'];if(_0xf2b9c2[_0x835c('0x2f')]!==_0x835c('0x33')){_0xf2b9c2[_0x835c('0x34')]=[_0xf2b9c2['interval']];}else{_0xf2b9c2[_0x835c('0x34')]=_0xf2b9c2['IntervalId']?_[_0x835c('0x35')](_['filter'](_0x3721df,{'IntervalId':_0xf2b9c2['IntervalId']}),_0x835c('0x2f')):[];}_0xf2b9c2[_0x835c('0x6')]=_0x4f038f[_0x835c('0x6')];_0xf2b9c2[_0x835c('0x9')]=_0x4f038f[_0x835c('0x9')];if(_0xf2b9c2[_0x835c('0x3')])_0xf2b9c2[_0x835c('0x3')]=_0xf2b9c2[_0x835c('0x3')][_0x835c('0x36')]();if(_0x4f038f[_0x835c('0x3')]===_0x835c('0xf')){if(_0xf2b9c2[_0x835c('0x1a')](_0x835c('0x37'))&&_0xf2b9c2[_0x835c('0x37')]&&_0xf2b9c2['tag']!=='--'){_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2[_0x835c('0x3')]['toLowerCase'](),'app':_0x835c('0x4'),'appdata':_0x835c('0x38')+_0xf2b9c2['tag'],'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});}_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2[_0x835c('0x3')][_0x835c('0x36')](),'app':'ExecIf','appdata':_0x835c('0x39')+(_0xf2b9c2[_0x835c('0x3a')]?_0x835c('0x3b')+_0xf2b9c2['callerID']+')':_0x835c('0x3c')),'context':_0x4f038f['context'],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')]['length']+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});}else{if(_0xf2b9c2[_0x835c('0x1a')](_0x835c('0x3d'))){if([_0x835c('0x3e'),_0x835c('0x3f')][_0x835c('0x40')](_0xf2b9c2[_0x835c('0x41')]['toLowerCase']())&&_0xf2b9c2[_0x835c('0x42')]!==_0x835c('0x43')){if(_0xf2b9c2[_0x835c('0x3d')]){_0x33729d['push']({'type':_0xf2b9c2['type']['toLowerCase'](),'app':_0x835c('0x14'),'appdata':_0x835c('0x44'),'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2['type'][_0x835c('0x36')](),'app':_0x835c('0x4'),'appdata':_0x835c('0x45'),'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});}else{_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2[_0x835c('0x3')]['toLowerCase'](),'app':_0x835c('0x14'),'appdata':_0x835c('0x46'),'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')]['length']+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2[_0x835c('0x3')][_0x835c('0x36')](),'app':_0x835c('0x4'),'appdata':_0x835c('0x47'),'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});}}}}for(var _0x5d8e80=0x0;_0x5d8e80<_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')];_0x5d8e80++){var _0xb0a03e=_0x555718+_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')];var _0x34d6f7=_0x5d8e80===_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]-0x1?_0x555718+_0x33729d['length']+_0x22b9ad[_0x835c('0x32')]+0x2:_0x555718+_0x5d8e80+0x1;_0x33729d[_0x835c('0x48')](_0x5d8e80,0x0,{'type':_0x4f038f['type'],'app':_0x835c('0x49'),'appdata':_0xf2b9c2['intervals'][_0x5d8e80]+'?'+_0x4f038f[_0x835c('0x6')]+_0x835c('0x4a')+_0xb0a03e+':'+_0x4f038f['context']+_0x835c('0x4a')+_0x34d6f7,'exten':_0x4f038f['exten'],'context':_0x4f038f['context'],'priority':_0x555718+_0x5d8e80,'VoiceExtensionId':_0x4f038f['id']});}if(_0xf2b9c2['appType']===_0x835c('0x4b'))_0xf2b9c2[_0x835c('0x4c')]=_0x1ed24d(_0x4f038f,_0xf2b9c2[_0x835c('0x4c')]);_0xf2b9c2[_0x835c('0x4d')]=_0x33729d['length']?_[_0x835c('0x4e')](_0x33729d)[_0x835c('0x4d')]+0x1:_0x555718;_0x2153d8=_[_0x835c('0x4f')](_0x2153d8,_0x33729d,[_0xf2b9c2],_0x22b9ad);_0x555718=_[_0x835c('0x4e')](_0x2153d8)[_0x835c('0x4d')]+0x1;}return _0xdf39ef(_0x2153d8);})[_0x835c('0x50')](function(_0x176757){_0x5b2a81(_0x176757);});});}return _0x1763c3['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5b6449){var _0x49d672=this[_0x835c('0x51')]({'plain':!![]});var _0x5f0eda=_0x49d672[_0x835c('0x3')]===_0x835c('0xf')?_0x202aa9(_0x49d672):_0x5a9764(_0x49d672);return _0x182ba5(_0x49d672,_0x5b6449,_[_0x835c('0x4e')](_0x5f0eda)[_0x835c('0x4d')]+0x1)[_0x835c('0x31')](function(_0x201db1){var _0x5e842e=_[_0x835c('0x4f')](_0x5f0eda,_0x201db1);_0x5e842e[_0x835c('0xb')]({'type':_0x49d672['type'],'app':_0x835c('0x52'),'exten':_0x49d672[_0x835c('0x9')],'context':_0x49d672['context'],'priority':_['last'](_0x5e842e)[_0x835c('0x4d')]+0x1,'VoiceExtensionId':_0x49d672['id']});return _0x5e842e;});}}});}; \ No newline at end of file +var _0xc2a5=['appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','NoOp','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','split','length','name','phone','param','prefix','SIP','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','then','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','playback','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial'];(function(_0x3c6376,_0xc147e4){var _0x4b5cbd=function(_0x4315c4){while(--_0x4315c4){_0x3c6376['push'](_0x3c6376['shift']());}};_0x4b5cbd(++_0xc147e4);}(_0xc2a5,0x14e));var _0x5c2a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc2a5[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5c2a('0x0'));var attributes=require(_0x5c2a('0x1'));module[_0x5c2a('0x2')]=function(_0x398c5a){var _0x1d1376=_0x398c5a['models'];function _0x1f3eb3(_0x3683ea){var _0xa022f0=0x2;var _0x33ef63=[{'type':_0x3683ea[_0x5c2a('0x3')],'app':_0x5c2a('0x4'),'appdata':_0x5c2a('0x5')+_0x3683ea[_0x5c2a('0x3')],'context':_0x3683ea['context'],'exten':_0x3683ea[_0x5c2a('0x6')],'priority':_0xa022f0++,'VoiceExtensionId':_0x3683ea['id']},{'type':_0x3683ea[_0x5c2a('0x3')],'app':_0x3683ea[_0x5c2a('0x7')]?_0x5c2a('0x4'):'NoOp','appdata':_0x3683ea[_0x5c2a('0x7')]?_0x5c2a('0x8')+_0x3683ea[_0x5c2a('0x7')]:_0x5c2a('0x9'),'context':_0x3683ea[_0x5c2a('0xa')],'exten':_0x3683ea[_0x5c2a('0x6')],'priority':_0xa022f0++,'VoiceExtensionId':_0x3683ea['id']}];if(_0x3683ea[_0x5c2a('0x3')]==='inbound'){_0x33ef63['push']({'type':_0x5c2a('0xb'),'app':_0x5c2a('0x4'),'appdata':'CDR(routeid)='+_0x3683ea['id'],'context':_0x3683ea['context'],'exten':_0x3683ea[_0x5c2a('0x6')],'priority':_0xa022f0++,'VoiceExtensionId':_0x3683ea['id']});}_0x33ef63[_0x5c2a('0xc')]({'type':_0x3683ea['type'],'app':_0x5c2a('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3683ea[_0x5c2a('0xa')],'exten':_0x3683ea[_0x5c2a('0x6')],'priority':_0xa022f0++,'VoiceExtensionId':_0x3683ea['id']},{'type':_0x3683ea['type'],'app':'Set','appdata':_0x5c2a('0xd'),'context':_0x3683ea[_0x5c2a('0xa')],'exten':_0x3683ea['exten'],'priority':_0xa022f0++,'VoiceExtensionId':_0x3683ea['id']},{'type':_0x3683ea[_0x5c2a('0x3')],'app':'Set','appdata':_0x5c2a('0xe'),'context':_0x3683ea['context'],'exten':_0x3683ea[_0x5c2a('0x6')],'priority':_0xa022f0++,'VoiceExtensionId':_0x3683ea['id']});return _0x33ef63;}function _0x5ad956(_0x50cd16){var _0x498690=0x2;var _0x1ca177=[{'type':'outbound','app':_0x5c2a('0x4'),'appdata':_0x5c2a('0xf'),'context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16[_0x5c2a('0x6')],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':_0x5c2a('0x10'),'app':_0x50cd16[_0x5c2a('0x7')]?'Set':_0x5c2a('0x11'),'appdata':_0x50cd16[_0x5c2a('0x7')]?'CDR(routeAlias)='+_0x50cd16[_0x5c2a('0x7')]:_0x5c2a('0x9'),'context':_0x50cd16['context'],'exten':_0x50cd16['exten'],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':_0x5c2a('0x10'),'app':_0x5c2a('0x4'),'appdata':'CDR(destination)='+(_0x50cd16[_0x5c2a('0x12')]?_0x5c2a('0x13')+_0x50cd16[_0x5c2a('0x12')]+'}':_0x5c2a('0x14')),'context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16[_0x5c2a('0x6')],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':_0x5c2a('0x10'),'app':_0x5c2a('0x4'),'appdata':_0x5c2a('0x15')+_0x50cd16['id'],'context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16[_0x5c2a('0x6')],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':_0x5c2a('0x10'),'app':_0x5c2a('0x16'),'appdata':_0x5c2a('0x17')+(_0x498690+0x2)+'):Goto('+(_0x498690+0x1)+')','context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16[_0x5c2a('0x6')],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':'outbound','app':_0x5c2a('0x4'),'appdata':_0x50cd16[_0x5c2a('0x12')]?_0x5c2a('0x18')+_0x50cd16[_0x5c2a('0x12')]+'}':_0x5c2a('0x19'),'context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16[_0x5c2a('0x6')],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':_0x5c2a('0x10'),'app':_0x5c2a('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16['exten'],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':_0x5c2a('0x10'),'app':_0x5c2a('0x4'),'appdata':_0x5c2a('0xd'),'context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16['exten'],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':'outbound','app':_0x5c2a('0x4'),'appdata':_0x5c2a('0xe'),'context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16[_0x5c2a('0x6')],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':'outbound','app':_0x5c2a('0x4'),'appdata':'outboundrouteid='+_0x50cd16['id'],'context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16['exten'],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']}];if(_0x50cd16[_0x5c2a('0x1a')](_0x5c2a('0x1b'))&&_0x50cd16[_0x5c2a('0x1b')]!==_0x5c2a('0x1c')){_0x1ca177['push']({'type':'outbound','app':_0x5c2a('0x4'),'appdata':_0x5c2a('0x1d'),'context':_0x50cd16[_0x5c2a('0xa')],'exten':_0x50cd16[_0x5c2a('0x6')],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']},{'type':_0x5c2a('0x10'),'app':_0x5c2a('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x50cd16['recordingFormat']||_0x5c2a('0x1e'),'context':_0x50cd16['context'],'exten':_0x50cd16[_0x5c2a('0x6')],'priority':_0x498690++,'VoiceExtensionId':_0x50cd16['id']});}return _0x1ca177;}function _0x53f7a0(_0x3544b5,_0x98ca39){var _0x43a0a4=[{'name':_0x5c2a('0x1f'),'param':0x0},{'name':_0x5c2a('0x20'),'param':0x1},{'name':_0x5c2a('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0x3de1e9={};var _0x124256=_0x98ca39[_0x5c2a('0x22')](',');var _0x58cfda=[];for(var _0x2d449c=0x0;_0x2d449c<_0x43a0a4[_0x5c2a('0x23')];_0x2d449c++){switch(_0x43a0a4[_0x2d449c][_0x5c2a('0x24')]){case _0x5c2a('0x1f'):_0x3de1e9[_0x5c2a('0x1f')]=_0x124256[_0x43a0a4[_0x2d449c]['param']][_0x5c2a('0x22')]('/')[0x1];_0x3de1e9[_0x5c2a('0x25')]=_0x124256[_0x43a0a4[_0x2d449c][_0x5c2a('0x26')]][_0x5c2a('0x22')]('/')[0x2];_0x3de1e9['prefix']=_0x3de1e9['phone']?_0x3de1e9[_0x5c2a('0x25')]['split']('$')[0x0]:undefined;_0x3de1e9['phone']=_0x3544b5[_0x5c2a('0x12')]?(_0x3de1e9[_0x5c2a('0x27')]||'')+'${EXTEN:'+_0x3544b5[_0x5c2a('0x12')]+'}':(_0x3de1e9[_0x5c2a('0x27')]||'')+_0x5c2a('0x14');_0x58cfda[_0x43a0a4[_0x2d449c][_0x5c2a('0x26')]]=[_0x5c2a('0x28'),_0x3de1e9[_0x5c2a('0x1f')],_0x3de1e9[_0x5c2a('0x25')]]['join']('/');break;case _0x5c2a('0x21'):_0x3de1e9['options']=_0x124256[_0x43a0a4[_0x2d449c][_0x5c2a('0x26')]];if(_0x3544b5[_0x5c2a('0x1b')]!==_0x5c2a('0x1c')){if(_0x3de1e9['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x3de1e9['options']+=_0x5c2a('0x29');}}else{_0x3de1e9['options']=_0x3de1e9[_0x5c2a('0x21')][_0x5c2a('0x2a')](_0x5c2a('0x29'),'');}_0x58cfda[_0x43a0a4[_0x2d449c][_0x5c2a('0x26')]]=_0x3de1e9[_0x5c2a('0x21')];break;default:_0x58cfda[_0x43a0a4[_0x2d449c][_0x5c2a('0x26')]]=_0x124256[_0x43a0a4[_0x2d449c][_0x5c2a('0x26')]];}}return _0x58cfda[_0x5c2a('0x2b')](',');}function _0x57e261(_0x51a217,_0x4c6a55,_0x177bec){return new Promise(function(_0xb9400b,_0x278b80){var _0x2a3da8=[];if(_[_0x5c2a('0x2c')](_0x4c6a55))return _0xb9400b(_0x2a3da8);_0x1d1376[_0x5c2a('0x2d')][_0x5c2a('0x2e')]({'attributes':['id',_0x5c2a('0x2f'),'IntervalId'],'raw':!![]})[_0x5c2a('0x30')](function(_0x3ea5e0){for(var _0x1de5b6=0x0,_0x48d5c6=0x0;_0x1de5b6<_0x4c6a55[_0x5c2a('0x23')];_0x1de5b6++,_0x48d5c6=0x0){var _0x339817=_0x4c6a55[_0x1de5b6];var _0x375cb4=[];var _0x4f7ef5=[];delete _0x339817['id'];if(_0x339817[_0x5c2a('0x2f')]!=='*,*,*,*'){_0x339817[_0x5c2a('0x31')]=[_0x339817['interval']];}else{_0x339817[_0x5c2a('0x31')]=_0x339817[_0x5c2a('0x32')]?_[_0x5c2a('0x33')](_[_0x5c2a('0x34')](_0x3ea5e0,{'IntervalId':_0x339817[_0x5c2a('0x32')]}),_0x5c2a('0x2f')):[];}_0x339817['context']=_0x51a217[_0x5c2a('0xa')];_0x339817['exten']=_0x51a217['exten'];if(_0x339817[_0x5c2a('0x3')])_0x339817[_0x5c2a('0x3')]=_0x339817[_0x5c2a('0x3')][_0x5c2a('0x35')]();if(_0x51a217[_0x5c2a('0x3')]===_0x5c2a('0x10')){if(_0x339817[_0x5c2a('0x1a')](_0x5c2a('0x36'))&&_0x339817[_0x5c2a('0x36')]&&_0x339817[_0x5c2a('0x36')]!=='--'){_0x375cb4[_0x5c2a('0xc')]({'type':_0x339817['type'][_0x5c2a('0x35')](),'app':'Set','appdata':_0x5c2a('0x37')+_0x339817[_0x5c2a('0x36')],'context':_0x51a217[_0x5c2a('0xa')],'exten':_0x51a217[_0x5c2a('0x6')],'priority':_0x339817[_0x5c2a('0x31')][_0x5c2a('0x23')]+_0x177bec+_0x48d5c6++,'VoiceExtensionId':_0x51a217['id']});}_0x375cb4[_0x5c2a('0xc')]({'type':_0x339817[_0x5c2a('0x3')][_0x5c2a('0x35')](),'app':'ExecIf','appdata':_0x5c2a('0x38')+(_0x339817[_0x5c2a('0x39')]?'Set(CALLERID(all)='+_0x339817[_0x5c2a('0x39')]+')':_0x5c2a('0x3a')),'context':_0x51a217[_0x5c2a('0xa')],'exten':_0x51a217[_0x5c2a('0x6')],'priority':_0x339817[_0x5c2a('0x31')][_0x5c2a('0x23')]+_0x177bec+_0x48d5c6++,'VoiceExtensionId':_0x51a217['id']});}else{if(_0x339817[_0x5c2a('0x1a')](_0x5c2a('0x3b'))){if(['queue',_0x5c2a('0x3c')]['includes'](_0x339817[_0x5c2a('0x3d')]['toLowerCase']())&&_0x339817['appType']!==_0x5c2a('0x3e')){if(_0x339817[_0x5c2a('0x3b')]){_0x375cb4[_0x5c2a('0xc')]({'type':_0x339817[_0x5c2a('0x3')][_0x5c2a('0x35')](),'app':_0x5c2a('0x16'),'appdata':_0x5c2a('0x3f'),'context':_0x51a217['context'],'exten':_0x51a217[_0x5c2a('0x6')],'priority':_0x339817[_0x5c2a('0x31')][_0x5c2a('0x23')]+_0x177bec+_0x48d5c6++,'VoiceExtensionId':_0x51a217['id']});_0x375cb4[_0x5c2a('0xc')]({'type':_0x339817[_0x5c2a('0x3')]['toLowerCase'](),'app':_0x5c2a('0x4'),'appdata':_0x5c2a('0x40'),'context':_0x51a217[_0x5c2a('0xa')],'exten':_0x51a217['exten'],'priority':_0x339817[_0x5c2a('0x31')]['length']+_0x177bec+_0x48d5c6++,'VoiceExtensionId':_0x51a217['id']});}else{_0x375cb4[_0x5c2a('0xc')]({'type':_0x339817[_0x5c2a('0x3')][_0x5c2a('0x35')](),'app':_0x5c2a('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x51a217[_0x5c2a('0xa')],'exten':_0x51a217[_0x5c2a('0x6')],'priority':_0x339817[_0x5c2a('0x31')][_0x5c2a('0x23')]+_0x177bec+_0x48d5c6++,'VoiceExtensionId':_0x51a217['id']});_0x375cb4[_0x5c2a('0xc')]({'type':_0x339817[_0x5c2a('0x3')][_0x5c2a('0x35')](),'app':_0x5c2a('0x4'),'appdata':_0x5c2a('0x41'),'context':_0x51a217[_0x5c2a('0xa')],'exten':_0x51a217[_0x5c2a('0x6')],'priority':_0x339817[_0x5c2a('0x31')]['length']+_0x177bec+_0x48d5c6++,'VoiceExtensionId':_0x51a217['id']});}}}}for(var _0x283dfc=0x0;_0x283dfc<_0x339817[_0x5c2a('0x31')][_0x5c2a('0x23')];_0x283dfc++){var _0x5a8a6e=_0x177bec+_0x339817['intervals'][_0x5c2a('0x23')];var _0x17e909=_0x283dfc===_0x339817[_0x5c2a('0x31')]['length']-0x1?_0x177bec+_0x375cb4['length']+_0x4f7ef5[_0x5c2a('0x23')]+0x2:_0x177bec+_0x283dfc+0x1;_0x375cb4[_0x5c2a('0x42')](_0x283dfc,0x0,{'type':_0x51a217[_0x5c2a('0x3')],'app':_0x5c2a('0x43'),'appdata':_0x339817['intervals'][_0x283dfc]+'?'+_0x51a217[_0x5c2a('0xa')]+_0x5c2a('0x44')+_0x5a8a6e+':'+_0x51a217[_0x5c2a('0xa')]+_0x5c2a('0x44')+_0x17e909,'exten':_0x51a217[_0x5c2a('0x6')],'context':_0x51a217[_0x5c2a('0xa')],'priority':_0x177bec+_0x283dfc,'VoiceExtensionId':_0x51a217['id']});}if(_0x339817[_0x5c2a('0x45')]===_0x5c2a('0x46'))_0x339817[_0x5c2a('0x47')]=_0x53f7a0(_0x51a217,_0x339817['appdata']);_0x339817[_0x5c2a('0x48')]=_0x375cb4[_0x5c2a('0x23')]?_[_0x5c2a('0x49')](_0x375cb4)[_0x5c2a('0x48')]+0x1:_0x177bec;_0x2a3da8=_[_0x5c2a('0x4a')](_0x2a3da8,_0x375cb4,[_0x339817],_0x4f7ef5);_0x177bec=_['last'](_0x2a3da8)['priority']+0x1;}return _0xb9400b(_0x2a3da8);})[_0x5c2a('0x4b')](function(_0x22871c){_0x278b80(_0x22871c);});});}return _0x398c5a[_0x5c2a('0x4c')](_0x5c2a('0x4d'),attributes,{'tableName':_0x5c2a('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2ae4d){var _0x3f5f97=this[_0x5c2a('0x4f')]({'plain':!![]});var _0x4a0dd5=_0x3f5f97[_0x5c2a('0x3')]===_0x5c2a('0x10')?_0x5ad956(_0x3f5f97):_0x1f3eb3(_0x3f5f97);return _0x57e261(_0x3f5f97,_0x2ae4d,_[_0x5c2a('0x49')](_0x4a0dd5)[_0x5c2a('0x48')]+0x1)[_0x5c2a('0x30')](function(_0x308678){var _0x37b8b2=_[_0x5c2a('0x4a')](_0x4a0dd5,_0x308678);_0x37b8b2['push']({'type':_0x3f5f97[_0x5c2a('0x3')],'app':_0x5c2a('0x50'),'exten':_0x3f5f97[_0x5c2a('0x6')],'context':_0x3f5f97[_0x5c2a('0xa')],'priority':_[_0x5c2a('0x49')](_0x37b8b2)[_0x5c2a('0x48')]+0x1,'VoiceExtensionId':_0x3f5f97['id']});return _0x37b8b2;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 9256b26..2e60d12 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 _0x77f7=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceExtension','findAll','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4e8ac4,_0x2b9802){var _0x3a3e06=function(_0x2c5461){while(--_0x2c5461){_0x4e8ac4['push'](_0x4e8ac4['shift']());}};_0x3a3e06(++_0x2b9802);}(_0x77f7,0xbd));var _0x777f=function(_0x36adce,_0x3c5a1a){_0x36adce=_0x36adce-0x0;var _0x2ff31e=_0x77f7[_0x36adce];return _0x2ff31e;};'use strict';var _=require(_0x777f('0x0'));var util=require(_0x777f('0x1'));var moment=require(_0x777f('0x2'));var BPromise=require(_0x777f('0x3'));var rs=require(_0x777f('0x4'));var fs=require('fs');var Redis=require(_0x777f('0x5'));var db=require(_0x777f('0x6'))['db'];var utils=require(_0x777f('0x7'));var logger=require(_0x777f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x777f('0x9'));var client=jayson[_0x777f('0xa')][_0x777f('0xb')]({'port':0x232a});config[_0x777f('0xc')]=_[_0x777f('0xd')](config[_0x777f('0xc')],{'host':_0x777f('0xe'),'port':0x18eb});var socket=require(_0x777f('0xf'))(new Redis(config[_0x777f('0xc')]));require(_0x777f('0x10'))['register'](socket);function respondWithRpcPromise(_0xd2273,_0x5c218b,_0x26e215){return new BPromise(function(_0x167e01,_0x4d6f47){return client[_0x777f('0x11')](_0xd2273,_0x26e215)[_0x777f('0x12')](function(_0x1a4853){logger['info'](_0x777f('0x13'),_0x5c218b,_0x777f('0x14'));logger[_0x777f('0x15')](_0x777f('0x16'),_0x5c218b,_0x777f('0x14'),JSON[_0x777f('0x17')](_0x1a4853));if(_0x1a4853['error']){if(_0x1a4853[_0x777f('0x18')][_0x777f('0x19')]===0x1f4){logger['error'](_0x777f('0x13'),_0x5c218b,_0x1a4853[_0x777f('0x18')][_0x777f('0x1a')]);return _0x4d6f47(_0x1a4853[_0x777f('0x18')][_0x777f('0x1a')]);}logger[_0x777f('0x18')](_0x777f('0x13'),_0x5c218b,_0x1a4853['error'][_0x777f('0x1a')]);return _0x167e01(_0x1a4853[_0x777f('0x18')][_0x777f('0x1a')]);}else{logger[_0x777f('0x1b')](_0x777f('0x13'),_0x5c218b,_0x777f('0x14'));_0x167e01(_0x1a4853[_0x777f('0x1c')]['message']);}})['catch'](function(_0x40c91e){logger[_0x777f('0x18')](_0x777f('0x13'),_0x5c218b,_0x40c91e);_0x4d6f47(_0x40c91e);});});}exports[_0x777f('0x1d')]=function(_0xa0c7f1){var _0x1c4b0f=this;return new Promise(function(_0x1897f0,_0x143f3d){return db['VoiceExtension'][_0x777f('0x1e')]({'raw':_0xa0c7f1['options']?_0xa0c7f1[_0x777f('0x1f')][_0x777f('0x20')]===undefined?!![]:![]:!![],'where':_0xa0c7f1[_0x777f('0x1f')]?_0xa0c7f1[_0x777f('0x1f')][_0x777f('0x21')]||null:null,'attributes':_0xa0c7f1[_0x777f('0x1f')]?_0xa0c7f1[_0x777f('0x1f')]['attributes']||null:null,'limit':_0xa0c7f1[_0x777f('0x1f')]?_0xa0c7f1[_0x777f('0x1f')]['limit']||null:null,'include':_0xa0c7f1[_0x777f('0x1f')]?_0xa0c7f1['options'][_0x777f('0x22')]?_[_0x777f('0x23')](_0xa0c7f1[_0x777f('0x1f')][_0x777f('0x22')],function(_0x43a7c1){return{'model':db[_0x43a7c1[_0x777f('0x24')]],'as':_0x43a7c1['as'],'attributes':_0x43a7c1[_0x777f('0x25')],'include':_0x43a7c1[_0x777f('0x22')]?_[_0x777f('0x23')](_0x43a7c1['include'],function(_0x5b865c){return{'model':db[_0x5b865c[_0x777f('0x24')]],'as':_0x5b865c['as'],'attributes':_0x5b865c[_0x777f('0x25')],'include':_0x5b865c[_0x777f('0x22')]?_[_0x777f('0x23')](_0x5b865c[_0x777f('0x22')],function(_0x32007e){return{'model':db[_0x32007e[_0x777f('0x24')]],'as':_0x32007e['as'],'attributes':_0x32007e['attributes']};}):[]};}):[]};}):[]:[]})[_0x777f('0x12')](function(_0x3940cb){logger['info'](_0x777f('0x1d'),_0xa0c7f1);logger[_0x777f('0x15')]('GetVoiceExtension',_0xa0c7f1,JSON['stringify'](_0x3940cb));_0x1897f0(_0x3940cb);})[_0x777f('0x26')](function(_0x10e02e){logger[_0x777f('0x18')](_0x777f('0x1d'),_0x10e02e[_0x777f('0x1a')],_0xa0c7f1);_0x143f3d(_0x1c4b0f[_0x777f('0x18')](0x1f4,_0x10e02e[_0x777f('0x1a')]));});});}; \ No newline at end of file +var _0xa13d=['raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','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'];(function(_0x13d2b5,_0x637906){var _0x21515b=function(_0x4f0caf){while(--_0x4f0caf){_0x13d2b5['push'](_0x13d2b5['shift']());}};_0x21515b(++_0x637906);}(_0xa13d,0x154));var _0xda13=function(_0x2528fe,_0xec4b9f){_0x2528fe=_0x2528fe-0x0;var _0xfb3c04=_0xa13d[_0x2528fe];return _0xfb3c04;};'use strict';var _=require(_0xda13('0x0'));var util=require('util');var moment=require(_0xda13('0x1'));var BPromise=require(_0xda13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda13('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xda13('0x4'));var logger=require(_0xda13('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda13('0x6'));var client=jayson[_0xda13('0x7')]['http']({'port':0x232a});config[_0xda13('0x8')]=_[_0xda13('0x9')](config[_0xda13('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xda13('0xa'))(new Redis(config[_0xda13('0x8')]));require(_0xda13('0xb'))[_0xda13('0xc')](socket);function respondWithRpcPromise(_0x1256f8,_0x29d821,_0xf307b6){return new BPromise(function(_0x202008,_0x139876){return client[_0xda13('0xd')](_0x1256f8,_0xf307b6)[_0xda13('0xe')](function(_0x3af482){logger[_0xda13('0xf')](_0xda13('0x10'),_0x29d821,_0xda13('0x11'));logger[_0xda13('0x12')](_0xda13('0x13'),_0x29d821,'request\x20sent',JSON[_0xda13('0x14')](_0x3af482));if(_0x3af482['error']){if(_0x3af482[_0xda13('0x15')][_0xda13('0x16')]===0x1f4){logger['error'](_0xda13('0x10'),_0x29d821,_0x3af482[_0xda13('0x15')][_0xda13('0x17')]);return _0x139876(_0x3af482[_0xda13('0x15')]['message']);}logger[_0xda13('0x15')](_0xda13('0x10'),_0x29d821,_0x3af482['error'][_0xda13('0x17')]);return _0x202008(_0x3af482['error'][_0xda13('0x17')]);}else{logger[_0xda13('0xf')](_0xda13('0x10'),_0x29d821,_0xda13('0x11'));_0x202008(_0x3af482[_0xda13('0x18')][_0xda13('0x17')]);}})[_0xda13('0x19')](function(_0x2790c8){logger['error'](_0xda13('0x10'),_0x29d821,_0x2790c8);_0x139876(_0x2790c8);});});}exports[_0xda13('0x1a')]=function(_0x19c00d){var _0x49cad2=this;return new Promise(function(_0x3ead85,_0x7a9700){return db[_0xda13('0x1b')][_0xda13('0x1c')]({'raw':_0x19c00d['options']?_0x19c00d[_0xda13('0x1d')][_0xda13('0x1e')]===undefined?!![]:![]:!![],'where':_0x19c00d[_0xda13('0x1d')]?_0x19c00d['options'][_0xda13('0x1f')]||null:null,'attributes':_0x19c00d[_0xda13('0x1d')]?_0x19c00d[_0xda13('0x1d')][_0xda13('0x20')]||null:null,'limit':_0x19c00d[_0xda13('0x1d')]?_0x19c00d[_0xda13('0x1d')][_0xda13('0x21')]||null:null,'include':_0x19c00d[_0xda13('0x1d')]?_0x19c00d['options'][_0xda13('0x22')]?_[_0xda13('0x23')](_0x19c00d[_0xda13('0x1d')][_0xda13('0x22')],function(_0x41cd49){return{'model':db[_0x41cd49['model']],'as':_0x41cd49['as'],'attributes':_0x41cd49['attributes'],'include':_0x41cd49[_0xda13('0x22')]?_['map'](_0x41cd49[_0xda13('0x22')],function(_0x386708){return{'model':db[_0x386708[_0xda13('0x24')]],'as':_0x386708['as'],'attributes':_0x386708[_0xda13('0x20')],'include':_0x386708[_0xda13('0x22')]?_[_0xda13('0x23')](_0x386708[_0xda13('0x22')],function(_0x206e00){return{'model':db[_0x206e00[_0xda13('0x24')]],'as':_0x206e00['as'],'attributes':_0x206e00['attributes']};}):[]};}):[]};}):[]:[]})[_0xda13('0xe')](function(_0x54c2f1){logger[_0xda13('0xf')](_0xda13('0x1a'),_0x19c00d);logger[_0xda13('0x12')](_0xda13('0x1a'),_0x19c00d,JSON['stringify'](_0x54c2f1));_0x3ead85(_0x54c2f1);})[_0xda13('0x19')](function(_0x383178){logger[_0xda13('0x15')](_0xda13('0x1a'),_0x383178[_0xda13('0x17')],_0x19c00d);_0x7a9700(_0x49cad2[_0xda13('0x15')](0x1f4,_0x383178[_0xda13('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 5eefe34..ef61b88 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x24a6d1,_0x5eb1f1){var _0x445f60=function(_0x461585){while(--_0x461585){_0x24a6d1['push'](_0x24a6d1['shift']());}};_0x445f60(++_0x5eb1f1);}(_0xf494,0x1c6));var _0x4f49=function(_0x46c2aa,_0x202480){_0x46c2aa=_0x46c2aa-0x0;var _0x2e98fa=_0xf494[_0x46c2aa];return _0x2e98fa;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x2b3abd,_0x59dbdd){var _0x328295=function(_0x56f5f3){while(--_0x56f5f3){_0x2b3abd['push'](_0x2b3abd['shift']());}};_0x328295(++_0x59dbdd);}(_0x4975,0x86));var _0x5497=function(_0x242e4a,_0x3266f5){_0x242e4a=_0x242e4a-0x0;var _0x2322a7=_0x4975[_0x242e4a];return _0x2322a7;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 8513c71..c2f39e5 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 _0xfb11=['index','/:id','show','get','/:id/messages','getMessages','post','create','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated'];(function(_0x4e696a,_0x50fba7){var _0x2b81d3=function(_0x57de84){while(--_0x57de84){_0x4e696a['push'](_0x4e696a['shift']());}};_0x2b81d3(++_0x50fba7);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xfb11[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xe')]('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xf')]);router['put'](_0x1fb1('0x9'),auth['isAuthenticated'](),controller[_0x1fb1('0x10')]);router['delete'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x11')]);module[_0x1fb1('0x12')]=router; \ No newline at end of file +var _0x781d=['/:id','show','post','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x100443,_0x24ca2b){var _0x5922f2=function(_0xfc6278){while(--_0xfc6278){_0x100443['push'](_0x100443['shift']());}};_0x5922f2(++_0x24ca2b);}(_0x781d,0x14a));var _0xd781=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x781d[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0x9')]('/:id/messages',auth[_0xd781('0xa')](),controller['getMessages']);router[_0xd781('0xe')]('/',auth[_0xd781('0xa')](),controller['create']);router[_0xd781('0xf')](_0xd781('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd781('0x10')](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0x11')]);module[_0xd781('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index d7f74b3..3c7e3c3 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 _0x05a3=['from-voicemail','contest_mailbox','email','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING'];(function(_0x118cd4,_0x2d4e5a){var _0x31b976=function(_0x265365){while(--_0x265365){_0x118cd4['push'](_0x118cd4['shift']());}};_0x31b976(++_0x2d4e5a);}(_0x05a3,0x1dd));var _0x305a=function(_0x382d3a,_0x1d4635){_0x382d3a=_0x382d3a-0x0;var _0x3a960d=_0x05a3[_0x382d3a];return _0x3a960d;};'use strict';var Sequelize=require(_0x305a('0x0'));module[_0x305a('0x1')]={'customer_id':{'type':Sequelize[_0x305a('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x305a('0x3'),'unique':_0x305a('0x4')},'mailbox':{'type':Sequelize[_0x305a('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x305a('0x2')]},'fullname':{'type':Sequelize[_0x305a('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3cdd25){this['setDataValue'](_0x305a('0x5'),typeof _0x3cdd25==='string'&&_0x3cdd25['trim']()?_0x3cdd25['trim']():null);}},'pager':{'type':Sequelize[_0x305a('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x305a('0x6')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x305a('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x305a('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x305a('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x305a('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':_0x305a('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x305a('0xa')},'emailsubject':{'type':Sequelize[_0x305a('0x2')]},'emailbody':{'type':Sequelize[_0x305a('0x2')]},'maxsecs':{'type':Sequelize[_0x305a('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x305a('0xc')],'get':function(){return this[_0x305a('0xd')](_0x305a('0xe'))+_0x305a('0xf')+this[_0x305a('0xd')]('mailbox');}}}; \ No newline at end of file +var _0x41a7=['setDataValue','email','string','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x14acea,_0x484bb1){var _0x42917e=function(_0x1ba4b3){while(--_0x1ba4b3){_0x14acea['push'](_0x14acea['shift']());}};_0x42917e(++_0x484bb1);}(_0x41a7,0x1d7));var _0x741a=function(_0x44fc5a,_0x2f2b17){_0x44fc5a=_0x44fc5a-0x0;var _0x278736=_0x41a7[_0x44fc5a];return _0x278736;};'use strict';var Sequelize=require(_0x741a('0x0'));module[_0x741a('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x741a('0x2')],'defaultValue':_0x741a('0x3'),'unique':_0x741a('0x4')},'mailbox':{'type':Sequelize[_0x741a('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x741a('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4a9d28){this[_0x741a('0x5')](_0x741a('0x6'),typeof _0x4a9d28===_0x741a('0x7')&&_0x4a9d28['trim']()?_0x4a9d28['trim']():null);}},'pager':{'type':Sequelize[_0x741a('0x2')]},'tz':{'type':Sequelize[_0x741a('0x2')],'defaultValue':_0x741a('0x8')},'attach':{'type':Sequelize[_0x741a('0x9')](_0x741a('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x741a('0x9')](_0x741a('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x741a('0x2')]},'review':{'type':Sequelize[_0x741a('0x9')](_0x741a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x741a('0x9')](_0x741a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x741a('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x741a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x741a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x741a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x741a('0x9')](_0x741a('0xa'),'no'),'defaultValue':_0x741a('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x741a('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x741a('0x9')](_0x741a('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x741a('0x9')](_0x741a('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x741a('0xb')},'emailsubject':{'type':Sequelize[_0x741a('0x2')]},'emailbody':{'type':Sequelize[_0x741a('0x2')]},'maxsecs':{'type':Sequelize[_0x741a('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x741a('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x741a('0xd')],'get':function(){return this[_0x741a('0xe')]('fullname')+_0x741a('0xf')+this[_0x741a('0xe')](_0x741a('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 74b8c2c..dec7f95 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 _0x3f8c=['create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','Voicemails','UserProfileResource','destroy','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch'];(function(_0x17e369,_0x24c4cd){var _0x3e8060=function(_0x269879){while(--_0x269879){_0x17e369['push'](_0x17e369['shift']());}};_0x3e8060(++_0x24c4cd);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1c935e,_0x4dd0bc){_0x1c935e=_0x1c935e-0x0;var _0x12db19=_0x3f8c[_0x1c935e];return _0x12db19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){var _0x3f196d=_0x2559a4['get']({'plain':!![]});var _0x4569c2=_0xc3f8('0x22');return db[_0xc3f8('0x23')][_0xc3f8('0x24')]({'where':{'type':_0x4569c2,'resourceId':_0x3f196d['id']}})[_0xc3f8('0x21')](function(){return _0x2559a4;});})[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)[_0xc3f8('0x18')]();});}};}function handleEntityNotFound(_0x21b002,_0xbea3b8){return function(_0x22c8e6){if(!_0x22c8e6){_0x21b002[_0xc3f8('0x16')](0x194);}return _0x22c8e6;};}function handleError(_0x238ff5,_0x429fd8){_0x429fd8=_0x429fd8||0x1f4;return function(_0x59e4dd){logger[_0xc3f8('0x25')](_0x59e4dd[_0xc3f8('0x26')]);if(_0x59e4dd[_0xc3f8('0x27')]){delete _0x59e4dd['name'];}_0x238ff5[_0xc3f8('0x17')](_0x429fd8)['send'](_0x59e4dd);};}exports[_0xc3f8('0x28')]=function(_0x32343e,_0x47ab53){var _0x48b32e={},_0x21a225={},_0x25df65={'count':0x0,'rows':[]};var _0xd32b09=_[_0xc3f8('0x29')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')],function(_0x680047){return{'name':_0x680047[_0xc3f8('0x2c')],'type':_0x680047[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x21a225['model']=_[_0xc3f8('0x29')](_0xd32b09,_0xc3f8('0x27'));_0x21a225[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x32343e[_0xc3f8('0x2f')]);_0x21a225['filters']=_['intersection'](_0x21a225[_0xc3f8('0x31')],_0x21a225[_0xc3f8('0x2f')]);_0x48b32e[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x21a225[_0xc3f8('0x31')],qs['fields'](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x48b32e[_0xc3f8('0x32')]=_0x48b32e['attributes'][_0xc3f8('0x35')]?_0x48b32e[_0xc3f8('0x32')]:_0x21a225[_0xc3f8('0x31')];if(!_0x32343e['query'][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x48b32e['limit']=qs[_0xc3f8('0x1b')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x48b32e[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x32343e[_0xc3f8('0x2f')]['offset']);}_0x48b32e[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x48b32e[_0xc3f8('0x3a')]=qs['filters'](_[_0xc3f8('0x3b')](_0x32343e[_0xc3f8('0x2f')],_0x21a225[_0xc3f8('0x3c')]),_0xd32b09);if(_0x32343e['query'][_0xc3f8('0x3d')]){_0x48b32e[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x48b32e[_0xc3f8('0x3a')],{'$or':_['map'](_0xd32b09,function(_0x306182){if(_0x306182[_0xc3f8('0x2d')]!==_0xc3f8('0x3f')){var _0x37b104={};_0x37b104[_0x306182['name']]={'$like':'%'+_0x32343e[_0xc3f8('0x2f')]['filter']+'%'};return _0x37b104;}})});}_0x48b32e=_['merge']({},_0x48b32e,_0x32343e[_0xc3f8('0x40')]);var _0x1f3aef={'where':_0x48b32e[_0xc3f8('0x3a')]};return db[_0xc3f8('0x2a')]['count'](_0x1f3aef)['then'](function(_0x361a85){_0x25df65[_0xc3f8('0x1c')]=_0x361a85;if(_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x48b32e[_0xc3f8('0x42')]=[{'all':!![]}];}return db[_0xc3f8('0x2a')][_0xc3f8('0x43')](_0x48b32e);})[_0xc3f8('0x21')](function(_0x13d8dc){_0x25df65[_0xc3f8('0x44')]=_0x13d8dc;return _0x25df65;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x47ab53,_0x48b32e))['catch'](handleError(_0x47ab53,null));};exports[_0xc3f8('0x45')]=function(_0x22e9b3,_0x4b327f){var _0x1aff20={'raw':!![],'where':{'id':_0x22e9b3['params']['id']}},_0x172f1a={};_0x172f1a[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')]);_0x172f1a[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x22e9b3[_0xc3f8('0x2f')]);_0x172f1a[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],_0x172f1a[_0xc3f8('0x2f')]);_0x1aff20['attributes']=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],qs['fields'](_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x1aff20[_0xc3f8('0x32')]=_0x1aff20[_0xc3f8('0x32')]['length']?_0x1aff20['attributes']:_0x172f1a[_0xc3f8('0x31')];if(_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x1aff20['include']=[{'all':!![]}];}_0x1aff20=_[_0xc3f8('0x3e')]({},_0x1aff20,_0x22e9b3[_0xc3f8('0x40')]);return db[_0xc3f8('0x2a')][_0xc3f8('0x46')](_0x1aff20)[_0xc3f8('0x21')](handleEntityNotFound(_0x4b327f,null))['then'](respondWithResult(_0x4b327f,null))[_0xc3f8('0x47')](handleError(_0x4b327f,null));};exports[_0xc3f8('0x48')]=function(_0x5961ab,_0x1becae){return db[_0xc3f8('0x2a')][_0xc3f8('0x48')](_0x5961ab[_0xc3f8('0x49')],{})[_0xc3f8('0x21')](function(_0x3045bc){var _0x1ca7c9=_0x5961ab['user'][_0xc3f8('0x4a')]({'plain':!![]});if(!_0x1ca7c9)throw new Error(_0xc3f8('0x4b'));if(_0x1ca7c9['role']===_0xc3f8('0x4c')){var _0x2e9f93=_0x3045bc[_0xc3f8('0x4a')]({'plain':!![]});var _0x33e5c5=_0xc3f8('0x22');return db[_0xc3f8('0x4d')][_0xc3f8('0x46')]({'where':{'name':_0x33e5c5,'userProfileId':_0x1ca7c9['userProfileId']},'raw':!![]})[_0xc3f8('0x21')](function(_0x2c6999){if(_0x2c6999&&_0x2c6999[_0xc3f8('0x4e')]===0x0){return db[_0xc3f8('0x23')][_0xc3f8('0x48')]({'name':_0x2e9f93[_0xc3f8('0x27')],'resourceId':_0x2e9f93['id'],'type':_0x2c6999[_0xc3f8('0x27')],'sectionId':_0x2c6999['id']},{})[_0xc3f8('0x21')](function(){return _0x3045bc;});}else{return _0x3045bc;}})['catch'](function(_0x51249a){logger[_0xc3f8('0x25')](_0xc3f8('0x4f'),_0x51249a);throw _0x51249a;});}return _0x3045bc;})['then'](respondWithResult(_0x1becae,0xc9))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x20')]=function(_0x4b4adb,_0x1b1e13){if(_0x4b4adb[_0xc3f8('0x49')]['id']){delete _0x4b4adb[_0xc3f8('0x49')]['id'];}return db['VoiceMail'][_0xc3f8('0x46')]({'where':{'id':_0x4b4adb['params']['id']}})['then'](handleEntityNotFound(_0x1b1e13,null))[_0xc3f8('0x21')](saveUpdates(_0x4b4adb['body'],null))[_0xc3f8('0x21')](respondWithResult(_0x1b1e13,null))[_0xc3f8('0x47')](handleError(_0x1b1e13,null));};exports[_0xc3f8('0x24')]=function(_0x490f37,_0xcb45c1){return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x490f37[_0xc3f8('0x50')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0xcb45c1,null))['then'](removeEntity(_0xcb45c1,null))['catch'](handleError(_0xcb45c1,null));};exports[_0xc3f8('0x51')]=function(_0x326dcc,_0x2f1b68,_0x3a268d){return db[_0xc3f8('0x2a')]['findOne']({'where':{'id':_0x326dcc[_0xc3f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f1b68,null))[_0xc3f8('0x21')](function(_0x337029){var _0x163264;var _0xd5d6a7={},_0x5c6f6e={};_0x5c6f6e[_0xc3f8('0x31')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x5c6f6e['query']=_[_0xc3f8('0x30')](_0x326dcc[_0xc3f8('0x2f')]);_0x5c6f6e[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x5c6f6e[_0xc3f8('0x31')],_0x5c6f6e[_0xc3f8('0x2f')]);_0xd5d6a7[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x5c6f6e['model'],qs[_0xc3f8('0x34')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0xd5d6a7[_0xc3f8('0x32')]=_0xd5d6a7[_0xc3f8('0x32')]['length']?_0xd5d6a7[_0xc3f8('0x32')]:_0x5c6f6e[_0xc3f8('0x31')];if(!_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0xd5d6a7['limit']=qs[_0xc3f8('0x1b')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0xd5d6a7[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x326dcc[_0xc3f8('0x2f')]['offset']);}_0xd5d6a7[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x326dcc[_0xc3f8('0x2f')]['sort']);_0xd5d6a7[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3c')](_['pick'](_0x326dcc['query'],_0x5c6f6e[_0xc3f8('0x3c')]));if(_0x326dcc[_0xc3f8('0x2f')]['filter']){_0xd5d6a7[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0xd5d6a7[_0xc3f8('0x3a')],{'$or':_[_0xc3f8('0x29')](_0xd5d6a7[_0xc3f8('0x32')],function(_0x30a23a){var _0x1e62ec={};_0x1e62ec[_0x30a23a]={'$like':'%'+_0x326dcc[_0xc3f8('0x2f')]['filter']+'%'};return _0x1e62ec;})});}_0xd5d6a7['where']=_[_0xc3f8('0x3e')](_0xd5d6a7['where'],{'mailboxuser':_0x337029['mailbox']});_0xd5d6a7=_['merge']({},_0xd5d6a7,_0x326dcc['options']);return db['VoiceMailMessage'][_0xc3f8('0x52')](_0xd5d6a7)[_0xc3f8('0x21')](respondWithFilteredResult(_0x2f1b68,_0xd5d6a7));})[_0xc3f8('0x47')](handleError(_0x2f1b68,null));}; \ No newline at end of file +var _0x0972=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','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','get','Voicemails','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','findAll','rows','catch','params','length','options'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x0972,0x64));var _0x2097=function(_0x398f3b,_0x395c84){_0x398f3b=_0x398f3b-0x0;var _0x1cbc10=_0x0972[_0x398f3b];return _0x1cbc10;};'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(){var _0x3f9279=_0x56390a[_0x2097('0x28')]({'plain':!![]});var _0x345875=_0x2097('0x29');return db['UserProfileResource'][_0x2097('0x27')]({'where':{'type':_0x345875,'resourceId':_0x3f9279['id']}})[_0x2097('0x26')](function(){return _0x56390a;});})['then'](function(){_0x36b15e[_0x2097('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b879,_0x48ae06){return function(_0xbc0339){if(!_0xbc0339){_0x29b879[_0x2097('0x1a')](0x194);}return _0xbc0339;};}function handleError(_0x407a2a,_0x7eefb4){_0x7eefb4=_0x7eefb4||0x1f4;return function(_0x410afa){logger[_0x2097('0x2a')](_0x410afa[_0x2097('0x2b')]);if(_0x410afa['name']){delete _0x410afa[_0x2097('0x2c')];}_0x407a2a[_0x2097('0x1b')](_0x7eefb4)['send'](_0x410afa);};}exports[_0x2097('0x2d')]=function(_0x41487d,_0x59fb84){var _0x4d0916={},_0x312c77={},_0x11b051={'count':0x0,'rows':[]};var _0x1649c8=_[_0x2097('0x2e')](db[_0x2097('0x2f')][_0x2097('0x30')],function(_0x56c538){return{'name':_0x56c538[_0x2097('0x31')],'type':_0x56c538['type'][_0x2097('0x32')]};});_0x312c77[_0x2097('0x33')]=_[_0x2097('0x2e')](_0x1649c8,_0x2097('0x2c'));_0x312c77[_0x2097('0x34')]=_[_0x2097('0x35')](_0x41487d[_0x2097('0x34')]);_0x312c77[_0x2097('0x36')]=_[_0x2097('0x37')](_0x312c77['model'],_0x312c77[_0x2097('0x34')]);_0x4d0916[_0x2097('0x38')]=_[_0x2097('0x37')](_0x312c77['model'],qs[_0x2097('0x39')](_0x41487d[_0x2097('0x34')][_0x2097('0x39')]));_0x4d0916[_0x2097('0x38')]=_0x4d0916['attributes']['length']?_0x4d0916['attributes']:_0x312c77[_0x2097('0x33')];if(!_0x41487d[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x4d0916[_0x2097('0x1f')]=qs[_0x2097('0x1f')](_0x41487d['query'][_0x2097('0x1f')]);_0x4d0916[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x41487d[_0x2097('0x34')][_0x2097('0x1e')]);}_0x4d0916[_0x2097('0x3c')]=qs['sort'](_0x41487d[_0x2097('0x34')][_0x2097('0x3d')]);_0x4d0916[_0x2097('0x3e')]=qs['filters'](_['pick'](_0x41487d[_0x2097('0x34')],_0x312c77[_0x2097('0x36')]),_0x1649c8);if(_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]){_0x4d0916[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x4d0916[_0x2097('0x3e')],{'$or':_[_0x2097('0x2e')](_0x1649c8,function(_0x23c4a5){if(_0x23c4a5[_0x2097('0x41')]!==_0x2097('0x42')){var _0x1ef92a={};_0x1ef92a[_0x23c4a5['name']]={'$like':'%'+_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1ef92a;}})});}_0x4d0916=_[_0x2097('0x40')]({},_0x4d0916,_0x41487d['options']);var _0x1394df={'where':_0x4d0916[_0x2097('0x3e')]};return db[_0x2097('0x2f')][_0x2097('0x21')](_0x1394df)[_0x2097('0x26')](function(_0xd4d89e){_0x11b051[_0x2097('0x21')]=_0xd4d89e;if(_0x41487d[_0x2097('0x34')]['includeAll']){_0x4d0916[_0x2097('0x43')]=[{'all':!![]}];}return db[_0x2097('0x2f')][_0x2097('0x44')](_0x4d0916);})[_0x2097('0x26')](function(_0x12e0e2){_0x11b051[_0x2097('0x45')]=_0x12e0e2;return _0x11b051;})[_0x2097('0x26')](respondWithFilteredResult(_0x59fb84,_0x4d0916))[_0x2097('0x46')](handleError(_0x59fb84,null));};exports['show']=function(_0x3fc3fe,_0x5869d8){var _0x3e0739={'raw':!![],'where':{'id':_0x3fc3fe[_0x2097('0x47')]['id']}},_0x298e49={};_0x298e49[_0x2097('0x33')]=_[_0x2097('0x35')](db['VoiceMail'][_0x2097('0x30')]);_0x298e49[_0x2097('0x34')]=_[_0x2097('0x35')](_0x3fc3fe[_0x2097('0x34')]);_0x298e49[_0x2097('0x36')]=_['intersection'](_0x298e49[_0x2097('0x33')],_0x298e49[_0x2097('0x34')]);_0x3e0739[_0x2097('0x38')]=_[_0x2097('0x37')](_0x298e49[_0x2097('0x33')],qs[_0x2097('0x39')](_0x3fc3fe[_0x2097('0x34')][_0x2097('0x39')]));_0x3e0739['attributes']=_0x3e0739[_0x2097('0x38')][_0x2097('0x48')]?_0x3e0739[_0x2097('0x38')]:_0x298e49[_0x2097('0x33')];if(_0x3fc3fe['query']['includeAll']){_0x3e0739['include']=[{'all':!![]}];}_0x3e0739=_[_0x2097('0x40')]({},_0x3e0739,_0x3fc3fe[_0x2097('0x49')]);return db['VoiceMail'][_0x2097('0x4a')](_0x3e0739)[_0x2097('0x26')](handleEntityNotFound(_0x5869d8,null))['then'](respondWithResult(_0x5869d8,null))['catch'](handleError(_0x5869d8,null));};exports[_0x2097('0x4b')]=function(_0x21829d,_0x1b4de6){return db['VoiceMail'][_0x2097('0x4b')](_0x21829d[_0x2097('0x4c')],{})['then'](function(_0x86a05a){var _0x2682a9=_0x21829d[_0x2097('0x4d')][_0x2097('0x28')]({'plain':!![]});if(!_0x2682a9)throw new Error(_0x2097('0x4e'));if(_0x2682a9['role']==='user'){var _0x140b41=_0x86a05a[_0x2097('0x28')]({'plain':!![]});var _0x329632='Voicemails';return db['UserProfileSection'][_0x2097('0x4a')]({'where':{'name':_0x329632,'userProfileId':_0x2682a9[_0x2097('0x4f')]},'raw':!![]})['then'](function(_0x41cd90){if(_0x41cd90&&_0x41cd90[_0x2097('0x50')]===0x0){return db[_0x2097('0x51')][_0x2097('0x4b')]({'name':_0x140b41[_0x2097('0x2c')],'resourceId':_0x140b41['id'],'type':_0x41cd90['name'],'sectionId':_0x41cd90['id']},{})[_0x2097('0x26')](function(){return _0x86a05a;});}else{return _0x86a05a;}})[_0x2097('0x46')](function(_0x190859){logger['error'](_0x2097('0x52'),_0x190859);throw _0x190859;});}return _0x86a05a;})[_0x2097('0x26')](respondWithResult(_0x1b4de6,0xc9))['catch'](handleError(_0x1b4de6,null));};exports[_0x2097('0x25')]=function(_0x4d6ed6,_0x30b4cd){if(_0x4d6ed6['body']['id']){delete _0x4d6ed6['body']['id'];}return db['VoiceMail'][_0x2097('0x4a')]({'where':{'id':_0x4d6ed6['params']['id']}})['then'](handleEntityNotFound(_0x30b4cd,null))[_0x2097('0x26')](saveUpdates(_0x4d6ed6['body'],null))[_0x2097('0x26')](respondWithResult(_0x30b4cd,null))[_0x2097('0x46')](handleError(_0x30b4cd,null));};exports['destroy']=function(_0x3e799f,_0x3e2e45){return db[_0x2097('0x2f')][_0x2097('0x4a')]({'where':{'id':_0x3e799f[_0x2097('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e2e45,null))[_0x2097('0x26')](removeEntity(_0x3e2e45,null))['catch'](handleError(_0x3e2e45,null));};exports[_0x2097('0x53')]=function(_0x140e43,_0x24f166,_0x55e3cd){return db[_0x2097('0x2f')][_0x2097('0x54')]({'where':{'id':_0x140e43[_0x2097('0x47')]['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x24f166,null))[_0x2097('0x26')](function(_0x56cfbf){var _0x5b9fa2;var _0x265eac={},_0x275578={};_0x275578['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x275578[_0x2097('0x34')]=_['keys'](_0x140e43[_0x2097('0x34')]);_0x275578[_0x2097('0x36')]=_['intersection'](_0x275578[_0x2097('0x33')],_0x275578[_0x2097('0x34')]);_0x265eac[_0x2097('0x38')]=_[_0x2097('0x37')](_0x275578[_0x2097('0x33')],qs[_0x2097('0x39')](_0x140e43[_0x2097('0x34')][_0x2097('0x39')]));_0x265eac[_0x2097('0x38')]=_0x265eac['attributes'][_0x2097('0x48')]?_0x265eac[_0x2097('0x38')]:_0x275578[_0x2097('0x33')];if(!_0x140e43[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x265eac['limit']=qs[_0x2097('0x1f')](_0x140e43[_0x2097('0x34')][_0x2097('0x1f')]);_0x265eac[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x140e43['query'][_0x2097('0x1e')]);}_0x265eac[_0x2097('0x3c')]=qs['sort'](_0x140e43['query']['sort']);_0x265eac[_0x2097('0x3e')]=qs[_0x2097('0x36')](_[_0x2097('0x55')](_0x140e43[_0x2097('0x34')],_0x275578[_0x2097('0x36')]));if(_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]){_0x265eac[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x265eac['where'],{'$or':_['map'](_0x265eac[_0x2097('0x38')],function(_0x34d832){var _0x1eeb30={};_0x1eeb30[_0x34d832]={'$like':'%'+_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1eeb30;})});}_0x265eac[_0x2097('0x3e')]=_['merge'](_0x265eac[_0x2097('0x3e')],{'mailboxuser':_0x56cfbf[_0x2097('0x56')]});_0x265eac=_[_0x2097('0x40')]({},_0x265eac,_0x140e43[_0x2097('0x49')]);return db['VoiceMailMessage']['findAndCountAll'](_0x265eac)[_0x2097('0x26')](respondWithFilteredResult(_0x24f166,_0x265eac));})[_0x2097('0x46')](handleError(_0x24f166,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 206fc9d..15383f9 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 _0x5847=['voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5847,0x7b));var _0x7584=function(_0xd6e35c,_0x31fde0){_0xd6e35c=_0xd6e35c-0x0;var _0x51f501=_0x5847[_0xd6e35c];return _0x51f501;};'use strict';var _=require(_0x7584('0x0'));var util=require(_0x7584('0x1'));var logger=require(_0x7584('0x2'))(_0x7584('0x3'));var moment=require(_0x7584('0x4'));var BPromise=require(_0x7584('0x5'));var rp=require(_0x7584('0x6'));var fs=require('fs');var path=require(_0x7584('0x7'));var rimraf=require(_0x7584('0x8'));var config=require('../../config/environment');var attributes=require(_0x7584('0x9'));module[_0x7584('0xa')]=function(_0x346986,_0x3eb95e){return _0x346986[_0x7584('0xb')]('VoiceMail',attributes,{'tableName':_0x7584('0xc'),'paranoid':![],'indexes':[{'name':_0x7584('0xd'),'fields':['mailbox',_0x7584('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5c3=['moment','path','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','lodash','util','../../config/logger','api'];(function(_0x1116cd,_0x41a0b7){var _0x52974a=function(_0x3c4e70){while(--_0x3c4e70){_0x1116cd['push'](_0x1116cd['shift']());}};_0x52974a(++_0x41a0b7);}(_0xc5c3,0x1b6));var _0x3c5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3c5c('0x0'));var util=require(_0x3c5c('0x1'));var logger=require(_0x3c5c('0x2'))(_0x3c5c('0x3'));var moment=require(_0x3c5c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c5c('0x5'));var rimraf=require(_0x3c5c('0x6'));var config=require(_0x3c5c('0x7'));var attributes=require(_0x3c5c('0x8'));module['exports']=function(_0x309805,_0x46b9bf){return _0x309805[_0x3c5c('0x9')](_0x3c5c('0xa'),attributes,{'tableName':_0x3c5c('0xb'),'paranoid':![],'indexes':[{'name':_0x3c5c('0xc'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 0e35656..35dba0b 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 _0x4ee1=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch'];(function(_0x1ed1ec,_0x5abb1c){var _0x4fd7f0=function(_0xb64b38){while(--_0xb64b38){_0x1ed1ec['push'](_0x1ed1ec['shift']());}};_0x4fd7f0(++_0x5abb1c);}(_0x4ee1,0x18c));var _0x14ee=function(_0x234b48,_0x59757b){_0x234b48=_0x234b48-0x0;var _0x210836=_0x4ee1[_0x234b48];return _0x210836;};'use strict';var _=require(_0x14ee('0x0'));var util=require(_0x14ee('0x1'));var moment=require('moment');var BPromise=require(_0x14ee('0x2'));var rs=require(_0x14ee('0x3'));var fs=require('fs');var Redis=require(_0x14ee('0x4'));var db=require(_0x14ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x14ee('0x6'))(_0x14ee('0x7'));var config=require(_0x14ee('0x8'));var jayson=require(_0x14ee('0x9'));var client=jayson[_0x14ee('0xa')][_0x14ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5db406,_0xa8ebfe,_0x304f13){return new BPromise(function(_0x5711bc,_0x1633a9){return client[_0x14ee('0xc')](_0x5db406,_0x304f13)[_0x14ee('0xd')](function(_0x37bffb){logger['info']('VoiceMail,\x20%s,\x20%s',_0xa8ebfe,_0x14ee('0xe'));logger['debug'](_0x14ee('0xf'),_0xa8ebfe,'request\x20sent',JSON['stringify'](_0x37bffb));if(_0x37bffb[_0x14ee('0x10')]){if(_0x37bffb[_0x14ee('0x10')][_0x14ee('0x11')]===0x1f4){logger[_0x14ee('0x10')](_0x14ee('0x12'),_0xa8ebfe,_0x37bffb['error'][_0x14ee('0x13')]);return _0x1633a9(_0x37bffb[_0x14ee('0x10')][_0x14ee('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0xa8ebfe,_0x37bffb[_0x14ee('0x10')][_0x14ee('0x13')]);return _0x5711bc(_0x37bffb['error'][_0x14ee('0x13')]);}else{logger['info'](_0x14ee('0x12'),_0xa8ebfe,_0x14ee('0xe'));_0x5711bc(_0x37bffb[_0x14ee('0x14')]['message']);}})[_0x14ee('0x15')](function(_0x401b29){logger['error'](_0x14ee('0x12'),_0xa8ebfe,_0x401b29);_0x1633a9(_0x401b29);});});} \ No newline at end of file +var _0xb0d3=['message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x40cc29,_0x98caa8){var _0x12d3b0=function(_0x3d86ca){while(--_0x3d86ca){_0x40cc29['push'](_0x40cc29['shift']());}};_0x12d3b0(++_0x98caa8);}(_0xb0d3,0x1a4));var _0x3b0d=function(_0x2cbb78,_0x282b39){_0x2cbb78=_0x2cbb78-0x0;var _0x53ee5e=_0xb0d3[_0x2cbb78];return _0x53ee5e;};'use strict';var _=require(_0x3b0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3b0d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b0d('0x2'));var db=require(_0x3b0d('0x3'))['db'];var utils=require(_0x3b0d('0x4'));var logger=require(_0x3b0d('0x5'))(_0x3b0d('0x6'));var config=require('../../config/environment');var jayson=require(_0x3b0d('0x7'));var client=jayson[_0x3b0d('0x8')][_0x3b0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x508f9f,_0x43e1a4,_0x192c30){return new BPromise(function(_0x3f679c,_0x320e53){return client['request'](_0x508f9f,_0x192c30)[_0x3b0d('0xa')](function(_0x5566c0){logger[_0x3b0d('0xb')](_0x3b0d('0xc'),_0x43e1a4,'request\x20sent');logger['debug'](_0x3b0d('0xd'),_0x43e1a4,_0x3b0d('0xe'),JSON[_0x3b0d('0xf')](_0x5566c0));if(_0x5566c0['error']){if(_0x5566c0[_0x3b0d('0x10')]['code']===0x1f4){logger['error'](_0x3b0d('0xc'),_0x43e1a4,_0x5566c0[_0x3b0d('0x10')]['message']);return _0x320e53(_0x5566c0[_0x3b0d('0x10')]['message']);}logger[_0x3b0d('0x10')](_0x3b0d('0xc'),_0x43e1a4,_0x5566c0[_0x3b0d('0x10')][_0x3b0d('0x11')]);return _0x3f679c(_0x5566c0[_0x3b0d('0x10')][_0x3b0d('0x11')]);}else{logger['info'](_0x3b0d('0xc'),_0x43e1a4,_0x3b0d('0xe'));_0x3f679c(_0x5566c0['result'][_0x3b0d('0x11')]);}})[_0x3b0d('0x12')](function(_0x3e0a05){logger[_0x3b0d('0x10')](_0x3b0d('0xc'),_0x43e1a4,_0x3e0a05);_0x320e53(_0x3e0a05);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 64bb0cc..4a08d73 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 _0x3030=['index','show','/:id/download','download','post','put','/:id','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x5eaefe,_0xc72159){var _0xe64929=function(_0x15f626){while(--_0x15f626){_0x5eaefe['push'](_0x5eaefe['shift']());}};_0xe64929(++_0xc72159);}(_0x3030,0xe6));var _0x0303=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x3030[_0x166d93];return _0xba708;};'use strict';var multer=require(_0x0303('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0303('0x1'));var express=require('express');var router=express[_0x0303('0x2')]();var fs_extra=require(_0x0303('0x3'));var auth=require(_0x0303('0x4'));var interaction=require(_0x0303('0x5'));var config=require(_0x0303('0x6'));var controller=require(_0x0303('0x7'));router[_0x0303('0x8')]('/',auth[_0x0303('0x9')](),controller[_0x0303('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0303('0xb')]);router['get'](_0x0303('0xc'),auth['isAuthenticated'](),controller[_0x0303('0xd')]);router[_0x0303('0xe')]('/',auth[_0x0303('0x9')](),controller['create']);router[_0x0303('0xf')](_0x0303('0x10'),auth[_0x0303('0x9')](),controller['update']);router[_0x0303('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0303('0x12')]);module[_0x0303('0x13')]=router; \ No newline at end of file +var _0x77e0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','download','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x77e0,0x162));var _0x077e=function(_0x4071d4,_0x52d7d2){_0x4071d4=_0x4071d4-0x0;var _0x4fbf42=_0x77e0[_0x4071d4];return _0x4fbf42;};'use strict';var multer=require(_0x077e('0x0'));var util=require(_0x077e('0x1'));var path=require(_0x077e('0x2'));var timeout=require(_0x077e('0x3'));var express=require(_0x077e('0x4'));var router=express[_0x077e('0x5')]();var fs_extra=require(_0x077e('0x6'));var auth=require(_0x077e('0x7'));var interaction=require(_0x077e('0x8'));var config=require(_0x077e('0x9'));var controller=require('./voiceMailMessage.controller');router[_0x077e('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x077e('0xa')](_0x077e('0xb'),auth['isAuthenticated'](),controller[_0x077e('0xc')]);router[_0x077e('0xa')]('/:id/download',auth[_0x077e('0xd')](),controller[_0x077e('0xe')]);router[_0x077e('0xf')]('/',auth[_0x077e('0xd')](),controller['create']);router[_0x077e('0x10')]('/:id',auth[_0x077e('0xd')](),controller[_0x077e('0x11')]);router[_0x077e('0x12')](_0x077e('0xb'),auth[_0x077e('0xd')](),controller[_0x077e('0x13')]);module[_0x077e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 96dff40..b71597d 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 _0xfc9e=['BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x4b247d,_0x39bde){var _0x22e8aa=function(_0x13d152){while(--_0x13d152){_0x4b247d['push'](_0x4b247d['shift']());}};_0x22e8aa(++_0x39bde);}(_0xfc9e,0x94));var _0xefc9=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0xfc9e[_0x2c3a8f];return _0x189412;};'use strict';var Sequelize=require('sequelize');module[_0xefc9('0x0')]={'name':{'type':Sequelize[_0xefc9('0x1')],'get':function(_0x4600e5){return this[_0xefc9('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xefc9('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xefc9('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'stamp':{'type':_0xefc9('0x6'),'defaultValue':Sequelize[_0xefc9('0x7')](_0xefc9('0x8'))}}; \ No newline at end of file +var _0xe0b9=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL'];(function(_0x389e37,_0x8e06ea){var _0x25aa82=function(_0x1df8c4){while(--_0x1df8c4){_0x389e37['push'](_0x389e37['shift']());}};_0x25aa82(++_0x8e06ea);}(_0xe0b9,0xd0));var _0x9e0b=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0xe0b9[_0x104a84];return _0x4973ff;};'use strict';var Sequelize=require('sequelize');module[_0x9e0b('0x0')]={'name':{'type':Sequelize[_0x9e0b('0x1')],'get':function(_0x3be33c){return this[_0x9e0b('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x9e0b('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x9e0b('0x5')](_0x9e0b('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9e0b('0x4')],'defaultValue':''},'stamp':{'type':_0x9e0b('0x7'),'defaultValue':Sequelize[_0x9e0b('0x8')](_0x9e0b('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 4c51248..5712d90 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 _0x0752=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','update','destroy','then','error','name','send','index','map','rawAttributes','type','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMailMessage','includeAll','rows','catch','show','params','find','create','body','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xc78d20,_0x5d0e2e){var _0x4c703d=function(_0x228ad6){while(--_0x228ad6){_0xc78d20['push'](_0xc78d20['shift']());}};_0x4c703d(++_0x5d0e2e);}(_0x0752,0x8b));var _0x2075=function(_0x110114,_0x27ce4b){_0x110114=_0x110114-0x0;var _0x35ddba=_0x0752[_0x110114];return _0x35ddba;};'use strict';var emlformat=require(_0x2075('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2075('0x1'));var jsonpatch=require(_0x2075('0x2'));var rp=require(_0x2075('0x3'));var moment=require(_0x2075('0x4'));var BPromise=require(_0x2075('0x5'));var Mustache=require(_0x2075('0x6'));var util=require(_0x2075('0x7'));var path=require(_0x2075('0x8'));var sox=require(_0x2075('0x9'));var csv=require(_0x2075('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2075('0xb'));var _=require(_0x2075('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2075('0xd'));var toCsv=require(_0x2075('0xa'));var querystring=require('querystring');var Papa=require(_0x2075('0xe'));var Redis=require(_0x2075('0xf'));var authService=require(_0x2075('0x10'));var qs=require(_0x2075('0x11'));var as=require(_0x2075('0x12'));var hardwareService=require(_0x2075('0x13'));var logger=require(_0x2075('0x14'))('api');var utils=require(_0x2075('0x15'));var config=require(_0x2075('0x16'));var licenseUtil=require(_0x2075('0x17'));var db=require(_0x2075('0x18'))['db'];function respondWithStatusCode(_0x258438,_0xc03e4b){_0xc03e4b=_0xc03e4b||0xcc;return function(_0x53b5d9){if(_0x53b5d9){return _0x258438[_0x2075('0x19')](_0xc03e4b);}return _0x258438[_0x2075('0x1a')](_0xc03e4b)[_0x2075('0x1b')]();};}function respondWithResult(_0x3f2cb8,_0x1e31ce){_0x1e31ce=_0x1e31ce||0xc8;return function(_0x919dca){if(_0x919dca){return _0x3f2cb8[_0x2075('0x1a')](_0x1e31ce)['json'](_0x919dca);}};}function respondWithFilteredResult(_0x42faf8,_0x54696d){return function(_0x709766){if(_0x709766){var _0x3883cb=typeof _0x54696d['offset']==='undefined'&&typeof _0x54696d['limit']===_0x2075('0x1c');var _0x4aeeca=_0x709766[_0x2075('0x1d')];var _0x18c579=_0x3883cb?0x0:_0x54696d[_0x2075('0x1e')];var _0x108cea=_0x3883cb?_0x709766[_0x2075('0x1d')]:_0x54696d[_0x2075('0x1e')]+_0x54696d[_0x2075('0x1f')];var _0x54d6ee;if(_0x108cea>=_0x4aeeca){_0x108cea=_0x4aeeca;_0x54d6ee=0xc8;}else{_0x54d6ee=0xce;}_0x42faf8['status'](_0x54d6ee);return _0x42faf8['set']('Content-Range',_0x18c579+'-'+_0x108cea+'/'+_0x4aeeca)['json'](_0x709766);}return null;};}function patchUpdates(_0x21d324){return function(_0x20dfbf){try{jsonpatch['apply'](_0x20dfbf,_0x21d324,!![]);}catch(_0x2a3fa7){return BPromise['reject'](_0x2a3fa7);}return _0x20dfbf['save']();};}function saveUpdates(_0x376fc1,_0x3bd784){return function(_0x552ffa){if(_0x552ffa){return _0x552ffa[_0x2075('0x20')](_0x376fc1)['then'](function(_0x20a45a){return _0x20a45a;});}return null;};}function removeEntity(_0x2dc622,_0x155126){return function(_0x59ef6f){if(_0x59ef6f){return _0x59ef6f[_0x2075('0x21')]()[_0x2075('0x22')](function(){_0x2dc622['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x462dee,_0x44d31a){return function(_0x22c9f8){if(!_0x22c9f8){_0x462dee[_0x2075('0x19')](0x194);}return _0x22c9f8;};}function handleError(_0x4a294a,_0x5965c9){_0x5965c9=_0x5965c9||0x1f4;return function(_0x43a87a){logger[_0x2075('0x23')](_0x43a87a['stack']);if(_0x43a87a[_0x2075('0x24')]){delete _0x43a87a[_0x2075('0x24')];}_0x4a294a[_0x2075('0x1a')](_0x5965c9)[_0x2075('0x25')](_0x43a87a);};}exports[_0x2075('0x26')]=function(_0x218f70,_0x472b66){var _0x3abffa={},_0x236940={},_0x2542b9={'count':0x0,'rows':[]};var _0x5c7316=_[_0x2075('0x27')](db['VoiceMailMessage'][_0x2075('0x28')],function(_0x134bf2){return{'name':_0x134bf2['fieldName'],'type':_0x134bf2[_0x2075('0x29')]['key']};});_0x236940[_0x2075('0x2a')]=_[_0x2075('0x2b')](_[_0x2075('0x27')](_0x5c7316,'name'),['name']);_0x236940[_0x2075('0x2c')]=_[_0x2075('0x2d')](_0x218f70[_0x2075('0x2c')]);_0x236940[_0x2075('0x2e')]=_[_0x2075('0x2f')](_0x236940[_0x2075('0x2a')],_0x236940['query']);_0x3abffa['attributes']=_[_0x2075('0x2f')](_0x236940[_0x2075('0x2a')],qs['fields'](_0x218f70[_0x2075('0x2c')][_0x2075('0x30')]));_0x3abffa[_0x2075('0x31')]=_0x3abffa[_0x2075('0x31')][_0x2075('0x32')]?_0x3abffa[_0x2075('0x31')]:_0x236940['model'];if(!_0x218f70[_0x2075('0x2c')][_0x2075('0x33')](_0x2075('0x34'))){_0x3abffa['limit']=qs['limit'](_0x218f70['query'][_0x2075('0x1f')]);_0x3abffa['offset']=qs[_0x2075('0x1e')](_0x218f70['query'][_0x2075('0x1e')]);}_0x3abffa['order']=qs[_0x2075('0x35')](_0x218f70[_0x2075('0x2c')][_0x2075('0x35')]);_0x3abffa['where']=qs['filters'](_[_0x2075('0x36')](_0x218f70[_0x2075('0x2c')],_0x236940[_0x2075('0x2e')]),_0x5c7316);if(_0x218f70[_0x2075('0x2c')][_0x2075('0x37')]){_0x3abffa['where']=_[_0x2075('0x38')](_0x3abffa[_0x2075('0x39')],{'$or':_[_0x2075('0x27')](_0x5c7316,function(_0x94cf7){if(_0x94cf7[_0x2075('0x29')]!==_0x2075('0x3a')){var _0x5d0ed2={};_0x5d0ed2[_0x94cf7[_0x2075('0x24')]]={'$like':'%'+_0x218f70[_0x2075('0x2c')][_0x2075('0x37')]+'%'};return _0x5d0ed2;}})});}_0x3abffa=_[_0x2075('0x38')]({},_0x3abffa,_0x218f70[_0x2075('0x3b')]);var _0x5d37b0={'where':_0x3abffa[_0x2075('0x39')]};return db[_0x2075('0x3c')][_0x2075('0x1d')](_0x5d37b0)[_0x2075('0x22')](function(_0x11dea0){_0x2542b9[_0x2075('0x1d')]=_0x11dea0;if(_0x218f70[_0x2075('0x2c')][_0x2075('0x3d')]){_0x3abffa['include']=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x3abffa);})[_0x2075('0x22')](function(_0x3dc7c9){_0x2542b9[_0x2075('0x3e')]=_0x3dc7c9;return _0x2542b9;})['then'](respondWithFilteredResult(_0x472b66,_0x3abffa))[_0x2075('0x3f')](handleError(_0x472b66,null));};exports[_0x2075('0x40')]=function(_0x2328cc,_0x22f63d){var _0x344aed={'raw':!![],'where':{'id':_0x2328cc[_0x2075('0x41')]['id']}},_0x1c5eb1={};_0x1c5eb1[_0x2075('0x2a')]=_[_0x2075('0x2d')](db[_0x2075('0x3c')]['rawAttributes']);_0x1c5eb1['query']=_[_0x2075('0x2d')](_0x2328cc['query']);_0x1c5eb1['filters']=_[_0x2075('0x2f')](_0x1c5eb1[_0x2075('0x2a')],_0x1c5eb1[_0x2075('0x2c')]);_0x344aed[_0x2075('0x31')]=_[_0x2075('0x2f')](_0x1c5eb1[_0x2075('0x2a')],qs[_0x2075('0x30')](_0x2328cc[_0x2075('0x2c')][_0x2075('0x30')]));_0x344aed[_0x2075('0x31')]=_0x344aed[_0x2075('0x31')][_0x2075('0x32')]?_0x344aed[_0x2075('0x31')]:_0x1c5eb1[_0x2075('0x2a')];if(_0x2328cc[_0x2075('0x2c')][_0x2075('0x3d')]){_0x344aed['include']=[{'all':!![]}];}_0x344aed=_['merge']({},_0x344aed,_0x2328cc[_0x2075('0x3b')]);return db[_0x2075('0x3c')][_0x2075('0x42')](_0x344aed)[_0x2075('0x22')](handleEntityNotFound(_0x22f63d,null))[_0x2075('0x22')](respondWithResult(_0x22f63d,null))['catch'](handleError(_0x22f63d,null));};exports['create']=function(_0x3762ae,_0x175250){return db[_0x2075('0x3c')][_0x2075('0x43')](_0x3762ae[_0x2075('0x44')],{})[_0x2075('0x22')](respondWithResult(_0x175250,0xc9))[_0x2075('0x3f')](handleError(_0x175250,null));};exports[_0x2075('0x20')]=function(_0xd5e2b6,_0x34ec9e){if(_0xd5e2b6[_0x2075('0x44')]['id']){delete _0xd5e2b6[_0x2075('0x44')]['id'];}return db['VoiceMailMessage'][_0x2075('0x42')]({'where':{'id':_0xd5e2b6[_0x2075('0x41')]['id']}})[_0x2075('0x22')](handleEntityNotFound(_0x34ec9e,null))['then'](saveUpdates(_0xd5e2b6[_0x2075('0x44')],null))[_0x2075('0x22')](respondWithResult(_0x34ec9e,null))[_0x2075('0x3f')](handleError(_0x34ec9e,null));};exports[_0x2075('0x21')]=function(_0x1fec60,_0x54a79b){return db['VoiceMailMessage'][_0x2075('0x42')]({'where':{'id':_0x1fec60[_0x2075('0x41')]['id']}})[_0x2075('0x22')](handleEntityNotFound(_0x54a79b,null))['then'](removeEntity(_0x54a79b,null))['catch'](handleError(_0x54a79b,null));};exports['download']=function(_0x594662,_0x46f080,_0x1e7d13){return db[_0x2075('0x3c')][_0x2075('0x42')]({'where':{'id':_0x594662[_0x2075('0x41')]['id']},'attributes':['id',_0x2075('0x45'),_0x2075('0x46')]})[_0x2075('0x22')](handleEntityNotFound(_0x46f080,null))[_0x2075('0x22')](function(_0x384230){if(_0x384230){if(!_0x384230[_0x2075('0x45')]){throw new db[(_0x2075('0x47'))][(_0x2075('0x48'))](_0x2075('0x49'));}var _0x4ffcdd={'Content-Type':_0x2075('0x4a'),'Content-Disposition':_0x2075('0x4b')};if(_0x384230['msg_id']){_0x4ffcdd[_0x2075('0x4c')]=_0x2075('0x4d')+_0x384230[_0x2075('0x46')]+_0x2075('0x4e');}_0x46f080[_0x2075('0x4f')](_0x4ffcdd);return _0x46f080['send'](new Buffer(_0x384230['recording']));}})[_0x2075('0x3f')](handleError(_0x46f080,null));}; \ No newline at end of file +var _0xfbf9=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','find','create','body','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2ddce7,_0x29613a){var _0x28051a=function(_0x1affbe){while(--_0x1affbe){_0x2ddce7['push'](_0x2ddce7['shift']());}};_0x28051a(++_0x29613a);}(_0xfbf9,0x1df));var _0x9fbf=function(_0x12916b,_0x3ba82d){_0x12916b=_0x12916b-0x0;var _0x58d533=_0xfbf9[_0x12916b];return _0x58d533;};'use strict';var emlformat=require(_0x9fbf('0x0'));var rimraf=require(_0x9fbf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fbf('0x2'));var rp=require(_0x9fbf('0x3'));var moment=require(_0x9fbf('0x4'));var BPromise=require(_0x9fbf('0x5'));var Mustache=require(_0x9fbf('0x6'));var util=require(_0x9fbf('0x7'));var path=require('path');var sox=require(_0x9fbf('0x8'));var csv=require(_0x9fbf('0x9'));var ejs=require(_0x9fbf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fbf('0xb'));var squel=require(_0x9fbf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9fbf('0xd'));var toCsv=require(_0x9fbf('0x9'));var querystring=require(_0x9fbf('0xe'));var Papa=require(_0x9fbf('0xf'));var Redis=require(_0x9fbf('0x10'));var authService=require(_0x9fbf('0x11'));var qs=require(_0x9fbf('0x12'));var as=require(_0x9fbf('0x13'));var hardwareService=require(_0x9fbf('0x14'));var logger=require(_0x9fbf('0x15'))('api');var utils=require(_0x9fbf('0x16'));var config=require(_0x9fbf('0x17'));var licenseUtil=require(_0x9fbf('0x18'));var db=require(_0x9fbf('0x19'))['db'];function respondWithStatusCode(_0x7dfdfe,_0x40d72e){_0x40d72e=_0x40d72e||0xcc;return function(_0x21a929){if(_0x21a929){return _0x7dfdfe[_0x9fbf('0x1a')](_0x40d72e);}return _0x7dfdfe[_0x9fbf('0x1b')](_0x40d72e)[_0x9fbf('0x1c')]();};}function respondWithResult(_0x4fa313,_0x45c15d){_0x45c15d=_0x45c15d||0xc8;return function(_0x2a266a){if(_0x2a266a){return _0x4fa313['status'](_0x45c15d)[_0x9fbf('0x1d')](_0x2a266a);}};}function respondWithFilteredResult(_0x3b88b7,_0x4d9564){return function(_0x104b2f){if(_0x104b2f){var _0xab631c=typeof _0x4d9564[_0x9fbf('0x1e')]===_0x9fbf('0x1f')&&typeof _0x4d9564['limit']==='undefined';var _0x21a683=_0x104b2f[_0x9fbf('0x20')];var _0x42a38f=_0xab631c?0x0:_0x4d9564[_0x9fbf('0x1e')];var _0x231c2e=_0xab631c?_0x104b2f[_0x9fbf('0x20')]:_0x4d9564[_0x9fbf('0x1e')]+_0x4d9564[_0x9fbf('0x21')];var _0x1a7405;if(_0x231c2e>=_0x21a683){_0x231c2e=_0x21a683;_0x1a7405=0xc8;}else{_0x1a7405=0xce;}_0x3b88b7[_0x9fbf('0x1b')](_0x1a7405);return _0x3b88b7[_0x9fbf('0x22')](_0x9fbf('0x23'),_0x42a38f+'-'+_0x231c2e+'/'+_0x21a683)[_0x9fbf('0x1d')](_0x104b2f);}return null;};}function patchUpdates(_0x3e0910){return function(_0x4a7968){try{jsonpatch[_0x9fbf('0x24')](_0x4a7968,_0x3e0910,!![]);}catch(_0x14546c){return BPromise[_0x9fbf('0x25')](_0x14546c);}return _0x4a7968[_0x9fbf('0x26')]();};}function saveUpdates(_0x2d075b,_0x202b9f){return function(_0x571c0b){if(_0x571c0b){return _0x571c0b[_0x9fbf('0x27')](_0x2d075b)[_0x9fbf('0x28')](function(_0x24fada){return _0x24fada;});}return null;};}function removeEntity(_0xeb97c2,_0x3e1ce0){return function(_0x430604){if(_0x430604){return _0x430604[_0x9fbf('0x29')]()[_0x9fbf('0x28')](function(){_0xeb97c2[_0x9fbf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497731,_0x2cf532){return function(_0x195ccf){if(!_0x195ccf){_0x497731[_0x9fbf('0x1a')](0x194);}return _0x195ccf;};}function handleError(_0x50ec6a,_0x59dec8){_0x59dec8=_0x59dec8||0x1f4;return function(_0x58e27b){logger[_0x9fbf('0x2a')](_0x58e27b[_0x9fbf('0x2b')]);if(_0x58e27b[_0x9fbf('0x2c')]){delete _0x58e27b[_0x9fbf('0x2c')];}_0x50ec6a[_0x9fbf('0x1b')](_0x59dec8)[_0x9fbf('0x2d')](_0x58e27b);};}exports[_0x9fbf('0x2e')]=function(_0x4d6056,_0x481157){var _0x114621={},_0x3d1de3={},_0x534986={'count':0x0,'rows':[]};var _0x42a636=_[_0x9fbf('0x2f')](db[_0x9fbf('0x30')][_0x9fbf('0x31')],function(_0x42cfda){return{'name':_0x42cfda['fieldName'],'type':_0x42cfda[_0x9fbf('0x32')][_0x9fbf('0x33')]};});_0x3d1de3[_0x9fbf('0x34')]=_[_0x9fbf('0x35')](_[_0x9fbf('0x2f')](_0x42a636,_0x9fbf('0x2c')),[_0x9fbf('0x2c')]);_0x3d1de3[_0x9fbf('0x36')]=_[_0x9fbf('0x37')](_0x4d6056[_0x9fbf('0x36')]);_0x3d1de3[_0x9fbf('0x38')]=_[_0x9fbf('0x39')](_0x3d1de3[_0x9fbf('0x34')],_0x3d1de3[_0x9fbf('0x36')]);_0x114621['attributes']=_[_0x9fbf('0x39')](_0x3d1de3[_0x9fbf('0x34')],qs[_0x9fbf('0x3a')](_0x4d6056[_0x9fbf('0x36')][_0x9fbf('0x3a')]));_0x114621[_0x9fbf('0x3b')]=_0x114621[_0x9fbf('0x3b')][_0x9fbf('0x3c')]?_0x114621[_0x9fbf('0x3b')]:_0x3d1de3[_0x9fbf('0x34')];if(!_0x4d6056[_0x9fbf('0x36')][_0x9fbf('0x3d')]('nolimit')){_0x114621[_0x9fbf('0x21')]=qs[_0x9fbf('0x21')](_0x4d6056[_0x9fbf('0x36')][_0x9fbf('0x21')]);_0x114621['offset']=qs[_0x9fbf('0x1e')](_0x4d6056[_0x9fbf('0x36')]['offset']);}_0x114621[_0x9fbf('0x3e')]=qs['sort'](_0x4d6056[_0x9fbf('0x36')][_0x9fbf('0x3f')]);_0x114621[_0x9fbf('0x40')]=qs['filters'](_[_0x9fbf('0x41')](_0x4d6056[_0x9fbf('0x36')],_0x3d1de3['filters']),_0x42a636);if(_0x4d6056[_0x9fbf('0x36')][_0x9fbf('0x42')]){_0x114621[_0x9fbf('0x40')]=_[_0x9fbf('0x43')](_0x114621[_0x9fbf('0x40')],{'$or':_[_0x9fbf('0x2f')](_0x42a636,function(_0x3d44c7){if(_0x3d44c7[_0x9fbf('0x32')]!=='VIRTUAL'){var _0x571891={};_0x571891[_0x3d44c7[_0x9fbf('0x2c')]]={'$like':'%'+_0x4d6056[_0x9fbf('0x36')][_0x9fbf('0x42')]+'%'};return _0x571891;}})});}_0x114621=_['merge']({},_0x114621,_0x4d6056[_0x9fbf('0x44')]);var _0x4f32d6={'where':_0x114621['where']};return db[_0x9fbf('0x30')][_0x9fbf('0x20')](_0x4f32d6)[_0x9fbf('0x28')](function(_0x14d13e){_0x534986[_0x9fbf('0x20')]=_0x14d13e;if(_0x4d6056[_0x9fbf('0x36')]['includeAll']){_0x114621[_0x9fbf('0x45')]=[{'all':!![]}];}return db[_0x9fbf('0x30')][_0x9fbf('0x46')](_0x114621);})['then'](function(_0x4a3041){_0x534986['rows']=_0x4a3041;return _0x534986;})[_0x9fbf('0x28')](respondWithFilteredResult(_0x481157,_0x114621))[_0x9fbf('0x47')](handleError(_0x481157,null));};exports[_0x9fbf('0x48')]=function(_0x45fd5c,_0x51d1cd){var _0x37f10a={'raw':!![],'where':{'id':_0x45fd5c[_0x9fbf('0x49')]['id']}},_0x4f1fd4={};_0x4f1fd4[_0x9fbf('0x34')]=_[_0x9fbf('0x37')](db[_0x9fbf('0x30')][_0x9fbf('0x31')]);_0x4f1fd4['query']=_[_0x9fbf('0x37')](_0x45fd5c['query']);_0x4f1fd4[_0x9fbf('0x38')]=_[_0x9fbf('0x39')](_0x4f1fd4[_0x9fbf('0x34')],_0x4f1fd4[_0x9fbf('0x36')]);_0x37f10a[_0x9fbf('0x3b')]=_[_0x9fbf('0x39')](_0x4f1fd4[_0x9fbf('0x34')],qs[_0x9fbf('0x3a')](_0x45fd5c[_0x9fbf('0x36')][_0x9fbf('0x3a')]));_0x37f10a[_0x9fbf('0x3b')]=_0x37f10a['attributes'][_0x9fbf('0x3c')]?_0x37f10a['attributes']:_0x4f1fd4[_0x9fbf('0x34')];if(_0x45fd5c[_0x9fbf('0x36')]['includeAll']){_0x37f10a[_0x9fbf('0x45')]=[{'all':!![]}];}_0x37f10a=_[_0x9fbf('0x43')]({},_0x37f10a,_0x45fd5c[_0x9fbf('0x44')]);return db['VoiceMailMessage'][_0x9fbf('0x4a')](_0x37f10a)[_0x9fbf('0x28')](handleEntityNotFound(_0x51d1cd,null))['then'](respondWithResult(_0x51d1cd,null))['catch'](handleError(_0x51d1cd,null));};exports[_0x9fbf('0x4b')]=function(_0x35c908,_0x394238){return db[_0x9fbf('0x30')]['create'](_0x35c908[_0x9fbf('0x4c')],{})[_0x9fbf('0x28')](respondWithResult(_0x394238,0xc9))[_0x9fbf('0x47')](handleError(_0x394238,null));};exports[_0x9fbf('0x27')]=function(_0x3cb24c,_0x4c6a75){if(_0x3cb24c[_0x9fbf('0x4c')]['id']){delete _0x3cb24c[_0x9fbf('0x4c')]['id'];}return db[_0x9fbf('0x30')][_0x9fbf('0x4a')]({'where':{'id':_0x3cb24c[_0x9fbf('0x49')]['id']}})[_0x9fbf('0x28')](handleEntityNotFound(_0x4c6a75,null))[_0x9fbf('0x28')](saveUpdates(_0x3cb24c[_0x9fbf('0x4c')],null))['then'](respondWithResult(_0x4c6a75,null))[_0x9fbf('0x47')](handleError(_0x4c6a75,null));};exports[_0x9fbf('0x29')]=function(_0x5a9c1b,_0x2441d5){return db[_0x9fbf('0x30')][_0x9fbf('0x4a')]({'where':{'id':_0x5a9c1b[_0x9fbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x2441d5,null))[_0x9fbf('0x28')](removeEntity(_0x2441d5,null))[_0x9fbf('0x47')](handleError(_0x2441d5,null));};exports['download']=function(_0x444847,_0x3f63a0,_0x1b6ad3){return db[_0x9fbf('0x30')][_0x9fbf('0x4a')]({'where':{'id':_0x444847[_0x9fbf('0x49')]['id']},'attributes':['id',_0x9fbf('0x4d'),_0x9fbf('0x4e')]})[_0x9fbf('0x28')](handleEntityNotFound(_0x3f63a0,null))[_0x9fbf('0x28')](function(_0x42d569){if(_0x42d569){if(!_0x42d569['recording']){throw new db['Sequelize'][(_0x9fbf('0x4f'))](_0x9fbf('0x50'));}var _0x2d96e0={'Content-Type':_0x9fbf('0x51'),'Content-Disposition':_0x9fbf('0x52')};if(_0x42d569[_0x9fbf('0x4e')]){_0x2d96e0[_0x9fbf('0x53')]='attachment;\x20filename=\x22'+_0x42d569[_0x9fbf('0x4e')]+_0x9fbf('0x54');}_0x3f63a0[_0x9fbf('0x22')](_0x2d96e0);return _0x3f63a0[_0x9fbf('0x2d')](new Buffer(_0x42d569[_0x9fbf('0x4d')]));}})[_0x9fbf('0x47')](handleError(_0x3f63a0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index fafc5d5..9fa3b67 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 _0x9ca2=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','moment'];(function(_0x1b885d,_0xb38593){var _0x1e7eaa=function(_0x124db1){while(--_0x124db1){_0x1b885d['push'](_0x1b885d['shift']());}};_0x1e7eaa(++_0xb38593);}(_0x9ca2,0x130));var _0x29ca=function(_0x2e493a,_0xe4a84e){_0x2e493a=_0x2e493a-0x0;var _0x1152d9=_0x9ca2[_0x2e493a];return _0x1152d9;};'use strict';var _=require(_0x29ca('0x0'));var util=require(_0x29ca('0x1'));var logger=require(_0x29ca('0x2'))('api');var moment=require(_0x29ca('0x3'));var BPromise=require(_0x29ca('0x4'));var rp=require(_0x29ca('0x5'));var fs=require('fs');var path=require(_0x29ca('0x6'));var rimraf=require(_0x29ca('0x7'));var config=require(_0x29ca('0x8'));var attributes=require(_0x29ca('0x9'));module[_0x29ca('0xa')]=function(_0x403f5f,_0x2da442){return _0x403f5f[_0x29ca('0xb')](_0x29ca('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x29ca('0xd'),'fields':[_0x29ca('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xfa64=['api','bluebird','path','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger'];(function(_0x2c8a8c,_0x359bda){var _0x33a6a4=function(_0x4f229f){while(--_0x4f229f){_0x2c8a8c['push'](_0x2c8a8c['shift']());}};_0x33a6a4(++_0x359bda);}(_0xfa64,0x194));var _0x4fa6=function(_0x241963,_0x975420){_0x241963=_0x241963-0x0;var _0x442942=_0xfa64[_0x241963];return _0x442942;};'use strict';var _=require(_0x4fa6('0x0'));var util=require(_0x4fa6('0x1'));var logger=require(_0x4fa6('0x2'))(_0x4fa6('0x3'));var moment=require('moment');var BPromise=require(_0x4fa6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fa6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4fa6('0x6'));module[_0x4fa6('0x7')]=function(_0x271000,_0x4a8e27){return _0x271000[_0x4fa6('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x4fa6('0x9'),'paranoid':![],'indexes':[{'name':_0x4fa6('0xa'),'fields':[_0x4fa6('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 41753a2..5145add 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 _0x596b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x596b,0xb5));var _0xb596=function(_0x67a5ef,_0x1b90e2){_0x67a5ef=_0x67a5ef-0x0;var _0x18afed=_0x596b[_0x67a5ef];return _0x18afed;};'use strict';var _=require(_0xb596('0x0'));var util=require(_0xb596('0x1'));var moment=require(_0xb596('0x2'));var BPromise=require(_0xb596('0x3'));var rs=require(_0xb596('0x4'));var fs=require('fs');var Redis=require(_0xb596('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb596('0x6'));var logger=require(_0xb596('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb596('0x8')][_0xb596('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f23b6,_0x4bb87e,_0x271ce2){return new BPromise(function(_0x5f0fa1,_0x9de6d4){return client['request'](_0x4f23b6,_0x271ce2)[_0xb596('0xa')](function(_0x26c2a2){logger['info'](_0xb596('0xb'),_0x4bb87e,_0xb596('0xc'));logger[_0xb596('0xd')](_0xb596('0xe'),_0x4bb87e,_0xb596('0xc'),JSON[_0xb596('0xf')](_0x26c2a2));if(_0x26c2a2[_0xb596('0x10')]){if(_0x26c2a2['error'][_0xb596('0x11')]===0x1f4){logger[_0xb596('0x10')](_0xb596('0xb'),_0x4bb87e,_0x26c2a2['error'][_0xb596('0x12')]);return _0x9de6d4(_0x26c2a2['error']['message']);}logger[_0xb596('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bb87e,_0x26c2a2[_0xb596('0x10')]['message']);return _0x5f0fa1(_0x26c2a2['error'][_0xb596('0x12')]);}else{logger['info'](_0xb596('0xb'),_0x4bb87e,_0xb596('0xc'));_0x5f0fa1(_0x26c2a2['result'][_0xb596('0x12')]);}})[_0xb596('0x13')](function(_0x37f260){logger['error'](_0xb596('0xb'),_0x4bb87e,_0x37f260);_0x9de6d4(_0x37f260);});});} \ No newline at end of file +var _0x30e8=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3d96d5,_0x3755b0){var _0x5726e9=function(_0xdb6065){while(--_0xdb6065){_0x3d96d5['push'](_0x3d96d5['shift']());}};_0x5726e9(++_0x3755b0);}(_0x30e8,0x11a));var _0x830e=function(_0x128cb6,_0x14be6b){_0x128cb6=_0x128cb6-0x0;var _0x405bf8=_0x30e8[_0x128cb6];return _0x405bf8;};'use strict';var _=require(_0x830e('0x0'));var util=require('util');var moment=require(_0x830e('0x1'));var BPromise=require(_0x830e('0x2'));var rs=require(_0x830e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x830e('0x4'))['db'];var utils=require(_0x830e('0x5'));var logger=require(_0x830e('0x6'))(_0x830e('0x7'));var config=require('../../config/environment');var jayson=require(_0x830e('0x8'));var client=jayson[_0x830e('0x9')][_0x830e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xae886e,_0x46e6a4,_0x52f835){return new BPromise(function(_0x58a8a8,_0x281fbc){return client[_0x830e('0xb')](_0xae886e,_0x52f835)[_0x830e('0xc')](function(_0x4cf4bf){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x46e6a4,_0x830e('0xd'));logger['debug'](_0x830e('0xe'),_0x46e6a4,_0x830e('0xd'),JSON[_0x830e('0xf')](_0x4cf4bf));if(_0x4cf4bf[_0x830e('0x10')]){if(_0x4cf4bf[_0x830e('0x10')]['code']===0x1f4){logger[_0x830e('0x10')](_0x830e('0x11'),_0x46e6a4,_0x4cf4bf[_0x830e('0x10')][_0x830e('0x12')]);return _0x281fbc(_0x4cf4bf['error'][_0x830e('0x12')]);}logger[_0x830e('0x10')](_0x830e('0x11'),_0x46e6a4,_0x4cf4bf[_0x830e('0x10')][_0x830e('0x12')]);return _0x58a8a8(_0x4cf4bf[_0x830e('0x10')]['message']);}else{logger[_0x830e('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x46e6a4,_0x830e('0xd'));_0x58a8a8(_0x4cf4bf[_0x830e('0x14')][_0x830e('0x12')]);}})[_0x830e('0x15')](function(_0x33a49a){logger[_0x830e('0x10')](_0x830e('0x11'),_0x46e6a4,_0x33a49a);_0x281fbc(_0x33a49a);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b17805f..0e314be 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 _0x8078=['addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','post','create'];(function(_0x3d58ca,_0x3acbd8){var _0x1644a4=function(_0x46d3bd){while(--_0x46d3bd){_0x3d58ca['push'](_0x3d58ca['shift']());}};_0x1644a4(++_0x3acbd8);}(_0x8078,0x99));var _0x8807=function(_0x1e324c,_0x1dac6f){_0x1e324c=_0x1e324c-0x0;var _0x4afcad=_0x8078[_0x1e324c];return _0x4afcad;};'use strict';var multer=require(_0x8807('0x0'));var util=require(_0x8807('0x1'));var path=require(_0x8807('0x2'));var timeout=require('connect-timeout');var express=require(_0x8807('0x3'));var router=express[_0x8807('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8807('0x5'));var interaction=require(_0x8807('0x6'));var config=require(_0x8807('0x7'));var controller=require(_0x8807('0x8'));router[_0x8807('0x9')]('/',auth[_0x8807('0xa')](),controller[_0x8807('0xb')]);router['get']('/:id',auth[_0x8807('0xa')](),controller[_0x8807('0xc')]);router[_0x8807('0x9')]('/:id/sounds',auth[_0x8807('0xa')](),controller['getSounds']);router[_0x8807('0xd')]('/',auth[_0x8807('0xa')](),controller[_0x8807('0xe')]);router['post']('/:id/sounds',auth['isAuthenticated'](),controller[_0x8807('0xf')]);router[_0x8807('0x10')](_0x8807('0x11'),auth[_0x8807('0xa')](),controller[_0x8807('0x12')]);router[_0x8807('0x13')](_0x8807('0x11'),auth['isAuthenticated'](),controller[_0x8807('0x14')]);router[_0x8807('0x13')](_0x8807('0x15'),auth[_0x8807('0xa')](),controller[_0x8807('0x16')]);module[_0x8807('0x17')]=router; \ No newline at end of file +var _0xe8bd=['removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','show','post','addSound','put','update','destroy','delete','/:id/sounds/:id2'];(function(_0xec4ac3,_0x2f1c42){var _0x52454a=function(_0x5c57e3){while(--_0x5c57e3){_0xec4ac3['push'](_0xec4ac3['shift']());}};_0x52454a(++_0x2f1c42);}(_0xe8bd,0xaa));var _0xde8b=function(_0x289e06,_0xd871b){_0x289e06=_0x289e06-0x0;var _0x4f1e1e=_0xe8bd[_0x289e06];return _0x4f1e1e;};'use strict';var multer=require(_0xde8b('0x0'));var util=require(_0xde8b('0x1'));var path=require(_0xde8b('0x2'));var timeout=require(_0xde8b('0x3'));var express=require(_0xde8b('0x4'));var router=express[_0xde8b('0x5')]();var fs_extra=require(_0xde8b('0x6'));var auth=require(_0xde8b('0x7'));var interaction=require(_0xde8b('0x8'));var config=require(_0xde8b('0x9'));var controller=require(_0xde8b('0xa'));router['get']('/',auth[_0xde8b('0xb')](),controller['index']);router[_0xde8b('0xc')](_0xde8b('0xd'),auth['isAuthenticated'](),controller[_0xde8b('0xe')]);router['get']('/:id/sounds',auth[_0xde8b('0xb')](),controller['getSounds']);router[_0xde8b('0xf')]('/',auth[_0xde8b('0xb')](),controller['create']);router[_0xde8b('0xf')]('/:id/sounds',auth[_0xde8b('0xb')](),controller[_0xde8b('0x10')]);router[_0xde8b('0x11')](_0xde8b('0xd'),auth[_0xde8b('0xb')](),controller[_0xde8b('0x12')]);router['delete'](_0xde8b('0xd'),auth[_0xde8b('0xb')](),controller[_0xde8b('0x13')]);router[_0xde8b('0x14')](_0xde8b('0x15'),auth[_0xde8b('0xb')](),controller[_0xde8b('0x16')]);module[_0xde8b('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 78c062a..2bf95b1 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 _0xf218=['STRING','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x2daad1,_0x2681a2){var _0x3b5125=function(_0xf1307){while(--_0xf1307){_0x2daad1['push'](_0x2daad1['shift']());}};_0x3b5125(++_0x2681a2);}(_0xf218,0xe2));var _0x8f21=function(_0x3965a3,_0x4fcebb){_0x3965a3=_0x3965a3-0x0;var _0x55f51d=_0xf218[_0x3965a3];return _0x55f51d;};'use strict';var Sequelize=require(_0x8f21('0x0'));module[_0x8f21('0x1')]={'name':{'type':Sequelize[_0x8f21('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x8f21('0x3'),'files',_0x8f21('0x4'),_0x8f21('0x5'),_0x8f21('0x6'),_0x8f21('0x7')),'allowNull':!![],'defaultValue':_0x8f21('0x8')},'directory':{'type':Sequelize[_0x8f21('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x8f21('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x8f21('0x2')],'allowNull':!![],'defaultValue':_0x8f21('0x9')},'format':{'type':Sequelize[_0x8f21('0x2')],'allowNull':!![]},'stamp':{'type':_0x8f21('0xa')},'defaultEntry':{'type':Sequelize[_0x8f21('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x180a=['exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x180a,0x1c7));var _0xa180=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x180a[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xa180('0x0'));module[_0xa180('0x1')]={'name':{'type':Sequelize[_0xa180('0x2')],'allowNull':![],'unique':_0xa180('0x3')},'mode':{'type':Sequelize[_0xa180('0x4')](_0xa180('0x5'),_0xa180('0x6'),_0xa180('0x7'),'quietmp3nb',_0xa180('0x8'),_0xa180('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xa180('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa180('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xa180('0x2')],'allowNull':!![],'defaultValue':_0xa180('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xa180('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 5e625a3..9799e24 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 _0x46e5=['params','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','transaction','Sound','findOne','save_name','converted_format','createdAt','basename','extname','format','%s.%s','removeSound','id2','getSounds','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','update','body','sequelize','files','directory','join','root','server/files/moh','create','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x46e5,0x8a));var _0x546e=function(_0x5980db,_0x1ce203){_0x5980db=_0x5980db-0x0;var _0x27040f=_0x46e5[_0x5980db];return _0x27040f;};'use strict';var emlformat=require(_0x546e('0x0'));var rimraf=require(_0x546e('0x1'));var zipdir=require(_0x546e('0x2'));var jsonpatch=require(_0x546e('0x3'));var rp=require(_0x546e('0x4'));var moment=require('moment');var BPromise=require(_0x546e('0x5'));var Mustache=require(_0x546e('0x6'));var util=require(_0x546e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x546e('0x8'));var ejs=require(_0x546e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x546e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x546e('0xb'));var deskjs=require(_0x546e('0xc'));var toCsv=require(_0x546e('0x8'));var querystring=require(_0x546e('0xd'));var Papa=require(_0x546e('0xe'));var Redis=require(_0x546e('0xf'));var authService=require(_0x546e('0x10'));var qs=require(_0x546e('0x11'));var as=require(_0x546e('0x12'));var hardwareService=require(_0x546e('0x13'));var logger=require(_0x546e('0x14'))(_0x546e('0x15'));var utils=require('../../config/utils');var config=require(_0x546e('0x16'));var licenseUtil=require(_0x546e('0x17'));var db=require(_0x546e('0x18'))['db'];function respondWithStatusCode(_0xa8e1b9,_0x13c3f8){_0x13c3f8=_0x13c3f8||0xcc;return function(_0x2f477b){if(_0x2f477b){return _0xa8e1b9['sendStatus'](_0x13c3f8);}return _0xa8e1b9[_0x546e('0x19')](_0x13c3f8)[_0x546e('0x1a')]();};}function respondWithResult(_0x10da8a,_0x27c592){_0x27c592=_0x27c592||0xc8;return function(_0x1256c4){if(_0x1256c4){return _0x10da8a['status'](_0x27c592)[_0x546e('0x1b')](_0x1256c4);}};}function respondWithFilteredResult(_0x8a7e46,_0x52375a){return function(_0xc4fe48){if(_0xc4fe48){var _0x3ee5f8=typeof _0x52375a[_0x546e('0x1c')]===_0x546e('0x1d')&&typeof _0x52375a[_0x546e('0x1e')]===_0x546e('0x1d');var _0x2aea17=_0xc4fe48[_0x546e('0x1f')];var _0x4feb41=_0x3ee5f8?0x0:_0x52375a[_0x546e('0x1c')];var _0x51751e=_0x3ee5f8?_0xc4fe48['count']:_0x52375a[_0x546e('0x1c')]+_0x52375a[_0x546e('0x1e')];var _0x5abdec;if(_0x51751e>=_0x2aea17){_0x51751e=_0x2aea17;_0x5abdec=0xc8;}else{_0x5abdec=0xce;}_0x8a7e46['status'](_0x5abdec);return _0x8a7e46[_0x546e('0x20')](_0x546e('0x21'),_0x4feb41+'-'+_0x51751e+'/'+_0x2aea17)['json'](_0xc4fe48);}return null;};}function patchUpdates(_0x4f99f7){return function(_0x57aa0c){try{jsonpatch[_0x546e('0x22')](_0x57aa0c,_0x4f99f7,!![]);}catch(_0x24867b){return BPromise[_0x546e('0x23')](_0x24867b);}return _0x57aa0c['save']();};}function saveUpdates(_0x2cbbd6,_0x51d4a2){return function(_0x508f10){if(_0x508f10){return _0x508f10['update'](_0x2cbbd6)[_0x546e('0x24')](function(_0x1f5dc0){return _0x1f5dc0;});}return null;};}function removeEntity(_0x1ee1ea,_0x57134b){return function(_0x44cb08){if(_0x44cb08){return _0x44cb08[_0x546e('0x25')]()[_0x546e('0x24')](function(){var _0x2405b4=_0x44cb08[_0x546e('0x26')]({'plain':!![]});var _0x189bfe=_0x546e('0x27');return db[_0x546e('0x28')]['destroy']({'where':{'type':_0x189bfe,'resourceId':_0x2405b4['id']}})[_0x546e('0x24')](function(){return _0x44cb08;});})[_0x546e('0x24')](function(){_0x1ee1ea[_0x546e('0x19')](0xcc)[_0x546e('0x1a')]();});}};}function handleEntityNotFound(_0xe84e03,_0x44ec32){return function(_0xca2a5e){if(!_0xca2a5e){_0xe84e03[_0x546e('0x29')](0x194);}return _0xca2a5e;};}function handleError(_0x2cf87b,_0x46fe8b){_0x46fe8b=_0x46fe8b||0x1f4;return function(_0x2abda6){logger[_0x546e('0x2a')](_0x2abda6[_0x546e('0x2b')]);if(_0x2abda6['name']){delete _0x2abda6[_0x546e('0x2c')];}_0x2cf87b[_0x546e('0x19')](_0x46fe8b)[_0x546e('0x2d')](_0x2abda6);};}exports[_0x546e('0x2e')]=function(_0x301f86,_0x1f8541){var _0x340d4c={},_0x5d3d3b={},_0x30bbb0={'count':0x0,'rows':[]};var _0x497196=_['map'](db[_0x546e('0x2f')][_0x546e('0x30')],function(_0x3f1acd){return{'name':_0x3f1acd[_0x546e('0x31')],'type':_0x3f1acd[_0x546e('0x32')][_0x546e('0x33')]};});_0x5d3d3b[_0x546e('0x34')]=_[_0x546e('0x35')](_0x497196,_0x546e('0x2c'));_0x5d3d3b[_0x546e('0x36')]=_[_0x546e('0x37')](_0x301f86[_0x546e('0x36')]);_0x5d3d3b[_0x546e('0x38')]=_[_0x546e('0x39')](_0x5d3d3b[_0x546e('0x34')],_0x5d3d3b[_0x546e('0x36')]);_0x340d4c['attributes']=_['intersection'](_0x5d3d3b[_0x546e('0x34')],qs[_0x546e('0x3a')](_0x301f86[_0x546e('0x36')][_0x546e('0x3a')]));_0x340d4c['attributes']=_0x340d4c[_0x546e('0x3b')][_0x546e('0x3c')]?_0x340d4c[_0x546e('0x3b')]:_0x5d3d3b['model'];if(!_0x301f86[_0x546e('0x36')][_0x546e('0x3d')](_0x546e('0x3e'))){_0x340d4c[_0x546e('0x1e')]=qs['limit'](_0x301f86[_0x546e('0x36')]['limit']);_0x340d4c[_0x546e('0x1c')]=qs[_0x546e('0x1c')](_0x301f86[_0x546e('0x36')][_0x546e('0x1c')]);}_0x340d4c[_0x546e('0x3f')]=qs[_0x546e('0x40')](_0x301f86[_0x546e('0x36')]['sort']);delete _0x301f86['query'][_0x546e('0x40')];_0x340d4c['where']=qs[_0x546e('0x38')](_['pick'](_0x301f86['query'],_0x5d3d3b[_0x546e('0x38')]),_0x497196);if(_0x301f86[_0x546e('0x36')][_0x546e('0x41')]){_0x340d4c[_0x546e('0x42')]=_[_0x546e('0x43')](_0x340d4c[_0x546e('0x42')],{'$or':_[_0x546e('0x35')](_0x497196,function(_0x44ece2){if(_0x44ece2[_0x546e('0x32')]!==_0x546e('0x44')){var _0x5cb0f3={};_0x5cb0f3[_0x44ece2[_0x546e('0x2c')]]={'$like':'%'+_0x301f86['query'][_0x546e('0x41')]+'%'};return _0x5cb0f3;}})});}_0x340d4c=_[_0x546e('0x43')]({},_0x340d4c,_0x301f86[_0x546e('0x45')]);var _0x517b6e={'where':_0x340d4c[_0x546e('0x42')]};return db[_0x546e('0x2f')][_0x546e('0x1f')](_0x517b6e)['then'](function(_0x54e9f3){_0x30bbb0[_0x546e('0x1f')]=_0x54e9f3;if(_0x301f86[_0x546e('0x36')][_0x546e('0x46')]){_0x340d4c[_0x546e('0x47')]=[{'all':!![]}];}return db[_0x546e('0x2f')][_0x546e('0x48')](_0x340d4c);})[_0x546e('0x24')](function(_0x15cd3a){_0x30bbb0[_0x546e('0x49')]=_0x15cd3a;return _0x30bbb0;})['then'](respondWithFilteredResult(_0x1f8541,_0x340d4c))[_0x546e('0x4a')](handleError(_0x1f8541,null));};exports['show']=function(_0x15d560,_0x465919){var _0x121afe={'raw':![],'where':{'id':_0x15d560['params']['id']}},_0x3d1f89={};_0x3d1f89[_0x546e('0x34')]=_[_0x546e('0x37')](db[_0x546e('0x2f')][_0x546e('0x30')]);_0x3d1f89[_0x546e('0x36')]=_['keys'](_0x15d560[_0x546e('0x36')]);_0x3d1f89[_0x546e('0x38')]=_[_0x546e('0x39')](_0x3d1f89['model'],_0x3d1f89[_0x546e('0x36')]);_0x121afe[_0x546e('0x3b')]=_[_0x546e('0x39')](_0x3d1f89[_0x546e('0x34')],qs[_0x546e('0x3a')](_0x15d560[_0x546e('0x36')]['fields']));_0x121afe[_0x546e('0x3b')]=_0x121afe['attributes'][_0x546e('0x3c')]?_0x121afe[_0x546e('0x3b')]:_0x3d1f89[_0x546e('0x34')];if(_0x15d560['query']['includeAll']){_0x121afe[_0x546e('0x47')]=[{'all':!![]}];}_0x121afe=_['merge']({},_0x121afe,_0x15d560['options']);return db['VoiceMusicOnHold'][_0x546e('0x4b')](_0x121afe)[_0x546e('0x24')](handleEntityNotFound(_0x465919,null))[_0x546e('0x24')](respondWithResult(_0x465919,null))[_0x546e('0x4a')](handleError(_0x465919,null));};exports[_0x546e('0x4c')]=function(_0x48f481,_0x217e01){if(_0x48f481[_0x546e('0x4d')]['id']){delete _0x48f481[_0x546e('0x4d')]['id'];}return db[_0x546e('0x2f')][_0x546e('0x4b')]({'where':{'id':_0x48f481['params']['id']}})[_0x546e('0x24')](handleEntityNotFound(_0x217e01,null))[_0x546e('0x24')](saveUpdates(_0x48f481[_0x546e('0x4d')],null))[_0x546e('0x24')](respondWithResult(_0x217e01,null))['catch'](handleError(_0x217e01,null));};exports['create']=function(_0x187c20,_0x3c4c47,_0x540cbe){return db[_0x546e('0x4e')]['transaction'](function(_0x480ee3){if(_0x187c20['body']['mode']===_0x546e('0x4f')){_0x187c20[_0x546e('0x4d')][_0x546e('0x50')]=path[_0x546e('0x51')](config[_0x546e('0x52')],_0x546e('0x53'),_0x187c20[_0x546e('0x4d')][_0x546e('0x2c')]);}return db[_0x546e('0x2f')][_0x546e('0x54')](_0x187c20[_0x546e('0x4d')],{'transaction':_0x480ee3})['then'](function(_0x54da32){if(_0x187c20[_0x546e('0x4d')][_0x546e('0x55')]===_0x546e('0x4f')){fs[_0x546e('0x56')](_0x54da32[_0x546e('0x50')],parseInt(_0x546e('0x57'),0x8));}var _0x1cf399=_0x187c20[_0x546e('0x58')][_0x546e('0x26')]({'plain':!![]});if(!_0x1cf399)throw new Error(_0x546e('0x59'));if(_0x1cf399[_0x546e('0x5a')]===_0x546e('0x58')){var _0x89e1c7=_0x54da32[_0x546e('0x26')]({'plain':!![]});return db[_0x546e('0x5b')]['find']({'where':{'name':_0x546e('0x27'),'userProfileId':_0x1cf399[_0x546e('0x5c')]},'raw':!![]})[_0x546e('0x24')](function(_0x201243){if(_0x201243&&_0x201243[_0x546e('0x5d')]===0x0){return db[_0x546e('0x28')][_0x546e('0x54')]({'name':_0x89e1c7[_0x546e('0x2c')],'resourceId':_0x89e1c7['id'],'type':_0x201243[_0x546e('0x2c')],'sectionId':_0x201243['id']},{})[_0x546e('0x24')](function(){return _0x54da32;});}else{return _0x54da32;}})[_0x546e('0x4a')](function(_0x17cf4d){logger[_0x546e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17cf4d);});}return _0x54da32;});})[_0x546e('0x24')](respondWithResult(_0x3c4c47,0xc9))[_0x546e('0x4a')](handleError(_0x3c4c47,null));};exports[_0x546e('0x25')]=function(_0x492ab7,_0x1b73a1,_0x450159){var _0x4cf1bc;return db[_0x546e('0x2f')][_0x546e('0x4b')]({'where':{'id':_0x492ab7[_0x546e('0x5e')]['id']}})[_0x546e('0x24')](function(_0x1257e1){if(_0x1257e1){return db['sequelize']['transaction'](function(_0x44ca9d){return _0x1257e1[_0x546e('0x25')]({'transaction':_0x44ca9d,'raw':!![]})[_0x546e('0x24')](function(_0x2606dd){if(_0x2606dd[_0x546e('0x50')]){fs[_0x546e('0x5f')](_0x2606dd[_0x546e('0x50')])['forEach'](function(_0x5e3cf0){fs[_0x546e('0x60')](path[_0x546e('0x51')](_0x2606dd[_0x546e('0x50')],_0x5e3cf0));});fs[_0x546e('0x61')](_0x2606dd[_0x546e('0x50')]);}return _0x2606dd;});})[_0x546e('0x4a')](function(_0x1ef72a){throw new db[(_0x546e('0x62'))][(_0x546e('0x63'))](_0x1ef72a[_0x546e('0x64')]);});}})[_0x546e('0x24')](handleEntityNotFound(_0x1b73a1,null))['then'](removeEntity(_0x1b73a1,null))['catch'](handleError(_0x1b73a1,null));};exports[_0x546e('0x65')]=function(_0x562bd8,_0x344276,_0x1f8445){return db[_0x546e('0x4e')][_0x546e('0x66')](function(_0x2235d0){var _0x4674ec;return db[_0x546e('0x2f')][_0x546e('0x4b')]({'where':{'id':_0x562bd8[_0x546e('0x5e')]['id']}})[_0x546e('0x24')](function(_0xa31658){if(_0xa31658){_0x4674ec=_0xa31658;return _0xa31658[_0x546e('0x65')](_0x562bd8[_0x546e('0x4d')]['id'],{'transaction':_0x2235d0});}})[_0x546e('0x24')](function(_0x51e943){if(_0x51e943){return db[_0x546e('0x67')][_0x546e('0x68')]({'where':{'id':_0x562bd8['body']['id']},'attributes':['id','name',_0x546e('0x69'),_0x546e('0x6a'),_0x546e('0x6b')],'raw':!![]});}})[_0x546e('0x24')](function(_0xd88efc){if(_0xd88efc){var _0x3ec6f8=path[_0x546e('0x51')](config[_0x546e('0x52')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x546e('0x6c')](_0xd88efc[_0x546e('0x69')],path[_0x546e('0x6d')](_0xd88efc[_0x546e('0x69')])),_0xd88efc[_0x546e('0x6a')]));var _0x12e025=path[_0x546e('0x51')](config[_0x546e('0x52')],'server/files/moh',_0x4674ec[_0x546e('0x2c')],util[_0x546e('0x6e')](_0x546e('0x6f'),_0xd88efc['name'],_0xd88efc[_0x546e('0x6a')]));fs['symlinkSync'](_0x3ec6f8,_0x12e025);return _0xd88efc;}})[_0x546e('0x4a')](function(_0x291cdb){throw new db['Sequelize'][(_0x546e('0x63'))](_0x291cdb[_0x546e('0x64')]);});})[_0x546e('0x24')](handleEntityNotFound(_0x344276,null))[_0x546e('0x24')](respondWithResult(_0x344276,0xc9))[_0x546e('0x4a')](handleError(_0x344276,null));};exports[_0x546e('0x70')]=function(_0x493279,_0x3bf34f,_0x31d1ff){return db[_0x546e('0x4e')][_0x546e('0x66')](function(_0x3bab10){var _0x5c43b5;return db['VoiceMusicOnHold'][_0x546e('0x68')]({'where':{'id':_0x493279[_0x546e('0x5e')]['id']}})[_0x546e('0x24')](handleEntityNotFound(_0x3bf34f,null))['then'](function(_0x3f1a91){if(_0x3f1a91){_0x5c43b5=_0x3f1a91;return _0x3f1a91[_0x546e('0x70')](_0x493279[_0x546e('0x5e')]['id2']);}})[_0x546e('0x24')](function(_0x10a6d9){if(_0x10a6d9){return db[_0x546e('0x67')][_0x546e('0x68')]({'where':{'id':_0x493279[_0x546e('0x5e')][_0x546e('0x71')]},'attributes':['id','name',_0x546e('0x69'),'converted_format',_0x546e('0x6b')],'raw':!![]});}})[_0x546e('0x24')](function(_0x21f5ae){if(_0x21f5ae){fs[_0x546e('0x60')](path[_0x546e('0x51')](_0x5c43b5['directory'],util[_0x546e('0x6e')](_0x546e('0x6f'),_0x21f5ae[_0x546e('0x2c')],_0x21f5ae['converted_format'])));return _0x21f5ae;}})[_0x546e('0x4a')](function(_0xf5b3e5){throw new db[(_0x546e('0x62'))][(_0x546e('0x63'))](_0xf5b3e5['message']);});})['then'](handleEntityNotFound(_0x3bf34f,null))[_0x546e('0x24')](respondWithStatusCode(_0x3bf34f,0xcc))[_0x546e('0x4a')](handleError(_0x3bf34f,null));};exports[_0x546e('0x72')]=function(_0x5bc919,_0x2df0d2,_0x1dc627){var _0x4075d9={};var _0x58f680={};var _0x24cbe3;var _0x21ff6a;return db[_0x546e('0x2f')][_0x546e('0x68')]({'where':{'id':_0x5bc919[_0x546e('0x5e')]['id']}})[_0x546e('0x24')](handleEntityNotFound(_0x2df0d2,null))[_0x546e('0x24')](function(_0x9117b){if(_0x9117b){_0x24cbe3=_0x9117b;_0x58f680['model']=_[_0x546e('0x37')](db[_0x546e('0x67')][_0x546e('0x30')]);_0x58f680['query']=_['keys'](_0x5bc919[_0x546e('0x36')]);_0x58f680['filters']=_[_0x546e('0x39')](_0x58f680[_0x546e('0x34')],_0x58f680[_0x546e('0x36')]);_0x4075d9['attributes']=_['intersection'](_0x58f680['model'],qs[_0x546e('0x3a')](_0x5bc919[_0x546e('0x36')][_0x546e('0x3a')]));_0x4075d9['attributes']=_0x4075d9[_0x546e('0x3b')][_0x546e('0x3c')]?_0x4075d9[_0x546e('0x3b')]:_0x58f680[_0x546e('0x34')];_0x4075d9[_0x546e('0x3f')]=qs[_0x546e('0x40')](_0x5bc919[_0x546e('0x36')][_0x546e('0x40')]);_0x4075d9[_0x546e('0x42')]=qs[_0x546e('0x38')](_[_0x546e('0x73')](_0x5bc919['query'],_0x58f680[_0x546e('0x38')]));if(_0x5bc919[_0x546e('0x36')][_0x546e('0x41')]){_0x4075d9[_0x546e('0x42')]=_[_0x546e('0x43')](_0x4075d9[_0x546e('0x42')],{'$or':_[_0x546e('0x35')](_0x4075d9[_0x546e('0x3b')],function(_0x176b94){var _0x34d0c7={};_0x34d0c7[_0x176b94]={'$like':'%'+_0x5bc919[_0x546e('0x36')]['filter']+'%'};return _0x34d0c7;})});}_0x4075d9=_[_0x546e('0x43')]({},_0x4075d9,_0x5bc919['options']);return _0x24cbe3['getSounds'](_0x4075d9);}})[_0x546e('0x24')](function(_0x3fa9bf){if(_0x3fa9bf){_0x21ff6a=_0x3fa9bf['length'];if(!_0x5bc919['query'][_0x546e('0x3d')](_0x546e('0x3e'))){_0x4075d9['limit']=qs['limit'](_0x5bc919['query'][_0x546e('0x1e')]);_0x4075d9[_0x546e('0x1c')]=qs[_0x546e('0x1c')](_0x5bc919['query']['offset']);}return _0x24cbe3['getSounds'](_0x4075d9);}})[_0x546e('0x24')](function(_0x159127){if(_0x159127){return _0x159127?{'count':_0x21ff6a,'rows':_0x159127}:null;}})[_0x546e('0x24')](respondWithResult(_0x2df0d2,null))[_0x546e('0x4a')](handleError(_0x2df0d2,null));}; \ No newline at end of file +var _0x77c7=['pick','filter','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','rows','show','params','keys','length','merge','find','catch','body','create','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','%s.%s','basename','extname','converted_format','symlinkSync','removeSound','sequelize','id2','createdAt','format','getSounds','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','save','update','then','get','MusicOnHolds','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filters'];(function(_0x170c5e,_0x19cd2d){var _0x182d10=function(_0x4a55d2){while(--_0x4a55d2){_0x170c5e['push'](_0x170c5e['shift']());}};_0x182d10(++_0x19cd2d);}(_0x77c7,0x1f1));var _0x777c=function(_0x2f769f,_0x1a9ab1){_0x2f769f=_0x2f769f-0x0;var _0x83f253=_0x77c7[_0x2f769f];return _0x83f253;};'use strict';var emlformat=require(_0x777c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x777c('0x1'));var jsonpatch=require(_0x777c('0x2'));var rp=require(_0x777c('0x3'));var moment=require(_0x777c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x777c('0x5'));var path=require('path');var sox=require(_0x777c('0x6'));var csv=require(_0x777c('0x7'));var ejs=require(_0x777c('0x8'));var fs=require('fs');var fs_extra=require(_0x777c('0x9'));var _=require(_0x777c('0xa'));var squel=require(_0x777c('0xb'));var crypto=require(_0x777c('0xc'));var jsforce=require(_0x777c('0xd'));var deskjs=require(_0x777c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x777c('0xf'));var authService=require(_0x777c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x777c('0x11'));var hardwareService=require(_0x777c('0x12'));var logger=require('../../config/logger')(_0x777c('0x13'));var utils=require(_0x777c('0x14'));var config=require(_0x777c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x777c('0x16'))['db'];function respondWithStatusCode(_0x106605,_0x26f912){_0x26f912=_0x26f912||0xcc;return function(_0x269dd3){if(_0x269dd3){return _0x106605[_0x777c('0x17')](_0x26f912);}return _0x106605['status'](_0x26f912)['end']();};}function respondWithResult(_0x1cd25e,_0x24dbba){_0x24dbba=_0x24dbba||0xc8;return function(_0x4db2d5){if(_0x4db2d5){return _0x1cd25e['status'](_0x24dbba)[_0x777c('0x18')](_0x4db2d5);}};}function respondWithFilteredResult(_0x3563bf,_0x1c3612){return function(_0x5653b4){if(_0x5653b4){var _0x1b0781=typeof _0x1c3612[_0x777c('0x19')]==='undefined'&&typeof _0x1c3612[_0x777c('0x1a')]===_0x777c('0x1b');var _0x304992=_0x5653b4[_0x777c('0x1c')];var _0x48011c=_0x1b0781?0x0:_0x1c3612[_0x777c('0x19')];var _0x5fb64=_0x1b0781?_0x5653b4['count']:_0x1c3612[_0x777c('0x19')]+_0x1c3612[_0x777c('0x1a')];var _0x5f398e;if(_0x5fb64>=_0x304992){_0x5fb64=_0x304992;_0x5f398e=0xc8;}else{_0x5f398e=0xce;}_0x3563bf[_0x777c('0x1d')](_0x5f398e);return _0x3563bf[_0x777c('0x1e')]('Content-Range',_0x48011c+'-'+_0x5fb64+'/'+_0x304992)[_0x777c('0x18')](_0x5653b4);}return null;};}function patchUpdates(_0x30aef7){return function(_0x530ecd){try{jsonpatch['apply'](_0x530ecd,_0x30aef7,!![]);}catch(_0x5167c2){return BPromise['reject'](_0x5167c2);}return _0x530ecd[_0x777c('0x1f')]();};}function saveUpdates(_0x44ffe9,_0x5dc1f6){return function(_0x2797e8){if(_0x2797e8){return _0x2797e8[_0x777c('0x20')](_0x44ffe9)['then'](function(_0x4f3273){return _0x4f3273;});}return null;};}function removeEntity(_0x5d5e00,_0x47fc00){return function(_0x2f4361){if(_0x2f4361){return _0x2f4361['destroy']()[_0x777c('0x21')](function(){var _0x532215=_0x2f4361[_0x777c('0x22')]({'plain':!![]});var _0x1d20b7=_0x777c('0x23');return db['UserProfileResource'][_0x777c('0x24')]({'where':{'type':_0x1d20b7,'resourceId':_0x532215['id']}})['then'](function(){return _0x2f4361;});})[_0x777c('0x21')](function(){_0x5d5e00[_0x777c('0x1d')](0xcc)[_0x777c('0x25')]();});}};}function handleEntityNotFound(_0x10e08a,_0x16a4d0){return function(_0x15e3ce){if(!_0x15e3ce){_0x10e08a['sendStatus'](0x194);}return _0x15e3ce;};}function handleError(_0x337f83,_0xfd4aee){_0xfd4aee=_0xfd4aee||0x1f4;return function(_0x4a25ae){logger[_0x777c('0x26')](_0x4a25ae[_0x777c('0x27')]);if(_0x4a25ae[_0x777c('0x28')]){delete _0x4a25ae[_0x777c('0x28')];}_0x337f83[_0x777c('0x1d')](_0xfd4aee)[_0x777c('0x29')](_0x4a25ae);};}exports[_0x777c('0x2a')]=function(_0x294ba4,_0x326581){var _0x477380={},_0x53a7e4={},_0x1a7f25={'count':0x0,'rows':[]};var _0x51563b=_[_0x777c('0x2b')](db['VoiceMusicOnHold'][_0x777c('0x2c')],function(_0x130771){return{'name':_0x130771[_0x777c('0x2d')],'type':_0x130771[_0x777c('0x2e')][_0x777c('0x2f')]};});_0x53a7e4['model']=_[_0x777c('0x2b')](_0x51563b,_0x777c('0x28'));_0x53a7e4[_0x777c('0x30')]=_['keys'](_0x294ba4['query']);_0x53a7e4['filters']=_[_0x777c('0x31')](_0x53a7e4['model'],_0x53a7e4[_0x777c('0x30')]);_0x477380['attributes']=_['intersection'](_0x53a7e4[_0x777c('0x32')],qs[_0x777c('0x33')](_0x294ba4[_0x777c('0x30')]['fields']));_0x477380['attributes']=_0x477380[_0x777c('0x34')]['length']?_0x477380['attributes']:_0x53a7e4[_0x777c('0x32')];if(!_0x294ba4[_0x777c('0x30')][_0x777c('0x35')]('nolimit')){_0x477380[_0x777c('0x1a')]=qs[_0x777c('0x1a')](_0x294ba4['query'][_0x777c('0x1a')]);_0x477380[_0x777c('0x19')]=qs['offset'](_0x294ba4[_0x777c('0x30')][_0x777c('0x19')]);}_0x477380[_0x777c('0x36')]=qs[_0x777c('0x37')](_0x294ba4['query'][_0x777c('0x37')]);delete _0x294ba4[_0x777c('0x30')][_0x777c('0x37')];_0x477380[_0x777c('0x38')]=qs[_0x777c('0x39')](_[_0x777c('0x3a')](_0x294ba4[_0x777c('0x30')],_0x53a7e4[_0x777c('0x39')]),_0x51563b);if(_0x294ba4[_0x777c('0x30')][_0x777c('0x3b')]){_0x477380['where']=_['merge'](_0x477380[_0x777c('0x38')],{'$or':_[_0x777c('0x2b')](_0x51563b,function(_0xe5b863){if(_0xe5b863[_0x777c('0x2e')]!==_0x777c('0x3c')){var _0x365b46={};_0x365b46[_0xe5b863[_0x777c('0x28')]]={'$like':'%'+_0x294ba4['query'][_0x777c('0x3b')]+'%'};return _0x365b46;}})});}_0x477380=_['merge']({},_0x477380,_0x294ba4[_0x777c('0x3d')]);var _0x25b975={'where':_0x477380[_0x777c('0x38')]};return db[_0x777c('0x3e')][_0x777c('0x1c')](_0x25b975)[_0x777c('0x21')](function(_0x5094c0){_0x1a7f25[_0x777c('0x1c')]=_0x5094c0;if(_0x294ba4[_0x777c('0x30')][_0x777c('0x3f')]){_0x477380[_0x777c('0x40')]=[{'all':!![]}];}return db[_0x777c('0x3e')][_0x777c('0x41')](_0x477380);})[_0x777c('0x21')](function(_0x193b67){_0x1a7f25[_0x777c('0x42')]=_0x193b67;return _0x1a7f25;})[_0x777c('0x21')](respondWithFilteredResult(_0x326581,_0x477380))['catch'](handleError(_0x326581,null));};exports[_0x777c('0x43')]=function(_0x1ae3f8,_0x352fb0){var _0x4d209c={'raw':![],'where':{'id':_0x1ae3f8[_0x777c('0x44')]['id']}},_0x51df55={};_0x51df55[_0x777c('0x32')]=_['keys'](db[_0x777c('0x3e')][_0x777c('0x2c')]);_0x51df55['query']=_[_0x777c('0x45')](_0x1ae3f8[_0x777c('0x30')]);_0x51df55[_0x777c('0x39')]=_[_0x777c('0x31')](_0x51df55['model'],_0x51df55[_0x777c('0x30')]);_0x4d209c[_0x777c('0x34')]=_[_0x777c('0x31')](_0x51df55['model'],qs[_0x777c('0x33')](_0x1ae3f8[_0x777c('0x30')][_0x777c('0x33')]));_0x4d209c[_0x777c('0x34')]=_0x4d209c[_0x777c('0x34')][_0x777c('0x46')]?_0x4d209c[_0x777c('0x34')]:_0x51df55[_0x777c('0x32')];if(_0x1ae3f8[_0x777c('0x30')][_0x777c('0x3f')]){_0x4d209c[_0x777c('0x40')]=[{'all':!![]}];}_0x4d209c=_[_0x777c('0x47')]({},_0x4d209c,_0x1ae3f8[_0x777c('0x3d')]);return db[_0x777c('0x3e')][_0x777c('0x48')](_0x4d209c)['then'](handleEntityNotFound(_0x352fb0,null))[_0x777c('0x21')](respondWithResult(_0x352fb0,null))[_0x777c('0x49')](handleError(_0x352fb0,null));};exports[_0x777c('0x20')]=function(_0x42e3af,_0x48985c){if(_0x42e3af['body']['id']){delete _0x42e3af[_0x777c('0x4a')]['id'];}return db[_0x777c('0x3e')][_0x777c('0x48')]({'where':{'id':_0x42e3af[_0x777c('0x44')]['id']}})['then'](handleEntityNotFound(_0x48985c,null))[_0x777c('0x21')](saveUpdates(_0x42e3af[_0x777c('0x4a')],null))[_0x777c('0x21')](respondWithResult(_0x48985c,null))[_0x777c('0x49')](handleError(_0x48985c,null));};exports[_0x777c('0x4b')]=function(_0x4a594e,_0x3318ca,_0x2886e8){return db['sequelize'][_0x777c('0x4c')](function(_0x14b40d){if(_0x4a594e['body'][_0x777c('0x4d')]==='files'){_0x4a594e['body'][_0x777c('0x4e')]=path[_0x777c('0x4f')](config[_0x777c('0x50')],_0x777c('0x51'),_0x4a594e[_0x777c('0x4a')][_0x777c('0x28')]);}return db[_0x777c('0x3e')][_0x777c('0x4b')](_0x4a594e['body'],{'transaction':_0x14b40d})[_0x777c('0x21')](function(_0x9a18f2){if(_0x4a594e['body'][_0x777c('0x4d')]===_0x777c('0x52')){fs[_0x777c('0x53')](_0x9a18f2[_0x777c('0x4e')],parseInt('0777',0x8));}var _0x1088c4=_0x4a594e[_0x777c('0x54')]['get']({'plain':!![]});if(!_0x1088c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1088c4[_0x777c('0x55')]==='user'){var _0x5bd32d=_0x9a18f2['get']({'plain':!![]});return db[_0x777c('0x56')][_0x777c('0x48')]({'where':{'name':_0x777c('0x23'),'userProfileId':_0x1088c4[_0x777c('0x57')]},'raw':!![]})[_0x777c('0x21')](function(_0x37f661){if(_0x37f661&&_0x37f661['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bd32d[_0x777c('0x28')],'resourceId':_0x5bd32d['id'],'type':_0x37f661[_0x777c('0x28')],'sectionId':_0x37f661['id']},{})['then'](function(){return _0x9a18f2;});}else{return _0x9a18f2;}})[_0x777c('0x49')](function(_0x4f134b){logger[_0x777c('0x26')](_0x777c('0x58'),_0x4f134b);});}return _0x9a18f2;});})[_0x777c('0x21')](respondWithResult(_0x3318ca,0xc9))['catch'](handleError(_0x3318ca,null));};exports[_0x777c('0x24')]=function(_0x58bb2a,_0x22415a,_0x233ecf){var _0x1f01f1;return db[_0x777c('0x3e')][_0x777c('0x48')]({'where':{'id':_0x58bb2a[_0x777c('0x44')]['id']}})[_0x777c('0x21')](function(_0x201ca9){if(_0x201ca9){return db['sequelize'][_0x777c('0x4c')](function(_0xcd2a0b){return _0x201ca9[_0x777c('0x24')]({'transaction':_0xcd2a0b,'raw':!![]})[_0x777c('0x21')](function(_0x25c982){if(_0x25c982[_0x777c('0x4e')]){fs[_0x777c('0x59')](_0x25c982[_0x777c('0x4e')])[_0x777c('0x5a')](function(_0x3cdf3c){fs[_0x777c('0x5b')](path[_0x777c('0x4f')](_0x25c982[_0x777c('0x4e')],_0x3cdf3c));});fs[_0x777c('0x5c')](_0x25c982['directory']);}return _0x25c982;});})[_0x777c('0x49')](function(_0x40759d){throw new db[(_0x777c('0x5d'))][(_0x777c('0x5e'))](_0x40759d[_0x777c('0x5f')]);});}})[_0x777c('0x21')](handleEntityNotFound(_0x22415a,null))[_0x777c('0x21')](removeEntity(_0x22415a,null))[_0x777c('0x49')](handleError(_0x22415a,null));};exports[_0x777c('0x60')]=function(_0x48dd7a,_0x3fee03,_0x57c168){return db['sequelize'][_0x777c('0x4c')](function(_0x376a1c){var _0x1335a1;return db[_0x777c('0x3e')][_0x777c('0x48')]({'where':{'id':_0x48dd7a[_0x777c('0x44')]['id']}})['then'](function(_0xf6f807){if(_0xf6f807){_0x1335a1=_0xf6f807;return _0xf6f807['addSound'](_0x48dd7a[_0x777c('0x4a')]['id'],{'transaction':_0x376a1c});}})['then'](function(_0xb642b1){if(_0xb642b1){return db[_0x777c('0x61')][_0x777c('0x62')]({'where':{'id':_0x48dd7a['body']['id']},'attributes':['id',_0x777c('0x28'),_0x777c('0x63'),'converted_format','createdAt'],'raw':!![]});}})['then'](function(_0x6c817a){if(_0x6c817a){var _0x335766=path[_0x777c('0x4f')](config[_0x777c('0x50')],'server/files/sounds/converted',util['format'](_0x777c('0x64'),path[_0x777c('0x65')](_0x6c817a[_0x777c('0x63')],path[_0x777c('0x66')](_0x6c817a[_0x777c('0x63')])),_0x6c817a['converted_format']));var _0x245b05=path[_0x777c('0x4f')](config[_0x777c('0x50')],'server/files/moh',_0x1335a1[_0x777c('0x28')],util['format']('%s.%s',_0x6c817a[_0x777c('0x28')],_0x6c817a[_0x777c('0x67')]));fs[_0x777c('0x68')](_0x335766,_0x245b05);return _0x6c817a;}})[_0x777c('0x49')](function(_0x9d18d4){throw new db[(_0x777c('0x5d'))][(_0x777c('0x5e'))](_0x9d18d4['message']);});})[_0x777c('0x21')](handleEntityNotFound(_0x3fee03,null))[_0x777c('0x21')](respondWithResult(_0x3fee03,0xc9))[_0x777c('0x49')](handleError(_0x3fee03,null));};exports[_0x777c('0x69')]=function(_0x3f8c82,_0xb6b752,_0x3d3a31){return db[_0x777c('0x6a')][_0x777c('0x4c')](function(_0xb051e){var _0x356c3e;return db[_0x777c('0x3e')][_0x777c('0x62')]({'where':{'id':_0x3f8c82['params']['id']}})[_0x777c('0x21')](handleEntityNotFound(_0xb6b752,null))['then'](function(_0x10d814){if(_0x10d814){_0x356c3e=_0x10d814;return _0x10d814[_0x777c('0x69')](_0x3f8c82[_0x777c('0x44')][_0x777c('0x6b')]);}})['then'](function(_0x842de9){if(_0x842de9){return db[_0x777c('0x61')][_0x777c('0x62')]({'where':{'id':_0x3f8c82[_0x777c('0x44')]['id2']},'attributes':['id','name','save_name',_0x777c('0x67'),_0x777c('0x6c')],'raw':!![]});}})[_0x777c('0x21')](function(_0x85a205){if(_0x85a205){fs[_0x777c('0x5b')](path[_0x777c('0x4f')](_0x356c3e['directory'],util[_0x777c('0x6d')](_0x777c('0x64'),_0x85a205['name'],_0x85a205[_0x777c('0x67')])));return _0x85a205;}})[_0x777c('0x49')](function(_0x3dd36c){throw new db[(_0x777c('0x5d'))][(_0x777c('0x5e'))](_0x3dd36c['message']);});})[_0x777c('0x21')](handleEntityNotFound(_0xb6b752,null))[_0x777c('0x21')](respondWithStatusCode(_0xb6b752,0xcc))[_0x777c('0x49')](handleError(_0xb6b752,null));};exports[_0x777c('0x6e')]=function(_0x21a697,_0x2d9ac5,_0x57c71b){var _0x2d15dd={};var _0x479e97={};var _0x4b3be3;var _0x50c877;return db[_0x777c('0x3e')]['findOne']({'where':{'id':_0x21a697[_0x777c('0x44')]['id']}})[_0x777c('0x21')](handleEntityNotFound(_0x2d9ac5,null))['then'](function(_0x4c74a3){if(_0x4c74a3){_0x4b3be3=_0x4c74a3;_0x479e97[_0x777c('0x32')]=_['keys'](db[_0x777c('0x61')][_0x777c('0x2c')]);_0x479e97[_0x777c('0x30')]=_[_0x777c('0x45')](_0x21a697[_0x777c('0x30')]);_0x479e97[_0x777c('0x39')]=_[_0x777c('0x31')](_0x479e97[_0x777c('0x32')],_0x479e97[_0x777c('0x30')]);_0x2d15dd['attributes']=_[_0x777c('0x31')](_0x479e97['model'],qs['fields'](_0x21a697[_0x777c('0x30')][_0x777c('0x33')]));_0x2d15dd[_0x777c('0x34')]=_0x2d15dd['attributes'][_0x777c('0x46')]?_0x2d15dd[_0x777c('0x34')]:_0x479e97['model'];_0x2d15dd[_0x777c('0x36')]=qs[_0x777c('0x37')](_0x21a697[_0x777c('0x30')][_0x777c('0x37')]);_0x2d15dd[_0x777c('0x38')]=qs['filters'](_[_0x777c('0x3a')](_0x21a697[_0x777c('0x30')],_0x479e97[_0x777c('0x39')]));if(_0x21a697['query'][_0x777c('0x3b')]){_0x2d15dd[_0x777c('0x38')]=_[_0x777c('0x47')](_0x2d15dd[_0x777c('0x38')],{'$or':_[_0x777c('0x2b')](_0x2d15dd[_0x777c('0x34')],function(_0x504187){var _0x23ff30={};_0x23ff30[_0x504187]={'$like':'%'+_0x21a697[_0x777c('0x30')]['filter']+'%'};return _0x23ff30;})});}_0x2d15dd=_[_0x777c('0x47')]({},_0x2d15dd,_0x21a697[_0x777c('0x3d')]);return _0x4b3be3[_0x777c('0x6e')](_0x2d15dd);}})[_0x777c('0x21')](function(_0x14b3de){if(_0x14b3de){_0x50c877=_0x14b3de['length'];if(!_0x21a697[_0x777c('0x30')][_0x777c('0x35')]('nolimit')){_0x2d15dd[_0x777c('0x1a')]=qs[_0x777c('0x1a')](_0x21a697[_0x777c('0x30')][_0x777c('0x1a')]);_0x2d15dd[_0x777c('0x19')]=qs[_0x777c('0x19')](_0x21a697[_0x777c('0x30')][_0x777c('0x19')]);}return _0x4b3be3[_0x777c('0x6e')](_0x2d15dd);}})['then'](function(_0x4434c3){if(_0x4434c3){return _0x4434c3?{'count':_0x50c877,'rows':_0x4434c3}:null;}})[_0x777c('0x21')](respondWithResult(_0x2d9ac5,null))[_0x777c('0x49')](handleError(_0x2d9ac5,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b69651c..b0cc0a7 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 _0xd0e7=['voice_musiconhold','../../config/logger','rimraf','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd0e7,0x121));var _0x7d0e=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xd0e7[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d0e('0x0'))('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(_0x7d0e('0x1'));var config=require('../../config/environment');var attributes=require(_0x7d0e('0x2'));module[_0x7d0e('0x3')]=function(_0x1bae67,_0x513da9){return _0x1bae67['define'](_0x7d0e('0x4'),attributes,{'tableName':_0x7d0e('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe01d=['define','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xe01d,0x147));var _0xde01=function(_0x357e06,_0x17e4e9){_0x357e06=_0x357e06-0x0;var _0x137954=_0xe01d[_0x357e06];return _0x137954;};'use strict';var _=require(_0xde01('0x0'));var util=require(_0xde01('0x1'));var logger=require(_0xde01('0x2'))(_0xde01('0x3'));var moment=require(_0xde01('0x4'));var BPromise=require(_0xde01('0x5'));var rp=require(_0xde01('0x6'));var fs=require('fs');var path=require(_0xde01('0x7'));var rimraf=require(_0xde01('0x8'));var config=require('../../config/environment');var attributes=require(_0xde01('0x9'));module[_0xde01('0xa')]=function(_0x3d8ad5,_0x2ae4d9){return _0x3d8ad5[_0xde01('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0xde01('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 fcee19b..14f0f6e 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4fdfec,_0x1568ee){var _0x4477b9=function(_0x3eb73b){while(--_0x3eb73b){_0x4fdfec['push'](_0x4fdfec['shift']());}};_0x4477b9(++_0x1568ee);}(_0x34e8,0x12c));var _0x834e=function(_0x1a28ca,_0x429ae4){_0x1a28ca=_0x1a28ca-0x0;var _0x12de74=_0x34e8[_0x1a28ca];return _0x12de74;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x585ca2,_0x1a7cb8){var _0x3e0a39=function(_0x3e99ed){while(--_0x3e99ed){_0x585ca2['push'](_0x585ca2['shift']());}};_0x3e0a39(++_0x1a7cb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index ba67cd3..09b8e29 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 _0x4f5d=['/:id','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xc3b53b,_0x1c1267){var _0x5c3e73=function(_0x4f2218){while(--_0x4f2218){_0xc3b53b['push'](_0xc3b53b['shift']());}};_0x5c3e73(++_0x1c1267);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4f5d[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var path=require(_0xd4f5('0x2'));var timeout=require(_0xd4f5('0x3'));var express=require(_0xd4f5('0x4'));var router=express[_0xd4f5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd4f5('0x6'));var interaction=require(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var controller=require(_0xd4f5('0x9'));router[_0xd4f5('0xa')]('/',auth[_0xd4f5('0xb')](),controller[_0xd4f5('0xc')]);router[_0xd4f5('0xa')](_0xd4f5('0xd'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0xe')]);router[_0xd4f5('0xa')](_0xd4f5('0xf'),auth['isAuthenticated'](),controller[_0xd4f5('0x10')]);router[_0xd4f5('0xa')]('/:id/users',auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x11')]);router[_0xd4f5('0xa')](_0xd4f5('0x12'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x13')]);router[_0xd4f5('0x14')]('/',auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x15')]);router['post'](_0xd4f5('0x16'),auth[_0xd4f5('0xb')](),controller['addAgents']);router[_0xd4f5('0x14')](_0xd4f5('0x12'),auth[_0xd4f5('0xb')](),controller['addTeams']);router[_0xd4f5('0x17')](_0xd4f5('0xf'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x18')]);router[_0xd4f5('0x19')](_0xd4f5('0xf'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x1a')]);router['delete'](_0xd4f5('0x16'),auth['isAuthenticated'](),controller[_0xd4f5('0x1b')]);router['delete'](_0xd4f5('0x12'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x1c')]);module[_0xd4f5('0x1d')]=router; \ No newline at end of file +var _0x330c=['/:id/users','/:id/teams','getTeams','post','create','addTeams','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x330c,0x186));var _0xc330=function(_0xeda4ba,_0x4215d5){_0xeda4ba=_0xeda4ba-0x0;var _0x121c71=_0x330c[_0xeda4ba];return _0x121c71;};'use strict';var multer=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var path=require(_0xc330('0x2'));var timeout=require(_0xc330('0x3'));var express=require('express');var router=express[_0xc330('0x4')]();var fs_extra=require(_0xc330('0x5'));var auth=require(_0xc330('0x6'));var interaction=require(_0xc330('0x7'));var config=require(_0xc330('0x8'));var controller=require(_0xc330('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc330('0xa')](_0xc330('0xb'),auth[_0xc330('0xc')](),controller[_0xc330('0xd')]);router[_0xc330('0xa')](_0xc330('0xe'),auth[_0xc330('0xc')](),controller['show']);router[_0xc330('0xa')](_0xc330('0xf'),auth[_0xc330('0xc')](),controller['getAgents']);router[_0xc330('0xa')](_0xc330('0x10'),auth[_0xc330('0xc')](),controller[_0xc330('0x11')]);router[_0xc330('0x12')]('/',auth[_0xc330('0xc')](),controller[_0xc330('0x13')]);router[_0xc330('0x12')](_0xc330('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0xc330('0x12')](_0xc330('0x10'),auth['isAuthenticated'](),controller[_0xc330('0x14')]);router[_0xc330('0x15')](_0xc330('0xe'),auth[_0xc330('0xc')](),controller[_0xc330('0x16')]);router[_0xc330('0x17')](_0xc330('0xe'),auth[_0xc330('0xc')](),controller[_0xc330('0x18')]);router['delete'](_0xc330('0xf'),auth[_0xc330('0xc')](),controller['removeAgents']);router[_0xc330('0x17')](_0xc330('0x10'),auth[_0xc330('0xc')](),controller[_0xc330('0x19')]);module[_0xc330('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index aacc329..a1c98de 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 _0xcc01=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x2fafc2,_0x795839){var _0x1aecfd=function(_0x4a339d){while(--_0x4a339d){_0x2fafc2['push'](_0x2fafc2['shift']());}};_0x1aecfd(++_0x795839);}(_0xcc01,0x18d));var _0x1cc0=function(_0x9c79b3,_0x5c5ac0){_0x9c79b3=_0x9c79b3-0x0;var _0x2b897a=_0xcc01[_0x9c79b3];return _0x2b897a;};'use strict';var Sequelize=require(_0x1cc0('0x0'));module[_0x1cc0('0x1')]={'name':{'type':Sequelize[_0x1cc0('0x2')],'allowNull':![],'unique':_0x1cc0('0x3')},'prefix':{'type':Sequelize[_0x1cc0('0x4')],'get':function(_0x232590){return _0x1cc0('0x5')+this[_0x1cc0('0x6')](_0x1cc0('0x3'))+'-';}},'description':{'type':Sequelize[_0x1cc0('0x2')]},'callerIdAll':{'type':Sequelize[_0x1cc0('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x1cc0('0x7')]}}; \ No newline at end of file +var _0x40b7=['exports','name','system-','getDataValue','STRING','INTEGER','sequelize'];(function(_0x42c994,_0x450814){var _0x7994cd=function(_0x3cff42){while(--_0x3cff42){_0x42c994['push'](_0x42c994['shift']());}};_0x7994cd(++_0x450814);}(_0x40b7,0x92));var _0x740b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x40b7[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x740b('0x0'));module[_0x740b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x740b('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x4e541c){return _0x740b('0x3')+this[_0x740b('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x740b('0x5')]},'callerIdAll':{'type':Sequelize[_0x740b('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x740b('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 3bf2382..73c9a6a 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 _0x36ee=['show','params','find','describe','create','sequelize','transaction','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','body','findById','addAgents','spread','ids','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','User','nolimit','getTeams','findOne','Team','findAll','Agents','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','includes','all','forEach','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','then','destroy','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x1eda65,_0x13d2d7){var _0x57d5ad=function(_0xc731b2){while(--_0xc731b2){_0x1eda65['push'](_0x1eda65['shift']());}};_0x57d5ad(++_0x13d2d7);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];config['redis']=_[_0xe36e('0x19')](config[_0xe36e('0x1a')],{'host':_0xe36e('0x1b'),'port':0x18eb});var socket=require(_0xe36e('0x1c'))(new Redis(config['redis']));require(_0xe36e('0x1d'))['register'](socket);function respondWithStatusCode(_0x525155,_0x27ff47){_0x27ff47=_0x27ff47||0xcc;return function(_0x300f21){if(_0x300f21){return _0x525155[_0xe36e('0x1e')](_0x27ff47);}return _0x525155[_0xe36e('0x1f')](_0x27ff47)[_0xe36e('0x20')]();};}function respondWithResult(_0x924cd5,_0x2096f6){_0x2096f6=_0x2096f6||0xc8;return function(_0x39bae8){if(_0x39bae8){return _0x924cd5[_0xe36e('0x1f')](_0x2096f6)[_0xe36e('0x21')](_0x39bae8);}};}function respondWithFilteredResult(_0x5792e8,_0x333554){return function(_0x2184ae){if(_0x2184ae){var _0x56c019=typeof _0x333554[_0xe36e('0x22')]==='undefined'&&typeof _0x333554[_0xe36e('0x23')]===_0xe36e('0x24');var _0x5e15f5=_0x2184ae[_0xe36e('0x25')];var _0x6aa186=_0x56c019?0x0:_0x333554[_0xe36e('0x22')];var _0x597331=_0x56c019?_0x2184ae[_0xe36e('0x25')]:_0x333554[_0xe36e('0x22')]+_0x333554[_0xe36e('0x23')];var _0x3c4017;if(_0x597331>=_0x5e15f5){_0x597331=_0x5e15f5;_0x3c4017=0xc8;}else{_0x3c4017=0xce;}_0x5792e8[_0xe36e('0x1f')](_0x3c4017);return _0x5792e8[_0xe36e('0x26')]('Content-Range',_0x6aa186+'-'+_0x597331+'/'+_0x5e15f5)[_0xe36e('0x21')](_0x2184ae);}return null;};}function patchUpdates(_0x4f214a){return function(_0x23bcf3){try{jsonpatch[_0xe36e('0x27')](_0x23bcf3,_0x4f214a,!![]);}catch(_0x437f3f){return BPromise['reject'](_0x437f3f);}return _0x23bcf3['save']();};}function saveUpdates(_0x4749a8,_0x10818d){return function(_0xb0cd85){if(_0xb0cd85){return _0xb0cd85[_0xe36e('0x28')](_0x4749a8)[_0xe36e('0x29')](function(_0x1507f9){return _0x1507f9;});}return null;};}function removeEntity(_0x1a045c,_0x5ac484){return function(_0x3cafbf){if(_0x3cafbf){return _0x3cafbf[_0xe36e('0x2a')]()[_0xe36e('0x29')](function(){var _0x262caa=_0x3cafbf['get']({'plain':!![]});var _0x2d757c='VoicePrefixes';return db[_0xe36e('0x2b')]['destroy']({'where':{'type':_0x2d757c,'resourceId':_0x262caa['id']}})[_0xe36e('0x29')](function(){return _0x3cafbf;});})['then'](function(){_0x1a045c[_0xe36e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b1045,_0x59548b){return function(_0x4bb75b){if(!_0x4bb75b){_0x3b1045['sendStatus'](0x194);}return _0x4bb75b;};}function handleError(_0x5b5d53,_0x203fa2){_0x203fa2=_0x203fa2||0x1f4;return function(_0x1fc639){logger['error'](_0x1fc639['stack']);if(_0x1fc639[_0xe36e('0x2c')]){delete _0x1fc639[_0xe36e('0x2c')];}_0x5b5d53[_0xe36e('0x1f')](_0x203fa2)[_0xe36e('0x2d')](_0x1fc639);};}exports[_0xe36e('0x2e')]=function(_0x4759b4,_0x57bb9b){var _0xb98e78={},_0x11c95d={},_0x57272f={'count':0x0,'rows':[]};var _0x87e595=_[_0xe36e('0x2f')](db[_0xe36e('0x30')][_0xe36e('0x31')],function(_0x21623e){return{'name':_0x21623e[_0xe36e('0x32')],'type':_0x21623e[_0xe36e('0x33')][_0xe36e('0x34')]};});_0x11c95d[_0xe36e('0x35')]=_[_0xe36e('0x2f')](_0x87e595,_0xe36e('0x2c'));_0x11c95d['query']=_[_0xe36e('0x36')](_0x4759b4['query']);_0x11c95d['filters']=_[_0xe36e('0x37')](_0x11c95d['model'],_0x11c95d[_0xe36e('0x38')]);_0xb98e78[_0xe36e('0x39')]=_[_0xe36e('0x37')](_0x11c95d[_0xe36e('0x35')],qs['fields'](_0x4759b4['query'][_0xe36e('0x3a')]));_0xb98e78[_0xe36e('0x39')]=_0xb98e78[_0xe36e('0x39')][_0xe36e('0x3b')]?_0xb98e78['attributes']:_0x11c95d[_0xe36e('0x35')];if(!_0x4759b4[_0xe36e('0x38')][_0xe36e('0x3c')]('nolimit')){_0xb98e78[_0xe36e('0x23')]=qs[_0xe36e('0x23')](_0x4759b4['query'][_0xe36e('0x23')]);_0xb98e78[_0xe36e('0x22')]=qs[_0xe36e('0x22')](_0x4759b4[_0xe36e('0x38')][_0xe36e('0x22')]);}_0xb98e78[_0xe36e('0x3d')]=qs[_0xe36e('0x3e')](_0x4759b4[_0xe36e('0x38')][_0xe36e('0x3e')]);_0xb98e78[_0xe36e('0x3f')]=qs[_0xe36e('0x40')](_[_0xe36e('0x41')](_0x4759b4[_0xe36e('0x38')],_0x11c95d['filters']),_0x87e595);if(_0x4759b4[_0xe36e('0x38')][_0xe36e('0x42')]){_0xb98e78[_0xe36e('0x3f')]=_[_0xe36e('0x43')](_0xb98e78[_0xe36e('0x3f')],{'$or':_['map'](_0x87e595,function(_0x591e33){if(_0x591e33[_0xe36e('0x33')]!==_0xe36e('0x44')){var _0x1acc12={};_0x1acc12[_0x591e33[_0xe36e('0x2c')]]={'$like':'%'+_0x4759b4[_0xe36e('0x38')][_0xe36e('0x42')]+'%'};return _0x1acc12;}})});}_0xb98e78=_[_0xe36e('0x43')]({},_0xb98e78,_0x4759b4[_0xe36e('0x45')]);var _0x48066c={'where':_0xb98e78[_0xe36e('0x3f')]};return db[_0xe36e('0x30')]['count'](_0x48066c)[_0xe36e('0x29')](function(_0x5ef3e4){_0x57272f[_0xe36e('0x25')]=_0x5ef3e4;if(_0x4759b4[_0xe36e('0x38')][_0xe36e('0x46')]){_0xb98e78[_0xe36e('0x47')]=[{'all':!![]}];}return db[_0xe36e('0x30')]['findAll'](_0xb98e78);})[_0xe36e('0x29')](function(_0x2961c9){_0x57272f[_0xe36e('0x48')]=_0x2961c9;return _0x57272f;})[_0xe36e('0x29')](respondWithFilteredResult(_0x57bb9b,_0xb98e78))[_0xe36e('0x49')](handleError(_0x57bb9b,null));};exports[_0xe36e('0x4a')]=function(_0x569809,_0x122704){var _0x134d71={'raw':![],'where':{'id':_0x569809[_0xe36e('0x4b')]['id']}},_0x2a6817={};_0x2a6817[_0xe36e('0x35')]=_['keys'](db[_0xe36e('0x30')][_0xe36e('0x31')]);_0x2a6817[_0xe36e('0x38')]=_[_0xe36e('0x36')](_0x569809[_0xe36e('0x38')]);_0x2a6817[_0xe36e('0x40')]=_[_0xe36e('0x37')](_0x2a6817[_0xe36e('0x35')],_0x2a6817[_0xe36e('0x38')]);_0x134d71['attributes']=_['intersection'](_0x2a6817[_0xe36e('0x35')],qs['fields'](_0x569809[_0xe36e('0x38')][_0xe36e('0x3a')]));_0x134d71[_0xe36e('0x39')]=_0x134d71[_0xe36e('0x39')]['length']?_0x134d71[_0xe36e('0x39')]:_0x2a6817[_0xe36e('0x35')];if(_0x569809['query'][_0xe36e('0x46')]){_0x134d71[_0xe36e('0x47')]=[{'all':!![]}];}_0x134d71=_[_0xe36e('0x43')]({},_0x134d71,_0x569809[_0xe36e('0x45')]);return db[_0xe36e('0x30')][_0xe36e('0x4c')](_0x134d71)[_0xe36e('0x29')](handleEntityNotFound(_0x122704,null))[_0xe36e('0x29')](respondWithResult(_0x122704,null))[_0xe36e('0x49')](handleError(_0x122704,null));};exports[_0xe36e('0x2a')]=function(_0x7307bc,_0x13ccc5){return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x7307bc[_0xe36e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13ccc5,null))[_0xe36e('0x29')](removeEntity(_0x13ccc5,null))['catch'](handleError(_0x13ccc5,null));};exports['describe']=function(_0x10b8ff,_0x3e8ccb){return db['VoicePrefix'][_0xe36e('0x4d')]()[_0xe36e('0x29')](respondWithResult(_0x3e8ccb,null))[_0xe36e('0x49')](handleError(_0x3e8ccb,null));};exports[_0xe36e('0x4e')]=function(_0xa4be24,_0x22788b){var _0x935e84;return db[_0xe36e('0x4f')][_0xe36e('0x50')](function(_0x55d190){return db[_0xe36e('0x30')][_0xe36e('0x4e')](_0xa4be24['body'],{'transaction':_0x55d190})[_0xe36e('0x29')](function(_0x1da952){_0x935e84=_0x1da952[_0xe36e('0x51')]({'plain':!![]});return db[_0xe36e('0x52')][_0xe36e('0x4c')]({'where':{'id':_0x935e84['VoiceExtensionId']},'raw':!![]})['then'](function(_0x56f5b6){return createVoicePrefixExtensions(_0x935e84,_0x56f5b6,_0x55d190);});});})['then'](function(){var _0x47605d=_0xa4be24[_0xe36e('0x53')][_0xe36e('0x51')]({'plain':!![]});if(!_0x47605d)throw new Error(_0xe36e('0x54'));if(_0x47605d[_0xe36e('0x55')]===_0xe36e('0x53')){var _0x7c3766=_0x935e84;return db[_0xe36e('0x56')][_0xe36e('0x4c')]({'where':{'name':'VoicePrefixes','userProfileId':_0x47605d[_0xe36e('0x57')]},'raw':!![]})[_0xe36e('0x29')](function(_0x5a058b){if(_0x5a058b&&_0x5a058b[_0xe36e('0x58')]===0x0){return db[_0xe36e('0x2b')][_0xe36e('0x4e')]({'name':_0x7c3766[_0xe36e('0x2c')],'resourceId':_0x7c3766['id'],'type':_0x5a058b[_0xe36e('0x2c')],'sectionId':_0x5a058b['id']},{})[_0xe36e('0x29')](function(){return _0x935e84;});}else{return _0x935e84;}})[_0xe36e('0x49')](function(_0x1a70d1){logger[_0xe36e('0x59')](_0xe36e('0x5a'),_0x1a70d1);throw _0x1a70d1;});}return _0x935e84;})[_0xe36e('0x29')](respondWithResult(_0x22788b,null))[_0xe36e('0x49')](handleError(_0x22788b,null));};function Extension(_0x389e91,_0x6f979f,_0x3512ec,_0x3e4860){this[_0xe36e('0x5b')]=_0xe36e('0x5c');this[_0xe36e('0x5d')]=_0x389e91;this[_0xe36e('0x5e')]=_0x3512ec;this[_0xe36e('0x33')]=_0xe36e('0x5f');this[_0xe36e('0x60')]=_0xe36e('0x61');this[_0xe36e('0x62')]=_0x6f979f;this['appdata']=_0x3e4860;}function createVoicePrefixExtensions(_0x429a01,_0xedaa96,_0x49336b){return new BPromise(function(_0xce5583,_0x41bad0){var _0x180dc3=new Extension(formatPrefixName(_0x429a01[_0xe36e('0x63')]),0x1,_0xe36e('0x64'),_0xe36e('0x65'));_0x180dc3['VoicePrefixId']=_0x429a01['id'];return db[_0xe36e('0x52')]['create'](_0x180dc3,{'transaction':_0x49336b})[_0xe36e('0x29')](function(_0x1fc1e5){var _0x2b0059=_0x1fc1e5[_0xe36e('0x51')]({'plain':!![]});var _0x2a767d=_[_0xe36e('0x2f')](addVoicePrefixExtensions(_0x429a01,_0xedaa96),function(_0x2ab6aa){_0x2ab6aa[_0xe36e('0x66')]=_0x2b0059['id'];_0x2ab6aa['VoicePrefixId']=_0x429a01['id'];return _0x2ab6aa;});return db[_0xe36e('0x52')][_0xe36e('0x67')](_0x2a767d,{'transaction':_0x49336b})['then'](function(_0x3068e1){if(!_0x3068e1){return _0x41bad0(_0xe36e('0x68'));}else{return _0xce5583(_0x3068e1);}})[_0xe36e('0x49')](function(_0x1e8943){return _0x41bad0(_0x1e8943);});});;});};function addVoicePrefixExtensions(_0x30786a,_0x3565cb){var _0x3d4874=[];var _0x48ff05=formatPrefixName(_0x30786a[_0xe36e('0x63')]);_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x2,_0xe36e('0x6a'),_0xe36e('0x6b')+_0x30786a[_0xe36e('0x2c')]));if(_0x30786a[_0xe36e('0x6c')]){_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x3,_0xe36e('0x6a'),_0xe36e('0x6d')+_0x30786a[_0xe36e('0x6c')]));}else{_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x3,'NoOp',_0xe36e('0x6e')));}_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x4,_0xe36e('0x6f'),_0x3565cb[_0xe36e('0x5b')]+','+'${EXTEN:'+(0x8+_0x30786a['name'][_0xe36e('0x3b')])+'}'+','+0x1));return _0x3d4874;}function formatPrefixName(_0x55911b){var _0x585bd5='_';for(var _0x59c454=0x0;_0x59c454<_0x55911b[_0xe36e('0x3b')];_0x59c454++){if(_0x55911b['charAt'](_0x59c454)=='-'){_0x585bd5+=_0x55911b[_0xe36e('0x70')](_0x59c454);}else{_0x585bd5+='['+_0x55911b[_0xe36e('0x70')](_0x59c454)+']';}}_0x585bd5+='.';return _0x585bd5;}exports[_0xe36e('0x28')]=function(_0x221a90,_0x1bd60d,_0x46f789){var _0x11e610=_0x221a90[_0xe36e('0x71')];_0x11e610[_0xe36e('0x63')]='system-'+_0x11e610[_0xe36e('0x2c')]+'-';return db['sequelize'][_0xe36e('0x50')](function(_0x517c2a){return db[_0xe36e('0x30')][_0xe36e('0x28')](_0x11e610,{'where':{'id':_0x11e610['id']},'transaction':_0x517c2a})[_0xe36e('0x29')](function(){return db[_0xe36e('0x52')]['destroy']({'where':{'VoicePrefixId':_0x11e610['id']},'transaction':_0x517c2a})['then'](function(){return db[_0xe36e('0x52')][_0xe36e('0x4c')]({'where':{'id':_0x11e610[_0xe36e('0x66')]},'raw':!![]})[_0xe36e('0x29')](function(_0x3be728){return createVoicePrefixExtensions(_0x11e610,_0x3be728,_0x517c2a);});});});})[_0xe36e('0x29')](function(){return db['VoicePrefix'][_0xe36e('0x72')](_0x11e610['id']);})[_0xe36e('0x29')](respondWithResult(_0x1bd60d,null))['catch'](handleError(_0x1bd60d,null));};exports[_0xe36e('0x73')]=function(_0x5eea4f,_0x45ebca,_0x421c28){return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x5eea4f['params']['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x45ebca,null))['then'](function(_0x49a74b){if(_0x49a74b){return _0x49a74b[_0xe36e('0x73')](_0x5eea4f[_0xe36e('0x71')]['ids'],_['omit'](_0x5eea4f[_0xe36e('0x71')],['ids','id'])||{})[_0xe36e('0x74')](function(_0x36ddc0){for(var _0x2c0ed5=0x0;_0x2c0ed5<_0x5eea4f[_0xe36e('0x71')][_0xe36e('0x75')][_0xe36e('0x3b')];_0x2c0ed5+=0x1){socket['emit'](_0xe36e('0x76'),{'UserId':Number(_0x5eea4f[_0xe36e('0x71')][_0xe36e('0x75')][_0x2c0ed5]),'VoicePrefixId':Number(_0x5eea4f[_0xe36e('0x4b')]['id'])});}return _0x36ddc0;});}})['then'](respondWithResult(_0x45ebca,null))[_0xe36e('0x49')](handleError(_0x45ebca,null));};exports[_0xe36e('0x77')]=function(_0x2eef73,_0x39c9fe,_0x5ee201){return db[_0xe36e('0x30')]['find']({'where':{'id':_0x2eef73[_0xe36e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x39c9fe,null))[_0xe36e('0x29')](function(_0x522968){if(_0x522968){return _0x522968['removeAgents'](_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')])[_0xe36e('0x29')](function(){if(_['isArray'](_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')])){for(var _0x48e4f5=0x0;_0x48e4f5<_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')][_0xe36e('0x3b')];_0x48e4f5+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')][_0x48e4f5]),'VoicePrefixId':Number(_0x2eef73[_0xe36e('0x4b')]['id'])});}}else{socket[_0xe36e('0x78')](_0xe36e('0x79'),{'UserId':Number(_0x2eef73['query'][_0xe36e('0x75')]),'VoicePrefixId':Number(_0x2eef73[_0xe36e('0x4b')]['id'])});}});}})[_0xe36e('0x29')](respondWithStatusCode(_0x39c9fe,null))[_0xe36e('0x49')](handleError(_0x39c9fe,null));};exports[_0xe36e('0x7a')]=function(_0x5bdeea,_0x3712f6,_0x24fcf8){var _0x188dc9={};var _0x493d0f={};var _0x25e4eb;var _0x499f0a;return db[_0xe36e('0x30')]['findOne']({'where':{'id':_0x5bdeea[_0xe36e('0x4b')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x3712f6,null))['then'](function(_0x463355){if(_0x463355){_0x25e4eb=_0x463355;_0x493d0f['model']=_[_0xe36e('0x36')](db[_0xe36e('0x7b')][_0xe36e('0x31')]);_0x493d0f[_0xe36e('0x38')]=_[_0xe36e('0x36')](_0x5bdeea['query']);_0x493d0f[_0xe36e('0x40')]=_['intersection'](_0x493d0f[_0xe36e('0x35')],_0x493d0f[_0xe36e('0x38')]);_0x188dc9[_0xe36e('0x39')]=_[_0xe36e('0x37')](_0x493d0f[_0xe36e('0x35')],qs[_0xe36e('0x3a')](_0x5bdeea['query'][_0xe36e('0x3a')]));_0x188dc9[_0xe36e('0x39')]=_0x188dc9[_0xe36e('0x39')]['length']?_0x188dc9[_0xe36e('0x39')]:_0x493d0f[_0xe36e('0x35')];_0x188dc9[_0xe36e('0x3d')]=qs[_0xe36e('0x3e')](_0x5bdeea['query'][_0xe36e('0x3e')]);_0x188dc9['where']=qs[_0xe36e('0x40')](_['pick'](_0x5bdeea[_0xe36e('0x38')],_0x493d0f[_0xe36e('0x40')]));if(_0x5bdeea[_0xe36e('0x38')]['filter']){_0x188dc9[_0xe36e('0x3f')]=_[_0xe36e('0x43')](_0x188dc9['where'],{'$or':_[_0xe36e('0x2f')](_0x188dc9[_0xe36e('0x39')],function(_0x1f4dd2){var _0x531eac={};_0x531eac[_0x1f4dd2]={'$like':'%'+_0x5bdeea['query'][_0xe36e('0x42')]+'%'};return _0x531eac;})});}_0x188dc9=_[_0xe36e('0x43')]({},_0x188dc9,_0x5bdeea[_0xe36e('0x45')]);return _0x25e4eb[_0xe36e('0x7a')](_0x188dc9);}})[_0xe36e('0x29')](function(_0x5e62f1){if(_0x5e62f1){_0x499f0a=_0x5e62f1[_0xe36e('0x3b')];if(!_0x5bdeea[_0xe36e('0x38')][_0xe36e('0x3c')](_0xe36e('0x7c'))){_0x188dc9['limit']=qs[_0xe36e('0x23')](_0x5bdeea[_0xe36e('0x38')]['limit']);_0x188dc9['offset']=qs['offset'](_0x5bdeea[_0xe36e('0x38')]['offset']);}return _0x25e4eb['getAgents'](_0x188dc9);}})[_0xe36e('0x29')](function(_0x96f37a){if(_0x96f37a){return _0x96f37a?{'count':_0x499f0a,'rows':_0x96f37a}:null;}})[_0xe36e('0x29')](respondWithResult(_0x3712f6,null))[_0xe36e('0x49')](handleError(_0x3712f6,null));};exports[_0xe36e('0x7d')]=function(_0x378126,_0x48fbed,_0x2ebe8e){var _0x4f9354={};var _0x493692={};var _0x4451ec;var _0x21644d;return db[_0xe36e('0x30')][_0xe36e('0x7e')]({'where':{'id':_0x378126['params']['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x48fbed,null))[_0xe36e('0x29')](function(_0x23e62d){if(_0x23e62d){_0x4451ec=_0x23e62d;_0x493692[_0xe36e('0x35')]=_['keys'](db[_0xe36e('0x7f')]['rawAttributes']);_0x493692[_0xe36e('0x38')]=_[_0xe36e('0x36')](_0x378126[_0xe36e('0x38')]);_0x493692[_0xe36e('0x40')]=_[_0xe36e('0x37')](_0x493692['model'],_0x493692[_0xe36e('0x38')]);_0x4f9354[_0xe36e('0x39')]=_[_0xe36e('0x37')](_0x493692[_0xe36e('0x35')],qs[_0xe36e('0x3a')](_0x378126[_0xe36e('0x38')][_0xe36e('0x3a')]));_0x4f9354[_0xe36e('0x39')]=_0x4f9354[_0xe36e('0x39')][_0xe36e('0x3b')]?_0x4f9354[_0xe36e('0x39')]:_0x493692[_0xe36e('0x35')];_0x4f9354[_0xe36e('0x3d')]=qs['sort'](_0x378126['query']['sort']);_0x4f9354[_0xe36e('0x3f')]=qs[_0xe36e('0x40')](_[_0xe36e('0x41')](_0x378126[_0xe36e('0x38')],_0x493692['filters']));if(_0x378126[_0xe36e('0x38')][_0xe36e('0x42')]){_0x4f9354[_0xe36e('0x3f')]=_[_0xe36e('0x43')](_0x4f9354['where'],{'$or':_[_0xe36e('0x2f')](_0x4f9354[_0xe36e('0x39')],function(_0xdd1816){var _0x18dd36={};_0x18dd36[_0xdd1816]={'$like':'%'+_0x378126['query']['filter']+'%'};return _0x18dd36;})});}_0x4f9354=_[_0xe36e('0x43')]({},_0x4f9354,_0x378126[_0xe36e('0x45')]);return _0x4451ec['getTeams'](_0x4f9354);}})['then'](function(_0x59bf4d){if(_0x59bf4d){_0x21644d=_0x59bf4d[_0xe36e('0x3b')];if(!_0x378126[_0xe36e('0x38')][_0xe36e('0x3c')]('nolimit')){_0x4f9354[_0xe36e('0x23')]=qs[_0xe36e('0x23')](_0x378126[_0xe36e('0x38')][_0xe36e('0x23')]);_0x4f9354['offset']=qs[_0xe36e('0x22')](_0x378126[_0xe36e('0x38')][_0xe36e('0x22')]);}return _0x4451ec[_0xe36e('0x7d')](_0x4f9354);}})['then'](function(_0x3de53b){if(_0x3de53b){return _0x3de53b?{'count':_0x21644d,'rows':_0x3de53b}:null;}})['then'](respondWithResult(_0x48fbed,null))[_0xe36e('0x49')](handleError(_0x48fbed,null));};exports['addTeams']=function(_0x1c95cd,_0x2b3e81,_0x498822){var _0x2376b2=_0x1c95cd[_0xe36e('0x71')]['ids'];var _0x179b3f;return db[_0xe36e('0x7f')][_0xe36e('0x80')]({'where':{'id':_0x2376b2},'attributes':['id'],'include':[{'model':db[_0xe36e('0x7b')],'as':_0xe36e('0x81'),'attributes':['id',_0xe36e('0x2c'),'online',_0xe36e('0x82'),_0xe36e('0x83')],'raw':!![]}]})['then'](function(_0xda5f86){if(_0xda5f86){_0x179b3f=_0xda5f86;var _0x48e276=_[_0xe36e('0x84')](_0xda5f86,function(_0x7872d5){var _0x2aefd4=_0x7872d5[_0xe36e('0x51')]({'plain':!![]});return _0x2aefd4['Agents'];});return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x1c95cd[_0xe36e('0x4b')]['id']}})[_0xe36e('0x29')](function(_0x43f149){return db['sequelize'][_0xe36e('0x50')](function(_0x25abc5){return _0x43f149['addTeams'](_0x2376b2,{'transaction':_0x25abc5})['then'](function(){return BPromise[_0xe36e('0x85')](_0x179b3f,function(_0x51c98c){return db[_0xe36e('0x86')][_0xe36e('0x87')]({'TeamId':_0x51c98c['id'],'VoicePrefixId':_0x1c95cd[_0xe36e('0x4b')]['id']},{'transaction':_0x25abc5});});})[_0xe36e('0x29')](function(){return BPromise[_0xe36e('0x85')](_0x48e276,function(_0x3bd8e1){return db[_0xe36e('0x88')][_0xe36e('0x89')]({'where':{'UserId':_0x3bd8e1['id'],'VoicePrefixId':_0x1c95cd[_0xe36e('0x4b')]['id']},'transaction':_0x25abc5});});})[_0xe36e('0x29')](function(){_0x48e276['forEach'](function(_0xab0e50){socket['emit'](_0xe36e('0x76'),{'UserId':_0xab0e50['id'],'VoicePrefixId':_0x43f149['id']});});});});});}})[_0xe36e('0x29')](respondWithStatusCode(_0x2b3e81,null))[_0xe36e('0x49')](handleError(_0x2b3e81,null));};exports['removeTeams']=function(_0x3fc054,_0x947053,_0x51c758){return db[_0xe36e('0x7f')]['findAll']({'where':{'id':_0x3fc054[_0xe36e('0x38')][_0xe36e('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe36e('0x7b')],'as':_0xe36e('0x81'),'attributes':['id'],'raw':!![]}]})[_0xe36e('0x29')](handleEntityNotFound(_0x947053,null))[_0xe36e('0x29')](function(_0x257b00){var _0x2056ed=_[_0xe36e('0x2f')](_0x257b00,'id');var _0x31ae71=[];var _0x166c22=[];var _0x47b082=squel['select']();_0x47b082[_0xe36e('0x8a')](_0xe36e('0x8b'))[_0xe36e('0x8c')](_0xe36e('0x8d'),'tq')['join'](_0xe36e('0x8e'),'ut',_0xe36e('0x8f'))['where'](_0xe36e('0x90'),_0x3fc054['params']['id']);for(var _0x260fff=0x0;_0x260fff<_0x257b00[_0xe36e('0x3b')];_0x260fff+=0x1){let _0x27d09b=_0x257b00[_0x260fff];for(var _0x5bc8b1=0x0;_0x5bc8b1<_0x27d09b[_0xe36e('0x81')][_0xe36e('0x3b')];_0x5bc8b1+=0x1){let _0x2e0e12=_0x27d09b[_0xe36e('0x81')][_0x5bc8b1];var _0x7a5d80=_0x47b082[_0xe36e('0x91')]();_0x7a5d80[_0xe36e('0x3f')]('ut.UserId\x20=\x20?',_0x2e0e12['id']);_0x166c22[_0xe36e('0x69')](db[_0xe36e('0x4f')][_0xe36e('0x38')](_0x7a5d80[_0xe36e('0x92')](),{'type':db[_0xe36e('0x4f')][_0xe36e('0x93')][_0xe36e('0x94')]})[_0xe36e('0x29')](function(_0xacc91e){if(_0xacc91e['length']===0x1){return _0x2e0e12['id'];}else{var _0x3e0dc9=_[_0xe36e('0x95')](_['map'](_0xacc91e,'TeamId'),function(_0x546461){return _[_0xe36e('0x96')](_0x2056ed,_0x546461);});if(_0x3e0dc9){return _0x2e0e12['id'];}}}));}}return BPromise[_0xe36e('0x97')](_0x166c22)['then'](function(_0x20208c){_0x31ae71=_(_0x31ae71)['union'](_0x20208c)['compact']()['value']();return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x3fc054['params']['id']}})[_0xe36e('0x29')](function(_0x2c9191){return db['sequelize'][_0xe36e('0x50')](function(_0x15b38e){return _0x2c9191['removeTeams'](_0x3fc054[_0xe36e('0x38')][_0xe36e('0x75')],{'transaction':_0x15b38e})['then'](function(){if(!_['isEmpty'](_0x31ae71)){return _0x2c9191[_0xe36e('0x77')](_0x31ae71,{'transaction':_0x15b38e});}})[_0xe36e('0x29')](function(){_0x31ae71[_0xe36e('0x98')](function(_0x3c7778){socket[_0xe36e('0x78')](_0xe36e('0x79'),{'UserId':_0x3c7778,'VoicePrefixId':_0x2c9191['id']});});});});});});})[_0xe36e('0x29')](respondWithStatusCode(_0x947053,null))[_0xe36e('0x49')](handleError(_0x947053,null));}; \ No newline at end of file +var _0x1775=['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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','includeAll','include','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','appdata','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','transaction','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','User','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x49a5ad,_0x54d71f){var _0x3cc821=function(_0x35a27a){while(--_0x35a27a){_0x49a5ad['push'](_0x49a5ad['shift']());}};_0x3cc821(++_0x54d71f);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];config[_0x5177('0x1c')]=_[_0x5177('0x1d')](config[_0x5177('0x1c')],{'host':_0x5177('0x1e'),'port':0x18eb});var socket=require(_0x5177('0x1f'))(new Redis(config[_0x5177('0x1c')]));require(_0x5177('0x20'))[_0x5177('0x21')](socket);function respondWithStatusCode(_0x41bef4,_0x2bf5bb){_0x2bf5bb=_0x2bf5bb||0xcc;return function(_0x29cd2c){if(_0x29cd2c){return _0x41bef4[_0x5177('0x22')](_0x2bf5bb);}return _0x41bef4[_0x5177('0x23')](_0x2bf5bb)[_0x5177('0x24')]();};}function respondWithResult(_0x2ab5e5,_0x7dba6f){_0x7dba6f=_0x7dba6f||0xc8;return function(_0xe6dcf6){if(_0xe6dcf6){return _0x2ab5e5['status'](_0x7dba6f)[_0x5177('0x25')](_0xe6dcf6);}};}function respondWithFilteredResult(_0x41e687,_0x3f5ab5){return function(_0x1b4102){if(_0x1b4102){var _0x5f5bd4=typeof _0x3f5ab5[_0x5177('0x26')]===_0x5177('0x27')&&typeof _0x3f5ab5[_0x5177('0x28')]==='undefined';var _0x86f5f8=_0x1b4102['count'];var _0xc2b2b5=_0x5f5bd4?0x0:_0x3f5ab5[_0x5177('0x26')];var _0x219744=_0x5f5bd4?_0x1b4102[_0x5177('0x29')]:_0x3f5ab5[_0x5177('0x26')]+_0x3f5ab5[_0x5177('0x28')];var _0x174c4f;if(_0x219744>=_0x86f5f8){_0x219744=_0x86f5f8;_0x174c4f=0xc8;}else{_0x174c4f=0xce;}_0x41e687[_0x5177('0x23')](_0x174c4f);return _0x41e687[_0x5177('0x2a')](_0x5177('0x2b'),_0xc2b2b5+'-'+_0x219744+'/'+_0x86f5f8)[_0x5177('0x25')](_0x1b4102);}return null;};}function patchUpdates(_0x3b0c37){return function(_0x5d9a9c){try{jsonpatch[_0x5177('0x2c')](_0x5d9a9c,_0x3b0c37,!![]);}catch(_0x556f96){return BPromise[_0x5177('0x2d')](_0x556f96);}return _0x5d9a9c[_0x5177('0x2e')]();};}function saveUpdates(_0x3b39b5,_0x2d51d0){return function(_0x4bc8e2){if(_0x4bc8e2){return _0x4bc8e2[_0x5177('0x2f')](_0x3b39b5)['then'](function(_0x564139){return _0x564139;});}return null;};}function removeEntity(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(_0x577bf7){return _0x577bf7[_0x5177('0x30')]()['then'](function(){var _0x231d35=_0x577bf7[_0x5177('0x31')]({'plain':!![]});var _0x58846c=_0x5177('0x32');return db[_0x5177('0x33')][_0x5177('0x30')]({'where':{'type':_0x58846c,'resourceId':_0x231d35['id']}})[_0x5177('0x34')](function(){return _0x577bf7;});})[_0x5177('0x34')](function(){_0x19a0c2[_0x5177('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498fcd,_0x45cf20){return function(_0x1c660e){if(!_0x1c660e){_0x498fcd[_0x5177('0x22')](0x194);}return _0x1c660e;};}function handleError(_0x174f7a,_0x2e1985){_0x2e1985=_0x2e1985||0x1f4;return function(_0x8134f9){logger[_0x5177('0x35')](_0x8134f9[_0x5177('0x36')]);if(_0x8134f9['name']){delete _0x8134f9[_0x5177('0x37')];}_0x174f7a[_0x5177('0x23')](_0x2e1985)['send'](_0x8134f9);};}exports[_0x5177('0x38')]=function(_0x5e4c48,_0x172b36){var _0x1a2c46={},_0x1ba51c={},_0x5e2e5a={'count':0x0,'rows':[]};var _0x4f70df=_[_0x5177('0x39')](db[_0x5177('0x3a')][_0x5177('0x3b')],function(_0x3735e9){return{'name':_0x3735e9[_0x5177('0x3c')],'type':_0x3735e9[_0x5177('0x3d')][_0x5177('0x3e')]};});_0x1ba51c[_0x5177('0x3f')]=_['map'](_0x4f70df,_0x5177('0x37'));_0x1ba51c[_0x5177('0x40')]=_['keys'](_0x5e4c48[_0x5177('0x40')]);_0x1ba51c[_0x5177('0x41')]=_[_0x5177('0x42')](_0x1ba51c[_0x5177('0x3f')],_0x1ba51c[_0x5177('0x40')]);_0x1a2c46[_0x5177('0x43')]=_['intersection'](_0x1ba51c[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x44')]));_0x1a2c46[_0x5177('0x43')]=_0x1a2c46[_0x5177('0x43')][_0x5177('0x45')]?_0x1a2c46['attributes']:_0x1ba51c[_0x5177('0x3f')];if(!_0x5e4c48[_0x5177('0x40')]['hasOwnProperty']('nolimit')){_0x1a2c46[_0x5177('0x28')]=qs[_0x5177('0x28')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x28')]);_0x1a2c46[_0x5177('0x26')]=qs[_0x5177('0x26')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x26')]);}_0x1a2c46[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x5e4c48[_0x5177('0x40')][_0x5177('0x47')]);_0x1a2c46[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x5e4c48[_0x5177('0x40')],_0x1ba51c['filters']),_0x4f70df);if(_0x5e4c48[_0x5177('0x40')]['filter']){_0x1a2c46[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x1a2c46[_0x5177('0x48')],{'$or':_['map'](_0x4f70df,function(_0x56eba4){if(_0x56eba4[_0x5177('0x3d')]!==_0x5177('0x4b')){var _0x1a149b={};_0x1a149b[_0x56eba4[_0x5177('0x37')]]={'$like':'%'+_0x5e4c48[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x1a149b;}})});}_0x1a2c46=_[_0x5177('0x4a')]({},_0x1a2c46,_0x5e4c48[_0x5177('0x4d')]);var _0x4e287e={'where':_0x1a2c46[_0x5177('0x48')]};return db['VoicePrefix']['count'](_0x4e287e)[_0x5177('0x34')](function(_0x17dc98){_0x5e2e5a['count']=_0x17dc98;if(_0x5e4c48[_0x5177('0x40')]['includeAll']){_0x1a2c46['include']=[{'all':!![]}];}return db[_0x5177('0x3a')][_0x5177('0x4e')](_0x1a2c46);})[_0x5177('0x34')](function(_0x3776b8){_0x5e2e5a[_0x5177('0x4f')]=_0x3776b8;return _0x5e2e5a;})[_0x5177('0x34')](respondWithFilteredResult(_0x172b36,_0x1a2c46))[_0x5177('0x50')](handleError(_0x172b36,null));};exports['show']=function(_0x5396cc,_0x12b70){var _0x511dc0={'raw':![],'where':{'id':_0x5396cc[_0x5177('0x51')]['id']}},_0x23be2a={};_0x23be2a[_0x5177('0x3f')]=_[_0x5177('0x52')](db['VoicePrefix'][_0x5177('0x3b')]);_0x23be2a[_0x5177('0x40')]=_[_0x5177('0x52')](_0x5396cc[_0x5177('0x40')]);_0x23be2a[_0x5177('0x41')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],_0x23be2a[_0x5177('0x40')]);_0x511dc0[_0x5177('0x43')]=_[_0x5177('0x42')](_0x23be2a[_0x5177('0x3f')],qs['fields'](_0x5396cc[_0x5177('0x40')]['fields']));_0x511dc0['attributes']=_0x511dc0['attributes'][_0x5177('0x45')]?_0x511dc0[_0x5177('0x43')]:_0x23be2a['model'];if(_0x5396cc[_0x5177('0x40')][_0x5177('0x53')]){_0x511dc0[_0x5177('0x54')]=[{'all':!![]}];}_0x511dc0=_['merge']({},_0x511dc0,_0x5396cc[_0x5177('0x4d')]);return db['VoicePrefix']['find'](_0x511dc0)['then'](handleEntityNotFound(_0x12b70,null))[_0x5177('0x34')](respondWithResult(_0x12b70,null))[_0x5177('0x50')](handleError(_0x12b70,null));};exports[_0x5177('0x30')]=function(_0x5a1f8b,_0x4e53e4){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x5a1f8b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x4e53e4,null))[_0x5177('0x34')](removeEntity(_0x4e53e4,null))[_0x5177('0x50')](handleError(_0x4e53e4,null));};exports[_0x5177('0x55')]=function(_0xa0edd7,_0x26bac0){return db[_0x5177('0x3a')][_0x5177('0x55')]()[_0x5177('0x34')](respondWithResult(_0x26bac0,null))[_0x5177('0x50')](handleError(_0x26bac0,null));};exports[_0x5177('0x56')]=function(_0x422d6c,_0x4c2068){var _0x59376b;return db[_0x5177('0x57')]['transaction'](function(_0x649c6f){return db['VoicePrefix'][_0x5177('0x56')](_0x422d6c[_0x5177('0x58')],{'transaction':_0x649c6f})[_0x5177('0x34')](function(_0x55a0b6){_0x59376b=_0x55a0b6['get']({'plain':!![]});return db[_0x5177('0x59')][_0x5177('0x5a')]({'where':{'id':_0x59376b[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x4a4758){return createVoicePrefixExtensions(_0x59376b,_0x4a4758,_0x649c6f);});});})['then'](function(){var _0x3f0e89=_0x422d6c[_0x5177('0x5c')][_0x5177('0x31')]({'plain':!![]});if(!_0x3f0e89)throw new Error(_0x5177('0x5d'));if(_0x3f0e89['role']===_0x5177('0x5c')){var _0x143aff=_0x59376b;return db[_0x5177('0x5e')]['find']({'where':{'name':_0x5177('0x32'),'userProfileId':_0x3f0e89[_0x5177('0x5f')]},'raw':!![]})[_0x5177('0x34')](function(_0x49e3e3){if(_0x49e3e3&&_0x49e3e3[_0x5177('0x60')]===0x0){return db['UserProfileResource'][_0x5177('0x56')]({'name':_0x143aff[_0x5177('0x37')],'resourceId':_0x143aff['id'],'type':_0x49e3e3[_0x5177('0x37')],'sectionId':_0x49e3e3['id']},{})['then'](function(){return _0x59376b;});}else{return _0x59376b;}})[_0x5177('0x50')](function(_0x161e03){logger[_0x5177('0x35')](_0x5177('0x61'),_0x161e03);throw _0x161e03;});}return _0x59376b;})[_0x5177('0x34')](respondWithResult(_0x4c2068,null))[_0x5177('0x50')](handleError(_0x4c2068,null));};function Extension(_0x37380c,_0x267599,_0x5ceed2,_0x5d96ce){this['context']=_0x5177('0x62');this[_0x5177('0x63')]=_0x37380c;this[_0x5177('0x64')]=_0x5ceed2;this[_0x5177('0x3d')]=_0x5177('0x65');this[_0x5177('0x66')]='Voice\x20Prefix\x20Extension';this['priority']=_0x267599;this[_0x5177('0x67')]=_0x5d96ce;}function createVoicePrefixExtensions(_0x23eb6e,_0x1f294e,_0x336017){return new BPromise(function(_0x123d40,_0x1b1778){var _0x2d1745=new Extension(formatPrefixName(_0x23eb6e[_0x5177('0x68')]),0x1,_0x5177('0x69'),'Voice\x20Prefix');_0x2d1745[_0x5177('0x6a')]=_0x23eb6e['id'];return db[_0x5177('0x59')]['create'](_0x2d1745,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4481b6){var _0x4edebc=_0x4481b6[_0x5177('0x31')]({'plain':!![]});var _0x2f3344=_[_0x5177('0x39')](addVoicePrefixExtensions(_0x23eb6e,_0x1f294e),function(_0x4be4b2){_0x4be4b2[_0x5177('0x5b')]=_0x4edebc['id'];_0x4be4b2[_0x5177('0x6a')]=_0x23eb6e['id'];return _0x4be4b2;});return db['VoiceExtension']['bulkCreate'](_0x2f3344,{'transaction':_0x336017})[_0x5177('0x34')](function(_0x4f76d7){if(!_0x4f76d7){return _0x1b1778(_0x5177('0x6b'));}else{return _0x123d40(_0x4f76d7);}})['catch'](function(_0x2771fa){return _0x1b1778(_0x2771fa);});});;});};function addVoicePrefixExtensions(_0x16f17c,_0x5a8ada){var _0x2af938=[];var _0x3b090d=formatPrefixName(_0x16f17c[_0x5177('0x68')]);_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x2,_0x5177('0x6d'),_0x5177('0x6e')+_0x16f17c[_0x5177('0x37')]));if(_0x16f17c['callerIdAll']){_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'Set','PREFIX-CALLERIDALL='+_0x16f17c[_0x5177('0x6f')]));}else{_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x3,'NoOp',_0x5177('0x70')));}_0x2af938[_0x5177('0x6c')](new Extension(_0x3b090d,0x4,_0x5177('0x71'),_0x5a8ada[_0x5177('0x72')]+','+_0x5177('0x73')+(0x8+_0x16f17c[_0x5177('0x37')][_0x5177('0x45')])+'}'+','+0x1));return _0x2af938;}function formatPrefixName(_0x3b26f4){var _0x478d5e='_';for(var _0x54b28f=0x0;_0x54b28f<_0x3b26f4[_0x5177('0x45')];_0x54b28f++){if(_0x3b26f4[_0x5177('0x74')](_0x54b28f)=='-'){_0x478d5e+=_0x3b26f4[_0x5177('0x74')](_0x54b28f);}else{_0x478d5e+='['+_0x3b26f4[_0x5177('0x74')](_0x54b28f)+']';}}_0x478d5e+='.';return _0x478d5e;}exports[_0x5177('0x2f')]=function(_0x3dd58f,_0x4fc289,_0x3692b2){var _0x397b75=_0x3dd58f[_0x5177('0x58')];_0x397b75[_0x5177('0x68')]='system-'+_0x397b75[_0x5177('0x37')]+'-';return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x22da9d){return db[_0x5177('0x3a')]['update'](_0x397b75,{'where':{'id':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x30')]({'where':{'VoicePrefixId':_0x397b75['id']},'transaction':_0x22da9d})[_0x5177('0x34')](function(){return db['VoiceExtension'][_0x5177('0x5a')]({'where':{'id':_0x397b75[_0x5177('0x5b')]},'raw':!![]})[_0x5177('0x34')](function(_0x44ed82){return createVoicePrefixExtensions(_0x397b75,_0x44ed82,_0x22da9d);});});});})['then'](function(){return db[_0x5177('0x3a')][_0x5177('0x76')](_0x397b75['id']);})[_0x5177('0x34')](respondWithResult(_0x4fc289,null))[_0x5177('0x50')](handleError(_0x4fc289,null));};exports['addAgents']=function(_0x16b85b,_0x17456b,_0x3502dd){return db['VoicePrefix']['find']({'where':{'id':_0x16b85b[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x17456b,null))[_0x5177('0x34')](function(_0x170e25){if(_0x170e25){return _0x170e25[_0x5177('0x77')](_0x16b85b[_0x5177('0x58')][_0x5177('0x78')],_[_0x5177('0x79')](_0x16b85b[_0x5177('0x58')],['ids','id'])||{})['spread'](function(_0x597a84){for(var _0x290315=0x0;_0x290315<_0x16b85b['body'][_0x5177('0x78')][_0x5177('0x45')];_0x290315+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':Number(_0x16b85b[_0x5177('0x58')]['ids'][_0x290315]),'VoicePrefixId':Number(_0x16b85b[_0x5177('0x51')]['id'])});}return _0x597a84;});}})[_0x5177('0x34')](respondWithResult(_0x17456b,null))[_0x5177('0x50')](handleError(_0x17456b,null));};exports['removeAgents']=function(_0x3d845e,_0x484762,_0x3d95df){return db[_0x5177('0x3a')]['find']({'where':{'id':_0x3d845e[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x484762,null))['then'](function(_0x5f0141){if(_0x5f0141){return _0x5f0141[_0x5177('0x7c')](_0x3d845e['query'][_0x5177('0x78')])[_0x5177('0x34')](function(){if(_['isArray'](_0x3d845e[_0x5177('0x40')][_0x5177('0x78')])){for(var _0xcbbb73=0x0;_0xcbbb73<_0x3d845e[_0x5177('0x40')][_0x5177('0x78')][_0x5177('0x45')];_0xcbbb73+=0x1){socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e['query'][_0x5177('0x78')][_0xcbbb73]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}}else{socket[_0x5177('0x7a')](_0x5177('0x7d'),{'UserId':Number(_0x3d845e[_0x5177('0x40')][_0x5177('0x78')]),'VoicePrefixId':Number(_0x3d845e['params']['id'])});}});}})[_0x5177('0x34')](respondWithStatusCode(_0x484762,null))[_0x5177('0x50')](handleError(_0x484762,null));};exports['getAgents']=function(_0x17efe1,_0x30c2dc,_0x523012){var _0x33e1a6={};var _0x5f57bc={};var _0x3f1aad;var _0x558e04;return db['VoicePrefix']['findOne']({'where':{'id':_0x17efe1[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x30c2dc,null))[_0x5177('0x34')](function(_0x516d0b){if(_0x516d0b){_0x3f1aad=_0x516d0b;_0x5f57bc[_0x5177('0x3f')]=_[_0x5177('0x52')](db[_0x5177('0x7e')][_0x5177('0x3b')]);_0x5f57bc[_0x5177('0x40')]=_['keys'](_0x17efe1[_0x5177('0x40')]);_0x5f57bc[_0x5177('0x41')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],_0x5f57bc['query']);_0x33e1a6[_0x5177('0x43')]=_['intersection'](_0x5f57bc[_0x5177('0x3f')],qs[_0x5177('0x44')](_0x17efe1[_0x5177('0x40')][_0x5177('0x44')]));_0x33e1a6[_0x5177('0x43')]=_0x33e1a6[_0x5177('0x43')]['length']?_0x33e1a6['attributes']:_0x5f57bc[_0x5177('0x3f')];_0x33e1a6[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x17efe1['query'][_0x5177('0x47')]);_0x33e1a6[_0x5177('0x48')]=qs['filters'](_[_0x5177('0x49')](_0x17efe1['query'],_0x5f57bc[_0x5177('0x41')]));if(_0x17efe1[_0x5177('0x40')][_0x5177('0x4c')]){_0x33e1a6['where']=_[_0x5177('0x4a')](_0x33e1a6['where'],{'$or':_[_0x5177('0x39')](_0x33e1a6[_0x5177('0x43')],function(_0x5a40f1){var _0x5a8146={};_0x5a8146[_0x5a40f1]={'$like':'%'+_0x17efe1['query'][_0x5177('0x4c')]+'%'};return _0x5a8146;})});}_0x33e1a6=_['merge']({},_0x33e1a6,_0x17efe1[_0x5177('0x4d')]);return _0x3f1aad[_0x5177('0x7f')](_0x33e1a6);}})[_0x5177('0x34')](function(_0x57adf4){if(_0x57adf4){_0x558e04=_0x57adf4['length'];if(!_0x17efe1['query'][_0x5177('0x80')](_0x5177('0x81'))){_0x33e1a6[_0x5177('0x28')]=qs['limit'](_0x17efe1[_0x5177('0x40')][_0x5177('0x28')]);_0x33e1a6['offset']=qs[_0x5177('0x26')](_0x17efe1['query'][_0x5177('0x26')]);}return _0x3f1aad['getAgents'](_0x33e1a6);}})['then'](function(_0x5910a8){if(_0x5910a8){return _0x5910a8?{'count':_0x558e04,'rows':_0x5910a8}:null;}})[_0x5177('0x34')](respondWithResult(_0x30c2dc,null))['catch'](handleError(_0x30c2dc,null));};exports[_0x5177('0x82')]=function(_0x450c61,_0x1d351b,_0x1372ad){var _0x3b4cab={};var _0x197377={};var _0x580d34;var _0x1e76cf;return db[_0x5177('0x3a')]['findOne']({'where':{'id':_0x450c61[_0x5177('0x51')]['id']}})[_0x5177('0x34')](handleEntityNotFound(_0x1d351b,null))[_0x5177('0x34')](function(_0x51f7ce){if(_0x51f7ce){_0x580d34=_0x51f7ce;_0x197377['model']=_['keys'](db[_0x5177('0x83')][_0x5177('0x3b')]);_0x197377[_0x5177('0x40')]=_[_0x5177('0x52')](_0x450c61[_0x5177('0x40')]);_0x197377[_0x5177('0x41')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],_0x197377[_0x5177('0x40')]);_0x3b4cab[_0x5177('0x43')]=_[_0x5177('0x42')](_0x197377[_0x5177('0x3f')],qs['fields'](_0x450c61[_0x5177('0x40')]['fields']));_0x3b4cab[_0x5177('0x43')]=_0x3b4cab[_0x5177('0x43')][_0x5177('0x45')]?_0x3b4cab['attributes']:_0x197377[_0x5177('0x3f')];_0x3b4cab[_0x5177('0x46')]=qs[_0x5177('0x47')](_0x450c61[_0x5177('0x40')][_0x5177('0x47')]);_0x3b4cab[_0x5177('0x48')]=qs[_0x5177('0x41')](_[_0x5177('0x49')](_0x450c61['query'],_0x197377['filters']));if(_0x450c61[_0x5177('0x40')]['filter']){_0x3b4cab[_0x5177('0x48')]=_[_0x5177('0x4a')](_0x3b4cab['where'],{'$or':_[_0x5177('0x39')](_0x3b4cab[_0x5177('0x43')],function(_0x54efd0){var _0x3e8a29={};_0x3e8a29[_0x54efd0]={'$like':'%'+_0x450c61[_0x5177('0x40')][_0x5177('0x4c')]+'%'};return _0x3e8a29;})});}_0x3b4cab=_[_0x5177('0x4a')]({},_0x3b4cab,_0x450c61[_0x5177('0x4d')]);return _0x580d34[_0x5177('0x82')](_0x3b4cab);}})[_0x5177('0x34')](function(_0x7a67fb){if(_0x7a67fb){_0x1e76cf=_0x7a67fb[_0x5177('0x45')];if(!_0x450c61[_0x5177('0x40')][_0x5177('0x80')](_0x5177('0x81'))){_0x3b4cab[_0x5177('0x28')]=qs['limit'](_0x450c61[_0x5177('0x40')][_0x5177('0x28')]);_0x3b4cab[_0x5177('0x26')]=qs['offset'](_0x450c61[_0x5177('0x40')][_0x5177('0x26')]);}return _0x580d34['getTeams'](_0x3b4cab);}})[_0x5177('0x34')](function(_0x5cbc48){if(_0x5cbc48){return _0x5cbc48?{'count':_0x1e76cf,'rows':_0x5cbc48}:null;}})['then'](respondWithResult(_0x1d351b,null))[_0x5177('0x50')](handleError(_0x1d351b,null));};exports[_0x5177('0x84')]=function(_0xd8f8f3,_0x40ded0,_0x356874){var _0x219a7c=_0xd8f8f3['body'][_0x5177('0x78')];var _0xcb831c;return db['Team'][_0x5177('0x4e')]({'where':{'id':_0x219a7c},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id',_0x5177('0x37'),_0x5177('0x86'),_0x5177('0x87'),_0x5177('0x88')],'raw':!![]}]})[_0x5177('0x34')](function(_0x4e60b2){if(_0x4e60b2){_0xcb831c=_0x4e60b2;var _0x193dbf=_['flatMap'](_0x4e60b2,function(_0xecd419){var _0x4970b3=_0xecd419[_0x5177('0x31')]({'plain':!![]});return _0x4970b3[_0x5177('0x85')];});return db[_0x5177('0x3a')][_0x5177('0x5a')]({'where':{'id':_0xd8f8f3['params']['id']}})[_0x5177('0x34')](function(_0x1b7c52){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x4e8c0c){return _0x1b7c52['addTeams'](_0x219a7c,{'transaction':_0x4e8c0c})['then'](function(){return BPromise['each'](_0xcb831c,function(_0xaafc9f){return db['TeamVoicePrefix'][_0x5177('0x89')]({'TeamId':_0xaafc9f['id'],'VoicePrefixId':_0xd8f8f3['params']['id']},{'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){return BPromise['each'](_0x193dbf,function(_0x384af7){return db[_0x5177('0x8a')][_0x5177('0x8b')]({'where':{'UserId':_0x384af7['id'],'VoicePrefixId':_0xd8f8f3[_0x5177('0x51')]['id']},'transaction':_0x4e8c0c});});})[_0x5177('0x34')](function(){_0x193dbf[_0x5177('0x8c')](function(_0x3a9c65){socket[_0x5177('0x7a')](_0x5177('0x7b'),{'UserId':_0x3a9c65['id'],'VoicePrefixId':_0x1b7c52['id']});});});});});}})[_0x5177('0x34')](respondWithStatusCode(_0x40ded0,null))['catch'](handleError(_0x40ded0,null));};exports[_0x5177('0x8d')]=function(_0x13fa90,_0x3475c3,_0x5ed46a){return db[_0x5177('0x83')][_0x5177('0x4e')]({'where':{'id':_0x13fa90[_0x5177('0x40')][_0x5177('0x78')]},'attributes':['id'],'include':[{'model':db[_0x5177('0x7e')],'as':_0x5177('0x85'),'attributes':['id'],'raw':!![]}]})[_0x5177('0x34')](handleEntityNotFound(_0x3475c3,null))[_0x5177('0x34')](function(_0xb8f7de){var _0x1bc4cb=_[_0x5177('0x39')](_0xb8f7de,'id');var _0x4d29b7=[];var _0x1f8c26=[];var _0x365b68=squel[_0x5177('0x8e')]();_0x365b68['field'](_0x5177('0x8f'))[_0x5177('0x90')]('team_has_voice_prefixes','tq')[_0x5177('0x91')](_0x5177('0x92'),'ut',_0x5177('0x93'))['where'](_0x5177('0x94'),_0x13fa90[_0x5177('0x51')]['id']);for(var _0x3b8c79=0x0;_0x3b8c79<_0xb8f7de[_0x5177('0x45')];_0x3b8c79+=0x1){let _0x2a16ed=_0xb8f7de[_0x3b8c79];for(var _0x5d1909=0x0;_0x5d1909<_0x2a16ed['Agents'][_0x5177('0x45')];_0x5d1909+=0x1){let _0x61ead2=_0x2a16ed['Agents'][_0x5d1909];var _0x2ffb25=_0x365b68[_0x5177('0x95')]();_0x2ffb25['where'](_0x5177('0x96'),_0x61ead2['id']);_0x1f8c26[_0x5177('0x6c')](db['sequelize']['query'](_0x2ffb25[_0x5177('0x97')](),{'type':db['sequelize']['QueryTypes'][_0x5177('0x98')]})[_0x5177('0x34')](function(_0x58170f){if(_0x58170f[_0x5177('0x45')]===0x1){return _0x61ead2['id'];}else{var _0xdc5504=_[_0x5177('0x99')](_[_0x5177('0x39')](_0x58170f,_0x5177('0x9a')),function(_0x2fa026){return _['includes'](_0x1bc4cb,_0x2fa026);});if(_0xdc5504){return _0x61ead2['id'];}}}));}}return BPromise[_0x5177('0x9b')](_0x1f8c26)['then'](function(_0x55e914){_0x4d29b7=_(_0x4d29b7)[_0x5177('0x9c')](_0x55e914)[_0x5177('0x9d')]()[_0x5177('0x9e')]();return db['VoicePrefix'][_0x5177('0x5a')]({'where':{'id':_0x13fa90[_0x5177('0x51')]['id']}})[_0x5177('0x34')](function(_0x3873ca){return db[_0x5177('0x57')][_0x5177('0x75')](function(_0x10698d){return _0x3873ca[_0x5177('0x8d')](_0x13fa90[_0x5177('0x40')][_0x5177('0x78')],{'transaction':_0x10698d})[_0x5177('0x34')](function(){if(!_[_0x5177('0x9f')](_0x4d29b7)){return _0x3873ca['removeAgents'](_0x4d29b7,{'transaction':_0x10698d});}})[_0x5177('0x34')](function(){_0x4d29b7[_0x5177('0x8c')](function(_0x38f0f4){socket[_0x5177('0x7a')]('userVoicePrefix:remove',{'UserId':_0x38f0f4,'VoicePrefixId':_0x3873ca['id']});});});});});});})['then'](respondWithStatusCode(_0x3475c3,null))['catch'](handleError(_0x3475c3,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5e7a71a..d473072 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 _0x5b2a=['exports','events','VoicePrefix','update','remove','hasOwnProperty','hook'];(function(_0x48e49a,_0x37a906){var _0x5f4dcd=function(_0x5d14c6){while(--_0x5d14c6){_0x48e49a['push'](_0x48e49a['shift']());}};_0x5f4dcd(++_0x37a906);}(_0x5b2a,0x120));var _0xa5b2=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x5b2a[_0x56916d];return _0x2b7f1f;};'use strict';var EventEmitter=require(_0xa5b2('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xa5b2('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa5b2('0x2'),'afterDestroy':_0xa5b2('0x3')};function emitEvent(_0x7ecb68){return function(_0x20bd79,_0x163d4d,_0x3a421f){VoicePrefixEvents['emit'](_0x7ecb68+':'+_0x20bd79['id'],_0x20bd79);VoicePrefixEvents['emit'](_0x7ecb68,_0x20bd79);_0x3a421f(null);};}for(var e in events){if(events[_0xa5b2('0x4')](e)){var event=events[e];VoicePrefix[_0xa5b2('0x5')](e,emitEvent(event));}}module[_0xa5b2('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0x070e=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit'];(function(_0x25eeb1,_0x3d1055){var _0x3a9f1e=function(_0x5da634){while(--_0x5da634){_0x25eeb1['push'](_0x25eeb1['shift']());}};_0x3a9f1e(++_0x3d1055);}(_0x070e,0x19d));var _0xe070=function(_0x500eeb,_0x500cf0){_0x500eeb=_0x500eeb-0x0;var _0x5c077e=_0x070e[_0x500eeb];return _0x5c077e;};'use strict';var EventEmitter=require(_0xe070('0x0'));var VoicePrefix=require(_0xe070('0x1'))['db'][_0xe070('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe070('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe070('0x4'),'afterDestroy':_0xe070('0x5')};function emitEvent(_0x38e0d8){return function(_0x2ed483,_0x3678c2,_0x4d34f2){VoicePrefixEvents[_0xe070('0x6')](_0x38e0d8+':'+_0x2ed483['id'],_0x2ed483);VoicePrefixEvents[_0xe070('0x6')](_0x38e0d8,_0x2ed483);_0x4d34f2(null);};}for(var e in events){if(events[_0xe070('0x7')](e)){var event=events[e];VoicePrefix[_0xe070('0x8')](e,emitEvent(event));}}module[_0xe070('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index b0ce971..669d09f 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 _0x6042=['exports','VoicePrefix','voice_prefixes','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x12adcb,_0x21cea0){var _0x3115eb=function(_0x5b6997){while(--_0x5b6997){_0x12adcb['push'](_0x12adcb['shift']());}};_0x3115eb(++_0x21cea0);}(_0x6042,0x11b));var _0x2604=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6042[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2604('0x0'));var rp=require(_0x2604('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2604('0x2'));var config=require(_0x2604('0x3'));var attributes=require(_0x2604('0x4'));module[_0x2604('0x5')]=function(_0x1c10d4,_0x18d4d3){return _0x1c10d4['define'](_0x2604('0x6'),attributes,{'tableName':_0x2604('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f0b=['request-promise','path','../../config/environment','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','bluebird'];(function(_0x49bf1c,_0x487b91){var _0x3b3c23=function(_0x2e1679){while(--_0x2e1679){_0x49bf1c['push'](_0x49bf1c['shift']());}};_0x3b3c23(++_0x487b91);}(_0x3f0b,0x1a9));var _0xb3f0=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x3f0b[_0x44268d];return _0x4be92d;};'use strict';var _=require('lodash');var util=require(_0xb3f0('0x0'));var logger=require(_0xb3f0('0x1'))(_0xb3f0('0x2'));var moment=require(_0xb3f0('0x3'));var BPromise=require(_0xb3f0('0x4'));var rp=require(_0xb3f0('0x5'));var fs=require('fs');var path=require(_0xb3f0('0x6'));var rimraf=require('rimraf');var config=require(_0xb3f0('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x170d85,_0x36947b){return _0x170d85['define'](_0xb3f0('0x8'),attributes,{'tableName':_0xb3f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 9f6f34e..6fe17b6 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 _0x44fe=['http','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f1719,_0x482ff3){var _0x22063b=function(_0x2c4fb8){while(--_0x2c4fb8){_0x2f1719['push'](_0x2f1719['shift']());}};_0x22063b(++_0x482ff3);}(_0x44fe,0x16f));var _0xe44f=function(_0x40cb19,_0x5f4b75){_0x40cb19=_0x40cb19-0x0;var _0x1c62ff=_0x44fe[_0x40cb19];return _0x1c62ff;};'use strict';var _=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var moment=require(_0xe44f('0x2'));var BPromise=require(_0xe44f('0x3'));var rs=require(_0xe44f('0x4'));var fs=require('fs');var Redis=require(_0xe44f('0x5'));var db=require(_0xe44f('0x6'))['db'];var utils=require(_0xe44f('0x7'));var logger=require(_0xe44f('0x8'))(_0xe44f('0x9'));var config=require(_0xe44f('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe44f('0xb')]({'port':0x232a});config[_0xe44f('0xc')]=_['defaults'](config[_0xe44f('0xc')],{'host':_0xe44f('0xd'),'port':0x18eb});var socket=require(_0xe44f('0xe'))(new Redis(config[_0xe44f('0xc')]));require(_0xe44f('0xf'))['register'](socket);function respondWithRpcPromise(_0x12bdfb,_0x28ed63,_0x44b180){return new BPromise(function(_0x447184,_0x2d6ec5){return client[_0xe44f('0x10')](_0x12bdfb,_0x44b180)[_0xe44f('0x11')](function(_0xdb9b6c){logger[_0xe44f('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x28ed63,_0xe44f('0x13'));logger[_0xe44f('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x28ed63,_0xe44f('0x13'),JSON[_0xe44f('0x15')](_0xdb9b6c));if(_0xdb9b6c[_0xe44f('0x16')]){if(_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x17')]===0x1f4){logger[_0xe44f('0x16')](_0xe44f('0x18'),_0x28ed63,_0xdb9b6c[_0xe44f('0x16')]['message']);return _0x2d6ec5(_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x19')]);}logger[_0xe44f('0x16')](_0xe44f('0x18'),_0x28ed63,_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x19')]);return _0x447184(_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x19')]);}else{logger[_0xe44f('0x12')](_0xe44f('0x18'),_0x28ed63,_0xe44f('0x13'));_0x447184(_0xdb9b6c[_0xe44f('0x1a')]['message']);}})['catch'](function(_0xf3b4df){logger[_0xe44f('0x16')](_0xe44f('0x18'),_0x28ed63,_0xf3b4df);_0x2d6ec5(_0xf3b4df);});});} \ No newline at end of file +var _0xef96=['defaults','localhost','socket.io-emitter','redis','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http'];(function(_0x58db5e,_0x5c9288){var _0x40cb58=function(_0x24ec56){while(--_0x24ec56){_0x58db5e['push'](_0x58db5e['shift']());}};_0x40cb58(++_0x5c9288);}(_0xef96,0x162));var _0x6ef9=function(_0x48ba23,_0x3db483){_0x48ba23=_0x48ba23-0x0;var _0x4cff29=_0xef96[_0x48ba23];return _0x4cff29;};'use strict';var _=require(_0x6ef9('0x0'));var util=require(_0x6ef9('0x1'));var moment=require(_0x6ef9('0x2'));var BPromise=require(_0x6ef9('0x3'));var rs=require(_0x6ef9('0x4'));var fs=require('fs');var Redis=require(_0x6ef9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ef9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ef9('0x7'));var client=jayson[_0x6ef9('0x8')][_0x6ef9('0x9')]({'port':0x232a});config['redis']=_[_0x6ef9('0xa')](config['redis'],{'host':_0x6ef9('0xb'),'port':0x18eb});var socket=require(_0x6ef9('0xc'))(new Redis(config[_0x6ef9('0xd')]));require('./voicePrefix.socket')[_0x6ef9('0xe')](socket);function respondWithRpcPromise(_0x4ccb23,_0xb9346c,_0x418b1d){return new BPromise(function(_0x46734b,_0x5aee3b){return client[_0x6ef9('0xf')](_0x4ccb23,_0x418b1d)[_0x6ef9('0x10')](function(_0xcee555){logger[_0x6ef9('0x11')]('VoicePrefix,\x20%s,\x20%s',_0xb9346c,_0x6ef9('0x12'));logger[_0x6ef9('0x13')](_0x6ef9('0x14'),_0xb9346c,_0x6ef9('0x12'),JSON[_0x6ef9('0x15')](_0xcee555));if(_0xcee555[_0x6ef9('0x16')]){if(_0xcee555[_0x6ef9('0x16')]['code']===0x1f4){logger[_0x6ef9('0x16')](_0x6ef9('0x17'),_0xb9346c,_0xcee555[_0x6ef9('0x16')][_0x6ef9('0x18')]);return _0x5aee3b(_0xcee555[_0x6ef9('0x16')][_0x6ef9('0x18')]);}logger[_0x6ef9('0x16')](_0x6ef9('0x17'),_0xb9346c,_0xcee555[_0x6ef9('0x16')]['message']);return _0x46734b(_0xcee555[_0x6ef9('0x16')][_0x6ef9('0x18')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0xb9346c,_0x6ef9('0x12'));_0x46734b(_0xcee555['result'][_0x6ef9('0x18')]);}})[_0x6ef9('0x19')](function(_0x9b792d){logger[_0x6ef9('0x16')](_0x6ef9('0x17'),_0xb9346c,_0x9b792d);_0x5aee3b(_0x9b792d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3ecc54e..f7c6aae 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 _0xcb18=['remove','emit','removeListener','register','voicePrefix:'];(function(_0x1ad6da,_0x1cd3aa){var _0x127557=function(_0x28d275){while(--_0x28d275){_0x1ad6da['push'](_0x1ad6da['shift']());}};_0x127557(++_0x1cd3aa);}(_0xcb18,0x159));var _0x8cb1=function(_0x368749,_0x5df9ab){_0x368749=_0x368749-0x0;var _0x88d295=_0xcb18[_0x368749];return _0x88d295;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x8cb1('0x0'),'update'];function createListener(_0x3df352,_0x50513d){return function(_0x5e800d){_0x50513d[_0x8cb1('0x1')](_0x3df352,_0x5e800d);};}function removeListener(_0x87b1d3,_0x15d761){return function(){VoicePrefixEvents[_0x8cb1('0x2')](_0x87b1d3,_0x15d761);};}exports[_0x8cb1('0x3')]=function(_0x503927){for(var _0x355d91=0x0,_0x335e41=events['length'];_0x355d91<_0x335e41;_0x355d91++){var _0x186f71=events[_0x355d91];var _0x510e92=createListener(_0x8cb1('0x4')+_0x186f71,_0x503927);VoicePrefixEvents['on'](_0x186f71,_0x510e92);}}; \ No newline at end of file +var _0x2bb0=['register','length','voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener'];(function(_0x2b4395,_0x1a8855){var _0x1d2df3=function(_0x45acda){while(--_0x45acda){_0x2b4395['push'](_0x2b4395['shift']());}};_0x1d2df3(++_0x1a8855);}(_0x2bb0,0xf3));var _0x02bb=function(_0x5b6396,_0x2400e0){_0x5b6396=_0x5b6396-0x0;var _0x6836ca=_0x2bb0[_0x5b6396];return _0x6836ca;};'use strict';var VoicePrefixEvents=require(_0x02bb('0x0'));var events=[_0x02bb('0x1'),_0x02bb('0x2'),'update'];function createListener(_0xc43ce8,_0x59a1ed){return function(_0x4a22b7){_0x59a1ed[_0x02bb('0x3')](_0xc43ce8,_0x4a22b7);};}function removeListener(_0x500cd1,_0x1dff97){return function(){VoicePrefixEvents[_0x02bb('0x4')](_0x500cd1,_0x1dff97);};}exports[_0x02bb('0x5')]=function(_0x390ff7){for(var _0x43dbb7=0x0,_0x16bb7c=events[_0x02bb('0x6')];_0x43dbb7<_0x16bb7c;_0x43dbb7++){var _0x47d7ae=events[_0x43dbb7];var _0x6d064a=createListener(_0x02bb('0x7')+_0x47d7ae,_0x390ff7);VoicePrefixEvents['on'](_0x47d7ae,_0x6d064a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index eef4817..5a04d08 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(_0x39a1f1,_0x522fd7){var _0xbbbc47=function(_0x173de8){while(--_0x173de8){_0x39a1f1['push'](_0x39a1f1['shift']());}};_0xbbbc47(++_0x522fd7);}(_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/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(_0x16ae34,_0x1dc6d){var _0x184836=function(_0x1e48b7){while(--_0x1e48b7){_0x16ae34['push'](_0x16ae34['shift']());}};_0x184836(++_0x1dc6d);}(_0xb10b,0x12a));var _0xbb10=function(_0x5426d0,_0x4a4f10){_0x5426d0=_0x5426d0-0x0;var _0x37be89=_0xb10b[_0x5426d0];return _0x37be89;};'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 47e4020..7d34b0a 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 _0xde6f=['outbound','STRING','default','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','type','dialMethod','getDataValue','booked','roundrobin','progressive','predictive','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','ENUM','inbound'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde6f,0xcc));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xfde6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x2'),_0xfde6('0x3')),'allowNull':![],'defaultValue':_0xfde6('0x2')},'musiconhold':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':_0xfde6('0x5')},'announce':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xfde6('0x6'),_0xfde6('0x7'),_0xfde6('0x8'),'random',_0xfde6('0x9'),'linear',_0xfde6('0xa'),_0xfde6('0xb')),'allowNull':![],'defaultValue':_0xfde6('0x6'),'set':function(_0x48f07b){this[_0xfde6('0xc')](_0xfde6('0xd'),_0x48f07b?_0x48f07b:_0xfde6('0x9'));},'get':function(){var _0x45648e=this['getDataValue'](_0xfde6('0xe'));var _0x4b7a6e=this['getDataValue'](_0xfde6('0xf'));var _0x36ffe8=this[_0xfde6('0x10')](_0xfde6('0xd'));if(_0x45648e==='inbound'){return _0x36ffe8;}if(_0x4b7a6e==='booked'&&_0x36ffe8===_0xfde6('0x9')||_0x4b7a6e===_0xfde6('0x11')&&_0x36ffe8===_0xfde6('0x12')){return _0x36ffe8;}if(_0x4b7a6e===_0xfde6('0x13')||_0x4b7a6e===_0xfde6('0x14')||_0x4b7a6e==='power'){return _0x36ffe8;}return null;}},'servicelevel':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfde6('0x15')](0xb)},'timeout':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xfde6('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xfde6('0x16'),'no'),'defaultValue':_0xfde6('0x16')},'autopause':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no',_0xfde6('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfde6('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xfde6('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xfde6('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xfde6('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':_0xfde6('0x16')},'announce_holdtime':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xfde6('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfde6('0x4')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfde6('0x4')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xfde6('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0xfde6('0x4')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xfde6('0x18')],'set':function(_0x22f07e){this['setDataValue'](_0xfde6('0x19'),_0x22f07e?_0x22f07e[_0xfde6('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xfde6('0x19'))?this[_0xfde6('0x10')](_0xfde6('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':_0xfde6('0x16'),'set':function(_0x3cebdf){this['setDataValue'](_0xfde6('0x1b'),_0x3cebdf?_0x3cebdf[_0xfde6('0x1a')](','):undefined);},'get':function(){return this[_0xfde6('0x10')]('joinempty')?this[_0xfde6('0x10')](_0xfde6('0x1b'))[_0xfde6('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':'no','set':function(_0x39c389){this['setDataValue'](_0xfde6('0x1d'),_0x39c389?_0x39c389[_0xfde6('0x1a')](','):undefined);},'get':function(){return this[_0xfde6('0x10')](_0xfde6('0x1d'))?this[_0xfde6('0x10')](_0xfde6('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfde6('0x4')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x28bdee){this[_0xfde6('0xc')]('acw',_0x28bdee);if(_0x28bdee){if(this[_0xfde6('0x10')](_0xfde6('0x1e'))<0x2){this[_0xfde6('0xc')](_0xfde6('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':0x0,'comment':_0xfde6('0x20')},'dialMethod':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x21'),'progressive','power',_0xfde6('0x14'),_0xfde6('0x11')),'defaultValue':_0xfde6('0x13'),'comment':_0xfde6('0x22')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xfde6('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xfde6('0x15')](0x4)[_0xfde6('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfde6('0x24')},'dialPowerLevel':{'type':Sequelize[_0xfde6('0x25')](0x2)[_0xfde6('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x26'),_0xfde6('0x27')),'defaultValue':'dropRate','comment':_0xfde6('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xfde6('0x25')](0x2)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfde6('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xfde6('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfde6('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x2a')},'dialQueueOptions':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':_0xfde6('0x2b'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xfde6('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfde6('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfde6('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfde6('0x15')](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfde6('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':_0xfde6('0x31')},'dialPrefix':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x32'),_0xfde6('0x33'),'onlyIfOpen'),'defaultValue':_0xfde6('0x32')},'dialAMDActive':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfde6('0x34')},'dialAMDGreeting':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfde6('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfde6('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfde6('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfde6('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfde6('0x15')](0x5)[_0xfde6('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfde6('0x39')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xfde6('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfde6('0x3a')},'dialRecallInQueue':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':0x0,'comment':_0xfde6('0x3b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xfde6('0x3c'),_0xfde6('0x3d')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xfde6('0x4')],'comment':_0xfde6('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfde6('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfde6('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x40')},'dialDropRetryFrequency':{'type':Sequelize[_0xfde6('0x15')](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfde6('0x41')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x42')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfde6('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':![],'comment':_0xfde6('0x43'),'set':function(_0x4cc9f1){if(!_0x4cc9f1)this[_0xfde6('0xc')](_0xfde6('0x44'),null);this[_0xfde6('0xc')]('mandatoryDisposition',_0x4cc9f1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfde6('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xfde6('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x39d3=['default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','booked','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','inbound'];(function(_0x2d3da5,_0x194cd6){var _0x125e17=function(_0x63b75c){while(--_0x63b75c){_0x2d3da5['push'](_0x2d3da5['shift']());}};_0x125e17(++_0x194cd6);}(_0x39d3,0x1e5));var _0x339d=function(_0x5c139b,_0x109f02){_0x5c139b=_0x5c139b-0x0;var _0x42327a=_0x39d3[_0x5c139b];return _0x42327a;};'use strict';var Sequelize=require(_0x339d('0x0'));module[_0x339d('0x1')]={'name':{'type':Sequelize[_0x339d('0x2')],'allowNull':![],'unique':_0x339d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x339d('0x4')]('inbound',_0x339d('0x5')),'allowNull':![],'defaultValue':_0x339d('0x6')},'musiconhold':{'type':Sequelize[_0x339d('0x2')],'defaultValue':_0x339d('0x7')},'announce':{'type':Sequelize[_0x339d('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x339d('0x4')]('rr',_0x339d('0x8'),_0x339d('0x9'),_0x339d('0xa'),_0x339d('0xb'),_0x339d('0xc'),_0x339d('0xd'),_0x339d('0xe'),_0x339d('0xf')),'allowNull':![],'defaultValue':_0x339d('0x8'),'set':function(_0x45ce4d){this['setDataValue'](_0x339d('0x10'),_0x45ce4d?_0x45ce4d:_0x339d('0xc'));},'get':function(){var _0x263afd=this[_0x339d('0x11')](_0x339d('0x12'));var _0x27e6b5=this[_0x339d('0x11')]('dialMethod');var _0x5e14dd=this['getDataValue'](_0x339d('0x10'));if(_0x263afd===_0x339d('0x6')){return _0x5e14dd;}if(_0x27e6b5===_0x339d('0x13')&&_0x5e14dd==='rrmemory'||_0x27e6b5===_0x339d('0x13')&&_0x5e14dd==='roundrobin'){return _0x5e14dd;}if(_0x27e6b5==='progressive'||_0x27e6b5===_0x339d('0x14')||_0x27e6b5===_0x339d('0x15')){return _0x5e14dd;}return null;}},'servicelevel':{'type':Sequelize[_0x339d('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x339d('0x16')](0xb)},'timeout':{'type':Sequelize[_0x339d('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x339d('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x339d('0x2')]},'weight':{'type':Sequelize[_0x339d('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x17'),'no'),'defaultValue':_0x339d('0x17')},'autopause':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x17'),'no',_0x339d('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x339d('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x339d('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x339d('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x339d('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x339d('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x339d('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x339d('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x339d('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x17'),'no'),'defaultValue':_0x339d('0x17')},'announce_holdtime':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x17'),'no',_0x339d('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x339d('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x339d('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x339d('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x339d('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x339d('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x339d('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x339d('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x339d('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x339d('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x339d('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x339d('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x339d('0x2')]},'queue_quantity1':{'type':Sequelize[_0x339d('0x2')]},'queue_quantity2':{'type':Sequelize[_0x339d('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x339d('0x2')]},'queue_less_than':{'type':Sequelize[_0x339d('0x2')]},'periodic_announce':{'type':Sequelize[_0x339d('0x1a')],'set':function(_0x2bd74c){this[_0x339d('0x1b')](_0x339d('0x1c'),_0x2bd74c?_0x2bd74c[_0x339d('0x1d')](','):[]);},'get':function(){return this[_0x339d('0x11')](_0x339d('0x1c'))?this[_0x339d('0x11')](_0x339d('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x339d('0x2')],'defaultValue':_0x339d('0x17'),'set':function(_0x26c2d0){this[_0x339d('0x1b')](_0x339d('0x1e'),_0x26c2d0?_0x26c2d0[_0x339d('0x1d')](','):undefined);},'get':function(){return this[_0x339d('0x11')](_0x339d('0x1e'))?this[_0x339d('0x11')](_0x339d('0x1e'))[_0x339d('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x339d('0x2')],'defaultValue':'no','set':function(_0x25b2fa){this[_0x339d('0x1b')](_0x339d('0x20'),_0x25b2fa?_0x25b2fa[_0x339d('0x1d')](','):undefined);},'get':function(){return this[_0x339d('0x11')](_0x339d('0x20'))?this[_0x339d('0x11')](_0x339d('0x20'))[_0x339d('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x339d('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x339d('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x339d('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x339d('0x2')]},'acw':{'type':Sequelize[_0x339d('0x21')],'defaultValue':0x0,'set':function(_0x248fb0){this[_0x339d('0x1b')]('acw',_0x248fb0);if(_0x248fb0){if(this[_0x339d('0x11')]('wrapuptime')<0x2){this[_0x339d('0x1b')](_0x339d('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x339d('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x339d('0x21')],'defaultValue':0x0,'comment':_0x339d('0x23')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x339d('0x24'),_0x339d('0x15'),_0x339d('0x14'),_0x339d('0x13')),'defaultValue':'progressive','comment':_0x339d('0x25')},'dialLimitChannel':{'type':Sequelize[_0x339d('0x16')](0x4)[_0x339d('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x339d('0x27')},'dialLimitQueue':{'type':Sequelize[_0x339d('0x16')](0x4)[_0x339d('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x339d('0x28')](0x2)[_0x339d('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x339d('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x2a'),_0x339d('0x2b')),'defaultValue':_0x339d('0x2b'),'comment':_0x339d('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x339d('0x28')](0x2)[_0x339d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x339d('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x339d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x339d('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x339d('0x2')],'defaultValue':_0x339d('0x2f'),'comment':_0x339d('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x339d('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x339d('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x339d('0x16')](0x5)[_0x339d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x339d('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x339d('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x339d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x339d('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0x3,'comment':_0x339d('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x339d('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x339d('0x38')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x339d('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x39'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x339d('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x339d('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x339d('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x339d('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x339d('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x339d('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x339d('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x339d('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x339d('0x3e')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x339d('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x339d('0x16')](0x9)[_0x339d('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x339d('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x339d('0x16')](0x9)[_0x339d('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x339d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x339d('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x339d('0x16')](0x5)[_0x339d('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x339d('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x339d('0x21')],'defaultValue':0x0,'comment':_0x339d('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x339d('0x4')](_0x339d('0x42'),_0x339d('0x43')),'defaultValue':_0x339d('0x42')},'dialQueueProject2':{'type':Sequelize[_0x339d('0x2')],'comment':_0x339d('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x339d('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x339d('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x339d('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x339d('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x339d('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x339d('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x339d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x339d('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x339d('0x16')](0x5)[_0x339d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x339d('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x339d('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x339d('0x16')](0x5)[_0x339d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x339d('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x339d('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x339d('0x16')](0x5)[_0x339d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x339d('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x339d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x339d('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x339d('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x339d('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x339d('0x16')](0x5)[_0x339d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x339d('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x339d('0x4f'),'set':function(_0xb1d004){if(!_0xb1d004)this['setDataValue'](_0x339d('0x50'),null);this[_0x339d('0x1b')](_0x339d('0x51'),_0xb1d004);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x339d('0x16')](0x3)[_0x339d('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x339d('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x339d('0x21')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c15f632..6bf1eb8 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 _0xb5db=['CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','phone','NOW()','scheduledAt','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','CmListId','phone\x20NOT\x20IN\x20(?)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','error','stack','send','index','VoiceQueue','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','VoiceQueues','UserProfileSection','userProfileId','params','getHoppers','findOne','CmHopper','rawAttributes','sort','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','User','Agents','voicePause','interface','flatMap','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','Team','select','field','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','TeamId','all','union','compact','isEmpty','forEach','userVoiceQueue:remove','addAgents','ids','spread','online','removeAgents','isArray','getAgents','getMembers','getLists'];(function(_0x2b37aa,_0x1d40dc){var _0x52b73d=function(_0x5eb623){while(--_0x5eb623){_0x2b37aa['push'](_0x2b37aa['shift']());}};_0x52b73d(++_0x1d40dc);}(_0xb5db,0xd9));var _0xbb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5db[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbb5d('0x0'));var rimraf=require(_0xbb5d('0x1'));var zipdir=require(_0xbb5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb5d('0x3'));var moment=require(_0xbb5d('0x4'));var BPromise=require(_0xbb5d('0x5'));var Mustache=require(_0xbb5d('0x6'));var util=require(_0xbb5d('0x7'));var path=require('path');var sox=require(_0xbb5d('0x8'));var csv=require(_0xbb5d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb5d('0xa'));var _=require('lodash');var squel=require(_0xbb5d('0xb'));var crypto=require('crypto');var jsforce=require(_0xbb5d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbb5d('0x9'));var querystring=require(_0xbb5d('0xd'));var Papa=require(_0xbb5d('0xe'));var Redis=require('ioredis');var authService=require(_0xbb5d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbb5d('0x10'));var hardwareService=require(_0xbb5d('0x11'));var logger=require(_0xbb5d('0x12'))(_0xbb5d('0x13'));var utils=require(_0xbb5d('0x14'));var config=require(_0xbb5d('0x15'));var licenseUtil=require(_0xbb5d('0x16'));var db=require(_0xbb5d('0x17'))['db'];config[_0xbb5d('0x18')]=_[_0xbb5d('0x19')](config[_0xbb5d('0x18')],{'host':_0xbb5d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb5d('0x18')]));require(_0xbb5d('0x1b'))[_0xbb5d('0x1c')](socket);function respondWithStatusCode(_0x4efe98,_0x4b1a8d){_0x4b1a8d=_0x4b1a8d||0xcc;return function(_0x13c9b1){if(_0x13c9b1){return _0x4efe98['sendStatus'](_0x4b1a8d);}return _0x4efe98[_0xbb5d('0x1d')](_0x4b1a8d)[_0xbb5d('0x1e')]();};}function respondWithResult(_0x2f4742,_0x4a8192){_0x4a8192=_0x4a8192||0xc8;return function(_0x5c79b0){if(_0x5c79b0){return _0x2f4742['status'](_0x4a8192)[_0xbb5d('0x1f')](_0x5c79b0);}};}function respondWithFilteredResult(_0x472727,_0x354531){return function(_0x1a7397){if(_0x1a7397){var _0x18f910=typeof _0x354531[_0xbb5d('0x20')]===_0xbb5d('0x21')&&typeof _0x354531['limit']===_0xbb5d('0x21');var _0x5ba641=_0x1a7397[_0xbb5d('0x22')];var _0x1d4090=_0x18f910?0x0:_0x354531[_0xbb5d('0x20')];var _0x4d8085=_0x18f910?_0x1a7397['count']:_0x354531[_0xbb5d('0x20')]+_0x354531[_0xbb5d('0x23')];var _0x1babe7;if(_0x4d8085>=_0x5ba641){_0x4d8085=_0x5ba641;_0x1babe7=0xc8;}else{_0x1babe7=0xce;}_0x472727[_0xbb5d('0x1d')](_0x1babe7);return _0x472727[_0xbb5d('0x24')](_0xbb5d('0x25'),_0x1d4090+'-'+_0x4d8085+'/'+_0x5ba641)[_0xbb5d('0x1f')](_0x1a7397);}return null;};}function patchUpdates(_0x44f29f){return function(_0x1f8633){try{jsonpatch[_0xbb5d('0x26')](_0x1f8633,_0x44f29f,!![]);}catch(_0x32363c){return BPromise[_0xbb5d('0x27')](_0x32363c);}return _0x1f8633[_0xbb5d('0x28')]();};}function saveUpdates(_0x462302,_0x4c9c57){return function(_0x51cc45){if(_0x51cc45){return _0x51cc45[_0xbb5d('0x29')](_0x462302)['then'](function(_0x3c0755){return _0x3c0755;});}return null;};}function removeEntity(_0x113c58,_0x43b22d){return function(_0x26c922){if(_0x26c922){return _0x26c922[_0xbb5d('0x2a')]()['then'](function(){var _0x489fc4=_0x26c922['get']({'plain':!![]});var _0x14ef52=[{'name':'VoiceQueues','value':_0xbb5d('0x2b'),'ignore':![]},{'name':_0xbb5d('0x2c'),'value':'outbound','ignore':![]}];var _0x1b415d=_(_0x14ef52)[_0xbb5d('0x2d')](_0xbb5d('0x2e'))[_0xbb5d('0x2f')](_0xbb5d('0x30'))[_0xbb5d('0x30')]();if(_[_0xbb5d('0x31')](_0x1b415d,_0x489fc4[_0xbb5d('0x32')])){return;}var _0x44ad34=_[_0xbb5d('0x33')](_0x14ef52,[_0xbb5d('0x30'),_0x489fc4[_0xbb5d('0x32')]])[_0xbb5d('0x34')];return db[_0xbb5d('0x35')][_0xbb5d('0x2a')]({'where':{'type':_0x44ad34,'resourceId':_0x489fc4['id']}})[_0xbb5d('0x36')](function(){return _0x26c922;});})[_0xbb5d('0x36')](function(){_0x113c58['status'](0xcc)[_0xbb5d('0x1e')]();});}};}function handleEntityNotFound(_0x1ae590,_0x214714){return function(_0x5a58f9){if(!_0x5a58f9){_0x1ae590['sendStatus'](0x194);}return _0x5a58f9;};}function handleError(_0x1654e1,_0x13abca){_0x13abca=_0x13abca||0x1f4;return function(_0x542e7d){logger[_0xbb5d('0x37')](_0x542e7d[_0xbb5d('0x38')]);if(_0x542e7d[_0xbb5d('0x34')]){delete _0x542e7d[_0xbb5d('0x34')];}_0x1654e1['status'](_0x13abca)[_0xbb5d('0x39')](_0x542e7d);};}exports[_0xbb5d('0x3a')]=function(_0x24727c,_0x2b93bd){var _0x5c12b1={},_0x1951ba={},_0x2b2d56={'count':0x0,'rows':[]};var _0x4d716b=_['map'](db[_0xbb5d('0x3b')]['rawAttributes'],function(_0x44b4ad){return{'name':_0x44b4ad['fieldName'],'type':_0x44b4ad['type'][_0xbb5d('0x3c')]};});_0x1951ba[_0xbb5d('0x3d')]=_[_0xbb5d('0x2f')](_0x4d716b,_0xbb5d('0x34'));_0x1951ba[_0xbb5d('0x3e')]=_['keys'](_0x24727c[_0xbb5d('0x3e')]);_0x1951ba[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x1951ba[_0xbb5d('0x3d')],_0x1951ba[_0xbb5d('0x3e')]);_0x5c12b1[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x1951ba['model'],qs[_0xbb5d('0x42')](_0x24727c[_0xbb5d('0x3e')]['fields']));_0x5c12b1[_0xbb5d('0x41')]=_0x5c12b1[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x5c12b1[_0xbb5d('0x41')]:_0x1951ba[_0xbb5d('0x3d')];if(!_0x24727c[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x5c12b1[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x24727c[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x5c12b1[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x24727c['query'][_0xbb5d('0x20')]);}_0x5c12b1[_0xbb5d('0x46')]=qs['sort'](_0x24727c['query']['sort']);_0x5c12b1[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x24727c[_0xbb5d('0x3e')],_0x1951ba[_0xbb5d('0x3f')]),_0x4d716b);if(_0x24727c['query'][_0xbb5d('0x2d')]){_0x5c12b1[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0x5c12b1[_0xbb5d('0x47')],{'$or':_[_0xbb5d('0x2f')](_0x4d716b,function(_0x113168){if(_0x113168[_0xbb5d('0x32')]!==_0xbb5d('0x4a')){var _0xc01040={};_0xc01040[_0x113168[_0xbb5d('0x34')]]={'$like':'%'+_0x24727c[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0xc01040;}})});}_0x5c12b1=_[_0xbb5d('0x49')]({},_0x5c12b1,_0x24727c[_0xbb5d('0x4b')]);var _0x4f22fd={'where':_0x5c12b1[_0xbb5d('0x47')]};return db[_0xbb5d('0x3b')]['count'](_0x4f22fd)[_0xbb5d('0x36')](function(_0x516dcf){_0x2b2d56['count']=_0x516dcf;if(_0x24727c[_0xbb5d('0x3e')][_0xbb5d('0x4c')]){_0x5c12b1[_0xbb5d('0x4d')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x5c12b1);})['then'](function(_0x1d841e){_0x2b2d56[_0xbb5d('0x4e')]=_0x1d841e;return _0x2b2d56;})[_0xbb5d('0x36')](respondWithFilteredResult(_0x2b93bd,_0x5c12b1))[_0xbb5d('0x4f')](handleError(_0x2b93bd,null));};exports[_0xbb5d('0x50')]=function(_0x16ffa0,_0xc42d62){var _0x51f358={'raw':![],'where':{'id':_0x16ffa0['params']['id']}},_0x2bf48d={};_0x2bf48d[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x3b')]['rawAttributes']);_0x2bf48d['query']=_['keys'](_0x16ffa0[_0xbb5d('0x3e')]);_0x2bf48d[_0xbb5d('0x3f')]=_['intersection'](_0x2bf48d[_0xbb5d('0x3d')],_0x2bf48d[_0xbb5d('0x3e')]);_0x51f358[_0xbb5d('0x41')]=_['intersection'](_0x2bf48d[_0xbb5d('0x3d')],qs['fields'](_0x16ffa0[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x51f358['attributes']=_0x51f358[_0xbb5d('0x41')]['length']?_0x51f358[_0xbb5d('0x41')]:_0x2bf48d['model'];if(_0x16ffa0[_0xbb5d('0x3e')]['includeAll']){_0x51f358['include']=[{'all':!![]}];}_0x51f358=_[_0xbb5d('0x49')]({},_0x51f358,_0x16ffa0['options']);return db[_0xbb5d('0x3b')][_0xbb5d('0x33')](_0x51f358)[_0xbb5d('0x36')](handleEntityNotFound(_0xc42d62,null))[_0xbb5d('0x36')](respondWithResult(_0xc42d62,null))['catch'](handleError(_0xc42d62,null));};exports[_0xbb5d('0x52')]=function(_0x3b2e22,_0x517879){return db[_0xbb5d('0x3b')][_0xbb5d('0x52')](_0x3b2e22[_0xbb5d('0x53')],{})['then'](function(_0x5cb2bc){var _0x3f0d0c=_0x3b2e22[_0xbb5d('0x54')][_0xbb5d('0x55')]({'plain':!![]});if(!_0x3f0d0c)throw new Error(_0xbb5d('0x56'));if(_0x3f0d0c['role']===_0xbb5d('0x54')){var _0x3e68e4=_0x5cb2bc[_0xbb5d('0x55')]({'plain':!![]});var _0x57224d=[{'name':'VoiceQueues','value':_0xbb5d('0x2b')},{'name':_0xbb5d('0x2c'),'value':_0xbb5d('0x57')}];var _0x55de86=_[_0xbb5d('0x33')](_0x57224d,[_0xbb5d('0x30'),_0x3e68e4[_0xbb5d('0x32')]])[_0xbb5d('0x34')];return db['UserProfileSection'][_0xbb5d('0x33')]({'where':{'name':_0x55de86,'userProfileId':_0x3f0d0c['userProfileId']},'raw':!![]})[_0xbb5d('0x36')](function(_0x17c1ba){if(_0x17c1ba&&_0x17c1ba['autoAssociation']===0x0){return db[_0xbb5d('0x35')][_0xbb5d('0x52')]({'name':_0x3e68e4[_0xbb5d('0x34')],'resourceId':_0x3e68e4['id'],'type':_0x17c1ba['name'],'sectionId':_0x17c1ba['id']},{})[_0xbb5d('0x36')](function(){return _0x5cb2bc;});}else{return _0x5cb2bc;}})[_0xbb5d('0x4f')](function(_0x20f4ea){logger[_0xbb5d('0x37')](_0xbb5d('0x58'),_0x20f4ea);throw _0x20f4ea;});}return _0x5cb2bc;})[_0xbb5d('0x36')](respondWithResult(_0x517879,0xc9))[_0xbb5d('0x4f')](handleError(_0x517879,null));};exports['clone']=function(_0x5ba94d,_0x3903eb){var _0xbf433a={'where':{'id':_0x5ba94d['params']['id']}},_0x5de825={};_0x5de825['model']=_[_0xbb5d('0x51')](db[_0xbb5d('0x3b')]['rawAttributes']);_0xbf433a[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x5de825[_0xbb5d('0x3d')],qs['fields'](_0x5ba94d[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0xbf433a[_0xbb5d('0x41')]=_0xbf433a[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0xbf433a['attributes']:_0x5de825[_0xbb5d('0x3d')];if(_0x5ba94d['query'][_0xbb5d('0x4c')]){_0xbf433a[_0xbb5d('0x4d')]=[{'all':!![]}];}_0xbf433a=_[_0xbb5d('0x49')]({},_0xbf433a,_0x5ba94d[_0xbb5d('0x4b')]);return db[_0xbb5d('0x3b')][_0xbb5d('0x33')](_0xbf433a)['then'](handleEntityNotFound(_0x3903eb,null))['then'](function(_0x3fb92f){if(_0x3fb92f){var _0x50a314=_0x3fb92f[_0xbb5d('0x55')]({'plain':!![]});_0x50a314=qs[_0xbb5d('0x59')](_0x50a314,['id',_0xbb5d('0x5a'),_0xbb5d('0x5b')]);_0x5ba94d[_0xbb5d('0x53')]=_['omit'](_0x5ba94d[_0xbb5d('0x53')],['id','createdAt',_0xbb5d('0x5b')]);return db[_0xbb5d('0x3b')][_0xbb5d('0x52')](_['merge'](_0x50a314,_0x5ba94d[_0xbb5d('0x53')]),{'include':_0x5ba94d[_0xbb5d('0x3e')][_0xbb5d('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x26fd23){var _0x5a52ad=_0x5ba94d[_0xbb5d('0x54')][_0xbb5d('0x55')]({'plain':!![]});if(!_0x5a52ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a52ad[_0xbb5d('0x5c')]===_0xbb5d('0x54')){var _0x4c5136=_0x26fd23[_0xbb5d('0x55')]({'plain':!![]});var _0x2c2567=[{'name':_0xbb5d('0x5d'),'value':_0xbb5d('0x2b')},{'name':_0xbb5d('0x2c'),'value':_0xbb5d('0x57')}];var _0x3d368d=_[_0xbb5d('0x33')](_0x2c2567,[_0xbb5d('0x30'),_0x4c5136[_0xbb5d('0x32')]])[_0xbb5d('0x34')];return db[_0xbb5d('0x5e')][_0xbb5d('0x33')]({'where':{'name':_0x3d368d,'userProfileId':_0x5a52ad[_0xbb5d('0x5f')]},'raw':!![]})[_0xbb5d('0x36')](function(_0x26d1e0){if(_0x26d1e0&&_0x26d1e0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4c5136['name'],'resourceId':_0x4c5136['id'],'type':_0x26d1e0[_0xbb5d('0x34')],'sectionId':_0x26d1e0['id']},{})['then'](function(){return _0x26fd23;});}else{return _0x26fd23;}})[_0xbb5d('0x4f')](function(_0x3a4419){logger[_0xbb5d('0x37')](_0xbb5d('0x58'),_0x3a4419);throw _0x3a4419;});}return _0x26fd23;});}})[_0xbb5d('0x36')](respondWithResult(_0x3903eb,0xc9))[_0xbb5d('0x4f')](handleError(_0x3903eb,null));};exports[_0xbb5d('0x29')]=function(_0x5a2ccd,_0x16bf0c){if(_0x5a2ccd['body']['id']){delete _0x5a2ccd[_0xbb5d('0x53')]['id'];}return db[_0xbb5d('0x3b')]['find']({'where':{'id':_0x5a2ccd[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x16bf0c,null))['then'](saveUpdates(_0x5a2ccd[_0xbb5d('0x53')],null))[_0xbb5d('0x36')](respondWithResult(_0x16bf0c,null))[_0xbb5d('0x4f')](handleError(_0x16bf0c,null));};exports[_0xbb5d('0x2a')]=function(_0x504fb5,_0x1f677b){return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x504fb5[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x1f677b,null))[_0xbb5d('0x36')](removeEntity(_0x1f677b,null))[_0xbb5d('0x4f')](handleError(_0x1f677b,null));};exports[_0xbb5d('0x61')]=function(_0x14323c,_0x41a5c9,_0x44d5cf){var _0x38115a={'raw':![],'where':{}};var _0x3ed444={};var _0x41ea0b={'count':0x0,'rows':[]};return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x14323c[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x41a5c9,null))['then'](function(_0x4891d7){if(_0x4891d7){_0x3ed444[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x63')][_0xbb5d('0x64')]);_0x3ed444[_0xbb5d('0x3e')]=_[_0xbb5d('0x51')](_0x14323c[_0xbb5d('0x3e')]);_0x3ed444[_0xbb5d('0x3f')]=_['intersection'](_0x3ed444['model'],_0x3ed444['query']);_0x38115a[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x3ed444[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x14323c[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x38115a['attributes']=_0x38115a[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x38115a[_0xbb5d('0x41')]:_0x3ed444[_0xbb5d('0x3d')];if(!_0x14323c[_0xbb5d('0x3e')]['hasOwnProperty'](_0xbb5d('0x45'))){_0x38115a['limit']=qs['limit'](_0x14323c['query'][_0xbb5d('0x23')]);_0x38115a[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x14323c['query'][_0xbb5d('0x20')]);}_0x38115a[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x14323c[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x38115a[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x14323c[_0xbb5d('0x3e')],_0x3ed444[_0xbb5d('0x3f')]));_0x38115a[_0xbb5d('0x47')][_0xbb5d('0x66')]=_0x4891d7['id'];if(_0x14323c[_0xbb5d('0x3e')]['filter']){_0x38115a[_0xbb5d('0x47')]=_['merge'](_0x38115a['where'],{'$or':_[_0xbb5d('0x2f')](_0x38115a[_0xbb5d('0x41')],function(_0x39c736){var _0x4fdaa1={};_0x4fdaa1[_0x39c736]={'$like':'%'+_0x14323c[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x4fdaa1;})});}_0x38115a=_[_0xbb5d('0x49')]({},_0x38115a,_0x14323c[_0xbb5d('0x4b')]);return db['CmHopper']['count']({'where':_0x38115a[_0xbb5d('0x47')]})[_0xbb5d('0x36')](function(_0x1139dd){_0x41ea0b[_0xbb5d('0x22')]=_0x1139dd;if(_0x14323c[_0xbb5d('0x3e')][_0xbb5d('0x4c')]){_0x38115a[_0xbb5d('0x4d')]=[{'all':!![]}];}return db[_0xbb5d('0x63')][_0xbb5d('0x67')](_0x38115a);})[_0xbb5d('0x36')](function(_0x19146c){_0x41ea0b[_0xbb5d('0x4e')]=_0x19146c;return _0x41ea0b;});}})[_0xbb5d('0x36')](respondWithFilteredResult(_0x41a5c9,_0x38115a))[_0xbb5d('0x4f')](handleError(_0x41a5c9,null));};exports[_0xbb5d('0x68')]=function(_0x252771,_0xdd2920,_0xf3e3c0){var _0x3ba338={'raw':!![],'where':{}};var _0x2b074f={};var _0x4c8479={'count':0x0,'rows':[]};return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x252771[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0xdd2920,null))['then'](function(_0x5e65bb){if(_0x5e65bb){_0x2b074f[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x69')]['rawAttributes']);_0x2b074f['query']=_['keys'](_0x252771[_0xbb5d('0x3e')]);_0x2b074f[_0xbb5d('0x3f')]=_['intersection'](_0x2b074f[_0xbb5d('0x3d')],_0x2b074f[_0xbb5d('0x3e')]);_0x3ba338[_0xbb5d('0x41')]=_['intersection'](_0x2b074f[_0xbb5d('0x3d')],qs['fields'](_0x252771[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x3ba338['attributes']=_0x3ba338[_0xbb5d('0x41')]['length']?_0x3ba338[_0xbb5d('0x41')]:_0x2b074f[_0xbb5d('0x3d')];if(!_0x252771[_0xbb5d('0x3e')]['hasOwnProperty'](_0xbb5d('0x45'))){_0x3ba338[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x252771[_0xbb5d('0x3e')]['limit']);_0x3ba338[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x252771[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}_0x3ba338['order']=qs['sort'](_0x252771['query'][_0xbb5d('0x65')]);_0x3ba338[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x252771[_0xbb5d('0x3e')],_0x2b074f[_0xbb5d('0x3f')]));_0x3ba338['where'][_0xbb5d('0x66')]=_0x5e65bb['id'];if(_0x252771[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x3ba338[_0xbb5d('0x47')]=_['merge'](_0x3ba338['where'],{'$or':_[_0xbb5d('0x2f')](_0x3ba338[_0xbb5d('0x41')],function(_0x15cdb2){var _0x120481={};_0x120481[_0x15cdb2]={'$like':'%'+_0x252771[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x120481;})});}_0x3ba338=_[_0xbb5d('0x49')]({},_0x3ba338,_0x252771[_0xbb5d('0x4b')]);return db['CmHopperHistory'][_0xbb5d('0x22')]({'where':_0x3ba338[_0xbb5d('0x47')]})[_0xbb5d('0x36')](function(_0x1c4448){_0x4c8479[_0xbb5d('0x22')]=_0x1c4448;if(_0x252771[_0xbb5d('0x3e')]['includeAll']){_0x3ba338[_0xbb5d('0x4d')]=[{'all':!![]}];}return db[_0xbb5d('0x69')][_0xbb5d('0x67')](_0x3ba338);})[_0xbb5d('0x36')](function(_0x15cfaf){_0x4c8479[_0xbb5d('0x4e')]=_0x15cfaf;return _0x4c8479;});}})[_0xbb5d('0x36')](respondWithFilteredResult(_0xdd2920,_0x3ba338))[_0xbb5d('0x4f')](handleError(_0xdd2920,null));};exports[_0xbb5d('0x6a')]=function(_0x2eb76c,_0x2764c0,_0x261c83){var _0xd828d9={'raw':!![],'where':{}};var _0x72a81c={};var _0x53eac6={'count':0x0,'rows':[]};return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x2eb76c[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x2764c0,null))['then'](function(_0x4e6c9b){if(_0x4e6c9b){_0x72a81c[_0xbb5d('0x3d')]=_['keys'](db[_0xbb5d('0x6b')][_0xbb5d('0x64')]);_0x72a81c['query']=_[_0xbb5d('0x51')](_0x2eb76c[_0xbb5d('0x3e')]);_0x72a81c[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x72a81c['model'],_0x72a81c[_0xbb5d('0x3e')]);_0xd828d9[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x72a81c[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x2eb76c[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0xd828d9[_0xbb5d('0x41')]=_0xd828d9[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0xd828d9['attributes']:_0x72a81c['model'];if(!_0x2eb76c[_0xbb5d('0x3e')]['hasOwnProperty'](_0xbb5d('0x45'))){_0xd828d9[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x2eb76c['query']['limit']);_0xd828d9[_0xbb5d('0x20')]=qs['offset'](_0x2eb76c[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}_0xd828d9['order']=qs[_0xbb5d('0x65')](_0x2eb76c['query'][_0xbb5d('0x65')]);_0xd828d9[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_['pick'](_0x2eb76c[_0xbb5d('0x3e')],_0x72a81c[_0xbb5d('0x3f')]));_0xd828d9[_0xbb5d('0x47')]['VoiceQueueId']=_0x4e6c9b['id'];if(_0x2eb76c[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0xd828d9[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0xd828d9[_0xbb5d('0x47')],{'$or':_['map'](_0xd828d9[_0xbb5d('0x41')],function(_0x57981e){var _0x1b5c45={};_0x1b5c45[_0x57981e]={'$like':'%'+_0x2eb76c['query']['filter']+'%'};return _0x1b5c45;})});}_0xd828d9=_[_0xbb5d('0x49')]({},_0xd828d9,_0x2eb76c['options']);return db[_0xbb5d('0x6b')]['count']({'where':_0xd828d9[_0xbb5d('0x47')]})['then'](function(_0x269ead){_0x53eac6[_0xbb5d('0x22')]=_0x269ead;if(_0x2eb76c[_0xbb5d('0x3e')][_0xbb5d('0x4c')]){_0xd828d9[_0xbb5d('0x4d')]=[{'all':!![]}];}return db[_0xbb5d('0x6b')][_0xbb5d('0x67')](_0xd828d9);})[_0xbb5d('0x36')](function(_0x33f982){_0x53eac6[_0xbb5d('0x4e')]=_0x33f982;return _0x53eac6;});}})[_0xbb5d('0x36')](respondWithFilteredResult(_0x2764c0,_0xd828d9))['catch'](handleError(_0x2764c0,null));};exports['getHopperBlacks']=function(_0x3c73c8,_0x46060e,_0x16c062){var _0x222801={'raw':!![],'where':{}};var _0x35f350={};var _0x30eb67={'count':0x0,'rows':[]};return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x3c73c8[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x46060e,null))[_0xbb5d('0x36')](function(_0x25dafe){if(_0x25dafe){_0x35f350[_0xbb5d('0x3d')]=_['keys'](db[_0xbb5d('0x6c')][_0xbb5d('0x64')]);_0x35f350[_0xbb5d('0x3e')]=_[_0xbb5d('0x51')](_0x3c73c8['query']);_0x35f350[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x35f350[_0xbb5d('0x3d')],_0x35f350[_0xbb5d('0x3e')]);_0x222801['attributes']=_[_0xbb5d('0x40')](_0x35f350[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x3c73c8[_0xbb5d('0x3e')]['fields']));_0x222801[_0xbb5d('0x41')]=_0x222801[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x222801['attributes']:_0x35f350['model'];if(!_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x222801[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x222801['offset']=qs[_0xbb5d('0x20')](_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}_0x222801[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x222801['where']=qs['filters'](_['pick'](_0x3c73c8['query'],_0x35f350[_0xbb5d('0x3f')]));_0x222801[_0xbb5d('0x47')]['VoiceQueueId']=_0x25dafe['id'];if(_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x222801[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0x222801[_0xbb5d('0x47')],{'$or':_['map'](_0x222801[_0xbb5d('0x41')],function(_0x394917){var _0x36457b={};_0x36457b[_0x394917]={'$like':'%'+_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x36457b;})});}_0x222801=_[_0xbb5d('0x49')]({},_0x222801,_0x3c73c8[_0xbb5d('0x4b')]);return db[_0xbb5d('0x6c')][_0xbb5d('0x22')]({'where':_0x222801['where']})[_0xbb5d('0x36')](function(_0x56bee8){_0x30eb67[_0xbb5d('0x22')]=_0x56bee8;if(_0x3c73c8['query']['includeAll']){_0x222801['include']=[{'all':!![]}];}return db[_0xbb5d('0x6c')][_0xbb5d('0x67')](_0x222801);})[_0xbb5d('0x36')](function(_0x3c0292){_0x30eb67[_0xbb5d('0x4e')]=_0x3c0292;return _0x30eb67;});}})[_0xbb5d('0x36')](respondWithFilteredResult(_0x46060e,_0x222801))['catch'](handleError(_0x46060e,null));};exports[_0xbb5d('0x6d')]=function(_0x4de8e0,_0x895241,_0x3466c8){var _0x5ec189={};var _0x2fa055={};var _0x3fc69d;var _0x58224b;return db[_0xbb5d('0x3b')]['findOne']({'where':{'id':_0x4de8e0[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x895241,null))['then'](function(_0x5416ce){if(_0x5416ce){_0x3fc69d=_0x5416ce;_0x2fa055[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db['Team'][_0xbb5d('0x64')]);_0x2fa055[_0xbb5d('0x3e')]=_[_0xbb5d('0x51')](_0x4de8e0[_0xbb5d('0x3e')]);_0x2fa055[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x2fa055['model'],_0x2fa055[_0xbb5d('0x3e')]);_0x5ec189[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x2fa055['model'],qs[_0xbb5d('0x42')](_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x5ec189[_0xbb5d('0x41')]=_0x5ec189['attributes'][_0xbb5d('0x43')]?_0x5ec189['attributes']:_0x2fa055[_0xbb5d('0x3d')];_0x5ec189[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x5ec189[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x4de8e0[_0xbb5d('0x3e')],_0x2fa055[_0xbb5d('0x3f')]));if(_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x5ec189[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0x5ec189[_0xbb5d('0x47')],{'$or':_['map'](_0x5ec189[_0xbb5d('0x41')],function(_0x163916){var _0x2ca49e={};_0x2ca49e[_0x163916]={'$like':'%'+_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x2ca49e;})});}_0x5ec189=_[_0xbb5d('0x49')]({},_0x5ec189,_0x4de8e0[_0xbb5d('0x4b')]);return _0x3fc69d[_0xbb5d('0x6d')](_0x5ec189);}})[_0xbb5d('0x36')](function(_0x3b134b){if(_0x3b134b){_0x58224b=_0x3b134b[_0xbb5d('0x43')];if(!_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x5ec189[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x4de8e0[_0xbb5d('0x3e')]['limit']);_0x5ec189[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}return _0x3fc69d['getTeams'](_0x5ec189);}})[_0xbb5d('0x36')](function(_0x3c4b6e){if(_0x3c4b6e){return _0x3c4b6e?{'count':_0x58224b,'rows':_0x3c4b6e}:null;}})[_0xbb5d('0x36')](respondWithResult(_0x895241,null))['catch'](handleError(_0x895241,null));};exports[_0xbb5d('0x6e')]=function(_0x358cae,_0x30c2ea,_0x255931){var _0x1aef4e=_0x358cae[_0xbb5d('0x53')][_0xbb5d('0x6f')];var _0xccc6c2=_[_0xbb5d('0x2f')](_0x1aef4e,'id');return db['Team']['findAll']({'where':{'id':_0xccc6c2},'attributes':['id'],'include':[{'model':db[_0xbb5d('0x70')],'as':_0xbb5d('0x71'),'attributes':['id',_0xbb5d('0x34'),'online',_0xbb5d('0x72'),_0xbb5d('0x73')],'raw':!![]}]})['then'](function(_0x5f74d2){if(_0x5f74d2){var _0x490831=_[_0xbb5d('0x74')](_0x5f74d2,function(_0x341841){var _0x5a3516=_0x341841[_0xbb5d('0x55')]({'plain':!![]});_0x5a3516[_0xbb5d('0x71')]['forEach'](function(_0x2d2aec){_0x2d2aec[_0xbb5d('0x75')]=_[_0xbb5d('0x33')](_0x1aef4e,{'id':_0x5a3516['id']})['penalty'];});return _0x5a3516['Agents'];});return db['VoiceQueue'][_0xbb5d('0x33')]({'where':{'id':_0x358cae['params']['id']}})[_0xbb5d('0x36')](function(_0x13bc11){return db['sequelize'][_0xbb5d('0x76')](function(_0x3648e4){return _0x13bc11[_0xbb5d('0x6e')](_0xccc6c2,{'transaction':_0x3648e4})['then'](function(){return BPromise[_0xbb5d('0x77')](_0x1aef4e,function(_0xd31f06){return db[_0xbb5d('0x78')][_0xbb5d('0x79')]({'TeamId':_0xd31f06['id'],'VoiceQueueId':_0x358cae[_0xbb5d('0x60')]['id'],'penalty':_0xd31f06[_0xbb5d('0x75')]},{'transaction':_0x3648e4});});})['then'](function(){return BPromise[_0xbb5d('0x77')](_0x490831,function(_0x47fe84){return db[_0xbb5d('0x7a')][_0xbb5d('0x7b')]({'where':{'UserId':_0x47fe84['id'],'VoiceQueueId':_0x358cae[_0xbb5d('0x60')]['id']},'defaults':{'penalty':_0x47fe84[_0xbb5d('0x75')]},'transaction':_0x3648e4});});})[_0xbb5d('0x36')](function(){return BPromise[_0xbb5d('0x77')](_[_0xbb5d('0x2d')](_0x490831,{'online':!![]}),function(_0x19e899){return db[_0xbb5d('0x7c')][_0xbb5d('0x79')]({'membername':_0x19e899[_0xbb5d('0x34')],'UserId':_0x19e899['id'],'queue_name':_0x13bc11[_0xbb5d('0x34')],'VoiceQueueId':_0x13bc11['id'],'interface':_[_0xbb5d('0x7d')](_0x19e899[_0xbb5d('0x73')])?util[_0xbb5d('0x7e')](_0xbb5d('0x7f'),_0x19e899[_0xbb5d('0x34')]):_0x19e899[_0xbb5d('0x73')],'paused':_0x19e899[_0xbb5d('0x72')]||![],'penalty':_0x19e899['penalty']},{'transaction':_0x3648e4});});})[_0xbb5d('0x36')](function(){_0x490831['forEach'](function(_0x4236e6){socket[_0xbb5d('0x80')](_0xbb5d('0x81'),{'UserId':_0x4236e6['id'],'VoiceQueueId':_0x13bc11['id']});});});});});}})[_0xbb5d('0x36')](respondWithStatusCode(_0x30c2ea,null))['catch'](handleError(_0x30c2ea,null));};exports[_0xbb5d('0x82')]=function(_0x588166,_0x1b4c96,_0x15f1fa){return db[_0xbb5d('0x83')][_0xbb5d('0x67')]({'where':{'id':_0x588166[_0xbb5d('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbb5d('0x36')](handleEntityNotFound(_0x1b4c96,null))['then'](function(_0xd3dfd0){var _0x47b90d=_[_0xbb5d('0x2f')](_0xd3dfd0,'id');var _0x37b2fc=[];var _0x55ac25=[];var _0x15cf6f=squel[_0xbb5d('0x84')]();_0x15cf6f[_0xbb5d('0x85')]('tq.TeamId')['from'](_0xbb5d('0x86'),'tq')[_0xbb5d('0x87')](_0xbb5d('0x88'),'ut',_0xbb5d('0x89'))['where'](_0xbb5d('0x8a'),_0x588166['params']['id']);for(var _0xfb3bf7=0x0;_0xfb3bf7<_0xd3dfd0[_0xbb5d('0x43')];_0xfb3bf7+=0x1){let _0x361ac5=_0xd3dfd0[_0xfb3bf7];for(var _0x5dfeb8=0x0;_0x5dfeb8<_0x361ac5[_0xbb5d('0x71')][_0xbb5d('0x43')];_0x5dfeb8+=0x1){let _0x2fb0fd=_0x361ac5[_0xbb5d('0x71')][_0x5dfeb8];var _0x3a5923=_0x15cf6f[_0xbb5d('0x8b')]();_0x3a5923[_0xbb5d('0x47')](_0xbb5d('0x8c'),_0x2fb0fd['id']);_0x55ac25[_0xbb5d('0x8d')](db[_0xbb5d('0x8e')][_0xbb5d('0x3e')](_0x3a5923['toString'](),{'type':db[_0xbb5d('0x8e')]['QueryTypes']['SELECT']})[_0xbb5d('0x36')](function(_0x22462e){if(_0x22462e[_0xbb5d('0x43')]===0x1){return _0x2fb0fd['id'];}else{var _0x32c3fd=_['every'](_[_0xbb5d('0x2f')](_0x22462e,_0xbb5d('0x8f')),function(_0x4a99c1){return _[_0xbb5d('0x31')](_0x47b90d,_0x4a99c1);});if(_0x32c3fd){return _0x2fb0fd['id'];}}}));}}return BPromise[_0xbb5d('0x90')](_0x55ac25)[_0xbb5d('0x36')](function(_0x13baa8){_0x37b2fc=_(_0x37b2fc)[_0xbb5d('0x91')](_0x13baa8)[_0xbb5d('0x92')]()['value']();return db['VoiceQueue']['find']({'where':{'id':_0x588166[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](function(_0x236d71){return db[_0xbb5d('0x8e')]['transaction'](function(_0x5c2f00){return _0x236d71['removeTeams'](_0x588166[_0xbb5d('0x3e')]['ids'],{'transaction':_0x5c2f00})[_0xbb5d('0x36')](function(){if(!_[_0xbb5d('0x93')](_0x37b2fc)){return _0x236d71['removeAgents'](_0x37b2fc,{'transaction':_0x5c2f00})[_0xbb5d('0x36')](function(){return db[_0xbb5d('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x588166[_0xbb5d('0x60')]['id'],'UserId':_0x37b2fc},'transaction':_0x5c2f00});});}})[_0xbb5d('0x36')](function(){_0x37b2fc[_0xbb5d('0x94')](function(_0x2c9599){socket[_0xbb5d('0x80')](_0xbb5d('0x95'),{'UserId':_0x2c9599,'VoiceQueueId':_0x236d71['id']});});});});});});})[_0xbb5d('0x36')](respondWithStatusCode(_0x1b4c96,null))[_0xbb5d('0x4f')](handleError(_0x1b4c96,null));};exports[_0xbb5d('0x96')]=function(_0x1dff86,_0x18ff44,_0x3a91ab){var _0x854ebc,_0x15de86;return db['VoiceQueue'][_0xbb5d('0x33')]({'where':{'id':_0x1dff86[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x18ff44,null))[_0xbb5d('0x36')](function(_0x278bb8){if(_0x278bb8){_0x15de86=_0x278bb8;return _0x278bb8[_0xbb5d('0x96')](_0x1dff86[_0xbb5d('0x53')]['ids'],_['omit'](_0x1dff86[_0xbb5d('0x53')],[_0xbb5d('0x97'),'id'])||{})[_0xbb5d('0x98')](function(_0x1a01a6){for(var _0x1feb82=0x0;_0x1feb82<_0x1dff86['body']['ids'][_0xbb5d('0x43')];_0x1feb82+=0x1){socket[_0xbb5d('0x80')](_0xbb5d('0x81'),{'UserId':Number(_0x1dff86[_0xbb5d('0x53')][_0xbb5d('0x97')][_0x1feb82]),'VoiceQueueId':Number(_0x1dff86[_0xbb5d('0x60')]['id'])});}return _0x1a01a6;});}})[_0xbb5d('0x36')](function(_0x47b3e4){_0x854ebc=_0x47b3e4||[];if(_0x15de86){return db[_0xbb5d('0x70')][_0xbb5d('0x67')]({'where':{'id':_0x1dff86[_0xbb5d('0x53')][_0xbb5d('0x97')]},'attributes':['id',_0xbb5d('0x34'),'online','voicePause',_0xbb5d('0x73')],'raw':!![]});}})[_0xbb5d('0x36')](function(_0x59f753){if(!_[_0xbb5d('0x93')](_0x59f753)){var _0x3d51b2=[];for(var _0x5cd39f=0x0;_0x5cd39f<_0x59f753[_0xbb5d('0x43')];_0x5cd39f++){if(_0x59f753[_0x5cd39f][_0xbb5d('0x99')]){_0x3d51b2[_0xbb5d('0x8d')](db[_0xbb5d('0x7c')][_0xbb5d('0x79')]({'membername':_0x59f753[_0x5cd39f][_0xbb5d('0x34')],'UserId':_0x59f753[_0x5cd39f]['id'],'queue_name':_0x15de86['name'],'VoiceQueueId':_0x15de86['id'],'interface':_[_0xbb5d('0x7d')](_0x59f753[_0x5cd39f][_0xbb5d('0x73')])?util[_0xbb5d('0x7e')](_0xbb5d('0x7f'),_0x59f753[_0x5cd39f][_0xbb5d('0x34')]):_0x59f753[_0x5cd39f][_0xbb5d('0x73')],'paused':_0x59f753[_0x5cd39f][_0xbb5d('0x72')]||![],'penalty':_0x1dff86[_0xbb5d('0x53')][_0xbb5d('0x75')]||0x0}));}}return BPromise[_0xbb5d('0x90')](_0x3d51b2);}})[_0xbb5d('0x36')](function(){return _0x854ebc;})['then'](respondWithResult(_0x18ff44,null))[_0xbb5d('0x4f')](handleError(_0x18ff44,null));};exports['removeAgents']=function(_0x326a2f,_0x3283d9,_0x5d374e){return db['VoiceQueue'][_0xbb5d('0x33')]({'where':{'id':_0x326a2f[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x3283d9,null))[_0xbb5d('0x36')](function(_0x5dbc2b){if(_0x5dbc2b){return _0x5dbc2b[_0xbb5d('0x9a')](_0x326a2f[_0xbb5d('0x3e')]['ids'])['then'](function(){if(_[_0xbb5d('0x9b')](_0x326a2f[_0xbb5d('0x3e')][_0xbb5d('0x97')])){for(var _0xbcb56f=0x0;_0xbcb56f<_0x326a2f[_0xbb5d('0x3e')][_0xbb5d('0x97')]['length'];_0xbcb56f+=0x1){socket[_0xbb5d('0x80')]('userVoiceQueue:remove',{'UserId':Number(_0x326a2f['query'][_0xbb5d('0x97')][_0xbcb56f]),'VoiceQueueId':Number(_0x326a2f['params']['id'])});}}else{socket[_0xbb5d('0x80')](_0xbb5d('0x95'),{'UserId':Number(_0x326a2f[_0xbb5d('0x3e')][_0xbb5d('0x97')]),'VoiceQueueId':Number(_0x326a2f[_0xbb5d('0x60')]['id'])});}});}})[_0xbb5d('0x36')](function(_0x237f79){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x326a2f[_0xbb5d('0x60')]['id'],'UserId':_0x326a2f[_0xbb5d('0x3e')][_0xbb5d('0x97')]}})[_0xbb5d('0x36')](function(){return _0x237f79;});})['then'](respondWithStatusCode(_0x3283d9,null))['catch'](handleError(_0x3283d9,null));};exports[_0xbb5d('0x9c')]=function(_0x4f644b,_0x26a89e,_0x506527){var _0x4ae518={};var _0x2fd7cd={};var _0x34eb2c;var _0x45d0b7;return db['VoiceQueue'][_0xbb5d('0x62')]({'where':{'id':_0x4f644b[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x26a89e,null))['then'](function(_0x13c845){if(_0x13c845){_0x34eb2c=_0x13c845;_0x2fd7cd[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x70')][_0xbb5d('0x64')]);_0x2fd7cd['query']=_[_0xbb5d('0x51')](_0x4f644b[_0xbb5d('0x3e')]);_0x2fd7cd[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x2fd7cd[_0xbb5d('0x3d')],_0x2fd7cd[_0xbb5d('0x3e')]);_0x4ae518[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x2fd7cd[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x4ae518[_0xbb5d('0x41')]=_0x4ae518[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x4ae518[_0xbb5d('0x41')]:_0x2fd7cd['model'];_0x4ae518[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x4ae518[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x4f644b[_0xbb5d('0x3e')],_0x2fd7cd[_0xbb5d('0x3f')]));if(_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x4ae518['where']=_[_0xbb5d('0x49')](_0x4ae518[_0xbb5d('0x47')],{'$or':_[_0xbb5d('0x2f')](_0x4ae518[_0xbb5d('0x41')],function(_0x5f18a9){var _0x4cc770={};_0x4cc770[_0x5f18a9]={'$like':'%'+_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x4cc770;})});}_0x4ae518=_['merge']({},_0x4ae518,_0x4f644b[_0xbb5d('0x4b')]);return _0x34eb2c[_0xbb5d('0x9c')](_0x4ae518);}})[_0xbb5d('0x36')](function(_0xd5dcb3){if(_0xd5dcb3){_0x45d0b7=_0xd5dcb3['length'];if(!_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x4ae518[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x4ae518[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x4f644b['query'][_0xbb5d('0x20')]);}return _0x34eb2c['getAgents'](_0x4ae518);}})[_0xbb5d('0x36')](function(_0x216a1e){if(_0x216a1e){return _0x216a1e?{'count':_0x45d0b7,'rows':_0x216a1e}:null;}})[_0xbb5d('0x36')](respondWithResult(_0x26a89e,null))[_0xbb5d('0x4f')](handleError(_0x26a89e,null));};exports['getMembers']=function(_0x4bdf99,_0x158ee5,_0x86db83){var _0x19d639={};var _0x5bf0a7={};var _0x1db051;var _0x38d046;return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x4bdf99[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x158ee5,null))[_0xbb5d('0x36')](function(_0xba0b66){if(_0xba0b66){_0x1db051=_0xba0b66;_0x5bf0a7[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x7c')][_0xbb5d('0x64')]);_0x5bf0a7['query']=_[_0xbb5d('0x51')](_0x4bdf99[_0xbb5d('0x3e')]);_0x5bf0a7[_0xbb5d('0x3f')]=_['intersection'](_0x5bf0a7[_0xbb5d('0x3d')],_0x5bf0a7[_0xbb5d('0x3e')]);_0x19d639['attributes']=_['intersection'](_0x5bf0a7[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x4bdf99[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x19d639[_0xbb5d('0x41')]=_0x19d639['attributes'][_0xbb5d('0x43')]?_0x19d639['attributes']:_0x5bf0a7[_0xbb5d('0x3d')];_0x19d639[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x4bdf99[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x19d639[_0xbb5d('0x47')]=qs['filters'](_[_0xbb5d('0x48')](_0x4bdf99[_0xbb5d('0x3e')],_0x5bf0a7['filters']));if(_0x4bdf99[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x19d639[_0xbb5d('0x47')]=_['merge'](_0x19d639[_0xbb5d('0x47')],{'$or':_[_0xbb5d('0x2f')](_0x19d639[_0xbb5d('0x41')],function(_0xba20e){var _0x30c662={};_0x30c662[_0xba20e]={'$like':'%'+_0x4bdf99[_0xbb5d('0x3e')]['filter']+'%'};return _0x30c662;})});}_0x19d639=_[_0xbb5d('0x49')]({},_0x19d639,_0x4bdf99[_0xbb5d('0x4b')]);return _0x1db051[_0xbb5d('0x9d')](_0x19d639);}})[_0xbb5d('0x36')](function(_0x2a4d12){if(_0x2a4d12){_0x38d046=_0x2a4d12[_0xbb5d('0x43')];if(!_0x4bdf99['query'][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x19d639[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x4bdf99[_0xbb5d('0x3e')]['limit']);_0x19d639[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x4bdf99[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}return _0x1db051[_0xbb5d('0x9d')](_0x19d639);}})['then'](function(_0x452a76){return _0x452a76?{'count':_0x38d046,'rows':_0x452a76}:null;})['then'](respondWithResult(_0x158ee5,null))['catch'](handleError(_0x158ee5,null));};exports[_0xbb5d('0x9e')]=function(_0x16b692,_0x4ad940,_0x106dd0){var _0x38693d={};var _0x2aba3a={};var _0x2f460c;var _0x384687;return db['VoiceQueue']['findOne']({'where':{'id':_0x16b692[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x4ad940,null))[_0xbb5d('0x36')](function(_0x2b1109){if(_0x2b1109){_0x2f460c=_0x2b1109;_0x2aba3a[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x9f')][_0xbb5d('0x64')]);_0x2aba3a[_0xbb5d('0x3e')]=_[_0xbb5d('0x51')](_0x16b692[_0xbb5d('0x3e')]);_0x2aba3a[_0xbb5d('0x3f')]=_['intersection'](_0x2aba3a[_0xbb5d('0x3d')],_0x2aba3a[_0xbb5d('0x3e')]);_0x38693d['attributes']=_[_0xbb5d('0x40')](_0x2aba3a[_0xbb5d('0x3d')],qs['fields'](_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x38693d[_0xbb5d('0x41')]=_0x38693d[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x38693d[_0xbb5d('0x41')]:_0x2aba3a[_0xbb5d('0x3d')];_0x38693d[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x38693d[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x16b692[_0xbb5d('0x3e')],_0x2aba3a[_0xbb5d('0x3f')]));if(_0x16b692[_0xbb5d('0x3e')]['filter']){_0x38693d[_0xbb5d('0x47')]=_['merge'](_0x38693d[_0xbb5d('0x47')],{'$or':_[_0xbb5d('0x2f')](_0x38693d[_0xbb5d('0x41')],function(_0x8a8767){var _0x365e6d={};_0x365e6d[_0x8a8767]={'$like':'%'+_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x365e6d;})});}_0x38693d=_[_0xbb5d('0x49')]({},_0x38693d,_0x16b692[_0xbb5d('0x4b')]);return _0x2f460c['getLists'](_0x38693d);}})[_0xbb5d('0x36')](function(_0x5c50d6){if(_0x5c50d6){_0x384687=_0x5c50d6['length'];if(!_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x44')]('nolimit')){_0x38693d[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x38693d['offset']=qs[_0xbb5d('0x20')](_0x16b692[_0xbb5d('0x3e')]['offset']);}return _0x2f460c[_0xbb5d('0x9e')](_0x38693d);}})[_0xbb5d('0x36')](function(_0x20cb47){if(_0x20cb47){return _0x20cb47?{'count':_0x384687,'rows':_0x20cb47}:null;}})[_0xbb5d('0x36')](respondWithResult(_0x4ad940,null))[_0xbb5d('0x4f')](handleError(_0x4ad940,null));};exports[_0xbb5d('0xa0')]=function(_0x15a27c,_0x1e4546,_0x2b5b85){var _0x55c5e3,_0x44ab1c;return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x15a27c[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x1e4546,null))[_0xbb5d('0x36')](function(_0x5be6f3){if(_0x5be6f3){_0x44ab1c=_0x5be6f3;return _0x5be6f3['addLists'](_0x15a27c[_0xbb5d('0x53')]['ids'],_[_0xbb5d('0x59')](_0x15a27c[_0xbb5d('0x53')],[_0xbb5d('0x97'),'id'])||{});}return null;})['spread'](function(_0x954e7){var _0x50cbff;_0x55c5e3=_0x954e7||[];var _0x341e6c=[];if(_0x954e7){for(var _0x7250d0=0x0;_0x7250d0<_0x954e7[_0xbb5d('0x43')];_0x7250d0+=0x1){var _0x51d9d9=_0x954e7[_0x7250d0][_0xbb5d('0x55')]({'plain':!![]});_0x44ab1c[_0xbb5d('0xa1')]=_0x15a27c['body'][_0xbb5d('0xa1')]?_0x15a27c['body'][_0xbb5d('0xa1')]:_0x44ab1c[_0xbb5d('0xa1')];switch(_0x44ab1c[_0xbb5d('0xa1')]){case _0xbb5d('0xa2'):_0x50cbff=squel[_0xbb5d('0xa3')]()[_0xbb5d('0xa4')](_0xbb5d('0xa5'))[_0xbb5d('0xa6')](['phone','scheduledAt',_0xbb5d('0xa7'),'ListId','VoiceQueueId',_0xbb5d('0x5a'),_0xbb5d('0x5b')],squel['select']()['field'](_0xbb5d('0xa8'),_0xbb5d('0xa8'))[_0xbb5d('0x85')](_0xbb5d('0xa9'),_0xbb5d('0xaa'))['field']('id',_0xbb5d('0xa7'))[_0xbb5d('0x85')](_0x51d9d9['CmListId'][_0xbb5d('0xab')](),_0xbb5d('0xac'))[_0xbb5d('0x85')](_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')](),'VoiceQueueId')[_0xbb5d('0x85')](_0xbb5d('0xa9'),'createdAt')['field'](_0xbb5d('0xa9'),_0xbb5d('0x5b'))[_0xbb5d('0xad')](_0xbb5d('0xae'))['where'](_0xbb5d('0xaf'))[_0xbb5d('0x47')]('ListId\x20=\x20?',_0x51d9d9['CmListId'][_0xbb5d('0xab')]())[_0xbb5d('0x47')](_0xbb5d('0xb0'))[_0xbb5d('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbb5d('0x84')]()['field'](_0xbb5d('0xb1'))[_0xbb5d('0xad')](_0xbb5d('0xb2'))[_0xbb5d('0x47')]('VoiceQueueId\x20=\x20?',_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xbb5d('0x84')]()['field'](_0xbb5d('0xb3'))[_0xbb5d('0xad')](_0xbb5d('0xa5'))[_0xbb5d('0x47')](_0xbb5d('0x8a'),_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')]())))[_0xbb5d('0xab')]();break;case _0xbb5d('0xb4'):_0x50cbff=squel[_0xbb5d('0xa3')]()[_0xbb5d('0xa4')](_0xbb5d('0xa5'))['fromQuery']([_0xbb5d('0xa8'),_0xbb5d('0xaa'),'ContactId',_0xbb5d('0xac'),'VoiceQueueId','createdAt',_0xbb5d('0x5b')],squel[_0xbb5d('0x84')]()[_0xbb5d('0x85')]('phone',_0xbb5d('0xa8'))[_0xbb5d('0x85')](_0xbb5d('0xa9'),_0xbb5d('0xaa'))['field']('id','ContactId')[_0xbb5d('0x85')](_0x51d9d9[_0xbb5d('0xb5')][_0xbb5d('0xab')](),_0xbb5d('0xac'))[_0xbb5d('0x85')](_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')](),'VoiceQueueId')[_0xbb5d('0x85')](_0xbb5d('0xa9'),_0xbb5d('0x5a'))['field'](_0xbb5d('0xa9'),'updatedAt')[_0xbb5d('0xad')](_0xbb5d('0xae'))[_0xbb5d('0x47')](_0xbb5d('0xaf'))['where']('ListId\x20=\x20?',_0x51d9d9[_0xbb5d('0xb5')][_0xbb5d('0xab')]())[_0xbb5d('0x47')](_0xbb5d('0xb0'))[_0xbb5d('0x47')](_0xbb5d('0xb6'),squel[_0xbb5d('0x84')]()['field'](_0xbb5d('0xb3'))[_0xbb5d('0xad')](_0xbb5d('0xa5'))[_0xbb5d('0x47')]('VoiceQueueId\x20=\x20?',_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')]())))[_0xbb5d('0xab')]();break;default:_0x50cbff=squel[_0xbb5d('0xa3')]()[_0xbb5d('0xa4')](_0xbb5d('0xa5'))[_0xbb5d('0xa6')]([_0xbb5d('0xa8'),_0xbb5d('0xaa'),_0xbb5d('0xa7'),'ListId','VoiceQueueId',_0xbb5d('0x5a'),_0xbb5d('0x5b')],squel[_0xbb5d('0x84')]()[_0xbb5d('0x85')](_0xbb5d('0xa8'),_0xbb5d('0xa8'))[_0xbb5d('0x85')](_0xbb5d('0xa9'),'scheduledAt')[_0xbb5d('0x85')]('id',_0xbb5d('0xa7'))[_0xbb5d('0x85')](_0x51d9d9[_0xbb5d('0xb5')][_0xbb5d('0xab')](),_0xbb5d('0xac'))['field'](_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')](),_0xbb5d('0x66'))[_0xbb5d('0x85')]('NOW()','createdAt')[_0xbb5d('0x85')]('NOW()',_0xbb5d('0x5b'))[_0xbb5d('0xad')](_0xbb5d('0xae'))[_0xbb5d('0x47')](_0xbb5d('0xaf'))[_0xbb5d('0x47')]('ListId\x20=\x20?',_0x51d9d9[_0xbb5d('0xb5')]['toString']())[_0xbb5d('0x47')](_0xbb5d('0xb0')))[_0xbb5d('0xab')]();}_0x341e6c[_0xbb5d('0x8d')](db[_0xbb5d('0x8e')][_0xbb5d('0x3e')](_0x50cbff));}return BPromise[_0xbb5d('0x90')](_0x341e6c);}})[_0xbb5d('0x36')](function(){return _0x55c5e3;})[_0xbb5d('0x36')](respondWithResult(_0x1e4546,null))[_0xbb5d('0x4f')](handleError(_0x1e4546,null));};exports[_0xbb5d('0xb7')]=function(_0x11bf27,_0x1785a7,_0xe73259){return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x11bf27['params']['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x1785a7,null))[_0xbb5d('0x36')](function(_0x47ec60){if(_0x47ec60){return _0x47ec60[_0xbb5d('0xb7')](_0x11bf27[_0xbb5d('0x3e')][_0xbb5d('0x97')]);}})['then'](function(_0x2d36cc){if(_0x2d36cc){return db[_0xbb5d('0x63')]['destroy']({'where':{'ListId':_0x11bf27[_0xbb5d('0x3e')][_0xbb5d('0x97')],'VoiceQueueId':_0x11bf27[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](function(){return _0x2d36cc;});}})[_0xbb5d('0x36')](respondWithStatusCode(_0x1785a7,null))[_0xbb5d('0x4f')](handleError(_0x1785a7,null));};exports[_0xbb5d('0xb8')]=function(_0x2838ee,_0x329705,_0x59a9c8){var _0x56318a={};var _0x10dd86={};var _0xde2089;var _0x7c787e;return db[_0xbb5d('0x3b')]['findOne']({'where':{'id':_0x2838ee['params']['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x329705,null))[_0xbb5d('0x36')](function(_0xd4e3c0){if(_0xd4e3c0){_0xde2089=_0xd4e3c0;_0x10dd86[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x9f')][_0xbb5d('0x64')]);_0x10dd86['query']=_['keys'](_0x2838ee[_0xbb5d('0x3e')]);_0x10dd86[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x10dd86[_0xbb5d('0x3d')],_0x10dd86['query']);_0x56318a[_0xbb5d('0x41')]=_['intersection'](_0x10dd86['model'],qs['fields'](_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x56318a['attributes']=_0x56318a[_0xbb5d('0x41')]['length']?_0x56318a[_0xbb5d('0x41')]:_0x10dd86[_0xbb5d('0x3d')];_0x56318a[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x56318a[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x2838ee[_0xbb5d('0x3e')],_0x10dd86[_0xbb5d('0x3f')]));if(_0x2838ee['query'][_0xbb5d('0x2d')]){_0x56318a[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0x56318a['where'],{'$or':_[_0xbb5d('0x2f')](_0x56318a[_0xbb5d('0x41')],function(_0x478062){var _0x5049dc={};_0x5049dc[_0x478062]={'$like':'%'+_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x5049dc;})});}_0x56318a=_[_0xbb5d('0x49')]({},_0x56318a,_0x2838ee['options']);return _0xde2089[_0xbb5d('0xb8')](_0x56318a);}})['then'](function(_0x4cc702){if(_0x4cc702){_0x7c787e=_0x4cc702[_0xbb5d('0x43')];if(!_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x56318a[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x56318a['offset']=qs[_0xbb5d('0x20')](_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}return _0xde2089['getBlackLists'](_0x56318a);}})[_0xbb5d('0x36')](function(_0x4dc8d2){if(_0x4dc8d2){return _0x4dc8d2?{'count':_0x7c787e,'rows':_0x4dc8d2}:null;}})[_0xbb5d('0x36')](respondWithResult(_0x329705,null))['catch'](handleError(_0x329705,null));};exports[_0xbb5d('0xb9')]=function(_0x5734a4,_0x53a264,_0x2322db){var _0x489026,_0x2d0586;return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x5734a4[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x53a264,null))[_0xbb5d('0x36')](function(_0x1c2db4){if(_0x1c2db4){_0x2d0586=_0x1c2db4;return _0x1c2db4[_0xbb5d('0xb9')](_0x5734a4['body'][_0xbb5d('0x97')],_['omit'](_0x5734a4['body'],[_0xbb5d('0x97'),'id'])||{});}return null;})[_0xbb5d('0x98')](function(_0x2d8029){var _0x3e0d6c;_0x489026=_0x2d8029||[];var _0x22cdd9=[];if(_0x2d8029){for(var _0x4d617b=0x0;_0x4d617b<_0x2d8029[_0xbb5d('0x43')];_0x4d617b+=0x1){var _0x1c5ea0=_0x2d8029[_0x4d617b]['get']({'plain':!![]});_0x3e0d6c=squel[_0xbb5d('0xa3')]()[_0xbb5d('0xa4')](_0xbb5d('0xba'))[_0xbb5d('0xa6')]([_0xbb5d('0xa8'),'ContactId',_0xbb5d('0xac'),_0xbb5d('0x66'),'createdAt',_0xbb5d('0x5b')],squel[_0xbb5d('0x84')]()[_0xbb5d('0x85')](_0xbb5d('0xa8'),_0xbb5d('0xa8'))[_0xbb5d('0x85')]('id',_0xbb5d('0xa7'))[_0xbb5d('0x85')](_0x1c5ea0[_0xbb5d('0xb5')]['toString'](),_0xbb5d('0xac'))[_0xbb5d('0x85')](_0x5734a4[_0xbb5d('0x60')]['id']['toString'](),_0xbb5d('0x66'))[_0xbb5d('0x85')]('NOW()',_0xbb5d('0x5a'))['field']('NOW()',_0xbb5d('0x5b'))[_0xbb5d('0xad')](_0xbb5d('0xae'))[_0xbb5d('0x47')](_0xbb5d('0xaf'))['where']('ListId\x20=\x20?',_0x1c5ea0[_0xbb5d('0xb5')][_0xbb5d('0xab')]())[_0xbb5d('0x47')](_0xbb5d('0xb0')))['toString']();_0x22cdd9[_0xbb5d('0x8d')](db['sequelize'][_0xbb5d('0x3e')](_0x3e0d6c));}return BPromise[_0xbb5d('0x90')](_0x22cdd9);}})['then'](function(){return _0x489026;})[_0xbb5d('0x36')](respondWithResult(_0x53a264,null))['catch'](handleError(_0x53a264,null));};exports['removeBlackLists']=function(_0x2bc901,_0xe949d5,_0x11bacd){return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x2bc901[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0xe949d5,null))['then'](function(_0x2153bd){if(_0x2153bd){return _0x2153bd[_0xbb5d('0xbb')](_0x2bc901['query'][_0xbb5d('0x97')]);}})[_0xbb5d('0x36')](function(_0x3d4fcd){if(_0x3d4fcd){return db[_0xbb5d('0x6c')][_0xbb5d('0x2a')]({'where':{'ListId':_0x2bc901[_0xbb5d('0x3e')][_0xbb5d('0x97')],'VoiceQueueId':_0x2bc901[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](function(){return _0x3d4fcd;});}})[_0xbb5d('0x36')](respondWithStatusCode(_0xe949d5,null))['catch'](handleError(_0xe949d5,null));}; \ No newline at end of file +var _0x9f29=['all','union','compact','removeAgents','addAgents','ids','spread','userVoiceQueue:save','online','isEmpty','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','from','cm_contacts','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','insert','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./voiceQueue.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','end','name','send','index','VoiceQueue','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','where','pick','filters','VIRTUAL','options','includeAll','include','findAll','rows','catch','fields','merge','create','body','user','role','userProfileId','error','clone','omit','updatedAt','createdAt','UserProfileSection','autoAssociation','update','params','getHoppers','findOne','nolimit','sort','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','interface','flatMap','Agents','penalty','sequelize','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','forEach','emit','removeTeams','select','field','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId'];(function(_0xee741b,_0x10cf16){var _0x9ce0a2=function(_0x196418){while(--_0x196418){_0xee741b['push'](_0xee741b['shift']());}};_0x9ce0a2(++_0x10cf16);}(_0x9f29,0x19b));var _0x99f2=function(_0x54e8c8,_0x18955c){_0x54e8c8=_0x54e8c8-0x0;var _0x1b0292=_0x9f29[_0x54e8c8];return _0x1b0292;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x99f2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x99f2('0x1'));var BPromise=require(_0x99f2('0x2'));var Mustache=require(_0x99f2('0x3'));var util=require(_0x99f2('0x4'));var path=require(_0x99f2('0x5'));var sox=require(_0x99f2('0x6'));var csv=require(_0x99f2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99f2('0x8'));var _=require(_0x99f2('0x9'));var squel=require(_0x99f2('0xa'));var crypto=require('crypto');var jsforce=require(_0x99f2('0xb'));var deskjs=require(_0x99f2('0xc'));var toCsv=require(_0x99f2('0x7'));var querystring=require(_0x99f2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x99f2('0xe'));var qs=require(_0x99f2('0xf'));var as=require(_0x99f2('0x10'));var hardwareService=require(_0x99f2('0x11'));var logger=require(_0x99f2('0x12'))(_0x99f2('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x99f2('0x14'));var db=require(_0x99f2('0x15'))['db'];config['redis']=_[_0x99f2('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x99f2('0x17'))(new Redis(config[_0x99f2('0x18')]));require(_0x99f2('0x19'))['register'](socket);function respondWithStatusCode(_0x1ce816,_0x4d6990){_0x4d6990=_0x4d6990||0xcc;return function(_0xedd8b1){if(_0xedd8b1){return _0x1ce816[_0x99f2('0x1a')](_0x4d6990);}return _0x1ce816[_0x99f2('0x1b')](_0x4d6990)['end']();};}function respondWithResult(_0x354ccb,_0x349f72){_0x349f72=_0x349f72||0xc8;return function(_0x347a4e){if(_0x347a4e){return _0x354ccb[_0x99f2('0x1b')](_0x349f72)[_0x99f2('0x1c')](_0x347a4e);}};}function respondWithFilteredResult(_0x149521,_0x53bf95){return function(_0x486aa8){if(_0x486aa8){var _0x25ab5b=typeof _0x53bf95[_0x99f2('0x1d')]==='undefined'&&typeof _0x53bf95['limit']===_0x99f2('0x1e');var _0x427ffe=_0x486aa8[_0x99f2('0x1f')];var _0x2a525c=_0x25ab5b?0x0:_0x53bf95[_0x99f2('0x1d')];var _0x5a19d8=_0x25ab5b?_0x486aa8['count']:_0x53bf95[_0x99f2('0x1d')]+_0x53bf95[_0x99f2('0x20')];var _0x49c1cf;if(_0x5a19d8>=_0x427ffe){_0x5a19d8=_0x427ffe;_0x49c1cf=0xc8;}else{_0x49c1cf=0xce;}_0x149521[_0x99f2('0x1b')](_0x49c1cf);return _0x149521[_0x99f2('0x21')](_0x99f2('0x22'),_0x2a525c+'-'+_0x5a19d8+'/'+_0x427ffe)[_0x99f2('0x1c')](_0x486aa8);}return null;};}function patchUpdates(_0x40dc95){return function(_0x35b320){try{jsonpatch[_0x99f2('0x23')](_0x35b320,_0x40dc95,!![]);}catch(_0x3a7ff1){return BPromise['reject'](_0x3a7ff1);}return _0x35b320[_0x99f2('0x24')]();};}function saveUpdates(_0x88b4e,_0x2cc1fa){return function(_0x562257){if(_0x562257){return _0x562257['update'](_0x88b4e)[_0x99f2('0x25')](function(_0x96752c){return _0x96752c;});}return null;};}function removeEntity(_0x175072,_0xe36dab){return function(_0x182ef6){if(_0x182ef6){return _0x182ef6[_0x99f2('0x26')]()['then'](function(){var _0x207c3f=_0x182ef6[_0x99f2('0x27')]({'plain':!![]});var _0x421e78=[{'name':_0x99f2('0x28'),'value':_0x99f2('0x29'),'ignore':![]},{'name':_0x99f2('0x2a'),'value':_0x99f2('0x2b'),'ignore':![]}];var _0x58ea5a=_(_0x421e78)[_0x99f2('0x2c')](_0x99f2('0x2d'))[_0x99f2('0x2e')](_0x99f2('0x2f'))[_0x99f2('0x2f')]();if(_[_0x99f2('0x30')](_0x58ea5a,_0x207c3f[_0x99f2('0x31')])){return;}var _0x5497c6=_[_0x99f2('0x32')](_0x421e78,[_0x99f2('0x2f'),_0x207c3f['type']])['name'];return db[_0x99f2('0x33')][_0x99f2('0x26')]({'where':{'type':_0x5497c6,'resourceId':_0x207c3f['id']}})['then'](function(){return _0x182ef6;});})[_0x99f2('0x25')](function(){_0x175072[_0x99f2('0x1b')](0xcc)[_0x99f2('0x34')]();});}};}function handleEntityNotFound(_0x55d518,_0x5a1541){return function(_0x416e50){if(!_0x416e50){_0x55d518[_0x99f2('0x1a')](0x194);}return _0x416e50;};}function handleError(_0x3aae11,_0x26e4c1){_0x26e4c1=_0x26e4c1||0x1f4;return function(_0x2b0866){logger['error'](_0x2b0866['stack']);if(_0x2b0866[_0x99f2('0x35')]){delete _0x2b0866[_0x99f2('0x35')];}_0x3aae11[_0x99f2('0x1b')](_0x26e4c1)[_0x99f2('0x36')](_0x2b0866);};}exports[_0x99f2('0x37')]=function(_0x3c3e0e,_0x308360){var _0x100ed2={},_0x391f3d={},_0x1992ce={'count':0x0,'rows':[]};var _0x395b5e=_[_0x99f2('0x2e')](db[_0x99f2('0x38')][_0x99f2('0x39')],function(_0x15fc74){return{'name':_0x15fc74['fieldName'],'type':_0x15fc74['type'][_0x99f2('0x3a')]};});_0x391f3d[_0x99f2('0x3b')]=_['map'](_0x395b5e,_0x99f2('0x35'));_0x391f3d[_0x99f2('0x3c')]=_[_0x99f2('0x3d')](_0x3c3e0e[_0x99f2('0x3c')]);_0x391f3d['filters']=_[_0x99f2('0x3e')](_0x391f3d[_0x99f2('0x3b')],_0x391f3d[_0x99f2('0x3c')]);_0x100ed2['attributes']=_[_0x99f2('0x3e')](_0x391f3d[_0x99f2('0x3b')],qs['fields'](_0x3c3e0e[_0x99f2('0x3c')]['fields']));_0x100ed2[_0x99f2('0x3f')]=_0x100ed2['attributes'][_0x99f2('0x40')]?_0x100ed2[_0x99f2('0x3f')]:_0x391f3d[_0x99f2('0x3b')];if(!_0x3c3e0e[_0x99f2('0x3c')][_0x99f2('0x41')]('nolimit')){_0x100ed2[_0x99f2('0x20')]=qs[_0x99f2('0x20')](_0x3c3e0e[_0x99f2('0x3c')][_0x99f2('0x20')]);_0x100ed2[_0x99f2('0x1d')]=qs[_0x99f2('0x1d')](_0x3c3e0e[_0x99f2('0x3c')][_0x99f2('0x1d')]);}_0x100ed2[_0x99f2('0x42')]=qs['sort'](_0x3c3e0e['query']['sort']);_0x100ed2[_0x99f2('0x43')]=qs['filters'](_[_0x99f2('0x44')](_0x3c3e0e[_0x99f2('0x3c')],_0x391f3d[_0x99f2('0x45')]),_0x395b5e);if(_0x3c3e0e[_0x99f2('0x3c')][_0x99f2('0x2c')]){_0x100ed2['where']=_['merge'](_0x100ed2[_0x99f2('0x43')],{'$or':_[_0x99f2('0x2e')](_0x395b5e,function(_0x348e4d){if(_0x348e4d['type']!==_0x99f2('0x46')){var _0x387478={};_0x387478[_0x348e4d[_0x99f2('0x35')]]={'$like':'%'+_0x3c3e0e[_0x99f2('0x3c')]['filter']+'%'};return _0x387478;}})});}_0x100ed2=_['merge']({},_0x100ed2,_0x3c3e0e[_0x99f2('0x47')]);var _0x5dce80={'where':_0x100ed2['where']};return db['VoiceQueue']['count'](_0x5dce80)['then'](function(_0x123747){_0x1992ce[_0x99f2('0x1f')]=_0x123747;if(_0x3c3e0e[_0x99f2('0x3c')][_0x99f2('0x48')]){_0x100ed2[_0x99f2('0x49')]=[{'all':!![]}];}return db['VoiceQueue'][_0x99f2('0x4a')](_0x100ed2);})['then'](function(_0x5c631d){_0x1992ce[_0x99f2('0x4b')]=_0x5c631d;return _0x1992ce;})[_0x99f2('0x25')](respondWithFilteredResult(_0x308360,_0x100ed2))[_0x99f2('0x4c')](handleError(_0x308360,null));};exports['show']=function(_0x38d5cf,_0x137f23){var _0x265710={'raw':![],'where':{'id':_0x38d5cf['params']['id']}},_0x217394={};_0x217394[_0x99f2('0x3b')]=_[_0x99f2('0x3d')](db[_0x99f2('0x38')][_0x99f2('0x39')]);_0x217394[_0x99f2('0x3c')]=_[_0x99f2('0x3d')](_0x38d5cf['query']);_0x217394['filters']=_[_0x99f2('0x3e')](_0x217394[_0x99f2('0x3b')],_0x217394[_0x99f2('0x3c')]);_0x265710[_0x99f2('0x3f')]=_[_0x99f2('0x3e')](_0x217394['model'],qs[_0x99f2('0x4d')](_0x38d5cf[_0x99f2('0x3c')][_0x99f2('0x4d')]));_0x265710[_0x99f2('0x3f')]=_0x265710[_0x99f2('0x3f')]['length']?_0x265710[_0x99f2('0x3f')]:_0x217394[_0x99f2('0x3b')];if(_0x38d5cf['query'][_0x99f2('0x48')]){_0x265710[_0x99f2('0x49')]=[{'all':!![]}];}_0x265710=_[_0x99f2('0x4e')]({},_0x265710,_0x38d5cf[_0x99f2('0x47')]);return db[_0x99f2('0x38')][_0x99f2('0x32')](_0x265710)[_0x99f2('0x25')](handleEntityNotFound(_0x137f23,null))[_0x99f2('0x25')](respondWithResult(_0x137f23,null))['catch'](handleError(_0x137f23,null));};exports[_0x99f2('0x4f')]=function(_0x4afc98,_0x42e5f1){return db[_0x99f2('0x38')][_0x99f2('0x4f')](_0x4afc98[_0x99f2('0x50')],{})[_0x99f2('0x25')](function(_0x163c97){var _0x89e813=_0x4afc98[_0x99f2('0x51')][_0x99f2('0x27')]({'plain':!![]});if(!_0x89e813)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x89e813[_0x99f2('0x52')]==='user'){var _0x2c5892=_0x163c97[_0x99f2('0x27')]({'plain':!![]});var _0x4f15be=[{'name':_0x99f2('0x28'),'value':_0x99f2('0x29')},{'name':_0x99f2('0x2a'),'value':_0x99f2('0x2b')}];var _0x57b2b7=_[_0x99f2('0x32')](_0x4f15be,[_0x99f2('0x2f'),_0x2c5892['type']])[_0x99f2('0x35')];return db['UserProfileSection'][_0x99f2('0x32')]({'where':{'name':_0x57b2b7,'userProfileId':_0x89e813[_0x99f2('0x53')]},'raw':!![]})[_0x99f2('0x25')](function(_0xb6ac05){if(_0xb6ac05&&_0xb6ac05['autoAssociation']===0x0){return db[_0x99f2('0x33')][_0x99f2('0x4f')]({'name':_0x2c5892[_0x99f2('0x35')],'resourceId':_0x2c5892['id'],'type':_0xb6ac05[_0x99f2('0x35')],'sectionId':_0xb6ac05['id']},{})[_0x99f2('0x25')](function(){return _0x163c97;});}else{return _0x163c97;}})[_0x99f2('0x4c')](function(_0x3ddec1){logger[_0x99f2('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ddec1);throw _0x3ddec1;});}return _0x163c97;})[_0x99f2('0x25')](respondWithResult(_0x42e5f1,0xc9))[_0x99f2('0x4c')](handleError(_0x42e5f1,null));};exports[_0x99f2('0x55')]=function(_0x3a9e05,_0x5803ec){var _0xc50882={'where':{'id':_0x3a9e05['params']['id']}},_0x2c1aba={};_0x2c1aba['model']=_['keys'](db[_0x99f2('0x38')]['rawAttributes']);_0xc50882['attributes']=_[_0x99f2('0x3e')](_0x2c1aba[_0x99f2('0x3b')],qs[_0x99f2('0x4d')](_0x3a9e05['query'][_0x99f2('0x4d')]));_0xc50882[_0x99f2('0x3f')]=_0xc50882[_0x99f2('0x3f')]['length']?_0xc50882[_0x99f2('0x3f')]:_0x2c1aba['model'];if(_0x3a9e05['query'][_0x99f2('0x48')]){_0xc50882[_0x99f2('0x49')]=[{'all':!![]}];}_0xc50882=_[_0x99f2('0x4e')]({},_0xc50882,_0x3a9e05[_0x99f2('0x47')]);return db[_0x99f2('0x38')][_0x99f2('0x32')](_0xc50882)[_0x99f2('0x25')](handleEntityNotFound(_0x5803ec,null))[_0x99f2('0x25')](function(_0x2c1c61){if(_0x2c1c61){var _0x1faf28=_0x2c1c61['get']({'plain':!![]});_0x1faf28=qs[_0x99f2('0x56')](_0x1faf28,['id','createdAt',_0x99f2('0x57')]);_0x3a9e05[_0x99f2('0x50')]=_[_0x99f2('0x56')](_0x3a9e05['body'],['id',_0x99f2('0x58'),'updatedAt']);return db['VoiceQueue'][_0x99f2('0x4f')](_['merge'](_0x1faf28,_0x3a9e05[_0x99f2('0x50')]),{'include':_0x3a9e05['query'][_0x99f2('0x48')]?[{'all':!![]}]:undefined})[_0x99f2('0x25')](function(_0x47ef00){var _0x4230c4=_0x3a9e05[_0x99f2('0x51')][_0x99f2('0x27')]({'plain':!![]});if(!_0x4230c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4230c4['role']===_0x99f2('0x51')){var _0x1538df=_0x47ef00[_0x99f2('0x27')]({'plain':!![]});var _0x466d4a=[{'name':'VoiceQueues','value':_0x99f2('0x29')},{'name':_0x99f2('0x2a'),'value':_0x99f2('0x2b')}];var _0x3ecf9e=_[_0x99f2('0x32')](_0x466d4a,[_0x99f2('0x2f'),_0x1538df[_0x99f2('0x31')]])[_0x99f2('0x35')];return db[_0x99f2('0x59')][_0x99f2('0x32')]({'where':{'name':_0x3ecf9e,'userProfileId':_0x4230c4[_0x99f2('0x53')]},'raw':!![]})[_0x99f2('0x25')](function(_0x3ffc56){if(_0x3ffc56&&_0x3ffc56[_0x99f2('0x5a')]===0x0){return db['UserProfileResource'][_0x99f2('0x4f')]({'name':_0x1538df[_0x99f2('0x35')],'resourceId':_0x1538df['id'],'type':_0x3ffc56[_0x99f2('0x35')],'sectionId':_0x3ffc56['id']},{})[_0x99f2('0x25')](function(){return _0x47ef00;});}else{return _0x47ef00;}})['catch'](function(_0x25c01a){logger[_0x99f2('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25c01a);throw _0x25c01a;});}return _0x47ef00;});}})[_0x99f2('0x25')](respondWithResult(_0x5803ec,0xc9))[_0x99f2('0x4c')](handleError(_0x5803ec,null));};exports[_0x99f2('0x5b')]=function(_0x3a98b0,_0x571b29){if(_0x3a98b0[_0x99f2('0x50')]['id']){delete _0x3a98b0[_0x99f2('0x50')]['id'];}return db[_0x99f2('0x38')]['find']({'where':{'id':_0x3a98b0[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x571b29,null))[_0x99f2('0x25')](saveUpdates(_0x3a98b0[_0x99f2('0x50')],null))[_0x99f2('0x25')](respondWithResult(_0x571b29,null))[_0x99f2('0x4c')](handleError(_0x571b29,null));};exports['destroy']=function(_0x4b351b,_0x4e6b30){return db[_0x99f2('0x38')][_0x99f2('0x32')]({'where':{'id':_0x4b351b[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x4e6b30,null))[_0x99f2('0x25')](removeEntity(_0x4e6b30,null))[_0x99f2('0x4c')](handleError(_0x4e6b30,null));};exports[_0x99f2('0x5d')]=function(_0x3700eb,_0x1d81a2,_0x203e40){var _0x401789={'raw':![],'where':{}};var _0x587b09={};var _0x60601={'count':0x0,'rows':[]};return db[_0x99f2('0x38')][_0x99f2('0x5e')]({'where':{'id':_0x3700eb[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x1d81a2,null))[_0x99f2('0x25')](function(_0x592a46){if(_0x592a46){_0x587b09[_0x99f2('0x3b')]=_['keys'](db['CmHopper'][_0x99f2('0x39')]);_0x587b09[_0x99f2('0x3c')]=_[_0x99f2('0x3d')](_0x3700eb[_0x99f2('0x3c')]);_0x587b09['filters']=_['intersection'](_0x587b09['model'],_0x587b09['query']);_0x401789['attributes']=_['intersection'](_0x587b09[_0x99f2('0x3b')],qs['fields'](_0x3700eb[_0x99f2('0x3c')][_0x99f2('0x4d')]));_0x401789[_0x99f2('0x3f')]=_0x401789[_0x99f2('0x3f')][_0x99f2('0x40')]?_0x401789['attributes']:_0x587b09[_0x99f2('0x3b')];if(!_0x3700eb['query'][_0x99f2('0x41')](_0x99f2('0x5f'))){_0x401789[_0x99f2('0x20')]=qs['limit'](_0x3700eb[_0x99f2('0x3c')][_0x99f2('0x20')]);_0x401789[_0x99f2('0x1d')]=qs['offset'](_0x3700eb[_0x99f2('0x3c')][_0x99f2('0x1d')]);}_0x401789[_0x99f2('0x42')]=qs[_0x99f2('0x60')](_0x3700eb[_0x99f2('0x3c')][_0x99f2('0x60')]);_0x401789[_0x99f2('0x43')]=qs[_0x99f2('0x45')](_['pick'](_0x3700eb['query'],_0x587b09['filters']));_0x401789[_0x99f2('0x43')][_0x99f2('0x61')]=_0x592a46['id'];if(_0x3700eb[_0x99f2('0x3c')][_0x99f2('0x2c')]){_0x401789[_0x99f2('0x43')]=_[_0x99f2('0x4e')](_0x401789['where'],{'$or':_[_0x99f2('0x2e')](_0x401789[_0x99f2('0x3f')],function(_0x405646){var _0x39db15={};_0x39db15[_0x405646]={'$like':'%'+_0x3700eb[_0x99f2('0x3c')][_0x99f2('0x2c')]+'%'};return _0x39db15;})});}_0x401789=_[_0x99f2('0x4e')]({},_0x401789,_0x3700eb[_0x99f2('0x47')]);return db[_0x99f2('0x62')]['count']({'where':_0x401789[_0x99f2('0x43')]})['then'](function(_0x4456c8){_0x60601[_0x99f2('0x1f')]=_0x4456c8;if(_0x3700eb[_0x99f2('0x3c')]['includeAll']){_0x401789[_0x99f2('0x49')]=[{'all':!![]}];}return db[_0x99f2('0x62')][_0x99f2('0x4a')](_0x401789);})[_0x99f2('0x25')](function(_0x5ecd39){_0x60601[_0x99f2('0x4b')]=_0x5ecd39;return _0x60601;});}})[_0x99f2('0x25')](respondWithFilteredResult(_0x1d81a2,_0x401789))['catch'](handleError(_0x1d81a2,null));};exports[_0x99f2('0x63')]=function(_0xe19c09,_0x53aafd,_0x15ad96){var _0x10df3e={'raw':!![],'where':{}};var _0x35ca2b={};var _0x1a6e31={'count':0x0,'rows':[]};return db[_0x99f2('0x38')][_0x99f2('0x5e')]({'where':{'id':_0xe19c09[_0x99f2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x53aafd,null))[_0x99f2('0x25')](function(_0x572e13){if(_0x572e13){_0x35ca2b['model']=_[_0x99f2('0x3d')](db[_0x99f2('0x64')][_0x99f2('0x39')]);_0x35ca2b['query']=_['keys'](_0xe19c09['query']);_0x35ca2b[_0x99f2('0x45')]=_['intersection'](_0x35ca2b[_0x99f2('0x3b')],_0x35ca2b[_0x99f2('0x3c')]);_0x10df3e['attributes']=_[_0x99f2('0x3e')](_0x35ca2b['model'],qs[_0x99f2('0x4d')](_0xe19c09[_0x99f2('0x3c')][_0x99f2('0x4d')]));_0x10df3e['attributes']=_0x10df3e[_0x99f2('0x3f')][_0x99f2('0x40')]?_0x10df3e[_0x99f2('0x3f')]:_0x35ca2b['model'];if(!_0xe19c09['query'][_0x99f2('0x41')](_0x99f2('0x5f'))){_0x10df3e[_0x99f2('0x20')]=qs[_0x99f2('0x20')](_0xe19c09['query']['limit']);_0x10df3e[_0x99f2('0x1d')]=qs[_0x99f2('0x1d')](_0xe19c09[_0x99f2('0x3c')][_0x99f2('0x1d')]);}_0x10df3e[_0x99f2('0x42')]=qs[_0x99f2('0x60')](_0xe19c09['query'][_0x99f2('0x60')]);_0x10df3e[_0x99f2('0x43')]=qs[_0x99f2('0x45')](_[_0x99f2('0x44')](_0xe19c09[_0x99f2('0x3c')],_0x35ca2b[_0x99f2('0x45')]));_0x10df3e[_0x99f2('0x43')][_0x99f2('0x61')]=_0x572e13['id'];if(_0xe19c09[_0x99f2('0x3c')][_0x99f2('0x2c')]){_0x10df3e[_0x99f2('0x43')]=_['merge'](_0x10df3e[_0x99f2('0x43')],{'$or':_[_0x99f2('0x2e')](_0x10df3e[_0x99f2('0x3f')],function(_0x111b5a){var _0x27cd92={};_0x27cd92[_0x111b5a]={'$like':'%'+_0xe19c09[_0x99f2('0x3c')][_0x99f2('0x2c')]+'%'};return _0x27cd92;})});}_0x10df3e=_['merge']({},_0x10df3e,_0xe19c09[_0x99f2('0x47')]);return db[_0x99f2('0x64')]['count']({'where':_0x10df3e['where']})[_0x99f2('0x25')](function(_0xd75df1){_0x1a6e31[_0x99f2('0x1f')]=_0xd75df1;if(_0xe19c09['query'][_0x99f2('0x48')]){_0x10df3e[_0x99f2('0x49')]=[{'all':!![]}];}return db[_0x99f2('0x64')][_0x99f2('0x4a')](_0x10df3e);})['then'](function(_0x3346ee){_0x1a6e31[_0x99f2('0x4b')]=_0x3346ee;return _0x1a6e31;});}})[_0x99f2('0x25')](respondWithFilteredResult(_0x53aafd,_0x10df3e))[_0x99f2('0x4c')](handleError(_0x53aafd,null));};exports[_0x99f2('0x65')]=function(_0x1c16fc,_0x2beb78,_0x4247af){var _0x1563dc={'raw':!![],'where':{}};var _0x143d2d={};var _0x375051={'count':0x0,'rows':[]};return db[_0x99f2('0x38')][_0x99f2('0x5e')]({'where':{'id':_0x1c16fc[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x2beb78,null))[_0x99f2('0x25')](function(_0x429c44){if(_0x429c44){_0x143d2d[_0x99f2('0x3b')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x143d2d['query']=_[_0x99f2('0x3d')](_0x1c16fc[_0x99f2('0x3c')]);_0x143d2d['filters']=_['intersection'](_0x143d2d[_0x99f2('0x3b')],_0x143d2d[_0x99f2('0x3c')]);_0x1563dc[_0x99f2('0x3f')]=_[_0x99f2('0x3e')](_0x143d2d[_0x99f2('0x3b')],qs[_0x99f2('0x4d')](_0x1c16fc[_0x99f2('0x3c')][_0x99f2('0x4d')]));_0x1563dc[_0x99f2('0x3f')]=_0x1563dc[_0x99f2('0x3f')][_0x99f2('0x40')]?_0x1563dc[_0x99f2('0x3f')]:_0x143d2d[_0x99f2('0x3b')];if(!_0x1c16fc[_0x99f2('0x3c')][_0x99f2('0x41')](_0x99f2('0x5f'))){_0x1563dc[_0x99f2('0x20')]=qs[_0x99f2('0x20')](_0x1c16fc[_0x99f2('0x3c')][_0x99f2('0x20')]);_0x1563dc[_0x99f2('0x1d')]=qs['offset'](_0x1c16fc['query'][_0x99f2('0x1d')]);}_0x1563dc[_0x99f2('0x42')]=qs[_0x99f2('0x60')](_0x1c16fc[_0x99f2('0x3c')][_0x99f2('0x60')]);_0x1563dc[_0x99f2('0x43')]=qs[_0x99f2('0x45')](_[_0x99f2('0x44')](_0x1c16fc[_0x99f2('0x3c')],_0x143d2d[_0x99f2('0x45')]));_0x1563dc['where'][_0x99f2('0x61')]=_0x429c44['id'];if(_0x1c16fc['query']['filter']){_0x1563dc[_0x99f2('0x43')]=_['merge'](_0x1563dc['where'],{'$or':_[_0x99f2('0x2e')](_0x1563dc['attributes'],function(_0x288290){var _0x1cc54d={};_0x1cc54d[_0x288290]={'$like':'%'+_0x1c16fc[_0x99f2('0x3c')][_0x99f2('0x2c')]+'%'};return _0x1cc54d;})});}_0x1563dc=_[_0x99f2('0x4e')]({},_0x1563dc,_0x1c16fc[_0x99f2('0x47')]);return db['CmHopperFinal'][_0x99f2('0x1f')]({'where':_0x1563dc[_0x99f2('0x43')]})[_0x99f2('0x25')](function(_0x108148){_0x375051[_0x99f2('0x1f')]=_0x108148;if(_0x1c16fc[_0x99f2('0x3c')][_0x99f2('0x48')]){_0x1563dc[_0x99f2('0x49')]=[{'all':!![]}];}return db[_0x99f2('0x66')][_0x99f2('0x4a')](_0x1563dc);})[_0x99f2('0x25')](function(_0x1dcd93){_0x375051[_0x99f2('0x4b')]=_0x1dcd93;return _0x375051;});}})[_0x99f2('0x25')](respondWithFilteredResult(_0x2beb78,_0x1563dc))[_0x99f2('0x4c')](handleError(_0x2beb78,null));};exports['getHopperBlacks']=function(_0xd37baa,_0xf4d354,_0x287cde){var _0x4b4c0c={'raw':!![],'where':{}};var _0x341c4e={};var _0x44fc02={'count':0x0,'rows':[]};return db[_0x99f2('0x38')][_0x99f2('0x5e')]({'where':{'id':_0xd37baa[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0xf4d354,null))['then'](function(_0x4eea8f){if(_0x4eea8f){_0x341c4e[_0x99f2('0x3b')]=_[_0x99f2('0x3d')](db[_0x99f2('0x67')]['rawAttributes']);_0x341c4e[_0x99f2('0x3c')]=_[_0x99f2('0x3d')](_0xd37baa[_0x99f2('0x3c')]);_0x341c4e[_0x99f2('0x45')]=_[_0x99f2('0x3e')](_0x341c4e[_0x99f2('0x3b')],_0x341c4e[_0x99f2('0x3c')]);_0x4b4c0c[_0x99f2('0x3f')]=_['intersection'](_0x341c4e[_0x99f2('0x3b')],qs['fields'](_0xd37baa[_0x99f2('0x3c')][_0x99f2('0x4d')]));_0x4b4c0c[_0x99f2('0x3f')]=_0x4b4c0c[_0x99f2('0x3f')][_0x99f2('0x40')]?_0x4b4c0c[_0x99f2('0x3f')]:_0x341c4e[_0x99f2('0x3b')];if(!_0xd37baa[_0x99f2('0x3c')][_0x99f2('0x41')]('nolimit')){_0x4b4c0c[_0x99f2('0x20')]=qs['limit'](_0xd37baa[_0x99f2('0x3c')][_0x99f2('0x20')]);_0x4b4c0c[_0x99f2('0x1d')]=qs[_0x99f2('0x1d')](_0xd37baa[_0x99f2('0x3c')][_0x99f2('0x1d')]);}_0x4b4c0c[_0x99f2('0x42')]=qs[_0x99f2('0x60')](_0xd37baa[_0x99f2('0x3c')][_0x99f2('0x60')]);_0x4b4c0c['where']=qs[_0x99f2('0x45')](_[_0x99f2('0x44')](_0xd37baa[_0x99f2('0x3c')],_0x341c4e['filters']));_0x4b4c0c[_0x99f2('0x43')][_0x99f2('0x61')]=_0x4eea8f['id'];if(_0xd37baa[_0x99f2('0x3c')][_0x99f2('0x2c')]){_0x4b4c0c[_0x99f2('0x43')]=_[_0x99f2('0x4e')](_0x4b4c0c[_0x99f2('0x43')],{'$or':_[_0x99f2('0x2e')](_0x4b4c0c[_0x99f2('0x3f')],function(_0x5053a6){var _0x45af42={};_0x45af42[_0x5053a6]={'$like':'%'+_0xd37baa[_0x99f2('0x3c')]['filter']+'%'};return _0x45af42;})});}_0x4b4c0c=_[_0x99f2('0x4e')]({},_0x4b4c0c,_0xd37baa[_0x99f2('0x47')]);return db['CmHopperBlack'][_0x99f2('0x1f')]({'where':_0x4b4c0c['where']})[_0x99f2('0x25')](function(_0x3abbe5){_0x44fc02[_0x99f2('0x1f')]=_0x3abbe5;if(_0xd37baa['query']['includeAll']){_0x4b4c0c['include']=[{'all':!![]}];}return db[_0x99f2('0x67')][_0x99f2('0x4a')](_0x4b4c0c);})[_0x99f2('0x25')](function(_0x1ad166){_0x44fc02['rows']=_0x1ad166;return _0x44fc02;});}})[_0x99f2('0x25')](respondWithFilteredResult(_0xf4d354,_0x4b4c0c))[_0x99f2('0x4c')](handleError(_0xf4d354,null));};exports[_0x99f2('0x68')]=function(_0x6b3275,_0x264289,_0x1e717b){var _0x365747={};var _0x56389b={};var _0x34f37b;var _0x324489;return db[_0x99f2('0x38')][_0x99f2('0x5e')]({'where':{'id':_0x6b3275[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x264289,null))['then'](function(_0xc232ff){if(_0xc232ff){_0x34f37b=_0xc232ff;_0x56389b[_0x99f2('0x3b')]=_[_0x99f2('0x3d')](db[_0x99f2('0x69')][_0x99f2('0x39')]);_0x56389b['query']=_[_0x99f2('0x3d')](_0x6b3275[_0x99f2('0x3c')]);_0x56389b[_0x99f2('0x45')]=_[_0x99f2('0x3e')](_0x56389b[_0x99f2('0x3b')],_0x56389b[_0x99f2('0x3c')]);_0x365747[_0x99f2('0x3f')]=_[_0x99f2('0x3e')](_0x56389b[_0x99f2('0x3b')],qs['fields'](_0x6b3275[_0x99f2('0x3c')][_0x99f2('0x4d')]));_0x365747[_0x99f2('0x3f')]=_0x365747['attributes'][_0x99f2('0x40')]?_0x365747[_0x99f2('0x3f')]:_0x56389b[_0x99f2('0x3b')];_0x365747[_0x99f2('0x42')]=qs[_0x99f2('0x60')](_0x6b3275[_0x99f2('0x3c')][_0x99f2('0x60')]);_0x365747[_0x99f2('0x43')]=qs[_0x99f2('0x45')](_[_0x99f2('0x44')](_0x6b3275['query'],_0x56389b[_0x99f2('0x45')]));if(_0x6b3275[_0x99f2('0x3c')][_0x99f2('0x2c')]){_0x365747['where']=_['merge'](_0x365747[_0x99f2('0x43')],{'$or':_[_0x99f2('0x2e')](_0x365747[_0x99f2('0x3f')],function(_0x1d8c92){var _0x1fb9db={};_0x1fb9db[_0x1d8c92]={'$like':'%'+_0x6b3275[_0x99f2('0x3c')][_0x99f2('0x2c')]+'%'};return _0x1fb9db;})});}_0x365747=_[_0x99f2('0x4e')]({},_0x365747,_0x6b3275[_0x99f2('0x47')]);return _0x34f37b['getTeams'](_0x365747);}})[_0x99f2('0x25')](function(_0x3cb285){if(_0x3cb285){_0x324489=_0x3cb285[_0x99f2('0x40')];if(!_0x6b3275['query'][_0x99f2('0x41')](_0x99f2('0x5f'))){_0x365747[_0x99f2('0x20')]=qs[_0x99f2('0x20')](_0x6b3275[_0x99f2('0x3c')][_0x99f2('0x20')]);_0x365747[_0x99f2('0x1d')]=qs[_0x99f2('0x1d')](_0x6b3275[_0x99f2('0x3c')]['offset']);}return _0x34f37b[_0x99f2('0x68')](_0x365747);}})[_0x99f2('0x25')](function(_0x267a50){if(_0x267a50){return _0x267a50?{'count':_0x324489,'rows':_0x267a50}:null;}})[_0x99f2('0x25')](respondWithResult(_0x264289,null))[_0x99f2('0x4c')](handleError(_0x264289,null));};exports[_0x99f2('0x6a')]=function(_0x17810f,_0x591871,_0x5a2d07){var _0x543100=_0x17810f['body'][_0x99f2('0x6b')];var _0x5163aa=_[_0x99f2('0x2e')](_0x543100,'id');return db['Team']['findAll']({'where':{'id':_0x5163aa},'attributes':['id'],'include':[{'model':db[_0x99f2('0x6c')],'as':'Agents','attributes':['id',_0x99f2('0x35'),'online','voicePause',_0x99f2('0x6d')],'raw':!![]}]})[_0x99f2('0x25')](function(_0x4e75ba){if(_0x4e75ba){var _0x1e3a14=_[_0x99f2('0x6e')](_0x4e75ba,function(_0x382ec3){var _0x74200=_0x382ec3[_0x99f2('0x27')]({'plain':!![]});_0x74200[_0x99f2('0x6f')]['forEach'](function(_0x29312c){_0x29312c[_0x99f2('0x70')]=_[_0x99f2('0x32')](_0x543100,{'id':_0x74200['id']})[_0x99f2('0x70')];});return _0x74200['Agents'];});return db[_0x99f2('0x38')][_0x99f2('0x32')]({'where':{'id':_0x17810f[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](function(_0x27f28f){return db[_0x99f2('0x71')]['transaction'](function(_0x45f787){return _0x27f28f[_0x99f2('0x6a')](_0x5163aa,{'transaction':_0x45f787})[_0x99f2('0x25')](function(){return BPromise['each'](_0x543100,function(_0x623d09){return db[_0x99f2('0x72')][_0x99f2('0x73')]({'TeamId':_0x623d09['id'],'VoiceQueueId':_0x17810f[_0x99f2('0x5c')]['id'],'penalty':_0x623d09[_0x99f2('0x70')]},{'transaction':_0x45f787});});})[_0x99f2('0x25')](function(){return BPromise['each'](_0x1e3a14,function(_0xbc1c11){return db[_0x99f2('0x74')][_0x99f2('0x75')]({'where':{'UserId':_0xbc1c11['id'],'VoiceQueueId':_0x17810f[_0x99f2('0x5c')]['id']},'defaults':{'penalty':_0xbc1c11[_0x99f2('0x70')]},'transaction':_0x45f787});});})[_0x99f2('0x25')](function(){return BPromise['each'](_[_0x99f2('0x2c')](_0x1e3a14,{'online':!![]}),function(_0x337b74){return db[_0x99f2('0x76')][_0x99f2('0x73')]({'membername':_0x337b74[_0x99f2('0x35')],'UserId':_0x337b74['id'],'queue_name':_0x27f28f[_0x99f2('0x35')],'VoiceQueueId':_0x27f28f['id'],'interface':_[_0x99f2('0x77')](_0x337b74['interface'])?util[_0x99f2('0x78')](_0x99f2('0x79'),_0x337b74[_0x99f2('0x35')]):_0x337b74[_0x99f2('0x6d')],'paused':_0x337b74[_0x99f2('0x7a')]||![],'penalty':_0x337b74[_0x99f2('0x70')]},{'transaction':_0x45f787});});})['then'](function(){_0x1e3a14[_0x99f2('0x7b')](function(_0x585bec){socket[_0x99f2('0x7c')]('userVoiceQueue:save',{'UserId':_0x585bec['id'],'VoiceQueueId':_0x27f28f['id']});});});});});}})[_0x99f2('0x25')](respondWithStatusCode(_0x591871,null))[_0x99f2('0x4c')](handleError(_0x591871,null));};exports[_0x99f2('0x7d')]=function(_0x1b9d24,_0x13b536,_0x4d5bf7){return db[_0x99f2('0x69')][_0x99f2('0x4a')]({'where':{'id':_0x1b9d24[_0x99f2('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x99f2('0x6c')],'as':_0x99f2('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x99f2('0x25')](handleEntityNotFound(_0x13b536,null))[_0x99f2('0x25')](function(_0x42fd50){var _0x329df9=_[_0x99f2('0x2e')](_0x42fd50,'id');var _0x3897a5=[];var _0x5f4e96=[];var _0x11c7d5=squel[_0x99f2('0x7e')]();_0x11c7d5[_0x99f2('0x7f')]('tq.TeamId')['from'](_0x99f2('0x80'),'tq')[_0x99f2('0x81')](_0x99f2('0x82'),'ut',_0x99f2('0x83'))[_0x99f2('0x43')]('VoiceQueueId\x20=\x20?',_0x1b9d24['params']['id']);for(var _0x4ea4d3=0x0;_0x4ea4d3<_0x42fd50[_0x99f2('0x40')];_0x4ea4d3+=0x1){let _0x2ceae1=_0x42fd50[_0x4ea4d3];for(var _0x2d2900=0x0;_0x2d2900<_0x2ceae1[_0x99f2('0x6f')][_0x99f2('0x40')];_0x2d2900+=0x1){let _0x22a4d2=_0x2ceae1[_0x99f2('0x6f')][_0x2d2900];var _0x7a200e=_0x11c7d5['clone']();_0x7a200e[_0x99f2('0x43')](_0x99f2('0x84'),_0x22a4d2['id']);_0x5f4e96[_0x99f2('0x85')](db[_0x99f2('0x71')]['query'](_0x7a200e[_0x99f2('0x86')](),{'type':db[_0x99f2('0x71')][_0x99f2('0x87')][_0x99f2('0x88')]})[_0x99f2('0x25')](function(_0x4bdf2c){if(_0x4bdf2c[_0x99f2('0x40')]===0x1){return _0x22a4d2['id'];}else{var _0x38c97f=_['every'](_['map'](_0x4bdf2c,_0x99f2('0x89')),function(_0x2611a6){return _[_0x99f2('0x30')](_0x329df9,_0x2611a6);});if(_0x38c97f){return _0x22a4d2['id'];}}}));}}return BPromise[_0x99f2('0x8a')](_0x5f4e96)[_0x99f2('0x25')](function(_0x27dc8e){_0x3897a5=_(_0x3897a5)[_0x99f2('0x8b')](_0x27dc8e)[_0x99f2('0x8c')]()[_0x99f2('0x2f')]();return db['VoiceQueue'][_0x99f2('0x32')]({'where':{'id':_0x1b9d24[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](function(_0x27eabf){return db[_0x99f2('0x71')]['transaction'](function(_0x241e3b){return _0x27eabf[_0x99f2('0x7d')](_0x1b9d24[_0x99f2('0x3c')]['ids'],{'transaction':_0x241e3b})[_0x99f2('0x25')](function(){if(!_['isEmpty'](_0x3897a5)){return _0x27eabf[_0x99f2('0x8d')](_0x3897a5,{'transaction':_0x241e3b})[_0x99f2('0x25')](function(){return db[_0x99f2('0x76')]['destroy']({'where':{'VoiceQueueId':_0x1b9d24['params']['id'],'UserId':_0x3897a5},'transaction':_0x241e3b});});}})['then'](function(){_0x3897a5['forEach'](function(_0x39c74f){socket[_0x99f2('0x7c')]('userVoiceQueue:remove',{'UserId':_0x39c74f,'VoiceQueueId':_0x27eabf['id']});});});});});});})['then'](respondWithStatusCode(_0x13b536,null))[_0x99f2('0x4c')](handleError(_0x13b536,null));};exports['addAgents']=function(_0x1633a4,_0x339013,_0x5c6dd3){var _0x404897,_0x5f9bab;return db[_0x99f2('0x38')][_0x99f2('0x32')]({'where':{'id':_0x1633a4[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x339013,null))['then'](function(_0xf727fb){if(_0xf727fb){_0x5f9bab=_0xf727fb;return _0xf727fb[_0x99f2('0x8e')](_0x1633a4[_0x99f2('0x50')][_0x99f2('0x8f')],_['omit'](_0x1633a4[_0x99f2('0x50')],[_0x99f2('0x8f'),'id'])||{})[_0x99f2('0x90')](function(_0x2aeb2d){for(var _0x502d28=0x0;_0x502d28<_0x1633a4['body']['ids'][_0x99f2('0x40')];_0x502d28+=0x1){socket[_0x99f2('0x7c')](_0x99f2('0x91'),{'UserId':Number(_0x1633a4['body']['ids'][_0x502d28]),'VoiceQueueId':Number(_0x1633a4[_0x99f2('0x5c')]['id'])});}return _0x2aeb2d;});}})[_0x99f2('0x25')](function(_0x336549){_0x404897=_0x336549||[];if(_0x5f9bab){return db[_0x99f2('0x6c')][_0x99f2('0x4a')]({'where':{'id':_0x1633a4['body']['ids']},'attributes':['id',_0x99f2('0x35'),_0x99f2('0x92'),_0x99f2('0x7a'),_0x99f2('0x6d')],'raw':!![]});}})[_0x99f2('0x25')](function(_0x275244){if(!_[_0x99f2('0x93')](_0x275244)){var _0x1037f9=[];for(var _0x19639d=0x0;_0x19639d<_0x275244[_0x99f2('0x40')];_0x19639d++){if(_0x275244[_0x19639d]['online']){_0x1037f9[_0x99f2('0x85')](db[_0x99f2('0x76')][_0x99f2('0x73')]({'membername':_0x275244[_0x19639d][_0x99f2('0x35')],'UserId':_0x275244[_0x19639d]['id'],'queue_name':_0x5f9bab[_0x99f2('0x35')],'VoiceQueueId':_0x5f9bab['id'],'interface':_['isNil'](_0x275244[_0x19639d][_0x99f2('0x6d')])?util[_0x99f2('0x78')]('SIP/%s',_0x275244[_0x19639d][_0x99f2('0x35')]):_0x275244[_0x19639d][_0x99f2('0x6d')],'paused':_0x275244[_0x19639d][_0x99f2('0x7a')]||![],'penalty':_0x1633a4[_0x99f2('0x50')][_0x99f2('0x70')]||0x0}));}}return BPromise['all'](_0x1037f9);}})[_0x99f2('0x25')](function(){return _0x404897;})[_0x99f2('0x25')](respondWithResult(_0x339013,null))[_0x99f2('0x4c')](handleError(_0x339013,null));};exports['removeAgents']=function(_0x2ecfa7,_0x22ff71,_0x41507f){return db[_0x99f2('0x38')]['find']({'where':{'id':_0x2ecfa7[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x22ff71,null))[_0x99f2('0x25')](function(_0x5c29f0){if(_0x5c29f0){return _0x5c29f0[_0x99f2('0x8d')](_0x2ecfa7['query'][_0x99f2('0x8f')])[_0x99f2('0x25')](function(){if(_[_0x99f2('0x94')](_0x2ecfa7[_0x99f2('0x3c')][_0x99f2('0x8f')])){for(var _0x3fc5fb=0x0;_0x3fc5fb<_0x2ecfa7['query'][_0x99f2('0x8f')][_0x99f2('0x40')];_0x3fc5fb+=0x1){socket[_0x99f2('0x7c')](_0x99f2('0x95'),{'UserId':Number(_0x2ecfa7[_0x99f2('0x3c')]['ids'][_0x3fc5fb]),'VoiceQueueId':Number(_0x2ecfa7[_0x99f2('0x5c')]['id'])});}}else{socket[_0x99f2('0x7c')](_0x99f2('0x95'),{'UserId':Number(_0x2ecfa7[_0x99f2('0x3c')][_0x99f2('0x8f')]),'VoiceQueueId':Number(_0x2ecfa7[_0x99f2('0x5c')]['id'])});}});}})[_0x99f2('0x25')](function(_0x172c5a){return db[_0x99f2('0x76')]['destroy']({'where':{'VoiceQueueId':_0x2ecfa7[_0x99f2('0x5c')]['id'],'UserId':_0x2ecfa7[_0x99f2('0x3c')][_0x99f2('0x8f')]}})[_0x99f2('0x25')](function(){return _0x172c5a;});})[_0x99f2('0x25')](respondWithStatusCode(_0x22ff71,null))['catch'](handleError(_0x22ff71,null));};exports[_0x99f2('0x96')]=function(_0x5ccabe,_0x5c161c,_0x45bb7a){var _0x4bfe72={};var _0x2d8c45={};var _0x1c23dd;var _0x428f67;return db['VoiceQueue'][_0x99f2('0x5e')]({'where':{'id':_0x5ccabe[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x5c161c,null))[_0x99f2('0x25')](function(_0x1f3c90){if(_0x1f3c90){_0x1c23dd=_0x1f3c90;_0x2d8c45[_0x99f2('0x3b')]=_[_0x99f2('0x3d')](db[_0x99f2('0x6c')][_0x99f2('0x39')]);_0x2d8c45[_0x99f2('0x3c')]=_[_0x99f2('0x3d')](_0x5ccabe[_0x99f2('0x3c')]);_0x2d8c45['filters']=_[_0x99f2('0x3e')](_0x2d8c45[_0x99f2('0x3b')],_0x2d8c45[_0x99f2('0x3c')]);_0x4bfe72['attributes']=_[_0x99f2('0x3e')](_0x2d8c45['model'],qs[_0x99f2('0x4d')](_0x5ccabe['query'][_0x99f2('0x4d')]));_0x4bfe72[_0x99f2('0x3f')]=_0x4bfe72[_0x99f2('0x3f')]['length']?_0x4bfe72['attributes']:_0x2d8c45['model'];_0x4bfe72[_0x99f2('0x42')]=qs[_0x99f2('0x60')](_0x5ccabe[_0x99f2('0x3c')]['sort']);_0x4bfe72[_0x99f2('0x43')]=qs[_0x99f2('0x45')](_[_0x99f2('0x44')](_0x5ccabe['query'],_0x2d8c45['filters']));if(_0x5ccabe[_0x99f2('0x3c')]['filter']){_0x4bfe72[_0x99f2('0x43')]=_['merge'](_0x4bfe72['where'],{'$or':_[_0x99f2('0x2e')](_0x4bfe72[_0x99f2('0x3f')],function(_0x4e9efc){var _0xbad630={};_0xbad630[_0x4e9efc]={'$like':'%'+_0x5ccabe[_0x99f2('0x3c')]['filter']+'%'};return _0xbad630;})});}_0x4bfe72=_[_0x99f2('0x4e')]({},_0x4bfe72,_0x5ccabe[_0x99f2('0x47')]);return _0x1c23dd[_0x99f2('0x96')](_0x4bfe72);}})[_0x99f2('0x25')](function(_0x4d850f){if(_0x4d850f){_0x428f67=_0x4d850f[_0x99f2('0x40')];if(!_0x5ccabe[_0x99f2('0x3c')][_0x99f2('0x41')]('nolimit')){_0x4bfe72[_0x99f2('0x20')]=qs['limit'](_0x5ccabe[_0x99f2('0x3c')][_0x99f2('0x20')]);_0x4bfe72[_0x99f2('0x1d')]=qs['offset'](_0x5ccabe[_0x99f2('0x3c')][_0x99f2('0x1d')]);}return _0x1c23dd[_0x99f2('0x96')](_0x4bfe72);}})[_0x99f2('0x25')](function(_0x3b3d0a){if(_0x3b3d0a){return _0x3b3d0a?{'count':_0x428f67,'rows':_0x3b3d0a}:null;}})['then'](respondWithResult(_0x5c161c,null))[_0x99f2('0x4c')](handleError(_0x5c161c,null));};exports[_0x99f2('0x97')]=function(_0x25b9d8,_0x12722a,_0x519253){var _0x15d216={};var _0x498c2f={};var _0x5a0a29;var _0x8841c8;return db[_0x99f2('0x38')][_0x99f2('0x5e')]({'where':{'id':_0x25b9d8[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x12722a,null))[_0x99f2('0x25')](function(_0x41ac3c){if(_0x41ac3c){_0x5a0a29=_0x41ac3c;_0x498c2f[_0x99f2('0x3b')]=_['keys'](db[_0x99f2('0x76')][_0x99f2('0x39')]);_0x498c2f[_0x99f2('0x3c')]=_['keys'](_0x25b9d8['query']);_0x498c2f[_0x99f2('0x45')]=_['intersection'](_0x498c2f[_0x99f2('0x3b')],_0x498c2f[_0x99f2('0x3c')]);_0x15d216[_0x99f2('0x3f')]=_[_0x99f2('0x3e')](_0x498c2f[_0x99f2('0x3b')],qs[_0x99f2('0x4d')](_0x25b9d8['query'][_0x99f2('0x4d')]));_0x15d216[_0x99f2('0x3f')]=_0x15d216[_0x99f2('0x3f')][_0x99f2('0x40')]?_0x15d216[_0x99f2('0x3f')]:_0x498c2f[_0x99f2('0x3b')];_0x15d216[_0x99f2('0x42')]=qs[_0x99f2('0x60')](_0x25b9d8[_0x99f2('0x3c')]['sort']);_0x15d216['where']=qs[_0x99f2('0x45')](_[_0x99f2('0x44')](_0x25b9d8[_0x99f2('0x3c')],_0x498c2f['filters']));if(_0x25b9d8[_0x99f2('0x3c')][_0x99f2('0x2c')]){_0x15d216[_0x99f2('0x43')]=_[_0x99f2('0x4e')](_0x15d216[_0x99f2('0x43')],{'$or':_[_0x99f2('0x2e')](_0x15d216['attributes'],function(_0x2d50d3){var _0x1051c2={};_0x1051c2[_0x2d50d3]={'$like':'%'+_0x25b9d8[_0x99f2('0x3c')][_0x99f2('0x2c')]+'%'};return _0x1051c2;})});}_0x15d216=_[_0x99f2('0x4e')]({},_0x15d216,_0x25b9d8[_0x99f2('0x47')]);return _0x5a0a29[_0x99f2('0x97')](_0x15d216);}})[_0x99f2('0x25')](function(_0x1088aa){if(_0x1088aa){_0x8841c8=_0x1088aa['length'];if(!_0x25b9d8[_0x99f2('0x3c')]['hasOwnProperty'](_0x99f2('0x5f'))){_0x15d216[_0x99f2('0x20')]=qs[_0x99f2('0x20')](_0x25b9d8['query'][_0x99f2('0x20')]);_0x15d216['offset']=qs['offset'](_0x25b9d8[_0x99f2('0x3c')]['offset']);}return _0x5a0a29[_0x99f2('0x97')](_0x15d216);}})[_0x99f2('0x25')](function(_0x1da2ac){return _0x1da2ac?{'count':_0x8841c8,'rows':_0x1da2ac}:null;})[_0x99f2('0x25')](respondWithResult(_0x12722a,null))[_0x99f2('0x4c')](handleError(_0x12722a,null));};exports[_0x99f2('0x98')]=function(_0x16b78f,_0x55167c,_0x262ba5){var _0x1526dd={};var _0x3c6c48={};var _0x2f75c5;var _0x295b58;return db[_0x99f2('0x38')]['findOne']({'where':{'id':_0x16b78f[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x55167c,null))[_0x99f2('0x25')](function(_0x1e8c7e){if(_0x1e8c7e){_0x2f75c5=_0x1e8c7e;_0x3c6c48[_0x99f2('0x3b')]=_['keys'](db[_0x99f2('0x99')][_0x99f2('0x39')]);_0x3c6c48['query']=_[_0x99f2('0x3d')](_0x16b78f[_0x99f2('0x3c')]);_0x3c6c48[_0x99f2('0x45')]=_[_0x99f2('0x3e')](_0x3c6c48['model'],_0x3c6c48['query']);_0x1526dd['attributes']=_[_0x99f2('0x3e')](_0x3c6c48[_0x99f2('0x3b')],qs[_0x99f2('0x4d')](_0x16b78f[_0x99f2('0x3c')][_0x99f2('0x4d')]));_0x1526dd[_0x99f2('0x3f')]=_0x1526dd[_0x99f2('0x3f')][_0x99f2('0x40')]?_0x1526dd[_0x99f2('0x3f')]:_0x3c6c48[_0x99f2('0x3b')];_0x1526dd[_0x99f2('0x42')]=qs[_0x99f2('0x60')](_0x16b78f[_0x99f2('0x3c')]['sort']);_0x1526dd[_0x99f2('0x43')]=qs[_0x99f2('0x45')](_['pick'](_0x16b78f[_0x99f2('0x3c')],_0x3c6c48['filters']));if(_0x16b78f[_0x99f2('0x3c')]['filter']){_0x1526dd[_0x99f2('0x43')]=_[_0x99f2('0x4e')](_0x1526dd[_0x99f2('0x43')],{'$or':_[_0x99f2('0x2e')](_0x1526dd['attributes'],function(_0xfdb0c3){var _0x33ba4b={};_0x33ba4b[_0xfdb0c3]={'$like':'%'+_0x16b78f[_0x99f2('0x3c')][_0x99f2('0x2c')]+'%'};return _0x33ba4b;})});}_0x1526dd=_[_0x99f2('0x4e')]({},_0x1526dd,_0x16b78f[_0x99f2('0x47')]);return _0x2f75c5['getLists'](_0x1526dd);}})[_0x99f2('0x25')](function(_0x160e1a){if(_0x160e1a){_0x295b58=_0x160e1a[_0x99f2('0x40')];if(!_0x16b78f[_0x99f2('0x3c')][_0x99f2('0x41')](_0x99f2('0x5f'))){_0x1526dd[_0x99f2('0x20')]=qs[_0x99f2('0x20')](_0x16b78f[_0x99f2('0x3c')]['limit']);_0x1526dd[_0x99f2('0x1d')]=qs[_0x99f2('0x1d')](_0x16b78f[_0x99f2('0x3c')]['offset']);}return _0x2f75c5['getLists'](_0x1526dd);}})['then'](function(_0x188237){if(_0x188237){return _0x188237?{'count':_0x295b58,'rows':_0x188237}:null;}})['then'](respondWithResult(_0x55167c,null))[_0x99f2('0x4c')](handleError(_0x55167c,null));};exports['addLists']=function(_0x277fbc,_0x321ffb,_0x5c3ebd){var _0x46d158,_0x343759;return db[_0x99f2('0x38')][_0x99f2('0x32')]({'where':{'id':_0x277fbc[_0x99f2('0x5c')]['id']}})['then'](handleEntityNotFound(_0x321ffb,null))['then'](function(_0x1b9609){if(_0x1b9609){_0x343759=_0x1b9609;return _0x1b9609[_0x99f2('0x9a')](_0x277fbc[_0x99f2('0x50')]['ids'],_['omit'](_0x277fbc[_0x99f2('0x50')],[_0x99f2('0x8f'),'id'])||{});}return null;})['spread'](function(_0xc91b81){var _0x29d1c6;_0x46d158=_0xc91b81||[];var _0x33fa77=[];if(_0xc91b81){for(var _0x22bbb8=0x0;_0x22bbb8<_0xc91b81[_0x99f2('0x40')];_0x22bbb8+=0x1){var _0xf6548c=_0xc91b81[_0x22bbb8][_0x99f2('0x27')]({'plain':!![]});_0x343759[_0x99f2('0x9b')]=_0x277fbc[_0x99f2('0x50')][_0x99f2('0x9b')]?_0x277fbc[_0x99f2('0x50')]['dialCheckDuplicateType']:_0x343759[_0x99f2('0x9b')];switch(_0x343759['dialCheckDuplicateType']){case _0x99f2('0x9c'):_0x29d1c6=squel['insert']()[_0x99f2('0x9d')](_0x99f2('0x9e'))[_0x99f2('0x9f')]([_0x99f2('0xa0'),_0x99f2('0xa1'),_0x99f2('0xa2'),_0x99f2('0xa3'),_0x99f2('0x61'),_0x99f2('0x58'),_0x99f2('0x57')],squel[_0x99f2('0x7e')]()[_0x99f2('0x7f')](_0x99f2('0xa0'),_0x99f2('0xa0'))[_0x99f2('0x7f')](_0x99f2('0xa4'),_0x99f2('0xa1'))['field']('id','ContactId')[_0x99f2('0x7f')](_0xf6548c[_0x99f2('0xa5')]['toString'](),'ListId')[_0x99f2('0x7f')](_0x277fbc[_0x99f2('0x5c')]['id'][_0x99f2('0x86')](),'VoiceQueueId')['field']('NOW()',_0x99f2('0x58'))[_0x99f2('0x7f')](_0x99f2('0xa4'),_0x99f2('0x57'))[_0x99f2('0xa6')](_0x99f2('0xa7'))[_0x99f2('0x43')]('deletedAt\x20IS\x20NULL')[_0x99f2('0x43')](_0x99f2('0xa8'),_0xf6548c[_0x99f2('0xa5')][_0x99f2('0x86')]())[_0x99f2('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x99f2('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x99f2('0x7e')]()[_0x99f2('0x7f')](_0x99f2('0xa9'))['from'](_0x99f2('0xaa'))['where'](_0x99f2('0xab'),_0x277fbc['params']['id']['toString']()))['where'](_0x99f2('0xac'),squel['select']()[_0x99f2('0x7f')]('COALESCE(phone,\x27\x27)')[_0x99f2('0xa6')](_0x99f2('0x9e'))[_0x99f2('0x43')](_0x99f2('0xab'),_0x277fbc[_0x99f2('0x5c')]['id'][_0x99f2('0x86')]())))[_0x99f2('0x86')]();break;case _0x99f2('0xad'):_0x29d1c6=squel['insert']()['into'](_0x99f2('0x9e'))[_0x99f2('0x9f')](['phone',_0x99f2('0xa1'),'ContactId','ListId',_0x99f2('0x61'),_0x99f2('0x58'),_0x99f2('0x57')],squel['select']()[_0x99f2('0x7f')]('phone','phone')[_0x99f2('0x7f')]('NOW()',_0x99f2('0xa1'))['field']('id',_0x99f2('0xa2'))['field'](_0xf6548c[_0x99f2('0xa5')][_0x99f2('0x86')](),_0x99f2('0xa3'))[_0x99f2('0x7f')](_0x277fbc['params']['id'][_0x99f2('0x86')](),_0x99f2('0x61'))[_0x99f2('0x7f')](_0x99f2('0xa4'),'createdAt')['field'](_0x99f2('0xa4'),_0x99f2('0x57'))[_0x99f2('0xa6')](_0x99f2('0xa7'))['where'](_0x99f2('0xae'))[_0x99f2('0x43')]('ListId\x20=\x20?',_0xf6548c[_0x99f2('0xa5')][_0x99f2('0x86')]())[_0x99f2('0x43')](_0x99f2('0xaf'))[_0x99f2('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x99f2('0x7e')]()[_0x99f2('0x7f')](_0x99f2('0xb0'))['from']('cm_hopper')['where'](_0x99f2('0xab'),_0x277fbc[_0x99f2('0x5c')]['id'][_0x99f2('0x86')]())))['toString']();break;default:_0x29d1c6=squel[_0x99f2('0xb1')]()[_0x99f2('0x9d')](_0x99f2('0x9e'))[_0x99f2('0x9f')](['phone',_0x99f2('0xa1'),_0x99f2('0xa2'),'ListId',_0x99f2('0x61'),_0x99f2('0x58'),_0x99f2('0x57')],squel[_0x99f2('0x7e')]()[_0x99f2('0x7f')]('phone',_0x99f2('0xa0'))[_0x99f2('0x7f')](_0x99f2('0xa4'),_0x99f2('0xa1'))[_0x99f2('0x7f')]('id',_0x99f2('0xa2'))['field'](_0xf6548c[_0x99f2('0xa5')][_0x99f2('0x86')](),_0x99f2('0xa3'))['field'](_0x277fbc[_0x99f2('0x5c')]['id']['toString'](),'VoiceQueueId')['field'](_0x99f2('0xa4'),_0x99f2('0x58'))[_0x99f2('0x7f')](_0x99f2('0xa4'),_0x99f2('0x57'))['from'](_0x99f2('0xa7'))[_0x99f2('0x43')](_0x99f2('0xae'))[_0x99f2('0x43')](_0x99f2('0xa8'),_0xf6548c[_0x99f2('0xa5')][_0x99f2('0x86')]())[_0x99f2('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x99f2('0x86')]();}_0x33fa77[_0x99f2('0x85')](db[_0x99f2('0x71')][_0x99f2('0x3c')](_0x29d1c6));}return BPromise[_0x99f2('0x8a')](_0x33fa77);}})[_0x99f2('0x25')](function(){return _0x46d158;})[_0x99f2('0x25')](respondWithResult(_0x321ffb,null))[_0x99f2('0x4c')](handleError(_0x321ffb,null));};exports[_0x99f2('0xb2')]=function(_0x18c110,_0x51f23a,_0x4f57be){return db[_0x99f2('0x38')]['find']({'where':{'id':_0x18c110[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x51f23a,null))[_0x99f2('0x25')](function(_0x7612fa){if(_0x7612fa){return _0x7612fa['removeLists'](_0x18c110[_0x99f2('0x3c')][_0x99f2('0x8f')]);}})[_0x99f2('0x25')](function(_0x4520b4){if(_0x4520b4){return db[_0x99f2('0x62')]['destroy']({'where':{'ListId':_0x18c110[_0x99f2('0x3c')][_0x99f2('0x8f')],'VoiceQueueId':_0x18c110[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](function(){return _0x4520b4;});}})[_0x99f2('0x25')](respondWithStatusCode(_0x51f23a,null))[_0x99f2('0x4c')](handleError(_0x51f23a,null));};exports[_0x99f2('0xb3')]=function(_0x5f3a09,_0x7ebab9,_0xb015f5){var _0x3ebd7d={};var _0x55575f={};var _0x3bdc94;var _0x34859b;return db[_0x99f2('0x38')]['findOne']({'where':{'id':_0x5f3a09[_0x99f2('0x5c')]['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x7ebab9,null))[_0x99f2('0x25')](function(_0x1648d5){if(_0x1648d5){_0x3bdc94=_0x1648d5;_0x55575f[_0x99f2('0x3b')]=_[_0x99f2('0x3d')](db[_0x99f2('0x99')][_0x99f2('0x39')]);_0x55575f[_0x99f2('0x3c')]=_['keys'](_0x5f3a09[_0x99f2('0x3c')]);_0x55575f[_0x99f2('0x45')]=_[_0x99f2('0x3e')](_0x55575f[_0x99f2('0x3b')],_0x55575f[_0x99f2('0x3c')]);_0x3ebd7d[_0x99f2('0x3f')]=_[_0x99f2('0x3e')](_0x55575f['model'],qs[_0x99f2('0x4d')](_0x5f3a09[_0x99f2('0x3c')][_0x99f2('0x4d')]));_0x3ebd7d[_0x99f2('0x3f')]=_0x3ebd7d['attributes']['length']?_0x3ebd7d[_0x99f2('0x3f')]:_0x55575f['model'];_0x3ebd7d['order']=qs[_0x99f2('0x60')](_0x5f3a09[_0x99f2('0x3c')][_0x99f2('0x60')]);_0x3ebd7d[_0x99f2('0x43')]=qs[_0x99f2('0x45')](_['pick'](_0x5f3a09[_0x99f2('0x3c')],_0x55575f[_0x99f2('0x45')]));if(_0x5f3a09[_0x99f2('0x3c')][_0x99f2('0x2c')]){_0x3ebd7d[_0x99f2('0x43')]=_[_0x99f2('0x4e')](_0x3ebd7d[_0x99f2('0x43')],{'$or':_[_0x99f2('0x2e')](_0x3ebd7d['attributes'],function(_0x2238b0){var _0x15445a={};_0x15445a[_0x2238b0]={'$like':'%'+_0x5f3a09[_0x99f2('0x3c')][_0x99f2('0x2c')]+'%'};return _0x15445a;})});}_0x3ebd7d=_['merge']({},_0x3ebd7d,_0x5f3a09[_0x99f2('0x47')]);return _0x3bdc94['getBlackLists'](_0x3ebd7d);}})[_0x99f2('0x25')](function(_0x5df301){if(_0x5df301){_0x34859b=_0x5df301[_0x99f2('0x40')];if(!_0x5f3a09[_0x99f2('0x3c')][_0x99f2('0x41')](_0x99f2('0x5f'))){_0x3ebd7d['limit']=qs[_0x99f2('0x20')](_0x5f3a09[_0x99f2('0x3c')]['limit']);_0x3ebd7d[_0x99f2('0x1d')]=qs['offset'](_0x5f3a09[_0x99f2('0x3c')][_0x99f2('0x1d')]);}return _0x3bdc94[_0x99f2('0xb3')](_0x3ebd7d);}})['then'](function(_0x1e38d1){if(_0x1e38d1){return _0x1e38d1?{'count':_0x34859b,'rows':_0x1e38d1}:null;}})[_0x99f2('0x25')](respondWithResult(_0x7ebab9,null))['catch'](handleError(_0x7ebab9,null));};exports['addBlackLists']=function(_0x48df81,_0x558226,_0xad7f79){var _0x530a92,_0x53eeb2;return db[_0x99f2('0x38')][_0x99f2('0x32')]({'where':{'id':_0x48df81['params']['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x558226,null))[_0x99f2('0x25')](function(_0x440785){if(_0x440785){_0x53eeb2=_0x440785;return _0x440785[_0x99f2('0xb4')](_0x48df81[_0x99f2('0x50')][_0x99f2('0x8f')],_[_0x99f2('0x56')](_0x48df81[_0x99f2('0x50')],[_0x99f2('0x8f'),'id'])||{});}return null;})[_0x99f2('0x90')](function(_0x2b15ee){var _0xdfddff;_0x530a92=_0x2b15ee||[];var _0x49b72c=[];if(_0x2b15ee){for(var _0x5224a5=0x0;_0x5224a5<_0x2b15ee['length'];_0x5224a5+=0x1){var _0x3244d9=_0x2b15ee[_0x5224a5][_0x99f2('0x27')]({'plain':!![]});_0xdfddff=squel[_0x99f2('0xb1')]()[_0x99f2('0x9d')](_0x99f2('0xb5'))[_0x99f2('0x9f')](['phone','ContactId',_0x99f2('0xa3'),'VoiceQueueId','createdAt',_0x99f2('0x57')],squel[_0x99f2('0x7e')]()['field']('phone',_0x99f2('0xa0'))[_0x99f2('0x7f')]('id','ContactId')['field'](_0x3244d9['CmListId'][_0x99f2('0x86')](),_0x99f2('0xa3'))[_0x99f2('0x7f')](_0x48df81[_0x99f2('0x5c')]['id']['toString'](),_0x99f2('0x61'))['field'](_0x99f2('0xa4'),_0x99f2('0x58'))[_0x99f2('0x7f')](_0x99f2('0xa4'),'updatedAt')['from'](_0x99f2('0xa7'))[_0x99f2('0x43')](_0x99f2('0xae'))[_0x99f2('0x43')](_0x99f2('0xa8'),_0x3244d9[_0x99f2('0xa5')][_0x99f2('0x86')]())[_0x99f2('0x43')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x49b72c[_0x99f2('0x85')](db['sequelize'][_0x99f2('0x3c')](_0xdfddff));}return BPromise['all'](_0x49b72c);}})['then'](function(){return _0x530a92;})[_0x99f2('0x25')](respondWithResult(_0x558226,null))['catch'](handleError(_0x558226,null));};exports[_0x99f2('0xb6')]=function(_0x5800ce,_0x1e0bf0,_0xb37e1d){return db['VoiceQueue'][_0x99f2('0x32')]({'where':{'id':_0x5800ce['params']['id']}})[_0x99f2('0x25')](handleEntityNotFound(_0x1e0bf0,null))[_0x99f2('0x25')](function(_0x414c49){if(_0x414c49){return _0x414c49['removeBlackLists'](_0x5800ce[_0x99f2('0x3c')][_0x99f2('0x8f')]);}})['then'](function(_0x20617a){if(_0x20617a){return db[_0x99f2('0x67')][_0x99f2('0x26')]({'where':{'ListId':_0x5800ce[_0x99f2('0x3c')]['ids'],'VoiceQueueId':_0x5800ce['params']['id']}})[_0x99f2('0x25')](function(){return _0x20617a;});}})[_0x99f2('0x25')](respondWithStatusCode(_0x1e0bf0,null))[_0x99f2('0x4c')](handleError(_0x1e0bf0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 883aeef..54c05af 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 _0xae6d=['update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x3971ab,_0x1021c1){var _0xe5d74c=function(_0x3d10f7){while(--_0x3d10f7){_0x3971ab['push'](_0x3971ab['shift']());}};_0xe5d74c(++_0x1021c1);}(_0xae6d,0xd7));var _0xdae6=function(_0x397014,_0x17cc12){_0x397014=_0x397014-0x0;var _0x1163f7=_0xae6d[_0x397014];return _0x1163f7;};'use strict';var EventEmitter=require(_0xdae6('0x0'));var VoiceQueue=require(_0xdae6('0x1'))['db'][_0xdae6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xdae6('0x3')](0x0);var events={'afterCreate':_0xdae6('0x4'),'afterUpdate':_0xdae6('0x5'),'afterDestroy':_0xdae6('0x6')};function emitEvent(_0x4b997a){return function(_0x5dea21,_0xd2c29a,_0x9121b9){VoiceQueueEvents[_0xdae6('0x7')](_0x4b997a+':'+_0x5dea21['id'],_0x5dea21);VoiceQueueEvents[_0xdae6('0x7')](_0x4b997a,_0x5dea21);_0x9121b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xdae6('0x8')](e,emitEvent(event));}}module[_0xdae6('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xcb48=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit','hook'];(function(_0x5295a5,_0x2f106a){var _0x499291=function(_0x5e2f29){while(--_0x5e2f29){_0x5295a5['push'](_0x5295a5['shift']());}};_0x499291(++_0x2f106a);}(_0xcb48,0xc7));var _0x8cb4=function(_0x115677,_0x5d5f2b){_0x115677=_0x115677-0x0;var _0x367d1c=_0xcb48[_0x115677];return _0x367d1c;};'use strict';var EventEmitter=require(_0x8cb4('0x0'));var VoiceQueue=require(_0x8cb4('0x1'))['db'][_0x8cb4('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8cb4('0x3')](0x0);var events={'afterCreate':_0x8cb4('0x4'),'afterUpdate':'update','afterDestroy':_0x8cb4('0x5')};function emitEvent(_0x2e6faa){return function(_0x9785c0,_0x5b1084,_0x471d47){VoiceQueueEvents[_0x8cb4('0x6')](_0x2e6faa+':'+_0x9785c0['id'],_0x9785c0);VoiceQueueEvents['emit'](_0x2e6faa,_0x9785c0);_0x471d47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x8cb4('0x7')](e,emitEvent(event));}}module[_0x8cb4('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 8201171..723d4fa 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2c3028,_0x1e3edf){var _0x786274=function(_0xc128e5){while(--_0xc128e5){_0x2c3028['push'](_0x2c3028['shift']());}};_0x786274(++_0x1e3edf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1a61e1,_0x2e3ecb){var _0xeab969=function(_0xf9fe08){while(--_0xf9fe08){_0x1a61e1['push'](_0x1a61e1['shift']());}};_0xeab969(++_0x2e3ecb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 00f841c..0db86ec 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 _0xdb58=['defaults','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','attributes','model','find','ShowVoiceQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis'];(function(_0x5abe2e,_0x5c1dfc){var _0x5bfd79=function(_0xc436bd){while(--_0xc436bd){_0x5abe2e['push'](_0x5abe2e['shift']());}};_0x5bfd79(++_0x5c1dfc);}(_0xdb58,0xdf));var _0x8db5=function(_0x3f815f,_0x481053){_0x3f815f=_0x3f815f-0x0;var _0x5a65c6=_0xdb58[_0x3f815f];return _0x5a65c6;};'use strict';var _=require(_0x8db5('0x0'));var util=require(_0x8db5('0x1'));var moment=require(_0x8db5('0x2'));var BPromise=require(_0x8db5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8db5('0x5'));var logger=require('../../config/logger')(_0x8db5('0x6'));var config=require(_0x8db5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8db5('0x8')][_0x8db5('0x9')]({'port':0x232a});config[_0x8db5('0xa')]=_[_0x8db5('0xb')](config[_0x8db5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8db5('0xc'))(new Redis(config['redis']));require(_0x8db5('0xd'))['register'](socket);function respondWithRpcPromise(_0x3e6083,_0x3abcf4,_0x3e57ae){return new BPromise(function(_0x442af0,_0xab0833){return client[_0x8db5('0xe')](_0x3e6083,_0x3e57ae)[_0x8db5('0xf')](function(_0x409d17){logger[_0x8db5('0x10')](_0x8db5('0x11'),_0x3abcf4,_0x8db5('0x12'));logger[_0x8db5('0x13')](_0x8db5('0x14'),_0x3abcf4,_0x8db5('0x12'),JSON[_0x8db5('0x15')](_0x409d17));if(_0x409d17[_0x8db5('0x16')]){if(_0x409d17['error'][_0x8db5('0x17')]===0x1f4){logger[_0x8db5('0x16')](_0x8db5('0x11'),_0x3abcf4,_0x409d17[_0x8db5('0x16')][_0x8db5('0x18')]);return _0xab0833(_0x409d17[_0x8db5('0x16')][_0x8db5('0x18')]);}logger[_0x8db5('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x3abcf4,_0x409d17[_0x8db5('0x16')][_0x8db5('0x18')]);return _0x442af0(_0x409d17[_0x8db5('0x16')]['message']);}else{logger['info'](_0x8db5('0x11'),_0x3abcf4,'request\x20sent');_0x442af0(_0x409d17['result'][_0x8db5('0x18')]);}})[_0x8db5('0x19')](function(_0x1b4036){logger[_0x8db5('0x16')](_0x8db5('0x11'),_0x3abcf4,_0x1b4036);_0xab0833(_0x1b4036);});});}exports[_0x8db5('0x1a')]=function(_0x1bfbdc){var _0x5f43a3=this;return new Promise(function(_0x481136,_0x537083){return db[_0x8db5('0x1b')][_0x8db5('0x1c')]({'raw':_0x1bfbdc[_0x8db5('0x1d')]?_0x1bfbdc[_0x8db5('0x1d')][_0x8db5('0x1e')]===undefined?!![]:![]:!![],'where':_0x1bfbdc['options']?_0x1bfbdc['options'][_0x8db5('0x1f')]||null:null,'attributes':_0x1bfbdc['options']?_0x1bfbdc[_0x8db5('0x1d')]['attributes']||null:null,'limit':_0x1bfbdc[_0x8db5('0x1d')]?_0x1bfbdc['options'][_0x8db5('0x20')]||null:null,'include':_0x1bfbdc[_0x8db5('0x1d')]?_0x1bfbdc[_0x8db5('0x1d')][_0x8db5('0x21')]?_[_0x8db5('0x22')](_0x1bfbdc[_0x8db5('0x1d')][_0x8db5('0x21')],function(_0x6f0539){return{'model':db[_0x6f0539['model']],'as':_0x6f0539['as'],'attributes':_0x6f0539[_0x8db5('0x23')],'include':_0x6f0539[_0x8db5('0x21')]?_['map'](_0x6f0539[_0x8db5('0x21')],function(_0x78d0e4){return{'model':db[_0x78d0e4['model']],'as':_0x78d0e4['as'],'attributes':_0x78d0e4['attributes'],'include':_0x78d0e4[_0x8db5('0x21')]?_[_0x8db5('0x22')](_0x78d0e4['include'],function(_0x1d2c83){return{'model':db[_0x1d2c83[_0x8db5('0x24')]],'as':_0x1d2c83['as'],'attributes':_0x1d2c83[_0x8db5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8db5('0xf')](function(_0x20d31e){logger[_0x8db5('0x10')](_0x8db5('0x1a'),_0x1bfbdc);logger[_0x8db5('0x13')](_0x8db5('0x1a'),_0x1bfbdc,JSON[_0x8db5('0x15')](_0x20d31e));_0x481136(_0x20d31e);})[_0x8db5('0x19')](function(_0x324f8b){logger[_0x8db5('0x16')](_0x8db5('0x1a'),_0x324f8b[_0x8db5('0x18')],_0x1bfbdc);_0x537083(_0x5f43a3[_0x8db5('0x16')](0x1f4,_0x324f8b['message']));});});};exports['ShowVoiceQueue']=function(_0x473bac){var _0x57ee5a=this;return new Promise(function(_0x64cb7,_0x44afe2){return db['VoiceQueue'][_0x8db5('0x25')]({'raw':_0x473bac[_0x8db5('0x1d')]?_0x473bac['options'][_0x8db5('0x1e')]===undefined?!![]:![]:!![],'where':_0x473bac[_0x8db5('0x1d')]?_0x473bac['options'][_0x8db5('0x1f')]||null:null,'attributes':_0x473bac[_0x8db5('0x1d')]?_0x473bac['options'][_0x8db5('0x23')]||null:null,'include':_0x473bac[_0x8db5('0x1d')]?_0x473bac[_0x8db5('0x1d')][_0x8db5('0x21')]?_[_0x8db5('0x22')](_0x473bac[_0x8db5('0x1d')][_0x8db5('0x21')],function(_0x2c36fa){return{'model':db[_0x2c36fa[_0x8db5('0x24')]],'as':_0x2c36fa['as'],'attributes':_0x2c36fa['attributes'],'include':_0x2c36fa[_0x8db5('0x21')]?_[_0x8db5('0x22')](_0x2c36fa[_0x8db5('0x21')],function(_0x2163ee){return{'model':db[_0x2163ee[_0x8db5('0x24')]],'as':_0x2163ee['as'],'attributes':_0x2163ee[_0x8db5('0x23')],'include':_0x2163ee['include']?_['map'](_0x2163ee[_0x8db5('0x21')],function(_0x531703){return{'model':db[_0x531703['model']],'as':_0x531703['as'],'attributes':_0x531703[_0x8db5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8db5('0xf')](function(_0x52e83b){logger['info']('ShowVoiceQueue',_0x473bac);logger[_0x8db5('0x13')](_0x8db5('0x26'),_0x473bac,JSON[_0x8db5('0x15')](_0x52e83b));_0x64cb7(_0x52e83b);})[_0x8db5('0x19')](function(_0x57a6be){logger[_0x8db5('0x16')](_0x8db5('0x26'),_0x57a6be['message'],_0x473bac);_0x44afe2(_0x57ee5a[_0x8db5('0x16')](0x1f4,_0x57a6be[_0x8db5('0x18')]));});});}; \ No newline at end of file +var _0x7b00=['then','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueue','findAll','raw','options','where','attributes','limit','include','map','model','debug','stringify','ShowVoiceQueue','VoiceQueue'];(function(_0x489b27,_0x1131a0){var _0x39cb1b=function(_0x3786d8){while(--_0x3786d8){_0x489b27['push'](_0x489b27['shift']());}};_0x39cb1b(++_0x1131a0);}(_0x7b00,0x10b));var _0x07b0=function(_0x486271,_0x506573){_0x486271=_0x486271-0x0;var _0x2176ad=_0x7b00[_0x486271];return _0x2176ad;};'use strict';var _=require('lodash');var util=require(_0x07b0('0x0'));var moment=require('moment');var BPromise=require(_0x07b0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07b0('0x2'))['db'];var utils=require(_0x07b0('0x3'));var logger=require(_0x07b0('0x4'))('rpc');var config=require(_0x07b0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x07b0('0x6')][_0x07b0('0x7')]({'port':0x232a});config['redis']=_[_0x07b0('0x8')](config[_0x07b0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x07b0('0xa'))(new Redis(config[_0x07b0('0x9')]));require(_0x07b0('0xb'))[_0x07b0('0xc')](socket);function respondWithRpcPromise(_0x21ba32,_0x4541cc,_0x29cf9e){return new BPromise(function(_0x106b05,_0x370a4c){return client[_0x07b0('0xd')](_0x21ba32,_0x29cf9e)['then'](function(_0x2db7ce){logger[_0x07b0('0xe')](_0x07b0('0xf'),_0x4541cc,_0x07b0('0x10'));logger['debug'](_0x07b0('0x11'),_0x4541cc,_0x07b0('0x10'),JSON['stringify'](_0x2db7ce));if(_0x2db7ce['error']){if(_0x2db7ce[_0x07b0('0x12')][_0x07b0('0x13')]===0x1f4){logger[_0x07b0('0x12')](_0x07b0('0xf'),_0x4541cc,_0x2db7ce[_0x07b0('0x12')][_0x07b0('0x14')]);return _0x370a4c(_0x2db7ce['error']['message']);}logger[_0x07b0('0x12')](_0x07b0('0xf'),_0x4541cc,_0x2db7ce[_0x07b0('0x12')]['message']);return _0x106b05(_0x2db7ce[_0x07b0('0x12')][_0x07b0('0x14')]);}else{logger[_0x07b0('0xe')](_0x07b0('0xf'),_0x4541cc,_0x07b0('0x10'));_0x106b05(_0x2db7ce[_0x07b0('0x15')][_0x07b0('0x14')]);}})[_0x07b0('0x16')](function(_0x1a49fb){logger[_0x07b0('0x12')](_0x07b0('0xf'),_0x4541cc,_0x1a49fb);_0x370a4c(_0x1a49fb);});});}exports[_0x07b0('0x17')]=function(_0x202ec9){var _0x2d1c03=this;return new Promise(function(_0x3ccda0,_0x109af6){return db['VoiceQueue'][_0x07b0('0x18')]({'raw':_0x202ec9['options']?_0x202ec9['options'][_0x07b0('0x19')]===undefined?!![]:![]:!![],'where':_0x202ec9[_0x07b0('0x1a')]?_0x202ec9[_0x07b0('0x1a')][_0x07b0('0x1b')]||null:null,'attributes':_0x202ec9[_0x07b0('0x1a')]?_0x202ec9[_0x07b0('0x1a')][_0x07b0('0x1c')]||null:null,'limit':_0x202ec9[_0x07b0('0x1a')]?_0x202ec9['options'][_0x07b0('0x1d')]||null:null,'include':_0x202ec9[_0x07b0('0x1a')]?_0x202ec9[_0x07b0('0x1a')][_0x07b0('0x1e')]?_[_0x07b0('0x1f')](_0x202ec9[_0x07b0('0x1a')][_0x07b0('0x1e')],function(_0x2357e9){return{'model':db[_0x2357e9[_0x07b0('0x20')]],'as':_0x2357e9['as'],'attributes':_0x2357e9['attributes'],'include':_0x2357e9[_0x07b0('0x1e')]?_[_0x07b0('0x1f')](_0x2357e9[_0x07b0('0x1e')],function(_0x25ddf5){return{'model':db[_0x25ddf5[_0x07b0('0x20')]],'as':_0x25ddf5['as'],'attributes':_0x25ddf5[_0x07b0('0x1c')],'include':_0x25ddf5[_0x07b0('0x1e')]?_[_0x07b0('0x1f')](_0x25ddf5[_0x07b0('0x1e')],function(_0x30a2d1){return{'model':db[_0x30a2d1['model']],'as':_0x30a2d1['as'],'attributes':_0x30a2d1[_0x07b0('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31a33b){logger[_0x07b0('0xe')](_0x07b0('0x17'),_0x202ec9);logger[_0x07b0('0x21')](_0x07b0('0x17'),_0x202ec9,JSON[_0x07b0('0x22')](_0x31a33b));_0x3ccda0(_0x31a33b);})['catch'](function(_0x5bfa52){logger['error'](_0x07b0('0x17'),_0x5bfa52['message'],_0x202ec9);_0x109af6(_0x2d1c03[_0x07b0('0x12')](0x1f4,_0x5bfa52[_0x07b0('0x14')]));});});};exports[_0x07b0('0x23')]=function(_0x54228e){var _0x19c82f=this;return new Promise(function(_0x41cac8,_0x2f8df8){return db[_0x07b0('0x24')]['find']({'raw':_0x54228e[_0x07b0('0x1a')]?_0x54228e[_0x07b0('0x1a')][_0x07b0('0x19')]===undefined?!![]:![]:!![],'where':_0x54228e['options']?_0x54228e[_0x07b0('0x1a')][_0x07b0('0x1b')]||null:null,'attributes':_0x54228e[_0x07b0('0x1a')]?_0x54228e[_0x07b0('0x1a')][_0x07b0('0x1c')]||null:null,'include':_0x54228e['options']?_0x54228e[_0x07b0('0x1a')][_0x07b0('0x1e')]?_['map'](_0x54228e[_0x07b0('0x1a')][_0x07b0('0x1e')],function(_0x136263){return{'model':db[_0x136263[_0x07b0('0x20')]],'as':_0x136263['as'],'attributes':_0x136263['attributes'],'include':_0x136263[_0x07b0('0x1e')]?_['map'](_0x136263[_0x07b0('0x1e')],function(_0x18d757){return{'model':db[_0x18d757['model']],'as':_0x18d757['as'],'attributes':_0x18d757['attributes'],'include':_0x18d757[_0x07b0('0x1e')]?_[_0x07b0('0x1f')](_0x18d757[_0x07b0('0x1e')],function(_0x450f3b){return{'model':db[_0x450f3b[_0x07b0('0x20')]],'as':_0x450f3b['as'],'attributes':_0x450f3b[_0x07b0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x07b0('0x25')](function(_0xf6f9b2){logger['info'](_0x07b0('0x23'),_0x54228e);logger[_0x07b0('0x21')](_0x07b0('0x23'),_0x54228e,JSON['stringify'](_0xf6f9b2));_0x41cac8(_0xf6f9b2);})['catch'](function(_0x4e6629){logger[_0x07b0('0x12')]('ShowVoiceQueue',_0x4e6629[_0x07b0('0x14')],_0x54228e);_0x2f8df8(_0x19c82f[_0x07b0('0x12')](0x1f4,_0x4e6629[_0x07b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 996a40f..1d1d312 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 _0x8b32=['./voiceQueue.events','save','remove','removeListener','length','voiceQueue:'];(function(_0x4077df,_0x10621c){var _0x57aeff=function(_0x3f1af0){while(--_0x3f1af0){_0x4077df['push'](_0x4077df['shift']());}};_0x57aeff(++_0x10621c);}(_0x8b32,0xde));var _0x28b3=function(_0xee793d,_0x3bd83c){_0xee793d=_0xee793d-0x0;var _0x59bec0=_0x8b32[_0xee793d];return _0x59bec0;};'use strict';var VoiceQueueEvents=require(_0x28b3('0x0'));var events=[_0x28b3('0x1'),_0x28b3('0x2'),'update'];function createListener(_0x3d1553,_0x91b73){return function(_0x43bc56){_0x91b73['emit'](_0x3d1553,_0x43bc56);};}function removeListener(_0x718fd4,_0x495a67){return function(){VoiceQueueEvents[_0x28b3('0x3')](_0x718fd4,_0x495a67);};}exports['register']=function(_0x1ce947){for(var _0x2fc7c6=0x0,_0x3d884f=events[_0x28b3('0x4')];_0x2fc7c6<_0x3d884f;_0x2fc7c6++){var _0x34a626=events[_0x2fc7c6];var _0x2bf1c0=createListener(_0x28b3('0x5')+_0x34a626,_0x1ce947);VoiceQueueEvents['on'](_0x34a626,_0x2bf1c0);}}; \ No newline at end of file +var _0x5087=['save','remove','emit','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x442590,_0x4f2991){var _0x3ac649=function(_0x58a7ed){while(--_0x58a7ed){_0x442590['push'](_0x442590['shift']());}};_0x3ac649(++_0x4f2991);}(_0x5087,0x172));var _0x7508=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0x5087[_0x199bc4];return _0x136ffb;};'use strict';var VoiceQueueEvents=require(_0x7508('0x0'));var events=[_0x7508('0x1'),_0x7508('0x2'),'update'];function createListener(_0x42e758,_0x17afaf){return function(_0x2a7912){_0x17afaf[_0x7508('0x3')](_0x42e758,_0x2a7912);};}function removeListener(_0x55d7b0,_0x3370ab){return function(){VoiceQueueEvents['removeListener'](_0x55d7b0,_0x3370ab);};}exports[_0x7508('0x4')]=function(_0x16359f){for(var _0x340b87=0x0,_0x4357e1=events[_0x7508('0x5')];_0x340b87<_0x4357e1;_0x340b87++){var _0x39df75=events[_0x340b87];var _0x3d1128=createListener(_0x7508('0x6')+_0x39df75,_0x16359f);VoiceQueueEvents['on'](_0x39df75,_0x3d1128);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e7d6248..918701d 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 _0x360c=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','update','delete'];(function(_0x2fe457,_0x1c58d6){var _0x40dac7=function(_0x29839b){while(--_0x29839b){_0x2fe457['push'](_0x2fe457['shift']());}};_0x40dac7(++_0x1c58d6);}(_0x360c,0x1d0));var _0xc360=function(_0x30078d,_0x24abbd){_0x30078d=_0x30078d-0x0;var _0x18417d=_0x360c[_0x30078d];return _0x18417d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc360('0x0'));var timeout=require(_0xc360('0x1'));var express=require(_0xc360('0x2'));var router=express[_0xc360('0x3')]();var fs_extra=require(_0xc360('0x4'));var auth=require(_0xc360('0x5'));var interaction=require(_0xc360('0x6'));var config=require('../../config/environment');var controller=require(_0xc360('0x7'));router[_0xc360('0x8')]('/',auth['isAuthenticated'](),controller[_0xc360('0x9')]);router['get'](_0xc360('0xa'),auth[_0xc360('0xb')](),controller[_0xc360('0xc')]);router[_0xc360('0x8')](_0xc360('0xd'),auth[_0xc360('0xb')](),controller[_0xc360('0xe')]);router['get'](_0xc360('0xf'),auth['isAuthenticated'](),controller[_0xc360('0x10')]);router[_0xc360('0x11')]('/',auth[_0xc360('0xb')](),controller['create']);router['put'](_0xc360('0xf'),auth['isAuthenticated'](),controller[_0xc360('0x12')]);router[_0xc360('0x13')]('/:id',auth[_0xc360('0xb')](),controller[_0xc360('0x14')]);module[_0xc360('0x15')]=router; \ No newline at end of file +var _0x3906=['getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index'];(function(_0x5e70f7,_0x344ec4){var _0x51aa64=function(_0x424e7d){while(--_0x424e7d){_0x5e70f7['push'](_0x5e70f7['shift']());}};_0x51aa64(++_0x344ec4);}(_0x3906,0x15a));var _0x6390=function(_0x4a7f51,_0x50ba01){_0x4a7f51=_0x4a7f51-0x0;var _0x4b96c0=_0x3906[_0x4a7f51];return _0x4b96c0;};'use strict';var multer=require(_0x6390('0x0'));var util=require(_0x6390('0x1'));var path=require(_0x6390('0x2'));var timeout=require(_0x6390('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6390('0x4'));var auth=require(_0x6390('0x5'));var interaction=require(_0x6390('0x6'));var config=require('../../config/environment');var controller=require(_0x6390('0x7'));router[_0x6390('0x8')]('/',auth['isAuthenticated'](),controller[_0x6390('0x9')]);router['get'](_0x6390('0xa'),auth[_0x6390('0xb')](),controller[_0x6390('0xc')]);router[_0x6390('0x8')](_0x6390('0xd'),auth[_0x6390('0xb')](),controller[_0x6390('0xe')]);router[_0x6390('0x8')]('/:id',auth[_0x6390('0xb')](),controller[_0x6390('0xf')]);router[_0x6390('0x10')]('/',auth[_0x6390('0xb')](),controller[_0x6390('0x11')]);router[_0x6390('0x12')](_0x6390('0x13'),auth[_0x6390('0xb')](),controller[_0x6390('0x14')]);router[_0x6390('0x15')]('/:id',auth[_0x6390('0xb')](),controller[_0x6390('0x16')]);module[_0x6390('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 2bf4e96..ed18051 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 _0x5460=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x5460,0x1f3));var _0x0546=function(_0x36c3b7,_0x596033){_0x36c3b7=_0x36c3b7-0x0;var _0x21eedf=_0x5460[_0x36c3b7];return _0x21eedf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0546('0x0'));module[_0x0546('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0546('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0546('0x2')]},'queue':{'type':Sequelize[_0x0546('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x0546('0x3')],'set':function(_0x161567){var _0x36c667=moment(_0x161567);var _0x599437=moment(this[_0x0546('0x4')]('queuecallerjoinAt'))[_0x0546('0x5')](_0x0546('0x6'));var _0x827007=_0x36c667[_0x0546('0x7')](_0x599437,_0x0546('0x8'));this[_0x0546('0x9')](_0x0546('0xa'),_0x161567);this[_0x0546('0x9')](_0x0546('0xb'),_0x827007||null);}},'position':{'type':Sequelize[_0x0546('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x0546('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0546('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0546('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0546('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x0546('0xe')},'originalposition':{'type':Sequelize[_0x0546('0xc')]},'channel':{'type':Sequelize[_0x0546('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0546('0x2')]},'connectedlinename':{'type':Sequelize[_0x0546('0x2')]},'accountcode':{'type':Sequelize[_0x0546('0x2')]},'context':{'type':Sequelize[_0x0546('0x2')]},'exten':{'type':Sequelize[_0x0546('0x2')]},'priority':{'type':Sequelize[_0x0546('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x0546('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0546('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0546('0x2')]},'transfer':{'type':Sequelize[_0x0546('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0546('0x2')],'comment':_0x0546('0xf')},'transferexten':{'type':Sequelize[_0x0546('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0546('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0546('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0546('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb6de=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x2ad1a0,_0x8c0cda){var _0x4ffc10=function(_0x6cb5ad){while(--_0x6cb5ad){_0x2ad1a0['push'](_0x2ad1a0['shift']());}};_0x4ffc10(++_0x8c0cda);}(_0xb6de,0x9f));var _0xeb6d=function(_0x1eda19,_0x36091c){_0x1eda19=_0x1eda19-0x0;var _0x3f7b8c=_0xb6de[_0x1eda19];return _0x3f7b8c;};'use strict';var Sequelize=require(_0xeb6d('0x0'));var moment=require(_0xeb6d('0x1'));module['exports']={'type':{'type':Sequelize[_0xeb6d('0x2')]},'uniqueid':{'type':Sequelize[_0xeb6d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xeb6d('0x2')]},'queue':{'type':Sequelize[_0xeb6d('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xeb6d('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xeb6d('0x3')],'set':function(_0x365647){var _0x1c6468=moment(_0x365647);var _0xe4cf1=moment(this[_0xeb6d('0x4')](_0xeb6d('0x5')))[_0xeb6d('0x6')](_0xeb6d('0x7'));var _0x47ef8e=_0x1c6468[_0xeb6d('0x8')](_0xe4cf1,'seconds');this['setDataValue']('queuecallerleaveAt',_0x365647);this['setDataValue'](_0xeb6d('0x9'),_0x47ef8e||null);}},'position':{'type':Sequelize[_0xeb6d('0xa')]},'count':{'type':Sequelize[_0xeb6d('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xeb6d('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xeb6d('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xeb6d('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xeb6d('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xeb6d('0x2')],'comment':_0xeb6d('0xc')},'originalposition':{'type':Sequelize[_0xeb6d('0xa')]},'channel':{'type':Sequelize[_0xeb6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0xeb6d('0x2')]},'connectedlinename':{'type':Sequelize[_0xeb6d('0x2')]},'accountcode':{'type':Sequelize[_0xeb6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xeb6d('0x2')]},'priority':{'type':Sequelize[_0xeb6d('0x2')]},'holdtime':{'type':Sequelize[_0xeb6d('0xa')]},'mohtime':{'type':Sequelize[_0xeb6d('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeb6d('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xeb6d('0x2')]},'transfer':{'type':Sequelize[_0xeb6d('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeb6d('0x2')],'comment':_0xeb6d('0xd')},'transferexten':{'type':Sequelize[_0xeb6d('0x2')]},'transferuniqueid':{'type':Sequelize[_0xeb6d('0x2')]},'disposition':{'type':Sequelize[_0xeb6d('0x2')]},'secondDisposition':{'type':Sequelize[_0xeb6d('0x2')]},'thirdDisposition':{'type':Sequelize[_0xeb6d('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xeb6d('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 72ed8de..60f9dc7 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 _0x921e=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','intersection','find','catch','create','body','describe','getVoiceQueuesReport','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x921e,0xa4));var _0xe921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x921e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe921('0x0'));var rimraf=require(_0xe921('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe921('0x2'));var rp=require(_0xe921('0x3'));var moment=require(_0xe921('0x4'));var BPromise=require(_0xe921('0x5'));var Mustache=require('mustache');var util=require(_0xe921('0x6'));var path=require(_0xe921('0x7'));var sox=require(_0xe921('0x8'));var csv=require('to-csv');var ejs=require(_0xe921('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe921('0xa'));var squel=require(_0xe921('0xb'));var crypto=require(_0xe921('0xc'));var jsforce=require(_0xe921('0xd'));var deskjs=require(_0xe921('0xe'));var toCsv=require(_0xe921('0xf'));var querystring=require(_0xe921('0x10'));var Papa=require(_0xe921('0x11'));var Redis=require(_0xe921('0x12'));var authService=require(_0xe921('0x13'));var qs=require(_0xe921('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe921('0x15'));var logger=require('../../config/logger')(_0xe921('0x16'));var utils=require(_0xe921('0x17'));var config=require(_0xe921('0x18'));var licenseUtil=require(_0xe921('0x19'));var db=require(_0xe921('0x1a'))['db'];config['redis']=_['defaults'](config[_0xe921('0x1b')],{'host':_0xe921('0x1c'),'port':0x18eb});var socket=require(_0xe921('0x1d'))(new Redis(config[_0xe921('0x1b')]));require(_0xe921('0x1e'))[_0xe921('0x1f')](socket);function respondWithStatusCode(_0x478f66,_0x136b72){_0x136b72=_0x136b72||0xcc;return function(_0xdfbf0a){if(_0xdfbf0a){return _0x478f66[_0xe921('0x20')](_0x136b72);}return _0x478f66[_0xe921('0x21')](_0x136b72)[_0xe921('0x22')]();};}function respondWithResult(_0x25e066,_0x184ad9){_0x184ad9=_0x184ad9||0xc8;return function(_0x1396c0){if(_0x1396c0){return _0x25e066[_0xe921('0x21')](_0x184ad9)[_0xe921('0x23')](_0x1396c0);}};}function respondWithFilteredResult(_0x2394a1,_0x45be17){return function(_0x3a292d){if(_0x3a292d){var _0x223b81=typeof _0x45be17[_0xe921('0x24')]===_0xe921('0x25')&&typeof _0x45be17['limit']===_0xe921('0x25');var _0xb31b0d=_0x3a292d[_0xe921('0x26')];var _0x2da47c=_0x223b81?0x0:_0x45be17[_0xe921('0x24')];var _0x8e85d4=_0x223b81?_0x3a292d['count']:_0x45be17[_0xe921('0x24')]+_0x45be17['limit'];var _0x469d46;if(_0x8e85d4>=_0xb31b0d){_0x8e85d4=_0xb31b0d;_0x469d46=0xc8;}else{_0x469d46=0xce;}_0x2394a1[_0xe921('0x21')](_0x469d46);return _0x2394a1[_0xe921('0x27')](_0xe921('0x28'),_0x2da47c+'-'+_0x8e85d4+'/'+_0xb31b0d)[_0xe921('0x23')](_0x3a292d);}return null;};}function patchUpdates(_0x51ebcf){return function(_0x5689f7){try{jsonpatch[_0xe921('0x29')](_0x5689f7,_0x51ebcf,!![]);}catch(_0x3f938d){return BPromise[_0xe921('0x2a')](_0x3f938d);}return _0x5689f7[_0xe921('0x2b')]();};}function saveUpdates(_0x5ee0e1,_0x43845f){return function(_0x5e3250){if(_0x5e3250){return _0x5e3250[_0xe921('0x2c')](_0x5ee0e1)[_0xe921('0x2d')](function(_0x1b3bdd){return _0x1b3bdd;});}return null;};}function removeEntity(_0x378cd8,_0x491af0){return function(_0x34e7d8){if(_0x34e7d8){return _0x34e7d8[_0xe921('0x2e')]()[_0xe921('0x2d')](function(){_0x378cd8[_0xe921('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44da32,_0x21f822){return function(_0x4e2beb){if(!_0x4e2beb){_0x44da32[_0xe921('0x20')](0x194);}return _0x4e2beb;};}function handleError(_0x2ef390,_0x165eca){_0x165eca=_0x165eca||0x1f4;return function(_0x4a4980){logger[_0xe921('0x2f')](_0x4a4980[_0xe921('0x30')]);if(_0x4a4980[_0xe921('0x31')]){delete _0x4a4980[_0xe921('0x31')];}_0x2ef390[_0xe921('0x21')](_0x165eca)[_0xe921('0x32')](_0x4a4980);};}exports[_0xe921('0x33')]=function(_0x188f4c,_0x50819b){var _0x3c0899={},_0x1a76fd={},_0x66b47={'count':0x0,'rows':[]};var _0x5c7537=_[_0xe921('0x34')](db[_0xe921('0x35')][_0xe921('0x36')],function(_0x5c728e){return{'name':_0x5c728e[_0xe921('0x37')],'type':_0x5c728e[_0xe921('0x38')][_0xe921('0x39')]};});_0x1a76fd[_0xe921('0x3a')]=_[_0xe921('0x34')](_0x5c7537,_0xe921('0x31'));_0x1a76fd[_0xe921('0x3b')]=_[_0xe921('0x3c')](_0x188f4c[_0xe921('0x3b')]);_0x1a76fd[_0xe921('0x3d')]=_['intersection'](_0x1a76fd['model'],_0x1a76fd['query']);_0x3c0899[_0xe921('0x3e')]=_['intersection'](_0x1a76fd[_0xe921('0x3a')],qs[_0xe921('0x3f')](_0x188f4c[_0xe921('0x3b')][_0xe921('0x3f')]));_0x3c0899[_0xe921('0x3e')]=_0x3c0899[_0xe921('0x3e')][_0xe921('0x40')]?_0x3c0899[_0xe921('0x3e')]:_0x1a76fd[_0xe921('0x3a')];if(!_0x188f4c[_0xe921('0x3b')][_0xe921('0x41')](_0xe921('0x42'))){_0x3c0899[_0xe921('0x43')]=qs[_0xe921('0x43')](_0x188f4c[_0xe921('0x3b')][_0xe921('0x43')]);_0x3c0899[_0xe921('0x24')]=qs[_0xe921('0x24')](_0x188f4c['query'][_0xe921('0x24')]);}_0x3c0899[_0xe921('0x44')]=qs[_0xe921('0x45')](_0x188f4c['query'][_0xe921('0x45')]);_0x3c0899['where']=qs[_0xe921('0x3d')](_[_0xe921('0x46')](_0x188f4c[_0xe921('0x3b')],_0x1a76fd[_0xe921('0x3d')]),_0x5c7537);if(_0x188f4c[_0xe921('0x3b')][_0xe921('0x47')]){_0x3c0899['where']=_[_0xe921('0x48')](_0x3c0899[_0xe921('0x49')],{'$or':_[_0xe921('0x34')](_0x5c7537,function(_0x5616a7){if(_0x5616a7[_0xe921('0x38')]!==_0xe921('0x4a')){var _0x5d8ebc={};_0x5d8ebc[_0x5616a7['name']]={'$like':'%'+_0x188f4c[_0xe921('0x3b')][_0xe921('0x47')]+'%'};return _0x5d8ebc;}})});}_0x3c0899=_['merge']({},_0x3c0899,_0x188f4c[_0xe921('0x4b')]);var _0x21713d={'where':_0x3c0899['where']};return db[_0xe921('0x35')][_0xe921('0x26')](_0x21713d)[_0xe921('0x2d')](function(_0x19306d){_0x66b47[_0xe921('0x26')]=_0x19306d;if(_0x188f4c[_0xe921('0x3b')][_0xe921('0x4c')]){_0x3c0899[_0xe921('0x4d')]=[{'all':!![]}];}return db[_0xe921('0x35')][_0xe921('0x4e')](_0x3c0899);})[_0xe921('0x2d')](function(_0x5c0ef1){_0x66b47['rows']=_0x5c0ef1;return _0x66b47;})[_0xe921('0x2d')](respondWithFilteredResult(_0x50819b,_0x3c0899))['catch'](handleError(_0x50819b,null));};exports[_0xe921('0x4f')]=function(_0x557cdf,_0x58abd7){var _0x36a2d7={'raw':![],'where':{'id':_0x557cdf[_0xe921('0x50')]['id']}},_0x37c6e0={};_0x37c6e0[_0xe921('0x3a')]=_[_0xe921('0x3c')](db[_0xe921('0x35')][_0xe921('0x36')]);_0x37c6e0['query']=_[_0xe921('0x3c')](_0x557cdf[_0xe921('0x3b')]);_0x37c6e0[_0xe921('0x3d')]=_[_0xe921('0x51')](_0x37c6e0[_0xe921('0x3a')],_0x37c6e0[_0xe921('0x3b')]);_0x36a2d7[_0xe921('0x3e')]=_['intersection'](_0x37c6e0[_0xe921('0x3a')],qs['fields'](_0x557cdf[_0xe921('0x3b')][_0xe921('0x3f')]));_0x36a2d7[_0xe921('0x3e')]=_0x36a2d7[_0xe921('0x3e')][_0xe921('0x40')]?_0x36a2d7[_0xe921('0x3e')]:_0x37c6e0[_0xe921('0x3a')];if(_0x557cdf[_0xe921('0x3b')][_0xe921('0x4c')]){_0x36a2d7[_0xe921('0x4d')]=[{'all':!![]}];}_0x36a2d7=_[_0xe921('0x48')]({},_0x36a2d7,_0x557cdf['options']);return db[_0xe921('0x35')][_0xe921('0x52')](_0x36a2d7)[_0xe921('0x2d')](handleEntityNotFound(_0x58abd7,null))['then'](respondWithResult(_0x58abd7,null))[_0xe921('0x53')](handleError(_0x58abd7,null));};exports[_0xe921('0x54')]=function(_0x2dc3cf,_0x501868){return db['VoiceQueueReport'][_0xe921('0x54')](_0x2dc3cf['body'],{})[_0xe921('0x2d')](respondWithResult(_0x501868,0xc9))[_0xe921('0x53')](handleError(_0x501868,null));};exports[_0xe921('0x2c')]=function(_0xfe0395,_0x7abf59){if(_0xfe0395[_0xe921('0x55')]['id']){delete _0xfe0395[_0xe921('0x55')]['id'];}return db['VoiceQueueReport'][_0xe921('0x52')]({'where':{'id':_0xfe0395['params']['id']}})['then'](handleEntityNotFound(_0x7abf59,null))['then'](saveUpdates(_0xfe0395['body'],null))[_0xe921('0x2d')](respondWithResult(_0x7abf59,null))[_0xe921('0x53')](handleError(_0x7abf59,null));};exports[_0xe921('0x2e')]=function(_0x13ff1e,_0x37fc74){return db[_0xe921('0x35')][_0xe921('0x52')]({'where':{'id':_0x13ff1e[_0xe921('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc74,null))[_0xe921('0x2d')](removeEntity(_0x37fc74,null))[_0xe921('0x53')](handleError(_0x37fc74,null));};exports[_0xe921('0x56')]=function(_0x59ba0b,_0x432f5f){return db[_0xe921('0x35')][_0xe921('0x56')]()[_0xe921('0x2d')](respondWithResult(_0x432f5f,null))[_0xe921('0x53')](handleError(_0x432f5f,null));};exports[_0xe921('0x57')]=function(_0x41ba35,_0x3ea140){var _0x494bc2={},_0x314a6b={},_0x524fb0={'count':0x0,'rows':[]};_0x314a6b[_0xe921('0x3a')]=_[_0xe921('0x3c')](db[_0xe921('0x35')]['rawAttributes']);_0x314a6b['query']=_[_0xe921('0x3c')](_0x41ba35[_0xe921('0x3b')]);_0x314a6b['filters']=_[_0xe921('0x51')](_0x314a6b[_0xe921('0x3a')],_0x314a6b['query']);_0x494bc2[_0xe921('0x3e')]=_[_0xe921('0x51')](_0x314a6b[_0xe921('0x3a')],qs['fields'](_0x41ba35[_0xe921('0x3b')][_0xe921('0x3f')]));_0x494bc2[_0xe921('0x3e')]=_0x494bc2[_0xe921('0x3e')][_0xe921('0x40')]?_0x494bc2[_0xe921('0x3e')]:_0x314a6b[_0xe921('0x3a')];if(!_0x41ba35[_0xe921('0x3b')]['hasOwnProperty']('nolimit')){_0x494bc2[_0xe921('0x43')]=qs[_0xe921('0x43')](_0x41ba35['query'][_0xe921('0x43')]);_0x494bc2[_0xe921('0x24')]=qs[_0xe921('0x24')](_0x41ba35[_0xe921('0x3b')][_0xe921('0x24')]);}_0x494bc2[_0xe921('0x44')]=qs[_0xe921('0x45')](_0x41ba35['query'][_0xe921('0x45')]);_0x494bc2['where']=qs['filters'](_['pick'](_0x41ba35[_0xe921('0x3b')],_0x314a6b['filters']));if(_0x41ba35[_0xe921('0x3b')][_0xe921('0x47')]){_0x494bc2[_0xe921('0x49')]=_[_0xe921('0x48')](_0x494bc2['where'],{'$or':_[_0xe921('0x34')](_0x494bc2['attributes'],function(_0x5e069b){var _0x3488e0={};_0x3488e0[_0x5e069b]={'$like':'%'+_0x41ba35[_0xe921('0x3b')]['filter']+'%'};return _0x3488e0;})});}_0x494bc2=_[_0xe921('0x48')]({},_0x494bc2,_0x41ba35['options']);var _0x1e8438={'where':_0x494bc2['where']};return db[_0xe921('0x35')]['count'](_0x1e8438)[_0xe921('0x2d')](function(_0x2c89ca){_0x524fb0[_0xe921('0x26')]=_0x2c89ca;if(_0x41ba35[_0xe921('0x3b')][_0xe921('0x4c')]){_0x494bc2[_0xe921('0x4d')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xe921('0x4e')](_0x494bc2);})[_0xe921('0x2d')](function(_0x4dde83){_0x524fb0[_0xe921('0x58')]=_0x4dde83;return _0x524fb0;})['then'](respondWithFilteredResult(_0x3ea140,_0x494bc2,_0xe921('0x57')))[_0xe921('0x53')](handleError(_0x3ea140,null,_0xe921('0x57')));}; \ No newline at end of file +var _0xae4d=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','getVoiceQueuesReport'];(function(_0x24e8ea,_0x17bb0f){var _0x299082=function(_0x1c1c86){while(--_0x1c1c86){_0x24e8ea['push'](_0x24e8ea['shift']());}};_0x299082(++_0x17bb0f);}(_0xae4d,0xfc));var _0xdae4=function(_0x379f9c,_0x400ec2){_0x379f9c=_0x379f9c-0x0;var _0x3842aa=_0xae4d[_0x379f9c];return _0x3842aa;};'use strict';var emlformat=require(_0xdae4('0x0'));var rimraf=require(_0xdae4('0x1'));var zipdir=require(_0xdae4('0x2'));var jsonpatch=require(_0xdae4('0x3'));var rp=require(_0xdae4('0x4'));var moment=require(_0xdae4('0x5'));var BPromise=require(_0xdae4('0x6'));var Mustache=require('mustache');var util=require(_0xdae4('0x7'));var path=require(_0xdae4('0x8'));var sox=require(_0xdae4('0x9'));var csv=require('to-csv');var ejs=require(_0xdae4('0xa'));var fs=require('fs');var fs_extra=require(_0xdae4('0xb'));var _=require('lodash');var squel=require(_0xdae4('0xc'));var crypto=require(_0xdae4('0xd'));var jsforce=require(_0xdae4('0xe'));var deskjs=require(_0xdae4('0xf'));var toCsv=require(_0xdae4('0x10'));var querystring=require('querystring');var Papa=require(_0xdae4('0x11'));var Redis=require('ioredis');var authService=require(_0xdae4('0x12'));var qs=require(_0xdae4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdae4('0x14'));var logger=require(_0xdae4('0x15'))('api');var utils=require(_0xdae4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdae4('0x17'));var db=require(_0xdae4('0x18'))['db'];config[_0xdae4('0x19')]=_['defaults'](config[_0xdae4('0x19')],{'host':_0xdae4('0x1a'),'port':0x18eb});var socket=require(_0xdae4('0x1b'))(new Redis(config[_0xdae4('0x19')]));require(_0xdae4('0x1c'))['register'](socket);function respondWithStatusCode(_0x4ce51d,_0x8e1386){_0x8e1386=_0x8e1386||0xcc;return function(_0x1f1c82){if(_0x1f1c82){return _0x4ce51d['sendStatus'](_0x8e1386);}return _0x4ce51d[_0xdae4('0x1d')](_0x8e1386)[_0xdae4('0x1e')]();};}function respondWithResult(_0x4e0975,_0x315770){_0x315770=_0x315770||0xc8;return function(_0x544276){if(_0x544276){return _0x4e0975[_0xdae4('0x1d')](_0x315770)['json'](_0x544276);}};}function respondWithFilteredResult(_0x3d8f69,_0x3c2158){return function(_0x2a63fb){if(_0x2a63fb){var _0x5f4267=typeof _0x3c2158[_0xdae4('0x1f')]===_0xdae4('0x20')&&typeof _0x3c2158[_0xdae4('0x21')]==='undefined';var _0x1254b1=_0x2a63fb[_0xdae4('0x22')];var _0x1b6ee5=_0x5f4267?0x0:_0x3c2158['offset'];var _0x41610b=_0x5f4267?_0x2a63fb[_0xdae4('0x22')]:_0x3c2158[_0xdae4('0x1f')]+_0x3c2158[_0xdae4('0x21')];var _0x5ac748;if(_0x41610b>=_0x1254b1){_0x41610b=_0x1254b1;_0x5ac748=0xc8;}else{_0x5ac748=0xce;}_0x3d8f69['status'](_0x5ac748);return _0x3d8f69[_0xdae4('0x23')]('Content-Range',_0x1b6ee5+'-'+_0x41610b+'/'+_0x1254b1)[_0xdae4('0x24')](_0x2a63fb);}return null;};}function patchUpdates(_0x1e3208){return function(_0x30fa54){try{jsonpatch[_0xdae4('0x25')](_0x30fa54,_0x1e3208,!![]);}catch(_0x51a850){return BPromise[_0xdae4('0x26')](_0x51a850);}return _0x30fa54[_0xdae4('0x27')]();};}function saveUpdates(_0x148392,_0x4f6e88){return function(_0x1b3644){if(_0x1b3644){return _0x1b3644[_0xdae4('0x28')](_0x148392)[_0xdae4('0x29')](function(_0x55b295){return _0x55b295;});}return null;};}function removeEntity(_0x33d0d8,_0x5eb5f7){return function(_0x3d2e09){if(_0x3d2e09){return _0x3d2e09[_0xdae4('0x2a')]()['then'](function(){_0x33d0d8[_0xdae4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x370fa7,_0x9a0cb8){return function(_0x3e5f2f){if(!_0x3e5f2f){_0x370fa7[_0xdae4('0x2b')](0x194);}return _0x3e5f2f;};}function handleError(_0x40e85b,_0x416026){_0x416026=_0x416026||0x1f4;return function(_0x5215c1){logger['error'](_0x5215c1[_0xdae4('0x2c')]);if(_0x5215c1[_0xdae4('0x2d')]){delete _0x5215c1[_0xdae4('0x2d')];}_0x40e85b[_0xdae4('0x1d')](_0x416026)[_0xdae4('0x2e')](_0x5215c1);};}exports[_0xdae4('0x2f')]=function(_0x43f23d,_0x4600f0){var _0x4759dd={},_0x5885f1={},_0x5f212b={'count':0x0,'rows':[]};var _0xcea249=_[_0xdae4('0x30')](db['VoiceQueueReport'][_0xdae4('0x31')],function(_0x5aa7d7){return{'name':_0x5aa7d7[_0xdae4('0x32')],'type':_0x5aa7d7['type'][_0xdae4('0x33')]};});_0x5885f1[_0xdae4('0x34')]=_[_0xdae4('0x30')](_0xcea249,_0xdae4('0x2d'));_0x5885f1['query']=_['keys'](_0x43f23d[_0xdae4('0x35')]);_0x5885f1[_0xdae4('0x36')]=_[_0xdae4('0x37')](_0x5885f1[_0xdae4('0x34')],_0x5885f1[_0xdae4('0x35')]);_0x4759dd[_0xdae4('0x38')]=_[_0xdae4('0x37')](_0x5885f1['model'],qs[_0xdae4('0x39')](_0x43f23d[_0xdae4('0x35')][_0xdae4('0x39')]));_0x4759dd[_0xdae4('0x38')]=_0x4759dd['attributes'][_0xdae4('0x3a')]?_0x4759dd[_0xdae4('0x38')]:_0x5885f1[_0xdae4('0x34')];if(!_0x43f23d[_0xdae4('0x35')][_0xdae4('0x3b')](_0xdae4('0x3c'))){_0x4759dd[_0xdae4('0x21')]=qs[_0xdae4('0x21')](_0x43f23d[_0xdae4('0x35')]['limit']);_0x4759dd['offset']=qs['offset'](_0x43f23d[_0xdae4('0x35')][_0xdae4('0x1f')]);}_0x4759dd[_0xdae4('0x3d')]=qs[_0xdae4('0x3e')](_0x43f23d[_0xdae4('0x35')][_0xdae4('0x3e')]);_0x4759dd[_0xdae4('0x3f')]=qs[_0xdae4('0x36')](_[_0xdae4('0x40')](_0x43f23d[_0xdae4('0x35')],_0x5885f1[_0xdae4('0x36')]),_0xcea249);if(_0x43f23d[_0xdae4('0x35')][_0xdae4('0x41')]){_0x4759dd['where']=_[_0xdae4('0x42')](_0x4759dd['where'],{'$or':_[_0xdae4('0x30')](_0xcea249,function(_0x59cd9d){if(_0x59cd9d[_0xdae4('0x43')]!==_0xdae4('0x44')){var _0x55e554={};_0x55e554[_0x59cd9d[_0xdae4('0x2d')]]={'$like':'%'+_0x43f23d[_0xdae4('0x35')][_0xdae4('0x41')]+'%'};return _0x55e554;}})});}_0x4759dd=_[_0xdae4('0x42')]({},_0x4759dd,_0x43f23d['options']);var _0x15f456={'where':_0x4759dd[_0xdae4('0x3f')]};return db[_0xdae4('0x45')]['count'](_0x15f456)[_0xdae4('0x29')](function(_0x5d254e){_0x5f212b[_0xdae4('0x22')]=_0x5d254e;if(_0x43f23d[_0xdae4('0x35')][_0xdae4('0x46')]){_0x4759dd[_0xdae4('0x47')]=[{'all':!![]}];}return db[_0xdae4('0x45')][_0xdae4('0x48')](_0x4759dd);})[_0xdae4('0x29')](function(_0x34805d){_0x5f212b[_0xdae4('0x49')]=_0x34805d;return _0x5f212b;})[_0xdae4('0x29')](respondWithFilteredResult(_0x4600f0,_0x4759dd))['catch'](handleError(_0x4600f0,null));};exports[_0xdae4('0x4a')]=function(_0x21cccd,_0x4c03b4){var _0x4c5fcb={'raw':![],'where':{'id':_0x21cccd[_0xdae4('0x4b')]['id']}},_0x54e5aa={};_0x54e5aa[_0xdae4('0x34')]=_['keys'](db[_0xdae4('0x45')][_0xdae4('0x31')]);_0x54e5aa[_0xdae4('0x35')]=_[_0xdae4('0x4c')](_0x21cccd[_0xdae4('0x35')]);_0x54e5aa['filters']=_[_0xdae4('0x37')](_0x54e5aa[_0xdae4('0x34')],_0x54e5aa[_0xdae4('0x35')]);_0x4c5fcb[_0xdae4('0x38')]=_[_0xdae4('0x37')](_0x54e5aa[_0xdae4('0x34')],qs[_0xdae4('0x39')](_0x21cccd[_0xdae4('0x35')][_0xdae4('0x39')]));_0x4c5fcb[_0xdae4('0x38')]=_0x4c5fcb[_0xdae4('0x38')][_0xdae4('0x3a')]?_0x4c5fcb[_0xdae4('0x38')]:_0x54e5aa[_0xdae4('0x34')];if(_0x21cccd['query'][_0xdae4('0x46')]){_0x4c5fcb[_0xdae4('0x47')]=[{'all':!![]}];}_0x4c5fcb=_[_0xdae4('0x42')]({},_0x4c5fcb,_0x21cccd[_0xdae4('0x4d')]);return db[_0xdae4('0x45')][_0xdae4('0x4e')](_0x4c5fcb)[_0xdae4('0x29')](handleEntityNotFound(_0x4c03b4,null))[_0xdae4('0x29')](respondWithResult(_0x4c03b4,null))[_0xdae4('0x4f')](handleError(_0x4c03b4,null));};exports[_0xdae4('0x50')]=function(_0x1db7a9,_0x4a7bb9){return db[_0xdae4('0x45')][_0xdae4('0x50')](_0x1db7a9[_0xdae4('0x51')],{})[_0xdae4('0x29')](respondWithResult(_0x4a7bb9,0xc9))[_0xdae4('0x4f')](handleError(_0x4a7bb9,null));};exports[_0xdae4('0x28')]=function(_0x286139,_0x2f5553){if(_0x286139[_0xdae4('0x51')]['id']){delete _0x286139[_0xdae4('0x51')]['id'];}return db[_0xdae4('0x45')]['find']({'where':{'id':_0x286139[_0xdae4('0x4b')]['id']}})[_0xdae4('0x29')](handleEntityNotFound(_0x2f5553,null))[_0xdae4('0x29')](saveUpdates(_0x286139[_0xdae4('0x51')],null))['then'](respondWithResult(_0x2f5553,null))[_0xdae4('0x4f')](handleError(_0x2f5553,null));};exports['destroy']=function(_0x1a4c1c,_0x18cb78){return db[_0xdae4('0x45')]['find']({'where':{'id':_0x1a4c1c[_0xdae4('0x4b')]['id']}})[_0xdae4('0x29')](handleEntityNotFound(_0x18cb78,null))[_0xdae4('0x29')](removeEntity(_0x18cb78,null))['catch'](handleError(_0x18cb78,null));};exports['describe']=function(_0x392212,_0x5eda95){return db[_0xdae4('0x45')][_0xdae4('0x52')]()[_0xdae4('0x29')](respondWithResult(_0x5eda95,null))[_0xdae4('0x4f')](handleError(_0x5eda95,null));};exports['getVoiceQueuesReport']=function(_0x3fe86e,_0x3cdb64){var _0x5c3316={},_0x5a55bd={},_0x55c513={'count':0x0,'rows':[]};_0x5a55bd[_0xdae4('0x34')]=_[_0xdae4('0x4c')](db[_0xdae4('0x45')][_0xdae4('0x31')]);_0x5a55bd['query']=_[_0xdae4('0x4c')](_0x3fe86e[_0xdae4('0x35')]);_0x5a55bd['filters']=_[_0xdae4('0x37')](_0x5a55bd[_0xdae4('0x34')],_0x5a55bd[_0xdae4('0x35')]);_0x5c3316['attributes']=_[_0xdae4('0x37')](_0x5a55bd[_0xdae4('0x34')],qs[_0xdae4('0x39')](_0x3fe86e[_0xdae4('0x35')][_0xdae4('0x39')]));_0x5c3316[_0xdae4('0x38')]=_0x5c3316[_0xdae4('0x38')][_0xdae4('0x3a')]?_0x5c3316[_0xdae4('0x38')]:_0x5a55bd[_0xdae4('0x34')];if(!_0x3fe86e[_0xdae4('0x35')]['hasOwnProperty']('nolimit')){_0x5c3316[_0xdae4('0x21')]=qs[_0xdae4('0x21')](_0x3fe86e[_0xdae4('0x35')][_0xdae4('0x21')]);_0x5c3316[_0xdae4('0x1f')]=qs[_0xdae4('0x1f')](_0x3fe86e[_0xdae4('0x35')]['offset']);}_0x5c3316[_0xdae4('0x3d')]=qs[_0xdae4('0x3e')](_0x3fe86e[_0xdae4('0x35')][_0xdae4('0x3e')]);_0x5c3316['where']=qs[_0xdae4('0x36')](_[_0xdae4('0x40')](_0x3fe86e[_0xdae4('0x35')],_0x5a55bd[_0xdae4('0x36')]));if(_0x3fe86e[_0xdae4('0x35')][_0xdae4('0x41')]){_0x5c3316['where']=_[_0xdae4('0x42')](_0x5c3316[_0xdae4('0x3f')],{'$or':_[_0xdae4('0x30')](_0x5c3316[_0xdae4('0x38')],function(_0x2cde1a){var _0x5f28cf={};_0x5f28cf[_0x2cde1a]={'$like':'%'+_0x3fe86e[_0xdae4('0x35')][_0xdae4('0x41')]+'%'};return _0x5f28cf;})});}_0x5c3316=_['merge']({},_0x5c3316,_0x3fe86e['options']);var _0x1c491c={'where':_0x5c3316['where']};return db['VoiceQueueReport'][_0xdae4('0x22')](_0x1c491c)[_0xdae4('0x29')](function(_0x24662d){_0x55c513[_0xdae4('0x22')]=_0x24662d;if(_0x3fe86e[_0xdae4('0x35')][_0xdae4('0x46')]){_0x5c3316['include']=[{'all':!![]}];}return db[_0xdae4('0x45')][_0xdae4('0x48')](_0x5c3316);})[_0xdae4('0x29')](function(_0xeca65c){_0x55c513[_0xdae4('0x49')]=_0xeca65c;return _0x55c513;})['then'](respondWithFilteredResult(_0x3cdb64,_0x5c3316,_0xdae4('0x53')))['catch'](handleError(_0x3cdb64,null,_0xdae4('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 8948151..f14f70e 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 _0xd77f=['../../mysqldb','VoiceQueueReport','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd77f,0x1c2));var _0xfd77=function(_0x15f055,_0x3d3d41){_0x15f055=_0x15f055-0x0;var _0x1523a8=_0xd77f[_0x15f055];return _0x1523a8;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xfd77('0x0'))['db'][_0xfd77('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd77('0x2'),'afterUpdate':_0xfd77('0x3'),'afterDestroy':_0xfd77('0x4')};function emitEvent(_0x2503e9){return function(_0x525a5b,_0x446b68,_0x4be99c){VoiceQueueReportEvents[_0xfd77('0x5')](_0x2503e9+':'+_0x525a5b['id'],_0x525a5b);VoiceQueueReportEvents[_0xfd77('0x5')](_0x2503e9,_0x525a5b);_0x4be99c(null);};}for(var e in events){if(events[_0xfd77('0x6')](e)){var event=events[e];VoiceQueueReport[_0xfd77('0x7')](e,emitEvent(event));}}module[_0xfd77('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x15f2=['save','remove','emit','hasOwnProperty','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x254744,_0x219e6b){var _0x2a6a96=function(_0x26aceb){while(--_0x26aceb){_0x254744['push'](_0x254744['shift']());}};_0x2a6a96(++_0x219e6b);}(_0x15f2,0xa4));var _0x215f=function(_0x439382,_0x392445){_0x439382=_0x439382-0x0;var _0x223265=_0x15f2[_0x439382];return _0x223265;};'use strict';var EventEmitter=require(_0x215f('0x0'));var VoiceQueueReport=require(_0x215f('0x1'))['db'][_0x215f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x215f('0x3')](0x0);var events={'afterCreate':_0x215f('0x4'),'afterUpdate':'update','afterDestroy':_0x215f('0x5')};function emitEvent(_0x24565b){return function(_0xfa9b0c,_0x284a47,_0x3c1f45){VoiceQueueReportEvents['emit'](_0x24565b+':'+_0xfa9b0c['id'],_0xfa9b0c);VoiceQueueReportEvents[_0x215f('0x6')](_0x24565b,_0xfa9b0c);_0x3c1f45(null);};}for(var e in events){if(events[_0x215f('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index e93cff2..abfa8ef 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 _0x487c=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceQueueReport.attributes'];(function(_0x555142,_0x3c15df){var _0x4f6d0b=function(_0x51bfdc){while(--_0x51bfdc){_0x555142['push'](_0x555142['shift']());}};_0x4f6d0b(++_0x3c15df);}(_0x487c,0x19b));var _0xc487=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x487c[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0xc487('0x0'));var util=require(_0xc487('0x1'));var logger=require(_0xc487('0x2'))(_0xc487('0x3'));var moment=require(_0xc487('0x4'));var BPromise=require('bluebird');var rp=require(_0xc487('0x5'));var fs=require('fs');var path=require(_0xc487('0x6'));var rimraf=require(_0xc487('0x7'));var config=require('../../config/environment');var attributes=require(_0xc487('0x8'));module['exports']=function(_0x14d4e4,_0x2ddf3d){return _0x14d4e4[_0xc487('0x9')](_0xc487('0xa'),attributes,{'tableName':_0xc487('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc487('0xc')]},{'fields':[_0xc487('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed28=['exports','VoiceQueueReport','report_queue','api','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xed28,0x93));var _0x8ed2=function(_0x3838cd,_0x498b81){_0x3838cd=_0x3838cd-0x0;var _0x595fa0=_0xed28[_0x3838cd];return _0x595fa0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8ed2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8ed2('0x1'));var fs=require('fs');var path=require(_0x8ed2('0x2'));var rimraf=require(_0x8ed2('0x3'));var config=require(_0x8ed2('0x4'));var attributes=require(_0x8ed2('0x5'));module[_0x8ed2('0x6')]=function(_0x42a3fc,_0x23a755){return _0x42a3fc['define'](_0x8ed2('0x7'),attributes,{'tableName':_0x8ed2('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'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 c05d15b..14d8154 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 _0x6eb9=['http','redis','defaults','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetVoiceQueueReport','options','where','attributes','limit','include','map','model','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','debug','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x48429d,_0x4d334d){var _0x1f7c03=function(_0x38762a){while(--_0x38762a){_0x48429d['push'](_0x48429d['shift']());}};_0x1f7c03(++_0x4d334d);}(_0x6eb9,0x145));var _0x96eb=function(_0x46e5fc,_0x5db9aa){_0x46e5fc=_0x46e5fc-0x0;var _0x52f4e6=_0x6eb9[_0x46e5fc];return _0x52f4e6;};'use strict';var _=require(_0x96eb('0x0'));var util=require(_0x96eb('0x1'));var moment=require(_0x96eb('0x2'));var BPromise=require(_0x96eb('0x3'));var rs=require(_0x96eb('0x4'));var fs=require('fs');var Redis=require(_0x96eb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x96eb('0x6'));var logger=require(_0x96eb('0x7'))(_0x96eb('0x8'));var config=require('../../config/environment');var jayson=require(_0x96eb('0x9'));var client=jayson[_0x96eb('0xa')][_0x96eb('0xb')]({'port':0x232a});config[_0x96eb('0xc')]=_[_0x96eb('0xd')](config[_0x96eb('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96eb('0xc')]));require(_0x96eb('0xe'))[_0x96eb('0xf')](socket);function respondWithRpcPromise(_0x517522,_0x2d26e4,_0x4c38b6){return new BPromise(function(_0x54f7e2,_0x483b89){return client[_0x96eb('0x10')](_0x517522,_0x4c38b6)[_0x96eb('0x11')](function(_0x5675e1){logger['info'](_0x96eb('0x12'),_0x2d26e4,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2d26e4,_0x96eb('0x13'),JSON['stringify'](_0x5675e1));if(_0x5675e1[_0x96eb('0x14')]){if(_0x5675e1['error']['code']===0x1f4){logger[_0x96eb('0x14')](_0x96eb('0x12'),_0x2d26e4,_0x5675e1[_0x96eb('0x14')][_0x96eb('0x15')]);return _0x483b89(_0x5675e1[_0x96eb('0x14')]['message']);}logger[_0x96eb('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x2d26e4,_0x5675e1[_0x96eb('0x14')][_0x96eb('0x15')]);return _0x54f7e2(_0x5675e1[_0x96eb('0x14')][_0x96eb('0x15')]);}else{logger[_0x96eb('0x16')](_0x96eb('0x12'),_0x2d26e4,_0x96eb('0x13'));_0x54f7e2(_0x5675e1[_0x96eb('0x17')][_0x96eb('0x15')]);}})[_0x96eb('0x18')](function(_0x166dc9){logger[_0x96eb('0x14')](_0x96eb('0x12'),_0x2d26e4,_0x166dc9);_0x483b89(_0x166dc9);});});}exports[_0x96eb('0x19')]=function(_0xd4e0a2){var _0x526ddf=this;return new Promise(function(_0x1ccf10,_0x4f6d56){return db['VoiceQueueReport']['findAll']({'raw':_0xd4e0a2[_0x96eb('0x1a')]?_0xd4e0a2[_0x96eb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xd4e0a2[_0x96eb('0x1a')]?_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1b')]||null:null,'attributes':_0xd4e0a2[_0x96eb('0x1a')]?_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1c')]||null:null,'limit':_0xd4e0a2[_0x96eb('0x1a')]?_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1d')]||null:null,'include':_0xd4e0a2['options']?_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1e')]?_[_0x96eb('0x1f')](_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1e')],function(_0x46916f){return{'model':db[_0x46916f[_0x96eb('0x20')]],'as':_0x46916f['as'],'attributes':_0x46916f['attributes'],'include':_0x46916f[_0x96eb('0x1e')]?_[_0x96eb('0x1f')](_0x46916f['include'],function(_0xabbf4f){return{'model':db[_0xabbf4f['model']],'as':_0xabbf4f['as'],'attributes':_0xabbf4f[_0x96eb('0x1c')],'include':_0xabbf4f[_0x96eb('0x1e')]?_['map'](_0xabbf4f['include'],function(_0x5cfc84){return{'model':db[_0x5cfc84[_0x96eb('0x20')]],'as':_0x5cfc84['as'],'attributes':_0x5cfc84['attributes']};}):[]};}):[]};}):[]:[]})[_0x96eb('0x11')](function(_0xebb162){logger['info']('GetVoiceQueueReport',_0xd4e0a2);logger['debug'](_0x96eb('0x19'),_0xd4e0a2,JSON[_0x96eb('0x21')](_0xebb162));_0x1ccf10(_0xebb162);})[_0x96eb('0x18')](function(_0x563b67){logger['error'](_0x96eb('0x19'),_0x563b67[_0x96eb('0x15')],_0xd4e0a2);_0x4f6d56(_0x526ddf['error'](0x1f4,_0x563b67['message']));});});};exports[_0x96eb('0x22')]=function(_0x5f18e2){var _0x5c431f=this;return new Promise(function(_0x5856e3,_0x110b57){return db[_0x96eb('0x23')][_0x96eb('0x24')](_0x5f18e2[_0x96eb('0x25')],{'raw':_0x5f18e2[_0x96eb('0x1a')]?_0x5f18e2[_0x96eb('0x1a')][_0x96eb('0x26')]===undefined?!![]:![]:!![]})[_0x96eb('0x11')](function(_0x53028d){logger['info'](_0x96eb('0x22'),_0x5f18e2);logger[_0x96eb('0x27')](_0x96eb('0x22'),_0x5f18e2,JSON['stringify'](_0x53028d));_0x5856e3(_0x53028d);})['catch'](function(_0x5a10d2){logger[_0x96eb('0x14')](_0x96eb('0x22'),_0x5a10d2['message'],_0x5f18e2);_0x110b57(_0x5c431f[_0x96eb('0x14')](0x1f4,_0x5a10d2[_0x96eb('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x425070){var _0x295a0b=this;return new Promise(function(_0x5f4ed2,_0x1199a0){return db[_0x96eb('0x23')][_0x96eb('0x28')](_0x425070[_0x96eb('0x25')],{'raw':_0x425070[_0x96eb('0x1a')]?_0x425070[_0x96eb('0x1a')][_0x96eb('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x425070['options']?_0x425070['options'][_0x96eb('0x1b')]||null:null,'attributes':_0x425070[_0x96eb('0x1a')]?_0x425070['options'][_0x96eb('0x1c')]||null:null,'limit':_0x425070[_0x96eb('0x1a')]?_0x425070[_0x96eb('0x1a')][_0x96eb('0x1d')]||null:null})[_0x96eb('0x11')](function(_0x5d0ace){logger[_0x96eb('0x16')](_0x96eb('0x29'),_0x425070);logger[_0x96eb('0x27')](_0x96eb('0x29'),_0x425070,JSON[_0x96eb('0x21')](_0x5d0ace));_0x5f4ed2(_0x5d0ace);})[_0x96eb('0x18')](function(_0x3d0242){logger[_0x96eb('0x14')](_0x96eb('0x29'),_0x3d0242[_0x96eb('0x15')],_0x425070);_0x1199a0(_0x295a0b[_0x96eb('0x14')](0x1f4,_0x3d0242[_0x96eb('0x15')]));});});}; \ No newline at end of file +var _0x0977=['limit','include','map','attributes','model','info','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','raw','options'];(function(_0x52598d,_0x10fb73){var _0x170309=function(_0x30c9f7){while(--_0x30c9f7){_0x52598d['push'](_0x52598d['shift']());}};_0x170309(++_0x10fb73);}(_0x0977,0x8f));var _0x7097=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0977[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x7097('0x0'));var util=require(_0x7097('0x1'));var moment=require(_0x7097('0x2'));var BPromise=require(_0x7097('0x3'));var rs=require(_0x7097('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7097('0x5'));var logger=require(_0x7097('0x6'))(_0x7097('0x7'));var config=require(_0x7097('0x8'));var jayson=require(_0x7097('0x9'));var client=jayson[_0x7097('0xa')][_0x7097('0xb')]({'port':0x232a});config[_0x7097('0xc')]=_[_0x7097('0xd')](config[_0x7097('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7097('0xe'))(new Redis(config[_0x7097('0xc')]));require(_0x7097('0xf'))[_0x7097('0x10')](socket);function respondWithRpcPromise(_0x14239c,_0x1aaa91,_0x1c7731){return new BPromise(function(_0x18cc02,_0x2b9556){return client['request'](_0x14239c,_0x1c7731)[_0x7097('0x11')](function(_0x7eff17){logger['info'](_0x7097('0x12'),_0x1aaa91,_0x7097('0x13'));logger[_0x7097('0x14')](_0x7097('0x15'),_0x1aaa91,_0x7097('0x13'),JSON[_0x7097('0x16')](_0x7eff17));if(_0x7eff17['error']){if(_0x7eff17[_0x7097('0x17')][_0x7097('0x18')]===0x1f4){logger['error'](_0x7097('0x12'),_0x1aaa91,_0x7eff17[_0x7097('0x17')]['message']);return _0x2b9556(_0x7eff17[_0x7097('0x17')][_0x7097('0x19')]);}logger['error'](_0x7097('0x12'),_0x1aaa91,_0x7eff17[_0x7097('0x17')][_0x7097('0x19')]);return _0x18cc02(_0x7eff17[_0x7097('0x17')][_0x7097('0x19')]);}else{logger['info'](_0x7097('0x12'),_0x1aaa91,'request\x20sent');_0x18cc02(_0x7eff17[_0x7097('0x1a')]['message']);}})[_0x7097('0x1b')](function(_0x499c72){logger[_0x7097('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x1aaa91,_0x499c72);_0x2b9556(_0x499c72);});});}exports[_0x7097('0x1c')]=function(_0x2eca56){var _0x4b2c1e=this;return new Promise(function(_0x55647c,_0x45b96d){return db[_0x7097('0x1d')][_0x7097('0x1e')]({'raw':_0x2eca56['options']?_0x2eca56['options'][_0x7097('0x1f')]===undefined?!![]:![]:!![],'where':_0x2eca56['options']?_0x2eca56[_0x7097('0x20')]['where']||null:null,'attributes':_0x2eca56[_0x7097('0x20')]?_0x2eca56[_0x7097('0x20')]['attributes']||null:null,'limit':_0x2eca56['options']?_0x2eca56[_0x7097('0x20')][_0x7097('0x21')]||null:null,'include':_0x2eca56['options']?_0x2eca56[_0x7097('0x20')][_0x7097('0x22')]?_[_0x7097('0x23')](_0x2eca56[_0x7097('0x20')][_0x7097('0x22')],function(_0xd072d9){return{'model':db[_0xd072d9['model']],'as':_0xd072d9['as'],'attributes':_0xd072d9[_0x7097('0x24')],'include':_0xd072d9[_0x7097('0x22')]?_[_0x7097('0x23')](_0xd072d9[_0x7097('0x22')],function(_0x1f2577){return{'model':db[_0x1f2577['model']],'as':_0x1f2577['as'],'attributes':_0x1f2577['attributes'],'include':_0x1f2577[_0x7097('0x22')]?_[_0x7097('0x23')](_0x1f2577['include'],function(_0x2f93ef){return{'model':db[_0x2f93ef[_0x7097('0x25')]],'as':_0x2f93ef['as'],'attributes':_0x2f93ef[_0x7097('0x24')]};}):[]};}):[]};}):[]:[]})[_0x7097('0x11')](function(_0x4801ba){logger[_0x7097('0x26')](_0x7097('0x1c'),_0x2eca56);logger[_0x7097('0x14')](_0x7097('0x1c'),_0x2eca56,JSON[_0x7097('0x16')](_0x4801ba));_0x55647c(_0x4801ba);})[_0x7097('0x1b')](function(_0x327139){logger[_0x7097('0x17')](_0x7097('0x1c'),_0x327139[_0x7097('0x19')],_0x2eca56);_0x45b96d(_0x4b2c1e['error'](0x1f4,_0x327139['message']));});});};exports[_0x7097('0x27')]=function(_0x17d5c0){var _0x35ba2f=this;return new Promise(function(_0x4ae043,_0xb80dad){return db[_0x7097('0x1d')][_0x7097('0x28')](_0x17d5c0[_0x7097('0x29')],{'raw':_0x17d5c0['options']?_0x17d5c0[_0x7097('0x20')][_0x7097('0x1f')]===undefined?!![]:![]:!![]})[_0x7097('0x11')](function(_0x4d928d){logger[_0x7097('0x26')](_0x7097('0x27'),_0x17d5c0);logger[_0x7097('0x14')](_0x7097('0x27'),_0x17d5c0,JSON[_0x7097('0x16')](_0x4d928d));_0x4ae043(_0x4d928d);})[_0x7097('0x1b')](function(_0xab2ed0){logger[_0x7097('0x17')](_0x7097('0x27'),_0xab2ed0[_0x7097('0x19')],_0x17d5c0);_0xb80dad(_0x35ba2f[_0x7097('0x17')](0x1f4,_0xab2ed0['message']));});});};exports[_0x7097('0x2a')]=function(_0x5b820c){var _0xe5916=this;return new Promise(function(_0x43dfc0,_0x2cb918){return db['VoiceQueueReport']['update'](_0x5b820c[_0x7097('0x29')],{'raw':_0x5b820c[_0x7097('0x20')]?_0x5b820c[_0x7097('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b820c[_0x7097('0x20')]?_0x5b820c[_0x7097('0x20')][_0x7097('0x2b')]||null:null,'attributes':_0x5b820c[_0x7097('0x20')]?_0x5b820c[_0x7097('0x20')]['attributes']||null:null,'limit':_0x5b820c[_0x7097('0x20')]?_0x5b820c[_0x7097('0x20')]['limit']||null:null})['then'](function(_0x5d7423){logger['info'](_0x7097('0x2a'),_0x5b820c);logger[_0x7097('0x14')]('UpdateVoiceQueueReport',_0x5b820c,JSON[_0x7097('0x16')](_0x5d7423));_0x43dfc0(_0x5d7423);})['catch'](function(_0x48c3cf){logger[_0x7097('0x17')]('UpdateVoiceQueueReport',_0x48c3cf[_0x7097('0x19')],_0x5b820c);_0x2cb918(_0xe5916[_0x7097('0x17')](0x1f4,_0x48c3cf['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 5255606..6a57886 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 _0x25b4=['./voiceQueueReport.events','remove','update','emit','removeListener','length','voiceQueueReport:'];(function(_0x42fc46,_0x54879a){var _0x25617c=function(_0x5dd602){while(--_0x5dd602){_0x42fc46['push'](_0x42fc46['shift']());}};_0x25617c(++_0x54879a);}(_0x25b4,0x1ab));var _0x425b=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x25b4[_0x393d69];return _0x3cee37;};'use strict';var VoiceQueueReportEvents=require(_0x425b('0x0'));var events=['save',_0x425b('0x1'),_0x425b('0x2')];function createListener(_0x23e1a1,_0x3d56e5){return function(_0x5d3f43){_0x3d56e5[_0x425b('0x3')](_0x23e1a1,_0x5d3f43);};}function removeListener(_0x448a81,_0xcf7b62){return function(){VoiceQueueReportEvents[_0x425b('0x4')](_0x448a81,_0xcf7b62);};}exports['register']=function(_0x27e02e){for(var _0x1e22e4=0x0,_0x306290=events[_0x425b('0x5')];_0x1e22e4<_0x306290;_0x1e22e4++){var _0x4509c2=events[_0x1e22e4];var _0x55c12b=createListener(_0x425b('0x6')+_0x4509c2,_0x27e02e);VoiceQueueReportEvents['on'](_0x4509c2,_0x55c12b);}}; \ No newline at end of file +var _0xde9c=['voiceQueueReport:','./voiceQueueReport.events','save','update','emit','removeListener','length'];(function(_0x3c5272,_0x1ea873){var _0x31a12a=function(_0x541b39){while(--_0x541b39){_0x3c5272['push'](_0x3c5272['shift']());}};_0x31a12a(++_0x1ea873);}(_0xde9c,0xa9));var _0xcde9=function(_0x525b7a,_0x3c591a){_0x525b7a=_0x525b7a-0x0;var _0x14f0ea=_0xde9c[_0x525b7a];return _0x14f0ea;};'use strict';var VoiceQueueReportEvents=require(_0xcde9('0x0'));var events=[_0xcde9('0x1'),'remove',_0xcde9('0x2')];function createListener(_0x4591e7,_0x400362){return function(_0x5dd2c3){_0x400362[_0xcde9('0x3')](_0x4591e7,_0x5dd2c3);};}function removeListener(_0x25e02b,_0x30a01a){return function(){VoiceQueueReportEvents[_0xcde9('0x4')](_0x25e02b,_0x30a01a);};}exports['register']=function(_0x47d93a){for(var _0x38fe99=0x0,_0x27c541=events[_0xcde9('0x5')];_0x38fe99<_0x27c541;_0x38fe99++){var _0x5ba6e1=events[_0x38fe99];var _0x95b23b=createListener(_0xcde9('0x6')+_0x5ba6e1,_0x47d93a);VoiceQueueReportEvents['on'](_0x5ba6e1,_0x95b23b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 904a62a..d82bffb 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 _0x0ec2=['index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x4cdfd7,_0x4487f3){var _0x345c0c=function(_0x92022){while(--_0x92022){_0x4cdfd7['push'](_0x4cdfd7['shift']());}};_0x345c0c(++_0x4487f3);}(_0x0ec2,0x72));var _0x20ec=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x0ec2[_0xfc406a];return _0x395473;};'use strict';var multer=require(_0x20ec('0x0'));var util=require('util');var path=require(_0x20ec('0x1'));var timeout=require(_0x20ec('0x2'));var express=require(_0x20ec('0x3'));var router=express[_0x20ec('0x4')]();var fs_extra=require(_0x20ec('0x5'));var auth=require(_0x20ec('0x6'));var interaction=require(_0x20ec('0x7'));var config=require(_0x20ec('0x8'));var controller=require(_0x20ec('0x9'));router[_0x20ec('0xa')]('/',auth[_0x20ec('0xb')](),controller[_0x20ec('0xc')]);router[_0x20ec('0xa')](_0x20ec('0xd'),auth[_0x20ec('0xb')](),controller['show']);router[_0x20ec('0xe')]('/',auth['isAuthenticated'](),controller[_0x20ec('0xf')]);router[_0x20ec('0x10')](_0x20ec('0xd'),auth[_0x20ec('0xb')](),controller[_0x20ec('0x11')]);router[_0x20ec('0x12')](_0x20ec('0xd'),auth[_0x20ec('0xb')](),controller[_0x20ec('0x13')]);module[_0x20ec('0x14')]=router; \ No newline at end of file +var _0x7e07=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x5c37ab,_0x5a6605){var _0x3551e7=function(_0x2aa99a){while(--_0x2aa99a){_0x5c37ab['push'](_0x5c37ab['shift']());}};_0x3551e7(++_0x5a6605);}(_0x7e07,0x8e));var _0x77e0=function(_0x3ac3f3,_0x2141fa){_0x3ac3f3=_0x3ac3f3-0x0;var _0x1901e4=_0x7e07[_0x3ac3f3];return _0x1901e4;};'use strict';var multer=require(_0x77e0('0x0'));var util=require(_0x77e0('0x1'));var path=require('path');var timeout=require(_0x77e0('0x2'));var express=require(_0x77e0('0x3'));var router=express[_0x77e0('0x4')]();var fs_extra=require(_0x77e0('0x5'));var auth=require(_0x77e0('0x6'));var interaction=require(_0x77e0('0x7'));var config=require(_0x77e0('0x8'));var controller=require(_0x77e0('0x9'));router['get']('/',auth[_0x77e0('0xa')](),controller[_0x77e0('0xb')]);router['get']('/:id',auth[_0x77e0('0xa')](),controller[_0x77e0('0xc')]);router[_0x77e0('0xd')]('/',auth[_0x77e0('0xa')](),controller[_0x77e0('0xe')]);router[_0x77e0('0xf')](_0x77e0('0x10'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x11')]);router[_0x77e0('0x12')](_0x77e0('0x10'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x13')]);module[_0x77e0('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d054508..6a3603e 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 _0x9583=['moment','exports','STRING','DATE','format','sequelize'];(function(_0x19ddd7,_0x4adc14){var _0x1326d1=function(_0x581913){while(--_0x581913){_0x19ddd7['push'](_0x19ddd7['shift']());}};_0x1326d1(++_0x4adc14);}(_0x9583,0xcb));var _0x3958=function(_0x8809b4,_0x3bdc8a){_0x8809b4=_0x8809b4-0x0;var _0xc33cb7=_0x9583[_0x8809b4];return _0xc33cb7;};'use strict';var Sequelize=require(_0x3958('0x0'));var moment=require(_0x3958('0x1'));module[_0x3958('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3958('0x4')],'allowNull':![],'defaultValue':moment()[_0x3958('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xb833=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x186bb8,_0x32313d){var _0x4829b2=function(_0x1c75a6){while(--_0x1c75a6){_0x186bb8['push'](_0x186bb8['shift']());}};_0x4829b2(++_0x32313d);}(_0xb833,0x105));var _0x3b83=function(_0x20c64d,_0x5c23e7){_0x20c64d=_0x20c64d-0x0;var _0xb04bf0=_0xb833[_0x20c64d];return _0xb04bf0;};'use strict';var Sequelize=require(_0x3b83('0x0'));var moment=require(_0x3b83('0x1'));module[_0x3b83('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x3b83('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3b83('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3b83('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3b83('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3b83('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3b83('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3b83('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3b83('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3b83('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x3b83('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b118188..9253f6a 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 _0xf213=['options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','name','VoiceQueuesLog','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter'];(function(_0x40f467,_0x544d10){var _0x749420=function(_0x53a842){while(--_0x53a842){_0x40f467['push'](_0x40f467['shift']());}};_0x749420(++_0x544d10);}(_0xf213,0x17f));var _0x3f21=function(_0x5d2a0b,_0x1386a3){_0x5d2a0b=_0x5d2a0b-0x0;var _0x2bb4a4=_0xf213[_0x5d2a0b];return _0x2bb4a4;};'use strict';var emlformat=require(_0x3f21('0x0'));var rimraf=require(_0x3f21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f21('0x2'));var rp=require(_0x3f21('0x3'));var moment=require(_0x3f21('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f21('0x5'));var util=require(_0x3f21('0x6'));var path=require(_0x3f21('0x7'));var sox=require(_0x3f21('0x8'));var csv=require(_0x3f21('0x9'));var ejs=require(_0x3f21('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f21('0xb'));var squel=require(_0x3f21('0xc'));var crypto=require(_0x3f21('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3f21('0xe'));var toCsv=require(_0x3f21('0x9'));var querystring=require(_0x3f21('0xf'));var Papa=require(_0x3f21('0x10'));var Redis=require(_0x3f21('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3f21('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f21('0x13'));var logger=require(_0x3f21('0x14'))(_0x3f21('0x15'));var utils=require(_0x3f21('0x16'));var config=require(_0x3f21('0x17'));var licenseUtil=require(_0x3f21('0x18'));var db=require(_0x3f21('0x19'))['db'];function respondWithStatusCode(_0x3a02a0,_0xa4b7eb){_0xa4b7eb=_0xa4b7eb||0xcc;return function(_0x2554e3){if(_0x2554e3){return _0x3a02a0[_0x3f21('0x1a')](_0xa4b7eb);}return _0x3a02a0[_0x3f21('0x1b')](_0xa4b7eb)[_0x3f21('0x1c')]();};}function respondWithResult(_0x421add,_0x5b61a5){_0x5b61a5=_0x5b61a5||0xc8;return function(_0x38e3c6){if(_0x38e3c6){return _0x421add['status'](_0x5b61a5)[_0x3f21('0x1d')](_0x38e3c6);}};}function respondWithFilteredResult(_0x244ebf,_0x4ff946){return function(_0x36e966){if(_0x36e966){var _0x34ca69=typeof _0x4ff946[_0x3f21('0x1e')]===_0x3f21('0x1f')&&typeof _0x4ff946[_0x3f21('0x20')]===_0x3f21('0x1f');var _0x564ee5=_0x36e966[_0x3f21('0x21')];var _0x1b58e4=_0x34ca69?0x0:_0x4ff946['offset'];var _0x5ba352=_0x34ca69?_0x36e966['count']:_0x4ff946[_0x3f21('0x1e')]+_0x4ff946[_0x3f21('0x20')];var _0x164574;if(_0x5ba352>=_0x564ee5){_0x5ba352=_0x564ee5;_0x164574=0xc8;}else{_0x164574=0xce;}_0x244ebf[_0x3f21('0x1b')](_0x164574);return _0x244ebf[_0x3f21('0x22')]('Content-Range',_0x1b58e4+'-'+_0x5ba352+'/'+_0x564ee5)[_0x3f21('0x1d')](_0x36e966);}return null;};}function patchUpdates(_0x4803f2){return function(_0x6d12c3){try{jsonpatch[_0x3f21('0x23')](_0x6d12c3,_0x4803f2,!![]);}catch(_0x101dc3){return BPromise['reject'](_0x101dc3);}return _0x6d12c3['save']();};}function saveUpdates(_0x393029,_0x284055){return function(_0x227a52){if(_0x227a52){return _0x227a52[_0x3f21('0x24')](_0x393029)[_0x3f21('0x25')](function(_0x192bfb){return _0x192bfb;});}return null;};}function removeEntity(_0x53fbf8,_0xf01ffb){return function(_0x3ad4ba){if(_0x3ad4ba){return _0x3ad4ba[_0x3f21('0x26')]()[_0x3f21('0x25')](function(){_0x53fbf8[_0x3f21('0x1b')](0xcc)[_0x3f21('0x1c')]();});}};}function handleEntityNotFound(_0x1ed675,_0x269960){return function(_0x51f9e7){if(!_0x51f9e7){_0x1ed675['sendStatus'](0x194);}return _0x51f9e7;};}function handleError(_0x582f09,_0x26c6d6){_0x26c6d6=_0x26c6d6||0x1f4;return function(_0xfb571c){logger[_0x3f21('0x27')](_0xfb571c['stack']);if(_0xfb571c[_0x3f21('0x28')]){delete _0xfb571c[_0x3f21('0x28')];}_0x582f09['status'](_0x26c6d6)['send'](_0xfb571c);};}exports['index']=function(_0x55c67e,_0x34dff2){var _0x3696ca={},_0xf617c0={},_0x21d1c6={'count':0x0,'rows':[]};var _0x4d318d=_['map'](db[_0x3f21('0x29')]['rawAttributes'],function(_0x554865){return{'name':_0x554865['fieldName'],'type':_0x554865[_0x3f21('0x2a')][_0x3f21('0x2b')]};});_0xf617c0['model']=_[_0x3f21('0x2c')](_0x4d318d,_0x3f21('0x28'));_0xf617c0[_0x3f21('0x2d')]=_['keys'](_0x55c67e[_0x3f21('0x2d')]);_0xf617c0[_0x3f21('0x2e')]=_[_0x3f21('0x2f')](_0xf617c0[_0x3f21('0x30')],_0xf617c0[_0x3f21('0x2d')]);_0x3696ca[_0x3f21('0x31')]=_[_0x3f21('0x2f')](_0xf617c0[_0x3f21('0x30')],qs[_0x3f21('0x32')](_0x55c67e[_0x3f21('0x2d')]['fields']));_0x3696ca[_0x3f21('0x31')]=_0x3696ca[_0x3f21('0x31')][_0x3f21('0x33')]?_0x3696ca['attributes']:_0xf617c0[_0x3f21('0x30')];if(!_0x55c67e[_0x3f21('0x2d')][_0x3f21('0x34')](_0x3f21('0x35'))){_0x3696ca['limit']=qs[_0x3f21('0x20')](_0x55c67e[_0x3f21('0x2d')][_0x3f21('0x20')]);_0x3696ca['offset']=qs[_0x3f21('0x1e')](_0x55c67e[_0x3f21('0x2d')]['offset']);}_0x3696ca[_0x3f21('0x36')]=qs[_0x3f21('0x37')](_0x55c67e[_0x3f21('0x2d')][_0x3f21('0x37')]);_0x3696ca['where']=qs[_0x3f21('0x2e')](_[_0x3f21('0x38')](_0x55c67e[_0x3f21('0x2d')],_0xf617c0[_0x3f21('0x2e')]),_0x4d318d);if(_0x55c67e[_0x3f21('0x2d')]['filter']){_0x3696ca[_0x3f21('0x39')]=_[_0x3f21('0x3a')](_0x3696ca[_0x3f21('0x39')],{'$or':_['map'](_0x4d318d,function(_0x10b321){if(_0x10b321[_0x3f21('0x2a')]!==_0x3f21('0x3b')){var _0x561608={};_0x561608[_0x10b321[_0x3f21('0x28')]]={'$like':'%'+_0x55c67e['query'][_0x3f21('0x3c')]+'%'};return _0x561608;}})});}_0x3696ca=_['merge']({},_0x3696ca,_0x55c67e[_0x3f21('0x3d')]);var _0x14b30c={'where':_0x3696ca[_0x3f21('0x39')]};return db[_0x3f21('0x29')][_0x3f21('0x21')](_0x14b30c)[_0x3f21('0x25')](function(_0x257544){_0x21d1c6[_0x3f21('0x21')]=_0x257544;if(_0x55c67e[_0x3f21('0x2d')][_0x3f21('0x3e')]){_0x3696ca['include']=[{'all':!![]}];}return db[_0x3f21('0x29')][_0x3f21('0x3f')](_0x3696ca);})[_0x3f21('0x25')](function(_0x53f925){_0x21d1c6[_0x3f21('0x40')]=_0x53f925;return _0x21d1c6;})[_0x3f21('0x25')](respondWithFilteredResult(_0x34dff2,_0x3696ca))[_0x3f21('0x41')](handleError(_0x34dff2,null));};exports[_0x3f21('0x42')]=function(_0x3d64df,_0x45ead9){var _0x16fe7b={'raw':!![],'where':{'id':_0x3d64df[_0x3f21('0x43')]['id']}},_0x70ed13={};_0x70ed13[_0x3f21('0x30')]=_[_0x3f21('0x44')](db[_0x3f21('0x29')][_0x3f21('0x45')]);_0x70ed13['query']=_[_0x3f21('0x44')](_0x3d64df[_0x3f21('0x2d')]);_0x70ed13[_0x3f21('0x2e')]=_[_0x3f21('0x2f')](_0x70ed13[_0x3f21('0x30')],_0x70ed13[_0x3f21('0x2d')]);_0x16fe7b[_0x3f21('0x31')]=_[_0x3f21('0x2f')](_0x70ed13[_0x3f21('0x30')],qs[_0x3f21('0x32')](_0x3d64df['query'][_0x3f21('0x32')]));_0x16fe7b['attributes']=_0x16fe7b['attributes'][_0x3f21('0x33')]?_0x16fe7b['attributes']:_0x70ed13[_0x3f21('0x30')];if(_0x3d64df[_0x3f21('0x2d')][_0x3f21('0x3e')]){_0x16fe7b[_0x3f21('0x46')]=[{'all':!![]}];}_0x16fe7b=_['merge']({},_0x16fe7b,_0x3d64df[_0x3f21('0x3d')]);return db[_0x3f21('0x29')][_0x3f21('0x47')](_0x16fe7b)[_0x3f21('0x25')](handleEntityNotFound(_0x45ead9,null))[_0x3f21('0x25')](respondWithResult(_0x45ead9,null))[_0x3f21('0x41')](handleError(_0x45ead9,null));};exports['create']=function(_0x5e524b,_0x1acaca){return db[_0x3f21('0x29')][_0x3f21('0x48')](_0x5e524b[_0x3f21('0x49')],{})['then'](respondWithResult(_0x1acaca,0xc9))['catch'](handleError(_0x1acaca,null));};exports[_0x3f21('0x24')]=function(_0x592486,_0x21466b){if(_0x592486['body']['id']){delete _0x592486['body']['id'];}return db[_0x3f21('0x29')]['find']({'where':{'id':_0x592486[_0x3f21('0x43')]['id']}})[_0x3f21('0x25')](handleEntityNotFound(_0x21466b,null))[_0x3f21('0x25')](saveUpdates(_0x592486['body'],null))[_0x3f21('0x25')](respondWithResult(_0x21466b,null))[_0x3f21('0x41')](handleError(_0x21466b,null));};exports['destroy']=function(_0x409e35,_0x15a8bd){return db[_0x3f21('0x29')][_0x3f21('0x47')]({'where':{'id':_0x409e35[_0x3f21('0x43')]['id']}})['then'](handleEntityNotFound(_0x15a8bd,null))['then'](removeEntity(_0x15a8bd,null))['catch'](handleError(_0x15a8bd,null));}; \ No newline at end of file +var _0x74d7=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','apply','save','update','then','destroy','end','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x57308a,_0xf02ca){var _0x40e3c1=function(_0x47256a){while(--_0x47256a){_0x57308a['push'](_0x57308a['shift']());}};_0x40e3c1(++_0xf02ca);}(_0x74d7,0xa8));var _0x774d=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x74d7[_0xfb0281];return _0x408dd3;};'use strict';var emlformat=require(_0x774d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x774d('0x1'));var jsonpatch=require(_0x774d('0x2'));var rp=require(_0x774d('0x3'));var moment=require(_0x774d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x774d('0x5'));var path=require(_0x774d('0x6'));var sox=require(_0x774d('0x7'));var csv=require(_0x774d('0x8'));var ejs=require(_0x774d('0x9'));var fs=require('fs');var fs_extra=require(_0x774d('0xa'));var _=require('lodash');var squel=require(_0x774d('0xb'));var crypto=require(_0x774d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x774d('0xd'));var toCsv=require(_0x774d('0x8'));var querystring=require(_0x774d('0xe'));var Papa=require('papaparse');var Redis=require(_0x774d('0xf'));var authService=require(_0x774d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x774d('0x11'))(_0x774d('0x12'));var utils=require(_0x774d('0x13'));var config=require(_0x774d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x774d('0x15'))['db'];function respondWithStatusCode(_0x2c20f7,_0x2fc489){_0x2fc489=_0x2fc489||0xcc;return function(_0x31142a){if(_0x31142a){return _0x2c20f7[_0x774d('0x16')](_0x2fc489);}return _0x2c20f7[_0x774d('0x17')](_0x2fc489)['end']();};}function respondWithResult(_0x2859a6,_0x56d8a7){_0x56d8a7=_0x56d8a7||0xc8;return function(_0x23fde2){if(_0x23fde2){return _0x2859a6[_0x774d('0x17')](_0x56d8a7)[_0x774d('0x18')](_0x23fde2);}};}function respondWithFilteredResult(_0x54dfa2,_0x2080ed){return function(_0x12f62b){if(_0x12f62b){var _0x3523f8=typeof _0x2080ed['offset']==='undefined'&&typeof _0x2080ed[_0x774d('0x19')]===_0x774d('0x1a');var _0xd579e0=_0x12f62b['count'];var _0x3512ac=_0x3523f8?0x0:_0x2080ed[_0x774d('0x1b')];var _0x444b00=_0x3523f8?_0x12f62b[_0x774d('0x1c')]:_0x2080ed[_0x774d('0x1b')]+_0x2080ed[_0x774d('0x19')];var _0xc957d8;if(_0x444b00>=_0xd579e0){_0x444b00=_0xd579e0;_0xc957d8=0xc8;}else{_0xc957d8=0xce;}_0x54dfa2[_0x774d('0x17')](_0xc957d8);return _0x54dfa2[_0x774d('0x1d')]('Content-Range',_0x3512ac+'-'+_0x444b00+'/'+_0xd579e0)[_0x774d('0x18')](_0x12f62b);}return null;};}function patchUpdates(_0x3e5277){return function(_0x307ce0){try{jsonpatch[_0x774d('0x1e')](_0x307ce0,_0x3e5277,!![]);}catch(_0x280b71){return BPromise['reject'](_0x280b71);}return _0x307ce0[_0x774d('0x1f')]();};}function saveUpdates(_0x5db548,_0x334c44){return function(_0x242f1a){if(_0x242f1a){return _0x242f1a[_0x774d('0x20')](_0x5db548)[_0x774d('0x21')](function(_0x3eeb3c){return _0x3eeb3c;});}return null;};}function removeEntity(_0x53cc8c,_0x55edb3){return function(_0x5da984){if(_0x5da984){return _0x5da984[_0x774d('0x22')]()[_0x774d('0x21')](function(){_0x53cc8c[_0x774d('0x17')](0xcc)[_0x774d('0x23')]();});}};}function handleEntityNotFound(_0xa0d7f2,_0x2fa074){return function(_0x67377b){if(!_0x67377b){_0xa0d7f2[_0x774d('0x16')](0x194);}return _0x67377b;};}function handleError(_0x561a1c,_0xf84e9f){_0xf84e9f=_0xf84e9f||0x1f4;return function(_0x3efdfd){logger['error'](_0x3efdfd['stack']);if(_0x3efdfd[_0x774d('0x24')]){delete _0x3efdfd['name'];}_0x561a1c['status'](_0xf84e9f)[_0x774d('0x25')](_0x3efdfd);};}exports[_0x774d('0x26')]=function(_0x2ed845,_0x44c6fb){var _0x28fa77={},_0x2d82e6={},_0x241573={'count':0x0,'rows':[]};var _0x43e53d=_[_0x774d('0x27')](db[_0x774d('0x28')][_0x774d('0x29')],function(_0x5484ea){return{'name':_0x5484ea[_0x774d('0x2a')],'type':_0x5484ea[_0x774d('0x2b')][_0x774d('0x2c')]};});_0x2d82e6[_0x774d('0x2d')]=_['map'](_0x43e53d,_0x774d('0x24'));_0x2d82e6[_0x774d('0x2e')]=_[_0x774d('0x2f')](_0x2ed845[_0x774d('0x2e')]);_0x2d82e6[_0x774d('0x30')]=_[_0x774d('0x31')](_0x2d82e6['model'],_0x2d82e6[_0x774d('0x2e')]);_0x28fa77[_0x774d('0x32')]=_[_0x774d('0x31')](_0x2d82e6['model'],qs[_0x774d('0x33')](_0x2ed845[_0x774d('0x2e')][_0x774d('0x33')]));_0x28fa77[_0x774d('0x32')]=_0x28fa77['attributes'][_0x774d('0x34')]?_0x28fa77[_0x774d('0x32')]:_0x2d82e6[_0x774d('0x2d')];if(!_0x2ed845[_0x774d('0x2e')][_0x774d('0x35')](_0x774d('0x36'))){_0x28fa77[_0x774d('0x19')]=qs[_0x774d('0x19')](_0x2ed845[_0x774d('0x2e')]['limit']);_0x28fa77['offset']=qs[_0x774d('0x1b')](_0x2ed845[_0x774d('0x2e')][_0x774d('0x1b')]);}_0x28fa77[_0x774d('0x37')]=qs[_0x774d('0x38')](_0x2ed845[_0x774d('0x2e')][_0x774d('0x38')]);_0x28fa77['where']=qs[_0x774d('0x30')](_[_0x774d('0x39')](_0x2ed845['query'],_0x2d82e6[_0x774d('0x30')]),_0x43e53d);if(_0x2ed845[_0x774d('0x2e')][_0x774d('0x3a')]){_0x28fa77[_0x774d('0x3b')]=_[_0x774d('0x3c')](_0x28fa77[_0x774d('0x3b')],{'$or':_[_0x774d('0x27')](_0x43e53d,function(_0x2f12ae){if(_0x2f12ae[_0x774d('0x2b')]!==_0x774d('0x3d')){var _0xf8049a={};_0xf8049a[_0x2f12ae[_0x774d('0x24')]]={'$like':'%'+_0x2ed845[_0x774d('0x2e')]['filter']+'%'};return _0xf8049a;}})});}_0x28fa77=_[_0x774d('0x3c')]({},_0x28fa77,_0x2ed845[_0x774d('0x3e')]);var _0x256fd3={'where':_0x28fa77[_0x774d('0x3b')]};return db[_0x774d('0x28')][_0x774d('0x1c')](_0x256fd3)[_0x774d('0x21')](function(_0xe3a69b){_0x241573[_0x774d('0x1c')]=_0xe3a69b;if(_0x2ed845['query'][_0x774d('0x3f')]){_0x28fa77[_0x774d('0x40')]=[{'all':!![]}];}return db[_0x774d('0x28')][_0x774d('0x41')](_0x28fa77);})[_0x774d('0x21')](function(_0x2e4003){_0x241573['rows']=_0x2e4003;return _0x241573;})[_0x774d('0x21')](respondWithFilteredResult(_0x44c6fb,_0x28fa77))[_0x774d('0x42')](handleError(_0x44c6fb,null));};exports[_0x774d('0x43')]=function(_0x5309ba,_0x3f765f){var _0x465e8b={'raw':!![],'where':{'id':_0x5309ba[_0x774d('0x44')]['id']}},_0x77e1d9={};_0x77e1d9[_0x774d('0x2d')]=_[_0x774d('0x2f')](db[_0x774d('0x28')]['rawAttributes']);_0x77e1d9['query']=_['keys'](_0x5309ba[_0x774d('0x2e')]);_0x77e1d9['filters']=_[_0x774d('0x31')](_0x77e1d9[_0x774d('0x2d')],_0x77e1d9[_0x774d('0x2e')]);_0x465e8b[_0x774d('0x32')]=_[_0x774d('0x31')](_0x77e1d9[_0x774d('0x2d')],qs[_0x774d('0x33')](_0x5309ba['query']['fields']));_0x465e8b[_0x774d('0x32')]=_0x465e8b[_0x774d('0x32')][_0x774d('0x34')]?_0x465e8b[_0x774d('0x32')]:_0x77e1d9[_0x774d('0x2d')];if(_0x5309ba[_0x774d('0x2e')][_0x774d('0x3f')]){_0x465e8b[_0x774d('0x40')]=[{'all':!![]}];}_0x465e8b=_[_0x774d('0x3c')]({},_0x465e8b,_0x5309ba[_0x774d('0x3e')]);return db['VoiceQueuesLog'][_0x774d('0x45')](_0x465e8b)['then'](handleEntityNotFound(_0x3f765f,null))['then'](respondWithResult(_0x3f765f,null))[_0x774d('0x42')](handleError(_0x3f765f,null));};exports[_0x774d('0x46')]=function(_0x1181dd,_0xc30b39){return db[_0x774d('0x28')][_0x774d('0x46')](_0x1181dd['body'],{})[_0x774d('0x21')](respondWithResult(_0xc30b39,0xc9))[_0x774d('0x42')](handleError(_0xc30b39,null));};exports[_0x774d('0x20')]=function(_0x12f6b4,_0x4129cd){if(_0x12f6b4[_0x774d('0x47')]['id']){delete _0x12f6b4[_0x774d('0x47')]['id'];}return db[_0x774d('0x28')]['find']({'where':{'id':_0x12f6b4[_0x774d('0x44')]['id']}})[_0x774d('0x21')](handleEntityNotFound(_0x4129cd,null))['then'](saveUpdates(_0x12f6b4[_0x774d('0x47')],null))['then'](respondWithResult(_0x4129cd,null))[_0x774d('0x42')](handleError(_0x4129cd,null));};exports['destroy']=function(_0x4601ed,_0x1ac7e3){return db[_0x774d('0x28')][_0x774d('0x45')]({'where':{'id':_0x4601ed['params']['id']}})[_0x774d('0x21')](handleEntityNotFound(_0x1ac7e3,null))[_0x774d('0x21')](removeEntity(_0x1ac7e3,null))[_0x774d('0x42')](handleError(_0x1ac7e3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 219437e..b5f37fa 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 _0x50ea=['request-promise','path','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5001ed,_0x1ecb28){var _0xe9378d=function(_0x289142){while(--_0x289142){_0x5001ed['push'](_0x5001ed['shift']());}};_0xe9378d(++_0x1ecb28);}(_0x50ea,0x1ca));var _0xa50e=function(_0x1713bc,_0x337d8c){_0x1713bc=_0x1713bc-0x0;var _0x59fe87=_0x50ea[_0x1713bc];return _0x59fe87;};'use strict';var _=require(_0xa50e('0x0'));var util=require(_0xa50e('0x1'));var logger=require(_0xa50e('0x2'))(_0xa50e('0x3'));var moment=require(_0xa50e('0x4'));var BPromise=require(_0xa50e('0x5'));var rp=require(_0xa50e('0x6'));var fs=require('fs');var path=require(_0xa50e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa50e('0x8'));module[_0xa50e('0x9')]=function(_0x35794c,_0x10e8c9){return _0x35794c[_0xa50e('0xa')](_0xa50e('0xb'),attributes,{'tableName':_0xa50e('0xc'),'paranoid':![],'indexes':[{'name':_0xa50e('0xd'),'fields':[_0xa50e('0xe'),_0xa50e('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1294=['event_dtm','event','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x318309,_0x430ab9){var _0x4c25ff=function(_0x4de818){while(--_0x4de818){_0x318309['push'](_0x318309['shift']());}};_0x4c25ff(++_0x430ab9);}(_0x1294,0xb8));var _0x4129=function(_0x3d9ba7,_0x1c8b5f){_0x3d9ba7=_0x3d9ba7-0x0;var _0x4621ce=_0x1294[_0x3d9ba7];return _0x4621ce;};'use strict';var _=require(_0x4129('0x0'));var util=require('util');var logger=require(_0x4129('0x1'))('api');var moment=require(_0x4129('0x2'));var BPromise=require(_0x4129('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4129('0x4'));var rimraf=require(_0x4129('0x5'));var config=require(_0x4129('0x6'));var attributes=require(_0x4129('0x7'));module[_0x4129('0x8')]=function(_0x3ea6a1,_0x1aa4dd){return _0x3ea6a1[_0x4129('0x9')](_0x4129('0xa'),attributes,{'tableName':_0x4129('0xb'),'paranoid':![],'indexes':[{'name':_0x4129('0xc'),'fields':[_0x4129('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 254222b..71edef2 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 _0x1e32=['error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x1e32,0xac));var _0x21e3=function(_0x42c7b1,_0x41c915){_0x42c7b1=_0x42c7b1-0x0;var _0x1de606=_0x1e32[_0x42c7b1];return _0x1de606;};'use strict';var _=require(_0x21e3('0x0'));var util=require(_0x21e3('0x1'));var moment=require(_0x21e3('0x2'));var BPromise=require(_0x21e3('0x3'));var rs=require(_0x21e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21e3('0x5'))['db'];var utils=require(_0x21e3('0x6'));var logger=require(_0x21e3('0x7'))(_0x21e3('0x8'));var config=require('../../config/environment');var jayson=require(_0x21e3('0x9'));var client=jayson[_0x21e3('0xa')][_0x21e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19a18c,_0x1aa10a,_0x2086d6){return new BPromise(function(_0x3a346f,_0x4db89c){return client[_0x21e3('0xc')](_0x19a18c,_0x2086d6)[_0x21e3('0xd')](function(_0x44b775){logger['info'](_0x21e3('0xe'),_0x1aa10a,_0x21e3('0xf'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1aa10a,_0x21e3('0xf'),JSON[_0x21e3('0x10')](_0x44b775));if(_0x44b775[_0x21e3('0x11')]){if(_0x44b775['error'][_0x21e3('0x12')]===0x1f4){logger['error'](_0x21e3('0xe'),_0x1aa10a,_0x44b775[_0x21e3('0x11')][_0x21e3('0x13')]);return _0x4db89c(_0x44b775[_0x21e3('0x11')]['message']);}logger[_0x21e3('0x11')](_0x21e3('0xe'),_0x1aa10a,_0x44b775[_0x21e3('0x11')][_0x21e3('0x13')]);return _0x3a346f(_0x44b775[_0x21e3('0x11')][_0x21e3('0x13')]);}else{logger['info'](_0x21e3('0xe'),_0x1aa10a,_0x21e3('0xf'));_0x3a346f(_0x44b775[_0x21e3('0x14')][_0x21e3('0x13')]);}})['catch'](function(_0x2450c7){logger[_0x21e3('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1aa10a,_0x2450c7);_0x4db89c(_0x2450c7);});});} \ No newline at end of file +var _0x0aaf=['rpc','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xa4ac04,_0x3cd392){var _0x4248f0=function(_0x30c836){while(--_0x30c836){_0xa4ac04['push'](_0xa4ac04['shift']());}};_0x4248f0(++_0x3cd392);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x28c7a7,_0x55a356){_0x28c7a7=_0x28c7a7-0x0;var _0x50610f=_0x0aaf[_0x28c7a7];return _0x50610f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf0aa('0x0'));var BPromise=require(_0xf0aa('0x1'));var rs=require(_0xf0aa('0x2'));var fs=require('fs');var Redis=require(_0xf0aa('0x3'));var db=require(_0xf0aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0aa('0x5'))(_0xf0aa('0x6'));var config=require('../../config/environment');var jayson=require(_0xf0aa('0x7'));var client=jayson['client'][_0xf0aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c2d11,_0xe4a744,_0x244745){return new BPromise(function(_0x38bf88,_0x579674){return client[_0xf0aa('0x9')](_0x4c2d11,_0x244745)[_0xf0aa('0xa')](function(_0x5b7efc){logger[_0xf0aa('0xb')](_0xf0aa('0xc'),_0xe4a744,_0xf0aa('0xd'));logger[_0xf0aa('0xe')](_0xf0aa('0xf'),_0xe4a744,_0xf0aa('0xd'),JSON[_0xf0aa('0x10')](_0x5b7efc));if(_0x5b7efc[_0xf0aa('0x11')]){if(_0x5b7efc[_0xf0aa('0x11')][_0xf0aa('0x12')]===0x1f4){logger[_0xf0aa('0x11')](_0xf0aa('0xc'),_0xe4a744,_0x5b7efc['error']['message']);return _0x579674(_0x5b7efc[_0xf0aa('0x11')][_0xf0aa('0x13')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xe4a744,_0x5b7efc[_0xf0aa('0x11')]['message']);return _0x38bf88(_0x5b7efc[_0xf0aa('0x11')]['message']);}else{logger[_0xf0aa('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0xe4a744,_0xf0aa('0xd'));_0x38bf88(_0x5b7efc[_0xf0aa('0x14')][_0xf0aa('0x13')]);}})[_0xf0aa('0x15')](function(_0x322ae0){logger[_0xf0aa('0x11')](_0xf0aa('0xc'),_0xe4a744,_0x322ae0);_0x579674(_0x322ae0);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 038b837..8b14c15 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 _0x8fe8=['/:id/transcribe','runTranscribe','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','index','get','/describe','isAuthenticated','show','/:id/download','download','downloads','downloadTranscribe','post','create'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0x8fe8,0x123));var _0x88fe=function(_0x1bef55,_0x37a6b2){_0x1bef55=_0x1bef55-0x0;var _0x9eea45=_0x8fe8[_0x1bef55];return _0x9eea45;};'use strict';var multer=require(_0x88fe('0x0'));var util=require(_0x88fe('0x1'));var path=require(_0x88fe('0x2'));var timeout=require(_0x88fe('0x3'));var express=require(_0x88fe('0x4'));var router=express[_0x88fe('0x5')]();var fs_extra=require(_0x88fe('0x6'));var auth=require(_0x88fe('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x88fe('0x8'));var controller=require(_0x88fe('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x88fe('0xa')]);router[_0x88fe('0xb')](_0x88fe('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x88fe('0xd')](),controller[_0x88fe('0xe')]);router[_0x88fe('0xb')](_0x88fe('0xf'),auth[_0x88fe('0xd')](),controller[_0x88fe('0x10')]);router[_0x88fe('0xb')]('/:id/downloads',controller[_0x88fe('0x11')]);router[_0x88fe('0xb')]('/:id/transcribe',auth[_0x88fe('0xd')](),controller[_0x88fe('0x12')]);router[_0x88fe('0x13')]('/',auth[_0x88fe('0xd')](),controller[_0x88fe('0x14')]);router['post'](_0x88fe('0x15'),auth[_0x88fe('0xd')](),controller[_0x88fe('0x16')]);router['put'](_0x88fe('0x17'),auth[_0x88fe('0xd')](),controller[_0x88fe('0x18')]);router['delete'](_0x88fe('0x17'),auth[_0x88fe('0xd')](),controller[_0x88fe('0x19')]);module['exports']=router; \ No newline at end of file +var _0x2f82=['create','/:id/transcribe','runTranscribe','/:id','update','delete','destroy','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post'];(function(_0x2cc659,_0x3981c0){var _0x37c538=function(_0x29778b){while(--_0x29778b){_0x2cc659['push'](_0x2cc659['shift']());}};_0x37c538(++_0x3981c0);}(_0x2f82,0xc8));var _0x22f8=function(_0x2d3206,_0x434cf5){_0x2d3206=_0x2d3206-0x0;var _0x18702d=_0x2f82[_0x2d3206];return _0x18702d;};'use strict';var multer=require('multer');var util=require(_0x22f8('0x0'));var path=require('path');var timeout=require(_0x22f8('0x1'));var express=require(_0x22f8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x22f8('0x3'));var config=require(_0x22f8('0x4'));var controller=require(_0x22f8('0x5'));router[_0x22f8('0x6')]('/',auth[_0x22f8('0x7')](),controller['index']);router[_0x22f8('0x6')](_0x22f8('0x8'),auth[_0x22f8('0x7')](),controller[_0x22f8('0x9')]);router[_0x22f8('0x6')]('/:id',auth[_0x22f8('0x7')](),controller['show']);router[_0x22f8('0x6')](_0x22f8('0xa'),auth['isAuthenticated'](),controller[_0x22f8('0xb')]);router[_0x22f8('0x6')](_0x22f8('0xc'),controller[_0x22f8('0xd')]);router[_0x22f8('0x6')]('/:id/transcribe',auth[_0x22f8('0x7')](),controller[_0x22f8('0xe')]);router[_0x22f8('0xf')]('/',auth[_0x22f8('0x7')](),controller[_0x22f8('0x10')]);router['post'](_0x22f8('0x11'),auth[_0x22f8('0x7')](),controller[_0x22f8('0x12')]);router['put'](_0x22f8('0x13'),auth[_0x22f8('0x7')](),controller[_0x22f8('0x14')]);router[_0x22f8('0x15')](_0x22f8('0x13'),auth[_0x22f8('0x7')](),controller[_0x22f8('0x16')]);module[_0x22f8('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 125efca..b90cf05 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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 93a5d4e..1889d12 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 _0xed7a=['error','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','ValidationError','Setting','findOne','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','status','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x19de6f,_0x12dc21){var _0x587129=function(_0x2f489c){while(--_0x2f489c){_0x19de6f['push'](_0x19de6f['shift']());}};_0x587129(++_0x12dc21);}(_0xed7a,0x111));var _0xaed7=function(_0xc4f3e8,_0x53d218){_0xc4f3e8=_0xc4f3e8-0x0;var _0x39da96=_0xed7a[_0xc4f3e8];return _0x39da96;};'use strict';var emlformat=require(_0xaed7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaed7('0x1'));var rp=require(_0xaed7('0x2'));var moment=require(_0xaed7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaed7('0x4'));var util=require(_0xaed7('0x5'));var path=require('path');var sox=require(_0xaed7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaed7('0x7'));var _=require(_0xaed7('0x8'));var squel=require(_0xaed7('0x9'));var crypto=require(_0xaed7('0xa'));var jsforce=require(_0xaed7('0xb'));var deskjs=require(_0xaed7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaed7('0xd'));var Papa=require(_0xaed7('0xe'));var AWS=require(_0xaed7('0xf'));var uuidv4=require(_0xaed7('0x10'));var Redis=require(_0xaed7('0x11'));var authService=require(_0xaed7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaed7('0x13'));var hardwareService=require(_0xaed7('0x14'));var logger=require(_0xaed7('0x15'))(_0xaed7('0x16'));var utils=require('../../config/utils');var config=require(_0xaed7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaed7('0x18'))['db'];function respondWithStatusCode(_0x1ab4ae,_0x3d2bab){_0x3d2bab=_0x3d2bab||0xcc;return function(_0x492c5c){if(_0x492c5c){return _0x1ab4ae[_0xaed7('0x19')](_0x3d2bab);}return _0x1ab4ae['status'](_0x3d2bab)[_0xaed7('0x1a')]();};}function respondWithResult(_0x28c8e2,_0x750324){_0x750324=_0x750324||0xc8;return function(_0x1473ae){if(_0x1473ae){return _0x28c8e2['status'](_0x750324)[_0xaed7('0x1b')](_0x1473ae);}};}function respondWithFilteredResult(_0x1acaa9,_0x13b7ee){return function(_0x5ce89f){if(_0x5ce89f){var _0x442c5e=typeof _0x13b7ee[_0xaed7('0x1c')]==='undefined'&&typeof _0x13b7ee[_0xaed7('0x1d')]===_0xaed7('0x1e');var _0x101030=_0x5ce89f['count'];var _0x1a108b=_0x442c5e?0x0:_0x13b7ee[_0xaed7('0x1c')];var _0x285b98=_0x442c5e?_0x5ce89f['count']:_0x13b7ee[_0xaed7('0x1c')]+_0x13b7ee[_0xaed7('0x1d')];var _0x731cde;if(_0x285b98>=_0x101030){_0x285b98=_0x101030;_0x731cde=0xc8;}else{_0x731cde=0xce;}_0x1acaa9[_0xaed7('0x1f')](_0x731cde);return _0x1acaa9[_0xaed7('0x20')](_0xaed7('0x21'),_0x1a108b+'-'+_0x285b98+'/'+_0x101030)['json'](_0x5ce89f);}return null;};}function patchUpdates(_0x348ef7){return function(_0x2e3593){try{jsonpatch[_0xaed7('0x22')](_0x2e3593,_0x348ef7,!![]);}catch(_0x176998){return BPromise[_0xaed7('0x23')](_0x176998);}return _0x2e3593[_0xaed7('0x24')]();};}function saveUpdates(_0x2562c6,_0x52754c){return function(_0xea417b){if(_0xea417b){return _0xea417b['update'](_0x2562c6)[_0xaed7('0x25')](function(_0x161ba8){return _0x161ba8;});}return null;};}function removeEntity(_0x35c434,_0x26dc45){return function(_0x2e85b4){if(_0x2e85b4){return _0x2e85b4[_0xaed7('0x26')]()[_0xaed7('0x25')](function(){_0x35c434[_0xaed7('0x1f')](0xcc)[_0xaed7('0x1a')]();});}};}function handleEntityNotFound(_0x322726,_0x4eb46c){return function(_0x4fd65a){if(!_0x4fd65a){_0x322726[_0xaed7('0x19')](0x194);}return _0x4fd65a;};}function handleError(_0x5bc9d2,_0x3a066f){_0x3a066f=_0x3a066f||0x1f4;return function(_0x1ba825){logger[_0xaed7('0x27')](_0x1ba825['stack']);if(_0x1ba825['name']){delete _0x1ba825[_0xaed7('0x28')];}_0x5bc9d2[_0xaed7('0x1f')](_0x3a066f)[_0xaed7('0x29')](_0x1ba825);};}exports[_0xaed7('0x2a')]=function(_0x478540,_0x211431){var _0x4eaa68={},_0x9a37b1={},_0x5568aa={'count':0x0,'rows':[]};var _0x59523f=_['map'](db[_0xaed7('0x2b')][_0xaed7('0x2c')],function(_0x3bf4d8){return{'name':_0x3bf4d8[_0xaed7('0x2d')],'type':_0x3bf4d8[_0xaed7('0x2e')][_0xaed7('0x2f')]};});_0x9a37b1[_0xaed7('0x30')]=_[_0xaed7('0x31')](_[_0xaed7('0x32')](_0x59523f,'name'),[_0xaed7('0x33')]);_0x9a37b1[_0xaed7('0x34')]=_[_0xaed7('0x35')](_0x478540['query']);_0x9a37b1[_0xaed7('0x36')]=_[_0xaed7('0x37')](_0x9a37b1[_0xaed7('0x30')],_0x9a37b1[_0xaed7('0x34')]);_0x4eaa68[_0xaed7('0x38')]=_[_0xaed7('0x37')](_0x9a37b1['model'],qs[_0xaed7('0x39')](_0x478540[_0xaed7('0x34')]['fields']));_0x4eaa68[_0xaed7('0x38')]=_0x4eaa68[_0xaed7('0x38')][_0xaed7('0x3a')]?_0x4eaa68[_0xaed7('0x38')]:_0x9a37b1[_0xaed7('0x30')];if(!_0x478540[_0xaed7('0x34')][_0xaed7('0x3b')](_0xaed7('0x3c'))){_0x4eaa68[_0xaed7('0x1d')]=qs['limit'](_0x478540[_0xaed7('0x34')][_0xaed7('0x1d')]);_0x4eaa68[_0xaed7('0x1c')]=qs['offset'](_0x478540[_0xaed7('0x34')][_0xaed7('0x1c')]);}_0x4eaa68[_0xaed7('0x3d')]=qs[_0xaed7('0x3e')](_0x478540[_0xaed7('0x34')][_0xaed7('0x3e')]);_0x4eaa68[_0xaed7('0x3f')]=qs['filters'](_[_0xaed7('0x40')](_0x478540['query'],_0x9a37b1[_0xaed7('0x36')]),_0x59523f);if(_0x478540['query'][_0xaed7('0x41')]){_0x4eaa68[_0xaed7('0x3f')]=_[_0xaed7('0x42')](_0x4eaa68[_0xaed7('0x3f')],{'$or':_[_0xaed7('0x32')](_0x59523f,function(_0xcba2d6){if(_0xcba2d6['type']!==_0xaed7('0x43')){var _0x8b13f7={};_0x8b13f7[_0xcba2d6[_0xaed7('0x28')]]={'$like':'%'+_0x478540['query'][_0xaed7('0x41')]+'%'};return _0x8b13f7;}})});}_0x4eaa68=_[_0xaed7('0x42')]({},_0x4eaa68,_0x478540[_0xaed7('0x44')]);var _0x3d4f38={'where':_0x4eaa68[_0xaed7('0x3f')]};return db['VoiceRecording'][_0xaed7('0x45')](_0x3d4f38)['then'](function(_0x5d16bf){_0x5568aa[_0xaed7('0x45')]=_0x5d16bf;if(_0x478540['query'][_0xaed7('0x46')]){_0x4eaa68[_0xaed7('0x47')]=[{'all':!![]}];}return db[_0xaed7('0x2b')][_0xaed7('0x48')](_0x4eaa68);})[_0xaed7('0x25')](function(_0x191de8){_0x5568aa[_0xaed7('0x49')]=_0x191de8;return _0x5568aa;})['then'](respondWithFilteredResult(_0x211431,_0x4eaa68))[_0xaed7('0x4a')](handleError(_0x211431,null));};exports[_0xaed7('0x4b')]=function(_0x40b936,_0x47619e){var _0x3d805e={'raw':![],'where':{'id':_0x40b936[_0xaed7('0x4c')]['id']}},_0x3b89fb={};_0x3b89fb[_0xaed7('0x30')]=_['keys'](db[_0xaed7('0x2b')][_0xaed7('0x2c')]);_0x3b89fb[_0xaed7('0x34')]=_[_0xaed7('0x35')](_0x40b936[_0xaed7('0x34')]);_0x3b89fb['filters']=_[_0xaed7('0x37')](_0x3b89fb['model'],_0x3b89fb[_0xaed7('0x34')]);_0x3d805e['attributes']=_[_0xaed7('0x37')](_0x3b89fb[_0xaed7('0x30')],qs['fields'](_0x40b936[_0xaed7('0x34')][_0xaed7('0x39')]));_0x3d805e['attributes']=_0x3d805e['attributes'][_0xaed7('0x3a')]?_0x3d805e[_0xaed7('0x38')]:_0x3b89fb[_0xaed7('0x30')];if(_0x40b936[_0xaed7('0x34')][_0xaed7('0x46')]){_0x3d805e[_0xaed7('0x47')]=[{'all':!![]}];}_0x3d805e=_['merge']({},_0x3d805e,_0x40b936['options']);return db[_0xaed7('0x2b')][_0xaed7('0x4d')](_0x3d805e)['then'](handleEntityNotFound(_0x47619e,null))[_0xaed7('0x25')](respondWithResult(_0x47619e,null))[_0xaed7('0x4a')](handleError(_0x47619e,null));};exports[_0xaed7('0x4e')]=function(_0xe861cc,_0x138a9a){return db[_0xaed7('0x2b')][_0xaed7('0x4e')](_0xe861cc[_0xaed7('0x4f')],{})[_0xaed7('0x25')](respondWithResult(_0x138a9a,0xc9))[_0xaed7('0x4a')](handleError(_0x138a9a,null));};exports[_0xaed7('0x50')]=function(_0x2dd40c,_0x15daa6){if(_0x2dd40c[_0xaed7('0x4f')]['id']){delete _0x2dd40c['body']['id'];}return db[_0xaed7('0x2b')][_0xaed7('0x4d')]({'where':{'id':_0x2dd40c[_0xaed7('0x4c')]['id']}})[_0xaed7('0x25')](handleEntityNotFound(_0x15daa6,null))['then'](saveUpdates(_0x2dd40c[_0xaed7('0x4f')],null))[_0xaed7('0x25')](respondWithResult(_0x15daa6,null))['catch'](handleError(_0x15daa6,null));};exports[_0xaed7('0x51')]=function(_0xf2a043,_0x278a75){return db[_0xaed7('0x2b')][_0xaed7('0x51')]()[_0xaed7('0x25')](respondWithResult(_0x278a75,null))[_0xaed7('0x4a')](handleError(_0x278a75,null));};exports['download']=function(_0x1c2c23,_0x363c3f,_0x37be4d){var _0x498ea0=require(_0xaed7('0x52'));var _0x11cc11=![];var _0x5c6ee8={};if(_0x1c2c23[_0xaed7('0x34')][_0xaed7('0x2e')]&&_0x1c2c23['query'][_0xaed7('0x2e')]===_0xaed7('0x53')){_0x5c6ee8[_0xaed7('0x53')]=_0x1c2c23[_0xaed7('0x4c')]['id'];}else{_0x5c6ee8['id']=_0x1c2c23['params']['id'];}return db[_0xaed7('0x2b')][_0xaed7('0x4d')]({'where':_0x5c6ee8,'attributes':['id',_0xaed7('0x54')],'raw':!![]})[_0xaed7('0x25')](handleEntityNotFound(_0x363c3f,null))['then'](function(_0x177fb4){if(_0x177fb4){var _0x191a19=_0x177fb4[_0xaed7('0x54')];var _0x204c7e=util[_0xaed7('0x33')](_0xaed7('0x55'),_0x191a19);if(fs['existsSync'](_0x204c7e)){_0x11cc11=!![];return _0x498ea0[_0xaed7('0x56')](_0x204c7e,_0x191a19,config[_0xaed7('0x57')]['recording'])[_0xaed7('0x25')](function(){return _0x177fb4;});}return _0x177fb4;}})[_0xaed7('0x25')](function(_0xc45b91){if(_0xc45b91){var _0x1cbc91=_0xc45b91[_0xaed7('0x54')];if(!fs[_0xaed7('0x58')](_0x1cbc91)){throw new db[(_0xaed7('0x59'))]['ValidationError'](_0xaed7('0x5a'));}if(_0xc45b91[_0xaed7('0x5b')]){return _0x363c3f[_0xaed7('0x5c')](_0x1cbc91,_0xc45b91['filename']+path[_0xaed7('0x5d')](_0x1cbc91),function(){if(_0x11cc11){fs[_0xaed7('0x5e')](_0x1cbc91);}});}else{return _0x363c3f[_0xaed7('0x5c')](_0x1cbc91,function(_0x58190b){if(_0x11cc11){fs[_0xaed7('0x5e')](_0x1cbc91);}});}}})['catch'](function(_0x480b80){if(_0x480b80[_0xaed7('0x5f')]===_0xaed7('0x5a')){_0x363c3f[_0xaed7('0x1f')](0x194)[_0xaed7('0x29')](_0xaed7('0x60'));}else{return handleError(_0x363c3f,null);}});};exports[_0xaed7('0x61')]=function(_0x44de87,_0x376f25,_0x26da3c){var _0x5b8c01=require(_0xaed7('0x52'));var _0xb4d863=![];var _0xc9cf1c={'$and':[db[_0xaed7('0x62')][_0xaed7('0x3f')](db[_0xaed7('0x62')]['fn'](_0xaed7('0x63'),db['sequelize'][_0xaed7('0x64')]('uniqueid')),_0x44de87['query'][_0xaed7('0x65')])]};if(_0x44de87[_0xaed7('0x34')][_0xaed7('0x2e')]&&_0x44de87[_0xaed7('0x34')][_0xaed7('0x2e')]===_0xaed7('0x53')){_0xc9cf1c[_0xaed7('0x66')]['push']({'uniqueid':_0x44de87['params']['id']});}else{_0xc9cf1c[_0xaed7('0x66')][_0xaed7('0x67')]({'id':_0x44de87[_0xaed7('0x4c')]['id']});}return db[_0xaed7('0x2b')][_0xaed7('0x4d')]({'where':_0xc9cf1c,'attributes':['id','value'],'raw':!![]})[_0xaed7('0x25')](handleEntityNotFound(_0x376f25,null))[_0xaed7('0x25')](function(_0x58ca02){if(_0x58ca02){var _0x50ab5d=util['format'](_0xaed7('0x55'),_0x58ca02['value']);if(fs['existsSync'](_0x50ab5d)){_0xb4d863=!![];return _0x5b8c01[_0xaed7('0x56')](_0x50ab5d,_0x58ca02[_0xaed7('0x54')],config[_0xaed7('0x57')][_0xaed7('0x68')])[_0xaed7('0x25')](function(){return _0x58ca02;});}return _0x58ca02;}})[_0xaed7('0x25')](function(_0x2cdb98){if(_0x2cdb98){if(!fs[_0xaed7('0x58')](_0x2cdb98[_0xaed7('0x54')])){throw new db[(_0xaed7('0x59'))]['ValidationError'](_0xaed7('0x5a'));}if(_0x2cdb98[_0xaed7('0x5b')]){return _0x376f25[_0xaed7('0x5c')](_0x2cdb98[_0xaed7('0x54')],_0x2cdb98['filename']+path[_0xaed7('0x5d')](_0x2cdb98[_0xaed7('0x54')]),function(){if(_0xb4d863){fs[_0xaed7('0x5e')](_0x2cdb98[_0xaed7('0x54')]);}});}else{return _0x376f25[_0xaed7('0x5c')](_0x2cdb98[_0xaed7('0x54')],function(_0x5d4b16){if(_0xb4d863){fs[_0xaed7('0x5e')](_0x2cdb98[_0xaed7('0x54')]);}});}}})[_0xaed7('0x4a')](handleError(_0x376f25,null));};exports[_0xaed7('0x26')]=function(_0x10bfbc,_0x525ec3){return db[_0xaed7('0x2b')][_0xaed7('0x4d')]({'where':{'id':_0x10bfbc[_0xaed7('0x4c')]['id']}})['then'](function(_0x4c7f93){if(_[_0xaed7('0x69')](_0x4c7f93)){throw new ReferenceError(_0xaed7('0x6a'));}return _0x4c7f93;})[_0xaed7('0x25')](function(_0x3f2089){var _0x38bfab=_0x3f2089[_0xaed7('0x54')];logger[_0xaed7('0x6b')](_0xaed7('0x6c'),_0x38bfab);if(!_[_0xaed7('0x69')](_0x3f2089[_0xaed7('0x54')])&&fs[_0xaed7('0x58')](_0x38bfab)){logger[_0xaed7('0x6b')](_0xaed7('0x6d')+_0x38bfab+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x38bfab);}_0x38bfab=_0x38bfab+_0xaed7('0x6e');if(!_[_0xaed7('0x69')](_0x3f2089[_0xaed7('0x54')])&&fs['existsSync'](_0x38bfab)){logger[_0xaed7('0x6b')](_0xaed7('0x6d')+_0x38bfab+_0xaed7('0x6f'));fs['unlinkSync'](_0x38bfab);}return _0x3f2089;})[_0xaed7('0x25')](function(_0x50d867){if(!_0x50d867)throw new InternalError();return _0x50d867[_0xaed7('0x26')]();})[_0xaed7('0x25')](function(){_0x525ec3[_0xaed7('0x1f')](0xcc)['end']();})[_0xaed7('0x4a')](handleError(_0x525ec3,null));};function getBucketslist(_0x1b3dfa,_0x3b523e,_0x2dd023){return new Promise(function(_0x59c34f,_0x200dcd){var _0x47f795=new AWS['S3']({'accessKeyId':_0x3b523e,'secretAccessKey':_0x1b3dfa,'region':_0x2dd023});_0x47f795[_0xaed7('0x70')]({},function(_0x226ece,_0x19fa3d){if(_0x226ece){return _0x200dcd(_0x226ece);}else{return _0x59c34f(_0x19fa3d);}});});}function createBucket(_0x458624,_0x3407e7,_0x2f213f,_0x1a9af6){return new Promise(function(_0x5ca6f,_0x412354){var _0x4a796c=new AWS['S3']({'accessKeyId':_0x3407e7,'secretAccessKey':_0x458624,'region':_0x2f213f});_0x4a796c['createBucket']({'Bucket':_0x1a9af6},function(_0xfe5663,_0x2ab369){if(_0xfe5663){return _0x412354(_0xfe5663);}else{return _0x5ca6f(_0x2ab369);}});});}function uploadFile(_0x41e5af,_0x32d05d,_0x1a00d4,_0x5609b2,_0x30a753,_0x128afb){return new Promise(function(_0x28fc3f,_0x3695e6){var _0x568b81=new AWS['S3']({'accessKeyId':_0x32d05d,'secretAccessKey':_0x41e5af,'region':_0x1a00d4});_0x568b81[_0xaed7('0x71')]({'Bucket':_0x5609b2,'Key':_0x30a753,'Body':_0x128afb},function(_0x262fde,_0x5c7a2f){if(_0x262fde){return _0x3695e6(_0x262fde);}else{return _0x28fc3f(_0x5c7a2f);}});});}function startTranscribe(_0x4d1d52,_0x4409c4,_0x3aa259,_0x2f4ed6,_0x7d3f0a,_0x160af9){return new Promise(function(_0x5996c8,_0x2f77e4){var _0x28351d=new AWS[(_0xaed7('0x72'))]({'accessKeyId':_0x4409c4,'secretAccessKey':_0x4d1d52,'region':_0x3aa259});_0x28351d[_0xaed7('0x73')]({'TranscriptionJobName':_0x2f4ed6,'LanguageCode':_0x7d3f0a,'Media':{'MediaFileUri':_0x160af9}},function(_0x4fc4db,_0x42ca47){if(_0x4fc4db){return _0x2f77e4(_0x4fc4db);}else{return _0x5996c8(_0x42ca47);}});});}function transcribe(_0x431f3e,_0x463ce0,_0x1f8d9a,_0x5a35aa,_0xbcf0e8,_0x3ce6b9,_0x4294a2){return new Promise(function(_0x5716a2,_0x48a3c2){var _0x188031={};logger[_0xaed7('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x431f3e,_0xbcf0e8));return uploadFile(_0x463ce0,_0x1f8d9a,_0x5a35aa,_0xbcf0e8,path['basename'](_0x3ce6b9),fs[_0xaed7('0x74')](_0x3ce6b9))[_0xaed7('0x25')](function(_0x494cc4){logger[_0xaed7('0x6b')](util[_0xaed7('0x33')](_0xaed7('0x75'),_0x431f3e,_0xbcf0e8,_0x494cc4['Location']));_0x188031[_0xaed7('0x76')]=_0x494cc4[_0xaed7('0x77')];_0x188031[_0xaed7('0x78')]=_0x494cc4['Location'];logger[_0xaed7('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x431f3e));return startTranscribe(_0x463ce0,_0x1f8d9a,_0x5a35aa,uuidv4(),_0x4294a2,_0x494cc4[_0xaed7('0x79')]);})['then'](function(_0x5b6baf){logger[_0xaed7('0x6b')](util[_0xaed7('0x33')](_0xaed7('0x7a'),_0x431f3e,_0x5b6baf[_0xaed7('0x7b')][_0xaed7('0x7c')]));_0x188031[_0xaed7('0x7d')]=_0x5b6baf[_0xaed7('0x7b')][_0xaed7('0x7c')];_0x188031[_0xaed7('0x7e')]=_0x5b6baf['TranscriptionJob']['TranscriptionJobStatus'];return _0x5716a2(_0x188031);})[_0xaed7('0x4a')](function(_0x49143d){return _0x48a3c2(_0x49143d);});});}exports[_0xaed7('0x7f')]=function(_0x2b4d7a,_0x4ecc0b,_0x3aee9c){var _0x36f4c4;var _0x38db16;var _0x22ddc5;var _0x5512cd=require('../../components/encryptor');return db['VoiceRecording']['findOne']({'where':{'id':_0x2b4d7a[_0xaed7('0x4c')]['id']}})[_0xaed7('0x25')](function(_0x540a51){if(_0x540a51){var _0xf808e1=util['format'](_0xaed7('0x55'),_0x540a51[_0xaed7('0x54')]);if(fs[_0xaed7('0x58')](_0xf808e1)){cypher=!![];return _0x5512cd['decryptFile'](_0xf808e1,_0x540a51[_0xaed7('0x54')],config[_0xaed7('0x57')][_0xaed7('0x68')])[_0xaed7('0x25')](function(){return _0x540a51;});}return _0x540a51;}})['then'](function(_0x274c90){if(!_0x274c90){throw new db[(_0xaed7('0x59'))][(_0xaed7('0x80'))]('Voice\x20Recording\x20not\x20found');}_0x38db16=_0x274c90;return db[_0xaed7('0x81')][_0xaed7('0x82')]({'where':{'id':0x1}});})[_0xaed7('0x25')](handleEntityNotFound(_0x4ecc0b,null))[_0xaed7('0x25')](function(_0x1a7bc5){if(_0x1a7bc5){_0x36f4c4=_0x1a7bc5;if(!_0x36f4c4[_0xaed7('0x83')]||!_0x36f4c4['transcribeAccountId']||!_0x36f4c4[_0xaed7('0x84')]||!_0x36f4c4[_0xaed7('0x85')]||!_0x36f4c4['bucket']){throw new db['Sequelize'][(_0xaed7('0x80'))](_0xaed7('0x86'));}if(_0x2b4d7a[_0xaed7('0x4f')][_0xaed7('0x87')]&&(!_0x36f4c4['sentiment']||!_0x36f4c4['sentimentAccountId']||!_0x36f4c4[_0xaed7('0x88')]||!_0x36f4c4['language']||!_0x36f4c4[_0xaed7('0x76')])){throw new db[(_0xaed7('0x59'))]['ValidationError'](_0xaed7('0x89'));}return db[_0xaed7('0x8a')][_0xaed7('0x82')]({'where':{'id':_0x36f4c4[_0xaed7('0x8b')]}});}})[_0xaed7('0x25')](function(_0x1d5e9a){if(!_0x1d5e9a){throw new db[(_0xaed7('0x59'))]['ValidationError'](_0xaed7('0x8c'));}if(!_0x1d5e9a[_0xaed7('0x8d')]||!_0x1d5e9a[_0xaed7('0x8e')]){throw new db[(_0xaed7('0x59'))][(_0xaed7('0x80'))]('Cloud\x20Provider\x20not\x20configured');}_0x22ddc5=_0x1d5e9a;return getBucketslist(_0x22ddc5[_0xaed7('0x8d')],_0x22ddc5[_0xaed7('0x8e')],_0x36f4c4[_0xaed7('0x84')]);})['then'](function(_0x329c16){if(_0x329c16&&_0x329c16[_0xaed7('0x8f')]){var _0x15a8e5=_[_0xaed7('0x4d')](_0x329c16[_0xaed7('0x8f')],function(_0x6b65d9){return _0x6b65d9[_0xaed7('0x90')]===_0x36f4c4[_0xaed7('0x76')];});if(!_0x15a8e5){logger[_0xaed7('0x6b')](util[_0xaed7('0x33')](_0xaed7('0x91'),_0x2b4d7a[_0xaed7('0x4c')]['id'],_0x36f4c4[_0xaed7('0x76')]));return createBucket(_0x22ddc5[_0xaed7('0x8d')],_0x22ddc5[_0xaed7('0x8e')],_0x36f4c4[_0xaed7('0x84')],_0x36f4c4[_0xaed7('0x76')]);}logger[_0xaed7('0x6b')](util[_0xaed7('0x33')](_0xaed7('0x92'),_0x2b4d7a['params']['id'],_0x36f4c4['bucket']));return;}})[_0xaed7('0x25')](function(_0x46a4cf){if(_0x38db16[_0xaed7('0x7e')]===_0xaed7('0x93')){return transcribe(_0x2b4d7a[_0xaed7('0x4c')]['id'],_0x22ddc5[_0xaed7('0x8d')],_0x22ddc5[_0xaed7('0x8e')],_0x36f4c4['transcribeRegion'],_0x36f4c4[_0xaed7('0x76')],_0x38db16['value'],_0x36f4c4[_0xaed7('0x85')]);}else{logger['info'](util[_0xaed7('0x33')](_0xaed7('0x94'),_0x2b4d7a[_0xaed7('0x4c')]['id']));return{'transcribeStatus':_0xaed7('0x95')};}})[_0xaed7('0x25')](function(_0x32661b){if(_0x32661b){_0x32661b[_0xaed7('0x96')]=_0x2b4d7a['body'][_0xaed7('0x87')];return _0x38db16[_0xaed7('0x97')](_0x32661b);}})[_0xaed7('0x25')](respondWithResult(_0x4ecc0b,null))[_0xaed7('0x4a')](handleError(_0x4ecc0b,null));};function writeFile(_0xd9941b,_0x578ebd){return new Promise(function(_0x1a2d03,_0x365fa7){fs[_0xaed7('0x98')](_0x578ebd,_0xd9941b,function(_0x713ebb,_0x3a3788){if(_0x713ebb){return _0x365fa7(_0x713ebb);}else{return _0x1a2d03(_0x3a3788);}});});}exports['downloadTranscribe']=function(_0x4615de,_0x526fa3,_0x25ae95){return db['VoiceRecording'][_0xaed7('0x82')]({'where':{'id':_0x4615de['params']['id']}})[_0xaed7('0x25')](handleEntityNotFound(_0x526fa3))['then'](function(_0x184da2){if(_0x184da2&&_0x184da2[_0xaed7('0x99')]){var _0x1fc15c=_0x184da2['fileText'];var _0x290705=config[_0xaed7('0x9a')]+'/server/files/transcribes/transcribe_'+_0x184da2['id']+'.txt';if(fs[_0xaed7('0x58')](_0x290705)){return _0x290705;}return writeFile(_0x1fc15c,_0x290705)['then'](function(){return _0x290705;});}else{throw new db[(_0xaed7('0x59'))][(_0xaed7('0x80'))](_0xaed7('0x9b'));}})['then'](function(_0x55085b){return _0x526fa3[_0xaed7('0x5c')](_0x55085b);})[_0xaed7('0x4a')](handleError(_0x526fa3));}; \ No newline at end of file +var _0xf34d=['json','limit','undefined','count','offset','set','apply','save','update','then','end','error','name','send','index','map','rawAttributes','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','VoiceRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','download','../../components/encryptor','uniqueid','value','decryptFile','secrets','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3e44c8,_0x1efb50){var _0x5a2aba=function(_0x25383e){while(--_0x25383e){_0x3e44c8['push'](_0x3e44c8['shift']());}};_0x5a2aba(++_0x1efb50);}(_0xf34d,0x78));var _0xdf34=function(_0x55b01e,_0x56d558){_0x55b01e=_0x55b01e-0x0;var _0x41c4b0=_0xf34d[_0x55b01e];return _0x41c4b0;};'use strict';var emlformat=require(_0xdf34('0x0'));var rimraf=require(_0xdf34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdf34('0x2'));var BPromise=require(_0xdf34('0x3'));var Mustache=require(_0xdf34('0x4'));var util=require('util');var path=require('path');var sox=require(_0xdf34('0x5'));var csv=require(_0xdf34('0x6'));var ejs=require(_0xdf34('0x7'));var fs=require('fs');var fs_extra=require(_0xdf34('0x8'));var _=require('lodash');var squel=require(_0xdf34('0x9'));var crypto=require('crypto');var jsforce=require(_0xdf34('0xa'));var deskjs=require(_0xdf34('0xb'));var toCsv=require(_0xdf34('0x6'));var querystring=require(_0xdf34('0xc'));var Papa=require(_0xdf34('0xd'));var AWS=require(_0xdf34('0xe'));var uuidv4=require(_0xdf34('0xf'));var Redis=require(_0xdf34('0x10'));var authService=require(_0xdf34('0x11'));var qs=require(_0xdf34('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf34('0x13'));var logger=require(_0xdf34('0x14'))(_0xdf34('0x15'));var utils=require(_0xdf34('0x16'));var config=require(_0xdf34('0x17'));var licenseUtil=require(_0xdf34('0x18'));var db=require(_0xdf34('0x19'))['db'];function respondWithStatusCode(_0xb863ef,_0x5b0588){_0x5b0588=_0x5b0588||0xcc;return function(_0x504f4b){if(_0x504f4b){return _0xb863ef[_0xdf34('0x1a')](_0x5b0588);}return _0xb863ef['status'](_0x5b0588)['end']();};}function respondWithResult(_0x4a77a6,_0x491f13){_0x491f13=_0x491f13||0xc8;return function(_0x2ae965){if(_0x2ae965){return _0x4a77a6[_0xdf34('0x1b')](_0x491f13)[_0xdf34('0x1c')](_0x2ae965);}};}function respondWithFilteredResult(_0x440ed2,_0x4a8f12){return function(_0x2c0182){if(_0x2c0182){var _0x5599e3=typeof _0x4a8f12['offset']==='undefined'&&typeof _0x4a8f12[_0xdf34('0x1d')]===_0xdf34('0x1e');var _0x39f695=_0x2c0182[_0xdf34('0x1f')];var _0x3fa995=_0x5599e3?0x0:_0x4a8f12[_0xdf34('0x20')];var _0x89afdd=_0x5599e3?_0x2c0182[_0xdf34('0x1f')]:_0x4a8f12['offset']+_0x4a8f12[_0xdf34('0x1d')];var _0x5e2141;if(_0x89afdd>=_0x39f695){_0x89afdd=_0x39f695;_0x5e2141=0xc8;}else{_0x5e2141=0xce;}_0x440ed2[_0xdf34('0x1b')](_0x5e2141);return _0x440ed2[_0xdf34('0x21')]('Content-Range',_0x3fa995+'-'+_0x89afdd+'/'+_0x39f695)[_0xdf34('0x1c')](_0x2c0182);}return null;};}function patchUpdates(_0x475766){return function(_0x5305dc){try{jsonpatch[_0xdf34('0x22')](_0x5305dc,_0x475766,!![]);}catch(_0x79bfca){return BPromise['reject'](_0x79bfca);}return _0x5305dc[_0xdf34('0x23')]();};}function saveUpdates(_0x2baab1,_0x2502d9){return function(_0x11236f){if(_0x11236f){return _0x11236f[_0xdf34('0x24')](_0x2baab1)[_0xdf34('0x25')](function(_0x4388f3){return _0x4388f3;});}return null;};}function removeEntity(_0x2a171b,_0x2cb981){return function(_0x3efaf2){if(_0x3efaf2){return _0x3efaf2['destroy']()['then'](function(){_0x2a171b[_0xdf34('0x1b')](0xcc)[_0xdf34('0x26')]();});}};}function handleEntityNotFound(_0x4db62f,_0xddefcd){return function(_0x2b8557){if(!_0x2b8557){_0x4db62f[_0xdf34('0x1a')](0x194);}return _0x2b8557;};}function handleError(_0x355b6d,_0x32e54a){_0x32e54a=_0x32e54a||0x1f4;return function(_0x40a33f){logger[_0xdf34('0x27')](_0x40a33f['stack']);if(_0x40a33f[_0xdf34('0x28')]){delete _0x40a33f[_0xdf34('0x28')];}_0x355b6d[_0xdf34('0x1b')](_0x32e54a)[_0xdf34('0x29')](_0x40a33f);};}exports[_0xdf34('0x2a')]=function(_0x3dd182,_0x36e026){var _0x3de684={},_0x5e6a10={},_0x3789a8={'count':0x0,'rows':[]};var _0x31c667=_[_0xdf34('0x2b')](db['VoiceRecording'][_0xdf34('0x2c')],function(_0x5b58d0){return{'name':_0x5b58d0['fieldName'],'type':_0x5b58d0['type'][_0xdf34('0x2d')]};});_0x5e6a10[_0xdf34('0x2e')]=_[_0xdf34('0x2f')](_[_0xdf34('0x2b')](_0x31c667,'name'),[_0xdf34('0x30')]);_0x5e6a10[_0xdf34('0x31')]=_[_0xdf34('0x32')](_0x3dd182[_0xdf34('0x31')]);_0x5e6a10[_0xdf34('0x33')]=_[_0xdf34('0x34')](_0x5e6a10[_0xdf34('0x2e')],_0x5e6a10[_0xdf34('0x31')]);_0x3de684[_0xdf34('0x35')]=_[_0xdf34('0x34')](_0x5e6a10[_0xdf34('0x2e')],qs[_0xdf34('0x36')](_0x3dd182[_0xdf34('0x31')]['fields']));_0x3de684[_0xdf34('0x35')]=_0x3de684[_0xdf34('0x35')]['length']?_0x3de684[_0xdf34('0x35')]:_0x5e6a10[_0xdf34('0x2e')];if(!_0x3dd182['query'][_0xdf34('0x37')](_0xdf34('0x38'))){_0x3de684[_0xdf34('0x1d')]=qs[_0xdf34('0x1d')](_0x3dd182[_0xdf34('0x31')][_0xdf34('0x1d')]);_0x3de684[_0xdf34('0x20')]=qs['offset'](_0x3dd182[_0xdf34('0x31')]['offset']);}_0x3de684['order']=qs[_0xdf34('0x39')](_0x3dd182[_0xdf34('0x31')]['sort']);_0x3de684[_0xdf34('0x3a')]=qs[_0xdf34('0x33')](_['pick'](_0x3dd182[_0xdf34('0x31')],_0x5e6a10[_0xdf34('0x33')]),_0x31c667);if(_0x3dd182[_0xdf34('0x31')][_0xdf34('0x3b')]){_0x3de684[_0xdf34('0x3a')]=_['merge'](_0x3de684[_0xdf34('0x3a')],{'$or':_[_0xdf34('0x2b')](_0x31c667,function(_0x5c290a){if(_0x5c290a[_0xdf34('0x3c')]!==_0xdf34('0x3d')){var _0xf1f861={};_0xf1f861[_0x5c290a['name']]={'$like':'%'+_0x3dd182[_0xdf34('0x31')][_0xdf34('0x3b')]+'%'};return _0xf1f861;}})});}_0x3de684=_[_0xdf34('0x3e')]({},_0x3de684,_0x3dd182[_0xdf34('0x3f')]);var _0x4a4275={'where':_0x3de684[_0xdf34('0x3a')]};return db[_0xdf34('0x40')][_0xdf34('0x1f')](_0x4a4275)['then'](function(_0x2eb988){_0x3789a8[_0xdf34('0x1f')]=_0x2eb988;if(_0x3dd182[_0xdf34('0x31')][_0xdf34('0x41')]){_0x3de684[_0xdf34('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0xdf34('0x43')](_0x3de684);})[_0xdf34('0x25')](function(_0x204e21){_0x3789a8[_0xdf34('0x44')]=_0x204e21;return _0x3789a8;})[_0xdf34('0x25')](respondWithFilteredResult(_0x36e026,_0x3de684))['catch'](handleError(_0x36e026,null));};exports[_0xdf34('0x45')]=function(_0x3af325,_0x31d112){var _0x115cb0={'raw':![],'where':{'id':_0x3af325[_0xdf34('0x46')]['id']}},_0x7b9a92={};_0x7b9a92[_0xdf34('0x2e')]=_['keys'](db[_0xdf34('0x40')][_0xdf34('0x2c')]);_0x7b9a92[_0xdf34('0x31')]=_[_0xdf34('0x32')](_0x3af325['query']);_0x7b9a92['filters']=_[_0xdf34('0x34')](_0x7b9a92[_0xdf34('0x2e')],_0x7b9a92['query']);_0x115cb0[_0xdf34('0x35')]=_[_0xdf34('0x34')](_0x7b9a92[_0xdf34('0x2e')],qs[_0xdf34('0x36')](_0x3af325[_0xdf34('0x31')][_0xdf34('0x36')]));_0x115cb0[_0xdf34('0x35')]=_0x115cb0['attributes']['length']?_0x115cb0[_0xdf34('0x35')]:_0x7b9a92[_0xdf34('0x2e')];if(_0x3af325[_0xdf34('0x31')][_0xdf34('0x41')]){_0x115cb0[_0xdf34('0x42')]=[{'all':!![]}];}_0x115cb0=_[_0xdf34('0x3e')]({},_0x115cb0,_0x3af325[_0xdf34('0x3f')]);return db[_0xdf34('0x40')][_0xdf34('0x47')](_0x115cb0)[_0xdf34('0x25')](handleEntityNotFound(_0x31d112,null))['then'](respondWithResult(_0x31d112,null))[_0xdf34('0x48')](handleError(_0x31d112,null));};exports['create']=function(_0x40fced,_0x4a72d2){return db[_0xdf34('0x40')][_0xdf34('0x49')](_0x40fced['body'],{})[_0xdf34('0x25')](respondWithResult(_0x4a72d2,0xc9))[_0xdf34('0x48')](handleError(_0x4a72d2,null));};exports[_0xdf34('0x24')]=function(_0x11d872,_0x44f387){if(_0x11d872['body']['id']){delete _0x11d872[_0xdf34('0x4a')]['id'];}return db['VoiceRecording'][_0xdf34('0x47')]({'where':{'id':_0x11d872[_0xdf34('0x46')]['id']}})[_0xdf34('0x25')](handleEntityNotFound(_0x44f387,null))[_0xdf34('0x25')](saveUpdates(_0x11d872[_0xdf34('0x4a')],null))[_0xdf34('0x25')](respondWithResult(_0x44f387,null))[_0xdf34('0x48')](handleError(_0x44f387,null));};exports['describe']=function(_0x32525c,_0x2d77a1){return db[_0xdf34('0x40')]['describe']()[_0xdf34('0x25')](respondWithResult(_0x2d77a1,null))[_0xdf34('0x48')](handleError(_0x2d77a1,null));};exports[_0xdf34('0x4b')]=function(_0x2f389f,_0x24ffb9,_0x241fe6){var _0x2bacb4=require(_0xdf34('0x4c'));var _0x3520ab=![];var _0xa40959={};if(_0x2f389f['query'][_0xdf34('0x3c')]&&_0x2f389f['query']['type']===_0xdf34('0x4d')){_0xa40959[_0xdf34('0x4d')]=_0x2f389f[_0xdf34('0x46')]['id'];}else{_0xa40959['id']=_0x2f389f[_0xdf34('0x46')]['id'];}return db[_0xdf34('0x40')][_0xdf34('0x47')]({'where':_0xa40959,'attributes':['id',_0xdf34('0x4e')],'raw':!![]})[_0xdf34('0x25')](handleEntityNotFound(_0x24ffb9,null))[_0xdf34('0x25')](function(_0x45d173){if(_0x45d173){var _0x5d6e14=_0x45d173[_0xdf34('0x4e')];var _0x33ec07=util[_0xdf34('0x30')]('%s.cypher',_0x5d6e14);if(fs['existsSync'](_0x33ec07)){_0x3520ab=!![];return _0x2bacb4[_0xdf34('0x4f')](_0x33ec07,_0x5d6e14,config[_0xdf34('0x50')]['recording'])['then'](function(){return _0x45d173;});}return _0x45d173;}})['then'](function(_0x1100e0){if(_0x1100e0){var _0x5be727=_0x1100e0[_0xdf34('0x4e')];if(!fs[_0xdf34('0x51')](_0x5be727)){throw new db[(_0xdf34('0x52'))][(_0xdf34('0x53'))](_0xdf34('0x54'));}if(_0x1100e0['filename']){return _0x24ffb9['download'](_0x5be727,_0x1100e0[_0xdf34('0x55')]+path[_0xdf34('0x56')](_0x5be727),function(){if(_0x3520ab){fs['unlink'](_0x5be727);}});}else{return _0x24ffb9[_0xdf34('0x4b')](_0x5be727,function(_0x429688){if(_0x3520ab){fs['unlink'](_0x5be727);}});}}})[_0xdf34('0x48')](function(_0x31cc59){if(_0x31cc59[_0xdf34('0x57')]===_0xdf34('0x54')){_0x24ffb9[_0xdf34('0x1b')](0x194)[_0xdf34('0x29')](_0xdf34('0x58'));}else{return handleError(_0x24ffb9,null);}});};exports[_0xdf34('0x59')]=function(_0x315327,_0x4422e9,_0x1284d4){var _0x5041f9=require('../../components/encryptor');var _0x573199=![];var _0xf4c02d={'$and':[db[_0xdf34('0x5a')][_0xdf34('0x3a')](db[_0xdf34('0x5a')]['fn'](_0xdf34('0x5b'),db['sequelize'][_0xdf34('0x5c')](_0xdf34('0x4d'))),_0x315327['query'][_0xdf34('0x5d')])]};if(_0x315327['query'][_0xdf34('0x3c')]&&_0x315327['query'][_0xdf34('0x3c')]===_0xdf34('0x4d')){_0xf4c02d[_0xdf34('0x5e')][_0xdf34('0x5f')]({'uniqueid':_0x315327[_0xdf34('0x46')]['id']});}else{_0xf4c02d[_0xdf34('0x5e')][_0xdf34('0x5f')]({'id':_0x315327[_0xdf34('0x46')]['id']});}return db['VoiceRecording']['find']({'where':_0xf4c02d,'attributes':['id',_0xdf34('0x4e')],'raw':!![]})[_0xdf34('0x25')](handleEntityNotFound(_0x4422e9,null))['then'](function(_0x5655df){if(_0x5655df){var _0x374072=util[_0xdf34('0x30')](_0xdf34('0x60'),_0x5655df[_0xdf34('0x4e')]);if(fs['existsSync'](_0x374072)){_0x573199=!![];return _0x5041f9[_0xdf34('0x4f')](_0x374072,_0x5655df[_0xdf34('0x4e')],config['secrets']['recording'])[_0xdf34('0x25')](function(){return _0x5655df;});}return _0x5655df;}})[_0xdf34('0x25')](function(_0x330bc9){if(_0x330bc9){if(!fs[_0xdf34('0x51')](_0x330bc9[_0xdf34('0x4e')])){throw new db[(_0xdf34('0x52'))][(_0xdf34('0x53'))](_0xdf34('0x54'));}if(_0x330bc9[_0xdf34('0x55')]){return _0x4422e9[_0xdf34('0x4b')](_0x330bc9[_0xdf34('0x4e')],_0x330bc9[_0xdf34('0x55')]+path[_0xdf34('0x56')](_0x330bc9[_0xdf34('0x4e')]),function(){if(_0x573199){fs[_0xdf34('0x61')](_0x330bc9['value']);}});}else{return _0x4422e9[_0xdf34('0x4b')](_0x330bc9[_0xdf34('0x4e')],function(_0x304de2){if(_0x573199){fs[_0xdf34('0x61')](_0x330bc9['value']);}});}}})[_0xdf34('0x48')](handleError(_0x4422e9,null));};exports[_0xdf34('0x62')]=function(_0x9c8ba,_0xdb85df){return db[_0xdf34('0x40')]['find']({'where':{'id':_0x9c8ba[_0xdf34('0x46')]['id']}})[_0xdf34('0x25')](function(_0x291040){if(_[_0xdf34('0x63')](_0x291040)){throw new ReferenceError(_0xdf34('0x64'));}return _0x291040;})[_0xdf34('0x25')](function(_0x5b83f8){var _0x512c06=_0x5b83f8['value'];logger[_0xdf34('0x65')](_0xdf34('0x66'),_0x512c06);if(!_[_0xdf34('0x63')](_0x5b83f8['value'])&&fs[_0xdf34('0x51')](_0x512c06)){logger['info'](_0xdf34('0x67')+_0x512c06+_0xdf34('0x68'));fs[_0xdf34('0x69')](_0x512c06);}_0x512c06=_0x512c06+_0xdf34('0x6a');if(!_[_0xdf34('0x63')](_0x5b83f8['value'])&&fs[_0xdf34('0x51')](_0x512c06)){logger[_0xdf34('0x65')](_0xdf34('0x67')+_0x512c06+_0xdf34('0x68'));fs['unlinkSync'](_0x512c06);}return _0x5b83f8;})['then'](function(_0x218d38){if(!_0x218d38)throw new InternalError();return _0x218d38['destroy']();})['then'](function(){_0xdb85df[_0xdf34('0x1b')](0xcc)[_0xdf34('0x26')]();})[_0xdf34('0x48')](handleError(_0xdb85df,null));};function getBucketslist(_0x1963cf,_0x1f099c,_0x408160){return new Promise(function(_0x2fc836,_0x39542f){var _0x51bfbf=new AWS['S3']({'accessKeyId':_0x1f099c,'secretAccessKey':_0x1963cf,'region':_0x408160});_0x51bfbf[_0xdf34('0x6b')]({},function(_0x597333,_0x7d1402){if(_0x597333){return _0x39542f(_0x597333);}else{return _0x2fc836(_0x7d1402);}});});}function createBucket(_0x1149c9,_0x41218e,_0x50b627,_0x1fc6bf){return new Promise(function(_0xe89315,_0x48ced5){var _0x2499e6=new AWS['S3']({'accessKeyId':_0x41218e,'secretAccessKey':_0x1149c9,'region':_0x50b627});_0x2499e6['createBucket']({'Bucket':_0x1fc6bf},function(_0x4157aa,_0x6a101c){if(_0x4157aa){return _0x48ced5(_0x4157aa);}else{return _0xe89315(_0x6a101c);}});});}function uploadFile(_0x2caf96,_0x2cccb5,_0x243aa3,_0xad60b4,_0x1871ff,_0x45623c){return new Promise(function(_0x1587cc,_0x13d499){var _0x213d9b=new AWS['S3']({'accessKeyId':_0x2cccb5,'secretAccessKey':_0x2caf96,'region':_0x243aa3});_0x213d9b['upload']({'Bucket':_0xad60b4,'Key':_0x1871ff,'Body':_0x45623c},function(_0x3b8242,_0x1544f9){if(_0x3b8242){return _0x13d499(_0x3b8242);}else{return _0x1587cc(_0x1544f9);}});});}function startTranscribe(_0x4e5ece,_0x46b72b,_0x1136d9,_0x2796ff,_0x2055c5,_0x22ebef){return new Promise(function(_0x97f10e,_0x481268){var _0x596722=new AWS[(_0xdf34('0x6c'))]({'accessKeyId':_0x46b72b,'secretAccessKey':_0x4e5ece,'region':_0x1136d9});_0x596722['startTranscriptionJob']({'TranscriptionJobName':_0x2796ff,'LanguageCode':_0x2055c5,'Media':{'MediaFileUri':_0x22ebef}},function(_0x11bd42,_0x2a3268){if(_0x11bd42){return _0x481268(_0x11bd42);}else{return _0x97f10e(_0x2a3268);}});});}function transcribe(_0x17c331,_0x3d0dcb,_0x44499e,_0x32b627,_0xd1478a,_0x5740c4,_0x761e1){return new Promise(function(_0x57b572,_0xdca9e){var _0x3e3013={};logger[_0xdf34('0x65')](util['format'](_0xdf34('0x6d'),_0x17c331,_0xd1478a));return uploadFile(_0x3d0dcb,_0x44499e,_0x32b627,_0xd1478a,path['basename'](_0x5740c4),fs[_0xdf34('0x6e')](_0x5740c4))['then'](function(_0x3a3d86){logger[_0xdf34('0x65')](util[_0xdf34('0x30')](_0xdf34('0x6f'),_0x17c331,_0xd1478a,_0x3a3d86[_0xdf34('0x70')]));_0x3e3013[_0xdf34('0x71')]=_0x3a3d86[_0xdf34('0x72')];_0x3e3013[_0xdf34('0x73')]=_0x3a3d86[_0xdf34('0x70')];logger[_0xdf34('0x65')](util[_0xdf34('0x30')](_0xdf34('0x74'),_0x17c331));return startTranscribe(_0x3d0dcb,_0x44499e,_0x32b627,uuidv4(),_0x761e1,_0x3a3d86[_0xdf34('0x70')]);})[_0xdf34('0x25')](function(_0x231f13){logger[_0xdf34('0x65')](util[_0xdf34('0x30')](_0xdf34('0x75'),_0x17c331,_0x231f13['TranscriptionJob'][_0xdf34('0x76')]));_0x3e3013['transcribeName']=_0x231f13[_0xdf34('0x77')]['TranscriptionJobName'];_0x3e3013[_0xdf34('0x78')]=_0x231f13[_0xdf34('0x77')][_0xdf34('0x79')];return _0x57b572(_0x3e3013);})[_0xdf34('0x48')](function(_0x34d3bf){return _0xdca9e(_0x34d3bf);});});}exports[_0xdf34('0x7a')]=function(_0x38575e,_0x4d9ea1,_0x3aa8b3){var _0x4cf358;var _0xb5c6a;var _0x1536cd;var _0x1139cc=require(_0xdf34('0x4c'));return db[_0xdf34('0x40')][_0xdf34('0x7b')]({'where':{'id':_0x38575e[_0xdf34('0x46')]['id']}})[_0xdf34('0x25')](function(_0x1800ce){if(_0x1800ce){var _0x35fc93=util['format'](_0xdf34('0x60'),_0x1800ce['value']);if(fs[_0xdf34('0x51')](_0x35fc93)){cypher=!![];return _0x1139cc[_0xdf34('0x4f')](_0x35fc93,_0x1800ce[_0xdf34('0x4e')],config['secrets']['recording'])[_0xdf34('0x25')](function(){return _0x1800ce;});}return _0x1800ce;}})['then'](function(_0x28425f){if(!_0x28425f){throw new db[(_0xdf34('0x52'))]['ValidationError'](_0xdf34('0x7c'));}_0xb5c6a=_0x28425f;return db[_0xdf34('0x7d')][_0xdf34('0x7b')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4d9ea1,null))[_0xdf34('0x25')](function(_0x372418){if(_0x372418){_0x4cf358=_0x372418;if(!_0x4cf358[_0xdf34('0x7e')]||!_0x4cf358['transcribeAccountId']||!_0x4cf358[_0xdf34('0x7f')]||!_0x4cf358[_0xdf34('0x80')]||!_0x4cf358['bucket']){throw new db[(_0xdf34('0x52'))][(_0xdf34('0x53'))]('Transcribe\x20not\x20configured');}if(_0x38575e[_0xdf34('0x4a')][_0xdf34('0x81')]&&(!_0x4cf358['sentiment']||!_0x4cf358[_0xdf34('0x82')]||!_0x4cf358[_0xdf34('0x83')]||!_0x4cf358['language']||!_0x4cf358[_0xdf34('0x71')])){throw new db[(_0xdf34('0x52'))][(_0xdf34('0x53'))](_0xdf34('0x84'));}return db[_0xdf34('0x85')][_0xdf34('0x7b')]({'where':{'id':_0x4cf358['transcribeAccountId']}});}})[_0xdf34('0x25')](function(_0x90e0fe){if(!_0x90e0fe){throw new db[(_0xdf34('0x52'))][(_0xdf34('0x53'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x90e0fe['data1']||!_0x90e0fe[_0xdf34('0x86')]){throw new db['Sequelize'][(_0xdf34('0x53'))](_0xdf34('0x87'));}_0x1536cd=_0x90e0fe;return getBucketslist(_0x1536cd[_0xdf34('0x88')],_0x1536cd[_0xdf34('0x86')],_0x4cf358['transcribeRegion']);})[_0xdf34('0x25')](function(_0x5b2c53){if(_0x5b2c53&&_0x5b2c53['Buckets']){var _0x3741c9=_[_0xdf34('0x47')](_0x5b2c53['Buckets'],function(_0x209b9c){return _0x209b9c['Name']===_0x4cf358[_0xdf34('0x71')];});if(!_0x3741c9){logger['info'](util[_0xdf34('0x30')](_0xdf34('0x89'),_0x38575e['params']['id'],_0x4cf358[_0xdf34('0x71')]));return createBucket(_0x1536cd['data1'],_0x1536cd['data2'],_0x4cf358['transcribeRegion'],_0x4cf358[_0xdf34('0x71')]);}logger[_0xdf34('0x65')](util[_0xdf34('0x30')](_0xdf34('0x8a'),_0x38575e[_0xdf34('0x46')]['id'],_0x4cf358[_0xdf34('0x71')]));return;}})[_0xdf34('0x25')](function(_0x9c79bd){if(_0xb5c6a[_0xdf34('0x78')]==='NEW'){return transcribe(_0x38575e[_0xdf34('0x46')]['id'],_0x1536cd[_0xdf34('0x88')],_0x1536cd['data2'],_0x4cf358[_0xdf34('0x7f')],_0x4cf358[_0xdf34('0x71')],_0xb5c6a[_0xdf34('0x4e')],_0x4cf358[_0xdf34('0x80')]);}else{logger[_0xdf34('0x65')](util['format'](_0xdf34('0x8b'),_0x38575e['params']['id']));return{'transcribeStatus':_0xdf34('0x8c')};}})[_0xdf34('0x25')](function(_0x17e6d1){if(_0x17e6d1){_0x17e6d1[_0xdf34('0x8d')]=_0x38575e['body']['runSentiment'];return _0xb5c6a['updateAttributes'](_0x17e6d1);}})[_0xdf34('0x25')](respondWithResult(_0x4d9ea1,null))[_0xdf34('0x48')](handleError(_0x4d9ea1,null));};function writeFile(_0x31b71d,_0x2e1d31){return new Promise(function(_0x50e757,_0x5cd792){fs[_0xdf34('0x8e')](_0x2e1d31,_0x31b71d,function(_0x3b784f,_0x469451){if(_0x3b784f){return _0x5cd792(_0x3b784f);}else{return _0x50e757(_0x469451);}});});}exports[_0xdf34('0x8f')]=function(_0x19207f,_0x5c16fd,_0x5e59ee){return db['VoiceRecording']['findOne']({'where':{'id':_0x19207f['params']['id']}})[_0xdf34('0x25')](handleEntityNotFound(_0x5c16fd))['then'](function(_0xa7a1e){if(_0xa7a1e&&_0xa7a1e[_0xdf34('0x90')]){var _0x1ffd11=_0xa7a1e[_0xdf34('0x90')];var _0x4dabe4=config[_0xdf34('0x91')]+'/server/files/transcribes/transcribe_'+_0xa7a1e['id']+_0xdf34('0x92');if(fs[_0xdf34('0x51')](_0x4dabe4)){return _0x4dabe4;}return writeFile(_0x1ffd11,_0x4dabe4)['then'](function(){return _0x4dabe4;});}else{throw new db[(_0xdf34('0x52'))][(_0xdf34('0x53'))](_0xdf34('0x93'));}})['then'](function(_0x2edd5a){return _0x5c16fd[_0xdf34('0x4b')](_0x2edd5a);})[_0xdf34('0x48')](handleError(_0x5c16fd));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index c230ee0..29ae554 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 _0x7b1f=['define','VoiceRecording','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x44e800,_0x35a701){var _0x297773=function(_0x258ad5){while(--_0x258ad5){_0x44e800['push'](_0x44e800['shift']());}};_0x297773(++_0x35a701);}(_0x7b1f,0x13b));var _0xf7b1=function(_0xd89cec,_0x4e3c06){_0xd89cec=_0xd89cec-0x0;var _0x2d5bb3=_0x7b1f[_0xd89cec];return _0x2d5bb3;};'use strict';var _=require(_0xf7b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf7b1('0x1'));var moment=require(_0xf7b1('0x2'));var BPromise=require(_0xf7b1('0x3'));var rp=require(_0xf7b1('0x4'));var fs=require('fs');var path=require(_0xf7b1('0x5'));var rimraf=require(_0xf7b1('0x6'));var config=require(_0xf7b1('0x7'));var attributes=require(_0xf7b1('0x8'));module[_0xf7b1('0x9')]=function(_0x117c8c,_0x41ff7f){return _0x117c8c[_0xf7b1('0xa')](_0xf7b1('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xf7b1('0xc'),'fields':[_0xf7b1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf1f9=['moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api'];(function(_0x209d55,_0x2eee4f){var _0x18e6e5=function(_0x3369cb){while(--_0x3369cb){_0x209d55['push'](_0x209d55['shift']());}};_0x18e6e5(++_0x2eee4f);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0xe6364b,_0x5d3422){_0xe6364b=_0xe6364b-0x0;var _0x24d1b8=_0xf1f9[_0xe6364b];return _0x24d1b8;};'use strict';var _=require(_0x9f1f('0x0'));var util=require(_0x9f1f('0x1'));var logger=require(_0x9f1f('0x2'))(_0x9f1f('0x3'));var moment=require(_0x9f1f('0x4'));var BPromise=require('bluebird');var rp=require(_0x9f1f('0x5'));var fs=require('fs');var path=require(_0x9f1f('0x6'));var rimraf=require(_0x9f1f('0x7'));var config=require(_0x9f1f('0x8'));var attributes=require(_0x9f1f('0x9'));module[_0x9f1f('0xa')]=function(_0x5e4f05,_0x5e4150){return _0x5e4f05[_0x9f1f('0xb')](_0x9f1f('0xc'),attributes,{'tableName':_0x9f1f('0xd'),'paranoid':![],'indexes':[{'name':_0x9f1f('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index bf201d0..3b9bd3f 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 _0x8f4c=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0x4e4f88,_0x2be77c){var _0x51ec61=function(_0x5f4076){while(--_0x5f4076){_0x4e4f88['push'](_0x4e4f88['shift']());}};_0x51ec61(++_0x2be77c);}(_0x8f4c,0x113));var _0xc8f4=function(_0x100f05,_0x2de0fa){_0x100f05=_0x100f05-0x0;var _0x2bcde1=_0x8f4c[_0x100f05];return _0x2bcde1;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108076[_0xc8f4('0x1b')]?_0x108076['options'][_0xc8f4('0x1d')]||null:null,'attributes':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1e')]||null:null,'limit':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x5e62aa){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON['stringify'](_0x5e62aa));_0x4763c1(_0x5e62aa);})[_0xc8f4('0x16')](function(_0x4a44e0){logger[_0xc8f4('0x11')]('UpdateVoiceRecording',_0x4a44e0[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0x4a44e0['message']));});});};exports[_0xc8f4('0x20')]=function(_0x21062f){var _0x11f766=this;return new Promise(function(_0x2fa052,_0x4ce586){var _0x3db490=require(_0xc8f4('0x21'));var _0x5db666;return db[_0xc8f4('0x22')][_0xc8f4('0x23')]({'attributes':['id',_0xc8f4('0x24')],'where':{'id':0x1},'raw':!![]})[_0xc8f4('0xb')](function(_0x24bef0){_0x5db666=_0x24bef0;return db[_0xc8f4('0x18')]['create'](_0x21062f[_0xc8f4('0x1a')]);})[_0xc8f4('0xb')](function(_0x1ea3d9){if(_0x5db666['callRecordingEncryption']&&fs[_0xc8f4('0x25')](_0x1ea3d9[_0xc8f4('0x26')])){var _0x5ab6cb=util['format']('%s.cypher',_0x1ea3d9[_0xc8f4('0x26')]);return _0x3db490[_0xc8f4('0x27')](_0x1ea3d9[_0xc8f4('0x26')],_0x5ab6cb,config[_0xc8f4('0x28')][_0xc8f4('0x29')])[_0xc8f4('0xb')](function(){fs[_0xc8f4('0x2a')](_0x1ea3d9[_0xc8f4('0x26')]);logger['info'](_0xc8f4('0x2b'));return _0x1ea3d9;});}return _0x1ea3d9;})[_0xc8f4('0xb')](function(_0x3910f3){logger['info'](_0xc8f4('0x20'),_0x21062f);logger[_0xc8f4('0xe')]('CreateVoiceRecording',_0x21062f,JSON[_0xc8f4('0x10')](_0x3910f3));_0x2fa052(_0x3910f3);})[_0xc8f4('0x16')](function(_0x36f24f){logger['error'](_0xc8f4('0x20'),_0x36f24f[_0xc8f4('0x13')],_0x21062f);_0x4ce586(_0x11f766[_0xc8f4('0x11')](0x1f4,_0x36f24f['message']));});});}; \ No newline at end of file +var _0xc2c7=['../../config/logger','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','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','attributes','limit','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','format','%s.cypher','value','encryptFile','secrets','unlink','info','CreateVoiceRecording\x20file\x20encrypted','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xc2c7,0x134));var _0x7c2c=function(_0x47b5ad,_0x53e4c9){_0x47b5ad=_0x47b5ad-0x0;var _0x44f8cb=_0xc2c7[_0x47b5ad];return _0x44f8cb;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});}exports[_0x7c2c('0x15')]=function(_0x14453f){var _0x2a9539=this;return new Promise(function(_0x17df4a,_0x26be0f){return db[_0x7c2c('0x16')][_0x7c2c('0x17')](_0x14453f[_0x7c2c('0x18')],{'raw':_0x14453f[_0x7c2c('0x19')]?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14453f['options']?_0x14453f[_0x7c2c('0x19')]['where']||null:null,'attributes':_0x14453f['options']?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1b')]||null:null,'limit':_0x14453f[_0x7c2c('0x19')]?_0x14453f[_0x7c2c('0x19')][_0x7c2c('0x1c')]||null:null})[_0x7c2c('0xc')](function(_0xa84620){logger['info'](_0x7c2c('0x15'),_0x14453f);logger['debug'](_0x7c2c('0x15'),_0x14453f,JSON['stringify'](_0xa84620));_0x17df4a(_0xa84620);})[_0x7c2c('0x1d')](function(_0x274c3b){logger[_0x7c2c('0x12')]('UpdateVoiceRecording',_0x274c3b['message'],_0x14453f);_0x26be0f(_0x2a9539[_0x7c2c('0x12')](0x1f4,_0x274c3b[_0x7c2c('0x14')]));});});};exports[_0x7c2c('0x1e')]=function(_0x150690){var _0x31d8f3=this;return new Promise(function(_0xa8e145,_0x3f4618){var _0x4b1dd0=require(_0x7c2c('0x1f'));var _0xf39941;return db[_0x7c2c('0x20')][_0x7c2c('0x21')]({'attributes':['id',_0x7c2c('0x22')],'where':{'id':0x1},'raw':!![]})[_0x7c2c('0xc')](function(_0xf2bfd1){_0xf39941=_0xf2bfd1;return db[_0x7c2c('0x16')][_0x7c2c('0x23')](_0x150690['body']);})[_0x7c2c('0xc')](function(_0x3a3730){if(_0xf39941[_0x7c2c('0x22')]&&fs[_0x7c2c('0x24')](_0x3a3730['value'])){var _0xcb98ba=util[_0x7c2c('0x25')](_0x7c2c('0x26'),_0x3a3730[_0x7c2c('0x27')]);return _0x4b1dd0[_0x7c2c('0x28')](_0x3a3730[_0x7c2c('0x27')],_0xcb98ba,config[_0x7c2c('0x29')]['recording'])[_0x7c2c('0xc')](function(){fs[_0x7c2c('0x2a')](_0x3a3730[_0x7c2c('0x27')]);logger[_0x7c2c('0x2b')](_0x7c2c('0x2c'));return _0x3a3730;});}return _0x3a3730;})['then'](function(_0x47ef3c){logger[_0x7c2c('0x2b')]('CreateVoiceRecording',_0x150690);logger['debug'](_0x7c2c('0x1e'),_0x150690,JSON[_0x7c2c('0x11')](_0x47ef3c));_0xa8e145(_0x47ef3c);})[_0x7c2c('0x1d')](function(_0x156c03){logger['error'](_0x7c2c('0x1e'),_0x156c03[_0x7c2c('0x14')],_0x150690);_0x3f4618(_0x31d8f3[_0x7c2c('0x12')](0x1f4,_0x156c03[_0x7c2c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8683102..7e0fa91 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 _0x8ec6=['../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','Router','fs-extra'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x8ec6,0x1b8));var _0x68ec=function(_0x4d8362,_0x3aaad4){_0x4d8362=_0x4d8362-0x0;var _0x6926fc=_0x8ec6[_0x4d8362];return _0x6926fc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x68ec('0x0')]();var fs_extra=require(_0x68ec('0x1'));var auth=require(_0x68ec('0x2'));var interaction=require(_0x68ec('0x3'));var config=require('../../config/environment');var controller=require(_0x68ec('0x4'));router[_0x68ec('0x5')]('/',auth[_0x68ec('0x6')](),controller[_0x68ec('0x7')]);router['get'](_0x68ec('0x8'),auth[_0x68ec('0x6')](),controller[_0x68ec('0x9')]);router[_0x68ec('0x5')](_0x68ec('0xa'),auth[_0x68ec('0x6')](),controller[_0x68ec('0xb')]);router[_0x68ec('0xc')]('/',auth[_0x68ec('0x6')](),controller[_0x68ec('0xd')]);router[_0x68ec('0xe')](_0x68ec('0xa'),auth[_0x68ec('0x6')](),controller['update']);router[_0x68ec('0xf')](_0x68ec('0xa'),auth['isAuthenticated'](),controller[_0x68ec('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7776=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4c1bdd,_0x10ba34){var _0x194759=function(_0x23138a){while(--_0x23138a){_0x4c1bdd['push'](_0x4c1bdd['shift']());}};_0x194759(++_0x10ba34);}(_0x7776,0x134));var _0x6777=function(_0x367f11,_0x4fd63c){_0x367f11=_0x367f11-0x0;var _0xd72760=_0x7776[_0x367f11];return _0xd72760;};'use strict';var multer=require(_0x6777('0x0'));var util=require(_0x6777('0x1'));var path=require(_0x6777('0x2'));var timeout=require(_0x6777('0x3'));var express=require(_0x6777('0x4'));var router=express[_0x6777('0x5')]();var fs_extra=require(_0x6777('0x6'));var auth=require(_0x6777('0x7'));var interaction=require(_0x6777('0x8'));var config=require(_0x6777('0x9'));var controller=require(_0x6777('0xa'));router[_0x6777('0xb')]('/',auth[_0x6777('0xc')](),controller['index']);router['get'](_0x6777('0xd'),auth[_0x6777('0xc')](),controller[_0x6777('0xe')]);router[_0x6777('0xb')](_0x6777('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6777('0xc')](),controller[_0x6777('0x10')]);router[_0x6777('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6777('0x12')]);router[_0x6777('0x13')](_0x6777('0xf'),auth[_0x6777('0xc')](),controller['destroy']);module[_0x6777('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b72e6c9..0343638 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 _0x259b=['exports','ENUM','STRING','Yes','sequelize','moment'];(function(_0x28ec1b,_0x5412ea){var _0x1ae01c=function(_0x2697c5){while(--_0x2697c5){_0x28ec1b['push'](_0x28ec1b['shift']());}};_0x1ae01c(++_0x5412ea);}(_0x259b,0x1e4));var _0xb259=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x259b[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0xb259('0x0'));var moment=require(_0xb259('0x1'));module[_0xb259('0x2')]={'type':{'type':Sequelize[_0xb259('0x3')]('blind','attended')},'result':{'type':Sequelize[_0xb259('0x4')]},'transfererchannel':{'type':Sequelize[_0xb259('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xb259('0x4')]},'transferercalleridname':{'type':Sequelize[_0xb259('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb259('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xb259('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xb259('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb259('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xb259('0x4')]},'transfereechannel':{'type':Sequelize[_0xb259('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xb259('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xb259('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb259('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xb259('0x4')]},'transfereecontext':{'type':Sequelize[_0xb259('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xb259('0x4')]},'isexternal':{'type':Sequelize[_0xb259('0x3')](_0xb259('0x5'),'No')},'context':{'type':Sequelize[_0xb259('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbd1=['exports','ENUM','blind','STRING','Yes','moment'];(function(_0x3ffbfc,_0x33b706){var _0x37e5bd=function(_0x5dd06a){while(--_0x5dd06a){_0x3ffbfc['push'](_0x3ffbfc['shift']());}};_0x37e5bd(++_0x33b706);}(_0xdbd1,0xdd));var _0x1dbd=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0xdbd1[_0x173f10];return _0x53142d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1dbd('0x0'));module[_0x1dbd('0x1')]={'type':{'type':Sequelize[_0x1dbd('0x2')](_0x1dbd('0x3'),'attended')},'result':{'type':Sequelize[_0x1dbd('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x1dbd('0x4')]},'transferercalleridname':{'type':Sequelize[_0x1dbd('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1dbd('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x1dbd('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x1dbd('0x4')]},'transferercontext':{'type':Sequelize[_0x1dbd('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x1dbd('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x1dbd('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1dbd('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1dbd('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x1dbd('0x4')]},'transfereecontext':{'type':Sequelize[_0x1dbd('0x4')]},'transfereeexten':{'type':Sequelize[_0x1dbd('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x1dbd('0x4')]},'isexternal':{'type':Sequelize[_0x1dbd('0x2')](_0x1dbd('0x5'),'No')},'context':{'type':Sequelize[_0x1dbd('0x4')]},'extension':{'type':Sequelize[_0x1dbd('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index cbc2e0b..9eea09e 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 _0xcec6=['destroy','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','then','include','rows','show','params','keys','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update'];(function(_0x1c99c6,_0x1479e7){var _0x34ae7d=function(_0x5f33fa){while(--_0x5f33fa){_0x1c99c6['push'](_0x1c99c6['shift']());}};_0x34ae7d(++_0x1479e7);}(_0xcec6,0xff));var _0x6cec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcec6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6cec('0x0'));var rimraf=require(_0x6cec('0x1'));var zipdir=require(_0x6cec('0x2'));var jsonpatch=require(_0x6cec('0x3'));var rp=require(_0x6cec('0x4'));var moment=require(_0x6cec('0x5'));var BPromise=require(_0x6cec('0x6'));var Mustache=require('mustache');var util=require(_0x6cec('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6cec('0x8'));var fs=require('fs');var fs_extra=require(_0x6cec('0x9'));var _=require('lodash');var squel=require(_0x6cec('0xa'));var crypto=require('crypto');var jsforce=require(_0x6cec('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6cec('0xc'));var Papa=require(_0x6cec('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6cec('0xe'));var hardwareService=require(_0x6cec('0xf'));var logger=require('../../config/logger')(_0x6cec('0x10'));var utils=require(_0x6cec('0x11'));var config=require(_0x6cec('0x12'));var licenseUtil=require(_0x6cec('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363cac,_0x47c8ce){_0x47c8ce=_0x47c8ce||0xcc;return function(_0xf24da){if(_0xf24da){return _0x363cac[_0x6cec('0x14')](_0x47c8ce);}return _0x363cac[_0x6cec('0x15')](_0x47c8ce)[_0x6cec('0x16')]();};}function respondWithResult(_0x41ee55,_0xfeca3c){_0xfeca3c=_0xfeca3c||0xc8;return function(_0x4442eb){if(_0x4442eb){return _0x41ee55['status'](_0xfeca3c)[_0x6cec('0x17')](_0x4442eb);}};}function respondWithFilteredResult(_0x2cbb70,_0x19ccfe){return function(_0x479e91){if(_0x479e91){var _0x52fe52=typeof _0x19ccfe['offset']===_0x6cec('0x18')&&typeof _0x19ccfe[_0x6cec('0x19')]===_0x6cec('0x18');var _0x417080=_0x479e91[_0x6cec('0x1a')];var _0x209835=_0x52fe52?0x0:_0x19ccfe[_0x6cec('0x1b')];var _0x11793d=_0x52fe52?_0x479e91[_0x6cec('0x1a')]:_0x19ccfe[_0x6cec('0x1b')]+_0x19ccfe[_0x6cec('0x19')];var _0x1c09c2;if(_0x11793d>=_0x417080){_0x11793d=_0x417080;_0x1c09c2=0xc8;}else{_0x1c09c2=0xce;}_0x2cbb70[_0x6cec('0x15')](_0x1c09c2);return _0x2cbb70['set'](_0x6cec('0x1c'),_0x209835+'-'+_0x11793d+'/'+_0x417080)['json'](_0x479e91);}return null;};}function patchUpdates(_0x10ab1a){return function(_0x8d62ac){try{jsonpatch[_0x6cec('0x1d')](_0x8d62ac,_0x10ab1a,!![]);}catch(_0x4fb250){return BPromise[_0x6cec('0x1e')](_0x4fb250);}return _0x8d62ac[_0x6cec('0x1f')]();};}function saveUpdates(_0x3102f5,_0x300e5e){return function(_0x22170d){if(_0x22170d){return _0x22170d[_0x6cec('0x20')](_0x3102f5)['then'](function(_0x2ff6e8){return _0x2ff6e8;});}return null;};}function removeEntity(_0x5baec7,_0x361687){return function(_0x3dd1fc){if(_0x3dd1fc){return _0x3dd1fc[_0x6cec('0x21')]()['then'](function(){_0x5baec7['status'](0xcc)[_0x6cec('0x16')]();});}};}function handleEntityNotFound(_0x5035f9,_0x1c2b77){return function(_0x6a97bd){if(!_0x6a97bd){_0x5035f9[_0x6cec('0x14')](0x194);}return _0x6a97bd;};}function handleError(_0x3c8cf1,_0x5d3712){_0x5d3712=_0x5d3712||0x1f4;return function(_0x45efbf){logger['error'](_0x45efbf[_0x6cec('0x22')]);if(_0x45efbf[_0x6cec('0x23')]){delete _0x45efbf[_0x6cec('0x23')];}_0x3c8cf1['status'](_0x5d3712)['send'](_0x45efbf);};}exports[_0x6cec('0x24')]=function(_0x3b8145,_0x5537e1){var _0x236d09={},_0x1c09d5={},_0xb79d57={'count':0x0,'rows':[]};var _0x33a615=_[_0x6cec('0x25')](db[_0x6cec('0x26')][_0x6cec('0x27')],function(_0x231c0e){return{'name':_0x231c0e[_0x6cec('0x28')],'type':_0x231c0e[_0x6cec('0x29')][_0x6cec('0x2a')]};});_0x1c09d5['model']=_['map'](_0x33a615,'name');_0x1c09d5[_0x6cec('0x2b')]=_['keys'](_0x3b8145[_0x6cec('0x2b')]);_0x1c09d5['filters']=_[_0x6cec('0x2c')](_0x1c09d5[_0x6cec('0x2d')],_0x1c09d5[_0x6cec('0x2b')]);_0x236d09[_0x6cec('0x2e')]=_[_0x6cec('0x2c')](_0x1c09d5[_0x6cec('0x2d')],qs['fields'](_0x3b8145['query'][_0x6cec('0x2f')]));_0x236d09[_0x6cec('0x2e')]=_0x236d09[_0x6cec('0x2e')][_0x6cec('0x30')]?_0x236d09[_0x6cec('0x2e')]:_0x1c09d5['model'];if(!_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x31')](_0x6cec('0x32'))){_0x236d09[_0x6cec('0x19')]=qs[_0x6cec('0x19')](_0x3b8145['query'][_0x6cec('0x19')]);_0x236d09[_0x6cec('0x1b')]=qs[_0x6cec('0x1b')](_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x1b')]);}_0x236d09[_0x6cec('0x33')]=qs[_0x6cec('0x34')](_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x34')]);_0x236d09['where']=qs[_0x6cec('0x35')](_[_0x6cec('0x36')](_0x3b8145['query'],_0x1c09d5[_0x6cec('0x35')]),_0x33a615);if(_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x37')]){_0x236d09['where']=_[_0x6cec('0x38')](_0x236d09[_0x6cec('0x39')],{'$or':_['map'](_0x33a615,function(_0x1f8fd7){if(_0x1f8fd7[_0x6cec('0x29')]!==_0x6cec('0x3a')){var _0x1fe754={};_0x1fe754[_0x1f8fd7[_0x6cec('0x23')]]={'$like':'%'+_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x37')]+'%'};return _0x1fe754;}})});}_0x236d09=_[_0x6cec('0x38')]({},_0x236d09,_0x3b8145[_0x6cec('0x3b')]);var _0x1adcd3={'where':_0x236d09[_0x6cec('0x39')]};return db[_0x6cec('0x26')]['count'](_0x1adcd3)[_0x6cec('0x3c')](function(_0x51d7bb){_0xb79d57[_0x6cec('0x1a')]=_0x51d7bb;if(_0x3b8145[_0x6cec('0x2b')]['includeAll']){_0x236d09[_0x6cec('0x3d')]=[{'all':!![]}];}return db[_0x6cec('0x26')]['findAll'](_0x236d09);})[_0x6cec('0x3c')](function(_0x3cdf44){_0xb79d57[_0x6cec('0x3e')]=_0x3cdf44;return _0xb79d57;})[_0x6cec('0x3c')](respondWithFilteredResult(_0x5537e1,_0x236d09))['catch'](handleError(_0x5537e1,null));};exports[_0x6cec('0x3f')]=function(_0x5b1710,_0x49d0df){var _0x3b1a33={'raw':!![],'where':{'id':_0x5b1710[_0x6cec('0x40')]['id']}},_0x11f38b={};_0x11f38b[_0x6cec('0x2d')]=_[_0x6cec('0x41')](db[_0x6cec('0x26')][_0x6cec('0x27')]);_0x11f38b[_0x6cec('0x2b')]=_[_0x6cec('0x41')](_0x5b1710['query']);_0x11f38b[_0x6cec('0x35')]=_[_0x6cec('0x2c')](_0x11f38b[_0x6cec('0x2d')],_0x11f38b[_0x6cec('0x2b')]);_0x3b1a33[_0x6cec('0x2e')]=_[_0x6cec('0x2c')](_0x11f38b['model'],qs['fields'](_0x5b1710['query'][_0x6cec('0x2f')]));_0x3b1a33[_0x6cec('0x2e')]=_0x3b1a33[_0x6cec('0x2e')][_0x6cec('0x30')]?_0x3b1a33[_0x6cec('0x2e')]:_0x11f38b['model'];if(_0x5b1710['query'][_0x6cec('0x42')]){_0x3b1a33['include']=[{'all':!![]}];}_0x3b1a33=_['merge']({},_0x3b1a33,_0x5b1710[_0x6cec('0x3b')]);return db['VoiceTransferReport']['find'](_0x3b1a33)[_0x6cec('0x3c')](handleEntityNotFound(_0x49d0df,null))['then'](respondWithResult(_0x49d0df,null))[_0x6cec('0x43')](handleError(_0x49d0df,null));};exports[_0x6cec('0x44')]=function(_0x2a6e3b,_0x442103){return db[_0x6cec('0x26')]['create'](_0x2a6e3b[_0x6cec('0x45')],{})[_0x6cec('0x3c')](respondWithResult(_0x442103,0xc9))[_0x6cec('0x43')](handleError(_0x442103,null));};exports[_0x6cec('0x20')]=function(_0x105687,_0x2a57ee){if(_0x105687[_0x6cec('0x45')]['id']){delete _0x105687['body']['id'];}return db[_0x6cec('0x26')][_0x6cec('0x46')]({'where':{'id':_0x105687[_0x6cec('0x40')]['id']}})[_0x6cec('0x3c')](handleEntityNotFound(_0x2a57ee,null))[_0x6cec('0x3c')](saveUpdates(_0x105687[_0x6cec('0x45')],null))[_0x6cec('0x3c')](respondWithResult(_0x2a57ee,null))['catch'](handleError(_0x2a57ee,null));};exports[_0x6cec('0x21')]=function(_0x55a40f,_0x5550e5){return db[_0x6cec('0x26')][_0x6cec('0x46')]({'where':{'id':_0x55a40f[_0x6cec('0x40')]['id']}})[_0x6cec('0x3c')](handleEntityNotFound(_0x5550e5,null))['then'](removeEntity(_0x5550e5,null))['catch'](handleError(_0x5550e5,null));};exports[_0x6cec('0x47')]=function(_0x558d3f,_0x2ed872){return db[_0x6cec('0x26')]['describe']()[_0x6cec('0x3c')](respondWithResult(_0x2ed872,null))[_0x6cec('0x43')](handleError(_0x2ed872,null));}; \ No newline at end of file +var _0x85cb=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse'];(function(_0x2a32e3,_0xc4b219){var _0x5c3f34=function(_0x56b671){while(--_0x56b671){_0x2a32e3['push'](_0x2a32e3['shift']());}};_0x5c3f34(++_0xc4b219);}(_0x85cb,0x1dd));var _0xb85c=function(_0xc68e30,_0x3014eb){_0xc68e30=_0xc68e30-0x0;var _0x522017=_0x85cb[_0xc68e30];return _0x522017;};'use strict';var emlformat=require(_0xb85c('0x0'));var rimraf=require(_0xb85c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb85c('0x2'));var rp=require('request-promise');var moment=require(_0xb85c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb85c('0x4'));var util=require('util');var path=require(_0xb85c('0x5'));var sox=require(_0xb85c('0x6'));var csv=require(_0xb85c('0x7'));var ejs=require(_0xb85c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb85c('0x9'));var squel=require(_0xb85c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb85c('0xb'));var toCsv=require(_0xb85c('0x7'));var querystring=require('querystring');var Papa=require(_0xb85c('0xc'));var Redis=require(_0xb85c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb85c('0xe'));var as=require(_0xb85c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb85c('0x10'))(_0xb85c('0x11'));var utils=require(_0xb85c('0x12'));var config=require(_0xb85c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb85c('0x14'))['db'];function respondWithStatusCode(_0x123a80,_0xb2cdd2){_0xb2cdd2=_0xb2cdd2||0xcc;return function(_0x294c83){if(_0x294c83){return _0x123a80['sendStatus'](_0xb2cdd2);}return _0x123a80[_0xb85c('0x15')](_0xb2cdd2)[_0xb85c('0x16')]();};}function respondWithResult(_0x28d063,_0x51d541){_0x51d541=_0x51d541||0xc8;return function(_0x19f843){if(_0x19f843){return _0x28d063[_0xb85c('0x15')](_0x51d541)['json'](_0x19f843);}};}function respondWithFilteredResult(_0x1f104d,_0x535155){return function(_0xaed00d){if(_0xaed00d){var _0x1b0c29=typeof _0x535155[_0xb85c('0x17')]===_0xb85c('0x18')&&typeof _0x535155[_0xb85c('0x19')]===_0xb85c('0x18');var _0xbc3b9f=_0xaed00d[_0xb85c('0x1a')];var _0x5b1c81=_0x1b0c29?0x0:_0x535155['offset'];var _0x36d015=_0x1b0c29?_0xaed00d[_0xb85c('0x1a')]:_0x535155[_0xb85c('0x17')]+_0x535155[_0xb85c('0x19')];var _0xf35e7a;if(_0x36d015>=_0xbc3b9f){_0x36d015=_0xbc3b9f;_0xf35e7a=0xc8;}else{_0xf35e7a=0xce;}_0x1f104d[_0xb85c('0x15')](_0xf35e7a);return _0x1f104d[_0xb85c('0x1b')]('Content-Range',_0x5b1c81+'-'+_0x36d015+'/'+_0xbc3b9f)[_0xb85c('0x1c')](_0xaed00d);}return null;};}function patchUpdates(_0x10bbc7){return function(_0x3b383e){try{jsonpatch[_0xb85c('0x1d')](_0x3b383e,_0x10bbc7,!![]);}catch(_0x4fdaca){return BPromise[_0xb85c('0x1e')](_0x4fdaca);}return _0x3b383e[_0xb85c('0x1f')]();};}function saveUpdates(_0x1042f0,_0x212f6b){return function(_0x46a0bd){if(_0x46a0bd){return _0x46a0bd['update'](_0x1042f0)[_0xb85c('0x20')](function(_0x3e3dc3){return _0x3e3dc3;});}return null;};}function removeEntity(_0x271865,_0x23869a){return function(_0x24b798){if(_0x24b798){return _0x24b798['destroy']()['then'](function(){_0x271865[_0xb85c('0x15')](0xcc)[_0xb85c('0x16')]();});}};}function handleEntityNotFound(_0x40876a,_0x2f75c9){return function(_0x5ce6f5){if(!_0x5ce6f5){_0x40876a[_0xb85c('0x21')](0x194);}return _0x5ce6f5;};}function handleError(_0x420cdc,_0x10fa4c){_0x10fa4c=_0x10fa4c||0x1f4;return function(_0x138c6b){logger[_0xb85c('0x22')](_0x138c6b['stack']);if(_0x138c6b['name']){delete _0x138c6b[_0xb85c('0x23')];}_0x420cdc['status'](_0x10fa4c)[_0xb85c('0x24')](_0x138c6b);};}exports[_0xb85c('0x25')]=function(_0x305027,_0xd408eb){var _0x1a7dba={},_0x983a65={},_0x1c33de={'count':0x0,'rows':[]};var _0xeac705=_[_0xb85c('0x26')](db['VoiceTransferReport'][_0xb85c('0x27')],function(_0x2f747d){return{'name':_0x2f747d[_0xb85c('0x28')],'type':_0x2f747d[_0xb85c('0x29')]['key']};});_0x983a65[_0xb85c('0x2a')]=_['map'](_0xeac705,'name');_0x983a65['query']=_[_0xb85c('0x2b')](_0x305027[_0xb85c('0x2c')]);_0x983a65['filters']=_['intersection'](_0x983a65['model'],_0x983a65[_0xb85c('0x2c')]);_0x1a7dba['attributes']=_[_0xb85c('0x2d')](_0x983a65[_0xb85c('0x2a')],qs[_0xb85c('0x2e')](_0x305027[_0xb85c('0x2c')]['fields']));_0x1a7dba['attributes']=_0x1a7dba[_0xb85c('0x2f')][_0xb85c('0x30')]?_0x1a7dba[_0xb85c('0x2f')]:_0x983a65['model'];if(!_0x305027[_0xb85c('0x2c')][_0xb85c('0x31')]('nolimit')){_0x1a7dba['limit']=qs[_0xb85c('0x19')](_0x305027[_0xb85c('0x2c')][_0xb85c('0x19')]);_0x1a7dba[_0xb85c('0x17')]=qs[_0xb85c('0x17')](_0x305027['query']['offset']);}_0x1a7dba[_0xb85c('0x32')]=qs[_0xb85c('0x33')](_0x305027['query']['sort']);_0x1a7dba[_0xb85c('0x34')]=qs[_0xb85c('0x35')](_[_0xb85c('0x36')](_0x305027[_0xb85c('0x2c')],_0x983a65['filters']),_0xeac705);if(_0x305027['query']['filter']){_0x1a7dba['where']=_[_0xb85c('0x37')](_0x1a7dba[_0xb85c('0x34')],{'$or':_[_0xb85c('0x26')](_0xeac705,function(_0x3f12a0){if(_0x3f12a0[_0xb85c('0x29')]!==_0xb85c('0x38')){var _0x4ac3bc={};_0x4ac3bc[_0x3f12a0[_0xb85c('0x23')]]={'$like':'%'+_0x305027[_0xb85c('0x2c')][_0xb85c('0x39')]+'%'};return _0x4ac3bc;}})});}_0x1a7dba=_['merge']({},_0x1a7dba,_0x305027['options']);var _0x4a7e4c={'where':_0x1a7dba[_0xb85c('0x34')]};return db[_0xb85c('0x3a')][_0xb85c('0x1a')](_0x4a7e4c)[_0xb85c('0x20')](function(_0x829771){_0x1c33de['count']=_0x829771;if(_0x305027[_0xb85c('0x2c')][_0xb85c('0x3b')]){_0x1a7dba[_0xb85c('0x3c')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xb85c('0x3d')](_0x1a7dba);})['then'](function(_0x3c9598){_0x1c33de[_0xb85c('0x3e')]=_0x3c9598;return _0x1c33de;})['then'](respondWithFilteredResult(_0xd408eb,_0x1a7dba))[_0xb85c('0x3f')](handleError(_0xd408eb,null));};exports[_0xb85c('0x40')]=function(_0x2be0d6,_0x4f5dc4){var _0x3cc494={'raw':!![],'where':{'id':_0x2be0d6['params']['id']}},_0x22a5e6={};_0x22a5e6[_0xb85c('0x2a')]=_['keys'](db[_0xb85c('0x3a')][_0xb85c('0x27')]);_0x22a5e6[_0xb85c('0x2c')]=_[_0xb85c('0x2b')](_0x2be0d6['query']);_0x22a5e6[_0xb85c('0x35')]=_[_0xb85c('0x2d')](_0x22a5e6[_0xb85c('0x2a')],_0x22a5e6['query']);_0x3cc494['attributes']=_[_0xb85c('0x2d')](_0x22a5e6['model'],qs[_0xb85c('0x2e')](_0x2be0d6[_0xb85c('0x2c')][_0xb85c('0x2e')]));_0x3cc494['attributes']=_0x3cc494[_0xb85c('0x2f')][_0xb85c('0x30')]?_0x3cc494[_0xb85c('0x2f')]:_0x22a5e6['model'];if(_0x2be0d6[_0xb85c('0x2c')][_0xb85c('0x3b')]){_0x3cc494[_0xb85c('0x3c')]=[{'all':!![]}];}_0x3cc494=_[_0xb85c('0x37')]({},_0x3cc494,_0x2be0d6['options']);return db['VoiceTransferReport'][_0xb85c('0x41')](_0x3cc494)[_0xb85c('0x20')](handleEntityNotFound(_0x4f5dc4,null))[_0xb85c('0x20')](respondWithResult(_0x4f5dc4,null))[_0xb85c('0x3f')](handleError(_0x4f5dc4,null));};exports[_0xb85c('0x42')]=function(_0xb282ea,_0x4a46f9){return db[_0xb85c('0x3a')][_0xb85c('0x42')](_0xb282ea[_0xb85c('0x43')],{})[_0xb85c('0x20')](respondWithResult(_0x4a46f9,0xc9))['catch'](handleError(_0x4a46f9,null));};exports['update']=function(_0x4b29eb,_0x527b46){if(_0x4b29eb['body']['id']){delete _0x4b29eb[_0xb85c('0x43')]['id'];}return db[_0xb85c('0x3a')][_0xb85c('0x41')]({'where':{'id':_0x4b29eb[_0xb85c('0x44')]['id']}})[_0xb85c('0x20')](handleEntityNotFound(_0x527b46,null))[_0xb85c('0x20')](saveUpdates(_0x4b29eb[_0xb85c('0x43')],null))[_0xb85c('0x20')](respondWithResult(_0x527b46,null))[_0xb85c('0x3f')](handleError(_0x527b46,null));};exports[_0xb85c('0x45')]=function(_0x19cee3,_0x35d047){return db['VoiceTransferReport'][_0xb85c('0x41')]({'where':{'id':_0x19cee3[_0xb85c('0x44')]['id']}})['then'](handleEntityNotFound(_0x35d047,null))['then'](removeEntity(_0x35d047,null))[_0xb85c('0x3f')](handleError(_0x35d047,null));};exports['describe']=function(_0x408497,_0x14b7dc){return db[_0xb85c('0x3a')]['describe']()[_0xb85c('0x20')](respondWithResult(_0x14b7dc,null))[_0xb85c('0x3f')](handleError(_0x14b7dc,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 50c25cf..0125d54 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 _0x4d97=['bluebird','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x1a58dc,_0x4d3bf4){var _0x23ea3b=function(_0x4e6087){while(--_0x4e6087){_0x1a58dc['push'](_0x1a58dc['shift']());}};_0x23ea3b(++_0x4d3bf4);}(_0x4d97,0x15c));var _0x74d9=function(_0x4f15b7,_0x2bd8bd){_0x4f15b7=_0x4f15b7-0x0;var _0x361c49=_0x4d97[_0x4f15b7];return _0x361c49;};'use strict';var _=require(_0x74d9('0x0'));var util=require(_0x74d9('0x1'));var logger=require(_0x74d9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x74d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x74d9('0x4'));var attributes=require('./voiceTransferReport.attributes');module[_0x74d9('0x5')]=function(_0x3dada2,_0x21564b){return _0x3dada2[_0x74d9('0x6')](_0x74d9('0x7'),attributes,{'tableName':_0x74d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0729=['report_call_transfer','util','api','moment','bluebird','request-promise','path','exports','define','VoiceTransferReport'];(function(_0x5a2416,_0x5c1413){var _0xb167ba=function(_0x365b90){while(--_0x365b90){_0x5a2416['push'](_0x5a2416['shift']());}};_0xb167ba(++_0x5c1413);}(_0x0729,0x1e1));var _0x9072=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x0729[_0x286726];return _0xcd4fe9;};'use strict';var _=require('lodash');var util=require(_0x9072('0x0'));var logger=require('../../config/logger')(_0x9072('0x1'));var moment=require(_0x9072('0x2'));var BPromise=require(_0x9072('0x3'));var rp=require(_0x9072('0x4'));var fs=require('fs');var path=require(_0x9072('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x9072('0x6')]=function(_0x2c33e6,_0x37d82b){return _0x2c33e6[_0x9072('0x7')](_0x9072('0x8'),attributes,{'tableName':_0x9072('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index e648b5c..1dba1f1 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 _0xd200=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5efe7c,_0x31bfce){var _0x38bdde=function(_0x483e5f){while(--_0x483e5f){_0x5efe7c['push'](_0x5efe7c['shift']());}};_0x38bdde(++_0x31bfce);}(_0xd200,0x165));var _0x0d20=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xd200[_0x599e60];return _0x468e19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d20('0x0'));var BPromise=require(_0x0d20('0x1'));var rs=require(_0x0d20('0x2'));var fs=require('fs');var Redis=require(_0x0d20('0x3'));var db=require(_0x0d20('0x4'))['db'];var utils=require(_0x0d20('0x5'));var logger=require(_0x0d20('0x6'))(_0x0d20('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d20('0x8'));var client=jayson[_0x0d20('0x9')][_0x0d20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x588257,_0x1eb8df,_0x9d7e78){return new BPromise(function(_0x40cd31,_0x47ec50){return client[_0x0d20('0xb')](_0x588257,_0x9d7e78)['then'](function(_0x5da547){logger[_0x0d20('0xc')](_0x0d20('0xd'),_0x1eb8df,_0x0d20('0xe'));logger[_0x0d20('0xf')](_0x0d20('0x10'),_0x1eb8df,_0x0d20('0xe'),JSON[_0x0d20('0x11')](_0x5da547));if(_0x5da547[_0x0d20('0x12')]){if(_0x5da547[_0x0d20('0x12')]['code']===0x1f4){logger[_0x0d20('0x12')](_0x0d20('0xd'),_0x1eb8df,_0x5da547[_0x0d20('0x12')][_0x0d20('0x13')]);return _0x47ec50(_0x5da547[_0x0d20('0x12')][_0x0d20('0x13')]);}logger['error'](_0x0d20('0xd'),_0x1eb8df,_0x5da547[_0x0d20('0x12')]['message']);return _0x40cd31(_0x5da547[_0x0d20('0x12')]['message']);}else{logger['info'](_0x0d20('0xd'),_0x1eb8df,'request\x20sent');_0x40cd31(_0x5da547[_0x0d20('0x14')]['message']);}})[_0x0d20('0x15')](function(_0x11c971){logger['error'](_0x0d20('0xd'),_0x1eb8df,_0x11c971);_0x47ec50(_0x11c971);});});}exports[_0x0d20('0x16')]=function(_0xc6dee7){var _0x22b594=this;return new Promise(function(_0x3508c1,_0x57ff26){return db[_0x0d20('0x17')][_0x0d20('0x18')](_0xc6dee7[_0x0d20('0x19')],{'raw':_0xc6dee7[_0x0d20('0x1a')]?_0xc6dee7[_0x0d20('0x1a')][_0x0d20('0x1b')]===undefined?!![]:![]:!![]})[_0x0d20('0x1c')](function(_0x24b912){logger[_0x0d20('0xc')]('CreateVoiceTransferReport',_0xc6dee7);logger[_0x0d20('0xf')](_0x0d20('0x16'),_0xc6dee7,JSON[_0x0d20('0x11')](_0x24b912));_0x3508c1(_0x24b912);})[_0x0d20('0x15')](function(_0x5169cc){logger[_0x0d20('0x12')](_0x0d20('0x16'),_0x5169cc['message'],_0xc6dee7);_0x57ff26(_0x22b594['error'](0x1f4,_0x5169cc['message']));});});}; \ No newline at end of file +var _0x93ca=['message','result','create','body','options','raw','then','info','CreateVoiceTransferReport','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','request\x20sent','debug','stringify','error','VoiceTransferReport,\x20%s,\x20%s'];(function(_0xe47f47,_0x1bee36){var _0x2e6cec=function(_0x4e0f53){while(--_0x4e0f53){_0xe47f47['push'](_0xe47f47['shift']());}};_0x2e6cec(++_0x1bee36);}(_0x93ca,0x1aa));var _0xa93c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ca[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa93c('0x0'));var util=require(_0xa93c('0x1'));var moment=require(_0xa93c('0x2'));var BPromise=require(_0xa93c('0x3'));var rs=require(_0xa93c('0x4'));var fs=require('fs');var Redis=require(_0xa93c('0x5'));var db=require(_0xa93c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa93c('0x7'))(_0xa93c('0x8'));var config=require(_0xa93c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50a15d,_0x554f88,_0x310860){return new BPromise(function(_0x43ab66,_0x7a3124){return client[_0xa93c('0xa')](_0x50a15d,_0x310860)['then'](function(_0x32f436){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x554f88,_0xa93c('0xb'));logger[_0xa93c('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x554f88,_0xa93c('0xb'),JSON[_0xa93c('0xd')](_0x32f436));if(_0x32f436[_0xa93c('0xe')]){if(_0x32f436[_0xa93c('0xe')]['code']===0x1f4){logger[_0xa93c('0xe')](_0xa93c('0xf'),_0x554f88,_0x32f436[_0xa93c('0xe')][_0xa93c('0x10')]);return _0x7a3124(_0x32f436[_0xa93c('0xe')][_0xa93c('0x10')]);}logger[_0xa93c('0xe')](_0xa93c('0xf'),_0x554f88,_0x32f436[_0xa93c('0xe')][_0xa93c('0x10')]);return _0x43ab66(_0x32f436[_0xa93c('0xe')][_0xa93c('0x10')]);}else{logger['info'](_0xa93c('0xf'),_0x554f88,_0xa93c('0xb'));_0x43ab66(_0x32f436[_0xa93c('0x11')][_0xa93c('0x10')]);}})['catch'](function(_0x154d75){logger[_0xa93c('0xe')](_0xa93c('0xf'),_0x554f88,_0x154d75);_0x7a3124(_0x154d75);});});}exports['CreateVoiceTransferReport']=function(_0x3001b){var _0x1bd5d4=this;return new Promise(function(_0x281b5c,_0x2d7897){return db['VoiceTransferReport'][_0xa93c('0x12')](_0x3001b[_0xa93c('0x13')],{'raw':_0x3001b[_0xa93c('0x14')]?_0x3001b[_0xa93c('0x14')][_0xa93c('0x15')]===undefined?!![]:![]:!![]})[_0xa93c('0x16')](function(_0x1a3baa){logger[_0xa93c('0x17')](_0xa93c('0x18'),_0x3001b);logger[_0xa93c('0xc')](_0xa93c('0x18'),_0x3001b,JSON['stringify'](_0x1a3baa));_0x281b5c(_0x1a3baa);})[_0xa93c('0x19')](function(_0x4b1867){logger[_0xa93c('0xe')]('CreateVoiceTransferReport',_0x4b1867[_0xa93c('0x10')],_0x3001b);_0x2d7897(_0x1bd5d4[_0xa93c('0xe')](0x1f4,_0x4b1867['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 8556c1c..9fac851 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 _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0xcb91[_0x307bf6];return _0x2878fc;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0xcb91[_0x35d775];return _0x59384d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 935013a..1aaeabc 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 _0xca66=['sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','agent','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','validate','then','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','userId','sessionId','answer\x20executed!','hold','webbar:hold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','transfer\x20executed!','path','../../config/environment','util','bluebird','client','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x383fac,_0xeda6b6){var _0x38d3b6=function(_0x481966){while(--_0x481966){_0x383fac['push'](_0x383fac['shift']());}};_0x38d3b6(++_0xeda6b6);}(_0xca66,0x8b));var _0x6ca6=function(_0x37364b,_0x45fc56){_0x37364b=_0x37364b-0x0;var _0x262ce7=_0xca66[_0x37364b];return _0x262ce7;};'use strict';var path=require(_0x6ca6('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x6ca6('0x1'));var util=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6ca6('0x4')]['http']({'port':0x232a});var logger=require(_0x6ca6('0x5'))('webbarapi');var Redis=require(_0x6ca6('0x6'));config[_0x6ca6('0x7')]=_[_0x6ca6('0x8')](config[_0x6ca6('0x7')],{'host':_0x6ca6('0x9'),'port':0x18eb});var io=require(_0x6ca6('0xa'))(new Redis(config[_0x6ca6('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'callNumber':{'type':_0x6ca6('0xd'),'required':[!![],_0x6ca6('0xe')]},'callerId':{'type':_0x6ca6('0xd')},'callbackUrl':{'type':_0x6ca6('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':'string','required':[!![],_0x6ca6('0xf')]},'transferNumber':{'type':_0x6ca6('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6ca6('0xc')]}});function emit(_0x19e94f,_0x260b56,_0x3f03e6){logger[_0x6ca6('0x10')](_0x19e94f,_0x260b56,JSON[_0x6ca6('0x11')](_0x3f03e6));io['to'](_0x19e94f)[_0x6ca6('0x12')](_0x260b56,_0x3f03e6);}function handleError(_0x4f056d){return function(_0x2391ce){console[_0x6ca6('0x13')](_0x6ca6('0x14'),_0x2391ce,_0x2391ce instanceof RangeError);logger[_0x6ca6('0x15')](_0x2391ce[_0x6ca6('0x16')]);if(_0x2391ce instanceof RangeError){if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d[_0x6ca6('0x18')](0x194)[_0x6ca6('0x19')](_0x2391ce);}else{if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d['status'](0x1f4)[_0x6ca6('0x19')](_0x2391ce);}};}function checkError(){return function(_0x254afe){if(!_0x254afe){throw new RangeError(_0x6ca6('0x1a'));}return _0x254afe;};}function respondWithRpcPromise(_0x195c92,_0x3a24aa){return new BPromise(function(_0x438694,_0x593f15){var _0xfb962d=amiClient;return _0xfb962d[_0x6ca6('0x1b')](_0x195c92,_0x3a24aa)['then'](function(_0x4927c1){if(_0x4927c1[_0x6ca6('0x15')]){if(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1c')]===0x1f4){return _0x593f15(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1d')]);}return _0x438694(_0x4927c1['error'][_0x6ca6('0x1d')]);}else{_0x438694(_0x4927c1[_0x6ca6('0x1e')]);}})[_0x6ca6('0x1f')](function(_0x2d8c64){_0x593f15(_0x2d8c64);});});}function getAgent(_0x3971a2){return db[_0x6ca6('0x20')][_0x6ca6('0x21')]({'where':{'id':_0x3971a2,'role':_0x6ca6('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x55b07f,_0x144ec5){return new BPromise(function(_0x9467bd,_0xf1d821){var _0x141c0f=respondWithRpcPromise('VoiceChannels');var _0x5ea6f7=getAgent(_0x55b07f);Promise[_0x6ca6('0x23')]([_0x141c0f,_0x5ea6f7])['then'](function(_0x4ab84c){var _0x141e78=_0x4ab84c[0x0];var _0xefd407=_0x4ab84c[0x1];var _0x4a15cb=_[_0x6ca6('0x24')](_0x141e78[_0x6ca6('0x25')],function(_0xac50e8){return _0xac50e8[_0x6ca6('0x26')]==_0xefd407['id']&&_0xac50e8['sessionId']==_0x144ec5;});if(_0x4a15cb[_0x6ca6('0x27')]==0x1){_0x9467bd(_0xefd407);}else{_0xf1d821(new RangeError(_0x6ca6('0x28')+_0x144ec5+_0x6ca6('0x29')));}});});}exports[_0x6ca6('0x2a')]=function(_0x480264,_0x467a89){logger[_0x6ca6('0x10')](_0x6ca6('0x2b'),_0x480264[_0x6ca6('0x2c')]);var _0x5788a2=originateValidation['validate'](_0x480264['body']);if(_0x5788a2['length']>0x0){return _0x467a89['status'](0x190)[_0x6ca6('0x2d')](_0x5788a2);}var _0x3389c2=_0x480264[_0x6ca6('0x2c')]['userId'];var _0x206ecd=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x2e')];var _0x388e32=_0x480264['body'][_0x6ca6('0x2f')];var _0x40de00=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x30')];return getAgent(_0x3389c2)['then'](function(_0x1e28b4){logger['info'](_0x6ca6('0x31'),_0x1e28b4['name']);emit(util['format'](_0x6ca6('0x32'),_0x1e28b4[_0x6ca6('0x17')]),_0x6ca6('0x33'),{'callNumber':_0x206ecd,'callerId':_0x388e32,'callbackUrl':_0x40de00});return _0x467a89[_0x6ca6('0x18')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x467a89));};exports[_0x6ca6('0x34')]=function(_0x49c8a4,_0x43c2cb){logger['info'](_0x6ca6('0x35'),_0x49c8a4['body']);var _0x1ada8b=hangupValidation[_0x6ca6('0x36')](_0x49c8a4[_0x6ca6('0x2c')]);if(_0x1ada8b[_0x6ca6('0x27')]>0x0){return _0x43c2cb[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x1ada8b);}var _0x45e77b=_0x49c8a4[_0x6ca6('0x2c')]['userId'];var _0x2f6daf=_0x49c8a4['body']['sessionId'];return getAgent(_0x45e77b)[_0x6ca6('0x37')](function(_0x306eda){logger['info'](_0x6ca6('0x31'),_0x306eda['name']);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x306eda[_0x6ca6('0x17')]),_0x6ca6('0x39'),{'sessionId':_0x2f6daf});return _0x43c2cb['status'](0xc8)['json']({'error':![],'message':_0x6ca6('0x3a')});})[_0x6ca6('0x1f')](handleError(_0x43c2cb));};exports[_0x6ca6('0x3b')]=function(_0x3423e2,_0x4e6d4){logger['info'](_0x6ca6('0x3c'),_0x3423e2[_0x6ca6('0x2c')]);var _0x5bed6e=answerValidation[_0x6ca6('0x36')](_0x3423e2[_0x6ca6('0x2c')]);if(_0x5bed6e[_0x6ca6('0x27')]>0x0){return _0x4e6d4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x5bed6e);}var _0x3e658e=_0x3423e2[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1a8b7e=_0x3423e2['body'][_0x6ca6('0x3e')];return getAgent(_0x3e658e)[_0x6ca6('0x37')](function(_0x243661){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x243661[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x243661['name']),'webbar:answer',{'sessionId':_0x1a8b7e});return _0x4e6d4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x3f')});})[_0x6ca6('0x1f')](handleError(_0x4e6d4));};exports[_0x6ca6('0x40')]=function(_0x33f5d5,_0x1f51f4){logger['info']('hold\x20fired:',_0x33f5d5[_0x6ca6('0x2c')]);var _0x42b263=holdValidation['validate'](_0x33f5d5[_0x6ca6('0x2c')]);if(_0x42b263[_0x6ca6('0x27')]>0x0){return _0x1f51f4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x42b263);}var _0xc1928f=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x5f27f5=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0xc1928f)[_0x6ca6('0x37')](function(_0x4fde51){logger[_0x6ca6('0x10')]('entityFound:',_0x4fde51[_0x6ca6('0x17')]);emit(util['format']('user:%s',_0x4fde51['name']),_0x6ca6('0x41'),{'sessionId':_0x5f27f5});return _0x1f51f4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'hold\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x1f51f4));};exports['unhold']=function(_0x1f552d,_0x1010a6){logger[_0x6ca6('0x10')](_0x6ca6('0x42'),_0x1f552d[_0x6ca6('0x2c')]);var _0x2e6364=unholdValidation[_0x6ca6('0x36')](_0x1f552d[_0x6ca6('0x2c')]);if(_0x2e6364[_0x6ca6('0x27')]>0x0){return _0x1010a6[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2e6364);}var _0x5578fb=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1de2ca=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0x5578fb)['then'](function(_0x14d87a){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x14d87a['name']);emit(util['format']('user:%s',_0x14d87a['name']),_0x6ca6('0x43'),{'sessionId':_0x1de2ca});return _0x1010a6[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x1010a6));};exports[_0x6ca6('0x44')]=function(_0x2cbf30,_0x2591de){logger['info'](_0x6ca6('0x45'),_0x2591de['body']);var _0x281759=callsValidation[_0x6ca6('0x36')](_0x2cbf30[_0x6ca6('0x2c')]);if(_0x281759[_0x6ca6('0x27')]>0x0){return _0x2591de['status'](0x190)[_0x6ca6('0x2d')](_0x281759);}var _0x4874d8=_0x2cbf30['body'][_0x6ca6('0x3d')];var _0x11538e=respondWithRpcPromise(_0x6ca6('0x46'));var _0x35854a=getAgent(_0x4874d8);return Promise['all']([_0x11538e,_0x35854a])[_0x6ca6('0x37')](function(_0x1c12ae){var _0x2c4053=_0x1c12ae[0x0];var _0x13d3ea=_0x1c12ae[0x1];var _0x43881a=_[_0x6ca6('0x24')](_0x2c4053[_0x6ca6('0x25')],function(_0x405609){return _0x405609[_0x6ca6('0x26')]==_0x13d3ea['id'];});return _0x2591de[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'count':_0x43881a[_0x6ca6('0x27')],'rows':_0x43881a});})[_0x6ca6('0x1f')](handleError(_0x2591de));};exports[_0x6ca6('0x47')]=function(_0x2eeed6,_0x290c04){logger['info'](_0x6ca6('0x48'),_0x2eeed6[_0x6ca6('0x2c')]);var _0x2f4886=conferenceValidation[_0x6ca6('0x36')](_0x2eeed6[_0x6ca6('0x2c')]);if(_0x2f4886[_0x6ca6('0x27')]>0x0){return _0x290c04[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2f4886);}var _0x3328ea=_0x2eeed6[_0x6ca6('0x2c')][_0x6ca6('0x3d')];return getAgent(_0x3328ea)[_0x6ca6('0x37')](function(_0x9834d6){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x9834d6[_0x6ca6('0x17')]);emit(util['format'](_0x6ca6('0x32'),_0x9834d6[_0x6ca6('0x17')]),_0x6ca6('0x49'));return _0x290c04[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4a')});})['catch'](handleError(_0x290c04));};exports['transfer']=function(_0x509fe3,_0x21f786){logger[_0x6ca6('0x10')]('transfer\x20fired:',_0x509fe3[_0x6ca6('0x2c')]);var _0xc6021a=transferValidation[_0x6ca6('0x36')](_0x509fe3['body']);if(_0xc6021a[_0x6ca6('0x27')]>0x0){return _0x21f786[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0xc6021a);}var _0x1c3064=_0x509fe3[_0x6ca6('0x2c')]['userId'];var _0x514684=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x3e')];var _0x47d420=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x4b')];return getAgent(_0x1c3064)[_0x6ca6('0x37')](function(_0x19e7ac){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x19e7ac[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x19e7ac['name']),'webbar:transfer',{'sessionId':_0x514684,'transferNumber':_0x47d420});return _0x21f786[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4c')});})[_0x6ca6('0x1f')](handleError(_0x21f786));}; \ No newline at end of file +var _0x5db8=['callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','UserId','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','callNumber\x20is\x20required','string','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','findOne','agent','then','all','filter','rows','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5db8,0xbb));var _0x85db=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0x5db8[_0x40d8d7];return _0x3454cc;};'use strict';var path=require(_0x85db('0x0'));var fs=require('fs');var _=require(_0x85db('0x1'));var db=require(_0x85db('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var jayson=require(_0x85db('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x85db('0x6'))(_0x85db('0x7'));var Redis=require(_0x85db('0x8'));config[_0x85db('0x9')]=_['defaults'](config['redis'],{'host':_0x85db('0xa'),'port':0x18eb});var io=require(_0x85db('0xb'))(new Redis(config[_0x85db('0x9')]));var Schema=require(_0x85db('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x85db('0xd')]},'callNumber':{'type':'string','required':[!![],_0x85db('0xe')]},'callerId':{'type':_0x85db('0xf')},'callbackUrl':{'type':_0x85db('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x85db('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x85db('0xd')]},'sessionId':{'type':_0x85db('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x85db('0xd')]},'sessionId':{'type':'string','required':[!![],_0x85db('0x11')]},'transferNumber':{'type':_0x85db('0xf'),'required':[!![],_0x85db('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x85db('0x10'),'required':[!![],_0x85db('0xd')]},'sessionId':{'type':_0x85db('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x85db('0x10'),'required':[!![],_0x85db('0xd')]},'sessionId':{'type':_0x85db('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x85db('0x10'),'required':[!![],_0x85db('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x85db('0x10'),'required':[!![],_0x85db('0xd')]}});function emit(_0x5ccfef,_0x27bd65,_0x175622){logger[_0x85db('0x13')](_0x5ccfef,_0x27bd65,JSON[_0x85db('0x14')](_0x175622));io['to'](_0x5ccfef)[_0x85db('0x15')](_0x27bd65,_0x175622);}function handleError(_0x396afa){return function(_0x3209b3){console['log'](_0x85db('0x16'),_0x3209b3,_0x3209b3 instanceof RangeError);logger[_0x85db('0x17')](_0x3209b3[_0x85db('0x18')]);if(_0x3209b3 instanceof RangeError){if(_0x3209b3[_0x85db('0x19')]){delete _0x3209b3[_0x85db('0x19')];}_0x396afa[_0x85db('0x1a')](0x194)[_0x85db('0x1b')](_0x3209b3);}else{if(_0x3209b3[_0x85db('0x19')]){delete _0x3209b3[_0x85db('0x19')];}_0x396afa[_0x85db('0x1a')](0x1f4)['send'](_0x3209b3);}};}function checkError(){return function(_0x36a2af){if(!_0x36a2af){throw new RangeError(_0x85db('0x1c'));}return _0x36a2af;};}function respondWithRpcPromise(_0xc812d2,_0x470c81){return new BPromise(function(_0x44c122,_0x3842d7){var _0x3a7148=amiClient;return _0x3a7148[_0x85db('0x1d')](_0xc812d2,_0x470c81)['then'](function(_0xfffea2){if(_0xfffea2[_0x85db('0x17')]){if(_0xfffea2[_0x85db('0x17')][_0x85db('0x1e')]===0x1f4){return _0x3842d7(_0xfffea2[_0x85db('0x17')][_0x85db('0x1f')]);}return _0x44c122(_0xfffea2['error'][_0x85db('0x1f')]);}else{_0x44c122(_0xfffea2[_0x85db('0x20')]);}})[_0x85db('0x21')](function(_0x54ba03){_0x3842d7(_0x54ba03);});});}function getAgent(_0x5467ad){return db['User'][_0x85db('0x22')]({'where':{'id':_0x5467ad,'role':_0x85db('0x23')}})[_0x85db('0x24')](checkError());}function getAgentCheckSession(_0x51b748,_0x71c6f4){return new BPromise(function(_0xc2abb8,_0xdfff49){var _0x574bcc=respondWithRpcPromise('VoiceChannels');var _0x299013=getAgent(_0x51b748);Promise[_0x85db('0x25')]([_0x574bcc,_0x299013])[_0x85db('0x24')](function(_0x226540){var _0x397afc=_0x226540[0x0];var _0x16ee2a=_0x226540[0x1];var _0x8af4a4=_[_0x85db('0x26')](_0x397afc[_0x85db('0x27')],function(_0x1edc8d){return _0x1edc8d['UserId']==_0x16ee2a['id']&&_0x1edc8d['sessionId']==_0x71c6f4;});if(_0x8af4a4[_0x85db('0x28')]==0x1){_0xc2abb8(_0x16ee2a);}else{_0xdfff49(new RangeError('sessionId\x20'+_0x71c6f4+_0x85db('0x29')));}});});}exports[_0x85db('0x2a')]=function(_0x5abdb7,_0x1d15b0){logger[_0x85db('0x13')](_0x85db('0x2b'),_0x5abdb7[_0x85db('0x2c')]);var _0x515a06=originateValidation[_0x85db('0xc')](_0x5abdb7[_0x85db('0x2c')]);if(_0x515a06[_0x85db('0x28')]>0x0){return _0x1d15b0[_0x85db('0x1a')](0x190)[_0x85db('0x2d')](_0x515a06);}var _0x4808a4=_0x5abdb7[_0x85db('0x2c')][_0x85db('0x2e')];var _0x232175=_0x5abdb7[_0x85db('0x2c')]['callNumber'];var _0xfe3cd9=_0x5abdb7[_0x85db('0x2c')][_0x85db('0x2f')];var _0x536398=_0x5abdb7['body'][_0x85db('0x30')];return getAgent(_0x4808a4)[_0x85db('0x24')](function(_0x4980b7){logger[_0x85db('0x13')](_0x85db('0x31'),_0x4980b7[_0x85db('0x19')]);emit(util[_0x85db('0x32')](_0x85db('0x33'),_0x4980b7[_0x85db('0x19')]),_0x85db('0x34'),{'callNumber':_0x232175,'callerId':_0xfe3cd9,'callbackUrl':_0x536398});return _0x1d15b0[_0x85db('0x1a')](0xc8)[_0x85db('0x2d')]({'error':![],'message':_0x85db('0x35')});})[_0x85db('0x21')](handleError(_0x1d15b0));};exports[_0x85db('0x36')]=function(_0x54bc6f,_0x35e938){logger[_0x85db('0x13')](_0x85db('0x37'),_0x54bc6f[_0x85db('0x2c')]);var _0x57a77a=hangupValidation[_0x85db('0xc')](_0x54bc6f[_0x85db('0x2c')]);if(_0x57a77a[_0x85db('0x28')]>0x0){return _0x35e938[_0x85db('0x1a')](0x190)['json'](_0x57a77a);}var _0x5dfe91=_0x54bc6f['body']['userId'];var _0x4d5ff9=_0x54bc6f[_0x85db('0x2c')][_0x85db('0x38')];return getAgent(_0x5dfe91)[_0x85db('0x24')](function(_0x17f649){logger[_0x85db('0x13')]('entityFound:',_0x17f649['name']);emit(util[_0x85db('0x32')]('user:%s',_0x17f649[_0x85db('0x19')]),_0x85db('0x39'),{'sessionId':_0x4d5ff9});return _0x35e938['status'](0xc8)['json']({'error':![],'message':_0x85db('0x3a')});})[_0x85db('0x21')](handleError(_0x35e938));};exports[_0x85db('0x3b')]=function(_0x73eb93,_0x24f8dc){logger['info'](_0x85db('0x3c'),_0x73eb93[_0x85db('0x2c')]);var _0x115720=answerValidation['validate'](_0x73eb93['body']);if(_0x115720['length']>0x0){return _0x24f8dc[_0x85db('0x1a')](0x190)[_0x85db('0x2d')](_0x115720);}var _0x116cb3=_0x73eb93['body']['userId'];var _0x3e4dbc=_0x73eb93['body'][_0x85db('0x38')];return getAgent(_0x116cb3)[_0x85db('0x24')](function(_0x374515){logger['info'](_0x85db('0x31'),_0x374515[_0x85db('0x19')]);emit(util[_0x85db('0x32')](_0x85db('0x33'),_0x374515[_0x85db('0x19')]),_0x85db('0x3d'),{'sessionId':_0x3e4dbc});return _0x24f8dc[_0x85db('0x1a')](0xc8)[_0x85db('0x2d')]({'error':![],'message':_0x85db('0x3e')});})['catch'](handleError(_0x24f8dc));};exports[_0x85db('0x3f')]=function(_0x1b9ab8,_0x30c7a0){logger[_0x85db('0x13')](_0x85db('0x40'),_0x1b9ab8[_0x85db('0x2c')]);var _0x4acd1c=holdValidation[_0x85db('0xc')](_0x1b9ab8[_0x85db('0x2c')]);if(_0x4acd1c[_0x85db('0x28')]>0x0){return _0x30c7a0['status'](0x190)['json'](_0x4acd1c);}var _0x1350ae=_0x1b9ab8['body'][_0x85db('0x2e')];var _0x85181f=_0x1b9ab8[_0x85db('0x2c')][_0x85db('0x38')];return getAgent(_0x1350ae)[_0x85db('0x24')](function(_0x5e1455){logger['info'](_0x85db('0x31'),_0x5e1455[_0x85db('0x19')]);emit(util[_0x85db('0x32')](_0x85db('0x33'),_0x5e1455[_0x85db('0x19')]),_0x85db('0x41'),{'sessionId':_0x85181f});return _0x30c7a0[_0x85db('0x1a')](0xc8)[_0x85db('0x2d')]({'error':![],'message':_0x85db('0x42')});})[_0x85db('0x21')](handleError(_0x30c7a0));};exports['unhold']=function(_0x69c505,_0x2c4ae4){logger['info']('unhold\x20fired:',_0x69c505[_0x85db('0x2c')]);var _0x306be6=unholdValidation['validate'](_0x69c505['body']);if(_0x306be6[_0x85db('0x28')]>0x0){return _0x2c4ae4[_0x85db('0x1a')](0x190)['json'](_0x306be6);}var _0x101388=_0x69c505[_0x85db('0x2c')][_0x85db('0x2e')];var _0xd3cedb=_0x69c505[_0x85db('0x2c')][_0x85db('0x38')];return getAgent(_0x101388)[_0x85db('0x24')](function(_0x438ce7){logger[_0x85db('0x13')](_0x85db('0x31'),_0x438ce7['name']);emit(util['format'](_0x85db('0x33'),_0x438ce7[_0x85db('0x19')]),_0x85db('0x43'),{'sessionId':_0xd3cedb});return _0x2c4ae4[_0x85db('0x1a')](0xc8)[_0x85db('0x2d')]({'error':![],'message':_0x85db('0x44')});})[_0x85db('0x21')](handleError(_0x2c4ae4));};exports[_0x85db('0x45')]=function(_0x34b54e,_0x1e6f60){logger[_0x85db('0x13')](_0x85db('0x46'),_0x1e6f60[_0x85db('0x2c')]);var _0x425e61=callsValidation['validate'](_0x34b54e[_0x85db('0x2c')]);if(_0x425e61[_0x85db('0x28')]>0x0){return _0x1e6f60['status'](0x190)[_0x85db('0x2d')](_0x425e61);}var _0x40a009=_0x34b54e[_0x85db('0x2c')][_0x85db('0x2e')];var _0x992a63=respondWithRpcPromise(_0x85db('0x47'));var _0x43b095=getAgent(_0x40a009);return Promise['all']([_0x992a63,_0x43b095])[_0x85db('0x24')](function(_0x355be9){var _0x4d7e50=_0x355be9[0x0];var _0x5b38c6=_0x355be9[0x1];var _0x1e910e=_['filter'](_0x4d7e50[_0x85db('0x27')],function(_0x42ca02){return _0x42ca02[_0x85db('0x48')]==_0x5b38c6['id'];});return _0x1e6f60[_0x85db('0x1a')](0xc8)['json']({'count':_0x1e910e[_0x85db('0x28')],'rows':_0x1e910e});})['catch'](handleError(_0x1e6f60));};exports['conference']=function(_0x493ab3,_0x367e3e){logger[_0x85db('0x13')]('conference\x20fired:',_0x493ab3[_0x85db('0x2c')]);var _0x1249a6=conferenceValidation['validate'](_0x493ab3[_0x85db('0x2c')]);if(_0x1249a6[_0x85db('0x28')]>0x0){return _0x367e3e[_0x85db('0x1a')](0x190)[_0x85db('0x2d')](_0x1249a6);}var _0x42eddd=_0x493ab3[_0x85db('0x2c')]['userId'];return getAgent(_0x42eddd)[_0x85db('0x24')](function(_0x427250){logger[_0x85db('0x13')](_0x85db('0x31'),_0x427250[_0x85db('0x19')]);emit(util[_0x85db('0x32')](_0x85db('0x33'),_0x427250[_0x85db('0x19')]),'webbar:conference');return _0x367e3e['status'](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x85db('0x21')](handleError(_0x367e3e));};exports[_0x85db('0x49')]=function(_0x88626d,_0x239027){logger[_0x85db('0x13')](_0x85db('0x4a'),_0x88626d['body']);var _0x367ebe=transferValidation[_0x85db('0xc')](_0x88626d[_0x85db('0x2c')]);if(_0x367ebe[_0x85db('0x28')]>0x0){return _0x239027['status'](0x190)[_0x85db('0x2d')](_0x367ebe);}var _0x3dc6f0=_0x88626d[_0x85db('0x2c')][_0x85db('0x2e')];var _0x4d042c=_0x88626d[_0x85db('0x2c')][_0x85db('0x38')];var _0x2af26e=_0x88626d[_0x85db('0x2c')][_0x85db('0x4b')];return getAgent(_0x3dc6f0)['then'](function(_0x4667a5){logger[_0x85db('0x13')](_0x85db('0x31'),_0x4667a5[_0x85db('0x19')]);emit(util[_0x85db('0x32')]('user:%s',_0x4667a5[_0x85db('0x19')]),_0x85db('0x4c'),{'sessionId':_0x4d042c,'transferNumber':_0x2af26e});return _0x239027[_0x85db('0x1a')](0xc8)[_0x85db('0x2d')]({'error':![],'message':_0x85db('0x4d')});})['catch'](handleError(_0x239027));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 965e468..9279ac1 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','post','/:id/canned_answers','/:id/users','addAgents','/:id/notify','notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x4251a4,_0x17292f){var _0x27d2f1=function(_0xf0a495){while(--_0xf0a495){_0x4251a4['push'](_0x4251a4['shift']());}};_0x27d2f1(++_0x17292f);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3f7192,_0xdb2d27){_0x3f7192=_0x3f7192-0x0;var _0x251e82=_0x9f0e[_0x3f7192];return _0x251e82;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x9')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x9')]('/:id/canned_answers',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x10')]);router[_0xe9f0('0x9')]('/:id/users',auth[_0xe9f0('0xb')](),controller['getAgents']);router[_0xe9f0('0x9')](_0xe9f0('0x11'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x12')]);router['post']('/',auth[_0xe9f0('0xb')](),controller['create']);router[_0xe9f0('0x13')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller['addDisposition']);router[_0xe9f0('0x13')](_0xe9f0('0x14'),auth[_0xe9f0('0xb')](),controller['addAnswer']);router[_0xe9f0('0x13')](_0xe9f0('0x15'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x16')]);router[_0xe9f0('0x13')](_0xe9f0('0x11'),auth[_0xe9f0('0xb')](),controller['addApplications']);router[_0xe9f0('0x13')](_0xe9f0('0x17'),controller[_0xe9f0('0x18')]);router['post'](_0xe9f0('0x19'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1a')]);router[_0xe9f0('0x1b')]('/:id',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe9f0('0x1d')]);router[_0xe9f0('0x1e')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1f')]);router['delete'](_0xe9f0('0x14'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x20')]);router[_0xe9f0('0x1e')](_0xe9f0('0x15'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x21')]);module[_0xe9f0('0x22')]=router; \ No newline at end of file +var _0xfcf0=['/:id/applications','getApplications','post','addAnswer','/:id/users','addAgents','addApplications','notify','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents'];(function(_0x4b7f43,_0x1bb236){var _0x314d7d=function(_0x5a57b0){while(--_0x5a57b0){_0x4b7f43['push'](_0x4b7f43['shift']());}};_0x314d7d(++_0x1bb236);}(_0xfcf0,0x138));var _0x0fcf=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xfcf0[_0x24259d];return _0x5a701;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x9')](_0x0fcf('0x10'),auth['isAuthenticated'](),controller[_0x0fcf('0x11')]);router['get'](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x13')]);router['get']('/:id/users',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x14')]);router['get'](_0x0fcf('0x15'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x16')]);router[_0x0fcf('0x17')]('/',auth[_0x0fcf('0xa')](),controller['create']);router[_0x0fcf('0x17')](_0x0fcf('0x10'),auth[_0x0fcf('0xa')](),controller['addDisposition']);router[_0x0fcf('0x17')](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x18')]);router['post'](_0x0fcf('0x19'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x1a')]);router[_0x0fcf('0x17')](_0x0fcf('0x15'),auth['isAuthenticated'](),controller[_0x0fcf('0x1b')]);router[_0x0fcf('0x17')]('/:id/notify',controller[_0x0fcf('0x1c')]);router[_0x0fcf('0x17')]('/:id/send',auth[_0x0fcf('0xa')](),controller['send']);router[_0x0fcf('0x1d')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0x1e')]);router[_0x0fcf('0x1f')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0x20')]);router[_0x0fcf('0x1f')](_0x0fcf('0x10'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x21')]);router[_0x0fcf('0x1f')]('/:id/canned_answers',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x22')]);router[_0x0fcf('0x1f')](_0x0fcf('0x19'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x23')]);module[_0x0fcf('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 4be9c82..0978b0e 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 _0xec33=['sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x34025d,_0x5c6de7){var _0x4d51e7=function(_0x5615a2){while(--_0x5615a2){_0x34025d['push'](_0x34025d['shift']());}};_0x4d51e7(++_0x5c6de7);}(_0xec33,0x108));var _0x3ec3=function(_0x13f3e7,_0x22c4d3){_0x13f3e7=_0x13f3e7-0x0;var _0x225877=_0xec33[_0x13f3e7];return _0x225877;};'use strict';var Sequelize=require(_0x3ec3('0x0'));var rs=require(_0x3ec3('0x1'));module[_0x3ec3('0x2')]={'name':{'type':Sequelize[_0x3ec3('0x3')],'unique':_0x3ec3('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3ec3('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3ec3('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3ec3('0x3')],'defaultValue':function(){return rs[_0x3ec3('0x5')]();}},'phone':{'type':Sequelize[_0x3ec3('0x3')]},'type':{'type':Sequelize[_0x3ec3('0x6')](_0x3ec3('0x7'),_0x3ec3('0x8'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x3ec3('0x3')]},'authToken':{'type':Sequelize[_0x3ec3('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3ec3('0x9');}},'notificationSound':{'type':Sequelize[_0x3ec3('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3ec3('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3ec3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3ec3('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3ec3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3ec3('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3ec3('0xb')],'comment':_0x3ec3('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3ec3('0xd'),'set':function(_0x4e9644){if(!_0x4e9644){this[_0x3ec3('0xe')](_0x3ec3('0xf'),null);}this['setDataValue'](_0x3ec3('0x10'),_0x4e9644);}},'description':{'type':Sequelize[_0x3ec3('0x3')]}}; \ No newline at end of file +var _0x2f02=['STRING','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports'];(function(_0x594163,_0xf3583c){var _0x18c749=function(_0x52f41b){while(--_0x52f41b){_0x594163['push'](_0x594163['shift']());}};_0x18c749(++_0xf3583c);}(_0x2f02,0x15a));var _0x22f0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2f02[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x22f0('0x0'));module[_0x22f0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x22f0('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x22f0('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x22f0('0x2')]},'type':{'type':Sequelize['ENUM'](_0x22f0('0x3'),_0x22f0('0x4'))},'accountSid':{'type':Sequelize[_0x22f0('0x2')]},'baseUrl':{'type':Sequelize[_0x22f0('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x22f0('0x5')],'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[_0x22f0('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x22f0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x22f0('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x22f0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x22f0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x22f0('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x22f0('0x6')],'defaultValue':![],'comment':_0x22f0('0x9'),'set':function(_0x2d13de){if(!_0x2d13de){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x22f0('0xa')](_0x22f0('0xb'),_0x2d13de);}},'description':{'type':Sequelize[_0x22f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index b845148..cd2025c 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 _0x24c6=['to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','keys','create','body','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','sequelize','transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','mobile','from','From','Body','MessageSid','notifications','messageId','message_id','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','applications','push','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a'];(function(_0x1535ec,_0x187b31){var _0x3a958e=function(_0xfacd12){while(--_0xfacd12){_0x1535ec['push'](_0x1535ec['shift']());}};_0x3a958e(++_0x187b31);}(_0x24c6,0xc6));var _0x624c=function(_0x1ef382,_0x86b051){_0x1ef382=_0x1ef382-0x0;var _0x505217=_0x24c6[_0x1ef382];return _0x505217;};'use strict';var emlformat=require(_0x624c('0x0'));var rimraf=require(_0x624c('0x1'));var zipdir=require(_0x624c('0x2'));var jsonpatch=require(_0x624c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x624c('0x4'));var util=require(_0x624c('0x5'));var path=require('path');var sox=require(_0x624c('0x6'));var csv=require('to-csv');var ejs=require(_0x624c('0x7'));var fs=require('fs');var fs_extra=require(_0x624c('0x8'));var _=require('lodash');var squel=require(_0x624c('0x9'));var crypto=require(_0x624c('0xa'));var jsforce=require(_0x624c('0xb'));var deskjs=require(_0x624c('0xc'));var toCsv=require(_0x624c('0xd'));var querystring=require(_0x624c('0xe'));var Papa=require('papaparse');var Redis=require(_0x624c('0xf'));var authService=require(_0x624c('0x10'));var qs=require(_0x624c('0x11'));var as=require(_0x624c('0x12'));var hardwareService=require(_0x624c('0x13'));var logger=require('../../config/logger')(_0x624c('0x14'));var utils=require('../../config/utils');var config=require(_0x624c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x624c('0x16'))['db'];config[_0x624c('0x17')]=_[_0x624c('0x18')](config[_0x624c('0x17')],{'host':_0x624c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x624c('0x17')]));require(_0x624c('0x1a'))[_0x624c('0x1b')](socket);var jayson=require(_0x624c('0x1c'));var client=jayson[_0x624c('0x1d')][_0x624c('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x6d52b0,_0xf0f459,_0x565b3b,_0x4ac376){return new BPromise(function(_0x4be612,_0x306cc2){var _0x323b36=_0x4ac376||client;return _0x323b36[_0x624c('0x1f')](_0x6d52b0,_0x565b3b)[_0x624c('0x20')](function(_0x19eeae){logger[_0x624c('0x21')](_0x624c('0x22'),_0xf0f459,_0x624c('0x23'));logger[_0x624c('0x24')](_0x624c('0x25'),_0xf0f459,_0x624c('0x23'),JSON[_0x624c('0x26')](_0x19eeae));if(_0x19eeae[_0x624c('0x27')]){if(_0x19eeae[_0x624c('0x27')][_0x624c('0x28')]===0x1f4){logger['error'](_0x624c('0x22'),_0xf0f459,_0x19eeae[_0x624c('0x27')]['message']);return _0x306cc2(_0x19eeae[_0x624c('0x27')][_0x624c('0x29')]);}logger[_0x624c('0x27')](_0x624c('0x22'),_0xf0f459,_0x19eeae['error']['message']);return _0x4be612(_0x19eeae[_0x624c('0x27')]['message']);}else{logger[_0x624c('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0xf0f459,_0x624c('0x23'));_0x4be612(_0x19eeae[_0x624c('0x2a')][_0x624c('0x29')]);}})[_0x624c('0x2b')](function(_0x54f271){logger[_0x624c('0x27')](_0x624c('0x22'),_0xf0f459,_0x54f271);_0x306cc2(_0x54f271);});});}function respondWithStatusCode(_0x51329d,_0x1fcd60){_0x1fcd60=_0x1fcd60||0xcc;return function(_0x250869){if(_0x250869){return _0x51329d[_0x624c('0x2c')](_0x1fcd60);}return _0x51329d[_0x624c('0x2d')](_0x1fcd60)['end']();};}function respondWithResult(_0x1b3865,_0x2b0c65){_0x2b0c65=_0x2b0c65||0xc8;return function(_0x3707ab){if(_0x3707ab){return _0x1b3865[_0x624c('0x2d')](_0x2b0c65)[_0x624c('0x2e')](_0x3707ab);}};}function respondWithFilteredResult(_0x602233,_0x49f10c){return function(_0x49a935){if(_0x49a935){var _0x3bf30c=typeof _0x49f10c[_0x624c('0x2f')]===_0x624c('0x30')&&typeof _0x49f10c[_0x624c('0x31')]==='undefined';var _0x2f6dda=_0x49a935['count'];var _0x37bb10=_0x3bf30c?0x0:_0x49f10c[_0x624c('0x2f')];var _0xa8e01b=_0x3bf30c?_0x49a935[_0x624c('0x32')]:_0x49f10c[_0x624c('0x2f')]+_0x49f10c[_0x624c('0x31')];var _0x159332;if(_0xa8e01b>=_0x2f6dda){_0xa8e01b=_0x2f6dda;_0x159332=0xc8;}else{_0x159332=0xce;}_0x602233['status'](_0x159332);return _0x602233[_0x624c('0x33')](_0x624c('0x34'),_0x37bb10+'-'+_0xa8e01b+'/'+_0x2f6dda)[_0x624c('0x2e')](_0x49a935);}return null;};}function patchUpdates(_0x2d34f){return function(_0x40dc41){try{jsonpatch[_0x624c('0x35')](_0x40dc41,_0x2d34f,!![]);}catch(_0x14e0b5){return BPromise[_0x624c('0x36')](_0x14e0b5);}return _0x40dc41[_0x624c('0x37')]();};}function saveUpdates(_0x27d726,_0x4330f1){return function(_0x3cfe32){if(_0x3cfe32){return _0x3cfe32[_0x624c('0x38')](_0x27d726)[_0x624c('0x20')](function(_0x56fde1){return _0x56fde1;});}return null;};}function removeEntity(_0x10187b,_0x5511c4){return function(_0x4f3c28){if(_0x4f3c28){return _0x4f3c28[_0x624c('0x39')]()[_0x624c('0x20')](function(){var _0x411c38=_0x4f3c28[_0x624c('0x3a')]({'plain':!![]});var _0x506864=_0x624c('0x3b');return db[_0x624c('0x3c')][_0x624c('0x39')]({'where':{'type':_0x506864,'resourceId':_0x411c38['id']}})[_0x624c('0x20')](function(){return _0x4f3c28;});})[_0x624c('0x20')](function(){_0x10187b[_0x624c('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308c66,_0x5afbde){return function(_0x6d2c76){if(!_0x6d2c76){_0x308c66[_0x624c('0x2c')](0x194);}return _0x6d2c76;};}function handleError(_0x596416,_0x172192){_0x172192=_0x172192||0x1f4;return function(_0x154bfa){logger[_0x624c('0x27')](_0x154bfa[_0x624c('0x3d')]);if(_0x154bfa[_0x624c('0x3e')]){delete _0x154bfa[_0x624c('0x3e')];}_0x596416[_0x624c('0x2d')](_0x172192)[_0x624c('0x3f')](_0x154bfa);};}exports[_0x624c('0x40')]=function(_0x2babaf,_0x53697c){var _0x305482={'include':[{'model':db[_0x624c('0x41')],'as':_0x624c('0x42')}]},_0x584719={},_0x1efb4c={'count':0x0,'rows':[]};var _0x54a442=_[_0x624c('0x43')](db['WhatsappAccount'][_0x624c('0x44')],function(_0x52e48b){return{'name':_0x52e48b[_0x624c('0x45')],'type':_0x52e48b[_0x624c('0x46')][_0x624c('0x47')]};});_0x584719[_0x624c('0x48')]=_[_0x624c('0x43')](_0x54a442,'name');_0x584719['query']=_['keys'](_0x2babaf[_0x624c('0x49')]);_0x584719[_0x624c('0x4a')]=_[_0x624c('0x4b')](_0x584719[_0x624c('0x48')],_0x584719[_0x624c('0x49')]);_0x305482[_0x624c('0x4c')]=_[_0x624c('0x4b')](_0x584719['model'],qs[_0x624c('0x4d')](_0x2babaf[_0x624c('0x49')]['fields']));_0x305482[_0x624c('0x4c')]=_0x305482[_0x624c('0x4c')][_0x624c('0x4e')]?_0x305482[_0x624c('0x4c')]:_0x584719[_0x624c('0x48')];if(!_0x2babaf[_0x624c('0x49')][_0x624c('0x4f')](_0x624c('0x50'))){_0x305482[_0x624c('0x31')]=qs[_0x624c('0x31')](_0x2babaf[_0x624c('0x49')]['limit']);_0x305482[_0x624c('0x2f')]=qs[_0x624c('0x2f')](_0x2babaf['query']['offset']);}_0x305482[_0x624c('0x51')]=qs[_0x624c('0x52')](_0x2babaf[_0x624c('0x49')]['sort']);_0x305482[_0x624c('0x53')]=qs[_0x624c('0x4a')](_[_0x624c('0x54')](_0x2babaf[_0x624c('0x49')],_0x584719['filters']),_0x54a442);if(_0x2babaf[_0x624c('0x49')][_0x624c('0x55')]){_0x305482[_0x624c('0x53')]=_[_0x624c('0x56')](_0x305482['where'],{'$or':_[_0x624c('0x43')](_0x54a442,function(_0x11e484){if(_0x11e484[_0x624c('0x46')]!==_0x624c('0x57')){var _0x577f00={};_0x577f00[_0x11e484[_0x624c('0x3e')]]={'$like':'%'+_0x2babaf[_0x624c('0x49')][_0x624c('0x55')]+'%'};return _0x577f00;}})});}_0x305482=_[_0x624c('0x56')]({},_0x305482,_0x2babaf[_0x624c('0x58')]);var _0x413147={'where':_0x305482[_0x624c('0x53')]};return db[_0x624c('0x59')]['count'](_0x413147)[_0x624c('0x20')](function(_0x452205){_0x1efb4c['count']=_0x452205;if(_0x2babaf[_0x624c('0x49')][_0x624c('0x5a')]){_0x305482[_0x624c('0x5b')]=[{'all':!![]}];}return db[_0x624c('0x59')][_0x624c('0x5c')](_0x305482);})[_0x624c('0x20')](function(_0x31f42f){_0x1efb4c[_0x624c('0x5d')]=_0x31f42f;return _0x1efb4c;})[_0x624c('0x20')](respondWithFilteredResult(_0x53697c,_0x305482))[_0x624c('0x2b')](handleError(_0x53697c,null));};exports[_0x624c('0x5e')]=function(_0x48ff3e,_0x150882){var _0x320d65={'raw':![],'where':{'id':_0x48ff3e['params']['id']},'include':[{'model':db[_0x624c('0x41')],'as':'mandatoryDispositionPause'}]},_0x5a3c7d={};_0x5a3c7d[_0x624c('0x48')]=_[_0x624c('0x5f')](db['WhatsappAccount']['rawAttributes']);_0x5a3c7d[_0x624c('0x49')]=_[_0x624c('0x5f')](_0x48ff3e[_0x624c('0x49')]);_0x5a3c7d[_0x624c('0x4a')]=_[_0x624c('0x4b')](_0x5a3c7d[_0x624c('0x48')],_0x5a3c7d['query']);_0x320d65['attributes']=_[_0x624c('0x4b')](_0x5a3c7d['model'],qs['fields'](_0x48ff3e[_0x624c('0x49')][_0x624c('0x4d')]));_0x320d65[_0x624c('0x4c')]=_0x320d65[_0x624c('0x4c')][_0x624c('0x4e')]?_0x320d65['attributes']:_0x5a3c7d[_0x624c('0x48')];if(_0x48ff3e[_0x624c('0x49')]['includeAll']){_0x320d65[_0x624c('0x5b')]=[{'all':!![]}];}_0x320d65=_['merge']({},_0x320d65,_0x48ff3e[_0x624c('0x58')]);return db[_0x624c('0x59')]['find'](_0x320d65)[_0x624c('0x20')](handleEntityNotFound(_0x150882,null))['then'](respondWithResult(_0x150882,null))[_0x624c('0x2b')](handleError(_0x150882,null));};exports[_0x624c('0x60')]=function(_0xbf3ec4,_0x10c4e3){return db[_0x624c('0x59')][_0x624c('0x60')](_0xbf3ec4[_0x624c('0x61')],{})[_0x624c('0x20')](function(_0x29af8f){var _0x286923=_0xbf3ec4[_0x624c('0x62')]['get']({'plain':!![]});if(!_0x286923)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x286923['role']===_0x624c('0x62')){var _0x163e21=_0x29af8f[_0x624c('0x3a')]({'plain':!![]});var _0x2a6f8b='WhatsappAccounts';return db[_0x624c('0x63')][_0x624c('0x64')]({'where':{'name':_0x2a6f8b,'userProfileId':_0x286923['userProfileId']},'raw':!![]})['then'](function(_0x212d1d){if(_0x212d1d&&_0x212d1d[_0x624c('0x65')]===0x0){return db[_0x624c('0x3c')]['create']({'name':_0x163e21[_0x624c('0x3e')],'resourceId':_0x163e21['id'],'type':_0x212d1d[_0x624c('0x3e')],'sectionId':_0x212d1d['id']},{})[_0x624c('0x20')](function(){return _0x29af8f;});}else{return _0x29af8f;}})['catch'](function(_0x53354c){logger['error'](_0x624c('0x66'),_0x53354c);throw _0x53354c;});}return _0x29af8f;})[_0x624c('0x20')](respondWithResult(_0x10c4e3,0xc9))[_0x624c('0x2b')](handleError(_0x10c4e3,null));};exports[_0x624c('0x38')]=function(_0x35ee09,_0x236b5a){if(_0x35ee09[_0x624c('0x61')]['id']){delete _0x35ee09[_0x624c('0x61')]['id'];}return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x35ee09[_0x624c('0x67')]['id']},'include':[{'model':db[_0x624c('0x41')],'as':_0x624c('0x42')}]})[_0x624c('0x20')](handleEntityNotFound(_0x236b5a,null))[_0x624c('0x20')](saveUpdates(_0x35ee09[_0x624c('0x61')],null))[_0x624c('0x20')](respondWithResult(_0x236b5a,null))[_0x624c('0x2b')](handleError(_0x236b5a,null));};exports[_0x624c('0x39')]=function(_0x3468b8,_0x3e9d26){return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x3468b8[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x3e9d26,null))[_0x624c('0x20')](removeEntity(_0x3e9d26,null))[_0x624c('0x2b')](handleError(_0x3e9d26,null));};exports[_0x624c('0x68')]=function(_0x3a802c,_0x3fc711){return db['WhatsappAccount'][_0x624c('0x68')]()[_0x624c('0x20')](respondWithResult(_0x3fc711,null))[_0x624c('0x2b')](handleError(_0x3fc711,null));};exports[_0x624c('0x69')]=function(_0x2544a9,_0x27d36c,_0xad549d){if(_0x2544a9[_0x624c('0x61')]['id']){delete _0x2544a9[_0x624c('0x61')]['id'];}return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x2544a9['params']['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x27d36c,null))[_0x624c('0x20')](function(_0x544592){if(_0x544592){_0x2544a9[_0x624c('0x61')][_0x624c('0x6a')]=_0x544592['id'];return db[_0x624c('0x6b')][_0x624c('0x60')](_0x2544a9['body']);}})[_0x624c('0x20')](respondWithResult(_0x27d36c,null))['catch'](handleError(_0x27d36c,null));};exports[_0x624c('0x6c')]=function(_0x42ad3f,_0x22a327,_0x38bcee){var _0x3b458b={'raw':![],'where':{}};var _0x21c8ea={};var _0x5ccc3c={'count':0x0,'rows':[]};return db[_0x624c('0x59')][_0x624c('0x6d')]({'where':{'id':_0x42ad3f[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x22a327,null))[_0x624c('0x20')](function(_0x8d0ba9){if(_0x8d0ba9){_0x21c8ea[_0x624c('0x48')]=_['keys'](db[_0x624c('0x6b')][_0x624c('0x44')]);_0x21c8ea[_0x624c('0x49')]=_[_0x624c('0x5f')](_0x42ad3f['query']);_0x21c8ea[_0x624c('0x4a')]=_[_0x624c('0x4b')](_0x21c8ea[_0x624c('0x48')],_0x21c8ea[_0x624c('0x49')]);_0x3b458b[_0x624c('0x4c')]=_[_0x624c('0x4b')](_0x21c8ea[_0x624c('0x48')],qs[_0x624c('0x4d')](_0x42ad3f['query'][_0x624c('0x4d')]));_0x3b458b[_0x624c('0x4c')]=_0x3b458b[_0x624c('0x4c')][_0x624c('0x4e')]?_0x3b458b[_0x624c('0x4c')]:_0x21c8ea[_0x624c('0x48')];if(!_0x42ad3f[_0x624c('0x49')]['hasOwnProperty']('nolimit')){_0x3b458b[_0x624c('0x31')]=qs[_0x624c('0x31')](_0x42ad3f[_0x624c('0x49')][_0x624c('0x31')]);_0x3b458b[_0x624c('0x2f')]=qs[_0x624c('0x2f')](_0x42ad3f[_0x624c('0x49')][_0x624c('0x2f')]);}_0x3b458b['order']=qs['sort'](_0x42ad3f[_0x624c('0x49')][_0x624c('0x52')]);_0x3b458b[_0x624c('0x53')]=qs[_0x624c('0x4a')](_['pick'](_0x42ad3f['query'],_0x21c8ea[_0x624c('0x4a')]));_0x3b458b[_0x624c('0x53')][_0x624c('0x6a')]=_0x8d0ba9['id'];if(_0x42ad3f[_0x624c('0x49')][_0x624c('0x55')]){_0x3b458b[_0x624c('0x53')]=_[_0x624c('0x56')](_0x3b458b[_0x624c('0x53')],{'$or':_[_0x624c('0x43')](_0x3b458b[_0x624c('0x4c')],function(_0x34a356){var _0x1b09a2={};_0x1b09a2[_0x34a356]={'$like':'%'+_0x42ad3f[_0x624c('0x49')]['filter']+'%'};return _0x1b09a2;})});}_0x3b458b=_[_0x624c('0x56')]({},_0x3b458b,_0x42ad3f[_0x624c('0x58')]);return db[_0x624c('0x6b')]['count']({'where':_0x3b458b['where']})[_0x624c('0x20')](function(_0x24e94a){_0x5ccc3c['count']=_0x24e94a;if(_0x42ad3f[_0x624c('0x49')]['includeAll']){_0x3b458b[_0x624c('0x5b')]=[{'all':!![]}];}return db[_0x624c('0x6b')]['findAll'](_0x3b458b);})[_0x624c('0x20')](function(_0x25c632){_0x5ccc3c[_0x624c('0x5d')]=_0x25c632;return _0x5ccc3c;});}})['then'](respondWithFilteredResult(_0x22a327,_0x3b458b))[_0x624c('0x2b')](handleError(_0x22a327,null));};exports['removeDispositions']=function(_0x33647a,_0x14edf9,_0x1d4cef){return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x33647a[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x14edf9,null))[_0x624c('0x20')](function(_0x3961eb){if(_0x3961eb){return _0x3961eb[_0x624c('0x6e')](_0x33647a[_0x624c('0x49')]['ids']);}})[_0x624c('0x20')](respondWithStatusCode(_0x14edf9,null))['catch'](handleError(_0x14edf9,null));};exports['addAnswer']=function(_0x257c39,_0x4fe034,_0x5c33a1){if(_0x257c39[_0x624c('0x61')]['id']){delete _0x257c39['body']['id'];}return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x257c39[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x4fe034,null))[_0x624c('0x20')](function(_0x12112d){if(_0x12112d){_0x257c39[_0x624c('0x61')]['WhatsappAccountId']=_0x12112d['id'];return db['CannedAnswer'][_0x624c('0x60')](_0x257c39['body']);}})['then'](respondWithResult(_0x4fe034,null))[_0x624c('0x2b')](handleError(_0x4fe034,null));};exports['getAnswers']=function(_0xb7b1f5,_0x21c47a,_0x504f3d){var _0x3f128e={'raw':![],'where':{}};var _0x2346a8={};var _0x16dc61={'count':0x0,'rows':[]};return db[_0x624c('0x59')][_0x624c('0x6d')]({'where':{'id':_0xb7b1f5[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x21c47a,null))[_0x624c('0x20')](function(_0x1c99ec){if(_0x1c99ec){_0x2346a8['model']=_[_0x624c('0x5f')](db[_0x624c('0x6f')][_0x624c('0x44')]);_0x2346a8[_0x624c('0x49')]=_['keys'](_0xb7b1f5[_0x624c('0x49')]);_0x2346a8['filters']=_[_0x624c('0x4b')](_0x2346a8[_0x624c('0x48')],_0x2346a8[_0x624c('0x49')]);_0x3f128e[_0x624c('0x4c')]=_['intersection'](_0x2346a8[_0x624c('0x48')],qs['fields'](_0xb7b1f5[_0x624c('0x49')]['fields']));_0x3f128e[_0x624c('0x4c')]=_0x3f128e['attributes'][_0x624c('0x4e')]?_0x3f128e[_0x624c('0x4c')]:_0x2346a8[_0x624c('0x48')];if(!_0xb7b1f5[_0x624c('0x49')][_0x624c('0x4f')](_0x624c('0x50'))){_0x3f128e[_0x624c('0x31')]=qs['limit'](_0xb7b1f5[_0x624c('0x49')][_0x624c('0x31')]);_0x3f128e[_0x624c('0x2f')]=qs[_0x624c('0x2f')](_0xb7b1f5[_0x624c('0x49')][_0x624c('0x2f')]);}_0x3f128e[_0x624c('0x51')]=qs[_0x624c('0x52')](_0xb7b1f5['query'][_0x624c('0x52')]);_0x3f128e[_0x624c('0x53')]=qs[_0x624c('0x4a')](_['pick'](_0xb7b1f5['query'],_0x2346a8['filters']));_0x3f128e['where'][_0x624c('0x6a')]=_0x1c99ec['id'];if(_0xb7b1f5[_0x624c('0x49')][_0x624c('0x55')]){_0x3f128e[_0x624c('0x53')]=_[_0x624c('0x56')](_0x3f128e['where'],{'$or':_[_0x624c('0x43')](_0x3f128e[_0x624c('0x4c')],function(_0x489e28){var _0x82262e={};_0x82262e[_0x489e28]={'$like':'%'+_0xb7b1f5[_0x624c('0x49')][_0x624c('0x55')]+'%'};return _0x82262e;})});}_0x3f128e=_[_0x624c('0x56')]({},_0x3f128e,_0xb7b1f5['options']);return db[_0x624c('0x6f')][_0x624c('0x32')]({'where':_0x3f128e[_0x624c('0x53')]})['then'](function(_0x151fcb){_0x16dc61['count']=_0x151fcb;if(_0xb7b1f5['query'][_0x624c('0x5a')]){_0x3f128e[_0x624c('0x5b')]=[{'all':!![]}];}return db[_0x624c('0x6f')][_0x624c('0x5c')](_0x3f128e);})[_0x624c('0x20')](function(_0x22dbac){_0x16dc61[_0x624c('0x5d')]=_0x22dbac;return _0x16dc61;});}})[_0x624c('0x20')](respondWithFilteredResult(_0x21c47a,_0x3f128e))[_0x624c('0x2b')](handleError(_0x21c47a,null));};exports[_0x624c('0x70')]=function(_0x28571e,_0x2ab5d1,_0x4a18ce){return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x28571e[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x2ab5d1,null))[_0x624c('0x20')](function(_0x499f9d){if(_0x499f9d){return _0x499f9d[_0x624c('0x70')](_0x28571e[_0x624c('0x49')][_0x624c('0x71')]);}})[_0x624c('0x20')](respondWithStatusCode(_0x2ab5d1,null))['catch'](handleError(_0x2ab5d1,null));};exports[_0x624c('0x72')]=function(_0x141b92,_0x5a5b85,_0x10c4b9){return db[_0x624c('0x59')]['find']({'where':{'id':_0x141b92[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x5a5b85,null))[_0x624c('0x20')](function(_0x58e633){if(_0x58e633){return _0x58e633[_0x624c('0x72')](_0x141b92[_0x624c('0x61')][_0x624c('0x71')],_[_0x624c('0x73')](_0x141b92[_0x624c('0x61')],[_0x624c('0x71'),'id'])||{})[_0x624c('0x74')](function(_0x591328){for(var _0x1d5d49=0x0;_0x1d5d49<_0x141b92[_0x624c('0x61')][_0x624c('0x71')][_0x624c('0x4e')];_0x1d5d49+=0x1){socket['emit'](_0x624c('0x75'),{'UserId':Number(_0x141b92[_0x624c('0x61')]['ids'][_0x1d5d49]),'WhatsappAccountId':Number(_0x141b92[_0x624c('0x67')]['id'])});}return _0x591328;});}})[_0x624c('0x20')](respondWithResult(_0x5a5b85,null))['catch'](handleError(_0x5a5b85,null));};exports[_0x624c('0x76')]=function(_0x25098f,_0xce8c75,_0x4aa3b9){return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x25098f[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0xce8c75,null))[_0x624c('0x20')](function(_0xf1031c){if(_0xf1031c){return _0xf1031c[_0x624c('0x76')](_0x25098f[_0x624c('0x49')]['ids'])['then'](function(){if(_[_0x624c('0x77')](_0x25098f[_0x624c('0x49')][_0x624c('0x71')])){for(var _0x3c41d5=0x0;_0x3c41d5<_0x25098f['query'][_0x624c('0x71')][_0x624c('0x4e')];_0x3c41d5+=0x1){socket['emit'](_0x624c('0x78'),{'UserId':Number(_0x25098f['query'][_0x624c('0x71')][_0x3c41d5]),'WhatsappAccountId':Number(_0x25098f[_0x624c('0x67')]['id'])});}}else{socket['emit'](_0x624c('0x78'),{'UserId':Number(_0x25098f['query'][_0x624c('0x71')]),'WhatsappAccountId':Number(_0x25098f[_0x624c('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0xce8c75,null))[_0x624c('0x2b')](handleError(_0xce8c75,null));};exports['getAgents']=function(_0x135de0,_0x2466f8,_0x5a4141){var _0x4f27dd={};var _0x498509={};var _0x1106fe;var _0xaca5da;return db[_0x624c('0x59')][_0x624c('0x6d')]({'where':{'id':_0x135de0[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x2466f8,null))['then'](function(_0x55c59e){if(_0x55c59e){_0x1106fe=_0x55c59e;_0x498509[_0x624c('0x48')]=_[_0x624c('0x5f')](db[_0x624c('0x79')]['rawAttributes']);_0x498509[_0x624c('0x49')]=_[_0x624c('0x5f')](_0x135de0[_0x624c('0x49')]);_0x498509['filters']=_[_0x624c('0x4b')](_0x498509['model'],_0x498509[_0x624c('0x49')]);_0x4f27dd[_0x624c('0x4c')]=_['intersection'](_0x498509['model'],qs[_0x624c('0x4d')](_0x135de0[_0x624c('0x49')]['fields']));_0x4f27dd[_0x624c('0x4c')]=_0x4f27dd[_0x624c('0x4c')][_0x624c('0x4e')]?_0x4f27dd[_0x624c('0x4c')]:_0x498509[_0x624c('0x48')];_0x4f27dd[_0x624c('0x51')]=qs['sort'](_0x135de0['query']['sort']);_0x4f27dd[_0x624c('0x53')]=qs['filters'](_['pick'](_0x135de0[_0x624c('0x49')],_0x498509[_0x624c('0x4a')]));if(_0x135de0[_0x624c('0x49')][_0x624c('0x55')]){_0x4f27dd[_0x624c('0x53')]=_[_0x624c('0x56')](_0x4f27dd['where'],{'$or':_[_0x624c('0x43')](_0x4f27dd[_0x624c('0x4c')],function(_0xf3acab){var _0x32290c={};_0x32290c[_0xf3acab]={'$like':'%'+_0x135de0[_0x624c('0x49')][_0x624c('0x55')]+'%'};return _0x32290c;})});}_0x4f27dd=_[_0x624c('0x56')]({},_0x4f27dd,_0x135de0['options']);return _0x1106fe[_0x624c('0x7a')](_0x4f27dd);}})['then'](function(_0x3b40f4){if(_0x3b40f4){_0xaca5da=_0x3b40f4[_0x624c('0x4e')];if(!_0x135de0[_0x624c('0x49')][_0x624c('0x4f')](_0x624c('0x50'))){_0x4f27dd[_0x624c('0x31')]=qs[_0x624c('0x31')](_0x135de0[_0x624c('0x49')][_0x624c('0x31')]);_0x4f27dd[_0x624c('0x2f')]=qs[_0x624c('0x2f')](_0x135de0['query'][_0x624c('0x2f')]);}return _0x1106fe[_0x624c('0x7a')](_0x4f27dd);}})[_0x624c('0x20')](function(_0x2d1ee9){if(_0x2d1ee9){return _0x2d1ee9?{'count':_0xaca5da,'rows':_0x2d1ee9}:null;}})[_0x624c('0x20')](respondWithResult(_0x2466f8,null))['catch'](handleError(_0x2466f8,null));};exports['addApplications']=function(_0x3e596a,_0x468bda){var _0x4260eb=_0x3e596a[_0x624c('0x67')]['id'];var _0x333873=_0x3e596a[_0x624c('0x61')];var _0x36087e=0xc8;var _0x1db731=null;return db[_0x624c('0x7b')][_0x624c('0x7c')]({'isolationLevel':db[_0x624c('0x7b')]['Transaction'][_0x624c('0x7d')]['READ_COMMITTED']},function(_0x6a6663){return db[_0x624c('0x59')][_0x624c('0x6d')]({'where':{'id':_0x4260eb},'transaction':_0x6a6663})[_0x624c('0x20')](function(_0x5657a7){if(_0x5657a7){return db[_0x624c('0x7e')][_0x624c('0x39')]({'where':{'WhatsappAccountId':_0x4260eb},'transaction':_0x6a6663})[_0x624c('0x20')](function(){var _0x1d3c6d=_['map'](_0x333873,function(_0x5ce731){_0x5ce731[_0x624c('0x6a')]=_0x4260eb;return _0x5ce731;});return db[_0x624c('0x7e')]['bulkCreate'](_0x1d3c6d,{'transaction':_0x6a6663});});}else{_0x36087e=0x194;_0x1db731=[];}});})['then'](function(){if(_0x36087e!==0x194){return db['WhatsappApplication'][_0x624c('0x7f')]({'where':{'WhatsappAccountId':_0x4260eb},'order':_0x624c('0x80')})['then'](function(_0x4ede3f){_0x1db731=_0x4ede3f;});}})[_0x624c('0x2b')](function(_0x262ef0){_0x36087e=0x1f4;logger[_0x624c('0x27')](_0x262ef0[_0x624c('0x3d')]);if(_0x262ef0[_0x624c('0x3e')]){delete _0x262ef0['name'];}_0x1db731=_0x262ef0;})[_0x624c('0x81')](function(){if(_0x1db731===null){_0x468bda['sendStatus'](_0x36087e);}else{if(_0x36087e===0x1f4){_0x468bda['status'](_0x36087e)[_0x624c('0x3f')](_0x1db731);}else{_0x468bda[_0x624c('0x2d')](_0x36087e)[_0x624c('0x2e')](_0x1db731);}}});};exports[_0x624c('0x82')]=function(_0x49fb0e,_0x321625,_0x17b9a1){var _0x1c6895={};var _0x572936={};var _0xddead0;var _0x2d2a57;return db[_0x624c('0x59')]['findOne']({'where':{'id':_0x49fb0e[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x321625,null))[_0x624c('0x20')](function(_0x5ce3d5){if(_0x5ce3d5){_0xddead0=_0x5ce3d5;_0x572936[_0x624c('0x48')]=_[_0x624c('0x5f')](db[_0x624c('0x7e')][_0x624c('0x44')]);_0x572936[_0x624c('0x49')]=_[_0x624c('0x5f')](_0x49fb0e[_0x624c('0x49')]);_0x572936['filters']=_[_0x624c('0x4b')](_0x572936[_0x624c('0x48')],_0x572936['query']);_0x1c6895[_0x624c('0x4c')]=_[_0x624c('0x4b')](_0x572936['model'],qs['fields'](_0x49fb0e[_0x624c('0x49')][_0x624c('0x4d')]));_0x1c6895[_0x624c('0x4c')]=_0x1c6895[_0x624c('0x4c')][_0x624c('0x4e')]?_0x1c6895['attributes']:_0x572936[_0x624c('0x48')];_0x1c6895[_0x624c('0x51')]=qs[_0x624c('0x52')](_0x49fb0e['query'][_0x624c('0x52')]);_0x1c6895[_0x624c('0x53')]=qs[_0x624c('0x4a')](_[_0x624c('0x54')](_0x49fb0e[_0x624c('0x49')],_0x572936[_0x624c('0x4a')]));if(_0x49fb0e[_0x624c('0x49')][_0x624c('0x55')]){_0x1c6895[_0x624c('0x53')]=_[_0x624c('0x56')](_0x1c6895[_0x624c('0x53')],{'$or':_['map'](_0x1c6895[_0x624c('0x4c')],function(_0x461109){var _0x286080={};_0x286080[_0x461109]={'$like':'%'+_0x49fb0e[_0x624c('0x49')]['filter']+'%'};return _0x286080;})});}_0x1c6895=_[_0x624c('0x56')]({},_0x1c6895,_0x49fb0e[_0x624c('0x58')]);return _0xddead0['getApplications'](_0x1c6895);}})[_0x624c('0x20')](function(_0x402658){if(_0x402658){_0x2d2a57=_0x402658[_0x624c('0x4e')];if(!_0x49fb0e[_0x624c('0x49')][_0x624c('0x4f')](_0x624c('0x50'))){_0x1c6895[_0x624c('0x31')]=qs[_0x624c('0x31')](_0x49fb0e[_0x624c('0x49')][_0x624c('0x31')]);_0x1c6895[_0x624c('0x2f')]=qs['offset'](_0x49fb0e[_0x624c('0x49')][_0x624c('0x2f')]);}return _0xddead0[_0x624c('0x82')](_0x1c6895);}})[_0x624c('0x20')](function(_0x31d51c){if(_0x31d51c){return _0x31d51c?{'count':_0x2d2a57,'rows':_0x31d51c}:null;}})[_0x624c('0x20')](respondWithResult(_0x321625,null))[_0x624c('0x2b')](handleError(_0x321625,null));};exports[_0x624c('0x83')]=function(_0x4ae931,_0x2bdaec,_0x50300b){var _0x41e55b={'channel':'whatsapp'};var _0x43d777=[];var _0x14d10b=[];var _0x597f8f={};return db['WhatsappAccount'][_0x624c('0x64')]({'where':{'id':_0x4ae931['params']['id']},'include':[{'model':db[_0x624c('0x7e')],'as':_0x624c('0x84')}]})[_0x624c('0x20')](handleEntityNotFound(_0x2bdaec,null))[_0x624c('0x20')](function(_0x5a5ba2){_0x41e55b[_0x624c('0x85')]=_0x5a5ba2;if(_0x41e55b['account']&&_0x41e55b[_0x624c('0x85')][_0x624c('0x46')]===_0x624c('0x86')&&_0x4ae931[_0x624c('0x61')][_0x624c('0x87')]){if(_0x4ae931[_0x624c('0x61')]['statuses'][_0x624c('0x4e')]===0x0)return;if(_0x4ae931[_0x624c('0x61')][_0x624c('0x87')][0x0][_0x624c('0x88')]!==_0x624c('0x89'))return;return db[_0x624c('0x8a')]['update']({'read':!![],'readAt':_0x4ae931[_0x624c('0x61')][_0x624c('0x87')][0x0][_0x624c('0x8b')]},{'where':{'messageId':_0x4ae931['body']['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x624c('0x20')](function(_0x1a3bfa){return _0x2bdaec[_0x624c('0x2d')](0xc8)[_0x624c('0x2e')](_0x1a3bfa);});}_0x41e55b['applications']=_[_0x624c('0x8c')](_0x5a5ba2['Applications'],[_0x624c('0x80')],[_0x624c('0x8d')]);if(_0x41e55b[_0x624c('0x85')][_0x624c('0x84')]){delete _0x41e55b['account']['Applications'];}return db[_0x624c('0x8e')][_0x624c('0x68')]()['then'](function(_0x3042d5){if(!_0x3042d5){throw new db['Sequelize'][(_0x624c('0x8f'))](_0x624c('0x90'));}_0x43d777=_['difference'](_[_0x624c('0x5f')](_0x3042d5),[_0x624c('0x91'),_0x624c('0x92')]);_0x14d10b=_[_0x624c('0x93')](_['keys'](_0x3042d5),[_0x624c('0x91'),_0x624c('0x92'),'CompanyId',_0x624c('0x94')]);_0x41e55b[_0x624c('0x61')]={'mapKey':_0x624c('0x95')};if(_0x41e55b[_0x624c('0x85')]&&_0x41e55b[_0x624c('0x85')][_0x624c('0x46')]==='twilio'){_0x41e55b[_0x624c('0x61')][_0x624c('0x96')]=_0x4ae931[_0x624c('0x61')][_0x624c('0x97')]['replace']('whatsapp:','');_0x41e55b[_0x624c('0x61')][_0x624c('0x61')]=_0x4ae931[_0x624c('0x61')][_0x624c('0x98')];_0x41e55b['body']['messageId']=_0x4ae931[_0x624c('0x61')][_0x624c('0x99')];}if(_0x41e55b[_0x624c('0x85')]&&_0x41e55b[_0x624c('0x85')][_0x624c('0x46')]==='sinch'){_0x41e55b[_0x624c('0x61')][_0x624c('0x96')]=_0x4ae931[_0x624c('0x61')]['notifications'][0x0][_0x624c('0x96')];_0x41e55b[_0x624c('0x61')][_0x624c('0x61')]=_0x4ae931[_0x624c('0x61')][_0x624c('0x9a')][0x0][_0x624c('0x29')]['body'];_0x41e55b[_0x624c('0x61')][_0x624c('0x9b')]=_0x4ae931[_0x624c('0x61')][_0x624c('0x9a')][0x0][_0x624c('0x9c')];}if(_0x41e55b[_0x624c('0x61')]['id']){delete _0x41e55b[_0x624c('0x61')]['id'];}if(_['isNil'](_0x41e55b[_0x624c('0x61')][_0x624c('0x96')])){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0x9e'));}if(_[_0x624c('0x9f')](_0x41e55b[_0x624c('0x61')][_0x624c('0x61')])||_0x41e55b[_0x624c('0x61')][_0x624c('0x61')]===''){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0xa0'));}if(_['isNil'](_0x41e55b['body'][_0x624c('0xa1')])){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0xa2')+_0x14d10b);}if(!_[_0x624c('0xa3')](_0x14d10b,_0x41e55b[_0x624c('0x61')]['mapKey'])){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14d10b);}_0x597f8f[_0x41e55b['body'][_0x624c('0xa1')]]=_0x41e55b['body'][_0x624c('0x96')];return db[_0x624c('0xa4')]['find']({'where':{'id':_0x41e55b[_0x624c('0x85')]['ListId']},'include':[{'model':db[_0x624c('0x8e')],'as':_0x624c('0xa5'),'where':_0x597f8f,'limit':0x1,'order':[[_0x624c('0x92'),'DESC']]}]});})[_0x624c('0x20')](handleEntityNotFound(_0x2bdaec,null))[_0x624c('0x20')](function(_0x3db123){if(_0x3db123){_0x41e55b[_0x624c('0xa6')]=_[_0x624c('0x73')](_0x3db123,['Contacts']);if(_0x3db123['Contacts']['length']){return _0x3db123[_0x624c('0xa5')][0x0];}var _0x5a9f61=_[_0x624c('0x18')](_0x41e55b['body'],{'firstName':_0x41e55b[_0x624c('0x61')][_0x624c('0x96')],'ListId':_0x3db123['id']});_0x5a9f61[_0x41e55b['body'][_0x624c('0xa1')]]=_0x41e55b[_0x624c('0x61')][_0x624c('0x96')];return db['CmContact'][_0x624c('0x60')](_0x5a9f61,{'fields':_0x43d777,'raw':!![]});}})['then'](handleEntityNotFound(_0x2bdaec,null))[_0x624c('0x20')](function(_0x515cc8){if(_0x515cc8){_0x41e55b[_0x624c('0xa7')]=_0x515cc8;var _0xa49c07={'ContactId':_0x515cc8['id'],'phone':_0x41e55b['body']['from'],'WhatsappAccountId':_0x4ae931[_0x624c('0x67')]['id']};var _0x4186da={'ContactId':_0x515cc8['id'],'WhatsappAccountId':_0x4ae931[_0x624c('0x67')]['id'],'closed':![]};return db[_0x624c('0xa8')]['find']({'where':_0x4186da})[_0x624c('0x20')](function(_0x5a17b0){if(_0x5a17b0){return[_0x5a17b0,![]];}return db[_0x624c('0xa8')][_0x624c('0x60')](_0xa49c07)[_0x624c('0x20')](function(_0x201cfd){return[_0x201cfd,!![]];});});}})['spread'](function(_0x1580b5,_0x11a107){_0x41e55b[_0x624c('0xa9')]=_0x1580b5[_0x624c('0x3a')]({'plain':!![]});_0x41e55b['interaction'][_0x624c('0xaa')]=![];if(_0x11a107){if(_0x41e55b[_0x624c('0x85')]['autoclose']){_0x41e55b[_0x624c('0xab')][_0x624c('0xac')]({'id':0x0,'priority':_0x41e55b['applications']['length']+0x1,'app':'close','appdata':_0x624c('0xad'),'interval':'*,*,*,*'});}_0x41e55b[_0x624c('0xa9')][_0x624c('0xaa')]=!![];}return db[_0x624c('0x8a')][_0x624c('0x60')]({'phone':_0x41e55b[_0x624c('0x61')][_0x624c('0x96')],'messageId':_0x41e55b[_0x624c('0x61')][_0x624c('0x9b')],'body':_0x41e55b[_0x624c('0x61')][_0x624c('0x61')],'WhatsappAccountId':_0x4ae931[_0x624c('0x67')]['id'],'WhatsappInteractionId':_0x1580b5['id'],'direction':'in','ContactId':_0x1580b5[_0x624c('0xae')],'AttachmentId':_0x41e55b['body'][_0x624c('0xaf')]});})['then'](function(_0x21b4b6){_0x41e55b[_0x624c('0x29')]=_0x21b4b6;if(_0x41e55b[_0x624c('0xa9')][_0x624c('0xb0')]){return db[_0x624c('0x79')][_0x624c('0x64')]({'attributes':['id',_0x624c('0x3e')],'where':{'id':_0x41e55b[_0x624c('0xa9')][_0x624c('0xb0')]}})[_0x624c('0x20')](function(_0x15ba2c){if(_0x15ba2c){_0x41e55b[_0x624c('0xab')][_0x624c('0xb1')]({'id':0x0,'priority':0x0,'app':_0x624c('0xb2'),'appdata':_0x15ba2c[_0x624c('0x3e')]+','+(_0x41e55b[_0x624c('0x85')][_0x624c('0xb3')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x624c('0xb4'),'startRouting',_0x41e55b);});}return respondWithRpcPromise(_0x624c('0xb4'),'startRouting',_0x41e55b);})[_0x624c('0x20')](function(_0x43d4a1){if(_0x43d4a1){var _0x41f385=0xc8;var _0x2f4959=_0x624c('0xb5');logger[_0x624c('0x21')](_0x624c('0x25'),_0x2f4959,_0x41f385,_0x624c('0xb6'));logger[_0x624c('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2f4959,_0x41f385,'entity\x20found',JSON[_0x624c('0x26')](_0x43d4a1));if(_0x41e55b[_0x624c('0x85')][_0x624c('0x46')]==='twilio'){return _0x2bdaec['status'](_0x41f385)[_0x624c('0x33')](_0x624c('0xb7'),_0x624c('0xb8'))[_0x624c('0x3f')](_0x624c('0xb9'));}else{return _0x2bdaec[_0x624c('0x2d')](_0x41f385)[_0x624c('0x2e')](_0x43d4a1);}}});})[_0x624c('0x2b')](handleError(_0x2bdaec,null));};exports['send']=function(_0xbcc8ed,_0x58ff28,_0x4b7b8b){var _0x3bb3fe,_0x2c61b8,_0x1a52d6;if(_['isNil'](_0xbcc8ed['body'][_0x624c('0x61')])||_0xbcc8ed[_0x624c('0x61')][_0x624c('0x61')]===''){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0xa0'));}if(_[_0x624c('0x9f')](_0xbcc8ed[_0x624c('0x61')]['to'])){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0xba'));}_0x3bb3fe=_0xbcc8ed[_0x624c('0x61')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0xbcc8ed[_0x624c('0x67')]['id']},'include':[{'model':db['CmList'],'as':_0x624c('0xbb'),'include':[{'model':db[_0x624c('0x8e')],'as':_0x624c('0xa5'),'where':{'mobile':_0x3bb3fe},'limit':0x1,'order':[['updatedAt',_0x624c('0xbc')]]}]}]})[_0x624c('0x20')](handleEntityNotFound(_0x58ff28,null))[_0x624c('0x20')](function(_0x3f61ee){if(_0x3f61ee&&_0x3f61ee[_0x624c('0xbb')]){_0x2c61b8=_0x3f61ee[_0x624c('0x3a')]({'plain':!![]});if(_0x2c61b8[_0x624c('0xbb')]&&_0x2c61b8[_0x624c('0xbb')][_0x624c('0xa5')]['length']){return _0x2c61b8[_0x624c('0xbb')][_0x624c('0xa5')][0x0];}return db[_0x624c('0x8e')][_0x624c('0x60')](_[_0x624c('0x18')](_0xbcc8ed[_0x624c('0x61')],{'firstName':_0x3bb3fe,'mobile':_0x3bb3fe,'phone':_0x3bb3fe,'ListId':_0x2c61b8[_0x624c('0x94')]}));}})['then'](handleEntityNotFound(_0x58ff28,null))['then'](function(_0x5c99e7){if(_0x5c99e7){_0x1a52d6=_0x5c99e7;return db[_0x624c('0xa8')][_0x624c('0x64')]({'where':{'ContactId':_0x1a52d6['id'],'closed':![],'WhatsappAccountId':_0x2c61b8['id']}})['then'](function(_0x3fa565){if(_0x3fa565){return[_0x3fa565,![]];}return db[_0x624c('0xa8')][_0x624c('0x60')]({'UserId':_0xbcc8ed['user']['id'],'ContactId':_0x1a52d6['id'],'WhatsappAccountId':_0x2c61b8['id'],'phone':_0x3bb3fe,'firstMsgDirection':_0x624c('0xbd'),'Messages':[_['merge'](_0xbcc8ed[_0x624c('0x61')],{'read':![],'body':_0xbcc8ed['body'][_0x624c('0x61')],'phone':_0x3bb3fe,'WhatsappAccountId':_0x2c61b8['id'],'UserId':_0xbcc8ed['user']['id'],'ContactId':_0x1a52d6['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x624c('0x20')](function(_0x2ce4a7){return[_0x2ce4a7,!![]];});});}})[_0x624c('0x74')](function(_0x23ddf7,_0x4b0a50){if(_0x4b0a50){return _0x23ddf7;}return db[_0x624c('0x8a')][_0x624c('0x60')](_[_0x624c('0x56')](_0xbcc8ed[_0x624c('0x61')],{'read':![],'body':_0xbcc8ed[_0x624c('0x61')][_0x624c('0x61')],'phone':_0x3bb3fe,'WhatsappAccountId':_0x2c61b8['id'],'WhatsappInteractionId':_0x23ddf7['id'],'UserId':_0xbcc8ed[_0x624c('0x62')]['id'],'ContactId':_0x1a52d6['id']}))['then'](function(_0x4c01a8){_0x23ddf7['dataValues'][_0x624c('0xbe')]=[];_0x23ddf7[_0x624c('0xbf')][_0x624c('0xbe')][_0x624c('0xac')](_0x4c01a8[_0x624c('0xbf')]);return _0x23ddf7;});})[_0x624c('0x20')](respondWithResult(_0x58ff28,null))[_0x624c('0x2b')](handleError(_0x58ff28,null));}; \ No newline at end of file +var _0x4799=['merge','includeAll','findAll','rows','catch','show','params','mandatoryDispositionPause','keys','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','options','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','findOne','User','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','priority','finally','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','message_id','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','From','replace','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','CmContact','Contacts','DESC','list','omit','defaults','WhatsappInteraction','interaction','autoclose','applications','push','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./whatsappAccount.socket','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','sendStatus','stack','name','send','index','Pause','WhatsappAccount','fieldName','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter'];(function(_0x4b5097,_0x36df98){var _0xbd49ad=function(_0x43b0af){while(--_0x43b0af){_0x4b5097['push'](_0x4b5097['shift']());}};_0xbd49ad(++_0x36df98);}(_0x4799,0x6e));var _0x9479=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4799[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x9479('0x0'));var rimraf=require(_0x9479('0x1'));var zipdir=require(_0x9479('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9479('0x3'));var moment=require(_0x9479('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9479('0x5'));var util=require(_0x9479('0x6'));var path=require('path');var sox=require(_0x9479('0x7'));var csv=require('to-csv');var ejs=require(_0x9479('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9479('0x9'));var squel=require(_0x9479('0xa'));var crypto=require(_0x9479('0xb'));var jsforce=require(_0x9479('0xc'));var deskjs=require(_0x9479('0xd'));var toCsv=require(_0x9479('0xe'));var querystring=require(_0x9479('0xf'));var Papa=require(_0x9479('0x10'));var Redis=require('ioredis');var authService=require(_0x9479('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9479('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9479('0x13'))(_0x9479('0x14'));var utils=require(_0x9479('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9479('0x16'));var db=require(_0x9479('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x9479('0x18'),'port':0x18eb});var socket=require(_0x9479('0x19'))(new Redis(config[_0x9479('0x1a')]));require(_0x9479('0x1b'))['register'](socket);var jayson=require(_0x9479('0x1c'));var client=jayson['client'][_0x9479('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4ded00,_0x7f566c,_0x41e048,_0x56d068){return new BPromise(function(_0x3bf48a,_0x12e984){var _0x20428e=_0x56d068||client;return _0x20428e[_0x9479('0x1e')](_0x4ded00,_0x41e048)[_0x9479('0x1f')](function(_0x15696f){logger[_0x9479('0x20')](_0x9479('0x21'),_0x7f566c,'request\x20sent');logger[_0x9479('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x7f566c,_0x9479('0x23'),JSON[_0x9479('0x24')](_0x15696f));if(_0x15696f['error']){if(_0x15696f[_0x9479('0x25')][_0x9479('0x26')]===0x1f4){logger[_0x9479('0x25')](_0x9479('0x21'),_0x7f566c,_0x15696f[_0x9479('0x25')]['message']);return _0x12e984(_0x15696f['error'][_0x9479('0x27')]);}logger[_0x9479('0x25')](_0x9479('0x21'),_0x7f566c,_0x15696f[_0x9479('0x25')][_0x9479('0x27')]);return _0x3bf48a(_0x15696f['error'][_0x9479('0x27')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x7f566c,_0x9479('0x23'));_0x3bf48a(_0x15696f[_0x9479('0x28')][_0x9479('0x27')]);}})['catch'](function(_0x4e47b1){logger['error'](_0x9479('0x21'),_0x7f566c,_0x4e47b1);_0x12e984(_0x4e47b1);});});}function respondWithStatusCode(_0x13536d,_0x2d8cbe){_0x2d8cbe=_0x2d8cbe||0xcc;return function(_0x5255df){if(_0x5255df){return _0x13536d['sendStatus'](_0x2d8cbe);}return _0x13536d[_0x9479('0x29')](_0x2d8cbe)[_0x9479('0x2a')]();};}function respondWithResult(_0x446d6a,_0x57ac61){_0x57ac61=_0x57ac61||0xc8;return function(_0x222aed){if(_0x222aed){return _0x446d6a['status'](_0x57ac61)[_0x9479('0x2b')](_0x222aed);}};}function respondWithFilteredResult(_0x244834,_0x3cc02f){return function(_0x4a1cbb){if(_0x4a1cbb){var _0xcd2525=typeof _0x3cc02f[_0x9479('0x2c')]===_0x9479('0x2d')&&typeof _0x3cc02f['limit']===_0x9479('0x2d');var _0x58bf61=_0x4a1cbb[_0x9479('0x2e')];var _0x46252a=_0xcd2525?0x0:_0x3cc02f[_0x9479('0x2c')];var _0x1daec7=_0xcd2525?_0x4a1cbb[_0x9479('0x2e')]:_0x3cc02f[_0x9479('0x2c')]+_0x3cc02f[_0x9479('0x2f')];var _0x188694;if(_0x1daec7>=_0x58bf61){_0x1daec7=_0x58bf61;_0x188694=0xc8;}else{_0x188694=0xce;}_0x244834[_0x9479('0x29')](_0x188694);return _0x244834[_0x9479('0x30')](_0x9479('0x31'),_0x46252a+'-'+_0x1daec7+'/'+_0x58bf61)['json'](_0x4a1cbb);}return null;};}function patchUpdates(_0x4ed16c){return function(_0x2db55d){try{jsonpatch[_0x9479('0x32')](_0x2db55d,_0x4ed16c,!![]);}catch(_0x4dd099){return BPromise[_0x9479('0x33')](_0x4dd099);}return _0x2db55d[_0x9479('0x34')]();};}function saveUpdates(_0x3d2cfa,_0x11d224){return function(_0x4217c8){if(_0x4217c8){return _0x4217c8[_0x9479('0x35')](_0x3d2cfa)[_0x9479('0x1f')](function(_0x1ec6cc){return _0x1ec6cc;});}return null;};}function removeEntity(_0x9b845a,_0x2fa3fc){return function(_0x232188){if(_0x232188){return _0x232188[_0x9479('0x36')]()['then'](function(){var _0x2486b6=_0x232188[_0x9479('0x37')]({'plain':!![]});var _0x5e6c8d='WhatsappAccounts';return db['UserProfileResource'][_0x9479('0x36')]({'where':{'type':_0x5e6c8d,'resourceId':_0x2486b6['id']}})['then'](function(){return _0x232188;});})['then'](function(){_0x9b845a[_0x9479('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf8518a,_0xde4db7){return function(_0x50108f){if(!_0x50108f){_0xf8518a[_0x9479('0x38')](0x194);}return _0x50108f;};}function handleError(_0x415622,_0x2b6301){_0x2b6301=_0x2b6301||0x1f4;return function(_0x47b7e5){logger[_0x9479('0x25')](_0x47b7e5[_0x9479('0x39')]);if(_0x47b7e5[_0x9479('0x3a')]){delete _0x47b7e5['name'];}_0x415622[_0x9479('0x29')](_0x2b6301)[_0x9479('0x3b')](_0x47b7e5);};}exports[_0x9479('0x3c')]=function(_0x13c1f2,_0x1c5704){var _0x12826e={'include':[{'model':db[_0x9479('0x3d')],'as':'mandatoryDispositionPause'}]},_0x3906f2={},_0x2a544c={'count':0x0,'rows':[]};var _0x45f1a5=_['map'](db[_0x9479('0x3e')]['rawAttributes'],function(_0x29bacd){return{'name':_0x29bacd[_0x9479('0x3f')],'type':_0x29bacd[_0x9479('0x40')][_0x9479('0x41')]};});_0x3906f2[_0x9479('0x42')]=_[_0x9479('0x43')](_0x45f1a5,_0x9479('0x3a'));_0x3906f2[_0x9479('0x44')]=_['keys'](_0x13c1f2[_0x9479('0x44')]);_0x3906f2['filters']=_[_0x9479('0x45')](_0x3906f2[_0x9479('0x42')],_0x3906f2[_0x9479('0x44')]);_0x12826e[_0x9479('0x46')]=_[_0x9479('0x45')](_0x3906f2['model'],qs[_0x9479('0x47')](_0x13c1f2['query'][_0x9479('0x47')]));_0x12826e[_0x9479('0x46')]=_0x12826e[_0x9479('0x46')][_0x9479('0x48')]?_0x12826e[_0x9479('0x46')]:_0x3906f2['model'];if(!_0x13c1f2['query']['hasOwnProperty'](_0x9479('0x49'))){_0x12826e[_0x9479('0x2f')]=qs[_0x9479('0x2f')](_0x13c1f2[_0x9479('0x44')]['limit']);_0x12826e[_0x9479('0x2c')]=qs[_0x9479('0x2c')](_0x13c1f2[_0x9479('0x44')][_0x9479('0x2c')]);}_0x12826e[_0x9479('0x4a')]=qs[_0x9479('0x4b')](_0x13c1f2[_0x9479('0x44')]['sort']);_0x12826e[_0x9479('0x4c')]=qs[_0x9479('0x4d')](_[_0x9479('0x4e')](_0x13c1f2[_0x9479('0x44')],_0x3906f2[_0x9479('0x4d')]),_0x45f1a5);if(_0x13c1f2['query'][_0x9479('0x4f')]){_0x12826e[_0x9479('0x4c')]=_[_0x9479('0x50')](_0x12826e[_0x9479('0x4c')],{'$or':_[_0x9479('0x43')](_0x45f1a5,function(_0x3034f3){if(_0x3034f3[_0x9479('0x40')]!=='VIRTUAL'){var _0x224586={};_0x224586[_0x3034f3[_0x9479('0x3a')]]={'$like':'%'+_0x13c1f2[_0x9479('0x44')][_0x9479('0x4f')]+'%'};return _0x224586;}})});}_0x12826e=_[_0x9479('0x50')]({},_0x12826e,_0x13c1f2['options']);var _0x45c9b4={'where':_0x12826e['where']};return db['WhatsappAccount'][_0x9479('0x2e')](_0x45c9b4)[_0x9479('0x1f')](function(_0x2f885f){_0x2a544c[_0x9479('0x2e')]=_0x2f885f;if(_0x13c1f2[_0x9479('0x44')][_0x9479('0x51')]){_0x12826e['include']=[{'all':!![]}];}return db[_0x9479('0x3e')][_0x9479('0x52')](_0x12826e);})[_0x9479('0x1f')](function(_0x1d1ede){_0x2a544c[_0x9479('0x53')]=_0x1d1ede;return _0x2a544c;})[_0x9479('0x1f')](respondWithFilteredResult(_0x1c5704,_0x12826e))[_0x9479('0x54')](handleError(_0x1c5704,null));};exports[_0x9479('0x55')]=function(_0x5c7c98,_0x4ffc8d){var _0x3eeeb4={'raw':![],'where':{'id':_0x5c7c98[_0x9479('0x56')]['id']},'include':[{'model':db[_0x9479('0x3d')],'as':_0x9479('0x57')}]},_0x522747={};_0x522747[_0x9479('0x42')]=_[_0x9479('0x58')](db[_0x9479('0x3e')][_0x9479('0x59')]);_0x522747['query']=_['keys'](_0x5c7c98[_0x9479('0x44')]);_0x522747[_0x9479('0x4d')]=_[_0x9479('0x45')](_0x522747[_0x9479('0x42')],_0x522747[_0x9479('0x44')]);_0x3eeeb4[_0x9479('0x46')]=_[_0x9479('0x45')](_0x522747['model'],qs[_0x9479('0x47')](_0x5c7c98[_0x9479('0x44')][_0x9479('0x47')]));_0x3eeeb4[_0x9479('0x46')]=_0x3eeeb4['attributes'][_0x9479('0x48')]?_0x3eeeb4[_0x9479('0x46')]:_0x522747[_0x9479('0x42')];if(_0x5c7c98[_0x9479('0x44')][_0x9479('0x51')]){_0x3eeeb4[_0x9479('0x5a')]=[{'all':!![]}];}_0x3eeeb4=_[_0x9479('0x50')]({},_0x3eeeb4,_0x5c7c98['options']);return db[_0x9479('0x3e')][_0x9479('0x5b')](_0x3eeeb4)[_0x9479('0x1f')](handleEntityNotFound(_0x4ffc8d,null))['then'](respondWithResult(_0x4ffc8d,null))[_0x9479('0x54')](handleError(_0x4ffc8d,null));};exports[_0x9479('0x5c')]=function(_0x552390,_0x3e0fdf){return db[_0x9479('0x3e')][_0x9479('0x5c')](_0x552390['body'],{})[_0x9479('0x1f')](function(_0x1dbd59){var _0x26ef14=_0x552390[_0x9479('0x5d')][_0x9479('0x37')]({'plain':!![]});if(!_0x26ef14)throw new Error(_0x9479('0x5e'));if(_0x26ef14['role']===_0x9479('0x5d')){var _0x3704b7=_0x1dbd59[_0x9479('0x37')]({'plain':!![]});var _0x316c90=_0x9479('0x5f');return db[_0x9479('0x60')][_0x9479('0x5b')]({'where':{'name':_0x316c90,'userProfileId':_0x26ef14[_0x9479('0x61')]},'raw':!![]})[_0x9479('0x1f')](function(_0xd2b125){if(_0xd2b125&&_0xd2b125[_0x9479('0x62')]===0x0){return db['UserProfileResource'][_0x9479('0x5c')]({'name':_0x3704b7[_0x9479('0x3a')],'resourceId':_0x3704b7['id'],'type':_0xd2b125['name'],'sectionId':_0xd2b125['id']},{})[_0x9479('0x1f')](function(){return _0x1dbd59;});}else{return _0x1dbd59;}})[_0x9479('0x54')](function(_0x511263){logger['error'](_0x9479('0x63'),_0x511263);throw _0x511263;});}return _0x1dbd59;})[_0x9479('0x1f')](respondWithResult(_0x3e0fdf,0xc9))[_0x9479('0x54')](handleError(_0x3e0fdf,null));};exports[_0x9479('0x35')]=function(_0x413f5e,_0x212658){if(_0x413f5e[_0x9479('0x64')]['id']){delete _0x413f5e['body']['id'];}return db[_0x9479('0x3e')]['find']({'where':{'id':_0x413f5e[_0x9479('0x56')]['id']},'include':[{'model':db[_0x9479('0x3d')],'as':_0x9479('0x57')}]})['then'](handleEntityNotFound(_0x212658,null))['then'](saveUpdates(_0x413f5e[_0x9479('0x64')],null))[_0x9479('0x1f')](respondWithResult(_0x212658,null))[_0x9479('0x54')](handleError(_0x212658,null));};exports['destroy']=function(_0x12fdb8,_0x1bbff2){return db[_0x9479('0x3e')][_0x9479('0x5b')]({'where':{'id':_0x12fdb8[_0x9479('0x56')]['id']}})[_0x9479('0x1f')](handleEntityNotFound(_0x1bbff2,null))[_0x9479('0x1f')](removeEntity(_0x1bbff2,null))[_0x9479('0x54')](handleError(_0x1bbff2,null));};exports[_0x9479('0x65')]=function(_0x50084e,_0x28012f){return db[_0x9479('0x3e')][_0x9479('0x65')]()[_0x9479('0x1f')](respondWithResult(_0x28012f,null))[_0x9479('0x54')](handleError(_0x28012f,null));};exports[_0x9479('0x66')]=function(_0x3040ee,_0x127c08,_0x398ea2){if(_0x3040ee['body']['id']){delete _0x3040ee[_0x9479('0x64')]['id'];}return db[_0x9479('0x3e')]['find']({'where':{'id':_0x3040ee[_0x9479('0x56')]['id']}})[_0x9479('0x1f')](handleEntityNotFound(_0x127c08,null))[_0x9479('0x1f')](function(_0x1ffd3a){if(_0x1ffd3a){_0x3040ee[_0x9479('0x64')][_0x9479('0x67')]=_0x1ffd3a['id'];return db[_0x9479('0x68')][_0x9479('0x5c')](_0x3040ee['body']);}})[_0x9479('0x1f')](respondWithResult(_0x127c08,null))[_0x9479('0x54')](handleError(_0x127c08,null));};exports[_0x9479('0x69')]=function(_0x1bcf95,_0x15b26e,_0x32f505){var _0x569d3d={'raw':![],'where':{}};var _0x32d8a2={};var _0x777ec1={'count':0x0,'rows':[]};return db[_0x9479('0x3e')]['findOne']({'where':{'id':_0x1bcf95[_0x9479('0x56')]['id']}})[_0x9479('0x1f')](handleEntityNotFound(_0x15b26e,null))['then'](function(_0x2e7db2){if(_0x2e7db2){_0x32d8a2[_0x9479('0x42')]=_[_0x9479('0x58')](db[_0x9479('0x68')][_0x9479('0x59')]);_0x32d8a2[_0x9479('0x44')]=_['keys'](_0x1bcf95[_0x9479('0x44')]);_0x32d8a2['filters']=_[_0x9479('0x45')](_0x32d8a2[_0x9479('0x42')],_0x32d8a2[_0x9479('0x44')]);_0x569d3d[_0x9479('0x46')]=_[_0x9479('0x45')](_0x32d8a2['model'],qs['fields'](_0x1bcf95[_0x9479('0x44')][_0x9479('0x47')]));_0x569d3d['attributes']=_0x569d3d[_0x9479('0x46')]['length']?_0x569d3d[_0x9479('0x46')]:_0x32d8a2[_0x9479('0x42')];if(!_0x1bcf95[_0x9479('0x44')][_0x9479('0x6a')]('nolimit')){_0x569d3d['limit']=qs['limit'](_0x1bcf95['query']['limit']);_0x569d3d['offset']=qs[_0x9479('0x2c')](_0x1bcf95[_0x9479('0x44')]['offset']);}_0x569d3d[_0x9479('0x4a')]=qs[_0x9479('0x4b')](_0x1bcf95['query']['sort']);_0x569d3d[_0x9479('0x4c')]=qs[_0x9479('0x4d')](_[_0x9479('0x4e')](_0x1bcf95[_0x9479('0x44')],_0x32d8a2['filters']));_0x569d3d[_0x9479('0x4c')][_0x9479('0x67')]=_0x2e7db2['id'];if(_0x1bcf95['query'][_0x9479('0x4f')]){_0x569d3d[_0x9479('0x4c')]=_[_0x9479('0x50')](_0x569d3d[_0x9479('0x4c')],{'$or':_[_0x9479('0x43')](_0x569d3d[_0x9479('0x46')],function(_0x42b95d){var _0x50c66d={};_0x50c66d[_0x42b95d]={'$like':'%'+_0x1bcf95[_0x9479('0x44')][_0x9479('0x4f')]+'%'};return _0x50c66d;})});}_0x569d3d=_['merge']({},_0x569d3d,_0x1bcf95[_0x9479('0x6b')]);return db[_0x9479('0x68')]['count']({'where':_0x569d3d[_0x9479('0x4c')]})[_0x9479('0x1f')](function(_0x3fac22){_0x777ec1[_0x9479('0x2e')]=_0x3fac22;if(_0x1bcf95['query'][_0x9479('0x51')]){_0x569d3d['include']=[{'all':!![]}];}return db['Disposition'][_0x9479('0x52')](_0x569d3d);})[_0x9479('0x1f')](function(_0x41fbff){_0x777ec1[_0x9479('0x53')]=_0x41fbff;return _0x777ec1;});}})[_0x9479('0x1f')](respondWithFilteredResult(_0x15b26e,_0x569d3d))[_0x9479('0x54')](handleError(_0x15b26e,null));};exports[_0x9479('0x6c')]=function(_0x25379e,_0x1e8395,_0x48e163){return db[_0x9479('0x3e')][_0x9479('0x5b')]({'where':{'id':_0x25379e[_0x9479('0x56')]['id']}})['then'](handleEntityNotFound(_0x1e8395,null))[_0x9479('0x1f')](function(_0x3f4bc7){if(_0x3f4bc7){return _0x3f4bc7[_0x9479('0x6c')](_0x25379e[_0x9479('0x44')]['ids']);}})[_0x9479('0x1f')](respondWithStatusCode(_0x1e8395,null))[_0x9479('0x54')](handleError(_0x1e8395,null));};exports[_0x9479('0x6d')]=function(_0x5863e4,_0x16cbf2,_0x494d84){if(_0x5863e4[_0x9479('0x64')]['id']){delete _0x5863e4['body']['id'];}return db[_0x9479('0x3e')][_0x9479('0x5b')]({'where':{'id':_0x5863e4[_0x9479('0x56')]['id']}})[_0x9479('0x1f')](handleEntityNotFound(_0x16cbf2,null))[_0x9479('0x1f')](function(_0x4b53ab){if(_0x4b53ab){_0x5863e4[_0x9479('0x64')][_0x9479('0x67')]=_0x4b53ab['id'];return db[_0x9479('0x6e')][_0x9479('0x5c')](_0x5863e4['body']);}})[_0x9479('0x1f')](respondWithResult(_0x16cbf2,null))['catch'](handleError(_0x16cbf2,null));};exports[_0x9479('0x6f')]=function(_0x5b256d,_0x360eb6,_0x2ea042){var _0x9bcbc8={'raw':![],'where':{}};var _0x1f004b={};var _0x14d4fa={'count':0x0,'rows':[]};return db[_0x9479('0x3e')]['findOne']({'where':{'id':_0x5b256d[_0x9479('0x56')]['id']}})[_0x9479('0x1f')](handleEntityNotFound(_0x360eb6,null))[_0x9479('0x1f')](function(_0x215f82){if(_0x215f82){_0x1f004b['model']=_[_0x9479('0x58')](db[_0x9479('0x6e')]['rawAttributes']);_0x1f004b[_0x9479('0x44')]=_[_0x9479('0x58')](_0x5b256d[_0x9479('0x44')]);_0x1f004b[_0x9479('0x4d')]=_[_0x9479('0x45')](_0x1f004b['model'],_0x1f004b['query']);_0x9bcbc8['attributes']=_[_0x9479('0x45')](_0x1f004b[_0x9479('0x42')],qs[_0x9479('0x47')](_0x5b256d['query'][_0x9479('0x47')]));_0x9bcbc8[_0x9479('0x46')]=_0x9bcbc8[_0x9479('0x46')][_0x9479('0x48')]?_0x9bcbc8[_0x9479('0x46')]:_0x1f004b[_0x9479('0x42')];if(!_0x5b256d['query'][_0x9479('0x6a')](_0x9479('0x49'))){_0x9bcbc8[_0x9479('0x2f')]=qs[_0x9479('0x2f')](_0x5b256d[_0x9479('0x44')]['limit']);_0x9bcbc8['offset']=qs[_0x9479('0x2c')](_0x5b256d[_0x9479('0x44')][_0x9479('0x2c')]);}_0x9bcbc8[_0x9479('0x4a')]=qs[_0x9479('0x4b')](_0x5b256d[_0x9479('0x44')][_0x9479('0x4b')]);_0x9bcbc8[_0x9479('0x4c')]=qs['filters'](_[_0x9479('0x4e')](_0x5b256d[_0x9479('0x44')],_0x1f004b[_0x9479('0x4d')]));_0x9bcbc8[_0x9479('0x4c')][_0x9479('0x67')]=_0x215f82['id'];if(_0x5b256d[_0x9479('0x44')]['filter']){_0x9bcbc8[_0x9479('0x4c')]=_['merge'](_0x9bcbc8[_0x9479('0x4c')],{'$or':_[_0x9479('0x43')](_0x9bcbc8[_0x9479('0x46')],function(_0x29ed81){var _0x2471c6={};_0x2471c6[_0x29ed81]={'$like':'%'+_0x5b256d['query']['filter']+'%'};return _0x2471c6;})});}_0x9bcbc8=_[_0x9479('0x50')]({},_0x9bcbc8,_0x5b256d[_0x9479('0x6b')]);return db[_0x9479('0x6e')][_0x9479('0x2e')]({'where':_0x9bcbc8[_0x9479('0x4c')]})[_0x9479('0x1f')](function(_0x36d8a6){_0x14d4fa['count']=_0x36d8a6;if(_0x5b256d[_0x9479('0x44')][_0x9479('0x51')]){_0x9bcbc8[_0x9479('0x5a')]=[{'all':!![]}];}return db[_0x9479('0x6e')][_0x9479('0x52')](_0x9bcbc8);})[_0x9479('0x1f')](function(_0x268187){_0x14d4fa['rows']=_0x268187;return _0x14d4fa;});}})[_0x9479('0x1f')](respondWithFilteredResult(_0x360eb6,_0x9bcbc8))[_0x9479('0x54')](handleError(_0x360eb6,null));};exports[_0x9479('0x70')]=function(_0x48ee3e,_0x446e94,_0x1737d4){return db[_0x9479('0x3e')][_0x9479('0x5b')]({'where':{'id':_0x48ee3e[_0x9479('0x56')]['id']}})[_0x9479('0x1f')](handleEntityNotFound(_0x446e94,null))['then'](function(_0x5c06a3){if(_0x5c06a3){return _0x5c06a3[_0x9479('0x70')](_0x48ee3e[_0x9479('0x44')][_0x9479('0x71')]);}})[_0x9479('0x1f')](respondWithStatusCode(_0x446e94,null))[_0x9479('0x54')](handleError(_0x446e94,null));};exports['addAgents']=function(_0x1695e1,_0x1c2fda,_0x58cad5){return db[_0x9479('0x3e')][_0x9479('0x5b')]({'where':{'id':_0x1695e1[_0x9479('0x56')]['id']}})[_0x9479('0x1f')](handleEntityNotFound(_0x1c2fda,null))[_0x9479('0x1f')](function(_0x2bbb94){if(_0x2bbb94){return _0x2bbb94[_0x9479('0x72')](_0x1695e1[_0x9479('0x64')]['ids'],_['omit'](_0x1695e1[_0x9479('0x64')],[_0x9479('0x71'),'id'])||{})[_0x9479('0x73')](function(_0x33ff10){for(var _0x421de2=0x0;_0x421de2<_0x1695e1[_0x9479('0x64')][_0x9479('0x71')]['length'];_0x421de2+=0x1){socket[_0x9479('0x74')](_0x9479('0x75'),{'UserId':Number(_0x1695e1[_0x9479('0x64')][_0x9479('0x71')][_0x421de2]),'WhatsappAccountId':Number(_0x1695e1['params']['id'])});}return _0x33ff10;});}})[_0x9479('0x1f')](respondWithResult(_0x1c2fda,null))['catch'](handleError(_0x1c2fda,null));};exports[_0x9479('0x76')]=function(_0x61b7e6,_0x205eaf,_0x93308){return db[_0x9479('0x3e')][_0x9479('0x5b')]({'where':{'id':_0x61b7e6[_0x9479('0x56')]['id']}})[_0x9479('0x1f')](handleEntityNotFound(_0x205eaf,null))[_0x9479('0x1f')](function(_0x137356){if(_0x137356){return _0x137356[_0x9479('0x76')](_0x61b7e6[_0x9479('0x44')][_0x9479('0x71')])[_0x9479('0x1f')](function(){if(_[_0x9479('0x77')](_0x61b7e6[_0x9479('0x44')][_0x9479('0x71')])){for(var _0x14b389=0x0;_0x14b389<_0x61b7e6['query'][_0x9479('0x71')][_0x9479('0x48')];_0x14b389+=0x1){socket[_0x9479('0x74')](_0x9479('0x78'),{'UserId':Number(_0x61b7e6[_0x9479('0x44')][_0x9479('0x71')][_0x14b389]),'WhatsappAccountId':Number(_0x61b7e6[_0x9479('0x56')]['id'])});}}else{socket[_0x9479('0x74')](_0x9479('0x78'),{'UserId':Number(_0x61b7e6[_0x9479('0x44')][_0x9479('0x71')]),'WhatsappAccountId':Number(_0x61b7e6[_0x9479('0x56')]['id'])});}});}})[_0x9479('0x1f')](respondWithStatusCode(_0x205eaf,null))['catch'](handleError(_0x205eaf,null));};exports[_0x9479('0x79')]=function(_0x2f1b5d,_0x1bf4ff,_0x3eee37){var _0x5d7289={};var _0x2ec1c6={};var _0x4cce98;var _0x3a4243;return db[_0x9479('0x3e')][_0x9479('0x7a')]({'where':{'id':_0x2f1b5d[_0x9479('0x56')]['id']}})[_0x9479('0x1f')](handleEntityNotFound(_0x1bf4ff,null))[_0x9479('0x1f')](function(_0x12cda5){if(_0x12cda5){_0x4cce98=_0x12cda5;_0x2ec1c6['model']=_[_0x9479('0x58')](db[_0x9479('0x7b')][_0x9479('0x59')]);_0x2ec1c6['query']=_[_0x9479('0x58')](_0x2f1b5d[_0x9479('0x44')]);_0x2ec1c6[_0x9479('0x4d')]=_['intersection'](_0x2ec1c6[_0x9479('0x42')],_0x2ec1c6['query']);_0x5d7289[_0x9479('0x46')]=_[_0x9479('0x45')](_0x2ec1c6[_0x9479('0x42')],qs[_0x9479('0x47')](_0x2f1b5d['query'][_0x9479('0x47')]));_0x5d7289[_0x9479('0x46')]=_0x5d7289['attributes']['length']?_0x5d7289[_0x9479('0x46')]:_0x2ec1c6['model'];_0x5d7289[_0x9479('0x4a')]=qs[_0x9479('0x4b')](_0x2f1b5d[_0x9479('0x44')][_0x9479('0x4b')]);_0x5d7289[_0x9479('0x4c')]=qs[_0x9479('0x4d')](_[_0x9479('0x4e')](_0x2f1b5d['query'],_0x2ec1c6[_0x9479('0x4d')]));if(_0x2f1b5d[_0x9479('0x44')][_0x9479('0x4f')]){_0x5d7289[_0x9479('0x4c')]=_['merge'](_0x5d7289[_0x9479('0x4c')],{'$or':_[_0x9479('0x43')](_0x5d7289[_0x9479('0x46')],function(_0xd2ca22){var _0x543cbc={};_0x543cbc[_0xd2ca22]={'$like':'%'+_0x2f1b5d[_0x9479('0x44')]['filter']+'%'};return _0x543cbc;})});}_0x5d7289=_[_0x9479('0x50')]({},_0x5d7289,_0x2f1b5d[_0x9479('0x6b')]);return _0x4cce98[_0x9479('0x79')](_0x5d7289);}})[_0x9479('0x1f')](function(_0xdd84f1){if(_0xdd84f1){_0x3a4243=_0xdd84f1[_0x9479('0x48')];if(!_0x2f1b5d[_0x9479('0x44')]['hasOwnProperty']('nolimit')){_0x5d7289['limit']=qs[_0x9479('0x2f')](_0x2f1b5d[_0x9479('0x44')][_0x9479('0x2f')]);_0x5d7289[_0x9479('0x2c')]=qs[_0x9479('0x2c')](_0x2f1b5d[_0x9479('0x44')][_0x9479('0x2c')]);}return _0x4cce98['getAgents'](_0x5d7289);}})['then'](function(_0x447f09){if(_0x447f09){return _0x447f09?{'count':_0x3a4243,'rows':_0x447f09}:null;}})[_0x9479('0x1f')](respondWithResult(_0x1bf4ff,null))['catch'](handleError(_0x1bf4ff,null));};exports[_0x9479('0x7c')]=function(_0x9ff95,_0x224454){var _0x57cce6=_0x9ff95[_0x9479('0x56')]['id'];var _0x3872ab=_0x9ff95[_0x9479('0x64')];var _0x184ce3=0xc8;var _0x225402=null;return db[_0x9479('0x7d')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x9479('0x7e')][_0x9479('0x7f')]},function(_0x2feccc){return db[_0x9479('0x3e')]['findOne']({'where':{'id':_0x57cce6},'transaction':_0x2feccc})[_0x9479('0x1f')](function(_0x31f389){if(_0x31f389){return db[_0x9479('0x80')][_0x9479('0x36')]({'where':{'WhatsappAccountId':_0x57cce6},'transaction':_0x2feccc})[_0x9479('0x1f')](function(){var _0x30780e=_['map'](_0x3872ab,function(_0x2efbad){_0x2efbad[_0x9479('0x67')]=_0x57cce6;return _0x2efbad;});return db[_0x9479('0x80')]['bulkCreate'](_0x30780e,{'transaction':_0x2feccc});});}else{_0x184ce3=0x194;_0x225402=[];}});})[_0x9479('0x1f')](function(){if(_0x184ce3!==0x194){return db[_0x9479('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x57cce6},'order':_0x9479('0x81')})['then'](function(_0x4e91d6){_0x225402=_0x4e91d6;});}})[_0x9479('0x54')](function(_0x125059){_0x184ce3=0x1f4;logger[_0x9479('0x25')](_0x125059[_0x9479('0x39')]);if(_0x125059['name']){delete _0x125059[_0x9479('0x3a')];}_0x225402=_0x125059;})[_0x9479('0x82')](function(){if(_0x225402===null){_0x224454['sendStatus'](_0x184ce3);}else{if(_0x184ce3===0x1f4){_0x224454[_0x9479('0x29')](_0x184ce3)[_0x9479('0x3b')](_0x225402);}else{_0x224454[_0x9479('0x29')](_0x184ce3)[_0x9479('0x2b')](_0x225402);}}});};exports[_0x9479('0x83')]=function(_0x360c28,_0x3ccd7e,_0x503f7c){var _0x1d2483={};var _0x2bf749={};var _0x55bd26;var _0x24290f;return db[_0x9479('0x3e')][_0x9479('0x7a')]({'where':{'id':_0x360c28[_0x9479('0x56')]['id']}})['then'](handleEntityNotFound(_0x3ccd7e,null))[_0x9479('0x1f')](function(_0x4b3ff9){if(_0x4b3ff9){_0x55bd26=_0x4b3ff9;_0x2bf749[_0x9479('0x42')]=_[_0x9479('0x58')](db[_0x9479('0x80')][_0x9479('0x59')]);_0x2bf749[_0x9479('0x44')]=_[_0x9479('0x58')](_0x360c28[_0x9479('0x44')]);_0x2bf749[_0x9479('0x4d')]=_[_0x9479('0x45')](_0x2bf749[_0x9479('0x42')],_0x2bf749[_0x9479('0x44')]);_0x1d2483[_0x9479('0x46')]=_['intersection'](_0x2bf749[_0x9479('0x42')],qs[_0x9479('0x47')](_0x360c28[_0x9479('0x44')][_0x9479('0x47')]));_0x1d2483[_0x9479('0x46')]=_0x1d2483[_0x9479('0x46')][_0x9479('0x48')]?_0x1d2483[_0x9479('0x46')]:_0x2bf749[_0x9479('0x42')];_0x1d2483['order']=qs[_0x9479('0x4b')](_0x360c28['query'][_0x9479('0x4b')]);_0x1d2483[_0x9479('0x4c')]=qs['filters'](_[_0x9479('0x4e')](_0x360c28['query'],_0x2bf749[_0x9479('0x4d')]));if(_0x360c28[_0x9479('0x44')][_0x9479('0x4f')]){_0x1d2483['where']=_['merge'](_0x1d2483[_0x9479('0x4c')],{'$or':_[_0x9479('0x43')](_0x1d2483['attributes'],function(_0x2501d7){var _0x18081e={};_0x18081e[_0x2501d7]={'$like':'%'+_0x360c28['query'][_0x9479('0x4f')]+'%'};return _0x18081e;})});}_0x1d2483=_[_0x9479('0x50')]({},_0x1d2483,_0x360c28[_0x9479('0x6b')]);return _0x55bd26['getApplications'](_0x1d2483);}})[_0x9479('0x1f')](function(_0x2b6637){if(_0x2b6637){_0x24290f=_0x2b6637[_0x9479('0x48')];if(!_0x360c28['query']['hasOwnProperty'](_0x9479('0x49'))){_0x1d2483[_0x9479('0x2f')]=qs[_0x9479('0x2f')](_0x360c28[_0x9479('0x44')][_0x9479('0x2f')]);_0x1d2483[_0x9479('0x2c')]=qs['offset'](_0x360c28['query'][_0x9479('0x2c')]);}return _0x55bd26[_0x9479('0x83')](_0x1d2483);}})[_0x9479('0x1f')](function(_0x7edec8){if(_0x7edec8){return _0x7edec8?{'count':_0x24290f,'rows':_0x7edec8}:null;}})['then'](respondWithResult(_0x3ccd7e,null))[_0x9479('0x54')](handleError(_0x3ccd7e,null));};exports['notify']=function(_0x2dfc1b,_0x41a41d,_0x2ef38c){var _0x2e7943={'channel':_0x9479('0x84')};var _0x3908ab=[];var _0x1c5cd2=[];var _0x54964d={};return db['WhatsappAccount'][_0x9479('0x5b')]({'where':{'id':_0x2dfc1b['params']['id']},'include':[{'model':db[_0x9479('0x80')],'as':_0x9479('0x85')}]})[_0x9479('0x1f')](handleEntityNotFound(_0x41a41d,null))['then'](function(_0x142259){_0x2e7943[_0x9479('0x86')]=_0x142259;if(_0x2e7943[_0x9479('0x86')]&&_0x2e7943[_0x9479('0x86')][_0x9479('0x40')]===_0x9479('0x87')&&_0x2dfc1b[_0x9479('0x64')][_0x9479('0x88')]){if(_0x2dfc1b['body']['statuses'][_0x9479('0x48')]===0x0)return;if(_0x2dfc1b[_0x9479('0x64')][_0x9479('0x88')][0x0][_0x9479('0x89')]!==_0x9479('0x8a'))return;return db['WhatsappMessage'][_0x9479('0x35')]({'read':!![],'readAt':_0x2dfc1b[_0x9479('0x64')][_0x9479('0x88')][0x0][_0x9479('0x8b')]},{'where':{'messageId':_0x2dfc1b[_0x9479('0x64')][_0x9479('0x88')][0x0][_0x9479('0x8c')]},'individualHooks':!![]})['then'](function(_0x13e149){return _0x41a41d[_0x9479('0x29')](0xc8)[_0x9479('0x2b')](_0x13e149);});}_0x2e7943['applications']=_[_0x9479('0x8d')](_0x142259[_0x9479('0x85')],['priority'],['asc']);if(_0x2e7943[_0x9479('0x86')]['Applications']){delete _0x2e7943[_0x9479('0x86')][_0x9479('0x85')];}return db['CmContact'][_0x9479('0x65')]()['then'](function(_0x5e55f4){if(!_0x5e55f4){throw new db[(_0x9479('0x8e'))][(_0x9479('0x8f'))](_0x9479('0x90'));}_0x3908ab=_[_0x9479('0x91')](_['keys'](_0x5e55f4),[_0x9479('0x92'),_0x9479('0x93')]);_0x1c5cd2=_[_0x9479('0x91')](_[_0x9479('0x58')](_0x5e55f4),['createdAt',_0x9479('0x93'),'CompanyId',_0x9479('0x94')]);_0x2e7943[_0x9479('0x64')]={'mapKey':'mobile'};if(_0x2e7943[_0x9479('0x86')]&&_0x2e7943[_0x9479('0x86')]['type']===_0x9479('0x95')){_0x2e7943['body'][_0x9479('0x96')]=_0x2dfc1b[_0x9479('0x64')][_0x9479('0x97')][_0x9479('0x98')]('whatsapp:','');_0x2e7943[_0x9479('0x64')][_0x9479('0x64')]=_0x2dfc1b[_0x9479('0x64')]['Body'];_0x2e7943[_0x9479('0x64')][_0x9479('0x99')]=_0x2dfc1b[_0x9479('0x64')]['MessageSid'];}if(_0x2e7943[_0x9479('0x86')]&&_0x2e7943[_0x9479('0x86')][_0x9479('0x40')]===_0x9479('0x87')){_0x2e7943[_0x9479('0x64')][_0x9479('0x96')]=_0x2dfc1b[_0x9479('0x64')]['notifications'][0x0][_0x9479('0x96')];_0x2e7943[_0x9479('0x64')]['body']=_0x2dfc1b['body']['notifications'][0x0][_0x9479('0x27')][_0x9479('0x64')];_0x2e7943[_0x9479('0x64')]['messageId']=_0x2dfc1b[_0x9479('0x64')][_0x9479('0x9a')][0x0]['message_id'];}if(_0x2e7943[_0x9479('0x64')]['id']){delete _0x2e7943[_0x9479('0x64')]['id'];}if(_[_0x9479('0x9b')](_0x2e7943[_0x9479('0x64')]['from'])){throw new db[(_0x9479('0x8e'))][(_0x9479('0x8f'))]('from\x20is\x20mandatory');}if(_[_0x9479('0x9b')](_0x2e7943[_0x9479('0x64')][_0x9479('0x64')])||_0x2e7943['body'][_0x9479('0x64')]===''){throw new db['Sequelize'][(_0x9479('0x8f'))](_0x9479('0x9c'));}if(_[_0x9479('0x9b')](_0x2e7943['body'][_0x9479('0x9d')])){throw new db[(_0x9479('0x8e'))][(_0x9479('0x8f'))](_0x9479('0x9e')+_0x1c5cd2);}if(!_[_0x9479('0x9f')](_0x1c5cd2,_0x2e7943['body'][_0x9479('0x9d')])){throw new db[(_0x9479('0x8e'))][(_0x9479('0x8f'))](_0x9479('0xa0')+_0x1c5cd2);}_0x54964d[_0x2e7943[_0x9479('0x64')][_0x9479('0x9d')]]=_0x2e7943[_0x9479('0x64')][_0x9479('0x96')];return db[_0x9479('0xa1')][_0x9479('0x5b')]({'where':{'id':_0x2e7943[_0x9479('0x86')][_0x9479('0x94')]},'include':[{'model':db[_0x9479('0xa2')],'as':_0x9479('0xa3'),'where':_0x54964d,'limit':0x1,'order':[[_0x9479('0x93'),_0x9479('0xa4')]]}]});})[_0x9479('0x1f')](handleEntityNotFound(_0x41a41d,null))[_0x9479('0x1f')](function(_0x1e0e76){if(_0x1e0e76){_0x2e7943[_0x9479('0xa5')]=_[_0x9479('0xa6')](_0x1e0e76,[_0x9479('0xa3')]);if(_0x1e0e76['Contacts'][_0x9479('0x48')]){return _0x1e0e76[_0x9479('0xa3')][0x0];}var _0x1babe4=_[_0x9479('0xa7')](_0x2e7943['body'],{'firstName':_0x2e7943[_0x9479('0x64')][_0x9479('0x96')],'ListId':_0x1e0e76['id']});_0x1babe4[_0x2e7943[_0x9479('0x64')][_0x9479('0x9d')]]=_0x2e7943[_0x9479('0x64')][_0x9479('0x96')];return db['CmContact']['create'](_0x1babe4,{'fields':_0x3908ab,'raw':!![]});}})['then'](handleEntityNotFound(_0x41a41d,null))[_0x9479('0x1f')](function(_0x3a9b2c){if(_0x3a9b2c){_0x2e7943['contact']=_0x3a9b2c;var _0x113d20={'ContactId':_0x3a9b2c['id'],'phone':_0x2e7943[_0x9479('0x64')][_0x9479('0x96')],'WhatsappAccountId':_0x2dfc1b[_0x9479('0x56')]['id']};var _0x440fd1={'ContactId':_0x3a9b2c['id'],'WhatsappAccountId':_0x2dfc1b[_0x9479('0x56')]['id'],'closed':![]};return db[_0x9479('0xa8')][_0x9479('0x5b')]({'where':_0x440fd1})[_0x9479('0x1f')](function(_0x1bf759){if(_0x1bf759){return[_0x1bf759,![]];}return db[_0x9479('0xa8')]['create'](_0x113d20)['then'](function(_0x5a0f65){return[_0x5a0f65,!![]];});});}})[_0x9479('0x73')](function(_0x38a001,_0x3031b3){_0x2e7943['interaction']=_0x38a001['get']({'plain':!![]});_0x2e7943[_0x9479('0xa9')]['created']=![];if(_0x3031b3){if(_0x2e7943['account'][_0x9479('0xaa')]){_0x2e7943[_0x9479('0xab')][_0x9479('0xac')]({'id':0x0,'priority':_0x2e7943[_0x9479('0xab')][_0x9479('0x48')]+0x1,'app':'close','appdata':_0x9479('0xad'),'interval':_0x9479('0xae')});}_0x2e7943['interaction']['created']=!![];}return db[_0x9479('0xaf')][_0x9479('0x5c')]({'phone':_0x2e7943['body'][_0x9479('0x96')],'messageId':_0x2e7943[_0x9479('0x64')][_0x9479('0x99')],'body':_0x2e7943[_0x9479('0x64')]['body'],'WhatsappAccountId':_0x2dfc1b[_0x9479('0x56')]['id'],'WhatsappInteractionId':_0x38a001['id'],'direction':'in','ContactId':_0x38a001[_0x9479('0xb0')],'AttachmentId':_0x2e7943['body'][_0x9479('0xb1')]});})[_0x9479('0x1f')](function(_0x327f9c){_0x2e7943[_0x9479('0x27')]=_0x327f9c;if(_0x2e7943[_0x9479('0xa9')]['UserId']){return db[_0x9479('0x7b')]['find']({'attributes':['id',_0x9479('0x3a')],'where':{'id':_0x2e7943[_0x9479('0xa9')][_0x9479('0xb2')]}})[_0x9479('0x1f')](function(_0x4e6f01){if(_0x4e6f01){_0x2e7943[_0x9479('0xab')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9479('0xb3'),'appdata':_0x4e6f01[_0x9479('0x3a')]+','+(_0x2e7943[_0x9479('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0x9479('0xae')});}return respondWithRpcPromise(_0x9479('0xb4'),_0x9479('0xb5'),_0x2e7943);});}return respondWithRpcPromise('Start',_0x9479('0xb5'),_0x2e7943);})['then'](function(_0x33aade){if(_0x33aade){var _0x2bab1f=0xc8;var _0x27d857=_0x9479('0xb6');logger[_0x9479('0x20')](_0x9479('0xb7'),_0x27d857,_0x2bab1f,'entity\x20found');logger['debug'](_0x9479('0xb8'),_0x27d857,_0x2bab1f,'entity\x20found',JSON[_0x9479('0x24')](_0x33aade));if(_0x2e7943[_0x9479('0x86')][_0x9479('0x40')]===_0x9479('0x95')){return _0x41a41d[_0x9479('0x29')](_0x2bab1f)[_0x9479('0x30')]('Content-Type',_0x9479('0xb9'))[_0x9479('0x3b')]('\x0a');}else{return _0x41a41d[_0x9479('0x29')](_0x2bab1f)[_0x9479('0x2b')](_0x33aade);}}});})[_0x9479('0x54')](handleError(_0x41a41d,null));};exports[_0x9479('0x3b')]=function(_0x119867,_0x56ccc4,_0x4b07c9){var _0x51a429,_0x5dab24,_0x313fce;if(_[_0x9479('0x9b')](_0x119867[_0x9479('0x64')][_0x9479('0x64')])||_0x119867[_0x9479('0x64')][_0x9479('0x64')]===''){throw new db[(_0x9479('0x8e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9479('0x9b')](_0x119867[_0x9479('0x64')]['to'])){throw new db[(_0x9479('0x8e'))][(_0x9479('0x8f'))]('to\x20is\x20mandatory');}_0x51a429=_0x119867[_0x9479('0x64')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x119867[_0x9479('0x56')]['id']},'include':[{'model':db[_0x9479('0xa1')],'as':_0x9479('0xba'),'include':[{'model':db[_0x9479('0xa2')],'as':'Contacts','where':{'mobile':_0x51a429},'limit':0x1,'order':[['updatedAt',_0x9479('0xa4')]]}]}]})[_0x9479('0x1f')](handleEntityNotFound(_0x56ccc4,null))[_0x9479('0x1f')](function(_0x3b5597){if(_0x3b5597&&_0x3b5597[_0x9479('0xba')]){_0x5dab24=_0x3b5597[_0x9479('0x37')]({'plain':!![]});if(_0x5dab24[_0x9479('0xba')]&&_0x5dab24[_0x9479('0xba')][_0x9479('0xa3')][_0x9479('0x48')]){return _0x5dab24[_0x9479('0xba')][_0x9479('0xa3')][0x0];}return db[_0x9479('0xa2')][_0x9479('0x5c')](_[_0x9479('0xa7')](_0x119867[_0x9479('0x64')],{'firstName':_0x51a429,'mobile':_0x51a429,'phone':_0x51a429,'ListId':_0x5dab24[_0x9479('0x94')]}));}})[_0x9479('0x1f')](handleEntityNotFound(_0x56ccc4,null))[_0x9479('0x1f')](function(_0x2395b4){if(_0x2395b4){_0x313fce=_0x2395b4;return db['WhatsappInteraction'][_0x9479('0x5b')]({'where':{'ContactId':_0x313fce['id'],'closed':![],'WhatsappAccountId':_0x5dab24['id']}})['then'](function(_0x258ccb){if(_0x258ccb){return[_0x258ccb,![]];}return db[_0x9479('0xa8')][_0x9479('0x5c')]({'UserId':_0x119867['user']['id'],'ContactId':_0x313fce['id'],'WhatsappAccountId':_0x5dab24['id'],'phone':_0x51a429,'firstMsgDirection':_0x9479('0xbb'),'Messages':[_[_0x9479('0x50')](_0x119867['body'],{'read':![],'body':_0x119867[_0x9479('0x64')][_0x9479('0x64')],'phone':_0x51a429,'WhatsappAccountId':_0x5dab24['id'],'UserId':_0x119867[_0x9479('0x5d')]['id'],'ContactId':_0x313fce['id']})]},{'include':[{'model':db[_0x9479('0xaf')],'as':'Messages'}]})[_0x9479('0x1f')](function(_0x3eb4b0){return[_0x3eb4b0,!![]];});});}})[_0x9479('0x73')](function(_0x327830,_0x45c200){if(_0x45c200){return _0x327830;}return db['WhatsappMessage'][_0x9479('0x5c')](_['merge'](_0x119867[_0x9479('0x64')],{'read':![],'body':_0x119867[_0x9479('0x64')]['body'],'phone':_0x51a429,'WhatsappAccountId':_0x5dab24['id'],'WhatsappInteractionId':_0x327830['id'],'UserId':_0x119867[_0x9479('0x5d')]['id'],'ContactId':_0x313fce['id']}))[_0x9479('0x1f')](function(_0x314e94){_0x327830['dataValues'][_0x9479('0xbc')]=[];_0x327830[_0x9479('0xbd')][_0x9479('0xbc')][_0x9479('0xac')](_0x314e94[_0x9479('0xbd')]);return _0x327830;});})[_0x9479('0x1f')](respondWithResult(_0x56ccc4,null))[_0x9479('0x54')](handleError(_0x56ccc4,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index fae6038..99aa456 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 _0xa2d5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x138156,_0x1155e6){var _0x45fb01=function(_0x3bfdec){while(--_0x3bfdec){_0x138156['push'](_0x138156['shift']());}};_0x45fb01(++_0x1155e6);}(_0xa2d5,0x15d));var _0x5a2d=function(_0x1e66c8,_0x1fc5af){_0x1e66c8=_0x1e66c8-0x0;var _0x9f577d=_0xa2d5[_0x1e66c8];return _0x9f577d;};'use strict';var EventEmitter=require(_0x5a2d('0x0'));var WhatsappAccount=require(_0x5a2d('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5a2d('0x2')](0x0);var events={'afterCreate':_0x5a2d('0x3'),'afterUpdate':_0x5a2d('0x4'),'afterDestroy':_0x5a2d('0x5')};function emitEvent(_0x18610d){return function(_0x15c170,_0x25ff05,_0x4dcac4){WhatsappAccountEvents[_0x5a2d('0x6')](_0x18610d+':'+_0x15c170['id'],_0x15c170);WhatsappAccountEvents[_0x5a2d('0x6')](_0x18610d,_0x15c170);_0x4dcac4(null);};}for(var e in events){if(events[_0x5a2d('0x7')](e)){var event=events[e];WhatsappAccount[_0x5a2d('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x8eca=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x10cf61,_0x5c76e6){var _0x50791c=function(_0x163fcd){while(--_0x163fcd){_0x10cf61['push'](_0x10cf61['shift']());}};_0x50791c(++_0x5c76e6);}(_0x8eca,0x1a9));var _0xa8ec=function(_0x5dce89,_0x2ae0a1){_0x5dce89=_0x5dce89-0x0;var _0x1bfe88=_0x8eca[_0x5dce89];return _0x1bfe88;};'use strict';var EventEmitter=require(_0xa8ec('0x0'));var WhatsappAccount=require(_0xa8ec('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa8ec('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa8ec('0x3'),'afterDestroy':_0xa8ec('0x4')};function emitEvent(_0x41770e){return function(_0xa62bcc,_0x20ec0a,_0x401cf8){WhatsappAccountEvents[_0xa8ec('0x5')](_0x41770e+':'+_0xa62bcc['id'],_0xa62bcc);WhatsappAccountEvents[_0xa8ec('0x5')](_0x41770e,_0xa62bcc);_0x401cf8(null);};}for(var e in events){if(events[_0xa8ec('0x6')](e)){var event=events[e];WhatsappAccount[_0xa8ec('0x7')](e,emitEvent(event));}}module[_0xa8ec('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index e1f4ae3..75d0e24 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 _0x07b3=['util','../../config/logger','moment','path','../../config/environment','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x2dcd15,_0x978a36){var _0x58ae7d=function(_0x95a26d){while(--_0x95a26d){_0x2dcd15['push'](_0x2dcd15['shift']());}};_0x58ae7d(++_0x978a36);}(_0x07b3,0x19d));var _0x307b=function(_0x3d5653,_0x4aa515){_0x3d5653=_0x3d5653-0x0;var _0x46519b=_0x07b3[_0x3d5653];return _0x46519b;};'use strict';var _=require(_0x307b('0x0'));var util=require(_0x307b('0x1'));var logger=require(_0x307b('0x2'))('api');var moment=require(_0x307b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x307b('0x4'));var rimraf=require('rimraf');var config=require(_0x307b('0x5'));var attributes=require(_0x307b('0x6'));module['exports']=function(_0x562552,_0x48e0a6){return _0x562552['define'](_0x307b('0x7'),attributes,{'tableName':_0x307b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa68d=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x1ae470,_0x1fb2c1){var _0xdfc1c0=function(_0x19a056){while(--_0x19a056){_0x1ae470['push'](_0x1ae470['shift']());}};_0xdfc1c0(++_0x1fb2c1);}(_0xa68d,0x167));var _0xda68=function(_0x582dae,_0x4f25e9){_0x582dae=_0x582dae-0x0;var _0x11da51=_0xa68d[_0x582dae];return _0x11da51;};'use strict';var _=require(_0xda68('0x0'));var util=require('util');var logger=require(_0xda68('0x1'))('api');var moment=require('moment');var BPromise=require(_0xda68('0x2'));var rp=require(_0xda68('0x3'));var fs=require('fs');var path=require(_0xda68('0x4'));var rimraf=require(_0xda68('0x5'));var config=require(_0xda68('0x6'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x242b8c,_0x2e6ef9){return _0x242b8c[_0xda68('0x7')](_0xda68('0x8'),attributes,{'tableName':_0xda68('0x9'),'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 0f205a2..07d2649 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 _0x8bef=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','WhatsappAccount','find','options','raw','where','include','map','model','attributes','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x26a776,_0xb78d93){var _0x440e98=function(_0x3ee6d8){while(--_0x3ee6d8){_0x26a776['push'](_0x26a776['shift']());}};_0x440e98(++_0xb78d93);}(_0x8bef,0x66));var _0xf8be=function(_0xaecc27,_0x3b15ab){_0xaecc27=_0xaecc27-0x0;var _0x2203ec=_0x8bef[_0xaecc27];return _0x2203ec;};'use strict';var _=require(_0xf8be('0x0'));var util=require(_0xf8be('0x1'));var moment=require(_0xf8be('0x2'));var BPromise=require(_0xf8be('0x3'));var rs=require(_0xf8be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8be('0x5'))['db'];var utils=require(_0xf8be('0x6'));var logger=require(_0xf8be('0x7'))(_0xf8be('0x8'));var config=require(_0xf8be('0x9'));var jayson=require(_0xf8be('0xa'));var client=jayson[_0xf8be('0xb')][_0xf8be('0xc')]({'port':0x232a});config[_0xf8be('0xd')]=_[_0xf8be('0xe')](config['redis'],{'host':_0xf8be('0xf'),'port':0x18eb});var socket=require(_0xf8be('0x10'))(new Redis(config[_0xf8be('0xd')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0xba0b30,_0x41bc53,_0x1810f0){return new BPromise(function(_0x4051eb,_0x11b15e){return client['request'](_0xba0b30,_0x1810f0)[_0xf8be('0x11')](function(_0x3f411c){logger[_0xf8be('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x41bc53,'request\x20sent');logger[_0xf8be('0x13')](_0xf8be('0x14'),_0x41bc53,_0xf8be('0x15'),JSON[_0xf8be('0x16')](_0x3f411c));if(_0x3f411c[_0xf8be('0x17')]){if(_0x3f411c['error']['code']===0x1f4){logger[_0xf8be('0x17')](_0xf8be('0x18'),_0x41bc53,_0x3f411c[_0xf8be('0x17')]['message']);return _0x11b15e(_0x3f411c[_0xf8be('0x17')][_0xf8be('0x19')]);}logger[_0xf8be('0x17')](_0xf8be('0x18'),_0x41bc53,_0x3f411c[_0xf8be('0x17')][_0xf8be('0x19')]);return _0x4051eb(_0x3f411c[_0xf8be('0x17')]['message']);}else{logger[_0xf8be('0x12')](_0xf8be('0x18'),_0x41bc53,_0xf8be('0x15'));_0x4051eb(_0x3f411c['result'][_0xf8be('0x19')]);}})[_0xf8be('0x1a')](function(_0x4069b5){logger['error'](_0xf8be('0x18'),_0x41bc53,_0x4069b5);_0x11b15e(_0x4069b5);});});}exports['ShowWhatsappAccount']=function(_0x2783f9){var _0x2db0a1=this;return new Promise(function(_0x5775a8,_0x852f98){return db[_0xf8be('0x1b')][_0xf8be('0x1c')]({'raw':_0x2783f9[_0xf8be('0x1d')]?_0x2783f9[_0xf8be('0x1d')][_0xf8be('0x1e')]===undefined?!![]:![]:!![],'where':_0x2783f9[_0xf8be('0x1d')]?_0x2783f9['options'][_0xf8be('0x1f')]||null:null,'attributes':_0x2783f9['options']?_0x2783f9[_0xf8be('0x1d')]['attributes']||null:null,'include':_0x2783f9[_0xf8be('0x1d')]?_0x2783f9[_0xf8be('0x1d')][_0xf8be('0x20')]?_[_0xf8be('0x21')](_0x2783f9[_0xf8be('0x1d')][_0xf8be('0x20')],function(_0x5bb12f){return{'model':db[_0x5bb12f[_0xf8be('0x22')]],'as':_0x5bb12f['as'],'attributes':_0x5bb12f['attributes'],'include':_0x5bb12f[_0xf8be('0x20')]?_[_0xf8be('0x21')](_0x5bb12f[_0xf8be('0x20')],function(_0x2a7c77){return{'model':db[_0x2a7c77[_0xf8be('0x22')]],'as':_0x2a7c77['as'],'attributes':_0x2a7c77[_0xf8be('0x23')],'include':_0x2a7c77[_0xf8be('0x20')]?_[_0xf8be('0x21')](_0x2a7c77[_0xf8be('0x20')],function(_0x4f5e02){return{'model':db[_0x4f5e02[_0xf8be('0x22')]],'as':_0x4f5e02['as'],'attributes':_0x4f5e02['attributes']};}):[]};}):[]};}):[]:[]})[_0xf8be('0x11')](function(_0x5eedc6){logger[_0xf8be('0x12')]('ShowWhatsappAccount',_0x2783f9);logger['debug'](_0xf8be('0x24'),_0x2783f9,JSON[_0xf8be('0x16')](_0x5eedc6));_0x5775a8(_0x5eedc6);})[_0xf8be('0x1a')](function(_0x520eac){logger[_0xf8be('0x17')](_0xf8be('0x24'),_0x520eac[_0xf8be('0x19')],_0x2783f9);_0x852f98(_0x2db0a1[_0xf8be('0x17')](0x1f4,_0x520eac[_0xf8be('0x19')]));});});}; \ No newline at end of file +var _0xf883=['localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','map','include','model','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5d868a,_0x2c1d19){var _0x587b00=function(_0x59499a){while(--_0x59499a){_0x5d868a['push'](_0x5d868a['shift']());}};_0x587b00(++_0x2c1d19);}(_0xf883,0xd6));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3f88('0x0'));var util=require(_0x3f88('0x1'));var moment=require(_0x3f88('0x2'));var BPromise=require(_0x3f88('0x3'));var rs=require(_0x3f88('0x4'));var fs=require('fs');var Redis=require(_0x3f88('0x5'));var db=require(_0x3f88('0x6'))['db'];var utils=require(_0x3f88('0x7'));var logger=require(_0x3f88('0x8'))('rpc');var config=require(_0x3f88('0x9'));var jayson=require(_0x3f88('0xa'));var client=jayson[_0x3f88('0xb')][_0x3f88('0xc')]({'port':0x232a});config[_0x3f88('0xd')]=_['defaults'](config[_0x3f88('0xd')],{'host':_0x3f88('0xe'),'port':0x18eb});var socket=require(_0x3f88('0xf'))(new Redis(config['redis']));require(_0x3f88('0x10'))[_0x3f88('0x11')](socket);function respondWithRpcPromise(_0x1c6c38,_0xe7ecf5,_0x3dde1a){return new BPromise(function(_0x58bfac,_0xe86ca2){return client['request'](_0x1c6c38,_0x3dde1a)[_0x3f88('0x12')](function(_0x57d238){logger[_0x3f88('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0xe7ecf5,_0x3f88('0x14'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe7ecf5,_0x3f88('0x14'),JSON[_0x3f88('0x15')](_0x57d238));if(_0x57d238[_0x3f88('0x16')]){if(_0x57d238['error']['code']===0x1f4){logger['error'](_0x3f88('0x17'),_0xe7ecf5,_0x57d238[_0x3f88('0x16')][_0x3f88('0x18')]);return _0xe86ca2(_0x57d238[_0x3f88('0x16')][_0x3f88('0x18')]);}logger[_0x3f88('0x16')](_0x3f88('0x17'),_0xe7ecf5,_0x57d238[_0x3f88('0x16')]['message']);return _0x58bfac(_0x57d238[_0x3f88('0x16')][_0x3f88('0x18')]);}else{logger['info'](_0x3f88('0x17'),_0xe7ecf5,_0x3f88('0x14'));_0x58bfac(_0x57d238[_0x3f88('0x19')][_0x3f88('0x18')]);}})['catch'](function(_0x2ef396){logger[_0x3f88('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0xe7ecf5,_0x2ef396);_0xe86ca2(_0x2ef396);});});}exports[_0x3f88('0x1a')]=function(_0x210ecf){var _0x46d684=this;return new Promise(function(_0x304cac,_0x32a927){return db[_0x3f88('0x1b')][_0x3f88('0x1c')]({'raw':_0x210ecf[_0x3f88('0x1d')]?_0x210ecf[_0x3f88('0x1d')][_0x3f88('0x1e')]===undefined?!![]:![]:!![],'where':_0x210ecf['options']?_0x210ecf['options'][_0x3f88('0x1f')]||null:null,'attributes':_0x210ecf[_0x3f88('0x1d')]?_0x210ecf[_0x3f88('0x1d')][_0x3f88('0x20')]||null:null,'include':_0x210ecf[_0x3f88('0x1d')]?_0x210ecf[_0x3f88('0x1d')]['include']?_[_0x3f88('0x21')](_0x210ecf[_0x3f88('0x1d')][_0x3f88('0x22')],function(_0x210c0b){return{'model':db[_0x210c0b[_0x3f88('0x23')]],'as':_0x210c0b['as'],'attributes':_0x210c0b['attributes'],'include':_0x210c0b['include']?_[_0x3f88('0x21')](_0x210c0b[_0x3f88('0x22')],function(_0x276e02){return{'model':db[_0x276e02['model']],'as':_0x276e02['as'],'attributes':_0x276e02[_0x3f88('0x20')],'include':_0x276e02[_0x3f88('0x22')]?_[_0x3f88('0x21')](_0x276e02[_0x3f88('0x22')],function(_0x15ff8b){return{'model':db[_0x15ff8b[_0x3f88('0x23')]],'as':_0x15ff8b['as'],'attributes':_0x15ff8b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f88('0x12')](function(_0x34d7f6){logger[_0x3f88('0x13')](_0x3f88('0x1a'),_0x210ecf);logger[_0x3f88('0x24')](_0x3f88('0x1a'),_0x210ecf,JSON[_0x3f88('0x15')](_0x34d7f6));_0x304cac(_0x34d7f6);})[_0x3f88('0x25')](function(_0x2f59af){logger[_0x3f88('0x16')](_0x3f88('0x1a'),_0x2f59af[_0x3f88('0x18')],_0x210ecf);_0x32a927(_0x46d684['error'](0x1f4,_0x2f59af['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4e0ae1a..a51e406 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 _0x6da1=['remove','update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x4b744a,_0x308bef){var _0x4572fc=function(_0x53f5c4){while(--_0x53f5c4){_0x4b744a['push'](_0x4b744a['shift']());}};_0x4572fc(++_0x308bef);}(_0x6da1,0x1db));var _0x16da=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x6da1[_0x2d0d9f];return _0x30243d;};'use strict';var WhatsappAccountEvents=require(_0x16da('0x0'));var events=[_0x16da('0x1'),_0x16da('0x2'),_0x16da('0x3')];function createListener(_0x3ae787,_0x2504cd){return function(_0xe792bf){_0x2504cd[_0x16da('0x4')](_0x3ae787,_0xe792bf);};}function removeListener(_0x20a92d,_0xfcb555){return function(){WhatsappAccountEvents[_0x16da('0x5')](_0x20a92d,_0xfcb555);};}exports[_0x16da('0x6')]=function(_0x16fcf9){for(var _0x5927cb=0x0,_0x45d30b=events[_0x16da('0x7')];_0x5927cb<_0x45d30b;_0x5927cb++){var _0x6cf20e=events[_0x5927cb];var _0xb93207=createListener(_0x16da('0x8')+_0x6cf20e,_0x16fcf9);WhatsappAccountEvents['on'](_0x6cf20e,_0xb93207);}}; \ No newline at end of file +var _0x7391=['update','register','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7391,0x11c));var _0x1739=function(_0x5de818,_0x7c4485){_0x5de818=_0x5de818-0x0;var _0x345670=_0x7391[_0x5de818];return _0x345670;};'use strict';var WhatsappAccountEvents=require(_0x1739('0x0'));var events=[_0x1739('0x1'),_0x1739('0x2'),_0x1739('0x3')];function createListener(_0x1d7420,_0x516aa5){return function(_0x5c4f0a){_0x516aa5['emit'](_0x1d7420,_0x5c4f0a);};}function removeListener(_0x4c6a2c,_0x15d68d){return function(){WhatsappAccountEvents['removeListener'](_0x4c6a2c,_0x15d68d);};}exports[_0x1739('0x4')]=function(_0x4474f7){for(var _0x2e9f80=0x0,_0x234f08=events[_0x1739('0x5')];_0x2e9f80<_0x234f08;_0x2e9f80++){var _0x426fff=events[_0x2e9f80];var _0x41f913=createListener(_0x1739('0x6')+_0x426fff,_0x4474f7);WhatsappAccountEvents['on'](_0x426fff,_0x41f913);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 204d696..b704aa2 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 _0x0fe9=['/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0fe9,0x1e7));var _0x90fe=function(_0x470613,_0x5b4daa){_0x470613=_0x470613-0x0;var _0x437860=_0x0fe9[_0x470613];return _0x437860;};'use strict';var multer=require(_0x90fe('0x0'));var util=require('util');var path=require(_0x90fe('0x1'));var timeout=require(_0x90fe('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fe('0x3'));var interaction=require(_0x90fe('0x4'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x90fe('0x5')]('/',auth[_0x90fe('0x6')](),controller[_0x90fe('0x7')]);router[_0x90fe('0x5')](_0x90fe('0x8'),auth[_0x90fe('0x6')](),controller['show']);router[_0x90fe('0x9')]('/',auth[_0x90fe('0x6')](),controller[_0x90fe('0xa')]);router[_0x90fe('0xb')](_0x90fe('0x8'),auth[_0x90fe('0x6')](),controller[_0x90fe('0xc')]);router['delete'](_0x90fe('0x8'),auth[_0x90fe('0x6')](),controller[_0x90fe('0xd')]);module[_0x90fe('0xe')]=router; \ No newline at end of file +var _0x67dc=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer'];(function(_0x1cf46f,_0x8e7167){var _0x4cc2d4=function(_0x303ab9){while(--_0x303ab9){_0x1cf46f['push'](_0x1cf46f['shift']());}};_0x4cc2d4(++_0x8e7167);}(_0x67dc,0x1ef));var _0xc67d=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x67dc[_0x5b5cde];return _0x364ad2;};'use strict';var multer=require(_0xc67d('0x0'));var util=require(_0xc67d('0x1'));var path=require(_0xc67d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc67d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc67d('0x4'));var interaction=require(_0xc67d('0x5'));var config=require(_0xc67d('0x6'));var controller=require('./whatsappApplication.controller');router[_0xc67d('0x7')]('/',auth[_0xc67d('0x8')](),controller[_0xc67d('0x9')]);router['get'](_0xc67d('0xa'),auth[_0xc67d('0x8')](),controller[_0xc67d('0xb')]);router[_0xc67d('0xc')]('/',auth[_0xc67d('0x8')](),controller[_0xc67d('0xd')]);router['put'](_0xc67d('0xa'),auth[_0xc67d('0x8')](),controller['update']);router['delete'](_0xc67d('0xa'),auth[_0xc67d('0x8')](),controller[_0xc67d('0xe')]);module[_0xc67d('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 204fcd2..f794ebf 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 _0xe62d=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe62d,0xb6));var _0xde62=function(_0x340b1b,_0x4f21b6){_0x340b1b=_0x340b1b-0x0;var _0x41b74e=_0xe62d[_0x340b1b];return _0x41b74e;};'use strict';var Sequelize=require('sequelize');module[_0xde62('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xde62('0x1')],'allowNull':![],'defaultValue':_0xde62('0x2')},'appdata':{'type':Sequelize[_0xde62('0x3')]()},'description':{'type':Sequelize[_0xde62('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xde62('0x4')}}; \ No newline at end of file +var _0xf805=['exports','INTEGER','STRING'];(function(_0xa4b8a,_0x3f1543){var _0x39f1d9=function(_0x5cdfdb){while(--_0x5cdfdb){_0xa4b8a['push'](_0xa4b8a['shift']());}};_0x39f1d9(++_0x3f1543);}(_0xf805,0xc9));var _0x5f80=function(_0x2dee4c,_0x59e3d3){_0x2dee4c=_0x2dee4c-0x0;var _0x32439b=_0xf805[_0x2dee4c];return _0x32439b;};'use strict';var Sequelize=require('sequelize');module[_0x5f80('0x0')]={'priority':{'type':Sequelize[_0x5f80('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5f80('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5f80('0x2')]},'interval':{'type':Sequelize[_0x5f80('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1413e07..2bffd9a 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 _0x2bab=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x9095fe,_0x18050c){var _0x21ddc0=function(_0xf20c02){while(--_0xf20c02){_0x9095fe['push'](_0x9095fe['shift']());}};_0x21ddc0(++_0x18050c);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x58dbf2,_0x485b1b){_0x58dbf2=_0x58dbf2-0x0;var _0x1d2a8c=_0x2bab[_0x58dbf2];return _0x1d2a8c;};'use strict';var emlformat=require(_0xb2ba('0x0'));var rimraf=require(_0xb2ba('0x1'));var zipdir=require(_0xb2ba('0x2'));var jsonpatch=require(_0xb2ba('0x3'));var rp=require('request-promise');var moment=require(_0xb2ba('0x4'));var BPromise=require(_0xb2ba('0x5'));var Mustache=require(_0xb2ba('0x6'));var util=require('util');var path=require(_0xb2ba('0x7'));var sox=require(_0xb2ba('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2ba('0x9'));var squel=require('squel');var crypto=require(_0xb2ba('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb2ba('0xb'));var querystring=require(_0xb2ba('0xc'));var Papa=require(_0xb2ba('0xd'));var Redis=require(_0xb2ba('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb2ba('0xf'));var as=require(_0xb2ba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb2ba('0x11'));var utils=require(_0xb2ba('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb2ba('0x13'));var db=require(_0xb2ba('0x14'))['db'];function respondWithStatusCode(_0x294301,_0x55317a){_0x55317a=_0x55317a||0xcc;return function(_0x44fe02){if(_0x44fe02){return _0x294301[_0xb2ba('0x15')](_0x55317a);}return _0x294301[_0xb2ba('0x16')](_0x55317a)[_0xb2ba('0x17')]();};}function respondWithResult(_0x14b5bc,_0x5d0455){_0x5d0455=_0x5d0455||0xc8;return function(_0x4f09a9){if(_0x4f09a9){return _0x14b5bc['status'](_0x5d0455)[_0xb2ba('0x18')](_0x4f09a9);}};}function respondWithFilteredResult(_0x1093cf,_0xaf8c1d){return function(_0x1f73a1){if(_0x1f73a1){var _0x52716a=typeof _0xaf8c1d['offset']===_0xb2ba('0x19')&&typeof _0xaf8c1d[_0xb2ba('0x1a')]===_0xb2ba('0x19');var _0x3a9fa6=_0x1f73a1[_0xb2ba('0x1b')];var _0x3e770f=_0x52716a?0x0:_0xaf8c1d[_0xb2ba('0x1c')];var _0x326b49=_0x52716a?_0x1f73a1[_0xb2ba('0x1b')]:_0xaf8c1d[_0xb2ba('0x1c')]+_0xaf8c1d[_0xb2ba('0x1a')];var _0x5189fa;if(_0x326b49>=_0x3a9fa6){_0x326b49=_0x3a9fa6;_0x5189fa=0xc8;}else{_0x5189fa=0xce;}_0x1093cf[_0xb2ba('0x16')](_0x5189fa);return _0x1093cf[_0xb2ba('0x1d')](_0xb2ba('0x1e'),_0x3e770f+'-'+_0x326b49+'/'+_0x3a9fa6)[_0xb2ba('0x18')](_0x1f73a1);}return null;};}function patchUpdates(_0x34aab5){return function(_0x5643a6){try{jsonpatch[_0xb2ba('0x1f')](_0x5643a6,_0x34aab5,!![]);}catch(_0x11a8f3){return BPromise[_0xb2ba('0x20')](_0x11a8f3);}return _0x5643a6[_0xb2ba('0x21')]();};}function saveUpdates(_0x19c0b8,_0x4639a9){return function(_0x588e34){if(_0x588e34){return _0x588e34[_0xb2ba('0x22')](_0x19c0b8)[_0xb2ba('0x23')](function(_0x45aeba){return _0x45aeba;});}return null;};}function removeEntity(_0x52d48d,_0xb4e5cf){return function(_0x2b22f5){if(_0x2b22f5){return _0x2b22f5[_0xb2ba('0x24')]()['then'](function(){_0x52d48d[_0xb2ba('0x16')](0xcc)[_0xb2ba('0x17')]();});}};}function handleEntityNotFound(_0x3684e3,_0xa86dbb){return function(_0x383c14){if(!_0x383c14){_0x3684e3[_0xb2ba('0x15')](0x194);}return _0x383c14;};}function handleError(_0xa64b7d,_0x4e9ae8){_0x4e9ae8=_0x4e9ae8||0x1f4;return function(_0x5ca398){logger[_0xb2ba('0x25')](_0x5ca398['stack']);if(_0x5ca398[_0xb2ba('0x26')]){delete _0x5ca398[_0xb2ba('0x26')];}_0xa64b7d[_0xb2ba('0x16')](_0x4e9ae8)['send'](_0x5ca398);};}exports[_0xb2ba('0x27')]=function(_0x5506f9,_0xba600a){var _0x2e63c9={},_0x254312={},_0x553cec={'count':0x0,'rows':[]};var _0x1248e7=_['map'](db[_0xb2ba('0x28')][_0xb2ba('0x29')],function(_0x4baaf5){return{'name':_0x4baaf5[_0xb2ba('0x2a')],'type':_0x4baaf5['type'][_0xb2ba('0x2b')]};});_0x254312[_0xb2ba('0x2c')]=_['map'](_0x1248e7,_0xb2ba('0x26'));_0x254312[_0xb2ba('0x2d')]=_[_0xb2ba('0x2e')](_0x5506f9['query']);_0x254312['filters']=_[_0xb2ba('0x2f')](_0x254312[_0xb2ba('0x2c')],_0x254312[_0xb2ba('0x2d')]);_0x2e63c9['attributes']=_[_0xb2ba('0x2f')](_0x254312[_0xb2ba('0x2c')],qs['fields'](_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x30')]));_0x2e63c9['attributes']=_0x2e63c9[_0xb2ba('0x31')][_0xb2ba('0x32')]?_0x2e63c9[_0xb2ba('0x31')]:_0x254312['model'];if(!_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x33')](_0xb2ba('0x34'))){_0x2e63c9['limit']=qs[_0xb2ba('0x1a')](_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x1a')]);_0x2e63c9[_0xb2ba('0x1c')]=qs[_0xb2ba('0x1c')](_0x5506f9['query'][_0xb2ba('0x1c')]);}_0x2e63c9[_0xb2ba('0x35')]=qs[_0xb2ba('0x36')](_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x36')]);_0x2e63c9[_0xb2ba('0x37')]=qs[_0xb2ba('0x38')](_[_0xb2ba('0x39')](_0x5506f9[_0xb2ba('0x2d')],_0x254312['filters']),_0x1248e7);if(_0x5506f9['query'][_0xb2ba('0x3a')]){_0x2e63c9['where']=_[_0xb2ba('0x3b')](_0x2e63c9['where'],{'$or':_['map'](_0x1248e7,function(_0x444b01){if(_0x444b01[_0xb2ba('0x3c')]!=='VIRTUAL'){var _0x2b970c={};_0x2b970c[_0x444b01[_0xb2ba('0x26')]]={'$like':'%'+_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x3a')]+'%'};return _0x2b970c;}})});}_0x2e63c9=_[_0xb2ba('0x3b')]({},_0x2e63c9,_0x5506f9[_0xb2ba('0x3d')]);var _0x356102={'where':_0x2e63c9[_0xb2ba('0x37')]};return db[_0xb2ba('0x28')][_0xb2ba('0x1b')](_0x356102)[_0xb2ba('0x23')](function(_0x4461c2){_0x553cec[_0xb2ba('0x1b')]=_0x4461c2;if(_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x3e')]){_0x2e63c9[_0xb2ba('0x3f')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xb2ba('0x40')](_0x2e63c9);})[_0xb2ba('0x23')](function(_0x1f3541){_0x553cec[_0xb2ba('0x41')]=_0x1f3541;return _0x553cec;})['then'](respondWithFilteredResult(_0xba600a,_0x2e63c9))[_0xb2ba('0x42')](handleError(_0xba600a,null));};exports['show']=function(_0x789d99,_0x5a7811){var _0x51bb6b={'raw':!![],'where':{'id':_0x789d99[_0xb2ba('0x43')]['id']}},_0x13c316={};_0x13c316[_0xb2ba('0x2c')]=_[_0xb2ba('0x2e')](db['WhatsappApplication'][_0xb2ba('0x29')]);_0x13c316['query']=_[_0xb2ba('0x2e')](_0x789d99[_0xb2ba('0x2d')]);_0x13c316[_0xb2ba('0x38')]=_[_0xb2ba('0x2f')](_0x13c316[_0xb2ba('0x2c')],_0x13c316['query']);_0x51bb6b[_0xb2ba('0x31')]=_[_0xb2ba('0x2f')](_0x13c316[_0xb2ba('0x2c')],qs[_0xb2ba('0x30')](_0x789d99['query']['fields']));_0x51bb6b[_0xb2ba('0x31')]=_0x51bb6b[_0xb2ba('0x31')]['length']?_0x51bb6b[_0xb2ba('0x31')]:_0x13c316[_0xb2ba('0x2c')];if(_0x789d99[_0xb2ba('0x2d')][_0xb2ba('0x3e')]){_0x51bb6b[_0xb2ba('0x3f')]=[{'all':!![]}];}_0x51bb6b=_[_0xb2ba('0x3b')]({},_0x51bb6b,_0x789d99[_0xb2ba('0x3d')]);return db[_0xb2ba('0x28')][_0xb2ba('0x44')](_0x51bb6b)[_0xb2ba('0x23')](handleEntityNotFound(_0x5a7811,null))['then'](respondWithResult(_0x5a7811,null))[_0xb2ba('0x42')](handleError(_0x5a7811,null));};exports['create']=function(_0x1c496d,_0xd17afe){return db['WhatsappApplication']['create'](_0x1c496d[_0xb2ba('0x45')],{})[_0xb2ba('0x23')](respondWithResult(_0xd17afe,0xc9))[_0xb2ba('0x42')](handleError(_0xd17afe,null));};exports[_0xb2ba('0x22')]=function(_0x3ffde0,_0x4939d2){if(_0x3ffde0['body']['id']){delete _0x3ffde0['body']['id'];}return db[_0xb2ba('0x28')][_0xb2ba('0x44')]({'where':{'id':_0x3ffde0['params']['id']}})['then'](handleEntityNotFound(_0x4939d2,null))[_0xb2ba('0x23')](saveUpdates(_0x3ffde0['body'],null))[_0xb2ba('0x23')](respondWithResult(_0x4939d2,null))['catch'](handleError(_0x4939d2,null));};exports[_0xb2ba('0x24')]=function(_0x44827d,_0x155320){return db[_0xb2ba('0x28')][_0xb2ba('0x44')]({'where':{'id':_0x44827d[_0xb2ba('0x43')]['id']}})[_0xb2ba('0x23')](handleEntityNotFound(_0x155320,null))[_0xb2ba('0x23')](removeEntity(_0x155320,null))[_0xb2ba('0x42')](handleError(_0x155320,null));}; \ No newline at end of file +var _0x63d4=['../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','rows','show','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis'];(function(_0x59de2a,_0x264f62){var _0x1d18d2=function(_0x5c1a5a){while(--_0x5c1a5a){_0x59de2a['push'](_0x59de2a['shift']());}};_0x1d18d2(++_0x264f62);}(_0x63d4,0x117));var _0x463d=function(_0x34c903,_0x372d24){_0x34c903=_0x34c903-0x0;var _0x1b7221=_0x63d4[_0x34c903];return _0x1b7221;};'use strict';var emlformat=require(_0x463d('0x0'));var rimraf=require(_0x463d('0x1'));var zipdir=require(_0x463d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x463d('0x3'));var moment=require(_0x463d('0x4'));var BPromise=require(_0x463d('0x5'));var Mustache=require(_0x463d('0x6'));var util=require(_0x463d('0x7'));var path=require('path');var sox=require(_0x463d('0x8'));var csv=require(_0x463d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x463d('0xa'));var _=require(_0x463d('0xb'));var squel=require(_0x463d('0xc'));var crypto=require(_0x463d('0xd'));var jsforce=require(_0x463d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x463d('0x9'));var querystring=require('querystring');var Papa=require(_0x463d('0xf'));var Redis=require(_0x463d('0x10'));var authService=require(_0x463d('0x11'));var qs=require(_0x463d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x463d('0x13'))('api');var utils=require(_0x463d('0x14'));var config=require(_0x463d('0x15'));var licenseUtil=require(_0x463d('0x16'));var db=require(_0x463d('0x17'))['db'];function respondWithStatusCode(_0x1ac050,_0x15d6ca){_0x15d6ca=_0x15d6ca||0xcc;return function(_0x39834c){if(_0x39834c){return _0x1ac050['sendStatus'](_0x15d6ca);}return _0x1ac050[_0x463d('0x18')](_0x15d6ca)[_0x463d('0x19')]();};}function respondWithResult(_0x436dba,_0x5d82ad){_0x5d82ad=_0x5d82ad||0xc8;return function(_0x8956d3){if(_0x8956d3){return _0x436dba[_0x463d('0x18')](_0x5d82ad)[_0x463d('0x1a')](_0x8956d3);}};}function respondWithFilteredResult(_0x1932e6,_0x37b3f6){return function(_0x46896c){if(_0x46896c){var _0x53c8c6=typeof _0x37b3f6[_0x463d('0x1b')]==='undefined'&&typeof _0x37b3f6[_0x463d('0x1c')]===_0x463d('0x1d');var _0x3c8154=_0x46896c[_0x463d('0x1e')];var _0x408f47=_0x53c8c6?0x0:_0x37b3f6[_0x463d('0x1b')];var _0x48df3c=_0x53c8c6?_0x46896c[_0x463d('0x1e')]:_0x37b3f6[_0x463d('0x1b')]+_0x37b3f6[_0x463d('0x1c')];var _0x2f813d;if(_0x48df3c>=_0x3c8154){_0x48df3c=_0x3c8154;_0x2f813d=0xc8;}else{_0x2f813d=0xce;}_0x1932e6[_0x463d('0x18')](_0x2f813d);return _0x1932e6[_0x463d('0x1f')](_0x463d('0x20'),_0x408f47+'-'+_0x48df3c+'/'+_0x3c8154)[_0x463d('0x1a')](_0x46896c);}return null;};}function patchUpdates(_0x27c4a3){return function(_0x622b48){try{jsonpatch[_0x463d('0x21')](_0x622b48,_0x27c4a3,!![]);}catch(_0xda9541){return BPromise[_0x463d('0x22')](_0xda9541);}return _0x622b48[_0x463d('0x23')]();};}function saveUpdates(_0x458789,_0x5670fc){return function(_0x19e3eb){if(_0x19e3eb){return _0x19e3eb['update'](_0x458789)[_0x463d('0x24')](function(_0x1a2756){return _0x1a2756;});}return null;};}function removeEntity(_0x541aa9,_0x5d16ad){return function(_0x3fc748){if(_0x3fc748){return _0x3fc748[_0x463d('0x25')]()['then'](function(){_0x541aa9[_0x463d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1379ef,_0x35e562){return function(_0x3f10b3){if(!_0x3f10b3){_0x1379ef['sendStatus'](0x194);}return _0x3f10b3;};}function handleError(_0x592748,_0x4627c0){_0x4627c0=_0x4627c0||0x1f4;return function(_0x3763a2){logger[_0x463d('0x26')](_0x3763a2[_0x463d('0x27')]);if(_0x3763a2[_0x463d('0x28')]){delete _0x3763a2[_0x463d('0x28')];}_0x592748['status'](_0x4627c0)['send'](_0x3763a2);};}exports[_0x463d('0x29')]=function(_0x5cf437,_0x5358bb){var _0x45165d={},_0x33305d={},_0x440921={'count':0x0,'rows':[]};var _0x540e9c=_[_0x463d('0x2a')](db[_0x463d('0x2b')][_0x463d('0x2c')],function(_0x236ebb){return{'name':_0x236ebb[_0x463d('0x2d')],'type':_0x236ebb['type'][_0x463d('0x2e')]};});_0x33305d[_0x463d('0x2f')]=_['map'](_0x540e9c,_0x463d('0x28'));_0x33305d['query']=_[_0x463d('0x30')](_0x5cf437[_0x463d('0x31')]);_0x33305d[_0x463d('0x32')]=_[_0x463d('0x33')](_0x33305d[_0x463d('0x2f')],_0x33305d['query']);_0x45165d[_0x463d('0x34')]=_[_0x463d('0x33')](_0x33305d[_0x463d('0x2f')],qs[_0x463d('0x35')](_0x5cf437[_0x463d('0x31')][_0x463d('0x35')]));_0x45165d[_0x463d('0x34')]=_0x45165d[_0x463d('0x34')][_0x463d('0x36')]?_0x45165d[_0x463d('0x34')]:_0x33305d[_0x463d('0x2f')];if(!_0x5cf437[_0x463d('0x31')][_0x463d('0x37')](_0x463d('0x38'))){_0x45165d[_0x463d('0x1c')]=qs['limit'](_0x5cf437[_0x463d('0x31')][_0x463d('0x1c')]);_0x45165d[_0x463d('0x1b')]=qs[_0x463d('0x1b')](_0x5cf437[_0x463d('0x31')][_0x463d('0x1b')]);}_0x45165d[_0x463d('0x39')]=qs[_0x463d('0x3a')](_0x5cf437[_0x463d('0x31')][_0x463d('0x3a')]);_0x45165d[_0x463d('0x3b')]=qs['filters'](_['pick'](_0x5cf437[_0x463d('0x31')],_0x33305d[_0x463d('0x32')]),_0x540e9c);if(_0x5cf437['query'][_0x463d('0x3c')]){_0x45165d['where']=_['merge'](_0x45165d[_0x463d('0x3b')],{'$or':_['map'](_0x540e9c,function(_0x2eab3d){if(_0x2eab3d[_0x463d('0x3d')]!=='VIRTUAL'){var _0x3485dc={};_0x3485dc[_0x2eab3d[_0x463d('0x28')]]={'$like':'%'+_0x5cf437[_0x463d('0x31')][_0x463d('0x3c')]+'%'};return _0x3485dc;}})});}_0x45165d=_[_0x463d('0x3e')]({},_0x45165d,_0x5cf437[_0x463d('0x3f')]);var _0x1d1d67={'where':_0x45165d['where']};return db['WhatsappApplication'][_0x463d('0x1e')](_0x1d1d67)[_0x463d('0x24')](function(_0x41145e){_0x440921['count']=_0x41145e;if(_0x5cf437['query'][_0x463d('0x40')]){_0x45165d['include']=[{'all':!![]}];}return db[_0x463d('0x2b')][_0x463d('0x41')](_0x45165d);})[_0x463d('0x24')](function(_0x36b532){_0x440921[_0x463d('0x42')]=_0x36b532;return _0x440921;})[_0x463d('0x24')](respondWithFilteredResult(_0x5358bb,_0x45165d))['catch'](handleError(_0x5358bb,null));};exports[_0x463d('0x43')]=function(_0x498286,_0xd2232e){var _0x3b261d={'raw':!![],'where':{'id':_0x498286['params']['id']}},_0x5e4976={};_0x5e4976[_0x463d('0x2f')]=_[_0x463d('0x30')](db['WhatsappApplication']['rawAttributes']);_0x5e4976[_0x463d('0x31')]=_['keys'](_0x498286[_0x463d('0x31')]);_0x5e4976[_0x463d('0x32')]=_[_0x463d('0x33')](_0x5e4976[_0x463d('0x2f')],_0x5e4976[_0x463d('0x31')]);_0x3b261d['attributes']=_[_0x463d('0x33')](_0x5e4976[_0x463d('0x2f')],qs[_0x463d('0x35')](_0x498286[_0x463d('0x31')][_0x463d('0x35')]));_0x3b261d[_0x463d('0x34')]=_0x3b261d[_0x463d('0x34')][_0x463d('0x36')]?_0x3b261d['attributes']:_0x5e4976[_0x463d('0x2f')];if(_0x498286['query']['includeAll']){_0x3b261d['include']=[{'all':!![]}];}_0x3b261d=_['merge']({},_0x3b261d,_0x498286[_0x463d('0x3f')]);return db[_0x463d('0x2b')][_0x463d('0x44')](_0x3b261d)[_0x463d('0x24')](handleEntityNotFound(_0xd2232e,null))[_0x463d('0x24')](respondWithResult(_0xd2232e,null))[_0x463d('0x45')](handleError(_0xd2232e,null));};exports[_0x463d('0x46')]=function(_0x533d80,_0x24d179){return db['WhatsappApplication'][_0x463d('0x46')](_0x533d80[_0x463d('0x47')],{})[_0x463d('0x24')](respondWithResult(_0x24d179,0xc9))[_0x463d('0x45')](handleError(_0x24d179,null));};exports[_0x463d('0x48')]=function(_0x29d10c,_0x14b54f){if(_0x29d10c[_0x463d('0x47')]['id']){delete _0x29d10c[_0x463d('0x47')]['id'];}return db['WhatsappApplication'][_0x463d('0x44')]({'where':{'id':_0x29d10c[_0x463d('0x49')]['id']}})[_0x463d('0x24')](handleEntityNotFound(_0x14b54f,null))['then'](saveUpdates(_0x29d10c['body'],null))[_0x463d('0x24')](respondWithResult(_0x14b54f,null))['catch'](handleError(_0x14b54f,null));};exports[_0x463d('0x25')]=function(_0x41152f,_0x18f7b3){return db['WhatsappApplication'][_0x463d('0x44')]({'where':{'id':_0x41152f[_0x463d('0x49')]['id']}})['then'](handleEntityNotFound(_0x18f7b3,null))['then'](removeEntity(_0x18f7b3,null))[_0x463d('0x45')](handleError(_0x18f7b3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index aa83428..6d2f194 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 _0x34e5=['./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x445edd,_0x34fbce){var _0x2f7128=function(_0x490275){while(--_0x490275){_0x445edd['push'](_0x445edd['shift']());}};_0x2f7128(++_0x34fbce);}(_0x34e5,0x172));var _0x534e=function(_0x6d243d,_0x566e5d){_0x6d243d=_0x6d243d-0x0;var _0x4ed985=_0x34e5[_0x6d243d];return _0x4ed985;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x534e('0xb'),'collate':_0x534e('0xc')});}; \ No newline at end of file +var _0x2123=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x3948a5,_0x5054a0){var _0x102ea5=function(_0x1b89c5){while(--_0x1b89c5){_0x3948a5['push'](_0x3948a5['shift']());}};_0x102ea5(++_0x5054a0);}(_0x2123,0x190));var _0x3212=function(_0x4aec4f,_0x54b6b7){_0x4aec4f=_0x4aec4f-0x0;var _0x589228=_0x2123[_0x4aec4f];return _0x589228;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var logger=require(_0x3212('0x2'))(_0x3212('0x3'));var moment=require(_0x3212('0x4'));var BPromise=require(_0x3212('0x5'));var rp=require(_0x3212('0x6'));var fs=require('fs');var path=require(_0x3212('0x7'));var rimraf=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var attributes=require(_0x3212('0xa'));module[_0x3212('0xb')]=function(_0x5d9d36,_0x3859e4){return _0x5d9d36[_0x3212('0xc')](_0x3212('0xd'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3212('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a464035..bae0b51 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 _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x22ac92,_0x5b15e8){var _0x489cde=function(_0xa927cf){while(--_0xa927cf){_0x22ac92['push'](_0x22ac92['shift']());}};_0x489cde(++_0x5b15e8);}(_0xda55,0x6d));var _0x5da5=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xda55[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file +var _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x681024,_0x5ebebd){var _0x58f379=function(_0x44ebdf){while(--_0x44ebdf){_0x681024['push'](_0x681024['shift']());}};_0x58f379(++_0x5ebebd);}(_0x17ba,0xab));var _0xa17b=function(_0x97d16,_0x31a502){_0x97d16=_0x97d16-0x0;var _0x558e55=_0x17ba[_0x97d16];return _0x558e55;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index b286853..0a4e343 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 _0xabce=['show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked','update','/:id','whatsapp','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe'];(function(_0x35d525,_0x502576){var _0x1b3692=function(_0x58a387){while(--_0x58a387){_0x35d525['push'](_0x35d525['shift']());}};_0x1b3692(++_0x502576);}(_0xabce,0x103));var _0xeabc=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xabce[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x10')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x10')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller['addMessage']);router[_0xeabc('0x10')](_0xeabc('0x12'),auth[_0xeabc('0x8')](),interaction['tracked']('whatsapp',_0xeabc('0x13')),controller[_0xeabc('0x14')]);router[_0xeabc('0x15')]('/:id',auth[_0xeabc('0x8')](),interaction[_0xeabc('0x16')]('whatsapp','whatsappinteraction:update'),controller[_0xeabc('0x17')]);router['delete'](_0xeabc('0x18'),auth[_0xeabc('0x8')](),interaction[_0xeabc('0x16')](_0xeabc('0x19'),_0xeabc('0x1a')),controller[_0xeabc('0x1b')]);router[_0xeabc('0x1c')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xe0ae=['update','delete','destroy','/:id/tags','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','index','get','/describe','isAuthenticated','show','/:id/messages','getMessages','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update'];(function(_0x5e8766,_0x2dc43e){var _0x484b49=function(_0x18bc30){while(--_0x18bc30){_0x5e8766['push'](_0x5e8766['shift']());}};_0x484b49(++_0x2dc43e);}(_0xe0ae,0xa1));var _0xee0a=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xe0ae[_0x2e04ef];return _0x5722b0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0x7')](_0xee0a('0xb'),auth['isAuthenticated'](),controller[_0xee0a('0xc')]);router[_0xee0a('0x7')]('/:id/download',auth[_0xee0a('0x9')](),controller['download']);router[_0xee0a('0xd')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xd')]('/:id/messages',auth[_0xee0a('0x9')](),controller[_0xee0a('0xe')]);router['post']('/:id/tags',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),_0xee0a('0x11')),controller[_0xee0a('0x12')]);router['put'](_0xee0a('0x13'),auth[_0xee0a('0x9')](),interaction['tracked'](_0xee0a('0x10'),_0xee0a('0x14')),controller[_0xee0a('0x15')]);router[_0xee0a('0x16')]('/:id',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),'whatsappinteraction:destroy'),controller[_0xee0a('0x17')]);router[_0xee0a('0x16')](_0xee0a('0x18'),auth[_0xee0a('0x9')](),controller['removeTags']);module[_0xee0a('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 2afd8b7..267d123 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 _0x0f80=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x269ab7,_0x5eba4e){var _0x25b5a7=function(_0x5a6b3e){while(--_0x5a6b3e){_0x269ab7['push'](_0x269ab7['shift']());}};_0x25b5a7(++_0x5eba4e);}(_0x0f80,0x108));var _0x00f8=function(_0x46b163,_0x58cb1a){_0x46b163=_0x46b163-0x0;var _0x1f0437=_0x0f80[_0x46b163];return _0x1f0437;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x00f8('0x0'));module[_0x00f8('0x1')]={'closed':{'type':Sequelize[_0x00f8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x00f8('0x3')]},'disposition':{'type':Sequelize[_0x00f8('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x00f8('0x4')]},'note':{'type':Sequelize[_0x00f8('0x4')]},'phone':{'type':Sequelize[_0x00f8('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x00f8('0x5')]('in',_0x00f8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x00f8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x00f8('0x5')]('in',_0x00f8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x00f8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x33ac=['moment','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x71b202,_0x2d8134){var _0x361b7e=function(_0xebb106){while(--_0xebb106){_0x71b202['push'](_0x71b202['shift']());}};_0x361b7e(++_0x2d8134);}(_0x33ac,0x1f2));var _0xc33a=function(_0x237473,_0x28b521){_0x237473=_0x237473-0x0;var _0x46e70d=_0x33ac[_0x237473];return _0x46e70d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc33a('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc33a('0x1')]},'disposition':{'type':Sequelize[_0xc33a('0x2')]},'secondDisposition':{'type':Sequelize[_0xc33a('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc33a('0x2')]},'note':{'type':Sequelize[_0xc33a('0x2')]},'phone':{'type':Sequelize[_0xc33a('0x2')]},'read1stAt':{'type':Sequelize[_0xc33a('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xc33a('0x3')]('in',_0xc33a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc33a('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc33a('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a2a3091..707bc89 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 _0xca8d=['Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','role','agent','sequelize','toString','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','all','rows','show','params','includeAll','include','merge','options','create','describe','WhatsappMessage','ids','omit','findOne','pick','WhatsappInteractionId','format','findAll','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','Attachment','Messages','direction','secret','WhatsappAccount','Account','mkdirSync','Owner','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','renderFile','views','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','WhatsappInteraction','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','select','field','color','tools_tags','u.id','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xca8d,0x172));var _0xdca8=function(_0x2df2d0,_0x1d6ea8){_0x2df2d0=_0x2df2d0-0x0;var _0x3c4438=_0xca8d[_0x2df2d0];return _0x3c4438;};'use strict';var emlformat=require(_0xdca8('0x0'));var rimraf=require(_0xdca8('0x1'));var zipdir=require(_0xdca8('0x2'));var jsonpatch=require(_0xdca8('0x3'));var rp=require(_0xdca8('0x4'));var moment=require(_0xdca8('0x5'));var BPromise=require(_0xdca8('0x6'));var Mustache=require(_0xdca8('0x7'));var util=require(_0xdca8('0x8'));var path=require(_0xdca8('0x9'));var sox=require(_0xdca8('0xa'));var csv=require(_0xdca8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdca8('0xc'));var _=require(_0xdca8('0xd'));var squel=require(_0xdca8('0xe'));var crypto=require(_0xdca8('0xf'));var jsforce=require(_0xdca8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xdca8('0xb'));var querystring=require(_0xdca8('0x11'));var Papa=require(_0xdca8('0x12'));var Redis=require('ioredis');var authService=require(_0xdca8('0x13'));var qs=require(_0xdca8('0x14'));var as=require(_0xdca8('0x15'));var pdf=require(_0xdca8('0x16'));var hardwareService=require(_0xdca8('0x17'));var logger=require(_0xdca8('0x18'))(_0xdca8('0x19'));var utils=require(_0xdca8('0x1a'));var config=require(_0xdca8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdca8('0x1c')]=_[_0xdca8('0x1d')](config[_0xdca8('0x1c')],{'host':_0xdca8('0x1e'),'port':0x18eb});var socket=require(_0xdca8('0x1f'))(new Redis(config[_0xdca8('0x1c')]));require(_0xdca8('0x20'))[_0xdca8('0x21')](socket);function respondWithStatusCode(_0x446974,_0x6fc479){_0x6fc479=_0x6fc479||0xcc;return function(_0x308d92){if(_0x308d92){return _0x446974['sendStatus'](_0x6fc479);}return _0x446974['status'](_0x6fc479)[_0xdca8('0x22')]();};}function respondWithResult(_0x574f68,_0x52c910){_0x52c910=_0x52c910||0xc8;return function(_0x13c269){if(_0x13c269){return _0x574f68['status'](_0x52c910)[_0xdca8('0x23')](_0x13c269);}};}function respondWithFilteredResult(_0x2c3cb2,_0x278d9e){return function(_0x490650){if(_0x490650){var _0x5778f9=typeof _0x278d9e[_0xdca8('0x24')]===_0xdca8('0x25')&&typeof _0x278d9e[_0xdca8('0x26')]===_0xdca8('0x25');var _0x4ffe19=_0x490650[_0xdca8('0x27')];var _0x105020=_0x5778f9?0x0:_0x278d9e['offset'];var _0x10dd28=_0x5778f9?_0x490650[_0xdca8('0x27')]:_0x278d9e[_0xdca8('0x24')]+_0x278d9e['limit'];var _0x5205b3;if(_0x10dd28>=_0x4ffe19){_0x10dd28=_0x4ffe19;_0x5205b3=0xc8;}else{_0x5205b3=0xce;}_0x2c3cb2[_0xdca8('0x28')](_0x5205b3);return _0x2c3cb2[_0xdca8('0x29')](_0xdca8('0x2a'),_0x105020+'-'+_0x10dd28+'/'+_0x4ffe19)[_0xdca8('0x23')](_0x490650);}return null;};}function patchUpdates(_0x19ce0c){return function(_0x358def){try{jsonpatch[_0xdca8('0x2b')](_0x358def,_0x19ce0c,!![]);}catch(_0x5e0cbb){return BPromise[_0xdca8('0x2c')](_0x5e0cbb);}return _0x358def[_0xdca8('0x2d')]();};}function saveUpdates(_0x11dff3,_0x5b618e){return function(_0x2ddd89){if(_0x2ddd89){return _0x2ddd89[_0xdca8('0x2e')](_0x11dff3)['then'](function(_0x108ead){return _0x108ead;});}return null;};}function removeEntity(_0x3e77d1,_0x3ff576){return function(_0x4228d4){if(_0x4228d4){return _0x4228d4[_0xdca8('0x2f')]()[_0xdca8('0x30')](function(){_0x3e77d1['status'](0xcc)[_0xdca8('0x22')]();});}};}function handleEntityNotFound(_0x5b85e4,_0x1c92ee){return function(_0x4078e3){if(!_0x4078e3){_0x5b85e4[_0xdca8('0x31')](0x194);}return _0x4078e3;};}function handleError(_0x5a089b,_0x448fa3){_0x448fa3=_0x448fa3||0x1f4;return function(_0x54f87a){logger[_0xdca8('0x32')](_0x54f87a['stack']);if(_0x54f87a[_0xdca8('0x33')]){delete _0x54f87a['name'];}_0x5a089b[_0xdca8('0x28')](_0x448fa3)['send'](_0x54f87a);};}function getInteractionUsers(_0x3ccf0c,_0x33728c){return new BPromise(function(_0xe9e785,_0x5eda19){try{if(_0x33728c[_0x3ccf0c['id']]){_0x3ccf0c[_0xdca8('0x34')]=_[_0xdca8('0x35')](_0x33728c[_0x3ccf0c['id']],function(_0xa070f6){return{'id':_0xa070f6['id'],'fullname':_0xa070f6[_0xdca8('0x36')]};});}}catch(_0x1a8149){_0x5eda19(_0x1a8149);}_0xe9e785(_0x3ccf0c);});}function getInteractionTags(_0x509cc9,_0x5009bd){return new BPromise(function(_0x1ae002,_0x453e00){try{if(_0x509cc9[_0xdca8('0x37')]){_0x509cc9[_0xdca8('0x38')]=[];_0x509cc9['TagIds'][_0xdca8('0x39')](',')[_0xdca8('0x3a')](function(_0x10a379){_0x509cc9[_0xdca8('0x38')][_0xdca8('0x3b')](_0x5009bd[_0x10a379]);});}delete _0x509cc9[_0xdca8('0x37')];}catch(_0x5458b2){_0x453e00(_0x5458b2);}_0x1ae002(_0x509cc9);});}function updateWhatsappInteraction(_0x2be4f1,_0x300b24,_0x169e54){return new BPromise(function(_0x3b61fd,_0x567e33){return getInteractionUsers(_0x2be4f1,_0x169e54)['then'](function(_0x497168){return getInteractionTags(_0x497168,_0x300b24);})[_0xdca8('0x30')](function(_0x220b42){_0x3b61fd(_0x220b42);})[_0xdca8('0x3c')](function(_0x3cbfe6){_0x567e33(_0x3cbfe6);});});}exports['index']=function(_0x37c2d8,_0x2f962d){var _0x28e0f0={},_0x18d2cc={},_0x5c8b40={'count':0x0,'rows':[]};var _0xdcf5b8=_[_0xdca8('0x35')](db[_0xdca8('0x3d')][_0xdca8('0x3e')],function(_0x3ecc88){return{'name':_0x3ecc88['fieldName'],'type':_0x3ecc88['type'][_0xdca8('0x3f')]};});_0x18d2cc[_0xdca8('0x40')]=_[_0xdca8('0x35')](_0xdcf5b8,'name');_0x18d2cc[_0xdca8('0x41')]=_[_0xdca8('0x42')](_0x37c2d8['query']);_0x18d2cc['filters']=_[_0xdca8('0x43')](_0x18d2cc[_0xdca8('0x40')],_0x18d2cc['query']);_0x28e0f0['attributes']=_[_0xdca8('0x43')](_0x18d2cc[_0xdca8('0x40')],qs[_0xdca8('0x44')](_0x37c2d8[_0xdca8('0x41')]['fields']));_0x28e0f0[_0xdca8('0x45')]=_0x28e0f0[_0xdca8('0x45')][_0xdca8('0x46')]?_0x28e0f0[_0xdca8('0x45')]:_0x18d2cc[_0xdca8('0x40')];if(!_0x37c2d8[_0xdca8('0x41')]['hasOwnProperty']('nolimit')){_0x28e0f0[_0xdca8('0x26')]=qs[_0xdca8('0x26')](_0x37c2d8['query'][_0xdca8('0x26')]);_0x28e0f0[_0xdca8('0x24')]=qs[_0xdca8('0x24')](_0x37c2d8['query']['offset']);}_0x28e0f0[_0xdca8('0x47')]=qs[_0xdca8('0x48')](_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x48')]);_0x28e0f0[_0xdca8('0x49')]=qs['filters'](_['pick'](_0x37c2d8['query'],_0x18d2cc[_0xdca8('0x4a')]),_0xdcf5b8);var _0x15234c=[];var _0x47e900=squel[_0xdca8('0x4b')]()[_0xdca8('0x4c')]('id')['field'](_0xdca8('0x33'))[_0xdca8('0x4c')](_0xdca8('0x4d'))['from'](_0xdca8('0x4e'));var _0x3a00ef=squel[_0xdca8('0x4b')]()[_0xdca8('0x4c')](_0xdca8('0x4f'))[_0xdca8('0x4c')]('u.fullname')[_0xdca8('0x4c')](_0xdca8('0x50'))[_0xdca8('0x51')](_0xdca8('0x52'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x41fc0a=squel[_0xdca8('0x4b')]()[_0xdca8('0x51')]('whatsapp_interactions','i')['left_join']('cm_contacts','c',_0xdca8('0x53'))[_0xdca8('0x54')](_0xdca8('0x55'),'o',_0xdca8('0x56'))['left_join'](_0xdca8('0x57'),'a',_0xdca8('0x58'))[_0xdca8('0x54')](_0xdca8('0x59'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xdca8('0x5a'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xdca8('0x54')](_0xdca8('0x4e'),'t',_0xdca8('0x5b'));var _0x40c50c=squel[_0xdca8('0x5c')]();var _0x176448=[];var _0x22a989=squel[_0xdca8('0x5c')]();var _0x5ecc40;if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x5d')]){_0x5ecc40=as[_0xdca8('0x5e')](_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x5d')]);var _0x349649=_0x5ecc40[_0xdca8('0x5f')];for(var _0x55da66=0x0;_0x55da66<_0x5ecc40['conditions'][_0xdca8('0x46')];_0x55da66++){var _0x10122a=_0x5ecc40[_0xdca8('0x60')][_0x55da66];var _0x2613e1='i';var _0x316d3c=_[_0xdca8('0x61')](_0xdcf5b8,[_0xdca8('0x33'),_0x10122a[_0xdca8('0x4c')]]);if(!_0x316d3c){switch(_0x10122a[_0xdca8('0x4c')]){case _0xdca8('0x62'):if(_0x10122a['value']==0x1){_0x41fc0a[_0xdca8('0x63')]('`'+_0x10122a[_0xdca8('0x4c')]+_0xdca8('0x64'));}else{_0x41fc0a['having']('`'+_0x10122a[_0xdca8('0x4c')]+_0xdca8('0x65'));}break;case _0xdca8('0x66'):if(_0x10122a[_0xdca8('0x67')]===_0xdca8('0x68')){if(_0x10122a['value']['split']('\x20')[_0xdca8('0x46')]>0x1){_0x40c50c[_0x349649](_0xdca8('0x69'),qs[_0xdca8('0x6a')](_0x10122a['value']),null);}else{var _0x26172c='%'+_0x10122a[_0xdca8('0x6b')]+'%';_0x40c50c[_0x349649]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26172c,_0x26172c,_0x26172c);}}else{_0x316d3c=_[_0xdca8('0x61')](_0xdcf5b8,[_0xdca8('0x33'),'ContactId']);_0x10122a[_0xdca8('0x4c')]='ContactId';_0x3a469d=as[_0xdca8('0x6c')](_0x2613e1,_0x316d3c[_0xdca8('0x6d')],_0x10122a);_0x40c50c[_0x349649](_0x3a469d[_0xdca8('0x6e')],_0x3a469d[_0xdca8('0x6b')][_0xdca8('0x6f')],_0x3a469d[_0xdca8('0x6b')][_0xdca8('0x22')]);}break;case'Tag':var _0x4366f1=_0x10122a[_0xdca8('0x6b')][_0xdca8('0x39')](',')[_0xdca8('0x35')](function(_0x564b19){return Number(_0x564b19);});_0x4366f1[_0xdca8('0x3a')](function(_0x17b43e){_0x22a989['or'](_0xdca8('0x70'),'%,'+_0x17b43e+',%');});_0x176448=_['union'](_0x176448,_0x4366f1);break;case _0xdca8('0x71'):if(_0x10122a[_0xdca8('0x67')]===_0xdca8('0x68')){_0x40c50c[_0x349649](_0xdca8('0x72'),'%'+_0x10122a['value']+'%',null);}else{_0x316d3c=_['find'](_0xdcf5b8,[_0xdca8('0x33'),_0xdca8('0x73')]);_0x10122a['field']=_0xdca8('0x73');_0x3a469d=as[_0xdca8('0x6c')](_0x2613e1,_0x316d3c[_0xdca8('0x6d')],_0x10122a);_0x40c50c[_0x349649](_0x3a469d['text'],_0x3a469d['value'][_0xdca8('0x6f')],_0x3a469d[_0xdca8('0x6b')]['end']);}break;case _0xdca8('0x74'):_0x3a469d=as['buildExpression']('me',null,_0x10122a);_0x40c50c[_0x349649](_0x3a469d[_0xdca8('0x6e')],_0x3a469d[_0xdca8('0x6b')]['start'],_0x3a469d[_0xdca8('0x6b')]['end']);break;}}else{var _0x3a469d=as['buildExpression'](_0x2613e1,_0x316d3c[_0xdca8('0x6d')],_0x10122a);_0x40c50c[_0x349649](_0x3a469d[_0xdca8('0x6e')],_0x3a469d[_0xdca8('0x6b')]['start'],_0x3a469d[_0xdca8('0x6b')][_0xdca8('0x22')]);}}}else{var _0x2917df=_(_0x37c2d8[_0xdca8('0x41')])[_0xdca8('0x42')]()[_0xdca8('0x35')](function(_0x55ed43){return _[_0xdca8('0x75')](_0xdcf5b8,[_0xdca8('0x33'),_0x55ed43])?_0x55ed43:undefined;})[_0xdca8('0x76')]()['value']();if(!_[_0xdca8('0x77')](_0x2917df)){_0x2917df[_0xdca8('0x3a')](function(_0x56a81d){if(_0x56a81d===_0xdca8('0x78')){_0x41fc0a[_0xdca8('0x49')](_0xdca8('0x79'),[]['concat'](_0x37c2d8[_0xdca8('0x41')][_0x56a81d]));}else if(_0x56a81d===_0xdca8('0x7a')){var _0x59daf8=JSON[_0xdca8('0x7b')](_0x37c2d8['query'][_0x56a81d])[_0xdca8('0x7c')];var _0x40c0af=JSON[_0xdca8('0x7b')](_0x37c2d8[_0xdca8('0x41')][_0x56a81d])[_0xdca8('0x7d')];_0x41fc0a[_0xdca8('0x49')](_0xdca8('0x7e'),_0x59daf8,_0x40c0af);}else{if(_0x37c2d8[_0xdca8('0x41')][_0x56a81d]===_0xdca8('0x7f')){_0x41fc0a[_0xdca8('0x49')]('i.'+_0x56a81d+_0xdca8('0x80'));}else{_0x41fc0a[_0xdca8('0x49')]('i.'+_0x56a81d+_0xdca8('0x81'),_0x37c2d8[_0xdca8('0x41')][_0x56a81d]);}}});}if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x82')]){if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x82')]==0x1){_0x41fc0a[_0xdca8('0x63')]('`unreadMessages`\x20=\x200');}else{_0x41fc0a[_0xdca8('0x63')](_0xdca8('0x83'));}}if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x84')]){_0x176448=_['isArray'](_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x84')])?_0x37c2d8['query'][_0xdca8('0x84')]:new Array(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x84')]);_0x176448[_0xdca8('0x3a')](function(_0x4000e9){_0x22a989['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4000e9+',%');});}if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x85')]){var _0x25dfd8=_0x37c2d8[_0xdca8('0x41')]['filter'][_0xdca8('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xdca8('0x87')](_0x25dfd8)){_0x40c50c['or'](_0xdca8('0x88'),_0x25dfd8+'%')['or'](_0xdca8('0x89'),_0x25dfd8+'%');}else{_0x40c50c['or'](_0xdca8('0x8a'),qs['getFullTextValue'](_0x25dfd8))['or'](_0xdca8('0x8b'),_0x25dfd8+'%');}}}_0x41fc0a['where'](_0x40c50c);_0x41fc0a[_0xdca8('0x8c')](_0xdca8('0x8d'));var _0x2248bd={'type':db[_0xdca8('0x8e')][_0xdca8('0x8f')][_0xdca8('0x90')],'raw':!![]};var _0x218cfa=_0x41fc0a[_0xdca8('0x91')]();_0x218cfa[_0xdca8('0x4c')](_0xdca8('0x8d'));_0x218cfa[_0xdca8('0x4c')](_0xdca8('0x92'),'unreadMessages');if(_0x28e0f0[_0xdca8('0x47')]){_0x28e0f0['order'][_0xdca8('0x3a')](function(_0x286c1a){var _0xaae3a2=_0x286c1a[0x0]===_0xdca8('0x93')?_0x286c1a[0x0]:'i.'+_0x286c1a[0x0];_0x41fc0a[_0xdca8('0x47')](_0xaae3a2,_0x286c1a[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdca8('0x77')](_0x176448)){_0x41fc0a['having'](_0x22a989);_0x218cfa[_0xdca8('0x49')](_0xdca8('0x94'),_0x176448);}BPromise[_0xdca8('0x95')]()[_0xdca8('0x30')](function(){if(!_0x5ecc40){if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x78')])return;_0x218cfa[_0xdca8('0x49')](_0xdca8('0x96'));_0x41fc0a[_0xdca8('0x49')](_0xdca8('0x96'));return;}if(_0x37c2d8['user']['role']!=='agent')return;return _0x37c2d8[_0xdca8('0x97')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xdca8('0x30')](function(_0x2d3e1d){if(_['isEmpty'](_0x2d3e1d)){_0x218cfa[_0xdca8('0x49')]('i.WhatsappAccountId\x20IS\x20NULL');_0x41fc0a['where'](_0xdca8('0x98'));}else{_0x218cfa[_0xdca8('0x49')](_0xdca8('0x79'),_[_0xdca8('0x35')](_0x2d3e1d,'id'));_0x41fc0a[_0xdca8('0x49')](_0xdca8('0x79'),_[_0xdca8('0x35')](_0x2d3e1d,'id'));}});})[_0xdca8('0x30')](function(){if(_0x37c2d8[_0xdca8('0x97')][_0xdca8('0x99')]===_0xdca8('0x9a')&&!_0x5ecc40&&!_0x37c2d8[_0xdca8('0x41')]['WhatsappAccountId'])return[];return db[_0xdca8('0x9b')][_0xdca8('0x41')](_0x218cfa[_0xdca8('0x9c')](),_0x2248bd);})[_0xdca8('0x30')](function(_0x4854b6){_0x5c8b40[_0xdca8('0x27')]=_0x4854b6[_0xdca8('0x46')];if(_0x5c8b40[_0xdca8('0x27')]===0x0)return[];return db['sequelize'][_0xdca8('0x41')](_0x47e900[_0xdca8('0x9c')](),_0x2248bd)[_0xdca8('0x30')](function(_0x6cb44c){_0x15234c=_['keyBy'](_0x6cb44c,'id');_0x2248bd=_['merge'](_0x2248bd,{'model':db[_0xdca8('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x37c2d8['query'][_0xdca8('0x44')]){_0x28e0f0[_0xdca8('0x45')][_0xdca8('0x3a')](function(_0x152713){_0x41fc0a['field']('i.'+_0x152713);});}else{_0x41fc0a[_0xdca8('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdca8('0x62'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0x9d'),_0xdca8('0x9e'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0x9f'),_0xdca8('0xa0'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xa1'),_0xdca8('0x93'));_0x41fc0a[_0xdca8('0x4c')]('i.*');_0x41fc0a[_0xdca8('0x4c')]('c.firstName',_0xdca8('0xa2'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xa3'),_0xdca8('0xa4'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xa5'),_0xdca8('0xa6'));_0x41fc0a[_0xdca8('0x4c')]('c.phone','Contact.phone');_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xa7'),_0xdca8('0xa8'));_0x41fc0a['field']('c.fax',_0xdca8('0xa9'));_0x41fc0a['field'](_0xdca8('0xaa'),'Owner.fullname');_0x41fc0a['field'](_0xdca8('0xab'),'Owner.internal');_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xac'),_0xdca8('0x37'));}if(_0x28e0f0[_0xdca8('0x26')])_0x41fc0a[_0xdca8('0x26')](_0x28e0f0[_0xdca8('0x26')]);if(_0x28e0f0[_0xdca8('0x24')])_0x41fc0a['offset'](_0x28e0f0[_0xdca8('0x24')]);return db[_0xdca8('0x9b')]['query'](_0x41fc0a[_0xdca8('0x9c')](),_0x2248bd);})['then'](function(_0x2ae9a6){if(_0x2ae9a6[_0xdca8('0x46')]>0x0)_0x3a00ef['where']('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x2ae9a6,'id'));return db[_0xdca8('0x9b')]['query'](_0x3a00ef[_0xdca8('0x9c')](),_0x2248bd)['then'](function(_0x27a347){var _0x1a0df1=_['groupBy'](_0x27a347,'WhatsappInteractionId');var _0x3f1544=[];_0x2ae9a6['forEach'](function(_0xf0f2ae){_0x3f1544['push'](updateWhatsappInteraction(_0xf0f2ae,_0x15234c,_0x1a0df1));});return BPromise[_0xdca8('0xad')](_0x3f1544);});});})[_0xdca8('0x30')](function(_0x3fccd8){_0x5c8b40[_0xdca8('0xae')]=_0x3fccd8;return _0x5c8b40;})[_0xdca8('0x30')](respondWithFilteredResult(_0x2f962d,_0x28e0f0))[_0xdca8('0x3c')](handleError(_0x2f962d,null));};exports[_0xdca8('0xaf')]=function(_0x441efe,_0x45117c){var _0x5215ea={'raw':![],'where':{'id':_0x441efe[_0xdca8('0xb0')]['id']}},_0x599e43={};_0x599e43[_0xdca8('0x40')]=_[_0xdca8('0x42')](db[_0xdca8('0x3d')][_0xdca8('0x3e')]);_0x599e43['query']=_[_0xdca8('0x42')](_0x441efe[_0xdca8('0x41')]);_0x599e43['filters']=_[_0xdca8('0x43')](_0x599e43['model'],_0x599e43[_0xdca8('0x41')]);_0x5215ea[_0xdca8('0x45')]=_[_0xdca8('0x43')](_0x599e43[_0xdca8('0x40')],qs[_0xdca8('0x44')](_0x441efe[_0xdca8('0x41')][_0xdca8('0x44')]));_0x5215ea[_0xdca8('0x45')]=_0x5215ea[_0xdca8('0x45')]['length']?_0x5215ea['attributes']:_0x599e43[_0xdca8('0x40')];if(_0x441efe[_0xdca8('0x41')][_0xdca8('0xb1')]){_0x5215ea[_0xdca8('0xb2')]=[{'all':!![]}];}_0x5215ea=_[_0xdca8('0xb3')]({},_0x5215ea,_0x441efe[_0xdca8('0xb4')]);return db[_0xdca8('0x3d')][_0xdca8('0x61')](_0x5215ea)[_0xdca8('0x30')](handleEntityNotFound(_0x45117c,null))[_0xdca8('0x30')](respondWithResult(_0x45117c,null))[_0xdca8('0x3c')](handleError(_0x45117c,null));};exports[_0xdca8('0xb5')]=function(_0x2d6c54,_0x46ab16){return db[_0xdca8('0x3d')][_0xdca8('0xb5')](_0x2d6c54[_0xdca8('0x74')],{})[_0xdca8('0x30')](respondWithResult(_0x46ab16,0xc9))['catch'](handleError(_0x46ab16,null));};exports[_0xdca8('0x2e')]=function(_0x4d1fb6,_0x572329){if(_0x4d1fb6[_0xdca8('0x74')]['id']){delete _0x4d1fb6[_0xdca8('0x74')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x4d1fb6[_0xdca8('0xb0')]['id']}})[_0xdca8('0x30')](handleEntityNotFound(_0x572329,null))[_0xdca8('0x30')](saveUpdates(_0x4d1fb6['body'],null))[_0xdca8('0x30')](respondWithResult(_0x572329,null))['catch'](handleError(_0x572329,null));};exports[_0xdca8('0x2f')]=function(_0x174d34,_0x5bfd42){return db[_0xdca8('0x3d')][_0xdca8('0x61')]({'where':{'id':_0x174d34[_0xdca8('0xb0')]['id']}})[_0xdca8('0x30')](handleEntityNotFound(_0x5bfd42,null))[_0xdca8('0x30')](removeEntity(_0x5bfd42,null))[_0xdca8('0x3c')](handleError(_0x5bfd42,null));};exports[_0xdca8('0xb6')]=function(_0x1d849f,_0x2a52c1){return db[_0xdca8('0x3d')][_0xdca8('0xb6')]()[_0xdca8('0x30')](respondWithResult(_0x2a52c1,null))[_0xdca8('0x3c')](handleError(_0x2a52c1,null));};exports['addMessage']=function(_0x5c2b10,_0xa21d67,_0x5e5984){return db[_0xdca8('0xb7')][_0xdca8('0x61')]({'where':{'id':_0x5c2b10[_0xdca8('0xb0')]['id']}})[_0xdca8('0x30')](handleEntityNotFound(_0xa21d67,null))[_0xdca8('0x30')](function(_0x20ca45){if(_0x20ca45){return _0x20ca45['addMessage'](_0x5c2b10[_0xdca8('0x74')][_0xdca8('0xb8')],_[_0xdca8('0xb9')](_0x5c2b10[_0xdca8('0x74')],['ids','id'])||{});}})[_0xdca8('0x30')](respondWithResult(_0xa21d67,null))['catch'](handleError(_0xa21d67,null));};exports['getMessages']=function(_0x2289b2,_0x4a6d6a,_0x3d02f8){var _0x45a18a={'raw':![],'where':{}};var _0x2accd5={};var _0x8f1d52={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xdca8('0xba')]({'where':{'id':_0x2289b2[_0xdca8('0xb0')]['id']}})['then'](handleEntityNotFound(_0x4a6d6a,null))['then'](function(_0x5c3c55){if(_0x5c3c55){_0x2accd5[_0xdca8('0x40')]=_[_0xdca8('0x42')](db[_0xdca8('0xb7')][_0xdca8('0x3e')]);_0x2accd5[_0xdca8('0x41')]=_[_0xdca8('0x42')](_0x2289b2['query']);_0x2accd5[_0xdca8('0x4a')]=_[_0xdca8('0x43')](_0x2accd5[_0xdca8('0x40')],_0x2accd5[_0xdca8('0x41')]);_0x45a18a[_0xdca8('0x45')]=_[_0xdca8('0x43')](_0x2accd5[_0xdca8('0x40')],qs[_0xdca8('0x44')](_0x2289b2['query'][_0xdca8('0x44')]));_0x45a18a[_0xdca8('0x45')]=_0x45a18a[_0xdca8('0x45')][_0xdca8('0x46')]?_0x45a18a[_0xdca8('0x45')]:_0x2accd5[_0xdca8('0x40')];if(!_0x2289b2[_0xdca8('0x41')]['hasOwnProperty']('nolimit')){_0x45a18a[_0xdca8('0x26')]=qs[_0xdca8('0x26')](_0x2289b2[_0xdca8('0x41')][_0xdca8('0x26')]);_0x45a18a[_0xdca8('0x24')]=qs[_0xdca8('0x24')](_0x2289b2[_0xdca8('0x41')][_0xdca8('0x24')]);}_0x45a18a[_0xdca8('0x47')]=qs[_0xdca8('0x48')](_0x2289b2['query']['sort']);_0x45a18a[_0xdca8('0x49')]=qs[_0xdca8('0x4a')](_[_0xdca8('0xbb')](_0x2289b2[_0xdca8('0x41')],_0x2accd5[_0xdca8('0x4a')]));_0x45a18a[_0xdca8('0x49')][_0xdca8('0xbc')]=_0x5c3c55['id'];if(_0x2289b2['query'][_0xdca8('0x85')]){_0x45a18a[_0xdca8('0x49')]=_[_0xdca8('0xb3')](_0x45a18a[_0xdca8('0x49')],{'$or':_[_0xdca8('0x35')](_0x45a18a[_0xdca8('0x45')],function(_0x3296c8){var _0x1dd14c={};_0x1dd14c[_0x3296c8]={'$like':'%'+_0x2289b2[_0xdca8('0x41')][_0xdca8('0x85')]+'%'};return _0x1dd14c;})});}if(_0x2289b2[_0xdca8('0x41')][_0xdca8('0x7c')]){var _0xdada30=_0x2289b2['query'][_0xdca8('0x7c')]['split'](',');var _0x2e7bff={};_0x2e7bff[_0xdada30[0x0]]={'$gte':moment(_0xdada30[0x1])[_0xdca8('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x45a18a['where']=_[_0xdca8('0xb3')](_0x45a18a[_0xdca8('0x49')],_0x2e7bff);}_0x45a18a=_[_0xdca8('0xb3')]({},_0x45a18a,_0x2289b2[_0xdca8('0xb4')]);return db[_0xdca8('0xb7')][_0xdca8('0x27')]({'where':_0x45a18a[_0xdca8('0x49')]})[_0xdca8('0x30')](function(_0x2f2aef){_0x8f1d52['count']=_0x2f2aef;if(_0x2289b2[_0xdca8('0x41')][_0xdca8('0xb1')]){_0x45a18a[_0xdca8('0xb2')]=[{'all':!![]}];}return db[_0xdca8('0xb7')][_0xdca8('0xbe')](_0x45a18a);})[_0xdca8('0x30')](function(_0x4e1624){_0x8f1d52[_0xdca8('0xae')]=_0x4e1624;return _0x8f1d52;});}})[_0xdca8('0x30')](respondWithFilteredResult(_0x4a6d6a,_0x45a18a))[_0xdca8('0x3c')](handleError(_0x4a6d6a,null));};exports[_0xdca8('0xbf')]=function(_0x57b2af,_0x546481,_0x148b63){return db[_0xdca8('0x3d')]['find']({'where':{'id':_0x57b2af[_0xdca8('0xb0')]['id']}})['then'](handleEntityNotFound(_0x546481,null))['then'](function(_0x555419){if(_0x555419){return _0x555419[_0xdca8('0xc0')](_0x57b2af[_0xdca8('0x74')][_0xdca8('0xb8')],_[_0xdca8('0xb9')](_0x57b2af[_0xdca8('0x74')],[_0xdca8('0xb8'),'id'])||{})[_0xdca8('0xc1')](function(){return db[_0xdca8('0xc2')][_0xdca8('0xbe')]({'attributes':['id',_0xdca8('0x33'),_0xdca8('0x4d')],'where':{'id':_0x57b2af['body'][_0xdca8('0xb8')]}});})[_0xdca8('0x30')](function(_0x107ca1){socket[_0xdca8('0xc3')](_0xdca8('0xc4'),{'id':Number(_0x57b2af[_0xdca8('0xb0')]['id']),'tags':_0x107ca1||[]});return{'id':Number(_0x57b2af[_0xdca8('0xb0')]['id']),'tags':_0x107ca1||[]};});}})[_0xdca8('0x30')](respondWithResult(_0x546481,null))[_0xdca8('0x3c')](handleError(_0x546481,null));};exports[_0xdca8('0xc5')]=function(_0x2925e9,_0x4bf69c,_0x4a5ffc){return db['WhatsappInteraction'][_0xdca8('0x61')]({'where':{'id':_0x2925e9['params']['id']}})[_0xdca8('0x30')](handleEntityNotFound(_0x4bf69c,null))[_0xdca8('0x30')](function(_0xece5b3){if(_0xece5b3){return _0xece5b3[_0xdca8('0xc5')](_0x2925e9[_0xdca8('0x41')][_0xdca8('0xb8')]);}})[_0xdca8('0x30')](respondWithStatusCode(_0x4bf69c,null))[_0xdca8('0x3c')](handleError(_0x4bf69c,null));};exports[_0xdca8('0xc6')]=function(_0x376e3a,_0x9489ee){var _0x3beb25=moment()[_0xdca8('0xc7')]()[_0xdca8('0x9c')]();var _0x7407d9=path[_0xdca8('0xc8')](config[_0xdca8('0xc9')],_0xdca8('0xca'),_0xdca8('0xcb'),'tmp');var _0x5c8457=path[_0xdca8('0xc8')](config[_0xdca8('0xc9')],_0xdca8('0xca'),'files',_0xdca8('0xcc'));var _0x29bcd4=path['join'](_0x7407d9,_0x3beb25);var _0x56e032=util[_0xdca8('0xbd')](_0xdca8('0xcd'),_0x376e3a[_0xdca8('0xb0')]['id'],_0x3beb25);var _0x671c8=path[_0xdca8('0xc8')](_0x7407d9,_0x56e032);var _0x812ac8=[];_0x812ac8[_0xdca8('0x3b')]({'model':db[_0xdca8('0x71')],'as':_0xdca8('0x71'),'attributes':['id',_0xdca8('0x36')],'raw':!![]});_0x812ac8[_0xdca8('0x3b')]({'model':db[_0xdca8('0xce')],'as':_0xdca8('0x66'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x376e3a['query'][_0xdca8('0xcc')]){_0x812ac8[_0xdca8('0x3b')]({'model':db[_0xdca8('0xcf')],'as':_0xdca8('0xcf'),'raw':!![]});}var _0x56d54d=[{'model':db['WhatsappMessage'],'as':_0xdca8('0xd0'),'attributes':['id',_0xdca8('0x74'),_0xdca8('0x7a'),_0xdca8('0xd1'),_0xdca8('0xd2'),_0xdca8('0x82')],'include':_0x812ac8}];_0x56d54d[_0xdca8('0x3b')]({'model':db[_0xdca8('0xd3')],'as':_0xdca8('0xd4'),'attributes':['id',_0xdca8('0x33')]});_0x56d54d[_0xdca8('0x3b')]({'model':db[_0xdca8('0x71')],'as':'Owner','attributes':['id','fullname']});return db[_0xdca8('0x3d')][_0xdca8('0x61')]({'where':{'id':_0x376e3a[_0xdca8('0xb0')]['id']},'include':_0x56d54d})[_0xdca8('0x30')](handleEntityNotFound(_0x9489ee,null))['then'](function(_0x281525){if(_0x281525){var _0x4f49c1=_0x281525['get']({'plain':!![]});fs[_0xdca8('0xd5')](_0x29bcd4);var _0x2b38e4={'channel':'Whatsapp','account':_0x4f49c1['Account']['name'],'agent':_0x4f49c1[_0xdca8('0xd6')]?_0x4f49c1[_0xdca8('0xd6')][_0xdca8('0x36')]:'N.A.','createdAt':moment(_0x4f49c1['createdAt'])[_0xdca8('0xbd')](_0xdca8('0xd7'))[_0xdca8('0x9c')](),'closedAt':_0x4f49c1[_0xdca8('0xd8')]?moment(_0x4f49c1[_0xdca8('0xd9')])[_0xdca8('0xbd')](_0xdca8('0xd7'))[_0xdca8('0x9c')]():'','disposition':_0x4f49c1[_0xdca8('0xda')],'messages':_(_0x4f49c1[_0xdca8('0xd0')])[_0xdca8('0x85')]({'secret':![]})[_0xdca8('0x35')](function(_0x2dac3f){if(_0x2dac3f['Attachment']){var _0x213a5f=path[_0xdca8('0xc8')](_0x5c8457,_0x2dac3f['Attachment'][_0xdca8('0xdb')]);if(fs[_0xdca8('0xdc')](_0x213a5f)){fs[_0xdca8('0xdd')](_0x213a5f)[_0xdca8('0xde')](fs[_0xdca8('0xdf')](path[_0xdca8('0xc8')](_0x29bcd4,_0x2dac3f[_0xdca8('0xcf')]['basename'])));}}return{'date':moment(_0x2dac3f[_0xdca8('0x7a')])[_0xdca8('0xbd')](_0xdca8('0xd7'))[_0xdca8('0x9c')](),'sender':_0x2dac3f['direction']===_0xdca8('0xe0')?_0x2dac3f[_0xdca8('0x71')]?_0x2dac3f[_0xdca8('0x71')]['fullname']:_0xdca8('0xe1'):_0x2dac3f[_0xdca8('0x66')][_0xdca8('0xe2')]+(_0x2dac3f[_0xdca8('0x66')][_0xdca8('0xe3')]?'\x20'+_0x2dac3f['Contact']['lastName']:''),'body':_0x2dac3f[_0xdca8('0xcf')]?_0x2dac3f[_0xdca8('0xcf')][_0xdca8('0xdb')]:_0x2dac3f[_0xdca8('0x74')],'direction':_0x2dac3f[_0xdca8('0xd1')]===_0xdca8('0xe0')?'A':'C','secret':_0x2dac3f[_0xdca8('0xd2')],'read':_0x2dac3f['read'],'attachment':_0x2dac3f[_0xdca8('0xcf')]};})[_0xdca8('0x6b')]()};return ejs[_0xdca8('0xe4')](path[_0xdca8('0xc8')](config[_0xdca8('0xc9')],_0xdca8('0xca'),_0xdca8('0xe5'),'downloadInteraction.ejs'),{'interaction':_0x2b38e4})[_0xdca8('0x30')](function(_0x1ed620){var _0x2b45b7=path[_0xdca8('0xc8')](_0x29bcd4,_0xdca8('0xe6')+_0x4f49c1['id']+'-'+_0x3beb25+_0xdca8('0xe7'));var _0xc1656a={'path':_0x2b45b7,'channel':_0xdca8('0xe8'),'interactionId':_0x4f49c1['id']};return pdf[_0xdca8('0xe9')](_0x1ed620,_0xc1656a);})[_0xdca8('0x30')](function(){return new BPromise(function(_0x5a4e6a,_0x4700e3){zipdir(_0x29bcd4,{'saveTo':_0x671c8},function(_0x46299d,_0x33cf14){if(_0x46299d)return _0x4700e3(_0x46299d);return _0x5a4e6a(_0x33cf14);});})[_0xdca8('0x30')](function(){return new BPromise(function(_0x5dbad6,_0x4b3e80){rimraf(_0x29bcd4,function(_0x348f8b){if(_0x348f8b)_0x4b3e80(_0x348f8b);return _0x5dbad6();});});})[_0xdca8('0x30')](function(){return _0x9489ee[_0xdca8('0xc6')](_0x671c8,_0x56e032,function(_0x26499c){if(_0x26499c){console[_0xdca8('0xea')]('err',_0x26499c);}else{fs[_0xdca8('0xeb')](_0x671c8);}});});});}else{return _0x9489ee['sendStatus'](0xc8);}})['catch'](handleError(_0x9489ee,null));}; \ No newline at end of file +var _0x1229=['order','sort','where','pick','select','field','color','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','from','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','length','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','UserId','body','keys','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','push','all','params','rawAttributes','includeAll','include','options','create','update','destroy','describe','WhatsappMessage','addMessage','omit','ids','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','closed','disposition','basename','createReadStream','pipe','createWriteStream','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','WhatsappInteraction','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x1229,0xac));var _0x9122=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1229[_0x209941];return _0x1e8729;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9122('0x0'));var zipdir=require(_0x9122('0x1'));var jsonpatch=require(_0x9122('0x2'));var rp=require(_0x9122('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9122('0x4'));var util=require('util');var path=require(_0x9122('0x5'));var sox=require(_0x9122('0x6'));var csv=require(_0x9122('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9122('0x8'));var _=require(_0x9122('0x9'));var squel=require(_0x9122('0xa'));var crypto=require(_0x9122('0xb'));var jsforce=require(_0x9122('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9122('0x7'));var querystring=require('querystring');var Papa=require(_0x9122('0xd'));var Redis=require(_0x9122('0xe'));var authService=require(_0x9122('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x9122('0x10'));var hardwareService=require(_0x9122('0x11'));var logger=require('../../config/logger')(_0x9122('0x12'));var utils=require(_0x9122('0x13'));var config=require(_0x9122('0x14'));var licenseUtil=require(_0x9122('0x15'));var db=require(_0x9122('0x16'))['db'];config[_0x9122('0x17')]=_[_0x9122('0x18')](config['redis'],{'host':_0x9122('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x9122('0x1a')](socket);function respondWithStatusCode(_0x2da686,_0x10b23f){_0x10b23f=_0x10b23f||0xcc;return function(_0x1f51d7){if(_0x1f51d7){return _0x2da686['sendStatus'](_0x10b23f);}return _0x2da686[_0x9122('0x1b')](_0x10b23f)[_0x9122('0x1c')]();};}function respondWithResult(_0x466b4c,_0x174728){_0x174728=_0x174728||0xc8;return function(_0x388244){if(_0x388244){return _0x466b4c[_0x9122('0x1b')](_0x174728)[_0x9122('0x1d')](_0x388244);}};}function respondWithFilteredResult(_0x3ae212,_0x19a244){return function(_0x58a948){if(_0x58a948){var _0x37d787=typeof _0x19a244[_0x9122('0x1e')]==='undefined'&&typeof _0x19a244[_0x9122('0x1f')]===_0x9122('0x20');var _0xe133e7=_0x58a948[_0x9122('0x21')];var _0x1e6b90=_0x37d787?0x0:_0x19a244[_0x9122('0x1e')];var _0x2f2ce5=_0x37d787?_0x58a948[_0x9122('0x21')]:_0x19a244['offset']+_0x19a244[_0x9122('0x1f')];var _0x7dae87;if(_0x2f2ce5>=_0xe133e7){_0x2f2ce5=_0xe133e7;_0x7dae87=0xc8;}else{_0x7dae87=0xce;}_0x3ae212[_0x9122('0x1b')](_0x7dae87);return _0x3ae212['set'](_0x9122('0x22'),_0x1e6b90+'-'+_0x2f2ce5+'/'+_0xe133e7)[_0x9122('0x1d')](_0x58a948);}return null;};}function patchUpdates(_0x37698d){return function(_0x2c38d2){try{jsonpatch['apply'](_0x2c38d2,_0x37698d,!![]);}catch(_0x11cfcd){return BPromise[_0x9122('0x23')](_0x11cfcd);}return _0x2c38d2[_0x9122('0x24')]();};}function saveUpdates(_0x5d1d1b,_0x36bb3e){return function(_0x488800){if(_0x488800){return _0x488800['update'](_0x5d1d1b)[_0x9122('0x25')](function(_0x55f026){return _0x55f026;});}return null;};}function removeEntity(_0x3650a9,_0x5926fd){return function(_0x28bd68){if(_0x28bd68){return _0x28bd68['destroy']()[_0x9122('0x25')](function(){_0x3650a9[_0x9122('0x1b')](0xcc)[_0x9122('0x1c')]();});}};}function handleEntityNotFound(_0x5c7c61,_0x4edd8f){return function(_0x318319){if(!_0x318319){_0x5c7c61[_0x9122('0x26')](0x194);}return _0x318319;};}function handleError(_0x4e4302,_0x476a06){_0x476a06=_0x476a06||0x1f4;return function(_0x168c6d){logger[_0x9122('0x27')](_0x168c6d[_0x9122('0x28')]);if(_0x168c6d[_0x9122('0x29')]){delete _0x168c6d[_0x9122('0x29')];}_0x4e4302[_0x9122('0x1b')](_0x476a06)[_0x9122('0x2a')](_0x168c6d);};}function getInteractionUsers(_0x299ee9,_0x426901){return new BPromise(function(_0x168017,_0x4c71ad){try{if(_0x426901[_0x299ee9['id']]){_0x299ee9[_0x9122('0x2b')]=_[_0x9122('0x2c')](_0x426901[_0x299ee9['id']],function(_0x3b0ec2){return{'id':_0x3b0ec2['id'],'fullname':_0x3b0ec2[_0x9122('0x2d')]};});}}catch(_0x116df0){_0x4c71ad(_0x116df0);}_0x168017(_0x299ee9);});}function getInteractionTags(_0x29dfb5,_0x54f309){return new BPromise(function(_0x1a2394,_0x4728bb){try{if(_0x29dfb5[_0x9122('0x2e')]){_0x29dfb5[_0x9122('0x2f')]=[];_0x29dfb5[_0x9122('0x2e')][_0x9122('0x30')](',')[_0x9122('0x31')](function(_0xdb4224){_0x29dfb5[_0x9122('0x2f')]['push'](_0x54f309[_0xdb4224]);});}delete _0x29dfb5['TagIds'];}catch(_0x4619c2){_0x4728bb(_0x4619c2);}_0x1a2394(_0x29dfb5);});}function updateWhatsappInteraction(_0x2d8f31,_0x1a1ce6,_0x536113){return new BPromise(function(_0x101fe9,_0xf6d02c){return getInteractionUsers(_0x2d8f31,_0x536113)[_0x9122('0x25')](function(_0x23e735){return getInteractionTags(_0x23e735,_0x1a1ce6);})[_0x9122('0x25')](function(_0x298efc){_0x101fe9(_0x298efc);})[_0x9122('0x32')](function(_0x273f5d){_0xf6d02c(_0x273f5d);});});}exports[_0x9122('0x33')]=function(_0x4b4e9b,_0xdda2ac){var _0x447a41={},_0x20fc81={},_0x2e22bd={'count':0x0,'rows':[]};var _0x431a7e=_[_0x9122('0x2c')](db[_0x9122('0x34')]['rawAttributes'],function(_0x2a2ae6){return{'name':_0x2a2ae6[_0x9122('0x35')],'type':_0x2a2ae6['type']['key']};});_0x20fc81[_0x9122('0x36')]=_[_0x9122('0x2c')](_0x431a7e,_0x9122('0x29'));_0x20fc81[_0x9122('0x37')]=_['keys'](_0x4b4e9b['query']);_0x20fc81[_0x9122('0x38')]=_[_0x9122('0x39')](_0x20fc81[_0x9122('0x36')],_0x20fc81[_0x9122('0x37')]);_0x447a41[_0x9122('0x3a')]=_['intersection'](_0x20fc81[_0x9122('0x36')],qs[_0x9122('0x3b')](_0x4b4e9b[_0x9122('0x37')][_0x9122('0x3b')]));_0x447a41[_0x9122('0x3a')]=_0x447a41[_0x9122('0x3a')]['length']?_0x447a41[_0x9122('0x3a')]:_0x20fc81[_0x9122('0x36')];if(!_0x4b4e9b['query'][_0x9122('0x3c')](_0x9122('0x3d'))){_0x447a41['limit']=qs['limit'](_0x4b4e9b[_0x9122('0x37')][_0x9122('0x1f')]);_0x447a41[_0x9122('0x1e')]=qs[_0x9122('0x1e')](_0x4b4e9b[_0x9122('0x37')][_0x9122('0x1e')]);}_0x447a41[_0x9122('0x3e')]=qs[_0x9122('0x3f')](_0x4b4e9b[_0x9122('0x37')][_0x9122('0x3f')]);_0x447a41[_0x9122('0x40')]=qs[_0x9122('0x38')](_[_0x9122('0x41')](_0x4b4e9b[_0x9122('0x37')],_0x20fc81[_0x9122('0x38')]),_0x431a7e);var _0x2440dc=[];var _0x4ece34=squel[_0x9122('0x42')]()[_0x9122('0x43')]('id')[_0x9122('0x43')](_0x9122('0x29'))[_0x9122('0x43')](_0x9122('0x44'))['from']('tools_tags');var _0x1fa8d9=squel['select']()[_0x9122('0x43')](_0x9122('0x45'))[_0x9122('0x43')](_0x9122('0x46'))[_0x9122('0x43')](_0x9122('0x47'))['from'](_0x9122('0x48'),'ui')[_0x9122('0x49')](_0x9122('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x373fd2=squel['select']()[_0x9122('0x4b')](_0x9122('0x4c'),'i')[_0x9122('0x49')]('cm_contacts','c',_0x9122('0x4d'))[_0x9122('0x49')]('users','o',_0x9122('0x4e'))[_0x9122('0x49')](_0x9122('0x4f'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x9122('0x49')](_0x9122('0x50'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x9122('0x51'),'it',_0x9122('0x52'))[_0x9122('0x49')](_0x9122('0x53'),'t',_0x9122('0x54'));var _0x5bf8dd=squel[_0x9122('0x55')]();var _0x42b5be=[];var _0x394636=squel[_0x9122('0x55')]();var _0x1977a9;if(_0x4b4e9b[_0x9122('0x37')][_0x9122('0x56')]){_0x1977a9=as[_0x9122('0x57')](_0x4b4e9b[_0x9122('0x37')][_0x9122('0x56')]);var _0x226da7=_0x1977a9[_0x9122('0x58')];for(var _0x33ceaa=0x0;_0x33ceaa<_0x1977a9[_0x9122('0x59')]['length'];_0x33ceaa++){var _0x196c13=_0x1977a9[_0x9122('0x59')][_0x33ceaa];var _0x1e275f='i';var _0x235d6e=_[_0x9122('0x5a')](_0x431a7e,[_0x9122('0x29'),_0x196c13['field']]);if(!_0x235d6e){switch(_0x196c13['field']){case _0x9122('0x5b'):if(_0x196c13[_0x9122('0x5c')]==0x1){_0x373fd2['having']('`'+_0x196c13['field']+_0x9122('0x5d'));}else{_0x373fd2[_0x9122('0x5e')]('`'+_0x196c13[_0x9122('0x43')]+'`\x20>\x200');}break;case _0x9122('0x5f'):if(_0x196c13['operator']==='$substring'){if(_0x196c13[_0x9122('0x5c')][_0x9122('0x30')]('\x20')[_0x9122('0x60')]>0x1){_0x5bf8dd[_0x226da7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9122('0x61')](_0x196c13[_0x9122('0x5c')]),null);}else{var _0x214da4='%'+_0x196c13['value']+'%';_0x5bf8dd[_0x226da7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x214da4,_0x214da4,_0x214da4);}}else{_0x235d6e=_['find'](_0x431a7e,['name',_0x9122('0x62')]);_0x196c13[_0x9122('0x43')]=_0x9122('0x62');_0x4ab233=as[_0x9122('0x63')](_0x1e275f,_0x235d6e[_0x9122('0x64')],_0x196c13);_0x5bf8dd[_0x226da7](_0x4ab233[_0x9122('0x65')],_0x4ab233[_0x9122('0x5c')][_0x9122('0x66')],_0x4ab233[_0x9122('0x5c')]['end']);}break;case _0x9122('0x67'):var _0x2da3de=_0x196c13['value'][_0x9122('0x30')](',')[_0x9122('0x2c')](function(_0x112024){return Number(_0x112024);});_0x2da3de[_0x9122('0x31')](function(_0x44cc31){_0x394636['or'](_0x9122('0x68'),'%,'+_0x44cc31+',%');});_0x42b5be=_[_0x9122('0x69')](_0x42b5be,_0x2da3de);break;case'User':if(_0x196c13[_0x9122('0x6a')]===_0x9122('0x6b')){_0x5bf8dd[_0x226da7]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x196c13['value']+'%',null);}else{_0x235d6e=_[_0x9122('0x5a')](_0x431a7e,[_0x9122('0x29'),_0x9122('0x6c')]);_0x196c13[_0x9122('0x43')]=_0x9122('0x6c');_0x4ab233=as[_0x9122('0x63')](_0x1e275f,_0x235d6e[_0x9122('0x64')],_0x196c13);_0x5bf8dd[_0x226da7](_0x4ab233[_0x9122('0x65')],_0x4ab233[_0x9122('0x5c')][_0x9122('0x66')],_0x4ab233[_0x9122('0x5c')][_0x9122('0x1c')]);}break;case _0x9122('0x6d'):_0x4ab233=as[_0x9122('0x63')]('me',null,_0x196c13);_0x5bf8dd[_0x226da7](_0x4ab233['text'],_0x4ab233[_0x9122('0x5c')][_0x9122('0x66')],_0x4ab233['value']['end']);break;}}else{var _0x4ab233=as[_0x9122('0x63')](_0x1e275f,_0x235d6e[_0x9122('0x64')],_0x196c13);_0x5bf8dd[_0x226da7](_0x4ab233[_0x9122('0x65')],_0x4ab233['value']['start'],_0x4ab233[_0x9122('0x5c')][_0x9122('0x1c')]);}}}else{var _0x2b64f7=_(_0x4b4e9b[_0x9122('0x37')])[_0x9122('0x6e')]()['map'](function(_0x1b2ca2){return _[_0x9122('0x6f')](_0x431a7e,['name',_0x1b2ca2])?_0x1b2ca2:undefined;})['compact']()['value']();if(!_[_0x9122('0x70')](_0x2b64f7)){_0x2b64f7[_0x9122('0x31')](function(_0x3de908){if(_0x3de908===_0x9122('0x71')){_0x373fd2[_0x9122('0x40')](_0x9122('0x72'),[][_0x9122('0x73')](_0x4b4e9b['query'][_0x3de908]));}else if(_0x3de908===_0x9122('0x74')){var _0x2bf149=JSON[_0x9122('0x75')](_0x4b4e9b[_0x9122('0x37')][_0x3de908])['$gte'];var _0x8ea4e6=JSON[_0x9122('0x75')](_0x4b4e9b['query'][_0x3de908])[_0x9122('0x76')];_0x373fd2[_0x9122('0x40')](_0x9122('0x77'),_0x2bf149,_0x8ea4e6);}else{if(_0x4b4e9b[_0x9122('0x37')][_0x3de908]===_0x9122('0x78')){_0x373fd2['where']('i.'+_0x3de908+'\x20IS\x20NULL');}else{_0x373fd2[_0x9122('0x40')]('i.'+_0x3de908+_0x9122('0x79'),_0x4b4e9b[_0x9122('0x37')][_0x3de908]);}}});}if(_0x4b4e9b['query'][_0x9122('0x7a')]){if(_0x4b4e9b['query'][_0x9122('0x7a')]==0x1){_0x373fd2[_0x9122('0x5e')](_0x9122('0x7b'));}else{_0x373fd2[_0x9122('0x5e')](_0x9122('0x7c'));}}if(_0x4b4e9b[_0x9122('0x37')]['tag']){_0x42b5be=_['isArray'](_0x4b4e9b['query'][_0x9122('0x7d')])?_0x4b4e9b[_0x9122('0x37')][_0x9122('0x7d')]:new Array(_0x4b4e9b[_0x9122('0x37')]['tag']);_0x42b5be['forEach'](function(_0x51c0fb){_0x394636['or'](_0x9122('0x68'),'%,'+_0x51c0fb+',%');});}if(_0x4b4e9b[_0x9122('0x37')][_0x9122('0x7e')]){var _0x10a80c=_0x4b4e9b['query'][_0x9122('0x7e')][_0x9122('0x7f')]('\x5c','\x5c\x5c')[_0x9122('0x7f')](/'/g,'\x27\x27');if(qs[_0x9122('0x80')](_0x10a80c)){_0x5bf8dd['or'](_0x9122('0x81'),_0x10a80c+'%')['or'](_0x9122('0x82'),_0x10a80c+'%');}else{_0x5bf8dd['or'](_0x9122('0x83'),qs[_0x9122('0x61')](_0x10a80c))['or'](_0x9122('0x84'),_0x10a80c+'%');}}}_0x373fd2['where'](_0x5bf8dd);_0x373fd2[_0x9122('0x85')](_0x9122('0x86'));var _0xa7684a={'type':db[_0x9122('0x87')][_0x9122('0x88')][_0x9122('0x89')],'raw':!![]};var _0x3b1824=_0x373fd2[_0x9122('0x8a')]();_0x3b1824[_0x9122('0x43')](_0x9122('0x86'));_0x3b1824[_0x9122('0x43')](_0x9122('0x8b'),'unreadMessages');if(_0x447a41[_0x9122('0x3e')]){_0x447a41[_0x9122('0x3e')][_0x9122('0x31')](function(_0x24b48f){var _0x8bb922=_0x24b48f[0x0]===_0x9122('0x8c')?_0x24b48f[0x0]:'i.'+_0x24b48f[0x0];_0x373fd2[_0x9122('0x3e')](_0x8bb922,_0x24b48f[0x1]===_0x9122('0x8d')?![]:!![]);});}if(!_['isEmpty'](_0x42b5be)){_0x373fd2['having'](_0x394636);_0x3b1824['where']('t.id\x20IN\x20?',_0x42b5be);}BPromise[_0x9122('0x8e')]()[_0x9122('0x25')](function(){if(!_0x1977a9){if(_0x4b4e9b[_0x9122('0x37')]['WhatsappAccountId'])return;_0x3b1824[_0x9122('0x40')](_0x9122('0x8f'));_0x373fd2[_0x9122('0x40')](_0x9122('0x8f'));return;}if(_0x4b4e9b[_0x9122('0x90')]['role']!==_0x9122('0x91'))return;return _0x4b4e9b[_0x9122('0x90')][_0x9122('0x92')]({'attributes':['id'],'raw':!![]})[_0x9122('0x25')](function(_0x4600b1){if(_[_0x9122('0x70')](_0x4600b1)){_0x3b1824[_0x9122('0x40')](_0x9122('0x93'));_0x373fd2[_0x9122('0x40')](_0x9122('0x93'));}else{_0x3b1824['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x4600b1,'id'));_0x373fd2[_0x9122('0x40')]('i.WhatsappAccountId\x20IN\x20?',_[_0x9122('0x2c')](_0x4600b1,'id'));}});})[_0x9122('0x25')](function(){if(_0x4b4e9b[_0x9122('0x90')][_0x9122('0x94')]===_0x9122('0x91')&&!_0x1977a9&&!_0x4b4e9b[_0x9122('0x37')]['WhatsappAccountId'])return[];return db[_0x9122('0x95')]['query'](_0x3b1824[_0x9122('0x96')](),_0xa7684a);})[_0x9122('0x25')](function(_0x132802){_0x2e22bd[_0x9122('0x21')]=_0x132802['length'];if(_0x2e22bd['count']===0x0)return[];return db['sequelize'][_0x9122('0x37')](_0x4ece34[_0x9122('0x96')](),_0xa7684a)['then'](function(_0x201bc9){_0x2440dc=_['keyBy'](_0x201bc9,'id');_0xa7684a=_[_0x9122('0x97')](_0xa7684a,{'model':db[_0x9122('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b4e9b[_0x9122('0x37')][_0x9122('0x3b')]){_0x447a41[_0x9122('0x3a')][_0x9122('0x31')](function(_0x52bede){_0x373fd2['field']('i.'+_0x52bede);});}else{_0x373fd2['field'](_0x9122('0x8b'),_0x9122('0x5b'));_0x373fd2['field'](_0x9122('0x98'),_0x9122('0x99'));_0x373fd2[_0x9122('0x43')]('a.mandatoryDisposition',_0x9122('0x9a'));_0x373fd2[_0x9122('0x43')](_0x9122('0x9b'),_0x9122('0x8c'));_0x373fd2[_0x9122('0x43')](_0x9122('0x9c'));_0x373fd2[_0x9122('0x43')](_0x9122('0x9d'),_0x9122('0x9e'));_0x373fd2[_0x9122('0x43')]('c.lastName',_0x9122('0x9f'));_0x373fd2[_0x9122('0x43')](_0x9122('0xa0'),_0x9122('0xa1'));_0x373fd2[_0x9122('0x43')](_0x9122('0xa2'),'Contact.phone');_0x373fd2[_0x9122('0x43')](_0x9122('0xa3'),'Contact.mobile');_0x373fd2['field'](_0x9122('0xa4'),_0x9122('0xa5'));_0x373fd2['field'](_0x9122('0xa6'),_0x9122('0xa7'));_0x373fd2[_0x9122('0x43')](_0x9122('0xa8'),_0x9122('0xa9'));_0x373fd2[_0x9122('0x43')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9122('0x2e'));}if(_0x447a41[_0x9122('0x1f')])_0x373fd2[_0x9122('0x1f')](_0x447a41[_0x9122('0x1f')]);if(_0x447a41[_0x9122('0x1e')])_0x373fd2[_0x9122('0x1e')](_0x447a41[_0x9122('0x1e')]);return db[_0x9122('0x95')][_0x9122('0x37')](_0x373fd2[_0x9122('0x96')](),_0xa7684a);})['then'](function(_0x309190){if(_0x309190[_0x9122('0x60')]>0x0)_0x1fa8d9[_0x9122('0x40')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x9122('0x2c')](_0x309190,'id'));return db[_0x9122('0x95')][_0x9122('0x37')](_0x1fa8d9[_0x9122('0x96')](),_0xa7684a)[_0x9122('0x25')](function(_0x529efb){var _0x3ad2e7=_[_0x9122('0xaa')](_0x529efb,'WhatsappInteractionId');var _0x993055=[];_0x309190[_0x9122('0x31')](function(_0x5e6c71){_0x993055[_0x9122('0xab')](updateWhatsappInteraction(_0x5e6c71,_0x2440dc,_0x3ad2e7));});return BPromise[_0x9122('0xac')](_0x993055);});});})[_0x9122('0x25')](function(_0x3829f7){_0x2e22bd['rows']=_0x3829f7;return _0x2e22bd;})[_0x9122('0x25')](respondWithFilteredResult(_0xdda2ac,_0x447a41))[_0x9122('0x32')](handleError(_0xdda2ac,null));};exports['show']=function(_0x127fb7,_0x440ce7){var _0x1477f1={'raw':![],'where':{'id':_0x127fb7[_0x9122('0xad')]['id']}},_0x386046={};_0x386046[_0x9122('0x36')]=_[_0x9122('0x6e')](db[_0x9122('0x34')][_0x9122('0xae')]);_0x386046[_0x9122('0x37')]=_[_0x9122('0x6e')](_0x127fb7['query']);_0x386046[_0x9122('0x38')]=_[_0x9122('0x39')](_0x386046['model'],_0x386046[_0x9122('0x37')]);_0x1477f1[_0x9122('0x3a')]=_[_0x9122('0x39')](_0x386046[_0x9122('0x36')],qs[_0x9122('0x3b')](_0x127fb7['query'][_0x9122('0x3b')]));_0x1477f1['attributes']=_0x1477f1[_0x9122('0x3a')][_0x9122('0x60')]?_0x1477f1[_0x9122('0x3a')]:_0x386046[_0x9122('0x36')];if(_0x127fb7[_0x9122('0x37')][_0x9122('0xaf')]){_0x1477f1[_0x9122('0xb0')]=[{'all':!![]}];}_0x1477f1=_[_0x9122('0x97')]({},_0x1477f1,_0x127fb7[_0x9122('0xb1')]);return db[_0x9122('0x34')]['find'](_0x1477f1)[_0x9122('0x25')](handleEntityNotFound(_0x440ce7,null))[_0x9122('0x25')](respondWithResult(_0x440ce7,null))[_0x9122('0x32')](handleError(_0x440ce7,null));};exports['create']=function(_0x21af5d,_0x39c581){return db['WhatsappInteraction'][_0x9122('0xb2')](_0x21af5d[_0x9122('0x6d')],{})[_0x9122('0x25')](respondWithResult(_0x39c581,0xc9))[_0x9122('0x32')](handleError(_0x39c581,null));};exports[_0x9122('0xb3')]=function(_0x44c77c,_0xec17ea){if(_0x44c77c['body']['id']){delete _0x44c77c[_0x9122('0x6d')]['id'];}return db[_0x9122('0x34')][_0x9122('0x5a')]({'where':{'id':_0x44c77c['params']['id']}})[_0x9122('0x25')](handleEntityNotFound(_0xec17ea,null))[_0x9122('0x25')](saveUpdates(_0x44c77c[_0x9122('0x6d')],null))['then'](respondWithResult(_0xec17ea,null))[_0x9122('0x32')](handleError(_0xec17ea,null));};exports[_0x9122('0xb4')]=function(_0x31bb5e,_0x4d8362){return db[_0x9122('0x34')][_0x9122('0x5a')]({'where':{'id':_0x31bb5e['params']['id']}})['then'](handleEntityNotFound(_0x4d8362,null))[_0x9122('0x25')](removeEntity(_0x4d8362,null))[_0x9122('0x32')](handleError(_0x4d8362,null));};exports[_0x9122('0xb5')]=function(_0x1fb9c8,_0x2ea312){return db[_0x9122('0x34')][_0x9122('0xb5')]()['then'](respondWithResult(_0x2ea312,null))[_0x9122('0x32')](handleError(_0x2ea312,null));};exports['addMessage']=function(_0x2f5947,_0x522425,_0x7e2d97){return db[_0x9122('0xb6')][_0x9122('0x5a')]({'where':{'id':_0x2f5947[_0x9122('0xad')]['id']}})[_0x9122('0x25')](handleEntityNotFound(_0x522425,null))[_0x9122('0x25')](function(_0x299ea4){if(_0x299ea4){return _0x299ea4[_0x9122('0xb7')](_0x2f5947['body']['ids'],_[_0x9122('0xb8')](_0x2f5947[_0x9122('0x6d')],[_0x9122('0xb9'),'id'])||{});}})[_0x9122('0x25')](respondWithResult(_0x522425,null))[_0x9122('0x32')](handleError(_0x522425,null));};exports['getMessages']=function(_0x5a93f9,_0x1fc380,_0x135ba8){var _0x5cf0f1={'raw':![],'where':{}};var _0x51bb40={};var _0x30964e={'count':0x0,'rows':[]};return db[_0x9122('0x34')]['findOne']({'where':{'id':_0x5a93f9[_0x9122('0xad')]['id']}})[_0x9122('0x25')](handleEntityNotFound(_0x1fc380,null))[_0x9122('0x25')](function(_0x24a859){if(_0x24a859){_0x51bb40[_0x9122('0x36')]=_[_0x9122('0x6e')](db['WhatsappMessage'][_0x9122('0xae')]);_0x51bb40[_0x9122('0x37')]=_[_0x9122('0x6e')](_0x5a93f9[_0x9122('0x37')]);_0x51bb40[_0x9122('0x38')]=_[_0x9122('0x39')](_0x51bb40[_0x9122('0x36')],_0x51bb40[_0x9122('0x37')]);_0x5cf0f1['attributes']=_[_0x9122('0x39')](_0x51bb40['model'],qs[_0x9122('0x3b')](_0x5a93f9[_0x9122('0x37')][_0x9122('0x3b')]));_0x5cf0f1['attributes']=_0x5cf0f1['attributes'][_0x9122('0x60')]?_0x5cf0f1[_0x9122('0x3a')]:_0x51bb40[_0x9122('0x36')];if(!_0x5a93f9['query']['hasOwnProperty'](_0x9122('0x3d'))){_0x5cf0f1[_0x9122('0x1f')]=qs[_0x9122('0x1f')](_0x5a93f9[_0x9122('0x37')]['limit']);_0x5cf0f1[_0x9122('0x1e')]=qs['offset'](_0x5a93f9['query'][_0x9122('0x1e')]);}_0x5cf0f1[_0x9122('0x3e')]=qs['sort'](_0x5a93f9[_0x9122('0x37')]['sort']);_0x5cf0f1['where']=qs[_0x9122('0x38')](_[_0x9122('0x41')](_0x5a93f9[_0x9122('0x37')],_0x51bb40[_0x9122('0x38')]));_0x5cf0f1[_0x9122('0x40')][_0x9122('0xba')]=_0x24a859['id'];if(_0x5a93f9[_0x9122('0x37')][_0x9122('0x7e')]){_0x5cf0f1[_0x9122('0x40')]=_[_0x9122('0x97')](_0x5cf0f1[_0x9122('0x40')],{'$or':_[_0x9122('0x2c')](_0x5cf0f1[_0x9122('0x3a')],function(_0x3837df){var _0x22f9fd={};_0x22f9fd[_0x3837df]={'$like':'%'+_0x5a93f9[_0x9122('0x37')]['filter']+'%'};return _0x22f9fd;})});}if(_0x5a93f9[_0x9122('0x37')][_0x9122('0xbb')]){var _0x71f034=_0x5a93f9['query'][_0x9122('0xbb')][_0x9122('0x30')](',');var _0x272b87={};_0x272b87[_0x71f034[0x0]]={'$gte':moment(_0x71f034[0x1])[_0x9122('0xbc')](_0x9122('0xbd'))};_0x5cf0f1[_0x9122('0x40')]=_[_0x9122('0x97')](_0x5cf0f1[_0x9122('0x40')],_0x272b87);}_0x5cf0f1=_[_0x9122('0x97')]({},_0x5cf0f1,_0x5a93f9[_0x9122('0xb1')]);return db['WhatsappMessage'][_0x9122('0x21')]({'where':_0x5cf0f1['where']})['then'](function(_0x1c57db){_0x30964e['count']=_0x1c57db;if(_0x5a93f9['query']['includeAll']){_0x5cf0f1[_0x9122('0xb0')]=[{'all':!![]}];}return db[_0x9122('0xb6')][_0x9122('0xbe')](_0x5cf0f1);})[_0x9122('0x25')](function(_0x25b069){_0x30964e[_0x9122('0xbf')]=_0x25b069;return _0x30964e;});}})['then'](respondWithFilteredResult(_0x1fc380,_0x5cf0f1))[_0x9122('0x32')](handleError(_0x1fc380,null));};exports[_0x9122('0xc0')]=function(_0x2c6a08,_0x5db843,_0x944408){return db[_0x9122('0x34')]['find']({'where':{'id':_0x2c6a08[_0x9122('0xad')]['id']}})[_0x9122('0x25')](handleEntityNotFound(_0x5db843,null))[_0x9122('0x25')](function(_0x3eafcc){if(_0x3eafcc){return _0x3eafcc[_0x9122('0xc1')](_0x2c6a08[_0x9122('0x6d')][_0x9122('0xb9')],_[_0x9122('0xb8')](_0x2c6a08[_0x9122('0x6d')],[_0x9122('0xb9'),'id'])||{})['spread'](function(){return db[_0x9122('0x67')]['findAll']({'attributes':['id',_0x9122('0x29'),_0x9122('0x44')],'where':{'id':_0x2c6a08[_0x9122('0x6d')][_0x9122('0xb9')]}});})[_0x9122('0x25')](function(_0x4e675a){socket['emit'](_0x9122('0xc2'),{'id':Number(_0x2c6a08[_0x9122('0xad')]['id']),'tags':_0x4e675a||[]});return{'id':Number(_0x2c6a08['params']['id']),'tags':_0x4e675a||[]};});}})[_0x9122('0x25')](respondWithResult(_0x5db843,null))[_0x9122('0x32')](handleError(_0x5db843,null));};exports[_0x9122('0xc3')]=function(_0x20c65d,_0x468d41,_0x54417d){return db[_0x9122('0x34')][_0x9122('0x5a')]({'where':{'id':_0x20c65d['params']['id']}})[_0x9122('0x25')](handleEntityNotFound(_0x468d41,null))[_0x9122('0x25')](function(_0x4a7039){if(_0x4a7039){return _0x4a7039[_0x9122('0xc3')](_0x20c65d['query']['ids']);}})['then'](respondWithStatusCode(_0x468d41,null))['catch'](handleError(_0x468d41,null));};exports['download']=function(_0x5e512c,_0x5f53a4){var _0x2a017b=moment()[_0x9122('0xc4')]()[_0x9122('0x96')]();var _0x4d6d35=path[_0x9122('0xc5')](config[_0x9122('0xc6')],_0x9122('0xc7'),_0x9122('0xc8'),_0x9122('0xc9'));var _0x11e4f8=path[_0x9122('0xc5')](config[_0x9122('0xc6')],_0x9122('0xc7'),'files',_0x9122('0xca'));var _0x3da1bc=path[_0x9122('0xc5')](_0x4d6d35,_0x2a017b);var _0x527c54=util[_0x9122('0xbc')](_0x9122('0xcb'),_0x5e512c['params']['id'],_0x2a017b);var _0x49c8c3=path[_0x9122('0xc5')](_0x4d6d35,_0x527c54);var _0x24aebf=[];_0x24aebf[_0x9122('0xab')]({'model':db[_0x9122('0xcc')],'as':'User','attributes':['id',_0x9122('0x2d')],'raw':!![]});_0x24aebf[_0x9122('0xab')]({'model':db[_0x9122('0xcd')],'as':_0x9122('0x5f'),'attributes':['id',_0x9122('0xce'),_0x9122('0xcf')],'raw':!![]});if(_0x5e512c[_0x9122('0x37')][_0x9122('0xca')]){_0x24aebf[_0x9122('0xab')]({'model':db[_0x9122('0xd0')],'as':_0x9122('0xd0'),'raw':!![]});}var _0x1d9914=[{'model':db[_0x9122('0xb6')],'as':_0x9122('0xd1'),'attributes':['id',_0x9122('0x6d'),_0x9122('0x74'),_0x9122('0xd2'),_0x9122('0xd3'),_0x9122('0x7a')],'include':_0x24aebf}];_0x1d9914[_0x9122('0xab')]({'model':db[_0x9122('0xd4')],'as':'Account','attributes':['id',_0x9122('0x29')]});_0x1d9914[_0x9122('0xab')]({'model':db[_0x9122('0xcc')],'as':_0x9122('0xd5'),'attributes':['id',_0x9122('0x2d')]});return db['WhatsappInteraction'][_0x9122('0x5a')]({'where':{'id':_0x5e512c['params']['id']},'include':_0x1d9914})[_0x9122('0x25')](handleEntityNotFound(_0x5f53a4,null))[_0x9122('0x25')](function(_0x386177){if(_0x386177){var _0x22e832=_0x386177[_0x9122('0xd6')]({'plain':!![]});fs[_0x9122('0xd7')](_0x3da1bc);var _0x5a9d30={'channel':_0x9122('0xd8'),'account':_0x22e832['Account'][_0x9122('0x29')],'agent':_0x22e832['Owner']?_0x22e832[_0x9122('0xd5')]['fullname']:'N.A.','createdAt':moment(_0x22e832[_0x9122('0x74')])['format'](_0x9122('0xbd'))[_0x9122('0x96')](),'closedAt':_0x22e832[_0x9122('0xd9')]?moment(_0x22e832['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9122('0x96')]():'','disposition':_0x22e832[_0x9122('0xda')],'messages':_(_0x22e832[_0x9122('0xd1')])[_0x9122('0x7e')]({'secret':![]})[_0x9122('0x2c')](function(_0x20f3cf){if(_0x20f3cf[_0x9122('0xd0')]){var _0x521949=path[_0x9122('0xc5')](_0x11e4f8,_0x20f3cf['Attachment'][_0x9122('0xdb')]);if(fs['existsSync'](_0x521949)){fs[_0x9122('0xdc')](_0x521949)[_0x9122('0xdd')](fs[_0x9122('0xde')](path[_0x9122('0xc5')](_0x3da1bc,_0x20f3cf['Attachment']['basename'])));}}return{'date':moment(_0x20f3cf[_0x9122('0x74')])[_0x9122('0xbc')](_0x9122('0xbd'))['toString'](),'sender':_0x20f3cf[_0x9122('0xd2')]===_0x9122('0xdf')?_0x20f3cf[_0x9122('0xcc')]?_0x20f3cf[_0x9122('0xcc')][_0x9122('0x2d')]:_0x9122('0xe0'):_0x20f3cf['Contact'][_0x9122('0xce')]+(_0x20f3cf[_0x9122('0x5f')][_0x9122('0xcf')]?'\x20'+_0x20f3cf[_0x9122('0x5f')]['lastName']:''),'body':_0x20f3cf[_0x9122('0xd0')]?_0x20f3cf[_0x9122('0xd0')][_0x9122('0xdb')]:_0x20f3cf[_0x9122('0x6d')],'direction':_0x20f3cf['direction']===_0x9122('0xdf')?'A':'C','secret':_0x20f3cf[_0x9122('0xd3')],'read':_0x20f3cf['read'],'attachment':_0x20f3cf[_0x9122('0xd0')]};})['value']()};return ejs[_0x9122('0xe1')](path[_0x9122('0xc5')](config['root'],_0x9122('0xc7'),'views',_0x9122('0xe2')),{'interaction':_0x5a9d30})['then'](function(_0x1cd7b1){var _0x56113f=path[_0x9122('0xc5')](_0x3da1bc,_0x9122('0xe3')+_0x22e832['id']+'-'+_0x2a017b+_0x9122('0xe4'));var _0x7956e0={'path':_0x56113f,'channel':_0x9122('0xd8'),'interactionId':_0x22e832['id']};return pdf[_0x9122('0xe5')](_0x1cd7b1,_0x7956e0);})[_0x9122('0x25')](function(){return new BPromise(function(_0x513785,_0x3442b1){zipdir(_0x3da1bc,{'saveTo':_0x49c8c3},function(_0x136e98,_0x3beba2){if(_0x136e98)return _0x3442b1(_0x136e98);return _0x513785(_0x3beba2);});})[_0x9122('0x25')](function(){return new BPromise(function(_0x3ff178,_0x254d6b){rimraf(_0x3da1bc,function(_0x5d9d0d){if(_0x5d9d0d)_0x254d6b(_0x5d9d0d);return _0x3ff178();});});})[_0x9122('0x25')](function(){return _0x5f53a4[_0x9122('0xe6')](_0x49c8c3,_0x527c54,function(_0x1bd93f){if(_0x1bd93f){console[_0x9122('0xe7')](_0x9122('0xe8'),_0x1bd93f);}else{fs[_0x9122('0xe9')](_0x49c8c3);}});});});}else{return _0x5f53a4['sendStatus'](0xc8);}})['catch'](handleError(_0x5f53a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 3d891ea..8836aaa 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 _0x0884=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events'];(function(_0x2584bc,_0x35d9f5){var _0x405f2c=function(_0x4a1d1e){while(--_0x4a1d1e){_0x2584bc['push'](_0x2584bc['shift']());}};_0x405f2c(++_0x35d9f5);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4088('0x0'));var WhatsappInteraction=require(_0x4088('0x1'))['db'][_0x4088('0x2')];var WhatsappMessage=require(_0x4088('0x1'))['db'][_0x4088('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4088('0x4')](0x0);var events={'afterCreate':_0x4088('0x5'),'afterUpdate':'update','afterDestroy':_0x4088('0x6')};function emitEvent(_0x634f6f){return function(_0x19841,_0x426db2,_0x3b1d74){_0x19841['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x42b2c3){_0x19841['setDataValue'](_0x4088('0x7'),_0x42b2c3[_0x4088('0x8')](function(_0x38e9d9){return{'id':_0x38e9d9['id']};}));return WhatsappMessage[_0x4088('0x9')]({'where':{'WhatsappInteractionId':_0x19841['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4088('0xa')](function(_0x29c7ec){_0x19841[_0x4088('0xb')](_0x4088('0xc'),_0x29c7ec[_0x4088('0xd')]);WhatsappInteractionEvents['emit'](_0x634f6f+':'+_0x19841['id'],_0x19841);WhatsappInteractionEvents[_0x4088('0xe')](_0x634f6f,_0x19841);_0x3b1d74(null);})[_0x4088('0xf')](_0x3b1d74(null));};}for(var e in events){if(events[_0x4088('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x4088('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x38c3=['remove','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0xbc8177,_0x4d1cfd){var _0x91d12f=function(_0x2855e5){while(--_0x2855e5){_0xbc8177['push'](_0xbc8177['shift']());}};_0x91d12f(++_0x4d1cfd);}(_0x38c3,0x13d));var _0x338c=function(_0x1058ed,_0x109d8d){_0x1058ed=_0x1058ed-0x0;var _0x4e4661=_0x38c3[_0x1058ed];return _0x4e4661;};'use strict';var EventEmitter=require(_0x338c('0x0'));var WhatsappInteraction=require(_0x338c('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x338c('0x1'))['db'][_0x338c('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x338c('0x3')](0x0);var events={'afterCreate':_0x338c('0x4'),'afterUpdate':_0x338c('0x5'),'afterDestroy':_0x338c('0x6')};function emitEvent(_0x4acb1a){return function(_0x236c87,_0x581e00,_0x41c16d){_0x236c87[_0x338c('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x39dacd){_0x236c87[_0x338c('0x8')](_0x338c('0x9'),_0x39dacd['map'](function(_0x2f3652){return{'id':_0x2f3652['id']};}));return WhatsappMessage[_0x338c('0xa')]({'where':{'WhatsappInteractionId':_0x236c87['id'],'direction':'in','read':![]},'raw':!![]});})[_0x338c('0xb')](function(_0x367047){_0x236c87[_0x338c('0x8')](_0x338c('0xc'),_0x367047[_0x338c('0xd')]);WhatsappInteractionEvents['emit'](_0x4acb1a+':'+_0x236c87['id'],_0x236c87);WhatsappInteractionEvents[_0x338c('0xe')](_0x4acb1a,_0x236c87);_0x41c16d(null);})[_0x338c('0xf')](_0x41c16d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x338c('0x10')](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 abcd742..ac79c45 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 _0x2820=['bluebird','request-promise','rimraf','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2820,0xb2));var _0x0282=function(_0x1103aa,_0x36973f){_0x1103aa=_0x1103aa-0x0;var _0x250eb4=_0x2820[_0x1103aa];return _0x250eb4;};'use strict';var _=require(_0x0282('0x0'));var util=require(_0x0282('0x1'));var logger=require('../../config/logger')(_0x0282('0x2'));var moment=require(_0x0282('0x3'));var BPromise=require(_0x0282('0x4'));var rp=require(_0x0282('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0282('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x4e088f,_0x2f428a){return _0x4e088f[_0x0282('0x7')](_0x0282('0x8'),attributes,{'tableName':_0x0282('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33b344,_0x118d2d,_0x2e8e61){if(_0x33b344['changed'](_0x0282('0xa'))){_0x33b344[_0x0282('0xb')]=moment()[_0x0282('0xc')](_0x0282('0xd'));}_0x2e8e61(null,_0x33b344);}}});}; \ No newline at end of file +var _0xb82a=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed'];(function(_0x39be39,_0x2853eb){var _0x58ffff=function(_0x321dad){while(--_0x321dad){_0x39be39['push'](_0x39be39['shift']());}};_0x58ffff(++_0x2853eb);}(_0xb82a,0x1b3));var _0xab82=function(_0x5131eb,_0x302a98){_0x5131eb=_0x5131eb-0x0;var _0x4d0ce2=_0xb82a[_0x5131eb];return _0x4d0ce2;};'use strict';var _=require(_0xab82('0x0'));var util=require('util');var logger=require(_0xab82('0x1'))(_0xab82('0x2'));var moment=require(_0xab82('0x3'));var BPromise=require(_0xab82('0x4'));var rp=require(_0xab82('0x5'));var fs=require('fs');var path=require(_0xab82('0x6'));var rimraf=require(_0xab82('0x7'));var config=require('../../config/environment');var attributes=require(_0xab82('0x8'));module[_0xab82('0x9')]=function(_0x203e49,_0x1630fa){return _0x203e49[_0xab82('0xa')](_0xab82('0xb'),attributes,{'tableName':_0xab82('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x185b07,_0x11838a,_0x12b15f){if(_0x185b07[_0xab82('0xd')](_0xab82('0xe'))){_0x185b07[_0xab82('0xf')]=moment()[_0xab82('0x10')](_0xab82('0x11'));}_0x12b15f(null,_0x185b07);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b03131a..6a9eecd 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 _0x3f2c=['localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','body','ids','spread','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x4e7012,_0x5d5f73){var _0xcd56d5=function(_0x330847){while(--_0x330847){_0x4e7012['push'](_0x4e7012['shift']());}};_0xcd56d5(++_0x5d5f73);}(_0x3f2c,0xb9));var _0xc3f2=function(_0x21cc16,_0x411798){_0x21cc16=_0x21cc16-0x0;var _0x5e6ca7=_0x3f2c[_0x21cc16];return _0x5e6ca7;};'use strict';var _=require(_0xc3f2('0x0'));var util=require('util');var moment=require(_0xc3f2('0x1'));var BPromise=require(_0xc3f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3f2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3f2('0x4'))('rpc');var config=require(_0xc3f2('0x5'));var jayson=require(_0xc3f2('0x6'));var client=jayson['client'][_0xc3f2('0x7')]({'port':0x232a});config[_0xc3f2('0x8')]=_[_0xc3f2('0x9')](config[_0xc3f2('0x8')],{'host':_0xc3f2('0xa'),'port':0x18eb});var socket=require(_0xc3f2('0xb'))(new Redis(config['redis']));require(_0xc3f2('0xc'))[_0xc3f2('0xd')](socket);function respondWithRpcPromise(_0x4ae83a,_0xdaf5a1,_0x596685){return new BPromise(function(_0x394105,_0x1207e8){return client[_0xc3f2('0xe')](_0x4ae83a,_0x596685)[_0xc3f2('0xf')](function(_0x1cb5f3){logger[_0xc3f2('0x10')](_0xc3f2('0x11'),_0xdaf5a1,'request\x20sent');logger[_0xc3f2('0x12')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xdaf5a1,_0xc3f2('0x13'),JSON[_0xc3f2('0x14')](_0x1cb5f3));if(_0x1cb5f3[_0xc3f2('0x15')]){if(_0x1cb5f3[_0xc3f2('0x15')]['code']===0x1f4){logger[_0xc3f2('0x15')](_0xc3f2('0x11'),_0xdaf5a1,_0x1cb5f3['error'][_0xc3f2('0x16')]);return _0x1207e8(_0x1cb5f3[_0xc3f2('0x15')]['message']);}logger[_0xc3f2('0x15')](_0xc3f2('0x11'),_0xdaf5a1,_0x1cb5f3[_0xc3f2('0x15')][_0xc3f2('0x16')]);return _0x394105(_0x1cb5f3[_0xc3f2('0x15')][_0xc3f2('0x16')]);}else{logger[_0xc3f2('0x10')](_0xc3f2('0x11'),_0xdaf5a1,_0xc3f2('0x13'));_0x394105(_0x1cb5f3['result'][_0xc3f2('0x16')]);}})[_0xc3f2('0x17')](function(_0x4488bf){logger[_0xc3f2('0x15')](_0xc3f2('0x11'),_0xdaf5a1,_0x4488bf);_0x1207e8(_0x4488bf);});});}exports[_0xc3f2('0x18')]=function(_0x5213d4){var _0x35b298=this;return new Promise(function(_0x32d6cc,_0x5c4322){return db[_0xc3f2('0x19')][_0xc3f2('0x1a')](_0x5213d4['body'],{'raw':_0x5213d4[_0xc3f2('0x1b')]?_0x5213d4[_0xc3f2('0x1b')][_0xc3f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5213d4[_0xc3f2('0x1b')]?_0x5213d4[_0xc3f2('0x1b')][_0xc3f2('0x1d')]||null:null,'attributes':_0x5213d4['options']?_0x5213d4[_0xc3f2('0x1b')][_0xc3f2('0x1e')]||null:null,'limit':_0x5213d4[_0xc3f2('0x1b')]?_0x5213d4[_0xc3f2('0x1b')][_0xc3f2('0x1f')]||null:null})[_0xc3f2('0xf')](function(_0x1fd9d6){logger[_0xc3f2('0x10')](_0xc3f2('0x18'),_0x5213d4);logger[_0xc3f2('0x12')](_0xc3f2('0x18'),_0x5213d4,JSON[_0xc3f2('0x14')](_0x1fd9d6));_0x32d6cc(_0x1fd9d6);})[_0xc3f2('0x17')](function(_0x14309e){logger[_0xc3f2('0x15')](_0xc3f2('0x18'),_0x14309e[_0xc3f2('0x16')],_0x5213d4);_0x5c4322(_0x35b298[_0xc3f2('0x15')](0x1f4,_0x14309e[_0xc3f2('0x16')]));});});};exports[_0xc3f2('0x20')]=function(_0x22192d){return new Promise(function(_0x38dcfc,_0x2d6f9b){return db[_0xc3f2('0x19')][_0xc3f2('0x21')]({'where':_0x22192d[_0xc3f2('0x1b')]?_0x22192d['options'][_0xc3f2('0x1d')]||null:null})[_0xc3f2('0xf')](function(_0xc45ec3){if(_0xc45ec3){return _0xc45ec3[_0xc3f2('0x22')](_0x22192d[_0xc3f2('0x23')][_0xc3f2('0x24')],_['omit'](_0x22192d[_0xc3f2('0x23')],['ids','id'])||{});}})[_0xc3f2('0x25')](function(_0x428636){logger[_0xc3f2('0x10')]('AddTags',_0x22192d);logger[_0xc3f2('0x12')]('AddTags',_0x22192d,JSON[_0xc3f2('0x14')](_0x428636));_0x38dcfc(_0x428636);})[_0xc3f2('0x17')](function(_0x258bab){logger['error'](_0xc3f2('0x26'),_0x258bab['message'],_0x22192d);_0x2d6f9b(_this[_0xc3f2('0x15')](0x1f4,_0x258bab[_0xc3f2('0x16')]));});});}; \ No newline at end of file +var _0xdd6e=['find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','then','AddTagsToWhatsappInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdd6e,0xdd));var _0xedd6=function(_0x5267b9,_0x159af6){_0x5267b9=_0x5267b9-0x0;var _0x2cf291=_0xdd6e[_0x5267b9];return _0x2cf291;};'use strict';var _=require(_0xedd6('0x0'));var util=require(_0xedd6('0x1'));var moment=require('moment');var BPromise=require(_0xedd6('0x2'));var rs=require(_0xedd6('0x3'));var fs=require('fs');var Redis=require(_0xedd6('0x4'));var db=require(_0xedd6('0x5'))['db'];var utils=require(_0xedd6('0x6'));var logger=require(_0xedd6('0x7'))(_0xedd6('0x8'));var config=require(_0xedd6('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xedd6('0xa')]({'port':0x232a});config[_0xedd6('0xb')]=_[_0xedd6('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xedd6('0xd'))(new Redis(config[_0xedd6('0xb')]));require(_0xedd6('0xe'))[_0xedd6('0xf')](socket);function respondWithRpcPromise(_0x1a981a,_0x20071f,_0x2acd6d){return new BPromise(function(_0x482b30,_0x2d4e55){return client[_0xedd6('0x10')](_0x1a981a,_0x2acd6d)['then'](function(_0x1b7962){logger[_0xedd6('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x20071f,_0xedd6('0x12'));logger[_0xedd6('0x13')](_0xedd6('0x14'),_0x20071f,_0xedd6('0x12'),JSON[_0xedd6('0x15')](_0x1b7962));if(_0x1b7962[_0xedd6('0x16')]){if(_0x1b7962[_0xedd6('0x16')][_0xedd6('0x17')]===0x1f4){logger[_0xedd6('0x16')](_0xedd6('0x18'),_0x20071f,_0x1b7962[_0xedd6('0x16')]['message']);return _0x2d4e55(_0x1b7962['error'][_0xedd6('0x19')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x20071f,_0x1b7962[_0xedd6('0x16')]['message']);return _0x482b30(_0x1b7962[_0xedd6('0x16')]['message']);}else{logger[_0xedd6('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x20071f,'request\x20sent');_0x482b30(_0x1b7962['result'][_0xedd6('0x19')]);}})[_0xedd6('0x1a')](function(_0xb1431a){logger[_0xedd6('0x16')](_0xedd6('0x18'),_0x20071f,_0xb1431a);_0x2d4e55(_0xb1431a);});});}exports[_0xedd6('0x1b')]=function(_0x36b844){var _0x112b8c=this;return new Promise(function(_0x29e873,_0x1a4747){return db[_0xedd6('0x1c')]['update'](_0x36b844[_0xedd6('0x1d')],{'raw':_0x36b844['options']?_0x36b844[_0xedd6('0x1e')][_0xedd6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36b844[_0xedd6('0x1e')]?_0x36b844[_0xedd6('0x1e')][_0xedd6('0x20')]||null:null,'attributes':_0x36b844['options']?_0x36b844[_0xedd6('0x1e')][_0xedd6('0x21')]||null:null,'limit':_0x36b844[_0xedd6('0x1e')]?_0x36b844[_0xedd6('0x1e')][_0xedd6('0x22')]||null:null})[_0xedd6('0x23')](function(_0x5b313e){logger[_0xedd6('0x11')](_0xedd6('0x1b'),_0x36b844);logger[_0xedd6('0x13')]('UpdateWhatsappInteraction',_0x36b844,JSON[_0xedd6('0x15')](_0x5b313e));_0x29e873(_0x5b313e);})[_0xedd6('0x1a')](function(_0x17f3e5){logger[_0xedd6('0x16')]('UpdateWhatsappInteraction',_0x17f3e5[_0xedd6('0x19')],_0x36b844);_0x1a4747(_0x112b8c[_0xedd6('0x16')](0x1f4,_0x17f3e5[_0xedd6('0x19')]));});});};exports[_0xedd6('0x24')]=function(_0xe786fe){return new Promise(function(_0x442112,_0x5c460a){return db[_0xedd6('0x1c')][_0xedd6('0x25')]({'where':_0xe786fe[_0xedd6('0x1e')]?_0xe786fe[_0xedd6('0x1e')]['where']||null:null})['then'](function(_0x5a2cd){if(_0x5a2cd){return _0x5a2cd[_0xedd6('0x26')](_0xe786fe['body'][_0xedd6('0x27')],_[_0xedd6('0x28')](_0xe786fe['body'],[_0xedd6('0x27'),'id'])||{});}})[_0xedd6('0x29')](function(_0xec82c4){logger[_0xedd6('0x11')](_0xedd6('0x2a'),_0xe786fe);logger[_0xedd6('0x13')](_0xedd6('0x2a'),_0xe786fe,JSON[_0xedd6('0x15')](_0xec82c4));_0x442112(_0xec82c4);})[_0xedd6('0x1a')](function(_0x142c1f){logger['error']('AddTags',_0x142c1f[_0xedd6('0x19')],_0xe786fe);_0x5c460a(_this['error'](0x1f4,_0x142c1f[_0xedd6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5aa56c6..eeba7e5 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 _0xe6be=['remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x1308cb,_0x23d743){var _0x4a241=function(_0x4f00ae){while(--_0x4f00ae){_0x1308cb['push'](_0x1308cb['shift']());}};_0x4a241(++_0x23d743);}(_0xe6be,0xa1));var _0xee6b=function(_0x3fd2b2,_0x5627f1){_0x3fd2b2=_0x3fd2b2-0x0;var _0x5d290f=_0xe6be[_0x3fd2b2];return _0x5d290f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xee6b('0x0'),_0xee6b('0x1')];function createListener(_0x5901d1,_0x1cb0f0){return function(_0x18d1bb){_0x1cb0f0[_0xee6b('0x2')](_0x5901d1,_0x18d1bb);};}function removeListener(_0x4f0de5,_0x55ebb9){return function(){WhatsappInteractionEvents[_0xee6b('0x3')](_0x4f0de5,_0x55ebb9);};}exports[_0xee6b('0x4')]=function(_0x3550fc){for(var _0x2b97d7=0x0,_0x1ce7c1=events[_0xee6b('0x5')];_0x2b97d7<_0x1ce7c1;_0x2b97d7++){var _0x4e1e9f=events[_0x2b97d7];var _0x1b3fbc=createListener(_0xee6b('0x6')+_0x4e1e9f,_0x3550fc);WhatsappInteractionEvents['on'](_0x4e1e9f,_0x1b3fbc);}}; \ No newline at end of file +var _0x1f98=['./whatsappInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x2fdb0d,_0x26c295){var _0x52e3bf=function(_0x77cc0a){while(--_0x77cc0a){_0x2fdb0d['push'](_0x2fdb0d['shift']());}};_0x52e3bf(++_0x26c295);}(_0x1f98,0x1ce));var _0x81f9=function(_0x8a5808,_0x128ab3){_0x8a5808=_0x8a5808-0x0;var _0x223384=_0x1f98[_0x8a5808];return _0x223384;};'use strict';var WhatsappInteractionEvents=require(_0x81f9('0x0'));var events=[_0x81f9('0x1'),'remove',_0x81f9('0x2')];function createListener(_0x22da31,_0x9a601e){return function(_0x4c17b2){_0x9a601e[_0x81f9('0x3')](_0x22da31,_0x4c17b2);};}function removeListener(_0x9f2499,_0x1751e0){return function(){WhatsappInteractionEvents[_0x81f9('0x4')](_0x9f2499,_0x1751e0);};}exports[_0x81f9('0x5')]=function(_0x3bc7ad){for(var _0x7cb532=0x0,_0x414008=events[_0x81f9('0x6')];_0x7cb532<_0x414008;_0x7cb532++){var _0x47bd9e=events[_0x7cb532];var _0x38c52b=createListener('whatsappInteraction:'+_0x47bd9e,_0x3bc7ad);WhatsappInteractionEvents['on'](_0x47bd9e,_0x38c52b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a28ef2b..5b67045 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 _0x7b84=['/:id/reject','reject','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0x7b84,0x9b));var _0x47b8=function(_0x121fcf,_0x4b0586){_0x121fcf=_0x121fcf-0x0;var _0x268822=_0x7b84[_0x121fcf];return _0x268822;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require('path');var timeout=require(_0x47b8('0x2'));var express=require(_0x47b8('0x3'));var router=express[_0x47b8('0x4')]();var fs_extra=require(_0x47b8('0x5'));var auth=require(_0x47b8('0x6'));var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth['isAuthenticated'](),controller[_0x47b8('0xb')]);router['get'](_0x47b8('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x47b8('0xd')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xf')]('/',auth['isAuthenticated'](),interaction[_0x47b8('0x10')](_0x47b8('0x11'),_0x47b8('0x12')),controller[_0x47b8('0x13')]);router[_0x47b8('0xf')](_0x47b8('0x14'),controller['status']);router[_0x47b8('0x15')]('/:id',auth[_0x47b8('0xd')](),controller[_0x47b8('0x16')]);router[_0x47b8('0x15')](_0x47b8('0x17'),auth[_0x47b8('0xd')](),controller[_0x47b8('0x18')]);router['put'](_0x47b8('0x19'),auth[_0x47b8('0xd')](),controller[_0x47b8('0x1a')]);router[_0x47b8('0x1b')](_0x47b8('0x1c'),auth[_0x47b8('0xd')](),controller['destroy']);module[_0x47b8('0x1d')]=router; \ No newline at end of file +var _0x87a5=['index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x87a5,0x9e));var _0x587a=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x87a5[_0x1460f6];return _0x46ce94;};'use strict';var multer=require(_0x587a('0x0'));var util=require('util');var path=require(_0x587a('0x1'));var timeout=require(_0x587a('0x2'));var express=require(_0x587a('0x3'));var router=express['Router']();var fs_extra=require(_0x587a('0x4'));var auth=require(_0x587a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x587a('0x6'));var controller=require(_0x587a('0x7'));router[_0x587a('0x8')]('/',auth[_0x587a('0x9')](),controller[_0x587a('0xa')]);router[_0x587a('0x8')](_0x587a('0xb'),auth['isAuthenticated'](),controller[_0x587a('0xc')]);router[_0x587a('0x8')](_0x587a('0xd'),auth[_0x587a('0x9')](),controller[_0x587a('0xe')]);router[_0x587a('0xf')]('/',auth[_0x587a('0x9')](),interaction[_0x587a('0x10')](_0x587a('0x11'),_0x587a('0x12')),controller['create']);router[_0x587a('0xf')](_0x587a('0x13'),controller[_0x587a('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x587a('0x15')](_0x587a('0x16'),auth['isAuthenticated'](),controller[_0x587a('0x17')]);router[_0x587a('0x15')](_0x587a('0x18'),auth[_0x587a('0x9')](),controller[_0x587a('0x19')]);router[_0x587a('0x1a')](_0x587a('0xd'),auth['isAuthenticated'](),controller[_0x587a('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6948bd8..0cebb06 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 _0x3ccc=['STRING','DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x10f60f,_0x5a3eea){var _0xd84616=function(_0x467c34){while(--_0x467c34){_0x10f60f['push'](_0x10f60f['shift']());}};_0xd84616(++_0x5a3eea);}(_0x3ccc,0x1bb));var _0xc3cc=function(_0x1a9ed0,_0x1085fc){_0x1a9ed0=_0x1a9ed0-0x0;var _0x47bbd6=_0x3ccc[_0x1a9ed0];return _0x47bbd6;};'use strict';var Sequelize=require(_0xc3cc('0x0'));module['exports']={'body':{'type':Sequelize[_0xc3cc('0x1')](_0xc3cc('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc3cc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc3cc('0x4')),'defaultValue':_0xc3cc('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc3cc('0x5')](0xbe)},'phone':{'type':Sequelize[_0xc3cc('0x5')]},'readAt':{'type':Sequelize[_0xc3cc('0x6')]},'secret':{'type':Sequelize[_0xc3cc('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc3cc('0x5')]},'providerResponse':{'type':Sequelize[_0xc3cc('0x1')]}}; \ No newline at end of file +var _0x9ee6=['out','STRING','DATE','TEXT','exports','BOOLEAN'];(function(_0x389249,_0x2eb752){var _0xc14c2b=function(_0x4960b4){while(--_0x4960b4){_0x389249['push'](_0x389249['shift']());}};_0xc14c2b(++_0x2eb752);}(_0x9ee6,0x94));var _0x69ee=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x9ee6[_0x2f71f6];return _0x2b23ea;};'use strict';var Sequelize=require('sequelize');module[_0x69ee('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x69ee('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x69ee('0x2')),'defaultValue':_0x69ee('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x69ee('0x3')](0xbe)},'phone':{'type':Sequelize[_0x69ee('0x3')]},'readAt':{'type':Sequelize[_0x69ee('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x69ee('0x3')]},'providerResponse':{'type':Sequelize[_0x69ee('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index d27af9a..49f05ef 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 _0xff92=['twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','send','index','map','WhatsappMessage','rawAttributes','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','find','create','body','describe','whatsapp','format','UserId','user','agent','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','RejectMessage','rejectMessage','sequelize','internal','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect'];(function(_0x212930,_0x2561f0){var _0x1103c5=function(_0x2c1a9a){while(--_0x2c1a9a){_0x212930['push'](_0x212930['shift']());}};_0x1103c5(++_0x2561f0);}(_0xff92,0x119));var _0x2ff9=function(_0x2bcc97,_0x3d284e){_0x2bcc97=_0x2bcc97-0x0;var _0x32a9b4=_0xff92[_0x2bcc97];return _0x32a9b4;};'use strict';var emlformat=require(_0x2ff9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ff9('0x1'));var jsonpatch=require(_0x2ff9('0x2'));var rp=require(_0x2ff9('0x3'));var moment=require(_0x2ff9('0x4'));var BPromise=require(_0x2ff9('0x5'));var Mustache=require(_0x2ff9('0x6'));var util=require('util');var path=require(_0x2ff9('0x7'));var sox=require('sox');var csv=require(_0x2ff9('0x8'));var ejs=require(_0x2ff9('0x9'));var fs=require('fs');var fs_extra=require(_0x2ff9('0xa'));var _=require(_0x2ff9('0xb'));var squel=require(_0x2ff9('0xc'));var crypto=require(_0x2ff9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2ff9('0xe'));var toCsv=require(_0x2ff9('0x8'));var querystring=require('querystring');var Papa=require(_0x2ff9('0xf'));var Redis=require('ioredis');var authService=require(_0x2ff9('0x10'));var qs=require(_0x2ff9('0x11'));var as=require(_0x2ff9('0x12'));var hardwareService=require(_0x2ff9('0x13'));var logger=require(_0x2ff9('0x14'))('api');var utils=require(_0x2ff9('0x15'));var config=require(_0x2ff9('0x16'));var licenseUtil=require(_0x2ff9('0x17'));var db=require(_0x2ff9('0x18'))['db'];config[_0x2ff9('0x19')]=_[_0x2ff9('0x1a')](config[_0x2ff9('0x19')],{'host':_0x2ff9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2ff9('0x1c'))['register'](socket);var jayson=require(_0x2ff9('0x1d'));var client=jayson[_0x2ff9('0x1e')][_0x2ff9('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41830a,_0x28074e,_0x1ae965,_0x58dac3){return new BPromise(function(_0x1055ec,_0x8a029b){var _0x117a2e=_0x58dac3||client;return _0x117a2e['request'](_0x41830a,_0x1ae965)['then'](function(_0x281277){logger[_0x2ff9('0x20')](_0x2ff9('0x21'),_0x28074e,'request\x20sent');logger[_0x2ff9('0x22')](_0x2ff9('0x23'),_0x28074e,_0x2ff9('0x24'),JSON[_0x2ff9('0x25')](_0x281277));if(_0x281277[_0x2ff9('0x26')]){if(_0x281277[_0x2ff9('0x26')][_0x2ff9('0x27')]===0x1f4){logger[_0x2ff9('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x28074e,_0x281277[_0x2ff9('0x26')][_0x2ff9('0x28')]);return _0x8a029b(_0x281277['error']['message']);}logger[_0x2ff9('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x28074e,_0x281277[_0x2ff9('0x26')][_0x2ff9('0x28')]);return _0x1055ec(_0x281277['error'][_0x2ff9('0x28')]);}else{logger[_0x2ff9('0x20')](_0x2ff9('0x21'),_0x28074e,_0x2ff9('0x24'));_0x1055ec(_0x281277['result']['message']);}})[_0x2ff9('0x29')](function(_0x2978af){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x28074e,_0x2978af);_0x8a029b(_0x2978af);});});}function respondWithStatusCode(_0x2cd015,_0x16a31c){_0x16a31c=_0x16a31c||0xcc;return function(_0x534c77){if(_0x534c77){return _0x2cd015['sendStatus'](_0x16a31c);}return _0x2cd015['status'](_0x16a31c)[_0x2ff9('0x2a')]();};}function respondWithResult(_0x498044,_0x315b71){_0x315b71=_0x315b71||0xc8;return function(_0x141aac){if(_0x141aac){return _0x498044[_0x2ff9('0x2b')](_0x315b71)['json'](_0x141aac);}};}function respondWithFilteredResult(_0x1617b4,_0x5955da){return function(_0x47e4eb){if(_0x47e4eb){var _0xc436fb=typeof _0x5955da[_0x2ff9('0x2c')]==='undefined'&&typeof _0x5955da['limit']===_0x2ff9('0x2d');var _0x315790=_0x47e4eb[_0x2ff9('0x2e')];var _0xdb38b3=_0xc436fb?0x0:_0x5955da[_0x2ff9('0x2c')];var _0xbe1d7=_0xc436fb?_0x47e4eb[_0x2ff9('0x2e')]:_0x5955da[_0x2ff9('0x2c')]+_0x5955da[_0x2ff9('0x2f')];var _0x7c07f1;if(_0xbe1d7>=_0x315790){_0xbe1d7=_0x315790;_0x7c07f1=0xc8;}else{_0x7c07f1=0xce;}_0x1617b4[_0x2ff9('0x2b')](_0x7c07f1);return _0x1617b4[_0x2ff9('0x30')](_0x2ff9('0x31'),_0xdb38b3+'-'+_0xbe1d7+'/'+_0x315790)[_0x2ff9('0x32')](_0x47e4eb);}return null;};}function patchUpdates(_0x4b1554){return function(_0x5b7d87){try{jsonpatch[_0x2ff9('0x33')](_0x5b7d87,_0x4b1554,!![]);}catch(_0xd750db){return BPromise[_0x2ff9('0x34')](_0xd750db);}return _0x5b7d87[_0x2ff9('0x35')]();};}function saveUpdates(_0xbb34a5,_0x402d57){return function(_0x21dd13){if(_0x21dd13){return _0x21dd13[_0x2ff9('0x36')](_0xbb34a5)[_0x2ff9('0x37')](function(_0x221318){return _0x221318;});}return null;};}function removeEntity(_0x5cf170,_0x2905d6){return function(_0x20e701){if(_0x20e701){return _0x20e701[_0x2ff9('0x38')]()['then'](function(){_0x5cf170[_0x2ff9('0x2b')](0xcc)[_0x2ff9('0x2a')]();});}};}function handleEntityNotFound(_0x5583e2,_0x39152c){return function(_0x25043d){if(!_0x25043d){_0x5583e2['sendStatus'](0x194);}return _0x25043d;};}function handleError(_0x1f52bd,_0x3163ef){_0x3163ef=_0x3163ef||0x1f4;return function(_0x47b3ff){logger[_0x2ff9('0x26')](_0x47b3ff[_0x2ff9('0x39')]);if(_0x47b3ff['name']){delete _0x47b3ff['name'];}_0x1f52bd[_0x2ff9('0x2b')](_0x3163ef)[_0x2ff9('0x3a')](_0x47b3ff);};}exports[_0x2ff9('0x3b')]=function(_0x551f20,_0x261187){var _0x310123={},_0x502606={},_0x329154={'count':0x0,'rows':[]};var _0x5afafa=_[_0x2ff9('0x3c')](db[_0x2ff9('0x3d')][_0x2ff9('0x3e')],function(_0x529344){return{'name':_0x529344['fieldName'],'type':_0x529344[_0x2ff9('0x3f')]['key']};});_0x502606[_0x2ff9('0x40')]=_[_0x2ff9('0x3c')](_0x5afafa,_0x2ff9('0x41'));_0x502606[_0x2ff9('0x42')]=_[_0x2ff9('0x43')](_0x551f20['query']);_0x502606[_0x2ff9('0x44')]=_['intersection'](_0x502606[_0x2ff9('0x40')],_0x502606['query']);_0x310123['attributes']=_[_0x2ff9('0x45')](_0x502606[_0x2ff9('0x40')],qs['fields'](_0x551f20['query'][_0x2ff9('0x46')]));_0x310123[_0x2ff9('0x47')]=_0x310123[_0x2ff9('0x47')][_0x2ff9('0x48')]?_0x310123[_0x2ff9('0x47')]:_0x502606[_0x2ff9('0x40')];if(!_0x551f20[_0x2ff9('0x42')][_0x2ff9('0x49')](_0x2ff9('0x4a'))){_0x310123[_0x2ff9('0x2f')]=qs[_0x2ff9('0x2f')](_0x551f20[_0x2ff9('0x42')][_0x2ff9('0x2f')]);_0x310123[_0x2ff9('0x2c')]=qs[_0x2ff9('0x2c')](_0x551f20['query']['offset']);}_0x310123[_0x2ff9('0x4b')]=qs[_0x2ff9('0x4c')](_0x551f20[_0x2ff9('0x42')]['sort']);_0x310123['where']=qs[_0x2ff9('0x44')](_[_0x2ff9('0x4d')](_0x551f20['query'],_0x502606['filters']),_0x5afafa);if(_0x551f20[_0x2ff9('0x42')][_0x2ff9('0x4e')]){_0x310123['where']=_['merge'](_0x310123[_0x2ff9('0x4f')],{'$or':_[_0x2ff9('0x3c')](_0x5afafa,function(_0x1a8720){if(_0x1a8720[_0x2ff9('0x3f')]!=='VIRTUAL'){var _0x30bcde={};_0x30bcde[_0x1a8720['name']]={'$like':'%'+_0x551f20['query'][_0x2ff9('0x4e')]+'%'};return _0x30bcde;}})});}_0x310123=_[_0x2ff9('0x50')]({},_0x310123,_0x551f20[_0x2ff9('0x51')]);var _0x45229b={'where':_0x310123[_0x2ff9('0x4f')]};return db[_0x2ff9('0x3d')][_0x2ff9('0x2e')](_0x45229b)['then'](function(_0x402f19){_0x329154['count']=_0x402f19;if(_0x551f20['query'][_0x2ff9('0x52')]){_0x310123['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x2ff9('0x53')](_0x310123);})[_0x2ff9('0x37')](function(_0x3a9e0d){_0x329154[_0x2ff9('0x54')]=_0x3a9e0d;return _0x329154;})[_0x2ff9('0x37')](respondWithFilteredResult(_0x261187,_0x310123))[_0x2ff9('0x29')](handleError(_0x261187,null));};exports[_0x2ff9('0x55')]=function(_0x4491ca,_0x2b947c){var _0x207a41={'raw':!![],'where':{'id':_0x4491ca[_0x2ff9('0x56')]['id']}},_0x575d7e={};_0x575d7e[_0x2ff9('0x40')]=_[_0x2ff9('0x43')](db[_0x2ff9('0x3d')][_0x2ff9('0x3e')]);_0x575d7e['query']=_[_0x2ff9('0x43')](_0x4491ca['query']);_0x575d7e['filters']=_[_0x2ff9('0x45')](_0x575d7e[_0x2ff9('0x40')],_0x575d7e[_0x2ff9('0x42')]);_0x207a41['attributes']=_[_0x2ff9('0x45')](_0x575d7e[_0x2ff9('0x40')],qs[_0x2ff9('0x46')](_0x4491ca[_0x2ff9('0x42')][_0x2ff9('0x46')]));_0x207a41[_0x2ff9('0x47')]=_0x207a41[_0x2ff9('0x47')][_0x2ff9('0x48')]?_0x207a41['attributes']:_0x575d7e[_0x2ff9('0x40')];if(_0x4491ca[_0x2ff9('0x42')][_0x2ff9('0x52')]){_0x207a41['include']=[{'all':!![]}];}_0x207a41=_[_0x2ff9('0x50')]({},_0x207a41,_0x4491ca[_0x2ff9('0x51')]);return db[_0x2ff9('0x3d')][_0x2ff9('0x57')](_0x207a41)[_0x2ff9('0x37')](handleEntityNotFound(_0x2b947c,null))[_0x2ff9('0x37')](respondWithResult(_0x2b947c,null))['catch'](handleError(_0x2b947c,null));};exports[_0x2ff9('0x58')]=function(_0x5a79cf,_0x470690){return db[_0x2ff9('0x3d')][_0x2ff9('0x58')](_0x5a79cf['body'],{})[_0x2ff9('0x37')](respondWithResult(_0x470690,0xc9))['catch'](handleError(_0x470690,null));};exports[_0x2ff9('0x36')]=function(_0x2e0abd,_0xc46797){if(_0x2e0abd['body']['id']){delete _0x2e0abd[_0x2ff9('0x59')]['id'];}return db[_0x2ff9('0x3d')][_0x2ff9('0x57')]({'where':{'id':_0x2e0abd[_0x2ff9('0x56')]['id']}})['then'](handleEntityNotFound(_0xc46797,null))['then'](saveUpdates(_0x2e0abd[_0x2ff9('0x59')],null))[_0x2ff9('0x37')](respondWithResult(_0xc46797,null))[_0x2ff9('0x29')](handleError(_0xc46797,null));};exports[_0x2ff9('0x38')]=function(_0x559123,_0x5330b5){return db[_0x2ff9('0x3d')][_0x2ff9('0x57')]({'where':{'id':_0x559123[_0x2ff9('0x56')]['id']}})[_0x2ff9('0x37')](handleEntityNotFound(_0x5330b5,null))[_0x2ff9('0x37')](removeEntity(_0x5330b5,null))[_0x2ff9('0x29')](handleError(_0x5330b5,null));};exports['describe']=function(_0x40dcab,_0x29d661){return db[_0x2ff9('0x3d')][_0x2ff9('0x5a')]()['then'](respondWithResult(_0x29d661,null))[_0x2ff9('0x29')](handleError(_0x29d661,null));};var interaction_log=require(_0x2ff9('0x14'))('whatsapp-interactions');exports['accept']=function(_0x4a113b,_0x563a74,_0x323c88){var _0x5ed130={'agent':{},'channel':_0x2ff9('0x5b')};if(_0x4a113b[_0x2ff9('0x59')]['id']){delete _0x4a113b[_0x2ff9('0x59')]['id'];}_0x4a113b[_0x2ff9('0x59')]['read']=!![];_0x4a113b[_0x2ff9('0x59')]['readAt']=moment()[_0x2ff9('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a113b[_0x2ff9('0x59')][_0x2ff9('0x5d')]=_0x4a113b['body'][_0x2ff9('0x5d')]||_0x4a113b[_0x2ff9('0x5e')]['id'];_0x5ed130[_0x2ff9('0x5f')]['id']=_0x4a113b[_0x2ff9('0x59')][_0x2ff9('0x5d')];return db['WhatsappMessage']['find']({'where':{'id':_0x4a113b['params']['id'],'UserId':null}})[_0x2ff9('0x37')](handleEntityNotFound(_0x563a74,null))[_0x2ff9('0x37')](saveUpdates(_0x4a113b['body'],null))[_0x2ff9('0x37')](function(_0x44a44b){if(_0x44a44b){_0x5ed130[_0x2ff9('0x28')]=_0x44a44b['get']({'plain':!![]});return db[_0x2ff9('0x60')][_0x2ff9('0x57')]({'where':{'id':_0x44a44b['WhatsappInteractionId']}});}return null;})[_0x2ff9('0x37')](handleEntityNotFound(_0x563a74,null))[_0x2ff9('0x37')](function(_0x1a3c1a){if(_0x1a3c1a){return _0x1a3c1a[_0x2ff9('0x36')]({'UserId':_0x4a113b[_0x2ff9('0x59')]['UserId'],'read1stAt':_[_0x2ff9('0x61')](_0x1a3c1a[_0x2ff9('0x62')])?moment()['format'](_0x2ff9('0x63')):undefined});}return null;})[_0x2ff9('0x37')](function(_0x4cc4ed){if(_0x4cc4ed){_0x5ed130['interaction']=_0x4cc4ed['get']({'plain':!![]});interaction_log[_0x2ff9('0x20')](_0x2ff9('0x64'),_0x4a113b[_0x2ff9('0x5e')]['id'],_0x4a113b[_0x2ff9('0x5e')]['name'],_0x4a113b[_0x2ff9('0x5e')][_0x2ff9('0x65')],_0x5ed130[_0x2ff9('0x66')]['id'],_0x4a113b[_0x2ff9('0x59')]?JSON['stringify'](_0x4a113b['body']):_0x2ff9('0x67'));return respondWithRpcPromise('AcceptMessage',_0x2ff9('0x68'),_0x5ed130);}return null;})[_0x2ff9('0x37')](function(_0x5f2935){var _0x4d7cc0=_0x2ff9('0x69')+_0x5f2935[_0x2ff9('0x28')][_0x2ff9('0x6a')];return db['sequelize'][_0x2ff9('0x42')](_0x4d7cc0,{'type':db[_0x2ff9('0x6b')][_0x2ff9('0x6c')][_0x2ff9('0x6d')],'raw':!![]})[_0x2ff9('0x37')](function(_0x437b7a){return _0x437b7a;});})[_0x2ff9('0x37')](function(_0x2c2960){if(_0x2c2960){_0x5ed130['message'][_0x2ff9('0x6e')]=_0x2c2960[0x0];if(!_0x4a113b[_0x2ff9('0x59')]['UserId'])return;return db[_0x2ff9('0x6f')][_0x2ff9('0x57')]({'where':{'id':_0x4a113b[_0x2ff9('0x59')]['UserId'],'role':_0x2ff9('0x5f')},'attributes':['id',_0x2ff9('0x41'),_0x2ff9('0x70'),_0x2ff9('0x71'),'internal'],'raw':!![]});}return null;})[_0x2ff9('0x37')](function(_0x1c5260){if(!_0x1c5260)return null;_0x5ed130[_0x2ff9('0x28')][_0x2ff9('0x5f')]=_0x1c5260;return _0x5ed130;})[_0x2ff9('0x37')](function(_0x1f06a5){if(_0x1f06a5){if(_0x4a113b[_0x2ff9('0x59')][_0x2ff9('0x72')]){_0x5ed130['message']['interface']=util[_0x2ff9('0x5c')](_0x2ff9('0x73'),_0x4a113b['user'][_0x2ff9('0x41')]);_0x5ed130[_0x2ff9('0x28')][_0x2ff9('0x74')]=_0x5ed130[_0x2ff9('0x74')];_0x5ed130[_0x2ff9('0x28')][_0x2ff9('0x75')]=_0x5ed130[_0x2ff9('0x74')];_0x5ed130[_0x2ff9('0x28')][_0x2ff9('0x76')]='accept';return respondWithRpcPromise(_0x2ff9('0x77'),_0x2ff9('0x77'),{'event':_0x2ff9('0x78'),'message':_0x5ed130[_0x2ff9('0x28')]},client9002)['then'](function(){return _0x5ed130;});}return _0x5ed130;}return null;})[_0x2ff9('0x37')](respondWithResult(_0x563a74,null))[_0x2ff9('0x29')](handleError(_0x563a74,null));};var interaction_log=require(_0x2ff9('0x14'))('whatsapp-interactions');exports[_0x2ff9('0x34')]=function(_0x179f1e,_0x3d4012,_0x4f887d){var _0x1fccd2={'agent':{},'channel':_0x2ff9('0x5b')};if(_0x179f1e[_0x2ff9('0x59')]['id']){delete _0x179f1e[_0x2ff9('0x59')]['id'];}_0x179f1e[_0x2ff9('0x59')][_0x2ff9('0x5d')]=_0x179f1e['body'][_0x2ff9('0x5d')]||_0x179f1e[_0x2ff9('0x5e')]['id'];_0x1fccd2['agent']['id']=_0x179f1e[_0x2ff9('0x59')][_0x2ff9('0x5d')];return db[_0x2ff9('0x3d')][_0x2ff9('0x57')]({'where':{'id':_0x179f1e[_0x2ff9('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d4012,null))[_0x2ff9('0x37')](function(_0x5bc1bf){if(_0x5bc1bf){_0x1fccd2[_0x2ff9('0x28')]=_0x5bc1bf[_0x2ff9('0x79')]({'plain':!![]});return db[_0x2ff9('0x60')][_0x2ff9('0x57')]({'where':{'id':_0x5bc1bf['WhatsappInteractionId']}});}return null;})[_0x2ff9('0x37')](handleEntityNotFound(_0x3d4012,null))[_0x2ff9('0x37')](function(_0x40835b){if(_0x40835b){_0x1fccd2['interaction']=_0x40835b[_0x2ff9('0x79')]({'plain':!![]});interaction_log[_0x2ff9('0x20')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x179f1e['user']['id'],_0x179f1e[_0x2ff9('0x5e')]['name'],_0x179f1e['user'][_0x2ff9('0x65')],_0x1fccd2[_0x2ff9('0x66')]['id'],_0x179f1e['body']?JSON[_0x2ff9('0x25')](_0x179f1e['body']):_0x2ff9('0x67'));return respondWithRpcPromise(_0x2ff9('0x7a'),_0x2ff9('0x7b'),_0x1fccd2);}return null;})[_0x2ff9('0x37')](function(_0x209e5a){var _0x162108=_0x2ff9('0x69')+_0x209e5a['message'][_0x2ff9('0x6a')];return db[_0x2ff9('0x7c')]['query'](_0x162108,{'type':db[_0x2ff9('0x6b')]['QueryTypes'][_0x2ff9('0x6d')],'raw':!![]})['then'](function(_0x414b8b){return _0x414b8b;});})[_0x2ff9('0x37')](function(_0x4f680c){if(_0x4f680c){_0x1fccd2[_0x2ff9('0x28')][_0x2ff9('0x6e')]=_0x4f680c[0x0];if(!_0x179f1e['body'][_0x2ff9('0x5d')])return;return db[_0x2ff9('0x6f')][_0x2ff9('0x57')]({'where':{'id':_0x179f1e[_0x2ff9('0x59')][_0x2ff9('0x5d')],'role':_0x2ff9('0x5f')},'attributes':['id','name',_0x2ff9('0x70'),_0x2ff9('0x71'),_0x2ff9('0x7d')],'raw':!![]});}return null;})[_0x2ff9('0x37')](function(_0x2ba020){if(!_0x2ba020)return null;_0x1fccd2[_0x2ff9('0x28')]['agent']=_0x2ba020;return _0x1fccd2;})['then'](function(_0x1fadda){if(_0x1fadda){_0x1fadda[_0x2ff9('0x28')][_0x2ff9('0x7e')]=util['format'](_0x2ff9('0x73'),_0x179f1e[_0x2ff9('0x5e')][_0x2ff9('0x41')]);_0x1fadda[_0x2ff9('0x28')][_0x2ff9('0x74')]=_0x1fccd2['channel'];_0x1fadda[_0x2ff9('0x28')]['motionChannel']=_0x1fccd2[_0x2ff9('0x74')];_0x1fadda[_0x2ff9('0x28')][_0x2ff9('0x76')]='reject';respondWithRpcPromise('EventManager',_0x2ff9('0x77'),{'event':_0x2ff9('0x7f'),'message':_0x1fadda[_0x2ff9('0x28')]},client9002);return _0x1fccd2;}return null;})[_0x2ff9('0x37')](respondWithResult(_0x3d4012,null))[_0x2ff9('0x29')](handleError(_0x3d4012,null));};exports[_0x2ff9('0x2b')]=function(_0x51c232,_0x3ef30c,_0x1b121f){if(_0x51c232['body']['id']){delete _0x51c232['body']['id'];}var _0x19cbe6;return db[_0x2ff9('0x3d')][_0x2ff9('0x57')]({'where':{'id':_0x51c232[_0x2ff9('0x56')]['id']}})['then'](handleEntityNotFound(_0x3ef30c,null))[_0x2ff9('0x37')](function(_0x32ede2){if(_0x32ede2){_0x19cbe6=_0x32ede2;return db[_0x2ff9('0x80')][_0x2ff9('0x57')]({'where':{'id':_0x32ede2[_0x2ff9('0x81')]}});}})[_0x2ff9('0x37')](handleEntityNotFound(_0x3ef30c,null))[_0x2ff9('0x37')](function(_0x44cf97){if(_0x44cf97){logger[_0x2ff9('0x22')](_0x2ff9('0x82'),'status',_0x2ff9('0x83'),_0x44cf97['type'],util[_0x2ff9('0x84')](_0x51c232[_0x2ff9('0x59')],{'showHidden':![],'depth':null}));switch(_0x44cf97['type']){case _0x2ff9('0x85'):if(_0x51c232[_0x2ff9('0x59')][_0x2ff9('0x86')]&&_0x51c232[_0x2ff9('0x59')][_0x2ff9('0x86')]===_0x19cbe6[_0x2ff9('0x87')]&&_0x51c232[_0x2ff9('0x59')][_0x2ff9('0x88')]&&_0x51c232[_0x2ff9('0x59')][_0x2ff9('0x88')]==='read'){return _0x19cbe6[_0x2ff9('0x36')]({'read':!![]});}else{logger[_0x2ff9('0x26')](_0x2ff9('0x89'),_0x2ff9('0x2b'),_0x2ff9('0x85'),util[_0x2ff9('0x84')](_0x51c232[_0x2ff9('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x19cbe6;}})[_0x2ff9('0x37')](respondWithResult(_0x3ef30c,null))[_0x2ff9('0x29')](handleError(_0x3ef30c,null));}; \ No newline at end of file +var _0x2c9d=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save','update','stack','name','map','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','WhatsappMessage','rows','params','include','create','body','find','destroy','describe','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE: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','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','contact','email','internal','reject','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x506b38,_0x40148b){var _0x54a20b=function(_0x274e02){while(--_0x274e02){_0x506b38['push'](_0x506b38['shift']());}};_0x54a20b(++_0x40148b);}(_0x2c9d,0x100));var _0xd2c9=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x2c9d[_0x4d07cc];return _0x42de3b;};'use strict';var emlformat=require(_0xd2c9('0x0'));var rimraf=require(_0xd2c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2c9('0x2'));var rp=require(_0xd2c9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd2c9('0x4'));var util=require(_0xd2c9('0x5'));var path=require(_0xd2c9('0x6'));var sox=require('sox');var csv=require(_0xd2c9('0x7'));var ejs=require(_0xd2c9('0x8'));var fs=require('fs');var fs_extra=require(_0xd2c9('0x9'));var _=require('lodash');var squel=require(_0xd2c9('0xa'));var crypto=require(_0xd2c9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd2c9('0xc'));var toCsv=require(_0xd2c9('0x7'));var querystring=require(_0xd2c9('0xd'));var Papa=require(_0xd2c9('0xe'));var Redis=require(_0xd2c9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd2c9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2c9('0x11'))(_0xd2c9('0x12'));var utils=require(_0xd2c9('0x13'));var config=require(_0xd2c9('0x14'));var licenseUtil=require(_0xd2c9('0x15'));var db=require('../../mysqldb')['db'];config[_0xd2c9('0x16')]=_[_0xd2c9('0x17')](config[_0xd2c9('0x16')],{'host':_0xd2c9('0x18'),'port':0x18eb});var socket=require(_0xd2c9('0x19'))(new Redis(config[_0xd2c9('0x16')]));require(_0xd2c9('0x1a'))[_0xd2c9('0x1b')](socket);var jayson=require(_0xd2c9('0x1c'));var client=jayson[_0xd2c9('0x1d')][_0xd2c9('0x1e')]({'port':0x232c});var client9002=jayson[_0xd2c9('0x1d')][_0xd2c9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4068d9,_0x250d73,_0x520c29,_0x5c2be0){return new BPromise(function(_0x3e6c82,_0x4b78f9){var _0x3f8782=_0x5c2be0||client;return _0x3f8782['request'](_0x4068d9,_0x520c29)[_0xd2c9('0x1f')](function(_0x476c31){logger[_0xd2c9('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x250d73,'request\x20sent');logger[_0xd2c9('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x250d73,_0xd2c9('0x22'),JSON[_0xd2c9('0x23')](_0x476c31));if(_0x476c31[_0xd2c9('0x24')]){if(_0x476c31[_0xd2c9('0x24')][_0xd2c9('0x25')]===0x1f4){logger[_0xd2c9('0x24')](_0xd2c9('0x26'),_0x250d73,_0x476c31[_0xd2c9('0x24')][_0xd2c9('0x27')]);return _0x4b78f9(_0x476c31[_0xd2c9('0x24')][_0xd2c9('0x27')]);}logger['error'](_0xd2c9('0x26'),_0x250d73,_0x476c31['error'][_0xd2c9('0x27')]);return _0x3e6c82(_0x476c31[_0xd2c9('0x24')]['message']);}else{logger[_0xd2c9('0x20')](_0xd2c9('0x26'),_0x250d73,_0xd2c9('0x22'));_0x3e6c82(_0x476c31[_0xd2c9('0x28')][_0xd2c9('0x27')]);}})[_0xd2c9('0x29')](function(_0x4d6ca8){logger[_0xd2c9('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x250d73,_0x4d6ca8);_0x4b78f9(_0x4d6ca8);});});}function respondWithStatusCode(_0x2beacc,_0x2fdad3){_0x2fdad3=_0x2fdad3||0xcc;return function(_0x4b0910){if(_0x4b0910){return _0x2beacc[_0xd2c9('0x2a')](_0x2fdad3);}return _0x2beacc[_0xd2c9('0x2b')](_0x2fdad3)[_0xd2c9('0x2c')]();};}function respondWithResult(_0x118f7c,_0x54df58){_0x54df58=_0x54df58||0xc8;return function(_0x28cd29){if(_0x28cd29){return _0x118f7c['status'](_0x54df58)['json'](_0x28cd29);}};}function respondWithFilteredResult(_0x3c3f7c,_0x4c9de1){return function(_0x474a67){if(_0x474a67){var _0x44fbba=typeof _0x4c9de1[_0xd2c9('0x2d')]==='undefined'&&typeof _0x4c9de1[_0xd2c9('0x2e')]===_0xd2c9('0x2f');var _0x3b96c5=_0x474a67[_0xd2c9('0x30')];var _0x1e0dc6=_0x44fbba?0x0:_0x4c9de1[_0xd2c9('0x2d')];var _0x930b89=_0x44fbba?_0x474a67[_0xd2c9('0x30')]:_0x4c9de1[_0xd2c9('0x2d')]+_0x4c9de1[_0xd2c9('0x2e')];var _0x55d499;if(_0x930b89>=_0x3b96c5){_0x930b89=_0x3b96c5;_0x55d499=0xc8;}else{_0x55d499=0xce;}_0x3c3f7c[_0xd2c9('0x2b')](_0x55d499);return _0x3c3f7c[_0xd2c9('0x31')](_0xd2c9('0x32'),_0x1e0dc6+'-'+_0x930b89+'/'+_0x3b96c5)['json'](_0x474a67);}return null;};}function patchUpdates(_0x5e4df0){return function(_0x118fec){try{jsonpatch[_0xd2c9('0x33')](_0x118fec,_0x5e4df0,!![]);}catch(_0x30d857){return BPromise['reject'](_0x30d857);}return _0x118fec[_0xd2c9('0x34')]();};}function saveUpdates(_0x476d5b,_0x1b89e4){return function(_0x6ed87a){if(_0x6ed87a){return _0x6ed87a[_0xd2c9('0x35')](_0x476d5b)[_0xd2c9('0x1f')](function(_0xf39814){return _0xf39814;});}return null;};}function removeEntity(_0x5e0323,_0x81e299){return function(_0x17a1c8){if(_0x17a1c8){return _0x17a1c8['destroy']()[_0xd2c9('0x1f')](function(){_0x5e0323['status'](0xcc)[_0xd2c9('0x2c')]();});}};}function handleEntityNotFound(_0x34948b,_0x590ee4){return function(_0x423433){if(!_0x423433){_0x34948b['sendStatus'](0x194);}return _0x423433;};}function handleError(_0x303669,_0x19f227){_0x19f227=_0x19f227||0x1f4;return function(_0x2d33f4){logger[_0xd2c9('0x24')](_0x2d33f4[_0xd2c9('0x36')]);if(_0x2d33f4['name']){delete _0x2d33f4[_0xd2c9('0x37')];}_0x303669[_0xd2c9('0x2b')](_0x19f227)['send'](_0x2d33f4);};}exports['index']=function(_0x4fb926,_0x21b9d3){var _0x36664f={},_0x2ff449={},_0xe9fc74={'count':0x0,'rows':[]};var _0x69e0ab=_[_0xd2c9('0x38')](db['WhatsappMessage'][_0xd2c9('0x39')],function(_0x410110){return{'name':_0x410110['fieldName'],'type':_0x410110[_0xd2c9('0x3a')]['key']};});_0x2ff449[_0xd2c9('0x3b')]=_[_0xd2c9('0x38')](_0x69e0ab,'name');_0x2ff449[_0xd2c9('0x3c')]=_[_0xd2c9('0x3d')](_0x4fb926[_0xd2c9('0x3c')]);_0x2ff449['filters']=_[_0xd2c9('0x3e')](_0x2ff449[_0xd2c9('0x3b')],_0x2ff449['query']);_0x36664f['attributes']=_[_0xd2c9('0x3e')](_0x2ff449[_0xd2c9('0x3b')],qs[_0xd2c9('0x3f')](_0x4fb926[_0xd2c9('0x3c')][_0xd2c9('0x3f')]));_0x36664f['attributes']=_0x36664f[_0xd2c9('0x40')][_0xd2c9('0x41')]?_0x36664f[_0xd2c9('0x40')]:_0x2ff449[_0xd2c9('0x3b')];if(!_0x4fb926[_0xd2c9('0x3c')][_0xd2c9('0x42')]('nolimit')){_0x36664f[_0xd2c9('0x2e')]=qs['limit'](_0x4fb926[_0xd2c9('0x3c')]['limit']);_0x36664f['offset']=qs[_0xd2c9('0x2d')](_0x4fb926[_0xd2c9('0x3c')][_0xd2c9('0x2d')]);}_0x36664f[_0xd2c9('0x43')]=qs[_0xd2c9('0x44')](_0x4fb926['query'][_0xd2c9('0x44')]);_0x36664f[_0xd2c9('0x45')]=qs[_0xd2c9('0x46')](_[_0xd2c9('0x47')](_0x4fb926['query'],_0x2ff449[_0xd2c9('0x46')]),_0x69e0ab);if(_0x4fb926['query'][_0xd2c9('0x48')]){_0x36664f['where']=_[_0xd2c9('0x49')](_0x36664f[_0xd2c9('0x45')],{'$or':_[_0xd2c9('0x38')](_0x69e0ab,function(_0x1c6906){if(_0x1c6906[_0xd2c9('0x3a')]!==_0xd2c9('0x4a')){var _0xf6a4e5={};_0xf6a4e5[_0x1c6906[_0xd2c9('0x37')]]={'$like':'%'+_0x4fb926[_0xd2c9('0x3c')][_0xd2c9('0x48')]+'%'};return _0xf6a4e5;}})});}_0x36664f=_['merge']({},_0x36664f,_0x4fb926[_0xd2c9('0x4b')]);var _0x23359f={'where':_0x36664f['where']};return db['WhatsappMessage']['count'](_0x23359f)['then'](function(_0xca0aa6){_0xe9fc74[_0xd2c9('0x30')]=_0xca0aa6;if(_0x4fb926['query'][_0xd2c9('0x4c')]){_0x36664f['include']=[{'all':!![]}];}return db[_0xd2c9('0x4d')]['findAll'](_0x36664f);})[_0xd2c9('0x1f')](function(_0x94989d){_0xe9fc74[_0xd2c9('0x4e')]=_0x94989d;return _0xe9fc74;})[_0xd2c9('0x1f')](respondWithFilteredResult(_0x21b9d3,_0x36664f))['catch'](handleError(_0x21b9d3,null));};exports['show']=function(_0x5391c6,_0x4b67d0){var _0x1a9622={'raw':!![],'where':{'id':_0x5391c6[_0xd2c9('0x4f')]['id']}},_0x11f70c={};_0x11f70c[_0xd2c9('0x3b')]=_[_0xd2c9('0x3d')](db[_0xd2c9('0x4d')][_0xd2c9('0x39')]);_0x11f70c['query']=_[_0xd2c9('0x3d')](_0x5391c6[_0xd2c9('0x3c')]);_0x11f70c[_0xd2c9('0x46')]=_[_0xd2c9('0x3e')](_0x11f70c[_0xd2c9('0x3b')],_0x11f70c[_0xd2c9('0x3c')]);_0x1a9622[_0xd2c9('0x40')]=_[_0xd2c9('0x3e')](_0x11f70c[_0xd2c9('0x3b')],qs[_0xd2c9('0x3f')](_0x5391c6[_0xd2c9('0x3c')]['fields']));_0x1a9622[_0xd2c9('0x40')]=_0x1a9622[_0xd2c9('0x40')][_0xd2c9('0x41')]?_0x1a9622[_0xd2c9('0x40')]:_0x11f70c[_0xd2c9('0x3b')];if(_0x5391c6[_0xd2c9('0x3c')]['includeAll']){_0x1a9622[_0xd2c9('0x50')]=[{'all':!![]}];}_0x1a9622=_[_0xd2c9('0x49')]({},_0x1a9622,_0x5391c6['options']);return db[_0xd2c9('0x4d')]['find'](_0x1a9622)[_0xd2c9('0x1f')](handleEntityNotFound(_0x4b67d0,null))['then'](respondWithResult(_0x4b67d0,null))[_0xd2c9('0x29')](handleError(_0x4b67d0,null));};exports[_0xd2c9('0x51')]=function(_0x1b9b11,_0x443ac7){return db['WhatsappMessage'][_0xd2c9('0x51')](_0x1b9b11['body'],{})[_0xd2c9('0x1f')](respondWithResult(_0x443ac7,0xc9))['catch'](handleError(_0x443ac7,null));};exports[_0xd2c9('0x35')]=function(_0x19e42b,_0x6cb98){if(_0x19e42b[_0xd2c9('0x52')]['id']){delete _0x19e42b[_0xd2c9('0x52')]['id'];}return db[_0xd2c9('0x4d')][_0xd2c9('0x53')]({'where':{'id':_0x19e42b[_0xd2c9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6cb98,null))[_0xd2c9('0x1f')](saveUpdates(_0x19e42b['body'],null))[_0xd2c9('0x1f')](respondWithResult(_0x6cb98,null))[_0xd2c9('0x29')](handleError(_0x6cb98,null));};exports[_0xd2c9('0x54')]=function(_0x17d51d,_0x35b7cb){return db[_0xd2c9('0x4d')][_0xd2c9('0x53')]({'where':{'id':_0x17d51d[_0xd2c9('0x4f')]['id']}})[_0xd2c9('0x1f')](handleEntityNotFound(_0x35b7cb,null))[_0xd2c9('0x1f')](removeEntity(_0x35b7cb,null))['catch'](handleError(_0x35b7cb,null));};exports[_0xd2c9('0x55')]=function(_0x1dba7a,_0x3fc40e){return db[_0xd2c9('0x4d')][_0xd2c9('0x55')]()[_0xd2c9('0x1f')](respondWithResult(_0x3fc40e,null))[_0xd2c9('0x29')](handleError(_0x3fc40e,null));};var interaction_log=require(_0xd2c9('0x11'))('whatsapp-interactions');exports[_0xd2c9('0x56')]=function(_0x54547b,_0xc5691c,_0x5036fb){var _0x3cd638={'agent':{},'channel':_0xd2c9('0x57')};if(_0x54547b[_0xd2c9('0x52')]['id']){delete _0x54547b[_0xd2c9('0x52')]['id'];}_0x54547b[_0xd2c9('0x52')]['read']=!![];_0x54547b[_0xd2c9('0x52')][_0xd2c9('0x58')]=moment()[_0xd2c9('0x59')](_0xd2c9('0x5a'));_0x54547b[_0xd2c9('0x52')][_0xd2c9('0x5b')]=_0x54547b[_0xd2c9('0x52')]['UserId']||_0x54547b[_0xd2c9('0x5c')]['id'];_0x3cd638[_0xd2c9('0x5d')]['id']=_0x54547b[_0xd2c9('0x52')]['UserId'];return db[_0xd2c9('0x4d')]['find']({'where':{'id':_0x54547b[_0xd2c9('0x4f')]['id'],'UserId':null}})[_0xd2c9('0x1f')](handleEntityNotFound(_0xc5691c,null))[_0xd2c9('0x1f')](saveUpdates(_0x54547b['body'],null))['then'](function(_0x100b67){if(_0x100b67){_0x3cd638[_0xd2c9('0x27')]=_0x100b67[_0xd2c9('0x5e')]({'plain':!![]});return db['WhatsappInteraction'][_0xd2c9('0x53')]({'where':{'id':_0x100b67[_0xd2c9('0x5f')]}});}return null;})[_0xd2c9('0x1f')](handleEntityNotFound(_0xc5691c,null))[_0xd2c9('0x1f')](function(_0x30c75c){if(_0x30c75c){return _0x30c75c['update']({'UserId':_0x54547b['body']['UserId'],'read1stAt':_[_0xd2c9('0x60')](_0x30c75c['read1stAt'])?moment()[_0xd2c9('0x59')](_0xd2c9('0x5a')):undefined});}return null;})[_0xd2c9('0x1f')](function(_0x1a6482){if(_0x1a6482){_0x3cd638[_0xd2c9('0x61')]=_0x1a6482[_0xd2c9('0x5e')]({'plain':!![]});interaction_log['info'](_0xd2c9('0x62'),_0x54547b[_0xd2c9('0x5c')]['id'],_0x54547b[_0xd2c9('0x5c')][_0xd2c9('0x37')],_0x54547b[_0xd2c9('0x5c')][_0xd2c9('0x63')],_0x3cd638[_0xd2c9('0x61')]['id'],_0x54547b[_0xd2c9('0x52')]?JSON['stringify'](_0x54547b[_0xd2c9('0x52')]):_0xd2c9('0x64'));return respondWithRpcPromise(_0xd2c9('0x65'),_0xd2c9('0x66'),_0x3cd638);}return null;})[_0xd2c9('0x1f')](function(_0x31ff18){var _0x357e5d=_0xd2c9('0x67')+_0x31ff18[_0xd2c9('0x27')][_0xd2c9('0x68')];return db[_0xd2c9('0x69')][_0xd2c9('0x3c')](_0x357e5d,{'type':db['Sequelize'][_0xd2c9('0x6a')]['SELECT'],'raw':!![]})[_0xd2c9('0x1f')](function(_0xb2190a){return _0xb2190a;});})[_0xd2c9('0x1f')](function(_0x40a43b){if(_0x40a43b){_0x3cd638[_0xd2c9('0x27')]['contact']=_0x40a43b[0x0];if(!_0x54547b[_0xd2c9('0x52')]['UserId'])return;return db['User'][_0xd2c9('0x53')]({'where':{'id':_0x54547b['body']['UserId'],'role':_0xd2c9('0x5d')},'attributes':['id','name',_0xd2c9('0x6b'),'email','internal'],'raw':!![]});}return null;})[_0xd2c9('0x1f')](function(_0x49d9e1){if(!_0x49d9e1)return null;_0x3cd638[_0xd2c9('0x27')][_0xd2c9('0x5d')]=_0x49d9e1;return _0x3cd638;})['then'](function(_0x23c317){if(_0x23c317){if(_0x54547b[_0xd2c9('0x52')][_0xd2c9('0x6c')]){_0x3cd638[_0xd2c9('0x27')][_0xd2c9('0x6d')]=util[_0xd2c9('0x59')](_0xd2c9('0x6e'),_0x54547b['user'][_0xd2c9('0x37')]);_0x3cd638['message'][_0xd2c9('0x6f')]=_0x3cd638[_0xd2c9('0x6f')];_0x3cd638['message'][_0xd2c9('0x70')]=_0x3cd638[_0xd2c9('0x6f')];_0x3cd638['message'][_0xd2c9('0x71')]='accept';return respondWithRpcPromise('EventManager',_0xd2c9('0x72'),{'event':_0xd2c9('0x73'),'message':_0x3cd638[_0xd2c9('0x27')]},client9002)[_0xd2c9('0x1f')](function(){return _0x3cd638;});}return _0x3cd638;}return null;})[_0xd2c9('0x1f')](respondWithResult(_0xc5691c,null))[_0xd2c9('0x29')](handleError(_0xc5691c,null));};var interaction_log=require(_0xd2c9('0x11'))(_0xd2c9('0x74'));exports['reject']=function(_0x23185f,_0x49aa86,_0x2a394e){var _0x27dded={'agent':{},'channel':_0xd2c9('0x57')};if(_0x23185f[_0xd2c9('0x52')]['id']){delete _0x23185f[_0xd2c9('0x52')]['id'];}_0x23185f[_0xd2c9('0x52')][_0xd2c9('0x5b')]=_0x23185f['body'][_0xd2c9('0x5b')]||_0x23185f['user']['id'];_0x27dded[_0xd2c9('0x5d')]['id']=_0x23185f[_0xd2c9('0x52')][_0xd2c9('0x5b')];return db[_0xd2c9('0x4d')][_0xd2c9('0x53')]({'where':{'id':_0x23185f[_0xd2c9('0x4f')]['id'],'UserId':null}})[_0xd2c9('0x1f')](handleEntityNotFound(_0x49aa86,null))[_0xd2c9('0x1f')](function(_0x567edc){if(_0x567edc){_0x27dded[_0xd2c9('0x27')]=_0x567edc['get']({'plain':!![]});return db[_0xd2c9('0x75')][_0xd2c9('0x53')]({'where':{'id':_0x567edc[_0xd2c9('0x5f')]}});}return null;})[_0xd2c9('0x1f')](handleEntityNotFound(_0x49aa86,null))['then'](function(_0x3fe87d){if(_0x3fe87d){_0x27dded[_0xd2c9('0x61')]=_0x3fe87d[_0xd2c9('0x5e')]({'plain':!![]});interaction_log[_0xd2c9('0x20')](_0xd2c9('0x76'),_0x23185f['user']['id'],_0x23185f['user'][_0xd2c9('0x37')],_0x23185f[_0xd2c9('0x5c')]['role'],_0x27dded[_0xd2c9('0x61')]['id'],_0x23185f[_0xd2c9('0x52')]?JSON['stringify'](_0x23185f[_0xd2c9('0x52')]):_0xd2c9('0x64'));return respondWithRpcPromise('RejectMessage',_0xd2c9('0x77'),_0x27dded);}return null;})[_0xd2c9('0x1f')](function(_0x3688c5){var _0x4e960f=_0xd2c9('0x67')+_0x3688c5[_0xd2c9('0x27')][_0xd2c9('0x68')];return db[_0xd2c9('0x69')][_0xd2c9('0x3c')](_0x4e960f,{'type':db[_0xd2c9('0x78')][_0xd2c9('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0xce0c83){return _0xce0c83;});})[_0xd2c9('0x1f')](function(_0x10d006){if(_0x10d006){_0x27dded[_0xd2c9('0x27')][_0xd2c9('0x79')]=_0x10d006[0x0];if(!_0x23185f[_0xd2c9('0x52')]['UserId'])return;return db['User']['find']({'where':{'id':_0x23185f[_0xd2c9('0x52')]['UserId'],'role':_0xd2c9('0x5d')},'attributes':['id','name',_0xd2c9('0x6b'),_0xd2c9('0x7a'),_0xd2c9('0x7b')],'raw':!![]});}return null;})[_0xd2c9('0x1f')](function(_0x29d9f2){if(!_0x29d9f2)return null;_0x27dded[_0xd2c9('0x27')]['agent']=_0x29d9f2;return _0x27dded;})[_0xd2c9('0x1f')](function(_0x4cbc34){if(_0x4cbc34){_0x4cbc34[_0xd2c9('0x27')]['interface']=util[_0xd2c9('0x59')](_0xd2c9('0x6e'),_0x23185f[_0xd2c9('0x5c')][_0xd2c9('0x37')]);_0x4cbc34[_0xd2c9('0x27')][_0xd2c9('0x6f')]=_0x27dded['channel'];_0x4cbc34[_0xd2c9('0x27')]['motionChannel']=_0x27dded[_0xd2c9('0x6f')];_0x4cbc34[_0xd2c9('0x27')]['event']=_0xd2c9('0x7c');respondWithRpcPromise('EventManager','EventManager',{'event':_0xd2c9('0x7d'),'message':_0x4cbc34['message']},client9002);return _0x27dded;}return null;})['then'](respondWithResult(_0x49aa86,null))[_0xd2c9('0x29')](handleError(_0x49aa86,null));};exports[_0xd2c9('0x2b')]=function(_0x4320c8,_0x353776,_0x2cca74){if(_0x4320c8[_0xd2c9('0x52')]['id']){delete _0x4320c8[_0xd2c9('0x52')]['id'];}var _0x4455f1;return db[_0xd2c9('0x4d')]['find']({'where':{'id':_0x4320c8[_0xd2c9('0x4f')]['id']}})[_0xd2c9('0x1f')](handleEntityNotFound(_0x353776,null))[_0xd2c9('0x1f')](function(_0x25b9dd){if(_0x25b9dd){_0x4455f1=_0x25b9dd;return db[_0xd2c9('0x7e')][_0xd2c9('0x53')]({'where':{'id':_0x25b9dd['WhatsappAccountId']}});}})[_0xd2c9('0x1f')](handleEntityNotFound(_0x353776,null))[_0xd2c9('0x1f')](function(_0x43be80){if(_0x43be80){logger[_0xd2c9('0x21')](_0xd2c9('0x7f'),_0xd2c9('0x2b'),_0xd2c9('0x80'),_0x43be80['type'],util[_0xd2c9('0x81')](_0x4320c8[_0xd2c9('0x52')],{'showHidden':![],'depth':null}));switch(_0x43be80[_0xd2c9('0x3a')]){case _0xd2c9('0x82'):if(_0x4320c8[_0xd2c9('0x52')][_0xd2c9('0x83')]&&_0x4320c8[_0xd2c9('0x52')]['MessageSid']===_0x4455f1['messageId']&&_0x4320c8[_0xd2c9('0x52')]['MessageStatus']&&_0x4320c8['body'][_0xd2c9('0x84')]==='read'){return _0x4455f1[_0xd2c9('0x35')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xd2c9('0x2b'),'twilio',util[_0xd2c9('0x81')](_0x4320c8['body'],{'showHidden':![],'depth':null}));}break;}return _0x4455f1;}})[_0xd2c9('0x1f')](respondWithResult(_0x353776,null))[_0xd2c9('0x29')](handleError(_0x353776,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index de04615..ef3db0e 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 _0x4024=['hook','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1704d6,_0x2c4c8d){var _0x1651a6=function(_0x46c435){while(--_0x46c435){_0x1704d6['push'](_0x1704d6['shift']());}};_0x1651a6(++_0x2c4c8d);}(_0x4024,0x89));var _0x4402=function(_0x589bac,_0x56768a){_0x589bac=_0x589bac-0x0;var _0x26a374=_0x4024[_0x589bac];return _0x26a374;};'use strict';var EventEmitter=require(_0x4402('0x0'));var WhatsappMessage=require(_0x4402('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4402('0x2')](0x0);var events={'afterCreate':_0x4402('0x3'),'afterUpdate':'update','afterDestroy':_0x4402('0x4')};function emitEvent(_0x47f001){return function(_0x950c82,_0x117f90,_0x5bdb3f){WhatsappMessageEvents['emit'](_0x47f001+':'+_0x950c82['id'],_0x950c82);WhatsappMessageEvents[_0x4402('0x5')](_0x47f001,_0x950c82);_0x5bdb3f(null);};}for(var e in events){if(events[_0x4402('0x6')](e)){var event=events[e];WhatsappMessage[_0x4402('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x23a3=['update','remove','emit','hasOwnProperty','exports','setMaxListeners'];(function(_0x35ef13,_0xe9c531){var _0x589d61=function(_0xf3c39){while(--_0xf3c39){_0x35ef13['push'](_0x35ef13['shift']());}};_0x589d61(++_0xe9c531);}(_0x23a3,0x131));var _0x323a=function(_0x714e4e,_0x220d25){_0x714e4e=_0x714e4e-0x0;var _0x10552a=_0x23a3[_0x714e4e];return _0x10552a;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x323a('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x323a('0x1'),'afterDestroy':_0x323a('0x2')};function emitEvent(_0x122b97){return function(_0x250485,_0x46030e,_0x180066){WhatsappMessageEvents[_0x323a('0x3')](_0x122b97+':'+_0x250485['id'],_0x250485);WhatsappMessageEvents[_0x323a('0x3')](_0x122b97,_0x250485);_0x180066(null);};}for(var e in events){if(events[_0x323a('0x4')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x323a('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 cb1df1e..e8453e4 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 _0xf6da=['messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','update','createdAt','error','out','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','whatsapp:','/api/whatsapp/messages/','token','sid','catch','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage'];(function(_0x2c6c77,_0x516ae2){var _0x25a647=function(_0xf80a2c){while(--_0xf80a2c){_0x2c6c77['push'](_0x2c6c77['shift']());}};_0x25a647(++_0x516ae2);}(_0xf6da,0x65));var _0xaf6d=function(_0x26b8e4,_0x460f4f){_0x26b8e4=_0x26b8e4-0x0;var _0x24984b=_0xf6da[_0x26b8e4];return _0x24984b;};'use strict';var _=require(_0xaf6d('0x0'));var util=require(_0xaf6d('0x1'));var logger=require(_0xaf6d('0x2'))(_0xaf6d('0x3'));var moment=require(_0xaf6d('0x4'));var BPromise=require(_0xaf6d('0x5'));var rp=require(_0xaf6d('0x6'));var fetch=require(_0xaf6d('0x7'));var fs=require('fs');var path=require(_0xaf6d('0x8'));var rimraf=require(_0xaf6d('0x9'));var config=require(_0xaf6d('0xa'));var attributes=require(_0xaf6d('0xb'));module['exports']=function(_0x268e28,_0x3e97dc){return _0x268e28['define'](_0xaf6d('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xaf6d('0xd'),'fields':[_0xaf6d('0xd')]},{'name':_0xaf6d('0xe'),'fields':[_0xaf6d('0xf')],'type':_0xaf6d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x459868,_0x583b20,_0x20aa96){var _0x5a6255=_0x268e28[_0xaf6d('0x11')];var _0x240f34=_0x459868[_0xaf6d('0x12')]({'plain':!![]});if(_0x240f34[_0xaf6d('0x13')][_0xaf6d('0x14')]()==='in'||_0x240f34['direction'][_0xaf6d('0x14')]()==='out'&&!_0x240f34[_0xaf6d('0x15')]&&!_[_0xaf6d('0x16')](_0x240f34[_0xaf6d('0x17')])){_0x5a6255[_0xaf6d('0x18')]['findOne']({'where':{'id':_0x240f34[_0xaf6d('0x19')]}})['then'](function(_0x570613){if(_0x570613){_0x570613[_0xaf6d('0x1a')]({'lastMsgAt':_0x240f34[_0xaf6d('0x1b')],'lastMsgDirection':_0x240f34[_0xaf6d('0x13')][_0xaf6d('0x14')]()});}})['catch'](function(_0x4feae1){console[_0xaf6d('0x1c')](_0x4feae1);});}if(_0x240f34[_0xaf6d('0x13')]===_0xaf6d('0x1d')&&!_0x240f34[_0xaf6d('0x15')]){var _0x53794f;_0x5a6255[_0xaf6d('0x1e')]['find']({'where':{'id':_0x240f34[_0xaf6d('0x1f')]},'raw':!![]})[_0xaf6d('0x20')](function(_0x312e4c){_0x53794f=_0x312e4c;if(_0x53794f&&_0x53794f[_0xaf6d('0x21')]){switch(_0x53794f['type']){case'twilio':var _0x2b4ac7=require(_0xaf6d('0x22'));if(_0x53794f[_0xaf6d('0x23')]&&_0x53794f[_0xaf6d('0x24')]&&_0x53794f[_0xaf6d('0x25')]){var _0x3ecebc=new _0x2b4ac7(_0x53794f['accountSid'],_0x53794f['authToken']);_0x3ecebc['messages']['create']({'body':_0x240f34[_0xaf6d('0xf')],'to':_0xaf6d('0x26')+_0x240f34[_0xaf6d('0x25')],'from':_0xaf6d('0x26')+_0x53794f['phone'],'statusCallback':_0x53794f['remote']+_0xaf6d('0x27')+_0x240f34['id']+'/status?token='+_0x53794f[_0xaf6d('0x28')]})[_0xaf6d('0x20')](function(_0x34a361){if(_0x34a361[_0xaf6d('0x29')]){return _0x459868['update']({'messageId':_0x34a361[_0xaf6d('0x29')]});}})[_0xaf6d('0x2a')](function(_0x247598){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xaf6d('0x2b'),'twilio',util[_0xaf6d('0x2c')](_0x247598,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xaf6d('0x2b'),_0xaf6d('0x22'),_0xaf6d('0x2d'));}break;case _0xaf6d('0x2e'):var _0x4e2694=_0x53794f['accountSid'];var _0xb4edde=_0x53794f[_0xaf6d('0x24')];var _0x12e672=_0x53794f['baseUrl']+_0xaf6d('0x2f')+_0x4e2694+'/messages/';var _0x170820={'to':[_0x240f34['phone']],'message':{'type':_0xaf6d('0x30'),'text':_0x240f34['body']}};var _0x4c8e27={'method':_0xaf6d('0x31'),'uri':_0x12e672,'headers':{'Authorization':_0xaf6d('0x32')+_0xb4edde,'Content-Type':_0xaf6d('0x33')},'body':_0x170820,'json':!![]};rp(_0x4c8e27)[_0xaf6d('0x20')](function(_0x577f89){if(_0x577f89[_0xaf6d('0x34')][0x0]['message_id']){return _0x459868[_0xaf6d('0x1a')]({'messageId':_0x577f89[_0xaf6d('0x34')][0x0][_0xaf6d('0x35')]});}})[_0xaf6d('0x2a')](function(_0x1b6d54){logger[_0xaf6d('0x36')](_0xaf6d('0x37'),_0x1b6d54);});break;}}})['finally'](function(){_0x20aa96();});}else{_0x20aa96();}}},'charset':'utf8mb4','collate':_0xaf6d('0x38')});}; \ No newline at end of file +var _0x8d39=['../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','toLowerCase','direction','out','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','find','type','twilio','authToken','accountSid','messages','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','util'];(function(_0x4e63f5,_0x7da16e){var _0x46d224=function(_0x5cc980){while(--_0x5cc980){_0x4e63f5['push'](_0x4e63f5['shift']());}};_0x46d224(++_0x7da16e);}(_0x8d39,0xb3));var _0x98d3=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x8d39[_0x173f10];return _0x53142d;};'use strict';var _=require('lodash');var util=require(_0x98d3('0x0'));var logger=require(_0x98d3('0x1'))(_0x98d3('0x2'));var moment=require(_0x98d3('0x3'));var BPromise=require(_0x98d3('0x4'));var rp=require(_0x98d3('0x5'));var fetch=require(_0x98d3('0x6'));var fs=require('fs');var path=require(_0x98d3('0x7'));var rimraf=require(_0x98d3('0x8'));var config=require(_0x98d3('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0x98d3('0xa')]=function(_0x289630,_0x1f5851){return _0x289630[_0x98d3('0xb')](_0x98d3('0xc'),attributes,{'tableName':_0x98d3('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x98d3('0xe')]},{'name':_0x98d3('0xf'),'fields':[_0x98d3('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x144e3a,_0x44a6c1,_0x46ef8f){var _0x5df2df=_0x289630[_0x98d3('0x11')];var _0x29e725=_0x144e3a[_0x98d3('0x12')]({'plain':!![]});if(_0x29e725['direction'][_0x98d3('0x13')]()==='in'||_0x29e725[_0x98d3('0x14')][_0x98d3('0x13')]()===_0x98d3('0x15')&&!_0x29e725['secret']&&!_['isNil'](_0x29e725[_0x98d3('0x16')])){_0x5df2df[_0x98d3('0x17')][_0x98d3('0x18')]({'where':{'id':_0x29e725[_0x98d3('0x19')]}})[_0x98d3('0x1a')](function(_0x18bee9){if(_0x18bee9){_0x18bee9[_0x98d3('0x1b')]({'lastMsgAt':_0x29e725[_0x98d3('0x1c')],'lastMsgDirection':_0x29e725[_0x98d3('0x14')][_0x98d3('0x13')]()});}})[_0x98d3('0x1d')](function(_0x5becea){console[_0x98d3('0x1e')](_0x5becea);});}if(_0x29e725['direction']===_0x98d3('0x15')&&!_0x29e725[_0x98d3('0x1f')]){var _0x4b6ba4;_0x5df2df['WhatsappAccount'][_0x98d3('0x20')]({'where':{'id':_0x29e725['WhatsappAccountId']},'raw':!![]})[_0x98d3('0x1a')](function(_0x2f4426){_0x4b6ba4=_0x2f4426;if(_0x4b6ba4&&_0x4b6ba4[_0x98d3('0x21')]){switch(_0x4b6ba4['type']){case _0x98d3('0x22'):var _0x57d3c6=require(_0x98d3('0x22'));if(_0x4b6ba4['accountSid']&&_0x4b6ba4[_0x98d3('0x23')]&&_0x4b6ba4['phone']){var _0x55af8b=new _0x57d3c6(_0x4b6ba4[_0x98d3('0x24')],_0x4b6ba4[_0x98d3('0x23')]);_0x55af8b[_0x98d3('0x25')]['create']({'body':_0x29e725[_0x98d3('0x10')],'to':_0x98d3('0x26')+_0x29e725[_0x98d3('0x27')],'from':_0x98d3('0x26')+_0x4b6ba4[_0x98d3('0x27')],'statusCallback':_0x4b6ba4[_0x98d3('0x28')]+_0x98d3('0x29')+_0x29e725['id']+_0x98d3('0x2a')+_0x4b6ba4[_0x98d3('0x2b')]})['then'](function(_0xf90db9){if(_0xf90db9[_0x98d3('0x2c')]){return _0x144e3a[_0x98d3('0x1b')]({'messageId':_0xf90db9[_0x98d3('0x2c')]});}})[_0x98d3('0x1d')](function(_0x4f1d8b){logger[_0x98d3('0x1e')](_0x98d3('0x2d'),_0x98d3('0x2e'),_0x98d3('0x22'),util[_0x98d3('0x2f')](_0x4f1d8b,{'showHidden':![],'depth':null}));});}else{logger[_0x98d3('0x1e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x98d3('0x22'),_0x98d3('0x30'));}break;case _0x98d3('0x31'):var _0x515b45=_0x4b6ba4[_0x98d3('0x24')];var _0x443e56=_0x4b6ba4[_0x98d3('0x23')];var _0x637e45=_0x4b6ba4['baseUrl']+_0x98d3('0x32')+_0x515b45+_0x98d3('0x33');var _0x4ad2d6={'to':[_0x29e725['phone']],'message':{'type':_0x98d3('0x34'),'text':_0x29e725[_0x98d3('0x10')]}};var _0x42b10e={'method':'POST','uri':_0x637e45,'headers':{'Authorization':'Bearer\x20'+_0x443e56,'Content-Type':_0x98d3('0x35')},'body':_0x4ad2d6,'json':!![]};rp(_0x42b10e)[_0x98d3('0x1a')](function(_0x5b3db6){if(_0x5b3db6[_0x98d3('0x36')][0x0][_0x98d3('0x37')]){return _0x144e3a['update']({'messageId':_0x5b3db6[_0x98d3('0x36')][0x0][_0x98d3('0x37')]});}})['catch'](function(_0x4f0731){logger[_0x98d3('0x38')](_0x98d3('0x39'),_0x4f0731);});break;}}})[_0x98d3('0x3a')](function(){_0x46ef8f();});}else{_0x46ef8f();}}},'charset':_0x98d3('0x3b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 9c36449..7ba944c 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 _0x19be=['request','then','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x5cc735,_0x5786bd){var _0x8c1101=function(_0x1ed0ea){while(--_0x1ed0ea){_0x5cc735['push'](_0x5cc735['shift']());}};_0x8c1101(++_0x5786bd);}(_0x19be,0x15b));var _0xe19b=function(_0x351fc0,_0x3e6594){_0x351fc0=_0x351fc0-0x0;var _0x277585=_0x19be[_0x351fc0];return _0x277585;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe19b('0x0'));var BPromise=require(_0xe19b('0x1'));var rs=require(_0xe19b('0x2'));var fs=require('fs');var Redis=require(_0xe19b('0x3'));var db=require(_0xe19b('0x4'))['db'];var utils=require(_0xe19b('0x5'));var logger=require(_0xe19b('0x6'))('rpc');var config=require(_0xe19b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe19b('0x8')]['http']({'port':0x232a});config[_0xe19b('0x9')]=_['defaults'](config[_0xe19b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe19b('0xa'))(new Redis(config[_0xe19b('0x9')]));require(_0xe19b('0xb'))[_0xe19b('0xc')](socket);function respondWithRpcPromise(_0x2f1417,_0x592227,_0x5b0db7){return new BPromise(function(_0x1dd2b2,_0x5b549b){return client[_0xe19b('0xd')](_0x2f1417,_0x5b0db7)[_0xe19b('0xe')](function(_0x5a00ee){logger['info'](_0xe19b('0xf'),_0x592227,'request\x20sent');logger['debug'](_0xe19b('0x10'),_0x592227,'request\x20sent',JSON[_0xe19b('0x11')](_0x5a00ee));if(_0x5a00ee[_0xe19b('0x12')]){if(_0x5a00ee[_0xe19b('0x12')]['code']===0x1f4){logger[_0xe19b('0x12')](_0xe19b('0xf'),_0x592227,_0x5a00ee[_0xe19b('0x12')][_0xe19b('0x13')]);return _0x5b549b(_0x5a00ee[_0xe19b('0x12')]['message']);}logger[_0xe19b('0x12')](_0xe19b('0xf'),_0x592227,_0x5a00ee[_0xe19b('0x12')][_0xe19b('0x13')]);return _0x1dd2b2(_0x5a00ee[_0xe19b('0x12')][_0xe19b('0x13')]);}else{logger[_0xe19b('0x14')](_0xe19b('0xf'),_0x592227,_0xe19b('0x15'));_0x1dd2b2(_0x5a00ee[_0xe19b('0x16')]['message']);}})[_0xe19b('0x17')](function(_0x5a6d57){logger[_0xe19b('0x12')](_0xe19b('0xf'),_0x592227,_0x5a6d57);_0x5b549b(_0x5a6d57);});});}exports['CreateWhatsappMessage']=function(_0x1e92c3){var _0x535367=this;return new Promise(function(_0x5b80c2,_0x50aa1c){return db[_0xe19b('0x18')][_0xe19b('0x19')](_0x1e92c3[_0xe19b('0x1a')],{'raw':_0x1e92c3[_0xe19b('0x1b')]?_0x1e92c3['options'][_0xe19b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x215080){logger['info']('CreateWhatsappMessage',_0x1e92c3);logger['debug'](_0xe19b('0x1d'),_0x1e92c3,JSON[_0xe19b('0x11')](_0x215080));_0x5b80c2(_0x215080);})[_0xe19b('0x17')](function(_0x521082){logger[_0xe19b('0x12')](_0xe19b('0x1d'),_0x521082[_0xe19b('0x13')],_0x1e92c3);_0x50aa1c(_0x535367['error'](0x1f4,_0x521082[_0xe19b('0x13')]));});});}; \ No newline at end of file +var _0x5380=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','debug','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1c8ef3,_0x5759fe){var _0x1e6f39=function(_0x3b3af7){while(--_0x3b3af7){_0x1c8ef3['push'](_0x1c8ef3['shift']());}};_0x1e6f39(++_0x5759fe);}(_0x5380,0xd0));var _0x0538=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5380[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x0538('0x0'));var util=require(_0x0538('0x1'));var moment=require(_0x0538('0x2'));var BPromise=require(_0x0538('0x3'));var rs=require(_0x0538('0x4'));var fs=require('fs');var Redis=require(_0x0538('0x5'));var db=require(_0x0538('0x6'))['db'];var utils=require(_0x0538('0x7'));var logger=require(_0x0538('0x8'))(_0x0538('0x9'));var config=require(_0x0538('0xa'));var jayson=require(_0x0538('0xb'));var client=jayson[_0x0538('0xc')][_0x0538('0xd')]({'port':0x232a});config[_0x0538('0xe')]=_[_0x0538('0xf')](config[_0x0538('0xe')],{'host':_0x0538('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0538('0x11'))[_0x0538('0x12')](socket);function respondWithRpcPromise(_0x2a5ce9,_0x4f359c,_0x1910e4){return new BPromise(function(_0x1cbba0,_0x8deb66){return client['request'](_0x2a5ce9,_0x1910e4)['then'](function(_0x111f68){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4f359c,'request\x20sent');logger[_0x0538('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4f359c,_0x0538('0x14'),JSON[_0x0538('0x15')](_0x111f68));if(_0x111f68[_0x0538('0x16')]){if(_0x111f68[_0x0538('0x16')][_0x0538('0x17')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4f359c,_0x111f68['error'][_0x0538('0x18')]);return _0x8deb66(_0x111f68[_0x0538('0x16')]['message']);}logger[_0x0538('0x16')](_0x0538('0x19'),_0x4f359c,_0x111f68[_0x0538('0x16')][_0x0538('0x18')]);return _0x1cbba0(_0x111f68['error'][_0x0538('0x18')]);}else{logger[_0x0538('0x1a')](_0x0538('0x19'),_0x4f359c,_0x0538('0x14'));_0x1cbba0(_0x111f68[_0x0538('0x1b')][_0x0538('0x18')]);}})[_0x0538('0x1c')](function(_0x3494bf){logger[_0x0538('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x4f359c,_0x3494bf);_0x8deb66(_0x3494bf);});});}exports[_0x0538('0x1d')]=function(_0x3017f6){var _0x1d5b8d=this;return new Promise(function(_0x3d849d,_0x1047a4){return db[_0x0538('0x1e')][_0x0538('0x1f')](_0x3017f6[_0x0538('0x20')],{'raw':_0x3017f6[_0x0538('0x21')]?_0x3017f6[_0x0538('0x21')][_0x0538('0x22')]===undefined?!![]:![]:!![]})[_0x0538('0x23')](function(_0x578453){logger[_0x0538('0x1a')](_0x0538('0x1d'),_0x3017f6);logger[_0x0538('0x13')]('CreateWhatsappMessage',_0x3017f6,JSON[_0x0538('0x15')](_0x578453));_0x3d849d(_0x578453);})[_0x0538('0x1c')](function(_0x1cc060){logger[_0x0538('0x16')]('CreateWhatsappMessage',_0x1cc060[_0x0538('0x18')],_0x3017f6);_0x1047a4(_0x1d5b8d[_0x0538('0x16')](0x1f4,_0x1cc060[_0x0538('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 864e487..abb6fd4 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 _0xd11c=['emit','removeListener','whatsappMessage:'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd11c,0x1ef));var _0xcd11=function(_0x25f28b,_0x4a11b0){_0x25f28b=_0x25f28b-0x0;var _0x3b7411=_0xd11c[_0x25f28b];return _0x3b7411;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save','remove','update'];function createListener(_0x52e498,_0x1d1461){return function(_0x307eaa){_0x1d1461[_0xcd11('0x0')](_0x52e498,_0x307eaa);};}function removeListener(_0x5565a9,_0x27129c){return function(){WhatsappMessageEvents[_0xcd11('0x1')](_0x5565a9,_0x27129c);};}exports['register']=function(_0x4d78d1){for(var _0x3ae954=0x0,_0x2caecd=events['length'];_0x3ae954<_0x2caecd;_0x3ae954++){var _0x1b54aa=events[_0x3ae954];var _0x2ddd92=createListener(_0xcd11('0x2')+_0x1b54aa,_0x4d78d1);WhatsappMessageEvents['on'](_0x1b54aa,_0x2ddd92);}}; \ No newline at end of file +var _0xe223=['save','remove','emit','removeListener','register','length','whatsappMessage:'];(function(_0x3e9155,_0x38e9d2){var _0x5de67a=function(_0x177031){while(--_0x177031){_0x3e9155['push'](_0x3e9155['shift']());}};_0x5de67a(++_0x38e9d2);}(_0xe223,0x19d));var _0x3e22=function(_0x3c20c9,_0x49d60c){_0x3c20c9=_0x3c20c9-0x0;var _0x173dc3=_0xe223[_0x3c20c9];return _0x173dc3;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x3e22('0x0'),_0x3e22('0x1'),'update'];function createListener(_0x230d64,_0x419087){return function(_0x22e260){_0x419087[_0x3e22('0x2')](_0x230d64,_0x22e260);};}function removeListener(_0x4b4fc2,_0xbe84a8){return function(){WhatsappMessageEvents[_0x3e22('0x3')](_0x4b4fc2,_0xbe84a8);};}exports[_0x3e22('0x4')]=function(_0x1a951f){for(var _0x8a4ca=0x0,_0x177965=events[_0x3e22('0x5')];_0x8a4ca<_0x177965;_0x8a4ca++){var _0x27dfb5=events[_0x8a4ca];var _0x5f3c74=createListener(_0x3e22('0x6')+_0x27dfb5,_0x1a951f);WhatsappMessageEvents['on'](_0x27dfb5,_0x5f3c74);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 039ac41..f240f19 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 _0x155f=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','show','getMembers'];(function(_0x2aa060,_0x5e3fb9){var _0x3306cc=function(_0x24aafe){while(--_0x24aafe){_0x2aa060['push'](_0x2aa060['shift']());}};_0x3306cc(++_0x5e3fb9);}(_0x155f,0x85));var _0xf155=function(_0x4bf643,_0x4ce13b){_0x4bf643=_0x4bf643-0x0;var _0x183cd0=_0x155f[_0x4bf643];return _0x183cd0;};'use strict';var multer=require(_0xf155('0x0'));var util=require(_0xf155('0x1'));var path=require(_0xf155('0x2'));var timeout=require('connect-timeout');var express=require(_0xf155('0x3'));var router=express[_0xf155('0x4')]();var fs_extra=require(_0xf155('0x5'));var auth=require(_0xf155('0x6'));var interaction=require(_0xf155('0x7'));var config=require(_0xf155('0x8'));var controller=require(_0xf155('0x9'));router[_0xf155('0xa')]('/',auth[_0xf155('0xb')](),controller[_0xf155('0xc')]);router[_0xf155('0xa')]('/describe',auth[_0xf155('0xb')](),controller[_0xf155('0xd')]);router[_0xf155('0xa')](_0xf155('0xe'),auth[_0xf155('0xb')](),controller[_0xf155('0xf')]);router[_0xf155('0xa')]('/:id/members',auth[_0xf155('0xb')](),controller[_0xf155('0x10')]);router[_0xf155('0xa')](_0xf155('0x11'),auth['isAuthenticated'](),controller[_0xf155('0x12')]);router[_0xf155('0xa')](_0xf155('0x13'),auth[_0xf155('0xb')](),controller[_0xf155('0x14')]);router[_0xf155('0x15')]('/',auth['isAuthenticated'](),controller[_0xf155('0x16')]);router[_0xf155('0x15')](_0xf155('0x11'),auth['isAuthenticated'](),controller[_0xf155('0x17')]);router[_0xf155('0x15')](_0xf155('0x13'),auth[_0xf155('0xb')](),controller['addAgents']);router[_0xf155('0x18')](_0xf155('0xe'),auth[_0xf155('0xb')](),controller['update']);router[_0xf155('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xf155('0x1a')]);router[_0xf155('0x19')](_0xf155('0x11'),auth[_0xf155('0xb')](),controller[_0xf155('0x1b')]);router[_0xf155('0x19')](_0xf155('0x13'),auth[_0xf155('0xb')](),controller[_0xf155('0x1c')]);module[_0xf155('0x1d')]=router; \ No newline at end of file +var _0xf1e3=['addTeams','addAgents','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create'];(function(_0x2bf5d1,_0x14e28f){var _0x3472c6=function(_0xa369da){while(--_0xa369da){_0x2bf5d1['push'](_0x2bf5d1['shift']());}};_0x3472c6(++_0x14e28f);}(_0xf1e3,0x17d));var _0x3f1e=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0xf1e3[_0x4d05a0];return _0x4c999c;};'use strict';var multer=require(_0x3f1e('0x0'));var util=require(_0x3f1e('0x1'));var path=require(_0x3f1e('0x2'));var timeout=require(_0x3f1e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3f1e('0x4'));var interaction=require(_0x3f1e('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x3f1e('0x6')](),controller[_0x3f1e('0x7')]);router[_0x3f1e('0x8')](_0x3f1e('0x9'),auth[_0x3f1e('0x6')](),controller['describe']);router[_0x3f1e('0x8')](_0x3f1e('0xa'),auth['isAuthenticated'](),controller[_0x3f1e('0xb')]);router['get'](_0x3f1e('0xc'),auth[_0x3f1e('0x6')](),controller[_0x3f1e('0xd')]);router[_0x3f1e('0x8')](_0x3f1e('0xe'),auth['isAuthenticated'](),controller[_0x3f1e('0xf')]);router[_0x3f1e('0x8')](_0x3f1e('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x3f1e('0x11')]('/',auth[_0x3f1e('0x6')](),controller[_0x3f1e('0x12')]);router[_0x3f1e('0x11')](_0x3f1e('0xe'),auth[_0x3f1e('0x6')](),controller[_0x3f1e('0x13')]);router[_0x3f1e('0x11')](_0x3f1e('0x10'),auth[_0x3f1e('0x6')](),controller[_0x3f1e('0x14')]);router['put'](_0x3f1e('0xa'),auth[_0x3f1e('0x6')](),controller['update']);router[_0x3f1e('0x15')](_0x3f1e('0xa'),auth[_0x3f1e('0x6')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x3f1e('0x16')]);router['delete'](_0x3f1e('0x10'),auth[_0x3f1e('0x6')](),controller[_0x3f1e('0x17')]);module[_0x3f1e('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 a8791c6..d66e4af 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 _0x4de7=['rrmemory','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x2afffb,_0x52f011){var _0x3a0a8b=function(_0x16674b){while(--_0x16674b){_0x2afffb['push'](_0x2afffb['shift']());}};_0x3a0a8b(++_0x52f011);}(_0x4de7,0x1f3));var _0x74de=function(_0x1ba6ba,_0xad4992){_0x1ba6ba=_0x1ba6ba-0x0;var _0x2749c9=_0x4de7[_0x1ba6ba];return _0x2749c9;};'use strict';var Sequelize=require(_0x74de('0x0'));module['exports']={'name':{'type':Sequelize[_0x74de('0x1')],'unique':_0x74de('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x74de('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x74de('0x4')](_0x74de('0x5'),'beepall',_0x74de('0x6'))},'description':{'type':Sequelize[_0x74de('0x1')]}}; \ No newline at end of file +var _0xb469=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xb469,0x13b));var _0x9b46=function(_0xed22c3,_0x5abf01){_0xed22c3=_0xed22c3-0x0;var _0xe2e381=_0xb469[_0xed22c3];return _0xe2e381;};'use strict';var Sequelize=require(_0x9b46('0x0'));module[_0x9b46('0x1')]={'name':{'type':Sequelize[_0x9b46('0x2')],'unique':_0x9b46('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9b46('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b46('0x5')](_0x9b46('0x6'),'beepall',_0x9b46('0x7'))},'description':{'type':Sequelize[_0x9b46('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 4de1989..5bdf276 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 _0x8574=['filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','pick','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','length','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','removeTeams','ids','tq.TeamId','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','compact','value','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','end','error','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','nolimit','sort','where'];(function(_0xce44ee,_0x387d70){var _0xf97a49=function(_0x3ceab0){while(--_0x3ceab0){_0xce44ee['push'](_0xce44ee['shift']());}};_0xf97a49(++_0x387d70);}(_0x8574,0x1e9));var _0x4857=function(_0x34dc5c,_0x3a1077){_0x34dc5c=_0x34dc5c-0x0;var _0x1af497=_0x8574[_0x34dc5c];return _0x1af497;};'use strict';var emlformat=require(_0x4857('0x0'));var rimraf=require(_0x4857('0x1'));var zipdir=require(_0x4857('0x2'));var jsonpatch=require(_0x4857('0x3'));var rp=require('request-promise');var moment=require(_0x4857('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4857('0x5'));var path=require(_0x4857('0x6'));var sox=require(_0x4857('0x7'));var csv=require(_0x4857('0x8'));var ejs=require(_0x4857('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4857('0xa'));var squel=require('squel');var crypto=require(_0x4857('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4857('0xc'));var Papa=require(_0x4857('0xd'));var Redis=require(_0x4857('0xe'));var authService=require(_0x4857('0xf'));var qs=require(_0x4857('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4857('0x11'))(_0x4857('0x12'));var utils=require('../../config/utils');var config=require(_0x4857('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4857('0x14'))['db'];config[_0x4857('0x15')]=_['defaults'](config[_0x4857('0x15')],{'host':_0x4857('0x16'),'port':0x18eb});var socket=require(_0x4857('0x17'))(new Redis(config[_0x4857('0x15')]));require(_0x4857('0x18'))['register'](socket);function respondWithStatusCode(_0xbca60f,_0x23581d){_0x23581d=_0x23581d||0xcc;return function(_0x340d69){if(_0x340d69){return _0xbca60f[_0x4857('0x19')](_0x23581d);}return _0xbca60f[_0x4857('0x1a')](_0x23581d)['end']();};}function respondWithResult(_0x51b4bf,_0x1db6ca){_0x1db6ca=_0x1db6ca||0xc8;return function(_0x2f2401){if(_0x2f2401){return _0x51b4bf[_0x4857('0x1a')](_0x1db6ca)['json'](_0x2f2401);}};}function respondWithFilteredResult(_0x193f6c,_0x1b440d){return function(_0x318d6a){if(_0x318d6a){var _0x4db031=typeof _0x1b440d[_0x4857('0x1b')]===_0x4857('0x1c')&&typeof _0x1b440d[_0x4857('0x1d')]==='undefined';var _0x28137a=_0x318d6a[_0x4857('0x1e')];var _0x22e852=_0x4db031?0x0:_0x1b440d['offset'];var _0x5075c4=_0x4db031?_0x318d6a[_0x4857('0x1e')]:_0x1b440d['offset']+_0x1b440d[_0x4857('0x1d')];var _0xedc41c;if(_0x5075c4>=_0x28137a){_0x5075c4=_0x28137a;_0xedc41c=0xc8;}else{_0xedc41c=0xce;}_0x193f6c['status'](_0xedc41c);return _0x193f6c[_0x4857('0x1f')](_0x4857('0x20'),_0x22e852+'-'+_0x5075c4+'/'+_0x28137a)[_0x4857('0x21')](_0x318d6a);}return null;};}function patchUpdates(_0x23459c){return function(_0x1a9fc7){try{jsonpatch[_0x4857('0x22')](_0x1a9fc7,_0x23459c,!![]);}catch(_0x34bbd1){return BPromise[_0x4857('0x23')](_0x34bbd1);}return _0x1a9fc7['save']();};}function saveUpdates(_0x5ebdb1,_0x118265){return function(_0xada7c4){if(_0xada7c4){return _0xada7c4[_0x4857('0x24')](_0x5ebdb1)[_0x4857('0x25')](function(_0x31ff9d){return _0x31ff9d;});}return null;};}function removeEntity(_0x2c4b62,_0x9a1396){return function(_0x2762d7){if(_0x2762d7){return _0x2762d7['destroy']()[_0x4857('0x25')](function(){var _0x5d481f=_0x2762d7[_0x4857('0x26')]({'plain':!![]});var _0x240511=_0x4857('0x27');return db[_0x4857('0x28')][_0x4857('0x29')]({'where':{'type':_0x240511,'resourceId':_0x5d481f['id']}})[_0x4857('0x25')](function(){return _0x2762d7;});})[_0x4857('0x25')](function(){_0x2c4b62['status'](0xcc)[_0x4857('0x2a')]();});}};}function handleEntityNotFound(_0xdbb3ea,_0x24d9b9){return function(_0x49e0ca){if(!_0x49e0ca){_0xdbb3ea[_0x4857('0x19')](0x194);}return _0x49e0ca;};}function handleError(_0x1f6afa,_0x572bb8){_0x572bb8=_0x572bb8||0x1f4;return function(_0x215862){logger[_0x4857('0x2b')](_0x215862[_0x4857('0x2c')]);if(_0x215862[_0x4857('0x2d')]){delete _0x215862[_0x4857('0x2d')];}_0x1f6afa[_0x4857('0x1a')](_0x572bb8)[_0x4857('0x2e')](_0x215862);};}exports[_0x4857('0x2f')]=function(_0x30239f,_0x31f9a5){var _0x564d86={},_0x5a87dc={},_0x309c85={'count':0x0,'rows':[]};var _0x14dff0=_['map'](db[_0x4857('0x30')][_0x4857('0x31')],function(_0x4115d3){return{'name':_0x4115d3[_0x4857('0x32')],'type':_0x4115d3[_0x4857('0x33')][_0x4857('0x34')]};});_0x5a87dc[_0x4857('0x35')]=_[_0x4857('0x36')](_0x14dff0,_0x4857('0x2d'));_0x5a87dc['query']=_[_0x4857('0x37')](_0x30239f[_0x4857('0x38')]);_0x5a87dc['filters']=_['intersection'](_0x5a87dc['model'],_0x5a87dc[_0x4857('0x38')]);_0x564d86['attributes']=_[_0x4857('0x39')](_0x5a87dc[_0x4857('0x35')],qs[_0x4857('0x3a')](_0x30239f[_0x4857('0x38')][_0x4857('0x3a')]));_0x564d86[_0x4857('0x3b')]=_0x564d86[_0x4857('0x3b')]['length']?_0x564d86['attributes']:_0x5a87dc[_0x4857('0x35')];if(!_0x30239f[_0x4857('0x38')]['hasOwnProperty'](_0x4857('0x3c'))){_0x564d86[_0x4857('0x1d')]=qs['limit'](_0x30239f['query'][_0x4857('0x1d')]);_0x564d86[_0x4857('0x1b')]=qs[_0x4857('0x1b')](_0x30239f[_0x4857('0x38')]['offset']);}_0x564d86['order']=qs['sort'](_0x30239f[_0x4857('0x38')][_0x4857('0x3d')]);_0x564d86[_0x4857('0x3e')]=qs[_0x4857('0x3f')](_['pick'](_0x30239f['query'],_0x5a87dc[_0x4857('0x3f')]),_0x14dff0);if(_0x30239f[_0x4857('0x38')][_0x4857('0x40')]){_0x564d86[_0x4857('0x3e')]=_[_0x4857('0x41')](_0x564d86[_0x4857('0x3e')],{'$or':_[_0x4857('0x36')](_0x14dff0,function(_0x3d2f1e){if(_0x3d2f1e[_0x4857('0x33')]!==_0x4857('0x42')){var _0x3b5606={};_0x3b5606[_0x3d2f1e[_0x4857('0x2d')]]={'$like':'%'+_0x30239f['query'][_0x4857('0x40')]+'%'};return _0x3b5606;}})});}_0x564d86=_[_0x4857('0x41')]({},_0x564d86,_0x30239f[_0x4857('0x43')]);var _0x19bb51={'where':_0x564d86['where']};return db[_0x4857('0x30')][_0x4857('0x1e')](_0x19bb51)['then'](function(_0xf43505){_0x309c85[_0x4857('0x1e')]=_0xf43505;if(_0x30239f[_0x4857('0x38')][_0x4857('0x44')]){_0x564d86[_0x4857('0x45')]=[{'all':!![]}];}return db[_0x4857('0x30')][_0x4857('0x46')](_0x564d86);})[_0x4857('0x25')](function(_0x5018a1){_0x309c85['rows']=_0x5018a1;return _0x309c85;})['then'](respondWithFilteredResult(_0x31f9a5,_0x564d86))['catch'](handleError(_0x31f9a5,null));};exports[_0x4857('0x47')]=function(_0x23e53c,_0x384e11){var _0x2872bb={'raw':!![],'where':{'id':_0x23e53c[_0x4857('0x48')]['id']}},_0xce05eb={};_0xce05eb[_0x4857('0x35')]=_['keys'](db[_0x4857('0x30')][_0x4857('0x31')]);_0xce05eb[_0x4857('0x38')]=_[_0x4857('0x37')](_0x23e53c['query']);_0xce05eb[_0x4857('0x3f')]=_[_0x4857('0x39')](_0xce05eb[_0x4857('0x35')],_0xce05eb[_0x4857('0x38')]);_0x2872bb[_0x4857('0x3b')]=_[_0x4857('0x39')](_0xce05eb[_0x4857('0x35')],qs[_0x4857('0x3a')](_0x23e53c['query'][_0x4857('0x3a')]));_0x2872bb[_0x4857('0x3b')]=_0x2872bb[_0x4857('0x3b')]['length']?_0x2872bb[_0x4857('0x3b')]:_0xce05eb[_0x4857('0x35')];if(_0x23e53c[_0x4857('0x38')][_0x4857('0x44')]){_0x2872bb[_0x4857('0x45')]=[{'all':!![]}];}_0x2872bb=_[_0x4857('0x41')]({},_0x2872bb,_0x23e53c[_0x4857('0x43')]);return db[_0x4857('0x30')][_0x4857('0x49')](_0x2872bb)['then'](handleEntityNotFound(_0x384e11,null))[_0x4857('0x25')](respondWithResult(_0x384e11,null))[_0x4857('0x4a')](handleError(_0x384e11,null));};exports[_0x4857('0x4b')]=function(_0x333b80,_0x4f0c3f){return db[_0x4857('0x30')][_0x4857('0x4b')](_0x333b80['body'],{})['then'](function(_0x3fd1bf){var _0x20582f=_0x333b80[_0x4857('0x4c')][_0x4857('0x26')]({'plain':!![]});if(!_0x20582f)throw new Error(_0x4857('0x4d'));if(_0x20582f[_0x4857('0x4e')]==='user'){var _0xfa4229=_0x3fd1bf[_0x4857('0x26')]({'plain':!![]});var _0x2e7f8b=_0x4857('0x27');return db[_0x4857('0x4f')][_0x4857('0x49')]({'where':{'name':_0x2e7f8b,'userProfileId':_0x20582f[_0x4857('0x50')]},'raw':!![]})[_0x4857('0x25')](function(_0x6bbad0){if(_0x6bbad0&&_0x6bbad0['autoAssociation']===0x0){return db[_0x4857('0x28')]['create']({'name':_0xfa4229[_0x4857('0x2d')],'resourceId':_0xfa4229['id'],'type':_0x6bbad0['name'],'sectionId':_0x6bbad0['id']},{})[_0x4857('0x25')](function(){return _0x3fd1bf;});}else{return _0x3fd1bf;}})[_0x4857('0x4a')](function(_0x54ebd8){logger[_0x4857('0x2b')](_0x4857('0x51'),_0x54ebd8);throw _0x54ebd8;});}return _0x3fd1bf;})['then'](respondWithResult(_0x4f0c3f,0xc9))['catch'](handleError(_0x4f0c3f,null));};exports[_0x4857('0x24')]=function(_0x18a204,_0x27cf45){if(_0x18a204[_0x4857('0x52')]['id']){delete _0x18a204[_0x4857('0x52')]['id'];}return db[_0x4857('0x30')][_0x4857('0x49')]({'where':{'id':_0x18a204[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x27cf45,null))['then'](saveUpdates(_0x18a204['body'],null))[_0x4857('0x25')](respondWithResult(_0x27cf45,null))['catch'](handleError(_0x27cf45,null));};exports[_0x4857('0x29')]=function(_0x33a6c6,_0x31ec9b){return db[_0x4857('0x30')][_0x4857('0x49')]({'where':{'id':_0x33a6c6[_0x4857('0x48')]['id']}})['then'](handleEntityNotFound(_0x31ec9b,null))[_0x4857('0x25')](removeEntity(_0x31ec9b,null))[_0x4857('0x4a')](handleError(_0x31ec9b,null));};exports[_0x4857('0x53')]=function(_0x362366,_0x52c9aa){return db[_0x4857('0x30')][_0x4857('0x53')]()[_0x4857('0x25')](respondWithResult(_0x52c9aa,null))[_0x4857('0x4a')](handleError(_0x52c9aa,null));};exports[_0x4857('0x54')]=function(_0x2531a7,_0x3eb32a,_0x1ac988){var _0x304208={'raw':!![],'where':{}},_0x3ab3a9={},_0x2add61;return db[_0x4857('0x30')][_0x4857('0x55')]({'where':{'id':_0x2531a7[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x3eb32a,null))[_0x4857('0x25')](function(_0x42178e){if(_0x42178e){_0x2add61=_0x42178e[_0x4857('0x26')]({'plain':!![]});_0x3ab3a9[_0x4857('0x35')]=_[_0x4857('0x37')](db[_0x4857('0x56')][_0x4857('0x31')]);_0x3ab3a9[_0x4857('0x38')]=_['keys'](_0x2531a7[_0x4857('0x38')]);_0x3ab3a9['filters']=_[_0x4857('0x39')](_0x3ab3a9[_0x4857('0x35')],_0x3ab3a9[_0x4857('0x38')]);_0x304208[_0x4857('0x3b')]=_[_0x4857('0x39')](_0x3ab3a9[_0x4857('0x35')],qs['fields'](_0x2531a7['query'][_0x4857('0x3a')]));_0x304208[_0x4857('0x3b')]=_0x304208[_0x4857('0x3b')]['length']?_0x304208['attributes']:_0x3ab3a9[_0x4857('0x35')];if(!_0x2531a7[_0x4857('0x38')][_0x4857('0x57')](_0x4857('0x3c'))){_0x304208[_0x4857('0x1d')]=qs[_0x4857('0x1d')](_0x2531a7[_0x4857('0x38')][_0x4857('0x1d')]);_0x304208['offset']=qs[_0x4857('0x1b')](_0x2531a7['query']['offset']);}_0x304208[_0x4857('0x58')]=qs[_0x4857('0x3d')](_0x2531a7[_0x4857('0x38')][_0x4857('0x3d')]);_0x304208[_0x4857('0x3e')]=qs[_0x4857('0x3f')](_[_0x4857('0x59')](_0x2531a7[_0x4857('0x38')],_0x3ab3a9[_0x4857('0x3f')]));_0x304208[_0x4857('0x3e')]['WhatsappQueueId']=_0x42178e['id'];if(_0x2531a7['query'][_0x4857('0x40')]){_0x304208['where']=_['merge'](_0x304208[_0x4857('0x3e')],{'$or':_[_0x4857('0x36')](_0x304208['attributes'],function(_0x3d3be1){var _0x44abf9={};_0x44abf9[_0x3d3be1]={'$like':'%'+_0x2531a7['query'][_0x4857('0x40')]+'%'};return _0x44abf9;})});}_0x304208=_[_0x4857('0x41')]({},_0x304208,_0x2531a7[_0x4857('0x43')]);return db[_0x4857('0x56')][_0x4857('0x46')](_0x304208);}})[_0x4857('0x25')](function(_0x243bf3){if(_0x243bf3){return db[_0x4857('0x5a')][_0x4857('0x5b')]({'where':{'id':_[_0x4857('0x36')](_0x243bf3,_0x4857('0x5c')),'role':_0x4857('0x5d')},'attributes':['id',_0x4857('0x2d'),_0x4857('0x5e'),_0x4857('0x5f'),_0x4857('0x60')]});}})[_0x4857('0x25')](function(_0x1e38a5){if(_0x1e38a5){return{'count':_0x1e38a5[_0x4857('0x1e')],'rows':_[_0x4857('0x36')](_0x1e38a5[_0x4857('0x61')],function(_0x41f0b3){return{'membername':_0x41f0b3[_0x4857('0x2d')],'UserId':_0x41f0b3['id'],'queue_name':_0x2add61[_0x4857('0x2d')],'WhatsappQueueId':_0x2add61['id'],'interface':util[_0x4857('0x62')]('%s/%s',_0x4857('0x63'),_0x41f0b3[_0x4857('0x2d')]),'penalty':0x0,'paused':_0x41f0b3[_0x4857('0x5e')],'createdAt':_0x41f0b3[_0x4857('0x60')],'updatedAt':_0x41f0b3[_0x4857('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4857('0x25')](respondWithFilteredResult(_0x3eb32a,_0x304208))['catch'](handleError(_0x3eb32a,null));};exports[_0x4857('0x64')]=function(_0x5268fc,_0x4dfb90,_0x2e2f2c){var _0x59f862={};var _0xfde5b9={};var _0x40bfbe;var _0x3af469;return db['WhatsappQueue'][_0x4857('0x55')]({'where':{'id':_0x5268fc[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x4dfb90,null))['then'](function(_0x13e48c){if(_0x13e48c){_0x40bfbe=_0x13e48c;_0xfde5b9[_0x4857('0x35')]=_[_0x4857('0x37')](db[_0x4857('0x65')][_0x4857('0x31')]);_0xfde5b9['query']=_[_0x4857('0x37')](_0x5268fc[_0x4857('0x38')]);_0xfde5b9[_0x4857('0x3f')]=_['intersection'](_0xfde5b9[_0x4857('0x35')],_0xfde5b9[_0x4857('0x38')]);_0x59f862[_0x4857('0x3b')]=_[_0x4857('0x39')](_0xfde5b9[_0x4857('0x35')],qs[_0x4857('0x3a')](_0x5268fc[_0x4857('0x38')][_0x4857('0x3a')]));_0x59f862[_0x4857('0x3b')]=_0x59f862[_0x4857('0x3b')][_0x4857('0x66')]?_0x59f862[_0x4857('0x3b')]:_0xfde5b9['model'];_0x59f862[_0x4857('0x58')]=qs['sort'](_0x5268fc['query'][_0x4857('0x3d')]);_0x59f862[_0x4857('0x3e')]=qs[_0x4857('0x3f')](_[_0x4857('0x59')](_0x5268fc[_0x4857('0x38')],_0xfde5b9[_0x4857('0x3f')]));if(_0x5268fc[_0x4857('0x38')]['filter']){_0x59f862['where']=_[_0x4857('0x41')](_0x59f862['where'],{'$or':_[_0x4857('0x36')](_0x59f862[_0x4857('0x3b')],function(_0x5ee627){var _0x45f110={};_0x45f110[_0x5ee627]={'$like':'%'+_0x5268fc[_0x4857('0x38')][_0x4857('0x40')]+'%'};return _0x45f110;})});}_0x59f862=_['merge']({},_0x59f862,_0x5268fc[_0x4857('0x43')]);return _0x40bfbe['getTeams'](_0x59f862);}})[_0x4857('0x25')](function(_0x3c49e8){if(_0x3c49e8){_0x3af469=_0x3c49e8[_0x4857('0x66')];if(!_0x5268fc[_0x4857('0x38')][_0x4857('0x57')](_0x4857('0x3c'))){_0x59f862[_0x4857('0x1d')]=qs['limit'](_0x5268fc['query'][_0x4857('0x1d')]);_0x59f862[_0x4857('0x1b')]=qs[_0x4857('0x1b')](_0x5268fc['query']['offset']);}return _0x40bfbe['getTeams'](_0x59f862);}})[_0x4857('0x25')](function(_0x1ae1a4){if(_0x1ae1a4){return _0x1ae1a4?{'count':_0x3af469,'rows':_0x1ae1a4}:null;}})[_0x4857('0x25')](respondWithResult(_0x4dfb90,null))[_0x4857('0x4a')](handleError(_0x4dfb90,null));};exports['addTeams']=function(_0x4f5caa,_0x3d38e5,_0x5c09e5){var _0x1d4099=_0x4f5caa[_0x4857('0x52')]['ids'];return db[_0x4857('0x65')]['findAll']({'where':{'id':_0x1d4099},'attributes':['id'],'include':[{'model':db[_0x4857('0x5a')],'as':_0x4857('0x67'),'attributes':['id','name',_0x4857('0x68'),_0x4857('0x69'),_0x4857('0x6a')],'raw':!![]}]})[_0x4857('0x25')](function(_0x5557f0){if(_0x5557f0){var _0xb4cf92=_[_0x4857('0x6b')](_0x5557f0,function(_0x519fe7){var _0x13e5ce=_0x519fe7[_0x4857('0x26')]({'plain':!![]});return _0x13e5ce[_0x4857('0x67')];});return db[_0x4857('0x30')][_0x4857('0x49')]({'where':{'id':_0x4f5caa[_0x4857('0x48')]['id']}})[_0x4857('0x25')](function(_0x3e6196){return db[_0x4857('0x6c')]['transaction'](function(_0xdd59d8){return _0x3e6196[_0x4857('0x6d')](_0x1d4099,{'transaction':_0xdd59d8})['then'](function(){return BPromise[_0x4857('0x6e')](_0xb4cf92,function(_0x37192e){return db['UserWhatsappQueue'][_0x4857('0x6f')]({'where':{'UserId':_0x37192e['id'],'WhatsappQueueId':_0x4f5caa[_0x4857('0x48')]['id']},'transaction':_0xdd59d8});});})[_0x4857('0x25')](function(){_0xb4cf92[_0x4857('0x70')](function(_0x562de2){socket[_0x4857('0x71')]('userWhatsappQueue:save',{'UserId':_0x562de2['id'],'WhatsappQueueId':_0x3e6196['id']});});});});});}})[_0x4857('0x25')](respondWithStatusCode(_0x3d38e5,null))[_0x4857('0x4a')](handleError(_0x3d38e5,null));};exports[_0x4857('0x72')]=function(_0x30078d,_0x424b18,_0x10837b){return db['Team'][_0x4857('0x46')]({'where':{'id':_0x30078d['query'][_0x4857('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4857('0x25')](handleEntityNotFound(_0x424b18,null))[_0x4857('0x25')](function(_0x58de0e){var _0x428bd3=_[_0x4857('0x36')](_0x58de0e,'id');var _0x4c9258=[];var _0x1f82ba=[];var _0x567b5e=squel['select']();_0x567b5e['field'](_0x4857('0x74'))[_0x4857('0x75')](_0x4857('0x76'),'tq')['join']('user_has_teams','ut',_0x4857('0x77'))[_0x4857('0x3e')](_0x4857('0x78'),_0x30078d['params']['id']);for(var _0x521735=0x0;_0x521735<_0x58de0e['length'];_0x521735+=0x1){let _0x3fac9c=_0x58de0e[_0x521735];for(var _0x15e306=0x0;_0x15e306<_0x3fac9c[_0x4857('0x67')][_0x4857('0x66')];_0x15e306+=0x1){let _0x5e4134=_0x3fac9c[_0x4857('0x67')][_0x15e306];var _0x4d0637=_0x567b5e[_0x4857('0x79')]();_0x4d0637[_0x4857('0x3e')]('ut.UserId\x20=\x20?',_0x5e4134['id']);_0x1f82ba[_0x4857('0x7a')](db[_0x4857('0x6c')][_0x4857('0x38')](_0x4d0637[_0x4857('0x7b')](),{'type':db['sequelize'][_0x4857('0x7c')][_0x4857('0x7d')]})['then'](function(_0x441e5f){if(_0x441e5f[_0x4857('0x66')]===0x1){return _0x5e4134['id'];}else{var _0x3687e4=_[_0x4857('0x7e')](_[_0x4857('0x36')](_0x441e5f,'TeamId'),function(_0x4344a0){return _[_0x4857('0x7f')](_0x428bd3,_0x4344a0);});if(_0x3687e4){return _0x5e4134['id'];}}}));}}return BPromise['all'](_0x1f82ba)['then'](function(_0x20542a){_0x4c9258=_(_0x4c9258)['union'](_0x20542a)[_0x4857('0x80')]()[_0x4857('0x81')]();return db[_0x4857('0x30')]['find']({'where':{'id':_0x30078d[_0x4857('0x48')]['id']}})['then'](function(_0x33a852){return db[_0x4857('0x6c')][_0x4857('0x82')](function(_0x954e90){return _0x33a852[_0x4857('0x72')](_0x30078d[_0x4857('0x38')][_0x4857('0x73')],{'transaction':_0x954e90})['then'](function(){if(!_['isEmpty'](_0x4c9258)){return _0x33a852[_0x4857('0x83')](_0x4c9258,{'transaction':_0x954e90});}})['then'](function(){_0x4c9258['forEach'](function(_0x9df481){socket[_0x4857('0x71')](_0x4857('0x84'),{'UserId':_0x9df481,'WhatsappQueueId':_0x33a852['id']});});});});});});})[_0x4857('0x25')](respondWithStatusCode(_0x424b18,null))[_0x4857('0x4a')](handleError(_0x424b18,null));};exports[_0x4857('0x85')]=function(_0x16db02,_0x3c1136,_0xbb5944){return db[_0x4857('0x30')][_0x4857('0x49')]({'where':{'id':_0x16db02[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x3c1136,null))[_0x4857('0x25')](function(_0x3a4785){if(_0x3a4785){return _0x3a4785['addAgents'](_0x16db02[_0x4857('0x52')]['ids'],_[_0x4857('0x86')](_0x16db02[_0x4857('0x52')],['ids','id'])||{})[_0x4857('0x87')](function(_0x1802b8){for(var _0x1f7692=0x0;_0x1f7692<_0x16db02[_0x4857('0x52')][_0x4857('0x73')][_0x4857('0x66')];_0x1f7692+=0x1){socket['emit'](_0x4857('0x88'),{'UserId':Number(_0x16db02[_0x4857('0x52')][_0x4857('0x73')][_0x1f7692]),'WhatsappQueueId':Number(_0x16db02['params']['id'])});}return _0x1802b8;});}})['then'](respondWithResult(_0x3c1136,null))[_0x4857('0x4a')](handleError(_0x3c1136,null));};exports[_0x4857('0x83')]=function(_0x519f6d,_0x412713,_0x115a95){return db['WhatsappQueue']['find']({'where':{'id':_0x519f6d[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x412713,null))[_0x4857('0x25')](function(_0x3969e8){if(_0x3969e8){return _0x3969e8[_0x4857('0x83')](_0x519f6d['query'][_0x4857('0x73')])['then'](function(){if(_['isArray'](_0x519f6d[_0x4857('0x38')][_0x4857('0x73')])){for(var _0x259d03=0x0;_0x259d03<_0x519f6d[_0x4857('0x38')][_0x4857('0x73')][_0x4857('0x66')];_0x259d03+=0x1){socket[_0x4857('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x519f6d[_0x4857('0x38')][_0x4857('0x73')][_0x259d03]),'WhatsappQueueId':Number(_0x519f6d[_0x4857('0x48')]['id'])});}}else{socket[_0x4857('0x71')](_0x4857('0x84'),{'UserId':Number(_0x519f6d[_0x4857('0x38')][_0x4857('0x73')]),'WhatsappQueueId':Number(_0x519f6d[_0x4857('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x412713,null))[_0x4857('0x4a')](handleError(_0x412713,null));};exports['getAgents']=function(_0x153a34,_0x3f7efa,_0x1364be){var _0x2b2a9e={};var _0x28bc4b={};var _0x26a3e3;var _0x238049;return db['WhatsappQueue']['findOne']({'where':{'id':_0x153a34[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x3f7efa,null))['then'](function(_0x15a7c2){if(_0x15a7c2){_0x26a3e3=_0x15a7c2;_0x28bc4b[_0x4857('0x35')]=_[_0x4857('0x37')](db[_0x4857('0x5a')][_0x4857('0x31')]);_0x28bc4b[_0x4857('0x38')]=_['keys'](_0x153a34['query']);_0x28bc4b[_0x4857('0x3f')]=_[_0x4857('0x39')](_0x28bc4b['model'],_0x28bc4b[_0x4857('0x38')]);_0x2b2a9e[_0x4857('0x3b')]=_[_0x4857('0x39')](_0x28bc4b[_0x4857('0x35')],qs[_0x4857('0x3a')](_0x153a34['query'][_0x4857('0x3a')]));_0x2b2a9e[_0x4857('0x3b')]=_0x2b2a9e[_0x4857('0x3b')][_0x4857('0x66')]?_0x2b2a9e[_0x4857('0x3b')]:_0x28bc4b[_0x4857('0x35')];_0x2b2a9e[_0x4857('0x58')]=qs[_0x4857('0x3d')](_0x153a34['query'][_0x4857('0x3d')]);_0x2b2a9e[_0x4857('0x3e')]=qs['filters'](_['pick'](_0x153a34[_0x4857('0x38')],_0x28bc4b['filters']));if(_0x153a34[_0x4857('0x38')][_0x4857('0x40')]){_0x2b2a9e[_0x4857('0x3e')]=_['merge'](_0x2b2a9e[_0x4857('0x3e')],{'$or':_[_0x4857('0x36')](_0x2b2a9e[_0x4857('0x3b')],function(_0x23c2bb){var _0x33a80f={};_0x33a80f[_0x23c2bb]={'$like':'%'+_0x153a34[_0x4857('0x38')]['filter']+'%'};return _0x33a80f;})});}_0x2b2a9e=_['merge']({},_0x2b2a9e,_0x153a34['options']);return _0x26a3e3[_0x4857('0x89')](_0x2b2a9e);}})[_0x4857('0x25')](function(_0x1fce9f){if(_0x1fce9f){_0x238049=_0x1fce9f['length'];if(!_0x153a34[_0x4857('0x38')]['hasOwnProperty'](_0x4857('0x3c'))){_0x2b2a9e['limit']=qs[_0x4857('0x1d')](_0x153a34['query'][_0x4857('0x1d')]);_0x2b2a9e[_0x4857('0x1b')]=qs[_0x4857('0x1b')](_0x153a34[_0x4857('0x38')][_0x4857('0x1b')]);}return _0x26a3e3['getAgents'](_0x2b2a9e);}})[_0x4857('0x25')](function(_0x3d77f9){if(_0x3d77f9){return _0x3d77f9?{'count':_0x238049,'rows':_0x3d77f9}:null;}})[_0x4857('0x25')](respondWithResult(_0x3f7efa,null))[_0x4857('0x4a')](handleError(_0x3f7efa,null));}; \ No newline at end of file +var _0x6df0=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','WhatsappQueues','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','catch','keys','create','body','user','get','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','hasOwnProperty','WhatsappQueueId','filter','UserWhatsappQueue','User','UserId','whatsappPause','updatedAt','rows','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Agents','online','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','Team','field','tq.TeamId','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','includes','all','union','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x20aa0a,_0x418dc5){var _0x734517=function(_0x4444b9){while(--_0x4444b9){_0x20aa0a['push'](_0x20aa0a['shift']());}};_0x734517(++_0x418dc5);}(_0x6df0,0xfe));var _0x06df=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x6df0[_0x48b810];return _0x23c17d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06df('0x0'));var zipdir=require(_0x06df('0x1'));var jsonpatch=require(_0x06df('0x2'));var rp=require(_0x06df('0x3'));var moment=require(_0x06df('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x06df('0x5'));var util=require(_0x06df('0x6'));var path=require(_0x06df('0x7'));var sox=require(_0x06df('0x8'));var csv=require(_0x06df('0x9'));var ejs=require(_0x06df('0xa'));var fs=require('fs');var fs_extra=require(_0x06df('0xb'));var _=require(_0x06df('0xc'));var squel=require(_0x06df('0xd'));var crypto=require('crypto');var jsforce=require(_0x06df('0xe'));var deskjs=require(_0x06df('0xf'));var toCsv=require('to-csv');var querystring=require(_0x06df('0x10'));var Papa=require('papaparse');var Redis=require(_0x06df('0x11'));var authService=require(_0x06df('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06df('0x13'));var logger=require('../../config/logger')(_0x06df('0x14'));var utils=require(_0x06df('0x15'));var config=require(_0x06df('0x16'));var licenseUtil=require(_0x06df('0x17'));var db=require('../../mysqldb')['db'];config[_0x06df('0x18')]=_[_0x06df('0x19')](config[_0x06df('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x06df('0x1a'))(new Redis(config[_0x06df('0x18')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x57d50d,_0x50d6ab){_0x50d6ab=_0x50d6ab||0xcc;return function(_0x19ccc4){if(_0x19ccc4){return _0x57d50d[_0x06df('0x1b')](_0x50d6ab);}return _0x57d50d['status'](_0x50d6ab)[_0x06df('0x1c')]();};}function respondWithResult(_0x5dd6d6,_0x376bc8){_0x376bc8=_0x376bc8||0xc8;return function(_0x151e3d){if(_0x151e3d){return _0x5dd6d6[_0x06df('0x1d')](_0x376bc8)[_0x06df('0x1e')](_0x151e3d);}};}function respondWithFilteredResult(_0x9ef7a6,_0xc16eee){return function(_0x5e5c03){if(_0x5e5c03){var _0x4bf455=typeof _0xc16eee[_0x06df('0x1f')]==='undefined'&&typeof _0xc16eee['limit']===_0x06df('0x20');var _0x409d8e=_0x5e5c03[_0x06df('0x21')];var _0x3cbc04=_0x4bf455?0x0:_0xc16eee['offset'];var _0x49483f=_0x4bf455?_0x5e5c03[_0x06df('0x21')]:_0xc16eee[_0x06df('0x1f')]+_0xc16eee[_0x06df('0x22')];var _0x2fddd2;if(_0x49483f>=_0x409d8e){_0x49483f=_0x409d8e;_0x2fddd2=0xc8;}else{_0x2fddd2=0xce;}_0x9ef7a6[_0x06df('0x1d')](_0x2fddd2);return _0x9ef7a6['set'](_0x06df('0x23'),_0x3cbc04+'-'+_0x49483f+'/'+_0x409d8e)[_0x06df('0x1e')](_0x5e5c03);}return null;};}function patchUpdates(_0x5b8b60){return function(_0x2bdac9){try{jsonpatch[_0x06df('0x24')](_0x2bdac9,_0x5b8b60,!![]);}catch(_0x3ac8c8){return BPromise[_0x06df('0x25')](_0x3ac8c8);}return _0x2bdac9['save']();};}function saveUpdates(_0xa60376,_0x45ba97){return function(_0x1088b7){if(_0x1088b7){return _0x1088b7[_0x06df('0x26')](_0xa60376)[_0x06df('0x27')](function(_0x51408d){return _0x51408d;});}return null;};}function removeEntity(_0x192244,_0xb5263c){return function(_0x55ab10){if(_0x55ab10){return _0x55ab10[_0x06df('0x28')]()[_0x06df('0x27')](function(){var _0x19d7f0=_0x55ab10['get']({'plain':!![]});var _0x1e9b50=_0x06df('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x1e9b50,'resourceId':_0x19d7f0['id']}})[_0x06df('0x27')](function(){return _0x55ab10;});})[_0x06df('0x27')](function(){_0x192244[_0x06df('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x303cc2,_0x3634b2){return function(_0x39d17c){if(!_0x39d17c){_0x303cc2[_0x06df('0x1b')](0x194);}return _0x39d17c;};}function handleError(_0x79e8b3,_0x56d92a){_0x56d92a=_0x56d92a||0x1f4;return function(_0x3b4083){logger['error'](_0x3b4083[_0x06df('0x2a')]);if(_0x3b4083[_0x06df('0x2b')]){delete _0x3b4083[_0x06df('0x2b')];}_0x79e8b3['status'](_0x56d92a)[_0x06df('0x2c')](_0x3b4083);};}exports[_0x06df('0x2d')]=function(_0x3b0687,_0x19544e){var _0x79aaaa={},_0xd2c4e5={},_0x5e069f={'count':0x0,'rows':[]};var _0x308d74=_['map'](db[_0x06df('0x2e')][_0x06df('0x2f')],function(_0x3fbe4e){return{'name':_0x3fbe4e[_0x06df('0x30')],'type':_0x3fbe4e[_0x06df('0x31')][_0x06df('0x32')]};});_0xd2c4e5[_0x06df('0x33')]=_[_0x06df('0x34')](_0x308d74,_0x06df('0x2b'));_0xd2c4e5['query']=_['keys'](_0x3b0687['query']);_0xd2c4e5[_0x06df('0x35')]=_[_0x06df('0x36')](_0xd2c4e5[_0x06df('0x33')],_0xd2c4e5[_0x06df('0x37')]);_0x79aaaa[_0x06df('0x38')]=_[_0x06df('0x36')](_0xd2c4e5[_0x06df('0x33')],qs['fields'](_0x3b0687['query'][_0x06df('0x39')]));_0x79aaaa[_0x06df('0x38')]=_0x79aaaa['attributes'][_0x06df('0x3a')]?_0x79aaaa[_0x06df('0x38')]:_0xd2c4e5['model'];if(!_0x3b0687['query']['hasOwnProperty'](_0x06df('0x3b'))){_0x79aaaa[_0x06df('0x22')]=qs[_0x06df('0x22')](_0x3b0687['query'][_0x06df('0x22')]);_0x79aaaa[_0x06df('0x1f')]=qs['offset'](_0x3b0687[_0x06df('0x37')][_0x06df('0x1f')]);}_0x79aaaa[_0x06df('0x3c')]=qs[_0x06df('0x3d')](_0x3b0687[_0x06df('0x37')]['sort']);_0x79aaaa[_0x06df('0x3e')]=qs[_0x06df('0x35')](_[_0x06df('0x3f')](_0x3b0687['query'],_0xd2c4e5[_0x06df('0x35')]),_0x308d74);if(_0x3b0687[_0x06df('0x37')]['filter']){_0x79aaaa[_0x06df('0x3e')]=_['merge'](_0x79aaaa[_0x06df('0x3e')],{'$or':_[_0x06df('0x34')](_0x308d74,function(_0x26de8b){if(_0x26de8b[_0x06df('0x31')]!==_0x06df('0x40')){var _0x56fb0b={};_0x56fb0b[_0x26de8b[_0x06df('0x2b')]]={'$like':'%'+_0x3b0687[_0x06df('0x37')]['filter']+'%'};return _0x56fb0b;}})});}_0x79aaaa=_[_0x06df('0x41')]({},_0x79aaaa,_0x3b0687[_0x06df('0x42')]);var _0x10adfd={'where':_0x79aaaa[_0x06df('0x3e')]};return db[_0x06df('0x2e')][_0x06df('0x21')](_0x10adfd)[_0x06df('0x27')](function(_0x83ab9c){_0x5e069f[_0x06df('0x21')]=_0x83ab9c;if(_0x3b0687[_0x06df('0x37')][_0x06df('0x43')]){_0x79aaaa[_0x06df('0x44')]=[{'all':!![]}];}return db[_0x06df('0x2e')][_0x06df('0x45')](_0x79aaaa);})['then'](function(_0x133a02){_0x5e069f['rows']=_0x133a02;return _0x5e069f;})['then'](respondWithFilteredResult(_0x19544e,_0x79aaaa))[_0x06df('0x46')](handleError(_0x19544e,null));};exports['show']=function(_0x20ad06,_0x27c533){var _0x13983f={'raw':!![],'where':{'id':_0x20ad06['params']['id']}},_0x45731a={};_0x45731a[_0x06df('0x33')]=_[_0x06df('0x47')](db[_0x06df('0x2e')]['rawAttributes']);_0x45731a[_0x06df('0x37')]=_[_0x06df('0x47')](_0x20ad06['query']);_0x45731a[_0x06df('0x35')]=_['intersection'](_0x45731a[_0x06df('0x33')],_0x45731a[_0x06df('0x37')]);_0x13983f[_0x06df('0x38')]=_[_0x06df('0x36')](_0x45731a['model'],qs[_0x06df('0x39')](_0x20ad06[_0x06df('0x37')][_0x06df('0x39')]));_0x13983f[_0x06df('0x38')]=_0x13983f['attributes'][_0x06df('0x3a')]?_0x13983f[_0x06df('0x38')]:_0x45731a['model'];if(_0x20ad06[_0x06df('0x37')][_0x06df('0x43')]){_0x13983f[_0x06df('0x44')]=[{'all':!![]}];}_0x13983f=_['merge']({},_0x13983f,_0x20ad06[_0x06df('0x42')]);return db[_0x06df('0x2e')]['find'](_0x13983f)[_0x06df('0x27')](handleEntityNotFound(_0x27c533,null))[_0x06df('0x27')](respondWithResult(_0x27c533,null))[_0x06df('0x46')](handleError(_0x27c533,null));};exports[_0x06df('0x48')]=function(_0x1837f5,_0x38f2b0){return db[_0x06df('0x2e')][_0x06df('0x48')](_0x1837f5[_0x06df('0x49')],{})[_0x06df('0x27')](function(_0x191250){var _0x5987e6=_0x1837f5[_0x06df('0x4a')][_0x06df('0x4b')]({'plain':!![]});if(!_0x5987e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5987e6[_0x06df('0x4c')]===_0x06df('0x4a')){var _0x149790=_0x191250[_0x06df('0x4b')]({'plain':!![]});var _0x5307e3=_0x06df('0x29');return db['UserProfileSection'][_0x06df('0x4d')]({'where':{'name':_0x5307e3,'userProfileId':_0x5987e6[_0x06df('0x4e')]},'raw':!![]})['then'](function(_0x29e4ab){if(_0x29e4ab&&_0x29e4ab[_0x06df('0x4f')]===0x0){return db['UserProfileResource'][_0x06df('0x48')]({'name':_0x149790[_0x06df('0x2b')],'resourceId':_0x149790['id'],'type':_0x29e4ab[_0x06df('0x2b')],'sectionId':_0x29e4ab['id']},{})['then'](function(){return _0x191250;});}else{return _0x191250;}})['catch'](function(_0x217aa5){logger[_0x06df('0x50')](_0x06df('0x51'),_0x217aa5);throw _0x217aa5;});}return _0x191250;})[_0x06df('0x27')](respondWithResult(_0x38f2b0,0xc9))[_0x06df('0x46')](handleError(_0x38f2b0,null));};exports[_0x06df('0x26')]=function(_0x9ff68c,_0x177d3f){if(_0x9ff68c[_0x06df('0x49')]['id']){delete _0x9ff68c[_0x06df('0x49')]['id'];}return db[_0x06df('0x2e')]['find']({'where':{'id':_0x9ff68c[_0x06df('0x52')]['id']}})[_0x06df('0x27')](handleEntityNotFound(_0x177d3f,null))['then'](saveUpdates(_0x9ff68c[_0x06df('0x49')],null))[_0x06df('0x27')](respondWithResult(_0x177d3f,null))[_0x06df('0x46')](handleError(_0x177d3f,null));};exports[_0x06df('0x28')]=function(_0x40108a,_0x3d8302){return db[_0x06df('0x2e')][_0x06df('0x4d')]({'where':{'id':_0x40108a[_0x06df('0x52')]['id']}})[_0x06df('0x27')](handleEntityNotFound(_0x3d8302,null))[_0x06df('0x27')](removeEntity(_0x3d8302,null))[_0x06df('0x46')](handleError(_0x3d8302,null));};exports[_0x06df('0x53')]=function(_0x5e7527,_0x13eb8f){return db[_0x06df('0x2e')][_0x06df('0x53')]()['then'](respondWithResult(_0x13eb8f,null))[_0x06df('0x46')](handleError(_0x13eb8f,null));};exports[_0x06df('0x54')]=function(_0x459caf,_0x4376a,_0x45ac70){var _0xf0cb0c={'raw':!![],'where':{}},_0x5ce472={},_0x22cefe;return db[_0x06df('0x2e')][_0x06df('0x55')]({'where':{'id':_0x459caf[_0x06df('0x52')]['id']}})[_0x06df('0x27')](handleEntityNotFound(_0x4376a,null))['then'](function(_0x14caff){if(_0x14caff){_0x22cefe=_0x14caff['get']({'plain':!![]});_0x5ce472[_0x06df('0x33')]=_[_0x06df('0x47')](db['UserWhatsappQueue'][_0x06df('0x2f')]);_0x5ce472[_0x06df('0x37')]=_[_0x06df('0x47')](_0x459caf[_0x06df('0x37')]);_0x5ce472[_0x06df('0x35')]=_[_0x06df('0x36')](_0x5ce472[_0x06df('0x33')],_0x5ce472[_0x06df('0x37')]);_0xf0cb0c['attributes']=_[_0x06df('0x36')](_0x5ce472['model'],qs[_0x06df('0x39')](_0x459caf[_0x06df('0x37')][_0x06df('0x39')]));_0xf0cb0c[_0x06df('0x38')]=_0xf0cb0c[_0x06df('0x38')][_0x06df('0x3a')]?_0xf0cb0c[_0x06df('0x38')]:_0x5ce472[_0x06df('0x33')];if(!_0x459caf[_0x06df('0x37')][_0x06df('0x56')]('nolimit')){_0xf0cb0c[_0x06df('0x22')]=qs[_0x06df('0x22')](_0x459caf[_0x06df('0x37')][_0x06df('0x22')]);_0xf0cb0c[_0x06df('0x1f')]=qs[_0x06df('0x1f')](_0x459caf[_0x06df('0x37')]['offset']);}_0xf0cb0c[_0x06df('0x3c')]=qs[_0x06df('0x3d')](_0x459caf[_0x06df('0x37')]['sort']);_0xf0cb0c[_0x06df('0x3e')]=qs[_0x06df('0x35')](_[_0x06df('0x3f')](_0x459caf['query'],_0x5ce472[_0x06df('0x35')]));_0xf0cb0c['where'][_0x06df('0x57')]=_0x14caff['id'];if(_0x459caf[_0x06df('0x37')][_0x06df('0x58')]){_0xf0cb0c['where']=_[_0x06df('0x41')](_0xf0cb0c[_0x06df('0x3e')],{'$or':_[_0x06df('0x34')](_0xf0cb0c[_0x06df('0x38')],function(_0x30e477){var _0x26f77c={};_0x26f77c[_0x30e477]={'$like':'%'+_0x459caf[_0x06df('0x37')][_0x06df('0x58')]+'%'};return _0x26f77c;})});}_0xf0cb0c=_[_0x06df('0x41')]({},_0xf0cb0c,_0x459caf[_0x06df('0x42')]);return db[_0x06df('0x59')][_0x06df('0x45')](_0xf0cb0c);}})[_0x06df('0x27')](function(_0x4b4a0c){if(_0x4b4a0c){return db[_0x06df('0x5a')]['findAndCountAll']({'where':{'id':_[_0x06df('0x34')](_0x4b4a0c,_0x06df('0x5b')),'role':'agent'},'attributes':['id',_0x06df('0x2b'),_0x06df('0x5c'),_0x06df('0x5d'),'createdAt']});}})[_0x06df('0x27')](function(_0x472ee7){if(_0x472ee7){return{'count':_0x472ee7['count'],'rows':_['map'](_0x472ee7[_0x06df('0x5e')],function(_0x49367c){return{'membername':_0x49367c[_0x06df('0x2b')],'UserId':_0x49367c['id'],'queue_name':_0x22cefe[_0x06df('0x2b')],'WhatsappQueueId':_0x22cefe['id'],'interface':util['format'](_0x06df('0x5f'),_0x06df('0x60'),_0x49367c[_0x06df('0x2b')]),'penalty':0x0,'paused':_0x49367c[_0x06df('0x5c')],'createdAt':_0x49367c[_0x06df('0x61')],'updatedAt':_0x49367c[_0x06df('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4376a,_0xf0cb0c))[_0x06df('0x46')](handleError(_0x4376a,null));};exports['getTeams']=function(_0x2677dc,_0x520c95,_0x45e3ef){var _0x1dbfa4={};var _0x171f10={};var _0x4a2842;var _0x2b44ba;return db['WhatsappQueue'][_0x06df('0x55')]({'where':{'id':_0x2677dc[_0x06df('0x52')]['id']}})[_0x06df('0x27')](handleEntityNotFound(_0x520c95,null))['then'](function(_0x3d8e8b){if(_0x3d8e8b){_0x4a2842=_0x3d8e8b;_0x171f10['model']=_[_0x06df('0x47')](db['Team'][_0x06df('0x2f')]);_0x171f10['query']=_['keys'](_0x2677dc[_0x06df('0x37')]);_0x171f10[_0x06df('0x35')]=_[_0x06df('0x36')](_0x171f10[_0x06df('0x33')],_0x171f10[_0x06df('0x37')]);_0x1dbfa4[_0x06df('0x38')]=_['intersection'](_0x171f10['model'],qs['fields'](_0x2677dc[_0x06df('0x37')][_0x06df('0x39')]));_0x1dbfa4['attributes']=_0x1dbfa4[_0x06df('0x38')][_0x06df('0x3a')]?_0x1dbfa4[_0x06df('0x38')]:_0x171f10[_0x06df('0x33')];_0x1dbfa4['order']=qs[_0x06df('0x3d')](_0x2677dc[_0x06df('0x37')][_0x06df('0x3d')]);_0x1dbfa4[_0x06df('0x3e')]=qs[_0x06df('0x35')](_[_0x06df('0x3f')](_0x2677dc[_0x06df('0x37')],_0x171f10['filters']));if(_0x2677dc[_0x06df('0x37')][_0x06df('0x58')]){_0x1dbfa4[_0x06df('0x3e')]=_['merge'](_0x1dbfa4[_0x06df('0x3e')],{'$or':_[_0x06df('0x34')](_0x1dbfa4[_0x06df('0x38')],function(_0xdb4719){var _0x13d60a={};_0x13d60a[_0xdb4719]={'$like':'%'+_0x2677dc['query'][_0x06df('0x58')]+'%'};return _0x13d60a;})});}_0x1dbfa4=_[_0x06df('0x41')]({},_0x1dbfa4,_0x2677dc[_0x06df('0x42')]);return _0x4a2842[_0x06df('0x62')](_0x1dbfa4);}})['then'](function(_0x18bff6){if(_0x18bff6){_0x2b44ba=_0x18bff6['length'];if(!_0x2677dc[_0x06df('0x37')][_0x06df('0x56')](_0x06df('0x3b'))){_0x1dbfa4[_0x06df('0x22')]=qs[_0x06df('0x22')](_0x2677dc[_0x06df('0x37')][_0x06df('0x22')]);_0x1dbfa4[_0x06df('0x1f')]=qs[_0x06df('0x1f')](_0x2677dc[_0x06df('0x37')]['offset']);}return _0x4a2842[_0x06df('0x62')](_0x1dbfa4);}})['then'](function(_0x1cff5d){if(_0x1cff5d){return _0x1cff5d?{'count':_0x2b44ba,'rows':_0x1cff5d}:null;}})[_0x06df('0x27')](respondWithResult(_0x520c95,null))[_0x06df('0x46')](handleError(_0x520c95,null));};exports[_0x06df('0x63')]=function(_0x468f8b,_0x2c799a,_0x143dfd){var _0x68b58a=_0x468f8b['body'][_0x06df('0x64')];return db['Team']['findAll']({'where':{'id':_0x68b58a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x06df('0x65'),'attributes':['id',_0x06df('0x2b'),_0x06df('0x66'),'voicePause','interface'],'raw':!![]}]})[_0x06df('0x27')](function(_0x149c36){if(_0x149c36){var _0x565c36=_['flatMap'](_0x149c36,function(_0x465204){var _0x12a591=_0x465204[_0x06df('0x4b')]({'plain':!![]});return _0x12a591[_0x06df('0x65')];});return db[_0x06df('0x2e')][_0x06df('0x4d')]({'where':{'id':_0x468f8b[_0x06df('0x52')]['id']}})['then'](function(_0x6bb28a){return db['sequelize'][_0x06df('0x67')](function(_0x3e6426){return _0x6bb28a[_0x06df('0x63')](_0x68b58a,{'transaction':_0x3e6426})[_0x06df('0x27')](function(){return BPromise[_0x06df('0x68')](_0x565c36,function(_0xae36bc){return db[_0x06df('0x59')][_0x06df('0x69')]({'where':{'UserId':_0xae36bc['id'],'WhatsappQueueId':_0x468f8b[_0x06df('0x52')]['id']},'transaction':_0x3e6426});});})['then'](function(){_0x565c36['forEach'](function(_0x4c30e5){socket[_0x06df('0x6a')](_0x06df('0x6b'),{'UserId':_0x4c30e5['id'],'WhatsappQueueId':_0x6bb28a['id']});});});});});}})['then'](respondWithStatusCode(_0x2c799a,null))[_0x06df('0x46')](handleError(_0x2c799a,null));};exports[_0x06df('0x6c')]=function(_0x675b45,_0x10306d,_0x196707){return db[_0x06df('0x6d')][_0x06df('0x45')]({'where':{'id':_0x675b45['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x06df('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x06df('0x27')](handleEntityNotFound(_0x10306d,null))[_0x06df('0x27')](function(_0x1a40db){var _0x20b556=_['map'](_0x1a40db,'id');var _0x3ba19c=[];var _0x4e5fcf=[];var _0x50f19d=squel['select']();_0x50f19d[_0x06df('0x6e')](_0x06df('0x6f'))['from']('team_has_whatsapp_queues','tq')[_0x06df('0x70')](_0x06df('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x06df('0x3e')](_0x06df('0x72'),_0x675b45['params']['id']);for(var _0xe36f9=0x0;_0xe36f9<_0x1a40db['length'];_0xe36f9+=0x1){let _0x947667=_0x1a40db[_0xe36f9];for(var _0x573aa4=0x0;_0x573aa4<_0x947667['Agents'][_0x06df('0x3a')];_0x573aa4+=0x1){let _0x410bc0=_0x947667['Agents'][_0x573aa4];var _0x562902=_0x50f19d[_0x06df('0x73')]();_0x562902[_0x06df('0x3e')]('ut.UserId\x20=\x20?',_0x410bc0['id']);_0x4e5fcf[_0x06df('0x74')](db[_0x06df('0x75')]['query'](_0x562902[_0x06df('0x76')](),{'type':db['sequelize'][_0x06df('0x77')][_0x06df('0x78')]})[_0x06df('0x27')](function(_0xbe3dc7){if(_0xbe3dc7[_0x06df('0x3a')]===0x1){return _0x410bc0['id'];}else{var _0x186042=_['every'](_[_0x06df('0x34')](_0xbe3dc7,'TeamId'),function(_0x57b091){return _[_0x06df('0x79')](_0x20b556,_0x57b091);});if(_0x186042){return _0x410bc0['id'];}}}));}}return BPromise[_0x06df('0x7a')](_0x4e5fcf)['then'](function(_0x12086a){_0x3ba19c=_(_0x3ba19c)[_0x06df('0x7b')](_0x12086a)['compact']()['value']();return db[_0x06df('0x2e')][_0x06df('0x4d')]({'where':{'id':_0x675b45[_0x06df('0x52')]['id']}})[_0x06df('0x27')](function(_0x2a48ec){return db[_0x06df('0x75')][_0x06df('0x67')](function(_0x12bff4){return _0x2a48ec['removeTeams'](_0x675b45['query']['ids'],{'transaction':_0x12bff4})['then'](function(){if(!_[_0x06df('0x7c')](_0x3ba19c)){return _0x2a48ec[_0x06df('0x7d')](_0x3ba19c,{'transaction':_0x12bff4});}})[_0x06df('0x27')](function(){_0x3ba19c[_0x06df('0x7e')](function(_0x3fa22f){socket['emit'](_0x06df('0x7f'),{'UserId':_0x3fa22f,'WhatsappQueueId':_0x2a48ec['id']});});});});});});})[_0x06df('0x27')](respondWithStatusCode(_0x10306d,null))['catch'](handleError(_0x10306d,null));};exports[_0x06df('0x80')]=function(_0x3af0bf,_0x59c9c2,_0x24bb9e){return db['WhatsappQueue'][_0x06df('0x4d')]({'where':{'id':_0x3af0bf[_0x06df('0x52')]['id']}})['then'](handleEntityNotFound(_0x59c9c2,null))[_0x06df('0x27')](function(_0x48c486){if(_0x48c486){return _0x48c486['addAgents'](_0x3af0bf[_0x06df('0x49')][_0x06df('0x64')],_[_0x06df('0x81')](_0x3af0bf[_0x06df('0x49')],[_0x06df('0x64'),'id'])||{})[_0x06df('0x82')](function(_0x4c2a2e){for(var _0x30ad5d=0x0;_0x30ad5d<_0x3af0bf[_0x06df('0x49')][_0x06df('0x64')][_0x06df('0x3a')];_0x30ad5d+=0x1){socket[_0x06df('0x6a')](_0x06df('0x6b'),{'UserId':Number(_0x3af0bf[_0x06df('0x49')]['ids'][_0x30ad5d]),'WhatsappQueueId':Number(_0x3af0bf[_0x06df('0x52')]['id'])});}return _0x4c2a2e;});}})['then'](respondWithResult(_0x59c9c2,null))[_0x06df('0x46')](handleError(_0x59c9c2,null));};exports[_0x06df('0x7d')]=function(_0xd08c1b,_0x1ed7de,_0x71e4f6){return db[_0x06df('0x2e')]['find']({'where':{'id':_0xd08c1b[_0x06df('0x52')]['id']}})['then'](handleEntityNotFound(_0x1ed7de,null))[_0x06df('0x27')](function(_0x3a4944){if(_0x3a4944){return _0x3a4944[_0x06df('0x7d')](_0xd08c1b[_0x06df('0x37')][_0x06df('0x64')])[_0x06df('0x27')](function(){if(_[_0x06df('0x83')](_0xd08c1b[_0x06df('0x37')][_0x06df('0x64')])){for(var _0x1398e7=0x0;_0x1398e7<_0xd08c1b['query'][_0x06df('0x64')][_0x06df('0x3a')];_0x1398e7+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0xd08c1b[_0x06df('0x37')][_0x06df('0x64')][_0x1398e7]),'WhatsappQueueId':Number(_0xd08c1b[_0x06df('0x52')]['id'])});}}else{socket[_0x06df('0x6a')](_0x06df('0x7f'),{'UserId':Number(_0xd08c1b[_0x06df('0x37')]['ids']),'WhatsappQueueId':Number(_0xd08c1b[_0x06df('0x52')]['id'])});}});}})[_0x06df('0x27')](respondWithStatusCode(_0x1ed7de,null))[_0x06df('0x46')](handleError(_0x1ed7de,null));};exports[_0x06df('0x84')]=function(_0x4d9142,_0x324136,_0x55b8c4){var _0x4bc590={};var _0xb83cfa={};var _0x37f106;var _0x172480;return db[_0x06df('0x2e')][_0x06df('0x55')]({'where':{'id':_0x4d9142[_0x06df('0x52')]['id']}})[_0x06df('0x27')](handleEntityNotFound(_0x324136,null))['then'](function(_0x1bcd1b){if(_0x1bcd1b){_0x37f106=_0x1bcd1b;_0xb83cfa[_0x06df('0x33')]=_['keys'](db[_0x06df('0x5a')]['rawAttributes']);_0xb83cfa[_0x06df('0x37')]=_[_0x06df('0x47')](_0x4d9142['query']);_0xb83cfa[_0x06df('0x35')]=_[_0x06df('0x36')](_0xb83cfa['model'],_0xb83cfa[_0x06df('0x37')]);_0x4bc590[_0x06df('0x38')]=_[_0x06df('0x36')](_0xb83cfa['model'],qs['fields'](_0x4d9142[_0x06df('0x37')]['fields']));_0x4bc590['attributes']=_0x4bc590[_0x06df('0x38')][_0x06df('0x3a')]?_0x4bc590[_0x06df('0x38')]:_0xb83cfa['model'];_0x4bc590[_0x06df('0x3c')]=qs[_0x06df('0x3d')](_0x4d9142[_0x06df('0x37')]['sort']);_0x4bc590['where']=qs[_0x06df('0x35')](_[_0x06df('0x3f')](_0x4d9142[_0x06df('0x37')],_0xb83cfa[_0x06df('0x35')]));if(_0x4d9142[_0x06df('0x37')][_0x06df('0x58')]){_0x4bc590['where']=_['merge'](_0x4bc590[_0x06df('0x3e')],{'$or':_[_0x06df('0x34')](_0x4bc590[_0x06df('0x38')],function(_0xa88ab3){var _0x26dcd3={};_0x26dcd3[_0xa88ab3]={'$like':'%'+_0x4d9142[_0x06df('0x37')][_0x06df('0x58')]+'%'};return _0x26dcd3;})});}_0x4bc590=_['merge']({},_0x4bc590,_0x4d9142[_0x06df('0x42')]);return _0x37f106[_0x06df('0x84')](_0x4bc590);}})[_0x06df('0x27')](function(_0x205123){if(_0x205123){_0x172480=_0x205123[_0x06df('0x3a')];if(!_0x4d9142['query'][_0x06df('0x56')](_0x06df('0x3b'))){_0x4bc590[_0x06df('0x22')]=qs[_0x06df('0x22')](_0x4d9142[_0x06df('0x37')][_0x06df('0x22')]);_0x4bc590[_0x06df('0x1f')]=qs[_0x06df('0x1f')](_0x4d9142[_0x06df('0x37')][_0x06df('0x1f')]);}return _0x37f106[_0x06df('0x84')](_0x4bc590);}})[_0x06df('0x27')](function(_0x259f5c){if(_0x259f5c){return _0x259f5c?{'count':_0x172480,'rows':_0x259f5c}:null;}})['then'](respondWithResult(_0x324136,null))['catch'](handleError(_0x324136,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e9b25fd..ba8c04c 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 _0x6f8b=['remove','emit','hasOwnProperty','exports','WhatsappQueue','save'];(function(_0x428220,_0x4c383c){var _0x5d9fac=function(_0x14777f){while(--_0x14777f){_0x428220['push'](_0x428220['shift']());}};_0x5d9fac(++_0x4c383c);}(_0x6f8b,0x112));var _0xb6f8=function(_0x3dc874,_0x5ee037){_0x3dc874=_0x3dc874-0x0;var _0x23bd94=_0x6f8b[_0x3dc874];return _0x23bd94;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xb6f8('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6f8('0x1'),'afterUpdate':'update','afterDestroy':_0xb6f8('0x2')};function emitEvent(_0x60441c){return function(_0x3ab037,_0xa145d0,_0x161954){WhatsappQueueEvents[_0xb6f8('0x3')](_0x60441c+':'+_0x3ab037['id'],_0x3ab037);WhatsappQueueEvents[_0xb6f8('0x3')](_0x60441c,_0x3ab037);_0x161954(null);};}for(var e in events){if(events[_0xb6f8('0x4')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xb6f8('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0x0cec=['hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x0cec,0xa2));var _0xc0ce=function(_0x28da28,_0x42a764){_0x28da28=_0x28da28-0x0;var _0x13e8b3=_0x0cec[_0x28da28];return _0x13e8b3;};'use strict';var EventEmitter=require(_0xc0ce('0x0'));var WhatsappQueue=require(_0xc0ce('0x1'))['db'][_0xc0ce('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc0ce('0x3')](0x0);var events={'afterCreate':_0xc0ce('0x4'),'afterUpdate':_0xc0ce('0x5'),'afterDestroy':_0xc0ce('0x6')};function emitEvent(_0x311e7c){return function(_0x2cc4f8,_0x4fec1e,_0x5e59ce){WhatsappQueueEvents[_0xc0ce('0x7')](_0x311e7c+':'+_0x2cc4f8['id'],_0x2cc4f8);WhatsappQueueEvents['emit'](_0x311e7c,_0x2cc4f8);_0x5e59ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xc0ce('0x8')](e,emitEvent(event));}}module[_0xc0ce('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index d6868ac..deaebba 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 _0xfeb5=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4c33fd,_0x4ec65){var _0x33cb98=function(_0x4f491c){while(--_0x4f491c){_0x4c33fd['push'](_0x4c33fd['shift']());}};_0x33cb98(++_0x4ec65);}(_0xfeb5,0x172));var _0x5feb=function(_0xe5b539,_0x467802){_0xe5b539=_0xe5b539-0x0;var _0x4bd185=_0xfeb5[_0xe5b539];return _0x4bd185;};'use strict';var _=require('lodash');var util=require(_0x5feb('0x0'));var logger=require(_0x5feb('0x1'))(_0x5feb('0x2'));var moment=require(_0x5feb('0x3'));var BPromise=require(_0x5feb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5feb('0x5'));var rimraf=require(_0x5feb('0x6'));var config=require(_0x5feb('0x7'));var attributes=require(_0x5feb('0x8'));module[_0x5feb('0x9')]=function(_0x1908f9,_0x23c4da){return _0x1908f9[_0x5feb('0xa')](_0x5feb('0xb'),attributes,{'tableName':_0x5feb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2830=['whatsapp_queues','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2830,0xb5));var _0x0283=function(_0x39deea,_0x522e8e){_0x39deea=_0x39deea-0x0;var _0x1f7dc3=_0x2830[_0x39deea];return _0x1f7dc3;};'use strict';var _=require('lodash');var util=require(_0x0283('0x0'));var logger=require(_0x0283('0x1'))('api');var moment=require(_0x0283('0x2'));var BPromise=require('bluebird');var rp=require(_0x0283('0x3'));var fs=require('fs');var path=require(_0x0283('0x4'));var rimraf=require(_0x0283('0x5'));var config=require(_0x0283('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x0283('0x7')]=function(_0x21f8cc,_0x569f3d){return _0x21f8cc['define'](_0x0283('0x8'),attributes,{'tableName':_0x0283('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index cccfb2f..ece0c8e 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 _0x0be0=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetWhatsappQueue','findAll','options','where','include','model','attributes','map','then','info','WhatsappQueue','find','ShowWhatsappQueue'];(function(_0xacb5cb,_0x1cdd12){var _0x272275=function(_0xb46a40){while(--_0xb46a40){_0xacb5cb['push'](_0xacb5cb['shift']());}};_0x272275(++_0x1cdd12);}(_0x0be0,0x17c));var _0x00be=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x0be0[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x00be('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x00be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00be('0x2'));var db=require(_0x00be('0x3'))['db'];var utils=require(_0x00be('0x4'));var logger=require(_0x00be('0x5'))('rpc');var config=require(_0x00be('0x6'));var jayson=require(_0x00be('0x7'));var client=jayson['client'][_0x00be('0x8')]({'port':0x232a});config[_0x00be('0x9')]=_[_0x00be('0xa')](config['redis'],{'host':_0x00be('0xb'),'port':0x18eb});var socket=require(_0x00be('0xc'))(new Redis(config[_0x00be('0x9')]));require(_0x00be('0xd'))[_0x00be('0xe')](socket);function respondWithRpcPromise(_0x219855,_0x17f0e4,_0x5adab3){return new BPromise(function(_0x19a658,_0x4cd378){return client['request'](_0x219855,_0x5adab3)['then'](function(_0x55e2f2){logger['info'](_0x00be('0xf'),_0x17f0e4,'request\x20sent');logger[_0x00be('0x10')](_0x00be('0x11'),_0x17f0e4,'request\x20sent',JSON[_0x00be('0x12')](_0x55e2f2));if(_0x55e2f2[_0x00be('0x13')]){if(_0x55e2f2[_0x00be('0x13')][_0x00be('0x14')]===0x1f4){logger[_0x00be('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x17f0e4,_0x55e2f2[_0x00be('0x13')][_0x00be('0x15')]);return _0x4cd378(_0x55e2f2['error'][_0x00be('0x15')]);}logger[_0x00be('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x17f0e4,_0x55e2f2[_0x00be('0x13')]['message']);return _0x19a658(_0x55e2f2['error']['message']);}else{logger['info'](_0x00be('0xf'),_0x17f0e4,_0x00be('0x16'));_0x19a658(_0x55e2f2[_0x00be('0x17')]['message']);}})[_0x00be('0x18')](function(_0x160fa1){logger[_0x00be('0x13')](_0x00be('0xf'),_0x17f0e4,_0x160fa1);_0x4cd378(_0x160fa1);});});}exports[_0x00be('0x19')]=function(_0x34d542){var _0x30abeb=this;return new Promise(function(_0x5bbe5f,_0x563faf){return db['WhatsappQueue'][_0x00be('0x1a')]({'raw':_0x34d542[_0x00be('0x1b')]?_0x34d542[_0x00be('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x34d542[_0x00be('0x1b')]?_0x34d542[_0x00be('0x1b')][_0x00be('0x1c')]||null:null,'attributes':_0x34d542[_0x00be('0x1b')]?_0x34d542[_0x00be('0x1b')]['attributes']||null:null,'limit':_0x34d542[_0x00be('0x1b')]?_0x34d542[_0x00be('0x1b')]['limit']||null:null,'include':_0x34d542['options']?_0x34d542['options'][_0x00be('0x1d')]?_['map'](_0x34d542[_0x00be('0x1b')][_0x00be('0x1d')],function(_0x22fcf4){return{'model':db[_0x22fcf4[_0x00be('0x1e')]],'as':_0x22fcf4['as'],'attributes':_0x22fcf4['attributes'],'include':_0x22fcf4[_0x00be('0x1d')]?_['map'](_0x22fcf4['include'],function(_0xf62900){return{'model':db[_0xf62900[_0x00be('0x1e')]],'as':_0xf62900['as'],'attributes':_0xf62900[_0x00be('0x1f')],'include':_0xf62900['include']?_[_0x00be('0x20')](_0xf62900[_0x00be('0x1d')],function(_0x312b7d){return{'model':db[_0x312b7d[_0x00be('0x1e')]],'as':_0x312b7d['as'],'attributes':_0x312b7d[_0x00be('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x00be('0x21')](function(_0x23e112){logger[_0x00be('0x22')](_0x00be('0x19'),_0x34d542);logger[_0x00be('0x10')](_0x00be('0x19'),_0x34d542,JSON[_0x00be('0x12')](_0x23e112));_0x5bbe5f(_0x23e112);})['catch'](function(_0xa87537){logger[_0x00be('0x13')](_0x00be('0x19'),_0xa87537['message'],_0x34d542);_0x563faf(_0x30abeb[_0x00be('0x13')](0x1f4,_0xa87537[_0x00be('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x23d408){var _0x3676fc=this;return new Promise(function(_0x4d4359,_0x54ff46){return db[_0x00be('0x23')][_0x00be('0x24')]({'raw':_0x23d408[_0x00be('0x1b')]?_0x23d408[_0x00be('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x23d408[_0x00be('0x1b')]?_0x23d408['options'][_0x00be('0x1c')]||null:null,'attributes':_0x23d408[_0x00be('0x1b')]?_0x23d408[_0x00be('0x1b')][_0x00be('0x1f')]||null:null,'include':_0x23d408[_0x00be('0x1b')]?_0x23d408['options']['include']?_[_0x00be('0x20')](_0x23d408[_0x00be('0x1b')][_0x00be('0x1d')],function(_0x3bcf59){return{'model':db[_0x3bcf59[_0x00be('0x1e')]],'as':_0x3bcf59['as'],'attributes':_0x3bcf59[_0x00be('0x1f')],'include':_0x3bcf59[_0x00be('0x1d')]?_['map'](_0x3bcf59['include'],function(_0x15cb91){return{'model':db[_0x15cb91[_0x00be('0x1e')]],'as':_0x15cb91['as'],'attributes':_0x15cb91['attributes'],'include':_0x15cb91[_0x00be('0x1d')]?_['map'](_0x15cb91[_0x00be('0x1d')],function(_0x5689fe){return{'model':db[_0x5689fe['model']],'as':_0x5689fe['as'],'attributes':_0x5689fe['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17beb6){logger[_0x00be('0x22')]('ShowWhatsappQueue',_0x23d408);logger[_0x00be('0x10')](_0x00be('0x25'),_0x23d408,JSON[_0x00be('0x12')](_0x17beb6));_0x4d4359(_0x17beb6);})[_0x00be('0x18')](function(_0x1c9e9b){logger[_0x00be('0x13')]('ShowWhatsappQueue',_0x1c9e9b[_0x00be('0x15')],_0x23d408);_0x54ff46(_0x3676fc[_0x00be('0x13')](0x1f4,_0x1c9e9b['message']));});});}; \ No newline at end of file +var _0xc1fb=['info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetWhatsappQueue','debug','find','ShowWhatsappQueue','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request'];(function(_0x13c3c8,_0x255be3){var _0x5ee04a=function(_0x78c360){while(--_0x78c360){_0x13c3c8['push'](_0x13c3c8['shift']());}};_0x5ee04a(++_0x255be3);}(_0xc1fb,0x136));var _0xbc1f=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0xc1fb[_0x4536a4];return _0x4fd1c1;};'use strict';var _=require(_0xbc1f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbc1f('0x1'));var rs=require(_0xbc1f('0x2'));var fs=require('fs');var Redis=require(_0xbc1f('0x3'));var db=require(_0xbc1f('0x4'))['db'];var utils=require(_0xbc1f('0x5'));var logger=require(_0xbc1f('0x6'))(_0xbc1f('0x7'));var config=require(_0xbc1f('0x8'));var jayson=require(_0xbc1f('0x9'));var client=jayson[_0xbc1f('0xa')]['http']({'port':0x232a});config[_0xbc1f('0xb')]=_[_0xbc1f('0xc')](config[_0xbc1f('0xb')],{'host':_0xbc1f('0xd'),'port':0x18eb});var socket=require(_0xbc1f('0xe'))(new Redis(config['redis']));require(_0xbc1f('0xf'))[_0xbc1f('0x10')](socket);function respondWithRpcPromise(_0x68bf35,_0x5d078c,_0x3ca194){return new BPromise(function(_0x2ed978,_0x56f6a3){return client[_0xbc1f('0x11')](_0x68bf35,_0x3ca194)['then'](function(_0x3992b9){logger[_0xbc1f('0x12')](_0xbc1f('0x13'),_0x5d078c,_0xbc1f('0x14'));logger['debug'](_0xbc1f('0x15'),_0x5d078c,_0xbc1f('0x14'),JSON['stringify'](_0x3992b9));if(_0x3992b9[_0xbc1f('0x16')]){if(_0x3992b9[_0xbc1f('0x16')][_0xbc1f('0x17')]===0x1f4){logger[_0xbc1f('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x5d078c,_0x3992b9[_0xbc1f('0x16')][_0xbc1f('0x18')]);return _0x56f6a3(_0x3992b9[_0xbc1f('0x16')]['message']);}logger[_0xbc1f('0x16')](_0xbc1f('0x13'),_0x5d078c,_0x3992b9['error'][_0xbc1f('0x18')]);return _0x2ed978(_0x3992b9[_0xbc1f('0x16')]['message']);}else{logger[_0xbc1f('0x12')](_0xbc1f('0x13'),_0x5d078c,_0xbc1f('0x14'));_0x2ed978(_0x3992b9['result']['message']);}})['catch'](function(_0x5ad721){logger['error'](_0xbc1f('0x13'),_0x5d078c,_0x5ad721);_0x56f6a3(_0x5ad721);});});}exports['GetWhatsappQueue']=function(_0x31dd44){var _0x41f9e5=this;return new Promise(function(_0x3643df,_0x4db0fa){return db[_0xbc1f('0x19')][_0xbc1f('0x1a')]({'raw':_0x31dd44[_0xbc1f('0x1b')]?_0x31dd44[_0xbc1f('0x1b')][_0xbc1f('0x1c')]===undefined?!![]:![]:!![],'where':_0x31dd44['options']?_0x31dd44[_0xbc1f('0x1b')][_0xbc1f('0x1d')]||null:null,'attributes':_0x31dd44[_0xbc1f('0x1b')]?_0x31dd44[_0xbc1f('0x1b')][_0xbc1f('0x1e')]||null:null,'limit':_0x31dd44[_0xbc1f('0x1b')]?_0x31dd44[_0xbc1f('0x1b')][_0xbc1f('0x1f')]||null:null,'include':_0x31dd44[_0xbc1f('0x1b')]?_0x31dd44[_0xbc1f('0x1b')][_0xbc1f('0x20')]?_[_0xbc1f('0x21')](_0x31dd44[_0xbc1f('0x1b')][_0xbc1f('0x20')],function(_0x2cdfec){return{'model':db[_0x2cdfec[_0xbc1f('0x22')]],'as':_0x2cdfec['as'],'attributes':_0x2cdfec[_0xbc1f('0x1e')],'include':_0x2cdfec[_0xbc1f('0x20')]?_[_0xbc1f('0x21')](_0x2cdfec[_0xbc1f('0x20')],function(_0x533148){return{'model':db[_0x533148['model']],'as':_0x533148['as'],'attributes':_0x533148[_0xbc1f('0x1e')],'include':_0x533148[_0xbc1f('0x20')]?_[_0xbc1f('0x21')](_0x533148[_0xbc1f('0x20')],function(_0x27ca21){return{'model':db[_0x27ca21[_0xbc1f('0x22')]],'as':_0x27ca21['as'],'attributes':_0x27ca21[_0xbc1f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbc1f('0x23')](function(_0x9b7689){logger[_0xbc1f('0x12')](_0xbc1f('0x24'),_0x31dd44);logger[_0xbc1f('0x25')](_0xbc1f('0x24'),_0x31dd44,JSON['stringify'](_0x9b7689));_0x3643df(_0x9b7689);})['catch'](function(_0x218821){logger[_0xbc1f('0x16')](_0xbc1f('0x24'),_0x218821[_0xbc1f('0x18')],_0x31dd44);_0x4db0fa(_0x41f9e5[_0xbc1f('0x16')](0x1f4,_0x218821[_0xbc1f('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x30b4d6){var _0x1aa54b=this;return new Promise(function(_0x22f55d,_0x58d7d8){return db[_0xbc1f('0x19')][_0xbc1f('0x26')]({'raw':_0x30b4d6[_0xbc1f('0x1b')]?_0x30b4d6[_0xbc1f('0x1b')][_0xbc1f('0x1c')]===undefined?!![]:![]:!![],'where':_0x30b4d6[_0xbc1f('0x1b')]?_0x30b4d6[_0xbc1f('0x1b')]['where']||null:null,'attributes':_0x30b4d6[_0xbc1f('0x1b')]?_0x30b4d6[_0xbc1f('0x1b')][_0xbc1f('0x1e')]||null:null,'include':_0x30b4d6[_0xbc1f('0x1b')]?_0x30b4d6['options']['include']?_[_0xbc1f('0x21')](_0x30b4d6[_0xbc1f('0x1b')][_0xbc1f('0x20')],function(_0x3f0178){return{'model':db[_0x3f0178['model']],'as':_0x3f0178['as'],'attributes':_0x3f0178[_0xbc1f('0x1e')],'include':_0x3f0178[_0xbc1f('0x20')]?_[_0xbc1f('0x21')](_0x3f0178[_0xbc1f('0x20')],function(_0x53e570){return{'model':db[_0x53e570[_0xbc1f('0x22')]],'as':_0x53e570['as'],'attributes':_0x53e570['attributes'],'include':_0x53e570[_0xbc1f('0x20')]?_[_0xbc1f('0x21')](_0x53e570[_0xbc1f('0x20')],function(_0x86b7e9){return{'model':db[_0x86b7e9[_0xbc1f('0x22')]],'as':_0x86b7e9['as'],'attributes':_0x86b7e9['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc1f('0x23')](function(_0x56da38){logger[_0xbc1f('0x12')](_0xbc1f('0x27'),_0x30b4d6);logger[_0xbc1f('0x25')](_0xbc1f('0x27'),_0x30b4d6,JSON[_0xbc1f('0x28')](_0x56da38));_0x22f55d(_0x56da38);})['catch'](function(_0x258d94){logger[_0xbc1f('0x16')](_0xbc1f('0x27'),_0x258d94['message'],_0x30b4d6);_0x58d7d8(_0x1aa54b[_0xbc1f('0x16')](0x1f4,_0x258d94[_0xbc1f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ebda445..ae35f8d 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 _0xb524=['register','length','save','update','emit'];(function(_0x76195,_0x58d0f9){var _0x1994e8=function(_0x1c00f9){while(--_0x1c00f9){_0x76195['push'](_0x76195['shift']());}};_0x1994e8(++_0x58d0f9);}(_0xb524,0x183));var _0x4b52=function(_0x324375,_0x452529){_0x324375=_0x324375-0x0;var _0x1f5239=_0xb524[_0x324375];return _0x1f5239;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x4b52('0x0'),'remove',_0x4b52('0x1')];function createListener(_0x47c108,_0x8bc474){return function(_0x1e7c36){_0x8bc474[_0x4b52('0x2')](_0x47c108,_0x1e7c36);};}function removeListener(_0x4aa162,_0x98941e){return function(){WhatsappQueueEvents['removeListener'](_0x4aa162,_0x98941e);};}exports[_0x4b52('0x3')]=function(_0x5935e8){for(var _0x12cc64=0x0,_0x2eadd6=events[_0x4b52('0x4')];_0x12cc64<_0x2eadd6;_0x12cc64++){var _0x277508=events[_0x12cc64];var _0x274cc2=createListener('whatsappQueue:'+_0x277508,_0x5935e8);WhatsappQueueEvents['on'](_0x277508,_0x274cc2);}}; \ No newline at end of file +var _0x9ad9=['register','length','whatsappQueue:','emit','removeListener'];(function(_0xc051b2,_0x3d6d9d){var _0x599dc2=function(_0x235ded){while(--_0x235ded){_0xc051b2['push'](_0xc051b2['shift']());}};_0x599dc2(++_0x3d6d9d);}(_0x9ad9,0x111));var _0x99ad=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0x9ad9[_0x5093e9];return _0x4c9a22;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save','remove','update'];function createListener(_0xb4e7ed,_0x1063d6){return function(_0x3677f7){_0x1063d6[_0x99ad('0x0')](_0xb4e7ed,_0x3677f7);};}function removeListener(_0x57872b,_0x1f1487){return function(){WhatsappQueueEvents[_0x99ad('0x1')](_0x57872b,_0x1f1487);};}exports[_0x99ad('0x2')]=function(_0x25f1a5){for(var _0x4d29a8=0x0,_0x3a7774=events[_0x99ad('0x3')];_0x4d29a8<_0x3a7774;_0x4d29a8++){var _0x3c9e25=events[_0x4d29a8];var _0x395c07=createListener(_0x99ad('0x4')+_0x3c9e25,_0x25f1a5);WhatsappQueueEvents['on'](_0x3c9e25,_0x395c07);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 2b1a23a..0f5a232 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 _0x5254=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x80efcb,_0x4ac9a1){var _0x959e68=function(_0x119a25){while(--_0x119a25){_0x80efcb['push'](_0x80efcb['shift']());}};_0x959e68(++_0x4ac9a1);}(_0x5254,0x1d3));var _0x4525=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x5254[_0x359377];return _0x8be18a;};'use strict';var multer=require(_0x4525('0x0'));var util=require(_0x4525('0x1'));var path=require(_0x4525('0x2'));var timeout=require(_0x4525('0x3'));var express=require(_0x4525('0x4'));var router=express['Router']();var fs_extra=require(_0x4525('0x5'));var auth=require(_0x4525('0x6'));var interaction=require(_0x4525('0x7'));var config=require('../../config/environment');var controller=require(_0x4525('0x8'));router[_0x4525('0x9')]('/',auth[_0x4525('0xa')](),controller[_0x4525('0xb')]);router[_0x4525('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4525('0xc')]);router[_0x4525('0x9')](_0x4525('0xd'),auth[_0x4525('0xa')](),controller[_0x4525('0xe')]);router[_0x4525('0xf')]('/',auth[_0x4525('0xa')](),controller[_0x4525('0x10')]);router[_0x4525('0x11')](_0x4525('0xd'),auth['isAuthenticated'](),controller[_0x4525('0x12')]);router[_0x4525('0x13')](_0x4525('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4525('0x14')]=router; \ No newline at end of file +var _0x2b72=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3df21d,_0xa44265){var _0x37ab8a=function(_0x156e3d){while(--_0x156e3d){_0x3df21d['push'](_0x3df21d['shift']());}};_0x37ab8a(++_0xa44265);}(_0x2b72,0x18a));var _0x22b7=function(_0x5d3267,_0xe106a8){_0x5d3267=_0x5d3267-0x0;var _0x57dba1=_0x2b72[_0x5d3267];return _0x57dba1;};'use strict';var multer=require(_0x22b7('0x0'));var util=require('util');var path=require(_0x22b7('0x1'));var timeout=require(_0x22b7('0x2'));var express=require(_0x22b7('0x3'));var router=express[_0x22b7('0x4')]();var fs_extra=require(_0x22b7('0x5'));var auth=require(_0x22b7('0x6'));var interaction=require(_0x22b7('0x7'));var config=require(_0x22b7('0x8'));var controller=require(_0x22b7('0x9'));router[_0x22b7('0xa')]('/',auth[_0x22b7('0xb')](),controller[_0x22b7('0xc')]);router[_0x22b7('0xa')](_0x22b7('0xd'),auth[_0x22b7('0xb')](),controller[_0x22b7('0xe')]);router[_0x22b7('0xa')](_0x22b7('0xf'),auth[_0x22b7('0xb')](),controller['show']);router['post']('/',auth[_0x22b7('0xb')](),controller[_0x22b7('0x10')]);router['put'](_0x22b7('0xf'),auth[_0x22b7('0xb')](),controller[_0x22b7('0x11')]);router[_0x22b7('0x12')](_0x22b7('0xf'),auth[_0x22b7('0xb')](),controller[_0x22b7('0x13')]);module[_0x22b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5d72f1d..d627ec4 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x497573,_0x424abd){var _0x4a5eab=function(_0x2774c2){while(--_0x2774c2){_0x497573['push'](_0x497573['shift']());}};_0x4a5eab(++_0x424abd);}(_0x7a54,0x106));var _0x47a5=function(_0x3600b9,_0x3f1d07){_0x3600b9=_0x3600b9-0x0;var _0x5a1cc8=_0x7a54[_0x3600b9];return _0x5a1cc8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x96fe7a,_0x4ba1c1){var _0x42b97f=function(_0x58750f){while(--_0x58750f){_0x96fe7a['push'](_0x96fe7a['shift']());}};_0x42b97f(++_0x4ba1c1);}(_0x7a54,0x106));var _0x47a5=function(_0x5bf89a,_0x508685){_0x5bf89a=_0x5bf89a-0x0;var _0x3bde44=_0x7a54[_0x5bf89a];return _0x3bde44;};'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 02d50f7..01b272d 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 _0x0fd9=['includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options'];(function(_0x2e6b0a,_0x4ff642){var _0x444e95=function(_0x1bf0a6){while(--_0x1bf0a6){_0x2e6b0a['push'](_0x2e6b0a['shift']());}};_0x444e95(++_0x4ff642);}(_0x0fd9,0xa3));var _0x90fd=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x0fd9[_0x351509];return _0x4e9861;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];function respondWithStatusCode(_0x4e8b99,_0x1439ed){_0x1439ed=_0x1439ed||0xcc;return function(_0x37a0f8){if(_0x37a0f8){return _0x4e8b99[_0x90fd('0x17')](_0x1439ed);}return _0x4e8b99['status'](_0x1439ed)[_0x90fd('0x18')]();};}function respondWithResult(_0x48e701,_0x1cae40){_0x1cae40=_0x1cae40||0xc8;return function(_0xb402d9){if(_0xb402d9){return _0x48e701[_0x90fd('0x19')](_0x1cae40)[_0x90fd('0x1a')](_0xb402d9);}};}function respondWithFilteredResult(_0x3c5da8,_0x442a19){return function(_0x296a64){if(_0x296a64){var _0x4eb953=typeof _0x442a19['offset']===_0x90fd('0x1b')&&typeof _0x442a19[_0x90fd('0x1c')]==='undefined';var _0x130489=_0x296a64[_0x90fd('0x1d')];var _0x1fcc87=_0x4eb953?0x0:_0x442a19['offset'];var _0x3f9c76=_0x4eb953?_0x296a64[_0x90fd('0x1d')]:_0x442a19[_0x90fd('0x1e')]+_0x442a19[_0x90fd('0x1c')];var _0x251957;if(_0x3f9c76>=_0x130489){_0x3f9c76=_0x130489;_0x251957=0xc8;}else{_0x251957=0xce;}_0x3c5da8[_0x90fd('0x19')](_0x251957);return _0x3c5da8[_0x90fd('0x1f')](_0x90fd('0x20'),_0x1fcc87+'-'+_0x3f9c76+'/'+_0x130489)[_0x90fd('0x1a')](_0x296a64);}return null;};}function patchUpdates(_0x90197e){return function(_0x19e79b){try{jsonpatch[_0x90fd('0x21')](_0x19e79b,_0x90197e,!![]);}catch(_0x1fb31a){return BPromise[_0x90fd('0x22')](_0x1fb31a);}return _0x19e79b[_0x90fd('0x23')]();};}function saveUpdates(_0x493c26,_0x35ce4e){return function(_0xc4e4e2){if(_0xc4e4e2){return _0xc4e4e2[_0x90fd('0x24')](_0x493c26)[_0x90fd('0x25')](function(_0x411a6a){return _0x411a6a;});}return null;};}function removeEntity(_0x3ad6c6,_0x30f67e){return function(_0x300262){if(_0x300262){return _0x300262['destroy']()[_0x90fd('0x25')](function(){_0x3ad6c6['status'](0xcc)[_0x90fd('0x18')]();});}};}function handleEntityNotFound(_0x18d5b3,_0x2ffea2){return function(_0x31667c){if(!_0x31667c){_0x18d5b3[_0x90fd('0x17')](0x194);}return _0x31667c;};}function handleError(_0x4c962f,_0x35c38d){_0x35c38d=_0x35c38d||0x1f4;return function(_0xe333f0){logger[_0x90fd('0x26')](_0xe333f0[_0x90fd('0x27')]);if(_0xe333f0[_0x90fd('0x28')]){delete _0xe333f0[_0x90fd('0x28')];}_0x4c962f['status'](_0x35c38d)['send'](_0xe333f0);};}exports[_0x90fd('0x29')]=function(_0x170cfb,_0x2924e9){var _0x404971={},_0x397aaf={},_0x59b3e8={'count':0x0,'rows':[]};var _0x4f69e7=_[_0x90fd('0x2a')](db[_0x90fd('0x2b')][_0x90fd('0x2c')],function(_0x3a0102){return{'name':_0x3a0102['fieldName'],'type':_0x3a0102['type'][_0x90fd('0x2d')]};});_0x397aaf[_0x90fd('0x2e')]=_[_0x90fd('0x2a')](_0x4f69e7,_0x90fd('0x28'));_0x397aaf['query']=_[_0x90fd('0x2f')](_0x170cfb[_0x90fd('0x30')]);_0x397aaf[_0x90fd('0x31')]=_[_0x90fd('0x32')](_0x397aaf[_0x90fd('0x2e')],_0x397aaf[_0x90fd('0x30')]);_0x404971[_0x90fd('0x33')]=_[_0x90fd('0x32')](_0x397aaf[_0x90fd('0x2e')],qs[_0x90fd('0x34')](_0x170cfb[_0x90fd('0x30')][_0x90fd('0x34')]));_0x404971[_0x90fd('0x33')]=_0x404971[_0x90fd('0x33')][_0x90fd('0x35')]?_0x404971[_0x90fd('0x33')]:_0x397aaf['model'];if(!_0x170cfb[_0x90fd('0x30')][_0x90fd('0x36')](_0x90fd('0x37'))){_0x404971[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x170cfb[_0x90fd('0x30')][_0x90fd('0x1c')]);_0x404971[_0x90fd('0x1e')]=qs[_0x90fd('0x1e')](_0x170cfb[_0x90fd('0x30')][_0x90fd('0x1e')]);}_0x404971[_0x90fd('0x38')]=qs[_0x90fd('0x39')](_0x170cfb['query'][_0x90fd('0x39')]);_0x404971[_0x90fd('0x3a')]=qs[_0x90fd('0x31')](_[_0x90fd('0x3b')](_0x170cfb['query'],_0x397aaf[_0x90fd('0x31')]),_0x4f69e7);if(_0x170cfb[_0x90fd('0x30')][_0x90fd('0x3c')]){_0x404971['where']=_['merge'](_0x404971[_0x90fd('0x3a')],{'$or':_[_0x90fd('0x2a')](_0x4f69e7,function(_0x377319){if(_0x377319[_0x90fd('0x3d')]!==_0x90fd('0x3e')){var _0x254200={};_0x254200[_0x377319[_0x90fd('0x28')]]={'$like':'%'+_0x170cfb[_0x90fd('0x30')][_0x90fd('0x3c')]+'%'};return _0x254200;}})});}_0x404971=_[_0x90fd('0x3f')]({},_0x404971,_0x170cfb[_0x90fd('0x40')]);var _0x43c84c={'where':_0x404971[_0x90fd('0x3a')]};return db[_0x90fd('0x2b')][_0x90fd('0x1d')](_0x43c84c)[_0x90fd('0x25')](function(_0x2717ca){_0x59b3e8[_0x90fd('0x1d')]=_0x2717ca;if(_0x170cfb['query'][_0x90fd('0x41')]){_0x404971[_0x90fd('0x42')]=[{'all':!![]}];}return db[_0x90fd('0x2b')]['findAll'](_0x404971);})['then'](function(_0x47b8c8){_0x59b3e8[_0x90fd('0x43')]=_0x47b8c8;return _0x59b3e8;})[_0x90fd('0x25')](respondWithFilteredResult(_0x2924e9,_0x404971))[_0x90fd('0x44')](handleError(_0x2924e9,null));};exports[_0x90fd('0x45')]=function(_0x1361d9,_0x311c7e){var _0x363365={'raw':!![],'where':{'id':_0x1361d9[_0x90fd('0x46')]['id']}},_0x733d4d={};_0x733d4d[_0x90fd('0x2e')]=_[_0x90fd('0x2f')](db[_0x90fd('0x2b')][_0x90fd('0x2c')]);_0x733d4d[_0x90fd('0x30')]=_[_0x90fd('0x2f')](_0x1361d9['query']);_0x733d4d['filters']=_[_0x90fd('0x32')](_0x733d4d[_0x90fd('0x2e')],_0x733d4d[_0x90fd('0x30')]);_0x363365['attributes']=_['intersection'](_0x733d4d[_0x90fd('0x2e')],qs[_0x90fd('0x34')](_0x1361d9['query']['fields']));_0x363365[_0x90fd('0x33')]=_0x363365[_0x90fd('0x33')]['length']?_0x363365['attributes']:_0x733d4d[_0x90fd('0x2e')];if(_0x1361d9[_0x90fd('0x30')][_0x90fd('0x41')]){_0x363365['include']=[{'all':!![]}];}_0x363365=_[_0x90fd('0x3f')]({},_0x363365,_0x1361d9[_0x90fd('0x40')]);return db['WhatsappQueueReport']['find'](_0x363365)['then'](handleEntityNotFound(_0x311c7e,null))[_0x90fd('0x25')](respondWithResult(_0x311c7e,null))[_0x90fd('0x44')](handleError(_0x311c7e,null));};exports['create']=function(_0x2d42b3,_0x2b73f7){return db[_0x90fd('0x2b')][_0x90fd('0x47')](_0x2d42b3[_0x90fd('0x48')],{})['then'](respondWithResult(_0x2b73f7,0xc9))['catch'](handleError(_0x2b73f7,null));};exports[_0x90fd('0x24')]=function(_0x326e4d,_0x125874){if(_0x326e4d[_0x90fd('0x48')]['id']){delete _0x326e4d[_0x90fd('0x48')]['id'];}return db[_0x90fd('0x2b')][_0x90fd('0x49')]({'where':{'id':_0x326e4d[_0x90fd('0x46')]['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x125874,null))[_0x90fd('0x25')](saveUpdates(_0x326e4d['body'],null))[_0x90fd('0x25')](respondWithResult(_0x125874,null))[_0x90fd('0x44')](handleError(_0x125874,null));};exports[_0x90fd('0x4a')]=function(_0x38021b,_0x4b47bc){return db['WhatsappQueueReport'][_0x90fd('0x49')]({'where':{'id':_0x38021b['params']['id']}})['then'](handleEntityNotFound(_0x4b47bc,null))[_0x90fd('0x25')](removeEntity(_0x4b47bc,null))[_0x90fd('0x44')](handleError(_0x4b47bc,null));};exports[_0x90fd('0x4b')]=function(_0xb8a2af,_0x13c428){return db[_0x90fd('0x2b')][_0x90fd('0x4b')]()['then'](respondWithResult(_0x13c428,null))['catch'](handleError(_0x13c428,null));}; \ No newline at end of file +var _0x1eba=['name','send','WhatsappQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error'];(function(_0x43644b,_0xeee395){var _0x46627c=function(_0x45c391){while(--_0x45c391){_0x43644b['push'](_0x43644b['shift']());}};_0x46627c(++_0xeee395);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x1eba[_0x3042c5];return _0x7cd140;};'use strict';var emlformat=require(_0xa1eb('0x0'));var rimraf=require(_0xa1eb('0x1'));var zipdir=require(_0xa1eb('0x2'));var jsonpatch=require(_0xa1eb('0x3'));var rp=require(_0xa1eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1eb('0x5'));var util=require(_0xa1eb('0x6'));var path=require(_0xa1eb('0x7'));var sox=require(_0xa1eb('0x8'));var csv=require(_0xa1eb('0x9'));var ejs=require(_0xa1eb('0xa'));var fs=require('fs');var fs_extra=require(_0xa1eb('0xb'));var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];function respondWithStatusCode(_0x39b4a3,_0x5df92d){_0x5df92d=_0x5df92d||0xcc;return function(_0x16a623){if(_0x16a623){return _0x39b4a3['sendStatus'](_0x5df92d);}return _0x39b4a3['status'](_0x5df92d)[_0xa1eb('0x19')]();};}function respondWithResult(_0x4c7983,_0x25d058){_0x25d058=_0x25d058||0xc8;return function(_0x2178e2){if(_0x2178e2){return _0x4c7983[_0xa1eb('0x1a')](_0x25d058)[_0xa1eb('0x1b')](_0x2178e2);}};}function respondWithFilteredResult(_0x3cd675,_0x44f37d){return function(_0x1c858c){if(_0x1c858c){var _0x45d6dd=typeof _0x44f37d[_0xa1eb('0x1c')]==='undefined'&&typeof _0x44f37d[_0xa1eb('0x1d')]==='undefined';var _0x1401ef=_0x1c858c[_0xa1eb('0x1e')];var _0x33c4e3=_0x45d6dd?0x0:_0x44f37d[_0xa1eb('0x1c')];var _0x49bfaa=_0x45d6dd?_0x1c858c[_0xa1eb('0x1e')]:_0x44f37d[_0xa1eb('0x1c')]+_0x44f37d[_0xa1eb('0x1d')];var _0xcf45c1;if(_0x49bfaa>=_0x1401ef){_0x49bfaa=_0x1401ef;_0xcf45c1=0xc8;}else{_0xcf45c1=0xce;}_0x3cd675[_0xa1eb('0x1a')](_0xcf45c1);return _0x3cd675[_0xa1eb('0x1f')](_0xa1eb('0x20'),_0x33c4e3+'-'+_0x49bfaa+'/'+_0x1401ef)[_0xa1eb('0x1b')](_0x1c858c);}return null;};}function patchUpdates(_0x4fc14a){return function(_0x137e2c){try{jsonpatch['apply'](_0x137e2c,_0x4fc14a,!![]);}catch(_0x2258d1){return BPromise[_0xa1eb('0x21')](_0x2258d1);}return _0x137e2c[_0xa1eb('0x22')]();};}function saveUpdates(_0x250f99,_0x5e7a34){return function(_0x539634){if(_0x539634){return _0x539634[_0xa1eb('0x23')](_0x250f99)[_0xa1eb('0x24')](function(_0x5b0903){return _0x5b0903;});}return null;};}function removeEntity(_0x437b2a,_0x250728){return function(_0x258d3a){if(_0x258d3a){return _0x258d3a[_0xa1eb('0x25')]()[_0xa1eb('0x24')](function(){_0x437b2a[_0xa1eb('0x1a')](0xcc)[_0xa1eb('0x19')]();});}};}function handleEntityNotFound(_0x364b1c,_0xd7bb88){return function(_0x352796){if(!_0x352796){_0x364b1c[_0xa1eb('0x26')](0x194);}return _0x352796;};}function handleError(_0x208844,_0x57d089){_0x57d089=_0x57d089||0x1f4;return function(_0x7c617e){logger[_0xa1eb('0x27')](_0x7c617e['stack']);if(_0x7c617e[_0xa1eb('0x28')]){delete _0x7c617e['name'];}_0x208844[_0xa1eb('0x1a')](_0x57d089)[_0xa1eb('0x29')](_0x7c617e);};}exports['index']=function(_0x45ff0d,_0x1581ee){var _0x136835={},_0x4f64bb={},_0x12cf56={'count':0x0,'rows':[]};var _0x41b3ad=_['map'](db[_0xa1eb('0x2a')][_0xa1eb('0x2b')],function(_0x401510){return{'name':_0x401510[_0xa1eb('0x2c')],'type':_0x401510[_0xa1eb('0x2d')]['key']};});_0x4f64bb[_0xa1eb('0x2e')]=_[_0xa1eb('0x2f')](_0x41b3ad,_0xa1eb('0x28'));_0x4f64bb[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x45ff0d[_0xa1eb('0x30')]);_0x4f64bb[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x4f64bb[_0xa1eb('0x2e')],_0x4f64bb[_0xa1eb('0x30')]);_0x136835[_0xa1eb('0x34')]=_['intersection'](_0x4f64bb['model'],qs[_0xa1eb('0x35')](_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x35')]));_0x136835[_0xa1eb('0x34')]=_0x136835[_0xa1eb('0x34')]['length']?_0x136835['attributes']:_0x4f64bb[_0xa1eb('0x2e')];if(!_0x45ff0d[_0xa1eb('0x30')]['hasOwnProperty']('nolimit')){_0x136835[_0xa1eb('0x1d')]=qs['limit'](_0x45ff0d[_0xa1eb('0x30')]['limit']);_0x136835[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0x45ff0d[_0xa1eb('0x30')]['offset']);}_0x136835[_0xa1eb('0x36')]=qs[_0xa1eb('0x37')](_0x45ff0d[_0xa1eb('0x30')]['sort']);_0x136835[_0xa1eb('0x38')]=qs[_0xa1eb('0x32')](_[_0xa1eb('0x39')](_0x45ff0d[_0xa1eb('0x30')],_0x4f64bb[_0xa1eb('0x32')]),_0x41b3ad);if(_0x45ff0d['query'][_0xa1eb('0x3a')]){_0x136835[_0xa1eb('0x38')]=_[_0xa1eb('0x3b')](_0x136835[_0xa1eb('0x38')],{'$or':_[_0xa1eb('0x2f')](_0x41b3ad,function(_0x2af1d1){if(_0x2af1d1[_0xa1eb('0x2d')]!==_0xa1eb('0x3c')){var _0x53f251={};_0x53f251[_0x2af1d1[_0xa1eb('0x28')]]={'$like':'%'+_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x3a')]+'%'};return _0x53f251;}})});}_0x136835=_[_0xa1eb('0x3b')]({},_0x136835,_0x45ff0d[_0xa1eb('0x3d')]);var _0x5bf994={'where':_0x136835[_0xa1eb('0x38')]};return db[_0xa1eb('0x2a')][_0xa1eb('0x1e')](_0x5bf994)['then'](function(_0x334849){_0x12cf56[_0xa1eb('0x1e')]=_0x334849;if(_0x45ff0d[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x136835[_0xa1eb('0x3f')]=[{'all':!![]}];}return db[_0xa1eb('0x2a')][_0xa1eb('0x40')](_0x136835);})['then'](function(_0x3c8713){_0x12cf56[_0xa1eb('0x41')]=_0x3c8713;return _0x12cf56;})['then'](respondWithFilteredResult(_0x1581ee,_0x136835))[_0xa1eb('0x42')](handleError(_0x1581ee,null));};exports['show']=function(_0x1744e4,_0x3a6f36){var _0x75f7f6={'raw':!![],'where':{'id':_0x1744e4[_0xa1eb('0x43')]['id']}},_0x361675={};_0x361675[_0xa1eb('0x2e')]=_[_0xa1eb('0x31')](db[_0xa1eb('0x2a')][_0xa1eb('0x2b')]);_0x361675[_0xa1eb('0x30')]=_[_0xa1eb('0x31')](_0x1744e4[_0xa1eb('0x30')]);_0x361675[_0xa1eb('0x32')]=_[_0xa1eb('0x33')](_0x361675[_0xa1eb('0x2e')],_0x361675[_0xa1eb('0x30')]);_0x75f7f6['attributes']=_[_0xa1eb('0x33')](_0x361675['model'],qs[_0xa1eb('0x35')](_0x1744e4[_0xa1eb('0x30')]['fields']));_0x75f7f6['attributes']=_0x75f7f6[_0xa1eb('0x34')][_0xa1eb('0x44')]?_0x75f7f6[_0xa1eb('0x34')]:_0x361675['model'];if(_0x1744e4[_0xa1eb('0x30')][_0xa1eb('0x3e')]){_0x75f7f6[_0xa1eb('0x3f')]=[{'all':!![]}];}_0x75f7f6=_[_0xa1eb('0x3b')]({},_0x75f7f6,_0x1744e4[_0xa1eb('0x3d')]);return db[_0xa1eb('0x2a')][_0xa1eb('0x45')](_0x75f7f6)[_0xa1eb('0x24')](handleEntityNotFound(_0x3a6f36,null))[_0xa1eb('0x24')](respondWithResult(_0x3a6f36,null))[_0xa1eb('0x42')](handleError(_0x3a6f36,null));};exports[_0xa1eb('0x46')]=function(_0x393f95,_0x39d3c6){return db[_0xa1eb('0x2a')]['create'](_0x393f95[_0xa1eb('0x47')],{})[_0xa1eb('0x24')](respondWithResult(_0x39d3c6,0xc9))[_0xa1eb('0x42')](handleError(_0x39d3c6,null));};exports[_0xa1eb('0x23')]=function(_0x2b0cbf,_0x12dfd4){if(_0x2b0cbf[_0xa1eb('0x47')]['id']){delete _0x2b0cbf['body']['id'];}return db[_0xa1eb('0x2a')][_0xa1eb('0x45')]({'where':{'id':_0x2b0cbf[_0xa1eb('0x43')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x12dfd4,null))[_0xa1eb('0x24')](saveUpdates(_0x2b0cbf[_0xa1eb('0x47')],null))[_0xa1eb('0x24')](respondWithResult(_0x12dfd4,null))[_0xa1eb('0x42')](handleError(_0x12dfd4,null));};exports[_0xa1eb('0x25')]=function(_0x4f7c05,_0x190370){return db['WhatsappQueueReport'][_0xa1eb('0x45')]({'where':{'id':_0x4f7c05['params']['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x190370,null))[_0xa1eb('0x24')](removeEntity(_0x190370,null))[_0xa1eb('0x42')](handleError(_0x190370,null));};exports['describe']=function(_0x3fbd6c,_0xbd9a42){return db['WhatsappQueueReport'][_0xa1eb('0x48')]()[_0xa1eb('0x24')](respondWithResult(_0xbd9a42,null))[_0xa1eb('0x42')](handleError(_0xbd9a42,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 8843846..c39d3ca 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 _0xc0a2=['bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x110f86,_0x160c75){var _0x40eef0=function(_0x451166){while(--_0x451166){_0x110f86['push'](_0x110f86['shift']());}};_0x40eef0(++_0x160c75);}(_0xc0a2,0x175));var _0x2c0a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0a2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2c0a('0x0'));var util=require(_0x2c0a('0x1'));var logger=require(_0x2c0a('0x2'))(_0x2c0a('0x3'));var moment=require(_0x2c0a('0x4'));var BPromise=require(_0x2c0a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c0a('0x6'));var rimraf=require(_0x2c0a('0x7'));var config=require(_0x2c0a('0x8'));var attributes=require(_0x2c0a('0x9'));module['exports']=function(_0x33fd14,_0x39d9bc){return _0x33fd14[_0x2c0a('0xa')](_0x2c0a('0xb'),attributes,{'tableName':_0x2c0a('0xc'),'paranoid':![],'indexes':[{'name':_0x2c0a('0xd'),'fields':[_0x2c0a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec58=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x521041,_0x140acd){var _0x1b8946=function(_0x54b1a7){while(--_0x54b1a7){_0x521041['push'](_0x521041['shift']());}};_0x1b8946(++_0x140acd);}(_0xec58,0x1ee));var _0x8ec5=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0xec58[_0x5180c3];return _0x55c975;};'use strict';var _=require(_0x8ec5('0x0'));var util=require(_0x8ec5('0x1'));var logger=require(_0x8ec5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8ec5('0x3'));var fs=require('fs');var path=require(_0x8ec5('0x4'));var rimraf=require(_0x8ec5('0x5'));var config=require('../../config/environment');var attributes=require(_0x8ec5('0x6'));module[_0x8ec5('0x7')]=function(_0x5419ab,_0x3da52a){return _0x5419ab[_0x8ec5('0x8')](_0x8ec5('0x9'),attributes,{'tableName':_0x8ec5('0xa'),'paranoid':![],'indexes':[{'name':_0x8ec5('0xb'),'fields':[_0x8ec5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 71396fc..0919f9e 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 _0xd426=['stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where'];(function(_0x4d4d2e,_0x2fdea8){var _0x5741c4=function(_0x49ec4c){while(--_0x49ec4c){_0x4d4d2e['push'](_0x4d4d2e['shift']());}};_0x5741c4(++_0x2fdea8);}(_0xd426,0x141));var _0x6d42=function(_0x12dc66,_0x43aab9){_0x12dc66=_0x12dc66-0x0;var _0x7bf9c6=_0xd426[_0x12dc66];return _0x7bf9c6;};'use strict';var _=require('lodash');var util=require(_0x6d42('0x0'));var moment=require(_0x6d42('0x1'));var BPromise=require(_0x6d42('0x2'));var rs=require(_0x6d42('0x3'));var fs=require('fs');var Redis=require(_0x6d42('0x4'));var db=require(_0x6d42('0x5'))['db'];var utils=require(_0x6d42('0x6'));var logger=require(_0x6d42('0x7'))(_0x6d42('0x8'));var config=require(_0x6d42('0x9'));var jayson=require(_0x6d42('0xa'));var client=jayson[_0x6d42('0xb')][_0x6d42('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23896b,_0x24e093,_0x1318d8){return new BPromise(function(_0x12d4d4,_0x28dcc4){return client['request'](_0x23896b,_0x1318d8)[_0x6d42('0xd')](function(_0x42b574){logger[_0x6d42('0xe')](_0x6d42('0xf'),_0x24e093,_0x6d42('0x10'));logger[_0x6d42('0x11')](_0x6d42('0x12'),_0x24e093,_0x6d42('0x10'),JSON['stringify'](_0x42b574));if(_0x42b574[_0x6d42('0x13')]){if(_0x42b574[_0x6d42('0x13')][_0x6d42('0x14')]===0x1f4){logger[_0x6d42('0x13')](_0x6d42('0xf'),_0x24e093,_0x42b574[_0x6d42('0x13')][_0x6d42('0x15')]);return _0x28dcc4(_0x42b574[_0x6d42('0x13')][_0x6d42('0x15')]);}logger['error'](_0x6d42('0xf'),_0x24e093,_0x42b574['error'][_0x6d42('0x15')]);return _0x12d4d4(_0x42b574['error']['message']);}else{logger[_0x6d42('0xe')](_0x6d42('0xf'),_0x24e093,_0x6d42('0x10'));_0x12d4d4(_0x42b574['result'][_0x6d42('0x15')]);}})[_0x6d42('0x16')](function(_0x5c0ea7){logger['error'](_0x6d42('0xf'),_0x24e093,_0x5c0ea7);_0x28dcc4(_0x5c0ea7);});});}exports['CreateWhatsappQueueReport']=function(_0x2fa289){var _0x29f853=this;return new Promise(function(_0x5b3b6d,_0x3bf2e5){return db['WhatsappQueueReport'][_0x6d42('0x17')](_0x2fa289[_0x6d42('0x18')],{'raw':_0x2fa289[_0x6d42('0x19')]?_0x2fa289[_0x6d42('0x19')][_0x6d42('0x1a')]===undefined?!![]:![]:!![]})[_0x6d42('0xd')](function(_0xdb03f6){logger[_0x6d42('0xe')](_0x6d42('0x1b'),_0x2fa289);logger['debug']('CreateWhatsappQueueReport',_0x2fa289,JSON['stringify'](_0xdb03f6));_0x5b3b6d(_0xdb03f6);})[_0x6d42('0x16')](function(_0x512373){logger[_0x6d42('0x13')](_0x6d42('0x1b'),_0x512373[_0x6d42('0x15')],_0x2fa289);_0x3bf2e5(_0x29f853[_0x6d42('0x13')](0x1f4,_0x512373[_0x6d42('0x15')]));});});};exports[_0x6d42('0x1c')]=function(_0x30837e){var _0x5dc5a2=this;return new Promise(function(_0x17dc44,_0xfd3e02){return db['WhatsappQueueReport'][_0x6d42('0x1d')](_0x30837e[_0x6d42('0x18')],{'raw':_0x30837e[_0x6d42('0x19')]?_0x30837e[_0x6d42('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30837e[_0x6d42('0x19')]?_0x30837e['options'][_0x6d42('0x1e')]||null:null,'attributes':_0x30837e['options']?_0x30837e['options']['attributes']||null:null,'limit':_0x30837e['options']?_0x30837e[_0x6d42('0x19')]['limit']||null:null})[_0x6d42('0xd')](function(_0x4733b6){logger[_0x6d42('0xe')]('UpdateWhatsappQueueReport',_0x30837e);logger['debug'](_0x6d42('0x1c'),_0x30837e,JSON[_0x6d42('0x1f')](_0x4733b6));_0x17dc44(_0x4733b6);})[_0x6d42('0x16')](function(_0x2c3748){logger[_0x6d42('0x13')](_0x6d42('0x1c'),_0x2c3748[_0x6d42('0x15')],_0x30837e);_0xfd3e02(_0x5dc5a2[_0x6d42('0x13')](0x1f4,_0x2c3748[_0x6d42('0x15')]));});});}; \ No newline at end of file +var _0x435d=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','update','body','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1b1578,_0x49ddd8){var _0x457912=function(_0x4dd211){while(--_0x4dd211){_0x1b1578['push'](_0x1b1578['shift']());}};_0x457912(++_0x49ddd8);}(_0x435d,0x12a));var _0xd435=function(_0x30e70c,_0x1c7f9a){_0x30e70c=_0x30e70c-0x0;var _0x53bf49=_0x435d[_0x30e70c];return _0x53bf49;};'use strict';var _=require(_0xd435('0x0'));var util=require(_0xd435('0x1'));var moment=require(_0xd435('0x2'));var BPromise=require(_0xd435('0x3'));var rs=require(_0xd435('0x4'));var fs=require('fs');var Redis=require(_0xd435('0x5'));var db=require(_0xd435('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd435('0x7'))(_0xd435('0x8'));var config=require('../../config/environment');var jayson=require(_0xd435('0x9'));var client=jayson[_0xd435('0xa')][_0xd435('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x431fad,_0x486d9b,_0x43ce42){return new BPromise(function(_0x231550,_0x5853c6){return client[_0xd435('0xc')](_0x431fad,_0x43ce42)[_0xd435('0xd')](function(_0x216c6b){logger[_0xd435('0xe')](_0xd435('0xf'),_0x486d9b,_0xd435('0x10'));logger[_0xd435('0x11')](_0xd435('0x12'),_0x486d9b,'request\x20sent',JSON[_0xd435('0x13')](_0x216c6b));if(_0x216c6b['error']){if(_0x216c6b[_0xd435('0x14')][_0xd435('0x15')]===0x1f4){logger[_0xd435('0x14')](_0xd435('0xf'),_0x486d9b,_0x216c6b[_0xd435('0x14')][_0xd435('0x16')]);return _0x5853c6(_0x216c6b[_0xd435('0x14')][_0xd435('0x16')]);}logger[_0xd435('0x14')](_0xd435('0xf'),_0x486d9b,_0x216c6b['error'][_0xd435('0x16')]);return _0x231550(_0x216c6b[_0xd435('0x14')][_0xd435('0x16')]);}else{logger['info'](_0xd435('0xf'),_0x486d9b,'request\x20sent');_0x231550(_0x216c6b[_0xd435('0x17')][_0xd435('0x16')]);}})[_0xd435('0x18')](function(_0x46b075){logger[_0xd435('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x486d9b,_0x46b075);_0x5853c6(_0x46b075);});});}exports[_0xd435('0x19')]=function(_0x3271a2){var _0x4bf3a5=this;return new Promise(function(_0x12bf57,_0x1ff9f7){return db[_0xd435('0x1a')][_0xd435('0x1b')](_0x3271a2['body'],{'raw':_0x3271a2['options']?_0x3271a2[_0xd435('0x1c')][_0xd435('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x533265){logger[_0xd435('0xe')](_0xd435('0x19'),_0x3271a2);logger[_0xd435('0x11')]('CreateWhatsappQueueReport',_0x3271a2,JSON[_0xd435('0x13')](_0x533265));_0x12bf57(_0x533265);})[_0xd435('0x18')](function(_0x1f6b56){logger[_0xd435('0x14')](_0xd435('0x19'),_0x1f6b56[_0xd435('0x16')],_0x3271a2);_0x1ff9f7(_0x4bf3a5[_0xd435('0x14')](0x1f4,_0x1f6b56[_0xd435('0x16')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x52be2d){var _0x49f9d5=this;return new Promise(function(_0x5cb155,_0x252275){return db[_0xd435('0x1a')][_0xd435('0x1e')](_0x52be2d[_0xd435('0x1f')],{'raw':_0x52be2d['options']?_0x52be2d[_0xd435('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52be2d[_0xd435('0x1c')]?_0x52be2d['options']['where']||null:null,'attributes':_0x52be2d['options']?_0x52be2d[_0xd435('0x1c')][_0xd435('0x20')]||null:null,'limit':_0x52be2d[_0xd435('0x1c')]?_0x52be2d[_0xd435('0x1c')][_0xd435('0x21')]||null:null})[_0xd435('0xd')](function(_0x2cb8c1){logger[_0xd435('0xe')]('UpdateWhatsappQueueReport',_0x52be2d);logger[_0xd435('0x11')](_0xd435('0x22'),_0x52be2d,JSON[_0xd435('0x13')](_0x2cb8c1));_0x5cb155(_0x2cb8c1);})[_0xd435('0x18')](function(_0x3834c6){logger['error'](_0xd435('0x22'),_0x3834c6['message'],_0x52be2d);_0x252275(_0x49f9d5[_0xd435('0x14')](0x1f4,_0x3834c6[_0xd435('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f96a6bd..3b73548 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 _0x5d89=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','update','delete','destroy'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x5d89,0x190));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x95d8('0x0'));var util=require(_0x95d8('0x1'));var path=require(_0x95d8('0x2'));var timeout=require(_0x95d8('0x3'));var express=require(_0x95d8('0x4'));var router=express[_0x95d8('0x5')]();var fs_extra=require(_0x95d8('0x6'));var auth=require(_0x95d8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x95d8('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x95d8('0x9')]('/',auth[_0x95d8('0xa')](),controller[_0x95d8('0xb')]);router['get'](_0x95d8('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x95d8('0xd')]);router[_0x95d8('0xe')]('/',auth[_0x95d8('0xa')](),controller[_0x95d8('0xf')]);router[_0x95d8('0x10')]('/:id',auth[_0x95d8('0xa')](),controller[_0x95d8('0x11')]);router[_0x95d8('0x12')]('/:id',auth[_0x95d8('0xa')](),controller[_0x95d8('0x13')]);module[_0x95d8('0x14')]=router; \ No newline at end of file +var _0x025a=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x025a,0xd1));var _0xa025=function(_0x1005d4,_0x5199ab){_0x1005d4=_0x1005d4-0x0;var _0x421977=_0x025a[_0x1005d4];return _0x421977;};'use strict';var multer=require(_0xa025('0x0'));var util=require(_0xa025('0x1'));var path=require(_0xa025('0x2'));var timeout=require(_0xa025('0x3'));var express=require(_0xa025('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa025('0x5'));router[_0xa025('0x6')]('/',auth['isAuthenticated'](),controller[_0xa025('0x7')]);router[_0xa025('0x6')](_0xa025('0x8'),auth[_0xa025('0x9')](),controller['describe']);router[_0xa025('0x6')](_0xa025('0xa'),auth[_0xa025('0x9')](),controller[_0xa025('0xb')]);router['post']('/',auth[_0xa025('0x9')](),controller[_0xa025('0xc')]);router[_0xa025('0xd')](_0xa025('0xa'),auth[_0xa025('0x9')](),controller[_0xa025('0xe')]);router['delete'](_0xa025('0xa'),auth[_0xa025('0x9')](),controller[_0xa025('0xf')]);module[_0xa025('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index be23a8e..43739e1 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 _0x76d2=['agent','queue','DATE','sequelize','exports','STRING','account'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0x76d2,0xf8));var _0x276d=function(_0x43bc1c,_0xb21fc1){_0x43bc1c=_0x43bc1c-0x0;var _0x4bfe93=_0x76d2[_0x43bc1c];return _0x4bfe93;};'use strict';var Sequelize=require(_0x276d('0x0'));module[_0x276d('0x1')]={'uniqueid':{'type':Sequelize[_0x276d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x276d('0x3'),_0x276d('0x4'),_0x276d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x276d('0x6')]}}; \ No newline at end of file +var _0x32b6=['sequelize','exports','ENUM','account','DATE'];(function(_0x54f80c,_0x17764f){var _0x3db2b4=function(_0x41d54e){while(--_0x41d54e){_0x54f80c['push'](_0x54f80c['shift']());}};_0x3db2b4(++_0x17764f);}(_0x32b6,0x1d1));var _0x632b=function(_0x1b7767,_0x1a13dd){_0x1b7767=_0x1b7767-0x0;var _0x13bcd6=_0x32b6[_0x1b7767];return _0x13bcd6;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x632b('0x2')](_0x632b('0x3'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x632b('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 20ee109..f89cf00 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 _0x33d0=['params','rawAttributes','create','body','update','find','describe','eml-format','zip-dir','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappTransferReport','rows','catch','show'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x33d0,0x99));var _0x033d=function(_0x49c8fb,_0x3621b9){_0x49c8fb=_0x49c8fb-0x0;var _0x283aca=_0x33d0[_0x49c8fb];return _0x283aca;};'use strict';var emlformat=require(_0x033d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x033d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x033d('0x2'));var BPromise=require(_0x033d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x033d('0x4'));var sox=require(_0x033d('0x5'));var csv=require(_0x033d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x033d('0x7'));var squel=require(_0x033d('0x8'));var crypto=require(_0x033d('0x9'));var jsforce=require(_0x033d('0xa'));var deskjs=require(_0x033d('0xb'));var toCsv=require(_0x033d('0x6'));var querystring=require(_0x033d('0xc'));var Papa=require(_0x033d('0xd'));var Redis=require(_0x033d('0xe'));var authService=require(_0x033d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x033d('0x10'))(_0x033d('0x11'));var utils=require(_0x033d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x033d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x529ef7,_0x4eb9e8){_0x4eb9e8=_0x4eb9e8||0xcc;return function(_0x7cb71e){if(_0x7cb71e){return _0x529ef7[_0x033d('0x14')](_0x4eb9e8);}return _0x529ef7[_0x033d('0x15')](_0x4eb9e8)[_0x033d('0x16')]();};}function respondWithResult(_0x47fdbc,_0x3c9f46){_0x3c9f46=_0x3c9f46||0xc8;return function(_0x3c06ba){if(_0x3c06ba){return _0x47fdbc[_0x033d('0x15')](_0x3c9f46)[_0x033d('0x17')](_0x3c06ba);}};}function respondWithFilteredResult(_0x15fc3d,_0x61b2bf){return function(_0x37c0d0){if(_0x37c0d0){var _0x488152=typeof _0x61b2bf['offset']===_0x033d('0x18')&&typeof _0x61b2bf[_0x033d('0x19')]===_0x033d('0x18');var _0x4f6ea8=_0x37c0d0[_0x033d('0x1a')];var _0x2a639e=_0x488152?0x0:_0x61b2bf[_0x033d('0x1b')];var _0xec6478=_0x488152?_0x37c0d0[_0x033d('0x1a')]:_0x61b2bf[_0x033d('0x1b')]+_0x61b2bf[_0x033d('0x19')];var _0x319ed7;if(_0xec6478>=_0x4f6ea8){_0xec6478=_0x4f6ea8;_0x319ed7=0xc8;}else{_0x319ed7=0xce;}_0x15fc3d[_0x033d('0x15')](_0x319ed7);return _0x15fc3d[_0x033d('0x1c')](_0x033d('0x1d'),_0x2a639e+'-'+_0xec6478+'/'+_0x4f6ea8)[_0x033d('0x17')](_0x37c0d0);}return null;};}function patchUpdates(_0x2aa6f7){return function(_0x11c2d4){try{jsonpatch[_0x033d('0x1e')](_0x11c2d4,_0x2aa6f7,!![]);}catch(_0x49d029){return BPromise[_0x033d('0x1f')](_0x49d029);}return _0x11c2d4[_0x033d('0x20')]();};}function saveUpdates(_0x307efb,_0x3bef){return function(_0x50f3ba){if(_0x50f3ba){return _0x50f3ba['update'](_0x307efb)[_0x033d('0x21')](function(_0x4a49ea){return _0x4a49ea;});}return null;};}function removeEntity(_0x144325,_0x5eddcb){return function(_0x50dd24){if(_0x50dd24){return _0x50dd24[_0x033d('0x22')]()[_0x033d('0x21')](function(){_0x144325['status'](0xcc)[_0x033d('0x16')]();});}};}function handleEntityNotFound(_0x160709,_0x248dfb){return function(_0x5df126){if(!_0x5df126){_0x160709['sendStatus'](0x194);}return _0x5df126;};}function handleError(_0x5687bc,_0x23e0c3){_0x23e0c3=_0x23e0c3||0x1f4;return function(_0x1d4a28){logger[_0x033d('0x23')](_0x1d4a28['stack']);if(_0x1d4a28[_0x033d('0x24')]){delete _0x1d4a28[_0x033d('0x24')];}_0x5687bc[_0x033d('0x15')](_0x23e0c3)[_0x033d('0x25')](_0x1d4a28);};}exports[_0x033d('0x26')]=function(_0x2fb0cd,_0x558448){var _0x516e13={},_0xe61d79={},_0x193bd1={'count':0x0,'rows':[]};var _0x7d58e6=_[_0x033d('0x27')](db['WhatsappTransferReport']['rawAttributes'],function(_0x23d21a){return{'name':_0x23d21a[_0x033d('0x28')],'type':_0x23d21a[_0x033d('0x29')][_0x033d('0x2a')]};});_0xe61d79[_0x033d('0x2b')]=_['map'](_0x7d58e6,'name');_0xe61d79[_0x033d('0x2c')]=_[_0x033d('0x2d')](_0x2fb0cd[_0x033d('0x2c')]);_0xe61d79['filters']=_['intersection'](_0xe61d79[_0x033d('0x2b')],_0xe61d79[_0x033d('0x2c')]);_0x516e13[_0x033d('0x2e')]=_[_0x033d('0x2f')](_0xe61d79['model'],qs[_0x033d('0x30')](_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x30')]));_0x516e13[_0x033d('0x2e')]=_0x516e13['attributes'][_0x033d('0x31')]?_0x516e13[_0x033d('0x2e')]:_0xe61d79[_0x033d('0x2b')];if(!_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x32')](_0x033d('0x33'))){_0x516e13['limit']=qs['limit'](_0x2fb0cd[_0x033d('0x2c')]['limit']);_0x516e13[_0x033d('0x1b')]=qs[_0x033d('0x1b')](_0x2fb0cd[_0x033d('0x2c')]['offset']);}_0x516e13['order']=qs[_0x033d('0x34')](_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x34')]);_0x516e13[_0x033d('0x35')]=qs[_0x033d('0x36')](_[_0x033d('0x37')](_0x2fb0cd[_0x033d('0x2c')],_0xe61d79[_0x033d('0x36')]),_0x7d58e6);if(_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x38')]){_0x516e13[_0x033d('0x35')]=_[_0x033d('0x39')](_0x516e13[_0x033d('0x35')],{'$or':_[_0x033d('0x27')](_0x7d58e6,function(_0x1c3791){if(_0x1c3791['type']!==_0x033d('0x3a')){var _0x22be68={};_0x22be68[_0x1c3791[_0x033d('0x24')]]={'$like':'%'+_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x38')]+'%'};return _0x22be68;}})});}_0x516e13=_['merge']({},_0x516e13,_0x2fb0cd[_0x033d('0x3b')]);var _0x4bc6e3={'where':_0x516e13[_0x033d('0x35')]};return db['WhatsappTransferReport'][_0x033d('0x1a')](_0x4bc6e3)[_0x033d('0x21')](function(_0x4438a9){_0x193bd1[_0x033d('0x1a')]=_0x4438a9;if(_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x3c')]){_0x516e13[_0x033d('0x3d')]=[{'all':!![]}];}return db[_0x033d('0x3e')]['findAll'](_0x516e13);})[_0x033d('0x21')](function(_0x5940d6){_0x193bd1[_0x033d('0x3f')]=_0x5940d6;return _0x193bd1;})[_0x033d('0x21')](respondWithFilteredResult(_0x558448,_0x516e13))[_0x033d('0x40')](handleError(_0x558448,null));};exports[_0x033d('0x41')]=function(_0x3b6733,_0x16b631){var _0x1d3e74={'raw':!![],'where':{'id':_0x3b6733[_0x033d('0x42')]['id']}},_0x4cc682={};_0x4cc682[_0x033d('0x2b')]=_[_0x033d('0x2d')](db[_0x033d('0x3e')][_0x033d('0x43')]);_0x4cc682['query']=_[_0x033d('0x2d')](_0x3b6733[_0x033d('0x2c')]);_0x4cc682['filters']=_['intersection'](_0x4cc682[_0x033d('0x2b')],_0x4cc682[_0x033d('0x2c')]);_0x1d3e74[_0x033d('0x2e')]=_[_0x033d('0x2f')](_0x4cc682[_0x033d('0x2b')],qs[_0x033d('0x30')](_0x3b6733['query'][_0x033d('0x30')]));_0x1d3e74[_0x033d('0x2e')]=_0x1d3e74[_0x033d('0x2e')][_0x033d('0x31')]?_0x1d3e74[_0x033d('0x2e')]:_0x4cc682[_0x033d('0x2b')];if(_0x3b6733[_0x033d('0x2c')]['includeAll']){_0x1d3e74[_0x033d('0x3d')]=[{'all':!![]}];}_0x1d3e74=_[_0x033d('0x39')]({},_0x1d3e74,_0x3b6733[_0x033d('0x3b')]);return db[_0x033d('0x3e')]['find'](_0x1d3e74)['then'](handleEntityNotFound(_0x16b631,null))[_0x033d('0x21')](respondWithResult(_0x16b631,null))[_0x033d('0x40')](handleError(_0x16b631,null));};exports[_0x033d('0x44')]=function(_0x554369,_0x38a16b){return db['WhatsappTransferReport'][_0x033d('0x44')](_0x554369[_0x033d('0x45')],{})[_0x033d('0x21')](respondWithResult(_0x38a16b,0xc9))['catch'](handleError(_0x38a16b,null));};exports[_0x033d('0x46')]=function(_0x34e1a8,_0x517703){if(_0x34e1a8['body']['id']){delete _0x34e1a8[_0x033d('0x45')]['id'];}return db[_0x033d('0x3e')][_0x033d('0x47')]({'where':{'id':_0x34e1a8[_0x033d('0x42')]['id']}})[_0x033d('0x21')](handleEntityNotFound(_0x517703,null))[_0x033d('0x21')](saveUpdates(_0x34e1a8['body'],null))[_0x033d('0x21')](respondWithResult(_0x517703,null))['catch'](handleError(_0x517703,null));};exports[_0x033d('0x22')]=function(_0x2640a3,_0x4d1bf7){return db[_0x033d('0x3e')]['find']({'where':{'id':_0x2640a3['params']['id']}})[_0x033d('0x21')](handleEntityNotFound(_0x4d1bf7,null))['then'](removeEntity(_0x4d1bf7,null))[_0x033d('0x40')](handleError(_0x4d1bf7,null));};exports[_0x033d('0x48')]=function(_0x1cb2f0,_0x5222d7){return db[_0x033d('0x3e')][_0x033d('0x48')]()[_0x033d('0x21')](respondWithResult(_0x5222d7,null))[_0x033d('0x40')](handleError(_0x5222d7,null));}; \ No newline at end of file +var _0x0433=['fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes'];(function(_0x276341,_0x4ff417){var _0x5f2f4c=function(_0x2eb105){while(--_0x2eb105){_0x276341['push'](_0x276341['shift']());}};_0x5f2f4c(++_0x4ff417);}(_0x0433,0x14f));var _0x3043=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x0433[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3043('0x0'));var zipdir=require(_0x3043('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3043('0x2'));var Mustache=require(_0x3043('0x3'));var util=require(_0x3043('0x4'));var path=require(_0x3043('0x5'));var sox=require(_0x3043('0x6'));var csv=require(_0x3043('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3043('0x8'));var _=require(_0x3043('0x9'));var squel=require(_0x3043('0xa'));var crypto=require(_0x3043('0xb'));var jsforce=require(_0x3043('0xc'));var deskjs=require(_0x3043('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3043('0xe'));var Redis=require(_0x3043('0xf'));var authService=require(_0x3043('0x10'));var qs=require(_0x3043('0x11'));var as=require(_0x3043('0x12'));var hardwareService=require(_0x3043('0x13'));var logger=require(_0x3043('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3043('0x15'));var licenseUtil=require(_0x3043('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4085ed,_0x1982ce){_0x1982ce=_0x1982ce||0xcc;return function(_0x564b6a){if(_0x564b6a){return _0x4085ed['sendStatus'](_0x1982ce);}return _0x4085ed[_0x3043('0x17')](_0x1982ce)[_0x3043('0x18')]();};}function respondWithResult(_0x13bead,_0x499c5c){_0x499c5c=_0x499c5c||0xc8;return function(_0x57f923){if(_0x57f923){return _0x13bead[_0x3043('0x17')](_0x499c5c)['json'](_0x57f923);}};}function respondWithFilteredResult(_0x1a3483,_0x1926dd){return function(_0x49243e){if(_0x49243e){var _0x36fc91=typeof _0x1926dd[_0x3043('0x19')]===_0x3043('0x1a')&&typeof _0x1926dd[_0x3043('0x1b')]===_0x3043('0x1a');var _0xe50adb=_0x49243e[_0x3043('0x1c')];var _0x117c52=_0x36fc91?0x0:_0x1926dd[_0x3043('0x19')];var _0x1dd651=_0x36fc91?_0x49243e[_0x3043('0x1c')]:_0x1926dd[_0x3043('0x19')]+_0x1926dd[_0x3043('0x1b')];var _0x4d9cfd;if(_0x1dd651>=_0xe50adb){_0x1dd651=_0xe50adb;_0x4d9cfd=0xc8;}else{_0x4d9cfd=0xce;}_0x1a3483[_0x3043('0x17')](_0x4d9cfd);return _0x1a3483[_0x3043('0x1d')](_0x3043('0x1e'),_0x117c52+'-'+_0x1dd651+'/'+_0xe50adb)['json'](_0x49243e);}return null;};}function patchUpdates(_0x34041c){return function(_0x28cf4b){try{jsonpatch[_0x3043('0x1f')](_0x28cf4b,_0x34041c,!![]);}catch(_0x414705){return BPromise['reject'](_0x414705);}return _0x28cf4b[_0x3043('0x20')]();};}function saveUpdates(_0x208ad6,_0x5cfcc0){return function(_0x5e92c5){if(_0x5e92c5){return _0x5e92c5[_0x3043('0x21')](_0x208ad6)[_0x3043('0x22')](function(_0x2f9940){return _0x2f9940;});}return null;};}function removeEntity(_0x5ecccc,_0x14fc63){return function(_0x429f64){if(_0x429f64){return _0x429f64[_0x3043('0x23')]()['then'](function(){_0x5ecccc[_0x3043('0x17')](0xcc)[_0x3043('0x18')]();});}};}function handleEntityNotFound(_0x4b46f4,_0x37f704){return function(_0x37f3a9){if(!_0x37f3a9){_0x4b46f4[_0x3043('0x24')](0x194);}return _0x37f3a9;};}function handleError(_0xbdac20,_0x368fe3){_0x368fe3=_0x368fe3||0x1f4;return function(_0x94e4f4){logger[_0x3043('0x25')](_0x94e4f4[_0x3043('0x26')]);if(_0x94e4f4['name']){delete _0x94e4f4[_0x3043('0x27')];}_0xbdac20[_0x3043('0x17')](_0x368fe3)[_0x3043('0x28')](_0x94e4f4);};}exports[_0x3043('0x29')]=function(_0x1c27c7,_0x53d877){var _0x292072={},_0x1016eb={},_0x1f3a61={'count':0x0,'rows':[]};var _0x2a7c2d=_[_0x3043('0x2a')](db[_0x3043('0x2b')][_0x3043('0x2c')],function(_0x4a4d81){return{'name':_0x4a4d81[_0x3043('0x2d')],'type':_0x4a4d81['type'][_0x3043('0x2e')]};});_0x1016eb[_0x3043('0x2f')]=_[_0x3043('0x2a')](_0x2a7c2d,_0x3043('0x27'));_0x1016eb['query']=_[_0x3043('0x30')](_0x1c27c7[_0x3043('0x31')]);_0x1016eb[_0x3043('0x32')]=_[_0x3043('0x33')](_0x1016eb[_0x3043('0x2f')],_0x1016eb['query']);_0x292072[_0x3043('0x34')]=_[_0x3043('0x33')](_0x1016eb['model'],qs[_0x3043('0x35')](_0x1c27c7['query'][_0x3043('0x35')]));_0x292072[_0x3043('0x34')]=_0x292072[_0x3043('0x34')][_0x3043('0x36')]?_0x292072[_0x3043('0x34')]:_0x1016eb[_0x3043('0x2f')];if(!_0x1c27c7[_0x3043('0x31')][_0x3043('0x37')](_0x3043('0x38'))){_0x292072[_0x3043('0x1b')]=qs['limit'](_0x1c27c7[_0x3043('0x31')]['limit']);_0x292072[_0x3043('0x19')]=qs[_0x3043('0x19')](_0x1c27c7[_0x3043('0x31')][_0x3043('0x19')]);}_0x292072[_0x3043('0x39')]=qs[_0x3043('0x3a')](_0x1c27c7[_0x3043('0x31')][_0x3043('0x3a')]);_0x292072[_0x3043('0x3b')]=qs['filters'](_[_0x3043('0x3c')](_0x1c27c7['query'],_0x1016eb[_0x3043('0x32')]),_0x2a7c2d);if(_0x1c27c7[_0x3043('0x31')][_0x3043('0x3d')]){_0x292072[_0x3043('0x3b')]=_[_0x3043('0x3e')](_0x292072[_0x3043('0x3b')],{'$or':_[_0x3043('0x2a')](_0x2a7c2d,function(_0x596659){if(_0x596659['type']!==_0x3043('0x3f')){var _0x495665={};_0x495665[_0x596659[_0x3043('0x27')]]={'$like':'%'+_0x1c27c7[_0x3043('0x31')][_0x3043('0x3d')]+'%'};return _0x495665;}})});}_0x292072=_['merge']({},_0x292072,_0x1c27c7[_0x3043('0x40')]);var _0x32993c={'where':_0x292072[_0x3043('0x3b')]};return db[_0x3043('0x2b')][_0x3043('0x1c')](_0x32993c)['then'](function(_0x783de1){_0x1f3a61[_0x3043('0x1c')]=_0x783de1;if(_0x1c27c7[_0x3043('0x31')]['includeAll']){_0x292072[_0x3043('0x41')]=[{'all':!![]}];}return db[_0x3043('0x2b')][_0x3043('0x42')](_0x292072);})[_0x3043('0x22')](function(_0x8f122f){_0x1f3a61[_0x3043('0x43')]=_0x8f122f;return _0x1f3a61;})[_0x3043('0x22')](respondWithFilteredResult(_0x53d877,_0x292072))[_0x3043('0x44')](handleError(_0x53d877,null));};exports[_0x3043('0x45')]=function(_0x31f4aa,_0x176b53){var _0x15b188={'raw':!![],'where':{'id':_0x31f4aa[_0x3043('0x46')]['id']}},_0xca825e={};_0xca825e[_0x3043('0x2f')]=_[_0x3043('0x30')](db[_0x3043('0x2b')][_0x3043('0x2c')]);_0xca825e['query']=_['keys'](_0x31f4aa[_0x3043('0x31')]);_0xca825e['filters']=_[_0x3043('0x33')](_0xca825e[_0x3043('0x2f')],_0xca825e[_0x3043('0x31')]);_0x15b188[_0x3043('0x34')]=_['intersection'](_0xca825e[_0x3043('0x2f')],qs[_0x3043('0x35')](_0x31f4aa['query']['fields']));_0x15b188[_0x3043('0x34')]=_0x15b188['attributes'][_0x3043('0x36')]?_0x15b188[_0x3043('0x34')]:_0xca825e[_0x3043('0x2f')];if(_0x31f4aa[_0x3043('0x31')][_0x3043('0x47')]){_0x15b188[_0x3043('0x41')]=[{'all':!![]}];}_0x15b188=_[_0x3043('0x3e')]({},_0x15b188,_0x31f4aa[_0x3043('0x40')]);return db[_0x3043('0x2b')][_0x3043('0x48')](_0x15b188)[_0x3043('0x22')](handleEntityNotFound(_0x176b53,null))[_0x3043('0x22')](respondWithResult(_0x176b53,null))['catch'](handleError(_0x176b53,null));};exports[_0x3043('0x49')]=function(_0x6fb14d,_0x35a315){return db[_0x3043('0x2b')][_0x3043('0x49')](_0x6fb14d[_0x3043('0x4a')],{})[_0x3043('0x22')](respondWithResult(_0x35a315,0xc9))[_0x3043('0x44')](handleError(_0x35a315,null));};exports[_0x3043('0x21')]=function(_0x329f79,_0x2729c1){if(_0x329f79[_0x3043('0x4a')]['id']){delete _0x329f79['body']['id'];}return db[_0x3043('0x2b')][_0x3043('0x48')]({'where':{'id':_0x329f79['params']['id']}})[_0x3043('0x22')](handleEntityNotFound(_0x2729c1,null))['then'](saveUpdates(_0x329f79[_0x3043('0x4a')],null))[_0x3043('0x22')](respondWithResult(_0x2729c1,null))['catch'](handleError(_0x2729c1,null));};exports[_0x3043('0x23')]=function(_0x5e794a,_0x3175bf){return db[_0x3043('0x2b')][_0x3043('0x48')]({'where':{'id':_0x5e794a[_0x3043('0x46')]['id']}})[_0x3043('0x22')](handleEntityNotFound(_0x3175bf,null))['then'](removeEntity(_0x3175bf,null))[_0x3043('0x44')](handleError(_0x3175bf,null));};exports['describe']=function(_0x5b8af1,_0xfff845){return db['WhatsappTransferReport'][_0x3043('0x4b')]()[_0x3043('0x22')](respondWithResult(_0xfff845,null))[_0x3043('0x44')](handleError(_0xfff845,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 17c0cc2..a0690b1 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 _0xe330=['request-promise','path','rimraf','./whatsappTransferReport.attributes','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x556763,_0x57e1df){var _0x201dc8=function(_0x43b443){while(--_0x43b443){_0x556763['push'](_0x556763['shift']());}};_0x201dc8(++_0x57e1df);}(_0xe330,0xb0));var _0x0e33=function(_0x1bc6c1,_0x31dd45){_0x1bc6c1=_0x1bc6c1-0x0;var _0x3fd1c2=_0xe330[_0x1bc6c1];return _0x3fd1c2;};'use strict';var _=require(_0x0e33('0x0'));var util=require(_0x0e33('0x1'));var logger=require(_0x0e33('0x2'))(_0x0e33('0x3'));var moment=require(_0x0e33('0x4'));var BPromise=require(_0x0e33('0x5'));var rp=require(_0x0e33('0x6'));var fs=require('fs');var path=require(_0x0e33('0x7'));var rimraf=require(_0x0e33('0x8'));var config=require('../../config/environment');var attributes=require(_0x0e33('0x9'));module['exports']=function(_0x5be414,_0x7611b2){return _0x5be414[_0x0e33('0xa')](_0x0e33('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x0e33('0xc'),'fields':[_0x0e33('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb569=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','./whatsappTransferReport.attributes'];(function(_0x4db34c,_0x16aed1){var _0xc6ea2a=function(_0x110ec6){while(--_0x110ec6){_0x4db34c['push'](_0x4db34c['shift']());}};_0xc6ea2a(++_0x16aed1);}(_0xb569,0x149));var _0x9b56=function(_0x5a7d3b,_0x197dc9){_0x5a7d3b=_0x5a7d3b-0x0;var _0x287b19=_0xb569[_0x5a7d3b];return _0x287b19;};'use strict';var _=require(_0x9b56('0x0'));var util=require(_0x9b56('0x1'));var logger=require(_0x9b56('0x2'))(_0x9b56('0x3'));var moment=require(_0x9b56('0x4'));var BPromise=require(_0x9b56('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(_0x9b56('0x6'));module[_0x9b56('0x7')]=function(_0x662a2d,_0x4bb057){return _0x662a2d[_0x9b56('0x8')](_0x9b56('0x9'),attributes,{'tableName':_0x9b56('0xa'),'paranoid':![],'indexes':[{'name':_0x9b56('0xb'),'fields':[_0x9b56('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d2c6255..dccec0c 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 _0x2f1a=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','bluebird'];(function(_0x4aa78a,_0x15c09c){var _0x444b3b=function(_0x7c30bb){while(--_0x7c30bb){_0x4aa78a['push'](_0x4aa78a['shift']());}};_0x444b3b(++_0x15c09c);}(_0x2f1a,0x129));var _0xa2f1=function(_0x149684,_0x13ea4a){_0x149684=_0x149684-0x0;var _0x2161b5=_0x2f1a[_0x149684];return _0x2161b5;};'use strict';var _=require(_0xa2f1('0x0'));var util=require(_0xa2f1('0x1'));var moment=require('moment');var BPromise=require(_0xa2f1('0x2'));var rs=require(_0xa2f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa2f1('0x4'))['db'];var utils=require(_0xa2f1('0x5'));var logger=require(_0xa2f1('0x6'))('rpc');var config=require(_0xa2f1('0x7'));var jayson=require(_0xa2f1('0x8'));var client=jayson[_0xa2f1('0x9')][_0xa2f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d36a,_0x16bdfc,_0x3cd1a2){return new BPromise(function(_0x2e93f4,_0x2cab89){return client['request'](_0x48d36a,_0x3cd1a2)[_0xa2f1('0xb')](function(_0x5b2e0a){logger[_0xa2f1('0xc')](_0xa2f1('0xd'),_0x16bdfc,_0xa2f1('0xe'));logger[_0xa2f1('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x16bdfc,_0xa2f1('0xe'),JSON['stringify'](_0x5b2e0a));if(_0x5b2e0a['error']){if(_0x5b2e0a[_0xa2f1('0x10')][_0xa2f1('0x11')]===0x1f4){logger[_0xa2f1('0x10')](_0xa2f1('0xd'),_0x16bdfc,_0x5b2e0a['error'][_0xa2f1('0x12')]);return _0x2cab89(_0x5b2e0a[_0xa2f1('0x10')][_0xa2f1('0x12')]);}logger[_0xa2f1('0x10')](_0xa2f1('0xd'),_0x16bdfc,_0x5b2e0a[_0xa2f1('0x10')]['message']);return _0x2e93f4(_0x5b2e0a[_0xa2f1('0x10')][_0xa2f1('0x12')]);}else{logger[_0xa2f1('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x16bdfc,_0xa2f1('0xe'));_0x2e93f4(_0x5b2e0a[_0xa2f1('0x13')][_0xa2f1('0x12')]);}})['catch'](function(_0x52cf1d){logger['error'](_0xa2f1('0xd'),_0x16bdfc,_0x52cf1d);_0x2cab89(_0x52cf1d);});});} \ No newline at end of file +var _0x4236=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x396cd9,_0x7291eb){var _0x1e667a=function(_0x4b519b){while(--_0x4b519b){_0x396cd9['push'](_0x396cd9['shift']());}};_0x1e667a(++_0x7291eb);}(_0x4236,0x1b2));var _0x6423=function(_0x18c39a,_0x1b0cfc){_0x18c39a=_0x18c39a-0x0;var _0x40f0a4=_0x4236[_0x18c39a];return _0x40f0a4;};'use strict';var _=require(_0x6423('0x0'));var util=require(_0x6423('0x1'));var moment=require(_0x6423('0x2'));var BPromise=require(_0x6423('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6423('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6423('0x5'));var logger=require(_0x6423('0x6'))('rpc');var config=require(_0x6423('0x7'));var jayson=require(_0x6423('0x8'));var client=jayson[_0x6423('0x9')][_0x6423('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d37cc,_0x4bb610,_0x489f11){return new BPromise(function(_0x1e4fa1,_0x2670a1){return client[_0x6423('0xb')](_0x5d37cc,_0x489f11)[_0x6423('0xc')](function(_0x592dfa){logger[_0x6423('0xd')](_0x6423('0xe'),_0x4bb610,'request\x20sent');logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x4bb610,_0x6423('0xf'),JSON[_0x6423('0x10')](_0x592dfa));if(_0x592dfa[_0x6423('0x11')]){if(_0x592dfa['error'][_0x6423('0x12')]===0x1f4){logger[_0x6423('0x11')](_0x6423('0xe'),_0x4bb610,_0x592dfa[_0x6423('0x11')][_0x6423('0x13')]);return _0x2670a1(_0x592dfa[_0x6423('0x11')][_0x6423('0x13')]);}logger[_0x6423('0x11')](_0x6423('0xe'),_0x4bb610,_0x592dfa['error'][_0x6423('0x13')]);return _0x1e4fa1(_0x592dfa[_0x6423('0x11')][_0x6423('0x13')]);}else{logger[_0x6423('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4bb610,'request\x20sent');_0x1e4fa1(_0x592dfa[_0x6423('0x14')][_0x6423('0x13')]);}})['catch'](function(_0x48556b){logger[_0x6423('0x11')](_0x6423('0xe'),_0x4bb610,_0x48556b);_0x2670a1(_0x48556b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a766a39..f68bfb4 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ad2=['info','start','Online\x20apps:','map','filter','join','status','None','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sync','listen','then'];(function(_0x443af1,_0x39c2d4){var _0x521c5c=function(_0x117d77){while(--_0x117d77){_0x443af1['push'](_0x443af1['shift']());}};_0x521c5c(++_0x39c2d4);}(_0x8ad2,0x91));var _0x28ad=function(_0x358b1c,_0x4f34c3){_0x358b1c=_0x358b1c-0x0;var _0x2ac97b=_0x8ad2[_0x358b1c];return _0x2ac97b;};'use strict';var _=require(_0x28ad('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x28ad('0x1'));var config=require('./config/environment');var logger=require(_0x28ad('0x2'))(_0x28ad('0x3'));var pm2=require(_0x28ad('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x28ad('0x5'));var chat=require(_0x28ad('0x6'));var whatsapp=require(_0x28ad('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0x28ad('0x8')]()['then'](function(){return rpc[_0x28ad('0x9')]();})[_0x28ad('0xa')](function(_0x5ac9c2){logger[_0x28ad('0xb')](_0x5ac9c2);return chat[_0x28ad('0xc')]();})[_0x28ad('0xa')](function(){return whatsapp[_0x28ad('0xc')]();})[_0x28ad('0xa')](function(){return schedule['start']();})[_0x28ad('0xa')](function(){return transcribe[_0x28ad('0xc')]();})[_0x28ad('0xa')](function(_0x1a8027){logger['info'](_0x1a8027);return pm2[_0x28ad('0xc')](pm2Config);})[_0x28ad('0xa')](function(_0x171f39){logger['info'](_0x28ad('0xd'),_[_0x28ad('0xe')](_[_0x28ad('0xf')](_0x171f39,{'status':'online'}),'name')[_0x28ad('0x10')]());logger['info']('Offline\x20apps:',_[_0x28ad('0xe')](_['filter'](_0x171f39,function(_0x3ac346){return _0x3ac346[_0x28ad('0x11')]!=='online';}),'name')[_0x28ad('0x10')]()||_0x28ad('0x12'));config['seedDB']&&require(_0x28ad('0x13'))[_0x28ad('0x14')]();require(_0x28ad('0x15'))[_0x28ad('0x14')]();})[_0x28ad('0x16')](function(_0x57e508){logger[_0x28ad('0x17')](_0x28ad('0x18'),_0x57e508);process[_0x28ad('0x19')](0x1);});}main(); \ No newline at end of file +var _0xa1a9=['name','join','Offline\x20apps:','filter','status','None','seedDB','default','./config/license','error','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','info','start','Online\x20apps:','online'];(function(_0x13cdaf,_0x4f5573){var _0x56833c=function(_0x4b0a66){while(--_0x4b0a66){_0x13cdaf['push'](_0x13cdaf['shift']());}};_0x56833c(++_0x4f5573);}(_0xa1a9,0x1e7));var _0x9a1a=function(_0x4972d7,_0x3a718b){_0x4972d7=_0x4972d7-0x0;var _0x33111f=_0xa1a9[_0x4972d7];return _0x33111f;};'use strict';var _=require(_0x9a1a('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x9a1a('0x1'));var config=require(_0x9a1a('0x2'));var logger=require(_0x9a1a('0x3'))(_0x9a1a('0x4'));var pm2=require(_0x9a1a('0x5'));var pm2Config=require(_0x9a1a('0x6'));var schedule=require(_0x9a1a('0x7'));var chat=require(_0x9a1a('0x8'));var whatsapp=require(_0x9a1a('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x9a1a('0xa')][_0x9a1a('0xb')]()[_0x9a1a('0xc')](function(){return rpc['listen']();})[_0x9a1a('0xc')](function(_0x31c735){logger[_0x9a1a('0xd')](_0x31c735);return chat[_0x9a1a('0xe')]();})[_0x9a1a('0xc')](function(){return whatsapp[_0x9a1a('0xe')]();})[_0x9a1a('0xc')](function(){return schedule[_0x9a1a('0xe')]();})[_0x9a1a('0xc')](function(){return transcribe[_0x9a1a('0xe')]();})['then'](function(_0x54c63f){logger['info'](_0x54c63f);return pm2['start'](pm2Config);})['then'](function(_0x1a1cd7){logger[_0x9a1a('0xd')](_0x9a1a('0xf'),_['map'](_['filter'](_0x1a1cd7,{'status':_0x9a1a('0x10')}),_0x9a1a('0x11'))[_0x9a1a('0x12')]());logger['info'](_0x9a1a('0x13'),_['map'](_[_0x9a1a('0x14')](_0x1a1cd7,function(_0x1ac216){return _0x1ac216[_0x9a1a('0x15')]!==_0x9a1a('0x10');}),_0x9a1a('0x11'))[_0x9a1a('0x12')]()||_0x9a1a('0x16'));config[_0x9a1a('0x17')]&&require('./config/seedDB')[_0x9a1a('0x18')]();require(_0x9a1a('0x19'))['default']();})['catch'](function(_0x249a53){logger[_0x9a1a('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x249a53);process[_0x9a1a('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index b5132da..3c89e5d 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 _0xc66c=['util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','faxPause','smsPause','openchannelPause','pauseType','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','startsWith','headers','authorization','Basic','User','find','authenticate','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','minutes','Invalid\x20API\x20access\x20key','catch','User\x20not\x20found.','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x28a725,_0x117901){var _0x305969=function(_0x261d8a){while(--_0x261d8a){_0x28a725['push'](_0x28a725['shift']());}};_0x305969(++_0x117901);}(_0xc66c,0x77));var _0xcc66=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc66c[_0x17d9e3];return _0x14192d;};'use strict';var db=require(_0xcc66('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xcc66('0x1'));var encryptor=require(_0xcc66('0x2'));var _=require(_0xcc66('0x3'));var jwt=require(_0xcc66('0x4'));var expressJwt=require(_0xcc66('0x5'));var compose=require(_0xcc66('0x6'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0xcc66('0x7'));var moment=require(_0xcc66('0x8'));var validateJwt=expressJwt({'secret':config[_0xcc66('0x9')][_0xcc66('0xa')]});var userAttributes=['id',_0xcc66('0xb'),_0xcc66('0xc'),_0xcc66('0xd'),_0xcc66('0xe'),_0xcc66('0xf'),_0xcc66('0x10'),_0xcc66('0x11'),_0xcc66('0x12'),'voicePause','chatPause','mailPause',_0xcc66('0x13'),_0xcc66('0x14'),_0xcc66('0x15'),_0xcc66('0x16'),'showWebBar','lastLoginAt',_0xcc66('0x17'),_0xcc66('0x18'),_0xcc66('0x19'),_0xcc66('0x1a'),_0xcc66('0x1b'),_0xcc66('0x1c'),'phoneBarAutoAnswerDelay',_0xcc66('0x1d'),_0xcc66('0x1e'),_0xcc66('0x1f'),'phoneBarEnableSettings',_0xcc66('0x20'),_0xcc66('0x21'),_0xcc66('0x22'),_0xcc66('0x23'),_0xcc66('0x24'),_0xcc66('0x25'),_0xcc66('0x26'),_0xcc66('0x27'),_0xcc66('0x28'),'wssPort',_0xcc66('0x29'),'downloadOmnichannelInteractions',_0xcc66('0x2a'),_0xcc66('0x2b'),_0xcc66('0x2c')];exports['isChatInteractionAuthorized']=function(){return this[_0xcc66('0x2d')](!![])[_0xcc66('0x2e')](function(_0x29a5a4,_0x3208c1,_0x164c0a){if(_0x29a5a4[_0xcc66('0x2f')]){_0x164c0a();}else{return db[_0xcc66('0x30')][_0xcc66('0x31')]({'where':{'id':_0x29a5a4[_0xcc66('0x32')]['id']},'attributes':['id',_0xcc66('0x33'),_0xcc66('0x34')],'raw':!![]})[_0xcc66('0x35')](function(_0x4c48e3){if(_0x4c48e3&&_0x4c48e3[_0xcc66('0x33')]){return _0x3208c1[_0xcc66('0x36')](_0x4c48e3[_0xcc66('0x34')]===_0xcc66('0x37')?0x195:0x193)[_0xcc66('0x38')]({'message':_0x4c48e3[_0xcc66('0x34')]===_0xcc66('0x37')?_0xcc66('0x39'):_0xcc66('0x3a')});}else{_0x164c0a();}})['catch'](function(_0x58f52a){_0x164c0a(_0x58f52a);});}});};exports['isAuthenticated']=function isAuthenticated(_0xc80dea){return compose()['use'](function(_0x3210f3,_0x1bd09f,_0x11043b){var _0x52c4be;if(_0x3210f3['headers']['authorization']){if(_[_0xcc66('0x3b')](_0x3210f3[_0xcc66('0x3c')][_0xcc66('0x3d')],_0xcc66('0x3e'))){var _0x45934b=basicAuth(_0x3210f3);db[_0xcc66('0x3f')][_0xcc66('0x40')]({'where':{'name':_0x45934b[_0xcc66('0xd')]}})[_0xcc66('0x35')](function(_0x41b68b){if(!_0x41b68b||!_0x41b68b[_0xcc66('0x41')](_0x45934b[_0xcc66('0x42')])){return _0x1bd09f[_0xcc66('0x36')](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x43')});}_0x3210f3['user']={'id':_0x41b68b['id']};_0x11043b();})['catch'](function(_0xe263f1){_0x11043b(_0xe263f1);});}else if(_['startsWith'](_0x3210f3[_0xcc66('0x3c')][_0xcc66('0x3d')],'Bearer')){validateJwt(_0x3210f3,_0x1bd09f,_0x11043b);}else{if(_0xc80dea){_0x11043b();}else{return _0x1bd09f['status'](0x193)['json']({'message':_0xcc66('0x44')});}}}else if(_0x3210f3[_0xcc66('0x45')][_0xcc66('0x46')]){try{var _0xbcdc8a={'audience':hardwareConf[_0xcc66('0x47')](),'issuer':hardwareConf[_0xcc66('0x47')]()};verifyJwt(_0x3210f3[_0xcc66('0x45')][_0xcc66('0x46')],_0xbcdc8a)[_0xcc66('0x35')](function(_0x878d10){return db[_0xcc66('0x3f')][_0xcc66('0x40')]({'where':{'id':_0x878d10[_0xcc66('0x48')]}})['then'](function(_0x3f6948){_0x52c4be=_0x3f6948;return db[_0xcc66('0x49')][_0xcc66('0x31')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xcc66('0x4a')],'raw':!![]});})['then'](function(_0xe0bf5){if(!_0x52c4be||!_['isEqual'](_0x52c4be[_0xcc66('0x4b')],_0x878d10['nonce'])){return _0x1bd09f[_0xcc66('0x36')](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x4c')});}if(_0x52c4be[_0xcc66('0x4d')]){return _0x1bd09f[_0xcc66('0x36')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x52c4be[_0xcc66('0x4e')]){if(_0xe0bf5[_0xcc66('0x4a')]>0x0){if(moment(_0x52c4be[_0xcc66('0x4f')])['add'](_0xe0bf5[_0xcc66('0x4a')],_0xcc66('0x50'))>moment()){return _0x1bd09f[_0xcc66('0x36')](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x51')});}}else{return _0x1bd09f['status'](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x51')});}}_0x3210f3[_0xcc66('0x2f')]={'id':_0x52c4be['id']};_0x11043b();});})[_0xcc66('0x52')](function(){return _0x1bd09f[_0xcc66('0x36')](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x51')});});}catch(_0x3730a7){_0x11043b(_0x3730a7);}}else if(_0xc80dea){_0x11043b();}else{return _0x1bd09f[_0xcc66('0x36')](0x193)[_0xcc66('0x38')]({'message':_0xcc66('0x44')});}})[_0xcc66('0x2e')](function(_0x10f41d,_0x58850c,_0x5aacd3){if(_0x10f41d[_0xcc66('0x2f')]){db[_0xcc66('0x3f')]['find']({'where':{'id':_0x10f41d[_0xcc66('0x2f')]['id']},'attributes':userAttributes})[_0xcc66('0x35')](function(_0x64b629){if(!_0x64b629){return _0x58850c['status'](0x194)['json']({'message':_0xcc66('0x53')});}_0x10f41d[_0xcc66('0x2f')]=_0x64b629;_0x5aacd3();})[_0xcc66('0x52')](function(_0x281c57){_0x5aacd3(_0x281c57);});}else if(_0xc80dea){_0x5aacd3();}else{return _0x58850c[_0xcc66('0x36')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x153aca,_0x53e85c,_0x35adab){return licenseUtil['getLicense']()[_0xcc66('0x35')](function(_0x511088){if(_0x511088['update']){_0x35adab();}else{return _0x53e85c['status'](0x193)[_0xcc66('0x38')]({'message':_0xcc66('0x54')});}})[_0xcc66('0x52')](function(_0x581c1a){_0x35adab(_0x581c1a);});});};exports[_0xcc66('0x55')]=function isWebrtcLicence(){return compose()[_0xcc66('0x2e')](function(_0x3463be,_0x28692e,_0x2755dd){return licenseUtil[_0xcc66('0x56')]()[_0xcc66('0x35')](function(_0x2a0a20){if(_0x2a0a20[_0xcc66('0x57')]){_0x2755dd();}else{return _0x28692e['status'](0x193)[_0xcc66('0x38')]({'message':_0xcc66('0x54')});}})['catch'](function(_0x4dc3bb){_0x2755dd(_0x4dc3bb);});});};exports[_0xcc66('0x58')]=function(_0x57e02b,_0x2e75b4,_0x115655){_0x57e02b[_0xcc66('0x58')]=!![];return _0x115655();};exports[_0xcc66('0x59')]=function signToken(_0x183f22){return signJwt(_0x183f22);};exports['setTokenCookie']=function(_0x549b14,_0xde054c){if(!_0x549b14['user']){return _0xde054c[_0xcc66('0x36')](0x194)[_0xcc66('0x38')]({'message':_0xcc66('0x5a')});}var _0x46f0c4={'payload':{'id':_0x549b14[_0xcc66('0x2f')]['id'],'role':_0x549b14[_0xcc66('0x2f')][_0xcc66('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x46f0c4)[_0xcc66('0x35')](function(_0x397cfd){_0xde054c[_0xcc66('0x5b')]('motion.token',_0x397cfd);_0xde054c[_0xcc66('0x5c')]('/dashboards/general');})[_0xcc66('0x52')](function(_0x354c90){return _0xde054c[_0xcc66('0x36')](0x1f4)[_0xcc66('0x5d')](_0x354c90);});};exports[_0xcc66('0x5e')]=function(_0x347d9f){if(_[_0xcc66('0x5f')](_0x347d9f[_0xcc66('0x4b')])||_[_0xcc66('0x5f')](_0x347d9f[_0xcc66('0x60')])){return null;}else{return createJwt(_0x347d9f);}};exports[_0xcc66('0x61')]=function(_0x39a459){_0x39a459['apiKeyNonce']=generateNonce();_0x39a459[_0xcc66('0x60')]=generateIssuedAt();return createJwt(_0x39a459);};exports[_0xcc66('0x62')]=function(_0xe68c6b,_0x3bccda){var _0x147448=_0xe68c6b[_0xcc66('0x45')][_0xcc66('0x46')];if(_0x147448){var _0x32cde3={'nonce':_0x3bccda[_0xcc66('0x4b')],'iat':_0x3bccda[_0xcc66('0x60')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x147448,_0x32cde3)[_0xcc66('0x35')](function(){return generateApiKey(_0x3bccda);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xcc66('0x63')]=function(_0x314b42){var _0x266887=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x266887[_0xcc66('0x64')](_0x314b42))throw new db[(_0xcc66('0x65'))][(_0xcc66('0x66'))](_0xcc66('0x67'));return;};exports['validatePasswordHistory']=function(_0x1a5a6e,_0x1090ea,_0x546a17){var _0x162918=encryptor[_0xcc66('0x68')](_0x1090ea)[_0xcc66('0x69')](',');for(var _0x2e0b9d=0x0;_0x2e0b9d<_0x546a17;_0x2e0b9d++){if(!_0x162918[_0x2e0b9d])break;if(_0x1a5a6e['toLowerCase']()===_0x162918[_0x2e0b9d][_0xcc66('0x6a')]()){var _0x5dd55f=util[_0xcc66('0x6b')](_0xcc66('0x6c'),_0x546a17);if(_0x546a17===0x1){_0x5dd55f=_0xcc66('0x6d');}throw new db[(_0xcc66('0x65'))]['ValidationError'](_0x5dd55f);}}return;};exports[_0xcc66('0x6e')]=function(_0x3cb71f,_0x406791){var _0x5c81b5=_0x406791?encryptor[_0xcc66('0x68')](_0x406791)[_0xcc66('0x69')](','):[];if(_0x5c81b5[_0xcc66('0x6f')]===0x5){_0x5c81b5[_0xcc66('0x70')](-0x1,0x1);}_0x5c81b5[_0xcc66('0x71')](_0x3cb71f);return encryptor[_0xcc66('0x72')](_0x5c81b5[_0xcc66('0x73')](','));};function signJwt(_0x4bb3df){var _0x447d5e=BPromise[_0xcc66('0x74')](jwt[_0xcc66('0x75')],{'context':jwt});var _0xa66aad=_0x4bb3df['secret']||config[_0xcc66('0x9')]['session'];return new BPromise(function(_0x56dd4d,_0x41b34e){_0x447d5e(_0x4bb3df[_0xcc66('0x76')],_0xa66aad,_0x4bb3df['options'])[_0xcc66('0x35')](function(_0x37cd11){_0x56dd4d(_0x37cd11);})[_0xcc66('0x52')](function(_0x405e2b){_0x41b34e(_0x405e2b);});});}function verifyJwt(_0x208aba,_0x25cfa2,_0x506736){var _0x22a33e=BPromise[_0xcc66('0x74')](jwt[_0xcc66('0x77')],{'context':jwt});var _0x20a8d3=_0x506736||config[_0xcc66('0x9')]['session'];return new BPromise(function(_0x31c425,_0x191334){_0x22a33e(_0x208aba,_0x20a8d3,_0x25cfa2)['then'](function(_0x3f6566){_0x31c425(_0x3f6566);})['catch'](function(_0x5f1eef){_0x191334(_0x5f1eef);});});}function generateNonce(){return crypto[_0xcc66('0x78')](0x10)[_0xcc66('0x79')](_0xcc66('0x7a'));}function generateIssuedAt(){return Math[_0xcc66('0x7b')](Date[_0xcc66('0x7c')]()/0x3e8)[_0xcc66('0x79')]();}function createJwt(_0x2f2ad9){var _0x3ae16c={'payload':{'iat':_0x2f2ad9[_0xcc66('0x60')],'nonce':_0x2f2ad9[_0xcc66('0x4b')]},'options':{'algorithm':_0xcc66('0x7d'),'subject':_0x2f2ad9['id']['toString'](),'issuer':hardwareConf[_0xcc66('0x47')](),'audience':hardwareConf[_0xcc66('0x47')]()}};return signJwt(_0x3ae16c)[_0xcc66('0x35')](function(_0x55f6e8){return{'iat':_0x2f2ad9[_0xcc66('0x60')],'nonce':_0x2f2ad9[_0xcc66('0x4b')],'token':_0x55f6e8};});} \ No newline at end of file +var _0xd821=['Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','disposition','then','closed','json','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','getUuid','apikey','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd821,0x13b));var _0x1d82=function(_0x13eeff,_0x3160dd){_0x13eeff=_0x13eeff-0x0;var _0x148051=_0xd821[_0x13eeff];return _0x148051;};'use strict';var db=require(_0x1d82('0x0'))['db'];var config=require(_0x1d82('0x1'));var hardwareConf=require(_0x1d82('0x2'));var licenseUtil=require(_0x1d82('0x3'));var encryptor=require(_0x1d82('0x4'));var _=require(_0x1d82('0x5'));var jwt=require(_0x1d82('0x6'));var expressJwt=require(_0x1d82('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0x1d82('0x8'));var crypto=require(_0x1d82('0x9'));var BPromise=require(_0x1d82('0xa'));var util=require(_0x1d82('0xb'));var moment=require(_0x1d82('0xc'));var validateJwt=expressJwt({'secret':config['secrets'][_0x1d82('0xd')]});var userAttributes=['id',_0x1d82('0xe'),_0x1d82('0xf'),_0x1d82('0x10'),_0x1d82('0x11'),'email',_0x1d82('0x12'),_0x1d82('0x13'),_0x1d82('0x14'),_0x1d82('0x15'),_0x1d82('0x16'),_0x1d82('0x17'),_0x1d82('0x18'),_0x1d82('0x19'),_0x1d82('0x1a'),_0x1d82('0x1b'),'showWebBar',_0x1d82('0x1c'),_0x1d82('0x1d'),_0x1d82('0x1e'),'allowmessenger',_0x1d82('0x1f'),_0x1d82('0x20'),_0x1d82('0x21'),_0x1d82('0x22'),_0x1d82('0x23'),_0x1d82('0x24'),'phoneBarEnableDtmfTone',_0x1d82('0x25'),_0x1d82('0x26'),_0x1d82('0x27'),_0x1d82('0x28'),'phoneBarRemoteControlPort',_0x1d82('0x29'),_0x1d82('0x2a'),'userProfileId',_0x1d82('0x2b'),_0x1d82('0x2c'),_0x1d82('0x2d'),_0x1d82('0x2e'),_0x1d82('0x2f'),_0x1d82('0x30'),_0x1d82('0x31'),'selectRecallMeCampaign'];exports[_0x1d82('0x32')]=function(){return this[_0x1d82('0x33')](!![])[_0x1d82('0x34')](function(_0x5d0b97,_0x58f6b2,_0x5e4f01){if(_0x5d0b97[_0x1d82('0x35')]){_0x5e4f01();}else{return db[_0x1d82('0x36')]['findOne']({'where':{'id':_0x5d0b97[_0x1d82('0x37')]['id']},'attributes':['id','closed',_0x1d82('0x38')],'raw':!![]})[_0x1d82('0x39')](function(_0x41435a){if(_0x41435a&&_0x41435a[_0x1d82('0x3a')]){return _0x58f6b2['status'](_0x41435a['disposition']==='unmanaged'?0x195:0x193)[_0x1d82('0x3b')]({'message':_0x41435a[_0x1d82('0x38')]===_0x1d82('0x3c')?_0x1d82('0x3d'):_0x1d82('0x3e')});}else{_0x5e4f01();}})[_0x1d82('0x3f')](function(_0x3e982e){_0x5e4f01(_0x3e982e);});}});};exports[_0x1d82('0x33')]=function isAuthenticated(_0x57248c){return compose()[_0x1d82('0x34')](function(_0x58e56f,_0x1db4ec,_0x13f556){var _0x72b76a;if(_0x58e56f[_0x1d82('0x40')][_0x1d82('0x41')]){if(_[_0x1d82('0x42')](_0x58e56f[_0x1d82('0x40')][_0x1d82('0x41')],_0x1d82('0x43'))){var _0x29b989=basicAuth(_0x58e56f);db[_0x1d82('0x44')][_0x1d82('0x45')]({'where':{'name':_0x29b989[_0x1d82('0x10')]}})[_0x1d82('0x39')](function(_0x54cf75){if(!_0x54cf75||!_0x54cf75[_0x1d82('0x46')](_0x29b989['pass'])){return _0x1db4ec[_0x1d82('0x47')](0x191)[_0x1d82('0x3b')]({'message':_0x1d82('0x48')});}_0x58e56f['user']={'id':_0x54cf75['id']};_0x13f556();})['catch'](function(_0x4db95d){_0x13f556(_0x4db95d);});}else if(_['startsWith'](_0x58e56f[_0x1d82('0x40')]['authorization'],_0x1d82('0x49'))){validateJwt(_0x58e56f,_0x1db4ec,_0x13f556);}else{if(_0x57248c){_0x13f556();}else{return _0x1db4ec[_0x1d82('0x47')](0x193)['json']({'message':_0x1d82('0x4a')});}}}else if(_0x58e56f[_0x1d82('0x4b')]['apikey']){try{var _0x3bdb20={'audience':hardwareConf[_0x1d82('0x4c')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x58e56f['query'][_0x1d82('0x4d')],_0x3bdb20)[_0x1d82('0x39')](function(_0x5a532){return db[_0x1d82('0x44')][_0x1d82('0x45')]({'where':{'id':_0x5a532['sub']}})[_0x1d82('0x39')](function(_0x371211){_0x72b76a=_0x371211;return db[_0x1d82('0x4e')][_0x1d82('0x4f')]({'where':{'id':0x1},'attributes':[_0x1d82('0x50'),_0x1d82('0x51')],'raw':!![]});})['then'](function(_0x2c5750){if(!_0x72b76a||!_[_0x1d82('0x52')](_0x72b76a['apiKeyNonce'],_0x5a532['nonce'])){return _0x1db4ec[_0x1d82('0x47')](0x191)['json']({'message':_0x1d82('0x53')});}if(_0x72b76a[_0x1d82('0x54')]){return _0x1db4ec['status'](0x191)[_0x1d82('0x3b')]({'message':_0x1d82('0x55')});}if(_0x72b76a['blocked']){if(_0x2c5750[_0x1d82('0x51')]>0x0){if(moment(_0x72b76a[_0x1d82('0x56')])[_0x1d82('0x57')](_0x2c5750[_0x1d82('0x51')],_0x1d82('0x58'))>moment()){return _0x1db4ec[_0x1d82('0x47')](0x191)[_0x1d82('0x3b')]({'message':_0x1d82('0x55')});}}else{return _0x1db4ec[_0x1d82('0x47')](0x191)[_0x1d82('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x58e56f[_0x1d82('0x35')]={'id':_0x72b76a['id']};_0x13f556();});})[_0x1d82('0x3f')](function(){return _0x1db4ec[_0x1d82('0x47')](0x191)[_0x1d82('0x3b')]({'message':_0x1d82('0x55')});});}catch(_0x33b81b){_0x13f556(_0x33b81b);}}else if(_0x57248c){_0x13f556();}else{return _0x1db4ec['status'](0x193)[_0x1d82('0x3b')]({'message':_0x1d82('0x4a')});}})[_0x1d82('0x34')](function(_0x3ae7e7,_0x3bbdeb,_0xb89e5a){if(_0x3ae7e7['user']){db[_0x1d82('0x44')]['find']({'where':{'id':_0x3ae7e7[_0x1d82('0x35')]['id']},'attributes':userAttributes})['then'](function(_0x319597){if(!_0x319597){return _0x3bbdeb[_0x1d82('0x47')](0x194)[_0x1d82('0x3b')]({'message':_0x1d82('0x59')});}_0x3ae7e7[_0x1d82('0x35')]=_0x319597;_0xb89e5a();})[_0x1d82('0x3f')](function(_0x407733){_0xb89e5a(_0x407733);});}else if(_0x57248c){_0xb89e5a();}else{return _0x3bbdeb[_0x1d82('0x47')](0x194)[_0x1d82('0x3b')]({'message':_0x1d82('0x5a')});}});};exports[_0x1d82('0x5b')]=function canUpdate(){return compose()['use'](function(_0x1bd03e,_0x54c4a2,_0x5e5624){return licenseUtil[_0x1d82('0x5c')]()[_0x1d82('0x39')](function(_0x33cfb4){if(_0x33cfb4['update']){_0x5e5624();}else{return _0x54c4a2[_0x1d82('0x47')](0x193)[_0x1d82('0x3b')]({'message':_0x1d82('0x5d')});}})[_0x1d82('0x3f')](function(_0x5e1de6){_0x5e5624(_0x5e1de6);});});};exports[_0x1d82('0x5e')]=function isWebrtcLicence(){return compose()[_0x1d82('0x34')](function(_0x3bbb6a,_0x271526,_0x1f9ab0){return licenseUtil[_0x1d82('0x5c')]()['then'](function(_0x31702d){if(_0x31702d[_0x1d82('0x5f')]){_0x1f9ab0();}else{return _0x271526[_0x1d82('0x47')](0x193)[_0x1d82('0x3b')]({'message':'Forbidden'});}})['catch'](function(_0x268bda){_0x1f9ab0(_0x268bda);});});};exports[_0x1d82('0x60')]=function(_0x44bc94,_0x19eacb,_0x505048){_0x44bc94[_0x1d82('0x60')]=!![];return _0x505048();};exports[_0x1d82('0x61')]=function signToken(_0x5e1b76){return signJwt(_0x5e1b76);};exports[_0x1d82('0x62')]=function(_0x19eb66,_0x375b41){if(!_0x19eb66[_0x1d82('0x35')]){return _0x375b41[_0x1d82('0x47')](0x194)['json']({'message':_0x1d82('0x63')});}var _0xc4eac6={'payload':{'id':_0x19eb66[_0x1d82('0x35')]['id'],'role':_0x19eb66[_0x1d82('0x35')][_0x1d82('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0xc4eac6)['then'](function(_0x3b8860){_0x375b41[_0x1d82('0x64')](_0x1d82('0x65'),_0x3b8860);_0x375b41['redirect'](_0x1d82('0x66'));})[_0x1d82('0x3f')](function(_0x9e192b){return _0x375b41['status'](0x1f4)[_0x1d82('0x67')](_0x9e192b);});};exports[_0x1d82('0x68')]=function(_0x1de549){if(_[_0x1d82('0x69')](_0x1de549['apiKeyNonce'])||_[_0x1d82('0x69')](_0x1de549['apiKeyIat'])){return null;}else{return createJwt(_0x1de549);}};exports[_0x1d82('0x6a')]=function(_0x3ced04){_0x3ced04['apiKeyNonce']=generateNonce();_0x3ced04[_0x1d82('0x6b')]=generateIssuedAt();return createJwt(_0x3ced04);};exports[_0x1d82('0x6c')]=function(_0x235982,_0x404710){var _0x2d7a20=_0x235982['query']['apikey'];if(_0x2d7a20){var _0x3b9d27={'nonce':_0x404710[_0x1d82('0x6d')],'iat':_0x404710[_0x1d82('0x6b')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x1d82('0x4c')]()};return verifyJwt(_0x2d7a20,_0x3b9d27)[_0x1d82('0x39')](function(){return generateApiKey(_0x404710);});}else{throw{'message':_0x1d82('0x6e')};}};exports['validatePasswordPattern']=function(_0xfe0b92){var _0x3763e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3763e4[_0x1d82('0x6f')](_0xfe0b92))throw new db[(_0x1d82('0x70'))]['ValidationError'](_0x1d82('0x71'));return;};exports[_0x1d82('0x72')]=function(_0x14e1af,_0x5a442d,_0x4235fd){var _0x2e56f8=encryptor[_0x1d82('0x73')](_0x5a442d)[_0x1d82('0x74')](',');for(var _0x508c95=0x0;_0x508c95<_0x4235fd;_0x508c95++){if(!_0x2e56f8[_0x508c95])break;if(_0x14e1af[_0x1d82('0x75')]()===_0x2e56f8[_0x508c95][_0x1d82('0x75')]()){var _0x3b18cc=util[_0x1d82('0x76')](_0x1d82('0x77'),_0x4235fd);if(_0x4235fd===0x1){_0x3b18cc=_0x1d82('0x78');}throw new db[(_0x1d82('0x70'))][(_0x1d82('0x79'))](_0x3b18cc);}}return;};exports['updatePasswordsHistory']=function(_0x2c2265,_0xcc36c3){var _0x29b915=_0xcc36c3?encryptor['decryptString'](_0xcc36c3)[_0x1d82('0x74')](','):[];if(_0x29b915['length']===0x5){_0x29b915['splice'](-0x1,0x1);}_0x29b915[_0x1d82('0x7a')](_0x2c2265);return encryptor[_0x1d82('0x7b')](_0x29b915[_0x1d82('0x7c')](','));};function signJwt(_0x55febd){var _0x4ef24c=BPromise[_0x1d82('0x7d')](jwt[_0x1d82('0x7e')],{'context':jwt});var _0x3c415c=_0x55febd[_0x1d82('0x7f')]||config[_0x1d82('0x80')][_0x1d82('0xd')];return new BPromise(function(_0x1c9a21,_0x403696){_0x4ef24c(_0x55febd[_0x1d82('0x81')],_0x3c415c,_0x55febd[_0x1d82('0x82')])[_0x1d82('0x39')](function(_0x4757c9){_0x1c9a21(_0x4757c9);})[_0x1d82('0x3f')](function(_0x3ec4bf){_0x403696(_0x3ec4bf);});});}function verifyJwt(_0x15e421,_0x392040,_0x494517){var _0x205b92=BPromise[_0x1d82('0x7d')](jwt[_0x1d82('0x83')],{'context':jwt});var _0x49de3d=_0x494517||config['secrets'][_0x1d82('0xd')];return new BPromise(function(_0x4ed108,_0x25b77a){_0x205b92(_0x15e421,_0x49de3d,_0x392040)[_0x1d82('0x39')](function(_0x2c8a61){_0x4ed108(_0x2c8a61);})[_0x1d82('0x3f')](function(_0x70e54c){_0x25b77a(_0x70e54c);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x1d82('0x84')](_0x1d82('0x85'));}function generateIssuedAt(){return Math[_0x1d82('0x86')](Date[_0x1d82('0x87')]()/0x3e8)[_0x1d82('0x84')]();}function createJwt(_0x57ec8a){var _0x1da116={'payload':{'iat':_0x57ec8a[_0x1d82('0x6b')],'nonce':_0x57ec8a[_0x1d82('0x6d')]},'options':{'algorithm':'HS512','subject':_0x57ec8a['id']['toString'](),'issuer':hardwareConf[_0x1d82('0x4c')](),'audience':hardwareConf[_0x1d82('0x4c')]()}};return signJwt(_0x1da116)[_0x1d82('0x39')](function(_0x213a35){return{'iat':_0x57ec8a[_0x1d82('0x6b')],'nonce':_0x57ec8a[_0x1d82('0x6d')],'token':_0x213a35};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 25f39f4..f3121b4 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 _0xbb72=['binary','write','end','final','unlink','decryptFile','createWriteStream','createDecipher','close','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','data','update'];(function(_0x3d44a9,_0x36fd3a){var _0x1ce0a6=function(_0x4ad80a){while(--_0x4ad80a){_0x3d44a9['push'](_0x3d44a9['shift']());}};_0x1ce0a6(++_0x36fd3a);}(_0xbb72,0x176));var _0x2bb7=function(_0xff4b2d,_0xcaa14c){_0xff4b2d=_0xff4b2d-0x0;var _0x2c230a=_0xbb72[_0xff4b2d];return _0x2c230a;};'use strict';var crypto=require(_0x2bb7('0x0'));var fs=require('fs');var BPromise=require(_0x2bb7('0x1'));var _=require(_0x2bb7('0x2'));var config=require(_0x2bb7('0x3'));var logger=require(_0x2bb7('0x4'))(_0x2bb7('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2bb7('0x6')][_0x2bb7('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x2bb7('0x8')};if(config[_0x2bb7('0x9')]&&config[_0x2bb7('0x9')][_0x2bb7('0xa')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x2bb7('0xa')]);if(isSupported){fileOptions['algorithm']=config[_0x2bb7('0x9')][_0x2bb7('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2bb7('0xb')](',\x20');logger[_0x2bb7('0xc')](config[_0x2bb7('0x9')][_0x2bb7('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4498be){return AES_SUPPORTED_RX[_0x2bb7('0xd')](_0x4498be);}function getSupportedCiphers(){return crypto[_0x2bb7('0xe')]()[_0x2bb7('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x1ffc00){return getSupportedCiphers()[_0x2bb7('0x10')](_0x1ffc00)>-0x1;}function combineOptions(_0x118ff8){var _0x3e57d7={};for(var _0x3d5ef7 in fileOptions){if(fileOptions[_0x2bb7('0x11')](_0x3d5ef7)){_0x3e57d7[_0x3d5ef7]=fileOptions[_0x3d5ef7];}}if(_0x118ff8){for(var _0x41653f in _0x118ff8){if(_0x118ff8[_0x2bb7('0x11')](_0x41653f)){_0x3e57d7[_0x41653f]=_0x118ff8[_0x41653f];}}}return _0x3e57d7;}exports[_0x2bb7('0x12')]=function(_0x444665,_0x47c210,_0x512e91,_0x1ce7d1){return new BPromise(function(_0x5783ca,_0x12ada7){_0x1ce7d1=combineOptions(_0x1ce7d1);var _0x597864=new Buffer(_0x512e91);var _0x405525=fs[_0x2bb7('0x13')](_0x444665);var _0x27e455=fs['createWriteStream'](_0x47c210);var _0xda3d9a=crypto['createCipher'](_0x1ce7d1['algorithm'],_0x597864);_0x405525['on'](_0x2bb7('0x14'),function(_0x1c27ec){var _0x11d975=new Buffer(_0xda3d9a[_0x2bb7('0x15')](_0x1c27ec),_0x2bb7('0x16'));_0x27e455[_0x2bb7('0x17')](_0x11d975);});_0x405525['on'](_0x2bb7('0x18'),function(){try{var _0x34adb7=new Buffer(_0xda3d9a[_0x2bb7('0x19')](_0x2bb7('0x16')),'binary');_0x27e455[_0x2bb7('0x17')](_0x34adb7);_0x27e455[_0x2bb7('0x18')]();_0x27e455['on']('close',function(){return _0x5783ca(_0x47c210);});}catch(_0x44773a){fs[_0x2bb7('0x1a')](_0x47c210);return _0x12ada7(_0x44773a);}});});};exports[_0x2bb7('0x1b')]=function(_0x2c16cb,_0x32cfc8,_0x238ff4,_0x2a6c3){return new BPromise(function(_0x4b6d02,_0x1d9ef8){_0x2a6c3=combineOptions(_0x2a6c3);var _0x571f64=new Buffer(_0x238ff4);var _0x16b686=fs[_0x2bb7('0x13')](_0x2c16cb);var _0x2c8ce4=fs[_0x2bb7('0x1c')](_0x32cfc8);var _0x102cb7=crypto[_0x2bb7('0x1d')](_0x2a6c3[_0x2bb7('0xa')],_0x571f64);_0x16b686['on']('data',function(_0x3edbe4){var _0xcfb5b5=new Buffer(_0x102cb7['update'](_0x3edbe4),_0x2bb7('0x16'));_0x2c8ce4['write'](_0xcfb5b5);});_0x16b686['on']('end',function(){try{var _0x270002=new Buffer(_0x102cb7[_0x2bb7('0x19')]('binary'),_0x2bb7('0x16'));_0x2c8ce4[_0x2bb7('0x17')](_0x270002);_0x2c8ce4[_0x2bb7('0x18')]();_0x2c8ce4['on'](_0x2bb7('0x1e'),function(){return _0x4b6d02(_0x32cfc8);});}catch(_0x3ac7ab){fs[_0x2bb7('0x1a')](_0x32cfc8);return _0x1d9ef8(_0x3ac7ab);}});});};exports['encryptString']=function(_0x3f9453,_0x33eacf,_0x4f6300){var _0x55f4e6=_0x4f6300||stringOptions['algorithm'];var _0x3893cf=_0x33eacf||stringOptions[_0x2bb7('0x1f')];var _0x594602=crypto[_0x2bb7('0x20')](_0x55f4e6,_0x3893cf);var _0x376a80=_0x594602[_0x2bb7('0x15')](_0x3f9453,_0x2bb7('0x21'),_0x2bb7('0x22'));_0x376a80+=_0x594602[_0x2bb7('0x19')](_0x2bb7('0x22'));return _0x376a80;};exports[_0x2bb7('0x23')]=function(_0x44a34f,_0x5703e2,_0x2de5be){var _0x28d3d7=_0x2de5be||stringOptions[_0x2bb7('0xa')];var _0x1b1399=_0x5703e2||stringOptions['secret'];var _0x45d416=crypto[_0x2bb7('0x1d')](_0x28d3d7,_0x1b1399);var _0xef00a1=_0x45d416[_0x2bb7('0x15')](_0x44a34f,_0x2bb7('0x22'),_0x2bb7('0x21'));_0xef00a1+=_0x45d416['final']('utf8');return _0xef00a1;}; \ No newline at end of file +var _0x5113=['encryptFile','createReadStream','createWriteStream','update','binary','write','final','end','close','unlink','decryptFile','createDecipher','encryptString','secret','createCipher','utf8','base64','decryptString','bluebird','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty'];(function(_0x4c6968,_0x1bd5a3){var _0xd7727=function(_0x31f288){while(--_0x31f288){_0x4c6968['push'](_0x4c6968['shift']());}};_0xd7727(++_0x1bd5a3);}(_0x5113,0x1d9));var _0x3511=function(_0x1c16a4,_0xbba97c){_0x1c16a4=_0x1c16a4-0x0;var _0xa47eb7=_0x5113[_0x1c16a4];return _0xa47eb7;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x3511('0x0'));var _=require('lodash');var config=require(_0x3511('0x1'));var logger=require('../../config/logger')(_0x3511('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3511('0x3')][_0x3511('0x4')],'algorithm':_0x3511('0x5')};const fileOptions={'algorithm':_0x3511('0x6')};if(config['encrypt']&&config[_0x3511('0x7')][_0x3511('0x8')]){var isSupported=isAlgorithmSupported(config[_0x3511('0x7')][_0x3511('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0x3511('0x7')][_0x3511('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3511('0x9')](',\x20');logger[_0x3511('0xa')](config[_0x3511('0x7')][_0x3511('0x8')],_0x3511('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x3184cc){return AES_SUPPORTED_RX[_0x3511('0xc')](_0x3184cc);}function getSupportedCiphers(){return crypto[_0x3511('0xd')]()[_0x3511('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x159dd2){return getSupportedCiphers()[_0x3511('0xf')](_0x159dd2)>-0x1;}function combineOptions(_0x1ac4f6){var _0x380153={};for(var _0x48da45 in fileOptions){if(fileOptions[_0x3511('0x10')](_0x48da45)){_0x380153[_0x48da45]=fileOptions[_0x48da45];}}if(_0x1ac4f6){for(var _0xd1619d in _0x1ac4f6){if(_0x1ac4f6[_0x3511('0x10')](_0xd1619d)){_0x380153[_0xd1619d]=_0x1ac4f6[_0xd1619d];}}}return _0x380153;}exports[_0x3511('0x11')]=function(_0x2f3c57,_0x3f3175,_0x4488d1,_0x5f2d25){return new BPromise(function(_0x1e30b8,_0x2bbc89){_0x5f2d25=combineOptions(_0x5f2d25);var _0xfd5031=new Buffer(_0x4488d1);var _0x57f44e=fs[_0x3511('0x12')](_0x2f3c57);var _0x33293b=fs[_0x3511('0x13')](_0x3f3175);var _0x44d552=crypto['createCipher'](_0x5f2d25[_0x3511('0x8')],_0xfd5031);_0x57f44e['on']('data',function(_0x1e8a51){var _0xd05ca4=new Buffer(_0x44d552[_0x3511('0x14')](_0x1e8a51),_0x3511('0x15'));_0x33293b[_0x3511('0x16')](_0xd05ca4);});_0x57f44e['on']('end',function(){try{var _0x34f432=new Buffer(_0x44d552[_0x3511('0x17')](_0x3511('0x15')),_0x3511('0x15'));_0x33293b[_0x3511('0x16')](_0x34f432);_0x33293b[_0x3511('0x18')]();_0x33293b['on'](_0x3511('0x19'),function(){return _0x1e30b8(_0x3f3175);});}catch(_0x48f6df){fs[_0x3511('0x1a')](_0x3f3175);return _0x2bbc89(_0x48f6df);}});});};exports[_0x3511('0x1b')]=function(_0x4bd7b8,_0x48c715,_0x486dfc,_0x3fe4ba){return new BPromise(function(_0x5beccc,_0x9ed6fb){_0x3fe4ba=combineOptions(_0x3fe4ba);var _0x198d75=new Buffer(_0x486dfc);var _0x2209ef=fs['createReadStream'](_0x4bd7b8);var _0x486667=fs[_0x3511('0x13')](_0x48c715);var _0x234d37=crypto[_0x3511('0x1c')](_0x3fe4ba[_0x3511('0x8')],_0x198d75);_0x2209ef['on']('data',function(_0x581690){var _0x18d5db=new Buffer(_0x234d37[_0x3511('0x14')](_0x581690),_0x3511('0x15'));_0x486667['write'](_0x18d5db);});_0x2209ef['on']('end',function(){try{var _0x360929=new Buffer(_0x234d37['final'](_0x3511('0x15')),_0x3511('0x15'));_0x486667['write'](_0x360929);_0x486667[_0x3511('0x18')]();_0x486667['on'](_0x3511('0x19'),function(){return _0x5beccc(_0x48c715);});}catch(_0x5efd0d){fs[_0x3511('0x1a')](_0x48c715);return _0x9ed6fb(_0x5efd0d);}});});};exports[_0x3511('0x1d')]=function(_0x5c82f0,_0x23ce64,_0x2946d3){var _0x4423c2=_0x2946d3||stringOptions[_0x3511('0x8')];var _0x2b07f5=_0x23ce64||stringOptions[_0x3511('0x1e')];var _0x362708=crypto[_0x3511('0x1f')](_0x4423c2,_0x2b07f5);var _0x35af30=_0x362708['update'](_0x5c82f0,_0x3511('0x20'),_0x3511('0x21'));_0x35af30+=_0x362708['final'](_0x3511('0x21'));return _0x35af30;};exports[_0x3511('0x22')]=function(_0x523acf,_0x12b08c,_0x44d6cf){var _0x5bdea0=_0x44d6cf||stringOptions[_0x3511('0x8')];var _0x28bbe1=_0x12b08c||stringOptions[_0x3511('0x1e')];var _0x3df65c=crypto[_0x3511('0x1c')](_0x5bdea0,_0x28bbe1);var _0x5884a9=_0x3df65c[_0x3511('0x14')](_0x523acf,'base64',_0x3511('0x20'));_0x5884a9+=_0x3df65c[_0x3511('0x17')](_0x3511('0x20'));return _0x5884a9;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d617739..ec7fbad 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 _0xc73f=['num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.csv','existsSync','join','each','csv','%s.%s','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv','bluebird','../../mysqldb','dbH','analytics','argv','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','Empty','length','range'];(function(_0x537f32,_0x30b628){var _0x53dd91=function(_0x238564){while(--_0x238564){_0x537f32['push'](_0x537f32['shift']());}};_0x53dd91(++_0x30b628);}(_0xc73f,0x173));var _0xfc73=function(_0x27f29c,_0x5f2c79){_0x27f29c=_0x27f29c-0x0;var _0x18eba8=_0xc73f[_0x27f29c];return _0x18eba8;};'use strict';var util=require(_0xfc73('0x0'));var path=require(_0xfc73('0x1'));var _=require(_0xfc73('0x2'));var csv=require(_0xfc73('0x3'));var fs=require('fs');var BPromise=require(_0xfc73('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xfc73('0x5'))[_0xfc73('0x6')];var logger=require('../../config/logger')(_0xfc73('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xfc73('0x8')][0x2]);var QUERY=process[_0xfc73('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xdbeede,_0x4d2018){var _0x3d6837={'status':_0xdbeede};var _0x1699c2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d2018){_0x3d6837['savename']=_0x4d2018;}return db['AnalyticExtractedReport']['update'](_0x3d6837,_0x1699c2);}function main(){var _0x4748ff=0x1388;var _0x4d5076;logger[_0xfc73('0x9')](util[_0xfc73('0xa')](_0xfc73('0xb'),EXTRACTED_REPORT_ID,_0xfc73('0xc')));return db[_0xfc73('0xd')][_0xfc73('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfc73('0xf'),'splitSizeCsv']})['then'](function(_0x4a95d0){if(_0x4a95d0){_0x4d5076=_0x4a95d0;_0x4748ff=_0x4d5076[_0xfc73('0x10')]||0x1388;}})[_0xfc73('0x11')](function(){return dbH['sequelize'][_0xfc73('0x12')](util[_0xfc73('0xa')](_0xfc73('0x13'),QUERY),{'type':dbH[_0xfc73('0x14')]['QueryTypes'][_0xfc73('0x15')]});})[_0xfc73('0x11')](function(_0x5b3412){if(!_0x5b3412[0x0]['num']){return analyticExtractedReport(_0xfc73('0x16'));}var _0x2e8169=[];var _0x2f775c=0x0;if(_0x4d5076['split']){if(_0x5b3412&&_0x5b3412[_0xfc73('0x17')]){var _0x3ff625=_[_0xfc73('0x18')](_0x5b3412[0x0][_0xfc73('0x19')]/_0x4748ff);var _0x206f11=Number['isInteger'](_0x5b3412[0x0][_0xfc73('0x19')]/_0x4748ff)?_0x5b3412[0x0][_0xfc73('0x19')]%_0x4748ff:0x0;_0x3ff625[_0xfc73('0x1a')](function(_0x5d80c0){if(_0x5d80c0>0x0){_0x2f775c+=_0x4748ff;}_0x2e8169[_0xfc73('0x1b')](dbH[_0xfc73('0x14')][_0xfc73('0x12')](util[_0xfc73('0xa')](_0xfc73('0x1c'),QUERY,_0x4748ff,_0x2f775c),{'type':dbH[_0xfc73('0x14')]['QueryTypes'][_0xfc73('0x15')]}));});if(_0x206f11>0x0){_0x2f775c+=_0x4748ff;_0x2e8169[_0xfc73('0x1b')](dbH[_0xfc73('0x14')]['query'](util[_0xfc73('0xa')](_0xfc73('0x1c'),QUERY,_0x206f11,_0x2f775c),{'type':dbH[_0xfc73('0x14')][_0xfc73('0x1d')][_0xfc73('0x15')]}));}}}else{_0x2e8169['push'](dbH[_0xfc73('0x14')][_0xfc73('0x12')](QUERY,{'type':dbH[_0xfc73('0x14')][_0xfc73('0x1d')][_0xfc73('0x15')]}));}var _0x5936ae=path[_0xfc73('0x1e')](PATH);var _0x2b8e0f=path['basename'](PATH,_0xfc73('0x1f'));var _0x17591d=_0x4d5076[_0xfc73('0xf')]&&_0x2e8169['length']>0x1;var _0x1baed5=[];if(!fs[_0xfc73('0x20')](path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f))&&_0x17591d){fs['mkdirSync'](path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f));}return BPromise[_0xfc73('0x22')](_0x2e8169,function(_0x47491b){_0x1baed5[_0xfc73('0x1b')](_0x47491b);})[_0xfc73('0x11')](function(){for(var _0x5c024c=0x0;_0x5c024c<_0x1baed5[_0xfc73('0x17')];_0x5c024c+=0x1){var _0x148303;var _0x247d11=_0x1baed5[_0x5c024c];if(_0x17591d){_0x148303=path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f,util[_0xfc73('0xa')]('%s%d.%s',_0x2b8e0f,_0x5c024c,_0xfc73('0x23')));}else{_0x148303=path[_0xfc73('0x21')](_0x5936ae,util['format'](_0xfc73('0x24'),_0x2b8e0f,_0xfc73('0x23')));}fs['writeFileSync'](_0x148303,csv(_0x247d11));}})['then'](function(){if(_0x17591d){return new Promise(function(_0x110841){zipdir(path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f),{'saveTo':path[_0xfc73('0x21')](_0x5936ae,util['format'](_0xfc73('0x24'),_0x2b8e0f,_0xfc73('0x25')))},function(_0x4db17e,_0x165d15){rimraf(path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f),function(){});_0x110841(_0xfc73('0x26'));});});}})[_0xfc73('0x11')](function(){logger['info'](util[_0xfc73('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfc73('0xc')));return analyticExtractedReport(_0xfc73('0x27'),_0x17591d?util[_0xfc73('0xa')](_0xfc73('0x24'),_0x2b8e0f,_0x17591d?_0xfc73('0x25'):_0xfc73('0x23')):null);});})['catch'](function(_0x13fa8e){logger[_0xfc73('0x9')](util[_0xfc73('0xa')](_0xfc73('0x28'),EXTRACTED_REPORT_ID,_0xfc73('0xc')),util[_0xfc73('0x29')](_0x13fa8e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfc73('0x2a'));})['finally'](function(){process[_0xfc73('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8ce2=['sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','.csv','length','existsSync','join','mkdirSync','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','split','splitSizeCsv','then'];(function(_0x398b16,_0x8fb9da){var _0x517cdb=function(_0x176d37){while(--_0x176d37){_0x398b16['push'](_0x398b16['shift']());}};_0x517cdb(++_0x8fb9da);}(_0x8ce2,0x100));var _0x28ce=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8ce2[_0x1035c1];return _0x308d67;};'use strict';var util=require(_0x28ce('0x0'));var path=require(_0x28ce('0x1'));var _=require(_0x28ce('0x2'));var csv=require(_0x28ce('0x3'));var fs=require('fs');var BPromise=require(_0x28ce('0x4'));var zipdir=require(_0x28ce('0x5'));var rimraf=require(_0x28ce('0x6'));var db=require(_0x28ce('0x7'))['db'];var dbH=require(_0x28ce('0x7'))['dbH'];var logger=require('../../config/logger')(_0x28ce('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x28ce('0x9')][0x2]);var QUERY=process[_0x28ce('0x9')][0x3];var PATH=process[_0x28ce('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5bf9d8,_0x1e3ecf){var _0x512965={'status':_0x5bf9d8};var _0x119460={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1e3ecf){_0x512965[_0x28ce('0xa')]=_0x1e3ecf;}return db[_0x28ce('0xb')][_0x28ce('0xc')](_0x512965,_0x119460);}function main(){var _0x2212e1=0x1388;var _0x2630de;logger[_0x28ce('0xd')](util[_0x28ce('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x28ce('0xf')));return db[_0x28ce('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x28ce('0x11'),_0x28ce('0x12')]})[_0x28ce('0x13')](function(_0xf83c35){if(_0xf83c35){_0x2630de=_0xf83c35;_0x2212e1=_0x2630de[_0x28ce('0x12')]||0x1388;}})[_0x28ce('0x13')](function(){return dbH[_0x28ce('0x14')]['query'](util[_0x28ce('0xe')](_0x28ce('0x15'),QUERY),{'type':dbH[_0x28ce('0x14')][_0x28ce('0x16')][_0x28ce('0x17')]});})[_0x28ce('0x13')](function(_0x4d2e6a){if(!_0x4d2e6a[0x0][_0x28ce('0x18')]){return analyticExtractedReport(_0x28ce('0x19'));}var _0x45c13d=[];var _0x362e59=0x0;if(_0x2630de[_0x28ce('0x11')]){if(_0x4d2e6a&&_0x4d2e6a['length']){var _0x11d305=_[_0x28ce('0x1a')](_0x4d2e6a[0x0][_0x28ce('0x18')]/_0x2212e1);var _0x5b6ddb=Number['isInteger'](_0x4d2e6a[0x0][_0x28ce('0x18')]/_0x2212e1)?_0x4d2e6a[0x0][_0x28ce('0x18')]%_0x2212e1:0x0;_0x11d305[_0x28ce('0x1b')](function(_0xca1ac){if(_0xca1ac>0x0){_0x362e59+=_0x2212e1;}_0x45c13d['push'](dbH[_0x28ce('0x14')][_0x28ce('0x1c')](util[_0x28ce('0xe')](_0x28ce('0x1d'),QUERY,_0x2212e1,_0x362e59),{'type':dbH[_0x28ce('0x14')]['QueryTypes'][_0x28ce('0x17')]}));});if(_0x5b6ddb>0x0){_0x362e59+=_0x2212e1;_0x45c13d[_0x28ce('0x1e')](dbH[_0x28ce('0x14')]['query'](util[_0x28ce('0xe')](_0x28ce('0x1d'),QUERY,_0x5b6ddb,_0x362e59),{'type':dbH[_0x28ce('0x14')][_0x28ce('0x16')][_0x28ce('0x17')]}));}}}else{_0x45c13d[_0x28ce('0x1e')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x28ce('0x14')][_0x28ce('0x16')]['SELECT']}));}var _0x4b3219=path['dirname'](PATH);var _0x1ca63f=path['basename'](PATH,_0x28ce('0x1f'));var _0x12382a=_0x2630de['split']&&_0x45c13d[_0x28ce('0x20')]>0x1;var _0x532f18=[];if(!fs[_0x28ce('0x21')](path[_0x28ce('0x22')](_0x4b3219,_0x1ca63f))&&_0x12382a){fs[_0x28ce('0x23')](path[_0x28ce('0x22')](_0x4b3219,_0x1ca63f));}return BPromise['each'](_0x45c13d,function(_0x3d29c0){_0x532f18[_0x28ce('0x1e')](_0x3d29c0);})[_0x28ce('0x13')](function(){for(var _0x5aa384=0x0;_0x5aa384<_0x532f18[_0x28ce('0x20')];_0x5aa384+=0x1){var _0x2fec78;var _0x5bba36=_0x532f18[_0x5aa384];if(_0x12382a){_0x2fec78=path[_0x28ce('0x22')](_0x4b3219,_0x1ca63f,util[_0x28ce('0xe')]('%s%d.%s',_0x1ca63f,_0x5aa384,_0x28ce('0x24')));}else{_0x2fec78=path[_0x28ce('0x22')](_0x4b3219,util[_0x28ce('0xe')](_0x28ce('0x25'),_0x1ca63f,'csv'));}fs[_0x28ce('0x26')](_0x2fec78,csv(_0x5bba36));}})[_0x28ce('0x13')](function(){if(_0x12382a){return new Promise(function(_0x20020c){zipdir(path['join'](_0x4b3219,_0x1ca63f),{'saveTo':path[_0x28ce('0x22')](_0x4b3219,util[_0x28ce('0xe')](_0x28ce('0x25'),_0x1ca63f,_0x28ce('0x27')))},function(_0xe3af49,_0x564b5f){rimraf(path[_0x28ce('0x22')](_0x4b3219,_0x1ca63f),function(){});_0x20020c(_0x28ce('0x28'));});});}})[_0x28ce('0x13')](function(){logger['info'](util[_0x28ce('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x28ce('0xf')));return analyticExtractedReport(_0x28ce('0x29'),_0x12382a?util[_0x28ce('0xe')](_0x28ce('0x25'),_0x1ca63f,_0x12382a?_0x28ce('0x27'):'csv'):null);});})['catch'](function(_0x24fd9b){logger[_0x28ce('0xd')](util['format'](_0x28ce('0x2a'),EXTRACTED_REPORT_ID,_0x28ce('0xf')),util[_0x28ce('0x2b')](_0x24fd9b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x28ce('0x2c'));})['finally'](function(){process[_0x28ce('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a5fc0d3..9b24e52 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 _0xb571=['range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','createPdfFromHTML','path','util','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','fill','length','auto','push','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','header','pageBreak','before','\x20/\x20','black','num','Setting','find','split','then','splitSizePdf'];(function(_0x235ec6,_0x14b872){var _0x2c4dad=function(_0x3861c5){while(--_0x3861c5){_0x235ec6['push'](_0x235ec6['shift']());}};_0x2c4dad(++_0x14b872);}(_0xb571,0x18f));var _0x1b57=function(_0x303d23,_0x46cd57){_0x303d23=_0x303d23-0x0;var _0x217e39=_0xb571[_0x303d23];return _0x217e39;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x1b57('0x0'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x1b57('0x1'));var PdfPrinter=require(_0x1b57('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x1b57('0x3'));var JSDOM=require(_0x1b57('0x4'))[_0x1b57('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0x1b57('0x6'));var db=require(_0x1b57('0x7'))['db'];var dbH=require(_0x1b57('0x7'))[_0x1b57('0x8')];var logger=require(_0x1b57('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1b57('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1b57('0xa')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x1b57('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4ff826,_0x35d4d4){var _0xfe1f9b={'status':_0x4ff826};var _0x4ddfe0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35d4d4){_0xfe1f9b[_0x1b57('0xc')]=_0x35d4d4;}return db[_0x1b57('0xd')][_0x1b57('0xe')](_0xfe1f9b,_0x4ddfe0);}function getHeaders(_0x140385){return _[_0x1b57('0xf')](_0x140385,function(_0x2b1932){return{'text':_0x2b1932,'style':_0x1b57('0x10')};});}function getRows(_0x424e7a,_0x232398){return _[_0x1b57('0xf')](_0x232398,function(_0x4a2e86){return _(_0x4a2e86)['pick'](_0x424e7a)[_0x1b57('0xf')](function(_0x29a046){return _0x29a046?_[_0x1b57('0x11')](_0x29a046):'';})['value']();});}function createTable(_0x4bb4b0,_0x55f6bd){var _0xbdae34={'widths':_[_0x1b57('0x12')](Array(_0x4bb4b0[_0x1b57('0x13')]),0x91),'heights':function(_0x57c401){return _0x57c401===0x0?_0x1b57('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x24492c=getHeaders(_0x4bb4b0);_0xbdae34['body'][_0x1b57('0x15')](_0x24492c);var _0x3ddcbb=getRows(_0x4bb4b0,_0x55f6bd);_0xbdae34[_0x1b57('0x16')]=_0xbdae34['body'][_0x1b57('0x17')](_0x3ddcbb);return _0xbdae34;}function createTables(_0x57c8f7){var _0x361440=[];var _0x1bdc4d=_[_0x1b57('0x18')](Object[_0x1b57('0x19')](_0x57c8f7[0x0]),0x5);_0x1bdc4d[_0x1b57('0x1a')](function(_0x108726){_0x361440['push'](createTable(_0x108726,_0x57c8f7));});return _0x361440;}function getPDFDocDefinition(_0x1d8438){var _0x3d866e=util[_0x1b57('0x1b')](_0x1b57('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x1b57('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x1b57('0x1d')])[_0x1b57('0x1b')](FORMAT));var _0x479de7=[];for(var _0x230d39=0x0;_0x230d39<_0x1d8438['length'];_0x230d39++){var _0x5d7f6f=[];if(_0x230d39===0x0){_0x5d7f6f[_0x1b57('0x15')]({'text':_0x3d866e,'style':_0x1b57('0x1e')});}var _0x4bed4e={'table':_0x1d8438[_0x230d39]};if(_0x230d39>0x0){_0x4bed4e[_0x1b57('0x1f')]=_0x1b57('0x20');_0x4bed4e['margin']=[0x0,0x46,0x0,0x0];}_0x5d7f6f['push'](_0x4bed4e);_0x479de7['push'](_0x5d7f6f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x479de7,'footer':function(_0x3d3b89,_0x55be21){return{'text':_0x3d3b89['toString']()+_0x1b57('0x21')+_0x55be21,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1b57('0x22')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xb9efd9){var _0x77ad22=0x1388;var _0xe6300d;if(!_0xb9efd9[0x0][_0x1b57('0x23')]){return analyticExtractedReport('Empty');}return db[_0x1b57('0x24')][_0x1b57('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1b57('0x26'),'splitSizePdf']})[_0x1b57('0x27')](function(_0x518fbc){if(_0x518fbc){_0xe6300d=_0x518fbc;_0x77ad22=_0xe6300d[_0x1b57('0x28')]||0x3e8;}})[_0x1b57('0x27')](function(){var _0x508005=[];var _0x128d2d=0x0;if(_0xe6300d[_0x1b57('0x26')]){if(_0xb9efd9&&_0xb9efd9['length']){var _0x48006f=_[_0x1b57('0x29')](_0xb9efd9[0x0][_0x1b57('0x23')]/_0x77ad22);var _0x5d4907=Number['isInteger'](_0xb9efd9[0x0][_0x1b57('0x23')]/_0x77ad22)?_0xb9efd9[0x0][_0x1b57('0x23')]%_0x77ad22:0x0;_0x48006f[_0x1b57('0x1a')](function(_0x4722f4){if(_0x4722f4>0x0){_0x128d2d+=_0x77ad22;}_0x508005[_0x1b57('0x15')](dbH[_0x1b57('0x2a')][_0x1b57('0x2b')](util[_0x1b57('0x1b')](_0x1b57('0x2c'),QUERY,_0x77ad22,_0x128d2d),{'type':dbH[_0x1b57('0x2a')][_0x1b57('0x2d')][_0x1b57('0x2e')]}));});if(_0x5d4907>0x0){_0x128d2d+=_0x77ad22;_0x508005[_0x1b57('0x15')](dbH[_0x1b57('0x2a')]['query'](util[_0x1b57('0x1b')](_0x1b57('0x2c'),QUERY,_0x5d4907,_0x128d2d),{'type':dbH['sequelize'][_0x1b57('0x2d')]['SELECT']}));}}}else{_0x508005['push'](dbH[_0x1b57('0x2a')]['query'](QUERY,{'type':dbH['sequelize'][_0x1b57('0x2d')]['SELECT']}));}var _0x2b42e5=path['dirname'](PATH);var _0x31e0f4=path['basename'](PATH,'.pdf');var _0x50ab49=_0xe6300d[_0x1b57('0x26')]&&_0x508005[_0x1b57('0x13')]>0x1;var _0x128a82=[];if(!fs[_0x1b57('0x2f')](path['join'](_0x2b42e5,_0x31e0f4))&&_0x50ab49){fs[_0x1b57('0x30')](path[_0x1b57('0x31')](_0x2b42e5,_0x31e0f4));}return BPromise[_0x1b57('0x32')](_0x508005,function(_0x57e41b){_0x128a82[_0x1b57('0x15')](_0x57e41b);})[_0x1b57('0x27')](function(){var _0x33cbe8=[];for(var _0x2ea307=0x0;_0x2ea307<_0x128a82['length'];_0x2ea307+=0x1){var _0x14f887=_0x128a82[_0x2ea307];var _0x5e54e2=createTables(_[_0x1b57('0x33')](_0x14f887));var _0x4e38a;var _0x19923a=getPDFDocDefinition(_0x5e54e2);var _0x1306f7=getPDFPrinter();var _0x62292c=_0x1306f7[_0x1b57('0x34')](_0x19923a);if(_0x50ab49){_0x4e38a=path['join'](_0x2b42e5,_0x31e0f4,util[_0x1b57('0x1b')](_0x1b57('0x35'),_0x31e0f4,_0x2ea307,_0x1b57('0x36')));}else{_0x4e38a=path[_0x1b57('0x31')](_0x2b42e5,util['format'](_0x1b57('0x37'),_0x31e0f4,_0x1b57('0x36')));}_0x33cbe8[_0x1b57('0x15')](writePDFDocument(_0x62292c,_0x4e38a));}return Promise[_0x1b57('0x38')](_0x33cbe8);})[_0x1b57('0x27')](function(){if(_0x50ab49){return new Promise(function(_0x153403){zipdir(path[_0x1b57('0x31')](_0x2b42e5,_0x31e0f4),{'saveTo':path[_0x1b57('0x31')](_0x2b42e5,util['format']('%s.%s',_0x31e0f4,_0x1b57('0x39')))},function(){rimraf(path['join'](_0x2b42e5,_0x31e0f4),function(){});_0x153403(_0x1b57('0x3a'));});});}})[_0x1b57('0x27')](function(){if(!_0x50ab49)return;rimraf(path[_0x1b57('0x31')](_0x2b42e5,_0x31e0f4),function(){});})[_0x1b57('0x27')](function(){logger[_0x1b57('0x3b')](util[_0x1b57('0x1b')](_0x1b57('0x3c'),EXTRACTED_REPORT_ID,_0x1b57('0x3d')));return analyticExtractedReport(_0x1b57('0x3e'),_0x50ab49?util[_0x1b57('0x1b')](_0x1b57('0x37'),_0x31e0f4,_0x50ab49?'zip':_0x1b57('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1b57('0x3b')](util['format'](_0x1b57('0x3f'),EXTRACTED_REPORT_ID,_0x1b57('0x3d')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x398915){EXTRACTED_REPORT=_0x398915;return dbH[_0x1b57('0x2a')][_0x1b57('0x2b')](util[_0x1b57('0x1b')](_0x1b57('0x40'),QUERY),{'type':dbH['sequelize'][_0x1b57('0x2d')]['SELECT']});})['then'](extractReport)[_0x1b57('0x41')](function(_0x1b774a){logger[_0x1b57('0x3b')](util[_0x1b57('0x1b')](_0x1b57('0x42'),EXTRACTED_REPORT_ID,_0x1b57('0x3d')),util[_0x1b57('0x43')](_0x1b774a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1b57('0x44'));})[_0x1b57('0x45')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x15352d=new PdfPrinter({'Arial':{'normal':__dirname+_0x1b57('0x46'),'bold':__dirname+_0x1b57('0x47'),'italics':__dirname+_0x1b57('0x48'),'bolditalics':__dirname+_0x1b57('0x49')}});return _0x15352d;}function getPDFDocDefinitionFromHTML(_0x454e3f,_0xd90188){var _0x59caff=util[_0x1b57('0x1b')](_0x1b57('0x4a'),_0xd90188[_0x1b57('0x4b')],_0xd90188[_0x1b57('0x4c')]);var _0x46ef6f=moment()[_0x1b57('0x1b')](_0x1b57('0x4d'))[_0x1b57('0x11')]();var _0x203e75=htmlToPdfmake(_0x454e3f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x203e75],'defaultStyle':{'font':_0x1b57('0x4e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1b57('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x1b57('0x50'),'style':_0x1b57('0x1e')}];},'footer':function(_0x23ba92,_0x19e943){return[{'text':util[_0x1b57('0x1b')](_0x1b57('0x51'),_0x59caff,_0x23ba92,_0x19e943,_0x46ef6f),'style':_0x1b57('0x52')}];}};}function writePDFDocument(_0x2ce192,_0x41c5bc){return new Promise(function(_0x154f3e,_0x21a33e){var _0x4f8640=_0x2ce192[_0x1b57('0x53')](fs[_0x1b57('0x54')](_0x41c5bc));_0x4f8640['on'](_0x1b57('0x55'),function(){_0x154f3e(_0x1b57('0x55'));});_0x4f8640['on']('error',function(_0x524816){_0x21a33e(_0x524816);});_0x2ce192['end']();});}exports[_0x1b57('0x56')]=function(_0x5bc481,_0x5770ca){var _0x171e7a=getPDFPrinter();var _0x56b7e4=getPDFDocDefinitionFromHTML(_0x5bc481,_0x5770ca);var _0x226c1b=_0x171e7a[_0x1b57('0x34')](_0x56b7e4);return writePDFDocument(_0x226c1b,_0x5770ca[_0x1b57('0x57')])[_0x1b57('0x41')](function(_0x423422){throw _0x423422;});}; \ No newline at end of file +var _0x0330=['range','num','isInteger','forEach','sequelize','query','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','existsSync','join','mkdirSync','each','then','flatten','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','PDF','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','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','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','update','map','tableHeader','value','length','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','margin','landscape','footer','Arial','right','Empty','Setting','split','splitSizePdf'];(function(_0x2e7b94,_0x1ac81f){var _0x11833b=function(_0x3f1108){while(--_0x3f1108){_0x2e7b94['push'](_0x2e7b94['shift']());}};_0x11833b(++_0x1ac81f);}(_0x0330,0x85));var _0x0033=function(_0x2960b3,_0x5dfd10){_0x2960b3=_0x2960b3-0x0;var _0x11ea92=_0x0330[_0x2960b3];return _0x11ea92;};'use strict';var _=require(_0x0033('0x0'));var fs=require('fs');var util=require(_0x0033('0x1'));var path=require(_0x0033('0x2'));var moment=require(_0x0033('0x3'));var htmlToPdfmake=require(_0x0033('0x4'));var PdfPrinter=require(_0x0033('0x5'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x0033('0x6'))[_0x0033('0x7')];var window=new JSDOM('')[_0x0033('0x8')];var BPromise=require(_0x0033('0x9'));var db=require(_0x0033('0xa'))['db'];var dbH=require(_0x0033('0xa'))['dbH'];var logger=require(_0x0033('0xb'))(_0x0033('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x0033('0xd')][0x2]);var QUERY=process[_0x0033('0xd')][0x3];var PATH=process[_0x0033('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1d0db4,_0xec1b8){var _0x5c6f98={'status':_0x1d0db4};var _0x525139={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xec1b8){_0x5c6f98[_0x0033('0xe')]=_0xec1b8;}return db['AnalyticExtractedReport'][_0x0033('0xf')](_0x5c6f98,_0x525139);}function getHeaders(_0x4e718a){return _[_0x0033('0x10')](_0x4e718a,function(_0x413a48){return{'text':_0x413a48,'style':_0x0033('0x11')};});}function getRows(_0xeb7ade,_0x5432e8){return _[_0x0033('0x10')](_0x5432e8,function(_0x2aee9c){return _(_0x2aee9c)['pick'](_0xeb7ade)['map'](function(_0x3a96f2){return _0x3a96f2?_['toString'](_0x3a96f2):'';})[_0x0033('0x12')]();});}function createTable(_0x1191aa,_0x3b7564){var _0x7dc425={'widths':_['fill'](Array(_0x1191aa[_0x0033('0x13')]),0x91),'heights':function(_0x2cb371){return _0x2cb371===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x59d948=getHeaders(_0x1191aa);_0x7dc425[_0x0033('0x14')][_0x0033('0x15')](_0x59d948);var _0x1a6438=getRows(_0x1191aa,_0x3b7564);_0x7dc425[_0x0033('0x14')]=_0x7dc425[_0x0033('0x14')][_0x0033('0x16')](_0x1a6438);return _0x7dc425;}function createTables(_0x2b8ceb){var _0x54e0c5=[];var _0x134de3=_[_0x0033('0x17')](Object[_0x0033('0x18')](_0x2b8ceb[0x0]),0x5);_0x134de3['forEach'](function(_0x48e25c){_0x54e0c5['push'](createTable(_0x48e25c,_0x2b8ceb));});return _0x54e0c5;}function getPDFDocDefinition(_0xfc2736){var _0x32ba1c=util[_0x0033('0x19')](_0x0033('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x0033('0x1b')])[_0x0033('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0x0033('0x1c')])[_0x0033('0x19')](FORMAT));var _0x2088ad=[];for(var _0x3cbfff=0x0;_0x3cbfff<_0xfc2736[_0x0033('0x13')];_0x3cbfff++){var _0x456bc2=[];if(_0x3cbfff===0x0){_0x456bc2[_0x0033('0x15')]({'text':_0x32ba1c,'style':_0x0033('0x1d')});}var _0x24e679={'table':_0xfc2736[_0x3cbfff]};if(_0x3cbfff>0x0){_0x24e679['pageBreak']='before';_0x24e679[_0x0033('0x1e')]=[0x0,0x46,0x0,0x0];}_0x456bc2[_0x0033('0x15')](_0x24e679);_0x2088ad['push'](_0x456bc2);}return{'pageSize':'A4','pageOrientation':_0x0033('0x1f'),'content':_0x2088ad,'footer':function(_0x56e0a3,_0x1255d4){return{'text':_0x56e0a3['toString']()+'\x20/\x20'+_0x1255d4,'style':_0x0033('0x20')};},'defaultStyle':{'font':_0x0033('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x0033('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4813ac){var _0x17b884=0x1388;var _0x45e312;if(!_0x4813ac[0x0]['num']){return analyticExtractedReport(_0x0033('0x23'));}return db[_0x0033('0x24')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0033('0x25'),_0x0033('0x26')]})['then'](function(_0x491435){if(_0x491435){_0x45e312=_0x491435;_0x17b884=_0x45e312[_0x0033('0x26')]||0x3e8;}})['then'](function(){var _0x3d97c4=[];var _0xd04369=0x0;if(_0x45e312[_0x0033('0x25')]){if(_0x4813ac&&_0x4813ac[_0x0033('0x13')]){var _0x5d446e=_[_0x0033('0x27')](_0x4813ac[0x0][_0x0033('0x28')]/_0x17b884);var _0x1ba08e=Number[_0x0033('0x29')](_0x4813ac[0x0]['num']/_0x17b884)?_0x4813ac[0x0][_0x0033('0x28')]%_0x17b884:0x0;_0x5d446e[_0x0033('0x2a')](function(_0x449600){if(_0x449600>0x0){_0xd04369+=_0x17b884;}_0x3d97c4[_0x0033('0x15')](dbH[_0x0033('0x2b')][_0x0033('0x2c')](util[_0x0033('0x19')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x17b884,_0xd04369),{'type':dbH[_0x0033('0x2b')][_0x0033('0x2d')]['SELECT']}));});if(_0x1ba08e>0x0){_0xd04369+=_0x17b884;_0x3d97c4[_0x0033('0x15')](dbH['sequelize'][_0x0033('0x2c')](util[_0x0033('0x19')](_0x0033('0x2e'),QUERY,_0x1ba08e,_0xd04369),{'type':dbH['sequelize']['QueryTypes'][_0x0033('0x2f')]}));}}}else{_0x3d97c4['push'](dbH[_0x0033('0x2b')][_0x0033('0x2c')](QUERY,{'type':dbH[_0x0033('0x2b')][_0x0033('0x2d')][_0x0033('0x2f')]}));}var _0x408401=path[_0x0033('0x30')](PATH);var _0x21ca94=path[_0x0033('0x31')](PATH,'.pdf');var _0x12fdd3=_0x45e312[_0x0033('0x25')]&&_0x3d97c4[_0x0033('0x13')]>0x1;var _0x513ef3=[];if(!fs[_0x0033('0x32')](path[_0x0033('0x33')](_0x408401,_0x21ca94))&&_0x12fdd3){fs[_0x0033('0x34')](path['join'](_0x408401,_0x21ca94));}return BPromise[_0x0033('0x35')](_0x3d97c4,function(_0x34cc28){_0x513ef3['push'](_0x34cc28);})[_0x0033('0x36')](function(){var _0x14ff6f=[];for(var _0x46e10b=0x0;_0x46e10b<_0x513ef3[_0x0033('0x13')];_0x46e10b+=0x1){var _0x248e45=_0x513ef3[_0x46e10b];var _0x5aa876=createTables(_[_0x0033('0x37')](_0x248e45));var _0x33c931;var _0x250158=getPDFDocDefinition(_0x5aa876);var _0x1ba129=getPDFPrinter();var _0x3693b1=_0x1ba129['createPdfKitDocument'](_0x250158);if(_0x12fdd3){_0x33c931=path[_0x0033('0x33')](_0x408401,_0x21ca94,util[_0x0033('0x19')](_0x0033('0x38'),_0x21ca94,_0x46e10b,_0x0033('0x39')));}else{_0x33c931=path['join'](_0x408401,util[_0x0033('0x19')](_0x0033('0x3a'),_0x21ca94,_0x0033('0x39')));}_0x14ff6f[_0x0033('0x15')](writePDFDocument(_0x3693b1,_0x33c931));}return Promise[_0x0033('0x3b')](_0x14ff6f);})[_0x0033('0x36')](function(){if(_0x12fdd3){return new Promise(function(_0x178f0d){zipdir(path[_0x0033('0x33')](_0x408401,_0x21ca94),{'saveTo':path[_0x0033('0x33')](_0x408401,util['format'](_0x0033('0x3a'),_0x21ca94,'zip'))},function(){rimraf(path[_0x0033('0x33')](_0x408401,_0x21ca94),function(){});_0x178f0d(_0x0033('0x3c'));});});}})[_0x0033('0x36')](function(){if(!_0x12fdd3)return;rimraf(path[_0x0033('0x33')](_0x408401,_0x21ca94),function(){});})[_0x0033('0x36')](function(){logger[_0x0033('0x3d')](util[_0x0033('0x19')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x0033('0x3e')));return analyticExtractedReport('Completed',_0x12fdd3?util[_0x0033('0x19')](_0x0033('0x3a'),_0x21ca94,_0x12fdd3?_0x0033('0x3f'):_0x0033('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x0033('0x3d')](util[_0x0033('0x19')](_0x0033('0x40'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x0033('0x41')][_0x0033('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x0033('0x36')](function(_0x53c915){EXTRACTED_REPORT=_0x53c915;return dbH[_0x0033('0x2b')][_0x0033('0x2c')](util[_0x0033('0x19')](_0x0033('0x43'),QUERY),{'type':dbH[_0x0033('0x2b')]['QueryTypes'][_0x0033('0x2f')]});})[_0x0033('0x36')](extractReport)[_0x0033('0x44')](function(_0x25baf7){logger['info'](util['format'](_0x0033('0x45'),EXTRACTED_REPORT_ID,_0x0033('0x3e')),util['inspect'](_0x25baf7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x0033('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9e0c2c=new PdfPrinter({'Arial':{'normal':__dirname+_0x0033('0x47'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x0033('0x48'),'bolditalics':__dirname+_0x0033('0x49')}});return _0x9e0c2c;}function getPDFDocDefinitionFromHTML(_0xdc1f1f,_0x27dc81){var _0x36db2e=util[_0x0033('0x19')](_0x0033('0x4a'),_0x27dc81[_0x0033('0x4b')],_0x27dc81[_0x0033('0x4c')]);var _0x28f7ff=moment()[_0x0033('0x19')]('YYYY-MM-DD')['toString']();var _0x4fab75=htmlToPdfmake(_0xdc1f1f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4fab75],'defaultStyle':{'font':_0x0033('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x0033('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x0033('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x0033('0x4d')}},'header':function(){return[{'text':_0x0033('0x4e'),'style':'header'}];},'footer':function(_0xf9361b,_0xb4390c){return[{'text':util[_0x0033('0x19')](_0x0033('0x4f'),_0x36db2e,_0xf9361b,_0xb4390c,_0x28f7ff),'style':_0x0033('0x20')}];}};}function writePDFDocument(_0x46e289,_0x2a4740){return new Promise(function(_0x390fc8,_0x367b78){var _0x45b868=_0x46e289[_0x0033('0x50')](fs[_0x0033('0x51')](_0x2a4740));_0x45b868['on']('finish',function(){_0x390fc8(_0x0033('0x52'));});_0x45b868['on'](_0x0033('0x53'),function(_0x389f87){_0x367b78(_0x389f87);});_0x46e289[_0x0033('0x54')]();});}exports['createPdfFromHTML']=function(_0x3ee7f6,_0x5a5e0d){var _0x596187=getPDFPrinter();var _0x4c6fd0=getPDFDocDefinitionFromHTML(_0x3ee7f6,_0x5a5e0d);var _0x4ba983=_0x596187[_0x0033('0x55')](_0x4c6fd0);return writePDFDocument(_0x4ba983,_0x5a5e0d[_0x0033('0x2')])[_0x0033('0x44')](function(_0xbf4aa){throw _0xbf4aa;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2a25914..57be8d3 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 _0x1e24=['split','then','splitSizeXlsx','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','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','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting'];(function(_0x338654,_0x9a50e2){var _0x437626=function(_0x2b19cc){while(--_0x2b19cc){_0x338654['push'](_0x338654['shift']());}};_0x437626(++_0x9a50e2);}(_0x1e24,0x82));var _0x41e2=function(_0x37b022,_0x742861){_0x37b022=_0x37b022-0x0;var _0x3b6c68=_0x1e24[_0x37b022];return _0x3b6c68;};'use strict';var util=require(_0x41e2('0x0'));var path=require(_0x41e2('0x1'));var _=require(_0x41e2('0x2'));var fs=require('fs');var json2xls=require(_0x41e2('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x41e2('0x4'));var rimraf=require(_0x41e2('0x5'));var db=require(_0x41e2('0x6'))['db'];var dbH=require(_0x41e2('0x6'))['dbH'];var logger=require(_0x41e2('0x7'))(_0x41e2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x41e2('0x9')][0x2]);var QUERY=process[_0x41e2('0x9')][0x3];var PATH=process[_0x41e2('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3d52b3,_0x12955b){var _0x1b6dd9={'status':_0x3d52b3};var _0x470d69={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12955b){_0x1b6dd9['savename']=_0x12955b;}return db[_0x41e2('0xa')][_0x41e2('0xb')](_0x1b6dd9,_0x470d69);}function main(){var _0x46015d=0x1388;var _0x1fed0f;logger[_0x41e2('0xc')](util[_0x41e2('0xd')](_0x41e2('0xe'),EXTRACTED_REPORT_ID,_0x41e2('0xf')));return db[_0x41e2('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x41e2('0x11'),'splitSizeXlsx']})[_0x41e2('0x12')](function(_0x33160d){if(_0x33160d){_0x1fed0f=_0x33160d;_0x46015d=_0x1fed0f[_0x41e2('0x13')]||0x1388;}})['then'](function(){return dbH[_0x41e2('0x14')]['query'](util[_0x41e2('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x41e2('0x14')][_0x41e2('0x15')][_0x41e2('0x16')]});})['then'](function(_0x9aab16){if(!_0x9aab16[0x0][_0x41e2('0x17')]){return analyticExtractedReport(_0x41e2('0x18'));}var _0x348630=[];var _0x491f50=0x0;if(_0x1fed0f[_0x41e2('0x11')]){if(_0x9aab16&&_0x9aab16[_0x41e2('0x19')]){var _0x7085dc=_[_0x41e2('0x1a')](_0x9aab16[0x0]['num']/_0x46015d);var _0x3dd4b7=Number[_0x41e2('0x1b')](_0x9aab16[0x0][_0x41e2('0x17')]/_0x46015d)?_0x9aab16[0x0][_0x41e2('0x17')]%_0x46015d:0x0;_0x7085dc['forEach'](function(_0x2108f5){if(_0x2108f5>0x0){_0x491f50+=_0x46015d;}_0x348630[_0x41e2('0x1c')](dbH[_0x41e2('0x14')][_0x41e2('0x1d')](util[_0x41e2('0xd')](_0x41e2('0x1e'),QUERY,_0x46015d,_0x491f50),{'type':dbH[_0x41e2('0x14')][_0x41e2('0x15')][_0x41e2('0x16')]}));});if(_0x3dd4b7>0x0){_0x491f50+=_0x46015d;_0x348630[_0x41e2('0x1c')](dbH[_0x41e2('0x14')][_0x41e2('0x1d')](util[_0x41e2('0xd')](_0x41e2('0x1e'),QUERY,_0x3dd4b7,_0x491f50),{'type':dbH[_0x41e2('0x14')][_0x41e2('0x15')][_0x41e2('0x16')]}));}}}else{_0x348630['push'](dbH[_0x41e2('0x14')]['query'](QUERY,{'type':dbH[_0x41e2('0x14')][_0x41e2('0x15')][_0x41e2('0x16')]}));}var _0x3dced4=path[_0x41e2('0x1f')](PATH);var _0x2cae5d=path[_0x41e2('0x20')](PATH,_0x41e2('0x21'));var _0x5ec732=_0x1fed0f['split']&&_0x348630[_0x41e2('0x19')]>0x1;var _0x49ec8e=[];if(!fs['existsSync'](path[_0x41e2('0x22')](_0x3dced4,_0x2cae5d))&&_0x5ec732){fs['mkdirSync'](path['join'](_0x3dced4,_0x2cae5d));}return BPromise[_0x41e2('0x23')](_0x348630,function(_0x668108){_0x49ec8e[_0x41e2('0x1c')](_0x668108);})[_0x41e2('0x12')](function(){for(var _0x314d8e=0x0;_0x314d8e<_0x49ec8e[_0x41e2('0x19')];_0x314d8e+=0x1){var _0x4f99ef;var _0x273710=_0x49ec8e[_0x314d8e];if(_0x5ec732){_0x4f99ef=path['join'](_0x3dced4,_0x2cae5d,util[_0x41e2('0xd')](_0x41e2('0x24'),_0x2cae5d,_0x314d8e,_0x41e2('0x25')));}else{_0x4f99ef=path[_0x41e2('0x22')](_0x3dced4,util[_0x41e2('0xd')](_0x41e2('0x26'),_0x2cae5d,_0x41e2('0x25')));}fs[_0x41e2('0x27')](_0x4f99ef,json2xls(_0x273710),_0x41e2('0x28'));}})[_0x41e2('0x12')](function(){if(_0x5ec732){return new Promise(function(_0x271a24){zipdir(path[_0x41e2('0x22')](_0x3dced4,_0x2cae5d),{'saveTo':path['join'](_0x3dced4,util['format'](_0x41e2('0x26'),_0x2cae5d,_0x41e2('0x29')))},function(_0x2b7403,_0x54855b){rimraf(path[_0x41e2('0x22')](_0x3dced4,_0x2cae5d),function(){});_0x271a24(_0x41e2('0x2a'));});});}})[_0x41e2('0x12')](function(){logger[_0x41e2('0xc')](util['format'](_0x41e2('0x2b'),EXTRACTED_REPORT_ID,_0x41e2('0xf')));return analyticExtractedReport('Completed',_0x5ec732?util[_0x41e2('0xd')](_0x41e2('0x26'),_0x2cae5d,_0x5ec732?'zip':_0x41e2('0x25')):null);});})[_0x41e2('0x2c')](function(_0xbb0b1d){logger[_0x41e2('0xc')](util[_0x41e2('0xd')](_0x41e2('0x2d'),EXTRACTED_REPORT_ID,_0x41e2('0xf')),util[_0x41e2('0x2e')](_0xbb0b1d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x41e2('0x2f'));})['finally'](function(){process[_0x41e2('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0874=['find','split','then','splitSizeXlsx','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s.%s','xlsx','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting'];(function(_0x541a27,_0x582830){var _0xb9d579=function(_0x4ba878){while(--_0x4ba878){_0x541a27['push'](_0x541a27['shift']());}};_0xb9d579(++_0x582830);}(_0x0874,0xb1));var _0x4087=function(_0x399a1e,_0x5d7c30){_0x399a1e=_0x399a1e-0x0;var _0x1077e1=_0x0874[_0x399a1e];return _0x1077e1;};'use strict';var util=require('util');var path=require(_0x4087('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x4087('0x1'));var BPromise=require(_0x4087('0x2'));var zipdir=require(_0x4087('0x3'));var rimraf=require(_0x4087('0x4'));var db=require(_0x4087('0x5'))['db'];var dbH=require(_0x4087('0x5'))['dbH'];var logger=require(_0x4087('0x6'))(_0x4087('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x4087('0x8')][0x2]);var QUERY=process[_0x4087('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x28044d,_0x5eb266){var _0x441d49={'status':_0x28044d};var _0x1bf287={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5eb266){_0x441d49['savename']=_0x5eb266;}return db[_0x4087('0x9')][_0x4087('0xa')](_0x441d49,_0x1bf287);}function main(){var _0x1d5023=0x1388;var _0x2d82a9;logger[_0x4087('0xb')](util['format'](_0x4087('0xc'),EXTRACTED_REPORT_ID,_0x4087('0xd')));return db[_0x4087('0xe')][_0x4087('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4087('0x10'),'splitSizeXlsx']})[_0x4087('0x11')](function(_0x6d0ed9){if(_0x6d0ed9){_0x2d82a9=_0x6d0ed9;_0x1d5023=_0x2d82a9[_0x4087('0x12')]||0x1388;}})[_0x4087('0x11')](function(){return dbH['sequelize'][_0x4087('0x13')](util[_0x4087('0x14')](_0x4087('0x15'),QUERY),{'type':dbH[_0x4087('0x16')]['QueryTypes'][_0x4087('0x17')]});})[_0x4087('0x11')](function(_0x176123){if(!_0x176123[0x0][_0x4087('0x18')]){return analyticExtractedReport('Empty');}var _0x27a823=[];var _0x4abf29=0x0;if(_0x2d82a9[_0x4087('0x10')]){if(_0x176123&&_0x176123[_0x4087('0x19')]){var _0x2f56d4=_[_0x4087('0x1a')](_0x176123[0x0]['num']/_0x1d5023);var _0xbc58b2=Number['isInteger'](_0x176123[0x0]['num']/_0x1d5023)?_0x176123[0x0][_0x4087('0x18')]%_0x1d5023:0x0;_0x2f56d4[_0x4087('0x1b')](function(_0x556fb3){if(_0x556fb3>0x0){_0x4abf29+=_0x1d5023;}_0x27a823[_0x4087('0x1c')](dbH[_0x4087('0x16')][_0x4087('0x13')](util[_0x4087('0x14')](_0x4087('0x1d'),QUERY,_0x1d5023,_0x4abf29),{'type':dbH[_0x4087('0x16')][_0x4087('0x1e')][_0x4087('0x17')]}));});if(_0xbc58b2>0x0){_0x4abf29+=_0x1d5023;_0x27a823[_0x4087('0x1c')](dbH['sequelize'][_0x4087('0x13')](util[_0x4087('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xbc58b2,_0x4abf29),{'type':dbH['sequelize']['QueryTypes'][_0x4087('0x17')]}));}}}else{_0x27a823[_0x4087('0x1c')](dbH[_0x4087('0x16')][_0x4087('0x13')](QUERY,{'type':dbH[_0x4087('0x16')][_0x4087('0x1e')][_0x4087('0x17')]}));}var _0x20d3dd=path[_0x4087('0x1f')](PATH);var _0x260526=path[_0x4087('0x20')](PATH,_0x4087('0x21'));var _0xf09a4f=_0x2d82a9[_0x4087('0x10')]&&_0x27a823[_0x4087('0x19')]>0x1;var _0x33d0e0=[];if(!fs[_0x4087('0x22')](path[_0x4087('0x23')](_0x20d3dd,_0x260526))&&_0xf09a4f){fs[_0x4087('0x24')](path[_0x4087('0x23')](_0x20d3dd,_0x260526));}return BPromise[_0x4087('0x25')](_0x27a823,function(_0x448b50){_0x33d0e0['push'](_0x448b50);})['then'](function(){for(var _0x255ec4=0x0;_0x255ec4<_0x33d0e0[_0x4087('0x19')];_0x255ec4+=0x1){var _0x2dfb24;var _0x16b972=_0x33d0e0[_0x255ec4];if(_0xf09a4f){_0x2dfb24=path[_0x4087('0x23')](_0x20d3dd,_0x260526,util[_0x4087('0x14')]('%s%d.%s',_0x260526,_0x255ec4,'xlsx'));}else{_0x2dfb24=path[_0x4087('0x23')](_0x20d3dd,util[_0x4087('0x14')](_0x4087('0x26'),_0x260526,_0x4087('0x27')));}fs['writeFileSync'](_0x2dfb24,json2xls(_0x16b972),_0x4087('0x28'));}})[_0x4087('0x11')](function(){if(_0xf09a4f){return new Promise(function(_0x21d979){zipdir(path['join'](_0x20d3dd,_0x260526),{'saveTo':path[_0x4087('0x23')](_0x20d3dd,util['format'](_0x4087('0x26'),_0x260526,_0x4087('0x29')))},function(_0x5be985,_0x11ab30){rimraf(path[_0x4087('0x23')](_0x20d3dd,_0x260526),function(){});_0x21d979('zip\x20finished');});});}})['then'](function(){logger[_0x4087('0xb')](util[_0x4087('0x14')](_0x4087('0x2a'),EXTRACTED_REPORT_ID,_0x4087('0xd')));return analyticExtractedReport(_0x4087('0x2b'),_0xf09a4f?util[_0x4087('0x14')](_0x4087('0x26'),_0x260526,_0xf09a4f?_0x4087('0x29'):'xlsx'):null);});})['catch'](function(_0x5bccf3){logger['info'](util[_0x4087('0x14')](_0x4087('0x2c'),EXTRACTED_REPORT_ID,_0x4087('0xd')),util[_0x4087('0x2d')](_0x5bccf3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4087('0x2e')](function(){process[_0x4087('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 e0ffe89..2195a1f 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 _0x65ec=['type','Set','format','context','priority','inbound','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','VoiceExtension','IntervalId','then','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','extensions','extension','find','push'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x65ec,0x186));var _0xc65e=function(_0xaf5222,_0x2f96c2){_0xaf5222=_0xaf5222-0x0;var _0x3972c1=_0x65ec[_0xaf5222];return _0x3972c1;};'use strict';var _=require(_0xc65e('0x0'));var util=require(_0xc65e('0x1'));function rewrite(_0x1954c2,_0x1ca52e){var _0x1d4558=this;return _0x1954c2[_0xc65e('0x2')][_0xc65e('0x3')][_0xc65e('0x4')]({'raw':!![]})['then'](function(_0x20f372){_0x1d4558['intervals']=_0x20f372;return _0x1954c2['models'][_0xc65e('0x5')][_0xc65e('0x4')]({'where':{'IntervalId':_0x1ca52e[_0xc65e('0x6')]},'raw':!![]});})[_0xc65e('0x7')](function(_0x36f6f2){return _0x1954c2[_0xc65e('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0xc65e('0x8')](_0x36f6f2,_0xc65e('0x9')))}},'order':[{'raw':_0xc65e('0xa')}],'raw':!![]});})[_0xc65e('0x7')](function(_0x2a1f85){var _0x3c57f4=_[_0xc65e('0xb')](_0x2a1f85,{'priority':'1'});var _0x4e88d7=_[_0xc65e('0xb')](_0x2a1f85,{'isApp':0x1});var _0x9df071=_[_0xc65e('0xc')](_0x4e88d7,'exten');var _0xf38b65=['queue','playback'];var _0x244ab7=[];var _0x5f1a6d=[];for(var _0x5a73b6 in _0x9df071){if(_0x9df071[_0xc65e('0xd')](_0x5a73b6)){_0x1d4558['priority']=0x2;_0x1d4558[_0xc65e('0xe')]=[];_0x1d4558[_0xc65e('0xf')]=_[_0xc65e('0x10')](_0x3c57f4,{'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')]});_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':util[_0xc65e('0x14')]('CDR(type)=%s',_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')]),'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0]['VoiceExtensionId']});if(_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')]===_0xc65e('0x17')){_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0]['type'],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x18')+_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')],'context':_0x9df071[_0x5a73b6][0x0]['context'],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}else if(_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')]===_0xc65e('0x1a')){if(_0x1d4558[_0xc65e('0xf')]){_0x1d4558['extensions'][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0]['type'],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x1b')+(_0x1d4558[_0xc65e('0xf')][_0xc65e('0x1c')]?_0xc65e('0x1d')+_0x1d4558['extension']['cutdigits']+'}':_0xc65e('0x1e')),'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0]['exten'],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}_0x1d4558[_0xc65e('0xe')]['push']({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')],'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});var _0x2283d1=_0x1d4558[_0xc65e('0x16')]++;_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0]['type'],'app':_0xc65e('0x1f'),'appdata':_0xc65e('0x20')+(_0x2283d1+0x2)+_0xc65e('0x21')+(_0x2283d1+0x1)+')','context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x2283d1,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});if(_0x1d4558[_0xc65e('0xf')]){_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0x1d4558['extension'][_0xc65e('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x1d4558[_0xc65e('0xf')][_0xc65e('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558['priority']++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}_0x1d4558[_0xc65e('0xe')]['push']({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':'outboundrouteid='+_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')],'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});if(_0x1d4558[_0xc65e('0xf')]&&_0x1d4558[_0xc65e('0xf')][_0xc65e('0xd')](_0xc65e('0x22'))&&_0x1d4558[_0xc65e('0xf')]['recordingFormat']!==_0xc65e('0x23')){_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x24'),'context':_0x9df071[_0x5a73b6][0x0]['context'],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0]['VoiceExtensionId']});_0x1d4558['extensions'][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x25')+_0x1d4558[_0xc65e('0xf')]['recordingFormat']||'wav','context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558['priority']++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}}_0x1d4558[_0xc65e('0xe')]['push']({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':'Set','appdata':_0xc65e('0x26'),'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x27'),'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0]['exten'],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});for(var _0x5def2c=0x0,_0x1940e1=0x0;_0x5def2c<_0x9df071[_0x5a73b6][_0xc65e('0x28')];_0x5def2c+=0x1,_0x1940e1=0x0){var _0x393229=_0x9df071[_0x5a73b6][_0x5def2c];if(_0x393229['type']){_0x393229['type']=_0x393229[_0xc65e('0x12')][_0xc65e('0x29')]();}var _0x5232e3=[];var _0x2519c0=[];delete _0x393229['id'];delete _0x393229[_0xc65e('0x2a')];delete _0x393229[_0xc65e('0x2b')];var _0x5a9782=_0x393229['interval']!==_0xc65e('0x2c')?[_0x393229['interval']]:_0x393229['IntervalId']?_[_0xc65e('0x8')](_[_0xc65e('0xb')](_0x1d4558['intervals'],{'IntervalId':_0x393229['IntervalId']}),_0xc65e('0x2d')):[];if(_0x393229[_0xc65e('0xd')](_0xc65e('0x2e'))){if(_0x393229[_0xc65e('0x2e')]&&_0x393229['tag']!=='--'){_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x2f')+_0x393229[_0xc65e('0x2e')],'context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}}if(_0x393229['type']===_0xc65e('0x1a')&&_0x393229[_0xc65e('0xd')](_0xc65e('0x30'))){if(_0x393229[_0xc65e('0x30')]){_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x1f'),'appdata':_0xc65e('0x31')+_0x393229['callerID']+')','context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}else{_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x1f'),'appdata':_0xc65e('0x32'),'context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782['length']+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}}if(_0x393229[_0xc65e('0xd')](_0xc65e('0x33'))){if(_0xf38b65['indexOf'](_0x393229['app']['toLowerCase']())>=0x0&&_0x393229[_0xc65e('0x34')]!==_0xc65e('0x35')){if(_0x393229['answer']){_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x1f'),'appdata':_0xc65e('0x36'),'context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782['length']+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});_0x5232e3['push']({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x37'),'context':_0x393229[_0xc65e('0x15')],'exten':_0x393229['exten'],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}else{_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558['priority']+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x393229[_0xc65e('0x15')],'exten':_0x393229['exten'],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}}}for(var _0x19676a=0x0;_0x19676a<_0x5a9782['length'];_0x19676a+=0x1){var _0x5574b1=_0x1d4558[_0xc65e('0x16')]+_0x5a9782[_0xc65e('0x28')];var _0x4ade4c=_0x19676a===_0x5a9782[_0xc65e('0x28')]-0x1?_0x1d4558[_0xc65e('0x16')]+_0x5232e3[_0xc65e('0x28')]+_0x2519c0[_0xc65e('0x28')]+0x2:_0x1d4558[_0xc65e('0x16')]+_0x19676a+0x1;_0x5232e3[_0xc65e('0x38')](_0x19676a,0x0,{'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x39'),'appdata':_0x5a9782[_0x19676a]+'?'+_0x393229[_0xc65e('0x15')]+_0xc65e('0x3a')+_0x5574b1+':'+_0x393229[_0xc65e('0x15')]+_0xc65e('0x3a')+_0x4ade4c,'exten':_0x393229['exten'],'context':_0x393229[_0xc65e('0x15')],'priority':_0x1d4558[_0xc65e('0x16')]+_0x19676a,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}_0x393229[_0xc65e('0x16')]=_0x5232e3[_0xc65e('0x28')]?_[_0xc65e('0x3b')](_0x5232e3)[_0xc65e('0x16')]+0x1:_0x1d4558[_0xc65e('0x16')];_0x1d4558[_0xc65e('0x16')]=(_0x2519c0[_0xc65e('0x28')]?_['last'](_0x2519c0)[_0xc65e('0x16')]:_0x393229[_0xc65e('0x16')])+0x1;_0x1d4558['extensions']=_[_0xc65e('0x3c')](_0x1d4558['extensions'],_0x5232e3,[_0x393229],_0x2519c0);}_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x3d'),'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'priority':_0x1d4558[_0xc65e('0x16')],'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});_0x244ab7[_0xc65e('0x11')](_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]);_0x5f1a6d=_[_0xc65e('0x3c')](_0x5f1a6d,_0x1d4558[_0xc65e('0xe')]);}}return _0x1954c2['transaction'](function(_0x40c898){return _0x1954c2[_0xc65e('0x2')][_0xc65e('0x5')][_0xc65e('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x244ab7}},'transaction':_0x40c898})[_0xc65e('0x7')](function(_0x46ffc9){return _0x1954c2[_0xc65e('0x2')][_0xc65e('0x5')][_0xc65e('0x3f')](_[_0xc65e('0x40')](_0x5f1a6d,_0xc65e('0x16')),{'transaction':_0x40c898});});});})[_0xc65e('0x41')](function(_0x297d2c){console[_0xc65e('0x42')](_0x297d2c);});}exports[_0xc65e('0x43')]=rewrite; \ No newline at end of file +var _0x6719=['CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','*,*,*,*','filter','interval','tag','callerID','length','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','catch','error','lodash','util','intervals','models','VoiceExtension','findAll','IntervalId','then','uniq','map','exten','queue','playback','priority','extensions','extension','find','push','Set','format','type','VoiceExtensionId','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto('];(function(_0x597886,_0x3772a8){var _0x1acdc2=function(_0x453242){while(--_0x453242){_0x597886['push'](_0x597886['shift']());}};_0x1acdc2(++_0x3772a8);}(_0x6719,0x67));var _0x9671=function(_0x1c4b46,_0x26ba44){_0x1c4b46=_0x1c4b46-0x0;var _0x32f50c=_0x6719[_0x1c4b46];return _0x32f50c;};'use strict';var _=require(_0x9671('0x0'));var util=require(_0x9671('0x1'));function rewrite(_0xb489e1,_0x457287){var _0x336141=this;return _0xb489e1['models']['Interval']['findAll']({'raw':!![]})['then'](function(_0x2cc4ed){_0x336141[_0x9671('0x2')]=_0x2cc4ed;return _0xb489e1[_0x9671('0x3')][_0x9671('0x4')][_0x9671('0x5')]({'where':{'IntervalId':_0x457287[_0x9671('0x6')]},'raw':!![]});})[_0x9671('0x7')](function(_0x17ba92){return _0xb489e1['models'][_0x9671('0x4')][_0x9671('0x5')]({'where':{'exten':{'$in':_[_0x9671('0x8')](_[_0x9671('0x9')](_0x17ba92,_0x9671('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x9671('0x7')](function(_0x2155e1){var _0x30b395=_['filter'](_0x2155e1,{'priority':'1'});var _0x2c5396=_['filter'](_0x2155e1,{'isApp':0x1});var _0x395280=_['groupBy'](_0x2c5396,_0x9671('0xa'));var _0x472ceb=[_0x9671('0xb'),_0x9671('0xc')];var _0x11efcf=[];var _0x5689e6=[];for(var _0x3ee492 in _0x395280){if(_0x395280['hasOwnProperty'](_0x3ee492)){_0x336141[_0x9671('0xd')]=0x2;_0x336141[_0x9671('0xe')]=[];_0x336141[_0x9671('0xf')]=_[_0x9671('0x10')](_0x30b395,{'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')]});_0x336141[_0x9671('0xe')][_0x9671('0x11')]({'type':_0x395280[_0x3ee492][0x0]['type'],'app':_0x9671('0x12'),'appdata':util[_0x9671('0x13')]('CDR(type)=%s',_0x395280[_0x3ee492][0x0][_0x9671('0x14')]),'context':_0x395280[_0x3ee492][0x0]['context'],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x336141[_0x9671('0xd')]++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});if(_0x395280[_0x3ee492][0x0][_0x9671('0x14')]==='inbound'){_0x336141[_0x9671('0xe')][_0x9671('0x11')]({'type':_0x395280[_0x3ee492][0x0]['type'],'app':_0x9671('0x12'),'appdata':_0x9671('0x16')+_0x395280[_0x3ee492][0x0]['VoiceExtensionId'],'context':_0x395280[_0x3ee492][0x0][_0x9671('0x17')],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x336141['priority']++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});}else if(_0x395280[_0x3ee492][0x0][_0x9671('0x14')]===_0x9671('0x18')){if(_0x336141[_0x9671('0xf')]){_0x336141[_0x9671('0xe')][_0x9671('0x11')]({'type':_0x395280[_0x3ee492][0x0]['type'],'app':_0x9671('0x12'),'appdata':_0x9671('0x19')+(_0x336141['extension'][_0x9671('0x1a')]?_0x9671('0x1b')+_0x336141['extension']['cutdigits']+'}':_0x9671('0x1c')),'context':_0x395280[_0x3ee492][0x0][_0x9671('0x17')],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x336141[_0x9671('0xd')]++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});}_0x336141[_0x9671('0xe')]['push']({'type':_0x395280[_0x3ee492][0x0]['type'],'app':_0x9671('0x12'),'appdata':_0x9671('0x16')+_0x395280[_0x3ee492][0x0][_0x9671('0x15')],'context':_0x395280[_0x3ee492][0x0][_0x9671('0x17')],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x336141[_0x9671('0xd')]++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0]['VoiceExtensionId']});var _0x5a6811=_0x336141[_0x9671('0xd')]++;_0x336141[_0x9671('0xe')][_0x9671('0x11')]({'type':_0x395280[_0x3ee492][0x0][_0x9671('0x14')],'app':_0x9671('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5a6811+0x2)+_0x9671('0x1e')+(_0x5a6811+0x1)+')','context':_0x395280[_0x3ee492][0x0]['context'],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x5a6811,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});if(_0x336141[_0x9671('0xf')]){_0x336141['extensions']['push']({'type':_0x395280[_0x3ee492][0x0][_0x9671('0x14')],'app':_0x9671('0x12'),'appdata':_0x336141[_0x9671('0xf')][_0x9671('0x1a')]?_0x9671('0x1f')+_0x336141[_0x9671('0xf')][_0x9671('0x1a')]+'}':_0x9671('0x20'),'context':_0x395280[_0x3ee492][0x0][_0x9671('0x17')],'exten':_0x395280[_0x3ee492][0x0]['exten'],'priority':_0x336141[_0x9671('0xd')]++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0]['VoiceExtensionId']});}_0x336141[_0x9671('0xe')]['push']({'type':_0x395280[_0x3ee492][0x0][_0x9671('0x14')],'app':_0x9671('0x12'),'appdata':_0x9671('0x21')+_0x395280[_0x3ee492][0x0][_0x9671('0x15')],'context':_0x395280[_0x3ee492][0x0][_0x9671('0x17')],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x336141['priority']++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});if(_0x336141[_0x9671('0xf')]&&_0x336141[_0x9671('0xf')][_0x9671('0x22')](_0x9671('0x23'))&&_0x336141[_0x9671('0xf')]['recordingFormat']!==_0x9671('0x24')){_0x336141[_0x9671('0xe')][_0x9671('0x11')]({'type':_0x395280[_0x3ee492][0x0][_0x9671('0x14')],'app':_0x9671('0x12'),'appdata':_0x9671('0x25'),'context':_0x395280[_0x3ee492][0x0][_0x9671('0x17')],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x336141[_0x9671('0xd')]++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});_0x336141['extensions']['push']({'type':_0x395280[_0x3ee492][0x0]['type'],'app':_0x9671('0x12'),'appdata':_0x9671('0x26')+_0x336141[_0x9671('0xf')][_0x9671('0x23')]||_0x9671('0x27'),'context':_0x395280[_0x3ee492][0x0]['context'],'exten':_0x395280[_0x3ee492][0x0]['exten'],'priority':_0x336141['priority']++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});}}_0x336141[_0x9671('0xe')][_0x9671('0x11')]({'type':_0x395280[_0x3ee492][0x0]['type'],'app':'Set','appdata':_0x9671('0x28'),'context':_0x395280[_0x3ee492][0x0][_0x9671('0x17')],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x336141['priority']++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});_0x336141[_0x9671('0xe')][_0x9671('0x11')]({'type':_0x395280[_0x3ee492][0x0][_0x9671('0x14')],'app':_0x9671('0x12'),'appdata':_0x9671('0x29'),'context':_0x395280[_0x3ee492][0x0][_0x9671('0x17')],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x336141['priority']++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});_0x336141[_0x9671('0xe')][_0x9671('0x11')]({'type':_0x395280[_0x3ee492][0x0][_0x9671('0x14')],'app':_0x9671('0x12'),'appdata':_0x9671('0x2a'),'context':_0x395280[_0x3ee492][0x0][_0x9671('0x17')],'exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'priority':_0x336141['priority']++,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});for(var _0x48f786=0x0,_0x1d8656=0x0;_0x48f786<_0x395280[_0x3ee492]['length'];_0x48f786+=0x1,_0x1d8656=0x0){var _0x4c3130=_0x395280[_0x3ee492][_0x48f786];if(_0x4c3130['type']){_0x4c3130[_0x9671('0x14')]=_0x4c3130[_0x9671('0x14')][_0x9671('0x2b')]();}var _0x251b2f=[];var _0x1faa4f=[];delete _0x4c3130['id'];delete _0x4c3130[_0x9671('0x2c')];delete _0x4c3130[_0x9671('0x2d')];var _0x385417=_0x4c3130['interval']!==_0x9671('0x2e')?[_0x4c3130['interval']]:_0x4c3130[_0x9671('0x6')]?_[_0x9671('0x9')](_[_0x9671('0x2f')](_0x336141[_0x9671('0x2')],{'IntervalId':_0x4c3130[_0x9671('0x6')]}),_0x9671('0x30')):[];if(_0x4c3130[_0x9671('0x22')](_0x9671('0x31'))){if(_0x4c3130['tag']&&_0x4c3130['tag']!=='--'){_0x251b2f[_0x9671('0x11')]({'type':_0x4c3130[_0x9671('0x14')],'app':_0x9671('0x12'),'appdata':'CDR(tag)='+_0x4c3130[_0x9671('0x31')],'context':_0x4c3130['context'],'exten':_0x4c3130[_0x9671('0xa')],'priority':_0x385417['length']+_0x336141[_0x9671('0xd')]+_0x1d8656++,'VoiceExtensionId':_0x4c3130[_0x9671('0x15')]});}}if(_0x4c3130['type']===_0x9671('0x18')&&_0x4c3130[_0x9671('0x22')](_0x9671('0x32'))){if(_0x4c3130[_0x9671('0x32')]){_0x251b2f[_0x9671('0x11')]({'type':_0x4c3130[_0x9671('0x14')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4c3130['callerID']+')','context':_0x4c3130[_0x9671('0x17')],'exten':_0x4c3130[_0x9671('0xa')],'priority':_0x385417['length']+_0x336141[_0x9671('0xd')]+_0x1d8656++,'VoiceExtensionId':_0x4c3130[_0x9671('0x15')]});}else{_0x251b2f[_0x9671('0x11')]({'type':_0x4c3130[_0x9671('0x14')],'app':_0x9671('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4c3130[_0x9671('0x17')],'exten':_0x4c3130[_0x9671('0xa')],'priority':_0x385417[_0x9671('0x33')]+_0x336141[_0x9671('0xd')]+_0x1d8656++,'VoiceExtensionId':_0x4c3130[_0x9671('0x15')]});}}if(_0x4c3130[_0x9671('0x22')](_0x9671('0x34'))){if(_0x472ceb[_0x9671('0x35')](_0x4c3130[_0x9671('0x36')][_0x9671('0x2b')]())>=0x0&&_0x4c3130['appType']!==_0x9671('0x37')){if(_0x4c3130[_0x9671('0x34')]){_0x251b2f[_0x9671('0x11')]({'type':_0x4c3130[_0x9671('0x14')],'app':_0x9671('0x1d'),'appdata':_0x9671('0x38'),'context':_0x4c3130[_0x9671('0x17')],'exten':_0x4c3130[_0x9671('0xa')],'priority':_0x385417[_0x9671('0x33')]+_0x336141[_0x9671('0xd')]+_0x1d8656++,'VoiceExtensionId':_0x4c3130[_0x9671('0x15')]});_0x251b2f[_0x9671('0x11')]({'type':_0x4c3130['type'],'app':_0x9671('0x12'),'appdata':_0x9671('0x39'),'context':_0x4c3130[_0x9671('0x17')],'exten':_0x4c3130[_0x9671('0xa')],'priority':_0x385417[_0x9671('0x33')]+_0x336141[_0x9671('0xd')]+_0x1d8656++,'VoiceExtensionId':_0x4c3130[_0x9671('0x15')]});}else{_0x251b2f[_0x9671('0x11')]({'type':_0x4c3130[_0x9671('0x14')],'app':_0x9671('0x1d'),'appdata':_0x9671('0x3a'),'context':_0x4c3130[_0x9671('0x17')],'exten':_0x4c3130[_0x9671('0xa')],'priority':_0x385417['length']+_0x336141[_0x9671('0xd')]+_0x1d8656++,'VoiceExtensionId':_0x4c3130['VoiceExtensionId']});_0x251b2f[_0x9671('0x11')]({'type':_0x4c3130['type'],'app':_0x9671('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4c3130[_0x9671('0x17')],'exten':_0x4c3130[_0x9671('0xa')],'priority':_0x385417[_0x9671('0x33')]+_0x336141[_0x9671('0xd')]+_0x1d8656++,'VoiceExtensionId':_0x4c3130['VoiceExtensionId']});}}}for(var _0x2f6410=0x0;_0x2f6410<_0x385417['length'];_0x2f6410+=0x1){var _0x5bbc75=_0x336141['priority']+_0x385417['length'];var _0x3d50f2=_0x2f6410===_0x385417[_0x9671('0x33')]-0x1?_0x336141[_0x9671('0xd')]+_0x251b2f['length']+_0x1faa4f[_0x9671('0x33')]+0x2:_0x336141[_0x9671('0xd')]+_0x2f6410+0x1;_0x251b2f['splice'](_0x2f6410,0x0,{'type':_0x4c3130[_0x9671('0x14')],'app':_0x9671('0x3b'),'appdata':_0x385417[_0x2f6410]+'?'+_0x4c3130[_0x9671('0x17')]+_0x9671('0x3c')+_0x5bbc75+':'+_0x4c3130['context']+',${EXTEN},'+_0x3d50f2,'exten':_0x4c3130[_0x9671('0xa')],'context':_0x4c3130[_0x9671('0x17')],'priority':_0x336141[_0x9671('0xd')]+_0x2f6410,'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});}_0x4c3130[_0x9671('0xd')]=_0x251b2f['length']?_[_0x9671('0x3d')](_0x251b2f)[_0x9671('0xd')]+0x1:_0x336141[_0x9671('0xd')];_0x336141[_0x9671('0xd')]=(_0x1faa4f[_0x9671('0x33')]?_['last'](_0x1faa4f)['priority']:_0x4c3130[_0x9671('0xd')])+0x1;_0x336141[_0x9671('0xe')]=_[_0x9671('0x3e')](_0x336141['extensions'],_0x251b2f,[_0x4c3130],_0x1faa4f);}_0x336141[_0x9671('0xe')][_0x9671('0x11')]({'type':_0x395280[_0x3ee492][0x0]['type'],'app':'Hangup','exten':_0x395280[_0x3ee492][0x0][_0x9671('0xa')],'context':_0x395280[_0x3ee492][0x0]['context'],'priority':_0x336141[_0x9671('0xd')],'VoiceExtensionId':_0x395280[_0x3ee492][0x0][_0x9671('0x15')]});_0x11efcf['push'](_0x395280[_0x3ee492][0x0]['VoiceExtensionId']);_0x5689e6=_[_0x9671('0x3e')](_0x5689e6,_0x336141[_0x9671('0xe')]);}}return _0xb489e1['transaction'](function(_0x259192){return _0xb489e1['models'][_0x9671('0x4')][_0x9671('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x11efcf}},'transaction':_0x259192})[_0x9671('0x7')](function(_0x4cfcba){return _0xb489e1[_0x9671('0x3')][_0x9671('0x4')][_0x9671('0x40')](_['sortBy'](_0x5689e6,'priority'),{'transaction':_0x259192});});});})[_0x9671('0x41')](function(_0x1030ab){console[_0x9671('0x42')](_0x1030ab);});}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 401a873..8c2bf89 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 _0xab94=['Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','ListId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','findAll','outbound','CmList','Lists','then','get','dialCheckDuplicateType','sequelize','VoiceQueueId','onlyIfOpen','query','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','find','duplicate','Duplicate\x20Contact','CmContact','create','push','pick','catch'];(function(_0x1febe9,_0x8dd768){var _0x2ed0bf=function(_0x47aded){while(--_0x47aded){_0x1febe9['push'](_0x1febe9['shift']());}};_0x2ed0bf(++_0x8dd768);}(_0xab94,0x16e));var _0x4ab9=function(_0x4953dd,_0x2946ab){_0x4953dd=_0x4953dd-0x0;var _0x11ce36=_0xab94[_0x4953dd];return _0x11ce36;};'use strict';var BPromise=require('bluebird');var util=require(_0x4ab9('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0x4ab9('0x1'));var Papa=require(_0x4ab9('0x2'));var Redis=require('ioredis');var db=require(_0x4ab9('0x3'))['db'];var config=require(_0x4ab9('0x4'));var logger=require(_0x4ab9('0x5'))(_0x4ab9('0x6'));config['redis']=_['defaults'](config[_0x4ab9('0x7')],{'host':_0x4ab9('0x8'),'port':0x18eb});var socket=require(_0x4ab9('0x9'))(new Redis(config[_0x4ab9('0x7')]));require(_0x4ab9('0xa'))[_0x4ab9('0xb')](socket);try{if(!process[_0x4ab9('0xc')][0x2]||process['argv'][0x2]===_0x4ab9('0xd')||process[_0x4ab9('0xc')][0x2]===_0x4ab9('0xe')){throw new Error(_0x4ab9('0xf'));}var FILEPATH=process[_0x4ab9('0xc')][0x2];if(!process[_0x4ab9('0xc')][0x3]||process[_0x4ab9('0xc')][0x3]===_0x4ab9('0xd')||process['argv'][0x3]===_0x4ab9('0xe')||!process['argv'][0x4]||process[_0x4ab9('0xc')][0x4]===_0x4ab9('0xd')||process[_0x4ab9('0xc')][0x4]===_0x4ab9('0xe')){throw new Error(_0x4ab9('0x10'));}var FIELDS=_['zipObject'](process[_0x4ab9('0xc')][0x3][_0x4ab9('0x11')](','),process[_0x4ab9('0xc')][0x4][_0x4ab9('0x11')](','));if(!process[_0x4ab9('0xc')][0x5]||process[_0x4ab9('0xc')][0x5]==='undefined'||process[_0x4ab9('0xc')][0x5]===_0x4ab9('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x4ab9('0xc')][0x5];var COMPANYID=process[_0x4ab9('0xc')][0x6]&&process[_0x4ab9('0xc')][0x6]!==_0x4ab9('0xd')&&process[_0x4ab9('0xc')][0x6]!==_0x4ab9('0xe')?process[_0x4ab9('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x4ab9('0xc')][0x7]!==_0x4ab9('0xd')&&process[_0x4ab9('0xc')][0x7]!==_0x4ab9('0xe')?process[_0x4ab9('0xc')][0x7]:null;if(!process[_0x4ab9('0xc')][0x8]||process['argv'][0x8]===_0x4ab9('0xd')||process[_0x4ab9('0xc')][0x8]===_0x4ab9('0xe')){throw new Error(_0x4ab9('0x12'));}var SOCKET_TIMESTAMP=process[_0x4ab9('0xc')][0x8];}catch(_0x131fe9){logger['error'](_0x131fe9);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(_0x27e742,_0x31afc9,_0x4f133d,_0x43b231){var _0xfd8de7={'message':_0x31afc9};_0xfd8de7[_0x27e742]=!![];if(_0x4f133d){_0xfd8de7['contact']=_0x4f133d;}if(_0x43b231){_0xfd8de7[_0x4ab9('0x13')]=_0x43b231;}return _0xfd8de7;}function isEmail(_0x340812){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))*$/[_0x4ab9('0x14')](_0x340812);}function checkRow(_0x1921c1,_0x32b522,_0xccb97f){return new BPromise(function(_0x5d0d01,_0x272424){if(_[_0x4ab9('0x15')](_0x1921c1)){return _0x272424(handleCheckRowError(_0x4ab9('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xccb97f));}if(_0x1921c1[_0x4ab9('0x17')]&&_0x1921c1[_0x4ab9('0x17')][_0x4ab9('0x18')]){var _0x558792=_[_0x4ab9('0x19')](_0x1921c1[_0x4ab9('0x17')],_0x4ab9('0x1a'))[_0x4ab9('0x1b')](';');return _0x272424(handleCheckRowError(_0x4ab9('0x16'),_0x558792,null,_0xccb97f));}var _0x39b687={};for(var _0x135720 in FIELDS){if(FIELDS['hasOwnProperty'](_0x135720)&&FIELDS[_0x135720]){_0x39b687[_0x135720]=_0x1921c1[_0x4ab9('0x1c')][0x0][FIELDS[_0x135720]]||_0x1921c1[_0x4ab9('0x1c')][0x0]['\ufeff'+FIELDS[_0x135720]];}}if(!_0x39b687[_0x4ab9('0x1d')]){return _0x272424(handleCheckRowError('error',_0x4ab9('0x1e'),null,_0xccb97f));}if(!_0x39b687[_0x4ab9('0x1f')]){return _0x272424(handleCheckRowError(_0x4ab9('0x16'),_0x4ab9('0x20'),null,_0xccb97f));}if(_0x39b687[_0x4ab9('0x21')]){var _0xd5c088=moment(_0x39b687[_0x4ab9('0x21')],_0x4ab9('0x22'));if(!_0xd5c088[_0x4ab9('0x23')]()){return _0x272424(handleCheckRowError(_0x4ab9('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0xccb97f));}}if(_0x39b687[_0x4ab9('0x24')]){if(!isEmail(_0x39b687['email'])){return _0x272424(handleCheckRowError(_0x4ab9('0x16'),_0x4ab9('0x25'),null,_0xccb97f));}}_0x39b687['ListId']=LISTID;_0x39b687['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4ab9('0x18')]&&_0x32b522){var _0x11ea36={};for(var _0x15f0a5=0x0,_0x579153=DUPLICATES['length'];_0x15f0a5<_0x579153;_0x15f0a5+=0x1){_0x11ea36[DUPLICATES[_0x15f0a5]]=_0x39b687[DUPLICATES[_0x15f0a5]];}var _0x4d5cd4=_[_0x4ab9('0x26')](_0x32b522,_0x11ea36);if(_0x4d5cd4){return _0x272424(handleCheckRowError(_0x4ab9('0x27'),_0x4ab9('0x28'),_0x4d5cd4,_0xccb97f));}}return db[_0x4ab9('0x29')][_0x4ab9('0x2a')](_0x39b687,{'raw':!![],'hooks':![],'fields':_['keys'](_0x39b687)})['then'](function(_0xf08f5f){if(DUPLICATES&&DUPLICATES[_0x4ab9('0x18')]&&_0x32b522){_0x32b522[_0x4ab9('0x2b')](_[_0x4ab9('0x2c')](_0x39b687,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf08f5f['id'];return _0x5d0d01();})[_0x4ab9('0x2d')](function(_0x3edde8){return _0x272424(handleCheckRowError('error',_0x4ab9('0x2e')+(_0x3edde8[_0x4ab9('0x1a')]||JSON[_0x4ab9('0x2f')](_0x3edde8)),null,_0xccb97f));});});}function checkHopper(){function _0x2f6557(){return function(_0x55888f){logger[_0x4ab9('0x16')]('cmContact','checkHopper',util[_0x4ab9('0x30')](_0x55888f,{'showHidden':![],'depth':null}));};}var _0x10c064=function(_0x446e8a,_0x16b8f7){var _0x4abb16=squel[_0x4ab9('0x31')]()[_0x4ab9('0x32')](_0x4ab9('0x33'))[_0x4ab9('0x34')]([_0x4ab9('0x1f'),_0x4ab9('0x35'),_0x4ab9('0x36'),'ListId',_0x16b8f7,_0x4ab9('0x37'),_0x4ab9('0x38')],squel[_0x4ab9('0x39')]()[_0x4ab9('0x3a')]('phone',_0x4ab9('0x1f'))[_0x4ab9('0x3a')](_0x4ab9('0x3b'),_0x4ab9('0x35'))[_0x4ab9('0x3a')]('id',_0x4ab9('0x36'))[_0x4ab9('0x3a')](LISTID['toString'](),_0x4ab9('0x3c'))[_0x4ab9('0x3a')](_0x446e8a['id'][_0x4ab9('0x3d')](),_0x16b8f7)[_0x4ab9('0x3a')](_0x4ab9('0x3b'),'createdAt')[_0x4ab9('0x3a')](_0x4ab9('0x3b'),'updatedAt')[_0x4ab9('0x3e')](_0x4ab9('0x3f'))[_0x4ab9('0x40')](_0x4ab9('0x41'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x4ab9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x4ab9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4ab9('0x39')]()[_0x4ab9('0x3a')](_0x4ab9('0x1f'))[_0x4ab9('0x3e')](_0x4ab9('0x33'))[_0x4ab9('0x40')](_0x16b8f7+_0x4ab9('0x42'),_0x446e8a['id'][_0x4ab9('0x3d')]())))[_0x4ab9('0x3d')]();return _0x4abb16;};var _0x122383=function(_0x869540,_0x4a1089){var _0x2ada02=squel[_0x4ab9('0x31')]()[_0x4ab9('0x32')](_0x4ab9('0x33'))[_0x4ab9('0x34')]([_0x4ab9('0x1f'),_0x4ab9('0x35'),'ContactId',_0x4ab9('0x3c'),_0x4a1089,_0x4ab9('0x37'),_0x4ab9('0x38')],squel[_0x4ab9('0x39')]()['field']('phone',_0x4ab9('0x1f'))['field'](_0x4ab9('0x3b'),_0x4ab9('0x35'))['field']('id',_0x4ab9('0x36'))[_0x4ab9('0x3a')](LISTID[_0x4ab9('0x3d')](),_0x4ab9('0x3c'))['field'](_0x869540['id'][_0x4ab9('0x3d')](),_0x4a1089)['field'](_0x4ab9('0x3b'),_0x4ab9('0x37'))[_0x4ab9('0x3a')](_0x4ab9('0x3b'),_0x4ab9('0x38'))['from']('cm_contacts')[_0x4ab9('0x40')]('deletedAt\x20IS\x20NULL')[_0x4ab9('0x40')](_0x4ab9('0x43'),LISTID[_0x4ab9('0x3d')]())[_0x4ab9('0x40')](_0x4ab9('0x44'),squel[_0x4ab9('0x45')](hopperContacts))['where'](_0x4ab9('0x46'))['where'](_0x4ab9('0x47'),squel['select']()[_0x4ab9('0x3a')]('calleridnum')['from'](_0x4ab9('0x48'))[_0x4ab9('0x40')](_0x4a1089+_0x4ab9('0x42'),_0x869540['id'][_0x4ab9('0x3d')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x4ab9('0x39')]()[_0x4ab9('0x3a')]('phone')['from'](_0x4ab9('0x33'))[_0x4ab9('0x40')](_0x4a1089+_0x4ab9('0x42'),_0x869540['id']['toString']())))[_0x4ab9('0x3d')]();return _0x2ada02;};function _0x15fa61(_0x37aadc,_0x501337){var _0x5973f9=squel[_0x4ab9('0x31')]()[_0x4ab9('0x32')](_0x4ab9('0x33'))[_0x4ab9('0x34')](['phone',_0x4ab9('0x35'),_0x4ab9('0x36'),_0x4ab9('0x3c'),_0x501337,'createdAt',_0x4ab9('0x38')],squel[_0x4ab9('0x39')]()['field'](_0x4ab9('0x1f'),'phone')[_0x4ab9('0x3a')](_0x4ab9('0x3b'),_0x4ab9('0x35'))[_0x4ab9('0x3a')]('id',_0x4ab9('0x36'))[_0x4ab9('0x3a')](LISTID[_0x4ab9('0x3d')](),_0x4ab9('0x3c'))[_0x4ab9('0x3a')](_0x37aadc['id'][_0x4ab9('0x3d')](),_0x501337)[_0x4ab9('0x3a')]('NOW()',_0x4ab9('0x37'))[_0x4ab9('0x3a')]('NOW()','updatedAt')[_0x4ab9('0x3e')](_0x4ab9('0x3f'))[_0x4ab9('0x40')](_0x4ab9('0x41'))[_0x4ab9('0x40')](_0x4ab9('0x43'),LISTID['toString']())['where'](_0x4ab9('0x44'),squel[_0x4ab9('0x45')](hopperContacts))[_0x4ab9('0x40')](_0x4ab9('0x46')))[_0x4ab9('0x3d')]();return _0x5973f9;}function _0x15ebd1(_0x3229a8,_0x30a43f){var _0x31fc0f=squel['insert']()[_0x4ab9('0x32')]('cm_hopper_black')[_0x4ab9('0x34')](['phone',_0x4ab9('0x36'),_0x4ab9('0x3c'),_0x30a43f,_0x4ab9('0x37'),'updatedAt'],squel['select']()['field'](_0x4ab9('0x1f'),'phone')[_0x4ab9('0x3a')]('id',_0x4ab9('0x36'))['field'](LISTID['toString'](),_0x4ab9('0x3c'))['field'](_0x3229a8['id']['toString'](),_0x30a43f)[_0x4ab9('0x3a')](_0x4ab9('0x3b'),_0x4ab9('0x37'))['field'](_0x4ab9('0x3b'),_0x4ab9('0x38'))['from'](_0x4ab9('0x3f'))[_0x4ab9('0x40')](_0x4ab9('0x41'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x4ab9('0x40')](_0x4ab9('0x44'),squel[_0x4ab9('0x45')](hopperContacts))['where'](_0x4ab9('0x46')))[_0x4ab9('0x3d')]();return _0x31fc0f;}return db['VoiceQueue'][_0x4ab9('0x49')]({'where':{'type':_0x4ab9('0x4a')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x4ab9('0x4b')],'as':_0x4ab9('0x4c'),'where':{'id':LISTID}}]})[_0x4ab9('0x4d')](function(_0x5cedd6){var _0x2e8bd3=[];if(_0x5cedd6){var _0x3a467e;for(var _0x13ac4f=0x0,_0x4430e8;_0x13ac4f<_0x5cedd6[_0x4ab9('0x18')];_0x13ac4f+=0x1){_0x4430e8=_0x5cedd6[_0x13ac4f][_0x4ab9('0x4e')]({'plain':!![]});switch(_0x4430e8[_0x4ab9('0x4f')]){case'always':_0x2e8bd3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')]['query'](_0x122383(_0x4430e8,_0x4ab9('0x51')))[_0x4ab9('0x4d')](function(){})[_0x4ab9('0x2d')](_0x2f6557()));break;case _0x4ab9('0x52'):_0x2e8bd3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x10c064(_0x4430e8,'VoiceQueueId'))[_0x4ab9('0x4d')](function(){})[_0x4ab9('0x2d')](_0x2f6557()));break;default:_0x2e8bd3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x15fa61(_0x4430e8,_0x4ab9('0x51')))['then'](function(){})[_0x4ab9('0x2d')](_0x2f6557()));}}}return _0x2e8bd3;})[_0x4ab9('0x54')]()[_0x4ab9('0x4d')](function(){return db['VoiceQueue'][_0x4ab9('0x49')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x4ab9('0x4b')],'as':_0x4ab9('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x3b84fb){var _0x5863b6=[];if(_0x3b84fb){var _0x28053b;for(var _0x70594e=0x0,_0x33bb93;_0x70594e<_0x3b84fb[_0x4ab9('0x18')];_0x70594e+=0x1){_0x33bb93=_0x3b84fb[_0x70594e][_0x4ab9('0x4e')]({'plain':!![]});_0x5863b6['push'](db[_0x4ab9('0x50')]['query'](_0x15ebd1(_0x33bb93,_0x4ab9('0x51')))[_0x4ab9('0x4d')](function(){})[_0x4ab9('0x2d')](_0x2f6557()));}}return _0x5863b6;})[_0x4ab9('0x54')]();})[_0x4ab9('0x4d')](function(){return db[_0x4ab9('0x56')][_0x4ab9('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x4ab9('0x4d')](function(_0x5b9052){var _0x1a21a3=[];if(_0x5b9052){for(var _0x122368=0x0,_0x3397e0;_0x122368<_0x5b9052[_0x4ab9('0x18')];_0x122368+=0x1){_0x3397e0=_0x5b9052[_0x122368][_0x4ab9('0x4e')]({'plain':!![]});switch(_0x3397e0[_0x4ab9('0x4f')]){case'always':_0x1a21a3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x122383(_0x3397e0,'CampaignId'))[_0x4ab9('0x4d')](function(){})['catch'](_0x2f6557()));break;case _0x4ab9('0x52'):_0x1a21a3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x10c064(_0x3397e0,_0x4ab9('0x57')))[_0x4ab9('0x4d')](function(){})[_0x4ab9('0x2d')](_0x2f6557()));break;default:_0x1a21a3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x15fa61(_0x3397e0,'CampaignId'))['then'](function(){})[_0x4ab9('0x2d')](_0x2f6557()));}}}return _0x1a21a3;})[_0x4ab9('0x54')]();})[_0x4ab9('0x4d')](function(){return db[_0x4ab9('0x56')][_0x4ab9('0x49')]({'attributes':['id'],'include':[{'model':db[_0x4ab9('0x4b')],'as':_0x4ab9('0x55'),'where':{'id':LISTID}}]})[_0x4ab9('0x4d')](function(_0x5b40d4){var _0x386a1e=[];if(_0x5b40d4){for(var _0x5d0641=0x0,_0x161244;_0x5d0641<_0x5b40d4[_0x4ab9('0x18')];_0x5d0641+=0x1){_0x161244=_0x5b40d4[_0x5d0641]['get']({'plain':!![]});_0x386a1e[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x15ebd1(_0x161244,_0x4ab9('0x57')))['then'](function(){})['catch'](_0x2f6557()));}}return _0x386a1e;})['all']();})[_0x4ab9('0x2d')](function(_0x1f2240){logger[_0x4ab9('0x16')](_0x4ab9('0x58'),_0x4ab9('0x59'),_0x1f2240[_0x4ab9('0x1a')]);});}var processPromises=function(_0x385ada){return BPromise['all'](promises)[_0x4ab9('0x4d')](function(_0x48c158){})['catch'](function(_0x2ba901){logger[_0x4ab9('0x16')]('Error\x20processing\x20rows\x20block:',JSON[_0x4ab9('0x2f')](_0x2ba901));})[_0x4ab9('0x5a')](function(){socket[_0x4ab9('0x5b')](_0x4ab9('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385ada){return _0x385ada[_0x4ab9('0x5d')]();}});};var endCsv=function(){return BPromise[_0x4ab9('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x4ab9('0x4d')](function(){socket['emit'](_0x4ab9('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1fa5de){logger['error'](_0x4ab9('0x5f'),JSON[_0x4ab9('0x2f')](_0x1fa5de));}finally{process['exit'](0x0);}});};process['on'](_0x4ab9('0x60'),function(){logger[_0x4ab9('0x61')](_0x4ab9('0x62'));endCsv();});function main(){return BPromise[_0x4ab9('0x5e')]()[_0x4ab9('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4ab9('0x11')](',');return db[_0x4ab9('0x29')][_0x4ab9('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xcb4aec){var _0x35576e=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x35576e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2fbfb0,_0x1cb50b){total+=0x1;var _0x27be1a=total;promises[_0x4ab9('0x2b')](checkRow(_0x2fbfb0,_0xcb4aec,_0x27be1a)[_0x4ab9('0x4d')](function(){success+=0x1;})[_0x4ab9('0x2d')](function(_0x19eddb){if(_0x19eddb[_0x4ab9('0x16')]){errors+=0x1;delete _0x19eddb[_0x4ab9('0x16')];}else if(_0x19eddb[_0x4ab9('0x27')]){duplicates+=0x1;delete _0x19eddb[_0x4ab9('0x27')];}rows['push'](_0x19eddb);}));if(total%0xc8===0x0){_0x1cb50b[_0x4ab9('0x63')]();return processPromises(_0x1cb50b);}},'complete':function(){return processPromises()[_0x4ab9('0x4d')](function(){logger[_0x4ab9('0x61')](_0x4ab9('0x64'));endCsv();});},'error':function(_0x5ece1e,_0x36e628){logger['info'](_0x4ab9('0x65'),JSON[_0x4ab9('0x2f')](_0x5ece1e));endCsv();}});})[_0x4ab9('0x2d')](function(_0x37ff10){logger[_0x4ab9('0x16')](_0x4ab9('0x66'),JSON[_0x4ab9('0x2f')](_0x37ff10));});}main(); \ No newline at end of file +var _0x1607=['bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','index','isNil','errors','length','map','message','join','data','phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','into','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper','\x20=\x20?','updatedAt','cm_contacts','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','fromQuery','VoiceQueue','findAll','outbound','dialCheckDuplicateType','sequelize','query','VoiceQueueId','onlyIfOpen','all','CmList','get','Campaign','Lists','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:'];(function(_0x5ef9ed,_0x3861e2){var _0x4bb47a=function(_0x2d6a90){while(--_0x2d6a90){_0x5ef9ed['push'](_0x5ef9ed['shift']());}};_0x4bb47a(++_0x3861e2);}(_0x1607,0x12c));var _0x7160=function(_0x564ebb,_0x5d2ebd){_0x564ebb=_0x564ebb-0x0;var _0x45ffcf=_0x1607[_0x564ebb];return _0x45ffcf;};'use strict';var BPromise=require(_0x7160('0x0'));var util=require(_0x7160('0x1'));var _=require(_0x7160('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7160('0x3'));var Redis=require(_0x7160('0x4'));var db=require(_0x7160('0x5'))['db'];var config=require(_0x7160('0x6'));var logger=require(_0x7160('0x7'))('api');config[_0x7160('0x8')]=_[_0x7160('0x9')](config[_0x7160('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7160('0xa'))(new Redis(config['redis']));require(_0x7160('0xb'))[_0x7160('0xc')](socket);try{if(!process[_0x7160('0xd')][0x2]||process[_0x7160('0xd')][0x2]===_0x7160('0xe')||process[_0x7160('0xd')][0x2]===_0x7160('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x7160('0xd')][0x2];if(!process[_0x7160('0xd')][0x3]||process[_0x7160('0xd')][0x3]===_0x7160('0xe')||process['argv'][0x3]===_0x7160('0xf')||!process['argv'][0x4]||process[_0x7160('0xd')][0x4]===_0x7160('0xe')||process[_0x7160('0xd')][0x4]==='null'){throw new Error(_0x7160('0x10'));}var FIELDS=_[_0x7160('0x11')](process[_0x7160('0xd')][0x3]['split'](','),process[_0x7160('0xd')][0x4][_0x7160('0x12')](','));if(!process[_0x7160('0xd')][0x5]||process['argv'][0x5]===_0x7160('0xe')||process[_0x7160('0xd')][0x5]===_0x7160('0xf')){throw new Error(_0x7160('0x13'));}var LISTID=process[_0x7160('0xd')][0x5];var COMPANYID=process[_0x7160('0xd')][0x6]&&process['argv'][0x6]!==_0x7160('0xe')&&process[_0x7160('0xd')][0x6]!==_0x7160('0xf')?process[_0x7160('0xd')][0x6]:null;var DUPLICATES=process[_0x7160('0xd')][0x7]&&process[_0x7160('0xd')][0x7]!==_0x7160('0xe')&&process[_0x7160('0xd')][0x7]!=='null'?process[_0x7160('0xd')][0x7]:null;if(!process[_0x7160('0xd')][0x8]||process[_0x7160('0xd')][0x8]===_0x7160('0xe')||process[_0x7160('0xd')][0x8]===_0x7160('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7160('0xd')][0x8];}catch(_0x506e53){logger[_0x7160('0x14')](_0x506e53);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(_0x23823e,_0x133025,_0x145241,_0x18eb22){var _0x29a129={'message':_0x133025};_0x29a129[_0x23823e]=!![];if(_0x145241){_0x29a129['contact']=_0x145241;}if(_0x18eb22){_0x29a129[_0x7160('0x15')]=_0x18eb22;}return _0x29a129;}function isEmail(_0x20090f){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'](_0x20090f);}function checkRow(_0x2f6432,_0x2b47a0,_0x166d5c){return new BPromise(function(_0x162aa5,_0x25f9bb){if(_[_0x7160('0x16')](_0x2f6432)){return _0x25f9bb(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x166d5c));}if(_0x2f6432[_0x7160('0x17')]&&_0x2f6432[_0x7160('0x17')][_0x7160('0x18')]){var _0x4e0898=_[_0x7160('0x19')](_0x2f6432[_0x7160('0x17')],_0x7160('0x1a'))[_0x7160('0x1b')](';');return _0x25f9bb(handleCheckRowError(_0x7160('0x14'),_0x4e0898,null,_0x166d5c));}var _0x1dee5c={};for(var _0x4bbde5 in FIELDS){if(FIELDS['hasOwnProperty'](_0x4bbde5)&&FIELDS[_0x4bbde5]){_0x1dee5c[_0x4bbde5]=_0x2f6432[_0x7160('0x1c')][0x0][FIELDS[_0x4bbde5]]||_0x2f6432[_0x7160('0x1c')][0x0]['\ufeff'+FIELDS[_0x4bbde5]];}}if(!_0x1dee5c['firstName']){return _0x25f9bb(handleCheckRowError(_0x7160('0x14'),'firstName\x20not\x20specified!',null,_0x166d5c));}if(!_0x1dee5c[_0x7160('0x1d')]){return _0x25f9bb(handleCheckRowError(_0x7160('0x14'),_0x7160('0x1e'),null,_0x166d5c));}if(_0x1dee5c[_0x7160('0x1f')]){var _0x3f9992=moment(_0x1dee5c[_0x7160('0x1f')],'YYYY-MM-DD');if(!_0x3f9992['isValid']()){return _0x25f9bb(handleCheckRowError('error',_0x7160('0x20'),null,_0x166d5c));}}if(_0x1dee5c[_0x7160('0x21')]){if(!isEmail(_0x1dee5c[_0x7160('0x21')])){return _0x25f9bb(handleCheckRowError(_0x7160('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x166d5c));}}_0x1dee5c[_0x7160('0x22')]=LISTID;_0x1dee5c[_0x7160('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7160('0x18')]&&_0x2b47a0){var _0x3aa9e4={};for(var _0xf0258b=0x0,_0x5069d0=DUPLICATES['length'];_0xf0258b<_0x5069d0;_0xf0258b+=0x1){_0x3aa9e4[DUPLICATES[_0xf0258b]]=_0x1dee5c[DUPLICATES[_0xf0258b]];}var _0x2d214f=_[_0x7160('0x24')](_0x2b47a0,_0x3aa9e4);if(_0x2d214f){return _0x25f9bb(handleCheckRowError(_0x7160('0x25'),_0x7160('0x26'),_0x2d214f,_0x166d5c));}}return db[_0x7160('0x27')][_0x7160('0x28')](_0x1dee5c,{'raw':!![],'hooks':![],'fields':_['keys'](_0x1dee5c)})[_0x7160('0x29')](function(_0x40ae82){if(DUPLICATES&&DUPLICATES[_0x7160('0x18')]&&_0x2b47a0){_0x2b47a0[_0x7160('0x2a')](_[_0x7160('0x2b')](_0x1dee5c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x40ae82['id'];return _0x162aa5();})[_0x7160('0x2c')](function(_0x3fa375){return _0x25f9bb(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x3fa375[_0x7160('0x1a')]||JSON[_0x7160('0x2d')](_0x3fa375)),null,_0x166d5c));});});}function checkHopper(){function _0x5795ac(){return function(_0x2478ed){logger['error'](_0x7160('0x2e'),_0x7160('0x2f'),util[_0x7160('0x30')](_0x2478ed,{'showHidden':![],'depth':null}));};}var _0x197420=function(_0x486a53,_0x8d0ca1){var _0x4be833=squel[_0x7160('0x31')]()[_0x7160('0x32')]('cm_hopper')['fromQuery']([_0x7160('0x1d'),_0x7160('0x33'),_0x7160('0x34'),'ListId',_0x8d0ca1,_0x7160('0x35'),'updatedAt'],squel[_0x7160('0x36')]()[_0x7160('0x37')](_0x7160('0x1d'),_0x7160('0x1d'))[_0x7160('0x37')](_0x7160('0x38'),'scheduledAt')[_0x7160('0x37')]('id',_0x7160('0x34'))['field'](LISTID[_0x7160('0x39')](),_0x7160('0x22'))[_0x7160('0x37')](_0x486a53['id'][_0x7160('0x39')](),_0x8d0ca1)['field'](_0x7160('0x38'),_0x7160('0x35'))[_0x7160('0x37')](_0x7160('0x38'),'updatedAt')[_0x7160('0x3a')]('cm_contacts')[_0x7160('0x3b')](_0x7160('0x3c'))[_0x7160('0x3b')]('ListId\x20=\x20?',LISTID[_0x7160('0x39')]())[_0x7160('0x3b')](_0x7160('0x3d'))[_0x7160('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x7160('0x1d'))['from'](_0x7160('0x3e'))[_0x7160('0x3b')](_0x8d0ca1+_0x7160('0x3f'),_0x486a53['id'][_0x7160('0x39')]())))[_0x7160('0x39')]();return _0x4be833;};var _0x393c28=function(_0x3fde81,_0x2b198d){var _0x5620ce=squel[_0x7160('0x31')]()['into'](_0x7160('0x3e'))['fromQuery']([_0x7160('0x1d'),_0x7160('0x33'),_0x7160('0x34'),'ListId',_0x2b198d,_0x7160('0x35'),_0x7160('0x40')],squel[_0x7160('0x36')]()['field'](_0x7160('0x1d'),_0x7160('0x1d'))['field'](_0x7160('0x38'),_0x7160('0x33'))[_0x7160('0x37')]('id','ContactId')[_0x7160('0x37')](LISTID[_0x7160('0x39')](),'ListId')['field'](_0x3fde81['id'][_0x7160('0x39')](),_0x2b198d)[_0x7160('0x37')](_0x7160('0x38'),_0x7160('0x35'))[_0x7160('0x37')](_0x7160('0x38'),_0x7160('0x40'))['from'](_0x7160('0x41'))[_0x7160('0x3b')](_0x7160('0x3c'))[_0x7160('0x3b')]('ListId\x20=\x20?',LISTID['toString']())[_0x7160('0x3b')](_0x7160('0x42'),squel[_0x7160('0x43')](hopperContacts))[_0x7160('0x3b')](_0x7160('0x3d'))[_0x7160('0x3b')](_0x7160('0x44'),squel[_0x7160('0x36')]()[_0x7160('0x37')]('calleridnum')[_0x7160('0x3a')](_0x7160('0x45'))[_0x7160('0x3b')](_0x2b198d+_0x7160('0x3f'),_0x3fde81['id'][_0x7160('0x39')]()))[_0x7160('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7160('0x36')]()[_0x7160('0x37')]('phone')[_0x7160('0x3a')]('cm_hopper')[_0x7160('0x3b')](_0x2b198d+_0x7160('0x3f'),_0x3fde81['id'][_0x7160('0x39')]())))[_0x7160('0x39')]();return _0x5620ce;};function _0x539f57(_0x2ff67e,_0x2ec640){var _0x403951=squel[_0x7160('0x31')]()[_0x7160('0x32')](_0x7160('0x3e'))[_0x7160('0x46')]([_0x7160('0x1d'),_0x7160('0x33'),_0x7160('0x34'),_0x7160('0x22'),_0x2ec640,_0x7160('0x35'),_0x7160('0x40')],squel[_0x7160('0x36')]()[_0x7160('0x37')](_0x7160('0x1d'),'phone')[_0x7160('0x37')]('NOW()',_0x7160('0x33'))['field']('id',_0x7160('0x34'))[_0x7160('0x37')](LISTID[_0x7160('0x39')](),_0x7160('0x22'))[_0x7160('0x37')](_0x2ff67e['id'][_0x7160('0x39')](),_0x2ec640)['field'](_0x7160('0x38'),'createdAt')[_0x7160('0x37')](_0x7160('0x38'),_0x7160('0x40'))[_0x7160('0x3a')](_0x7160('0x41'))[_0x7160('0x3b')](_0x7160('0x3c'))[_0x7160('0x3b')]('ListId\x20=\x20?',LISTID[_0x7160('0x39')]())[_0x7160('0x3b')]('id\x20IN\x20?',squel[_0x7160('0x43')](hopperContacts))['where'](_0x7160('0x3d')))[_0x7160('0x39')]();return _0x403951;}function _0x3311b0(_0x146e55,_0x4a6a50){var _0x1718af=squel[_0x7160('0x31')]()[_0x7160('0x32')]('cm_hopper_black')[_0x7160('0x46')](['phone',_0x7160('0x34'),'ListId',_0x4a6a50,_0x7160('0x35'),_0x7160('0x40')],squel['select']()['field'](_0x7160('0x1d'),_0x7160('0x1d'))['field']('id','ContactId')[_0x7160('0x37')](LISTID[_0x7160('0x39')](),'ListId')[_0x7160('0x37')](_0x146e55['id']['toString'](),_0x4a6a50)[_0x7160('0x37')](_0x7160('0x38'),_0x7160('0x35'))['field'](_0x7160('0x38'),_0x7160('0x40'))[_0x7160('0x3a')]('cm_contacts')[_0x7160('0x3b')]('deletedAt\x20IS\x20NULL')[_0x7160('0x3b')]('ListId\x20=\x20?',LISTID[_0x7160('0x39')]())[_0x7160('0x3b')](_0x7160('0x42'),squel[_0x7160('0x43')](hopperContacts))[_0x7160('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7160('0x39')]();return _0x1718af;}return db[_0x7160('0x47')][_0x7160('0x48')]({'where':{'type':_0x7160('0x49')},'attributes':['id',_0x7160('0x4a')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x7160('0x29')](function(_0x335d47){var _0x7a7f6=[];if(_0x335d47){var _0x13b1f9;for(var _0x1467f7=0x0,_0x21ae34;_0x1467f7<_0x335d47['length'];_0x1467f7+=0x1){_0x21ae34=_0x335d47[_0x1467f7]['get']({'plain':!![]});switch(_0x21ae34[_0x7160('0x4a')]){case'always':_0x7a7f6['push'](db[_0x7160('0x4b')][_0x7160('0x4c')](_0x393c28(_0x21ae34,_0x7160('0x4d')))[_0x7160('0x29')](function(){})[_0x7160('0x2c')](_0x5795ac()));break;case _0x7160('0x4e'):_0x7a7f6[_0x7160('0x2a')](db['sequelize'][_0x7160('0x4c')](_0x197420(_0x21ae34,_0x7160('0x4d')))[_0x7160('0x29')](function(){})[_0x7160('0x2c')](_0x5795ac()));break;default:_0x7a7f6[_0x7160('0x2a')](db[_0x7160('0x4b')][_0x7160('0x4c')](_0x539f57(_0x21ae34,_0x7160('0x4d')))[_0x7160('0x29')](function(){})[_0x7160('0x2c')](_0x5795ac()));}}}return _0x7a7f6;})[_0x7160('0x4f')]()['then'](function(){return db[_0x7160('0x47')][_0x7160('0x48')]({'where':{'type':_0x7160('0x49')},'attributes':['id'],'include':[{'model':db[_0x7160('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x7160('0x29')](function(_0x54d604){var _0x33d838=[];if(_0x54d604){var _0x44c3f1;for(var _0x5cc515=0x0,_0x2e79c6;_0x5cc515<_0x54d604[_0x7160('0x18')];_0x5cc515+=0x1){_0x2e79c6=_0x54d604[_0x5cc515][_0x7160('0x51')]({'plain':!![]});_0x33d838[_0x7160('0x2a')](db[_0x7160('0x4b')][_0x7160('0x4c')](_0x3311b0(_0x2e79c6,'VoiceQueueId'))[_0x7160('0x29')](function(){})[_0x7160('0x2c')](_0x5795ac()));}}return _0x33d838;})[_0x7160('0x4f')]();})['then'](function(){return db[_0x7160('0x52')][_0x7160('0x48')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7160('0x50')],'as':_0x7160('0x53'),'where':{'id':LISTID}}]})['then'](function(_0x1c5137){var _0xa1e006=[];if(_0x1c5137){for(var _0x511075=0x0,_0x3a0b45;_0x511075<_0x1c5137[_0x7160('0x18')];_0x511075+=0x1){_0x3a0b45=_0x1c5137[_0x511075][_0x7160('0x51')]({'plain':!![]});switch(_0x3a0b45[_0x7160('0x4a')]){case _0x7160('0x54'):_0xa1e006[_0x7160('0x2a')](db['sequelize'][_0x7160('0x4c')](_0x393c28(_0x3a0b45,_0x7160('0x55')))['then'](function(){})[_0x7160('0x2c')](_0x5795ac()));break;case _0x7160('0x4e'):_0xa1e006[_0x7160('0x2a')](db[_0x7160('0x4b')]['query'](_0x197420(_0x3a0b45,_0x7160('0x55')))[_0x7160('0x29')](function(){})[_0x7160('0x2c')](_0x5795ac()));break;default:_0xa1e006['push'](db['sequelize'][_0x7160('0x4c')](_0x539f57(_0x3a0b45,_0x7160('0x55')))[_0x7160('0x29')](function(){})[_0x7160('0x2c')](_0x5795ac()));}}}return _0xa1e006;})[_0x7160('0x4f')]();})[_0x7160('0x29')](function(){return db[_0x7160('0x52')][_0x7160('0x48')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7160('0x56'),'where':{'id':LISTID}}]})[_0x7160('0x29')](function(_0x473ee5){var _0x28896d=[];if(_0x473ee5){for(var _0x8a249b=0x0,_0x2d2970;_0x8a249b<_0x473ee5[_0x7160('0x18')];_0x8a249b+=0x1){_0x2d2970=_0x473ee5[_0x8a249b][_0x7160('0x51')]({'plain':!![]});_0x28896d[_0x7160('0x2a')](db[_0x7160('0x4b')][_0x7160('0x4c')](_0x3311b0(_0x2d2970,_0x7160('0x55')))[_0x7160('0x29')](function(){})[_0x7160('0x2c')](_0x5795ac()));}}return _0x28896d;})[_0x7160('0x4f')]();})[_0x7160('0x2c')](function(_0x4bcabd){logger['error'](_0x7160('0x57'),_0x7160('0x58'),_0x4bcabd['message']);});}var processPromises=function(_0x46ac06){return BPromise[_0x7160('0x4f')](promises)[_0x7160('0x29')](function(_0x4de2d0){})['catch'](function(_0x1cc75c){logger[_0x7160('0x14')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x1cc75c));})[_0x7160('0x59')](function(){socket[_0x7160('0x5a')](_0x7160('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x46ac06){return _0x46ac06[_0x7160('0x5c')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7160('0x29')](function(){socket[_0x7160('0x5a')](_0x7160('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x401372){logger[_0x7160('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x7160('0x2d')](_0x401372));}finally{process[_0x7160('0x5d')](0x0);}});};process['on'](_0x7160('0x5e'),function(){logger[_0x7160('0x5f')](_0x7160('0x60'));endCsv();});function main(){return BPromise['resolve']()[_0x7160('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7160('0x12')](',');return db[_0x7160('0x27')][_0x7160('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7160('0x29')](function(_0x42375d){var _0x46efd4=fs[_0x7160('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x46efd4,{'header':!![],'skipEmptyLines':!![],'step':function(_0x130f10,_0x289c29){total+=0x1;var _0x4dfb19=total;promises[_0x7160('0x2a')](checkRow(_0x130f10,_0x42375d,_0x4dfb19)[_0x7160('0x29')](function(){success+=0x1;})[_0x7160('0x2c')](function(_0x20624d){if(_0x20624d['error']){errors+=0x1;delete _0x20624d[_0x7160('0x14')];}else if(_0x20624d[_0x7160('0x25')]){duplicates+=0x1;delete _0x20624d[_0x7160('0x25')];}rows[_0x7160('0x2a')](_0x20624d);}));if(total%0xc8===0x0){_0x289c29['pause']();return processPromises(_0x289c29);}},'complete':function(){return processPromises()[_0x7160('0x29')](function(){logger[_0x7160('0x5f')](_0x7160('0x62'));endCsv();});},'error':function(_0x2ce7bd,_0x134f24){logger[_0x7160('0x5f')]('CSV\x20parse\x20error',JSON[_0x7160('0x2d')](_0x2ce7bd));endCsv();}});})[_0x7160('0x2c')](function(_0x68d42e){logger['error'](_0x7160('0x63'),JSON[_0x7160('0x2d')](_0x68d42e));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index c143576..1872577 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 _0xa47f=['cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','select','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','errors','push','message','query','spread','catch','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','isValid','UserId','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','SystemError','step','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil','scheduledat',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','emit','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','priority','fields'];(function(_0x2401c8,_0x523747){var _0x2106dc=function(_0x1fbc55){while(--_0x1fbc55){_0x2401c8['push'](_0x2401c8['shift']());}};_0x2106dc(++_0x523747);}(_0xa47f,0x1f3));var _0xfa47=function(_0x2b0ac5,_0x56bb92){_0x2b0ac5=_0x2b0ac5-0x0;var _0x2612e0=_0xa47f[_0x2b0ac5];return _0x2612e0;};'use strict';var fs=require('fs');var path=require(_0xfa47('0x0'));var _=require(_0xfa47('0x1'));var Papa=require(_0xfa47('0x2'));var util=require(_0xfa47('0x3'));var BPromise=require(_0xfa47('0x4'));var moment=require(_0xfa47('0x5'));var squel=require(_0xfa47('0x6'));var Redis=require('ioredis');var db=require(_0xfa47('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xfa47('0x8'));config[_0xfa47('0x9')]=_[_0xfa47('0xa')](config[_0xfa47('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa47('0xb'))(new Redis(config[_0xfa47('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xfa47('0xc')](_0xfa47('0xd'));function isEmail(_0x4991c6){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))*$/[_0xfa47('0xe')](_0x4991c6);}function selectNotIn(_0x317bfd,_0x23a560,_0x4d019b,_0xa862e,_0x2bfa79){return squel['select']()[_0xfa47('0xf')]('phone')[_0xfa47('0x10')](_0xa862e)[_0xfa47('0x11')](_0x23a560,null,_0x23a560+_0xfa47('0x12')+_0xa862e+'.'+_0x4d019b)[_0xfa47('0x13')](_0xa862e+'.'+_0x4d019b+_0xfa47('0x14')+_0x317bfd+'.'+_0x4d019b)[_0xfa47('0x13')](_0x23a560+'.dialCheckDuplicateType\x20IN\x20('+_0x2bfa79[_0xfa47('0x11')]()+')');}function insertCmHopper(_0x5128bb,_0x4f8537,_0x26176b,_0x4fb3a6,_0x566d72){var _0xcb3500=[_0xfa47('0x15'),_0xfa47('0x16'),_0xfa47('0x17'),_0xfa47('0x18'),_0x4f8537+'.'+_0x4fb3a6,'cm_contacts.createdAt',_0xfa47('0x19'),_0xfa47('0x1a'),'cm_contacts.UserId','\x22'+_0x566d72+'\x22'];return squel[_0xfa47('0x1b')]()[_0xfa47('0x1c')]('cm_hopper')[_0xfa47('0x1d')]([_0xfa47('0x1e'),'scheduledat',_0xfa47('0x1f'),_0xfa47('0x20'),_0x4fb3a6,_0xfa47('0x21'),_0xfa47('0x22'),_0xfa47('0x23'),'UserId','recallme'],squel['select']()[_0xfa47('0x24')](_0xcb3500)[_0xfa47('0x10')](_0x4f8537)['join'](_0xfa47('0x25'),null,_0xfa47('0x26')+_0x4f8537+_0xfa47('0x27'))['join'](_0x26176b,null,_0x26176b+_0xfa47('0x12')+_0x4f8537+'.'+_0x4fb3a6)['where'](_0x4f8537+'.CmListId\x20=\x20?',_0x5128bb)['where'](_0xfa47('0x28'),NOW)[_0xfa47('0x13')](_0xfa47('0x29'),selectNotIn(_0x4f8537,_0x26176b,_0x4fb3a6,_0xfa47('0x2a'),[_0xfa47('0x2b'),_0xfa47('0x2c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f8537,_0x26176b,_0x4fb3a6,_0xfa47('0x2a'),['\x22always\x22'])))[_0xfa47('0x2d')]();}function insertCmHopperBlack(_0x17eca3,_0x3d8c6c,_0x5f2137,_0x5dc68e){var _0x32bd4a=['cm_contacts.phone',_0xfa47('0x17'),_0xfa47('0x18'),_0x3d8c6c+'.'+_0x5dc68e,_0xfa47('0x2e'),_0xfa47('0x19')];return squel[_0xfa47('0x1b')]()['into'](_0xfa47('0x2f'))[_0xfa47('0x1d')]([_0xfa47('0x1e'),_0xfa47('0x1f'),_0xfa47('0x20'),_0x5dc68e,_0xfa47('0x21'),_0xfa47('0x22')],squel[_0xfa47('0x30')]()[_0xfa47('0x24')](_0x32bd4a)[_0xfa47('0x10')](_0x3d8c6c)[_0xfa47('0x11')](_0xfa47('0x25'),null,_0xfa47('0x26')+_0x3d8c6c+'.CmListId')[_0xfa47('0x11')](_0x5f2137,null,_0x5f2137+_0xfa47('0x12')+_0x3d8c6c+'.'+_0x5dc68e)[_0xfa47('0x13')](_0x3d8c6c+'.CmListId\x20=\x20?',_0x17eca3)[_0xfa47('0x13')](_0xfa47('0x28'),NOW)[_0xfa47('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xfa47('0x30')]()[_0xfa47('0xf')](_0xfa47('0x1e'))['from'](_0xfa47('0x2f'))[_0xfa47('0x13')](_0xfa47('0x31'),_0x17eca3)['where'](_0x5dc68e+_0xfa47('0x32'),_0x3d8c6c+'.'+_0x5dc68e)))['toString']();}function insertCmContact(_0x3dcdcc,_0x5da66a,_0x2409b4,_0x2297b2){var _0x2fdcdd=_[_0xfa47('0x33')](_[_0xfa47('0x34')](_0x2297b2),[_0xfa47('0x20'),_0xfa47('0x35'),'createdAt',_0xfa47('0x22')]);return squel[_0xfa47('0x1b')]()[_0xfa47('0x1c')]('cm_contacts')[_0xfa47('0x1d')](_0x2fdcdd,squel[_0xfa47('0x30')]()['fields'](_0x2fdcdd)[_0xfa47('0x10')](_0x5da66a)[_0xfa47('0x13')]('('+_0x2409b4[_0xfa47('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0xfa47('0x30')]()[_0xfa47('0x24')](_0x2409b4)[_0xfa47('0x10')](_0xfa47('0x25'))['where']('ListId\x20=\x20?',_0x3dcdcc)['where'](_0xfa47('0x36')))[_0xfa47('0x13')](_0xfa47('0x37'),squel[_0xfa47('0x30')]()[_0xfa47('0xf')](_0xfa47('0x38'),_0xfa47('0x39'))[_0xfa47('0x10')](_0x5da66a)[_0xfa47('0x3a')](_0x2409b4['join'](','))))[_0xfa47('0x2d')]();}function handleStop(){logger[_0xfa47('0x3b')](_0xfa47('0x3c'));stopped=!![];}function handleUncaughtException(_0x12958c){logger[_0xfa47('0x3d')](_0x12958c['message']);process['exit'](0x1);}function handleError(_0x23bbb6,_0x517c69){stats[_0xfa47('0x3e')][_0xfa47('0x3f')]({'name':_0x517c69['code'],'message':_0x517c69[_0xfa47('0x40')],'row':_0x23bbb6});}function handleQuery(_0xa8d64){logger[_0xfa47('0x3b')](_0xa8d64);return db['sequelize'][_0xfa47('0x41')](_0xa8d64)[_0xfa47('0x42')](function(_0xf193fd){results[_0xfa47('0x3f')](_0xf193fd);})[_0xfa47('0x43')](function(_0x18c450){logger['error'](_0x18c450['message']);});}function main(_0x56857b,_0x4c2f3a,_0x1a86af,_0x1c1fb8){logger[_0xfa47('0x3b')]('main',_0x56857b,JSON[_0xfa47('0x44')](_0x4c2f3a));process['send'](_0xfa47('0x45'));var _0x4db1e0=_0x4c2f3a[_0xfa47('0x46')];var _0x3f9e7d=_0x4c2f3a[_0xfa47('0x47')];var _0x191250=path[_0xfa47('0x11')](config[_0xfa47('0x48')],_0xfa47('0x49'),_0x3f9e7d+_0xfa47('0x4a'));var _0x4ed5da=_[_0xfa47('0x34')](_0x4db1e0)[_0xfa47('0x11')]();logger[_0xfa47('0x3b')](_0xfa47('0x4b'),_0x4ed5da);fs['writeFileSync'](_0x191250,_0x4ed5da+'\x0a');Papa[_0xfa47('0x4c')](fs[_0xfa47('0x4d')](_0x56857b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x21fe8f,_0x4624c4){try{for(var _0x8ecf92=0x0,_0x253632=[];_0x8ecf92<_0x21fe8f[_0xfa47('0x4e')][_0xfa47('0x4f')];_0x8ecf92++){stats[_0xfa47('0x50')]+=0x1;if(_0x21fe8f[_0xfa47('0x3e')][_0x8ecf92]){handleError(_0x21fe8f['data'][_0x8ecf92],_0x21fe8f[_0xfa47('0x3e')][_0x8ecf92]);}else{var _0x5d7a1d=[];for(var _0x4ecdee in _0x4db1e0){if(_0x4db1e0[_0xfa47('0x51')](_0x4ecdee)){if(_0x21fe8f[_0xfa47('0x4e')][_0x8ecf92][_0x4db1e0[_0x4ecdee]]){var _0x5a6b2f=_[_0xfa47('0x52')](_0x21fe8f['data'][_0x8ecf92][_0x4db1e0[_0x4ecdee]][_0xfa47('0x53')](/"/g,'\x27'));switch(_0x4ecdee){case'scheduledat':var _0x446c08=moment(_0x5a6b2f,_0xfa47('0xd'),!![]);if(_0x446c08[_0xfa47('0x54')]()){_0x253632[_0xfa47('0x3f')]('\x22'+_0x5a6b2f+'\x22');}else{_0x5d7a1d[_0xfa47('0x3f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xfa47('0x23'):var _0x498728=parseInt(_0x5a6b2f);_0x5a6b2f=_['isNaN'](_0x498728)||_0x498728<0x0||_0x498728>0x4?_0x1c1fb8?0x3:0x2:_0x498728;_0x253632['push']('\x22'+_0x5a6b2f+'\x22');break;case _0xfa47('0x55'):var _0xe9d8a8=parseInt(_0x5a6b2f);if(_['isNumber'](_0xe9d8a8)&&_[_0xfa47('0x56')](_0x1a86af,_0xe9d8a8)){_0x253632[_0xfa47('0x3f')]('\x22'+_0xe9d8a8+'\x22');}else{_0x5d7a1d[_0xfa47('0x3f')]('agent\x20not\x20exists');}break;case _0xfa47('0x57'):if(isEmail(_0x5a6b2f)){_0x253632['push']('\x22'+_0x5a6b2f+'\x22');}else{_0x5d7a1d['push'](_0xfa47('0x58'));}break;case _0xfa47('0x59'):var _0x19ff8b=moment(_0x5a6b2f,_0xfa47('0x5a'),!![]);if(_0x19ff8b[_0xfa47('0x54')]()){_0x253632[_0xfa47('0x3f')]('\x22'+_0x5a6b2f+'\x22');}else{_0x5d7a1d[_0xfa47('0x3f')](_0xfa47('0x5b'));}break;default:_0x253632['push']('\x22'+_0x5a6b2f+'\x22');}}else{switch(_0x4ecdee){case _0xfa47('0x5c'):case _0xfa47('0x1e'):_0x5d7a1d[_0xfa47('0x3f')](_0x4ecdee+_0xfa47('0x5d'));break;default:_0x253632['push']('\x22\x22');}}}}if(_0x5d7a1d[_0xfa47('0x4f')]){handleError(_0x21fe8f[_0xfa47('0x4e')][_0x8ecf92],{'code':_0xfa47('0x5e'),'message':_0x5d7a1d[_0xfa47('0x11')]()});}else{fs[_0xfa47('0x5f')](_0x191250,_0x253632['join']()+'\x0a');}_0x253632=[];}if(!(stats[_0xfa47('0x50')]%0xc8)){socket['emit'](_0xfa47('0x60')+_0x3f9e7d,stats);stats[_0xfa47('0x3e')]=[];}}if(stopped){logger[_0xfa47('0x3b')](_0xfa47('0x61'));_0x4624c4['abort']();}}catch(_0x4cd551){handleError(_0x21fe8f[_0xfa47('0x4e')][_0x8ecf92],{'code':_0xfa47('0x62'),'message':_0x4cd551['message']});logger[_0xfa47('0x3d')](_0xfa47('0x63'),_0x4cd551[_0xfa47('0x40')]);}},'complete':function(){try{var _0x18ac6d=[];var _0x488d52=_0xfa47('0x25');if(_0x4c2f3a['duplicates']&&_0x4c2f3a['duplicates'][_0xfa47('0x4f')]){_0x488d52=_0xfa47('0x64')+_0x3f9e7d;_0x18ac6d[_0xfa47('0x3f')](_0xfa47('0x65')+_0x488d52+_0xfa47('0x66'));}var _0x562a16=util[_0xfa47('0xc')]('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',_0x191250,_0x488d52,_0x4ed5da,_0x4c2f3a['ListId'],_0x4c2f3a[_0xfa47('0x35')]||null,NOW,NOW);if(_[_0xfa47('0x67')](_0x4db1e0[_0xfa47('0x68')])){_0x562a16+=_0xfa47('0x69');}_0x18ac6d['push'](_0x562a16);if(_0x4c2f3a[_0xfa47('0x6a')]&&_0x4c2f3a[_0xfa47('0x6a')][_0xfa47('0x4f')]){_0x18ac6d[_0xfa47('0x3f')](insertCmContact(_0x4c2f3a[_0xfa47('0x20')],_0x488d52,_0x4c2f3a[_0xfa47('0x6a')],_0x4db1e0));_0x18ac6d[_0xfa47('0x3f')](_0xfa47('0x6b')+_0x488d52+';');}_0x18ac6d['push'](insertCmHopper(_0x4c2f3a[_0xfa47('0x20')],_0xfa47('0x6c'),_0xfa47('0x6d'),'VoiceQueueId',_0x1c1fb8));_0x18ac6d[_0xfa47('0x3f')](insertCmHopperBlack(_0x4c2f3a[_0xfa47('0x20')],_0xfa47('0x6e'),_0xfa47('0x6d'),_0xfa47('0x6f')));_0x18ac6d[_0xfa47('0x3f')](insertCmHopper(_0x4c2f3a[_0xfa47('0x20')],_0xfa47('0x70'),_0xfa47('0x71'),_0xfa47('0x72'),_0x1c1fb8));_0x18ac6d['push'](insertCmHopperBlack(_0x4c2f3a['ListId'],_0xfa47('0x73'),_0xfa47('0x71'),_0xfa47('0x72')));BPromise[_0xfa47('0x74')](_0x18ac6d,handleQuery)[_0xfa47('0x75')](function(_0x14fd71){stats[_0xfa47('0x76')]=!![];stats[_0xfa47('0x77')]=_0x4c2f3a[_0xfa47('0x6a')]&&_0x4c2f3a[_0xfa47('0x6a')][_0xfa47('0x4f')]?results[0x2][_0xfa47('0x77')]:results[0x0][_0xfa47('0x77')];socket[_0xfa47('0x78')](_0xfa47('0x60')+_0x3f9e7d,stats);fs['unlink'](_0x56857b);fs[_0xfa47('0x79')](_0x191250);process[_0xfa47('0x7a')](0x0);})[_0xfa47('0x43')](function(_0x26d291){logger[_0xfa47('0x3d')](_0x26d291['message']);process['exit'](0x1);});}catch(_0x547b63){logger[_0xfa47('0x3d')](_0xfa47('0x7b'),_0x547b63['message']);process[_0xfa47('0x7a')](0x1);}},'error':function(_0x1c13cd,_0x4c5eda,_0x20a752,_0xe6ff3a){throw new Error(_0xe6ff3a);}});}function validate(){if(process['argv']&&process[_0xfa47('0x7c')][_0xfa47('0x4f')]<0x4){throw new Error(_0xfa47('0x7d'));}var _0x5c28da=path[_0xfa47('0x11')](config[_0xfa47('0x48')],_0xfa47('0x49'),process[_0xfa47('0x7c')][0x2]);if(!fs['existsSync'](_0x5c28da)){throw new Error(_0xfa47('0x7e'));}var _0x1b9359={};try{_0x1b9359=JSON[_0xfa47('0x4c')](process[_0xfa47('0x7c')][0x3]);if(!_0x1b9359['binding']){throw new Error(_0xfa47('0x7f'));}if(!_0x1b9359['binding']['phone']){throw new Error(_0xfa47('0x80'));}if(!_0x1b9359[_0xfa47('0x46')][_0xfa47('0x5c')]){throw new Error(_0xfa47('0x81'));}var _0x1c88ff=0x0;if(_0x1b9359[_0xfa47('0x46')][_0xfa47('0x55')]){_0x1c88ff=0x1;}if(!_0x1b9359['ListId']){throw new Error(_0xfa47('0x82'));}}catch(_0x187e7d){throw new Error(_0xfa47('0x83'));}var _0x13d7ea=[];try{_0x13d7ea=_['map'](JSON[_0xfa47('0x4c')](process[_0xfa47('0x7c')][0x4]),'id');}catch(_0x241952){logger[_0xfa47('0x3b')](_0xfa47('0x84'));}main(_0x5c28da,_0x1b9359,_0x13d7ea,_0x1c88ff);}validate();process['on']('SIGINT',handleStop);process['on'](_0xfa47('0x85'),handleUncaughtException); \ No newline at end of file +var _0x76a0=['select','field','phone','join','.id\x20=\x20','\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','from','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','errors','push','code','message','query','catch','error','stringify','socket_timestamp','root','server/files/tmp','.csv','header','createReadStream','rows','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','ListId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','contact:import:','unlink','exit','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','test'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76a0,0xf4));var _0x076a=function(_0x28353f,_0x5b5ae2){_0x28353f=_0x28353f-0x0;var _0x6efccb=_0x76a0[_0x28353f];return _0x6efccb;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x076a('0x0'));var Papa=require(_0x076a('0x1'));var util=require(_0x076a('0x2'));var BPromise=require(_0x076a('0x3'));var moment=require(_0x076a('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x076a('0x5'))['db'];var config=require(_0x076a('0x6'));var logger=require(_0x076a('0x7'))('import');config[_0x076a('0x8')]=_[_0x076a('0x9')](config[_0x076a('0x8')],{'host':_0x076a('0xa'),'port':0x18eb});var socket=require(_0x076a('0xb'))(new Redis(config[_0x076a('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x076a('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x296fcb){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))*$/[_0x076a('0xd')](_0x296fcb);}function selectNotIn(_0x1f441b,_0xb6d854,_0x32c251,_0x846fd3,_0x21ecbb){return squel[_0x076a('0xe')]()[_0x076a('0xf')](_0x076a('0x10'))['from'](_0x846fd3)[_0x076a('0x11')](_0xb6d854,null,_0xb6d854+_0x076a('0x12')+_0x846fd3+'.'+_0x32c251)['where'](_0x846fd3+'.'+_0x32c251+_0x076a('0x13')+_0x1f441b+'.'+_0x32c251)[_0x076a('0x14')](_0xb6d854+'.dialCheckDuplicateType\x20IN\x20('+_0x21ecbb[_0x076a('0x11')]()+')');}function insertCmHopper(_0x5ba1b2,_0x10d902,_0x483664,_0x2cb714,_0x36e0e2){var _0x3766a3=[_0x076a('0x15'),_0x076a('0x16'),_0x076a('0x17'),_0x076a('0x18'),_0x10d902+'.'+_0x2cb714,_0x076a('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x076a('0x1a'),'\x22'+_0x36e0e2+'\x22'];return squel['insert']()[_0x076a('0x1b')](_0x076a('0x1c'))[_0x076a('0x1d')]([_0x076a('0x10'),_0x076a('0x1e'),_0x076a('0x1f'),'ListId',_0x2cb714,_0x076a('0x20'),_0x076a('0x21'),'priority','UserId','recallme'],squel[_0x076a('0xe')]()['fields'](_0x3766a3)[_0x076a('0x22')](_0x10d902)[_0x076a('0x11')](_0x076a('0x23'),null,'cm_contacts.ListId\x20=\x20'+_0x10d902+_0x076a('0x24'))[_0x076a('0x11')](_0x483664,null,_0x483664+_0x076a('0x12')+_0x10d902+'.'+_0x2cb714)[_0x076a('0x14')](_0x10d902+_0x076a('0x25'),_0x5ba1b2)['where'](_0x076a('0x26'),NOW)[_0x076a('0x14')](_0x076a('0x27'),selectNotIn(_0x10d902,_0x483664,_0x2cb714,_0x076a('0x1c'),[_0x076a('0x28'),_0x076a('0x29')]))[_0x076a('0x14')](_0x076a('0x27'),selectNotIn(_0x10d902,_0x483664,_0x2cb714,'cm_hopper',[_0x076a('0x28')])))[_0x076a('0x2a')]();}function insertCmHopperBlack(_0x36047f,_0x2014d2,_0x894ed8,_0x3c03e7){var _0x441615=['cm_contacts.phone',_0x076a('0x17'),_0x076a('0x18'),_0x2014d2+'.'+_0x3c03e7,_0x076a('0x19'),'cm_contacts.updatedAt'];return squel[_0x076a('0x2b')]()['into'](_0x076a('0x2c'))[_0x076a('0x1d')]([_0x076a('0x10'),_0x076a('0x1f'),'ListId',_0x3c03e7,_0x076a('0x20'),_0x076a('0x21')],squel['select']()[_0x076a('0x2d')](_0x441615)[_0x076a('0x22')](_0x2014d2)[_0x076a('0x11')](_0x076a('0x23'),null,_0x076a('0x2e')+_0x2014d2+_0x076a('0x24'))[_0x076a('0x11')](_0x894ed8,null,_0x894ed8+_0x076a('0x12')+_0x2014d2+'.'+_0x3c03e7)[_0x076a('0x14')](_0x2014d2+_0x076a('0x25'),_0x36047f)[_0x076a('0x14')](_0x076a('0x26'),NOW)['where'](_0x076a('0x27'),squel[_0x076a('0xe')]()[_0x076a('0xf')](_0x076a('0x10'))['from'](_0x076a('0x2c'))[_0x076a('0x14')]('ListId\x20=\x20?',_0x36047f)[_0x076a('0x14')](_0x3c03e7+'\x20=\x20?',_0x2014d2+'.'+_0x3c03e7)))[_0x076a('0x2a')]();}function insertCmContact(_0xde4d18,_0x1a1428,_0x5d0363,_0xf07f3c){var _0x1734e1=_[_0x076a('0x2f')](_[_0x076a('0x30')](_0xf07f3c),['ListId',_0x076a('0x31'),'createdAt','updatedAt']);return squel['insert']()[_0x076a('0x1b')](_0x076a('0x23'))['fromQuery'](_0x1734e1,squel['select']()[_0x076a('0x2d')](_0x1734e1)[_0x076a('0x22')](_0x1a1428)[_0x076a('0x14')]('('+_0x5d0363[_0x076a('0x11')](',')+_0x076a('0x32'),squel[_0x076a('0xe')]()[_0x076a('0x2d')](_0x5d0363)[_0x076a('0x22')](_0x076a('0x23'))[_0x076a('0x14')](_0x076a('0x33'),_0xde4d18)[_0x076a('0x14')](_0x076a('0x34')))[_0x076a('0x14')](_0x076a('0x35'),squel[_0x076a('0xe')]()[_0x076a('0xf')](_0x076a('0x36'),_0x076a('0x37'))['from'](_0x1a1428)['group'](_0x5d0363[_0x076a('0x11')](','))))[_0x076a('0x2a')]();}function handleStop(){logger[_0x076a('0x38')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xe5fb2d){logger['error'](_0xe5fb2d['message']);process['exit'](0x1);}function handleError(_0x425492,_0x9cb297){stats[_0x076a('0x39')][_0x076a('0x3a')]({'name':_0x9cb297[_0x076a('0x3b')],'message':_0x9cb297[_0x076a('0x3c')],'row':_0x425492});}function handleQuery(_0x2954d5){logger['info'](_0x2954d5);return db['sequelize'][_0x076a('0x3d')](_0x2954d5)['spread'](function(_0x22ee00){results['push'](_0x22ee00);})[_0x076a('0x3e')](function(_0xf6c270){logger[_0x076a('0x3f')](_0xf6c270[_0x076a('0x3c')]);});}function main(_0xaba2aa,_0x1f7b71,_0x5df8d3,_0x327872){logger[_0x076a('0x38')]('main',_0xaba2aa,JSON[_0x076a('0x40')](_0x1f7b71));process['send']('start');var _0x5ad8df=_0x1f7b71['binding'];var _0xc8aa8e=_0x1f7b71[_0x076a('0x41')];var _0x50c9ad=path[_0x076a('0x11')](config[_0x076a('0x42')],_0x076a('0x43'),_0xc8aa8e+_0x076a('0x44'));var _0x232f8b=_[_0x076a('0x30')](_0x5ad8df)['join']();logger['info'](_0x076a('0x45'),_0x232f8b);fs['writeFileSync'](_0x50c9ad,_0x232f8b+'\x0a');Papa['parse'](fs[_0x076a('0x46')](_0xaba2aa),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5e49cb,_0x400cd9){try{for(var _0x34f1c5=0x0,_0x391bee=[];_0x34f1c5<_0x5e49cb['data']['length'];_0x34f1c5++){stats[_0x076a('0x47')]+=0x1;if(_0x5e49cb[_0x076a('0x39')][_0x34f1c5]){handleError(_0x5e49cb[_0x076a('0x48')][_0x34f1c5],_0x5e49cb[_0x076a('0x39')][_0x34f1c5]);}else{var _0x3595a0=[];for(var _0x4e4490 in _0x5ad8df){if(_0x5ad8df[_0x076a('0x49')](_0x4e4490)){if(_0x5e49cb[_0x076a('0x48')][_0x34f1c5][_0x5ad8df[_0x4e4490]]){var _0x2acb8b=_[_0x076a('0x4a')](_0x5e49cb['data'][_0x34f1c5][_0x5ad8df[_0x4e4490]][_0x076a('0x4b')](/"/g,'\x27'));switch(_0x4e4490){case _0x076a('0x1e'):var _0x1de00d=moment(_0x2acb8b,_0x076a('0x4c'),!![]);if(_0x1de00d['isValid']()){_0x391bee[_0x076a('0x3a')]('\x22'+_0x2acb8b+'\x22');}else{_0x3595a0[_0x076a('0x3a')](_0x076a('0x4d'));}break;case _0x076a('0x4e'):var _0x581c01=parseInt(_0x2acb8b);_0x2acb8b=_['isNaN'](_0x581c01)||_0x581c01<0x0||_0x581c01>0x4?_0x327872?0x3:0x2:_0x581c01;_0x391bee[_0x076a('0x3a')]('\x22'+_0x2acb8b+'\x22');break;case _0x076a('0x4f'):var _0x2fd0e9=parseInt(_0x2acb8b);if(_[_0x076a('0x50')](_0x2fd0e9)&&_[_0x076a('0x51')](_0x5df8d3,_0x2fd0e9)){_0x391bee[_0x076a('0x3a')]('\x22'+_0x2fd0e9+'\x22');}else{_0x3595a0[_0x076a('0x3a')](_0x076a('0x52'));}break;case _0x076a('0x53'):if(isEmail(_0x2acb8b)){_0x391bee[_0x076a('0x3a')]('\x22'+_0x2acb8b+'\x22');}else{_0x3595a0[_0x076a('0x3a')](_0x076a('0x54'));}break;case _0x076a('0x55'):var _0x18826f=moment(_0x2acb8b,_0x076a('0x56'),!![]);if(_0x18826f['isValid']()){_0x391bee['push']('\x22'+_0x2acb8b+'\x22');}else{_0x3595a0[_0x076a('0x3a')](_0x076a('0x57'));}break;default:_0x391bee[_0x076a('0x3a')]('\x22'+_0x2acb8b+'\x22');}}else{switch(_0x4e4490){case _0x076a('0x58'):case _0x076a('0x10'):_0x3595a0[_0x076a('0x3a')](_0x4e4490+_0x076a('0x59'));break;default:_0x391bee['push']('\x22\x22');}}}}if(_0x3595a0[_0x076a('0x5a')]){handleError(_0x5e49cb[_0x076a('0x48')][_0x34f1c5],{'code':_0x076a('0x5b'),'message':_0x3595a0['join']()});}else{fs[_0x076a('0x5c')](_0x50c9ad,_0x391bee['join']()+'\x0a');}_0x391bee=[];}if(!(stats[_0x076a('0x47')]%0xc8)){socket[_0x076a('0x5d')]('contact:import:'+_0xc8aa8e,stats);stats['errors']=[];}}if(stopped){logger[_0x076a('0x38')](_0x076a('0x5e'));_0x400cd9[_0x076a('0x5f')]();}}catch(_0x59bddb){handleError(_0x5e49cb[_0x076a('0x48')][_0x34f1c5],{'code':_0x076a('0x60'),'message':_0x59bddb[_0x076a('0x3c')]});logger[_0x076a('0x3f')]('step',_0x59bddb[_0x076a('0x3c')]);}},'complete':function(){try{var _0x53a23e=[];var _0x589161=_0x076a('0x23');if(_0x1f7b71[_0x076a('0x61')]&&_0x1f7b71[_0x076a('0x61')]['length']){_0x589161='cm_contacts_'+_0xc8aa8e;_0x53a23e[_0x076a('0x3a')](_0x076a('0x62')+_0x589161+_0x076a('0x63'));}var _0x23de31=util[_0x076a('0xc')]('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',_0x50c9ad,_0x589161,_0x232f8b,_0x1f7b71[_0x076a('0x64')],_0x1f7b71[_0x076a('0x31')]||null,NOW,NOW);if(_['isNil'](_0x5ad8df['scheduledat'])){_0x23de31+=_0x076a('0x65');}_0x53a23e['push'](_0x23de31);if(_0x1f7b71[_0x076a('0x61')]&&_0x1f7b71['duplicates'][_0x076a('0x5a')]){_0x53a23e['push'](insertCmContact(_0x1f7b71[_0x076a('0x64')],_0x589161,_0x1f7b71[_0x076a('0x61')],_0x5ad8df));_0x53a23e[_0x076a('0x3a')](_0x076a('0x66')+_0x589161+';');}_0x53a23e[_0x076a('0x3a')](insertCmHopper(_0x1f7b71[_0x076a('0x64')],_0x076a('0x67'),_0x076a('0x68'),_0x076a('0x69'),_0x327872));_0x53a23e[_0x076a('0x3a')](insertCmHopperBlack(_0x1f7b71[_0x076a('0x64')],'voice_queues_has_cm_blacklists',_0x076a('0x68'),'VoiceQueueId'));_0x53a23e[_0x076a('0x3a')](insertCmHopper(_0x1f7b71[_0x076a('0x64')],_0x076a('0x6a'),_0x076a('0x6b'),'CampaignId',_0x327872));_0x53a23e[_0x076a('0x3a')](insertCmHopperBlack(_0x1f7b71[_0x076a('0x64')],_0x076a('0x6c'),_0x076a('0x6b'),_0x076a('0x6d')));BPromise[_0x076a('0x6e')](_0x53a23e,handleQuery)[_0x076a('0x6f')](function(_0xc38d9e){stats[_0x076a('0x70')]=!![];stats[_0x076a('0x71')]=_0x1f7b71['duplicates']&&_0x1f7b71[_0x076a('0x61')][_0x076a('0x5a')]?results[0x2][_0x076a('0x71')]:results[0x0]['affectedRows'];socket['emit'](_0x076a('0x72')+_0xc8aa8e,stats);fs[_0x076a('0x73')](_0xaba2aa);fs[_0x076a('0x73')](_0x50c9ad);process[_0x076a('0x74')](0x0);})[_0x076a('0x3e')](function(_0x12d6ad){logger['error'](_0x12d6ad[_0x076a('0x3c')]);process[_0x076a('0x74')](0x1);});}catch(_0x4c8a41){logger[_0x076a('0x3f')]('complete',_0x4c8a41[_0x076a('0x3c')]);process['exit'](0x1);}},'error':function(_0x22a692,_0x3f09f3,_0x7f2ce9,_0x442ce2){throw new Error(_0x442ce2);}});}function validate(){if(process[_0x076a('0x75')]&&process[_0x076a('0x75')][_0x076a('0x5a')]<0x4){throw new Error(_0x076a('0x76'));}var _0x15b3d7=path[_0x076a('0x11')](config[_0x076a('0x42')],_0x076a('0x43'),process[_0x076a('0x75')][0x2]);if(!fs['existsSync'](_0x15b3d7)){throw new Error(_0x076a('0x77'));}var _0xc41d4f={};try{_0xc41d4f=JSON[_0x076a('0x78')](process[_0x076a('0x75')][0x3]);if(!_0xc41d4f[_0x076a('0x79')]){throw new Error(_0x076a('0x7a'));}if(!_0xc41d4f[_0x076a('0x79')]['phone']){throw new Error(_0x076a('0x7b'));}if(!_0xc41d4f[_0x076a('0x79')]['firstName']){throw new Error(_0x076a('0x7c'));}var _0x5032eb=0x0;if(_0xc41d4f[_0x076a('0x79')][_0x076a('0x4f')]){_0x5032eb=0x1;}if(!_0xc41d4f[_0x076a('0x64')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x3511a8){throw new Error('body\x20id\x20mandatory');}var _0x1ff3ef=[];try{_0x1ff3ef=_[_0x076a('0x7d')](JSON[_0x076a('0x78')](process[_0x076a('0x75')][0x4]),'id');}catch(_0x3cd324){logger[_0x076a('0x38')](_0x076a('0x7e'));}main(_0x15b3d7,_0xc41d4f,_0x1ff3ef,_0x5032eb);}validate();process['on'](_0x076a('0x7f'),handleStop);process['on'](_0x076a('0x80'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index c863fe2..b3bf06c 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 _0x4f5c=['uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','outbound','Called\x20Number','membername','Date','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','Outbound\x20Call','variable','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','Queue'];(function(_0x109371,_0x441c8e){var _0x4fd858=function(_0x13504f){while(--_0x13504f){_0x109371['push'](_0x109371['shift']());}};_0x4fd858(++_0x441c8e);}(_0x4f5c,0x1a7));var _0xc4f5=function(_0x2552ab,_0x232d4a){_0x2552ab=_0x2552ab-0x0;var _0x180c2b=_0x4f5c[_0x2552ab];return _0x180c2b;};'use strict';exports['getSubjects']=function(_0x2f8f35,_0x8e2f2c){var _0x4019e2=[{'type':_0xc4f5('0x0'),'content':_0xc4f5('0x1'),'variableName':null}];switch(_0x2f8f35[_0xc4f5('0x2')]()){case _0xc4f5('0x3'):switch(_0x8e2f2c[_0xc4f5('0x2')]()){case _0xc4f5('0x4'):_0x4019e2[_0xc4f5('0x5')]({'type':'variable','content':'','variableName':_0xc4f5('0x6')});_0x4019e2[_0xc4f5('0x5')]({'type':'variable','content':'','variableName':'calleridnum'});break;case'outbound':_0x4019e2['push']({'type':'string','content':_0xc4f5('0x7'),'variableName':null});_0x4019e2['push']({'type':_0xc4f5('0x8'),'content':'','variableName':_0xc4f5('0x9')});break;}}return _0x4019e2;};exports[_0xc4f5('0xa')]=function(_0xfc9a66,_0x4cf22b){var _0x299cd1=[];switch(_0xfc9a66[_0xc4f5('0x2')]()){case'voice':switch(_0x4cf22b[_0xc4f5('0x2')]()){case _0xc4f5('0x4'):_0x299cd1=[{'type':_0xc4f5('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0xc'),'keyType':_0xc4f5('0x8'),'variableName':'calleridnum'},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0xd'),'keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0xe')},{'type':'keyValue','content':'','key':_0xc4f5('0xf'),'keyType':_0xc4f5('0x8'),'variableName':'destexten'},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x10'),'keyType':_0xc4f5('0x8'),'variableName':'queue'},{'type':_0xc4f5('0xb'),'content':'','key':'UniqueId','keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x11')},{'type':_0xc4f5('0xb'),'content':'','key':'Date','keyType':'variable','variableName':'agentcalledAt'},{'type':_0xc4f5('0x0'),'content':_0xc4f5('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x13'),'keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x14')},{'type':_0xc4f5('0xb'),'content':'','key':'Agent\x20Number','keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x9')},{'type':_0xc4f5('0x0'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xc4f5('0xb'),'content':'','key':'Agent\x20Ring','keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x15')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x16'),'keyType':'variable','variableName':_0xc4f5('0x17')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x18'),'keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x19')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x1a'),'keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x1b')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x1c')}];break;case _0xc4f5('0x1d'):_0x299cd1=[{'type':_0xc4f5('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x1e'),'keyType':'variable','keyContent':'','variableName':_0xc4f5('0x9')},{'type':_0xc4f5('0xb'),'content':'','key':'Member\x20Name','keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x1f')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x11')},{'type':'keyValue','content':'','key':_0xc4f5('0x20'),'keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x21')},{'type':_0xc4f5('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x22'),'keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x23')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x24'),'keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x25')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x26'),'keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x27')},{'type':_0xc4f5('0xb'),'content':'','key':'Billable\x20Time','keyType':_0xc4f5('0x8'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x299cd1;}; \ No newline at end of file +var _0x134e=['Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','voice','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***','keyValue'];(function(_0x10a0e4,_0x24dd3b){var _0x4618d2=function(_0x435524){while(--_0x435524){_0x10a0e4['push'](_0x10a0e4['shift']());}};_0x4618d2(++_0x24dd3b);}(_0x134e,0xd2));var _0xe134=function(_0x18a078,_0x3abbbc){_0x18a078=_0x18a078-0x0;var _0x504d42=_0x134e[_0x18a078];return _0x504d42;};'use strict';exports[_0xe134('0x0')]=function(_0x16883f,_0x4b19b2){var _0xe68776=[{'type':_0xe134('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x16883f[_0xe134('0x2')]()){case _0xe134('0x3'):switch(_0x4b19b2[_0xe134('0x2')]()){case'inbound':_0xe68776[_0xe134('0x4')]({'type':_0xe134('0x5'),'content':'','variableName':_0xe134('0x6')});_0xe68776['push']({'type':_0xe134('0x5'),'content':'','variableName':_0xe134('0x7')});break;case _0xe134('0x8'):_0xe68776[_0xe134('0x4')]({'type':_0xe134('0x1'),'content':_0xe134('0x9'),'variableName':null});_0xe68776['push']({'type':'variable','content':'','variableName':_0xe134('0xa')});break;}}return _0xe68776;};exports[_0xe134('0xb')]=function(_0x321759,_0xc2a7ae){var _0x45967c=[];switch(_0x321759[_0xe134('0x2')]()){case _0xe134('0x3'):switch(_0xc2a7ae['toLowerCase']()){case _0xe134('0xc'):_0x45967c=[{'type':_0xe134('0x1'),'content':_0xe134('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0xf'),'keyType':_0xe134('0x5'),'variableName':_0xe134('0x7')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x10'),'keyType':_0xe134('0x5'),'variableName':_0xe134('0x11')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x12'),'keyType':_0xe134('0x5'),'variableName':_0xe134('0x13')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x14'),'keyType':'variable','variableName':_0xe134('0x6')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x15'),'keyType':'variable','variableName':_0xe134('0x16')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x17'),'keyType':_0xe134('0x5'),'variableName':_0xe134('0x18')},{'type':_0xe134('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x19'),'keyType':_0xe134('0x5'),'variableName':_0xe134('0x1a')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x1b'),'keyType':_0xe134('0x5'),'variableName':'destcalleridnum'},{'type':'string','content':_0xe134('0x1c'),'key':null,'keyType':null,'variableName':null},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x1d'),'keyType':_0xe134('0x5'),'variableName':_0xe134('0x18')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x1e'),'keyType':_0xe134('0x5'),'variableName':'agentconnectAt'},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x1f'),'keyType':_0xe134('0x5'),'variableName':_0xe134('0x20')},{'type':_0xe134('0xe'),'content':'','key':'Hold\x20Time','keyType':_0xe134('0x5'),'variableName':_0xe134('0x21')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x22'),'keyType':'variable','variableName':'talktime'}];break;case _0xe134('0x8'):_0x45967c=[{'type':_0xe134('0x1'),'content':_0xe134('0xd'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0xe134('0xa')},{'type':_0xe134('0xe'),'content':'','key':'Member\x20Name','keyType':_0xe134('0x5'),'keyContent':'','variableName':_0xe134('0x23')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x15'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x17'),'keyType':_0xe134('0x5'),'keyContent':'','variableName':_0xe134('0x24')},{'type':'string','content':_0xe134('0x1c')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x25'),'keyType':_0xe134('0x5'),'keyContent':'','variableName':_0xe134('0x26')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x27'),'keyType':'variable','keyContent':'','variableName':_0xe134('0x28')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x29'),'keyType':_0xe134('0x5'),'keyContent':'','variableName':_0xe134('0x2a')},{'type':_0xe134('0xe'),'content':'','key':_0xe134('0x2b'),'keyType':_0xe134('0x5'),'keyContent':'','variableName':_0xe134('0x2c')}];break;}}return _0x45967c;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 773d415..29012d4 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 _0x1f36=['error','tracked','user','body','omit','html','fax','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','findOne','update','then','info'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1f36,0x1ed));var _0x61f3=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0x1f36[_0x2842b4];return _0x2b9521;};'use strict';var _=require(_0x61f3('0x0'));var db=require(_0x61f3('0x1'))['db'];var loggers={'openchannel':require(_0x61f3('0x2'))(_0x61f3('0x3')),'mail':require('../../config/logger')(_0x61f3('0x4')),'fax':require('../../config/logger')(_0x61f3('0x5')),'sms':require(_0x61f3('0x2'))(_0x61f3('0x6')),'chat':require(_0x61f3('0x2'))(_0x61f3('0x7')),'whatsapp':require(_0x61f3('0x2'))(_0x61f3('0x8'))};function getInteractionId(_0x52a5eb,_0x2e5a92,_0x2f1f60){if(_0x52a5eb&&_0x52a5eb[_[_0x61f3('0x9')](_0x2f1f60)+_0x61f3('0xa')]){return _0x52a5eb[_[_0x61f3('0x9')](_0x2f1f60)+_0x61f3('0xa')];}else if(_0x52a5eb&&_0x52a5eb['id']){return _0x52a5eb['id'];}else if(_0x2e5a92&&_0x2e5a92['id']){return _0x2e5a92['id'];}else{return _0x61f3('0xb');}}function log(_0x51f786,_0x1dba23,_0x183bf0,_0x14b24e,_0x3ae705,_0x2326bf){loggers[_0x3ae705['toLowerCase']()][_0x51f786](_0x61f3('0xc'),_0x2326bf['toUpperCase'](),_0x1dba23?_0x1dba23['id']:null,_0x1dba23?_0x1dba23[_0x61f3('0xd')]:null,_0x1dba23?_0x1dba23[_0x61f3('0xe')]:null,getInteractionId(_0x183bf0,_0x14b24e,_0x3ae705),_0x183bf0?JSON['stringify'](_0x183bf0):_0x61f3('0xf'));}function updateUser(_0x2eacb1,_0x545004,_0x1e0d4b,_0x585822,_0x42c8b4){db[_[_0x61f3('0x9')](_0x585822)+'Interaction'][_0x61f3('0x10')]({'where':{'id':getInteractionId(_0x545004,_0x1e0d4b,_0x585822)}})['then'](function(_0x1b74c4){if(_0x1b74c4){return _0x1b74c4[_0x61f3('0x11')]({'UserId':_0x2eacb1?_0x2eacb1['id']:null});}})[_0x61f3('0x12')](function(_0x55c02e){if(_0x55c02e){log(_0x61f3('0x13'),_0x2eacb1,_0x545004,_0x1e0d4b,_0x585822,_0x42c8b4);}})['catch'](function(){log(_0x61f3('0x14'),_0x2eacb1,_0x545004,_0x1e0d4b,_0x585822,_0x42c8b4);});}exports[_0x61f3('0x15')]=function(_0xf55071,_0x2e339f){return function(_0x1d6fde,_0x433113,_0x45e9ac){var _0x37f16d=_0x1d6fde[_0x61f3('0x16')];var _0x33f258={};var _0xb61897=_0x1d6fde['query'];if(_0x33f258){_0x33f258=_['clone'](_0x1d6fde[_0x61f3('0x17')]);_0x33f258=_[_0x61f3('0x18')](_0x33f258,[_0x61f3('0x17'),_0x61f3('0x19'),'phone',_0x61f3('0x1a'),'mobile']);}updateUser(_0x37f16d,_0x33f258,_0xb61897,_0xf55071,_0x2e339f);_0x45e9ac(null);};}; \ No newline at end of file +var _0x7ca5=['findOne','then','update','info','error','tracked','user','query','clone','body','omit','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify'];(function(_0x3333bb,_0x1df222){var _0x273d39=function(_0x5c411b){while(--_0x5c411b){_0x3333bb['push'](_0x3333bb['shift']());}};_0x273d39(++_0x1df222);}(_0x7ca5,0x1f2));var _0x57ca=function(_0x195f33,_0x249f6e){_0x195f33=_0x195f33-0x0;var _0x1a7e43=_0x7ca5[_0x195f33];return _0x1a7e43;};'use strict';var _=require(_0x57ca('0x0'));var db=require(_0x57ca('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x57ca('0x2')),'mail':require(_0x57ca('0x3'))('mail-interactions'),'fax':require(_0x57ca('0x3'))('fax-interactions'),'sms':require(_0x57ca('0x3'))('sms-interactions'),'chat':require(_0x57ca('0x3'))(_0x57ca('0x4')),'whatsapp':require('../../config/logger')(_0x57ca('0x5'))};function getInteractionId(_0x209eb,_0x56dbd0,_0x266c62){if(_0x209eb&&_0x209eb[_['upperFirst'](_0x266c62)+_0x57ca('0x6')]){return _0x209eb[_[_0x57ca('0x7')](_0x266c62)+_0x57ca('0x6')];}else if(_0x209eb&&_0x209eb['id']){return _0x209eb['id'];}else if(_0x56dbd0&&_0x56dbd0['id']){return _0x56dbd0['id'];}else{return _0x57ca('0x8');}}function log(_0x43bed3,_0x40d8cd,_0x57dc72,_0x2e0f9f,_0x55ffda,_0x9059cf){loggers[_0x55ffda[_0x57ca('0x9')]()][_0x43bed3](_0x57ca('0xa'),_0x9059cf[_0x57ca('0xb')](),_0x40d8cd?_0x40d8cd['id']:null,_0x40d8cd?_0x40d8cd[_0x57ca('0xc')]:null,_0x40d8cd?_0x40d8cd[_0x57ca('0xd')]:null,getInteractionId(_0x57dc72,_0x2e0f9f,_0x55ffda),_0x57dc72?JSON[_0x57ca('0xe')](_0x57dc72):'null');}function updateUser(_0x4dc633,_0x1b2da2,_0x512534,_0x2631e9,_0x1123ef){db[_['upperFirst'](_0x2631e9)+'Interaction'][_0x57ca('0xf')]({'where':{'id':getInteractionId(_0x1b2da2,_0x512534,_0x2631e9)}})[_0x57ca('0x10')](function(_0x1d4dc4){if(_0x1d4dc4){return _0x1d4dc4[_0x57ca('0x11')]({'UserId':_0x4dc633?_0x4dc633['id']:null});}})[_0x57ca('0x10')](function(_0x5e65dd){if(_0x5e65dd){log(_0x57ca('0x12'),_0x4dc633,_0x1b2da2,_0x512534,_0x2631e9,_0x1123ef);}})['catch'](function(){log(_0x57ca('0x13'),_0x4dc633,_0x1b2da2,_0x512534,_0x2631e9,_0x1123ef);});}exports[_0x57ca('0x14')]=function(_0x55579f,_0x473bee){return function(_0x335bbc,_0x24e2cb,_0x48e7e7){var _0x319d64=_0x335bbc[_0x57ca('0x15')];var _0x486687={};var _0xae965a=_0x335bbc[_0x57ca('0x16')];if(_0x486687){_0x486687=_[_0x57ca('0x17')](_0x335bbc[_0x57ca('0x18')]);_0x486687=_[_0x57ca('0x19')](_0x486687,[_0x57ca('0x18'),'html','phone','fax',_0x57ca('0x1a')]);}updateUser(_0x319d64,_0x486687,_0xae965a,_0x55579f,_0x473bee);_0x48e7e7(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 3c03274..0e65469 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 _0x537a=['license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb'];(function(_0x106d4a,_0x5b5994){var _0xcdafb7=function(_0x563fec){while(--_0x563fec){_0x106d4a['push'](_0x106d4a['shift']());}};_0xcdafb7(++_0x5b5994);}(_0x537a,0xcc));var _0xa537=function(_0x487368,_0x417826){_0x487368=_0x487368-0x0;var _0x2895d8=_0x537a[_0x487368];return _0x2895d8;};'use strict';var crypto=require(_0xa537('0x0'));var util=require(_0xa537('0x1'));var compose=require(_0xa537('0x2'));var db=require(_0xa537('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5f2944,_0x4f2d5d){if(_0x5f2944&&_0x4f2d5d){if(_0x4f2d5d['data1']&&_0x4f2d5d[_0xa537('0x4')]){var _0x55402c=_0x4f2d5d[_0xa537('0x5')];var _0x560cd0=_0x4f2d5d['license'];var _0xa326fa=_0x55402c[_0xa537('0x6')]('-')[0x4];var _0xebb91d=_0x55402c[_0xa537('0x6')]('-')[0x0];var _0x5ec3a1=crypto[_0xa537('0x7')](_0xa537('0x8'),util[_0xa537('0x9')](_0xa537('0xa'),_0xa326fa,_0x55402c,_0xebb91d));var _0x5a59de=_0x5ec3a1[_0xa537('0xb')](_0x560cd0,_0xa537('0xc'),_0xa537('0xd'));_0x5a59de+=_0x5ec3a1[_0xa537('0xe')]('utf8');var _0x18c9d1=JSON['parse'](_0x5a59de);return _0x18c9d1['hasOwnProperty'](_0x5f2944)?_0x18c9d1[_0x5f2944]:null;}}return null;}function isLimit(_0x2b03b2,_0x4664a0,_0x199a84,_0x9333e7){var _0x8de31b=_0x4664a0;return compose()[_0xa537('0xf')](function(_0x2de8bd,_0x3f26e5,_0x5909cb){return db[_0xa537('0x10')][_0xa537('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x17d7c4){var _0x43ee49=getValueFromLicense(_0x2b03b2,_0x17d7c4);return _0x43ee49?_0x43ee49:_0x8de31b;})[_0xa537('0x12')](function(_0x114bcb){_0x8de31b=_0x114bcb;return _0x199a84['count'](_0x9333e7);})[_0xa537('0x12')](function(_0x373459){if(_0x373459>=_0x8de31b){return _0x3f26e5[_0xa537('0x13')](0x193)[_0xa537('0x14')]({'message':util[_0xa537('0x9')](_0xa537('0x15'),_0x2b03b2)});}_0x5909cb();})[_0xa537('0x16')](function(_0x1664bc){_0x5909cb(_0x1664bc);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xa537('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0xa537('0x18')}]}});}exports[_0xa537('0x19')]=isUserLimit; \ No newline at end of file +var _0x5e3d=['findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License'];(function(_0x1ccc8d,_0x5c3d4e){var _0x3561d9=function(_0x29d3ad){while(--_0x29d3ad){_0x1ccc8d['push'](_0x1ccc8d['shift']());}};_0x3561d9(++_0x5c3d4e);}(_0x5e3d,0xf3));var _0xd5e3=function(_0x1e3ec2,_0x5b5cd8){_0x1e3ec2=_0x1e3ec2-0x0;var _0x4995fb=_0x5e3d[_0x1e3ec2];return _0x4995fb;};'use strict';var crypto=require('crypto');var util=require(_0xd5e3('0x0'));var compose=require(_0xd5e3('0x1'));var db=require(_0xd5e3('0x2'))['db'];var config=require(_0xd5e3('0x3'));function getValueFromLicense(_0x25c56a,_0x2488a6){if(_0x25c56a&&_0x2488a6){if(_0x2488a6[_0xd5e3('0x4')]&&_0x2488a6[_0xd5e3('0x5')]){var _0x11641f=_0x2488a6[_0xd5e3('0x4')];var _0x544302=_0x2488a6[_0xd5e3('0x5')];var _0x2013c2=_0x11641f['split']('-')[0x4];var _0x2d5433=_0x11641f[_0xd5e3('0x6')]('-')[0x0];var _0x4428d2=crypto[_0xd5e3('0x7')]('aes-256-ctr',util[_0xd5e3('0x8')](_0xd5e3('0x9'),_0x2013c2,_0x11641f,_0x2d5433));var _0x252c24=_0x4428d2[_0xd5e3('0xa')](_0x544302,_0xd5e3('0xb'),_0xd5e3('0xc'));_0x252c24+=_0x4428d2[_0xd5e3('0xd')]('utf8');var _0x3f5b79=JSON[_0xd5e3('0xe')](_0x252c24);return _0x3f5b79[_0xd5e3('0xf')](_0x25c56a)?_0x3f5b79[_0x25c56a]:null;}}return null;}function isLimit(_0x11f66e,_0x2f4829,_0x545de7,_0x2f6521){var _0x2c8b5a=_0x2f4829;return compose()[_0xd5e3('0x10')](function(_0xc667a5,_0x4c3559,_0x9eb40b){return db[_0xd5e3('0x11')][_0xd5e3('0x12')]({'where':{'id':0x1},'raw':!![]})[_0xd5e3('0x13')](function(_0x2d1025){var _0x845f69=getValueFromLicense(_0x11f66e,_0x2d1025);return _0x845f69?_0x845f69:_0x2c8b5a;})[_0xd5e3('0x13')](function(_0xd6c3f4){_0x2c8b5a=_0xd6c3f4;return _0x545de7[_0xd5e3('0x14')](_0x2f6521);})[_0xd5e3('0x13')](function(_0x59c75c){if(_0x59c75c>=_0x2c8b5a){return _0x4c3559[_0xd5e3('0x15')](0x193)[_0xd5e3('0x16')]({'message':util[_0xd5e3('0x8')](_0xd5e3('0x17'),_0x11f66e)});}_0x9eb40b();})['catch'](function(_0x117bc2){_0x9eb40b(_0x117bc2);});});}function isUserLimit(){return isLimit(_0xd5e3('0x18'),0x1,db[_0xd5e3('0x19')],{'where':{'$or':[{'role':_0xd5e3('0x1a')},{'role':_0xd5e3('0x1b')}]}});}exports[_0xd5e3('0x1c')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 618623a..e39f2e1 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 _0x2255=['LIKE\x20?','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','forEach','shift','match','filter','indexOf','map','buildExpression','DATE','operator','$eq','$between','value','$gt','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','includes','\x20OR\x20','\x20IS\x20NULL)','$in','$notIn','NOT\x20IN\x20?','=\x20?','$ne','$substring','$startsWith','$endsWith'];(function(_0x115b95,_0xa1f8b9){var _0x460b3d=function(_0x510c02){while(--_0x510c02){_0x115b95['push'](_0x115b95['shift']());}};_0x460b3d(++_0xa1f8b9);}(_0x2255,0x121));var _0x5225=function(_0x260e2f,_0xf3321e){_0x260e2f=_0x260e2f-0x0;var _0x568330=_0x2255[_0x260e2f];return _0x568330;};'use strict';var _=require(_0x5225('0x0'));var moment=require(_0x5225('0x1'));exports['parseSearch']=function(_0x573c76){var _0x59fe18={'conditions':[]};_0x59fe18[_0x5225('0x2')]=_[_0x5225('0x3')](_0x573c76,_0x5225('0x4'))?'or':_0x5225('0x5');var _0x3fe16e=_0x573c76[_0x5225('0x6')](_0x5225('0x7'),'')[_0x5225('0x6')](_0x5225('0x4'),'')[_0x5225('0x8')]('||');for(var _0x55fe3f=0x0;_0x55fe3f<_0x3fe16e['length'];_0x55fe3f++){var _0x3b57fb=_0x3fe16e[_0x55fe3f][_0x5225('0x8')](':=');var _0x49b971=_0x3b57fb[0x0];var _0x46c635=_0x3b57fb['slice'](0x1);_0x46c635[_0x5225('0x9')](function(_0x50ac8c){var _0x62b3e2=_0x50ac8c[_0x5225('0x8')]('[')[_0x5225('0xa')]();var _0x2f499f=_0x50ac8c[_0x5225('0xb')](/\[(.*?)\]/g);_0x2f499f[_0x5225('0x9')](function(_0x4c953f){var _0x47feed=_0x4c953f['split']('[')[_0x5225('0xc')](function(_0x1605a8){return _0x1605a8[_0x5225('0xd')](']')>-0x1;})[_0x5225('0xe')](function(_0x437d31){return _0x437d31[_0x5225('0x8')](']')[0x0];})[0x0];_0x59fe18['conditions']['push']({'field':_0x49b971,'operator':_0x62b3e2,'value':_0x47feed});});});}return _0x59fe18;};exports[_0x5225('0xf')]=function(_0x4841db,_0x3e3a60,_0x285e98){var _0x426b23={};if(_0x3e3a60===_0x5225('0x10')){if(_0x285e98[_0x5225('0x11')]===_0x5225('0x12')){_0x285e98[_0x5225('0x11')]=_0x5225('0x13');_0x285e98[_0x5225('0x14')]+=','+_0x285e98['value'];}else if(_['includes']([_0x5225('0x15'),'$lte'],_0x285e98['operator'])){_0x285e98[_0x5225('0x14')]=moment(_0x285e98[_0x5225('0x14')])[_0x5225('0x16')](0x1,_0x5225('0x17'))[_0x5225('0x18')](_0x5225('0x19'));}}if(_0x285e98[_0x5225('0x1a')]){_0x3e3a60=_0x285e98['castTo'];_0x426b23[_0x5225('0x1b')]=_0x5225('0x1c')+_0x4841db+'.'+_0x285e98[_0x5225('0x1d')]+'\x20AS\x20'+_0x285e98[_0x5225('0x1a')]+')\x20'+parseOperator(_0x285e98[_0x5225('0x11')]);}else{_0x426b23[_0x5225('0x1b')]=_0x4841db+'.'+_0x285e98['field']+'\x20'+parseOperator(_0x285e98[_0x5225('0x11')]);}if(_[_0x5225('0x1e')](['$ne','$notIn'],_0x285e98[_0x5225('0x11')]))_0x426b23['text']='('+_0x426b23['text']+_0x5225('0x1f')+_0x4841db+'.'+_0x285e98[_0x5225('0x1d')]+_0x5225('0x20');_0x426b23[_0x5225('0x14')]=parseValue(_0x3e3a60,_0x285e98[_0x5225('0x11')],_0x285e98[_0x5225('0x14')]);return _0x426b23;};function parseOperator(_0x47dacd){var _0x7aab0b;switch(_0x47dacd){case _0x5225('0x21'):_0x7aab0b='IN\x20?';break;case _0x5225('0x22'):_0x7aab0b=_0x5225('0x23');break;case'$eq':_0x7aab0b=_0x5225('0x24');break;case _0x5225('0x25'):_0x7aab0b='<>\x20?';break;case _0x5225('0x26'):case _0x5225('0x27'):case _0x5225('0x28'):_0x7aab0b=_0x5225('0x29');break;case'$lt':_0x7aab0b=_0x5225('0x2a');break;case'$gt':_0x7aab0b=_0x5225('0x2b');break;case _0x5225('0x2c'):_0x7aab0b=_0x5225('0x2d');break;case _0x5225('0x2e'):_0x7aab0b=_0x5225('0x2f');break;case _0x5225('0x13'):_0x7aab0b=_0x5225('0x30');break;}return _0x7aab0b;}function parseValue(_0x353691,_0x547166,_0x5a739e){var _0xc631b7={'start':undefined,'end':undefined};switch(_0x547166){case _0x5225('0x21'):case'$notIn':_0xc631b7[_0x5225('0x31')]=_0x5a739e['split'](',');break;case _0x5225('0x26'):_0xc631b7[_0x5225('0x31')]='%'+_0x5a739e+'%';break;case'$startsWith':_0xc631b7[_0x5225('0x31')]=_0x5a739e+'%';break;case _0x5225('0x28'):_0xc631b7[_0x5225('0x31')]='%'+_0x5a739e;break;case _0x5225('0x13'):var _0x1f7e30=_0x5a739e[_0x5225('0x8')](',');var _0x5a739e=_0x1f7e30[_0x5225('0xa')]();var _0x51c9a9=_0x1f7e30[_0x5225('0x32')]();if(_0x353691===_0x5225('0x10')){_0x5a739e=moment(_0x5a739e)[_0x5225('0x33')](0x0,!![])['format']();_0x51c9a9=moment(_0x51c9a9)['utcOffset'](0x0,!![])[_0x5225('0x16')](0x17,_0x5225('0x34'))[_0x5225('0x16')](0x3b,_0x5225('0x35'))[_0x5225('0x16')](0x3b,_0x5225('0x36'))['format']();}_0xc631b7={'start':_0x5a739e,'end':_0x51c9a9};break;default:_0xc631b7[_0x5225('0x31')]=_0x5a739e;break;}return _0xc631b7;} \ No newline at end of file +var _0xc21e=['length','slice','forEach','shift','match','filter','map','buildExpression','operator','$eq','$between','includes','$gt','$lte','value','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','<=\x20?','$gte','>=\x20?','start','pop','utcOffset','minutes','seconds','moment','parseSearch','[$or]','replace','split'];(function(_0x3ba258,_0x1fd22e){var _0x3cd575=function(_0xe92497){while(--_0xe92497){_0x3ba258['push'](_0x3ba258['shift']());}};_0x3cd575(++_0x1fd22e);}(_0xc21e,0x1a2));var _0xec21=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc21e[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var moment=require(_0xec21('0x0'));exports[_0xec21('0x1')]=function(_0x5078fb){var _0x1947f1={'conditions':[]};_0x1947f1['sqlOperator']=_['startsWith'](_0x5078fb,_0xec21('0x2'))?'or':'and';var _0x6081d1=_0x5078fb['replace']('[$and]','')[_0xec21('0x3')](_0xec21('0x2'),'')[_0xec21('0x4')]('||');for(var _0x28c54e=0x0;_0x28c54e<_0x6081d1[_0xec21('0x5')];_0x28c54e++){var _0x1d689c=_0x6081d1[_0x28c54e]['split'](':=');var _0xdea447=_0x1d689c[0x0];var _0x11f3a3=_0x1d689c[_0xec21('0x6')](0x1);_0x11f3a3[_0xec21('0x7')](function(_0x2c0dca){var _0x44f31c=_0x2c0dca[_0xec21('0x4')]('[')[_0xec21('0x8')]();var _0x5b4730=_0x2c0dca[_0xec21('0x9')](/\[(.*?)\]/g);_0x5b4730['forEach'](function(_0x35ca9b){var _0x50464f=_0x35ca9b[_0xec21('0x4')]('[')[_0xec21('0xa')](function(_0x5244ee){return _0x5244ee['indexOf'](']')>-0x1;})[_0xec21('0xb')](function(_0x1e753a){return _0x1e753a['split'](']')[0x0];})[0x0];_0x1947f1['conditions']['push']({'field':_0xdea447,'operator':_0x44f31c,'value':_0x50464f});});});}return _0x1947f1;};exports[_0xec21('0xc')]=function(_0x502556,_0x46c895,_0xd92bfc){var _0x24d0b5={};if(_0x46c895==='DATE'){if(_0xd92bfc[_0xec21('0xd')]===_0xec21('0xe')){_0xd92bfc['operator']=_0xec21('0xf');_0xd92bfc['value']+=','+_0xd92bfc['value'];}else if(_[_0xec21('0x10')]([_0xec21('0x11'),_0xec21('0x12')],_0xd92bfc['operator'])){_0xd92bfc[_0xec21('0x13')]=moment(_0xd92bfc[_0xec21('0x13')])[_0xec21('0x14')](0x1,_0xec21('0x15'))[_0xec21('0x16')](_0xec21('0x17'));}}if(_0xd92bfc[_0xec21('0x18')]){_0x46c895=_0xd92bfc[_0xec21('0x18')];_0x24d0b5[_0xec21('0x19')]=_0xec21('0x1a')+_0x502556+'.'+_0xd92bfc[_0xec21('0x1b')]+'\x20AS\x20'+_0xd92bfc[_0xec21('0x18')]+')\x20'+parseOperator(_0xd92bfc[_0xec21('0xd')]);}else{_0x24d0b5[_0xec21('0x19')]=_0x502556+'.'+_0xd92bfc[_0xec21('0x1b')]+'\x20'+parseOperator(_0xd92bfc[_0xec21('0xd')]);}if(_['includes']([_0xec21('0x1c'),_0xec21('0x1d')],_0xd92bfc[_0xec21('0xd')]))_0x24d0b5[_0xec21('0x19')]='('+_0x24d0b5[_0xec21('0x19')]+'\x20OR\x20'+_0x502556+'.'+_0xd92bfc['field']+_0xec21('0x1e');_0x24d0b5[_0xec21('0x13')]=parseValue(_0x46c895,_0xd92bfc[_0xec21('0xd')],_0xd92bfc[_0xec21('0x13')]);return _0x24d0b5;};function parseOperator(_0x8a8ea1){var _0x2ae1ae;switch(_0x8a8ea1){case _0xec21('0x1f'):_0x2ae1ae=_0xec21('0x20');break;case _0xec21('0x1d'):_0x2ae1ae='NOT\x20IN\x20?';break;case _0xec21('0xe'):_0x2ae1ae='=\x20?';break;case _0xec21('0x1c'):_0x2ae1ae=_0xec21('0x21');break;case _0xec21('0x22'):case _0xec21('0x23'):case _0xec21('0x24'):_0x2ae1ae=_0xec21('0x25');break;case'$lt':_0x2ae1ae=_0xec21('0x26');break;case _0xec21('0x11'):_0x2ae1ae='>\x20?';break;case'$lte':_0x2ae1ae=_0xec21('0x27');break;case _0xec21('0x28'):_0x2ae1ae=_0xec21('0x29');break;case _0xec21('0xf'):_0x2ae1ae='BETWEEN\x20?\x20AND\x20?';break;}return _0x2ae1ae;}function parseValue(_0x47dc98,_0x11f53f,_0x4a216d){var _0x14bc54={'start':undefined,'end':undefined};switch(_0x11f53f){case _0xec21('0x1f'):case _0xec21('0x1d'):_0x14bc54[_0xec21('0x2a')]=_0x4a216d[_0xec21('0x4')](',');break;case _0xec21('0x22'):_0x14bc54[_0xec21('0x2a')]='%'+_0x4a216d+'%';break;case'$startsWith':_0x14bc54[_0xec21('0x2a')]=_0x4a216d+'%';break;case'$endsWith':_0x14bc54[_0xec21('0x2a')]='%'+_0x4a216d;break;case _0xec21('0xf'):var _0x4c2b26=_0x4a216d['split'](',');var _0x4a216d=_0x4c2b26['shift']();var _0x101597=_0x4c2b26[_0xec21('0x2b')]();if(_0x47dc98==='DATE'){_0x4a216d=moment(_0x4a216d)[_0xec21('0x2c')](0x0,!![])[_0xec21('0x16')]();_0x101597=moment(_0x101597)[_0xec21('0x2c')](0x0,!![])[_0xec21('0x14')](0x17,'hours')['add'](0x3b,_0xec21('0x2d'))[_0xec21('0x14')](0x3b,_0xec21('0x2e'))[_0xec21('0x16')]();}_0x14bc54={'start':_0x4a216d,'end':_0x101597};break;default:_0x14bc54['start']=_0x4a216d;break;}return _0x14bc54;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index b989c0c..4ae1afe 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 _0x855a=['type','DATE','isPlainObject','$gte','format','utc','subtract','name','uniqueid','isArray','offset','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','push','query','$id','intersection','model','attributes','fields','nolimit','limit','where','pick','filter','object','columns','value','merge','map','VIRTUAL','lower','sequelize','includes','parse','keys','split','filters','isEmpty','forOwn','find'];(function(_0x13c2eb,_0x3ec240){var _0x3b8845=function(_0x2ee861){while(--_0x2ee861){_0x13c2eb['push'](_0x13c2eb['shift']());}};_0x3b8845(++_0x3ec240);}(_0x855a,0x6f));var _0xa855=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x855a[_0x17406e];return _0x2bfc5a;};'use strict';var _=require('lodash');var sequelize=require(_0xa855('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xece8db){var _0x2ae28b=['ne'];try{var _0xa1a5a7=JSON['parse'](_0xece8db);var _0x513fdf=Object['keys'](_0xa1a5a7)[0x0];return _0x2ae28b[_0xa855('0x1')](_0x513fdf);}catch(_0x373344){return![];}}function getOperatorValue(_0x523a90){var _0x54b354=JSON[_0xa855('0x2')](_0x523a90);var _0x2bb2c9=Object[_0xa855('0x3')](_0x54b354)[0x0];var _0x24d243=_0x54b354[_0x2bb2c9];return{['$'+_0x2bb2c9]:_0x24d243};}exports['fields']=function(_0x1775fb){var _0x4e9b27=null;if(_0x1775fb){_0x4e9b27=_0x1775fb[_0xa855('0x4')](',');}return _0x4e9b27;};exports[_0xa855('0x5')]=function(_0x38b09f,_0x3f77e3){var _0x67f08={};if(!_[_0xa855('0x6')](_0x38b09f)){_[_0xa855('0x7')](_0x38b09f,function(_0x2bbd31,_0x4c684f){try{if(_0x3f77e3){var _0x1df018=_[_0xa855('0x8')](_0x3f77e3,{'name':_0x4c684f})||{};if(hasSequelizeOperator(_0x2bbd31)){_0x67f08[_0x4c684f]=getOperatorValue(_0x2bbd31);}else if(_0x1df018[_0xa855('0x9')]===_0xa855('0xa')&&_[_0xa855('0xb')](_0x2bbd31)){var _0xdd7dff=JSON[_0xa855('0x2')](_0x2bbd31);var _0x4f3910={'$gte':moment(moment(_0xdd7dff[_0xa855('0xc')])[_0xa855('0xd')]('YYYY-MM-DD'))[_0xa855('0xe')]()[_0xa855('0xd')](),'$lte':moment(moment(_0xdd7dff['$lte'])['format']('YYYY-MM-DD'))[_0xa855('0xe')]()[_0xa855('0xf')](0x1,'s')[_0xa855('0xd')]()};_0x67f08[_0x4c684f]=_0x4f3910;}else if(_0x1df018[_0xa855('0x10')]===_0xa855('0x11')){_0x67f08[_0x4c684f]=_0x2bbd31;}else{_0x67f08[_0x4c684f]=_[_0xa855('0x12')](_0x2bbd31)?_0x2bbd31:JSON[_0xa855('0x2')](_0x2bbd31);}}else{_0x67f08[_0x4c684f]=_[_0xa855('0x12')](_0x2bbd31)?_0x2bbd31:JSON[_0xa855('0x2')](_0x2bbd31);}}catch(_0x5cb1a4){_0x67f08[_0x4c684f]=_0x2bbd31[_0xa855('0x4')](',');}});}return _0x67f08;};exports['limit']=function(_0x5952ed){_0x5952ed=parseInt(_0x5952ed,0xa);if(!_0x5952ed||_0x5952ed<0x0){_0x5952ed=LIMIT_VALUE;}return _0x5952ed;};exports[_0xa855('0x13')]=function(_0x525d0e){_0x525d0e=parseInt(_0x525d0e,0xa);if(!_0x525d0e||_0x525d0e<0x0){_0x525d0e=0x0;}return _0x525d0e;};exports[_0xa855('0x14')]=function(_0x4ea7a8){var _0x32401c,_0x1eb045=null;if(_0x4ea7a8){_0x32401c=_0x4ea7a8[_0xa855('0x4')](',');_0x1eb045=_['map'](_0x32401c,function(_0x20f68d){if(_0x20f68d[_0xa855('0x15')]('-')===0x0){return[_0x20f68d===_0xa855('0x16')?sequelize[_0xa855('0x17')](sequelize[_0xa855('0x18')](_0xa855('0x16')),_0xa855('0x19')):_0x20f68d[_0xa855('0x1a')](0x1),_0xa855('0x1b')];}else{return[_0x20f68d===_0xa855('0x16')?sequelize[_0xa855('0x17')](sequelize[_0xa855('0x18')](_0xa855('0x16')),_0xa855('0x19')):_0x20f68d,_0xa855('0x1c')];}});}return _0x1eb045;};exports[_0xa855('0x1d')]=function(_0x4ddf25,_0x24efb3){if(_[_0xa855('0x6')](_0x4ddf25)){return _0x4ddf25;}if(_[_0xa855('0x12')](_0x4ddf25)){for(var _0x20e41b=0x0;_0x20e41b<_0x4ddf25[_0xa855('0x1e')];_0x20e41b+=0x1){_0x4ddf25[_0x20e41b]=this[_0xa855('0x1d')](_0x4ddf25[_0x20e41b],_0x24efb3);}return _0x4ddf25;}if(!_[_0xa855('0x1f')](_0x4ddf25)){return _0x4ddf25;}if(_[_0xa855('0x20')](_0x24efb3)){_0x24efb3=[_0x24efb3];}if(!_[_0xa855('0x12')](_0x24efb3)){return _0x4ddf25;}for(var _0x390d66=0x0;_0x390d66<_0x24efb3[_0xa855('0x1e')];_0x390d66+=0x1){_[_0xa855('0x21')](_0x4ddf25,_0x24efb3[_0x390d66]);}for(var _0x6768f5 in _0x4ddf25){if(_0x4ddf25[_0xa855('0x22')](_0x6768f5)){_0x4ddf25[_0x6768f5]=this['omit'](_0x4ddf25[_0x6768f5],_0x24efb3);}}return _0x4ddf25;};exports[_0xa855('0x23')]=function(_0x1f8171){return _0x1f8171[_0xa855('0x24')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa855('0x25')]=function(_0x3a7c6e){return _0x3a7c6e[_0xa855('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xa855('0x26')]=function(_0x5214d8){var _0x523769=[];_0x5214d8[_0xa855('0x4')](/[ ,]+/)[_0xa855('0x27')](function(_0x5c1b5b){_0x5c1b5b=_0x5c1b5b[_0xa855('0x28')](/([^:]")"+/g,'$1');_0x5c1b5b='+'+_0x5c1b5b+'*';if(_0x5c1b5b[_0xa855('0x1')]('@'))_0x5c1b5b='\x22'+_0x5c1b5b+'\x22';_0x523769[_0xa855('0x29')](_0x5c1b5b);});return _0x523769['join']('\x20');};exports['getOptions']=function(_0x53b8a2,_0x2d796d,_0x957866){var _0x462cc5={},_0x3d88eb={};if(_0x2d796d[_0xa855('0x2a')]['$id']){_0x2d796d['query']['id']=_0x2d796d['query'][_0xa855('0x2b')];delete _0x2d796d[_0xa855('0x2a')][_0xa855('0x2b')];}_0x462cc5['model']=_['map'](_0x53b8a2,_0xa855('0x10'));_0x462cc5[_0xa855('0x2a')]=_[_0xa855('0x3')](_0x2d796d[_0xa855('0x2a')]);_0x462cc5[_0xa855('0x5')]=_[_0xa855('0x2c')](_0x462cc5[_0xa855('0x2d')],_0x462cc5['query']);_0x3d88eb[_0xa855('0x2e')]=_[_0xa855('0x2c')](_0x462cc5[_0xa855('0x2d')],this[_0xa855('0x2f')](_0x2d796d[_0xa855('0x2a')][_0xa855('0x2f')]));_0x3d88eb[_0xa855('0x2e')]=_0x3d88eb[_0xa855('0x2e')]['length']?_0x3d88eb[_0xa855('0x2e')]:_0x462cc5[_0xa855('0x2d')];if(!_0x2d796d[_0xa855('0x2a')][_0xa855('0x22')](_0xa855('0x30'))){_0x3d88eb['limit']=this['limit'](_0x2d796d['query'][_0xa855('0x31')]);_0x3d88eb[_0xa855('0x13')]=this[_0xa855('0x13')](_0x2d796d[_0xa855('0x2a')][_0xa855('0x13')]);}_0x3d88eb['order']=this['sort'](_0x2d796d[_0xa855('0x2a')][_0xa855('0x14')]);_0x3d88eb[_0xa855('0x32')]=this[_0xa855('0x5')](_[_0xa855('0x33')](_0x2d796d[_0xa855('0x2a')],_0x462cc5['filters']),_0x53b8a2);if(_0x2d796d['query'][_0xa855('0x34')]){var _0x340f57=_0x53b8a2;var _0x590cf5=_0x2d796d['query']['filter'];if(typeof _0x590cf5===_0xa855('0x35')){_0x340f57=_[_0xa855('0x34')](_0x53b8a2,function(_0x67325){return _[_0xa855('0x1')](_0x590cf5[_0xa855('0x36')],_0x67325['name']);});_0x590cf5=_0x590cf5[_0xa855('0x37')];}_0x3d88eb[_0xa855('0x32')]=_[_0xa855('0x38')](_0x3d88eb[_0xa855('0x32')],{'$or':_[_0xa855('0x39')](_0x340f57,function(_0x276912){if(_0x276912[_0xa855('0x9')]!==_0xa855('0x3a')){if(_0x957866){return sequelize[_0xa855('0x32')](sequelize['fn'](_0xa855('0x3b'),sequelize[_0xa855('0x18')](_0x276912[_0xa855('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x2d796d[_0xa855('0x2a')][_0xa855('0x34')]+'%')});}else{var _0x3042e1={};_0x3042e1[_0x276912[_0xa855('0x10')]]={'$like':'%'+_0x2d796d['query']['filter']+'%'};return _0x3042e1;}}})});}_0x3d88eb=_['merge']({},_0x3d88eb,_0x2d796d['options']);return _0x3d88eb;}; \ No newline at end of file +var _0xb962=['isEmail','forEach','replace','push','getOptions','query','$id','intersection','model','fields','attributes','offset','order','where','pick','filter','columns','value','VIRTUAL','lower','merge','options','lodash','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','name','isArray','limit','sort','map','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','isString','hasOwnProperty','match','^[+]?[0-9]*$'];(function(_0x518ab7,_0x2b3355){var _0x3192f8=function(_0x4b64d9){while(--_0x4b64d9){_0x518ab7['push'](_0x518ab7['shift']());}};_0x3192f8(++_0x2b3355);}(_0xb962,0x88));var _0x2b96=function(_0x43b2dc,_0x42ad03){_0x43b2dc=_0x43b2dc-0x0;var _0x268ee9=_0xb962[_0x43b2dc];return _0x268ee9;};'use strict';var _=require(_0x2b96('0x0'));var sequelize=require(_0x2b96('0x1'));var moment=require(_0x2b96('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x370075){var _0x1dc7c1=['ne'];try{var _0x39c6cf=JSON[_0x2b96('0x3')](_0x370075);var _0x40947f=Object[_0x2b96('0x4')](_0x39c6cf)[0x0];return _0x1dc7c1[_0x2b96('0x5')](_0x40947f);}catch(_0x3b5c7b){return![];}}function getOperatorValue(_0x126660){var _0x5298d1=JSON[_0x2b96('0x3')](_0x126660);var _0x557574=Object['keys'](_0x5298d1)[0x0];var _0x213b19=_0x5298d1[_0x557574];return{['$'+_0x557574]:_0x213b19};}exports['fields']=function(_0xb9828a){var _0xa71181=null;if(_0xb9828a){_0xa71181=_0xb9828a[_0x2b96('0x6')](',');}return _0xa71181;};exports[_0x2b96('0x7')]=function(_0xf94e3e,_0x4a457c){var _0x4a5f63={};if(!_[_0x2b96('0x8')](_0xf94e3e)){_[_0x2b96('0x9')](_0xf94e3e,function(_0x3be3a9,_0x4379be){try{if(_0x4a457c){var _0x1bf1c2=_['find'](_0x4a457c,{'name':_0x4379be})||{};if(hasSequelizeOperator(_0x3be3a9)){_0x4a5f63[_0x4379be]=getOperatorValue(_0x3be3a9);}else if(_0x1bf1c2[_0x2b96('0xa')]===_0x2b96('0xb')&&_[_0x2b96('0xc')](_0x3be3a9)){var _0x142e41=JSON['parse'](_0x3be3a9);var _0x46b399={'$gte':moment(moment(_0x142e41['$gte'])[_0x2b96('0xd')](_0x2b96('0xe')))['utc']()[_0x2b96('0xd')](),'$lte':moment(moment(_0x142e41['$lte'])['format'](_0x2b96('0xe')))[_0x2b96('0xf')]()['subtract'](0x1,'s')[_0x2b96('0xd')]()};_0x4a5f63[_0x4379be]=_0x46b399;}else if(_0x1bf1c2[_0x2b96('0x10')]==='uniqueid'){_0x4a5f63[_0x4379be]=_0x3be3a9;}else{_0x4a5f63[_0x4379be]=_[_0x2b96('0x11')](_0x3be3a9)?_0x3be3a9:JSON[_0x2b96('0x3')](_0x3be3a9);}}else{_0x4a5f63[_0x4379be]=_['isArray'](_0x3be3a9)?_0x3be3a9:JSON[_0x2b96('0x3')](_0x3be3a9);}}catch(_0x476c5c){_0x4a5f63[_0x4379be]=_0x3be3a9[_0x2b96('0x6')](',');}});}return _0x4a5f63;};exports[_0x2b96('0x12')]=function(_0x3e6cd5){_0x3e6cd5=parseInt(_0x3e6cd5,0xa);if(!_0x3e6cd5||_0x3e6cd5<0x0){_0x3e6cd5=LIMIT_VALUE;}return _0x3e6cd5;};exports['offset']=function(_0x128bf2){_0x128bf2=parseInt(_0x128bf2,0xa);if(!_0x128bf2||_0x128bf2<0x0){_0x128bf2=0x0;}return _0x128bf2;};exports[_0x2b96('0x13')]=function(_0x81ecfc){var _0x51998f,_0x4d66a8=null;if(_0x81ecfc){_0x51998f=_0x81ecfc['split'](',');_0x4d66a8=_[_0x2b96('0x14')](_0x51998f,function(_0x4b12fa){if(_0x4b12fa['indexOf']('-')===0x0){return[_0x4b12fa===_0x2b96('0x15')?sequelize['cast'](sequelize[_0x2b96('0x16')](_0x2b96('0x15')),_0x2b96('0x17')):_0x4b12fa[_0x2b96('0x18')](0x1),_0x2b96('0x19')];}else{return[_0x4b12fa==='priority'?sequelize[_0x2b96('0x1a')](sequelize[_0x2b96('0x16')]('priority'),_0x2b96('0x17')):_0x4b12fa,_0x2b96('0x1b')];}});}return _0x4d66a8;};exports[_0x2b96('0x1c')]=function(_0x53be97,_0x4b1472){if(_[_0x2b96('0x8')](_0x53be97)){return _0x53be97;}if(_['isArray'](_0x53be97)){for(var _0x5e1385=0x0;_0x5e1385<_0x53be97[_0x2b96('0x1d')];_0x5e1385+=0x1){_0x53be97[_0x5e1385]=this[_0x2b96('0x1c')](_0x53be97[_0x5e1385],_0x4b1472);}return _0x53be97;}if(!_[_0x2b96('0x1e')](_0x53be97)){return _0x53be97;}if(_[_0x2b96('0x1f')](_0x4b1472)){_0x4b1472=[_0x4b1472];}if(!_[_0x2b96('0x11')](_0x4b1472)){return _0x53be97;}for(var _0x5d84de=0x0;_0x5d84de<_0x4b1472[_0x2b96('0x1d')];_0x5d84de+=0x1){_['unset'](_0x53be97,_0x4b1472[_0x5d84de]);}for(var _0x324e7f in _0x53be97){if(_0x53be97[_0x2b96('0x20')](_0x324e7f)){_0x53be97[_0x324e7f]=this['omit'](_0x53be97[_0x324e7f],_0x4b1472);}}return _0x53be97;};exports['isNumeric']=function(_0x526de4){return _0x526de4[_0x2b96('0x21')](RegExp(_0x2b96('0x22')))?!![]:![];};exports[_0x2b96('0x23')]=function(_0x836083){return _0x836083[_0x2b96('0x21')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3b956f){var _0x3be983=[];_0x3b956f[_0x2b96('0x6')](/[ ,]+/)[_0x2b96('0x24')](function(_0x556872){_0x556872=_0x556872[_0x2b96('0x25')](/([^:]")"+/g,'$1');_0x556872='+'+_0x556872+'*';if(_0x556872['includes']('@'))_0x556872='\x22'+_0x556872+'\x22';_0x3be983[_0x2b96('0x26')](_0x556872);});return _0x3be983['join']('\x20');};exports[_0x2b96('0x27')]=function(_0x524361,_0x3fa5b6,_0x36a10c){var _0x38a8d8={},_0x5cc206={};if(_0x3fa5b6[_0x2b96('0x28')][_0x2b96('0x29')]){_0x3fa5b6['query']['id']=_0x3fa5b6['query']['$id'];delete _0x3fa5b6[_0x2b96('0x28')][_0x2b96('0x29')];}_0x38a8d8['model']=_[_0x2b96('0x14')](_0x524361,'name');_0x38a8d8[_0x2b96('0x28')]=_[_0x2b96('0x4')](_0x3fa5b6[_0x2b96('0x28')]);_0x38a8d8[_0x2b96('0x7')]=_[_0x2b96('0x2a')](_0x38a8d8[_0x2b96('0x2b')],_0x38a8d8['query']);_0x5cc206['attributes']=_[_0x2b96('0x2a')](_0x38a8d8[_0x2b96('0x2b')],this[_0x2b96('0x2c')](_0x3fa5b6[_0x2b96('0x28')]['fields']));_0x5cc206['attributes']=_0x5cc206['attributes'][_0x2b96('0x1d')]?_0x5cc206[_0x2b96('0x2d')]:_0x38a8d8['model'];if(!_0x3fa5b6[_0x2b96('0x28')][_0x2b96('0x20')]('nolimit')){_0x5cc206[_0x2b96('0x12')]=this['limit'](_0x3fa5b6['query'][_0x2b96('0x12')]);_0x5cc206[_0x2b96('0x2e')]=this[_0x2b96('0x2e')](_0x3fa5b6[_0x2b96('0x28')][_0x2b96('0x2e')]);}_0x5cc206[_0x2b96('0x2f')]=this[_0x2b96('0x13')](_0x3fa5b6[_0x2b96('0x28')][_0x2b96('0x13')]);_0x5cc206[_0x2b96('0x30')]=this['filters'](_[_0x2b96('0x31')](_0x3fa5b6[_0x2b96('0x28')],_0x38a8d8[_0x2b96('0x7')]),_0x524361);if(_0x3fa5b6[_0x2b96('0x28')][_0x2b96('0x32')]){var _0x541753=_0x524361;var _0x122b5a=_0x3fa5b6[_0x2b96('0x28')]['filter'];if(typeof _0x122b5a==='object'){_0x541753=_[_0x2b96('0x32')](_0x524361,function(_0x576870){return _['includes'](_0x122b5a[_0x2b96('0x33')],_0x576870[_0x2b96('0x10')]);});_0x122b5a=_0x122b5a[_0x2b96('0x34')];}_0x5cc206[_0x2b96('0x30')]=_['merge'](_0x5cc206['where'],{'$or':_[_0x2b96('0x14')](_0x541753,function(_0x4a4851){if(_0x4a4851[_0x2b96('0xa')]!==_0x2b96('0x35')){if(_0x36a10c){return sequelize[_0x2b96('0x30')](sequelize['fn'](_0x2b96('0x36'),sequelize['col'](_0x4a4851['name'])),{'$like':sequelize['fn'](_0x2b96('0x36'),'%'+_0x3fa5b6[_0x2b96('0x28')][_0x2b96('0x32')]+'%')});}else{var _0x32e05f={};_0x32e05f[_0x4a4851[_0x2b96('0x10')]]={'$like':'%'+_0x3fa5b6['query']['filter']+'%'};return _0x32e05f;}}})});}_0x5cc206=_[_0x2b96('0x37')]({},_0x5cc206,_0x3fa5b6[_0x2b96('0x38')]);return _0x5cc206;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b101e41..5a5aeef 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac5d=['50mb','json','initialize','express','serve-favicon','method-override','cookie-parser','cors','moment','./environment','../mysqldb','default','get','env','root','public','test','appPath','join','client','use','json\x20replacer','split','static','set','/server/views','engine','ejs','renderFile','view\x20engine','html','urlencoded'];(function(_0x5bec42,_0xe1a92a){var _0x4fca51=function(_0x26408d){while(--_0x26408d){_0x5bec42['push'](_0x5bec42['shift']());}};_0x4fca51(++_0xe1a92a);}(_0xac5d,0x163));var _0xdac5=function(_0x22df9f,_0x9ec477){_0x22df9f=_0x22df9f-0x0;var _0x4ed906=_0xac5d[_0x22df9f];return _0x4ed906;};'use strict';var express=require(_0xdac5('0x0'));var favicon=require(_0xdac5('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0xdac5('0x2'));var cookieParser=require(_0xdac5('0x3'));var errorHandler=require('errorhandler');var path=require('path');var passport=require('passport');var cors=require(_0xdac5('0x4'));var moment=require(_0xdac5('0x5'));var config=require(_0xdac5('0x6'));var db=require(_0xdac5('0x7'))['db'];exports[_0xdac5('0x8')]=function(_0xca0803){var _0x22a3f7=_0xca0803[_0xdac5('0x9')](_0xdac5('0xa'));if(_0x22a3f7==='production'){_0xca0803['set']('appPath',path['join'](config[_0xdac5('0xb')],_0xdac5('0xc')));}if(_0x22a3f7==='development'||_0x22a3f7===_0xdac5('0xd')){_0xca0803['set'](_0xdac5('0xe'),path[_0xdac5('0xf')](config[_0xdac5('0xb')],_0xdac5('0x10')));_0xca0803[_0xdac5('0x11')](errorHandler());}_0xca0803['set'](_0xdac5('0x12'),function(_0x1783f4,_0xa623d2){if(this[_0x1783f4]instanceof Date){_0xa623d2=this[_0x1783f4]['toISOString']()[_0xdac5('0x13')]('.')[0x0]+'Z';}return _0xa623d2;});_0xca0803['use'](express[_0xdac5('0x14')](_0xca0803[_0xdac5('0x9')](_0xdac5('0xe'))));_0xca0803[_0xdac5('0x15')]('views',config[_0xdac5('0xb')]+_0xdac5('0x16'));_0xca0803[_0xdac5('0x17')]('html',require(_0xdac5('0x18'))[_0xdac5('0x19')]);_0xca0803[_0xdac5('0x15')](_0xdac5('0x1a'),_0xdac5('0x1b'));_0xca0803[_0xdac5('0x11')](bodyParser[_0xdac5('0x1c')]({'limit':_0xdac5('0x1d'),'extended':!![]}));_0xca0803[_0xdac5('0x11')](bodyParser[_0xdac5('0x1e')]({'limit':_0xdac5('0x1d')}));_0xca0803[_0xdac5('0x11')](cors());_0xca0803[_0xdac5('0x11')](methodOverride());_0xca0803[_0xdac5('0x11')](cookieParser());_0xca0803[_0xdac5('0x11')](passport[_0xdac5('0x1f')]());}; \ No newline at end of file +var _0x4c57=['/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','cors','./environment','../mysqldb','default','get','set','appPath','join','root','public','development','test','client','use','json\x20replacer','toISOString','split','static','views'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x4c57,0x72));var _0x74c5=function(_0x177856,_0xbaa620){_0x177856=_0x177856-0x0;var _0x3355ab=_0x4c57[_0x177856];return _0x3355ab;};'use strict';var express=require(_0x74c5('0x0'));var favicon=require(_0x74c5('0x1'));var bodyParser=require(_0x74c5('0x2'));var methodOverride=require(_0x74c5('0x3'));var cookieParser=require(_0x74c5('0x4'));var errorHandler=require(_0x74c5('0x5'));var path=require(_0x74c5('0x6'));var passport=require('passport');var cors=require(_0x74c5('0x7'));var moment=require('moment');var config=require(_0x74c5('0x8'));var db=require(_0x74c5('0x9'))['db'];exports[_0x74c5('0xa')]=function(_0x27b78f){var _0x562bb1=_0x27b78f[_0x74c5('0xb')]('env');if(_0x562bb1==='production'){_0x27b78f[_0x74c5('0xc')](_0x74c5('0xd'),path[_0x74c5('0xe')](config[_0x74c5('0xf')],_0x74c5('0x10')));}if(_0x562bb1===_0x74c5('0x11')||_0x562bb1===_0x74c5('0x12')){_0x27b78f[_0x74c5('0xc')]('appPath',path[_0x74c5('0xe')](config[_0x74c5('0xf')],_0x74c5('0x13')));_0x27b78f[_0x74c5('0x14')](errorHandler());}_0x27b78f['set'](_0x74c5('0x15'),function(_0x440385,_0x5434a7){if(this[_0x440385]instanceof Date){_0x5434a7=this[_0x440385][_0x74c5('0x16')]()[_0x74c5('0x17')]('.')[0x0]+'Z';}return _0x5434a7;});_0x27b78f['use'](express[_0x74c5('0x18')](_0x27b78f['get'](_0x74c5('0xd'))));_0x27b78f['set'](_0x74c5('0x19'),config[_0x74c5('0xf')]+_0x74c5('0x1a'));_0x27b78f[_0x74c5('0x1b')](_0x74c5('0x1c'),require(_0x74c5('0x1d'))[_0x74c5('0x1e')]);_0x27b78f[_0x74c5('0xc')](_0x74c5('0x1f'),_0x74c5('0x1c'));_0x27b78f[_0x74c5('0x14')](bodyParser[_0x74c5('0x20')]({'limit':_0x74c5('0x21'),'extended':!![]}));_0x27b78f[_0x74c5('0x14')](bodyParser['json']({'limit':_0x74c5('0x21')}));_0x27b78f[_0x74c5('0x14')](cors());_0x27b78f[_0x74c5('0x14')](methodOverride());_0x27b78f[_0x74c5('0x14')](cookieParser());_0x27b78f[_0x74c5('0x14')](passport[_0x74c5('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d219df7..67b1ca8 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 _0xdbd8=['00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','hex','substring','lodash','crypto','child_process','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0xdbd8,0xc4));var _0x8dbd=function(_0x9e4333,_0x3828a7){_0x9e4333=_0x9e4333-0x0;var _0xc426ea=_0xdbd8[_0x9e4333];return _0xc426ea;};'use strict';var _=require(_0x8dbd('0x0'));var os=require('os');var crypto=require(_0x8dbd('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x8dbd('0x2'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x4f280a=[];var _0x4da5ae=os[_0x8dbd('0x3')]();var _0x125fce=_[_0x8dbd('0x4')](_[_0x8dbd('0x5')](_0x4da5ae));for(var _0x4ca8bd=0x0;_0x4ca8bd<_0x125fce[_0x8dbd('0x6')];_0x4ca8bd++){var _0x301397=_0x4da5ae[_0x125fce[_0x4ca8bd]][_0x8dbd('0x7')](function(_0x3dc101){return _0x3dc101[_0x8dbd('0x8')]===_0x8dbd('0x9')&&_0x3dc101[_0x8dbd('0xa')]===![];});_0x4f280a=_0x4f280a[_0x8dbd('0xb')](_0x301397);}return _0x4f280a;}function getFirstInterface(){var _0x40def0=_[_0x8dbd('0xc')](getInterfaces());return{'macAddress':_0x40def0&&_0x40def0['mac']?_0x40def0[_0x8dbd('0xd')]:_0x8dbd('0xe'),'ipAddress':_0x40def0&&_0x40def0[_0x8dbd('0xf')]?_0x40def0[_0x8dbd('0xf')]:_0x8dbd('0x10')};}exports[_0x8dbd('0x11')]=getFirstInterface;function getCPUhash(){var _0x5d36be=_[_0x8dbd('0x4')](os[_0x8dbd('0x12')]()['map'](function(_0x254314){return _0x254314[_0x8dbd('0x13')];}))['join'](':');return crypto[_0x8dbd('0x14')](_0x8dbd('0x15'))[_0x8dbd('0x16')](_0x5d36be)[_0x8dbd('0x17')]('hex');}exports[_0x8dbd('0x18')]=function(){var _0x4130e5=os[_0x8dbd('0x19')]();var _0x117305=/[0-9a-f-]{36}/;if(config[_0x8dbd('0x1a')]&&_0x117305[_0x8dbd('0x1b')](config[_0x8dbd('0x1a')])){return config[_0x8dbd('0x1a')];}else if(_0x4130e5===_0x8dbd('0x1c')){return exec(_0x8dbd('0x1d'),{'encoding':'utf8'})[_0x8dbd('0x1e')]('\x0d\x0a','');}else{var _0x2355da=getFirstInterface();var _0x39468a=getCPUhash();var _0x702437=_0x39468a+'|'+os[_0x8dbd('0x1f')]()+'|'+_0x2355da[_0x8dbd('0x20')]+'|'+_0x2355da['ipAddress'];var _0x516376=crypto[_0x8dbd('0x14')](_0x8dbd('0x15'))['update'](_0x702437)[_0x8dbd('0x17')](_0x8dbd('0x21'));return _0x516376[_0x8dbd('0x22')](0x0,0x8)+'-'+_0x516376[_0x8dbd('0x22')](0x8,0xc)+'-'+_0x516376[_0x8dbd('0x22')](0xc,0x10)+'-'+_0x516376[_0x8dbd('0x22')](0x10,0x14)+'-'+_0x516376['substring'](0x14);}}; \ No newline at end of file +var _0x17ce=['00:00:00:00:00:00','address','127.0.0.1','cpus','model','join','createHash','md5','update','digest','hex','getUuid','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','concat','head','mac'];(function(_0x1d534a,_0x21910c){var _0x15e244=function(_0x1df3a0){while(--_0x1df3a0){_0x1d534a['push'](_0x1d534a['shift']());}};_0x15e244(++_0x21910c);}(_0x17ce,0x109));var _0xe17c=function(_0x4e3e78,_0x2d6c17){_0x4e3e78=_0x4e3e78-0x0;var _0x18c794=_0x17ce[_0x4e3e78];return _0x18c794;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xe17c('0x0'));var machine=require(_0xe17c('0x1'));var exec=require(_0xe17c('0x2'))[_0xe17c('0x3')];var config=require(_0xe17c('0x4'));function getInterfaces(){var _0x124d37=[];var _0x58f844=os[_0xe17c('0x5')]();var _0x3c384a=_[_0xe17c('0x6')](_[_0xe17c('0x7')](_0x58f844));for(var _0x18b6e1=0x0;_0x18b6e1<_0x3c384a[_0xe17c('0x8')];_0x18b6e1++){var _0x59e131=_0x58f844[_0x3c384a[_0x18b6e1]][_0xe17c('0x9')](function(_0x4569ff){return _0x4569ff['family']===_0xe17c('0xa')&&_0x4569ff[_0xe17c('0xb')]===![];});_0x124d37=_0x124d37[_0xe17c('0xc')](_0x59e131);}return _0x124d37;}function getFirstInterface(){var _0x22f2be=_[_0xe17c('0xd')](getInterfaces());return{'macAddress':_0x22f2be&&_0x22f2be[_0xe17c('0xe')]?_0x22f2be[_0xe17c('0xe')]:_0xe17c('0xf'),'ipAddress':_0x22f2be&&_0x22f2be[_0xe17c('0x10')]?_0x22f2be[_0xe17c('0x10')]:_0xe17c('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x13f47d=_[_0xe17c('0x6')](os[_0xe17c('0x12')]()['map'](function(_0x21eb68){return _0x21eb68[_0xe17c('0x13')];}))[_0xe17c('0x14')](':');return crypto[_0xe17c('0x15')](_0xe17c('0x16'))[_0xe17c('0x17')](_0x13f47d)[_0xe17c('0x18')](_0xe17c('0x19'));}exports[_0xe17c('0x1a')]=function(){var _0x165c02=os['platform']();var _0x25e7f9=/[0-9a-f-]{36}/;if(config[_0xe17c('0x1b')]&&_0x25e7f9['test'](config[_0xe17c('0x1b')])){return config[_0xe17c('0x1b')];}else if(_0x165c02===_0xe17c('0x1c')){return exec(_0xe17c('0x1d'),{'encoding':_0xe17c('0x1e')})[_0xe17c('0x1f')]('\x0d\x0a','');}else{var _0x3db247=getFirstInterface();var _0x2d3438=getCPUhash();var _0x3f4a95=_0x2d3438+'|'+os[_0xe17c('0x20')]()+'|'+_0x3db247['macAddress']+'|'+_0x3db247[_0xe17c('0x21')];var _0x364434=crypto[_0xe17c('0x15')](_0xe17c('0x16'))[_0xe17c('0x17')](_0x3f4a95)[_0xe17c('0x18')](_0xe17c('0x19'));return _0x364434[_0xe17c('0x22')](0x0,0x8)+'-'+_0x364434['substring'](0x8,0xc)+'-'+_0x364434[_0xe17c('0x22')](0xc,0x10)+'-'+_0x364434[_0xe17c('0x22')](0x10,0x14)+'-'+_0x364434[_0xe17c('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7733882..6a8713d 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 _0xb17c=['toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','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'];(function(_0x4ca65f,_0x48906c){var _0x1b193c=function(_0xec2461){while(--_0xec2461){_0x4ca65f['push'](_0x4ca65f['shift']());}};_0x1b193c(++_0x48906c);}(_0xb17c,0x1e7));var _0xcb17=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xb17c[_0x2112d4];return _0x434972;};'use strict';var util=require(_0xcb17('0x0'));var moment=require(_0xcb17('0x1'));var rp=require(_0xcb17('0x2'));var BPromise=require(_0xcb17('0x3'));var pkginfo=require(_0xcb17('0x4'))(module,_0xcb17('0x5'));var db=require(_0xcb17('0x6'))['db'];var encryptor=require(_0xcb17('0x7'));var hardware=require(_0xcb17('0x8'));var logger=require('../logger')(_0xcb17('0x9'));var HOST=_0xcb17('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x94da63){return new BPromise(function(_0x353800,_0x48afdb){var _0x279b52=util[_0xcb17('0xb')](_0xcb17('0xc'),HOST,_0x94da63,module[_0xcb17('0xd')][_0xcb17('0x5')]);if(oldToken){_0x279b52=util[_0xcb17('0xb')](_0xcb17('0xe'),HOST,_0x94da63,module['exports'][_0xcb17('0x5')],oldToken);}var _0x26983c={'uri':_0x279b52,'method':_0xcb17('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x26983c)[_0xcb17('0x10')](function(_0x4f960d){_0x353800(_0x4f960d);})[_0xcb17('0x11')](function(_0x5a7f82){_0x48afdb(_0x5a7f82);});});}function manageLicense(_0x52306f,_0x442ab7){var _0x7acd9a=_0x442ab7[_0xcb17('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x7acd9a[_0xcb17('0x13')]!==_0x52306f&&!_0x7acd9a[_0xcb17('0x14')]){oldToken=_0x7acd9a[_0xcb17('0x13')];}httpRequest(_0x52306f)[_0xcb17('0x10')](function(_0x144ae7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x144ae7['active']){isOldTokenSent=![];if(!_0x7acd9a[_0xcb17('0x9')]&&_0x7acd9a[_0xcb17('0x9')]!=_0x144ae7[_0xcb17('0x9')]||_0x7acd9a['license']&&_0x7acd9a[_0xcb17('0x14')]){logger[_0xcb17('0x15')](_0xcb17('0x16'));}if(_0x7acd9a[_0xcb17('0x9')]&&!_0x7acd9a[_0xcb17('0x14')]&&_0x7acd9a[_0xcb17('0x9')]!=_0x144ae7['license']){logger[_0xcb17('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x7acd9a[_0xcb17('0x9')]&&!_0x7acd9a[_0xcb17('0x14')]&&_0x7acd9a['license']==_0x144ae7[_0xcb17('0x9')]){return _0x442ab7;}return _0x442ab7[_0xcb17('0x17')]({'data1':_0x52306f,'data2':null,'license':_0x144ae7['license']});}else{if(_0x144ae7[_0xcb17('0x9')]||_0x7acd9a[_0xcb17('0x9')]){if(!_0x7acd9a[_0xcb17('0x14')]){if(_0x7acd9a['data1']==_0x52306f){GRAY_PERIOD_REASON=_0xcb17('0x18');logger['info'](_0xcb17('0x19'));}else{GRAY_PERIOD_REASON=_0xcb17('0x1a');logger[_0xcb17('0x15')](_0xcb17('0x1b'),_0x7acd9a[_0xcb17('0x13')],_0x52306f);}logger[_0xcb17('0x15')](_0xcb17('0x1c'),GRAY_PERIOD_REASON[_0xcb17('0x1d')](),moment()[_0xcb17('0xb')](_0xcb17('0x1e')));return _0x442ab7['update']({'data2':encryptor[_0xcb17('0x1f')](moment()[_0xcb17('0xb')](_0xcb17('0x1e')))});}else{if(moment()[_0xcb17('0x20')](encryptor[_0xcb17('0x21')](_0x7acd9a[_0xcb17('0x14')]),_0xcb17('0x22'))>DAYS){logger[_0xcb17('0x15')](_0xcb17('0x23'),moment()[_0xcb17('0xb')](_0xcb17('0x1e')));isOldTokenSent=![];return _0x442ab7[_0xcb17('0x17')]({'data1':_0x52306f,'data2':null,'license':null});}}}else{if(_0x7acd9a[_0xcb17('0x13')]!=_0x52306f){logger['info'](_0xcb17('0x1b'),_0x7acd9a['data1'],_0x52306f);return _0x442ab7[_0xcb17('0x17')]({'data1':_0x52306f,'data2':null,'license':null});}}}return _0x442ab7;})[_0xcb17('0x10')](function(_0x3cced0){_0x442ab7=_0x3cced0;})['catch'](function(_0x412932){logger[_0xcb17('0x24')](_0x412932[_0xcb17('0x25')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xcb17('0x26')](),_0x442ab7);},TIME);});}function defaultLicense(){var _0x36c580=hardware[_0xcb17('0x26')]();if(_0x36c580){return db[_0xcb17('0x27')][_0xcb17('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x36c580}})[_0xcb17('0x29')](function(_0x158092,_0x57b689){logger[_0xcb17('0x15')](_0xcb17('0x2a'),_0x36c580);manageLicense(_0x36c580,_0x158092);})[_0xcb17('0x11')](function(_0x561ea6){logger[_0xcb17('0x24')](_0x561ea6[_0xcb17('0x25')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xc480=['util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','GET','get','data1','then','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','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','encryptString','days','update','catch','error','message','finally','getUuid','findOrCreate','default'];(function(_0x16ce08,_0x4ed328){var _0x1a293e=function(_0x5e0836){while(--_0x5e0836){_0x16ce08['push'](_0x16ce08['shift']());}};_0x1a293e(++_0x4ed328);}(_0xc480,0xbe));var _0x0c48=function(_0x4c253f,_0x4e2331){_0x4c253f=_0x4c253f-0x0;var _0x142c0d=_0xc480[_0x4c253f];return _0x142c0d;};'use strict';var util=require(_0x0c48('0x0'));var moment=require(_0x0c48('0x1'));var rp=require(_0x0c48('0x2'));var BPromise=require(_0x0c48('0x3'));var pkginfo=require(_0x0c48('0x4'))(module,_0x0c48('0x5'));var db=require(_0x0c48('0x6'))['db'];var encryptor=require(_0x0c48('0x7'));var hardware=require(_0x0c48('0x8'));var logger=require(_0x0c48('0x9'))(_0x0c48('0xa'));var HOST=_0x0c48('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x64706e){return new BPromise(function(_0x21ee42,_0x2428c4){var _0xf8e5e3=util[_0x0c48('0xc')](_0x0c48('0xd'),HOST,_0x64706e,module['exports'][_0x0c48('0x5')]);if(oldToken){_0xf8e5e3=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x64706e,module['exports']['version'],oldToken);}var _0x3cbd16={'uri':_0xf8e5e3,'method':_0x0c48('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3cbd16)['then'](function(_0x53e63b){_0x21ee42(_0x53e63b);})['catch'](function(_0x5e1163){_0x2428c4(_0x5e1163);});});}function manageLicense(_0x2230f9,_0x29cd21){var _0x4202b3=_0x29cd21[_0x0c48('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x4202b3[_0x0c48('0x10')]!==_0x2230f9&&!_0x4202b3['data2']){oldToken=_0x4202b3[_0x0c48('0x10')];}httpRequest(_0x2230f9)[_0x0c48('0x11')](function(_0x3ff75a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3ff75a[_0x0c48('0x12')]){isOldTokenSent=![];if(!_0x4202b3[_0x0c48('0xa')]&&_0x4202b3['license']!=_0x3ff75a[_0x0c48('0xa')]||_0x4202b3[_0x0c48('0xa')]&&_0x4202b3[_0x0c48('0x13')]){logger[_0x0c48('0x14')](_0x0c48('0x15'));}if(_0x4202b3[_0x0c48('0xa')]&&!_0x4202b3['data2']&&_0x4202b3[_0x0c48('0xa')]!=_0x3ff75a[_0x0c48('0xa')]){logger[_0x0c48('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4202b3[_0x0c48('0xa')]&&!_0x4202b3['data2']&&_0x4202b3[_0x0c48('0xa')]==_0x3ff75a[_0x0c48('0xa')]){return _0x29cd21;}return _0x29cd21['update']({'data1':_0x2230f9,'data2':null,'license':_0x3ff75a[_0x0c48('0xa')]});}else{if(_0x3ff75a[_0x0c48('0xa')]||_0x4202b3[_0x0c48('0xa')]){if(!_0x4202b3['data2']){if(_0x4202b3[_0x0c48('0x10')]==_0x2230f9){GRAY_PERIOD_REASON=_0x0c48('0x16');logger['info'](_0x0c48('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x0c48('0x14')](_0x0c48('0x18'),_0x4202b3[_0x0c48('0x10')],_0x2230f9);}logger['info'](_0x0c48('0x19'),GRAY_PERIOD_REASON[_0x0c48('0x1a')](),moment()[_0x0c48('0xc')](_0x0c48('0x1b')));return _0x29cd21['update']({'data2':encryptor[_0x0c48('0x1c')](moment()[_0x0c48('0xc')](_0x0c48('0x1b')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x4202b3[_0x0c48('0x13')]),_0x0c48('0x1d'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x0c48('0xc')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x29cd21[_0x0c48('0x1e')]({'data1':_0x2230f9,'data2':null,'license':null});}}}else{if(_0x4202b3[_0x0c48('0x10')]!=_0x2230f9){logger[_0x0c48('0x14')](_0x0c48('0x18'),_0x4202b3[_0x0c48('0x10')],_0x2230f9);return _0x29cd21['update']({'data1':_0x2230f9,'data2':null,'license':null});}}}return _0x29cd21;})[_0x0c48('0x11')](function(_0x25f1ce){_0x29cd21=_0x25f1ce;})[_0x0c48('0x1f')](function(_0x48cd22){logger[_0x0c48('0x20')](_0x48cd22[_0x0c48('0x21')]);})[_0x0c48('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x0c48('0x23')](),_0x29cd21);},TIME);});}function defaultLicense(){var _0x572bfd=hardware[_0x0c48('0x23')]();if(_0x572bfd){return db['License'][_0x0c48('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x572bfd}})['spread'](function(_0x3b2c35,_0x418f94){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x572bfd);manageLicense(_0x572bfd,_0x3b2c35);})[_0x0c48('0x1f')](function(_0x4387aa){logger['error'](_0x4387aa[_0x0c48('0x21')]);});}}exports[_0x0c48('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index d0eeddb..0787c7c 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 _0x3d2a=['disabled','message','User','findAll','role','COUNT','sequelize','col','count','admin','user','users','telephones','forEach','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','util','lodash','moment','bluebird','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','defaults','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','days'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x3d2a,0x9c));var _0xa3d2=function(_0x36921f,_0x3d8888){_0x36921f=_0x36921f-0x0;var _0x2a20bb=_0x3d2a[_0x36921f];return _0x2a20bb;};'use strict';var util=require(_0xa3d2('0x0'));var _=require(_0xa3d2('0x1'));var moment=require(_0xa3d2('0x2'));var BPromise=require(_0xa3d2('0x3'));var hardware=require(_0xa3d2('0x4'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa3d2('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa3d2('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa3d2('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa3d2('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5dc516){return new BPromise(function(_0x231f56,_0x5bbca2){return db[_0xa3d2('0x8')]['find'](_[_0xa3d2('0x9')](_0x5dc516,{'raw':!![],'where':{'id':0x1}}))[_0xa3d2('0xa')](function(_0x5a35f6){return checkLicense(_0x5a35f6,null);})[_0xa3d2('0xa')](function(_0x41b3f8){_0x231f56(_0x41b3f8);return;})[_0xa3d2('0xb')](function(_0x58f901){_0x5bbca2(_0x58f901);});});}function checkLicense(_0x213bf4,_0x2e7de8){if(!_0x213bf4){demoLicense['uuid']=_0x213bf4['data1'];return demoLicense;}try{var _0x483cb9=_0x2e7de8||_0x213bf4[_0xa3d2('0xc')];if(_[_0xa3d2('0xd')](_0x483cb9)){throw new Error(_0xa3d2('0xe'));}var _0x2e8093=_0x213bf4[_0xa3d2('0xf')];var _0x11c100=_0x213bf4[_0xa3d2('0x10')];var _0x643935=_0x2e8093['split']('-')[0x4];var _0x217ee5=_0x2e8093[_0xa3d2('0x11')]('-')[0x0];var _0x59f34e=encryptor['decryptString'](_0x483cb9,util[_0xa3d2('0x12')](_0xa3d2('0x13'),_0x643935,_0x2e8093,_0x217ee5));var _0x17a72d=JSON[_0xa3d2('0x14')](_0x59f34e);_0x17a72d[_0xa3d2('0x15')]=![];_0x17a72d[_0xa3d2('0x16')]=_0x2e8093;_0x17a72d[_0xa3d2('0x17')]=hardware['getUuid']();if(_0x11c100){var _0x526f9d=encryptor['decryptString'](_0x11c100);_0x17a72d[_0xa3d2('0x18')]=_0x526f9d;_0x17a72d[_0xa3d2('0x19')]=moment(_0x526f9d)[_0xa3d2('0x1a')](0x7,_0xa3d2('0x1b'))[_0xa3d2('0x12')]();_0x17a72d['grayReason']=_0x17a72d[_0xa3d2('0x16')]!=_0x17a72d[_0xa3d2('0x17')]?'changed':_0xa3d2('0x1c');}return _0x17a72d;}catch(_0x26cf85){breakingLicense[_0xa3d2('0x16')]=_0x213bf4[_0xa3d2('0xf')];breakingLicense[_0xa3d2('0x1d')]=_0x26cf85[_0xa3d2('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xdc556d,_0x1afc16){getLicense()[_0xa3d2('0xa')](function(_0x107a1b){return db[_0xa3d2('0x1e')][_0xa3d2('0x1f')]({'attributes':[_0xa3d2('0x20'),[db['sequelize']['fn'](_0xa3d2('0x21'),db[_0xa3d2('0x22')][_0xa3d2('0x23')](_0xa3d2('0x20'))),_0xa3d2('0x24')]],'group':_0xa3d2('0x20'),'where':{'role':{'$or':[_0xa3d2('0x25'),_0xa3d2('0x26'),'telephone']}},'raw':!![]})[_0xa3d2('0xa')](function(_0x1ff067){var _0x2dead6={'user':_0x107a1b[_0xa3d2('0x27')]||0x0,'telephone':_0x107a1b[_0xa3d2('0x28')]||0x0};_0x1ff067[_0xa3d2('0x29')](function(_0x52c2e4){var _0x53b60c=_0x52c2e4[_0xa3d2('0x20')]===_0xa3d2('0x25')?_0xa3d2('0x26'):_0x52c2e4[_0xa3d2('0x20')];_0x2dead6[_0x53b60c]-=_0x52c2e4[_0xa3d2('0x24')];if(_0x2dead6[_0x53b60c]<0x0)_0x2dead6[_0x53b60c]=0x0;});_0xdc556d(_0x2dead6);return;});})[_0xa3d2('0xb')](function(_0x4e1ec3){_0x1afc16(_0x4e1ec3);});});}function checkUserLimits(_0x5428f8){return new BPromise(function(_0x4497ec,_0x2bc6d7){getLimits()[_0xa3d2('0xa')](function(_0x324137){var _0x458e9d=_[_0xa3d2('0x2a')](_[_0xa3d2('0x2b')](_0x5428f8,_0xa3d2('0x20')),['admin',_0xa3d2('0x26'),_0xa3d2('0x2c')]);var _0x4f90da=(_0x458e9d[_0xa3d2('0x25')]||0x0)+(_0x458e9d[_0xa3d2('0x26')]||0x0);var _0x2a4a01=_0x458e9d[_0xa3d2('0x2c')]||0x0;if(_0x4f90da>_0x324137[_0xa3d2('0x26')])return _0x2bc6d7(_0xa3d2('0x2d'));if(_0x2a4a01>_0x324137[_0xa3d2('0x2c')])return _0x2bc6d7('License\x20limit\x20reached\x20for\x20telephones');return _0x4497ec();})[_0xa3d2('0xb')](function(_0x3dd684){_0x2bc6d7(_0x3dd684);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8261=['changed','disabled','message','User','role','sequelize','col','count','admin','user','users','telephones','forEach','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','./hardware','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','deadline','add','days','machineUuid'];(function(_0x1c80b4,_0x20c065){var _0x3d70c2=function(_0x51f99a){while(--_0x51f99a){_0x1c80b4['push'](_0x1c80b4['shift']());}};_0x3d70c2(++_0x20c065);}(_0x8261,0x1d3));var _0x1826=function(_0x465ded,_0x1a41f7){_0x465ded=_0x465ded-0x0;var _0x206b2e=_0x8261[_0x465ded];return _0x206b2e;};'use strict';var util=require(_0x1826('0x0'));var _=require(_0x1826('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x1826('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x1826('0x3'))['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':_0x1826('0x4'),'machineUuid':hardware[_0x1826('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1826('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1483d1){return new BPromise(function(_0x3ee88b,_0x2f7968){return db[_0x1826('0x7')]['find'](_[_0x1826('0x8')](_0x1483d1,{'raw':!![],'where':{'id':0x1}}))[_0x1826('0x9')](function(_0x2e402e){return checkLicense(_0x2e402e,null);})[_0x1826('0x9')](function(_0x1599ed){_0x3ee88b(_0x1599ed);return;})[_0x1826('0xa')](function(_0x26ccbb){_0x2f7968(_0x26ccbb);});});}function checkLicense(_0x31c755,_0x810f94){if(!_0x31c755){demoLicense[_0x1826('0xb')]=_0x31c755[_0x1826('0xc')];return demoLicense;}try{var _0x3da440=_0x810f94||_0x31c755[_0x1826('0xd')];if(_[_0x1826('0xe')](_0x3da440)){throw new Error(_0x1826('0xf'));}var _0x2ec46e=_0x31c755[_0x1826('0xc')];var _0xa17dd3=_0x31c755[_0x1826('0x10')];var _0x2a060c=_0x2ec46e[_0x1826('0x11')]('-')[0x4];var _0x4347fa=_0x2ec46e[_0x1826('0x11')]('-')[0x0];var _0x3a01af=encryptor[_0x1826('0x12')](_0x3da440,util[_0x1826('0x13')](_0x1826('0x14'),_0x2a060c,_0x2ec46e,_0x4347fa));var _0x75cc12=JSON[_0x1826('0x15')](_0x3a01af);_0x75cc12[_0x1826('0x16')]=![];_0x75cc12[_0x1826('0xb')]=_0x2ec46e;_0x75cc12['machineUuid']=hardware[_0x1826('0x5')]();if(_0xa17dd3){var _0x2b8fb2=encryptor[_0x1826('0x12')](_0xa17dd3);_0x75cc12[_0x1826('0x17')]=_0x2b8fb2;_0x75cc12[_0x1826('0x18')]=moment(_0x2b8fb2)[_0x1826('0x19')](0x7,_0x1826('0x1a'))['format']();_0x75cc12['grayReason']=_0x75cc12[_0x1826('0xb')]!=_0x75cc12[_0x1826('0x1b')]?_0x1826('0x1c'):_0x1826('0x1d');}return _0x75cc12;}catch(_0xd431ed){breakingLicense[_0x1826('0xb')]=_0x31c755[_0x1826('0xc')];breakingLicense['message']=_0xd431ed[_0x1826('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1ad333,_0x5c65c1){getLicense()[_0x1826('0x9')](function(_0x2fd554){return db[_0x1826('0x1f')]['findAll']({'attributes':[_0x1826('0x20'),[db[_0x1826('0x21')]['fn']('COUNT',db[_0x1826('0x21')][_0x1826('0x22')](_0x1826('0x20'))),_0x1826('0x23')]],'group':_0x1826('0x20'),'where':{'role':{'$or':[_0x1826('0x24'),_0x1826('0x25'),'telephone']}},'raw':!![]})[_0x1826('0x9')](function(_0x341548){var _0x4006f6={'user':_0x2fd554[_0x1826('0x26')]||0x0,'telephone':_0x2fd554[_0x1826('0x27')]||0x0};_0x341548[_0x1826('0x28')](function(_0x5e4b2d){var _0x1e850e=_0x5e4b2d[_0x1826('0x20')]===_0x1826('0x24')?'user':_0x5e4b2d[_0x1826('0x20')];_0x4006f6[_0x1e850e]-=_0x5e4b2d[_0x1826('0x23')];if(_0x4006f6[_0x1e850e]<0x0)_0x4006f6[_0x1e850e]=0x0;});_0x1ad333(_0x4006f6);return;});})[_0x1826('0xa')](function(_0x26f08a){_0x5c65c1(_0x26f08a);});});}function checkUserLimits(_0x57d34e){return new BPromise(function(_0x398787,_0x1d8698){getLimits()[_0x1826('0x9')](function(_0x573b01){var _0x461235=_['pick'](_[_0x1826('0x29')](_0x57d34e,_0x1826('0x20')),['admin',_0x1826('0x25'),'telephone']);var _0xdcdfd9=(_0x461235[_0x1826('0x24')]||0x0)+(_0x461235[_0x1826('0x25')]||0x0);var _0x5992fd=_0x461235[_0x1826('0x2a')]||0x0;if(_0xdcdfd9>_0x573b01[_0x1826('0x25')])return _0x1d8698(_0x1826('0x2b'));if(_0x5992fd>_0x573b01['telephone'])return _0x1d8698(_0x1826('0x2c'));return _0x398787();})[_0x1826('0xa')](function(_0x229c30){_0x1d8698(_0x229c30);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 4a41411..43acbfc 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 _0xe2cf=['app-id','http://localhost:9000'];(function(_0x2ed1a0,_0x36acd9){var _0x3d272e=function(_0x41460c){while(--_0x41460c){_0x2ed1a0['push'](_0x2ed1a0['shift']());}};_0x3d272e(++_0x36acd9);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x3e0600,_0x9bb3c9){_0x3e0600=_0x3e0600-0x0;var _0x5e1117=_0xe2cf[_0x3e0600];return _0x5e1117;};'use strict';module['exports']={'DOMAIN':_0xfe2c('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xfe2c('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x8f59=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8f59,0x11d));var _0x98f5=function(_0x899a7b,_0x47f3fe){_0x899a7b=_0x899a7b-0x0;var _0x501574=_0x8f59[_0x899a7b];return _0x501574;};'use strict';module[_0x98f5('0x0')]={'DOMAIN':_0x98f5('0x1'),'SESSION_SECRET':_0x98f5('0x2'),'GOOGLE_ID':_0x98f5('0x3'),'GOOGLE_SECRET':_0x98f5('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index e4ae539..46b0ad8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cf1=['%s-%s','error','transports','info','Console','env','debugLevel','winston','util','INFO','/var','log','xcally','%s-%s.log','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','File'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x0cf1,0xb6));var _0x10cf=function(_0x2dbfad,_0x2e40bd){_0x2dbfad=_0x2dbfad-0x0;var _0xba3bd5=_0x0cf1[_0x2dbfad];return _0xba3bd5;};'use strict';var moment=require('moment');var winston=require(_0x10cf('0x0'));var util=require(_0x10cf('0x1'));var path=require('path');var debugLevel=_0x10cf('0x2');function filename(_0x16c3ea,_0x2a2474){return path['join'](_0x10cf('0x3'),_0x10cf('0x4'),_0x10cf('0x5'),util['format'](_0x10cf('0x6'),_0x16c3ea,_0x2a2474));}function formatter(_0x42a4d5,_0x3aae22){_0x3aae22[_0x10cf('0x7')]=_0x3aae22[_0x10cf('0x7')]['replace'](/@@{/g,_0x10cf('0x8'))[_0x10cf('0x9')](/}@@/g,_0x10cf('0xa'))[_0x10cf('0x9')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x10cf('0xb')](_0x10cf('0xc'),moment()[_0x10cf('0xb')](_0x10cf('0xd')),_0x3aae22[_0x10cf('0xe')]['toUpperCase'](),_0x42a4d5,_0x3aae22[_0x10cf('0x7')]);}module[_0x10cf('0xf')]=function(_0x27371a){return new winston[(_0x10cf('0x10'))]({'transports':[new winston['transports'][(_0x10cf('0x11'))]({'name':util[_0x10cf('0xb')](_0x10cf('0x12'),_0x27371a,'error'),'filename':filename(_0x27371a,_0x10cf('0x13')),'level':_0x10cf('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5775f2){return formatter(_0x27371a,_0x5775f2);}}),new winston[(_0x10cf('0x14'))][(_0x10cf('0x11'))]({'name':util[_0x10cf('0xb')]('%s-%s',_0x27371a,_0x10cf('0x15')),'filename':filename(_0x27371a,_0x10cf('0x15')),'level':_0x10cf('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x159433){return formatter(_0x27371a,_0x159433);}}),new winston[(_0x10cf('0x14'))][(_0x10cf('0x16'))]({'level':process[_0x10cf('0x17')][_0x10cf('0x18')]||debugLevel,'json':![],'formatter':function(_0x514f13){return formatter(_0x27371a,_0x514f13);}})]});}; \ No newline at end of file +var _0xa618=['{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','File','%s-%s','error','transports','info','Console','env','debugLevel','util','path','INFO','join','/var','log','xcally','format','%s-%s.log','message','replace'];(function(_0x413607,_0x37df5f){var _0x6b5aa2=function(_0x3c36c4){while(--_0x3c36c4){_0x413607['push'](_0x413607['shift']());}};_0x6b5aa2(++_0x37df5f);}(_0xa618,0x77));var _0x8a61=function(_0x3ef3b0,_0x1cf3dd){_0x3ef3b0=_0x3ef3b0-0x0;var _0x196491=_0xa618[_0x3ef3b0];return _0x196491;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x8a61('0x0'));var path=require(_0x8a61('0x1'));var debugLevel=_0x8a61('0x2');function filename(_0x1968f4,_0x83adb2){return path[_0x8a61('0x3')](_0x8a61('0x4'),_0x8a61('0x5'),_0x8a61('0x6'),util[_0x8a61('0x7')](_0x8a61('0x8'),_0x1968f4,_0x83adb2));}function formatter(_0x147bfa,_0x483e40){_0x483e40['message']=_0x483e40[_0x8a61('0x9')][_0x8a61('0xa')](/@@{/g,_0x8a61('0xb'))[_0x8a61('0xa')](/}@@/g,'}}}')[_0x8a61('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x8a61('0x7')](_0x8a61('0xc'),moment()[_0x8a61('0x7')](_0x8a61('0xd')),_0x483e40[_0x8a61('0xe')][_0x8a61('0xf')](),_0x147bfa,_0x483e40[_0x8a61('0x9')]);}module[_0x8a61('0x10')]=function(_0x419227){return new winston[(_0x8a61('0x11'))]({'transports':[new winston['transports'][(_0x8a61('0x12'))]({'name':util['format'](_0x8a61('0x13'),_0x419227,_0x8a61('0x14')),'filename':filename(_0x419227,_0x8a61('0x14')),'level':_0x8a61('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x548fca){return formatter(_0x419227,_0x548fca);}}),new winston[(_0x8a61('0x15'))]['File']({'name':util['format'](_0x8a61('0x13'),_0x419227,_0x8a61('0x16')),'filename':filename(_0x419227,_0x8a61('0x16')),'level':_0x8a61('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d37c9){return formatter(_0x419227,_0x4d37c9);}}),new winston[(_0x8a61('0x15'))][(_0x8a61('0x17'))]({'level':process[_0x8a61('0x18')][_0x8a61('0x19')]||debugLevel,'json':![],'formatter':function(_0x27a0eb){return formatter(_0x419227,_0x27a0eb);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 493f354..06e80b4 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 _0x1087=['ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','express','join','../../services/express/index.js'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x1087,0x1aa));var _0x7108=function(_0x1ecb2a,_0x12a47f){_0x1ecb2a=_0x1ecb2a-0x0;var _0x532f48=_0x1087[_0x1ecb2a];return _0x532f48;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x7108('0x0'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0x2'))},{'name':_0x7108('0x3'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0x4'))},{'name':'agi','script':path[_0x7108('0x1')](__dirname,_0x7108('0x5'))},{'name':_0x7108('0x6'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0x7'))},{'name':_0x7108('0x8'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0x9'))},{'name':_0x7108('0xa'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0xb'))}]};module[_0x7108('0xc')]=config; \ No newline at end of file +var _0x1061=['xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js','../../services/ami/index.js','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x211a26,_0x4d35df){var _0x3c0ef7=function(_0x4c9a0c){while(--_0x4c9a0c){_0x211a26['push'](_0x211a26['shift']());}};_0x3c0ef7(++_0x4d35df);}(_0x1061,0x124));var _0x1106=function(_0x4cc2f1,_0xf95ae0){_0x4cc2f1=_0x4cc2f1-0x0;var _0x2eba10=_0x1061[_0x4cc2f1];return _0x2eba10;};'use strict';var path=require(_0x1106('0x0'));var os=require('os');var config={'apps':[{'name':_0x1106('0x1'),'script':path[_0x1106('0x2')](__dirname,_0x1106('0x3'))},{'name':'ami','script':path[_0x1106('0x2')](__dirname,_0x1106('0x4'))},{'name':'agi','script':path[_0x1106('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x1106('0x2')](__dirname,_0x1106('0x5'))},{'name':_0x1106('0x6'),'script':path[_0x1106('0x2')](__dirname,_0x1106('0x7'))},{'name':_0x1106('0x8'),'script':path[_0x1106('0x2')](__dirname,_0x1106('0x9'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ff10953..6b74ceb 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 _0xc630=['start','then','stop','disconnect','restart','list','describe','delete','dump','bluebird','./config'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xc630,0x153));var _0x0c63=function(_0x2e349f,_0x313c79){_0x2e349f=_0x2e349f-0x0;var _0x4a41dd=_0xc630[_0x2e349f];return _0x4a41dd;};'use strict';var pm2=require('pm2');var BPromise=require(_0x0c63('0x0'));var config=require(_0x0c63('0x1'));function connect(){return new BPromise(function(_0x10127e,_0x4ad945){return pm2['connect'](function(_0x5a9b0a){if(_0x5a9b0a){return _0x4ad945(_0x5a9b0a);}return _0x10127e('connected');});});};exports[_0x0c63('0x2')]=function(_0x1827f2){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x219b4b,_0x1bcbf7){return pm2[_0x0c63('0x2')](_0x1827f2,function(_0xccb9d6,_0x4c2a28){if(_0xccb9d6){return _0x1bcbf7(_0xccb9d6);}pm2['disconnect']();return _0x219b4b(_0x4c2a28);});});});};exports['stop']=function(_0x17a325){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0xb4f64,_0x3bc2b9){return pm2[_0x0c63('0x4')](_0x17a325,function(_0x11f3fc,_0x15eb60){if(_0x11f3fc){return _0x3bc2b9(_0x11f3fc);}pm2[_0x0c63('0x5')]();return _0xb4f64(_0x15eb60);});});});};exports[_0x0c63('0x6')]=function(_0x3d2858){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x18a791,_0x4997b0){return pm2[_0x0c63('0x6')](_0x3d2858,function(_0x12aa16,_0x75e950){if(_0x12aa16){return _0x4997b0(_0x12aa16);}pm2[_0x0c63('0x5')]();return _0x18a791(_0x75e950);});});});};exports[_0x0c63('0x7')]=function(){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x153b01,_0xb8bb28){return pm2['list'](function(_0x3ef7e4,_0x163aa8){if(_0x3ef7e4){return _0xb8bb28(_0x3ef7e4);}pm2[_0x0c63('0x5')]();return _0x153b01(_0x163aa8);});});});};exports[_0x0c63('0x8')]=function(_0x3bc04c){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x5bd9d1,_0x285e8f){return pm2[_0x0c63('0x8')](_0x3bc04c,function(_0x5f24e0,_0x2d8347){if(_0x5f24e0){return _0x285e8f(_0x5f24e0);}pm2['disconnect']();return _0x5bd9d1(_0x2d8347);});});});};exports[_0x0c63('0x9')]=function(_0x4d2309){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x3f9b61,_0x14a6fe){return pm2[_0x0c63('0x9')](_0x4d2309,function(_0x38eafa,_0x4e87bf){if(_0x38eafa){return _0x14a6fe(_0x38eafa);}pm2[_0x0c63('0x5')]();return _0x3f9b61(_0x4e87bf);});});});};exports[_0x0c63('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1b2c38,_0x1138b6){return pm2[_0x0c63('0xa')](function(_0xd49509){if(_0xd49509){return _0x1138b6(_0xd49509);}return _0x1b2c38('saved');});});});}; \ No newline at end of file +var _0xefb6=['saved','pm2','bluebird','connect','connected','start','then','stop','restart','disconnect','list','describe','delete','dump'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xefb6,0x71));var _0x6efb=function(_0xa28b1a,_0x384f4b){_0xa28b1a=_0xa28b1a-0x0;var _0x4c9b78=_0xefb6[_0xa28b1a];return _0x4c9b78;};'use strict';var pm2=require(_0x6efb('0x0'));var BPromise=require(_0x6efb('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x36ac07,_0x3cc7d2){return pm2[_0x6efb('0x2')](function(_0x226181){if(_0x226181){return _0x3cc7d2(_0x226181);}return _0x36ac07(_0x6efb('0x3'));});});};exports[_0x6efb('0x4')]=function(_0x1afd0c){return connect()[_0x6efb('0x5')](function(){return new BPromise(function(_0x15e4c6,_0x260c92){return pm2[_0x6efb('0x4')](_0x1afd0c,function(_0x42e6ff,_0x4e0234){if(_0x42e6ff){return _0x260c92(_0x42e6ff);}pm2['disconnect']();return _0x15e4c6(_0x4e0234);});});});};exports[_0x6efb('0x6')]=function(_0x54ea13){return connect()['then'](function(){return new BPromise(function(_0x1ef5d0,_0x611c71){return pm2[_0x6efb('0x6')](_0x54ea13,function(_0x45cb15,_0x524dce){if(_0x45cb15){return _0x611c71(_0x45cb15);}pm2['disconnect']();return _0x1ef5d0(_0x524dce);});});});};exports[_0x6efb('0x7')]=function(_0x509fe5){return connect()['then'](function(){return new BPromise(function(_0x18d5d0,_0x45b7c6){return pm2['restart'](_0x509fe5,function(_0x14ecdd,_0x531e4e){if(_0x14ecdd){return _0x45b7c6(_0x14ecdd);}pm2[_0x6efb('0x8')]();return _0x18d5d0(_0x531e4e);});});});};exports[_0x6efb('0x9')]=function(){return connect()[_0x6efb('0x5')](function(){return new BPromise(function(_0x48e332,_0x5e55b){return pm2[_0x6efb('0x9')](function(_0x3b962f,_0x58cd8c){if(_0x3b962f){return _0x5e55b(_0x3b962f);}pm2[_0x6efb('0x8')]();return _0x48e332(_0x58cd8c);});});});};exports[_0x6efb('0xa')]=function(_0x332274){return connect()[_0x6efb('0x5')](function(){return new BPromise(function(_0x2ec667,_0x2f9fb2){return pm2['describe'](_0x332274,function(_0x51c378,_0x5ceab3){if(_0x51c378){return _0x2f9fb2(_0x51c378);}pm2[_0x6efb('0x8')]();return _0x2ec667(_0x5ceab3);});});});};exports[_0x6efb('0xb')]=function(_0x449c9c){return connect()['then'](function(){return new BPromise(function(_0x2f2897,_0x131454){return pm2['delete'](_0x449c9c,function(_0x15e6fd,_0x4f9e84){if(_0x15e6fd){return _0x131454(_0x15e6fd);}pm2[_0x6efb('0x8')]();return _0x2f2897(_0x4f9e84);});});});};exports[_0x6efb('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5c34a6,_0x5f0faf){return pm2[_0x6efb('0xc')](function(_0x38d626){if(_0x38d626){return _0x5f0faf(_0x38d626);}return _0x5c34a6(_0x6efb('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 4c073d9..acb6206 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 _0x8387=['[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x8387,0x15a));var _0x7838=function(_0x3c27df,_0xc6d32b){_0x3c27df=_0x3c27df-0x0;var _0x56f1f0=_0x8387[_0x3c27df];return _0x56f1f0;};'use strict';var _=require(_0x7838('0x0'));var moment=require(_0x7838('0x1'));var Redis=require(_0x7838('0x2'));var util=require(_0x7838('0x3'));var config=require(_0x7838('0x4'));var db=require(_0x7838('0x5'))['db'];var logger=require(_0x7838('0x6'))(_0x7838('0x7'));config[_0x7838('0x8')]=_[_0x7838('0x9')](config['redis'],{'host':_0x7838('0xa'),'port':0x18eb});var io=require(_0x7838('0xb'))(new Redis(config[_0x7838('0x8')]));function closeInteractions(){var _0x4f3d8c=0x0;var _0x479128=[];return db[_0x7838('0xc')][_0x7838('0xd')]({'raw':!![],'attributes':['id',_0x7838('0xe')],'where':{'id':0x1}})[_0x7838('0xf')](function(_0x5d2530){_0x4f3d8c=_0x5d2530[_0x7838('0xe')];if(_0x4f3d8c){return db[_0x7838('0x10')][_0x7838('0x11')]({'raw':!![],'attributes':['id',_0x7838('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7838('0x13')](_0x5d2530[_0x7838('0xe')],_0x7838('0x14'))}}});}else{return[];}})[_0x7838('0xf')](function(_0x5927d7){if(_0x5927d7&&_0x5927d7[_0x7838('0x15')]){_0x479128=_[_0x7838('0x16')](_0x5927d7||[],'id');logger[_0x7838('0x17')](_0x7838('0x18'),_0x479128[_0x7838('0x19')]());return db[_0x7838('0x10')][_0x7838('0x1a')]({'closeReason':_0x7838('0x1b'),'disposition':_0x7838('0x1c'),'closed':!![],'closedAt':moment()[_0x7838('0x1d')](_0x7838('0x1e'))},{'where':{'id':_0x479128}});}})['then'](function(){if(_0x479128&&_0x479128[_0x7838('0x15')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x479128[_0x7838('0x19')]());for(var _0x399ce2=0x0;_0x399ce2<_0x479128[_0x7838('0x15')];_0x399ce2++){io[_0x7838('0x1f')](_0x7838('0x20'),{'id':_0x479128[_0x399ce2],'closed':!![]});}}})[_0x7838('0x21')](function(_0x5cb1ab){logger[_0x7838('0x22')](_0x7838('0x23'),_0x5cb1ab?util['inspect'](_0x5cb1ab,{'showHidden':![],'depth':null}):'');});}exports[_0x7838('0x24')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x4726=['ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','util','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','chatTimeout','then'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0x4726,0x6a));var _0x6472=function(_0x49f3a0,_0x2790b3){_0x49f3a0=_0x49f3a0-0x0;var _0x5396d8=_0x4726[_0x49f3a0];return _0x5396d8;};'use strict';var _=require('lodash');var moment=require(_0x6472('0x0'));var Redis=require('ioredis');var util=require(_0x6472('0x1'));var config=require(_0x6472('0x2'));var db=require(_0x6472('0x3'))['db'];var logger=require('../logger')('schedule');config[_0x6472('0x4')]=_[_0x6472('0x5')](config[_0x6472('0x4')],{'host':_0x6472('0x6'),'port':0x18eb});var io=require(_0x6472('0x7'))(new Redis(config[_0x6472('0x4')]));function closeInteractions(){var _0x97ffa5=0x0;var _0x4bc0be=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x6472('0x8')],'where':{'id':0x1}})[_0x6472('0x9')](function(_0x349446){_0x97ffa5=_0x349446[_0x6472('0x8')];if(_0x97ffa5){return db[_0x6472('0xa')][_0x6472('0xb')]({'raw':!![],'attributes':['id',_0x6472('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6472('0xd')](_0x349446['chatTimeout'],_0x6472('0xe'))}}});}else{return[];}})[_0x6472('0x9')](function(_0x48641a){if(_0x48641a&&_0x48641a[_0x6472('0xf')]){_0x4bc0be=_[_0x6472('0x10')](_0x48641a||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x4bc0be[_0x6472('0x11')]());return db[_0x6472('0xa')][_0x6472('0x12')]({'closeReason':'system','disposition':_0x6472('0x13'),'closed':!![],'closedAt':moment()[_0x6472('0x14')](_0x6472('0x15'))},{'where':{'id':_0x4bc0be}});}})[_0x6472('0x9')](function(){if(_0x4bc0be&&_0x4bc0be['length']){logger[_0x6472('0x16')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x4bc0be[_0x6472('0x11')]());for(var _0x59eaf8=0x0;_0x59eaf8<_0x4bc0be[_0x6472('0xf')];_0x59eaf8++){io[_0x6472('0x17')](_0x6472('0x18'),{'id':_0x4bc0be[_0x59eaf8],'closed':!![]});}}})[_0x6472('0x19')](function(_0x504bec){logger[_0x6472('0x1a')](_0x6472('0x1b'),_0x504bec?util[_0x6472('0x1c')](_0x504bec,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index cfa1ba1..c4f2f3b 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 _0xdba8=['Schedule','findAll','keys','jobs','map','keyBy','difference','intersection','length','toString','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','email','bcc','subtractUnit','../../files/reports','%s.%s','basename','extname','savename','zip','join','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id'];(function(_0x2b8a92,_0x192f64){var _0x31f0da=function(_0x208455){while(--_0x208455){_0x2b8a92['push'](_0x2b8a92['shift']());}};_0x31f0da(++_0x192f64);}(_0xdba8,0x196));var _0x8dba=function(_0x56193f,_0x21888a){_0x56193f=_0x56193f-0x0;var _0x22197f=_0xdba8[_0x56193f];return _0x22197f;};'use strict';var fs=require('fs');var util=require(_0x8dba('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x8dba('0x1'));var CronJobManager=require(_0x8dba('0x2'));var jayson=require(_0x8dba('0x3'));var BPromise=require(_0x8dba('0x4'));var logger=require(_0x8dba('0x5'))(_0x8dba('0x6'));var db=require(_0x8dba('0x7'))['db'];var analyticCustomReportController=require(_0x8dba('0x8'));var analyticDefaultReportController=require(_0x8dba('0x9'));var client=jayson[_0x8dba('0xa')][_0x8dba('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4b9319,_0x3cd0de){return function(){logger[_0x8dba('0xc')](_0x8dba('0xd'),_0x4b9319['email']);var _0x3d4d99=!![];var _0x12191c={'tls':{'rejectUnauthorized':![]}};if(_0x4b9319[_0x8dba('0xe')]['Smtp'][_0x8dba('0xf')]){_0x12191c['service']=_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')]['service'];}else{_0x12191c[_0x8dba('0x11')]=_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')][_0x8dba('0x11')];_0x12191c[_0x8dba('0x12')]=_0x4b9319['MailAccount']['Smtp']['port'];_0x12191c['secure']=_0x4b9319['MailAccount'][_0x8dba('0x10')][_0x8dba('0x13')];}if(_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')][_0x8dba('0x14')]){_0x12191c[_0x8dba('0x15')]={'user':_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')][_0x8dba('0x16')],'pass':_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')]['pass']};}var _0x262c90={'account':_0x12191c,'message':{'from':util[_0x8dba('0x17')](_0x8dba('0x18'),_0x4b9319[_0x8dba('0xe')][_0x8dba('0x19')],_0x4b9319[_0x8dba('0xe')]['email']||_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')][_0x8dba('0x16')]),'to':_0x4b9319[_0x8dba('0x1a')],'cc':_0x4b9319['cc'],'bcc':_0x4b9319[_0x8dba('0x1b')],'subject':util[_0x8dba('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x3cd0de[_0x8dba('0x19')],_0x4b9319['subtractNumber'],_0x4b9319[_0x8dba('0x1c')])}};var _0x1ce292=path['join'](__dirname,_0x8dba('0x1d'));var _0x440ba5=_0x3cd0de['savename'];var _0x4aa64e=util[_0x8dba('0x17')](_0x8dba('0x1e'),path[_0x8dba('0x1f')](_0x3cd0de['savename'],path[_0x8dba('0x20')](_0x3cd0de[_0x8dba('0x21')])),_0x8dba('0x22'));var _0x337158=path[_0x8dba('0x23')](_0x1ce292,_0x440ba5);var _0x52abe9=path[_0x8dba('0x23')](_0x1ce292,_0x4aa64e);if(fs['existsSync'](_0x337158)){_0x3cd0de['status']=_0x8dba('0x24');_0x262c90[_0x8dba('0x25')][_0x8dba('0x26')]=[{'filename':_0x440ba5,'path':_0x337158}];_0x262c90[_0x8dba('0x25')][_0x8dba('0x27')]=util[_0x8dba('0x17')](_0x8dba('0x28'),JSON[_0x8dba('0x29')](_0x3cd0de,null,0x2));}else if(fs['existsSync'](_0x52abe9)){_0x3cd0de[_0x8dba('0x2a')]=_0x8dba('0x24');_0x262c90['message'][_0x8dba('0x26')]=[{'filename':_0x4aa64e,'path':_0x52abe9}];}else{_0x262c90['message'][_0x8dba('0x27')]=_0x8dba('0x2b');if(!_0x4b9319[_0x8dba('0x2c')]){_0x3d4d99=![];logger[_0x8dba('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3d4d99){return client['request'](_0x8dba('0x2d'),_0x262c90)[_0x8dba('0x2e')](function(_0x4deb77){if(_0x4deb77[_0x8dba('0x2f')]){return logger[_0x8dba('0x2f')](_0x8dba('0x30'),JSON[_0x8dba('0x29')](_0x4deb77));}return logger['info'](_0x8dba('0x31'));})[_0x8dba('0x32')](function(_0x58c63c){return logger[_0x8dba('0x2f')](_0x8dba('0x30'),JSON[_0x8dba('0x29')](_0x58c63c));});}};}function handleError(){return function(_0x28c078){return logger[_0x8dba('0x2f')](JSON[_0x8dba('0x29')](_0x28c078));};}function handleResult(_0x2a3f0d){return function(_0x3e2341){logger[_0x8dba('0xc')]('data',JSON[_0x8dba('0x29')](_0x3e2341));if(_0x2a3f0d[_0x8dba('0xe')]&&_0x2a3f0d[_0x8dba('0xe')]['Smtp']&&!_[_0x8dba('0x33')](_0x2a3f0d[_0x8dba('0x1a')])){setTimeout(handleSendEmail(_0x2a3f0d,_0x3e2341),0x3c*0x3e8);}};}function handleJob(_0x49e73c){return function(){try{if(_[_0x8dba('0x33')](_0x49e73c[_0x8dba('0x34')])){return logger[_0x8dba('0xc')](_0x8dba('0x35'));}if(_['isNil'](_0x49e73c['subtractUnit'])){return logger[_0x8dba('0xc')](_0x8dba('0x36'));}var _0x4996f0={'startDate':moment()[_0x8dba('0x37')](_0x49e73c['subtractNumber'],_0x49e73c[_0x8dba('0x1c')])[_0x8dba('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x8dba('0x17')](_0x8dba('0x38')),'type':'scheduled','output':_0x49e73c[_0x8dba('0x39')],'name':_0x49e73c[_0x8dba('0x19')]};if(!_[_0x8dba('0x33')](_0x49e73c[_0x8dba('0x3a')])){logger['info'](_0x8dba('0x3b'),_0x49e73c['DefaultReportId']);return analyticDefaultReportController[_0x8dba('0x3c')]({'id':_0x49e73c[_0x8dba('0x3a')]},_0x4996f0)[_0x8dba('0x2e')](handleResult(_0x49e73c))[_0x8dba('0x32')](handleError());}if(!_[_0x8dba('0x33')](_0x49e73c[_0x8dba('0x3d')])){logger[_0x8dba('0xc')](_0x8dba('0x3e'),_0x49e73c[_0x8dba('0x3d')]);return analyticCustomReportController[_0x8dba('0x3c')]({'id':_0x49e73c[_0x8dba('0x3d')]},_0x4996f0)['then'](handleResult(_0x49e73c))[_0x8dba('0x32')](handleError());}}catch(_0x3de9bb){logger[_0x8dba('0x2f')](JSON[_0x8dba('0x29')](_0x3de9bb));}return logger[_0x8dba('0xc')](_0x8dba('0x3f'));};}function getJobs(_0x447a4a){var _0x5a7a0f={};if(_0x447a4a){_0x5a7a0f['id']=_0x447a4a;}return db[_0x8dba('0x40')][_0x8dba('0x41')]({'where':_0x5a7a0f,'include':[{'model':db['MailAccount'],'attributes':['id',_0x8dba('0x19'),_0x8dba('0x1a')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0x8dba('0x2e')](function(_0x5176cf){var _0x5748c1=_[_0x8dba('0x42')](manager[_0x8dba('0x43')]);var _0x56afe1=_[_0x8dba('0x44')](_0x5176cf,function(_0x787820){return _0x787820['id']['toString']();});var _0x4b7403=_[_0x8dba('0x45')](_0x5176cf,function(_0x12ee9d){return _0x12ee9d['id']['toString']();});var _0x329c1d=_0x447a4a?_0x56afe1:_[_0x8dba('0x46')](_0x56afe1,_0x5748c1);var _0x420317=_[_0x8dba('0x47')](_0x56afe1,_0x5748c1);var _0x3e5a97=_[_0x8dba('0x46')](_0x5748c1,_0x56afe1);var _0x392c92;var _0x4a8543;for(_0x392c92=0x0;_0x392c92<_0x3e5a97[_0x8dba('0x48')]&&!_0x447a4a;_0x392c92+=0x1){_0x4a8543=_0x3e5a97[_0x392c92][_0x8dba('0x49')]();if(manager['exists'](_0x4a8543)){manager[_0x8dba('0x4a')](_0x4a8543);manager[_0x8dba('0x4b')](_0x4a8543);logger[_0x8dba('0xc')](_0x8dba('0x4c'),_0x4a8543);}}logger[_0x8dba('0xc')](_0x8dba('0x4d'),JSON[_0x8dba('0x29')](_0x329c1d));for(_0x392c92=0x0;_0x392c92<_0x329c1d[_0x8dba('0x48')];_0x392c92+=0x1){_0x4a8543=_0x329c1d[_0x392c92]['toString']();logger['info']('index',_0x4a8543);if(_0x447a4a){logger[_0x8dba('0xc')](_0x8dba('0x4e'),_0x447a4a);logger[_0x8dba('0xc')](JSON['stringify'](_0x4b7403[_0x4a8543]));BPromise[_0x8dba('0x4f')]()[_0x8dba('0x2e')](handleJob(_0x4b7403[_0x4a8543]));logger[_0x8dba('0xc')](_0x8dba('0x50'),_0x4b7403[_0x4a8543][_0x8dba('0x19')],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}else if(_0x4b7403[_0x4a8543]['cron']&&_0x4b7403[_0x4a8543][_0x8dba('0x52')]&&moment()[_0x8dba('0x53')](_0x4b7403[_0x4a8543][_0x8dba('0x54')],_0x4b7403[_0x4a8543][_0x8dba('0x55')])){manager[_0x8dba('0x56')](_0x4a8543,_0x4b7403[_0x4a8543][_0x8dba('0x51')],handleJob(_0x4b7403[_0x4a8543]));manager[_0x8dba('0x57')](_0x4a8543);logger[_0x8dba('0xc')](_0x8dba('0x58'),_0x4b7403[_0x4a8543]['name'],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}else if(manager[_0x8dba('0x59')](_0x4a8543)){manager[_0x8dba('0x4a')](_0x4a8543);manager[_0x8dba('0x4b')](_0x4a8543);logger[_0x8dba('0xc')](_0x8dba('0x5a'),_0x4b7403[_0x4a8543][_0x8dba('0x19')],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}}for(_0x392c92=0x0,_0x4a8543;_0x392c92<_0x420317[_0x8dba('0x48')]&&!_0x447a4a;_0x392c92+=0x1){_0x4a8543=_0x420317[_0x392c92][_0x8dba('0x49')]();if(manager['exists'](_0x4a8543)){if(_0x4b7403[_0x4a8543]['cron']&&_0x4b7403[_0x4a8543][_0x8dba('0x52')]&&moment()[_0x8dba('0x53')](_0x4b7403[_0x4a8543]['startAt'],_0x4b7403[_0x4a8543][_0x8dba('0x55')])){manager[_0x8dba('0x5b')](_0x4a8543,_0x4b7403[_0x4a8543][_0x8dba('0x51')],handleJob(_0x4b7403[_0x4a8543]));logger['info'](_0x8dba('0x5c'),_0x4b7403[_0x4a8543][_0x8dba('0x19')],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}else{manager[_0x8dba('0x4a')](_0x4a8543);manager['deleteJob'](_0x4a8543);logger[_0x8dba('0xc')](_0x8dba('0x5a'),_0x4b7403[_0x4a8543]['name'],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}}}})[_0x8dba('0x32')](function(_0x3ba7f5){logger[_0x8dba('0x2f')](JSON['stringify'](_0x3ba7f5));});}exports[_0x8dba('0x5d')]=function(_0x418a6b){return getJobs(_0x418a6b);};exports[_0x8dba('0x57')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc851=['email','MailAccount','Smtp','service','secure','authentication','user','pass','\x22%s\x22\x20<%s>','name','bcc','subtractNumber','subtractUnit','savename','format','extname','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','intersection','difference','exists','deleteJob','toRun','length','index','my\x20id','run\x20job','cron','active','isBetween','endAt','add','start','stop','stop\x20cron','startAt','update','run','util','path','lodash','moment','cron-job-manager','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to'];(function(_0x34b029,_0x1201a3){var _0xfa1eed=function(_0x4c8841){while(--_0x4c8841){_0x34b029['push'](_0x34b029['shift']());}};_0xfa1eed(++_0x1201a3);}(_0xc851,0x1eb));var _0x1c85=function(_0x5f2c15,_0x3c2755){_0x5f2c15=_0x5f2c15-0x0;var _0x291ba3=_0xc851[_0x5f2c15];return _0x291ba3;};'use strict';var fs=require('fs');var util=require(_0x1c85('0x0'));var path=require(_0x1c85('0x1'));var _=require(_0x1c85('0x2'));var moment=require(_0x1c85('0x3'));var CronJobManager=require(_0x1c85('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x1c85('0x5'));var logger=require('../logger')(_0x1c85('0x6'));var db=require(_0x1c85('0x7'))['db'];var analyticCustomReportController=require(_0x1c85('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1c85('0x9')][_0x1c85('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x304745,_0x24d9ea){return function(){logger[_0x1c85('0xb')](_0x1c85('0xc'),_0x304745[_0x1c85('0xd')]);var _0x230eff=!![];var _0x539944={'tls':{'rejectUnauthorized':![]}};if(_0x304745[_0x1c85('0xe')][_0x1c85('0xf')]['service']){_0x539944['service']=_0x304745[_0x1c85('0xe')][_0x1c85('0xf')][_0x1c85('0x10')];}else{_0x539944['host']=_0x304745['MailAccount'][_0x1c85('0xf')]['host'];_0x539944['port']=_0x304745['MailAccount'][_0x1c85('0xf')]['port'];_0x539944[_0x1c85('0x11')]=_0x304745[_0x1c85('0xe')][_0x1c85('0xf')][_0x1c85('0x11')];}if(_0x304745[_0x1c85('0xe')][_0x1c85('0xf')][_0x1c85('0x12')]){_0x539944['auth']={'user':_0x304745['MailAccount']['Smtp'][_0x1c85('0x13')],'pass':_0x304745[_0x1c85('0xe')][_0x1c85('0xf')][_0x1c85('0x14')]};}var _0x44fa67={'account':_0x539944,'message':{'from':util['format'](_0x1c85('0x15'),_0x304745['MailAccount'][_0x1c85('0x16')],_0x304745[_0x1c85('0xe')]['email']||_0x304745[_0x1c85('0xe')][_0x1c85('0xf')]['user']),'to':_0x304745[_0x1c85('0xd')],'cc':_0x304745['cc'],'bcc':_0x304745[_0x1c85('0x17')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x24d9ea[_0x1c85('0x16')],_0x304745[_0x1c85('0x18')],_0x304745[_0x1c85('0x19')])}};var _0x3158b0=path['join'](__dirname,'../../files/reports');var _0x2e95b4=_0x24d9ea[_0x1c85('0x1a')];var _0x32d4d2=util[_0x1c85('0x1b')]('%s.%s',path['basename'](_0x24d9ea[_0x1c85('0x1a')],path[_0x1c85('0x1c')](_0x24d9ea[_0x1c85('0x1a')])),'zip');var _0x717c9=path['join'](_0x3158b0,_0x2e95b4);var _0x4c0513=path[_0x1c85('0x1d')](_0x3158b0,_0x32d4d2);if(fs[_0x1c85('0x1e')](_0x717c9)){_0x24d9ea[_0x1c85('0x1f')]=_0x1c85('0x20');_0x44fa67[_0x1c85('0x21')][_0x1c85('0x22')]=[{'filename':_0x2e95b4,'path':_0x717c9}];_0x44fa67[_0x1c85('0x21')]['text']=util[_0x1c85('0x1b')](_0x1c85('0x23'),JSON[_0x1c85('0x24')](_0x24d9ea,null,0x2));}else if(fs[_0x1c85('0x1e')](_0x4c0513)){_0x24d9ea[_0x1c85('0x1f')]='Sent';_0x44fa67[_0x1c85('0x21')][_0x1c85('0x22')]=[{'filename':_0x32d4d2,'path':_0x4c0513}];}else{_0x44fa67[_0x1c85('0x21')][_0x1c85('0x25')]=_0x1c85('0x26');if(!_0x304745[_0x1c85('0x27')]){_0x230eff=![];logger[_0x1c85('0xb')](_0x1c85('0x28'));}}if(_0x230eff){return client[_0x1c85('0x29')]('SendMail',_0x44fa67)[_0x1c85('0x2a')](function(_0x30b58a){if(_0x30b58a[_0x1c85('0x2b')]){return logger[_0x1c85('0x2b')]('error\x20mail',JSON[_0x1c85('0x24')](_0x30b58a));}return logger[_0x1c85('0xb')](_0x1c85('0x2c'));})[_0x1c85('0x2d')](function(_0x35ab92){return logger['error'](_0x1c85('0x2e'),JSON['stringify'](_0x35ab92));});}};}function handleError(){return function(_0x277706){return logger[_0x1c85('0x2b')](JSON[_0x1c85('0x24')](_0x277706));};}function handleResult(_0x3ce6f4){return function(_0x479174){logger[_0x1c85('0xb')](_0x1c85('0x2f'),JSON['stringify'](_0x479174));if(_0x3ce6f4[_0x1c85('0xe')]&&_0x3ce6f4[_0x1c85('0xe')][_0x1c85('0xf')]&&!_[_0x1c85('0x30')](_0x3ce6f4[_0x1c85('0xd')])){setTimeout(handleSendEmail(_0x3ce6f4,_0x479174),0x3c*0x3e8);}};}function handleJob(_0x214451){return function(){try{if(_[_0x1c85('0x30')](_0x214451[_0x1c85('0x18')])){return logger[_0x1c85('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x1c85('0x30')](_0x214451[_0x1c85('0x19')])){return logger[_0x1c85('0xb')](_0x1c85('0x31'));}var _0x212eee={'startDate':moment()[_0x1c85('0x32')](_0x214451[_0x1c85('0x18')],_0x214451[_0x1c85('0x19')])[_0x1c85('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x1c85('0x33')),'type':'scheduled','output':_0x214451[_0x1c85('0x34')],'name':_0x214451[_0x1c85('0x16')]};if(!_[_0x1c85('0x30')](_0x214451[_0x1c85('0x35')])){logger[_0x1c85('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x214451[_0x1c85('0x35')]);return analyticDefaultReportController['runReport']({'id':_0x214451[_0x1c85('0x35')]},_0x212eee)[_0x1c85('0x2a')](handleResult(_0x214451))[_0x1c85('0x2d')](handleError());}if(!_[_0x1c85('0x30')](_0x214451[_0x1c85('0x36')])){logger[_0x1c85('0xb')](_0x1c85('0x37'),_0x214451[_0x1c85('0x36')]);return analyticCustomReportController[_0x1c85('0x38')]({'id':_0x214451['CustomReportId']},_0x212eee)[_0x1c85('0x2a')](handleResult(_0x214451))[_0x1c85('0x2d')](handleError());}}catch(_0x8c115f){logger['error'](JSON['stringify'](_0x8c115f));}return logger['info'](_0x1c85('0x39'));};}function getJobs(_0x1b193e){var _0xb71f24={};if(_0x1b193e){_0xb71f24['id']=_0x1b193e;}return db[_0x1c85('0x3a')][_0x1c85('0x3b')]({'where':_0xb71f24,'include':[{'model':db[_0x1c85('0xe')],'attributes':['id','name',_0x1c85('0xd')],'include':[{'model':db[_0x1c85('0x3c')],'as':_0x1c85('0xf')}]}]})[_0x1c85('0x2a')](function(_0x4d5c7e){var _0x130e52=_[_0x1c85('0x3d')](manager[_0x1c85('0x3e')]);var _0x184776=_['map'](_0x4d5c7e,function(_0x180368){return _0x180368['id'][_0x1c85('0x3f')]();});var _0x53e162=_['keyBy'](_0x4d5c7e,function(_0x5755a2){return _0x5755a2['id'][_0x1c85('0x3f')]();});var _0x18e2a3=_0x1b193e?_0x184776:_['difference'](_0x184776,_0x130e52);var _0x1795fa=_[_0x1c85('0x40')](_0x184776,_0x130e52);var _0x3482ae=_[_0x1c85('0x41')](_0x130e52,_0x184776);var _0x304548;var _0xf2bdaf;for(_0x304548=0x0;_0x304548<_0x3482ae['length']&&!_0x1b193e;_0x304548+=0x1){_0xf2bdaf=_0x3482ae[_0x304548]['toString']();if(manager[_0x1c85('0x42')](_0xf2bdaf)){manager['stop'](_0xf2bdaf);manager[_0x1c85('0x43')](_0xf2bdaf);logger[_0x1c85('0xb')]('delete\x20cron',_0xf2bdaf);}}logger[_0x1c85('0xb')](_0x1c85('0x44'),JSON[_0x1c85('0x24')](_0x18e2a3));for(_0x304548=0x0;_0x304548<_0x18e2a3[_0x1c85('0x45')];_0x304548+=0x1){_0xf2bdaf=_0x18e2a3[_0x304548][_0x1c85('0x3f')]();logger[_0x1c85('0xb')](_0x1c85('0x46'),_0xf2bdaf);if(_0x1b193e){logger[_0x1c85('0xb')](_0x1c85('0x47'),_0x1b193e);logger[_0x1c85('0xb')](JSON[_0x1c85('0x24')](_0x53e162[_0xf2bdaf]));BPromise['resolve']()[_0x1c85('0x2a')](handleJob(_0x53e162[_0xf2bdaf]));logger['info'](_0x1c85('0x48'),_0x53e162[_0xf2bdaf][_0x1c85('0x16')],_0x53e162[_0xf2bdaf][_0x1c85('0x49')]);}else if(_0x53e162[_0xf2bdaf][_0x1c85('0x49')]&&_0x53e162[_0xf2bdaf][_0x1c85('0x4a')]&&moment()[_0x1c85('0x4b')](_0x53e162[_0xf2bdaf]['startAt'],_0x53e162[_0xf2bdaf][_0x1c85('0x4c')])){manager[_0x1c85('0x4d')](_0xf2bdaf,_0x53e162[_0xf2bdaf]['cron'],handleJob(_0x53e162[_0xf2bdaf]));manager[_0x1c85('0x4e')](_0xf2bdaf);logger[_0x1c85('0xb')]('add\x20cron',_0x53e162[_0xf2bdaf][_0x1c85('0x16')],_0x53e162[_0xf2bdaf][_0x1c85('0x49')]);}else if(manager['exists'](_0xf2bdaf)){manager[_0x1c85('0x4f')](_0xf2bdaf);manager['deleteJob'](_0xf2bdaf);logger[_0x1c85('0xb')](_0x1c85('0x50'),_0x53e162[_0xf2bdaf][_0x1c85('0x16')],_0x53e162[_0xf2bdaf]['cron']);}}for(_0x304548=0x0,_0xf2bdaf;_0x304548<_0x1795fa['length']&&!_0x1b193e;_0x304548+=0x1){_0xf2bdaf=_0x1795fa[_0x304548]['toString']();if(manager[_0x1c85('0x42')](_0xf2bdaf)){if(_0x53e162[_0xf2bdaf][_0x1c85('0x49')]&&_0x53e162[_0xf2bdaf][_0x1c85('0x4a')]&&moment()['isBetween'](_0x53e162[_0xf2bdaf][_0x1c85('0x51')],_0x53e162[_0xf2bdaf]['endAt'])){manager[_0x1c85('0x52')](_0xf2bdaf,_0x53e162[_0xf2bdaf]['cron'],handleJob(_0x53e162[_0xf2bdaf]));logger[_0x1c85('0xb')]('update\x20cron',_0x53e162[_0xf2bdaf]['name'],_0x53e162[_0xf2bdaf]['cron']);}else{manager[_0x1c85('0x4f')](_0xf2bdaf);manager[_0x1c85('0x43')](_0xf2bdaf);logger['info'](_0x1c85('0x50'),_0x53e162[_0xf2bdaf][_0x1c85('0x16')],_0x53e162[_0xf2bdaf][_0x1c85('0x49')]);}}}})[_0x1c85('0x2d')](function(_0x43e0b5){logger[_0x1c85('0x2b')](JSON[_0x1c85('0x24')](_0x43e0b5));});}exports[_0x1c85('0x53')]=function(_0xac2a84){return getJobs(_0xac2a84);};exports[_0x1c85('0x4e')]=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 cbe983f..55c9ebe 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 _0xb921=['TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','ValidationError','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','COMPLETED','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','start','lodash','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0x26a898,_0x20fd99){var _0xac386c=function(_0x10310e){while(--_0x10310e){_0x26a898['push'](_0x26a898['shift']());}};_0xac386c(++_0x20fd99);}(_0xb921,0x16a));var _0x1b92=function(_0x161d41,_0x306119){_0x161d41=_0x161d41-0x0;var _0x21daf6=_0xb921[_0x161d41];return _0x21daf6;};var _=require(_0x1b92('0x0'));var AWS=require(_0x1b92('0x1'));var rp=require(_0x1b92('0x2'));var util=require(_0x1b92('0x3'));var BPromise=require(_0x1b92('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x1b92('0x5'));function getTranscriptionJob(_0xc3832e,_0x1e49a8,_0x10868d,_0x464cc4){return new Promise(function(_0x29a1db,_0x4358e3){var _0x8a6282=new AWS[(_0x1b92('0x6'))]({'accessKeyId':_0x1e49a8,'secretAccessKey':_0xc3832e,'region':_0x10868d});_0x8a6282[_0x1b92('0x7')]({'TranscriptionJobName':_0x464cc4},function(_0x1545f9,_0x64a3ed){if(_0x1545f9){return _0x4358e3(_0x1545f9);}else{return _0x29a1db(_0x64a3ed);}});});}function sentiment(_0x2cf050,_0x37b876,_0x4567ab,_0x4c8e30,_0x31e314){return new Promise(function(_0x1e5802,_0x154b6d){var _0x146d68=new AWS[(_0x1b92('0x8'))]({'accessKeyId':_0x37b876,'secretAccessKey':_0x2cf050,'region':_0x4567ab});_0x146d68[_0x1b92('0x9')]({'Text':_0x4c8e30,'LanguageCode':_0x31e314[_0x1b92('0xa')](0x0,0x2)},function(_0x4aee95,_0x352b18){if(_0x4aee95){return _0x154b6d(_0x4aee95);}else{return _0x1e5802(_0x352b18);}});});}function checkTranscribeJob(_0x3b5e5b,_0x5a1ca5,_0x81cbe0){var _0x29a7ed;return new BPromise(function(_0x2c07a4,_0x178f66){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0xd'),_0x3b5e5b['id'],_0x3b5e5b['transcribeName']));return getTranscriptionJob(_0x81cbe0[_0x1b92('0xe')],_0x81cbe0['data2'],_0x5a1ca5[_0x1b92('0xf')],_0x3b5e5b['transcribeName'])[_0x1b92('0x10')](function(_0x523285){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x11'),_0x3b5e5b['id'],_0x3b5e5b['transcribeName'],_0x523285[_0x1b92('0x12')][_0x1b92('0x13')]));if(!_0x3b5e5b[_0x1b92('0x14')]){switch(_0x523285[_0x1b92('0x12')][_0x1b92('0x13')]){case'COMPLETED':var _0x4024bf={'transcribeStatus':_0x523285[_0x1b92('0x12')][_0x1b92('0x13')],'fileUri':_0x523285['TranscriptionJob'][_0x1b92('0x15')][_0x1b92('0x16')]};logger[_0x1b92('0xb')](util['format'](_0x1b92('0x17'),_0x3b5e5b['id']));return rp({'uri':_0x523285['TranscriptionJob'][_0x1b92('0x15')][_0x1b92('0x16')],'json':!![]})['then'](function(_0x4ea25f){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x18'),_0x3b5e5b['id']));if(_0x4ea25f&&_0x4ea25f[_0x1b92('0x19')]&&_0x4ea25f[_0x1b92('0x19')][_0x1b92('0x1a')]&&_0x4ea25f['results'][_0x1b92('0x1a')][_0x1b92('0x1b')]){_0x4024bf[_0x1b92('0x14')]='';for(var _0x39dcaa=0x0;_0x39dcaa<_0x4ea25f['results'][_0x1b92('0x1a')]['length'];_0x39dcaa++){_0x4024bf[_0x1b92('0x14')]+=_0x4ea25f[_0x1b92('0x19')][_0x1b92('0x1a')][_0x39dcaa][_0x1b92('0x1c')]+'';}}return _0x3b5e5b[_0x1b92('0x1d')](_0x4024bf);})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util[_0x1b92('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3b5e5b['id']));if(!_0x3b5e5b['tempSentiment']){throw new db['Sequelize'][(_0x1b92('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5a1ca5[_0x1b92('0x1f')]||!_0x5a1ca5['sentimentAccountId']||!_0x5a1ca5[_0x1b92('0x20')]||!_0x5a1ca5[_0x1b92('0x21')]||!_0x5a1ca5[_0x1b92('0x22')]){throw new db['Sequelize'][(_0x1b92('0x1e'))](_0x1b92('0x23'));}if(!_0x4024bf['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5a1ca5[_0x1b92('0x24')]===_0x81cbe0['id']){return _0x81cbe0;}else{return db[_0x1b92('0x25')][_0x1b92('0x26')]({'where':{'id':_settings[_0x1b92('0x24')]}});}})[_0x1b92('0x10')](function(_0x50eddf){if(!_0x50eddf){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x28'));}if(!_0x50eddf[_0x1b92('0xe')]||!_0x50eddf[_0x1b92('0x29')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x29a7ed=_0x50eddf;logger[_0x1b92('0xb')](util[_0x1b92('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3b5e5b['id']));return sentiment(_0x29a7ed[_0x1b92('0xe')],_0x29a7ed[_0x1b92('0x29')],_0x5a1ca5[_0x1b92('0x20')],_0x4024bf['fileText'],_0x5a1ca5[_0x1b92('0x21')]);})[_0x1b92('0x10')](function(_0x5cce14){logger['info'](util[_0x1b92('0xc')](_0x1b92('0x2a'),_0x3b5e5b['id']));return _0x3b5e5b[_0x1b92('0x1d')]({'sentiment':_0x5cce14[_0x1b92('0x2b')],'sPositive':_0x5cce14['SentimentScore']['Positive'],'sNegative':_0x5cce14['SentimentScore'][_0x1b92('0x2c')],'sMixed':_0x5cce14[_0x1b92('0x2d')][_0x1b92('0x2e')],'sNeutral':_0x5cce14[_0x1b92('0x2d')][_0x1b92('0x2f')]});})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util['format'](_0x1b92('0x30'),_0x3b5e5b['id']));_0x2c07a4();});case _0x1b92('0x31'):return _0x3b5e5b['update']({'transcribeStatus':_0x1b92('0x31'),'failureReason':_0x523285[_0x1b92('0x12')][_0x1b92('0x32')]})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x30'),_0x3b5e5b['id']));_0x2c07a4();});default:logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x33'),_0x3b5e5b['id']));break;}}else{return BPromise['resolve']()[_0x1b92('0x10')](function(){if(!_0x3b5e5b['tempSentiment']){throw new db[(_0x1b92('0x27'))]['ValidationError'](_0x1b92('0x34'));}if(!_0x5a1ca5[_0x1b92('0x1f')]||!_0x5a1ca5[_0x1b92('0x24')]||!_0x5a1ca5[_0x1b92('0x20')]||!_0x5a1ca5[_0x1b92('0x21')]||!_0x5a1ca5[_0x1b92('0x22')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x23'));}if(!_0x3b5e5b['fileText']){throw new Error(_0x1b92('0x35'));}if(_0x5a1ca5['sentimentAccountId']===_0x81cbe0['id']){return _0x81cbe0;}else{return db[_0x1b92('0x25')][_0x1b92('0x26')]({'where':{'id':_settings[_0x1b92('0x24')]}});}})[_0x1b92('0x10')](function(_0x52a982){if(!_0x52a982){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x28'));}if(!_0x52a982[_0x1b92('0xe')]||!_0x52a982[_0x1b92('0x29')]){throw new db[(_0x1b92('0x27'))]['ValidationError'](_0x1b92('0x36'));}_0x29a7ed=_0x52a982;logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x37'),_0x3b5e5b['id']));return sentiment(_0x29a7ed[_0x1b92('0xe')],_0x29a7ed[_0x1b92('0x29')],_0x5a1ca5['sentimentRegion'],_0x3b5e5b[_0x1b92('0x14')],_0x5a1ca5[_0x1b92('0x21')]);})['then'](function(_0x4af49c){logger['info'](util[_0x1b92('0xc')](_0x1b92('0x2a'),_0x3b5e5b['id']));return _0x3b5e5b[_0x1b92('0x1d')]({'sentiment':_0x4af49c['Sentiment'],'sPositive':_0x4af49c[_0x1b92('0x2d')][_0x1b92('0x38')],'sNegative':_0x4af49c['SentimentScore']['Negative'],'sMixed':_0x4af49c['SentimentScore'][_0x1b92('0x2e')],'sNeutral':_0x4af49c[_0x1b92('0x2d')][_0x1b92('0x2f')],'transcribeStatus':_0x1b92('0x39')});})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util['format'](_0x1b92('0x30'),_0x3b5e5b['id']));_0x2c07a4();});}})[_0x1b92('0x3a')](function(_0x498012){if(_0x498012){if(!_0x498012[_0x1b92('0x3b')]||_0x498012[_0x1b92('0x3b')]!==_0x1b92('0x3c')){logger['error'](util[_0x1b92('0xc')](_0x1b92('0x3d'),_0x3b5e5b['id']),util[_0x1b92('0x3e')](_0x498012,{'showHidden':![],'depth':null}));}}_0x2c07a4();});});}function checkTranscribe(){var _0x3d57d3;var _0x199c29;var _0x5ac096;return db[_0x1b92('0x3f')][_0x1b92('0x40')]({'where':{'transcribeStatus':_0x1b92('0x41')}})[_0x1b92('0x10')](function(_0x619e35){if(!_0x619e35||!_0x619e35['length']){throw new db['Sequelize'][(_0x1b92('0x1e'))](_0x1b92('0x42'));}_0x3d57d3=_0x619e35;return db[_0x1b92('0x43')][_0x1b92('0x26')]({'where':{'id':0x1}});})['then'](function(_0x4e0954){if(!_0x4e0954){throw new db[(_0x1b92('0x27'))]['ValidationError'](_0x1b92('0x44'));}_0x199c29=_0x4e0954;if(!_0x199c29[_0x1b92('0x5')]||!_0x199c29[_0x1b92('0x45')]||!_0x199c29['transcribeRegion']||!_0x199c29[_0x1b92('0x21')]||!_0x199c29[_0x1b92('0x22')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x46'));}return db[_0x1b92('0x25')][_0x1b92('0x26')]({'where':{'id':_0x199c29[_0x1b92('0x45')]}});})['then'](function(_0x140202){if(!_0x140202){throw new db['Sequelize'][(_0x1b92('0x1e'))](_0x1b92('0x28'));}if(!_0x140202[_0x1b92('0xe')]||!_0x140202[_0x1b92('0x29')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x36'));}_0x5ac096=_0x140202;var _0x32d994=[];_0x3d57d3[_0x1b92('0x47')](function(_0x23e03a){_0x32d994[_0x1b92('0x48')](checkTranscribeJob(_0x23e03a,_0x199c29,_0x5ac096));});return BPromise[_0x1b92('0x49')](_0x32d994);})[_0x1b92('0x3a')](function(_0x181e03){if(_0x181e03){if(!_0x181e03[_0x1b92('0x3b')]||_0x181e03[_0x1b92('0x3b')]!==_0x1b92('0x3c')){logger[_0x1b92('0x4a')](util[_0x1b92('0x3e')](_0x181e03,{'showHidden':![],'depth':null}));}}});}exports[_0x1b92('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1752=['update','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribe','transcribeAccountId','Cloud\x20Provider\x20not\x20available','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Cloud\x20Provider\x20not\x20configured','language','SentimentScore','Negative','Mixed','Neutral','FAILED'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x1752,0xa5));var _0x2175=function(_0x3696ec,_0x4cd357){_0x3696ec=_0x3696ec-0x0;var _0x1cc486=_0x1752[_0x3696ec];return _0x1cc486;};var _=require('lodash');var AWS=require(_0x2175('0x0'));var rp=require(_0x2175('0x1'));var util=require(_0x2175('0x2'));var BPromise=require(_0x2175('0x3'));var db=require(_0x2175('0x4'))['db'];var logger=require(_0x2175('0x5'))('transcribe');function getTranscriptionJob(_0x1ee277,_0x22c167,_0x12b8d9,_0xe55453){return new Promise(function(_0x222868,_0x27ff0b){var _0x19ca87=new AWS[(_0x2175('0x6'))]({'accessKeyId':_0x22c167,'secretAccessKey':_0x1ee277,'region':_0x12b8d9});_0x19ca87[_0x2175('0x7')]({'TranscriptionJobName':_0xe55453},function(_0x672ff1,_0x516ccc){if(_0x672ff1){return _0x27ff0b(_0x672ff1);}else{return _0x222868(_0x516ccc);}});});}function sentiment(_0x4e818f,_0xa39599,_0x407a71,_0x455803,_0x77e3fa){return new Promise(function(_0x4be8c8,_0x5ad5ad){var _0x5717b0=new AWS[(_0x2175('0x8'))]({'accessKeyId':_0xa39599,'secretAccessKey':_0x4e818f,'region':_0x407a71});_0x5717b0['detectSentiment']({'Text':_0x455803,'LanguageCode':_0x77e3fa['substring'](0x0,0x2)},function(_0x510de5,_0x4fa5eb){if(_0x510de5){return _0x5ad5ad(_0x510de5);}else{return _0x4be8c8(_0x4fa5eb);}});});}function checkTranscribeJob(_0x453acd,_0x5bc446,_0x43be3c){var _0x393c02;return new BPromise(function(_0x49522e,_0x20477e){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0xb'),_0x453acd['id'],_0x453acd[_0x2175('0xc')]));return getTranscriptionJob(_0x43be3c[_0x2175('0xd')],_0x43be3c[_0x2175('0xe')],_0x5bc446[_0x2175('0xf')],_0x453acd['transcribeName'])['then'](function(_0x371b42){logger[_0x2175('0x9')](util[_0x2175('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x453acd['id'],_0x453acd['transcribeName'],_0x371b42['TranscriptionJob'][_0x2175('0x10')]));if(!_0x453acd[_0x2175('0x11')]){switch(_0x371b42['TranscriptionJob']['TranscriptionJobStatus']){case _0x2175('0x12'):var _0x3d6467={'transcribeStatus':_0x371b42[_0x2175('0x13')]['TranscriptionJobStatus'],'fileUri':_0x371b42[_0x2175('0x13')]['Transcript'][_0x2175('0x14')]};logger['info'](util[_0x2175('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x453acd['id']));return rp({'uri':_0x371b42['TranscriptionJob']['Transcript'][_0x2175('0x14')],'json':!![]})['then'](function(_0x28c4b8){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0x15'),_0x453acd['id']));if(_0x28c4b8&&_0x28c4b8[_0x2175('0x16')]&&_0x28c4b8[_0x2175('0x16')]['transcripts']&&_0x28c4b8[_0x2175('0x16')][_0x2175('0x17')][_0x2175('0x18')]){_0x3d6467[_0x2175('0x11')]='';for(var _0x495887=0x0;_0x495887<_0x28c4b8['results'][_0x2175('0x17')][_0x2175('0x18')];_0x495887++){_0x3d6467[_0x2175('0x11')]+=_0x28c4b8['results'][_0x2175('0x17')][_0x495887]['transcript']+'';}}return _0x453acd['update'](_0x3d6467);})[_0x2175('0x19')](function(){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0x1a'),_0x453acd['id']));if(!_0x453acd[_0x2175('0x1b')]){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))](_0x2175('0x1e'));}if(!_0x5bc446[_0x2175('0x1f')]||!_0x5bc446[_0x2175('0x20')]||!_0x5bc446[_0x2175('0x21')]||!_0x5bc446['language']||!_0x5bc446[_0x2175('0x22')]){throw new db[(_0x2175('0x1c'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3d6467[_0x2175('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x5bc446[_0x2175('0x20')]===_0x43be3c['id']){return _0x43be3c;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2175('0x19')](function(_0x2811b6){if(!_0x2811b6){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2811b6[_0x2175('0xd')]||!_0x2811b6[_0x2175('0xe')]){throw new db['Sequelize'][(_0x2175('0x1d'))](_0x2175('0x23'));}_0x393c02=_0x2811b6;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x453acd['id']));return sentiment(_0x393c02['data1'],_0x393c02[_0x2175('0xe')],_0x5bc446[_0x2175('0x21')],_0x3d6467[_0x2175('0x11')],_0x5bc446[_0x2175('0x24')]);})[_0x2175('0x19')](function(_0x25cce5){logger[_0x2175('0x9')](util[_0x2175('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x453acd['id']));return _0x453acd['update']({'sentiment':_0x25cce5['Sentiment'],'sPositive':_0x25cce5['SentimentScore']['Positive'],'sNegative':_0x25cce5[_0x2175('0x25')][_0x2175('0x26')],'sMixed':_0x25cce5['SentimentScore'][_0x2175('0x27')],'sNeutral':_0x25cce5[_0x2175('0x25')][_0x2175('0x28')]});})[_0x2175('0x19')](function(){logger[_0x2175('0x9')](util[_0x2175('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x453acd['id']));_0x49522e();});case _0x2175('0x29'):return _0x453acd[_0x2175('0x2a')]({'transcribeStatus':_0x2175('0x29'),'failureReason':_0x371b42[_0x2175('0x13')][_0x2175('0x2b')]})[_0x2175('0x19')](function(){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0x1a'),_0x453acd['id']));_0x49522e();});default:logger[_0x2175('0x9')](util[_0x2175('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x453acd['id']));break;}}else{return BPromise[_0x2175('0x2c')]()[_0x2175('0x19')](function(){if(!_0x453acd[_0x2175('0x1b')]){throw new db['Sequelize']['ValidationError'](_0x2175('0x1e'));}if(!_0x5bc446['sentiment']||!_0x5bc446[_0x2175('0x20')]||!_0x5bc446[_0x2175('0x21')]||!_0x5bc446[_0x2175('0x24')]||!_0x5bc446['bucket']){throw new db['Sequelize'][(_0x2175('0x1d'))](_0x2175('0x2d'));}if(!_0x453acd['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5bc446[_0x2175('0x20')]===_0x43be3c['id']){return _0x43be3c;}else{return db[_0x2175('0x2e')][_0x2175('0x2f')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2175('0x19')](function(_0x4343f9){if(!_0x4343f9){throw new db[(_0x2175('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4343f9[_0x2175('0xd')]||!_0x4343f9['data2']){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x393c02=_0x4343f9;logger['info'](util['format'](_0x2175('0x30'),_0x453acd['id']));return sentiment(_0x393c02['data1'],_0x393c02['data2'],_0x5bc446[_0x2175('0x21')],_0x453acd['fileText'],_0x5bc446[_0x2175('0x24')]);})[_0x2175('0x19')](function(_0x246e16){logger[_0x2175('0x9')](util[_0x2175('0xa')](_0x2175('0x31'),_0x453acd['id']));return _0x453acd['update']({'sentiment':_0x246e16[_0x2175('0x32')],'sPositive':_0x246e16[_0x2175('0x25')][_0x2175('0x33')],'sNegative':_0x246e16[_0x2175('0x25')][_0x2175('0x26')],'sMixed':_0x246e16[_0x2175('0x25')]['Mixed'],'sNeutral':_0x246e16[_0x2175('0x25')][_0x2175('0x28')],'transcribeStatus':_0x2175('0x12')});})['then'](function(){logger[_0x2175('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x453acd['id']));_0x49522e();});}})[_0x2175('0x34')](function(_0x2792c0){if(_0x2792c0){if(!_0x2792c0[_0x2175('0x35')]||_0x2792c0['name']!==_0x2175('0x36')){logger[_0x2175('0x37')](util[_0x2175('0xa')](_0x2175('0x38'),_0x453acd['id']),util[_0x2175('0x39')](_0x2792c0,{'showHidden':![],'depth':null}));}}_0x49522e();});});}function checkTranscribe(){var _0x5c1a8d;var _0x58ef93;var _0xdb0a97;return db[_0x2175('0x3a')][_0x2175('0x3b')]({'where':{'transcribeStatus':_0x2175('0x3c')}})[_0x2175('0x19')](function(_0x47b8ae){if(!_0x47b8ae||!_0x47b8ae[_0x2175('0x18')]){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x5c1a8d=_0x47b8ae;return db['Setting'][_0x2175('0x2f')]({'where':{'id':0x1}});})['then'](function(_0x5af419){if(!_0x5af419){throw new db['Sequelize']['ValidationError'](_0x2175('0x3d'));}_0x58ef93=_0x5af419;if(!_0x58ef93[_0x2175('0x3e')]||!_0x58ef93['transcribeAccountId']||!_0x58ef93['transcribeRegion']||!_0x58ef93['language']||!_0x58ef93['bucket']){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x2175('0x2f')]({'where':{'id':_0x58ef93[_0x2175('0x3f')]}});})[_0x2175('0x19')](function(_0xce807c){if(!_0xce807c){throw new db[(_0x2175('0x1c'))]['ValidationError'](_0x2175('0x40'));}if(!_0xce807c['data1']||!_0xce807c[_0x2175('0xe')]){throw new db[(_0x2175('0x1c'))][(_0x2175('0x1d'))](_0x2175('0x23'));}_0xdb0a97=_0xce807c;var _0x1fc25a=[];_0x5c1a8d[_0x2175('0x41')](function(_0x197a88){_0x1fc25a[_0x2175('0x42')](checkTranscribeJob(_0x197a88,_0x58ef93,_0xdb0a97));});return BPromise[_0x2175('0x43')](_0x1fc25a);})[_0x2175('0x34')](function(_0x1f967d){if(_0x1f967d){if(!_0x1f967d[_0x2175('0x35')]||_0x1f967d[_0x2175('0x35')]!==_0x2175('0x36')){logger[_0x2175('0x37')](util['inspect'](_0x1f967d,{'showHidden':![],'depth':null}));}}});}exports[_0x2175('0x44')]=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 9c4044a..02a80f6 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 _0x90ac=['hours','length','map','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt'];(function(_0x10d8e5,_0x22bc56){var _0x5c3923=function(_0x5f3bab){while(--_0x5f3bab){_0x10d8e5['push'](_0x10d8e5['shift']());}};_0x5c3923(++_0x22bc56);}(_0x90ac,0x1b4));var _0xc90a=function(_0x107b59,_0x283272){_0x107b59=_0x107b59-0x0;var _0xfac415=_0x90ac[_0x107b59];return _0xfac415;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xc90a('0x0'));var util=require(_0xc90a('0x1'));var config=require(_0xc90a('0x2'));var db=require(_0xc90a('0x3'))['db'];var logger=require('../logger')(_0xc90a('0x4'));config[_0xc90a('0x5')]=_[_0xc90a('0x6')](config[_0xc90a('0x5')],{'host':_0xc90a('0x7'),'port':0x18eb});var io=require(_0xc90a('0x8'))(new Redis(config[_0xc90a('0x5')]));function closeInteractions(){var _0x439866=[];return db[_0xc90a('0x9')][_0xc90a('0xa')]({'raw':!![],'attributes':['id',_0xc90a('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xc90a('0xc'))}}})['then'](function(_0x577c44){if(_0x577c44&&_0x577c44[_0xc90a('0xd')]){_0x439866=_[_0xc90a('0xe')](_0x577c44||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x439866[_0xc90a('0xf')]());return db[_0xc90a('0x9')][_0xc90a('0x10')]({'closeReason':'system','disposition':_0xc90a('0x11'),'closed':!![],'closedAt':moment()[_0xc90a('0x12')](_0xc90a('0x13'))},{'where':{'id':_0x439866}});}})[_0xc90a('0x14')](function(){if(_0x439866&&_0x439866['length']){logger['info'](_0xc90a('0x15'),_0x439866[_0xc90a('0xf')]());for(var _0x3859bc=0x0;_0x3859bc<_0x439866[_0xc90a('0xd')];_0x3859bc++){io[_0xc90a('0x16')]('whatsappInteraction:update',{'id':_0x439866[_0x3859bc],'closed':!![]});}}})[_0xc90a('0x17')](function(_0x2d065d){logger[_0xc90a('0x18')](_0xc90a('0x19'),_0x2d065d?util[_0xc90a('0x1a')](_0x2d065d,{'showHidden':![],'depth':null}):'');});}exports[_0xc90a('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa03d=['moment','util','../../mysqldb','schedule','redis','socket.io-emitter','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash'];(function(_0x43fda2,_0x1c5662){var _0xa492a2=function(_0x3a92c4){while(--_0x3a92c4){_0x43fda2['push'](_0x43fda2['shift']());}};_0xa492a2(++_0x1c5662);}(_0xa03d,0x15b));var _0xda03=function(_0x1130e4,_0x14fa7f){_0x1130e4=_0x1130e4-0x0;var _0x46b2fc=_0xa03d[_0x1130e4];return _0x46b2fc;};'use strict';var _=require(_0xda03('0x0'));var moment=require(_0xda03('0x1'));var Redis=require('ioredis');var util=require(_0xda03('0x2'));var config=require('../../config/environment');var db=require(_0xda03('0x3'))['db'];var logger=require('../logger')(_0xda03('0x4'));config[_0xda03('0x5')]=_['defaults'](config[_0xda03('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xda03('0x6'))(new Redis(config[_0xda03('0x5')]));function closeInteractions(){var _0x46242a=[];return db['WhatsappInteraction'][_0xda03('0x7')]({'raw':!![],'attributes':['id',_0xda03('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xda03('0x9')](0x18,_0xda03('0xa'))}}})['then'](function(_0x4e938f){if(_0x4e938f&&_0x4e938f[_0xda03('0xb')]){_0x46242a=_[_0xda03('0xc')](_0x4e938f||[],'id');logger[_0xda03('0xd')](_0xda03('0xe'),_0x46242a[_0xda03('0xf')]());return db['WhatsappInteraction'][_0xda03('0x10')]({'closeReason':_0xda03('0x11'),'disposition':_0xda03('0x12'),'closed':!![],'closedAt':moment()[_0xda03('0x13')](_0xda03('0x14'))},{'where':{'id':_0x46242a}});}})[_0xda03('0x15')](function(){if(_0x46242a&&_0x46242a[_0xda03('0xb')]){logger[_0xda03('0xd')](_0xda03('0x16'),_0x46242a['join']());for(var _0xd72e8d=0x0;_0xd72e8d<_0x46242a['length'];_0xd72e8d++){io[_0xda03('0x17')]('whatsappInteraction:update',{'id':_0x46242a[_0xd72e8d],'closed':!![]});}}})[_0xda03('0x18')](function(_0x9ca888){logger[_0xda03('0x19')](_0xda03('0x1a'),_0x9ca888?util[_0xda03('0x1b')](_0x9ca888,{'showHidden':![],'depth':null}):'');});}exports[_0xda03('0x1c')]=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 889467e..d07ecd8 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd050=['@xcally.com','push','now','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x2c5435,_0x1bbff8){var _0x1f7ffe=function(_0x5c6ac3){while(--_0x5c6ac3){_0x2c5435['push'](_0x2c5435['shift']());}};_0x1f7ffe(++_0x1bbff8);}(_0xd050,0x1c7));var _0x0d05=function(_0x4cac8c,_0x2664d2){_0x4cac8c=_0x4cac8c-0x0;var _0x52def9=_0xd050[_0x4cac8c];return _0x52def9;};'use strict';var util=require(_0x0d05('0x0'));var db=require(_0x0d05('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0d05('0x2')+i,'lastName':_0x0d05('0x3')+i,'phone':0xf879fb460+i,'email':_0x0d05('0x4')+i+_0x0d05('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0d05('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x0d05('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x0d05('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0d05('0x6')]({'id':i,'firstName':_0x0d05('0x2')+i,'lastName':_0x0d05('0x3')+i,'phone':0xf879fb460+i,'email':_0x0d05('0x4')+i+_0x0d05('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0d05('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x0d05('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0d05('0x7')](),'updatedAt':Date[_0x0d05('0x7')]()});}db[_0x0d05('0x8')]['destroy']({'where':{}})[_0x0d05('0x9')](function(){return db['CmContact'][_0x0d05('0xa')](contacts);})['then'](function(){console[_0x0d05('0xb')](_0x0d05('0xc'),_0x0d05('0xd'));return db[_0x0d05('0xe')][_0x0d05('0xf')]({'where':{}});})[_0x0d05('0x9')](function(){return db[_0x0d05('0xe')]['bulkCreate'](hopper);})['then'](function(){console[_0x0d05('0xb')]('finished\x20populating',_0x0d05('0x10'));return db[_0x0d05('0x8')][_0x0d05('0xa')](contacts2);})[_0x0d05('0x9')](function(){console['log'](_0x0d05('0xc'),_0x0d05('0x11'));return db[_0x0d05('0xe')]['bulkCreate'](hopper2);})[_0x0d05('0x9')](function(){console[_0x0d05('0xb')](_0x0d05('0xc'),_0x0d05('0x12'));})[_0x0d05('0x13')](function(_0x52843e){console[_0x0d05('0xb')](_0x52843e);}); \ No newline at end of file +var _0x33ae=['then','contacts1','CmHopper','destroy','bulkCreate','log','finished\x20populating','hopper1','contacts2','catch','util','../mysqldb','push','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x33ae,0x118));var _0xe33a=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x33ae[_0x2085f3];return _0x384e3c;};'use strict';var util=require(_0xe33a('0x0'));var db=require(_0xe33a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe33a('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe33a('0x3')+i+_0xe33a('0x4')});}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[_0xe33a('0x5')](),'updatedAt':Date[_0xe33a('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xe33a('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe33a('0x3')+i+_0xe33a('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe33a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe33a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe33a('0x5')](),'updatedAt':Date['now']()});}db[_0xe33a('0x7')]['destroy']({'where':{}})[_0xe33a('0x8')](function(){return db[_0xe33a('0x7')]['bulkCreate'](contacts);})[_0xe33a('0x8')](function(){console['log']('finished\x20populating',_0xe33a('0x9'));return db[_0xe33a('0xa')][_0xe33a('0xb')]({'where':{}});})[_0xe33a('0x8')](function(){return db[_0xe33a('0xa')][_0xe33a('0xc')](hopper);})[_0xe33a('0x8')](function(){console[_0xe33a('0xd')](_0xe33a('0xe'),_0xe33a('0xf'));return db[_0xe33a('0x7')][_0xe33a('0xc')](contacts2);})[_0xe33a('0x8')](function(){console[_0xe33a('0xd')]('finished\x20populating',_0xe33a('0x10'));return db[_0xe33a('0xa')][_0xe33a('0xc')](hopper2);})['then'](function(){console[_0xe33a('0xd')]('finished\x20populating','hopper2');})[_0xe33a('0x11')](function(_0x25b256){console[_0xe33a('0xd')](_0x25b256);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 60ca3e9..10c74bc 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ca3=['../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util'];(function(_0x4fad65,_0x5e60a0){var _0xb990a3=function(_0x4d7c08){while(--_0x4d7c08){_0x4fad65['push'](_0x4fad65['shift']());}};_0xb990a3(++_0x5e60a0);}(_0x1ca3,0x110));var _0x31ca=function(_0xd9e557,_0x43dabb){_0xd9e557=_0xd9e557-0x0;var _0x9358e6=_0x1ca3[_0xd9e557];return _0x9358e6;};'use strict';var util=require(_0x31ca('0x0'));var db=require(_0x31ca('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x31ca('0x2')]({'name':util[_0x31ca('0x3')](_0x31ca('0x4'),_0x31ca('0x5'),i),'fullname':util[_0x31ca('0x3')](_0x31ca('0x4'),_0x31ca('0x5'),i),'email':util[_0x31ca('0x3')](_0x31ca('0x6'),_0x31ca('0x5'),i),'role':_0x31ca('0x5'),'password':_0x31ca('0x7'),'internal':0xfa0+i,'type':_0x31ca('0x8'),'transport':['udp','ws',_0x31ca('0x9')],'disallow':[_0x31ca('0xa')],'allow':[_0x31ca('0xb')],'defaultuser':util['format'](_0x31ca('0x4'),'agent',i),'encryption':'yes','avpf':'yes','force_avp':_0x31ca('0xc'),'icesupport':_0x31ca('0xc'),'dtlsenable':_0x31ca('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x31ca('0xd'),'dtlssetup':_0x31ca('0xe'),'callerid':util[_0x31ca('0x3')](_0x31ca('0xf'),util[_0x31ca('0x3')](_0x31ca('0x4'),_0x31ca('0x5'),i),0xfa0+i)});}db[_0x31ca('0x10')][_0x31ca('0x11')](users)[_0x31ca('0x12')](function(){console[_0x31ca('0x13')](_0x31ca('0x14'));})['catch'](function(_0x566051){console['log'](_0x566051);}); \ No newline at end of file +var _0x0d7c=['add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log'];(function(_0x500c89,_0x2ba5a0){var _0x5aa6c4=function(_0x5c740e){while(--_0x5c740e){_0x500c89['push'](_0x500c89['shift']());}};_0x5aa6c4(++_0x2ba5a0);}(_0x0d7c,0x6b));var _0xc0d7=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0x0d7c[_0x413aac];return _0x569b11;};'use strict';var util=require(_0xc0d7('0x0'));var db=require(_0xc0d7('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xc0d7('0x2')]({'name':util[_0xc0d7('0x3')](_0xc0d7('0x4'),_0xc0d7('0x5'),i),'fullname':util[_0xc0d7('0x3')](_0xc0d7('0x4'),'agent',i),'email':util['format'](_0xc0d7('0x6'),_0xc0d7('0x5'),i),'role':_0xc0d7('0x5'),'password':_0xc0d7('0x7'),'internal':0xfa0+i,'type':_0xc0d7('0x8'),'transport':['udp','ws',_0xc0d7('0x9')],'disallow':['all'],'allow':[_0xc0d7('0xa')],'defaultuser':util[_0xc0d7('0x3')]('%s%s',_0xc0d7('0x5'),i),'encryption':_0xc0d7('0xb'),'avpf':'yes','force_avp':'yes','icesupport':_0xc0d7('0xb'),'dtlsenable':_0xc0d7('0xb'),'dtlsverify':'no','dtlscertfile':_0xc0d7('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xc0d7('0xd'),'callerid':util[_0xc0d7('0x3')](_0xc0d7('0xe'),util[_0xc0d7('0x3')](_0xc0d7('0x4'),'agent',i),0xfa0+i)});}db[_0xc0d7('0xf')][_0xc0d7('0x10')](users)[_0xc0d7('0x11')](function(){console[_0xc0d7('0x12')](_0xc0d7('0x13'));})[_0xc0d7('0x14')](function(_0x17724f){console[_0xc0d7('0x12')](_0x17724f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index a60f4b7..a5e9c91 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['userProfileId','handshake','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','WhatsappQueue','Trunk','user','FaxQueues','SmsQueues','MailQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','map','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','request','connectedAt','log','SocketIO\x20','address','disconnect','lodash','util','bluebird','../mysqldb','name','User','role','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','then','where','telephone','Campaign','format','Agents','user:%s','find'];(function(_0x46f1f4,_0x74fd4e){var _0x1b925d=function(_0x55144b){while(--_0x55144b){_0x46f1f4['push'](_0x46f1f4['shift']());}};_0x1b925d(++_0x74fd4e);}(_0x2542,0x169));var _0x2254=function(_0x2d2ad2,_0x1a52aa){_0x2d2ad2=_0x2d2ad2-0x0;var _0x6af9b0=_0x2542[_0x2d2ad2];return _0x6af9b0;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var db=require(_0x2254('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x2254('0x4')],'include':[{'as':'Agents','model':db[_0x2254('0x5')],'attributes':['id',_0x2254('0x4'),_0x2254('0x6')],'raw':!![],'where':{'role':_0x2254('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2254('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x2254('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x2254('0x4')],'where':{'role':_0x2254('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2254('0x4'),_0x2254('0x8')],'where':{'type':_0x2254('0x9')}};function getAssociatedResources(_0x263459,_0xbf1c18,_0xb395da){return db[_0x2254('0xa')][_0x2254('0xb')]({'where':{'name':_0x263459,'userProfileId':_0xbf1c18},'raw':!![]})['then'](function(_0x336e14){if(_0x336e14){if(_0x336e14[_0x2254('0xc')]){switch(_0x263459){case _0x2254('0xd'):case _0x2254('0xe'):case'FaxQueues':case'SmsQueues':case _0x2254('0xf'):case _0x2254('0x10'):case _0x2254('0x11'):return db[_0xb395da][_0x2254('0x12')](queryQueues);case _0x2254('0x13'):return db[_0xb395da][_0x2254('0x12')](queryTelephones);case'Trunks':return db[_0xb395da][_0x2254('0x12')](queryTrunks);case _0x2254('0x14'):return db[_0xb395da]['findAll'](queryCampaigns);}}else{return db[_0x2254('0x15')][_0x2254('0x12')]({'attributes':[_0x2254('0x16')],'where':{'sectionId':_0x336e14['id']},'raw':!![]})[_0x2254('0x17')](function(_0x26285a){if(_0x26285a){var _0xbc5548={'where':{'id':_['map'](_0x26285a,_0x2254('0x16'))},'raw':!![]};switch(_0xb395da){case'User':_0xbc5548[_0x2254('0x18')][_0x2254('0x6')]=_0x2254('0x19');break;case _0x2254('0x1a'):_0xbc5548[_0x2254('0x18')][_0x2254('0x8')]='ivr';break;}return db[_0xb395da]['findAll'](_0xbc5548);}else{return[];}});}}else{return[];}})['then'](function(_0xb05559){return _0xb05559;});}function joinOrLeaveQueues(_0x3a79f8,_0x3c3a98,_0x1f1163,_0x2801d9){_0x3a79f8[_0x3c3a98](util[_0x2254('0x1b')]('%s:queue:%s',_0x1f1163,_0x2801d9[_0x2254('0x4')]));if(_0x2801d9[_0x2254('0x1c')]){for(var _0x906cde=0x0;_0x906cde<_0x2801d9['Agents']['length'];_0x906cde+=0x1){_0x3a79f8[_0x3c3a98](util['format'](_0x2254('0x1d'),_0x2801d9[_0x2254('0x1c')][_0x906cde][_0x2254('0x4')]));}}}function joinOrLeave(_0x56b91e,_0x5713e4,_0x4d8faf){var _0x540020;if(_0x56b91e['handshake']['query']['id']){db[_0x2254('0x5')][_0x2254('0x1e')]({'attributes':['id',_0x2254('0x4'),_0x2254('0x6'),_0x2254('0x1f')],'where':{'id':_0x56b91e[_0x2254('0x20')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x2254('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x2254('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x2254('0x23')],'as':_0x2254('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x2254('0x25')],'as':_0x2254('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x2254('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2254('0x28')],'as':_0x2254('0x29'),'attributes':['id'],'raw':!![]}]})[_0x2254('0x17')](function(_0x13366a){if(_0x13366a){_0x540020=_0x13366a;_0x56b91e[_0x5713e4](util[_0x2254('0x1b')](_0x2254('0x1d'),_0x13366a[_0x2254('0x4')]));var _0x29975f=[];switch(_0x13366a[_0x2254('0x6')]){case _0x2254('0x2a'):_0x56b91e[_0x5713e4](_0x2254('0x2b'));_0x56b91e[_0x5713e4](_0x2254('0x2c'));if(queryQueues[_0x2254('0x2d')](_0x2254('0x2e'))){delete queryQueues[_0x2254('0x2e')];}_0x29975f[_0x2254('0x2f')](db[_0x2254('0x30')][_0x2254('0x12')](queryQueues));_0x29975f['push'](db[_0x2254('0x31')][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x32')][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x33')][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db['MailQueue'][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db['OpenchannelQueue'][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x34')][_0x2254('0x12')](queryQueues));_0x29975f['push'](db['User'][_0x2254('0x12')](queryTelephones));_0x29975f['push'](db[_0x2254('0x35')][_0x2254('0x12')](queryTrunks));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x1a')][_0x2254('0x12')](queryCampaigns));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x5')]['findAll'](queryAgents));break;case _0x2254('0x36'):_0x56b91e[_0x5713e4](_0x2254('0x2b'));_0x56b91e[_0x5713e4](_0x2254('0x2c'));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0xd'),_0x13366a[_0x2254('0x1f')],_0x2254('0x30')));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0xe'),_0x13366a[_0x2254('0x1f')],'ChatQueue'));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0x37'),_0x13366a[_0x2254('0x1f')],_0x2254('0x32')));_0x29975f['push'](getAssociatedResources(_0x2254('0x38'),_0x13366a[_0x2254('0x1f')],_0x2254('0x33')));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0xf'),_0x13366a[_0x2254('0x1f')],_0x2254('0x39')));_0x29975f[_0x2254('0x2f')](getAssociatedResources('OpenchannelQueues',_0x13366a[_0x2254('0x1f')],'OpenchannelQueue'));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0x11'),_0x13366a[_0x2254('0x1f')],_0x2254('0x34')));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0x13'),_0x13366a[_0x2254('0x1f')],'User'));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0x3a'),_0x13366a[_0x2254('0x1f')],_0x2254('0x35')));_0x29975f[_0x2254('0x2f')](getAssociatedResources('IvrCampaigns',_0x13366a[_0x2254('0x1f')],_0x2254('0x1a')));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x5')][_0x2254('0x12')](queryAgents));break;case'agent':_0x56b91e[_0x5713e4](_0x2254('0x2b'));_0x56b91e[_0x5713e4]('voice:outbound');_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3b')]({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3c')]({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3d')]({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3e')]({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a['getMailQueues']({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3f')]({'attributes':['id','name']}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x40')]({'attributes':['id',_0x2254('0x4')]}));break;}return BPromise[_0x2254('0x41')](_0x29975f);}})[_0x2254('0x17')](function(_0x470241){if(_0x470241&&_0x470241[_0x2254('0x42')]){for(var _0x3c685e=0x0;_0x3c685e<_0x470241[_0x2254('0x42')];_0x3c685e+=0x1){for(var _0x4fc83c=0x0;_0x4fc83c<_0x470241[_0x3c685e][_0x2254('0x42')];_0x4fc83c+=0x1){switch(_0x3c685e){case 0x0:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x43'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x1:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x44'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x2:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x45'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x3:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x46'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x4:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x47'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x5:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x48'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x6:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x49'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x7:if(_0x540020[_0x2254('0x6')]!==_0x2254('0x7'))_0x56b91e[_0x5713e4](util['format'](_0x2254('0x4a'),_0x470241[_0x3c685e][_0x4fc83c][_0x2254('0x4')]));break;case 0x8:if(_0x540020['role']!==_0x2254('0x7'))_0x56b91e[_0x5713e4](util[_0x2254('0x1b')](_0x2254('0x4b'),_0x470241[_0x3c685e][_0x4fc83c][_0x2254('0x4')]));break;case 0x9:if(_0x540020['role']!==_0x2254('0x7'))_0x56b91e[_0x5713e4](util[_0x2254('0x1b')]('campaign:%s:%s',_0x470241[_0x3c685e][_0x4fc83c][_0x2254('0x8')],_0x470241[_0x3c685e][_0x4fc83c][_0x2254('0x4')]));break;case 0xa:_0x56b91e[_0x5713e4](util[_0x2254('0x1b')](_0x2254('0x1d'),_0x470241[_0x3c685e][_0x4fc83c]['name']));break;}}}}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x222a4e=_['map'](_0x540020['ChatInteractions'],'id');return _0x540020[_0x2254('0x4d')](_0x222a4e)[_0x2254('0x17')](function(){for(var _0x5d6628=0x0;_0x5d6628<_0x222a4e[_0x2254('0x42')];_0x5d6628+=0x1){_0x4d8faf['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x222a4e[_0x5d6628]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x3be0f3=_[_0x2254('0x4e')](_0x540020[_0x2254('0x22')],'id');return _0x540020['removeMailInteractions'](_0x3be0f3)['then'](function(){for(var _0x1bd988=0x0;_0x1bd988<_0x3be0f3['length'];_0x1bd988+=0x1){_0x4d8faf[_0x2254('0x4f')](_0x2254('0x50'),{'MailInteractionId':Number(_0x3be0f3[_0x1bd988]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x49c60d=_[_0x2254('0x4e')](_0x540020[_0x2254('0x24')],'id');return _0x540020['removeFaxInteractions'](_0x49c60d)['then'](function(){for(var _0x1a2973=0x0;_0x1a2973<_0x49c60d['length'];_0x1a2973+=0x1){_0x4d8faf[_0x2254('0x4f')](_0x2254('0x51'),{'FaxInteractionId':Number(_0x49c60d[_0x1a2973]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x301a12=_['map'](_0x540020['SmsInteractions'],'id');return _0x540020[_0x2254('0x52')](_0x301a12)['then'](function(){for(var _0x335c66=0x0;_0x335c66<_0x301a12['length'];_0x335c66+=0x1){_0x4d8faf['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x301a12[_0x335c66]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x1d4b90=_[_0x2254('0x4e')](_0x540020[_0x2254('0x27')],'id');return _0x540020[_0x2254('0x53')](_0x1d4b90)[_0x2254('0x17')](function(){for(var _0x25137c=0x0;_0x25137c<_0x1d4b90[_0x2254('0x42')];_0x25137c+=0x1){_0x4d8faf[_0x2254('0x4f')](_0x2254('0x54'),{'OpenchannelInteractionId':Number(_0x1d4b90[_0x25137c]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x24e57a=_[_0x2254('0x4e')](_0x540020[_0x2254('0x29')],'id');return _0x540020[_0x2254('0x55')](_0x24e57a)[_0x2254('0x17')](function(){for(var _0x179cf1=0x0;_0x179cf1<_0x24e57a['length'];_0x179cf1+=0x1){_0x4d8faf[_0x2254('0x4f')](_0x2254('0x56'),{'WhatsappInteractionId':Number(_0x24e57a[_0x179cf1]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x57')](function(_0x38be3b){_0x56b91e['log'](_0x38be3b);});}}function onDisconnect(_0x494347,_0x471fdd){joinOrLeave(_0x494347,_0x2254('0x4c'),_0x471fdd);}function onConnect(_0x1d73a3){joinOrLeave(_0x1d73a3,_0x2254('0x58'));}exports[_0x2254('0x59')]=function(_0x53b55b){_0x53b55b['on'](_0x2254('0x5a'),function(_0x2d8a53){_0x2d8a53[_0x2254('0x5b')](0x0);_0x2d8a53['address']=_0x2d8a53['request'][_0x2254('0x5a')]['remoteAddress']+':'+_0x2d8a53[_0x2254('0x5c')][_0x2254('0x5a')]['remotePort'];_0x2d8a53[_0x2254('0x5d')]=new Date();_0x2d8a53[_0x2254('0x5e')]=function(_0x4d30a5){console[_0x2254('0x5e')](_0x2254('0x5f')+_0x2d8a53['nsp']['name']+'['+_0x2d8a53[_0x2254('0x60')]+']',_0x4d30a5);};_0x2d8a53['on'](_0x2254('0x61'),function(){onDisconnect(_0x2d8a53,_0x53b55b);_0x2d8a53['log']('DISCONNECTED');});onConnect(_0x2d8a53);_0x2d8a53[_0x2254('0x5e')]('CONNECTED');});}; \ No newline at end of file +var _0x020a=['SocketIO\x20','nsp','address','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','format','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','user','userProfileId','MailQueue','Trunk','getChatQueues','getFaxQueues','getWhatsappQueues','all','voice','fax','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt'];(function(_0x1d6229,_0x4b8c95){var _0x26150b=function(_0xb11488){while(--_0xb11488){_0x1d6229['push'](_0x1d6229['shift']());}};_0x26150b(++_0x4b8c95);}(_0x020a,0xc9));var _0xa020=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x020a[_0x45c48f];return _0xaf5037;};'use strict';var _=require(_0xa020('0x0'));var util=require(_0xa020('0x1'));var BPromise=require(_0xa020('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xa020('0x3'));var queryQueues={'attributes':['id',_0xa020('0x4')],'include':[{'as':_0xa020('0x5'),'model':db[_0xa020('0x6')],'attributes':['id',_0xa020('0x4'),_0xa020('0x7')],'raw':!![],'where':{'role':_0xa020('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa020('0x4')],'where':{'role':_0xa020('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xa020('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xa020('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa020('0x4'),_0xa020('0xa')],'where':{'type':_0xa020('0xb')}};function getAssociatedResources(_0x504f83,_0x38704f,_0x52f53a){return db[_0xa020('0xc')][_0xa020('0xd')]({'where':{'name':_0x504f83,'userProfileId':_0x38704f},'raw':!![]})[_0xa020('0xe')](function(_0x1f42ed){if(_0x1f42ed){if(_0x1f42ed[_0xa020('0xf')]){switch(_0x504f83){case'VoiceQueues':case'ChatQueues':case _0xa020('0x10'):case _0xa020('0x11'):case _0xa020('0x12'):case _0xa020('0x13'):case _0xa020('0x14'):return db[_0x52f53a][_0xa020('0x15')](queryQueues);case _0xa020('0x16'):return db[_0x52f53a][_0xa020('0x15')](queryTelephones);case _0xa020('0x17'):return db[_0x52f53a][_0xa020('0x15')](queryTrunks);case _0xa020('0x18'):return db[_0x52f53a][_0xa020('0x15')](queryCampaigns);}}else{return db[_0xa020('0x19')][_0xa020('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x1f42ed['id']},'raw':!![]})[_0xa020('0xe')](function(_0x1388ad){if(_0x1388ad){var _0x38ee15={'where':{'id':_[_0xa020('0x1a')](_0x1388ad,_0xa020('0x1b'))},'raw':!![]};switch(_0x52f53a){case _0xa020('0x6'):_0x38ee15[_0xa020('0x1c')]['role']=_0xa020('0x9');break;case _0xa020('0x1d'):_0x38ee15[_0xa020('0x1c')][_0xa020('0xa')]=_0xa020('0xb');break;}return db[_0x52f53a]['findAll'](_0x38ee15);}else{return[];}});}}else{return[];}})[_0xa020('0xe')](function(_0x470953){return _0x470953;});}function joinOrLeaveQueues(_0x1a9723,_0x2fed27,_0x59c001,_0x5a18c7){_0x1a9723[_0x2fed27](util['format'](_0xa020('0x1e'),_0x59c001,_0x5a18c7[_0xa020('0x4')]));if(_0x5a18c7[_0xa020('0x5')]){for(var _0xb72f64=0x0;_0xb72f64<_0x5a18c7['Agents'][_0xa020('0x1f')];_0xb72f64+=0x1){_0x1a9723[_0x2fed27](util['format'](_0xa020('0x20'),_0x5a18c7[_0xa020('0x5')][_0xb72f64][_0xa020('0x4')]));}}}function joinOrLeave(_0x36debe,_0x1123c0,_0x402689){var _0x173705;if(_0x36debe[_0xa020('0x21')][_0xa020('0x22')]['id']){db['User'][_0xa020('0x23')]({'attributes':['id',_0xa020('0x4'),_0xa020('0x7'),'userProfileId'],'where':{'id':_0x36debe[_0xa020('0x21')][_0xa020('0x22')]['id']},'include':[{'model':db[_0xa020('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xa020('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xa020('0x26')],'as':_0xa020('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xa020('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xa020('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xa020('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xa020('0xe')](function(_0x29112a){if(_0x29112a){_0x173705=_0x29112a;_0x36debe[_0x1123c0](util[_0xa020('0x2b')](_0xa020('0x20'),_0x29112a['name']));var _0x5aefdc=[];switch(_0x29112a[_0xa020('0x7')]){case'admin':_0x36debe[_0x1123c0](_0xa020('0x2c'));_0x36debe[_0x1123c0](_0xa020('0x2d'));if(queryQueues[_0xa020('0x2e')]('include')){delete queryQueues[_0xa020('0x2f')];}_0x5aefdc[_0xa020('0x30')](db[_0xa020('0x31')][_0xa020('0x15')](queryQueues));_0x5aefdc[_0xa020('0x30')](db[_0xa020('0x32')]['findAll'](queryQueues));_0x5aefdc['push'](db[_0xa020('0x33')][_0xa020('0x15')](queryQueues));_0x5aefdc[_0xa020('0x30')](db[_0xa020('0x34')][_0xa020('0x15')](queryQueues));_0x5aefdc[_0xa020('0x30')](db['MailQueue']['findAll'](queryQueues));_0x5aefdc[_0xa020('0x30')](db[_0xa020('0x35')][_0xa020('0x15')](queryQueues));_0x5aefdc[_0xa020('0x30')](db[_0xa020('0x36')][_0xa020('0x15')](queryQueues));_0x5aefdc[_0xa020('0x30')](db[_0xa020('0x6')]['findAll'](queryTelephones));_0x5aefdc[_0xa020('0x30')](db['Trunk'][_0xa020('0x15')](queryTrunks));_0x5aefdc[_0xa020('0x30')](db[_0xa020('0x1d')][_0xa020('0x15')](queryCampaigns));_0x5aefdc[_0xa020('0x30')](db[_0xa020('0x6')]['findAll'](queryAgents));break;case _0xa020('0x37'):_0x36debe[_0x1123c0]('voice:inbound');_0x36debe[_0x1123c0]('voice:outbound');_0x5aefdc[_0xa020('0x30')](getAssociatedResources('VoiceQueues',_0x29112a['userProfileId'],_0xa020('0x31')));_0x5aefdc[_0xa020('0x30')](getAssociatedResources('ChatQueues',_0x29112a[_0xa020('0x38')],'ChatQueue'));_0x5aefdc[_0xa020('0x30')](getAssociatedResources(_0xa020('0x10'),_0x29112a[_0xa020('0x38')],_0xa020('0x33')));_0x5aefdc['push'](getAssociatedResources(_0xa020('0x11'),_0x29112a[_0xa020('0x38')],_0xa020('0x34')));_0x5aefdc['push'](getAssociatedResources('MailQueues',_0x29112a[_0xa020('0x38')],_0xa020('0x39')));_0x5aefdc[_0xa020('0x30')](getAssociatedResources(_0xa020('0x13'),_0x29112a['userProfileId'],_0xa020('0x35')));_0x5aefdc[_0xa020('0x30')](getAssociatedResources(_0xa020('0x14'),_0x29112a[_0xa020('0x38')],'WhatsappQueue'));_0x5aefdc[_0xa020('0x30')](getAssociatedResources('Telephones',_0x29112a[_0xa020('0x38')],_0xa020('0x6')));_0x5aefdc[_0xa020('0x30')](getAssociatedResources('Trunks',_0x29112a['userProfileId'],_0xa020('0x3a')));_0x5aefdc[_0xa020('0x30')](getAssociatedResources(_0xa020('0x18'),_0x29112a[_0xa020('0x38')],'Campaign'));_0x5aefdc[_0xa020('0x30')](db[_0xa020('0x6')][_0xa020('0x15')](queryAgents));break;case _0xa020('0x8'):_0x36debe[_0x1123c0]('voice:inbound');_0x36debe[_0x1123c0](_0xa020('0x2d'));_0x5aefdc[_0xa020('0x30')](_0x29112a['getVoiceQueues']({'attributes':['id',_0xa020('0x4')]}));_0x5aefdc[_0xa020('0x30')](_0x29112a[_0xa020('0x3b')]({'attributes':['id','name']}));_0x5aefdc['push'](_0x29112a[_0xa020('0x3c')]({'attributes':['id',_0xa020('0x4')]}));_0x5aefdc[_0xa020('0x30')](_0x29112a['getSmsQueues']({'attributes':['id',_0xa020('0x4')]}));_0x5aefdc[_0xa020('0x30')](_0x29112a['getMailQueues']({'attributes':['id',_0xa020('0x4')]}));_0x5aefdc[_0xa020('0x30')](_0x29112a['getOpenchannelQueues']({'attributes':['id',_0xa020('0x4')]}));_0x5aefdc['push'](_0x29112a[_0xa020('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0xa020('0x3e')](_0x5aefdc);}})[_0xa020('0xe')](function(_0x33e502){if(_0x33e502&&_0x33e502[_0xa020('0x1f')]){for(var _0x29e671=0x0;_0x29e671<_0x33e502['length'];_0x29e671+=0x1){for(var _0xce1a=0x0;_0xce1a<_0x33e502[_0x29e671][_0xa020('0x1f')];_0xce1a+=0x1){switch(_0x29e671){case 0x0:joinOrLeaveQueues(_0x36debe,_0x1123c0,_0xa020('0x3f'),_0x33e502[_0x29e671][_0xce1a]);break;case 0x1:joinOrLeaveQueues(_0x36debe,_0x1123c0,'chat',_0x33e502[_0x29e671][_0xce1a]);break;case 0x2:joinOrLeaveQueues(_0x36debe,_0x1123c0,_0xa020('0x40'),_0x33e502[_0x29e671][_0xce1a]);break;case 0x3:joinOrLeaveQueues(_0x36debe,_0x1123c0,'sms',_0x33e502[_0x29e671][_0xce1a]);break;case 0x4:joinOrLeaveQueues(_0x36debe,_0x1123c0,_0xa020('0x41'),_0x33e502[_0x29e671][_0xce1a]);break;case 0x5:joinOrLeaveQueues(_0x36debe,_0x1123c0,'openchannel',_0x33e502[_0x29e671][_0xce1a]);break;case 0x6:joinOrLeaveQueues(_0x36debe,_0x1123c0,_0xa020('0x42'),_0x33e502[_0x29e671][_0xce1a]);break;case 0x7:if(_0x173705[_0xa020('0x7')]!==_0xa020('0x8'))_0x36debe[_0x1123c0](util['format'](_0xa020('0x43'),_0x33e502[_0x29e671][_0xce1a][_0xa020('0x4')]));break;case 0x8:if(_0x173705[_0xa020('0x7')]!==_0xa020('0x8'))_0x36debe[_0x1123c0](util[_0xa020('0x2b')](_0xa020('0x44'),_0x33e502[_0x29e671][_0xce1a]['name']));break;case 0x9:if(_0x173705[_0xa020('0x7')]!=='agent')_0x36debe[_0x1123c0](util['format'](_0xa020('0x45'),_0x33e502[_0x29e671][_0xce1a][_0xa020('0xa')],_0x33e502[_0x29e671][_0xce1a][_0xa020('0x4')]));break;case 0xa:_0x36debe[_0x1123c0](util['format'](_0xa020('0x20'),_0x33e502[_0x29e671][_0xce1a][_0xa020('0x4')]));break;}}}}})[_0xa020('0xe')](function(){if(_0x1123c0===_0xa020('0x46')){var _0x292849=_['map'](_0x173705[_0xa020('0x47')],'id');return _0x173705['removeChatInteractions'](_0x292849)[_0xa020('0xe')](function(){for(var _0x49c87b=0x0;_0x49c87b<_0x292849[_0xa020('0x1f')];_0x49c87b+=0x1){_0x402689[_0xa020('0x48')](_0xa020('0x49'),{'ChatInteractionId':Number(_0x292849[_0x49c87b]),'UserId':Number(_0x173705['id'])});}});}})[_0xa020('0xe')](function(){if(_0x1123c0===_0xa020('0x46')){var _0x3c6b64=_[_0xa020('0x1a')](_0x173705[_0xa020('0x25')],'id');return _0x173705[_0xa020('0x4a')](_0x3c6b64)[_0xa020('0xe')](function(){for(var _0x26b8b9=0x0;_0x26b8b9<_0x3c6b64[_0xa020('0x1f')];_0x26b8b9+=0x1){_0x402689['emit'](_0xa020('0x4b'),{'MailInteractionId':Number(_0x3c6b64[_0x26b8b9]),'UserId':Number(_0x173705['id'])});}});}})[_0xa020('0xe')](function(){if(_0x1123c0==='leave'){var _0x3e3619=_[_0xa020('0x1a')](_0x173705[_0xa020('0x27')],'id');return _0x173705[_0xa020('0x4c')](_0x3e3619)[_0xa020('0xe')](function(){for(var _0x5c5570=0x0;_0x5c5570<_0x3e3619[_0xa020('0x1f')];_0x5c5570+=0x1){_0x402689[_0xa020('0x48')](_0xa020('0x4d'),{'FaxInteractionId':Number(_0x3e3619[_0x5c5570]),'UserId':Number(_0x173705['id'])});}});}})['then'](function(){if(_0x1123c0===_0xa020('0x46')){var _0x5730f8=_['map'](_0x173705['SmsInteractions'],'id');return _0x173705[_0xa020('0x4e')](_0x5730f8)[_0xa020('0xe')](function(){for(var _0x1415f1=0x0;_0x1415f1<_0x5730f8[_0xa020('0x1f')];_0x1415f1+=0x1){_0x402689[_0xa020('0x48')](_0xa020('0x4f'),{'SmsInteractionId':Number(_0x5730f8[_0x1415f1]),'UserId':Number(_0x173705['id'])});}});}})[_0xa020('0xe')](function(){if(_0x1123c0===_0xa020('0x46')){var _0x2bda2a=_[_0xa020('0x1a')](_0x173705[_0xa020('0x29')],'id');return _0x173705[_0xa020('0x50')](_0x2bda2a)['then'](function(){for(var _0xfd5a91=0x0;_0xfd5a91<_0x2bda2a['length'];_0xfd5a91+=0x1){_0x402689[_0xa020('0x48')](_0xa020('0x51'),{'OpenchannelInteractionId':Number(_0x2bda2a[_0xfd5a91]),'UserId':Number(_0x173705['id'])});}});}})[_0xa020('0xe')](function(){if(_0x1123c0===_0xa020('0x46')){var _0x3b6671=_[_0xa020('0x1a')](_0x173705['WhatsappInteractions'],'id');return _0x173705[_0xa020('0x52')](_0x3b6671)[_0xa020('0xe')](function(){for(var _0x38b2ed=0x0;_0x38b2ed<_0x3b6671[_0xa020('0x1f')];_0x38b2ed+=0x1){_0x402689[_0xa020('0x48')](_0xa020('0x53'),{'WhatsappInteractionId':Number(_0x3b6671[_0x38b2ed]),'UserId':Number(_0x173705['id'])});}});}})[_0xa020('0x54')](function(_0x24b7ef){_0x36debe[_0xa020('0x55')](_0x24b7ef);});}}function onDisconnect(_0x398c6,_0x1df5e8){joinOrLeave(_0x398c6,_0xa020('0x46'),_0x1df5e8);}function onConnect(_0x5e22de){joinOrLeave(_0x5e22de,_0xa020('0x56'));}exports['default']=function(_0x2c4ebb){_0x2c4ebb['on'](_0xa020('0x57'),function(_0x1c4e4c){_0x1c4e4c[_0xa020('0x58')](0x0);_0x1c4e4c['address']=_0x1c4e4c[_0xa020('0x59')]['connection'][_0xa020('0x5a')]+':'+_0x1c4e4c[_0xa020('0x59')]['connection'][_0xa020('0x5b')];_0x1c4e4c[_0xa020('0x5c')]=new Date();_0x1c4e4c[_0xa020('0x55')]=function(_0x51677f){console[_0xa020('0x55')](_0xa020('0x5d')+_0x1c4e4c[_0xa020('0x5e')]['name']+'['+_0x1c4e4c[_0xa020('0x5f')]+']',_0x51677f);};_0x1c4e4c['on']('disconnect',function(){onDisconnect(_0x1c4e4c,_0x2c4ebb);_0x1c4e4c[_0xa020('0x55')](_0xa020('0x60'));});onConnect(_0x1c4e4c);_0x1c4e4c[_0xa020('0x55')](_0xa020('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a2d2a08..9a49d21 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 _0x170c=['SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','changed','closed','substatus','Sequelize','AfterUpdate','User','find','fullname','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','info','Trigger,\x20%s','error','code','catch','get','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','contact','UserId','then','interface','format'];(function(_0x44da01,_0x13c7f7){var _0x53cce7=function(_0x52eda7){while(--_0x52eda7){_0x44da01['push'](_0x44da01['shift']());}};_0x53cce7(++_0x13c7f7);}(_0x170c,0x18e));var _0xc170=function(_0x1beb80,_0x34016e){_0x1beb80=_0x1beb80-0x0;var _0x716efd=_0x170c[_0x1beb80];return _0x716efd;};'use strict';var util=require(_0xc170('0x0'));var db=require(_0xc170('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0xc170('0x2'))(_0xc170('0x3'));var client=jayson[_0xc170('0x4')][_0xc170('0x5')]({'port':0x232a});var triggers=[{'channel':_0xc170('0x6'),'model':_0xc170('0x7'),'event':'afterCreate','condition':_0xc170('0x8'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0xc170('0x9'),'condition':_0xc170('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0xc170('0xb'),'event':_0xc170('0xc'),'condition':_0xc170('0xd'),'callback':afterCreateMessage},{'channel':_0xc170('0xe'),'model':_0xc170('0xf'),'event':_0xc170('0xc'),'condition':_0xc170('0x8'),'callback':afterCreate},{'channel':_0xc170('0xe'),'model':_0xc170('0xf'),'event':_0xc170('0x9'),'condition':_0xc170('0xa'),'callback':afterUpdate},{'channel':'Sms','model':_0xc170('0x10'),'event':_0xc170('0xc'),'condition':_0xc170('0xd'),'callback':afterCreateMessage},{'channel':_0xc170('0x11'),'model':_0xc170('0x12'),'event':_0xc170('0xc'),'condition':_0xc170('0x8'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xc170('0x12'),'event':'afterUpdate','condition':_0xc170('0xa'),'callback':afterUpdate},{'channel':_0xc170('0x11'),'model':_0xc170('0x13'),'event':_0xc170('0xc'),'condition':_0xc170('0xd'),'callback':afterCreateMessage},{'channel':_0xc170('0x14'),'model':_0xc170('0x15'),'event':_0xc170('0xc'),'condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':_0xc170('0x15'),'event':'afterUpdate','condition':_0xc170('0xa'),'callback':afterUpdate},{'channel':_0xc170('0x14'),'model':_0xc170('0x16'),'event':_0xc170('0xc'),'condition':_0xc170('0xd'),'callback':afterCreateMessage},{'channel':_0xc170('0x17'),'model':_0xc170('0x18'),'event':_0xc170('0xc'),'condition':_0xc170('0x8'),'callback':afterCreate},{'channel':_0xc170('0x17'),'model':'MailInteraction','event':'afterUpdate','condition':_0xc170('0xa'),'callback':afterUpdate},{'channel':_0xc170('0x17'),'model':_0xc170('0x19'),'event':_0xc170('0xc'),'condition':_0xc170('0xd'),'callback':afterCreateMessage},{'channel':_0xc170('0x1a'),'model':'OpenchannelInteraction','event':_0xc170('0xc'),'condition':_0xc170('0x8'),'callback':afterCreate},{'channel':_0xc170('0x1a'),'model':_0xc170('0x1b'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xc170('0x1a'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0xc170('0xd'),'callback':afterCreateMessage}];function request(_0xd8ce68){return client[_0xc170('0x1c')](_0xc170('0x1d'),_0xd8ce68)['then'](function(_0x2afa38){logger[_0xc170('0x1e')](_0xc170('0x1f'),'EventManager',_0x2afa38);if(_0x2afa38[_0xc170('0x20')]){if(_0x2afa38[_0xc170('0x20')][_0xc170('0x21')]===0x1f4){logger[_0xc170('0x20')](_0xc170('0x1f'),_0xc170('0x1d'),_0x2afa38[_0xc170('0x20')]);}}})[_0xc170('0x22')](function(_0x198896){logger[_0xc170('0x20')](_0xc170('0x1f'),_0xc170('0x1d'),_0x198896);});}function afterCreateMessage(_0x51de0c){return function(_0x2a3c3c){_0x2a3c3c=_0x2a3c3c[_0xc170('0x23')]({'plain':!![]});_0x2a3c3c['channel']=_0x51de0c;_0x2a3c3c[_0xc170('0x24')]=_0x51de0c;_0x2a3c3c[_0xc170('0x25')]=_0x2a3c3c[_0xc170('0x26')];Promise[_0xc170('0x27')]()['then'](function(){if(typeof _0x2a3c3c[_0xc170('0x28')]===_0xc170('0x29'))return null;var _0xd0c50c=_0xc170('0x2a')+_0x2a3c3c[_0xc170('0x28')];return db[_0xc170('0x2b')][_0xc170('0x2c')](_0xd0c50c,{'type':db['Sequelize'][_0xc170('0x2d')][_0xc170('0x2e')],'raw':!![]});})['then'](function(_0x210053){if(_0x210053){_0x2a3c3c[_0xc170('0x2f')]=_0x210053[0x0];}if(typeof _0x2a3c3c[_0xc170('0x30')]==='undefined')return;return getAgent(_0x2a3c3c['UserId']);})[_0xc170('0x31')](function(_0x41e508){if(_0x41e508){_0x2a3c3c[_0xc170('0x32')]=util[_0xc170('0x33')](_0xc170('0x34'),_0x41e508[_0xc170('0x35')]);_0x2a3c3c[_0xc170('0x36')]=_0x41e508;_0x2a3c3c[_0xc170('0x37')]=_0x51de0c;return request({'event':_0xc170('0x38'),'message':_0x2a3c3c});}else{return request({'event':_0xc170('0x39'),'message':_0x2a3c3c});}})['catch'](function(_0x3e0932){logger[_0xc170('0x20')]('Trigger,\x20%s','AfterCreateMessage',_0x3e0932);});};}function afterCreate(_0x2d3f0c,_0x2ea3a6){return function(_0x1ef706){_0x1ef706=_0x1ef706['get']({'plain':!![]});_0x1ef706[_0xc170('0x37')]=_0x2d3f0c;_0x1ef706[_0xc170('0x24')]=_0x2d3f0c;_0x1ef706[_0xc170('0x25')]='opened';Promise['resolve']()['then'](function(){var _0x5b4d16=_0xc170('0x2a')+_0x1ef706[_0xc170('0x28')];return db[_0xc170('0x2b')][_0xc170('0x2c')](_0x5b4d16,{'type':db['Sequelize'][_0xc170('0x2d')][_0xc170('0x2e')],'raw':!![]});})[_0xc170('0x31')](function(_0x366801){if(_0x366801){_0x1ef706[_0xc170('0x2f')]=_0x366801[0x0];}if(typeof _0x1ef706[_0xc170('0x30')]===_0xc170('0x29'))return;return getAgent(_0x1ef706['UserId']);})[_0xc170('0x31')](function(_0x2b6989){if(_0x2b6989){_0x1ef706[_0xc170('0x32')]=util[_0xc170('0x33')](_0xc170('0x34'),_0x2b6989[_0xc170('0x35')]);_0x1ef706[_0xc170('0x36')]=_0x2b6989;}return request({'event':_0x2ea3a6,'message':_0x1ef706});})[_0xc170('0x22')](function(_0x59a2ed){logger[_0xc170('0x20')](_0xc170('0x1f'),'AfterCreate',_0x59a2ed);});};}function afterUpdate(_0x498e9b){return function(_0x5d59da){var _0x5b1f2a=_0x5d59da[_0xc170('0x3a')](_0xc170('0x3b'))&&_0x5d59da[_0xc170('0x3b')];var _0x599e01=_0x5d59da[_0xc170('0x3a')](_0xc170('0x3c'));if(_0x5b1f2a||_0x599e01){var _0x317b2f=_0x5b1f2a?_0xc170('0xa'):'substatus';var _0x25e3ca=_0x5d59da[_0xc170('0x23')]({'plain':!![]});_0x25e3ca[_0xc170('0x37')]=_0x498e9b;_0x25e3ca[_0xc170('0x24')]=_0x498e9b;_0x25e3ca['event']=_0x5b1f2a?'closed':_0xc170('0x3c');var _0x37ac85=_0xc170('0x2a')+_0x25e3ca[_0xc170('0x28')];return db['sequelize'][_0xc170('0x2c')](_0x37ac85,{'type':db[_0xc170('0x3d')][_0xc170('0x2d')][_0xc170('0x2e')],'raw':!![]})[_0xc170('0x31')](function(_0x130ac1){if(_0x130ac1){_0x25e3ca[_0xc170('0x2f')]=_0x130ac1[0x0];}if(typeof _0x25e3ca[_0xc170('0x30')]===_0xc170('0x29'))return;return getAgent(_0x25e3ca[_0xc170('0x30')]);})[_0xc170('0x31')](function(_0x336c88){if(_0x336c88){_0x25e3ca[_0xc170('0x32')]=util['format'](_0xc170('0x34'),_0x336c88[_0xc170('0x35')]);_0x25e3ca['agent']=_0x336c88;}return request({'event':_0x317b2f,'message':_0x25e3ca});})[_0xc170('0x22')](function(_0x12d1fb){logger[_0xc170('0x20')]('Trigger,\x20%s',_0xc170('0x3e'),_0x12d1fb);});}};}function getAgent(_0x52db4e){return db[_0xc170('0x3f')][_0xc170('0x40')]({'where':{'id':_0x52db4e},'attributes':['id',_0xc170('0x35'),_0xc170('0x41'),'email',_0xc170('0x42')],'raw':!![]})[_0xc170('0x31')](function(_0x5b9039){return _0x5b9039;});}exports[_0xc170('0x43')]=function(){for(var _0xcfde01=0x0;_0xcfde01=_0x3afaaf[_0x81e0('0x14')]){throw Error(_0x81e0('0x15'));}_0x409598(_0x541e57);})[_0x81e0('0x16')](function(_0x68d8a7){_0x831d0b(_0x68d8a7);});});}; \ No newline at end of file +var _0xb4a0=['Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','voice','mail','chat','sms','whatsapp','toLowerCase','includes','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','User','count','then','agents'];(function(_0x4f0bb2,_0x1df0d5){var _0x352ccb=function(_0x3eedb2){while(--_0x3eedb2){_0x4f0bb2['push'](_0x4f0bb2['shift']());}};_0x352ccb(++_0x1df0d5);}(_0xb4a0,0x1ba));var _0x0b4a=function(_0x521ee4,_0x2aba99){_0x521ee4=_0x521ee4-0x0;var _0x1a0a12=_0xb4a0[_0x521ee4];return _0x1a0a12;};'use strict';var _=require('lodash');var BPromise=require(_0x0b4a('0x0'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=[_0x0b4a('0x1'),_0x0b4a('0x2'),_0x0b4a('0x3'),'fax',_0x0b4a('0x4'),_0x0b4a('0x5'),'openchannel'];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x2f3cd8){_0x2f3cd8=_0x2f3cd8[_0x0b4a('0x6')]();return _[_0x0b4a('0x7')](channels,_0x2f3cd8);};exports[_0x0b4a('0x8')]=function(_0x378a7f,_0x39227b,_0x126d2e,_0x199cfd){var _0x25f705={'loginAttempts':_0x39227b,'blocked':_0x126d2e};if(!_[_0x0b4a('0x9')](_0x199cfd)){_0x25f705['blockedAt']=_0x199cfd;}return _0x378a7f[_0x0b4a('0xa')](_0x25f705);};exports[_0x0b4a('0xb')]=function(_0x296d14){return new BPromise(function(_0xe082f,_0x18f8dd){var _0x3818b4=0x0;if(_0x296d14[_0x0b4a('0xc')]!==_0x0b4a('0xd')){_0xe082f(_0x296d14);}db[_0x0b4a('0xe')][_0x0b4a('0xf')]({'where':{'role':_0x0b4a('0xd'),'online':!![],'id':{'$ne':_0x296d14['id']}}})[_0x0b4a('0x10')](function(_0x38e6cf){_0x3818b4=_0x38e6cf;return util[_0x0b4a('0xb')]();})['then'](function(_0xe26085){if(_0xe26085&&_0xe26085[_0x0b4a('0x11')]&&_0x3818b4>=_0xe26085['agents']){throw Error(_0x0b4a('0x12'));}_0xe082f(_0x296d14);})[_0x0b4a('0x13')](function(_0x4662e7){_0x18f8dd(_0x4662e7);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 7981c5a..1896441 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x995f=['status','send','exports'];(function(_0x49137e,_0x5e7642){var _0x110571=function(_0x5d871d){while(--_0x5d871d){_0x49137e['push'](_0x49137e['shift']());}};_0x110571(++_0x5e7642);}(_0x995f,0x1b2));var _0xf995=function(_0x3c78e7,_0x19a615){_0x3c78e7=_0x3c78e7-0x0;var _0x46c763=_0x995f[_0x3c78e7];return _0x46c763;};'use strict';module[_0xf995('0x0')][0x194]=function pageNotFound(_0x3e441e,_0x339654){var _0x26fef7='404';var _0x50d464=0x194;var _0x3ba99d={'status':_0x50d464};_0x339654[_0xf995('0x1')](_0x3ba99d[_0xf995('0x1')]);_0x339654['render'](_0x26fef7,{},function(_0x143361,_0x46134d){if(_0x143361){return _0x339654[_0xf995('0x1')](_0x3ba99d['status'])['json'](_0x3ba99d);}_0x339654[_0xf995('0x2')](_0x46134d);});}; \ No newline at end of file +var _0xa902=['json','exports','404','render','status'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xa902,0x8d));var _0x2a90=function(_0x35f1ab,_0x427d19){_0x35f1ab=_0x35f1ab-0x0;var _0x53fa2a=_0xa902[_0x35f1ab];return _0x53fa2a;};'use strict';module[_0x2a90('0x0')][0x194]=function pageNotFound(_0x8dd67,_0x416198){var _0x3a1839=_0x2a90('0x1');var _0x4983a4=0x194;var _0x2da982={'status':_0x4983a4};_0x416198['status'](_0x2da982['status']);_0x416198[_0x2a90('0x2')](_0x3a1839,{},function(_0x2b40c0,_0x203ecf){if(_0x2b40c0){return _0x416198[_0x2a90('0x3')](_0x2da982[_0x2a90('0x3')])[_0x2a90('0x4')](_0x2da982);}_0x416198['send'](_0x203ecf);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f87aade..509e555 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['ScreenRecording','VoiceMailMessage','Messages','mailboxuser','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','VoiceCallReport','Contact','ContactId','MailServerIn','MailAccountId','Imap','Smtp','Dispositions','Answers','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','List','Items','FaxAccountId','Interactions','FaxApplication','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatGroupId','chat_group_has_users','CmCompany','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','Automation','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','Fields','MetricId','Configurations','Subjects','SubjectId','FieldId','AccountId','Subject','DescriptionId','Field','VariableId','Description','int_desk_configuration_has_tags','ZohoConfiguration','Descriptions','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FreshsalesAccount','FreshsalesField','FromId','ToId','SessionId','ProjectId','user_has_square_projects','MailQueues','ChatQueues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','VoicePrefix','TeamVoicePrefix','TrunkBackup','TrunkBackupId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsAccountId','CmCustomField','CustomFields','Queues','UserVoicePrefix','userProfileId','UserProfileSection','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','username','options','password','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','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','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','Team','Campaign','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','User','hasMany','VoiceRecording','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','SenderId','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','FaxQueues','SmsQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','CmHopper','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','IntervalId','Agents','Teams','voice_queues_has_cm_blacklists'];(function(_0x680969,_0x261431){var _0x3932fd=function(_0x50849e){while(--_0x50849e){_0x680969['push'](_0x680969['shift']());}};_0x3932fd(++_0x261431);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4cd410,_0x5064d3){_0x4cd410=_0x4cd410-0x0;var _0x52b21c=_0x9ffd[_0x4cd410];return _0x52b21c;};'use strict';var config=require(_0xd9ff('0x0'));var Sequelize=require(_0xd9ff('0x1'));var _=require(_0xd9ff('0x2'));var jstz=require('jstz');var timezone=jstz[_0xd9ff('0x3')]();config[_0xd9ff('0x1')]=_[_0xd9ff('0x4')](config[_0xd9ff('0x1')],{'database':'motion2','username':_0xd9ff('0x5'),'password':_0xd9ff('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd9ff('0x7'),'dialectOptions':{'charset':_0xd9ff('0x8')},'logging':![],'timezone':timezone[_0xd9ff('0x9')](),'define':{'charset':_0xd9ff('0xa'),'collate':_0xd9ff('0xb')}}});config[_0xd9ff('0xc')]=_[_0xd9ff('0x4')](config[_0xd9ff('0xc')],{'database':_0xd9ff('0xd'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xd9ff('0x8')},'logging':![],'timezone':timezone[_0xd9ff('0x9')](),'define':{'charset':_0xd9ff('0xa'),'collate':_0xd9ff('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd9ff('0x1')][_0xd9ff('0xe')],config[_0xd9ff('0x1')][_0xd9ff('0xf')],config['sequelize']['password'],config[_0xd9ff('0x1')][_0xd9ff('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd9ff('0xc')][_0xd9ff('0xe')],config[_0xd9ff('0xc')]['username'],config[_0xd9ff('0xc')][_0xd9ff('0x11')],config['sequelizeHistory'][_0xd9ff('0x10')])};db['User']=db['sequelize']['import']('../api/user/user.model');db[_0xd9ff('0x12')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x14'));db[_0xd9ff('0x15')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x16'));db[_0xd9ff('0x17')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x18'));db[_0xd9ff('0x19')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db['sequelize']['import'](_0xd9ff('0x1a'));db['ScreenRecording']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x1b'));db[_0xd9ff('0x1c')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x1d'));db['VoiceCallReport']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x1e'));db[_0xd9ff('0x1f')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0xd9ff('0x20')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x21'));db['VoiceQueueReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x22'));db[_0xd9ff('0x23')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x24'));db[_0xd9ff('0x25')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x26'));db['VoiceTransferReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x27'));db['UserVoiceQueueRt']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x28'));db[_0xd9ff('0x29')]=db['sequelize'][_0xd9ff('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xd9ff('0x2a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x2b'));db[_0xd9ff('0x2c')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x2d'));db[_0xd9ff('0x2e')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x2f'));db[_0xd9ff('0x30')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x31'));db[_0xd9ff('0x32')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x33'));db['UserWhatsappQueue']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x34'));db['MailServerIn']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x35'));db['MailServerOut']=db['sequelize']['import'](_0xd9ff('0x36'));db[_0xd9ff('0x37')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x38'));db[_0xd9ff('0x39')]=db['sequelize']['import']('../api/mailQueue/mailQueue.model');db[_0xd9ff('0x3a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x3b'));db['MailInteraction']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x3c'));db[_0xd9ff('0x3d')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/mailMessage/mailMessage.model');db[_0xd9ff('0x3e')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x3f'));db[_0xd9ff('0x40')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x41'));db[_0xd9ff('0x42')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x43'));db[_0xd9ff('0x44')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0xd9ff('0x45')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x46'));db[_0xd9ff('0x47')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0xd9ff('0x48')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x49'));db[_0xd9ff('0x4a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x4b'));db['FaxQueueReport']=db['sequelize']['import'](_0xd9ff('0x4c'));db['SmsAccount']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x4d'));db['SmsApplication']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/smsApplication/smsApplication.model');db[_0xd9ff('0x4e')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x4f'));db['SmsMessage']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x50'));db['SmsQueue']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x51'));db[_0xd9ff('0x52')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x53'));db[_0xd9ff('0x54')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x55'));db[_0xd9ff('0x56')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x57'));db[_0xd9ff('0x58')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x59'));db[_0xd9ff('0x5a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x5b'));db[_0xd9ff('0x5c')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xd9ff('0x5d')]=db['sequelize'][_0xd9ff('0x13')]('../api/chatApplication/chatApplication.model');db[_0xd9ff('0x5e')]=db['sequelize'][_0xd9ff('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0xd9ff('0x5f')]=db['sequelize'][_0xd9ff('0x13')]('../api/chatMessage/chatMessage.model');db[_0xd9ff('0x60')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x61'));db[_0xd9ff('0x62')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x63'));db[_0xd9ff('0x64')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x65'));db[_0xd9ff('0x66')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x67'));db['CmCompany']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x68'));db[_0xd9ff('0x69')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x6a'));db['CmHopper']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/cmHopper/cmHopper.model');db[_0xd9ff('0x6b')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x6c'));db[_0xd9ff('0x6d')]=db[_0xd9ff('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xd9ff('0x6e')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x6f'));db[_0xd9ff('0x70')]=db[_0xd9ff('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x71'));db[_0xd9ff('0x72')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x73'));db['Automation']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x74'));db[_0xd9ff('0x75')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x76'));db[_0xd9ff('0x77')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x78'));db['Condition']=db['sequelize'][_0xd9ff('0x13')]('../api/condition/condition.model');db[_0xd9ff('0x79')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x7a'));db[_0xd9ff('0x7b')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x7c'));db['Cdr']=db[_0xd9ff('0x1')]['import']('../api/cdr/cdr.model');db[_0xd9ff('0x7d')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x7e'));db['Schedule']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x7f'));db[_0xd9ff('0x80')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x81'));db[_0xd9ff('0x82')]=db['sequelize']['import']('../api/tag/tag.model');db[_0xd9ff('0x83')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x84'));db[_0xd9ff('0x85')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x86'));db[_0xd9ff('0x87')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/variable/variable.model');db[_0xd9ff('0x88')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/integration/integration.model');db[_0xd9ff('0x89')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x8a'));db[_0xd9ff('0x8b')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x8c'));db[_0xd9ff('0x8d')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x8e'));db[_0xd9ff('0x8f')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x90'));db[_0xd9ff('0x91')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x92'));db[_0xd9ff('0x93')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x94'));db['AnalyticTreeReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xd9ff('0x95')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xd9ff('0x96')]=db['sequelize'][_0xd9ff('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xd9ff('0x97')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x98'));db[_0xd9ff('0x99')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x9a'));db[_0xd9ff('0x9b')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x9c'));db[_0xd9ff('0x9d')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x9e'));db[_0xd9ff('0x9f')]=db['sequelize']['import'](_0xd9ff('0xa0'));db[_0xd9ff('0xa1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa2'));db[_0xd9ff('0xa3')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xa4'));db[_0xd9ff('0xa5')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa6'));db['ZohoConfiguration']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa7'));db[_0xd9ff('0xa8')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa9'));db[_0xd9ff('0xaa')]=db['sequelize'][_0xd9ff('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xd9ff('0xab')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xac'));db[_0xd9ff('0xad')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xae'));db[_0xd9ff('0xaf')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xb0'));db[_0xd9ff('0xb1')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xb2'));db[_0xd9ff('0xb3')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xb4'));db[_0xd9ff('0xb5')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xb6'));db[_0xd9ff('0xb7')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xb8'));db[_0xd9ff('0xb9')]=db['sequelize'][_0xd9ff('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0xd9ff('0xba')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xbb'));db[_0xd9ff('0xbc')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xbd'));db[_0xd9ff('0xbe')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xd9ff('0xbf')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xc0'));db[_0xd9ff('0xc1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xc2'));db[_0xd9ff('0xc3')]=db['sequelize']['import'](_0xd9ff('0xc4'));db['FreshsalesAccount']=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xd9ff('0xc5')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xc6'));db['Integration']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xc7'));db[_0xd9ff('0xc8')]=db[_0xd9ff('0x1')]['import']('../api/network/network.model');db[_0xd9ff('0xc9')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xca'));db[_0xd9ff('0xcb')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xcc'));db[_0xd9ff('0xcd')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xce'));db[_0xd9ff('0xcf')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xd0'));db[_0xd9ff('0xd1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xd9ff('0xd2')]=db[_0xd9ff('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0xd9ff('0xd3')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xd4'));db[_0xd9ff('0xd5')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xd6'));db[_0xd9ff('0xd7')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xd8'));db[_0xd9ff('0xd9')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xda'));db[_0xd9ff('0xdb')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xdc'));db['SquareRecording']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xdd'));db[_0xd9ff('0xde')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/squareMessage/squareMessage.model');db[_0xd9ff('0xdf')]=db[_0xd9ff('0x1')]['import']('../api/team/team.model');db['License']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/license/license.model');db[_0xd9ff('0xe0')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/campaign/campaign.model');db['Migration']=db['sequelize'][_0xd9ff('0x13')]('../api/migration/migration.model');db[_0xd9ff('0xe1')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xe2'));db[_0xd9ff('0xe3')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xe4'));db['MailTransferReport']=db[_0xd9ff('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xe5'));db[_0xd9ff('0xe6')]=db['sequelize']['import'](_0xd9ff('0xe7'));db[_0xd9ff('0xe8')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xe9'));db['SmsTransferReport']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xea'));db[_0xd9ff('0xeb')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xec'));db['VoicePrefix']=db[_0xd9ff('0x1')]['import']('../api/voicePrefix/voicePrefix.model');db[_0xd9ff('0xed')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xee'));db['UserProfileSection']=db['sequelize'][_0xd9ff('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xef'));db['UserNotification']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf0'));db[_0xd9ff('0xf1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf2'));db['WhatsappApplication']=db[_0xd9ff('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xd9ff('0xf3')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xf4'));db['WhatsappMessage']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xf5'));db[_0xd9ff('0xf6')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf7'));db[_0xd9ff('0xf8')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf9'));db[_0xd9ff('0xfa')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0xd9ff('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0xd9ff('0xfb')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xfc'));db['TeamVoicePrefix']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xfd'));db['UserVoicePrefix']=db['sequelize']['import'](_0xd9ff('0xfe'));db['User'][_0xd9ff('0xff')](db['VoiceMail'],{'as':_0xd9ff('0x1c'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x104')],{'as':'Recordings','foreignKey':'UserId'});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x105')],{'as':_0xd9ff('0x106'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x107'),'onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db['CmHopperFinal'],{'as':_0xd9ff('0x108'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x109'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x70')],{'as':_0xd9ff('0x70'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x10a')],{'as':_0xd9ff('0x10b'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')]['hasMany'](db[_0xd9ff('0x5e')],{'as':_0xd9ff('0x10c'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x10d'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db['FaxInteraction'],{'as':_0xd9ff('0x10e'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x10f')],{'as':_0xd9ff('0x110'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db[_0xd9ff('0xf3')],{'as':_0xd9ff('0x111'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db[_0xd9ff('0x112')],{'as':'UserNotifications','foreignKey':_0xd9ff('0x113')});db[_0xd9ff('0x102')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x64')],{'as':'Groups','through':'chat_group_has_users'});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x115'),'through':_0xd9ff('0x116')});db['User']['belongsToMany'](db['CmList'],{'as':_0xd9ff('0x117'),'through':_0xd9ff('0x118')});db['User'][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x119')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x10f')],{'as':_0xd9ff('0x110'),'through':_0xd9ff('0x11a')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x5e')],{'as':_0xd9ff('0x10c'),'through':_0xd9ff('0x11b')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x47')],{'as':_0xd9ff('0x10e'),'through':_0xd9ff('0x11c')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x10d'),'through':_0xd9ff('0x11d')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x10a')],{'as':_0xd9ff('0x10b'),'through':_0xd9ff('0x11e')});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0xf3')],{'as':_0xd9ff('0x111'),'through':'user_has_whatsapp_interactions'});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x11f')],{'as':_0xd9ff('0x120'),'through':_0xd9ff('0x29'),'required':![]});db[_0xd9ff('0x102')]['belongsToMany'](db['VoicePrefix'],{'as':_0xd9ff('0x121'),'through':'UserVoicePrefix','required':![]});db['User'][_0xd9ff('0x114')](db[_0xd9ff('0x39')],{'as':'MailQueues','through':_0xd9ff('0x2c'),'required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x62')],{'as':'ChatQueues','through':_0xd9ff('0x2a'),'required':![],'hooks':!![]});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0x4a')],{'as':_0xd9ff('0x122'),'through':'UserFaxQueue','required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x123')],{'as':'SmsQueues','through':_0xd9ff('0x30'),'required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db['OpenchannelQueue'],{'as':_0xd9ff('0x124'),'through':'UserOpenchannelQueue','required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0xfa')],{'as':_0xd9ff('0x125'),'through':_0xd9ff('0x126'),'required':![]});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0xeb')],{'through':_0xd9ff('0x118')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x5a')],{'as':'ChatWebsites','through':_0xd9ff('0x127')});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0x45')],{'as':_0xd9ff('0x128'),'through':_0xd9ff('0x129')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x37')],{'as':_0xd9ff('0x12a'),'through':_0xd9ff('0x12b')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x52')],{'as':_0xd9ff('0x12c'),'through':_0xd9ff('0x12d')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x12e')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User'][_0xd9ff('0x114')](db['WhatsappAccount'],{'as':_0xd9ff('0x12f'),'through':'user_has_whatsapp_accounts'});db['User']['belongsToMany'](db[_0xd9ff('0xdb')],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0xd9ff('0x12')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x130'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x131')});db[_0xd9ff('0x15')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x17')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x132'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0xd9ff('0x114')](db[_0xd9ff('0x80')],{'as':_0xd9ff('0x133'),'through':_0xd9ff('0x134')});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x105')],{'as':_0xd9ff('0x135'),'foreignKey':'VoiceQueueId'});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x136')],{'as':_0xd9ff('0x137'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xd9ff('0x103')](db[_0xd9ff('0x6d')],{'as':'HopperFinals','foreignKey':_0xd9ff('0x138')});db[_0xd9ff('0x11f')]['hasMany'](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x139'),'foreignKey':_0xd9ff('0x138')});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x70')],{'as':_0xd9ff('0x70'),'foreignKey':'VoiceQueueId'});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x6b')],{'as':_0xd9ff('0x13a'),'foreignKey':_0xd9ff('0x138')});db['VoiceQueue'][_0xd9ff('0x103')](db[_0xd9ff('0xd1')],{'as':_0xd9ff('0x13b'),'foreignKey':'VoiceQueueId'});db[_0xd9ff('0x11f')][_0xd9ff('0x13c')](db[_0xd9ff('0x25')],{'as':'Trunk','foreignKey':_0xd9ff('0x13d')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xd9ff('0x11f')][_0xd9ff('0x13c')](db['Interval'],{'as':_0xd9ff('0x79'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x11f')]['belongsTo'](db[_0xd9ff('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xd9ff('0x11f')][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xd9ff('0x11f')][_0xd9ff('0x114')](db['User'],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x29')});db[_0xd9ff('0x11f')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'as':_0xd9ff('0x140'),'through':_0xd9ff('0xfb')});db['VoiceQueue'][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':'BlackLists','through':_0xd9ff('0x141')});db[_0xd9ff('0x104')]['belongsTo'](db[_0xd9ff('0x102')],{'as':'User','foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x142')]['belongsTo'](db[_0xd9ff('0x102')],{'as':'User','foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x1c')][_0xd9ff('0x103')](db[_0xd9ff('0x143')],{'as':_0xd9ff('0x144'),'onDelete':_0xd9ff('0x100'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0xd9ff('0x143')]['belongsTo'](db[_0xd9ff('0x1c')],{'foreignKey':_0xd9ff('0x145'),'targetKey':'mailbox'});db['VoiceCallReport']['hasMany'](db[_0xd9ff('0x146')],{'as':_0xd9ff('0x147'),'foreignKey':_0xd9ff('0x148'),'constraints':![]});db['VoiceCallReport'][_0xd9ff('0x103')](db[_0xd9ff('0x20')],{'as':_0xd9ff('0x149'),'foreignKey':_0xd9ff('0x148'),'constraints':![]});db[_0xd9ff('0x14a')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':'User','foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x14a')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x14d')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'as':_0xd9ff('0x37'),'foreignKey':_0xd9ff('0x14e')});db['MailServerOut']['belongsTo'](db[_0xd9ff('0x37')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xd9ff('0x37')][_0xd9ff('0xff')](db[_0xd9ff('0x14d')],{'as':_0xd9ff('0x14f'),'onDelete':_0xd9ff('0x100')});db['MailAccount'][_0xd9ff('0xff')](db['MailServerOut'],{'as':_0xd9ff('0x150'),'onDelete':_0xd9ff('0x100')});db['MailAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x14e'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x37')][_0xd9ff('0x103')](db['CannedAnswer'],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x14e')});db[_0xd9ff('0x37')][_0xd9ff('0x103')](db[_0xd9ff('0x3d')],{'as':_0xd9ff('0x144'),'foreignKey':'MailAccountId'});db[_0xd9ff('0x37')][_0xd9ff('0x103')](db[_0xd9ff('0x10f')],{'as':'Interactions'});db[_0xd9ff('0x37')]['hasMany'](db[_0xd9ff('0x3e')],{'as':'Applications'});db[_0xd9ff('0x37')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':'List','foreignKey':_0xd9ff('0x153')});db['MailAccount'][_0xd9ff('0x13c')](db[_0xd9ff('0x83')],{'as':_0xd9ff('0x83'),'foreignKey':_0xd9ff('0x154')});db[_0xd9ff('0x37')]['belongsTo'](db[_0xd9ff('0x7b')],{'as':_0xd9ff('0x155'),'foreignKey':_0xd9ff('0x156')});db[_0xd9ff('0x37')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xd9ff('0x39')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x2c')});db[_0xd9ff('0x39')][_0xd9ff('0x114')](db['Team'],{'through':_0xd9ff('0x157'),'as':_0xd9ff('0x140')});db[_0xd9ff('0x10f')][_0xd9ff('0x103')](db[_0xd9ff('0x3d')],{'as':_0xd9ff('0x144'),'onDelete':'cascade','foreignKey':_0xd9ff('0x158')});db[_0xd9ff('0x10f')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x14e')});db['MailInteraction']['belongsTo'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x10f')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db['MailInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x15b'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x10f')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x15b'),'as':'ThroughTags'});db['MailInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11a'),'foreignKey':_0xd9ff('0x158')});db[_0xd9ff('0x3d')][_0xd9ff('0x103')](db[_0xd9ff('0xe1')],{'as':'Attachments','onDelete':_0xd9ff('0x100')});db['MailMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x102')});db[_0xd9ff('0x3d')]['belongsTo'](db[_0xd9ff('0x69')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b')});db[_0xd9ff('0x3d')][_0xd9ff('0x13c')](db[_0xd9ff('0x10f')],{'as':_0xd9ff('0x15e'),'foreignKey':_0xd9ff('0x158')});db[_0xd9ff('0x3d')]['belongsTo'](db[_0xd9ff('0x37')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xd9ff('0x3d')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x5a'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x3d')][_0xd9ff('0x13c')](db[_0xd9ff('0x60')],{'as':_0xd9ff('0x60'),'foreignKey':_0xd9ff('0x160')});db[_0xd9ff('0x3e')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db['MailApplication'][_0xd9ff('0x13c')](db[_0xd9ff('0x39')],{'onDelete':'restrict'});db['MailApplication'][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'onDelete':'restrict'});db[_0xd9ff('0x3e')][_0xd9ff('0x13c')](db['Interval'],{'onDelete':_0xd9ff('0x161'),'foreignKey':'IntervalId'});db[_0xd9ff('0x3e')][_0xd9ff('0x13c')](db[_0xd9ff('0x82')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x162')});db[_0xd9ff('0x40')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{});db[_0xd9ff('0x40')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x40')]['belongsTo'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x40')][_0xd9ff('0x13c')](db[_0xd9ff('0x10f')],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db['MailQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{});db['MailQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x39')],{});db[_0xd9ff('0x42')]['hasMany'](db['DashboardItem'],{'as':_0xd9ff('0x164'),'onDelete':_0xd9ff('0x100')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x165')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x47')],{'as':_0xd9ff('0x166')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x167')],{'as':_0xd9ff('0x132')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':'Exntensions','onDelete':_0xd9ff('0x100')});db['FaxAccount'][_0xd9ff('0x103')](db['FaxMessage'],{'as':_0xd9ff('0x144')});db[_0xd9ff('0x45')][_0xd9ff('0x13c')](db['Trunk'],{'as':'Trunk'});db['FaxAccount']['belongsTo'](db['CmList'],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x45')][_0xd9ff('0x13c')](db[_0xd9ff('0x7b')],{'as':_0xd9ff('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd9ff('0x45')][_0xd9ff('0x114')](db['User'],{'as':'Agents','through':_0xd9ff('0x129')});db[_0xd9ff('0x167')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x167')]['belongsTo'](db[_0xd9ff('0x4a')],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x167')][_0xd9ff('0x13c')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xd9ff('0x167')][_0xd9ff('0x13c')](db['Tag'],{'onDelete':_0xd9ff('0x161'),'foreignKey':'TagId'});db[_0xd9ff('0x47')][_0xd9ff('0x103')](db[_0xd9ff('0x48')],{'as':_0xd9ff('0x144'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x168')});db['FaxInteraction']['belongsTo'](db[_0xd9ff('0x45')],{'as':'Account','foreignKey':_0xd9ff('0x165')});db['FaxInteraction'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':'ContactId'});db[_0xd9ff('0x47')][_0xd9ff('0x13c')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xd9ff('0x47')][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x169'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x47')][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':'fax_interaction_has_tags','as':_0xd9ff('0x16a')});db[_0xd9ff('0x47')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11c'),'foreignKey':_0xd9ff('0x168')});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db['User'],{'onDelete':'cascade','as':'User'});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db['FaxInteraction'],{'as':_0xd9ff('0x15e'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b')});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db['Attachment'],{'as':_0xd9ff('0xe1'),'foreignKey':_0xd9ff('0x16b')});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xd9ff('0x4a')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x2e')});db[_0xd9ff('0x4a')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x16c'),'as':_0xd9ff('0x140')});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{});db['FaxQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x47')],{});db[_0xd9ff('0x16d')]['belongsTo'](db[_0xd9ff('0x48')],{});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{});db['FaxQueueReport'][_0xd9ff('0x13c')](db['FaxQueue'],{});db['SmsAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x16e'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x12e')][_0xd9ff('0x103')](db['CannedAnswer'],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x16e')});db['SmsAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x16f')],{'as':_0xd9ff('0x144'),'foreignKey':_0xd9ff('0x16e')});db[_0xd9ff('0x12e')][_0xd9ff('0x103')](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x166')});db[_0xd9ff('0x12e')][_0xd9ff('0x103')](db[_0xd9ff('0x170')],{'as':'Applications'});db['SmsAccount'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x12e')][_0xd9ff('0x13c')](db[_0xd9ff('0x7b')],{'as':_0xd9ff('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd9ff('0x12e')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'user_has_sms_accounts'});db[_0xd9ff('0x170')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db['SmsApplication']['belongsTo'](db[_0xd9ff('0x123')],{'onDelete':'restrict'});db['SmsApplication'][_0xd9ff('0x13c')](db['SmsAccount'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x170')][_0xd9ff('0x13c')](db[_0xd9ff('0x79')],{'onDelete':_0xd9ff('0x161'),'foreignKey':'IntervalId'});db[_0xd9ff('0x170')][_0xd9ff('0x13c')](db['Tag'],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x162')});db['SmsInteraction']['hasMany'](db[_0xd9ff('0x16f')],{'as':'Messages','onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xd9ff('0x4e')]['belongsTo'](db['SmsAccount'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x16e')});db[_0xd9ff('0x4e')][_0xd9ff('0x13c')](db['CmContact'],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x4e')][_0xd9ff('0x13c')](db['User'],{'as':_0xd9ff('0x15a'),'foreignKey':'UserId'});db['SmsInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x171'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x4e')][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x171'),'as':_0xd9ff('0x16a')});db['SmsInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11d'),'foreignKey':_0xd9ff('0x172')});db[_0xd9ff('0x16f')]['belongsTo'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x102')});db[_0xd9ff('0x16f')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'onDelete':'cascade','as':_0xd9ff('0x14b')});db[_0xd9ff('0x16f')][_0xd9ff('0x13c')](db[_0xd9ff('0x4e')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x15e'),'foreignKey':_0xd9ff('0x172')});db['SmsMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x12e')],{'as':'Account','foreignKey':_0xd9ff('0x16e')});db[_0xd9ff('0x123')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x30'),'foreignKey':_0xd9ff('0x173')});db[_0xd9ff('0x123')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':'team_has_sms_queues','as':_0xd9ff('0x140')});db[_0xd9ff('0x52')]['hasMany'](db[_0xd9ff('0x77')],{'as':'Dispositions','foreignKey':_0xd9ff('0x174'),'onDelete':_0xd9ff('0x100')});db['OpenchannelAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':'OpenchannelAccountId'});db[_0xd9ff('0x52')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xd9ff('0x166'),'foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x52')][_0xd9ff('0x103')](db[_0xd9ff('0x56')],{'as':'Messages','foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x52')][_0xd9ff('0x103')](db[_0xd9ff('0x54')],{'as':'Applications','foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x52')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x52')][_0xd9ff('0x13c')](db['Pause'],{'as':_0xd9ff('0x155'),'foreignKey':_0xd9ff('0x156')});db[_0xd9ff('0x52')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x12d')});db['OpenchannelApplication'][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x58')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x175')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x79')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x82')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x162')});db['OpenchannelInteraction'][_0xd9ff('0x103')](db[_0xd9ff('0x56')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xd9ff('0x176')});db[_0xd9ff('0x10a')][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x174')});db['OpenchannelInteraction'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x10a')]['belongsTo'](db['User'],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db['OpenchannelInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x177'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x10a')]['belongsToMany'](db[_0xd9ff('0x82')],{'through':'openchannel_interaction_has_tags','as':_0xd9ff('0x16a')});db['OpenchannelInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11e'),'foreignKey':_0xd9ff('0x176')});db[_0xd9ff('0x56')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x100'),'as':'User'});db['OpenchannelMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b')});db['OpenchannelMessage'][_0xd9ff('0x13c')](db['OpenchannelInteraction'],{'onDelete':_0xd9ff('0x100'),'as':'Interaction','foreignKey':_0xd9ff('0x176')});db[_0xd9ff('0x56')]['belongsTo'](db[_0xd9ff('0xe1')],{'as':_0xd9ff('0xe1'),'foreignKey':_0xd9ff('0x16b')});db[_0xd9ff('0x56')]['belongsTo'](db[_0xd9ff('0x52')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x58')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xd9ff('0x175')});db[_0xd9ff('0x58')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x178'),'as':_0xd9ff('0x140')});db['ChatWebsite'][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x15f'),'onDelete':_0xd9ff('0x100')});db['ChatWebsite'][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x5a')][_0xd9ff('0x103')](db[_0xd9ff('0x66')],{'as':_0xd9ff('0x179')});db['ChatWebsite'][_0xd9ff('0x103')](db['ChatInteraction'],{'as':_0xd9ff('0x166')});db[_0xd9ff('0x5a')][_0xd9ff('0x103')](db[_0xd9ff('0x5d')],{'as':_0xd9ff('0x132')});db[_0xd9ff('0x5a')][_0xd9ff('0x103')](db['ChatMessage'],{'as':_0xd9ff('0x144')});db[_0xd9ff('0x5a')]['belongsTo'](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db['ChatWebsite']['belongsTo'](db[_0xd9ff('0x79')],{'as':_0xd9ff('0x79'),'foreignKey':_0xd9ff('0x13e')});db['ChatWebsite'][_0xd9ff('0x13c')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xd9ff('0x14e')});db[_0xd9ff('0x5a')][_0xd9ff('0x13c')](db['Pause'],{'as':_0xd9ff('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{});db['OpenchannelQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':'ListId'});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':'Contact','foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db[_0xd9ff('0x10a')],{});db['OpenchannelQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x56')],{});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db['User'],{});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db[_0xd9ff('0x58')],{});db[_0xd9ff('0x5d')]['belongsTo'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x17a'),'foreignKey':'UserId','onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x5d')][_0xd9ff('0x13c')](db[_0xd9ff('0x62')],{'as':'Queue','foreignKey':_0xd9ff('0x17b'),'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x5d')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x17c'),'foreignKey':_0xd9ff('0x15f'),'onDelete':'restrict'});db[_0xd9ff('0x5d')][_0xd9ff('0x13c')](db[_0xd9ff('0x82')],{'onDelete':_0xd9ff('0x161'),'foreignKey':'TagId'});db['ChatInteraction'][_0xd9ff('0x103')](db[_0xd9ff('0x5f')],{'as':'Messages','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x17d')});db[_0xd9ff('0x5e')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x5e')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':'ContactId'});db[_0xd9ff('0x5e')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x5e')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x17e'),'as':_0xd9ff('0x15c')});db['ChatInteraction']['belongsToMany'](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x17e'),'as':'ThroughTags'});db[_0xd9ff('0x5e')][_0xd9ff('0x114')](db['User'],{'as':_0xd9ff('0x15d'),'through':'user_has_chat_interactions','foreignKey':_0xd9ff('0x17d')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x102')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db['CmContact'],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db['ChatMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x5e')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x15e'),'foreignKey':_0xd9ff('0x17d')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db[_0xd9ff('0xe1')],{'as':'Attachment','foreignKey':_0xd9ff('0x16b')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db['ChatWebsite'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x60')][_0xd9ff('0x103')](db[_0xd9ff('0xe1')],{'as':_0xd9ff('0x17f'),'foreignKey':_0xd9ff('0x160'),'onDelete':'cascade','hooks':!![]});db[_0xd9ff('0x60')]['belongsTo'](db[_0xd9ff('0x69')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db['ChatOfflineMessage']['belongsTo'](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x15f')});db['ChatQueue'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':'team_has_chat_queues','as':_0xd9ff('0x140')});db[_0xd9ff('0x64')][_0xd9ff('0x103')](db[_0xd9ff('0xcb')],{'as':_0xd9ff('0x144'),'foreignKey':_0xd9ff('0x180'),'onDelete':'cascade'});db[_0xd9ff('0x64')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x135'),'through':_0xd9ff('0x181')});db[_0xd9ff('0x66')][_0xd9ff('0x13c')](db['ChatWebsite'],{'as':_0xd9ff('0x17c'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0xd9ff('0x103')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x115'),'foreignKey':'CompanyId'});db[_0xd9ff('0x69')]['hasMany'](db[_0xd9ff('0x136')],{'as':_0xd9ff('0x137'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')]['hasMany'](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x139'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')]['hasMany'](db[_0xd9ff('0x70')],{'as':_0xd9ff('0x70'),'foreignKey':_0xd9ff('0x14c')});db['CmContact'][_0xd9ff('0x103')](db[_0xd9ff('0xd1')],{'as':'JscriptySessions','foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x10a')],{'as':_0xd9ff('0x10b'),'foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x5e')],{'as':_0xd9ff('0x10c'),'foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x161')});db['CmContact']['hasMany'](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x10d'),'foreignKey':'ContactId','onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x47')],{'as':_0xd9ff('0x10e'),'foreignKey':_0xd9ff('0x14c'),'onDelete':'restrict'});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x10f')],{'as':'MailInteractions','foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x69')][_0xd9ff('0x13c')](db[_0xd9ff('0x182')],{'as':_0xd9ff('0x183'),'foreignKey':'CompanyId'});db[_0xd9ff('0x69')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153'),'onDelete':'cascade'});db[_0xd9ff('0x69')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x116')});db[_0xd9ff('0x69')]['belongsToMany'](db[_0xd9ff('0x82')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xd9ff('0x69')]['belongsToMany'](db['Tag'],{'through':_0xd9ff('0x184'),'as':_0xd9ff('0x16a')});db['CmHopper']['belongsTo'](db['CmContact'],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x136')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':'List','foreignKey':_0xd9ff('0x153'),'onDelete':'cascade'});db[_0xd9ff('0x136')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x17a'),'foreignKey':_0xd9ff('0x101')});db['CmHopper'][_0xd9ff('0x13c')](db[_0xd9ff('0x11f')],{'as':_0xd9ff('0x185'),'foreignKey':_0xd9ff('0x138'),'onDelete':_0xd9ff('0x100')});db['CmHopper'][_0xd9ff('0x13c')](db[_0xd9ff('0xe0')],{'as':'Campaign','foreignKey':_0xd9ff('0x186'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x136')][_0xd9ff('0x13c')](db['User'],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x187')});db['CmHopperBlack']['belongsTo'](db[_0xd9ff('0x69')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xd9ff('0x100')});db['CmHopperBlack'][_0xd9ff('0x13c')](db['CmList'],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x6b')][_0xd9ff('0x13c')](db['VoiceQueue'],{'as':_0xd9ff('0x185'),'foreignKey':_0xd9ff('0x138'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x6b')][_0xd9ff('0x13c')](db[_0xd9ff('0xe0')],{'as':_0xd9ff('0xe0'),'foreignKey':_0xd9ff('0x186'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x188')][_0xd9ff('0x103')](db[_0xd9ff('0x189')],{'as':{'plural':_0xd9ff('0x18a'),'singular':_0xd9ff('0x18b')},'foreignKey':_0xd9ff('0x18c'),'onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x188')][_0xd9ff('0x103')](db[_0xd9ff('0x189')],{'as':{'plural':_0xd9ff('0x18d'),'singular':_0xd9ff('0x18e')},'foreignKey':_0xd9ff('0x18f'),'onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x188')][_0xd9ff('0x103')](db[_0xd9ff('0x72')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0xd9ff('0x77')]['hasMany'](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x190'),'onDelete':_0xd9ff('0x100')});db['Interval'][_0xd9ff('0x103')](db[_0xd9ff('0x79')],{'as':'Intervals','foreignKey':_0xd9ff('0x13e'),'onDelete':_0xd9ff('0x100'),'hooks':!![],'required':![]});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x107'),'foreignKey':_0xd9ff('0x13e'),'onDelete':'restrict'});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db['MailApplication'],{'as':_0xd9ff('0x191'),'foreignKey':'IntervalId'});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db[_0xd9ff('0x5d')],{'as':_0xd9ff('0x192'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db[_0xd9ff('0x167')],{'as':_0xd9ff('0x193'),'foreignKey':'IntervalId'});db[_0xd9ff('0x79')]['hasMany'](db['SmsApplication'],{'as':_0xd9ff('0x194'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x195')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{});db[_0xd9ff('0x195')][_0xd9ff('0x13c')](db[_0xd9ff('0x8d')],{'foreignKey':_0xd9ff('0x196')});db['Schedule'][_0xd9ff('0x13c')](db[_0xd9ff('0x8b')],{'foreignKey':_0xd9ff('0x197')});db[_0xd9ff('0x80')][_0xd9ff('0x114')](db[_0xd9ff('0x19')],{'as':_0xd9ff('0x198'),'through':_0xd9ff('0x134'),'onDelete':_0xd9ff('0x161')});db['Tag'][_0xd9ff('0x114')](db[_0xd9ff('0x69')],{'through':_0xd9ff('0x184')});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db[_0xd9ff('0x5e')],{'through':_0xd9ff('0x17e')});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db[_0xd9ff('0x10f')],{'through':'mail_interaction_has_tags'});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db[_0xd9ff('0x4e')],{'through':'sms_interaction_has_tags'});db['Tag'][_0xd9ff('0x114')](db[_0xd9ff('0x47')],{'through':_0xd9ff('0x169')});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db['OpenchannelInteraction'],{'through':_0xd9ff('0x177')});db['Tag'][_0xd9ff('0x114')](db[_0xd9ff('0xf3')],{'through':_0xd9ff('0x199')});db[_0xd9ff('0x85')][_0xd9ff('0x103')](db[_0xd9ff('0x189')],{'as':{'plural':_0xd9ff('0x19a'),'singular':_0xd9ff('0x19b')},'foreignKey':_0xd9ff('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0xd9ff('0x85')][_0xd9ff('0x103')](db['Condition'],{'as':{'plural':_0xd9ff('0x19d'),'singular':_0xd9ff('0x19e')},'foreignKey':'TriggerAnyId','onDelete':_0xd9ff('0x100'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xd9ff('0x72')],{'as':_0xd9ff('0x19f'),'foreignKey':'TriggerId','onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x8b')][_0xd9ff('0x103')](db['AnalyticFieldReport'],{'as':_0xd9ff('0x1a0'),'onDelete':'cascade','foreignKey':_0xd9ff('0x197'),'hooks':!![]});db[_0xd9ff('0x8d')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x196')});db[_0xd9ff('0x91')]['hasMany'](db[_0xd9ff('0x93')],{'as':'Fields','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a1')});db['AnalyticFieldReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x91')],{'foreignKey':_0xd9ff('0x1a1')});db['SalesforceAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x96')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':'AccountId'});db[_0xd9ff('0x96')][_0xd9ff('0x103')](db['SalesforceField'],{'as':_0xd9ff('0x1a3'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0x96')]['hasMany'](db[_0xd9ff('0x97')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':'DescriptionId'});db[_0xd9ff('0x96')]['hasMany'](db[_0xd9ff('0x97')],{'as':_0xd9ff('0x1a0'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0x96')][_0xd9ff('0x13c')](db[_0xd9ff('0x95')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db['SalesforceField'][_0xd9ff('0x103')](db[_0xd9ff('0x97')],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db['SalesforceField'][_0xd9ff('0x103')](db[_0xd9ff('0x97')],{'as':'Description','foreignKey':_0xd9ff('0x1a8')});db['SalesforceField'][_0xd9ff('0x103')](db[_0xd9ff('0x97')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db['SalesforceField']['belongsTo'](db[_0xd9ff('0x87')],{'as':'Variable','foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0x99')][_0xd9ff('0x103')](db['SugarcrmConfiguration'],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0x9b')][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1a3'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0x9b')]['hasMany'](db[_0xd9ff('0x9d')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0x9b')][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1a0'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db['SugarcrmConfiguration'][_0xd9ff('0x13c')](db['SugarcrmAccount'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0x9d')]['hasMany'](db['SugarcrmField'],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0x9d')][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db['SugarcrmField'][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0x9d')]['belongsTo'](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0x9f')]['hasMany'](db[_0xd9ff('0xa1')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a6')});db['DeskConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xa3')],{'as':'Subjects','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xa1')]['hasMany'](db[_0xd9ff('0xa3')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xa3')],{'as':'Fields','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xa1')][_0xd9ff('0x13c')](db['DeskAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xd9ff('0xa1')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x1ac')});db[_0xd9ff('0xa3')][_0xd9ff('0x103')](db[_0xd9ff('0xa3')],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xa3')][_0xd9ff('0x103')](db['DeskField'],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xa3')][_0xd9ff('0x103')](db['DeskField'],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xa3')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xa5')][_0xd9ff('0x103')](db[_0xd9ff('0x1ad')],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xd9ff('0x1ad')][_0xd9ff('0x103')](db[_0xd9ff('0xa8')],{'as':_0xd9ff('0x1a3'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xd9ff('0x1ad')][_0xd9ff('0x103')](db[_0xd9ff('0xa8')],{'as':_0xd9ff('0x1ae'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0x1ad')][_0xd9ff('0x103')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xd9ff('0x1ad')]['belongsTo'](db[_0xd9ff('0xa5')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db['ZohoField'][_0xd9ff('0x103')](db[_0xd9ff('0xa8')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xa8')][_0xd9ff('0x103')](db['ZohoField'],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xa8')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xaa')][_0xd9ff('0x103')](db[_0xd9ff('0xab')],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xab')][_0xd9ff('0x103')](db[_0xd9ff('0xad')],{'as':'Subjects','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xab')][_0xd9ff('0x103')](db[_0xd9ff('0xad')],{'as':'Descriptions','foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xab')][_0xd9ff('0x103')](db['ZendeskField'],{'as':_0xd9ff('0x1a0'),'foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db[_0xd9ff('0xaa')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db['ZendeskConfiguration'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x1af')});db[_0xd9ff('0xad')]['hasMany'](db[_0xd9ff('0xad')],{'as':'Subject','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xad')]['hasMany'](db[_0xd9ff('0xad')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xad')][_0xd9ff('0x103')](db[_0xd9ff('0xad')],{'as':'Field','foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xad')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xaf')][_0xd9ff('0x103')](db['FreshdeskConfiguration'],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xb1')][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':_0xd9ff('0x1a3'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xb1')][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':_0xd9ff('0x1ae'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xb1')][_0xd9ff('0x13c')](db[_0xd9ff('0xaf')],{'as':'Account','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xb1')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x1b0')});db['FreshdeskField'][_0xd9ff('0x103')](db['FreshdeskField'],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xb3')][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db[_0xd9ff('0xb3')],{'as':_0xd9ff('0x1a9'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':'VariableId'});db[_0xd9ff('0xb5')]['hasMany'](db[_0xd9ff('0xb7')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a6')});db['VtigerConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a3'),'foreignKey':'SubjectId'});db[_0xd9ff('0xb7')]['hasMany'](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a0'),'foreignKey':'FieldId'});db[_0xd9ff('0xb7')][_0xd9ff('0x13c')](db['VtigerAccount'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xb9')]['hasMany'](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xb9')]['hasMany'](db['VtigerField'],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db['VtigerField']['hasMany'](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xb9')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xba')][_0xd9ff('0x103')](db[_0xd9ff('0xbc')],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db['ServicenowConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':_0xd9ff('0x1a3'),'foreignKey':'SubjectId'});db[_0xd9ff('0xbc')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':'Descriptions','foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xbc')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':'Fields','foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xbc')][_0xd9ff('0x13c')](db[_0xd9ff('0xba')],{'as':_0xd9ff('0x159'),'foreignKey':'AccountId'});db['ServicenowField'][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':'Subject','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xbe')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':_0xd9ff('0x1ab'),'foreignKey':'DescriptionId'});db[_0xd9ff('0xbe')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xbe')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':'Variable','foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xbf')]['hasMany'](db[_0xd9ff('0xc1')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xc1')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':_0xd9ff('0x1a3'),'onDelete':_0xd9ff('0x100'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a8')});db['Dynamics365Configuration'][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':_0xd9ff('0x1a0'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db['Dynamics365Configuration'][_0xd9ff('0x13c')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xc3')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':'Subject','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xc3')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xd9ff('0xc3')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db['Dynamics365Field']['belongsTo'](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0x1b1')][_0xd9ff('0x103')](db[_0xd9ff('0xc5')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':'AccountId'});db[_0xd9ff('0xc5')]['hasMany'](db['FreshsalesField'],{'as':_0xd9ff('0x1a3'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xc5')][_0xd9ff('0x103')](db['FreshsalesField'],{'as':_0xd9ff('0x1ae'),'foreignKey':'DescriptionId'});db[_0xd9ff('0xc5')][_0xd9ff('0x103')](db['FreshsalesField'],{'as':_0xd9ff('0x1a0'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xc5')][_0xd9ff('0x13c')](db[_0xd9ff('0x1b1')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0x1b2')]['hasMany'](db[_0xd9ff('0x1b2')],{'as':_0xd9ff('0x1a7'),'foreignKey':'SubjectId'});db[_0xd9ff('0x1b2')][_0xd9ff('0x103')](db[_0xd9ff('0x1b2')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db['FreshsalesField'][_0xd9ff('0x103')](db[_0xd9ff('0x1b2')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db['FreshsalesField'][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':'VariableId'});db[_0xd9ff('0xc9')][_0xd9ff('0x13c')](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xc9')][_0xd9ff('0x13c')](db['CmContact'],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db['ChatQueueReport'][_0xd9ff('0x13c')](db['ChatInteraction'],{});db['ChatQueueReport'][_0xd9ff('0x13c')](db['ChatMessage'],{});db['ChatQueueReport'][_0xd9ff('0x13c')](db['User'],{});db[_0xd9ff('0xc9')][_0xd9ff('0x13c')](db[_0xd9ff('0x62')],{});db[_0xd9ff('0xcb')][_0xd9ff('0x13c')](db['User'],{'onDelete':'cascade','foreignKey':_0xd9ff('0x1b3')});db['ChatInternalMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1b4')});db[_0xd9ff('0xd1')][_0xd9ff('0x103')](db[_0xd9ff('0xcf')],{'foreignKey':'SessionId','onDelete':_0xd9ff('0x100')});db['JscriptySessionReport']['hasMany'](db[_0xd9ff('0xcd')],{'foreignKey':_0xd9ff('0x1b5'),'onDelete':_0xd9ff('0x100')});db['SmsQueueReport'][_0xd9ff('0x13c')](db['SmsAccount'],{});db['SmsQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':'List','foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xd2')][_0xd9ff('0x13c')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xd9ff('0xd2')]['belongsTo'](db[_0xd9ff('0x4e')],{});db[_0xd9ff('0xd2')]['belongsTo'](db[_0xd9ff('0x16f')],{});db['SmsQueueReport'][_0xd9ff('0x13c')](db['User'],{});db[_0xd9ff('0xd2')][_0xd9ff('0x13c')](db[_0xd9ff('0x123')],{});db[_0xd9ff('0xd7')][_0xd9ff('0x103')](db[_0xd9ff('0xd1')],{'foreignKey':_0xd9ff('0x1b6')});db[_0xd9ff('0xd7')][_0xd9ff('0x103')](db[_0xd9ff('0xcf')],{'foreignKey':_0xd9ff('0x1b6')});db[_0xd9ff('0xd7')][_0xd9ff('0x103')](db[_0xd9ff('0xcd')],{'foreignKey':'ProjectId'});db['SquareProject']['belongsToMany'](db['User'],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x1b7')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':'Agents','through':_0xd9ff('0x119')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x11f')],{'through':_0xd9ff('0xfb'),'as':_0xd9ff('0x120')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0xd9ff('0x1b8')});db['Team'][_0xd9ff('0x114')](db[_0xd9ff('0x62')],{'through':'team_has_chat_queues','as':_0xd9ff('0x1b9')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x4a')],{'through':_0xd9ff('0x16c'),'as':_0xd9ff('0x122')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x123')],{'through':_0xd9ff('0x1ba'),'as':_0xd9ff('0x1bb')});db['Team']['belongsToMany'](db['OpenchannelQueue'],{'through':_0xd9ff('0x178'),'as':'OpenchannelQueues'});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':_0xd9ff('0x1bc'),'as':_0xd9ff('0x125')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x1bd')],{'through':_0xd9ff('0x1be'),'as':_0xd9ff('0x121')});db['Campaign'][_0xd9ff('0x103')](db[_0xd9ff('0x136')],{'as':_0xd9ff('0x137'),'foreignKey':'CampaignId'});db['Campaign'][_0xd9ff('0x103')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd9ff('0x186')});db[_0xd9ff('0xe0')]['hasMany'](db['CmHopperHistory'],{'as':_0xd9ff('0x139'),'foreignKey':_0xd9ff('0x186')});db[_0xd9ff('0xe0')][_0xd9ff('0x103')](db[_0xd9ff('0x6b')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0xd9ff('0xe0')]['belongsTo'](db[_0xd9ff('0x25')],{'as':_0xd9ff('0x25'),'foreignKey':_0xd9ff('0x13d')});db['Campaign'][_0xd9ff('0x13c')](db[_0xd9ff('0x25')],{'as':_0xd9ff('0x1bf'),'foreignKey':_0xd9ff('0x1c0')});db[_0xd9ff('0xe0')][_0xd9ff('0x13c')](db[_0xd9ff('0x79')],{'as':'Interval','foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0xe0')][_0xd9ff('0x13c')](db['SquareProject'],{'as':_0xd9ff('0xdb'),'foreignKey':'SquareProjectId'});db[_0xd9ff('0xe0')][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x117'),'through':_0xd9ff('0x1c1')});db[_0xd9ff('0xe0')][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x1c2'),'through':_0xd9ff('0x1c3')});db[_0xd9ff('0xe1')][_0xd9ff('0x13c')](db[_0xd9ff('0x60')],{'as':_0xd9ff('0x60'),'foreignKey':_0xd9ff('0x160')});db['MailTransferReport']['belongsTo'](db[_0xd9ff('0x3d')],{});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x10f')],{});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'foreignKey':_0xd9ff('0x1c5'),'as':_0xd9ff('0x1c6')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xd9ff('0x1c7'),'as':_0xd9ff('0x1c8')});db[_0xd9ff('0x1c4')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x39')],{'foreignKey':'ToMailQueueId','as':_0xd9ff('0x1c9')});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'foreignKey':_0xd9ff('0x1ca'),'as':'ToAccount'});db[_0xd9ff('0x1cb')][_0xd9ff('0x13c')](db[_0xd9ff('0x5f')],{});db['ChatTransferReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x5e')],{});db[_0xd9ff('0x1cb')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xd9ff('0x1cc'),'as':_0xd9ff('0x1c6')});db[_0xd9ff('0x1cb')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1c7'),'as':_0xd9ff('0x1c8')});db[_0xd9ff('0x1cb')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1cd'),'as':_0xd9ff('0x1ce')});db[_0xd9ff('0x1cb')][_0xd9ff('0x13c')](db['ChatQueue'],{'foreignKey':_0xd9ff('0x1cf'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0x1cb')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'foreignKey':'ToChatWebsiteId','as':_0xd9ff('0x1d0')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db['FaxMessage'],{});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db['FaxInteraction'],{});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{'foreignKey':_0xd9ff('0x1d1'),'as':'FromAccount'});db[_0xd9ff('0xe6')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':'FromUserId','as':_0xd9ff('0x1c8')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'foreignKey':'ToUserId','as':_0xd9ff('0x1ce')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x4a')],{'foreignKey':_0xd9ff('0x1d2'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{'foreignKey':_0xd9ff('0x1d3'),'as':'ToAccount'});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db['OpenchannelMessage'],{});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db[_0xd9ff('0x10a')],{});db['OpenchannelTransferReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'foreignKey':_0xd9ff('0x1d4'),'as':_0xd9ff('0x1c6')});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db['User'],{'foreignKey':'FromUserId','as':_0xd9ff('0x1c8')});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1cd'),'as':_0xd9ff('0x1ce')});db[_0xd9ff('0xe8')]['belongsTo'](db[_0xd9ff('0x58')],{'foreignKey':_0xd9ff('0x1d5'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'foreignKey':_0xd9ff('0x1d6'),'as':_0xd9ff('0x1d0')});db[_0xd9ff('0x1d7')]['belongsTo'](db[_0xd9ff('0x16f')],{});db[_0xd9ff('0x1d7')]['belongsTo'](db[_0xd9ff('0x4e')],{});db[_0xd9ff('0x1d7')][_0xd9ff('0x13c')](db[_0xd9ff('0x12e')],{'foreignKey':'FromSmsAccountId','as':_0xd9ff('0x1c6')});db[_0xd9ff('0x1d7')][_0xd9ff('0x13c')](db['User'],{'foreignKey':_0xd9ff('0x1c7'),'as':_0xd9ff('0x1c8')});db[_0xd9ff('0x1d7')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':'ToUserId','as':_0xd9ff('0x1ce')});db['SmsTransferReport'][_0xd9ff('0x13c')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xd9ff('0x1c9')});db[_0xd9ff('0x1d7')][_0xd9ff('0x13c')](db[_0xd9ff('0x12e')],{'foreignKey':_0xd9ff('0x1d8'),'as':_0xd9ff('0x1d0')});db[_0xd9ff('0xeb')][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xd9ff('0xeb')]['hasMany'](db[_0xd9ff('0x1d9')],{'as':_0xd9ff('0x1da'),'foreignKey':'ListId'});db[_0xd9ff('0xeb')]['hasMany'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x115'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xeb')][_0xd9ff('0x103')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd9ff('0x153')});db['CmList'][_0xd9ff('0x103')](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x109'),'foreignKey':'ListId'});db[_0xd9ff('0xeb')][_0xd9ff('0x103')](db[_0xd9ff('0x70')],{'as':'ReportAgentPreview','foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xeb')][_0xd9ff('0x114')](db[_0xd9ff('0x11f')],{'as':_0xd9ff('0x1db'),'through':'voice_queues_has_cm_lists'});db[_0xd9ff('0xeb')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'cm_user_has_lists'});db[_0xd9ff('0x1bd')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x107'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x1bd')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x1dc')});db[_0xd9ff('0x1bd')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x1be'),'as':_0xd9ff('0x140')});db[_0xd9ff('0xed')][_0xd9ff('0x103')](db['User'],{'as':'Users','foreignKey':_0xd9ff('0x1dd')});db[_0xd9ff('0xed')][_0xd9ff('0x103')](db[_0xd9ff('0x1de')],{'as':_0xd9ff('0x1df'),'foreignKey':'userProfileId','onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x1de')][_0xd9ff('0x103')](db[_0xd9ff('0x1e0')],{'as':'Resources','foreignKey':_0xd9ff('0x1e1'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0xf1')][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x1e2'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0xf1')][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x1e2')});db[_0xd9ff('0xf1')][_0xd9ff('0x103')](db['WhatsappMessage'],{'as':_0xd9ff('0x144'),'foreignKey':_0xd9ff('0x1e2')});db[_0xd9ff('0xf1')]['hasMany'](db[_0xd9ff('0xf3')],{'as':'Interactions'});db['WhatsappAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x1e3')],{'as':_0xd9ff('0x132')});db[_0xd9ff('0xf1')]['belongsTo'](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db['WhatsappAccount'][_0xd9ff('0x13c')](db[_0xd9ff('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0xd9ff('0x156')});db[_0xd9ff('0xf1')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':'Agents','through':_0xd9ff('0x1e4')});db[_0xd9ff('0x1e3')]['belongsTo'](db['User'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x1e3')][_0xd9ff('0x13c')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0xd9ff('0x1e3')][_0xd9ff('0x13c')](db['WhatsappAccount'],{'onDelete':_0xd9ff('0x161')});db['WhatsappApplication'][_0xd9ff('0x13c')](db['Interval'],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x1e3')][_0xd9ff('0x13c')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xd9ff('0x162')});db[_0xd9ff('0xf3')][_0xd9ff('0x103')](db[_0xd9ff('0x1e5')],{'as':_0xd9ff('0x144'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1e6')});db[_0xd9ff('0xf3')][_0xd9ff('0x13c')](db[_0xd9ff('0xf1')],{'as':'Account','foreignKey':_0xd9ff('0x1e2')});db['WhatsappInteraction'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0xd9ff('0xf3')]['belongsTo'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0xf3')]['belongsToMany'](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x199'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0xf3')]['belongsToMany'](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x199'),'as':_0xd9ff('0x16a')});db['WhatsappInteraction'][_0xd9ff('0x114')](db['User'],{'as':_0xd9ff('0x15d'),'through':'user_has_whatsapp_interactions','foreignKey':_0xd9ff('0x1e6')});db[_0xd9ff('0x1e5')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x102')});db[_0xd9ff('0x1e5')][_0xd9ff('0x13c')](db['CmContact'],{'onDelete':_0xd9ff('0x100'),'as':'Contact'});db[_0xd9ff('0x1e5')][_0xd9ff('0x13c')](db[_0xd9ff('0xf3')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xd9ff('0x1e6')});db[_0xd9ff('0x1e5')]['belongsTo'](db[_0xd9ff('0xf1')],{'as':_0xd9ff('0x159'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0xd9ff('0x13c')](db['WhatsappAccount'],{});db[_0xd9ff('0xf6')]['belongsTo'](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db['WhatsappInteraction'],{});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0xfa')],{});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0x1e5')],{});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{});db[_0xd9ff('0xf8')][_0xd9ff('0x13c')](db['WhatsappMessage'],{});db[_0xd9ff('0xf8')][_0xd9ff('0x13c')](db[_0xd9ff('0xf3')],{});db['WhatsappTransferReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xf1')],{'foreignKey':_0xd9ff('0x1e7'),'as':'FromAccount'});db[_0xd9ff('0xf8')]['belongsTo'](db[_0xd9ff('0xf1')],{'foreignKey':_0xd9ff('0x1e8'),'as':_0xd9ff('0x1d0')});db[_0xd9ff('0xf8')][_0xd9ff('0x13c')](db[_0xd9ff('0xfa')],{'foreignKey':_0xd9ff('0x1e9'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0xf8')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1c7'),'as':'FromAgent'});db[_0xd9ff('0xf8')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1cd'),'as':_0xd9ff('0x1ce')});db['WhatsappQueue'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'UserWhatsappQueue','foreignKey':_0xd9ff('0x1ea')});db[_0xd9ff('0xfa')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x1bc'),'as':'Teams'});module[_0xd9ff('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa74f=['MailAccountId','Imap','hasOne','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','Team','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','IntervalId','TagId','DashboardItem','Exntensions','FaxAccountId','fax_interaction_has_tags','ThroughTags','Users','FaxInteractionId','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteraction','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','Pause','OpenchannelQueueId','OpenchannelInteractionId','Owner','openchannel_interaction_has_tags','ProactiveActions','ChatMessage','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','team_has_chat_queues','ChatGroupId','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','ParentId','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','Trigger','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','DefaultReportId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Subjects','Field','VariableId','DeskAccount','DeskField','int_desk_configuration_has_tags','ZendeskAccount','ZendeskField','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','FromId','SessionId','SmsQueueReport','ProjectId','MailQueues','ChatQueues','FaxQueues','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromUserId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappMessage','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','exports','lodash','sequelize','defaultsDeep','motion2','xC@LL1234','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','127.0.0.1','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','VoiceMail','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserMailQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsite','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId'];(function(_0x1be5a6,_0x50dff7){var _0x1c3173=function(_0x3091e5){while(--_0x3091e5){_0x1be5a6['push'](_0x1be5a6['shift']());}};_0x1c3173(++_0x50dff7);}(_0xa74f,0x9a));var _0xfa74=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xa74f[_0x2d2c16];return _0x53f2fb;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0xfa74('0x0'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xfa74('0x1')]=_[_0xfa74('0x2')](config[_0xfa74('0x1')],{'database':_0xfa74('0x3'),'username':'xcall','password':_0xfa74('0x4'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xfa74('0x5')},'logging':![],'timezone':timezone[_0xfa74('0x6')](),'define':{'charset':_0xfa74('0x7'),'collate':_0xfa74('0x8')}}});config[_0xfa74('0x9')]=_[_0xfa74('0x2')](config['sequelizeHistory'],{'database':_0xfa74('0x3'),'username':_0xfa74('0xa'),'password':_0xfa74('0x4'),'options':{'host':_0xfa74('0xb'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xfa74('0x5')},'logging':![],'timezone':timezone[_0xfa74('0x6')](),'define':{'charset':'utf8','collate':_0xfa74('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfa74('0x1')][_0xfa74('0xc')],config[_0xfa74('0x1')]['username'],config[_0xfa74('0x1')][_0xfa74('0xd')],config[_0xfa74('0x1')][_0xfa74('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xfa74('0xc')],config[_0xfa74('0x9')][_0xfa74('0xf')],config[_0xfa74('0x9')][_0xfa74('0xd')],config['sequelizeHistory'][_0xfa74('0xe')])};db[_0xfa74('0x10')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x12'));db[_0xfa74('0x13')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x14'));db[_0xfa74('0x15')]=db['sequelize']['import'](_0xfa74('0x16'));db[_0xfa74('0x17')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x18'));db[_0xfa74('0x19')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x1a'));db[_0xfa74('0x1b')]=db[_0xfa74('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db[_0xfa74('0x1c')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x1d'));db[_0xfa74('0x1e')]=db['sequelize']['import'](_0xfa74('0x1f'));db['VoiceMail']=db['sequelize']['import'](_0xfa74('0x20'));db[_0xfa74('0x21')]=db[_0xfa74('0x1')]['import']('../api/voiceMailMessage/voiceMailMessage.model');db[_0xfa74('0x22')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x23'));db['VoiceDialReport']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/voiceDialReport/voiceDialReport.model');db[_0xfa74('0x24')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x25'));db['VoiceQueueReport']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x26'));db['MemberReport']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x27'));db['Trunk']=db['sequelize'][_0xfa74('0x11')]('../api/trunk/trunk.model');db[_0xfa74('0x28')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x29'));db[_0xfa74('0x2a')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x2b'));db[_0xfa74('0x2c')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x2d'));db[_0xfa74('0x2e')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x2f'));db['UserMailQueue']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x30'));db[_0xfa74('0x31')]=db['sequelize']['import'](_0xfa74('0x32'));db[_0xfa74('0x33')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/userSmsQueue/userSmsQueue.model');db[_0xfa74('0x34')]=db[_0xfa74('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db['sequelize']['import'](_0xfa74('0x35'));db[_0xfa74('0x36')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x37'));db[_0xfa74('0x38')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x39'));db['MailAccount']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x3a'));db[_0xfa74('0x3b')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/mailQueue/mailQueue.model');db[_0xfa74('0x3c')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x3d'));db['MailInteraction']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x3e'));db[_0xfa74('0x3f')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x40'));db[_0xfa74('0x41')]=db['sequelize']['import'](_0xfa74('0x42'));db[_0xfa74('0x43')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/mailQueueReport/mailQueueReport.model');db[_0xfa74('0x44')]=db[_0xfa74('0x1')]['import']('../api/dashboard/dashboard.model');db['DashboardItem']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x45'));db[_0xfa74('0x46')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x47'));db[_0xfa74('0x48')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x49'));db[_0xfa74('0x4a')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/faxInteraction/faxInteraction.model');db[_0xfa74('0x4b')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x4c'));db[_0xfa74('0x4d')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x4e'));db[_0xfa74('0x4f')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x50'));db['SmsAccount']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x51'));db[_0xfa74('0x52')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x53'));db['SmsInteraction']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0xfa74('0x54')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x55'));db[_0xfa74('0x56')]=db['sequelize']['import'](_0xfa74('0x57'));db[_0xfa74('0x58')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x59'));db[_0xfa74('0x5a')]=db['sequelize']['import'](_0xfa74('0x5b'));db[_0xfa74('0x5c')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x5d'));db[_0xfa74('0x5e')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/openchannelMessage/openchannelMessage.model');db[_0xfa74('0x5f')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x60'));db['ChatWebsite']=db['sequelize'][_0xfa74('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0xfa74('0x61')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x62'));db[_0xfa74('0x63')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/chatApplication/chatApplication.model');db[_0xfa74('0x64')]=db['sequelize'][_0xfa74('0x11')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x65'));db[_0xfa74('0x66')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x67'));db[_0xfa74('0x68')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/chatGroup/chatGroup.model');db[_0xfa74('0x69')]=db[_0xfa74('0x1')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0xfa74('0x6a')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x6b'));db[_0xfa74('0x6c')]=db['sequelize'][_0xfa74('0x11')]('../api/cmContact/cmContact.model');db[_0xfa74('0x6d')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x6e'));db[_0xfa74('0x6f')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x70'));db['CmHopperHistory']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x71'));db[_0xfa74('0x72')]=db['sequelize'][_0xfa74('0x11')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xfa74('0x73')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x74'));db[_0xfa74('0x75')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x76'));db[_0xfa74('0x77')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x78'));db[_0xfa74('0x79')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/cannedAnswer/cannedAnswer.model');db[_0xfa74('0x7a')]=db[_0xfa74('0x1')]['import']('../api/disposition/disposition.model');db[_0xfa74('0x7b')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x7c'));db[_0xfa74('0x7d')]=db['sequelize'][_0xfa74('0x11')]('../api/interval/interval.model');db['Pause']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x7e'));db[_0xfa74('0x7f')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x80'));db[_0xfa74('0x81')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x82'));db['Schedule']=db[_0xfa74('0x1')]['import'](_0xfa74('0x83'));db[_0xfa74('0x84')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x85'));db[_0xfa74('0x86')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x87'));db[_0xfa74('0x88')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x89'));db['Trigger']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x8a'));db[_0xfa74('0x8b')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x8c'));db[_0xfa74('0x8d')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x8e'));db[_0xfa74('0x8f')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x90'));db[_0xfa74('0x91')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x92'));db[_0xfa74('0x93')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x94'));db[_0xfa74('0x95')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xfa74('0x96')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x97'));db['AnalyticFieldReport']=db[_0xfa74('0x1')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0xfa74('0x98')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x99'));db['SalesforceAccount']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x9a'));db[_0xfa74('0x9b')]=db[_0xfa74('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x9c'));db[_0xfa74('0x9d')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x9e'));db[_0xfa74('0x9f')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xa0'));db[_0xfa74('0xa1')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xa2'));db['DeskAccount']=db['sequelize']['import'](_0xfa74('0xa3'));db[_0xfa74('0xa4')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xa5'));db['DeskField']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/intDeskField/intDeskField.model');db[_0xfa74('0xa6')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xa7'));db[_0xfa74('0xa8')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xa9'));db[_0xfa74('0xaa')]=db[_0xfa74('0x1')]['import']('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xfa74('0xab')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xac'));db['ZendeskField']=db[_0xfa74('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db[_0xfa74('0xad')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xfa74('0xae')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xaf'));db['FreshdeskField']=db['sequelize']['import'](_0xfa74('0xb0'));db[_0xfa74('0xb1')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xb2'));db['VtigerConfiguration']=db['sequelize'][_0xfa74('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xfa74('0xb3')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xb4'));db[_0xfa74('0xb5')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xb6'));db[_0xfa74('0xb7')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xb8'));db[_0xfa74('0xb9')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xba'));db[_0xfa74('0xbb')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xbc'));db[_0xfa74('0xbd')]=db['sequelize']['import'](_0xfa74('0xbe'));db[_0xfa74('0xbf')]=db[_0xfa74('0x1')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xfa74('0xc0')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xc1'));db[_0xfa74('0xc2')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xfa74('0xc3')]=db['sequelize']['import'](_0xfa74('0xc4'));db[_0xfa74('0x8d')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x8e'));db['Network']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xc5'));db[_0xfa74('0xc6')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xc7'));db['ChatInternalMessage']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xfa74('0xc8')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xfa74('0xc9')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xca'));db[_0xfa74('0xcb')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xcc'));db['SmsQueueReport']=db['sequelize'][_0xfa74('0x11')]('../api/smsQueueReport/smsQueueReport.model');db[_0xfa74('0xcd')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xce'));db[_0xfa74('0xcf')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xd0'));db[_0xfa74('0xd1')]=db[_0xfa74('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xd2'));db['SquareOdbc']=db[_0xfa74('0x1')]['import'](_0xfa74('0xd3'));db[_0xfa74('0xd4')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xd5'));db[_0xfa74('0xd6')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xd7'));db[_0xfa74('0xd8')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xd9'));db['Team']=db[_0xfa74('0x1')]['import'](_0xfa74('0xda'));db[_0xfa74('0xdb')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xdc'));db[_0xfa74('0xdd')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xde'));db['Migration']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xdf'));db['Attachment']=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/attachment/attachment.model');db[_0xfa74('0xe0')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xe1'));db[_0xfa74('0xe2')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xe3'));db[_0xfa74('0xe4')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xe5'));db[_0xfa74('0xe6')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/faxTransferReport/faxTransferReport.model');db[_0xfa74('0xe7')]=db['sequelize'][_0xfa74('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xfa74('0xe8')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0xfa74('0xe9')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xea'));db[_0xfa74('0xeb')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xec'));db[_0xfa74('0xed')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xee'));db[_0xfa74('0xef')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xf0'));db[_0xfa74('0xf1')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xf2'));db[_0xfa74('0xf3')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xf4'));db[_0xfa74('0xf5')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0xf6'));db[_0xfa74('0xf7')]=db['sequelize']['import'](_0xfa74('0xf8'));db[_0xfa74('0xf9')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xfa'));db['WhatsappMessage']=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0xfb'));db[_0xfa74('0xfc')]=db[_0xfa74('0x1')]['import'](_0xfa74('0xfd'));db[_0xfa74('0xfe')]=db[_0xfa74('0x1')][_0xfa74('0x11')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xfa74('0xff')]=db[_0xfa74('0x1')]['import'](_0xfa74('0x100'));db[_0xfa74('0x101')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x102'));db[_0xfa74('0x103')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x104'));db[_0xfa74('0x105')]=db[_0xfa74('0x1')][_0xfa74('0x11')](_0xfa74('0x106'));db[_0xfa74('0x107')]=db['sequelize'][_0xfa74('0x11')](_0xfa74('0x108'));db[_0xfa74('0x10')]['hasOne'](db[_0xfa74('0x109')],{'as':'VoiceMail','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x1c')],{'as':'Recordings','foreignKey':'UserId'});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x2a')],{'as':_0xfa74('0x10d'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x10e'),'onDelete':'cascade','hooks':!![]});db['User'][_0xfa74('0x10c')](db[_0xfa74('0x6f')],{'as':_0xfa74('0x10f'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db['CmHopperHistory'],{'as':_0xfa74('0x110'),'foreignKey':_0xfa74('0x10b')});db['User'][_0xfa74('0x10c')](db[_0xfa74('0x72')],{'as':_0xfa74('0x72'),'foreignKey':_0xfa74('0x10b')});db['User'][_0xfa74('0x10c')](db[_0xfa74('0x5c')],{'as':_0xfa74('0x111'),'foreignKey':'UserId'});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x64')],{'as':'ChatInteractions','foreignKey':_0xfa74('0x10b')});db['User'][_0xfa74('0x10c')](db['SmsInteraction'],{'as':_0xfa74('0x112'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x4a')],{'as':_0xfa74('0x113'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0x114')],{'as':'MailInteractions','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x10')][_0xfa74('0x10c')](db[_0xfa74('0xf9')],{'as':_0xfa74('0x115'),'foreignKey':'UserId'});db[_0xfa74('0x10')][_0xfa74('0x10c')](db['UserNotification'],{'as':_0xfa74('0x116'),'foreignKey':_0xfa74('0x117')});db['User'][_0xfa74('0x118')](db[_0xfa74('0xed')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x68')],{'as':'Groups','through':_0xfa74('0x11a')});db[_0xfa74('0x10')][_0xfa74('0x119')](db['CmContact'],{'as':_0xfa74('0x11b'),'through':_0xfa74('0x11c')});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'as':'Lists','through':_0xfa74('0x11d')});db[_0xfa74('0x10')][_0xfa74('0x119')](db['Team'],{'through':_0xfa74('0x11e')});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x114')],{'as':_0xfa74('0x11f'),'through':_0xfa74('0x120')});db['User'][_0xfa74('0x119')](db[_0xfa74('0x64')],{'as':_0xfa74('0x121'),'through':'user_has_chat_interactions'});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x4a')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0xfa74('0x119')](db['SmsInteraction'],{'as':_0xfa74('0x112'),'through':_0xfa74('0x122')});db['User'][_0xfa74('0x119')](db[_0xfa74('0x5c')],{'as':_0xfa74('0x111'),'through':_0xfa74('0x123')});db[_0xfa74('0x10')][_0xfa74('0x119')](db['WhatsappInteraction'],{'as':_0xfa74('0x115'),'through':_0xfa74('0x124')});db['User'][_0xfa74('0x119')](db['VoiceQueue'],{'as':_0xfa74('0x125'),'through':_0xfa74('0x2c'),'required':![]});db['User'][_0xfa74('0x119')](db[_0xfa74('0xeb')],{'as':_0xfa74('0x126'),'through':_0xfa74('0x107'),'required':![]});db['User'][_0xfa74('0x119')](db[_0xfa74('0x3b')],{'as':'MailQueues','through':_0xfa74('0x127'),'required':![]});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x66')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0x4d')],{'as':'FaxQueues','through':_0xfa74('0x31'),'required':![]});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x56')],{'as':'SmsQueues','through':_0xfa74('0x33'),'required':![]});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x5f')],{'as':_0xfa74('0x128'),'through':_0xfa74('0x34'),'required':![]});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0xff')],{'as':_0xfa74('0x129'),'through':_0xfa74('0x12a'),'required':![]});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'through':_0xfa74('0x11d')});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x12c'),'through':_0xfa74('0x12d')});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0x46')],{'as':'FaxAccounts','through':_0xfa74('0x12e')});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0x12f')],{'as':_0xfa74('0x130'),'through':_0xfa74('0x131')});db['User'][_0xfa74('0x119')](db[_0xfa74('0x58')],{'as':_0xfa74('0x132'),'through':_0xfa74('0x133')});db[_0xfa74('0x10')]['belongsToMany'](db[_0xfa74('0x134')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0xf5')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0xfa74('0x10')][_0xfa74('0x119')](db[_0xfa74('0xd4')],{'as':_0xfa74('0x135'),'through':_0xfa74('0x136')});db['VoiceChanSpy'][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':'SpiedAgents','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x137')});db['VoiceContext'][_0xfa74('0x10c')](db['VoiceExtension'],{'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x17')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x138'),'onDelete':'cascade'});db[_0xfa74('0x19')][_0xfa74('0x119')](db[_0xfa74('0x84')],{'as':_0xfa74('0x139'),'through':'moh_has_sounds'});db['VoiceQueue'][_0xfa74('0x10c')](db['UserVoiceQueueRt'],{'as':_0xfa74('0x13a'),'foreignKey':_0xfa74('0x13b')});db[_0xfa74('0x1b')][_0xfa74('0x10c')](db['CmHopper'],{'as':_0xfa74('0x13c'),'foreignKey':'VoiceQueueId'});db[_0xfa74('0x1b')][_0xfa74('0x10c')](db[_0xfa74('0x6f')],{'as':_0xfa74('0x10f'),'foreignKey':_0xfa74('0x13b')});db['VoiceQueue'][_0xfa74('0x10c')](db['CmHopperHistory'],{'as':_0xfa74('0x13d'),'foreignKey':'VoiceQueueId'});db[_0xfa74('0x1b')]['hasMany'](db[_0xfa74('0x72')],{'as':'ReportAgentPreview','foreignKey':_0xfa74('0x13b')});db['VoiceQueue'][_0xfa74('0x10c')](db[_0xfa74('0x13e')],{'as':_0xfa74('0x13f'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xfa74('0x10c')](db[_0xfa74('0xcb')],{'as':_0xfa74('0x140'),'foreignKey':_0xfa74('0x13b')});db['VoiceQueue'][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x141'),'foreignKey':'TrunkId'});db[_0xfa74('0x1b')][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x142'),'foreignKey':'TrunkBackupId'});db[_0xfa74('0x1b')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'as':_0xfa74('0x7d'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0xfa74('0x118')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x143'),'through':_0xfa74('0x144')});db[_0xfa74('0x1b')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x2c')});db[_0xfa74('0x1b')][_0xfa74('0x119')](db['Team'],{'as':_0xfa74('0x146'),'through':_0xfa74('0x103')});db[_0xfa74('0x1b')]['belongsToMany'](db[_0xfa74('0xe9')],{'as':_0xfa74('0x147'),'through':_0xfa74('0x148')});db[_0xfa74('0x1c')][_0xfa74('0x118')](db['User'],{'as':'User','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x1e')]['belongsTo'](db[_0xfa74('0x10')],{'as':_0xfa74('0x10'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x109')][_0xfa74('0x10c')](db['VoiceMailMessage'],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x14a'),'sourceKey':_0xfa74('0x14b')});db[_0xfa74('0x21')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0xfa74('0x14a'),'targetKey':_0xfa74('0x14b')});db['VoiceCallReport'][_0xfa74('0x10c')](db[_0xfa74('0x14c')],{'as':_0xfa74('0x14d'),'foreignKey':_0xfa74('0x14e'),'constraints':![]});db[_0xfa74('0x22')][_0xfa74('0x10c')](db['VoiceAgentReport'],{'as':_0xfa74('0x14f'),'foreignKey':'uniqueid','constraints':![]});db[_0xfa74('0x22')]['belongsTo'](db['User'],{'as':_0xfa74('0x10'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x22')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x36')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'as':_0xfa74('0x12f'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x38')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'as':_0xfa74('0x12f'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x12f')]['hasOne'](db[_0xfa74('0x36')],{'as':_0xfa74('0x153'),'onDelete':'cascade'});db[_0xfa74('0x12f')][_0xfa74('0x154')](db[_0xfa74('0x38')],{'as':_0xfa74('0x155'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x12f')][_0xfa74('0x10c')](db[_0xfa74('0x7a')],{'as':_0xfa74('0x156'),'foreignKey':_0xfa74('0x152'),'onDelete':'cascade'});db[_0xfa74('0x12f')][_0xfa74('0x10c')](db[_0xfa74('0x79')],{'as':_0xfa74('0x157'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x12f')][_0xfa74('0x10c')](db[_0xfa74('0x3f')],{'as':_0xfa74('0x149'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x12f')][_0xfa74('0x10c')](db[_0xfa74('0x114')],{'as':_0xfa74('0x158')});db[_0xfa74('0x12f')]['hasMany'](db[_0xfa74('0x41')],{'as':_0xfa74('0x138')});db['MailAccount'][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x12f')][_0xfa74('0x118')](db[_0xfa74('0x88')],{'as':_0xfa74('0x88'),'foreignKey':_0xfa74('0x15b')});db[_0xfa74('0x12f')][_0xfa74('0x118')](db['Pause'],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db[_0xfa74('0x12f')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x131')});db[_0xfa74('0x3b')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x127')});db[_0xfa74('0x3b')][_0xfa74('0x119')](db[_0xfa74('0x15e')],{'through':_0xfa74('0x15f'),'as':_0xfa74('0x146')});db[_0xfa74('0x114')][_0xfa74('0x10c')](db['MailMessage'],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x160')});db[_0xfa74('0x114')]['belongsTo'](db[_0xfa74('0x12f')],{'as':_0xfa74('0x161'),'foreignKey':'MailAccountId'});db[_0xfa74('0x114')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x114')][_0xfa74('0x118')](db['User'],{'as':'Owner','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x114')]['belongsToMany'](db[_0xfa74('0x86')],{'through':_0xfa74('0x162'),'as':_0xfa74('0x163')});db[_0xfa74('0x114')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x162'),'as':'ThroughTags'});db['MailInteraction'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':'Users','through':_0xfa74('0x120'),'foreignKey':_0xfa74('0x160')});db[_0xfa74('0x3f')][_0xfa74('0x10c')](db['Attachment'],{'as':'Attachments','onDelete':_0xfa74('0x10a')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db['User'],{'as':_0xfa74('0x10')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x150')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x114')],{'as':_0xfa74('0x164'),'foreignKey':_0xfa74('0x160')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x152')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x12b'),'foreignKey':_0xfa74('0x165')});db[_0xfa74('0x3f')][_0xfa74('0x118')](db[_0xfa74('0x166')],{'as':_0xfa74('0x166'),'foreignKey':_0xfa74('0x167')});db[_0xfa74('0x41')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db['MailApplication']['belongsTo'](db[_0xfa74('0x3b')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x41')]['belongsTo'](db[_0xfa74('0x12f')],{'onDelete':_0xfa74('0x168')});db['MailApplication']['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xfa74('0x169')});db[_0xfa74('0x41')]['belongsTo'](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x16a')});db[_0xfa74('0x43')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{});db[_0xfa74('0x43')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db['MailQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x43')]['belongsTo'](db[_0xfa74('0x114')],{});db[_0xfa74('0x43')][_0xfa74('0x118')](db[_0xfa74('0x3f')],{});db[_0xfa74('0x43')]['belongsTo'](db[_0xfa74('0x10')],{});db[_0xfa74('0x43')]['belongsTo'](db[_0xfa74('0x3b')],{});db[_0xfa74('0x44')][_0xfa74('0x10c')](db[_0xfa74('0x16b')],{'as':'Items','onDelete':_0xfa74('0x10a')});db[_0xfa74('0x46')]['hasMany'](db[_0xfa74('0x7a')],{'as':_0xfa74('0x156'),'foreignKey':'FaxAccountId','onDelete':_0xfa74('0x10a')});db['FaxAccount'][_0xfa74('0x10c')](db[_0xfa74('0x79')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xfa74('0x46')][_0xfa74('0x10c')](db['FaxInteraction'],{'as':_0xfa74('0x158')});db['FaxAccount']['hasMany'](db[_0xfa74('0x48')],{'as':_0xfa74('0x138')});db[_0xfa74('0x46')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x16c'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x46')]['hasMany'](db['FaxMessage'],{'as':_0xfa74('0x149')});db[_0xfa74('0x46')][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x141')});db[_0xfa74('0x46')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x46')][_0xfa74('0x118')](db['Pause'],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db[_0xfa74('0x46')][_0xfa74('0x119')](db['User'],{'as':'Agents','through':_0xfa74('0x12e')});db['FaxApplication']['belongsTo'](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x48')][_0xfa74('0x118')](db[_0xfa74('0x4d')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x48')][_0xfa74('0x118')](db[_0xfa74('0x46')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x48')][_0xfa74('0x118')](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x16a')});db['FaxInteraction'][_0xfa74('0x10c')](db[_0xfa74('0x4b')],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':'FaxInteractionId'});db[_0xfa74('0x4a')]['belongsTo'](db[_0xfa74('0x46')],{'as':'Account','foreignKey':_0xfa74('0x16d')});db[_0xfa74('0x4a')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x4a')][_0xfa74('0x118')](db['User'],{'as':'Owner','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x4a')][_0xfa74('0x119')](db['Tag'],{'through':_0xfa74('0x16e'),'as':'Tags'});db[_0xfa74('0x4a')]['belongsToMany'](db[_0xfa74('0x86')],{'through':'fax_interaction_has_tags','as':_0xfa74('0x16f')});db[_0xfa74('0x4a')]['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xfa74('0x4b')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':'cascade','as':'User'});db[_0xfa74('0x4b')][_0xfa74('0x118')](db[_0xfa74('0x4a')],{'as':_0xfa74('0x164'),'foreignKey':_0xfa74('0x171')});db['FaxMessage']['belongsTo'](db[_0xfa74('0x6c')],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x150')});db['FaxMessage'][_0xfa74('0x118')](db['Attachment'],{'as':_0xfa74('0x172'),'foreignKey':_0xfa74('0x173')});db[_0xfa74('0x4b')][_0xfa74('0x118')](db['FaxAccount'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x16d')});db['FaxQueue']['belongsToMany'](db[_0xfa74('0x10')],{'as':'Agents','through':_0xfa74('0x31')});db[_0xfa74('0x4d')][_0xfa74('0x119')](db[_0xfa74('0x15e')],{'through':_0xfa74('0x174'),'as':_0xfa74('0x146')});db[_0xfa74('0x4f')][_0xfa74('0x118')](db[_0xfa74('0x46')],{});db[_0xfa74('0x4f')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x4f')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':'ContactId'});db[_0xfa74('0x4f')][_0xfa74('0x118')](db['FaxInteraction'],{});db['FaxQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x4b')],{});db['FaxQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x10')],{});db['FaxQueueReport'][_0xfa74('0x118')](db['FaxQueue'],{});db[_0xfa74('0x134')][_0xfa74('0x10c')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xfa74('0x175'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x134')][_0xfa74('0x10c')](db['CannedAnswer'],{'as':_0xfa74('0x157'),'foreignKey':_0xfa74('0x175')});db[_0xfa74('0x134')][_0xfa74('0x10c')](db[_0xfa74('0x54')],{'as':_0xfa74('0x149'),'foreignKey':_0xfa74('0x175')});db[_0xfa74('0x134')][_0xfa74('0x10c')](db[_0xfa74('0x176')],{'as':_0xfa74('0x158')});db['SmsAccount'][_0xfa74('0x10c')](db[_0xfa74('0x52')],{'as':_0xfa74('0x138')});db['SmsAccount'][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x134')][_0xfa74('0x118')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xfa74('0x15d')});db[_0xfa74('0x134')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':'user_has_sms_accounts'});db[_0xfa74('0x52')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x52')]['belongsTo'](db[_0xfa74('0x56')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x52')]['belongsTo'](db[_0xfa74('0x134')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x52')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0x52')][_0xfa74('0x118')](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x16a')});db[_0xfa74('0x176')][_0xfa74('0x10c')](db[_0xfa74('0x54')],{'as':_0xfa74('0x149'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xfa74('0x176')][_0xfa74('0x118')](db['SmsAccount'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x175')});db[_0xfa74('0x176')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x176')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':'Owner','foreignKey':'UserId'});db[_0xfa74('0x176')][_0xfa74('0x119')](db['Tag'],{'through':_0xfa74('0x177'),'as':_0xfa74('0x163')});db[_0xfa74('0x176')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'sms_interaction_has_tags','as':_0xfa74('0x16f')});db[_0xfa74('0x176')]['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x122'),'foreignKey':_0xfa74('0x178')});db[_0xfa74('0x54')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':'User'});db['SmsMessage']['belongsTo'](db[_0xfa74('0x6c')],{'onDelete':'cascade','as':'Contact'});db['SmsMessage'][_0xfa74('0x118')](db['SmsInteraction'],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x164'),'foreignKey':'SmsInteractionId'});db[_0xfa74('0x54')][_0xfa74('0x118')](db[_0xfa74('0x134')],{'as':'Account','foreignKey':_0xfa74('0x175')});db[_0xfa74('0x56')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x33'),'foreignKey':_0xfa74('0x179')});db[_0xfa74('0x56')][_0xfa74('0x119')](db[_0xfa74('0x15e')],{'through':_0xfa74('0x17a'),'as':_0xfa74('0x146')});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x7a')],{'as':'Dispositions','foreignKey':_0xfa74('0x17b'),'onDelete':'cascade'});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x79')],{'as':_0xfa74('0x157'),'foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x5c')],{'as':_0xfa74('0x158'),'foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x5e')],{'as':'Messages','foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x58')][_0xfa74('0x10c')](db[_0xfa74('0x5a')],{'as':_0xfa74('0x138'),'foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x58')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x58')]['belongsTo'](db[_0xfa74('0x17c')],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db[_0xfa74('0x58')]['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x133')});db['OpenchannelApplication'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0x5a')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x17d')});db[_0xfa74('0x5a')][_0xfa74('0x118')](db[_0xfa74('0x58')],{'onDelete':'restrict','foreignKey':_0xfa74('0x17b')});db['OpenchannelApplication']['belongsTo'](db[_0xfa74('0x7d')],{'onDelete':'restrict','foreignKey':_0xfa74('0x169')});db[_0xfa74('0x5a')][_0xfa74('0x118')](db[_0xfa74('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xfa74('0x5c')][_0xfa74('0x10c')](db['OpenchannelMessage'],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x17e')});db[_0xfa74('0x5c')][_0xfa74('0x118')](db['OpenchannelAccount'],{'as':_0xfa74('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0xfa74('0x5c')][_0xfa74('0x118')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xfa74('0x5c')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':_0xfa74('0x17f'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x5c')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x180'),'as':_0xfa74('0x163')});db[_0xfa74('0x5c')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db['OpenchannelInteraction']['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':'user_has_openchannel_interactions','foreignKey':_0xfa74('0x17e')});db[_0xfa74('0x5e')]['belongsTo'](db[_0xfa74('0x10')],{'onDelete':'cascade','as':_0xfa74('0x10')});db[_0xfa74('0x5e')][_0xfa74('0x118')](db['CmContact'],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x150')});db[_0xfa74('0x5e')][_0xfa74('0x118')](db[_0xfa74('0x5c')],{'onDelete':_0xfa74('0x10a'),'as':'Interaction','foreignKey':_0xfa74('0x17e')});db[_0xfa74('0x5e')][_0xfa74('0x118')](db[_0xfa74('0x172')],{'as':_0xfa74('0x172'),'foreignKey':_0xfa74('0x173')});db[_0xfa74('0x5e')]['belongsTo'](db[_0xfa74('0x58')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x17b')});db[_0xfa74('0x5f')][_0xfa74('0x119')](db['User'],{'as':_0xfa74('0x145'),'through':_0xfa74('0x34'),'foreignKey':_0xfa74('0x17d')});db[_0xfa74('0x5f')][_0xfa74('0x119')](db['Team'],{'through':'team_has_openchannel_queues','as':_0xfa74('0x146')});db[_0xfa74('0x12b')][_0xfa74('0x10c')](db['Disposition'],{'as':_0xfa74('0x156'),'foreignKey':_0xfa74('0x165'),'onDelete':'cascade'});db[_0xfa74('0x12b')]['hasMany'](db[_0xfa74('0x79')],{'as':_0xfa74('0x157'),'foreignKey':_0xfa74('0x165')});db[_0xfa74('0x12b')][_0xfa74('0x10c')](db[_0xfa74('0x69')],{'as':_0xfa74('0x181')});db['ChatWebsite'][_0xfa74('0x10c')](db['ChatInteraction'],{'as':_0xfa74('0x158')});db[_0xfa74('0x12b')][_0xfa74('0x10c')](db[_0xfa74('0x63')],{'as':_0xfa74('0x138')});db[_0xfa74('0x12b')][_0xfa74('0x10c')](db[_0xfa74('0x182')],{'as':_0xfa74('0x149')});db[_0xfa74('0x12b')]['belongsTo'](db[_0xfa74('0xe9')],{'as':'List','foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x12b')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'as':_0xfa74('0x7d'),'foreignKey':'IntervalId'});db[_0xfa74('0x12b')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'as':'MailAccount','foreignKey':_0xfa74('0x152')});db[_0xfa74('0x12b')]['belongsTo'](db[_0xfa74('0x17c')],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db['ChatWebsite'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':'Agents','through':_0xfa74('0x12d')});db['OpenchannelQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x58')],{});db[_0xfa74('0x61')][_0xfa74('0x118')](db['CmList'],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x61')][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':'ContactId'});db[_0xfa74('0x61')][_0xfa74('0x118')](db[_0xfa74('0x5c')],{});db[_0xfa74('0x61')][_0xfa74('0x118')](db[_0xfa74('0x5e')],{});db['OpenchannelQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x10')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db[_0xfa74('0x63')]['belongsTo'](db[_0xfa74('0x10')],{'as':'Agent','foreignKey':'UserId','onDelete':_0xfa74('0x168')});db[_0xfa74('0x63')]['belongsTo'](db['ChatQueue'],{'as':_0xfa74('0x183'),'foreignKey':_0xfa74('0x184'),'onDelete':_0xfa74('0x168')});db['ChatApplication']['belongsTo'](db[_0xfa74('0x12b')],{'as':_0xfa74('0x185'),'foreignKey':_0xfa74('0x165'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x63')][_0xfa74('0x118')](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':'TagId'});db[_0xfa74('0x64')][_0xfa74('0x10c')](db[_0xfa74('0x182')],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x186')});db[_0xfa74('0x64')][_0xfa74('0x118')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x161'),'foreignKey':'ChatWebsiteId'});db[_0xfa74('0x64')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db['ChatInteraction'][_0xfa74('0x118')](db['User'],{'as':_0xfa74('0x17f'),'foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x64')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x187'),'as':_0xfa74('0x163')});db[_0xfa74('0x64')][_0xfa74('0x119')](db['Tag'],{'through':_0xfa74('0x187'),'as':'ThroughTags'});db['ChatInteraction'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x188'),'foreignKey':_0xfa74('0x186')});db[_0xfa74('0x182')][_0xfa74('0x118')](db['User'],{'onDelete':'cascade','as':_0xfa74('0x10')});db['ChatMessage'][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xfa74('0x151')});db[_0xfa74('0x182')][_0xfa74('0x118')](db['ChatInteraction'],{'onDelete':'cascade','as':_0xfa74('0x164'),'foreignKey':_0xfa74('0x186')});db[_0xfa74('0x182')][_0xfa74('0x118')](db[_0xfa74('0x172')],{'as':_0xfa74('0x172'),'foreignKey':_0xfa74('0x173')});db[_0xfa74('0x182')][_0xfa74('0x118')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x161'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xfa74('0x10c')](db[_0xfa74('0x172')],{'as':_0xfa74('0x189'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xfa74('0x10a'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0xfa74('0x166')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':'UserChatQueue','hooks':!![]});db[_0xfa74('0x66')][_0xfa74('0x119')](db['Team'],{'through':_0xfa74('0x18a'),'as':'Teams'});db[_0xfa74('0x68')][_0xfa74('0x10c')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0xfa74('0x18b'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x68')][_0xfa74('0x119')](db['User'],{'as':'Members','through':_0xfa74('0x11a')});db[_0xfa74('0x69')][_0xfa74('0x118')](db[_0xfa74('0x12b')],{'as':_0xfa74('0x185'),'foreignKey':_0xfa74('0x165')});db[_0xfa74('0x6a')]['hasMany'](db[_0xfa74('0x6c')],{'as':'Contacts','foreignKey':_0xfa74('0x18c')});db[_0xfa74('0x6c')][_0xfa74('0x10c')](db['CmHopper'],{'as':_0xfa74('0x13c'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x6c')][_0xfa74('0x10c')](db['CmHopperFinal'],{'as':_0xfa74('0x10f'),'foreignKey':'ContactId'});db[_0xfa74('0x6c')]['hasMany'](db['CmHopperHistory'],{'as':_0xfa74('0x13d'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0x6c')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xfa74('0x151')});db['CmContact']['hasMany'](db[_0xfa74('0xcb')],{'as':'JscriptySessions','foreignKey':_0xfa74('0x151')});db['CmContact'][_0xfa74('0x10c')](db[_0xfa74('0x5c')],{'as':_0xfa74('0x111'),'foreignKey':'ContactId','onDelete':_0xfa74('0x168')});db['CmContact'][_0xfa74('0x10c')](db['ChatInteraction'],{'as':_0xfa74('0x121'),'foreignKey':_0xfa74('0x151'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x6c')][_0xfa74('0x10c')](db[_0xfa74('0x176')],{'as':_0xfa74('0x112'),'foreignKey':_0xfa74('0x151'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x6c')]['hasMany'](db[_0xfa74('0x4a')],{'as':'FaxInteractions','foreignKey':_0xfa74('0x151'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x6c')][_0xfa74('0x10c')](db['MailInteraction'],{'as':_0xfa74('0x11f'),'foreignKey':'ContactId','onDelete':_0xfa74('0x168')});db[_0xfa74('0x6c')][_0xfa74('0x118')](db[_0xfa74('0x6a')],{'as':_0xfa74('0x18d'),'foreignKey':_0xfa74('0x18c')});db['CmContact'][_0xfa74('0x118')](db['CmList'],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x6c')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x11c')});db['CmContact'][_0xfa74('0x119')](db[_0xfa74('0x86')],{'as':_0xfa74('0x163'),'through':_0xfa74('0x18e')});db[_0xfa74('0x6c')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0xfa74('0x6d')][_0xfa74('0x118')](db['CmContact'],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x6d')]['belongsTo'](db[_0xfa74('0xe9')],{'as':'List','foreignKey':_0xfa74('0x15a'),'onDelete':_0xfa74('0x10a')});db['CmHopper'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':'Agent','foreignKey':_0xfa74('0x10b')});db[_0xfa74('0x6d')][_0xfa74('0x118')](db[_0xfa74('0x1b')],{'as':_0xfa74('0x183'),'foreignKey':_0xfa74('0x13b'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x6d')][_0xfa74('0x118')](db[_0xfa74('0xdd')],{'as':_0xfa74('0xdd'),'foreignKey':_0xfa74('0x18f'),'onDelete':_0xfa74('0x10a')});db['CmHopper'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':_0xfa74('0x17f'),'foreignKey':_0xfa74('0x190')});db[_0xfa74('0x13e')]['belongsTo'](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151'),'onDelete':'cascade'});db[_0xfa74('0x13e')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x13e')][_0xfa74('0x118')](db[_0xfa74('0x1b')],{'as':_0xfa74('0x183'),'foreignKey':'VoiceQueueId','onDelete':_0xfa74('0x10a')});db[_0xfa74('0x13e')]['belongsTo'](db['Campaign'],{'as':_0xfa74('0xdd'),'foreignKey':_0xfa74('0x18f'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x77')][_0xfa74('0x10c')](db[_0xfa74('0x7b')],{'as':{'plural':_0xfa74('0x191'),'singular':_0xfa74('0x192')},'foreignKey':_0xfa74('0x193'),'onDelete':_0xfa74('0x10a'),'hooks':!![]});db['Automation'][_0xfa74('0x10c')](db[_0xfa74('0x7b')],{'as':{'plural':_0xfa74('0x194'),'singular':'OneAny'},'foreignKey':_0xfa74('0x195'),'onDelete':'cascade','hooks':!![]});db[_0xfa74('0x77')][_0xfa74('0x10c')](db[_0xfa74('0x75')],{'as':_0xfa74('0x196'),'foreignKey':'AutomationId','onDelete':_0xfa74('0x10a'),'hooks':!![]});db[_0xfa74('0x7a')][_0xfa74('0x10c')](db[_0xfa74('0x7a')],{'as':_0xfa74('0x156'),'foreignKey':_0xfa74('0x197'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db[_0xfa74('0x7d')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x10e'),'foreignKey':_0xfa74('0x169'),'onDelete':_0xfa74('0x168')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0xfa74('0x169')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db[_0xfa74('0x63')],{'as':_0xfa74('0x198'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db['FaxApplication'],{'as':_0xfa74('0x199'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0x7d')][_0xfa74('0x10c')](db[_0xfa74('0x52')],{'as':_0xfa74('0x19a'),'foreignKey':'IntervalId'});db[_0xfa74('0x19b')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{});db['Schedule'][_0xfa74('0x118')](db[_0xfa74('0x93')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0xfa74('0x118')](db[_0xfa74('0x91')],{'foreignKey':_0xfa74('0x19c')});db[_0xfa74('0x84')][_0xfa74('0x119')](db[_0xfa74('0x19')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0xfa74('0x168')});db['Tag'][_0xfa74('0x119')](db[_0xfa74('0x6c')],{'through':'cm_contact_has_tags'});db[_0xfa74('0x86')][_0xfa74('0x119')](db[_0xfa74('0x64')],{'through':_0xfa74('0x187')});db[_0xfa74('0x86')][_0xfa74('0x119')](db[_0xfa74('0x114')],{'through':_0xfa74('0x162')});db['Tag'][_0xfa74('0x119')](db[_0xfa74('0x176')],{'through':_0xfa74('0x177')});db[_0xfa74('0x86')]['belongsToMany'](db['FaxInteraction'],{'through':_0xfa74('0x16e')});db['Tag']['belongsToMany'](db[_0xfa74('0x5c')],{'through':'openchannel_interaction_has_tags'});db[_0xfa74('0x86')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0xfa74('0x19d')});db['Trigger'][_0xfa74('0x10c')](db[_0xfa74('0x7b')],{'as':{'plural':_0xfa74('0x19e'),'singular':_0xfa74('0x19f')},'foreignKey':_0xfa74('0x1a0'),'onDelete':_0xfa74('0x10a'),'hooks':!![]});db[_0xfa74('0x1a1')]['hasMany'](db[_0xfa74('0x7b')],{'as':{'plural':'AnyConditions','singular':_0xfa74('0x1a2')},'foreignKey':_0xfa74('0x1a3'),'onDelete':_0xfa74('0x10a'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':_0xfa74('0x196'),'foreignKey':_0xfa74('0x1a4'),'onDelete':_0xfa74('0x10a'),'hooks':!![]});db[_0xfa74('0x91')][_0xfa74('0x10c')](db[_0xfa74('0x1a5')],{'as':'Fields','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x19c'),'hooks':!![]});db[_0xfa74('0x93')][_0xfa74('0x10c')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1a6')});db[_0xfa74('0x96')][_0xfa74('0x10c')](db['AnalyticFieldReport'],{'as':_0xfa74('0x1a7'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1a8')});db[_0xfa74('0x1a5')][_0xfa74('0x118')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0xfa74('0x1a9')][_0xfa74('0x10c')](db[_0xfa74('0x9b')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0x9b')]['hasMany'](db[_0xfa74('0x1ac')],{'as':'Subjects','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0x9b')]['hasMany'](db[_0xfa74('0x1ac')],{'as':_0xfa74('0x1ae'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1af')});db['SalesforceConfiguration'][_0xfa74('0x10c')](db['SalesforceField'],{'as':_0xfa74('0x1a7'),'onDelete':'cascade','foreignKey':_0xfa74('0x1b0')});db['SalesforceConfiguration']['belongsTo'](db[_0xfa74('0x1a9')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0x1ac')][_0xfa74('0x10c')](db[_0xfa74('0x1ac')],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0x1ac')]['hasMany'](db[_0xfa74('0x1ac')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0x1ac')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0x1ac')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':'Variable','foreignKey':'VariableId'});db[_0xfa74('0x9d')][_0xfa74('0x10c')](db[_0xfa74('0x9f')],{'as':'Configurations','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db['SugarcrmConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0xa1')],{'as':_0xfa74('0x1b3'),'onDelete':'cascade','foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0x9f')][_0xfa74('0x10c')](db[_0xfa74('0xa1')],{'as':_0xfa74('0x1ae'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0x9f')][_0xfa74('0x10c')](db[_0xfa74('0xa1')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xfa74('0x9f')][_0xfa74('0x118')](db[_0xfa74('0x9d')],{'as':_0xfa74('0x161'),'foreignKey':'AccountId'});db[_0xfa74('0xa1')][_0xfa74('0x10c')](db['SugarcrmField'],{'as':_0xfa74('0x1b1'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xa1')]['hasMany'](db['SugarcrmField'],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xa1')][_0xfa74('0x10c')](db[_0xfa74('0xa1')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xa1')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0x1b6')]['hasMany'](db[_0xfa74('0xa4')],{'as':_0xfa74('0x1aa'),'onDelete':'cascade','foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xa4')][_0xfa74('0x10c')](db['DeskField'],{'as':_0xfa74('0x1b3'),'onDelete':_0xfa74('0x10a'),'foreignKey':'SubjectId'});db[_0xfa74('0xa4')][_0xfa74('0x10c')](db[_0xfa74('0x1b7')],{'as':_0xfa74('0x1ae'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0x1b7')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xa4')][_0xfa74('0x118')](db[_0xfa74('0x1b6')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db['DeskConfiguration'][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x1b8')});db[_0xfa74('0x1b7')][_0xfa74('0x10c')](db[_0xfa74('0x1b7')],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0x1b7')][_0xfa74('0x10c')](db['DeskField'],{'as':'Description','foreignKey':_0xfa74('0x1af')});db['DeskField']['hasMany'](db[_0xfa74('0x1b7')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0x1b7')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':'VariableId'});db[_0xfa74('0xa6')][_0xfa74('0x10c')](db[_0xfa74('0xa8')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xa8')][_0xfa74('0x10c')](db['ZohoField'],{'as':_0xfa74('0x1b3'),'onDelete':_0xfa74('0x10a'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0xaa')],{'as':_0xfa74('0x1ae'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xfa74('0xa8')][_0xfa74('0x10c')](db[_0xfa74('0xaa')],{'as':_0xfa74('0x1a7'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1b0')});db['ZohoConfiguration'][_0xfa74('0x118')](db[_0xfa74('0xa6')],{'as':_0xfa74('0x161'),'foreignKey':'AccountId'});db['ZohoField']['hasMany'](db[_0xfa74('0xaa')],{'as':_0xfa74('0x1b1'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xaa')][_0xfa74('0x10c')](db['ZohoField'],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xaa')]['hasMany'](db[_0xfa74('0xaa')],{'as':'Field','foreignKey':'FieldId'});db[_0xfa74('0xaa')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0x1b9')][_0xfa74('0x10c')](db[_0xfa74('0xab')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':'AccountId'});db[_0xfa74('0xab')][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':_0xfa74('0x1b3'),'foreignKey':'SubjectId'});db[_0xfa74('0xab')][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':_0xfa74('0x1ae'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':_0xfa74('0x1a7'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xab')][_0xfa74('0x118')](db['ZendeskAccount'],{'as':_0xfa74('0x161'),'foreignKey':'AccountId'});db[_0xfa74('0xab')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0x1ba')][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0x1ba')][_0xfa74('0x10c')](db[_0xfa74('0x1ba')],{'as':'Field','foreignKey':'FieldId'});db['ZendeskField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xfa74('0x1b5')});db['FreshdeskAccount'][_0xfa74('0x10c')](db['FreshdeskConfiguration'],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xfa74('0x10c')](db['FreshdeskField'],{'as':_0xfa74('0x1b3'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xfa74('0xae')][_0xfa74('0x10c')](db[_0xfa74('0x1bb')],{'as':_0xfa74('0x1ae'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xfa74('0xae')][_0xfa74('0x10c')](db[_0xfa74('0x1bb')],{'as':_0xfa74('0x1a7'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1b0')});db['FreshdeskConfiguration'][_0xfa74('0x118')](db['FreshdeskAccount'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db['FreshdeskConfiguration'][_0xfa74('0x119')](db['Tag'],{'through':_0xfa74('0x1bc')});db['FreshdeskField'][_0xfa74('0x10c')](db['FreshdeskField'],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0xfa74('0x10c')](db[_0xfa74('0x1bb')],{'as':'Description','foreignKey':_0xfa74('0x1af')});db['FreshdeskField'][_0xfa74('0x10c')](db[_0xfa74('0x1bb')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db['FreshdeskField']['belongsTo'](db[_0xfa74('0x8b')],{'as':'Variable','foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0xb1')][_0xfa74('0x10c')](db[_0xfa74('0x1bd')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0x1bd')][_0xfa74('0x10c')](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1b3'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0x1bd')][_0xfa74('0x10c')](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1ae'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0x1bd')][_0xfa74('0x10c')](db['VtigerField'],{'as':_0xfa74('0x1a7'),'foreignKey':_0xfa74('0x1b0')});db['VtigerConfiguration'][_0xfa74('0x118')](db[_0xfa74('0xb1')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xb3')]['hasMany'](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0xb3')][_0xfa74('0x10c')](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xb3')][_0xfa74('0x10c')](db[_0xfa74('0xb3')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xb3')][_0xfa74('0x118')](db['Variable'],{'as':'Variable','foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0xb5')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db['ServicenowConfiguration'][_0xfa74('0x10c')](db[_0xfa74('0xb9')],{'as':_0xfa74('0x1b3'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xb7')][_0xfa74('0x10c')](db['ServicenowField'],{'as':_0xfa74('0x1ae'),'foreignKey':'DescriptionId'});db[_0xfa74('0xb7')][_0xfa74('0x10c')](db[_0xfa74('0xb9')],{'as':_0xfa74('0x1a7'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xb7')][_0xfa74('0x118')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xb9')][_0xfa74('0x10c')](db[_0xfa74('0xb9')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xfa74('0xb9')][_0xfa74('0x10c')](db[_0xfa74('0xb9')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xb9')]['hasMany'](db[_0xfa74('0xb9')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xb9')][_0xfa74('0x118')](db[_0xfa74('0x8b')],{'as':'Variable','foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0xbb')]['hasMany'](db[_0xfa74('0xbd')],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':'AccountId'});db['Dynamics365Configuration'][_0xfa74('0x10c')](db['Dynamics365Field'],{'as':_0xfa74('0x1b3'),'onDelete':_0xfa74('0x10a'),'foreignKey':'SubjectId'});db[_0xfa74('0xbd')][_0xfa74('0x10c')](db[_0xfa74('0xbf')],{'as':_0xfa74('0x1ae'),'onDelete':'cascade','foreignKey':_0xfa74('0x1af')});db['Dynamics365Configuration'][_0xfa74('0x10c')](db[_0xfa74('0xbf')],{'as':_0xfa74('0x1a7'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1b0')});db['Dynamics365Configuration'][_0xfa74('0x118')](db['Dynamics365Account'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xbf')]['hasMany'](db[_0xfa74('0xbf')],{'as':_0xfa74('0x1b1'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xbf')][_0xfa74('0x10c')](db['Dynamics365Field'],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xbf')]['hasMany'](db[_0xfa74('0xbf')],{'as':_0xfa74('0x1b4'),'foreignKey':_0xfa74('0x1b0')});db[_0xfa74('0xbf')]['belongsTo'](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':_0xfa74('0x1b5')});db[_0xfa74('0xc0')][_0xfa74('0x10c')](db['FreshsalesConfiguration'],{'as':_0xfa74('0x1aa'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1ab')});db[_0xfa74('0xc2')]['hasMany'](db['FreshsalesField'],{'as':_0xfa74('0x1b3'),'foreignKey':_0xfa74('0x1ad')});db[_0xfa74('0xc2')][_0xfa74('0x10c')](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1ae'),'foreignKey':'DescriptionId'});db[_0xfa74('0xc2')]['hasMany'](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1a7'),'foreignKey':_0xfa74('0x1b0')});db['FreshsalesConfiguration'][_0xfa74('0x118')](db[_0xfa74('0xc0')],{'as':'Account','foreignKey':_0xfa74('0x1ab')});db['FreshsalesField'][_0xfa74('0x10c')](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1b1'),'foreignKey':'SubjectId'});db[_0xfa74('0xc3')][_0xfa74('0x10c')](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1b2'),'foreignKey':_0xfa74('0x1af')});db[_0xfa74('0xc3')][_0xfa74('0x10c')](db[_0xfa74('0xc3')],{'as':_0xfa74('0x1b4'),'foreignKey':'FieldId'});db[_0xfa74('0xc3')]['belongsTo'](db[_0xfa74('0x8b')],{'as':_0xfa74('0x8b'),'foreignKey':_0xfa74('0x1b5')});db['ChatQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x12b')],{});db['ChatQueueReport'][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xc6')]['belongsTo'](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db['ChatQueueReport'][_0xfa74('0x118')](db['ChatInteraction'],{});db[_0xfa74('0xc6')][_0xfa74('0x118')](db[_0xfa74('0x182')],{});db[_0xfa74('0xc6')]['belongsTo'](db[_0xfa74('0x10')],{});db['ChatQueueReport']['belongsTo'](db[_0xfa74('0x66')],{});db['ChatInternalMessage'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1be')});db['ChatInternalMessage'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x10a'),'foreignKey':'ToId'});db[_0xfa74('0xcb')][_0xfa74('0x10c')](db[_0xfa74('0xc9')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xfa74('0xcb')][_0xfa74('0x10c')](db[_0xfa74('0xc8')],{'foreignKey':_0xfa74('0x1bf'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0x1c0')][_0xfa74('0x118')](db[_0xfa74('0x134')],{});db[_0xfa74('0x1c0')][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0x1c0')]['belongsTo'](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':'ContactId'});db['SmsQueueReport'][_0xfa74('0x118')](db[_0xfa74('0x176')],{});db[_0xfa74('0x1c0')][_0xfa74('0x118')](db['SmsMessage'],{});db[_0xfa74('0x1c0')][_0xfa74('0x118')](db['User'],{});db[_0xfa74('0x1c0')]['belongsTo'](db[_0xfa74('0x56')],{});db[_0xfa74('0xd1')][_0xfa74('0x10c')](db[_0xfa74('0xcb')],{'foreignKey':_0xfa74('0x1c1')});db[_0xfa74('0xd1')][_0xfa74('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xfa74('0xd1')]['hasMany'](db[_0xfa74('0xc8')],{'foreignKey':_0xfa74('0x1c1')});db[_0xfa74('0xd4')]['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x136')});db['Team']['belongsToMany'](db['User'],{'as':_0xfa74('0x145'),'through':_0xfa74('0x11e')});db[_0xfa74('0x15e')][_0xfa74('0x119')](db['VoiceQueue'],{'through':_0xfa74('0x103'),'as':_0xfa74('0x125')});db[_0xfa74('0x15e')]['belongsToMany'](db[_0xfa74('0x3b')],{'through':_0xfa74('0x15f'),'as':_0xfa74('0x1c2')});db[_0xfa74('0x15e')]['belongsToMany'](db[_0xfa74('0x66')],{'through':'team_has_chat_queues','as':_0xfa74('0x1c3')});db['Team']['belongsToMany'](db[_0xfa74('0x4d')],{'through':_0xfa74('0x174'),'as':_0xfa74('0x1c4')});db[_0xfa74('0x15e')][_0xfa74('0x119')](db[_0xfa74('0x56')],{'through':_0xfa74('0x17a'),'as':_0xfa74('0x1c5')});db['Team'][_0xfa74('0x119')](db['OpenchannelQueue'],{'through':_0xfa74('0x1c6'),'as':_0xfa74('0x128')});db['Team'][_0xfa74('0x119')](db[_0xfa74('0xff')],{'through':_0xfa74('0x1c7'),'as':'WhatsappQueues'});db[_0xfa74('0x15e')][_0xfa74('0x119')](db[_0xfa74('0xeb')],{'through':'TeamVoicePrefix','as':_0xfa74('0x126')});db[_0xfa74('0xdd')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xfa74('0x18f')});db[_0xfa74('0xdd')][_0xfa74('0x10c')](db[_0xfa74('0x6f')],{'as':_0xfa74('0x10f'),'foreignKey':'CampaignId'});db[_0xfa74('0xdd')][_0xfa74('0x10c')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0xfa74('0xdd')][_0xfa74('0x10c')](db[_0xfa74('0x13e')],{'as':_0xfa74('0x13f'),'foreignKey':_0xfa74('0x18f')});db[_0xfa74('0xdd')][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x141'),'foreignKey':_0xfa74('0x1c8')});db['Campaign'][_0xfa74('0x118')](db[_0xfa74('0x141')],{'as':_0xfa74('0x142'),'foreignKey':_0xfa74('0x1c9')});db[_0xfa74('0xdd')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'as':_0xfa74('0x7d'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0xdd')][_0xfa74('0x118')](db[_0xfa74('0xd4')],{'as':_0xfa74('0xd4'),'foreignKey':_0xfa74('0x1ca')});db[_0xfa74('0xdd')][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xfa74('0xdd')][_0xfa74('0x119')](db[_0xfa74('0xe9')],{'as':_0xfa74('0x147'),'through':_0xfa74('0x1cb')});db[_0xfa74('0x172')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0xfa74('0x166'),'foreignKey':_0xfa74('0x167')});db['MailTransferReport'][_0xfa74('0x118')](db[_0xfa74('0x3f')],{});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x114')],{});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'foreignKey':_0xfa74('0x1cc'),'as':_0xfa74('0x1cd')});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'foreignKey':'FromUserId','as':_0xfa74('0x1ce')});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'foreignKey':'ToUserId','as':_0xfa74('0x1cf')});db['MailTransferReport'][_0xfa74('0x118')](db[_0xfa74('0x3b')],{'foreignKey':_0xfa74('0x1d0'),'as':_0xfa74('0x1d1')});db[_0xfa74('0xe2')][_0xfa74('0x118')](db[_0xfa74('0x12f')],{'foreignKey':_0xfa74('0x1d2'),'as':_0xfa74('0x1d3')});db[_0xfa74('0xe4')][_0xfa74('0x118')](db[_0xfa74('0x182')],{});db[_0xfa74('0xe4')][_0xfa74('0x118')](db[_0xfa74('0x64')],{});db[_0xfa74('0xe4')]['belongsTo'](db[_0xfa74('0x12b')],{'foreignKey':_0xfa74('0x1d4'),'as':_0xfa74('0x1cd')});db[_0xfa74('0xe4')][_0xfa74('0x118')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xfa74('0xe4')]['belongsTo'](db[_0xfa74('0x10')],{'foreignKey':_0xfa74('0x1d5'),'as':'ToAgent'});db['ChatTransferReport'][_0xfa74('0x118')](db[_0xfa74('0x66')],{'foreignKey':_0xfa74('0x1d6'),'as':_0xfa74('0x1d1')});db[_0xfa74('0xe4')][_0xfa74('0x118')](db['ChatWebsite'],{'foreignKey':_0xfa74('0x1d7'),'as':_0xfa74('0x1d3')});db[_0xfa74('0xe6')]['belongsTo'](db[_0xfa74('0x4b')],{});db[_0xfa74('0xe6')][_0xfa74('0x118')](db[_0xfa74('0x4a')],{});db[_0xfa74('0xe6')][_0xfa74('0x118')](db[_0xfa74('0x46')],{'foreignKey':_0xfa74('0x1d8'),'as':_0xfa74('0x1cd')});db[_0xfa74('0xe6')][_0xfa74('0x118')](db['User'],{'foreignKey':_0xfa74('0x1d9'),'as':_0xfa74('0x1ce')});db[_0xfa74('0xe6')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'foreignKey':'ToUserId','as':_0xfa74('0x1cf')});db['FaxTransferReport'][_0xfa74('0x118')](db[_0xfa74('0x4d')],{'foreignKey':'ToFaxQueueId','as':_0xfa74('0x1d1')});db[_0xfa74('0xe6')]['belongsTo'](db[_0xfa74('0x46')],{'foreignKey':_0xfa74('0x1da'),'as':'ToAccount'});db[_0xfa74('0xe7')]['belongsTo'](db[_0xfa74('0x5e')],{});db[_0xfa74('0xe7')][_0xfa74('0x118')](db[_0xfa74('0x5c')],{});db[_0xfa74('0xe7')][_0xfa74('0x118')](db[_0xfa74('0x58')],{'foreignKey':_0xfa74('0x1db'),'as':'FromAccount'});db[_0xfa74('0xe7')][_0xfa74('0x118')](db['User'],{'foreignKey':_0xfa74('0x1d9'),'as':_0xfa74('0x1ce')});db[_0xfa74('0xe7')]['belongsTo'](db[_0xfa74('0x10')],{'foreignKey':_0xfa74('0x1d5'),'as':_0xfa74('0x1cf')});db[_0xfa74('0xe7')][_0xfa74('0x118')](db[_0xfa74('0x5f')],{'foreignKey':_0xfa74('0x1dc'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0xfa74('0x118')](db['OpenchannelAccount'],{'foreignKey':_0xfa74('0x1dd'),'as':_0xfa74('0x1d3')});db[_0xfa74('0xe8')]['belongsTo'](db[_0xfa74('0x54')],{});db[_0xfa74('0xe8')][_0xfa74('0x118')](db[_0xfa74('0x176')],{});db[_0xfa74('0xe8')][_0xfa74('0x118')](db[_0xfa74('0x134')],{'foreignKey':_0xfa74('0x1de'),'as':_0xfa74('0x1cd')});db[_0xfa74('0xe8')][_0xfa74('0x118')](db['User'],{'foreignKey':_0xfa74('0x1d9'),'as':_0xfa74('0x1ce')});db[_0xfa74('0xe8')]['belongsTo'](db[_0xfa74('0x10')],{'foreignKey':'ToUserId','as':_0xfa74('0x1cf')});db[_0xfa74('0xe8')]['belongsTo'](db[_0xfa74('0x56')],{'foreignKey':_0xfa74('0x1df'),'as':'ToQueue'});db[_0xfa74('0xe8')][_0xfa74('0x118')](db[_0xfa74('0x134')],{'foreignKey':'ToSmsAccountId','as':_0xfa74('0x1d3')});db['CmList'][_0xfa74('0x10c')](db['Disposition'],{'as':_0xfa74('0x156'),'foreignKey':_0xfa74('0x15a'),'onDelete':'cascade'});db[_0xfa74('0xe9')][_0xfa74('0x10c')](db[_0xfa74('0x73')],{'as':_0xfa74('0x1e0'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xe9')][_0xfa74('0x10c')](db['CmContact'],{'as':'Contacts','onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x15a')});db['CmList'][_0xfa74('0x10c')](db[_0xfa74('0x6f')],{'as':'HopperFinals','foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xe9')][_0xfa74('0x10c')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xe9')][_0xfa74('0x10c')](db['ReportAgentPreview'],{'as':_0xfa74('0x72'),'foreignKey':_0xfa74('0x15a')});db['CmList'][_0xfa74('0x119')](db['VoiceQueue'],{'as':_0xfa74('0x1e1'),'through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x11d')});db[_0xfa74('0xeb')][_0xfa74('0x10c')](db[_0xfa74('0x17')],{'as':_0xfa74('0x10e'),'onDelete':'cascade'});db[_0xfa74('0xeb')][_0xfa74('0x119')](db['User'],{'as':_0xfa74('0x145'),'through':_0xfa74('0x107')});db[_0xfa74('0xeb')]['belongsToMany'](db[_0xfa74('0x15e')],{'through':_0xfa74('0x105'),'as':_0xfa74('0x146')});db[_0xfa74('0xed')][_0xfa74('0x10c')](db[_0xfa74('0x10')],{'as':'Users','foreignKey':_0xfa74('0x1e2')});db['UserProfile'][_0xfa74('0x10c')](db[_0xfa74('0xef')],{'as':_0xfa74('0x1e3'),'foreignKey':'userProfileId','onDelete':_0xfa74('0x10a')});db['UserProfileSection'][_0xfa74('0x10c')](db[_0xfa74('0xf1')],{'as':'Resources','foreignKey':_0xfa74('0x1e4'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xfa74('0x1e5'),'onDelete':_0xfa74('0x10a')});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db[_0xfa74('0x79')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db['WhatsappMessage'],{'as':_0xfa74('0x149'),'foreignKey':_0xfa74('0x1e5')});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db[_0xfa74('0xf9')],{'as':'Interactions'});db[_0xfa74('0xf5')][_0xfa74('0x10c')](db[_0xfa74('0xf7')],{'as':'Applications'});db[_0xfa74('0xf5')][_0xfa74('0x118')](db['CmList'],{'as':_0xfa74('0x159'),'foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xf5')][_0xfa74('0x118')](db['Pause'],{'as':_0xfa74('0x15c'),'foreignKey':_0xfa74('0x15d')});db['WhatsappAccount'][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x145'),'through':_0xfa74('0x1e6')});db['WhatsappApplication'][_0xfa74('0x118')](db[_0xfa74('0x10')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0xf7')][_0xfa74('0x118')](db[_0xfa74('0xff')],{'onDelete':'restrict'});db[_0xfa74('0xf7')][_0xfa74('0x118')](db[_0xfa74('0xf5')],{'onDelete':_0xfa74('0x168')});db[_0xfa74('0xf7')][_0xfa74('0x118')](db[_0xfa74('0x7d')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x169')});db[_0xfa74('0xf7')]['belongsTo'](db[_0xfa74('0x86')],{'onDelete':_0xfa74('0x168'),'foreignKey':_0xfa74('0x16a')});db['WhatsappInteraction'][_0xfa74('0x10c')](db[_0xfa74('0x1e7')],{'as':_0xfa74('0x149'),'onDelete':_0xfa74('0x10a'),'foreignKey':_0xfa74('0x1e8')});db[_0xfa74('0xf9')][_0xfa74('0x118')](db['WhatsappAccount'],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1e5')});db[_0xfa74('0xf9')][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'as':_0xfa74('0x150'),'foreignKey':_0xfa74('0x151')});db[_0xfa74('0xf9')]['belongsTo'](db[_0xfa74('0x10')],{'as':_0xfa74('0x17f'),'foreignKey':_0xfa74('0x10b')});db['WhatsappInteraction'][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':_0xfa74('0x19d'),'as':_0xfa74('0x163')});db[_0xfa74('0xf9')][_0xfa74('0x119')](db[_0xfa74('0x86')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xfa74('0xf9')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':_0xfa74('0x170'),'through':_0xfa74('0x124'),'foreignKey':_0xfa74('0x1e8')});db[_0xfa74('0x1e7')][_0xfa74('0x118')](db[_0xfa74('0x10')],{'as':_0xfa74('0x10')});db[_0xfa74('0x1e7')][_0xfa74('0x118')](db[_0xfa74('0x6c')],{'onDelete':'cascade','as':_0xfa74('0x150')});db[_0xfa74('0x1e7')][_0xfa74('0x118')](db[_0xfa74('0xf9')],{'onDelete':_0xfa74('0x10a'),'as':_0xfa74('0x164'),'foreignKey':_0xfa74('0x1e8')});db['WhatsappMessage']['belongsTo'](db[_0xfa74('0xf5')],{'as':_0xfa74('0x161'),'foreignKey':_0xfa74('0x1e5')});db[_0xfa74('0xfc')][_0xfa74('0x118')](db[_0xfa74('0xf5')],{});db['WhatsappQueueReport'][_0xfa74('0x118')](db[_0xfa74('0xe9')],{'as':'List','foreignKey':_0xfa74('0x15a')});db[_0xfa74('0xfc')]['belongsTo'](db[_0xfa74('0x6c')],{'as':'Contact','foreignKey':_0xfa74('0x151')});db[_0xfa74('0xfc')][_0xfa74('0x118')](db[_0xfa74('0xf9')],{});db[_0xfa74('0xfc')][_0xfa74('0x118')](db['WhatsappQueue'],{});db[_0xfa74('0xfc')][_0xfa74('0x118')](db[_0xfa74('0x1e7')],{});db[_0xfa74('0xfc')][_0xfa74('0x118')](db[_0xfa74('0x10')],{});db[_0xfa74('0xfe')][_0xfa74('0x118')](db[_0xfa74('0x1e7')],{});db[_0xfa74('0xfe')][_0xfa74('0x118')](db[_0xfa74('0xf9')],{});db['WhatsappTransferReport'][_0xfa74('0x118')](db[_0xfa74('0xf5')],{'foreignKey':'FromWhatsappAccountId','as':_0xfa74('0x1cd')});db[_0xfa74('0xfe')][_0xfa74('0x118')](db[_0xfa74('0xf5')],{'foreignKey':_0xfa74('0x1e9'),'as':'ToAccount'});db[_0xfa74('0xfe')][_0xfa74('0x118')](db[_0xfa74('0xff')],{'foreignKey':_0xfa74('0x1ea'),'as':_0xfa74('0x1d1')});db[_0xfa74('0xfe')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0xfa74('0x1ce')});db[_0xfa74('0xfe')]['belongsTo'](db['User'],{'foreignKey':_0xfa74('0x1d5'),'as':_0xfa74('0x1cf')});db[_0xfa74('0xff')][_0xfa74('0x119')](db[_0xfa74('0x10')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db['WhatsappQueue']['belongsToMany'](db[_0xfa74('0x15e')],{'through':_0xfa74('0x1c7'),'as':_0xfa74('0x146')});module[_0xfa74('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 587ef38..5168e69 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5203=['/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/fields','/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/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/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/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/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/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/rpc','/api/version','./api/system','/api/pm2','/api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','username','password','newPassword','apiKey','lastName','street','mobile','clientId','code','token','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','exten','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','@@{','}@@','includes','lodash','path','express','util','./config/logger','api','auth','./safe-template','safeTemplate','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','name','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0x5203,0xd3));var _0x3520=function(_0x1b8653,_0xa77a4e){_0x1b8653=_0x1b8653-0x0;var _0x4b867e=_0x5203[_0x1b8653];return _0x4b867e;};'use strict';var _=require(_0x3520('0x0'));var path=require(_0x3520('0x1'));var express=require(_0x3520('0x2'));var ewinston=require('express-winston');var util=require(_0x3520('0x3'));var errors=require('./errors');var config=require('./config/environment');var logger=require(_0x3520('0x4'))(_0x3520('0x5'));var authLogger=require(_0x3520('0x4'))(_0x3520('0x6'));var safeTemplate=require(_0x3520('0x7'))[_0x3520('0x8')];exports[_0x3520('0x9')]=function(_0x4cb627){_0x4cb627[_0x3520('0xa')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3ad9e4,_0x336612){var _0x33b89f=_0x3520('0xb');if(!_[_0x3520('0xc')](_0x3ad9e4[_0x3520('0xd')])){_0x33b89f+='\x20body=%s';var _0x157081=_0x3ad9e4[_0x3520('0xd')];maskSensitiveData(_0x157081);}return safeTemplate(util[_0x3520('0xe')](_0x33b89f,_0x3ad9e4['method'],_0x3ad9e4[_0x3520('0xf')]['x-forwarded-for']?_0x3ad9e4[_0x3520('0xf')][_0x3520('0x10')]:_0x3ad9e4[_0x3520('0x11')][_0x3520('0x12')]||_0x3ad9e4['ip'],_0x3ad9e4[_0x3520('0x13')],_0x336612[_0x3520('0x14')],_0x336612[_0x3520('0x15')],_0x3ad9e4['user']?_0x3ad9e4[_0x3520('0x16')]['id']:null,_0x3ad9e4[_0x3520('0x16')]?_0x3ad9e4['user']['name']:null,_0x3ad9e4['user']?_0x3ad9e4[_0x3520('0x16')][_0x3520('0x17')]:null,_0x157081?util[_0x3520('0x18')](_0x157081,![],null):''));}}));_0x4cb627[_0x3520('0xa')](ewinston[_0x3520('0x19')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3c7a38,_0x11f41a){var _0x5156b7=_0x3520('0x1a');if(_0x3c7a38[_0x3520('0xd')]&&_0x3c7a38['body'][_0x3520('0x1b')]&&_0x3c7a38['body'][_0x3520('0x1c')]){_0x5156b7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3520('0xe')](_0x5156b7,_0x3c7a38['method'],_0x3c7a38[_0x3520('0xf')][_0x3520('0x10')]?_0x3c7a38[_0x3520('0xf')]['x-forwarded-for']:_0x3c7a38[_0x3520('0x11')][_0x3520('0x12')]||_0x3c7a38['ip'],_0x3c7a38['url'],_0x11f41a[_0x3520('0x14')],_0x11f41a[_0x3520('0x15')],_0x3c7a38['user']?_0x3c7a38['user']['id']:null,_0x3c7a38[_0x3520('0x16')]?_0x3c7a38[_0x3520('0x16')][_0x3520('0x1d')]:null,_0x3c7a38['user']?_0x3c7a38[_0x3520('0x16')][_0x3520('0x17')]:null,_0x3c7a38[_0x3520('0xd')]&&_0x3c7a38[_0x3520('0xd')][_0x3520('0x1b')]?_0x3c7a38[_0x3520('0xd')][_0x3520('0x1b')]:_0x3520('0x1e'),_0x3c7a38[_0x3520('0xd')]&&_0x3c7a38['body'][_0x3520('0x1c')]?_0x3c7a38[_0x3520('0xd')][_0x3520('0x1c')]:'',_0x3c7a38['body']&&_0x3c7a38[_0x3520('0xd')]['agent_name']?_0x3c7a38[_0x3520('0xd')][_0x3520('0x1f')]:'');},'ignoreRoute':function(_0xf09dfe){var _0x149bd1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x149bd1[_0x3520('0x20')](_0xf09dfe[_0x3520('0x13')]);}}));_0x4cb627['use'](_0x3520('0x21'),require(_0x3520('0x22')));_0x4cb627['use'](_0x3520('0x23'),require(_0x3520('0x24')));_0x4cb627[_0x3520('0xa')](_0x3520('0x25'),require(_0x3520('0x26')));_0x4cb627[_0x3520('0xa')](_0x3520('0x27'),require(_0x3520('0x28')));_0x4cb627[_0x3520('0xa')](_0x3520('0x29'),require(_0x3520('0x2a')));_0x4cb627[_0x3520('0xa')]('/api/voice/queues',require(_0x3520('0x2b')));_0x4cb627[_0x3520('0xa')](_0x3520('0x2c'),require(_0x3520('0x2d')));_0x4cb627[_0x3520('0xa')](_0x3520('0x2e'),require(_0x3520('0x2f')));_0x4cb627['use']('/api/voice/mails',require(_0x3520('0x30')));_0x4cb627['use'](_0x3520('0x31'),require(_0x3520('0x32')));_0x4cb627[_0x3520('0xa')](_0x3520('0x33'),require(_0x3520('0x34')));_0x4cb627[_0x3520('0xa')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x4cb627['use']('/api/voice/agents/reports',require(_0x3520('0x35')));_0x4cb627['use'](_0x3520('0x36'),require('./api/voiceQueueReport'));_0x4cb627[_0x3520('0xa')]('/api/members/reports',require(_0x3520('0x37')));_0x4cb627[_0x3520('0xa')](_0x3520('0x38'),require(_0x3520('0x39')));_0x4cb627['use']('/api/voice/transfers/reports',require(_0x3520('0x3a')));_0x4cb627['use'](_0x3520('0x3b'),require('./api/mailServerOut'));_0x4cb627[_0x3520('0xa')](_0x3520('0x3c'),require(_0x3520('0x3d')));_0x4cb627[_0x3520('0xa')](_0x3520('0x3e'),require(_0x3520('0x3f')));_0x4cb627[_0x3520('0xa')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x4cb627[_0x3520('0xa')](_0x3520('0x40'),require(_0x3520('0x41')));_0x4cb627['use']('/api/mail/messages',require(_0x3520('0x42')));_0x4cb627[_0x3520('0xa')](_0x3520('0x43'),require(_0x3520('0x44')));_0x4cb627[_0x3520('0xa')]('/api/mail/reports/queue',require(_0x3520('0x45')));_0x4cb627['use'](_0x3520('0x46'),require(_0x3520('0x47')));_0x4cb627[_0x3520('0xa')](_0x3520('0x48'),require('./api/dashboardItem'));_0x4cb627[_0x3520('0xa')](_0x3520('0x49'),require(_0x3520('0x4a')));_0x4cb627[_0x3520('0xa')](_0x3520('0x4b'),require(_0x3520('0x4c')));_0x4cb627[_0x3520('0xa')](_0x3520('0x4d'),require(_0x3520('0x4e')));_0x4cb627[_0x3520('0xa')]('/api/fax/messages',require(_0x3520('0x4f')));_0x4cb627[_0x3520('0xa')](_0x3520('0x50'),require(_0x3520('0x51')));_0x4cb627[_0x3520('0xa')](_0x3520('0x52'),require(_0x3520('0x53')));_0x4cb627['use'](_0x3520('0x54'),require('./api/smsAccount'));_0x4cb627['use']('/api/sms/applications',require('./api/smsApplication'));_0x4cb627[_0x3520('0xa')](_0x3520('0x55'),require(_0x3520('0x56')));_0x4cb627[_0x3520('0xa')](_0x3520('0x57'),require('./api/smsMessage'));_0x4cb627[_0x3520('0xa')](_0x3520('0x58'),require(_0x3520('0x59')));_0x4cb627[_0x3520('0xa')]('/api/openchannel/accounts',require(_0x3520('0x5a')));_0x4cb627[_0x3520('0xa')](_0x3520('0x5b'),require('./api/openchannelApplication'));_0x4cb627[_0x3520('0xa')](_0x3520('0x5c'),require(_0x3520('0x5d')));_0x4cb627[_0x3520('0xa')](_0x3520('0x5e'),require(_0x3520('0x5f')));_0x4cb627[_0x3520('0xa')](_0x3520('0x60'),require(_0x3520('0x61')));_0x4cb627['use']('/api/chat/websites',require('./api/chatWebsite'));_0x4cb627[_0x3520('0xa')](_0x3520('0x62'),require('./api/openchannelQueueReport'));_0x4cb627[_0x3520('0xa')]('/api/chat/applications',require(_0x3520('0x63')));_0x4cb627[_0x3520('0xa')](_0x3520('0x64'),require('./api/chatInteraction'));_0x4cb627[_0x3520('0xa')](_0x3520('0x65'),require(_0x3520('0x66')));_0x4cb627[_0x3520('0xa')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x4cb627[_0x3520('0xa')](_0x3520('0x67'),require('./api/chatQueue'));_0x4cb627[_0x3520('0xa')](_0x3520('0x68'),require(_0x3520('0x69')));_0x4cb627[_0x3520('0xa')](_0x3520('0x6a'),require(_0x3520('0x6b')));_0x4cb627['use']('/api/cm/companies',require(_0x3520('0x6c')));_0x4cb627[_0x3520('0xa')]('/api/cm/contacts',require('./api/cmContact'));_0x4cb627[_0x3520('0xa')](_0x3520('0x6d'),require('./api/cmHopper'));_0x4cb627[_0x3520('0xa')](_0x3520('0x6e'),require(_0x3520('0x6f')));_0x4cb627[_0x3520('0xa')](_0x3520('0x70'),require(_0x3520('0x71')));_0x4cb627['use'](_0x3520('0x72'),require('./api/cmHopperHistory'));_0x4cb627[_0x3520('0xa')](_0x3520('0x73'),require(_0x3520('0x74')));_0x4cb627[_0x3520('0xa')](_0x3520('0x75'),require(_0x3520('0x76')));_0x4cb627[_0x3520('0xa')](_0x3520('0x77'),require(_0x3520('0x78')));_0x4cb627['use'](_0x3520('0x79'),require(_0x3520('0x7a')));_0x4cb627['use']('/api/dispositions',require(_0x3520('0x7b')));_0x4cb627['use'](_0x3520('0x7c'),require(_0x3520('0x7d')));_0x4cb627[_0x3520('0xa')]('/api/intervals',require(_0x3520('0x7e')));_0x4cb627['use'](_0x3520('0x7f'),require('./api/pause'));_0x4cb627[_0x3520('0xa')](_0x3520('0x80'),require(_0x3520('0x81')));_0x4cb627[_0x3520('0xa')]('/api/voiceQueuesLog',require(_0x3520('0x82')));_0x4cb627[_0x3520('0xa')](_0x3520('0x83'),require(_0x3520('0x84')));_0x4cb627[_0x3520('0xa')](_0x3520('0x85'),require(_0x3520('0x86')));_0x4cb627[_0x3520('0xa')](_0x3520('0x87'),require(_0x3520('0x88')));_0x4cb627['use'](_0x3520('0x89'),require(_0x3520('0x8a')));_0x4cb627['use']('/api/triggers',require('./api/trigger'));_0x4cb627[_0x3520('0xa')](_0x3520('0x8b'),require(_0x3520('0x8c')));_0x4cb627[_0x3520('0xa')](_0x3520('0x8d'),require(_0x3520('0x8e')));_0x4cb627['use'](_0x3520('0x8f'),require(_0x3520('0x90')));_0x4cb627[_0x3520('0xa')]('/api/analytics/custom_reports',require(_0x3520('0x91')));_0x4cb627[_0x3520('0xa')](_0x3520('0x92'),require('./api/analyticDefaultReport'));_0x4cb627[_0x3520('0xa')](_0x3520('0x93'),require('./api/analyticExtractedReport'));_0x4cb627[_0x3520('0xa')](_0x3520('0x94'),require('./api/analyticMetric'));_0x4cb627[_0x3520('0xa')](_0x3520('0x95'),require('./api/analyticFieldReport'));_0x4cb627[_0x3520('0xa')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x4cb627['use'](_0x3520('0x96'),require('./api/intSalesforceAccount'));_0x4cb627[_0x3520('0xa')](_0x3520('0x97'),require(_0x3520('0x98')));_0x4cb627[_0x3520('0xa')](_0x3520('0x99'),require(_0x3520('0x9a')));_0x4cb627[_0x3520('0xa')](_0x3520('0x9b'),require(_0x3520('0x9c')));_0x4cb627['use'](_0x3520('0x9d'),require(_0x3520('0x9e')));_0x4cb627[_0x3520('0xa')](_0x3520('0x9f'),require(_0x3520('0xa0')));_0x4cb627['use'](_0x3520('0xa1'),require(_0x3520('0xa2')));_0x4cb627[_0x3520('0xa')](_0x3520('0xa3'),require(_0x3520('0xa4')));_0x4cb627[_0x3520('0xa')]('/api/integrations/desk/fields',require(_0x3520('0xa5')));_0x4cb627[_0x3520('0xa')]('/api/integrations/zoho/accounts',require(_0x3520('0xa6')));_0x4cb627['use'](_0x3520('0xa7'),require('./api/intZohoConfiguration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xa8'),require(_0x3520('0xa9')));_0x4cb627[_0x3520('0xa')]('/api/integrations/zendesk/accounts',require(_0x3520('0xaa')));_0x4cb627['use'](_0x3520('0xab'),require(_0x3520('0xac')));_0x4cb627['use'](_0x3520('0xad'),require(_0x3520('0xae')));_0x4cb627[_0x3520('0xa')](_0x3520('0xaf'),require(_0x3520('0xb0')));_0x4cb627[_0x3520('0xa')](_0x3520('0xb1'),require('./api/intFreshdeskConfiguration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xb2'),require(_0x3520('0xb3')));_0x4cb627['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x4cb627[_0x3520('0xa')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xb4'),require('./api/intVtigerField'));_0x4cb627[_0x3520('0xa')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x4cb627[_0x3520('0xa')](_0x3520('0xb5'),require('./api/intServicenowConfiguration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xb6'),require(_0x3520('0xb7')));_0x4cb627['use'](_0x3520('0xb8'),require(_0x3520('0xb9')));_0x4cb627[_0x3520('0xa')](_0x3520('0xba'),require(_0x3520('0xbb')));_0x4cb627[_0x3520('0xa')](_0x3520('0xbc'),require(_0x3520('0xbd')));_0x4cb627[_0x3520('0xa')](_0x3520('0xbe'),require('./api/intFreshsalesAccount'));_0x4cb627['use'](_0x3520('0xbf'),require(_0x3520('0xc0')));_0x4cb627[_0x3520('0xa')](_0x3520('0xc1'),require(_0x3520('0xc2')));_0x4cb627[_0x3520('0xa')]('/api/networks',require(_0x3520('0xc3')));_0x4cb627[_0x3520('0xa')]('/api/chat/reports/queue',require(_0x3520('0xc4')));_0x4cb627['use']('/api/chat/internal/messages',require(_0x3520('0xc5')));_0x4cb627[_0x3520('0xa')](_0x3520('0xc6'),require(_0x3520('0xc7')));_0x4cb627[_0x3520('0xa')](_0x3520('0xc8'),require('./api/jscriptyQuestionReport'));_0x4cb627[_0x3520('0xa')](_0x3520('0xc9'),require(_0x3520('0xca')));_0x4cb627[_0x3520('0xa')](_0x3520('0xcb'),require(_0x3520('0xcc')));_0x4cb627[_0x3520('0xa')]('/api/square/reports',require('./api/squareReport'));_0x4cb627[_0x3520('0xa')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x4cb627[_0x3520('0xa')](_0x3520('0xcd'),require(_0x3520('0xce')));_0x4cb627[_0x3520('0xa')](_0x3520('0xcf'),require(_0x3520('0xd0')));_0x4cb627[_0x3520('0xa')](_0x3520('0xd1'),require(_0x3520('0xd2')));_0x4cb627[_0x3520('0xa')](_0x3520('0xd3'),require(_0x3520('0xd4')));_0x4cb627[_0x3520('0xa')](_0x3520('0xd5'),require(_0x3520('0xd6')));_0x4cb627[_0x3520('0xa')](_0x3520('0xd7'),require('./api/squareMessage'));_0x4cb627[_0x3520('0xa')](_0x3520('0xd8'),require(_0x3520('0xd9')));_0x4cb627[_0x3520('0xa')](_0x3520('0xda'),require(_0x3520('0xdb')));_0x4cb627[_0x3520('0xa')](_0x3520('0xdc'),require(_0x3520('0xdd')));_0x4cb627[_0x3520('0xa')]('/api/migrations',require('./api/migration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xde'),require(_0x3520('0xdf')));_0x4cb627[_0x3520('0xa')](_0x3520('0xe0'),require(_0x3520('0xe1')));_0x4cb627['use'](_0x3520('0xe2'),require('./api/mailTransferReport'));_0x4cb627['use'](_0x3520('0xe3'),require(_0x3520('0xe4')));_0x4cb627[_0x3520('0xa')](_0x3520('0xe5'),require(_0x3520('0xe6')));_0x4cb627[_0x3520('0xa')](_0x3520('0xe7'),require(_0x3520('0xe8')));_0x4cb627[_0x3520('0xa')](_0x3520('0xe9'),require(_0x3520('0xea')));_0x4cb627[_0x3520('0xa')](_0x3520('0xeb'),require('./api/cmList'));_0x4cb627[_0x3520('0xa')](_0x3520('0xec'),require(_0x3520('0xed')));_0x4cb627[_0x3520('0xa')](_0x3520('0xee'),require(_0x3520('0xef')));_0x4cb627[_0x3520('0xa')](_0x3520('0xf0'),require(_0x3520('0xf1')));_0x4cb627[_0x3520('0xa')](_0x3520('0xf2'),require(_0x3520('0xf3')));_0x4cb627[_0x3520('0xa')]('/api/userNotifications',require(_0x3520('0xf4')));_0x4cb627[_0x3520('0xa')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x4cb627['use'](_0x3520('0xf5'),require(_0x3520('0xf6')));_0x4cb627[_0x3520('0xa')]('/api/whatsapp/interactions',require(_0x3520('0xf7')));_0x4cb627[_0x3520('0xa')](_0x3520('0xf8'),require(_0x3520('0xf9')));_0x4cb627[_0x3520('0xa')](_0x3520('0xfa'),require(_0x3520('0xfb')));_0x4cb627[_0x3520('0xa')](_0x3520('0xfc'),require(_0x3520('0xfd')));_0x4cb627['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x4cb627[_0x3520('0xa')]('/api/cloudProviders',require(_0x3520('0xfe')));_0x4cb627[_0x3520('0xa')](_0x3520('0xff'),require('./api/realtime'));_0x4cb627[_0x3520('0xa')](_0x3520('0x100'),require(_0x3520('0x101')));_0x4cb627[_0x3520('0xa')](_0x3520('0x102'),require(_0x3520('0x103')));_0x4cb627[_0x3520('0xa')](_0x3520('0x104'),require('./api/jira'));_0x4cb627[_0x3520('0xa')]('/api/rpc',require(_0x3520('0x105')));_0x4cb627[_0x3520('0xa')](_0x3520('0x106'),require('./api/version'));_0x4cb627[_0x3520('0xa')]('/api/system',require(_0x3520('0x107')));_0x4cb627[_0x3520('0xa')](_0x3520('0x108'),require('./api/pm2'));_0x4cb627[_0x3520('0xa')](_0x3520('0x109'),require('./api/webbar'));_0x4cb627['use'](_0x3520('0x10a'),express[_0x3520('0x10b')](path[_0x3520('0x10c')](config[_0x3520('0x10d')],'/apidoc')));_0x4cb627['use'](_0x3520('0x10e'),express['static'](path['join'](config[_0x3520('0x10d')],_0x3520('0x10e'))));_0x4cb627[_0x3520('0xa')]('/demo',express[_0x3520('0x10b')](path[_0x3520('0x10c')](config[_0x3520('0x10d')],_0x3520('0x10f'))));_0x4cb627[_0x3520('0xa')](_0x3520('0x110'),express[_0x3520('0x10b')](path[_0x3520('0x10c')](config[_0x3520('0x10d')],_0x3520('0x111'),'3.0.0')));_0x4cb627['use'](_0x3520('0x112'),express[_0x3520('0x10b')](path[_0x3520('0x10c')](config['root'],'/server/files/plugins')));_0x4cb627[_0x3520('0x113')](_0x3520('0x114'))[_0x3520('0x115')](errors[0x194]);_0x4cb627['route']('/*')[_0x3520('0x115')](function(_0x228fa2,_0x268047){_0x268047[_0x3520('0x116')](path[_0x3520('0x117')](_0x4cb627[_0x3520('0x115')](_0x3520('0x118'))+'/index.html'));});};var sensitiveFields=[_0x3520('0x119'),_0x3520('0x11a'),_0x3520('0x11b'),_0x3520('0x11c'),'firstName',_0x3520('0x11d'),_0x3520('0x11e'),'phone',_0x3520('0x11f'),'fax','email',_0x3520('0x120'),'clientSecret','securityToken',_0x3520('0x121'),'accessKey','tenantId',_0x3520('0x122'),'channelSecret',_0x3520('0x123'),_0x3520('0x124'),_0x3520('0x125'),_0x3520('0x126'),_0x3520('0x127'),_0x3520('0x128'),_0x3520('0x129'),'calleridnum',_0x3520('0x12a'),'vidaooApiKey','clientEmail',_0x3520('0x12b'),_0x3520('0x12c'),_0x3520('0x12d'),_0x3520('0x12e'),_0x3520('0x16'),_0x3520('0x12f'),_0x3520('0x130'),_0x3520('0x131'),_0x3520('0x132'),_0x3520('0x133'),_0x3520('0x134'),_0x3520('0x135')];function maskSensitiveData(_0x4758e9){var _0x5df936=/(?!^)[\s\S](?!$)/g;if(!_[_0x3520('0x136')](_0x4758e9))return;for(var _0x57427b in _0x4758e9){if(_[_0x3520('0x137')](_0x4758e9[_0x57427b])){for(var _0x3b76b2=0x0;_0x3b76b2<_0x4758e9[_0x57427b][_0x3520('0x138')];_0x3b76b2++){maskSensitiveData(_0x4758e9[_0x57427b][_0x3b76b2]);}}else if(_[_0x3520('0x136')](_0x4758e9[_0x57427b])){maskSensitiveData(_0x4758e9[_0x57427b]);}else if(_['isString'](_0x4758e9[_0x57427b])){_0x4758e9[_0x57427b]=_0x4758e9[_0x57427b][_0x3520('0x139')](/{{{/g,_0x3520('0x13a'))[_0x3520('0x139')](/}}}/g,_0x3520('0x13b'))['replace'](/{{/g,'@{')[_0x3520('0x139')](/}}/g,'}@');if(_[_0x3520('0x13c')](sensitiveFields,_0x57427b)){_0x4758e9[_0x57427b]=_0x4758e9[_0x57427b][_0x3520('0x139')](_0x5df936,'*');}}}} \ No newline at end of file +var _0x1a61=['/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/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/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','mobile','fax','clientSecret','securityToken','code','tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','isString','@@{','}@@','replace','includes','lodash','express','util','./errors','./config/environment','./config/logger','auth','./safe-template','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','responseTime','user','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','url','statusCode','name','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a61,0x1e6));var _0x11a6=function(_0x131e26,_0x706c7f){_0x131e26=_0x131e26-0x0;var _0x3e72ae=_0x1a61[_0x131e26];return _0x3e72ae;};'use strict';var _=require(_0x11a6('0x0'));var path=require('path');var express=require(_0x11a6('0x1'));var ewinston=require('express-winston');var util=require(_0x11a6('0x2'));var errors=require(_0x11a6('0x3'));var config=require(_0x11a6('0x4'));var logger=require(_0x11a6('0x5'))('api');var authLogger=require('./config/logger')(_0x11a6('0x6'));var safeTemplate=require(_0x11a6('0x7'))['safeTemplate'];exports[_0x11a6('0x8')]=function(_0x1c4b31){_0x1c4b31[_0x11a6('0x9')](ewinston[_0x11a6('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1c67ce,_0x33b9b4){var _0x2b8dd4=_0x11a6('0xb');if(!_[_0x11a6('0xc')](_0x1c67ce['body'])){_0x2b8dd4+='\x20body=%s';var _0x522315=_0x1c67ce[_0x11a6('0xd')];maskSensitiveData(_0x522315);}return safeTemplate(util[_0x11a6('0xe')](_0x2b8dd4,_0x1c67ce['method'],_0x1c67ce[_0x11a6('0xf')][_0x11a6('0x10')]?_0x1c67ce[_0x11a6('0xf')][_0x11a6('0x10')]:_0x1c67ce[_0x11a6('0x11')][_0x11a6('0x12')]||_0x1c67ce['ip'],_0x1c67ce['url'],_0x33b9b4['statusCode'],_0x33b9b4[_0x11a6('0x13')],_0x1c67ce[_0x11a6('0x14')]?_0x1c67ce['user']['id']:null,_0x1c67ce[_0x11a6('0x14')]?_0x1c67ce[_0x11a6('0x14')]['name']:null,_0x1c67ce[_0x11a6('0x14')]?_0x1c67ce[_0x11a6('0x14')]['role']:null,_0x522315?util[_0x11a6('0x15')](_0x522315,![],null):''));}}));_0x1c4b31[_0x11a6('0x9')](ewinston[_0x11a6('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x444ed0,_0x4bdbf3){var _0x3d6457=_0x11a6('0x16');if(_0x444ed0[_0x11a6('0xd')]&&_0x444ed0[_0x11a6('0xd')][_0x11a6('0x17')]&&_0x444ed0[_0x11a6('0xd')][_0x11a6('0x18')]){_0x3d6457=_0x11a6('0x19');}return util[_0x11a6('0xe')](_0x3d6457,_0x444ed0[_0x11a6('0x1a')],_0x444ed0[_0x11a6('0xf')][_0x11a6('0x10')]?_0x444ed0[_0x11a6('0xf')][_0x11a6('0x10')]:_0x444ed0['connection'][_0x11a6('0x12')]||_0x444ed0['ip'],_0x444ed0[_0x11a6('0x1b')],_0x4bdbf3[_0x11a6('0x1c')],_0x4bdbf3[_0x11a6('0x13')],_0x444ed0['user']?_0x444ed0['user']['id']:null,_0x444ed0[_0x11a6('0x14')]?_0x444ed0['user'][_0x11a6('0x1d')]:null,_0x444ed0['user']?_0x444ed0['user']['role']:null,_0x444ed0['body']&&_0x444ed0[_0x11a6('0xd')]['device']?_0x444ed0[_0x11a6('0xd')][_0x11a6('0x17')]:'other',_0x444ed0['body']&&_0x444ed0[_0x11a6('0xd')][_0x11a6('0x18')]?_0x444ed0[_0x11a6('0xd')][_0x11a6('0x18')]:'',_0x444ed0[_0x11a6('0xd')]&&_0x444ed0[_0x11a6('0xd')][_0x11a6('0x1e')]?_0x444ed0[_0x11a6('0xd')][_0x11a6('0x1e')]:'');},'ignoreRoute':function(_0x349915){var _0x1ceb50=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1ceb50[_0x11a6('0x1f')](_0x349915[_0x11a6('0x1b')]);}}));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x20'),require(_0x11a6('0x21')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x22'),require(_0x11a6('0x23')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x24'),require(_0x11a6('0x25')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x26'),require(_0x11a6('0x27')));_0x1c4b31['use'](_0x11a6('0x28'),require('./api/voiceMusicOnHold'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x29'),require(_0x11a6('0x2a')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x2b'),require('./api/voiceRecording'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x2c'),require('./api/screenRecording'));_0x1c4b31['use']('/api/voice/mails',require(_0x11a6('0x2d')));_0x1c4b31[_0x11a6('0x9')]('/api/voice/mails/messages',require(_0x11a6('0x2e')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x2f'),require(_0x11a6('0x30')));_0x1c4b31[_0x11a6('0x9')]('/api/voice/dials/reports',require(_0x11a6('0x31')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x32'),require(_0x11a6('0x33')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x34'),require(_0x11a6('0x35')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x36'),require(_0x11a6('0x37')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x38'),require(_0x11a6('0x39')));_0x1c4b31['use'](_0x11a6('0x3a'),require(_0x11a6('0x3b')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x3c'),require(_0x11a6('0x3d')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x3e'),require(_0x11a6('0x3f')));_0x1c4b31[_0x11a6('0x9')]('/api/mail/queues',require(_0x11a6('0x40')));_0x1c4b31[_0x11a6('0x9')]('/api/mail/substatuses',require(_0x11a6('0x41')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x42'),require('./api/mailInteraction'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x43'),require('./api/mailMessage'));_0x1c4b31['use'](_0x11a6('0x44'),require('./api/mailApplication'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x45'),require('./api/mailQueueReport'));_0x1c4b31[_0x11a6('0x9')]('/api/dashboards',require(_0x11a6('0x46')));_0x1c4b31[_0x11a6('0x9')]('/api/dashboards/items',require(_0x11a6('0x47')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x48'),require(_0x11a6('0x49')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x4a'),require(_0x11a6('0x4b')));_0x1c4b31['use'](_0x11a6('0x4c'),require(_0x11a6('0x4d')));_0x1c4b31['use'](_0x11a6('0x4e'),require(_0x11a6('0x4f')));_0x1c4b31['use'](_0x11a6('0x50'),require(_0x11a6('0x51')));_0x1c4b31[_0x11a6('0x9')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x1c4b31['use']('/api/sms/accounts',require(_0x11a6('0x52')));_0x1c4b31['use'](_0x11a6('0x53'),require(_0x11a6('0x54')));_0x1c4b31['use']('/api/sms/interactions',require('./api/smsInteraction'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x55'),require('./api/smsMessage'));_0x1c4b31[_0x11a6('0x9')]('/api/sms/queues',require(_0x11a6('0x56')));_0x1c4b31['use'](_0x11a6('0x57'),require(_0x11a6('0x58')));_0x1c4b31['use'](_0x11a6('0x59'),require('./api/openchannelApplication'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x5a'),require(_0x11a6('0x5b')));_0x1c4b31[_0x11a6('0x9')]('/api/openchannel/messages',require(_0x11a6('0x5c')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x5d'),require(_0x11a6('0x5e')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x5f'),require('./api/chatWebsite'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x60'),require(_0x11a6('0x61')));_0x1c4b31['use'](_0x11a6('0x62'),require(_0x11a6('0x63')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x64'),require(_0x11a6('0x65')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x66'),require(_0x11a6('0x67')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x68'),require(_0x11a6('0x69')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x6a'),require(_0x11a6('0x6b')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x6c'),require(_0x11a6('0x6d')));_0x1c4b31[_0x11a6('0x9')]('/api/chat/proactive_actions',require(_0x11a6('0x6e')));_0x1c4b31['use'](_0x11a6('0x6f'),require('./api/cmCompany'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x70'),require(_0x11a6('0x71')));_0x1c4b31[_0x11a6('0x9')]('/api/cm/hopper',require(_0x11a6('0x72')));_0x1c4b31[_0x11a6('0x9')]('/api/cm/hopper_black',require(_0x11a6('0x73')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x74'),require(_0x11a6('0x75')));_0x1c4b31[_0x11a6('0x9')]('/api/cm/hopper_history',require(_0x11a6('0x76')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x77'),require(_0x11a6('0x78')));_0x1c4b31[_0x11a6('0x9')]('/api/actions',require(_0x11a6('0x79')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x7a'),require(_0x11a6('0x7b')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x7c'),require('./api/cannedAnswer'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x7d'),require(_0x11a6('0x7e')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x7f'),require(_0x11a6('0x80')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x81'),require('./api/interval'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x82'),require(_0x11a6('0x83')));_0x1c4b31['use'](_0x11a6('0x84'),require(_0x11a6('0x85')));_0x1c4b31[_0x11a6('0x9')]('/api/voiceQueuesLog',require(_0x11a6('0x86')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x87'),require(_0x11a6('0x88')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x89'),require('./api/sound'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x8a'),require(_0x11a6('0x8b')));_0x1c4b31['use'](_0x11a6('0x8c'),require(_0x11a6('0x8d')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x8e'),require(_0x11a6('0x8f')));_0x1c4b31['use'](_0x11a6('0x90'),require(_0x11a6('0x91')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x92'),require(_0x11a6('0x93')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x94'),require(_0x11a6('0x95')));_0x1c4b31[_0x11a6('0x9')]('/api/analytics/custom_reports',require(_0x11a6('0x96')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x97'),require(_0x11a6('0x98')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x99'),require(_0x11a6('0x9a')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x9b'),require(_0x11a6('0x9c')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x9d'),require('./api/analyticFieldReport'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x9e'),require(_0x11a6('0x9f')));_0x1c4b31['use'](_0x11a6('0xa0'),require(_0x11a6('0xa1')));_0x1c4b31['use']('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xa2'),require(_0x11a6('0xa3')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xa4'),require(_0x11a6('0xa5')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xa6'),require(_0x11a6('0xa7')));_0x1c4b31[_0x11a6('0x9')]('/api/integrations/sugarcrm/fields',require(_0x11a6('0xa8')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xa9'),require('./api/intDeskAccount'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xaa'),require(_0x11a6('0xab')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xac'),require(_0x11a6('0xad')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xae'),require(_0x11a6('0xaf')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xb0'),require(_0x11a6('0xb1')));_0x1c4b31['use'](_0x11a6('0xb2'),require(_0x11a6('0xb3')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xb4'),require(_0x11a6('0xb5')));_0x1c4b31['use'](_0x11a6('0xb6'),require(_0x11a6('0xb7')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xb8'),require(_0x11a6('0xb9')));_0x1c4b31['use'](_0x11a6('0xba'),require('./api/intFreshdeskAccount'));_0x1c4b31['use'](_0x11a6('0xbb'),require(_0x11a6('0xbc')));_0x1c4b31['use'](_0x11a6('0xbd'),require(_0x11a6('0xbe')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xbf'),require(_0x11a6('0xc0')));_0x1c4b31['use'](_0x11a6('0xc1'),require('./api/intVtigerConfiguration'));_0x1c4b31['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xc2'),require(_0x11a6('0xc3')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xc4'),require('./api/intServicenowConfiguration'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xc5'),require('./api/intServicenowField'));_0x1c4b31[_0x11a6('0x9')]('/api/integrations/dynamics365/accounts',require(_0x11a6('0xc6')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xc7'),require(_0x11a6('0xc8')));_0x1c4b31['use'](_0x11a6('0xc9'),require('./api/intDynamics365Field'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xca'),require(_0x11a6('0xcb')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xcc'),require('./api/intFreshsalesConfiguration'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xcd'),require(_0x11a6('0xce')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xcf'),require(_0x11a6('0xd0')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xd1'),require(_0x11a6('0xd2')));_0x1c4b31[_0x11a6('0x9')]('/api/chat/internal/messages',require(_0x11a6('0xd3')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xd4'),require(_0x11a6('0xd5')));_0x1c4b31['use'](_0x11a6('0xd6'),require(_0x11a6('0xd7')));_0x1c4b31[_0x11a6('0x9')]('/api/jscripty/sessions/reports',require(_0x11a6('0xd8')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xd9'),require(_0x11a6('0xda')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xdb'),require(_0x11a6('0xdc')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xdd'),require('./api/squareReportDetail'));_0x1c4b31['use'](_0x11a6('0xde'),require(_0x11a6('0xdf')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xe0'),require(_0x11a6('0xe1')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xe2'),require(_0x11a6('0xe3')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xe4'),require(_0x11a6('0xe5')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xe6'),require('./api/squareRecording'));_0x1c4b31[_0x11a6('0x9')]('/api/square/messages',require(_0x11a6('0xe7')));_0x1c4b31['use']('/api/teams',require(_0x11a6('0xe8')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xe9'),require(_0x11a6('0xea')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xeb'),require(_0x11a6('0xec')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xed'),require(_0x11a6('0xee')));_0x1c4b31['use'](_0x11a6('0xef'),require(_0x11a6('0xf0')));_0x1c4b31['use'](_0x11a6('0xf1'),require(_0x11a6('0xf2')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xf3'),require(_0x11a6('0xf4')));_0x1c4b31[_0x11a6('0x9')]('/api/chat/reports/transfer',require(_0x11a6('0xf5')));_0x1c4b31[_0x11a6('0x9')]('/api/fax/reports/transfer',require(_0x11a6('0xf6')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xf7'),require('./api/openchannelTransferReport'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xf8'),require(_0x11a6('0xf9')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xfa'),require(_0x11a6('0xfb')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xfc'),require('./api/voicePrefix'));_0x1c4b31['use'](_0x11a6('0xfd'),require(_0x11a6('0xfe')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0xff'),require(_0x11a6('0x100')));_0x1c4b31['use'](_0x11a6('0x101'),require(_0x11a6('0x102')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x103'),require(_0x11a6('0x104')));_0x1c4b31['use'](_0x11a6('0x105'),require(_0x11a6('0x106')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x107'),require(_0x11a6('0x108')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x109'),require(_0x11a6('0x10a')));_0x1c4b31['use'](_0x11a6('0x10b'),require(_0x11a6('0x10c')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x10d'),require('./api/whatsappQueueReport'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x10e'),require(_0x11a6('0x10f')));_0x1c4b31[_0x11a6('0x9')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x110'),require(_0x11a6('0x111')));_0x1c4b31['use'](_0x11a6('0x112'),require('./api/realtime'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x113'),require(_0x11a6('0x114')));_0x1c4b31['use'](_0x11a6('0x115'),require(_0x11a6('0x116')));_0x1c4b31[_0x11a6('0x9')]('/api/jira',require('./api/jira'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x117'),require('./api/rpc'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x118'),require(_0x11a6('0x119')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x11a'),require('./api/system'));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x11b'),require(_0x11a6('0x11c')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x11d'),require(_0x11a6('0x11e')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x11f'),express['static'](path[_0x11a6('0x120')](config[_0x11a6('0x121')],'/apidoc')));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x122'),express[_0x11a6('0x123')](path[_0x11a6('0x120')](config[_0x11a6('0x121')],_0x11a6('0x122'))));_0x1c4b31[_0x11a6('0x9')]('/demo',express[_0x11a6('0x123')](path['join'](config['root'],_0x11a6('0x124'))));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x125'),express[_0x11a6('0x123')](path[_0x11a6('0x120')](config['root'],_0x11a6('0x126'),_0x11a6('0x127'))));_0x1c4b31[_0x11a6('0x9')](_0x11a6('0x128'),express[_0x11a6('0x123')](path[_0x11a6('0x120')](config['root'],_0x11a6('0x129'))));_0x1c4b31[_0x11a6('0x12a')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x11a6('0x12b')](errors[0x194]);_0x1c4b31[_0x11a6('0x12a')]('/*')[_0x11a6('0x12b')](function(_0x159c8b,_0x2abc85){_0x2abc85['sendFile'](path[_0x11a6('0x12c')](_0x1c4b31[_0x11a6('0x12b')](_0x11a6('0x12d'))+_0x11a6('0x12e')));});};var sensitiveFields=[_0x11a6('0x12f'),_0x11a6('0x130'),_0x11a6('0x131'),_0x11a6('0x132'),_0x11a6('0x133'),_0x11a6('0x134'),'street','phone',_0x11a6('0x135'),_0x11a6('0x136'),'email','clientId',_0x11a6('0x137'),_0x11a6('0x138'),_0x11a6('0x139'),'accessKey',_0x11a6('0x13a'),_0x11a6('0x13b'),_0x11a6('0x13c'),'accessToken',_0x11a6('0x13d'),_0x11a6('0x13e'),_0x11a6('0x13f'),_0x11a6('0x140'),_0x11a6('0x141'),_0x11a6('0x142'),_0x11a6('0x143'),_0x11a6('0x144'),_0x11a6('0x145'),_0x11a6('0x146'),_0x11a6('0x147'),_0x11a6('0x148'),_0x11a6('0x149'),_0x11a6('0x14a'),_0x11a6('0x14'),_0x11a6('0x14b'),_0x11a6('0x14c'),'localstationid',_0x11a6('0x14d'),_0x11a6('0x14e'),_0x11a6('0x14f'),_0x11a6('0x150')];function maskSensitiveData(_0x18e615){var _0x3accc9=/(?!^)[\s\S](?!$)/g;if(!_[_0x11a6('0x151')](_0x18e615))return;for(var _0x4add15 in _0x18e615){if(_[_0x11a6('0x152')](_0x18e615[_0x4add15])){for(var _0x8036cb=0x0;_0x8036cb<_0x18e615[_0x4add15]['length'];_0x8036cb++){maskSensitiveData(_0x18e615[_0x4add15][_0x8036cb]);}}else if(_[_0x11a6('0x151')](_0x18e615[_0x4add15])){maskSensitiveData(_0x18e615[_0x4add15]);}else if(_[_0x11a6('0x153')](_0x18e615[_0x4add15])){_0x18e615[_0x4add15]=_0x18e615[_0x4add15]['replace'](/{{{/g,_0x11a6('0x154'))['replace'](/}}}/g,_0x11a6('0x155'))[_0x11a6('0x156')](/{{/g,'@{')[_0x11a6('0x156')](/}}/g,'}@');if(_[_0x11a6('0x157')](sensitiveFields,_0x4add15)){_0x18e615[_0x4add15]=_0x18e615[_0x4add15][_0x11a6('0x156')](_0x3accc9,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index d5e534e..2c9ae07 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36de=['rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http'];(function(_0x179d45,_0x5a1fef){var _0xf32461=function(_0x3a5660){while(--_0x3a5660){_0x179d45['push'](_0x179d45['shift']());}};_0xf32461(++_0x5a1fef);}(_0x36de,0x1ea));var _0xe36d=function(_0x1b15f1,_0x59e21c){_0x1b15f1=_0x1b15f1-0x0;var _0x3b9486=_0x36de[_0x1b15f1];return _0x3b9486;};'use strict';var jayson=require(_0xe36d('0x0'));var BPromise=require(_0xe36d('0x1'));var _=require(_0xe36d('0x2'));var config=require(_0xe36d('0x3'));exports[_0xe36d('0x4')]=function(){return new BPromise(function(_0x44414e,_0x4be980){var _0x4c9e2b={};_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x5')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x7')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x8')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x9')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xa')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xb')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xc')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xd')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xe')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/mailServerIn/mailServerIn.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xf')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x10')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/mailInteraction/mailInteraction.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x11')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/mailApplication/mailApplication.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/faxAccount/faxAccount.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x12')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x13')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x14')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x15')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x16')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x17')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x18')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x19')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x1a')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x1b')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x1c')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x1d')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require('../api/chatInteraction/chatInteraction.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x1e')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x1f')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/cmContact/cmContact.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x20')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x21')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x22')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x23')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x24')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x25')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x26')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x27')));_0x4c9e2b=_['merge'](_0x4c9e2b,require('../api/trigger/trigger.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x28')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x29')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x2a')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x2b')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x2c')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x2d')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x2e')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x2f')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x30')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x31')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x32')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x33')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x34')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x35')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/squareOdbc/squareOdbc.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x36')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x37')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/squareMessage/squareMessage.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x38')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x39')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/plugin/plugin.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x3a')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x3b')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x3c')));var _0x1e63bf=jayson['server'](_0x4c9e2b)[_0xe36d('0x3d')]();var _0x12cc7a=config[_0xe36d('0x3e')][_0xe36d('0x3f')]||config[_0xe36d('0x3f')]+0x1;var _0x536c6b=config['rpc']['ip']||'localhost';_0x1e63bf['on'](_0xe36d('0x40'),function(_0xc897cf){return _0x4be980(_0xc897cf);});_0x1e63bf[_0xe36d('0x4')](_0x12cc7a,_0x536c6b,function(){console[_0xe36d('0x41')](_0xe36d('0x42'),_0x536c6b,_0x12cc7a);require(_0xe36d('0x43'))['default']();return _0x44414e(_0xe36d('0x44')+_0x536c6b+':'+_0x12cc7a);});});}; \ No newline at end of file +var _0x5fea=['../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.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'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5fea,0x82));var _0xa5fe=function(_0x5f5497,_0x50803a){_0x5f5497=_0x5f5497-0x0;var _0x10e943=_0x5fea[_0x5f5497];return _0x10e943;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa5fe('0x0'));var _=require(_0xa5fe('0x1'));var config=require(_0xa5fe('0x2'));exports[_0xa5fe('0x3')]=function(){return new BPromise(function(_0x54cff1,_0x32ee21){var _0x5ed395={};_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x4')));_0x5ed395=_['merge'](_0x5ed395,require('../api/voiceExtension/voiceExtension.rpc'));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x6')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x7')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x8')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x9')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require('../api/memberReport/memberReport.rpc'));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0xa')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0xb')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0xc')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0xd')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0xe')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0xf')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x10')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x11')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x12')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x13')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x14')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x15')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x16')));_0x5ed395=_['merge'](_0x5ed395,require('../api/faxMessage/faxMessage.rpc'));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x17')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x18')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x19')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x1a')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require('../api/smsMessage/smsMessage.rpc'));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x1b')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x1c')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x1d')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x1e')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x1f')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x20')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x21')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x22')));_0x5ed395=_['merge'](_0x5ed395,require('../api/cmContact/cmContact.rpc'));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x23')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x24')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x25')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x26')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x27')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x28')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x29')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require('../api/sound/sound.rpc'));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x2a')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x2b')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x2c')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x2d')));_0x5ed395=_['merge'](_0x5ed395,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x2e')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x2f')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x30')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5ed395=_['merge'](_0x5ed395,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x31')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x32')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x33')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x34')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x35')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x36')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x37')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x38')));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x39')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x3a')));_0x5ed395=_['merge'](_0x5ed395,require('../api/squareRecording/squareRecording.rpc'));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x3b')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x3c')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x3d')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x3e')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x3f')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5ed395=_['merge'](_0x5ed395,require(_0xa5fe('0x40')));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5ed395=_[_0xa5fe('0x5')](_0x5ed395,require(_0xa5fe('0x41')));var _0x9057f9=jayson['server'](_0x5ed395)['http']();var _0x79c675=config[_0xa5fe('0x42')]['port']||config[_0xa5fe('0x43')]+0x1;var _0x3d6461=config['rpc']['ip']||_0xa5fe('0x44');_0x9057f9['on']('error',function(_0x46fc5e){return _0x32ee21(_0x46fc5e);});_0x9057f9[_0xa5fe('0x3')](_0x79c675,_0x3d6461,function(){console[_0xa5fe('0x45')](_0xa5fe('0x46'),_0x3d6461,_0x79c675);require(_0xa5fe('0x47'))[_0xa5fe('0x48')]();return _0x54cff1(_0xa5fe('0x49')+_0x3d6461+':'+_0x79c675);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 2522d29..5674ef8 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x4b4c68,_0x14d416){var _0x1686e6=function(_0x56ab6c){while(--_0x56ab6c){_0x4b4c68['push'](_0x4b4c68['shift']());}};_0x1686e6(++_0x14d416);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file +var _0x14a0=['string','replace','isPlainObject','keys','exports','safeTemplate','{\x20{\x20','\x20}\x20}'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x14a0,0x8e));var _0x014a=function(_0x165fa1,_0x5c68f4){_0x165fa1=_0x165fa1-0x0;var _0x8b7001=_0x14a0[_0x165fa1];return _0x8b7001;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x105436){return _0x105436==='{{'?_0x014a('0x0'):_0x014a('0x1');}function safeTemplate(_0x28b0f6){var _0x32e88c=_0x28b0f6;if(typeof _0x28b0f6===_0x014a('0x2')){_0x32e88c=_0x28b0f6[_0x014a('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x28b0f6)){_0x32e88c=_0x28b0f6['map'](function(_0x1730a5){return safeTemplate(_0x1730a5);});}else if(_[_0x014a('0x4')](_0x28b0f6)){_0x32e88c=Object[_0x014a('0x5')](_0x28b0f6)['reduce'](function(_0x5a61ac,_0x11b8ce){_0x5a61ac[_0x11b8ce]=safeTemplate(_0x28b0f6[_0x11b8ce]);return _0x5a61ac;},{});}return _0x32e88c;}module[_0x014a('0x6')][_0x014a('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index a862997..e9be099 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 _0xcdd2=['destroy','function','write','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','format','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','startsWith','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT'];(function(_0x373ea0,_0x4be8bd){var _0x4c0bdc=function(_0xa5dd09){while(--_0xa5dd09){_0x373ea0['push'](_0x373ea0['shift']());}};_0x4c0bdc(++_0x4be8bd);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x2cdd('0x0'));var _=require(_0x2cdd('0x1'));var EventEmitter=require(_0x2cdd('0x2'))[_0x2cdd('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x2cdd('0x4'));function AGIChannel(_0x35f3ce){var _0xf0d3dc=this,_0x2b63a4=new AGIReply(),_0x5d1626=![],_0x42dbf8={};EventEmitter[_0x2cdd('0x5')](_0xf0d3dc);_0x35f3ce['setEncoding'](_0x2cdd('0x6'));_0x35f3ce[_0x2cdd('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2b63a4[_0x2cdd('0x8')](_0x2cdd('0x6'));_0x2b63a4['on']('headers',function(_0x569943){for(var _0x54f580 in _0x569943){_0xf0d3dc[_0x54f580]=_0x569943[_0x54f580];}_0xf0d3dc[_0x2cdd('0x9')]('ready');});_0x2b63a4['on'](_0x2cdd('0xa'),function(_0x3e3cf0){if(_0x3e3cf0[_0x2cdd('0xb')]()==_0x2cdd('0xc')){_0xf0d3dc[_0x2cdd('0x9')](_0x2cdd('0xc'));return;}if(_0x3e3cf0[_0x2cdd('0xd')](0x0,0xb)==_0x2cdd('0xe')){_0x5d1626=!![];}if(_0x5d1626){_0x42dbf8['rx']+=_0x3e3cf0+'\x0a';if(_0x3e3cf0[_0x2cdd('0xf')](_0x2cdd('0x10'))!=-0x1){_0x5d1626=![];}}else{_0x42dbf8['rx']=_0x3e3cf0;}if(_0x5d1626){return;}if(typeof _0x42dbf8['cb']=='function'){var _0x53ea0b=_0x42dbf8['rx']['substring'](0x0,0x3),_0xfddd1e=null,_0x11b209=null;_0x53ea0b=parseInt(_0x53ea0b);if(isNaN(_0x53ea0b)){_0x42dbf8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2cdd('0x11')});return;}if(_0x53ea0b!=0xc8){_0x42dbf8['cb'](null,{'code':_0x53ea0b,'result':-0x1,'extra':'KO'});return;}_0xfddd1e=_0x42dbf8['rx'][_0x2cdd('0xd')](0x4)[_0x2cdd('0x12')](_0x2cdd('0x13'),'');if(_0xfddd1e[_0x2cdd('0x14')]('\x20')!=-0x1){_0xfddd1e=_0xfddd1e['substr'](0x0,_0xfddd1e[_0x2cdd('0x14')]('\x20'));}if(_[_0x2cdd('0x15')](_0xfddd1e,'-1')){_0xfddd1e=parseInt(_0xfddd1e);}_0x11b209=_0x42dbf8['rx']['split']('\x20');if(_0x11b209[_0x2cdd('0x16')]==0x3){_0x11b209=_0x11b209[0x2][_0x2cdd('0xd')](0x1,_0x11b209[0x2][_0x2cdd('0x16')]-0x1);}else if(_0x11b209[_0x2cdd('0x16')]>0x3){var _0x3af7c8=/\((.+)\)/;var _0x2587fb=_0x42dbf8['rx']['match'](_0x3af7c8);if(_0x2587fb){_0x11b209=_0x2587fb[0x1];}else{_0x11b209=null;}}else{_0x11b209=null;}_0x42dbf8['cb'](null,{'code':_0x53ea0b,'result':_0xfddd1e,'extra':_0x11b209});}});_0x35f3ce['on'](_0x2cdd('0x17'),function(_0x9491c8){_0xf0d3dc[_0x2cdd('0x9')](_0x2cdd('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x9491c8[_0x2cdd('0x18')]));});_0x35f3ce['on'](_0x2cdd('0x19'),function(){_0xf0d3dc[_0x2cdd('0x9')](_0x2cdd('0x19'),new AGIError(_0x2cdd('0x1a')));});_0x35f3ce['on'](_0x2cdd('0x1b'),function(){_0xf0d3dc[_0x2cdd('0x9')](_0x2cdd('0x1b'),new AGIError(_0x2cdd('0x1c')));_0x35f3ce[_0x2cdd('0x1d')]();});_0x35f3ce['pipe'](_0x2b63a4);this['command']=function(_0x206942,_0x5e874e){var _0x206942=_0x206942||'',_0x5e874e=typeof _0x5e874e==_0x2cdd('0x1e')?_0x5e874e:new Function();_0x42dbf8={'tx':_0x206942,'rx':'','cb':_0x5e874e};_0x35f3ce[_0x2cdd('0x1f')](_0x206942+'\x0a');},this[_0x2cdd('0x19')]=function(){_0x35f3ce['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x21')]=function(_0x340a47){return this[_0x2cdd('0x22')][_0x2cdd('0x23')](this,_0x340a47);};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x24')]=function(){return this['sendRequest'](_0x2cdd('0x25'));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x26')]=function(_0x5a8eff,_0x4cbc21,_0x5ef69f){_0x5a8eff=_0x5a8eff===undefined?_0x2cdd('0x27'):_0x5a8eff;_0x4cbc21=_0x4cbc21===undefined?'5':_0x4cbc21;_0x5ef69f=_0x5ef69f===undefined?'1':_0x5ef69f;return this[_0x2cdd('0x21')](util['format'](_0x2cdd('0x28'),_0x5a8eff,_0x4cbc21*0x3e8,_0x5ef69f));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x29')]=function(_0x1fd007){_0x1fd007=_0x1fd007||_0x2cdd('0x2a');return this[_0x2cdd('0x21')](util['format'](_0x2cdd('0x2b'),_0x1fd007));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x2c')]=function(_0x43fbc3,_0x4d6929){if(_[_0x2cdd('0x2d')](_0x4d6929)){return this[_0x2cdd('0x21')](util['format'](_0x2cdd('0x2e'),_0x43fbc3,_0x4d6929[_0x2cdd('0x2f')](',')));}return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x2e'),_0x43fbc3,_0x4d6929));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x31')]=function(_0x1a7552){return this[_0x2cdd('0x21')](util['format'](_0x2cdd('0x32'),_0x1a7552));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x33')]=function(_0x5a0fb4){return this['sendRequest'](util['format'](_0x2cdd('0x34'),_0x5a0fb4));};AGIChannel[_0x2cdd('0x20')]['setPriority']=function(_0x6c7f28){return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x35'),_0x6c7f28));};AGIChannel[_0x2cdd('0x20')]['hangup']=function(){return this['sendRequest'](_0x2cdd('0x36'));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x37')]=function(_0x1b4bd7,_0x41156e){var _0x49a484=_[_0x2cdd('0x38')](_0x41156e)||_[_0x2cdd('0x39')](_0x41156e)?_0x41156e[_0x2cdd('0x3a')]():_0x41156e;return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x3b'),_0x1b4bd7,_0x49a484?_0x49a484[_0x2cdd('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x3c')]=function(_0x2f8e8c,_0x42cbd7){return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x3d'),_0x2f8e8c,_0x42cbd7));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x3e')]=function(_0x49b727,_0x4bf498){return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x3f'),_0x49b727,_0x4bf498));};AGIChannel['prototype'][_0x2cdd('0x40')]=function(_0x59e7d8,_0x573bd4){return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x41'),_0x59e7d8,_0x573bd4));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x42')]=function(_0x2414bd,_0x4388d7,_0x3778d9){_0x4388d7=_0x4388d7||this[_0x2cdd('0x43')];_0x3778d9=_0x3778d9||0x1;this['setContext'](_0x2414bd);this[_0x2cdd('0x33')](_0x4388d7);this[_0x2cdd('0x44')](_0x3778d9);return this[_0x2cdd('0x29')](util['format'](_0x2cdd('0x45'),_0x2414bd,_0x4388d7,_0x3778d9));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x46')]=function(_0x2b3932){return this[_0x2cdd('0x21')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2b3932));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x47')]=function(_0x945df1,_0x5d9369,_0x51c6c6,_0x4162ba,_0x477482,_0x5258fc){_0x5d9369=_0x5d9369||'wav';_0x51c6c6=_0x51c6c6||'';_0x4162ba=_0x4162ba===undefined?-0x1:_0x4162ba==='-1'?-0x1:_0x4162ba*0x3e8;_0x477482=_0x477482===undefined?'':'s='+_0x477482;_0x5258fc=_0x5258fc?_0x2cdd('0x48'):'';return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x49'),_0x945df1,_0x5d9369,_0x51c6c6,_0x4162ba,_0x5258fc,_0x477482));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x4a')]=function(_0x4427f3,_0x3ac603){_0x3ac603=_0x3ac603||'';return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x4b'),_0x4427f3,_0x3ac603));};AGIChannel['prototype'][_0x2cdd('0x4c')]=function(_0x1f9fb3){return this[_0x2cdd('0x2c')]('AGI',_0x1f9fb3);};AGIChannel[_0x2cdd('0x20')]['wait']=function(_0x5acb44){return this[_0x2cdd('0x2c')]('WAIT',_0x5acb44);};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x17')]=function(_0x14566e,_0x4c55f5){this[_0x2cdd('0x29')](util[_0x2cdd('0x30')](_0x2cdd('0x4d'),_0x14566e['id'],_0x14566e[_0x2cdd('0x4e')],_0x4c55f5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x2cdd('0x4f')]=AGIChannel; \ No newline at end of file +var _0x5a9e=['exec','isArray','EXEC\x20%s\x20%s','join','setContext','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','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','./error','call','utf8','setTimeout','headers','emit','ready','toLowerCase','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','write','inherits','prototype','sync','answer','sendRequest','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22'];(function(_0x26de6c,_0x185fe1){var _0x4f5bd5=function(_0x394355){while(--_0x394355){_0x26de6c['push'](_0x26de6c['shift']());}};_0x4f5bd5(++_0x185fe1);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x5a9e[_0x47a349];return _0x18ab75;};'use strict';var util=require('util');var _=require(_0xe5a9('0x0'));var EventEmitter=require(_0xe5a9('0x1'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0xe5a9('0x2'));function AGIChannel(_0x40bc74){var _0x15c7f3=this,_0x353351=new AGIReply(),_0x36e506=![],_0x5b155d={};EventEmitter[_0xe5a9('0x3')](_0x15c7f3);_0x40bc74['setEncoding'](_0xe5a9('0x4'));_0x40bc74[_0xe5a9('0x5')](0x8*0x3c*0x3c*0x3e8);_0x353351['setEncoding']('utf8');_0x353351['on'](_0xe5a9('0x6'),function(_0x13bb4f){for(var _0x1f5bfc in _0x13bb4f){_0x15c7f3[_0x1f5bfc]=_0x13bb4f[_0x1f5bfc];}_0x15c7f3[_0xe5a9('0x7')](_0xe5a9('0x8'));});_0x353351['on']('line',function(_0x579b84){if(_0x579b84[_0xe5a9('0x9')]()=='hangup'){_0x15c7f3[_0xe5a9('0x7')]('hangup');return;}if(_0x579b84['substring'](0x0,0xb)==_0xe5a9('0xa')){_0x36e506=!![];}if(_0x36e506){_0x5b155d['rx']+=_0x579b84+'\x0a';if(_0x579b84[_0xe5a9('0xb')](_0xe5a9('0xc'))!=-0x1){_0x36e506=![];}}else{_0x5b155d['rx']=_0x579b84;}if(_0x36e506){return;}if(typeof _0x5b155d['cb']==_0xe5a9('0xd')){var _0x2e36e6=_0x5b155d['rx']['substring'](0x0,0x3),_0x4386ec=null,_0x14ccdf=null;_0x2e36e6=parseInt(_0x2e36e6);if(isNaN(_0x2e36e6)){_0x5b155d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe5a9('0xe')});return;}if(_0x2e36e6!=0xc8){_0x5b155d['cb'](null,{'code':_0x2e36e6,'result':-0x1,'extra':'KO'});return;}_0x4386ec=_0x5b155d['rx'][_0xe5a9('0xf')](0x4)[_0xe5a9('0x10')](_0xe5a9('0x11'),'');if(_0x4386ec[_0xe5a9('0x12')]('\x20')!=-0x1){_0x4386ec=_0x4386ec[_0xe5a9('0x13')](0x0,_0x4386ec[_0xe5a9('0x12')]('\x20'));}if(_['startsWith'](_0x4386ec,'-1')){_0x4386ec=parseInt(_0x4386ec);}_0x14ccdf=_0x5b155d['rx'][_0xe5a9('0x14')]('\x20');if(_0x14ccdf[_0xe5a9('0x15')]==0x3){_0x14ccdf=_0x14ccdf[0x2][_0xe5a9('0xf')](0x1,_0x14ccdf[0x2]['length']-0x1);}else if(_0x14ccdf['length']>0x3){var _0x1c46ba=/\((.+)\)/;var _0x369d4f=_0x5b155d['rx'][_0xe5a9('0x16')](_0x1c46ba);if(_0x369d4f){_0x14ccdf=_0x369d4f[0x1];}else{_0x14ccdf=null;}}else{_0x14ccdf=null;}_0x5b155d['cb'](null,{'code':_0x2e36e6,'result':_0x4386ec,'extra':_0x14ccdf});}});_0x40bc74['on'](_0xe5a9('0x17'),function(_0xd5f697){_0x15c7f3[_0xe5a9('0x7')]('error',new AGIError(_0xe5a9('0x18'),_0xd5f697['code']));});_0x40bc74['on']('close',function(){_0x15c7f3[_0xe5a9('0x7')](_0xe5a9('0x19'),new AGIError(_0xe5a9('0x1a')));});_0x40bc74['on'](_0xe5a9('0x1b'),function(){_0x15c7f3[_0xe5a9('0x7')](_0xe5a9('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x40bc74['destroy']();});_0x40bc74[_0xe5a9('0x1c')](_0x353351);this[_0xe5a9('0x1d')]=function(_0x37947b,_0x374879){var _0x37947b=_0x37947b||'',_0x374879=typeof _0x374879=='function'?_0x374879:new Function();_0x5b155d={'tx':_0x37947b,'rx':'','cb':_0x374879};_0x40bc74[_0xe5a9('0x1e')](_0x37947b+'\x0a');},this[_0xe5a9('0x19')]=function(){_0x40bc74['destroy']();};}util[_0xe5a9('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0xe5a9('0x20')]['sendRequest']=function(_0x40108c){return this['command'][_0xe5a9('0x21')](this,_0x40108c);};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x22')]=function(){return this[_0xe5a9('0x23')]('ANSWER');};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x24')]=function(_0x20e1a1,_0x127ca0,_0x3dd3da){_0x20e1a1=_0x20e1a1===undefined?_0xe5a9('0x25'):_0x20e1a1;_0x127ca0=_0x127ca0===undefined?'5':_0x127ca0;_0x3dd3da=_0x3dd3da===undefined?'1':_0x3dd3da;return this[_0xe5a9('0x23')](util[_0xe5a9('0x26')](_0xe5a9('0x27'),_0x20e1a1,_0x127ca0*0x3e8,_0x3dd3da));};AGIChannel['prototype'][_0xe5a9('0x28')]=function(_0x20621a){_0x20621a=_0x20621a||'NO\x20MESSAGE';return this[_0xe5a9('0x23')](util['format'](_0xe5a9('0x29'),_0x20621a));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x2a')]=function(_0x3bd64b,_0x40f6dd){if(_[_0xe5a9('0x2b')](_0x40f6dd)){return this[_0xe5a9('0x23')](util[_0xe5a9('0x26')](_0xe5a9('0x2c'),_0x3bd64b,_0x40f6dd[_0xe5a9('0x2d')](',')));}return this['sendRequest'](util[_0xe5a9('0x26')](_0xe5a9('0x2c'),_0x3bd64b,_0x40f6dd));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x2e')]=function(_0x3fee13){return this[_0xe5a9('0x23')](util['format'](_0xe5a9('0x2f'),_0x3fee13));};AGIChannel['prototype'][_0xe5a9('0x30')]=function(_0x2aed39){return this[_0xe5a9('0x23')](util[_0xe5a9('0x26')](_0xe5a9('0x31'),_0x2aed39));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x32')]=function(_0x4e5986){return this[_0xe5a9('0x23')](util[_0xe5a9('0x26')](_0xe5a9('0x33'),_0x4e5986));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x34')]=function(){return this[_0xe5a9('0x23')]('HANGUP');};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x35')]=function(_0x57a896,_0x4d940e){var _0x2a6074=_[_0xe5a9('0x36')](_0x4d940e)||_[_0xe5a9('0x37')](_0x4d940e)?_0x4d940e[_0xe5a9('0x38')]():_0x4d940e;return this[_0xe5a9('0x23')](util[_0xe5a9('0x26')](_0xe5a9('0x39'),_0x57a896,_0x2a6074?_0x2a6074[_0xe5a9('0x38')]()[_0xe5a9('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x3a')]=function(_0x79f4dc,_0x2d6263){return this['sendRequest'](util['format'](_0xe5a9('0x3b'),_0x79f4dc,_0x2d6263));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x3c')]=function(_0x12fb65,_0x3716d3){return this['sendRequest'](util[_0xe5a9('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x12fb65,_0x3716d3));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x3d')]=function(_0x248c4c,_0x21ea4c){return this[_0xe5a9('0x23')](util[_0xe5a9('0x26')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x248c4c,_0x21ea4c));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x3e')]=function(_0x5d49ed,_0x24b0ce,_0xc5c13f){_0x24b0ce=_0x24b0ce||this[_0xe5a9('0x3f')];_0xc5c13f=_0xc5c13f||0x1;this[_0xe5a9('0x2e')](_0x5d49ed);this['setExtension'](_0x24b0ce);this['setPriority'](_0xc5c13f);return this[_0xe5a9('0x28')](util[_0xe5a9('0x26')](_0xe5a9('0x40'),_0x5d49ed,_0x24b0ce,_0xc5c13f));};AGIChannel[_0xe5a9('0x20')]['getVariable']=function(_0x28ebd7){return this[_0xe5a9('0x23')](util['format'](_0xe5a9('0x41'),_0x28ebd7));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x42')]=function(_0x13524e,_0xf8048b,_0x3b6eb1,_0x5e67dc,_0x25c9b9,_0x14b425){_0xf8048b=_0xf8048b||_0xe5a9('0x43');_0x3b6eb1=_0x3b6eb1||'';_0x5e67dc=_0x5e67dc===undefined?-0x1:_0x5e67dc==='-1'?-0x1:_0x5e67dc*0x3e8;_0x25c9b9=_0x25c9b9===undefined?'':'s='+_0x25c9b9;_0x14b425=_0x14b425?_0xe5a9('0x44'):'';return this[_0xe5a9('0x23')](util[_0xe5a9('0x26')](_0xe5a9('0x45'),_0x13524e,_0xf8048b,_0x3b6eb1,_0x5e67dc,_0x14b425,_0x25c9b9));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x46')]=function(_0x50bec6,_0xaf920a){_0xaf920a=_0xaf920a||'';return this[_0xe5a9('0x23')](util['format'](_0xe5a9('0x47'),_0x50bec6,_0xaf920a));};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x48')]=function(_0x4ada6b){return this[_0xe5a9('0x2a')]('AGI',_0x4ada6b);};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x49')]=function(_0x1061bd){return this[_0xe5a9('0x2a')]('WAIT',_0x1061bd);};AGIChannel[_0xe5a9('0x20')][_0xe5a9('0x17')]=function(_0x3d0338,_0x583323){this[_0xe5a9('0x28')](util[_0xe5a9('0x26')](_0xe5a9('0x4a'),_0x3d0338['id'],_0x3d0338[_0xe5a9('0x4b')],_0x583323));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe5a9('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index db7e92b..27b4295 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 _0x1ce9=['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.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.'];(function(_0x2c9956,_0x3fb838){var _0x503855=function(_0x5ba9b6){while(--_0x5ba9b6){_0x2c9956['push'](_0x2c9956['shift']());}};_0x503855(++_0x3fb838);}(_0x1ce9,0x10c));var _0x91ce=function(_0x4cd73d,_0x356ffb){_0x4cd73d=_0x4cd73d-0x0;var _0x2955fc=_0x1ce9[_0x4cd73d];return _0x2955fc;};'use strict';var util=require(_0x91ce('0x0'));var error={'E_AGI_UNDEFINED':_0x91ce('0x1'),'E_AGI_ARGUMENT_PORT':_0x91ce('0x2'),'E_AGI_SERVER_ERROR':_0x91ce('0x3'),'E_AGI_SERVER_CLOSE':_0x91ce('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x91ce('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x91ce('0x6'),'E_AGI_SOCKET_ERROR':_0x91ce('0x7'),'E_AGI_SOCKET_CLOSE':_0x91ce('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x91ce('0x9'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x91ce('0xa'),'E_AGI_IVR_ENTRY':_0x91ce('0xb')};function AGIError(_0x1213c7){var _0x1213c7=_0x1213c7||null,_0x44021a=_0x44021a||[],_0x4a0a1c=0x1,_0x74804='';if(!error[_0x1213c7]){_0x1213c7=_0x91ce('0xc');}_0x44021a[_0x91ce('0xd')](error[_0x1213c7]);while(arguments[_0x4a0a1c]){_0x44021a['push'](arguments[_0x4a0a1c]);_0x4a0a1c++;}_0x74804=util['format'][_0x91ce('0xe')](util,_0x44021a);this[_0x91ce('0xf')]=_0x74804;this[_0x91ce('0x10')]=_0x1213c7;}module[_0x91ce('0x11')]=AGIError; \ No newline at end of file +var _0x0dee=['message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply'];(function(_0x4cb83a,_0x3b86e3){var _0x26031f=function(_0x362cef){while(--_0x362cef){_0x4cb83a['push'](_0x4cb83a['shift']());}};_0x26031f(++_0x3b86e3);}(_0x0dee,0xed));var _0xe0de=function(_0x15ef8f,_0x2dbe55){_0x15ef8f=_0x15ef8f-0x0;var _0x401d71=_0x0dee[_0x15ef8f];return _0x401d71;};'use strict';var util=require(_0xe0de('0x0'));var error={'E_AGI_UNDEFINED':_0xe0de('0x1'),'E_AGI_ARGUMENT_PORT':_0xe0de('0x2'),'E_AGI_SERVER_ERROR':_0xe0de('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xe0de('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xe0de('0x5'),'E_AGI_SOCKET_ERROR':_0xe0de('0x6'),'E_AGI_SOCKET_CLOSE':_0xe0de('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xe0de('0x8'),'E_AGI_COMMAND_EMPTY':_0xe0de('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe0de('0xa'),'E_AGI_IVR_ENTRY':_0xe0de('0xb')};function AGIError(_0x379ac9){var _0x379ac9=_0x379ac9||null,_0x4db4ef=_0x4db4ef||[],_0x440a0d=0x1,_0x403f0b='';if(!error[_0x379ac9]){_0x379ac9='E_AGI_UNDEFINED';}_0x4db4ef[_0xe0de('0xc')](error[_0x379ac9]);while(arguments[_0x440a0d]){_0x4db4ef[_0xe0de('0xc')](arguments[_0x440a0d]);_0x440a0d++;}_0x403f0b=util[_0xe0de('0xd')][_0xe0de('0xe')](util,_0x4db4ef);this[_0xe0de('0xf')]=_0x403f0b;this[_0xe0de('0x10')]=_0x379ac9;}module[_0xe0de('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 d4fa127..1f76152 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 _0x3f77=['menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','relations','info','no\x20vertex\x20found','stop\x20traverse','length','condition','vswitch','target','default','agicommand','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger'];(function(_0x3da3be,_0x3cd879){var _0x220f4f=function(_0x1bb553){while(--_0x1bb553){_0x3da3be['push'](_0x3da3be['shift']());}};_0x220f4f(++_0x3cd879);}(_0x3f77,0x103));var _0x73f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f77[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73f7('0x0'));var logger=require(_0x73f7('0x1'))('agi');var verticesWithRetry=[_0x73f7('0x2'),_0x73f7('0x3'),_0x73f7('0x4')];var Graph=function(){this[_0x73f7('0x5')]={};this[_0x73f7('0x6')]={};this[_0x73f7('0x7')]=0x0;};Graph[_0x73f7('0x8')]['addVertex']=function(_0xad6dd8){this['vertices'][_0xad6dd8['id']]=_0xad6dd8;this[_0x73f7('0x6')][_0xad6dd8['id']]=[];};Graph[_0x73f7('0x8')][_0x73f7('0x9')]=function(_0x2cbcc8,_0x2f6b13,_0x4c89c7){this['edges'][_0x2cbcc8][_0x73f7('0xa')]({'target':_0x2f6b13,'condition':_0x4c89c7});this['numberOfEdges']+=0x1;};Graph['prototype'][_0x73f7('0xb')]=function(){return _[_0x73f7('0xb')](this[_0x73f7('0x5')]);};Graph['prototype'][_0x73f7('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x73f7('0x8')]['getVertex']=function(_0xa0f270){return this[_0x73f7('0x5')][_0xa0f270];};Graph[_0x73f7('0x8')]['traverseBFS']=function(_0x49ed98,_0x3f4e5a){if(!this[_0x73f7('0x5')][_0x49ed98]){return logger[_0x73f7('0xd')](_0x73f7('0xe'));}var _0x321ec0=_0x3f4e5a(this[_0x73f7('0x5')][_0x49ed98]);if(!_0x321ec0){return logger[_0x73f7('0xd')](_0x73f7('0xf'));}if(this[_0x73f7('0x6')][_0x49ed98][_0x73f7('0x10')]===0x0){return logger[_0x73f7('0xd')]('no\x20edge/s\x20available');}for(var _0x20347c=0x0,_0x5eb974=[],_0x3c8eb2=![];_0x20347c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','mxCell','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','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\x20published','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','format','[%s]\x20%s','name','[ERROR]\x20%s','calleridname','callerid','dnid','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup'];(function(_0x33de6e,_0x483020){var _0x20b705=function(_0x476648){while(--_0x476648){_0x33de6e['push'](_0x33de6e['shift']());}};_0x20b705(++_0x483020);}(_0xf1db,0x8d));var _0xbf1d=function(_0x8f5037,_0x3c7139){_0x8f5037=_0x8f5037-0x0;var _0x26fd81=_0xf1db[_0x8f5037];return _0x26fd81;};'use strict';var parser=require(_0xbf1d('0x0'));var _=require('lodash');var syncho=require(_0xbf1d('0x1'));var util=require(_0xbf1d('0x2'));var moment=require('moment');var config=require(_0xbf1d('0x3'));var logger=require(_0xbf1d('0x4'))(_0xbf1d('0x5'));var utilLicense=require(_0xbf1d('0x6'));var rpc=require('./rpc');var mailRpc=require(_0xbf1d('0x7'));var Graph=require(_0xbf1d('0x8'));var Vertices=require(_0xbf1d('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xbf1d('0x5')]=_[_0xbf1d('0xa')](config[_0xbf1d('0x5')],{'ip':_0xbf1d('0xb'),'port':0x11dd});function connectionHandler(_0x2848ed){process[_0xbf1d('0xc')](function(){syncho(function(){try{setChannelVariables(_0x2848ed);agiHandler(_0x2848ed);}catch(_0x52aad2){logger[_0xbf1d('0xd')](_0x52aad2[_0xbf1d('0xe')]);}});});}function listeningHandler(){console['log'](_0xbf1d('0xf'),config[_0xbf1d('0x5')][_0xbf1d('0x10')]);logger[_0xbf1d('0x11')](util['format'](_0xbf1d('0x12'),config['agi']['ip'],config[_0xbf1d('0x5')][_0xbf1d('0x10')]));}function errorHandler(_0x5f5154){if(_0x5f5154&&_0x5f5154['name']&&_0x5f5154[_0xbf1d('0x13')]){logger[_0xbf1d('0xd')](util[_0xbf1d('0x14')](_0xbf1d('0x15'),_0x5f5154[_0xbf1d('0x16')],_0x5f5154[_0xbf1d('0x13')]));}else{logger[_0xbf1d('0xd')](util[_0xbf1d('0x14')](_0xbf1d('0x17'),_0x5f5154[_0xbf1d('0xe')]));}}function closeHandler(){logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xbf1d('0x18')],this[_0xbf1d('0x19')],this[_0xbf1d('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5b0841){logger[_0xbf1d('0xd')](_0x5b0841[_0xbf1d('0xe')]);}}function timeoutHandler(){logger['info'](util[_0xbf1d('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xbf1d('0x1b')],this['calleridname'],this[_0xbf1d('0x19')],this['dnid'],this[_0xbf1d('0x1c')]));}function hangupHandler(){logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x1d'),this['arg_1'],this['calleridname'],this[_0xbf1d('0x19')],this[_0xbf1d('0x1a')],this[_0xbf1d('0x1c')]));this[_0xbf1d('0x1e')]=!![];}function getRoot(_0xe5b178){return parser[_0xbf1d('0x1f')](_0xe5b178,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x540e0b,_0x37bd3c,_0x2f49df){_0x37bd3c[_0xbf1d('0x20')]=_0x2f49df;if(_0x37bd3c[_0xbf1d('0x21')]('retry')){_0x37bd3c[_0xbf1d('0x22')]=parseInt(_0x37bd3c['retry'],0xa);}_0x540e0b[_0xbf1d('0x23')](_[_0xbf1d('0x24')](_0x37bd3c,'mxCell'));}function initGraph(_0x3cfeb7,_0x52752d){var _0x31db77=new Graph();for(var _0x5a5fb2 in _0x3cfeb7){if(_0x3cfeb7[_0xbf1d('0x21')](_0x5a5fb2)){if(_[_0xbf1d('0x25')](_0x3cfeb7[_0x5a5fb2])){for(var _0x5c5074=0x0;_0x5c5074<_0x3cfeb7[_0x5a5fb2]['length'];_0x5c5074+=0x1){addVertex(_0x31db77,_0x3cfeb7[_0x5a5fb2][_0x5c5074],_0x5a5fb2);}}else{addVertex(_0x31db77,_0x3cfeb7[_0x5a5fb2],_0x5a5fb2);}}}for(var _0x236800=0x0;_0x236800<_0x52752d[_0xbf1d('0x26')];_0x236800+=0x1){if(_0x52752d[_0x236800][_0xbf1d('0x27')]&&_0x52752d[_0x236800][_0xbf1d('0x28')]){_0x31db77['addEdge'](_0x52752d[_0x236800]['source'],_0x52752d[_0x236800]['target'],_0x52752d[_0x236800][_0xbf1d('0x29')]);}}return _0x31db77;}function getSquareProject(_0x4b54e7,_0x13dceb){rpc[_0xbf1d('0x2a')](_0x4b54e7)[_0xbf1d('0x2b')](function(_0x4ff506){_0x13dceb(null,_0x4ff506);})['catch'](function(_0x5e8b1b){_0x13dceb(null,_0x5e8b1b);});}function createSquareReport(_0xd862ef,_0xa64bee){rpc[_0xbf1d('0x2c')](_0xd862ef)['then'](function(_0x9351b7){if(_0xa64bee){_0xa64bee(null,_0x9351b7);}})['catch'](function(_0x275ebf){if(_0xa64bee){_0xa64bee(null,_0x275ebf);}});}function setChannelVariables(_0x17e15f){for(var _0x402e93 in _0x17e15f){if(_0x17e15f[_0xbf1d('0x21')](_0x402e93)){if(_0x402e93['indexOf'](_0xbf1d('0x2d'))===0x0){_0x17e15f[_0x402e93[_0xbf1d('0x2e')](0x4)]=_0x17e15f[_0x402e93];delete _0x17e15f[_0x402e93];}}}}function getLogFromObject(_0x2e4279){return util[_0xbf1d('0x2f')](_0x2e4279,{'showHidden':![],'depth':null});}function agiHandler(_0x3260c3){var _0x3d9d6f,_0x14cf3e,_0x2ba923,_0x3a104f,_0xa1356f;logger[_0xbf1d('0x30')]('variables',JSON[_0xbf1d('0x31')](_0x3260c3,null,0x2));logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x32'),_0x3260c3[_0xbf1d('0x1b')],_0x3260c3[_0xbf1d('0x18')],_0x3260c3[_0xbf1d('0x19')],_0x3260c3[_0xbf1d('0x1a')],_0x3260c3[_0xbf1d('0x1c')]));_0x3260c3['on'](_0xbf1d('0xd'),errorHandler);_0x3260c3['on'](_0xbf1d('0x33'),closeHandler);_0x3260c3['on'](_0xbf1d('0x34'),timeoutHandler);_0x3260c3[_0xbf1d('0x1e')]=![];_0x3260c3['on'](_0xbf1d('0x35'),hangupHandler);var _0x4dffde=getSquareProject[_0xbf1d('0x36')](null,_0x3260c3[_0xbf1d('0x1b')]);if(_0x4dffde){if(_0x4dffde[_0xbf1d('0x37')]){_0x3d9d6f=getRoot(_0x4dffde[_0xbf1d('0x37')]);if(_0x3d9d6f&&_0x3d9d6f[_0xbf1d('0x38')]){logger[_0xbf1d('0x30')]('root',JSON['stringify'](_0x3d9d6f,null,0x2));_0x3260c3[_0xbf1d('0x39')]=moment()[_0xbf1d('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x14cf3e=initGraph(_[_0xbf1d('0x24')](_0x3d9d6f,_0xbf1d('0x3a')),_0x3d9d6f[_0xbf1d('0x3a')]);_0x2ba923=new Vertices(_0x3260c3,rpc,mailRpc);logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3260c3['arg_1'],_0x3260c3['calleridname'],_0x3260c3[_0xbf1d('0x19')],_0x3260c3['dnid'],_0x3260c3[_0xbf1d('0x1c')]));_0x14cf3e['traverseBFS'](_0x3d9d6f['start']['id'],function(_0x6a5a72){try{_0x6a5a72=_0x2ba923[_0xbf1d('0x3b')](_0x6a5a72);logger['debug']('vertex',JSON[_0xbf1d('0x31')](_0x6a5a72,null,0x2));if(_0x6a5a72['agicommand']===_0xbf1d('0x3c')){logger[_0xbf1d('0x11')](_0xbf1d('0x3d'));_0x3260c3[_0xbf1d('0x3e')]=_0x6a5a72['context']||_0x3260c3[_0xbf1d('0x3e')];_0x3260c3[_0xbf1d('0x3f')]=_0x6a5a72[_0xbf1d('0x3f')];_0x3260c3['priority']=_0x6a5a72[_0xbf1d('0x40')]?_0x6a5a72[_0xbf1d('0x40')]-0x1:0x1;return null;}else if(_0x6a5a72&&_0x2ba923[_0x6a5a72[_0xbf1d('0x20')]]){_0xa1356f=_0x2ba923[_0x6a5a72[_0xbf1d('0x20')]](_0x6a5a72);logger[_0xbf1d('0x11')](_0xbf1d('0x41'),JSON[_0xbf1d('0x31')](_0xa1356f,null,0x2));if(_0xa1356f&&_0xa1356f['code']===AGI_CODE_SUCCESS&&_0xa1356f['result']!==AGI_RESULT_ERROR&&!_0x3260c3[_0xbf1d('0x1e')]){logger[_0xbf1d('0x30')](_0xbf1d('0x41'),getLogFromObject(_0xa1356f));return _[_0xbf1d('0x42')](_0xa1356f['result'])?null:_0xa1356f[_0xbf1d('0x43')]['toString']();}else{logger[_0xbf1d('0xd')](_0xbf1d('0x41'),getLogFromObject(_0xa1356f));return null;}}else{logger[_0xbf1d('0xd')](_0xbf1d('0x44'));return null;}}catch(_0x4f1130){logger[_0xbf1d('0xd')](_0x4f1130['stack']);return null;}});if(_0x3d9d6f[_0xbf1d('0x45')]){logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x46'),_0x3260c3[_0xbf1d('0x1b')],_0x3260c3[_0xbf1d('0x18')],_0x3260c3[_0xbf1d('0x19')],_0x3260c3[_0xbf1d('0x1a')],_0x3260c3['uniqueid']));_0x14cf3e[_0xbf1d('0x47')](_0x3d9d6f[_0xbf1d('0x45')]['id'],function(_0xdb4efa){try{_0xdb4efa=_0x2ba923[_0xbf1d('0x3b')](_0xdb4efa);logger[_0xbf1d('0x30')]('vertex',JSON[_0xbf1d('0x31')](_0xdb4efa,null,0x2));if(_0xdb4efa&&_0x2ba923[_0xdb4efa[_0xbf1d('0x20')]]){_0xa1356f=_0x2ba923[_0xdb4efa['agicommand']](_0xdb4efa);if(_0xa1356f){logger[_0xbf1d('0x30')](_0xbf1d('0x41'),getLogFromObject(_0xa1356f));return _['isUndefined'](_0xa1356f['result'])?null:_0xa1356f[_0xbf1d('0x43')][_0xbf1d('0x48')]();}else{logger[_0xbf1d('0xd')](_0xbf1d('0x41'),getLogFromObject(_0xa1356f));return null;}}else{logger['error'](_0xbf1d('0x44'));return null;}}catch(_0x1fb139){logger['error'](_0x1fb139[_0xbf1d('0xe')]);return null;}});}logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x49'),_0x3260c3['arg_1'],_0x3260c3[_0xbf1d('0x18')],_0x3260c3['callerid'],_0x3260c3['dnid'],_0x3260c3[_0xbf1d('0x1c')]));logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x4a'),_0x3260c3[_0xbf1d('0x3e')],_0x3260c3['extension'],parseInt(_0x3260c3[_0xbf1d('0x40')],0xa)+0x1));_0x3260c3[_0xbf1d('0x4b')](_0x3260c3[_0xbf1d('0x3e')],_0x3260c3[_0xbf1d('0x3f')],parseInt(_0x3260c3[_0xbf1d('0x40')],0xa)+0x1);_0x3260c3['close']();}}else{logger[_0xbf1d('0xd')](util[_0xbf1d('0x14')](_0xbf1d('0x4c'),_0x3260c3[_0xbf1d('0x1b')]));_0x3260c3[_0xbf1d('0x4b')](_0x3260c3['context'],_0x3260c3['extension'],parseInt(_0x3260c3[_0xbf1d('0x40')],0xa)+0x1);_0x3260c3['close']();}}else{logger[_0xbf1d('0xd')](util[_0xbf1d('0x14')]('Project\x20%s\x20not\x20found',_0x3260c3[_0xbf1d('0x1b')]));_0x3260c3[_0xbf1d('0x4b')](_0x3260c3[_0xbf1d('0x3e')],_0x3260c3[_0xbf1d('0x3f')],parseInt(_0x3260c3[_0xbf1d('0x40')],0xa)+0x1);_0x3260c3['close']();}}function main(){var _0x569c57;return utilLicense['getLicense']()[_0xbf1d('0x2b')](function(_0x10f1c0){if(_0x10f1c0){if(_0x10f1c0[_0xbf1d('0x4d')]){if(_0x10f1c0['callysquare']&&_0x10f1c0[_0xbf1d('0x4e')]>0x0){logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x4f'),_0x10f1c0[_0xbf1d('0x4e')]));_0x569c57=_0x10f1c0['callysquare'];}else{logger[_0xbf1d('0x11')](_0xbf1d('0x50'));}}else{logger[_0xbf1d('0x11')](_0xbf1d('0x51'));_0x569c57=-0x1;}}})['catch'](function(_0x4e079b){logger[_0xbf1d('0xd')](_0xbf1d('0x52'),_0x4e079b[_0xbf1d('0xe')]);})[_0xbf1d('0x45')](function(){var _0x175bb4=require(_0xbf1d('0x53'))(config[_0xbf1d('0x5')][_0xbf1d('0x10')],config['agi']['ip'],_0x569c57);_0x175bb4['on']('error',errorHandler);_0x175bb4['on'](_0xbf1d('0x54'),listeningHandler);_0x175bb4['on'](_0xbf1d('0x55'),connectionHandler);_0x175bb4['on'](_0xbf1d('0x33'),closeHandler);});}main(); \ No newline at end of file +var _0x7514=['port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[ERROR]\x20%s','calleridname','callerid','dnid','uniqueid','stack','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','catch','indexOf','agi_','substring','inspect','debug','stringify','close','timeout','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','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/logger','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log'];(function(_0x4f629e,_0x2902a1){var _0x368622=function(_0x154be7){while(--_0x154be7){_0x4f629e['push'](_0x4f629e['shift']());}};_0x368622(++_0x2902a1);}(_0x7514,0x168));var _0x4751=function(_0x4ba888,_0x4c2dbc){_0x4ba888=_0x4ba888-0x0;var _0x1edec2=_0x7514[_0x4ba888];return _0x1edec2;};'use strict';var parser=require(_0x4751('0x0'));var _=require(_0x4751('0x1'));var syncho=require(_0x4751('0x2'));var util=require(_0x4751('0x3'));var moment=require(_0x4751('0x4'));var config=require('../../config/environment');var logger=require(_0x4751('0x5'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0x4751('0x6'));var mailRpc=require(_0x4751('0x7'));var Graph=require(_0x4751('0x8'));var Vertices=require(_0x4751('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x4751('0xa')]=_[_0x4751('0xb')](config[_0x4751('0xa')],{'ip':_0x4751('0xc'),'port':0x11dd});function connectionHandler(_0x1a268e){process[_0x4751('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1a268e);agiHandler(_0x1a268e);}catch(_0x172f25){logger[_0x4751('0xe')](_0x172f25['stack']);}});});}function listeningHandler(){console[_0x4751('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x4751('0xa')][_0x4751('0x10')]);logger[_0x4751('0x11')](util['format'](_0x4751('0x12'),config['agi']['ip'],config[_0x4751('0xa')]['port']));}function errorHandler(_0x3b55f7){if(_0x3b55f7&&_0x3b55f7[_0x4751('0x13')]&&_0x3b55f7[_0x4751('0x14')]){logger[_0x4751('0xe')](util[_0x4751('0x15')](_0x4751('0x16'),_0x3b55f7[_0x4751('0x13')],_0x3b55f7[_0x4751('0x14')]));}else{logger[_0x4751('0xe')](util['format'](_0x4751('0x17'),_0x3b55f7['stack']));}}function closeHandler(){logger[_0x4751('0x11')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x4751('0x18')],this[_0x4751('0x19')],this[_0x4751('0x1a')],this[_0x4751('0x1b')]));try{createSquareReport(this);}catch(_0x455984){logger[_0x4751('0xe')](_0x455984[_0x4751('0x1c')]);}}function timeoutHandler(){logger['info'](util[_0x4751('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4751('0x1d')],this[_0x4751('0x18')],this[_0x4751('0x19')],this[_0x4751('0x1a')],this[_0x4751('0x1b')]));}function hangupHandler(){logger[_0x4751('0x11')](util[_0x4751('0x15')](_0x4751('0x1e'),this[_0x4751('0x1d')],this[_0x4751('0x18')],this['callerid'],this['dnid'],this[_0x4751('0x1b')]));this[_0x4751('0x1f')]=!![];}function getRoot(_0x3f573a){return parser[_0x4751('0x20')](_0x3f573a,{'object':!![]})['mxGraphModel'][_0x4751('0x21')];}function addVertex(_0x447f4a,_0x254b2e,_0x2f779a){_0x254b2e[_0x4751('0x22')]=_0x2f779a;if(_0x254b2e[_0x4751('0x23')](_0x4751('0x24'))){_0x254b2e[_0x4751('0x25')]=parseInt(_0x254b2e['retry'],0xa);}_0x447f4a[_0x4751('0x26')](_[_0x4751('0x27')](_0x254b2e,_0x4751('0x28')));}function initGraph(_0x566c7e,_0x28df6e){var _0x550041=new Graph();for(var _0x193e9d in _0x566c7e){if(_0x566c7e[_0x4751('0x23')](_0x193e9d)){if(_[_0x4751('0x29')](_0x566c7e[_0x193e9d])){for(var _0x2a62c3=0x0;_0x2a62c3<_0x566c7e[_0x193e9d]['length'];_0x2a62c3+=0x1){addVertex(_0x550041,_0x566c7e[_0x193e9d][_0x2a62c3],_0x193e9d);}}else{addVertex(_0x550041,_0x566c7e[_0x193e9d],_0x193e9d);}}}for(var _0x2d0503=0x0;_0x2d0503<_0x28df6e[_0x4751('0x2a')];_0x2d0503+=0x1){if(_0x28df6e[_0x2d0503][_0x4751('0x2b')]&&_0x28df6e[_0x2d0503][_0x4751('0x2c')]){_0x550041[_0x4751('0x2d')](_0x28df6e[_0x2d0503][_0x4751('0x2b')],_0x28df6e[_0x2d0503][_0x4751('0x2c')],_0x28df6e[_0x2d0503][_0x4751('0x2e')]);}}return _0x550041;}function getSquareProject(_0x550eca,_0x26fc4b){rpc[_0x4751('0x2f')](_0x550eca)['then'](function(_0x2762c0){_0x26fc4b(null,_0x2762c0);})['catch'](function(_0xb0f278){_0x26fc4b(null,_0xb0f278);});}function createSquareReport(_0x146b8b,_0x431a25){rpc['createSquareReport'](_0x146b8b)['then'](function(_0xa4a468){if(_0x431a25){_0x431a25(null,_0xa4a468);}})[_0x4751('0x30')](function(_0x14f6ab){if(_0x431a25){_0x431a25(null,_0x14f6ab);}});}function setChannelVariables(_0x5a5206){for(var _0x25f9bf in _0x5a5206){if(_0x5a5206[_0x4751('0x23')](_0x25f9bf)){if(_0x25f9bf[_0x4751('0x31')](_0x4751('0x32'))===0x0){_0x5a5206[_0x25f9bf[_0x4751('0x33')](0x4)]=_0x5a5206[_0x25f9bf];delete _0x5a5206[_0x25f9bf];}}}}function getLogFromObject(_0x469f50){return util[_0x4751('0x34')](_0x469f50,{'showHidden':![],'depth':null});}function agiHandler(_0x294db0){var _0xba2f45,_0x318f57,_0x1dfe77,_0x2dce86,_0x3c1b94;logger[_0x4751('0x35')]('variables',JSON[_0x4751('0x36')](_0x294db0,null,0x2));logger[_0x4751('0x11')](util[_0x4751('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x294db0[_0x4751('0x1d')],_0x294db0[_0x4751('0x18')],_0x294db0['callerid'],_0x294db0[_0x4751('0x1a')],_0x294db0['uniqueid']));_0x294db0['on'](_0x4751('0xe'),errorHandler);_0x294db0['on'](_0x4751('0x37'),closeHandler);_0x294db0['on'](_0x4751('0x38'),timeoutHandler);_0x294db0['evtHangup']=![];_0x294db0['on']('hangup',hangupHandler);var _0x2b300a=getSquareProject[_0x4751('0x39')](null,_0x294db0['arg_1']);if(_0x2b300a){if(_0x2b300a[_0x4751('0x3a')]){_0xba2f45=getRoot(_0x2b300a[_0x4751('0x3a')]);if(_0xba2f45&&_0xba2f45[_0x4751('0x3b')]){logger[_0x4751('0x35')](_0x4751('0x21'),JSON[_0x4751('0x36')](_0xba2f45,null,0x2));_0x294db0[_0x4751('0x3c')]=moment()['format'](_0x4751('0x3d'));_0x318f57=initGraph(_[_0x4751('0x27')](_0xba2f45,_0x4751('0x28')),_0xba2f45[_0x4751('0x28')]);_0x1dfe77=new Vertices(_0x294db0,rpc,mailRpc);logger[_0x4751('0x11')](util[_0x4751('0x15')](_0x4751('0x3e'),_0x294db0[_0x4751('0x1d')],_0x294db0[_0x4751('0x18')],_0x294db0[_0x4751('0x19')],_0x294db0['dnid'],_0x294db0[_0x4751('0x1b')]));_0x318f57[_0x4751('0x3f')](_0xba2f45['start']['id'],function(_0xba89b2){try{_0xba89b2=_0x1dfe77[_0x4751('0x40')](_0xba89b2);logger[_0x4751('0x35')](_0x4751('0x41'),JSON[_0x4751('0x36')](_0xba89b2,null,0x2));if(_0xba89b2['agicommand']==='gotoc'){logger['info'](_0x4751('0x42'));_0x294db0[_0x4751('0x43')]=_0xba89b2[_0x4751('0x43')]||_0x294db0['context'];_0x294db0['extension']=_0xba89b2[_0x4751('0x44')];_0x294db0['priority']=_0xba89b2[_0x4751('0x45')]?_0xba89b2[_0x4751('0x45')]-0x1:0x1;return null;}else if(_0xba89b2&&_0x1dfe77[_0xba89b2[_0x4751('0x22')]]){_0x3c1b94=_0x1dfe77[_0xba89b2[_0x4751('0x22')]](_0xba89b2);logger[_0x4751('0x11')](_0x4751('0x46'),JSON[_0x4751('0x36')](_0x3c1b94,null,0x2));if(_0x3c1b94&&_0x3c1b94[_0x4751('0x47')]===AGI_CODE_SUCCESS&&_0x3c1b94[_0x4751('0x48')]!==AGI_RESULT_ERROR&&!_0x294db0[_0x4751('0x1f')]){logger[_0x4751('0x35')]('response',getLogFromObject(_0x3c1b94));return _[_0x4751('0x49')](_0x3c1b94[_0x4751('0x48')])?null:_0x3c1b94[_0x4751('0x48')][_0x4751('0x4a')]();}else{logger[_0x4751('0xe')](_0x4751('0x46'),getLogFromObject(_0x3c1b94));return null;}}else{logger['error'](_0x4751('0x4b'));return null;}}catch(_0x1a46cf){logger['error'](_0x1a46cf[_0x4751('0x1c')]);return null;}});if(_0xba2f45[_0x4751('0x4c')]){logger[_0x4751('0x11')](util[_0x4751('0x15')](_0x4751('0x4d'),_0x294db0[_0x4751('0x1d')],_0x294db0['calleridname'],_0x294db0['callerid'],_0x294db0[_0x4751('0x1a')],_0x294db0[_0x4751('0x1b')]));_0x318f57[_0x4751('0x3f')](_0xba2f45[_0x4751('0x4c')]['id'],function(_0xa22c72){try{_0xa22c72=_0x1dfe77[_0x4751('0x40')](_0xa22c72);logger[_0x4751('0x35')](_0x4751('0x41'),JSON[_0x4751('0x36')](_0xa22c72,null,0x2));if(_0xa22c72&&_0x1dfe77[_0xa22c72[_0x4751('0x22')]]){_0x3c1b94=_0x1dfe77[_0xa22c72[_0x4751('0x22')]](_0xa22c72);if(_0x3c1b94){logger[_0x4751('0x35')](_0x4751('0x46'),getLogFromObject(_0x3c1b94));return _[_0x4751('0x49')](_0x3c1b94[_0x4751('0x48')])?null:_0x3c1b94[_0x4751('0x48')][_0x4751('0x4a')]();}else{logger[_0x4751('0xe')](_0x4751('0x46'),getLogFromObject(_0x3c1b94));return null;}}else{logger['error'](_0x4751('0x4b'));return null;}}catch(_0x51e498){logger[_0x4751('0xe')](_0x51e498['stack']);return null;}});}logger['info'](util[_0x4751('0x15')](_0x4751('0x4e'),_0x294db0[_0x4751('0x1d')],_0x294db0[_0x4751('0x18')],_0x294db0[_0x4751('0x19')],_0x294db0[_0x4751('0x1a')],_0x294db0[_0x4751('0x1b')]));logger[_0x4751('0x11')](util['format'](_0x4751('0x4f'),_0x294db0[_0x4751('0x43')],_0x294db0[_0x4751('0x44')],parseInt(_0x294db0[_0x4751('0x45')],0xa)+0x1));_0x294db0['continueAt'](_0x294db0[_0x4751('0x43')],_0x294db0[_0x4751('0x44')],parseInt(_0x294db0[_0x4751('0x45')],0xa)+0x1);_0x294db0[_0x4751('0x37')]();}}else{logger['error'](util[_0x4751('0x15')](_0x4751('0x50'),_0x294db0['arg_1']));_0x294db0[_0x4751('0x51')](_0x294db0[_0x4751('0x43')],_0x294db0[_0x4751('0x44')],parseInt(_0x294db0['priority'],0xa)+0x1);_0x294db0[_0x4751('0x37')]();}}else{logger[_0x4751('0xe')](util['format'](_0x4751('0x52'),_0x294db0[_0x4751('0x1d')]));_0x294db0['continueAt'](_0x294db0[_0x4751('0x43')],_0x294db0[_0x4751('0x44')],parseInt(_0x294db0[_0x4751('0x45')],0xa)+0x1);_0x294db0[_0x4751('0x37')]();}}function main(){var _0x32ec27;return utilLicense[_0x4751('0x53')]()[_0x4751('0x54')](function(_0x2a2a91){if(_0x2a2a91){if(_0x2a2a91[_0x4751('0x55')]){if(_0x2a2a91[_0x4751('0x56')]&&_0x2a2a91[_0x4751('0x56')]>0x0){logger[_0x4751('0x11')](util['format'](_0x4751('0x57'),_0x2a2a91[_0x4751('0x56')]));_0x32ec27=_0x2a2a91['callysquare'];}else{logger[_0x4751('0x11')](_0x4751('0x58'));}}else{logger[_0x4751('0x11')](_0x4751('0x59'));_0x32ec27=-0x1;}}})['catch'](function(_0xaa4191){logger[_0x4751('0xe')](_0x4751('0x5a'),_0xaa4191[_0x4751('0x1c')]);})['finally'](function(){var _0x4a3fb0=require(_0x4751('0x5b'))(config[_0x4751('0xa')][_0x4751('0x10')],config[_0x4751('0xa')]['ip'],_0x32ec27);_0x4a3fb0['on'](_0x4751('0xe'),errorHandler);_0x4a3fb0['on'](_0x4751('0x5c'),listeningHandler);_0x4a3fb0['on'](_0x4751('0x5d'),connectionHandler);_0x4a3fb0['on'](_0x4751('0x37'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 2f1c112..dfb0ba3 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 _0xa34c=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','sendMailMessage'];(function(_0x22b671,_0x150a2a){var _0x4bd474=function(_0x4e9236){while(--_0x4e9236){_0x22b671['push'](_0x22b671['shift']());}};_0x4bd474(++_0x150a2a);}(_0xa34c,0x16c));var _0xca34=function(_0x94e69,_0x41892b){_0x94e69=_0x94e69-0x0;var _0x415667=_0xa34c[_0x94e69];return _0x415667;};'use strict';var BPromise=require(_0xca34('0x0'));var jayson=require(_0xca34('0x1'));var client=jayson[_0xca34('0x2')][_0xca34('0x3')]({'port':0x232b});function request(_0x5f0126,_0x312be6){return new BPromise(function(_0xc83c5a,_0xe7369f){return client[_0xca34('0x4')](_0x5f0126,_0x312be6)[_0xca34('0x5')](function(_0x4e5c1c){if(_0x4e5c1c[_0xca34('0x6')]){return _0xe7369f(_0x4e5c1c[_0xca34('0x6')][_0xca34('0x7')]);}else{return _0xc83c5a(_0x4e5c1c[_0xca34('0x8')]);}})['catch'](function(_0x4313f2){return _0xe7369f(_0x4313f2);});});}exports[_0xca34('0x9')]=function(_0x5c32e3,_0x233124){return request(_0xca34('0xa'),{'account':_0x5c32e3,'message':_0x233124});}; \ No newline at end of file +var _0xca24=['bluebird','jayson/promise','client','http','request','then','error','message','result','catch','SendMail'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xca24,0x160));var _0x4ca2=function(_0x7a0e4b,_0x1eda4e){_0x7a0e4b=_0x7a0e4b-0x0;var _0xd5faa8=_0xca24[_0x7a0e4b];return _0xd5faa8;};'use strict';var BPromise=require(_0x4ca2('0x0'));var jayson=require(_0x4ca2('0x1'));var client=jayson[_0x4ca2('0x2')][_0x4ca2('0x3')]({'port':0x232b});function request(_0x50f5c8,_0x120b9e){return new BPromise(function(_0x2b1bdd,_0x4aa92e){return client[_0x4ca2('0x4')](_0x50f5c8,_0x120b9e)[_0x4ca2('0x5')](function(_0x459697){if(_0x459697[_0x4ca2('0x6')]){return _0x4aa92e(_0x459697[_0x4ca2('0x6')][_0x4ca2('0x7')]);}else{return _0x2b1bdd(_0x459697[_0x4ca2('0x8')]);}})[_0x4ca2('0x9')](function(_0x50b775){return _0x4aa92e(_0x50b775);});});}exports['sendMailMessage']=function(_0x54fa76,_0x2b48a4){return request(_0x4ca2('0xa'),{'account':_0x54fa76,'message':_0x2b48a4});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index f6e9d22..3cc3f3b 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 _0xb36c=['Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','substring','length','slice','trim','emit','headers','indexOf','line','exports','util','stream'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0xb36c,0xbc));var _0xcb36=function(_0x21045c,_0x52f950){_0x21045c=_0x21045c-0x0;var _0x2daa90=_0xb36c[_0x21045c];return _0x2daa90;};'use strict';var util=require(_0xcb36('0x0'));var Transform=require(_0xcb36('0x1'))[_0xcb36('0x2')];function AGIReply(_0x59f54b){Transform[_0xcb36('0x3')](this,_0x59f54b);this[_0xcb36('0x4')]='';this[_0xcb36('0x5')]=![];}util[_0xcb36('0x6')](AGIReply,Transform);AGIReply[_0xcb36('0x7')][_0xcb36('0x8')]=function(_0x195a5c,_0x244084,_0x4879d1){var _0x431871='\x0a',_0x55e7ab=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x474816=-0x1,_0x2e8cc1=-0x1,_0x113ab6='',_0x557f17=0x0,_0xc3ce11='',_0x2cf78a='';this[_0xcb36('0x4')]+=_0x195a5c[_0xcb36('0x9')]();_0xc3ce11=this[_0xcb36('0x4')];if(!this[_0xcb36('0x5')]){_0x557f17=0x0;while(_0x55e7ab[_0x557f17]){while((_0x2e8cc1=_0xc3ce11['indexOf'](_0x55e7ab[_0x557f17]))!=-0x1){_0x113ab6=_0x55e7ab[_0x557f17];_0x2cf78a=_0xc3ce11[_0xcb36('0xa')](0x0,_0x2e8cc1);_0xc3ce11=_0xc3ce11[_0xcb36('0xa')](_0x2e8cc1+_0x113ab6[_0xcb36('0xb')]);var _0x3ebc04=_0x2cf78a['split'](_0x431871),_0x51216c=0x0,_0x3134cf={},_0x4bcfdd='',_0xd8e85c='',_0x53cdb4=-0x1;while(_0x3ebc04[_0x51216c]){_0x53cdb4=_0x3ebc04[_0x51216c]['indexOf'](':');if(_0x53cdb4!=-0x1){_0x4bcfdd=_0x3ebc04[_0x51216c][_0xcb36('0xc')](0x0,_0x53cdb4)[_0xcb36('0xd')]();_0xd8e85c=_0x3ebc04[_0x51216c][_0xcb36('0xc')](_0x53cdb4+0x1)[_0xcb36('0xd')]();if(_0x4bcfdd[_0xcb36('0xb')]>0x0){_0x3134cf[_0x4bcfdd]=_0xd8e85c;}}else{}_0x51216c++;}this[_0xcb36('0xe')](_0xcb36('0xf'),_0x3134cf);this[_0xcb36('0x5')]=!![];}_0x557f17++;}this['_localBuffer']=_0xc3ce11;}else{while((_0x474816=_0xc3ce11[_0xcb36('0x10')](_0x431871))!=-0x1){_0x2cf78a=_0xc3ce11[_0xcb36('0xa')](0x0,_0x474816);this[_0xcb36('0xe')](_0xcb36('0x11'),_0x2cf78a);_0xc3ce11=_0xc3ce11[_0xcb36('0xa')](_0x474816+_0x431871[_0xcb36('0xb')]);}this[_0xcb36('0x4')]=_0xc3ce11;}_0x4879d1();};module[_0xcb36('0x12')]=AGIReply; \ No newline at end of file +var _0x28a1=['headers','line','util','stream','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit'];(function(_0x1a979e,_0x2337b8){var _0x1eeb70=function(_0x10f216){while(--_0x10f216){_0x1a979e['push'](_0x1a979e['shift']());}};_0x1eeb70(++_0x2337b8);}(_0x28a1,0x145));var _0x128a=function(_0x2a6754,_0x277259){_0x2a6754=_0x2a6754-0x0;var _0x17feda=_0x28a1[_0x2a6754];return _0x17feda;};'use strict';var util=require(_0x128a('0x0'));var Transform=require(_0x128a('0x1'))['Transform'];function AGIReply(_0x1a1555){Transform[_0x128a('0x2')](this,_0x1a1555);this[_0x128a('0x3')]='';this[_0x128a('0x4')]=![];}util[_0x128a('0x5')](AGIReply,Transform);AGIReply[_0x128a('0x6')][_0x128a('0x7')]=function(_0x12a029,_0x26be79,_0x5c66e6){var _0x22d599='\x0a',_0x2f14b1=['\x0a\x0a',_0x128a('0x8')],_0xf81516=-0x1,_0x6b7aeb=-0x1,_0x2656c2='',_0x1a2e27=0x0,_0x7c6557='',_0x5b9d7a='';this[_0x128a('0x3')]+=_0x12a029[_0x128a('0x9')]();_0x7c6557=this['_localBuffer'];if(!this['_inBody']){_0x1a2e27=0x0;while(_0x2f14b1[_0x1a2e27]){while((_0x6b7aeb=_0x7c6557[_0x128a('0xa')](_0x2f14b1[_0x1a2e27]))!=-0x1){_0x2656c2=_0x2f14b1[_0x1a2e27];_0x5b9d7a=_0x7c6557[_0x128a('0xb')](0x0,_0x6b7aeb);_0x7c6557=_0x7c6557[_0x128a('0xb')](_0x6b7aeb+_0x2656c2[_0x128a('0xc')]);var _0x30dd79=_0x5b9d7a[_0x128a('0xd')](_0x22d599),_0x477e56=0x0,_0xb2fef9={},_0x3ed77e='',_0x4b7451='',_0x5d1f48=-0x1;while(_0x30dd79[_0x477e56]){_0x5d1f48=_0x30dd79[_0x477e56][_0x128a('0xa')](':');if(_0x5d1f48!=-0x1){_0x3ed77e=_0x30dd79[_0x477e56][_0x128a('0xe')](0x0,_0x5d1f48)[_0x128a('0xf')]();_0x4b7451=_0x30dd79[_0x477e56][_0x128a('0xe')](_0x5d1f48+0x1)[_0x128a('0xf')]();if(_0x3ed77e[_0x128a('0xc')]>0x0){_0xb2fef9[_0x3ed77e]=_0x4b7451;}}else{}_0x477e56++;}this[_0x128a('0x10')](_0x128a('0x11'),_0xb2fef9);this[_0x128a('0x4')]=!![];}_0x1a2e27++;}this[_0x128a('0x3')]=_0x7c6557;}else{while((_0xf81516=_0x7c6557[_0x128a('0xa')](_0x22d599))!=-0x1){_0x5b9d7a=_0x7c6557[_0x128a('0xb')](0x0,_0xf81516);this[_0x128a('0x10')](_0x128a('0x12'),_0x5b9d7a);_0x7c6557=_0x7c6557['substring'](_0xf81516+_0x22d599[_0x128a('0xc')]);}this[_0x128a('0x3')]=_0x7c6557;}_0x5c66e6();};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 31e0d45..1b57c15 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 _0xb75a=['createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','bluebird','moment','lodash','util','jayson/promise','client','http','then','error','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','getSquareProjectById','name','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareMessage'];(function(_0x2f46c9,_0x348fb8){var _0x25da0f=function(_0x4089d2){while(--_0x4089d2){_0x2f46c9['push'](_0x2f46c9['shift']());}};_0x25da0f(++_0x348fb8);}(_0xb75a,0x6f));var _0xab75=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0xb75a[_0x1b6563];return _0xdea7b8;};'use strict';var BPromise=require(_0xab75('0x0'));var moment=require(_0xab75('0x1'));var _=require(_0xab75('0x2'));var util=require(_0xab75('0x3'));var jayson=require(_0xab75('0x4'));var client=jayson[_0xab75('0x5')][_0xab75('0x6')]({'port':0x2329});function request(_0x12693d,_0x4b5a65){return new BPromise(function(_0x2e72d3,_0x88815b){return client['request'](_0x12693d,_0x4b5a65)[_0xab75('0x7')](function(_0x28bd31){if(_0x28bd31[_0xab75('0x8')]){return _0x88815b(_0x28bd31[_0xab75('0x8')]['message']);}else{return _0x2e72d3(_0x28bd31['result']);}})['catch'](function(_0x547a8b){return _0x88815b(_0x547a8b);});});}exports[_0xab75('0x9')]=function(_0x41bdaf){return request(_0xab75('0xa'),{'options':{'raw':![],'where':{'name':_0x41bdaf},'attributes':[_0xab75('0xb')]}});};exports[_0xab75('0xc')]=function(_0x778ac2){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x778ac2},'include':[{'model':_0xab75('0xd'),'as':_0xab75('0xe')}],'attributes':['id','name','email']}});};exports[_0xab75('0xf')]=function(_0x2a44de){return request(_0xab75('0xa'),{'options':{'where':{'id':_0x2a44de},'attributes':[_0xab75('0x10')]}});};exports['getVoiceQueueById']=function(_0x2ff15a){return request(_0xab75('0x11'),{'options':{'where':{'id':_0x2ff15a},'attributes':['name']}});};exports[_0xab75('0x12')]=function(_0x5631b4){return request('ShowVariable',{'options':{'where':{'id':_0x5631b4},'attributes':[_0xab75('0x10')]}});};exports['getSquareOdbcById']=function(_0x19124f){return request(_0xab75('0x13'),{'options':{'where':{'id':_0x19124f},'attributes':[_0xab75('0x14')]}});};exports[_0xab75('0x15')]=function(_0x1ff7fb){return request('ShowUser',{'options':{'where':{'id':_0x1ff7fb},'attributes':[_0xab75('0x10')]}});};exports[_0xab75('0x16')]=function(_0x4c7ebb){return request(_0xab75('0x17'),{'options':{'where':{'id':_0x4c7ebb},'attributes':[_0xab75('0x10')]}});};exports[_0xab75('0x18')]=function(_0x1d4a14){return request(_0xab75('0x19'),{'options':{'where':{'id':_0x1d4a14},'attributes':[_0xab75('0x1a')]}});};exports['getIntervalById']=function(_0x42c850){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x42c850},'include':[{'model':'Interval','as':_0xab75('0x1b')}]}});};exports[_0xab75('0x1c')]=function(_0x175929){return request(_0xab75('0x1d'),{'options':{'where':{'id':_0x175929},'attributes':['id','name']}});};exports[_0xab75('0x1e')]=function(_0x277514){return request(_0xab75('0x1f'),{'body':_0x277514});};exports['createSquareDetailsReport']=function(_0x3fb91c){return request('CreateSquareDetailsReport',{'body':_0x3fb91c});};exports['createSquareReport']=function(_0x2412b9){return request(_0xab75('0x20'),{'body':_[_0xab75('0x21')](_0x2412b9,{'project_name':_0x2412b9[_0xab75('0x22')],'prev_project_name':_0x2412b9[_0xab75('0x23')]||'','is_subproject':_0x2412b9['arg_2']?!![]:![],'leaveAt':moment()[_0xab75('0x24')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xab75('0x25')]=function(_0x1f7dfb){return request('CreateSquareRecording',{'body':_0x1f7dfb});};exports['createSquareMessage']=function(_0x1c9f7b){return request(_0xab75('0x26'),{'body':_0x1c9f7b});};exports[_0xab75('0x27')]=function(_0x3c41e1){return request(_0xab75('0x28'),{'options':{'raw':![],'where':{'phone':_0x3c41e1[_0xab75('0x29')],'ListId':_0x3c41e1[_0xab75('0x2a')]}}})[_0xab75('0x7')](function(_0x2797b5){if(_0x2797b5){return _0x2797b5;}return request(_0xab75('0x2b'),{'body':_0x3c41e1});});};exports[_0xab75('0x2c')]=function(_0xddb151){return request('ShowPause',{'options':{'where':{'id':_0xddb151},'attributes':[_0xab75('0x10')]}});};exports[_0xab75('0x2d')]=function(_0x5afee6,_0x157805){return request(_0xab75('0x2e'),{'body':{'interface':_0x157805},'options':{'where':_0x5afee6}});};exports[_0xab75('0x2f')]=function(_0x271096,_0x46be65,_0x11c4df){return request(_0xab75('0x30'),{'body':{'type':_0x46be65,'uniqueid':_0x11c4df},'options':{'where':_0x271096}});};exports['agentUnpause']=function(_0x53e285){return request(_0xab75('0x31'),{'body':{},'options':{'where':_0x53e285}});};exports['agentLogout']=function(_0x1fe526){return request('LogoutUser',{'body':{},'options':{'where':_0x1fe526}});}; \ No newline at end of file +var _0xbbb9=['dsn','getUserById','getTrunkById','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','jayson/promise','client','http','request','then','error','message','catch','getSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbbb9,0x1d8));var _0x9bbb=function(_0x3384b6,_0x482924){_0x3384b6=_0x3384b6-0x0;var _0x4e4538=_0xbbb9[_0x3384b6];return _0x4e4538;};'use strict';var BPromise=require(_0x9bbb('0x0'));var moment=require(_0x9bbb('0x1'));var _=require('lodash');var util=require('util');var jayson=require(_0x9bbb('0x2'));var client=jayson[_0x9bbb('0x3')][_0x9bbb('0x4')]({'port':0x2329});function request(_0x182d11,_0x1b0aec){return new BPromise(function(_0x6cf2e2,_0xf25634){return client[_0x9bbb('0x5')](_0x182d11,_0x1b0aec)[_0x9bbb('0x6')](function(_0x6998af){if(_0x6998af['error']){return _0xf25634(_0x6998af[_0x9bbb('0x7')][_0x9bbb('0x8')]);}else{return _0x6cf2e2(_0x6998af['result']);}})[_0x9bbb('0x9')](function(_0x132650){return _0xf25634(_0x132650);});});}exports[_0x9bbb('0xa')]=function(_0x5b2ebc){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x5b2ebc},'attributes':[_0x9bbb('0xb')]}});};exports[_0x9bbb('0xc')]=function(_0x4c567a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4c567a},'include':[{'model':_0x9bbb('0xd'),'as':_0x9bbb('0xe')}],'attributes':['id',_0x9bbb('0xf'),'email']}});};exports[_0x9bbb('0x10')]=function(_0x2368db){return request(_0x9bbb('0x11'),{'options':{'where':{'id':_0x2368db},'attributes':[_0x9bbb('0xf')]}});};exports[_0x9bbb('0x12')]=function(_0x2ba16b){return request(_0x9bbb('0x13'),{'options':{'where':{'id':_0x2ba16b},'attributes':[_0x9bbb('0xf')]}});};exports['getVariableById']=function(_0x2fcb3a){return request(_0x9bbb('0x14'),{'options':{'where':{'id':_0x2fcb3a},'attributes':['name']}});};exports[_0x9bbb('0x15')]=function(_0xba1b51){return request(_0x9bbb('0x16'),{'options':{'where':{'id':_0xba1b51},'attributes':[_0x9bbb('0x17')]}});};exports[_0x9bbb('0x18')]=function(_0xe40cfb){return request('ShowUser',{'options':{'where':{'id':_0xe40cfb},'attributes':[_0x9bbb('0xf')]}});};exports[_0x9bbb('0x19')]=function(_0x27ee04){return request('ShowTrunk',{'options':{'where':{'id':_0x27ee04},'attributes':[_0x9bbb('0xf')]}});};exports['getSoundById']=function(_0x22d305){return request('ShowSound',{'options':{'where':{'id':_0x22d305},'attributes':['save_name']}});};exports[_0x9bbb('0x1a')]=function(_0x1d9480){return request(_0x9bbb('0x1b'),{'options':{'raw':![],'where':{'id':_0x1d9480},'include':[{'model':_0x9bbb('0x1c'),'as':_0x9bbb('0x1d')}]}});};exports[_0x9bbb('0x1e')]=function(_0x54f198){return request(_0x9bbb('0x1f'),{'options':{'where':{'id':_0x54f198},'attributes':['id',_0x9bbb('0xf')]}});};exports['createSmsMessage']=function(_0x32a035){return request(_0x9bbb('0x20'),{'body':_0x32a035});};exports[_0x9bbb('0x21')]=function(_0x3fe8f0){return request(_0x9bbb('0x22'),{'body':_0x3fe8f0});};exports[_0x9bbb('0x23')]=function(_0x5745c8){return request(_0x9bbb('0x24'),{'body':_[_0x9bbb('0x25')](_0x5745c8,{'project_name':_0x5745c8[_0x9bbb('0x26')],'prev_project_name':_0x5745c8[_0x9bbb('0x27')]||'','is_subproject':_0x5745c8['arg_2']?!![]:![],'leaveAt':moment()[_0x9bbb('0x28')](_0x9bbb('0x29'))})});};exports[_0x9bbb('0x2a')]=function(_0x4eabff){return request(_0x9bbb('0x2b'),{'body':_0x4eabff});};exports['createSquareMessage']=function(_0x51beeb){return request(_0x9bbb('0x2c'),{'body':_0x51beeb});};exports[_0x9bbb('0x2d')]=function(_0x20c277){return request(_0x9bbb('0x2e'),{'options':{'raw':![],'where':{'phone':_0x20c277['phone'],'ListId':_0x20c277[_0x9bbb('0x2f')]}}})[_0x9bbb('0x6')](function(_0x2c4393){if(_0x2c4393){return _0x2c4393;}return request(_0x9bbb('0x30'),{'body':_0x20c277});});};exports[_0x9bbb('0x31')]=function(_0x1f14af){return request(_0x9bbb('0x32'),{'options':{'where':{'id':_0x1f14af},'attributes':[_0x9bbb('0xf')]}});};exports['agentLogin']=function(_0x57f709,_0x2ec174){return request(_0x9bbb('0x33'),{'body':{'interface':_0x2ec174},'options':{'where':_0x57f709}});};exports['agentPause']=function(_0x376a3b,_0x4bcdad,_0x2f5e78){return request('PauseUser',{'body':{'type':_0x4bcdad,'uniqueid':_0x2f5e78},'options':{'where':_0x376a3b}});};exports[_0x9bbb('0x34')]=function(_0x410351){return request('UnpauseUser',{'body':{},'options':{'where':_0x410351}});};exports[_0x9bbb('0x35')]=function(_0x54e405){return request(_0x9bbb('0x36'),{'body':{},'options':{'where':_0x54e405}});}; \ 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 e3b80bd..95bf10c 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 _0x812d=['./lex','exports'];(function(_0x13c6b5,_0x4d97bf){var _0x3da107=function(_0x31d45a){while(--_0x31d45a){_0x13c6b5['push'](_0x13c6b5['shift']());}};_0x3da107(++_0x4d97bf);}(_0x812d,0x6e));var _0xd812=function(_0x32d6a9,_0x38a788){_0x32d6a9=_0x32d6a9-0x0;var _0x50e02c=_0x812d[_0x32d6a9];return _0x50e02c;};var polly=require('./polly');var lex=require(_0xd812('0x0'));module[_0xd812('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1b65=['exports','./polly','./lex'];(function(_0xbac7eb,_0x215bec){var _0x342a73=function(_0x1df89d){while(--_0x1df89d){_0xbac7eb['push'](_0xbac7eb['shift']());}};_0x342a73(++_0x215bec);}(_0x1b65,0x1b4));var _0x51b6=function(_0x526786,_0x105cbf){_0x526786=_0x526786-0x0;var _0x3a512d=_0x1b65[_0x526786];return _0x3a512d;};var polly=require(_0x51b6('0x0'));var lex=require(_0x51b6('0x1'));module[_0x51b6('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 567fcec..5f4ce97 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 _0xb43b=['./lib/api','exports'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3f5c72,_0x414ecb){_0x3f5c72=_0x3f5c72-0x0;var _0x5ebb3c=_0xb43b[_0x3f5c72];return _0x5ebb3c;};'use strict';var lex=require(_0xbb43('0x0'));module[_0xbb43('0x1')]=function(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e){return lex(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e);}; \ No newline at end of file +var _0x2750=['./lib/api'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x2750,0x13b));var _0x0275=function(_0x1aa2ef,_0x550d92){_0x1aa2ef=_0x1aa2ef-0x0;var _0x5541d2=_0x2750[_0x1aa2ef];return _0x5541d2;};'use strict';var lex=require(_0x0275('0x0'));module['exports']=function(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06){return lex(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index f841f63..b2151c2 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(_0x5533ce,_0x8d8b81){var _0x38a351=function(_0x2813ce){while(--_0x2813ce){_0x5533ce['push'](_0x5533ce['shift']());}};_0x38a351(++_0x8d8b81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x3b0bbc,_0xd3c6bf){var _0x1a89bf=function(_0x2bd208){while(--_0x2bd208){_0x3b0bbc['push'](_0x3b0bbc['shift']());}};_0x1a89bf(++_0xd3c6bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 1c8444e..7316f88 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 _0x4eac=['./lib/api','exports'];(function(_0x1443e3,_0x1f01d4){var _0x3f1aea=function(_0x5bf193){while(--_0x5bf193){_0x1443e3['push'](_0x1443e3['shift']());}};_0x3f1aea(++_0x1f01d4);}(_0x4eac,0x1e8));var _0xc4ea=function(_0x424d7c,_0x25aa0b){_0x424d7c=_0x424d7c-0x0;var _0x3698ef=_0x4eac[_0x424d7c];return _0x3698ef;};'use strict';var polly=require(_0xc4ea('0x0'));module[_0xc4ea('0x1')]=function(_0x459958,_0x5617a7,_0x462bf7,_0x14bd87,_0x864ba,_0x4090d8,_0x3dff75){return polly(_0x459958,_0x5617a7,_0x462bf7,_0x14bd87,_0x864ba,_0x4090d8,_0x3dff75);}; \ No newline at end of file +var _0xf692=['./lib/api'];(function(_0x508c0a,_0x89f8c1){var _0x18df41=function(_0x1cb6d7){while(--_0x1cb6d7){_0x508c0a['push'](_0x508c0a['shift']());}};_0x18df41(++_0x89f8c1);}(_0xf692,0x137));var _0x2f69=function(_0xee9ad2,_0x1922c7){_0xee9ad2=_0xee9ad2-0x0;var _0xc80f85=_0xf692[_0xee9ad2];return _0xc80f85;};'use strict';var polly=require(_0x2f69('0x0'));module['exports']=function(_0x44d9be,_0x1d8577,_0xc6b1d8,_0x1b3bd0,_0x13de58,_0x1fdfd8,_0x1ea081){return polly(_0x44d9be,_0x1d8577,_0xc6b1d8,_0x1b3bd0,_0x13de58,_0x1fdfd8,_0x1ea081);}; \ 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 7484a28..ce36c5c 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 _0xd2a8=['synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','aws-sdk'];(function(_0x4c59d1,_0x6e4e01){var _0x3125c8=function(_0x29eacd){while(--_0x29eacd){_0x4c59d1['push'](_0x4c59d1['shift']());}};_0x3125c8(++_0x6e4e01);}(_0xd2a8,0x1f1));var _0x8d2a=function(_0x3c7d70,_0x212dfd){_0x3c7d70=_0x3c7d70-0x0;var _0x251c06=_0xd2a8[_0x3c7d70];return _0x251c06;};'use strict';var fs=require('fs');var path=require(_0x8d2a('0x0'));var BPromise=require(_0x8d2a('0x1'));var rs=require('randomstring');var AWS=require(_0x8d2a('0x2'));function pollyResult(_0x4b62e7,_0xa449da,_0x30ae28){return new BPromise(function(_0x28b900,_0x22092c){_0x4b62e7[_0x8d2a('0x3')](_0xa449da,function(_0x36d9f1,_0xd3e447){if(_0x36d9f1){_0x22092c(_0x36d9f1);}else if(_0xd3e447){if(_0xd3e447[_0x8d2a('0x4')]instanceof Buffer){fs['writeFile'](_0x30ae28,_0xd3e447[_0x8d2a('0x4')],function(_0x50066f){if(_0x50066f){_0x22092c(_0x50066f);}else{_0x28b900();}});}else{_0x22092c(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x22092c(new Error(_0x8d2a('0x5')));}});});}module[_0x8d2a('0x6')]=function(_0x702b97,_0x5cc60f,_0x286ecf,_0x41f914,_0x4e43bc,_0x3baceb,_0x30e38c){var _0x2b93fe=new AWS[(_0x8d2a('0x7'))]({'accessKeyId':_0x702b97,'secretAccessKey':_0x5cc60f,'region':_0x286ecf});var _0x1780af={'Text':_0x4e43bc,'TextType':_0x3baceb||_0x8d2a('0x8'),'OutputFormat':_0x8d2a('0x9'),'VoiceId':_0x41f914};return pollyResult(_0x2b93fe,_0x1780af,_0x30e38c);}; \ No newline at end of file +var _0x0799=['bluebird','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x0799,0x1b9));var _0x9079=function(_0x1ee9a1,_0x5f1434){_0x1ee9a1=_0x1ee9a1-0x0;var _0x21270f=_0x0799[_0x1ee9a1];return _0x21270f;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9079('0x0'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x2224ec,_0x826b6a,_0x2198af){return new BPromise(function(_0x11e09b,_0x3a075f){_0x2224ec['synthesizeSpeech'](_0x826b6a,function(_0x652b,_0x342f74){if(_0x652b){_0x3a075f(_0x652b);}else if(_0x342f74){if(_0x342f74['AudioStream']instanceof Buffer){fs['writeFile'](_0x2198af,_0x342f74[_0x9079('0x1')],function(_0x1b42b2){if(_0x1b42b2){_0x3a075f(_0x1b42b2);}else{_0x11e09b();}});}else{_0x3a075f(new Error(_0x9079('0x2')));}}else{_0x3a075f(new Error(_0x9079('0x3')));}});});}module[_0x9079('0x4')]=function(_0x2136e2,_0x334ab0,_0x6a2986,_0x29d155,_0x2728bd,_0x2f22b9,_0x47dbed){var _0x7765df=new AWS[(_0x9079('0x5'))]({'accessKeyId':_0x2136e2,'secretAccessKey':_0x334ab0,'region':_0x6a2986});var _0x21d1f8={'Text':_0x2728bd,'TextType':_0x2f22b9||_0x9079('0x6'),'OutputFormat':'mp3','VoiceId':_0x29d155};return pollyResult(_0x7765df,_0x21d1f8,_0x47dbed);}; \ 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 22d8d03..fb0c6a5 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 _0x2aae=['./lib/api','exports'];(function(_0x50e318,_0x103521){var _0x209b0f=function(_0x12897d){while(--_0x12897d){_0x50e318['push'](_0x50e318['shift']());}};_0x209b0f(++_0x103521);}(_0x2aae,0x18c));var _0xe2aa=function(_0x4f9149,_0x2694b0){_0x4f9149=_0x4f9149-0x0;var _0x419f59=_0x2aae[_0x4f9149];return _0x419f59;};'use strict';var asr=require(_0xe2aa('0x0'));module[_0xe2aa('0x1')]=function(_0xb38906,_0x3867a1,_0x4b15eb,_0x21825f){return asr(_0xb38906,_0x3867a1,_0x4b15eb);}; \ No newline at end of file +var _0x4d08=['exports','./lib/api'];(function(_0x5a2d2f,_0x1f8def){var _0x1d7789=function(_0x2c70fb){while(--_0x2c70fb){_0x5a2d2f['push'](_0x5a2d2f['shift']());}};_0x1d7789(++_0x1f8def);}(_0x4d08,0x1b9));var _0x84d0=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0x4d08[_0x1c289a];return _0x28d68e;};'use strict';var asr=require(_0x84d0('0x0'));module[_0x84d0('0x1')]=function(_0x143409,_0x4b70d0,_0x221ace,_0x4d10e1){return asr(_0x143409,_0x4b70d0,_0x221ace);}; \ 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 2b43430..882c216 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 _0x87ae=['toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x41ad1c,_0x18b856){var _0x567184=function(_0x12ca12){while(--_0x12ca12){_0x41ad1c['push'](_0x41ad1c['shift']());}};_0x567184(++_0x18b856);}(_0x87ae,0xf5));var _0xe87a=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x87ae[_0x550d12];return _0x12103d;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xe87a('0x0');module['exports']=function(_0x4ab66a,_0x2241d2,_0x44fc79){return new BPromise(function(_0x404a0a,_0x5a55b8){var _0x28899c;if(typeof _0x4ab66a!==_0xe87a('0x1')||_0x4ab66a[_0xe87a('0x2')]===0x0){return _0x5a55b8('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x2241d2!=='string'||_0x2241d2[_0xe87a('0x2')]===0x0){return _0x5a55b8(_0xe87a('0x3'));}if(typeof _0x44fc79!=='undefined'&&(typeof _0x44fc79!==_0xe87a('0x1')||_0x44fc79[_0xe87a('0x2')]===0x0)){return _0x5a55b8('lang\x20should\x20be\x20a\x20string');}try{_0x28899c=fs[_0xe87a('0x4')](_0x4ab66a)[_0xe87a('0x5')]('base64');}catch(_0x18cf9d){return _0x5a55b8(_0x18cf9d);}return _0x404a0a({'method':_0xe87a('0x6'),'uri':host+_0xe87a('0x7')+_0x2241d2,'body':{'config':{'encoding':_0xe87a('0x8'),'sampleRateHertz':_0xe87a('0x9'),'languageCode':_0x44fc79},'audio':{'content':_0x28899c}},'json':!![]});});}; \ No newline at end of file +var _0x4522=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','8000','https://speech.googleapis.com','exports','string','length'];(function(_0x14fd4e,_0x27c587){var _0x4a73d2=function(_0xdf6589){while(--_0xdf6589){_0x14fd4e['push'](_0x14fd4e['shift']());}};_0x4a73d2(++_0x27c587);}(_0x4522,0x1a0));var _0x2452=function(_0x4b2b3e,_0x720687){_0x4b2b3e=_0x4b2b3e-0x0;var _0x2f59a6=_0x4522[_0x4b2b3e];return _0x2f59a6;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x2452('0x0');module[_0x2452('0x1')]=function(_0x4a08d4,_0x5080f5,_0x229028){return new BPromise(function(_0x1fdf5b,_0x35e30a){var _0x2f21dc;if(typeof _0x4a08d4!==_0x2452('0x2')||_0x4a08d4[_0x2452('0x3')]===0x0){return _0x35e30a(_0x2452('0x4'));}if(typeof _0x5080f5!==_0x2452('0x2')||_0x5080f5[_0x2452('0x3')]===0x0){return _0x35e30a(_0x2452('0x5'));}if(typeof _0x229028!==_0x2452('0x6')&&(typeof _0x229028!==_0x2452('0x2')||_0x229028[_0x2452('0x3')]===0x0)){return _0x35e30a(_0x2452('0x7'));}try{_0x2f21dc=fs[_0x2452('0x8')](_0x4a08d4)[_0x2452('0x9')]('base64');}catch(_0x5dc630){return _0x35e30a(_0x5dc630);}return _0x1fdf5b({'method':_0x2452('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x5080f5,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x2452('0xb'),'languageCode':_0x229028},'audio':{'content':_0x2f21dc}},'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 9cb6441..ddc80de 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 _0x5b1d=['exports'];(function(_0xc93e9d,_0x39900c){var _0x4e5f84=function(_0x2e6bdc){while(--_0x2e6bdc){_0xc93e9d['push'](_0xc93e9d['shift']());}};_0x4e5f84(++_0x39900c);}(_0x5b1d,0x13f));var _0xd5b1=function(_0x3d5832,_0x373d4a){_0x3d5832=_0x3d5832-0x0;var _0xf79f94=_0x5b1d[_0x3d5832];return _0xf79f94;};var asr=require('./asr');module[_0xd5b1('0x0')]={'asr':asr}; \ No newline at end of file +var _0x34ba=['exports'];(function(_0x4d0481,_0x33b81e){var _0x1956d4=function(_0x217074){while(--_0x217074){_0x4d0481['push'](_0x4d0481['shift']());}};_0x1956d4(++_0x33b81e);}(_0x34ba,0x138));var _0xa34b=function(_0x57f9d3,_0x44990d){_0x57f9d3=_0x57f9d3-0x0;var _0x2d0f6b=_0x34ba[_0x57f9d3];return _0x2d0f6b;};var asr=require('./asr');module[_0xa34b('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index d7c5d88..9d10891 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 _0x7869=['alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','endConversation','metadata','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','statusCode','request\x20to\x20','statusMessage','info','finish\x20download\x20file','close','error','unlink','pipe','protocol','get','wav','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','writeFile','.wav','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x7869,0x1d0));var _0x9786=function(_0x301022,_0x4e2773){_0x301022=_0x301022-0x0;var _0x1c7893=_0x7869[_0x301022];return _0x1c7893;};'use strict';var apiai=require(_0x9786('0x0'));var BPromise=require(_0x9786('0x1'));var dialogflow=require(_0x9786('0x2'));var fs=require('fs');var http=require(_0x9786('0x3'));var https=require(_0x9786('0x4'));var md5=require(_0x9786('0x5'));var path=require(_0x9786('0x6'));var querystring=require(_0x9786('0x7'));var rp=require(_0x9786('0x8'));var rs=require(_0x9786('0x9'));var sox=require(_0x9786('0xa'));var tts=require(_0x9786('0xb'));var urlParse=require(_0x9786('0xc'))[_0x9786('0xd')];var util=require(_0x9786('0xe'));var aws=require(_0x9786('0xf'));var google=require(_0x9786('0x10'));var sestek=require('./sestek');var tilde=require(_0x9786('0x11'));var logger=require(_0x9786('0x12'))(_0x9786('0x13'));var ISPEECH_API=_0x9786('0x14');function downloadFile(_0x4914b5,_0x41bf11){return new BPromise(function(_0x5d8008,_0x1ee3d7){var _0x38d045=urlParse(_0x4914b5);var _0x4a4442=_0x38d045['protocol']===_0x9786('0x15')?https:http;var _0x35d9a3={'host':_0x38d045[_0x9786('0x16')],'path':_0x38d045[_0x9786('0x6')],'headers':{'user-agent':_0x9786('0x17')}};_0x4a4442['get'](_0x35d9a3,function(_0x4df8f3){if(_0x4df8f3[_0x9786('0x18')]!==0xc8){logger['error'](_0x9786('0x19')+_0x4914b5+'\x20failed,\x20status\x20code\x20=\x20'+_0x4df8f3[_0x9786('0x18')]+'\x20('+_0x4df8f3[_0x9786('0x1a')]+')');_0x1ee3d7(new Error(_0x9786('0x19')+_0x4914b5+'\x20failed,\x20status\x20code\x20=\x20'+_0x4df8f3[_0x9786('0x18')]+'\x20('+_0x4df8f3['statusMessage']+')'));return;}var _0x3bc527=fs['createWriteStream'](_0x41bf11);_0x3bc527['on']('finish',function(){logger[_0x9786('0x1b')](_0x9786('0x1c'));_0x3bc527[_0x9786('0x1d')](_0x5d8008);});_0x3bc527['on'](_0x9786('0x1e'),function(_0x195879){fs[_0x9786('0x1f')](_0x41bf11);logger[_0x9786('0x1e')]('download\x20error',_0x195879);_0x1ee3d7(_0x195879);});_0x4df8f3[_0x9786('0x20')](_0x3bc527);})['on'](_0x9786('0x1e'),function(_0x3cbcca){logger[_0x9786('0x1e')](_0x3cbcca);_0x1ee3d7(_0x3cbcca);})['end']();});}function uploadFile(_0x182e95){return new BPromise(function(_0x195ca7,_0x3393ce){var _0x2d07c9=urlParse(_0x182e95);var _0x4e1cf9=_0x2d07c9[_0x9786('0x21')]===_0x9786('0x15')?https:http;var _0x2efc7f={'host':_0x2d07c9[_0x9786('0x16')],'path':_0x2d07c9['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4e1cf9[_0x9786('0x22')](_0x2efc7f,function(_0x3020e7){if(_0x3020e7[_0x9786('0x18')]!==0xc8){_0x3393ce(new Error(_0x9786('0x19')+_0x182e95+'\x20failed,\x20status\x20code\x20=\x20'+_0x3020e7[_0x9786('0x18')]+'\x20('+_0x3020e7['statusMessage']+')'));return;}var _0x2ce799='';_0x3020e7['on']('data',function(_0x413ea7){_0x2ce799+=_0x413ea7;});_0x3020e7['on']('end',function(){_0x195ca7(_0x2ce799);});})['on'](_0x9786('0x1e'),function(_0x1e7cd2){_0x3393ce(_0x1e7cd2);})['end']();});}function convertFile(_0x5abeaa,_0x367b8b){return new BPromise(function(_0x23a3a4,_0xb5ab3d){var _0x1ca0ca=sox['transcode'](_0x5abeaa,_0x367b8b,{'sampleRate':0x1f40,'format':_0x9786('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ca0ca['on'](_0x9786('0x1e'),function(_0x2d42ac){logger[_0x9786('0x1e')]('error\x20convert',_0x2d42ac);_0xb5ab3d(_0x2d42ac);});_0x1ca0ca['on']('end',function(){logger[_0x9786('0x1b')]('finish\x20to\x20convert');_0x23a3a4();});_0x1ca0ca[_0x9786('0x24')]();});}function base64Decode(_0x5b72a2,_0xf3271c){var _0x89c557=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs[_0x9786('0x27')](0x4)+'.wav');fs[_0x9786('0x28')](_0x89c557,_0x5b72a2,_0x9786('0x29'));return convertFile(_0x89c557,_0xf3271c)[_0x9786('0x2a')](function(){try{fs['unlink'](_0x89c557);fs[_0x9786('0x2b')](_0xf3271c,_0x9786('0x2c'));}catch(_0x1d66d8){logger[_0x9786('0x1e')](_0x1d66d8);}return _0xf3271c[_0x9786('0x2d')]('.')[0x0];});}function base64Encode(_0x20b1e6){var _0x5007e6=fs[_0x9786('0x2e')](_0x20b1e6);return new Buffer(_0x5007e6)['toString'](_0x9786('0x29'));}exports[_0x9786('0x2f')]=function(_0x437396,_0x2e2079,_0x56a51b,_0x26bad5,_0x1cf044,_0x25fc5b){var _0xa30433,_0x2718ef;var _0x12e020=_0x9786('0x30');var _0x14d52a=_0x9786('0x31')+_0x437396;var _0x235103={};if(_0x2e2079===_0x9786('0x32')){_0x235103['input']={'ssml':_0x56a51b};}else{_0x235103[_0x9786('0x33')]={'text':_0x56a51b};};_0x235103[_0x9786('0x34')]={'languageCode':_0x26bad5,'ssmlGender':_0x1cf044};_0x235103[_0x9786('0x35')]={'audioEncoding':_0x9786('0x36'),'sampleRateHertz':0x1f40};var _0x12b2a4={'url':_0x12e020+_0x9786('0x37')+_0x14d52a,'method':_0x9786('0x38'),'json':!![],'body':_0x235103};return rp(_0x12b2a4)[_0x9786('0x2a')](function(_0x14f000){return new BPromise(function(_0x136a75,_0x50955d){_0xa30433=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs[_0x9786('0x27')](0x4)+_0x9786('0x39'));var _0xd41696=Buffer['from'](_0x14f000['audioContent'],_0x9786('0x29'));return fs[_0x9786('0x3a')](_0xa30433,_0xd41696,function(_0x5b545c){_0x50955d(_0x5b545c);},function(_0x3f03ae){fs[_0x9786('0x2b')](_0xa30433,_0x9786('0x2c'));_0x136a75(_0x3f03ae);});});})[_0x9786('0x2a')](function(_0x1d526a){_0x2718ef=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs[_0x9786('0x27')](0x4)+_0x9786('0x3b'));return convertFile(_0xa30433,_0x2718ef);})[_0x9786('0x2a')](function(){try{fs[_0x9786('0x1f')](_0xa30433);fs[_0x9786('0x2b')](_0x2718ef,_0x9786('0x2c'));}catch(_0x119b17){logger['error'](_0x119b17);}logger['info'](_0x9786('0x3c'),_0x2718ef[_0x9786('0x2d')]('.')[0x0]);return _0x2718ef[_0x9786('0x2d')]('.')[0x0];});};exports[_0x9786('0x3d')]=function(_0x1919c9,_0x55ddab){var _0x146902='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5471af,_0x10719e;var _0x16e92c;var _0x227323={'encoding':_0x9786('0x3e'),'method':_0x9786('0x38'),'timeout':0x2710,'url':_0x146902,'headers':{'Content-Type':_0x9786('0x3f')},'body':_0x9786('0x40')+encodeURIComponent(JSON[_0x9786('0x41')]([[[_0x9786('0x42'),JSON[_0x9786('0x41')]([_0x1919c9,_0x55ddab||'en',![],_0x9786('0x43')]),null,_0x9786('0x44')]]]))};return rp(_0x227323)[_0x9786('0x2a')](function(_0x1384da){try{_0x16e92c=eval(_0x1384da[_0x9786('0x45')](0x5))[0x0][0x2];}catch(_0x4e5fe8){throw new Error(_0x9786('0x46')+_0x1384da[_0x9786('0x47')]);}if(!_0x16e92c){if(_0x1919c9[_0x9786('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x55ddab+_0x9786('0x49'));}}try{_0x16e92c=eval(_0x16e92c)[0x0];}catch(_0x1e9c6b){throw new Error(_0x9786('0x46')+res[_0x9786('0x47')]);}const _0x4f3265=_0x16e92c;_0x5471af=path[_0x9786('0x25')](__dirname,'tmp',rs[_0x9786('0x27')](0x4)+'.mp3');fs[_0x9786('0x28')](_0x5471af,_0x16e92c,{'encoding':'base64'});_0x10719e=path[_0x9786('0x25')](__dirname,'tmp',rs[_0x9786('0x27')](0x4)+_0x9786('0x3b'));return convertFile(_0x5471af,_0x10719e);})[_0x9786('0x2a')](function(){try{fs['unlink'](_0x5471af);fs['chmodSync'](_0x10719e,_0x9786('0x2c'));}catch(_0x7a7a7f){logger[_0x9786('0x1e')](_0x7a7a7f);}logger[_0x9786('0x1b')](_0x9786('0x4a'),_0x10719e[_0x9786('0x2d')]('.')[0x0]);return _0x10719e[_0x9786('0x2d')]('.')[0x0];});};exports[_0x9786('0x4b')]=function(_0x342636,_0x431566,_0x55b887){return google[_0x9786('0x4c')](_0x342636,_0x431566,_0x55b887)[_0x9786('0x2a')](function(_0x36e465){logger[_0x9786('0x1b')](_0x36e465[_0x9786('0x4d')]);return rp(_0x36e465);})[_0x9786('0x2a')](function(_0x3b9a66){var _0x314036='';var _0x42568b=0x0;try{fs[_0x9786('0x1f')](_0x342636);}catch(_0x46ca36){logger[_0x9786('0x1e')](_0x46ca36);}if(_0x3b9a66&&_0x3b9a66[_0x9786('0x4e')]){_0x314036=_0x3b9a66[_0x9786('0x4e')][_0x9786('0x4f')](function(_0xe0907d){return _0xe0907d&&_0xe0907d[_0x9786('0x50')][0x0]&&_0xe0907d[_0x9786('0x50')][0x0][_0x9786('0x51')]?_0xe0907d['alternatives'][0x0]['transcript']:'';})[_0x9786('0x52')]('\x0a');_0x42568b=_0x3b9a66['results'][_0x9786('0x4f')](function(_0x57843b){return _0x57843b&&_0x57843b[_0x9786('0x50')][0x0]&&_0x57843b['alternatives'][0x0][_0x9786('0x53')]?_0x57843b[_0x9786('0x50')][0x0]['confidence']:0x0;})[_0x9786('0x52')]('\x0a');}logger['info'](_0x9786('0x54'),_0x314036);logger[_0x9786('0x1b')](_0x9786('0x55'),_0x42568b);return{'transcript':_0x314036,'confidence':_0x42568b};})[_0x9786('0x56')](function(_0x374e07){logger[_0x9786('0x1e')](_0x9786('0x57'),_0x374e07['statusCode'],_0x374e07[_0x9786('0x58')],_0x374e07[_0x9786('0x59')]);});};exports[_0x9786('0x5a')]=function(_0x33eb37,_0x37ab20,_0x18ed6f,_0x3d1287){var _0x2b885d=apiai(_0x37ab20,{'language':_0x3d1287||'en'});return _0x2b885d[_0x9786('0x5b')](_0x18ed6f,{'sessionId':md5(_0x33eb37)})[_0x9786('0x2a')](function(_0x4a2da5){logger[_0x9786('0x1b')](JSON['stringify'](_0x4a2da5));return{'source':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x5d')],'resolvedQuery':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x5e')],'action':_0x4a2da5['result'][_0x9786('0x5f')],'actionIncomplete':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x60')],'speech':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x61')][_0x9786('0x62')],'score':_0x4a2da5['result'][_0x9786('0x63')],'statusCode':_0x4a2da5[_0x9786('0x64')]['code'],'endConversation':_0x4a2da5[_0x9786('0x5c')]['metadata'][_0x9786('0x65')]||![],'isFallbackIntent':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x66')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x1fa716,_0x16ba9d,_0xcb0dea,_0x13f490,_0x121334,_0x9a7f0b){var _0x3417e6=_0x13f490[_0x9786('0x67')](/\\n/g,'\x0a');var _0x4bbb87={'credentials':{'private_key':_0x3417e6,'client_email':_0xcb0dea}};var _0x1e2daa=new dialogflow[(_0x9786('0x68'))](_0x4bbb87);var _0x547643=_0x1e2daa[_0x9786('0x69')](_0x16ba9d,md5(_0x1fa716));var _0x4a9a24={'session':_0x547643,'queryInput':{'text':{'text':_0x121334,'languageCode':_0x9a7f0b}}};return _0x1e2daa['detectIntent'](_0x4a9a24)['then'](function(_0x3e2d48){if(_0x3e2d48&&_0x3e2d48[_0x9786('0x48')]){logger['info'](_0x9786('0x6a'),JSON['stringify'](_0x3e2d48));var _0x2c4bca=_0x3e2d48[0x0];if(_0x2c4bca){var _0xb78e1={'action':_0x2c4bca[_0x9786('0x6b')]['action'],'allRequiredParamsPresent':_0x2c4bca[_0x9786('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x2c4bca[_0x9786('0x6b')][_0x9786('0x6c')]&&_0x2c4bca[_0x9786('0x6b')][_0x9786('0x6c')]['fields']?_0x2c4bca[_0x9786('0x6b')][_0x9786('0x6c')][_0x9786('0x6d')][_0x9786('0x6e')][_0x9786('0x6f')]:![],'fulfillmentText':_0x2c4bca['queryResult'][_0x9786('0x70')],'intentName':_0x2c4bca[_0x9786('0x6b')][_0x9786('0x71')][_0x9786('0x58')],'intentDisplayName':_0x2c4bca[_0x9786('0x6b')]['intent'][_0x9786('0x72')],'isFallbackIntent':_0x2c4bca['queryResult'][_0x9786('0x71')][_0x9786('0x73')],'languageCode':_0x2c4bca['queryResult'][_0x9786('0x74')],'queryText':_0x2c4bca['queryResult'][_0x9786('0x75')],'responseId':_0x2c4bca[_0x9786('0x76')],'score':_0x2c4bca[_0x9786('0x6b')][_0x9786('0x77')],'speech':_0x2c4bca[_0x9786('0x6b')][_0x9786('0x70')],'providerResponse':JSON[_0x9786('0x41')](_0x3e2d48)};return _0xb78e1;}}});};exports['tildeASR']=function(_0x1f02a1,_0x2adf7b,_0x10f98d,_0x1114c6){return tilde[_0x9786('0x4c')](_0x1f02a1,_0x2adf7b,_0x10f98d,_0x1114c6)[_0x9786('0x2a')](function(_0x161fd2){try{fs[_0x9786('0x1f')](_0x1f02a1);}catch(_0x813cc9){logger['error'](_0x813cc9);}logger[_0x9786('0x1b')](_0x9786('0x78'),_0x161fd2['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x161fd2['confidence']);return _0x161fd2;});};exports[_0x9786('0x79')]=function(_0x390008,_0xbf69e3,_0x4ff533,_0x25f5c9,_0x60fc33,_0x20ced1){var _0x17741c=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs['generate'](0x4)+_0x9786('0x39'));var _0x2755ad;return aws[_0x9786('0x7a')](_0x390008,_0xbf69e3,_0x4ff533,_0x25f5c9,_0x60fc33,_0x20ced1,_0x17741c)['then'](function(){_0x2755ad=path[_0x9786('0x25')](__dirname,'tmp',rs[_0x9786('0x27')](0x4)+_0x9786('0x3b'));return convertFile(_0x17741c,_0x2755ad);})['then'](function(){try{fs[_0x9786('0x1f')](_0x17741c);fs[_0x9786('0x2b')](_0x2755ad,'777');}catch(_0x16e925){logger[_0x9786('0x1e')](_0x16e925);}return _0x2755ad[_0x9786('0x2d')]('.')[0x0];});};exports[_0x9786('0x7b')]=function(_0x36f78b,_0x4dea86,_0x2ea952,_0x3fb8e3,_0x3b60f6,_0x381466){return aws[_0x9786('0x7c')](_0x36f78b,_0x4dea86,_0x2ea952,_0x3fb8e3,_0x3b60f6,_0x381466)['then'](function(_0x34d17a){logger[_0x9786('0x1b')](JSON[_0x9786('0x41')](_0x34d17a));return _0x34d17a;});};exports['ispeechTTS']=function(_0x38865f,_0x271fd2,_0x56e871,_0x6283a3){var _0x25d153=util[_0x9786('0x7d')](_0x9786('0x7e'),ISPEECH_API,_0x38865f,encodeURIComponent(_0x271fd2),_0x56e871,_0x6283a3);var _0x2c7e59=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs['generate'](0x4)+'.mp3');var _0x4032d0;return downloadFile(_0x25d153,_0x2c7e59)['then'](function(){_0x4032d0=path[_0x9786('0x25')](__dirname,'tmp',rs[_0x9786('0x27')](0x4)+_0x9786('0x3b'));return convertFile(_0x2c7e59,_0x4032d0);})[_0x9786('0x2a')](function(){try{fs[_0x9786('0x1f')](_0x2c7e59);fs[_0x9786('0x2b')](_0x4032d0,_0x9786('0x2c'));}catch(_0x2f5e23){logger[_0x9786('0x1e')](_0x2f5e23);}return _0x4032d0[_0x9786('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x3a10de,_0x387f9f,_0x2f8bdf,_0x698c51){var _0x19597c=util[_0x9786('0x7d')](_0x9786('0x7f'),ISPEECH_API,_0x387f9f,_0x2f8bdf,base64Encode(_0x3a10de),_0x698c51?util[_0x9786('0x7d')](_0x9786('0x80'),encodeURIComponent(_0x698c51)):_0x9786('0x81'));return uploadFile(_0x19597c)['then'](function(_0x3de569){return querystring[_0x9786('0xd')](_0x3de569);});};exports[_0x9786('0x82')]=function(_0x150527,_0x182394){return sestek[_0x9786('0x83')](_0x150527,_0x182394)[_0x9786('0x2a')](function(_0x20260b){logger[_0x9786('0x1b')](JSON[_0x9786('0x41')](_0x20260b));var _0x5d3245={'speech':_0x20260b['text'],'action':_0x20260b[_0x9786('0x84')]?_0x20260b[_0x9786('0x84')]['CustomAction']:undefined,'actiondata':_0x20260b[_0x9786('0x84')]?_0x20260b[_0x9786('0x84')][_0x9786('0x85')]:undefined};if(_0x20260b[_0x9786('0x84')]&&_0x20260b[_0x9786('0x84')][_0x9786('0x86')]){return base64Decode(_0x20260b[_0x9786('0x84')][_0x9786('0x86')]['Data'],path['resolve'](__dirname,_0x9786('0x26'),rs[_0x9786('0x27')](0x4)+_0x9786('0x3b')))[_0x9786('0x2a')](function(_0x52ad38){_0x5d3245[_0x9786('0x87')]=_0x52ad38;return _0x5d3245;});}return _0x5d3245;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x519d=['MP3','text:synthesize','POST','then','.mp3','audioContent','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','slice','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','apiai-promise','bluebird','dialogflow','http','https','md5','path','randomstring','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','get','statusMessage','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x519d,0x15e));var _0xd519=function(_0x1b6e96,_0x2203b9){_0x1b6e96=_0x1b6e96-0x0;var _0x59286f=_0x519d[_0x1b6e96];return _0x59286f;};'use strict';var apiai=require(_0xd519('0x0'));var BPromise=require(_0xd519('0x1'));var dialogflow=require(_0xd519('0x2'));var fs=require('fs');var http=require(_0xd519('0x3'));var https=require(_0xd519('0x4'));var md5=require(_0xd519('0x5'));var path=require(_0xd519('0x6'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xd519('0x7'));var sox=require('sox');var tts=require(_0xd519('0x8'));var urlParse=require(_0xd519('0x9'))[_0xd519('0xa')];var util=require(_0xd519('0xb'));var aws=require(_0xd519('0xc'));var google=require('./google');var sestek=require(_0xd519('0xd'));var tilde=require(_0xd519('0xe'));var logger=require(_0xd519('0xf'))(_0xd519('0x10'));var ISPEECH_API=_0xd519('0x11');function downloadFile(_0x3b4917,_0x3b5db6){return new BPromise(function(_0x3cf29b,_0x4eea57){var _0x3a7418=urlParse(_0x3b4917);var _0x5e2d0f=_0x3a7418[_0xd519('0x12')]===_0xd519('0x13')?https:http;var _0x5edf4a={'host':_0x3a7418[_0xd519('0x14')],'path':_0x3a7418['path'],'headers':{'user-agent':_0xd519('0x15')}};_0x5e2d0f['get'](_0x5edf4a,function(_0xe583ad){if(_0xe583ad[_0xd519('0x16')]!==0xc8){logger[_0xd519('0x17')](_0xd519('0x18')+_0x3b4917+_0xd519('0x19')+_0xe583ad[_0xd519('0x16')]+'\x20('+_0xe583ad['statusMessage']+')');_0x4eea57(new Error(_0xd519('0x18')+_0x3b4917+'\x20failed,\x20status\x20code\x20=\x20'+_0xe583ad[_0xd519('0x16')]+'\x20('+_0xe583ad['statusMessage']+')'));return;}var _0x3446fa=fs[_0xd519('0x1a')](_0x3b5db6);_0x3446fa['on'](_0xd519('0x1b'),function(){logger[_0xd519('0x1c')](_0xd519('0x1d'));_0x3446fa[_0xd519('0x1e')](_0x3cf29b);});_0x3446fa['on'](_0xd519('0x17'),function(_0xbc13b6){fs[_0xd519('0x1f')](_0x3b5db6);logger['error']('download\x20error',_0xbc13b6);_0x4eea57(_0xbc13b6);});_0xe583ad[_0xd519('0x20')](_0x3446fa);})['on'](_0xd519('0x17'),function(_0x2d5e42){logger[_0xd519('0x17')](_0x2d5e42);_0x4eea57(_0x2d5e42);})[_0xd519('0x21')]();});}function uploadFile(_0x126d49){return new BPromise(function(_0x290a34,_0x4f464e){var _0x11071d=urlParse(_0x126d49);var _0x148ac3=_0x11071d['protocol']===_0xd519('0x13')?https:http;var _0x1105fc={'host':_0x11071d['host'],'path':_0x11071d[_0xd519('0x6')],'headers':{'user-agent':_0xd519('0x15')}};_0x148ac3[_0xd519('0x22')](_0x1105fc,function(_0x3b4cf6){if(_0x3b4cf6[_0xd519('0x16')]!==0xc8){_0x4f464e(new Error('request\x20to\x20'+_0x126d49+'\x20failed,\x20status\x20code\x20=\x20'+_0x3b4cf6[_0xd519('0x16')]+'\x20('+_0x3b4cf6[_0xd519('0x23')]+')'));return;}var _0x1747fd='';_0x3b4cf6['on'](_0xd519('0x24'),function(_0x465d43){_0x1747fd+=_0x465d43;});_0x3b4cf6['on'](_0xd519('0x21'),function(){_0x290a34(_0x1747fd);});})['on']('error',function(_0xb08d2){_0x4f464e(_0xb08d2);})[_0xd519('0x21')]();});}function convertFile(_0xb743f8,_0x6f68bf){return new BPromise(function(_0x2af91c,_0x58bd14){var _0x1e2cea=sox[_0xd519('0x25')](_0xb743f8,_0x6f68bf,{'sampleRate':0x1f40,'format':_0xd519('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1e2cea['on']('error',function(_0x1df98e){logger[_0xd519('0x17')](_0xd519('0x27'),_0x1df98e);_0x58bd14(_0x1df98e);});_0x1e2cea['on'](_0xd519('0x21'),function(){logger[_0xd519('0x1c')](_0xd519('0x28'));_0x2af91c();});_0x1e2cea[_0xd519('0x29')]();});}function base64Decode(_0x4c1b0d,_0x564fdc){var _0xcfd423=path[_0xd519('0x2a')](__dirname,_0xd519('0x2b'),rs[_0xd519('0x2c')](0x4)+'.wav');fs[_0xd519('0x2d')](_0xcfd423,_0x4c1b0d,_0xd519('0x2e'));return convertFile(_0xcfd423,_0x564fdc)['then'](function(){try{fs[_0xd519('0x1f')](_0xcfd423);fs[_0xd519('0x2f')](_0x564fdc,_0xd519('0x30'));}catch(_0x257cb4){logger[_0xd519('0x17')](_0x257cb4);}return _0x564fdc[_0xd519('0x31')]('.')[0x0];});}function base64Encode(_0x4f3c89){var _0x1c8dd8=fs[_0xd519('0x32')](_0x4f3c89);return new Buffer(_0x1c8dd8)[_0xd519('0x33')]('base64');}exports[_0xd519('0x34')]=function(_0x42f97e,_0x181102,_0x38bd77,_0x9c3c43,_0x3a780d,_0x5d2bc2){var _0x43f9ff,_0x5d9770;var _0x26b3f6=_0xd519('0x35');var _0x30cf91=_0xd519('0x36')+_0x42f97e;var _0x4a86f6={};if(_0x181102==='ssml'){_0x4a86f6['input']={'ssml':_0x38bd77};}else{_0x4a86f6[_0xd519('0x37')]={'text':_0x38bd77};};_0x4a86f6[_0xd519('0x38')]={'languageCode':_0x9c3c43,'ssmlGender':_0x3a780d};_0x4a86f6[_0xd519('0x39')]={'audioEncoding':_0xd519('0x3a'),'sampleRateHertz':0x1f40};var _0x1fcae1={'url':_0x26b3f6+_0xd519('0x3b')+_0x30cf91,'method':_0xd519('0x3c'),'json':!![],'body':_0x4a86f6};return rp(_0x1fcae1)[_0xd519('0x3d')](function(_0x44c226){return new BPromise(function(_0xb56d73,_0x302d37){_0x43f9ff=path[_0xd519('0x2a')](__dirname,_0xd519('0x2b'),rs[_0xd519('0x2c')](0x4)+_0xd519('0x3e'));var _0x394868=Buffer['from'](_0x44c226[_0xd519('0x3f')],_0xd519('0x2e'));return fs['writeFile'](_0x43f9ff,_0x394868,function(_0x4e1713){_0x302d37(_0x4e1713);},function(_0x2b9470){fs[_0xd519('0x2f')](_0x43f9ff,_0xd519('0x30'));_0xb56d73(_0x2b9470);});});})[_0xd519('0x3d')](function(_0x39e23f){_0x5d9770=path[_0xd519('0x2a')](__dirname,'tmp',rs[_0xd519('0x2c')](0x4)+_0xd519('0x40'));return convertFile(_0x43f9ff,_0x5d9770);})[_0xd519('0x3d')](function(){try{fs['unlink'](_0x43f9ff);fs[_0xd519('0x2f')](_0x5d9770,_0xd519('0x30'));}catch(_0x2d81c1){logger['error'](_0x2d81c1);}logger[_0xd519('0x1c')](_0xd519('0x41'),_0x5d9770['split']('.')[0x0]);return _0x5d9770[_0xd519('0x31')]('.')[0x0];});};exports[_0xd519('0x42')]=function(_0x5e2353,_0x546332){var _0x2970dd=_0xd519('0x43');var _0x1444b2,_0x511fed;var _0x5cff16;var _0x453fc3={'encoding':_0xd519('0x44'),'method':'POST','timeout':0x2710,'url':_0x2970dd,'headers':{'Content-Type':_0xd519('0x45')},'body':_0xd519('0x46')+encodeURIComponent(JSON[_0xd519('0x47')]([[[_0xd519('0x48'),JSON[_0xd519('0x47')]([_0x5e2353,_0x546332||'en',![],'null']),null,'generic']]]))};return rp(_0x453fc3)[_0xd519('0x3d')](function(_0x20883e){try{_0x5cff16=eval(_0x20883e[_0xd519('0x49')](0x5))[0x0][0x2];}catch(_0x445e0d){throw new Error(_0xd519('0x4a')+_0x20883e[_0xd519('0x24')]);}if(!_0x5cff16){if(_0x5e2353['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x546332+'\x22\x20might\x20not\x20exist');}}try{_0x5cff16=eval(_0x5cff16)[0x0];}catch(_0xfdb4f3){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xd519('0x24')]);}const _0x3c3aaf=_0x5cff16;_0x1444b2=path[_0xd519('0x2a')](__dirname,_0xd519('0x2b'),rs[_0xd519('0x2c')](0x4)+_0xd519('0x3e'));fs['writeFileSync'](_0x1444b2,_0x5cff16,{'encoding':_0xd519('0x2e')});_0x511fed=path[_0xd519('0x2a')](__dirname,_0xd519('0x2b'),rs[_0xd519('0x2c')](0x4)+_0xd519('0x40'));return convertFile(_0x1444b2,_0x511fed);})[_0xd519('0x3d')](function(){try{fs[_0xd519('0x1f')](_0x1444b2);fs[_0xd519('0x2f')](_0x511fed,'777');}catch(_0x5210ea){logger['error'](_0x5210ea);}logger['info'](_0xd519('0x4b'),_0x511fed[_0xd519('0x31')]('.')[0x0]);return _0x511fed[_0xd519('0x31')]('.')[0x0];});};exports[_0xd519('0x4c')]=function(_0x3a1502,_0x5a6e6d,_0x3f3097){return google[_0xd519('0x4d')](_0x3a1502,_0x5a6e6d,_0x3f3097)[_0xd519('0x3d')](function(_0x1fe91d){logger[_0xd519('0x1c')](_0x1fe91d[_0xd519('0x4e')]);return rp(_0x1fe91d);})[_0xd519('0x3d')](function(_0x482311){var _0x14821c='';var _0x3358b7=0x0;try{fs[_0xd519('0x1f')](_0x3a1502);}catch(_0x7cce83){logger[_0xd519('0x17')](_0x7cce83);}if(_0x482311&&_0x482311[_0xd519('0x4f')]){_0x14821c=_0x482311[_0xd519('0x4f')][_0xd519('0x50')](function(_0x2f4782){return _0x2f4782&&_0x2f4782[_0xd519('0x51')][0x0]&&_0x2f4782[_0xd519('0x51')][0x0][_0xd519('0x52')]?_0x2f4782[_0xd519('0x51')][0x0]['transcript']:'';})[_0xd519('0x53')]('\x0a');_0x3358b7=_0x482311['results'][_0xd519('0x50')](function(_0x36d636){return _0x36d636&&_0x36d636[_0xd519('0x51')][0x0]&&_0x36d636['alternatives'][0x0][_0xd519('0x54')]?_0x36d636[_0xd519('0x51')][0x0][_0xd519('0x54')]:0x0;})[_0xd519('0x53')]('\x0a');}logger[_0xd519('0x1c')]('googleASR\x20transcription',_0x14821c);logger[_0xd519('0x1c')](_0xd519('0x55'),_0x3358b7);return{'transcript':_0x14821c,'confidence':_0x3358b7};})['catch'](function(_0x1e9be0){logger[_0xd519('0x17')]('[%s]\x20%s:%s',_0x1e9be0[_0xd519('0x16')],_0x1e9be0['name'],_0x1e9be0[_0xd519('0x56')]);});};exports[_0xd519('0x57')]=function(_0xaa966d,_0x3b199c,_0x208986,_0x19c4e){var _0x43b5a6=apiai(_0x3b199c,{'language':_0x19c4e||'en'});return _0x43b5a6[_0xd519('0x58')](_0x208986,{'sessionId':md5(_0xaa966d)})[_0xd519('0x3d')](function(_0x249005){logger[_0xd519('0x1c')](JSON[_0xd519('0x47')](_0x249005));return{'source':_0x249005[_0xd519('0x59')][_0xd519('0x5a')],'resolvedQuery':_0x249005[_0xd519('0x59')][_0xd519('0x5b')],'action':_0x249005['result'][_0xd519('0x5c')],'actionIncomplete':_0x249005[_0xd519('0x59')][_0xd519('0x5d')],'speech':_0x249005[_0xd519('0x59')][_0xd519('0x5e')][_0xd519('0x5f')],'score':_0x249005[_0xd519('0x59')][_0xd519('0x60')],'statusCode':_0x249005[_0xd519('0x61')][_0xd519('0x62')],'endConversation':_0x249005[_0xd519('0x59')][_0xd519('0x63')][_0xd519('0x64')]||![],'isFallbackIntent':_0x249005[_0xd519('0x59')]['metadata'][_0xd519('0x65')]};});};exports[_0xd519('0x66')]=function(_0x45ed6f,_0x44892e,_0x2eb2da,_0x5d3024,_0x50da02,_0x4c206c){var _0x3b72ea=_0x5d3024[_0xd519('0x67')](/\\n/g,'\x0a');var _0x4e6971={'credentials':{'private_key':_0x3b72ea,'client_email':_0x2eb2da}};var _0x2b3708=new dialogflow[(_0xd519('0x68'))](_0x4e6971);var _0x4adca3=_0x2b3708[_0xd519('0x69')](_0x44892e,md5(_0x45ed6f));var _0xe076f7={'session':_0x4adca3,'queryInput':{'text':{'text':_0x50da02,'languageCode':_0x4c206c}}};return _0x2b3708['detectIntent'](_0xe076f7)[_0xd519('0x3d')](function(_0x59f014){if(_0x59f014&&_0x59f014[_0xd519('0x6a')]){logger[_0xd519('0x1c')](_0xd519('0x6b'),JSON[_0xd519('0x47')](_0x59f014));var _0x51de6e=_0x59f014[0x0];if(_0x51de6e){var _0x5f553d={'action':_0x51de6e[_0xd519('0x6c')][_0xd519('0x5c')],'allRequiredParamsPresent':_0x51de6e['queryResult']['allRequiredParamsPresent'],'endConversation':_0x51de6e[_0xd519('0x6c')][_0xd519('0x6d')]&&_0x51de6e[_0xd519('0x6c')][_0xd519('0x6d')]['fields']?_0x51de6e[_0xd519('0x6c')]['diagnosticInfo'][_0xd519('0x6e')][_0xd519('0x6f')]['boolValue']:![],'fulfillmentText':_0x51de6e[_0xd519('0x6c')][_0xd519('0x70')],'intentName':_0x51de6e['queryResult']['intent']['name'],'intentDisplayName':_0x51de6e[_0xd519('0x6c')]['intent'][_0xd519('0x71')],'isFallbackIntent':_0x51de6e[_0xd519('0x6c')]['intent'][_0xd519('0x72')],'languageCode':_0x51de6e[_0xd519('0x6c')][_0xd519('0x73')],'queryText':_0x51de6e['queryResult']['queryText'],'responseId':_0x51de6e[_0xd519('0x74')],'score':_0x51de6e['queryResult'][_0xd519('0x75')],'speech':_0x51de6e['queryResult'][_0xd519('0x70')],'providerResponse':JSON['stringify'](_0x59f014)};return _0x5f553d;}}});};exports[_0xd519('0x76')]=function(_0x385b4d,_0xba7379,_0x265ec6,_0x9d9e0b){return tilde[_0xd519('0x4d')](_0x385b4d,_0xba7379,_0x265ec6,_0x9d9e0b)[_0xd519('0x3d')](function(_0xf8a1ea){try{fs[_0xd519('0x1f')](_0x385b4d);}catch(_0x2a3d33){logger[_0xd519('0x17')](_0x2a3d33);}logger[_0xd519('0x1c')](_0xd519('0x77'),_0xf8a1ea[_0xd519('0x52')]);logger[_0xd519('0x1c')]('Tilde\x20ASR\x20confidence',_0xf8a1ea[_0xd519('0x54')]);return _0xf8a1ea;});};exports[_0xd519('0x78')]=function(_0x3f5581,_0x495fbe,_0x320d83,_0x25ebfa,_0x56e570,_0x1244e8){var _0x5313c8=path[_0xd519('0x2a')](__dirname,_0xd519('0x2b'),rs[_0xd519('0x2c')](0x4)+'.mp3');var _0x11c6e6;return aws[_0xd519('0x79')](_0x3f5581,_0x495fbe,_0x320d83,_0x25ebfa,_0x56e570,_0x1244e8,_0x5313c8)['then'](function(){_0x11c6e6=path['resolve'](__dirname,_0xd519('0x2b'),rs[_0xd519('0x2c')](0x4)+_0xd519('0x40'));return convertFile(_0x5313c8,_0x11c6e6);})[_0xd519('0x3d')](function(){try{fs['unlink'](_0x5313c8);fs[_0xd519('0x2f')](_0x11c6e6,_0xd519('0x30'));}catch(_0xbd2ec2){logger[_0xd519('0x17')](_0xbd2ec2);}return _0x11c6e6['split']('.')[0x0];});};exports[_0xd519('0x7a')]=function(_0x59feba,_0x350f2d,_0x572fc8,_0x2375f8,_0x1d8a1b,_0x3e7ab4){return aws[_0xd519('0x7b')](_0x59feba,_0x350f2d,_0x572fc8,_0x2375f8,_0x1d8a1b,_0x3e7ab4)[_0xd519('0x3d')](function(_0x247f32){logger[_0xd519('0x1c')](JSON[_0xd519('0x47')](_0x247f32));return _0x247f32;});};exports[_0xd519('0x7c')]=function(_0x36973f,_0xbf92c7,_0x267ae6,_0x361ceb){var _0x250fae=util[_0xd519('0x7d')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x36973f,encodeURIComponent(_0xbf92c7),_0x267ae6,_0x361ceb);var _0x571615=path['resolve'](__dirname,_0xd519('0x2b'),rs[_0xd519('0x2c')](0x4)+_0xd519('0x3e'));var _0x42f4c3;return downloadFile(_0x250fae,_0x571615)[_0xd519('0x3d')](function(){_0x42f4c3=path['resolve'](__dirname,_0xd519('0x2b'),rs[_0xd519('0x2c')](0x4)+_0xd519('0x40'));return convertFile(_0x571615,_0x42f4c3);})[_0xd519('0x3d')](function(){try{fs[_0xd519('0x1f')](_0x571615);fs[_0xd519('0x2f')](_0x42f4c3,'777');}catch(_0x4a6a24){logger[_0xd519('0x17')](_0x4a6a24);}return _0x42f4c3['split']('.')[0x0];});};exports['ispeechASR']=function(_0x31ae42,_0x3fa322,_0x407f49,_0x43b8f7){var _0x585b05=util[_0xd519('0x7d')](_0xd519('0x7e'),ISPEECH_API,_0x3fa322,_0x407f49,base64Encode(_0x31ae42),_0x43b8f7?util[_0xd519('0x7d')](_0xd519('0x7f'),encodeURIComponent(_0x43b8f7)):_0xd519('0x80'));return uploadFile(_0x585b05)[_0xd519('0x3d')](function(_0x297b8b){return querystring[_0xd519('0xa')](_0x297b8b);});};exports[_0xd519('0x81')]=function(_0x4957fe,_0x3ea977){return sestek[_0xd519('0x82')](_0x4957fe,_0x3ea977)[_0xd519('0x3d')](function(_0x954b38){logger[_0xd519('0x1c')](JSON[_0xd519('0x47')](_0x954b38));var _0xd6f218={'speech':_0x954b38['text'],'action':_0x954b38[_0xd519('0x83')]?_0x954b38[_0xd519('0x83')][_0xd519('0x84')]:undefined,'actiondata':_0x954b38[_0xd519('0x83')]?_0x954b38['channelData'][_0xd519('0x85')]:undefined};if(_0x954b38[_0xd519('0x83')]&&_0x954b38['channelData'][_0xd519('0x86')]){return base64Decode(_0x954b38[_0xd519('0x83')][_0xd519('0x86')][_0xd519('0x87')],path['resolve'](__dirname,_0xd519('0x2b'),rs[_0xd519('0x2c')](0x4)+_0xd519('0x40')))[_0xd519('0x3d')](function(_0x249918){_0xd6f218['audiofile']=_0x249918;return _0xd6f218;});}return _0xd6f218;});};exports['dirName']=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 4c545ad..2f875b8 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 _0x43fb=['exports','./nda'];(function(_0x4945d2,_0x5b8613){var _0xa4a8e4=function(_0xf3ad39){while(--_0xf3ad39){_0x4945d2['push'](_0x4945d2['shift']());}};_0xa4a8e4(++_0x5b8613);}(_0x43fb,0x19f));var _0xb43f=function(_0x56d487,_0x5f1b66){_0x56d487=_0x56d487-0x0;var _0x4229b1=_0x43fb[_0x56d487];return _0x4229b1;};var nda=require(_0xb43f('0x0'));module[_0xb43f('0x1')]={'nda':nda}; \ No newline at end of file +var _0xa781=['exports','./nda'];(function(_0x25eb68,_0x2b9197){var _0x359151=function(_0x32ea66){while(--_0x32ea66){_0x25eb68['push'](_0x25eb68['shift']());}};_0x359151(++_0x2b9197);}(_0xa781,0x11f));var _0x1a78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa781[_0x3dd15e];return _0x231fd0;};var nda=require(_0x1a78('0x0'));module[_0x1a78('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 bf203d2..bba9e09 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 _0xd404=['AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio'];(function(_0x5aa20c,_0x28b6ca){var _0x5d0a3a=function(_0x4b6cc8){while(--_0x4b6cc8){_0x5aa20c['push'](_0x5aa20c['shift']());}};_0x5d0a3a(++_0x28b6ca);}(_0xd404,0x15b));var _0x4d40=function(_0xcfc09a,_0xf0c7b9){_0xcfc09a=_0xcfc09a-0x0;var _0x275bcb=_0xd404[_0xcfc09a];return _0x275bcb;};'use strict';var rp=require(_0x4d40('0x0'));var url=require(_0x4d40('0x1'));var logger=require('../../../../../config/logger')(_0x4d40('0x2'));module[_0x4d40('0x3')]=function(_0x502a67,_0x3e9bbc){var _0x610dbf={'method':_0x4d40('0x4'),'uri':url[_0x4d40('0x5')](_0x3e9bbc[_0x4d40('0x6')],_0x4d40('0x7')),'form':{'grant_type':_0x4d40('0x8'),'username':_0x3e9bbc[_0x4d40('0x9')],'password':_0x3e9bbc[_0x4d40('0x8')]},'json':!![]};return rp(_0x610dbf)['then'](function(_0x292180){var _0x116941={'method':'POST','uri':url[_0x4d40('0x5')](_0x3e9bbc['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3e9bbc[_0x4d40('0xa')]||_0x4d40('0xb'),'channelId':_0x4d40('0xc'),'conversation':{'id':_0x502a67[_0x4d40('0xd')]},'from':{'id':_0x502a67[_0x4d40('0xe')],'name':_0x502a67[_0x4d40('0xf')]},'recipient':{'id':_0x502a67[_0x4d40('0x10')],'name':_0x502a67[_0x4d40('0x11')]},'text':_0x3e9bbc[_0x4d40('0x12')],'channelData':{}},'headers':{'Authorization':_0x4d40('0x13')+_0x292180[_0x4d40('0x14')]},'json':!![]};if(_0x3e9bbc[_0x4d40('0x15')]){_0x116941[_0x4d40('0x16')][_0x4d40('0x17')]['ProjectName']=_0x3e9bbc[_0x4d40('0x15')];}if(_0x3e9bbc[_0x4d40('0x18')]=='1'){_0x116941[_0x4d40('0x16')][_0x4d40('0x17')][_0x4d40('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3e9bbc[_0x4d40('0x1a')]){_0x116941[_0x4d40('0x16')][_0x4d40('0x17')][_0x4d40('0x1b')]=_0x3e9bbc[_0x4d40('0x1a')];if(_0x3e9bbc[_0x4d40('0x1c')]){_0x116941[_0x4d40('0x16')][_0x4d40('0x17')][_0x4d40('0x1d')]=_0x3e9bbc['custom_action_data'];}}logger['info'](JSON[_0x4d40('0x1e')](_0x116941));return rp(_0x116941);});}; \ No newline at end of file +var _0xa1e8=['exports','POST','resolve','ndauth_url','/token','username','password','then','ndassistant_url','ndaactivity_type','Nda','uniqueid','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','CustomAction','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi'];(function(_0x238719,_0xa42993){var _0x3afbee=function(_0x545728){while(--_0x545728){_0x238719['push'](_0x238719['shift']());}};_0x3afbee(++_0xa42993);}(_0xa1e8,0x1af));var _0x8a1e=function(_0x2dfe85,_0x147f2d){_0x2dfe85=_0x2dfe85-0x0;var _0x10b8c2=_0xa1e8[_0x2dfe85];return _0x10b8c2;};'use strict';var rp=require(_0x8a1e('0x0'));var url=require('url');var logger=require(_0x8a1e('0x1'))(_0x8a1e('0x2'));module[_0x8a1e('0x3')]=function(_0x55e9fc,_0x4e112e){var _0x5dd1f6={'method':_0x8a1e('0x4'),'uri':url[_0x8a1e('0x5')](_0x4e112e[_0x8a1e('0x6')],_0x8a1e('0x7')),'form':{'grant_type':'password','username':_0x4e112e[_0x8a1e('0x8')],'password':_0x4e112e[_0x8a1e('0x9')]},'json':!![]};return rp(_0x5dd1f6)[_0x8a1e('0xa')](function(_0x238e9e){var _0x483e06={'method':_0x8a1e('0x4'),'uri':url[_0x8a1e('0x5')](_0x4e112e[_0x8a1e('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x4e112e[_0x8a1e('0xc')]||'message','channelId':_0x8a1e('0xd'),'conversation':{'id':_0x55e9fc[_0x8a1e('0xe')]},'from':{'id':_0x55e9fc['callerid'],'name':_0x55e9fc['calleridname']},'recipient':{'id':_0x55e9fc[_0x8a1e('0xf')],'name':_0x55e9fc[_0x8a1e('0x10')]},'text':_0x4e112e[_0x8a1e('0x11')],'channelData':{}},'headers':{'Authorization':_0x8a1e('0x12')+_0x238e9e[_0x8a1e('0x13')]},'json':!![]};if(_0x4e112e[_0x8a1e('0x14')]){_0x483e06[_0x8a1e('0x15')]['channelData'][_0x8a1e('0x16')]=_0x4e112e[_0x8a1e('0x14')];}if(_0x4e112e[_0x8a1e('0x17')]=='1'){_0x483e06['body'][_0x8a1e('0x18')][_0x8a1e('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8a1e('0x1a')};}if(_0x4e112e['custom_action']){_0x483e06[_0x8a1e('0x15')][_0x8a1e('0x18')][_0x8a1e('0x1b')]=_0x4e112e['custom_action'];if(_0x4e112e['custom_action_data']){_0x483e06['body'][_0x8a1e('0x18')][_0x8a1e('0x1c')]=_0x4e112e['custom_action_data'];}}logger[_0x8a1e('0x1d')](JSON[_0x8a1e('0x1e')](_0x483e06));return rp(_0x483e06);});}; \ 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 ced839c..b9069e9 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x337c=['./lib/api','exports'];(function(_0x3b025f,_0x3f4d04){var _0xb129b2=function(_0x2fb05a){while(--_0x2fb05a){_0x3b025f['push'](_0x3b025f['shift']());}};_0xb129b2(++_0x3f4d04);}(_0x337c,0x98));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xc337('0x0'));module[_0xc337('0x1')]=function(_0x1cbc16,_0x270b26,_0x555363,_0x4b2570){return asr(_0x1cbc16,_0x270b26,_0x555363,_0x4b2570);}; \ No newline at end of file +var _0xc7e6=['./lib/api','exports'];(function(_0x5a9b6c,_0x30ccd0){var _0x72bed=function(_0x1468ea){while(--_0x1468ea){_0x5a9b6c['push'](_0x5a9b6c['shift']());}};_0x72bed(++_0x30ccd0);}(_0xc7e6,0x1a0));var _0x6c7e=function(_0x444a8b,_0x526b10){_0x444a8b=_0x444a8b-0x0;var _0x2cebf5=_0xc7e6[_0x444a8b];return _0x2cebf5;};'use strict';var asr=require(_0x6c7e('0x0'));module[_0x6c7e('0x1')]=function(_0x3eb7e3,_0x2bb4c1,_0x155f79,_0x5bb223){return asr(_0x3eb7e3,_0x2bb4c1,_0x155f79,_0x5bb223);}; \ 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 b8bea5b..dea352f 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 _0x5e72=['transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','error','status','result','final','hypotheses'];(function(_0x33a7e5,_0x316645){var _0x7c7133=function(_0x58bc62){while(--_0x58bc62){_0x33a7e5['push'](_0x33a7e5['shift']());}};_0x7c7133(++_0x316645);}(_0x5e72,0x147));var _0x25e7=function(_0x95e7f7,_0x5c6e79){_0x95e7f7=_0x95e7f7-0x0;var _0x5939f2=_0x5e72[_0x95e7f7];return _0x5939f2;};'use strict';var BPromise=require(_0x25e7('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x25e7('0x1'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x25e7('0x2'));module[_0x25e7('0x3')]=function(_0x2c3c99,_0x46f353,_0x269bde,_0x2c8175){return new BPromise(function(_0x45d2c1,_0x3f7eb0){logger['info'](_0x25e7('0x4'),_0x2c8175||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x40612f=new WebSocket(_0x2c8175||_0x25e7('0x5'),{'perMessageDeflate':![]});var _0x41f586='';var _0x5e7573='0';var _0x18ffca='1';var _0x3ccd7e=_0x25e7('0x6');function _0x3db60e(_0x2ab9e5){var _0x10b8c8=crypto[_0x25e7('0x7')](_0x25e7('0x8'));_0x10b8c8[_0x25e7('0x9')](_0x2ab9e5);return _0x10b8c8[_0x25e7('0xa')](_0x25e7('0xb'));}function _0xa4a649(){try{logger[_0x25e7('0xc')](_0x25e7('0xd'));var _0x574744=moment()['unix']();var _0xdd149b=_0x3db60e(_0x574744+_0x46f353+_0x269bde);_0x40612f[_0x25e7('0xe')](JSON[_0x25e7('0xf')]({'appID':_0x46f353,'timestamp':_0x574744,'appKey':_0xdd149b}));var _0x59f99c=fs[_0x25e7('0x10')](_0x2c3c99);_0x59f99c['on'](_0x25e7('0x11'),function(_0x4882b1){_0x40612f['send'](_0x4882b1);});_0x59f99c['on'](_0x25e7('0x12'),function(){_0x40612f[_0x25e7('0xe')]('EOS');});}catch(_0x2da28b){logger[_0x25e7('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x25e7('0xf')](_0x2da28b));_0x40612f['terminate']();}}function _0xc583f7(_0x1c347a){try{if(_0x1c347a){var _0x2bbf82=JSON['parse'](_0x1c347a);switch(_0x2bbf82[_0x25e7('0x14')]){case 0x0:if(_0x2bbf82[_0x25e7('0x15')]){if(_0x2bbf82[_0x25e7('0x15')][_0x25e7('0x16')]){logger[_0x25e7('0xc')]('Tilde\x20ASR\x20hypoteses',JSON[_0x25e7('0xf')](_0x2bbf82[_0x25e7('0x15')][_0x25e7('0x17')]));_0x41f586=_0x2bbf82['result'][_0x25e7('0x17')][0x0][_0x25e7('0x18')];_0x5e7573=_0x2bbf82[_0x25e7('0x15')][_0x25e7('0x17')][0x0][_0x25e7('0x19')];_0x18ffca='0';_0x3ccd7e=_0x25e7('0x1a');_0x40612f['terminate']();}}break;case 0x1:logger['info'](_0x25e7('0x6'));_0x18ffca='1';_0x3ccd7e=_0x25e7('0x6');break;case 0x2:logger[_0x25e7('0xc')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x18ffca='2';_0x3ccd7e=_0x25e7('0x1b');break;case 0x9:logger[_0x25e7('0xc')](_0x25e7('0x1c'));_0x18ffca='9';_0x3ccd7e='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x25e7('0xc')](_0x25e7('0x1d'));_0x18ffca='10';_0x3ccd7e=_0x25e7('0x1d');break;case 0xb:logger[_0x25e7('0xc')](_0x25e7('0x1e'));_0x18ffca='11';_0x3ccd7e=_0x25e7('0x1e');}}}catch(_0x2518b0){logger[_0x25e7('0x13')](_0x25e7('0x1f'),JSON[_0x25e7('0xf')](_0x2518b0));_0x40612f[_0x25e7('0x20')]();}}function _0x31baf8(){logger['info'](_0x25e7('0x21'));_0x45d2c1({'transcript':_0x41f586,'confidence':_0x5e7573,'status':_0x18ffca,'status_message':_0x3ccd7e});}function _0x573a47(_0x359dd1){logger['error'](_0x25e7('0x22'));if(!_[_0x25e7('0x23')](_0x359dd1)){logger['error'](_[_0x25e7('0x24')](_0x359dd1)?JSON['stringify'](_0x359dd1):_0x359dd1);}}_0x40612f['on'](_0x25e7('0x25'),_0xa4a649);_0x40612f['on'](_0x25e7('0x26'),_0xc583f7);_0x40612f['on'](_0x25e7('0x12'),_0x31baf8);_0x40612f['on'](_0x25e7('0x13'),_0x573a47);});}; \ No newline at end of file +var _0xd327=['hex','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xd327,0x1c8));var _0x7d32=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd327[_0x502c7d];return _0x30b7ed;};'use strict';var BPromise=require(_0x7d32('0x0'));var _=require(_0x7d32('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x7d32('0x2'));var logger=require(_0x7d32('0x3'))('agi');module[_0x7d32('0x4')]=function(_0x5f2614,_0x4551b0,_0x3f33a2,_0x36d523){return new BPromise(function(_0x31bbe5,_0x53d577){logger[_0x7d32('0x5')](_0x7d32('0x6'),_0x36d523||_0x7d32('0x7'));var _0x4525d9=new WebSocket(_0x36d523||_0x7d32('0x7'),{'perMessageDeflate':![]});var _0x14fa88='';var _0x2559a1='0';var _0xdf6e0f='1';var _0x378c04=_0x7d32('0x8');function _0x2c659a(_0x20391d){var _0x23de10=crypto[_0x7d32('0x9')](_0x7d32('0xa'));_0x23de10['update'](_0x20391d);return _0x23de10[_0x7d32('0xb')](_0x7d32('0xc'));}function _0x4aaeae(){try{logger[_0x7d32('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x1fff99=moment()['unix']();var _0xcf1bc8=_0x2c659a(_0x1fff99+_0x4551b0+_0x3f33a2);_0x4525d9['send'](JSON[_0x7d32('0xd')]({'appID':_0x4551b0,'timestamp':_0x1fff99,'appKey':_0xcf1bc8}));var _0x1b7834=fs[_0x7d32('0xe')](_0x5f2614);_0x1b7834['on'](_0x7d32('0xf'),function(_0x17901b){_0x4525d9[_0x7d32('0x10')](_0x17901b);});_0x1b7834['on'](_0x7d32('0x11'),function(){_0x4525d9[_0x7d32('0x10')](_0x7d32('0x12'));});}catch(_0x149a71){logger[_0x7d32('0x13')](_0x7d32('0x14'),JSON[_0x7d32('0xd')](_0x149a71));_0x4525d9[_0x7d32('0x15')]();}}function _0x2ac288(_0x509866){try{if(_0x509866){var _0x2d977a=JSON[_0x7d32('0x16')](_0x509866);switch(_0x2d977a[_0x7d32('0x17')]){case 0x0:if(_0x2d977a['result']){if(_0x2d977a[_0x7d32('0x18')][_0x7d32('0x19')]){logger[_0x7d32('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x7d32('0xd')](_0x2d977a[_0x7d32('0x18')][_0x7d32('0x1a')]));_0x14fa88=_0x2d977a['result'][_0x7d32('0x1a')][0x0][_0x7d32('0x1b')];_0x2559a1=_0x2d977a[_0x7d32('0x18')]['hypotheses'][0x0]['likelihood'];_0xdf6e0f='0';_0x378c04=_0x7d32('0x1c');_0x4525d9[_0x7d32('0x15')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0xdf6e0f='1';_0x378c04=_0x7d32('0x8');break;case 0x2:logger['info'](_0x7d32('0x1d'));_0xdf6e0f='2';_0x378c04=_0x7d32('0x1d');break;case 0x9:logger[_0x7d32('0x5')](_0x7d32('0x1e'));_0xdf6e0f='9';_0x378c04='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0xdf6e0f='10';_0x378c04=_0x7d32('0x1f');break;case 0xb:logger[_0x7d32('0x5')](_0x7d32('0x20'));_0xdf6e0f='11';_0x378c04='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x202dd5){logger[_0x7d32('0x13')](_0x7d32('0x21'),JSON[_0x7d32('0xd')](_0x202dd5));_0x4525d9[_0x7d32('0x15')]();}}function _0x5de4bc(){logger['info'](_0x7d32('0x22'));_0x31bbe5({'transcript':_0x14fa88,'confidence':_0x2559a1,'status':_0xdf6e0f,'status_message':_0x378c04});}function _0x454ad3(_0x1e6c74){logger[_0x7d32('0x13')](_0x7d32('0x23'));if(!_[_0x7d32('0x24')](_0x1e6c74)){logger[_0x7d32('0x13')](_[_0x7d32('0x25')](_0x1e6c74)?JSON[_0x7d32('0xd')](_0x1e6c74):_0x1e6c74);}}_0x4525d9['on']('open',_0x4aaeae);_0x4525d9['on'](_0x7d32('0x26'),_0x2ac288);_0x4525d9['on'](_0x7d32('0x11'),_0x5de4bc);_0x4525d9['on'](_0x7d32('0x13'),_0x454ad3);});}; \ 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 97351ca..573e388 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 _0x7847=['./asr','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7847,0xde));var _0x7784=function(_0xa91c8b,_0x178735){_0xa91c8b=_0xa91c8b-0x0;var _0x16cace=_0x7847[_0xa91c8b];return _0x16cace;};var asr=require(_0x7784('0x0'));module[_0x7784('0x1')]={'asr':asr}; \ No newline at end of file +var _0xc6e9=['./asr','exports'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0xc6e9,0x10c));var _0x9c6e=function(_0xb832a5,_0x5c130c){_0xb832a5=_0xb832a5-0x0;var _0x53cb6b=_0xc6e9[_0xb832a5];return _0x53cb6b;};var asr=require(_0x9c6e('0x0'));module[_0x9c6e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 394698b..38b652d 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 _0xe6ba=['EventEmitter','./error','./channel','127.0.0.1','call','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','emit','E_AGI_SERVER_ERROR','error','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe6ba,0x6c));var _0xae6b=function(_0x19c346,_0x302fcd){_0x19c346=_0x19c346-0x0;var _0x1d091c=_0xe6ba[_0x19c346];return _0x1d091c;};'use strict';var util=require(_0xae6b('0x0'));var net=require(_0xae6b('0x1'));var EventEmitter=require('events')[_0xae6b('0x2')];var AGIError=require(_0xae6b('0x3'));var AGIChannel=require(_0xae6b('0x4'));var AGIServer=function(_0x1fbf2c,_0x4f0350,_0x5d8d11){var _0x3b1a1a=this,_0x1fbf2c=_0x1fbf2c||0x11dd,_0x4f0350=_0x4f0350||_0xae6b('0x5'),_0x3f42de=null,_0x4345fd=0x0;EventEmitter[_0xae6b('0x6')](_0x3b1a1a);function _0x298798(){if(!_0x1fbf2c){_0x3b1a1a['emit']('error',new AGIError(_0xae6b('0x7')));return![];}_0x3f42de=net[_0xae6b('0x8')]();_0x3f42de[_0xae6b('0x9')](_0x1fbf2c,_0x4f0350);_0x3f42de['on'](_0xae6b('0xa'),function(){_0x3b1a1a['emit'](_0xae6b('0xa'));});_0x3f42de['on'](_0xae6b('0xb'),function(_0x33922a){_0x3f42de['getConnections'](function(_0x264d1f,_0x908bfa){if(_0x264d1f){_0x3b1a1a[_0xae6b('0xc')]('error',new AGIError(_0xae6b('0xd'),_0x264d1f));}else if(_0x5d8d11&&_0x5d8d11<0x0){_0x3b1a1a[_0xae6b('0xc')](_0xae6b('0xe'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x33922a[_0xae6b('0xf')]();}else if(_0x5d8d11&&_0x5d8d11>0x0&&_0x5d8d11<_0x908bfa){_0x4345fd+=0x1;_0x3b1a1a[_0xae6b('0xc')](_0xae6b('0xe'),new AGIError(_0xae6b('0x10'),_0x4345fd));_0x33922a[_0xae6b('0xf')]();}else{var _0x41f5c5=new AGIChannel(_0x33922a);_0x41f5c5['on']('ready',function(){_0x3b1a1a[_0xae6b('0xc')](_0xae6b('0xb'),_0x41f5c5);});}});});_0x3f42de['on'](_0xae6b('0xe'),function(_0x167960){_0x3b1a1a[_0xae6b('0xc')]('error',new AGIError(_0xae6b('0xd'),_0x167960[_0xae6b('0x11')]));});_0x3f42de['on'](_0xae6b('0x12'),function(){_0x3b1a1a[_0xae6b('0xc')](_0xae6b('0x12'),new AGIError(_0xae6b('0x13')));});}process[_0xae6b('0x14')](function(){_0x298798();});};util['inherits'](AGIServer,EventEmitter);module[_0xae6b('0x15')]=function(_0x196487,_0x34691c,_0x55eac0){return new AGIServer(_0x196487,_0x34691c,_0x55eac0);}; \ No newline at end of file +var _0x2283=['ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','net','EventEmitter','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION'];(function(_0x11a6fa,_0x263fc3){var _0x2ee0d1=function(_0x9cf57a){while(--_0x9cf57a){_0x11a6fa['push'](_0x11a6fa['shift']());}};_0x2ee0d1(++_0x263fc3);}(_0x2283,0x1d2));var _0x3228=function(_0x1ef863,_0x3d7b1f){_0x1ef863=_0x1ef863-0x0;var _0x3a18ab=_0x2283[_0x1ef863];return _0x3a18ab;};'use strict';var util=require('util');var net=require(_0x3228('0x0'));var EventEmitter=require('events')[_0x3228('0x1')];var AGIError=require('./error');var AGIChannel=require(_0x3228('0x2'));var AGIServer=function(_0x565dec,_0x54e531,_0x361cbc){var _0x446c42=this,_0x565dec=_0x565dec||0x11dd,_0x54e531=_0x54e531||_0x3228('0x3'),_0x2217d5=null,_0x56aadd=0x0;EventEmitter[_0x3228('0x4')](_0x446c42);function _0x142507(){if(!_0x565dec){_0x446c42[_0x3228('0x5')](_0x3228('0x6'),new AGIError(_0x3228('0x7')));return![];}_0x2217d5=net[_0x3228('0x8')]();_0x2217d5[_0x3228('0x9')](_0x565dec,_0x54e531);_0x2217d5['on'](_0x3228('0xa'),function(){_0x446c42[_0x3228('0x5')]('listening');});_0x2217d5['on'](_0x3228('0xb'),function(_0xa676b7){_0x2217d5[_0x3228('0xc')](function(_0x26c698,_0x1752ad){if(_0x26c698){_0x446c42[_0x3228('0x5')](_0x3228('0x6'),new AGIError(_0x3228('0xd'),_0x26c698));}else if(_0x361cbc&&_0x361cbc<0x0){_0x446c42[_0x3228('0x5')](_0x3228('0x6'),new AGIError(_0x3228('0xe')));_0xa676b7[_0x3228('0xf')]();}else if(_0x361cbc&&_0x361cbc>0x0&&_0x361cbc<_0x1752ad){_0x56aadd+=0x1;_0x446c42[_0x3228('0x5')](_0x3228('0x6'),new AGIError(_0x3228('0x10'),_0x56aadd));_0xa676b7[_0x3228('0xf')]();}else{var _0x555c44=new AGIChannel(_0xa676b7);_0x555c44['on'](_0x3228('0x11'),function(){_0x446c42['emit']('connection',_0x555c44);});}});});_0x2217d5['on'](_0x3228('0x6'),function(_0x4ed706){_0x446c42[_0x3228('0x5')](_0x3228('0x6'),new AGIError(_0x3228('0xd'),_0x4ed706[_0x3228('0x12')]));});_0x2217d5['on'](_0x3228('0x13'),function(){_0x446c42[_0x3228('0x5')](_0x3228('0x13'),new AGIError(_0x3228('0x14')));});}process[_0x3228('0x15')](function(){_0x142507();});};util['inherits'](AGIServer,EventEmitter);module[_0x3228('0x16')]=function(_0x2e1976,_0x490ff0,_0x567bbe){return new AGIServer(_0x2e1976,_0x490ff0,_0x567bbe);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3ff1f76..a89cee2 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 _0x1f3d=['SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','Trying\x20DialogflowV2:\x20%s','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','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','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','toString','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','replace','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','util','lodash','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','rawHeaders','rawBody','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agent','error','agentUnpause','internal','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','method','timeout','number','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','url','headers','stringify','statusCode','statusMessage','message','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','awsPolly','aws_access_key_id','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','includes','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','length','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','result','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','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','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block'];(function(_0x118796,_0x156f22){var _0x592d87=function(_0x19aa5c){while(--_0x19aa5c){_0x118796['push'](_0x118796['shift']());}};_0x592d87(++_0x156f22);}(_0x1f3d,0x10f));var _0xd1f3=function(_0x1129da,_0x31cf2d){_0x1129da=_0x1129da-0x0;var _0x433dea=_0x1f3d[_0x1129da];return _0x433dea;};'use strict';var fs=require('fs');var path=require(_0xd1f3('0x0'));var util=require(_0xd1f3('0x1'));var _=require(_0xd1f3('0x2'));var sh=require('shelljs');var odbc=require(_0xd1f3('0x3'))();var rs=require(_0xd1f3('0x4'));var moment=require(_0xd1f3('0x5'));var Mustache=require(_0xd1f3('0x6'));var rp=require(_0xd1f3('0x7'));var logger=require('../../config/logger')(_0xd1f3('0x8'));var config=require(_0xd1f3('0x9'));var scripts=require(_0xd1f3('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xd1f3('0xb'),_0xd1f3('0xc')];var verticesWithRetry=['menu','getdigits',_0xd1f3('0xd')];var AGIVertices=function(_0x3b1b3c,_0x2b9b6f,_0x5bf5da){this[_0xd1f3('0xe')]=_0x3b1b3c;this[_0xd1f3('0xf')]=_0x2b9b6f;this[_0xd1f3('0x10')]=_0x5bf5da;};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x12')]=function(_0xec5588,_0x36aeb5){this[_0xd1f3('0xf')][_0xd1f3('0x13')](_0xec5588)[_0xd1f3('0x14')](function(_0x24598e){_0x36aeb5(null,_0x24598e?_0x24598e[_0xd1f3('0x15')]:![]);})[_0xd1f3('0x16')](function(_0x1447b3){_0x36aeb5(_0x1447b3);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x17')]=function(_0x5c47a5,_0x56bf76){this['rpc'][_0xd1f3('0x18')](_0x5c47a5)[_0xd1f3('0x14')](function(_0x517abe){_0x56bf76(null,_0x517abe?_0x517abe['name']:![]);})[_0xd1f3('0x16')](function(_0x995e02){_0x56bf76(_0x995e02);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x19')]=function(_0x44097a,_0x182970){this[_0xd1f3('0xf')][_0xd1f3('0x1a')](_0x44097a)[_0xd1f3('0x14')](function(_0x23c593){_0x182970(null,_0x23c593?_0x23c593[_0xd1f3('0x15')]:![]);})['catch'](function(_0x44496e){_0x182970(_0x44496e);});};AGIVertices['prototype'][_0xd1f3('0x1b')]=function(_0x30b6b3,_0x3fa9e3){this[_0xd1f3('0xf')][_0xd1f3('0x1c')](_0x30b6b3)['then'](function(_0xc879ab){_0x3fa9e3(null,_0xc879ab?_0xc879ab[_0xd1f3('0x1d')]:![]);})[_0xd1f3('0x16')](function(_0x5c7c6c){_0x3fa9e3(_0x5c7c6c);});};AGIVertices[_0xd1f3('0x11')]['getUser']=function(_0x3e2ffa,_0x187ce2){this['rpc'][_0xd1f3('0x1e')](_0x3e2ffa)[_0xd1f3('0x14')](function(_0x402e5f){_0x187ce2(null,_0x402e5f?_0x402e5f[_0xd1f3('0x15')]:![]);})[_0xd1f3('0x16')](function(_0xfbe28b){_0x187ce2(_0xfbe28b);});};AGIVertices[_0xd1f3('0x11')]['getTrunk']=function(_0x11bf76,_0x47033e){this['rpc'][_0xd1f3('0x1f')](_0x11bf76)[_0xd1f3('0x14')](function(_0x426f66){_0x47033e(null,_0x426f66?_0x426f66['name']:![]);})[_0xd1f3('0x16')](function(_0x314da3){_0x47033e(_0x314da3);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x20')]=function(_0x2c36b7,_0x3b14b7){var _0x148980=this;this[_0xd1f3('0xf')]['getSoundById'](_0x2c36b7)[_0xd1f3('0x14')](function(_0x583d25){_0x3b14b7(null,_0x583d25?_0x148980['getSoundPath'](_0x583d25[_0xd1f3('0x21')]):![]);})['catch'](function(_0x218eb8){_0x3b14b7(_0x218eb8);});};AGIVertices[_0xd1f3('0x11')]['getMailAccount']=function(_0x24e66d,_0x4782fc){this[_0xd1f3('0xf')][_0xd1f3('0x22')](_0x24e66d)['then'](function(_0x40da57){_0x4782fc(null,_0x40da57?_0x40da57:![]);})[_0xd1f3('0x16')](function(_0x3c725b){_0x4782fc(_0x3c725b);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x23')]=function(_0x20eac9,_0xb674bb,_0x154140){this[_0xd1f3('0x10')][_0xd1f3('0x23')](_0x20eac9,_0xb674bb)[_0xd1f3('0x14')](function(){_0x154140(null);})[_0xd1f3('0x16')](function(_0x4e3804){_0x154140(_0x4e3804);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x24')]=function(_0x5d7a69,_0x48c910){this[_0xd1f3('0xf')][_0xd1f3('0x25')](_0x5d7a69)[_0xd1f3('0x14')](function(_0x557d7f){if(_0x557d7f){if(_0x557d7f[_0xd1f3('0x26')]){_0x48c910(null,[_0x557d7f['interval']]);}else{_0x48c910(null,_[_0xd1f3('0x27')](_0x557d7f[_0xd1f3('0x28')],_0xd1f3('0x29')));}}else{_0x48c910(null,![]);}})[_0xd1f3('0x16')](function(_0x2d3830){_0x48c910(_0x2d3830);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x2a')]=function(_0x80e42b){return util[_0xd1f3('0x2b')](_0xd1f3('0x2c'),FILES_PATH,_0x80e42b);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x2d')]=function(_0x58f46d,_0x1305ac,_0x348065){odbc[_0xd1f3('0x2e')](_0x58f46d,function(_0xea208f){if(_0xea208f){logger['error'](_0xd1f3('0x2f'),_0xea208f);_0x348065(_0xea208f);}else{logger[_0xd1f3('0x30')]('ODBC\x20connection\x20successfully');odbc['query'](_0x1305ac,function(_0x4d4768,_0xc3905b){if(_0x4d4768){logger['info']('Error\x20executing\x20query\x20%s',_0x1305ac);_0x348065(_0x4d4768);}else{logger[_0xd1f3('0x30')]('Query\x20executed\x20correctly\x20%s',_0x1305ac);odbc[_0xd1f3('0x31')](function(_0x5bfb03){if(_0x5bfb03){logger['error'](_0xd1f3('0x32'),_0x5bfb03);}_0x348065(null,_0xc3905b);});}});}});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x33')]=function(_0x405eee,_0x453e7c){this[_0xd1f3('0xf')][_0xd1f3('0x34')](_0x405eee)[_0xd1f3('0x14')](function(_0x4e395b){_0x453e7c(null,_0x4e395b?_0x4e395b:![]);})[_0xd1f3('0x16')](function(_0x5882ea){_0x453e7c(_0x5882ea);});};AGIVertices[_0xd1f3('0x11')]['createSmsMessage']=function(_0x38b15e,_0x39f262){this[_0xd1f3('0xf')][_0xd1f3('0x35')](_0x38b15e)['then'](function(_0xcb76d4){_0x39f262(null,_0xcb76d4);})[_0xd1f3('0x16')](function(_0x13b2ff){_0x39f262(_0x13b2ff);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x1c68e2,_0x1a8717,_0x24c3ab){this[_0xd1f3('0xf')][_0xd1f3('0x36')]({'uniqueid':this['channel'][_0xd1f3('0x37')],'node':_0x1c68e2[_0xd1f3('0x38')],'application':_0x1c68e2[_0xd1f3('0x39')],'data':_0x1a8717||null,'project_name':this['channel'][_0xd1f3('0x3a')],'callerid':this[_0xd1f3('0xe')][_0xd1f3('0x3b')]})[_0xd1f3('0x14')](function(_0x235d9e){if(_0x24c3ab){_0x24c3ab(null,_0x235d9e);}})[_0xd1f3('0x16')](function(_0x22d166){if(_0x24c3ab){_0x24c3ab(_0x22d166);}});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x3c')]=function(_0x268b9e,_0x2b5c5f,_0x3b048d,_0x4c84c1){this[_0xd1f3('0xf')][_0xd1f3('0x3c')]({'uniqueid':this[_0xd1f3('0xe')][_0xd1f3('0x37')],'callerid':this['channel'][_0xd1f3('0x3b')],'calleridname':this['channel'][_0xd1f3('0x3d')],'context':this[_0xd1f3('0xe')]['context'],'extension':this['channel']['extension'],'priority':this[_0xd1f3('0xe')]['priority'],'accountcode':this[_0xd1f3('0xe')][_0xd1f3('0x3e')],'dnid':this['channel'][_0xd1f3('0x3f')],'projectName':this[_0xd1f3('0xe')][_0xd1f3('0x3a')],'saveName':_0x2b5c5f,'filename':_0x268b9e['file']||_0x2b5c5f,'savePath':_0x3b048d})[_0xd1f3('0x14')](function(_0x27d5c7){_0x4c84c1(null,_0x27d5c7);})[_0xd1f3('0x16')](function(_0x594402){_0x4c84c1(_0x594402);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x40')]=function(_0x326707,_0x581144,_0x487e40,_0x2589ec,_0x20c6a6){this[_0xd1f3('0xf')]['createSquareMessage']({'uniqueid':this['channel'][_0xd1f3('0x37')],'body':_0x326707,'direction':_0x581144,'providerName':_0x487e40,'providerResponse':_0x2589ec})[_0xd1f3('0x14')](function(_0x4251ff){if(_0x20c6a6){_0x20c6a6(null,_0x4251ff);}})[_0xd1f3('0x16')](function(_0x4e1faa){if(_0x20c6a6){_0x20c6a6(_0x4e1faa);}});};AGIVertices['prototype'][_0xd1f3('0x41')]=function(_0x56a74f,_0xecca08){this[_0xd1f3('0xf')][_0xd1f3('0x41')]({'firstName':_[_0xd1f3('0x42')](_0x56a74f['name'])||_[_0xd1f3('0x43')](_0x56a74f[_0xd1f3('0x15')])?_0xd1f3('0x44')+Math[_0xd1f3('0x45')]():_0x56a74f[_0xd1f3('0x15')],'lastName':_[_0xd1f3('0x42')](_0x56a74f[_0xd1f3('0x46')])||_[_0xd1f3('0x43')](_0x56a74f[_0xd1f3('0x46')])?null:_0x56a74f[_0xd1f3('0x46')],'phone':_0x56a74f[_0xd1f3('0x47')],'ListId':_0x56a74f['list_id'],'scheduledat':_0x56a74f[_0xd1f3('0x48')],'callbackUniqueid':this[_0xd1f3('0xe')][_0xd1f3('0x37')],'tags':_0xd1f3('0x49'),'description':_0xd1f3('0x4a')+_0x56a74f[_0xd1f3('0x48')]['toString'](),'priority':_0x56a74f[_0xd1f3('0x4b')]})[_0xd1f3('0x14')](function(_0x3a3180){_0xecca08(null,_0x3a3180);})['catch'](function(_0x24089a){_0xecca08(_0x24089a);});};AGIVertices[_0xd1f3('0x11')]['getPause']=function(_0x555265,_0xf52bcf){this[_0xd1f3('0xf')][_0xd1f3('0x4c')](_0x555265)['then'](function(_0x3f6b45){_0xf52bcf(null,_0x3f6b45?_0x3f6b45[_0xd1f3('0x15')]:![]);})[_0xd1f3('0x16')](function(_0x55bfd1){_0xf52bcf(_0x55bfd1);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x4d')]=function(_0x2a2751,_0x3a5df6,_0x57182d){var _0xb0df45={'role':_0xd1f3('0x4e')};_0xb0df45[_0x2a2751]=this[_0xd1f3('0xe')][_0xd1f3('0x3b')];this[_0xd1f3('0xf')][_0xd1f3('0x4d')](_0xb0df45,_0x3a5df6,this['channel'][_0xd1f3('0x37')])['then'](function(_0x14505e){_0x57182d(null,_[_0xd1f3('0x43')](_0x14505e)?![]:!![]);})[_0xd1f3('0x16')](function(_0x423dcc){logger[_0xd1f3('0x4f')](_0x423dcc);_0x57182d(null,![]);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x50')]=function(_0x169ae4,_0x50b9f2){var _0x2f09e5={'role':_0xd1f3('0x4e')};_0x2f09e5[_0x169ae4]=this[_0xd1f3('0xe')][_0xd1f3('0x3b')];this['rpc']['agentUnpause'](_0x2f09e5)['then'](function(_0x434850){_0x50b9f2(null,_['isNil'](_0x434850)?![]:!![]);})[_0xd1f3('0x16')](function(_0x3bcf86){logger[_0xd1f3('0x4f')](_0x3bcf86);_0x50b9f2(null,![]);});};AGIVertices[_0xd1f3('0x11')]['agentLogout']=function(_0x580e76,_0x34133e){var _0x316a02={'role':'agent'};_0x316a02[_0x580e76]=this[_0xd1f3('0xe')][_0xd1f3('0x3b')];this[_0xd1f3('0xf')]['agentLogout'](_0x316a02)[_0xd1f3('0x14')](function(_0x6e1f47){_0x34133e(null,_[_0xd1f3('0x43')](_0x6e1f47)?![]:!![]);})[_0xd1f3('0x16')](function(_0x636152){logger[_0xd1f3('0x4f')](_0x636152);_0x34133e(null,![]);});};AGIVertices[_0xd1f3('0x11')]['agentLogin']=function(_0x2e9670,_0x6da335){var _0x5de71d={'role':_0xd1f3('0x4e')};_0x5de71d[_0x2e9670]=this[_0xd1f3('0xe')][_0xd1f3('0x3b')];var _0x54d9ed=_0x2e9670!=_0xd1f3('0x51')?util[_0xd1f3('0x2b')]('%s/%s@from-sip/n','LOCAL',this[_0xd1f3('0xe')]['callerid']):undefined;this['rpc'][_0xd1f3('0x52')](_0x5de71d,_0x54d9ed)[_0xd1f3('0x14')](function(_0x3f6a07){_0x6da335(null,_[_0xd1f3('0x43')](_0x3f6a07)?![]:!![]);})['catch'](function(_0x4ded96){logger['error'](_0x4ded96);_0x6da335(null,![]);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x53')]=function(_0x35e689,_0x2b6095){sh[_0xd1f3('0x54')](_[_0xd1f3('0x55')](_0x35e689),function(_0x2abbc6,_0x1a9dfa){var _0x59f340=_0x1a9dfa['replace'](/(\r\n|\n|\r)/gm,'');_0x2b6095(null,_0x59f340);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x56')]=function(_0x4374dc,_0x3b5ea2){scripts[_0xd1f3('0x56')](_0x4374dc[_0xd1f3('0x57')],_0x4374dc[_0xd1f3('0x58')]||_0xd1f3('0x59'),_0x4374dc[_0xd1f3('0x59')],_0x4374dc[_0xd1f3('0x5a')]||_0xd1f3('0x5b'),_0x4374dc['ssmlGender']||_0xd1f3('0x5c'),_0x4374dc[_0xd1f3('0x5d')]||'MP3')['then'](function(_0x48d3d1){_0x3b5ea2(null,_0x48d3d1);})['catch'](function(_0x3dc00d){_0x3b5ea2(_0x3dc00d);});};AGIVertices[_0xd1f3('0x11')]['googleTTS']=function(_0x3f857d,_0x11c187){scripts[_0xd1f3('0x5e')](_0x3f857d['text'],_0x3f857d[_0xd1f3('0x5f')]||'en',0x1)[_0xd1f3('0x14')](function(_0x373e08){_0x11c187(null,_0x373e08);})['catch'](function(_0x323540){_0x11c187(_0x323540);});};AGIVertices['prototype'][_0xd1f3('0x60')]=function(_0x2c6a44,_0x51d22e){var _0x180dec={'uri':_0x2c6a44['url'],'method':_0x2c6a44[_0xd1f3('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2c6a44[_0xd1f3('0x62')])===_0xd1f3('0x63')&&parseInt(_0x2c6a44['timeout'])>=0x1?parseInt(_0x2c6a44[_0xd1f3('0x62')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0xd1f3('0x64')],_0x180dec['method'][_0xd1f3('0x65')]())){try{_0x180dec[_0xd1f3('0x66')]=_0x2c6a44[_0xd1f3('0xc')]?JSON['parse'](_0x2c6a44[_0xd1f3('0xc')]):{};}catch(_0x566c4a){logger[_0xd1f3('0x4f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x566c4a);}}try{_0x180dec['headers']=_0x2c6a44[_0xd1f3('0xb')]?JSON[_0xd1f3('0x67')](_0x2c6a44[_0xd1f3('0xb')]):{};}catch(_0x460f1c){logger[_0xd1f3('0x4f')](_0xd1f3('0x68'),_0x460f1c);}if(_0x2c6a44[_0xd1f3('0x69')]){try{var _0x389e2f=require(_0x2c6a44['computedVariables'])[_0xd1f3('0x6a')](this,_0x180dec);_0x180dec['uri']=Mustache[_0xd1f3('0x6b')](_0x2c6a44[_0xd1f3('0x6c')],_0x389e2f,{},['$$','$$']);if(_0x180dec[_0xd1f3('0x6d')]){_0x180dec['headers']=JSON[_0xd1f3('0x67')](Mustache[_0xd1f3('0x6b')](JSON[_0xd1f3('0x6e')](_0x180dec[_0xd1f3('0x6d')]),_0x389e2f,{},['$$','$$']));}if(_0x180dec['body']){_0x180dec['body']=JSON[_0xd1f3('0x67')](Mustache[_0xd1f3('0x6b')](JSON[_0xd1f3('0x6e')](_0x180dec[_0xd1f3('0x66')]),_0x389e2f,{},['$$','$$']));}}catch(_0x17d403){logger[_0xd1f3('0x4f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x17d403);}}rp(_0x180dec)['then'](function(_0x56bcf5){var _0x29d3c1={'statusCode':_0x56bcf5[_0xd1f3('0x6f')]||0xc8,'statusMessage':_0x56bcf5[_0xd1f3('0x70')]||'OK','headers':_0x56bcf5[_0xd1f3('0x6d')]||{},'body':_0x56bcf5['body']||{}};_0x51d22e(null,_0x29d3c1);})[_0xd1f3('0x16')](function(_0x1309d0){var _0x4fde13={'statusCode':_0x1309d0[_0xd1f3('0x6f')]||0x1f4,'statusMessage':_0x1309d0[_0xd1f3('0x71')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1309d0[_0xd1f3('0x72')][_0xd1f3('0x6d')]||{},'body':_0x1309d0[_0xd1f3('0x72')][_0xd1f3('0x66')]||{}};_0x51d22e(null,_0x4fde13);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x73')]=function(_0x2ee1a5,_0x19e4ad){scripts['googleDialogflow'](this[_0xd1f3('0xe')][_0xd1f3('0x37')],_0x2ee1a5[_0xd1f3('0x74')],_0x2ee1a5['text'],_0x2ee1a5[_0xd1f3('0x75')]||'en')[_0xd1f3('0x14')](function(_0x525aa8){_0x19e4ad(null,_0x525aa8);})[_0xd1f3('0x16')](function(_0x2c2ab6){_0x19e4ad(_0x2c2ab6);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x38a0a4,_0x27f901){scripts[_0xd1f3('0x76')](this['channel'][_0xd1f3('0x37')],_0x38a0a4[_0xd1f3('0x77')],_0x38a0a4[_0xd1f3('0x78')],_0x38a0a4[_0xd1f3('0x79')],_0x38a0a4['text'],_0x38a0a4[_0xd1f3('0x7a')]||'en')[_0xd1f3('0x14')](function(_0x8cd801){_0x27f901(null,_0x8cd801);})['catch'](function(_0xb849ea){_0x27f901(_0xb849ea);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x7b')]=function(_0x49a1b1,_0x35c5df){scripts[_0xd1f3('0x7b')](this[_0xd1f3('0xe')],_0x49a1b1)[_0xd1f3('0x14')](function(_0x4dbbda){_0x35c5df(null,_0x4dbbda);})[_0xd1f3('0x16')](function(_0x3833a8){_0x35c5df(_0x3833a8);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x7c')]=function(_0x3e25f3,_0xec47cb){scripts[_0xd1f3('0x7c')](_0x3e25f3[_0xd1f3('0x74')],_0x3e25f3[_0xd1f3('0x59')],_0x3e25f3[_0xd1f3('0x7d')]||_0xd1f3('0x5b'),_0x3e25f3[_0xd1f3('0x7e')])[_0xd1f3('0x14')](function(_0x359843){_0xec47cb(null,_0x359843);})[_0xd1f3('0x16')](function(_0x46258){_0xec47cb(_0x46258);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x7f')]=function(_0x45bd00,_0x20d192,_0x5b8925){scripts['ispeechASR'](_0x20d192,_0x45bd00[_0xd1f3('0x74')],_0x45bd00[_0xd1f3('0x80')]||_0xd1f3('0x5b'),this[_0xd1f3('0x81')](_0x45bd00['model'])?_0x45bd00[_0xd1f3('0x82')]:undefined)[_0xd1f3('0x14')](function(_0x40f740){_0x5b8925(null,_0x40f740);})['catch'](function(_0x4e1a11){_0x5b8925(_0x4e1a11);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x83')]=function(_0x20ed93,_0x4f6c6f){scripts[_0xd1f3('0x83')](_0x20ed93[_0xd1f3('0x84')],_0x20ed93['aws_secret_access_key'],_0x20ed93['aws_polly_region'],_0x20ed93[_0xd1f3('0x85')]||_0xd1f3('0x86'),_0x20ed93[_0xd1f3('0x59')],_0x20ed93[_0xd1f3('0x87')]||_0xd1f3('0x59'))['then'](function(_0x53afad){_0x4f6c6f(null,_0x53afad);})[_0xd1f3('0x16')](function(_0x47dec4){_0x4f6c6f(_0x47dec4);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x88')]=function(_0x2804be,_0x604725){scripts[_0xd1f3('0x88')](this[_0xd1f3('0xe')][_0xd1f3('0x37')],_0x2804be[_0xd1f3('0x84')],_0x2804be['aws_secret_access_key'],_0x2804be[_0xd1f3('0x89')],_0x2804be[_0xd1f3('0x59')],_0x2804be[_0xd1f3('0x8a')])[_0xd1f3('0x14')](function(_0x7596d6){_0x604725(null,_0x7596d6);})['catch'](function(_0x1663ed){_0x604725(_0x1663ed);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x8b')]=function(_0x2b3c1e,_0x2f1559,_0x3998e4){scripts[_0xd1f3('0x8b')](_0x2f1559,_0x2b3c1e[_0xd1f3('0x74')],_0x2b3c1e[_0xd1f3('0x8c')]||_0xd1f3('0x5b'))[_0xd1f3('0x14')](function(_0x19838c){_0x3998e4(null,_0x19838c);})[_0xd1f3('0x16')](function(_0x67c9cf){_0x3998e4(_0x67c9cf);});};AGIVertices['prototype'][_0xd1f3('0x8d')]=function(_0x106c23,_0x92cc74,_0x1ecb14){scripts['tildeASR'](_0x92cc74,_0x106c23['appid'],_0x106c23[_0xd1f3('0x8e')],_0x106c23[_0xd1f3('0x8f')])[_0xd1f3('0x14')](function(_0x14522a){_0x1ecb14(null,_0x14522a);})[_0xd1f3('0x16')](function(_0x137d4a){_0x1ecb14(_0x137d4a);});};AGIVertices[_0xd1f3('0x11')]['clear']=function(_0x47d6cb){var _0x17e21a=_[_0xd1f3('0x90')](verticesWithRetry,_0x47d6cb['agicommand'])?_0x47d6cb:_[_0xd1f3('0x91')](_0x47d6cb);for(var _0x20bca6 in _0x17e21a){if(_0x17e21a['hasOwnProperty'](_0x20bca6)){if(_0x17e21a[_0x20bca6]&&_[_0xd1f3('0x92')](_0x17e21a[_0x20bca6])){if(_[_0xd1f3('0x90')](recursiveMapAttributes,_0x20bca6)){_0x17e21a[_0x20bca6]=this[_0xd1f3('0x93')](_0x17e21a[_0x20bca6]);}else{_0x17e21a[_0x20bca6]=this[_0xd1f3('0x94')](_0x17e21a[_0x20bca6]);}}}}return _0x17e21a;};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x95')]=function(_0x9c3660){for(var _0x5a5043 in _0x9c3660){if(_0x9c3660[_0xd1f3('0x96')](_0x5a5043)){if(_[_0xd1f3('0x97')](_0x9c3660[_0x5a5043])){this['recursiveNodeIndex'](_0x9c3660[_0x5a5043]);}else if(_[_0xd1f3('0x98')](_0x9c3660[_0x5a5043])){for(var _0x259114=0x0;_0x259114<_0x9c3660[_0x5a5043]['length'];_0x259114++){this[_0xd1f3('0x95')](_0x9c3660[_0x5a5043][_0x259114]);}}else if(_[_0xd1f3('0x92')](_0x9c3660[_0x5a5043])){_0x9c3660[_0x5a5043]=this['replaceAllVariables'](_0x9c3660[_0x5a5043]);}}}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x99')]=function(_0x377ca1,_0x4bb5b4){for(var _0x765839 in _0x377ca1){if(_0x377ca1['hasOwnProperty'](_0x765839)){if(_[_0xd1f3('0x97')](_0x377ca1[_0x765839])){if(!_[_0xd1f3('0x42')](_0x377ca1[_0x765839])){this[_0xd1f3('0x99')](_0x377ca1[_0x765839],util[_0xd1f3('0x2b')]('%s.%s',_0x4bb5b4,_0x765839));}}else if(_[_0xd1f3('0x98')](_0x377ca1[_0x765839])){for(var _0x21076f=0x0;_0x21076f<_0x377ca1[_0x765839][_0xd1f3('0x9a')];_0x21076f++){this['saveRestApiResult'](_0x377ca1[_0x765839][_0x21076f],util['format'](_0xd1f3('0x9b'),_0x4bb5b4,_0x765839+'['+_0x21076f+']'));}}else{if(!_[_0xd1f3('0x43')](_0x377ca1[_0x765839])){this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0x9b'),_0x4bb5b4,_0x765839),_0x377ca1[_0x765839]);}}}}};AGIVertices['prototype'][_0xd1f3('0x93')]=function(_0x250ba8){try{var _0x3452f9=JSON[_0xd1f3('0x67')](_0x250ba8);this[_0xd1f3('0x95')](_0x3452f9);return JSON[_0xd1f3('0x6e')](_0x3452f9);}catch(_0x2c920e){return this['replaceAllVariables'](_0x250ba8);}};AGIVertices['prototype'][_0xd1f3('0x94')]=function(_0x366178){var _0x3537f1=_0x366178[_0xd1f3('0x9d')]('{');for(var _0x504836=0x1;_0x504836<_0x3537f1[_0xd1f3('0x9a')];_0x504836+=0x1){var _0x3c8b90=_0x3537f1[_0x504836]['split']('}');if(_0x3c8b90['length']>0x1){_0x366178=_0x366178[_0xd1f3('0x9e')]('{'+_0x3c8b90[0x0]+'}',this['channel'][_0xd1f3('0x12')](_0x3c8b90[0x0])[_0xd1f3('0x9f')]||_0x3c8b90[0x0]);}}if(_0x3537f1[_0xd1f3('0x9a')]===0x1){return _0x366178['toString']();}return this[_0xd1f3('0x94')](_0x366178);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xa0')]=function(_0x142c18,_0x1ecb00){var _0x5982cd=this['channel'][_0xd1f3('0x12')](_0x142c18);if(_0x5982cd['result']===-0x1){return _0x5982cd;}logger['info'](util[_0xd1f3('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1ecb00,_0x5982cd['extra']));return this[_0xd1f3('0xe')]['setVariable'](_0x1ecb00,_0x5982cd['extra']);};AGIVertices['prototype'][_0xd1f3('0x81')]=function(_0x11e942){return _0x11e942&&_0x11e942!=='0'&&_0x11e942!=='-1'&&_0x11e942!=='';};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xa1')]=function(_0xb9af69){this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0xb9af69,'-');_0xb9af69[_0xd1f3('0xa2')]=_0xb9af69[_0xd1f3('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xa3')]=function(_0xc18fc9){logger[_0xd1f3('0x30')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xc18fc9[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0xc18fc9[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}var _0x3097fa='\x22'+_0xc18fc9[_0xd1f3('0x59')]+'\x22';if(this[_0xd1f3('0x81')](_0xc18fc9[_0xd1f3('0x72')])){_0x3097fa+=','+_0xc18fc9[_0xd1f3('0x72')];}var _0x41c63a=this[_0xd1f3('0xe')]['exec'](_0xd1f3('0xa6'),_0x3097fa);if(_0x41c63a['result']===-0x1){return _0x41c63a;}return this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xa7'),_0x3097fa));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xa8')]=function(_0x219046){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xa9'),_0x219046[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x219046[_0xd1f3('0xaa')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xab'));}var _0x57536f=_0x219046['grammar'];if(this[_0xd1f3('0x81')](_0x219046[_0xd1f3('0x72')])){_0x57536f+=','+_0x219046['options'];}var _0xd383d9=this[_0xd1f3('0xe')]['exec'](_0xd1f3('0xac'),_0x57536f);if(_0xd383d9[_0xd1f3('0xad')]===-0x1){return _0xd383d9;}var _0x4e0cdf=this[_0xd1f3('0xa0')](_0xd1f3('0xae'),_0xd1f3('0xaf'));if(_0x4e0cdf['result']===-0x1){return _0x4e0cdf;}var _0x3b53d6=this[_0xd1f3('0xa0')](_0xd1f3('0xb0'),_0xd1f3('0xb1'));if(_0x3b53d6[_0xd1f3('0xad')]===-0x1){return _0x3b53d6;}var _0x1c6caa=this[_0xd1f3('0xa0')](_0xd1f3('0xb2'),_0xd1f3('0xb3'));if(_0x1c6caa['result']===-0x1){return _0x1c6caa;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xb4'),_0x57536f));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x8')]=function(_0xd50a92){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0xb5'),_0xd50a92[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')]['agi']([_0xd50a92[_0xd1f3('0xb6')],_0xd50a92[_0xd1f3('0xb7')]]);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xb8')]=function(_0x43e271){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xb9'),_0x43e271[_0xd1f3('0x38')]));if(this[_0xd1f3('0x81')](_0x43e271[_0xd1f3('0x62')])){logger['info'](util['format'](_0xd1f3('0xba'),_0x43e271['timeout']));var _0x14b24a=this[_0xd1f3('0xe')][_0xd1f3('0xbb')](_0x43e271[_0xd1f3('0x62')]);if(_0x14b24a[_0xd1f3('0xad')]===-0x1){return _0x14b24a;}}return this[_0xd1f3('0xe')][_0xd1f3('0xb8')]();};AGIVertices['prototype'][_0xd1f3('0x49')]=function(_0x13c8c5){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xbc'),_0x13c8c5['label']));if(!this[_0xd1f3('0x81')](_0x13c8c5[_0xd1f3('0xbd')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x13c8c5,_0xd1f3('0xbe'));}_0x13c8c5['scheduledAt']=moment();if(this[_0xd1f3('0x81')](_0x13c8c5[_0xd1f3('0xbf')])){_0x13c8c5[_0xd1f3('0x48')]=moment()[_0xd1f3('0xc0')](_0x13c8c5['delay'],'minutes');}if(!this[_0xd1f3('0x81')](_0x13c8c5[_0xd1f3('0x4b')])){_0x13c8c5[_0xd1f3('0x4b')]=0x2;}this[_0xd1f3('0x41')][_0xd1f3('0x6a')](this,_0x13c8c5);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xc1'),_0x13c8c5[_0xd1f3('0x47')],_0x13c8c5[_0xd1f3('0xbd')],_0x13c8c5[_0xd1f3('0x48')]));};AGIVertices[_0xd1f3('0x11')]['custom_app']=function(_0x57e751){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xc2'),_0x57e751['label']));var _0x501dcb=this[_0xd1f3('0xe')][_0xd1f3('0x54')](_0x57e751[_0xd1f3('0xc3')],_0x57e751[_0xd1f3('0x72')]);if(_0x501dcb[_0xd1f3('0xad')]===-0x1){return _0x501dcb;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xc4'),_0x57e751[_0xd1f3('0xc3')],_0x57e751[_0xd1f3('0x72')]));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xc5')]=function(_0x4d8beb){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4d8beb[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x4d8beb[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}var _0x403316='\x22'+_0x4d8beb['text']+'\x22';if(this[_0xd1f3('0x81')](_0x4d8beb[_0xd1f3('0x72')])){_0x403316+=','+_0x4d8beb[_0xd1f3('0x72')];}var _0x25a30c=this[_0xd1f3('0xe')]['exec']('MRCPSynth',_0x403316);if(_0x25a30c[_0xd1f3('0xad')]===-0x1){return _0x25a30c;}return this['channel']['noop'](util['format'](_0xd1f3('0xa7'),_0x403316));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xc6')]=function(_0x2c6daa){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0xc7'),_0x2c6daa[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x2c6daa[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20text\x20configured');}var _0x59a535='\x22'+_0x2c6daa[_0xd1f3('0x59')]+'\x22';if(this['isConfigured'](_0x2c6daa[_0xd1f3('0x72')])){_0x59a535+=','+_0x2c6daa['options'];}var _0x21c604=this[_0xd1f3('0xe')]['exec']('MRCPSynth',_0x59a535);if(_0x21c604[_0xd1f3('0xad')]===-0x1){return _0x21c604;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xa7'),_0x59a535));};AGIVertices[_0xd1f3('0x11')]['lumenvoxasr']=function(_0x16040e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xc8'),_0x16040e[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x16040e[_0xd1f3('0xaa')])){return this['channel'][_0xd1f3('0xa4')]('no\x20grammar\x20configured');}var _0x89d356=_0x16040e['grammar'];if(this['isConfigured'](_0x16040e[_0xd1f3('0x72')])){_0x89d356+=','+_0x16040e[_0xd1f3('0x72')];}var _0x17925b=this[_0xd1f3('0xe')][_0xd1f3('0x54')]('MRCPRecog',_0x89d356);if(_0x17925b[_0xd1f3('0xad')]===-0x1){return _0x17925b;}var _0x20c7c1=this['getAndSetVariable'](_0xd1f3('0xae'),_0xd1f3('0xc9'));if(_0x20c7c1[_0xd1f3('0xad')]===-0x1){return _0x20c7c1;}var _0x4b5aed=this[_0xd1f3('0xa0')](_0xd1f3('0xb0'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x4b5aed[_0xd1f3('0xad')]===-0x1){return _0x4b5aed;}var _0x25e91e=this[_0xd1f3('0xa0')](_0xd1f3('0xb2'),_0xd1f3('0xca'));if(_0x25e91e[_0xd1f3('0xad')]===-0x1){return _0x25e91e;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xb4'),_0x89d356));};AGIVertices[_0xd1f3('0x11')]['sestekasr']=function(_0x36414f){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xcb'),_0x36414f[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x36414f[_0xd1f3('0xaa')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0xab'));}var _0x48b18f=_0x36414f['grammar'];if(this[_0xd1f3('0x81')](_0x36414f['options'])){_0x48b18f+=','+_0x36414f['options'];}var _0x533f38=this['channel'][_0xd1f3('0x54')](_0xd1f3('0xac'),_0x48b18f);if(_0x533f38[_0xd1f3('0xad')]===-0x1){return _0x533f38;}var _0x4aeefe=this['getAndSetVariable'](_0xd1f3('0xae'),_0xd1f3('0xcc'));if(_0x4aeefe['result']===-0x1){return _0x4aeefe;}var _0x2fa188=this[_0xd1f3('0xa0')](_0xd1f3('0xb0'),_0xd1f3('0xcd'));if(_0x2fa188['result']===-0x1){return _0x2fa188;}var _0x107dbc=this['getAndSetVariable'](_0xd1f3('0xb2'),_0xd1f3('0xce'));if(_0x107dbc['result']===-0x1){return _0x107dbc;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xb4'),_0x48b18f));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xcf')]=function(_0x39f5a8){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x39f5a8[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x39f5a8[_0xd1f3('0xd0')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39f5a8,'no\x20database\x20selected');}var _0x34459e=this[_0xd1f3('0x1b')][_0xd1f3('0x6a')](this,_0x39f5a8[_0xd1f3('0xd0')]);if(!_0x34459e){return this['channel'][_0xd1f3('0x4f')](_0x39f5a8,_0xd1f3('0xd1'));}if(!this['isConfigured'](_0x39f5a8['query'])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39f5a8,_0xd1f3('0xd2'));}var _0x2ca724=_0x39f5a8['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0xd3'),_0x2ca724));var _0x3ed70f=this['getQueryOdbc'][_0xd1f3('0x6a')](this,_0x34459e,_0x2ca724);this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x39f5a8,_0x2ca724);if(!this[_0xd1f3('0x81')](_0x39f5a8[_0xd1f3('0xd4')])){return this['channel'][_0xd1f3('0xa4')](_0xd1f3('0xd5'));}var _0x56a87e=this[_0xd1f3('0x12')][_0xd1f3('0x6a')](this,_0x39f5a8[_0xd1f3('0xd4')]);if(!_0x56a87e){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39f5a8,'no\x20variable\x20found');}var _0x4e47df=this;_0x3ed70f['forEach'](function(_0x3aeb1b,_0x5f1c44){Object[_0xd1f3('0xd6')](_0x3aeb1b)[_0xd1f3('0xd7')](function(_0x389a29){_0x4e47df[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0xd8'),_0x56a87e,_0x5f1c44,_0x389a29),_0x3aeb1b[_0x389a29]);});});this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0xd9'),_0x56a87e),_0x3ed70f[_0xd1f3('0x9a')]);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xda'),_0x56a87e));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xdb')]=function(_0x3bf2ed){logger[_0xd1f3('0xdc')](util[_0xd1f3('0x2b')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3bf2ed[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x3bf2ed[_0xd1f3('0xdd')])){return this['channel']['error'](_0x3bf2ed,_0xd1f3('0xde'));}var _0x406cdd=this[_0xd1f3('0xdf')]['sync'](this,_0x3bf2ed['sip_id']);if(!_0x406cdd){return this[_0xd1f3('0xe')]['error'](_0x3bf2ed,_0xd1f3('0xe0'));}var _0x522d53=this[_0xd1f3('0xe')][_0xd1f3('0x54')]('DIAL',[util[_0xd1f3('0x2b')](_0xd1f3('0xe1'),_0x406cdd),_0x3bf2ed[_0xd1f3('0x62')],_0x3bf2ed[_0xd1f3('0xe2')],_0x3bf2ed[_0xd1f3('0x6c')]]);if(_0x522d53[_0xd1f3('0xad')]===-0x1){return _0x522d53;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xe3'),_0xd1f3('0xe4')));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xe5')]=function(_0xcb9730){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xe6'),_0xcb9730[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0xcb9730['key'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20key\x20configured');}if(!this[_0xd1f3('0x81')](_0xcb9730[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this['channel'][_0xd1f3('0xe7')]=!![];this[_0xd1f3('0x36')](_0xcb9730);this['createSquareMessage'](_0xcb9730[_0xd1f3('0x59')],'in','','');this[_0xd1f3('0xe')]['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0xcb9730[_0xd1f3('0x59')]));var _0xd44bb2=this['googleDialogflow'][_0xd1f3('0x6a')](this,_0xcb9730);if(_0xd44bb2){for(var _0x2bb2c4 in _0xd44bb2){if(_0xd44bb2['hasOwnProperty'](_0x2bb2c4)){this[_0xd1f3('0xe')]['setVariable'](util['format'](_0xd1f3('0xe8'),_0x2bb2c4[_0xd1f3('0x65')]()),_0xd44bb2[_0x2bb2c4]);}}this[_0xd1f3('0x40')](_0xd44bb2['speech'],_0xd1f3('0xe9'),_0xd1f3('0xe5'),'');return this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xea'),_0xd44bb2[_0xd1f3('0xeb')]));}return this[_0xd1f3('0xe')]['error'](_0xcb9730,_0xd1f3('0xec'));};AGIVertices[_0xd1f3('0x11')]['dialogflowV2']=function(_0x2c9a4e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xed'),_0x2c9a4e[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x2c9a4e['dialogflowV2_project_id'])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0xee'));}if(!this[_0xd1f3('0x81')](_0x2c9a4e[_0xd1f3('0x78')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20client_email\x20configured');}if(!this[_0xd1f3('0x81')](_0x2c9a4e['private_key'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20private_key\x20configured');}if(!this[_0xd1f3('0x81')](_0x2c9a4e[_0xd1f3('0x7a')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20anguage\x20configured');}if(!this[_0xd1f3('0x81')](_0x2c9a4e[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')][_0xd1f3('0xe7')]=!![];this[_0xd1f3('0x36')](_0x2c9a4e);this[_0xd1f3('0x40')](_0x2c9a4e[_0xd1f3('0x59')],'in','','');this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xef'),_0x2c9a4e[_0xd1f3('0x59')]));var _0x16a744=this[_0xd1f3('0x76')][_0xd1f3('0x6a')](this,_0x2c9a4e);if(_0x16a744){for(var _0x3df8d4 in _0x16a744){if(_0x16a744['hasOwnProperty'](_0x3df8d4)){if(_0x3df8d4!=='providerResponse'){this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0xe8'),_0x3df8d4[_0xd1f3('0x65')]()),_0x16a744[_0x3df8d4]);}}}this['createSquareMessage'](_0x16a744[_0xd1f3('0xeb')],_0xd1f3('0xe9'),_0xd1f3('0xf0'),_0x16a744[_0xd1f3('0xf1')]);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xf2'),_0x16a744['speech']));}return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x2c9a4e,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0xd1f3('0xf3')]=function(_0x4a0583){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xf4'),_0x4a0583[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x4a0583[_0xd1f3('0xf5')])){return this[_0xd1f3('0xe')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0xd1f3('0x81')](_0x4a0583[_0xd1f3('0xf6')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xf7'));}if(!this[_0xd1f3('0x81')](_0x4a0583[_0xd1f3('0xf8')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xf9'));}if(!this[_0xd1f3('0x81')](_0x4a0583['ndassistant_url'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')]['bot']=!![];this[_0xd1f3('0x36')](_0x4a0583);this[_0xd1f3('0x40')](_0x4a0583['text'],'in','','');this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xfa'),_0x4a0583[_0xd1f3('0x59')]));var _0x180ac3=this[_0xd1f3('0x7b')][_0xd1f3('0x6a')](this,_0x4a0583);if(_0x180ac3){for(var _0x33241a in _0x180ac3){if(_0x180ac3[_0xd1f3('0x96')](_0x33241a)){this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')]('SESTEK_NDA_%s',_0x33241a[_0xd1f3('0x65')]()),_0x180ac3[_0x33241a]);}}this['createSquareMessage'](_0x180ac3[_0xd1f3('0xeb')],'out',_0xd1f3('0xf3'),'');if(_0x180ac3['audiofile']){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xfb'),_0x180ac3['audiofile']));var _0x43ed48=this[_0xd1f3('0xe')][_0xd1f3('0xfc')](_0x180ac3[_0xd1f3('0xfd')]);try{fs[_0xd1f3('0xfe')](_0x180ac3[_0xd1f3('0xfd')]+'.wav');}catch(_0x4a7661){logger['error'](_0x4a7661);}return _0x43ed48;}else{return this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0xff'),_0x180ac3[_0xd1f3('0xeb')]));}}return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4a0583,_0xd1f3('0x100'));};AGIVertices['prototype'][_0xd1f3('0x101')]=function(_0x105678){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x102'),_0x105678[_0xd1f3('0x38')]));return this['channel'][_0xd1f3('0xa4')](_0xd1f3('0x101'));};AGIVertices['prototype']['ext_dial']=function(_0x403a88){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x103'),_0x403a88['label']));var _0x305142='';if(_0x403a88['trunk_id']){if(!this['isConfigured'](_0x403a88[_0xd1f3('0x104')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x403a88,_0xd1f3('0x105'));}else{var _0x763a55=parseInt(_0x403a88[_0xd1f3('0x104')],0xa);if(isNaN(_0x763a55)){_0x305142=_0x403a88['trunk_id'];}else{_0x305142=this[_0xd1f3('0x106')][_0xd1f3('0x6a')](this,_0x403a88['trunk_id']);if(!_0x305142){return this['channel'][_0xd1f3('0x4f')](_0x403a88,_0xd1f3('0x107'));}}}}else if(_0x403a88[_0xd1f3('0x108')]){_0x305142=_0x403a88['trunk_name'];}else{return this[_0xd1f3('0xe')]['error'](_0x403a88,_0xd1f3('0x105'));}var _0xda28a7=this[_0xd1f3('0xe')]['exec'](_0xd1f3('0xe4'),[util[_0xd1f3('0x2b')]('SIP/%s/%s',_0x305142,_0x403a88['phone']),_0x403a88['timeout'],_0x403a88['opts'],_0x403a88[_0xd1f3('0x6c')]]);if(_0xda28a7['result']===-0x1){return _0xda28a7;}return this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xe3'),'DIAL'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x109')]=function(_0x153f1e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x10a'),_0x153f1e[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x109'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x10b')]=function(_0x157ada){logger['info'](util['format'](_0xd1f3('0x10c'),_0x157ada[_0xd1f3('0x38')]));if(_0x157ada['retry']===0x0){return this[_0xd1f3('0xa1')](_0x157ada);}_0x157ada['retry']-=0x1;if(!this[_0xd1f3('0x81')](_0x157ada['file_id'])){return this['channel'][_0xd1f3('0x4f')](_0x157ada,_0xd1f3('0x10d'));}var _0x318448=this[_0xd1f3('0x20')][_0xd1f3('0x6a')](this,_0x157ada[_0xd1f3('0x10e')]);if(!_0x318448){return this[_0xd1f3('0xe')]['error'](_0x157ada,_0xd1f3('0x10f'));}if(!this[_0xd1f3('0x81')](_0x157ada['variable_id'])){return this['channel'][_0xd1f3('0x4f')](_0xd1f3('0xd5'));}var _0x4d690a=this['channel'][_0xd1f3('0x110')](_0x318448,_0x157ada[_0xd1f3('0x111')],_0x157ada[_0xd1f3('0x112')]);var _0x450d6f=_0x4d690a[_0xd1f3('0xad')]?_0x4d690a[_0xd1f3('0xad')][_0xd1f3('0x113')]():'';logger['info'](_0xd1f3('0x114'),JSON[_0xd1f3('0x6e')](_0x4d690a));if(_0x4d690a[_0xd1f3('0xad')]===-0x1){this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,_0x450d6f);return _0x4d690a;}else if(_0x4d690a['extra']==='timeout'){_0x4d690a[_0xd1f3('0xad')]=_0x450d6f['length']>=parseInt(_0x157ada['mindigit'])?'x':'i';}else{_0x4d690a[_0xd1f3('0xad')]=_0x450d6f['length']>=parseInt(_0x157ada[_0xd1f3('0x115')])&&_0x450d6f['length']<=parseInt(_0x157ada[_0xd1f3('0x112')])?'x':'i';}var _0x56dc9b=this[_0xd1f3('0x12')][_0xd1f3('0x6a')](this,_0x157ada[_0xd1f3('0xd4')]);if(!_0x56dc9b){return this[_0xd1f3('0xe')]['error'](_0x157ada,_0xd1f3('0x116'));}this[_0xd1f3('0xe')][_0xd1f3('0x9c')](_0x56dc9b,_0x450d6f);if(this[_0xd1f3('0x81')](_0x157ada['hiddendigitsnum'])){var _0x2453cd=parseInt(_0x157ada[_0xd1f3('0x117')],0xa);var _0x181afa=rs[_0xd1f3('0x118')]({'charset':'*','length':_0x2453cd});var _0x7cd639=_0x450d6f['length'];if(_0x7cd639>0x0){if(_0x7cd639>_0x2453cd){this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,_0x157ada[_0xd1f3('0x119')]===_0xd1f3('0x11a')?_0x181afa+_0x450d6f[_0xd1f3('0x11b')](_0x2453cd):_0x450d6f['substr'](0x0,_0x7cd639-_0x2453cd)+_0x181afa);}else{this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,rs[_0xd1f3('0x118')]({'charset':'*','length':_0x7cd639}));}}else{this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,'');}}else{this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,_0x450d6f);}return _0x4d690a;};AGIVertices[_0xd1f3('0x11')]['getsecretdigits']=function(_0x252856){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x11c'),_0x252856[_0xd1f3('0x38')]));return this[_0xd1f3('0x10b')](_0x252856);};AGIVertices['prototype'][_0xd1f3('0x11d')]=function(_0x36396c){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x11e'),_0x36396c[_0xd1f3('0x38')]));this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x36396c,_0x36396c['goalname']);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x11f'),_0x36396c[_0xd1f3('0x120')]));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x121')]=function(_0x16605f){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x122'),_0x16605f['label']));if(!this[_0xd1f3('0x81')](_0x16605f[_0xd1f3('0x84')])||!this[_0xd1f3('0x81')](_0x16605f[_0xd1f3('0x123')])){return this['channel'][_0xd1f3('0xa4')](_0xd1f3('0x124'));}if(!this[_0xd1f3('0x81')](_0x16605f[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x125'),_0x16605f[_0xd1f3('0x59')]));var _0x3fe405=this[_0xd1f3('0x83')][_0xd1f3('0x6a')](this,_0x16605f);if(_0x3fe405){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x126'),_0x3fe405));var _0x522858=this[_0xd1f3('0xe')][_0xd1f3('0xfc')](_0x3fe405);try{fs[_0xd1f3('0xfe')](_0x3fe405+_0xd1f3('0x127'));}catch(_0x52da30){logger[_0xd1f3('0x4f')](_0x52da30);}return _0x522858;}return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x16605f,_0xd1f3('0x128'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x129')]=function(_0x2f9cf5){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x12a'),_0x2f9cf5['label']));if(!this[_0xd1f3('0x81')](_0x2f9cf5[_0xd1f3('0x84')])||!this['isConfigured'](_0x2f9cf5[_0xd1f3('0x123')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x124'));}if(!this[_0xd1f3('0x81')](_0x2f9cf5[_0xd1f3('0x8a')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20bot\x20name\x20configured');}if(!this[_0xd1f3('0x81')](_0x2f9cf5[_0xd1f3('0x59')])){return this['channel'][_0xd1f3('0xa4')]('no\x20text\x20configured');}this[_0xd1f3('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x2f9cf5);this[_0xd1f3('0x40')](_0x2f9cf5[_0xd1f3('0x59')],'in','','');this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x12b'),_0x2f9cf5['text']));var _0x242b8e=this[_0xd1f3('0x88')][_0xd1f3('0x6a')](this,_0x2f9cf5);if(_0x242b8e){for(var _0x22c251 in _0x242b8e){if(_0x242b8e[_0xd1f3('0x96')](_0x22c251)&&_[_0xd1f3('0x92')](_0x242b8e[_0x22c251])){this['channel']['setVariable'](util[_0xd1f3('0x2b')]('AWS_LEX_%s',_0x22c251['toUpperCase']()),_0x242b8e[_0x22c251]);}}if(_['isNil'](_0x242b8e[_0xd1f3('0x71')])){return this['channel'][_0xd1f3('0xa4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x242b8e[_0xd1f3('0x71')],_0xd1f3('0xe9'),_0xd1f3('0x12c'),'');return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x12d'),_0x242b8e[_0xd1f3('0x71')]));}}return this[_0xd1f3('0xe')]['error'](_0x2f9cf5,_0xd1f3('0x12e'));};AGIVertices[_0xd1f3('0x11')]['googleasr']=function(_0x542184){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x12f'),_0x542184[_0xd1f3('0x38')],_0x542184[_0xd1f3('0x62')]));if(!this[_0xd1f3('0x81')](_0x542184['key'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x130'));}var _0xf0013c='wav';var _0x12c4ec=util['format'](_0xd1f3('0x131'),FILES_PATH,rs[_0xd1f3('0x118')](0x4));var _0x362c2d=util[_0xd1f3('0x2b')]('%s.%s',_0x12c4ec,_0xf0013c);var _0x4cc913=!![];if(_0x542184[_0xd1f3('0x132')]==='NOBEEP'){_0x4cc913=![];}var _0x158b8c=this[_0xd1f3('0xe')][_0xd1f3('0x133')](_0x12c4ec,_0xf0013c,_0x542184[_0xd1f3('0x134')],_0x542184['timeout'],undefined,_0x4cc913);if(_0x158b8c['result']!==-0x1){this['channel']['noop'](util['format'](_0xd1f3('0x135'),_0x362c2d));var _0x5697a9=this[_0xd1f3('0x8b')][_0xd1f3('0x6a')](this,_0x542184,_0x362c2d);if(_0x5697a9){for(var _0xbfa1b8 in _0x5697a9){if(_0x5697a9[_0xd1f3('0x96')](_0xbfa1b8)){this['channel'][_0xd1f3('0x9c')](util['format'](_0xd1f3('0x136'),_0xbfa1b8[_0xd1f3('0x65')]()),_0x5697a9[_0xbfa1b8]);}}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x137'),JSON[_0xd1f3('0x6e')](_0x5697a9)));}}return _0x158b8c;};AGIVertices['prototype'][_0xd1f3('0x138')]=function(_0x4bc0d7){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x139'),_0x4bc0d7[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x4bc0d7['appid'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x13a'));}if(!this[_0xd1f3('0x81')](_0x4bc0d7['appsecret'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x13b'));}var _0x27f2cd='wav';var _0x3fd840=util['format'](_0xd1f3('0x131'),FILES_PATH,rs['generate'](0x4));var _0x313d82=util[_0xd1f3('0x2b')](_0xd1f3('0x9b'),_0x3fd840,_0x27f2cd);var _0x50b5dd=!![];if(_0x4bc0d7['beep']==='NOBEEP'){_0x50b5dd=![];}var _0x3beec9=this['channel']['recordFile'](_0x3fd840,_0x27f2cd,_0x4bc0d7[_0xd1f3('0x134')],_0x4bc0d7['timeout'],undefined,_0x50b5dd);if(_0x3beec9[_0xd1f3('0xad')]!==-0x1){this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x13c'),_0x313d82));var _0x3318b9=this['tildeASR'][_0xd1f3('0x6a')](this,_0x4bc0d7,_0x313d82);if(_0x3318b9){for(var _0x20cf63 in _0x3318b9){if(_0x3318b9['hasOwnProperty'](_0x20cf63)){this['channel']['setVariable'](util[_0xd1f3('0x2b')](_0xd1f3('0x13d'),_0x20cf63[_0xd1f3('0x65')]()),_0x3318b9[_0x20cf63]);}}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x13e'),JSON[_0xd1f3('0x6e')](_0x3318b9)));}}return _0x3beec9;};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x13f')]=function(_0x7f9f4e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x140'),_0x7f9f4e[_0xd1f3('0x38')]));return this['channel'][_0xd1f3('0x141')](_0x7f9f4e['context'],_0x7f9f4e[_0xd1f3('0x142')],_0x7f9f4e[_0xd1f3('0x143')]);};AGIVertices['prototype'][_0xd1f3('0x144')]=function(_0x2ac6d9){logger[_0xd1f3('0x30')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2ac6d9[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x2ac6d9[_0xd1f3('0x145')])){return this[_0xd1f3('0xe')]['error'](_0x2ac6d9,_0xd1f3('0x146'));}try{var _0x2f4651=eval(_0x2ac6d9[_0xd1f3('0x145')])?_0xd1f3('0x147'):_0xd1f3('0x148');this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2ac6d9[_0xd1f3('0x145')],_0x2f4651));return{'code':0xc8,'result':_0x2f4651};}catch(_0x36b862){return{'code':0xc8,'result':_0xd1f3('0x148')};}};AGIVertices[_0xd1f3('0x11')]['gotoiftime']=function(_0x676d05){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x149'),_0x676d05[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x676d05[_0xd1f3('0x14a')])){return this['channel']['error'](_0x676d05,_0xd1f3('0x14b'));}var _0x26159f=this[_0xd1f3('0x24')][_0xd1f3('0x6a')](this,_0x676d05[_0xd1f3('0x14a')]);if(!_0x26159f){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x676d05,_0xd1f3('0x14c'));}for(var _0x10b421=0x0;_0x10b421<_0x26159f[_0xd1f3('0x9a')];_0x10b421+=0x1){var _0x3ee07d=this[_0xd1f3('0xe')][_0xd1f3('0x12')](util[_0xd1f3('0x2b')](_0xd1f3('0x14d'),_0x26159f[_0x10b421]));if(_0x3ee07d[_0xd1f3('0xad')]===-0x1){return _0x3ee07d;}logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x14e'),_0x26159f[_0x10b421],_0x3ee07d[_0xd1f3('0x9f')]));if(_0x3ee07d[_0xd1f3('0x9f')]===_0xd1f3('0x147')){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x14e'),_0x26159f[_0x10b421],_0xd1f3('0x147')));this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')]('IFTIME\x20%s\x20%s',_0x26159f[_0x10b421],'true'));return{'code':0xc8,'result':_0xd1f3('0x147')};}else{logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x14e'),_0x26159f[_0x10b421],_0xd1f3('0x148')));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x14e'),_0x26159f[_0x10b421],_0xd1f3('0x148')));}}return{'code':0xc8,'result':_0xd1f3('0x148')};};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x14f')]=function(_0x5e6175){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5e6175['label']));return this[_0xd1f3('0xe')][_0xd1f3('0x14f')]();};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x150')]=function(_0x4915e2){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4915e2[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x4915e2[_0xd1f3('0x74')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20key\x20configured');}var _0x48f39b='wav';var _0x28a161=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xd1f3('0x118')](0x4));var _0x4fd197=util['format']('%s.%s',_0x28a161,_0x48f39b);var _0x1d7ae8=!![];if(_0x4915e2['beep']===_0xd1f3('0x151')){_0x1d7ae8=![];}var _0xfa3f6e=this['channel'][_0xd1f3('0x133')](_0x28a161,_0x48f39b,_0x4915e2['intKey'],_0x4915e2[_0xd1f3('0x62')],undefined,_0x1d7ae8);if(_0xfa3f6e[_0xd1f3('0xad')]!==-0x1){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x152'),_0x4fd197));var _0x1dbb06=this[_0xd1f3('0x7f')][_0xd1f3('0x6a')](this,_0x4915e2,_0x4fd197);if(_0x1dbb06){for(var _0x97618b in _0x1dbb06){if(_0x1dbb06['hasOwnProperty'](_0x97618b)){this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util['format'](_0xd1f3('0x153'),_0x97618b[_0xd1f3('0x65')]()),_0x1dbb06[_0x97618b]);}}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0xd1f3('0x6e')](_0x1dbb06)));}}return _0xfa3f6e;};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x154')]=function(_0x36907e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x155'),_0x36907e[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x36907e[_0xd1f3('0x74')])){return this['channel'][_0xd1f3('0xa4')]('no\x20key\x20configured');}if(!this[_0xd1f3('0x81')](_0x36907e[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x156'),_0x36907e['text']));var _0x1fdf92=this['ispeechTTS'][_0xd1f3('0x6a')](this,_0x36907e);if(_0x1fdf92){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x152'),_0x1fdf92));var _0x8d9412=this['channel'][_0xd1f3('0xfc')](_0x1fdf92,_0x36907e['intKey']);try{fs[_0xd1f3('0xfe')](_0x1fdf92+_0xd1f3('0x127'));}catch(_0x41d440){logger[_0xd1f3('0x4f')](_0x41d440);}return _0x8d9412;}return this[_0xd1f3('0xe')]['error'](_0x36907e,_0xd1f3('0x157'));};AGIVertices['prototype'][_0xd1f3('0x158')]=function(_0x529a4a){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x159'),_0x529a4a[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x529a4a[_0xd1f3('0x15a')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x529a4a,_0xd1f3('0x15b'));}logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15c'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x529a4a['findBy']));var _0x30ad80=this[_0xd1f3('0x52')]['sync'](this,_0x529a4a['findBy']);if(_0x30ad80){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this['channel'][_0xd1f3('0x3b')],_0x529a4a[_0xd1f3('0x15a')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x15d'),this['channel'][_0xd1f3('0x3b')],_0x529a4a[_0xd1f3('0x15a')]));return{'code':0xc8,'result':_0xd1f3('0x15e')};}else{logger['info'](util['format'](_0xd1f3('0x15f'),this['channel']['callerid'],_0x529a4a[_0xd1f3('0x15a')]));this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x15f'),this[_0xd1f3('0xe')]['callerid'],_0x529a4a['findBy']));return{'code':0xc8,'result':_0xd1f3('0x160')};}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x161')]=function(_0x421578){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x162'),_0x421578['label']));if(!this['isConfigured'](_0x421578['findBy'])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x421578,_0xd1f3('0x15b'));}logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15c'),this['channel'][_0xd1f3('0x3b')],_0x421578[_0xd1f3('0x15a')]));var _0x3c8067=this['agentLogout']['sync'](this,_0x421578['findBy']);if(_0x3c8067){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x421578['findBy']));this[_0xd1f3('0xe')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x421578[_0xd1f3('0x15a')]));return{'code':0xc8,'result':_0xd1f3('0x15e')};}else{logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15f'),this['channel'][_0xd1f3('0x3b')],_0x421578['findBy']));this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd1f3('0xe')]['callerid'],_0x421578['findBy']));return{'code':0xc8,'result':_0xd1f3('0x160')};}};AGIVertices['prototype'][_0xd1f3('0x163')]=function(_0x4daf65){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x164'),_0x4daf65[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x4daf65[_0xd1f3('0x165')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4daf65,_0xd1f3('0x166'));}this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x167'),_0x4daf65['operation']));var _0x2c2acd=eval(_0x4daf65[_0xd1f3('0x165')]);if(!this[_0xd1f3('0x81')](_0x4daf65[_0xd1f3('0xd4')])){return this['channel'][_0xd1f3('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x25215b=this[_0xd1f3('0x12')][_0xd1f3('0x6a')](this,_0x4daf65[_0xd1f3('0xd4')]);if(!_0x25215b){return this['channel']['error'](_0x4daf65,_0xd1f3('0x116'));}if(_[_0xd1f3('0x98')](_0x2c2acd)){var _0x9b8358=this;_0x2c2acd[_0xd1f3('0xd7')](function(_0x4f749c,_0x12f68b){_0x9b8358[_0xd1f3('0xe')][_0xd1f3('0x9c')](util['format'](_0xd1f3('0x168'),_0x25215b,_0x12f68b),_0x4f749c);});return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x169'),_0x25215b));}else{return this['channel'][_0xd1f3('0x9c')](_0x25215b,_0x2c2acd);}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x16a')]=function(_0x4cbdf1){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x16b'),_0x4cbdf1[_0xd1f3('0x38')]));if(_0x4cbdf1[_0xd1f3('0xa2')]===0x0){return this['maxRetry'](_0x4cbdf1);}_0x4cbdf1[_0xd1f3('0xa2')]-=0x1;if(!this[_0xd1f3('0x81')](_0x4cbdf1[_0xd1f3('0x10e')])){return this[_0xd1f3('0xe')]['error'](_0x4cbdf1,_0xd1f3('0x10d'));}var _0x22df05=this['getSound'][_0xd1f3('0x6a')](this,_0x4cbdf1[_0xd1f3('0x10e')]);if(!_0x22df05){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4cbdf1,_0xd1f3('0x10f'));}var _0x2da23c=this[_0xd1f3('0xe')]['getData'](_0x22df05,_0x4cbdf1[_0xd1f3('0x111')],_0x4cbdf1['digit']);var _0x63c7e9=_0x2da23c[_0xd1f3('0xad')];if(_0x2da23c[_0xd1f3('0xad')]===-0x1){this[_0xd1f3('0x36')]['sync'](this,_0x4cbdf1,'-1');return _0x2da23c;}else if(_0x2da23c[_0xd1f3('0x9f')]===_0xd1f3('0x62')){_0x2da23c[_0xd1f3('0xad')]=_0x2da23c[_0xd1f3('0xad')][_0xd1f3('0x9a')]>0x0?_0x2da23c[_0xd1f3('0xad')]:'t';}else if(_[_0xd1f3('0x42')](_0x2da23c[_0xd1f3('0xad')])){_0x2da23c[_0xd1f3('0xad')]='#';_0x63c7e9='#';}if(!this[_0xd1f3('0x81')](_0x4cbdf1[_0xd1f3('0xd4')])){this['channel']['noop'](_0xd1f3('0xd5'));}else{var _0x1c076d=this[_0xd1f3('0x12')]['sync'](this,_0x4cbdf1[_0xd1f3('0xd4')]);if(!_0x1c076d){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4cbdf1,_0xd1f3('0x116'));}this['channel'][_0xd1f3('0x9c')](_0x1c076d,_0x63c7e9);}this[_0xd1f3('0x36')]['sync'](this,_0x4cbdf1,_0x63c7e9);return _0x2da23c;};AGIVertices[_0xd1f3('0x11')]['noop']=function(_0xd96a5f){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x16c'),_0xd96a5f[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd96a5f[_0xd1f3('0x16d')]||_0xd96a5f[_0xd1f3('0x38')]);};AGIVertices['prototype']['pause']=function(_0x362c23){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x16e'),_0x362c23[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x362c23[_0xd1f3('0x15a')])){return this[_0xd1f3('0xe')]['error'](_0x362c23,_0xd1f3('0x15b'));}logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x15c'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23[_0xd1f3('0x15a')]));var _0x1f8223=this[_0xd1f3('0x16f')][_0xd1f3('0x6a')](this,_0x362c23[_0xd1f3('0x170')]);var _0x3787c2=this[_0xd1f3('0x4d')]['sync'](this,_0x362c23[_0xd1f3('0x15a')],_0x1f8223);if(_0x3787c2){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23[_0xd1f3('0x15a')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23[_0xd1f3('0x15a')]));return{'code':0xc8,'result':_0xd1f3('0x15e')};}else{logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15f'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23[_0xd1f3('0x15a')]));this['channel']['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23['findBy']));return{'code':0xc8,'result':_0xd1f3('0x160')};}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x171')]=function(_0x1f5c41){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x172'),_0x1f5c41['label']));if(!this[_0xd1f3('0x81')](_0x1f5c41[_0xd1f3('0x10e')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x1f5c41,'no\x20file\x20audio\x20selected');}var _0x8ba774=this[_0xd1f3('0x20')]['sync'](this,_0x1f5c41[_0xd1f3('0x10e')]);if(!_0x8ba774){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x1f5c41,_0xd1f3('0x10f'));}var _0x49bcef=this['channel'][_0xd1f3('0x54')]('PLAYBACK',[_0x8ba774,_0x1f5c41['opts']]);if(_0x49bcef[_0xd1f3('0xad')]===-0x1){return _0x49bcef;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0xd1f3('0x173'),_0x8ba774));};AGIVertices['prototype']['queue']=function(_0x5d8c42){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x174'),_0x5d8c42['label']));if(!this[_0xd1f3('0x81')](_0x5d8c42[_0xd1f3('0x175')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x5d8c42,_0xd1f3('0x176'));}var _0x254406='';var _0x4f2a00=parseInt(_0x5d8c42['queue_id'],0xa);if(isNaN(_0x4f2a00)){_0x254406=_0x5d8c42[_0xd1f3('0x175')];}else{_0x254406=this[_0xd1f3('0x17')][_0xd1f3('0x6a')](this,_0x5d8c42[_0xd1f3('0x175')]);if(!_0x254406){return this[_0xd1f3('0xe')]['error'](_0x5d8c42,_0xd1f3('0x177'));}}var _0x243828='';if(this[_0xd1f3('0x81')](_0x5d8c42[_0xd1f3('0x10e')])){var _0x25cd2f=this['getSound'][_0xd1f3('0x6a')](this,_0x5d8c42[_0xd1f3('0x10e')]);if(_0x25cd2f){_0x243828=_0x25cd2f;}}this['createSquareDetailsReport']['sync'](this,_0x5d8c42,_0x254406);if(_0x5d8c42[_0xd1f3('0xe2')][_0xd1f3('0x178')]('x')<0x0){_0x5d8c42[_0xd1f3('0xe2')]+='x';}if(_0x5d8c42[_0xd1f3('0xe2')]['indexOf']('X')<0x0){_0x5d8c42[_0xd1f3('0xe2')]+='X';}this[_0xd1f3('0xe')]['setVariable'](_0xd1f3('0x179'),_0x254406?_0x254406[_0xd1f3('0x17a')]():'');var _0x193ef7=this[_0xd1f3('0xe')][_0xd1f3('0x54')]('QUEUE',[_0x254406,_0x5d8c42[_0xd1f3('0xe2')],_0x5d8c42['url'],_0x243828,_0x5d8c42[_0xd1f3('0x62')],_0x5d8c42[_0xd1f3('0x8')],_0x5d8c42[_0xd1f3('0x17b')],_0x5d8c42[_0xd1f3('0x17c')],'',_0x5d8c42[_0xd1f3('0x17d')]]);if(_0x193ef7[_0xd1f3('0xad')]===-0x1){return _0x193ef7;}return this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xc4'),_0xd1f3('0x17e'),_0x254406));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x17f')]=function(_0x1d7870){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x180'),_0x1d7870[_0xd1f3('0x38')]));var _0x7104e3=_0x1d7870[_0xd1f3('0x181')]||'wav';var _0x4bf379=util[_0xd1f3('0x2b')](_0xd1f3('0x182'),this[_0xd1f3('0xe')][_0xd1f3('0x37')],rs[_0xd1f3('0x118')](0x5));var _0x1df83b=util[_0xd1f3('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x4bf379,_0x7104e3);var _0x3940d0=util[_0xd1f3('0x2b')](_0xd1f3('0x131'),FILES_PATH,_0x4bf379);this[_0xd1f3('0x3c')][_0xd1f3('0x6a')](this,_0x1d7870,_0x4bf379,_0x1df83b);this[_0xd1f3('0xe')][_0xd1f3('0x9c')]('RECORDING_SAVENAME',_0x4bf379);logger['info'](_0xd1f3('0x183'),_0x3940d0,_0x7104e3,_0x1d7870[_0xd1f3('0x184')],_0x1d7870['timeout']);return this[_0xd1f3('0xe')][_0xd1f3('0x133')](_0x3940d0,_0x7104e3,_0x1d7870[_0xd1f3('0x184')],_0x1d7870[_0xd1f3('0x62')],undefined,!![]);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x185')]=function(_0xd67480){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x186'),_0xd67480[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0xd67480[_0xd1f3('0x6c')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0x187'));}var _0xf11bcb=this[_0xd1f3('0x60')][_0xd1f3('0x6a')](this,_0xd67480);logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x188'),util[_0xd1f3('0x189')](_0xf11bcb,{'showHidden':![],'depth':null})));if(!this[_0xd1f3('0x81')](_0xd67480[_0xd1f3('0xd4')])){return this[_0xd1f3('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5d3ebc=this[_0xd1f3('0x12')][_0xd1f3('0x6a')](this,_0xd67480[_0xd1f3('0xd4')]);if(!_0x5d3ebc){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0xd67480,'no\x20variable\x20found');}this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0x18a'),_0x5d3ebc),_0xf11bcb[_0xd1f3('0x6f')]?_0xf11bcb[_0xd1f3('0x6f')]:_0xd1f3('0x18b'));this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util['format'](_0xd1f3('0x18c'),_0x5d3ebc),_0xf11bcb[_0xd1f3('0x70')]?_0xf11bcb[_0xd1f3('0x70')]:'OK');if(_0xf11bcb['body']){try{this[_0xd1f3('0x99')](_0xf11bcb[_0xd1f3('0x66')],_0x5d3ebc);}catch(_0x37b822){logger[_0xd1f3('0x4f')](util['format'](_0xd1f3('0x18d'),_0x5d3ebc));}}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xda'),_0x5d3ebc));};AGIVertices[_0xd1f3('0x11')]['saydigits']=function(_0x5201cd){logger['info'](util['format'](_0xd1f3('0x18e'),_0x5201cd[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0x18f')](_0x5201cd['digits'][_0xd1f3('0x190')](/\s+/g,''),_0x5201cd['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0xc05339){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xc05339[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0x191')](_0xc05339[_0xd1f3('0x63')][_0xd1f3('0x190')](/\s+/g,''),_0xc05339[_0xd1f3('0x184')]);};AGIVertices['prototype'][_0xd1f3('0x192')]=function(_0x3a515e){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x193'),_0x3a515e[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0x194')](_0x3a515e[_0xd1f3('0x59')],_0x3a515e[_0xd1f3('0x184')]);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x195')]=function(_0x4aed67){logger['info'](util[_0xd1f3('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4aed67[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x4aed67[_0xd1f3('0x196')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0x197'));}var _0xfa3630=this[_0xd1f3('0x198')][_0xd1f3('0x6a')](this,_0x4aed67[_0xd1f3('0x196')]);if(!_0xfa3630||!_0xfa3630[_0xd1f3('0x199')]){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4aed67,_0xd1f3('0x19a'));}var _0x3f83ab={'from':util[_0xd1f3('0x2b')](_0xd1f3('0x19b'),_0xfa3630['name'],_0xfa3630[_0xd1f3('0x19c')]||_0xfa3630['Smtp']['user']),'to':_0x4aed67['to']||'','cc':_0x4aed67['cc']||'','bcc':_0x4aed67[_0xd1f3('0x19d')]||'','subject':_0x4aed67['subject'],'html':_0x4aed67[_0xd1f3('0x59')],'text':_0x4aed67[_0xd1f3('0x59')]};var _0x1daf77={'tls':{'rejectUnauthorized':![]}};if(_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x19e')]){_0x1daf77['service']=_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x19e')];}else{_0x1daf77[_0xd1f3('0x19f')]=_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x19f')];_0x1daf77[_0xd1f3('0x1a0')]=_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x1a0')];_0x1daf77[_0xd1f3('0x1a1')]=_0xfa3630[_0xd1f3('0x199')]['secure'];}if(_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x1a2')]){_0x1daf77[_0xd1f3('0x1a3')]={'user':_0xfa3630['Smtp']['user'],'pass':_0xfa3630['Smtp'][_0xd1f3('0x1a4')]};}if(this[_0xd1f3('0x81')](_0x4aed67[_0xd1f3('0x1a5')])){}logger['debug'](_0xd1f3('0x1a6'),JSON[_0xd1f3('0x6e')](_0x3f83ab));this[_0xd1f3('0x36')]['sync'](this,_0x4aed67,_0x4aed67[_0xd1f3('0x196')]);this['channel'][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x1a7'),_0xfa3630[_0xd1f3('0x15')]));this[_0xd1f3('0x23')][_0xd1f3('0x6a')](this,_0x1daf77,_0x3f83ab);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1a8'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1a9')]=function(_0xe67050){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xe67050[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0x1aa'));};AGIVertices['prototype'][_0xd1f3('0x1ab')]=function(_0x4c544a){logger['info'](util['format'](_0xd1f3('0x1ac'),_0x4c544a[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x4c544a['sms_account_id'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1ad'));}var _0xe91cee=this['getSmsAccount'][_0xd1f3('0x6a')](this,_0x4c544a['sms_account_id']);if(!_0xe91cee){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4c544a,'no\x20sms\x20account\x20found');}var _0x502006={'body':_0x4c544a[_0xd1f3('0x1ae')],'phone':_0x4c544a['to']||'','SmsAccountId':_0xe91cee['id']};logger[_0xd1f3('0xdc')](_0xd1f3('0x1af'),JSON[_0xd1f3('0x6e')](_0x502006));this[_0xd1f3('0x36')]['sync'](this,_0x4c544a,_0x4c544a['sms_account_id']);this['channel']['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1b0'),_0xe91cee[_0xd1f3('0x15')]));this[_0xd1f3('0x35')][_0xd1f3('0x6a')](this,_0x502006);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1b1'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1b2')]=function(_0x39adf0){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1b3'),_0x39adf0['label']));if(!this[_0xd1f3('0x81')](_0x39adf0[_0xd1f3('0xd4')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39adf0,'no\x20variable\x20selected');}var _0x436b28=this['getVariable'][_0xd1f3('0x6a')](this,_0x39adf0[_0xd1f3('0xd4')]);if(!_0x436b28){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39adf0,_0xd1f3('0x116'));}return this[_0xd1f3('0xe')][_0xd1f3('0x9c')](_0x436b28,_0x39adf0[_0xd1f3('0x1b4')]);};AGIVertices['prototype'][_0xd1f3('0x1b5')]=function(_0x1cbb85){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1b6'),_0x1cbb85[_0xd1f3('0x38')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1b7'));if(_0x1cbb85['answer']===_0xd1f3('0x1b8')){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1b9'));return this['channel'][_0xd1f3('0xb8')]();}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1ba'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1bb')]=function(_0x2429e9){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2429e9['label']));if(!this[_0xd1f3('0x81')](_0x2429e9[_0xd1f3('0x1bc')])){return this['channel'][_0xd1f3('0x4f')](_0x2429e9,_0xd1f3('0x1bd'));}var _0x2da418=this[_0xd1f3('0x19')][_0xd1f3('0x6a')](this,_0x2429e9[_0xd1f3('0x1bc')]);if(!this[_0xd1f3('0x81')](_0x2da418)){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x2429e9,util[_0xd1f3('0x2b')](_0xd1f3('0x1be'),_0x2429e9[_0xd1f3('0x1bc')]));}if(_0x2da418===this[_0xd1f3('0xe')]['arg_1']){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x2429e9,_0xd1f3('0x1bf'));}this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x2429e9,_0x2da418);var _0x4ec66a=this[_0xd1f3('0xe')][_0xd1f3('0x54')](_0xd1f3('0x1c0'),util[_0xd1f3('0x2b')](_0xd1f3('0x1c1'),config['agi'][_0xd1f3('0x19f')]||'127.0.0.1',_0x2da418,this[_0xd1f3('0xe')][_0xd1f3('0x3a')]));if(_0x4ec66a['result']===-0x1){return _0x4ec66a;}return this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')]('Executed\x20command\x20%s\x20%s',_0xd1f3('0x1c0'),_0x2da418));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1c2')]=function(_0x20e3be){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x1c3'),_0x20e3be[_0xd1f3('0x38')]));var _0x4f44d2=this[_0xd1f3('0x53')][_0xd1f3('0x6a')](this,_0x20e3be[_0xd1f3('0xb6')]);this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x20e3be,_0x20e3be['command']);if(this[_0xd1f3('0x81')](_0x20e3be[_0xd1f3('0xd4')])){var _0x60c944=this[_0xd1f3('0x12')]['sync'](this,_0x20e3be['variable_id']);if(_0x60c944){this['channel'][_0xd1f3('0x9c')](_0x60c944,_0x4f44d2);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x1c4'),_0x20e3be[_0xd1f3('0xb6')],_0x60c944));}}return this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1c5'),_0x20e3be[_0xd1f3('0xb6')]));};AGIVertices[_0xd1f3('0x11')]['google_cloud_tts']=function(_0x4b470b){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1c6'),_0x4b470b[_0xd1f3('0x38')]));_0x4b470b['text']=_0x4b470b[_0xd1f3('0x59')][_0xd1f3('0x190')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd1f3('0x81')](_0x4b470b[_0xd1f3('0x57')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1c7'));}if(!this['isConfigured'](_0x4b470b[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x1c8'),_0x4b470b[_0xd1f3('0x59')]));var _0x132491=this[_0xd1f3('0x56')][_0xd1f3('0x6a')](this,_0x4b470b);if(_0x132491){this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1c9'),_0x132491));var _0xb91887=this['channel'][_0xd1f3('0xfc')](_0x132491);try{fs['unlink'](_0x132491+_0xd1f3('0x127'));}catch(_0x3ce5d5){logger[_0xd1f3('0x4f')](_0x3ce5d5);}return _0xb91887;}return this[_0xd1f3('0xe')]['error'](_0x4b470b,_0xd1f3('0x1ca'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1cb')]=function(_0xffe113){logger['info'](util['format'](_0xd1f3('0x1cc'),_0xffe113[_0xd1f3('0x38')]));_0xffe113[_0xd1f3('0x59')]=_0xffe113[_0xd1f3('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd1f3('0x81')](_0xffe113[_0xd1f3('0x59')])){return this['channel'][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this['channel']['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1cd'),_0xffe113['text']));var _0x471c82=this[_0xd1f3('0x5e')]['sync'](this,_0xffe113);if(_0x471c82){this['channel']['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1ce'),_0x471c82));var _0x1bc15a=this[_0xd1f3('0xe')][_0xd1f3('0xfc')](_0x471c82);try{fs[_0xd1f3('0xfe')](_0x471c82+_0xd1f3('0x127'));}catch(_0x4222db){logger[_0xd1f3('0x4f')](_0x4222db);}return _0x1bc15a;}return this['channel'][_0xd1f3('0x4f')](_0xffe113,_0xd1f3('0x1cf'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1d0')]=function(_0x43542f){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1d1'),_0x43542f[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x43542f[_0xd1f3('0x15a')])){return this[_0xd1f3('0xe')]['error'](_0x43542f,'no\x20find\x20by\x20configured');}logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x43542f[_0xd1f3('0x15a')]));var _0x131475=this[_0xd1f3('0x50')][_0xd1f3('0x6a')](this,_0x43542f['findBy']);if(_0x131475){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x43542f[_0xd1f3('0x15a')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x43542f[_0xd1f3('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd1f3('0x30')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x43542f[_0xd1f3('0x15a')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x15f'),this[_0xd1f3('0xe')]['callerid'],_0x43542f[_0xd1f3('0x15a')]));return{'code':0xc8,'result':_0xd1f3('0x160')};}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1d2')]=function(_0x24c12b){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1d3'),_0x24c12b[_0xd1f3('0x38')]));var _0x3bff24=this['channel'][_0xd1f3('0x54')]('VOICEMAIL',[_0x24c12b[_0xd1f3('0x1d4')],_0x24c12b[_0xd1f3('0x72')]]);if(_0x3bff24['result']===-0x1){return _0x3bff24;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xc4'),_0xd1f3('0x1d5'),_0x24c12b['mailbox']));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1d6')]=function(_0x3f71b9){logger['info'](util['format'](_0xd1f3('0x1d7'),_0x3f71b9[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x3f71b9[_0xd1f3('0xd4')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x3f71b9,_0xd1f3('0x1d8'));}var _0x42e02f=this[_0xd1f3('0x12')]['sync'](this,_0x3f71b9[_0xd1f3('0xd4')]);if(!_0x42e02f){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x3f71b9,_0xd1f3('0x116'));}var _0x5d4562=this[_0xd1f3('0xe')][_0xd1f3('0x12')](_0x42e02f);return{'code':0xc8,'result':_0x5d4562[_0xd1f3('0x9f')]?_0x5d4562['extra']:'-'};};String[_0xd1f3('0x11')][_0xd1f3('0x9e')]=function(_0x1b52b8,_0x1cbf20){return this[_0xd1f3('0x9d')](_0x1b52b8)[_0xd1f3('0x1d9')](_0x1cbf20);};module[_0xd1f3('0x1da')]=AGIVertices; \ No newline at end of file +var _0x6c99=['info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','setVariable','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','no\x20appid\x20configured','no\x20appsecret\x20configured','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','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','forEach','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','success','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','getSound','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','statusCode','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','auth','pass','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','AGI','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','randomstring','mustache','request-promise','../../config/logger','agi','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueueById','then','catch','getSquareProject','dsn','getTrunk','getTrunkById','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0x6c99,0x19b));var _0x96c9=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x6c99[_0x540dcb];return _0x49353c;};'use strict';var fs=require('fs');var path=require(_0x96c9('0x0'));var util=require(_0x96c9('0x1'));var _=require(_0x96c9('0x2'));var sh=require(_0x96c9('0x3'));var odbc=require('odbc')();var rs=require(_0x96c9('0x4'));var moment=require('moment');var Mustache=require(_0x96c9('0x5'));var rp=require(_0x96c9('0x6'));var logger=require(_0x96c9('0x7'))(_0x96c9('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0x96c9('0x9');var recursiveMapAttributes=[_0x96c9('0xa'),_0x96c9('0xb')];var verticesWithRetry=[_0x96c9('0xc'),_0x96c9('0xd'),_0x96c9('0xe')];var AGIVertices=function(_0x3c1906,_0xdc5d12,_0x2cfc1b){this[_0x96c9('0xf')]=_0x3c1906;this[_0x96c9('0x10')]=_0xdc5d12;this[_0x96c9('0x11')]=_0x2cfc1b;};AGIVertices[_0x96c9('0x12')][_0x96c9('0x13')]=function(_0x21393b,_0x57a7e9){this[_0x96c9('0x10')][_0x96c9('0x14')](_0x21393b)['then'](function(_0x4ff5d7){_0x57a7e9(null,_0x4ff5d7?_0x4ff5d7[_0x96c9('0x15')]:![]);})['catch'](function(_0x3a63ff){_0x57a7e9(_0x3a63ff);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x309602,_0x25e455){this[_0x96c9('0x10')][_0x96c9('0x16')](_0x309602)[_0x96c9('0x17')](function(_0x176bfb){_0x25e455(null,_0x176bfb?_0x176bfb[_0x96c9('0x15')]:![]);})[_0x96c9('0x18')](function(_0x434a00){_0x25e455(_0x434a00);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x19')]=function(_0x45edaf,_0x30317a){this[_0x96c9('0x10')]['getSquareProjectById'](_0x45edaf)[_0x96c9('0x17')](function(_0x3fd489){_0x30317a(null,_0x3fd489?_0x3fd489['name']:![]);})[_0x96c9('0x18')](function(_0x35dc59){_0x30317a(_0x35dc59);});};AGIVertices[_0x96c9('0x12')]['getSquareOdbc']=function(_0x4f358c,_0x28b264){this[_0x96c9('0x10')]['getSquareOdbcById'](_0x4f358c)['then'](function(_0x174ee5){_0x28b264(null,_0x174ee5?_0x174ee5[_0x96c9('0x1a')]:![]);})[_0x96c9('0x18')](function(_0x2fd976){_0x28b264(_0x2fd976);});};AGIVertices[_0x96c9('0x12')]['getUser']=function(_0x413a42,_0x245113){this[_0x96c9('0x10')]['getUserById'](_0x413a42)[_0x96c9('0x17')](function(_0x5691d8){_0x245113(null,_0x5691d8?_0x5691d8[_0x96c9('0x15')]:![]);})[_0x96c9('0x18')](function(_0x12899f){_0x245113(_0x12899f);});};AGIVertices['prototype'][_0x96c9('0x1b')]=function(_0x129cb3,_0x163604){this[_0x96c9('0x10')][_0x96c9('0x1c')](_0x129cb3)['then'](function(_0x1ff6f6){_0x163604(null,_0x1ff6f6?_0x1ff6f6[_0x96c9('0x15')]:![]);})[_0x96c9('0x18')](function(_0x3d54d0){_0x163604(_0x3d54d0);});};AGIVertices[_0x96c9('0x12')]['getSound']=function(_0x4b21a4,_0x2d352a){var _0xfa1737=this;this[_0x96c9('0x10')][_0x96c9('0x1d')](_0x4b21a4)[_0x96c9('0x17')](function(_0x50ebba){_0x2d352a(null,_0x50ebba?_0xfa1737[_0x96c9('0x1e')](_0x50ebba['save_name']):![]);})[_0x96c9('0x18')](function(_0x83e9db){_0x2d352a(_0x83e9db);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x1f')]=function(_0x5f228f,_0x3e4b28){this[_0x96c9('0x10')][_0x96c9('0x20')](_0x5f228f)['then'](function(_0x1f0853){_0x3e4b28(null,_0x1f0853?_0x1f0853:![]);})[_0x96c9('0x18')](function(_0x4e74bd){_0x3e4b28(_0x4e74bd);});};AGIVertices['prototype'][_0x96c9('0x21')]=function(_0x56fc4d,_0x1722cf,_0x4727b8){this[_0x96c9('0x11')][_0x96c9('0x21')](_0x56fc4d,_0x1722cf)[_0x96c9('0x17')](function(){_0x4727b8(null);})[_0x96c9('0x18')](function(_0xc38e3a){_0x4727b8(_0xc38e3a);});};AGIVertices['prototype'][_0x96c9('0x22')]=function(_0x584dc1,_0x46b2cb){this[_0x96c9('0x10')][_0x96c9('0x23')](_0x584dc1)[_0x96c9('0x17')](function(_0x38eb6c){if(_0x38eb6c){if(_0x38eb6c['IntervalId']){_0x46b2cb(null,[_0x38eb6c[_0x96c9('0x24')]]);}else{_0x46b2cb(null,_[_0x96c9('0x25')](_0x38eb6c[_0x96c9('0x26')],_0x96c9('0x24')));}}else{_0x46b2cb(null,![]);}})['catch'](function(_0x14f232){_0x46b2cb(_0x14f232);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x1e')]=function(_0x1634c9){return util[_0x96c9('0x27')](_0x96c9('0x28'),FILES_PATH,_0x1634c9);};AGIVertices[_0x96c9('0x12')][_0x96c9('0x29')]=function(_0xc4bb9a,_0x45486b,_0x5109ab){odbc[_0x96c9('0x2a')](_0xc4bb9a,function(_0x46ccba){if(_0x46ccba){logger[_0x96c9('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x46ccba);_0x5109ab(_0x46ccba);}else{logger[_0x96c9('0x2c')](_0x96c9('0x2d'));odbc[_0x96c9('0x2e')](_0x45486b,function(_0x52651e,_0x1d2014){if(_0x52651e){logger[_0x96c9('0x2c')](_0x96c9('0x2f'),_0x45486b);_0x5109ab(_0x52651e);}else{logger[_0x96c9('0x2c')](_0x96c9('0x30'),_0x45486b);odbc[_0x96c9('0x31')](function(_0x4836a9){if(_0x4836a9){logger[_0x96c9('0x2b')](_0x96c9('0x32'),_0x4836a9);}_0x5109ab(null,_0x1d2014);});}});}});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x33')]=function(_0x2ca0a9,_0x26f2cb){this[_0x96c9('0x10')][_0x96c9('0x34')](_0x2ca0a9)[_0x96c9('0x17')](function(_0x8a5583){_0x26f2cb(null,_0x8a5583?_0x8a5583:![]);})[_0x96c9('0x18')](function(_0x42d27e){_0x26f2cb(_0x42d27e);});};AGIVertices['prototype'][_0x96c9('0x35')]=function(_0x8b0a25,_0x26a4a8){this[_0x96c9('0x10')]['createSmsMessage'](_0x8b0a25)[_0x96c9('0x17')](function(_0x15e280){_0x26a4a8(null,_0x15e280);})[_0x96c9('0x18')](function(_0x50f90b){_0x26a4a8(_0x50f90b);});};AGIVertices['prototype'][_0x96c9('0x36')]=function(_0x2a809e,_0xd96833,_0x225549){this['rpc'][_0x96c9('0x36')]({'uniqueid':this[_0x96c9('0xf')]['uniqueid'],'node':_0x2a809e[_0x96c9('0x37')],'application':_0x2a809e[_0x96c9('0x38')],'data':_0xd96833||null,'project_name':this['channel'][_0x96c9('0x39')],'callerid':this[_0x96c9('0xf')][_0x96c9('0x3a')]})[_0x96c9('0x17')](function(_0x20e1a1){if(_0x225549){_0x225549(null,_0x20e1a1);}})['catch'](function(_0x251849){if(_0x225549){_0x225549(_0x251849);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x3aef63,_0x4f98b1,_0x39339c,_0xe25405){this['rpc'][_0x96c9('0x3b')]({'uniqueid':this['channel'][_0x96c9('0x3c')],'callerid':this[_0x96c9('0xf')][_0x96c9('0x3a')],'calleridname':this[_0x96c9('0xf')][_0x96c9('0x3d')],'context':this['channel'][_0x96c9('0x3e')],'extension':this['channel'][_0x96c9('0x3f')],'priority':this['channel'][_0x96c9('0x40')],'accountcode':this[_0x96c9('0xf')]['accountcode'],'dnid':this[_0x96c9('0xf')][_0x96c9('0x41')],'projectName':this[_0x96c9('0xf')][_0x96c9('0x39')],'saveName':_0x4f98b1,'filename':_0x3aef63[_0x96c9('0x42')]||_0x4f98b1,'savePath':_0x39339c})[_0x96c9('0x17')](function(_0x105339){_0xe25405(null,_0x105339);})[_0x96c9('0x18')](function(_0x5bc343){_0xe25405(_0x5bc343);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x43')]=function(_0x4ab5de,_0x1fb826,_0x47f0da,_0x37d900,_0x576267){this[_0x96c9('0x10')][_0x96c9('0x43')]({'uniqueid':this[_0x96c9('0xf')][_0x96c9('0x3c')],'body':_0x4ab5de,'direction':_0x1fb826,'providerName':_0x47f0da,'providerResponse':_0x37d900})[_0x96c9('0x17')](function(_0x610de3){if(_0x576267){_0x576267(null,_0x610de3);}})[_0x96c9('0x18')](function(_0x57bd9d){if(_0x576267){_0x576267(_0x57bd9d);}});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x44')]=function(_0x279876,_0x5795e1){this[_0x96c9('0x10')]['createCmContact']({'firstName':_[_0x96c9('0x45')](_0x279876[_0x96c9('0x15')])||_[_0x96c9('0x46')](_0x279876[_0x96c9('0x15')])?_0x96c9('0x47')+Math[_0x96c9('0x48')]():_0x279876['name'],'lastName':_[_0x96c9('0x45')](_0x279876[_0x96c9('0x49')])||_[_0x96c9('0x46')](_0x279876['lastName'])?null:_0x279876[_0x96c9('0x49')],'phone':_0x279876[_0x96c9('0x4a')],'ListId':_0x279876[_0x96c9('0x4b')],'scheduledat':_0x279876[_0x96c9('0x4c')],'callbackUniqueid':this[_0x96c9('0xf')][_0x96c9('0x3c')],'tags':_0x96c9('0x4d'),'description':_0x96c9('0x4e')+_0x279876[_0x96c9('0x4c')][_0x96c9('0x4f')](),'priority':_0x279876[_0x96c9('0x50')]})[_0x96c9('0x17')](function(_0x27add0){_0x5795e1(null,_0x27add0);})[_0x96c9('0x18')](function(_0x42cbf4){_0x5795e1(_0x42cbf4);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x51')]=function(_0x325956,_0xf74490){this[_0x96c9('0x10')][_0x96c9('0x52')](_0x325956)['then'](function(_0x20a913){_0xf74490(null,_0x20a913?_0x20a913[_0x96c9('0x15')]:![]);})['catch'](function(_0x54864f){_0xf74490(_0x54864f);});};AGIVertices['prototype']['agentPause']=function(_0x49fb22,_0xb226b,_0x5e92ec){var _0x406217={'role':_0x96c9('0x53')};_0x406217[_0x49fb22]=this[_0x96c9('0xf')]['callerid'];this[_0x96c9('0x10')][_0x96c9('0x54')](_0x406217,_0xb226b,this['channel'][_0x96c9('0x3c')])[_0x96c9('0x17')](function(_0x20c403){_0x5e92ec(null,_[_0x96c9('0x46')](_0x20c403)?![]:!![]);})[_0x96c9('0x18')](function(_0x3623ce){logger[_0x96c9('0x2b')](_0x3623ce);_0x5e92ec(null,![]);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x55')]=function(_0x37a6a0,_0x405fac){var _0x2ef1a2={'role':_0x96c9('0x53')};_0x2ef1a2[_0x37a6a0]=this[_0x96c9('0xf')][_0x96c9('0x3a')];this[_0x96c9('0x10')][_0x96c9('0x55')](_0x2ef1a2)[_0x96c9('0x17')](function(_0xf19dbb){_0x405fac(null,_[_0x96c9('0x46')](_0xf19dbb)?![]:!![]);})[_0x96c9('0x18')](function(_0x13a65c){logger[_0x96c9('0x2b')](_0x13a65c);_0x405fac(null,![]);});};AGIVertices['prototype'][_0x96c9('0x56')]=function(_0x3da441,_0xf91f9b){var _0x57a677={'role':'agent'};_0x57a677[_0x3da441]=this[_0x96c9('0xf')][_0x96c9('0x3a')];this[_0x96c9('0x10')]['agentLogout'](_0x57a677)[_0x96c9('0x17')](function(_0x2bacfb){_0xf91f9b(null,_[_0x96c9('0x46')](_0x2bacfb)?![]:!![]);})[_0x96c9('0x18')](function(_0x3289b6){logger[_0x96c9('0x2b')](_0x3289b6);_0xf91f9b(null,![]);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x57')]=function(_0x484f18,_0x45fbfe){var _0x4b279b={'role':_0x96c9('0x53')};_0x4b279b[_0x484f18]=this['channel'][_0x96c9('0x3a')];var _0x4fec79=_0x484f18!=_0x96c9('0x58')?util[_0x96c9('0x27')](_0x96c9('0x59'),'LOCAL',this[_0x96c9('0xf')]['callerid']):undefined;this['rpc'][_0x96c9('0x57')](_0x4b279b,_0x4fec79)['then'](function(_0x21c3df){_0x45fbfe(null,_['isNil'](_0x21c3df)?![]:!![]);})[_0x96c9('0x18')](function(_0xe61a76){logger[_0x96c9('0x2b')](_0xe61a76);_0x45fbfe(null,![]);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x5a')]=function(_0x3c0770,_0x1b22ca){sh[_0x96c9('0x5b')](_[_0x96c9('0x5c')](_0x3c0770),function(_0x4c9ec8,_0x3e5ef8){var _0x3ae126=_0x3e5ef8[_0x96c9('0x5d')](/(\r\n|\n|\r)/gm,'');_0x1b22ca(null,_0x3ae126);});};AGIVertices['prototype'][_0x96c9('0x5e')]=function(_0x6ddde4,_0x32d386){scripts['googleCloudTTS'](_0x6ddde4[_0x96c9('0x5f')],_0x6ddde4[_0x96c9('0x60')]||'text',_0x6ddde4[_0x96c9('0x61')],_0x6ddde4[_0x96c9('0x62')]||'en-US',_0x6ddde4[_0x96c9('0x63')]||_0x96c9('0x64'),_0x6ddde4[_0x96c9('0x65')]||'MP3')['then'](function(_0x3b35b5){_0x32d386(null,_0x3b35b5);})['catch'](function(_0xb70366){_0x32d386(_0xb70366);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x66')]=function(_0x496dfe,_0x58af14){scripts[_0x96c9('0x66')](_0x496dfe['text'],_0x496dfe['google_tts_language']||'en',0x1)[_0x96c9('0x17')](function(_0x41a772){_0x58af14(null,_0x41a772);})[_0x96c9('0x18')](function(_0x353cb2){_0x58af14(_0x353cb2);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x67')]=function(_0x4e2939,_0x39c5a5){var _0x3dc7ba={'uri':_0x4e2939[_0x96c9('0x68')],'method':_0x4e2939[_0x96c9('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4e2939[_0x96c9('0x6a')])===_0x96c9('0x6b')&&parseInt(_0x4e2939[_0x96c9('0x6a')])>=0x1?parseInt(_0x4e2939[_0x96c9('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x96c9('0x6c')]([_0x96c9('0x6d'),_0x96c9('0x6e')],_0x3dc7ba[_0x96c9('0x69')]['toUpperCase']())){try{_0x3dc7ba['body']=_0x4e2939[_0x96c9('0xb')]?JSON[_0x96c9('0x6f')](_0x4e2939[_0x96c9('0xb')]):{};}catch(_0xd6eb69){logger[_0x96c9('0x2b')](_0x96c9('0x70'),_0xd6eb69);}}try{_0x3dc7ba['headers']=_0x4e2939['rawHeaders']?JSON['parse'](_0x4e2939[_0x96c9('0xa')]):{};}catch(_0x3f3889){logger[_0x96c9('0x2b')](_0x96c9('0x71'),_0x3f3889);}if(_0x4e2939[_0x96c9('0x72')]){try{var _0x1b9193=require(_0x4e2939[_0x96c9('0x72')])[_0x96c9('0x73')](this,_0x3dc7ba);_0x3dc7ba[_0x96c9('0x74')]=Mustache[_0x96c9('0x75')](_0x4e2939[_0x96c9('0x68')],_0x1b9193,{},['$$','$$']);if(_0x3dc7ba[_0x96c9('0x76')]){_0x3dc7ba[_0x96c9('0x76')]=JSON[_0x96c9('0x6f')](Mustache[_0x96c9('0x75')](JSON[_0x96c9('0x77')](_0x3dc7ba[_0x96c9('0x76')]),_0x1b9193,{},['$$','$$']));}if(_0x3dc7ba[_0x96c9('0x78')]){_0x3dc7ba[_0x96c9('0x78')]=JSON[_0x96c9('0x6f')](Mustache[_0x96c9('0x75')](JSON[_0x96c9('0x77')](_0x3dc7ba[_0x96c9('0x78')]),_0x1b9193,{},['$$','$$']));}}catch(_0x511329){logger[_0x96c9('0x2b')](_0x96c9('0x79'),_0x511329);}}rp(_0x3dc7ba)[_0x96c9('0x17')](function(_0x2429f5){var _0x3c55e5={'statusCode':_0x2429f5['statusCode']||0xc8,'statusMessage':_0x2429f5[_0x96c9('0x7a')]||'OK','headers':_0x2429f5['headers']||{},'body':_0x2429f5[_0x96c9('0x78')]||{}};_0x39c5a5(null,_0x3c55e5);})[_0x96c9('0x18')](function(_0x2cbdc6){var _0xfb8951={'statusCode':_0x2cbdc6['statusCode']||0x1f4,'statusMessage':_0x2cbdc6[_0x96c9('0x7b')]||_0x96c9('0x7c'),'headers':_0x2cbdc6[_0x96c9('0x7d')][_0x96c9('0x76')]||{},'body':_0x2cbdc6['options'][_0x96c9('0x78')]||{}};_0x39c5a5(null,_0xfb8951);});};AGIVertices[_0x96c9('0x12')]['googleDialogflow']=function(_0x3357d3,_0x207c72){scripts[_0x96c9('0x7e')](this[_0x96c9('0xf')][_0x96c9('0x3c')],_0x3357d3[_0x96c9('0x7f')],_0x3357d3[_0x96c9('0x61')],_0x3357d3[_0x96c9('0x80')]||'en')[_0x96c9('0x17')](function(_0x4c2952){_0x207c72(null,_0x4c2952);})[_0x96c9('0x18')](function(_0x2f1d50){_0x207c72(_0x2f1d50);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x81')]=function(_0x36bebf,_0x3b543b){scripts['googleDialogflowV2'](this[_0x96c9('0xf')][_0x96c9('0x3c')],_0x36bebf['dialogflowV2_project_id'],_0x36bebf['client_email'],_0x36bebf[_0x96c9('0x82')],_0x36bebf[_0x96c9('0x61')],_0x36bebf[_0x96c9('0x83')]||'en')[_0x96c9('0x17')](function(_0x1ee031){_0x3b543b(null,_0x1ee031);})[_0x96c9('0x18')](function(_0x5d8c0b){_0x3b543b(_0x5d8c0b);});};AGIVertices['prototype'][_0x96c9('0x84')]=function(_0x9f8aeb,_0x32fd86){scripts[_0x96c9('0x84')](this[_0x96c9('0xf')],_0x9f8aeb)[_0x96c9('0x17')](function(_0x1d67ea){_0x32fd86(null,_0x1d67ea);})['catch'](function(_0x8dc94c){_0x32fd86(_0x8dc94c);});};AGIVertices[_0x96c9('0x12')]['ispeechTTS']=function(_0x365229,_0x154d92){scripts['ispeechTTS'](_0x365229[_0x96c9('0x7f')],_0x365229[_0x96c9('0x61')],_0x365229['ispeech_tts_language']||_0x96c9('0x85'),_0x365229[_0x96c9('0x86')])['then'](function(_0x5168aa){_0x154d92(null,_0x5168aa);})[_0x96c9('0x18')](function(_0x147c35){_0x154d92(_0x147c35);});};AGIVertices['prototype'][_0x96c9('0x87')]=function(_0x36a8ee,_0x259de0,_0x814170){scripts[_0x96c9('0x87')](_0x259de0,_0x36a8ee[_0x96c9('0x7f')],_0x36a8ee[_0x96c9('0x88')]||_0x96c9('0x85'),this[_0x96c9('0x89')](_0x36a8ee[_0x96c9('0x8a')])?_0x36a8ee[_0x96c9('0x8a')]:undefined)[_0x96c9('0x17')](function(_0x20108f){_0x814170(null,_0x20108f);})[_0x96c9('0x18')](function(_0x4c8cab){_0x814170(_0x4c8cab);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x8b')]=function(_0x3d8392,_0x390018){scripts[_0x96c9('0x8b')](_0x3d8392['aws_access_key_id'],_0x3d8392[_0x96c9('0x8c')],_0x3d8392[_0x96c9('0x8d')],_0x3d8392[_0x96c9('0x8e')]||'Amy',_0x3d8392[_0x96c9('0x61')],_0x3d8392[_0x96c9('0x8f')]||_0x96c9('0x61'))['then'](function(_0x20aeb6){_0x390018(null,_0x20aeb6);})[_0x96c9('0x18')](function(_0x3e6988){_0x390018(_0x3e6988);});};AGIVertices[_0x96c9('0x12')]['awsLex']=function(_0x2a0337,_0x1dde77){scripts[_0x96c9('0x90')](this[_0x96c9('0xf')][_0x96c9('0x3c')],_0x2a0337[_0x96c9('0x91')],_0x2a0337[_0x96c9('0x8c')],_0x2a0337[_0x96c9('0x92')],_0x2a0337[_0x96c9('0x61')],_0x2a0337[_0x96c9('0x93')])[_0x96c9('0x17')](function(_0x3a3259){_0x1dde77(null,_0x3a3259);})['catch'](function(_0x2bbc43){_0x1dde77(_0x2bbc43);});};AGIVertices[_0x96c9('0x12')]['googleASR']=function(_0xdb6ebf,_0x5e94f3,_0x2afaa3){scripts[_0x96c9('0x94')](_0x5e94f3,_0xdb6ebf['key'],_0xdb6ebf['google_asr_language']||_0x96c9('0x85'))[_0x96c9('0x17')](function(_0x15778c){_0x2afaa3(null,_0x15778c);})[_0x96c9('0x18')](function(_0x104c54){_0x2afaa3(_0x104c54);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x95')]=function(_0x3dc243,_0x40b241,_0x25e468){scripts[_0x96c9('0x95')](_0x40b241,_0x3dc243[_0x96c9('0x96')],_0x3dc243[_0x96c9('0x97')],_0x3dc243[_0x96c9('0x74')])[_0x96c9('0x17')](function(_0xa0ff2f){_0x25e468(null,_0xa0ff2f);})[_0x96c9('0x18')](function(_0x3cc1fe){_0x25e468(_0x3cc1fe);});};AGIVertices[_0x96c9('0x12')][_0x96c9('0x98')]=function(_0x5768e5){var _0x5c56ac=_[_0x96c9('0x6c')](verticesWithRetry,_0x5768e5[_0x96c9('0x38')])?_0x5768e5:_[_0x96c9('0x99')](_0x5768e5);for(var _0x2f95e3 in _0x5c56ac){if(_0x5c56ac[_0x96c9('0x9a')](_0x2f95e3)){if(_0x5c56ac[_0x2f95e3]&&_[_0x96c9('0x9b')](_0x5c56ac[_0x2f95e3])){if(_[_0x96c9('0x6c')](recursiveMapAttributes,_0x2f95e3)){_0x5c56ac[_0x2f95e3]=this[_0x96c9('0x9c')](_0x5c56ac[_0x2f95e3]);}else{_0x5c56ac[_0x2f95e3]=this[_0x96c9('0x9d')](_0x5c56ac[_0x2f95e3]);}}}}return _0x5c56ac;};AGIVertices[_0x96c9('0x12')]['recursiveNodeIndex']=function(_0x488608){for(var _0x2149de in _0x488608){if(_0x488608['hasOwnProperty'](_0x2149de)){if(_[_0x96c9('0x9e')](_0x488608[_0x2149de])){this[_0x96c9('0x9f')](_0x488608[_0x2149de]);}else if(_[_0x96c9('0xa0')](_0x488608[_0x2149de])){for(var _0x1d374d=0x0;_0x1d374d<_0x488608[_0x2149de]['length'];_0x1d374d++){this[_0x96c9('0x9f')](_0x488608[_0x2149de][_0x1d374d]);}}else if(_[_0x96c9('0x9b')](_0x488608[_0x2149de])){_0x488608[_0x2149de]=this[_0x96c9('0x9d')](_0x488608[_0x2149de]);}}}};AGIVertices[_0x96c9('0x12')]['saveRestApiResult']=function(_0x115c7f,_0x527a03){for(var _0x5a1f39 in _0x115c7f){if(_0x115c7f[_0x96c9('0x9a')](_0x5a1f39)){if(_[_0x96c9('0x9e')](_0x115c7f[_0x5a1f39])){if(!_[_0x96c9('0x45')](_0x115c7f[_0x5a1f39])){this[_0x96c9('0xa1')](_0x115c7f[_0x5a1f39],util[_0x96c9('0x27')](_0x96c9('0xa2'),_0x527a03,_0x5a1f39));}}else if(_[_0x96c9('0xa0')](_0x115c7f[_0x5a1f39])){for(var _0x251496=0x0;_0x251496<_0x115c7f[_0x5a1f39]['length'];_0x251496++){this[_0x96c9('0xa1')](_0x115c7f[_0x5a1f39][_0x251496],util['format'](_0x96c9('0xa2'),_0x527a03,_0x5a1f39+'['+_0x251496+']'));}}else{if(!_[_0x96c9('0x46')](_0x115c7f[_0x5a1f39])){this[_0x96c9('0xf')][_0x96c9('0xa3')](util['format'](_0x96c9('0xa2'),_0x527a03,_0x5a1f39),_0x115c7f[_0x5a1f39]);}}}}};AGIVertices[_0x96c9('0x12')][_0x96c9('0x9c')]=function(_0x3f9d97){try{var _0x284d07=JSON[_0x96c9('0x6f')](_0x3f9d97);this[_0x96c9('0x9f')](_0x284d07);return JSON['stringify'](_0x284d07);}catch(_0x59c09f){return this[_0x96c9('0x9d')](_0x3f9d97);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x3a44a9){var _0x381a40=_0x3a44a9[_0x96c9('0xa4')]('{');for(var _0x1b5c86=0x1;_0x1b5c86<_0x381a40[_0x96c9('0xa5')];_0x1b5c86+=0x1){var _0x24e931=_0x381a40[_0x1b5c86][_0x96c9('0xa4')]('}');if(_0x24e931[_0x96c9('0xa5')]>0x1){_0x3a44a9=_0x3a44a9[_0x96c9('0xa6')]('{'+_0x24e931[0x0]+'}',this[_0x96c9('0xf')][_0x96c9('0x13')](_0x24e931[0x0])[_0x96c9('0xa7')]||_0x24e931[0x0]);}}if(_0x381a40[_0x96c9('0xa5')]===0x1){return _0x3a44a9[_0x96c9('0x4f')]();}return this[_0x96c9('0x9d')](_0x3a44a9);};AGIVertices[_0x96c9('0x12')][_0x96c9('0xa8')]=function(_0x11ecb3,_0x4bef22){var _0xfafa29=this['channel'][_0x96c9('0x13')](_0x11ecb3);if(_0xfafa29[_0x96c9('0xa9')]===-0x1){return _0xfafa29;}logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0xaa'),_0x4bef22,_0xfafa29[_0x96c9('0xa7')]));return this[_0x96c9('0xf')][_0x96c9('0xa3')](_0x4bef22,_0xfafa29['extra']);};AGIVertices[_0x96c9('0x12')][_0x96c9('0x89')]=function(_0x4f2e55){return _0x4f2e55&&_0x4f2e55!=='0'&&_0x4f2e55!=='-1'&&_0x4f2e55!=='';};AGIVertices[_0x96c9('0x12')][_0x96c9('0xab')]=function(_0xbd838e){this[_0x96c9('0x36')][_0x96c9('0x73')](this,_0xbd838e,'-');_0xbd838e['retry']=_0xbd838e['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x96c9('0x12')]['mrcpsynth']=function(_0x5db38c){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0xac'),_0x5db38c[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x5db38c[_0x96c9('0x61')])){return this['channel'][_0x96c9('0xad')]('no\x20text\x20configured');}var _0x15f564='\x22'+_0x5db38c[_0x96c9('0x61')]+'\x22';if(this['isConfigured'](_0x5db38c[_0x96c9('0x7d')])){_0x15f564+=','+_0x5db38c[_0x96c9('0x7d')];}var _0x492649=this['channel'][_0x96c9('0x5b')](_0x96c9('0xae'),_0x15f564);if(_0x492649[_0x96c9('0xa9')]===-0x1){return _0x492649;}return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0xaf'),_0x15f564));};AGIVertices[_0x96c9('0x12')][_0x96c9('0xb0')]=function(_0x1aebff){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0xb1'),_0x1aebff[_0x96c9('0x37')]));if(!this['isConfigured'](_0x1aebff[_0x96c9('0xb2')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xb3'));}var _0xb991ea=_0x1aebff['grammar'];if(this[_0x96c9('0x89')](_0x1aebff[_0x96c9('0x7d')])){_0xb991ea+=','+_0x1aebff[_0x96c9('0x7d')];}var _0x1cd68d=this[_0x96c9('0xf')][_0x96c9('0x5b')](_0x96c9('0xb4'),_0xb991ea);if(_0x1cd68d[_0x96c9('0xa9')]===-0x1){return _0x1cd68d;}var _0x10350b=this[_0x96c9('0xa8')](_0x96c9('0xb5'),'MRCP_RECOG_CONFIDENCE');if(_0x10350b[_0x96c9('0xa9')]===-0x1){return _0x10350b;}var _0x1e3687=this['getAndSetVariable'](_0x96c9('0xb6'),'MRCP_RECOG_TRANSCRIPT');if(_0x1e3687[_0x96c9('0xa9')]===-0x1){return _0x1e3687;}var _0x5c3048=this[_0x96c9('0xa8')]('RECOG_INSTANCE()',_0x96c9('0xb7'));if(_0x5c3048[_0x96c9('0xa9')]===-0x1){return _0x5c3048;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xb991ea));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x8')]=function(_0x636d9a){logger['info'](util[_0x96c9('0x27')](_0x96c9('0xb8'),_0x636d9a[_0x96c9('0x37')]));return this[_0x96c9('0xf')][_0x96c9('0x8')]([_0x636d9a[_0x96c9('0xb9')],_0x636d9a[_0x96c9('0xba')]]);};AGIVertices['prototype'][_0x96c9('0xbb')]=function(_0x57253c){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0xbc'),_0x57253c[_0x96c9('0x37')]));if(this[_0x96c9('0x89')](_0x57253c['timeout'])){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0xbd'),_0x57253c[_0x96c9('0x6a')]));var _0x183342=this[_0x96c9('0xf')][_0x96c9('0xbe')](_0x57253c['timeout']);if(_0x183342[_0x96c9('0xa9')]===-0x1){return _0x183342;}}return this[_0x96c9('0xf')]['answer']();};AGIVertices[_0x96c9('0x12')][_0x96c9('0x4d')]=function(_0x58c375){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x58c375[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x58c375[_0x96c9('0x4b')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x58c375,'no\x20list\x20selected');}_0x58c375[_0x96c9('0x4c')]=moment();if(this[_0x96c9('0x89')](_0x58c375[_0x96c9('0xbf')])){_0x58c375['scheduledAt']=moment()[_0x96c9('0xc0')](_0x58c375[_0x96c9('0xbf')],_0x96c9('0xc1'));}if(!this[_0x96c9('0x89')](_0x58c375[_0x96c9('0x50')])){_0x58c375[_0x96c9('0x50')]=0x2;}this[_0x96c9('0x44')][_0x96c9('0x73')](this,_0x58c375);return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x58c375[_0x96c9('0x4a')],_0x58c375[_0x96c9('0x4b')],_0x58c375[_0x96c9('0x4c')]));};AGIVertices[_0x96c9('0x12')][_0x96c9('0xc2')]=function(_0x2372bf){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0xc3'),_0x2372bf['label']));var _0x590353=this[_0x96c9('0xf')]['exec'](_0x2372bf[_0x96c9('0xc4')],_0x2372bf['options']);if(_0x590353[_0x96c9('0xa9')]===-0x1){return _0x590353;}return this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0xc5'),_0x2372bf[_0x96c9('0xc4')],_0x2372bf['options']));};AGIVertices[_0x96c9('0x12')][_0x96c9('0xc6')]=function(_0x438147){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0xc7'),_0x438147[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x438147['text'])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xc8'));}var _0x278390='\x22'+_0x438147[_0x96c9('0x61')]+'\x22';if(this['isConfigured'](_0x438147[_0x96c9('0x7d')])){_0x278390+=','+_0x438147[_0x96c9('0x7d')];}var _0x2edf55=this['channel'][_0x96c9('0x5b')](_0x96c9('0xae'),_0x278390);if(_0x2edf55['result']===-0x1){return _0x2edf55;}return this[_0x96c9('0xf')][_0x96c9('0xad')](util['format'](_0x96c9('0xaf'),_0x278390));};AGIVertices['prototype']['sestektts']=function(_0x472689){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x472689['label']));if(!this[_0x96c9('0x89')](_0x472689['text'])){return this[_0x96c9('0xf')][_0x96c9('0xad')]('no\x20text\x20configured');}var _0x39d257='\x22'+_0x472689[_0x96c9('0x61')]+'\x22';if(this[_0x96c9('0x89')](_0x472689['options'])){_0x39d257+=','+_0x472689[_0x96c9('0x7d')];}var _0x97ed34=this[_0x96c9('0xf')][_0x96c9('0x5b')](_0x96c9('0xae'),_0x39d257);if(_0x97ed34[_0x96c9('0xa9')]===-0x1){return _0x97ed34;}return this[_0x96c9('0xf')][_0x96c9('0xad')](util['format'](_0x96c9('0xaf'),_0x39d257));};AGIVertices[_0x96c9('0x12')][_0x96c9('0xc9')]=function(_0x20adf5){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x20adf5[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x20adf5[_0x96c9('0xb2')])){return this[_0x96c9('0xf')][_0x96c9('0xad')]('no\x20grammar\x20configured');}var _0x738727=_0x20adf5[_0x96c9('0xb2')];if(this['isConfigured'](_0x20adf5['options'])){_0x738727+=','+_0x20adf5[_0x96c9('0x7d')];}var _0x2f51db=this['channel'][_0x96c9('0x5b')](_0x96c9('0xb4'),_0x738727);if(_0x2f51db['result']===-0x1){return _0x2f51db;}var _0x9d1ce5=this[_0x96c9('0xa8')](_0x96c9('0xb5'),'LUMENVOX_ASR_CONFIDENCE');if(_0x9d1ce5[_0x96c9('0xa9')]===-0x1){return _0x9d1ce5;}var _0xbfeefa=this[_0x96c9('0xa8')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0xbfeefa['result']===-0x1){return _0xbfeefa;}var _0x4e64e4=this['getAndSetVariable']('RECOG_INSTANCE()',_0x96c9('0xca'));if(_0x4e64e4[_0x96c9('0xa9')]===-0x1){return _0x4e64e4;}return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0xcb'),_0x738727));};AGIVertices[_0x96c9('0x12')][_0x96c9('0xcc')]=function(_0x4c3cb4){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0xcd'),_0x4c3cb4[_0x96c9('0x37')]));if(!this['isConfigured'](_0x4c3cb4['grammar'])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xb3'));}var _0x27d51c=_0x4c3cb4[_0x96c9('0xb2')];if(this[_0x96c9('0x89')](_0x4c3cb4[_0x96c9('0x7d')])){_0x27d51c+=','+_0x4c3cb4[_0x96c9('0x7d')];}var _0x322474=this[_0x96c9('0xf')][_0x96c9('0x5b')](_0x96c9('0xb4'),_0x27d51c);if(_0x322474['result']===-0x1){return _0x322474;}var _0x561fa3=this[_0x96c9('0xa8')](_0x96c9('0xb5'),'SESTEK_ASR_CONFIDENCE');if(_0x561fa3[_0x96c9('0xa9')]===-0x1){return _0x561fa3;}var _0x23ba68=this[_0x96c9('0xa8')]('RECOG_INPUT()',_0x96c9('0xce'));if(_0x23ba68['result']===-0x1){return _0x23ba68;}var _0x54edf2=this[_0x96c9('0xa8')]('RECOG_INSTANCE()',_0x96c9('0xcf'));if(_0x54edf2[_0x96c9('0xa9')]===-0x1){return _0x54edf2;}return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x27d51c));};AGIVertices['prototype']['database']=function(_0x381ec5){logger['info'](util['format'](_0x96c9('0xd0'),_0x381ec5[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x381ec5[_0x96c9('0xd1')])){return this['channel'][_0x96c9('0x2b')](_0x381ec5,_0x96c9('0xd2'));}var _0x16188f=this['getSquareOdbc']['sync'](this,_0x381ec5[_0x96c9('0xd1')]);if(!_0x16188f){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x381ec5,'no\x20odbc\x20database\x20found');}if(!this[_0x96c9('0x89')](_0x381ec5[_0x96c9('0x2e')])){return this['channel']['error'](_0x381ec5,_0x96c9('0xd3'));}var _0x48950c=_0x381ec5[_0x96c9('0x2e')][_0x96c9('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this[_0x96c9('0xf')]['noop'](util['format'](_0x96c9('0xd4'),_0x48950c));var _0x2951bb=this[_0x96c9('0x29')]['sync'](this,_0x16188f,_0x48950c);this[_0x96c9('0x36')][_0x96c9('0x73')](this,_0x381ec5,_0x48950c);if(!this['isConfigured'](_0x381ec5['variable_id'])){return this['channel'][_0x96c9('0xad')](_0x96c9('0xd5'));}var _0x57268a=this['getVariable'][_0x96c9('0x73')](this,_0x381ec5[_0x96c9('0xd6')]);if(!_0x57268a){return this['channel'][_0x96c9('0x2b')](_0x381ec5,'no\x20variable\x20found');}var _0x250099=this;_0x2951bb['forEach'](function(_0x4dfb11,_0x3828ae){Object[_0x96c9('0xd7')](_0x4dfb11)['forEach'](function(_0x372255){_0x250099['channel'][_0x96c9('0xa3')](util[_0x96c9('0x27')](_0x96c9('0xd8'),_0x57268a,_0x3828ae,_0x372255),_0x4dfb11[_0x372255]);});});this[_0x96c9('0xf')][_0x96c9('0xa3')](util['format']('%s_ROWS_COUNT',_0x57268a),_0x2951bb['length']);return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0xd9'),_0x57268a));};AGIVertices[_0x96c9('0x12')][_0x96c9('0xda')]=function(_0x273143){logger['debug'](util['format'](_0x96c9('0xdb'),_0x273143[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x273143[_0x96c9('0xdc')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x273143,'no\x20user\x20selected');}var _0x1d708a=this['getUser'][_0x96c9('0x73')](this,_0x273143[_0x96c9('0xdc')]);if(!_0x1d708a){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x273143,_0x96c9('0xdd'));}var _0x13c69f=this[_0x96c9('0xf')]['exec']('DIAL',[util['format']('SIP/%s',_0x1d708a),_0x273143[_0x96c9('0x6a')],_0x273143[_0x96c9('0xde')],_0x273143[_0x96c9('0x68')]]);if(_0x13c69f['result']===-0x1){return _0x13c69f;}return this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0xdf'),_0x96c9('0xe0')));};AGIVertices['prototype'][_0x96c9('0xe1')]=function(_0x188a34){logger['info'](util[_0x96c9('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x188a34[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x188a34[_0x96c9('0x7f')])){return this['channel'][_0x96c9('0xad')](_0x96c9('0xe2'));}if(!this[_0x96c9('0x89')](_0x188a34[_0x96c9('0x61')])){return this[_0x96c9('0xf')][_0x96c9('0xad')]('no\x20text\x20configured');}this[_0x96c9('0xf')][_0x96c9('0xe3')]=!![];this['createSquareDetailsReport'](_0x188a34);this[_0x96c9('0x43')](_0x188a34[_0x96c9('0x61')],'in','','');this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0xe4'),_0x188a34[_0x96c9('0x61')]));var _0x12eb39=this[_0x96c9('0x7e')][_0x96c9('0x73')](this,_0x188a34);if(_0x12eb39){for(var _0x62ca7a in _0x12eb39){if(_0x12eb39[_0x96c9('0x9a')](_0x62ca7a)){this[_0x96c9('0xf')][_0x96c9('0xa3')](util['format'](_0x96c9('0xe5'),_0x62ca7a[_0x96c9('0xe6')]()),_0x12eb39[_0x62ca7a]);}}this[_0x96c9('0x43')](_0x12eb39[_0x96c9('0xe7')],_0x96c9('0xe8'),'dialogflow','');return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0xe9'),_0x12eb39['speech']));}return this[_0x96c9('0xf')]['error'](_0x188a34,_0x96c9('0xea'));};AGIVertices[_0x96c9('0x12')][_0x96c9('0xeb')]=function(_0x301dfd){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x301dfd[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x301dfd[_0x96c9('0xec')])){return this['channel'][_0x96c9('0xad')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x301dfd[_0x96c9('0xed')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xee'));}if(!this[_0x96c9('0x89')](_0x301dfd[_0x96c9('0x82')])){return this[_0x96c9('0xf')]['noop'](_0x96c9('0xef'));}if(!this[_0x96c9('0x89')](_0x301dfd[_0x96c9('0x83')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xf0'));}if(!this[_0x96c9('0x89')](_0x301dfd[_0x96c9('0x61')])){return this['channel'][_0x96c9('0xad')](_0x96c9('0xc8'));}this['channel'][_0x96c9('0xe3')]=!![];this[_0x96c9('0x36')](_0x301dfd);this[_0x96c9('0x43')](_0x301dfd[_0x96c9('0x61')],'in','','');this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0xf1'),_0x301dfd['text']));var _0x47b282=this['googleDialogflowV2'][_0x96c9('0x73')](this,_0x301dfd);if(_0x47b282){for(var _0x2cbadc in _0x47b282){if(_0x47b282['hasOwnProperty'](_0x2cbadc)){if(_0x2cbadc!==_0x96c9('0xf2')){this[_0x96c9('0xf')][_0x96c9('0xa3')](util[_0x96c9('0x27')]('DIALOGFLOW_%s',_0x2cbadc[_0x96c9('0xe6')]()),_0x47b282[_0x2cbadc]);}}}this[_0x96c9('0x43')](_0x47b282[_0x96c9('0xe7')],_0x96c9('0xe8'),_0x96c9('0xeb'),_0x47b282[_0x96c9('0xf2')]);return this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0xf3'),_0x47b282[_0x96c9('0xe7')]));}return this['channel'][_0x96c9('0x2b')](_0x301dfd,_0x96c9('0xf4'));};AGIVertices[_0x96c9('0x12')][_0x96c9('0xf5')]=function(_0x441c2d){logger['info'](util['format'](_0x96c9('0xf6'),_0x441c2d['label']));if(!this[_0x96c9('0x89')](_0x441c2d['ndauth_url'])){return this[_0x96c9('0xf')][_0x96c9('0xad')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x441c2d[_0x96c9('0xf7')])){return this[_0x96c9('0xf')][_0x96c9('0xad')]('no\x20username\x20configured');}if(!this[_0x96c9('0x89')](_0x441c2d[_0x96c9('0xf8')])){return this['channel']['noop']('no\x20password\x20configured');}if(!this[_0x96c9('0x89')](_0x441c2d[_0x96c9('0xf9')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xc8'));}this['channel'][_0x96c9('0xe3')]=!![];this[_0x96c9('0x36')](_0x441c2d);this[_0x96c9('0x43')](_0x441c2d[_0x96c9('0x61')],'in','','');this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0xfa'),_0x441c2d[_0x96c9('0x61')]));var _0x53dfea=this['sestekNDA']['sync'](this,_0x441c2d);if(_0x53dfea){for(var _0x3ea0cb in _0x53dfea){if(_0x53dfea[_0x96c9('0x9a')](_0x3ea0cb)){this['channel']['setVariable'](util[_0x96c9('0x27')](_0x96c9('0xfb'),_0x3ea0cb[_0x96c9('0xe6')]()),_0x53dfea[_0x3ea0cb]);}}this[_0x96c9('0x43')](_0x53dfea[_0x96c9('0xe7')],_0x96c9('0xe8'),_0x96c9('0xf5'),'');if(_0x53dfea[_0x96c9('0xfc')]){this['channel'][_0x96c9('0xad')](util['format'](_0x96c9('0xfd'),_0x53dfea[_0x96c9('0xfc')]));var _0x357470=this[_0x96c9('0xf')][_0x96c9('0xfe')](_0x53dfea[_0x96c9('0xfc')]);try{fs[_0x96c9('0xff')](_0x53dfea[_0x96c9('0xfc')]+_0x96c9('0x100'));}catch(_0x47933b){logger[_0x96c9('0x2b')](_0x47933b);}return _0x357470;}else{return this['channel'][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x101'),_0x53dfea[_0x96c9('0xe7')]));}}return this[_0x96c9('0xf')]['error'](_0x441c2d,_0x96c9('0x102'));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x103')]=function(_0x54714a){logger[_0x96c9('0x2c')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x54714a['label']));return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0x103'));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x104')]=function(_0xa754e7){logger['info'](util[_0x96c9('0x27')](_0x96c9('0x105'),_0xa754e7[_0x96c9('0x37')]));var _0x342bf2='';if(_0xa754e7[_0x96c9('0x106')]){if(!this[_0x96c9('0x89')](_0xa754e7[_0x96c9('0x106')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0xa754e7,_0x96c9('0x107'));}else{var _0x142179=parseInt(_0xa754e7['trunk_id'],0xa);if(isNaN(_0x142179)){_0x342bf2=_0xa754e7[_0x96c9('0x106')];}else{_0x342bf2=this[_0x96c9('0x1b')][_0x96c9('0x73')](this,_0xa754e7['trunk_id']);if(!_0x342bf2){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0xa754e7,'no\x20trunk\x20found');}}}}else if(_0xa754e7[_0x96c9('0x108')]){_0x342bf2=_0xa754e7['trunk_name'];}else{return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0xa754e7,'no\x20trunk\x20selected');}var _0x3ecd2c=this[_0x96c9('0xf')][_0x96c9('0x5b')](_0x96c9('0xe0'),[util[_0x96c9('0x27')](_0x96c9('0x109'),_0x342bf2,_0xa754e7['phone']),_0xa754e7[_0x96c9('0x6a')],_0xa754e7[_0x96c9('0xde')],_0xa754e7[_0x96c9('0x68')]]);if(_0x3ecd2c[_0x96c9('0xa9')]===-0x1){return _0x3ecd2c;}return this['channel'][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0xdf'),_0x96c9('0xe0')));};AGIVertices[_0x96c9('0x12')]['finally']=function(_0x200e4b){logger['info'](util[_0x96c9('0x27')](_0x96c9('0x10a'),_0x200e4b['label']));return this[_0x96c9('0xf')]['noop'](_0x96c9('0x10b'));};AGIVertices['prototype'][_0x96c9('0xd')]=function(_0x3a95){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x10c'),_0x3a95[_0x96c9('0x37')]));if(_0x3a95[_0x96c9('0x10d')]===0x0){return this[_0x96c9('0xab')](_0x3a95);}_0x3a95[_0x96c9('0x10d')]-=0x1;if(!this[_0x96c9('0x89')](_0x3a95[_0x96c9('0x10e')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x3a95,_0x96c9('0x10f'));}var _0x560036=this['getSound'][_0x96c9('0x73')](this,_0x3a95['file_id']);if(!_0x560036){return this[_0x96c9('0xf')]['error'](_0x3a95,_0x96c9('0x110'));}if(!this[_0x96c9('0x89')](_0x3a95[_0x96c9('0xd6')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4521c9=this[_0x96c9('0xf')][_0x96c9('0x111')](_0x560036,_0x3a95[_0x96c9('0x112')],_0x3a95[_0x96c9('0x113')]);var _0xc7c75f=_0x4521c9['result']?_0x4521c9[_0x96c9('0xa9')][_0x96c9('0x4f')]():'';logger[_0x96c9('0x2c')](_0x96c9('0x114'),JSON['stringify'](_0x4521c9));if(_0x4521c9[_0x96c9('0xa9')]===-0x1){this[_0x96c9('0x36')][_0x96c9('0x73')](this,_0x3a95,_0xc7c75f);return _0x4521c9;}else if(_0x4521c9[_0x96c9('0xa7')]===_0x96c9('0x6a')){_0x4521c9[_0x96c9('0xa9')]=_0xc7c75f[_0x96c9('0xa5')]>=parseInt(_0x3a95[_0x96c9('0x115')])?'x':'i';}else{_0x4521c9[_0x96c9('0xa9')]=_0xc7c75f['length']>=parseInt(_0x3a95[_0x96c9('0x115')])&&_0xc7c75f[_0x96c9('0xa5')]<=parseInt(_0x3a95['maxdigit'])?'x':'i';}var _0x4948d4=this[_0x96c9('0x13')][_0x96c9('0x73')](this,_0x3a95[_0x96c9('0xd6')]);if(!_0x4948d4){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x3a95,_0x96c9('0x116'));}this['channel']['setVariable'](_0x4948d4,_0xc7c75f);if(this[_0x96c9('0x89')](_0x3a95[_0x96c9('0x117')])){var _0x1d0c27=parseInt(_0x3a95['hiddendigitsnum'],0xa);var _0x444bc2=rs[_0x96c9('0x118')]({'charset':'*','length':_0x1d0c27});var _0x1526cf=_0xc7c75f['length'];if(_0x1526cf>0x0){if(_0x1526cf>_0x1d0c27){this['createSquareDetailsReport']['sync'](this,_0x3a95,_0x3a95['hiddendigitspos']===_0x96c9('0x119')?_0x444bc2+_0xc7c75f[_0x96c9('0x11a')](_0x1d0c27):_0xc7c75f['substr'](0x0,_0x1526cf-_0x1d0c27)+_0x444bc2);}else{this['createSquareDetailsReport'][_0x96c9('0x73')](this,_0x3a95,rs[_0x96c9('0x118')]({'charset':'*','length':_0x1526cf}));}}else{this[_0x96c9('0x36')]['sync'](this,_0x3a95,'');}}else{this[_0x96c9('0x36')][_0x96c9('0x73')](this,_0x3a95,_0xc7c75f);}return _0x4521c9;};AGIVertices[_0x96c9('0x12')][_0x96c9('0xe')]=function(_0x495e48){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x11b'),_0x495e48[_0x96c9('0x37')]));return this[_0x96c9('0xd')](_0x495e48);};AGIVertices[_0x96c9('0x12')]['goal']=function(_0x48a20c){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x11c'),_0x48a20c[_0x96c9('0x37')]));this[_0x96c9('0x36')][_0x96c9('0x73')](this,_0x48a20c,_0x48a20c['goalname']);return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')]('GOAL\x20%s',_0x48a20c[_0x96c9('0x11d')]));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x11e')]=function(_0x2f4cf9){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x11f'),_0x2f4cf9[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x2f4cf9[_0x96c9('0x91')])||!this['isConfigured'](_0x2f4cf9['aws_secret_access_key'])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0x120'));}if(!this[_0x96c9('0x89')](_0x2f4cf9[_0x96c9('0x61')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xc8'));}this[_0x96c9('0xf')][_0x96c9('0xad')](util['format'](_0x96c9('0x121'),_0x2f4cf9['text']));var _0x727b22=this['awsPolly'][_0x96c9('0x73')](this,_0x2f4cf9);if(_0x727b22){this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0x122'),_0x727b22));var _0x188d6f=this['channel'][_0x96c9('0xfe')](_0x727b22);try{fs['unlink'](_0x727b22+'.wav');}catch(_0x6fe73f){logger[_0x96c9('0x2b')](_0x6fe73f);}return _0x188d6f;}return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x2f4cf9,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x96c9('0x12')][_0x96c9('0x123')]=function(_0x855aef){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x124'),_0x855aef[_0x96c9('0x37')]));if(!this['isConfigured'](_0x855aef['aws_access_key_id'])||!this['isConfigured'](_0x855aef['aws_secret_access_key'])){return this['channel'][_0x96c9('0xad')](_0x96c9('0x120'));}if(!this[_0x96c9('0x89')](_0x855aef[_0x96c9('0x93')])){return this['channel'][_0x96c9('0xad')](_0x96c9('0x125'));}if(!this[_0x96c9('0x89')](_0x855aef['text'])){return this[_0x96c9('0xf')][_0x96c9('0xad')]('no\x20text\x20configured');}this['channel'][_0x96c9('0xe3')]=!![];this[_0x96c9('0x36')](_0x855aef);this['createSquareMessage'](_0x855aef['text'],'in','','');this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x855aef[_0x96c9('0x61')]));var _0x9a1802=this[_0x96c9('0x90')][_0x96c9('0x73')](this,_0x855aef);if(_0x9a1802){for(var _0x1a11bf in _0x9a1802){if(_0x9a1802[_0x96c9('0x9a')](_0x1a11bf)&&_[_0x96c9('0x9b')](_0x9a1802[_0x1a11bf])){this['channel'][_0x96c9('0xa3')](util[_0x96c9('0x27')](_0x96c9('0x126'),_0x1a11bf[_0x96c9('0xe6')]()),_0x9a1802[_0x1a11bf]);}}if(_[_0x96c9('0x46')](_0x9a1802[_0x96c9('0x7b')])){return this[_0x96c9('0xf')]['noop'](_0x96c9('0x127'));}else{this['createSquareMessage'](_0x9a1802[_0x96c9('0x7b')],_0x96c9('0xe8'),_0x96c9('0x128'),'');return this['channel'][_0x96c9('0xad')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x9a1802[_0x96c9('0x7b')]));}}return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x855aef,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x96c9('0x12')]['googleasr']=function(_0xf9b268){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x129'),_0xf9b268[_0x96c9('0x37')],_0xf9b268['timeout']));if(!this[_0x96c9('0x89')](_0xf9b268['key'])){return this[_0x96c9('0xf')]['noop']('no\x20key\x20configured');}var _0x50b3ca=_0x96c9('0x12a');var _0x29ad58=util[_0x96c9('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x96c9('0x118')](0x4));var _0x5a8e9=util['format'](_0x96c9('0xa2'),_0x29ad58,_0x50b3ca);var _0x4ba776=!![];if(_0xf9b268[_0x96c9('0x12b')]===_0x96c9('0x12c')){_0x4ba776=![];}var _0x3a7713=this['channel'][_0x96c9('0x12d')](_0x29ad58,_0x50b3ca,_0xf9b268[_0x96c9('0x12e')],_0xf9b268[_0x96c9('0x6a')],undefined,_0x4ba776);if(_0x3a7713[_0x96c9('0xa9')]!==-0x1){this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x12f'),_0x5a8e9));var _0x529ac8=this[_0x96c9('0x94')]['sync'](this,_0xf9b268,_0x5a8e9);if(_0x529ac8){for(var _0xa7af48 in _0x529ac8){if(_0x529ac8[_0x96c9('0x9a')](_0xa7af48)){this[_0x96c9('0xf')][_0x96c9('0xa3')](util[_0x96c9('0x27')](_0x96c9('0x130'),_0xa7af48['toUpperCase']()),_0x529ac8[_0xa7af48]);}}return this[_0x96c9('0xf')]['noop'](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x96c9('0x77')](_0x529ac8)));}}return _0x3a7713;};AGIVertices[_0x96c9('0x12')]['tildeasr']=function(_0x382711){logger['info'](util[_0x96c9('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x382711[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x382711[_0x96c9('0x96')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0x131'));}if(!this[_0x96c9('0x89')](_0x382711[_0x96c9('0x97')])){return this['channel'][_0x96c9('0xad')](_0x96c9('0x132'));}var _0x24780f='wav';var _0x4fbcdc=util[_0x96c9('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x96c9('0x118')](0x4));var _0x100213=util[_0x96c9('0x27')](_0x96c9('0xa2'),_0x4fbcdc,_0x24780f);var _0x273f15=!![];if(_0x382711[_0x96c9('0x12b')]==='NOBEEP'){_0x273f15=![];}var _0x39a15c=this[_0x96c9('0xf')][_0x96c9('0x12d')](_0x4fbcdc,_0x24780f,_0x382711[_0x96c9('0x12e')],_0x382711[_0x96c9('0x6a')],undefined,_0x273f15);if(_0x39a15c[_0x96c9('0xa9')]!==-0x1){this[_0x96c9('0xf')]['noop'](util['format'](_0x96c9('0x133'),_0x100213));var _0xde8b5c=this[_0x96c9('0x95')][_0x96c9('0x73')](this,_0x382711,_0x100213);if(_0xde8b5c){for(var _0x6aa8d3 in _0xde8b5c){if(_0xde8b5c[_0x96c9('0x9a')](_0x6aa8d3)){this[_0x96c9('0xf')]['setVariable'](util['format'](_0x96c9('0x134'),_0x6aa8d3[_0x96c9('0xe6')]()),_0xde8b5c[_0x6aa8d3]);}}return this['channel'][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x135'),JSON['stringify'](_0xde8b5c)));}}return _0x39a15c;};AGIVertices[_0x96c9('0x12')][_0x96c9('0x136')]=function(_0x30f86c){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x30f86c[_0x96c9('0x37')]));return this[_0x96c9('0xf')][_0x96c9('0x137')](_0x30f86c[_0x96c9('0x3e')],_0x30f86c['extension'],_0x30f86c['priority']);};AGIVertices[_0x96c9('0x12')][_0x96c9('0x138')]=function(_0x20fd2e){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x139'),_0x20fd2e['label']));if(!this[_0x96c9('0x89')](_0x20fd2e['condition'])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x20fd2e,_0x96c9('0x13a'));}try{var _0x28ba98=eval(_0x20fd2e[_0x96c9('0x13b')])?'true':_0x96c9('0x13c');this['channel'][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x13d'),_0x20fd2e[_0x96c9('0x13b')],_0x28ba98));return{'code':0xc8,'result':_0x28ba98};}catch(_0x5e7091){return{'code':0xc8,'result':_0x96c9('0x13c')};}};AGIVertices[_0x96c9('0x12')][_0x96c9('0x13e')]=function(_0x4904e9){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x13f'),_0x4904e9['label']));if(!this['isConfigured'](_0x4904e9[_0x96c9('0x140')])){return this['channel'][_0x96c9('0x2b')](_0x4904e9,_0x96c9('0x141'));}var _0xa43f07=this['getIntervals'][_0x96c9('0x73')](this,_0x4904e9[_0x96c9('0x140')]);if(!_0xa43f07){return this['channel'][_0x96c9('0x2b')](_0x4904e9,_0x96c9('0x142'));}for(var _0xbe18cd=0x0;_0xbe18cd<_0xa43f07['length'];_0xbe18cd+=0x1){var _0x3e18a2=this[_0x96c9('0xf')][_0x96c9('0x13')](util[_0x96c9('0x27')](_0x96c9('0x143'),_0xa43f07[_0xbe18cd]));if(_0x3e18a2[_0x96c9('0xa9')]===-0x1){return _0x3e18a2;}logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('IFTIME\x20%s\x20%s',_0xa43f07[_0xbe18cd],_0x3e18a2[_0x96c9('0xa7')]));if(_0x3e18a2[_0x96c9('0xa7')]===_0x96c9('0x144')){logger[_0x96c9('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0xa43f07[_0xbe18cd],'true'));this[_0x96c9('0xf')][_0x96c9('0xad')](util['format']('IFTIME\x20%s\x20%s',_0xa43f07[_0xbe18cd],_0x96c9('0x144')));return{'code':0xc8,'result':_0x96c9('0x144')};}else{logger['info'](util[_0x96c9('0x27')](_0x96c9('0x145'),_0xa43f07[_0xbe18cd],_0x96c9('0x13c')));this['channel'][_0x96c9('0xad')](util['format'](_0x96c9('0x145'),_0xa43f07[_0xbe18cd],'false'));}}return{'code':0xc8,'result':_0x96c9('0x13c')};};AGIVertices['prototype'][_0x96c9('0x146')]=function(_0x15c4a5){logger['info'](util[_0x96c9('0x27')](_0x96c9('0x147'),_0x15c4a5[_0x96c9('0x37')]));return this[_0x96c9('0xf')][_0x96c9('0x146')]();};AGIVertices[_0x96c9('0x12')][_0x96c9('0x148')]=function(_0x54974e){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x149'),_0x54974e[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x54974e[_0x96c9('0x7f')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xe2'));}var _0xdcfe30='wav';var _0x1df51f=util[_0x96c9('0x27')](_0x96c9('0x14a'),FILES_PATH,rs[_0x96c9('0x118')](0x4));var _0x25206e=util[_0x96c9('0x27')]('%s.%s',_0x1df51f,_0xdcfe30);var _0x46492f=!![];if(_0x54974e['beep']==='NOBEEP'){_0x46492f=![];}var _0x3ca0b9=this['channel'][_0x96c9('0x12d')](_0x1df51f,_0xdcfe30,_0x54974e[_0x96c9('0x12e')],_0x54974e[_0x96c9('0x6a')],undefined,_0x46492f);if(_0x3ca0b9['result']!==-0x1){this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x14b'),_0x25206e));var _0x1c66d5=this['ispeechASR'][_0x96c9('0x73')](this,_0x54974e,_0x25206e);if(_0x1c66d5){for(var _0x39e39b in _0x1c66d5){if(_0x1c66d5['hasOwnProperty'](_0x39e39b)){this['channel'][_0x96c9('0xa3')](util[_0x96c9('0x27')]('ISPEECH_ASR_%s',_0x39e39b[_0x96c9('0xe6')]()),_0x1c66d5[_0x39e39b]);}}return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x14c'),JSON[_0x96c9('0x77')](_0x1c66d5)));}}return _0x3ca0b9;};AGIVertices['prototype'][_0x96c9('0x14d')]=function(_0x1b5e5b){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x14e'),_0x1b5e5b[_0x96c9('0x37')]));if(!this['isConfigured'](_0x1b5e5b[_0x96c9('0x7f')])){return this['channel'][_0x96c9('0xad')](_0x96c9('0xe2'));}if(!this[_0x96c9('0x89')](_0x1b5e5b['text'])){return this['channel'][_0x96c9('0xad')]('no\x20text\x20configured');}this['channel'][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x14f'),_0x1b5e5b['text']));var _0x5f2c35=this['ispeechTTS'][_0x96c9('0x73')](this,_0x1b5e5b);if(_0x5f2c35){this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0x14b'),_0x5f2c35));var _0x3c8886=this[_0x96c9('0xf')][_0x96c9('0xfe')](_0x5f2c35,_0x1b5e5b[_0x96c9('0x12e')]);try{fs[_0x96c9('0xff')](_0x5f2c35+_0x96c9('0x100'));}catch(_0x3f0ccc){logger[_0x96c9('0x2b')](_0x3f0ccc);}return _0x3c8886;}return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x1b5e5b,_0x96c9('0x150'));};AGIVertices[_0x96c9('0x12')]['login']=function(_0x4e119b){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x4e119b[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x4e119b[_0x96c9('0x151')])){return this[_0x96c9('0xf')]['error'](_0x4e119b,_0x96c9('0x152'));}logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x153'),this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x4e119b[_0x96c9('0x151')]));var _0x26a790=this[_0x96c9('0x57')][_0x96c9('0x73')](this,_0x4e119b['findBy']);if(_0x26a790){logger['info'](util['format'](_0x96c9('0x154'),this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x4e119b[_0x96c9('0x151')]));this['channel']['noop'](util[_0x96c9('0x27')](_0x96c9('0x154'),this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x4e119b['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x96c9('0x3a')],_0x4e119b[_0x96c9('0x151')]));this[_0x96c9('0xf')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x4e119b[_0x96c9('0x151')]));return{'code':0xc8,'result':_0x96c9('0x155')};}};AGIVertices[_0x96c9('0x12')]['logout']=function(_0x28c024){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x156'),_0x28c024[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x28c024[_0x96c9('0x151')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x28c024,_0x96c9('0x152'));}logger['info'](util[_0x96c9('0x27')](_0x96c9('0x153'),this[_0x96c9('0xf')]['callerid'],_0x28c024[_0x96c9('0x151')]));var _0x23953d=this[_0x96c9('0x56')][_0x96c9('0x73')](this,_0x28c024['findBy']);if(_0x23953d){logger['info'](util[_0x96c9('0x27')](_0x96c9('0x154'),this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x28c024[_0x96c9('0x151')]));this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x96c9('0x3a')],_0x28c024[_0x96c9('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x157'),this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x28c024[_0x96c9('0x151')]));this['channel']['noop'](util[_0x96c9('0x27')](_0x96c9('0x157'),this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x28c024[_0x96c9('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x96c9('0x158')]=function(_0x23a14e){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x159'),_0x23a14e[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x23a14e[_0x96c9('0x15a')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x23a14e,_0x96c9('0x15b'));}this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')]('math\x20%s',_0x23a14e[_0x96c9('0x15a')]));var _0x499bb1=eval(_0x23a14e[_0x96c9('0x15a')]);if(!this[_0x96c9('0x89')](_0x23a14e[_0x96c9('0xd6')])){return this[_0x96c9('0xf')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4cb79e=this[_0x96c9('0x13')][_0x96c9('0x73')](this,_0x23a14e['variable_id']);if(!_0x4cb79e){return this[_0x96c9('0xf')]['error'](_0x23a14e,_0x96c9('0x116'));}if(_['isArray'](_0x499bb1)){var _0x4dfd83=this;_0x499bb1[_0x96c9('0x15c')](function(_0x2884cd,_0x4bb66f){_0x4dfd83[_0x96c9('0xf')][_0x96c9('0xa3')](util['format'](_0x96c9('0x15d'),_0x4cb79e,_0x4bb66f),_0x2884cd);});return this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0x15e'),_0x4cb79e));}else{return this[_0x96c9('0xf')][_0x96c9('0xa3')](_0x4cb79e,_0x499bb1);}};AGIVertices['prototype'][_0x96c9('0xc')]=function(_0x30435e){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x15f'),_0x30435e[_0x96c9('0x37')]));if(_0x30435e[_0x96c9('0x10d')]===0x0){return this[_0x96c9('0xab')](_0x30435e);}_0x30435e[_0x96c9('0x10d')]-=0x1;if(!this[_0x96c9('0x89')](_0x30435e[_0x96c9('0x10e')])){return this['channel'][_0x96c9('0x2b')](_0x30435e,_0x96c9('0x10f'));}var _0x48c26a=this['getSound']['sync'](this,_0x30435e[_0x96c9('0x10e')]);if(!_0x48c26a){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x30435e,'no\x20file\x20audio\x20found');}var _0x5e0aec=this[_0x96c9('0xf')][_0x96c9('0x111')](_0x48c26a,_0x30435e['response'],_0x30435e[_0x96c9('0x160')]);var _0x3bd97a=_0x5e0aec['result'];if(_0x5e0aec[_0x96c9('0xa9')]===-0x1){this[_0x96c9('0x36')][_0x96c9('0x73')](this,_0x30435e,'-1');return _0x5e0aec;}else if(_0x5e0aec[_0x96c9('0xa7')]===_0x96c9('0x6a')){_0x5e0aec[_0x96c9('0xa9')]=_0x5e0aec['result'][_0x96c9('0xa5')]>0x0?_0x5e0aec[_0x96c9('0xa9')]:'t';}else if(_['isEmpty'](_0x5e0aec[_0x96c9('0xa9')])){_0x5e0aec[_0x96c9('0xa9')]='#';_0x3bd97a='#';}if(!this[_0x96c9('0x89')](_0x30435e['variable_id'])){this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xd5'));}else{var _0x1ca9ef=this[_0x96c9('0x13')][_0x96c9('0x73')](this,_0x30435e[_0x96c9('0xd6')]);if(!_0x1ca9ef){return this[_0x96c9('0xf')]['error'](_0x30435e,_0x96c9('0x116'));}this[_0x96c9('0xf')][_0x96c9('0xa3')](_0x1ca9ef,_0x3bd97a);}this['createSquareDetailsReport'][_0x96c9('0x73')](this,_0x30435e,_0x3bd97a);return _0x5e0aec;};AGIVertices[_0x96c9('0x12')][_0x96c9('0xad')]=function(_0x189a0b){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x161'),_0x189a0b[_0x96c9('0x37')]));return this[_0x96c9('0xf')]['noop'](_0x189a0b['output']||_0x189a0b[_0x96c9('0x37')]);};AGIVertices[_0x96c9('0x12')][_0x96c9('0x162')]=function(_0x4bf3b6){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4bf3b6[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x4bf3b6[_0x96c9('0x151')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x4bf3b6,_0x96c9('0x152'));}logger['info'](util[_0x96c9('0x27')](_0x96c9('0x153'),this['channel'][_0x96c9('0x3a')],_0x4bf3b6[_0x96c9('0x151')]));var _0x25a4ec=this[_0x96c9('0x51')]['sync'](this,_0x4bf3b6['pause_id']);var _0x3bf27a=this[_0x96c9('0x54')][_0x96c9('0x73')](this,_0x4bf3b6[_0x96c9('0x151')],_0x25a4ec);if(_0x3bf27a){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x154'),this['channel']['callerid'],_0x4bf3b6[_0x96c9('0x151')]));this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0x154'),this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x4bf3b6['findBy']));return{'code':0xc8,'result':_0x96c9('0x163')};}else{logger['info'](util[_0x96c9('0x27')](_0x96c9('0x157'),this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x4bf3b6[_0x96c9('0x151')]));this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x154'),this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x4bf3b6['findBy']));return{'code':0xc8,'result':_0x96c9('0x155')};}};AGIVertices[_0x96c9('0x12')][_0x96c9('0x164')]=function(_0x5048a8){logger['info'](util['format'](_0x96c9('0x165'),_0x5048a8[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x5048a8[_0x96c9('0x10e')])){return this[_0x96c9('0xf')]['error'](_0x5048a8,_0x96c9('0x10f'));}var _0x325279=this[_0x96c9('0x166')][_0x96c9('0x73')](this,_0x5048a8[_0x96c9('0x10e')]);if(!_0x325279){return this['channel'][_0x96c9('0x2b')](_0x5048a8,_0x96c9('0x110'));}var _0x159b0e=this[_0x96c9('0xf')][_0x96c9('0x5b')](_0x96c9('0x167'),[_0x325279,_0x5048a8[_0x96c9('0xde')]]);if(_0x159b0e[_0x96c9('0xa9')]===-0x1){return _0x159b0e;}return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0xc5'),'PLAYBACK',_0x325279));};AGIVertices['prototype']['queue']=function(_0x2895d2){logger['info'](util[_0x96c9('0x27')](_0x96c9('0x168'),_0x2895d2['label']));if(!this['isConfigured'](_0x2895d2[_0x96c9('0x169')])){return this[_0x96c9('0xf')]['error'](_0x2895d2,_0x96c9('0x16a'));}var _0x26fd06='';var _0x3d303c=parseInt(_0x2895d2[_0x96c9('0x169')],0xa);if(isNaN(_0x3d303c)){_0x26fd06=_0x2895d2[_0x96c9('0x169')];}else{_0x26fd06=this[_0x96c9('0x16b')][_0x96c9('0x73')](this,_0x2895d2[_0x96c9('0x169')]);if(!_0x26fd06){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x2895d2,_0x96c9('0x16c'));}}var _0x475643='';if(this[_0x96c9('0x89')](_0x2895d2[_0x96c9('0x10e')])){var _0x1311ab=this[_0x96c9('0x166')][_0x96c9('0x73')](this,_0x2895d2[_0x96c9('0x10e')]);if(_0x1311ab){_0x475643=_0x1311ab;}}this['createSquareDetailsReport'][_0x96c9('0x73')](this,_0x2895d2,_0x26fd06);if(_0x2895d2[_0x96c9('0xde')][_0x96c9('0x16d')]('x')<0x0){_0x2895d2[_0x96c9('0xde')]+='x';}if(_0x2895d2[_0x96c9('0xde')][_0x96c9('0x16d')]('X')<0x0){_0x2895d2['opts']+='X';}this[_0x96c9('0xf')]['setVariable']('XMCS-QUEUE',_0x26fd06?_0x26fd06[_0x96c9('0x16e')]():'');var _0x22ae68=this[_0x96c9('0xf')][_0x96c9('0x5b')](_0x96c9('0x16f'),[_0x26fd06,_0x2895d2[_0x96c9('0xde')],_0x2895d2[_0x96c9('0x68')],_0x475643,_0x2895d2['timeout'],_0x2895d2[_0x96c9('0x8')],_0x2895d2[_0x96c9('0x170')],_0x2895d2[_0x96c9('0x171')],'',_0x2895d2['position']]);if(_0x22ae68[_0x96c9('0xa9')]===-0x1){return _0x22ae68;}return this[_0x96c9('0xf')][_0x96c9('0xad')](util['format'](_0x96c9('0xc5'),_0x96c9('0x16f'),_0x26fd06));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x172')]=function(_0x37d9c0){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x173'),_0x37d9c0[_0x96c9('0x37')]));var _0x1ceb16=_0x37d9c0[_0x96c9('0x174')]||_0x96c9('0x12a');var _0x5cb2b3=util['format'](_0x96c9('0x175'),this[_0x96c9('0xf')][_0x96c9('0x3c')],rs['generate'](0x5));var _0x1da7a2=util[_0x96c9('0x27')](_0x96c9('0x176'),FILES_PATH,_0x5cb2b3,_0x1ceb16);var _0x1e715d=util['format'](_0x96c9('0x14a'),FILES_PATH,_0x5cb2b3);this[_0x96c9('0x3b')][_0x96c9('0x73')](this,_0x37d9c0,_0x5cb2b3,_0x1da7a2);this[_0x96c9('0xf')][_0x96c9('0xa3')]('RECORDING_SAVENAME',_0x5cb2b3);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x1e715d,_0x1ceb16,_0x37d9c0[_0x96c9('0x177')],_0x37d9c0['timeout']);return this[_0x96c9('0xf')][_0x96c9('0x12d')](_0x1e715d,_0x1ceb16,_0x37d9c0[_0x96c9('0x177')],_0x37d9c0['timeout'],undefined,!![]);};AGIVertices[_0x96c9('0x12')][_0x96c9('0x178')]=function(_0x467996){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x179'),_0x467996[_0x96c9('0x37')]));if(!this['isConfigured'](_0x467996[_0x96c9('0x68')])){return this[_0x96c9('0xf')]['noop']('no\x20url\x20configured');}var _0x1acb41=this[_0x96c9('0x67')][_0x96c9('0x73')](this,_0x467996);logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x17a'),util['inspect'](_0x1acb41,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x467996[_0x96c9('0xd6')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0x17b'));}var _0x5efae1=this[_0x96c9('0x13')][_0x96c9('0x73')](this,_0x467996[_0x96c9('0xd6')]);if(!_0x5efae1){return this[_0x96c9('0xf')]['error'](_0x467996,_0x96c9('0x116'));}this['channel'][_0x96c9('0xa3')](util[_0x96c9('0x27')]('%s_STATUS_CODE',_0x5efae1),_0x1acb41[_0x96c9('0x17c')]?_0x1acb41[_0x96c9('0x17c')]:_0x96c9('0x17d'));this[_0x96c9('0xf')][_0x96c9('0xa3')](util[_0x96c9('0x27')](_0x96c9('0x17e'),_0x5efae1),_0x1acb41['statusMessage']?_0x1acb41['statusMessage']:'OK');if(_0x1acb41[_0x96c9('0x78')]){try{this['saveRestApiResult'](_0x1acb41['body'],_0x5efae1);}catch(_0x2ee8f9){logger['error'](util[_0x96c9('0x27')](_0x96c9('0x17f'),_0x5efae1));}}return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')]('variable\x20%s\x20set',_0x5efae1));};AGIVertices['prototype']['saydigits']=function(_0x33e877){logger['info'](util[_0x96c9('0x27')](_0x96c9('0x180'),_0x33e877[_0x96c9('0x37')]));return this[_0x96c9('0xf')][_0x96c9('0x181')](_0x33e877[_0x96c9('0x182')][_0x96c9('0x5d')](/\s+/g,''),_0x33e877[_0x96c9('0x177')]);};AGIVertices['prototype']['saynumber']=function(_0x285e0a){logger['info'](util[_0x96c9('0x27')](_0x96c9('0x183'),_0x285e0a['label']));return this[_0x96c9('0xf')][_0x96c9('0x184')](_0x285e0a[_0x96c9('0x6b')][_0x96c9('0x5d')](/\s+/g,''),_0x285e0a['escape_digits']);};AGIVertices['prototype'][_0x96c9('0x185')]=function(_0x13d442){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x186'),_0x13d442[_0x96c9('0x37')]));return this['channel'][_0x96c9('0x187')](_0x13d442[_0x96c9('0x61')],_0x13d442[_0x96c9('0x177')]);};AGIVertices[_0x96c9('0x12')][_0x96c9('0x188')]=function(_0x21a114){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x21a114[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x21a114[_0x96c9('0x189')])){return this['channel'][_0x96c9('0xad')](_0x96c9('0x18a'));}var _0x565c9f=this[_0x96c9('0x1f')][_0x96c9('0x73')](this,_0x21a114[_0x96c9('0x189')]);if(!_0x565c9f||!_0x565c9f['Smtp']){return this['channel'][_0x96c9('0x2b')](_0x21a114,_0x96c9('0x18b'));}var _0x5a8315={'from':util[_0x96c9('0x27')](_0x96c9('0x18c'),_0x565c9f[_0x96c9('0x15')],_0x565c9f[_0x96c9('0x18d')]||_0x565c9f[_0x96c9('0x18e')][_0x96c9('0x18f')]),'to':_0x21a114['to']||'','cc':_0x21a114['cc']||'','bcc':_0x21a114[_0x96c9('0x190')]||'','subject':_0x21a114[_0x96c9('0x191')],'html':_0x21a114['text'],'text':_0x21a114[_0x96c9('0x61')]};var _0x3ca4dc={'tls':{'rejectUnauthorized':![]}};if(_0x565c9f[_0x96c9('0x18e')]['service']){_0x3ca4dc['service']=_0x565c9f[_0x96c9('0x18e')][_0x96c9('0x192')];}else{_0x3ca4dc['host']=_0x565c9f[_0x96c9('0x18e')][_0x96c9('0x193')];_0x3ca4dc['port']=_0x565c9f[_0x96c9('0x18e')][_0x96c9('0x194')];_0x3ca4dc[_0x96c9('0x195')]=_0x565c9f[_0x96c9('0x18e')][_0x96c9('0x195')];}if(_0x565c9f[_0x96c9('0x18e')][_0x96c9('0x196')]){_0x3ca4dc[_0x96c9('0x197')]={'user':_0x565c9f[_0x96c9('0x18e')][_0x96c9('0x18f')],'pass':_0x565c9f[_0x96c9('0x18e')][_0x96c9('0x198')]};}if(this['isConfigured'](_0x21a114['template_id'])){}logger[_0x96c9('0x199')](_0x96c9('0x19a'),JSON[_0x96c9('0x77')](_0x5a8315));this[_0x96c9('0x36')]['sync'](this,_0x21a114,_0x21a114[_0x96c9('0x189')]);this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0x19b'),_0x565c9f['name']));this[_0x96c9('0x21')][_0x96c9('0x73')](this,_0x3ca4dc,_0x5a8315);return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0x19c'));};AGIVertices['prototype'][_0x96c9('0x19d')]=function(_0x5519d3){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x19e'),_0x5519d3[_0x96c9('0x37')]));return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0x19f'));};AGIVertices[_0x96c9('0x12')]['sendSMS']=function(_0x1b381f){logger['info'](util['format'](_0x96c9('0x1a0'),_0x1b381f[_0x96c9('0x37')]));if(!this['isConfigured'](_0x1b381f['sms_account_id'])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0x1a1'));}var _0x200b62=this['getSmsAccount']['sync'](this,_0x1b381f[_0x96c9('0x1a2')]);if(!_0x200b62){return this['channel']['error'](_0x1b381f,_0x96c9('0x1a3'));}var _0xd27af4={'body':_0x1b381f['sms_text'],'phone':_0x1b381f['to']||'','SmsAccountId':_0x200b62['id']};logger[_0x96c9('0x199')]('sendSMS\x20message',JSON[_0x96c9('0x77')](_0xd27af4));this[_0x96c9('0x36')][_0x96c9('0x73')](this,_0x1b381f,_0x1b381f[_0x96c9('0x1a2')]);this['channel']['noop'](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x200b62[_0x96c9('0x15')]));this['createSmsMessage'][_0x96c9('0x73')](this,_0xd27af4);return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0x1a4'));};AGIVertices['prototype'][_0x96c9('0x1a5')]=function(_0x2762bf){logger[_0x96c9('0x2c')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2762bf[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x2762bf[_0x96c9('0xd6')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x2762bf,_0x96c9('0x1a6'));}var _0x30c1b2=this[_0x96c9('0x13')][_0x96c9('0x73')](this,_0x2762bf[_0x96c9('0xd6')]);if(!_0x30c1b2){return this['channel'][_0x96c9('0x2b')](_0x2762bf,_0x96c9('0x116'));}return this['channel'][_0x96c9('0xa3')](_0x30c1b2,_0x2762bf[_0x96c9('0x1a7')]);};AGIVertices['prototype']['start']=function(_0x5c2e35){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x1a8'),_0x5c2e35['label']));this['channel']['noop']('START\x20CALLY\x20SQUARE');if(_0x5c2e35[_0x96c9('0xbb')]===_0x96c9('0x1a9')){this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0x1aa'));return this[_0x96c9('0xf')][_0x96c9('0xbb')]();}return this[_0x96c9('0xf')]['noop'](_0x96c9('0x1ab'));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x1ac')]=function(_0x32d702){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x1ad'),_0x32d702[_0x96c9('0x37')]));if(!this[_0x96c9('0x89')](_0x32d702[_0x96c9('0x1ae')])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x32d702,_0x96c9('0x1af'));}var _0x5abfb0=this['getSquareProject'][_0x96c9('0x73')](this,_0x32d702[_0x96c9('0x1ae')]);if(!this['isConfigured'](_0x5abfb0)){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x32d702,util[_0x96c9('0x27')](_0x96c9('0x1b0'),_0x32d702[_0x96c9('0x1ae')]));}if(_0x5abfb0===this['channel'][_0x96c9('0x39')]){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x32d702,_0x96c9('0x1b1'));}this[_0x96c9('0x36')][_0x96c9('0x73')](this,_0x32d702,_0x5abfb0);var _0x1fbe67=this[_0x96c9('0xf')][_0x96c9('0x5b')]('AGI',util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x96c9('0x8')][_0x96c9('0x193')]||_0x96c9('0x1b2'),_0x5abfb0,this['channel'][_0x96c9('0x39')]));if(_0x1fbe67[_0x96c9('0xa9')]===-0x1){return _0x1fbe67;}return this['channel']['noop'](util['format'](_0x96c9('0xc5'),_0x96c9('0x1b3'),_0x5abfb0));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x1b4')]=function(_0x130a3b){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x130a3b[_0x96c9('0x37')]));var _0x4df840=this[_0x96c9('0x5a')][_0x96c9('0x73')](this,_0x130a3b[_0x96c9('0xb9')]);this[_0x96c9('0x36')][_0x96c9('0x73')](this,_0x130a3b,_0x130a3b[_0x96c9('0xb9')]);if(this[_0x96c9('0x89')](_0x130a3b[_0x96c9('0xd6')])){var _0x19c551=this[_0x96c9('0x13')][_0x96c9('0x73')](this,_0x130a3b[_0x96c9('0xd6')]);if(_0x19c551){this[_0x96c9('0xf')]['setVariable'](_0x19c551,_0x4df840);return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x1b5'),_0x130a3b[_0x96c9('0xb9')],_0x19c551));}}return this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x130a3b[_0x96c9('0xb9')]));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x1b6')]=function(_0x4c1ab9){logger[_0x96c9('0x2c')](util['format'](_0x96c9('0x1b7'),_0x4c1ab9[_0x96c9('0x37')]));_0x4c1ab9[_0x96c9('0x61')]=_0x4c1ab9[_0x96c9('0x61')][_0x96c9('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x96c9('0x89')](_0x4c1ab9['apiKey'])){return this[_0x96c9('0xf')][_0x96c9('0xad')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x4c1ab9[_0x96c9('0x61')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xc8'));}this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')](_0x96c9('0x1b8'),_0x4c1ab9[_0x96c9('0x61')]));var _0x56bf14=this[_0x96c9('0x5e')][_0x96c9('0x73')](this,_0x4c1ab9);if(_0x56bf14){this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0x1b9'),_0x56bf14));var _0x35a7bb=this['channel'][_0x96c9('0xfe')](_0x56bf14);try{fs[_0x96c9('0xff')](_0x56bf14+_0x96c9('0x100'));}catch(_0x56fbe0){logger[_0x96c9('0x2b')](_0x56fbe0);}return _0x35a7bb;}return this[_0x96c9('0xf')]['error'](_0x4c1ab9,_0x96c9('0x1ba'));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x1bb')]=function(_0x5cdd39){logger['info'](util[_0x96c9('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5cdd39['label']));_0x5cdd39[_0x96c9('0x61')]=_0x5cdd39['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5cdd39[_0x96c9('0x61')])){return this[_0x96c9('0xf')][_0x96c9('0xad')](_0x96c9('0xc8'));}this['channel']['noop'](util[_0x96c9('0x27')](_0x96c9('0x1bc'),_0x5cdd39[_0x96c9('0x61')]));var _0x26eb2b=this['googleTTS'][_0x96c9('0x73')](this,_0x5cdd39);if(_0x26eb2b){this['channel']['noop'](util[_0x96c9('0x27')](_0x96c9('0x1bd'),_0x26eb2b));var _0x1eb41f=this['channel']['streamFile'](_0x26eb2b);try{fs['unlink'](_0x26eb2b+_0x96c9('0x100'));}catch(_0x18cc67){logger[_0x96c9('0x2b')](_0x18cc67);}return _0x1eb41f;}return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x5cdd39,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x96c9('0x12')]['unpause']=function(_0x1f5b5d){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x1be'),_0x1f5b5d['label']));if(!this[_0x96c9('0x89')](_0x1f5b5d['findBy'])){return this[_0x96c9('0xf')]['error'](_0x1f5b5d,_0x96c9('0x152'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x1f5b5d['findBy']));var _0x5eda0f=this[_0x96c9('0x55')][_0x96c9('0x73')](this,_0x1f5b5d[_0x96c9('0x151')]);if(_0x5eda0f){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x1f5b5d[_0x96c9('0x151')]));this[_0x96c9('0xf')]['noop'](util[_0x96c9('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x96c9('0xf')]['callerid'],_0x1f5b5d[_0x96c9('0x151')]));return{'code':0xc8,'result':_0x96c9('0x163')};}else{logger[_0x96c9('0x2c')](util[_0x96c9('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x96c9('0xf')][_0x96c9('0x3a')],_0x1f5b5d[_0x96c9('0x151')]));this[_0x96c9('0xf')][_0x96c9('0xad')](util[_0x96c9('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x96c9('0x3a')],_0x1f5b5d['findBy']));return{'code':0xc8,'result':_0x96c9('0x155')};}};AGIVertices[_0x96c9('0x12')][_0x96c9('0x1bf')]=function(_0x2414b9){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x1c0'),_0x2414b9[_0x96c9('0x37')]));var _0x28d5c1=this[_0x96c9('0xf')][_0x96c9('0x5b')](_0x96c9('0x1c1'),[_0x2414b9[_0x96c9('0x1c2')],_0x2414b9[_0x96c9('0x7d')]]);if(_0x28d5c1[_0x96c9('0xa9')]===-0x1){return _0x28d5c1;}return this['channel'][_0x96c9('0xad')](util[_0x96c9('0x27')](_0x96c9('0xc5'),_0x96c9('0x1c1'),_0x2414b9[_0x96c9('0x1c2')]));};AGIVertices[_0x96c9('0x12')][_0x96c9('0x1c3')]=function(_0x2f5b02){logger[_0x96c9('0x2c')](util[_0x96c9('0x27')](_0x96c9('0x1c4'),_0x2f5b02[_0x96c9('0x37')]));if(!this['isConfigured'](_0x2f5b02['variable_id'])){return this[_0x96c9('0xf')][_0x96c9('0x2b')](_0x2f5b02,'no\x20variable\x20selected');}var _0x3631cd=this[_0x96c9('0x13')][_0x96c9('0x73')](this,_0x2f5b02[_0x96c9('0xd6')]);if(!_0x3631cd){return this['channel']['error'](_0x2f5b02,_0x96c9('0x116'));}var _0x58ba5e=this[_0x96c9('0xf')][_0x96c9('0x13')](_0x3631cd);return{'code':0xc8,'result':_0x58ba5e[_0x96c9('0xa7')]?_0x58ba5e[_0x96c9('0xa7')]:'-'};};String[_0x96c9('0x12')][_0x96c9('0xa6')]=function(_0x294d76,_0x57dce7){return this[_0x96c9('0xa4')](_0x294d76)[_0x96c9('0x1c5')](_0x57dce7);};module[_0x96c9('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2f48aca..1aad2a7 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 _0x95ee=['voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','lastPauseAt','format','update','uniqueid','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','then','getAgent'];(function(_0x2a6196,_0x1f2295){var _0x2b021e=function(_0x2143b6){while(--_0x2143b6){_0x2a6196['push'](_0x2a6196['shift']());}};_0x2b021e(++_0x1f2295);}(_0x95ee,0xd1));var _0xe95e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x95ee[_0xefd519];return _0x4bb882;};'use strict';var util=require(_0xe95e('0x0'));var _=require(_0xe95e('0x1'));var moment=require(_0xe95e('0x2'));var ami=require('../ami');var logger=require(_0xe95e('0x3'))(_0xe95e('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xe95e('0x5'));function Acw(_0x270aae){this[_0xe95e('0x6')]=_0x270aae[_0xe95e('0x6')];this[_0xe95e('0x7')]=_0x270aae[_0xe95e('0x7')];this[_0xe95e('0x8')]=_0x270aae['timers'];this[_0xe95e('0x9')]={};ami['on'](_0xe95e('0xa'),this[_0xe95e('0xb')][_0xe95e('0xc')](this));ami['on'](_0xe95e('0xd'),this[_0xe95e('0xe')][_0xe95e('0xc')](this));ami['on'](_0xe95e('0xf'),this['syncHangup'][_0xe95e('0xc')](this));ami['on']('agentringnoanswer',this[_0xe95e('0x10')][_0xe95e('0xc')](this));ami['on'](_0xe95e('0x11'),this[_0xe95e('0x12')][_0xe95e('0xc')](this));ami['on'](_0xe95e('0x13'),this['syncBlindTransfer'][_0xe95e('0xc')](this));ami['on'](_0xe95e('0x14'),this[_0xe95e('0x15')][_0xe95e('0xc')](this));}function getDiff(_0x532532){var _0x11d041=moment()[_0xe95e('0x16')](0x0);var _0xdd9e4f=moment(_0x532532)[_0xe95e('0x16')](0x0);return _0x11d041['diff'](_0xdd9e4f,_0xe95e('0x17'));}Acw['prototype'][_0xe95e('0x18')]=function(_0x459fc3){try{var _0x5a5e6d=this;var _0x3fc580=this[_0xe95e('0x9')][_0x459fc3][_0xe95e('0x19')];var _0x538ed8=this[_0xe95e('0x9')][_0x459fc3][_0xe95e('0x1a')];var _0x5b114e=this[_0xe95e('0x6')][_0x538ed8];var _0x24d9a2=![];var _0x2e5d58=_0xe95e('0x1b');if(_0x5b114e[_0xe95e('0x1c')]){if(_0x5b114e[_0xe95e('0x1d')]['name']){_0x24d9a2=!![];_0x2e5d58=_0x5b114e['mandatoryDispositionPause']['name'];}}ami[_0xe95e('0x1e')]({'action':_0xe95e('0x1f'),'interface':_0x3fc580,'paused':!![],'reason':_0x2e5d58})[_0xe95e('0x20')](function(_0x1c51ad){if(_0x5a5e6d['agents'][_0x3fc580]){return RpcUser[_0xe95e('0x21')](_0x5a5e6d[_0xe95e('0x7')][_0x3fc580]['id'])[_0xe95e('0x20')](function(_0x1e6094){if(_0x1e6094&&!_0x1e6094[_0xe95e('0x22')]){logger[_0xe95e('0x23')](_0xe95e('0x24'),_0x459fc3,_0x3fc580,_0x538ed8);var _0x1af1ac=_0x5a5e6d[_0xe95e('0x9')][_0x459fc3][_0xe95e('0x25')]&&_0x5a5e6d['channels'][_0x459fc3][_0xe95e('0x26')]?_0x5a5e6d[_0xe95e('0x9')][_0x459fc3][_0xe95e('0x26')]:_0x459fc3;return RpcUser['savePause'](_0x5a5e6d[_0xe95e('0x7')][_0x3fc580],_0x2e5d58,_0x1af1ac)[_0xe95e('0x20')](function(_0x16451d){if(!_0x24d9a2){_0x5a5e6d[_0xe95e('0x8')][_0x3fc580]={};logger[_0xe95e('0x23')](_0xe95e('0x27'),_0x459fc3,_0x5a5e6d[_0xe95e('0x6')][_0x538ed8]['acwTimeout'],_0x3fc580,_0x538ed8);_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x28')]=setTimeout(_0x5a5e6d[_0xe95e('0x29')][_0xe95e('0xc')](_0x5a5e6d,_0x3fc580),_0x5a5e6d[_0xe95e('0x6')][_0x538ed8]['acwTimeout']*0x3e8);_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x2a')]=moment()[_0xe95e('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a5e6d[_0xe95e('0x8')][_0x3fc580]['uniqueid']=_0x459fc3;_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x1a')]=_0x538ed8;_0x5a5e6d[_0xe95e('0x8')][_0x3fc580]['updateAcw']=function(){var _0x3cb6bf=getDiff(_0x5a5e6d['timers'][_0x3fc580][_0xe95e('0x2a')]);clearTimeout(_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x28')]);_0x5a5e6d['timers'][_0x3fc580][_0xe95e('0x28')]=![];RpcVoiceAgentReport[_0xe95e('0x2c')]({'acwtime':_0x3cb6bf},_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x2d')],_0x3fc580)[_0xe95e('0x20')](function(_0x5b5846){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x459fc3,_0x3cb6bf,_0x5b5846);})[_0xe95e('0x2e')](function(_0x13db51){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x459fc3,_0x13db51);});delete _0x5a5e6d[_0xe95e('0x8')][_0x3fc580];};}});}else{logger[_0xe95e('0x23')](_0xe95e('0x2f'),_0x459fc3,_0x3fc580,_0x538ed8);}});}})[_0xe95e('0x2e')](function(_0x300e02){logger['error'](_0xe95e('0x27'),_0x459fc3,_0x5a5e6d[_0xe95e('0x6')][_0x538ed8]['acwTimeout'],_0x3fc580,_0x538ed8);})['finally'](function(){delete _0x5a5e6d[_0xe95e('0x9')][_0x459fc3];});}catch(_0x2853ae){logger[_0xe95e('0x30')](_0xe95e('0x31'),_0x2853ae[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')][_0xe95e('0x29')]=function(_0x489fe1){try{var _0x4e168a=this;if(_0x4e168a['timers'][_0x489fe1]){_0x4e168a[_0xe95e('0x8')][_0x489fe1][_0xe95e('0x28')]=![];var _0x31f45b=_0x4e168a[_0xe95e('0x8')][_0x489fe1][_0xe95e('0x2d')];var _0xca9762=_0x4e168a[_0xe95e('0x8')][_0x489fe1]['queue'];var _0x3cb29c=_0x4e168a['voiceQueues'][_0xca9762]['acwTimeout'];logger[_0xe95e('0x23')](_0xe95e('0x34'),_0x31f45b,_0x489fe1);RpcUser[_0xe95e('0x35')](this[_0xe95e('0x7')][_0x489fe1]);RpcVoiceAgentReport['update']({'acwtime':_0x3cb29c,'agentacw':!![]},_0x31f45b,_0x489fe1)[_0xe95e('0x20')](function(_0x27183b){logger[_0xe95e('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x31f45b,_0x3cb29c,_0x27183b);})[_0xe95e('0x2e')](function(_0x4ed5a9){logger[_0xe95e('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x31f45b,_0x4ed5a9);});}else{logger[_0xe95e('0x30')](_0xe95e('0x36'),_0x489fe1);if(_0x4e168a['timers']){logger[_0xe95e('0x23')]('[ACW][TIMERS]',JSON[_0xe95e('0x37')](_0x4e168a[_0xe95e('0x8')]));}}}catch(_0xdcd95a){logger[_0xe95e('0x30')](_0xe95e('0x38'),_0xdcd95a['message']);}};Acw[_0xe95e('0x33')][_0xe95e('0xb')]=function(_0x36c7f4){try{if(this['voiceQueues'][_0x36c7f4[_0xe95e('0x1a')]]&&(this[_0xe95e('0x6')][_0x36c7f4[_0xe95e('0x1a')]][_0xe95e('0x4')]||this[_0xe95e('0x6')][_0x36c7f4[_0xe95e('0x1a')]][_0xe95e('0x1c')])){if(this[_0xe95e('0x7')][_0x36c7f4[_0xe95e('0x19')]]){this[_0xe95e('0x9')][_0x36c7f4[_0xe95e('0x2d')]]={'queue':_0x36c7f4[_0xe95e('0x1a')],'interface':_0x36c7f4[_0xe95e('0x19')],'destlinkedid':_0x36c7f4[_0xe95e('0x26')]};}}}catch(_0x287a9a){logger['error'](_0xe95e('0x39'),_0x287a9a[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')]['syncAgentConnectPreview']=function(_0x3bcf5f){try{if(this['voiceQueues'][_0x3bcf5f[_0xe95e('0x1a')]]&&(this[_0xe95e('0x6')][_0x3bcf5f[_0xe95e('0x1a')]][_0xe95e('0x4')]||this['voiceQueues'][_0x3bcf5f[_0xe95e('0x1a')]][_0xe95e('0x1c')])){if(this[_0xe95e('0x7')][_0x3bcf5f[_0xe95e('0x19')]]){this[_0xe95e('0x9')][_0x3bcf5f[_0xe95e('0x2d')]]={'queue':_0x3bcf5f[_0xe95e('0x1a')],'interface':_0x3bcf5f[_0xe95e('0x19')]};}}}catch(_0x1e621a){logger[_0xe95e('0x30')]('[ACW][syncAgentConnectPreview]\x20%s',_0x1e621a[_0xe95e('0x32')]);}};Acw['prototype'][_0xe95e('0xe')]=function(_0x480c3a){try{if(this[_0xe95e('0x9')][_0x480c3a[_0xe95e('0x2d')]]&&_[_0xe95e('0x3a')](this[_0xe95e('0x9')][_0x480c3a['uniqueid']]['attended'])){logger[_0xe95e('0x23')](_0xe95e('0x3b'),_0x480c3a[_0xe95e('0x2d')]);this[_0xe95e('0x18')](_0x480c3a[_0xe95e('0x2d')]);}else if(this[_0xe95e('0x9')][_0x480c3a[_0xe95e('0x3c')]]&&_[_0xe95e('0x3a')](this['channels'][_0x480c3a[_0xe95e('0x3c')]]['attended'])){logger[_0xe95e('0x23')](_0xe95e('0x3d'),_0x480c3a[_0xe95e('0x3c')]);this[_0xe95e('0x18')](_0x480c3a['linkedid']);}}catch(_0x24fa2d){logger[_0xe95e('0x30')](_0xe95e('0x3e'),_0x24fa2d[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')][_0xe95e('0x3f')]=function(_0x164306){try{if(this[_0xe95e('0x9')][_0x164306['uniqueid']]&&this[_0xe95e('0x9')][_0x164306[_0xe95e('0x2d')]][_0xe95e('0x25')]){logger[_0xe95e('0x23')](_0xe95e('0x40'),_0x164306[_0xe95e('0x2d')]);this[_0xe95e('0x18')](_0x164306[_0xe95e('0x2d')]);}else if(this[_0xe95e('0x9')][_0x164306[_0xe95e('0x3c')]]&&this[_0xe95e('0x9')][_0x164306[_0xe95e('0x3c')]][_0xe95e('0x25')]){logger[_0xe95e('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x164306[_0xe95e('0x3c')]);this[_0xe95e('0x18')](_0x164306[_0xe95e('0x3c')]);}}catch(_0x339dda){logger['error'](_0xe95e('0x41'),_0x339dda[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')]['syncAttendedTransfer']=function(_0x3bff92){try{if(!_[_0xe95e('0x42')](this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x43')]])){this[_0xe95e('0x18')](_0x3bff92[_0xe95e('0x43')]);if(this[_0xe95e('0x9')][_0x3bff92['secondtransfereruniqueid']]){this[_0xe95e('0x9')][_0x3bff92['secondtransfereruniqueid']][_0xe95e('0x25')]=!![];this[_0xe95e('0x9')][_0x3bff92['transfertargetuniqueid']]=this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x44')]];delete this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x44')]];}}else if(!_['isNil'](this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x45')]])){this[_0xe95e('0x18')](_0x3bff92['transfertargetuniqueid']);if(this[_0xe95e('0x9')][_0x3bff92['origtransfereruniqueid']]){this[_0xe95e('0x9')][_0x3bff92['origtransfereruniqueid']][_0xe95e('0x25')]=!![];this[_0xe95e('0x9')][_0x3bff92['transfereeuniqueid']]=this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x46')]];delete this[_0xe95e('0x9')][_0x3bff92['origtransfereruniqueid']];}}}catch(_0x34bf23){logger[_0xe95e('0x30')](_0xe95e('0x47'),_0x34bf23[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')]['syncBlindTransfer']=function(_0x3c2bd4){try{if(this['channels'][_0x3c2bd4[_0xe95e('0x48')]]){logger[_0xe95e('0x23')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xe95e('0x37')](_0x3c2bd4[_0xe95e('0x48')]));this[_0xe95e('0x18')](_0x3c2bd4[_0xe95e('0x48')]);}else if(this[_0xe95e('0x9')][_0x3c2bd4[_0xe95e('0x49')]]){logger[_0xe95e('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xe95e('0x37')](_0x3c2bd4['transfererlinkedid']));this['startAcw'](_0x3c2bd4[_0xe95e('0x49')]);}}catch(_0x38fff3){logger[_0xe95e('0x30')](_0xe95e('0x4a'),_0x38fff3[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')][_0xe95e('0x10')]=function(_0x5ace82){try{if(this[_0xe95e('0x6')][_0x5ace82['queue']]&&this['voiceQueues'][_0x5ace82[_0xe95e('0x1a')]][_0xe95e('0x4b')]==='all'){if(this[_0xe95e('0x7')][_0x5ace82[_0xe95e('0x19')]]){logger['info'](_0xe95e('0x4c'),_0x5ace82['uniqueid'],_0x5ace82[_0xe95e('0x19')],_0x5ace82[_0xe95e('0x1a')]);return RpcUser[_0xe95e('0x4d')](this[_0xe95e('0x7')][_0x5ace82[_0xe95e('0x19')]],_0xe95e('0x4e'),_0x5ace82[_0xe95e('0x2d')]);}}}catch(_0x103aa6){logger[_0xe95e('0x30')](_0xe95e('0x4f'),_0x103aa6['message']);}};module[_0xe95e('0x50')]=Acw; \ No newline at end of file +var _0x4c35=['lodash','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','bind','hanguprequest','syncHangupRequest','syncHangup','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','startAcw','channels','interface','queue','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util'];(function(_0x3cdd72,_0x80d6d6){var _0x5d2e31=function(_0x210caa){while(--_0x210caa){_0x3cdd72['push'](_0x3cdd72['shift']());}};_0x5d2e31(++_0x80d6d6);}(_0x4c35,0xf5));var _0x54c3=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0x4c35[_0xd02bb];return _0x1cdf23;};'use strict';var util=require(_0x54c3('0x0'));var _=require(_0x54c3('0x1'));var moment=require(_0x54c3('0x2'));var ami=require(_0x54c3('0x3'));var logger=require('../../../config/logger')(_0x54c3('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x54c3('0x5'));function Acw(_0x16f0e8){this['voiceQueues']=_0x16f0e8[_0x54c3('0x6')];this[_0x54c3('0x7')]=_0x16f0e8[_0x54c3('0x7')];this[_0x54c3('0x8')]=_0x16f0e8[_0x54c3('0x8')];this['channels']={};ami['on']('agentconnect',this['syncAgentConnect'][_0x54c3('0x9')](this));ami['on'](_0x54c3('0xa'),this[_0x54c3('0xb')][_0x54c3('0x9')](this));ami['on']('hangup',this[_0x54c3('0xc')][_0x54c3('0x9')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x54c3('0x9')](this));ami['on']('attendedtransfer',this[_0x54c3('0xd')][_0x54c3('0x9')](this));ami['on'](_0x54c3('0xe'),this[_0x54c3('0xf')][_0x54c3('0x9')](this));ami['on'](_0x54c3('0x10'),this['syncAgentConnectPreview'][_0x54c3('0x9')](this));}function getDiff(_0x4fb17a){var _0x83966a=moment()['milliseconds'](0x0);var _0x43e6d5=moment(_0x4fb17a)[_0x54c3('0x11')](0x0);return _0x83966a['diff'](_0x43e6d5,_0x54c3('0x12'));}Acw[_0x54c3('0x13')][_0x54c3('0x14')]=function(_0x419bc5){try{var _0x47754c=this;var _0x4d022f=this[_0x54c3('0x15')][_0x419bc5][_0x54c3('0x16')];var _0x1631a8=this[_0x54c3('0x15')][_0x419bc5][_0x54c3('0x17')];var _0x34429a=this[_0x54c3('0x6')][_0x1631a8];var _0x390178=![];var _0x159000='ACW';if(_0x34429a['mandatoryDisposition']){if(_0x34429a[_0x54c3('0x18')][_0x54c3('0x19')]){_0x390178=!![];_0x159000=_0x34429a[_0x54c3('0x18')][_0x54c3('0x19')];}}ami[_0x54c3('0x1a')]({'action':_0x54c3('0x1b'),'interface':_0x4d022f,'paused':!![],'reason':_0x159000})[_0x54c3('0x1c')](function(_0x1084bf){if(_0x47754c[_0x54c3('0x7')][_0x4d022f]){return RpcUser[_0x54c3('0x1d')](_0x47754c[_0x54c3('0x7')][_0x4d022f]['id'])[_0x54c3('0x1c')](function(_0x1265b6){if(_0x1265b6&&!_0x1265b6[_0x54c3('0x1e')]){logger['info'](_0x54c3('0x1f'),_0x419bc5,_0x4d022f,_0x1631a8);var _0x1cd2d3=_0x47754c['channels'][_0x419bc5][_0x54c3('0x20')]&&_0x47754c[_0x54c3('0x15')][_0x419bc5][_0x54c3('0x21')]?_0x47754c[_0x54c3('0x15')][_0x419bc5]['destlinkedid']:_0x419bc5;return RpcUser[_0x54c3('0x22')](_0x47754c['agents'][_0x4d022f],_0x159000,_0x1cd2d3)[_0x54c3('0x1c')](function(_0x49ed4f){if(!_0x390178){_0x47754c['timers'][_0x4d022f]={};logger['info'](_0x54c3('0x23'),_0x419bc5,_0x47754c[_0x54c3('0x6')][_0x1631a8][_0x54c3('0x24')],_0x4d022f,_0x1631a8);_0x47754c[_0x54c3('0x8')][_0x4d022f][_0x54c3('0x25')]=setTimeout(_0x47754c[_0x54c3('0x26')][_0x54c3('0x9')](_0x47754c,_0x4d022f),_0x47754c['voiceQueues'][_0x1631a8][_0x54c3('0x24')]*0x3e8);_0x47754c['timers'][_0x4d022f][_0x54c3('0x27')]=moment()[_0x54c3('0x28')](_0x54c3('0x29'));_0x47754c['timers'][_0x4d022f][_0x54c3('0x2a')]=_0x419bc5;_0x47754c[_0x54c3('0x8')][_0x4d022f][_0x54c3('0x17')]=_0x1631a8;_0x47754c['timers'][_0x4d022f][_0x54c3('0x2b')]=function(){var _0x50a046=getDiff(_0x47754c[_0x54c3('0x8')][_0x4d022f][_0x54c3('0x27')]);clearTimeout(_0x47754c['timers'][_0x4d022f][_0x54c3('0x25')]);_0x47754c[_0x54c3('0x8')][_0x4d022f][_0x54c3('0x25')]=![];RpcVoiceAgentReport[_0x54c3('0x2c')]({'acwtime':_0x50a046},_0x47754c['timers'][_0x4d022f][_0x54c3('0x2a')],_0x4d022f)[_0x54c3('0x1c')](function(_0x5968d9){logger[_0x54c3('0x2d')](_0x54c3('0x2e'),_0x419bc5,_0x50a046,_0x5968d9);})[_0x54c3('0x2f')](function(_0x5c4b8e){logger[_0x54c3('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x419bc5,_0x5c4b8e);});delete _0x47754c[_0x54c3('0x8')][_0x4d022f];};}});}else{logger['info'](_0x54c3('0x31'),_0x419bc5,_0x4d022f,_0x1631a8);}});}})[_0x54c3('0x2f')](function(_0x47b666){logger[_0x54c3('0x30')](_0x54c3('0x23'),_0x419bc5,_0x47754c[_0x54c3('0x6')][_0x1631a8]['acwTimeout'],_0x4d022f,_0x1631a8);})[_0x54c3('0x32')](function(){delete _0x47754c[_0x54c3('0x15')][_0x419bc5];});}catch(_0x3f1190){logger['error'](_0x54c3('0x33'),_0x3f1190['message']);}};Acw[_0x54c3('0x13')]['stopAcw']=function(_0x3120d6){try{var _0x3b62be=this;if(_0x3b62be[_0x54c3('0x8')][_0x3120d6]){_0x3b62be[_0x54c3('0x8')][_0x3120d6][_0x54c3('0x25')]=![];var _0x582193=_0x3b62be[_0x54c3('0x8')][_0x3120d6][_0x54c3('0x2a')];var _0x45d881=_0x3b62be['timers'][_0x3120d6]['queue'];var _0x251298=_0x3b62be[_0x54c3('0x6')][_0x45d881][_0x54c3('0x24')];logger[_0x54c3('0x2d')]('[%s][TIMER][STOP][AGENT:%s]',_0x582193,_0x3120d6);RpcUser[_0x54c3('0x34')](this[_0x54c3('0x7')][_0x3120d6]);RpcVoiceAgentReport[_0x54c3('0x2c')]({'acwtime':_0x251298,'agentacw':!![]},_0x582193,_0x3120d6)[_0x54c3('0x1c')](function(_0x136906){logger[_0x54c3('0x2d')](_0x54c3('0x2e'),_0x582193,_0x251298,_0x136906);})[_0x54c3('0x2f')](function(_0x457e5b){logger[_0x54c3('0x30')](_0x54c3('0x35'),_0x582193,_0x457e5b);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x3120d6);if(_0x3b62be['timers']){logger[_0x54c3('0x2d')](_0x54c3('0x36'),JSON[_0x54c3('0x37')](_0x3b62be[_0x54c3('0x8')]));}}}catch(_0x39e7d7){logger[_0x54c3('0x30')](_0x54c3('0x38'),_0x39e7d7[_0x54c3('0x39')]);}};Acw[_0x54c3('0x13')][_0x54c3('0x3a')]=function(_0x11e47a){try{if(this[_0x54c3('0x6')][_0x11e47a[_0x54c3('0x17')]]&&(this['voiceQueues'][_0x11e47a[_0x54c3('0x17')]][_0x54c3('0x4')]||this[_0x54c3('0x6')][_0x11e47a[_0x54c3('0x17')]][_0x54c3('0x3b')])){if(this[_0x54c3('0x7')][_0x11e47a[_0x54c3('0x16')]]){this['channels'][_0x11e47a['uniqueid']]={'queue':_0x11e47a[_0x54c3('0x17')],'interface':_0x11e47a['interface'],'destlinkedid':_0x11e47a[_0x54c3('0x21')]};}}}catch(_0x64e72a){logger[_0x54c3('0x30')](_0x54c3('0x3c'),_0x64e72a['message']);}};Acw[_0x54c3('0x13')]['syncAgentConnectPreview']=function(_0x28f3a5){try{if(this[_0x54c3('0x6')][_0x28f3a5[_0x54c3('0x17')]]&&(this[_0x54c3('0x6')][_0x28f3a5['queue']]['acw']||this[_0x54c3('0x6')][_0x28f3a5['queue']][_0x54c3('0x3b')])){if(this[_0x54c3('0x7')][_0x28f3a5[_0x54c3('0x16')]]){this[_0x54c3('0x15')][_0x28f3a5[_0x54c3('0x2a')]]={'queue':_0x28f3a5[_0x54c3('0x17')],'interface':_0x28f3a5[_0x54c3('0x16')]};}}}catch(_0x59cc69){logger['error'](_0x54c3('0x3d'),_0x59cc69['message']);}};Acw[_0x54c3('0x13')][_0x54c3('0xb')]=function(_0x482a72){try{if(this['channels'][_0x482a72[_0x54c3('0x2a')]]&&_[_0x54c3('0x3e')](this[_0x54c3('0x15')][_0x482a72[_0x54c3('0x2a')]][_0x54c3('0x20')])){logger[_0x54c3('0x2d')]('[%s][HANGUP:UNIQUEID]',_0x482a72['uniqueid']);this[_0x54c3('0x14')](_0x482a72[_0x54c3('0x2a')]);}else if(this['channels'][_0x482a72[_0x54c3('0x3f')]]&&_[_0x54c3('0x3e')](this[_0x54c3('0x15')][_0x482a72[_0x54c3('0x3f')]][_0x54c3('0x20')])){logger[_0x54c3('0x2d')]('[%s][HANGUP:LINKEDID]',_0x482a72[_0x54c3('0x3f')]);this[_0x54c3('0x14')](_0x482a72[_0x54c3('0x3f')]);}}catch(_0x17a65d){logger[_0x54c3('0x30')](_0x54c3('0x40'),_0x17a65d[_0x54c3('0x39')]);}};Acw[_0x54c3('0x13')][_0x54c3('0xc')]=function(_0x27f80){try{if(this['channels'][_0x27f80['uniqueid']]&&this[_0x54c3('0x15')][_0x27f80['uniqueid']][_0x54c3('0x20')]){logger[_0x54c3('0x2d')](_0x54c3('0x41'),_0x27f80['uniqueid']);this[_0x54c3('0x14')](_0x27f80[_0x54c3('0x2a')]);}else if(this[_0x54c3('0x15')][_0x27f80[_0x54c3('0x3f')]]&&this[_0x54c3('0x15')][_0x27f80[_0x54c3('0x3f')]][_0x54c3('0x20')]){logger[_0x54c3('0x2d')](_0x54c3('0x42'),_0x27f80['linkedid']);this[_0x54c3('0x14')](_0x27f80['linkedid']);}}catch(_0x2bb28c){logger[_0x54c3('0x30')](_0x54c3('0x43'),_0x2bb28c['message']);}};Acw['prototype']['syncAttendedTransfer']=function(_0xbc426e){try{if(!_[_0x54c3('0x44')](this[_0x54c3('0x15')][_0xbc426e[_0x54c3('0x45')]])){this[_0x54c3('0x14')](_0xbc426e[_0x54c3('0x45')]);if(this[_0x54c3('0x15')][_0xbc426e[_0x54c3('0x46')]]){this[_0x54c3('0x15')][_0xbc426e[_0x54c3('0x46')]][_0x54c3('0x20')]=!![];this[_0x54c3('0x15')][_0xbc426e['transfertargetuniqueid']]=this[_0x54c3('0x15')][_0xbc426e['secondtransfereruniqueid']];delete this[_0x54c3('0x15')][_0xbc426e[_0x54c3('0x46')]];}}else if(!_[_0x54c3('0x44')](this[_0x54c3('0x15')][_0xbc426e[_0x54c3('0x47')]])){this[_0x54c3('0x14')](_0xbc426e[_0x54c3('0x47')]);if(this[_0x54c3('0x15')][_0xbc426e[_0x54c3('0x48')]]){this[_0x54c3('0x15')][_0xbc426e[_0x54c3('0x48')]][_0x54c3('0x20')]=!![];this[_0x54c3('0x15')][_0xbc426e[_0x54c3('0x45')]]=this[_0x54c3('0x15')][_0xbc426e[_0x54c3('0x48')]];delete this[_0x54c3('0x15')][_0xbc426e['origtransfereruniqueid']];}}}catch(_0xd9478d){logger[_0x54c3('0x30')]('[ACW][syncAttendedTransfer]\x20%s',_0xd9478d['message']);}};Acw[_0x54c3('0x13')][_0x54c3('0xf')]=function(_0x1c5af2){try{if(this['channels'][_0x1c5af2[_0x54c3('0x49')]]){logger[_0x54c3('0x2d')](_0x54c3('0x4a'),JSON[_0x54c3('0x37')](_0x1c5af2[_0x54c3('0x49')]));this[_0x54c3('0x14')](_0x1c5af2[_0x54c3('0x49')]);}else if(this['channels'][_0x1c5af2['transfererlinkedid']]){logger[_0x54c3('0x2d')](_0x54c3('0x4b'),JSON['stringify'](_0x1c5af2['transfererlinkedid']));this[_0x54c3('0x14')](_0x1c5af2[_0x54c3('0x4c')]);}}catch(_0x294096){logger[_0x54c3('0x30')](_0x54c3('0x4d'),_0x294096[_0x54c3('0x39')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x30a3be){try{if(this[_0x54c3('0x6')][_0x30a3be[_0x54c3('0x17')]]&&this[_0x54c3('0x6')][_0x30a3be[_0x54c3('0x17')]]['autopause']==='all'){if(this[_0x54c3('0x7')][_0x30a3be[_0x54c3('0x16')]]){logger[_0x54c3('0x2d')](_0x54c3('0x4e'),_0x30a3be['uniqueid'],_0x30a3be[_0x54c3('0x16')],_0x30a3be[_0x54c3('0x17')]);return RpcUser[_0x54c3('0x22')](this['agents'][_0x30a3be[_0x54c3('0x16')]],_0x54c3('0x4f'),_0x30a3be[_0x54c3('0x2a')]);}}}catch(_0x269a40){logger[_0x54c3('0x30')](_0x54c3('0x50'),_0x269a40[_0x54c3('0x39')]);}};module[_0x54c3('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 4ab5f8d..e49b5fe 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 _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x189cf1,_0x16ba19){var _0x1d2f50=function(_0x5aa8e5){while(--_0x5aa8e5){_0x189cf1['push'](_0x189cf1['shift']());}};_0x1d2f50(++_0x16ba19);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file +var _0x0713=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','exports','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error'];(function(_0x3cb52a,_0x5a586d){var _0x4e6bab=function(_0xd38f5){while(--_0xd38f5){_0x3cb52a['push'](_0x3cb52a['shift']());}};_0x4e6bab(++_0x5a586d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var _=require(_0x3071('0x2'));var logger=require(_0x3071('0x3'))(_0x3071('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x3071('0x5')][_0x3071('0x6')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')][_0x3071('0x8')],!![]);ami[_0x3071('0x9')]();ami[_0x3071('0xa')]=BPromise[_0x3071('0xb')](ami[_0x3071('0xc')]);function error(_0x2fce7a){logger[_0x3071('0xd')](util['format'](_0x3071('0xe'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')]['port'],util[_0x3071('0xf')](_0x2fce7a,![],null)));}function close(){logger[_0x3071('0xd')](util[_0x3071('0x10')](_0x3071('0x11'),config[_0x3071('0x5')]['username'],config['asterisk']['ip'],config[_0x3071('0x5')]['port']));}ami[_0x3071('0x12')]=function(){return function(){return ami[_0x3071('0xa')]({'action':'sipshowregistry'});};};ami[_0x3071('0x13')]=function(){return function(){return ami['Action']({'action':_0x3071('0x14')});};};ami[_0x3071('0x15')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x16')});};};ami[_0x3071('0x17')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x18')});};};ami[_0x3071('0x19')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x1a')});};};function connect(_0x5f3c22){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x1c'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));ami['once'](_0x3071('0xd'),error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0x3071('0x1f'),function(_0x5cd80d){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x20'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')],util['inspect'](_0x5cd80d,![],null)));});ami['on']('fullybooted',function(_0x2ce48a){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x21'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));return BPromise['resolve']()[_0x3071('0x22')](ami[_0x3071('0x12')]())[_0x3071('0x22')](ami['actionDeviceStateList']())[_0x3071('0x22')](ami[_0x3071('0x15')]())[_0x3071('0x22')](ami[_0x3071('0x17')]())[_0x3071('0x22')](ami[_0x3071('0x19')]())[_0x3071('0x23')](function(_0x3921a1){logger[_0x3071('0xd')](_0x3071('0x24'),util[_0x3071('0xf')](_0x3921a1,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);module[_0x3071('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 2f854de..24135ba 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x2369aa,_0x49de68){var _0x17ecf3=function(_0x3c3bd2){while(--_0x3c3bd2){_0x2369aa['push'](_0x2369aa['shift']());}};_0x17ecf3(++_0x49de68);}(_0xaa88,0x137));var _0x8aa8=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0xaa88[_0x3e32a8];return _0x2997b0;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 3ab99f8..c945523 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 _0xe1fd=['queue','util','lodash','string','isNil','uniqueid','name','Contact','firstName','number','phone','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xe1fd,0xf7));var _0xde1f=function(_0xc221ab,_0x10ab19){_0xc221ab=_0xc221ab-0x0;var _0x5267bc=_0xe1fd[_0xc221ab];return _0x5267bc;};'use strict';var util=require(_0xde1f('0x0'));var _=require(_0xde1f('0x1'));var moment=require('moment');function checkNameSurname(_0x3b553b,_0x22f775,_0x35c3e8){var _0x45f682='';if(!_['isNil'](_0x22f775)&&_0xde1f('0x2')===typeof _0x22f775){_0x45f682+=_0x22f775;}if(!_[_0xde1f('0x3')](_0x35c3e8)&&_0xde1f('0x2')===typeof _0x35c3e8){_0x45f682+='\x20'+_0x35c3e8;}if(_0x45f682!==''){return _0x45f682;}return _0x3b553b;}function Action(_0x302b14,_0x4ed7e2,_0x5bce56){this['voiceQueue']=_0x302b14;this[_0xde1f('0x4')]=_0x5bce56||undefined;this[_0xde1f('0x5')]=checkNameSurname(_0x4ed7e2[_0xde1f('0x6')]['phone'],_0x4ed7e2['Contact'][_0xde1f('0x7')],_0x4ed7e2[_0xde1f('0x6')]['lastName']);this[_0xde1f('0x8')]=_0x4ed7e2['Contact'][_0xde1f('0x9')];this['queue']=_0x302b14[_0xde1f('0x5')];this['active']=_0x4ed7e2['active']||![];this[_0xde1f('0xa')]=_0x302b14['type'];this[_0xde1f('0xb')]=_0x302b14['dialQueueTimeout']||0x3;this[_0xde1f('0xc')]=_0x4ed7e2['scheduledat'];this['countbusyretry']=_0x4ed7e2[_0xde1f('0xd')];this['countcongestionretry']=_0x4ed7e2[_0xde1f('0xe')];this[_0xde1f('0xf')]=_0x4ed7e2['countnoanswerretry'];this[_0xde1f('0x10')]=_0x4ed7e2['countnosuchnumberretry'];this['countdropretry']=_0x4ed7e2['countdropretry'];this[_0xde1f('0x11')]=_0x4ed7e2[_0xde1f('0x11')];this[_0xde1f('0x12')]=_0x4ed7e2[_0xde1f('0x12')];this[_0xde1f('0x13')]=_0x4ed7e2[_0xde1f('0x13')];this[_0xde1f('0x14')]=_0x4ed7e2[_0xde1f('0x14')];this[_0xde1f('0x15')]=_0x4ed7e2['ListId'];this[_0xde1f('0x16')]=_0x4ed7e2[_0xde1f('0x16')];this['VoiceQueueId']=_0x4ed7e2[_0xde1f('0x17')];this[_0xde1f('0x18')]=_0x4ed7e2[_0xde1f('0x18')];this['idHopper']=_0x4ed7e2['id'];this[_0xde1f('0x19')]=_0x4ed7e2['Contact'][_0xde1f('0x7')]||'';this[_0xde1f('0x1a')]=moment()[_0xde1f('0x1b')](_0xde1f('0x1c'));this[_0xde1f('0x1d')]=_0x4ed7e2[_0xde1f('0x1d')];this[_0xde1f('0x1e')]=_0x4ed7e2[_0xde1f('0x1e')];this[_0xde1f('0x1f')]=_0x4ed7e2[_0xde1f('0x1f')];this[_0xde1f('0x20')]=_0x4ed7e2['recallme'];this['originatecalleridnum']='';this[_0xde1f('0x21')]='';}Action[_0xde1f('0x22')]['getCaller']=function(){return util['format'](_0xde1f('0x23'),this['name'],this[_0xde1f('0x24')][_0xde1f('0x25')]>0x0?this[_0xde1f('0x8')][_0xde1f('0x26')](this[_0xde1f('0x24')][_0xde1f('0x25')]):this[_0xde1f('0x8')]);};Action[_0xde1f('0x22')][_0xde1f('0x27')]=function(){return this[_0xde1f('0x28')];};module['exports']=Action; \ No newline at end of file +var _0x8672=['scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','voiceQueue','getQueue','queue','exports','util','lodash','moment','isNil','string','uniqueid','Contact','phone','lastName','name','active','type','dialQueueTimeout'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x8672,0x17f));var _0x2867=function(_0x8e076d,_0x4ace21){_0x8e076d=_0x8e076d-0x0;var _0x323059=_0x8672[_0x8e076d];return _0x323059;};'use strict';var util=require(_0x2867('0x0'));var _=require(_0x2867('0x1'));var moment=require(_0x2867('0x2'));function checkNameSurname(_0x1c54f4,_0xfd16ae,_0x3adeea){var _0x3e3530='';if(!_[_0x2867('0x3')](_0xfd16ae)&&_0x2867('0x4')===typeof _0xfd16ae){_0x3e3530+=_0xfd16ae;}if(!_[_0x2867('0x3')](_0x3adeea)&&'string'===typeof _0x3adeea){_0x3e3530+='\x20'+_0x3adeea;}if(_0x3e3530!==''){return _0x3e3530;}return _0x1c54f4;}function Action(_0x4371be,_0x35d734,_0x588dea){this['voiceQueue']=_0x4371be;this[_0x2867('0x5')]=_0x588dea||undefined;this['name']=checkNameSurname(_0x35d734[_0x2867('0x6')][_0x2867('0x7')],_0x35d734[_0x2867('0x6')]['firstName'],_0x35d734['Contact'][_0x2867('0x8')]);this['number']=_0x35d734[_0x2867('0x6')][_0x2867('0x7')];this['queue']=_0x4371be[_0x2867('0x9')];this['active']=_0x35d734[_0x2867('0xa')]||![];this[_0x2867('0xb')]=_0x4371be[_0x2867('0xb')];this['dialQueueTimeout']=_0x4371be[_0x2867('0xc')]||0x3;this[_0x2867('0xd')]=_0x35d734[_0x2867('0xd')];this['countbusyretry']=_0x35d734['countbusyretry'];this[_0x2867('0xe')]=_0x35d734[_0x2867('0xe')];this['countnoanswerretry']=_0x35d734[_0x2867('0xf')];this[_0x2867('0x10')]=_0x35d734['countnosuchnumberretry'];this['countdropretry']=_0x35d734[_0x2867('0x11')];this[_0x2867('0x12')]=_0x35d734[_0x2867('0x12')];this[_0x2867('0x13')]=_0x35d734[_0x2867('0x13')];this[_0x2867('0x14')]=_0x35d734['countagentrejectretry'];this['ContactId']=_0x35d734['ContactId'];this['ListId']=_0x35d734[_0x2867('0x15')];this[_0x2867('0x16')]=_0x35d734[_0x2867('0x16')];this['VoiceQueueId']=_0x35d734[_0x2867('0x17')];this['CampaignId']=_0x35d734['CampaignId'];this['idHopper']=_0x35d734['id'];this[_0x2867('0x18')]=_0x35d734[_0x2867('0x6')][_0x2867('0x19')]||'';this[_0x2867('0x1a')]=moment()[_0x2867('0x1b')](_0x2867('0x1c'));this[_0x2867('0x1d')]=_0x35d734['callback'];this[_0x2867('0x1e')]=_0x35d734[_0x2867('0x1e')];this[_0x2867('0x1f')]=_0x35d734['callbackat'];this[_0x2867('0x20')]=_0x35d734[_0x2867('0x20')];this[_0x2867('0x21')]='';this['originatecalleridname']='';}Action[_0x2867('0x22')][_0x2867('0x23')]=function(){return util[_0x2867('0x1b')](_0x2867('0x24'),this[_0x2867('0x9')],this['voiceQueue'][_0x2867('0x25')]>0x0?this[_0x2867('0x26')][_0x2867('0x27')](this[_0x2867('0x28')]['dialCutDigit']):this['number']);};Action[_0x2867('0x22')][_0x2867('0x29')]=function(){return this[_0x2867('0x2a')];};module[_0x2867('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 1e5128c..f3a1b2a 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 _0x26f2=['countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x33f750,_0x3a0638){var _0xd2186a=function(_0x20b011){while(--_0x20b011){_0x33f750['push'](_0x33f750['shift']());}};_0xd2186a(++_0x3a0638);}(_0x26f2,0xa3));var _0x226f=function(_0x11a7a1,_0x1c29fc){_0x11a7a1=_0x11a7a1-0x0;var _0x434912=_0x26f2[_0x11a7a1];return _0x434912;};'use strict';var util=require(_0x226f('0x0'));var _=require(_0x226f('0x1'));var moment=require(_0x226f('0x2'));function getSeconds(_0x48d143,_0x5bf578){var _0x292ac2=moment(_0x48d143)[_0x226f('0x3')](0x0);var _0xe0e584=moment(_0x5bf578)[_0x226f('0x3')](0x0);return _0x292ac2['diff'](_0xe0e584,_0x226f('0x4'));}function AgentComplete(_0x3ef4f5,_0x52ba7f){this[_0x226f('0x5')]=0x4;this[_0x226f('0x6')]='Answer';this[_0x226f('0x7')]=_0x3ef4f5[_0x226f('0x7')];this['type']=_0x3ef4f5[_0x226f('0x8')];this[_0x226f('0x9')]=_0x3ef4f5['type']===_0x226f('0xa')?_0x226f('0xb'):_0x3ef4f5[_0x226f('0x8')];this[_0x226f('0xc')]=_0x3ef4f5['countbusyretry'];this['countcongestionretry']=_0x3ef4f5[_0x226f('0xd')];this[_0x226f('0xe')]=_0x3ef4f5[_0x226f('0xe')];this['countglobal']=_0x3ef4f5['countbusyretry']+_0x3ef4f5['countcongestionretry']+_0x3ef4f5['countnoanswerretry']+_0x3ef4f5['countnosuchnumberretry']+_0x3ef4f5['countdropretry']+_0x3ef4f5[_0x226f('0xf')]+_0x3ef4f5[_0x226f('0x10')]+_0x3ef4f5[_0x226f('0x11')];this['countnosuchnumberretry']=_0x3ef4f5[_0x226f('0x12')];this['countdropretry']=_0x3ef4f5[_0x226f('0x13')];this[_0x226f('0xf')]=_0x3ef4f5[_0x226f('0xf')];this[_0x226f('0x10')]=_0x3ef4f5[_0x226f('0x10')];this['countagentrejectretry']=_0x3ef4f5[_0x226f('0x11')];this['uniqueid']=_0x52ba7f[_0x226f('0x14')];this[_0x226f('0x15')]=_0x3ef4f5[_0x226f('0x16')];this['calleridnum']=_0x3ef4f5[_0x226f('0x17')];this['starttime']=_0x3ef4f5[_0x226f('0x18')];this['responsetime']=_0x3ef4f5[_0x226f('0x19')];this[_0x226f('0x1a')]=_0x3ef4f5[_0x226f('0x1a')];this['endtime']=moment()[_0x226f('0x1b')](_0x226f('0x1c'));this[_0x226f('0x1d')]=getSeconds(_0x3ef4f5[_0x226f('0x19')],_0x3ef4f5['starttime']);this[_0x226f('0x1e')]=getSeconds(_0x3ef4f5[_0x226f('0x1a')],_0x3ef4f5[_0x226f('0x19')]);this['talktime']=getSeconds(this['endtime'],_0x3ef4f5[_0x226f('0x1a')]);this[_0x226f('0xb')]=_0x52ba7f[_0x226f('0xb')];this[_0x226f('0x1f')]=_0x52ba7f[_0x226f('0x1f')];this[_0x226f('0x20')]=_0x52ba7f[_0x226f('0x20')];this['callback']=_0x3ef4f5[_0x226f('0x21')];this[_0x226f('0x22')]=_0x3ef4f5[_0x226f('0x22')];this[_0x226f('0x23')]=_0x3ef4f5[_0x226f('0x23')];this[_0x226f('0x24')]=_0x3ef4f5[_0x226f('0x24')];this[_0x226f('0x25')]=_0x3ef4f5[_0x226f('0x25')];this[_0x226f('0x26')]=_0x3ef4f5[_0x226f('0x26')];this['UserId']=_0x3ef4f5[_0x226f('0x27')];this[_0x226f('0x28')]=_0x3ef4f5[_0x226f('0x28')];this['CampaignId']=_0x3ef4f5[_0x226f('0x29')];this[_0x226f('0x2a')]=_0x3ef4f5[_0x226f('0x2a')]||'';this[_0x226f('0x2b')]=_0x3ef4f5[_0x226f('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x9d52=['calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9d52,0x18e));var _0x29d5=function(_0x39782f,_0x4aa931){_0x39782f=_0x39782f-0x0;var _0x47768c=_0x9d52[_0x39782f];return _0x47768c;};'use strict';var util=require(_0x29d5('0x0'));var _=require(_0x29d5('0x1'));var moment=require(_0x29d5('0x2'));function getSeconds(_0x3ddcd6,_0x3d1cdc){var _0x357922=moment(_0x3ddcd6)[_0x29d5('0x3')](0x0);var _0x440044=moment(_0x3d1cdc)[_0x29d5('0x3')](0x0);return _0x357922[_0x29d5('0x4')](_0x440044,_0x29d5('0x5'));}function AgentComplete(_0x2fdf78,_0x29c726){this[_0x29d5('0x6')]=0x4;this[_0x29d5('0x7')]=_0x29d5('0x8');this['scheduledat']=_0x2fdf78['scheduledat'];this[_0x29d5('0x9')]=_0x2fdf78[_0x29d5('0x9')];this['campaigntype']=_0x2fdf78[_0x29d5('0x9')]==='outbound'?_0x29d5('0xa'):_0x2fdf78[_0x29d5('0x9')];this[_0x29d5('0xb')]=_0x2fdf78[_0x29d5('0xb')];this[_0x29d5('0xc')]=_0x2fdf78[_0x29d5('0xc')];this[_0x29d5('0xd')]=_0x2fdf78[_0x29d5('0xd')];this['countglobal']=_0x2fdf78[_0x29d5('0xb')]+_0x2fdf78[_0x29d5('0xc')]+_0x2fdf78[_0x29d5('0xd')]+_0x2fdf78[_0x29d5('0xe')]+_0x2fdf78[_0x29d5('0xf')]+_0x2fdf78[_0x29d5('0x10')]+_0x2fdf78[_0x29d5('0x11')]+_0x2fdf78[_0x29d5('0x12')];this['countnosuchnumberretry']=_0x2fdf78[_0x29d5('0xe')];this[_0x29d5('0xf')]=_0x2fdf78[_0x29d5('0xf')];this[_0x29d5('0x10')]=_0x2fdf78['countabandonedretry'];this[_0x29d5('0x11')]=_0x2fdf78[_0x29d5('0x11')];this[_0x29d5('0x12')]=_0x2fdf78[_0x29d5('0x12')];this[_0x29d5('0x13')]=_0x29c726['uniqueid'];this[_0x29d5('0x14')]=_0x2fdf78[_0x29d5('0x15')];this[_0x29d5('0x16')]=_0x2fdf78['number'];this[_0x29d5('0x17')]=_0x2fdf78[_0x29d5('0x17')];this[_0x29d5('0x18')]=_0x2fdf78[_0x29d5('0x18')];this[_0x29d5('0x19')]=_0x2fdf78['answertime'];this[_0x29d5('0x1a')]=moment()[_0x29d5('0x1b')](_0x29d5('0x1c'));this['ringtime']=getSeconds(_0x2fdf78[_0x29d5('0x18')],_0x2fdf78[_0x29d5('0x17')]);this['holdtime']=getSeconds(_0x2fdf78['answertime'],_0x2fdf78['responsetime']);this[_0x29d5('0x1d')]=getSeconds(this[_0x29d5('0x1a')],_0x2fdf78[_0x29d5('0x19')]);this['queue']=_0x29c726[_0x29d5('0xa')];this[_0x29d5('0x1e')]=_0x29c726[_0x29d5('0x1e')];this['reason']=_0x29c726[_0x29d5('0x1f')];this[_0x29d5('0x20')]=_0x2fdf78[_0x29d5('0x20')];this[_0x29d5('0x21')]=_0x2fdf78['callbackuniqueid'];this['callbackat']=_0x2fdf78[_0x29d5('0x22')];this[_0x29d5('0x23')]=_0x2fdf78[_0x29d5('0x23')];this[_0x29d5('0x24')]=_0x2fdf78['ContactId'];this[_0x29d5('0x25')]=_0x2fdf78[_0x29d5('0x25')];this['UserId']=_0x2fdf78['UserId'];this[_0x29d5('0x26')]=_0x2fdf78[_0x29d5('0x26')];this[_0x29d5('0x27')]=_0x2fdf78[_0x29d5('0x27')];this[_0x29d5('0x28')]=_0x2fdf78[_0x29d5('0x28')]||'';this[_0x29d5('0x29')]=_0x2fdf78['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index aef0fd5..ca142b5 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 _0x7579=['endtime','ringtime','holdtime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime'];(function(_0xed3f99,_0x110dd4){var _0x34c839=function(_0x52c2d0){while(--_0x52c2d0){_0xed3f99['push'](_0xed3f99['shift']());}};_0x34c839(++_0x110dd4);}(_0x7579,0x1e2));var _0x9757=function(_0x23598a,_0x29a520){_0x23598a=_0x23598a-0x0;var _0x3a9a4b=_0x7579[_0x23598a];return _0x3a9a4b;};'use strict';var util=require(_0x9757('0x0'));var _=require(_0x9757('0x1'));var moment=require(_0x9757('0x2'));function getSeconds(_0x30eeec,_0x2e6afa){var _0x304b14=moment(_0x30eeec)['milliseconds'](0x0);var _0x399165=moment(_0x2e6afa)[_0x9757('0x3')](0x0);return _0x304b14[_0x9757('0x4')](_0x399165,_0x9757('0x5'));}function Final(_0x4c1a67){this[_0x9757('0x6')]=_0x4c1a67[_0x9757('0x6')];this[_0x9757('0x7')]=_0x4c1a67['scheduledat'];this[_0x9757('0x8')]=_0x4c1a67['type'];this[_0x9757('0x9')]=_0x4c1a67[_0x9757('0x8')]===_0x9757('0xa')?'queue':_0x4c1a67[_0x9757('0x8')];this[_0x9757('0xb')]=_0x4c1a67[_0x9757('0xb')];this[_0x9757('0xc')]=_0x4c1a67[_0x9757('0xc')];this[_0x9757('0xd')]=_0x4c1a67[_0x9757('0xd')];this[_0x9757('0xe')]=_0x4c1a67[_0x9757('0xb')]+_0x4c1a67[_0x9757('0xc')]+_0x4c1a67[_0x9757('0xd')]+_0x4c1a67['countnosuchnumberretry']+_0x4c1a67[_0x9757('0xf')]+_0x4c1a67[_0x9757('0x10')]+_0x4c1a67[_0x9757('0x11')]+_0x4c1a67['countagentrejectretry'];this[_0x9757('0x12')]=_0x4c1a67[_0x9757('0x12')];this[_0x9757('0xf')]=_0x4c1a67[_0x9757('0xf')];this[_0x9757('0x10')]=_0x4c1a67[_0x9757('0x10')];this[_0x9757('0x11')]=_0x4c1a67['countmachineretry'];this[_0x9757('0x13')]=_0x4c1a67['countagentrejectretry'];this[_0x9757('0x14')]=_0x4c1a67[_0x9757('0x14')];this[_0x9757('0x15')]=_0x4c1a67[_0x9757('0x15')];this[_0x9757('0x16')]=_0x4c1a67[_0x9757('0x16')];this['starttime']=_0x4c1a67[_0x9757('0x17')];this[_0x9757('0x18')]=_0x4c1a67[_0x9757('0x18')];this[_0x9757('0x19')]=_0x4c1a67[_0x9757('0x18')];this[_0x9757('0x1a')]=_0x4c1a67[_0x9757('0x1a')]||0x0;this['holdtime']=_0x4c1a67[_0x9757('0x1b')]||0x0;this['talktime']=_0x4c1a67['talktime']||0x0;this[_0x9757('0x1c')]=_0x4c1a67[_0x9757('0x1c')];this[_0x9757('0x1d')]=_0x4c1a67[_0x9757('0x1d')];this['callbackat']=_0x4c1a67['callbackat'];this['recallme']=_0x4c1a67[_0x9757('0x1e')];this[_0x9757('0x1f')]=_0x4c1a67[_0x9757('0x1f')];this[_0x9757('0x20')]=_0x4c1a67['ListId'];this[_0x9757('0x21')]=_0x4c1a67[_0x9757('0x21')];this['VoiceQueueId']=_0x4c1a67[_0x9757('0x22')];this[_0x9757('0x23')]=_0x4c1a67['CampaignId'];this[_0x9757('0x24')]=_0x4c1a67[_0x9757('0x24')]||'';this[_0x9757('0x25')]=_0x4c1a67[_0x9757('0x25')]||'';}module[_0x9757('0x26')]=Final; \ No newline at end of file +var _0x2123=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x2123,0x190));var _0x3212=function(_0x8095dd,_0x2d1641){_0x8095dd=_0x8095dd-0x0;var _0x293887=_0x2123[_0x8095dd];return _0x293887;};'use strict';var util=require(_0x3212('0x0'));var _=require(_0x3212('0x1'));var moment=require(_0x3212('0x2'));function getSeconds(_0x3424c2,_0x7158b8){var _0x2ff863=moment(_0x3424c2)[_0x3212('0x3')](0x0);var _0x2e951f=moment(_0x7158b8)[_0x3212('0x3')](0x0);return _0x2ff863[_0x3212('0x4')](_0x2e951f,_0x3212('0x5'));}function Final(_0x265328){this['uniqueid']=_0x265328[_0x3212('0x6')];this[_0x3212('0x7')]=_0x265328[_0x3212('0x7')];this['type']=_0x265328[_0x3212('0x8')];this['campaigntype']=_0x265328[_0x3212('0x8')]===_0x3212('0x9')?_0x3212('0xa'):_0x265328[_0x3212('0x8')];this['countbusyretry']=_0x265328['countbusyretry'];this[_0x3212('0xb')]=_0x265328[_0x3212('0xb')];this[_0x3212('0xc')]=_0x265328[_0x3212('0xc')];this[_0x3212('0xd')]=_0x265328[_0x3212('0xe')]+_0x265328[_0x3212('0xb')]+_0x265328[_0x3212('0xc')]+_0x265328[_0x3212('0xf')]+_0x265328[_0x3212('0x10')]+_0x265328[_0x3212('0x11')]+_0x265328[_0x3212('0x12')]+_0x265328[_0x3212('0x13')];this[_0x3212('0xf')]=_0x265328[_0x3212('0xf')];this[_0x3212('0x10')]=_0x265328[_0x3212('0x10')];this[_0x3212('0x11')]=_0x265328[_0x3212('0x11')];this[_0x3212('0x12')]=_0x265328[_0x3212('0x12')];this[_0x3212('0x13')]=_0x265328['countagentrejectretry'];this[_0x3212('0xa')]=_0x265328[_0x3212('0xa')];this[_0x3212('0x14')]=_0x265328[_0x3212('0x14')];this[_0x3212('0x15')]=_0x265328[_0x3212('0x15')];this[_0x3212('0x16')]=_0x265328['starttime'];this['responsetime']=_0x265328[_0x3212('0x17')];this['endtime']=_0x265328[_0x3212('0x17')];this[_0x3212('0x18')]=_0x265328[_0x3212('0x18')]||0x0;this[_0x3212('0x19')]=_0x265328[_0x3212('0x19')]||0x0;this['talktime']=_0x265328[_0x3212('0x1a')]||0x0;this[_0x3212('0x1b')]=_0x265328['callback'];this[_0x3212('0x1c')]=_0x265328[_0x3212('0x1c')];this[_0x3212('0x1d')]=_0x265328['callbackat'];this['recallme']=_0x265328[_0x3212('0x1e')];this[_0x3212('0x1f')]=_0x265328[_0x3212('0x1f')];this[_0x3212('0x20')]=_0x265328[_0x3212('0x20')];this[_0x3212('0x21')]=_0x265328['UserId'];this['VoiceQueueId']=_0x265328[_0x3212('0x22')];this['CampaignId']=_0x265328[_0x3212('0x23')];this[_0x3212('0x24')]=_0x265328[_0x3212('0x24')]||'';this['originatecalleridname']=_0x265328[_0x3212('0x25')]||'';}module[_0x3212('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index aa2077d..dcb5736 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 _0xcb9a=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','format','ringtime','holdtime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x3ec0c5,_0xd53892){var _0x34c0c8=function(_0x13a192){while(--_0x13a192){_0x3ec0c5['push'](_0x3ec0c5['shift']());}};_0x34c0c8(++_0xd53892);}(_0xcb9a,0x73));var _0xacb9=function(_0x46352f,_0xdf0ce1){_0x46352f=_0x46352f-0x0;var _0x3721eb=_0xcb9a[_0x46352f];return _0x3721eb;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xacb9('0x0'));function getSeconds(_0x339835,_0x1cf22e){var _0x800431=moment(_0x339835)[_0xacb9('0x1')](0x0);var _0x1d0017=moment(_0x1cf22e)['milliseconds'](0x0);return _0x800431['diff'](_0x1d0017,_0xacb9('0x2'));}function Hangup(_0x2e6238,_0x3698a1){this[_0xacb9('0x3')]=0x4;this[_0xacb9('0x4')]='Answer';this[_0xacb9('0x5')]=_0x2e6238[_0xacb9('0x5')];this[_0xacb9('0x6')]=_0x2e6238[_0xacb9('0x6')];this[_0xacb9('0x7')]=_0x2e6238[_0xacb9('0x6')]===_0xacb9('0x8')?_0xacb9('0x9'):_0x2e6238[_0xacb9('0x6')];this[_0xacb9('0xa')]=_0x2e6238[_0xacb9('0xa')];this[_0xacb9('0xb')]=_0x2e6238[_0xacb9('0xb')];this[_0xacb9('0xc')]=_0x2e6238[_0xacb9('0xc')];this[_0xacb9('0xd')]=_0x2e6238[_0xacb9('0xa')]+_0x2e6238[_0xacb9('0xb')]+_0x2e6238[_0xacb9('0xc')]+_0x2e6238[_0xacb9('0xe')]+_0x2e6238[_0xacb9('0xf')]+_0x2e6238['countabandonedretry']+_0x2e6238['countmachineretry']+_0x2e6238['countagentrejectretry'];this[_0xacb9('0xe')]=_0x2e6238[_0xacb9('0xe')];this[_0xacb9('0xf')]=_0x2e6238[_0xacb9('0xf')];this['countabandonedretry']=_0x2e6238[_0xacb9('0x10')];this['countmachineretry']=_0x2e6238[_0xacb9('0x11')];this['countagentrejectretry']=_0x2e6238[_0xacb9('0x12')];this['uniqueid']=_0x3698a1[_0xacb9('0x13')];this[_0xacb9('0x14')]=_0x2e6238[_0xacb9('0x15')];this['calleridnum']=_0x2e6238[_0xacb9('0x16')];this[_0xacb9('0x17')]=_0x2e6238[_0xacb9('0x17')];this[_0xacb9('0x18')]=_0x2e6238[_0xacb9('0x18')];this['endtime']=moment()[_0xacb9('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xacb9('0x1a')]=getSeconds(_0x2e6238[_0xacb9('0x18')],_0x2e6238[_0xacb9('0x17')]);this[_0xacb9('0x1b')]=0x0;this['talktime']=getSeconds(this[_0xacb9('0x1c')],_0x2e6238[_0xacb9('0x18')]);this[_0xacb9('0x9')]=_0x2e6238[_0xacb9('0x9')];this[_0xacb9('0x1d')]=_0xacb9('0x1e');this[_0xacb9('0x1f')]=_0x3698a1[_0xacb9('0x20')];this[_0xacb9('0x21')]=_0x2e6238['callback'];this[_0xacb9('0x22')]=_0x2e6238[_0xacb9('0x22')];this[_0xacb9('0x23')]=_0x2e6238[_0xacb9('0x23')];this[_0xacb9('0x24')]=_0x2e6238[_0xacb9('0x24')];this['ContactId']=_0x2e6238[_0xacb9('0x25')];this[_0xacb9('0x26')]=_0x2e6238['ListId'];this[_0xacb9('0x27')]=_0x2e6238[_0xacb9('0x27')];this[_0xacb9('0x28')]=_0x2e6238[_0xacb9('0x28')];this[_0xacb9('0x29')]=_0x2e6238[_0xacb9('0x29')];}module[_0xacb9('0x2a')]=Hangup; \ No newline at end of file +var _0xe1fe=['ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x406217,_0x5650da){var _0x2966d6=function(_0x3f8b9a){while(--_0x3f8b9a){_0x406217['push'](_0x406217['shift']());}};_0x2966d6(++_0x5650da);}(_0xe1fe,0x14e));var _0xee1f=function(_0x3e219c,_0x301021){_0x3e219c=_0x3e219c-0x0;var _0x11d8ea=_0xe1fe[_0x3e219c];return _0x11d8ea;};'use strict';var util=require(_0xee1f('0x0'));var _=require(_0xee1f('0x1'));var moment=require(_0xee1f('0x2'));function getSeconds(_0x30c7f1,_0x5bb967){var _0x1b0eea=moment(_0x30c7f1)[_0xee1f('0x3')](0x0);var _0x5796c6=moment(_0x5bb967)[_0xee1f('0x3')](0x0);return _0x1b0eea[_0xee1f('0x4')](_0x5796c6,_0xee1f('0x5'));}function Hangup(_0x3a97f2,_0x45752f){this[_0xee1f('0x6')]=0x4;this[_0xee1f('0x7')]='Answer';this[_0xee1f('0x8')]=_0x3a97f2[_0xee1f('0x8')];this['type']=_0x3a97f2['type'];this[_0xee1f('0x9')]=_0x3a97f2[_0xee1f('0xa')]===_0xee1f('0xb')?_0xee1f('0xc'):_0x3a97f2[_0xee1f('0xa')];this[_0xee1f('0xd')]=_0x3a97f2[_0xee1f('0xd')];this[_0xee1f('0xe')]=_0x3a97f2[_0xee1f('0xe')];this[_0xee1f('0xf')]=_0x3a97f2[_0xee1f('0xf')];this[_0xee1f('0x10')]=_0x3a97f2[_0xee1f('0xd')]+_0x3a97f2['countcongestionretry']+_0x3a97f2[_0xee1f('0xf')]+_0x3a97f2[_0xee1f('0x11')]+_0x3a97f2[_0xee1f('0x12')]+_0x3a97f2[_0xee1f('0x13')]+_0x3a97f2['countmachineretry']+_0x3a97f2[_0xee1f('0x14')];this[_0xee1f('0x11')]=_0x3a97f2['countnosuchnumberretry'];this[_0xee1f('0x12')]=_0x3a97f2[_0xee1f('0x12')];this['countabandonedretry']=_0x3a97f2['countabandonedretry'];this[_0xee1f('0x15')]=_0x3a97f2[_0xee1f('0x15')];this[_0xee1f('0x14')]=_0x3a97f2[_0xee1f('0x14')];this[_0xee1f('0x16')]=_0x45752f[_0xee1f('0x16')];this[_0xee1f('0x17')]=_0x3a97f2[_0xee1f('0x18')];this[_0xee1f('0x19')]=_0x3a97f2['number'];this[_0xee1f('0x1a')]=_0x3a97f2['starttime'];this[_0xee1f('0x1b')]=_0x3a97f2['responsetime'];this[_0xee1f('0x1c')]=moment()[_0xee1f('0x1d')](_0xee1f('0x1e'));this['ringtime']=getSeconds(_0x3a97f2['responsetime'],_0x3a97f2[_0xee1f('0x1a')]);this[_0xee1f('0x1f')]=0x0;this[_0xee1f('0x20')]=getSeconds(this[_0xee1f('0x1c')],_0x3a97f2['responsetime']);this['queue']=_0x3a97f2[_0xee1f('0xc')];this[_0xee1f('0x21')]=_0xee1f('0x22');this[_0xee1f('0x23')]=_0x45752f[_0xee1f('0x24')];this[_0xee1f('0x25')]=_0x3a97f2[_0xee1f('0x25')];this['callbackuniqueid']=_0x3a97f2[_0xee1f('0x26')];this[_0xee1f('0x27')]=_0x3a97f2[_0xee1f('0x27')];this[_0xee1f('0x28')]=_0x3a97f2['recallme'];this['ContactId']=_0x3a97f2[_0xee1f('0x29')];this[_0xee1f('0x2a')]=_0x3a97f2[_0xee1f('0x2a')];this[_0xee1f('0x2b')]=_0x3a97f2[_0xee1f('0x2b')];this[_0xee1f('0x2c')]=_0x3a97f2[_0xee1f('0x2c')];this[_0xee1f('0x2d')]=_0x3a97f2['CampaignId'];}module[_0xee1f('0x2e')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 59d68fb..0b57aa3 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 _0xdf90=['CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0xebb73e,_0x2e2497){var _0x265d8c=function(_0x324ebb){while(--_0x324ebb){_0xebb73e['push'](_0xebb73e['shift']());}};_0x265d8c(++_0x2e2497);}(_0xdf90,0xbd));var _0x0df9=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0xdf90[_0x4e0b8c];return _0x633ecc;};'use strict';var util=require('util');var _=require(_0x0df9('0x0'));var moment=require(_0x0df9('0x1'));function getSeconds(_0x580ea6,_0x1bcbe2){var _0x13c3b7=moment(_0x580ea6)[_0x0df9('0x2')](0x0);var _0x1cad68=moment(_0x1bcbe2)[_0x0df9('0x2')](0x0);return _0x13c3b7['diff'](_0x1cad68,_0x0df9('0x3'));}function History(_0x3414ab){this[_0x0df9('0x4')]=_0x3414ab[_0x0df9('0x4')];this['scheduledat']=_0x3414ab[_0x0df9('0x5')]||undefined;this['type']=_0x3414ab['type'];this['campaigntype']=_0x3414ab[_0x0df9('0x6')]===_0x0df9('0x7')?_0x0df9('0x8'):_0x3414ab[_0x0df9('0x6')];this[_0x0df9('0x9')]=_0x3414ab[_0x0df9('0x9')];this['countcongestionretry']=_0x3414ab[_0x0df9('0xa')];this[_0x0df9('0xb')]=_0x3414ab['countnoanswerretry'];this['countglobal']=_0x3414ab[_0x0df9('0x9')]+_0x3414ab['countcongestionretry']+_0x3414ab['countnoanswerretry']+_0x3414ab[_0x0df9('0xc')]+_0x3414ab[_0x0df9('0xd')]+_0x3414ab[_0x0df9('0xe')]+_0x3414ab[_0x0df9('0xf')]+_0x3414ab[_0x0df9('0x10')];this[_0x0df9('0xc')]=_0x3414ab[_0x0df9('0xc')];this['countdropretry']=_0x3414ab[_0x0df9('0xd')];this[_0x0df9('0xe')]=_0x3414ab[_0x0df9('0xe')];this[_0x0df9('0xf')]=_0x3414ab[_0x0df9('0xf')];this[_0x0df9('0x10')]=_0x3414ab[_0x0df9('0x10')];this[_0x0df9('0x8')]=_0x3414ab[_0x0df9('0x8')];this['calleridname']=_0x3414ab[_0x0df9('0x11')];this[_0x0df9('0x12')]=_0x3414ab[_0x0df9('0x13')];this['starttime']=_0x3414ab[_0x0df9('0x14')];this[_0x0df9('0x15')]=_0x3414ab[_0x0df9('0x15')];this[_0x0df9('0x16')]=_0x3414ab['responsetime'];this['ringtime']=getSeconds(_0x3414ab[_0x0df9('0x15')],_0x3414ab[_0x0df9('0x14')]);this[_0x0df9('0x17')]=0x0;this[_0x0df9('0x18')]=0x0;this[_0x0df9('0x19')]=_0x3414ab[_0x0df9('0x19')];this[_0x0df9('0x1a')]=_0x3414ab[_0x0df9('0x1a')];this[_0x0df9('0x1b')]=_0x3414ab['callbackat'];this[_0x0df9('0x1c')]=_0x3414ab[_0x0df9('0x1c')];this['ContactId']=_0x3414ab[_0x0df9('0x1d')];this[_0x0df9('0x1e')]=_0x3414ab[_0x0df9('0x1e')];this[_0x0df9('0x1f')]=_0x3414ab[_0x0df9('0x1f')];this[_0x0df9('0x20')]=_0x3414ab[_0x0df9('0x20')];this[_0x0df9('0x21')]=_0x3414ab['CampaignId'];this[_0x0df9('0x22')]=_0x3414ab[_0x0df9('0x22')]||'';this[_0x0df9('0x23')]=_0x3414ab[_0x0df9('0x23')]||'';}module[_0x0df9('0x24')]=History; \ No newline at end of file +var _0x0b7d=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','name','calleridnum','number','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x464d68,_0x5a69ee){var _0x6fe4a1=function(_0x40f0ae){while(--_0x40f0ae){_0x464d68['push'](_0x464d68['shift']());}};_0x6fe4a1(++_0x5a69ee);}(_0x0b7d,0x1a3));var _0xd0b7=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x0b7d[_0x525b28];return _0x180178;};'use strict';var util=require(_0xd0b7('0x0'));var _=require(_0xd0b7('0x1'));var moment=require(_0xd0b7('0x2'));function getSeconds(_0x11b685,_0x21f9aa){var _0x152079=moment(_0x11b685)[_0xd0b7('0x3')](0x0);var _0x256269=moment(_0x21f9aa)['milliseconds'](0x0);return _0x152079[_0xd0b7('0x4')](_0x256269,_0xd0b7('0x5'));}function History(_0xeb6129){this['uniqueid']=_0xeb6129['uniqueid'];this[_0xd0b7('0x6')]=_0xeb6129[_0xd0b7('0x6')]||undefined;this[_0xd0b7('0x7')]=_0xeb6129[_0xd0b7('0x7')];this[_0xd0b7('0x8')]=_0xeb6129['type']===_0xd0b7('0x9')?_0xd0b7('0xa'):_0xeb6129[_0xd0b7('0x7')];this[_0xd0b7('0xb')]=_0xeb6129[_0xd0b7('0xb')];this[_0xd0b7('0xc')]=_0xeb6129['countcongestionretry'];this[_0xd0b7('0xd')]=_0xeb6129[_0xd0b7('0xd')];this[_0xd0b7('0xe')]=_0xeb6129[_0xd0b7('0xb')]+_0xeb6129['countcongestionretry']+_0xeb6129[_0xd0b7('0xd')]+_0xeb6129[_0xd0b7('0xf')]+_0xeb6129[_0xd0b7('0x10')]+_0xeb6129['countabandonedretry']+_0xeb6129[_0xd0b7('0x11')]+_0xeb6129['countagentrejectretry'];this[_0xd0b7('0xf')]=_0xeb6129[_0xd0b7('0xf')];this[_0xd0b7('0x10')]=_0xeb6129[_0xd0b7('0x10')];this[_0xd0b7('0x12')]=_0xeb6129[_0xd0b7('0x12')];this['countmachineretry']=_0xeb6129[_0xd0b7('0x11')];this[_0xd0b7('0x13')]=_0xeb6129['countagentrejectretry'];this[_0xd0b7('0xa')]=_0xeb6129[_0xd0b7('0xa')];this[_0xd0b7('0x14')]=_0xeb6129[_0xd0b7('0x15')];this[_0xd0b7('0x16')]=_0xeb6129[_0xd0b7('0x17')];this['starttime']=_0xeb6129['starttime'];this[_0xd0b7('0x18')]=_0xeb6129['responsetime'];this[_0xd0b7('0x19')]=_0xeb6129[_0xd0b7('0x18')];this[_0xd0b7('0x1a')]=getSeconds(_0xeb6129[_0xd0b7('0x18')],_0xeb6129['starttime']);this[_0xd0b7('0x1b')]=0x0;this[_0xd0b7('0x1c')]=0x0;this[_0xd0b7('0x1d')]=_0xeb6129[_0xd0b7('0x1d')];this['callbackuniqueid']=_0xeb6129[_0xd0b7('0x1e')];this[_0xd0b7('0x1f')]=_0xeb6129[_0xd0b7('0x1f')];this[_0xd0b7('0x20')]=_0xeb6129[_0xd0b7('0x20')];this[_0xd0b7('0x21')]=_0xeb6129[_0xd0b7('0x21')];this[_0xd0b7('0x22')]=_0xeb6129[_0xd0b7('0x22')];this[_0xd0b7('0x23')]=_0xeb6129[_0xd0b7('0x23')];this[_0xd0b7('0x24')]=_0xeb6129[_0xd0b7('0x24')];this[_0xd0b7('0x25')]=_0xeb6129[_0xd0b7('0x25')];this[_0xd0b7('0x26')]=_0xeb6129['originatecalleridnum']||'';this[_0xd0b7('0x27')]=_0xeb6129['originatecalleridname']||'';}module[_0xd0b7('0x28')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 3a7b67e..19326b5 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 _0xebaa=['stateinterface','rrmemory','queueBooked','push','queueStatusComplete','[unlockQueueStatus][undefined]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','timezones','content','true','iftime\x20%s,%s','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','Contact','phone','getCaller','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictive','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','maxNumberOriginate','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[actionOriginate]\x20','Contact.phone','[handlePredictive][limitChannel]','tryOriginatePredictive','checkContactBlack','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','util','lodash','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/setting','./action','./history','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','agentconnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','message','AGENTS_NOT_LOGGED','name','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','milliseconds','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','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---------','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','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','isNil','Action','status','No\x20such\x20channel','ivr','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','uniqueid','variable','amdstatus','value','outboundAnswerCallsDay','membername','AMD','custom:amd','[syncHangupInAMD][createHistory]','dialAMDActive','MACHINE','countglobal','amd','buildObj','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','Machine','[syncAgentComplete][createHistory][0]','dialMachineMaxRetry','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','syncAgentComplete','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xebaa,0xf3));var _0xaeba=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xebaa[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0xaeba('0x0'));var _=require(_0xaeba('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xaeba('0x2'));var rr=require('rr');var md5=require(_0xaeba('0x3'));var Redis=require(_0xaeba('0x4'));var ut=require('../preview/util/util');var config=require(_0xaeba('0x5'));var logger=require(_0xaeba('0x6'))(_0xaeba('0x7'));var loggerBooked=require(_0xaeba('0x6'))(_0xaeba('0x8'));var loggerPredictive=require(_0xaeba('0x6'))('predictive');var loggerPredictiveCalls=require(_0xaeba('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xaeba('0x6'))(_0xaeba('0x9'));var ami=require(_0xaeba('0xa'));config[_0xaeba('0xb')]=_[_0xaeba('0xc')](config[_0xaeba('0xb')],{'host':_0xaeba('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaeba('0xb')]));var cmHopper=require(_0xaeba('0xe'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xaeba('0xf'));var Action=require(_0xaeba('0x10'));var History=require(_0xaeba('0x11'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xaeba('0x12'));var Hangup=require(_0xaeba('0x13'));var ipAgi=process[_0xaeba('0x14')]['XCALLY_IP_AGI']||_0xaeba('0x15');var strategy={'rrmemory':'rrmemory','roundrobin':_0xaeba('0x16')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xaeba('0x17')][_0xaeba('0x18')]=function(_0xa78c7f){this[_0xaeba('0x19')]=this[_0xaeba('0x19')]?this[_0xaeba('0x19')]['finally'](_0xa78c7f):_0xa78c7f();};function Dialer(_0x50401b,_0x57fb89){this[_0xaeba('0x1a')]=new Sequence();this[_0xaeba('0x1b')]=_0x57fb89;this[_0xaeba('0x1c')]=_0x50401b[_0xaeba('0x1c')];this[_0xaeba('0x1d')]=_0x50401b[_0xaeba('0x1d')];this['agents']=_0x50401b[_0xaeba('0x1e')];this[_0xaeba('0x1f')]=_0x50401b[_0xaeba('0x1f')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0xaeba('0x20')]={};this['actions']={};this[_0xaeba('0x21')]={};this[_0xaeba('0x22')]={};this[_0xaeba('0x23')]={};this[_0xaeba('0x24')]={};this[_0xaeba('0x25')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xaeba('0x26')]={};ami['on'](_0xaeba('0x27'),this['syncAgentConnect'][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x29'),this['syncQueueCallerAbandon'][_0xaeba('0x28')](this));ami['on']('originateresponse',this[_0xaeba('0x2a')][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x2b'),this['syncAgentComplete'][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x2c'),this['syncQueueSummary'][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x2d'),this[_0xaeba('0x2e')]['bind'](this));ami['on'](_0xaeba('0x2f'),this[_0xaeba('0x30')][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x31'),this[_0xaeba('0x32')][_0xaeba('0x28')](this));ami['on']('queuemember',this[_0xaeba('0x33')][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x34'),this['syncQueueStatusComplete'][_0xaeba('0x28')](this));this['loopCampaigns']();this[_0xaeba('0x35')]();RpcSetting[_0xaeba('0x36')]()[_0xaeba('0x37')](function(_0x41c478){previewRecallmeReminderInterval=_0x41c478[_0xaeba('0x38')];});}function isNotNull(_0x4ea621){return _0x4ea621!==null&&!_['isUndefined'](_0x4ea621);}function checkIsLoggedIn(_0x3df13f,_0x1a1824){return function(){if(_0x1a1824<=0x0){_0x3df13f[_0xaeba('0x39')]=_0xaeba('0x3a');throw _0x3df13f[_0xaeba('0x3b')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3d21af){return _0x3d21af;}function checkIsActive(_0x565c60,_0x2766f0){return function(){if(!isActive(_0x2766f0)){_0x565c60[_0xaeba('0x39')]='NOT_ACTIVE';throw _0x565c60['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x3821cb){return function(){if(!isNotNull(_0x3821cb[_0xaeba('0x3c')])){_0x3821cb[_0xaeba('0x39')]=_0xaeba('0x3d');throw _0x3821cb[_0xaeba('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x3821cb[_0xaeba('0x3c')][_0xaeba('0x3e')])){_0x3821cb['message']=_0xaeba('0x3d');throw _0x3821cb[_0xaeba('0x3b')]+_0xaeba('0x3f');}if(!isNotNull(_[_0xaeba('0x40')](_0x3821cb[_0xaeba('0x3c')][_0xaeba('0x3e')]))){_0x3821cb[_0xaeba('0x39')]=_0xaeba('0x3d');throw _0x3821cb[_0xaeba('0x3b')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x1d4850,_0x4ff0af,_0x4cb5a2){return{'action':_0x1d4850,'response':_0x4ff0af,'message':_0x4cb5a2,'stack':_0x4cb5a2};}function myreject(_0x2af96c){return function(_0x30294a){return _0x2af96c(msgResponse(_0xaeba('0x41'),_0xaeba('0x42'),JSON['stringify'](_0x30294a)));};}function getSeconds(_0x4bc390,_0x528950){var _0x47b85c=moment(_0x4bc390)[_0xaeba('0x43')](0x0);var _0x16523b=moment(_0x528950)[_0xaeba('0x43')](0x0);return _0x47b85c['diff'](_0x16523b,_0xaeba('0x44'));}function emit(_0x5c0ab5,_0x38a83d,_0x21fefb){io['to'](_0x5c0ab5)[_0xaeba('0x45')](_0x38a83d,_0x21fefb);}function emitVoiceQueueSummary(_0x30e413){if(_0x30e413[_0xaeba('0x46')]===_0xaeba('0x47')){var _0x552998={'id':_0x30e413['id'],'name':_0x30e413[_0xaeba('0x3b')],'strategy':_0x30e413[_0xaeba('0x48')],'answered':_0x30e413[_0xaeba('0x49')],'available':_0x30e413[_0xaeba('0x4a')],'loggedIn':_0x30e413[_0xaeba('0x4b')],'pTalking':_0x30e413[_0xaeba('0x4c')],'sumBillable':_0x30e413[_0xaeba('0x4d')],'sumDuration':_0x30e413[_0xaeba('0x4e')],'sumHoldTime':_0x30e413[_0xaeba('0x4f')]||0x0,'talking':_0x30e413[_0xaeba('0x50')],'total':_0x30e413[_0xaeba('0x51')],'type':_0x30e413[_0xaeba('0x46')],'unmanaged':_0x30e413[_0xaeba('0x52')],'abandoned':_0x30e413[_0xaeba('0x53')],'waiting':_0x30e413[_0xaeba('0x54')],'loggedInDb':_0x30e413[_0xaeba('0x55')],'dialActive':_0x30e413['dialActive'],'dialMethod':_0x30e413['dialMethod'],'dialOriginateCallerIdName':_0x30e413[_0xaeba('0x56')],'dialOriginateCallerIdNumber':_0x30e413[_0xaeba('0x57')],'dialOriginateTimeout':_0x30e413[_0xaeba('0x58')],'dialPrefix':_0x30e413[_0xaeba('0x59')],'outboundAnswerAgiCallsDay':_0x30e413[_0xaeba('0x5a')],'outboundAnswerCallsDay':_0x30e413['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x30e413[_0xaeba('0x5b')],'outboundBusyCallsDay':_0x30e413[_0xaeba('0x5c')],'outboundCongestionCallsDay':_0x30e413[_0xaeba('0x5d')],'outboundDropCallsDayACS':_0x30e413[_0xaeba('0x5e')],'outboundDropCallsDayCallersExit':_0x30e413[_0xaeba('0x5f')],'outboundDropCallsDayTimeout':_0x30e413[_0xaeba('0x60')],'outboundNoAnswerCallsDay':_0x30e413[_0xaeba('0x61')],'outboundNoSuchCallsDay':_0x30e413['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x30e413[_0xaeba('0x62')],'outboundReCallsDay':_0x30e413[_0xaeba('0x63')],'outboundRejectCallsDay':_0x30e413['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x30e413[_0xaeba('0x64')],'predictiveIntervalAnsweredCalls':_0x30e413[_0xaeba('0x65')],'predictiveIntervalAvgHoldtime':_0x30e413['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x30e413[_0xaeba('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x30e413[_0xaeba('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x30e413[_0xaeba('0x68')],'predictiveIntervalErlangCalls':_0x30e413[_0xaeba('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x30e413[_0xaeba('0x6a')],'predictiveIntervalHitRate':_0x30e413[_0xaeba('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x30e413[_0xaeba('0x6c')],'predictiveIntervalPauses':_0x30e413[_0xaeba('0x6d')],'predictiveIntervalAvailable':_0x30e413['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x30e413[_0xaeba('0x6e')],'message':_0x30e413[_0xaeba('0x39')],'originated':_0x30e413['originated'],'erlangCalls':_0x30e413[_0xaeba('0x6f')],'erlangCallToSecond':_0x30e413[_0xaeba('0x70')],'erlangAbandonmentRate':_0x30e413[_0xaeba('0x71')],'erlangBusyFactor':_0x30e413[_0xaeba('0x72')],'startPredictive':_0x30e413[_0xaeba('0x24')],'startProgressive':_0x30e413[_0xaeba('0x25')]};if(_0x30e413['Trunk']){_0x552998[_0xaeba('0x73')]={'id':_0x30e413[_0xaeba('0x73')]['id'],'name':_0x30e413[_0xaeba('0x73')]['name'],'active':_0x30e413[_0xaeba('0x73')][_0xaeba('0x74')],'callerid':_0x30e413['Trunk'][_0xaeba('0x75')]};}if(_0x30e413[_0xaeba('0x3c')]){_0x552998[_0xaeba('0x3c')]={'id':_0x30e413[_0xaeba('0x3c')]['id'],'name':_0x30e413['Interval'][_0xaeba('0x3b')]};}var _0x32bcab=md5(JSON[_0xaeba('0x76')](_0x552998));if(_0x30e413[_0xaeba('0x3')]!==_0x32bcab){_0x30e413[_0xaeba('0x3')]=_0x32bcab;emit(util[_0xaeba('0x77')](_0xaeba('0x78'),_0x552998[_0xaeba('0x3b')]),_0xaeba('0x79'),_0x552998);}}}function emitCampaignSummary(_0x1a628d){if(_0x1a628d[_0xaeba('0x46')]==='ivr'){emit(util[_0xaeba('0x77')](_0xaeba('0x7a'),_0x1a628d['name']),'campaign:save',_0x1a628d);}}function checkGetDataPredictive(_0x4cd2af){if(isNotNull(_0x4cd2af)&&!_[_0xaeba('0x40')](_0x4cd2af)){loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x7c'));loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x7d'),_0x4cd2af[_0xaeba('0x6e')]);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x7e'),_0x4cd2af[_0xaeba('0x65')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4cd2af[_0xaeba('0x68')]);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x7f'),_0x4cd2af['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x80'),_0x4cd2af[_0xaeba('0x81')]);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x82'),_0x4cd2af[_0xaeba('0x66')]);loggerPredictive['info'](_0xaeba('0x83'));if(_0x4cd2af['predictiveIntervalTotalCalls']>0x0){if(!_[_0xaeba('0x84')](_0x4cd2af[_0xaeba('0x66')])&&_0x4cd2af[_0xaeba('0x66')]>0x0){return!![];}loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x85'));if(!_['isUndefined'](_0x4cd2af[_0xaeba('0x81')])&&_0x4cd2af[_0xaeba('0x81')]>0x0){return!![];}loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x86'));}else{loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x87'));}}else{loggerPredictive['info'](_0xaeba('0x88'));}return![];}function mergeDataErlangB(_0x5dd87e){return function(_0x1cce1c){loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x89'));loggerPredictive['info'](_0xaeba('0x8a'),_0x1cce1c[_0xaeba('0x6f')]);loggerPredictive[_0xaeba('0x7b')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cce1c['erlangCallToSecond']);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x8b'),_0x1cce1c[_0xaeba('0x71')]);loggerPredictive[_0xaeba('0x7b')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cce1c[_0xaeba('0x72')]);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x8b'),_0x1cce1c[_0xaeba('0x71')]);loggerPredictive[_0xaeba('0x7b')]('---------------------------');_['merge'](_0x5dd87e,_0x1cce1c);};}function getDiff(_0x2c72fd){var _0x57c339=moment()[_0xaeba('0x43')](0x0);var _0x13509a=moment(_0x2c72fd)[_0xaeba('0x43')](0x0);return _0x57c339[_0xaeba('0x8c')](_0x13509a,'seconds');}function ifInterval(_0xf34b72,_0x2a7847){if(_[_0xaeba('0x84')](_0x2a7847)){return![];}return getDiff(_0x2a7847)<_0xf34b72*0x3c;}function freeVariablesPredictive(_0x3883c3){if(isNotNull(_0x3883c3)){if(!_[_0xaeba('0x84')](_0x3883c3['startProgressive'])){_0x3883c3[_0xaeba('0x25')]=undefined;loggerPredictive['info'](_0x3883c3[_0xaeba('0x3b')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x3883c3[_0xaeba('0x24')])){_0x3883c3[_0xaeba('0x24')]=undefined;loggerPredictive['info'](_0x3883c3[_0xaeba('0x3b')],_0xaeba('0x8d'));}if(!_[_0xaeba('0x84')](_0x3883c3[_0xaeba('0x8e')])){clearInterval(_0x3883c3['handlePredictive']);_0x3883c3[_0xaeba('0x8e')]=undefined;loggerPredictive[_0xaeba('0x7b')](_0x3883c3[_0xaeba('0x3b')],_0xaeba('0x8f'));}}}function erlangb(_0x1f6125,_0x10d335){if(_0x10d335===0x0){return 0x0;}var _0x5ce2e4=0x1;for(var _0x42cc76=0x1;_0x42cc76<=_0x10d335;_0x42cc76+=0x1){_0x5ce2e4=0x1+_0x5ce2e4*_0x42cc76/_0x1f6125;}return 0x1/_0x5ce2e4;}function isVoiceQueueOutbound(_0x44001d){return _0x44001d===_0xaeba('0x47');}function isNotPreview(_0x5b2459){return _0x5b2459!=='preview';}function isCampaignIvr(_0x193b32){return _0x193b32==='ivr';}function getCallerId(_0x31a3a4,_0x3b5c7e,_0x21afc4){if(!_[_0xaeba('0x84')](_0x21afc4)&&typeof _0x21afc4==='string'&&!_[_0xaeba('0x40')](_0x21afc4)){if(!_[_0xaeba('0x84')](_0x3b5c7e)&&typeof _0x3b5c7e===_0xaeba('0x90')&&!_[_0xaeba('0x40')](_0x3b5c7e)){return util[_0xaeba('0x77')](_0xaeba('0x91'),_0x3b5c7e,_0x21afc4);}return util[_0xaeba('0x77')]('\x22%s\x22\x20<%s>',_0x21afc4,_0x21afc4);}if(!_['isUndefined'](_0x31a3a4)&&typeof _0x31a3a4==='string'&&!_[_0xaeba('0x40')](_0x31a3a4)){return _0x31a3a4;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1df4fc,_0x3eb3b1){return function(_0x5c54c1){freeVariablesPredictive(_0x3eb3b1);emitVoiceQueueSummary(_0x3eb3b1);emitCampaignSummary(_0x3eb3b1);loggerSyncQueueSummary[_0xaeba('0x92')](_0x1df4fc,util[_0xaeba('0x93')](_0x5c54c1,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x190d54,_0x3b9737){return function(_0x3dd57d){loggerPredictive[_0xaeba('0x92')](_0x3b9737['name'],_0x190d54);loggerPredictive['error'](_0x3dd57d[_0xaeba('0x94')]);freeVariablesPredictive(_0x3b9737);};}function loggerCatch(_0x32309c){return function(_0x4f9c25){logger['error'](_0x32309c,util['inspect'](_0x4f9c25,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3c1207){return _0x3c1207&&!_[_0xaeba('0x84')](_0x3c1207)&&_0x3c1207[_0xaeba('0x95')]>0x0;}function decremetOriginate(_0x21eed2){if(!_[_0xaeba('0x84')](_0x21eed2)&&_0x21eed2!==null){if(typeof _0x21eed2[_0xaeba('0x96')]!==_0xaeba('0x97')){if(_0x21eed2[_0xaeba('0x96')]>0x0){_0x21eed2[_0xaeba('0x96')]-=0x1;}else{logger[_0xaeba('0x92')](_0xaeba('0x98'));}}}else{logger[_0xaeba('0x92')](_0xaeba('0x99'));}}function checkContactLowerLimitOriginate(_0x221e0d,_0x2ea8d0,_0x4d08de){if(_0x2ea8d0>_0x4d08de){for(var _0x23b800=0x0;_0x23b800<_0x2ea8d0-_0x4d08de;_0x23b800+=0x1){decremetOriginate(_0x221e0d);}}}function loggerGetContactDialer(_0x533ab4,_0x7b31a7,_0x4c8b89){return function(_0x48bcf0){checkContactLowerLimitOriginate(_0x7b31a7,_0x4c8b89,0x0);logger[_0xaeba('0x92')](_0x533ab4,util['inspect'](_0x48bcf0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b3443){return function(_0x2919bf){if(isNotNull(_0x2919bf)&&isNotNull(_0x2919bf[0x0])){if(_0x2919bf[0x0][_0xaeba('0x9a')]>0x0){_0x2b3443[_0xaeba('0x39')]=_0xaeba('0x9b');logger['info'](_0xaeba('0x9c')+_0x2b3443[_0xaeba('0x3b')],_0x2919bf[0x0][_0xaeba('0x9a')],_0xaeba('0x9d'));}else{_0x2b3443[_0xaeba('0x39')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xaeba('0x7b')](_0xaeba('0x9e')+_0x2b3443[_0xaeba('0x3b')]);}}};}function notSendMessagesQueue(_0x430059){if(_0x430059[_0xaeba('0x9f')]){freeVariablesPredictive(_0x430059);if(_0x430059[_0xaeba('0x96')]===0x0&&_0x430059[_0xaeba('0x50')]===0x0&&_0x430059[_0xaeba('0x54')]===0x0&&(_0x430059[_0xaeba('0x4c')]||0x0)===0x0){_0x430059[_0xaeba('0x9f')]=![];_0x430059[_0xaeba('0x4a')]=0x0;_0x430059[_0xaeba('0x39')]=_0xaeba('0xa0');loggerSyncQueueSummary[_0xaeba('0x92')](_0xaeba('0xa1'),_0x430059['name'],_0xaeba('0xa2'));}else{_0x430059[_0xaeba('0x39')]=_0xaeba('0xa3');loggerSyncQueueSummary[_0xaeba('0x92')](_0xaeba('0xa1'),_0x430059[_0xaeba('0x3b')],_0xaeba('0xa4'));}emitVoiceQueueSummary(_0x430059);}}function notSendMessagesCampaign(_0x47c2e6){if(_0x47c2e6[_0xaeba('0x9f')]){if(_0x47c2e6['originated']===0x0){_0x47c2e6[_0xaeba('0x9f')]=![];_0x47c2e6[_0xaeba('0x39')]=_0xaeba('0xa0');loggerSyncQueueSummary[_0xaeba('0x92')](_0xaeba('0xa5'),_0x47c2e6[_0xaeba('0x3b')],_0xaeba('0xa2'));}else{_0x47c2e6[_0xaeba('0x39')]=_0xaeba('0xa3');loggerSyncQueueSummary[_0xaeba('0x92')](_0xaeba('0xa5'),_0x47c2e6[_0xaeba('0x3b')],_0xaeba('0xa4'));}emitCampaignSummary(_0x47c2e6);}}function createObjHistory(_0x4b81fc,_0x587ff2,_0x355189,_0x3fd0ec,_0x258aa9){_0x4b81fc[_0xaeba('0x39')]=_0x355189;var _0x217df2=new Action(_0x4b81fc,_0x587ff2);var _0x337fa1=new History(_0x217df2);_0x337fa1[_0xaeba('0xa6')]=_0x3fd0ec;_0x337fa1[_0xaeba('0xa7')]=_0x258aa9;_0x337fa1[_0xaeba('0xa8')]=_0x217df2[_0xaeba('0xa9')];return _0x337fa1;}Dialer[_0xaeba('0x17')][_0xaeba('0x35')]=function(){var _0x18fa02=this;setInterval(function(){_0x18fa02[_0xaeba('0xaa')](_0x18fa02['uniqueId'],_0xaeba('0xab'));_0x18fa02[_0xaeba('0xaa')](_0x18fa02[_0xaeba('0xac')],'[actions]');},0x32c8);};Dialer[_0xaeba('0x17')][_0xaeba('0xaa')]=function(_0x90db75,_0x5815cb){var _0xdeb682=this;for(var _0x2e0f40 in _0x90db75){if(typeof _0x90db75[_0x2e0f40]!==_0xaeba('0x97')){this[_0xaeba('0x1a')][_0xaeba('0x18')](function(){if(!_[_0xaeba('0xad')](_0x90db75[_0x2e0f40])){return ami[_0xaeba('0xae')]({'action':_0xaeba('0xaf'),'channel':_0x90db75[_0x2e0f40]['channel']})['catch'](function(_0xf1c1d0){if(_0xf1c1d0[_0xaeba('0x39')]===_0xaeba('0xb0')){setTimeout(function(){if(_0x90db75[_0x2e0f40]&&_0x90db75[_0x2e0f40][_0xaeba('0x46')]!==_0xaeba('0xb1')){_0xdeb682[_0xaeba('0xb2')](_0xdeb682['voiceQueues'][_0x90db75[_0x2e0f40][_0xaeba('0xb3')]]);logger[_0xaeba('0x92')](_0xaeba('0xb4'),_0x5815cb,_0x2e0f40,_0x90db75[_0x2e0f40]['queue']);delete _0x90db75[_0x2e0f40];}if(_0x90db75[_0x2e0f40]&&_0x90db75[_0x2e0f40][_0xaeba('0x46')]===_0xaeba('0xb1')){_0xdeb682[_0xaeba('0xb2')](_0xdeb682[_0xaeba('0x1d')][_0x90db75[_0x2e0f40]['queue']]);logger[_0xaeba('0x92')](_0xaeba('0xb5'),_0x5815cb,_0x2e0f40,_0x90db75[_0x2e0f40]['queue']);delete _0x90db75[_0x2e0f40];}},0x2328);}});}});}}};Dialer[_0xaeba('0x17')][_0xaeba('0xb6')]=function(_0x430a9e){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopper['countReScheduled'](_0x430a9e))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xb9')));};Dialer[_0xaeba('0x17')]['checkIsBlackList']=function(_0x4171b){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopperBlack[_0xaeba('0xba')](_0x4171b))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xbb')));};Dialer[_0xaeba('0x17')][_0xaeba('0xbc')]=function(_0x4fd282){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopperBlack[_0xaeba('0xbc')](_0x4fd282))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xbd')));};Dialer[_0xaeba('0x17')][_0xaeba('0xbe')]=function(_0x451b1d){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x451b1d))['catch'](loggerCatch(_0xaeba('0xbf')));};Dialer[_0xaeba('0x17')][_0xaeba('0xc0')]=function(_0x5e3187){return BPromise['resolve']()[_0xaeba('0x37')](cmHopper[_0xaeba('0xc0')](_0x5e3187))['catch'](loggerCatch(_0xaeba('0xc1')));};Dialer[_0xaeba('0x17')][_0xaeba('0xc2')]=function(_0x164dfa,_0x428c2e,_0x519161){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopper[_0xaeba('0xc2')](_0x164dfa,_0x428c2e,_0x519161))[_0xaeba('0xb8')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xaeba('0x17')][_0xaeba('0xc3')]=function(_0x710f15,_0x40db0e,_0x3abf8a,_0x375bc2,_0x272fba){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopper[_0xaeba('0xc3')](_0x710f15,_0x40db0e,_0x3abf8a,_0x375bc2))[_0xaeba('0xb8')](function(_0xcf5f6c){_0x272fba['temp']-=_0x3abf8a;_0x272fba[_0xaeba('0xc4')]=_0x272fba[_0xaeba('0xc4')]>0x0?_0x272fba['temp']:0x0;loggerCatch(_0xaeba('0xc5'))(_0xcf5f6c);});};Dialer[_0xaeba('0x17')][_0xaeba('0xc6')]=function(_0x4bd88e,_0x38fffb,_0x2f8448,_0x4e35cf){return BPromise[_0xaeba('0xb7')]()['then'](cmHopper[_0xaeba('0xc6')](_0x4bd88e,_0x38fffb,_0x2f8448))[_0xaeba('0xb8')](function(_0x18d4e7){_0x4e35cf[_0xaeba('0xc4')]-=_0x38fffb;_0x4e35cf[_0xaeba('0xc4')]=_0x4e35cf[_0xaeba('0xc4')]>0x0?_0x4e35cf[_0xaeba('0xc4')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x18d4e7);});};Dialer[_0xaeba('0x17')][_0xaeba('0xc7')]=function(_0x5cce36){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5cce36))[_0xaeba('0xb8')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xaeba('0x17')][_0xaeba('0xc8')]=function(_0x3d6dca){return BPromise[_0xaeba('0xb7')]()['then'](cmHopper[_0xaeba('0xc8')](_0x3d6dca))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xc9')));};Dialer[_0xaeba('0x17')][_0xaeba('0xca')]=function(_0x37c33a){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopperHistory['createHistory'](_0x37c33a))[_0xaeba('0xb8')](loggerCatch('[createHistory]\x20'));};Dialer['prototype']['updateOriginated']=function(_0xfbe706){if(!_[_0xaeba('0x84')](_0xfbe706)&&_0xfbe706!==null){if(typeof _0xfbe706[_0xaeba('0x96')]!=='undefined'){if(_0xfbe706[_0xaeba('0x96')]>0x0){_0xfbe706['originated']-=0x1;}else{logger[_0xaeba('0x92')](_0xaeba('0xcb'));}}}else{logger['error'](_0xaeba('0xcc'));}};Dialer[_0xaeba('0x17')][_0xaeba('0xcd')]=function(_0x391a1d,_0x35ddf4){var _0x4db17f=this;return function(_0x2d0524){_0x4db17f[_0xaeba('0xb2')](_0x35ddf4);logger[_0xaeba('0x92')](_0x391a1d,util['inspect'](_0x2d0524,{'showHidden':![],'depth':null}));};};Dialer[_0xaeba('0x17')][_0xaeba('0xce')]=function(_0x4a955e,_0x2a9082,_0x58f00e){var _0x2b147c={'state':0x19,'statedesc':_0xaeba('0xcf')};this[_0xaeba('0xb2')](_0x2a9082);this[_0xaeba('0xd0')](_[_0xaeba('0xd1')](_0x2b147c,_[_0xaeba('0xd2')](_0x58f00e,[_0xaeba('0xd3'),_0xaeba('0xd4'),'UserId',_0xaeba('0xd5'),'CampaignId'])),_0xaeba('0xd6'),_0xaeba('0xd7'));logger[_0xaeba('0x92')](_0x4a955e);};Dialer[_0xaeba('0x17')][_0xaeba('0xd8')]=function(_0xf80c85){return _0xf80c85==='Success';};Dialer[_0xaeba('0x17')][_0xaeba('0xd9')]=function(_0x235eaf){return!_[_0xaeba('0x84')](_0x235eaf)&&_0x235eaf&&!_[_0xaeba('0x84')](_0x235eaf['name'])&&!_[_0xaeba('0x84')](_0x235eaf['active'])&&_0x235eaf[_0xaeba('0x74')]&&(this['trunks'][util[_0xaeba('0x77')]('SIP/%s',_0x235eaf['name'])]['status']==='reachable'||this[_0xaeba('0x1f')][util[_0xaeba('0x77')](_0xaeba('0xda'),_0x235eaf[_0xaeba('0x3b')])]['status']==='unmonitored');};Dialer[_0xaeba('0x17')][_0xaeba('0xd0')]=function(_0x8e669d,_0x31ac2b,_0x1b1126){this[_0xaeba('0xca')](_0x8e669d)[_0xaeba('0xb8')](loggerCatch(_0x31ac2b));this[_0xaeba('0xc8')](_0x8e669d)[_0xaeba('0xb8')](loggerCatch(_0x1b1126));};Dialer['prototype']['syncVarSet']=function(_0x3d4ed3){var _0xaecb75=this[_0xaeba('0x22')][_0x3d4ed3[_0xaeba('0xdb')]];var _0x4911eb;if(!_[_0xaeba('0xad')](_0x3d4ed3)&&!_[_0xaeba('0xad')](_0x3d4ed3[_0xaeba('0xdc')])&&!_[_0xaeba('0xad')](_0x3d4ed3[_0xaeba('0xdc')][_0xaeba('0xdd')])&&_0x3d4ed3['exten']==='xcally-motion-dialer'&&_0xaecb75){if(_0xaecb75[_0xaeba('0x46')]!==_0xaeba('0xb1')&&this['voiceQueues'][_0xaecb75['queue']]['dialAMDActive']&&_0x3d4ed3[_0xaeba('0xde')]==='HANGUP'){delete this[_0xaeba('0x22')][_0x3d4ed3[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]]);this[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xdf')]+=0x1;this[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4911eb=new Hangup(_0xaecb75,_0x3d4ed3);_0x4911eb[_0xaeba('0xa6')]=0x12;_0x4911eb[_0xaeba('0xa7')]='HangupInAMD';_0x4911eb[_0xaeba('0xe0')]=_0xaeba('0xe1');ami['emit'](_0xaeba('0xe2'),ut['buildObj'](_0x4911eb,'amd'));this[_0xaeba('0xd0')](_0x4911eb,_0xaeba('0xe3'),'[syncHangupInAMD]');}if(_0xaecb75[_0xaeba('0x46')]!==_0xaeba('0xb1')&&this[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xe4')]&&_0x3d4ed3[_0xaeba('0xde')]===_0xaeba('0xe5')){var _0x3ce053=this;return new BPromise(function(_0x37317f,_0x364fdf){delete _0x3ce053[_0xaeba('0x22')][_0x3d4ed3[_0xaeba('0xdb')]];_0x3ce053[_0xaeba('0xb2')](_0x3ce053[_0xaeba('0x1c')][_0xaecb75['queue']]);_0x3ce053[_0xaeba('0x1c')][_0xaecb75['queue']]['outboundAnswerCallsDay']+=0x1;_0x3ce053['voiceQueues'][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0x5a')]+=0x1;var _0xb20371=_0x3ce053[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]];var _0x89ff51=new Hangup(_0xaecb75,_0x3d4ed3);_0x89ff51[_0xaeba('0xa6')]=0x13;_0x89ff51[_0xaeba('0xa7')]='Machine';_0x89ff51['membername']=_0xaeba('0xe1');_0x89ff51['countmachineretry']+=0x1;_0x89ff51[_0xaeba('0xe6')]+=0x1;_0x89ff51[_0xaeba('0xe7')]=!![];ami[_0xaeba('0x45')]('custom:amd',ut[_0xaeba('0xe8')](_0x89ff51,_0xaeba('0xe7')));_0x3ce053['createHistory'](_0x89ff51)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x89ff51[_0xaeba('0xe9')]+_0x89ff51[_0xaeba('0xea')]+_0x89ff51[_0xaeba('0xeb')]+_0x89ff51[_0xaeba('0xec')]+_0x89ff51[_0xaeba('0xed')]+_0x89ff51[_0xaeba('0xee')]+_0x89ff51[_0xaeba('0xef')]+_0x89ff51[_0xaeba('0xf0')]>=_0xb20371[_0xaeba('0xf1')]){_0x3ce053[_0xaeba('0xf2')](_0x89ff51,_0x37317f,_0x364fdf,_0xaeba('0xf3'));}else{if(_0x89ff51[_0xaeba('0xef')]>=_0xb20371['dialMachineMaxRetry']){_0x3ce053[_0xaeba('0xf4')](_0x89ff51,_0x37317f,_0x364fdf,_0xaeba('0xf5'));}else{_0x3ce053[_0xaeba('0xc0')]({'active':![],'countmachineretry':_0x89ff51[_0xaeba('0xef')],'scheduledat':moment()[_0xaeba('0xf6')](_0xb20371[_0xaeba('0xf7')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x89ff51[_0xaeba('0xd3')],'ListId':_0x89ff51[_0xaeba('0xd4')],'VoiceQueueId':_0x89ff51[_0xaeba('0xd5')]||undefined,'CampaignId':_0x89ff51[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xfb')));_0x37317f({'reschedule':0x1});}}});}if(_0xaecb75[_0xaeba('0x46')]===_0xaeba('0xb1')&&this['campaigns'][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xe4')]&&_0x3d4ed3[_0xaeba('0xde')]===_0xaeba('0xfc')){delete this['uniqueId'][_0x3d4ed3[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]]);_0x4911eb=new Hangup(_0xaecb75,_0x3d4ed3);_0x4911eb[_0xaeba('0xa6')]=0x12;_0x4911eb[_0xaeba('0xa7')]='HangupInAMD';_0x4911eb[_0xaeba('0xe0')]=_0xaeba('0xe1');ami[_0xaeba('0x45')]('custom:amd',ut[_0xaeba('0xe8')](_0x4911eb,_0xaeba('0xe7')));this[_0xaeba('0xd0')](_0x4911eb,_0xaeba('0xfd'),'[syncHangupInAMDIvr]');}if(_0xaecb75[_0xaeba('0x46')]==='ivr'&&this[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xe4')]&&_0x3d4ed3[_0xaeba('0xde')]===_0xaeba('0xe5')){var _0x3ce053=this;return new BPromise(function(_0x56cf3a,_0x3eafb9){delete _0x3ce053[_0xaeba('0x22')][_0x3d4ed3[_0xaeba('0xdb')]];_0x3ce053[_0xaeba('0xb2')](_0x3ce053['campaigns'][_0xaecb75[_0xaeba('0xb3')]]);_0x3ce053[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xdf')]+=0x1;_0x3ce053[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0x5a')]+=0x1;var _0x16426d=_0x3ce053[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]];var _0x57e1dd=new Hangup(_0xaecb75,_0x3d4ed3);_0x57e1dd[_0xaeba('0xa6')]=0x13;_0x57e1dd['statedesc']=_0xaeba('0xfe');_0x57e1dd[_0xaeba('0xe0')]=_0xaeba('0xe1');_0x57e1dd[_0xaeba('0xef')]+=0x1;_0x57e1dd[_0xaeba('0xe6')]+=0x1;_0x57e1dd[_0xaeba('0xe7')]=!![];ami[_0xaeba('0x45')](_0xaeba('0xe2'),ut[_0xaeba('0xe8')](_0x57e1dd,_0xaeba('0xe7')));_0x3ce053[_0xaeba('0xca')](_0x57e1dd)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xff')));if(_0x57e1dd[_0xaeba('0xe9')]+_0x57e1dd['countcongestionretry']+_0x57e1dd[_0xaeba('0xeb')]+_0x57e1dd['countnosuchnumberretry']+_0x57e1dd['countdropretry']+_0x57e1dd[_0xaeba('0xee')]+_0x57e1dd[_0xaeba('0xef')]+_0x57e1dd[_0xaeba('0xf0')]>=_0x16426d[_0xaeba('0xf1')]){_0x3ce053[_0xaeba('0xf2')](_0x57e1dd,_0x56cf3a,_0x3eafb9,_0xaeba('0xf3'));}else{if(_0x57e1dd[_0xaeba('0xef')]>=_0x16426d[_0xaeba('0x100')]){_0x3ce053[_0xaeba('0xf4')](_0x57e1dd,_0x56cf3a,_0x3eafb9,_0xaeba('0xf5'));}else{_0x3ce053[_0xaeba('0xc0')]({'active':![],'countmachineretry':_0x57e1dd[_0xaeba('0xef')],'scheduledat':moment()['add'](_0x16426d[_0xaeba('0xf7')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x57e1dd[_0xaeba('0xd3')],'ListId':_0x57e1dd[_0xaeba('0xd4')],'VoiceQueueId':_0x57e1dd[_0xaeba('0xd5')]||undefined,'CampaignId':_0x57e1dd[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xfb')));_0x56cf3a({'reschedule':0x1});}}});}}};Dialer[_0xaeba('0x17')]['syncHangup']=function(_0x4776a4){var _0x10dc0b=this[_0xaeba('0x22')][_0x4776a4[_0xaeba('0xdb')]];var _0x527db0=this;var _0x4fc6f7;if(_0x10dc0b&&_0x10dc0b['type']==='ivr'){delete this[_0xaeba('0x22')][_0x4776a4[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this[_0xaeba('0x1d')][_0x10dc0b[_0xaeba('0xb3')]]);this[_0xaeba('0x1d')][_0x10dc0b[_0xaeba('0xb3')]]['ivrAnswerCallsDay']+=0x1;_0x4fc6f7=new Hangup(_0x10dc0b,_0x4776a4);this[_0xaeba('0xca')](_0x4fc6f7)['catch'](loggerCatch(_0xaeba('0x101')));this['moveContactManagedDialer'](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x102')));}if(_0x10dc0b&&_0x10dc0b['type']!==_0xaeba('0xb1')&&isNotNull(this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]][_0xaeba('0x103')])){delete this[_0xaeba('0x22')][_0x4776a4[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this['voiceQueues'][_0x10dc0b[_0xaeba('0xb3')]]);this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]][_0xaeba('0xdf')]+=0x1;this[_0xaeba('0x1c')][_0x10dc0b['queue']][_0xaeba('0x5a')]+=0x1;_0x4fc6f7=new Hangup(_0x10dc0b,_0x4776a4);_0x4fc6f7[_0xaeba('0xa6')]=0x10;_0x4fc6f7[_0xaeba('0xa7')]=_0xaeba('0x104');_0x4fc6f7[_0xaeba('0xe0')]='AGI';this[_0xaeba('0xca')](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x101')));this['moveContactManagedDialer'](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x102')));}if(_0x10dc0b&&_0x10dc0b['type']!==_0xaeba('0xb1')&&!isNotNull(this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]]['dialQueueProject'])){delete this[_0xaeba('0x22')][_0x4776a4[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]]);this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]]['outboundUnknownCallsDay']+=0x1;_0x4fc6f7=new Hangup(_0x10dc0b,_0x4776a4);_0x4fc6f7[_0xaeba('0xa6')]=0xc;_0x4fc6f7[_0xaeba('0xa7')]=_0x4776a4[_0xaeba('0x105')];_0x4fc6f7[_0xaeba('0xe0')]=_0xaeba('0x106');this[_0xaeba('0xca')](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x101')));this[_0xaeba('0xc8')](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x102')));}};Dialer[_0xaeba('0x17')][_0xaeba('0x107')]=function(_0x3534d6){var _0x556fd4=this[_0xaeba('0x22')][_0x3534d6[_0xaeba('0xdb')]];var _0x4cb206=this;if(this[_0xaeba('0x1c')][_0x3534d6[_0xaeba('0xb3')]]){if(_0x556fd4&&_0x556fd4['type']!==_0xaeba('0xb1')){delete this[_0xaeba('0x22')][_0x3534d6[_0xaeba('0xdb')]];this[_0xaeba('0x1c')][_0x3534d6[_0xaeba('0xb3')]][_0xaeba('0xdf')]+=0x1;var _0x250bb1=new AgentComplete(_0x556fd4,_0x3534d6);if(_0x3534d6[_0xaeba('0x108')]==='agent'){_0x250bb1[_0xaeba('0x109')]=this[_0xaeba('0x1c')][_0x3534d6[_0xaeba('0xb3')]][_0xaeba('0x10a')]&&this['voiceQueues'][_0x3534d6[_0xaeba('0xb3')]]['dialAgiAfterHangupAgent']?moment()[_0xaeba('0x77')](_0xaeba('0xf9')):undefined;}this[_0xaeba('0xca')](_0x250bb1)['catch'](loggerCatch(_0xaeba('0x10b')));this[_0xaeba('0xc8')](_0x250bb1)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x10c')));}}};Dialer[_0xaeba('0x17')][_0xaeba('0x10d')]=function(_0x5d617b){if(this[_0xaeba('0x1c')][_0x5d617b[_0xaeba('0xb3')]]){if(this['uniqueId'][_0x5d617b[_0xaeba('0xdb')]]&&this[_0xaeba('0x22')][_0x5d617b[_0xaeba('0xdb')]][_0xaeba('0x46')]!==_0xaeba('0xb1')){this['updateOriginated'](this[_0xaeba('0x1c')][_0x5d617b['queue']]);this['uniqueId'][_0x5d617b[_0xaeba('0xdb')]][_0xaeba('0x10e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xaeba('0x17')][_0xaeba('0x10f')]=function(_0x406560){this['createHistory'](_0x406560)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x10b')));this[_0xaeba('0xc8')](_0x406560)[_0xaeba('0xb8')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x576781){var _0x33d1fc=this[_0xaeba('0x22')][_0x576781[_0xaeba('0xdb')]];var _0x4f199c=this;if(this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]]){if(_0x33d1fc&&_0x33d1fc[_0xaeba('0x46')]!==_0xaeba('0xb1')){delete this['uniqueId'][_0x576781[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this['voiceQueues'][_0x576781[_0xaeba('0xb3')]]);_0x33d1fc[_0xaeba('0x110')]=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));var _0x5b7c0f=new QueueCallerAbandon(_0x33d1fc,_0x576781);if(getSeconds(_0x33d1fc['droptime'],_0x33d1fc[_0xaeba('0x111')])>=_0x33d1fc[_0xaeba('0x112')]){this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x60')]+=0x1;this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x6a')]+=0x1;_0x5b7c0f[_0xaeba('0xa6')]=0xa;_0x5b7c0f[_0xaeba('0xa7')]=_0xaeba('0x113');_0x5b7c0f[_0xaeba('0x114')]=_0xaeba('0x115');_0x5b7c0f['agiafterat']=this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]]['dialQueueProject2']?moment()['format'](_0xaeba('0xf9')):undefined;_0x5b7c0f['countdropretry']+=0x1;_0x5b7c0f[_0xaeba('0xe6')]+=0x1;if(_0x5b7c0f[_0xaeba('0xed')]>=this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x116')]){this[_0xaeba('0x10f')](_0x5b7c0f);}else{this[_0xaeba('0xc0')]({'active':![],'countdropretry':_0x5b7c0f[_0xaeba('0xed')],'scheduledat':moment()[_0xaeba('0xf6')](this['voiceQueues'][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x117')],'minutes')['format'](_0xaeba('0xf9')),'ContactId':_0x33d1fc['ContactId'],'ListId':_0x33d1fc['ListId'],'VoiceQueueId':_0x33d1fc['VoiceQueueId']||undefined,'CampaignId':_0x33d1fc['CampaignId']||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x118')));var _0x1a8be1=new History(_0x5b7c0f);_0x1a8be1[_0xaeba('0xa6')]=0xa;_0x1a8be1[_0xaeba('0xa7')]=_0xaeba('0x113');_0x1a8be1[_0xaeba('0xa9')]=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));_0x1a8be1[_0xaeba('0xa8')]=_0x1a8be1[_0xaeba('0xa9')];_0x1a8be1[_0xaeba('0x119')]=_0x5b7c0f[_0xaeba('0x119')];_0x1a8be1[_0xaeba('0x11a')]=_0x5b7c0f['calleridnum'];this[_0xaeba('0xca')](_0x1a8be1)['catch'](loggerCatch(_0xaeba('0x11b')));}}else{this[_0xaeba('0x1c')][_0x576781['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5b7c0f[_0xaeba('0xa6')]=0xb;_0x5b7c0f[_0xaeba('0xa7')]=_0xaeba('0x11c');_0x5b7c0f[_0xaeba('0x114')]='CALLEREXIT';_0x5b7c0f['countabandonedretry']+=0x1;_0x5b7c0f[_0xaeba('0xe6')]+=0x1;if(_0x5b7c0f['countabandonedretry']>=this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x11d')]){this[_0xaeba('0x10f')](_0x5b7c0f);}else{this[_0xaeba('0xc0')]({'active':![],'countabandonedretry':_0x5b7c0f[_0xaeba('0xee')],'scheduledat':moment()[_0xaeba('0xf6')](this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x11e')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x33d1fc['ContactId'],'ListId':_0x33d1fc[_0xaeba('0xd4')],'VoiceQueueId':_0x33d1fc[_0xaeba('0xd5')]||undefined,'CampaignId':_0x33d1fc['CampaignId']||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x11f')));var _0x1a8be1=new History(_0x5b7c0f);_0x1a8be1['state']=0xb;_0x1a8be1[_0xaeba('0xa7')]='Abandoned';_0x1a8be1['starttime']=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));_0x1a8be1[_0xaeba('0xa8')]=_0x1a8be1['starttime'];_0x1a8be1[_0xaeba('0x119')]=_0x5b7c0f[_0xaeba('0x119')];_0x1a8be1[_0xaeba('0x11a')]=_0x5b7c0f['calleridnum'];this[_0xaeba('0xca')](_0x1a8be1)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x120')));}}}}};Dialer[_0xaeba('0x17')][_0xaeba('0x30')]=function(_0xf0bf58){if(this['actions'][_0xf0bf58[_0xaeba('0xdb')]]){this['actions'][_0xf0bf58[_0xaeba('0xdb')]][_0xaeba('0x121')]=_0xf0bf58[_0xaeba('0x121')];}if(this[_0xaeba('0x22')][_0xf0bf58[_0xaeba('0xdb')]]){this[_0xaeba('0x22')][_0xf0bf58[_0xaeba('0xdb')]]['channel']=_0xf0bf58['channel'];}};Dialer['prototype'][_0xaeba('0x33')]=function(_0x428f6e){if(strategy[this['voiceQueues'][this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x48')]]===_0xaeba('0x16')){if(this[_0xaeba('0xac')][_0x428f6e['actionid']]&&_[_0xaeba('0xad')](this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0x123')])&&_0x428f6e[_0xaeba('0xaf')]==='1'&&_0x428f6e[_0xaeba('0x124')]==='0'){if(this[_0xaeba('0x1e')][_0x428f6e[_0xaeba('0x125')]]){if(!this[_0xaeba('0x1e')][_0x428f6e[_0xaeba('0x125')]][_0xaeba('0x123')]){this[_0xaeba('0x1e')][_0x428f6e[_0xaeba('0x125')]]['locked']=!![];this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0x123')]=!![];this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0x125')]=_0x428f6e[_0xaeba('0x125')];}}}}else if((strategy[this[_0xaeba('0x1c')][this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x48')]]||'rrmemory')===_0xaeba('0x126')){if(this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]]){if(this[_0xaeba('0x1e')][_0x428f6e[_0xaeba('0x125')]]){this['actions'][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0x125')]=_0x428f6e['stateinterface'];if(_[_0xaeba('0xad')](this['queueBooked'][this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]]['queue']])){this[_0xaeba('0x127')][this[_0xaeba('0xac')][_0x428f6e['actionid']]['queue']]=[];}this[_0xaeba('0x127')][this[_0xaeba('0xac')][_0x428f6e['actionid']][_0xaeba('0xb3')]][_0xaeba('0x128')](_['merge'](_[_0xaeba('0xd2')](this['actions'][_0x428f6e[_0xaeba('0x122')]],['idHopper','stateinterface']),{'status':_0x428f6e[_0xaeba('0xaf')],'paused':_0x428f6e['paused']}));}}}};function unlockQueueStatus(_0x106003,_0x3a932c){setTimeout(function(){if(_['isUndefined'](_0x106003[_0xaeba('0x129')])){loggerBooked[_0xaeba('0x92')](_0xaeba('0x12a'),_0x3a932c);}_0x106003['queueStatusComplete']=!![];loggerBooked[_0xaeba('0x7b')]('[booked][unlockQueueStatus]',_0x3a932c,JSON['stringify'](_['pick'](_0x106003,[_0xaeba('0x3b'),_0xaeba('0x129')])));},0x1f3);}Dialer[_0xaeba('0x17')]['syncQueueStatusComplete']=function(_0x3dca9c){var _0x5ba14f=this;var _0x51aac5=_0x5ba14f['voiceQueues'][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]];if(strategy[this[_0xaeba('0x1c')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x48')]]==='roundrobin'){if(this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]&&this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0x125')]){this[_0xaeba('0x1b')][_0xaeba('0x12b')](this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0x12c')],this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]['stateinterface'])[_0xaeba('0xb8')](function(_0x29d763){logger[_0xaeba('0x92')](_0xaeba('0x12d'),util[_0xaeba('0x93')](_0x29d763,{'showHidden':![],'depth':null}));})[_0xaeba('0x12e')](function(){_0x5ba14f['updateOriginated'](_0x5ba14f[_0xaeba('0x1c')][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]);_0x5ba14f['agents'][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c['actionid']][_0xaeba('0x125')]]['locked']=![];delete _0x5ba14f['actions'][_0x3dca9c[_0xaeba('0x122')]];unlockQueueStatus(_0x51aac5);});}else{this[_0xaeba('0xb2')](this[_0xaeba('0x1c')][this['actions'][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x3dca9c[_0xaeba('0x122')]]['ContactId'],'ListId':this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xd4')],'VoiceQueueId':this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xaeba('0xac')][_0x3dca9c['actionid']][_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x3dca9c[_0xaeba('0x122')]];unlockQueueStatus(_0x51aac5);}}else if((strategy[this['voiceQueues'][this['actions'][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x48')]]||_0xaeba('0x126'))===_0xaeba('0x126')){var _0x2e92e0;if(this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]&&!_[_0xaeba('0x40')](this[_0xaeba('0x127')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]])){if(this[_0xaeba('0x26')][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]['queue']]){this[_0xaeba('0x26')][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]=this[_0xaeba('0x26')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]?this[_0xaeba('0x26')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]['queue']]:this[_0xaeba('0x127')][this['actions'][_0x3dca9c['actionid']][_0xaeba('0xb3')]]?this[_0xaeba('0x127')][this['actions'][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]['_rr']||0x0:0x0;}this[_0xaeba('0x127')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x12f')]=this[_0xaeba('0x26')][this['actions'][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]];for(var _0x1ee690=0x0;_0x1ee690=0x0;})[_0xaeba('0xb8')](myreject(_0x20f4ec)));}}else{_0x2f6485[_0xaeba('0x128')](ami[_0xaeba('0xae')]({'action':'command','command':util[_0xaeba('0x77')](_0xaeba('0x14e'),_0x20b568,!_[_0xaeba('0x84')](config[_0xaeba('0x14b')][_0x515f4c])?_0x515f4c:'')})[_0xaeba('0x37')](function(_0x198234){return _0x198234[_0xaeba('0x14c')][_0xaeba('0x14f')]('true')>=0x0;})[_0xaeba('0xb8')](myreject(_0x20f4ec)));}BPromise[_0xaeba('0x150')](_0x2f6485)['then'](function(_0x42f508){var _0x439b06=_['some'](_0x42f508);if(_0x439b06){return _0x56bd47(_0x439b06);}else{_0x3aaa03[_0xaeba('0x39')]=_0x4738f0?_0xaeba('0x151'):_0xaeba('0x152');return _0x20f4ec(msgResponse(_0xaeba('0x153'),_0xaeba('0x145'),_0xaeba('0x154')+_0x4738f0+'\x20'+_0x512eda+_0xaeba('0x155')+util[_0xaeba('0x93')](_0x20b568,{'showHidden':![],'depth':null})+_0xaeba('0x156')+_0x515f4c));}})['catch'](function(_0x15c948){return _0x20f4ec(msgResponse('ifTime',_0xaeba('0x145'),JSON['stringify'](_0x15c948)));});});};Dialer[_0xaeba('0x17')][_0xaeba('0x157')]=function(_0x1835f6){var _0x42fc33=this;return function(){switch(_0x1835f6[_0xaeba('0x158')]){case _0xaeba('0x159'):freeVariablesPredictive(_0x1835f6);_0x42fc33[_0xaeba('0x15a')](_0x1835f6,0x1);break;case _0xaeba('0x15b'):freeVariablesPredictive(_0x1835f6);_0x42fc33[_0xaeba('0x15a')](_0x1835f6,_0x1835f6[_0xaeba('0x15c')]);break;case'predictive':_0x42fc33['predictive'](_0x1835f6);break;case'booked':freeVariablesPredictive(_0x1835f6);_0x42fc33[_0xaeba('0x15a')](_0x1835f6,0x1);break;default:freeVariablesPredictive(_0x1835f6);logger[_0xaeba('0x92')](_0xaeba('0x15d'),_0x1835f6['name'],_0xaeba('0x15e'));}};};Dialer['prototype'][_0xaeba('0x15f')]=function(_0x12531f){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopper[_0xaeba('0x160')](_0x12531f['id'],previewRecallmeReminderInterval))[_0xaeba('0x37')](function(_0x216640){for(var _0x3abbf3=0x0;_0x3abbf3<_0x216640[_0xaeba('0x95')];_0x3abbf3++){var _0x4d8f33=_0x216640[_0x3abbf3]['Agent']['name'];if(_0x4d8f33)io['to'](util[_0xaeba('0x77')](_0xaeba('0x161'),_0x4d8f33))[_0xaeba('0x45')](_0xaeba('0x162'),{'hopper':_0x216640[_0x3abbf3]});}})[_0xaeba('0xb8')](function(_0x49b4bc){});};Dialer['prototype']['launchHandleIvr']=function(_0x3d88f4){var _0x1c7b0b=this;return function(){_0x1c7b0b[_0xaeba('0x163')](_0x3d88f4);};};Dialer[_0xaeba('0x17')][_0xaeba('0x9')]=function(_0x5bf283){var _0x4849e2=this;if(isNotPreview(_0x5bf283['dialMethod'])){if(isVoiceQueueOutbound(_0x5bf283[_0xaeba('0x46')])&&isActive(_0x5bf283[_0xaeba('0x164')])){_0x5bf283[_0xaeba('0x9f')]=!![];BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](checkIsLoggedIn(_0x5bf283,_0x5bf283[_0xaeba('0x4b')]))[_0xaeba('0x37')](checkIsActive(_0x5bf283,_0x5bf283[_0xaeba('0x164')]))[_0xaeba('0x37')](checkInterval(_0x5bf283))[_0xaeba('0x37')](_0x4849e2[_0xaeba('0x13e')](_0x5bf283))[_0xaeba('0x37')](_0x4849e2[_0xaeba('0x142')](_0x5bf283[_0xaeba('0x165')],_0x5bf283['dialTimezone'],_0x5bf283[_0xaeba('0x3b')],_0x5bf283))[_0xaeba('0x37')](_0x4849e2[_0xaeba('0x144')](_0x5bf283[_0xaeba('0x3c')],_0x5bf283[_0xaeba('0x166')],_0x5bf283[_0xaeba('0x3b')],_0x5bf283))[_0xaeba('0x37')](_0x4849e2[_0xaeba('0x157')](_0x5bf283))[_0xaeba('0xb8')](loggerCatchQueueSummary(_0xaeba('0x167'),_0x5bf283));}else{notSendMessagesQueue(_0x5bf283);}}else{freeVariablesPredictive(_0x5bf283);if(_0x5bf283[_0xaeba('0x168')]){_0x4849e2[_0xaeba('0x15f')](_0x5bf283);}}};Dialer[_0xaeba('0x17')]['syncCampaigns']=function(){var _0x3159ab=this;var _0x4bc2fa;for(var _0x9a7408 in this[_0xaeba('0x1d')]){if(typeof this[_0xaeba('0x1d')][_0x9a7408]!=='undefined'){_0x4bc2fa=this[_0xaeba('0x1d')][_0x9a7408];if(isCampaignIvr(_0x4bc2fa[_0xaeba('0x46')])&&isActive(_0x4bc2fa[_0xaeba('0x74')])){_0x4bc2fa[_0xaeba('0x9f')]=!![];BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](checkIsActive(_0x4bc2fa,_0x4bc2fa['active']))['then'](checkInterval(_0x4bc2fa))[_0xaeba('0x37')](_0x3159ab[_0xaeba('0x13e')](_0x4bc2fa))[_0xaeba('0x37')](_0x3159ab[_0xaeba('0x142')](_0x4bc2fa[_0xaeba('0x165')],_0x4bc2fa[_0xaeba('0x166')],_0x4bc2fa[_0xaeba('0x3b')],_0x4bc2fa))['then'](_0x3159ab[_0xaeba('0x144')](_0x4bc2fa[_0xaeba('0x3c')],_0x4bc2fa[_0xaeba('0x166')],_0x4bc2fa[_0xaeba('0x3b')],_0x4bc2fa))[_0xaeba('0x37')](_0x3159ab[_0xaeba('0x169')](_0x4bc2fa))[_0xaeba('0xb8')](loggerCatchQueueSummary(_0xaeba('0x16a'),_0x4bc2fa));}else{notSendMessagesCampaign(_0x4bc2fa);}}}};function getCallerIdRandom(_0x2d33ab,_0x3ba19b){var _0x44083e;var _0x4119fe;var _0xaabf2d;if(_0x3ba19b<=0x0){_0x3ba19b=0x1;}_0x44083e=new RegExp(_0xaeba('0x16b')+_0x3ba19b+'}$');_0x4119fe=Math[_0xaeba('0x16c')](0xa,_0x3ba19b-0x1);_0xaabf2d=Math[_0xaeba('0x16c')](0xa,_0x3ba19b)-0x1;return util[_0xaeba('0x77')]('%s',_['replace'](_0x2d33ab,_0x44083e,_[_0xaeba('0x16d')](_0x4119fe,_0xaabf2d)));}function extractCalleridName(_0x5bb969){var _0xf6f624=_0x5bb969[_0xaeba('0x16e')](/"(.*?)"/);return _0xf6f624?_0xf6f624[0x1]:_0x5bb969;}function extractCalleridNumber(_0x2825c3){var _0x344877=_0x2825c3[_0xaeba('0x16e')](/<(.*?)>/);return _0x344877?_0x344877[0x1]:_0x2825c3;}Dialer[_0xaeba('0x17')][_0xaeba('0x16f')]=function(_0x4f54c0,_0x55edd6){var _0x24eba9=this;var _0x4128a8=uuid['v4']();this[_0xaeba('0xac')][_0x4128a8]=new Action(_0x4f54c0,_0x55edd6,_0x4128a8);return new BPromise(function(_0x18cdb7,_0x2490e1){if(_[_0xaeba('0x84')](_0x4f54c0)&&typeof _0x4f54c0!==_0xaeba('0x170')){return _0x2490e1(msgResponse(_0xaeba('0x171'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xaeba('0x84')](_0x55edd6[_0xaeba('0x172')][_0xaeba('0x173')])||_0x55edd6['Contact'][_0xaeba('0x173')]===null){return _0x2490e1(msgResponse(_0xaeba('0x171'),_0xaeba('0x145'),'contact\x20is\x20undefine'));}var _0x5878e8={'XMD-CALLERID':_0x24eba9[_0xaeba('0xac')][_0x4128a8][_0xaeba('0x174')](),'XMD-AGI':_0x4f54c0[_0xaeba('0x103')]?util[_0xaeba('0x77')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4f54c0[_0xaeba('0x103')]):'NONE','XMD-AGIAFTER':_0x4f54c0[_0xaeba('0x10a')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4f54c0[_0xaeba('0x10a')]):_0xaeba('0x175'),'XMD-QUEUE':_0x4f54c0['type']===_0xaeba('0x47')?util['format'](_0xaeba('0x176'),_0x4f54c0[_0xaeba('0x3b')],_0x4f54c0[_0xaeba('0x177')]||'',_0x4f54c0[_0xaeba('0x178')]?'c':'',_0x4f54c0[_0xaeba('0x112')]||0x3):'NONE','XMD-CONTACTID':_0x55edd6[_0xaeba('0xd3')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x24eba9[_0xaeba('0xac')][_0x4128a8][_0xaeba('0x174')](),'XMD-AMD':_0x4f54c0[_0xaeba('0xe4')]?_0xaeba('0x179'):_0xaeba('0x175'),'XMD-DESTINATION':_0xaeba('0x17a')};if(_0x4f54c0[_0xaeba('0xe4')]){_0x5878e8[_0xaeba('0x17b')]=_0x4f54c0[_0xaeba('0x17c')]||0x9c4;_0x5878e8['XMD-AMDGREETING']=_0x4f54c0[_0xaeba('0x17d')]||0x5dc;_0x5878e8['XMD-AMDAFTERGREETINGSILENCE']=_0x4f54c0['dialAMDAfterGreetingSilence']||0x320;_0x5878e8['XMD-AMDTOTALANALYSISTIME']=_0x4f54c0[_0xaeba('0x17e')]||0x1388;_0x5878e8[_0xaeba('0x17f')]=_0x4f54c0[_0xaeba('0x180')]||0x64;_0x5878e8[_0xaeba('0x181')]=_0x4f54c0[_0xaeba('0x182')]||0x32;_0x5878e8['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4f54c0[_0xaeba('0x183')]||0x3;_0x5878e8['XMD-AMDSILENCETHRESHOLD']=_0x4f54c0[_0xaeba('0x184')]||0x100;_0x5878e8[_0xaeba('0x185')]=_0x4f54c0[_0xaeba('0x186')]||0x1388;}if(_0x4f54c0['type']===_0xaeba('0x47')){_0x5878e8[_0xaeba('0x187')]=_0x55edd6[_0xaeba('0xd5')];}else{_0x5878e8[_0xaeba('0x188')]=_0x55edd6['CampaignId'];}for(var _0x381b2a in _0x55edd6['Contact']){if(typeof _0x55edd6[_0xaeba('0x172')][_0x381b2a]!==_0xaeba('0x97')){if(isNotNull(_0x55edd6[_0xaeba('0x172')][_0x381b2a])&&_0x381b2a!=='id'&&_0x381b2a!==_0xaeba('0x189')&&_0x381b2a!=='createdAt'&&_0x381b2a!==_0xaeba('0x18a')){_0x5878e8[util['format'](_0xaeba('0x18b'),'XMD-',_[_0xaeba('0x18c')](_0x381b2a))]=_0x55edd6[_0xaeba('0x172')][_0x381b2a];}}}var _0x313c02=_0x24eba9[_0xaeba('0xd9')](_0x4f54c0[_0xaeba('0x73')])?getCallerId(_0x4f54c0[_0xaeba('0x73')][_0xaeba('0x75')],_0x4f54c0[_0xaeba('0x56')],_0x4f54c0[_0xaeba('0x18d')]>0x0?getCallerIdRandom(_0x4f54c0[_0xaeba('0x57')],_0x4f54c0['dialRandomLastDigitCallerIdNumber']):_0x4f54c0[_0xaeba('0x57')]):getCallerId(_[_0xaeba('0xad')](_0x4f54c0[_0xaeba('0x13f')])?_0x4f54c0[_0xaeba('0x73')]['callerid']:_0x4f54c0[_0xaeba('0x13f')][_0xaeba('0x75')],_0x4f54c0[_0xaeba('0x56')],_0x4f54c0[_0xaeba('0x18d')]>0x0?getCallerIdRandom(_0x4f54c0[_0xaeba('0x57')],_0x4f54c0[_0xaeba('0x18d')]):_0x4f54c0[_0xaeba('0x57')]);if(_0x313c02){_0x5878e8[_0xaeba('0x18e')]=_0x24eba9['actions'][_0x4128a8]['originatecalleridname']=extractCalleridName(_0x313c02);_0x5878e8[_0xaeba('0x18f')]=_0x24eba9['actions'][_0x4128a8][_0xaeba('0x190')]=extractCalleridNumber(_0x313c02);}return ami[_0xaeba('0xae')]({'actionid':_0x4128a8,'action':_0xaeba('0x171'),'channel':_0x24eba9[_0xaeba('0xd9')](_0x4f54c0[_0xaeba('0x73')])?util[_0xaeba('0x77')](_0xaeba('0x191'),_0x4f54c0[_0xaeba('0x73')][_0xaeba('0x3b')],isNotNull(_0x4f54c0['dialPrefix'])?_0x4f54c0[_0xaeba('0x59')][_0xaeba('0x192')]()||'':'',_0x4f54c0[_0xaeba('0x193')]>0x0?_0x55edd6[_0xaeba('0x172')][_0xaeba('0x173')]['substring'](_0x4f54c0[_0xaeba('0x193')]):_0x55edd6[_0xaeba('0x172')]['phone']):util[_0xaeba('0x77')](_0xaeba('0x191'),_['isNil'](_0x4f54c0[_0xaeba('0x13f')])?_0x4f54c0['Trunk'][_0xaeba('0x3b')]:_0x4f54c0['TrunkBackup']['name'],isNotNull(_0x4f54c0[_0xaeba('0x59')])?_0x4f54c0[_0xaeba('0x59')][_0xaeba('0x192')]()||'':'',_0x4f54c0['dialCutDigit']>0x0?_0x55edd6[_0xaeba('0x172')]['phone'][_0xaeba('0x194')](_0x4f54c0[_0xaeba('0x193')]):_0x55edd6[_0xaeba('0x172')][_0xaeba('0x173')]),'callerid':_0x313c02,'Exten':'xcally-motion-dialer','Context':_0xaeba('0x195'),'Priority':'1','variable':_0x5878e8,'timeout':(_0x4f54c0[_0xaeba('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4128a8})[_0xaeba('0x37')](function(_0x1249a9){return _0x18cdb7(_0x1249a9);})[_0xaeba('0xb8')](function(_0x513a5d){_0x4f54c0[_0xaeba('0x62')]+=0x1;var _0x3f096b=new History(_0x24eba9['actions'][_0x4128a8]);logger[_0xaeba('0x92')](util[_0xaeba('0x77')](_0xaeba('0x196'),JSON[_0xaeba('0x76')](_0x513a5d)));_0x3f096b[_0xaeba('0xa6')]=0xe;_0x3f096b['statedesc']=_0xaeba('0x197');_0x3f096b['starttime']=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));_0x3f096b[_0xaeba('0xa8')]=_0x3f096b[_0xaeba('0xa9')];_0x24eba9[_0xaeba('0xca')](_0x3f096b)['catch'](loggerCatch(_0xaeba('0x198')));_0x24eba9['moveContactManagedDialer'](_0x3f096b)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x198')))[_0xaeba('0x12e')](function(){delete _0x24eba9['actions'][_0x4128a8];return _0x2490e1(msgResponse(_0xaeba('0x171'),_0xaeba('0x42'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0xaeba('0x2a')]=function(_0x458a3b){var _0x5c808a=this[_0xaeba('0xac')][_0x458a3b[_0xaeba('0x122')]];if(_0x5c808a){delete this[_0xaeba('0xac')][_0x458a3b[_0xaeba('0x122')]];_0x5c808a['responsetime']=moment()['format'](_0xaeba('0xf9'));var _0x345446=_0x5c808a[_0xaeba('0x46')]===_0xaeba('0xb1')?this['campaigns'][_0x5c808a[_0xaeba('0xb3')]]:this['voiceQueues'][_0x5c808a[_0xaeba('0x199')]()];if(!this[_0xaeba('0xd8')](_0x458a3b['response'])){this[_0xaeba('0xb2')](_0x345446);return this['callProgressDetecting'](_0x5c808a,_0x345446,_0x458a3b)[_0xaeba('0xb8')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xaeba('0x22')][_0x458a3b[_0xaeba('0xdb')]]=_0x5c808a;}};Dialer['prototype']['checkRetriveMax']=function(_0x25ea49,_0x57e29e,_0x458f40){var _0x252f45=new History(_0x57e29e);if(_0x252f45[_0xaeba('0xe9')]+_0x252f45['countcongestionretry']+_0x252f45[_0xaeba('0xeb')]+_0x252f45['countnosuchnumberretry']+_0x252f45['countdropretry']+_0x252f45[_0xaeba('0xee')]+_0x252f45[_0xaeba('0xef')]+_0x252f45[_0xaeba('0xf0')]>=_0x458f40[_0xaeba('0xf1')]-0x1){return!![];}switch(_0x25ea49){case 0x3:if(_0x252f45[_0xaeba('0xeb')]>=_0x458f40[_0xaeba('0x19a')]-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countnoanswerretry':_0x252f45[_0xaeba('0xeb')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x19b')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45['ContactId'],'ListId':_0x252f45['ListId'],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45['CampaignId']||undefined})['catch'](loggerCatch(_0xaeba('0x19c')));break;case 0x5:if(_0x252f45[_0xaeba('0xe9')]>=_0x458f40['dialBusyMaxRetry']-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countbusyretry':_0x252f45[_0xaeba('0xe9')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x19d')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45['ListId'],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x252f45[_0xaeba('0xea')]>=_0x458f40[_0xaeba('0x19e')]-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countcongestionretry':_0x252f45[_0xaeba('0xea')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x19f')],_0xaeba('0xf8'))['format'](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45['VoiceQueueId']||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1a0')));break;case 0x0:if(_0x252f45[_0xaeba('0xec')]>=_0x458f40['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xaeba('0xc0')]({'active':![],'countnosuchnumberretry':_0x252f45[_0xaeba('0xec')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x1a1')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45['VoiceQueueId']||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x252f45['countdropretry']>=_0x458f40[_0xaeba('0x116')]-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countdropretry':_0x252f45[_0xaeba('0xed')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x117')],_0xaeba('0xf8'))['format'](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})['catch'](loggerCatch(_0xaeba('0x118')));break;case 0xb:if(_0x252f45['countabandonedretry']>=_0x458f40['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countabandonedretry':_0x252f45[_0xaeba('0xee')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x11e')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45['ContactId'],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x11f')));break;case 0x13:if(_0x252f45['countmachineretry']>=_0x458f40['dialMachineMaxRetry']-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countmachineretry':_0x252f45[_0xaeba('0xef')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0xf7')],'minutes')['format'](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45['ListId'],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xfb')));break;case 0x14:if(_0x252f45[_0xaeba('0xf0')]>=_0x458f40[_0xaeba('0x1a2')]-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countagentrejectretry':_0x252f45[_0xaeba('0xf0')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x1a3')],'minutes')[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xaeba('0x17')][_0xaeba('0x1a4')]=function(_0x303b4c,_0x523c5d,_0x2b4b36){var _0x3a694f=this;var _0x1380fa=new History(_0x303b4c);return new BPromise(function(_0x197fc0,_0x5e09e7){if(_[_0xaeba('0x84')](_0x523c5d)&&typeof _0x523c5d!==_0xaeba('0x170')){return _0x5e09e7(msgResponse(_0xaeba('0x1a5'),'Failure','entity\x20is\x20undefine'));}if(_[_0xaeba('0x84')](_0x2b4b36)&&typeof _0x2b4b36!=='object'){return _0x5e09e7(msgResponse('[callProgressDetecting]',_0xaeba('0x145'),_0xaeba('0x1a6')));}switch(_0x2b4b36[_0xaeba('0x108')]){case'0':_0x523c5d['outboundNoSuchCallsDay']+=0x1;_0x1380fa[_0xaeba('0xa6')]=0x0;_0x1380fa['statedesc']=_0xaeba('0x1a7');_0x1380fa[_0xaeba('0xec')]+=0x1;_0x1380fa[_0xaeba('0xe6')]+=0x1;ami[_0xaeba('0x45')](_0xaeba('0x1a8'),ut[_0xaeba('0xe8')](_0x303b4c,_0xaeba('0x1a9')));_0x3a694f['createHistory'](_0x1380fa)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xff')));if(_0x3a694f[_0xaeba('0x1aa')](0x0,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xec')]>=_0x523c5d[_0xaeba('0x1ab')]){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1ac'));}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1ac'));}}break;case'3':_0x523c5d['outboundNoAnswerCallsDay']+=0x1;_0x1380fa['state']=0x3;_0x1380fa[_0xaeba('0xa7')]=_0xaeba('0x1ad');_0x1380fa[_0xaeba('0xeb')]+=0x1;_0x1380fa[_0xaeba('0xe6')]+=0x1;ami[_0xaeba('0x45')]('custom:agentnoanswer',ut[_0xaeba('0xe8')](_0x303b4c,_0xaeba('0x1ae')));_0x3a694f[_0xaeba('0xca')](_0x1380fa)['catch'](loggerCatch(_0xaeba('0x1af')));if(_0x3a694f[_0xaeba('0x1aa')](0x3,_0x303b4c,_0x523c5d)){if(_0x1380fa['countnoanswerretry']>=_0x523c5d['dialNoAnswerMaxRetry']){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,'reason\x203\x20ringing\x20no\x20answer');}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1b0'));}}break;case'5':_0x523c5d[_0xaeba('0x5c')]+=0x1;_0x1380fa[_0xaeba('0xa6')]=0x5;_0x1380fa['statedesc']=_0xaeba('0x1b1');_0x1380fa['countbusyretry']+=0x1;_0x1380fa[_0xaeba('0xe6')]+=0x1;ami[_0xaeba('0x45')](_0xaeba('0x1b2'),ut['buildObj'](_0x303b4c,_0xaeba('0x1b3')));_0x3a694f[_0xaeba('0xca')](_0x1380fa)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1b4')));if(_0x3a694f[_0xaeba('0x1aa')](0x5,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xe9')]>=_0x523c5d['dialBusyMaxRetry']){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1b5'));}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,'reason\x205\x20busy');}}break;case'8':_0x523c5d[_0xaeba('0x5d')]+=0x1;_0x1380fa[_0xaeba('0xa6')]=0x8;_0x1380fa[_0xaeba('0xa7')]=_0xaeba('0x1b6');_0x1380fa[_0xaeba('0xea')]+=0x1;_0x1380fa['countglobal']+=0x1;ami[_0xaeba('0x45')](_0xaeba('0x1b7'),ut[_0xaeba('0xe8')](_0x303b4c,_0xaeba('0x1b8')));_0x3a694f[_0xaeba('0xca')](_0x1380fa)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1b9')));if(_0x3a694f[_0xaeba('0x1aa')](0x8,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xea')]>=_0x523c5d['dialCongestionMaxRetry']){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1ba'));}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1ba'));}}break;case'11':_0x523c5d[_0xaeba('0x1bb')]+=0x1;_0x1380fa[_0xaeba('0xa6')]=0xb;_0x1380fa[_0xaeba('0xa7')]=_0xaeba('0x11c');_0x1380fa[_0xaeba('0xee')]+=0x1;_0x1380fa['countglobal']+=0x1;_0x3a694f[_0xaeba('0xca')](_0x1380fa)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x120')));if(_0x3a694f[_0xaeba('0x1aa')](0xb,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xee')]>=_0x523c5d[_0xaeba('0x11d')]){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1bc'));}else{_0x3a694f['stateGlobal'](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1bc'));}}break;case'20':_0x523c5d[_0xaeba('0x1bd')]+=0x1;_0x1380fa[_0xaeba('0xa6')]=0x14;_0x1380fa[_0xaeba('0xa7')]=_0xaeba('0x1be');_0x1380fa['countagentrejectretry']+=0x1;_0x1380fa['countglobal']+=0x1;ami[_0xaeba('0x45')](_0xaeba('0x1bf'),ut[_0xaeba('0xe8')](_0x303b4c,_0xaeba('0x1c0')));_0x3a694f[_0xaeba('0xca')](_0x1380fa)[_0xaeba('0xb8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x3a694f[_0xaeba('0x1aa')](0x14,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xf0')]>=_0x523c5d[_0xaeba('0x1a2')]){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1c1'));}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1c1'));}}break;default:_0x523c5d[_0xaeba('0x64')]+=0x1;_0x1380fa['state']=0xc;_0x1380fa[_0xaeba('0xa7')]=_0x2b4b36[_0xaeba('0x108')];_0x3a694f[_0xaeba('0xca')](_0x1380fa)['catch'](loggerCatch(_0xaeba('0x1c2')));if(_0x3a694f[_0xaeba('0x1aa')](_0x2b4b36[_0xaeba('0x108')],_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xe9')]+_0x1380fa['countcongestionretry']+_0x1380fa[_0xaeba('0xeb')]+_0x1380fa[_0xaeba('0xec')]+_0x1380fa[_0xaeba('0xed')]+_0x1380fa['countabandonedretry']+_0x1380fa['countmachineretry']+_0x1380fa[_0xaeba('0xf0')]>=_0x523c5d[_0xaeba('0xf1')]){_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0x2b4b36['reason']);}else{_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0x2b4b36[_0xaeba('0x108')]);}}}});};Dialer['prototype'][_0xaeba('0xf2')]=function(_0x30e744,_0x4cac7e,_0x35966e,_0x50e435){var _0x217dd6=new Final(_0x30e744);_0x217dd6[_0xaeba('0xa6')]=0xf;_0x217dd6[_0xaeba('0xa7')]='Global';this[_0xaeba('0xf4')](_0x217dd6,_0x4cac7e,_0x35966e,_0x50e435);};Dialer['prototype'][_0xaeba('0xf4')]=function(_0x5f2a42,_0x33a1d6,_0xe9b46,_0x45cc3b){this[_0xaeba('0xc8')](_0x5f2a42)[_0xaeba('0x37')](function(){return _0x33a1d6(msgResponse(_0xaeba('0x1a5'),'Success',_0x45cc3b));})[_0xaeba('0xb8')](function(){return _0xe9b46(msgResponse(_0xaeba('0x1c3'),_0xaeba('0x145'),_0xaeba('0x1c4')));});};Dialer[_0xaeba('0x17')][_0xaeba('0x1c5')]=function(_0x26f938){var _0x4e3c2d=_0x26f938[_0xaeba('0x1c6')]/0x64;var _0x294ab7=_0x26f938[_0xaeba('0x60')]/(_0x26f938[_0xaeba('0x60')]+_0x26f938[_0xaeba('0xdf')]);var _0x4e9d44=Math['round'](_0x26f938[_0xaeba('0x1c7')]*(_0x26f938[_0xaeba('0x1c8')]/0x64));var _0x335680=Math['round'](_0x26f938[_0xaeba('0x1c7')]*(_0x26f938[_0xaeba('0x1c9')]/0x64));var _0x366604=_0x26f938[_0xaeba('0x4a')]+_0x26f938['talking'];var _0x2bb3d0=Math['floor'](_0x26f938[_0xaeba('0x6f')]*_0x26f938[_0xaeba('0x71')]*_0x26f938[_0xaeba('0x6b')]*_0x26f938[_0xaeba('0x6c')]);if(_[_0xaeba('0x84')](_0x26f938[_0xaeba('0x25')])){if(!_[_0xaeba('0x84')](_0x26f938[_0xaeba('0x24')])){_0x26f938[_0xaeba('0x24')]=undefined;loggerPredictive[_0xaeba('0x92')](_0xaeba('0x1ca'),_0xaeba('0x1cb'));}if(!_['isUndefined'](_0x26f938[_0xaeba('0x8e')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xaeba('0x1cc'));clearInterval(_0x26f938[_0xaeba('0x8e')]);_0x26f938[_0xaeba('0x8e')]=undefined;}_0x26f938[_0xaeba('0x25')]=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));loggerPredictive[_0xaeba('0x7b')](_0x26f938[_0xaeba('0x3b')],_0xaeba('0x1cd'),_0x26f938[_0xaeba('0x25')]);this[_0xaeba('0x15a')](_0x26f938,0x1);}else if(ifInterval(_0x26f938[_0xaeba('0x1ce')],_0x26f938[_0xaeba('0x25')])){this[_0xaeba('0x15a')](_0x26f938,0x1);loggerPredictiveCalls[_0xaeba('0x7b')]('[startMethodPredictive][StartProgressive][Loop]',_0x26f938['startProgressive'],_0x26f938['name']);_0x26f938[_0xaeba('0x6f')]=0x0;_0x26f938['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4e3c2d<_0x294ab7&&_0x26f938[_0xaeba('0x1cf')]===_0xaeba('0x1d0')){freeVariablesPredictive(_0x26f938);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x1d1'),_0xaeba('0x1d2'),_0x294ab7,'startProgressive',_0x26f938[_0xaeba('0x3b')]);}else if(_0x2bb3d0<_0x26f938[_0xaeba('0x6a')]&&_0x26f938[_0xaeba('0x1cf')]===_0xaeba('0x1d0')){freeVariablesPredictive(_0x26f938);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x1d3'),_0xaeba('0x1d4'),_0x2bb3d0,'Drop\x20in\x20this\x20interval',_0x26f938[_0xaeba('0x6a')],_0xaeba('0x25'),_0x26f938[_0xaeba('0x3b')]);}else if(!ifInterval(_0x26f938[_0xaeba('0x1ce')],_0x26f938[_0xaeba('0x25')])&&_[_0xaeba('0x84')](_0x26f938[_0xaeba('0x24')])&&!_['isUndefined'](_0x26f938[_0xaeba('0x25')])){_0x26f938[_0xaeba('0x24')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x26f938[_0xaeba('0x3b')],_0xaeba('0x1d5'),_0x26f938[_0xaeba('0x24')]);this[_0xaeba('0xbe')](_0x26f938[_0xaeba('0x1ce')])[_0xaeba('0x37')](this['getDataPredictive'](_0x26f938))[_0xaeba('0x37')](mergeDataErlangB(_0x26f938))[_0xaeba('0x37')](this[_0xaeba('0x1d6')](_0x26f938))[_0xaeba('0xb8')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x26f938));}else if(!ifInterval(_0x26f938[_0xaeba('0x1ce')],_0x26f938[_0xaeba('0x24')])){_0x26f938[_0xaeba('0x6a')]=0x0;_0x26f938[_0xaeba('0x24')]=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));loggerPredictive['info'](_0x26f938[_0xaeba('0x3b')],_0xaeba('0x1d7'),_0x26f938[_0xaeba('0x24')]);clearInterval(_0x26f938['handlePredictive']);_0x26f938[_0xaeba('0x8e')]=undefined;this['averageHandleTime'](_0x26f938[_0xaeba('0x1ce')])[_0xaeba('0x37')](this[_0xaeba('0x1d8')](_0x26f938))[_0xaeba('0x37')](mergeDataErlangB(_0x26f938))['then'](this[_0xaeba('0x1d6')](_0x26f938))[_0xaeba('0xb8')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x26f938));}else if(_0x26f938['predictiveIntervalAvailable']&&_0x366604<_0x26f938[_0xaeba('0x1c7')]-_0x335680){freeVariablesPredictive(_0x26f938);loggerPredictive[_0xaeba('0x7b')](_0x26f938[_0xaeba('0x3b')],_0xaeba('0x1d9'),_0x366604,_0xaeba('0x1da'),_0x26f938['predictiveIntervalAvailable'],'-',_0x335680,'=',_0x26f938[_0xaeba('0x1c7')]-_0x335680,')');}else if(_0x26f938['predictiveIntervalAvailable']&&_0x366604>_0x26f938['predictiveIntervalAvailable']+_0x4e9d44){freeVariablesPredictive(_0x26f938);loggerPredictive[_0xaeba('0x7b')](_0x26f938['name'],_0xaeba('0x1d9'),_0x366604,')\x20are\x20more\x20than\x20threshold\x20(',_0x26f938[_0xaeba('0x1c7')],'+',_0x4e9d44,'=',_0x26f938[_0xaeba('0x1c7')]+_0x4e9d44,')');}};Dialer[_0xaeba('0x17')][_0xaeba('0x1d8')]=function(_0x3a295e){var _0x2d084e=this;return function(_0x115940){return new BPromise(function(_0x595757,_0x5044ac){_[_0xaeba('0xd1')](_0x3a295e,_0x115940[0x0]);if(checkGetDataPredictive(_0x115940[0x0])){var _0x344e94=_0x3a295e[_0xaeba('0x1c7')]=_0x3a295e['talking']+_0x3a295e[_0xaeba('0x4a')];var _0x436936=_0x3a295e['dialPredictiveInterval']*0x3c;var _0x1656a7=_0x115940[0x0][_0xaeba('0x66')]+_0x115940[0x0][_0xaeba('0x81')];var _0x15eeb3=(_0x115940[0x0]['predictiveIntervalAnsweredCalls']+_0x115940[0x0][_0xaeba('0x68')]+_0x115940[0x0][_0xaeba('0x67')])/_0x115940[0x0][_0xaeba('0x6e')];_0x3a295e[_0xaeba('0x6b')]=_0x15eeb3>0x0?_0x15eeb3:0x1;switch(_0x3a295e[_0xaeba('0x1cf')]){case _0xaeba('0x1d0'):var _0x211561=_0x3a295e[_0xaeba('0x1c6')]/0x64;return _0x2d084e[_0xaeba('0x1db')](_0x344e94,_0x436936,_0x1656a7,_0x15eeb3,_0x211561)[_0xaeba('0x37')](function(_0xbdce78){return _0x595757(_0xbdce78);});case'agentBusyFactor':var _0x3673c3=_0x3a295e[_0xaeba('0x1c6')]/0x64;return _0x2d084e[_0xaeba('0x1dc')](_0x344e94,_0x436936,_0x1656a7,_0x15eeb3,_0x3673c3)['then'](function(_0x3176fa){return _0x595757(_0x3176fa);});default:return _0x5044ac(msgResponse(_0xaeba('0x1dd'),_0xaeba('0x145'),_0xaeba('0x1de')));}}else{return _0x5044ac(msgResponse(_0xaeba('0x1dd'),'Failure','check\x20failure'));}});};};Dialer[_0xaeba('0x17')][_0xaeba('0x1df')]=function(_0x43f7bc){var _0xd573ab=this;return function(_0x24ca04){return new BPromise(function(_0x137d32,_0x88fe96){_[_0xaeba('0xd1')](_0x43f7bc,_0x24ca04[0x0]);if(checkGetDataPredictive(_0x24ca04[0x0])){loggerPredictive[_0xaeba('0x7b')](JSON[_0xaeba('0x76')](_0x24ca04[0x0]));if(_0x43f7bc['dialPredictiveOptimization']===_0xaeba('0x1d0')){return _0xd573ab['getVoiceQueueRtPauses'](_0x43f7bc['id'])[_0xaeba('0x37')](function(_0x1fe576){var _0x5101fe=_0x43f7bc[_0xaeba('0x4b')]-_0x1fe576[0x0]['outboundQueuePauses'];var _0x2137e5=_0x43f7bc[_0xaeba('0x1ce')]*0x3c;var _0x32fdb5=_0x24ca04[0x0][_0xaeba('0x66')]+_0x24ca04[0x0][_0xaeba('0x81')];var _0x23be25=(_0x24ca04[0x0][_0xaeba('0x65')]+_0x24ca04[0x0][_0xaeba('0x68')]+_0x24ca04[0x0][_0xaeba('0x67')])/_0x24ca04[0x0][_0xaeba('0x6e')];var _0x4562f1=_0x43f7bc[_0xaeba('0x1c6')]/0x64;_0x43f7bc[_0xaeba('0x6d')]=_0x1fe576[0x0][_0xaeba('0x1e0')]||0x0;_0x43f7bc[_0xaeba('0x6b')]=_0x23be25>0x0?_0x23be25:0x1;return _0xd573ab[_0xaeba('0x1db')](_0x5101fe,_0x2137e5,_0x32fdb5,_0x23be25,_0x4562f1);})[_0xaeba('0x37')](function(_0xc60154){return _0x137d32(_0xc60154);})[_0xaeba('0xb8')](function(_0x5a91f8){return _0x88fe96(msgResponse(_0xaeba('0x1e1'),_0xaeba('0x145'),JSON[_0xaeba('0x76')](_0x5a91f8)));});}if(_0x43f7bc[_0xaeba('0x1cf')]===_0xaeba('0x1e2')){return _0xd573ab['getVoiceQueueRtPauses'](_0x43f7bc['id'])[_0xaeba('0x37')](function(_0x4116d2){var _0x2c303c=_0x43f7bc['loggedIn']-_0x4116d2[0x0]['outboundQueuePauses'];var _0x4212be=_0x43f7bc['dialPredictiveInterval']*0x3c;var _0xa6be7c=_0x24ca04[0x0][_0xaeba('0x66')]+_0x24ca04[0x0][_0xaeba('0x81')];var _0xe30e60=(_0x24ca04[0x0][_0xaeba('0x65')]+_0x24ca04[0x0][_0xaeba('0x68')]+_0x24ca04[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x24ca04[0x0]['predictiveIntervalTotalCalls'];var _0x3f5dc4=_0x43f7bc[_0xaeba('0x1c6')]/0x64;_0x43f7bc[_0xaeba('0x6d')]=_0x4116d2[0x0][_0xaeba('0x1e0')]||0x0;_0x43f7bc['predictiveIntervalHitRate']=_0xe30e60>0x0?_0xe30e60:0x1;return _0xd573ab[_0xaeba('0x1dc')](_0x2c303c,_0x4212be,_0xa6be7c,_0xe30e60,_0x3f5dc4);})[_0xaeba('0x37')](function(_0x1c6a81){return _0x137d32(_0x1c6a81);})['catch'](function(_0x3c67a8){return _0x88fe96(msgResponse('[CatchErlangB]',_0xaeba('0x145'),JSON[_0xaeba('0x76')](_0x3c67a8)));});}}else{return _0x88fe96(msgResponse(_0xaeba('0x1dd'),_0xaeba('0x145'),'check\x20failure'));}});};};Dialer[_0xaeba('0x17')]['startMethodPredictive']=function(_0x4b0088){var _0x2845df=this;return function(){var _0x1c3277=0x0;var _0x28b240=Math['floor'](_0x4b0088[_0xaeba('0x70')]*0x3e8);if(_0x28b240>0x0){_0x28b240=_0x28b240<0x64?0x64:_0x28b240;loggerPredictive[_0xaeba('0x7b')](_0x4b0088[_0xaeba('0x3b')],'one\x20call\x20every:',_0x28b240,_0xaeba('0x43'));_0x4b0088[_0xaeba('0x8e')]=setInterval(function(){_0x2845df[_0xaeba('0x8e')](_0x4b0088);loggerPredictiveCalls[_0xaeba('0x7b')]('[handlePredictive]',_0x1c3277+=0x1);},_0x28b240);}else{loggerPredictive[_0xaeba('0x7b')](_0x4b0088[_0xaeba('0x3b')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xaeba('0x17')]['checkContactBlack']=function(_0x342432,_0x19db98){var _0x1f82ca=this;return function(_0x4646b8){if(_[_0xaeba('0x40')](_0x4646b8)){if(_[_0xaeba('0xad')](_0x19db98[_0xaeba('0x1e3')])||!_0x19db98[_0xaeba('0x1e4')]){if(_0x342432[_0xaeba('0x158')]===_0xaeba('0x8')){_0x342432[_0xaeba('0x129')]=_[_0xaeba('0x84')](_0x342432[_0xaeba('0x129')])?!![]:_0x342432[_0xaeba('0x129')];var _0x52a22c=uuid['v4']();_0x1f82ca[_0xaeba('0xac')][_0x52a22c]=new Action(_0x342432,_0x19db98,_0x52a22c);loggerBooked[_0xaeba('0x7b')](_0xaeba('0x1e5'),_0x52a22c,'queueStatusComplete:\x20',JSON['stringify'](_0x342432[_0xaeba('0x129')]),_0xaeba('0x1e6'),_0x342432['name']);if(_0x342432[_0xaeba('0x129')]){_0x342432[_0xaeba('0x129')]=![];_0x1f82ca[_0xaeba('0x127')][_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xb3')]]=[];ami['Action']({'actionid':_0x52a22c,'action':_0xaeba('0x1e7'),'queue':_0x342432['name']})[_0xaeba('0xb8')](function(){_0x1f82ca['updateOriginated'](_0x342432);_0x1f82ca[_0xaeba('0xc0')]({'active':![],'ContactId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xd3')],'ListId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c]['ListId'],'VoiceQueueId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xd5')]||undefined,'CampaignId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1e8')));delete _0x1f82ca['actions'][_0x52a22c];});}else{loggerBooked[_0xaeba('0x7b')](_0xaeba('0x1e9'),JSON[_0xaeba('0x76')](_0x342432[_0xaeba('0x129')]),_0xaeba('0x1e6'),_0x342432['name']);_0x1f82ca[_0xaeba('0xb2')](_0x342432);_0x1f82ca[_0xaeba('0xc0')]({'active':![],'ContactId':_0x1f82ca['actions'][_0x52a22c][_0xaeba('0xd3')],'ListId':_0x1f82ca['actions'][_0x52a22c][_0xaeba('0xd4')],'VoiceQueueId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c]['VoiceQueueId']||undefined,'CampaignId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1f82ca[_0xaeba('0xac')][_0x52a22c];}}else{return _0x1f82ca[_0xaeba('0x16f')](_0x342432,_0x19db98);}}else{if(getDiff(_0x19db98[_0xaeba('0x1ea')])<_0x342432[_0xaeba('0x1eb')]*0x3c){if(_0x19db98[_0xaeba('0x1ec')]&&!_0x19db98[_0xaeba('0x1ec')][_0xaeba('0x1ed')]){_0x1f82ca[_0xaeba('0x1b')][_0xaeba('0x12b')](_0x19db98['id'])['finally'](function(){_0x1f82ca['updateOriginated'](_0x342432);});}else{_0x1f82ca[_0xaeba('0xc2')]({'active':![]},_0x19db98['id'],0x1)['finally'](function(){_0x1f82ca[_0xaeba('0xb2')](_0x342432);});}}else{_0x342432[_0xaeba('0x63')]+=0x1;_0x1f82ca[_0xaeba('0xb2')](_0x342432);if(_0x342432[_0xaeba('0x1ee')]){_0x1f82ca['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x19db98[_0xaeba('0xd3')],'ListId':_0x19db98['ListId'],'VoiceQueueId':_0x19db98['VoiceQueueId']||undefined,'CampaignId':_0x19db98[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1ef')));_0x1f82ca[_0xaeba('0xca')](createObjHistory(_0x342432,_0x19db98,'RECALLINQUEUE',0x17,_0xaeba('0x1f0')))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1f1')));}else{_0x1f82ca[_0xaeba('0xd0')](createObjHistory(_0x342432,_0x19db98,_0xaeba('0x1f2'),0x16,'RecallFailedTimeout'),_0xaeba('0x1f3'),_0xaeba('0x1f4'));}}}}else{_0x342432[_0xaeba('0x5b')]+=0x1;_0x1f82ca[_0xaeba('0xd0')](createObjHistory(_0x342432,_0x19db98,_0xaeba('0x1f5'),0xd,'Blacklist'),_0xaeba('0x1f6'),_0xaeba('0x1f7'));throw _0xaeba('0x1f8');}};};Dialer[_0xaeba('0x17')][_0xaeba('0x163')]=function(_0x2e9193){var _0xf0a561=this;var _0x15feeb=_0x2e9193['limitCalls']-_0x2e9193[_0xaeba('0x96')]-_0x2e9193[_0xaeba('0xc4')];emitCampaignSummary(_0x2e9193);if(_0x15feeb>0x0){if(_0x15feeb>this[_0xaeba('0x1f9')]){_0x15feeb=this['maxNumberOriginate'];}_0x2e9193[_0xaeba('0xc4')]+=_0x15feeb;this[_0xaeba('0xc6')](_0x2e9193['id'],_0x15feeb,_0x2e9193[_0xaeba('0x1fa')],_0x2e9193)[_0xaeba('0x37')](function(_0xf2d806){_0x2e9193['temp']-=_0x15feeb;_0x2e9193[_0xaeba('0xc4')]=_0x2e9193[_0xaeba('0xc4')]>0x0?_0x2e9193[_0xaeba('0xc4')]:0x0;if(!checkContactEmpty(_0xf2d806)){_0x2e9193[_0xaeba('0x39')]=_0xaeba('0x1fb');logger[_0xaeba('0x7b')](_0xaeba('0x1fc')+_0x2e9193[_0xaeba('0x3b')]);}else{_0x2e9193[_0xaeba('0x96')]+=_0xf2d806[_0xaeba('0x95')];_0x2e9193['message']=_0xaeba('0x1fd');for(var _0x34e3a1=0x0;_0x34e3a1<_0xf2d806[_0xaeba('0x95')];_0x34e3a1+=0x1){_0x2e9193['ivrTotalCallsDays']+=0x1;if(_[_0xaeba('0xad')](_0xf2d806[_0x34e3a1])||_[_0xaeba('0xad')](_0xf2d806[_0x34e3a1][_0xaeba('0x172')])||_[_0xaeba('0xad')](_0xf2d806[_0x34e3a1]['Contact'][_0xaeba('0x173')])){_0xf0a561[_0xaeba('0xce')]('[actionOriginate]\x20',_0x2e9193,_0xf2d806[_0x34e3a1]);}else{_0xf0a561[_0xaeba('0xbc')](_[_0xaeba('0xd2')](_0xf2d806[_0x34e3a1],[_0xaeba('0xfa'),'Contact.phone']))[_0xaeba('0x37')](_0xf0a561['checkContactBlack'](_0x2e9193,_0xf2d806[_0x34e3a1]))['catch'](_0xf0a561[_0xaeba('0xcd')](_0xaeba('0x1fe'),_0x2e9193));}}}})[_0xaeba('0xb8')](loggerGetContactDialer(_0xaeba('0x1ff'),_0x2e9193,_0x15feeb));}};Dialer['prototype'][_0xaeba('0x15a')]=function(_0x266671,_0x26f966){var _0x4b233f=this;var _0x50ff9e=[];var _0x540730=_0x26f966>=0x1?_0x26f966:0x1;if(_0x266671[_0xaeba('0x158')]===_0xaeba('0x8')){_0x540730=0x1;}var _0x2122a4=Math['floor'](_0x266671['available']*_0x540730)-_0x266671[_0xaeba('0x96')]-_0x266671[_0xaeba('0xc4')];emitVoiceQueueSummary(_0x266671);if(_0x266671[_0xaeba('0x200')]>0x0){var _0x266fb6=_0x266671['dialLimitQueue']-_0x266671['originated']-_0x266671['talking']-_0x266671[_0xaeba('0xc4')]-_0x266671[_0xaeba('0x4c')];if(_0x2122a4>_0x266fb6){_0x2122a4=_0x266fb6;}}if(_0x2122a4>0x0){if(_0x266671['dialMethod']===_0xaeba('0x8')){_0x2122a4=0x1;}if(_0x2122a4>this[_0xaeba('0x1f9')]){_0x2122a4=this['maxNumberOriginate'];}_0x266671[_0xaeba('0xc4')]+=_0x2122a4;for(var _0x10d754 in this['agents']){if(typeof this[_0xaeba('0x1e')][_0x10d754]!=='undefined'){if(this[_0xaeba('0x1e')][_0x10d754][_0xaeba('0xa6')]===_0xaeba('0x201')&&this[_0xaeba('0x1e')][_0x10d754][_0xaeba('0xaf')]===_0xaeba('0x202')){_0x50ff9e['push'](this[_0xaeba('0x1e')][_0x10d754]['id']);}}}this['getContactDialer'](_0x266671['id'],_0x50ff9e,_0x2122a4,_0x266671[_0xaeba('0x1fa')],_0x266671)[_0xaeba('0x37')](function(_0x3815eb){_0x266671[_0xaeba('0xc4')]-=_0x2122a4;_0x266671[_0xaeba('0xc4')]=_0x266671[_0xaeba('0xc4')]>0x0?_0x266671[_0xaeba('0xc4')]:0x0;if(!checkContactEmpty(_0x3815eb)){_0x4b233f[_0xaeba('0xb6')](_0x266671)[_0xaeba('0x37')](sendMessageReschedule(_0x266671))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xb9')));}else{_0x266671[_0xaeba('0x96')]+=_0x3815eb[_0xaeba('0x95')];_0x266671[_0xaeba('0x39')]=_0x266671[_0xaeba('0x158')]==='booked'?_0xaeba('0x179'):_0xaeba('0x1fd');for(var _0x1d724a=0x0;_0x1d724a<_0x3815eb[_0xaeba('0x95')];_0x1d724a+=0x1){if(_['isNil'](_0x3815eb[_0x1d724a])||_[_0xaeba('0xad')](_0x3815eb[_0x1d724a][_0xaeba('0x172')])||_['isNil'](_0x3815eb[_0x1d724a][_0xaeba('0x172')][_0xaeba('0x173')])){_0x4b233f[_0xaeba('0xce')](_0xaeba('0x203'),_0x266671,_0x3815eb[_0x1d724a]);}else{_0x4b233f[_0xaeba('0xba')](_[_0xaeba('0xd2')](_0x3815eb[_0x1d724a],[_0xaeba('0xd5'),_0xaeba('0x204')]))[_0xaeba('0x37')](_0x4b233f['checkContactBlack'](_0x266671,_0x3815eb[_0x1d724a]))[_0xaeba('0xb8')](_0x4b233f[_0xaeba('0xcd')](_0xaeba('0x203'),_0x266671));}}}})[_0xaeba('0xb8')](loggerGetContactDialer('[getContactDialer2]',_0x266671,_0x2122a4));}};Dialer[_0xaeba('0x17')][_0xaeba('0x8e')]=function(_0x3aedf5){if(_0x3aedf5[_0xaeba('0x200')]>0x0){var _0x4e1fe8=_0x3aedf5[_0xaeba('0x200')]-_0x3aedf5['originated']-_0x3aedf5[_0xaeba('0x50')];if(_0x4e1fe8>0x0){this['tryOriginatePredictive'](_0x3aedf5);}else{loggerPredictiveCalls[_0xaeba('0x7b')](_0xaeba('0x205'));}}else{this[_0xaeba('0x206')](_0x3aedf5);}};Dialer[_0xaeba('0x17')][_0xaeba('0x206')]=function(_0x54b249){var _0x358f2c=this;var _0x106055=[];_0x54b249[_0xaeba('0x96')]+=0x1;for(var _0x41e911 in this[_0xaeba('0x1e')]){if(typeof this[_0xaeba('0x1e')][_0x41e911]!==_0xaeba('0x97')){if(this[_0xaeba('0x1e')][_0x41e911][_0xaeba('0xa6')]==='not_inuse'&&this[_0xaeba('0x1e')][_0x41e911]['status']===_0xaeba('0x202')){_0x106055[_0xaeba('0x128')](this['agents'][_0x41e911]['id']);}}}this[_0xaeba('0xc3')](_0x54b249['id'],_0x106055,0x1,_0x54b249[_0xaeba('0x1fa')],_0x54b249)['then'](function(_0x4e3f29){if(!checkContactEmpty(_0x4e3f29)){checkContactLowerLimitOriginate(_0x54b249,0x1,0x0);_0x358f2c[_0xaeba('0xb6')](_0x54b249)[_0xaeba('0x37')](sendMessageReschedule(_0x54b249))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xb9')));}else{_0x54b249[_0xaeba('0x39')]=_0xaeba('0x1fd');if(_[_0xaeba('0xad')](_0x4e3f29[0x0])||_[_0xaeba('0xad')](_0x4e3f29[0x0][_0xaeba('0x172')])||_[_0xaeba('0xad')](_0x4e3f29[0x0][_0xaeba('0x172')][_0xaeba('0x173')])){_0x358f2c[_0xaeba('0xce')](_0xaeba('0x203'),_0x54b249,_0x4e3f29[0x0]);}else{_0x358f2c[_0xaeba('0xba')](_[_0xaeba('0xd2')](_0x4e3f29[0x0],[_0xaeba('0xd5'),_0xaeba('0x204')]))[_0xaeba('0x37')](_0x358f2c[_0xaeba('0x207')](_0x54b249,_0x4e3f29[0x0]))[_0xaeba('0xb8')](_0x358f2c[_0xaeba('0xcd')]('[actionOriginatePredictive]\x20',_0x54b249));}}})[_0xaeba('0xb8')](loggerGetContactDialer(_0xaeba('0x208'),_0x54b249,0x1));emitVoiceQueueSummary(_0x54b249);};Dialer[_0xaeba('0x17')][_0xaeba('0x1db')]=function(_0x30f003,_0x2764d6,_0x5ad30e,_0x5eac84,_0x38c0b0,_0x132fe8){loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x209'));loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20a'),_0x30f003);loggerPredictive[_0xaeba('0x7b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2764d6);loggerPredictive['info'](_0xaeba('0x20b'),_0x5ad30e);loggerPredictive['info'](_0xaeba('0x20c'),_0x5eac84);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20d'),_0x38c0b0);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x83'));return new BPromise(function(_0x21d215,_0x193e37){if(_0x30f003<=0x0||isNaN(_0x30f003)){return _0x193e37(msgResponse(_0xaeba('0x20e'),'Error',_0xaeba('0x20f')+_0x30f003));}if(_0x5ad30e<=0x0||isNaN(_0x5ad30e)){return _0x193e37(msgResponse(_0xaeba('0x20e'),'Error',_0xaeba('0x210')+_0x5ad30e));}if(_0x5eac84<=0x0||isNaN(_0x5eac84)){return _0x193e37(msgResponse(_0xaeba('0x20e'),_0xaeba('0x42'),_0xaeba('0x211')+_0x5eac84));}if(_0x2764d6<=0x0||isNaN(_0x2764d6)){return _0x193e37(msgResponse('[abandonmentRate]','Error',_0xaeba('0x212')+_0x2764d6));}if(_0x38c0b0<=0x0||isNaN(_0x38c0b0)){return _0x193e37(msgResponse('[abandonmentRate]',_0xaeba('0x42'),_0xaeba('0x213')+_0x38c0b0));}_0x132fe8=_0x132fe8||0x0;var _0x4f61cf=0x1/_0x5ad30e;var _0x2098a3=0x0;var _0x3f1b7b=0x0;var _0x16a2b7=0x0;var _0x5f2808=0x0;for(var _0x49f6e9=0x0;_0x16a2b7<_0x38c0b0;_0x49f6e9+=0x1){_0x3f1b7b=_0x49f6e9/_0x2764d6;_0x2098a3=(_0x5eac84*_0x3f1b7b+_0x132fe8)/_0x4f61cf;_0x16a2b7=erlangb(_0x2098a3,_0x30f003);_0x5f2808=_0x2098a3/_0x30f003*(0x1-erlangb(_0x2098a3,_0x30f003));}return _0x21d215({'erlangCalls':_0x49f6e9,'erlangCallToSecond':_0x2764d6/_0x49f6e9,'erlangAbandonmentRate':_0x16a2b7,'erlangBusyFactor':_0x5f2808});});};Dialer[_0xaeba('0x17')]['busyFactor']=function(_0x5a1996,_0x53e76e,_0x2324be,_0x486a42,_0x32a7d4,_0x24ac46){loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x214'));loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20a'),_0x5a1996);loggerPredictive[_0xaeba('0x7b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53e76e);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20b'),_0x2324be);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20c'),_0x486a42);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x215'),_0x32a7d4);loggerPredictive['info'](_0xaeba('0x83'));return new BPromise(function(_0xe170aa,_0x23166c){if(_0x5a1996<=0x0||isNaN(_0x5a1996)){return _0x23166c(msgResponse(_0xaeba('0x216'),_0xaeba('0x42'),_0xaeba('0x20f')+_0x5a1996));}if(_0x2324be<=0x0||isNaN(_0x2324be)){return _0x23166c(msgResponse(_0xaeba('0x216'),_0xaeba('0x42'),'Ts\x20=\x20'+_0x2324be));}if(_0x486a42<=0x0||isNaN(_0x486a42)){return _0x23166c(msgResponse('[busyFactor]',_0xaeba('0x42'),'p\x20=\x20'+_0x486a42));}if(_0x53e76e<=0x0||isNaN(_0x53e76e)){return _0x23166c(msgResponse(_0xaeba('0x216'),_0xaeba('0x42'),'interval\x20=\x20'+_0x53e76e));}if(_0x32a7d4<=0x0||isNaN(_0x32a7d4)){return _0x23166c(msgResponse(_0xaeba('0x216'),'Error',_0xaeba('0x217')+_0x32a7d4));}_0x24ac46=_0x24ac46||0x0;var _0x4db519=0x1/_0x2324be;var _0x45c04c=0x0;var _0xbc1298=0x0;var _0x32e046=0x0;var _0x1da6aa=0x0;for(var _0x5e871e=0x0;_0x1da6aa<_0x32a7d4;_0x5e871e+=0x1){_0xbc1298=_0x5e871e/_0x53e76e;_0x45c04c=(_0x486a42*_0xbc1298+_0x24ac46)/_0x4db519;_0x32e046=erlangb(_0x45c04c,_0x5a1996);_0x1da6aa=_0x45c04c/_0x5a1996*(0x1-erlangb(_0x45c04c,_0x5a1996));}return _0xe170aa({'erlangCalls':_0x5e871e,'erlangCallToSecond':_0x53e76e/_0x5e871e,'erlangAbandonmentRate':_0x32e046,'erlangBusyFactor':_0x1da6aa});});};module['exports']=Dialer; \ No newline at end of file +var _0x8f48=['predictiveIntervalErlangCallsDroppedCalls','TIMEOUT','dialDropMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','rrmemory','push','pick','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','resetActiveCalls','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','content','indexOf','true','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialTimezone','[syncQueueSummary]','syncCampaigns','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','phone','Contact','originate','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','outbound','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','tags','createdAt','updatedAt','%s%s','toUpper','callerid','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','abandonmentRate','[CatchErlangB]','milliseconds','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','voicePause','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','limitCalls','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/setting','./action','./final','./hangup','env','XCALLY_IP_AGI','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncAgentComplete','custom:queuesummary','hangup','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','isUndefined','AGENTS_NOT_LOGGED','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','diff','seconds','type','strategy','answered','available','loggedIn','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','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','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','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','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','Action','status','channel','catch','ivr','updateOriginated','queue','[Dialer][checkChannel][ivr]','resolve','countReScheduled','[countReScheduled]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','reachable','unmonitored','moveContactManagedDialer','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','value','HANGUP','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','add','ListId','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime'];(function(_0x2a8255,_0x2ab6cb){var _0x20d7a5=function(_0x19f120){while(--_0x19f120){_0x2a8255['push'](_0x2a8255['shift']());}};_0x20d7a5(++_0x2ab6cb);}(_0x8f48,0x10a));var _0x88f4=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x8f48[_0x5b78e8];return _0xf2c321;};'use strict';var util=require(_0x88f4('0x0'));var _=require(_0x88f4('0x1'));var BPromise=require(_0x88f4('0x2'));var uuid=require(_0x88f4('0x3'));var moment=require(_0x88f4('0x4'));var rr=require('rr');var md5=require(_0x88f4('0x5'));var Redis=require(_0x88f4('0x6'));var ut=require(_0x88f4('0x7'));var config=require('../../../config/environment/');var logger=require(_0x88f4('0x8'))(_0x88f4('0x9'));var loggerBooked=require(_0x88f4('0x8'))(_0x88f4('0xa'));var loggerPredictive=require(_0x88f4('0x8'))(_0x88f4('0xb'));var loggerPredictiveCalls=require(_0x88f4('0x8'))(_0x88f4('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x88f4('0xd'));var ami=require(_0x88f4('0xe'));config[_0x88f4('0xf')]=_[_0x88f4('0x10')](config[_0x88f4('0xf')],{'host':_0x88f4('0x11'),'port':0x18eb});var io=require(_0x88f4('0x12'))(new Redis(config[_0x88f4('0xf')]));var cmHopper=require(_0x88f4('0x13'));var cmHopperHistory=require(_0x88f4('0x14'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x88f4('0x15'));var Action=require(_0x88f4('0x16'));var History=require('./history');var Final=require(_0x88f4('0x17'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x88f4('0x18'));var ipAgi=process[_0x88f4('0x19')][_0x88f4('0x1a')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x88f4('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x88f4('0x1c')][_0x88f4('0x1d')]=function(_0x15be99){this[_0x88f4('0x1e')]=this[_0x88f4('0x1e')]?this[_0x88f4('0x1e')][_0x88f4('0x1f')](_0x15be99):_0x15be99();};function Dialer(_0x14205c,_0x23a712){this[_0x88f4('0x20')]=new Sequence();this[_0x88f4('0x21')]=_0x23a712;this[_0x88f4('0x22')]=_0x14205c[_0x88f4('0x22')];this[_0x88f4('0x23')]=_0x14205c[_0x88f4('0x23')];this[_0x88f4('0x24')]=_0x14205c[_0x88f4('0x24')];this[_0x88f4('0x25')]=_0x14205c[_0x88f4('0x25')];this['maxNumberOriginate']=config[_0x88f4('0x26')]||0x2;this[_0x88f4('0x27')]={};this[_0x88f4('0x28')]={};this[_0x88f4('0x29')]={};this[_0x88f4('0x2a')]={};this[_0x88f4('0x2b')]={};this[_0x88f4('0x2c')]={};this[_0x88f4('0x2d')]={};this['ivrOriginated']={};this[_0x88f4('0x2e')]={};this[_0x88f4('0x2f')]={};ami['on'](_0x88f4('0x30'),this[_0x88f4('0x31')][_0x88f4('0x32')](this));ami['on'](_0x88f4('0x33'),this[_0x88f4('0x34')][_0x88f4('0x32')](this));ami['on'](_0x88f4('0x35'),this['syncOriginateResponse'][_0x88f4('0x32')](this));ami['on']('agentcomplete',this[_0x88f4('0x36')][_0x88f4('0x32')](this));ami['on'](_0x88f4('0x37'),this[_0x88f4('0xd')][_0x88f4('0x32')](this));ami['on'](_0x88f4('0x38'),this['syncHangup'][_0x88f4('0x32')](this));ami['on']('newexten',this[_0x88f4('0x39')][_0x88f4('0x32')](this));ami['on']('varset',this[_0x88f4('0x3a')][_0x88f4('0x32')](this));ami['on'](_0x88f4('0x3b'),this['syncQueueMember'][_0x88f4('0x32')](this));ami['on'](_0x88f4('0x3c'),this[_0x88f4('0x3d')][_0x88f4('0x32')](this));this[_0x88f4('0x3e')]();this[_0x88f4('0x3f')]();RpcSetting['getSettings']()[_0x88f4('0x40')](function(_0x451672){previewRecallmeReminderInterval=_0x451672['previewRecallmeReminderInterval'];});}function isNotNull(_0x5caf2b){return _0x5caf2b!==null&&!_[_0x88f4('0x41')](_0x5caf2b);}function checkIsLoggedIn(_0x2f07bb,_0x367d4a){return function(){if(_0x367d4a<=0x0){_0x2f07bb['message']=_0x88f4('0x42');throw _0x2f07bb['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x36ba10){return _0x36ba10;}function checkIsActive(_0x1ea798,_0x21a58b){return function(){if(!isActive(_0x21a58b)){_0x1ea798[_0x88f4('0x43')]=_0x88f4('0x44');throw _0x1ea798[_0x88f4('0x45')]+_0x88f4('0x46');}};}function checkInterval(_0x4f603c){return function(){if(!isNotNull(_0x4f603c[_0x88f4('0x47')])){_0x4f603c[_0x88f4('0x43')]=_0x88f4('0x48');throw _0x4f603c[_0x88f4('0x45')]+_0x88f4('0x49');}if(!isNotNull(_0x4f603c[_0x88f4('0x47')][_0x88f4('0x4a')])){_0x4f603c[_0x88f4('0x43')]=_0x88f4('0x48');throw _0x4f603c['name']+_0x88f4('0x49');}if(!isNotNull(_[_0x88f4('0x4b')](_0x4f603c['Interval'][_0x88f4('0x4a')]))){_0x4f603c['message']=_0x88f4('0x48');throw _0x4f603c[_0x88f4('0x45')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x34c644,_0x18e33c,_0x1922cb){return{'action':_0x34c644,'response':_0x18e33c,'message':_0x1922cb,'stack':_0x1922cb};}function myreject(_0x198a15){return function(_0x18f88c){return _0x198a15(msgResponse(_0x88f4('0x4c'),_0x88f4('0x4d'),JSON[_0x88f4('0x4e')](_0x18f88c)));};}function getSeconds(_0xbc36b9,_0x519db8){var _0x342518=moment(_0xbc36b9)['milliseconds'](0x0);var _0x32768c=moment(_0x519db8)['milliseconds'](0x0);return _0x342518[_0x88f4('0x4f')](_0x32768c,_0x88f4('0x50'));}function emit(_0x121765,_0x3419aa,_0x4a0fd1){io['to'](_0x121765)['emit'](_0x3419aa,_0x4a0fd1);}function emitVoiceQueueSummary(_0x2913c2){if(_0x2913c2[_0x88f4('0x51')]==='outbound'){var _0x5e7bde={'id':_0x2913c2['id'],'name':_0x2913c2[_0x88f4('0x45')],'strategy':_0x2913c2[_0x88f4('0x52')],'answered':_0x2913c2[_0x88f4('0x53')],'available':_0x2913c2[_0x88f4('0x54')],'loggedIn':_0x2913c2[_0x88f4('0x55')],'pTalking':_0x2913c2['pTalking'],'sumBillable':_0x2913c2[_0x88f4('0x56')],'sumDuration':_0x2913c2[_0x88f4('0x57')],'sumHoldTime':_0x2913c2['sumHoldTime']||0x0,'talking':_0x2913c2[_0x88f4('0x58')],'total':_0x2913c2[_0x88f4('0x59')],'type':_0x2913c2['type'],'unmanaged':_0x2913c2[_0x88f4('0x5a')],'abandoned':_0x2913c2[_0x88f4('0x5b')],'waiting':_0x2913c2[_0x88f4('0x5c')],'loggedInDb':_0x2913c2[_0x88f4('0x5d')],'dialActive':_0x2913c2[_0x88f4('0x5e')],'dialMethod':_0x2913c2[_0x88f4('0x5f')],'dialOriginateCallerIdName':_0x2913c2[_0x88f4('0x60')],'dialOriginateCallerIdNumber':_0x2913c2[_0x88f4('0x61')],'dialOriginateTimeout':_0x2913c2['dialOriginateTimeout'],'dialPrefix':_0x2913c2[_0x88f4('0x62')],'outboundAnswerAgiCallsDay':_0x2913c2[_0x88f4('0x63')],'outboundAnswerCallsDay':_0x2913c2[_0x88f4('0x64')],'outboundBlacklistCallsDay':_0x2913c2[_0x88f4('0x65')],'outboundBusyCallsDay':_0x2913c2[_0x88f4('0x66')],'outboundCongestionCallsDay':_0x2913c2[_0x88f4('0x67')],'outboundDropCallsDayACS':_0x2913c2[_0x88f4('0x68')],'outboundDropCallsDayCallersExit':_0x2913c2[_0x88f4('0x69')],'outboundDropCallsDayTimeout':_0x2913c2[_0x88f4('0x6a')],'outboundNoAnswerCallsDay':_0x2913c2['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2913c2[_0x88f4('0x6b')],'outboundOriginateFailureCallsDay':_0x2913c2[_0x88f4('0x6c')],'outboundReCallsDay':_0x2913c2['outboundReCallsDay'],'outboundRejectCallsDay':_0x2913c2[_0x88f4('0x6d')],'outboundUnknownCallsDay':_0x2913c2[_0x88f4('0x6e')],'predictiveIntervalAnsweredCalls':_0x2913c2['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2913c2[_0x88f4('0x6f')],'predictiveIntervalAvgTalktime':_0x2913c2['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x2913c2[_0x88f4('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x2913c2[_0x88f4('0x71')],'predictiveIntervalErlangCalls':_0x2913c2[_0x88f4('0x72')],'predictiveIntervalErlangCallsDroppedCalls':_0x2913c2['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2913c2[_0x88f4('0x73')],'predictiveIntervalMultiplicativeFactor':_0x2913c2['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2913c2[_0x88f4('0x74')],'predictiveIntervalAvailable':_0x2913c2['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2913c2[_0x88f4('0x75')],'message':_0x2913c2[_0x88f4('0x43')],'originated':_0x2913c2[_0x88f4('0x76')],'erlangCalls':_0x2913c2['erlangCalls'],'erlangCallToSecond':_0x2913c2[_0x88f4('0x77')],'erlangAbandonmentRate':_0x2913c2[_0x88f4('0x78')],'erlangBusyFactor':_0x2913c2[_0x88f4('0x79')],'startPredictive':_0x2913c2[_0x88f4('0x2c')],'startProgressive':_0x2913c2[_0x88f4('0x2d')]};if(_0x2913c2['Trunk']){_0x5e7bde[_0x88f4('0x7a')]={'id':_0x2913c2['Trunk']['id'],'name':_0x2913c2[_0x88f4('0x7a')][_0x88f4('0x45')],'active':_0x2913c2[_0x88f4('0x7a')][_0x88f4('0x7b')],'callerid':_0x2913c2[_0x88f4('0x7a')]['callerid']};}if(_0x2913c2['Interval']){_0x5e7bde['Interval']={'id':_0x2913c2[_0x88f4('0x47')]['id'],'name':_0x2913c2[_0x88f4('0x47')][_0x88f4('0x45')]};}var _0x4fb59f=md5(JSON['stringify'](_0x5e7bde));if(_0x2913c2[_0x88f4('0x5')]!==_0x4fb59f){_0x2913c2[_0x88f4('0x5')]=_0x4fb59f;emit(util[_0x88f4('0x7c')](_0x88f4('0x7d'),_0x5e7bde[_0x88f4('0x45')]),_0x88f4('0x7e'),_0x5e7bde);}}}function emitCampaignSummary(_0x31157d){if(_0x31157d['type']==='ivr'){emit(util[_0x88f4('0x7c')](_0x88f4('0x7f'),_0x31157d['name']),'campaign:save',_0x31157d);}}function checkGetDataPredictive(_0x42cff3){if(isNotNull(_0x42cff3)&&!_[_0x88f4('0x4b')](_0x42cff3)){loggerPredictive[_0x88f4('0x80')](_0x88f4('0x81'));loggerPredictive[_0x88f4('0x80')](_0x88f4('0x82'),_0x42cff3[_0x88f4('0x75')]);loggerPredictive[_0x88f4('0x80')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42cff3['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x88f4('0x83'),_0x42cff3['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x84'),_0x42cff3[_0x88f4('0x70')]);loggerPredictive[_0x88f4('0x80')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42cff3[_0x88f4('0x6f')]);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x85'),_0x42cff3[_0x88f4('0x86')]);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x87'));if(_0x42cff3[_0x88f4('0x75')]>0x0){if(!_[_0x88f4('0x41')](_0x42cff3[_0x88f4('0x86')])&&_0x42cff3[_0x88f4('0x86')]>0x0){return!![];}loggerPredictive[_0x88f4('0x80')](_0x88f4('0x88'));if(!_[_0x88f4('0x41')](_0x42cff3[_0x88f4('0x6f')])&&_0x42cff3['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x88f4('0x80')](_0x88f4('0x89'));}else{loggerPredictive[_0x88f4('0x80')](_0x88f4('0x8a'));}}else{loggerPredictive[_0x88f4('0x80')](_0x88f4('0x8b'));}return![];}function mergeDataErlangB(_0x2c6db0){return function(_0x1d2435){loggerPredictive[_0x88f4('0x80')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x88f4('0x8c'),_0x1d2435[_0x88f4('0x8d')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d2435[_0x88f4('0x77')]);loggerPredictive['info'](_0x88f4('0x8e'),_0x1d2435[_0x88f4('0x78')]);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x8f'),_0x1d2435['erlangBusyFactor']);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x8e'),_0x1d2435['erlangAbandonmentRate']);loggerPredictive['info'](_0x88f4('0x87'));_[_0x88f4('0x90')](_0x2c6db0,_0x1d2435);};}function getDiff(_0x548bb7){var _0x230339=moment()['milliseconds'](0x0);var _0x18d079=moment(_0x548bb7)['milliseconds'](0x0);return _0x230339[_0x88f4('0x4f')](_0x18d079,_0x88f4('0x50'));}function ifInterval(_0x249d68,_0x34a57b){if(_['isUndefined'](_0x34a57b)){return![];}return getDiff(_0x34a57b)<_0x249d68*0x3c;}function freeVariablesPredictive(_0x5c2ee5){if(isNotNull(_0x5c2ee5)){if(!_[_0x88f4('0x41')](_0x5c2ee5[_0x88f4('0x2d')])){_0x5c2ee5[_0x88f4('0x2d')]=undefined;loggerPredictive[_0x88f4('0x80')](_0x5c2ee5[_0x88f4('0x45')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x5c2ee5[_0x88f4('0x2c')])){_0x5c2ee5[_0x88f4('0x2c')]=undefined;loggerPredictive[_0x88f4('0x80')](_0x5c2ee5['name'],_0x88f4('0x91'));}if(!_[_0x88f4('0x41')](_0x5c2ee5['handlePredictive'])){clearInterval(_0x5c2ee5[_0x88f4('0x92')]);_0x5c2ee5[_0x88f4('0x92')]=undefined;loggerPredictive['info'](_0x5c2ee5[_0x88f4('0x45')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x46fa26,_0x41bae6){if(_0x41bae6===0x0){return 0x0;}var _0x317130=0x1;for(var _0x27263b=0x1;_0x27263b<=_0x41bae6;_0x27263b+=0x1){_0x317130=0x1+_0x317130*_0x27263b/_0x46fa26;}return 0x1/_0x317130;}function isVoiceQueueOutbound(_0x325446){return _0x325446==='outbound';}function isNotPreview(_0x4eee15){return _0x4eee15!==_0x88f4('0x21');}function isCampaignIvr(_0x2e74d6){return _0x2e74d6==='ivr';}function getCallerId(_0x1e8449,_0x532ecc,_0x47547f){if(!_[_0x88f4('0x41')](_0x47547f)&&typeof _0x47547f===_0x88f4('0x93')&&!_[_0x88f4('0x4b')](_0x47547f)){if(!_[_0x88f4('0x41')](_0x532ecc)&&typeof _0x532ecc===_0x88f4('0x93')&&!_['isEmpty'](_0x532ecc)){return util[_0x88f4('0x7c')](_0x88f4('0x94'),_0x532ecc,_0x47547f);}return util['format']('\x22%s\x22\x20<%s>',_0x47547f,_0x47547f);}if(!_[_0x88f4('0x41')](_0x1e8449)&&typeof _0x1e8449===_0x88f4('0x93')&&!_[_0x88f4('0x4b')](_0x1e8449)){return _0x1e8449;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x434441,_0x2d3d6c){return function(_0x2fa7b8){freeVariablesPredictive(_0x2d3d6c);emitVoiceQueueSummary(_0x2d3d6c);emitCampaignSummary(_0x2d3d6c);loggerSyncQueueSummary[_0x88f4('0x95')](_0x434441,util[_0x88f4('0x96')](_0x2fa7b8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3bbb73,_0x383dd9){return function(_0x395612){loggerPredictive[_0x88f4('0x95')](_0x383dd9[_0x88f4('0x45')],_0x3bbb73);loggerPredictive[_0x88f4('0x95')](_0x395612[_0x88f4('0x97')]);freeVariablesPredictive(_0x383dd9);};}function loggerCatch(_0x132861){return function(_0x5c5be3){logger[_0x88f4('0x95')](_0x132861,util[_0x88f4('0x96')](_0x5c5be3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x461a5b){return _0x461a5b&&!_[_0x88f4('0x41')](_0x461a5b)&&_0x461a5b[_0x88f4('0x98')]>0x0;}function decremetOriginate(_0x2dc306){if(!_[_0x88f4('0x41')](_0x2dc306)&&_0x2dc306!==null){if(typeof _0x2dc306[_0x88f4('0x76')]!==_0x88f4('0x99')){if(_0x2dc306[_0x88f4('0x76')]>0x0){_0x2dc306[_0x88f4('0x76')]-=0x1;}else{logger[_0x88f4('0x95')](_0x88f4('0x9a'));}}}else{logger[_0x88f4('0x95')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x3cc3c1,_0x28423b,_0x4ca7cb){if(_0x28423b>_0x4ca7cb){for(var _0x58f627=0x0;_0x58f627<_0x28423b-_0x4ca7cb;_0x58f627+=0x1){decremetOriginate(_0x3cc3c1);}}}function loggerGetContactDialer(_0x170e0b,_0x3fe8a7,_0x2f2f55){return function(_0x1e5bd1){checkContactLowerLimitOriginate(_0x3fe8a7,_0x2f2f55,0x0);logger['error'](_0x170e0b,util['inspect'](_0x1e5bd1,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x58b4d0){return function(_0x481759){if(isNotNull(_0x481759)&&isNotNull(_0x481759[0x0])){if(_0x481759[0x0][_0x88f4('0x9b')]>0x0){_0x58b4d0[_0x88f4('0x43')]=_0x88f4('0x9c');logger[_0x88f4('0x80')](_0x88f4('0x9d')+_0x58b4d0['name'],_0x481759[0x0][_0x88f4('0x9b')],_0x88f4('0x9e'));}else{_0x58b4d0[_0x88f4('0x43')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x88f4('0x80')]('[getContactDialer2][Empty]'+_0x58b4d0[_0x88f4('0x45')]);}}};}function notSendMessagesQueue(_0x34f1ef){if(_0x34f1ef[_0x88f4('0x9f')]){freeVariablesPredictive(_0x34f1ef);if(_0x34f1ef[_0x88f4('0x76')]===0x0&&_0x34f1ef[_0x88f4('0x58')]===0x0&&_0x34f1ef[_0x88f4('0x5c')]===0x0&&(_0x34f1ef[_0x88f4('0xa0')]||0x0)===0x0){_0x34f1ef[_0x88f4('0x9f')]=![];_0x34f1ef[_0x88f4('0x54')]=0x0;_0x34f1ef[_0x88f4('0x43')]=_0x88f4('0x44');loggerSyncQueueSummary['error'](_0x88f4('0xa1'),_0x34f1ef['name'],_0x88f4('0xa2'));}else{_0x34f1ef[_0x88f4('0x43')]=_0x88f4('0xa3');loggerSyncQueueSummary[_0x88f4('0x95')](_0x88f4('0xa1'),_0x34f1ef[_0x88f4('0x45')],_0x88f4('0xa4'));}emitVoiceQueueSummary(_0x34f1ef);}}function notSendMessagesCampaign(_0x4da10a){if(_0x4da10a[_0x88f4('0x9f')]){if(_0x4da10a[_0x88f4('0x76')]===0x0){_0x4da10a[_0x88f4('0x9f')]=![];_0x4da10a[_0x88f4('0x43')]=_0x88f4('0x44');loggerSyncQueueSummary[_0x88f4('0x95')](_0x88f4('0xa5'),_0x4da10a['name'],_0x88f4('0xa2'));}else{_0x4da10a[_0x88f4('0x43')]=_0x88f4('0xa3');loggerSyncQueueSummary['error'](_0x88f4('0xa5'),_0x4da10a[_0x88f4('0x45')],_0x88f4('0xa4'));}emitCampaignSummary(_0x4da10a);}}function createObjHistory(_0x40cea4,_0x365346,_0x89efab,_0x1b9261,_0x49ef0a){_0x40cea4[_0x88f4('0x43')]=_0x89efab;var _0x6a7a30=new Action(_0x40cea4,_0x365346);var _0x39ad1c=new History(_0x6a7a30);_0x39ad1c[_0x88f4('0xa6')]=_0x1b9261;_0x39ad1c[_0x88f4('0xa7')]=_0x49ef0a;_0x39ad1c[_0x88f4('0xa8')]=_0x6a7a30[_0x88f4('0xa9')];return _0x39ad1c;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x1cce1e=this;setInterval(function(){_0x1cce1e[_0x88f4('0xaa')](_0x1cce1e[_0x88f4('0x2a')],_0x88f4('0xab'));_0x1cce1e[_0x88f4('0xaa')](_0x1cce1e[_0x88f4('0x28')],_0x88f4('0xac'));},0x32c8);};Dialer['prototype'][_0x88f4('0xaa')]=function(_0x574506,_0x567789){var _0x90711b=this;for(var _0x36e037 in _0x574506){if(typeof _0x574506[_0x36e037]!==_0x88f4('0x99')){this[_0x88f4('0x20')][_0x88f4('0x1d')](function(){if(!_['isNil'](_0x574506[_0x36e037])){return ami[_0x88f4('0xad')]({'action':_0x88f4('0xae'),'channel':_0x574506[_0x36e037][_0x88f4('0xaf')]})[_0x88f4('0xb0')](function(_0x52c1e2){if(_0x52c1e2['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x574506[_0x36e037]&&_0x574506[_0x36e037][_0x88f4('0x51')]!==_0x88f4('0xb1')){_0x90711b[_0x88f4('0xb2')](_0x90711b[_0x88f4('0x22')][_0x574506[_0x36e037][_0x88f4('0xb3')]]);logger[_0x88f4('0x95')]('[Dialer][checkChannel]',_0x567789,_0x36e037,_0x574506[_0x36e037][_0x88f4('0xb3')]);delete _0x574506[_0x36e037];}if(_0x574506[_0x36e037]&&_0x574506[_0x36e037]['type']===_0x88f4('0xb1')){_0x90711b[_0x88f4('0xb2')](_0x90711b[_0x88f4('0x23')][_0x574506[_0x36e037]['queue']]);logger[_0x88f4('0x95')](_0x88f4('0xb4'),_0x567789,_0x36e037,_0x574506[_0x36e037][_0x88f4('0xb3')]);delete _0x574506[_0x36e037];}},0x2328);}});}});}}};Dialer[_0x88f4('0x1c')]['countReScheduled']=function(_0x5e28db){return BPromise[_0x88f4('0xb5')]()[_0x88f4('0x40')](cmHopper[_0x88f4('0xb6')](_0x5e28db))[_0x88f4('0xb0')](loggerCatch(_0x88f4('0xb7')));};Dialer['prototype']['checkIsBlackList']=function(_0x54e042){return BPromise[_0x88f4('0xb5')]()[_0x88f4('0x40')](cmHopperBlack['checkIsBlackList'](_0x54e042))[_0x88f4('0xb0')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x88f4('0x1c')][_0x88f4('0xb8')]=function(_0x18f066){return BPromise['resolve']()['then'](cmHopperBlack[_0x88f4('0xb8')](_0x18f066))['catch'](loggerCatch(_0x88f4('0xb9')));};Dialer[_0x88f4('0x1c')][_0x88f4('0xba')]=function(_0x4b50bd){return BPromise[_0x88f4('0xb5')]()[_0x88f4('0x40')](cmHopperHistory[_0x88f4('0xbb')](_0x4b50bd))[_0x88f4('0xb0')](loggerCatch(_0x88f4('0xbc')));};Dialer['prototype']['rescheduleContact']=function(_0x2177b9){return BPromise[_0x88f4('0xb5')]()[_0x88f4('0x40')](cmHopper[_0x88f4('0xbd')](_0x2177b9))[_0x88f4('0xb0')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x88f4('0x1c')][_0x88f4('0xbe')]=function(_0x1a9f15,_0x1ac62e,_0x132c2f){return BPromise[_0x88f4('0xb5')]()[_0x88f4('0x40')](cmHopper[_0x88f4('0xbe')](_0x1a9f15,_0x1ac62e,_0x132c2f))[_0x88f4('0xb0')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x88f4('0x1c')][_0x88f4('0xbf')]=function(_0x5041cc,_0x3061c6,_0x3c5da6,_0x2a17cc,_0x559637){return BPromise[_0x88f4('0xb5')]()['then'](cmHopper[_0x88f4('0xbf')](_0x5041cc,_0x3061c6,_0x3c5da6,_0x2a17cc))['catch'](function(_0x1e4726){_0x559637['temp']-=_0x3c5da6;_0x559637[_0x88f4('0xc0')]=_0x559637[_0x88f4('0xc0')]>0x0?_0x559637[_0x88f4('0xc0')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x1e4726);});};Dialer[_0x88f4('0x1c')][_0x88f4('0xc1')]=function(_0x1abd62,_0x2c3500,_0x17fb3c,_0x4387d6){return BPromise[_0x88f4('0xb5')]()[_0x88f4('0x40')](cmHopper['getContactDialerIvr'](_0x1abd62,_0x2c3500,_0x17fb3c))[_0x88f4('0xb0')](function(_0x54f14a){_0x4387d6[_0x88f4('0xc0')]-=_0x2c3500;_0x4387d6[_0x88f4('0xc0')]=_0x4387d6[_0x88f4('0xc0')]>0x0?_0x4387d6[_0x88f4('0xc0')]:0x0;loggerCatch(_0x88f4('0xc2'))(_0x54f14a);});};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x17e6a4){return BPromise[_0x88f4('0xb5')]()['then'](voiceQueueRt[_0x88f4('0xc3')](_0x17e6a4))[_0x88f4('0xb0')](loggerCatch(_0x88f4('0xc4')));};Dialer[_0x88f4('0x1c')]['moveContactManagedDialer']=function(_0x4ce26e){return BPromise[_0x88f4('0xb5')]()['then'](cmHopper['moveContactManagedDialer'](_0x4ce26e))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype']['createHistory']=function(_0x535bd3){return BPromise[_0x88f4('0xb5')]()[_0x88f4('0x40')](cmHopperHistory[_0x88f4('0xc5')](_0x535bd3))[_0x88f4('0xb0')](loggerCatch(_0x88f4('0xc6')));};Dialer[_0x88f4('0x1c')][_0x88f4('0xb2')]=function(_0x425f37){if(!_['isUndefined'](_0x425f37)&&_0x425f37!==null){if(typeof _0x425f37[_0x88f4('0x76')]!==_0x88f4('0x99')){if(_0x425f37['originated']>0x0){_0x425f37['originated']-=0x1;}else{logger[_0x88f4('0x95')](_0x88f4('0xc7'));}}}else{logger['error'](_0x88f4('0xc8'));}};Dialer[_0x88f4('0x1c')]['loggerHandler']=function(_0x3d5a71,_0x270a01){var _0x14c210=this;return function(_0x1dd203){_0x14c210['updateOriginated'](_0x270a01);logger[_0x88f4('0x95')](_0x3d5a71,util['inspect'](_0x1dd203,{'showHidden':![],'depth':null}));};};Dialer[_0x88f4('0x1c')][_0x88f4('0xc9')]=function(_0x25610c,_0x29f44d,_0x2184a9){var _0x17a2d8={'state':0x19,'statedesc':'notFound'};this[_0x88f4('0xb2')](_0x29f44d);this[_0x88f4('0xca')](_[_0x88f4('0x90')](_0x17a2d8,_['pick'](_0x2184a9,[_0x88f4('0xcb'),'ListId',_0x88f4('0xcc'),_0x88f4('0xcd'),_0x88f4('0xce')])),_0x88f4('0xcf'),_0x88f4('0xd0'));logger['error'](_0x25610c);};Dialer[_0x88f4('0x1c')][_0x88f4('0xd1')]=function(_0x191baf){return _0x191baf==='Success';};Dialer[_0x88f4('0x1c')][_0x88f4('0xd2')]=function(_0x4611e9){return!_[_0x88f4('0x41')](_0x4611e9)&&_0x4611e9&&!_[_0x88f4('0x41')](_0x4611e9[_0x88f4('0x45')])&&!_['isUndefined'](_0x4611e9[_0x88f4('0x7b')])&&_0x4611e9['active']&&(this[_0x88f4('0x25')][util['format'](_0x88f4('0xd3'),_0x4611e9['name'])]['status']===_0x88f4('0xd4')||this['trunks'][util[_0x88f4('0x7c')]('SIP/%s',_0x4611e9['name'])][_0x88f4('0xae')]===_0x88f4('0xd5'));};Dialer['prototype'][_0x88f4('0xca')]=function(_0x4cb038,_0x21d16c,_0x3aa0e2){this['createHistory'](_0x4cb038)[_0x88f4('0xb0')](loggerCatch(_0x21d16c));this[_0x88f4('0xd6')](_0x4cb038)[_0x88f4('0xb0')](loggerCatch(_0x3aa0e2));};Dialer[_0x88f4('0x1c')][_0x88f4('0x3a')]=function(_0x2c0de8){var _0x3ba970=this['uniqueId'][_0x2c0de8[_0x88f4('0xd7')]];var _0x4e3496;if(!_[_0x88f4('0xd8')](_0x2c0de8)&&!_[_0x88f4('0xd8')](_0x2c0de8[_0x88f4('0xd9')])&&!_[_0x88f4('0xd8')](_0x2c0de8['variable'][_0x88f4('0xda')])&&_0x2c0de8['exten']===_0x88f4('0xdb')&&_0x3ba970){if(_0x3ba970[_0x88f4('0x51')]!==_0x88f4('0xb1')&&this[_0x88f4('0x22')][_0x3ba970['queue']]['dialAMDActive']&&_0x2c0de8[_0x88f4('0xdc')]===_0x88f4('0xdd')){delete this['uniqueId'][_0x2c0de8[_0x88f4('0xd7')]];this[_0x88f4('0xb2')](this['voiceQueues'][_0x3ba970[_0x88f4('0xb3')]]);this['voiceQueues'][_0x3ba970[_0x88f4('0xb3')]][_0x88f4('0x64')]+=0x1;this[_0x88f4('0x22')][_0x3ba970[_0x88f4('0xb3')]][_0x88f4('0x63')]+=0x1;_0x4e3496=new Hangup(_0x3ba970,_0x2c0de8);_0x4e3496[_0x88f4('0xa6')]=0x12;_0x4e3496[_0x88f4('0xa7')]=_0x88f4('0xde');_0x4e3496[_0x88f4('0xdf')]=_0x88f4('0xe0');ami[_0x88f4('0xe1')](_0x88f4('0xe2'),ut[_0x88f4('0xe3')](_0x4e3496,_0x88f4('0xe4')));this[_0x88f4('0xca')](_0x4e3496,_0x88f4('0xe5'),_0x88f4('0xe6'));}if(_0x3ba970[_0x88f4('0x51')]!==_0x88f4('0xb1')&&this[_0x88f4('0x22')][_0x3ba970['queue']][_0x88f4('0xe7')]&&_0x2c0de8[_0x88f4('0xdc')]===_0x88f4('0xe8')){var _0x5754e5=this;return new BPromise(function(_0x43802e,_0x366f85){delete _0x5754e5[_0x88f4('0x2a')][_0x2c0de8[_0x88f4('0xd7')]];_0x5754e5['updateOriginated'](_0x5754e5[_0x88f4('0x22')][_0x3ba970[_0x88f4('0xb3')]]);_0x5754e5['voiceQueues'][_0x3ba970[_0x88f4('0xb3')]][_0x88f4('0x64')]+=0x1;_0x5754e5[_0x88f4('0x22')][_0x3ba970[_0x88f4('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4db635=_0x5754e5[_0x88f4('0x22')][_0x3ba970['queue']];var _0x42c31e=new Hangup(_0x3ba970,_0x2c0de8);_0x42c31e['state']=0x13;_0x42c31e[_0x88f4('0xa7')]='Machine';_0x42c31e[_0x88f4('0xdf')]=_0x88f4('0xe0');_0x42c31e[_0x88f4('0xe9')]+=0x1;_0x42c31e[_0x88f4('0xea')]+=0x1;_0x42c31e[_0x88f4('0xe4')]=!![];ami[_0x88f4('0xe1')]('custom:amd',ut[_0x88f4('0xe3')](_0x42c31e,'amd'));_0x5754e5[_0x88f4('0xc5')](_0x42c31e)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0xeb')));if(_0x42c31e[_0x88f4('0xec')]+_0x42c31e[_0x88f4('0xed')]+_0x42c31e[_0x88f4('0xee')]+_0x42c31e[_0x88f4('0xef')]+_0x42c31e[_0x88f4('0xf0')]+_0x42c31e[_0x88f4('0xf1')]+_0x42c31e[_0x88f4('0xe9')]+_0x42c31e[_0x88f4('0xf2')]>=_0x4db635[_0x88f4('0xf3')]){_0x5754e5[_0x88f4('0xf4')](_0x42c31e,_0x43802e,_0x366f85,_0x88f4('0xf5'));}else{if(_0x42c31e['countmachineretry']>=_0x4db635[_0x88f4('0xf6')]){_0x5754e5[_0x88f4('0xf7')](_0x42c31e,_0x43802e,_0x366f85,_0x88f4('0xf8'));}else{_0x5754e5['rescheduleContact']({'active':![],'countmachineretry':_0x42c31e[_0x88f4('0xe9')],'scheduledat':moment()['add'](_0x4db635[_0x88f4('0xf9')],_0x88f4('0xfa'))['format'](_0x88f4('0xfb')),'ContactId':_0x42c31e[_0x88f4('0xcb')],'ListId':_0x42c31e['ListId'],'VoiceQueueId':_0x42c31e[_0x88f4('0xcd')]||undefined,'CampaignId':_0x42c31e[_0x88f4('0xce')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x43802e({'reschedule':0x1});}}});}if(_0x3ba970[_0x88f4('0x51')]===_0x88f4('0xb1')&&this[_0x88f4('0x23')][_0x3ba970[_0x88f4('0xb3')]][_0x88f4('0xe7')]&&_0x2c0de8[_0x88f4('0xdc')]===_0x88f4('0xdd')){delete this[_0x88f4('0x2a')][_0x2c0de8[_0x88f4('0xd7')]];this[_0x88f4('0xb2')](this[_0x88f4('0x23')][_0x3ba970[_0x88f4('0xb3')]]);_0x4e3496=new Hangup(_0x3ba970,_0x2c0de8);_0x4e3496[_0x88f4('0xa6')]=0x12;_0x4e3496['statedesc']=_0x88f4('0xde');_0x4e3496['membername']=_0x88f4('0xe0');ami[_0x88f4('0xe1')](_0x88f4('0xe2'),ut['buildObj'](_0x4e3496,_0x88f4('0xe4')));this[_0x88f4('0xca')](_0x4e3496,_0x88f4('0xfc'),_0x88f4('0xfd'));}if(_0x3ba970['type']===_0x88f4('0xb1')&&this[_0x88f4('0x23')][_0x3ba970['queue']][_0x88f4('0xe7')]&&_0x2c0de8['value']===_0x88f4('0xe8')){var _0x5754e5=this;return new BPromise(function(_0x46ae09,_0x3f9824){delete _0x5754e5[_0x88f4('0x2a')][_0x2c0de8['uniqueid']];_0x5754e5[_0x88f4('0xb2')](_0x5754e5[_0x88f4('0x23')][_0x3ba970[_0x88f4('0xb3')]]);_0x5754e5[_0x88f4('0x23')][_0x3ba970[_0x88f4('0xb3')]][_0x88f4('0x64')]+=0x1;_0x5754e5[_0x88f4('0x23')][_0x3ba970[_0x88f4('0xb3')]][_0x88f4('0x63')]+=0x1;var _0x1705b0=_0x5754e5['campaigns'][_0x3ba970['queue']];var _0x11872a=new Hangup(_0x3ba970,_0x2c0de8);_0x11872a[_0x88f4('0xa6')]=0x13;_0x11872a[_0x88f4('0xa7')]='Machine';_0x11872a['membername']='AMD';_0x11872a[_0x88f4('0xe9')]+=0x1;_0x11872a['countglobal']+=0x1;_0x11872a[_0x88f4('0xe4')]=!![];ami[_0x88f4('0xe1')](_0x88f4('0xe2'),ut['buildObj'](_0x11872a,_0x88f4('0xe4')));_0x5754e5[_0x88f4('0xc5')](_0x11872a)['catch'](loggerCatch(_0x88f4('0xeb')));if(_0x11872a[_0x88f4('0xec')]+_0x11872a['countcongestionretry']+_0x11872a['countnoanswerretry']+_0x11872a[_0x88f4('0xef')]+_0x11872a[_0x88f4('0xf0')]+_0x11872a[_0x88f4('0xf1')]+_0x11872a[_0x88f4('0xe9')]+_0x11872a[_0x88f4('0xf2')]>=_0x1705b0[_0x88f4('0xf3')]){_0x5754e5[_0x88f4('0xf4')](_0x11872a,_0x46ae09,_0x3f9824,_0x88f4('0xf5'));}else{if(_0x11872a[_0x88f4('0xe9')]>=_0x1705b0[_0x88f4('0xf6')]){_0x5754e5[_0x88f4('0xf7')](_0x11872a,_0x46ae09,_0x3f9824,'reason\x2019\x20machine....');}else{_0x5754e5[_0x88f4('0xbd')]({'active':![],'countmachineretry':_0x11872a[_0x88f4('0xe9')],'scheduledat':moment()[_0x88f4('0xfe')](_0x1705b0['dialMachineRetryFrequency'],_0x88f4('0xfa'))[_0x88f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x11872a[_0x88f4('0xcb')],'ListId':_0x11872a[_0x88f4('0xff')],'VoiceQueueId':_0x11872a[_0x88f4('0xcd')]||undefined,'CampaignId':_0x11872a[_0x88f4('0xce')]||undefined})['catch'](loggerCatch(_0x88f4('0x100')));_0x46ae09({'reschedule':0x1});}}});}}};Dialer[_0x88f4('0x1c')][_0x88f4('0x101')]=function(_0x5d305a){var _0x168b40=this['uniqueId'][_0x5d305a[_0x88f4('0xd7')]];var _0xd2065d=this;var _0x466182;if(_0x168b40&&_0x168b40[_0x88f4('0x51')]===_0x88f4('0xb1')){delete this['uniqueId'][_0x5d305a[_0x88f4('0xd7')]];this[_0x88f4('0xb2')](this[_0x88f4('0x23')][_0x168b40[_0x88f4('0xb3')]]);this['campaigns'][_0x168b40[_0x88f4('0xb3')]][_0x88f4('0x102')]+=0x1;_0x466182=new Hangup(_0x168b40,_0x5d305a);this[_0x88f4('0xc5')](_0x466182)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x103')));this['moveContactManagedDialer'](_0x466182)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x104')));}if(_0x168b40&&_0x168b40[_0x88f4('0x51')]!==_0x88f4('0xb1')&&isNotNull(this[_0x88f4('0x22')][_0x168b40[_0x88f4('0xb3')]][_0x88f4('0x105')])){delete this[_0x88f4('0x2a')][_0x5d305a[_0x88f4('0xd7')]];this[_0x88f4('0xb2')](this[_0x88f4('0x22')][_0x168b40['queue']]);this['voiceQueues'][_0x168b40[_0x88f4('0xb3')]][_0x88f4('0x64')]+=0x1;this[_0x88f4('0x22')][_0x168b40['queue']][_0x88f4('0x63')]+=0x1;_0x466182=new Hangup(_0x168b40,_0x5d305a);_0x466182[_0x88f4('0xa6')]=0x10;_0x466182['statedesc']=_0x88f4('0x106');_0x466182['membername']='AGI';this[_0x88f4('0xc5')](_0x466182)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x103')));this[_0x88f4('0xd6')](_0x466182)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x104')));}if(_0x168b40&&_0x168b40[_0x88f4('0x51')]!==_0x88f4('0xb1')&&!isNotNull(this[_0x88f4('0x22')][_0x168b40[_0x88f4('0xb3')]][_0x88f4('0x105')])){delete this[_0x88f4('0x2a')][_0x5d305a['uniqueid']];this[_0x88f4('0xb2')](this[_0x88f4('0x22')][_0x168b40[_0x88f4('0xb3')]]);this[_0x88f4('0x22')][_0x168b40[_0x88f4('0xb3')]][_0x88f4('0x6e')]+=0x1;_0x466182=new Hangup(_0x168b40,_0x5d305a);_0x466182[_0x88f4('0xa6')]=0xc;_0x466182[_0x88f4('0xa7')]=_0x5d305a[_0x88f4('0x107')];_0x466182[_0x88f4('0xdf')]='Unknow';this['createHistory'](_0x466182)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x103')));this[_0x88f4('0xd6')](_0x466182)['catch'](loggerCatch(_0x88f4('0x104')));}};Dialer[_0x88f4('0x1c')][_0x88f4('0x36')]=function(_0x66f253){var _0x358f91=this[_0x88f4('0x2a')][_0x66f253['uniqueid']];var _0x28f9c5=this;if(this[_0x88f4('0x22')][_0x66f253[_0x88f4('0xb3')]]){if(_0x358f91&&_0x358f91[_0x88f4('0x51')]!==_0x88f4('0xb1')){delete this[_0x88f4('0x2a')][_0x66f253['uniqueid']];this[_0x88f4('0x22')][_0x66f253[_0x88f4('0xb3')]][_0x88f4('0x64')]+=0x1;var _0x42fce0=new AgentComplete(_0x358f91,_0x66f253);if(_0x66f253[_0x88f4('0x108')]===_0x88f4('0x109')){_0x42fce0['agiafterat']=this[_0x88f4('0x22')][_0x66f253[_0x88f4('0xb3')]][_0x88f4('0x10a')]&&this['voiceQueues'][_0x66f253[_0x88f4('0xb3')]][_0x88f4('0x10b')]?moment()['format'](_0x88f4('0xfb')):undefined;}this[_0x88f4('0xc5')](_0x42fce0)['catch'](loggerCatch(_0x88f4('0x10c')));this[_0x88f4('0xd6')](_0x42fce0)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x10d')));}}};Dialer[_0x88f4('0x1c')][_0x88f4('0x31')]=function(_0x4fecc2){if(this[_0x88f4('0x22')][_0x4fecc2['queue']]){if(this[_0x88f4('0x2a')][_0x4fecc2[_0x88f4('0xd7')]]&&this[_0x88f4('0x2a')][_0x4fecc2[_0x88f4('0xd7')]][_0x88f4('0x51')]!==_0x88f4('0xb1')){this[_0x88f4('0xb2')](this[_0x88f4('0x22')][_0x4fecc2[_0x88f4('0xb3')]]);this[_0x88f4('0x2a')][_0x4fecc2[_0x88f4('0xd7')]][_0x88f4('0x10e')]=moment()[_0x88f4('0x7c')](_0x88f4('0xfb'));}}};Dialer[_0x88f4('0x1c')]['queueCallerAbandonCreateState']=function(_0x85cc4f){this[_0x88f4('0xc5')](_0x85cc4f)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x10c')));this[_0x88f4('0xd6')](_0x85cc4f)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x10f')));};Dialer[_0x88f4('0x1c')][_0x88f4('0x34')]=function(_0x453e94){var _0x5687bb=this['uniqueId'][_0x453e94[_0x88f4('0xd7')]];var _0x2ec066=this;if(this['voiceQueues'][_0x453e94[_0x88f4('0xb3')]]){if(_0x5687bb&&_0x5687bb[_0x88f4('0x51')]!==_0x88f4('0xb1')){delete this[_0x88f4('0x2a')][_0x453e94[_0x88f4('0xd7')]];this['updateOriginated'](this[_0x88f4('0x22')][_0x453e94[_0x88f4('0xb3')]]);_0x5687bb[_0x88f4('0x110')]=moment()[_0x88f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5c8cf6=new QueueCallerAbandon(_0x5687bb,_0x453e94);if(getSeconds(_0x5687bb[_0x88f4('0x110')],_0x5687bb[_0x88f4('0x111')])>=_0x5687bb['dialQueueTimeout']){this[_0x88f4('0x22')][_0x453e94[_0x88f4('0xb3')]][_0x88f4('0x71')]+=0x1;this[_0x88f4('0x22')][_0x453e94['queue']][_0x88f4('0x6a')]+=0x1;this[_0x88f4('0x22')][_0x453e94[_0x88f4('0xb3')]][_0x88f4('0x112')]+=0x1;_0x5c8cf6['state']=0xa;_0x5c8cf6[_0x88f4('0xa7')]='Drop';_0x5c8cf6['dropreason']=_0x88f4('0x113');_0x5c8cf6['agiafterat']=this[_0x88f4('0x22')][_0x453e94[_0x88f4('0xb3')]]['dialQueueProject2']?moment()[_0x88f4('0x7c')](_0x88f4('0xfb')):undefined;_0x5c8cf6['countdropretry']+=0x1;_0x5c8cf6[_0x88f4('0xea')]+=0x1;if(_0x5c8cf6[_0x88f4('0xf0')]>=this[_0x88f4('0x22')][_0x453e94['queue']][_0x88f4('0x114')]){this[_0x88f4('0x115')](_0x5c8cf6);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x5c8cf6[_0x88f4('0xf0')],'scheduledat':moment()['add'](this[_0x88f4('0x22')][_0x453e94[_0x88f4('0xb3')]]['dialDropRetryFrequency'],_0x88f4('0xfa'))[_0x88f4('0x7c')](_0x88f4('0xfb')),'ContactId':_0x5687bb[_0x88f4('0xcb')],'ListId':_0x5687bb[_0x88f4('0xff')],'VoiceQueueId':_0x5687bb['VoiceQueueId']||undefined,'CampaignId':_0x5687bb[_0x88f4('0xce')]||undefined})['catch'](loggerCatch(_0x88f4('0x116')));var _0x33a1ca=new History(_0x5c8cf6);_0x33a1ca[_0x88f4('0xa6')]=0xa;_0x33a1ca[_0x88f4('0xa7')]=_0x88f4('0x117');_0x33a1ca['starttime']=moment()[_0x88f4('0x7c')](_0x88f4('0xfb'));_0x33a1ca['endtime']=_0x33a1ca[_0x88f4('0xa9')];_0x33a1ca[_0x88f4('0x118')]=_0x5c8cf6[_0x88f4('0x118')];_0x33a1ca[_0x88f4('0x119')]=_0x5c8cf6['calleridnum'];this[_0x88f4('0xc5')](_0x33a1ca)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x11a')));}}else{this[_0x88f4('0x22')][_0x453e94[_0x88f4('0xb3')]][_0x88f4('0x70')]+=0x1;this[_0x88f4('0x22')][_0x453e94[_0x88f4('0xb3')]][_0x88f4('0x69')]+=0x1;_0x5c8cf6['state']=0xb;_0x5c8cf6[_0x88f4('0xa7')]='Abandoned';_0x5c8cf6[_0x88f4('0x11b')]=_0x88f4('0x11c');_0x5c8cf6[_0x88f4('0xf1')]+=0x1;_0x5c8cf6[_0x88f4('0xea')]+=0x1;if(_0x5c8cf6[_0x88f4('0xf1')]>=this[_0x88f4('0x22')][_0x453e94[_0x88f4('0xb3')]][_0x88f4('0x11d')]){this[_0x88f4('0x115')](_0x5c8cf6);}else{this[_0x88f4('0xbd')]({'active':![],'countabandonedretry':_0x5c8cf6[_0x88f4('0xf1')],'scheduledat':moment()[_0x88f4('0xfe')](this[_0x88f4('0x22')][_0x453e94[_0x88f4('0xb3')]][_0x88f4('0x11e')],_0x88f4('0xfa'))[_0x88f4('0x7c')](_0x88f4('0xfb')),'ContactId':_0x5687bb[_0x88f4('0xcb')],'ListId':_0x5687bb['ListId'],'VoiceQueueId':_0x5687bb[_0x88f4('0xcd')]||undefined,'CampaignId':_0x5687bb['CampaignId']||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x11f')));var _0x33a1ca=new History(_0x5c8cf6);_0x33a1ca[_0x88f4('0xa6')]=0xb;_0x33a1ca[_0x88f4('0xa7')]=_0x88f4('0x120');_0x33a1ca['starttime']=moment()['format'](_0x88f4('0xfb'));_0x33a1ca['endtime']=_0x33a1ca[_0x88f4('0xa9')];_0x33a1ca[_0x88f4('0x118')]=_0x5c8cf6[_0x88f4('0x118')];_0x33a1ca['calleridnum']=_0x5c8cf6['calleridnum'];this['createHistory'](_0x33a1ca)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x121')));}}}}};Dialer['prototype'][_0x88f4('0x39')]=function(_0x12235d){if(this[_0x88f4('0x28')][_0x12235d[_0x88f4('0xd7')]]){this[_0x88f4('0x28')][_0x12235d[_0x88f4('0xd7')]]['channel']=_0x12235d[_0x88f4('0xaf')];}if(this[_0x88f4('0x2a')][_0x12235d[_0x88f4('0xd7')]]){this['uniqueId'][_0x12235d[_0x88f4('0xd7')]]['channel']=_0x12235d[_0x88f4('0xaf')];}};Dialer[_0x88f4('0x1c')][_0x88f4('0x122')]=function(_0x224e54){if(strategy[this[_0x88f4('0x22')][this[_0x88f4('0x28')][_0x224e54[_0x88f4('0x123')]][_0x88f4('0xb3')]]['strategy']]===_0x88f4('0x1b')){if(this[_0x88f4('0x28')][_0x224e54['actionid']]&&_['isNil'](this['actions'][_0x224e54[_0x88f4('0x123')]][_0x88f4('0x124')])&&_0x224e54[_0x88f4('0xae')]==='1'&&_0x224e54[_0x88f4('0x125')]==='0'){if(this[_0x88f4('0x24')][_0x224e54['stateinterface']]){if(!this['agents'][_0x224e54[_0x88f4('0x126')]][_0x88f4('0x124')]){this['agents'][_0x224e54['stateinterface']][_0x88f4('0x124')]=!![];this[_0x88f4('0x28')][_0x224e54[_0x88f4('0x123')]][_0x88f4('0x124')]=!![];this['actions'][_0x224e54[_0x88f4('0x123')]][_0x88f4('0x126')]=_0x224e54[_0x88f4('0x126')];}}}}else if((strategy[this[_0x88f4('0x22')][this[_0x88f4('0x28')][_0x224e54[_0x88f4('0x123')]][_0x88f4('0xb3')]][_0x88f4('0x52')]]||_0x88f4('0x127'))===_0x88f4('0x127')){if(this[_0x88f4('0x28')][_0x224e54[_0x88f4('0x123')]]){if(this['agents'][_0x224e54[_0x88f4('0x126')]]){this[_0x88f4('0x28')][_0x224e54[_0x88f4('0x123')]][_0x88f4('0x126')]=_0x224e54[_0x88f4('0x126')];if(_[_0x88f4('0xd8')](this[_0x88f4('0x2e')][this[_0x88f4('0x28')][_0x224e54[_0x88f4('0x123')]][_0x88f4('0xb3')]])){this['queueBooked'][this[_0x88f4('0x28')][_0x224e54['actionid']]['queue']]=[];}this[_0x88f4('0x2e')][this['actions'][_0x224e54[_0x88f4('0x123')]][_0x88f4('0xb3')]][_0x88f4('0x128')](_[_0x88f4('0x90')](_[_0x88f4('0x129')](this[_0x88f4('0x28')][_0x224e54[_0x88f4('0x123')]],[_0x88f4('0x12a'),_0x88f4('0x126')]),{'status':_0x224e54[_0x88f4('0xae')],'paused':_0x224e54['paused']}));}}}};function unlockQueueStatus(_0x42874b,_0x469d5e){setTimeout(function(){if(_['isUndefined'](_0x42874b['queueStatusComplete'])){loggerBooked[_0x88f4('0x95')](_0x88f4('0x12b'),_0x469d5e);}_0x42874b[_0x88f4('0x12c')]=!![];loggerBooked[_0x88f4('0x80')](_0x88f4('0x12d'),_0x469d5e,JSON['stringify'](_[_0x88f4('0x129')](_0x42874b,[_0x88f4('0x45'),_0x88f4('0x12c')])));},0x1f3);}Dialer[_0x88f4('0x1c')][_0x88f4('0x3d')]=function(_0x19e83a){var _0x34fb3e=this;var _0x1bc778=_0x34fb3e['voiceQueues'][_0x34fb3e[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]]['queue']];if(strategy[this[_0x88f4('0x22')][this['actions'][_0x19e83a[_0x88f4('0x123')]][_0x88f4('0xb3')]]['strategy']]===_0x88f4('0x1b')){if(this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]]&&this[_0x88f4('0x28')][_0x19e83a['actionid']][_0x88f4('0x126')]){this[_0x88f4('0x21')][_0x88f4('0x12e')](this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]]['idHopper'],this['actions'][_0x19e83a[_0x88f4('0x123')]][_0x88f4('0x126')])[_0x88f4('0xb0')](function(_0x37e9e2){logger[_0x88f4('0x95')](_0x88f4('0x12f'),util[_0x88f4('0x96')](_0x37e9e2,{'showHidden':![],'depth':null}));})['finally'](function(){_0x34fb3e[_0x88f4('0xb2')](_0x34fb3e[_0x88f4('0x22')][_0x34fb3e[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]][_0x88f4('0xb3')]]);_0x34fb3e[_0x88f4('0x24')][_0x34fb3e[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]][_0x88f4('0x126')]][_0x88f4('0x124')]=![];delete _0x34fb3e[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]];unlockQueueStatus(_0x1bc778);});}else{this[_0x88f4('0xb2')](this[_0x88f4('0x22')][this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]][_0x88f4('0xb3')]]);this[_0x88f4('0xbd')]({'active':![],'ContactId':this[_0x88f4('0x28')][_0x19e83a['actionid']][_0x88f4('0xcb')],'ListId':this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]][_0x88f4('0xff')],'VoiceQueueId':this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]][_0x88f4('0xce')]||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x130')));delete this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]];unlockQueueStatus(_0x1bc778);}}else if((strategy[this['voiceQueues'][this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]]['queue']][_0x88f4('0x52')]]||_0x88f4('0x127'))===_0x88f4('0x127')){var _0x93d285;if(this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]]&&!_[_0x88f4('0x4b')](this[_0x88f4('0x2e')][this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]][_0x88f4('0xb3')]])){if(this[_0x88f4('0x2f')][_0x34fb3e[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]]['queue']]){this[_0x88f4('0x2f')][_0x34fb3e[_0x88f4('0x28')][_0x19e83a['actionid']][_0x88f4('0xb3')]]=this[_0x88f4('0x2f')][this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]][_0x88f4('0xb3')]]?this[_0x88f4('0x2f')][this['actions'][_0x19e83a[_0x88f4('0x123')]]['queue']]:this['queueBooked'][this[_0x88f4('0x28')][_0x19e83a['actionid']]['queue']]?this['queueBooked'][this[_0x88f4('0x28')][_0x19e83a['actionid']][_0x88f4('0xb3')]]['_rr']||0x0:0x0;}this[_0x88f4('0x2e')][this[_0x88f4('0x28')][_0x19e83a[_0x88f4('0x123')]]['queue']][_0x88f4('0x131')]=this[_0x88f4('0x2f')][this[_0x88f4('0x28')][_0x19e83a['actionid']][_0x88f4('0xb3')]];for(var _0x3a4c5b=0x0;_0x3a4c5b=0x0;})[_0x88f4('0xb0')](myreject(_0x163ff7)));}}else{_0x2b0007[_0x88f4('0x128')](ami['Action']({'action':'command','command':util['format'](_0x88f4('0x14a'),_0x231d15,!_['isUndefined'](config[_0x88f4('0x142')][_0x175b2c])?_0x175b2c:'')})[_0x88f4('0x40')](function(_0x325d3e){return _0x325d3e[_0x88f4('0x147')][_0x88f4('0x148')]('true')>=0x0;})[_0x88f4('0xb0')](myreject(_0x163ff7)));}BPromise[_0x88f4('0x14b')](_0x2b0007)[_0x88f4('0x40')](function(_0x3549ed){var _0x136d04=_[_0x88f4('0x14c')](_0x3549ed);if(_0x136d04){return _0x121e42(_0x136d04);}else{_0xdc314[_0x88f4('0x43')]=_0x5c8ce4?_0x88f4('0x14d'):_0x88f4('0x14e');return _0x163ff7(msgResponse(_0x88f4('0x14f'),_0x88f4('0x140'),_0x88f4('0x150')+_0x5c8ce4+'\x20'+_0x5acfef+_0x88f4('0x151')+util[_0x88f4('0x96')](_0x231d15,{'showHidden':![],'depth':null})+_0x88f4('0x152')+_0x175b2c));}})[_0x88f4('0xb0')](function(_0x52b7dd){return _0x163ff7(msgResponse(_0x88f4('0x13e'),_0x88f4('0x140'),JSON[_0x88f4('0x4e')](_0x52b7dd)));});});};Dialer[_0x88f4('0x1c')][_0x88f4('0x153')]=function(_0x3e1e89){var _0xe884c9=this;return function(){switch(_0x3e1e89['dialMethod']){case'progressive':freeVariablesPredictive(_0x3e1e89);_0xe884c9[_0x88f4('0x154')](_0x3e1e89,0x1);break;case _0x88f4('0x155'):freeVariablesPredictive(_0x3e1e89);_0xe884c9['handlePower'](_0x3e1e89,_0x3e1e89[_0x88f4('0x156')]);break;case _0x88f4('0xb'):_0xe884c9['predictive'](_0x3e1e89);break;case'booked':freeVariablesPredictive(_0x3e1e89);_0xe884c9['handlePower'](_0x3e1e89,0x1);break;default:freeVariablesPredictive(_0x3e1e89);logger[_0x88f4('0x95')](_0x88f4('0x157'),_0x3e1e89[_0x88f4('0x45')],_0x88f4('0x158'));}};};Dialer[_0x88f4('0x1c')][_0x88f4('0x159')]=function(_0x280931){return BPromise['resolve']()[_0x88f4('0x40')](cmHopper[_0x88f4('0x15a')](_0x280931['id'],previewRecallmeReminderInterval))['then'](function(_0x19cfec){for(var _0x4b2b5b=0x0;_0x4b2b5b<_0x19cfec[_0x88f4('0x98')];_0x4b2b5b++){var _0x32199a=_0x19cfec[_0x4b2b5b]['Agent'][_0x88f4('0x45')];if(_0x32199a)io['to'](util[_0x88f4('0x7c')](_0x88f4('0x15b'),_0x32199a))['emit'](_0x88f4('0x15c'),{'hopper':_0x19cfec[_0x4b2b5b]});}})['catch'](function(_0x105131){});};Dialer[_0x88f4('0x1c')][_0x88f4('0x15d')]=function(_0x1898a6){var _0x39a082=this;return function(){_0x39a082[_0x88f4('0x15e')](_0x1898a6);};};Dialer[_0x88f4('0x1c')][_0x88f4('0xd')]=function(_0x3d9594){var _0xf44746=this;if(isNotPreview(_0x3d9594[_0x88f4('0x5f')])){if(isVoiceQueueOutbound(_0x3d9594[_0x88f4('0x51')])&&isActive(_0x3d9594[_0x88f4('0x5e')])){_0x3d9594['sendMessageOneNotActive']=!![];BPromise[_0x88f4('0xb5')]()['then'](checkIsLoggedIn(_0x3d9594,_0x3d9594[_0x88f4('0x55')]))['then'](checkIsActive(_0x3d9594,_0x3d9594['dialActive']))[_0x88f4('0x40')](checkInterval(_0x3d9594))[_0x88f4('0x40')](_0xf44746[_0x88f4('0x13a')](_0x3d9594))['then'](_0xf44746[_0x88f4('0x13d')](_0x3d9594['dialGlobalInterval'],_0x3d9594[_0x88f4('0x15f')],_0x3d9594[_0x88f4('0x45')],_0x3d9594))[_0x88f4('0x40')](_0xf44746[_0x88f4('0x13f')](_0x3d9594[_0x88f4('0x47')],_0x3d9594[_0x88f4('0x15f')],_0x3d9594[_0x88f4('0x45')],_0x3d9594))[_0x88f4('0x40')](_0xf44746[_0x88f4('0x153')](_0x3d9594))[_0x88f4('0xb0')](loggerCatchQueueSummary(_0x88f4('0x160'),_0x3d9594));}else{notSendMessagesQueue(_0x3d9594);}}else{freeVariablesPredictive(_0x3d9594);if(_0x3d9594['dialPreviewRecallmeReminder']){_0xf44746[_0x88f4('0x159')](_0x3d9594);}}};Dialer[_0x88f4('0x1c')][_0x88f4('0x161')]=function(){var _0x519d63=this;var _0x4e5f7a;for(var _0xe4d869 in this[_0x88f4('0x23')]){if(typeof this['campaigns'][_0xe4d869]!==_0x88f4('0x99')){_0x4e5f7a=this[_0x88f4('0x23')][_0xe4d869];if(isCampaignIvr(_0x4e5f7a[_0x88f4('0x51')])&&isActive(_0x4e5f7a[_0x88f4('0x7b')])){_0x4e5f7a[_0x88f4('0x9f')]=!![];BPromise[_0x88f4('0xb5')]()['then'](checkIsActive(_0x4e5f7a,_0x4e5f7a[_0x88f4('0x7b')]))[_0x88f4('0x40')](checkInterval(_0x4e5f7a))[_0x88f4('0x40')](_0x519d63[_0x88f4('0x13a')](_0x4e5f7a))['then'](_0x519d63[_0x88f4('0x13d')](_0x4e5f7a[_0x88f4('0x162')],_0x4e5f7a['dialTimezone'],_0x4e5f7a[_0x88f4('0x45')],_0x4e5f7a))['then'](_0x519d63[_0x88f4('0x13f')](_0x4e5f7a[_0x88f4('0x47')],_0x4e5f7a[_0x88f4('0x15f')],_0x4e5f7a[_0x88f4('0x45')],_0x4e5f7a))[_0x88f4('0x40')](_0x519d63[_0x88f4('0x15d')](_0x4e5f7a))[_0x88f4('0xb0')](loggerCatchQueueSummary(_0x88f4('0x163'),_0x4e5f7a));}else{notSendMessagesCampaign(_0x4e5f7a);}}}};function getCallerIdRandom(_0x4c7758,_0x41ad49){var _0x3e922e;var _0x169f19;var _0x50e861;if(_0x41ad49<=0x0){_0x41ad49=0x1;}_0x3e922e=new RegExp(_0x88f4('0x164')+_0x41ad49+'}$');_0x169f19=Math[_0x88f4('0x165')](0xa,_0x41ad49-0x1);_0x50e861=Math[_0x88f4('0x165')](0xa,_0x41ad49)-0x1;return util['format']('%s',_[_0x88f4('0x166')](_0x4c7758,_0x3e922e,_['random'](_0x169f19,_0x50e861)));}function extractCalleridName(_0x20c345){var _0x467d49=_0x20c345[_0x88f4('0x167')](/"(.*?)"/);return _0x467d49?_0x467d49[0x1]:_0x20c345;}function extractCalleridNumber(_0x4ef83d){var _0x41c008=_0x4ef83d[_0x88f4('0x167')](/<(.*?)>/);return _0x41c008?_0x41c008[0x1]:_0x4ef83d;}Dialer[_0x88f4('0x1c')][_0x88f4('0x168')]=function(_0x140923,_0xe72686){var _0x43ba48=this;var _0x2789d6=uuid['v4']();this[_0x88f4('0x28')][_0x2789d6]=new Action(_0x140923,_0xe72686,_0x2789d6);return new BPromise(function(_0xc2d558,_0x215ac8){if(_[_0x88f4('0x41')](_0x140923)&&typeof _0x140923!==_0x88f4('0x169')){return _0x215ac8(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x88f4('0x41')](_0xe72686['Contact'][_0x88f4('0x16a')])||_0xe72686[_0x88f4('0x16b')][_0x88f4('0x16a')]===null){return _0x215ac8(msgResponse(_0x88f4('0x16c'),_0x88f4('0x140'),_0x88f4('0x16d')));}var _0x56e311={'XMD-CALLERID':_0x43ba48[_0x88f4('0x28')][_0x2789d6][_0x88f4('0x16e')](),'XMD-AGI':_0x140923[_0x88f4('0x105')]?util[_0x88f4('0x7c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x140923[_0x88f4('0x105')]):_0x88f4('0x16f'),'XMD-AGIAFTER':_0x140923[_0x88f4('0x10a')]?util[_0x88f4('0x7c')](_0x88f4('0x170'),ipAgi,_0x140923[_0x88f4('0x10a')]):'NONE','XMD-QUEUE':_0x140923[_0x88f4('0x51')]===_0x88f4('0x171')?util['format']('\x22%s,%s%s,,,%s\x22',_0x140923[_0x88f4('0x45')],_0x140923[_0x88f4('0x172')]||'',_0x140923['dialAgiAfterHangupAgent']?'c':'',_0x140923[_0x88f4('0x173')]||0x3):_0x88f4('0x16f'),'XMD-CONTACTID':_0xe72686[_0x88f4('0xcb')],'XMD-CDRTYPE':_0x88f4('0x9'),'CALLERID(all)':_0x43ba48[_0x88f4('0x28')][_0x2789d6][_0x88f4('0x16e')](),'XMD-AMD':_0x140923[_0x88f4('0xe7')]?_0x88f4('0x174'):_0x88f4('0x16f'),'XMD-DESTINATION':_0x88f4('0xdb')};if(_0x140923[_0x88f4('0xe7')]){_0x56e311[_0x88f4('0x175')]=_0x140923['dialAMDInitialSilence']||0x9c4;_0x56e311[_0x88f4('0x176')]=_0x140923[_0x88f4('0x177')]||0x5dc;_0x56e311[_0x88f4('0x178')]=_0x140923['dialAMDAfterGreetingSilence']||0x320;_0x56e311[_0x88f4('0x179')]=_0x140923[_0x88f4('0x17a')]||0x1388;_0x56e311['XMD-AMDMINWORDLENGTH']=_0x140923['dialAMDMinWordLength']||0x64;_0x56e311[_0x88f4('0x17b')]=_0x140923[_0x88f4('0x17c')]||0x32;_0x56e311[_0x88f4('0x17d')]=_0x140923[_0x88f4('0x17e')]||0x3;_0x56e311[_0x88f4('0x17f')]=_0x140923['dialAMDSilenceThreshold']||0x100;_0x56e311[_0x88f4('0x180')]=_0x140923[_0x88f4('0x181')]||0x1388;}if(_0x140923['type']==='outbound'){_0x56e311['XMD-VOICEQUEUEID']=_0xe72686[_0x88f4('0xcd')];}else{_0x56e311['XMD-CAMPAIGNID']=_0xe72686[_0x88f4('0xce')];}for(var _0x450a0b in _0xe72686['Contact']){if(typeof _0xe72686[_0x88f4('0x16b')][_0x450a0b]!==_0x88f4('0x99')){if(isNotNull(_0xe72686[_0x88f4('0x16b')][_0x450a0b])&&_0x450a0b!=='id'&&_0x450a0b!==_0x88f4('0x182')&&_0x450a0b!==_0x88f4('0x183')&&_0x450a0b!==_0x88f4('0x184')){_0x56e311[util[_0x88f4('0x7c')](_0x88f4('0x185'),'XMD-',_[_0x88f4('0x186')](_0x450a0b))]=_0xe72686[_0x88f4('0x16b')][_0x450a0b];}}}var _0x5283c8=_0x43ba48[_0x88f4('0xd2')](_0x140923['Trunk'])?getCallerId(_0x140923[_0x88f4('0x7a')][_0x88f4('0x187')],_0x140923[_0x88f4('0x60')],_0x140923[_0x88f4('0x188')]>0x0?getCallerIdRandom(_0x140923[_0x88f4('0x61')],_0x140923[_0x88f4('0x188')]):_0x140923[_0x88f4('0x61')]):getCallerId(_[_0x88f4('0xd8')](_0x140923[_0x88f4('0x189')])?_0x140923[_0x88f4('0x7a')]['callerid']:_0x140923[_0x88f4('0x189')][_0x88f4('0x187')],_0x140923[_0x88f4('0x60')],_0x140923[_0x88f4('0x188')]>0x0?getCallerIdRandom(_0x140923[_0x88f4('0x61')],_0x140923[_0x88f4('0x188')]):_0x140923[_0x88f4('0x61')]);if(_0x5283c8){_0x56e311[_0x88f4('0x18a')]=_0x43ba48['actions'][_0x2789d6][_0x88f4('0x18b')]=extractCalleridName(_0x5283c8);_0x56e311[_0x88f4('0x18c')]=_0x43ba48[_0x88f4('0x28')][_0x2789d6]['originatecalleridnum']=extractCalleridNumber(_0x5283c8);}return ami[_0x88f4('0xad')]({'actionid':_0x2789d6,'action':_0x88f4('0x16c'),'channel':_0x43ba48[_0x88f4('0xd2')](_0x140923[_0x88f4('0x7a')])?util[_0x88f4('0x7c')](_0x88f4('0x18d'),_0x140923[_0x88f4('0x7a')][_0x88f4('0x45')],isNotNull(_0x140923[_0x88f4('0x62')])?_0x140923[_0x88f4('0x62')][_0x88f4('0x18e')]()||'':'',_0x140923[_0x88f4('0x18f')]>0x0?_0xe72686[_0x88f4('0x16b')][_0x88f4('0x16a')][_0x88f4('0x190')](_0x140923[_0x88f4('0x18f')]):_0xe72686[_0x88f4('0x16b')]['phone']):util[_0x88f4('0x7c')]('SIP/%s/%s%s',_[_0x88f4('0xd8')](_0x140923['TrunkBackup'])?_0x140923[_0x88f4('0x7a')][_0x88f4('0x45')]:_0x140923[_0x88f4('0x189')][_0x88f4('0x45')],isNotNull(_0x140923[_0x88f4('0x62')])?_0x140923[_0x88f4('0x62')][_0x88f4('0x18e')]()||'':'',_0x140923['dialCutDigit']>0x0?_0xe72686['Contact'][_0x88f4('0x16a')][_0x88f4('0x190')](_0x140923['dialCutDigit']):_0xe72686['Contact'][_0x88f4('0x16a')]),'callerid':_0x5283c8,'Exten':_0x88f4('0xdb'),'Context':_0x88f4('0x191'),'Priority':'1','variable':_0x56e311,'timeout':(_0x140923[_0x88f4('0x192')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2789d6})[_0x88f4('0x40')](function(_0x16d190){return _0xc2d558(_0x16d190);})[_0x88f4('0xb0')](function(_0xc4b330){_0x140923[_0x88f4('0x6c')]+=0x1;var _0x18674f=new History(_0x43ba48[_0x88f4('0x28')][_0x2789d6]);logger[_0x88f4('0x95')](util[_0x88f4('0x7c')](_0x88f4('0x193'),JSON['stringify'](_0xc4b330)));_0x18674f[_0x88f4('0xa6')]=0xe;_0x18674f[_0x88f4('0xa7')]=_0x88f4('0x194');_0x18674f['starttime']=moment()[_0x88f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');_0x18674f['endtime']=_0x18674f[_0x88f4('0xa9')];_0x43ba48[_0x88f4('0xc5')](_0x18674f)[_0x88f4('0xb0')](loggerCatch('[originate][error]'));_0x43ba48[_0x88f4('0xd6')](_0x18674f)[_0x88f4('0xb0')](loggerCatch('[originate][error]'))[_0x88f4('0x1f')](function(){delete _0x43ba48[_0x88f4('0x28')][_0x2789d6];return _0x215ac8(msgResponse('originate',_0x88f4('0x4d'),_0x88f4('0x195')));});});});};Dialer[_0x88f4('0x1c')][_0x88f4('0x196')]=function(_0x1f90bb){var _0x3e4b1b=this[_0x88f4('0x28')][_0x1f90bb[_0x88f4('0x123')]];if(_0x3e4b1b){delete this[_0x88f4('0x28')][_0x1f90bb[_0x88f4('0x123')]];_0x3e4b1b[_0x88f4('0x111')]=moment()['format'](_0x88f4('0xfb'));var _0x11f16e=_0x3e4b1b[_0x88f4('0x51')]===_0x88f4('0xb1')?this['campaigns'][_0x3e4b1b['queue']]:this['voiceQueues'][_0x3e4b1b[_0x88f4('0x197')]()];if(!this['isSuccess'](_0x1f90bb[_0x88f4('0x198')])){this[_0x88f4('0xb2')](_0x11f16e);return this[_0x88f4('0x199')](_0x3e4b1b,_0x11f16e,_0x1f90bb)['catch'](loggerCatch(_0x88f4('0x19a')));}this[_0x88f4('0x2a')][_0x1f90bb[_0x88f4('0xd7')]]=_0x3e4b1b;}};Dialer['prototype']['checkRetriveMax']=function(_0x136e2c,_0x4572ee,_0x443658){var _0x2d85fc=new History(_0x4572ee);if(_0x2d85fc['countbusyretry']+_0x2d85fc[_0x88f4('0xed')]+_0x2d85fc[_0x88f4('0xee')]+_0x2d85fc[_0x88f4('0xef')]+_0x2d85fc[_0x88f4('0xf0')]+_0x2d85fc[_0x88f4('0xf1')]+_0x2d85fc[_0x88f4('0xe9')]+_0x2d85fc[_0x88f4('0xf2')]>=_0x443658['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x136e2c){case 0x3:if(_0x2d85fc['countnoanswerretry']>=_0x443658[_0x88f4('0x19b')]-0x1){return!![];}this[_0x88f4('0xbd')]({'active':![],'countnoanswerretry':_0x2d85fc[_0x88f4('0xee')]+=0x1,'scheduledat':moment()['add'](_0x443658[_0x88f4('0x19c')],'minutes')[_0x88f4('0x7c')](_0x88f4('0xfb')),'ContactId':_0x2d85fc[_0x88f4('0xcb')],'ListId':_0x2d85fc['ListId'],'VoiceQueueId':_0x2d85fc[_0x88f4('0xcd')]||undefined,'CampaignId':_0x2d85fc['CampaignId']||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x19d')));break;case 0x5:if(_0x2d85fc[_0x88f4('0xec')]>=_0x443658[_0x88f4('0x19e')]-0x1){return!![];}this[_0x88f4('0xbd')]({'active':![],'countbusyretry':_0x2d85fc['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x443658['dialBusyRetryFrequency'],_0x88f4('0xfa'))[_0x88f4('0x7c')](_0x88f4('0xfb')),'ContactId':_0x2d85fc[_0x88f4('0xcb')],'ListId':_0x2d85fc['ListId'],'VoiceQueueId':_0x2d85fc[_0x88f4('0xcd')]||undefined,'CampaignId':_0x2d85fc[_0x88f4('0xce')]||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x19f')));break;case 0x8:if(_0x2d85fc[_0x88f4('0xed')]>=_0x443658[_0x88f4('0x1a0')]-0x1){return!![];}this[_0x88f4('0xbd')]({'active':![],'countcongestionretry':_0x2d85fc[_0x88f4('0xed')]+=0x1,'scheduledat':moment()[_0x88f4('0xfe')](_0x443658[_0x88f4('0x1a1')],'minutes')[_0x88f4('0x7c')](_0x88f4('0xfb')),'ContactId':_0x2d85fc['ContactId'],'ListId':_0x2d85fc['ListId'],'VoiceQueueId':_0x2d85fc[_0x88f4('0xcd')]||undefined,'CampaignId':_0x2d85fc['CampaignId']||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x1a2')));break;case 0x0:if(_0x2d85fc[_0x88f4('0xef')]>=_0x443658[_0x88f4('0x1a3')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x2d85fc['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x88f4('0xfe')](_0x443658['dialNoSuchNumberRetryFrequency'],_0x88f4('0xfa'))['format'](_0x88f4('0xfb')),'ContactId':_0x2d85fc[_0x88f4('0xcb')],'ListId':_0x2d85fc[_0x88f4('0xff')],'VoiceQueueId':_0x2d85fc[_0x88f4('0xcd')]||undefined,'CampaignId':_0x2d85fc['CampaignId']||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x1a4')));}break;case 0xa:if(_0x2d85fc[_0x88f4('0xf0')]>=_0x443658[_0x88f4('0x114')]-0x1){return!![];}this[_0x88f4('0xbd')]({'active':![],'countdropretry':_0x2d85fc[_0x88f4('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x443658[_0x88f4('0x1a5')],'minutes')[_0x88f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d85fc[_0x88f4('0xcb')],'ListId':_0x2d85fc['ListId'],'VoiceQueueId':_0x2d85fc['VoiceQueueId']||undefined,'CampaignId':_0x2d85fc[_0x88f4('0xce')]||undefined})['catch'](loggerCatch(_0x88f4('0x116')));break;case 0xb:if(_0x2d85fc[_0x88f4('0xf1')]>=_0x443658['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x88f4('0xbd')]({'active':![],'countabandonedretry':_0x2d85fc[_0x88f4('0xf1')]+=0x1,'scheduledat':moment()[_0x88f4('0xfe')](_0x443658[_0x88f4('0x11e')],_0x88f4('0xfa'))[_0x88f4('0x7c')](_0x88f4('0xfb')),'ContactId':_0x2d85fc['ContactId'],'ListId':_0x2d85fc['ListId'],'VoiceQueueId':_0x2d85fc[_0x88f4('0xcd')]||undefined,'CampaignId':_0x2d85fc[_0x88f4('0xce')]||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x11f')));break;case 0x13:if(_0x2d85fc['countmachineretry']>=_0x443658['dialMachineMaxRetry']-0x1){return!![];}this[_0x88f4('0xbd')]({'active':![],'countmachineretry':_0x2d85fc[_0x88f4('0xe9')]+=0x1,'scheduledat':moment()[_0x88f4('0xfe')](_0x443658['dialMachineRetryFrequency'],_0x88f4('0xfa'))[_0x88f4('0x7c')](_0x88f4('0xfb')),'ContactId':_0x2d85fc['ContactId'],'ListId':_0x2d85fc['ListId'],'VoiceQueueId':_0x2d85fc[_0x88f4('0xcd')]||undefined,'CampaignId':_0x2d85fc[_0x88f4('0xce')]||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x100')));break;case 0x14:if(_0x2d85fc['countagentrejectretry']>=_0x443658[_0x88f4('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x2d85fc['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x88f4('0xfe')](_0x443658[_0x88f4('0x1a7')],_0x88f4('0xfa'))[_0x88f4('0x7c')](_0x88f4('0xfb')),'ContactId':_0x2d85fc[_0x88f4('0xcb')],'ListId':_0x2d85fc['ListId'],'VoiceQueueId':_0x2d85fc[_0x88f4('0xcd')]||undefined,'CampaignId':_0x2d85fc[_0x88f4('0xce')]||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x1a8')));break;default:return!![];}};Dialer[_0x88f4('0x1c')][_0x88f4('0x199')]=function(_0x35de14,_0x39eafd,_0x4b7579){var _0x5146ab=this;var _0xa0d6ad=new History(_0x35de14);return new BPromise(function(_0x5a28a6,_0x55b607){if(_[_0x88f4('0x41')](_0x39eafd)&&typeof _0x39eafd!==_0x88f4('0x169')){return _0x55b607(msgResponse(_0x88f4('0x1a9'),_0x88f4('0x140'),_0x88f4('0x1aa')));}if(_['isUndefined'](_0x4b7579)&&typeof _0x4b7579!=='object'){return _0x55b607(msgResponse(_0x88f4('0x1a9'),_0x88f4('0x140'),_0x88f4('0x1ab')));}switch(_0x4b7579[_0x88f4('0x108')]){case'0':_0x39eafd[_0x88f4('0x6b')]+=0x1;_0xa0d6ad[_0x88f4('0xa6')]=0x0;_0xa0d6ad[_0x88f4('0xa7')]=_0x88f4('0x1ac');_0xa0d6ad[_0x88f4('0xef')]+=0x1;_0xa0d6ad[_0x88f4('0xea')]+=0x1;ami[_0x88f4('0xe1')](_0x88f4('0x1ad'),ut[_0x88f4('0xe3')](_0x35de14,_0x88f4('0x1ae')));_0x5146ab[_0x88f4('0xc5')](_0xa0d6ad)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0xeb')));if(_0x5146ab[_0x88f4('0x1af')](0x0,_0x35de14,_0x39eafd)){if(_0xa0d6ad[_0x88f4('0xef')]>=_0x39eafd[_0x88f4('0x1a3')]){_0x5146ab[_0x88f4('0xf7')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x88f4('0x1b0'));}else{_0x5146ab[_0x88f4('0xf4')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x88f4('0x1b0'));}}break;case'3':_0x39eafd[_0x88f4('0x1b1')]+=0x1;_0xa0d6ad[_0x88f4('0xa6')]=0x3;_0xa0d6ad['statedesc']=_0x88f4('0x1b2');_0xa0d6ad[_0x88f4('0xee')]+=0x1;_0xa0d6ad[_0x88f4('0xea')]+=0x1;ami[_0x88f4('0xe1')](_0x88f4('0x1b3'),ut[_0x88f4('0xe3')](_0x35de14,_0x88f4('0x1b4')));_0x5146ab[_0x88f4('0xc5')](_0xa0d6ad)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x1b5')));if(_0x5146ab[_0x88f4('0x1af')](0x3,_0x35de14,_0x39eafd)){if(_0xa0d6ad[_0x88f4('0xee')]>=_0x39eafd[_0x88f4('0x19b')]){_0x5146ab[_0x88f4('0xf7')](_0xa0d6ad,_0x5a28a6,_0x55b607,'reason\x203\x20ringing\x20no\x20answer');}else{_0x5146ab[_0x88f4('0xf4')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x88f4('0x1b6'));}}break;case'5':_0x39eafd[_0x88f4('0x66')]+=0x1;_0xa0d6ad[_0x88f4('0xa6')]=0x5;_0xa0d6ad[_0x88f4('0xa7')]='Busy';_0xa0d6ad['countbusyretry']+=0x1;_0xa0d6ad[_0x88f4('0xea')]+=0x1;ami[_0x88f4('0xe1')](_0x88f4('0x1b7'),ut[_0x88f4('0xe3')](_0x35de14,'busy'));_0x5146ab[_0x88f4('0xc5')](_0xa0d6ad)[_0x88f4('0xb0')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x5146ab[_0x88f4('0x1af')](0x5,_0x35de14,_0x39eafd)){if(_0xa0d6ad['countbusyretry']>=_0x39eafd[_0x88f4('0x19e')]){_0x5146ab[_0x88f4('0xf7')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x88f4('0x1b8'));}else{_0x5146ab[_0x88f4('0xf4')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x88f4('0x1b8'));}}break;case'8':_0x39eafd[_0x88f4('0x67')]+=0x1;_0xa0d6ad[_0x88f4('0xa6')]=0x8;_0xa0d6ad['statedesc']=_0x88f4('0x1b9');_0xa0d6ad[_0x88f4('0xed')]+=0x1;_0xa0d6ad[_0x88f4('0xea')]+=0x1;ami['emit'](_0x88f4('0x1ba'),ut[_0x88f4('0xe3')](_0x35de14,_0x88f4('0x1bb')));_0x5146ab['createHistory'](_0xa0d6ad)[_0x88f4('0xb0')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5146ab['checkRetriveMax'](0x8,_0x35de14,_0x39eafd)){if(_0xa0d6ad[_0x88f4('0xed')]>=_0x39eafd[_0x88f4('0x1a0')]){_0x5146ab[_0x88f4('0xf7')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x88f4('0x1bc'));}else{_0x5146ab[_0x88f4('0xf4')](_0xa0d6ad,_0x5a28a6,_0x55b607,'reason\x208\x20congestion');}}break;case'11':_0x39eafd['outboundAbandonedCallsDay']+=0x1;_0xa0d6ad['state']=0xb;_0xa0d6ad[_0x88f4('0xa7')]='Abandoned';_0xa0d6ad[_0x88f4('0xf1')]+=0x1;_0xa0d6ad['countglobal']+=0x1;_0x5146ab[_0x88f4('0xc5')](_0xa0d6ad)['catch'](loggerCatch(_0x88f4('0x121')));if(_0x5146ab[_0x88f4('0x1af')](0xb,_0x35de14,_0x39eafd)){if(_0xa0d6ad[_0x88f4('0xf1')]>=_0x39eafd[_0x88f4('0x11d')]){_0x5146ab[_0x88f4('0xf7')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x88f4('0x1bd'));}else{_0x5146ab[_0x88f4('0xf4')](_0xa0d6ad,_0x5a28a6,_0x55b607,'reason\x2011\x20abandoned');}}break;case'20':_0x39eafd[_0x88f4('0x6d')]+=0x1;_0xa0d6ad[_0x88f4('0xa6')]=0x14;_0xa0d6ad[_0x88f4('0xa7')]=_0x88f4('0x1be');_0xa0d6ad['countagentrejectretry']+=0x1;_0xa0d6ad[_0x88f4('0xea')]+=0x1;ami[_0x88f4('0xe1')](_0x88f4('0x1bf'),ut[_0x88f4('0xe3')](_0x35de14,_0x88f4('0x1c0')));_0x5146ab[_0x88f4('0xc5')](_0xa0d6ad)[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x1c1')));if(_0x5146ab['checkRetriveMax'](0x14,_0x35de14,_0x39eafd)){if(_0xa0d6ad[_0x88f4('0xf2')]>=_0x39eafd[_0x88f4('0x1a6')]){_0x5146ab['createStateFinal'](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x88f4('0x1c2'));}else{_0x5146ab[_0x88f4('0xf4')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x88f4('0x1c2'));}}break;default:_0x39eafd[_0x88f4('0x6e')]+=0x1;_0xa0d6ad[_0x88f4('0xa6')]=0xc;_0xa0d6ad[_0x88f4('0xa7')]=_0x4b7579['reason'];_0x5146ab[_0x88f4('0xc5')](_0xa0d6ad)[_0x88f4('0xb0')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x5146ab[_0x88f4('0x1af')](_0x4b7579[_0x88f4('0x108')],_0x35de14,_0x39eafd)){if(_0xa0d6ad[_0x88f4('0xec')]+_0xa0d6ad[_0x88f4('0xed')]+_0xa0d6ad[_0x88f4('0xee')]+_0xa0d6ad[_0x88f4('0xef')]+_0xa0d6ad[_0x88f4('0xf0')]+_0xa0d6ad['countabandonedretry']+_0xa0d6ad[_0x88f4('0xe9')]+_0xa0d6ad['countagentrejectretry']>=_0x39eafd[_0x88f4('0xf3')]){_0x5146ab[_0x88f4('0xf4')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x4b7579[_0x88f4('0x108')]);}else{_0x5146ab[_0x88f4('0xf7')](_0xa0d6ad,_0x5a28a6,_0x55b607,_0x4b7579[_0x88f4('0x108')]);}}}});};Dialer[_0x88f4('0x1c')][_0x88f4('0xf4')]=function(_0x800e18,_0x26220f,_0x42583a,_0x11af18){var _0x57d43b=new Final(_0x800e18);_0x57d43b[_0x88f4('0xa6')]=0xf;_0x57d43b[_0x88f4('0xa7')]=_0x88f4('0x1c3');this[_0x88f4('0xf7')](_0x57d43b,_0x26220f,_0x42583a,_0x11af18);};Dialer[_0x88f4('0x1c')][_0x88f4('0xf7')]=function(_0x2fb27c,_0x206241,_0x51e707,_0x53ecaf){this[_0x88f4('0xd6')](_0x2fb27c)[_0x88f4('0x40')](function(){return _0x206241(msgResponse(_0x88f4('0x1a9'),_0x88f4('0x1c4'),_0x53ecaf));})[_0x88f4('0xb0')](function(){return _0x51e707(msgResponse(_0x88f4('0x1c5'),_0x88f4('0x140'),_0x88f4('0x1c6')));});};Dialer[_0x88f4('0x1c')]['predictive']=function(_0x4ceee5){var _0x5ef2e6=_0x4ceee5[_0x88f4('0x1c7')]/0x64;var _0x1658b0=_0x4ceee5['outboundDropCallsDayTimeout']/(_0x4ceee5[_0x88f4('0x6a')]+_0x4ceee5[_0x88f4('0x64')]);var _0x2ce52c=Math[_0x88f4('0x1c8')](_0x4ceee5[_0x88f4('0x1c9')]*(_0x4ceee5['predictiveIntervalMaxThreshold']/0x64));var _0x23a1d9=Math[_0x88f4('0x1c8')](_0x4ceee5[_0x88f4('0x1c9')]*(_0x4ceee5[_0x88f4('0x1ca')]/0x64));var _0x161378=_0x4ceee5[_0x88f4('0x54')]+_0x4ceee5[_0x88f4('0x58')];var _0x46d34b=Math[_0x88f4('0x1cb')](_0x4ceee5[_0x88f4('0x8d')]*_0x4ceee5[_0x88f4('0x78')]*_0x4ceee5[_0x88f4('0x73')]*_0x4ceee5[_0x88f4('0x1cc')]);if(_['isUndefined'](_0x4ceee5[_0x88f4('0x2d')])){if(!_[_0x88f4('0x41')](_0x4ceee5[_0x88f4('0x2c')])){_0x4ceee5[_0x88f4('0x2c')]=undefined;loggerPredictive[_0x88f4('0x95')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x4ceee5[_0x88f4('0x92')])){loggerPredictive[_0x88f4('0x95')](_0x88f4('0x1cd'),_0x88f4('0x1ce'));clearInterval(_0x4ceee5[_0x88f4('0x92')]);_0x4ceee5['handlePredictive']=undefined;}_0x4ceee5['startProgressive']=moment()[_0x88f4('0x7c')](_0x88f4('0xfb'));loggerPredictive[_0x88f4('0x80')](_0x4ceee5[_0x88f4('0x45')],'collection\x20data\x20in\x20progressive\x20at',_0x4ceee5['startProgressive']);this['handlePower'](_0x4ceee5,0x1);}else if(ifInterval(_0x4ceee5[_0x88f4('0x1cf')],_0x4ceee5['startProgressive'])){this['handlePower'](_0x4ceee5,0x1);loggerPredictiveCalls[_0x88f4('0x80')](_0x88f4('0x1d0'),_0x4ceee5['startProgressive'],_0x4ceee5[_0x88f4('0x45')]);_0x4ceee5[_0x88f4('0x8d')]=0x0;_0x4ceee5[_0x88f4('0x112')]=0x0;}else if(_0x5ef2e6<_0x1658b0&&_0x4ceee5[_0x88f4('0x1d1')]==='dropRate'){freeVariablesPredictive(_0x4ceee5);loggerPredictive['info'](_0x88f4('0x1d2'),_0x88f4('0x1d3'),_0x1658b0,_0x88f4('0x2d'),_0x4ceee5[_0x88f4('0x45')]);}else if(_0x46d34b<_0x4ceee5['predictiveIntervalErlangCallsDroppedCalls']&&_0x4ceee5['dialPredictiveOptimization']===_0x88f4('0x1d4')){freeVariablesPredictive(_0x4ceee5);loggerPredictive['info'](_0x88f4('0x1d5'),_0x88f4('0x1d6'),_0x46d34b,'Drop\x20in\x20this\x20interval',_0x4ceee5[_0x88f4('0x112')],_0x88f4('0x2d'),_0x4ceee5[_0x88f4('0x45')]);}else if(!ifInterval(_0x4ceee5['dialPredictiveInterval'],_0x4ceee5[_0x88f4('0x2d')])&&_[_0x88f4('0x41')](_0x4ceee5[_0x88f4('0x2c')])&&!_[_0x88f4('0x41')](_0x4ceee5['startProgressive'])){_0x4ceee5['startPredictive']=moment()[_0x88f4('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x88f4('0x80')](_0x4ceee5[_0x88f4('0x45')],_0x88f4('0x1d7'),_0x4ceee5['startPredictive']);this[_0x88f4('0xba')](_0x4ceee5[_0x88f4('0x1cf')])[_0x88f4('0x40')](this[_0x88f4('0x1d8')](_0x4ceee5))[_0x88f4('0x40')](mergeDataErlangB(_0x4ceee5))[_0x88f4('0x40')](this[_0x88f4('0x1d9')](_0x4ceee5))[_0x88f4('0xb0')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x4ceee5));}else if(!ifInterval(_0x4ceee5[_0x88f4('0x1cf')],_0x4ceee5[_0x88f4('0x2c')])){_0x4ceee5[_0x88f4('0x112')]=0x0;_0x4ceee5[_0x88f4('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x88f4('0x80')](_0x4ceee5[_0x88f4('0x45')],_0x88f4('0x1da'),_0x4ceee5[_0x88f4('0x2c')]);clearInterval(_0x4ceee5[_0x88f4('0x92')]);_0x4ceee5['handlePredictive']=undefined;this['averageHandleTime'](_0x4ceee5[_0x88f4('0x1cf')])[_0x88f4('0x40')](this['getDataPredictive'](_0x4ceee5))[_0x88f4('0x40')](mergeDataErlangB(_0x4ceee5))['then'](this[_0x88f4('0x1d9')](_0x4ceee5))[_0x88f4('0xb0')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4ceee5));}else if(_0x4ceee5[_0x88f4('0x1c9')]&&_0x161378<_0x4ceee5[_0x88f4('0x1c9')]-_0x23a1d9){freeVariablesPredictive(_0x4ceee5);loggerPredictive[_0x88f4('0x80')](_0x4ceee5[_0x88f4('0x45')],_0x88f4('0x1db'),_0x161378,_0x88f4('0x1dc'),_0x4ceee5['predictiveIntervalAvailable'],'-',_0x23a1d9,'=',_0x4ceee5[_0x88f4('0x1c9')]-_0x23a1d9,')');}else if(_0x4ceee5[_0x88f4('0x1c9')]&&_0x161378>_0x4ceee5[_0x88f4('0x1c9')]+_0x2ce52c){freeVariablesPredictive(_0x4ceee5);loggerPredictive['info'](_0x4ceee5['name'],_0x88f4('0x1db'),_0x161378,_0x88f4('0x1dd'),_0x4ceee5[_0x88f4('0x1c9')],'+',_0x2ce52c,'=',_0x4ceee5[_0x88f4('0x1c9')]+_0x2ce52c,')');}};Dialer[_0x88f4('0x1c')][_0x88f4('0x1d8')]=function(_0x5dba45){var _0x107a10=this;return function(_0x60c2b3){return new BPromise(function(_0x45f373,_0x3fa4ba){_[_0x88f4('0x90')](_0x5dba45,_0x60c2b3[0x0]);if(checkGetDataPredictive(_0x60c2b3[0x0])){var _0x5e796b=_0x5dba45[_0x88f4('0x1c9')]=_0x5dba45['talking']+_0x5dba45[_0x88f4('0x54')];var _0x4b6c18=_0x5dba45['dialPredictiveInterval']*0x3c;var _0x563478=_0x60c2b3[0x0][_0x88f4('0x86')]+_0x60c2b3[0x0][_0x88f4('0x6f')];var _0x507c7d=(_0x60c2b3[0x0][_0x88f4('0x1de')]+_0x60c2b3[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x60c2b3[0x0][_0x88f4('0x70')])/_0x60c2b3[0x0][_0x88f4('0x75')];_0x5dba45[_0x88f4('0x73')]=_0x507c7d>0x0?_0x507c7d:0x1;switch(_0x5dba45['dialPredictiveOptimization']){case _0x88f4('0x1d4'):var _0x1e2775=_0x5dba45[_0x88f4('0x1c7')]/0x64;return _0x107a10['abandonmentRate'](_0x5e796b,_0x4b6c18,_0x563478,_0x507c7d,_0x1e2775)[_0x88f4('0x40')](function(_0x525f45){return _0x45f373(_0x525f45);});case _0x88f4('0x1df'):var _0x51d5ae=_0x5dba45['dialPredictiveOptimizationPercentage']/0x64;return _0x107a10[_0x88f4('0x1e0')](_0x5e796b,_0x4b6c18,_0x563478,_0x507c7d,_0x51d5ae)[_0x88f4('0x40')](function(_0x53b4af){return _0x45f373(_0x53b4af);});default:return _0x3fa4ba(msgResponse(_0x88f4('0x1e1'),_0x88f4('0x140'),_0x88f4('0x1e2')));}}else{return _0x3fa4ba(msgResponse(_0x88f4('0x1e1'),'Failure',_0x88f4('0x1e3')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x4da159){var _0x496633=this;return function(_0x42d651){return new BPromise(function(_0x5f5704,_0x4f0ff3){_[_0x88f4('0x90')](_0x4da159,_0x42d651[0x0]);if(checkGetDataPredictive(_0x42d651[0x0])){loggerPredictive[_0x88f4('0x80')](JSON[_0x88f4('0x4e')](_0x42d651[0x0]));if(_0x4da159['dialPredictiveOptimization']==='dropRate'){return _0x496633[_0x88f4('0xc3')](_0x4da159['id'])['then'](function(_0x4734f5){var _0x5e8778=_0x4da159[_0x88f4('0x55')]-_0x4734f5[0x0]['outboundQueuePauses'];var _0x53a9fd=_0x4da159['dialPredictiveInterval']*0x3c;var _0x142946=_0x42d651[0x0][_0x88f4('0x86')]+_0x42d651[0x0]['predictiveIntervalAvgHoldtime'];var _0x46bead=(_0x42d651[0x0][_0x88f4('0x1de')]+_0x42d651[0x0][_0x88f4('0x71')]+_0x42d651[0x0][_0x88f4('0x70')])/_0x42d651[0x0][_0x88f4('0x75')];var _0x21f08b=_0x4da159['dialPredictiveOptimizationPercentage']/0x64;_0x4da159[_0x88f4('0x74')]=_0x4734f5[0x0][_0x88f4('0x1e4')]||0x0;_0x4da159['predictiveIntervalHitRate']=_0x46bead>0x0?_0x46bead:0x1;return _0x496633[_0x88f4('0x1e5')](_0x5e8778,_0x53a9fd,_0x142946,_0x46bead,_0x21f08b);})[_0x88f4('0x40')](function(_0x1de360){return _0x5f5704(_0x1de360);})[_0x88f4('0xb0')](function(_0x1a44c4){return _0x4f0ff3(msgResponse(_0x88f4('0x1e6'),'Failure',JSON[_0x88f4('0x4e')](_0x1a44c4)));});}if(_0x4da159[_0x88f4('0x1d1')]===_0x88f4('0x1df')){return _0x496633['getVoiceQueueRtPauses'](_0x4da159['id'])[_0x88f4('0x40')](function(_0x516a36){var _0x39497d=_0x4da159['loggedIn']-_0x516a36[0x0]['outboundQueuePauses'];var _0x39034e=_0x4da159[_0x88f4('0x1cf')]*0x3c;var _0x48c375=_0x42d651[0x0][_0x88f4('0x86')]+_0x42d651[0x0][_0x88f4('0x6f')];var _0x32d962=(_0x42d651[0x0][_0x88f4('0x1de')]+_0x42d651[0x0][_0x88f4('0x71')]+_0x42d651[0x0][_0x88f4('0x70')])/_0x42d651[0x0][_0x88f4('0x75')];var _0x174874=_0x4da159[_0x88f4('0x1c7')]/0x64;_0x4da159[_0x88f4('0x74')]=_0x516a36[0x0]['outboundQueuePauses']||0x0;_0x4da159['predictiveIntervalHitRate']=_0x32d962>0x0?_0x32d962:0x1;return _0x496633[_0x88f4('0x1e0')](_0x39497d,_0x39034e,_0x48c375,_0x32d962,_0x174874);})['then'](function(_0x4f4ab7){return _0x5f5704(_0x4f4ab7);})['catch'](function(_0x54b549){return _0x4f0ff3(msgResponse(_0x88f4('0x1e6'),'Failure',JSON[_0x88f4('0x4e')](_0x54b549)));});}}else{return _0x4f0ff3(msgResponse(_0x88f4('0x1e1'),'Failure','check\x20failure'));}});};};Dialer[_0x88f4('0x1c')][_0x88f4('0x1d9')]=function(_0x3cda7e){var _0x44faec=this;return function(){var _0x28e264=0x0;var _0x148362=Math[_0x88f4('0x1cb')](_0x3cda7e[_0x88f4('0x77')]*0x3e8);if(_0x148362>0x0){_0x148362=_0x148362<0x64?0x64:_0x148362;loggerPredictive['info'](_0x3cda7e[_0x88f4('0x45')],'one\x20call\x20every:',_0x148362,_0x88f4('0x1e7'));_0x3cda7e[_0x88f4('0x92')]=setInterval(function(){_0x44faec[_0x88f4('0x92')](_0x3cda7e);loggerPredictiveCalls[_0x88f4('0x80')](_0x88f4('0x1e8'),_0x28e264+=0x1);},_0x148362);}else{loggerPredictive[_0x88f4('0x80')](_0x3cda7e[_0x88f4('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x88f4('0x1e9')]=function(_0x2a64b8,_0x7be3d2){var _0x365673=this;return function(_0x544d41){if(_[_0x88f4('0x4b')](_0x544d41)){if(_[_0x88f4('0xd8')](_0x7be3d2[_0x88f4('0xcc')])||!_0x7be3d2[_0x88f4('0x1ea')]){if(_0x2a64b8[_0x88f4('0x5f')]===_0x88f4('0xa')){_0x2a64b8[_0x88f4('0x12c')]=_[_0x88f4('0x41')](_0x2a64b8[_0x88f4('0x12c')])?!![]:_0x2a64b8['queueStatusComplete'];var _0x32d341=uuid['v4']();_0x365673[_0x88f4('0x28')][_0x32d341]=new Action(_0x2a64b8,_0x7be3d2,_0x32d341);loggerBooked['info'](_0x88f4('0x1eb'),_0x32d341,_0x88f4('0x1ec'),JSON[_0x88f4('0x4e')](_0x2a64b8[_0x88f4('0x12c')]),_0x88f4('0x1ed'),_0x2a64b8[_0x88f4('0x45')]);if(_0x2a64b8[_0x88f4('0x12c')]){_0x2a64b8[_0x88f4('0x12c')]=![];_0x365673[_0x88f4('0x2e')][_0x365673[_0x88f4('0x28')][_0x32d341][_0x88f4('0xb3')]]=[];ami[_0x88f4('0xad')]({'actionid':_0x32d341,'action':_0x88f4('0x1ee'),'queue':_0x2a64b8[_0x88f4('0x45')]})[_0x88f4('0xb0')](function(){_0x365673[_0x88f4('0xb2')](_0x2a64b8);_0x365673[_0x88f4('0xbd')]({'active':![],'ContactId':_0x365673[_0x88f4('0x28')][_0x32d341][_0x88f4('0xcb')],'ListId':_0x365673[_0x88f4('0x28')][_0x32d341]['ListId'],'VoiceQueueId':_0x365673[_0x88f4('0x28')][_0x32d341][_0x88f4('0xcd')]||undefined,'CampaignId':_0x365673[_0x88f4('0x28')][_0x32d341][_0x88f4('0xce')]||undefined})['catch'](loggerCatch(_0x88f4('0x1ef')));delete _0x365673['actions'][_0x32d341];});}else{loggerBooked[_0x88f4('0x80')](_0x88f4('0x1f0'),JSON[_0x88f4('0x4e')](_0x2a64b8[_0x88f4('0x12c')]),_0x88f4('0x1ed'),_0x2a64b8[_0x88f4('0x45')]);_0x365673[_0x88f4('0xb2')](_0x2a64b8);_0x365673[_0x88f4('0xbd')]({'active':![],'ContactId':_0x365673['actions'][_0x32d341][_0x88f4('0xcb')],'ListId':_0x365673[_0x88f4('0x28')][_0x32d341][_0x88f4('0xff')],'VoiceQueueId':_0x365673[_0x88f4('0x28')][_0x32d341]['VoiceQueueId']||undefined,'CampaignId':_0x365673[_0x88f4('0x28')][_0x32d341][_0x88f4('0xce')]||undefined})[_0x88f4('0xb0')](loggerCatch(_0x88f4('0x1ef')));delete _0x365673[_0x88f4('0x28')][_0x32d341];}}else{return _0x365673[_0x88f4('0x168')](_0x2a64b8,_0x7be3d2);}}else{if(getDiff(_0x7be3d2[_0x88f4('0x1f1')])<_0x2a64b8['dialRecallMeTimeout']*0x3c){if(_0x7be3d2[_0x88f4('0x1f2')]&&!_0x7be3d2[_0x88f4('0x1f2')][_0x88f4('0x1f3')]){_0x365673[_0x88f4('0x21')][_0x88f4('0x12e')](_0x7be3d2['id'])[_0x88f4('0x1f')](function(){_0x365673[_0x88f4('0xb2')](_0x2a64b8);});}else{_0x365673[_0x88f4('0xbe')]({'active':![]},_0x7be3d2['id'],0x1)[_0x88f4('0x1f')](function(){_0x365673[_0x88f4('0xb2')](_0x2a64b8);});}}else{_0x2a64b8['outboundReCallsDay']+=0x1;_0x365673['updateOriginated'](_0x2a64b8);if(_0x2a64b8['dialRecallInQueue']){_0x365673['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x7be3d2[_0x88f4('0xcb')],'ListId':_0x7be3d2[_0x88f4('0xff')],'VoiceQueueId':_0x7be3d2[_0x88f4('0xcd')]||undefined,'CampaignId':_0x7be3d2[_0x88f4('0xce')]||undefined})[_0x88f4('0xb0')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x365673[_0x88f4('0xc5')](createObjHistory(_0x2a64b8,_0x7be3d2,_0x88f4('0x1f4'),0x17,_0x88f4('0x1f5')))['catch'](loggerCatch(_0x88f4('0x1f6')));}else{_0x365673[_0x88f4('0xca')](createObjHistory(_0x2a64b8,_0x7be3d2,'RECALLFAILEDTIMEOUT',0x16,_0x88f4('0x1f7')),_0x88f4('0x1f8'),_0x88f4('0x1f9'));}}}}else{_0x2a64b8[_0x88f4('0x65')]+=0x1;_0x365673[_0x88f4('0xca')](createObjHistory(_0x2a64b8,_0x7be3d2,_0x88f4('0x1fa'),0xd,_0x88f4('0x1fb')),_0x88f4('0x1fc'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x88f4('0x1c')][_0x88f4('0x15e')]=function(_0x5ea315){var _0x24cec=this;var _0x360e1e=_0x5ea315[_0x88f4('0x1fd')]-_0x5ea315['originated']-_0x5ea315['temp'];emitCampaignSummary(_0x5ea315);if(_0x360e1e>0x0){if(_0x360e1e>this[_0x88f4('0x26')]){_0x360e1e=this[_0x88f4('0x26')];}_0x5ea315[_0x88f4('0xc0')]+=_0x360e1e;this[_0x88f4('0xc1')](_0x5ea315['id'],_0x360e1e,_0x5ea315['dialOrderByScheduledAt'],_0x5ea315)[_0x88f4('0x40')](function(_0x3b3ad5){_0x5ea315[_0x88f4('0xc0')]-=_0x360e1e;_0x5ea315[_0x88f4('0xc0')]=_0x5ea315[_0x88f4('0xc0')]>0x0?_0x5ea315['temp']:0x0;if(!checkContactEmpty(_0x3b3ad5)){_0x5ea315[_0x88f4('0x43')]=_0x88f4('0x1fe');logger[_0x88f4('0x80')](_0x88f4('0x1ff')+_0x5ea315[_0x88f4('0x45')]);}else{_0x5ea315['originated']+=_0x3b3ad5['length'];_0x5ea315['message']=_0x88f4('0x200');for(var _0x137493=0x0;_0x137493<_0x3b3ad5[_0x88f4('0x98')];_0x137493+=0x1){_0x5ea315[_0x88f4('0x201')]+=0x1;if(_[_0x88f4('0xd8')](_0x3b3ad5[_0x137493])||_[_0x88f4('0xd8')](_0x3b3ad5[_0x137493]['Contact'])||_['isNil'](_0x3b3ad5[_0x137493][_0x88f4('0x16b')][_0x88f4('0x16a')])){_0x24cec[_0x88f4('0xc9')]('[actionOriginate]\x20',_0x5ea315,_0x3b3ad5[_0x137493]);}else{_0x24cec[_0x88f4('0xb8')](_[_0x88f4('0x129')](_0x3b3ad5[_0x137493],[_0x88f4('0xce'),_0x88f4('0x202')]))[_0x88f4('0x40')](_0x24cec[_0x88f4('0x1e9')](_0x5ea315,_0x3b3ad5[_0x137493]))[_0x88f4('0xb0')](_0x24cec[_0x88f4('0x203')](_0x88f4('0x204'),_0x5ea315));}}}})[_0x88f4('0xb0')](loggerGetContactDialer(_0x88f4('0x205'),_0x5ea315,_0x360e1e));}};Dialer['prototype'][_0x88f4('0x154')]=function(_0x7a2fc,_0xadf8ec){var _0x3da481=this;var _0x5a568d=[];var _0xb0e5d3=_0xadf8ec>=0x1?_0xadf8ec:0x1;if(_0x7a2fc[_0x88f4('0x5f')]===_0x88f4('0xa')){_0xb0e5d3=0x1;}var _0x407d16=Math[_0x88f4('0x1cb')](_0x7a2fc[_0x88f4('0x54')]*_0xb0e5d3)-_0x7a2fc[_0x88f4('0x76')]-_0x7a2fc[_0x88f4('0xc0')];emitVoiceQueueSummary(_0x7a2fc);if(_0x7a2fc[_0x88f4('0x206')]>0x0){var _0x5bbe44=_0x7a2fc['dialLimitQueue']-_0x7a2fc[_0x88f4('0x76')]-_0x7a2fc[_0x88f4('0x58')]-_0x7a2fc['temp']-_0x7a2fc['pTalking'];if(_0x407d16>_0x5bbe44){_0x407d16=_0x5bbe44;}}if(_0x407d16>0x0){if(_0x7a2fc[_0x88f4('0x5f')]===_0x88f4('0xa')){_0x407d16=0x1;}if(_0x407d16>this['maxNumberOriginate']){_0x407d16=this[_0x88f4('0x26')];}_0x7a2fc[_0x88f4('0xc0')]+=_0x407d16;for(var _0x4fc4f5 in this[_0x88f4('0x24')]){if(typeof this['agents'][_0x4fc4f5]!==_0x88f4('0x99')){if(this[_0x88f4('0x24')][_0x4fc4f5][_0x88f4('0xa6')]===_0x88f4('0x207')&&this[_0x88f4('0x24')][_0x4fc4f5][_0x88f4('0xae')]===_0x88f4('0xd4')){_0x5a568d[_0x88f4('0x128')](this[_0x88f4('0x24')][_0x4fc4f5]['id']);}}}this[_0x88f4('0xbf')](_0x7a2fc['id'],_0x5a568d,_0x407d16,_0x7a2fc[_0x88f4('0x208')],_0x7a2fc)['then'](function(_0x5ca2a5){_0x7a2fc[_0x88f4('0xc0')]-=_0x407d16;_0x7a2fc[_0x88f4('0xc0')]=_0x7a2fc[_0x88f4('0xc0')]>0x0?_0x7a2fc[_0x88f4('0xc0')]:0x0;if(!checkContactEmpty(_0x5ca2a5)){_0x3da481[_0x88f4('0xb6')](_0x7a2fc)[_0x88f4('0x40')](sendMessageReschedule(_0x7a2fc))[_0x88f4('0xb0')](loggerCatch('[countReScheduled]\x20'));}else{_0x7a2fc[_0x88f4('0x76')]+=_0x5ca2a5[_0x88f4('0x98')];_0x7a2fc[_0x88f4('0x43')]=_0x7a2fc[_0x88f4('0x5f')]==='booked'?_0x88f4('0x174'):_0x88f4('0x200');for(var _0x18a35c=0x0;_0x18a35c<_0x5ca2a5[_0x88f4('0x98')];_0x18a35c+=0x1){if(_[_0x88f4('0xd8')](_0x5ca2a5[_0x18a35c])||_['isNil'](_0x5ca2a5[_0x18a35c][_0x88f4('0x16b')])||_[_0x88f4('0xd8')](_0x5ca2a5[_0x18a35c]['Contact'][_0x88f4('0x16a')])){_0x3da481[_0x88f4('0xc9')](_0x88f4('0x209'),_0x7a2fc,_0x5ca2a5[_0x18a35c]);}else{_0x3da481[_0x88f4('0x20a')](_['pick'](_0x5ca2a5[_0x18a35c],[_0x88f4('0xcd'),_0x88f4('0x202')]))[_0x88f4('0x40')](_0x3da481[_0x88f4('0x1e9')](_0x7a2fc,_0x5ca2a5[_0x18a35c]))[_0x88f4('0xb0')](_0x3da481[_0x88f4('0x203')](_0x88f4('0x209'),_0x7a2fc));}}}})['catch'](loggerGetContactDialer(_0x88f4('0x20b'),_0x7a2fc,_0x407d16));}};Dialer[_0x88f4('0x1c')][_0x88f4('0x92')]=function(_0x22fc4){if(_0x22fc4[_0x88f4('0x206')]>0x0){var _0x4c8e25=_0x22fc4[_0x88f4('0x206')]-_0x22fc4[_0x88f4('0x76')]-_0x22fc4[_0x88f4('0x58')];if(_0x4c8e25>0x0){this[_0x88f4('0x20c')](_0x22fc4);}else{loggerPredictiveCalls[_0x88f4('0x80')](_0x88f4('0x20d'));}}else{this[_0x88f4('0x20c')](_0x22fc4);}};Dialer[_0x88f4('0x1c')][_0x88f4('0x20c')]=function(_0x5cde20){var _0x4d6f90=this;var _0x586837=[];_0x5cde20['originated']+=0x1;for(var _0x4c9e76 in this[_0x88f4('0x24')]){if(typeof this[_0x88f4('0x24')][_0x4c9e76]!==_0x88f4('0x99')){if(this[_0x88f4('0x24')][_0x4c9e76][_0x88f4('0xa6')]===_0x88f4('0x207')&&this[_0x88f4('0x24')][_0x4c9e76][_0x88f4('0xae')]===_0x88f4('0xd4')){_0x586837[_0x88f4('0x128')](this[_0x88f4('0x24')][_0x4c9e76]['id']);}}}this[_0x88f4('0xbf')](_0x5cde20['id'],_0x586837,0x1,_0x5cde20['dialOrderByScheduledAt'],_0x5cde20)['then'](function(_0x33e346){if(!checkContactEmpty(_0x33e346)){checkContactLowerLimitOriginate(_0x5cde20,0x1,0x0);_0x4d6f90[_0x88f4('0xb6')](_0x5cde20)[_0x88f4('0x40')](sendMessageReschedule(_0x5cde20))[_0x88f4('0xb0')](loggerCatch(_0x88f4('0xb7')));}else{_0x5cde20[_0x88f4('0x43')]=_0x88f4('0x200');if(_[_0x88f4('0xd8')](_0x33e346[0x0])||_[_0x88f4('0xd8')](_0x33e346[0x0][_0x88f4('0x16b')])||_[_0x88f4('0xd8')](_0x33e346[0x0][_0x88f4('0x16b')]['phone'])){_0x4d6f90[_0x88f4('0xc9')](_0x88f4('0x209'),_0x5cde20,_0x33e346[0x0]);}else{_0x4d6f90[_0x88f4('0x20a')](_['pick'](_0x33e346[0x0],['VoiceQueueId',_0x88f4('0x202')]))[_0x88f4('0x40')](_0x4d6f90[_0x88f4('0x1e9')](_0x5cde20,_0x33e346[0x0]))[_0x88f4('0xb0')](_0x4d6f90[_0x88f4('0x203')](_0x88f4('0x20e'),_0x5cde20));}}})[_0x88f4('0xb0')](loggerGetContactDialer('[getContactDialerPredictive]',_0x5cde20,0x1));emitVoiceQueueSummary(_0x5cde20);};Dialer['prototype'][_0x88f4('0x1e5')]=function(_0x3b6b84,_0x10948b,_0x36af81,_0x499bf5,_0x2a2b77,_0x236ed9){loggerPredictive['info'](_0x88f4('0x20f'));loggerPredictive[_0x88f4('0x80')](_0x88f4('0x210'),_0x3b6b84);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x211'),_0x10948b);loggerPredictive['info'](_0x88f4('0x212'),_0x36af81);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x213'),_0x499bf5);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x214'),_0x2a2b77);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x2d9ff9,_0x477162){if(_0x3b6b84<=0x0||isNaN(_0x3b6b84)){return _0x477162(msgResponse(_0x88f4('0x215'),_0x88f4('0x4d'),_0x88f4('0x216')+_0x3b6b84));}if(_0x36af81<=0x0||isNaN(_0x36af81)){return _0x477162(msgResponse(_0x88f4('0x215'),_0x88f4('0x4d'),_0x88f4('0x217')+_0x36af81));}if(_0x499bf5<=0x0||isNaN(_0x499bf5)){return _0x477162(msgResponse(_0x88f4('0x215'),_0x88f4('0x4d'),'p\x20=\x20'+_0x499bf5));}if(_0x10948b<=0x0||isNaN(_0x10948b)){return _0x477162(msgResponse(_0x88f4('0x215'),_0x88f4('0x4d'),'interval\x20=\x20'+_0x10948b));}if(_0x2a2b77<=0x0||isNaN(_0x2a2b77)){return _0x477162(msgResponse(_0x88f4('0x215'),_0x88f4('0x4d'),_0x88f4('0x218')+_0x2a2b77));}_0x236ed9=_0x236ed9||0x0;var _0x453a05=0x1/_0x36af81;var _0x1a97a3=0x0;var _0x3adb8a=0x0;var _0x5b3bff=0x0;var _0x3926cc=0x0;for(var _0x529dc4=0x0;_0x5b3bff<_0x2a2b77;_0x529dc4+=0x1){_0x3adb8a=_0x529dc4/_0x10948b;_0x1a97a3=(_0x499bf5*_0x3adb8a+_0x236ed9)/_0x453a05;_0x5b3bff=erlangb(_0x1a97a3,_0x3b6b84);_0x3926cc=_0x1a97a3/_0x3b6b84*(0x1-erlangb(_0x1a97a3,_0x3b6b84));}return _0x2d9ff9({'erlangCalls':_0x529dc4,'erlangCallToSecond':_0x10948b/_0x529dc4,'erlangAbandonmentRate':_0x5b3bff,'erlangBusyFactor':_0x3926cc});});};Dialer[_0x88f4('0x1c')][_0x88f4('0x1e0')]=function(_0x1c470f,_0x364830,_0x12d443,_0x159849,_0x494149,_0x4fd612){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x88f4('0x80')](_0x88f4('0x210'),_0x1c470f);loggerPredictive[_0x88f4('0x80')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x364830);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x212'),_0x12d443);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x213'),_0x159849);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x219'),_0x494149);loggerPredictive[_0x88f4('0x80')](_0x88f4('0x87'));return new BPromise(function(_0x471497,_0x3f0c81){if(_0x1c470f<=0x0||isNaN(_0x1c470f)){return _0x3f0c81(msgResponse(_0x88f4('0x21a'),_0x88f4('0x4d'),_0x88f4('0x216')+_0x1c470f));}if(_0x12d443<=0x0||isNaN(_0x12d443)){return _0x3f0c81(msgResponse(_0x88f4('0x21a'),_0x88f4('0x4d'),'Ts\x20=\x20'+_0x12d443));}if(_0x159849<=0x0||isNaN(_0x159849)){return _0x3f0c81(msgResponse(_0x88f4('0x21a'),_0x88f4('0x4d'),'p\x20=\x20'+_0x159849));}if(_0x364830<=0x0||isNaN(_0x364830)){return _0x3f0c81(msgResponse(_0x88f4('0x21a'),_0x88f4('0x4d'),'interval\x20=\x20'+_0x364830));}if(_0x494149<=0x0||isNaN(_0x494149)){return _0x3f0c81(msgResponse(_0x88f4('0x21a'),_0x88f4('0x4d'),'Umin\x20=\x20'+_0x494149));}_0x4fd612=_0x4fd612||0x0;var _0x2068b6=0x1/_0x12d443;var _0x58ad81=0x0;var _0x43d1b5=0x0;var _0x31adfa=0x0;var _0x2ca36a=0x0;for(var _0x4cdb60=0x0;_0x2ca36a<_0x494149;_0x4cdb60+=0x1){_0x43d1b5=_0x4cdb60/_0x364830;_0x58ad81=(_0x159849*_0x43d1b5+_0x4fd612)/_0x2068b6;_0x31adfa=erlangb(_0x58ad81,_0x1c470f);_0x2ca36a=_0x58ad81/_0x1c470f*(0x1-erlangb(_0x58ad81,_0x1c470f));}return _0x471497({'erlangCalls':_0x4cdb60,'erlangCallToSecond':_0x364830/_0x4cdb60,'erlangAbandonmentRate':_0x31adfa,'erlangBusyFactor':_0x2ca36a});});};module[_0x88f4('0x21b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 0ae197d..09a3557 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 _0x4d43=['reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','droptime','ringtime','holdtime','talktime','connectedlinename'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x4d43,0xce));var _0x34d4=function(_0xea1be7,_0x92c0ca){_0xea1be7=_0xea1be7-0x0;var _0x29a757=_0x4d43[_0xea1be7];return _0x29a757;};'use strict';var util=require(_0x34d4('0x0'));var _=require(_0x34d4('0x1'));var moment=require(_0x34d4('0x2'));function getSeconds(_0x17a102,_0x53cfc3){var _0x257248=moment(_0x17a102)[_0x34d4('0x3')](0x0);var _0x505a15=moment(_0x53cfc3)['milliseconds'](0x0);return _0x257248[_0x34d4('0x4')](_0x505a15,'seconds');}function QueueCallerAbandon(_0x59bb4f,_0x537156){this[_0x34d4('0x5')]=_0x59bb4f['scheduledat'];this[_0x34d4('0x6')]=_0x59bb4f['type'];this['campaigntype']=_0x59bb4f['type']===_0x34d4('0x7')?_0x34d4('0x8'):_0x59bb4f[_0x34d4('0x6')];this[_0x34d4('0x9')]=_0x59bb4f[_0x34d4('0x9')];this['countcongestionretry']=_0x59bb4f[_0x34d4('0xa')];this['countnoanswerretry']=_0x59bb4f[_0x34d4('0xb')];this[_0x34d4('0xc')]=_0x59bb4f[_0x34d4('0x9')]+_0x59bb4f[_0x34d4('0xa')]+_0x59bb4f['countnoanswerretry']+_0x59bb4f[_0x34d4('0xd')]+_0x59bb4f[_0x34d4('0xe')]+_0x59bb4f[_0x34d4('0xf')]+_0x59bb4f[_0x34d4('0x10')]+_0x59bb4f[_0x34d4('0x11')];this['countnosuchnumberretry']=_0x59bb4f[_0x34d4('0xd')];this['countdropretry']=_0x59bb4f[_0x34d4('0xe')];this['countabandonedretry']=_0x59bb4f[_0x34d4('0xf')];this[_0x34d4('0x10')]=_0x59bb4f[_0x34d4('0x10')];this['countagentrejectretry']=_0x59bb4f['countagentrejectretry'];this[_0x34d4('0x12')]=_0x537156[_0x34d4('0x12')];this[_0x34d4('0x13')]=_0x59bb4f[_0x34d4('0x14')];this['calleridnum']=_0x59bb4f[_0x34d4('0x15')];this['starttime']=_0x59bb4f['starttime'];this[_0x34d4('0x16')]=_0x59bb4f['responsetime'];this[_0x34d4('0x17')]=_0x59bb4f[_0x34d4('0x17')];this['endtime']=this['droptime'];this[_0x34d4('0x18')]=getSeconds(_0x59bb4f[_0x34d4('0x16')],_0x59bb4f['starttime']);this[_0x34d4('0x19')]=getSeconds(this[_0x34d4('0x17')],_0x59bb4f[_0x34d4('0x16')]);this[_0x34d4('0x1a')]=0x0;this['queue']=_0x537156[_0x34d4('0x8')];this['membername']=_0x537156[_0x34d4('0x1b')];this[_0x34d4('0x1c')]=_0x537156['reason'];this['callback']=_0x59bb4f['callback'];this[_0x34d4('0x1d')]=_0x59bb4f[_0x34d4('0x1d')];this['callbackat']=_0x59bb4f[_0x34d4('0x1e')];this['recallme']=_0x59bb4f[_0x34d4('0x1f')];this[_0x34d4('0x20')]=_0x59bb4f[_0x34d4('0x20')];this[_0x34d4('0x21')]=_0x59bb4f['ListId'];this[_0x34d4('0x22')]=_0x59bb4f[_0x34d4('0x22')];this[_0x34d4('0x23')]=_0x59bb4f['VoiceQueueId'];this[_0x34d4('0x24')]=_0x59bb4f[_0x34d4('0x24')];this['originatecalleridnum']=_0x59bb4f[_0x34d4('0x25')]||'';this[_0x34d4('0x26')]=_0x59bb4f['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x9ab7=['countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','calleridnum','number','responsetime','droptime','endtime','starttime','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4a3297,_0x6b4c01){var _0x44d38e=function(_0x309581){while(--_0x309581){_0x4a3297['push'](_0x4a3297['shift']());}};_0x44d38e(++_0x6b4c01);}(_0x9ab7,0x120));var _0x79ab=function(_0x346f93,_0x2dd9ce){_0x346f93=_0x346f93-0x0;var _0x3b69fa=_0x9ab7[_0x346f93];return _0x3b69fa;};'use strict';var util=require(_0x79ab('0x0'));var _=require(_0x79ab('0x1'));var moment=require(_0x79ab('0x2'));function getSeconds(_0xdb9105,_0x102bb3){var _0x1ca724=moment(_0xdb9105)['milliseconds'](0x0);var _0x448c6c=moment(_0x102bb3)[_0x79ab('0x3')](0x0);return _0x1ca724[_0x79ab('0x4')](_0x448c6c,_0x79ab('0x5'));}function QueueCallerAbandon(_0x5aa0cb,_0x54e13d){this['scheduledat']=_0x5aa0cb[_0x79ab('0x6')];this[_0x79ab('0x7')]=_0x5aa0cb[_0x79ab('0x7')];this[_0x79ab('0x8')]=_0x5aa0cb['type']===_0x79ab('0x9')?'queue':_0x5aa0cb[_0x79ab('0x7')];this['countbusyretry']=_0x5aa0cb[_0x79ab('0xa')];this['countcongestionretry']=_0x5aa0cb[_0x79ab('0xb')];this[_0x79ab('0xc')]=_0x5aa0cb[_0x79ab('0xc')];this[_0x79ab('0xd')]=_0x5aa0cb[_0x79ab('0xa')]+_0x5aa0cb[_0x79ab('0xb')]+_0x5aa0cb[_0x79ab('0xc')]+_0x5aa0cb['countnosuchnumberretry']+_0x5aa0cb[_0x79ab('0xe')]+_0x5aa0cb[_0x79ab('0xf')]+_0x5aa0cb['countmachineretry']+_0x5aa0cb[_0x79ab('0x10')];this[_0x79ab('0x11')]=_0x5aa0cb[_0x79ab('0x11')];this[_0x79ab('0xe')]=_0x5aa0cb[_0x79ab('0xe')];this[_0x79ab('0xf')]=_0x5aa0cb[_0x79ab('0xf')];this['countmachineretry']=_0x5aa0cb[_0x79ab('0x12')];this[_0x79ab('0x10')]=_0x5aa0cb['countagentrejectretry'];this[_0x79ab('0x13')]=_0x54e13d[_0x79ab('0x13')];this[_0x79ab('0x14')]=_0x5aa0cb['name'];this[_0x79ab('0x15')]=_0x5aa0cb[_0x79ab('0x16')];this['starttime']=_0x5aa0cb['starttime'];this['responsetime']=_0x5aa0cb[_0x79ab('0x17')];this['droptime']=_0x5aa0cb[_0x79ab('0x18')];this[_0x79ab('0x19')]=this[_0x79ab('0x18')];this['ringtime']=getSeconds(_0x5aa0cb[_0x79ab('0x17')],_0x5aa0cb[_0x79ab('0x1a')]);this[_0x79ab('0x1b')]=getSeconds(this[_0x79ab('0x18')],_0x5aa0cb[_0x79ab('0x17')]);this[_0x79ab('0x1c')]=0x0;this['queue']=_0x54e13d[_0x79ab('0x1d')];this['membername']=_0x54e13d[_0x79ab('0x1e')];this['reason']=_0x54e13d[_0x79ab('0x1f')];this[_0x79ab('0x20')]=_0x5aa0cb[_0x79ab('0x20')];this[_0x79ab('0x21')]=_0x5aa0cb[_0x79ab('0x21')];this[_0x79ab('0x22')]=_0x5aa0cb[_0x79ab('0x22')];this[_0x79ab('0x23')]=_0x5aa0cb['recallme'];this[_0x79ab('0x24')]=_0x5aa0cb['ContactId'];this[_0x79ab('0x25')]=_0x5aa0cb[_0x79ab('0x25')];this[_0x79ab('0x26')]=_0x5aa0cb[_0x79ab('0x26')];this[_0x79ab('0x27')]=_0x5aa0cb[_0x79ab('0x27')];this[_0x79ab('0x28')]=_0x5aa0cb[_0x79ab('0x28')];this['originatecalleridnum']=_0x5aa0cb['originatecalleridnum']||'';this[_0x79ab('0x29')]=_0x5aa0cb[_0x79ab('0x29')]||'';}module[_0x79ab('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index fab34af..63da4ca 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(_0x1e02c1,_0x576272){var _0x5e37ad=function(_0x2c5d99){while(--_0x2c5d99){_0x1e02c1['push'](_0x1e02c1['shift']());}};_0x5e37ad(++_0x576272);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x3fcbd3,_0x553f41){var _0x37dd0c=function(_0x4f29e5){while(--_0x4f29e5){_0x3fcbd3['push'](_0x3fcbd3['shift']());}};_0x37dd0c(++_0x553f41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 c5c971d..8092b39 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 _0x7af2=['application/pdf','then','parse','catch','error','stringify','\x20receiveFax\x20','pick','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','SUCCESS','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','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','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','.pdf'];(function(_0x10161b,_0x525d72){var _0x3ba890=function(_0xd50f9d){while(--_0xd50f9d){_0x10161b['push'](_0x10161b['shift']());}};_0x3ba890(++_0x525d72);}(_0x7af2,0x119));var _0x27af=function(_0x4034c2,_0x3253e5){_0x4034c2=_0x4034c2-0x0;var _0x1cc244=_0x7af2[_0x4034c2];return _0x1cc244;};'use strict';var util=require('util');var _=require(_0x27af('0x0'));var BPromise=require(_0x27af('0x1'));var uuid=require(_0x27af('0x2'));var moment=require(_0x27af('0x3'));var path=require('path');var tiff2pdf=require(_0x27af('0x4'));var gs=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var ami=require(_0x27af('0x8'));var rpcDb=require(_0x27af('0x9'));var Channel=require(_0x27af('0xa'));var ut=require(_0x27af('0xb'));var Action=require(_0x27af('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x27af('0xd'));var faxMessage=require(_0x27af('0xe'));function Fax(_0x389e97){this['channels']={};this[_0x27af('0xf')]=_0x389e97[_0x27af('0xf')];this[_0x27af('0x10')]=_0x389e97['trunks'];this[_0x27af('0x11')]={};ami['on']('newchannel',this['syncNewchannel'][_0x27af('0x12')](this));ami['on']('varset',this['syncVarSet'][_0x27af('0x12')](this));ami['on']('newstate',this[_0x27af('0x13')]['bind'](this));ami['on'](_0x27af('0x14'),this[_0x27af('0x15')][_0x27af('0x12')](this));ami['on'](_0x27af('0x16'),this[_0x27af('0x17')][_0x27af('0x12')](this));ami['on'](_0x27af('0x18'),this[_0x27af('0x19')][_0x27af('0x12')](this));ami['on'](_0x27af('0x1a'),this[_0x27af('0x1b')][_0x27af('0x12')](this));ami['on'](_0x27af('0x1c'),this[_0x27af('0x1d')][_0x27af('0x12')](this));}Fax[_0x27af('0x1e')][_0x27af('0x1f')]=function(_0xbcf794){if(_0xbcf794['context']===_0x27af('0x20')){for(var _0x31d702 in this['faxAccounts']){if(this['faxAccounts'][_0x27af('0x21')](_0x31d702)){if(_0xbcf794[_0x27af('0x22')]===this[_0x27af('0xf')][_0x31d702][_0x27af('0x23')]){this[_0x27af('0x24')][_0xbcf794['uniqueid']]={};this[_0x27af('0x24')][_0xbcf794[_0x27af('0x25')]][_0x27af('0x26')]=_0xbcf794['channel'];this[_0x27af('0x24')][_0xbcf794[_0x27af('0x25')]]['id']=this[_0x27af('0xf')][_0x31d702]['id'];this['channels'][_0xbcf794[_0x27af('0x25')]][_0x27af('0x27')]=this[_0x27af('0xf')][_0x31d702][_0x27af('0x27')];logger[_0x27af('0x28')](_0xbcf794[_0x27af('0x25')],_0x27af('0x29'));}}}}if(this[_0x27af('0x11')][_0xbcf794[_0x27af('0x25')]]){this['channels'][_0xbcf794['uniqueid']]={};this['channels'][_0xbcf794[_0x27af('0x25')]]['channel']=_0xbcf794[_0x27af('0x26')];logger[_0x27af('0x28')](_0xbcf794['uniqueid'],_0x27af('0x29'));}};Fax[_0x27af('0x1e')][_0x27af('0x2a')]=function(_0x424490){if(this[_0x27af('0x24')][_0x424490[_0x27af('0x25')]]){for(var _0x775d4e in _0x424490['variable']){if(_0x424490[_0x27af('0x2b')][_0x27af('0x21')](_0x775d4e)){this[_0x27af('0x24')][_0x424490[_0x27af('0x25')]][_0x775d4e]=_0x424490[_0x27af('0x2c')];}}}};Fax[_0x27af('0x1e')][_0x27af('0x13')]=function(_0x2b26ac){if(this[_0x27af('0x24')][_0x2b26ac[_0x27af('0x25')]]){this[_0x27af('0x24')][_0x2b26ac['uniqueid']][_0x27af('0x2d')]=_0x2b26ac[_0x27af('0x2d')];this[_0x27af('0x24')][_0x2b26ac[_0x27af('0x25')]][_0x27af('0x2e')]=_0x2b26ac[_0x27af('0x2e')];}};Fax['prototype']['syncNewExten']=function(_0x214791){if(this[_0x27af('0x24')][_0x214791['uniqueid']]){for(var _0x24e7e9 in _0x214791[_0x27af('0x2b')]){if(_0x214791[_0x27af('0x2b')][_0x27af('0x21')](_0x24e7e9)){this[_0x27af('0x24')][_0x214791[_0x27af('0x25')]][_0x24e7e9]=_0x214791[_0x27af('0x2c')];}}}};Fax[_0x27af('0x1e')][_0x27af('0x17')]=function(_0x425ac1){if(this[_0x27af('0x24')][_0x425ac1['uniqueid']]){this['channels'][_0x425ac1[_0x27af('0x25')]][_0x27af('0x2f')]=_0x425ac1['operation'];this[_0x27af('0x24')][_0x425ac1[_0x27af('0x25')]]['status']=_0x425ac1[_0x27af('0x30')];this[_0x27af('0x24')][_0x425ac1[_0x27af('0x25')]][_0x27af('0x23')]=_0x425ac1[_0x27af('0x23')];this['channels'][_0x425ac1[_0x27af('0x25')]][_0x27af('0x31')]=_0x425ac1['filename'];logger['info'](_0x425ac1[_0x27af('0x25')],_0x27af('0x32'));}};Fax[_0x27af('0x1e')][_0x27af('0x19')]=function(_0x467891){var _0xd58131=this;if(this['channels'][_0x467891[_0x27af('0x25')]]){var _0x506474=this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]]['id'];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x33')]=_0x467891['remotestationid'];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x34')]=_0x467891[_0x27af('0x34')];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x23')]=_0x467891[_0x27af('0x23')];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x35')]=_0x467891[_0x27af('0x35')];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]]['transferrate']=_0x467891[_0x27af('0x36')];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x31')]=_0x467891['filename'];this[_0x27af('0x24')][_0x467891['uniqueid']]['calleridnum']=_0x467891[_0x27af('0x37')];if(this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x34')]>0x0){tiff2pdf(_0x467891[_0x27af('0x31')],_0x27af('0x38'),function(_0x28b953){logger[_0x27af('0x28')](_0x467891[_0x27af('0x25')],_0x27af('0x39'),_0x28b953[_0x27af('0x3a')]);attachment[_0x27af('0x3b')]({'name':path['parse'](_0x467891[_0x27af('0x31')])[_0x27af('0x27')],'basename':path['parse'](_0x467891['filename'])[_0x27af('0x27')]+_0x27af('0x3c'),'type':_0x27af('0x3d')})[_0x27af('0x3e')](function(_0x1bd775){faxAccount['notify'](_0x506474,{'from':_0x467891[_0x27af('0x37')],'mapKey':'fax','body':path[_0x27af('0x3f')](_0x467891[_0x27af('0x31')])[_0x27af('0x27')]+_0x27af('0x3c'),'AttachmentId':_0x1bd775['id']})[_0x27af('0x40')](function(_0x3fd6ef){logger[_0x27af('0x41')](_0x467891['uniqueid'],'\x20notify\x20',JSON[_0x27af('0x42')](_0x3fd6ef));});})['catch'](function(_0xffeb6){logger[_0x27af('0x41')](_0x467891[_0x27af('0x25')],_0x27af('0x43'),JSON[_0x27af('0x42')](_0xffeb6));});});}logger[_0x27af('0x28')](_0x467891[_0x27af('0x25')],'\x20receiveFax\x20');}};Fax[_0x27af('0x1e')][_0x27af('0x1d')]=function(_0x20e180){if(this[_0x27af('0x11')][_0x20e180[_0x27af('0x25')]]){_['merge'](this[_0x27af('0x24')][_0x20e180[_0x27af('0x25')]],_[_0x27af('0x44')](_0x20e180,['response','reason']));}};function updateStatus(_0x3c0a03){if(_0x3c0a03[_0x27af('0x45')]){faxMessage[_0x27af('0x46')](_0x3c0a03['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x27af('0x3e')](function(_0x5278cd){ut[_0x27af('0x47')](_0x27af('0x48'),_0x5278cd);})[_0x27af('0x40')](function(_0x290f4f){ut[_0x27af('0x47')](_0x27af('0x49'),_0x290f4f);});}else{ut[_0x27af('0x47')](_0x27af('0x4a'));}}Fax[_0x27af('0x1e')][_0x27af('0x4b')]=function(_0x23369a,_0x5c02c1,_0x76ed78){var _0x2ee44a=this;var _0x3f1b20={};if(_0x5c02c1){_0x3f1b20={'read':_0x5c02c1};}else{_0x3f1b20={'failMessage':_0x76ed78};}if(this[_0x27af('0x11')][_0x23369a][_0x27af('0x45')]){faxMessage[_0x27af('0x46')](this[_0x27af('0x11')][_0x23369a][_0x27af('0x45')],_0x3f1b20)['then'](function(_0x2e7b34){ut['logger'](_0x27af('0x4c'),_0x2e7b34);})[_0x27af('0x40')](function(_0x42b6a2){ut['logger'](_0x27af('0x4d'),_0x42b6a2);})['finally'](function(){delete _0x2ee44a[_0x27af('0x24')][_0x23369a];delete _0x2ee44a[_0x27af('0x11')][_0x23369a];});}else{ut[_0x27af('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0x27af('0x24')][_0x23369a];delete this['actions'][_0x23369a];}};Fax[_0x27af('0x1e')]['syncHangup']=function(_0x477251){var _0x3eea7b=this;if(this[_0x27af('0x24')][_0x477251['uniqueid']]){if(this['actions'][_0x477251[_0x27af('0x25')]]){this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]]['id']=this[_0x27af('0x11')][_0x477251['uniqueid']]['id'];this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]][_0x27af('0x27')]=this[_0x27af('0x11')][_0x477251[_0x27af('0x25')]][_0x27af('0x27')];}logger['info'](_0x477251[_0x27af('0x25')],this[_0x27af('0x11')][_0x477251[_0x27af('0x25')]]?_0x27af('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON[_0x27af('0x42')](this['channels'][_0x477251[_0x27af('0x25')]]));if(this[_0x27af('0x11')][_0x477251['uniqueid']]){if(this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]]['faxpages']>0x0&&this['channels'][_0x477251[_0x27af('0x25')]][_0x27af('0x16')]===_0x27af('0x4f')){this['updateStatus'](_0x477251[_0x27af('0x25')],!![]);}else{this[_0x27af('0x4b')](_0x477251['uniqueid'],![],this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x27af('0x1e')][_0x27af('0x50')]=function(_0x2a8534){var _0x266220=this;return new BPromise(function(_0x15103e,_0x3515ee){_0x266220[_0x27af('0x51')](_0x2a8534,_0x266220['faxAccounts'][_0x2a8534['FaxAccountId']])[_0x27af('0x3e')](function(_0x402654){ut[_0x27af('0x47')](_0x27af('0x52'),_0x402654);_0x15103e(ut[_0x27af('0x3a')](_0x27af('0x53')));})[_0x27af('0x40')](function(_0x2b86b3){ut[_0x27af('0x47')](_0x27af('0x54'),_0x2b86b3);updateStatus(_0x2a8534);_0x3515ee(ut[_0x27af('0x3a')](_0x27af('0x55')));});});};Fax[_0x27af('0x1e')][_0x27af('0x56')]=function(_0x3bfd28){var _0x4932b8=this;return new BPromise(function(_0x4601e9,_0x4eb01f){var _0x3379a9=_0x4932b8[_0x27af('0x57')](_0x4932b8['faxAccounts'][_0x3bfd28[_0x27af('0x58')]][_0x27af('0x59')],_0x3bfd28);if(_0x3379a9[_0x27af('0x5a')]){_0x4601e9(ut[_0x27af('0x3a')](_0x27af('0x5b')));}else{_0x4eb01f(ut[_0x27af('0x3a')](_0x3379a9['message']));}});};function originate(_0x132ed4,_0x31a595,_0x3a2958){return new BPromise(function(_0x4ab463,_0x5d7af4){if(_0x3a2958){var _0xf3ac96=util['format'](_0x27af('0x5c'),path[_0x27af('0x3f')](_0x132ed4[_0x27af('0x5d')])[_0x27af('0x27')],_0x132ed4[_0x27af('0x5d')]);gs['execute'](_0xf3ac96)[_0x27af('0x3e')](function(){_0x132ed4[_0x27af('0x5d')]=util['format'](_0x27af('0x5e'),path[_0x27af('0x3f')](_0x132ed4['path'])['dir'],path[_0x27af('0x3f')](_0x132ed4[_0x27af('0x5d')])[_0x27af('0x27')]);_0x31a595[_0x27af('0x5f')]=_0x132ed4[_0x27af('0x5d')];ut[_0x27af('0x47')](_0x27af('0x60'),'');ami['Action'](ut[_0x27af('0x61')](_0x132ed4,_0x31a595))[_0x27af('0x3e')](function(_0x19067d){_0x4ab463(_0x19067d);})[_0x27af('0x40')](function(_0x4d120b){_0x5d7af4(_0x4d120b);});})['catch'](function(_0x8bcd9f){_0x5d7af4(_0x8bcd9f);});}else{ami[_0x27af('0x62')](ut[_0x27af('0x61')](_0x132ed4,_0x31a595))[_0x27af('0x3e')](function(_0x569083){_0x4ab463(_0x569083);})['catch'](function(_0x5de989){_0x5d7af4(_0x5de989);});}});}Fax[_0x27af('0x1e')][_0x27af('0x51')]=function(_0x27add6,_0x2c1225){var _0x44af31=this;return new BPromise(function(_0x27dcd5,_0x50f5e6){var _0x4895f4=uuid['v4']();var _0x18c5c0=ut[_0x27af('0x63')](_0x27add6,_0x2c1225);_0x44af31[_0x27af('0x11')][_0x4895f4]=new Action(_0x4895f4,_0x2c1225,_0x27add6);var _0x2c3d30=_0x44af31['actions'][_0x4895f4];if(path['parse'](_0x27add6[_0x27af('0x5d')])[_0x27af('0x64')]===_0x27af('0x3c')){originate(_0x2c3d30,_0x18c5c0,!![])[_0x27af('0x3e')](function(_0x2b7e18){_0x27dcd5(_0x2b7e18);})[_0x27af('0x40')](function(_0x199679){_0x50f5e6(_0x199679);});}else{originate(_0x2c3d30,_0x18c5c0,![])[_0x27af('0x3e')](function(_0x1d0438){_0x27dcd5(_0x1d0438);})[_0x27af('0x40')](function(_0x435746){_0x50f5e6(_0x435746);});}});};Fax['prototype'][_0x27af('0x65')]=function(_0xb0161c){return!_[_0x27af('0x66')](_0xb0161c)&&!_['isNil'](_0xb0161c[_0x27af('0x27')])&&!_[_0x27af('0x66')](_0xb0161c[_0x27af('0x67')])&&_0xb0161c['active']&&!_[_0x27af('0x66')](this['trunks'][util[_0x27af('0x68')](_0x27af('0x69'),_0xb0161c[_0x27af('0x27')])])&&!_[_0x27af('0x66')](this[_0x27af('0x10')][util[_0x27af('0x68')](_0x27af('0x69'),_0xb0161c[_0x27af('0x27')])]['status'])&&(this[_0x27af('0x10')][util['format'](_0x27af('0x69'),_0xb0161c[_0x27af('0x27')])][_0x27af('0x30')]==='reachable'||this['trunks'][util[_0x27af('0x68')](_0x27af('0x69'),_0xb0161c[_0x27af('0x27')])]['status']==='unmonitored');};Fax['prototype'][_0x27af('0x57')]=function(_0x110843,_0x551f50){if(!this[_0x27af('0x65')](_0x110843)){ut[_0x27af('0x47')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x27af('0x66')](_0x110843)?'':_0x110843[_0x27af('0x27')]+_0x27af('0x6a'));return{'isValid':![],'message':_0x27af('0x6b')};}if(_['isNil'](_0x551f50[_0x27af('0x7')])){ut[_0x27af('0x47')](_0x27af('0x6c'),JSON[_0x27af('0x42')](_0x551f50));return{'isValid':![],'message':_0x27af('0x6d')};}if(_['isNil'](_0x551f50['path'])){ut[_0x27af('0x47')](_0x27af('0x6e'),JSON['stringify'](_0x551f50));return{'isValid':![],'message':_0x27af('0x6f')};}return{'isValid':!![],'message':_0x27af('0x70')};};module[_0x27af('0x71')]=Fax; \ No newline at end of file +var _0x1339=['SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','exten','channel','uniqueid','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring'];(function(_0x257285,_0x5e2abf){var _0x14b0a6=function(_0x42468f){while(--_0x42468f){_0x257285['push'](_0x257285['shift']());}};_0x14b0a6(++_0x5e2abf);}(_0x1339,0x1ed));var _0x9133=function(_0x532c95,_0x48baa2){_0x532c95=_0x532c95-0x0;var _0x2ed9d4=_0x1339[_0x532c95];return _0x2ed9d4;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x9133('0x0'));var uuid=require(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var path=require(_0x9133('0x3'));var tiff2pdf=require(_0x9133('0x4'));var gs=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var ami=require('../ami');var rpcDb=require(_0x9133('0x8'));var Channel=require(_0x9133('0x9'));var ut=require(_0x9133('0xa'));var Action=require('./action');var faxAccount=require(_0x9133('0xb'));var attachment=require(_0x9133('0xc'));var faxMessage=require(_0x9133('0xd'));function Fax(_0x431a55){this[_0x9133('0xe')]={};this[_0x9133('0xf')]=_0x431a55[_0x9133('0xf')];this[_0x9133('0x10')]=_0x431a55[_0x9133('0x10')];this[_0x9133('0x11')]={};ami['on']('newchannel',this[_0x9133('0x12')][_0x9133('0x13')](this));ami['on'](_0x9133('0x14'),this[_0x9133('0x15')][_0x9133('0x13')](this));ami['on'](_0x9133('0x16'),this['syncNewState'][_0x9133('0x13')](this));ami['on'](_0x9133('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0x9133('0x18'),this['syncFaxStatus'][_0x9133('0x13')](this));ami['on'](_0x9133('0x19'),this[_0x9133('0x1a')][_0x9133('0x13')](this));ami['on'](_0x9133('0x1b'),this[_0x9133('0x1c')]['bind'](this));ami['on'](_0x9133('0x1d'),this[_0x9133('0x1e')]['bind'](this));}Fax[_0x9133('0x1f')][_0x9133('0x12')]=function(_0x3b39ec){if(_0x3b39ec[_0x9133('0x20')]==='from-voip-provider'){for(var _0x1f3484 in this['faxAccounts']){if(this[_0x9133('0xf')]['hasOwnProperty'](_0x1f3484)){if(_0x3b39ec[_0x9133('0x21')]===this[_0x9133('0xf')][_0x1f3484]['localstationid']){this[_0x9133('0xe')][_0x3b39ec['uniqueid']]={};this[_0x9133('0xe')][_0x3b39ec['uniqueid']]['channel']=_0x3b39ec[_0x9133('0x22')];this['channels'][_0x3b39ec[_0x9133('0x23')]]['id']=this['faxAccounts'][_0x1f3484]['id'];this['channels'][_0x3b39ec['uniqueid']][_0x9133('0x24')]=this[_0x9133('0xf')][_0x1f3484]['name'];logger[_0x9133('0x25')](_0x3b39ec[_0x9133('0x23')],_0x9133('0x26'));}}}}if(this[_0x9133('0x11')][_0x3b39ec['uniqueid']]){this[_0x9133('0xe')][_0x3b39ec['uniqueid']]={};this[_0x9133('0xe')][_0x3b39ec[_0x9133('0x23')]][_0x9133('0x22')]=_0x3b39ec[_0x9133('0x22')];logger[_0x9133('0x25')](_0x3b39ec[_0x9133('0x23')],_0x9133('0x26'));}};Fax[_0x9133('0x1f')][_0x9133('0x15')]=function(_0x46050b){if(this['channels'][_0x46050b['uniqueid']]){for(var _0x477bf1 in _0x46050b[_0x9133('0x27')]){if(_0x46050b[_0x9133('0x27')][_0x9133('0x28')](_0x477bf1)){this['channels'][_0x46050b['uniqueid']][_0x477bf1]=_0x46050b[_0x9133('0x29')];}}}};Fax[_0x9133('0x1f')][_0x9133('0x2a')]=function(_0x26d351){if(this[_0x9133('0xe')][_0x26d351[_0x9133('0x23')]]){this['channels'][_0x26d351['uniqueid']]['channelstate']=_0x26d351[_0x9133('0x2b')];this['channels'][_0x26d351[_0x9133('0x23')]][_0x9133('0x2c')]=_0x26d351['channelstatedesc'];}};Fax[_0x9133('0x1f')]['syncNewExten']=function(_0xf0aec4){if(this[_0x9133('0xe')][_0xf0aec4[_0x9133('0x23')]]){for(var _0x5f1de2 in _0xf0aec4[_0x9133('0x27')]){if(_0xf0aec4[_0x9133('0x27')][_0x9133('0x28')](_0x5f1de2)){this['channels'][_0xf0aec4[_0x9133('0x23')]][_0x5f1de2]=_0xf0aec4[_0x9133('0x29')];}}}};Fax[_0x9133('0x1f')]['syncFaxStatus']=function(_0x37667e){if(this[_0x9133('0xe')][_0x37667e[_0x9133('0x23')]]){this[_0x9133('0xe')][_0x37667e['uniqueid']][_0x9133('0x2d')]=_0x37667e[_0x9133('0x2d')];this['channels'][_0x37667e[_0x9133('0x23')]][_0x9133('0x2e')]=_0x37667e[_0x9133('0x2e')];this[_0x9133('0xe')][_0x37667e[_0x9133('0x23')]][_0x9133('0x2f')]=_0x37667e[_0x9133('0x2f')];this[_0x9133('0xe')][_0x37667e[_0x9133('0x23')]][_0x9133('0x30')]=_0x37667e[_0x9133('0x30')];logger['info'](_0x37667e[_0x9133('0x23')],_0x9133('0x31'));}};Fax['prototype'][_0x9133('0x1a')]=function(_0x3a2d1f){var _0x2bc3b3=this;if(this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]]){var _0x3d24f4=this['channels'][_0x3a2d1f['uniqueid']]['id'];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x32')]=_0x3a2d1f[_0x9133('0x32')];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x33')]=_0x3a2d1f[_0x9133('0x33')];this[_0x9133('0xe')][_0x3a2d1f['uniqueid']][_0x9133('0x2f')]=_0x3a2d1f[_0x9133('0x2f')];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x34')]=_0x3a2d1f['resolution'];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x35')]=_0x3a2d1f[_0x9133('0x35')];this['channels'][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x30')]=_0x3a2d1f[_0x9133('0x30')];this[_0x9133('0xe')][_0x3a2d1f[_0x9133('0x23')]][_0x9133('0x36')]=_0x3a2d1f[_0x9133('0x36')];if(this['channels'][_0x3a2d1f[_0x9133('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x3a2d1f['filename'],_0x9133('0x37'),function(_0x1d564f){logger[_0x9133('0x25')](_0x3a2d1f[_0x9133('0x23')],_0x9133('0x38'),_0x1d564f[_0x9133('0x39')]);attachment[_0x9133('0x3a')]({'name':path[_0x9133('0x3b')](_0x3a2d1f[_0x9133('0x30')])['name'],'basename':path[_0x9133('0x3b')](_0x3a2d1f[_0x9133('0x30')])[_0x9133('0x24')]+'.pdf','type':'application/pdf'})[_0x9133('0x3c')](function(_0x2311aa){faxAccount['notify'](_0x3d24f4,{'from':_0x3a2d1f[_0x9133('0x36')],'mapKey':_0x9133('0x7'),'body':path[_0x9133('0x3b')](_0x3a2d1f[_0x9133('0x30')])[_0x9133('0x24')]+'.pdf','AttachmentId':_0x2311aa['id']})[_0x9133('0x3d')](function(_0x4423b4){logger[_0x9133('0x3e')](_0x3a2d1f['uniqueid'],_0x9133('0x3f'),JSON[_0x9133('0x40')](_0x4423b4));});})['catch'](function(_0x5d31a7){logger[_0x9133('0x3e')](_0x3a2d1f[_0x9133('0x23')],_0x9133('0x41'),JSON[_0x9133('0x40')](_0x5d31a7));});});}logger[_0x9133('0x25')](_0x3a2d1f[_0x9133('0x23')],_0x9133('0x41'));}};Fax[_0x9133('0x1f')][_0x9133('0x1e')]=function(_0xf07fbb){if(this[_0x9133('0x11')][_0xf07fbb[_0x9133('0x23')]]){_['merge'](this['channels'][_0xf07fbb[_0x9133('0x23')]],_['pick'](_0xf07fbb,[_0x9133('0x42'),_0x9133('0x43')]));}};function updateStatus(_0x6fbb11){if(_0x6fbb11[_0x9133('0x44')]){faxMessage['update'](_0x6fbb11[_0x9133('0x44')],{'failMessage':_0x9133('0x45')})[_0x9133('0x3c')](function(_0x5d8db4){ut[_0x9133('0x46')](_0x9133('0x47'),_0x5d8db4);})[_0x9133('0x3d')](function(_0x4ad8c5){ut[_0x9133('0x46')]('[Fax][Message][Error][NoUpdate1]',_0x4ad8c5);});}else{ut[_0x9133('0x46')](_0x9133('0x48'));}}Fax[_0x9133('0x1f')][_0x9133('0x49')]=function(_0x4f58fe,_0x4a346c,_0x2f09f6){var _0x213e3d=this;var _0x20b1fe={};if(_0x4a346c){_0x20b1fe={'read':_0x4a346c};}else{_0x20b1fe={'failMessage':_0x2f09f6};}if(this[_0x9133('0x11')][_0x4f58fe][_0x9133('0x44')]){faxMessage['update'](this['actions'][_0x4f58fe][_0x9133('0x44')],_0x20b1fe)[_0x9133('0x3c')](function(_0x4abefd){ut[_0x9133('0x46')](_0x9133('0x4a'),_0x4abefd);})['catch'](function(_0x508303){ut['logger'](_0x9133('0x4b'),_0x508303);})['finally'](function(){delete _0x213e3d[_0x9133('0xe')][_0x4f58fe];delete _0x213e3d[_0x9133('0x11')][_0x4f58fe];});}else{ut[_0x9133('0x46')](_0x9133('0x4c'));delete this['channels'][_0x4f58fe];delete this[_0x9133('0x11')][_0x4f58fe];}};Fax['prototype'][_0x9133('0x1c')]=function(_0x3d7cf0){var _0x46d348=this;if(this[_0x9133('0xe')][_0x3d7cf0[_0x9133('0x23')]]){if(this[_0x9133('0x11')][_0x3d7cf0['uniqueid']]){this['channels'][_0x3d7cf0['uniqueid']]['id']=this[_0x9133('0x11')][_0x3d7cf0[_0x9133('0x23')]]['id'];this[_0x9133('0xe')][_0x3d7cf0['uniqueid']][_0x9133('0x24')]=this[_0x9133('0x11')][_0x3d7cf0[_0x9133('0x23')]][_0x9133('0x24')];}logger[_0x9133('0x25')](_0x3d7cf0[_0x9133('0x23')],this[_0x9133('0x11')][_0x3d7cf0[_0x9133('0x23')]]?'\x20hangup\x20sendFile\x20':_0x9133('0x4d'),JSON['stringify'](this[_0x9133('0xe')][_0x3d7cf0['uniqueid']]));if(this[_0x9133('0x11')][_0x3d7cf0[_0x9133('0x23')]]){if(this['channels'][_0x3d7cf0['uniqueid']][_0x9133('0x4e')]>0x0&&this[_0x9133('0xe')][_0x3d7cf0[_0x9133('0x23')]][_0x9133('0x18')]===_0x9133('0x4f')){this[_0x9133('0x49')](_0x3d7cf0[_0x9133('0x23')],!![]);}else{this[_0x9133('0x49')](_0x3d7cf0[_0x9133('0x23')],![],this[_0x9133('0xe')][_0x3d7cf0[_0x9133('0x23')]]['faxstatusstring']?_0x9133('0x50')+this['channels'][_0x3d7cf0[_0x9133('0x23')]][_0x9133('0x51')]:_0x9133('0x52'));}}}};Fax[_0x9133('0x1f')][_0x9133('0x53')]=function(_0x52d4c8){var _0x35bc72=this;return new BPromise(function(_0x1f0ca7,_0x19339e){_0x35bc72[_0x9133('0x54')](_0x52d4c8,_0x35bc72['faxAccounts'][_0x52d4c8[_0x9133('0x55')]])[_0x9133('0x3c')](function(_0xcfcae2){ut[_0x9133('0x46')]('[Fax][execOriginate][success]',_0xcfcae2);_0x1f0ca7(ut['message'](_0x9133('0x56')));})[_0x9133('0x3d')](function(_0x23e4d1){ut[_0x9133('0x46')](_0x9133('0x57'),_0x23e4d1);updateStatus(_0x52d4c8);_0x19339e(ut[_0x9133('0x39')]('Fax\x20failed'));});});};Fax[_0x9133('0x1f')][_0x9133('0x58')]=function(_0x2576c8){var _0x22611b=this;return new BPromise(function(_0x57e4e9,_0x47342a){var _0x54ddcd=_0x22611b[_0x9133('0x59')](_0x22611b[_0x9133('0xf')][_0x2576c8[_0x9133('0x55')]][_0x9133('0x5a')],_0x2576c8);if(_0x54ddcd[_0x9133('0x5b')]){_0x57e4e9(ut[_0x9133('0x39')](_0x9133('0x5c')));}else{_0x47342a(ut[_0x9133('0x39')](_0x54ddcd['message']));}});};function originate(_0x23bd83,_0x1fcd01,_0x10afd7){return new BPromise(function(_0x152283,_0x406861){if(_0x10afd7){var _0x4e0afe=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x9133('0x3b')](_0x23bd83[_0x9133('0x3')])[_0x9133('0x24')],_0x23bd83['path']);gs[_0x9133('0x5d')](_0x4e0afe)[_0x9133('0x3c')](function(){_0x23bd83[_0x9133('0x3')]=util[_0x9133('0x5e')](_0x9133('0x5f'),path[_0x9133('0x3b')](_0x23bd83[_0x9133('0x3')])[_0x9133('0x60')],path['parse'](_0x23bd83[_0x9133('0x3')])[_0x9133('0x24')]);_0x1fcd01['XMF-PATH']=_0x23bd83[_0x9133('0x3')];ut['logger'](_0x9133('0x61'),'');ami[_0x9133('0x62')](ut[_0x9133('0x63')](_0x23bd83,_0x1fcd01))[_0x9133('0x3c')](function(_0x353a37){_0x152283(_0x353a37);})['catch'](function(_0x2d6f8e){_0x406861(_0x2d6f8e);});})[_0x9133('0x3d')](function(_0x23b4ac){_0x406861(_0x23b4ac);});}else{ami[_0x9133('0x62')](ut['variablesAction'](_0x23bd83,_0x1fcd01))[_0x9133('0x3c')](function(_0x24c70d){_0x152283(_0x24c70d);})[_0x9133('0x3d')](function(_0x208dd3){_0x406861(_0x208dd3);});}});}Fax[_0x9133('0x1f')][_0x9133('0x54')]=function(_0x1fd7f5,_0x156d20){var _0x650c7d=this;return new BPromise(function(_0x31bda5,_0x37297a){var _0x4c3dc7=uuid['v4']();var _0x408456=ut[_0x9133('0x64')](_0x1fd7f5,_0x156d20);_0x650c7d[_0x9133('0x11')][_0x4c3dc7]=new Action(_0x4c3dc7,_0x156d20,_0x1fd7f5);var _0x12ae5f=_0x650c7d['actions'][_0x4c3dc7];if(path[_0x9133('0x3b')](_0x1fd7f5['path'])[_0x9133('0x65')]===_0x9133('0x66')){originate(_0x12ae5f,_0x408456,!![])[_0x9133('0x3c')](function(_0x530984){_0x31bda5(_0x530984);})[_0x9133('0x3d')](function(_0x163487){_0x37297a(_0x163487);});}else{originate(_0x12ae5f,_0x408456,![])[_0x9133('0x3c')](function(_0x52d940){_0x31bda5(_0x52d940);})[_0x9133('0x3d')](function(_0x3275b3){_0x37297a(_0x3275b3);});}});};Fax['prototype'][_0x9133('0x67')]=function(_0x12094c){return!_[_0x9133('0x68')](_0x12094c)&&!_['isNil'](_0x12094c[_0x9133('0x24')])&&!_['isNil'](_0x12094c[_0x9133('0x69')])&&_0x12094c[_0x9133('0x69')]&&!_[_0x9133('0x68')](this['trunks'][util[_0x9133('0x5e')]('SIP/%s',_0x12094c[_0x9133('0x24')])])&&!_[_0x9133('0x68')](this[_0x9133('0x10')][util[_0x9133('0x5e')](_0x9133('0x6a'),_0x12094c[_0x9133('0x24')])][_0x9133('0x2e')])&&(this[_0x9133('0x10')][util['format'](_0x9133('0x6a'),_0x12094c[_0x9133('0x24')])][_0x9133('0x2e')]===_0x9133('0x6b')||this[_0x9133('0x10')][util['format'](_0x9133('0x6a'),_0x12094c[_0x9133('0x24')])][_0x9133('0x2e')]===_0x9133('0x6c'));};Fax['prototype'][_0x9133('0x59')]=function(_0x580741,_0x29a1d9){if(!this[_0x9133('0x67')](_0x580741)){ut[_0x9133('0x46')](_0x9133('0x6d'),_['isNil'](_0x580741)?'':_0x580741[_0x9133('0x24')]+_0x9133('0x6e'));return{'isValid':![],'message':_0x9133('0x6f')};}if(_[_0x9133('0x68')](_0x29a1d9[_0x9133('0x7')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x29a1d9));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x9133('0x68')](_0x29a1d9[_0x9133('0x3')])){ut[_0x9133('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x9133('0x40')](_0x29a1d9));return{'isValid':![],'message':_0x9133('0x70')};}return{'isValid':!![],'message':_0x9133('0x71')};};module[_0x9133('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index c77e6d6..e092e36 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 _0x5d0d=['util','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d0d,0x99));var _0xd5d0=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x5d0d[_0x382e89];return _0x3a1318;};'use strict';var util=require(_0xd5d0('0x0'));var BPromise=require('bluebird');var logger=require(_0xd5d0('0x1'))('preview');var _=require(_0xd5d0('0x2'));var faxAccount=require(_0xd5d0('0x3'));function loggerCatch(_0x2089b3){return function(_0x3105d1){logger[_0xd5d0('0x4')](_0x2089b3,util[_0xd5d0('0x5')](_0x3105d1,{'showHidden':![],'depth':null}));};}exports[_0xd5d0('0x6')]=function(_0x1acf6e,_0x347495){return BPromise[_0xd5d0('0x7')]()['then'](faxAccount['notify'](_0x1acf6e,_0x347495))[_0xd5d0('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x37ec=['bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x5dd349,_0x51dc39){var _0x3fbd33=function(_0x1c5dc5){while(--_0x1c5dc5){_0x5dd349['push'](_0x5dd349['shift']());}};_0x3fbd33(++_0x51dc39);}(_0x37ec,0x83));var _0xc37e=function(_0x103206,_0x1fae01){_0x103206=_0x103206-0x0;var _0x2e2f53=_0x37ec[_0x103206];return _0x2e2f53;};'use strict';var util=require(_0xc37e('0x0'));var BPromise=require(_0xc37e('0x1'));var logger=require(_0xc37e('0x2'))(_0xc37e('0x3'));var _=require(_0xc37e('0x4'));var faxAccount=require(_0xc37e('0x5'));function loggerCatch(_0x14f208){return function(_0x4702a6){logger['error'](_0x14f208,util[_0xc37e('0x6')](_0x4702a6,{'showHidden':![],'depth':null}));};}exports[_0xc37e('0x7')]=function(_0x7540d7,_0x26c6f4){return BPromise[_0xc37e('0x8')]()[_0xc37e('0x9')](faxAccount[_0xc37e('0x7')](_0x7540d7,_0x26c6f4))[_0xc37e('0xa')](loggerCatch(_0xc37e('0xb')));}; \ 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 7993d31..2c12573 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 _0x9c41=['exec','Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process'];(function(_0x4149c4,_0x293567){var _0x32079e=function(_0x5df9e3){while(--_0x5df9e3){_0x4149c4['push'](_0x4149c4['shift']());}};_0x32079e(++_0x293567);}(_0x9c41,0x1eb));var _0x19c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c41[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x19c4('0x0'));var logger=require(_0x19c4('0x1'))('fax');var BPromise=require(_0x19c4('0x2'));var exec=require(_0x19c4('0x3'))[_0x19c4('0x4')];exports['execute']=function(_0xcf3239){return new BPromise(function(_0x2f3cc1,_0x1b859a){exec(_0xcf3239,function(_0x262d71,_0x19aa79,_0x4c53c0){logger['info'](_0x19c4('0x5'),_0x19aa79);if(_0x262d71){logger[_0x19c4('0x6')](_0x19c4('0x5'),_0x19c4('0x7'),util[_0x19c4('0x8')](_0x262d71,{'showHidden':![],'depth':null}),_0x19aa79,_0x4c53c0);_0x1b859a(_0x262d71);}_0x2f3cc1(_0x19aa79);});});}; \ No newline at end of file +var _0xb20f=['../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x20a68a,_0x54502e){var _0x56c5d4=function(_0x4ace56){while(--_0x4ace56){_0x20a68a['push'](_0x20a68a['shift']());}};_0x56c5d4(++_0x54502e);}(_0xb20f,0xf9));var _0xfb20=function(_0x1c24ea,_0x436e7e){_0x1c24ea=_0x1c24ea-0x0;var _0x57b654=_0xb20f[_0x1c24ea];return _0x57b654;};'use strict';var util=require(_0xfb20('0x0'));var logger=require(_0xfb20('0x1'))(_0xfb20('0x2'));var BPromise=require(_0xfb20('0x3'));var exec=require(_0xfb20('0x4'))[_0xfb20('0x5')];exports[_0xfb20('0x6')]=function(_0xde2065){return new BPromise(function(_0x775ad9,_0x566164){exec(_0xde2065,function(_0x3383c8,_0x1ee597,_0x907369){logger[_0xfb20('0x7')](_0xfb20('0x8'),_0x1ee597);if(_0x3383c8){logger[_0xfb20('0x7')]('Exec\x20gs',_0xfb20('0x9'),util['inspect'](_0x3383c8,{'showHidden':![],'depth':null}),_0x1ee597,_0x907369);_0x566164(_0x3383c8);}_0x775ad9(_0x1ee597);});});}; \ 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 1d768be..bbe7f8a 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 _0x896f=['../../../../config/logger','fax','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x896f,0x12a));var _0xf896=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x896f[_0x25662e];return _0x59b7bc;};'use strict';var util=require(_0xf896('0x0'));var _=require('lodash');var moment=require(_0xf896('0x1'));var logger=require(_0xf896('0x2'))(_0xf896('0x3'));exports['message']=function(_0xda1fdb){return{'message':_0xda1fdb};};exports[_0xf896('0x4')]=function(_0xefafa2,_0x4e285d){logger[_0xf896('0x5')](_0xefafa2,util[_0xf896('0x6')](_0x4e285d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3acf6a,_0x1c8ae2){var _0x3fe24e={'XMF-ECM':_0x1c8ae2[_0xf896('0x7')],'XMF-HEADERINFO':_0x1c8ae2[_0xf896('0x8')],'XMF-MINRATE':_0x1c8ae2[_0xf896('0x9')],'XMF-MAXRATE':_0x1c8ae2[_0xf896('0xa')],'XMF-MODEM':util[_0xf896('0xb')](_0xf896('0xc'),_0x1c8ae2[_0xf896('0xd')]),'XMF-GATEWAY':_0x1c8ae2[_0xf896('0xe')],'XMF-FAXDETECT':_0x1c8ae2[_0xf896('0xf')],'XMF-T38TIMEOUT':_0x1c8ae2[_0xf896('0x10')],'XMF-LOCALSTATIONID':_0x1c8ae2[_0xf896('0x11')],'XMF-PATH':_0x3acf6a[_0xf896('0x12')]};return _0x3fe24e;};exports['variablesAction']=function(_0x599f01,_0x56abb7){return{'actionid':_0x599f01[_0xf896('0x13')],'action':_0xf896('0x14'),'channel':_0x599f01[_0xf896('0x15')],'Exten':_0xf896('0x16'),'Context':_0xf896('0x17'),'Priority':'1','callerid':util[_0xf896('0xb')](_0xf896('0x18'),_0x599f01[_0xf896('0x8')]?_0x599f01[_0xf896('0x8')]:'',_0x599f01['localstationid']),'variable':_0x56abb7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x599f01[_0xf896('0x13')]};}; \ No newline at end of file +var _0x701c=['../../../../config/logger','fax','info','inspect','ecm','minrate','\x22%s\x22','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','lodash','moment'];(function(_0x12d347,_0x43cc88){var _0x36fbf4=function(_0x3e572c){while(--_0x3e572c){_0x12d347['push'](_0x12d347['shift']());}};_0x36fbf4(++_0x43cc88);}(_0x701c,0x174));var _0xc701=function(_0x396b85,_0x2daea7){_0x396b85=_0x396b85-0x0;var _0x267550=_0x701c[_0x396b85];return _0x267550;};'use strict';var util=require('util');var _=require(_0xc701('0x0'));var moment=require(_0xc701('0x1'));var logger=require(_0xc701('0x2'))(_0xc701('0x3'));exports['message']=function(_0x204513){return{'message':_0x204513};};exports['logger']=function(_0x50099f,_0x53f1dd){logger[_0xc701('0x4')](_0x50099f,util[_0xc701('0x5')](_0x53f1dd,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x45ab5a,_0x4f1923){var _0x546e4c={'XMF-ECM':_0x4f1923[_0xc701('0x6')],'XMF-HEADERINFO':_0x4f1923['headerinfo'],'XMF-MINRATE':_0x4f1923[_0xc701('0x7')],'XMF-MAXRATE':_0x4f1923['maxrate'],'XMF-MODEM':util['format'](_0xc701('0x8'),_0x4f1923['modem']),'XMF-GATEWAY':_0x4f1923['gateway'],'XMF-FAXDETECT':_0x4f1923[_0xc701('0x9')],'XMF-T38TIMEOUT':_0x4f1923[_0xc701('0xa')],'XMF-LOCALSTATIONID':_0x4f1923[_0xc701('0xb')],'XMF-PATH':_0x45ab5a[_0xc701('0xc')]};return _0x546e4c;};exports[_0xc701('0xd')]=function(_0x4020bc,_0x2213bd){return{'actionid':_0x4020bc[_0xc701('0xe')],'action':_0xc701('0xf'),'channel':_0x4020bc[_0xc701('0x10')],'Exten':_0xc701('0x11'),'Context':_0xc701('0x12'),'Priority':'1','callerid':util[_0xc701('0x13')](_0xc701('0x14'),_0x4020bc[_0xc701('0x15')]?_0x4020bc['headerinfo']:'',_0x4020bc[_0xc701('0xb')]),'variable':_0x2213bd,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4020bc['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ec09fda..07db0bb 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 _0x7c2a=['getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./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','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7c2a,0x15e));var _0xa7c2=function(_0x575771,_0x164c49){_0x575771=_0x575771-0x0;var _0x272415=_0x7c2a[_0x575771];return _0x272415;};'use strict';var BPromise=require(_0xa7c2('0x0'));var util=require(_0xa7c2('0x1'));var moment=require('moment');var server=require(_0xa7c2('0x2'));var Realtime=require(_0xa7c2('0x3'));var Report=require(_0xa7c2('0x4'));var Acw=require(_0xa7c2('0x5'));var Trigger=require(_0xa7c2('0x6'));var Dialer=require(_0xa7c2('0x7'));var Preview=require(_0xa7c2('0x8'));var Fax=require(_0xa7c2('0x9'));var user=require(_0xa7c2('0xa'));var voiceQueue=require(_0xa7c2('0xb'));var voiceQueueReport=require(_0xa7c2('0xc'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xa7c2('0xd'));var trigger=require(_0xa7c2('0xe'));var template=require(_0xa7c2('0xf'));var cmHopperHistory=require(_0xa7c2('0x10'));var campaign=require(_0xa7c2('0x11'));var voiceExtension=require(_0xa7c2('0x12'));var faxAccount=require(_0xa7c2('0x13'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xa7c2('0x14'));var sugarcrm=require(_0xa7c2('0x15'));var freshdesk=require(_0xa7c2('0x16'));var desk=require(_0xa7c2('0x17'));var zoho=require(_0xa7c2('0x18'));var vtiger=require(_0xa7c2('0x19'));var freshsales=require(_0xa7c2('0x1a'));var servicenow=require(_0xa7c2('0x1b'));var dynamics365=require(_0xa7c2('0x1c'));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(_0xa7c2('0x1d'))(_0xa7c2('0x1e'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa7c2('0x1f')](_0xa7c2('0x20'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa7c2('0x21')]()[_0xa7c2('0x22')](user[_0xa7c2('0x23')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x24')]())['then'](user[_0xa7c2('0x25')]())[_0xa7c2('0x22')](realtime['initTelephones']())[_0xa7c2('0x22')](trunk[_0xa7c2('0x26')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x27')]())[_0xa7c2('0x22')](voiceQueue['getVoiceQueues']())[_0xa7c2('0x22')](realtime[_0xa7c2('0x28')]())[_0xa7c2('0x22')](trigger[_0xa7c2('0x29')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x2a')]())['then'](template[_0xa7c2('0x2b')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x2c')]())[_0xa7c2('0x22')](zendesk['getZendeskAccounts']())[_0xa7c2('0x22')](realtime[_0xa7c2('0x2d')]())[_0xa7c2('0x22')](salesforce[_0xa7c2('0x2e')]())['then'](realtime[_0xa7c2('0x2f')]())[_0xa7c2('0x22')](sugarcrm[_0xa7c2('0x30')]())['then'](realtime[_0xa7c2('0x31')]())[_0xa7c2('0x22')](freshdesk[_0xa7c2('0x32')]())[_0xa7c2('0x22')](realtime['initFreshdeskAccounts']())['then'](desk[_0xa7c2('0x33')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x34')]())[_0xa7c2('0x22')](zoho[_0xa7c2('0x35')]())['then'](realtime['initZohoAccounts']())['then'](vtiger[_0xa7c2('0x36')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x37')]())['then'](freshsales['getFreshsalesAccounts']())[_0xa7c2('0x22')](realtime[_0xa7c2('0x38')]())[_0xa7c2('0x22')](servicenow[_0xa7c2('0x39')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x3a')]())[_0xa7c2('0x22')](dynamics365[_0xa7c2('0x3b')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x3c')]())[_0xa7c2('0x22')](campaign[_0xa7c2('0x3d')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x3e')]())[_0xa7c2('0x22')](voiceExtension[_0xa7c2('0x3f')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x40')]())['then'](faxAccount[_0xa7c2('0x41')]())['then'](realtime[_0xa7c2('0x42')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xa7c2('0x21')]()[_0xa7c2('0x22')](voiceQueueReport[_0xa7c2('0x43')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x44')]())[_0xa7c2('0x22')](cmHopperHistory[_0xa7c2('0x45')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x46')]())['then'](cmHopperHistory[_0xa7c2('0x47')]())[_0xa7c2('0x22')](realtime['initCampaignHopperHistory']())[_0xa7c2('0x22')](voiceCallReport['getVoiceCallReports']())[_0xa7c2('0x22')](realtime[_0xa7c2('0x48')]())[_0xa7c2('0x49')](function(_0xb22ae9){logger[_0xa7c2('0x4a')](_0xa7c2('0x4b'),util[_0xa7c2('0x4c')](_0xb22ae9,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa7c2('0x4d')](realtime,preview,fax)[_0xa7c2('0x22')](function(_0x1ecf0d){return initRealtime();})[_0xa7c2('0x22')](function(){return initParams();})[_0xa7c2('0x22')](function(){report[_0xa7c2('0x4e')]();setInterval(initRealtime,0x1388);})[_0xa7c2('0x49')](function(_0x391a20){logger[_0xa7c2('0x4a')](_0xa7c2('0x4f'),util[_0xa7c2('0x4c')](_0x391a20,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x749c=['initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','inspect','sync','catch','error','bluebird','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts'];(function(_0xb5eb2,_0x4f42f0){var _0x237eb6=function(_0x25d2ee){while(--_0x25d2ee){_0xb5eb2['push'](_0xb5eb2['shift']());}};_0x237eb6(++_0x4f42f0);}(_0x749c,0x17a));var _0xc749=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x749c[_0x38537f];return _0x141e23;};'use strict';var BPromise=require(_0xc749('0x0'));var util=require(_0xc749('0x1'));var moment=require(_0xc749('0x2'));var server=require(_0xc749('0x3'));var Realtime=require('./realtime');var Report=require(_0xc749('0x4'));var Acw=require(_0xc749('0x5'));var Trigger=require(_0xc749('0x6'));var Dialer=require(_0xc749('0x7'));var Preview=require(_0xc749('0x8'));var Fax=require(_0xc749('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xc749('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc749('0xb'));var trunk=require(_0xc749('0xc'));var trigger=require('./rpc/trigger');var template=require(_0xc749('0xd'));var cmHopperHistory=require(_0xc749('0xe'));var campaign=require(_0xc749('0xf'));var voiceExtension=require(_0xc749('0x10'));var faxAccount=require(_0xc749('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xc749('0x12'));var sugarcrm=require(_0xc749('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xc749('0x14'));var zoho=require(_0xc749('0x15'));var vtiger=require(_0xc749('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xc749('0x17'));var dynamics365=require(_0xc749('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xc749('0x19'))(_0xc749('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xc749('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc749('0x1c')]()['then'](user[_0xc749('0x1d')]())[_0xc749('0x1e')](realtime[_0xc749('0x1f')]())['then'](user[_0xc749('0x20')]())[_0xc749('0x1e')](realtime[_0xc749('0x21')]())[_0xc749('0x1e')](trunk[_0xc749('0x22')]())['then'](realtime[_0xc749('0x23')]())['then'](voiceQueue[_0xc749('0x24')]())[_0xc749('0x1e')](realtime[_0xc749('0x25')]())[_0xc749('0x1e')](trigger['getTriggers']())['then'](realtime[_0xc749('0x26')]())[_0xc749('0x1e')](template['getTemplates']())[_0xc749('0x1e')](realtime[_0xc749('0x27')]())['then'](zendesk[_0xc749('0x28')]())[_0xc749('0x1e')](realtime['initZendeskAccounts']())[_0xc749('0x1e')](salesforce['getSalesforceAccounts']())[_0xc749('0x1e')](realtime[_0xc749('0x29')]())[_0xc749('0x1e')](sugarcrm[_0xc749('0x2a')]())[_0xc749('0x1e')](realtime[_0xc749('0x2b')]())[_0xc749('0x1e')](freshdesk[_0xc749('0x2c')]())[_0xc749('0x1e')](realtime['initFreshdeskAccounts']())[_0xc749('0x1e')](desk[_0xc749('0x2d')]())['then'](realtime[_0xc749('0x2e')]())['then'](zoho[_0xc749('0x2f')]())[_0xc749('0x1e')](realtime[_0xc749('0x30')]())[_0xc749('0x1e')](vtiger[_0xc749('0x31')]())[_0xc749('0x1e')](realtime[_0xc749('0x32')]())[_0xc749('0x1e')](freshsales[_0xc749('0x33')]())[_0xc749('0x1e')](realtime[_0xc749('0x34')]())[_0xc749('0x1e')](servicenow[_0xc749('0x35')]())[_0xc749('0x1e')](realtime['initServicenowAccounts']())[_0xc749('0x1e')](dynamics365[_0xc749('0x36')]())[_0xc749('0x1e')](realtime['initDynamics365Accounts']())[_0xc749('0x1e')](campaign['getCampaigns']())[_0xc749('0x1e')](realtime['initCampaigns']())[_0xc749('0x1e')](voiceExtension[_0xc749('0x37')]())[_0xc749('0x1e')](realtime[_0xc749('0x38')]())[_0xc749('0x1e')](faxAccount[_0xc749('0x39')]())[_0xc749('0x1e')](realtime[_0xc749('0x3a')]())[_0xc749('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0xc749('0x1c')]()[_0xc749('0x1e')](voiceQueueReport[_0xc749('0x3b')]())[_0xc749('0x1e')](realtime[_0xc749('0x3c')]())[_0xc749('0x1e')](cmHopperHistory[_0xc749('0x3d')]())[_0xc749('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0xc749('0x1e')](cmHopperHistory[_0xc749('0x3e')]())[_0xc749('0x1e')](realtime[_0xc749('0x3f')]())[_0xc749('0x1e')](voiceCallReport[_0xc749('0x40')]())[_0xc749('0x1e')](realtime[_0xc749('0x41')]())['catch'](function(_0x342459){logger['error'](_0xc749('0x42'),util[_0xc749('0x43')](_0x342459,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xc749('0x1e')](function(_0x286786){return initRealtime();})[_0xc749('0x1e')](function(){return initParams();})['then'](function(){report[_0xc749('0x44')]();setInterval(initRealtime,0x1388);})[_0xc749('0x45')](function(_0x4191af){logger[_0xc749('0x46')]('[index.js][main]',util['inspect'](_0x4191af,{'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 13e6582..0eed7bf 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x46917f,_0x24e037){var _0x355f8f=function(_0x2e4aa3){while(--_0x2e4aa3){_0x46917f['push'](_0x46917f['shift']());}};_0x355f8f(++_0x24e037);}(_0x70e0,0x17b));var _0x070e=function(_0x27d682,_0x1aaa3e){_0x27d682=_0x27d682-0x0;var _0x182c4a=_0x70e0[_0x27d682];return _0x182c4a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x23f294,_0x57f182){var _0x5a15a9=function(_0x5f183a){while(--_0x5f183a){_0x23f294['push'](_0x23f294['shift']());}};_0x5a15a9(++_0x57f182);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0xcb91[_0x3b711c];return _0x2685f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 39250fb..6519c07 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 _0x9f42=['SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval'];(function(_0x2ac3f7,_0x50e025){var _0x2d84a3=function(_0x57ca8a){while(--_0x57ca8a){_0x2ac3f7['push'](_0x2ac3f7['shift']());}};_0x2d84a3(++_0x50e025);}(_0x9f42,0x10c));var _0x29f4=function(_0x5c524e,_0x4f07dc){_0x5c524e=_0x5c524e-0x0;var _0x49ffd1=_0x9f42[_0x5c524e];return _0x49ffd1;};'use strict';function Campaign(_0x499dc1){this['id']=_0x499dc1['id']||0x0;this[_0x29f4('0x0')]=_0x499dc1[_0x29f4('0x0')]||'';this[_0x29f4('0x1')]=_0x499dc1[_0x29f4('0x1')]||_0x29f4('0x2');this[_0x29f4('0x3')]=0x0;this[_0x29f4('0x4')]=0x0;this[_0x29f4('0x5')]=0x0;this[_0x29f4('0x6')]=0x0;this[_0x29f4('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x29f4('0x8')]=_0x499dc1['active'];this['limitCalls']=_0x499dc1['limitCalls'];this['dialTimezone']=_0x499dc1[_0x29f4('0x9')]||null;this[_0x29f4('0xa')]=_0x499dc1[_0x29f4('0xa')]?_0x499dc1[_0x29f4('0xa')]:null;this[_0x29f4('0xb')]=_0x499dc1[_0x29f4('0xb')];this['dialOriginateCallerIdNumber']=_0x499dc1[_0x29f4('0xc')];this['dialOriginateTimeout']=_0x499dc1[_0x29f4('0xd')]||0x1e;this[_0x29f4('0xe')]=_0x499dc1['dialCongestionMaxRetry'];this[_0x29f4('0xf')]=_0x499dc1[_0x29f4('0xf')];this[_0x29f4('0x10')]=_0x499dc1['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x499dc1[_0x29f4('0x11')];this[_0x29f4('0x12')]=_0x499dc1['dialNoAnswerMaxRetry'];this[_0x29f4('0x13')]=_0x499dc1[_0x29f4('0x13')];this[_0x29f4('0x14')]=_0x499dc1['dialGlobalMaxRetry'];this[_0x29f4('0x15')]=_0x499dc1['dialNoSuchNumberMaxRetry']||0x3;this[_0x29f4('0x16')]=_0x499dc1['dialNoSuchNumberRetryFrequency']||0x96;this[_0x29f4('0x17')]=_0x499dc1['dialDropMaxRetry']||0x3;this[_0x29f4('0x18')]=_0x499dc1['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x499dc1[_0x29f4('0x19')]||0x3;this[_0x29f4('0x1a')]=_0x499dc1[_0x29f4('0x1a')]||0x96;this[_0x29f4('0x1b')]=_0x499dc1[_0x29f4('0x1b')]||0x3;this[_0x29f4('0x1c')]=_0x499dc1[_0x29f4('0x1c')]||0x96;this[_0x29f4('0x1d')]=_0x499dc1[_0x29f4('0x1d')]||0x3;this[_0x29f4('0x1e')]=_0x499dc1[_0x29f4('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x499dc1['dialOrderByScheduledAt']||_0x29f4('0x1f');this[_0x29f4('0x20')]=_0x499dc1[_0x29f4('0x20')]||undefined;this[_0x29f4('0x21')]=_0x499dc1[_0x29f4('0x21')]||undefined;this[_0x29f4('0x22')]=_0x499dc1[_0x29f4('0x22')]||undefined;this[_0x29f4('0x23')]=_0x499dc1[_0x29f4('0x23')]?_0x499dc1[_0x29f4('0x23')]:undefined;this[_0x29f4('0x24')]=_0x499dc1[_0x29f4('0x24')]?_0x499dc1[_0x29f4('0x24')]:undefined;this['Interval']=_0x499dc1[_0x29f4('0x25')]?_0x499dc1[_0x29f4('0x25')]:undefined;this['SquareProject']=_0x499dc1[_0x29f4('0x26')]?_0x499dc1[_0x29f4('0x26')]:undefined;this[_0x29f4('0x27')]=_0x499dc1['SquareProject']?_0x499dc1[_0x29f4('0x26')][_0x29f4('0x0')]:undefined;this[_0x29f4('0x28')]=_0x499dc1[_0x29f4('0x28')]||![];this['dialAMDInitialSilence']=_0x499dc1[_0x29f4('0x29')];this[_0x29f4('0x2a')]=_0x499dc1[_0x29f4('0x2a')];this[_0x29f4('0x2b')]=_0x499dc1['dialAMDAfterGreetingSilence'];this[_0x29f4('0x2c')]=_0x499dc1['dialAMDTotalAnalysisTime'];this[_0x29f4('0x2d')]=_0x499dc1['dialAMDMinWordLength'];this[_0x29f4('0x2e')]=_0x499dc1[_0x29f4('0x2e')];this[_0x29f4('0x2f')]=_0x499dc1[_0x29f4('0x2f')];this[_0x29f4('0x30')]=_0x499dc1['dialAMDSilenceThreshold'];this[_0x29f4('0x31')]=_0x499dc1[_0x29f4('0x31')];}module[_0x29f4('0x32')]=Campaign; \ No newline at end of file +var _0xd3ac=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3ac,0x17d));var _0xcd3a=function(_0x7934ec,_0x5f44eb){_0x7934ec=_0x7934ec-0x0;var _0x52d9f8=_0xd3ac[_0x7934ec];return _0x52d9f8;};'use strict';function Campaign(_0x4c4ffc){this['id']=_0x4c4ffc['id']||0x0;this[_0xcd3a('0x0')]=_0x4c4ffc[_0xcd3a('0x0')]||'';this['type']=_0x4c4ffc[_0xcd3a('0x1')]||_0xcd3a('0x2');this[_0xcd3a('0x3')]=0x0;this[_0xcd3a('0x4')]=0x0;this[_0xcd3a('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xcd3a('0x6')]='';this[_0xcd3a('0x7')]=!![];this['active']=_0x4c4ffc[_0xcd3a('0x8')];this[_0xcd3a('0x9')]=_0x4c4ffc[_0xcd3a('0x9')];this['dialTimezone']=_0x4c4ffc[_0xcd3a('0xa')]||null;this[_0xcd3a('0xb')]=_0x4c4ffc[_0xcd3a('0xb')]?_0x4c4ffc[_0xcd3a('0xb')]:null;this[_0xcd3a('0xc')]=_0x4c4ffc[_0xcd3a('0xc')];this['dialOriginateCallerIdNumber']=_0x4c4ffc[_0xcd3a('0xd')];this[_0xcd3a('0xe')]=_0x4c4ffc[_0xcd3a('0xe')]||0x1e;this[_0xcd3a('0xf')]=_0x4c4ffc['dialCongestionMaxRetry'];this[_0xcd3a('0x10')]=_0x4c4ffc[_0xcd3a('0x10')];this['dialBusyMaxRetry']=_0x4c4ffc[_0xcd3a('0x11')];this[_0xcd3a('0x12')]=_0x4c4ffc[_0xcd3a('0x12')];this[_0xcd3a('0x13')]=_0x4c4ffc[_0xcd3a('0x13')];this[_0xcd3a('0x14')]=_0x4c4ffc[_0xcd3a('0x14')];this[_0xcd3a('0x15')]=_0x4c4ffc['dialGlobalMaxRetry'];this[_0xcd3a('0x16')]=_0x4c4ffc[_0xcd3a('0x16')]||0x3;this[_0xcd3a('0x17')]=_0x4c4ffc['dialNoSuchNumberRetryFrequency']||0x96;this[_0xcd3a('0x18')]=_0x4c4ffc[_0xcd3a('0x18')]||0x3;this[_0xcd3a('0x19')]=_0x4c4ffc[_0xcd3a('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x4c4ffc['dialAbandonedMaxRetry']||0x3;this[_0xcd3a('0x1a')]=_0x4c4ffc[_0xcd3a('0x1a')]||0x96;this[_0xcd3a('0x1b')]=_0x4c4ffc['dialMachineMaxRetry']||0x3;this[_0xcd3a('0x1c')]=_0x4c4ffc[_0xcd3a('0x1c')]||0x96;this[_0xcd3a('0x1d')]=_0x4c4ffc[_0xcd3a('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4c4ffc[_0xcd3a('0x1e')]||0x96;this[_0xcd3a('0x1f')]=_0x4c4ffc[_0xcd3a('0x1f')]||_0xcd3a('0x20');this[_0xcd3a('0x21')]=_0x4c4ffc[_0xcd3a('0x21')]||undefined;this[_0xcd3a('0x22')]=_0x4c4ffc[_0xcd3a('0x22')]||undefined;this['dialCutDigit']=_0x4c4ffc[_0xcd3a('0x23')]||undefined;this[_0xcd3a('0x24')]=_0x4c4ffc[_0xcd3a('0x24')]?_0x4c4ffc[_0xcd3a('0x24')]:undefined;this[_0xcd3a('0x25')]=_0x4c4ffc[_0xcd3a('0x25')]?_0x4c4ffc[_0xcd3a('0x25')]:undefined;this['Interval']=_0x4c4ffc[_0xcd3a('0x26')]?_0x4c4ffc[_0xcd3a('0x26')]:undefined;this[_0xcd3a('0x27')]=_0x4c4ffc[_0xcd3a('0x27')]?_0x4c4ffc[_0xcd3a('0x27')]:undefined;this['dialQueueProject']=_0x4c4ffc['SquareProject']?_0x4c4ffc[_0xcd3a('0x27')][_0xcd3a('0x0')]:undefined;this[_0xcd3a('0x28')]=_0x4c4ffc[_0xcd3a('0x28')]||![];this[_0xcd3a('0x29')]=_0x4c4ffc['dialAMDInitialSilence'];this[_0xcd3a('0x2a')]=_0x4c4ffc[_0xcd3a('0x2a')];this[_0xcd3a('0x2b')]=_0x4c4ffc['dialAMDAfterGreetingSilence'];this[_0xcd3a('0x2c')]=_0x4c4ffc['dialAMDTotalAnalysisTime'];this[_0xcd3a('0x2d')]=_0x4c4ffc[_0xcd3a('0x2d')];this[_0xcd3a('0x2e')]=_0x4c4ffc['dialAMDBetweenWordsSilence'];this[_0xcd3a('0x2f')]=_0x4c4ffc['dialAMDMaximumNumberOfWords'];this[_0xcd3a('0x30')]=_0x4c4ffc[_0xcd3a('0x30')];this[_0xcd3a('0x31')]=_0x4c4ffc[_0xcd3a('0x31')];}module[_0xcd3a('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 0767e76..eb0a8d0 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 _0x707b=['linkedid','exten','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','accountcode','context','uniqueid'];(function(_0x1af97d,_0x28daf7){var _0x588362=function(_0x5ceb2f){while(--_0x5ceb2f){_0x1af97d['push'](_0x1af97d['shift']());}};_0x588362(++_0x28daf7);}(_0x707b,0xdf));var _0xb707=function(_0x47fa10,_0x39b01c){_0x47fa10=_0x47fa10-0x0;var _0x204f30=_0x707b[_0x47fa10];return _0x204f30;};'use strict';function Channel(){this[_0xb707('0x0')]=null;this[_0xb707('0x1')]='';this[_0xb707('0x2')]='';this['calleridnum']=0x0;this[_0xb707('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xb707('0x4')]=0x0;this[_0xb707('0x5')]='';this[_0xb707('0x6')]=0x0;this[_0xb707('0x7')]=0x0;this[_0xb707('0x8')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0xb707('0x9')]=![];this[_0xb707('0xa')]=![];this[_0xb707('0xb')]='';this[_0xb707('0xc')]='';this['duration']=0x0;this[_0xb707('0xd')]=0x0;this[_0xb707('0xe')]=0x0;this['type']=null;this['tag']=null;this['disposition']=null;this[_0xb707('0xf')]=![];this['monitorFilename']=null;this[_0xb707('0x10')]=null;this[_0xb707('0x11')]=[];this[_0xb707('0x12')]=undefined;this[_0xb707('0x13')]=undefined;this[_0xb707('0x14')]=undefined;this[_0xb707('0x15')]=0x0;}module[_0xb707('0x16')]=Channel; \ No newline at end of file +var _0xdc5d=['monitorFilename','queue','transferconnectedlinenum','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','exten','answered','endtime','abandoned','lastapplication','billableseconds','holdtime','type','tag','disposition','monitor'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0xdc5d,0x14d));var _0xddc5=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xdc5d[_0x999b85];return _0x1d7124;};'use strict';function Channel(){this[_0xddc5('0x0')]=null;this[_0xddc5('0x1')]='';this[_0xddc5('0x2')]='';this[_0xddc5('0x3')]=0x0;this[_0xddc5('0x4')]='';this[_0xddc5('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xddc5('0x6')]=0x0;this[_0xddc5('0x7')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0xddc5('0x8')]=0x0;this[_0xddc5('0x9')]=![];this['answertime']=null;this[_0xddc5('0xa')]=null;this['unmanaged']=![];this[_0xddc5('0xb')]=![];this[_0xddc5('0xc')]='';this['lastdata']='';this['duration']=0x0;this[_0xddc5('0xd')]=0x0;this[_0xddc5('0xe')]=0x0;this[_0xddc5('0xf')]=null;this[_0xddc5('0x10')]=null;this[_0xddc5('0x11')]=null;this[_0xddc5('0x12')]=![];this[_0xddc5('0x13')]=null;this[_0xddc5('0x14')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0xddc5('0x15')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 950ec49..fbc8860 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 _0x34b0=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x19e3a4,_0x2f28ca){var _0x142b55=function(_0x53e37b){while(--_0x53e37b){_0x19e3a4['push'](_0x19e3a4['shift']());}};_0x142b55(++_0x2f28ca);}(_0x34b0,0x7f));var _0x034b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x34b0[_0x20a584];return _0x4b41a8;};'use strict';function DeskAccount(_0x2ddc63){this['id']=_0x2ddc63['id']||0x0;this[_0x034b('0x0')]=_0x2ddc63[_0x034b('0x0')]||'';this[_0x034b('0x1')]=_0x2ddc63[_0x034b('0x1')]||'';this[_0x034b('0x2')]=_0x2ddc63[_0x034b('0x2')]||'';this['authType']=_0x2ddc63[_0x034b('0x3')]||'';this[_0x034b('0x4')]=_0x2ddc63['password']||'';this[_0x034b('0x5')]=_0x2ddc63[_0x034b('0x5')]||'';this[_0x034b('0x6')]=_0x2ddc63['consumerSecret']||'';this['token']=_0x2ddc63[_0x034b('0x7')]||'';this[_0x034b('0x8')]=_0x2ddc63[_0x034b('0x8')]||'';this['type']=_0x2ddc63[_0x034b('0x9')]||'';this[_0x034b('0xa')]=_0x2ddc63[_0x034b('0xa')]||'';this[_0x034b('0xb')]=_0x2ddc63[_0x034b('0xb')]||{};}module[_0x034b('0xc')]=DeskAccount; \ No newline at end of file +var _0x5c2a=['consumerKey','token','tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5c2a,0x89));var _0xa5c2=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0x5c2a[_0x3b1e3f];return _0x3b1cd3;};'use strict';function DeskAccount(_0x20a136){this['id']=_0x20a136['id']||0x0;this['name']=_0x20a136['name']||'';this['username']=_0x20a136[_0xa5c2('0x0')]||'';this[_0xa5c2('0x1')]=_0x20a136[_0xa5c2('0x1')]||'';this[_0xa5c2('0x2')]=_0x20a136[_0xa5c2('0x2')]||'';this['password']=_0x20a136['password']||'';this[_0xa5c2('0x3')]=_0x20a136[_0xa5c2('0x3')]||'';this['consumerSecret']=_0x20a136['consumerSecret']||'';this['token']=_0x20a136[_0xa5c2('0x4')]||'';this[_0xa5c2('0x5')]=_0x20a136[_0xa5c2('0x5')]||'';this[_0xa5c2('0x6')]=_0x20a136[_0xa5c2('0x6')]||'';this[_0xa5c2('0x7')]=_0x20a136[_0xa5c2('0x7')]||'';this[_0xa5c2('0x8')]=_0x20a136[_0xa5c2('0x8')]||{};}module[_0xa5c2('0x9')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 47ad4f5..24a743b 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 _0xb43b=['Configurations','exports','name','username','password','remoteUri','tenantId','clientSecret','serverUrl'];(function(_0x5e1358,_0x51fa66){var _0x4a16a6=function(_0x7fd22c){while(--_0x7fd22c){_0x5e1358['push'](_0x5e1358['shift']());}};_0x4a16a6(++_0x51fa66);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5cfc53,_0x20b989){_0x5cfc53=_0x5cfc53-0x0;var _0x21fec6=_0xb43b[_0x5cfc53];return _0x21fec6;};'use strict';function Dynamics365Account(_0x2ee678){this['id']=_0x2ee678['id']||0x0;this[_0xbb43('0x0')]=_0x2ee678['name']||'';this[_0xbb43('0x1')]=_0x2ee678[_0xbb43('0x1')]||'';this[_0xbb43('0x2')]=_0x2ee678['password']||'';this[_0xbb43('0x3')]=_0x2ee678[_0xbb43('0x3')]||'';this[_0xbb43('0x4')]=_0x2ee678[_0xbb43('0x4')]||'';this['clientId']=_0x2ee678['clientId']||'';this[_0xbb43('0x5')]=_0x2ee678['clientSecret']||{};this[_0xbb43('0x6')]=_0x2ee678[_0xbb43('0x6')]||'';this[_0xbb43('0x7')]=_0x2ee678[_0xbb43('0x7')]||{};}module[_0xbb43('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xf7b4=['Configurations','exports','username','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x510bef,_0x45d98e){var _0x5af891=function(_0x477668){while(--_0x477668){_0x510bef['push'](_0x510bef['shift']());}};_0x5af891(++_0x45d98e);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5d68c,_0x384051){_0x5d68c=_0x5d68c-0x0;var _0x4038e5=_0xf7b4[_0x5d68c];return _0x4038e5;};'use strict';function Dynamics365Account(_0x4e182d){this['id']=_0x4e182d['id']||0x0;this['name']=_0x4e182d['name']||'';this[_0x4f7b('0x0')]=_0x4e182d[_0x4f7b('0x0')]||'';this['password']=_0x4e182d['password']||'';this[_0x4f7b('0x1')]=_0x4e182d[_0x4f7b('0x1')]||'';this[_0x4f7b('0x2')]=_0x4e182d[_0x4f7b('0x2')]||'';this[_0x4f7b('0x3')]=_0x4e182d[_0x4f7b('0x3')]||'';this[_0x4f7b('0x4')]=_0x4e182d[_0x4f7b('0x4')]||{};this[_0x4f7b('0x5')]=_0x4e182d[_0x4f7b('0x5')]||'';this[_0x4f7b('0x6')]=_0x4e182d[_0x4f7b('0x6')]||{};}module[_0x4f7b('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 2c1248f..6870b35 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 _0xd85e=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','headerinfo','localstationid','maxrate','modem'];(function(_0x19b63f,_0x5aa47d){var _0x53ca6a=function(_0x17eba6){while(--_0x17eba6){_0x19b63f['push'](_0x19b63f['shift']());}};_0x53ca6a(++_0x5aa47d);}(_0xd85e,0x72));var _0xed85=function(_0x325bb6,_0x3a1811){_0x325bb6=_0x325bb6-0x0;var _0x1f0a86=_0xd85e[_0x325bb6];return _0x1f0a86;};'use strict';function FaxAccount(_0x286388){this['id']=_0x286388['id']||0x0;this[_0xed85('0x0')]=_0x286388[_0xed85('0x0')]||'';this[_0xed85('0x1')]=_0x286388['description'];this['ecm']=_0x286388['ecm'];this['headerinfo']=_0x286388[_0xed85('0x2')];this[_0xed85('0x3')]=_0x286388['localstationid'];this['minrate']=_0x286388['minrate']||0x960;this[_0xed85('0x4')]=_0x286388[_0xed85('0x4')]||0x3840;this['modem']=_0x286388[_0xed85('0x5')]||_0xed85('0x6');this[_0xed85('0x7')]=_0x286388['gateway']||'no';this[_0xed85('0x8')]=_0x286388['faxdetect']||'no';this['t38timeout']=_0x286388[_0xed85('0x9')]||0x1388;this[_0xed85('0xa')]=_0x286388[_0xed85('0xa')]||'SIP';this['Trunk']=_0x286388[_0xed85('0xb')]?_0x286388['Trunk']:undefined;this[_0xed85('0xc')]=_0x286388['ListId'];this[_0xed85('0xd')]=_0x286388[_0xed85('0xd')];}module[_0xed85('0xe')]=FaxAccount; \ No newline at end of file +var _0xee9d=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','ListId'];(function(_0x3fa7bd,_0x4710d1){var _0x1f3a7c=function(_0x165373){while(--_0x165373){_0x3fa7bd['push'](_0x3fa7bd['shift']());}};_0x1f3a7c(++_0x4710d1);}(_0xee9d,0x12d));var _0xdee9=function(_0x2e2077,_0x27a94c){_0x2e2077=_0x2e2077-0x0;var _0x2aac87=_0xee9d[_0x2e2077];return _0x2aac87;};'use strict';function FaxAccount(_0x54824a){this['id']=_0x54824a['id']||0x0;this[_0xdee9('0x0')]=_0x54824a[_0xdee9('0x0')]||'';this[_0xdee9('0x1')]=_0x54824a['description'];this[_0xdee9('0x2')]=_0x54824a[_0xdee9('0x2')];this['headerinfo']=_0x54824a[_0xdee9('0x3')];this['localstationid']=_0x54824a[_0xdee9('0x4')];this['minrate']=_0x54824a[_0xdee9('0x5')]||0x960;this[_0xdee9('0x6')]=_0x54824a[_0xdee9('0x6')]||0x3840;this[_0xdee9('0x7')]=_0x54824a['modem']||'v17,v27,v29';this[_0xdee9('0x8')]=_0x54824a[_0xdee9('0x8')]||'no';this[_0xdee9('0x9')]=_0x54824a[_0xdee9('0x9')]||'no';this['t38timeout']=_0x54824a[_0xdee9('0xa')]||0x1388;this[_0xdee9('0xb')]=_0x54824a[_0xdee9('0xb')]||_0xdee9('0xc');this['Trunk']=_0x54824a['Trunk']?_0x54824a['Trunk']:undefined;this[_0xdee9('0xd')]=_0x54824a[_0xdee9('0xd')];this['key']=_0x54824a['key'];}module[_0xdee9('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index d1eec99..7521fb7 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 _0xfb34=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xfb34,0x1ed));var _0x4fb3=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xfb34[_0x3fe6df];return _0x372a0e;};'use strict';function FreshdeskAccount(_0x87cc73){this['id']=_0x87cc73['id']||0x0;this[_0x4fb3('0x0')]=_0x87cc73[_0x4fb3('0x0')]||'';this[_0x4fb3('0x1')]=_0x87cc73[_0x4fb3('0x1')]||'';this[_0x4fb3('0x2')]=_0x87cc73[_0x4fb3('0x3')]||'';this[_0x4fb3('0x4')]=_0x87cc73[_0x4fb3('0x4')]||'';this[_0x4fb3('0x5')]=_0x87cc73['serverUrl']||'';this[_0x4fb3('0x6')]=_0x87cc73[_0x4fb3('0x6')]||{};}module[_0x4fb3('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x7c0f=['token','remoteUri','Configurations','exports','name','username','apiKey'];(function(_0x1fd450,_0x42cbf6){var _0x4cb0a5=function(_0x1384d4){while(--_0x1384d4){_0x1fd450['push'](_0x1fd450['shift']());}};_0x4cb0a5(++_0x42cbf6);}(_0x7c0f,0x1d9));var _0xf7c0=function(_0x31d0ae,_0x5099ea){_0x31d0ae=_0x31d0ae-0x0;var _0x3039c2=_0x7c0f[_0x31d0ae];return _0x3039c2;};'use strict';function FreshdeskAccount(_0x44df66){this['id']=_0x44df66['id']||0x0;this[_0xf7c0('0x0')]=_0x44df66[_0xf7c0('0x0')]||'';this[_0xf7c0('0x1')]=_0x44df66[_0xf7c0('0x1')]||'';this[_0xf7c0('0x2')]=_0x44df66[_0xf7c0('0x3')]||'';this[_0xf7c0('0x4')]=_0x44df66[_0xf7c0('0x4')]||'';this['serverUrl']=_0x44df66['serverUrl']||'';this[_0xf7c0('0x5')]=_0x44df66[_0xf7c0('0x5')]||{};}module[_0xf7c0('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 35d8df1..2498ca8 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 _0x35d0=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x297d6f,_0x12c8be){var _0x4e0852=function(_0x37780e){while(--_0x37780e){_0x297d6f['push'](_0x297d6f['shift']());}};_0x4e0852(++_0x12c8be);}(_0x35d0,0xf9));var _0x035d=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x35d0[_0x3239f5];return _0x3559c8;};'use strict';function FreshsalesAccount(_0x5dadff){this['id']=_0x5dadff['id']||0x0;this[_0x035d('0x0')]=_0x5dadff['name']||'';this[_0x035d('0x1')]=_0x5dadff[_0x035d('0x1')]||'';this[_0x035d('0x2')]=_0x5dadff[_0x035d('0x3')]||'';this[_0x035d('0x4')]=_0x5dadff[_0x035d('0x4')]||'';this['serverUrl']=_0x5dadff[_0x035d('0x5')]||'';this[_0x035d('0x6')]=_0x5dadff[_0x035d('0x6')]||{};}module[_0x035d('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x49c4=['exports','name','username','apiKey','token','remoteUri','Configurations'];(function(_0x5b6aa8,_0x1f206a){var _0x5d7da4=function(_0x5a39b0){while(--_0x5a39b0){_0x5b6aa8['push'](_0x5b6aa8['shift']());}};_0x5d7da4(++_0x1f206a);}(_0x49c4,0x9b));var _0x449c=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x49c4[_0x18ab2a];return _0x16dcee;};'use strict';function FreshsalesAccount(_0x342c0b){this['id']=_0x342c0b['id']||0x0;this['name']=_0x342c0b[_0x449c('0x0')]||'';this[_0x449c('0x1')]=_0x342c0b[_0x449c('0x1')]||'';this[_0x449c('0x2')]=_0x342c0b[_0x449c('0x3')]||'';this[_0x449c('0x4')]=_0x342c0b[_0x449c('0x4')]||'';this['serverUrl']=_0x342c0b['serverUrl']||'';this[_0x449c('0x5')]=_0x342c0b[_0x449c('0x5')]||{};}module[_0x449c('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 004e341..771e205 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 _0xd3db=['queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','exten','holdtime','assigned','lastAssignedTo','voice','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xd3db,0x199));var _0xbd3d=function(_0x1820c5,_0x5368fb){_0x1820c5=_0x1820c5-0x0;var _0x163d38=_0xd3db[_0x1820c5];return _0x163d38;};'use strict';function QueueReport(){this[_0xbd3d('0x0')]=_0xbd3d('0x1');this[_0xbd3d('0x2')]='';this[_0xbd3d('0x3')]='';this[_0xbd3d('0x4')]='';this[_0xbd3d('0x5')]='';this[_0xbd3d('0x6')]=null;this[_0xbd3d('0x7')]=null;this[_0xbd3d('0x8')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0xbd3d('0x9')]=null;this[_0xbd3d('0xa')]=![];this[_0xbd3d('0xb')]=null;this['queuecallerexit']=![];this[_0xbd3d('0xc')]=null;this[_0xbd3d('0xd')]=0x1;this['channel']='';this[_0xbd3d('0xe')]='';this[_0xbd3d('0xf')]='';this['accountcode']='';this['context']='';this[_0xbd3d('0x10')]='';this['priority']='';this[_0xbd3d('0x11')]=0x0;this[_0xbd3d('0x12')]=![];this[_0xbd3d('0x13')]='';this['motionChannel']=_0xbd3d('0x14');this[_0xbd3d('0x15')]=0x0;this['variables']={};}module[_0xbd3d('0x16')]=QueueReport; \ No newline at end of file +var _0x77a8=['connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','position','count','queuecallercomplete','queuecallercompleteAt','originalposition','channel'];(function(_0x4f4f6a,_0x5ad62d){var _0x357c33=function(_0x18995d){while(--_0x18995d){_0x4f4f6a['push'](_0x4f4f6a['shift']());}};_0x357c33(++_0x5ad62d);}(_0x77a8,0xe5));var _0x877a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77a8[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0x877a('0x0')]='inbound';this[_0x877a('0x1')]='';this[_0x877a('0x2')]='';this[_0x877a('0x3')]='';this[_0x877a('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x877a('0x5')]=0x1;this[_0x877a('0x6')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x877a('0x7')]=![];this[_0x877a('0x8')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x877a('0x9')]=0x1;this[_0x877a('0xa')]='';this[_0x877a('0xb')]='';this[_0x877a('0xc')]='';this[_0x877a('0xd')]='';this[_0x877a('0xe')]='';this['exten']='';this[_0x877a('0xf')]='';this[_0x877a('0x10')]=0x0;this[_0x877a('0x11')]=![];this[_0x877a('0x12')]='';this[_0x877a('0x13')]=_0x877a('0x14');this[_0x877a('0x15')]=0x0;this[_0x877a('0x16')]={};}module[_0x877a('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index a5d96c3..0e49edd 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 _0x3cdd=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x1051b2,_0x21810e){var _0x4b302b=function(_0x4d7d0a){while(--_0x4d7d0a){_0x1051b2['push'](_0x1051b2['shift']());}};_0x4b302b(++_0x21810e);}(_0x3cdd,0xb5));var _0xd3cd=function(_0x516414,_0x3fda1c){_0x516414=_0x516414-0x0;var _0x1aaa21=_0x3cdd[_0x516414];return _0x1aaa21;};'use strict';function SalesforceAccount(_0x52f0d3){this['id']=_0x52f0d3['id']||0x0;this[_0xd3cd('0x0')]=_0x52f0d3[_0xd3cd('0x0')]||'';this[_0xd3cd('0x1')]=_0x52f0d3['username']||'';this['remoteUri']=_0x52f0d3[_0xd3cd('0x2')]||'';this[_0xd3cd('0x3')]=_0x52f0d3[_0xd3cd('0x3')]||'';this[_0xd3cd('0x4')]=_0x52f0d3['clientId']||'';this['clientSecret']=_0x52f0d3[_0xd3cd('0x5')]||'';this[_0xd3cd('0x6')]=_0x52f0d3['securityToken']||'';this[_0xd3cd('0x7')]=_0x52f0d3[_0xd3cd('0x7')]||_0xd3cd('0x8');this[_0xd3cd('0x9')]=_0x52f0d3[_0xd3cd('0x9')]||'';this[_0xd3cd('0xa')]=_0x52f0d3[_0xd3cd('0xa')]||{};}module[_0xd3cd('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x54cc=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54cc,0xa0));var _0xc54c=function(_0x2e016c,_0x8f371f){_0x2e016c=_0x2e016c-0x0;var _0x24e0ef=_0x54cc[_0x2e016c];return _0x24e0ef;};'use strict';function SalesforceAccount(_0x40809a){this['id']=_0x40809a['id']||0x0;this['name']=_0x40809a[_0xc54c('0x0')]||'';this[_0xc54c('0x1')]=_0x40809a['username']||'';this[_0xc54c('0x2')]=_0x40809a[_0xc54c('0x2')]||'';this['password']=_0x40809a[_0xc54c('0x3')]||'';this[_0xc54c('0x4')]=_0x40809a[_0xc54c('0x4')]||'';this[_0xc54c('0x5')]=_0x40809a[_0xc54c('0x5')]||'';this[_0xc54c('0x6')]=_0x40809a[_0xc54c('0x6')]||'';this[_0xc54c('0x7')]=_0x40809a[_0xc54c('0x7')]||_0xc54c('0x8');this[_0xc54c('0x9')]=_0x40809a['serverUrl']||'';this[_0xc54c('0xa')]=_0x40809a[_0xc54c('0xa')]||{};}module[_0xc54c('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ed035f3..194fe6d 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 _0xedc1=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2087e4,_0x34d318){var _0x5bb608=function(_0x8e7f3c){while(--_0x8e7f3c){_0x2087e4['push'](_0x2087e4['shift']());}};_0x5bb608(++_0x34d318);}(_0xedc1,0x1ab));var _0x1edc=function(_0x15482e,_0x25b23c){_0x15482e=_0x15482e-0x0;var _0x4a0651=_0xedc1[_0x15482e];return _0x4a0651;};'use strict';function ServicenowAccount(_0xce1ddd){this['id']=_0xce1ddd['id']||0x0;this['name']=_0xce1ddd[_0x1edc('0x0')]||'';this['username']=_0xce1ddd[_0x1edc('0x1')]||'';this['password']=_0xce1ddd[_0x1edc('0x2')]||'';this[_0x1edc('0x3')]=_0xce1ddd[_0x1edc('0x3')]||'';this[_0x1edc('0x4')]=_0xce1ddd[_0x1edc('0x4')]||'';this['Configurations']=_0xce1ddd[_0x1edc('0x5')]||{};}module[_0x1edc('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x2606=['remoteUri','serverUrl','Configurations','username','password'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2606,0x111));var _0x6260=function(_0x5982b6,_0xfe1c77){_0x5982b6=_0x5982b6-0x0;var _0x53baed=_0x2606[_0x5982b6];return _0x53baed;};'use strict';function ServicenowAccount(_0x398a70){this['id']=_0x398a70['id']||0x0;this['name']=_0x398a70['name']||'';this[_0x6260('0x0')]=_0x398a70[_0x6260('0x0')]||'';this[_0x6260('0x1')]=_0x398a70['password']||'';this[_0x6260('0x2')]=_0x398a70[_0x6260('0x2')]||'';this[_0x6260('0x3')]=_0x398a70[_0x6260('0x3')]||'';this['Configurations']=_0x398a70[_0x6260('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 0a62b80..ce6d902 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 _0x6618=['name','username','password','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6618,0xb8));var _0x8661=function(_0x2bed54,_0xd54293){_0x2bed54=_0x2bed54-0x0;var _0x7c3ae6=_0x6618[_0x2bed54];return _0x7c3ae6;};'use strict';function SugarcrmAccount(_0x3f77aa){this['id']=_0x3f77aa['id']||0x0;this[_0x8661('0x0')]=_0x3f77aa[_0x8661('0x0')]||'';this[_0x8661('0x1')]=_0x3f77aa[_0x8661('0x1')]||'';this[_0x8661('0x2')]=_0x3f77aa['password']||'';this[_0x8661('0x3')]=_0x3f77aa['remoteUri']||'';this['serverUrl']=_0x3f77aa['serverUrl']||'';this['Configurations']=_0x3f77aa['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x0b05=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4a2957,_0x40aa65){var _0x3e5184=function(_0x218e4e){while(--_0x218e4e){_0x4a2957['push'](_0x4a2957['shift']());}};_0x3e5184(++_0x40aa65);}(_0x0b05,0x8e));var _0x50b0=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x0b05[_0x173d7e];return _0x2220d6;};'use strict';function SugarcrmAccount(_0x5ca697){this['id']=_0x5ca697['id']||0x0;this[_0x50b0('0x0')]=_0x5ca697[_0x50b0('0x0')]||'';this[_0x50b0('0x1')]=_0x5ca697['username']||'';this[_0x50b0('0x2')]=_0x5ca697[_0x50b0('0x2')]||'';this['remoteUri']=_0x5ca697[_0x50b0('0x3')]||'';this[_0x50b0('0x4')]=_0x5ca697[_0x50b0('0x4')]||'';this['Configurations']=_0x5ca697[_0x50b0('0x5')]||{};}module[_0x50b0('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 93a48c7..87d9cc0 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 _0x6aa4=['address','exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x115a45,_0x375a9d){var _0x289dd9=function(_0x136649){while(--_0x136649){_0x115a45['push'](_0x115a45['shift']());}};_0x289dd9(++_0x375a9d);}(_0x6aa4,0xb2));var _0x46aa=function(_0x4453a4,_0xca002c){_0x4453a4=_0x4453a4-0x0;var _0x15f835=_0x6aa4[_0x4453a4];return _0x15f835;};'use strict';function Telephone(_0x24790f){this['id']=_0x24790f['id']||0x0;this[_0x46aa('0x0')]=_0x24790f[_0x46aa('0x0')]||'';this['accountcode']=_0x24790f[_0x46aa('0x1')]||'';this[_0x46aa('0x2')]=_0x46aa('0x3');this[_0x46aa('0x4')]=0x0;this[_0x46aa('0x5')]=_0x46aa('0x3');this[_0x46aa('0x6')]='';}module[_0x46aa('0x7')]=Telephone; \ No newline at end of file +var _0x2e1d=['name','accountcode','stateTime','status','address'];(function(_0x250b6e,_0x56b70f){var _0x36eed8=function(_0x4d3a31){while(--_0x4d3a31){_0x250b6e['push'](_0x250b6e['shift']());}};_0x36eed8(++_0x56b70f);}(_0x2e1d,0xc8));var _0xd2e1=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0x2e1d[_0x1b2255];return _0x33e57d;};'use strict';function Telephone(_0x7f6227){this['id']=_0x7f6227['id']||0x0;this[_0xd2e1('0x0')]=_0x7f6227[_0xd2e1('0x0')]||'';this[_0xd2e1('0x1')]=_0x7f6227[_0xd2e1('0x1')]||'';this['state']='unknown';this[_0xd2e1('0x2')]=0x0;this[_0xd2e1('0x3')]='unknown';this[_0xd2e1('0x4')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f04ebc0..eee964f 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(_0xc9bde2,_0x49e3ec){var _0x4a468d=function(_0x57714a){while(--_0x57714a){_0xc9bde2['push'](_0xc9bde2['shift']());}};_0x4a468d(++_0x49e3ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x4a7ffb,_0x178890){var _0x48cf9b=function(_0x340143){while(--_0x340143){_0x4a7ffb['push'](_0x4a7ffb['shift']());}};_0x48cf9b(++_0x178890);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ecc30,_0x75412b){_0x3ecc30=_0x3ecc30-0x0;var _0x2682bc=_0xb10b[_0x3ecc30];return _0x2682bc;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 8793d7f..a1cf7a0 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x52286f,_0x235214){var _0x2b2c86=function(_0x432992){while(--_0x432992){_0x52286f['push'](_0x52286f['shift']());}};_0x2b2c86(++_0x235214);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b63a0,_0x14fc48){_0x2b63a0=_0x2b63a0-0x0;var _0x4f0434=_0xb10b[_0x2b63a0];return _0x4f0434;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1a85,0x178));var _0x51a8=function(_0x4882dc,_0x1a6680){_0x4882dc=_0x4882dc-0x0;var _0x45257f=_0x1a85[_0x4882dc];return _0x45257f;};'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 5d40886..99fb1f6 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 _0x7057=['registry','indexOf','split','host','port','domainport','refresh','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status'];(function(_0x2e137e,_0x3ec457){var _0x2d92ac=function(_0x59afcf){while(--_0x59afcf){_0x2e137e['push'](_0x2e137e['shift']());}};_0x2d92ac(++_0x3ec457);}(_0x7057,0x12a));var _0x7705=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7057[_0x199572];return _0x13cfa3;};'use strict';function Trunk(_0x4396de){this['id']=_0x4396de['id']||0x0;this[_0x7705('0x0')]=_0x4396de['active']||![];this[_0x7705('0x1')]=_0x4396de[_0x7705('0x1')]||'';this[_0x7705('0x2')]=_0x7705('0x3');this[_0x7705('0x4')]=0x0;this[_0x7705('0x5')]=_0x7705('0x3');this[_0x7705('0x6')]=_0x4396de[_0x7705('0x6')]&&_0x4396de[_0x7705('0x6')][_0x7705('0x7')](':')?_0x4396de[_0x7705('0x6')][_0x7705('0x8')](':')[0x0]:'';this[_0x7705('0x9')]='';this[_0x7705('0xa')]='';this['domain']='';this[_0x7705('0xb')]='';this[_0x7705('0xc')]='';this['stateRegistry']=_0x7705('0x3');this[_0x7705('0xd')]='';this[_0x7705('0xe')]='';this[_0x7705('0xf')]=_0x4396de[_0x7705('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x9d92=['defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','domain','refresh','registrationtime'];(function(_0x144d9c,_0x3ec497){var _0x54db44=function(_0x11bbc3){while(--_0x11bbc3){_0x144d9c['push'](_0x144d9c['shift']());}};_0x54db44(++_0x3ec497);}(_0x9d92,0x77));var _0x29d9=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x9d92[_0x585133];return _0x18254a;};'use strict';function Trunk(_0x11ad66){this['id']=_0x11ad66['id']||0x0;this[_0x29d9('0x0')]=_0x11ad66[_0x29d9('0x0')]||![];this['name']=_0x11ad66[_0x29d9('0x1')]||'';this['state']=_0x29d9('0x2');this[_0x29d9('0x3')]=0x0;this[_0x29d9('0x4')]='unknown';this[_0x29d9('0x5')]=_0x11ad66[_0x29d9('0x5')]&&_0x11ad66['registry'][_0x29d9('0x6')](':')?_0x11ad66[_0x29d9('0x5')][_0x29d9('0x7')](':')[0x0]:'';this['host']='';this['port']='';this[_0x29d9('0x8')]='';this['domainport']='';this[_0x29d9('0x9')]='';this['stateRegistry']=_0x29d9('0x2');this[_0x29d9('0xa')]='';this['address']='';this[_0x29d9('0xb')]=_0x11ad66[_0x29d9('0xb')]||'';}module[_0x29d9('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 230c7d3..185461d 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 _0x12a3=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x12a3,0x83));var _0x312a=function(_0xc0c9b4,_0x5a2bb0){_0xc0c9b4=_0xc0c9b4-0x0;var _0x375b9f=_0x12a3[_0xc0c9b4];return _0x375b9f;};'use strict';function voiceExtension(_0x5920ad){this['id']=_0x5920ad['id']||0x0;this[_0x312a('0x0')]=_0x5920ad[_0x312a('0x0')]||'';this['recordingFormat']=_0x5920ad[_0x312a('0x1')]||'none';this[_0x312a('0x2')]=_0x5920ad[_0x312a('0x2')]||![];}module[_0x312a('0x3')]=voiceExtension; \ No newline at end of file +var _0x7d15=['none','exten','recordingFormat'];(function(_0x2bcdc2,_0x3ecddb){var _0x5eff6f=function(_0x202fff){while(--_0x202fff){_0x2bcdc2['push'](_0x2bcdc2['shift']());}};_0x5eff6f(++_0x3ecddb);}(_0x7d15,0x9d));var _0x57d1=function(_0x1a24c9,_0x135d98){_0x1a24c9=_0x1a24c9-0x0;var _0xb33490=_0x7d15[_0x1a24c9];return _0xb33490;};'use strict';function voiceExtension(_0x5c7b4d){this['id']=_0x5c7b4d['id']||0x0;this[_0x57d1('0x0')]=_0x5c7b4d[_0x57d1('0x0')]||'';this[_0x57d1('0x1')]=_0x5c7b4d['recordingFormat']||_0x57d1('0x2');this['mandatoryDisposition']=_0x5c7b4d['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index faab6af..aa865b2 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 _0x5ae7=['dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','unavailable','ringing','ringinuse','onhold','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate'];(function(_0x29dda1,_0x508e13){var _0x21b0ef=function(_0x118906){while(--_0x118906){_0x29dda1['push'](_0x29dda1['shift']());}};_0x21b0ef(++_0x508e13);}(_0x5ae7,0x140));var _0x75ae=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x5ae7[_0x2aec52];return _0x3b8835;};'use strict';var statusDesc=[_0x75ae('0x0'),'not_inuse',_0x75ae('0x1'),'busy',_0x75ae('0x2'),_0x75ae('0x3'),_0x75ae('0x4'),_0x75ae('0x5'),_0x75ae('0x6')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x75ae('0x7')};var strategy={'rrmemory':_0x75ae('0x8'),'roundrobin':_0x75ae('0x9')};function VoiceQueue(_0x16797d){this['id']=_0x16797d['id']||0x0;this[_0x75ae('0xa')]=_0x16797d[_0x75ae('0xa')]||'';this[_0x75ae('0xb')]=_0x16797d[_0x75ae('0xb')]||'';this[_0x75ae('0xc')]=_0x16797d[_0x75ae('0xc')]||'inbound';this[_0x75ae('0xd')]=0x0;this[_0x75ae('0xe')]=0x0;this[_0x75ae('0xf')]=0x0;this['answered']=0x0;this[_0x75ae('0x10')]=0x0;this[_0x75ae('0x11')]=0x0;this[_0x75ae('0x12')]=0x0;this['unmanaged']=0x0;this[_0x75ae('0x13')]=0x0;this[_0x75ae('0x14')]=0x0;this[_0x75ae('0x15')]=0x0;this[_0x75ae('0x16')]=_0x16797d[_0x75ae('0x16')]||![];this['acwTimeout']=_0x16797d[_0x75ae('0x17')]||0xa;this[_0x75ae('0x18')]=_0x16797d['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x75ae('0x19')]='';this[_0x75ae('0x1a')]=0x0;this['temp']=0x0;this[_0x75ae('0x1b')]=_0x16797d[_0x75ae('0x1b')]||null;this[_0x75ae('0x1c')]=_0x16797d[_0x75ae('0x1c')]?_0x16797d[_0x75ae('0x1c')]:null;this[_0x75ae('0x1d')]=_0x16797d[_0x75ae('0x1d')];this['dialMethod']=_0x16797d[_0x75ae('0x1e')]||_0x75ae('0x1f');this[_0x75ae('0x20')]=_0x16797d[_0x75ae('0x20')]||0x0;this[_0x75ae('0x21')]=_0x16797d['dialLimitQueue']||0x0;this[_0x75ae('0x22')]=_0x16797d[_0x75ae('0x22')]||0x1;this[_0x75ae('0x23')]=_0x16797d[_0x75ae('0x23')]||_0x75ae('0x24');this[_0x75ae('0x25')]=_0x16797d[_0x75ae('0x25')]||0.03;this[_0x75ae('0x26')]=_0x16797d[_0x75ae('0x26')]||0x258;this[_0x75ae('0x27')]=_0x16797d[_0x75ae('0x27')]||_0x75ae('0x28');this['dialOriginateCallerIdNumber']=_0x16797d[_0x75ae('0x29')]||_0x75ae('0x28');this[_0x75ae('0x2a')]=_0x16797d['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x16797d[_0x75ae('0x2b')]||'tTxX';this['dialQueueTimeout']=_0x16797d['dialQueueTimeout']||0x3;this[_0x75ae('0x2c')]=_0x16797d[_0x75ae('0x2c')]||undefined;this[_0x75ae('0x2d')]=_0x16797d[_0x75ae('0x2d')]||0x3;this[_0x75ae('0x2e')]=_0x16797d[_0x75ae('0x2e')]||0x96;this[_0x75ae('0x2f')]=_0x16797d[_0x75ae('0x2f')]||0x3;this[_0x75ae('0x30')]=_0x16797d['dialBusyRetryFrequency']||0x96;this[_0x75ae('0x31')]=_0x16797d[_0x75ae('0x31')]||0x3;this[_0x75ae('0x32')]=_0x16797d[_0x75ae('0x32')]||0x96;this[_0x75ae('0x33')]=_0x16797d['dialNoSuchNumberMaxRetry']||0x3;this[_0x75ae('0x34')]=_0x16797d[_0x75ae('0x34')]||0x96;this[_0x75ae('0x35')]=_0x16797d[_0x75ae('0x35')]||0x3;this[_0x75ae('0x36')]=_0x16797d[_0x75ae('0x36')]||0x96;this['dialAbandonedMaxRetry']=_0x16797d['dialAbandonedMaxRetry']||0x3;this[_0x75ae('0x37')]=_0x16797d[_0x75ae('0x37')]||0x96;this[_0x75ae('0x38')]=_0x16797d[_0x75ae('0x38')]||0x3;this[_0x75ae('0x39')]=_0x16797d[_0x75ae('0x39')]||0x96;this[_0x75ae('0x3a')]=_0x16797d['dialAgentRejectMaxRetry']||0x3;this[_0x75ae('0x3b')]=_0x16797d[_0x75ae('0x3b')]||0x96;this[_0x75ae('0x3c')]=_0x16797d[_0x75ae('0x3c')]||0x4;this['Trunk']=_0x16797d['Trunk']?_0x16797d[_0x75ae('0x3d')]:undefined;this[_0x75ae('0x3e')]=_0x16797d['TrunkBackup']?_0x16797d[_0x75ae('0x3e')]:undefined;this[_0x75ae('0x3f')]=_0x16797d[_0x75ae('0x3f')]||undefined;this[_0x75ae('0x40')]=_0x16797d[_0x75ae('0x40')]?_0x16797d[_0x75ae('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x16797d[_0x75ae('0x41')]||'DESC';this[_0x75ae('0x42')]=_0x16797d[_0x75ae('0x42')]||undefined;this['dialCutDigit']=_0x16797d[_0x75ae('0x43')]||undefined;this[_0x75ae('0x44')]=strategy[_0x16797d['strategy']]||_0x75ae('0x8');this[_0x75ae('0x45')]=!![];this[_0x75ae('0x46')]=_0x16797d[_0x75ae('0x46')]||![];this[_0x75ae('0x47')]=_0x16797d[_0x75ae('0x47')];this['dialAMDGreeting']=_0x16797d[_0x75ae('0x48')];this['dialAMDAfterGreetingSilence']=_0x16797d['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x16797d[_0x75ae('0x49')];this[_0x75ae('0x4a')]=_0x16797d[_0x75ae('0x4a')];this[_0x75ae('0x4b')]=_0x16797d[_0x75ae('0x4b')];this['dialAMDMaximumNumberOfWords']=_0x16797d[_0x75ae('0x4c')];this[_0x75ae('0x4d')]=_0x16797d[_0x75ae('0x4d')];this[_0x75ae('0x4e')]=_0x16797d['dialAMDMaximumWordLength'];this[_0x75ae('0x4f')]=0x0;this[_0x75ae('0x50')]=0x0;this[_0x75ae('0x51')]=_0x16797d[_0x75ae('0x51')];this[_0x75ae('0x52')]=0x0;this[_0x75ae('0x53')]=0x0;this[_0x75ae('0x54')]=0x0;this[_0x75ae('0x55')]=0x0;this[_0x75ae('0x56')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x75ae('0x57')]=0x0;this[_0x75ae('0x58')]=0x0;this[_0x75ae('0x59')]=0x0;this[_0x75ae('0x5a')]=0x0;this[_0x75ae('0x5b')]=0x0;this[_0x75ae('0x5c')]=0x0;this[_0x75ae('0x5d')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x75ae('0x5e')]=undefined;this['handlePredictive']=undefined;this[_0x75ae('0x5f')]=1.05;this[_0x75ae('0x60')]=0x0;this[_0x75ae('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x75ae('0x62')]=0x0;this[_0x75ae('0x63')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x75ae('0x64')]=0x0;this[_0x75ae('0x65')]=0x0;this[_0x75ae('0x66')]=_0x16797d[_0x75ae('0x67')]||0x14;this['predictiveIntervalMinThreshold']=_0x16797d['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x75ae('0x68')]=0x0;this[_0x75ae('0x69')]=0x0;this[_0x75ae('0x6a')]=0x1;this[_0x75ae('0x6b')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x75ae('0x6c')]=0x0;this[_0x75ae('0x6d')]=_0x16797d[_0x75ae('0x6d')]||0x1e;this[_0x75ae('0x6e')]=_0x16797d[_0x75ae('0x6e')]||![];this[_0x75ae('0x6f')]=!!_0x16797d['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x16797d[_0x75ae('0x70')]||![];this[_0x75ae('0x71')]=_0x16797d[_0x75ae('0x71')]||undefined;this[_0x75ae('0x72')]=_0x16797d[_0x75ae('0x72')]||![];this[_0x75ae('0x73')]=_0x16797d[_0x75ae('0x73')]||![];this[_0x75ae('0xb')]=monitorFormat[_0x16797d['monitor_format']]?monitorFormat[_0x16797d[_0x75ae('0xb')]]:undefined;this[_0x75ae('0x74')]=_0x16797d['mandatoryDisposition']||![];this[_0x75ae('0x75')]=_0x16797d[_0x75ae('0x75')]?_0x16797d[_0x75ae('0x75')]:undefined;}module[_0x75ae('0x76')]=VoiceQueue; \ No newline at end of file +var _0x176c=['mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent'];(function(_0x18e875,_0x54fff7){var _0x1643c6=function(_0x5f09ff){while(--_0x5f09ff){_0x18e875['push'](_0x18e875['shift']());}};_0x1643c6(++_0x54fff7);}(_0x176c,0x1f2));var _0xc176=function(_0x324f8f,_0x17b42e){_0x324f8f=_0x324f8f-0x0;var _0xd1c094=_0x176c[_0x324f8f];return _0xd1c094;};'use strict';var statusDesc=[_0xc176('0x0'),_0xc176('0x1'),_0xc176('0x2'),_0xc176('0x3'),_0xc176('0x4'),_0xc176('0x5'),_0xc176('0x6'),_0xc176('0x7'),_0xc176('0x8')];var monitorFormat={'wav':_0xc176('0x9'),'wav49':_0xc176('0xa'),'gsm':_0xc176('0xb')};var strategy={'rrmemory':_0xc176('0xc'),'roundrobin':_0xc176('0xd')};function VoiceQueue(_0x459727){this['id']=_0x459727['id']||0x0;this['name']=_0x459727[_0xc176('0xe')]||'';this[_0xc176('0xf')]=_0x459727[_0xc176('0xf')]||'';this[_0xc176('0x10')]=_0x459727[_0xc176('0x10')]||_0xc176('0x11');this['waiting']=0x0;this[_0xc176('0x12')]=0x0;this[_0xc176('0x13')]=0x0;this[_0xc176('0x14')]=0x0;this[_0xc176('0x15')]=0x0;this[_0xc176('0x16')]=0x0;this[_0xc176('0x17')]=0x0;this[_0xc176('0x18')]=0x0;this['abandoned']=0x0;this[_0xc176('0x19')]=0x0;this['available']=0x0;this[_0xc176('0x1a')]=_0x459727[_0xc176('0x1a')]||![];this[_0xc176('0x1b')]=_0x459727[_0xc176('0x1b')]||0xa;this['autopause']=_0x459727[_0xc176('0x1c')]||'no';this[_0xc176('0x1d')]=!![];this[_0xc176('0x1e')]='';this[_0xc176('0x1f')]=0x0;this[_0xc176('0x20')]=0x0;this['dialTimezone']=_0x459727['dialTimezone']||null;this['dialGlobalInterval']=_0x459727[_0xc176('0x21')]?_0x459727[_0xc176('0x21')]:null;this[_0xc176('0x22')]=_0x459727['dialActive'];this[_0xc176('0x23')]=_0x459727[_0xc176('0x23')]||_0xc176('0x24');this['dialLimitChannel']=_0x459727[_0xc176('0x25')]||0x0;this[_0xc176('0x26')]=_0x459727[_0xc176('0x26')]||0x0;this[_0xc176('0x27')]=_0x459727[_0xc176('0x27')]||0x1;this['dialPredictiveOptimization']=_0x459727[_0xc176('0x28')]||_0xc176('0x29');this[_0xc176('0x2a')]=_0x459727[_0xc176('0x2a')]||0.03;this[_0xc176('0x2b')]=_0x459727[_0xc176('0x2b')]||0x258;this[_0xc176('0x2c')]=_0x459727[_0xc176('0x2c')]||_0xc176('0x2d');this[_0xc176('0x2e')]=_0x459727[_0xc176('0x2e')]||_0xc176('0x2d');this[_0xc176('0x2f')]=_0x459727['dialOriginateTimeout']||0x1e;this[_0xc176('0x30')]=_0x459727[_0xc176('0x30')]||'tTxX';this['dialQueueTimeout']=_0x459727['dialQueueTimeout']||0x3;this[_0xc176('0x31')]=_0x459727[_0xc176('0x31')]||undefined;this[_0xc176('0x32')]=_0x459727[_0xc176('0x32')]||0x3;this['dialCongestionRetryFrequency']=_0x459727['dialCongestionRetryFrequency']||0x96;this[_0xc176('0x33')]=_0x459727['dialBusyMaxRetry']||0x3;this[_0xc176('0x34')]=_0x459727['dialBusyRetryFrequency']||0x96;this[_0xc176('0x35')]=_0x459727[_0xc176('0x35')]||0x3;this[_0xc176('0x36')]=_0x459727[_0xc176('0x36')]||0x96;this[_0xc176('0x37')]=_0x459727['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x459727[_0xc176('0x38')]||0x96;this['dialDropMaxRetry']=_0x459727['dialDropMaxRetry']||0x3;this[_0xc176('0x39')]=_0x459727[_0xc176('0x39')]||0x96;this[_0xc176('0x3a')]=_0x459727[_0xc176('0x3a')]||0x3;this[_0xc176('0x3b')]=_0x459727[_0xc176('0x3b')]||0x96;this[_0xc176('0x3c')]=_0x459727['dialMachineMaxRetry']||0x3;this[_0xc176('0x3d')]=_0x459727[_0xc176('0x3d')]||0x96;this[_0xc176('0x3e')]=_0x459727[_0xc176('0x3e')]||0x3;this[_0xc176('0x3f')]=_0x459727[_0xc176('0x3f')]||0x96;this[_0xc176('0x40')]=_0x459727[_0xc176('0x40')]||0x4;this['Trunk']=_0x459727[_0xc176('0x41')]?_0x459727[_0xc176('0x41')]:undefined;this[_0xc176('0x42')]=_0x459727[_0xc176('0x42')]?_0x459727[_0xc176('0x42')]:undefined;this['dialPrefix']=_0x459727[_0xc176('0x43')]||undefined;this[_0xc176('0x44')]=_0x459727['Interval']?_0x459727['Interval']:undefined;this[_0xc176('0x45')]=_0x459727['dialOrderByScheduledAt']||'DESC';this[_0xc176('0x46')]=_0x459727[_0xc176('0x46')]||undefined;this[_0xc176('0x47')]=_0x459727[_0xc176('0x47')]||undefined;this[_0xc176('0x48')]=strategy[_0x459727[_0xc176('0x48')]]||'rrmemory';this[_0xc176('0x49')]=!![];this[_0xc176('0x4a')]=_0x459727[_0xc176('0x4a')]||![];this[_0xc176('0x4b')]=_0x459727['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x459727[_0xc176('0x4c')];this[_0xc176('0x4d')]=_0x459727[_0xc176('0x4d')];this[_0xc176('0x4e')]=_0x459727[_0xc176('0x4e')];this['dialAMDMinWordLength']=_0x459727['dialAMDMinWordLength'];this[_0xc176('0x4f')]=_0x459727['dialAMDBetweenWordsSilence'];this[_0xc176('0x50')]=_0x459727['dialAMDMaximumNumberOfWords'];this[_0xc176('0x51')]=_0x459727['dialAMDSilenceThreshold'];this[_0xc176('0x52')]=_0x459727[_0xc176('0x52')];this[_0xc176('0x53')]=0x0;this[_0xc176('0x54')]=0x0;this[_0xc176('0x55')]=_0x459727[_0xc176('0x55')];this[_0xc176('0x56')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xc176('0x57')]=0x0;this[_0xc176('0x58')]=0x0;this[_0xc176('0x59')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xc176('0x5a')]=0x0;this[_0xc176('0x5b')]=0x0;this[_0xc176('0x5c')]=0x0;this[_0xc176('0x5d')]=0x0;this[_0xc176('0x5e')]=0x0;this[_0xc176('0x5f')]=0x0;this[_0xc176('0x60')]=0x0;this[_0xc176('0x61')]=undefined;this[_0xc176('0x62')]=undefined;this[_0xc176('0x63')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xc176('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xc176('0x65')]=0x0;this[_0xc176('0x66')]=0x0;this[_0xc176('0x67')]=0x0;this[_0xc176('0x68')]=0x0;this[_0xc176('0x69')]=0x0;this[_0xc176('0x6a')]=_0x459727['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xc176('0x6b')]=_0x459727[_0xc176('0x6c')]||0xa;this[_0xc176('0x6d')]=0x0;this[_0xc176('0x6e')]=0x0;this[_0xc176('0x6f')]=0x1;this[_0xc176('0x70')]=0x0;this[_0xc176('0x71')]=0x0;this[_0xc176('0x72')]=0x0;this[_0xc176('0x73')]=0x0;this['dialRecallMeTimeout']=_0x459727[_0xc176('0x74')]||0x1e;this[_0xc176('0x75')]=_0x459727['dialRecallInQueue']||![];this[_0xc176('0x76')]=!!_0x459727[_0xc176('0x76')]||![];this[_0xc176('0x77')]=!!_0x459727[_0xc176('0x77')]||![];this['dialQueueProject2']=_0x459727['dialQueueProject2']||undefined;this[_0xc176('0x78')]=_0x459727[_0xc176('0x78')]||![];this[_0xc176('0x79')]=_0x459727[_0xc176('0x79')]||![];this['monitor_format']=monitorFormat[_0x459727[_0xc176('0xf')]]?monitorFormat[_0x459727['monitor_format']]:undefined;this[_0xc176('0x7a')]=_0x459727[_0xc176('0x7a')]||![];this['mandatoryDispositionPause']=_0x459727[_0xc176('0x7b')]?_0x459727['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 32ac5a4..ca56167 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 _0x30b8=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x3bc31,_0x13a7a2){var _0x3762d1=function(_0x138fbd){while(--_0x138fbd){_0x3bc31['push'](_0x3bc31['shift']());}};_0x3762d1(++_0x13a7a2);}(_0x30b8,0x10b));var _0x830b=function(_0x32100e,_0x143db0){_0x32100e=_0x32100e-0x0;var _0x2e8081=_0x30b8[_0x32100e];return _0x2e8081;};'use strict';function VtigerAccount(_0x301aa4){this['id']=_0x301aa4['id']||0x0;this['name']=_0x301aa4[_0x830b('0x0')]||'';this[_0x830b('0x1')]=_0x301aa4[_0x830b('0x1')]||'';this[_0x830b('0x2')]=_0x301aa4[_0x830b('0x2')]||'';this[_0x830b('0x3')]=_0x301aa4['remoteUri']||'';this['serverUrl']=_0x301aa4[_0x830b('0x4')]||'';this[_0x830b('0x5')]=_0x301aa4[_0x830b('0x5')]||{};}module[_0x830b('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb2e9=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x55b75e,_0x23e1dc){var _0x1909b1=function(_0x4152ed){while(--_0x4152ed){_0x55b75e['push'](_0x55b75e['shift']());}};_0x1909b1(++_0x23e1dc);}(_0xb2e9,0x1a2));var _0x9b2e=function(_0x2d6121,_0x2c8056){_0x2d6121=_0x2d6121-0x0;var _0x2c18ae=_0xb2e9[_0x2d6121];return _0x2c18ae;};'use strict';function VtigerAccount(_0x3373fc){this['id']=_0x3373fc['id']||0x0;this[_0x9b2e('0x0')]=_0x3373fc[_0x9b2e('0x0')]||'';this[_0x9b2e('0x1')]=_0x3373fc['username']||'';this[_0x9b2e('0x2')]=_0x3373fc['accessKey']||'';this[_0x9b2e('0x3')]=_0x3373fc['remoteUri']||'';this[_0x9b2e('0x4')]=_0x3373fc[_0x9b2e('0x4')]||'';this[_0x9b2e('0x5')]=_0x3373fc['Configurations']||{};}module[_0x9b2e('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index be2ed9b..8b68995 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 _0x8afb=['name','password','remoteUri','authType','type','serverUrl','Configurations','exports'];(function(_0x39428c,_0x34b23a){var _0x52d069=function(_0x394962){while(--_0x394962){_0x39428c['push'](_0x39428c['shift']());}};_0x52d069(++_0x34b23a);}(_0x8afb,0xa8));var _0xb8af=function(_0x51e7d8,_0x56d4d4){_0x51e7d8=_0x51e7d8-0x0;var _0x27b10e=_0x8afb[_0x51e7d8];return _0x27b10e;};'use strict';function ZendeskAccount(_0x39c5cc){this['id']=_0x39c5cc['id']||0x0;this[_0xb8af('0x0')]=_0x39c5cc[_0xb8af('0x0')]||'';this['username']=_0x39c5cc['username']||'';this[_0xb8af('0x1')]=_0x39c5cc[_0xb8af('0x1')]||'';this['token']=_0x39c5cc['token']||'';this[_0xb8af('0x2')]=_0x39c5cc[_0xb8af('0x2')]||'';this[_0xb8af('0x3')]=_0x39c5cc[_0xb8af('0x3')]||'';this[_0xb8af('0x4')]=_0x39c5cc[_0xb8af('0x4')]||'integrationTab';this['serverUrl']=_0x39c5cc[_0xb8af('0x5')]||'';this[_0xb8af('0x6')]=_0x39c5cc['Configurations']||{};}module[_0xb8af('0x7')]=ZendeskAccount; \ No newline at end of file +var _0xb0fe=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x488818,_0x17c6de){var _0x30783c=function(_0x1b418c){while(--_0x1b418c){_0x488818['push'](_0x488818['shift']());}};_0x30783c(++_0x17c6de);}(_0xb0fe,0xd8));var _0xeb0f=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xb0fe[_0x380307];return _0x9ea14b;};'use strict';function ZendeskAccount(_0x2fa63c){this['id']=_0x2fa63c['id']||0x0;this[_0xeb0f('0x0')]=_0x2fa63c[_0xeb0f('0x0')]||'';this[_0xeb0f('0x1')]=_0x2fa63c['username']||'';this['password']=_0x2fa63c['password']||'';this[_0xeb0f('0x2')]=_0x2fa63c[_0xeb0f('0x2')]||'';this[_0xeb0f('0x3')]=_0x2fa63c[_0xeb0f('0x3')]||'';this[_0xeb0f('0x4')]=_0x2fa63c[_0xeb0f('0x4')]||'';this[_0xeb0f('0x5')]=_0x2fa63c['type']||_0xeb0f('0x6');this[_0xeb0f('0x7')]=_0x2fa63c[_0xeb0f('0x7')]||'';this[_0xeb0f('0x8')]=_0x2fa63c['Configurations']||{};}module[_0xeb0f('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 0d8ae79..2e3fe56 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 _0x54e1=['refreshToken','Configurations','exports','name','description','host','clientId','clientSecret','code'];(function(_0x417b1a,_0x3cfce5){var _0x1e41af=function(_0xe2e44e){while(--_0xe2e44e){_0x417b1a['push'](_0x417b1a['shift']());}};_0x1e41af(++_0x3cfce5);}(_0x54e1,0x66));var _0x154e=function(_0x3526a3,_0x1d2792){_0x3526a3=_0x3526a3-0x0;var _0x3ddfd6=_0x54e1[_0x3526a3];return _0x3ddfd6;};'use strict';function ZohoAccount(_0x216b39){this['id']=_0x216b39['id']||0x0;this['name']=_0x216b39[_0x154e('0x0')]||'';this['description']=_0x216b39[_0x154e('0x1')]||'';this[_0x154e('0x2')]=_0x216b39['host']||'';this['zone']=_0x216b39['zone']||'';this[_0x154e('0x3')]=_0x216b39[_0x154e('0x3')]||'';this[_0x154e('0x4')]=_0x216b39['clientSecret']||'';this['serverUrl']=_0x216b39['serverUrl']||'';this['code']=_0x216b39[_0x154e('0x5')]||'';this['refreshToken']=_0x216b39[_0x154e('0x6')]||'';this[_0x154e('0x7')]=_0x216b39[_0x154e('0x7')]||{};}module[_0x154e('0x8')]=ZohoAccount; \ No newline at end of file +var _0x8822=['code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x494368,_0x56d9a3){var _0x1491a3=function(_0x81e189){while(--_0x81e189){_0x494368['push'](_0x494368['shift']());}};_0x1491a3(++_0x56d9a3);}(_0x8822,0x1b1));var _0x2882=function(_0x584a41,_0x260f62){_0x584a41=_0x584a41-0x0;var _0x3226ca=_0x8822[_0x584a41];return _0x3226ca;};'use strict';function ZohoAccount(_0x330284){this['id']=_0x330284['id']||0x0;this['name']=_0x330284[_0x2882('0x0')]||'';this['description']=_0x330284[_0x2882('0x1')]||'';this[_0x2882('0x2')]=_0x330284['host']||'';this[_0x2882('0x3')]=_0x330284[_0x2882('0x3')]||'';this[_0x2882('0x4')]=_0x330284[_0x2882('0x4')]||'';this[_0x2882('0x5')]=_0x330284[_0x2882('0x5')]||'';this[_0x2882('0x6')]=_0x330284[_0x2882('0x6')]||'';this[_0x2882('0x7')]=_0x330284[_0x2882('0x7')]||'';this['refreshToken']=_0x330284[_0x2882('0x8')]||'';this[_0x2882('0x9')]=_0x330284[_0x2882('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 80deecb..8cd2f9b 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 _0x1e19=['queue','type','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','phone','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0x48181d,_0x42e154){var _0x514544=function(_0xe69612){while(--_0xe69612){_0x48181d['push'](_0x48181d['shift']());}};_0x514544(++_0x42e154);}(_0x1e19,0x161));var _0x91e1=function(_0x2897cd,_0x30b5de){_0x2897cd=_0x2897cd-0x0;var _0x25f1c8=_0x1e19[_0x2897cd];return _0x25f1c8;};'use strict';var util=require(_0x91e1('0x0'));var _=require(_0x91e1('0x1'));var moment=require(_0x91e1('0x2'));function checkNameSurname(_0xe59b5e,_0x43c0da,_0x18b855){var _0xc25a2a='';if(!_[_0x91e1('0x3')](_0x43c0da)&&_0x91e1('0x4')===typeof _0x43c0da){_0xc25a2a+=_0x43c0da;}if(!_[_0x91e1('0x3')](_0x18b855)&&'string'===typeof _0x18b855){_0xc25a2a+='\x20'+_0x18b855;}if(_0xc25a2a!==''){return _0xc25a2a;}return _0xe59b5e;}function Action(_0x1f5fa5,_0x66b584,_0x454f3e,_0x5d9687,_0x4842e3){this[_0x91e1('0x5')]=_0x454f3e||undefined;this[_0x91e1('0x6')]=_0x1f5fa5['id'];this[_0x91e1('0x7')]=_0x66b584['name'];this[_0x91e1('0x8')]=_0x66b584['type'];this['campaigntype']='queue';this[_0x91e1('0x9')]=![];this[_0x91e1('0xa')]=_[_0x91e1('0x3')](_0x1f5fa5[_0x91e1('0xb')])?undefined:_0x1f5fa5[_0x91e1('0xb')][_0x91e1('0xc')];this[_0x91e1('0xd')]=this[_0x91e1('0xa')]?util[_0x91e1('0xe')](_0x91e1('0xf'),this['membername']):_0x5d9687||undefined;this['calleridname']=checkNameSurname(_0x1f5fa5['Contact'][_0x91e1('0x10')],_0x1f5fa5[_0x91e1('0x11')]['firstName'],_0x1f5fa5[_0x91e1('0x11')][_0x91e1('0x12')]);this[_0x91e1('0x13')]=_0x1f5fa5[_0x91e1('0x13')]||![];this[_0x91e1('0x14')]=_0x1f5fa5[_0x91e1('0x11')][_0x91e1('0x10')];this[_0x91e1('0x15')]=_0x1f5fa5['scheduledat'];this[_0x91e1('0x16')]=_0x1f5fa5[_0x91e1('0x16')]||0x0;this[_0x91e1('0x17')]=_0x1f5fa5[_0x91e1('0x17')]||0x0;this[_0x91e1('0x18')]=_0x1f5fa5[_0x91e1('0x18')]||0x0;this['countglobal']=(_0x1f5fa5[_0x91e1('0x16')]||0x0)+(_0x1f5fa5[_0x91e1('0x17')]||0x0)+(_0x1f5fa5['countnoanswerretry']||0x0)+(_0x1f5fa5['countnosuchnumberretry']||0x0)+(_0x1f5fa5[_0x91e1('0x19')]||0x0)+(_0x1f5fa5[_0x91e1('0x1a')]||0x0)+(_0x1f5fa5['countmachineretry']||0x0)+(_0x1f5fa5[_0x91e1('0x1b')]||0x0);this[_0x91e1('0x1c')]=_0x1f5fa5[_0x91e1('0x1c')]||0x0;this[_0x91e1('0x19')]=_0x1f5fa5[_0x91e1('0x19')]||0x0;this[_0x91e1('0x1a')]=_0x1f5fa5['countabandonedretry']||0x0;this[_0x91e1('0x1d')]=_0x1f5fa5['countmachineretry']||0x0;this['countagentrejectretry']=_0x1f5fa5[_0x91e1('0x1b')]||0x0;this[_0x91e1('0x1e')]=_0x1f5fa5['callback'];this[_0x91e1('0x1f')]=_0x1f5fa5[_0x91e1('0x1f')];this['callbackat']=_0x1f5fa5[_0x91e1('0x20')];this[_0x91e1('0x21')]=_0x1f5fa5['recallme'];this[_0x91e1('0x22')]=_0x1f5fa5[_0x91e1('0x22')];this[_0x91e1('0x23')]=_0x1f5fa5[_0x91e1('0x23')];this[_0x91e1('0x24')]=_[_0x91e1('0x3')](_0x1f5fa5[_0x91e1('0xb')])?_0x1f5fa5[_0x91e1('0x24')]:_0x1f5fa5['Agent']['id'];this[_0x91e1('0x25')]=_0x1f5fa5['VoiceQueueId'];this[_0x91e1('0x26')]='';this[_0x91e1('0x27')]='';}Action[_0x91e1('0x28')]['getCaller']=function(){return util['format'](_0x91e1('0x29'),this[_0x91e1('0x2a')],this[_0x91e1('0x2b')]);};module[_0x91e1('0x2c')]=Action; \ No newline at end of file +var _0xba4e=['prototype','getCaller','number','util','lodash','isNil','string','uniqueid','idContact','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0x3b2adc,_0xf1df7d){var _0x44bfe6=function(_0x4fa034){while(--_0x4fa034){_0x3b2adc['push'](_0x3b2adc['shift']());}};_0x44bfe6(++_0xf1df7d);}(_0xba4e,0x129));var _0xeba4=function(_0x946bb2,_0xbdde84){_0x946bb2=_0x946bb2-0x0;var _0x40d752=_0xba4e[_0x946bb2];return _0x40d752;};'use strict';var util=require(_0xeba4('0x0'));var _=require(_0xeba4('0x1'));var moment=require('moment');function checkNameSurname(_0x4a552b,_0x399fc2,_0x535623){var _0x5029b7='';if(!_[_0xeba4('0x2')](_0x399fc2)&&_0xeba4('0x3')===typeof _0x399fc2){_0x5029b7+=_0x399fc2;}if(!_[_0xeba4('0x2')](_0x535623)&&_0xeba4('0x3')===typeof _0x535623){_0x5029b7+='\x20'+_0x535623;}if(_0x5029b7!==''){return _0x5029b7;}return _0x4a552b;}function Action(_0x3a1354,_0x478b37,_0x323bcf,_0x125531,_0x4978a0){this[_0xeba4('0x4')]=_0x323bcf||undefined;this[_0xeba4('0x5')]=_0x3a1354['id'];this['queue']=_0x478b37[_0xeba4('0x6')];this[_0xeba4('0x7')]=_0x478b37[_0xeba4('0x7')];this[_0xeba4('0x8')]='queue';this[_0xeba4('0x9')]=![];this[_0xeba4('0xa')]=_['isNil'](_0x3a1354['Agent'])?undefined:_0x3a1354[_0xeba4('0xb')][_0xeba4('0x6')];this[_0xeba4('0xc')]=this[_0xeba4('0xa')]?util[_0xeba4('0xd')]('SIP/%s',this[_0xeba4('0xa')]):_0x125531||undefined;this[_0xeba4('0xe')]=checkNameSurname(_0x3a1354[_0xeba4('0xf')][_0xeba4('0x10')],_0x3a1354[_0xeba4('0xf')][_0xeba4('0x11')],_0x3a1354[_0xeba4('0xf')][_0xeba4('0x12')]);this['active']=_0x3a1354[_0xeba4('0x13')]||![];this['calleridnum']=_0x3a1354[_0xeba4('0xf')][_0xeba4('0x10')];this[_0xeba4('0x14')]=_0x3a1354[_0xeba4('0x14')];this[_0xeba4('0x15')]=_0x3a1354['countbusyretry']||0x0;this[_0xeba4('0x16')]=_0x3a1354[_0xeba4('0x16')]||0x0;this[_0xeba4('0x17')]=_0x3a1354[_0xeba4('0x17')]||0x0;this[_0xeba4('0x18')]=(_0x3a1354[_0xeba4('0x15')]||0x0)+(_0x3a1354[_0xeba4('0x16')]||0x0)+(_0x3a1354[_0xeba4('0x17')]||0x0)+(_0x3a1354['countnosuchnumberretry']||0x0)+(_0x3a1354['countdropretry']||0x0)+(_0x3a1354[_0xeba4('0x19')]||0x0)+(_0x3a1354['countmachineretry']||0x0)+(_0x3a1354[_0xeba4('0x1a')]||0x0);this['countnosuchnumberretry']=_0x3a1354[_0xeba4('0x1b')]||0x0;this[_0xeba4('0x1c')]=_0x3a1354[_0xeba4('0x1c')]||0x0;this['countabandonedretry']=_0x3a1354[_0xeba4('0x19')]||0x0;this[_0xeba4('0x1d')]=_0x3a1354['countmachineretry']||0x0;this['countagentrejectretry']=_0x3a1354[_0xeba4('0x1a')]||0x0;this[_0xeba4('0x1e')]=_0x3a1354[_0xeba4('0x1e')];this[_0xeba4('0x1f')]=_0x3a1354[_0xeba4('0x1f')];this[_0xeba4('0x20')]=_0x3a1354[_0xeba4('0x20')];this[_0xeba4('0x21')]=_0x3a1354['recallme'];this[_0xeba4('0x22')]=_0x3a1354[_0xeba4('0x22')];this[_0xeba4('0x23')]=_0x3a1354[_0xeba4('0x23')];this[_0xeba4('0x24')]=_[_0xeba4('0x2')](_0x3a1354[_0xeba4('0xb')])?_0x3a1354[_0xeba4('0x24')]:_0x3a1354[_0xeba4('0xb')]['id'];this[_0xeba4('0x25')]=_0x3a1354['VoiceQueueId'];this[_0xeba4('0x26')]='';this['originatecalleridname']='';}Action[_0xeba4('0x27')][_0xeba4('0x28')]=function(){return util[_0xeba4('0xd')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0xeba4('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 9dfe5f4..1eb32db 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 _0x9c5a=['[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','SIP/%s','status','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','idContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','addVariable','variables','keys','variable','error','inspect','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./rpcDb','./action','defaults','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','booked','clearZombieChannels','dialActive','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','then','length','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','buildAcw','custom:agentcomplete','Answer','[callProgressDetectingCustomer][logAnswer]','talktime','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','unlockAgent','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','agentreject','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]'];(function(_0x462e1e,_0x168a64){var _0x100ec6=function(_0x3a24c6){while(--_0x3a24c6){_0x462e1e['push'](_0x462e1e['shift']());}};_0x100ec6(++_0x168a64);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2e147e,_0x4e51cd){_0x2e147e=_0x2e147e-0x0;var _0x4df73c=_0x9c5a[_0x2e147e];return _0x4df73c;};'use strict';var util=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));var BPromise=require('bluebird');var uuid=require(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var md5=require(_0xa9c5('0x4'));var Redis=require(_0xa9c5('0x5'));var config=require('../../../config/environment');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var loggerAction=require('../../../config/logger')(_0xa9c5('0x8'));var ami=require('../ami');var rpcDb=require(_0xa9c5('0x9'));var Action=require(_0xa9c5('0xa'));var ut=require('./util/util');config['redis']=_[_0xa9c5('0xb')](config[_0xa9c5('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xa9c5('0xd'))(new Redis(config[_0xa9c5('0xc')]));var Sequence=function(){};Sequence['prototype'][_0xa9c5('0xe')]=function(_0x40a79d){this['tail']=this['tail']?this[_0xa9c5('0xf')][_0xa9c5('0x10')](_0x40a79d):_0x40a79d();};function Preview(_0x45f8d8){this[_0xa9c5('0x11')]=new Sequence();this[_0xa9c5('0x12')]=_0x45f8d8[_0xa9c5('0x13')];this[_0xa9c5('0x14')]=_0x45f8d8[_0xa9c5('0x14')];this[_0xa9c5('0x15')]={};this[_0xa9c5('0x16')]=_0x45f8d8['agents'];this[_0xa9c5('0x17')]=0x0;ami['on'](_0xa9c5('0x18'),this[_0xa9c5('0x19')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x1b'),this[_0xa9c5('0x1c')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x1d'),this[_0xa9c5('0x1e')][_0xa9c5('0x1a')](this));ami['on']('dialend',this[_0xa9c5('0x1f')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x20'),this['syncNewExten'][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x21'),this[_0xa9c5('0x22')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x23'),this[_0xa9c5('0x24')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x25'),this[_0xa9c5('0x26')][_0xa9c5('0x1a')](this));this[_0xa9c5('0x27')](this[_0xa9c5('0x12')]);}function emit(_0x54f8b9,_0x1115ad,_0x21ab50){io['to'](_0x54f8b9)['emit'](_0x1115ad,_0x21ab50);}function emitCampaignPreview(_0x5d2115){if(_0x5d2115[_0xa9c5('0x28')]===_0xa9c5('0x29')){var _0x10b208={'id':_0x5d2115['id'],'name':_0x5d2115[_0xa9c5('0x2a')],'strategy':_0x5d2115[_0xa9c5('0x2b')],'answered':_0x5d2115[_0xa9c5('0x2c')],'available':_0x5d2115['available'],'loggedIn':_0x5d2115['loggedIn'],'pTalking':_0x5d2115[_0xa9c5('0x2d')],'sumBillable':_0x5d2115[_0xa9c5('0x2e')],'sumDuration':_0x5d2115['sumDuration'],'sumHoldTime':_0x5d2115[_0xa9c5('0x2f')]||0x0,'talking':_0x5d2115[_0xa9c5('0x30')],'total':_0x5d2115[_0xa9c5('0x31')],'type':_0x5d2115[_0xa9c5('0x28')],'unmanaged':_0x5d2115[_0xa9c5('0x32')],'abandoned':_0x5d2115[_0xa9c5('0x33')],'waiting':_0x5d2115[_0xa9c5('0x34')],'loggedInDb':_0x5d2115['loggedInDb'],'dialActive':_0x5d2115['dialActive'],'dialMethod':_0x5d2115[_0xa9c5('0x35')],'dialOriginateCallerIdName':_0x5d2115['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5d2115[_0xa9c5('0x36')],'dialOriginateTimeout':_0x5d2115[_0xa9c5('0x37')],'dialPrefix':_0x5d2115['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5d2115[_0xa9c5('0x38')],'outboundAnswerCallsDay':_0x5d2115[_0xa9c5('0x39')],'outboundBlacklistCallsDay':_0x5d2115['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5d2115[_0xa9c5('0x3a')],'outboundCongestionCallsDay':_0x5d2115[_0xa9c5('0x3b')],'outboundDropCallsDayACS':_0x5d2115[_0xa9c5('0x3c')],'outboundDropCallsDayCallersExit':_0x5d2115[_0xa9c5('0x3d')],'outboundDropCallsDayTimeout':_0x5d2115[_0xa9c5('0x3e')],'outboundNoAnswerCallsDay':_0x5d2115['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5d2115[_0xa9c5('0x3f')],'outboundOriginateFailureCallsDay':_0x5d2115['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5d2115[_0xa9c5('0x40')],'outboundRejectCallsDay':_0x5d2115[_0xa9c5('0x41')],'outboundUnknownCallsDay':_0x5d2115[_0xa9c5('0x42')],'outboundAbandonedCallsDay':_0x5d2115['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5d2115[_0xa9c5('0x43')],'predictiveIntervalAvgHoldtime':_0x5d2115[_0xa9c5('0x44')],'predictiveIntervalAvgTalktime':_0x5d2115['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5d2115[_0xa9c5('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x5d2115[_0xa9c5('0x46')],'predictiveIntervalErlangCalls':_0x5d2115[_0xa9c5('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x5d2115[_0xa9c5('0x48')],'predictiveIntervalHitRate':_0x5d2115[_0xa9c5('0x49')],'predictiveIntervalMultiplicativeFactor':_0x5d2115[_0xa9c5('0x4a')],'predictiveIntervalPauses':_0x5d2115[_0xa9c5('0x4b')],'predictiveIntervalAvailable':_0x5d2115['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5d2115[_0xa9c5('0x4c')],'message':_0x5d2115[_0xa9c5('0x4d')],'originated':_0x5d2115[_0xa9c5('0x4e')],'erlangCalls':_0x5d2115[_0xa9c5('0x4f')],'erlangCallToSecond':_0x5d2115[_0xa9c5('0x50')],'erlangAbandonmentRate':_0x5d2115[_0xa9c5('0x51')],'erlangBusyFactor':_0x5d2115[_0xa9c5('0x52')],'startPredictive':_0x5d2115[_0xa9c5('0x53')],'startProgressive':_0x5d2115['startProgressive']};if(_0x5d2115['Trunk']){_0x10b208[_0xa9c5('0x54')]={'id':_0x5d2115[_0xa9c5('0x54')]['id'],'name':_0x5d2115[_0xa9c5('0x54')][_0xa9c5('0x2a')],'active':_0x5d2115[_0xa9c5('0x54')][_0xa9c5('0x55')],'callerid':_0x5d2115['Trunk']['callerid']};}if(_0x5d2115['Interval']){_0x10b208[_0xa9c5('0x56')]={'id':_0x5d2115[_0xa9c5('0x56')]['id'],'name':_0x5d2115['Interval'][_0xa9c5('0x2a')]};}var _0x56eb82=md5(JSON[_0xa9c5('0x57')](_0x10b208));if(_0x5d2115[_0xa9c5('0x4')]!==_0x56eb82){_0x5d2115[_0xa9c5('0x4')]=_0x56eb82;emit(util[_0xa9c5('0x58')]('voice:queue:%s',_0x10b208[_0xa9c5('0x2a')]),_0xa9c5('0x59'),_0x10b208);}}}function emitVoiceQueueChannelRemove(_0x191153){logger[_0xa9c5('0x5a')](_0xa9c5('0x5b'),JSON[_0xa9c5('0x57')](_0x191153));emit(util[_0xa9c5('0x58')](_0xa9c5('0x5c'),_0x191153['name']),_0xa9c5('0x5d'),_0x191153);io[_0xa9c5('0x5e')](_0xa9c5('0x5f'),_0x191153);}function notSendMessagesQueue(_0x2b95fa){if(_0x2b95fa[_0xa9c5('0x60')]){if(_0x2b95fa[_0xa9c5('0x4e')]===0x0&&_0x2b95fa['pTalking']===0x0){_0x2b95fa[_0xa9c5('0x60')]=![];_0x2b95fa['available']=0x0;_0x2b95fa[_0xa9c5('0x61')]=0x0;_0x2b95fa['message']=_0xa9c5('0x62');ut[_0xa9c5('0x63')](_0xa9c5('0x64'),_0x2b95fa['name']+_0xa9c5('0x65'));}else{_0x2b95fa[_0xa9c5('0x4d')]=_0xa9c5('0x66');ut[_0xa9c5('0x63')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2b95fa[_0xa9c5('0x2a')]+_0xa9c5('0x67'));}emitCampaignPreview(_0x2b95fa);}}Preview[_0xa9c5('0x68')][_0xa9c5('0x27')]=function(){var _0x2a6b48=this;setInterval(function(){_0x2a6b48['syncCampaigns']();},0x7cf);};Preview[_0xa9c5('0x68')]['syncCampaigns']=function(){var _0x1de605=this[_0xa9c5('0x12')];this[_0xa9c5('0x17')]+=0x1;for(var _0xc8fca4 in _0x1de605){if(_0x1de605[_0xa9c5('0x69')](_0xc8fca4)&&(_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x7')||_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x6a'))&&_0x1de605[_0xc8fca4][_0xa9c5('0x28')]==='outbound'){if(this[_0xa9c5('0x17')]>0x7){this[_0xa9c5('0x17')]=0x0;this[_0xa9c5('0x6b')]();}}if(_0x1de605[_0xa9c5('0x69')](_0xc8fca4)&&_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x7')&&_0x1de605[_0xc8fca4]['type']===_0xa9c5('0x29')){if(_0x1de605[_0xc8fca4][_0xa9c5('0x6c')]){this['setMessage'](_0x1de605[_0xc8fca4]);if(_0x1de605[_0xc8fca4]['dialPreviewAutoRecallMe'])this['recallMe'](_0x1de605[_0xc8fca4]);}else{notSendMessagesQueue(_0x1de605[_0xc8fca4]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x160020){var _0x569185=this;this[_0xa9c5('0x11')][_0xa9c5('0xe')](function(){if(!_[_0xa9c5('0x6d')](_0x569185[_0xa9c5('0x15')][_0x160020])){loggerAction[_0xa9c5('0x5a')](_0xa9c5('0x6e'),_0x160020,_0xa9c5('0x6f'),_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')],_0xa9c5('0x71'),JSON[_0xa9c5('0x57')](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020]['queue']][_0xa9c5('0x4e')]),_0xa9c5('0x72'),JSON['stringify'](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]][_0xa9c5('0x2d')]),JSON['stringify'](_0x569185['actions'][_0x160020][_0xa9c5('0x73')]),JSON[_0xa9c5('0x57')](_['pick'](_0x569185[_0xa9c5('0x15')][_0x160020],[_0xa9c5('0x74'),_0xa9c5('0x75'),_0xa9c5('0x76'),_0xa9c5('0x77')])));return ami[_0xa9c5('0x78')]({'action':'status','channel':_0x569185['actions'][_0x160020]['channel']})[_0xa9c5('0x79')](function(_0x277903){if(_0x277903[_0xa9c5('0x4d')]===_0xa9c5('0x7a')){setTimeout(function(){if(_0x569185[_0xa9c5('0x15')][_0x160020]){ut[_0xa9c5('0x7b')](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]],_0xa9c5('0x7c'));if(_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x73')]===!![]){ut[_0xa9c5('0x7d')](_0x569185['campaignsPreview'][_0x569185['actions'][_0x160020][_0xa9c5('0x70')]],'[clearZombieChannel]');ut[_0xa9c5('0x7e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x160020,_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]);}ut[_0xa9c5('0x7e')]('[Dialer][checkChannel][Preview]'+_0x160020,_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]);delete _0x569185[_0xa9c5('0x15')][_0x160020];}},0x2328);}});}});};Preview[_0xa9c5('0x68')]['clearZombieChannels']=function(){var _0x49422c=this;loggerAction[_0xa9c5('0x5a')](_0xa9c5('0x7f'),_[_0xa9c5('0x80')](this['actions']));for(var _0x31e12e in this[_0xa9c5('0x15')]){if(_0x49422c[_0xa9c5('0x15')][_0xa9c5('0x69')](_0x31e12e)){_0x49422c[_0xa9c5('0x81')](_0x31e12e);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x82')]=function(_0x298b3d){var _0x5a7f0a=this;rpcDb[_0xa9c5('0x83')](_0x298b3d['id'],ut['agentReadyId'](this[_0xa9c5('0x16')]))[_0xa9c5('0x84')](function(_0x26bda1){if(!_['isNil'](_0x26bda1)){for(var _0x4d475a=0x0;_0x4d475a<_0x26bda1[_0xa9c5('0x85')];_0x4d475a+=0x1){if(ut['getDiff'](_0x26bda1[_0x4d475a][_0xa9c5('0x86')])<_0x298b3d[_0xa9c5('0x87')]*0x3c){if(_0x26bda1[_0x4d475a][_0xa9c5('0x88')]&&!_0x26bda1[_0x4d475a][_0xa9c5('0x88')]['voicePause']){_0x5a7f0a[_0xa9c5('0x89')](_0x26bda1[_0x4d475a]['id'])[_0xa9c5('0x84')](ut[_0xa9c5('0x8a')](_0xa9c5('0x8b')))['catch'](ut['logger2'](_0xa9c5('0x8b')));}else{rpcDb[_0xa9c5('0x8c')](_0x26bda1[_0x4d475a]['id']);}}else{var _0x67c1f8=new Action(_0x26bda1[_0x4d475a],_0x298b3d);_0x67c1f8[_0xa9c5('0x8d')]=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));_0x298b3d['outboundReCallsDay']+=0x1;ut[_0xa9c5('0x8f')](_0x67c1f8,0x17,_0xa9c5('0x90'));if(_0x298b3d[_0xa9c5('0x91')]){rpcDb[_0xa9c5('0x92')](ut[_0xa9c5('0x93')](_0x26bda1[_0x4d475a]));rpcDb[_0xa9c5('0x94')](_0x67c1f8,_0xa9c5('0x95'));}else{ut[_0xa9c5('0x8f')](_0x67c1f8,0x16,_0xa9c5('0x96'));rpcDb[_0xa9c5('0x94')](_0x67c1f8,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x67c1f8,_0xa9c5('0x97'));}}}}})[_0xa9c5('0x79')](ut[_0xa9c5('0x8a')](_0xa9c5('0x98')));};Preview['prototype'][_0xa9c5('0x99')]=function(_0x4aa699){_0x4aa699[_0xa9c5('0x60')]=!![];if(ut[_0xa9c5('0x9a')](_0x4aa699[_0xa9c5('0x9b')])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x9c');}else if(!ut[_0xa9c5('0x9d')](_0x4aa699[_0xa9c5('0x6c')])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x62');}else if(!this[_0xa9c5('0x9e')](_0x4aa699[_0xa9c5('0x54')])){if(!this[_0xa9c5('0x9e')](_0x4aa699['TrunkBackup'])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x9f');}else{_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0xa0');}}else{_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0xa0');}emitCampaignPreview(_0x4aa699);};Preview[_0xa9c5('0x68')]['callProgressDetectingCustomer']=function(_0x5b7c33,_0x207bb7,_0x502a00){var _0x2ae087=this;var _0x2510e4=this['actions'][_0x207bb7];var _0x219854=this[_0xa9c5('0x12')][_0x2510e4['queue']];var _0x4f8d9e;if(_0x219854){switch(_0x502a00){case'1':_0x219854[_0xa9c5('0x3f')]+=0x1;_0x2510e4[_0xa9c5('0xa1')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut['totalGlobal'](_0x2510e4);ut['logCustomer'](_0x2510e4,0x0,_0xa9c5('0xa3'));ami[_0xa9c5('0x5e')]('custom:agentnosuchnumber',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xa5')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xa6'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xab'));}else{if(_0x2510e4[_0xa9c5('0xa1')]>=_0x219854['dialNoSuchNumberMaxRetry']){rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xab'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xa1'),_0x219854[_0xa9c5('0xad')]),_0x2510e4['unlockAgent'],_0x2510e4[_0xa9c5('0xae')]);}}delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];break;case _0xa9c5('0xb0'):var _0x2d449a=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));_0x2510e4['responsetime']=_0x2d449a;_0x2510e4[_0xa9c5('0xb1')]=_0x2d449a;_0x2510e4[_0xa9c5('0x73')]=!![];_0x219854[_0xa9c5('0x2d')]+=0x1;logger[_0xa9c5('0x5a')](_0xa9c5('0xb2'),_0x2510e4[_0xa9c5('0xb3')],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x219854[_0xa9c5('0x2d')]);ami[_0xa9c5('0x5e')]('custom:agentconnect',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xb5'),this['campaignsPreview'][_0x2510e4[_0xa9c5('0x70')]]));if(_0x219854[_0xa9c5('0xb6')]){ami[_0xa9c5('0x5e')]('custom:agentConnectPreview',ut[_0xa9c5('0xb7')](_0x2510e4));}break;case'16':ami[_0xa9c5('0x5e')](_0xa9c5('0xb8'),ut[_0xa9c5('0xa4')](_0x2510e4,'complete',this[_0xa9c5('0x12')][_0x2510e4[_0xa9c5('0x70')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2510e4,'complete'));_0x219854['outboundAnswerCallsDay']+=0x1;_0x219854['total']+=0x1;_0x219854['answered']+=0x1;ut['decrementTalkink'](_0x219854,'[16]');_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x4,_0xa9c5('0xb9'));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xba'));rpcDb['createCustomerFinal'](_0x2510e4,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x2510e4);_0x219854['sumDuration']+=_0x2510e4[_0xa9c5('0xbb')];_0x219854[_0xa9c5('0x2e')]+=_0x2510e4[_0xa9c5('0xbb')];logger[_0xa9c5('0x5a')]('[syncHangup][talking][decrement]',_0x2510e4['uniqueid'],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x219854[_0xa9c5('0x2d')]);delete this[_0xa9c5('0x15')][_0x5b7c33['linkedid']];break;case _0xa9c5('0xbc'):_0x219854[_0xa9c5('0x3a')]+=0x1;_0x2510e4[_0xa9c5('0xbd')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x5,_0xa9c5('0xbe'));ami[_0xa9c5('0x5e')]('custom:agentbusy',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xbf')));rpcDb['createCustomerHistory'](_0x2510e4,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854['dialGlobalMaxRetry']){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xc0'));}else{if(_0x2510e4[_0xa9c5('0xbd')]>=_0x219854[_0xa9c5('0xc1')]){rpcDb['createCustomerFinal'](_0x2510e4,_0xa9c5('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xbd'),_0x219854[_0xa9c5('0xc3')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4['activeContact']);}}break;case'NOANSWER':_0x219854[_0xa9c5('0xc5')]+=0x1;_0x2510e4['countnoanswerretry']+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x3,'NoAnswer');ami['emit'](_0xa9c5('0xc6'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xc7')));rpcDb[_0xa9c5('0x94')](_0x2510e4,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xc9'));}else{if(_0x2510e4[_0xa9c5('0xca')]>=_0x219854[_0xa9c5('0xcb')]){rpcDb['createCustomerFinal'](_0x2510e4,_0xa9c5('0xcc'));}else{rpcDb[_0xa9c5('0xcd')](ut['scheduledAt'](_0x2510e4,_0xa9c5('0xca'),_0x219854[_0xa9c5('0xce')]),_0x2510e4['unlockAgent'],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xcf'):_0x219854[_0xa9c5('0x3b')]+=0x1;_0x2510e4[_0xa9c5('0xd0')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x8,_0xa9c5('0xd1'));ami[_0xa9c5('0x5e')](_0xa9c5('0xd2'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xd3')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xd4'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,'Global');rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xd5'));}else{if(_0x2510e4[_0xa9c5('0xd0')]>=_0x219854['dialCongestionMaxRetry']){rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xd0'),_0x219854[_0xa9c5('0xc3')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xd6'):_0x219854[_0xa9c5('0x41')]+=0x1;_0x2510e4[_0xa9c5('0xd7')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x14,_0xa9c5('0xd8'));ami[_0xa9c5('0x5e')]('custom:agentreject',ut['buildObj'](_0x2510e4,_0xa9c5('0xd9')));rpcDb[_0xa9c5('0x94')](_0x2510e4,'[syncHangupRequest][logAgentReject]');if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0x14,_0xa9c5('0xd8'));rpcDb['createCustomerFinal'](_0x4f8d9e,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2510e4[_0xa9c5('0xd7')]>=_0x219854[_0xa9c5('0xda')]){rpcDb[_0xa9c5('0xaa')](_0x2510e4,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xa9c5('0xcd')](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xd7'),_0x219854['dialAgentRejectRetryFrequency']),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xdb'):_0x219854[_0xa9c5('0xdc')]+=0x1;_0x2510e4[_0xa9c5('0xdd')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0xb,_0xa9c5('0xde'));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xdf'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb['createCustomerFinal'](_0x4f8d9e,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2510e4['countabandonedetry']>=_0x219854[_0xa9c5('0xe0')]){rpcDb[_0xa9c5('0xaa')](_0x2510e4,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa9c5('0xcd')](ut[_0xa9c5('0xac')](_0x2510e4,'countabandonedretry',_0x219854[_0xa9c5('0xe1')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case'18':_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4[_0xa9c5('0xe2')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x12,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);ami[_0xa9c5('0x5e')](_0xa9c5('0xe5'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xe6')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xe7'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,'Global');rpcDb['createCustomerFinal'](_0x4f8d9e,_0xa9c5('0xe7'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xe7'));}delete this[_0xa9c5('0x15')][_0x5b7c33['linkedid']];break;case'19':_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4['countglobal']=ut['totalGlobal'](_0x2510e4);ut['logCustomer'](_0x2510e4,0x13,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);ami['emit'](_0xa9c5('0xe5'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xe6')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xe8'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb['createCustomerFinal'](_0x4f8d9e,_0xa9c5('0xe8'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xe8'));}delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];break;default:if(_0x2510e4[_0xa9c5('0x73')]){ut[_0xa9c5('0x7d')](_0x219854,_0xa9c5('0xe9'));ut['loggerError'](_0xa9c5('0xea')+_0x219854['name'],_0x5b7c33);}_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0xc,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xeb'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,'Global');rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xec'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xec'));}delete this['actions'][_0x5b7c33['linkedid']];}if(!(_0x2510e4[_0xa9c5('0x73')]&&_0x502a00==='16')){ut[_0xa9c5('0x7b')](_0x219854,_0xa9c5('0xed'));logger[_0xa9c5('0x5a')](_0xa9c5('0xee'),_0x2510e4[_0xa9c5('0xb3')],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x71'),_0x219854['originated']);}if(_0x502a00!==_0xa9c5('0xb0')){delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xef')]];}}};Preview[_0xa9c5('0x68')][_0xa9c5('0xf0')]=function(_0x42e803,_0xf77e11,_0x2204b){if(_[_0xa9c5('0xf1')](_0xf77e11)&&_0xa9c5('0xf2')!==typeof _0xf77e11){return;}if(_[_0xa9c5('0xf1')](_0x2204b)&&_0xa9c5('0xf2')!==typeof _0x2204b){return;}switch(_0x2204b[_0xa9c5('0xf3')]){case'0':ut['logAgent'](_0x42e803,0x0,_0xa9c5('0xa3'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xf5'));break;case'3':ut['logAgent'](_0x42e803,0x3,_0xa9c5('0xf6'));rpcDb['createAgentHistory'](_0x42e803,_0xa9c5('0xf7'));break;case'5':ut[_0xa9c5('0xf8')](_0x42e803,0x5,_0xa9c5('0xbe'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xf9'));break;case'8':ut[_0xa9c5('0xf8')](_0x42e803,0x8,_0xa9c5('0xd1'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xfa'));break;case'22':ut['logAgent'](_0x42e803,0x16,_0xa9c5('0xfb'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xfc'));break;default:ut[_0xa9c5('0xf8')](_0x42e803,0xc,_0x2204b[_0xa9c5('0xf3')]);rpcDb['createAgentHistory'](_0x42e803,_0xa9c5('0xfa'));}ut[_0xa9c5('0x7b')](_0xf77e11,_0xa9c5('0xfd'));logger[_0xa9c5('0x5a')](_0xa9c5('0xfe'),_0x42e803['uniqueid'],_0xa9c5('0xb4'),_0xf77e11['name'],_0xa9c5('0x71'),_0xf77e11[_0xa9c5('0x4e')]);delete this[_0xa9c5('0x15')][_0x42e803[_0xa9c5('0xb3')]];};Preview[_0xa9c5('0x68')][_0xa9c5('0xff')]=function(_0xe3b086,_0x35b8c9,_0x1fdc93,_0x1400b2,_0x3e2a1e){var _0x150d58=this;return new BPromise(function(_0x466ce6,_0x1c8efb){if(_[_0xa9c5('0x6d')](_0x35b8c9)||_[_0xa9c5('0x6d')](_0x35b8c9[_0xa9c5('0x100')])||_['isNil'](_0x35b8c9[_0xa9c5('0x100')][_0xa9c5('0x101')])||_[_0xa9c5('0x6d')](_0x35b8c9[_0xa9c5('0x76')])){_0x1c8efb(ut[_0xa9c5('0x4d')](_0xa9c5('0x102'),_0x1400b2,_0x3e2a1e));return;}var _0x18389c=uuid['v4']();var _0xd2bb86=_0x150d58['campaignsPreview'][_0x35b8c9[_0xa9c5('0x6f')][_0xa9c5('0x2a')]];var _0x5018c4=_0x1fdc93?_0x150d58[_0xa9c5('0x16')][_0x1fdc93]['id']:undefined;_0x150d58[_0xa9c5('0x15')][_0x18389c]=new Action(_0x35b8c9,_0xd2bb86,_0x18389c,_0x1fdc93,_0x5018c4);var _0x5545eb=_0x150d58['actions'][_0x18389c];_0x5545eb[_0xa9c5('0xc4')]=_0x1400b2;_0x5545eb[_0xa9c5('0xae')]=_0x3e2a1e;_0x5545eb['lookAgent']=_0x1fdc93;if(_[_0xa9c5('0x103')](_0xe3b086)){_0x150d58[_0xa9c5('0x104')](_0x5545eb,_0xd2bb86,_0x35b8c9,_0x1fdc93)[_0xa9c5('0x84')](function(_0x2d5a24){logger[_0xa9c5('0x5a')](_0xa9c5('0x105'),_0xa9c5('0x106')+_0x5545eb[_0xa9c5('0x70')]+_0xa9c5('0x107')+_0x5545eb['idContact'],JSON[_0xa9c5('0x57')](_0x2d5a24));ami[_0xa9c5('0x5e')](_0xa9c5('0x108'),ut[_0xa9c5('0xa4')](_0x5545eb,'called',_0x150d58['campaignsPreview'][_0x5545eb[_0xa9c5('0x70')]]));_0x466ce6(ut[_0xa9c5('0x4d')](_0xa9c5('0x109')));})[_0xa9c5('0x79')](function(_0x3269ba){ut[_0xa9c5('0x63')]('[Preview][execCall][failure]',_0x3269ba);_0x1c8efb(ut[_0xa9c5('0x4d')](_0xa9c5('0x10a'),_0x1400b2,_0x3e2a1e));});}else{_0xd2bb86[_0xa9c5('0x10b')]+=0x1;ut['logBlacklist'](_0x5545eb);rpcDb[_0xa9c5('0x10c')](_0x5545eb,_0xa9c5('0x10d'));delete _0x150d58['actions'][_0x18389c];_0x1c8efb(ut[_0xa9c5('0x4d')]('Contact\x20in\x20black\x20List',_0x1400b2,_0x3e2a1e));}});};Preview[_0xa9c5('0x68')]['isTrunkReachable']=function(_0x52d348){return!_[_0xa9c5('0x6d')](_0x52d348)&&!_[_0xa9c5('0x6d')](_0x52d348['name'])&&!_['isNil'](_0x52d348[_0xa9c5('0x55')])&&_0x52d348[_0xa9c5('0x55')]&&!_[_0xa9c5('0x6d')](this[_0xa9c5('0x14')][util['format'](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])])&&!_['isNil'](this['trunks'][util[_0xa9c5('0x58')]('SIP/%s',_0x52d348[_0xa9c5('0x2a')])]['status'])&&(this[_0xa9c5('0x14')][util['format'](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])][_0xa9c5('0x10f')]==='reachable'||this[_0xa9c5('0x14')][util[_0xa9c5('0x58')](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])][_0xa9c5('0x10f')]===_0xa9c5('0x110'));};Preview[_0xa9c5('0x68')][_0xa9c5('0x89')]=function(_0x37bdd7,_0x456833){var _0x1cc858=this;return new BPromise(function(_0x345b1d,_0x4681f9){_0x1cc858[_0xa9c5('0x111')](_0x37bdd7,_0x456833)[_0xa9c5('0x84')](function(_0x2f8ccf){_0x345b1d(_[_0xa9c5('0x112')](_0x2f8ccf,[_0xa9c5('0x4d')]));})[_0xa9c5('0x79')](function(_0x1b54dc){if(_0x1b54dc[_0xa9c5('0x113')]){rpcDb[_0xa9c5('0x114')](_0x37bdd7);}if(_0x1b54dc[_0xa9c5('0x55')]){rpcDb[_0xa9c5('0x8c')](_0x37bdd7);}_0x4681f9(_[_0xa9c5('0x112')](_0x1b54dc,['message']));});});};Preview[_0xa9c5('0x68')][_0xa9c5('0x111')]=function(_0x1d0b63,_0xa8905e){var _0x5e9ce9=this;return new BPromise(function(_0x1ff174,_0x4d7916){var _0x21a87e,_0x5b8f70;rpcDb[_0xa9c5('0x115')](_0x1d0b63)['then'](function(_0x22424e){if(!_[_0xa9c5('0x6d')](_0x22424e[0x0])){_0x5b8f70=_0x22424e[0x0][_0xa9c5('0x116')]?![]:!![];_0x21a87e=_0x22424e[0x0][_0xa9c5('0x116')]?!![]:![];_0x21a87e=_0xa8905e?!![]:_0x21a87e;}var _0x4a6123=_0x5e9ce9[_0xa9c5('0x117')](_0x22424e);if(_0x4a6123[_0xa9c5('0x118')]){rpcDb[_0xa9c5('0x119')](_[_0xa9c5('0x112')](_0x22424e[0x0],[_0xa9c5('0x76'),'Contact.phone']))[_0xa9c5('0x84')](function(_0x272db4){_0x5e9ce9[_0xa9c5('0xff')](_0x272db4,_0x22424e[0x0],_0xa8905e,_0x5b8f70,_0x21a87e)['then'](function(_0x18a668){_0x1ff174(_0x18a668);})[_0xa9c5('0x79')](function(_0x8cccd1){_0x4d7916(_0x8cccd1);});})[_0xa9c5('0x79')](function(_0x4c4b56){ut['logger']('[Preview][checkIsBlackList]',_0x4c4b56);_0x4d7916(ut[_0xa9c5('0x4d')](_0xa9c5('0x11a'),_0x5b8f70,_0x21a87e));});}else{_0x4d7916(ut['message'](_0x4a6123[_0xa9c5('0x4d')],_0x5b8f70,_0x21a87e));}})['catch'](function(_0x592b18){ut['logger'](_0xa9c5('0x11b'),_0x592b18);_0x4d7916(ut[_0xa9c5('0x4d')](_0xa9c5('0x11a'),![],!![]));});});};Preview[_0xa9c5('0x68')][_0xa9c5('0x117')]=function(_0xd06ffc){if(_[_0xa9c5('0x6d')](_0xd06ffc)||_[_0xa9c5('0x103')](_0xd06ffc)||!_[_0xa9c5('0x6d')](_0xd06ffc[0x0][_0xa9c5('0x88')])&&_[_0xa9c5('0x6d')](_0xd06ffc[0x0]['Agent'][_0xa9c5('0x2a')])){ut[_0xa9c5('0x63')](_0xa9c5('0x11c'),_0xd06ffc);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x24b12d=this[_0xa9c5('0x12')][_0xd06ffc[0x0][_0xa9c5('0x6f')]['name']];_0x24b12d[_0xa9c5('0x4d')]=_0xa9c5('0xa0');if(_['isNil'](_0x24b12d)){ut[_0xa9c5('0x63')](_0xa9c5('0x11d'),_0x24b12d);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xa9c5('0x9e')](_0x24b12d[_0xa9c5('0x54')])){ut[_0xa9c5('0x63')](_0xa9c5('0x11e'),'campaign\x20Name:\x20'+_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x11f'));if(!this[_0xa9c5('0x9e')](_0x24b12d[_0xa9c5('0x120')])){ut['logger'](_0xa9c5('0x11e'),_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x121'));return{'isValid':![],'message':_0xa9c5('0x122')};}}if(!ut['isActive'](_0x24b12d['dialActive'])){ut[_0xa9c5('0x63')]('[Preview][validateContact][Campaign\x20Active]',_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x123'));return{'isValid':![],'message':_0xa9c5('0x124')+_0x24b12d['name']+_0xa9c5('0x123')};}return{'isValid':!![],'message':_0xa9c5('0x125')};};Preview[_0xa9c5('0x68')][_0xa9c5('0x104')]=function(_0x2c2671,_0x1c8e59,_0x26c209,_0x417181){var _0x58dd4c=this;return new BPromise(function(_0x4382cf,_0xdeb6e5){var _0x11621e=_0x2c2671[_0xa9c5('0xb3')];var _0x54ffc4=_0x58dd4c[_0xa9c5('0x9e')](_0x1c8e59[_0xa9c5('0x54')])?util[_0xa9c5('0x58')]('SIP/%s/%s%s',_0x1c8e59['Trunk'][_0xa9c5('0x2a')],_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x126')])?'':_0x1c8e59['dialPrefix']['trim']()||'',_0x1c8e59[_0xa9c5('0x127')]>0x0?_0x26c209[_0xa9c5('0x100')]['phone'][_0xa9c5('0x128')](_0x1c8e59['dialCutDigit']):_0x26c209[_0xa9c5('0x100')][_0xa9c5('0x101')]):util[_0xa9c5('0x58')](_0xa9c5('0x129'),_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x120')])?_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x2a')]:_0x1c8e59[_0xa9c5('0x120')][_0xa9c5('0x2a')],_[_0xa9c5('0x6d')](_0x1c8e59['dialPrefix'])?'':_0x1c8e59[_0xa9c5('0x126')][_0xa9c5('0x12a')]()||'',_0x1c8e59[_0xa9c5('0x127')]>0x0?_0x26c209[_0xa9c5('0x100')][_0xa9c5('0x101')][_0xa9c5('0x128')](_0x1c8e59[_0xa9c5('0x127')]):_0x26c209['Contact'][_0xa9c5('0x101')]);var _0x3a25fd=_0x58dd4c[_0xa9c5('0x9e')](_0x1c8e59['Trunk'])?ut['getCallerId'](_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x12b')],_0x1c8e59['dialOriginateCallerIdName'],_0x1c8e59[_0xa9c5('0x12c')]>0x0?ut[_0xa9c5('0x12d')](_0x1c8e59['dialOriginateCallerIdNumber'],_0x1c8e59[_0xa9c5('0x12c')]):_0x1c8e59[_0xa9c5('0x36')]):ut[_0xa9c5('0x12e')](_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x120')])?_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x12b')]:_0x1c8e59[_0xa9c5('0x120')][_0xa9c5('0x12b')],_0x1c8e59[_0xa9c5('0x12f')],_0x1c8e59[_0xa9c5('0x12c')]>0x0?ut['getCallerIdRandom'](_0x1c8e59[_0xa9c5('0x36')],_0x1c8e59['dialRandomLastDigitCallerIdNumber']):_0x1c8e59[_0xa9c5('0x36')]);if(_0x3a25fd){_0x2c2671[_0xa9c5('0x130')]=ut[_0xa9c5('0x131')](_0x3a25fd);_0x2c2671[_0xa9c5('0x132')]=ut['extractCalleridNumber'](_0x3a25fd);}var _0x3058a6=ut[_0xa9c5('0x133')](_0x1c8e59,_0x26c209,_0x54ffc4,_0x3a25fd,_0x11621e,_0x2c2671);_[_0xa9c5('0x134')](_0x2c2671,ut[_0xa9c5('0x135')](_0x3058a6));_0x2c2671['starttime']=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));ami[_0xa9c5('0x78')](ut[_0xa9c5('0x136')](_0x2c2671,_0x1c8e59,_0x3058a6,_0x2c2671['activeContact'],_0x417181))[_0xa9c5('0x84')](function(_0x42dbd7){_0x1c8e59[_0xa9c5('0x4e')]+=0x1;logger[_0xa9c5('0x5a')](_0xa9c5('0x137'),_0x11621e,_0xa9c5('0xb4'),_0x1c8e59[_0xa9c5('0x2a')],_0xa9c5('0x71'),_0x1c8e59[_0xa9c5('0x4e')]);_0x4382cf(_0x42dbd7);})[_0xa9c5('0x79')](function(_0x411ee7){ut[_0xa9c5('0xf8')](_0x2c2671,0xe,_0xa9c5('0x138'));rpcDb[_0xa9c5('0xf4')](_0x2c2671,_0xa9c5('0x139'));_0xdeb6e5(_0x411ee7);});});};Preview['prototype'][_0xa9c5('0x13a')]=function(_0x543b32){if(this['actions'][_0x543b32[_0xa9c5('0xaf')]]){this[_0xa9c5('0x15')][_0x543b32[_0xa9c5('0xaf')]][_0xa9c5('0x13b')]=_0x543b32[_0xa9c5('0x13b')];}};Preview['prototype'][_0xa9c5('0x19')]=function(_0x53b2f1){var _0x4dde67=this;var _0x130c9a=this[_0xa9c5('0x15')][_0x53b2f1[_0xa9c5('0x13c')]];if(_0x130c9a){if(_0x130c9a[_0xa9c5('0x13d')]&&this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]]){ut[_0xa9c5('0x13e')](_0x130c9a,this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]][_0xa9c5('0x2a')],this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]]['id']);}var _0x5d93d2=_[_0xa9c5('0x13f')](_0x130c9a);_0x5d93d2[_0xa9c5('0x140')]=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));var _0x20454c=_0x4dde67[_0xa9c5('0x12')][_0x130c9a[_0xa9c5('0x70')]];if(ut[_0xa9c5('0x141')](_0x53b2f1[_0xa9c5('0x142')])){if(_0x130c9a[_0xa9c5('0xc4')]){rpcDb['unlockContact'](_0x130c9a[_0xa9c5('0x143')]);}if(_0x130c9a['activeContact']){rpcDb[_0xa9c5('0x8c')](_0x130c9a[_0xa9c5('0x143')]);}ami[_0xa9c5('0x5e')](_0xa9c5('0x144'),ut[_0xa9c5('0xa4')](_0x130c9a,_0xa9c5('0x145'),this['campaignsPreview'][_0x130c9a[_0xa9c5('0x70')]]));this['callProgressDetectingAgent'](_0x5d93d2,_0x20454c,_0x53b2f1);}else{_0x130c9a[_0xa9c5('0x8d')]=moment()['format'](_0xa9c5('0x8e'));ut[_0xa9c5('0xf8')](_0x5d93d2,0x4,_0xa9c5('0xb9'));rpcDb[_0xa9c5('0xf4')](_0x5d93d2,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x21fa3e){var _0x4d19fe=this;var _0x45fa29=this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]];var _0x40ddd5;if(_0x45fa29){_0x40ddd5=this['campaignsPreview'][_0x45fa29['queue']];logger['info'](_0xa9c5('0x146'),_0x21fa3e['linkedid'],_0xa9c5('0xb4'),_0x40ddd5[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x40ddd5[_0xa9c5('0x2d')]);}if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]&&_0x21fa3e['linkedid']!==_0x21fa3e[_0xa9c5('0xb3')]){if(_0x21fa3e[_0xa9c5('0x147')]==='16'&&this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]['dialAnswer']){this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e['cause']);}else if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]['dialAnswer']){logger[_0xa9c5('0x5a')](_0xa9c5('0x149'),_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')],_0xa9c5('0xb4'),_0x40ddd5[_0xa9c5('0x2a')],'pTalking:\x20',_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')]);}}else if(_0x45fa29&&_[_0xa9c5('0x6d')](_0x45fa29[_0xa9c5('0x14a')])&&_0x40ddd5[_0xa9c5('0x14b')]&&_0x21fa3e[_0xa9c5('0xaf')]===_0x21fa3e[_0xa9c5('0xb3')]&&_[_0xa9c5('0x6d')](_0x21fa3e[_0xa9c5('0xf3')])&&_0x21fa3e['cause']==='16'&&_0x21fa3e['channelstate']==='6'&&_['isUndefined'](_0x45fa29[_0xa9c5('0x14c')])){if(_0x45fa29['unlockAgent']){rpcDb[_0xa9c5('0x114')](_0x45fa29['idContact']);}if(_0x45fa29[_0xa9c5('0xae')]){rpcDb[_0xa9c5('0x8c')](_0x45fa29[_0xa9c5('0x143')]);}_0x21fa3e['reason']='22';this['callProgressDetectingAgent'](_0x45fa29,_0x40ddd5,_0x21fa3e);}else if(_0x45fa29&&_0x45fa29[_0xa9c5('0x14c')]){if(_0x21fa3e[_0xa9c5('0x147')]==='16'&&this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){logger['info'](_0xa9c5('0x14d'),_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')],_0xa9c5('0xb4'),_0x40ddd5['name'],'pTalking:\x20',_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')]);}else if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){logger[_0xa9c5('0x5a')](_0xa9c5('0x149'),_0x21fa3e[_0xa9c5('0xaf')],_0x21fa3e[_0xa9c5('0x147')],'\x20Queue',_0x40ddd5[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e[_0xa9c5('0xaf')],_0x21fa3e['cause']);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x1f')]=function(_0x4db22d){if(this[_0xa9c5('0x15')][_0x4db22d[_0xa9c5('0xef')]]&&_0x4db22d[_0xa9c5('0xef')]!==_0x4db22d['destuniqueid']){this[_0xa9c5('0x148')](_0x4db22d,_0x4db22d['destlinkedid'],_0x4db22d[_0xa9c5('0xe4')]);}};Preview[_0xa9c5('0x68')][_0xa9c5('0x1e')]=function(_0x1def15){if(this[_0xa9c5('0x15')][_0x1def15[_0xa9c5('0xaf')]]&&_0x1def15[_0xa9c5('0xaf')]!==_0x1def15['uniqueid']&&!this['actions'][_0x1def15[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){if(_0x1def15[_0xa9c5('0x147')]==='1'){this[_0xa9c5('0x148')](_0x1def15,_0x1def15['linkedid'],_0x1def15[_0xa9c5('0x147')]);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x14e')]=function(_0x90b498,_0x314f21,_0x4e1931){if(this[_0xa9c5('0x15')][_0x90b498]){if(_[_0xa9c5('0x6d')](this[_0xa9c5('0x15')][_0x90b498][_0xa9c5('0x14f')])){this[_0xa9c5('0x15')][_0x90b498][_0xa9c5('0x14f')]={};}this['actions'][_0x90b498]['variables'][_0x314f21]=_0x4e1931;}};Preview[_0xa9c5('0x68')][_0xa9c5('0x22')]=function(_0x7698d5){try{if(!_['isNil'](_0x7698d5)){if(ut['filterKey'](_[_0xa9c5('0x150')](_0x7698d5[_0xa9c5('0x151')])[0x0])){this[_0xa9c5('0x14e')](_0x7698d5[_0xa9c5('0xb3')],_['keys'](_0x7698d5[_0xa9c5('0x151')])[0x0],_0x7698d5['value']);}}}catch(_0xc1126c){logger[_0xa9c5('0x152')]('[syncVarSet][Preview]',util[_0xa9c5('0x153')](_0xc1126c,{'showHidden':![],'depth':null}));}};Preview[_0xa9c5('0x68')][_0xa9c5('0x24')]=function(_0x440f3d){if(_0x440f3d){if(this[_0xa9c5('0x15')][_0x440f3d['transfertargetlinkedid']]){this[_0xa9c5('0x15')][_0x440f3d['transfertargetlinkedid']]['transfer']=!![];}}};Preview['prototype'][_0xa9c5('0x26')]=function(_0x4be8cd){if(_0x4be8cd){if(this[_0xa9c5('0x15')][_0x4be8cd[_0xa9c5('0x154')]]){this[_0xa9c5('0x15')][_0x4be8cd[_0xa9c5('0x154')]][_0xa9c5('0x14c')]=!![];}}};module[_0xa9c5('0x155')]=Preview; \ No newline at end of file +var _0x17ba=['linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','acw','custom:agentConnectPreview','custom:agentcomplete','complete','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','countbusyretry','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','Global','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[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]','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','actionid','clone','responsetime','isFailure','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','value','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','available','pTalking','sumBillable','talking','total','unmanaged','abandoned','waiting','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','emit','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','info','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','RecallInQueue','createBody','createCustomerHistory','logCustomer','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','unlockAgent'];(function(_0x4fa3b3,_0x4e5556){var _0xfa7ac1=function(_0x2b7718){while(--_0x2b7718){_0x4fa3b3['push'](_0x4fa3b3['shift']());}};_0xfa7ac1(++_0x4e5556);}(_0x17ba,0xab));var _0xa17b=function(_0x3ea564,_0x50ed33){_0x3ea564=_0x3ea564-0x0;var _0x448142=_0x17ba[_0x3ea564];return _0x448142;};'use strict';var util=require(_0xa17b('0x0'));var _=require(_0xa17b('0x1'));var BPromise=require('bluebird');var uuid=require(_0xa17b('0x2'));var moment=require(_0xa17b('0x3'));var md5=require(_0xa17b('0x4'));var Redis=require(_0xa17b('0x5'));var config=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var loggerAction=require(_0xa17b('0x7'))(_0xa17b('0x9'));var ami=require(_0xa17b('0xa'));var rpcDb=require(_0xa17b('0xb'));var Action=require(_0xa17b('0xc'));var ut=require(_0xa17b('0xd'));config[_0xa17b('0xe')]=_[_0xa17b('0xf')](config[_0xa17b('0xe')],{'host':_0xa17b('0x10'),'port':0x18eb});var io=require(_0xa17b('0x11'))(new Redis(config[_0xa17b('0xe')]));var Sequence=function(){};Sequence['prototype'][_0xa17b('0x12')]=function(_0x38b8f1){this[_0xa17b('0x13')]=this[_0xa17b('0x13')]?this[_0xa17b('0x13')][_0xa17b('0x14')](_0x38b8f1):_0x38b8f1();};function Preview(_0xc5ef2e){this['sequence']=new Sequence();this[_0xa17b('0x15')]=_0xc5ef2e[_0xa17b('0x16')];this[_0xa17b('0x17')]=_0xc5ef2e['trunks'];this[_0xa17b('0x18')]={};this[_0xa17b('0x19')]=_0xc5ef2e[_0xa17b('0x19')];this[_0xa17b('0x1a')]=0x0;ami['on']('originateresponse',this[_0xa17b('0x1b')]['bind'](this));ami['on'](_0xa17b('0x1c'),this[_0xa17b('0x1d')]['bind'](this));ami['on'](_0xa17b('0x1e'),this[_0xa17b('0x1f')][_0xa17b('0x20')](this));ami['on'](_0xa17b('0x21'),this['syncDialEnd'][_0xa17b('0x20')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xa17b('0x22'),this[_0xa17b('0x23')]['bind'](this));ami['on'](_0xa17b('0x24'),this[_0xa17b('0x25')][_0xa17b('0x20')](this));ami['on'](_0xa17b('0x26'),this[_0xa17b('0x27')][_0xa17b('0x20')](this));this[_0xa17b('0x28')](this['campaignsPreview']);}function emit(_0x610c2b,_0x3f409a,_0x45bd0c){io['to'](_0x610c2b)['emit'](_0x3f409a,_0x45bd0c);}function emitCampaignPreview(_0x44f7bc){if(_0x44f7bc[_0xa17b('0x29')]===_0xa17b('0x2a')){var _0xbbbb62={'id':_0x44f7bc['id'],'name':_0x44f7bc[_0xa17b('0x2b')],'strategy':_0x44f7bc[_0xa17b('0x2c')],'answered':_0x44f7bc['answered'],'available':_0x44f7bc[_0xa17b('0x2d')],'loggedIn':_0x44f7bc['loggedIn'],'pTalking':_0x44f7bc[_0xa17b('0x2e')],'sumBillable':_0x44f7bc[_0xa17b('0x2f')],'sumDuration':_0x44f7bc['sumDuration'],'sumHoldTime':_0x44f7bc['sumHoldTime']||0x0,'talking':_0x44f7bc[_0xa17b('0x30')],'total':_0x44f7bc[_0xa17b('0x31')],'type':_0x44f7bc[_0xa17b('0x29')],'unmanaged':_0x44f7bc[_0xa17b('0x32')],'abandoned':_0x44f7bc[_0xa17b('0x33')],'waiting':_0x44f7bc[_0xa17b('0x34')],'loggedInDb':_0x44f7bc['loggedInDb'],'dialActive':_0x44f7bc['dialActive'],'dialMethod':_0x44f7bc['dialMethod'],'dialOriginateCallerIdName':_0x44f7bc['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x44f7bc[_0xa17b('0x35')],'dialOriginateTimeout':_0x44f7bc['dialOriginateTimeout'],'dialPrefix':_0x44f7bc[_0xa17b('0x36')],'outboundAnswerAgiCallsDay':_0x44f7bc['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x44f7bc[_0xa17b('0x37')],'outboundBlacklistCallsDay':_0x44f7bc[_0xa17b('0x38')],'outboundBusyCallsDay':_0x44f7bc[_0xa17b('0x39')],'outboundCongestionCallsDay':_0x44f7bc[_0xa17b('0x3a')],'outboundDropCallsDayACS':_0x44f7bc[_0xa17b('0x3b')],'outboundDropCallsDayCallersExit':_0x44f7bc[_0xa17b('0x3c')],'outboundDropCallsDayTimeout':_0x44f7bc[_0xa17b('0x3d')],'outboundNoAnswerCallsDay':_0x44f7bc[_0xa17b('0x3e')],'outboundNoSuchCallsDay':_0x44f7bc[_0xa17b('0x3f')],'outboundOriginateFailureCallsDay':_0x44f7bc[_0xa17b('0x40')],'outboundReCallsDay':_0x44f7bc[_0xa17b('0x41')],'outboundRejectCallsDay':_0x44f7bc['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x44f7bc['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x44f7bc['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x44f7bc[_0xa17b('0x42')],'predictiveIntervalAvgHoldtime':_0x44f7bc[_0xa17b('0x43')],'predictiveIntervalAvgTalktime':_0x44f7bc[_0xa17b('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x44f7bc[_0xa17b('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x44f7bc[_0xa17b('0x46')],'predictiveIntervalErlangCalls':_0x44f7bc[_0xa17b('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x44f7bc[_0xa17b('0x48')],'predictiveIntervalHitRate':_0x44f7bc[_0xa17b('0x49')],'predictiveIntervalMultiplicativeFactor':_0x44f7bc['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x44f7bc[_0xa17b('0x4a')],'predictiveIntervalAvailable':_0x44f7bc['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x44f7bc[_0xa17b('0x4b')],'message':_0x44f7bc[_0xa17b('0x4c')],'originated':_0x44f7bc[_0xa17b('0x4d')],'erlangCalls':_0x44f7bc[_0xa17b('0x4e')],'erlangCallToSecond':_0x44f7bc[_0xa17b('0x4f')],'erlangAbandonmentRate':_0x44f7bc[_0xa17b('0x50')],'erlangBusyFactor':_0x44f7bc['erlangBusyFactor'],'startPredictive':_0x44f7bc[_0xa17b('0x51')],'startProgressive':_0x44f7bc[_0xa17b('0x52')]};if(_0x44f7bc[_0xa17b('0x53')]){_0xbbbb62[_0xa17b('0x53')]={'id':_0x44f7bc[_0xa17b('0x53')]['id'],'name':_0x44f7bc['Trunk'][_0xa17b('0x2b')],'active':_0x44f7bc['Trunk'][_0xa17b('0x54')],'callerid':_0x44f7bc['Trunk'][_0xa17b('0x55')]};}if(_0x44f7bc[_0xa17b('0x56')]){_0xbbbb62['Interval']={'id':_0x44f7bc[_0xa17b('0x56')]['id'],'name':_0x44f7bc[_0xa17b('0x56')]['name']};}var _0x2fb380=md5(JSON[_0xa17b('0x57')](_0xbbbb62));if(_0x44f7bc[_0xa17b('0x4')]!==_0x2fb380){_0x44f7bc[_0xa17b('0x4')]=_0x2fb380;emit(util[_0xa17b('0x58')]('voice:queue:%s',_0xbbbb62[_0xa17b('0x2b')]),'voice_queue:save',_0xbbbb62);}}}function emitVoiceQueueChannelRemove(_0x26786d){logger['info'](_0xa17b('0x59'),JSON['stringify'](_0x26786d));emit(util[_0xa17b('0x58')]('voice:queue:%s',_0x26786d[_0xa17b('0x2b')]),'voice_queue_channel:remove',_0x26786d);io[_0xa17b('0x5a')](_0xa17b('0x5b'),_0x26786d);}function notSendMessagesQueue(_0x5bfb5){if(_0x5bfb5[_0xa17b('0x5c')]){if(_0x5bfb5[_0xa17b('0x4d')]===0x0&&_0x5bfb5[_0xa17b('0x2e')]===0x0){_0x5bfb5[_0xa17b('0x5c')]=![];_0x5bfb5[_0xa17b('0x2d')]=0x0;_0x5bfb5['paused']=0x0;_0x5bfb5[_0xa17b('0x4c')]=_0xa17b('0x5d');ut['logger'](_0xa17b('0x5e'),_0x5bfb5[_0xa17b('0x2b')]+_0xa17b('0x5f'));}else{_0x5bfb5[_0xa17b('0x4c')]=_0xa17b('0x60');ut[_0xa17b('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5bfb5[_0xa17b('0x2b')]+_0xa17b('0x62'));}emitCampaignPreview(_0x5bfb5);}}Preview[_0xa17b('0x63')]['loopCampaigns']=function(){var _0x54b65c=this;setInterval(function(){_0x54b65c['syncCampaigns']();},0x7cf);};Preview[_0xa17b('0x63')][_0xa17b('0x64')]=function(){var _0x3c2788=this[_0xa17b('0x15')];this[_0xa17b('0x1a')]+=0x1;for(var _0x315424 in _0x3c2788){if(_0x3c2788[_0xa17b('0x65')](_0x315424)&&(_0x3c2788[_0x315424][_0xa17b('0x66')]===_0xa17b('0x8')||_0x3c2788[_0x315424][_0xa17b('0x66')]===_0xa17b('0x67'))&&_0x3c2788[_0x315424][_0xa17b('0x29')]==='outbound'){if(this[_0xa17b('0x1a')]>0x7){this[_0xa17b('0x1a')]=0x0;this[_0xa17b('0x68')]();}}if(_0x3c2788[_0xa17b('0x65')](_0x315424)&&_0x3c2788[_0x315424][_0xa17b('0x66')]===_0xa17b('0x8')&&_0x3c2788[_0x315424]['type']===_0xa17b('0x2a')){if(_0x3c2788[_0x315424][_0xa17b('0x69')]){this[_0xa17b('0x6a')](_0x3c2788[_0x315424]);if(_0x3c2788[_0x315424][_0xa17b('0x6b')])this[_0xa17b('0x6c')](_0x3c2788[_0x315424]);}else{notSendMessagesQueue(_0x3c2788[_0x315424]);}}}};Preview['prototype'][_0xa17b('0x6d')]=function(_0x21a61e){var _0x2b4831=this;this[_0xa17b('0x6e')]['enqueue'](function(){if(!_[_0xa17b('0x6f')](_0x2b4831[_0xa17b('0x18')][_0x21a61e])){loggerAction[_0xa17b('0x70')](_0xa17b('0x71'),_0x21a61e,_0xa17b('0x72'),_0x2b4831[_0xa17b('0x18')][_0x21a61e][_0xa17b('0x73')],'originated:\x20',JSON[_0xa17b('0x57')](_0x2b4831[_0xa17b('0x15')][_0x2b4831['actions'][_0x21a61e][_0xa17b('0x73')]][_0xa17b('0x4d')]),_0xa17b('0x74'),JSON['stringify'](_0x2b4831[_0xa17b('0x15')][_0x2b4831[_0xa17b('0x18')][_0x21a61e]['queue']][_0xa17b('0x2e')]),JSON[_0xa17b('0x57')](_0x2b4831['actions'][_0x21a61e][_0xa17b('0x75')]),JSON[_0xa17b('0x57')](_['pick'](_0x2b4831[_0xa17b('0x18')][_0x21a61e],[_0xa17b('0x76'),_0xa17b('0x77'),_0xa17b('0x78'),_0xa17b('0x79')])));return ami[_0xa17b('0x7a')]({'action':_0xa17b('0x7b'),'channel':_0x2b4831['actions'][_0x21a61e][_0xa17b('0x7c')]})[_0xa17b('0x7d')](function(_0x620a4a){if(_0x620a4a[_0xa17b('0x4c')]===_0xa17b('0x7e')){setTimeout(function(){if(_0x2b4831[_0xa17b('0x18')][_0x21a61e]){ut[_0xa17b('0x7f')](_0x2b4831[_0xa17b('0x15')][_0x2b4831[_0xa17b('0x18')][_0x21a61e][_0xa17b('0x73')]],_0xa17b('0x80'));if(_0x2b4831[_0xa17b('0x18')][_0x21a61e][_0xa17b('0x75')]===!![]){ut['decrementTalkink'](_0x2b4831[_0xa17b('0x15')][_0x2b4831[_0xa17b('0x18')][_0x21a61e][_0xa17b('0x73')]],_0xa17b('0x80'));ut[_0xa17b('0x81')](_0xa17b('0x82')+_0x21a61e,_0x2b4831[_0xa17b('0x18')][_0x21a61e][_0xa17b('0x73')]);}ut[_0xa17b('0x81')]('[Dialer][checkChannel][Preview]'+_0x21a61e,_0x2b4831['actions'][_0x21a61e][_0xa17b('0x73')]);delete _0x2b4831[_0xa17b('0x18')][_0x21a61e];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x4adfbd=this;loggerAction[_0xa17b('0x70')](_0xa17b('0x83'),_[_0xa17b('0x84')](this[_0xa17b('0x18')]));for(var _0x301019 in this[_0xa17b('0x18')]){if(_0x4adfbd['actions']['hasOwnProperty'](_0x301019)){_0x4adfbd['clearZombieChannel'](_0x301019);}}};Preview['prototype']['recallMe']=function(_0x2a62e4){var _0x172479=this;rpcDb[_0xa17b('0x85')](_0x2a62e4['id'],ut[_0xa17b('0x86')](this[_0xa17b('0x19')]))[_0xa17b('0x87')](function(_0x3270a0){if(!_['isNil'](_0x3270a0)){for(var _0x3e739a=0x0;_0x3e739a<_0x3270a0[_0xa17b('0x88')];_0x3e739a+=0x1){if(ut[_0xa17b('0x89')](_0x3270a0[_0x3e739a][_0xa17b('0x8a')])<_0x2a62e4[_0xa17b('0x8b')]*0x3c){if(_0x3270a0[_0x3e739a][_0xa17b('0x8c')]&&!_0x3270a0[_0x3e739a][_0xa17b('0x8c')][_0xa17b('0x8d')]){_0x172479[_0xa17b('0x8e')](_0x3270a0[_0x3e739a]['id'])[_0xa17b('0x87')](ut[_0xa17b('0x8f')](_0xa17b('0x90')))['catch'](ut[_0xa17b('0x8f')]('[RecallMe]'));}else{rpcDb[_0xa17b('0x91')](_0x3270a0[_0x3e739a]['id']);}}else{var _0x290e04=new Action(_0x3270a0[_0x3e739a],_0x2a62e4);_0x290e04[_0xa17b('0x92')]=moment()[_0xa17b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a62e4[_0xa17b('0x41')]+=0x1;ut['logCustomer'](_0x290e04,0x17,_0xa17b('0x93'));if(_0x2a62e4['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0xa17b('0x94')](_0x3270a0[_0x3e739a]));rpcDb[_0xa17b('0x95')](_0x290e04,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xa17b('0x96')](_0x290e04,0x16,_0xa17b('0x97'));rpcDb['createCustomerHistory'](_0x290e04,'[HistoryRecallClose]');rpcDb[_0xa17b('0x98')](_0x290e04,_0xa17b('0x99'));}}}}})['catch'](ut[_0xa17b('0x8f')](_0xa17b('0x9a')));};Preview['prototype'][_0xa17b('0x6a')]=function(_0x3ad933){_0x3ad933[_0xa17b('0x5c')]=!![];if(ut[_0xa17b('0x9b')](_0x3ad933[_0xa17b('0x9c')])){_0x3ad933['message']=_0xa17b('0x9d');}else if(!ut[_0xa17b('0x9e')](_0x3ad933[_0xa17b('0x69')])){_0x3ad933[_0xa17b('0x4c')]=_0xa17b('0x5d');}else if(!this[_0xa17b('0x9f')](_0x3ad933[_0xa17b('0x53')])){if(!this[_0xa17b('0x9f')](_0x3ad933[_0xa17b('0xa0')])){_0x3ad933[_0xa17b('0x4c')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3ad933[_0xa17b('0x4c')]=_0xa17b('0xa1');}}else{_0x3ad933['message']='ACTIVE';}emitCampaignPreview(_0x3ad933);};Preview[_0xa17b('0x63')][_0xa17b('0xa2')]=function(_0x2d426a,_0x1b5f10,_0xa6a240){var _0x4d9716=this;var _0xf8ae5e=this[_0xa17b('0x18')][_0x1b5f10];var _0x42e548=this[_0xa17b('0x15')][_0xf8ae5e['queue']];var _0x29b023;if(_0x42e548){switch(_0xa6a240){case'1':_0x42e548['outboundNoSuchCallsDay']+=0x1;_0xf8ae5e[_0xa17b('0xa3')]+=0x1;_0xf8ae5e[_0xa17b('0xa4')]=ut[_0xa17b('0xa5')](_0xf8ae5e);ut[_0xa17b('0x96')](_0xf8ae5e,0x0,_0xa17b('0xa6'));ami['emit'](_0xa17b('0xa7'),ut[_0xa17b('0xa8')](_0xf8ae5e,_0xa17b('0xa9')));rpcDb[_0xa17b('0x95')](_0xf8ae5e,_0xa17b('0xaa'));if(ut['totalGlobal'](_0xf8ae5e)>=_0x42e548[_0xa17b('0xab')]){_0x29b023=ut[_0xa17b('0xac')](_0xf8ae5e,0xf,'Global');rpcDb[_0xa17b('0x98')](_0x29b023,_0xa17b('0xad'));}else{if(_0xf8ae5e['countnosuchnumberretry']>=_0x42e548['dialNoSuchNumberMaxRetry']){rpcDb[_0xa17b('0x98')](_0xf8ae5e,_0xa17b('0xad'));}else{rpcDb[_0xa17b('0xae')](ut['scheduledAt'](_0xf8ae5e,'countnosuchnumberretry',_0x42e548['dialNoSuchNumberRetryFrequency']),_0xf8ae5e[_0xa17b('0xaf')],_0xf8ae5e['activeContact']);}}delete this[_0xa17b('0x18')][_0x2d426a[_0xa17b('0xb0')]];break;case _0xa17b('0xb1'):var _0x42f7bc=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xf8ae5e['responsetime']=_0x42f7bc;_0xf8ae5e[_0xa17b('0xb2')]=_0x42f7bc;_0xf8ae5e[_0xa17b('0x75')]=!![];_0x42e548[_0xa17b('0x2e')]+=0x1;logger[_0xa17b('0x70')](_0xa17b('0xb3'),_0xf8ae5e[_0xa17b('0xb4')],_0xa17b('0xb5'),_0x42e548[_0xa17b('0x2b')],_0xa17b('0x74'),_0x42e548['pTalking']);ami[_0xa17b('0x5a')]('custom:agentconnect',ut[_0xa17b('0xa8')](_0xf8ae5e,'connect',this[_0xa17b('0x15')][_0xf8ae5e[_0xa17b('0x73')]]));if(_0x42e548[_0xa17b('0xb6')]){ami['emit'](_0xa17b('0xb7'),ut['buildAcw'](_0xf8ae5e));}break;case'16':ami[_0xa17b('0x5a')](_0xa17b('0xb8'),ut[_0xa17b('0xa8')](_0xf8ae5e,'complete',this[_0xa17b('0x15')][_0xf8ae5e[_0xa17b('0x73')]]));emitVoiceQueueChannelRemove(ut[_0xa17b('0xa8')](_0xf8ae5e,_0xa17b('0xb9')));_0x42e548[_0xa17b('0x37')]+=0x1;_0x42e548['total']+=0x1;_0x42e548[_0xa17b('0xba')]+=0x1;ut[_0xa17b('0xbb')](_0x42e548,_0xa17b('0xbc'));_0xf8ae5e[_0xa17b('0xa4')]=ut[_0xa17b('0xa5')](_0xf8ae5e);ut['logCustomer'](_0xf8ae5e,0x4,_0xa17b('0xbd'));rpcDb[_0xa17b('0x95')](_0xf8ae5e,_0xa17b('0xbe'));rpcDb['createCustomerFinal'](_0xf8ae5e,_0xa17b('0xbf'));rpcDb[_0xa17b('0xc0')](_0xf8ae5e);_0x42e548[_0xa17b('0xc1')]+=_0xf8ae5e[_0xa17b('0xc2')];_0x42e548[_0xa17b('0x2f')]+=_0xf8ae5e[_0xa17b('0xc2')];logger[_0xa17b('0x70')](_0xa17b('0xc3'),_0xf8ae5e[_0xa17b('0xb4')],_0xa17b('0xb5'),_0x42e548['name'],_0xa17b('0x74'),_0x42e548['pTalking']);delete this['actions'][_0x2d426a[_0xa17b('0xb0')]];break;case _0xa17b('0xc4'):_0x42e548[_0xa17b('0x39')]+=0x1;_0xf8ae5e['countbusyretry']+=0x1;_0xf8ae5e[_0xa17b('0xa4')]=ut[_0xa17b('0xa5')](_0xf8ae5e);ut[_0xa17b('0x96')](_0xf8ae5e,0x5,_0xa17b('0xc5'));ami[_0xa17b('0x5a')](_0xa17b('0xc6'),ut[_0xa17b('0xa8')](_0xf8ae5e,_0xa17b('0xc7')));rpcDb['createCustomerHistory'](_0xf8ae5e,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xa17b('0xa5')](_0xf8ae5e)>=_0x42e548['dialGlobalMaxRetry']){_0x29b023=ut[_0xa17b('0xac')](_0xf8ae5e,0xf,'Global');rpcDb['createCustomerFinal'](_0x29b023,_0xa17b('0xc8'));}else{if(_0xf8ae5e['countbusyretry']>=_0x42e548[_0xa17b('0xc9')]){rpcDb[_0xa17b('0x98')](_0xf8ae5e,_0xa17b('0xca'));}else{rpcDb[_0xa17b('0xae')](ut[_0xa17b('0xcb')](_0xf8ae5e,_0xa17b('0xcc'),_0x42e548[_0xa17b('0xcd')]),_0xf8ae5e[_0xa17b('0xaf')],_0xf8ae5e[_0xa17b('0xce')]);}}break;case _0xa17b('0xcf'):_0x42e548[_0xa17b('0x3e')]+=0x1;_0xf8ae5e[_0xa17b('0xd0')]+=0x1;_0xf8ae5e[_0xa17b('0xa4')]=ut[_0xa17b('0xa5')](_0xf8ae5e);ut[_0xa17b('0x96')](_0xf8ae5e,0x3,_0xa17b('0xd1'));ami['emit']('custom:agentnoanswer',ut['buildObj'](_0xf8ae5e,_0xa17b('0xd2')));rpcDb['createCustomerHistory'](_0xf8ae5e,_0xa17b('0xd3'));if(ut[_0xa17b('0xa5')](_0xf8ae5e)>=_0x42e548['dialGlobalMaxRetry']){_0x29b023=ut[_0xa17b('0xac')](_0xf8ae5e,0xf,'Global');rpcDb[_0xa17b('0x98')](_0x29b023,_0xa17b('0xd4'));}else{if(_0xf8ae5e[_0xa17b('0xd0')]>=_0x42e548[_0xa17b('0xd5')]){rpcDb[_0xa17b('0x98')](_0xf8ae5e,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xa17b('0xcb')](_0xf8ae5e,_0xa17b('0xd0'),_0x42e548[_0xa17b('0xd6')]),_0xf8ae5e[_0xa17b('0xaf')],_0xf8ae5e[_0xa17b('0xce')]);}}break;case _0xa17b('0xd7'):_0x42e548[_0xa17b('0x3a')]+=0x1;_0xf8ae5e[_0xa17b('0xd8')]+=0x1;_0xf8ae5e[_0xa17b('0xa4')]=ut[_0xa17b('0xa5')](_0xf8ae5e);ut['logCustomer'](_0xf8ae5e,0x8,_0xa17b('0xd9'));ami[_0xa17b('0x5a')](_0xa17b('0xda'),ut['buildObj'](_0xf8ae5e,_0xa17b('0xdb')));rpcDb[_0xa17b('0x95')](_0xf8ae5e,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xa17b('0xa5')](_0xf8ae5e)>=_0x42e548[_0xa17b('0xab')]){_0x29b023=ut[_0xa17b('0xac')](_0xf8ae5e,0xf,_0xa17b('0xdc'));rpcDb[_0xa17b('0x98')](_0x29b023,_0xa17b('0xdd'));}else{if(_0xf8ae5e['countcongestionretry']>=_0x42e548[_0xa17b('0xde')]){rpcDb[_0xa17b('0x98')](_0xf8ae5e,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xa17b('0xae')](ut[_0xa17b('0xcb')](_0xf8ae5e,_0xa17b('0xd8'),_0x42e548[_0xa17b('0xcd')]),_0xf8ae5e[_0xa17b('0xaf')],_0xf8ae5e[_0xa17b('0xce')]);}}break;case _0xa17b('0xdf'):_0x42e548['outboundRejectCallsDay']+=0x1;_0xf8ae5e[_0xa17b('0xe0')]+=0x1;_0xf8ae5e[_0xa17b('0xa4')]=ut[_0xa17b('0xa5')](_0xf8ae5e);ut['logCustomer'](_0xf8ae5e,0x14,'AgentReject');ami[_0xa17b('0x5a')]('custom:agentreject',ut['buildObj'](_0xf8ae5e,'agentreject'));rpcDb[_0xa17b('0x95')](_0xf8ae5e,_0xa17b('0xe1'));if(ut[_0xa17b('0xa5')](_0xf8ae5e)>=_0x42e548[_0xa17b('0xab')]){_0x29b023=ut[_0xa17b('0xac')](_0xf8ae5e,0x14,'AgentReject');rpcDb[_0xa17b('0x98')](_0x29b023,_0xa17b('0xe2'));}else{if(_0xf8ae5e[_0xa17b('0xe0')]>=_0x42e548[_0xa17b('0xe3')]){rpcDb['createCustomerFinal'](_0xf8ae5e,_0xa17b('0xe2'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0xf8ae5e,'countagentrejectretry',_0x42e548[_0xa17b('0xe4')]),_0xf8ae5e['unlockAgent'],_0xf8ae5e[_0xa17b('0xce')]);}}break;case _0xa17b('0xe5'):_0x42e548['outboundAbandonedCallsDay']+=0x1;_0xf8ae5e[_0xa17b('0xe6')]+=0x1;_0xf8ae5e[_0xa17b('0xa4')]=ut['totalGlobal'](_0xf8ae5e);ut[_0xa17b('0x96')](_0xf8ae5e,0xb,'Abandoned');rpcDb[_0xa17b('0x95')](_0xf8ae5e,_0xa17b('0xe7'));if(ut[_0xa17b('0xa5')](_0xf8ae5e)>=_0x42e548[_0xa17b('0xab')]){_0x29b023=ut['cloneAction'](_0xf8ae5e,0xf,_0xa17b('0xdc'));rpcDb[_0xa17b('0x98')](_0x29b023,_0xa17b('0xe7'));}else{if(_0xf8ae5e[_0xa17b('0xe8')]>=_0x42e548['dialAbandonedMaxRety']){rpcDb[_0xa17b('0x98')](_0xf8ae5e,_0xa17b('0xe7'));}else{rpcDb['rescheduleContact'](ut[_0xa17b('0xcb')](_0xf8ae5e,_0xa17b('0xe6'),_0x42e548[_0xa17b('0xe9')]),_0xf8ae5e[_0xa17b('0xaf')],_0xf8ae5e['activeContact']);}}break;case'18':_0x42e548[_0xa17b('0xea')]+=0x1;_0xf8ae5e['countmachineretry']+=0x1;_0xf8ae5e[_0xa17b('0xa4')]=ut[_0xa17b('0xa5')](_0xf8ae5e);ut[_0xa17b('0x96')](_0xf8ae5e,0x12,_0x2d426a['cause-txt']||_0x2d426a[_0xa17b('0xeb')]);ami[_0xa17b('0x5a')](_0xa17b('0xec'),ut[_0xa17b('0xa8')](_0xf8ae5e,_0xa17b('0xed')));rpcDb[_0xa17b('0x95')](_0xf8ae5e,_0xa17b('0xee'));if(ut[_0xa17b('0xa5')](_0xf8ae5e)>=_0x42e548[_0xa17b('0xab')]){_0x29b023=ut['cloneAction'](_0xf8ae5e,0xf,_0xa17b('0xdc'));rpcDb[_0xa17b('0x98')](_0x29b023,_0xa17b('0xee'));}else{rpcDb[_0xa17b('0x98')](_0xf8ae5e,'[callProgressDetectingCustomer][hangupInAMD]');}delete this['actions'][_0x2d426a['linkedid']];break;case'19':_0x42e548[_0xa17b('0xea')]+=0x1;_0xf8ae5e['countglobal']=ut[_0xa17b('0xa5')](_0xf8ae5e);ut[_0xa17b('0x96')](_0xf8ae5e,0x13,_0x2d426a['cause-txt']||_0x2d426a[_0xa17b('0xeb')]);ami[_0xa17b('0x5a')](_0xa17b('0xec'),ut['buildObj'](_0xf8ae5e,_0xa17b('0xed')));rpcDb['createCustomerHistory'](_0xf8ae5e,'[callProgressDetectingCustomer][machine]');if(ut[_0xa17b('0xa5')](_0xf8ae5e)>=_0x42e548[_0xa17b('0xab')]){_0x29b023=ut[_0xa17b('0xac')](_0xf8ae5e,0xf,'Global');rpcDb[_0xa17b('0x98')](_0x29b023,_0xa17b('0xef'));}else{rpcDb[_0xa17b('0x98')](_0xf8ae5e,_0xa17b('0xef'));}delete this[_0xa17b('0x18')][_0x2d426a[_0xa17b('0xb0')]];break;default:if(_0xf8ae5e[_0xa17b('0x75')]){ut[_0xa17b('0xbb')](_0x42e548,'[default]');ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x42e548['name'],_0x2d426a);}_0x42e548['outboundUnknownCallsDay']+=0x1;_0xf8ae5e[_0xa17b('0xa4')]=ut[_0xa17b('0xa5')](_0xf8ae5e);ut['logCustomer'](_0xf8ae5e,0xc,_0x2d426a[_0xa17b('0xf0')]||_0x2d426a[_0xa17b('0xeb')]);rpcDb[_0xa17b('0x95')](_0xf8ae5e,_0xa17b('0xf1'));if(ut[_0xa17b('0xa5')](_0xf8ae5e)>=_0x42e548[_0xa17b('0xab')]){_0x29b023=ut[_0xa17b('0xac')](_0xf8ae5e,0xf,_0xa17b('0xdc'));rpcDb[_0xa17b('0x98')](_0x29b023,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0xf8ae5e,_0xa17b('0xf2'));}delete this[_0xa17b('0x18')][_0x2d426a[_0xa17b('0xb0')]];}if(!(_0xf8ae5e[_0xa17b('0x75')]&&_0xa6a240==='16')){ut[_0xa17b('0x7f')](_0x42e548,_0xa17b('0xf3'));logger[_0xa17b('0x70')](_0xa17b('0xf4'),_0xf8ae5e[_0xa17b('0xb4')],_0xa17b('0xb5'),_0x42e548[_0xa17b('0x2b')],'originated:\x20',_0x42e548['originated']);}if(_0xa6a240!=='ANSWER'){delete this[_0xa17b('0x18')][_0x2d426a[_0xa17b('0xb0')]];delete this[_0xa17b('0x18')][_0x2d426a[_0xa17b('0xf5')]];}}};Preview['prototype'][_0xa17b('0xf6')]=function(_0x34fbb1,_0x48af6e,_0x19bb68){if(_[_0xa17b('0xf7')](_0x48af6e)&&_0xa17b('0xf8')!==typeof _0x48af6e){return;}if(_[_0xa17b('0xf7')](_0x19bb68)&&_0xa17b('0xf8')!==typeof _0x19bb68){return;}switch(_0x19bb68[_0xa17b('0xf9')]){case'0':ut[_0xa17b('0xfa')](_0x34fbb1,0x0,_0xa17b('0xa6'));rpcDb[_0xa17b('0xfb')](_0x34fbb1,_0xa17b('0xfc'));break;case'3':ut[_0xa17b('0xfa')](_0x34fbb1,0x3,_0xa17b('0xd1'));rpcDb[_0xa17b('0xfb')](_0x34fbb1,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x34fbb1,0x5,_0xa17b('0xc5'));rpcDb[_0xa17b('0xfb')](_0x34fbb1,_0xa17b('0xfd'));break;case'8':ut[_0xa17b('0xfa')](_0x34fbb1,0x8,_0xa17b('0xd9'));rpcDb[_0xa17b('0xfb')](_0x34fbb1,_0xa17b('0xfe'));break;case'22':ut[_0xa17b('0xfa')](_0x34fbb1,0x16,_0xa17b('0xff'));rpcDb[_0xa17b('0xfb')](_0x34fbb1,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xa17b('0xfa')](_0x34fbb1,0xc,_0x19bb68[_0xa17b('0xf9')]);rpcDb['createAgentHistory'](_0x34fbb1,'[callProgressDetectingAgent][logCongestion]');}ut[_0xa17b('0x7f')](_0x48af6e,_0xa17b('0x100'));logger['info'](_0xa17b('0x101'),_0x34fbb1['uniqueid'],_0xa17b('0xb5'),_0x48af6e[_0xa17b('0x2b')],_0xa17b('0x102'),_0x48af6e['originated']);delete this[_0xa17b('0x18')][_0x34fbb1[_0xa17b('0xb4')]];};Preview[_0xa17b('0x63')][_0xa17b('0x103')]=function(_0x54df54,_0x25d725,_0x2ae453,_0x30345e,_0x43e061){var _0x1d1959=this;return new BPromise(function(_0x5565be,_0x49c273){if(_[_0xa17b('0x6f')](_0x25d725)||_[_0xa17b('0x6f')](_0x25d725[_0xa17b('0x104')])||_['isNil'](_0x25d725[_0xa17b('0x104')]['phone'])||_['isNil'](_0x25d725[_0xa17b('0x78')])){_0x49c273(ut[_0xa17b('0x4c')](_0xa17b('0x105'),_0x30345e,_0x43e061));return;}var _0x188f98=uuid['v4']();var _0x3c78b6=_0x1d1959['campaignsPreview'][_0x25d725[_0xa17b('0x72')]['name']];var _0x93e86e=_0x2ae453?_0x1d1959[_0xa17b('0x19')][_0x2ae453]['id']:undefined;_0x1d1959['actions'][_0x188f98]=new Action(_0x25d725,_0x3c78b6,_0x188f98,_0x2ae453,_0x93e86e);var _0x5cfb3c=_0x1d1959[_0xa17b('0x18')][_0x188f98];_0x5cfb3c[_0xa17b('0xaf')]=_0x30345e;_0x5cfb3c['activeContact']=_0x43e061;_0x5cfb3c[_0xa17b('0x106')]=_0x2ae453;if(_[_0xa17b('0x107')](_0x54df54)){_0x1d1959[_0xa17b('0x108')](_0x5cfb3c,_0x3c78b6,_0x25d725,_0x2ae453)['then'](function(_0x222227){logger[_0xa17b('0x70')](_0xa17b('0x109'),_0xa17b('0x10a')+_0x5cfb3c['queue']+_0xa17b('0x10b')+_0x5cfb3c['idContact'],JSON[_0xa17b('0x57')](_0x222227));ami[_0xa17b('0x5a')](_0xa17b('0x10c'),ut[_0xa17b('0xa8')](_0x5cfb3c,_0xa17b('0x10d'),_0x1d1959[_0xa17b('0x15')][_0x5cfb3c['queue']]));_0x5565be(ut[_0xa17b('0x4c')](_0xa17b('0x10e')));})[_0xa17b('0x7d')](function(_0x33acaf){ut[_0xa17b('0x61')](_0xa17b('0x10f'),_0x33acaf);_0x49c273(ut[_0xa17b('0x4c')](_0xa17b('0x110'),_0x30345e,_0x43e061));});}else{_0x3c78b6['outboundBlacklistCallsDay']+=0x1;ut[_0xa17b('0x111')](_0x5cfb3c);rpcDb[_0xa17b('0x112')](_0x5cfb3c,_0xa17b('0x113'));delete _0x1d1959[_0xa17b('0x18')][_0x188f98];_0x49c273(ut[_0xa17b('0x4c')](_0xa17b('0x114'),_0x30345e,_0x43e061));}});};Preview[_0xa17b('0x63')][_0xa17b('0x9f')]=function(_0x595e87){return!_[_0xa17b('0x6f')](_0x595e87)&&!_[_0xa17b('0x6f')](_0x595e87[_0xa17b('0x2b')])&&!_['isNil'](_0x595e87[_0xa17b('0x54')])&&_0x595e87[_0xa17b('0x54')]&&!_[_0xa17b('0x6f')](this['trunks'][util[_0xa17b('0x58')](_0xa17b('0x115'),_0x595e87[_0xa17b('0x2b')])])&&!_[_0xa17b('0x6f')](this[_0xa17b('0x17')][util[_0xa17b('0x58')]('SIP/%s',_0x595e87[_0xa17b('0x2b')])]['status'])&&(this[_0xa17b('0x17')][util['format'](_0xa17b('0x115'),_0x595e87[_0xa17b('0x2b')])][_0xa17b('0x7b')]===_0xa17b('0x116')||this[_0xa17b('0x17')][util[_0xa17b('0x58')]('SIP/%s',_0x595e87[_0xa17b('0x2b')])]['status']===_0xa17b('0x117'));};Preview[_0xa17b('0x63')][_0xa17b('0x8e')]=function(_0x3239fb,_0x195be0){var _0x3b0423=this;return new BPromise(function(_0x26a457,_0x1e4646){_0x3b0423[_0xa17b('0x118')](_0x3239fb,_0x195be0)[_0xa17b('0x87')](function(_0x9bb9f3){_0x26a457(_[_0xa17b('0x119')](_0x9bb9f3,['message']));})[_0xa17b('0x7d')](function(_0x352d20){if(_0x352d20[_0xa17b('0x11a')]){rpcDb[_0xa17b('0x11b')](_0x3239fb);}if(_0x352d20[_0xa17b('0x54')]){rpcDb['disableContact'](_0x3239fb);}_0x1e4646(_[_0xa17b('0x119')](_0x352d20,[_0xa17b('0x4c')]));});});};Preview[_0xa17b('0x63')][_0xa17b('0x118')]=function(_0x251e99,_0x4aab4){var _0x441439=this;return new BPromise(function(_0x576262,_0x5adde7){var _0x49dbac,_0x4d2bca;rpcDb[_0xa17b('0x11c')](_0x251e99)['then'](function(_0xf45e06){if(!_[_0xa17b('0x6f')](_0xf45e06[0x0])){_0x4d2bca=_0xf45e06[0x0][_0xa17b('0x11d')]?![]:!![];_0x49dbac=_0xf45e06[0x0][_0xa17b('0x11d')]?!![]:![];_0x49dbac=_0x4aab4?!![]:_0x49dbac;}var _0x23c2e7=_0x441439[_0xa17b('0x11e')](_0xf45e06);if(_0x23c2e7[_0xa17b('0x11f')]){rpcDb[_0xa17b('0x120')](_[_0xa17b('0x119')](_0xf45e06[0x0],['VoiceQueueId',_0xa17b('0x121')]))[_0xa17b('0x87')](function(_0x1e678c){_0x441439[_0xa17b('0x103')](_0x1e678c,_0xf45e06[0x0],_0x4aab4,_0x4d2bca,_0x49dbac)[_0xa17b('0x87')](function(_0x33a3b7){_0x576262(_0x33a3b7);})['catch'](function(_0x2216cd){_0x5adde7(_0x2216cd);});})['catch'](function(_0x12b061){ut[_0xa17b('0x61')](_0xa17b('0x122'),_0x12b061);_0x5adde7(ut[_0xa17b('0x4c')](_0xa17b('0x123'),_0x4d2bca,_0x49dbac));});}else{_0x5adde7(ut['message'](_0x23c2e7[_0xa17b('0x4c')],_0x4d2bca,_0x49dbac));}})[_0xa17b('0x7d')](function(_0x3e4ab1){ut[_0xa17b('0x61')](_0xa17b('0x124'),_0x3e4ab1);_0x5adde7(ut[_0xa17b('0x4c')](_0xa17b('0x123'),![],!![]));});});};Preview[_0xa17b('0x63')][_0xa17b('0x11e')]=function(_0x4d4dfa){if(_[_0xa17b('0x6f')](_0x4d4dfa)||_['isEmpty'](_0x4d4dfa)||!_[_0xa17b('0x6f')](_0x4d4dfa[0x0][_0xa17b('0x8c')])&&_[_0xa17b('0x6f')](_0x4d4dfa[0x0]['Agent'][_0xa17b('0x2b')])){ut[_0xa17b('0x61')](_0xa17b('0x125'),_0x4d4dfa);return{'isValid':![],'message':_0xa17b('0x126')};}var _0x43f053=this[_0xa17b('0x15')][_0x4d4dfa[0x0][_0xa17b('0x72')][_0xa17b('0x2b')]];_0x43f053[_0xa17b('0x4c')]='ACTIVE';if(_[_0xa17b('0x6f')](_0x43f053)){ut['logger'](_0xa17b('0x127'),_0x43f053);return{'isValid':![],'message':_0xa17b('0x128')};}if(!this[_0xa17b('0x9f')](_0x43f053[_0xa17b('0x53')])){ut[_0xa17b('0x61')](_0xa17b('0x129'),_0xa17b('0x12a')+_0x43f053[_0xa17b('0x2b')]+_0xa17b('0x12b'));if(!this[_0xa17b('0x9f')](_0x43f053['TrunkBackup'])){ut[_0xa17b('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x43f053['name']+_0xa17b('0x12c'));return{'isValid':![],'message':_0xa17b('0x12d')};}}if(!ut[_0xa17b('0x9e')](_0x43f053[_0xa17b('0x69')])){ut[_0xa17b('0x61')](_0xa17b('0x12e'),_0x43f053['name']+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x43f053[_0xa17b('0x2b')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xa17b('0x12f')};};Preview[_0xa17b('0x63')][_0xa17b('0x108')]=function(_0x46714c,_0x1de55e,_0x167eaf,_0x277db6){var _0x2cbf75=this;return new BPromise(function(_0x5a57dd,_0x569f75){var _0x477ba4=_0x46714c['uniqueid'];var _0x228cf4=_0x2cbf75[_0xa17b('0x9f')](_0x1de55e[_0xa17b('0x53')])?util[_0xa17b('0x58')](_0xa17b('0x130'),_0x1de55e[_0xa17b('0x53')]['name'],_[_0xa17b('0x6f')](_0x1de55e[_0xa17b('0x36')])?'':_0x1de55e['dialPrefix']['trim']()||'',_0x1de55e[_0xa17b('0x131')]>0x0?_0x167eaf[_0xa17b('0x104')][_0xa17b('0x132')][_0xa17b('0x133')](_0x1de55e[_0xa17b('0x131')]):_0x167eaf[_0xa17b('0x104')][_0xa17b('0x132')]):util['format'](_0xa17b('0x130'),_['isNil'](_0x1de55e['TrunkBackup'])?_0x1de55e[_0xa17b('0x53')][_0xa17b('0x2b')]:_0x1de55e[_0xa17b('0xa0')][_0xa17b('0x2b')],_[_0xa17b('0x6f')](_0x1de55e[_0xa17b('0x36')])?'':_0x1de55e['dialPrefix'][_0xa17b('0x134')]()||'',_0x1de55e[_0xa17b('0x131')]>0x0?_0x167eaf[_0xa17b('0x104')][_0xa17b('0x132')]['substring'](_0x1de55e['dialCutDigit']):_0x167eaf['Contact'][_0xa17b('0x132')]);var _0x4ed4fe=_0x2cbf75['isTrunkReachable'](_0x1de55e[_0xa17b('0x53')])?ut['getCallerId'](_0x1de55e['Trunk'][_0xa17b('0x55')],_0x1de55e[_0xa17b('0x135')],_0x1de55e[_0xa17b('0x136')]>0x0?ut[_0xa17b('0x137')](_0x1de55e[_0xa17b('0x35')],_0x1de55e['dialRandomLastDigitCallerIdNumber']):_0x1de55e[_0xa17b('0x35')]):ut[_0xa17b('0x138')](_[_0xa17b('0x6f')](_0x1de55e[_0xa17b('0xa0')])?_0x1de55e[_0xa17b('0x53')][_0xa17b('0x55')]:_0x1de55e[_0xa17b('0xa0')][_0xa17b('0x55')],_0x1de55e[_0xa17b('0x135')],_0x1de55e[_0xa17b('0x136')]>0x0?ut[_0xa17b('0x137')](_0x1de55e[_0xa17b('0x35')],_0x1de55e['dialRandomLastDigitCallerIdNumber']):_0x1de55e[_0xa17b('0x35')]);if(_0x4ed4fe){_0x46714c['originatecalleridname']=ut['extractCalleridName'](_0x4ed4fe);_0x46714c[_0xa17b('0x139')]=ut[_0xa17b('0x13a')](_0x4ed4fe);}var _0x1272f1=ut[_0xa17b('0x13b')](_0x1de55e,_0x167eaf,_0x228cf4,_0x4ed4fe,_0x477ba4,_0x46714c);_[_0xa17b('0x13c')](_0x46714c,ut[_0xa17b('0x13d')](_0x1272f1));_0x46714c[_0xa17b('0x92')]=moment()[_0xa17b('0x58')](_0xa17b('0x13e'));ami['Action'](ut['variablesAction'](_0x46714c,_0x1de55e,_0x1272f1,_0x46714c[_0xa17b('0xce')],_0x277db6))[_0xa17b('0x87')](function(_0x5972dd){_0x1de55e[_0xa17b('0x4d')]+=0x1;logger[_0xa17b('0x70')](_0xa17b('0x13f'),_0x477ba4,_0xa17b('0xb5'),_0x1de55e[_0xa17b('0x2b')],_0xa17b('0x102'),_0x1de55e[_0xa17b('0x4d')]);_0x5a57dd(_0x5972dd);})[_0xa17b('0x7d')](function(_0x422345){ut[_0xa17b('0xfa')](_0x46714c,0xe,'OriginateError');rpcDb[_0xa17b('0xfb')](_0x46714c,_0xa17b('0x140'));_0x569f75(_0x422345);});});};Preview[_0xa17b('0x63')][_0xa17b('0x141')]=function(_0x377552){if(this['actions'][_0x377552[_0xa17b('0xb0')]]){this[_0xa17b('0x18')][_0x377552[_0xa17b('0xb0')]][_0xa17b('0x7c')]=_0x377552[_0xa17b('0x7c')];}};Preview[_0xa17b('0x63')][_0xa17b('0x1b')]=function(_0x376945){var _0x2b75b6=this;var _0x3c8b97=this[_0xa17b('0x18')][_0x376945[_0xa17b('0x142')]];if(_0x3c8b97){if(_0x3c8b97['lookAgent']&&this['agents'][_0x3c8b97[_0xa17b('0x106')]]){ut['logLookAgent'](_0x3c8b97,this[_0xa17b('0x19')][_0x3c8b97[_0xa17b('0x106')]][_0xa17b('0x2b')],this['agents'][_0x3c8b97[_0xa17b('0x106')]]['id']);}var _0x4c06ab=_[_0xa17b('0x143')](_0x3c8b97);_0x4c06ab[_0xa17b('0x144')]=moment()['format'](_0xa17b('0x13e'));var _0x54d0c7=_0x2b75b6[_0xa17b('0x15')][_0x3c8b97[_0xa17b('0x73')]];if(ut[_0xa17b('0x145')](_0x376945['response'])){if(_0x3c8b97['unlockAgent']){rpcDb[_0xa17b('0x11b')](_0x3c8b97[_0xa17b('0x146')]);}if(_0x3c8b97[_0xa17b('0xce')]){rpcDb[_0xa17b('0x91')](_0x3c8b97[_0xa17b('0x146')]);}ami['emit'](_0xa17b('0x147'),ut[_0xa17b('0xa8')](_0x3c8b97,_0xa17b('0x148'),this['campaignsPreview'][_0x3c8b97['queue']]));this[_0xa17b('0xf6')](_0x4c06ab,_0x54d0c7,_0x376945);}else{_0x3c8b97[_0xa17b('0x92')]=moment()[_0xa17b('0x58')](_0xa17b('0x13e'));ut[_0xa17b('0xfa')](_0x4c06ab,0x4,'Answer');rpcDb[_0xa17b('0xfb')](_0x4c06ab,_0xa17b('0x149'));}}};Preview[_0xa17b('0x63')][_0xa17b('0x1d')]=function(_0x457795){var _0x21f774=this;var _0x507861=this['actions'][_0x457795[_0xa17b('0xb0')]];var _0x59f2e1;if(_0x507861){_0x59f2e1=this[_0xa17b('0x15')][_0x507861[_0xa17b('0x73')]];logger['info'](_0xa17b('0x14a'),_0x457795['linkedid'],_0xa17b('0xb5'),_0x59f2e1[_0xa17b('0x2b')],_0xa17b('0x74'),_0x59f2e1[_0xa17b('0x2e')]);}if(this[_0xa17b('0x18')][_0x457795[_0xa17b('0xb0')]]&&_0x457795[_0xa17b('0xb0')]!==_0x457795[_0xa17b('0xb4')]){if(_0x457795[_0xa17b('0x14b')]==='16'&&this[_0xa17b('0x18')][_0x457795[_0xa17b('0xb0')]][_0xa17b('0x75')]){this[_0xa17b('0xa2')](_0x457795,_0x457795['linkedid'],_0x457795[_0xa17b('0x14b')]);}else if(this[_0xa17b('0x18')][_0x457795[_0xa17b('0xb0')]][_0xa17b('0x75')]){logger[_0xa17b('0x70')]('[syncHangup][talking][cause]',_0x457795[_0xa17b('0xb0')],_0x457795['cause'],_0xa17b('0xb5'),_0x59f2e1[_0xa17b('0x2b')],_0xa17b('0x74'),_0x59f2e1[_0xa17b('0x2e')]);this[_0xa17b('0xa2')](_0x457795,_0x457795[_0xa17b('0xb0')],_0x457795[_0xa17b('0x14b')]);}}else if(_0x507861&&_[_0xa17b('0x6f')](_0x507861[_0xa17b('0x14c')])&&_0x59f2e1[_0xa17b('0x14d')]&&_0x457795[_0xa17b('0xb0')]===_0x457795[_0xa17b('0xb4')]&&_[_0xa17b('0x6f')](_0x457795[_0xa17b('0xf9')])&&_0x457795[_0xa17b('0x14b')]==='16'&&_0x457795[_0xa17b('0x14e')]==='6'&&_[_0xa17b('0xf7')](_0x507861[_0xa17b('0x14f')])){if(_0x507861['unlockAgent']){rpcDb[_0xa17b('0x11b')](_0x507861['idContact']);}if(_0x507861['activeContact']){rpcDb[_0xa17b('0x91')](_0x507861['idContact']);}_0x457795[_0xa17b('0xf9')]='22';this[_0xa17b('0xf6')](_0x507861,_0x59f2e1,_0x457795);}else if(_0x507861&&_0x507861[_0xa17b('0x14f')]){if(_0x457795[_0xa17b('0x14b')]==='16'&&this['actions'][_0x457795['linkedid']]['dialAnswer']){logger[_0xa17b('0x70')](_0xa17b('0x150'),_0x457795[_0xa17b('0xb0')],_0x457795[_0xa17b('0x14b')],'\x20Queue',_0x59f2e1[_0xa17b('0x2b')],_0xa17b('0x74'),_0x59f2e1[_0xa17b('0x2e')]);this['callProgressDetectingCustomer'](_0x457795,_0x457795[_0xa17b('0xb0')],_0x457795[_0xa17b('0x14b')]);}else if(this['actions'][_0x457795[_0xa17b('0xb0')]][_0xa17b('0x75')]){logger[_0xa17b('0x70')]('[syncHangup][talking][cause]',_0x457795['linkedid'],_0x457795['cause'],_0xa17b('0xb5'),_0x59f2e1['name'],'pTalking:\x20',_0x59f2e1[_0xa17b('0x2e')]);this[_0xa17b('0xa2')](_0x457795,_0x457795[_0xa17b('0xb0')],_0x457795[_0xa17b('0x14b')]);}}};Preview[_0xa17b('0x63')]['syncDialEnd']=function(_0xdb0576){if(this[_0xa17b('0x18')][_0xdb0576[_0xa17b('0xf5')]]&&_0xdb0576['destlinkedid']!==_0xdb0576['destuniqueid']){this[_0xa17b('0xa2')](_0xdb0576,_0xdb0576[_0xa17b('0xf5')],_0xdb0576[_0xa17b('0xeb')]);}};Preview[_0xa17b('0x63')][_0xa17b('0x1f')]=function(_0x1cf9ce){if(this['actions'][_0x1cf9ce[_0xa17b('0xb0')]]&&_0x1cf9ce['linkedid']!==_0x1cf9ce['uniqueid']&&!this[_0xa17b('0x18')][_0x1cf9ce['linkedid']][_0xa17b('0x75')]){if(_0x1cf9ce['cause']==='1'){this[_0xa17b('0xa2')](_0x1cf9ce,_0x1cf9ce[_0xa17b('0xb0')],_0x1cf9ce[_0xa17b('0x14b')]);}}};Preview[_0xa17b('0x63')][_0xa17b('0x151')]=function(_0x16bee7,_0x1482a1,_0x38f48e){if(this[_0xa17b('0x18')][_0x16bee7]){if(_['isNil'](this[_0xa17b('0x18')][_0x16bee7]['variables'])){this[_0xa17b('0x18')][_0x16bee7]['variables']={};}this['actions'][_0x16bee7][_0xa17b('0x152')][_0x1482a1]=_0x38f48e;}};Preview[_0xa17b('0x63')][_0xa17b('0x23')]=function(_0x31e21b){try{if(!_[_0xa17b('0x6f')](_0x31e21b)){if(ut[_0xa17b('0x153')](_[_0xa17b('0x154')](_0x31e21b[_0xa17b('0x155')])[0x0])){this[_0xa17b('0x151')](_0x31e21b[_0xa17b('0xb4')],_[_0xa17b('0x154')](_0x31e21b[_0xa17b('0x155')])[0x0],_0x31e21b[_0xa17b('0x156')]);}}}catch(_0x1b8be4){logger['error']('[syncVarSet][Preview]',util[_0xa17b('0x157')](_0x1b8be4,{'showHidden':![],'depth':null}));}};Preview[_0xa17b('0x63')][_0xa17b('0x25')]=function(_0x38c204){if(_0x38c204){if(this[_0xa17b('0x18')][_0x38c204[_0xa17b('0x158')]]){this[_0xa17b('0x18')][_0x38c204[_0xa17b('0x158')]]['transfer']=!![];}}};Preview[_0xa17b('0x63')]['syncBlindTransfer']=function(_0x50beca){if(_0x50beca){if(this[_0xa17b('0x18')][_0x50beca['transfererlinkedid']]){this[_0xa17b('0x18')][_0x50beca[_0xa17b('0x159')]][_0xa17b('0x14f')]=!![];}}};module[_0xa17b('0x15a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 27cca92..0287aab 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 _0x61df=['resolve','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','[moveContactManagedDialer]\x20','checkIsBlackList'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x61df,0x19e));var _0xf61d=function(_0x4133a7,_0x389139){_0x4133a7=_0x4133a7-0x0;var _0x161c4e=_0x61df[_0x4133a7];return _0x161c4e;};'use strict';var util=require(_0xf61d('0x0'));var BPromise=require('bluebird');var logger=require(_0xf61d('0x1'))(_0xf61d('0x2'));var _=require(_0xf61d('0x3'));var cmHopper=require(_0xf61d('0x4'));var cmHopperFinal=require(_0xf61d('0x5'));var cmHopperHistory=require(_0xf61d('0x6'));var cmHopperBlack=require(_0xf61d('0x7'));var voiceQueueRt=require(_0xf61d('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xf61d('0x9'));function loggerCatch(_0x3d1472){return function(_0x299383){logger[_0xf61d('0xa')](_0x3d1472,util[_0xf61d('0xb')](_0x299383,{'showHidden':![],'depth':null}));};}function create(_0x5dc4ef){return BPromise['resolve']()['then'](cmHopperHistory[_0xf61d('0xc')](_0x5dc4ef))[_0xf61d('0xd')](loggerCatch(_0xf61d('0xe')));}function createAgent(_0x346f3d){return BPromise['resolve']()[_0xf61d('0xf')](agentReportPreview[_0xf61d('0xc')](_0x346f3d))['catch'](loggerCatch(_0xf61d('0xe')));}function moveContact(_0x15ad35){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x15ad35,!![]))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x10')));}exports[_0xf61d('0x11')]=function(_0x54b2b3){return BPromise[_0xf61d('0x12')]()[_0xf61d('0xf')](cmHopperBlack[_0xf61d('0x11')](_0x54b2b3))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x13')));};exports['getContactPreview']=function(_0x387f9e){return BPromise[_0xf61d('0x12')]()[_0xf61d('0xf')](cmHopper[_0xf61d('0x14')](_0x387f9e))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x15')));};exports['createHistory']=function(_0x178fc9,_0xfcfb1d){create(_0x178fc9)[_0xf61d('0xd')](loggerCatch(_0xfcfb1d));moveContact(_0x178fc9)['catch'](loggerCatch(_0xfcfb1d));};exports[_0xf61d('0x16')]=function(_0xeb9dca,_0x11c0c8){createAgent(_0xeb9dca)[_0xf61d('0xd')](loggerCatch(_0x11c0c8));};exports['createCustomerHistory']=function(_0x3c5246,_0x13c700){create(_0x3c5246)['catch'](loggerCatch(_0x13c700));};exports[_0xf61d('0x17')]=function(_0x93a75a,_0x485caf){moveContact(_0x93a75a)[_0xf61d('0xd')](loggerCatch(_0x485caf));};exports[_0xf61d('0x18')]=function(_0x5b1884,_0x26e86f,_0x5e2cb0){if(_0x26e86f){_0x5b1884[_0xf61d('0x19')]=null;}if(_0x5e2cb0){_0x5b1884[_0xf61d('0x1a')]=![];}return BPromise[_0xf61d('0x12')]()['then'](cmHopper[_0xf61d('0x18')](_0x5b1884))['catch'](loggerCatch(_0xf61d('0x1b')));};exports[_0xf61d('0x1c')]=function(_0x223be8){return BPromise[_0xf61d('0x12')]()['then'](cmHopper[_0xf61d('0x1c')](_0x223be8))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xf61d('0x1d')]=function(_0xb61e1c){return BPromise['resolve']()[_0xf61d('0xf')](cmHopper['unlockContact']({'UserId':null},_0xb61e1c,0x1))[_0xf61d('0xd')](loggerCatch('[unlockContact]\x20'));};exports[_0xf61d('0x1e')]=function(_0x5a5b7c){return BPromise['resolve']()['then'](cmHopper[_0xf61d('0x1d')]({'active':![]},_0x5a5b7c,0x1))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x1f')));};exports[_0xf61d('0x20')]=function(_0x45d1f6){var _0x483b47={};_0x483b47[_0xf61d('0x21')]=_0x45d1f6['type'];_0x483b47[_0xf61d('0x22')]=_0x45d1f6['uniqueid'];_0x483b47[_0xf61d('0x23')]=_0x45d1f6[_0xf61d('0x23')];_0x483b47[_0xf61d('0x24')]=_0x45d1f6[_0xf61d('0x24')];_0x483b47['queue']=_0x45d1f6['queue'];_0x483b47[_0xf61d('0x25')]=_0x45d1f6[_0xf61d('0x26')];_0x483b47['queuecallerleaveAt']=_0x45d1f6['answertime'];_0x483b47[_0xf61d('0x27')]=0x1;_0x483b47[_0xf61d('0x28')]=_0x45d1f6[_0xf61d('0x29')];_0x483b47[_0xf61d('0x2a')]=_0x45d1f6[_0xf61d('0x2b')];_0x483b47['context']=_0xf61d('0x2c');_0x483b47[_0xf61d('0x2d')]=_0xf61d('0x2e');_0x483b47[_0xf61d('0x2f')]=0x0;_0x483b47['assigned']=0x1;_0x483b47['lastAssignedTo']=_0x45d1f6[_0xf61d('0x2b')];_0x483b47[_0xf61d('0x30')]=_0xf61d('0x31');return BPromise['resolve']()['then'](voiceQueueReport[_0xf61d('0x32')](_0x483b47))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x33')));};exports[_0xf61d('0x34')]=function(_0x5569e8,_0x565cd4){return BPromise['resolve']()['then'](cmHopper[_0xf61d('0x34')](_0x5569e8,_0x565cd4))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x2b827d){return BPromise['resolve']()[_0xf61d('0xf')](cmHopper[_0xf61d('0x18')](_0x2b827d,!![],!![]))['catch'](loggerCatch(_0xf61d('0x35')));}; \ No newline at end of file +var _0xb1ca=['answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x586d28,_0x252dbc){var _0x1902e9=function(_0x1b3375){while(--_0x1b3375){_0x586d28['push'](_0x586d28['shift']());}};_0x1902e9(++_0x252dbc);}(_0xb1ca,0xff));var _0xab1c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb1ca[_0x4ff09b];return _0x3f5c2e;};'use strict';var util=require(_0xab1c('0x0'));var BPromise=require(_0xab1c('0x1'));var logger=require(_0xab1c('0x2'))(_0xab1c('0x3'));var _=require('lodash');var cmHopper=require(_0xab1c('0x4'));var cmHopperFinal=require(_0xab1c('0x5'));var cmHopperHistory=require(_0xab1c('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xab1c('0x7'));var agentReportPreview=require(_0xab1c('0x8'));var voiceQueueReport=require(_0xab1c('0x9'));function loggerCatch(_0x56cc08){return function(_0x25e48f){logger['error'](_0x56cc08,util[_0xab1c('0xa')](_0x25e48f,{'showHidden':![],'depth':null}));};}function create(_0x1f6c5e){return BPromise['resolve']()[_0xab1c('0xb')](cmHopperHistory[_0xab1c('0xc')](_0x1f6c5e))[_0xab1c('0xd')](loggerCatch(_0xab1c('0xe')));}function createAgent(_0x59ffd2){return BPromise[_0xab1c('0xf')]()[_0xab1c('0xb')](agentReportPreview['createHistory'](_0x59ffd2))['catch'](loggerCatch(_0xab1c('0xe')));}function moveContact(_0x429dcf){return BPromise[_0xab1c('0xf')]()[_0xab1c('0xb')](cmHopper[_0xab1c('0x10')](_0x429dcf,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xab1c('0x11')]=function(_0x5c61a8){return BPromise[_0xab1c('0xf')]()['then'](cmHopperBlack[_0xab1c('0x11')](_0x5c61a8))[_0xab1c('0xd')](loggerCatch(_0xab1c('0x12')));};exports[_0xab1c('0x13')]=function(_0x13506c){return BPromise[_0xab1c('0xf')]()[_0xab1c('0xb')](cmHopper['getContactPreview'](_0x13506c))[_0xab1c('0xd')](loggerCatch(_0xab1c('0x14')));};exports[_0xab1c('0xc')]=function(_0x2532d2,_0x4dc755){create(_0x2532d2)[_0xab1c('0xd')](loggerCatch(_0x4dc755));moveContact(_0x2532d2)[_0xab1c('0xd')](loggerCatch(_0x4dc755));};exports[_0xab1c('0x15')]=function(_0x4ad5e1,_0x4d0d7b){createAgent(_0x4ad5e1)[_0xab1c('0xd')](loggerCatch(_0x4d0d7b));};exports[_0xab1c('0x16')]=function(_0x3f8e71,_0x40283d){create(_0x3f8e71)[_0xab1c('0xd')](loggerCatch(_0x40283d));};exports[_0xab1c('0x17')]=function(_0x3c31c1,_0x369a4f){moveContact(_0x3c31c1)[_0xab1c('0xd')](loggerCatch(_0x369a4f));};exports['rescheduleContact']=function(_0x1548f2,_0x3451d3,_0x2528d8){if(_0x3451d3){_0x1548f2[_0xab1c('0x18')]=null;}if(_0x2528d8){_0x1548f2[_0xab1c('0x19')]=![];}return BPromise['resolve']()[_0xab1c('0xb')](cmHopper[_0xab1c('0x1a')](_0x1548f2))['catch'](loggerCatch(_0xab1c('0x1b')));};exports['countReScheduled']=function(_0x48d2cc){return BPromise['resolve']()[_0xab1c('0xb')](cmHopper[_0xab1c('0x1c')](_0x48d2cc))[_0xab1c('0xd')](loggerCatch(_0xab1c('0x1d')));};exports['unlockContact']=function(_0x313346){return BPromise['resolve']()['then'](cmHopper[_0xab1c('0x1e')]({'UserId':null},_0x313346,0x1))[_0xab1c('0xd')](loggerCatch(_0xab1c('0x1f')));};exports[_0xab1c('0x20')]=function(_0x9fafae){return BPromise[_0xab1c('0xf')]()[_0xab1c('0xb')](cmHopper[_0xab1c('0x1e')]({'active':![]},_0x9fafae,0x1))[_0xab1c('0xd')](loggerCatch(_0xab1c('0x21')));};exports[_0xab1c('0x22')]=function(_0x54c182){var _0x4a905b={};_0x4a905b[_0xab1c('0x23')]=_0x54c182[_0xab1c('0x23')];_0x4a905b[_0xab1c('0x24')]=_0x54c182[_0xab1c('0x24')];_0x4a905b[_0xab1c('0x25')]=_0x54c182['calleridnum'];_0x4a905b[_0xab1c('0x26')]=_0x54c182[_0xab1c('0x26')];_0x4a905b[_0xab1c('0x27')]=_0x54c182['queue'];_0x4a905b['queuecallerjoinAt']=_0x54c182[_0xab1c('0x28')];_0x4a905b[_0xab1c('0x29')]=_0x54c182[_0xab1c('0x28')];_0x4a905b[_0xab1c('0x2a')]=0x1;_0x4a905b[_0xab1c('0x2b')]=_0x54c182[_0xab1c('0x2c')];_0x4a905b[_0xab1c('0x2d')]=_0x54c182[_0xab1c('0x2e')];_0x4a905b[_0xab1c('0x2f')]=_0xab1c('0x30');_0x4a905b[_0xab1c('0x31')]=_0xab1c('0x32');_0x4a905b[_0xab1c('0x33')]=0x0;_0x4a905b[_0xab1c('0x34')]=0x1;_0x4a905b['lastAssignedTo']=_0x54c182[_0xab1c('0x2e')];_0x4a905b[_0xab1c('0x35')]='COMPLETED';return BPromise[_0xab1c('0xf')]()[_0xab1c('0xb')](voiceQueueReport[_0xab1c('0x36')](_0x4a905b))[_0xab1c('0xd')](loggerCatch(_0xab1c('0x37')));};exports[_0xab1c('0x38')]=function(_0x58e10c,_0x1aacab){return BPromise[_0xab1c('0xf')]()[_0xab1c('0xb')](cmHopper['getContactRecallMe'](_0x58e10c,_0x1aacab))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xab1c('0x39')]=function(_0x55e267){return BPromise[_0xab1c('0xf')]()[_0xab1c('0xb')](cmHopper['rescheduleContact'](_0x55e267,!![],!![]))[_0xab1c('0xd')](loggerCatch(_0xab1c('0x3a')));}; \ 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 5cc026d..cb05d86 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 _0xc5b9=['countnoanswerretry','countnosuchnumberretry','cloneAction','clone','state','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','error','inspect','logger','info','loggerError','logger2','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','responsetime','endtime','statedesc','ringtime','logLookAgent','UserId','starttime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry'];(function(_0x510912,_0x91f943){var _0x23f357=function(_0x141565){while(--_0x141565){_0x510912['push'](_0x510912['shift']());}};_0x23f357(++_0x91f943);}(_0xc5b9,0xce));var _0x9c5b=function(_0x30986c,_0x39ce58){_0x30986c=_0x30986c-0x0;var _0x57c209=_0xc5b9[_0x30986c];return _0x57c209;};'use strict';var util=require('util');var _=require(_0x9c5b('0x0'));var moment=require(_0x9c5b('0x1'));var logger=require(_0x9c5b('0x2'))(_0x9c5b('0x3'));var ipAgi=process[_0x9c5b('0x4')]['XCALLY_IP_AGI']||_0x9c5b('0x5');function getSeconds(_0x6d944e,_0x4c414e){var _0x3b864d=moment(_0x6d944e)[_0x9c5b('0x6')](0x0);var _0x5453ab=moment(_0x4c414e)[_0x9c5b('0x6')](0x0);return _0x3b864d[_0x9c5b('0x7')](_0x5453ab,'seconds');}exports['loggerCatch']=function(_0x29348b){return function(_0x46892d){logger[_0x9c5b('0x8')](_0x29348b,util[_0x9c5b('0x9')](_0x46892d,{'showHidden':![],'depth':null}));};};exports[_0x9c5b('0xa')]=function(_0x4371e2,_0x47ba42){logger[_0x9c5b('0xb')](_0x4371e2,util[_0x9c5b('0x9')](_0x47ba42,{'showHidden':![],'depth':null}));};exports[_0x9c5b('0xc')]=function(_0x40afff,_0x4da2fd){logger[_0x9c5b('0x8')](_0x40afff,util['inspect'](_0x4da2fd,{'showHidden':![],'depth':null}));};exports[_0x9c5b('0xd')]=function(_0x2acda2){return function(_0x320a94){logger[_0x9c5b('0xb')](_0x2acda2,util['inspect'](_0x320a94,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xec4281,_0x1ef799,_0x133bb4){return{'message':_0xec4281,'unlock':_0x1ef799,'active':_0x133bb4};};exports[_0x9c5b('0xe')]=function(_0x47324d,_0x6f608d,_0x5ee129){if(!_[_0x9c5b('0xf')](_0x5ee129)&&'string'===typeof _0x5ee129&&!_[_0x9c5b('0x10')](_0x5ee129)){if(!_[_0x9c5b('0xf')](_0x6f608d)&&'string'===typeof _0x6f608d&&!_[_0x9c5b('0x10')](_0x6f608d)){return util[_0x9c5b('0x11')](_0x9c5b('0x12'),_0x6f608d,_0x5ee129);}return util['format'](_0x9c5b('0x12'),_0x5ee129,_0x5ee129);}if(!_[_0x9c5b('0xf')](_0x47324d)&&_0x9c5b('0x13')===typeof _0x47324d&&!_[_0x9c5b('0x10')](_0x47324d)){return _0x47324d;}return _0x9c5b('0x14');};exports[_0x9c5b('0x15')]=function(_0x132279){if(_[_0x9c5b('0x16')](_0x132279)){return![];}return _0x132279;};exports[_0x9c5b('0x17')]=function(_0x599933,_0x4909c9,_0x240324,_0x363393,_0x4f2fc1,_0x172618){var _0x4f06f8={'XMD-QUEUE':_0x4909c9['Queue']?_0x4909c9['Queue'][_0x9c5b('0x18')]:'','XMD-CALLERID':_0x363393,'XMD-CALLERID-PREVIEW':_0x172618?util[_0x9c5b('0x11')](_0x9c5b('0x12'),_0x172618[_0x9c5b('0x19')],_0x172618['calleridnum']):_0x363393,'XMD-DIALID':_0x4f2fc1,'XMD-CONTACTID':_0x4909c9[_0x9c5b('0x1a')],'XMD-CDRTYPE':_0x9c5b('0x1b'),'CALLERID(all)':_0x363393,'XMD-VOICEQUEUEID':_0x4909c9[_0x9c5b('0x1c')],'XMD-DIALCHANNEL':_0x240324,'XMD-DIALTIMEOUT':_0x599933[_0x9c5b('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x9c5b('0x11')](_0x9c5b('0x1e'),_0x599933[_0x9c5b('0x1f')]?'g':'',_['isEmpty'](_0x599933[_0x9c5b('0x20')])?'':_0x9c5b('0x21')),'XMD-DIALURL':_0x599933['dialPreviewUrl']||'','XMD-AGI':_0x599933[_0x9c5b('0x22')]?util[_0x9c5b('0x11')](_0x9c5b('0x23'),ipAgi,_0x599933[_0x9c5b('0x22')]):_0x9c5b('0x24'),'XMD-AGIAFTER':_0x599933[_0x9c5b('0x1f')]?util[_0x9c5b('0x11')](_0x9c5b('0x23'),ipAgi,_0x599933[_0x9c5b('0x1f')]):_0x9c5b('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x172618?_0x172618[_0x9c5b('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x172618?_0x172618[_0x9c5b('0x26')]:'','XMD-DESTINATION':_0x9c5b('0x27'),'SIPADDHEADER':_0x9c5b('0x28')};if(!_['isEmpty'](_0x599933[_0x9c5b('0x20')])){_0x4f06f8[util[_0x9c5b('0x11')]('%s',_0x9c5b('0x29'))]=_0x599933[_0x9c5b('0x20')];_0x4f06f8[util[_0x9c5b('0x11')]('%s',_0x9c5b('0x2a'))]=_0x4f2fc1;}if(_0x4909c9&&_0x4909c9[_0x9c5b('0x2b')]){for(var _0x5d8e59 in _0x4909c9[_0x9c5b('0x2b')]){if(_0x4909c9[_0x9c5b('0x2b')][_0x9c5b('0x2c')](_0x5d8e59)){if(!_[_0x9c5b('0x16')](_0x4909c9[_0x9c5b('0x2b')][_0x5d8e59])&&_0x5d8e59!=='id'&&_0x5d8e59!==_0x9c5b('0x2d')&&_0x5d8e59!=='createdAt'&&_0x5d8e59!==_0x9c5b('0x2e')){_0x4f06f8[util[_0x9c5b('0x11')](_0x9c5b('0x2f'),_0x9c5b('0x30'),_[_0x9c5b('0x31')](_0x5d8e59))]=_0x4909c9[_0x9c5b('0x2b')][_0x5d8e59];}}}}return _0x4f06f8;};exports[_0x9c5b('0x32')]=function(_0x361b4c){var _0x48cecf={};for(var _0xd42baa in _0x361b4c){if(_0x361b4c[_0x9c5b('0x2c')](_0xd42baa)){_0x48cecf[util[_0x9c5b('0x11')]('%s',_[_0x9c5b('0x33')](_0xd42baa))]=_0x361b4c[_0xd42baa];}}return{'variables':_0x48cecf};};exports['updateOriginated']=function(_0x17e233,_0x1c182f){if(!_[_0x9c5b('0x16')](_0x17e233)){if(_0x17e233[_0x9c5b('0x2c')](_0x9c5b('0x34'))){if(_0x17e233[_0x9c5b('0x34')]>0x0){_0x17e233['originated']-=0x1;}else{logger[_0x9c5b('0x8')](_0x9c5b('0x35'),_0x1c182f);}}}else{logger[_0x9c5b('0x8')](_0x9c5b('0x36'),_0x1c182f);}};exports[_0x9c5b('0x37')]=function(_0x138430){var _0x250e04=moment()[_0x9c5b('0x11')](_0x9c5b('0x38'));_0x138430['state']=0xd;_0x138430['statedesc']=_0x9c5b('0x39');_0x138430['starttime']=_0x250e04;_0x138430[_0x9c5b('0x3a')]=_0x250e04;_0x138430[_0x9c5b('0x3b')]=_0x250e04;};exports['logAgent']=function(_0x830b80,_0x1a9178,_0x5e5fff){var _0x38f381=moment()[_0x9c5b('0x11')](_0x9c5b('0x38'));_0x830b80['state']=_0x1a9178;_0x830b80[_0x9c5b('0x3c')]=_0x5e5fff;_0x830b80[_0x9c5b('0x3a')]=_0x38f381;_0x830b80[_0x9c5b('0x3d')]=getSeconds(_0x830b80[_0x9c5b('0x3a')],_0x830b80['starttime']);};exports[_0x9c5b('0x3e')]=function(_0x266ea7,_0x63fa00,_0xa06b12){_0x266ea7['membername']=_0x63fa00;_0x266ea7[_0x9c5b('0x3f')]=_0xa06b12;};exports['logCustomer']=function(_0x13f7e6,_0x55d295,_0x134ae7){var _0x522fec=moment()[_0x9c5b('0x11')](_0x9c5b('0x38'));_0x13f7e6['state']=_0x55d295;_0x13f7e6[_0x9c5b('0x3c')]=_0x134ae7;_0x13f7e6[_0x9c5b('0x3a')]=_0x13f7e6[_0x9c5b('0x3a')]?_0x13f7e6[_0x9c5b('0x3a')]:_0x522fec;_0x13f7e6[_0x9c5b('0x3b')]=_0x13f7e6[_0x9c5b('0x3b')]?_0x13f7e6[_0x9c5b('0x3b')]:_0x522fec;_0x13f7e6[_0x9c5b('0x3d')]=getSeconds(_0x13f7e6[_0x9c5b('0x3a')]||0x0,_0x13f7e6[_0x9c5b('0x40')]||0x0);_0x13f7e6[_0x9c5b('0x41')]=_0x13f7e6[_0x9c5b('0x42')]?getSeconds(_0x13f7e6[_0x9c5b('0x3b')],_0x13f7e6['answertime']):0x0;};exports[_0x9c5b('0x43')]=function(_0x991742){return _0x991742===_0x9c5b('0x44');};exports[_0x9c5b('0x45')]=function(_0x5eb948,_0x3a74fe,_0x546360,_0x38271d,_0x4fb442){var _0x5b0998=_0x38271d?_0x9c5b('0x46'):_0x5eb948[_0x9c5b('0x19')];_0x5b0998=_0x4fb442?_0x9c5b('0x47'):_0x5b0998;return{'actionid':_0x5eb948[_0x9c5b('0x48')],'action':_0x9c5b('0x49'),'channel':_0x5eb948[_0x9c5b('0x4a')],'callerid':util[_0x9c5b('0x11')](_0x9c5b('0x12'),_0x5b0998,_0x5eb948[_0x9c5b('0x4b')]),'Exten':_0x9c5b('0x27'),'Context':'from-sip','Priority':'1','variable':_0x546360,'timeout':(_0x3a74fe[_0x9c5b('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5eb948[_0x9c5b('0x48')]};};exports[_0x9c5b('0x4d')]=function(_0x30f98a){return _0x30f98a[_0x9c5b('0x4e')]+_0x30f98a[_0x9c5b('0x4f')]+_0x30f98a[_0x9c5b('0x50')]+_0x30f98a['countagentrejectretry']+_0x30f98a[_0x9c5b('0x51')];};exports[_0x9c5b('0x52')]=function(_0x1d37f3){var _0xc7adf4=_[_0x9c5b('0x53')](_0x1d37f3);_0xc7adf4[_0x9c5b('0x54')]=0xf;_0xc7adf4[_0x9c5b('0x3c')]=_0x9c5b('0x55');return _0xc7adf4;};exports[_0x9c5b('0x56')]=function(_0x2f5ea0,_0x485be2,_0x9657f8){var _0x1b7df3={};_0x1b7df3[_0x485be2]=_0x2f5ea0[_0x485be2];_0x1b7df3[_0x9c5b('0x57')]=![];_0x1b7df3[_0x9c5b('0x58')]=moment()[_0x9c5b('0x59')](_0x9657f8,_0x9c5b('0x5a'))['format'](_0x9c5b('0x38'));_0x1b7df3[_0x9c5b('0x1a')]=_0x2f5ea0[_0x9c5b('0x1a')];_0x1b7df3[_0x9c5b('0x5b')]=_0x2f5ea0['ListId'];_0x1b7df3[_0x9c5b('0x1c')]=_0x2f5ea0[_0x9c5b('0x1c')]||undefined;return _0x1b7df3;};exports[_0x9c5b('0x5c')]=function(_0x3a777a,_0x4faff0){if(!_[_0x9c5b('0x16')](_0x3a777a)){if(_0x3a777a['pTalking']>0x0){_0x3a777a[_0x9c5b('0x5d')]-=0x1;}else{logger['error'](_0x4faff0,_0x9c5b('0x5e'));}}else{logger[_0x9c5b('0x8')](_0x4faff0,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x3dabd3){if(_0x3dabd3<=0x0){return!![];}return![];};exports['buildObj']=function(_0x460d40,_0x336969,_0x120d5a){_0x460d40['lastevent']=_0x336969;_0x460d40['name']=_0x460d40[_0x9c5b('0x5f')];_0x460d40[_0x9c5b('0x60')]=_0x460d40[_0x9c5b('0x4a')];_0x460d40[_0x9c5b('0x61')]=_0x9c5b('0x62');if(_0x120d5a){_0x460d40['mandatoryDisposition']=_0x120d5a[_0x9c5b('0x63')];}return _0x460d40;};exports[_0x9c5b('0x64')]=function(_0x813ca3){var _0x11bbb9={};_0x11bbb9[_0x9c5b('0x5f')]=_0x813ca3['queue'];_0x11bbb9[_0x9c5b('0x60')]=_0x813ca3[_0x9c5b('0x4a')];_0x11bbb9[_0x9c5b('0x48')]=_0x813ca3['uniqueid'];return _0x11bbb9;};exports[_0x9c5b('0x65')]=function(_0x2b7c87){var _0x3b6bea=[];for(var _0x5bd8df in _0x2b7c87){if(_0x2b7c87[_0x9c5b('0x2c')](_0x5bd8df)){if(!_[_0x9c5b('0x16')](_0x2b7c87[_0x5bd8df])&&_0x2b7c87[_0x5bd8df]['state']===_0x9c5b('0x66')&&_0x2b7c87[_0x5bd8df][_0x9c5b('0x67')]===_0x9c5b('0x68')){_0x3b6bea[_0x9c5b('0x69')](_0x2b7c87[_0x5bd8df]['id']);}}}return _0x3b6bea;};exports['getDiff']=function(_0x1a456d){var _0x27df4b=moment()[_0x9c5b('0x6')](0x0);var _0x1bd798=moment(_0x1a456d)[_0x9c5b('0x6')](0x0);return _0x27df4b[_0x9c5b('0x7')](_0x1bd798,_0x9c5b('0x6a'));};exports[_0x9c5b('0x6b')]=function(_0x3253a6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3253a6[_0x9c5b('0x1a')],'ListId':_0x3253a6[_0x9c5b('0x5b')],'VoiceQueueId':_0x3253a6['VoiceQueueId']||undefined,'CampaignId':_0x3253a6[_0x9c5b('0x6c')]||undefined};};exports[_0x9c5b('0x6d')]=function(_0x511c29){if(_0x511c29===_0x9c5b('0x48')||_0x511c29===_0x9c5b('0x6e')||_0x511c29===_0x9c5b('0x5f')||_0x511c29===_0x9c5b('0x6f')||_0x511c29===_0x9c5b('0x70')||_0x511c29===_0x9c5b('0x71')||_0x511c29===_0x9c5b('0x72')||_0x511c29===_0x9c5b('0x4a')||_0x511c29===_0x9c5b('0x19')||_0x511c29===_0x9c5b('0x57')||_0x511c29===_0x9c5b('0x4b')||_0x511c29===_0x9c5b('0x58')||_0x511c29==='countbusyretry'||_0x511c29==='countcongestionretry'||_0x511c29===_0x9c5b('0x50')||_0x511c29===_0x9c5b('0x73')||_0x511c29===_0x9c5b('0x74')||_0x511c29===_0x9c5b('0x75')||_0x511c29===_0x9c5b('0x76')||_0x511c29===_0x9c5b('0x77')||_0x511c29===_0x9c5b('0x1a')||_0x511c29==='ListId'||_0x511c29===_0x9c5b('0x3f')||_0x511c29===_0x9c5b('0x1c')||_0x511c29==='sipcallid'||_0x511c29===_0x9c5b('0x78')||_0x511c29==='xmd-queue'||_0x511c29==='xmd-phone'||_0x511c29===_0x9c5b('0x79')||_0x511c29===_0x9c5b('0x7a')||_0x511c29===_0x9c5b('0x7b')||_0x511c29==='xmd-dialoptions'||_0x511c29===_0x9c5b('0x7c')||_0x511c29===_0x9c5b('0x7d')||_0x511c29===_0x9c5b('0x7e')||_0x511c29==='xmd-cdrtype'||_0x511c29===_0x9c5b('0x7f')||_0x511c29==='xmd-agiafter'||_0x511c29===_0x9c5b('0x80')||_0x511c29===_0x9c5b('0x81')||_0x511c29===_0x9c5b('0x82')||_0x511c29===_0x9c5b('0x83')||_0x511c29===_0x9c5b('0x84')||_0x511c29===_0x9c5b('0x85')||_0x511c29==='rtpaudioqoslossbridged'||_0x511c29===_0x9c5b('0x86')||_0x511c29===_0x9c5b('0x87')||_0x511c29===_0x9c5b('0x81')||_0x511c29==='rtpaudioqosbridged'||_0x511c29===_0x9c5b('0x83')||_0x511c29===_0x9c5b('0x84')||_0x511c29===_0x9c5b('0x85')||_0x511c29===_0x9c5b('0x88')||_0x511c29===_0x9c5b('0x86')||_0x511c29==='rtpaudioqosrttbridged'||_0x511c29==='bridgepeer'||_0x511c29==='bridgepvtcallid'||_0x511c29==='state'||_0x511c29===_0x9c5b('0x3c')){return![];}return!![];};exports[_0x9c5b('0x89')]=function(_0x410efd,_0x31d151){var _0x44e61d,_0x539278,_0x280f33;if(_0x31d151<=0x0){_0x31d151=0x1;}_0x44e61d=new RegExp('\x5cw{0,'+_0x31d151+'}$');_0x539278=Math[_0x9c5b('0x8a')](0xa,_0x31d151-0x1);_0x280f33=Math[_0x9c5b('0x8a')](0xa,_0x31d151)-0x1;return util[_0x9c5b('0x11')]('%s',_[_0x9c5b('0x8b')](_0x410efd,_0x44e61d,_[_0x9c5b('0x8c')](_0x539278,_0x280f33)));};exports['extractCalleridName']=function(_0x380b9d){var _0x4f7d16=_0x380b9d[_0x9c5b('0x8d')](/"(.*?)"/);return _0x4f7d16?_0x4f7d16[0x1]:_0x380b9d;};exports[_0x9c5b('0x8e')]=function(_0x4dd204){var _0x51337a=_0x4dd204[_0x9c5b('0x8d')](/<(.*?)>/);return _0x51337a?_0x51337a[0x1]:_0x4dd204;}; \ No newline at end of file +var _0x070e=['dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','responsetime','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','calleridname','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','motionChannel','voice','mandatoryDisposition','agentReadyId','not_inuse','status','reachable','push','getDiff','CampaignId','idContact','type','campaigntype','dialAnswer','active','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','getCallerId','string','isUndefined','format','isEmpty','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId'];(function(_0x59ec59,_0x4ed24c){var _0x303114=function(_0xf153e9){while(--_0xf153e9){_0x59ec59['push'](_0x59ec59['shift']());}};_0x303114(++_0x4ed24c);}(_0x070e,0xf5));var _0xe070=function(_0x2f5989,_0xa5da7a){_0x2f5989=_0x2f5989-0x0;var _0x3a1d5c=_0x070e[_0x2f5989];return _0x3a1d5c;};'use strict';var util=require(_0xe070('0x0'));var _=require(_0xe070('0x1'));var moment=require('moment');var logger=require(_0xe070('0x2'))(_0xe070('0x3'));var ipAgi=process['env'][_0xe070('0x4')]||_0xe070('0x5');function getSeconds(_0x5231ca,_0x1a80ee){var _0x54f572=moment(_0x5231ca)[_0xe070('0x6')](0x0);var _0x441ea4=moment(_0x1a80ee)[_0xe070('0x6')](0x0);return _0x54f572[_0xe070('0x7')](_0x441ea4,_0xe070('0x8'));}exports[_0xe070('0x9')]=function(_0x1baea1){return function(_0x5a5b7c){logger[_0xe070('0xa')](_0x1baea1,util[_0xe070('0xb')](_0x5a5b7c,{'showHidden':![],'depth':null}));};};exports[_0xe070('0xc')]=function(_0x25003e,_0x190996){logger[_0xe070('0xd')](_0x25003e,util[_0xe070('0xb')](_0x190996,{'showHidden':![],'depth':null}));};exports[_0xe070('0xe')]=function(_0x1758d1,_0x2becb5){logger[_0xe070('0xa')](_0x1758d1,util[_0xe070('0xb')](_0x2becb5,{'showHidden':![],'depth':null}));};exports[_0xe070('0xf')]=function(_0x2d77bd){return function(_0xc0bdb8){logger[_0xe070('0xd')](_0x2d77bd,util['inspect'](_0xc0bdb8,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x554fd7,_0x4de39c,_0x5b9237){return{'message':_0x554fd7,'unlock':_0x4de39c,'active':_0x5b9237};};exports[_0xe070('0x10')]=function(_0x2ce579,_0x22b102,_0x28be79){if(!_['isUndefined'](_0x28be79)&&_0xe070('0x11')===typeof _0x28be79&&!_['isEmpty'](_0x28be79)){if(!_[_0xe070('0x12')](_0x22b102)&&'string'===typeof _0x22b102&&!_['isEmpty'](_0x22b102)){return util['format']('\x22%s\x22\x20<%s>',_0x22b102,_0x28be79);}return util[_0xe070('0x13')]('\x22%s\x22\x20<%s>',_0x28be79,_0x28be79);}if(!_['isUndefined'](_0x2ce579)&&'string'===typeof _0x2ce579&&!_[_0xe070('0x14')](_0x2ce579)){return _0x2ce579;}return _0xe070('0x15');};exports[_0xe070('0x16')]=function(_0x510634){if(_[_0xe070('0x17')](_0x510634)){return![];}return _0x510634;};exports[_0xe070('0x18')]=function(_0x292382,_0x754539,_0x2aa73b,_0x22cf9d,_0x16b02a,_0x17ff1d){var _0x22d18f={'XMD-QUEUE':_0x754539[_0xe070('0x19')]?_0x754539[_0xe070('0x19')][_0xe070('0x1a')]:'','XMD-CALLERID':_0x22cf9d,'XMD-CALLERID-PREVIEW':_0x17ff1d?util['format']('\x22%s\x22\x20<%s>',_0x17ff1d['calleridname'],_0x17ff1d[_0xe070('0x1b')]):_0x22cf9d,'XMD-DIALID':_0x16b02a,'XMD-CONTACTID':_0x754539[_0xe070('0x1c')],'XMD-CDRTYPE':_0xe070('0x1d'),'CALLERID(all)':_0x22cf9d,'XMD-VOICEQUEUEID':_0x754539[_0xe070('0x1e')],'XMD-DIALCHANNEL':_0x2aa73b,'XMD-DIALTIMEOUT':_0x292382['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xe070('0x13')](_0xe070('0x1f'),_0x292382['dialQueueProject2']?'g':'',_['isEmpty'](_0x292382['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x292382[_0xe070('0x20')]||'','XMD-AGI':_0x292382[_0xe070('0x21')]?util['format'](_0xe070('0x22'),ipAgi,_0x292382['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x292382[_0xe070('0x23')]?util[_0xe070('0x13')](_0xe070('0x22'),ipAgi,_0x292382[_0xe070('0x23')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x17ff1d?_0x17ff1d[_0xe070('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x17ff1d?_0x17ff1d[_0xe070('0x25')]:'','XMD-DESTINATION':_0xe070('0x26'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x292382['monitor_format'])){_0x22d18f[util[_0xe070('0x13')]('%s',_0xe070('0x27'))]=_0x292382['monitor_format'];_0x22d18f[util['format']('%s',_0xe070('0x28'))]=_0x16b02a;}if(_0x754539&&_0x754539[_0xe070('0x29')]){for(var _0x1aae23 in _0x754539['Contact']){if(_0x754539[_0xe070('0x29')][_0xe070('0x2a')](_0x1aae23)){if(!_[_0xe070('0x17')](_0x754539[_0xe070('0x29')][_0x1aae23])&&_0x1aae23!=='id'&&_0x1aae23!==_0xe070('0x2b')&&_0x1aae23!=='createdAt'&&_0x1aae23!=='updatedAt'){_0x22d18f[util[_0xe070('0x13')](_0xe070('0x2c'),_0xe070('0x2d'),_[_0xe070('0x2e')](_0x1aae23))]=_0x754539['Contact'][_0x1aae23];}}}}return _0x22d18f;};exports[_0xe070('0x2f')]=function(_0x4647d){var _0x5e4c75={};for(var _0x163118 in _0x4647d){if(_0x4647d[_0xe070('0x2a')](_0x163118)){_0x5e4c75[util[_0xe070('0x13')]('%s',_[_0xe070('0x30')](_0x163118))]=_0x4647d[_0x163118];}}return{'variables':_0x5e4c75};};exports['updateOriginated']=function(_0x44bf43,_0x182c29){if(!_[_0xe070('0x17')](_0x44bf43)){if(_0x44bf43[_0xe070('0x2a')](_0xe070('0x31'))){if(_0x44bf43[_0xe070('0x31')]>0x0){_0x44bf43['originated']-=0x1;}else{logger[_0xe070('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x182c29);}}}else{logger[_0xe070('0xa')](_0xe070('0x32'),_0x182c29);}};exports[_0xe070('0x33')]=function(_0x5a833e){var _0x1fb0f5=moment()[_0xe070('0x13')](_0xe070('0x34'));_0x5a833e[_0xe070('0x35')]=0xd;_0x5a833e[_0xe070('0x36')]='Blacklist';_0x5a833e['starttime']=_0x1fb0f5;_0x5a833e['responsetime']=_0x1fb0f5;_0x5a833e[_0xe070('0x37')]=_0x1fb0f5;};exports['logAgent']=function(_0x4db755,_0x3e50b5,_0x4ab7f6){var _0x2a2163=moment()[_0xe070('0x13')](_0xe070('0x34'));_0x4db755[_0xe070('0x35')]=_0x3e50b5;_0x4db755['statedesc']=_0x4ab7f6;_0x4db755[_0xe070('0x38')]=_0x2a2163;_0x4db755[_0xe070('0x39')]=getSeconds(_0x4db755[_0xe070('0x38')],_0x4db755[_0xe070('0x3a')]);};exports[_0xe070('0x3b')]=function(_0x8b1fe4,_0x4ec2cf,_0x58ff5f){_0x8b1fe4[_0xe070('0x3c')]=_0x4ec2cf;_0x8b1fe4[_0xe070('0x3d')]=_0x58ff5f;};exports[_0xe070('0x3e')]=function(_0x5cc842,_0x33c0bf,_0x283d7c){var _0x3564f8=moment()[_0xe070('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cc842[_0xe070('0x35')]=_0x33c0bf;_0x5cc842['statedesc']=_0x283d7c;_0x5cc842[_0xe070('0x38')]=_0x5cc842[_0xe070('0x38')]?_0x5cc842[_0xe070('0x38')]:_0x3564f8;_0x5cc842['endtime']=_0x5cc842[_0xe070('0x37')]?_0x5cc842[_0xe070('0x37')]:_0x3564f8;_0x5cc842[_0xe070('0x39')]=getSeconds(_0x5cc842['responsetime']||0x0,_0x5cc842[_0xe070('0x3a')]||0x0);_0x5cc842[_0xe070('0x3f')]=_0x5cc842['answertime']?getSeconds(_0x5cc842[_0xe070('0x37')],_0x5cc842[_0xe070('0x40')]):0x0;};exports[_0xe070('0x41')]=function(_0x16f212){return _0x16f212===_0xe070('0x42');};exports['variablesAction']=function(_0x3705e1,_0x22f4bb,_0x5560a1,_0x5396a9,_0x44aa03){var _0x26dfa9=_0x5396a9?_0xe070('0x43'):_0x3705e1[_0xe070('0x44')];_0x26dfa9=_0x44aa03?'BOOKED':_0x26dfa9;return{'actionid':_0x3705e1[_0xe070('0x45')],'action':_0xe070('0x46'),'channel':_0x3705e1[_0xe070('0x47')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x26dfa9,_0x3705e1[_0xe070('0x1b')]),'Exten':'xcally-motion-preview','Context':_0xe070('0x48'),'Priority':'1','variable':_0x5560a1,'timeout':(_0x22f4bb[_0xe070('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3705e1['uniqueid']};};exports[_0xe070('0x4a')]=function(_0x2dc5a2){return _0x2dc5a2['countbusyretry']+_0x2dc5a2['countcongestionretry']+_0x2dc5a2[_0xe070('0x4b')]+_0x2dc5a2[_0xe070('0x4c')]+_0x2dc5a2['countnosuchnumberretry'];};exports[_0xe070('0x4d')]=function(_0x1a59c4){var _0x1cc93f=_[_0xe070('0x4e')](_0x1a59c4);_0x1cc93f[_0xe070('0x35')]=0xf;_0x1cc93f[_0xe070('0x36')]=_0xe070('0x4f');return _0x1cc93f;};exports['scheduledAt']=function(_0x5c366d,_0x464985,_0x3829ba){var _0x437bf0={};_0x437bf0[_0x464985]=_0x5c366d[_0x464985];_0x437bf0['active']=![];_0x437bf0[_0xe070('0x50')]=moment()['add'](_0x3829ba,'minutes')[_0xe070('0x13')](_0xe070('0x34'));_0x437bf0[_0xe070('0x1c')]=_0x5c366d[_0xe070('0x1c')];_0x437bf0[_0xe070('0x51')]=_0x5c366d['ListId'];_0x437bf0[_0xe070('0x1e')]=_0x5c366d['VoiceQueueId']||undefined;return _0x437bf0;};exports[_0xe070('0x52')]=function(_0x1e74ce,_0x3ddd9e){if(!_['isNil'](_0x1e74ce)){if(_0x1e74ce[_0xe070('0x53')]>0x0){_0x1e74ce[_0xe070('0x53')]-=0x1;}else{logger[_0xe070('0xa')](_0x3ddd9e,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xe070('0xa')](_0x3ddd9e,_0xe070('0x54'));}};exports[_0xe070('0x55')]=function(_0x3482cd){if(_0x3482cd<=0x0){return!![];}return![];};exports[_0xe070('0x56')]=function(_0x56b8e3,_0x509159,_0x1b3b7a){_0x56b8e3['lastevent']=_0x509159;_0x56b8e3['name']=_0x56b8e3[_0xe070('0x57')];_0x56b8e3[_0xe070('0x58')]=_0x56b8e3['channelAgent'];_0x56b8e3[_0xe070('0x59')]=_0xe070('0x5a');if(_0x1b3b7a){_0x56b8e3[_0xe070('0x5b')]=_0x1b3b7a[_0xe070('0x5b')];}return _0x56b8e3;};exports['buildAcw']=function(_0x1aef22){var _0x2b16b4={};_0x2b16b4[_0xe070('0x57')]=_0x1aef22[_0xe070('0x57')];_0x2b16b4[_0xe070('0x58')]=_0x1aef22[_0xe070('0x47')];_0x2b16b4[_0xe070('0x45')]=_0x1aef22['uniqueid'];return _0x2b16b4;};exports[_0xe070('0x5c')]=function(_0x4348e7){var _0x88ae1b=[];for(var _0x4b8c82 in _0x4348e7){if(_0x4348e7[_0xe070('0x2a')](_0x4b8c82)){if(!_[_0xe070('0x17')](_0x4348e7[_0x4b8c82])&&_0x4348e7[_0x4b8c82]['state']===_0xe070('0x5d')&&_0x4348e7[_0x4b8c82][_0xe070('0x5e')]===_0xe070('0x5f')){_0x88ae1b[_0xe070('0x60')](_0x4348e7[_0x4b8c82]['id']);}}}return _0x88ae1b;};exports[_0xe070('0x61')]=function(_0x3a386a){var _0x4d07f0=moment()[_0xe070('0x6')](0x0);var _0x8c9425=moment(_0x3a386a)[_0xe070('0x6')](0x0);return _0x4d07f0[_0xe070('0x7')](_0x8c9425,'seconds');};exports['createBody']=function(_0x576923){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x576923['ContactId'],'ListId':_0x576923[_0xe070('0x51')],'VoiceQueueId':_0x576923['VoiceQueueId']||undefined,'CampaignId':_0x576923[_0xe070('0x62')]||undefined};};exports['filterKey']=function(_0x118fe3){if(_0x118fe3===_0xe070('0x45')||_0x118fe3===_0xe070('0x63')||_0x118fe3===_0xe070('0x57')||_0x118fe3===_0xe070('0x64')||_0x118fe3===_0xe070('0x65')||_0x118fe3===_0xe070('0x66')||_0x118fe3===_0xe070('0x3c')||_0x118fe3==='channelAgent'||_0x118fe3===_0xe070('0x44')||_0x118fe3===_0xe070('0x67')||_0x118fe3===_0xe070('0x1b')||_0x118fe3==='scheduledat'||_0x118fe3==='countbusyretry'||_0x118fe3===_0xe070('0x68')||_0x118fe3==='countnoanswerretry'||_0x118fe3===_0xe070('0x69')||_0x118fe3===_0xe070('0x6a')||_0x118fe3===_0xe070('0x6b')||_0x118fe3===_0xe070('0x6c')||_0x118fe3===_0xe070('0x6d')||_0x118fe3===_0xe070('0x1c')||_0x118fe3===_0xe070('0x51')||_0x118fe3===_0xe070('0x3d')||_0x118fe3===_0xe070('0x1e')||_0x118fe3===_0xe070('0x6e')||_0x118fe3===_0xe070('0x6f')||_0x118fe3==='xmd-queue'||_0x118fe3===_0xe070('0x70')||_0x118fe3==='xmd-listid'||_0x118fe3==='xmd-dialurl'||_0x118fe3===_0xe070('0x71')||_0x118fe3===_0xe070('0x72')||_0x118fe3===_0xe070('0x73')||_0x118fe3===_0xe070('0x74')||_0x118fe3===_0xe070('0x75')||_0x118fe3===_0xe070('0x76')||_0x118fe3==='xmd-callerid'||_0x118fe3===_0xe070('0x77')||_0x118fe3==='xmd-agi'||_0x118fe3==='rtpaudioqos'||_0x118fe3==='rtpaudioqosbridged'||_0x118fe3===_0xe070('0x78')||_0x118fe3===_0xe070('0x79')||_0x118fe3===_0xe070('0x7a')||_0x118fe3==='rtpaudioqoslossbridged'||_0x118fe3===_0xe070('0x7b')||_0x118fe3===_0xe070('0x7c')||_0x118fe3===_0xe070('0x7d')||_0x118fe3===_0xe070('0x7e')||_0x118fe3==='rtpaudioqosjitter'||_0x118fe3===_0xe070('0x79')||_0x118fe3===_0xe070('0x7a')||_0x118fe3===_0xe070('0x7f')||_0x118fe3===_0xe070('0x7b')||_0x118fe3===_0xe070('0x7c')||_0x118fe3===_0xe070('0x80')||_0x118fe3===_0xe070('0x81')||_0x118fe3===_0xe070('0x35')||_0x118fe3===_0xe070('0x36')){return![];}return!![];};exports[_0xe070('0x82')]=function(_0x1700bc,_0x2782d8){var _0x1ec292,_0xad6cea,_0x458d5c;if(_0x2782d8<=0x0){_0x2782d8=0x1;}_0x1ec292=new RegExp(_0xe070('0x83')+_0x2782d8+'}$');_0xad6cea=Math[_0xe070('0x84')](0xa,_0x2782d8-0x1);_0x458d5c=Math['pow'](0xa,_0x2782d8)-0x1;return util['format']('%s',_[_0xe070('0x85')](_0x1700bc,_0x1ec292,_['random'](_0xad6cea,_0x458d5c)));};exports[_0xe070('0x86')]=function(_0x5b07c7){var _0x1616bd=_0x5b07c7[_0xe070('0x87')](/"(.*?)"/);return _0x1616bd?_0x1616bd[0x1]:_0x5b07c7;};exports[_0xe070('0x88')]=function(_0x298e41){var _0xbb45d4=_0x298e41[_0xe070('0x87')](/<(.*?)>/);return _0xbb45d4?_0xbb45d4[0x1]:_0x298e41;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index b92878e..b1b0ba7 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 _0x9a25=['voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9a25,0x81));var _0x59a2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9a25[_0x5b644e];return _0x49c6bf;};'use strict';exports[_0x59a2('0x0')]={'queue':{'type':_0x59a2('0x1'),'required':!![]},'interface':{'type':_0x59a2('0x1'),'required':!![]},'membername':{'type':_0x59a2('0x1'),'required':!![]},'penalty':{'type':_0x59a2('0x2'),'required':![]},'paused':{'type':_0x59a2('0x3'),'required':![]}};exports[_0x59a2('0x4')]={'queue':{'type':_0x59a2('0x1'),'required':!![]},'interface':{'type':_0x59a2('0x1'),'required':!![]}};exports[_0x59a2('0x5')]={'interface':{'type':_0x59a2('0x1'),'required':!![]},'paused':{'type':_0x59a2('0x3')},'reason':{'type':_0x59a2('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x59a2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x59a2('0x1'),'required':!![]},'filename':{'type':_0x59a2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x59a2('0x7')]={'uniqueid':{'type':_0x59a2('0x1'),'required':!![]}};exports[_0x59a2('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x59a2('0x1'),'required':!![]},'context':{'type':_0x59a2('0x1')}}; \ No newline at end of file +var _0xc6a3=['reload','voicechannel','voicequeuechannelredirect','queueadd','string','boolean','queuepause'];(function(_0x347ed4,_0x1d35be){var _0x2dedcf=function(_0x5ec1fd){while(--_0x5ec1fd){_0x347ed4['push'](_0x347ed4['shift']());}};_0x2dedcf(++_0x1d35be);}(_0xc6a3,0x1ae));var _0x3c6a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc6a3[_0x1facfa];return _0x9ec701;};'use strict';exports[_0x3c6a('0x0')]={'queue':{'type':_0x3c6a('0x1'),'required':!![]},'interface':{'type':_0x3c6a('0x1'),'required':!![]},'membername':{'type':_0x3c6a('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x3c6a('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x3c6a('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x3c6a('0x3')]={'interface':{'type':_0x3c6a('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x3c6a('0x4')]={'module':{'type':_0x3c6a('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x3c6a('0x1'),'required':!![]}};exports[_0x3c6a('0x5')]={'uniqueid':{'type':_0x3c6a('0x1'),'required':!![]},'filename':{'type':_0x3c6a('0x1')},'format':{'type':_0x3c6a('0x1')},'mixmonitorid':{'type':_0x3c6a('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x3c6a('0x1'),'required':!![]}};exports[_0x3c6a('0x6')]={'uniqueid':{'type':_0x3c6a('0x1'),'required':!![]},'exten':{'type':_0x3c6a('0x1'),'required':!![]},'context':{'type':_0x3c6a('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index ff892fe..4c37471 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 _0xaf00=['length','isUndefined','initTelephones','telephones','initTrunks','voiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','servicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','ANSWERED','duration','billableseconds','SquareProject','initVoiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','triggers','campaigns','templates','outbound','voiceExtensions','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase'];(function(_0x61711c,_0x5b2962){var _0x4cf0e9=function(_0x179352){while(--_0x179352){_0x61711c['push'](_0x61711c['shift']());}};_0x4cf0e9(++_0x5b2962);}(_0xaf00,0x8f));var _0x0af0=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0xaf00[_0x495e9f];return _0xb249d2;};'use strict';var BPromise=require(_0x0af0('0x0'));var util=require(_0x0af0('0x1'));var _=require(_0x0af0('0x2'));var moment=require('moment');var Agent=require(_0x0af0('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x0af0('0x4'));var VoiceQueue=require(_0x0af0('0x5'));var Trigger=require(_0x0af0('0x6'));var Template=require(_0x0af0('0x7'));var Campaign=require(_0x0af0('0x8'));var VoiceExtension=require(_0x0af0('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x0af0('0xa'));var SugarcrmAccount=require(_0x0af0('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x0af0('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x0af0('0xd'));var Dynamics365Account=require(_0x0af0('0xe'));var FreshsalesAccount=require(_0x0af0('0xf'));var FaxAccount=require(_0x0af0('0x10'));var Realtime=function(){this[_0x0af0('0x11')]={};this['telephones']={};this[_0x0af0('0x12')]={};this['voiceQueues']={};this[_0x0af0('0x13')]={};this[_0x0af0('0x14')]={};this[_0x0af0('0x15')]={};this[_0x0af0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x0af0('0x17')]={};this['channels']={};this['queueChannels']={};this[_0x0af0('0x18')]={};this[_0x0af0('0x19')]={};this[_0x0af0('0x1a')]={};this[_0x0af0('0x1b')]={};this[_0x0af0('0x1c')]={};this[_0x0af0('0x1d')]={};this[_0x0af0('0x1e')]={};this[_0x0af0('0x1f')]={};this['deskAccounts']={};this[_0x0af0('0x20')]={};this['servicenowAccounts']={};this[_0x0af0('0x21')]={};this[_0x0af0('0x22')]={};this[_0x0af0('0x23')]={};};function freeIsNotKey(_0x2cde3f,_0x51f466,_0x52fcc0){var _0x1950e9=_[_0x0af0('0x24')](_0x2cde3f,function(_0xdadc2a,_0x2ba3b3){return _0xdadc2a[_0x52fcc0];});for(var _0x549cee in _0x51f466){if(_0x51f466[_0x0af0('0x25')](_0x549cee)){if(!_0x1950e9[_0x549cee]){delete _0x51f466[_0x549cee];}}}}function freeIsNotKeySip(_0x4c05ce,_0x4e2820){var _0x4b2a2b=_[_0x0af0('0x24')](_0x4c05ce,function(_0x3ae482,_0x2c83b2){return util[_0x0af0('0x26')](_0x0af0('0x27'),_0x3ae482[_0x0af0('0x28')]);});for(var _0x3f62ac in _0x4e2820){if(_0x4e2820[_0x0af0('0x25')](_0x3f62ac)){if(!_0x4b2a2b[_0x3f62ac]){delete _0x4e2820[_0x3f62ac];}}}}function freeIsNotKeyAgent(_0x1a7b75,_0xe36ba1){var _0x4a31ef=_[_0x0af0('0x24')](_0x1a7b75,function(_0x5e4cd3,_0x4e9afb){var _0x1d8694=_[_0x0af0('0x29')](_0x5e4cd3[_0x0af0('0x2a')])?util['format'](_0x0af0('0x27'),_0x5e4cd3[_0x0af0('0x28')]):_0x5e4cd3[_0x0af0('0x2a')];return _0x1d8694;});for(var _0x3888c4 in _0xe36ba1){if(_0xe36ba1[_0x0af0('0x25')](_0x3888c4)){if(!_0x4a31ef[_0x3888c4]){delete _0xe36ba1[_0x3888c4];}}}}function clearVoiceCallReports(_0x2711a0){_0x2711a0[_0x0af0('0x2b')]=0x0;_0x2711a0['answered']=0x0;_0x2711a0[_0x0af0('0x2c')]=0x0;_0x2711a0[_0x0af0('0x2d')]=0x0;_0x2711a0[_0x0af0('0x2e')]=0x0;}function clearCampaigns(_0x2243f3){if(!_[_0x0af0('0x2f')](_0x2243f3)){for(var _0x29c1f5 in _0x2243f3){if(_0x2243f3['hasOwnProperty'](_0x29c1f5)){_0x2243f3[_0x29c1f5][_0x0af0('0x30')]=0x0;_0x2243f3[_0x29c1f5][_0x0af0('0x31')]=0x0;}}}}function clearVoiceQueues(_0x5228af){if(!_[_0x0af0('0x2f')](_0x5228af)){for(var _0x18e0a4 in _0x5228af){if(_0x5228af[_0x0af0('0x25')](_0x18e0a4)){_0x5228af[_0x18e0a4][_0x0af0('0x2b')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x32')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x33')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x34')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x2c')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x2d')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x2e')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x35')]=0x0;_0x5228af[_0x18e0a4]['outboundNoAnswerCallsDay']=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x36')]=0x0;_0x5228af[_0x18e0a4]['outboundCongestionCallsDay']=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x37')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x38')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x39')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3a')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3b')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3c')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3d')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3e')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x35')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3f')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x40')]=!![];}}}}Realtime[_0x0af0('0x41')][_0x0af0('0x42')]=function(_0x237e8e,_0x4c1495){for(var _0x903889 in _0x4c1495){if(_0x237e8e[_0x0af0('0x25')](_0x903889)){_0x237e8e[_0x903889]=_0x4c1495[_0x903889];}}};Realtime[_0x0af0('0x41')]['initAgents']=function(){var _0x2f7c4c=this;return function(_0x41d031){if(_0x41d031){freeIsNotKeyAgent(_0x41d031,_0x2f7c4c['agents']);for(var _0x4cf1da=0x0,_0x2df2d9={},_0x172f93={};_0x4cf1da<_0x41d031[_0x0af0('0x43')];_0x4cf1da+=0x1){_0x2df2d9=_0x41d031[_0x4cf1da];var _0x1db0c2=_[_0x0af0('0x29')](_0x2df2d9[_0x0af0('0x2a')])?util['format'](_0x0af0('0x27'),_0x2df2d9[_0x0af0('0x28')]):_0x2df2d9[_0x0af0('0x2a')];if(_[_0x0af0('0x44')](_0x2f7c4c[_0x0af0('0x11')][_0x1db0c2])){_0x2f7c4c[_0x0af0('0x11')][_0x1db0c2]=new Agent(_0x2df2d9);}else{_0x2f7c4c[_0x0af0('0x42')](_0x2f7c4c[_0x0af0('0x11')][_0x1db0c2],_0x2df2d9);}}}return _0x2f7c4c['agents'];};};Realtime[_0x0af0('0x41')][_0x0af0('0x45')]=function(){var _0x282538=this;return function(_0x326a6a){if(_0x326a6a){freeIsNotKeySip(_0x326a6a,_0x282538[_0x0af0('0x46')]);for(var _0x5bf9f3=0x0,_0x2b2e47={},_0x641b0={};_0x5bf9f3<_0x326a6a['length'];_0x5bf9f3+=0x1){_0x2b2e47=_0x326a6a[_0x5bf9f3];if(_[_0x0af0('0x44')](_0x282538['telephones'][util[_0x0af0('0x26')](_0x0af0('0x27'),_0x2b2e47[_0x0af0('0x28')])])){_0x282538[_0x0af0('0x46')][util[_0x0af0('0x26')]('SIP/%s',_0x2b2e47[_0x0af0('0x28')])]=new Telephone(_0x2b2e47);}else{_0x282538['mergeFromDatabase'](_0x282538[_0x0af0('0x46')][util[_0x0af0('0x26')]('SIP/%s',_0x2b2e47[_0x0af0('0x28')])],_0x2b2e47);}}}return _0x282538['telephones'];};};Realtime['prototype'][_0x0af0('0x47')]=function(){var _0x388c9c=this;return function(_0x1bf1e0){if(_0x1bf1e0){freeIsNotKeySip(_0x1bf1e0,_0x388c9c[_0x0af0('0x12')]);for(var _0x283252=0x0,_0x15e266={},_0x53a304={};_0x283252<_0x1bf1e0['length'];_0x283252+=0x1){_0x15e266=_0x1bf1e0[_0x283252];if(_[_0x0af0('0x44')](_0x388c9c[_0x0af0('0x12')][util['format']('SIP/%s',_0x15e266['name'])])){_0x388c9c[_0x0af0('0x12')][util[_0x0af0('0x26')]('SIP/%s',_0x15e266[_0x0af0('0x28')])]=new Trunk(_0x15e266);}else{_0x388c9c[_0x0af0('0x42')](_0x388c9c[_0x0af0('0x12')][util[_0x0af0('0x26')]('SIP/%s',_0x15e266['name'])],_0x15e266);}}}return _0x388c9c[_0x0af0('0x12')];};};Realtime[_0x0af0('0x41')]['initVoiceQueues']=function(){var _0x4b9030=this;return function(_0x3bf52d){if(_0x3bf52d){freeIsNotKey(_0x3bf52d,_0x4b9030['voiceQueues'],_0x0af0('0x28'));for(var _0x95a1e1=0x0,_0xd1f372={},_0x455620={};_0x95a1e1<_0x3bf52d[_0x0af0('0x43')];_0x95a1e1+=0x1){_0xd1f372=_0x3bf52d[_0x95a1e1];if(_[_0x0af0('0x44')](_0x4b9030[_0x0af0('0x48')][_0xd1f372[_0x0af0('0x28')]])){_0x4b9030[_0x0af0('0x48')][_0xd1f372[_0x0af0('0x28')]]=new VoiceQueue(_0xd1f372);}else{_0x4b9030[_0x0af0('0x42')](_0x4b9030['voiceQueues'][_0xd1f372[_0x0af0('0x28')]],_0xd1f372);}}}return _0x4b9030[_0x0af0('0x48')];};};Realtime[_0x0af0('0x41')]['initTriggers']=function(){var _0xba4fc9=this;return function(_0x45b5d9){if(_0x45b5d9){freeIsNotKey(_0x45b5d9,_0xba4fc9[_0x0af0('0x13')],'id');for(var _0x55a532=0x0,_0x2fac16={},_0x1ae9d3={};_0x55a532<_0x45b5d9[_0x0af0('0x43')];_0x55a532+=0x1){_0x2fac16=_0x45b5d9[_0x55a532];if(_['isUndefined'](_0xba4fc9['triggers'][_0x2fac16['id']])){_0xba4fc9[_0x0af0('0x13')][_0x2fac16['id']]=new Trigger(_0x2fac16);}else{_0xba4fc9[_0x0af0('0x42')](_0xba4fc9['triggers'][_0x2fac16['id']],_0x2fac16);}}}return _0xba4fc9[_0x0af0('0x13')];};};Realtime['prototype'][_0x0af0('0x49')]=function(){var _0x301db1=this;return function(_0x4af083){if(_0x4af083){freeIsNotKey(_0x4af083,_0x301db1[_0x0af0('0x15')],'id');for(var _0x5ad84f=0x0,_0x5712a4={},_0x1cfa89={};_0x5ad84f<_0x4af083[_0x0af0('0x43')];_0x5ad84f+=0x1){_0x5712a4=_0x4af083[_0x5ad84f];if(_[_0x0af0('0x44')](_0x301db1[_0x0af0('0x15')][_0x5712a4['id']])){_0x301db1['templates'][_0x5712a4['id']]=new Template(_0x5712a4);}else{_0x301db1['mergeFromDatabase'](_0x301db1[_0x0af0('0x15')][_0x5712a4['id']],_0x5712a4);}}}return _0x301db1[_0x0af0('0x15')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4a')]=function(){var _0x5c1cde=this;return function(_0x52b84b){if(_0x52b84b){freeIsNotKey(_0x52b84b,_0x5c1cde[_0x0af0('0x1b')],'id');for(var _0x1d13dc=0x0,_0x5e946b={},_0xfddd2a={};_0x1d13dc<_0x52b84b['length'];_0x1d13dc+=0x1){_0x5e946b=_0x52b84b[_0x1d13dc];if(_[_0x0af0('0x44')](_0x5c1cde[_0x0af0('0x1b')][_0x5e946b['id']])){_0x5c1cde[_0x0af0('0x1b')][_0x5e946b['id']]=new ZendeskAccount(_0x5e946b);}else{_0x5c1cde['mergeFromDatabase'](_0x5c1cde[_0x0af0('0x1b')][_0x5e946b['id']],_0x5e946b);}}}return _0x5c1cde['zendeskAccounts'];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4b')]=function(){var _0x525001=this;return function(_0x44e41b){if(_0x44e41b){freeIsNotKey(_0x44e41b,_0x525001[_0x0af0('0x1c')],'id');for(var _0x29f20d=0x0,_0x428579={},_0x43beee={};_0x29f20d<_0x44e41b[_0x0af0('0x43')];_0x29f20d+=0x1){_0x428579=_0x44e41b[_0x29f20d];if(_[_0x0af0('0x44')](_0x525001[_0x0af0('0x1c')][_0x428579['id']])){_0x525001[_0x0af0('0x1c')][_0x428579['id']]=new SalesforceAccount(_0x428579);}else{_0x525001[_0x0af0('0x42')](_0x525001['salesforceAccounts'][_0x428579['id']],_0x428579);}}}return _0x525001[_0x0af0('0x1c')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4c')]=function(){var _0x23f14c=this;return function(_0x7ae8e7){if(_0x7ae8e7){freeIsNotKey(_0x7ae8e7,_0x23f14c[_0x0af0('0x1e')],'id');for(var _0x45c250=0x0,_0x581ebb={},_0xb60e55={};_0x45c250<_0x7ae8e7[_0x0af0('0x43')];_0x45c250+=0x1){_0x581ebb=_0x7ae8e7[_0x45c250];if(_[_0x0af0('0x44')](_0x23f14c[_0x0af0('0x1e')][_0x581ebb['id']])){_0x23f14c[_0x0af0('0x1e')][_0x581ebb['id']]=new FreshdeskAccount(_0x581ebb);}else{_0x23f14c[_0x0af0('0x42')](_0x23f14c[_0x0af0('0x1e')][_0x581ebb['id']],_0x581ebb);}}}return _0x23f14c[_0x0af0('0x1e')];};};Realtime[_0x0af0('0x41')]['initZohoAccounts']=function(){var _0x58084e=this;return function(_0x4a8ee8){if(_0x4a8ee8){freeIsNotKey(_0x4a8ee8,_0x58084e[_0x0af0('0x1f')],'id');for(var _0x24b4da=0x0,_0x110d28={},_0xdc50e0={};_0x24b4da<_0x4a8ee8['length'];_0x24b4da+=0x1){_0x110d28=_0x4a8ee8[_0x24b4da];if(_[_0x0af0('0x44')](_0x58084e[_0x0af0('0x1f')][_0x110d28['id']])){_0x58084e['zohoAccounts'][_0x110d28['id']]=new ZohoAccount(_0x110d28);}else{_0x58084e[_0x0af0('0x42')](_0x58084e[_0x0af0('0x1f')][_0x110d28['id']],_0x110d28);}}}return _0x58084e[_0x0af0('0x1f')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4d')]=function(){var _0x4a6a1e=this;return function(_0x5cf0b7){if(_0x5cf0b7){freeIsNotKey(_0x5cf0b7,_0x4a6a1e[_0x0af0('0x4e')],'id');for(var _0x603fcf=0x0,_0x4e138e={},_0x1a33b5={};_0x603fcf<_0x5cf0b7[_0x0af0('0x43')];_0x603fcf+=0x1){_0x4e138e=_0x5cf0b7[_0x603fcf];if(_['isUndefined'](_0x4a6a1e['deskAccounts'][_0x4e138e['id']])){_0x4a6a1e[_0x0af0('0x4e')][_0x4e138e['id']]=new DeskAccount(_0x4e138e);}else{_0x4a6a1e[_0x0af0('0x42')](_0x4a6a1e[_0x0af0('0x4e')][_0x4e138e['id']],_0x4e138e);}}}return _0x4a6a1e[_0x0af0('0x4e')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4f')]=function(){var _0x577969=this;return function(_0x438398){if(_0x438398){freeIsNotKey(_0x438398,_0x577969[_0x0af0('0x1d')],'id');for(var _0xf1d28b=0x0,_0x5ee7c0={},_0x5c2752={};_0xf1d28b<_0x438398[_0x0af0('0x43')];_0xf1d28b+=0x1){_0x5ee7c0=_0x438398[_0xf1d28b];if(_[_0x0af0('0x44')](_0x577969[_0x0af0('0x1d')][_0x5ee7c0['id']])){_0x577969[_0x0af0('0x1d')][_0x5ee7c0['id']]=new SugarcrmAccount(_0x5ee7c0);}else{_0x577969[_0x0af0('0x42')](_0x577969[_0x0af0('0x1d')][_0x5ee7c0['id']],_0x5ee7c0);}}}return _0x577969[_0x0af0('0x1d')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x50')]=function(){var _0x116f36=this;return function(_0x151eeb){if(_0x151eeb){freeIsNotKey(_0x151eeb,_0x116f36[_0x0af0('0x20')],'id');for(var _0x7d6a2=0x0,_0x180d3e={},_0x30a3c1={};_0x7d6a2<_0x151eeb[_0x0af0('0x43')];_0x7d6a2+=0x1){_0x180d3e=_0x151eeb[_0x7d6a2];if(_[_0x0af0('0x44')](_0x116f36[_0x0af0('0x20')][_0x180d3e['id']])){_0x116f36[_0x0af0('0x20')][_0x180d3e['id']]=new VtigerAccount(_0x180d3e);}else{_0x116f36[_0x0af0('0x42')](_0x116f36[_0x0af0('0x20')][_0x180d3e['id']],_0x180d3e);}}}return _0x116f36[_0x0af0('0x20')];};};Realtime[_0x0af0('0x41')]['initServicenowAccounts']=function(){var _0x1bfb63=this;return function(_0x373a36){if(_0x373a36){freeIsNotKey(_0x373a36,_0x1bfb63[_0x0af0('0x51')],'id');for(var _0x24be96=0x0,_0x46dcf8={},_0x182af1={};_0x24be96<_0x373a36[_0x0af0('0x43')];_0x24be96+=0x1){_0x46dcf8=_0x373a36[_0x24be96];if(_['isUndefined'](_0x1bfb63[_0x0af0('0x51')][_0x46dcf8['id']])){_0x1bfb63['servicenowAccounts'][_0x46dcf8['id']]=new ServicenowAccount(_0x46dcf8);}else{_0x1bfb63[_0x0af0('0x42')](_0x1bfb63['servicenowAccounts'][_0x46dcf8['id']],_0x46dcf8);}}}return _0x1bfb63['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x2ff5c6=this;return function(_0x1d5696){if(_0x1d5696){freeIsNotKey(_0x1d5696,_0x2ff5c6[_0x0af0('0x21')],'id');for(var _0x80e039=0x0,_0x4df4da={},_0x27e702={};_0x80e039<_0x1d5696[_0x0af0('0x43')];_0x80e039+=0x1){_0x4df4da=_0x1d5696[_0x80e039];if(_[_0x0af0('0x44')](_0x2ff5c6[_0x0af0('0x21')][_0x4df4da['id']])){_0x2ff5c6[_0x0af0('0x21')][_0x4df4da['id']]=new Dynamics365Account(_0x4df4da);}else{_0x2ff5c6[_0x0af0('0x42')](_0x2ff5c6[_0x0af0('0x21')][_0x4df4da['id']],_0x4df4da);}}}return _0x2ff5c6[_0x0af0('0x21')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x52')]=function(){var _0x2f9b4b=this;return function(_0xe3d919){if(_0xe3d919){freeIsNotKey(_0xe3d919,_0x2f9b4b[_0x0af0('0x22')],'id');for(var _0x49ca9e=0x0,_0x499088={},_0x393034={};_0x49ca9e<_0xe3d919[_0x0af0('0x43')];_0x49ca9e+=0x1){_0x499088=_0xe3d919[_0x49ca9e];if(_[_0x0af0('0x44')](_0x2f9b4b[_0x0af0('0x22')][_0x499088['id']])){_0x2f9b4b[_0x0af0('0x22')][_0x499088['id']]=new FreshsalesAccount(_0x499088);}else{_0x2f9b4b[_0x0af0('0x42')](_0x2f9b4b[_0x0af0('0x22')][_0x499088['id']],_0x499088);}}}return _0x2f9b4b[_0x0af0('0x22')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x53')]=function(){var _0xc2de46=this;return function(_0x25621c){for(var _0x43336a=0x0;_0x43336a<_0x25621c[_0x0af0('0x43')];_0x43336a+=0x1){_[_0x0af0('0x54')](_0xc2de46[_0x0af0('0x48')][_0x25621c[_0x43336a]['name']],_0x25621c[_0x43336a]);}return _0xc2de46['voiceQueues'];};};Realtime[_0x0af0('0x41')][_0x0af0('0x55')]=function(){var _0x31a1ab=this;return function(_0x1f39b3){clearVoiceQueues(_0x31a1ab[_0x0af0('0x48')]);if(_0x1f39b3){_0x1f39b3=_[_0x0af0('0x56')](_0x1f39b3,'uniqueid');for(var _0x3d340a in _0x1f39b3){if(_0x1f39b3['hasOwnProperty'](_0x3d340a)){var _0x545742={};for(var _0x1f16a3=0x0;_0x1f16a3<_0x1f39b3[_0x3d340a]['length'];_0x1f16a3+=0x1){var _0x19921f=_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x57')];if(_0x31a1ab[_0x0af0('0x48')][_0x19921f]){if(_0x1f39b3[_0x3d340a][_0x1f16a3]['queuecallerexit']){_0x31a1ab['voiceQueues'][_0x19921f]['unmanaged']+=0x1;}if(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x58')]){_0x31a1ab[_0x0af0('0x48')][_0x19921f]['abandoned']+=0x1;}_0x31a1ab['voiceQueues'][_0x19921f][_0x0af0('0x2c')]+=moment(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x59')])['diff'](moment(_0x1f39b3[_0x3d340a][_0x1f16a3]['queuecallerjoinAt']),_0x0af0('0x5a'))||0x0;if(_0x1f16a3===_0x1f39b3[_0x3d340a][_0x0af0('0x43')]-0x1){_0x31a1ab[_0x0af0('0x48')][_0x19921f]['sumDuration']+=moment(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5b')]||_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5c')]||_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5d')])[_0x0af0('0x5e')](moment(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5f')]),'seconds')||0x0;_0x31a1ab[_0x0af0('0x48')][_0x19921f]['total']+=0x1;if(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x60')]){_0x31a1ab[_0x0af0('0x48')][_0x19921f][_0x0af0('0x32')]+=0x1;_0x31a1ab['voiceQueues'][_0x19921f][_0x0af0('0x2e')]+=moment(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5b')])['diff'](moment(_0x1f39b3[_0x3d340a][_0x1f16a3]['queuecallerleaveAt']),_0x0af0('0x5a'))||0x0;}}else{_0x31a1ab[_0x0af0('0x48')][_0x19921f]['sumDuration']+=_0x31a1ab[_0x0af0('0x48')][_0x19921f][_0x0af0('0x2c')]||0x0;}}}}}}return _0x31a1ab[_0x0af0('0x48')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x61')]=function(){var _0x18a1f1=this;return function(_0xa684c2){clearVoiceCallReports(_0x18a1f1['outbound']);if(_0xa684c2){for(var _0x570e73=0x0;_0x570e73<_0xa684c2[_0x0af0('0x43')];_0x570e73+=0x1){_0x18a1f1['outbound'][_0x0af0('0x2b')]+=0x1;_0x18a1f1[_0x0af0('0x16')][_0x0af0('0x2d')]+=_0xa684c2[_0x570e73]['duration'];if(_0xa684c2[_0x570e73]['disposition']===_0x0af0('0x62')){_0x18a1f1[_0x0af0('0x16')]['answered']+=0x1;_0x18a1f1[_0x0af0('0x16')][_0x0af0('0x2c')]+=_0xa684c2[_0x570e73][_0x0af0('0x63')]-_0xa684c2[_0x570e73][_0x0af0('0x64')]||0x0;_0x18a1f1[_0x0af0('0x16')][_0x0af0('0x2e')]+=_0xa684c2[_0x570e73][_0x0af0('0x64')];}}}return _0x18a1f1['outbound'];};};Realtime[_0x0af0('0x41')]['initCampaigns']=function(){var _0x26cbca=this;return function(_0x2ed0ef){if(_0x2ed0ef){freeIsNotKey(_0x2ed0ef,_0x26cbca[_0x0af0('0x14')],_0x0af0('0x28'));for(var _0x2c980d=0x0,_0x5e8cf1={};_0x2c980d<_0x2ed0ef[_0x0af0('0x43')];_0x2c980d+=0x1){_0x5e8cf1=_0x2ed0ef[_0x2c980d];if(_[_0x0af0('0x44')](_0x26cbca[_0x0af0('0x14')][_0x5e8cf1[_0x0af0('0x28')]])){_0x26cbca[_0x0af0('0x14')][_0x5e8cf1['name']]=new Campaign(_0x5e8cf1);}else{_0x26cbca['mergeFromDatabase'](_0x26cbca['campaigns'][_0x5e8cf1['name']],_0x5e8cf1);_0x26cbca[_0x0af0('0x14')][_0x5e8cf1[_0x0af0('0x28')]]['dialQueueProject']=_0x5e8cf1[_0x0af0('0x65')]?_0x5e8cf1[_0x0af0('0x65')]['name']:undefined;}}}return _0x26cbca['campaigns'];};};Realtime[_0x0af0('0x41')][_0x0af0('0x66')]=function(){var _0x5be1f7=this;return function(_0x5280e5){if(_0x5280e5){freeIsNotKey(_0x5280e5,_0x5be1f7[_0x0af0('0x17')],'id');for(var _0x3ec149=0x0,_0x221d6b={};_0x3ec149<_0x5280e5[_0x0af0('0x43')];_0x3ec149+=0x1){_0x221d6b=_0x5280e5[_0x3ec149];if(_[_0x0af0('0x44')](_0x5be1f7[_0x0af0('0x17')][_0x221d6b['id']])){_0x5be1f7[_0x0af0('0x17')][_0x221d6b['id']]=new VoiceExtension(_0x221d6b);}else{_0x5be1f7[_0x0af0('0x42')](_0x5be1f7[_0x0af0('0x17')][_0x221d6b['id']],_0x221d6b);}}}return _0x5be1f7['voiceExtensions'];};};Realtime[_0x0af0('0x41')]['initCampaignHopperHistory']=function(){var _0x46e212=this;return function(_0x1e3b5a){clearCampaigns(_0x46e212[_0x0af0('0x14')]);for(var _0x20358e=0x0;_0x20358e<_0x1e3b5a[_0x0af0('0x43')];_0x20358e+=0x1){_['merge'](_0x46e212[_0x0af0('0x14')][_0x1e3b5a[_0x20358e][_0x0af0('0x28')]],_0x1e3b5a[_0x20358e]);}return _0x46e212[_0x0af0('0x14')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x67')]=function(){var _0x239b8b=this;return function(_0x26600d){if(_0x26600d){freeIsNotKey(_0x26600d,_0x239b8b['faxAccounts'],'id');for(var _0x5570ce=0x0,_0x45d879={},_0x5459f4={};_0x5570ce<_0x26600d[_0x0af0('0x43')];_0x5570ce+=0x1){_0x45d879=_0x26600d[_0x5570ce];if(_[_0x0af0('0x44')](_0x239b8b[_0x0af0('0x23')][_0x45d879['id']])){_0x239b8b['faxAccounts'][_0x45d879['id']]=new FaxAccount(_0x45d879);}else{_0x239b8b[_0x0af0('0x42')](_0x239b8b[_0x0af0('0x23')][_0x45d879['id']],_0x45d879);}}}return _0x239b8b[_0x0af0('0x23')];};};module[_0x0af0('0x68')]=Realtime; \ No newline at end of file +var _0x3d05=['../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','campaigns','templates','outbound','queueChannels','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','format','SIP/%s','hasOwnProperty','name','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','answered','unmanaged','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','isUndefined','initTrunks','initVoiceQueues','voiceQueues','initTriggers','triggers','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initZohoAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','uniqueid','queuecallerabandon','abandoned','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','diff','seconds','queuecallercomplete','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','faxAccounts','bluebird','util','lodash','moment','../model/telephone','../model/trunk'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x3d05,0x18e));var _0x53d0=function(_0x54b458,_0x4da21b){_0x54b458=_0x54b458-0x0;var _0x18d704=_0x3d05[_0x54b458];return _0x18d704;};'use strict';var BPromise=require(_0x53d0('0x0'));var util=require(_0x53d0('0x1'));var _=require(_0x53d0('0x2'));var moment=require(_0x53d0('0x3'));var Agent=require('../model/agent');var Telephone=require(_0x53d0('0x4'));var Trunk=require(_0x53d0('0x5'));var VoiceQueue=require(_0x53d0('0x6'));var Trigger=require(_0x53d0('0x7'));var Template=require('../model/template');var Campaign=require(_0x53d0('0x8'));var VoiceExtension=require(_0x53d0('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x53d0('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x53d0('0xb'));var ZohoAccount=require(_0x53d0('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x53d0('0xd'));var ServicenowAccount=require(_0x53d0('0xe'));var Dynamics365Account=require(_0x53d0('0xf'));var FreshsalesAccount=require(_0x53d0('0x10'));var FaxAccount=require(_0x53d0('0x11'));var Realtime=function(){this['agents']={};this[_0x53d0('0x12')]={};this[_0x53d0('0x13')]={};this['voiceQueues']={};this['triggers']={};this[_0x53d0('0x14')]={};this[_0x53d0('0x15')]={};this[_0x53d0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x53d0('0x17')]={};this['outboundChannels']={};this['timers']={};this[_0x53d0('0x18')]={};this[_0x53d0('0x19')]={};this['salesforceAccounts']={};this[_0x53d0('0x1a')]={};this[_0x53d0('0x1b')]={};this[_0x53d0('0x1c')]={};this['deskAccounts']={};this[_0x53d0('0x1d')]={};this[_0x53d0('0x1e')]={};this['dynamics365Accounts']={};this[_0x53d0('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x51fa0c,_0x371948,_0x4b71ca){var _0x4a19ad=_[_0x53d0('0x20')](_0x51fa0c,function(_0x259eda,_0x58ee9b){return _0x259eda[_0x4b71ca];});for(var _0x3b619f in _0x371948){if(_0x371948['hasOwnProperty'](_0x3b619f)){if(!_0x4a19ad[_0x3b619f]){delete _0x371948[_0x3b619f];}}}}function freeIsNotKeySip(_0xa3a949,_0x8a05d1){var _0x48090c=_[_0x53d0('0x20')](_0xa3a949,function(_0x14a1eb,_0x12f58d){return util[_0x53d0('0x21')](_0x53d0('0x22'),_0x14a1eb['name']);});for(var _0x3f54c9 in _0x8a05d1){if(_0x8a05d1[_0x53d0('0x23')](_0x3f54c9)){if(!_0x48090c[_0x3f54c9]){delete _0x8a05d1[_0x3f54c9];}}}}function freeIsNotKeyAgent(_0xbdb677,_0x25b963){var _0x402f8b=_[_0x53d0('0x20')](_0xbdb677,function(_0x4e3c6a,_0x214b8){var _0x515071=_['isNil'](_0x4e3c6a['interface'])?util[_0x53d0('0x21')](_0x53d0('0x22'),_0x4e3c6a[_0x53d0('0x24')]):_0x4e3c6a[_0x53d0('0x25')];return _0x515071;});for(var _0xdd16c7 in _0x25b963){if(_0x25b963['hasOwnProperty'](_0xdd16c7)){if(!_0x402f8b[_0xdd16c7]){delete _0x25b963[_0xdd16c7];}}}}function clearVoiceCallReports(_0x58cdbe){_0x58cdbe[_0x53d0('0x26')]=0x0;_0x58cdbe['answered']=0x0;_0x58cdbe[_0x53d0('0x27')]=0x0;_0x58cdbe[_0x53d0('0x28')]=0x0;_0x58cdbe[_0x53d0('0x29')]=0x0;}function clearCampaigns(_0x218948){if(!_['isEmpty'](_0x218948)){for(var _0x292c9c in _0x218948){if(_0x218948[_0x53d0('0x23')](_0x292c9c)){_0x218948[_0x292c9c]['ivrTotalCallsDays']=0x0;_0x218948[_0x292c9c]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2e1821){if(!_[_0x53d0('0x2a')](_0x2e1821)){for(var _0x5baba7 in _0x2e1821){if(_0x2e1821[_0x53d0('0x23')](_0x5baba7)){_0x2e1821[_0x5baba7][_0x53d0('0x26')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x2b')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x2c')]=0x0;_0x2e1821[_0x5baba7]['abandoned']=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x27')]=0x0;_0x2e1821[_0x5baba7]['sumDuration']=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x29')]=0x0;_0x2e1821[_0x5baba7]['outboundAnswerAgiCallsDay']=0x0;_0x2e1821[_0x5baba7]['outboundNoAnswerCallsDay']=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x2d')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x2e')]=0x0;_0x2e1821[_0x5baba7]['outboundNoSuchCallsDay']=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x2f')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x30')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x31')]=0x0;_0x2e1821[_0x5baba7]['outboundBlacklistCallsDay']=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x32')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x33')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x34')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x35')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x36')]=0x0;_0x2e1821[_0x5baba7][_0x53d0('0x37')]=!![];}}}}Realtime[_0x53d0('0x38')][_0x53d0('0x39')]=function(_0x4dacc7,_0x18456f){for(var _0x461f5f in _0x18456f){if(_0x4dacc7[_0x53d0('0x23')](_0x461f5f)){_0x4dacc7[_0x461f5f]=_0x18456f[_0x461f5f];}}};Realtime[_0x53d0('0x38')][_0x53d0('0x3a')]=function(){var _0x21228c=this;return function(_0xf8ea6a){if(_0xf8ea6a){freeIsNotKeyAgent(_0xf8ea6a,_0x21228c[_0x53d0('0x3b')]);for(var _0xc6d0b8=0x0,_0xafe349={},_0x54cee5={};_0xc6d0b8<_0xf8ea6a[_0x53d0('0x3c')];_0xc6d0b8+=0x1){_0xafe349=_0xf8ea6a[_0xc6d0b8];var _0x156ff5=_['isNil'](_0xafe349[_0x53d0('0x25')])?util[_0x53d0('0x21')](_0x53d0('0x22'),_0xafe349['name']):_0xafe349[_0x53d0('0x25')];if(_['isUndefined'](_0x21228c[_0x53d0('0x3b')][_0x156ff5])){_0x21228c[_0x53d0('0x3b')][_0x156ff5]=new Agent(_0xafe349);}else{_0x21228c['mergeFromDatabase'](_0x21228c[_0x53d0('0x3b')][_0x156ff5],_0xafe349);}}}return _0x21228c[_0x53d0('0x3b')];};};Realtime['prototype']['initTelephones']=function(){var _0x27b596=this;return function(_0x1f22a8){if(_0x1f22a8){freeIsNotKeySip(_0x1f22a8,_0x27b596[_0x53d0('0x12')]);for(var _0x561d8=0x0,_0x4215e9={},_0x3c54fd={};_0x561d8<_0x1f22a8['length'];_0x561d8+=0x1){_0x4215e9=_0x1f22a8[_0x561d8];if(_[_0x53d0('0x3d')](_0x27b596[_0x53d0('0x12')][util['format'](_0x53d0('0x22'),_0x4215e9['name'])])){_0x27b596[_0x53d0('0x12')][util[_0x53d0('0x21')](_0x53d0('0x22'),_0x4215e9[_0x53d0('0x24')])]=new Telephone(_0x4215e9);}else{_0x27b596['mergeFromDatabase'](_0x27b596[_0x53d0('0x12')][util[_0x53d0('0x21')](_0x53d0('0x22'),_0x4215e9[_0x53d0('0x24')])],_0x4215e9);}}}return _0x27b596[_0x53d0('0x12')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x3e')]=function(){var _0x207850=this;return function(_0x3aaa94){if(_0x3aaa94){freeIsNotKeySip(_0x3aaa94,_0x207850['trunks']);for(var _0x2a1dc4=0x0,_0x2af1ce={},_0x203a79={};_0x2a1dc4<_0x3aaa94['length'];_0x2a1dc4+=0x1){_0x2af1ce=_0x3aaa94[_0x2a1dc4];if(_['isUndefined'](_0x207850[_0x53d0('0x13')][util[_0x53d0('0x21')]('SIP/%s',_0x2af1ce[_0x53d0('0x24')])])){_0x207850['trunks'][util['format'](_0x53d0('0x22'),_0x2af1ce[_0x53d0('0x24')])]=new Trunk(_0x2af1ce);}else{_0x207850[_0x53d0('0x39')](_0x207850[_0x53d0('0x13')][util['format']('SIP/%s',_0x2af1ce[_0x53d0('0x24')])],_0x2af1ce);}}}return _0x207850[_0x53d0('0x13')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x3f')]=function(){var _0x222564=this;return function(_0x2afef7){if(_0x2afef7){freeIsNotKey(_0x2afef7,_0x222564[_0x53d0('0x40')],_0x53d0('0x24'));for(var _0x283a9d=0x0,_0x32e5f5={},_0x16f579={};_0x283a9d<_0x2afef7[_0x53d0('0x3c')];_0x283a9d+=0x1){_0x32e5f5=_0x2afef7[_0x283a9d];if(_[_0x53d0('0x3d')](_0x222564[_0x53d0('0x40')][_0x32e5f5[_0x53d0('0x24')]])){_0x222564[_0x53d0('0x40')][_0x32e5f5[_0x53d0('0x24')]]=new VoiceQueue(_0x32e5f5);}else{_0x222564[_0x53d0('0x39')](_0x222564[_0x53d0('0x40')][_0x32e5f5[_0x53d0('0x24')]],_0x32e5f5);}}}return _0x222564[_0x53d0('0x40')];};};Realtime['prototype'][_0x53d0('0x41')]=function(){var _0x3599a9=this;return function(_0x4b00ec){if(_0x4b00ec){freeIsNotKey(_0x4b00ec,_0x3599a9[_0x53d0('0x42')],'id');for(var _0x2b9569=0x0,_0x55c9ef={},_0xfe2179={};_0x2b9569<_0x4b00ec[_0x53d0('0x3c')];_0x2b9569+=0x1){_0x55c9ef=_0x4b00ec[_0x2b9569];if(_['isUndefined'](_0x3599a9[_0x53d0('0x42')][_0x55c9ef['id']])){_0x3599a9[_0x53d0('0x42')][_0x55c9ef['id']]=new Trigger(_0x55c9ef);}else{_0x3599a9[_0x53d0('0x39')](_0x3599a9[_0x53d0('0x42')][_0x55c9ef['id']],_0x55c9ef);}}}return _0x3599a9[_0x53d0('0x42')];};};Realtime[_0x53d0('0x38')]['initTemplates']=function(){var _0x55482b=this;return function(_0x113968){if(_0x113968){freeIsNotKey(_0x113968,_0x55482b[_0x53d0('0x15')],'id');for(var _0x4f5b74=0x0,_0x299ba6={},_0x253331={};_0x4f5b74<_0x113968[_0x53d0('0x3c')];_0x4f5b74+=0x1){_0x299ba6=_0x113968[_0x4f5b74];if(_[_0x53d0('0x3d')](_0x55482b[_0x53d0('0x15')][_0x299ba6['id']])){_0x55482b[_0x53d0('0x15')][_0x299ba6['id']]=new Template(_0x299ba6);}else{_0x55482b[_0x53d0('0x39')](_0x55482b[_0x53d0('0x15')][_0x299ba6['id']],_0x299ba6);}}}return _0x55482b['templates'];};};Realtime['prototype'][_0x53d0('0x43')]=function(){var _0x1b445d=this;return function(_0x2d8231){if(_0x2d8231){freeIsNotKey(_0x2d8231,_0x1b445d['zendeskAccounts'],'id');for(var _0x10e454=0x0,_0xe34806={},_0x4b0d28={};_0x10e454<_0x2d8231[_0x53d0('0x3c')];_0x10e454+=0x1){_0xe34806=_0x2d8231[_0x10e454];if(_[_0x53d0('0x3d')](_0x1b445d[_0x53d0('0x19')][_0xe34806['id']])){_0x1b445d[_0x53d0('0x19')][_0xe34806['id']]=new ZendeskAccount(_0xe34806);}else{_0x1b445d['mergeFromDatabase'](_0x1b445d[_0x53d0('0x19')][_0xe34806['id']],_0xe34806);}}}return _0x1b445d[_0x53d0('0x19')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x44')]=function(){var _0x201546=this;return function(_0x1bb507){if(_0x1bb507){freeIsNotKey(_0x1bb507,_0x201546['salesforceAccounts'],'id');for(var _0xd212a1=0x0,_0x23accd={},_0x4356d4={};_0xd212a1<_0x1bb507['length'];_0xd212a1+=0x1){_0x23accd=_0x1bb507[_0xd212a1];if(_[_0x53d0('0x3d')](_0x201546['salesforceAccounts'][_0x23accd['id']])){_0x201546[_0x53d0('0x45')][_0x23accd['id']]=new SalesforceAccount(_0x23accd);}else{_0x201546[_0x53d0('0x39')](_0x201546[_0x53d0('0x45')][_0x23accd['id']],_0x23accd);}}}return _0x201546[_0x53d0('0x45')];};};Realtime[_0x53d0('0x38')]['initFreshdeskAccounts']=function(){var _0x3720c7=this;return function(_0x185b1e){if(_0x185b1e){freeIsNotKey(_0x185b1e,_0x3720c7['freshdeskAccounts'],'id');for(var _0x37e44f=0x0,_0x32319b={},_0x34d0e9={};_0x37e44f<_0x185b1e[_0x53d0('0x3c')];_0x37e44f+=0x1){_0x32319b=_0x185b1e[_0x37e44f];if(_[_0x53d0('0x3d')](_0x3720c7[_0x53d0('0x1b')][_0x32319b['id']])){_0x3720c7[_0x53d0('0x1b')][_0x32319b['id']]=new FreshdeskAccount(_0x32319b);}else{_0x3720c7[_0x53d0('0x39')](_0x3720c7[_0x53d0('0x1b')][_0x32319b['id']],_0x32319b);}}}return _0x3720c7[_0x53d0('0x1b')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x46')]=function(){var _0x3cc421=this;return function(_0x340b34){if(_0x340b34){freeIsNotKey(_0x340b34,_0x3cc421[_0x53d0('0x1c')],'id');for(var _0x21430a=0x0,_0x16a17c={},_0x125096={};_0x21430a<_0x340b34[_0x53d0('0x3c')];_0x21430a+=0x1){_0x16a17c=_0x340b34[_0x21430a];if(_[_0x53d0('0x3d')](_0x3cc421[_0x53d0('0x1c')][_0x16a17c['id']])){_0x3cc421[_0x53d0('0x1c')][_0x16a17c['id']]=new ZohoAccount(_0x16a17c);}else{_0x3cc421[_0x53d0('0x39')](_0x3cc421[_0x53d0('0x1c')][_0x16a17c['id']],_0x16a17c);}}}return _0x3cc421[_0x53d0('0x1c')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x1b231c=this;return function(_0xda8b42){if(_0xda8b42){freeIsNotKey(_0xda8b42,_0x1b231c[_0x53d0('0x47')],'id');for(var _0x2ad338=0x0,_0x17250f={},_0x4d9b14={};_0x2ad338<_0xda8b42[_0x53d0('0x3c')];_0x2ad338+=0x1){_0x17250f=_0xda8b42[_0x2ad338];if(_[_0x53d0('0x3d')](_0x1b231c[_0x53d0('0x47')][_0x17250f['id']])){_0x1b231c[_0x53d0('0x47')][_0x17250f['id']]=new DeskAccount(_0x17250f);}else{_0x1b231c[_0x53d0('0x39')](_0x1b231c[_0x53d0('0x47')][_0x17250f['id']],_0x17250f);}}}return _0x1b231c['deskAccounts'];};};Realtime[_0x53d0('0x38')][_0x53d0('0x48')]=function(){var _0xd30666=this;return function(_0x265d88){if(_0x265d88){freeIsNotKey(_0x265d88,_0xd30666[_0x53d0('0x1a')],'id');for(var _0x51bf6d=0x0,_0xa0eac5={},_0x4092cf={};_0x51bf6d<_0x265d88[_0x53d0('0x3c')];_0x51bf6d+=0x1){_0xa0eac5=_0x265d88[_0x51bf6d];if(_[_0x53d0('0x3d')](_0xd30666[_0x53d0('0x1a')][_0xa0eac5['id']])){_0xd30666['sugarcrmAccounts'][_0xa0eac5['id']]=new SugarcrmAccount(_0xa0eac5);}else{_0xd30666[_0x53d0('0x39')](_0xd30666[_0x53d0('0x1a')][_0xa0eac5['id']],_0xa0eac5);}}}return _0xd30666[_0x53d0('0x1a')];};};Realtime['prototype'][_0x53d0('0x49')]=function(){var _0x5ef8a2=this;return function(_0x511c9b){if(_0x511c9b){freeIsNotKey(_0x511c9b,_0x5ef8a2[_0x53d0('0x1d')],'id');for(var _0x389a37=0x0,_0x36c8ff={},_0xab2905={};_0x389a37<_0x511c9b[_0x53d0('0x3c')];_0x389a37+=0x1){_0x36c8ff=_0x511c9b[_0x389a37];if(_[_0x53d0('0x3d')](_0x5ef8a2[_0x53d0('0x1d')][_0x36c8ff['id']])){_0x5ef8a2[_0x53d0('0x1d')][_0x36c8ff['id']]=new VtigerAccount(_0x36c8ff);}else{_0x5ef8a2[_0x53d0('0x39')](_0x5ef8a2[_0x53d0('0x1d')][_0x36c8ff['id']],_0x36c8ff);}}}return _0x5ef8a2['vtigerAccounts'];};};Realtime[_0x53d0('0x38')][_0x53d0('0x4a')]=function(){var _0x49c2e5=this;return function(_0x5d8d42){if(_0x5d8d42){freeIsNotKey(_0x5d8d42,_0x49c2e5[_0x53d0('0x1e')],'id');for(var _0x19c06e=0x0,_0x288d66={},_0x2a7567={};_0x19c06e<_0x5d8d42[_0x53d0('0x3c')];_0x19c06e+=0x1){_0x288d66=_0x5d8d42[_0x19c06e];if(_[_0x53d0('0x3d')](_0x49c2e5[_0x53d0('0x1e')][_0x288d66['id']])){_0x49c2e5['servicenowAccounts'][_0x288d66['id']]=new ServicenowAccount(_0x288d66);}else{_0x49c2e5[_0x53d0('0x39')](_0x49c2e5[_0x53d0('0x1e')][_0x288d66['id']],_0x288d66);}}}return _0x49c2e5[_0x53d0('0x1e')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x4b')]=function(){var _0x13d10f=this;return function(_0x3b48fe){if(_0x3b48fe){freeIsNotKey(_0x3b48fe,_0x13d10f[_0x53d0('0x4c')],'id');for(var _0x334362=0x0,_0x294147={},_0x307b5b={};_0x334362<_0x3b48fe[_0x53d0('0x3c')];_0x334362+=0x1){_0x294147=_0x3b48fe[_0x334362];if(_[_0x53d0('0x3d')](_0x13d10f[_0x53d0('0x4c')][_0x294147['id']])){_0x13d10f[_0x53d0('0x4c')][_0x294147['id']]=new Dynamics365Account(_0x294147);}else{_0x13d10f[_0x53d0('0x39')](_0x13d10f['dynamics365Accounts'][_0x294147['id']],_0x294147);}}}return _0x13d10f[_0x53d0('0x4c')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x4d')]=function(){var _0x26656=this;return function(_0x5a48a8){if(_0x5a48a8){freeIsNotKey(_0x5a48a8,_0x26656[_0x53d0('0x1f')],'id');for(var _0x1d8fd7=0x0,_0x2096d5={},_0x4cabef={};_0x1d8fd7<_0x5a48a8[_0x53d0('0x3c')];_0x1d8fd7+=0x1){_0x2096d5=_0x5a48a8[_0x1d8fd7];if(_[_0x53d0('0x3d')](_0x26656['freshsalesAccounts'][_0x2096d5['id']])){_0x26656[_0x53d0('0x1f')][_0x2096d5['id']]=new FreshsalesAccount(_0x2096d5);}else{_0x26656[_0x53d0('0x39')](_0x26656['freshsalesAccounts'][_0x2096d5['id']],_0x2096d5);}}}return _0x26656[_0x53d0('0x1f')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x4e')]=function(){var _0x22e801=this;return function(_0x56cd32){for(var _0x47164f=0x0;_0x47164f<_0x56cd32[_0x53d0('0x3c')];_0x47164f+=0x1){_[_0x53d0('0x4f')](_0x22e801[_0x53d0('0x40')][_0x56cd32[_0x47164f][_0x53d0('0x24')]],_0x56cd32[_0x47164f]);}return _0x22e801[_0x53d0('0x40')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x393426=this;return function(_0x342bf3){clearVoiceQueues(_0x393426['voiceQueues']);if(_0x342bf3){_0x342bf3=_['groupBy'](_0x342bf3,_0x53d0('0x50'));for(var _0x260986 in _0x342bf3){if(_0x342bf3[_0x53d0('0x23')](_0x260986)){var _0x313dc8={};for(var _0x4c8d2f=0x0;_0x4c8d2f<_0x342bf3[_0x260986]['length'];_0x4c8d2f+=0x1){var _0x53950b=_0x342bf3[_0x260986][_0x4c8d2f]['queue'];if(_0x393426[_0x53d0('0x40')][_0x53950b]){if(_0x342bf3[_0x260986][_0x4c8d2f]['queuecallerexit']){_0x393426['voiceQueues'][_0x53950b][_0x53d0('0x2c')]+=0x1;}if(_0x342bf3[_0x260986][_0x4c8d2f][_0x53d0('0x51')]){_0x393426[_0x53d0('0x40')][_0x53950b][_0x53d0('0x52')]+=0x1;}_0x393426[_0x53d0('0x40')][_0x53950b][_0x53d0('0x27')]+=moment(_0x342bf3[_0x260986][_0x4c8d2f][_0x53d0('0x53')])['diff'](moment(_0x342bf3[_0x260986][_0x4c8d2f][_0x53d0('0x54')]),'seconds')||0x0;if(_0x4c8d2f===_0x342bf3[_0x260986][_0x53d0('0x3c')]-0x1){_0x393426[_0x53d0('0x40')][_0x53950b][_0x53d0('0x28')]+=moment(_0x342bf3[_0x260986][_0x4c8d2f][_0x53d0('0x55')]||_0x342bf3[_0x260986][_0x4c8d2f]['queuecallerabandonAt']||_0x342bf3[_0x260986][_0x4c8d2f]['queuecallerexitAt'])[_0x53d0('0x56')](moment(_0x342bf3[_0x260986][_0x4c8d2f][_0x53d0('0x54')]),_0x53d0('0x57'))||0x0;_0x393426[_0x53d0('0x40')][_0x53950b][_0x53d0('0x26')]+=0x1;if(_0x342bf3[_0x260986][_0x4c8d2f][_0x53d0('0x58')]){_0x393426['voiceQueues'][_0x53950b][_0x53d0('0x2b')]+=0x1;_0x393426[_0x53d0('0x40')][_0x53950b][_0x53d0('0x29')]+=moment(_0x342bf3[_0x260986][_0x4c8d2f][_0x53d0('0x55')])['diff'](moment(_0x342bf3[_0x260986][_0x4c8d2f][_0x53d0('0x53')]),_0x53d0('0x57'))||0x0;}}else{_0x393426[_0x53d0('0x40')][_0x53950b][_0x53d0('0x28')]+=_0x393426[_0x53d0('0x40')][_0x53950b][_0x53d0('0x27')]||0x0;}}}}}}return _0x393426[_0x53d0('0x40')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x59')]=function(){var _0x122952=this;return function(_0x245f39){clearVoiceCallReports(_0x122952['outbound']);if(_0x245f39){for(var _0x2e504b=0x0;_0x2e504b<_0x245f39['length'];_0x2e504b+=0x1){_0x122952[_0x53d0('0x16')][_0x53d0('0x26')]+=0x1;_0x122952[_0x53d0('0x16')][_0x53d0('0x28')]+=_0x245f39[_0x2e504b]['duration'];if(_0x245f39[_0x2e504b][_0x53d0('0x5a')]===_0x53d0('0x5b')){_0x122952[_0x53d0('0x16')][_0x53d0('0x2b')]+=0x1;_0x122952[_0x53d0('0x16')][_0x53d0('0x27')]+=_0x245f39[_0x2e504b][_0x53d0('0x5c')]-_0x245f39[_0x2e504b][_0x53d0('0x5d')]||0x0;_0x122952[_0x53d0('0x16')]['sumBillable']+=_0x245f39[_0x2e504b][_0x53d0('0x5d')];}}}return _0x122952['outbound'];};};Realtime[_0x53d0('0x38')][_0x53d0('0x5e')]=function(){var _0x35d9c2=this;return function(_0x4f5b28){if(_0x4f5b28){freeIsNotKey(_0x4f5b28,_0x35d9c2[_0x53d0('0x14')],_0x53d0('0x24'));for(var _0x3087f8=0x0,_0x1f4d09={};_0x3087f8<_0x4f5b28[_0x53d0('0x3c')];_0x3087f8+=0x1){_0x1f4d09=_0x4f5b28[_0x3087f8];if(_[_0x53d0('0x3d')](_0x35d9c2['campaigns'][_0x1f4d09['name']])){_0x35d9c2[_0x53d0('0x14')][_0x1f4d09[_0x53d0('0x24')]]=new Campaign(_0x1f4d09);}else{_0x35d9c2[_0x53d0('0x39')](_0x35d9c2[_0x53d0('0x14')][_0x1f4d09[_0x53d0('0x24')]],_0x1f4d09);_0x35d9c2[_0x53d0('0x14')][_0x1f4d09['name']][_0x53d0('0x5f')]=_0x1f4d09['SquareProject']?_0x1f4d09[_0x53d0('0x60')][_0x53d0('0x24')]:undefined;}}}return _0x35d9c2[_0x53d0('0x14')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x61')]=function(){var _0x12deed=this;return function(_0x569491){if(_0x569491){freeIsNotKey(_0x569491,_0x12deed['voiceExtensions'],'id');for(var _0x44b948=0x0,_0x373f76={};_0x44b948<_0x569491['length'];_0x44b948+=0x1){_0x373f76=_0x569491[_0x44b948];if(_[_0x53d0('0x3d')](_0x12deed[_0x53d0('0x62')][_0x373f76['id']])){_0x12deed[_0x53d0('0x62')][_0x373f76['id']]=new VoiceExtension(_0x373f76);}else{_0x12deed[_0x53d0('0x39')](_0x12deed[_0x53d0('0x62')][_0x373f76['id']],_0x373f76);}}}return _0x12deed[_0x53d0('0x62')];};};Realtime[_0x53d0('0x38')][_0x53d0('0x63')]=function(){var _0x1ebf11=this;return function(_0x59c5da){clearCampaigns(_0x1ebf11['campaigns']);for(var _0xe7a432=0x0;_0xe7a432<_0x59c5da['length'];_0xe7a432+=0x1){_[_0x53d0('0x4f')](_0x1ebf11['campaigns'][_0x59c5da[_0xe7a432]['name']],_0x59c5da[_0xe7a432]);}return _0x1ebf11[_0x53d0('0x14')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x3d66d7=this;return function(_0x41ffe7){if(_0x41ffe7){freeIsNotKey(_0x41ffe7,_0x3d66d7[_0x53d0('0x64')],'id');for(var _0x2d228a=0x0,_0x24d575={},_0x4b978a={};_0x2d228a<_0x41ffe7[_0x53d0('0x3c')];_0x2d228a+=0x1){_0x24d575=_0x41ffe7[_0x2d228a];if(_[_0x53d0('0x3d')](_0x3d66d7[_0x53d0('0x64')][_0x24d575['id']])){_0x3d66d7[_0x53d0('0x64')][_0x24d575['id']]=new FaxAccount(_0x24d575);}else{_0x3d66d7[_0x53d0('0x39')](_0x3d66d7[_0x53d0('0x64')][_0x24d575['id']],_0x24d575);}}}return _0x3d66d7[_0x53d0('0x64')];};};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 f47e111..f61de52 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 _0x835c=['monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','length','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','queuecallerexit','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','destination','exten','type','lastapplication','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','UserId','membername','monitor'];(function(_0x3a846e,_0x5bbd99){var _0x14c089=function(_0x46ae0d){while(--_0x46ae0d){_0x3a846e['push'](_0x3a846e['shift']());}};_0x14c089(++_0x5bbd99);}(_0x835c,0x1e1));var _0xc835=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x835c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc835('0x0'));var moment=require(_0xc835('0x1'));var util=require(_0xc835('0x2'));var config=require(_0xc835('0x3'));var ami=require(_0xc835('0x4'));var RpcVoiceAgentReport=require(_0xc835('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc835('0x6'));var RpcMemberReport=require(_0xc835('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xc835('0x8'));var VoiceQueueReport=require(_0xc835('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xc835('0xa'));var VoiceDialReport=require(_0xc835('0xb'));var UserReport=require(_0xc835('0xc'));function Report(_0x2f1a89){this[_0xc835('0xd')]=_0x2f1a89;this['agents']=_0x2f1a89[_0xc835('0xe')];this[_0xc835('0xf')]=_0x2f1a89[_0xc835('0xf')];}Report[_0xc835('0x10')]['sync']=function(_0x2aa124){var _0x14d1af=new VoiceQueueReport(this[_0xc835('0xd')]);var _0x5c9ba7=new VoiceAgentReport(this[_0xc835('0xd')]);var _0x2c7bfb=new VoiceDialReport(this[_0xc835('0xd')]);var _0x315d3c=new VoiceCallReport(this[_0xc835('0xd')]);var _0x1355b8=new UserReport(this[_0xc835('0xd')]);if(config[_0xc835('0x11')]&&config[_0xc835('0x11')][_0xc835('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xc835('0x13')][_0xc835('0x14')](this));ami['on'](_0xc835('0x15'),this[_0xc835('0x16')][_0xc835('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0xc835('0x17')][_0xc835('0x14')](this));ami['on'](_0xc835('0x18'),this[_0xc835('0x19')][_0xc835('0x14')](this));ami['on'](_0xc835('0x1a'),this[_0xc835('0x1b')][_0xc835('0x14')](this));ami['on']('attendedtransfer',this[_0xc835('0x1c')][_0xc835('0x14')](this));}};Report[_0xc835('0x10')][_0xc835('0x1d')]=function(_0x1a69e9){var _0x2a8ac1;_0x2a8ac1=_['find'](this[_0xc835('0xe')],function(_0x53ed13){return _0x53ed13[_0xc835('0x1e')]==_0x1a69e9||_0x53ed13[_0xc835('0x1f')]==_0x1a69e9;});if(_[_0xc835('0x20')](_0x2a8ac1)){var _0x368b21=_['find'](this[_0xc835('0xf')],function(_0x3e6551){return _0x3e6551[_0xc835('0x1e')]==_0x1a69e9||_0x3e6551['name']==_0x1a69e9;});if(_0x368b21){_0x2a8ac1=_[_0xc835('0x21')](this[_0xc835('0xe')],function(_0x1cd5d2){return _0x1cd5d2[_0xc835('0x22')]==util[_0xc835('0x23')]('SIP/%s',_0x368b21['name']);});}}return _0x2a8ac1;};Report[_0xc835('0x10')][_0xc835('0x13')]=function(_0x43a8ab){for(var _0x4029e2=0x0;_0x4029e2<_0x43a8ab[_0xc835('0x24')];_0x4029e2+=0x1){var _0x2cbe91=this[_0xc835('0x1d')](_0x43a8ab[_0x4029e2][_0xc835('0x25')]);if(_0x2cbe91){_0x43a8ab[_0x4029e2][_0xc835('0x1e')]=_0x2cbe91[_0xc835('0x1e')];_0x43a8ab[_0x4029e2][_0xc835('0x26')]=!![];_0x43a8ab[_0x4029e2][_0xc835('0x27')]=_0x2cbe91['name'];_0x43a8ab[_0x4029e2]['interface']=_[_0xc835('0x20')](_0x2cbe91[_0xc835('0x22')])?util[_0xc835('0x23')](_0xc835('0x28'),_0x2cbe91[_0xc835('0x1f')]):_0x2cbe91[_0xc835('0x22')];if(_0x43a8ab[_0x4029e2][_0xc835('0x29')]){_0x43a8ab[_0x4029e2][_0xc835('0x2a')]=moment()[_0xc835('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x43a8ab[_0x4029e2][_0xc835('0x2b')]){_0x43a8ab[_0x4029e2]['queuecallerexitAt']=moment()[_0xc835('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc835('0x13')](_0x43a8ab[_0x4029e2]);}RpcVoiceQueueReport[_0xc835('0x2c')](_0x43a8ab[_0x4029e2]);}};function extractCalleridNumber(_0x33e7bf){var _0x1dfe87=_0x33e7bf[_0xc835('0x2d')](/<(.*?)>/);return _0x1dfe87?_0x1dfe87[0x1]:_0x33e7bf;}Report[_0xc835('0x10')][_0xc835('0x2e')]=function(_0x331351){for(var _0x1b8c57=0x0;_0x1b8c57'];(function(_0x3ce6b2,_0x1fc0b0){var _0x98a558=function(_0x2031d8){while(--_0x2031d8){_0x3ce6b2['push'](_0x3ce6b2['shift']());}};_0x98a558(++_0x1fc0b0);}(_0x6dfb,0x121));var _0xb6df=function(_0x27b702,_0x4a1f0b){_0x27b702=_0x27b702-0x0;var _0x5c4ab1=_0x6dfb[_0x27b702];return _0x5c4ab1;};'use strict';var _=require('lodash');var moment=require(_0xb6df('0x0'));var util=require(_0xb6df('0x1'));var config=require(_0xb6df('0x2'));var ami=require(_0xb6df('0x3'));var RpcVoiceAgentReport=require(_0xb6df('0x4'));var RpcVoiceCallReport=require(_0xb6df('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xb6df('0x6'));var RpcVoiceRecording=require(_0xb6df('0x7'));var RpcVoiceTransferReport=require(_0xb6df('0x8'));var VoiceQueueReport=require(_0xb6df('0x9'));var VoiceCallReport=require(_0xb6df('0xa'));var VoiceAgentReport=require(_0xb6df('0xb'));var VoiceDialReport=require(_0xb6df('0xc'));var UserReport=require('./userReport');function Report(_0x4078f4){this[_0xb6df('0xd')]=_0x4078f4;this[_0xb6df('0xe')]=_0x4078f4[_0xb6df('0xe')];this[_0xb6df('0xf')]=_0x4078f4[_0xb6df('0xf')];}Report[_0xb6df('0x10')][_0xb6df('0x11')]=function(_0x3478bd){var _0x16df01=new VoiceQueueReport(this[_0xb6df('0xd')]);var _0x53372a=new VoiceAgentReport(this[_0xb6df('0xd')]);var _0x408164=new VoiceDialReport(this['realtime']);var _0x3fc3e9=new VoiceCallReport(this[_0xb6df('0xd')]);var _0x1522b1=new UserReport(this['realtime']);if(config['xdr']&&config[_0xb6df('0x12')][_0xb6df('0x13')]){ami['on'](_0xb6df('0x14'),this['voiceQueueReport'][_0xb6df('0x15')](this));ami['on'](_0xb6df('0x16'),this[_0xb6df('0x17')][_0xb6df('0x15')](this));ami['on'](_0xb6df('0x18'),this[_0xb6df('0x19')][_0xb6df('0x15')](this));ami['on'](_0xb6df('0x1a'),this[_0xb6df('0x1b')]['bind'](this));ami['on'](_0xb6df('0x1c'),this['blindTransfer'][_0xb6df('0x15')](this));ami['on'](_0xb6df('0x1d'),this['attendedTransfer'][_0xb6df('0x15')](this));}};Report[_0xb6df('0x10')]['findAgent']=function(_0x4854e3){var _0x312748;_0x312748=_[_0xb6df('0x1e')](this[_0xb6df('0xe')],function(_0x4e161d){return _0x4e161d[_0xb6df('0x1f')]==_0x4854e3||_0x4e161d[_0xb6df('0x20')]==_0x4854e3;});if(_[_0xb6df('0x21')](_0x312748)){var _0x36acd5=_['find'](this[_0xb6df('0xf')],function(_0x2ca505){return _0x2ca505[_0xb6df('0x1f')]==_0x4854e3||_0x2ca505[_0xb6df('0x20')]==_0x4854e3;});if(_0x36acd5){_0x312748=_[_0xb6df('0x1e')](this[_0xb6df('0xe')],function(_0xf8dd4c){return _0xf8dd4c[_0xb6df('0x22')]==util[_0xb6df('0x23')](_0xb6df('0x24'),_0x36acd5['name']);});}}return _0x312748;};Report[_0xb6df('0x10')][_0xb6df('0x25')]=function(_0x1c821b){for(var _0x341c87=0x0;_0x341c87<_0x1c821b[_0xb6df('0x26')];_0x341c87+=0x1){var _0x569171=this['findAgent'](_0x1c821b[_0x341c87][_0xb6df('0x27')]);if(_0x569171){_0x1c821b[_0x341c87]['accountcode']=_0x569171[_0xb6df('0x1f')];_0x1c821b[_0x341c87]['assigned']=!![];_0x1c821b[_0x341c87]['lastAssignedTo']=_0x569171['name'];_0x1c821b[_0x341c87]['interface']=_['isNil'](_0x569171[_0xb6df('0x22')])?util[_0xb6df('0x23')]('SIP/%s',_0x569171[_0xb6df('0x20')]):_0x569171[_0xb6df('0x22')];if(_0x1c821b[_0x341c87][_0xb6df('0x28')]){_0x1c821b[_0x341c87]['queuecallercompleteAt']=moment()['format'](_0xb6df('0x29'));}if(_0x1c821b[_0x341c87][_0xb6df('0x2a')]){_0x1c821b[_0x341c87][_0xb6df('0x2b')]=moment()[_0xb6df('0x23')](_0xb6df('0x29'));}RpcMemberReport[_0xb6df('0x25')](_0x1c821b[_0x341c87]);}RpcVoiceQueueReport[_0xb6df('0x2c')](_0x1c821b[_0x341c87]);}};function extractCalleridNumber(_0x502472){var _0x1667c0=_0x502472['match'](/<(.*?)>/);return _0x1667c0?_0x1667c0[0x1]:_0x502472;}Report['prototype']['getAgentByInternal']=function(_0x281240){for(var _0x286e12=0x0;_0x286e120x0?_0x4009da:0x0;this[_0x0eaf('0x10')][_0x1122ac[_0x0eaf('0x63')]]['talking']=this[_0x0eaf('0x10')][_0x1122ac[_0x0eaf('0x63')]]['talking']>_[_0x0eaf('0x68')](_0x1122ac[_0x0eaf('0x69')])?_[_0x0eaf('0x68')](_0x1122ac[_0x0eaf('0x69')]):this[_0x0eaf('0x10')][_0x1122ac['queue']][_0x0eaf('0x6a')];this[_0x0eaf('0x50')](this[_0x0eaf('0x10')][_0x1122ac[_0x0eaf('0x63')]],'queuesummary');}logger[_0x0eaf('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x0eaf('0x47')](this['voiceQueues'][_0x1122ac[_0x0eaf('0x63')]],{'showHidden':![],'depth':null}));ami[_0x0eaf('0x42')](_0x0eaf('0x6b'),this[_0x0eaf('0x10')][_0x1122ac[_0x0eaf('0x63')]]);}}}catch(_0x489044){logger[_0x0eaf('0x3b')](_0x0eaf('0x62'),util[_0x0eaf('0x47')](_0x489044,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x6c')]=function(_0x45a13f){logger[_0x0eaf('0x43')](_0x0eaf('0x6d'),util['inspect'](_0x45a13f,{'showHidden':![],'depth':null}));this[_0x0eaf('0x11')]=!![];};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x6e')]=function(_0xe4438a){try{if(this[_0x0eaf('0x5e')](_0xe4438a)){logger['debug'](_0x0eaf('0x6f'),_0xe4438a[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0xe4438a,{'showHidden':![],'depth':null}));if(_[_0x0eaf('0x5f')](this[_0x0eaf('0xd')][_0xe4438a[_0x0eaf('0x46')]]))this['queueReports'][_0xe4438a[_0x0eaf('0x46')]]=[];if(_[_0x0eaf('0x5f')](this[_0x0eaf('0x33')][_0xe4438a[_0x0eaf('0x46')]]))this[_0x0eaf('0x33')][_0xe4438a[_0x0eaf('0x46')]]={};var _0x4062e0=new QueueReport();_0x4062e0[_0x0eaf('0x4a')]=_0xe4438a[_0x0eaf('0x63')];_0x4062e0['type']=this['voiceQueues'][_0x4062e0[_0x0eaf('0x4a')]]&&this['voiceQueues'][_0x4062e0['name']]['type']?this[_0x0eaf('0x10')][_0x4062e0['name']][_0x0eaf('0x51')]||'inbound':'inbound';_0x4062e0['queue']=_0xe4438a[_0x0eaf('0x63')];_0x4062e0[_0x0eaf('0x70')]=moment()['format'](_0x0eaf('0x71'));_0x4062e0[_0x0eaf('0x72')]=_0xe4438a[_0x0eaf('0x72')];_0x4062e0[_0x0eaf('0x73')]=_0xe4438a[_0x0eaf('0x73')];_0x4062e0['uniqueid']=_0xe4438a[_0x0eaf('0x46')];_0x4062e0[_0x0eaf('0x74')]=this[_0x0eaf('0x33')][_0xe4438a[_0x0eaf('0x46')]][_0x0eaf('0x74')];logger[_0x0eaf('0x65')](_0x0eaf('0x75'),_0x4062e0[_0x0eaf('0x4a')],_0x4062e0['type']);_[_0x0eaf('0x76')](_0x4062e0,_['pick'](_0xe4438a,_[_0x0eaf('0x77')](_0x4062e0)));this[_0x0eaf('0xd')][_0xe4438a[_0x0eaf('0x46')]][_0x0eaf('0x78')](_0x4062e0);this[_0x0eaf('0x33')][_0xe4438a[_0x0eaf('0x46')]]=_0x4062e0;this['emitVoiceQueueChannelSave'](_0x4062e0,_0x0eaf('0x16'));}}catch(_0xacff44){logger[_0x0eaf('0x3b')]('[%s][voiceQueueReport][queuecallerjoin]',_0xe4438a['uniqueid'],util[_0x0eaf('0x47')](_0xacff44,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0eaf('0x18')]=function(_0x5e286e){try{if(this['isNotNull'](_0x5e286e)){logger[_0x0eaf('0x43')](_0x0eaf('0x79'),_0x5e286e['uniqueid'],util[_0x0eaf('0x47')](_0x5e286e,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x5e286e['uniqueid']]){var _0x461cef=_[_0x0eaf('0x7a')](this['queueReports'][_0x5e286e[_0x0eaf('0x46')]]);_0x461cef[_0x0eaf('0x7b')]=![];_0x461cef[_0x0eaf('0x7c')]=null;_0x461cef[_0x0eaf('0x7d')]=_0x5e286e[_0x0eaf('0x7d')];_0x461cef[_0x0eaf('0x7e')]=_0x5e286e[_0x0eaf('0x7e')];_0x461cef['queuecallerabandon']=!![];_0x461cef[_0x0eaf('0x7f')]=moment()['format'](_0x0eaf('0x71'));_0x461cef[_0x0eaf('0x80')]='ABANDONED';_0x461cef[_0x0eaf('0x81')]=null;logger['info'](_0x0eaf('0x82'),_0x461cef['name'],_0x461cef[_0x0eaf('0x51')]);this['channels'][_0x5e286e['uniqueid']]=_0x461cef;this[_0x0eaf('0x40')](_0x461cef,'queuecallerabandon');}}}catch(_0x248c94){logger[_0x0eaf('0x3b')](_0x0eaf('0x79'),_0x5e286e[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0x248c94,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')]['syncQueueCallerLeave']=function(_0x2ab924){try{if(this['isNotNull'](_0x2ab924)){logger['debug'](_0x0eaf('0x83'),_0x2ab924['uniqueid'],util[_0x0eaf('0x47')](_0x2ab924,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x2ab924[_0x0eaf('0x46')]]){var _0x4de057=_[_0x0eaf('0x7a')](this[_0x0eaf('0xd')][_0x2ab924['uniqueid']]);_0x4de057[_0x0eaf('0x84')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x4de057[_0x0eaf('0x85')]=_0x2ab924['connectedlinenum'];_0x4de057[_0x0eaf('0x86')]=_0x2ab924[_0x0eaf('0x86')];logger[_0x0eaf('0x65')](_0x0eaf('0x87'),_0x4de057[_0x0eaf('0x4a')],_0x4de057[_0x0eaf('0x51')],_0x2ab924['connectedlinenum'],_0x2ab924[_0x0eaf('0x86')]);this[_0x0eaf('0x33')][_0x2ab924['uniqueid']]=_0x4de057;this[_0x0eaf('0x88')](_0x4de057,_0x0eaf('0x19'));}}}catch(_0x275d0c){logger[_0x0eaf('0x3b')](_0x0eaf('0x83'),_0x2ab924[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0x275d0c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x89')]=function(_0x28afa8){try{if(this[_0x0eaf('0x5e')](_0x28afa8)){logger[_0x0eaf('0x43')](_0x0eaf('0x8a'),_0x28afa8['uniqueid'],util[_0x0eaf('0x47')](_0x28afa8,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x28afa8[_0x0eaf('0x46')]]){var _0x32b132=_[_0x0eaf('0x7a')](this['queueReports'][_0x28afa8[_0x0eaf('0x46')]]);_0x32b132['queuecallercomplete']=!![];_0x32b132['queuecallerexitreason']=_0x0eaf('0x8b');logger[_0x0eaf('0x65')](_0x0eaf('0x8c'),_0x32b132[_0x0eaf('0x4a')],_0x32b132[_0x0eaf('0x51')]);}}}catch(_0x1aa22d){logger[_0x0eaf('0x3b')](_0x0eaf('0x8a'),_0x28afa8['uniqueid'],util[_0x0eaf('0x47')](_0x1aa22d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x1c')]=function(_0x4394b3){try{if(this[_0x0eaf('0x5e')](_0x4394b3)){logger['debug'](_0x0eaf('0x8d'),_0x4394b3[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0x4394b3,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x4394b3[_0x0eaf('0x46')]]){var _0x3e3120=_[_0x0eaf('0x7a')](this['queueReports'][_0x4394b3[_0x0eaf('0x46')]]);_0x3e3120[_0x0eaf('0x17')]=![];_0x3e3120[_0x0eaf('0x7f')]=null;_0x3e3120[_0x0eaf('0x8e')]=!![];_0x3e3120[_0x0eaf('0x81')]=_0x4394b3['membername'];_0x3e3120['holdtime']=_0x4394b3[_0x0eaf('0x7d')];_0x3e3120[_0x0eaf('0x7b')]=!![];_0x3e3120[_0x0eaf('0x8f')]=![];_0x3e3120['queuecallerexitAt']=null;if(!_0x3e3120[_0x0eaf('0x90')]){if(_0x4394b3[_0x0eaf('0x91')]==_0x0eaf('0x90')){_0x3e3120[_0x0eaf('0x80')]='COMPLETED';logger[_0x0eaf('0x65')](_0x0eaf('0x92'),_0x3e3120[_0x0eaf('0x4a')],_0x3e3120[_0x0eaf('0x51')]);}else{if(_[_0x0eaf('0x93')](_0x4394b3['channel'][_0x0eaf('0x94')](),_0x0eaf('0x95'))){if(this['queueReports'][_0x4394b3['linkedid']]){var _0x44e230=_[_0x0eaf('0x7a')](this['queueReports'][_0x4394b3[_0x0eaf('0x96')]]);_0x44e230[_0x0eaf('0x7b')]=![];_0x44e230[_0x0eaf('0x8f')]=!![];_0x44e230['queuecallerexitAt']=moment(_0x3e3120['queuecallerjoinAt'])[_0x0eaf('0x97')](_0x4394b3[_0x0eaf('0x7d')],_0x0eaf('0x98'))[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x44e230['queuecallerexitreason']=_0x0eaf('0x99');_0x44e230['transfer']=!![];_0x44e230[_0x0eaf('0x9a')]=_0x0eaf('0x9b');_0x44e230[_0x0eaf('0x9c')]=_0x4394b3[_0x0eaf('0x9d')];_0x44e230[_0x0eaf('0x9e')]=_0x4394b3[_0x0eaf('0x46')];logger[_0x0eaf('0x65')](_0x0eaf('0x9f'),_0x44e230[_0x0eaf('0x4a')],_0x44e230[_0x0eaf('0x51')]);var _0x16144d=this[_0x0eaf('0xd')][_0x4394b3[_0x0eaf('0x96')]];this[_0x0eaf('0xd')][_0x4394b3[_0x0eaf('0x96')]]=this[_0x0eaf('0xd')][_0x4394b3['uniqueid']];this[_0x0eaf('0xd')][_0x4394b3['uniqueid']]=_0x16144d;}}else{_0x3e3120[_0x0eaf('0x80')]=_0x0eaf('0xa0')+_0x4394b3[_0x0eaf('0x91')]['toUpperCase']();logger[_0x0eaf('0x65')](_0x0eaf('0xa1'),_0x3e3120[_0x0eaf('0x4a')],_0x3e3120[_0x0eaf('0x51')],_0x3e3120[_0x0eaf('0x80')]);}}}this[_0x0eaf('0x33')][_0x4394b3['uniqueid']]=_0x3e3120;this['emitVoiceQueueChannelRemove'](_0x3e3120,'agentcomplete');}}}catch(_0xaa4e10){logger['error'](_0x0eaf('0x8d'),_0x4394b3[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0xaa4e10,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x1e')]=function(_0x3a58ae){try{if(this[_0x0eaf('0x5e')](_0x3a58ae)){logger['debug'](_0x0eaf('0xa2'),_0x3a58ae['uniqueid'],util['inspect'](_0x3a58ae,{'showHidden':![],'depth':null}));this[_0x0eaf('0xa3')](_0x3a58ae[_0x0eaf('0x46')],_[_0x0eaf('0x77')](_0x3a58ae[_0x0eaf('0xa4')])[0x0],_0x3a58ae[_0x0eaf('0xa5')]);if(this[_0x0eaf('0xd')][_0x3a58ae[_0x0eaf('0x46')]]){var _0x27d63a=_[_0x0eaf('0x7a')](this[_0x0eaf('0xd')][_0x3a58ae[_0x0eaf('0x46')]]);if(_0x27d63a){if(this[_0x0eaf('0x5e')](_0x3a58ae[_0x0eaf('0xa4')])&&this['isNotNull'](_0x3a58ae[_0x0eaf('0xa4')][_0x0eaf('0xa6')])){switch(_0x3a58ae[_0x0eaf('0xa5')]){case _0x0eaf('0xa7'):_0x27d63a[_0x0eaf('0x8f')]=![];_0x27d63a[_0x0eaf('0xa8')]=null;break;case _0x0eaf('0xa9'):_0x27d63a[_0x0eaf('0xaa')]=_0x0eaf('0xab');_0x27d63a[_0x0eaf('0x8f')]=!![];_0x27d63a['queuecallerexitAt']=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x27d63a[_0x0eaf('0x84')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));logger[_0x0eaf('0x43')](_0x0eaf('0xac'),_0x3a58ae[_0x0eaf('0x46')],util['inspect'](_0x27d63a,{'showHidden':![],'depth':null}));ami['emit'](_0x0eaf('0xad'),_0x27d63a);break;default:_0x27d63a['queuecallerexit']=!![];_0x27d63a[_0x0eaf('0xa8')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x27d63a[_0x0eaf('0x84')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));}_0x27d63a[_0x0eaf('0x17')]=![];_0x27d63a[_0x0eaf('0x7f')]=null;_0x27d63a[_0x0eaf('0x80')]=_0x3a58ae[_0x0eaf('0xa5')];this[_0x0eaf('0x33')][_0x3a58ae[_0x0eaf('0x46')]]=_0x27d63a;this['emitVoiceQueueChannelRemove'](_0x27d63a,_0x0eaf('0x1d'));}else if(this[_0x0eaf('0x5e')](_0x3a58ae[_0x0eaf('0xa4')])&&this[_0x0eaf('0x5e')](_0x3a58ae[_0x0eaf('0xa4')][_0x0eaf('0xae')])){if(!_0x27d63a[_0x0eaf('0x17')]){_0x27d63a[_0x0eaf('0x8f')]=!![];_0x27d63a[_0x0eaf('0xa8')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x27d63a['queuecallerexitreason']=_0x0eaf('0xaf');_0x27d63a[_0x0eaf('0x84')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));this[_0x0eaf('0x33')][_0x3a58ae[_0x0eaf('0x46')]]=_0x27d63a;}}logger[_0x0eaf('0x65')](_0x0eaf('0xb0'),_0x3a58ae[_0x0eaf('0x46')],_0x27d63a['name'],_0x27d63a[_0x0eaf('0x51')],_[_0x0eaf('0x77')](_0x3a58ae[_0x0eaf('0xa4')])[0x0],_0x3a58ae[_0x0eaf('0xa5')]);_0x27d63a[_0x0eaf('0x13')]=this[_0x0eaf('0x13')][_0x3a58ae[_0x0eaf('0x46')]];}}}}catch(_0x2b01b2){logger[_0x0eaf('0x3b')](_0x0eaf('0xa2'),_0x3a58ae[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0x2b01b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')]['addVariable']=function(_0x4e02b1,_0x40e16d,_0x18fe09){var _0x454c59=[_0x0eaf('0xb1'),_0x0eaf('0xb2'),_0x0eaf('0xb3'),'rtpaudioqosjitterbridged',_0x0eaf('0xb4'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0x0eaf('0xb5'),_0x0eaf('0xb6'),'bridgepvtcallid','membercalls',_0x0eaf('0xb7'),_0x0eaf('0xb8'),_0x0eaf('0xb9'),'membername','memberpenalty',_0x0eaf('0xba')];if(!_['isNil'](_0x40e16d)&&!_[_0x0eaf('0xbb')](_0x454c59,_0x40e16d)){if(_[_0x0eaf('0x5f')](this[_0x0eaf('0x13')][_0x4e02b1])){this[_0x0eaf('0x13')][_0x4e02b1]={};}this['variables'][_0x4e02b1][_0x40e16d]=_0x18fe09;}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x20')]=function(_0x3629f2){try{if(this[_0x0eaf('0x5e')](_0x3629f2)){logger['debug'](_0x0eaf('0xbc'),_0x3629f2[_0x0eaf('0x46')],util['inspect'](_0x3629f2,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x3629f2[_0x0eaf('0x46')]]){for(var _0xfdb24=0x0,_0x3a75de={};_0xfdb240x0?_0x455564:0x0;this[_0x815f('0x13')][_0x9a66ba[_0x815f('0x6d')]]['talking']=this[_0x815f('0x13')][_0x9a66ba[_0x815f('0x6d')]][_0x815f('0x33')]>_[_0x815f('0x73')](_0x9a66ba[_0x815f('0x74')])?_['toNumber'](_0x9a66ba[_0x815f('0x74')]):this[_0x815f('0x13')][_0x9a66ba[_0x815f('0x6d')]][_0x815f('0x33')];this[_0x815f('0x55')](this[_0x815f('0x13')][_0x9a66ba[_0x815f('0x6d')]],_0x815f('0x6a'));}logger[_0x815f('0x49')](_0x815f('0x76'),util[_0x815f('0x42')](this['voiceQueues'][_0x9a66ba[_0x815f('0x6d')]],{'showHidden':![],'depth':null}));ami[_0x815f('0x4f')](_0x815f('0x77'),this['voiceQueues'][_0x9a66ba[_0x815f('0x6d')]]);}}}catch(_0x111ecf){logger[_0x815f('0x40')](_0x815f('0x6c'),util['inspect'](_0x111ecf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x815f('0x19')]=function(_0x32450d){logger['debug'](_0x815f('0x78'),util[_0x815f('0x42')](_0x32450d,{'showHidden':![],'depth':null}));this[_0x815f('0x14')]=!![];};VoiceQueueReport[_0x815f('0x36')][_0x815f('0x1b')]=function(_0x5657be){try{if(this['isNotNull'](_0x5657be)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x5657be['uniqueid'],util['inspect'](_0x5657be,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x5657be[_0x815f('0x4c')]]))this[_0x815f('0xf')][_0x5657be['uniqueid']]=[];if(_['isUndefined'](this[_0x815f('0x11')][_0x5657be[_0x815f('0x4c')]]))this['channels'][_0x5657be[_0x815f('0x4c')]]={};var _0x521ada=new QueueReport();_0x521ada[_0x815f('0x4d')]=_0x5657be[_0x815f('0x6d')];_0x521ada[_0x815f('0x56')]=this[_0x815f('0x13')][_0x521ada['name']]&&this[_0x815f('0x13')][_0x521ada[_0x815f('0x4d')]][_0x815f('0x56')]?this[_0x815f('0x13')][_0x521ada['name']][_0x815f('0x56')]||_0x815f('0x57'):'inbound';_0x521ada[_0x815f('0x6d')]=_0x5657be[_0x815f('0x6d')];_0x521ada[_0x815f('0x79')]=moment()[_0x815f('0x52')](_0x815f('0x7a'));_0x521ada[_0x815f('0x7b')]=_0x5657be[_0x815f('0x7b')];_0x521ada[_0x815f('0x7c')]=_0x5657be['count'];_0x521ada['uniqueid']=_0x5657be[_0x815f('0x4c')];_0x521ada[_0x815f('0x7d')]=this[_0x815f('0x11')][_0x5657be[_0x815f('0x4c')]][_0x815f('0x7d')];logger[_0x815f('0x6f')](_0x815f('0x7e'),_0x521ada[_0x815f('0x4d')],_0x521ada['type']);_[_0x815f('0x7f')](_0x521ada,_[_0x815f('0x80')](_0x5657be,_[_0x815f('0x81')](_0x521ada)));this[_0x815f('0xf')][_0x5657be['uniqueid']][_0x815f('0x82')](_0x521ada);this[_0x815f('0x11')][_0x5657be[_0x815f('0x4c')]]=_0x521ada;this['emitVoiceQueueChannelSave'](_0x521ada,_0x815f('0x1a'));}}catch(_0x3899a5){logger['error'](_0x815f('0x83'),_0x5657be[_0x815f('0x4c')],util[_0x815f('0x42')](_0x3899a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x815f('0x36')][_0x815f('0x1d')]=function(_0x1ce971){try{if(this[_0x815f('0x66')](_0x1ce971)){logger[_0x815f('0x49')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1ce971[_0x815f('0x4c')],util[_0x815f('0x42')](_0x1ce971,{'showHidden':![],'depth':null}));if(this[_0x815f('0xf')][_0x1ce971[_0x815f('0x4c')]]){var _0x581f22=_['last'](this[_0x815f('0xf')][_0x1ce971[_0x815f('0x4c')]]);_0x581f22[_0x815f('0x84')]=![];_0x581f22[_0x815f('0x85')]=null;_0x581f22[_0x815f('0x86')]=_0x1ce971[_0x815f('0x86')];_0x581f22['originalposition']=_0x1ce971[_0x815f('0x87')];_0x581f22['queuecallerabandon']=!![];_0x581f22[_0x815f('0x88')]=moment()['format'](_0x815f('0x7a'));_0x581f22['queuecallerexitreason']='ABANDONED';_0x581f22['lastAssignedTo']=null;logger[_0x815f('0x6f')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x581f22['name'],_0x581f22[_0x815f('0x56')]);this[_0x815f('0x11')][_0x1ce971['uniqueid']]=_0x581f22;this['emitVoiceQueueChannelRemove'](_0x581f22,_0x815f('0x1c'));}}}catch(_0x49392f){logger[_0x815f('0x40')](_0x815f('0x89'),_0x1ce971[_0x815f('0x4c')],util[_0x815f('0x42')](_0x49392f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x815f('0x36')]['syncQueueCallerLeave']=function(_0x20773b){try{if(this[_0x815f('0x66')](_0x20773b)){logger[_0x815f('0x49')](_0x815f('0x8a'),_0x20773b[_0x815f('0x4c')],util['inspect'](_0x20773b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x20773b[_0x815f('0x4c')]]){var _0x1a04e7=_[_0x815f('0x8b')](this['queueReports'][_0x20773b[_0x815f('0x4c')]]);_0x1a04e7[_0x815f('0x8c')]=moment()[_0x815f('0x52')](_0x815f('0x7a'));_0x1a04e7['connectedlinenum']=_0x20773b[_0x815f('0x8d')];_0x1a04e7[_0x815f('0x8e')]=_0x20773b[_0x815f('0x8e')];logger[_0x815f('0x6f')](_0x815f('0x8f'),_0x1a04e7[_0x815f('0x4d')],_0x1a04e7['type'],_0x20773b[_0x815f('0x8d')],_0x20773b[_0x815f('0x8e')]);this[_0x815f('0x11')][_0x20773b[_0x815f('0x4c')]]=_0x1a04e7;this[_0x815f('0x48')](_0x1a04e7,_0x815f('0x1e'));}}}catch(_0x2f5003){logger['error'](_0x815f('0x8a'),_0x20773b[_0x815f('0x4c')],util['inspect'](_0x2f5003,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x815f('0x36')][_0x815f('0x22')]=function(_0x1c06f7){try{if(this[_0x815f('0x66')](_0x1c06f7)){logger[_0x815f('0x49')](_0x815f('0x90'),_0x1c06f7['uniqueid'],util[_0x815f('0x42')](_0x1c06f7,{'showHidden':![],'depth':null}));if(this[_0x815f('0xf')][_0x1c06f7[_0x815f('0x4c')]]){var _0x5958bb=_['last'](this[_0x815f('0xf')][_0x1c06f7['uniqueid']]);_0x5958bb['queuecallercomplete']=!![];_0x5958bb['queuecallerexitreason']=_0x815f('0x91');logger[_0x815f('0x6f')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5958bb[_0x815f('0x4d')],_0x5958bb[_0x815f('0x56')]);}}}catch(_0x26d4f4){logger[_0x815f('0x40')](_0x815f('0x90'),_0x1c06f7[_0x815f('0x4c')],util['inspect'](_0x26d4f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x815f('0x36')][_0x815f('0x20')]=function(_0x3ac546){try{if(this[_0x815f('0x66')](_0x3ac546)){logger['debug'](_0x815f('0x92'),_0x3ac546[_0x815f('0x4c')],util[_0x815f('0x42')](_0x3ac546,{'showHidden':![],'depth':null}));if(this[_0x815f('0xf')][_0x3ac546[_0x815f('0x4c')]]){var _0x116ec2=_['last'](this[_0x815f('0xf')][_0x3ac546[_0x815f('0x4c')]]);_0x116ec2[_0x815f('0x1c')]=![];_0x116ec2[_0x815f('0x88')]=null;_0x116ec2[_0x815f('0x93')]=!![];_0x116ec2['lastAssignedTo']=_0x3ac546[_0x815f('0x94')];_0x116ec2['holdtime']=_0x3ac546[_0x815f('0x86')];_0x116ec2[_0x815f('0x84')]=!![];_0x116ec2[_0x815f('0x95')]=![];_0x116ec2[_0x815f('0x96')]=null;if(!_0x116ec2[_0x815f('0x97')]){if(_0x3ac546[_0x815f('0x98')]==_0x815f('0x97')){_0x116ec2['queuecallerexitreason']='COMPLETED';logger['info'](_0x815f('0x99'),_0x116ec2[_0x815f('0x4d')],_0x116ec2[_0x815f('0x56')]);}else{if(_[_0x815f('0x9a')](_0x3ac546['channel'][_0x815f('0x9b')](),_0x815f('0x9c'))){if(this[_0x815f('0xf')][_0x3ac546['linkedid']]){var _0x4ce2f6=_['last'](this[_0x815f('0xf')][_0x3ac546['linkedid']]);_0x4ce2f6[_0x815f('0x84')]=![];_0x4ce2f6[_0x815f('0x95')]=!![];_0x4ce2f6['queuecallerexitAt']=moment(_0x116ec2['queuecallerjoinAt'])[_0x815f('0x9d')](_0x3ac546['holdtime'],_0x815f('0x9e'))[_0x815f('0x52')](_0x815f('0x7a'));_0x4ce2f6['queuecallerexitreason']=_0x815f('0x9f');_0x4ce2f6['transfer']=!![];_0x4ce2f6['transfertype']=_0x815f('0xa0');_0x4ce2f6[_0x815f('0xa1')]=_0x3ac546[_0x815f('0xa2')];_0x4ce2f6[_0x815f('0xa3')]=_0x3ac546[_0x815f('0x4c')];logger[_0x815f('0x6f')](_0x815f('0xa4'),_0x4ce2f6[_0x815f('0x4d')],_0x4ce2f6[_0x815f('0x56')]);var _0x1e994d=this[_0x815f('0xf')][_0x3ac546[_0x815f('0xa5')]];this[_0x815f('0xf')][_0x3ac546['linkedid']]=this[_0x815f('0xf')][_0x3ac546[_0x815f('0x4c')]];this[_0x815f('0xf')][_0x3ac546[_0x815f('0x4c')]]=_0x1e994d;}}else{_0x116ec2[_0x815f('0xa6')]='COMPLETEDBY'+_0x3ac546['reason'][_0x815f('0xa7')]();logger[_0x815f('0x6f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x116ec2[_0x815f('0x4d')],_0x116ec2[_0x815f('0x56')],_0x116ec2[_0x815f('0xa6')]);}}}this['channels'][_0x3ac546[_0x815f('0x4c')]]=_0x116ec2;this[_0x815f('0x47')](_0x116ec2,'agentcomplete');}}}catch(_0xf2cc5b){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x3ac546[_0x815f('0x4c')],util[_0x815f('0x42')](_0xf2cc5b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x815f('0x36')][_0x815f('0x24')]=function(_0x1bfda1){try{if(this[_0x815f('0x66')](_0x1bfda1)){logger[_0x815f('0x49')]('[%s][voiceQueueReport][varset]',_0x1bfda1[_0x815f('0x4c')],util[_0x815f('0x42')](_0x1bfda1,{'showHidden':![],'depth':null}));this['addVariable'](_0x1bfda1['uniqueid'],_[_0x815f('0x81')](_0x1bfda1['variable'])[0x0],_0x1bfda1[_0x815f('0xa8')]);if(this[_0x815f('0xf')][_0x1bfda1['uniqueid']]){var _0x28abc4=_[_0x815f('0x8b')](this['queueReports'][_0x1bfda1[_0x815f('0x4c')]]);if(_0x28abc4){if(this[_0x815f('0x66')](_0x1bfda1[_0x815f('0xa9')])&&this['isNotNull'](_0x1bfda1['variable']['queuestatus'])){switch(_0x1bfda1['value']){case _0x815f('0xaa'):_0x28abc4[_0x815f('0x95')]=![];_0x28abc4['queuecallerexitAt']=null;break;case'TIMEOUT':_0x28abc4[_0x815f('0xab')]=_0x815f('0xac');_0x28abc4[_0x815f('0x95')]=!![];_0x28abc4[_0x815f('0x96')]=moment()[_0x815f('0x52')](_0x815f('0x7a'));_0x28abc4['queuecallerleaveAt']=moment()[_0x815f('0x52')](_0x815f('0x7a'));logger['debug'](_0x815f('0xad'),_0x1bfda1[_0x815f('0x4c')],util[_0x815f('0x42')](_0x28abc4,{'showHidden':![],'depth':null}));ami[_0x815f('0x4f')](_0x815f('0xae'),_0x28abc4);break;default:_0x28abc4[_0x815f('0x95')]=!![];_0x28abc4['queuecallerexitAt']=moment()[_0x815f('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x28abc4[_0x815f('0x8c')]=moment()[_0x815f('0x52')](_0x815f('0x7a'));}_0x28abc4[_0x815f('0x1c')]=![];_0x28abc4[_0x815f('0x88')]=null;_0x28abc4['queuecallerexitreason']=_0x1bfda1[_0x815f('0xa8')];this['channels'][_0x1bfda1[_0x815f('0x4c')]]=_0x28abc4;this['emitVoiceQueueChannelRemove'](_0x28abc4,_0x815f('0x23'));}else if(this[_0x815f('0x66')](_0x1bfda1['variable'])&&this[_0x815f('0x66')](_0x1bfda1[_0x815f('0xa9')][_0x815f('0xaf')])){if(!_0x28abc4[_0x815f('0x1c')]){_0x28abc4[_0x815f('0x95')]=!![];_0x28abc4['queuecallerexitAt']=moment()[_0x815f('0x52')](_0x815f('0x7a'));_0x28abc4[_0x815f('0xa6')]=_0x815f('0xb0');_0x28abc4[_0x815f('0x8c')]=moment()[_0x815f('0x52')](_0x815f('0x7a'));this[_0x815f('0x11')][_0x1bfda1['uniqueid']]=_0x28abc4;}}logger[_0x815f('0x6f')](_0x815f('0xb1'),_0x1bfda1[_0x815f('0x4c')],_0x28abc4['name'],_0x28abc4[_0x815f('0x56')],_['keys'](_0x1bfda1[_0x815f('0xa9')])[0x0],_0x1bfda1[_0x815f('0xa8')]);_0x28abc4[_0x815f('0x43')]=this[_0x815f('0x43')][_0x1bfda1['uniqueid']];}}}}catch(_0x289fa8){logger[_0x815f('0x40')](_0x815f('0xb2'),_0x1bfda1[_0x815f('0x4c')],util[_0x815f('0x42')](_0x289fa8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x815f('0xb3')]=function(_0xd7b25,_0x25a66c,_0x2701ed){var _0x398537=['rtpaudioqos',_0x815f('0xb4'),_0x815f('0xb5'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x815f('0xb6'),_0x815f('0xb7'),_0x815f('0xb8'),_0x815f('0xb9'),_0x815f('0xba'),_0x815f('0xbb'),_0x815f('0xbc'),'membercalls','memberdynamic',_0x815f('0xbd'),_0x815f('0xbe'),'membername',_0x815f('0xbf'),'memberrealtime'];if(!_['isNil'](_0x25a66c)&&!_[_0x815f('0xc0')](_0x398537,_0x25a66c)){if(_[_0x815f('0x67')](this[_0x815f('0x43')][_0xd7b25])){this['variables'][_0xd7b25]={};}this[_0x815f('0x43')][_0xd7b25][_0x25a66c]=_0x2701ed;}};VoiceQueueReport[_0x815f('0x36')][_0x815f('0x25')]=function(_0xd4436a){try{if(this[_0x815f('0x66')](_0xd4436a)){logger[_0x815f('0x49')]('[%s][voiceQueueReport][hangup]',_0xd4436a[_0x815f('0x4c')],util[_0x815f('0x42')](_0xd4436a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xd4436a['uniqueid']]){for(var _0x287b06=0x0,_0xe97ff7={};_0x287b06=0x0?moment(_0x2a3625[_0xfbb0('0x15')])[_0xfbb0('0xc')](_0x2a3625[_0xfbb0('0x14')],_0xfbb0('0xd')):null,'data1':_0xfbb0('0x16'),'data2':_0x2a3625[_0xfbb0('0x10')],'data3':_0x2a3625[_0xfbb0('0x17')],'data4':_0x2a3625[_0xfbb0('0x18')]||null,'role':'agent','internal':_0x2a3625[_0xfbb0('0x10')]?_[_0xfbb0('0x11')](_0x2a3625[_0xfbb0('0x10')]):undefined,'uniqueid':_0x2a3625['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xf7e1=['SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','exten','agent','toNumber','accountcode','uniqueid','membername','starttime','endtime','seconds','outbound','moment','util','../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','isNil','interface','format'];(function(_0x1df028,_0x1f0ac8){var _0x1fa40b=function(_0xaed14){while(--_0xaed14){_0x1df028['push'](_0x1df028['shift']());}};_0x1fa40b(++_0x1f0ac8);}(_0xf7e1,0x12f));var _0x1f7e=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xf7e1[_0x1a9204];return _0x17ca68;};'use strict';var moment=require(_0x1f7e('0x0'));var _=require('lodash');var util=require(_0x1f7e('0x1'));var client=require(_0x1f7e('0x2'));exports[_0x1f7e('0x3')]=function(_0x2701e3){var _0x76f8=_0x2701e3[_0x1f7e('0x4')]||_0x2701e3['queuecallerexitAt'];return client['Request'](_0x1f7e('0x5'),{'body':{'channel':'voice','membername':_0x2701e3['lastAssignedTo'],'interface':_[_0x1f7e('0x6')](_0x2701e3[_0x1f7e('0x7')])?util[_0x1f7e('0x8')](_0x1f7e('0x9'),_0x2701e3[_0x1f7e('0xa')]):_0x2701e3[_0x1f7e('0x7')],'type':_0x1f7e('0xb'),'enterAt':_0x2701e3[_0x1f7e('0xc')],'exitAt':_0x76f8,'duration':moment(_0x76f8)[_0x1f7e('0xd')](_0x2701e3[_0x1f7e('0xc')],'seconds'),'data1':'inbound','data2':_0x2701e3['calleridnum'],'data3':_0x2701e3[_0x1f7e('0xe')],'data4':null,'data5':_0x2701e3['queue'],'role':_0x1f7e('0xf'),'internal':_0x2701e3['accountcode']?_[_0x1f7e('0x10')](_0x2701e3[_0x1f7e('0x11')]):undefined,'uniqueid':_0x2701e3[_0x1f7e('0x12')]},'log':_0x1f7e('0x5')});};exports['voiceDialReport']=function(_0x44669b){return client['Request'](_0x1f7e('0x5'),{'body':{'channel':'voice','membername':_0x44669b[_0x1f7e('0x13')],'interface':_0x44669b['interface'],'type':_0x1f7e('0xb'),'enterAt':_0x44669b[_0x1f7e('0x14')],'exitAt':_0x44669b[_0x1f7e('0x15')],'duration':moment(_0x44669b['endtime'])['diff'](_0x44669b['starttime'],_0x1f7e('0x16'))>=0x0?moment(_0x44669b[_0x1f7e('0x15')])['diff'](_0x44669b['starttime'],'seconds'):null,'data1':_0x1f7e('0x17'),'data2':_0x44669b[_0x1f7e('0x11')],'data3':_0x44669b[_0x1f7e('0xe')],'data4':_0x44669b['dialstring']||null,'role':_0x1f7e('0xf'),'internal':_0x44669b[_0x1f7e('0x11')]?_[_0x1f7e('0x10')](_0x44669b['accountcode']):undefined,'uniqueid':_0x44669b[_0x1f7e('0x12')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index c5b81de..7963743 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 _0x0bb4=['getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x2f0c55,_0x57370f){var _0x10a23f=function(_0x2aaef3){while(--_0x2aaef3){_0x2f0c55['push'](_0x2f0c55['shift']());}};_0x10a23f(++_0x57370f);}(_0x0bb4,0x77));var _0x40bb=function(_0xca8a7c,_0x2f7a66){_0xca8a7c=_0xca8a7c-0x0;var _0x3ab51c=_0x0bb4[_0xca8a7c];return _0x3ab51c;};'use strict';var client=require(_0x40bb('0x0'));exports[_0x40bb('0x1')]=function(){return client['Request'](_0x40bb('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x40bb('0x3'),_0x40bb('0x4')]},'log':_0x40bb('0x5')});}; \ No newline at end of file +var _0x1b2a=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings'];(function(_0x191343,_0x331a0a){var _0x208956=function(_0x51df8c){while(--_0x51df8c){_0x191343['push'](_0x191343['shift']());}};_0x208956(++_0x331a0a);}(_0x1b2a,0x18f));var _0xa1b2=function(_0x4fd7f5,_0x4573cd){_0x4fd7f5=_0x4fd7f5-0x0;var _0x135fc9=_0x1b2a[_0x4fd7f5];return _0x135fc9;};'use strict';var client=require('../client');exports[_0xa1b2('0x0')]=function(){return client['Request'](_0xa1b2('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa1b2('0x2'),_0xa1b2('0x3')]},'log':_0xa1b2('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 4a65fb4..0aa699d 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 _0x969d=['getTemplates','GetTemplate','html','../client'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x969d,0xf7));var _0xd969=function(_0x34bd49,_0x3c9070){_0x34bd49=_0x34bd49-0x0;var _0x349fca=_0x969d[_0x34bd49];return _0x349fca;};'use strict';var client=require(_0xd969('0x0'));exports[_0xd969('0x1')]=function(_0x1c5abf){return function(_0x1c40b8){return client['Request'](_0xd969('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xd969('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xf793=['GetTemplate','name','html','getTemplates','Request'];(function(_0xf74372,_0x51fe82){var _0x36bb65=function(_0x499b7a){while(--_0x499b7a){_0xf74372['push'](_0xf74372['shift']());}};_0x36bb65(++_0x51fe82);}(_0xf793,0x1ac));var _0x3f79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf793[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0x3f79('0x0')]=function(_0x54148c){return function(_0x5075af){return client[_0x3f79('0x1')](_0x3f79('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3f79('0x3'),_0x3f79('0x4')]},'log':_0x3f79('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7177812..ba21085 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 _0x9f40=['data2','data3','data4','data5','data6','data7','GetTrigger','../client','getTriggers','Request','name','status','Condition','field','operator','value','Action','Actions'];(function(_0x258df0,_0x31ce33){var _0x2a96fe=function(_0x2a93cf){while(--_0x2a93cf){_0x258df0['push'](_0x258df0['shift']());}};_0x2a96fe(++_0x31ce33);}(_0x9f40,0x1ed));var _0x09f4=function(_0x3323f6,_0x957905){_0x3323f6=_0x3323f6-0x0;var _0x55eb64=_0x9f40[_0x3323f6];return _0x55eb64;};'use strict';var client=require(_0x09f4('0x0'));exports[_0x09f4('0x1')]=function(_0x2501c7){return function(_0x2b9d60){return client[_0x09f4('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x09f4('0x3'),'channel',_0x09f4('0x4')],'include':[{'model':_0x09f4('0x5'),'as':'AllConditions','attributes':['id',_0x09f4('0x6'),_0x09f4('0x7'),_0x09f4('0x8')]},{'model':_0x09f4('0x5'),'as':'AnyConditions','attributes':['id',_0x09f4('0x6'),_0x09f4('0x7'),'value']},{'model':_0x09f4('0x9'),'as':_0x09f4('0xa'),'attributes':['id','action','data1',_0x09f4('0xb'),_0x09f4('0xc'),_0x09f4('0xd'),_0x09f4('0xe'),_0x09f4('0xf'),_0x09f4('0x10')]}]},'log':_0x09f4('0x11')});};}; \ No newline at end of file +var _0xca22=['value','AnyConditions','Action','Actions','action','data3','data4','data6','GetTrigger','getTriggers','Request','name','channel','status','Condition','field','operator'];(function(_0x3c45bf,_0x335246){var _0x10f652=function(_0x14f1cf){while(--_0x14f1cf){_0x3c45bf['push'](_0x3c45bf['shift']());}};_0x10f652(++_0x335246);}(_0xca22,0x1a1));var _0x2ca2=function(_0x53cb5b,_0x2a90e5){_0x53cb5b=_0x53cb5b-0x0;var _0x14fe7f=_0xca22[_0x53cb5b];return _0x14fe7f;};'use strict';var client=require('../client');exports[_0x2ca2('0x0')]=function(_0x137d50){return function(_0x485c24){return client[_0x2ca2('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x2ca2('0x2'),_0x2ca2('0x3'),_0x2ca2('0x4')],'include':[{'model':_0x2ca2('0x5'),'as':'AllConditions','attributes':['id',_0x2ca2('0x6'),_0x2ca2('0x7'),_0x2ca2('0x8')]},{'model':'Condition','as':_0x2ca2('0x9'),'attributes':['id',_0x2ca2('0x6'),_0x2ca2('0x7'),'value']},{'model':_0x2ca2('0xa'),'as':_0x2ca2('0xb'),'attributes':['id',_0x2ca2('0xc'),'data1','data2',_0x2ca2('0xd'),_0x2ca2('0xe'),'data5',_0x2ca2('0xf'),'data7']}]},'log':_0x2ca2('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 69bf3b4..8e8433f 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 _0xe306=['getTrunks','Request','registry','defaultuser','../client'];(function(_0x19a773,_0x2c3111){var _0xf2eaa2=function(_0x2053bc){while(--_0x2053bc){_0x19a773['push'](_0x19a773['shift']());}};_0xf2eaa2(++_0x2c3111);}(_0xe306,0x180));var _0x6e30=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0xe306[_0x5471ec];return _0x121d4c;};'use strict';var client=require(_0x6e30('0x0'));exports[_0x6e30('0x1')]=function(_0x31a12f){return function(_0x2c9174){return client[_0x6e30('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x6e30('0x3'),_0x6e30('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x0ec2=['../client','Request','GetTrunk','name','registry','defaultuser'];(function(_0x4d5ee6,_0x32da52){var _0x2ddf2c=function(_0x2c2298){while(--_0x2c2298){_0x4d5ee6['push'](_0x4d5ee6['shift']());}};_0x2ddf2c(++_0x32da52);}(_0x0ec2,0x72));var _0x20ec=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x0ec2[_0x26d386];return _0x4ef9a8;};'use strict';var client=require(_0x20ec('0x0'));exports['getTrunks']=function(_0x251518){return function(_0x163ec6){return client[_0x20ec('0x1')](_0x20ec('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x20ec('0x3'),_0x20ec('0x4'),_0x20ec('0x5')]},'log':_0x20ec('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index bd49290..cb28422 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 _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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d8539e4..cbaa317 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 _0x3a9c=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','Request'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x3a9c,0x1ac));var _0xc3a9=function(_0x6a189a,_0x49a42c){_0x6a189a=_0x6a189a-0x0;var _0x515500=_0x3a9c[_0x6a189a];return _0x515500;};'use strict';var client=require(_0xc3a9('0x0'));exports['create']=function(_0x49f3e0){return client[_0xc3a9('0x1')]('CreateVoiceAgentReport',{'body':_0x49f3e0,'log':_0xc3a9('0x2')});};exports[_0xc3a9('0x3')]=function(_0x2259e3,_0x211a66,_0x2954cf){return client['Request'](_0xc3a9('0x4'),{'body':_0x2259e3,'options':{'where':{'uniqueid':_0x211a66,'interface':_0x2954cf,'agentcomplete':!![]}},'log':_0xc3a9('0x4')});}; \ No newline at end of file +var _0xe079=['UpdateVoiceAgentReport','CreateVoiceAgentReport','update'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xe079,0x169));var _0x9e07=function(_0x5766d1,_0x503806){_0x5766d1=_0x5766d1-0x0;var _0x5958fa=_0xe079[_0x5766d1];return _0x5958fa;};'use strict';var client=require('../client');exports['create']=function(_0x342fc6){return client['Request'](_0x9e07('0x0'),{'body':_0x342fc6,'log':_0x9e07('0x0')});};exports[_0x9e07('0x1')]=function(_0x325701,_0x2049a2,_0x334753){return client['Request'](_0x9e07('0x2'),{'body':_0x325701,'options':{'where':{'uniqueid':_0x2049a2,'interface':_0x334753,'agentcomplete':!![]}},'log':_0x9e07('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 10be711..aae3c47 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 _0x3b5c=['startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3b5c,0x128));var _0xc3b5=function(_0x436d51,_0x947007){_0x436d51=_0x436d51-0x0;var _0x2dcf75=_0x3b5c[_0x436d51];return _0x2dcf75;};'use strict';var moment=require(_0xc3b5('0x0'));var util=require('util');var _=require(_0xc3b5('0x1'));var client=require('../client');exports[_0xc3b5('0x2')]=function(_0x30c4ad){return client[_0xc3b5('0x3')](_0xc3b5('0x4'),{'body':_[_0xc3b5('0x5')](_0x30c4ad,{'source':_0x30c4ad[_0xc3b5('0x6')],'destinationcontext':_0x30c4ad[_0xc3b5('0x7')],'callerid':_0x30c4ad['callerid'],'amaflags':_0xc3b5('0x8')}),'log':_0xc3b5('0x4')});};exports[_0xc3b5('0x9')]=function(){return function(){return client['Request'](_0xc3b5('0xa'),{'options':{'where':{'type':[_0xc3b5('0xb')],'createdAt':{'$between':[moment()[_0xc3b5('0xc')](_0xc3b5('0xd'))['format'](_0xc3b5('0xe')),moment()[_0xc3b5('0xf')]('day')[_0xc3b5('0x10')](_0xc3b5('0xe'))]}},'attributes':[_0xc3b5('0x11'),_0xc3b5('0x12'),_0xc3b5('0x13'),_0xc3b5('0x14')]},'log':_0xc3b5('0x15')});};}; \ No newline at end of file +var _0x0b6e=['endOf','type','disposition','duration','GetVoiceCallReports','moment','util','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x41f9b2,_0xdde591){var _0x4570bb=function(_0x37d4db){while(--_0x37d4db){_0x41f9b2['push'](_0x41f9b2['shift']());}};_0x4570bb(++_0xdde591);}(_0x0b6e,0xb9));var _0xe0b6=function(_0xabb67b,_0x5d8866){_0xabb67b=_0xabb67b-0x0;var _0x4ab21a=_0x0b6e[_0xabb67b];return _0x4ab21a;};'use strict';var moment=require(_0xe0b6('0x0'));var util=require(_0xe0b6('0x1'));var _=require('lodash');var client=require('../client');exports['create']=function(_0x2323ab){return client[_0xe0b6('0x2')](_0xe0b6('0x3'),{'body':_[_0xe0b6('0x4')](_0x2323ab,{'source':_0x2323ab[_0xe0b6('0x5')],'destinationcontext':_0x2323ab[_0xe0b6('0x6')],'callerid':_0x2323ab[_0xe0b6('0x7')],'amaflags':_0xe0b6('0x8')}),'log':_0xe0b6('0x3')});};exports[_0xe0b6('0x9')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0xe0b6('0xa')],'createdAt':{'$between':[moment()[_0xe0b6('0xb')](_0xe0b6('0xc'))[_0xe0b6('0xd')](_0xe0b6('0xe')),moment()[_0xe0b6('0xf')](_0xe0b6('0xc'))[_0xe0b6('0xd')](_0xe0b6('0xe'))]}},'attributes':[_0xe0b6('0x10'),_0xe0b6('0x11'),_0xe0b6('0x12'),'billableseconds']},'log':_0xe0b6('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 88bf6ab..fbb104b 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 _0x1b86=['../client','create','Request','CreateVoiceDialReport'];(function(_0x23d437,_0x4261dd){var _0x4c99f4=function(_0x5cffd0){while(--_0x5cffd0){_0x23d437['push'](_0x23d437['shift']());}};_0x4c99f4(++_0x4261dd);}(_0x1b86,0x1d8));var _0x61b8=function(_0x37f1b4,_0x124c4e){_0x37f1b4=_0x37f1b4-0x0;var _0x4b96c5=_0x1b86[_0x37f1b4];return _0x4b96c5;};'use strict';var client=require(_0x61b8('0x0'));exports[_0x61b8('0x1')]=function(_0x16a5c0){return client[_0x61b8('0x2')](_0x61b8('0x3'),{'body':_0x16a5c0,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xfa65=['CreateVoiceDialReport','Request'];(function(_0x900446,_0x4c09c9){var _0x4e46e3=function(_0x542d6d){while(--_0x542d6d){_0x900446['push'](_0x900446['shift']());}};_0x4e46e3(++_0x4c09c9);}(_0xfa65,0x1a1));var _0x5fa6=function(_0x44df26,_0x5d1100){_0x44df26=_0x44df26-0x0;var _0xec7ab6=_0xfa65[_0x44df26];return _0xec7ab6;};'use strict';var client=require('../client');exports['create']=function(_0x58bdde){return client[_0x5fa6('0x0')](_0x5fa6('0x1'),{'body':_0x58bdde,'log':_0x5fa6('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7522ad3..c594d43 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 _0x68fc=['recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x68fc,0xa5));var _0xc68f=function(_0x480f28,_0x1b9b80){_0x480f28=_0x480f28-0x0;var _0xd4c034=_0x68fc[_0x480f28];return _0xd4c034;};'use strict';var client=require(_0xc68f('0x0'));exports[_0xc68f('0x1')]=function(){return function(){return client[_0xc68f('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xc68f('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x9c44=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x2f97c1,_0x17ddb4){var _0x31c537=function(_0x2dc81d){while(--_0x2dc81d){_0x2f97c1['push'](_0x2f97c1['shift']());}};_0x31c537(++_0x17ddb4);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x49c4('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index dc7d6ac..7743639 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 _0x5858=['dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','type','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueProject'];(function(_0x367a44,_0x121a26){var _0x14c9d1=function(_0x1262a8){while(--_0x1262a8){_0x367a44['push'](_0x367a44['shift']());}};_0x14c9d1(++_0x121a26);}(_0x5858,0xa7));var _0x8585=function(_0xbfae90,_0xa9e4ef){_0xbfae90=_0xbfae90-0x0;var _0xda61ef=_0x5858[_0xbfae90];return _0xda61ef;};'use strict';var client=require(_0x8585('0x0'));exports[_0x8585('0x1')]=function(){return function(){return client[_0x8585('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x8585('0x3'),_0x8585('0x4'),_0x8585('0x5'),'autopause','monitor_format',_0x8585('0x6'),_0x8585('0x7'),_0x8585('0x8'),'dialLimitChannel',_0x8585('0x9'),'dialPowerLevel',_0x8585('0xa'),_0x8585('0xb'),_0x8585('0xc'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x8585('0xd'),_0x8585('0xe'),'dialQueueTimeout',_0x8585('0xf'),_0x8585('0x10'),'dialCongestionRetryFrequency',_0x8585('0x11'),_0x8585('0x12'),_0x8585('0x13'),'dialNoAnswerRetryFrequency',_0x8585('0x14'),_0x8585('0x15'),_0x8585('0x16'),_0x8585('0x17'),_0x8585('0x18'),_0x8585('0x19'),_0x8585('0x1a'),_0x8585('0x1b'),_0x8585('0x1c'),'dialAMDTotalAnalysisTime',_0x8585('0x1d'),_0x8585('0x1e'),_0x8585('0x1f'),_0x8585('0x20'),'dialAMDMaximumWordLength','timeout',_0x8585('0x21'),'dialRecallInQueue',_0x8585('0x22'),_0x8585('0x23'),_0x8585('0x24'),_0x8585('0x25'),_0x8585('0x26'),'strategy',_0x8585('0x27'),_0x8585('0x28'),_0x8585('0x29'),'dialNoSuchNumberRetryFrequency',_0x8585('0x2a'),_0x8585('0x2b'),_0x8585('0x2c'),'dialAbandonedRetryFrequency',_0x8585('0x2d'),_0x8585('0x2e'),_0x8585('0x2f'),_0x8585('0x30'),_0x8585('0x31'),_0x8585('0x32'),'dialPredictiveIntervalMinThreshold',_0x8585('0x33'),_0x8585('0x34')],'include':[{'model':_0x8585('0x35'),'as':_0x8585('0x35'),'attributes':['id',_0x8585('0x3'),_0x8585('0x36'),_0x8585('0x37')]},{'model':_0x8585('0x38'),'as':_0x8585('0x39'),'attributes':['id','name']},{'model':_0x8585('0x35'),'as':_0x8585('0x3a'),'attributes':['id',_0x8585('0x3'),_0x8585('0x36'),_0x8585('0x37')]},{'model':_0x8585('0x3b'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x8585('0x3b'),'as':'Intervals','attributes':['id',_0x8585('0x3'),_0x8585('0x3c')]}]}]},'log':_0x8585('0x1')});};}; \ No newline at end of file +var _0x85af=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85af,0x69));var _0xf85a=function(_0x205f6c,_0x38f04a){_0x205f6c=_0x205f6c-0x0;var _0x14a81e=_0x85af[_0x205f6c];return _0x14a81e;};'use strict';var client=require(_0xf85a('0x0'));exports[_0xf85a('0x1')]=function(){return function(){return client[_0xf85a('0x2')](_0xf85a('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0xf85a('0x4'),'autopause',_0xf85a('0x5'),_0xf85a('0x6'),_0xf85a('0x7'),_0xf85a('0x8'),_0xf85a('0x9'),_0xf85a('0xa'),'dialPowerLevel',_0xf85a('0xb'),_0xf85a('0xc'),_0xf85a('0xd'),_0xf85a('0xe'),_0xf85a('0xf'),_0xf85a('0x10'),_0xf85a('0x11'),_0xf85a('0x12'),_0xf85a('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0xf85a('0x14'),'dialBusyRetryFrequency',_0xf85a('0x15'),_0xf85a('0x16'),_0xf85a('0x17'),_0xf85a('0x18'),_0xf85a('0x19'),_0xf85a('0x1a'),_0xf85a('0x1b'),_0xf85a('0x1c'),'dialAMDInitialSilence',_0xf85a('0x1d'),_0xf85a('0x1e'),_0xf85a('0x1f'),_0xf85a('0x20'),'dialAMDBetweenWordsSilence',_0xf85a('0x21'),_0xf85a('0x22'),'dialAMDMaximumWordLength',_0xf85a('0x23'),_0xf85a('0x24'),_0xf85a('0x25'),_0xf85a('0x26'),_0xf85a('0x27'),_0xf85a('0x28'),_0xf85a('0x29'),_0xf85a('0x5'),_0xf85a('0x2a'),_0xf85a('0x2b'),_0xf85a('0x2c'),_0xf85a('0x2d'),_0xf85a('0x2e'),_0xf85a('0x2f'),_0xf85a('0x30'),_0xf85a('0x31'),_0xf85a('0x32'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xf85a('0x33'),_0xf85a('0x34'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xf85a('0x35'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xf85a('0x36'),'attributes':['id',_0xf85a('0x37'),_0xf85a('0x38'),_0xf85a('0x39')]},{'model':_0xf85a('0x3a'),'as':_0xf85a('0x3b'),'attributes':['id',_0xf85a('0x37')]},{'model':_0xf85a('0x36'),'as':_0xf85a('0x3c'),'attributes':['id','name',_0xf85a('0x38'),_0xf85a('0x39')]},{'model':_0xf85a('0x3d'),'as':'Interval','attributes':['id',_0xf85a('0x37')],'include':[{'model':_0xf85a('0x3d'),'as':_0xf85a('0x3e'),'attributes':['id','name','interval']}]}]},'log':_0xf85a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 48a9887..2f0b33a 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(_0x42dd69,_0x862f4b){var _0x151a64=function(_0x19c9f0){while(--_0x19c9f0){_0x42dd69['push'](_0x42dd69['shift']());}};_0x151a64(++_0x862f4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x56a997,_0x553a33){var _0x319a36=function(_0x2e82a0){while(--_0x2e82a0){_0x56a997['push'](_0x56a997['shift']());}};_0x319a36(++_0x553a33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 676b942..b379c12 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 _0xbc3d=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x29caf2,_0x517e50){var _0x46ed50=function(_0x1f3f3c){while(--_0x1f3f3c){_0x29caf2['push'](_0x29caf2['shift']());}};_0x46ed50(++_0x517e50);}(_0xbc3d,0x1b0));var _0xdbc3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xbc3d[_0x122096];return _0x3d1966;};'use strict';var client=require(_0xdbc3('0x0'));exports[_0xdbc3('0x1')]=function(_0x50977f){return function(){return client['Request'](_0xdbc3('0x2'),{'options':{'where':{'VoiceQueueId':_0x50977f,'paused':!![]},'raw':!![]},'log':_0xdbc3('0x1')});};}; \ No newline at end of file +var _0x5e22=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0x5e22,0x77));var _0x25e2=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x5e22[_0x3511d3];return _0x5d6321;};'use strict';var client=require(_0x25e2('0x0'));exports[_0x25e2('0x1')]=function(_0x3f94c5){return function(){return client[_0x25e2('0x2')](_0x25e2('0x3'),{'options':{'where':{'VoiceQueueId':_0x3f94c5,'paused':!![]},'raw':!![]},'log':_0x25e2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index cab9e1a..aae1b8b 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x396c3a,_0x18f378){var _0x24b7f6=function(_0x2377c6){while(--_0x2377c6){_0x396c3a['push'](_0x396c3a['shift']());}};_0x24b7f6(++_0x18f378);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x67995f,_0x408bae){var _0x5172ac=function(_0x56c594){while(--_0x56c594){_0x67995f['push'](_0x67995f['shift']());}};_0x5172ac(++_0x408bae);}(_0x7a54,0x106));var _0x47a5=function(_0x2a2d6d,_0x4ab6c7){_0x2a2d6d=_0x2a2d6d-0x0;var _0xb2b1ad=_0x7a54[_0x2a2d6d];return _0xb2b1ad;};'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 30d46f5..33d8f37 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 _0x1012=['transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext'];(function(_0x48df04,_0x1522b1){var _0x4de5fa=function(_0x3ae6db){while(--_0x3ae6db){_0x48df04['push'](_0x48df04['shift']());}};_0x4de5fa(++_0x1522b1);}(_0x1012,0xc2));var _0x2101=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x1012[_0x3a0ebd];return _0x51a660;};'use strict';var client=require('../client');exports[_0x2101('0x0')]={};exports[_0x2101('0x1')]=function(_0x26eb53){return client[_0x2101('0x2')](_0x2101('0x3'),{'body':{'result':_0x26eb53['result'],'transfererchannel':_0x26eb53[_0x2101('0x4')],'transferercalleridnum':_0x26eb53[_0x2101('0x5')],'transferercalleridname':_0x26eb53['transferercalleridname'],'transfererconnectedlinenum':_0x26eb53[_0x2101('0x6')],'transfererconnectedlinename':_0x26eb53[_0x2101('0x7')],'transfereraccountcode':_0x26eb53[_0x2101('0x8')],'transferercontext':_0x26eb53[_0x2101('0x9')],'transfererexten':_0x26eb53[_0x2101('0xa')],'transfererlinkedid':_0x26eb53[_0x2101('0xb')],'transfereechannel':_0x26eb53[_0x2101('0xc')],'transfereecalleridnum':_0x26eb53[_0x2101('0xd')],'transfereecalleridname':_0x26eb53[_0x2101('0xe')],'transfereeconnectedlinenum':_0x26eb53[_0x2101('0xf')],'transfereeconnectedlinename':_0x26eb53[_0x2101('0x10')],'transfereeaccountcode':_0x26eb53[_0x2101('0x11')],'transfereecontext':_0x26eb53[_0x2101('0x12')],'transfereeexten':_0x26eb53['transfereeexten'],'transfereelinkedid':_0x26eb53[_0x2101('0x13')],'isexternal':_0x26eb53['isexternal'],'context':_0x26eb53['context'],'extension':_0x26eb53[_0x2101('0x14')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x2101('0x15')]=function(_0x3809fd){return client[_0x2101('0x2')](_0x2101('0x3'),{'body':{'result':_0x3809fd['result'],'transfererchannel':_0x3809fd[_0x2101('0x16')],'transferercalleridnum':_0x3809fd[_0x2101('0x17')],'transferercalleridname':_0x3809fd[_0x2101('0x18')],'transfererconnectedlinenum':_0x3809fd[_0x2101('0x19')],'transfererconnectedlinename':_0x3809fd[_0x2101('0x1a')],'transfereraccountcode':_0x3809fd['origtransfereraccountcode'],'transferercontext':_0x3809fd[_0x2101('0x1b')],'transfererexten':_0x3809fd['secondtransfererexten'],'transfererlinkedid':_0x3809fd['origtransfererlinkedid'],'transfereechannel':_0x3809fd['transfertargetchannel'],'transfereecalleridnum':_0x3809fd[_0x2101('0x1c')],'transfereecalleridname':_0x3809fd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3809fd[_0x2101('0x1d')],'transfereeconnectedlinename':_0x3809fd[_0x2101('0x1e')],'transfereeaccountcode':_0x3809fd[_0x2101('0x1f')],'transfereecontext':_0x3809fd[_0x2101('0x20')],'transfereeexten':_0x3809fd['transfertargetexten'],'transfereelinkedid':_0x3809fd[_0x2101('0x21')],'isexternal':_0x3809fd[_0x2101('0x22')],'context':_0x3809fd[_0x2101('0x23')],'extension':_0x3809fd[_0x2101('0x24')],'type':'attended'},'log':_0x2101('0x3')});}; \ No newline at end of file +var _0x01c7=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','isexternal','origtransferercontext','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x403ba1,_0x20eebf){var _0x43462c=function(_0x3447ef){while(--_0x3447ef){_0x403ba1['push'](_0x403ba1['shift']());}};_0x43462c(++_0x20eebf);}(_0x01c7,0xf2));var _0x701c=function(_0x4f7edb,_0x43b96b){_0x4f7edb=_0x4f7edb-0x0;var _0x35967d=_0x01c7[_0x4f7edb];return _0x35967d;};'use strict';var client=require('../client');exports[_0x701c('0x0')]={};exports[_0x701c('0x1')]=function(_0x64bfcf){return client[_0x701c('0x2')](_0x701c('0x3'),{'body':{'result':_0x64bfcf[_0x701c('0x4')],'transfererchannel':_0x64bfcf[_0x701c('0x5')],'transferercalleridnum':_0x64bfcf['transferercalleridnum'],'transferercalleridname':_0x64bfcf[_0x701c('0x6')],'transfererconnectedlinenum':_0x64bfcf[_0x701c('0x7')],'transfererconnectedlinename':_0x64bfcf['transfererconnectedlinename'],'transfereraccountcode':_0x64bfcf[_0x701c('0x8')],'transferercontext':_0x64bfcf['transferercontext'],'transfererexten':_0x64bfcf['transfererexten'],'transfererlinkedid':_0x64bfcf[_0x701c('0x9')],'transfereechannel':_0x64bfcf[_0x701c('0xa')],'transfereecalleridnum':_0x64bfcf[_0x701c('0xb')],'transfereecalleridname':_0x64bfcf['transfereecalleridname'],'transfereeconnectedlinenum':_0x64bfcf['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x64bfcf[_0x701c('0xc')],'transfereeaccountcode':_0x64bfcf[_0x701c('0xd')],'transfereecontext':_0x64bfcf[_0x701c('0xe')],'transfereeexten':_0x64bfcf[_0x701c('0xf')],'transfereelinkedid':_0x64bfcf[_0x701c('0x10')],'isexternal':_0x64bfcf['isexternal'],'context':_0x64bfcf[_0x701c('0x11')],'extension':_0x64bfcf[_0x701c('0x12')],'type':_0x701c('0x13')},'log':_0x701c('0x3')});};exports[_0x701c('0x14')]=function(_0x14b3b8){return client['Request'](_0x701c('0x3'),{'body':{'result':_0x14b3b8['result'],'transfererchannel':_0x14b3b8[_0x701c('0x15')],'transferercalleridnum':_0x14b3b8[_0x701c('0x16')],'transferercalleridname':_0x14b3b8[_0x701c('0x17')],'transfererconnectedlinenum':_0x14b3b8[_0x701c('0x18')],'transfererconnectedlinename':_0x14b3b8[_0x701c('0x19')],'transfereraccountcode':_0x14b3b8[_0x701c('0x1a')],'transferercontext':_0x14b3b8[_0x701c('0x1b')],'transfererexten':_0x14b3b8[_0x701c('0x1c')],'transfererlinkedid':_0x14b3b8[_0x701c('0x1d')],'transfereechannel':_0x14b3b8[_0x701c('0x1e')],'transfereecalleridnum':_0x14b3b8[_0x701c('0x1f')],'transfereecalleridname':_0x14b3b8['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x14b3b8[_0x701c('0x20')],'transfereeconnectedlinename':_0x14b3b8[_0x701c('0x21')],'transfereeaccountcode':_0x14b3b8['transfertargetaccountcode'],'transfereecontext':_0x14b3b8[_0x701c('0x22')],'transfereeexten':_0x14b3b8['transfertargetexten'],'transfereelinkedid':_0x14b3b8['transfertargetlinkedid'],'isexternal':_0x14b3b8[_0x701c('0x23')],'context':_0x14b3b8[_0x701c('0x24')],'extension':_0x14b3b8['origtransfererexten'],'type':_0x701c('0x25')},'log':_0x701c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 20b5f0a..5b5b23d 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 _0xc9c3=['exten','context','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','agents','updateStatusRealtime','pause','asterisk','username','ami\x20disconnected','join','pick','module','then','message','catch','error','command','action','Command','Action','content','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','find','omit','undefined','values','channels','length','isConnected','voicechannel','validate','map','uniqueid','channel','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','status','stop','%s.%s','filename','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','Redirect'];(function(_0x2bdf29,_0x40cab0){var _0x60cb83=function(_0x4bc761){while(--_0x4bc761){_0x2bdf29['push'](_0x2bdf29['shift']());}};_0x60cb83(++_0x40cab0);}(_0xc9c3,0x96));var _0x3c9c=function(_0x36bcca,_0x7b315f){_0x36bcca=_0x36bcca-0x0;var _0x3374c7=_0xc9c3[_0x36bcca];return _0x3374c7;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x3c9c('0x0'));var schema=require('validate');var BPromise=require(_0x3c9c('0x1'));var moment=require(_0x3c9c('0x2'));var config=require(_0x3c9c('0x3'));var properties=require(_0x3c9c('0x4'));var ami=require(_0x3c9c('0x5'));exports[_0x3c9c('0x6')]=function(_0x143bfe,_0x512e80,_0x48b219){return new BPromise(function(_0x5c86bd,_0x5a2836){var _0x3ca0ce={'QueuePause':function(_0xc35e75){return new Promise(function(_0x2eb946,_0x3e5ccb){var _0x355ef3=util[_0x3c9c('0x7')](_0x3c9c('0x8'),_0x3c9c('0x9'),_0xc35e75[_0x3c9c('0xa')]);if(_0x143bfe['timers']&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['timer']){_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['updateAcw']();}if(_0x143bfe[_0x3c9c('0xc')][_0x355ef3]){_0x143bfe[_0x3c9c('0xc')][_0x355ef3][_0x3c9c('0xd')]({'statePause':_0xc35e75[_0x3c9c('0xe')]?!![]:![]});}_0x2eb946({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x50cf96){var _0x4a60d9=this;return new Promise(function(_0x857b1f,_0x59bbc6){if(ami['isConnected']()==![]){return _0x59bbc6(_0x4a60d9['error'](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x50cf96=_[_0x3c9c('0x13')](_0x50cf96,_['keys'](properties[_0x3c9c('0x14')]));_0x50cf96['action']='Reload';return ami['Action'](_0x50cf96)[_0x3c9c('0x15')](function(_0x32d94a){_0x857b1f({'code':0xc8,'message':_0x32d94a[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x3e63e0){_0x59bbc6(_0x4a60d9[_0x3c9c('0x18')](0x1f5,_0x3e63e0[_0x3c9c('0x16')]));});});},'Command':function(_0x56fa79){var _0x15a90a=this;return new Promise(function(_0x4c7122,_0x461711){if(ami['isConnected']()==![]){return _0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x56fa79=_['pick'](_0x56fa79,_0x3c9c('0x19'));_0x56fa79[_0x3c9c('0x1a')]=_0x3c9c('0x1b');return ami[_0x3c9c('0x1c')](_0x56fa79)[_0x3c9c('0x15')](function(_0x3bc5c4){_0x4c7122({'code':0xc8,'message':_0x3bc5c4[_0x3c9c('0x1d')]});})[_0x3c9c('0x17')](function(_0x509bf7){_0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f5,_0x509bf7['message']));});});},'VoiceQueues':function(_0x497145){return new Promise(function(_0xe04fca,_0x4ca078){var _0x527bb9=[];for(var _0x379880 in _0x143bfe[_0x3c9c('0x1e')]){if(_0x143bfe[_0x3c9c('0x1e')][_0x3c9c('0x1f')](_0x379880)){var _0x4c283d=_0x143bfe[_0x3c9c('0x1e')][_0x379880];var _0x65b831={'id':_0x4c283d['id'],'name':_0x4c283d['name'],'strategy':_0x4c283d[_0x3c9c('0x20')],'answered':_0x4c283d['answered'],'available':_0x4c283d['available'],'loggedIn':_0x4c283d[_0x3c9c('0x21')],'pTalking':_0x4c283d[_0x3c9c('0x22')],'sumBillable':_0x4c283d[_0x3c9c('0x23')],'sumDuration':_0x4c283d[_0x3c9c('0x24')],'sumHoldTime':_0x4c283d[_0x3c9c('0x25')]||0x0,'talking':_0x4c283d['talking'],'total':_0x4c283d[_0x3c9c('0x26')],'type':_0x4c283d['type'],'unmanaged':_0x4c283d[_0x3c9c('0x27')],'abandoned':_0x4c283d[_0x3c9c('0x28')],'waiting':_0x4c283d[_0x3c9c('0x29')],'loggedInDb':_0x4c283d[_0x3c9c('0x2a')]};if(_0x4c283d['type']===_0x3c9c('0x2b')){_0x65b831[_0x3c9c('0x2c')]=_0x4c283d[_0x3c9c('0x2c')];_0x65b831[_0x3c9c('0x2d')]=_0x4c283d[_0x3c9c('0x2d')];_0x65b831[_0x3c9c('0x2e')]=_0x4c283d[_0x3c9c('0x2e')];_0x65b831[_0x3c9c('0x2f')]=_0x4c283d['dialOriginateCallerIdNumber'];_0x65b831[_0x3c9c('0x30')]=_0x4c283d[_0x3c9c('0x30')];_0x65b831[_0x3c9c('0x31')]=_0x4c283d[_0x3c9c('0x31')];_0x65b831[_0x3c9c('0x32')]=_0x4c283d[_0x3c9c('0x32')];_0x65b831[_0x3c9c('0x33')]=_0x4c283d[_0x3c9c('0x33')];_0x65b831[_0x3c9c('0x34')]=_0x4c283d[_0x3c9c('0x34')];_0x65b831[_0x3c9c('0x35')]=_0x4c283d[_0x3c9c('0x35')];_0x65b831[_0x3c9c('0x36')]=_0x4c283d[_0x3c9c('0x36')];_0x65b831['outboundCongestionCallsDay']=_0x4c283d[_0x3c9c('0x37')];_0x65b831[_0x3c9c('0x38')]=_0x4c283d[_0x3c9c('0x38')];_0x65b831['outboundDropCallsDayCallersExit']=_0x4c283d[_0x3c9c('0x39')];_0x65b831[_0x3c9c('0x3a')]=_0x4c283d[_0x3c9c('0x3a')];_0x65b831[_0x3c9c('0x3b')]=_0x4c283d['outboundNoAnswerCallsDay'];_0x65b831['outboundNoSuchCallsDay']=_0x4c283d[_0x3c9c('0x3c')];_0x65b831[_0x3c9c('0x3d')]=_0x4c283d[_0x3c9c('0x3d')];_0x65b831['outboundReCallsDay']=_0x4c283d['outboundReCallsDay'];_0x65b831[_0x3c9c('0x3e')]=_0x4c283d['outboundRejectCallsDay'];_0x65b831['outboundUnknownCallsDay']=_0x4c283d[_0x3c9c('0x3f')];_0x65b831[_0x3c9c('0x40')]=_0x4c283d[_0x3c9c('0x40')];_0x65b831['predictiveIntervalAvgHoldtime']=_0x4c283d[_0x3c9c('0x41')];_0x65b831[_0x3c9c('0x42')]=_0x4c283d[_0x3c9c('0x42')];_0x65b831['predictiveIntervalDroppedCallsCallersExit']=_0x4c283d['predictiveIntervalDroppedCallsCallersExit'];_0x65b831['predictiveIntervalDroppedCallsTimeout']=_0x4c283d[_0x3c9c('0x43')];_0x65b831[_0x3c9c('0x44')]=_0x4c283d[_0x3c9c('0x44')];_0x65b831[_0x3c9c('0x45')]=_0x4c283d[_0x3c9c('0x45')];_0x65b831[_0x3c9c('0x46')]=_0x4c283d['predictiveIntervalHitRate'];_0x65b831['predictiveIntervalMultiplicativeFactor']=_0x4c283d[_0x3c9c('0x47')];_0x65b831[_0x3c9c('0x48')]=_0x4c283d[_0x3c9c('0x48')];_0x65b831['predictiveIntervalAvailable']=_0x4c283d[_0x3c9c('0x49')];_0x65b831[_0x3c9c('0x4a')]=_0x4c283d[_0x3c9c('0x4a')];_0x65b831['message']=_0x4c283d['message'];_0x65b831[_0x3c9c('0x4b')]=_0x4c283d[_0x3c9c('0x4b')];_0x65b831[_0x3c9c('0x4c')]=_0x4c283d['erlangCalls'];_0x65b831[_0x3c9c('0x4d')]=_0x4c283d[_0x3c9c('0x4d')];_0x65b831[_0x3c9c('0x4e')]=_0x4c283d[_0x3c9c('0x4e')];_0x65b831['erlangBusyFactor']=_0x4c283d[_0x3c9c('0x4f')];_0x65b831[_0x3c9c('0x50')]=_0x4c283d['startPredictive'];_0x65b831['startProgressive']=_0x4c283d[_0x3c9c('0x51')];}if(_0x4c283d[_0x3c9c('0x52')]){_0x65b831['Trunk']={'id':_0x4c283d[_0x3c9c('0x52')]['id'],'name':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0xa')],'active':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0x53')],'callerid':_0x4c283d[_0x3c9c('0x52')]['callerid']};}if(_0x4c283d[_0x3c9c('0x54')]){_0x65b831[_0x3c9c('0x54')]={'id':_0x4c283d[_0x3c9c('0x54')]['id'],'name':_0x4c283d[_0x3c9c('0x54')][_0x3c9c('0xa')]};}_0x527bb9['push'](_0x65b831);}}_0xe04fca({'count':_0x527bb9['length'],'rows':_0x527bb9});});},'UpdateVoiceQueue':function(_0x55a6ba){return new Promise(function(_0x3ff47a,_0x1da3e7){var _0x25285d=_[_0x3c9c('0x55')](_0x143bfe['voiceQueues'],{'id':parseInt(_0x55a6ba['id'])});var _0x798651=_[_0x3c9c('0x56')](_0x55a6ba,['id']);if(_0x25285d){for(var _0x27a013 in _0x798651){if(typeof _0x798651[_0x27a013]!==_0x3c9c('0x57')&&typeof _0x25285d[_0x27a013]!==_0x3c9c('0x57')){_0x25285d[_0x27a013]=_0x798651[_0x27a013];}}_0x3ff47a(_0x25285d);}else{_0x1da3e7();}});},'VoiceChannels':function(_0x58f6b7){return new Promise(function(_0x184c22,_0x1177b3){var _0x1804e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x59')]);_0x184c22({'count':_0x1804e3[_0x3c9c('0x5a')],'rows':_0x1804e3});});},'VoiceChannelMixMonitor':function(_0x475fd6){var _0x5a74ce=this;return new Promise(function(_0x260d3b,_0x3a59f9){if(ami[_0x3c9c('0x5b')]()==![]){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}var _0x2b0691=schema(properties[_0x3c9c('0x5c')])[_0x3c9c('0x5d')](_0x475fd6);if(_0x2b0691[_0x3c9c('0x5a')]>0x0){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x2b0691,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x39b9d8=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x475fd6[_0x3c9c('0x5f')]});if(_0x39b9d8&&_0x39b9d8[_0x3c9c('0x60')]){var _0x2b022f=util['format']('%s.%s',_0x475fd6['filename']||_0x475fd6[_0x3c9c('0x5f')],_0x475fd6[_0x3c9c('0x7')]||_0x3c9c('0x61'));return ami[_0x3c9c('0x1c')]({'action':'MixMonitor','channel':_0x39b9d8[_0x3c9c('0x60')],'file':_0x2b022f,'options':'ai(mixmonitorid)'})['then'](function(_0x34cd84){var _0x2849c6=_[_0x3c9c('0x55')](_0x39b9d8[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x2b022f[_0x3c9c('0x64')]()});if(_[_0x3c9c('0x65')](_0x2849c6)){_0x39b9d8[_0x3c9c('0x62')][_0x3c9c('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2b022f[_0x3c9c('0x64')](),'createdAt':moment()[_0x3c9c('0x7')](_0x3c9c('0x67')),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')],'status':_0x3c9c('0x69')});}else{_0x2849c6[_0x3c9c('0x68')]=_0x34cd84[_0x3c9c('0x68')];_0x2849c6['status']='rec';}_0x260d3b({'code':0xc8,'message':[_0x475fd6[_0x3c9c('0x5f')],_0x3c9c('0x6a'),_0x34cd84[_0x3c9c('0x68')]][_0x3c9c('0x12')]('\x20'),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')]});})[_0x3c9c('0x17')](function(_0x287ca1){_0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,[_0x475fd6[_0x3c9c('0x5f')],_0x287ca1[_0x3c9c('0x16')][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x581523){var _0x423891=this;return new Promise(function(_0x4306fe,_0x1b6f0a){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,[config['asterisk']['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected']['join']('\x20')));}var _0x1d810d=schema(properties[_0x3c9c('0x5c')])['validate'](_0x581523);if(_0x1d810d[_0x3c9c('0x5a')]>0x0){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x1d810d,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x2264b7=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x581523[_0x3c9c('0x5f')]});if(_0x2264b7){return BPromise[_0x3c9c('0x6c')]()[_0x3c9c('0x15')](function(){if(_0x2264b7['channel']){return ami[_0x3c9c('0x1c')]({'action':'StopMixMonitor','channel':_0x2264b7['channel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x1a1485){});}})[_0x3c9c('0x15')](function(){if(_0x2264b7[_0x3c9c('0x6d')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x6e'),'channel':_0x2264b7['destinationchannel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x31fb57){});}})[_0x3c9c('0x15')](function(_0x1cfaea){var _0x4fb887=_['find'](_0x2264b7[_0x3c9c('0x62')],{'mixmonitorid':_0x581523[_0x3c9c('0x68')]});if(_0x4fb887){_0x4fb887[_0x3c9c('0x6f')]=_0x3c9c('0x70');}})[_0x3c9c('0x15')](function(){var _0x990934=util[_0x3c9c('0x7')](_0x3c9c('0x71'),_0x581523[_0x3c9c('0x72')]||_0x581523[_0x3c9c('0x5f')],_0x581523[_0x3c9c('0x7')]||_0x3c9c('0x61'));var _0x4311c0=_[_0x3c9c('0x55')](_0x2264b7[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x990934[_0x3c9c('0x64')]()});if(_0x4311c0){_0x4311c0['status']=_0x3c9c('0x70');}})['then'](function(){_0x4306fe({'code':0xc8,'message':[_0x581523['uniqueid'],_0x3c9c('0x73')][_0x3c9c('0x12')]('\x20')});})[_0x3c9c('0x17')](function(_0x4b1b16){_0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f5,[_0x581523[_0x3c9c('0x5f')],_0x4b1b16['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x1b6f0a(_0x423891['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5e4146){return new Promise(function(_0x1e93d7,_0x2fc65b){var _0xbc5b78=_[_0x3c9c('0x58')](_0x143bfe['queueChannels']);_0x1e93d7({'count':_0xbc5b78['length'],'rows':_0xbc5b78});});},'VoiceQueuesChannel':function(_0x2f2628){var _0x2dc609=this;return new Promise(function(_0x260a90,_0x94bc44){var _0x4342a9=schema(properties[_0x3c9c('0x74')])[_0x3c9c('0x5d')](_0x2f2628);if(_0x4342a9[_0x3c9c('0x5a')]>0x0){return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f4,_['map'](_0x4342a9,'message')[_0x3c9c('0x12')](',\x20')));}var _0x5cf82a=_['find'](_0x143bfe['queueChannels'],{'uniqueid':_0x2f2628[_0x3c9c('0x5f')]});if(_0x5cf82a){_0x260a90(_0x5cf82a);}else{return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x56effa){var _0x53ccaf=this;return new Promise(function(_0x482612,_0x77afb5){if(ami['isConnected']()==![]){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x5ca292=schema(properties[_0x3c9c('0x75')])[_0x3c9c('0x5d')](_0x56effa);if(_0x5ca292[_0x3c9c('0x5a')]>0x0){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,_['map'](_0x5ca292,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x5c1a13=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x76')],{'uniqueid':_0x56effa['uniqueid']});if(_0x5c1a13&&_0x5c1a13[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':'Hangup','channel':_0x5c1a13[_0x3c9c('0x60')]})[_0x3c9c('0x15')](function(_0xab562a){_0x482612({'code':0xc8,'message':[_0x56effa['uniqueid'],_0xab562a['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')});})['catch'](function(_0x386197){_0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f5,[_0x56effa[_0x3c9c('0x5f')],_0x386197['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x77afb5(_0x53ccaf['error'](0x1f5,_0x3c9c('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x2cb21d){var _0xc4b7c9=this;return new Promise(function(_0x3caddb,_0x1ecabd){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x150a27=schema(properties['voicequeuechannelredirect'])[_0x3c9c('0x5d')](_0x2cb21d);if(_0x150a27[_0x3c9c('0x5a')]>0x0){return _0x1ecabd(_0xc4b7c9['error'](0x1f4,_[_0x3c9c('0x5e')](_0x150a27,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x17d23e=_[_0x3c9c('0x55')](_0x143bfe['queueChannels'],{'uniqueid':_0x2cb21d[_0x3c9c('0x5f')]});if(_0x17d23e&&_0x17d23e[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x77'),'channel':_0x17d23e[_0x3c9c('0x60')],'exten':_0x2cb21d[_0x3c9c('0x78')],'context':_0x2cb21d[_0x3c9c('0x79')]||_0x17d23e[_0x3c9c('0x79')],'priority':0x1})[_0x3c9c('0x15')](function(_0x36018f){_0x3caddb({'code':0xc8,'message':[_0x2cb21d[_0x3c9c('0x5f')],_0x36018f[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')});})[_0x3c9c('0x17')](function(_0x296e46){_0x1ecabd(_0xc4b7c9['error'](0x1f5,[_0x2cb21d[_0x3c9c('0x5f')],_0x296e46[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')));});}else{return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'Agents':function(_0x21c7c3){return new Promise(function(_0x285ebc,_0x478572){var _0x773eea=_['values'](_0x143bfe[_0x3c9c('0xc')]);_0x285ebc({'count':_0x773eea['length'],'rows':_0x773eea});});},'Telephones':function(_0x2265e8){return new Promise(function(_0x48a57f,_0x4950c3){var _0x263270=_['values'](_0x143bfe['telephones']);_0x48a57f({'count':_0x263270[_0x3c9c('0x5a')],'rows':_0x263270});});},'Trunks':function(_0x2f3a98){return new Promise(function(_0x14ccbc,_0x9b3118){var _0x2f4e79=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x7a')]);_0x14ccbc({'count':_0x2f4e79[_0x3c9c('0x5a')],'rows':_0x2f4e79});});},'OutboundChannels':function(_0x2e6b96){return new Promise(function(_0x13e236,_0x1528a6){var _0x570ae6=_['values'](_0x143bfe[_0x3c9c('0x7b')]);_0x13e236({'count':_0x570ae6['length'],'rows':_0x570ae6});});},'Outbound':function(_0x552ec1){return new Promise(function(_0x3bb0c1,_0x1838d7){_0x3bb0c1(_0x143bfe[_0x3c9c('0x2b')]);});},'Campaigns':function(_0x1748c7){return new Promise(function(_0x2dec50,_0x57746d){var _0x105e67=_[_0x3c9c('0x58')](_0x143bfe['campaigns']);_0x2dec50({'count':_0x105e67['length'],'rows':_0x105e67});});},'VoiceQueuesPreview':function(_0x308a24){var _0x5f42c1=this;return new Promise(function(_0x2e3cab,_0x1ceaa3){_0x512e80[_0x3c9c('0x7c')](_0x308a24['id'])[_0x3c9c('0x15')](function(_0x327e63){_0x2e3cab({'code':0xc8,'message':_0x327e63[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x18012e){_0x1ceaa3(_0x5f42c1[_0x3c9c('0x18')](0x1f4,_0x18012e[_0x3c9c('0x16')]));});});},'EventManager':function(_0x52af3a){var _0x32690f=this;return new Promise(function(_0x2f5738,_0xf6f1ea){if(!_0x52af3a[_0x3c9c('0x7d')]){return _0xf6f1ea(_0x32690f['error'](0x1f4,_0x3c9c('0x7e')));}ami['emit'](_0x3c9c('0x7f')+_0x52af3a[_0x3c9c('0x7d')],_0x52af3a['message']);_0x2f5738({'code':0xc8,'message':_0x52af3a});});},'FaxAccounts':function(_0x22d2bd){return new Promise(function(_0x4cd7b9,_0x49559f){var _0x3d34e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x80')]);_0x4cd7b9({'count':_0x3d34e3[_0x3c9c('0x5a')],'rows':_0x3d34e3});});},'SendFax':function(_0x17e5ce){var _0x5c96ad=this;return new Promise(function(_0x3e2f73,_0x48c11d){_0x48b219[_0x3c9c('0x81')](_0x17e5ce)['then'](function(_0x12bb7b){_0x3e2f73({'code':0xc8,'message':_0x12bb7b[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x19db8a){_0x48c11d(_0x5c96ad[_0x3c9c('0x18')](0x1f4,_0x19db8a[_0x3c9c('0x16')]));});});},'CheckAfterSend':function(_0x1fe080){var _0x41c07b=this;return new Promise(function(_0x557dc6,_0xa1de30){_0x48b219[_0x3c9c('0x82')](_0x1fe080)[_0x3c9c('0x15')](function(_0x5614df){_0x557dc6({'code':0xc8,'message':_0x5614df[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x37d2b6){_0xa1de30(_0x41c07b[_0x3c9c('0x18')](0x1f4,_0x37d2b6[_0x3c9c('0x16')]));});});}};var _0xdfe4f7=jayson['server'](_0x3ca0ce)[_0x3c9c('0x83')]();_0xdfe4f7['on'](_0x3c9c('0x18'),function(_0x2e158c){return _0x5a2836(_0x2e158c);});_0xdfe4f7[_0x3c9c('0x6')](0x232a,'127.0.0.1',function(){console[_0x3c9c('0x84')](_0x3c9c('0x85'),0x232a);return _0x5c86bd(_0x3c9c('0x86')+0x232a);});});}; \ No newline at end of file +var _0x90ec=['undefined','values','channels','voicechannel','map','channel','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','Redirect','exten','context','agents','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','action','Action','then','message','catch','join','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','length','find','omit'];(function(_0x338411,_0x17c0a1){var _0x553fba=function(_0x177d4c){while(--_0x177d4c){_0x338411['push'](_0x338411['shift']());}};_0x553fba(++_0x17c0a1);}(_0x90ec,0x1d4));var _0xc90e=function(_0x4c97d4,_0x19c6d2){_0x4c97d4=_0x4c97d4-0x0;var _0x3be2e1=_0x90ec[_0x4c97d4];return _0x3be2e1;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var jayson=require('jayson/promise');var schema=require(_0xc90e('0x2'));var BPromise=require(_0xc90e('0x3'));var moment=require(_0xc90e('0x4'));var config=require(_0xc90e('0x5'));var properties=require(_0xc90e('0x6'));var ami=require('../ami');exports[_0xc90e('0x7')]=function(_0x207b98,_0x206583,_0x54a0a8){return new BPromise(function(_0x259c62,_0x48bea9){var _0x42051a={'QueuePause':function(_0x14311a){return new Promise(function(_0x48253c,_0x3bc98f){var _0xd539f6=util[_0xc90e('0x8')](_0xc90e('0x9'),_0xc90e('0xa'),_0x14311a[_0xc90e('0xb')]);if(_0x207b98[_0xc90e('0xc')]&&_0x207b98[_0xc90e('0xc')][_0xd539f6]&&_0x207b98[_0xc90e('0xc')][_0xd539f6]['timer']){_0x207b98[_0xc90e('0xc')][_0xd539f6]['updateAcw']();}if(_0x207b98['agents'][_0xd539f6]){_0x207b98['agents'][_0xd539f6]['updateStatusRealtime']({'statePause':_0x14311a[_0xc90e('0xd')]?!![]:![]});}_0x48253c({'code':0xc8,'message':_0xc90e('0xe')});});},'Reload':function(_0x5cef50){var _0x37321a=this;return new Promise(function(_0x98aa2b,_0x52beef){if(ami[_0xc90e('0xf')]()==![]){return _0x52beef(_0x37321a[_0xc90e('0x10')](0x1f4,[config[_0xc90e('0x11')]['ip'],config[_0xc90e('0x11')][_0xc90e('0x12')],_0xc90e('0x13')]['join']('\x20')));}_0x5cef50=_[_0xc90e('0x14')](_0x5cef50,_[_0xc90e('0x15')](properties['module']));_0x5cef50[_0xc90e('0x16')]='Reload';return ami[_0xc90e('0x17')](_0x5cef50)[_0xc90e('0x18')](function(_0x558b22){_0x98aa2b({'code':0xc8,'message':_0x558b22[_0xc90e('0x19')]});})[_0xc90e('0x1a')](function(_0x17ec6b){_0x52beef(_0x37321a['error'](0x1f5,_0x17ec6b['message']));});});},'Command':function(_0x486725){var _0x161a3a=this;return new Promise(function(_0x147120,_0x25b1d7){if(ami[_0xc90e('0xf')]()==![]){return _0x25b1d7(_0x161a3a[_0xc90e('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xc90e('0x11')]['username'],_0xc90e('0x13')][_0xc90e('0x1b')]('\x20')));}_0x486725=_['pick'](_0x486725,_0xc90e('0x1c'));_0x486725[_0xc90e('0x16')]=_0xc90e('0x1d');return ami[_0xc90e('0x17')](_0x486725)[_0xc90e('0x18')](function(_0x282c53){_0x147120({'code':0xc8,'message':_0x282c53[_0xc90e('0x1e')]});})[_0xc90e('0x1a')](function(_0x1cff73){_0x25b1d7(_0x161a3a['error'](0x1f5,_0x1cff73[_0xc90e('0x19')]));});});},'VoiceQueues':function(_0x41deea){return new Promise(function(_0x25223e,_0x380f3f){var _0x3371aa=[];for(var _0x59d731 in _0x207b98[_0xc90e('0x1f')]){if(_0x207b98[_0xc90e('0x1f')][_0xc90e('0x20')](_0x59d731)){var _0x4fde04=_0x207b98[_0xc90e('0x1f')][_0x59d731];var _0x2ea6e6={'id':_0x4fde04['id'],'name':_0x4fde04[_0xc90e('0xb')],'strategy':_0x4fde04[_0xc90e('0x21')],'answered':_0x4fde04[_0xc90e('0x22')],'available':_0x4fde04[_0xc90e('0x23')],'loggedIn':_0x4fde04['loggedIn'],'pTalking':_0x4fde04['pTalking'],'sumBillable':_0x4fde04[_0xc90e('0x24')],'sumDuration':_0x4fde04['sumDuration'],'sumHoldTime':_0x4fde04[_0xc90e('0x25')]||0x0,'talking':_0x4fde04[_0xc90e('0x26')],'total':_0x4fde04[_0xc90e('0x27')],'type':_0x4fde04[_0xc90e('0x28')],'unmanaged':_0x4fde04[_0xc90e('0x29')],'abandoned':_0x4fde04[_0xc90e('0x2a')],'waiting':_0x4fde04[_0xc90e('0x2b')],'loggedInDb':_0x4fde04['loggedInDb']};if(_0x4fde04[_0xc90e('0x28')]===_0xc90e('0x2c')){_0x2ea6e6['dialActive']=_0x4fde04[_0xc90e('0x2d')];_0x2ea6e6['dialMethod']=_0x4fde04[_0xc90e('0x2e')];_0x2ea6e6[_0xc90e('0x2f')]=_0x4fde04[_0xc90e('0x2f')];_0x2ea6e6[_0xc90e('0x30')]=_0x4fde04[_0xc90e('0x30')];_0x2ea6e6[_0xc90e('0x31')]=_0x4fde04[_0xc90e('0x31')];_0x2ea6e6[_0xc90e('0x32')]=_0x4fde04[_0xc90e('0x32')];_0x2ea6e6['temp']=_0x4fde04['temp'];_0x2ea6e6[_0xc90e('0x33')]=_0x4fde04[_0xc90e('0x33')];_0x2ea6e6[_0xc90e('0x34')]=_0x4fde04[_0xc90e('0x34')];_0x2ea6e6[_0xc90e('0x35')]=_0x4fde04[_0xc90e('0x35')];_0x2ea6e6[_0xc90e('0x36')]=_0x4fde04[_0xc90e('0x36')];_0x2ea6e6[_0xc90e('0x37')]=_0x4fde04[_0xc90e('0x37')];_0x2ea6e6['outboundDropCallsDayACS']=_0x4fde04[_0xc90e('0x38')];_0x2ea6e6[_0xc90e('0x39')]=_0x4fde04[_0xc90e('0x39')];_0x2ea6e6[_0xc90e('0x3a')]=_0x4fde04['outboundDropCallsDayTimeout'];_0x2ea6e6['outboundNoAnswerCallsDay']=_0x4fde04['outboundNoAnswerCallsDay'];_0x2ea6e6[_0xc90e('0x3b')]=_0x4fde04[_0xc90e('0x3b')];_0x2ea6e6[_0xc90e('0x3c')]=_0x4fde04[_0xc90e('0x3c')];_0x2ea6e6[_0xc90e('0x3d')]=_0x4fde04['outboundReCallsDay'];_0x2ea6e6[_0xc90e('0x3e')]=_0x4fde04[_0xc90e('0x3e')];_0x2ea6e6[_0xc90e('0x3f')]=_0x4fde04[_0xc90e('0x3f')];_0x2ea6e6[_0xc90e('0x40')]=_0x4fde04[_0xc90e('0x40')];_0x2ea6e6[_0xc90e('0x41')]=_0x4fde04[_0xc90e('0x41')];_0x2ea6e6[_0xc90e('0x42')]=_0x4fde04[_0xc90e('0x42')];_0x2ea6e6[_0xc90e('0x43')]=_0x4fde04[_0xc90e('0x43')];_0x2ea6e6[_0xc90e('0x44')]=_0x4fde04['predictiveIntervalDroppedCallsTimeout'];_0x2ea6e6[_0xc90e('0x45')]=_0x4fde04[_0xc90e('0x45')];_0x2ea6e6['predictiveIntervalErlangCallsDroppedCalls']=_0x4fde04['predictiveIntervalErlangCallsDroppedCalls'];_0x2ea6e6[_0xc90e('0x46')]=_0x4fde04['predictiveIntervalHitRate'];_0x2ea6e6[_0xc90e('0x47')]=_0x4fde04[_0xc90e('0x47')];_0x2ea6e6['predictiveIntervalPauses']=_0x4fde04[_0xc90e('0x48')];_0x2ea6e6['predictiveIntervalAvailable']=_0x4fde04['predictiveIntervalAvailable'];_0x2ea6e6[_0xc90e('0x49')]=_0x4fde04['predictiveIntervalTotalCalls'];_0x2ea6e6['message']=_0x4fde04[_0xc90e('0x19')];_0x2ea6e6[_0xc90e('0x4a')]=_0x4fde04['originated'];_0x2ea6e6[_0xc90e('0x4b')]=_0x4fde04[_0xc90e('0x4b')];_0x2ea6e6[_0xc90e('0x4c')]=_0x4fde04[_0xc90e('0x4c')];_0x2ea6e6[_0xc90e('0x4d')]=_0x4fde04[_0xc90e('0x4d')];_0x2ea6e6[_0xc90e('0x4e')]=_0x4fde04[_0xc90e('0x4e')];_0x2ea6e6['startPredictive']=_0x4fde04[_0xc90e('0x4f')];_0x2ea6e6['startProgressive']=_0x4fde04['startProgressive'];}if(_0x4fde04[_0xc90e('0x50')]){_0x2ea6e6['Trunk']={'id':_0x4fde04[_0xc90e('0x50')]['id'],'name':_0x4fde04['Trunk'][_0xc90e('0xb')],'active':_0x4fde04[_0xc90e('0x50')][_0xc90e('0x51')],'callerid':_0x4fde04[_0xc90e('0x50')][_0xc90e('0x52')]};}if(_0x4fde04[_0xc90e('0x53')]){_0x2ea6e6[_0xc90e('0x53')]={'id':_0x4fde04[_0xc90e('0x53')]['id'],'name':_0x4fde04[_0xc90e('0x53')]['name']};}_0x3371aa[_0xc90e('0x54')](_0x2ea6e6);}}_0x25223e({'count':_0x3371aa[_0xc90e('0x55')],'rows':_0x3371aa});});},'UpdateVoiceQueue':function(_0x317aa7){return new Promise(function(_0x24d0ca,_0x5dd284){var _0x21408a=_[_0xc90e('0x56')](_0x207b98[_0xc90e('0x1f')],{'id':parseInt(_0x317aa7['id'])});var _0x48cb44=_[_0xc90e('0x57')](_0x317aa7,['id']);if(_0x21408a){for(var _0x49c8ab in _0x48cb44){if(typeof _0x48cb44[_0x49c8ab]!==_0xc90e('0x58')&&typeof _0x21408a[_0x49c8ab]!=='undefined'){_0x21408a[_0x49c8ab]=_0x48cb44[_0x49c8ab];}}_0x24d0ca(_0x21408a);}else{_0x5dd284();}});},'VoiceChannels':function(_0x130263){return new Promise(function(_0x55e36b,_0x18cd72){var _0x45c1e0=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x5a')]);_0x55e36b({'count':_0x45c1e0[_0xc90e('0x55')],'rows':_0x45c1e0});});},'VoiceChannelMixMonitor':function(_0x35f401){var _0x1ebe62=this;return new Promise(function(_0x1d7f6a,_0x53957d){if(ami[_0xc90e('0xf')]()==![]){return _0x53957d(_0x1ebe62[_0xc90e('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xc90e('0x12')],'ami\x20disconnected'][_0xc90e('0x1b')]('\x20')));}var _0x3ae820=schema(properties[_0xc90e('0x5b')])[_0xc90e('0x2')](_0x35f401);if(_0x3ae820[_0xc90e('0x55')]>0x0){return _0x53957d(_0x1ebe62['error'](0x1f4,_[_0xc90e('0x5c')](_0x3ae820,_0xc90e('0x19'))['join'](',\x20')));}var _0x2f6d54=_['find'](_0x207b98[_0xc90e('0x5a')],{'uniqueid':_0x35f401['uniqueid']});if(_0x2f6d54&&_0x2f6d54[_0xc90e('0x5d')]){var _0x1d8bd0=util[_0xc90e('0x8')](_0xc90e('0x5e'),_0x35f401[_0xc90e('0x5f')]||_0x35f401[_0xc90e('0x60')],_0x35f401[_0xc90e('0x8')]||_0xc90e('0x61'));return ami[_0xc90e('0x17')]({'action':_0xc90e('0x62'),'channel':_0x2f6d54[_0xc90e('0x5d')],'file':_0x1d8bd0,'options':_0xc90e('0x63')})[_0xc90e('0x18')](function(_0x6d0a9d){var _0x358568=_[_0xc90e('0x56')](_0x2f6d54['monitors'],{'filename':_0xc90e('0x64')+_0x1d8bd0[_0xc90e('0x65')]()});if(_[_0xc90e('0x66')](_0x358568)){_0x2f6d54[_0xc90e('0x67')][_0xc90e('0x54')]({'filename':_0xc90e('0x64')+_0x1d8bd0[_0xc90e('0x65')](),'createdAt':moment()['format'](_0xc90e('0x68')),'mixmonitorid':_0x6d0a9d['mixmonitorid'],'status':_0xc90e('0x69')});}else{_0x358568[_0xc90e('0x6a')]=_0x6d0a9d[_0xc90e('0x6a')];_0x358568[_0xc90e('0x6b')]=_0xc90e('0x69');}_0x1d7f6a({'code':0xc8,'message':[_0x35f401['uniqueid'],_0xc90e('0x6c'),_0x6d0a9d[_0xc90e('0x6a')]]['join']('\x20'),'mixmonitorid':_0x6d0a9d[_0xc90e('0x6a')]});})[_0xc90e('0x1a')](function(_0x288571){_0x53957d(_0x1ebe62[_0xc90e('0x10')](0x1f5,[_0x35f401['uniqueid'],_0x288571['message'][_0xc90e('0x65')]()][_0xc90e('0x1b')]('\x20')));});}else{return _0x53957d(_0x1ebe62[_0xc90e('0x10')](0x1f5,_0xc90e('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x2cc917){var _0x4c44ea=this;return new Promise(function(_0x3e8c0d,_0x40b61e){if(ami['isConnected']()==![]){return _0x40b61e(_0x4c44ea['error'](0x1f4,[config[_0xc90e('0x11')]['ip'],config[_0xc90e('0x11')][_0xc90e('0x12')],_0xc90e('0x13')]['join']('\x20')));}var _0x33cd37=schema(properties[_0xc90e('0x5b')])[_0xc90e('0x2')](_0x2cc917);if(_0x33cd37[_0xc90e('0x55')]>0x0){return _0x40b61e(_0x4c44ea[_0xc90e('0x10')](0x1f4,_[_0xc90e('0x5c')](_0x33cd37,_0xc90e('0x19'))[_0xc90e('0x1b')](',\x20')));}var _0x57db5e=_[_0xc90e('0x56')](_0x207b98[_0xc90e('0x5a')],{'uniqueid':_0x2cc917[_0xc90e('0x60')]});if(_0x57db5e){return BPromise[_0xc90e('0x6e')]()[_0xc90e('0x18')](function(){if(_0x57db5e['channel']){return ami[_0xc90e('0x17')]({'action':_0xc90e('0x6f'),'channel':_0x57db5e[_0xc90e('0x5d')],'mixmonitorid':_0x2cc917['mixmonitorid']})['catch'](function(_0x31bca6){});}})['then'](function(){if(_0x57db5e[_0xc90e('0x70')]){return ami['Action']({'action':_0xc90e('0x6f'),'channel':_0x57db5e[_0xc90e('0x70')],'mixmonitorid':_0x2cc917[_0xc90e('0x6a')]})[_0xc90e('0x1a')](function(_0x10d31b){});}})[_0xc90e('0x18')](function(_0xb44c95){var _0x5db362=_[_0xc90e('0x56')](_0x57db5e[_0xc90e('0x67')],{'mixmonitorid':_0x2cc917[_0xc90e('0x6a')]});if(_0x5db362){_0x5db362[_0xc90e('0x6b')]='stop';}})[_0xc90e('0x18')](function(){var _0x511e33=util['format']('%s.%s',_0x2cc917['filename']||_0x2cc917[_0xc90e('0x60')],_0x2cc917[_0xc90e('0x8')]||'wav');var _0x5c6240=_[_0xc90e('0x56')](_0x57db5e[_0xc90e('0x67')],{'filename':_0xc90e('0x64')+_0x511e33[_0xc90e('0x65')]()});if(_0x5c6240){_0x5c6240[_0xc90e('0x6b')]='stop';}})[_0xc90e('0x18')](function(){_0x3e8c0d({'code':0xc8,'message':[_0x2cc917[_0xc90e('0x60')],_0xc90e('0x71')][_0xc90e('0x1b')]('\x20')});})[_0xc90e('0x1a')](function(_0x4783fb){_0x40b61e(_0x4c44ea['error'](0x1f5,[_0x2cc917[_0xc90e('0x60')],_0x4783fb['message'][_0xc90e('0x65')]()]['join']('\x20')));});}else{return _0x40b61e(_0x4c44ea['error'](0x1f5,_0xc90e('0x6d')));}});},'VoiceQueuesChannels':function(_0x2b02f1){return new Promise(function(_0x51f714,_0x441879){var _0x59765e=_['values'](_0x207b98['queueChannels']);_0x51f714({'count':_0x59765e['length'],'rows':_0x59765e});});},'VoiceQueuesChannel':function(_0xa26ec4){var _0x1ac648=this;return new Promise(function(_0x5a3fc6,_0x104288){var _0x115f53=schema(properties[_0xc90e('0x72')])[_0xc90e('0x2')](_0xa26ec4);if(_0x115f53[_0xc90e('0x55')]>0x0){return _0x104288(_0x1ac648[_0xc90e('0x10')](0x1f4,_[_0xc90e('0x5c')](_0x115f53,'message')[_0xc90e('0x1b')](',\x20')));}var _0x3e88de=_['find'](_0x207b98['queueChannels'],{'uniqueid':_0xa26ec4[_0xc90e('0x60')]});if(_0x3e88de){_0x5a3fc6(_0x3e88de);}else{return _0x104288(_0x1ac648['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x1df4de){var _0x3f44f0=this;return new Promise(function(_0x3fa878,_0x16a95f){if(ami[_0xc90e('0xf')]()==![]){return _0x16a95f(_0x3f44f0[_0xc90e('0x10')](0x1f4,[config[_0xc90e('0x11')]['ip'],config['asterisk'][_0xc90e('0x12')],_0xc90e('0x13')]['join']('\x20')));}var _0x29619f=schema(properties[_0xc90e('0x73')])[_0xc90e('0x2')](_0x1df4de);if(_0x29619f['length']>0x0){return _0x16a95f(_0x3f44f0['error'](0x1f4,_[_0xc90e('0x5c')](_0x29619f,'message')[_0xc90e('0x1b')](',\x20')));}var _0x2f86a6=_[_0xc90e('0x56')](_0x207b98[_0xc90e('0x74')],{'uniqueid':_0x1df4de['uniqueid']});if(_0x2f86a6&&_0x2f86a6[_0xc90e('0x5d')]){return ami[_0xc90e('0x17')]({'action':_0xc90e('0x75'),'channel':_0x2f86a6[_0xc90e('0x5d')]})['then'](function(_0x12a7cd){_0x3fa878({'code':0xc8,'message':[_0x1df4de['uniqueid'],_0x12a7cd[_0xc90e('0x19')][_0xc90e('0x65')]()][_0xc90e('0x1b')]('\x20')});})[_0xc90e('0x1a')](function(_0x264b7f){_0x16a95f(_0x3f44f0['error'](0x1f5,[_0x1df4de[_0xc90e('0x60')],_0x264b7f[_0xc90e('0x19')]['toLowerCase']()][_0xc90e('0x1b')]('\x20')));});}else{return _0x16a95f(_0x3f44f0[_0xc90e('0x10')](0x1f5,_0xc90e('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x387964){var _0x306002=this;return new Promise(function(_0x2915bf,_0x4b5843){if(ami['isConnected']()==![]){return _0x4b5843(_0x306002[_0xc90e('0x10')](0x1f4,[config[_0xc90e('0x11')]['ip'],config[_0xc90e('0x11')][_0xc90e('0x12')],'ami\x20disconnected'][_0xc90e('0x1b')]('\x20')));}var _0x5a3b0f=schema(properties['voicequeuechannelredirect'])[_0xc90e('0x2')](_0x387964);if(_0x5a3b0f[_0xc90e('0x55')]>0x0){return _0x4b5843(_0x306002[_0xc90e('0x10')](0x1f4,_['map'](_0x5a3b0f,_0xc90e('0x19'))[_0xc90e('0x1b')](',\x20')));}var _0xcbdef4=_[_0xc90e('0x56')](_0x207b98[_0xc90e('0x74')],{'uniqueid':_0x387964['uniqueid']});if(_0xcbdef4&&_0xcbdef4[_0xc90e('0x5d')]){return ami[_0xc90e('0x17')]({'action':_0xc90e('0x76'),'channel':_0xcbdef4[_0xc90e('0x5d')],'exten':_0x387964[_0xc90e('0x77')],'context':_0x387964['context']||_0xcbdef4[_0xc90e('0x78')],'priority':0x1})[_0xc90e('0x18')](function(_0x3926e3){_0x2915bf({'code':0xc8,'message':[_0x387964[_0xc90e('0x60')],_0x3926e3['message'][_0xc90e('0x65')]()][_0xc90e('0x1b')]('\x20')});})[_0xc90e('0x1a')](function(_0x7dd466){_0x4b5843(_0x306002['error'](0x1f5,[_0x387964[_0xc90e('0x60')],_0x7dd466[_0xc90e('0x19')][_0xc90e('0x65')]()][_0xc90e('0x1b')]('\x20')));});}else{return _0x4b5843(_0x306002['error'](0x1f5,_0xc90e('0x6d')));}});},'Agents':function(_0x5c844d){return new Promise(function(_0x466275,_0xa83990){var _0x58f17d=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x79')]);_0x466275({'count':_0x58f17d[_0xc90e('0x55')],'rows':_0x58f17d});});},'Telephones':function(_0x474b17){return new Promise(function(_0x169cf2,_0x51c8c5){var _0x1054dc=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x7a')]);_0x169cf2({'count':_0x1054dc[_0xc90e('0x55')],'rows':_0x1054dc});});},'Trunks':function(_0x32e063){return new Promise(function(_0x9ac7e9,_0x1e3aba){var _0x20adcb=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x7b')]);_0x9ac7e9({'count':_0x20adcb[_0xc90e('0x55')],'rows':_0x20adcb});});},'OutboundChannels':function(_0x5a1a79){return new Promise(function(_0x103a51,_0x1019dd){var _0x546b39=_['values'](_0x207b98[_0xc90e('0x7c')]);_0x103a51({'count':_0x546b39[_0xc90e('0x55')],'rows':_0x546b39});});},'Outbound':function(_0x4bc529){return new Promise(function(_0x5743ec,_0x49bee2){_0x5743ec(_0x207b98['outbound']);});},'Campaigns':function(_0x5f2c65){return new Promise(function(_0x1eb1b9,_0x5ba415){var _0x34ee10=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x7d')]);_0x1eb1b9({'count':_0x34ee10['length'],'rows':_0x34ee10});});},'VoiceQueuesPreview':function(_0x4fbb50){var _0x3e1e4a=this;return new Promise(function(_0x58df42,_0x2a792c){_0x206583[_0xc90e('0x7e')](_0x4fbb50['id'])[_0xc90e('0x18')](function(_0x4bad23){_0x58df42({'code':0xc8,'message':_0x4bad23[_0xc90e('0x19')]});})[_0xc90e('0x1a')](function(_0x3810fe){_0x2a792c(_0x3e1e4a['error'](0x1f4,_0x3810fe[_0xc90e('0x19')]));});});},'EventManager':function(_0x3b2c01){var _0x46e954=this;return new Promise(function(_0x5b49fe,_0x328a92){if(!_0x3b2c01['event']){return _0x328a92(_0x46e954['error'](0x1f4,_0xc90e('0x7f')));}ami[_0xc90e('0x80')](_0xc90e('0x81')+_0x3b2c01[_0xc90e('0x82')],_0x3b2c01[_0xc90e('0x19')]);_0x5b49fe({'code':0xc8,'message':_0x3b2c01});});},'FaxAccounts':function(_0x347673){return new Promise(function(_0x247c1c,_0x322f90){var _0x1800ae=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x83')]);_0x247c1c({'count':_0x1800ae['length'],'rows':_0x1800ae});});},'SendFax':function(_0x2c01f5){var _0x5c12e2=this;return new Promise(function(_0x2e8d6a,_0x19de29){_0x54a0a8[_0xc90e('0x84')](_0x2c01f5)['then'](function(_0x1ca398){_0x2e8d6a({'code':0xc8,'message':_0x1ca398[_0xc90e('0x19')]});})[_0xc90e('0x1a')](function(_0x349040){_0x19de29(_0x5c12e2[_0xc90e('0x10')](0x1f4,_0x349040[_0xc90e('0x19')]));});});},'CheckAfterSend':function(_0x467b3e){var _0x3784ba=this;return new Promise(function(_0x21ce32,_0x146b6e){_0x54a0a8[_0xc90e('0x85')](_0x467b3e)['then'](function(_0x104005){_0x21ce32({'code':0xc8,'message':_0x104005[_0xc90e('0x19')]});})[_0xc90e('0x1a')](function(_0x17e531){_0x146b6e(_0x3784ba[_0xc90e('0x10')](0x1f4,_0x17e531[_0xc90e('0x19')]));});});}};var _0x3922f5=jayson[_0xc90e('0x86')](_0x42051a)[_0xc90e('0x87')]();_0x3922f5['on'](_0xc90e('0x10'),function(_0x590b13){return _0x48bea9(_0x590b13);});_0x3922f5[_0xc90e('0x7')](0x232a,_0xc90e('0x88'),function(){console['log'](_0xc90e('0x89'),0x232a);return _0x259c62(_0xc90e('0x8a')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 2a9abe6..9b82e5d 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 _0xd6d6=['isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','destcalleridnum','calleridnum','firstName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x26b7ad,_0xba6345){_0x26b7ad=_0x26b7ad-0x0;var _0x466237=_0xd6d6[_0x26b7ad];return _0x466237;};'use strict';var _=require(_0x6d6d('0x0'));var BPromise=require(_0x6d6d('0x1'));var Redis=require(_0x6d6d('0x2'));var util=require(_0x6d6d('0x3'));var config=require('../../../../config/environment');var logger=require(_0x6d6d('0x4'))(_0x6d6d('0x5'));var cmContactRpc=require(_0x6d6d('0x6'));config[_0x6d6d('0x7')]=_[_0x6d6d('0x8')](config[_0x6d6d('0x7')],{'host':_0x6d6d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d6d('0x7')]));function emit(_0x1bf731,_0x44f83d,_0x18f824,_0xd49f57,_0x408f88){logger[_0x6d6d('0xa')]('[CM][%s][%s]',_0x1bf731,_0x44f83d['id'],_0x18f824,_0xd49f57,JSON['stringify'](_0x408f88));io['to'](_0x18f824)[_0x6d6d('0xb')](_0xd49f57,_0x408f88);}exports[_0x6d6d('0xc')]=function(_0x23b18a,_0x290dfb,_0xf84314,_0x576c88){var _0x1f2b86,_0x158f82;var _0x49b59c={};var _0x4fbe9c=Number(_0xf84314[_0x6d6d('0xd')]);var _0x32146d=_0xf84314[_0x6d6d('0xe')]?Boolean(Number(_0xf84314[_0x6d6d('0xe')])):![];var _0x2b74ed;var _0x41fbdf=![];if(!_[_0x6d6d('0xf')](_0xf84314[_0x6d6d('0x10')])){if(_0xf84314['data5']=='1')_0x41fbdf=!![];}if(!_0x41fbdf){if(_0x576c88[_0x6d6d('0x11')]){_0x49b59c['id']=_0x576c88[_0x6d6d('0x11')];}}if(!_0x49b59c['id']){_0x49b59c[_0x6d6d('0x12')]=_0x4fbe9c;_0x2b74ed=_0xf84314[_0x6d6d('0x13')]&&_0xf84314[_0x6d6d('0x13')]!=='0'?_0xf84314['data3'][_0x6d6d('0x14')](','):['phone'];_0x49b59c[_0x6d6d('0x15')]=_[_0x6d6d('0x16')](_0x2b74ed,function(_0x1cc02b){var _0x4bb3d1={};_0x4bb3d1[_0x1cc02b]=_0x576c88['routeId']?_0x576c88[_0x6d6d('0x17')]:_0x576c88[_0x6d6d('0x18')];return _0x4bb3d1;});}var _0x2b59d4=['id',_0x6d6d('0x19'),'lastName','phone',_0x6d6d('0x1a'),'fax',_0x6d6d('0x12'),_0x6d6d('0x1b'),_0x6d6d('0x1c'),_0x6d6d('0x1d')];var _0x40d35b=_[_0x6d6d('0x1e')](_0x2b59d4,_0x2b74ed);BPromise[_0x6d6d('0x1f')]()[_0x6d6d('0x20')](cmContactRpc[_0x6d6d('0x21')]({'attributes':_0x40d35b,'where':_0x49b59c}))[_0x6d6d('0x20')](function(_0x24b10d){_0x158f82=_0x24b10d;if(!_[_0x6d6d('0x22')](_0x158f82)){if(_0x158f82[_0x6d6d('0x23')]===0x1){_0x1f2b86=_0x158f82[0x0];logger[_0x6d6d('0xa')](_0x6d6d('0x24'),_0x576c88[_0x6d6d('0x25')],_0x290dfb['id'],_0x1f2b86['id']);}else{logger[_0x6d6d('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x576c88[_0x6d6d('0x25')],_0x290dfb['id'],_[_0x6d6d('0x16')](_0x158f82,'id')[_0x6d6d('0x26')](','));}return;}else{logger[_0x6d6d('0xa')](_0x6d6d('0x27'),_0x576c88[_0x6d6d('0x25')],_0x290dfb['id']);var _0x554f8e={'ListId':_0x4fbe9c};var _0x2851dd=_0xf84314[_0x6d6d('0x28')]&&_0xf84314[_0x6d6d('0x28')]!=='0'?_0xf84314[_0x6d6d('0x28')]:_0x6d6d('0x29');if(_0x32146d){logger[_0x6d6d('0xa')](_0x6d6d('0x2a'),_0x576c88['uniqueid'],_0x290dfb['id']);_0x554f8e[_0x2851dd]=_[_0x6d6d('0xf')](_0x576c88[_0x6d6d('0x2b')])?_0x576c88['calleridnum']:_0x576c88['destcalleridnum'];if(_[_0x6d6d('0xf')](_0x576c88[_0x6d6d('0x2b')])){_0x554f8e[_0x6d6d('0x19')]=_0x576c88['calleridname']&&_0x576c88[_0x6d6d('0x2c')]!==_0x6d6d('0x2d')?_0x576c88[_0x6d6d('0x2c')]:_0x6d6d('0x2e');}else{_0x554f8e[_0x6d6d('0x19')]=_0x576c88[_0x6d6d('0x2f')]&&_0x576c88[_0x6d6d('0x2f')]!==_0x6d6d('0x2d')?_0x576c88[_0x6d6d('0x2f')]:_0x6d6d('0x2e');}return BPromise['resolve']()[_0x6d6d('0x20')](cmContactRpc['createContact'](_0x554f8e))[_0x6d6d('0x20')](function(_0x1ea9b2){_0x1f2b86=_0x1ea9b2;_0x158f82[_0x6d6d('0x30')](_0x1ea9b2);if(_0x1f2b86){logger[_0x6d6d('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x576c88[_0x6d6d('0x25')],_0x290dfb['id'],_0x1f2b86['id']);}return;});}else{logger['info'](_0x6d6d('0x31'),_0x576c88[_0x6d6d('0x25')],_0x290dfb['id']);_0x554f8e[_0x2851dd]=_['isNil'](_0x576c88[_0x6d6d('0x2b')])?_0x576c88[_0x6d6d('0x18')]:_0x576c88[_0x6d6d('0x17')];if(_[_0x6d6d('0xf')](_0x576c88[_0x6d6d('0x2b')])){_0x554f8e[_0x6d6d('0x19')]=_0x576c88[_0x6d6d('0x2c')]&&_0x576c88[_0x6d6d('0x2c')]!==_0x6d6d('0x2d')?_0x576c88[_0x6d6d('0x2c')]:_0x6d6d('0x2e');}else{_0x554f8e[_0x6d6d('0x19')]=_0x576c88[_0x6d6d('0x2f')]&&_0x576c88[_0x6d6d('0x2f')]!==''?_0x576c88[_0x6d6d('0x2f')]:_0x6d6d('0x2e');}_0x1f2b86=_0x554f8e;_0x158f82[_0x6d6d('0x30')](_0x554f8e);return;}}})[_0x6d6d('0x20')](function(){if(_0x23b18a){emit(_0x576c88['uniqueid'],_0x290dfb,util['format'](_0x6d6d('0x32'),_0x23b18a[_0x6d6d('0x33')]),util[_0x6d6d('0x34')]('trigger:%s',_0xf84314[_0x6d6d('0x35')][_0x6d6d('0x36')]()),{'evt':_[_0x6d6d('0x37')](_0x576c88,{'autoCreate':_0x32146d}),'contact':_0x1f2b86===undefined?{}:_0x1f2b86,'contacts':_0x158f82[_0x6d6d('0x23')]===0x0?undefined:_0x158f82});}});}; \ No newline at end of file +var _0xa8a8=['resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','routeId','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','updatedAt','union'];(function(_0x38a7f5,_0x54eeec){var _0x1492e7=function(_0x26ec5e){while(--_0x26ec5e){_0x38a7f5['push'](_0x38a7f5['shift']());}};_0x1492e7(++_0x54eeec);}(_0xa8a8,0xec));var _0x8a8a=function(_0x6efa85,_0x10537a){_0x6efa85=_0x6efa85-0x0;var _0x1d1269=_0xa8a8[_0x6efa85];return _0x1d1269;};'use strict';var _=require(_0x8a8a('0x0'));var BPromise=require(_0x8a8a('0x1'));var Redis=require(_0x8a8a('0x2'));var util=require(_0x8a8a('0x3'));var config=require('../../../../config/environment');var logger=require(_0x8a8a('0x4'))(_0x8a8a('0x5'));var cmContactRpc=require(_0x8a8a('0x6'));config[_0x8a8a('0x7')]=_[_0x8a8a('0x8')](config[_0x8a8a('0x7')],{'host':_0x8a8a('0x9'),'port':0x18eb});var io=require(_0x8a8a('0xa'))(new Redis(config[_0x8a8a('0x7')]));function emit(_0x315fe9,_0x1d7121,_0x8e7aa0,_0x4225b9,_0xecaa6f){logger[_0x8a8a('0xb')]('[CM][%s][%s]',_0x315fe9,_0x1d7121['id'],_0x8e7aa0,_0x4225b9,JSON['stringify'](_0xecaa6f));io['to'](_0x8e7aa0)[_0x8a8a('0xc')](_0x4225b9,_0xecaa6f);}exports['exec']=function(_0x11788d,_0x3d3a00,_0x532621,_0x118380){var _0x76b586,_0xb13fca;var _0x5e448d={};var _0x679da2=Number(_0x532621[_0x8a8a('0xd')]);var _0x330796=_0x532621[_0x8a8a('0xe')]?Boolean(Number(_0x532621['data2'])):![];var _0x23febf;var _0x4e5d74=![];if(!_[_0x8a8a('0xf')](_0x532621[_0x8a8a('0x10')])){if(_0x532621[_0x8a8a('0x10')]=='1')_0x4e5d74=!![];}if(!_0x4e5d74){if(_0x118380[_0x8a8a('0x11')]){_0x5e448d['id']=_0x118380[_0x8a8a('0x11')];}}if(!_0x5e448d['id']){_0x5e448d[_0x8a8a('0x12')]=_0x679da2;_0x23febf=_0x532621[_0x8a8a('0x13')]&&_0x532621['data3']!=='0'?_0x532621[_0x8a8a('0x13')]['split'](','):[_0x8a8a('0x14')];_0x5e448d[_0x8a8a('0x15')]=_[_0x8a8a('0x16')](_0x23febf,function(_0x4291e9){var _0x42e8b6={};_0x42e8b6[_0x4291e9]=_0x118380['routeId']?_0x118380[_0x8a8a('0x17')]:_0x118380[_0x8a8a('0x18')];return _0x42e8b6;});}var _0x262ca9=['id',_0x8a8a('0x19'),_0x8a8a('0x1a'),_0x8a8a('0x14'),'mobile','fax','ListId','createdAt','scheduledAt',_0x8a8a('0x1b')];var _0x45095b=_[_0x8a8a('0x1c')](_0x262ca9,_0x23febf);BPromise[_0x8a8a('0x1d')]()[_0x8a8a('0x1e')](cmContactRpc[_0x8a8a('0x1f')]({'attributes':_0x45095b,'where':_0x5e448d}))[_0x8a8a('0x1e')](function(_0xe0321c){_0xb13fca=_0xe0321c;if(!_[_0x8a8a('0x20')](_0xb13fca)){if(_0xb13fca[_0x8a8a('0x21')]===0x1){_0x76b586=_0xb13fca[0x0];logger[_0x8a8a('0xb')](_0x8a8a('0x22'),_0x118380[_0x8a8a('0x23')],_0x3d3a00['id'],_0x76b586['id']);}else{logger[_0x8a8a('0xb')](_0x8a8a('0x24'),_0x118380['uniqueid'],_0x3d3a00['id'],_[_0x8a8a('0x16')](_0xb13fca,'id')[_0x8a8a('0x25')](','));}return;}else{logger[_0x8a8a('0xb')](_0x8a8a('0x26'),_0x118380[_0x8a8a('0x23')],_0x3d3a00['id']);var _0x251315={'ListId':_0x679da2};var _0x3aa46d=_0x532621['data4']&&_0x532621[_0x8a8a('0x27')]!=='0'?_0x532621[_0x8a8a('0x27')]:_0x8a8a('0x14');if(_0x330796){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x118380[_0x8a8a('0x23')],_0x3d3a00['id']);_0x251315[_0x3aa46d]=_[_0x8a8a('0xf')](_0x118380['routeId'])?_0x118380['calleridnum']:_0x118380['destcalleridnum'];if(_[_0x8a8a('0xf')](_0x118380['routeId'])){_0x251315[_0x8a8a('0x19')]=_0x118380[_0x8a8a('0x28')]&&_0x118380['calleridname']!==_0x8a8a('0x29')?_0x118380[_0x8a8a('0x28')]:_0x8a8a('0x2a');}else{_0x251315[_0x8a8a('0x19')]=_0x118380[_0x8a8a('0x2b')]&&_0x118380[_0x8a8a('0x2b')]!==_0x8a8a('0x29')?_0x118380[_0x8a8a('0x2b')]:'Unknown';}return BPromise['resolve']()['then'](cmContactRpc[_0x8a8a('0x2c')](_0x251315))[_0x8a8a('0x1e')](function(_0x5f301e){_0x76b586=_0x5f301e;_0xb13fca[_0x8a8a('0x2d')](_0x5f301e);if(_0x76b586){logger[_0x8a8a('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x118380[_0x8a8a('0x23')],_0x3d3a00['id'],_0x76b586['id']);}return;});}else{logger[_0x8a8a('0xb')](_0x8a8a('0x2e'),_0x118380['uniqueid'],_0x3d3a00['id']);_0x251315[_0x3aa46d]=_['isNil'](_0x118380[_0x8a8a('0x2f')])?_0x118380['calleridnum']:_0x118380[_0x8a8a('0x17')];if(_[_0x8a8a('0xf')](_0x118380[_0x8a8a('0x2f')])){_0x251315[_0x8a8a('0x19')]=_0x118380[_0x8a8a('0x28')]&&_0x118380[_0x8a8a('0x28')]!==_0x8a8a('0x29')?_0x118380[_0x8a8a('0x28')]:_0x8a8a('0x2a');}else{_0x251315[_0x8a8a('0x19')]=_0x118380[_0x8a8a('0x2b')]&&_0x118380[_0x8a8a('0x2b')]!==_0x8a8a('0x29')?_0x118380[_0x8a8a('0x2b')]:_0x8a8a('0x2a');}_0x76b586=_0x251315;_0xb13fca[_0x8a8a('0x2d')](_0x251315);return;}}})[_0x8a8a('0x1e')](function(){if(_0x11788d){emit(_0x118380[_0x8a8a('0x23')],_0x3d3a00,util['format']('user:%s',_0x11788d['name']),util[_0x8a8a('0x30')](_0x8a8a('0x31'),_0x532621[_0x8a8a('0x32')][_0x8a8a('0x33')]()),{'evt':_[_0x8a8a('0x34')](_0x118380,{'autoCreate':_0x330796}),'contact':_0x76b586===undefined?{}:_0x76b586,'contacts':_0xb13fca['length']===0x0?undefined:_0xb13fca});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 25b5a75..0ce0546 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 _0x949d=['length','interface','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','windowWidth','data5','800','data6','600','winapp','winApplication','winArguments','format','user:%s','name','data1','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','field','account','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','util','lodash','url','mustache','ioredis','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','prototype','emit','stringify','undefined','motionChannel','checkTriggers','triggers','status','checkTrigger','merge','Actions'];(function(_0x129ee4,_0x8d0e62){var _0x5491fe=function(_0x214735){while(--_0x214735){_0x129ee4['push'](_0x129ee4['shift']());}};_0x5491fe(++_0x8d0e62);}(_0x949d,0x130));var _0xd949=function(_0x53aba7,_0x39594c){_0x53aba7=_0x53aba7-0x0;var _0x38ccca=_0x949d[_0x53aba7];return _0x38ccca;};'use strict';var util=require(_0xd949('0x0'));var _=require(_0xd949('0x1'));var url=require(_0xd949('0x2'));var Mustache=require(_0xd949('0x3'));var Redis=require(_0xd949('0x4'));var urlforward=require('./urlforward');var integration=require(_0xd949('0x5'));var cmContact=require(_0xd949('0x6'));var script=require('./script');var config=require(_0xd949('0x7'));var logger=require(_0xd949('0x8'))(_0xd949('0x9'));var ami=require(_0xd949('0xa'));config[_0xd949('0xb')]=_[_0xd949('0xc')](config[_0xd949('0xb')],{'host':_0xd949('0xd'),'port':0x18eb});var io=require(_0xd949('0xe'))(new Redis(config[_0xd949('0xb')]));var operators={'equals':function(_0x2fc0f0,_0x229b0c){return _0x2fc0f0==_0x229b0c;},'not_equals':function(_0x541f5b,_0x330a44){return _0x541f5b!=_0x330a44;}};var barAndWebActions=[_0xd949('0xf'),_0xd949('0x2'),'winapp'];function Trigger(_0xe64f9e){this['triggers']=_0xe64f9e['triggers'];this['agents']=_0xe64f9e[_0xd949('0x10')];this[_0xd949('0x11')]=_0xe64f9e[_0xd949('0x11')];this['templates']=_0xe64f9e[_0xd949('0x12')];this[_0xd949('0x13')]=_0xe64f9e[_0xd949('0x13')];this['zendeskAccounts']=_0xe64f9e[_0xd949('0x14')];this[_0xd949('0x15')]=_0xe64f9e[_0xd949('0x15')];this[_0xd949('0x16')]=_0xe64f9e[_0xd949('0x16')];this['sugarcrmAccounts']=_0xe64f9e[_0xd949('0x17')];this['zohoAccounts']=_0xe64f9e[_0xd949('0x18')];this[_0xd949('0x19')]=_0xe64f9e[_0xd949('0x19')];this['vtigerAccounts']=_0xe64f9e[_0xd949('0x1a')];this['servicenowAccounts']=_0xe64f9e[_0xd949('0x1b')];this[_0xd949('0x1c')]=_0xe64f9e[_0xd949('0x1c')];this[_0xd949('0x1d')]=_0xe64f9e[_0xd949('0x1d')];this[_0xd949('0x1e')]={'zendesk':this[_0xd949('0x14')],'salesforce':this[_0xd949('0x16')],'freshdesk':this[_0xd949('0x15')],'sugarcrm':this[_0xd949('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xd949('0x19')],'vtiger':this[_0xd949('0x1a')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xd949('0x1d')],'servicenow':this['servicenowAccounts']};ami['on'](_0xd949('0x1f'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on'](_0xd949('0x22'),this[_0xd949('0x20')]['bind'](this));ami['on'](_0xd949('0x23'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on'](_0xd949('0x24'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on'](_0xd949('0x25'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on'](_0xd949('0x26'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on'](_0xd949('0x27'),this[_0xd949('0x20')]['bind'](this));ami['on'](_0xd949('0x28'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on']('custom:agentreject',this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on'](_0xd949('0x29'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on'](_0xd949('0x2a'),this[_0xd949('0x20')]['bind'](this));ami['on'](_0xd949('0x2b'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on'](_0xd949('0x2c'),this[_0xd949('0x2d')][_0xd949('0x21')](this));ami['on']('custom:dialconnect',this[_0xd949('0x2d')]['bind'](this));ami['on']('custom:dialend',this[_0xd949('0x2d')][_0xd949('0x21')](this));ami['on'](_0xd949('0x2e'),this['syncCustomEvent'][_0xd949('0x21')](this));ami['on'](_0xd949('0x2f'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on'](_0xd949('0x30'),this[_0xd949('0x20')]['bind'](this));ami['on'](_0xd949('0x31'),this['syncCustomEvent'][_0xd949('0x21')](this));ami['on'](_0xd949('0x32'),this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on']('custom:acceptmessage',this[_0xd949('0x20')][_0xd949('0x21')](this));ami['on']('custom:rejectmessage',this[_0xd949('0x20')][_0xd949('0x21')](this));}Trigger[_0xd949('0x33')][_0xd949('0x34')]=function(_0x9b138a,_0x18c341,_0x1905bf){logger['info'](_0x9b138a,_0x18c341,JSON[_0xd949('0x35')](_0x1905bf));io['to'](_0x9b138a)[_0xd949('0x34')](_0x18c341,_0x1905bf);};Trigger[_0xd949('0x33')][_0xd949('0x20')]=function(_0x227a25){var _0x1807d4=_['clone'](_0x227a25);if(typeof _0x1807d4['motionChannel']===_0xd949('0x36')){_0x1807d4[_0xd949('0x37')]='voice';}this['checkTriggers'](_0x1807d4);};Trigger[_0xd949('0x33')][_0xd949('0x2d')]=function(_0x3d0188){if(this[_0xd949('0x10')][_0x3d0188['interface']]){this[_0xd949('0x20')](_0x3d0188);}};Trigger[_0xd949('0x33')][_0xd949('0x38')]=function(_0x279730){var _0x19f04c;for(var _0x29833e in this[_0xd949('0x39')]){if(this[_0xd949('0x39')]['hasOwnProperty'](_0x29833e)){if(this[_0xd949('0x39')][_0x29833e][_0xd949('0x3a')]){_0x19f04c=this[_0xd949('0x3b')](this[_0xd949('0x39')][_0x29833e],_0x279730);if(_0x19f04c){_[_0xd949('0x3c')](_0x279730,_0x279730['variables']);for(var _0x1c620c=0x0,_0x32d963,_0x76f7bb,_0x2e2038;_0x1c620c0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x5fc3,0xa8));var _0x35fc=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x5fc3[_0xf2662b];return _0x257dc7;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index cba7da2..b282cc3 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 _0x7c25=['email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','/systemusers(','lastIndexOf','message','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','enduserId','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','Fields','phonecall','phonecalls','callDirection','queue','headers','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','serverUrl','stripTrailingSlash','unmanaged','outbound','format','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0'];(function(_0x6fb7ec,_0x2cc36f){var _0x243017=function(_0x3d591c){while(--_0x3d591c){_0x6fb7ec['push'](_0x6fb7ec['shift']());}};_0x243017(++_0x2cc36f);}(_0x7c25,0x10e));var _0x57c2=function(_0x45b0d4,_0x131741){_0x45b0d4=_0x45b0d4-0x0;var _0x3d6c14=_0x7c25[_0x45b0d4];return _0x3d6c14;};'use strict';var _=require('lodash');var BPromise=require(_0x57c2('0x0'));var rp=require(_0x57c2('0x1'));var util=require(_0x57c2('0x2'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x57c2('0x3'));var config=require(_0x57c2('0x4'));config[_0x57c2('0x5')]=_[_0x57c2('0x6')](config[_0x57c2('0x5')],{'host':_0x57c2('0x7'),'port':0x18eb});var io=require(_0x57c2('0x8'))(new Redis(config[_0x57c2('0x5')]));function getAuthToken(_0x14de4f,_0x1ab8b1,_0x2de8bb){var _0x44dbb6={'method':_0x57c2('0x9'),'uri':_0x1ab8b1,'form':{'client_id':_0x14de4f[_0x57c2('0xa')],'resource':_0x14de4f[_0x57c2('0xb')],'username':_0x14de4f[_0x57c2('0xc')],'password':_0x14de4f['password'],'grant_type':_0x57c2('0xd'),'client_secret':_0x14de4f[_0x57c2('0xe')]},'json':!![]};return rp(_0x44dbb6)[_0x57c2('0xf')](function(_0x41db3c){return _0x41db3c[_0x57c2('0x10')];})[_0x57c2('0x11')](function(_0x490c06){logger[_0x57c2('0x12')]('['+[_0x2de8bb[_0x57c2('0x13')]()]+']\x20Wrong\x20credentials!');return _0x490c06['message'];});}function getUser(_0x47f3f6,_0x20e750,_0x53150d,_0x329b80,_0x53a011,_0x41bd29){return new BPromise(function(_0x21f48d,_0x3d118e){return getAuthToken(_0x20e750,_0x329b80,_0x41bd29)[_0x57c2('0xf')](function(_0x1d5590){var _0x5a9a9f={'method':_0x57c2('0x14'),'uri':_0x53a011+_0x57c2('0x15'),'headers':{'Authorization':_0x57c2('0x16')+_0x1d5590,'OData-Version':_0x57c2('0x17')},'json':!![]};return rp(_0x5a9a9f);})[_0x57c2('0xf')](function(_0x45554a){var _0x3a3e48=_0x45554a['value'];var _0x30f162=![];var _0x201c7d=null;if(!_['isNil'](_0x53150d)){if(intUtil['validateEmail'](_0x53150d[_0x57c2('0x18')])){_0x47f3f6[_0x57c2('0x19')]=_0x53150d[_0x57c2('0x18')];for(_0x201c7d=0x0;_0x201c7d<_0x3a3e48[_0x57c2('0x1a')];_0x201c7d++){if(_0x3a3e48[_0x201c7d][_0x57c2('0x1b')]===_0x53150d[_0x57c2('0x18')]&&!_0x3a3e48[_0x201c7d][_0x57c2('0x1c')]){_0x30f162=!![];logger[_0x57c2('0x1d')]('['+[_0x41bd29['toUpperCase']()]+_0x57c2('0x1e')+_0x3a3e48[_0x201c7d][_0x57c2('0x1f')]+'!');_0x47f3f6[_0x57c2('0x20')]=_0x3a3e48[_0x201c7d][_0x57c2('0x1f')];}}}}if(!_0x30f162){logger['info']('['+[_0x41bd29[_0x57c2('0x13')]()]+_0x57c2('0x21'));_0x47f3f6['userEmail']=_0x20e750[_0x57c2('0xc')];for(_0x201c7d=0x0;_0x201c7d<_0x3a3e48[_0x57c2('0x1a')];_0x201c7d++){if(_0x3a3e48[_0x201c7d][_0x57c2('0x1b')]===_0x20e750['username']){_0x47f3f6[_0x57c2('0x20')]=_0x3a3e48[_0x201c7d][_0x57c2('0x1f')];}}}_0x21f48d(_0x47f3f6);})[_0x57c2('0x11')](function(_0x13a5d5){_0x3d118e(_0x13a5d5['message']);});});}function createEndUser(_0x99bfc7,_0x37ccb6,_0x2801d2,_0x366296,_0x15ad17,_0xf07439){return new BPromise(function(_0x1ab3af,_0x35b69c){return getAuthToken(_0x37ccb6,_0x2801d2,_0xf07439)[_0x57c2('0xf')](function(_0x4076bd){var _0x5d5284=_0xf07439[_0x57c2('0x22')]()==='outbound'?_0x15ad17[_0x57c2('0x23')]:_0x15ad17[_0x57c2('0x24')];var _0x596a36={'method':_0x57c2('0x9'),'uri':_0x366296+'contacts','body':{'telephone1':_0x5d5284,'fullname':_0x5d5284,'firstname':_0x5d5284,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x57c2('0x25')+_0x99bfc7[_0x57c2('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4076bd,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x596a36);})['then'](function(_0x341142){var _0x2c3cce=_0x341142['headers']['odata-entityid'];var _0x20ab5f=_0x2c3cce['substring'](_0x2c3cce['lastIndexOf']('(')+0x1,_0x2c3cce[_0x57c2('0x26')](')'));_0x99bfc7['enduserId']=_0x20ab5f;_0x1ab3af(_0x99bfc7);})[_0x57c2('0x11')](function(_0x55196f){_0x35b69c(_0x55196f[_0x57c2('0x27')]);});});}function getEndUser(_0x1ba9a6,_0x1a44fa,_0x1ff6ae,_0x1a903c,_0x431faf,_0x56b27b){return new BPromise(function(_0x1fbd3b,_0x3fbdfc){var _0x258d47=_0x56b27b['toLowerCase']()==='outbound'?_0x431faf[_0x57c2('0x23')]:_0x431faf[_0x57c2('0x24')];return getAuthToken(_0x1a44fa,_0x1ff6ae,_0x56b27b)[_0x57c2('0xf')](function(_0x8f87de){var _0x1b09aa={'method':_0x57c2('0x14'),'uri':_0x1a903c+_0x57c2('0x28')+_0x258d47[_0x57c2('0x29')]('+',_0x57c2('0x2a'))+'\x27','headers':{'Authorization':_0x57c2('0x16')+_0x8f87de,'If-None-Match':null,'OData-Version':_0x57c2('0x17')},'json':!![]};return rp(_0x1b09aa);})[_0x57c2('0xf')](function(_0xe3dc89){var _0xc174e5=null;if(_0xe3dc89){var _0x8e2bc=_0xe3dc89[_0x57c2('0x2b')];var _0x3d2e1c=![];for(_0xc174e5=0x0;_0xc174e5<_0x8e2bc[_0x57c2('0x1a')];_0xc174e5++){if(_0x8e2bc[_0xc174e5]['telephone1']===_0x258d47){_0x3d2e1c=!![];_0x1ba9a6[_0x57c2('0x2c')]=_0x8e2bc[_0xc174e5][_0x57c2('0x2d')];}}if(_0x3d2e1c){_0x1fbd3b(_0x1ba9a6);}else{return createEndUser(_0x1ba9a6,_0x1a44fa,_0x1ff6ae,_0x1a903c,_0x431faf,_0x56b27b)['then'](function(_0x4a830f){logger[_0x57c2('0x1d')]('['+[_0x56b27b['toUpperCase']()]+_0x57c2('0x2e'),_0x4a830f[_0x57c2('0x2c')]);_0x1fbd3b(_0x4a830f);});}}else{return createEndUser(_0x1ba9a6,_0x1a44fa,_0x1ff6ae,_0x1a903c,_0x431faf,_0x56b27b)['then'](function(_0x3932d3){logger[_0x57c2('0x1d')]('['+[_0x56b27b[_0x57c2('0x13')]()]+']\x20Enduser\x20Created!',_0x3932d3[_0x57c2('0x2c')]);_0x1fbd3b(_0x3932d3);});}});});}function getCustomFields(_0x413652,_0x291f8e,_0x42bea6){var _0xa12abf={};if(_0x413652[_0x57c2('0x1a')]>0x0){_[_0x57c2('0x2f')](_0x413652,function(_0x451fe0){if(_[_0x57c2('0x30')]([_0x57c2('0x31'),_0x57c2('0x32')],_0x451fe0[_0x57c2('0x33')])&&_0x451fe0[_0x57c2('0x34')]&&!_0x451fe0['customField']){var _0x27b9e4=_0x451fe0[_0x57c2('0x35')][_0x57c2('0x22')]();var _0x292c1e=_0x27b9e4[_0x57c2('0x36')](0x0,_0x27b9e4['indexOf']('_'));var _0x37eeec=_0x27b9e4[_0x57c2('0x36')](_0x27b9e4[_0x57c2('0x37')]('_')+0x1);if(_0x292c1e===_0x42bea6){_0xa12abf[_0x37eeec]=_0x451fe0[_0x57c2('0x38')];}}});}return _0xa12abf;}function getTicket(_0x27bab9,_0x2cd274,_0x2782ff,_0x4fe312,_0x261480,_0x2f0608,_0x19dec2){return new BPromise(function(_0xc26d05,_0x4e34f2){var _0x4436d9;return getAuthToken(_0x2cd274,_0x2782ff,_0x19dec2)['then'](function(_0x14a396){if(_0x2f0608[_0x57c2('0x39')]===_0x57c2('0x3a')){_0x4436d9={'method':_0x57c2('0x9'),'uri':_0x4fe312+_0x57c2('0x3b'),'body':Object[_0x57c2('0x3c')]({},{'title':intUtil['getString'](_0x2f0608[_0x57c2('0x3d')],_0x261480,'\x20'),'description':intUtil[_0x57c2('0x3e')](_0x2f0608[_0x57c2('0x3f')],_0x261480,'\x0a'),'customerid_contact@odata.bind':_0x57c2('0x40')+_0x27bab9['enduserId']+')','ownerid@odata.bind':_0x57c2('0x25')+_0x27bab9[_0x57c2('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x2f0608[_0x57c2('0x41')],_0x261480,_0x2f0608[_0x57c2('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x14a396,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2f0608['ticketType']===_0x57c2('0x42')){_0x4436d9={'method':_0x57c2('0x9'),'uri':_0x4fe312+_0x57c2('0x43'),'body':Object[_0x57c2('0x3c')]({},{'subject':intUtil[_0x57c2('0x3e')](_0x2f0608[_0x57c2('0x3d')],_0x261480,'\x20'),'phonenumber':String(_0x261480[_0x57c2('0x24')]),'description':intUtil[_0x57c2('0x3e')](_0x2f0608[_0x57c2('0x3f')],_0x261480,'\x0a'),'regardingobjectid_contact@odata.bind':_0x57c2('0x40')+_0x27bab9['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x27bab9[_0x57c2('0x20')]+')','directioncode':_0x27bab9[_0x57c2('0x44')]===_0x57c2('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x57c2('0x25')+_0x27bab9['userId']+')','participationtypemask':_0x27bab9[_0x57c2('0x44')]===_0x57c2('0x45')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x27bab9[_0x57c2('0x2c')]+')','participationtypemask':_0x27bab9[_0x57c2('0x44')]===_0x57c2('0x45')?0x1:0x2}]},getCustomFields(_0x2f0608[_0x57c2('0x41')],_0x261480,_0x2f0608['ticketType'])),'headers':{'Authorization':_0x57c2('0x16')+_0x14a396,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4436d9);})[_0x57c2('0xf')](function(_0x32055f){var _0x4f5f2f=_0x32055f[_0x57c2('0x46')][_0x57c2('0x47')];var _0x4382e6=_0x4f5f2f[_0x57c2('0x36')](_0x4f5f2f[_0x57c2('0x26')]('(')+0x1,_0x4f5f2f[_0x57c2('0x26')](')'));_0x27bab9[_0x57c2('0x48')]=_0x4382e6;_0xc26d05(_0x27bab9);})['catch'](function(_0x73b733){_0x4e34f2(_0x73b733['message']);});});}function emit(_0x40aea0,_0xc326ad,_0x1ca44d,_0x1eb295){var _0x32f929={'uri':util['format'](_0x57c2('0x49'),_0x40aea0,_0x1ca44d,_0x1eb295)};io['to'](util['format'](_0x57c2('0x4a'),_0xc326ad))[_0x57c2('0x4b')]('trigger:browser:url',_0x32f929);}exports['cs']=function(_0xb33955,_0x54120c,_0x2e39c2,_0x159eeb,_0x1d1635,_0x4870d3,_0xe27852,_0x2e289b){var _0x17621d={};_0x4870d3['remoteUri']=intUtil['stripTrailingSlash'](_0x4870d3[_0x57c2('0xb')]);_0x4870d3[_0x57c2('0x4c')]=intUtil[_0x57c2('0x4d')](_0x4870d3[_0x57c2('0x4c')]);_0x17621d['callDirection']=_0x2e289b==='queue'||_0x2e289b===_0x57c2('0x4e')?_0x57c2('0x45'):_0x57c2('0x4f');var _0x4c9215=util[_0x57c2('0x50')](_0x57c2('0x51'),_0x4870d3[_0x57c2('0xb')]);var _0x24643e=util[_0x57c2('0x50')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4870d3['tenantId']);var _0x26b533=util['format'](_0x57c2('0x52'),_0x4870d3['serverUrl'],_0x54120c[_0x57c2('0x53')],md5(_0x54120c['uniqueid']));if(_0x1d1635&&_0x1d1635['monitor_format']){logger[_0x57c2('0x1d')](_0x57c2('0x54'),_0x57c2('0x55'));_0x54120c[_0x57c2('0x56')]=_0x26b533;}else if(_0xe27852&&_0xe27852['recordingFormat']&&_0xe27852[_0x57c2('0x57')]!==_0x57c2('0x58')){logger[_0x57c2('0x1d')](_0x57c2('0x59'),_0x57c2('0x55'));_0x54120c['recordingURL']=_0x26b533;}else{_0x54120c[_0x57c2('0x56')]='';}return getUser(_0x17621d,_0x4870d3,_0x159eeb,_0x24643e,_0x4c9215,_0x2e289b)[_0x57c2('0xf')](function(_0x5516ef){logger[_0x57c2('0x1d')]('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x5a'),_0x5516ef[_0x57c2('0x20')]);logger[_0x57c2('0x1d')]('['+_0x2e289b['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x5516ef['userEmail']);return getEndUser(_0x5516ef,_0x4870d3,_0x24643e,_0x4c9215,_0x54120c,_0x2e289b);})[_0x57c2('0xf')](function(_0x2e7d6c){logger[_0x57c2('0x1d')]('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x5b'),_0x2e7d6c[_0x57c2('0x2c')]);logger['info']('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x5c'),_0x54120c[_0x57c2('0x24')]);return getTicket(_0x2e7d6c,_0x4870d3,_0x24643e,_0x4c9215,_0x54120c,_0x2e39c2,_0x2e289b);})['then'](function(_0x476184){logger['info'](util[_0x57c2('0x50')]('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x5d'),_0x2e39c2[_0x57c2('0x39')],_0x476184['ticketId']));logger[_0x57c2('0x1d')](util[_0x57c2('0x50')]('['+_0x2e289b[_0x57c2('0x13')]()+']\x20Call\x20direction:\x20%s',_0x2e289b));if(_0x2e289b!==_0x57c2('0x4e')){logger[_0x57c2('0x1d')]('['+_0x2e289b[_0x57c2('0x13')]()+']',_0x57c2('0x5e'));emit(_0x4870d3[_0x57c2('0xb')],_0x159eeb[_0x57c2('0x5f')],_0x2e39c2['ticketType'],_0x476184[_0x57c2('0x48')]);}})[_0x57c2('0x11')](function(_0x1bf183){logger[_0x57c2('0x12')]('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x60'),util[_0x57c2('0x61')](_0x1bf183,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe75c=['destcalleridnum','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','calleridnum','callDirection','queue','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','POST','remoteUri','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','catch','outbound'];(function(_0x5e909d,_0xcb0787){var _0x4cf7b5=function(_0x4581c6){while(--_0x4581c6){_0x5e909d['push'](_0x5e909d['shift']());}};_0x4cf7b5(++_0xcb0787);}(_0xe75c,0x172));var _0xce75=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe75c[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xce75('0x0'));var BPromise=require(_0xce75('0x1'));var rp=require(_0xce75('0x2'));var util=require(_0xce75('0x3'));var intUtil=require(_0xce75('0x4'));var md5=require(_0xce75('0x5'));var Redis=require(_0xce75('0x6'));var logger=require(_0xce75('0x7'))(_0xce75('0x8'));var config=require(_0xce75('0x9'));config[_0xce75('0xa')]=_['defaults'](config[_0xce75('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xce75('0xb'))(new Redis(config[_0xce75('0xa')]));function getAuthToken(_0x3ae87d,_0x5e0fa2,_0x822415){var _0x5ebad3={'method':_0xce75('0xc'),'uri':_0x5e0fa2,'form':{'client_id':_0x3ae87d['clientId'],'resource':_0x3ae87d[_0xce75('0xd')],'username':_0x3ae87d['username'],'password':_0x3ae87d[_0xce75('0xe')],'grant_type':_0xce75('0xe'),'client_secret':_0x3ae87d['clientSecret']},'json':!![]};return rp(_0x5ebad3)[_0xce75('0xf')](function(_0x28c38b){return _0x28c38b[_0xce75('0x10')];})['catch'](function(_0x32fa35){logger[_0xce75('0x11')]('['+[_0x822415[_0xce75('0x12')]()]+_0xce75('0x13'));return _0x32fa35[_0xce75('0x14')];});}function getUser(_0x5deded,_0x40174e,_0x47bef1,_0x353187,_0x45a1da,_0x2a98d8){return new BPromise(function(_0x2a490d,_0x301994){return getAuthToken(_0x40174e,_0x353187,_0x2a98d8)[_0xce75('0xf')](function(_0x27f5c7){var _0x5028ff={'method':_0xce75('0x15'),'uri':_0x45a1da+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x27f5c7,'OData-Version':_0xce75('0x16')},'json':!![]};return rp(_0x5028ff);})['then'](function(_0x5c5476){var _0x5842de=_0x5c5476[_0xce75('0x17')];var _0x2992a6=![];var _0x449c44=null;if(!_[_0xce75('0x18')](_0x47bef1)){if(intUtil[_0xce75('0x19')](_0x47bef1[_0xce75('0x1a')])){_0x5deded[_0xce75('0x1b')]=_0x47bef1['email'];for(_0x449c44=0x0;_0x449c44<_0x5842de[_0xce75('0x1c')];_0x449c44++){if(_0x5842de[_0x449c44][_0xce75('0x1d')]===_0x47bef1['email']&&!_0x5842de[_0x449c44]['isdisabled']){_0x2992a6=!![];logger[_0xce75('0x1e')]('['+[_0x2a98d8['toUpperCase']()]+_0xce75('0x1f')+_0x5842de[_0x449c44][_0xce75('0x20')]+'!');_0x5deded[_0xce75('0x21')]=_0x5842de[_0x449c44][_0xce75('0x20')];}}}}if(!_0x2992a6){logger[_0xce75('0x1e')]('['+[_0x2a98d8['toUpperCase']()]+_0xce75('0x22'));_0x5deded[_0xce75('0x1b')]=_0x40174e['username'];for(_0x449c44=0x0;_0x449c44<_0x5842de[_0xce75('0x1c')];_0x449c44++){if(_0x5842de[_0x449c44][_0xce75('0x1d')]===_0x40174e[_0xce75('0x23')]){_0x5deded[_0xce75('0x21')]=_0x5842de[_0x449c44][_0xce75('0x20')];}}}_0x2a490d(_0x5deded);})[_0xce75('0x24')](function(_0x2fe09b){_0x301994(_0x2fe09b['message']);});});}function createEndUser(_0xb16391,_0x12d708,_0x2df4e3,_0x6feeb8,_0x374693,_0x4a2a80){return new BPromise(function(_0x30513a,_0x26a644){return getAuthToken(_0x12d708,_0x2df4e3,_0x4a2a80)['then'](function(_0x5ceb10){var _0x35b845=_0x4a2a80['toLowerCase']()===_0xce75('0x25')?_0x374693[_0xce75('0x26')]:_0x374693['calleridnum'];var _0x16d36b={'method':_0xce75('0xc'),'uri':_0x6feeb8+'contacts','body':{'telephone1':_0x35b845,'fullname':_0x35b845,'firstname':_0x35b845,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xce75('0x27')+_0xb16391[_0xce75('0x21')]+')'},'headers':{'Authorization':_0xce75('0x28')+_0x5ceb10,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x16d36b);})[_0xce75('0xf')](function(_0x1c123b){var _0x4dc071=_0x1c123b[_0xce75('0x29')][_0xce75('0x2a')];var _0x55c554=_0x4dc071[_0xce75('0x2b')](_0x4dc071[_0xce75('0x2c')]('(')+0x1,_0x4dc071['lastIndexOf'](')'));_0xb16391[_0xce75('0x2d')]=_0x55c554;_0x30513a(_0xb16391);})['catch'](function(_0xe639f0){_0x26a644(_0xe639f0['message']);});});}function getEndUser(_0x2825b0,_0x54beba,_0x3c90db,_0x3c7ea7,_0x3e246b,_0x3c13e6){return new BPromise(function(_0x17e424,_0x2c0455){var _0x1255e4=_0x3c13e6[_0xce75('0x2e')]()===_0xce75('0x25')?_0x3e246b['destcalleridnum']:_0x3e246b['calleridnum'];return getAuthToken(_0x54beba,_0x3c90db,_0x3c13e6)[_0xce75('0xf')](function(_0x33134b){var _0x233a26={'method':_0xce75('0x15'),'uri':_0x3c7ea7+_0xce75('0x2f')+_0x1255e4[_0xce75('0x30')]('+',_0xce75('0x31'))+'\x27','headers':{'Authorization':_0xce75('0x28')+_0x33134b,'If-None-Match':null,'OData-Version':_0xce75('0x16')},'json':!![]};return rp(_0x233a26);})['then'](function(_0x3031a7){var _0x8ae4e3=null;if(_0x3031a7){var _0x2b53d2=_0x3031a7['value'];var _0x1e50ea=![];for(_0x8ae4e3=0x0;_0x8ae4e3<_0x2b53d2[_0xce75('0x1c')];_0x8ae4e3++){if(_0x2b53d2[_0x8ae4e3][_0xce75('0x32')]===_0x1255e4){_0x1e50ea=!![];_0x2825b0[_0xce75('0x2d')]=_0x2b53d2[_0x8ae4e3][_0xce75('0x33')];}}if(_0x1e50ea){_0x17e424(_0x2825b0);}else{return createEndUser(_0x2825b0,_0x54beba,_0x3c90db,_0x3c7ea7,_0x3e246b,_0x3c13e6)['then'](function(_0x4576af){logger[_0xce75('0x1e')]('['+[_0x3c13e6[_0xce75('0x12')]()]+_0xce75('0x34'),_0x4576af[_0xce75('0x2d')]);_0x17e424(_0x4576af);});}}else{return createEndUser(_0x2825b0,_0x54beba,_0x3c90db,_0x3c7ea7,_0x3e246b,_0x3c13e6)[_0xce75('0xf')](function(_0x38099c){logger[_0xce75('0x1e')]('['+[_0x3c13e6[_0xce75('0x12')]()]+']\x20Enduser\x20Created!',_0x38099c[_0xce75('0x2d')]);_0x17e424(_0x38099c);});}});});}function getCustomFields(_0xaebda2,_0x2171bf,_0x326e1e){var _0x56977d={};if(_0xaebda2[_0xce75('0x1c')]>0x0){_[_0xce75('0x35')](_0xaebda2,function(_0x48cdfe){if(_[_0xce75('0x36')](['string',_0xce75('0x37')],_0x48cdfe[_0xce75('0x38')])&&_0x48cdfe[_0xce75('0x39')]&&!_0x48cdfe[_0xce75('0x3a')]){var _0x138ff1=_0x48cdfe[_0xce75('0x3b')][_0xce75('0x2e')]();var _0x3bf956=_0x138ff1['substring'](0x0,_0x138ff1[_0xce75('0x3c')]('_'));var _0x908503=_0x138ff1[_0xce75('0x2b')](_0x138ff1[_0xce75('0x3c')]('_')+0x1);if(_0x3bf956===_0x326e1e){_0x56977d[_0x908503]=_0x48cdfe[_0xce75('0x3d')];}}});}return _0x56977d;}function getTicket(_0x17ae7a,_0x1ca393,_0x1c885f,_0x256d3f,_0x38b6dc,_0x2d152d,_0x36771a){return new BPromise(function(_0x184db8,_0x5d20c1){var _0x3de121;return getAuthToken(_0x1ca393,_0x1c885f,_0x36771a)[_0xce75('0xf')](function(_0x5abe0a){if(_0x2d152d['ticketType']===_0xce75('0x3e')){_0x3de121={'method':'POST','uri':_0x256d3f+_0xce75('0x3f'),'body':Object[_0xce75('0x40')]({},{'title':intUtil[_0xce75('0x41')](_0x2d152d[_0xce75('0x42')],_0x38b6dc,'\x20'),'description':intUtil[_0xce75('0x41')](_0x2d152d[_0xce75('0x43')],_0x38b6dc,'\x0a'),'customerid_contact@odata.bind':_0xce75('0x44')+_0x17ae7a['enduserId']+')','ownerid@odata.bind':_0xce75('0x27')+_0x17ae7a[_0xce75('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x2d152d[_0xce75('0x45')],_0x38b6dc,_0x2d152d[_0xce75('0x46')])),'headers':{'Authorization':_0xce75('0x28')+_0x5abe0a,'OData-Version':_0xce75('0x16')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2d152d[_0xce75('0x46')]===_0xce75('0x47')){_0x3de121={'method':'POST','uri':_0x256d3f+_0xce75('0x48'),'body':Object[_0xce75('0x40')]({},{'subject':intUtil[_0xce75('0x41')](_0x2d152d['Subjects'],_0x38b6dc,'\x20'),'phonenumber':String(_0x38b6dc[_0xce75('0x49')]),'description':intUtil[_0xce75('0x41')](_0x2d152d[_0xce75('0x43')],_0x38b6dc,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x17ae7a[_0xce75('0x2d')]+')','ownerid@odata.bind':_0xce75('0x27')+_0x17ae7a[_0xce75('0x21')]+')','directioncode':_0x17ae7a[_0xce75('0x4a')]===_0xce75('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x17ae7a[_0xce75('0x21')]+')','participationtypemask':_0x17ae7a[_0xce75('0x4a')]===_0xce75('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0xce75('0x44')+_0x17ae7a[_0xce75('0x2d')]+')','participationtypemask':_0x17ae7a[_0xce75('0x4a')]===_0xce75('0x4b')?0x1:0x2}]},getCustomFields(_0x2d152d[_0xce75('0x45')],_0x38b6dc,_0x2d152d[_0xce75('0x46')])),'headers':{'Authorization':_0xce75('0x28')+_0x5abe0a,'OData-Version':_0xce75('0x16')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3de121);})[_0xce75('0xf')](function(_0x6a9c11){var _0x2b7131=_0x6a9c11['headers']['odata-entityid'];var _0x319cd7=_0x2b7131[_0xce75('0x2b')](_0x2b7131[_0xce75('0x2c')]('(')+0x1,_0x2b7131[_0xce75('0x2c')](')'));_0x17ae7a[_0xce75('0x4c')]=_0x319cd7;_0x184db8(_0x17ae7a);})[_0xce75('0x24')](function(_0x35632e){_0x5d20c1(_0x35632e[_0xce75('0x14')]);});});}function emit(_0x31e2de,_0xcbebea,_0x2c0b2c,_0x320783){var _0x54e096={'uri':util['format'](_0xce75('0x4d'),_0x31e2de,_0x2c0b2c,_0x320783)};io['to'](util['format'](_0xce75('0x4e'),_0xcbebea))['emit'](_0xce75('0x4f'),_0x54e096);}exports['cs']=function(_0x3e55ad,_0x2875ad,_0x555939,_0x3c4b9b,_0x45baa2,_0x284085,_0x44882a,_0x232df2){var _0x2a3151={};_0x284085[_0xce75('0xd')]=intUtil[_0xce75('0x50')](_0x284085[_0xce75('0xd')]);_0x284085[_0xce75('0x51')]=intUtil['stripTrailingSlash'](_0x284085[_0xce75('0x51')]);_0x2a3151[_0xce75('0x4a')]=_0x232df2===_0xce75('0x4b')||_0x232df2==='unmanaged'?'queue':_0xce75('0x25');var _0x411f99=util[_0xce75('0x52')](_0xce75('0x53'),_0x284085[_0xce75('0xd')]);var _0x34122b=util[_0xce75('0x52')](_0xce75('0x54'),_0x284085[_0xce75('0x55')]);var _0x2b9091=util[_0xce75('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x284085['serverUrl'],_0x2875ad[_0xce75('0x56')],md5(_0x2875ad[_0xce75('0x56')]));if(_0x45baa2&&_0x45baa2[_0xce75('0x57')]){logger[_0xce75('0x1e')](_0xce75('0x58'),_0xce75('0x59'));_0x2875ad['recordingURL']=_0x2b9091;}else if(_0x44882a&&_0x44882a[_0xce75('0x5a')]&&_0x44882a['recordingFormat']!==_0xce75('0x5b')){logger['info'](_0xce75('0x5c'),_0xce75('0x59'));_0x2875ad[_0xce75('0x5d')]=_0x2b9091;}else{_0x2875ad[_0xce75('0x5d')]='';}return getUser(_0x2a3151,_0x284085,_0x3c4b9b,_0x34122b,_0x411f99,_0x232df2)[_0xce75('0xf')](function(_0x287191){logger[_0xce75('0x1e')]('['+_0x232df2[_0xce75('0x12')]()+_0xce75('0x5e'),_0x287191[_0xce75('0x21')]);logger['info']('['+_0x232df2[_0xce75('0x12')]()+_0xce75('0x5f'),_0x287191['userEmail']);return getEndUser(_0x287191,_0x284085,_0x34122b,_0x411f99,_0x2875ad,_0x232df2);})['then'](function(_0x4ff532){logger[_0xce75('0x1e')]('['+_0x232df2['toUpperCase']()+_0xce75('0x60'),_0x4ff532[_0xce75('0x2d')]);logger[_0xce75('0x1e')]('['+_0x232df2[_0xce75('0x12')]()+_0xce75('0x61'),_0x2875ad['calleridnum']);return getTicket(_0x4ff532,_0x284085,_0x34122b,_0x411f99,_0x2875ad,_0x555939,_0x232df2);})[_0xce75('0xf')](function(_0x3cf9fb){logger[_0xce75('0x1e')](util[_0xce75('0x52')]('['+_0x232df2[_0xce75('0x12')]()+_0xce75('0x62'),_0x555939[_0xce75('0x46')],_0x3cf9fb[_0xce75('0x4c')]));logger['info'](util[_0xce75('0x52')]('['+_0x232df2[_0xce75('0x12')]()+_0xce75('0x63'),_0x232df2));if(_0x232df2!=='unmanaged'){logger[_0xce75('0x1e')]('['+_0x232df2['toUpperCase']()+']',_0xce75('0x64'));emit(_0x284085['remoteUri'],_0x3c4b9b['name'],_0x555939[_0xce75('0x46')],_0x3cf9fb[_0xce75('0x4c')]);}})[_0xce75('0x24')](function(_0x158a7e){logger[_0xce75('0x11')]('['+_0x232df2['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xce75('0x65')](_0x158a7e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index ddf3647..d424c55 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 _0x34d2=['Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','stringify','GET','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','lastevent','toUpperCase','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','info'];(function(_0x4d9b26,_0x287573){var _0x3cce89=function(_0x2e62bf){while(--_0x2e62bf){_0x4d9b26['push'](_0x4d9b26['shift']());}};_0x3cce89(++_0x287573);}(_0x34d2,0x1ad));var _0x234d=function(_0x1c0fc6,_0x216b51){_0x1c0fc6=_0x1c0fc6-0x0;var _0x4fb60b=_0x34d2[_0x1c0fc6];return _0x4fb60b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x234d('0x0'));var util=require(_0x234d('0x1'));var Redis=require(_0x234d('0x2'));var intUtil=require(_0x234d('0x3'));var config=require(_0x234d('0x4'));var logger=require(_0x234d('0x5'))(_0x234d('0x6'));config['redis']=_[_0x234d('0x7')](config[_0x234d('0x8')],{'host':_0x234d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x234d('0x8')]));var headers={'Content-Type':_0x234d('0xa'),'Accept':_0x234d('0xa')};function emit(_0x4b0280,_0x2b68ca,_0x278022){io['to'](_0x4b0280)[_0x234d('0xb')](_0x2b68ca,_0x278022);}function getTicket(_0x1f481d,_0x3619e6,_0x4128ea,_0x1dfe13,_0x54e33a){logger['info'](_0x234d('0xc'));var _0x15b0c6=_['merge']({'responder_id':_0x3619e6['id'],'requester_id':_0x4128ea['id'],'name':util[_0x234d('0xd')](_0x234d('0xe'),_0x54e33a[_0x234d('0xf')]),'phone':_0x54e33a['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x234d('0x10')](_0x1dfe13[_0x234d('0x11')],_0x54e33a,'\x20'),'description':intUtil[_0x234d('0x10')](_0x1dfe13[_0x234d('0x12')],_0x54e33a,_0x234d('0x13')),'tags':getTags(_0x1dfe13[_0x234d('0x14')],_0x234d('0x15'))},getCustomFields(_0x1dfe13[_0x234d('0x16')],_0x54e33a));_0x15b0c6[_0x234d('0x17')]=_[_0x234d('0x18')](_[_0x234d('0x19')](_0x15b0c6[_0x234d('0x17')],'id'),_0x234d('0x1a'));return request({'uri':util[_0x234d('0xd')](_0x234d('0x1b'),_0x1f481d['remoteUri']),'method':_0x234d('0x1c'),'body':_0x15b0c6})[_0x234d('0x1d')](function(_0x18680b){logger[_0x234d('0x1e')](_0x234d('0x1f'));return _0x18680b;});}function getUser(_0x1f89a7,_0x447f05){if(intUtil[_0x234d('0x20')](_0x447f05)){return request({'uri':util[_0x234d('0xd')](_0x234d('0x21'),_0x1f89a7[_0x234d('0x22')]),'qs':{'email':_0x447f05}})[_0x234d('0x1d')](function(_0x11bcd5){if(_0x11bcd5[_0x234d('0x23')]){logger['info'](_0x234d('0x24'));return _['find'](_0x11bcd5,function(_0x1dde74){return _0x1dde74[_0x234d('0x25')][_0x234d('0x26')]===_0x447f05;});}else{logger[_0x234d('0x1e')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x234d('0x27'),_0x1f89a7[_0x234d('0x22')])})['then'](function(_0x53f908){logger[_0x234d('0x1e')]('Admin\x20account\x20selected.');return _0x53f908;});}});}else{logger[_0x234d('0x1e')](_0x234d('0x28'));return request({'uri':util['format'](_0x234d('0x27'),_0x1f89a7[_0x234d('0x22')])})['then'](function(_0x329a6f){logger[_0x234d('0x1e')](_0x234d('0x29'));return _0x329a6f;});}}function getEndUser(_0x3b9b72,_0x531ea,_0x19504b){logger[_0x234d('0x1e')](_0x234d('0x2a'),_0x19504b);return request({'uri':util[_0x234d('0xd')]('%s/api/v2/contacts',_0x3b9b72[_0x234d('0x22')]),'qs':{'phone':_0x19504b}})['then'](function(_0x3a719d){if(_0x3a719d[_0x234d('0x23')]){logger[_0x234d('0x1e')](_0x234d('0x2b'));return _['find'](_0x3a719d,{'phone':_0x19504b});}else{logger[_0x234d('0x1e')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x234d('0xd')](_0x234d('0x2c'),_0x3b9b72['remoteUri']),'method':_0x234d('0x1c'),'body':{'name':_0x531ea,'phone':_0x19504b}})[_0x234d('0x1d')](function(_0x49bb4c){logger[_0x234d('0x1e')](_0x234d('0x2d'));return _0x49bb4c;});}});}function getAuth(_0x379589){return util[_0x234d('0xd')]('Basic\x20%s',new Buffer(_0x379589[_0x234d('0x2e')]+':X')[_0x234d('0x2f')](_0x234d('0x30')));}function request(_0x45e531){logger['debug']('[HTTP]',JSON[_0x234d('0x31')](_0x45e531));return rp(_[_0x234d('0x7')](_0x45e531,{'method':_0x234d('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x2fe4eb,_0x20817d){var _0x4a2d76=[];if(_0x2fe4eb&&_0x2fe4eb['length']>0x0){_0x4a2d76=_[_0x234d('0x33')](_0x2fe4eb,_0x20817d);}return _0x4a2d76;}function getCustomFields(_0x5f0130,_0x5c3ae5){var _0xff2cfc=[];var _0x28a572={'custom_fields':[]};if(_0x5f0130[_0x234d('0x23')]>0x0){_[_0x234d('0x34')](_0x5f0130,function(_0x30a7ee){if(_[_0x234d('0x35')]([_0x234d('0x36'),'picklist'],_0x30a7ee[_0x234d('0x37')])&&_0x30a7ee[_0x234d('0x38')]&&!_0x30a7ee[_0x234d('0x39')]){_0x28a572[_0x30a7ee[_0x234d('0x38')][_0x234d('0x3a')]()]=_0x30a7ee[_0x234d('0x3b')][_0x234d('0x2f')]();}else if(_['includes']([_0x234d('0x36'),_0x234d('0x3c')],_0x30a7ee[_0x234d('0x37')])&&_0x30a7ee[_0x234d('0x3d')]&&_0x30a7ee['customField']){_0x28a572[_0x234d('0x17')][_0x234d('0x3e')]({'id':_0x30a7ee[_0x234d('0x3d')],'value':_0x30a7ee[_0x234d('0x3b')][_0x234d('0x2f')]()});}else if(_0x30a7ee[_0x234d('0x37')]===_0x234d('0x3f')&&_0x30a7ee['variableName']&&_0x30a7ee['idField']&&_0x30a7ee[_0x234d('0x39')]){_0x5c3ae5[_0x30a7ee[_0x234d('0x40')]]&&_0x28a572['custom_fields'][_0x234d('0x3e')]({'id':_0x30a7ee[_0x234d('0x3d')],'value':_0x5c3ae5[_0x30a7ee['variableName']]['toString']()});}else if(_0x30a7ee[_0x234d('0x37')]===_0x234d('0x41')&&_0x30a7ee[_0x234d('0x42')]&&_0x30a7ee['Variable'][_0x234d('0x15')]&&_0x30a7ee[_0x234d('0x3d')]&&_0x30a7ee[_0x234d('0x39')]){_0x5c3ae5[_0x30a7ee['Variable'][_0x234d('0x15')][_0x234d('0x3a')]()]&&_0x28a572['custom_fields'][_0x234d('0x3e')]({'id':_0x30a7ee[_0x234d('0x3d')],'value':_0x5c3ae5[_0x30a7ee[_0x234d('0x42')][_0x234d('0x15')]['toLowerCase']()][_0x234d('0x2f')]()});}});}return _0x28a572;}exports[_0x234d('0x43')]=function(_0x2af8dc,_0x4a6aa7,_0x420cdc,_0x2a0282,_0xa0100a,_0x1c784d){var _0x3e4319,_0x27ac97;_0x1c784d[_0x234d('0x22')]=intUtil['stripTrailingSlash'](_0x1c784d[_0x234d('0x22')]);_0x1c784d[_0x234d('0x44')]=intUtil['stripTrailingSlash'](_0x1c784d['serverUrl']);if(_0xa0100a&&_0xa0100a['monitor_format']){logger[_0x234d('0x1e')]('[QUEUE]',_0x234d('0x45'));_0x4a6aa7[_0x234d('0x46')]=util[_0x234d('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c784d['serverUrl'],_0x4a6aa7[_0x234d('0x47')],md5(_0x4a6aa7[_0x234d('0x47')]));}else{_0x4a6aa7[_0x234d('0x46')]='';}headers[_0x234d('0x48')]=getAuth(_0x1c784d);return getUser(_0x1c784d,_0x2a0282[_0x234d('0x26')])[_0x234d('0x1d')](function(_0x58fee7){_0x3e4319=_0x58fee7;logger['info'](_0x234d('0x49'),_0x3e4319['id']);return getEndUser(_0x1c784d,_0x4a6aa7[_0x234d('0xf')],_0x4a6aa7[_0x234d('0x4a')]);})[_0x234d('0x1d')](function(_0x113580){_0x27ac97=_0x113580;logger[_0x234d('0x1e')](_0x234d('0x4b'),_0x27ac97['id']);return getTicket(_0x1c784d,_0x3e4319,_0x27ac97,_0x420cdc,_0x4a6aa7);})[_0x234d('0x1d')](function(_0x4fefd7){if(_0x4fefd7&&_0x4fefd7['id']){logger[_0x234d('0x1e')]('Ticket\x20created!');logger[_0x234d('0x1e')](_0x234d('0x4c'),_0x4fefd7['id']);logger[_0x234d('0x1e')](_0x234d('0x4d'),_0x234d('0x4e'));emit(util['format'](_0x234d('0x4f'),_0x2a0282['name']),_0x234d('0x50'),{'uri':util[_0x234d('0xd')](_0x234d('0x51'),_0x1c784d[_0x234d('0x22')],_0x4fefd7['id'])});}})[_0x234d('0x52')](function(_0x3d51c2){logger[_0x234d('0x53')](_0x234d('0x4d'),JSON[_0x234d('0x31')](_0x3d51c2));});};exports['outbound']=function(_0x21ec16,_0x5e0cae,_0x318195,_0x4734a9,_0x5be58c,_0x39031e,_0x1414e1){var _0x505936,_0x5d3b3c;_0x39031e[_0x234d('0x22')]=intUtil[_0x234d('0x54')](_0x39031e[_0x234d('0x22')]);_0x39031e[_0x234d('0x44')]=intUtil[_0x234d('0x54')](_0x39031e['serverUrl']);if(_0x1414e1&&_0x1414e1['recordingFormat']&&_0x1414e1[_0x234d('0x55')]!==_0x234d('0x56')){logger[_0x234d('0x1e')](_0x234d('0x57'),'Recording\x20is\x20enabled!');_0x5e0cae['recordingURL']=util[_0x234d('0xd')](_0x234d('0x58'),_0x39031e[_0x234d('0x44')],_0x5e0cae[_0x234d('0x47')],md5(_0x5e0cae[_0x234d('0x47')]));}headers[_0x234d('0x48')]=getAuth(_0x39031e);return getUser(_0x39031e,_0x4734a9[_0x234d('0x26')])['then'](function(_0x1955c1){_0x505936=_0x1955c1;logger[_0x234d('0x1e')](_0x234d('0x49'),_0x505936['id']);return getEndUser(_0x39031e,_0x5e0cae['destcalleridname'],_0x5e0cae[_0x234d('0x59')]);})[_0x234d('0x1d')](function(_0x596f9c){_0x5d3b3c=_0x596f9c;logger[_0x234d('0x1e')](_0x234d('0x4b'),_0x5d3b3c['id']);return getTicket(_0x39031e,_0x505936,_0x5d3b3c,_0x318195,_0x5e0cae);})[_0x234d('0x1d')](function(_0x51f6d2){if(_0x51f6d2&&_0x51f6d2['id']){logger[_0x234d('0x1e')]('Ticket\x20created!');logger[_0x234d('0x1e')](_0x234d('0x4c'),_0x51f6d2['id']);logger[_0x234d('0x1e')](_0x234d('0x57'),_0x234d('0x4e'));emit(util[_0x234d('0xd')](_0x234d('0x4f'),_0x4734a9[_0x234d('0x15')]),_0x234d('0x50'),{'uri':util[_0x234d('0xd')](_0x234d('0x51'),_0x39031e['remoteUri'],_0x51f6d2['id'])});}})[_0x234d('0x52')](function(_0x4995c8){logger['error'](_0x234d('0x57'),JSON[_0x234d('0x31')](_0x4995c8));});};exports['unmanaged']=function(_0x52aed5,_0x5e7353,_0x3501b3,_0xae67f,_0x416952,_0x8c89e8){var _0x5bed6b,_0x43fbde;_0x8c89e8['remoteUri']=intUtil[_0x234d('0x54')](_0x8c89e8[_0x234d('0x22')]);_0x8c89e8[_0x234d('0x44')]=intUtil[_0x234d('0x54')](_0x8c89e8['serverUrl']);if(_0x416952&&_0x416952['monitor_format']){logger[_0x234d('0x1e')]('['+_0x5e7353[_0x234d('0x5a')][_0x234d('0x5b')]()+']',_0x234d('0x45'));_0x5e7353['recordingURL']=util['format'](_0x234d('0x58'),_0x8c89e8[_0x234d('0x44')],_0x5e7353[_0x234d('0x47')],md5(_0x5e7353['uniqueid']));}else{_0x5e7353['recordingURL']='';}headers['Authorization']=getAuth(_0x8c89e8);return getUser(_0x8c89e8,'')[_0x234d('0x1d')](function(_0x49426c){_0x5bed6b=_0x49426c;logger[_0x234d('0x1e')](_0x234d('0x49'),_0x5bed6b['id']);return getEndUser(_0x8c89e8,_0x5e7353[_0x234d('0xf')],_0x5e7353[_0x234d('0x4a')]);})[_0x234d('0x1d')](function(_0x500f2c){_0x43fbde=_0x500f2c;logger[_0x234d('0x1e')]('The\x20Enduser\x20ID\x20is:',_0x43fbde['id']);return getTicket(_0x8c89e8,_0x5bed6b,_0x43fbde,_0x3501b3,_0x5e7353);})[_0x234d('0x1d')](function(_0x263128){if(_0x263128){logger[_0x234d('0x1e')](_0x234d('0x1f'));logger[_0x234d('0x1e')](_0x234d('0x4c'),_0x263128['id']);}})['catch'](function(_0x39cf08){logger['error']('['+_0x5e7353[_0x234d('0x5a')][_0x234d('0x5b')]()+']',JSON[_0x234d('0x31')](_0x39cf08));});}; \ No newline at end of file +var _0xebd5=['queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','redis','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','
','Tags','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','find','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','variableName','push','Variable','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebd5,0x193));var _0x5ebd=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xebd5[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x5ebd('0x0'));var rp=require(_0x5ebd('0x1'));var md5=require(_0x5ebd('0x2'));var util=require(_0x5ebd('0x3'));var Redis=require(_0x5ebd('0x4'));var intUtil=require(_0x5ebd('0x5'));var config=require(_0x5ebd('0x6'));var logger=require(_0x5ebd('0x7'))('freshdesk');config['redis']=_[_0x5ebd('0x8')](config['redis'],{'host':_0x5ebd('0x9'),'port':0x18eb});var io=require(_0x5ebd('0xa'))(new Redis(config[_0x5ebd('0xb')]));var headers={'Content-Type':_0x5ebd('0xc'),'Accept':_0x5ebd('0xc')};function emit(_0x44fa4e,_0x3ab3b1,_0x4e06da){io['to'](_0x44fa4e)['emit'](_0x3ab3b1,_0x4e06da);}function getTicket(_0x467dba,_0x10c337,_0x5703dd,_0x4f2b3e,_0x4cfd4d){logger[_0x5ebd('0xd')](_0x5ebd('0xe'));var _0x4871fc=_[_0x5ebd('0xf')]({'responder_id':_0x10c337['id'],'requester_id':_0x5703dd['id'],'name':util['format'](_0x5ebd('0x10'),_0x4cfd4d[_0x5ebd('0x11')]),'phone':_0x4cfd4d[_0x5ebd('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4f2b3e[_0x5ebd('0x13')],_0x4cfd4d,'\x20'),'description':intUtil['getString'](_0x4f2b3e['Descriptions'],_0x4cfd4d,_0x5ebd('0x14')),'tags':getTags(_0x4f2b3e[_0x5ebd('0x15')],'name')},getCustomFields(_0x4f2b3e[_0x5ebd('0x16')],_0x4cfd4d));_0x4871fc[_0x5ebd('0x17')]=_[_0x5ebd('0x18')](_[_0x5ebd('0x19')](_0x4871fc[_0x5ebd('0x17')],'id'),_0x5ebd('0x1a'));return request({'uri':util[_0x5ebd('0x1b')](_0x5ebd('0x1c'),_0x467dba[_0x5ebd('0x1d')]),'method':'POST','body':_0x4871fc})['then'](function(_0x3edb69){logger[_0x5ebd('0xd')](_0x5ebd('0x1e'));return _0x3edb69;});}function getUser(_0x329e56,_0x4217e1){if(intUtil[_0x5ebd('0x1f')](_0x4217e1)){return request({'uri':util[_0x5ebd('0x1b')]('%s/api/v2/agents',_0x329e56[_0x5ebd('0x1d')]),'qs':{'email':_0x4217e1}})[_0x5ebd('0x20')](function(_0x5cd28b){if(_0x5cd28b[_0x5ebd('0x21')]){logger['info'](_0x5ebd('0x22'));return _['find'](_0x5cd28b,function(_0x509a37){return _0x509a37[_0x5ebd('0x23')]['email']===_0x4217e1;});}else{logger['info'](_0x5ebd('0x24'));return request({'uri':util[_0x5ebd('0x1b')](_0x5ebd('0x25'),_0x329e56[_0x5ebd('0x1d')])})[_0x5ebd('0x20')](function(_0x1442f9){logger['info'](_0x5ebd('0x26'));return _0x1442f9;});}});}else{logger[_0x5ebd('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5ebd('0x1b')](_0x5ebd('0x25'),_0x329e56[_0x5ebd('0x1d')])})[_0x5ebd('0x20')](function(_0x516ae0){logger[_0x5ebd('0xd')]('Admin\x20account\x20selected.');return _0x516ae0;});}}function getEndUser(_0x1f89e7,_0x5e325e,_0x18fd66){logger[_0x5ebd('0xd')]('Searching\x20enduser\x20with\x20phone',_0x18fd66);return request({'uri':util[_0x5ebd('0x1b')](_0x5ebd('0x27'),_0x1f89e7['remoteUri']),'qs':{'phone':_0x18fd66}})[_0x5ebd('0x20')](function(_0x3c78fa){if(_0x3c78fa['length']){logger[_0x5ebd('0xd')](_0x5ebd('0x28'));return _[_0x5ebd('0x29')](_0x3c78fa,{'phone':_0x18fd66});}else{logger[_0x5ebd('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x5ebd('0x1b')](_0x5ebd('0x27'),_0x1f89e7[_0x5ebd('0x1d')]),'method':_0x5ebd('0x2a'),'body':{'name':_0x5e325e,'phone':_0x18fd66}})[_0x5ebd('0x20')](function(_0x2667d9){logger[_0x5ebd('0xd')](_0x5ebd('0x2b'));return _0x2667d9;});}});}function getAuth(_0x2ce1a1){return util[_0x5ebd('0x1b')](_0x5ebd('0x2c'),new Buffer(_0x2ce1a1[_0x5ebd('0x2d')]+':X')[_0x5ebd('0x2e')](_0x5ebd('0x2f')));}function request(_0x89e5ce){logger[_0x5ebd('0x30')](_0x5ebd('0x31'),JSON[_0x5ebd('0x32')](_0x89e5ce));return rp(_[_0x5ebd('0x8')](_0x89e5ce,{'method':_0x5ebd('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x39cfcf,_0x186bab){var _0x312891=[];if(_0x39cfcf&&_0x39cfcf[_0x5ebd('0x21')]>0x0){_0x312891=_[_0x5ebd('0x34')](_0x39cfcf,_0x186bab);}return _0x312891;}function getCustomFields(_0x3b328e,_0x4532e0){var _0x59d301=[];var _0x5ca537={'custom_fields':[]};if(_0x3b328e[_0x5ebd('0x21')]>0x0){_[_0x5ebd('0x35')](_0x3b328e,function(_0x1006b7){if(_['includes']([_0x5ebd('0x36'),_0x5ebd('0x37')],_0x1006b7[_0x5ebd('0x38')])&&_0x1006b7[_0x5ebd('0x39')]&&!_0x1006b7[_0x5ebd('0x3a')]){_0x5ca537[_0x1006b7[_0x5ebd('0x39')][_0x5ebd('0x3b')]()]=_0x1006b7[_0x5ebd('0x3c')][_0x5ebd('0x2e')]();}else if(_[_0x5ebd('0x3d')]([_0x5ebd('0x36'),'picklist'],_0x1006b7[_0x5ebd('0x38')])&&_0x1006b7[_0x5ebd('0x3e')]&&_0x1006b7[_0x5ebd('0x3a')]){_0x5ca537[_0x5ebd('0x17')]['push']({'id':_0x1006b7['idField'],'value':_0x1006b7['content'][_0x5ebd('0x2e')]()});}else if(_0x1006b7['type']==='variable'&&_0x1006b7[_0x5ebd('0x3f')]&&_0x1006b7['idField']&&_0x1006b7[_0x5ebd('0x3a')]){_0x4532e0[_0x1006b7[_0x5ebd('0x3f')]]&&_0x5ca537['custom_fields'][_0x5ebd('0x40')]({'id':_0x1006b7[_0x5ebd('0x3e')],'value':_0x4532e0[_0x1006b7['variableName']][_0x5ebd('0x2e')]()});}else if(_0x1006b7[_0x5ebd('0x38')]==='customVariable'&&_0x1006b7[_0x5ebd('0x41')]&&_0x1006b7[_0x5ebd('0x41')]['name']&&_0x1006b7[_0x5ebd('0x3e')]&&_0x1006b7[_0x5ebd('0x3a')]){_0x4532e0[_0x1006b7[_0x5ebd('0x41')]['name'][_0x5ebd('0x3b')]()]&&_0x5ca537[_0x5ebd('0x17')][_0x5ebd('0x40')]({'id':_0x1006b7[_0x5ebd('0x3e')],'value':_0x4532e0[_0x1006b7[_0x5ebd('0x41')][_0x5ebd('0x42')][_0x5ebd('0x3b')]()]['toString']()});}});}return _0x5ca537;}exports[_0x5ebd('0x43')]=function(_0x575511,_0xf5585a,_0x8e12df,_0x1ba384,_0xbc5fd7,_0x4a94c8){var _0x49c5c9,_0x50ea4f;_0x4a94c8[_0x5ebd('0x1d')]=intUtil[_0x5ebd('0x44')](_0x4a94c8['remoteUri']);_0x4a94c8['serverUrl']=intUtil[_0x5ebd('0x44')](_0x4a94c8['serverUrl']);if(_0xbc5fd7&&_0xbc5fd7[_0x5ebd('0x45')]){logger[_0x5ebd('0xd')](_0x5ebd('0x46'),_0x5ebd('0x47'));_0xf5585a['recordingURL']=util['format'](_0x5ebd('0x48'),_0x4a94c8['serverUrl'],_0xf5585a[_0x5ebd('0x49')],md5(_0xf5585a[_0x5ebd('0x49')]));}else{_0xf5585a[_0x5ebd('0x4a')]='';}headers[_0x5ebd('0x4b')]=getAuth(_0x4a94c8);return getUser(_0x4a94c8,_0x1ba384[_0x5ebd('0x4c')])[_0x5ebd('0x20')](function(_0x3d6a6d){_0x49c5c9=_0x3d6a6d;logger['info']('The\x20User\x20ID\x20is:',_0x49c5c9['id']);return getEndUser(_0x4a94c8,_0xf5585a[_0x5ebd('0x11')],_0xf5585a[_0x5ebd('0x12')]);})[_0x5ebd('0x20')](function(_0x57935f){_0x50ea4f=_0x57935f;logger[_0x5ebd('0xd')](_0x5ebd('0x4d'),_0x50ea4f['id']);return getTicket(_0x4a94c8,_0x49c5c9,_0x50ea4f,_0x8e12df,_0xf5585a);})[_0x5ebd('0x20')](function(_0x20e3a6){if(_0x20e3a6&&_0x20e3a6['id']){logger[_0x5ebd('0xd')](_0x5ebd('0x1e'));logger[_0x5ebd('0xd')](_0x5ebd('0x4e'),_0x20e3a6['id']);logger[_0x5ebd('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5ebd('0x1b')](_0x5ebd('0x4f'),_0x1ba384[_0x5ebd('0x42')]),_0x5ebd('0x50'),{'uri':util[_0x5ebd('0x1b')](_0x5ebd('0x51'),_0x4a94c8['remoteUri'],_0x20e3a6['id'])});}})[_0x5ebd('0x52')](function(_0x44f112){logger[_0x5ebd('0x53')]('[QUEUE]',JSON[_0x5ebd('0x32')](_0x44f112));});};exports[_0x5ebd('0x54')]=function(_0x206774,_0x1eb078,_0x47c416,_0x20e63c,_0x28004d,_0x1eaaba,_0x53082c){var _0x5aab8d,_0x4bd593;_0x1eaaba[_0x5ebd('0x1d')]=intUtil['stripTrailingSlash'](_0x1eaaba[_0x5ebd('0x1d')]);_0x1eaaba[_0x5ebd('0x55')]=intUtil['stripTrailingSlash'](_0x1eaaba[_0x5ebd('0x55')]);if(_0x53082c&&_0x53082c[_0x5ebd('0x56')]&&_0x53082c[_0x5ebd('0x56')]!==_0x5ebd('0x57')){logger[_0x5ebd('0xd')](_0x5ebd('0x58'),_0x5ebd('0x47'));_0x1eb078[_0x5ebd('0x4a')]=util['format'](_0x5ebd('0x48'),_0x1eaaba[_0x5ebd('0x55')],_0x1eb078[_0x5ebd('0x49')],md5(_0x1eb078[_0x5ebd('0x49')]));}headers[_0x5ebd('0x4b')]=getAuth(_0x1eaaba);return getUser(_0x1eaaba,_0x20e63c['email'])['then'](function(_0x31a297){_0x5aab8d=_0x31a297;logger[_0x5ebd('0xd')](_0x5ebd('0x59'),_0x5aab8d['id']);return getEndUser(_0x1eaaba,_0x1eb078[_0x5ebd('0x5a')],_0x1eb078[_0x5ebd('0x5b')]);})[_0x5ebd('0x20')](function(_0x4a809c){_0x4bd593=_0x4a809c;logger['info'](_0x5ebd('0x4d'),_0x4bd593['id']);return getTicket(_0x1eaaba,_0x5aab8d,_0x4bd593,_0x47c416,_0x1eb078);})[_0x5ebd('0x20')](function(_0x11618d){if(_0x11618d&&_0x11618d['id']){logger[_0x5ebd('0xd')]('Ticket\x20created!');logger[_0x5ebd('0xd')](_0x5ebd('0x4e'),_0x11618d['id']);logger[_0x5ebd('0xd')](_0x5ebd('0x58'),_0x5ebd('0x5c'));emit(util['format'](_0x5ebd('0x4f'),_0x20e63c[_0x5ebd('0x42')]),_0x5ebd('0x50'),{'uri':util[_0x5ebd('0x1b')](_0x5ebd('0x51'),_0x1eaaba[_0x5ebd('0x1d')],_0x11618d['id'])});}})[_0x5ebd('0x52')](function(_0x406c2e){logger[_0x5ebd('0x53')]('[OUTBOUND]',JSON[_0x5ebd('0x32')](_0x406c2e));});};exports['unmanaged']=function(_0x43f561,_0x5b347a,_0x4ad984,_0x2fad6b,_0x4456f6,_0x1e9a9c){var _0x35470b,_0x1c212a;_0x1e9a9c[_0x5ebd('0x1d')]=intUtil[_0x5ebd('0x44')](_0x1e9a9c[_0x5ebd('0x1d')]);_0x1e9a9c['serverUrl']=intUtil[_0x5ebd('0x44')](_0x1e9a9c['serverUrl']);if(_0x4456f6&&_0x4456f6[_0x5ebd('0x45')]){logger[_0x5ebd('0xd')]('['+_0x5b347a[_0x5ebd('0x5d')]['toUpperCase']()+']',_0x5ebd('0x47'));_0x5b347a[_0x5ebd('0x4a')]=util[_0x5ebd('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e9a9c[_0x5ebd('0x55')],_0x5b347a['uniqueid'],md5(_0x5b347a['uniqueid']));}else{_0x5b347a[_0x5ebd('0x4a')]='';}headers['Authorization']=getAuth(_0x1e9a9c);return getUser(_0x1e9a9c,'')['then'](function(_0x436a74){_0x35470b=_0x436a74;logger[_0x5ebd('0xd')]('The\x20User\x20ID\x20is:',_0x35470b['id']);return getEndUser(_0x1e9a9c,_0x5b347a[_0x5ebd('0x11')],_0x5b347a['calleridnum']);})[_0x5ebd('0x20')](function(_0x2a41c9){_0x1c212a=_0x2a41c9;logger[_0x5ebd('0xd')](_0x5ebd('0x4d'),_0x1c212a['id']);return getTicket(_0x1e9a9c,_0x35470b,_0x1c212a,_0x4ad984,_0x5b347a);})[_0x5ebd('0x20')](function(_0x462796){if(_0x462796){logger[_0x5ebd('0xd')]('Ticket\x20created!');logger[_0x5ebd('0xd')]('The\x20Ticket\x20ID\x20is:',_0x462796['id']);}})[_0x5ebd('0x52')](function(_0x5a77b3){logger[_0x5ebd('0x53')]('['+_0x5b347a[_0x5ebd('0x5d')]['toUpperCase']()+']',JSON[_0x5ebd('0x32')](_0x5a77b3));});}; \ 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 7bfe955..fdb5127 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 _0x9ca3=['contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','add','Task\x20created:','ticketId','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','message','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s'];(function(_0x4299c1,_0x2d1416){var _0x1b6dbd=function(_0x3cde6f){while(--_0x3cde6f){_0x4299c1['push'](_0x4299c1['shift']());}};_0x1b6dbd(++_0x2d1416);}(_0x9ca3,0x7d));var _0x39ca=function(_0x180dfa,_0x3a21db){_0x180dfa=_0x180dfa-0x0;var _0x530cf7=_0x9ca3[_0x180dfa];return _0x530cf7;};'use strict';var _=require(_0x39ca('0x0'));var rp=require(_0x39ca('0x1'));var md5=require('md5');var util=require(_0x39ca('0x2'));var moment=require(_0x39ca('0x3'));var Promise=require(_0x39ca('0x4'));var Redis=require(_0x39ca('0x5'));var intUtil=require(_0x39ca('0x6'));var config=require(_0x39ca('0x7'));var logger=require('../../../../config/logger')(_0x39ca('0x8'));config['redis']=_[_0x39ca('0x9')](config[_0x39ca('0xa')],{'host':_0x39ca('0xb'),'port':0x18eb});var io=require(_0x39ca('0xc'))(new Redis(config[_0x39ca('0xa')]));function getAdminId(_0x5b8a85,_0x31c41f,_0x281e12,_0x34aaf1){return new Promise(function(_0x328d83,_0x449fb9){var _0xa23451=![];var _0x568c87={'method':_0x39ca('0xd'),'uri':_0x34aaf1+_0x39ca('0xe'),'json':!![]};_0x568c87[_0x39ca('0xf')]=_0x281e12;logger[_0x39ca('0x10')](_0x39ca('0x11'));return rp(_0x568c87)[_0x39ca('0x12')](function(_0x3dac2b){if(_0x3dac2b){var _0x505223=_0x3dac2b[_0x39ca('0x13')];var _0x3451d2=null;for(_0x3451d2=0x0;_0x3451d2<_0x505223[_0x39ca('0x14')];_0x3451d2++){if(_0x505223[_0x3451d2][_0x39ca('0x15')]===_0x5b8a85[_0x39ca('0x16')]){_0x5b8a85[_0x39ca('0x17')]=_0x505223[_0x3451d2]['id'];_0xa23451=!![];}}if(_0xa23451){logger['info'](_0x39ca('0x18'),_0x5b8a85[_0x39ca('0x17')]);_0x328d83(_0x5b8a85);}else{_0x449fb9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x449fb9({'statusCode':0x194,'message':_0x39ca('0x19')});}})[_0x39ca('0x1a')](function(_0xbdb5f6){logger[_0x39ca('0x1b')]('['+[_0x31c41f[_0x39ca('0x1c')]()]+']',_0xbdb5f6['message']);_0x449fb9(_0xbdb5f6);});});}function getUser(_0x1dcd75,_0x221010,_0x3a349f){return function(_0x3fa86a){return new Promise(function(_0x59387a,_0x144e19){var _0x2ede5a={'method':_0x39ca('0xd'),'uri':_0x3a349f+_0x39ca('0xe'),'json':!![]};_0x2ede5a[_0x39ca('0xf')]=_0x221010;logger[_0x39ca('0x10')](_0x39ca('0x1d'));return rp(_0x2ede5a)[_0x39ca('0x12')](function(_0x838449){if(_0x838449){var _0x5d5faf=_0x838449[_0x39ca('0x13')];var _0x48cd58=![];var _0x4bc88b=null;if(_0x3fa86a[_0x39ca('0x1e')]!==null){logger[_0x39ca('0x10')](_0x39ca('0x1f'),_0x3fa86a[_0x39ca('0x1e')]);_0x3fa86a['userEmail']=_0x3fa86a['agentEmail'];for(_0x4bc88b=0x0;_0x4bc88b<_0x5d5faf['length'];_0x4bc88b++){if(_0x5d5faf[_0x4bc88b][_0x39ca('0x15')]===_0x3fa86a['agentEmail']){_0x48cd58=!![];_0x3fa86a[_0x39ca('0x20')]=_0x5d5faf[_0x4bc88b]['id'];logger[_0x39ca('0x10')](_0x39ca('0x21'),_0x3fa86a[_0x39ca('0x20')]);}}}if(!_0x48cd58){logger[_0x39ca('0x10')](_0x39ca('0x22'));_0x3fa86a['userEmail']=_0x3fa86a[_0x39ca('0x16')];_0x3fa86a[_0x39ca('0x20')]=_0x3fa86a[_0x39ca('0x17')];_0x48cd58=!![];}if(_0x48cd58){_0x59387a(_0x3fa86a);}else{_0x144e19({'statusCode':0x194,'message':_0x39ca('0x19')});}}else{_0x144e19({'statusCode':0x194,'message':_0x39ca('0x19')});}})['catch'](function(_0x1fb007){logger[_0x39ca('0x1b')]('['+[_0x1dcd75[_0x39ca('0x1c')]()]+']',_0x1fb007[_0x39ca('0x23')]);_0x144e19(_0x1fb007);});});};}function searchContact(_0x5a44d6,_0x31653e,_0x567e35,_0x5183a7){return new Promise(function(_0x114ccc,_0x24c2bb){var _0xd50cac={'method':_0x39ca('0xd'),'headers':_0x31653e,'uri':_0x5a44d6+'/api/lookup?q='+_0x5183a7+_0x39ca('0x24')+_0x567e35+_0x39ca('0x25'),'json':!![]};rp(_0xd50cac)['then'](function(_0x13b59f){var _0x255043=_['find'](_0x13b59f[_0x39ca('0x26')]['contacts'],[_0x567e35,_0x5183a7]);_0x114ccc(_0x255043);})['catch'](function(_0x56edf2){_0x24c2bb(_0x56edf2);});});}function getEndUser(_0x4e1980,_0x384650,_0x53c77e){return function(_0xd1f579){return new Promise(function(_0x380ab6,_0x53589f){logger[_0x39ca('0x10')](util[_0x39ca('0x27')](_0x39ca('0x28'),_0xd1f579[_0x39ca('0x29')]));searchContact(_0x53c77e,_0x384650,_0x39ca('0x2a'),_0xd1f579[_0x39ca('0x29')])[_0x39ca('0x12')](function(_0x4ef2bf){if(_0x4ef2bf){_0xd1f579[_0x39ca('0x2b')]=_0x4ef2bf['id'];logger['info'](_0x39ca('0x2c'),_0xd1f579[_0x39ca('0x2b')]);return _0x380ab6(_0xd1f579);}searchContact(_0x53c77e,_0x384650,'work_number',_0xd1f579[_0x39ca('0x29')])[_0x39ca('0x12')](function(_0x5ddb95){if(_0x5ddb95){_0xd1f579[_0x39ca('0x2b')]=_0x5ddb95['id'];logger[_0x39ca('0x10')](_0x39ca('0x2d'),_0xd1f579[_0x39ca('0x2b')]);return _0x380ab6(_0xd1f579);}createEndUser(_0xd1f579,_0x4e1980,_0x384650,_0x53c77e)[_0x39ca('0x12')](function(_0x1bc49e){logger['info'](_0x39ca('0x2e'),_0x1bc49e[_0x39ca('0x2b')]);return _0x380ab6(_0x1bc49e);});});})['catch'](function(_0x5dc5b6){_0x53589f(_0x5dc5b6);});});};}function createEndUser(_0x4f652c,_0x4c9755,_0xb5c4bf,_0x474dcc){return new Promise(function(_0x2fe28c,_0x3390b8){var _0x2af364=moment();var _0x32bb44={'method':_0x39ca('0x2f'),'uri':_0x474dcc+_0x39ca('0x30'),'body':{'contact':{'last_name':_0x4f652c[_0x39ca('0x29')],'work_number':_0x4f652c['contactNumber'],'mobile_number':_0x4f652c[_0x39ca('0x29')],'owner_id':_0x4f652c['userId'],'created_at':_0x2af364[_0x39ca('0x27')](_0x39ca('0x31'))}},'json':!![]};_0x32bb44['headers']=_0xb5c4bf;logger[_0x39ca('0x10')](_0x39ca('0x32'));return rp(_0x32bb44)[_0x39ca('0x12')](function(_0x3ea899){_0x4f652c['endUserId']=_0x3ea899[_0x39ca('0x33')]['id'];_0x2fe28c(_0x4f652c);})['catch'](function(_0x51dc29){logger['error']('['+[_0x4c9755[_0x39ca('0x1c')]()]+']',_0x51dc29['message']);_0x3390b8(_0x51dc29[_0x39ca('0x23')]);});});}function getTicket(_0x275fe4,_0x29473a,_0x4e2654,_0x117285,_0x1c6ad3){return function(_0x5bcf77){logger[_0x39ca('0x10')](_0x39ca('0x34'));return new Promise(function(_0x313294,_0x260e29){var _0x34be18=moment();var _0xb434a4={'method':_0x39ca('0x2f'),'uri':_0x4e2654+_0x39ca('0x35'),'body':{'title':intUtil[_0x39ca('0x36')](_0x117285['Subjects'],_0x1c6ad3,'\x20'),'description':intUtil[_0x39ca('0x36')](_0x117285[_0x39ca('0x37')],_0x1c6ad3,'\x0a'),'owner_id':_0x5bcf77[_0x39ca('0x20')],'creater_id':_0x5bcf77['adminId'],'targetable_id':_0x5bcf77[_0x39ca('0x2b')],'targetable_type':'Contact','created_at':_0x34be18[_0x39ca('0x27')](_0x39ca('0x31')),'due_date':_0x34be18[_0x39ca('0x38')](0x1e,'m')[_0x39ca('0x27')](_0x39ca('0x31'))},'json':!![]};_0xb434a4[_0x39ca('0xf')]=_0x29473a;return rp(_0xb434a4)['then'](function(_0x58e565){_0x5bcf77['ticketId']=_0x58e565['task']['id'];logger[_0x39ca('0x10')](_0x39ca('0x39'),_0x5bcf77[_0x39ca('0x3a')]);_0x313294(_0x5bcf77);})['catch'](function(_0x480e7f){logger[_0x39ca('0x1b')]('['+[_0x275fe4['toUpperCase']()]+']',_0x480e7f[_0x39ca('0x23')]);_0x260e29(_0x480e7f['message']);});});};}function emit(_0x59125a,_0x1b359e,_0x52c429){var _0x259dc3={'uri':_0x59125a+'/contacts/'+_0x52c429};io['to'](util[_0x39ca('0x27')]('user:%s',_0x1b359e))[_0x39ca('0x3b')](_0x39ca('0x3c'),_0x259dc3);}exports['cs']=function(_0x5c9bcc,_0x372ee4,_0x250a93,_0x4c2f5d,_0x1b7ad9,_0x139db2,_0x94d8c6,_0x58b51b){var _0x59d069={};var _0xe3a0={'Authorization':_0x39ca('0x3d')+_0x139db2['apiKey']};_0x139db2[_0x39ca('0x3e')]=intUtil[_0x39ca('0x3f')](_0x139db2[_0x39ca('0x3e')]);_0x139db2[_0x39ca('0x40')]=intUtil[_0x39ca('0x3f')](_0x139db2['serverUrl']);var _0x6746b2=_0x139db2[_0x39ca('0x3e')];_0x59d069[_0x39ca('0x16')]=_0x139db2['username'];_0x59d069[_0x39ca('0x29')]=_0x58b51b[_0x39ca('0x41')]()===_0x39ca('0x42')?_0x372ee4[_0x39ca('0x43')]:_0x372ee4[_0x39ca('0x44')];_0x59d069['callDirection']=_0x58b51b===_0x39ca('0x45')||_0x58b51b===_0x39ca('0x46')?_0x39ca('0x45'):_0x39ca('0x42');if(_0x4c2f5d){_0x59d069[_0x39ca('0x1e')]=_0x4c2f5d['email'];}var _0x4b90c4=util[_0x39ca('0x27')](_0x39ca('0x47'),_0x139db2[_0x39ca('0x40')],_0x372ee4[_0x39ca('0x48')],md5(_0x372ee4['uniqueid']));if(_0x1b7ad9&&_0x1b7ad9['monitor_format']){logger['info'](_0x39ca('0x49'),_0x39ca('0x4a'));_0x372ee4[_0x39ca('0x4b')]=_0x4b90c4;}else if(_0x94d8c6&&_0x94d8c6[_0x39ca('0x4c')]&&_0x94d8c6[_0x39ca('0x4c')]!==_0x39ca('0x4d')){logger[_0x39ca('0x10')](_0x39ca('0x4e'),_0x39ca('0x4a'));_0x372ee4[_0x39ca('0x4b')]=_0x4b90c4;}else{_0x372ee4[_0x39ca('0x4b')]='';}return getAdminId(_0x59d069,_0x58b51b,_0xe3a0,_0x6746b2)[_0x39ca('0x12')](getUser(_0x58b51b,_0xe3a0,_0x6746b2))[_0x39ca('0x12')](getEndUser(_0x58b51b,_0xe3a0,_0x6746b2))[_0x39ca('0x12')](getTicket(_0x58b51b,_0xe3a0,_0x6746b2,_0x250a93,_0x372ee4))[_0x39ca('0x12')](function(_0x3156a6){logger[_0x39ca('0x10')](util[_0x39ca('0x27')](_0x39ca('0x4f'),_0x3156a6[_0x39ca('0x3a')]));if(_0x58b51b!==_0x39ca('0x46')){logger[_0x39ca('0x10')]('['+[_0x58b51b[_0x39ca('0x1c')]()]+']',_0x39ca('0x50'));emit(_0x6746b2,_0x4c2f5d[_0x39ca('0x51')],_0x3156a6['endUserId']);}})[_0x39ca('0x1a')](function(_0x69663a){logger[_0x39ca('0x1b')]('['+[_0x58b51b[_0x39ca('0x1c')]()]+_0x39ca('0x52'),util['inspect'](_0x69663a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2b17=['userEmail','userId','User\x20found:','/api/lookup?q=','&entities=contact','find','contacts','format','mobile_number','contactNumber','endUserId','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','/api/tasks','Subjects','getString','Descriptions','Contact','add','Task\x20created:','ticketId','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','none','[OUTBOUND]','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','GET','users','agentEmail'];(function(_0x2bc9ce,_0x12c6a3){var _0x578069=function(_0x45ec5d){while(--_0x45ec5d){_0x2bc9ce['push'](_0x2bc9ce['shift']());}};_0x578069(++_0x12c6a3);}(_0x2b17,0xdb));var _0x72b1=function(_0x40ac46,_0x12a302){_0x40ac46=_0x40ac46-0x0;var _0x1b9014=_0x2b17[_0x40ac46];return _0x1b9014;};'use strict';var _=require(_0x72b1('0x0'));var rp=require('request-promise');var md5=require(_0x72b1('0x1'));var util=require(_0x72b1('0x2'));var moment=require(_0x72b1('0x3'));var Promise=require(_0x72b1('0x4'));var Redis=require(_0x72b1('0x5'));var intUtil=require(_0x72b1('0x6'));var config=require(_0x72b1('0x7'));var logger=require(_0x72b1('0x8'))(_0x72b1('0x9'));config[_0x72b1('0xa')]=_[_0x72b1('0xb')](config[_0x72b1('0xa')],{'host':_0x72b1('0xc'),'port':0x18eb});var io=require(_0x72b1('0xd'))(new Redis(config[_0x72b1('0xa')]));function getAdminId(_0x4f43e3,_0x349776,_0x407741,_0x29effc){return new Promise(function(_0x896191,_0x45f4b5){var _0x270889=![];var _0x41cbbf={'method':'GET','uri':_0x29effc+_0x72b1('0xe'),'json':!![]};_0x41cbbf[_0x72b1('0xf')]=_0x407741;logger[_0x72b1('0x10')](_0x72b1('0x11'));return rp(_0x41cbbf)[_0x72b1('0x12')](function(_0x2a75a5){if(_0x2a75a5){var _0x292c82=_0x2a75a5['users'];var _0x5892e0=null;for(_0x5892e0=0x0;_0x5892e0<_0x292c82[_0x72b1('0x13')];_0x5892e0++){if(_0x292c82[_0x5892e0]['email']===_0x4f43e3[_0x72b1('0x14')]){_0x4f43e3[_0x72b1('0x15')]=_0x292c82[_0x5892e0]['id'];_0x270889=!![];}}if(_0x270889){logger[_0x72b1('0x10')](_0x72b1('0x16'),_0x4f43e3['adminId']);_0x896191(_0x4f43e3);}else{_0x45f4b5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x45f4b5({'statusCode':0x194,'message':_0x72b1('0x17')});}})[_0x72b1('0x18')](function(_0x153478){logger[_0x72b1('0x19')]('['+[_0x349776['toUpperCase']()]+']',_0x153478[_0x72b1('0x1a')]);_0x45f4b5(_0x153478);});});}function getUser(_0x4f8cba,_0x48a5d5,_0x273c11){return function(_0x50f7b6){return new Promise(function(_0xb0efda,_0x348d68){var _0x5c8015={'method':_0x72b1('0x1b'),'uri':_0x273c11+'/api/selector/owners','json':!![]};_0x5c8015['headers']=_0x48a5d5;logger[_0x72b1('0x10')]('Getting\x20user\x20list');return rp(_0x5c8015)[_0x72b1('0x12')](function(_0x1edf78){if(_0x1edf78){var _0x991929=_0x1edf78[_0x72b1('0x1c')];var _0x5eced9=![];var _0x3d3b7e=null;if(_0x50f7b6[_0x72b1('0x1d')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x50f7b6[_0x72b1('0x1d')]);_0x50f7b6[_0x72b1('0x1e')]=_0x50f7b6[_0x72b1('0x1d')];for(_0x3d3b7e=0x0;_0x3d3b7e<_0x991929[_0x72b1('0x13')];_0x3d3b7e++){if(_0x991929[_0x3d3b7e]['email']===_0x50f7b6['agentEmail']){_0x5eced9=!![];_0x50f7b6[_0x72b1('0x1f')]=_0x991929[_0x3d3b7e]['id'];logger[_0x72b1('0x10')](_0x72b1('0x20'),_0x50f7b6[_0x72b1('0x1f')]);}}}if(!_0x5eced9){logger['info']('Admin\x20selected');_0x50f7b6[_0x72b1('0x1e')]=_0x50f7b6[_0x72b1('0x14')];_0x50f7b6['userId']=_0x50f7b6['adminId'];_0x5eced9=!![];}if(_0x5eced9){_0xb0efda(_0x50f7b6);}else{_0x348d68({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x348d68({'statusCode':0x194,'message':_0x72b1('0x17')});}})[_0x72b1('0x18')](function(_0x5cf8be){logger['error']('['+[_0x4f8cba['toUpperCase']()]+']',_0x5cf8be[_0x72b1('0x1a')]);_0x348d68(_0x5cf8be);});});};}function searchContact(_0x32ce6d,_0x58fd5e,_0x5cdb4e,_0x548ae5){return new Promise(function(_0x1d4570,_0x343ddf){var _0x3aa794={'method':_0x72b1('0x1b'),'headers':_0x58fd5e,'uri':_0x32ce6d+_0x72b1('0x21')+_0x548ae5+'&f='+_0x5cdb4e+_0x72b1('0x22'),'json':!![]};rp(_0x3aa794)['then'](function(_0x13cfb4){var _0x27e8fa=_[_0x72b1('0x23')](_0x13cfb4['contacts'][_0x72b1('0x24')],[_0x5cdb4e,_0x548ae5]);_0x1d4570(_0x27e8fa);})[_0x72b1('0x18')](function(_0x5399bc){_0x343ddf(_0x5399bc);});});}function getEndUser(_0x4436d8,_0x1e5671,_0x39c775){return function(_0x5a65b6){return new Promise(function(_0x4bb1ef,_0x25da3e){logger[_0x72b1('0x10')](util[_0x72b1('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5a65b6['contactNumber']));searchContact(_0x39c775,_0x1e5671,_0x72b1('0x26'),_0x5a65b6[_0x72b1('0x27')])['then'](function(_0x504c73){if(_0x504c73){_0x5a65b6[_0x72b1('0x28')]=_0x504c73['id'];logger[_0x72b1('0x10')]('Contact\x20found\x20mobile_number:',_0x5a65b6[_0x72b1('0x28')]);return _0x4bb1ef(_0x5a65b6);}searchContact(_0x39c775,_0x1e5671,_0x72b1('0x29'),_0x5a65b6[_0x72b1('0x27')])[_0x72b1('0x12')](function(_0x128ee1){if(_0x128ee1){_0x5a65b6[_0x72b1('0x28')]=_0x128ee1['id'];logger[_0x72b1('0x10')]('Contact\x20found\x20work_number:',_0x5a65b6[_0x72b1('0x28')]);return _0x4bb1ef(_0x5a65b6);}createEndUser(_0x5a65b6,_0x4436d8,_0x1e5671,_0x39c775)['then'](function(_0x27e3e4){logger[_0x72b1('0x10')](_0x72b1('0x2a'),_0x27e3e4[_0x72b1('0x28')]);return _0x4bb1ef(_0x27e3e4);});});})[_0x72b1('0x18')](function(_0x47a134){_0x25da3e(_0x47a134);});});};}function createEndUser(_0x2f1485,_0x2f3d07,_0x10031b,_0x450190){return new Promise(function(_0x34afb9,_0x36660f){var _0x1f03c6=moment();var _0x367564={'method':_0x72b1('0x2b'),'uri':_0x450190+_0x72b1('0x2c'),'body':{'contact':{'last_name':_0x2f1485[_0x72b1('0x27')],'work_number':_0x2f1485[_0x72b1('0x27')],'mobile_number':_0x2f1485['contactNumber'],'owner_id':_0x2f1485[_0x72b1('0x1f')],'created_at':_0x1f03c6[_0x72b1('0x25')](_0x72b1('0x2d'))}},'json':!![]};_0x367564['headers']=_0x10031b;logger[_0x72b1('0x10')](_0x72b1('0x2e'));return rp(_0x367564)[_0x72b1('0x12')](function(_0x1079d1){_0x2f1485[_0x72b1('0x28')]=_0x1079d1[_0x72b1('0x2f')]['id'];_0x34afb9(_0x2f1485);})[_0x72b1('0x18')](function(_0x4cf986){logger[_0x72b1('0x19')]('['+[_0x2f3d07[_0x72b1('0x30')]()]+']',_0x4cf986[_0x72b1('0x1a')]);_0x36660f(_0x4cf986[_0x72b1('0x1a')]);});});}function getTicket(_0x8073ce,_0x501e18,_0x12c356,_0x33b023,_0x2256da){return function(_0x3359e2){logger[_0x72b1('0x10')]('Creating\x20new\x20task');return new Promise(function(_0x3fd476,_0x18ea81){var _0x16f1d8=moment();var _0x2e78df={'method':_0x72b1('0x2b'),'uri':_0x12c356+_0x72b1('0x31'),'body':{'title':intUtil['getString'](_0x33b023[_0x72b1('0x32')],_0x2256da,'\x20'),'description':intUtil[_0x72b1('0x33')](_0x33b023[_0x72b1('0x34')],_0x2256da,'\x0a'),'owner_id':_0x3359e2['userId'],'creater_id':_0x3359e2['adminId'],'targetable_id':_0x3359e2[_0x72b1('0x28')],'targetable_type':_0x72b1('0x35'),'created_at':_0x16f1d8['format'](_0x72b1('0x2d')),'due_date':_0x16f1d8[_0x72b1('0x36')](0x1e,'m')[_0x72b1('0x25')](_0x72b1('0x2d'))},'json':!![]};_0x2e78df[_0x72b1('0xf')]=_0x501e18;return rp(_0x2e78df)['then'](function(_0x5819e2){_0x3359e2['ticketId']=_0x5819e2['task']['id'];logger[_0x72b1('0x10')](_0x72b1('0x37'),_0x3359e2[_0x72b1('0x38')]);_0x3fd476(_0x3359e2);})[_0x72b1('0x18')](function(_0x3f2e0c){logger['error']('['+[_0x8073ce[_0x72b1('0x30')]()]+']',_0x3f2e0c['message']);_0x18ea81(_0x3f2e0c[_0x72b1('0x1a')]);});});};}function emit(_0x3a2c3a,_0x3392ca,_0x21f0d6){var _0x44de77={'uri':_0x3a2c3a+'/contacts/'+_0x21f0d6};io['to'](util[_0x72b1('0x25')](_0x72b1('0x39'),_0x3392ca))[_0x72b1('0x3a')]('trigger:browser:url',_0x44de77);}exports['cs']=function(_0x559289,_0x3e6c35,_0x5c0f0c,_0x5011a6,_0x52ac3a,_0x290a3f,_0x33e9b1,_0x139e19){var _0x1e2f69={};var _0x2bf359={'Authorization':_0x72b1('0x3b')+_0x290a3f[_0x72b1('0x3c')]};_0x290a3f[_0x72b1('0x3d')]=intUtil[_0x72b1('0x3e')](_0x290a3f[_0x72b1('0x3d')]);_0x290a3f[_0x72b1('0x3f')]=intUtil[_0x72b1('0x3e')](_0x290a3f[_0x72b1('0x3f')]);var _0x5a08bb=_0x290a3f[_0x72b1('0x3d')];_0x1e2f69['adminEmail']=_0x290a3f[_0x72b1('0x40')];_0x1e2f69[_0x72b1('0x27')]=_0x139e19[_0x72b1('0x41')]()===_0x72b1('0x42')?_0x3e6c35[_0x72b1('0x43')]:_0x3e6c35[_0x72b1('0x44')];_0x1e2f69[_0x72b1('0x45')]=_0x139e19===_0x72b1('0x46')||_0x139e19===_0x72b1('0x47')?_0x72b1('0x46'):_0x72b1('0x42');if(_0x5011a6){_0x1e2f69['agentEmail']=_0x5011a6['email'];}var _0x2fa538=util[_0x72b1('0x25')](_0x72b1('0x48'),_0x290a3f[_0x72b1('0x3f')],_0x3e6c35[_0x72b1('0x49')],md5(_0x3e6c35[_0x72b1('0x49')]));if(_0x52ac3a&&_0x52ac3a[_0x72b1('0x4a')]){logger[_0x72b1('0x10')](_0x72b1('0x4b'),_0x72b1('0x4c'));_0x3e6c35['recordingURL']=_0x2fa538;}else if(_0x33e9b1&&_0x33e9b1['recordingFormat']&&_0x33e9b1['recordingFormat']!==_0x72b1('0x4d')){logger[_0x72b1('0x10')](_0x72b1('0x4e'),_0x72b1('0x4c'));_0x3e6c35[_0x72b1('0x4f')]=_0x2fa538;}else{_0x3e6c35[_0x72b1('0x4f')]='';}return getAdminId(_0x1e2f69,_0x139e19,_0x2bf359,_0x5a08bb)[_0x72b1('0x12')](getUser(_0x139e19,_0x2bf359,_0x5a08bb))[_0x72b1('0x12')](getEndUser(_0x139e19,_0x2bf359,_0x5a08bb))[_0x72b1('0x12')](getTicket(_0x139e19,_0x2bf359,_0x5a08bb,_0x5c0f0c,_0x3e6c35))['then'](function(_0x530153){logger[_0x72b1('0x10')](util[_0x72b1('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x530153[_0x72b1('0x38')]));if(_0x139e19!==_0x72b1('0x47')){logger['info']('['+[_0x139e19['toUpperCase']()]+']',_0x72b1('0x50'));emit(_0x5a08bb,_0x5011a6[_0x72b1('0x51')],_0x530153['endUserId']);}})[_0x72b1('0x18')](function(_0x2bdfdb){logger[_0x72b1('0x19')]('['+[_0x139e19[_0x72b1('0x30')]()]+_0x72b1('0x52'),util['inspect'](_0x2bdfdb,{'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 5b2a757..4806571 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 _0xa437=['freshsales','servicenow','exec','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./desk','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','dynamics365'];(function(_0x1ab7db,_0x5ae040){var _0x1c5b48=function(_0x3b9bf3){while(--_0x3b9bf3){_0x1ab7db['push'](_0x1ab7db['shift']());}};_0x1c5b48(++_0x5ae040);}(_0xa437,0x1d0));var _0x7a43=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa437[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x7a43('0x0'));var util=require('util');var zendesk=require(_0x7a43('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x7a43('0x2'));var freshdesk=require(_0x7a43('0x3'));var zoho=require('./zoho');var desk=require(_0x7a43('0x4'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x7a43('0x5'));var freshsales=require(_0x7a43('0x6'));var integrations=[_0x7a43('0x7'),_0x7a43('0x8'),_0x7a43('0x9'),'freshdesk',_0x7a43('0xa'),'desk','vtiger',_0x7a43('0xb'),_0x7a43('0xc'),_0x7a43('0xd')];exports[_0x7a43('0xe')]=function(_0x4a61c4,_0x242ab2,_0x11829b,_0x59b68c,_0x3d0a04,_0x2ca8f9){if(_0x11829b){if(_['includes'](integrations,_0x4a61c4[_0x7a43('0xf')][_0x7a43('0x10')]())){try{var _0x111130=null;var _0x517759='';var _0x2d9cf7=_0x11829b[_0x4a61c4[_0x7a43('0xf')][_0x7a43('0x10')]()];if(_0x2d9cf7){var _0x52c96b=_0x2d9cf7[_0x4a61c4[_0x7a43('0x11')]];if(_0x52c96b){var _0xf443d5=_['find'](_0x52c96b[_0x7a43('0x12')],{'id':parseInt(_0x4a61c4[_0x7a43('0x13')],0xa)});if(_0xf443d5){if(_0x59b68c){if(_0x3d0a04&&_0x242ab2[_0x7a43('0x14')]){_0x517759=_0x7a43('0x14');}else if(_0x242ab2[_0x7a43('0x15')]){_0x517759=_0x7a43('0x16');}else{console[_0x7a43('0x17')](_0x7a43('0x18'),_0x242ab2);}}else{_0x517759=_0x7a43('0x19');}switch(_0x4a61c4['data1']['toLowerCase']()){case _0x7a43('0x7'):zendesk[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0x8'):salesforce[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0x9'):sugarcrm[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0x1a'):freshdesk[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0xa'):zoho[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case'desk':desk[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0x1b'):vtiger[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0xc'):freshsales['cs'](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9,_0x517759);break;case _0x7a43('0xd'):servicenow['cs'](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9,_0x517759);break;case _0x7a43('0xb'):dynamics365['cs'](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9,_0x517759);break;default:console[_0x7a43('0x17')](_0x7a43('0x1c'));}}else{_0x111130=require(_0x7a43('0x1d'))(_0x4a61c4['data1']['toLowerCase']());_0x111130[_0x7a43('0x1e')](_0x7a43('0x1f'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x4a61c4[_0x7a43('0xf')][_0x7a43('0x10')](),_0x4a61c4['data3']));}}else{_0x111130=require(_0x7a43('0x1d'))(_0x4a61c4['data1'][_0x7a43('0x10')]());_0x111130[_0x7a43('0x1e')]('[EXEC]',util[_0x7a43('0x20')](_0x7a43('0x21'),_0x4a61c4[_0x7a43('0xf')][_0x7a43('0x10')](),_0x4a61c4[_0x7a43('0x11')]));}}else{}}catch(_0xd79231){console[_0x7a43('0x1e')](_0xd79231);}}}}; \ No newline at end of file +var _0x50fa=['exec','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','unmanaged','salesforce','zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./freshsales','zendesk','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow'];(function(_0x2c2d11,_0x4308ac){var _0x255f24=function(_0x1aa524){while(--_0x1aa524){_0x2c2d11['push'](_0x2c2d11['shift']());}};_0x255f24(++_0x4308ac);}(_0x50fa,0xde));var _0xa50f=function(_0x1bd8e9,_0x1efd6d){_0x1bd8e9=_0x1bd8e9-0x0;var _0xb360c0=_0x50fa[_0x1bd8e9];return _0xb360c0;};'use strict';var _=require(_0xa50f('0x0'));var util=require(_0xa50f('0x1'));var zendesk=require(_0xa50f('0x2'));var salesforce=require(_0xa50f('0x3'));var sugarcrm=require(_0xa50f('0x4'));var freshdesk=require(_0xa50f('0x5'));var zoho=require(_0xa50f('0x6'));var desk=require(_0xa50f('0x7'));var vtiger=require('./vtiger');var servicenow=require(_0xa50f('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xa50f('0x9'));var integrations=[_0xa50f('0xa'),'salesforce',_0xa50f('0xb'),_0xa50f('0xc'),'zoho',_0xa50f('0xd'),_0xa50f('0xe'),_0xa50f('0xf'),_0xa50f('0x10'),_0xa50f('0x11')];exports[_0xa50f('0x12')]=function(_0x3dc1a3,_0x3c94cc,_0xf7c517,_0x44f5f6,_0xdc80a8,_0x489a2c){if(_0xf7c517){if(_[_0xa50f('0x13')](integrations,_0x3dc1a3[_0xa50f('0x14')][_0xa50f('0x15')]())){try{var _0x586ba5=null;var _0x57090e='';var _0x39ce45=_0xf7c517[_0x3dc1a3[_0xa50f('0x14')][_0xa50f('0x15')]()];if(_0x39ce45){var _0x45abc7=_0x39ce45[_0x3dc1a3[_0xa50f('0x16')]];if(_0x45abc7){var _0x32525e=_[_0xa50f('0x17')](_0x45abc7[_0xa50f('0x18')],{'id':parseInt(_0x3dc1a3['data3'],0xa)});if(_0x32525e){if(_0x44f5f6){if(_0xdc80a8&&_0x3c94cc[_0xa50f('0x19')]){_0x57090e=_0xa50f('0x19');}else if(_0x3c94cc[_0xa50f('0x1a')]){_0x57090e=_0xa50f('0x1b');}else{console[_0xa50f('0x1c')]('EVENT\x20UNKNOWN',_0x3c94cc);}}else{_0x57090e=_0xa50f('0x1d');}switch(_0x3dc1a3[_0xa50f('0x14')][_0xa50f('0x15')]()){case _0xa50f('0xa'):zendesk[_0x57090e](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c);break;case _0xa50f('0x1e'):salesforce[_0x57090e](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c);break;case'sugarcrm':sugarcrm[_0x57090e](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c);break;case _0xa50f('0xc'):freshdesk[_0x57090e](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c);break;case _0xa50f('0x1f'):zoho[_0x57090e](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c);break;case'desk':desk[_0x57090e](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c);break;case _0xa50f('0xe'):vtiger[_0x57090e](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c);break;case'freshsales':freshsales['cs'](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c,_0x57090e);break;case _0xa50f('0x11'):servicenow['cs'](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c,_0x57090e);break;case _0xa50f('0xf'):dynamics365['cs'](_0x3dc1a3,_0x3c94cc,_0x32525e,_0x44f5f6,_0xdc80a8,_0x45abc7,_0x489a2c,_0x57090e);break;default:console[_0xa50f('0x1c')](_0xa50f('0x20'));}}else{_0x586ba5=require(_0xa50f('0x21'))(_0x3dc1a3[_0xa50f('0x14')]['toLowerCase']());_0x586ba5[_0xa50f('0x22')](_0xa50f('0x23'),util[_0xa50f('0x24')](_0xa50f('0x25'),_0x3dc1a3[_0xa50f('0x14')][_0xa50f('0x15')](),_0x3dc1a3[_0xa50f('0x26')]));}}else{_0x586ba5=require(_0xa50f('0x21'))(_0x3dc1a3['data1'][_0xa50f('0x15')]());_0x586ba5['error'](_0xa50f('0x23'),util['format'](_0xa50f('0x27'),_0x3dc1a3[_0xa50f('0x14')][_0xa50f('0x15')](),_0x3dc1a3[_0xa50f('0x16')]));}}else{}}catch(_0x239370){console[_0xa50f('0x22')](_0x239370);}}}}; \ 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 6ee30a5..fe0983c 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 _0xef4f=['lead','WhoId','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','info','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','Lead','account_contact_lead','additionalSearchAccount','Account','execute','additionalSearchLead','first','Phone','type','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','account','','upperFirst','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','IsRecurrence','endUserType','contact'];(function(_0x1522ad,_0x84f385){var _0x4f649a=function(_0x5f0bbc){while(--_0x5f0bbc){_0x1522ad['push'](_0x1522ad['shift']());}};_0x4f649a(++_0x84f385);}(_0xef4f,0xf2));var _0xfef4=function(_0x3d40f6,_0x160271){_0x3d40f6=_0x3d40f6-0x0;var _0x246255=_0xef4f[_0x3d40f6];return _0x246255;};'use strict';var _=require(_0xfef4('0x0'));var rp=require(_0xfef4('0x1'));var moment=require(_0xfef4('0x2'));var BPromise=require('bluebird');var md5=require(_0xfef4('0x3'));var jsforce=require(_0xfef4('0x4'));var util=require(_0xfef4('0x5'));var Redis=require(_0xfef4('0x6'));var intUtil=require(_0xfef4('0x7'));var config=require(_0xfef4('0x8'));var logger=require(_0xfef4('0x9'))(_0xfef4('0xa'));config[_0xfef4('0xb')]=_[_0xfef4('0xc')](config[_0xfef4('0xb')],{'host':_0xfef4('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfef4('0xb')]));function emit(_0x1f80b7,_0x385084,_0x23a6b3){io['to'](_0x1f80b7)[_0xfef4('0xe')](_0x385084,_0x23a6b3);}function getTicket(_0x5acec8,_0x2f7b30,_0xe85e74,_0xe22e33,_0x4ef590,_0xece40a,_0x2856f9,_0xf491a9){var _0x27d8b8=Object[_0xfef4('0xf')]({},{'OwnerId':_0x2f7b30['id'],'Subject':intUtil[_0xfef4('0x10')](_0xe22e33[_0xfef4('0x11')],_0x4ef590,'\x20'),'Description':intUtil[_0xfef4('0x10')](_0xe22e33[_0xfef4('0x12')],_0x4ef590,'\x0a')},getCustomFields(_0xece40a,_0x4ef590));if(_0xe85e74){if(_0xe22e33[_0xfef4('0x13')]==='Task'){_0x27d8b8[_0xfef4('0x14')]=moment['utc']();_0x27d8b8['IsReminderSet']=![];_0x27d8b8[_0xfef4('0x15')]=![];if(_0xe85e74[_0xfef4('0x16')]===_0xfef4('0x17')||_0xe85e74[_0xfef4('0x16')]===_0xfef4('0x18')){_0x27d8b8[_0xfef4('0x19')]=_0xe85e74['id'];}else if(_0xe85e74[_0xfef4('0x16')]==='account'){_0x27d8b8['WhatId']=_0xe85e74['id'];}}else if(_0xe22e33[_0xfef4('0x13')]===_0xfef4('0x1a')){if(_0xe85e74[_0xfef4('0x16')]===_0xfef4('0x17')){_0x27d8b8[_0xfef4('0x1b')]=_0xe85e74['id'];}else if(_0xe85e74['endUserType']==='account'){_0x27d8b8[_0xfef4('0x1c')]=_0xe85e74['id'];}else if(_0xe85e74[_0xfef4('0x16')]==='lead'&&_0xe22e33[_0xfef4('0x1d')]){_0x27d8b8[_0xe22e33['leadId']]=_0xe85e74['id'];}else{logger['info'](_0xfef4('0x1e'));}}}return _0x2856f9[_0xfef4('0x1f')](_0xe22e33[_0xfef4('0x13')])[_0xfef4('0x20')](_0x27d8b8);}function getUser(_0x5170fc,_0x140cc6,_0x222ff2){if(!_[_0xfef4('0x21')](_0x140cc6)&&intUtil[_0xfef4('0x22')](_0x140cc6)){var _0x52b860={'Email':_0x140cc6};var _0x392afd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x222ff2[_0xfef4('0x1f')](_0xfef4('0x23'))[_0xfef4('0x24')](_0x52b860,_0x392afd)['execute']()[_0xfef4('0x25')](function(_0x47bbe1){if(_0x47bbe1[_0xfef4('0x26')]){var _0x128033=_['find'](_0x47bbe1,function(_0x4980ec){return _0x4980ec[_0xfef4('0x27')]===_0x140cc6;});if(_0x128033){logger['info'](_0xfef4('0x28'),_0x140cc6);return BPromise[_0xfef4('0x29')]({'id':_0x128033['Id'],'name':_0x128033[_0xfef4('0x2a')]});}}else{logger[_0xfef4('0x2b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x140cc6);return _0x222ff2[_0xfef4('0x2c')]()[_0xfef4('0x25')](function(_0x44a8c5){return BPromise[_0xfef4('0x29')]({'id':_0x44a8c5[_0xfef4('0x2d')],'name':_0x44a8c5['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x140cc6);return _0x222ff2[_0xfef4('0x2c')]()['then'](function(_0x2cc30d){return BPromise['resolve']({'id':_0x2cc30d[_0xfef4('0x2d')],'name':_0x2cc30d[_0xfef4('0x2e')]});});}}function getEndUser(_0x376b3c,_0x40d585,_0x31d62a,_0x51821f,_0x370fbc){var _0x5d13ff={'$or':{'Phone':_0x51821f}};var _0x24ad6d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfef4('0x29')]()[_0xfef4('0x25')](function(){logger[_0xfef4('0x2b')](_0xfef4('0x2f'),_0x51821f,_0x40d585[_0xfef4('0x30')]);switch(_0x40d585[_0xfef4('0x30')]){case _0xfef4('0x31'):var _0x431904=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x33')]){var _0x3c6af2={};_0x3c6af2[_0x40d585[_0xfef4('0x33')]]=_0x51821f;_[_0xfef4('0x34')](_0x431904[_0xfef4('0x35')],_0x3c6af2);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x36'))['find'](_0x431904,_0x24ad6d)['execute']()['then'](function(_0x6bf2a3){if(_0x6bf2a3&&_0x6bf2a3['length']){return _0x6bf2a3;}else{var _0x57d68d=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585['additionalSearchLead']){var _0x18e7e0={};_0x18e7e0[_0x40d585['additionalSearchLead']]=_0x51821f;_['merge'](_0x57d68d[_0xfef4('0x35')],_0x18e7e0);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x37'))[_0xfef4('0x24')](_0x57d68d,_0x24ad6d);}});case _0xfef4('0x38'):var _0x31c801=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x39')]){var _0x3c6af2={};_0x3c6af2[_0x40d585[_0xfef4('0x39')]]=_0x51821f;_[_0xfef4('0x34')](_0x31c801['$or'],_0x3c6af2);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x3a'))[_0xfef4('0x24')](_0x31c801,_0x24ad6d)[_0xfef4('0x3b')]()[_0xfef4('0x25')](function(_0x2e3fd3){if(_0x2e3fd3&&_0x2e3fd3[_0xfef4('0x26')]){return _0x2e3fd3;}else{var _0x19158d=_['cloneDeep'](_0x5d13ff);if(_0x40d585[_0xfef4('0x33')]){var _0x54b213={};_0x54b213[_0x40d585['additionalSearchContact']]=_0x51821f;_[_0xfef4('0x34')](_0x19158d[_0xfef4('0x35')],_0x54b213);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x36'))[_0xfef4('0x24')](_0x19158d,_0x24ad6d)['then'](function(_0x93c6f0){if(_0x93c6f0&&_0x93c6f0[_0xfef4('0x26')]){return _0x93c6f0;}else{var _0x443080=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585['additionalSearchLead']){var _0x1ecd46={};_0x1ecd46[_0x40d585[_0xfef4('0x3c')]]=_0x51821f;_[_0xfef4('0x34')](_0x443080[_0xfef4('0x35')],_0x1ecd46);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x37'))[_0xfef4('0x24')](_0x443080,_0x24ad6d);}});}});case _0xfef4('0x17'):var _0x431904=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x33')]){var _0x3c6af2={};_0x3c6af2[_0x40d585['additionalSearchContact']]=_0x51821f;_['merge'](_0x431904[_0xfef4('0x35')],_0x3c6af2);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x36'))['find'](_0x431904,_0x24ad6d)[_0xfef4('0x3b')]();case _0xfef4('0x18'):var _0x404c41=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x3c')]){var _0x3c6af2={};_0x3c6af2[_0x40d585[_0xfef4('0x3c')]]=_0x51821f;_[_0xfef4('0x34')](_0x404c41[_0xfef4('0x35')],_0x3c6af2);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x37'))[_0xfef4('0x24')](_0x404c41,_0x24ad6d);case'account':var _0x31c801=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x39')]){var _0x3c6af2={};_0x3c6af2[_0x40d585[_0xfef4('0x39')]]=_0x51821f;_[_0xfef4('0x34')](_0x31c801[_0xfef4('0x35')],_0x3c6af2);}return _0x370fbc['sobject'](_0xfef4('0x3a'))[_0xfef4('0x24')](_0x31c801,_0x24ad6d);default:return null;}})['then'](function(_0x206d3d){if(_0x206d3d&&_0x206d3d[_0xfef4('0x26')]){var _0x501910=_[_0xfef4('0x3d')](_0x206d3d);if(_0x501910){return BPromise[_0xfef4('0x29')]({'id':_0x501910['Id'],'name':_0x501910[_0xfef4('0x2a')],'phone':_0x501910[_0xfef4('0x3e')],'endUserType':_0x501910['attributes'][_0xfef4('0x3f')]['toLowerCase']()});}}})[_0xfef4('0x25')](function(_0x7a4352){if(_0x7a4352){logger[_0xfef4('0x2b')](_0xfef4('0x40'),_0x7a4352['endUserType'],_0x51821f);return BPromise['resolve'](_0x7a4352);}else{logger['info'](_0xfef4('0x41'),_0x51821f);var _0x2bbfe5={'Phone':_0x51821f};if(_0x40d585[_0xfef4('0x42')]){if(_0x40d585[_0xfef4('0x42')]===_0xfef4('0x17')){logger['info'](_0xfef4('0x43'),_0x51821f,_0x40d585[_0xfef4('0x42')]);_0x2bbfe5[_0xfef4('0x44')]=_0x31d62a!==''?_0x31d62a:util[_0xfef4('0x45')](_0xfef4('0x46'),_0x51821f);}else if(_0x40d585['moduleCreate']===_0xfef4('0x18')){logger[_0xfef4('0x2b')](_0xfef4('0x43'),_0x51821f,_0x40d585[_0xfef4('0x42')]);_0x2bbfe5[_0xfef4('0x44')]=_0x31d62a!==''?_0x31d62a:util[_0xfef4('0x45')](_0xfef4('0x46'),_0x51821f);_0x2bbfe5[_0xfef4('0x47')]=_0xfef4('0x48');}else if(_0x40d585[_0xfef4('0x42')]===_0xfef4('0x49')){logger[_0xfef4('0x2b')](_0xfef4('0x43'),_0x51821f,_0x40d585['moduleCreate']);_0x2bbfe5['Name']=_0x31d62a!==_0xfef4('0x4a')?_0x31d62a:util[_0xfef4('0x45')](_0xfef4('0x46'),_0x51821f);}else{return null;}}return _0x370fbc[_0xfef4('0x1f')](_[_0xfef4('0x4b')](_0x40d585['moduleCreate']))[_0xfef4('0x20')](_0x2bbfe5)[_0xfef4('0x25')](function(_0xa7ffff){return BPromise[_0xfef4('0x29')]({'id':_0xa7ffff['id'],'endUserType':_0x40d585[_0xfef4('0x42')]});});}});}function getCustomFields(_0x5de94c,_0x385ed3){var _0x27c79f={};if(_0x5de94c[_0xfef4('0x26')]>0x0){_['forEach'](_0x5de94c,function(_0x2a2396){if(_[_0xfef4('0x4c')]([_0xfef4('0x4d'),_0xfef4('0x4e')],_0x2a2396[_0xfef4('0x3f')])&&_0x2a2396[_0xfef4('0x4f')]){_0x27c79f[_0x2a2396[_0xfef4('0x4f')]]=_0x2a2396[_0xfef4('0x50')][_0xfef4('0x51')]();}else if(_0x2a2396[_0xfef4('0x3f')]==='variable'&&_0x2a2396[_0xfef4('0x52')]&&_0x2a2396['idField']){_0x385ed3[_0x2a2396[_0xfef4('0x52')]]&&(_0x27c79f[_0x2a2396[_0xfef4('0x4f')]]=_0x385ed3[_0x2a2396[_0xfef4('0x52')]][_0xfef4('0x51')]());}else if(_0x2a2396[_0xfef4('0x3f')]===_0xfef4('0x53')&&_0x2a2396[_0xfef4('0x54')]&&_0x2a2396[_0xfef4('0x54')][_0xfef4('0x55')]&&_0x2a2396[_0xfef4('0x4f')]){_0x385ed3[_0x2a2396[_0xfef4('0x54')][_0xfef4('0x55')][_0xfef4('0x56')]()]&&(_0x27c79f[_0x2a2396['idField']]=_0x385ed3[_0x2a2396['Variable'][_0xfef4('0x55')][_0xfef4('0x56')]()][_0xfef4('0x51')]());}});}return _0x27c79f;}function getConnection(_0x8f13fd){var _0x4f849f=_0x8f13fd[_0xfef4('0x57')][_0xfef4('0x58')](_0x8f13fd[_0xfef4('0x59')]);var _0x1f7d1e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x8f13fd[_0xfef4('0x5a')]||_0xfef4('0x5b'),'clientId':_0x8f13fd['clientId'],'clientSecret':_0x8f13fd[_0xfef4('0x5c')]}});return _0x1f7d1e[_0xfef4('0x5d')](_0x8f13fd[_0xfef4('0x5e')],_0x4f849f)['then'](function(){logger[_0xfef4('0x2b')](_0xfef4('0x5f'));return _0x1f7d1e;});}exports['queue']=function(_0x45deb9,_0x362796,_0x2a351b,_0x4f44b7,_0x525538,_0x44da48){var _0x1d4c78,_0x56a30f,_0x16f8ef,_0x24a92c;_0x44da48[_0xfef4('0x60')]=intUtil[_0xfef4('0x61')](_0x44da48[_0xfef4('0x60')]);_0x44da48[_0xfef4('0x5a')]=intUtil[_0xfef4('0x61')](_0x44da48[_0xfef4('0x5a')]);if(_0x525538&&_0x525538[_0xfef4('0x62')]){logger[_0xfef4('0x2b')](_0xfef4('0x63'),_0xfef4('0x64'));_0x362796[_0xfef4('0x65')]=util[_0xfef4('0x45')](_0xfef4('0x66'),_0x44da48['serverUrl'],_0x362796[_0xfef4('0x67')],md5(_0x362796[_0xfef4('0x67')]));}else{_0x362796[_0xfef4('0x65')]='';}return getConnection(_0x44da48)['then'](function(_0x5f2b99){_0x24a92c=_0x5f2b99;return getUser(_0x44da48,_0x4f44b7[_0xfef4('0x68')],_0x24a92c);})[_0xfef4('0x25')](function(_0x32a89){_0x1d4c78=_0x32a89;return getEndUser(_0x44da48,_0x2a351b,_0x362796['calleridname'],_0x362796[_0xfef4('0x69')],_0x24a92c);})[_0xfef4('0x25')](function(_0x1538a7){_0x56a30f=_0x1538a7;return getTicket(_0x44da48,_0x1d4c78,_0x56a30f,_0x2a351b,_0x362796,_0x2a351b[_0xfef4('0x6a')],_0x24a92c,_0xfef4('0x6b'));})[_0xfef4('0x25')](function(_0x272d6c){_0x16f8ef=_0x272d6c;logger[_0xfef4('0x2b')](_0xfef4('0x6c'),_0x16f8ef['id']);logger[_0xfef4('0x2b')](_0xfef4('0x6d'),_0x16f8ef['id'],_0x4f44b7['name'],_0x44da48['type']);switch(_0x44da48[_0xfef4('0x3f')]){case _0xfef4('0x6e'):emit(util[_0xfef4('0x45')](_0xfef4('0x6f'),_0x4f44b7[_0xfef4('0x55')]),_0xfef4('0x70'),{'recordId':_0x16f8ef['id']});break;case _0xfef4('0x71'):emit(util[_0xfef4('0x45')](_0xfef4('0x6f'),_0x4f44b7[_0xfef4('0x55')]),'trigger:browser:url',{'uri':util['format'](_0xfef4('0x72'),_0x24a92c[_0xfef4('0x73')],_0x16f8ef['id'])});break;default:logger[_0xfef4('0x74')](_0xfef4('0x75'));}})[_0xfef4('0x76')](function(_0x51f369){logger[_0xfef4('0x74')](_0xfef4('0x63'),_0x51f369);});};exports[_0xfef4('0x77')]=function(_0x5ef4af,_0x17d36c,_0x565bf8,_0x5bbc2e,_0x7777c2,_0xefd685,_0x3e7638){var _0x5d2a20,_0x5d8106,_0x593954,_0x155da1;_0xefd685['serverUrl']=intUtil['stripTrailingSlash'](_0xefd685[_0xfef4('0x60')]);_0xefd685['remoteUri']=intUtil[_0xfef4('0x61')](_0xefd685['remoteUri']);if(_0x3e7638&&_0x3e7638[_0xfef4('0x78')]&&_0x3e7638['recordingFormat']!==_0xfef4('0x79')){logger[_0xfef4('0x2b')](_0xfef4('0x7a'),'Recording\x20is\x20enabled!');_0x17d36c['recordingURL']=util['format'](_0xfef4('0x66'),_0xefd685[_0xfef4('0x60')],_0x17d36c[_0xfef4('0x67')],md5(_0x17d36c[_0xfef4('0x67')]));}return getConnection(_0xefd685)[_0xfef4('0x25')](function(_0x4b6b15){_0x155da1=_0x4b6b15;return getUser(_0xefd685,_0x5bbc2e[_0xfef4('0x68')],_0x155da1);})['then'](function(_0x253d8c){_0x5d2a20=_0x253d8c;return getEndUser(_0xefd685,_0x565bf8,_0x17d36c[_0xfef4('0x7b')],_0x17d36c[_0xfef4('0x7c')],_0x155da1);})[_0xfef4('0x25')](function(_0x67d7ef){_0x5d8106=_0x67d7ef;return getTicket(_0xefd685,_0x5d2a20,_0x5d8106,_0x565bf8,_0x17d36c,_0x565bf8[_0xfef4('0x6a')],_0x155da1,_0xfef4('0x77'));})[_0xfef4('0x25')](function(_0x2c4ee5){_0x593954=_0x2c4ee5;logger[_0xfef4('0x2b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x593954['id']);logger['info'](_0xfef4('0x7d'),_0x593954['id'],_0x5bbc2e['name'],_0xefd685[_0xfef4('0x3f')]);switch(_0xefd685[_0xfef4('0x3f')]){case'integrationTab':emit(util['format'](_0xfef4('0x6f'),_0x5bbc2e['name']),_0xfef4('0x70'),{'recordId':_0x593954['id']});break;case _0xfef4('0x71'):emit(util[_0xfef4('0x45')](_0xfef4('0x6f'),_0x5bbc2e[_0xfef4('0x55')]),_0xfef4('0x7e'),{'uri':util[_0xfef4('0x45')](_0xfef4('0x72'),_0x155da1[_0xfef4('0x73')],_0x593954['id'])});break;default:logger[_0xfef4('0x74')](_0xfef4('0x7a'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xfef4('0x76')](function(_0x5356d7){logger[_0xfef4('0x74')](_0xfef4('0x7a'),_0x5356d7);});};exports[_0xfef4('0x7f')]=function(_0x426597,_0x86813f,_0x1d7a5d,_0x44d32a,_0xed4e81,_0x45a579){var _0x825262,_0xb25176,_0x57f289,_0x13e9f8;_0x45a579['serverUrl']=intUtil[_0xfef4('0x61')](_0x45a579['serverUrl']);_0x45a579[_0xfef4('0x5a')]=intUtil['stripTrailingSlash'](_0x45a579['remoteUri']);if(_0xed4e81&&_0xed4e81[_0xfef4('0x62')]){logger['info']('['+_0x86813f[_0xfef4('0x80')][_0xfef4('0x81')]()+']',_0xfef4('0x64'));_0x86813f[_0xfef4('0x65')]=util[_0xfef4('0x45')](_0xfef4('0x66'),_0x45a579['serverUrl'],_0x86813f[_0xfef4('0x67')],md5(_0x86813f[_0xfef4('0x67')]));}else{_0x86813f[_0xfef4('0x65')]='';}return getConnection(_0x45a579)['then'](function(_0x2f7b82){_0x13e9f8=_0x2f7b82;if(!_['isNil'](_0x44d32a)){return getUser(_0x45a579,_0x44d32a[_0xfef4('0x55')],_0x13e9f8);}else{return getUser(_0x45a579,null,_0x13e9f8);}})[_0xfef4('0x25')](function(_0x468fb4){_0x825262=_0x468fb4;return getEndUser(_0x45a579,_0x1d7a5d,_0x86813f[_0xfef4('0x82')],_0x86813f[_0xfef4('0x69')],_0x13e9f8);})[_0xfef4('0x25')](function(_0x2cfe62){_0xb25176=_0x2cfe62;return getTicket(_0x45a579,_0x825262,_0xb25176,_0x1d7a5d,_0x86813f,_0x1d7a5d[_0xfef4('0x6a')],_0x13e9f8);})[_0xfef4('0x25')](function(_0x473f4c){_0x57f289=_0x473f4c;logger['info']('['+_0x86813f['lastevent'][_0xfef4('0x81')]()+_0xfef4('0x83'),_0x57f289['id']);logger[_0xfef4('0x2b')]('['+_0x86813f[_0xfef4('0x80')]['toUpperCase']()+_0xfef4('0x84'),_0x45a579[_0xfef4('0x3f')]);})[_0xfef4('0x76')](function(_0x2a0d1d){logger[_0xfef4('0x74')]('['+_0x86813f['lastevent']['toUpperCase']()+']',_0x2a0d1d);});}; \ No newline at end of file +var _0xd92f=['Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Contact','Lead','Name','Phone','attributes','type','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','toLowerCase','password','concat','securityToken','Connection','remoteUri','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','[QUEUE]','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','getString','Subjects','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','sobject','create','isNil','User','execute','then','length','find','Email','info','resolve'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xd92f,0xd8));var _0xfd92=function(_0x4a973e,_0x29034b){_0x4a973e=_0x4a973e-0x0;var _0x36b56e=_0xd92f[_0x4a973e];return _0x36b56e;};'use strict';var _=require(_0xfd92('0x0'));var rp=require('request-promise');var moment=require(_0xfd92('0x1'));var BPromise=require(_0xfd92('0x2'));var md5=require(_0xfd92('0x3'));var jsforce=require(_0xfd92('0x4'));var util=require(_0xfd92('0x5'));var Redis=require(_0xfd92('0x6'));var intUtil=require(_0xfd92('0x7'));var config=require(_0xfd92('0x8'));var logger=require(_0xfd92('0x9'))(_0xfd92('0xa'));config[_0xfd92('0xb')]=_[_0xfd92('0xc')](config[_0xfd92('0xb')],{'host':_0xfd92('0xd'),'port':0x18eb});var io=require(_0xfd92('0xe'))(new Redis(config[_0xfd92('0xb')]));function emit(_0x35efdb,_0x470a86,_0x2440b1){io['to'](_0x35efdb)['emit'](_0x470a86,_0x2440b1);}function getTicket(_0x255976,_0x406bda,_0x4a418a,_0xb54087,_0x4a63bc,_0x52b8e9,_0x5346b0,_0x4afccb){var _0x2f71e8=Object['assign']({},{'OwnerId':_0x406bda['id'],'Subject':intUtil[_0xfd92('0xf')](_0xb54087[_0xfd92('0x10')],_0x4a63bc,'\x20'),'Description':intUtil['getString'](_0xb54087['Descriptions'],_0x4a63bc,'\x0a')},getCustomFields(_0x52b8e9,_0x4a63bc));if(_0x4a418a){if(_0xb54087['ticketType']===_0xfd92('0x11')){_0x2f71e8[_0xfd92('0x12')]=moment[_0xfd92('0x13')]();_0x2f71e8[_0xfd92('0x14')]=![];_0x2f71e8[_0xfd92('0x15')]=![];if(_0x4a418a[_0xfd92('0x16')]===_0xfd92('0x17')||_0x4a418a['endUserType']===_0xfd92('0x18')){_0x2f71e8[_0xfd92('0x19')]=_0x4a418a['id'];}else if(_0x4a418a[_0xfd92('0x16')]===_0xfd92('0x1a')){_0x2f71e8[_0xfd92('0x1b')]=_0x4a418a['id'];}}else if(_0xb54087[_0xfd92('0x1c')]===_0xfd92('0x1d')){if(_0x4a418a[_0xfd92('0x16')]===_0xfd92('0x17')){_0x2f71e8[_0xfd92('0x1e')]=_0x4a418a['id'];}else if(_0x4a418a[_0xfd92('0x16')]===_0xfd92('0x1a')){_0x2f71e8[_0xfd92('0x1f')]=_0x4a418a['id'];}else if(_0x4a418a[_0xfd92('0x16')]==='lead'&&_0xb54087[_0xfd92('0x20')]){_0x2f71e8[_0xb54087['leadId']]=_0x4a418a['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x5346b0[_0xfd92('0x21')](_0xb54087[_0xfd92('0x1c')])[_0xfd92('0x22')](_0x2f71e8);}function getUser(_0x2ed933,_0xa708ce,_0x3fb485){if(!_[_0xfd92('0x23')](_0xa708ce)&&intUtil['validateEmail'](_0xa708ce)){var _0x5646ce={'Email':_0xa708ce};var _0x580235={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3fb485['sobject'](_0xfd92('0x24'))['find'](_0x5646ce,_0x580235)[_0xfd92('0x25')]()[_0xfd92('0x26')](function(_0x24213f){if(_0x24213f[_0xfd92('0x27')]){var _0x7eb366=_[_0xfd92('0x28')](_0x24213f,function(_0x1124df){return _0x1124df[_0xfd92('0x29')]===_0xa708ce;});if(_0x7eb366){logger[_0xfd92('0x2a')]('Agent\x20%s\x20found.',_0xa708ce);return BPromise[_0xfd92('0x2b')]({'id':_0x7eb366['Id'],'name':_0x7eb366['Name']});}}else{logger[_0xfd92('0x2a')](_0xfd92('0x2c'),_0xa708ce);return _0x3fb485[_0xfd92('0x2d')]()['then'](function(_0x147fdc){return BPromise[_0xfd92('0x2b')]({'id':_0x147fdc[_0xfd92('0x2e')],'name':_0x147fdc[_0xfd92('0x2f')]});});}});}else{logger[_0xfd92('0x2a')](_0xfd92('0x2c'),_0xa708ce);return _0x3fb485[_0xfd92('0x2d')]()[_0xfd92('0x26')](function(_0xd46c0){return BPromise['resolve']({'id':_0xd46c0[_0xfd92('0x2e')],'name':_0xd46c0[_0xfd92('0x2f')]});});}}function getEndUser(_0x2f4a7f,_0x277a65,_0x392d79,_0x41726c,_0xd93eb9){var _0x3e6145={'$or':{'Phone':_0x41726c}};var _0x233efa={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfd92('0x2b')]()[_0xfd92('0x26')](function(){logger[_0xfd92('0x2a')](_0xfd92('0x30'),_0x41726c,_0x277a65['moduleSearch']);switch(_0x277a65[_0xfd92('0x31')]){case _0xfd92('0x32'):var _0x36845a=_[_0xfd92('0x33')](_0x3e6145);if(_0x277a65[_0xfd92('0x34')]){var _0x1c4809={};_0x1c4809[_0x277a65['additionalSearchContact']]=_0x41726c;_[_0xfd92('0x35')](_0x36845a[_0xfd92('0x36')],_0x1c4809);}return _0xd93eb9['sobject']('Contact')['find'](_0x36845a,_0x233efa)[_0xfd92('0x25')]()[_0xfd92('0x26')](function(_0xbafb1e){if(_0xbafb1e&&_0xbafb1e[_0xfd92('0x27')]){return _0xbafb1e;}else{var _0x162e43=_[_0xfd92('0x33')](_0x3e6145);if(_0x277a65[_0xfd92('0x37')]){var _0x1fbc99={};_0x1fbc99[_0x277a65[_0xfd92('0x37')]]=_0x41726c;_['merge'](_0x162e43['$or'],_0x1fbc99);}return _0xd93eb9[_0xfd92('0x21')]('Lead')[_0xfd92('0x28')](_0x162e43,_0x233efa);}});case _0xfd92('0x38'):var _0x16dce8=_[_0xfd92('0x33')](_0x3e6145);if(_0x277a65[_0xfd92('0x39')]){var _0x1c4809={};_0x1c4809[_0x277a65[_0xfd92('0x39')]]=_0x41726c;_[_0xfd92('0x35')](_0x16dce8[_0xfd92('0x36')],_0x1c4809);}return _0xd93eb9['sobject'](_0xfd92('0x3a'))[_0xfd92('0x28')](_0x16dce8,_0x233efa)[_0xfd92('0x25')]()[_0xfd92('0x26')](function(_0x23a884){if(_0x23a884&&_0x23a884[_0xfd92('0x27')]){return _0x23a884;}else{var _0x3d7126=_['cloneDeep'](_0x3e6145);if(_0x277a65[_0xfd92('0x34')]){var _0x21829e={};_0x21829e[_0x277a65[_0xfd92('0x34')]]=_0x41726c;_['merge'](_0x3d7126['$or'],_0x21829e);}return _0xd93eb9[_0xfd92('0x21')](_0xfd92('0x3b'))['find'](_0x3d7126,_0x233efa)[_0xfd92('0x26')](function(_0x1cd131){if(_0x1cd131&&_0x1cd131[_0xfd92('0x27')]){return _0x1cd131;}else{var _0x265d79=_[_0xfd92('0x33')](_0x3e6145);if(_0x277a65[_0xfd92('0x37')]){var _0xd382ac={};_0xd382ac[_0x277a65[_0xfd92('0x37')]]=_0x41726c;_['merge'](_0x265d79[_0xfd92('0x36')],_0xd382ac);}return _0xd93eb9[_0xfd92('0x21')](_0xfd92('0x3c'))[_0xfd92('0x28')](_0x265d79,_0x233efa);}});}});case _0xfd92('0x17'):var _0x36845a=_[_0xfd92('0x33')](_0x3e6145);if(_0x277a65[_0xfd92('0x34')]){var _0x1c4809={};_0x1c4809[_0x277a65[_0xfd92('0x34')]]=_0x41726c;_['merge'](_0x36845a[_0xfd92('0x36')],_0x1c4809);}return _0xd93eb9[_0xfd92('0x21')](_0xfd92('0x3b'))[_0xfd92('0x28')](_0x36845a,_0x233efa)[_0xfd92('0x25')]();case _0xfd92('0x18'):var _0x1870c8=_['cloneDeep'](_0x3e6145);if(_0x277a65[_0xfd92('0x37')]){var _0x1c4809={};_0x1c4809[_0x277a65[_0xfd92('0x37')]]=_0x41726c;_[_0xfd92('0x35')](_0x1870c8[_0xfd92('0x36')],_0x1c4809);}return _0xd93eb9[_0xfd92('0x21')](_0xfd92('0x3c'))[_0xfd92('0x28')](_0x1870c8,_0x233efa);case _0xfd92('0x1a'):var _0x16dce8=_[_0xfd92('0x33')](_0x3e6145);if(_0x277a65['additionalSearchAccount']){var _0x1c4809={};_0x1c4809[_0x277a65[_0xfd92('0x39')]]=_0x41726c;_[_0xfd92('0x35')](_0x16dce8[_0xfd92('0x36')],_0x1c4809);}return _0xd93eb9[_0xfd92('0x21')]('Account')['find'](_0x16dce8,_0x233efa);default:return null;}})[_0xfd92('0x26')](function(_0x4c9c3f){if(_0x4c9c3f&&_0x4c9c3f[_0xfd92('0x27')]){var _0x31ab78=_['first'](_0x4c9c3f);if(_0x31ab78){return BPromise[_0xfd92('0x2b')]({'id':_0x31ab78['Id'],'name':_0x31ab78[_0xfd92('0x3d')],'phone':_0x31ab78[_0xfd92('0x3e')],'endUserType':_0x31ab78[_0xfd92('0x3f')][_0xfd92('0x40')]['toLowerCase']()});}}})[_0xfd92('0x26')](function(_0x172a83){if(_0x172a83){logger[_0xfd92('0x2a')](_0xfd92('0x41'),_0x172a83[_0xfd92('0x16')],_0x41726c);return BPromise[_0xfd92('0x2b')](_0x172a83);}else{logger[_0xfd92('0x2a')](_0xfd92('0x42'),_0x41726c);var _0x3f96ab={'Phone':_0x41726c};if(_0x277a65[_0xfd92('0x43')]){if(_0x277a65['moduleCreate']===_0xfd92('0x17')){logger[_0xfd92('0x2a')](_0xfd92('0x44'),_0x41726c,_0x277a65[_0xfd92('0x43')]);_0x3f96ab[_0xfd92('0x45')]=_0x392d79!==''?_0x392d79:util[_0xfd92('0x46')](_0xfd92('0x47'),_0x41726c);}else if(_0x277a65[_0xfd92('0x43')]===_0xfd92('0x18')){logger[_0xfd92('0x2a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x41726c,_0x277a65['moduleCreate']);_0x3f96ab[_0xfd92('0x45')]=_0x392d79!==_0xfd92('0x48')?_0x392d79:util[_0xfd92('0x46')]('Caller\x20-\x20%s',_0x41726c);_0x3f96ab[_0xfd92('0x49')]=_0xfd92('0x4a');}else if(_0x277a65['moduleCreate']===_0xfd92('0x1a')){logger[_0xfd92('0x2a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x41726c,_0x277a65[_0xfd92('0x43')]);_0x3f96ab[_0xfd92('0x3d')]=_0x392d79!==_0xfd92('0x48')?_0x392d79:util[_0xfd92('0x46')](_0xfd92('0x47'),_0x41726c);}else{return null;}}return _0xd93eb9[_0xfd92('0x21')](_[_0xfd92('0x4b')](_0x277a65[_0xfd92('0x43')]))['create'](_0x3f96ab)[_0xfd92('0x26')](function(_0x4f6349){return BPromise[_0xfd92('0x2b')]({'id':_0x4f6349['id'],'endUserType':_0x277a65[_0xfd92('0x43')]});});}});}function getCustomFields(_0x190511,_0x17af1b){var _0x402582={};if(_0x190511[_0xfd92('0x27')]>0x0){_[_0xfd92('0x4c')](_0x190511,function(_0x1d4574){if(_[_0xfd92('0x4d')]([_0xfd92('0x4e'),_0xfd92('0x4f')],_0x1d4574[_0xfd92('0x40')])&&_0x1d4574[_0xfd92('0x50')]){_0x402582[_0x1d4574[_0xfd92('0x50')]]=_0x1d4574[_0xfd92('0x51')][_0xfd92('0x52')]();}else if(_0x1d4574['type']===_0xfd92('0x53')&&_0x1d4574[_0xfd92('0x54')]&&_0x1d4574[_0xfd92('0x50')]){_0x17af1b[_0x1d4574[_0xfd92('0x54')]]&&(_0x402582[_0x1d4574[_0xfd92('0x50')]]=_0x17af1b[_0x1d4574[_0xfd92('0x54')]][_0xfd92('0x52')]());}else if(_0x1d4574[_0xfd92('0x40')]==='customVariable'&&_0x1d4574[_0xfd92('0x55')]&&_0x1d4574[_0xfd92('0x55')][_0xfd92('0x56')]&&_0x1d4574['idField']){_0x17af1b[_0x1d4574[_0xfd92('0x55')][_0xfd92('0x56')]['toLowerCase']()]&&(_0x402582[_0x1d4574[_0xfd92('0x50')]]=_0x17af1b[_0x1d4574['Variable'][_0xfd92('0x56')][_0xfd92('0x57')]()][_0xfd92('0x52')]());}});}return _0x402582;}function getConnection(_0x2a78d6){var _0x12511d=_0x2a78d6[_0xfd92('0x58')][_0xfd92('0x59')](_0x2a78d6[_0xfd92('0x5a')]);var _0x514ff8=new jsforce[(_0xfd92('0x5b'))]({'oauth2':{'loginUrl':_0x2a78d6[_0xfd92('0x5c')]||'https://login.salesforce.com','clientId':_0x2a78d6['clientId'],'clientSecret':_0x2a78d6['clientSecret']}});return _0x514ff8['login'](_0x2a78d6[_0xfd92('0x5d')],_0x12511d)[_0xfd92('0x26')](function(){logger['info'](_0xfd92('0x5e'));return _0x514ff8;});}exports['queue']=function(_0x593c04,_0x38bb46,_0x3c12d9,_0x5f0a52,_0x26b0b9,_0x54f2df){var _0x511a3f,_0x199015,_0x1160b8,_0x1b2442;_0x54f2df[_0xfd92('0x5f')]=intUtil[_0xfd92('0x60')](_0x54f2df[_0xfd92('0x5f')]);_0x54f2df['remoteUri']=intUtil[_0xfd92('0x60')](_0x54f2df[_0xfd92('0x5c')]);if(_0x26b0b9&&_0x26b0b9[_0xfd92('0x61')]){logger['info']('[QUEUE]',_0xfd92('0x62'));_0x38bb46['recordingURL']=util[_0xfd92('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54f2df[_0xfd92('0x5f')],_0x38bb46[_0xfd92('0x63')],md5(_0x38bb46[_0xfd92('0x63')]));}else{_0x38bb46[_0xfd92('0x64')]='';}return getConnection(_0x54f2df)[_0xfd92('0x26')](function(_0xbdd62a){_0x1b2442=_0xbdd62a;return getUser(_0x54f2df,_0x5f0a52[_0xfd92('0x65')],_0x1b2442);})[_0xfd92('0x26')](function(_0x24dbc7){_0x511a3f=_0x24dbc7;return getEndUser(_0x54f2df,_0x3c12d9,_0x38bb46[_0xfd92('0x66')],_0x38bb46[_0xfd92('0x67')],_0x1b2442);})[_0xfd92('0x26')](function(_0x1e1460){_0x199015=_0x1e1460;return getTicket(_0x54f2df,_0x511a3f,_0x199015,_0x3c12d9,_0x38bb46,_0x3c12d9[_0xfd92('0x68')],_0x1b2442,_0xfd92('0x69'));})[_0xfd92('0x26')](function(_0x3dd277){_0x1160b8=_0x3dd277;logger[_0xfd92('0x2a')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x1160b8['id']);logger['info'](_0xfd92('0x6a'),_0x1160b8['id'],_0x5f0a52[_0xfd92('0x56')],_0x54f2df[_0xfd92('0x40')]);switch(_0x54f2df[_0xfd92('0x40')]){case _0xfd92('0x6b'):emit(util[_0xfd92('0x46')](_0xfd92('0x6c'),_0x5f0a52['name']),_0xfd92('0x6d'),{'recordId':_0x1160b8['id']});break;case'newTab':emit(util[_0xfd92('0x46')]('user:%s',_0x5f0a52[_0xfd92('0x56')]),_0xfd92('0x6e'),{'uri':util[_0xfd92('0x46')](_0xfd92('0x6f'),_0x1b2442[_0xfd92('0x70')],_0x1160b8['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xfd92('0x71')](function(_0x12c417){logger[_0xfd92('0x72')](_0xfd92('0x73'),_0x12c417);});};exports['outbound']=function(_0x3db531,_0x7d358d,_0x4ee096,_0xd89f76,_0x16ca64,_0x41a1e1,_0x820048){var _0x254374,_0x2bc6cf,_0x9541a8,_0x12aae6;_0x41a1e1['serverUrl']=intUtil['stripTrailingSlash'](_0x41a1e1[_0xfd92('0x5f')]);_0x41a1e1[_0xfd92('0x5c')]=intUtil['stripTrailingSlash'](_0x41a1e1[_0xfd92('0x5c')]);if(_0x820048&&_0x820048[_0xfd92('0x74')]&&_0x820048[_0xfd92('0x74')]!==_0xfd92('0x75')){logger[_0xfd92('0x2a')](_0xfd92('0x76'),_0xfd92('0x62'));_0x7d358d[_0xfd92('0x64')]=util[_0xfd92('0x46')](_0xfd92('0x77'),_0x41a1e1[_0xfd92('0x5f')],_0x7d358d[_0xfd92('0x63')],md5(_0x7d358d[_0xfd92('0x63')]));}return getConnection(_0x41a1e1)[_0xfd92('0x26')](function(_0x16cce8){_0x12aae6=_0x16cce8;return getUser(_0x41a1e1,_0xd89f76[_0xfd92('0x65')],_0x12aae6);})[_0xfd92('0x26')](function(_0xd67e2b){_0x254374=_0xd67e2b;return getEndUser(_0x41a1e1,_0x4ee096,_0x7d358d[_0xfd92('0x78')],_0x7d358d[_0xfd92('0x79')],_0x12aae6);})[_0xfd92('0x26')](function(_0x1b45dd){_0x2bc6cf=_0x1b45dd;return getTicket(_0x41a1e1,_0x254374,_0x2bc6cf,_0x4ee096,_0x7d358d,_0x4ee096[_0xfd92('0x68')],_0x12aae6,'outbound');})['then'](function(_0x440570){_0x9541a8=_0x440570;logger[_0xfd92('0x2a')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x9541a8['id']);logger[_0xfd92('0x2a')](_0xfd92('0x7a'),_0x9541a8['id'],_0xd89f76['name'],_0x41a1e1[_0xfd92('0x40')]);switch(_0x41a1e1[_0xfd92('0x40')]){case'integrationTab':emit(util[_0xfd92('0x46')](_0xfd92('0x6c'),_0xd89f76[_0xfd92('0x56')]),_0xfd92('0x6d'),{'recordId':_0x9541a8['id']});break;case _0xfd92('0x7b'):emit(util[_0xfd92('0x46')]('user:%s',_0xd89f76['name']),'trigger:browser:url',{'uri':util[_0xfd92('0x46')](_0xfd92('0x6f'),_0x12aae6[_0xfd92('0x70')],_0x9541a8['id'])});break;default:logger[_0xfd92('0x72')](_0xfd92('0x76'),_0xfd92('0x7c'));}})[_0xfd92('0x71')](function(_0x429d42){logger[_0xfd92('0x72')]('[OUTBOUND]',_0x429d42);});};exports[_0xfd92('0x7d')]=function(_0xb727ed,_0x4059b1,_0x4a620a,_0x55ba7d,_0xc0a79,_0x5e6498){var _0x363f08,_0x255bba,_0xec0176,_0x5e4a6d;_0x5e6498['serverUrl']=intUtil['stripTrailingSlash'](_0x5e6498[_0xfd92('0x5f')]);_0x5e6498[_0xfd92('0x5c')]=intUtil[_0xfd92('0x60')](_0x5e6498[_0xfd92('0x5c')]);if(_0xc0a79&&_0xc0a79[_0xfd92('0x61')]){logger[_0xfd92('0x2a')]('['+_0x4059b1[_0xfd92('0x7e')][_0xfd92('0x7f')]()+']','Recording\x20is\x20enabled!');_0x4059b1['recordingURL']=util[_0xfd92('0x46')](_0xfd92('0x77'),_0x5e6498[_0xfd92('0x5f')],_0x4059b1[_0xfd92('0x63')],md5(_0x4059b1['uniqueid']));}else{_0x4059b1['recordingURL']='';}return getConnection(_0x5e6498)['then'](function(_0x37ee3e){_0x5e4a6d=_0x37ee3e;if(!_[_0xfd92('0x23')](_0x55ba7d)){return getUser(_0x5e6498,_0x55ba7d[_0xfd92('0x56')],_0x5e4a6d);}else{return getUser(_0x5e6498,null,_0x5e4a6d);}})[_0xfd92('0x26')](function(_0x39e579){_0x363f08=_0x39e579;return getEndUser(_0x5e6498,_0x4a620a,_0x4059b1[_0xfd92('0x66')],_0x4059b1['calleridnum'],_0x5e4a6d);})[_0xfd92('0x26')](function(_0x17148a){_0x255bba=_0x17148a;return getTicket(_0x5e6498,_0x363f08,_0x255bba,_0x4a620a,_0x4059b1,_0x4a620a[_0xfd92('0x68')],_0x5e4a6d);})['then'](function(_0x1a567a){_0xec0176=_0x1a567a;logger[_0xfd92('0x2a')]('['+_0x4059b1[_0xfd92('0x7e')][_0xfd92('0x7f')]()+_0xfd92('0x80'),_0xec0176['id']);logger['info']('['+_0x4059b1[_0xfd92('0x7e')][_0xfd92('0x7f')]()+_0xfd92('0x81'),_0x5e6498['type']);})[_0xfd92('0x71')](function(_0x1bf77a){logger['error']('['+_0x4059b1[_0xfd92('0x7e')][_0xfd92('0x7f')]()+']',_0x1bf77a);});}; \ 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 3cd0147..4b05227 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 _0x293a=['error','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','then','],\x20getUser\x20entity','active','true','userId','sys_id','message','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','catch','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','nameField','customField','content','toString','picklist','type','idField','toLowerCase','variable','variableName','customVariable','Variable','name','outbound','POST','incident','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm'];(function(_0x44e3b1,_0x12291e){var _0x277485=function(_0x21517f){while(--_0x21517f){_0x44e3b1['push'](_0x44e3b1['shift']());}};_0x277485(++_0x12291e);}(_0x293a,0xc0));var _0xa293=function(_0x449340,_0x2233e1){_0x449340=_0x449340-0x0;var _0x1a188d=_0x293a[_0x449340];return _0x1a188d;};'use strict';var _=require(_0xa293('0x0'));var Promise=require('bluebird');var rp=require(_0xa293('0x1'));var util=require(_0xa293('0x2'));var md5=require(_0xa293('0x3'));var Redis=require(_0xa293('0x4'));var intUtil=require('./util');var config=require(_0xa293('0x5'));var logger=require(_0xa293('0x6'))(_0xa293('0x7'));config[_0xa293('0x8')]=_[_0xa293('0x9')](config[_0xa293('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa293('0xa'))(new Redis(config[_0xa293('0x8')]));function getAdminUser(_0x59d8ad,_0x208a6d,_0x2bd780,_0x5ad60a,_0x5e4ed7,_0x12a6d7){return new Promise(function(_0x4b3813,_0x22ed59){var _0x3a6778={'method':_0xa293('0xb'),'uri':_0x5ad60a+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5e4ed7+'&'+_0x12a6d7,'auth':_0x208a6d,'json':!![]};return rp(_0x3a6778)['then'](function(_0x101a9f){if(_0x101a9f[_0xa293('0xc')][_0xa293('0xd')]>0x0){_0x2bd780[_0xa293('0xe')]=_0x101a9f['result'][0x0]['sys_id'];}logger[_0xa293('0xf')]('['+[_0x59d8ad[_0xa293('0x10')]()]+_0xa293('0x11'),_0x2bd780);_0x4b3813(_0x2bd780);})['catch'](function(_0x260601){logger[_0xa293('0x12')]('['+[_0x59d8ad[_0xa293('0x10')]()]+']',_0x260601['message']);_0x22ed59(_0x260601['message']);});});}function getUser(_0x44e81a,_0x47d36a,_0x502a18,_0x279491,_0x29245d){return function(_0x376dab){logger[_0xa293('0xf')]('['+[_0x44e81a['toUpperCase']()]+_0xa293('0x13'),_0x376dab);return new Promise(function(_0x1bb755,_0x172077){if(intUtil[_0xa293('0x14')](_0x376dab[_0xa293('0x15')])){var _0x191594={'method':_0xa293('0xb'),'uri':_0x502a18+_0xa293('0x16')+_0x376dab[_0xa293('0x15')]+'&'+_0x279491+'&'+_0x29245d,'auth':_0x47d36a,'json':!![]};logger['info']('['+[_0x44e81a[_0xa293('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x191594);return rp(_0x191594)[_0xa293('0x17')](function(_0x2a83f9){logger[_0xa293('0xf')]('['+[_0x44e81a[_0xa293('0x10')]()]+_0xa293('0x18'),_0x2a83f9);if(_0x2a83f9[_0xa293('0xc')][_0xa293('0xd')]>0x0&&String(_0x2a83f9['result'][0x0][_0xa293('0x19')])===_0xa293('0x1a')){_0x376dab[_0xa293('0x1b')]=_0x2a83f9['result'][0x0][_0xa293('0x1c')];}else{_0x376dab[_0xa293('0x1b')]=_0x376dab[_0xa293('0xe')];_0x376dab[_0xa293('0x15')]=_0x376dab['adminEmail'];}logger[_0xa293('0xf')]('['+[_0x44e81a[_0xa293('0x10')]()]+'],\x20getUser\x20crm',_0x376dab);_0x1bb755(_0x376dab);})['catch'](function(_0x20e73c){logger[_0xa293('0x12')]('['+[_0x44e81a[_0xa293('0x10')]()]+']',_0x20e73c['message']);_0x172077(_0x20e73c[_0xa293('0x1d')]);});}else{logger[_0xa293('0xf')]('['+[_0x44e81a[_0xa293('0x10')]()]+']\x20using\x20admin\x20profile');_0x376dab[_0xa293('0x1b')]=_0x376dab['adminId'];_0x376dab[_0xa293('0x15')]=_0x376dab['adminEmail'];_0x1bb755(_0x376dab);}});};}function createEndUser(_0x43623b,_0x25944d,_0x342faa,_0x45dc8f,_0x463141){logger['info']('['+[_0x43623b[_0xa293('0x10')]()]+_0xa293('0x1e'),_0x342faa);return new Promise(function(_0xd6487e,_0x1e9534){var _0x54da8b={'method':'POST','uri':_0x45dc8f+_0xa293('0x1f')+_0x463141,'body':{'user_name':_0x342faa[_0xa293('0x20')],'roles':'user','first_name':_0x342faa[_0xa293('0x20')],'active':_0xa293('0x1a'),'date_format':_0xa293('0x21'),'phone':_0x342faa[_0xa293('0x20')]},'auth':_0x25944d,'json':!![]};return rp(_0x54da8b)['then'](function(_0x56bc78){logger['info']('['+[_0x43623b[_0xa293('0x10')]()]+_0xa293('0x22'),_0x56bc78[_0xa293('0xc')]);_0x342faa['endUserId']=_0x56bc78[_0xa293('0xc')][_0xa293('0x1c')];_0xd6487e(_0x342faa);})[_0xa293('0x23')](function(_0x2f817d){logger[_0xa293('0x12')]('['+[_0x43623b[_0xa293('0x10')]()]+']',_0x2f817d[_0xa293('0x1d')]);_0x1e9534(_0x2f817d[_0xa293('0x1d')]);});});}function getEndUser(_0x1f3152,_0x221693,_0x53f943,_0x2bfe3e,_0x526bd0){return function(_0x12b016){logger[_0xa293('0xf')]('['+[_0x1f3152[_0xa293('0x10')]()]+_0xa293('0x24'),_0x12b016);return new Promise(function(_0x273187,_0x2e3b86){var _0x3fdadb={'method':'GET','uri':_0x53f943+_0xa293('0x25')+_0x12b016[_0xa293('0x20')]+'&'+_0x2bfe3e+'&'+_0x526bd0,'auth':_0x221693,'json':!![]};return rp(_0x3fdadb)[_0xa293('0x17')](function(_0x36ccb5){if(_0x36ccb5[_0xa293('0xc')][_0xa293('0xd')]>0x0){_0x12b016[_0xa293('0x26')]=_0x36ccb5['result'][0x0][_0xa293('0x1c')];logger[_0xa293('0xf')]('['+[_0x1f3152[_0xa293('0x10')]()]+_0xa293('0x27'),_0x12b016);_0x273187(_0x12b016);}else{return createEndUser(_0x1f3152,_0x221693,_0x12b016,_0x53f943,_0x2bfe3e)[_0xa293('0x17')](function(_0x3a8522){logger[_0xa293('0xf')]('['+[_0x1f3152[_0xa293('0x10')]()]+_0xa293('0x28'),_0x3a8522);_0x273187(_0x3a8522);});}})[_0xa293('0x23')](function(_0x3cc2a4){logger[_0xa293('0x12')]('['+[_0x1f3152[_0xa293('0x10')]()]+']',_0x3cc2a4[_0xa293('0x1d')]);_0x2e3b86(_0x3cc2a4[_0xa293('0x1d')]);});});};}function getCustomFields(_0x8bcfcc,_0x3ac9ed){var _0x4c8217={};if(_0x8bcfcc[_0xa293('0xd')]>0x0){_[_0xa293('0x29')](_0x8bcfcc,function(_0x3a42ff){if(_[_0xa293('0x2a')]([_0xa293('0x2b'),'picklist'],_0x3a42ff['type'])&&_0x3a42ff[_0xa293('0x2c')]&&!_0x3a42ff[_0xa293('0x2d')]){_0x4c8217[_0x3a42ff['nameField']['toLowerCase']()]=_0x3a42ff[_0xa293('0x2e')][_0xa293('0x2f')]();}else if(_[_0xa293('0x2a')]([_0xa293('0x2b'),_0xa293('0x30')],_0x3a42ff[_0xa293('0x31')])&&_0x3a42ff[_0xa293('0x32')]&&_0x3a42ff[_0xa293('0x2d')]){_0x4c8217[_0x3a42ff[_0xa293('0x32')][_0xa293('0x33')]()]=_0x3a42ff[_0xa293('0x2e')][_0xa293('0x2f')]();}else if(_0x3a42ff[_0xa293('0x31')]===_0xa293('0x34')&&_0x3a42ff[_0xa293('0x35')]&&_0x3a42ff[_0xa293('0x32')]&&_0x3a42ff[_0xa293('0x2d')]){_0x4c8217[_0x3a42ff[_0xa293('0x32')][_0xa293('0x33')]()]=_0x3ac9ed[_0x3a42ff[_0xa293('0x35')]][_0xa293('0x2f')]();}else if(_0x3a42ff[_0xa293('0x31')]===_0xa293('0x36')&&_0x3a42ff[_0xa293('0x37')]&&_0x3a42ff['Variable'][_0xa293('0x38')]&&_0x3a42ff[_0xa293('0x32')]&&_0x3a42ff[_0xa293('0x2d')]){_0x4c8217[_0x3a42ff['idField'][_0xa293('0x33')]()]=_0x3ac9ed[_0x3a42ff[_0xa293('0x37')][_0xa293('0x38')][_0xa293('0x33')]()][_0xa293('0x2f')]();}});}return _0x4c8217;}function getTicket(_0x16f8b9,_0x522a8b,_0x39677d,_0x224963,_0x1e63fb,_0x180aad){return function(_0x45d521){logger[_0xa293('0xf')]('['+[_0x16f8b9[_0xa293('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x45d521);return new Promise(function(_0x526889,_0xdcb73){var _0x2725e3=_0x16f8b9[_0xa293('0x33')]()===_0xa293('0x39')?_0x45d521['userId']:_0x45d521[_0xa293('0x26')];var _0x23584f={'method':_0xa293('0x3a'),'uri':_0x39677d+_0xa293('0x3b')+'?'+_0x180aad,'body':Object['assign']({},{'active':'true','caller_id':_0x2725e3,'assigned_to':_0x45d521[_0xa293('0x1b')],'short_description':intUtil[_0xa293('0x3c')](_0x224963[_0xa293('0x3d')],_0x1e63fb,'\x20'),'description':intUtil['getString'](_0x224963[_0xa293('0x3e')],_0x1e63fb,'\x0a')},getCustomFields(_0x224963['Fields'],_0x1e63fb)),'auth':_0x522a8b,'json':!![]};return rp(_0x23584f)['then'](function(_0x3920ac){logger[_0xa293('0xf')]('['+[_0x16f8b9['toUpperCase']()]+_0xa293('0x3f'),_0x3920ac[_0xa293('0xc')]);_0x45d521[_0xa293('0x40')]=_0x3920ac[_0xa293('0xc')]['sys_id'];_0x45d521[_0xa293('0x41')]=_0x3920ac[_0xa293('0xc')]['number'];logger[_0xa293('0xf')]('['+[_0x16f8b9['toUpperCase']()]+_0xa293('0x42'),_0x45d521);_0x526889(_0x45d521);})['catch'](function(_0x15e47d){logger[_0xa293('0x12')]('['+[_0x16f8b9[_0xa293('0x10')]()]+']',_0x15e47d['message']);_0xdcb73(_0x15e47d[_0xa293('0x1d')]);});});};}function createRemoteTag(_0x61db0,_0x8981b9,_0x1ae111,_0x4b030e){return new Promise(function(_0x3cf75b,_0x967de2){var _0x5243bd={'method':_0xa293('0x3a'),'uri':_0x1ae111+_0xa293('0x43')+'?'+_0x4b030e,'body':{'short_description':_0x61db0,'global':!![],'active':!![],'name':_0x61db0},'auth':_0x8981b9,'json':!![]};return rp(_0x5243bd)[_0xa293('0x17')](function(_0x53289d){var _0x5332b2=_0x53289d[_0xa293('0xc')]['sys_id'];_0x3cf75b(_0x5332b2);});});}function getRemoteTag(_0x2f6b7b,_0x11e259,_0x222a3d,_0xc96466,_0x34efea){return new Promise(function(_0xb66d0d,_0x3371f7){var _0x2068b0={'method':_0xa293('0xb'),'uri':_0x222a3d+_0xa293('0x43')+_0xa293('0x44')+_0x2f6b7b+'&'+_0xc96466,'auth':_0x11e259,'json':!![]};return rp(_0x2068b0)[_0xa293('0x17')](function(_0x29888c){if(_0x29888c[_0xa293('0xc')]['length']>0x0){var _0x366058=_0x29888c[_0xa293('0xc')][0x0][_0xa293('0x1c')];_0xb66d0d(_0x366058);}else{return createRemoteTag(_0x2f6b7b,_0x11e259,_0x222a3d,_0xc96466)[_0xa293('0x17')](function(_0x3bdbb0){_0xb66d0d(_0x3bdbb0);});}});});}function assignTagToIncident(_0x32db9e,_0x34ccd4,_0x92f0fa,_0x391e99,_0x11c548){return new Promise(function(_0x534b17,_0x2ea4a6){var _0x2c2f3e={'method':_0xa293('0x3a'),'uri':_0x92f0fa+'label_entry'+'?'+_0x11c548,'body':{'label':_0x32db9e,'table':_0xa293('0x3b'),'id_type':_0xa293('0x45'),'table_key':_0x391e99[_0xa293('0x40')],'title':_0xa293('0x46')+_0x391e99['ticketNumber'],'id_display':_0x391e99[_0xa293('0x41')]},'auth':_0x34ccd4,'json':!![]};return rp(_0x2c2f3e)[_0xa293('0x17')](function(_0x3676ce){_0x534b17();})[_0xa293('0x23')](function(){_0x534b17();});});}function manageTags(_0x308603,_0x59b500,_0xef5ee2,_0x1c9f7e,_0x37462b,_0x6b1dd1,_0x26ed0f){return new Promise(function(_0x389fa3,_0x589792){var _0x3171fa=[];_0x59b500[_0xa293('0x29')](function(_0x25df37){_0x3171fa[_0xa293('0x47')](getRemoteTag(_0x25df37,_0xef5ee2,_0x1c9f7e,_0x6b1dd1,_0x26ed0f));});return Promise[_0xa293('0x48')](_0x3171fa)['then'](function(_0x5b2d5b){if(_0x5b2d5b['length']){logger['info']('['+[_0x308603[_0xa293('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5b2d5b);var _0x5cf481=[];_0x5b2d5b[_0xa293('0x29')](function(_0x45e307){_0x5cf481[_0xa293('0x47')](assignTagToIncident(_0x45e307,_0xef5ee2,_0x1c9f7e,_0x37462b,_0x6b1dd1));});return Promise[_0xa293('0x48')](_0x5cf481)[_0xa293('0x17')](function(){_0x389fa3();})[_0xa293('0x23')](function(){_0x389fa3();});}else{_0x389fa3();}});});}function getTags(_0x1fc820,_0x272949,_0x56a428,_0xf2652,_0x39dc27,_0x4700df){return function(_0x434da7){return new Promise(function(_0x597cb8,_0x4e090e){var _0x26079d=[];var _0x156398=_0xf2652[_0xa293('0x49')];if(_0x156398&&_0x156398[_0xa293('0xd')]>0x0){_0x26079d=_[_0xa293('0x4a')](_0x156398,_0xa293('0x38'));}if(_0x26079d[_0xa293('0xd')]>0x0){return manageTags(_0x1fc820,_0x26079d,_0x272949,_0x56a428,_0x434da7,_0x39dc27,_0x4700df)[_0xa293('0x17')](function(){_0x597cb8(_0x434da7);});}else{_0x597cb8(_0x434da7);}});};}function emit(_0x1600ac,_0x5dba03,_0x514c67){var _0x567413=_0xa293('0x4b')+_0xa293('0x4c')+_0xa293('0x4d')+_0xa293('0x4e');var _0x18a0f1={'uri':_0x1600ac+_0xa293('0x4f')+_0x514c67+_0x567413};io['to'](util[_0xa293('0x50')]('user:%s',_0x5dba03))[_0xa293('0x51')](_0xa293('0x52'),_0x18a0f1);}exports['cs']=function(_0x2b6a11,_0x570ad4,_0x4d2820,_0xfa9d1c,_0x4edd5b,_0x58efde,_0x53adfd,_0x1c0e36){var _0x158c1b={};var _0x147a02={'user':_0x58efde['username'],'pass':_0x58efde['password']};var _0x9d74fc='sysparm_limit=1';var _0x5a0774=_0xa293('0x53');_0x58efde[_0xa293('0x54')]=intUtil[_0xa293('0x55')](_0x58efde[_0xa293('0x54')]);_0x58efde[_0xa293('0x56')]=intUtil[_0xa293('0x55')](_0x58efde['serverUrl']);var _0x330de0=util['format'](_0xa293('0x57'),_0x58efde[_0xa293('0x54')]);_0x158c1b[_0xa293('0x15')]=!_[_0xa293('0x58')](_0xfa9d1c)?_0xfa9d1c[_0xa293('0x59')]:null;_0x158c1b['adminEmail']=_0x58efde['email'];_0x158c1b[_0xa293('0x20')]=_0x1c0e36[_0xa293('0x33')]()===_0xa293('0x39')?_0x570ad4[_0xa293('0x5a')]:_0x570ad4[_0xa293('0x5b')];_0x158c1b[_0xa293('0x5c')]=_0x1c0e36==='queue'||_0x1c0e36==='unmanaged'?_0xa293('0x5d'):_0xa293('0x39');var _0x382d03=util['format'](_0xa293('0x5e'),_0x58efde['serverUrl'],_0x570ad4[_0xa293('0x5f')],md5(_0x570ad4[_0xa293('0x5f')]));if(_0x4edd5b&&_0x4edd5b[_0xa293('0x60')]){logger[_0xa293('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x570ad4[_0xa293('0x61')]=_0x382d03;}else if(_0x53adfd&&_0x53adfd[_0xa293('0x62')]&&_0x53adfd[_0xa293('0x62')]!==_0xa293('0x63')){logger[_0xa293('0xf')]('[OUTBOUND]',_0xa293('0x64'));_0x570ad4['recordingURL']=_0x382d03;}else{_0x570ad4[_0xa293('0x61')]='';}return getAdminUser(_0x1c0e36,_0x147a02,_0x158c1b,_0x330de0,_0x5a0774,_0x9d74fc)['then'](getUser(_0x1c0e36,_0x147a02,_0x330de0,_0x5a0774,_0x9d74fc))[_0xa293('0x17')](getEndUser(_0x1c0e36,_0x147a02,_0x330de0,_0x5a0774,_0x9d74fc))[_0xa293('0x17')](getTicket(_0x1c0e36,_0x147a02,_0x330de0,_0x4d2820,_0x570ad4,_0x5a0774))[_0xa293('0x17')](function(_0x4a59a4){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x4a59a4[_0xa293('0x40')]));logger['info'](util[_0xa293('0x50')](_0xa293('0x65'),_0x1c0e36));if(_0x1c0e36!==_0xa293('0x66')){logger['info']('['+[_0x1c0e36[_0xa293('0x10')]()]+']',_0xa293('0x67'));emit(_0x58efde['remoteUri'],_0xfa9d1c[_0xa293('0x38')],_0x4a59a4[_0xa293('0x40')]);}})[_0xa293('0x23')](function(_0x17227e){logger[_0xa293('0x12')]('['+[_0x1c0e36[_0xa293('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xa293('0x68')](_0x17227e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x62a1=['[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','ioredis','./util','../../../../config/logger','redis','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','GET','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','idField','name','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingFormat'];(function(_0x330858,_0x115825){var _0x1f5c25=function(_0x4b626b){while(--_0x4b626b){_0x330858['push'](_0x330858['shift']());}};_0x1f5c25(++_0x115825);}(_0x62a1,0x145));var _0x162a=function(_0x3cc3bf,_0x31a454){_0x3cc3bf=_0x3cc3bf-0x0;var _0x1aa24e=_0x62a1[_0x3cc3bf];return _0x1aa24e;};'use strict';var _=require(_0x162a('0x0'));var Promise=require('bluebird');var rp=require(_0x162a('0x1'));var util=require(_0x162a('0x2'));var md5=require('md5');var Redis=require(_0x162a('0x3'));var intUtil=require(_0x162a('0x4'));var config=require('../../../../config/environment');var logger=require(_0x162a('0x5'))('servicenow');config[_0x162a('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x162a('0x6')]));function getAdminUser(_0x1ae2c8,_0x34ec3f,_0x56d242,_0x1a3d74,_0x30137d,_0x223dfb){return new Promise(function(_0x29f783,_0x2584ef){var _0x1aee68={'method':'GET','uri':_0x1a3d74+_0x162a('0x7')+'&'+_0x30137d+'&'+_0x223dfb,'auth':_0x34ec3f,'json':!![]};return rp(_0x1aee68)[_0x162a('0x8')](function(_0x506079){if(_0x506079[_0x162a('0x9')][_0x162a('0xa')]>0x0){_0x56d242[_0x162a('0xb')]=_0x506079[_0x162a('0x9')][0x0][_0x162a('0xc')];}logger['info']('['+[_0x1ae2c8[_0x162a('0xd')]()]+_0x162a('0xe'),_0x56d242);_0x29f783(_0x56d242);})[_0x162a('0xf')](function(_0x53588c){logger[_0x162a('0x10')]('['+[_0x1ae2c8[_0x162a('0xd')]()]+']',_0x53588c[_0x162a('0x11')]);_0x2584ef(_0x53588c['message']);});});}function getUser(_0x5dddff,_0x26b3d0,_0x48ed64,_0x50c9c3,_0x54426c){return function(_0x5f4c44){logger[_0x162a('0x12')]('['+[_0x5dddff['toUpperCase']()]+_0x162a('0x13'),_0x5f4c44);return new Promise(function(_0x5d6ed8,_0x2ebc1b){if(intUtil[_0x162a('0x14')](_0x5f4c44['userEmail'])){var _0x1467a7={'method':_0x162a('0x15'),'uri':_0x48ed64+_0x162a('0x16')+_0x5f4c44[_0x162a('0x17')]+'&'+_0x50c9c3+'&'+_0x54426c,'auth':_0x26b3d0,'json':!![]};logger[_0x162a('0x12')]('['+[_0x5dddff[_0x162a('0xd')]()]+_0x162a('0x18'),_0x1467a7);return rp(_0x1467a7)[_0x162a('0x8')](function(_0x5b8386){logger[_0x162a('0x12')]('['+[_0x5dddff[_0x162a('0xd')]()]+_0x162a('0x19'),_0x5b8386);if(_0x5b8386[_0x162a('0x9')][_0x162a('0xa')]>0x0&&String(_0x5b8386['result'][0x0]['active'])===_0x162a('0x1a')){_0x5f4c44[_0x162a('0x1b')]=_0x5b8386[_0x162a('0x9')][0x0][_0x162a('0xc')];}else{_0x5f4c44[_0x162a('0x1b')]=_0x5f4c44[_0x162a('0xb')];_0x5f4c44[_0x162a('0x17')]=_0x5f4c44[_0x162a('0x1c')];}logger[_0x162a('0x12')]('['+[_0x5dddff[_0x162a('0xd')]()]+_0x162a('0x1d'),_0x5f4c44);_0x5d6ed8(_0x5f4c44);})[_0x162a('0xf')](function(_0x26868c){logger[_0x162a('0x10')]('['+[_0x5dddff[_0x162a('0xd')]()]+']',_0x26868c[_0x162a('0x11')]);_0x2ebc1b(_0x26868c[_0x162a('0x11')]);});}else{logger[_0x162a('0x12')]('['+[_0x5dddff[_0x162a('0xd')]()]+_0x162a('0x1e'));_0x5f4c44[_0x162a('0x1b')]=_0x5f4c44[_0x162a('0xb')];_0x5f4c44[_0x162a('0x17')]=_0x5f4c44[_0x162a('0x1c')];_0x5d6ed8(_0x5f4c44);}});};}function createEndUser(_0x5a4eee,_0x17a887,_0x2d0368,_0x256b60,_0x282cf5){logger['info']('['+[_0x5a4eee[_0x162a('0xd')]()]+'],\x20createEndUser\x20input\x20crm',_0x2d0368);return new Promise(function(_0x6ca8c,_0x475d71){var _0x4d55a7={'method':_0x162a('0x1f'),'uri':_0x256b60+_0x162a('0x20')+_0x282cf5,'body':{'user_name':_0x2d0368[_0x162a('0x21')],'roles':_0x162a('0x22'),'first_name':_0x2d0368[_0x162a('0x21')],'active':_0x162a('0x1a'),'date_format':_0x162a('0x23'),'phone':_0x2d0368['endUserNumber']},'auth':_0x17a887,'json':!![]};return rp(_0x4d55a7)[_0x162a('0x8')](function(_0x13de8d){logger[_0x162a('0x12')]('['+[_0x5a4eee[_0x162a('0xd')]()]+_0x162a('0x24'),_0x13de8d[_0x162a('0x9')]);_0x2d0368[_0x162a('0x25')]=_0x13de8d[_0x162a('0x9')]['sys_id'];_0x6ca8c(_0x2d0368);})['catch'](function(_0x254d4d){logger['error']('['+[_0x5a4eee['toUpperCase']()]+']',_0x254d4d['message']);_0x475d71(_0x254d4d[_0x162a('0x11')]);});});}function getEndUser(_0x39f325,_0x589da5,_0x398930,_0x4c969f,_0x267d6e){return function(_0x278fa0){logger[_0x162a('0x12')]('['+[_0x39f325['toUpperCase']()]+_0x162a('0x26'),_0x278fa0);return new Promise(function(_0x4ea4b4,_0x28fdb4){var _0x1ba1f3={'method':_0x162a('0x15'),'uri':_0x398930+'sys_user?sysparm_query=phone%3D'+_0x278fa0[_0x162a('0x21')]+'&'+_0x4c969f+'&'+_0x267d6e,'auth':_0x589da5,'json':!![]};return rp(_0x1ba1f3)[_0x162a('0x8')](function(_0x393e3a){if(_0x393e3a[_0x162a('0x9')][_0x162a('0xa')]>0x0){_0x278fa0[_0x162a('0x25')]=_0x393e3a[_0x162a('0x9')][0x0]['sys_id'];logger[_0x162a('0x12')]('['+[_0x39f325[_0x162a('0xd')]()]+_0x162a('0x27'),_0x278fa0);_0x4ea4b4(_0x278fa0);}else{return createEndUser(_0x39f325,_0x589da5,_0x278fa0,_0x398930,_0x4c969f)[_0x162a('0x8')](function(_0x44930c){logger[_0x162a('0x12')]('['+[_0x39f325['toUpperCase']()]+_0x162a('0x28'),_0x44930c);_0x4ea4b4(_0x44930c);});}})[_0x162a('0xf')](function(_0x30e5f5){logger[_0x162a('0x10')]('['+[_0x39f325['toUpperCase']()]+']',_0x30e5f5['message']);_0x28fdb4(_0x30e5f5[_0x162a('0x11')]);});});};}function getCustomFields(_0x8d165b,_0x11ae7c){var _0x3b1b86={};if(_0x8d165b[_0x162a('0xa')]>0x0){_['forEach'](_0x8d165b,function(_0x4d0bc5){if(_[_0x162a('0x29')]([_0x162a('0x2a'),_0x162a('0x2b')],_0x4d0bc5[_0x162a('0x2c')])&&_0x4d0bc5[_0x162a('0x2d')]&&!_0x4d0bc5[_0x162a('0x2e')]){_0x3b1b86[_0x4d0bc5[_0x162a('0x2d')][_0x162a('0x2f')]()]=_0x4d0bc5[_0x162a('0x30')][_0x162a('0x31')]();}else if(_['includes'](['string',_0x162a('0x2b')],_0x4d0bc5['type'])&&_0x4d0bc5['idField']&&_0x4d0bc5[_0x162a('0x2e')]){_0x3b1b86[_0x4d0bc5['idField'][_0x162a('0x2f')]()]=_0x4d0bc5[_0x162a('0x30')][_0x162a('0x31')]();}else if(_0x4d0bc5[_0x162a('0x2c')]===_0x162a('0x32')&&_0x4d0bc5[_0x162a('0x33')]&&_0x4d0bc5['idField']&&_0x4d0bc5[_0x162a('0x2e')]){_0x3b1b86[_0x4d0bc5['idField']['toLowerCase']()]=_0x11ae7c[_0x4d0bc5[_0x162a('0x33')]][_0x162a('0x31')]();}else if(_0x4d0bc5[_0x162a('0x2c')]===_0x162a('0x34')&&_0x4d0bc5[_0x162a('0x35')]&&_0x4d0bc5['Variable']['name']&&_0x4d0bc5[_0x162a('0x36')]&&_0x4d0bc5[_0x162a('0x2e')]){_0x3b1b86[_0x4d0bc5['idField'][_0x162a('0x2f')]()]=_0x11ae7c[_0x4d0bc5[_0x162a('0x35')][_0x162a('0x37')][_0x162a('0x2f')]()][_0x162a('0x31')]();}});}return _0x3b1b86;}function getTicket(_0x4f12fb,_0x453dc2,_0x141c1f,_0x4d5ee9,_0x3710dd,_0x19bc0f){return function(_0x4f5038){logger[_0x162a('0x12')]('['+[_0x4f12fb['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x4f5038);return new Promise(function(_0x13031f,_0x1a03c4){var _0x4113b4=_0x4f12fb[_0x162a('0x2f')]()==='outbound'?_0x4f5038[_0x162a('0x1b')]:_0x4f5038[_0x162a('0x25')];var _0x6597e7={'method':_0x162a('0x1f'),'uri':_0x141c1f+'incident'+'?'+_0x19bc0f,'body':Object['assign']({},{'active':_0x162a('0x1a'),'caller_id':_0x4113b4,'assigned_to':_0x4f5038[_0x162a('0x1b')],'short_description':intUtil[_0x162a('0x38')](_0x4d5ee9[_0x162a('0x39')],_0x3710dd,'\x20'),'description':intUtil[_0x162a('0x38')](_0x4d5ee9[_0x162a('0x3a')],_0x3710dd,'\x0a')},getCustomFields(_0x4d5ee9[_0x162a('0x3b')],_0x3710dd)),'auth':_0x453dc2,'json':!![]};return rp(_0x6597e7)[_0x162a('0x8')](function(_0x82f6c2){logger[_0x162a('0x12')]('['+[_0x4f12fb[_0x162a('0xd')]()]+_0x162a('0x3c'),_0x82f6c2[_0x162a('0x9')]);_0x4f5038[_0x162a('0x3d')]=_0x82f6c2[_0x162a('0x9')][_0x162a('0xc')];_0x4f5038[_0x162a('0x3e')]=_0x82f6c2['result'][_0x162a('0x3f')];logger[_0x162a('0x12')]('['+[_0x4f12fb[_0x162a('0xd')]()]+_0x162a('0x40'),_0x4f5038);_0x13031f(_0x4f5038);})['catch'](function(_0x4cc4f3){logger[_0x162a('0x10')]('['+[_0x4f12fb['toUpperCase']()]+']',_0x4cc4f3['message']);_0x1a03c4(_0x4cc4f3[_0x162a('0x11')]);});});};}function createRemoteTag(_0x237370,_0x16182a,_0x3a0f1e,_0x3983e4){return new Promise(function(_0x48a88c,_0x497239){var _0x271c26={'method':_0x162a('0x1f'),'uri':_0x3a0f1e+_0x162a('0x41')+'?'+_0x3983e4,'body':{'short_description':_0x237370,'global':!![],'active':!![],'name':_0x237370},'auth':_0x16182a,'json':!![]};return rp(_0x271c26)[_0x162a('0x8')](function(_0x47c595){var _0x41d49c=_0x47c595[_0x162a('0x9')][_0x162a('0xc')];_0x48a88c(_0x41d49c);});});}function getRemoteTag(_0x575bf9,_0x523bd6,_0x526e0a,_0x246969,_0xb115e0){return new Promise(function(_0x4660ff,_0xd0f02d){var _0x49d15f={'method':_0x162a('0x15'),'uri':_0x526e0a+_0x162a('0x41')+_0x162a('0x42')+_0x575bf9+'&'+_0x246969,'auth':_0x523bd6,'json':!![]};return rp(_0x49d15f)['then'](function(_0x4ae071){if(_0x4ae071[_0x162a('0x9')]['length']>0x0){var _0x2ecb3a=_0x4ae071[_0x162a('0x9')][0x0][_0x162a('0xc')];_0x4660ff(_0x2ecb3a);}else{return createRemoteTag(_0x575bf9,_0x523bd6,_0x526e0a,_0x246969)[_0x162a('0x8')](function(_0xd3661b){_0x4660ff(_0xd3661b);});}});});}function assignTagToIncident(_0x565b7a,_0x49cd5d,_0x1fb16a,_0x462933,_0xd7cad6){return new Promise(function(_0x71130b,_0x3c1c70){var _0x10b5d2={'method':_0x162a('0x1f'),'uri':_0x1fb16a+_0x162a('0x43')+'?'+_0xd7cad6,'body':{'label':_0x565b7a,'table':_0x162a('0x44'),'id_type':_0x162a('0x45'),'table_key':_0x462933['ticketId'],'title':'Incident\x20-\x20'+_0x462933[_0x162a('0x3e')],'id_display':_0x462933[_0x162a('0x3e')]},'auth':_0x49cd5d,'json':!![]};return rp(_0x10b5d2)['then'](function(_0x4192f8){_0x71130b();})[_0x162a('0xf')](function(){_0x71130b();});});}function manageTags(_0x288857,_0x35dead,_0x5f8026,_0x369985,_0x3835ce,_0x468613,_0x43f6d7){return new Promise(function(_0x5704e8,_0x297304){var _0x4f260e=[];_0x35dead['forEach'](function(_0x2c0f07){_0x4f260e[_0x162a('0x46')](getRemoteTag(_0x2c0f07,_0x5f8026,_0x369985,_0x468613,_0x43f6d7));});return Promise[_0x162a('0x47')](_0x4f260e)['then'](function(_0x13b6a4){if(_0x13b6a4[_0x162a('0xa')]){logger['info']('['+[_0x288857[_0x162a('0xd')]()]+_0x162a('0x48'),_0x13b6a4);var _0x402bd1=[];_0x13b6a4[_0x162a('0x49')](function(_0x334322){_0x402bd1['push'](assignTagToIncident(_0x334322,_0x5f8026,_0x369985,_0x3835ce,_0x468613));});return Promise[_0x162a('0x47')](_0x402bd1)[_0x162a('0x8')](function(){_0x5704e8();})['catch'](function(){_0x5704e8();});}else{_0x5704e8();}});});}function getTags(_0x1361b0,_0x353170,_0xff8598,_0x597ad9,_0x2b42f8,_0x2da76e){return function(_0x23b0be){return new Promise(function(_0x1091fc,_0x160785){var _0xd63ce5=[];var _0x3f645f=_0x597ad9[_0x162a('0x4a')];if(_0x3f645f&&_0x3f645f['length']>0x0){_0xd63ce5=_['map'](_0x3f645f,_0x162a('0x37'));}if(_0xd63ce5[_0x162a('0xa')]>0x0){return manageTags(_0x1361b0,_0xd63ce5,_0x353170,_0xff8598,_0x23b0be,_0x2b42f8,_0x2da76e)['then'](function(){_0x1091fc(_0x23b0be);});}else{_0x1091fc(_0x23b0be);}});};}function emit(_0x1c929a,_0x4602a5,_0x1e9ed3){var _0x6cef7=_0x162a('0x4b')+_0x162a('0x4c')+_0x162a('0x4d')+'%255EORDERBYDESCnumber';var _0x36e5d0={'uri':_0x1c929a+_0x162a('0x4e')+_0x1e9ed3+_0x6cef7};io['to'](util['format'](_0x162a('0x4f'),_0x4602a5))[_0x162a('0x50')]('trigger:browser:url',_0x36e5d0);}exports['cs']=function(_0x50f1a9,_0x4b0eae,_0x373569,_0x175efe,_0x5a9dac,_0x1261d1,_0x55d32c,_0x50f344){var _0xb851a5={};var _0x4ea655={'user':_0x1261d1['username'],'pass':_0x1261d1['password']};var _0x50cfa3=_0x162a('0x51');var _0x5211ec='sysparm_display_value=true';_0x1261d1[_0x162a('0x52')]=intUtil['stripTrailingSlash'](_0x1261d1[_0x162a('0x52')]);_0x1261d1[_0x162a('0x53')]=intUtil[_0x162a('0x54')](_0x1261d1[_0x162a('0x53')]);var _0x476385=util[_0x162a('0x55')](_0x162a('0x56'),_0x1261d1[_0x162a('0x52')]);_0xb851a5[_0x162a('0x17')]=!_[_0x162a('0x57')](_0x175efe)?_0x175efe['email']:null;_0xb851a5[_0x162a('0x1c')]=_0x1261d1[_0x162a('0x58')];_0xb851a5[_0x162a('0x21')]=_0x50f344[_0x162a('0x2f')]()===_0x162a('0x59')?_0x4b0eae[_0x162a('0x5a')]:_0x4b0eae[_0x162a('0x5b')];_0xb851a5[_0x162a('0x5c')]=_0x50f344===_0x162a('0x5d')||_0x50f344===_0x162a('0x5e')?_0x162a('0x5d'):'outbound';var _0x4e7dcc=util[_0x162a('0x55')](_0x162a('0x5f'),_0x1261d1[_0x162a('0x53')],_0x4b0eae[_0x162a('0x60')],md5(_0x4b0eae[_0x162a('0x60')]));if(_0x5a9dac&&_0x5a9dac['monitor_format']){logger[_0x162a('0x12')](_0x162a('0x61'),'Recording\x20is\x20enabled!');_0x4b0eae['recordingURL']=_0x4e7dcc;}else if(_0x55d32c&&_0x55d32c['recordingFormat']&&_0x55d32c[_0x162a('0x62')]!=='none'){logger[_0x162a('0x12')](_0x162a('0x63'),_0x162a('0x64'));_0x4b0eae[_0x162a('0x65')]=_0x4e7dcc;}else{_0x4b0eae[_0x162a('0x65')]='';}return getAdminUser(_0x50f344,_0x4ea655,_0xb851a5,_0x476385,_0x5211ec,_0x50cfa3)[_0x162a('0x8')](getUser(_0x50f344,_0x4ea655,_0x476385,_0x5211ec,_0x50cfa3))[_0x162a('0x8')](getEndUser(_0x50f344,_0x4ea655,_0x476385,_0x5211ec,_0x50cfa3))[_0x162a('0x8')](getTicket(_0x50f344,_0x4ea655,_0x476385,_0x373569,_0x4b0eae,_0x5211ec))[_0x162a('0x8')](function(_0x223b91){logger[_0x162a('0x12')](util[_0x162a('0x55')](_0x162a('0x66'),_0x223b91[_0x162a('0x3d')]));logger[_0x162a('0x12')](util[_0x162a('0x55')]('call\x20direction:\x20%s',_0x50f344));if(_0x50f344!==_0x162a('0x5e')){logger[_0x162a('0x12')]('['+[_0x50f344[_0x162a('0xd')]()]+']',_0x162a('0x67'));emit(_0x1261d1['remoteUri'],_0x175efe[_0x162a('0x37')],_0x223b91[_0x162a('0x3d')]);}})['catch'](function(_0x54cc39){logger[_0x162a('0x10')]('['+[_0x50f344[_0x162a('0xd')]()]+_0x162a('0x68'),util[_0x162a('0x69')](_0x54cc39,{'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 3af5a21..1281ae9 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 _0xab65=['Subjects','assigned_user_id','created_by','description','Descriptions','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','forEach','type','string','nameField','customField','toLowerCase','toString','content','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','contacts','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','name','getString'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xab65,0xea));var _0x5ab6=function(_0x5452b9,_0x3e1158){_0x5452b9=_0x5452b9-0x0;var _0x218041=_0xab65[_0x5452b9];return _0x218041;};'use strict';var _=require('lodash');var rp=require(_0x5ab6('0x0'));var BPromise=require('bluebird');var md5=require(_0x5ab6('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x5ab6('0x2'));var config=require(_0x5ab6('0x3'));var logger=require(_0x5ab6('0x4'))(_0x5ab6('0x5'));config[_0x5ab6('0x6')]=_[_0x5ab6('0x7')](config[_0x5ab6('0x6')],{'host':_0x5ab6('0x8'),'port':0x18eb});var io=require(_0x5ab6('0x9'))(new Redis(config[_0x5ab6('0x6')]));var def={'method':_0x5ab6('0xa'),'json':!![]};function emit(_0x1639c5,_0x1dbebb,_0x274e65){io['to'](_0x1639c5)[_0x5ab6('0xb')](_0x1dbebb,_0x274e65);}function getTicket(_0x156ded,_0x4c08b3,_0x4a5a1f,_0x5815e7,_0x156bd3,_0x54a97a,_0x4ccbeb,_0xf5b936){logger['info']('Creating\x20new\x20ticket...');var _0x1536d4=new Date();var _0x5bc528=[{'name':_0x5ab6('0xc'),'value':intUtil[_0x5ab6('0xd')](_0x5815e7[_0x5ab6('0xe')],_0x156bd3,'\x20')},{'name':_0x5ab6('0xf'),'value':_0x4c08b3['id']},{'name':_0x5ab6('0x10'),'value':_0x4c08b3['id']},{'name':_0x5ab6('0x11'),'value':intUtil['getString'](_0x5815e7[_0x5ab6('0x12')],_0x156bd3,'\x0a')},{'name':'date_start','value':_0x1536d4['toISOString']()[_0x5ab6('0x13')](0x0,0x13)[_0x5ab6('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x5ab6('0x15'),'value':'15'},{'name':_0x5ab6('0x16'),'value':_0x4a5a1f['id']},{'name':_0x5ab6('0x17'),'value':_0x5ab6('0x18')},{'name':_0x5ab6('0x19'),'value':_0x4a5a1f[_0x5ab6('0xc')]},{'name':_0x5ab6('0x1a'),'value':_0xf5b936}];if(_0x54a97a['length']){_['forEach'](_0x54a97a,function(_0x3c2f6d){if(_0x156bd3[_0x3c2f6d[_0x5ab6('0x1b')]]){_0x5bc528[_0x5ab6('0x1c')]({'name':_0x3c2f6d[_0x5ab6('0x1d')],'value':_0x156bd3[_0x3c2f6d[_0x5ab6('0x1b')]]});}});}return request({'form':{'method':_0x5ab6('0x1e'),'input_type':_0x5ab6('0x1f'),'response_type':'JSON','rest_data':JSON[_0x5ab6('0x20')]({'session':_0x4ccbeb['id'],'module_name':'Calls','name_value_list':_0x5bc528})}});}function getAuth(_0x223a71){return util[_0x5ab6('0x21')](_0x5ab6('0x22'),new Buffer(_0x223a71[_0x5ab6('0x23')]+':X')['toString'](_0x5ab6('0x24')));}function getServerInfo(_0x40e7af){return request({'form':{'method':_0x5ab6('0x25'),'input_type':'JSON','response_type':_0x5ab6('0x1f'),'rest_data':JSON[_0x5ab6('0x20')]({'session':_0x40e7af['id']})}});}function getUser(_0x1ab4d3,_0x20b359,_0x2f9483){if(!_[_0x5ab6('0x26')](_0x20b359)){logger[_0x5ab6('0x27')](_0x5ab6('0x28'),_0x20b359);return request({'form':{'method':_0x5ab6('0x29'),'input_type':_0x5ab6('0x1f'),'response_type':_0x5ab6('0x1f'),'rest_data':JSON[_0x5ab6('0x20')]({'session':_0x2f9483['id'],'module_name':_0x5ab6('0x2a'),'query':util[_0x5ab6('0x21')](_0x5ab6('0x2b'),_0x20b359),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5ab6('0x2c')](function(_0x51a146){if(_0x51a146[_0x5ab6('0x2d')][_0x5ab6('0x2e')]){var _0x47d0ee=_['find'](_0x51a146[_0x5ab6('0x2d')],function(_0xd6ef4e){return _0xd6ef4e[_0x5ab6('0x2f')]['user_name'][_0x5ab6('0x30')]===_0x20b359;});if(_0x47d0ee){logger[_0x5ab6('0x27')](_0x5ab6('0x31'));return BPromise[_0x5ab6('0x32')]({'id':_0x47d0ee[_0x5ab6('0x2f')]['id'][_0x5ab6('0x30')],'name':_0x47d0ee[_0x5ab6('0x2f')]['name'][_0x5ab6('0x30')]});}}logger[_0x5ab6('0x27')](_0x5ab6('0x33'));return BPromise[_0x5ab6('0x32')]({'id':_0x2f9483[_0x5ab6('0x2f')][_0x5ab6('0x34')][_0x5ab6('0x30')],'name':_0x2f9483['name_value_list'][_0x5ab6('0x35')][_0x5ab6('0x30')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5ab6('0x32')]({'id':_0x2f9483[_0x5ab6('0x2f')][_0x5ab6('0x34')][_0x5ab6('0x30')],'name':_0x2f9483[_0x5ab6('0x2f')][_0x5ab6('0x35')]['value']});}}function getEndUser(_0x3ee83e,_0x484ada,_0x49f6f6,_0x1c6ac3){logger[_0x5ab6('0x27')]('Searching\x20enduser\x20with\x20phone',_0x49f6f6);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x5ab6('0x1f'),'rest_data':JSON[_0x5ab6('0x20')]({'session':_0x1c6ac3['id'],'module_name':_0x5ab6('0x18'),'query':util[_0x5ab6('0x21')](_0x5ab6('0x36'),_0x49f6f6),'order_by':'','offset':'0','select_fields':['id',_0x5ab6('0xc'),_0x5ab6('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5ade12){if(_0x5ade12['entry_list'][_0x5ab6('0x2e')]){var _0x2479c3=_[_0x5ab6('0x38')](_0x5ade12[_0x5ab6('0x2d')],function(_0x437c33){return _0x437c33[_0x5ab6('0x2f')][_0x5ab6('0x37')][_0x5ab6('0x30')]===_0x49f6f6;});if(_0x2479c3){logger[_0x5ab6('0x27')](_0x5ab6('0x39'));return BPromise[_0x5ab6('0x32')]({'id':_0x2479c3[_0x5ab6('0x2f')]['id'][_0x5ab6('0x30')],'name':_0x2479c3[_0x5ab6('0x2f')][_0x5ab6('0xc')][_0x5ab6('0x30')],'phone':_0x2479c3['name_value_list'][_0x5ab6('0x37')][_0x5ab6('0x30')]});}}else{logger[_0x5ab6('0x27')](_0x5ab6('0x3a'));return request({'form':{'method':_0x5ab6('0x1e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x5ab6('0x20')]({'session':_0x1c6ac3['id'],'module_name':_0x5ab6('0x18'),'name_value_list':[{'name':'first_name','value':_0x484ada!==_0x5ab6('0x3b')?_0x484ada:util['format'](_0x5ab6('0x3c'),_0x49f6f6)},{'name':'phone_home','value':_0x49f6f6}]})}})[_0x5ab6('0x2c')](function(_0x5614fd){logger[_0x5ab6('0x27')](_0x5ab6('0x3d'));return BPromise[_0x5ab6('0x32')]({'id':_0x5614fd['id'],'name':_0x5614fd[_0x5ab6('0x2d')]['first_name'][_0x5ab6('0x30')],'phone':_0x5614fd[_0x5ab6('0x2d')]['phone_home'][_0x5ab6('0x30')]});});}});}function request(_0x4ea773){logger[_0x5ab6('0x3e')](_0x5ab6('0x3f'),JSON[_0x5ab6('0x20')](_0x4ea773));return rp(_[_0x5ab6('0x40')](def,_0x4ea773));}function getTags(_0x56ca94,_0x20662f){var _0x31c708=[];if(_0x56ca94&&_0x56ca94[_0x5ab6('0x2e')]>0x0){_0x31c708=_['map'](_0x56ca94,_0x20662f);}return _0x31c708;}function getCustomFields(_0x22052d,_0xa404ba){var _0xef9a1a=[];var _0x5b1b6d={'custom_fields':[]};if(_0x22052d[_0x5ab6('0x2e')]>0x0){_[_0x5ab6('0x41')](_0x22052d,function(_0xe0a905){if(_0xe0a905[_0x5ab6('0x42')]===_0x5ab6('0x43')&&_0xe0a905[_0x5ab6('0x44')]&&!_0xe0a905[_0x5ab6('0x45')]){_0x5b1b6d[_0xe0a905['nameField'][_0x5ab6('0x46')]()]=_0xe0a905['content'][_0x5ab6('0x47')]();}else if(_0xe0a905[_0x5ab6('0x42')]===_0x5ab6('0x43')&&_0xe0a905[_0x5ab6('0x1d')]&&_0xe0a905[_0x5ab6('0x45')]){_0x5b1b6d['custom_fields'][_0x5ab6('0x1c')]({'id':_0xe0a905[_0x5ab6('0x1d')],'value':_0xe0a905[_0x5ab6('0x48')][_0x5ab6('0x47')]()});}else if(_0xe0a905['type']===_0x5ab6('0x49')&&_0xe0a905[_0x5ab6('0x1b')]&&_0xe0a905['idField']&&_0xe0a905['customField']){_0xa404ba[_0xe0a905[_0x5ab6('0x1b')]]&&_0x5b1b6d[_0x5ab6('0x4a')][_0x5ab6('0x1c')]({'id':_0xe0a905[_0x5ab6('0x1d')],'value':_0xa404ba[_0xe0a905['variableName']][_0x5ab6('0x47')]()});}else if(_0xe0a905[_0x5ab6('0x42')]===_0x5ab6('0x4b')&&_0xe0a905[_0x5ab6('0x4c')]&&_0xe0a905[_0x5ab6('0x4c')][_0x5ab6('0xc')]&&_0xe0a905[_0x5ab6('0x1d')]&&_0xe0a905['customField']){_0xa404ba[_0xe0a905[_0x5ab6('0x4c')][_0x5ab6('0xc')][_0x5ab6('0x46')]()]&&_0x5b1b6d['custom_fields'][_0x5ab6('0x1c')]({'id':_0xe0a905['idField'],'value':_0xa404ba[_0xe0a905[_0x5ab6('0x4c')][_0x5ab6('0xc')][_0x5ab6('0x46')]()][_0x5ab6('0x47')]()});}});}return _0x5b1b6d;}function getConnection(_0x727ddd){return request({'method':_0x5ab6('0xa'),'form':{'method':_0x5ab6('0x4d'),'input_type':_0x5ab6('0x1f'),'response_type':_0x5ab6('0x1f'),'rest_data':JSON[_0x5ab6('0x20')]({'user_auth':{'user_name':_0x727ddd[_0x5ab6('0x4e')],'password':_0x727ddd[_0x5ab6('0x4f')],'encryption':_0x5ab6('0x50')},'application':_0x5ab6('0x51')})}})['then'](function(_0x3cc959){var _0x4fcaba=_0x3cc959;if(_0x4fcaba['id']){def[_0x5ab6('0x52')]=_0x4fcaba['id'];return BPromise[_0x5ab6('0x32')](_0x4fcaba);}else{throw new Error(util['format'](_0x5ab6('0x53'),_0x727ddd['id']));}});}function setRelationship(_0x576488,_0x33c9c0,_0x225355,_0x223cb5){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x5ab6('0x20')]({'session':_0x576488['id'],'module_name':_0x5ab6('0x54'),'module_id':_0x225355['id'],'link_field_name':_0x223cb5,'related_ids':[_0x33c9c0['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5ab6('0x55')]=function(_0x22155c,_0x21c499,_0x343be2,_0x594f96,_0x57e2f3,_0x27d3e1){var _0x16c744,_0xd18bc2,_0x2e93a6,_0x1fd454;_0x27d3e1[_0x5ab6('0x56')]=intUtil['stripTrailingSlash'](_0x27d3e1['remoteUri']);_0x27d3e1[_0x5ab6('0x57')]=intUtil[_0x5ab6('0x58')](_0x27d3e1[_0x5ab6('0x57')]);def[_0x5ab6('0x59')]=util[_0x5ab6('0x21')](_0x5ab6('0x5a'),_0x27d3e1[_0x5ab6('0x56')]);if(_0x57e2f3&&_0x57e2f3[_0x5ab6('0x5b')]){logger[_0x5ab6('0x27')](_0x5ab6('0x5c'),'Recording\x20is\x20enabled!');_0x21c499[_0x5ab6('0x5d')]=util[_0x5ab6('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27d3e1[_0x5ab6('0x57')],_0x21c499[_0x5ab6('0x5e')],md5(_0x21c499[_0x5ab6('0x5e')]));}else{_0x21c499[_0x5ab6('0x5d')]='';}return getConnection(_0x27d3e1)['then'](function(_0x553c2a){_0x1fd454=_0x553c2a;return getUser(_0x27d3e1,_0x594f96[_0x5ab6('0xc')],_0x1fd454);})[_0x5ab6('0x2c')](function(_0x117989){_0x16c744=_0x117989;logger['info']('The\x20User\x20ID\x20is:',_0x16c744['id']);return getEndUser(_0x27d3e1,_0x21c499[_0x5ab6('0x5f')],_0x21c499['calleridnum'],_0x1fd454);})['then'](function(_0xd10fc){_0xd18bc2=_0xd10fc;logger['info'](_0x5ab6('0x60'),_0xd18bc2['id']);return getTicket(_0x27d3e1,_0x16c744,_0xd18bc2,_0x343be2,_0x21c499,_0x343be2[_0x5ab6('0x61')],_0x1fd454,_0x5ab6('0x62'));})[_0x5ab6('0x2c')](function(_0x5e4534){_0x2e93a6=_0x5e4534;logger[_0x5ab6('0x27')](_0x5ab6('0x63'));logger[_0x5ab6('0x27')](_0x5ab6('0x64'),_0x2e93a6['id']);return setRelationship(_0x1fd454,_0x16c744,_0x2e93a6,_0x5ab6('0x65'));})['then'](function(){return setRelationship(_0x1fd454,_0xd18bc2,_0x2e93a6,'contacts');})[_0x5ab6('0x2c')](function(){return getServerInfo(_0x1fd454);})[_0x5ab6('0x2c')](function(_0x519b4f){var _0x5f5b9d=parseInt(_0x519b4f[_0x5ab6('0x66')][_0x5ab6('0x67')](0x0));var _0x334b3d=util['format'](_0x5ab6('0x68'),_0x27d3e1['remoteUri'],_0x2e93a6['id']);if(_0x5f5b9d>0x6){_0x334b3d=util[_0x5ab6('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x27d3e1[_0x5ab6('0x56')],_0x2e93a6['id']);}logger['info'](_0x5ab6('0x5c'),_0x5ab6('0x69'));emit(util[_0x5ab6('0x21')]('user:%s',_0x594f96[_0x5ab6('0xc')]),'trigger:browser:url',{'uri':_0x334b3d});})['catch'](function(_0x564dca){logger[_0x5ab6('0x6a')](_0x5ab6('0x5c'),JSON[_0x5ab6('0x20')](_0x564dca));});};exports[_0x5ab6('0x6b')]=function(_0x36db25,_0x1ba67f,_0x42d440,_0x14c81e,_0x302d5d,_0x48a147,_0xe86cc4){var _0x2d0183,_0x40174a,_0x1c4842,_0x326058;_0x48a147['remoteUri']=intUtil['stripTrailingSlash'](_0x48a147[_0x5ab6('0x56')]);_0x48a147[_0x5ab6('0x57')]=intUtil[_0x5ab6('0x58')](_0x48a147[_0x5ab6('0x57')]);def[_0x5ab6('0x59')]=util[_0x5ab6('0x21')]('%s/service/v4_1/rest.php',_0x48a147[_0x5ab6('0x56')]);if(_0xe86cc4&&_0xe86cc4[_0x5ab6('0x6c')]&&_0xe86cc4[_0x5ab6('0x6c')]!==_0x5ab6('0x6d')){logger[_0x5ab6('0x27')](_0x5ab6('0x6e'),_0x5ab6('0x6f'));_0x1ba67f[_0x5ab6('0x5d')]=util['format'](_0x5ab6('0x70'),_0x48a147['serverUrl'],_0x1ba67f[_0x5ab6('0x5e')],md5(_0x1ba67f['uniqueid']));}return getConnection(_0x48a147)[_0x5ab6('0x2c')](function(_0x164373){_0x326058=_0x164373;return getUser(_0x48a147,_0x14c81e['name'],_0x326058);})[_0x5ab6('0x2c')](function(_0x284f05){_0x2d0183=_0x284f05;logger[_0x5ab6('0x27')]('The\x20User\x20ID\x20is:',_0x2d0183['id']);return getEndUser(_0x48a147,_0x1ba67f[_0x5ab6('0x71')],_0x1ba67f[_0x5ab6('0x72')],_0x326058);})[_0x5ab6('0x2c')](function(_0x1ee3e9){_0x40174a=_0x1ee3e9;logger[_0x5ab6('0x27')]('The\x20Enduser\x20ID\x20is:',_0x40174a['id']);return getTicket(_0x48a147,_0x2d0183,_0x40174a,_0x42d440,_0x1ba67f,_0x42d440['Fields'],_0x326058,_0x5ab6('0x73'));})['then'](function(_0x812934){_0x1c4842=_0x812934;logger['info'](_0x5ab6('0x63'));logger[_0x5ab6('0x27')](_0x5ab6('0x64'),_0x1c4842['id']);return setRelationship(_0x326058,_0x2d0183,_0x1c4842,_0x5ab6('0x65'));})[_0x5ab6('0x2c')](function(){return setRelationship(_0x326058,_0x40174a,_0x1c4842,_0x5ab6('0x74'));})[_0x5ab6('0x2c')](function(){return getServerInfo(_0x326058);})[_0x5ab6('0x2c')](function(_0xf04d5b){var _0x1c849e=parseInt(_0xf04d5b[_0x5ab6('0x66')]['charAt'](0x0));var _0x173f83=util['format'](_0x5ab6('0x68'),_0x48a147[_0x5ab6('0x56')],_0x1c4842['id']);if(_0x1c849e>0x6){_0x173f83=util[_0x5ab6('0x21')](_0x5ab6('0x75'),_0x48a147['remoteUri'],_0x1c4842['id']);}logger[_0x5ab6('0x27')](_0x5ab6('0x6e'),_0x5ab6('0x69'));emit(util['format']('user:%s',_0x14c81e[_0x5ab6('0xc')]),_0x5ab6('0x76'),{'uri':_0x173f83});})[_0x5ab6('0x77')](function(_0x3bbc39){logger[_0x5ab6('0x6a')]('[OUTBOUND]',JSON[_0x5ab6('0x20')](_0x3bbc39));});};exports[_0x5ab6('0x78')]=function(_0x2bc75c,_0x4321e0,_0x1bf76a,_0x11c5a5,_0x5b33f3,_0x4813f7){var _0x8fe55e,_0x330ab9,_0xfee369,_0x806cd1;_0x4813f7[_0x5ab6('0x56')]=intUtil[_0x5ab6('0x58')](_0x4813f7[_0x5ab6('0x56')]);_0x4813f7[_0x5ab6('0x57')]=intUtil[_0x5ab6('0x58')](_0x4813f7['serverUrl']);def[_0x5ab6('0x59')]=util[_0x5ab6('0x21')](_0x5ab6('0x5a'),_0x4813f7['remoteUri']);if(_0x5b33f3&&_0x5b33f3['monitor_format']){logger['info']('['+_0x4321e0[_0x5ab6('0x79')][_0x5ab6('0x7a')]()+']',_0x5ab6('0x6f'));_0x4321e0[_0x5ab6('0x5d')]=util[_0x5ab6('0x21')](_0x5ab6('0x70'),_0x4813f7[_0x5ab6('0x57')],_0x4321e0[_0x5ab6('0x5e')],md5(_0x4321e0[_0x5ab6('0x5e')]));}else{_0x4321e0['recordingURL']='';}return getConnection(_0x4813f7)[_0x5ab6('0x2c')](function(_0x47cc1f){_0x806cd1=_0x47cc1f;if(!_[_0x5ab6('0x26')](_0x11c5a5)){return getUser(_0x4813f7,_0x11c5a5['name'],_0x806cd1);}else{return getUser(_0x4813f7,null,_0x806cd1);}})[_0x5ab6('0x2c')](function(_0x1bcca1){_0x8fe55e=_0x1bcca1;logger[_0x5ab6('0x27')](_0x5ab6('0x7b'),_0x8fe55e['id']);return getEndUser(_0x4813f7,_0x4321e0[_0x5ab6('0x5f')],_0x4321e0['calleridnum'],_0x806cd1);})[_0x5ab6('0x2c')](function(_0x42dcfe){_0x330ab9=_0x42dcfe;logger[_0x5ab6('0x27')]('The\x20Enduser\x20ID\x20is:',_0x330ab9['id']);return getTicket(_0x4813f7,_0x8fe55e,_0x330ab9,_0x1bf76a,_0x4321e0,_0x1bf76a[_0x5ab6('0x61')],_0x806cd1,_0x5ab6('0x62'));})[_0x5ab6('0x2c')](function(_0x96379f){_0xfee369=_0x96379f;logger[_0x5ab6('0x27')]('Ticket\x20created!');logger[_0x5ab6('0x27')](_0x5ab6('0x64'),_0xfee369['id']);return setRelationship(_0x806cd1,_0x8fe55e,_0xfee369,_0x5ab6('0x65'));})[_0x5ab6('0x2c')](function(){return setRelationship(_0x806cd1,_0x330ab9,_0xfee369,'contacts');})['then'](function(){return getServerInfo(_0x806cd1);})['catch'](function(_0x1ee2da){logger[_0x5ab6('0x6a')]('['+_0x4321e0[_0x5ab6('0x79')][_0x5ab6('0x7a')]()+']',JSON[_0x5ab6('0x20')](_0x1ee2da));});}; \ No newline at end of file +var _0x7e21=['stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','toUpperCase','lodash','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','created_by','description','getString','Descriptions','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','variableName','idField','set_entry','JSON','stringify','format','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20available,\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!','first_name','Caller\x20-\x20%s','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','push','variable','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls'];(function(_0x3dfa3e,_0x293558){var _0x3ff9ed=function(_0x400e9b){while(--_0x400e9b){_0x3dfa3e['push'](_0x3dfa3e['shift']());}};_0x3ff9ed(++_0x293558);}(_0x7e21,0x9b));var _0x17e2=function(_0x3f8cac,_0x58f65e){_0x3f8cac=_0x3f8cac-0x0;var _0xcd86b=_0x7e21[_0x3f8cac];return _0xcd86b;};'use strict';var _=require(_0x17e2('0x0'));var rp=require('request-promise');var BPromise=require(_0x17e2('0x1'));var md5=require('md5');var util=require(_0x17e2('0x2'));var Redis=require(_0x17e2('0x3'));var intUtil=require('./util');var config=require(_0x17e2('0x4'));var logger=require(_0x17e2('0x5'))(_0x17e2('0x6'));config[_0x17e2('0x7')]=_[_0x17e2('0x8')](config[_0x17e2('0x7')],{'host':_0x17e2('0x9'),'port':0x18eb});var io=require(_0x17e2('0xa'))(new Redis(config['redis']));var def={'method':_0x17e2('0xb'),'json':!![]};function emit(_0xbf90b5,_0x35e4c5,_0x35bd78){io['to'](_0xbf90b5)[_0x17e2('0xc')](_0x35e4c5,_0x35bd78);}function getTicket(_0x1583d3,_0x2389dc,_0x370fd4,_0x4cfe54,_0x426457,_0x2596fd,_0x2788b9,_0x2068df){logger[_0x17e2('0xd')](_0x17e2('0xe'));var _0x178e78=new Date();var _0x3ab672=[{'name':_0x17e2('0xf'),'value':intUtil['getString'](_0x4cfe54[_0x17e2('0x10')],_0x426457,'\x20')},{'name':'assigned_user_id','value':_0x2389dc['id']},{'name':_0x17e2('0x11'),'value':_0x2389dc['id']},{'name':_0x17e2('0x12'),'value':intUtil[_0x17e2('0x13')](_0x4cfe54[_0x17e2('0x14')],_0x426457,'\x0a')},{'name':'date_start','value':_0x178e78[_0x17e2('0x15')]()[_0x17e2('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0x17e2('0x17'),'value':'0'},{'name':_0x17e2('0x18'),'value':'15'},{'name':_0x17e2('0x19'),'value':_0x370fd4['id']},{'name':_0x17e2('0x1a'),'value':_0x17e2('0x1b')},{'name':_0x17e2('0x1c'),'value':_0x370fd4['name']},{'name':'direction','value':_0x2068df}];if(_0x2596fd[_0x17e2('0x1d')]){_['forEach'](_0x2596fd,function(_0x311c85){if(_0x426457[_0x311c85[_0x17e2('0x1e')]]){_0x3ab672['push']({'name':_0x311c85[_0x17e2('0x1f')],'value':_0x426457[_0x311c85[_0x17e2('0x1e')]]});}});}return request({'form':{'method':_0x17e2('0x20'),'input_type':_0x17e2('0x21'),'response_type':_0x17e2('0x21'),'rest_data':JSON[_0x17e2('0x22')]({'session':_0x2788b9['id'],'module_name':'Calls','name_value_list':_0x3ab672})}});}function getAuth(_0x35206b){return util[_0x17e2('0x23')]('Basic\x20%s',new Buffer(_0x35206b['apiKey']+':X')[_0x17e2('0x24')](_0x17e2('0x25')));}function getServerInfo(_0x321f09){return request({'form':{'method':_0x17e2('0x26'),'input_type':_0x17e2('0x21'),'response_type':_0x17e2('0x21'),'rest_data':JSON[_0x17e2('0x22')]({'session':_0x321f09['id']})}});}function getUser(_0x39bf31,_0x7c420b,_0x3bfacc){if(!_[_0x17e2('0x27')](_0x7c420b)){logger[_0x17e2('0xd')](_0x17e2('0x28'),_0x7c420b);return request({'form':{'method':_0x17e2('0x29'),'input_type':_0x17e2('0x21'),'response_type':_0x17e2('0x21'),'rest_data':JSON['stringify']({'session':_0x3bfacc['id'],'module_name':'Employees','query':util[_0x17e2('0x23')](_0x17e2('0x2a'),_0x7c420b),'order_by':'','offset':'0','select_fields':['id',_0x17e2('0xf'),_0x17e2('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x17e2('0x2c')](function(_0x4cf62b){if(_0x4cf62b[_0x17e2('0x2d')][_0x17e2('0x1d')]){var _0x50aeab=_['find'](_0x4cf62b['entry_list'],function(_0x58d68d){return _0x58d68d['name_value_list'][_0x17e2('0x2b')][_0x17e2('0x2e')]===_0x7c420b;});if(_0x50aeab){logger[_0x17e2('0xd')](_0x17e2('0x2f'));return BPromise[_0x17e2('0x30')]({'id':_0x50aeab['name_value_list']['id'][_0x17e2('0x2e')],'name':_0x50aeab['name_value_list'][_0x17e2('0xf')][_0x17e2('0x2e')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x17e2('0x30')]({'id':_0x3bfacc[_0x17e2('0x31')]['user_id'][_0x17e2('0x2e')],'name':_0x3bfacc[_0x17e2('0x31')][_0x17e2('0x2b')]['value']});});}else{logger[_0x17e2('0xd')](_0x17e2('0x32'));return BPromise[_0x17e2('0x30')]({'id':_0x3bfacc['name_value_list'][_0x17e2('0x33')]['value'],'name':_0x3bfacc[_0x17e2('0x31')][_0x17e2('0x2b')][_0x17e2('0x2e')]});}}function getEndUser(_0x1f8d1a,_0x1e0530,_0x4b6319,_0x15dee4){logger[_0x17e2('0xd')](_0x17e2('0x34'),_0x4b6319);return request({'form':{'method':'get_entry_list','input_type':_0x17e2('0x21'),'response_type':_0x17e2('0x21'),'rest_data':JSON[_0x17e2('0x22')]({'session':_0x15dee4['id'],'module_name':'Contacts','query':util[_0x17e2('0x23')](_0x17e2('0x35'),_0x4b6319),'order_by':'','offset':'0','select_fields':['id','name',_0x17e2('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x17e2('0x2c')](function(_0x2bcfec){if(_0x2bcfec[_0x17e2('0x2d')][_0x17e2('0x1d')]){var _0x5c8913=_['find'](_0x2bcfec[_0x17e2('0x2d')],function(_0x42e351){return _0x42e351['name_value_list']['phone_home']['value']===_0x4b6319;});if(_0x5c8913){logger[_0x17e2('0xd')](_0x17e2('0x37'));return BPromise[_0x17e2('0x30')]({'id':_0x5c8913['name_value_list']['id'][_0x17e2('0x2e')],'name':_0x5c8913['name_value_list'][_0x17e2('0xf')][_0x17e2('0x2e')],'phone':_0x5c8913['name_value_list']['phone_home']['value']});}}else{logger[_0x17e2('0xd')](_0x17e2('0x38'));return request({'form':{'method':_0x17e2('0x20'),'input_type':'JSON','response_type':_0x17e2('0x21'),'rest_data':JSON[_0x17e2('0x22')]({'session':_0x15dee4['id'],'module_name':_0x17e2('0x1b'),'name_value_list':[{'name':_0x17e2('0x39'),'value':_0x1e0530!==''?_0x1e0530:util[_0x17e2('0x23')](_0x17e2('0x3a'),_0x4b6319)},{'name':_0x17e2('0x36'),'value':_0x4b6319}]})}})[_0x17e2('0x2c')](function(_0x13e057){logger[_0x17e2('0xd')]('Enduser\x20created.');return BPromise[_0x17e2('0x30')]({'id':_0x13e057['id'],'name':_0x13e057['entry_list'][_0x17e2('0x39')][_0x17e2('0x2e')],'phone':_0x13e057['entry_list'][_0x17e2('0x36')]['value']});});}});}function request(_0x4ff3c2){logger['debug'](_0x17e2('0x3b'),JSON[_0x17e2('0x22')](_0x4ff3c2));return rp(_[_0x17e2('0x3c')](def,_0x4ff3c2));}function getTags(_0x380878,_0x41c38b){var _0x3b6be4=[];if(_0x380878&&_0x380878[_0x17e2('0x1d')]>0x0){_0x3b6be4=_[_0x17e2('0x3d')](_0x380878,_0x41c38b);}return _0x3b6be4;}function getCustomFields(_0x4667bf,_0x53b734){var _0x5672f3=[];var _0x5ca2c8={'custom_fields':[]};if(_0x4667bf['length']>0x0){_[_0x17e2('0x3e')](_0x4667bf,function(_0x2816ea){if(_0x2816ea[_0x17e2('0x3f')]===_0x17e2('0x40')&&_0x2816ea[_0x17e2('0x41')]&&!_0x2816ea[_0x17e2('0x42')]){_0x5ca2c8[_0x2816ea[_0x17e2('0x41')][_0x17e2('0x43')]()]=_0x2816ea[_0x17e2('0x44')][_0x17e2('0x24')]();}else if(_0x2816ea[_0x17e2('0x3f')]==='string'&&_0x2816ea[_0x17e2('0x1f')]&&_0x2816ea[_0x17e2('0x42')]){_0x5ca2c8[_0x17e2('0x45')][_0x17e2('0x46')]({'id':_0x2816ea[_0x17e2('0x1f')],'value':_0x2816ea[_0x17e2('0x44')]['toString']()});}else if(_0x2816ea[_0x17e2('0x3f')]===_0x17e2('0x47')&&_0x2816ea[_0x17e2('0x1e')]&&_0x2816ea[_0x17e2('0x1f')]&&_0x2816ea[_0x17e2('0x42')]){_0x53b734[_0x2816ea[_0x17e2('0x1e')]]&&_0x5ca2c8[_0x17e2('0x45')][_0x17e2('0x46')]({'id':_0x2816ea[_0x17e2('0x1f')],'value':_0x53b734[_0x2816ea['variableName']]['toString']()});}else if(_0x2816ea[_0x17e2('0x3f')]===_0x17e2('0x48')&&_0x2816ea[_0x17e2('0x49')]&&_0x2816ea[_0x17e2('0x49')][_0x17e2('0xf')]&&_0x2816ea[_0x17e2('0x1f')]&&_0x2816ea[_0x17e2('0x42')]){_0x53b734[_0x2816ea['Variable']['name']['toLowerCase']()]&&_0x5ca2c8[_0x17e2('0x45')][_0x17e2('0x46')]({'id':_0x2816ea['idField'],'value':_0x53b734[_0x2816ea[_0x17e2('0x49')][_0x17e2('0xf')]['toLowerCase']()][_0x17e2('0x24')]()});}});}return _0x5ca2c8;}function getConnection(_0x4b2d54){return request({'method':'POST','form':{'method':_0x17e2('0x4a'),'input_type':_0x17e2('0x21'),'response_type':_0x17e2('0x21'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4b2d54[_0x17e2('0x4b')],'password':_0x4b2d54['password'],'encryption':_0x17e2('0x4c')},'application':_0x17e2('0x4d')})}})['then'](function(_0x3e6464){var _0x2bc0c4=_0x3e6464;if(_0x2bc0c4['id']){def['sessionID']=_0x2bc0c4['id'];return BPromise[_0x17e2('0x30')](_0x2bc0c4);}else{throw new Error(util['format'](_0x17e2('0x4e'),_0x4b2d54['id']));}});}function setRelationship(_0x18aa28,_0x2bd941,_0x3cf31b,_0x3ae536){return request({'form':{'method':_0x17e2('0x4f'),'input_type':'JSON','response_type':_0x17e2('0x21'),'rest_data':JSON['stringify']({'session':_0x18aa28['id'],'module_name':_0x17e2('0x50'),'module_id':_0x3cf31b['id'],'link_field_name':_0x3ae536,'related_ids':[_0x2bd941['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x286665,_0x2f763c,_0x36e778,_0x380bdd,_0x1ac484,_0x352922){var _0x58be79,_0x239076,_0x3f7cfb,_0x120094;_0x352922['remoteUri']=intUtil[_0x17e2('0x51')](_0x352922[_0x17e2('0x52')]);_0x352922[_0x17e2('0x53')]=intUtil['stripTrailingSlash'](_0x352922[_0x17e2('0x53')]);def[_0x17e2('0x54')]=util[_0x17e2('0x23')](_0x17e2('0x55'),_0x352922[_0x17e2('0x52')]);if(_0x1ac484&&_0x1ac484[_0x17e2('0x56')]){logger[_0x17e2('0xd')](_0x17e2('0x57'),_0x17e2('0x58'));_0x2f763c[_0x17e2('0x59')]=util[_0x17e2('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x352922[_0x17e2('0x53')],_0x2f763c[_0x17e2('0x5a')],md5(_0x2f763c[_0x17e2('0x5a')]));}else{_0x2f763c[_0x17e2('0x59')]='';}return getConnection(_0x352922)[_0x17e2('0x2c')](function(_0x34505f){_0x120094=_0x34505f;return getUser(_0x352922,_0x380bdd[_0x17e2('0xf')],_0x120094);})[_0x17e2('0x2c')](function(_0x838812){_0x58be79=_0x838812;logger[_0x17e2('0xd')](_0x17e2('0x5b'),_0x58be79['id']);return getEndUser(_0x352922,_0x2f763c[_0x17e2('0x5c')],_0x2f763c[_0x17e2('0x5d')],_0x120094);})['then'](function(_0x12fd34){_0x239076=_0x12fd34;logger['info'](_0x17e2('0x5e'),_0x239076['id']);return getTicket(_0x352922,_0x58be79,_0x239076,_0x36e778,_0x2f763c,_0x36e778[_0x17e2('0x5f')],_0x120094,_0x17e2('0x60'));})[_0x17e2('0x2c')](function(_0x649a92){_0x3f7cfb=_0x649a92;logger['info'](_0x17e2('0x61'));logger['info'](_0x17e2('0x62'),_0x3f7cfb['id']);return setRelationship(_0x120094,_0x58be79,_0x3f7cfb,_0x17e2('0x63'));})['then'](function(){return setRelationship(_0x120094,_0x239076,_0x3f7cfb,_0x17e2('0x64'));})[_0x17e2('0x2c')](function(){return getServerInfo(_0x120094);})[_0x17e2('0x2c')](function(_0x5ed5b9){var _0x1893d0=parseInt(_0x5ed5b9[_0x17e2('0x65')][_0x17e2('0x66')](0x0));var _0x1e36c6=util[_0x17e2('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x352922[_0x17e2('0x52')],_0x3f7cfb['id']);if(_0x1893d0>0x6){_0x1e36c6=util['format'](_0x17e2('0x67'),_0x352922[_0x17e2('0x52')],_0x3f7cfb['id']);}logger['info']('[QUEUE]',_0x17e2('0x68'));emit(util[_0x17e2('0x23')](_0x17e2('0x69'),_0x380bdd[_0x17e2('0xf')]),_0x17e2('0x6a'),{'uri':_0x1e36c6});})[_0x17e2('0x6b')](function(_0x596850){logger['error'](_0x17e2('0x57'),JSON[_0x17e2('0x22')](_0x596850));});};exports[_0x17e2('0x6c')]=function(_0x2cdd7a,_0x201521,_0x71976b,_0x4b16c6,_0x439553,_0x3399ac,_0x22d7f9){var _0x436d91,_0x378900,_0x2724eb,_0x39d292;_0x3399ac[_0x17e2('0x52')]=intUtil[_0x17e2('0x51')](_0x3399ac[_0x17e2('0x52')]);_0x3399ac['serverUrl']=intUtil[_0x17e2('0x51')](_0x3399ac[_0x17e2('0x53')]);def['uri']=util['format'](_0x17e2('0x55'),_0x3399ac[_0x17e2('0x52')]);if(_0x22d7f9&&_0x22d7f9[_0x17e2('0x6d')]&&_0x22d7f9['recordingFormat']!==_0x17e2('0x6e')){logger[_0x17e2('0xd')]('[OUTBOUND]',_0x17e2('0x58'));_0x201521['recordingURL']=util['format'](_0x17e2('0x6f'),_0x3399ac[_0x17e2('0x53')],_0x201521[_0x17e2('0x5a')],md5(_0x201521['uniqueid']));}return getConnection(_0x3399ac)[_0x17e2('0x2c')](function(_0x479689){_0x39d292=_0x479689;return getUser(_0x3399ac,_0x4b16c6[_0x17e2('0xf')],_0x39d292);})[_0x17e2('0x2c')](function(_0x542f29){_0x436d91=_0x542f29;logger[_0x17e2('0xd')](_0x17e2('0x5b'),_0x436d91['id']);return getEndUser(_0x3399ac,_0x201521[_0x17e2('0x70')],_0x201521[_0x17e2('0x71')],_0x39d292);})['then'](function(_0x2cbacf){_0x378900=_0x2cbacf;logger[_0x17e2('0xd')](_0x17e2('0x5e'),_0x378900['id']);return getTicket(_0x3399ac,_0x436d91,_0x378900,_0x71976b,_0x201521,_0x71976b['Fields'],_0x39d292,_0x17e2('0x72'));})[_0x17e2('0x2c')](function(_0x46db2f){_0x2724eb=_0x46db2f;logger[_0x17e2('0xd')]('Ticket\x20created!');logger[_0x17e2('0xd')](_0x17e2('0x62'),_0x2724eb['id']);return setRelationship(_0x39d292,_0x436d91,_0x2724eb,_0x17e2('0x63'));})[_0x17e2('0x2c')](function(){return setRelationship(_0x39d292,_0x378900,_0x2724eb,_0x17e2('0x64'));})['then'](function(){return getServerInfo(_0x39d292);})[_0x17e2('0x2c')](function(_0x334d1a){var _0x154f95=parseInt(_0x334d1a[_0x17e2('0x65')][_0x17e2('0x66')](0x0));var _0x12531f=util[_0x17e2('0x23')](_0x17e2('0x73'),_0x3399ac[_0x17e2('0x52')],_0x2724eb['id']);if(_0x154f95>0x6){_0x12531f=util[_0x17e2('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3399ac[_0x17e2('0x52')],_0x2724eb['id']);}logger[_0x17e2('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x17e2('0x23')](_0x17e2('0x69'),_0x4b16c6[_0x17e2('0xf')]),_0x17e2('0x6a'),{'uri':_0x12531f});})[_0x17e2('0x6b')](function(_0x4d85cf){logger['error']('[OUTBOUND]',JSON['stringify'](_0x4d85cf));});};exports[_0x17e2('0x74')]=function(_0x5ec28f,_0x183e2f,_0x115ed5,_0x644c88,_0x3b9418,_0x2cee59){var _0x10b817,_0x314c36,_0x158c05,_0x436b05;_0x2cee59['remoteUri']=intUtil[_0x17e2('0x51')](_0x2cee59[_0x17e2('0x52')]);_0x2cee59[_0x17e2('0x53')]=intUtil['stripTrailingSlash'](_0x2cee59[_0x17e2('0x53')]);def[_0x17e2('0x54')]=util['format'](_0x17e2('0x55'),_0x2cee59[_0x17e2('0x52')]);if(_0x3b9418&&_0x3b9418[_0x17e2('0x56')]){logger['info']('['+_0x183e2f['lastevent'][_0x17e2('0x75')]()+']',_0x17e2('0x58'));_0x183e2f['recordingURL']=util[_0x17e2('0x23')](_0x17e2('0x6f'),_0x2cee59['serverUrl'],_0x183e2f[_0x17e2('0x5a')],md5(_0x183e2f[_0x17e2('0x5a')]));}else{_0x183e2f['recordingURL']='';}return getConnection(_0x2cee59)[_0x17e2('0x2c')](function(_0x4e0f1c){_0x436b05=_0x4e0f1c;if(!_[_0x17e2('0x27')](_0x644c88)){return getUser(_0x2cee59,_0x644c88[_0x17e2('0xf')],_0x436b05);}else{return getUser(_0x2cee59,null,_0x436b05);}})[_0x17e2('0x2c')](function(_0x256923){_0x10b817=_0x256923;logger[_0x17e2('0xd')](_0x17e2('0x5b'),_0x10b817['id']);return getEndUser(_0x2cee59,_0x183e2f['calleridname'],_0x183e2f[_0x17e2('0x5d')],_0x436b05);})[_0x17e2('0x2c')](function(_0x1eae97){_0x314c36=_0x1eae97;logger[_0x17e2('0xd')](_0x17e2('0x5e'),_0x314c36['id']);return getTicket(_0x2cee59,_0x10b817,_0x314c36,_0x115ed5,_0x183e2f,_0x115ed5['Fields'],_0x436b05,_0x17e2('0x60'));})[_0x17e2('0x2c')](function(_0x5cf8fa){_0x158c05=_0x5cf8fa;logger['info'](_0x17e2('0x61'));logger['info'](_0x17e2('0x62'),_0x158c05['id']);return setRelationship(_0x436b05,_0x10b817,_0x158c05,_0x17e2('0x63'));})[_0x17e2('0x2c')](function(){return setRelationship(_0x436b05,_0x314c36,_0x158c05,_0x17e2('0x64'));})[_0x17e2('0x2c')](function(){return getServerInfo(_0x436b05);})[_0x17e2('0x6b')](function(_0x5a4e04){logger['error']('['+_0x183e2f['lastevent'][_0x17e2('0x75')]()+']',JSON[_0x17e2('0x22')](_0x5a4e04));});}; \ 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 372947b..b90add0 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 _0xfd52=['util','getString','length','sortBy','type','string','content','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','variable','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test'];(function(_0x4123ee,_0x337d4d){var _0x7458fb=function(_0x25b899){while(--_0x25b899){_0x4123ee['push'](_0x4123ee['shift']());}};_0x7458fb(++_0x337d4d);}(_0xfd52,0x195));var _0x2fd5=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xfd52[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require(_0x2fd5('0x0'));exports[_0x2fd5('0x1')]=function(_0x3a69ac,_0x51ad13,_0x5709c6){var _0xa512df=[];if(_0x3a69ac[_0x2fd5('0x2')]>0x0){var _0xd0187e=_[_0x2fd5('0x3')](_0x3a69ac,['id']);for(var _0x4d5f12=0x0;_0x4d5f12<_0xd0187e[_0x2fd5('0x2')];_0x4d5f12++){var _0x23f210=_0xd0187e[_0x4d5f12];if(_0x23f210[_0x2fd5('0x4')]===_0x2fd5('0x5')){_0xa512df['push'](_0x23f210[_0x2fd5('0x6')]);}else if(_0x23f210[_0x2fd5('0x4')]==='variable'&&_0x23f210[_0x2fd5('0x7')]){_0x51ad13[_0x23f210[_0x2fd5('0x7')]]&&_0xa512df[_0x2fd5('0x8')](_0x51ad13[_0x23f210[_0x2fd5('0x7')]][_0x2fd5('0x9')]());}else if(_0x23f210[_0x2fd5('0x4')]===_0x2fd5('0xa')&&_0x23f210[_0x2fd5('0xb')]&&_0x23f210[_0x2fd5('0xb')][_0x2fd5('0xc')]){_0x51ad13[_0x23f210[_0x2fd5('0xb')]['name']['toLowerCase']()]&&_0xa512df['push'](_0x51ad13[_0x23f210[_0x2fd5('0xb')][_0x2fd5('0xc')][_0x2fd5('0xd')]()]['toString']());}else if(_0x23f210[_0x2fd5('0x4')]===_0x2fd5('0xe')){if(_0x23f210[_0x2fd5('0xf')]==='string'&&_0x23f210[_0x2fd5('0x10')]){_0xa512df[_0x2fd5('0x8')](util[_0x2fd5('0x11')](_0x2fd5('0x12'),_0x23f210[_0x2fd5('0x10')],_0x23f210['keyContent']));}else if(_0x23f210[_0x2fd5('0xf')]===_0x2fd5('0x13')&&_0x23f210[_0x2fd5('0x7')]&&_0x23f210[_0x2fd5('0x10')]){_0x51ad13[_0x23f210[_0x2fd5('0x7')]]&&_0xa512df[_0x2fd5('0x8')](util[_0x2fd5('0x11')](_0x2fd5('0x12'),_0x23f210['key'],_0x51ad13[_0x23f210[_0x2fd5('0x7')]]));}else if(_0x23f210[_0x2fd5('0xf')]==='customVariable'&&_0x23f210[_0x2fd5('0xb')]&&_0x23f210['Variable'][_0x2fd5('0xc')]&&_0x23f210['key']){_0x51ad13[_0x23f210[_0x2fd5('0xb')][_0x2fd5('0xc')]['toLowerCase']()]&&_0xa512df['push'](util['format'](_0x2fd5('0x12'),_0x23f210[_0x2fd5('0x10')],_0x51ad13[_0x23f210[_0x2fd5('0xb')][_0x2fd5('0xc')]['toLowerCase']()]));}}}}return _0xa512df[_0x2fd5('0x14')](_0x5709c6);};exports[_0x2fd5('0x15')]=function(_0x1686ee){var _0x33d758=_0x1686ee[_0x2fd5('0x16')](-0x1);if(_0x33d758==='/'){_0x1686ee=_0x1686ee[_0x2fd5('0x17')](0x0,_0x1686ee['lastIndexOf'](_0x33d758));}return _0x1686ee;};exports[_0x2fd5('0x18')]=function(_0x4ca739){if(!_[_0x2fd5('0x19')](_0x4ca739)&&_0x4ca739!==''){var _0x2461b8=/^(([^<>()\[\]\\.,;:\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 _0x2461b8[_0x2fd5('0x1a')](String(_0x4ca739)[_0x2fd5('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xcc9b=['%s:\x20%s','keyContent','join','stripTrailingSlash','lastIndexOf','validateEmail','isNil','test','util','length','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format'];(function(_0x52be0f,_0x7a50d7){var _0x193c9e=function(_0x46d154){while(--_0x46d154){_0x52be0f['push'](_0x52be0f['shift']());}};_0x193c9e(++_0x7a50d7);}(_0xcc9b,0xa9));var _0xbcc9=function(_0x5ea1ea,_0x25da1b){_0x5ea1ea=_0x5ea1ea-0x0;var _0x4003a8=_0xcc9b[_0x5ea1ea];return _0x4003a8;};'use strict';var _=require('lodash');var util=require(_0xbcc9('0x0'));exports['getString']=function(_0xc627ca,_0x3b42da,_0x349115){var _0x2bd752=[];if(_0xc627ca[_0xbcc9('0x1')]>0x0){var _0x1a8514=_['sortBy'](_0xc627ca,['id']);for(var _0x3577ee=0x0;_0x3577ee<_0x1a8514[_0xbcc9('0x1')];_0x3577ee++){var _0x20e416=_0x1a8514[_0x3577ee];if(_0x20e416[_0xbcc9('0x2')]===_0xbcc9('0x3')){_0x2bd752[_0xbcc9('0x4')](_0x20e416['content']);}else if(_0x20e416[_0xbcc9('0x2')]===_0xbcc9('0x5')&&_0x20e416[_0xbcc9('0x6')]){_0x3b42da[_0x20e416['variableName']]&&_0x2bd752[_0xbcc9('0x4')](_0x3b42da[_0x20e416['variableName']][_0xbcc9('0x7')]());}else if(_0x20e416[_0xbcc9('0x2')]===_0xbcc9('0x8')&&_0x20e416['Variable']&&_0x20e416[_0xbcc9('0x9')]['name']){_0x3b42da[_0x20e416[_0xbcc9('0x9')][_0xbcc9('0xa')][_0xbcc9('0xb')]()]&&_0x2bd752[_0xbcc9('0x4')](_0x3b42da[_0x20e416['Variable']['name'][_0xbcc9('0xb')]()][_0xbcc9('0x7')]());}else if(_0x20e416[_0xbcc9('0x2')]==='keyValue'){if(_0x20e416[_0xbcc9('0xc')]===_0xbcc9('0x3')&&_0x20e416[_0xbcc9('0xd')]){_0x2bd752[_0xbcc9('0x4')](util[_0xbcc9('0xe')](_0xbcc9('0xf'),_0x20e416['key'],_0x20e416[_0xbcc9('0x10')]));}else if(_0x20e416['keyType']==='variable'&&_0x20e416[_0xbcc9('0x6')]&&_0x20e416[_0xbcc9('0xd')]){_0x3b42da[_0x20e416['variableName']]&&_0x2bd752['push'](util['format'](_0xbcc9('0xf'),_0x20e416[_0xbcc9('0xd')],_0x3b42da[_0x20e416[_0xbcc9('0x6')]]));}else if(_0x20e416[_0xbcc9('0xc')]===_0xbcc9('0x8')&&_0x20e416['Variable']&&_0x20e416[_0xbcc9('0x9')][_0xbcc9('0xa')]&&_0x20e416[_0xbcc9('0xd')]){_0x3b42da[_0x20e416['Variable'][_0xbcc9('0xa')][_0xbcc9('0xb')]()]&&_0x2bd752[_0xbcc9('0x4')](util['format']('%s:\x20%s',_0x20e416[_0xbcc9('0xd')],_0x3b42da[_0x20e416['Variable']['name'][_0xbcc9('0xb')]()]));}}}}return _0x2bd752[_0xbcc9('0x11')](_0x349115);};exports[_0xbcc9('0x12')]=function(_0x644687){var _0x48c346=_0x644687['slice'](-0x1);if(_0x48c346==='/'){_0x644687=_0x644687['substring'](0x0,_0x644687[_0xbcc9('0x13')](_0x48c346));}return _0x644687;};exports[_0xbcc9('0x14')]=function(_0x2ecd94){if(!_[_0xbcc9('0x15')](_0x2ecd94)&&_0x2ecd94!==''){var _0x4d2691=/^(([^<>()\[\]\\.,;:\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 _0x4d2691[_0xbcc9('0x16')](String(_0x2ecd94)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 4ada0d7..98165fb 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x5be37a,_0x4bb5a2){var _0x50e3c7=function(_0x120a91){while(--_0x120a91){_0x5be37a['push'](_0x5be37a['shift']());}};_0x50e3c7(++_0x4bb5a2);}(_0xe706,0xa3));var _0x6e70=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0xe706[_0x154cb5];return _0x3f574f;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0xc568e3,_0x114f39){var _0x48091d=function(_0x2d8f01){while(--_0x2d8f01){_0xc568e3['push'](_0xc568e3['shift']());}};_0x48091d(++_0x114f39);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'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 5e322c1..56ece06 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 _0x747c=['../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','info','format','%s/tickets.json','remoteUri','merge','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','[HTTP]','stringify','GET','map','forEach','string','picklist','nameField','toString','includes','customField','custom_fields','push','idField','content','type','variable','variableName','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','recordingFormat','Recording\x20is\x20enabled!','email','destcalleridname','[OUTBOUND]','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','util','ioredis','./util'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x747c,0x1a1));var _0xc747=function(_0x5b846c,_0x52fc09){_0x5b846c=_0x5b846c-0x0;var _0x5905f6=_0x747c[_0x5b846c];return _0x5905f6;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xc747('0x0'));var Redis=require(_0xc747('0x1'));var intUtil=require(_0xc747('0x2'));var config=require(_0xc747('0x3'));var logger=require(_0xc747('0x4'))(_0xc747('0x5'));config[_0xc747('0x6')]=_[_0xc747('0x7')](config[_0xc747('0x6')],{'host':_0xc747('0x8'),'port':0x18eb});var io=require(_0xc747('0x9'))(new Redis(config[_0xc747('0x6')]));function emit(_0x582399,_0x3dcb87,_0x4a2d45){io['to'](_0x582399)[_0xc747('0xa')](_0x3dcb87,_0x4a2d45);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x27b879,_0x2e2305,_0x3f6223,_0x3103b4,_0x511123){logger[_0xc747('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xc747('0xc')](_0xc747('0xd'),_0x27b879[_0xc747('0xe')]),'method':'POST','body':{'ticket':_[_0xc747('0xf')]({'requester_id':_0x3f6223['id'],'submitter_id':_0x2e2305?_0x2e2305['id']:undefined,'assignee_id':_0x2e2305?_0x2e2305['id']:undefined,'tags':getTags(_0x3103b4['Tags'],'name'),'subject':intUtil[_0xc747('0x10')](_0x3103b4[_0xc747('0x11')],_0x511123,'\x20'),'description':intUtil[_0xc747('0x10')](_0x3103b4[_0xc747('0x12')],_0x511123,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc747('0x10')](_0x3103b4[_0xc747('0x12')],_0x511123,'\x0a')}},getCustomFields(_0x3103b4['Fields'],_0x511123))}})[_0xc747('0x13')](function(_0x35b851){logger[_0xc747('0xb')](_0xc747('0x14'));return _0x35b851[_0xc747('0x15')];});}function getUser(_0x518e6c,_0x33ced2){if(intUtil[_0xc747('0x16')](_0x33ced2)){logger[_0xc747('0xb')]('Getting\x20agent\x20with\x20email',_0x33ced2);return request({'uri':util['format'](_0xc747('0x17'),_0x518e6c[_0xc747('0xe')]),'qs':{'query':util[_0xc747('0xc')]('type:user\x20role:agent\x20email:%s',_0x33ced2)}})['then'](function(_0x5de479){if(_0x5de479['count']){logger[_0xc747('0xb')]('Agent\x20found!');return _[_0xc747('0x18')](_0x5de479[_0xc747('0x19')],{'email':_0x33ced2,'role':_0xc747('0x1a')});}else{logger[_0xc747('0xb')](_0xc747('0x1b'));return request({'uri':util[_0xc747('0xc')](_0xc747('0x1c'),_0x518e6c[_0xc747('0xe')])})[_0xc747('0x13')](function(_0x234cff){logger[_0xc747('0xb')](_0xc747('0x1d'));return _0x234cff[_0xc747('0x1e')];});}});}else{logger[_0xc747('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xc747('0x1c'),_0x518e6c[_0xc747('0xe')])})[_0xc747('0x13')](function(_0x3c0b0e){logger[_0xc747('0xb')](_0xc747('0x1d'));return _0x3c0b0e[_0xc747('0x1e')];});}}function getEndUser(_0x3e4a37,_0x4b3d11,_0x2bf515){logger[_0xc747('0xb')](_0xc747('0x1f'),_0x2bf515);return request({'uri':util[_0xc747('0xc')](_0xc747('0x17'),_0x3e4a37[_0xc747('0xe')]),'qs':{'query':util[_0xc747('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x2bf515)}})[_0xc747('0x13')](function(_0x34d19e){var _0x49bc9a;if(_0x34d19e[_0xc747('0x19')][_0xc747('0x20')]){_0x34d19e[_0xc747('0x19')]=_[_0xc747('0x21')](_0x34d19e['results'],{'suspended':![],'role':_0xc747('0x22')});if(_0x34d19e['results'][_0xc747('0x20')]){_0x49bc9a=_[_0xc747('0x23')](_0x34d19e[_0xc747('0x19')]);}}if(_0x49bc9a){logger['info'](_0xc747('0x24'));return _0x49bc9a;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xc747('0xc')](_0xc747('0x25'),_0x3e4a37[_0xc747('0xe')]),'method':_0xc747('0x26'),'body':{'user':{'role':_0xc747('0x22'),'name':util[_0xc747('0xc')](_0xc747('0x27'),_0x4b3d11||_0x2bf515),'phone':_0x2bf515}}})[_0xc747('0x13')](function(_0x59b402){logger[_0xc747('0xb')](_0xc747('0x28'));return _0x59b402['user'];});}});}function getAuth(_0x1142b3){var _0x3ffb9f;if(_0x1142b3[_0xc747('0x29')]===_0xc747('0x2a')){_0x3ffb9f=util[_0xc747('0xc')]('%s:%s',_0x1142b3[_0xc747('0x2b')],_0x1142b3[_0xc747('0x2a')]);}else if(_0x1142b3[_0xc747('0x29')]===_0xc747('0x2c')){_0x3ffb9f=util[_0xc747('0xc')](_0xc747('0x2d'),_0x1142b3['username'],_0x1142b3[_0xc747('0x2c')]);}return util[_0xc747('0xc')](_0xc747('0x2e'),new Buffer(_0x3ffb9f)['toString']('base64'));}function request(_0x1e6558){logger['debug'](_0xc747('0x2f'),JSON[_0xc747('0x30')](_0x1e6558));return rp(_['defaults'](_0x1e6558,{'method':_0xc747('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x53f51d,_0x48a139){var _0x4e97c9=[];if(_0x53f51d&&_0x53f51d[_0xc747('0x20')]>0x0){_0x4e97c9=_[_0xc747('0x32')](_0x53f51d,_0x48a139);}return _0x4e97c9;}function getCustomFields(_0x3a20d6,_0x2701a5){var _0x3830db=[];var _0x2643d5={'custom_fields':[]};if(_0x3a20d6['length']>0x0){_[_0xc747('0x33')](_0x3a20d6,function(_0x59afd7){if(_['includes']([_0xc747('0x34'),_0xc747('0x35')],_0x59afd7['type'])&&_0x59afd7[_0xc747('0x36')]&&!_0x59afd7['customField']){_0x2643d5[_0x59afd7['nameField']['toLowerCase']()]=_0x59afd7['content'][_0xc747('0x37')]();}else if(_[_0xc747('0x38')](['string','picklist'],_0x59afd7['type'])&&_0x59afd7['idField']&&_0x59afd7[_0xc747('0x39')]){_0x2643d5[_0xc747('0x3a')][_0xc747('0x3b')]({'id':_0x59afd7[_0xc747('0x3c')],'value':_0x59afd7[_0xc747('0x3d')][_0xc747('0x37')]()});}else if(_0x59afd7[_0xc747('0x3e')]===_0xc747('0x3f')&&_0x59afd7[_0xc747('0x40')]&&_0x59afd7[_0xc747('0x3c')]&&_0x59afd7[_0xc747('0x39')]){_0x2701a5[_0x59afd7['variableName']]&&_0x2643d5['custom_fields'][_0xc747('0x3b')]({'id':_0x59afd7[_0xc747('0x3c')],'value':_0x2701a5[_0x59afd7[_0xc747('0x40')]][_0xc747('0x37')]()});}else if(_0x59afd7[_0xc747('0x3e')]==='customVariable'&&_0x59afd7[_0xc747('0x41')]&&_0x59afd7['Variable'][_0xc747('0x42')]&&_0x59afd7[_0xc747('0x3c')]&&_0x59afd7[_0xc747('0x39')]){_0x2701a5[_0x59afd7[_0xc747('0x41')][_0xc747('0x42')]['toLowerCase']()]&&_0x2643d5[_0xc747('0x3a')][_0xc747('0x3b')]({'id':_0x59afd7[_0xc747('0x3c')],'value':_0x2701a5[_0x59afd7[_0xc747('0x41')]['name'][_0xc747('0x43')]()][_0xc747('0x37')]()});}});}return _0x2643d5;}exports['queue']=function(_0xed972e,_0x16e112,_0x4f7b47,_0x5793f1,_0x3ff64c,_0x59a051){var _0x564352,_0x4d2aa9;_0x59a051['remoteUri']=intUtil[_0xc747('0x44')](_0x59a051['remoteUri']);_0x59a051[_0xc747('0x45')]=intUtil[_0xc747('0x44')](_0x59a051[_0xc747('0x45')]);if(_0x3ff64c&&_0x3ff64c[_0xc747('0x46')]){logger[_0xc747('0xb')](_0xc747('0x47'),'Recording\x20is\x20enabled!');_0x16e112[_0xc747('0x48')]=util[_0xc747('0xc')](_0xc747('0x49'),_0x59a051[_0xc747('0x45')],_0x16e112[_0xc747('0x4a')],md5(_0x16e112[_0xc747('0x4a')]));}else{_0x16e112[_0xc747('0x48')]='';}headers[_0xc747('0x4b')]=getAuth(_0x59a051);return getUser(_0x59a051,_0x5793f1['email'])['then'](function(_0x5da9f1){_0x564352=_0x5da9f1;logger[_0xc747('0xb')](_0xc747('0x4c'),_0x564352['id']);return getEndUser(_0x59a051,_0x16e112['calleridname'],_0x16e112[_0xc747('0x4d')]);})[_0xc747('0x13')](function(_0x26de1a){_0x4d2aa9=_0x26de1a;logger['info'](_0xc747('0x4e'),_0x4d2aa9['id']);return getTicket(_0x59a051,_0x564352,_0x4d2aa9,_0x4f7b47,_0x16e112);})[_0xc747('0x13')](function(_0x2b2d86){if(_0x2b2d86){logger[_0xc747('0xb')](_0xc747('0x4f'),_0x2b2d86['id']);switch(_0x59a051[_0xc747('0x3e')]){case _0xc747('0x50'):logger[_0xc747('0xb')](_0xc747('0x47'),_0xc747('0x51'));return request({'uri':util[_0xc747('0xc')](_0xc747('0x52'),_0x59a051['remoteUri'],_0x564352['id'],_0x2b2d86['id']),'method':'POST'});case _0xc747('0x53'):logger[_0xc747('0xb')](_0xc747('0x47'),_0xc747('0x54'));emit(util['format'](_0xc747('0x55'),_0x5793f1[_0xc747('0x42')]),_0xc747('0x56'),{'uri':util[_0xc747('0xc')]('%s/agent/tickets/%s',_0x59a051[_0xc747('0xe')][_0xc747('0x57')](_0xc747('0x58'),''),_0x2b2d86['id'])});break;default:logger[_0xc747('0x59')](_0xc747('0x47'),_0xc747('0x5a'));}}})[_0xc747('0x5b')](function(_0x2a97b7){logger[_0xc747('0x59')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xc747('0x5c')](_0x2a97b7,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5927fe,_0x58e92b,_0x4c045d,_0x33d8cc,_0x41a5d0,_0x895ef0,_0x3bb74d){var _0x28c3cd,_0x22091f;_0x895ef0[_0xc747('0xe')]=intUtil[_0xc747('0x44')](_0x895ef0[_0xc747('0xe')]);_0x895ef0['serverUrl']=intUtil[_0xc747('0x44')](_0x895ef0[_0xc747('0x45')]);if(_0x3bb74d&&_0x3bb74d[_0xc747('0x5d')]&&_0x3bb74d[_0xc747('0x5d')]!=='none'){logger[_0xc747('0xb')]('[OUTBOUND]',_0xc747('0x5e'));_0x58e92b[_0xc747('0x48')]=util[_0xc747('0xc')](_0xc747('0x49'),_0x895ef0[_0xc747('0x45')],_0x58e92b[_0xc747('0x4a')],md5(_0x58e92b[_0xc747('0x4a')]));}headers['Authorization']=getAuth(_0x895ef0);return getUser(_0x895ef0,_0x33d8cc[_0xc747('0x5f')])[_0xc747('0x13')](function(_0x5e59d7){_0x28c3cd=_0x5e59d7;logger['info'](_0xc747('0x4c'),_0x28c3cd['id']);return getEndUser(_0x895ef0,_0x58e92b[_0xc747('0x60')],_0x58e92b['destcalleridnum']);})[_0xc747('0x13')](function(_0x4bf9c5){_0x22091f=_0x4bf9c5;logger[_0xc747('0xb')](_0xc747('0x4e'),_0x22091f['id']);return getTicket(_0x895ef0,_0x28c3cd,_0x22091f,_0x4c045d,_0x58e92b);})[_0xc747('0x13')](function(_0xf40686){if(_0xf40686){logger[_0xc747('0xb')](_0xc747('0x4f'),_0xf40686['id']);switch(_0x895ef0[_0xc747('0x3e')]){case _0xc747('0x50'):logger[_0xc747('0xb')](_0xc747('0x61'),_0xc747('0x51'));return request({'uri':util[_0xc747('0xc')](_0xc747('0x52'),_0x895ef0[_0xc747('0xe')],_0x28c3cd['id'],_0xf40686['id']),'method':'POST'});case _0xc747('0x53'):logger['info'](_0xc747('0x61'),_0xc747('0x54'));emit(util[_0xc747('0xc')](_0xc747('0x55'),_0x33d8cc[_0xc747('0x42')]),'trigger:browser:url',{'uri':util[_0xc747('0xc')](_0xc747('0x62'),_0x895ef0[_0xc747('0xe')][_0xc747('0x57')](_0xc747('0x58'),''),_0xf40686['id'])});break;default:logger[_0xc747('0x59')](_0xc747('0x61'),_0xc747('0x5a'));}}})[_0xc747('0x5b')](function(_0x568c95){logger[_0xc747('0x59')](_0xc747('0x63'),util['inspect'](_0x568c95,{'showHidden':!![],'depth':null}));});};exports[_0xc747('0x64')]=function(_0x183692,_0x222f62,_0x12149e,_0x31f1a2,_0x497672,_0x5efea8){var _0x3054f7,_0x5f41a4;_0x5efea8[_0xc747('0xe')]=intUtil[_0xc747('0x44')](_0x5efea8[_0xc747('0xe')]);_0x5efea8[_0xc747('0x45')]=intUtil[_0xc747('0x44')](_0x5efea8[_0xc747('0x45')]);if(_0x497672&&_0x497672['monitor_format']){logger[_0xc747('0xb')]('['+_0x222f62[_0xc747('0x65')][_0xc747('0x66')]()+']',_0xc747('0x5e'));_0x222f62[_0xc747('0x48')]=util[_0xc747('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5efea8[_0xc747('0x45')],_0x222f62['uniqueid'],md5(_0x222f62[_0xc747('0x4a')]));}else{_0x222f62[_0xc747('0x48')]='';}headers[_0xc747('0x4b')]=getAuth(_0x5efea8);return getUser(_0x5efea8)[_0xc747('0x13')](function(_0x1f219d){_0x3054f7=_0x1f219d;logger['info'](_0xc747('0x4c'),_0x3054f7['id']);return getEndUser(_0x5efea8,_0x222f62[_0xc747('0x67')],_0x222f62[_0xc747('0x4d')]);})['then'](function(_0x5d794c){_0x5f41a4=_0x5d794c;logger[_0xc747('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5f41a4['id']);return getTicket(_0x5efea8,_0x3054f7,_0x5f41a4,_0x12149e,_0x222f62);})['then'](function(_0x108abc){if(_0x108abc){logger[_0xc747('0xb')](_0xc747('0x4f'),_0x108abc['id']);}})[_0xc747('0x5b')](function(_0x4e861b){logger['error']('['+_0x222f62['lastevent'][_0xc747('0x66')]()+']'+_0xc747('0x68'),util[_0xc747('0x5c')](_0x4e861b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x90e1=['name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','debug','[HTTP]','defaults','GET','map','forEach','picklist','type','nameField','customField','content','toString','includes','string','custom_fields','idField','variable','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','POST','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','localhost','redis','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge'];(function(_0x5bbf63,_0x70c8b3){var _0x1141f8=function(_0x39f475){while(--_0x39f475){_0x5bbf63['push'](_0x5bbf63['shift']());}};_0x1141f8(++_0x70c8b3);}(_0x90e1,0x1b1));var _0x190e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x90e1[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var rp=require(_0x190e('0x0'));var md5=require('md5');var util=require(_0x190e('0x1'));var Redis=require(_0x190e('0x2'));var intUtil=require('./util');var config=require(_0x190e('0x3'));var logger=require(_0x190e('0x4'))(_0x190e('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x190e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x190e('0x7')]));function emit(_0x1fdbb5,_0x5a6c71,_0x254a68){io['to'](_0x1fdbb5)[_0x190e('0x8')](_0x5a6c71,_0x254a68);}var headers={'Content-Type':_0x190e('0x9'),'Accept':_0x190e('0x9')};function getTicket(_0x20ce15,_0x4ff9de,_0x312609,_0x19a495,_0x15a8cf){logger['info'](_0x190e('0xa'));return request({'uri':util[_0x190e('0xb')](_0x190e('0xc'),_0x20ce15[_0x190e('0xd')]),'method':'POST','body':{'ticket':_[_0x190e('0xe')]({'requester_id':_0x312609['id'],'submitter_id':_0x4ff9de?_0x4ff9de['id']:undefined,'assignee_id':_0x4ff9de?_0x4ff9de['id']:undefined,'tags':getTags(_0x19a495['Tags'],_0x190e('0xf')),'subject':intUtil[_0x190e('0x10')](_0x19a495[_0x190e('0x11')],_0x15a8cf,'\x20'),'description':intUtil['getString'](_0x19a495[_0x190e('0x12')],_0x15a8cf,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x19a495['Descriptions'],_0x15a8cf,'\x0a')}},getCustomFields(_0x19a495[_0x190e('0x13')],_0x15a8cf))}})[_0x190e('0x14')](function(_0x3ea7d9){logger[_0x190e('0x15')](_0x190e('0x16'));return _0x3ea7d9[_0x190e('0x17')];});}function getUser(_0x4f3665,_0xbe0a9){if(intUtil['validateEmail'](_0xbe0a9)){logger[_0x190e('0x15')](_0x190e('0x18'),_0xbe0a9);return request({'uri':util[_0x190e('0xb')](_0x190e('0x19'),_0x4f3665[_0x190e('0xd')]),'qs':{'query':util[_0x190e('0xb')](_0x190e('0x1a'),_0xbe0a9)}})['then'](function(_0x4ba1a5){if(_0x4ba1a5['count']){logger[_0x190e('0x15')](_0x190e('0x1b'));return _['find'](_0x4ba1a5[_0x190e('0x1c')],{'email':_0xbe0a9,'role':_0x190e('0x1d')});}else{logger[_0x190e('0x15')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x190e('0xb')](_0x190e('0x1e'),_0x4f3665[_0x190e('0xd')])})['then'](function(_0x7343c0){logger['info'](_0x190e('0x1f'));return _0x7343c0[_0x190e('0x20')];});}});}else{logger[_0x190e('0x15')](_0x190e('0x21'));return request({'uri':util[_0x190e('0xb')](_0x190e('0x1e'),_0x4f3665['remoteUri'])})[_0x190e('0x14')](function(_0x211269){logger[_0x190e('0x15')](_0x190e('0x1f'));return _0x211269[_0x190e('0x20')];});}}function getEndUser(_0x349ec9,_0x412b73,_0x5bd506){logger[_0x190e('0x15')](_0x190e('0x22'),_0x5bd506);return request({'uri':util['format'](_0x190e('0x19'),_0x349ec9['remoteUri']),'qs':{'query':util[_0x190e('0xb')](_0x190e('0x23'),_0x5bd506)}})[_0x190e('0x14')](function(_0x3adcbe){var _0x1b39bc;if(_0x3adcbe[_0x190e('0x1c')][_0x190e('0x24')]){_0x3adcbe[_0x190e('0x1c')]=_[_0x190e('0x25')](_0x3adcbe[_0x190e('0x1c')],{'suspended':![],'role':_0x190e('0x26')});if(_0x3adcbe[_0x190e('0x1c')][_0x190e('0x24')]){_0x1b39bc=_[_0x190e('0x27')](_0x3adcbe[_0x190e('0x1c')]);}}if(_0x1b39bc){logger['info'](_0x190e('0x28'));return _0x1b39bc;}else{logger[_0x190e('0x15')](_0x190e('0x29'));return request({'uri':util[_0x190e('0xb')](_0x190e('0x2a'),_0x349ec9[_0x190e('0xd')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x190e('0xb')](_0x190e('0x2b'),_0x412b73||_0x5bd506),'phone':_0x5bd506}}})[_0x190e('0x14')](function(_0x3eea2b){logger[_0x190e('0x15')](_0x190e('0x2c'));return _0x3eea2b[_0x190e('0x20')];});}});}function getAuth(_0x25180c){var _0x7e007b;if(_0x25180c[_0x190e('0x2d')]===_0x190e('0x2e')){_0x7e007b=util[_0x190e('0xb')](_0x190e('0x2f'),_0x25180c[_0x190e('0x30')],_0x25180c[_0x190e('0x2e')]);}else if(_0x25180c[_0x190e('0x2d')]===_0x190e('0x31')){_0x7e007b=util[_0x190e('0xb')](_0x190e('0x32'),_0x25180c['username'],_0x25180c[_0x190e('0x31')]);}return util['format'](_0x190e('0x33'),new Buffer(_0x7e007b)['toString']('base64'));}function request(_0x217491){logger[_0x190e('0x34')](_0x190e('0x35'),JSON['stringify'](_0x217491));return rp(_[_0x190e('0x36')](_0x217491,{'method':_0x190e('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x374a72,_0x52f5b5){var _0x3563c5=[];if(_0x374a72&&_0x374a72[_0x190e('0x24')]>0x0){_0x3563c5=_[_0x190e('0x38')](_0x374a72,_0x52f5b5);}return _0x3563c5;}function getCustomFields(_0x8c9bfc,_0x27fa52){var _0x247afc=[];var _0x2e7242={'custom_fields':[]};if(_0x8c9bfc[_0x190e('0x24')]>0x0){_[_0x190e('0x39')](_0x8c9bfc,function(_0x515e29){if(_['includes'](['string',_0x190e('0x3a')],_0x515e29[_0x190e('0x3b')])&&_0x515e29[_0x190e('0x3c')]&&!_0x515e29[_0x190e('0x3d')]){_0x2e7242[_0x515e29[_0x190e('0x3c')]['toLowerCase']()]=_0x515e29[_0x190e('0x3e')][_0x190e('0x3f')]();}else if(_[_0x190e('0x40')]([_0x190e('0x41'),_0x190e('0x3a')],_0x515e29['type'])&&_0x515e29['idField']&&_0x515e29[_0x190e('0x3d')]){_0x2e7242[_0x190e('0x42')]['push']({'id':_0x515e29[_0x190e('0x43')],'value':_0x515e29[_0x190e('0x3e')][_0x190e('0x3f')]()});}else if(_0x515e29[_0x190e('0x3b')]===_0x190e('0x44')&&_0x515e29[_0x190e('0x45')]&&_0x515e29[_0x190e('0x43')]&&_0x515e29[_0x190e('0x3d')]){_0x27fa52[_0x515e29[_0x190e('0x45')]]&&_0x2e7242[_0x190e('0x42')]['push']({'id':_0x515e29['idField'],'value':_0x27fa52[_0x515e29[_0x190e('0x45')]][_0x190e('0x3f')]()});}else if(_0x515e29[_0x190e('0x3b')]===_0x190e('0x46')&&_0x515e29[_0x190e('0x47')]&&_0x515e29[_0x190e('0x47')][_0x190e('0xf')]&&_0x515e29[_0x190e('0x43')]&&_0x515e29['customField']){_0x27fa52[_0x515e29[_0x190e('0x47')][_0x190e('0xf')][_0x190e('0x48')]()]&&_0x2e7242[_0x190e('0x42')]['push']({'id':_0x515e29['idField'],'value':_0x27fa52[_0x515e29['Variable'][_0x190e('0xf')][_0x190e('0x48')]()]['toString']()});}});}return _0x2e7242;}exports[_0x190e('0x49')]=function(_0x44d3ec,_0x79d038,_0x102c98,_0x2e7013,_0x13c390,_0x175057){var _0x1ec656,_0x179150;_0x175057['remoteUri']=intUtil['stripTrailingSlash'](_0x175057['remoteUri']);_0x175057[_0x190e('0x4a')]=intUtil['stripTrailingSlash'](_0x175057[_0x190e('0x4a')]);if(_0x13c390&&_0x13c390['monitor_format']){logger[_0x190e('0x15')](_0x190e('0x4b'),_0x190e('0x4c'));_0x79d038['recordingURL']=util[_0x190e('0xb')](_0x190e('0x4d'),_0x175057['serverUrl'],_0x79d038[_0x190e('0x4e')],md5(_0x79d038['uniqueid']));}else{_0x79d038[_0x190e('0x4f')]='';}headers[_0x190e('0x50')]=getAuth(_0x175057);return getUser(_0x175057,_0x2e7013[_0x190e('0x51')])[_0x190e('0x14')](function(_0x43c905){_0x1ec656=_0x43c905;logger['info'](_0x190e('0x52'),_0x1ec656['id']);return getEndUser(_0x175057,_0x79d038[_0x190e('0x53')],_0x79d038[_0x190e('0x54')]);})[_0x190e('0x14')](function(_0x47f94c){_0x179150=_0x47f94c;logger[_0x190e('0x15')]('The\x20Enduser\x20ID\x20is:',_0x179150['id']);return getTicket(_0x175057,_0x1ec656,_0x179150,_0x102c98,_0x79d038);})[_0x190e('0x14')](function(_0xb643c9){if(_0xb643c9){logger[_0x190e('0x15')](_0x190e('0x55'),_0xb643c9['id']);switch(_0x175057[_0x190e('0x3b')]){case _0x190e('0x56'):logger['info']('[QUEUE]',_0x190e('0x57'));return request({'uri':util[_0x190e('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x175057[_0x190e('0xd')],_0x1ec656['id'],_0xb643c9['id']),'method':_0x190e('0x58')});case _0x190e('0x59'):logger['info'](_0x190e('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x190e('0x5a'),_0x2e7013[_0x190e('0xf')]),_0x190e('0x5b'),{'uri':util[_0x190e('0xb')](_0x190e('0x5c'),_0x175057['remoteUri'][_0x190e('0x5d')](_0x190e('0x5e'),''),_0xb643c9['id'])});break;default:logger[_0x190e('0x5f')](_0x190e('0x4b'),_0x190e('0x60'));}}})[_0x190e('0x61')](function(_0x30da4d){logger[_0x190e('0x5f')](_0x190e('0x62'),util[_0x190e('0x63')](_0x30da4d,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x21859d,_0x30fd75,_0x188756,_0x36d3af,_0x366fc6,_0x3fc7d5,_0x4faa5c){var _0x552fea,_0xd8bcd7;_0x3fc7d5[_0x190e('0xd')]=intUtil['stripTrailingSlash'](_0x3fc7d5[_0x190e('0xd')]);_0x3fc7d5['serverUrl']=intUtil[_0x190e('0x64')](_0x3fc7d5[_0x190e('0x4a')]);if(_0x4faa5c&&_0x4faa5c['recordingFormat']&&_0x4faa5c[_0x190e('0x65')]!=='none'){logger[_0x190e('0x15')](_0x190e('0x66'),_0x190e('0x4c'));_0x30fd75[_0x190e('0x4f')]=util[_0x190e('0xb')](_0x190e('0x4d'),_0x3fc7d5[_0x190e('0x4a')],_0x30fd75[_0x190e('0x4e')],md5(_0x30fd75[_0x190e('0x4e')]));}headers[_0x190e('0x50')]=getAuth(_0x3fc7d5);return getUser(_0x3fc7d5,_0x36d3af[_0x190e('0x51')])[_0x190e('0x14')](function(_0x2ab034){_0x552fea=_0x2ab034;logger[_0x190e('0x15')](_0x190e('0x52'),_0x552fea['id']);return getEndUser(_0x3fc7d5,_0x30fd75[_0x190e('0x67')],_0x30fd75[_0x190e('0x68')]);})['then'](function(_0x221db2){_0xd8bcd7=_0x221db2;logger['info'](_0x190e('0x69'),_0xd8bcd7['id']);return getTicket(_0x3fc7d5,_0x552fea,_0xd8bcd7,_0x188756,_0x30fd75);})[_0x190e('0x14')](function(_0x47903f){if(_0x47903f){logger[_0x190e('0x15')](_0x190e('0x55'),_0x47903f['id']);switch(_0x3fc7d5['type']){case'integrationTab':logger['info'](_0x190e('0x66'),_0x190e('0x57'));return request({'uri':util[_0x190e('0xb')](_0x190e('0x6a'),_0x3fc7d5[_0x190e('0xd')],_0x552fea['id'],_0x47903f['id']),'method':'POST'});case _0x190e('0x59'):logger[_0x190e('0x15')](_0x190e('0x66'),_0x190e('0x6b'));emit(util[_0x190e('0xb')](_0x190e('0x5a'),_0x36d3af['name']),_0x190e('0x5b'),{'uri':util[_0x190e('0xb')](_0x190e('0x5c'),_0x3fc7d5[_0x190e('0xd')][_0x190e('0x5d')](_0x190e('0x5e'),''),_0x47903f['id'])});break;default:logger[_0x190e('0x5f')](_0x190e('0x66'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x108003){logger[_0x190e('0x5f')](_0x190e('0x6c'),util[_0x190e('0x63')](_0x108003,{'showHidden':!![],'depth':null}));});};exports[_0x190e('0x6d')]=function(_0xdcfeff,_0x36224f,_0x54bd0f,_0xdc7f1a,_0x5301dd,_0xcab2b3){var _0x35eade,_0x108616;_0xcab2b3[_0x190e('0xd')]=intUtil[_0x190e('0x64')](_0xcab2b3[_0x190e('0xd')]);_0xcab2b3[_0x190e('0x4a')]=intUtil[_0x190e('0x64')](_0xcab2b3[_0x190e('0x4a')]);if(_0x5301dd&&_0x5301dd['monitor_format']){logger[_0x190e('0x15')]('['+_0x36224f[_0x190e('0x6e')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x36224f[_0x190e('0x4f')]=util[_0x190e('0xb')](_0x190e('0x4d'),_0xcab2b3[_0x190e('0x4a')],_0x36224f[_0x190e('0x4e')],md5(_0x36224f[_0x190e('0x4e')]));}else{_0x36224f[_0x190e('0x4f')]='';}headers[_0x190e('0x50')]=getAuth(_0xcab2b3);return getUser(_0xcab2b3)[_0x190e('0x14')](function(_0x499c51){_0x35eade=_0x499c51;logger[_0x190e('0x15')](_0x190e('0x52'),_0x35eade['id']);return getEndUser(_0xcab2b3,_0x36224f[_0x190e('0x53')],_0x36224f['calleridnum']);})['then'](function(_0x4e9b51){_0x108616=_0x4e9b51;logger['info'](_0x190e('0x69'),_0x108616['id']);return getTicket(_0xcab2b3,_0x35eade,_0x108616,_0x54bd0f,_0x36224f);})[_0x190e('0x14')](function(_0x37628b){if(_0x37628b){logger[_0x190e('0x15')](_0x190e('0x55'),_0x37628b['id']);}})[_0x190e('0x61')](function(_0xbc03eb){logger[_0x190e('0x5f')]('['+_0x36224f[_0x190e('0x6e')][_0x190e('0x6f')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x190e('0x63')](_0xbc03eb,{'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 cc6a05e..bd1b7b1 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 _0xb973=['What_Id','Full_Name','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Answered','Rejected','abandoned','timeout','Call_Start_Time','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','string','type','idField','content','toString','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','seconds','catch','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','data','details','startCase','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Who_Id','First_Name','Last_Name'];(function(_0x13ceed,_0xecda6a){var _0x545d11=function(_0x3f40a0){while(--_0x3f40a0){_0x13ceed['push'](_0x13ceed['shift']());}};_0x545d11(++_0xecda6a);}(_0xb973,0xc9));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b97('0x0'));var rp=require('request-promise');var md5=require(_0x3b97('0x1'));var util=require(_0x3b97('0x2'));var intUtil=require('./util');var moment=require(_0x3b97('0x3'));var Redis=require(_0x3b97('0x4'));var BPromise=require(_0x3b97('0x5'));var config=require(_0x3b97('0x6'));var logger=require(_0x3b97('0x7'))(_0x3b97('0x8'));config[_0x3b97('0x9')]=_[_0x3b97('0xa')](config['redis'],{'host':_0x3b97('0xb'),'port':0x18eb});var io=require(_0x3b97('0xc'))(new Redis(config[_0x3b97('0x9')]));function emit(_0x7e23b8,_0x27e67f,_0x10824d){io['to'](_0x7e23b8)[_0x3b97('0xd')](_0x27e67f,_0x10824d);}function request(_0x3d70e9){logger[_0x3b97('0xe')](_0x3b97('0xf'),JSON[_0x3b97('0x10')](_0x3d70e9));return rp(_0x3d70e9);}function getCustomFields(_0x214cbe,_0x12a0f7){var _0x26ecd8={};if(_0x214cbe[_0x3b97('0x11')]>0x0){_['forEach'](_0x214cbe,function(_0x23d927){if(_['includes']([_0x3b97('0x12'),'picklist'],_0x23d927[_0x3b97('0x13')])&&_0x23d927[_0x3b97('0x14')]){_0x26ecd8[_0x23d927['idField']]=_0x23d927[_0x3b97('0x15')][_0x3b97('0x16')]();}else if(_0x23d927[_0x3b97('0x13')]==='variable'&&_0x23d927['variableName']&&_0x23d927[_0x3b97('0x14')]&&_0x12a0f7[_0x23d927['variableName']]){_0x26ecd8[_0x23d927[_0x3b97('0x14')]]=_0x12a0f7[_0x23d927[_0x3b97('0x17')]]['toString']();}else if(_0x23d927['type']==='customVariable'&&_0x23d927[_0x3b97('0x18')]&&_0x23d927[_0x3b97('0x18')][_0x3b97('0x19')]&&_0x23d927['idField']&&_0x12a0f7[_0x23d927[_0x3b97('0x18')][_0x3b97('0x19')][_0x3b97('0x1a')]()]){_0x26ecd8[_0x23d927[_0x3b97('0x14')]]=_0x12a0f7[_0x23d927[_0x3b97('0x18')][_0x3b97('0x19')]['toLowerCase']()]['toString']();}});}return _0x26ecd8;}function getName(_0x19b79a){if(_0x19b79a[_0x3b97('0x1b')]('\x20')>0x0){var _0x5b4646=_0x19b79a[_0x3b97('0x1c')](/ (.+)/);if(_0x5b4646[0x1]){return _0x5b4646;}}return[_0x19b79a,_0x19b79a];}var accountsTokens={};function getAccessToken(_0xe9e56b){return new Promise(function(_0x26c505,_0x5e28ce){if(!_[_0x3b97('0x1d')](accountsTokens[_0xe9e56b['id']])&&!_[_0x3b97('0x1d')](accountsTokens[_0xe9e56b['id']][_0x3b97('0x1e')])){if(moment()['isBefore'](accountsTokens[_0xe9e56b['id']][_0x3b97('0x1f')])){_0x26c505(accountsTokens[_0xe9e56b['id']][_0x3b97('0x1e')]);}}var _0x3ac890;switch(_0xe9e56b[_0x3b97('0x20')]){case'US':_0x3ac890=_0x3b97('0x21');break;case'AU':_0x3ac890='https://accounts.zoho.com.au';break;case'EU':_0x3ac890=_0x3b97('0x22');break;case'IN':_0x3ac890=_0x3b97('0x23');break;case'CN':_0x3ac890=_0x3b97('0x24');break;default:_0x3ac890=_0x3b97('0x22');break;}var _0x5377a8={'method':_0x3b97('0x25'),'uri':_0x3ac890+_0x3b97('0x26'),'qs':{'refresh_token':_0xe9e56b[_0x3b97('0x27')],'client_id':_0xe9e56b['clientId'],'client_secret':_0xe9e56b[_0x3b97('0x28')],'grant_type':_0x3b97('0x29')},'json':!![]};return rp(_0x5377a8)[_0x3b97('0x2a')](function(_0x4b7be3){accountsTokens[_0xe9e56b['id']]={'access_token':_0x4b7be3[_0x3b97('0x1e')],'expires_in':moment()[_0x3b97('0x2b')](_0x4b7be3[_0x3b97('0x1f')],_0x3b97('0x2c'))};_0x26c505(_0x4b7be3['access_token']);})[_0x3b97('0x2d')](function(_0x57fcef){logger['error']('Failing\x20creating\x20the\x20access_token',_0x57fcef[_0x3b97('0x2e')]);_0x5e28ce(_0x57fcef);});});}function getUser(_0x2b9bde,_0x47e1be,_0x258fd4,_0x4c7766){logger[_0x3b97('0x2f')](_0x3b97('0x30'));return request({'method':_0x3b97('0x31'),'uri':util[_0x3b97('0x32')](_0x3b97('0x33'),_0x47e1be),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x3b97('0x34')+_0x2b9bde},'json':!![]})[_0x3b97('0x2a')](function(_0x2a4b22){if(_0x2a4b22[_0x3b97('0x35')]){var _0x39a363=-0x1;if(_[_0x3b97('0x36')](_0x2a4b22[_0x3b97('0x35')])){if(!_[_0x3b97('0x1d')](_0x4c7766)){_0x39a363=_[_0x3b97('0x37')](_0x2a4b22[_0x3b97('0x35')],function(_0x159b51){return _0x159b51[_0x3b97('0x38')]===_0x4c7766;});}if(_0x39a363>=0x0){logger['info'](_0x3b97('0x39'));}else{logger['info'](_0x3b97('0x3a'));_0x39a363=_[_0x3b97('0x37')](_0x2a4b22['users'],function(_0x9f5d42){return _0x9f5d42['profile'][_0x3b97('0x19')]===_0x3b97('0x3b');});}return _0x2a4b22[_0x3b97('0x35')][_0x39a363];}else{if(_0x2a4b22[_0x3b97('0x3c')][_0x3b97('0x3d')][_0x3b97('0x19')]===_0x3b97('0x3b')){logger[_0x3b97('0x2f')](_0x3b97('0x3a'));user=_0x2a4b22['user'];return user;}else{logger[_0x3b97('0x3e')](_0x3b97('0x3f'),JSON[_0x3b97('0x10')](_0x2a4b22));throw new Error(_0x3b97('0x40')+JSON[_0x3b97('0x10')](_0x2a4b22));}}}else{logger['error'](_0x3b97('0x3f'),JSON['stringify'](_0x2a4b22));throw new Error(_0x3b97('0x40')+JSON[_0x3b97('0x10')](_0x2a4b22));}})['catch'](function(_0x35f0c0){console[_0x3b97('0x3e')](_0x35f0c0);});}function getZohoUser(_0x144ccb,_0x50781f){return new BPromise(function(_0x1139cf,_0x32bbb5){request(_0x144ccb)['then'](function(_0x1e47ba){var _0x5c61a8=null;if(_0x1e47ba){_0x5c61a8=_0x1e47ba['data'][0x0];_0x5c61a8[_0x3b97('0x41')]=_0x50781f;}_0x1139cf(_0x5c61a8);})['catch'](function(_0x4891dd){_0x32bbb5(_0x4891dd);});});}function createEndUser(_0x21f6cf,_0x316678,_0x31bfc8,_0x4a4478,_0x30c9c1,_0x3325c5){var _0x31bfc8=getName(_0x31bfc8);return request({'method':_0x3b97('0x25'),'uri':_0x3b97('0x42')+_0x316678+_0x3b97('0x43')+_['startCase'](_0x3325c5[_0x3b97('0x44')])+'s','body':{'data':[{'Last_Name':_0x31bfc8[0x1],'First_Name':_0x31bfc8[0x0],'Phone':_0x4a4478,'Owner':{'name':!_[_0x3b97('0x1d')](_0x30c9c1[_0x3b97('0x45')][_0x3b97('0x19')])?_0x30c9c1[_0x3b97('0x45')][_0x3b97('0x19')]:!_[_0x3b97('0x1d')](_0x30c9c1[_0x3b97('0x46')])?_0x30c9c1[_0x3b97('0x46')]+'\x20'+_0x30c9c1[_0x3b97('0x47')]:_0x30c9c1[_0x3b97('0x47')],'id':_0x30c9c1['id']}}]},'headers':{'Authorization':_0x3b97('0x34')+_0x21f6cf},'json':!![]})[_0x3b97('0x2a')](function(_0x1bf0ce){if(_0x1bf0ce&&_0x1bf0ce['data'][0x0][_0x3b97('0x48')]===_0x3b97('0x49')){var _0x5d7fa=_0x1bf0ce[_0x3b97('0x4a')][0x0][_0x3b97('0x4b')];_0x5d7fa[_0x3b97('0x41')]=_[_0x3b97('0x4c')](_0x3325c5[_0x3b97('0x44')])+'s';return _0x5d7fa;}logger[_0x3b97('0x3e')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x3b97('0x2d')](function(_0x2a3b1c){console[_0x3b97('0x4d')](_0x3b97('0x4e'),_0x2a3b1c);});}function getEndUser(_0x335efb,_0x3f3363,_0x837214,_0x47c15a,_0x16820a,_0x2ca77c,_0x4990a7){var _0x5efa9f={'method':_0x3b97('0x31'),'uri':'','headers':{'Authorization':_0x3b97('0x34')+_0x335efb},'json':!![]};switch(_0x4990a7[_0x3b97('0x4f')]){case _0x3b97('0x50'):_0x5efa9f[_0x3b97('0x51')]='https://www.zohoapis.'+_0x3f3363+_0x3b97('0x52')+_0x16820a+'))';return getZohoUser(_0x5efa9f,_0x3b97('0x53'))[_0x3b97('0x2a')](function(_0x367a8b){if(_0x367a8b)return _0x367a8b;_0x5efa9f[_0x3b97('0x51')]=_0x3b97('0x42')+_0x3f3363+_0x3b97('0x54')+_0x16820a+'))';return getZohoUser(_0x5efa9f,_0x3b97('0x55'))['then'](function(_0x2c643c){if(_0x2c643c)return _0x2c643c;if(_0x4990a7[_0x3b97('0x44')]!=_0x3b97('0x56')){return createEndUser(_0x335efb,_0x3f3363,_0x47c15a,_0x16820a,_0x2ca77c,_0x4990a7);}else{return{};}});});break;case _0x3b97('0x57'):_0x5efa9f[_0x3b97('0x51')]=_0x3b97('0x42')+_0x3f3363+_0x3b97('0x52')+_0x16820a+'))';return getZohoUser(_0x5efa9f,_0x3b97('0x53'))[_0x3b97('0x2a')](function(_0x10c69c){if(_0x10c69c)return _0x10c69c;if(_0x4990a7[_0x3b97('0x44')]!=_0x3b97('0x56')){return createEndUser(_0x335efb,_0x3f3363,_0x47c15a,_0x16820a,_0x2ca77c,_0x4990a7);}else{return{};}});break;case _0x3b97('0x58'):_0x5efa9f[_0x3b97('0x51')]=_0x3b97('0x42')+_0x3f3363+_0x3b97('0x54')+_0x16820a+'))';return getZohoUser(_0x5efa9f,_0x3b97('0x55'))[_0x3b97('0x2a')](function(_0x1db3de){if(_0x1db3de)return _0x1db3de;if(_0x4990a7[_0x3b97('0x44')]!=_0x3b97('0x56')){return createEndUser(_0x335efb,_0x3f3363,_0x47c15a,_0x16820a,_0x2ca77c,_0x4990a7);}else{return{};}});break;}}function getCall(_0x59086e,_0x3c9e3e,_0x2551e0,_0x37654d,_0x559325,_0x4ef6a1,_0x2dd5fa,_0x4af59c){logger[_0x3b97('0x2f')](_0x3b97('0x59'));var _0x71fc4e={};_0x71fc4e[_0x3b97('0x5a')]={'name':!_[_0x3b97('0x1d')](_0x37654d[_0x3b97('0x45')]['name'])&&!_[_0x3b97('0x1d')](_0x37654d['profile'][_0x3b97('0x19')])&&_0x37654d[_0x3b97('0x3d')][_0x3b97('0x19')]===_0x3b97('0x5b')?_0x37654d[_0x3b97('0x45')][_0x3b97('0x19')]:!_[_0x3b97('0x1d')](_0x37654d[_0x3b97('0x46')])?_0x37654d[_0x3b97('0x46')]+'\x20'+_0x37654d[_0x3b97('0x47')]:_0x37654d[_0x3b97('0x47')],'id':_0x37654d['id']};_0x71fc4e[_0x3b97('0x5c')]=intUtil[_0x3b97('0x5d')](_0x4ef6a1['Subjects'],_0x2dd5fa,'\x20');_0x71fc4e['Description']=intUtil['getString'](_0x4ef6a1['Descriptions'],_0x2dd5fa,'\x0a');if(_0x559325[_0x3b97('0x41')]===_0x3b97('0x53')){_0x71fc4e[_0x3b97('0x5e')]={'name':!_['isNil'](_0x559325['Full_Name'])?_0x559325['Full_Name']:!_[_0x3b97('0x1d')](_0x559325[_0x3b97('0x5f')])?_0x559325[_0x3b97('0x5f')]+'\x20'+_0x559325[_0x3b97('0x60')]:_0x559325[_0x3b97('0x60')],'id':_0x559325['id']};}if(_0x559325[_0x3b97('0x41')]==='Leads'){_0x71fc4e[_0x3b97('0x61')]={'name':!_[_0x3b97('0x1d')](_0x559325[_0x3b97('0x62')])?_0x559325[_0x3b97('0x62')]:!_['isNil'](_0x559325[_0x3b97('0x5f')])?_0x559325['First_Name']+'\x20'+_0x559325[_0x3b97('0x60')]:_0x559325[_0x3b97('0x60')],'id':_0x559325['id']};_0x71fc4e['$se_module']=_[_0x3b97('0x4c')](_0x559325['enduserType']);}if(_0x2dd5fa[_0x3b97('0x63')]){_0x71fc4e[_0x3b97('0x64')]=moment[_0x3b97('0x65')](parseInt(_0x2dd5fa['talktime'])*0x3e8)['format'](_0x3b97('0x66'));}else if(_0x2dd5fa['answertime']&&_0x2dd5fa[_0x3b97('0x67')]){_0x71fc4e[_0x3b97('0x64')]=moment[_0x3b97('0x65')](moment(_0x2dd5fa[_0x3b97('0x67')],_0x3b97('0x68'))[_0x3b97('0x69')](moment(_0x2dd5fa[_0x3b97('0x6a')],_0x3b97('0x68'))))[_0x3b97('0x32')](_0x3b97('0x66'));}switch(_0x2dd5fa['lastevent']){case _0x3b97('0x6b'):_0x71fc4e[_0x3b97('0x6c')]='Called';break;case'complete':case'connect':_0x71fc4e[_0x3b97('0x6c')]=_0x3b97('0x6d');break;case'rejected':_0x71fc4e[_0x3b97('0x6c')]=_0x3b97('0x6e');break;case _0x3b97('0x6f'):_0x71fc4e[_0x3b97('0x6c')]='Abandoned';break;case _0x3b97('0x70'):_0x71fc4e[_0x3b97('0x6c')]='Timeout';default:}_0x71fc4e[_0x3b97('0x71')]=(_0x4af59c==='outbound'?moment(_0x2dd5fa['starttime'])[_0x3b97('0x32')](_0x3b97('0x68')):moment(_0x2dd5fa['agentcalledAt'])[_0x3b97('0x32')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3b97('0x32')]('YYYY-MM-DDTHH:mm:ss');_0x71fc4e['Call_Type']=_0x4af59c||_0x3b97('0x72');_0x71fc4e=_[_0x3b97('0x73')](_0x71fc4e,getCustomFields(_0x4ef6a1[_0x3b97('0x74')],_0x2dd5fa));return request({'method':_0x3b97('0x25'),'uri':_0x3b97('0x42')+_0x3c9e3e+_0x3b97('0x75'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x59086e},'body':{'data':[_0x71fc4e]},'json':!![]})[_0x3b97('0x2a')](function(_0x1cf91a){if(_0x1cf91a&&_0x1cf91a[_0x3b97('0x4a')][0x0][_0x3b97('0x48')]===_0x3b97('0x49')){logger[_0x3b97('0x2f')](_0x3b97('0x76'));return{'id':_0x1cf91a[_0x3b97('0x4a')][0x0][_0x3b97('0x4b')]['id']};}})['catch'](function(_0x4f4f1a){logger[_0x3b97('0x2f')](_0x3b97('0x77'),_0x4f4f1a['stack']);console['log'](_0x3b97('0x77'),_0x4f4f1a);});}exports[_0x3b97('0x78')]=function(_0x115d6c,_0x6d1345,_0x181029,_0x2d901b,_0x547c09,_0x2cfdd5){var _0x10b1be,_0xa33552,_0x333612;_0x2cfdd5[_0x3b97('0x79')]=intUtil[_0x3b97('0x7a')](_0x2cfdd5[_0x3b97('0x79')]);_0x2cfdd5[_0x3b97('0x7b')]=intUtil[_0x3b97('0x7a')](_0x2cfdd5[_0x3b97('0x7b')]);if(_0x547c09&&_0x547c09[_0x3b97('0x7c')]){logger[_0x3b97('0x2f')](_0x3b97('0x7d'),_0x3b97('0x7e'));_0x6d1345[_0x3b97('0x7f')]=_0x2cfdd5[_0x3b97('0x7b')]+_0x3b97('0x80')+_0x6d1345['uniqueid']+_0x3b97('0x81')+md5(_0x6d1345[_0x3b97('0x82')]);}else{_0x6d1345[_0x3b97('0x7f')]='';}var _0x1db9c1=_0x2cfdd5[_0x3b97('0x79')]==='zoho.eu'?'eu':_0x3b97('0x83');return getAccessToken(_0x2cfdd5)[_0x3b97('0x2a')](function(_0x263a84){_0x333612=_0x263a84;return getUser(_0x333612,_0x1db9c1,_0x2cfdd5,_0x2d901b[_0x3b97('0x38')]);})[_0x3b97('0x2a')](function(_0x5d5f6e){_0x10b1be=_0x5d5f6e;logger[_0x3b97('0x2f')](_0x3b97('0x84'),_0x10b1be['id']);return getEndUser(_0x333612,_0x1db9c1,_0x2cfdd5,_0x6d1345[_0x3b97('0x85')],_0x6d1345['calleridnum'],_0x10b1be,_0x181029);})[_0x3b97('0x2a')](function(_0x2fe5be){_0xa33552=_0x2fe5be;return getCall(_0x333612,_0x1db9c1,_0x2cfdd5,_0x10b1be,_0xa33552,_0x181029,_0x6d1345,_0x3b97('0x72'));})[_0x3b97('0x2a')](function(_0x451b33){if(_0x451b33){logger[_0x3b97('0x2f')](_0x3b97('0x86'),_0x451b33['id']);logger[_0x3b97('0x2f')](_0x3b97('0x7d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3b97('0x87'),_0x2d901b['name']),_0x3b97('0x88'),{'uri':_0x3b97('0x89')+_0x2cfdd5[_0x3b97('0x79')]+'/crm/EntityInfo.do?module=Calls&id='+_0x451b33['id']});}})[_0x3b97('0x2d')](function(_0x31b6a4){logger[_0x3b97('0x3e')]('[QUEUE]',JSON[_0x3b97('0x10')](_0x31b6a4));});};exports['outbound']=function(_0xb4760,_0x3faa7e,_0x44cdc5,_0x3a403d,_0x24c771,_0x2fe97e,_0x5bd8e4){var _0x1adaac,_0x400cc1,_0x9223d1;_0x2fe97e['host']=intUtil[_0x3b97('0x7a')](_0x2fe97e['host']);_0x2fe97e[_0x3b97('0x7b')]=intUtil[_0x3b97('0x7a')](_0x2fe97e[_0x3b97('0x7b')]);if(_0x5bd8e4&&_0x5bd8e4[_0x3b97('0x8a')]&&_0x5bd8e4[_0x3b97('0x8a')]!==_0x3b97('0x8b')){logger['info'](_0x3b97('0x8c'),_0x3b97('0x7e'));_0x3faa7e[_0x3b97('0x7f')]=_0x2fe97e['serverUrl']+_0x3b97('0x80')+_0x3faa7e[_0x3b97('0x82')]+_0x3b97('0x81')+md5(_0x3faa7e[_0x3b97('0x82')]);}var _0x28eb3d=_0x2fe97e[_0x3b97('0x79')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x2fe97e)[_0x3b97('0x2a')](function(_0x388e4b){_0x9223d1=_0x388e4b;return getUser(_0x9223d1,_0x28eb3d,_0x2fe97e,_0x3a403d[_0x3b97('0x38')]);})['then'](function(_0x483d6c){_0x1adaac=_0x483d6c;logger['info'](_0x3b97('0x84'),_0x1adaac['id']);return getEndUser(_0x9223d1,_0x28eb3d,_0x2fe97e,_0x3faa7e[_0x3b97('0x8d')],_0x3faa7e[_0x3b97('0x8e')],_0x1adaac,_0x44cdc5);})['then'](function(_0x53c898){_0x400cc1=_0x53c898;return getCall(_0x9223d1,_0x28eb3d,_0x2fe97e,_0x1adaac,_0x400cc1,_0x44cdc5,_0x3faa7e,_0x3b97('0x8f'));})['then'](function(_0xa29cb5){if(_0xa29cb5){logger['info'](_0x3b97('0x86'),_0xa29cb5['id']);logger[_0x3b97('0x2f')](_0x3b97('0x8c'),_0x3b97('0x90'));emit(util['format'](_0x3b97('0x87'),_0x3a403d[_0x3b97('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x2fe97e[_0x3b97('0x79')]+_0x3b97('0x91')+_0xa29cb5['id']});}})[_0x3b97('0x2d')](function(_0x1170e5){logger['error'](_0x3b97('0x8c'),JSON[_0x3b97('0x10')](_0x1170e5));});};exports[_0x3b97('0x92')]=function(_0x252405,_0x2de9bb,_0x8c92bc,_0x2de1b4,_0x268d94,_0xd26c3e){var _0x7c2758,_0x4a8fae,_0x4c9b80;_0xd26c3e['host']=intUtil['stripTrailingSlash'](_0xd26c3e[_0x3b97('0x79')]);_0xd26c3e[_0x3b97('0x7b')]=intUtil['stripTrailingSlash'](_0xd26c3e[_0x3b97('0x7b')]);if(_0x268d94&&_0x268d94[_0x3b97('0x7c')]){logger[_0x3b97('0x2f')]('['+_0x2de9bb[_0x3b97('0x93')][_0x3b97('0x94')]()+']',_0x3b97('0x7e'));_0x2de9bb[_0x3b97('0x7f')]=_0xd26c3e[_0x3b97('0x7b')]+_0x3b97('0x80')+_0x2de9bb[_0x3b97('0x82')]+_0x3b97('0x81')+md5(_0x2de9bb[_0x3b97('0x82')]);}else{_0x2de9bb['recordingURL']='';}var _0x57bee3=_0xd26c3e['host']==='zoho.eu'?'eu':_0x3b97('0x83');return getAccessToken(_0xd26c3e)['then'](function(_0x343e14){_0x4c9b80=_0x343e14;return getUser(_0x4c9b80,_0x57bee3,_0xd26c3e);})[_0x3b97('0x2a')](function(_0x12b21c){_0x7c2758=_0x12b21c;logger[_0x3b97('0x2f')](_0x3b97('0x84'),_0x7c2758['id']);return getEndUser(_0x4c9b80,_0x57bee3,_0xd26c3e,_0x2de9bb[_0x3b97('0x85')],_0x2de9bb['calleridnum'],_0x7c2758,_0x8c92bc);})['then'](function(_0x13f6ce){_0x4a8fae=_0x13f6ce;return getCall(_0x4c9b80,_0x57bee3,_0xd26c3e,_0x7c2758,_0x4a8fae,_0x8c92bc,_0x2de9bb,_0x3b97('0x72'));})[_0x3b97('0x2a')](function(_0x1d4125){if(_0x1d4125){logger[_0x3b97('0x2f')](_0x3b97('0x86'),_0x1d4125['id']);}})[_0x3b97('0x2d')](function(_0x1d3824){logger[_0x3b97('0x3e')]('['+_0x2de9bb['lastevent'][_0x3b97('0x94')]()+']',JSON['stringify'](_0x1d3824));});}; \ No newline at end of file +var _0x71a6=['calleridnum','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','toUpperCase','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','forEach','includes','string','picklist','type','idField','content','toString','variableName','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','Error:\x20','log','CREATE\x20ERROR','moduleSearch','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','uri','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname'];(function(_0x1013d8,_0x442794){var _0x37ac70=function(_0x1dfe3a){while(--_0x1dfe3a){_0x1013d8['push'](_0x1013d8['shift']());}};_0x37ac70(++_0x442794);}(_0x71a6,0xa8));var _0x671a=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0x71a6[_0x5517c0];return _0x33803b;};'use strict';var _=require(_0x671a('0x0'));var rp=require(_0x671a('0x1'));var md5=require(_0x671a('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0x671a('0x3'));var Redis=require(_0x671a('0x4'));var BPromise=require(_0x671a('0x5'));var config=require(_0x671a('0x6'));var logger=require('../../../../config/logger')(_0x671a('0x7'));config[_0x671a('0x8')]=_[_0x671a('0x9')](config[_0x671a('0x8')],{'host':_0x671a('0xa'),'port':0x18eb});var io=require(_0x671a('0xb'))(new Redis(config['redis']));function emit(_0x220908,_0x3806b2,_0x373173){io['to'](_0x220908)[_0x671a('0xc')](_0x3806b2,_0x373173);}function request(_0x290cf0){logger[_0x671a('0xd')]('[HTTP]',JSON[_0x671a('0xe')](_0x290cf0));return rp(_0x290cf0);}function getCustomFields(_0x51c419,_0x2824c0){var _0x5c09d7={};if(_0x51c419['length']>0x0){_[_0x671a('0xf')](_0x51c419,function(_0x39e54d){if(_[_0x671a('0x10')]([_0x671a('0x11'),_0x671a('0x12')],_0x39e54d[_0x671a('0x13')])&&_0x39e54d[_0x671a('0x14')]){_0x5c09d7[_0x39e54d['idField']]=_0x39e54d[_0x671a('0x15')][_0x671a('0x16')]();}else if(_0x39e54d['type']==='variable'&&_0x39e54d[_0x671a('0x17')]&&_0x39e54d[_0x671a('0x14')]&&_0x2824c0[_0x39e54d[_0x671a('0x17')]]){_0x5c09d7[_0x39e54d['idField']]=_0x2824c0[_0x39e54d[_0x671a('0x17')]][_0x671a('0x16')]();}else if(_0x39e54d[_0x671a('0x13')]==='customVariable'&&_0x39e54d['Variable']&&_0x39e54d[_0x671a('0x18')][_0x671a('0x19')]&&_0x39e54d[_0x671a('0x14')]&&_0x2824c0[_0x39e54d[_0x671a('0x18')][_0x671a('0x19')][_0x671a('0x1a')]()]){_0x5c09d7[_0x39e54d[_0x671a('0x14')]]=_0x2824c0[_0x39e54d['Variable'][_0x671a('0x19')]['toLowerCase']()][_0x671a('0x16')]();}});}return _0x5c09d7;}function getName(_0x27c9a3){if(_0x27c9a3[_0x671a('0x1b')]('\x20')>0x0){var _0x227217=_0x27c9a3['split'](/ (.+)/);if(_0x227217[0x1]){return _0x227217;}}return[_0x27c9a3,_0x27c9a3];}var accountsTokens={};function getAccessToken(_0x579d95){return new Promise(function(_0xff6354,_0x22526b){if(!_[_0x671a('0x1c')](accountsTokens[_0x579d95['id']])&&!_[_0x671a('0x1c')](accountsTokens[_0x579d95['id']][_0x671a('0x1d')])){if(moment()[_0x671a('0x1e')](accountsTokens[_0x579d95['id']][_0x671a('0x1f')])){_0xff6354(accountsTokens[_0x579d95['id']][_0x671a('0x1d')]);}}var _0x5882c9;switch(_0x579d95[_0x671a('0x20')]){case'US':_0x5882c9='https://accounts.zoho.com';break;case'AU':_0x5882c9=_0x671a('0x21');break;case'EU':_0x5882c9='https://accounts.zoho.eu';break;case'IN':_0x5882c9=_0x671a('0x22');break;case'CN':_0x5882c9=_0x671a('0x23');break;default:_0x5882c9=_0x671a('0x24');break;}var _0x3ae442={'method':'POST','uri':_0x5882c9+_0x671a('0x25'),'qs':{'refresh_token':_0x579d95['refreshToken'],'client_id':_0x579d95[_0x671a('0x26')],'client_secret':_0x579d95['clientSecret'],'grant_type':_0x671a('0x27')},'json':!![]};return rp(_0x3ae442)[_0x671a('0x28')](function(_0x2e6778){accountsTokens[_0x579d95['id']]={'access_token':_0x2e6778[_0x671a('0x1d')],'expires_in':moment()[_0x671a('0x29')](_0x2e6778[_0x671a('0x1f')],_0x671a('0x2a'))};_0xff6354(_0x2e6778[_0x671a('0x1d')]);})[_0x671a('0x2b')](function(_0x3f5871){logger[_0x671a('0x2c')](_0x671a('0x2d'),_0x3f5871[_0x671a('0x2e')]);_0x22526b(_0x3f5871);});});}function getUser(_0x33ff84,_0x4c7bea,_0x100934,_0x3564d4){logger[_0x671a('0x2f')](_0x671a('0x30'));return request({'method':_0x671a('0x31'),'uri':util[_0x671a('0x32')](_0x671a('0x33'),_0x4c7bea),'qs':{'type':_0x671a('0x34')},'headers':{'Authorization':_0x671a('0x35')+_0x33ff84},'json':!![]})['then'](function(_0x99842f){if(_0x99842f[_0x671a('0x36')]){var _0x57706b=-0x1;if(_[_0x671a('0x37')](_0x99842f[_0x671a('0x36')])){if(!_[_0x671a('0x1c')](_0x3564d4)){_0x57706b=_[_0x671a('0x38')](_0x99842f['users'],function(_0x543ff9){return _0x543ff9[_0x671a('0x39')]===_0x3564d4;});}if(_0x57706b>=0x0){logger[_0x671a('0x2f')](_0x671a('0x3a'));}else{logger[_0x671a('0x2f')](_0x671a('0x3b'));_0x57706b=_['findIndex'](_0x99842f[_0x671a('0x36')],function(_0x3e1f59){return _0x3e1f59[_0x671a('0x3c')][_0x671a('0x19')]===_0x671a('0x3d');});}return _0x99842f[_0x671a('0x36')][_0x57706b];}else{if(_0x99842f['user']['profile']['name']===_0x671a('0x3d')){logger[_0x671a('0x2f')](_0x671a('0x3b'));user=_0x99842f['user'];return user;}else{logger['error'](_0x671a('0x3e'),JSON[_0x671a('0xe')](_0x99842f));throw new Error(_0x671a('0x3f')+JSON[_0x671a('0xe')](_0x99842f));}}}else{logger[_0x671a('0x2c')](_0x671a('0x3e'),JSON[_0x671a('0xe')](_0x99842f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x671a('0xe')](_0x99842f));}})['catch'](function(_0x2ac70f){console[_0x671a('0x2c')](_0x2ac70f);});}function getZohoUser(_0x32035d,_0x10091f){return new BPromise(function(_0x1cecb0,_0x44d4c5){request(_0x32035d)[_0x671a('0x28')](function(_0x4fb393){var _0x378e7e=null;if(_0x4fb393){_0x378e7e=_0x4fb393['data'][0x0];_0x378e7e[_0x671a('0x40')]=_0x10091f;}_0x1cecb0(_0x378e7e);})[_0x671a('0x2b')](function(_0x5cd6fc){_0x44d4c5(_0x5cd6fc);});});}function createEndUser(_0xd1f2fd,_0x207f99,_0x5a4e67,_0x502d02,_0x520dbc,_0x141a28){var _0x5a4e67=getName(_0x5a4e67);return request({'method':_0x671a('0x41'),'uri':'https://www.zohoapis.'+_0x207f99+'/crm/v2/'+_[_0x671a('0x42')](_0x141a28[_0x671a('0x43')])+'s','body':{'data':[{'Last_Name':_0x5a4e67[0x1],'First_Name':_0x5a4e67[0x0],'Phone':_0x502d02,'Owner':{'name':!_[_0x671a('0x1c')](_0x520dbc[_0x671a('0x44')][_0x671a('0x19')])?_0x520dbc['role'][_0x671a('0x19')]:!_['isNil'](_0x520dbc[_0x671a('0x45')])?_0x520dbc[_0x671a('0x45')]+'\x20'+_0x520dbc[_0x671a('0x46')]:_0x520dbc[_0x671a('0x46')],'id':_0x520dbc['id']}}]},'headers':{'Authorization':_0x671a('0x35')+_0xd1f2fd},'json':!![]})[_0x671a('0x28')](function(_0x4680f3){if(_0x4680f3&&_0x4680f3[_0x671a('0x47')][0x0][_0x671a('0x48')]===_0x671a('0x49')){var _0x32c4fe=_0x4680f3[_0x671a('0x47')][0x0]['details'];_0x32c4fe[_0x671a('0x40')]=_[_0x671a('0x42')](_0x141a28[_0x671a('0x43')])+'s';return _0x32c4fe;}logger['error'](_0x671a('0x3e'),JSON['stringify'](data));throw new Error(_0x671a('0x4a')+JSON[_0x671a('0xe')](data));})[_0x671a('0x2b')](function(_0x2b7c56){console[_0x671a('0x4b')](_0x671a('0x4c'),_0x2b7c56);});}function getEndUser(_0x2b0ff9,_0x243a20,_0x49212f,_0x527307,_0x2ccab8,_0x35bb62,_0xfa2184){var _0x86f3b0={'method':_0x671a('0x31'),'uri':'','headers':{'Authorization':_0x671a('0x35')+_0x2b0ff9},'json':!![]};switch(_0xfa2184[_0x671a('0x4d')]){case'contact_lead':_0x86f3b0['uri']=_0x671a('0x4e')+_0x243a20+_0x671a('0x4f')+_0x2ccab8+'))';return getZohoUser(_0x86f3b0,_0x671a('0x50'))[_0x671a('0x28')](function(_0x41aa85){if(_0x41aa85)return _0x41aa85;_0x86f3b0['uri']=_0x671a('0x4e')+_0x243a20+_0x671a('0x51')+_0x2ccab8+'))';return getZohoUser(_0x86f3b0,_0x671a('0x52'))['then'](function(_0x35a9f0){if(_0x35a9f0)return _0x35a9f0;if(_0xfa2184[_0x671a('0x43')]!=_0x671a('0x53')){return createEndUser(_0x2b0ff9,_0x243a20,_0x527307,_0x2ccab8,_0x35bb62,_0xfa2184);}else{return{};}});});break;case'contact':_0x86f3b0[_0x671a('0x54')]=_0x671a('0x4e')+_0x243a20+_0x671a('0x4f')+_0x2ccab8+'))';return getZohoUser(_0x86f3b0,_0x671a('0x50'))[_0x671a('0x28')](function(_0x3c7d6a){if(_0x3c7d6a)return _0x3c7d6a;if(_0xfa2184[_0x671a('0x43')]!=_0x671a('0x53')){return createEndUser(_0x2b0ff9,_0x243a20,_0x527307,_0x2ccab8,_0x35bb62,_0xfa2184);}else{return{};}});break;case'lead':_0x86f3b0[_0x671a('0x54')]=_0x671a('0x4e')+_0x243a20+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ccab8+'))';return getZohoUser(_0x86f3b0,_0x671a('0x52'))['then'](function(_0x4f179c){if(_0x4f179c)return _0x4f179c;if(_0xfa2184[_0x671a('0x43')]!='nothing'){return createEndUser(_0x2b0ff9,_0x243a20,_0x527307,_0x2ccab8,_0x35bb62,_0xfa2184);}else{return{};}});break;}}function getCall(_0x4bb385,_0x3a955f,_0x13fa71,_0x265a09,_0xf2b40e,_0x15e427,_0xc21dd8,_0x1fda93){logger['info'](_0x671a('0x55'));var _0x472e99={};_0x472e99[_0x671a('0x56')]={'name':!_[_0x671a('0x1c')](_0x265a09[_0x671a('0x44')][_0x671a('0x19')])&&!_[_0x671a('0x1c')](_0x265a09[_0x671a('0x3c')][_0x671a('0x19')])&&_0x265a09['profile'][_0x671a('0x19')]===_0x671a('0x57')?_0x265a09[_0x671a('0x44')]['name']:!_[_0x671a('0x1c')](_0x265a09[_0x671a('0x45')])?_0x265a09[_0x671a('0x45')]+'\x20'+_0x265a09[_0x671a('0x46')]:_0x265a09[_0x671a('0x46')],'id':_0x265a09['id']};_0x472e99[_0x671a('0x58')]=intUtil[_0x671a('0x59')](_0x15e427[_0x671a('0x5a')],_0xc21dd8,'\x20');_0x472e99[_0x671a('0x5b')]=intUtil[_0x671a('0x59')](_0x15e427[_0x671a('0x5c')],_0xc21dd8,'\x0a');if(_0xf2b40e[_0x671a('0x40')]===_0x671a('0x50')){_0x472e99[_0x671a('0x5d')]={'name':!_[_0x671a('0x1c')](_0xf2b40e['Full_Name'])?_0xf2b40e[_0x671a('0x5e')]:!_[_0x671a('0x1c')](_0xf2b40e[_0x671a('0x5f')])?_0xf2b40e[_0x671a('0x5f')]+'\x20'+_0xf2b40e[_0x671a('0x60')]:_0xf2b40e[_0x671a('0x60')],'id':_0xf2b40e['id']};}if(_0xf2b40e[_0x671a('0x40')]===_0x671a('0x52')){_0x472e99[_0x671a('0x61')]={'name':!_[_0x671a('0x1c')](_0xf2b40e[_0x671a('0x5e')])?_0xf2b40e[_0x671a('0x5e')]:!_[_0x671a('0x1c')](_0xf2b40e[_0x671a('0x5f')])?_0xf2b40e[_0x671a('0x5f')]+'\x20'+_0xf2b40e['Last_Name']:_0xf2b40e[_0x671a('0x60')],'id':_0xf2b40e['id']};_0x472e99[_0x671a('0x62')]=_['startCase'](_0xf2b40e['enduserType']);}if(_0xc21dd8[_0x671a('0x63')]){_0x472e99[_0x671a('0x64')]=moment[_0x671a('0x65')](parseInt(_0xc21dd8[_0x671a('0x63')])*0x3e8)[_0x671a('0x32')](_0x671a('0x66'));}else if(_0xc21dd8[_0x671a('0x67')]&&_0xc21dd8[_0x671a('0x68')]){_0x472e99[_0x671a('0x64')]=moment[_0x671a('0x65')](moment(_0xc21dd8[_0x671a('0x68')],_0x671a('0x69'))[_0x671a('0x6a')](moment(_0xc21dd8[_0x671a('0x6b')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x671a('0x66'));}switch(_0xc21dd8[_0x671a('0x6c')]){case'called':_0x472e99[_0x671a('0x6d')]=_0x671a('0x6e');break;case _0x671a('0x6f'):case _0x671a('0x70'):_0x472e99[_0x671a('0x6d')]=_0x671a('0x71');break;case _0x671a('0x72'):_0x472e99[_0x671a('0x6d')]='Rejected';break;case _0x671a('0x73'):_0x472e99[_0x671a('0x6d')]=_0x671a('0x74');break;case _0x671a('0x75'):_0x472e99['Call_Result']=_0x671a('0x76');default:}_0x472e99[_0x671a('0x77')]=(_0x1fda93===_0x671a('0x78')?moment(_0xc21dd8['starttime'])[_0x671a('0x32')](_0x671a('0x69')):moment(_0xc21dd8[_0x671a('0x79')])[_0x671a('0x32')](_0x671a('0x69')))||moment()['format'](_0x671a('0x69'));_0x472e99['Call_Type']=_0x1fda93||_0x671a('0x7a');_0x472e99=_[_0x671a('0x7b')](_0x472e99,getCustomFields(_0x15e427['Fields'],_0xc21dd8));return request({'method':_0x671a('0x41'),'uri':_0x671a('0x4e')+_0x3a955f+_0x671a('0x7c'),'headers':{'Authorization':_0x671a('0x35')+_0x4bb385},'body':{'data':[_0x472e99]},'json':!![]})[_0x671a('0x28')](function(_0x3e5342){if(_0x3e5342&&_0x3e5342[_0x671a('0x47')][0x0]['code']===_0x671a('0x49')){logger[_0x671a('0x2f')](_0x671a('0x7d'));return{'id':_0x3e5342[_0x671a('0x47')][0x0]['details']['id']};}})[_0x671a('0x2b')](function(_0x2d2bd3){logger['info']('err',_0x2d2bd3[_0x671a('0x2e')]);console['log'](_0x671a('0x7e'),_0x2d2bd3);});}exports['queue']=function(_0x5947c0,_0x3de1ce,_0xb64da7,_0x38959d,_0x59844f,_0x10524e){var _0x1072a3,_0x10b4cc,_0x7b5b8d;_0x10524e[_0x671a('0x7f')]=intUtil['stripTrailingSlash'](_0x10524e['host']);_0x10524e[_0x671a('0x80')]=intUtil['stripTrailingSlash'](_0x10524e[_0x671a('0x80')]);if(_0x59844f&&_0x59844f[_0x671a('0x81')]){logger[_0x671a('0x2f')](_0x671a('0x82'),_0x671a('0x83'));_0x3de1ce[_0x671a('0x84')]=_0x10524e[_0x671a('0x80')]+_0x671a('0x85')+_0x3de1ce[_0x671a('0x86')]+_0x671a('0x87')+md5(_0x3de1ce[_0x671a('0x86')]);}else{_0x3de1ce[_0x671a('0x84')]='';}var _0xd5b7d6=_0x10524e[_0x671a('0x7f')]===_0x671a('0x88')?'eu':_0x671a('0x89');return getAccessToken(_0x10524e)[_0x671a('0x28')](function(_0x12077a){_0x7b5b8d=_0x12077a;return getUser(_0x7b5b8d,_0xd5b7d6,_0x10524e,_0x38959d[_0x671a('0x39')]);})['then'](function(_0x2e4752){_0x1072a3=_0x2e4752;logger[_0x671a('0x2f')](_0x671a('0x8a'),_0x1072a3['id']);return getEndUser(_0x7b5b8d,_0xd5b7d6,_0x10524e,_0x3de1ce[_0x671a('0x8b')],_0x3de1ce[_0x671a('0x8c')],_0x1072a3,_0xb64da7);})['then'](function(_0x4fd883){_0x10b4cc=_0x4fd883;return getCall(_0x7b5b8d,_0xd5b7d6,_0x10524e,_0x1072a3,_0x10b4cc,_0xb64da7,_0x3de1ce,'Inbound');})[_0x671a('0x28')](function(_0x56f938){if(_0x56f938){logger[_0x671a('0x2f')]('The\x20Call\x20ID\x20is:',_0x56f938['id']);logger['info'](_0x671a('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x671a('0x32')](_0x671a('0x8d'),_0x38959d[_0x671a('0x19')]),'trigger:browser:url',{'uri':_0x671a('0x8e')+_0x10524e['host']+_0x671a('0x8f')+_0x56f938['id']});}})['catch'](function(_0x2a5035){logger[_0x671a('0x2c')](_0x671a('0x82'),JSON[_0x671a('0xe')](_0x2a5035));});};exports[_0x671a('0x78')]=function(_0x52d6f7,_0x2ee660,_0x5a298d,_0x2051a3,_0x93c01,_0x43525b,_0x19f83c){var _0x3288b7,_0x5e5b2c,_0x2c7115;_0x43525b[_0x671a('0x7f')]=intUtil[_0x671a('0x90')](_0x43525b[_0x671a('0x7f')]);_0x43525b[_0x671a('0x80')]=intUtil[_0x671a('0x90')](_0x43525b[_0x671a('0x80')]);if(_0x19f83c&&_0x19f83c['recordingFormat']&&_0x19f83c[_0x671a('0x91')]!=='none'){logger['info'](_0x671a('0x92'),_0x671a('0x83'));_0x2ee660[_0x671a('0x84')]=_0x43525b['serverUrl']+_0x671a('0x85')+_0x2ee660[_0x671a('0x86')]+_0x671a('0x87')+md5(_0x2ee660['uniqueid']);}var _0x1188b9=_0x43525b[_0x671a('0x7f')]===_0x671a('0x88')?'eu':_0x671a('0x89');return getAccessToken(_0x43525b)[_0x671a('0x28')](function(_0x3f2658){_0x2c7115=_0x3f2658;return getUser(_0x2c7115,_0x1188b9,_0x43525b,_0x2051a3['email']);})[_0x671a('0x28')](function(_0x2e61bc){_0x3288b7=_0x2e61bc;logger['info'](_0x671a('0x8a'),_0x3288b7['id']);return getEndUser(_0x2c7115,_0x1188b9,_0x43525b,_0x2ee660[_0x671a('0x93')],_0x2ee660['destcalleridnum'],_0x3288b7,_0x5a298d);})[_0x671a('0x28')](function(_0x126843){_0x5e5b2c=_0x126843;return getCall(_0x2c7115,_0x1188b9,_0x43525b,_0x3288b7,_0x5e5b2c,_0x5a298d,_0x2ee660,_0x671a('0x94'));})[_0x671a('0x28')](function(_0x3d4296){if(_0x3d4296){logger[_0x671a('0x2f')]('The\x20Call\x20ID\x20is:',_0x3d4296['id']);logger[_0x671a('0x2f')](_0x671a('0x92'),_0x671a('0x95'));emit(util['format'](_0x671a('0x8d'),_0x2051a3[_0x671a('0x19')]),_0x671a('0x96'),{'uri':_0x671a('0x8e')+_0x43525b[_0x671a('0x7f')]+_0x671a('0x8f')+_0x3d4296['id']});}})[_0x671a('0x2b')](function(_0x57fd1d){logger[_0x671a('0x2c')]('[OUTBOUND]',JSON[_0x671a('0xe')](_0x57fd1d));});};exports[_0x671a('0x97')]=function(_0x164ed0,_0x2b4492,_0x40d92c,_0x5bdf9a,_0x12d52d,_0x2ceebb){var _0x5e99ef,_0x2e6782,_0x193b65;_0x2ceebb['host']=intUtil[_0x671a('0x90')](_0x2ceebb['host']);_0x2ceebb[_0x671a('0x80')]=intUtil[_0x671a('0x90')](_0x2ceebb[_0x671a('0x80')]);if(_0x12d52d&&_0x12d52d[_0x671a('0x81')]){logger[_0x671a('0x2f')]('['+_0x2b4492[_0x671a('0x6c')][_0x671a('0x98')]()+']',_0x671a('0x83'));_0x2b4492[_0x671a('0x84')]=_0x2ceebb['serverUrl']+_0x671a('0x85')+_0x2b4492[_0x671a('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x2b4492[_0x671a('0x86')]);}else{_0x2b4492[_0x671a('0x84')]='';}var _0x49ee6d=_0x2ceebb['host']===_0x671a('0x88')?'eu':_0x671a('0x89');return getAccessToken(_0x2ceebb)['then'](function(_0xf81aaf){_0x193b65=_0xf81aaf;return getUser(_0x193b65,_0x49ee6d,_0x2ceebb);})[_0x671a('0x28')](function(_0x3760a3){_0x5e99ef=_0x3760a3;logger['info'](_0x671a('0x8a'),_0x5e99ef['id']);return getEndUser(_0x193b65,_0x49ee6d,_0x2ceebb,_0x2b4492[_0x671a('0x8b')],_0x2b4492[_0x671a('0x8c')],_0x5e99ef,_0x40d92c);})[_0x671a('0x28')](function(_0x1d21f1){_0x2e6782=_0x1d21f1;return getCall(_0x193b65,_0x49ee6d,_0x2ceebb,_0x5e99ef,_0x2e6782,_0x40d92c,_0x2b4492,'Inbound');})[_0x671a('0x28')](function(_0x1cc69f){if(_0x1cc69f){logger[_0x671a('0x2f')](_0x671a('0x99'),_0x1cc69f['id']);}})[_0x671a('0x2b')](function(_0x476dc8){logger[_0x671a('0x2c')]('['+_0x2b4492['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x476dc8));});}; \ 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 17afb01..d3f36f9 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 _0xd306=['mustache','../../../../config/logger','trigger','data2','render','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd306,0x96));var _0x6d30=function(_0x4978e1,_0x28aa9a){_0x4978e1=_0x4978e1-0x0;var _0x319309=_0xd306[_0x4978e1];return _0x319309;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x6d30('0x0'));var logger=require(_0x6d30('0x1'))(_0x6d30('0x2'));exports['exec']=function(_0x37f82d,_0x3065be){var _0x23af51=_0x37f82d[_0x6d30('0x3')]?_0x37f82d['data2']:'Script';var _0x4a529e=_0x37f82d['data3']?Mustache[_0x6d30('0x4')](_0x37f82d['data3'],_0x3065be):_0x3065be;sh['exec'](_0x4a529e,function(_0x5effaf,_0x329b29,_0x50cc6){if(_0x5effaf!==0x0){logger['error'](util[_0x6d30('0x5')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x23af51,_0x4a529e,_0x5effaf,_0x50cc6));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x23af51,_0x4a529e,_0x329b29));}});}; \ No newline at end of file +var _0xd7c0=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','trigger','data2','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x589f8d,_0x5ec07a){var _0x1beb18=function(_0x30c935){while(--_0x30c935){_0x589f8d['push'](_0x589f8d['shift']());}};_0x1beb18(++_0x5ec07a);}(_0xd7c0,0x139));var _0x0d7c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd7c0[_0x4b369d];return _0x571a98;};'use strict';var util=require('util');var sh=require(_0x0d7c('0x0'));var Mustache=require(_0x0d7c('0x1'));var logger=require('../../../../config/logger')(_0x0d7c('0x2'));exports['exec']=function(_0x52d1ce,_0x2a669d){var _0x93f795=_0x52d1ce[_0x0d7c('0x3')]?_0x52d1ce['data2']:'Script';var _0x171156=_0x52d1ce[_0x0d7c('0x4')]?Mustache[_0x0d7c('0x5')](_0x52d1ce[_0x0d7c('0x4')],_0x2a669d):_0x2a669d;sh[_0x0d7c('0x6')](_0x171156,function(_0x47fa56,_0x4fe564,_0x3777e6){if(_0x47fa56!==0x0){logger[_0x0d7c('0x7')](util[_0x0d7c('0x8')](_0x0d7c('0x9'),_0x93f795,_0x171156,_0x47fa56,_0x3777e6));}else{logger[_0x0d7c('0xa')](util[_0x0d7c('0x8')](_0x0d7c('0xb'),_0x93f795,_0x171156,_0x4fe564));}});}; \ 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 e3fc46b..9689f6a 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 _0xea61=['render','error','stack','toUpperCase','PUT','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','trigger','exec','data1','data5','headers','parse'];(function(_0x613fd3,_0xe7d69a){var _0x499fce=function(_0x2d72d0){while(--_0x2d72d0){_0x613fd3['push'](_0x613fd3['shift']());}};_0x499fce(++_0xe7d69a);}(_0xea61,0x104));var _0x1ea6=function(_0x1883dd,_0x15f5b6){_0x1883dd=_0x1883dd-0x0;var _0x65c0a=_0xea61[_0x1883dd];return _0x65c0a;};'use strict';var rp=require(_0x1ea6('0x0'));var util=require(_0x1ea6('0x1'));var _=require('lodash');var Mustache=require(_0x1ea6('0x2'));var logger=require(_0x1ea6('0x3'))(_0x1ea6('0x4'));exports[_0x1ea6('0x5')]=function(_0x3456db,_0x47198d){var _0x5d4ef4,_0x423c5b;var _0x456084={'method':_0x3456db[_0x1ea6('0x6')]['toUpperCase'](),'uri':Mustache['render'](_0x3456db['data2'],_0x47198d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3456db[_0x1ea6('0x7')])==='number'&&parseInt(_0x3456db[_0x1ea6('0x7')])>=0x1&&parseInt(_0x3456db['data5'])<=0xa?parseInt(_0x3456db[_0x1ea6('0x7')])*0x3e8:0x5*0x3e8};try{_0x456084[_0x1ea6('0x8')]=_0x3456db['data6']?JSON[_0x1ea6('0x9')](Mustache[_0x1ea6('0xa')](_0x3456db['data6'],_0x47198d)):{};}catch(_0x12305e){logger[_0x1ea6('0xb')](_0x12305e[_0x1ea6('0xc')]);}switch(_0x3456db[_0x1ea6('0x6')][_0x1ea6('0xd')]()){case'GET':case'DELETE':_0x5d4ef4=null;_0x456084['qs']=_0x47198d;break;case'POST':case _0x1ea6('0xe'):if(_0x3456db[_0x1ea6('0xf')]){try{_0x5d4ef4=JSON[_0x1ea6('0x9')](Mustache[_0x1ea6('0xa')](_0x3456db[_0x1ea6('0xf')],_0x47198d));_0x456084['body']=_0x5d4ef4;}catch(_0x5b63db){logger[_0x1ea6('0xb')](_0x5b63db[_0x1ea6('0xc')]);logger[_0x1ea6('0xb')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x5d4ef4=_0x47198d;_0x456084[_0x1ea6('0x10')]=_0x5d4ef4;}break;}logger[_0x1ea6('0x11')](util['format'](_0x1ea6('0x12'),_0x3456db[_0x1ea6('0x6')],_0x3456db[_0x1ea6('0x13')],JSON[_0x1ea6('0x14')](_0x456084)));rp(_0x456084)[_0x1ea6('0x15')](function(_0x37369e){_0x5d4ef4=!_[_0x1ea6('0x16')](_0x5d4ef4)?',\x20request\x20body:\x20'+_0x5d4ef4:'';_0x423c5b=typeof _0x37369e[_0x1ea6('0x10')]===_0x1ea6('0x17')?JSON[_0x1ea6('0x14')](_0x37369e['body']):_0x37369e['body'];logger['info'](util[_0x1ea6('0x18')](_0x1ea6('0x19'),_0x3456db['data1'],_0x3456db[_0x1ea6('0x13')],_0x37369e[_0x1ea6('0x1a')],_0x423c5b));})['catch'](function(_0x157ce8){logger[_0x1ea6('0xb')](util['format'](_0x1ea6('0x1b'),_0x3456db[_0x1ea6('0x6')],_0x3456db['data2'],_0x157ce8['statusCode'],_0x157ce8[_0x1ea6('0x1c')],_0x157ce8[_0x1ea6('0x1d')]));});}; \ No newline at end of file +var _0xb017=['info','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','../../../../config/logger','trigger','exec','data1','data2','data5','parse','toUpperCase','GET','DELETE','data7','render','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','object'];(function(_0x3fbba8,_0x28c96a){var _0x5342de=function(_0x3161f6){while(--_0x3161f6){_0x3fbba8['push'](_0x3fbba8['shift']());}};_0x5342de(++_0x28c96a);}(_0xb017,0x127));var _0x7b01=function(_0x2a12fc,_0x66bc1d){_0x2a12fc=_0x2a12fc-0x0;var _0x440c95=_0xb017[_0x2a12fc];return _0x440c95;};'use strict';var rp=require(_0x7b01('0x0'));var util=require(_0x7b01('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require(_0x7b01('0x2'))(_0x7b01('0x3'));exports[_0x7b01('0x4')]=function(_0x10e1ba,_0x458139){var _0x16d2a2,_0x2fc6bf;var _0x3285dd={'method':_0x10e1ba[_0x7b01('0x5')]['toUpperCase'](),'uri':Mustache['render'](_0x10e1ba[_0x7b01('0x6')],_0x458139),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x10e1ba['data5'])==='number'&&parseInt(_0x10e1ba[_0x7b01('0x7')])>=0x1&&parseInt(_0x10e1ba[_0x7b01('0x7')])<=0xa?parseInt(_0x10e1ba[_0x7b01('0x7')])*0x3e8:0x5*0x3e8};try{_0x3285dd['headers']=_0x10e1ba['data6']?JSON[_0x7b01('0x8')](Mustache['render'](_0x10e1ba['data6'],_0x458139)):{};}catch(_0x715184){logger['error'](_0x715184['stack']);}switch(_0x10e1ba[_0x7b01('0x5')][_0x7b01('0x9')]()){case _0x7b01('0xa'):case _0x7b01('0xb'):_0x16d2a2=null;_0x3285dd['qs']=_0x458139;break;case'POST':case'PUT':if(_0x10e1ba[_0x7b01('0xc')]){try{_0x16d2a2=JSON[_0x7b01('0x8')](Mustache[_0x7b01('0xd')](_0x10e1ba[_0x7b01('0xc')],_0x458139));_0x3285dd[_0x7b01('0xe')]=_0x16d2a2;}catch(_0x3e34e8){logger[_0x7b01('0xf')](_0x3e34e8[_0x7b01('0x10')]);logger[_0x7b01('0xf')](_0x7b01('0x11'));}}else{_0x16d2a2=_0x458139;_0x3285dd[_0x7b01('0xe')]=_0x16d2a2;}break;}logger['info'](util[_0x7b01('0x12')](_0x7b01('0x13'),_0x10e1ba['data1'],_0x10e1ba[_0x7b01('0x6')],JSON[_0x7b01('0x14')](_0x3285dd)));rp(_0x3285dd)[_0x7b01('0x15')](function(_0x39d2fc){_0x16d2a2=!_[_0x7b01('0x16')](_0x16d2a2)?',\x20request\x20body:\x20'+_0x16d2a2:'';_0x2fc6bf=typeof _0x39d2fc[_0x7b01('0xe')]===_0x7b01('0x17')?JSON['stringify'](_0x39d2fc['body']):_0x39d2fc[_0x7b01('0xe')];logger[_0x7b01('0x18')](util[_0x7b01('0x12')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x10e1ba['data1'],_0x10e1ba['data2'],_0x39d2fc[_0x7b01('0x19')],_0x2fc6bf));})[_0x7b01('0x1a')](function(_0x28934e){logger['error'](util[_0x7b01('0x12')](_0x7b01('0x1b'),_0x10e1ba[_0x7b01('0x5')],_0x10e1ba['data2'],_0x28934e[_0x7b01('0x19')],_0x28934e['name'],_0x28934e[_0x7b01('0x1c')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c8a5863..e2db55a 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 _0xda8d=['routing','message','result','catch','exports','jayson/promise','bluebird','client','http','Request','request','then','debug','rpc','error'];(function(_0x1f8a0c,_0x5e8443){var _0x39073b=function(_0x394753){while(--_0x394753){_0x1f8a0c['push'](_0x1f8a0c['shift']());}};_0x39073b(++_0x5e8443);}(_0xda8d,0x131));var _0xdda8=function(_0x2404ed,_0x104e4d){_0x2404ed=_0x2404ed-0x0;var _0x51b96d=_0xda8d[_0x2404ed];return _0x51b96d;};'use strict';var jayson=require(_0xdda8('0x0'));var BPromise=require(_0xdda8('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xdda8('0x2')][_0xdda8('0x3')]({'port':0x2329});client[_0xdda8('0x4')]=function(_0x2be989,_0x192c63){return new BPromise(function(_0x10696e,_0x202b97){return client[_0xdda8('0x5')](_0x2be989,_0x192c63)[_0xdda8('0x6')](function(_0x8d8748){logger[_0xdda8('0x7')](_0xdda8('0x8'),'routing',_0x2be989,_0x192c63,_0x8d8748);if(_0x8d8748[_0xdda8('0x9')]){logger[_0xdda8('0x9')]('rpc',_0xdda8('0xa'),_0x2be989,_0x8d8748[_0xdda8('0x9')][_0xdda8('0xb')],_0x192c63);return _0x202b97(_0x8d8748[_0xdda8('0x9')][_0xdda8('0xb')]);}else{return _0x10696e(_0x8d8748[_0xdda8('0xc')]);}})[_0xdda8('0xd')](function(_0xffe6fa){logger[_0xdda8('0x9')]('rpc','routing',_0x2be989,_0xffe6fa,_0x192c63);return _0x202b97(_0xffe6fa);});});};module[_0xdda8('0xe')]=client; \ No newline at end of file +var _0x9939=['catch','exports','jayson/promise','routing','client','Request','request','debug','rpc','error','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9939,0x1e2));var _0x9993=function(_0x2f355d,_0x1f0ded){_0x2f355d=_0x2f355d-0x0;var _0x351313=_0x9939[_0x2f355d];return _0x351313;};'use strict';var jayson=require(_0x9993('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x9993('0x1'));var client=jayson[_0x9993('0x2')]['http']({'port':0x2329});client[_0x9993('0x3')]=function(_0x33e268,_0x4a15eb){return new BPromise(function(_0x3738d3,_0x824d97){return client[_0x9993('0x4')](_0x33e268,_0x4a15eb)['then'](function(_0x3cbe90){logger[_0x9993('0x5')](_0x9993('0x6'),'routing',_0x33e268,_0x4a15eb,_0x3cbe90);if(_0x3cbe90[_0x9993('0x7')]){logger[_0x9993('0x7')]('rpc',_0x9993('0x1'),_0x33e268,_0x3cbe90['error'][_0x9993('0x8')],_0x4a15eb);return _0x824d97(_0x3cbe90[_0x9993('0x7')][_0x9993('0x8')]);}else{return _0x3738d3(_0x3cbe90[_0x9993('0x9')]);}})[_0x9993('0xa')](function(_0x57ea4c){logger[_0x9993('0x7')](_0x9993('0x6'),'routing',_0x33e268,_0x57ea4c,_0x4a15eb);return _0x824d97(_0x57ea4c);});});};module[_0x9993('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8aa3fc7..adb8f00 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 _0xe8b1=['./rpc/setting','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','catch','bluebird','./server','./lib/email','./rpc/mailAccount'];(function(_0xdee72,_0x309d1d){var _0x1fae39=function(_0x234c8f){while(--_0x234c8f){_0xdee72['push'](_0xdee72['shift']());}};_0x1fae39(++_0x309d1d);}(_0xe8b1,0x104));var _0x1e8b=function(_0x34e4f1,_0x57b35d){_0x34e4f1=_0x34e4f1-0x0;var _0x1a7e8e=_0xe8b1[_0x34e4f1];return _0x1a7e8e;};'use strict';var BPromise=require(_0x1e8b('0x0'));var server=require(_0x1e8b('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x1e8b('0x2'));var mailAccount=require(_0x1e8b('0x3'));var setting=require(_0x1e8b('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x1e8b('0x5')](mailAccount[_0x1e8b('0x6')]())[_0x1e8b('0x5')](realtime[_0x1e8b('0x7')]())[_0x1e8b('0x5')](function(){email[_0x1e8b('0x8')](realtime[_0x1e8b('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x1e8b('0xa')]();})[_0x1e8b('0x5')](function(_0x1c2e15){return setInterval(initRealtime,_0x1c2e15['loginMailFrequency']*0x3e8);})[_0x1e8b('0xb')](function(_0x4cd746){console['log'](_0x4cd746);});}main(); \ No newline at end of file +var _0x6560=['./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','bluebird','./realtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6560,0x7c));var _0x0656=function(_0x2395ce,_0x32ca53){_0x2395ce=_0x2395ce-0x0;var _0x4f154a=_0x6560[_0x2395ce];return _0x4f154a;};'use strict';var BPromise=require(_0x0656('0x0'));var server=require('./server');var Realtime=require(_0x0656('0x1'));var EmailChannel=require(_0x0656('0x2'));var mailAccount=require(_0x0656('0x3'));var setting=require(_0x0656('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x0656('0x5')]()[_0x0656('0x6')](mailAccount[_0x0656('0x7')]())[_0x0656('0x6')](realtime[_0x0656('0x8')]())['then'](function(){email[_0x0656('0x9')](realtime[_0x0656('0xa')]);return realtime;});}function main(){return server[_0x0656('0xb')](realtime,email)[_0x0656('0x6')](function(){return initRealtime();})[_0x0656('0x6')](function(){return setting['getSettings']();})['then'](function(_0x5c1f3d){return setInterval(initRealtime,_0x5c1f3d[_0x0656('0xc')]*0x3e8);})[_0x0656('0xd')](function(_0x3bdc75){console['log'](_0x3bdc75);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8b8a571..90b89ab 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 _0x2094=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','key','active','status','Imap','messageStatus','total','isNil','md5','emit','mailAccount:update','refresh','email','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','handleImapBox','connected','messages','lastName','then','Mail\x20accepted\x20from\x20routing','catch','stringify','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x5eee95,_0x732124){var _0x142f18=function(_0x501e75){while(--_0x501e75){_0x5eee95['push'](_0x5eee95['shift']());}};_0x142f18(++_0x732124);}(_0x2094,0x1ed));var _0x4209=function(_0x27cbc5,_0x161380){_0x27cbc5=_0x27cbc5-0x0;var _0x1d82fd=_0x2094[_0x27cbc5];return _0x1d82fd;};'use strict';var _=require(_0x4209('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x4209('0x1'));var logger=require(_0x4209('0x2'))('email');config[_0x4209('0x3')]=_[_0x4209('0x4')](config[_0x4209('0x3')],{'host':_0x4209('0x5'),'port':0x18eb});var io=require(_0x4209('0x6'))(new Redis(config[_0x4209('0x3')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x4209('0x7'));var md5Accounts={};function EmailChannel(_0x1639ab){logger[_0x4209('0x8')](_0x4209('0x9'));this[_0x4209('0xa')]=_0x1639ab['mailAccounts'];this[_0x4209('0xb')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x4209('0xc')]['emit']=function(_0x5f4a7e){var _0x15d3a2=this[_0x4209('0xa')][_0x5f4a7e];var _0x19410b={'id':_0x15d3a2['id'],'name':_0x15d3a2[_0x4209('0xd')],'key':_0x15d3a2[_0x4209('0xe')],'active':_0x15d3a2[_0x4209('0xf')],'Imap':{'status':_0x15d3a2['Imap'][_0x4209('0x10')],'messageStatus':_0x15d3a2[_0x4209('0x11')][_0x4209('0x12')],'total':_0x15d3a2['Imap'][_0x4209('0x13')]}};if(_[_0x4209('0x14')](md5Accounts[_0x5f4a7e])){md5Accounts[_0x5f4a7e]={};}var _0x1d3783=md5(JSON['stringify'](_0x19410b));if(md5Accounts[_0x5f4a7e]['md5']!==_0x1d3783){md5Accounts[_0x5f4a7e][_0x4209('0x15')]=_0x1d3783;io[_0x4209('0x16')](_0x4209('0x17'),_0x19410b);}};EmailChannel[_0x4209('0xc')][_0x4209('0x18')]=function(_0x3af923){for(var _0x3ec240 in _0x3af923){if(_0x3af923['hasOwnProperty'](_0x3ec240)){if(_0x3af923[_0x3ec240][_0x4209('0x11')]&&_0x3af923[_0x3ec240]['active']){var _0x538dc3=_0x3af923[_0x3ec240][_0x4209('0x11')];if(!this[_0x4209('0xb')]['hasOwnProperty'](_0x538dc3['id'])){this[_0x4209('0xb')][_0x538dc3['id']]=new EmailImap(_0x538dc3,_0x3af923[_0x3ec240][_0x4209('0x19')]);this[_0x4209('0xb')][_0x538dc3['id']]['on'](_0x4209('0x1a'),this['handleImapBox'][_0x4209('0x1b')](this,_0x3ec240));this[_0x4209('0xb')][_0x538dc3['id']]['on'](_0x4209('0x19'),this[_0x4209('0x1c')][_0x4209('0x1b')](this,_0x3ec240));this[_0x4209('0xb')][_0x538dc3['id']]['on'](_0x4209('0x1d'),this[_0x4209('0x1e')][_0x4209('0x1b')](this,_0x3ec240));this[_0x4209('0xb')][_0x538dc3['id']]['on'](_0x4209('0x1f'),this[_0x4209('0x20')][_0x4209('0x1b')](this,_0x3ec240));}}else{if(_['isNil'](this[_0x4209('0xa')][_0x3ec240][_0x4209('0x11')])){this[_0x4209('0xa')][_0x3ec240]['Imap']={};}this[_0x4209('0xa')][_0x3ec240][_0x4209('0x11')][_0x4209('0x10')]='disabled';this[_0x4209('0xa')][_0x3ec240][_0x4209('0x11')]['messageStatus']='';this[_0x4209('0x16')](_0x3ec240);}}}};EmailChannel[_0x4209('0xc')][_0x4209('0x21')]=function(_0x451b99,_0x5923ba){if(this[_0x4209('0xa')][_0x451b99]){this[_0x4209('0xa')][_0x451b99]['Imap'][_0x4209('0x10')]=_0x4209('0x22');this[_0x4209('0xa')][_0x451b99][_0x4209('0x11')][_0x4209('0x12')]=_0x5923ba[_0x4209('0xd')];if(_0x5923ba[_0x4209('0x23')]){this[_0x4209('0xa')][_0x451b99][_0x4209('0x11')][_0x4209('0x13')]=_0x5923ba[_0x4209('0x23')][_0x4209('0x13')];}return this[_0x4209('0x16')](_0x451b99);}};EmailChannel['prototype'][_0x4209('0x1c')]=function(_0x2123da,_0xceef32){logger[_0x4209('0x8')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0xceef32['firstName'],_0xceef32[_0x4209('0x24')],_0xceef32['from'],_0x2123da);if(this[_0x4209('0xa')][_0x2123da]){return mailAccount['notify'](_0x2123da,_0xceef32)[_0x4209('0x25')](function(_0xb7de72){if(_0xb7de72){logger[_0x4209('0x8')](_0x4209('0x26'));}})[_0x4209('0x27')](function(_0x2bb89d){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4209('0x28')](_0x2bb89d));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x24d451){if(this[_0x4209('0xa')][_0x24d451]&&this[_0x4209('0xa')][_0x24d451][_0x4209('0x11')]){if(this['imapAccounts'][this[_0x4209('0xa')][_0x24d451][_0x4209('0x11')]['id']]){delete this[_0x4209('0xb')][this[_0x4209('0xa')][_0x24d451][_0x4209('0x11')]['id']];}this[_0x4209('0xa')][_0x24d451]['Imap'][_0x4209('0x29')]=moment();this[_0x4209('0x16')](_0x24d451);}};EmailChannel[_0x4209('0xc')][_0x4209('0x20')]=function(_0x2080cf,_0x3d179e){if(this[_0x4209('0xa')][_0x2080cf]){this[_0x4209('0xa')][_0x2080cf][_0x4209('0x11')][_0x4209('0x10')]=_0x4209('0x1f');this[_0x4209('0xa')][_0x2080cf]['Imap'][_0x4209('0x12')]=_0x3d179e;return this[_0x4209('0x16')](_0x2080cf);}};EmailChannel['prototype'][_0x4209('0x2a')]=function(_0x8516c5,_0x4af30f){return this[_0x4209('0x2b')][_0x4209('0x2c')](_0x8516c5,_0x4af30f);};EmailChannel[_0x4209('0xc')][_0x4209('0x2d')]=function(_0xc3451c){var _0x3c567f=this;if(this[_0x4209('0xa')][_0xc3451c['id']]){if(_[_0x4209('0x14')](this[_0x4209('0xa')][_0xc3451c['id']][_0x4209('0x2e')])){this['mailAccounts'][_0xc3451c['id']][_0x4209('0x2e')]={};}this['mailAccounts'][_0xc3451c['id']][_0x4209('0x2e')][_0x4209('0x29')]=moment();return new BPromise(function(_0x397e5b,_0x5b0318){return _0x3c567f[_0x4209('0x2b')][_0x4209('0x2f')](_0xc3451c)[_0x4209('0x25')](function(_0x4b2a64){_0x3c567f[_0x4209('0xa')][_0xc3451c['id']]['Smtp'][_0x4209('0x10')]=_0x4209('0x30');_0x3c567f[_0x4209('0xa')][_0xc3451c['id']]['Smtp'][_0x4209('0x12')]='';_0x3c567f[_0x4209('0x16')](_0xc3451c['id']);_0x397e5b(_0x4b2a64);})[_0x4209('0x27')](function(_0x1e7f5d){_0x3c567f['mailAccounts'][_0xc3451c['id']]['Smtp']['status']=_0x4209('0x1f');_0x3c567f['mailAccounts'][_0xc3451c['id']][_0x4209('0x2e')][_0x4209('0x12')]=_0x1e7f5d;_0x3c567f[_0x4209('0x16')](_0xc3451c['id']);_0x5b0318(_0x1e7f5d);});});}return this[_0x4209('0x2b')]['verify'](_0xc3451c);};module[_0x4209('0x31')]=EmailChannel; \ No newline at end of file +var _0xcf82=['stringify','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil'];(function(_0x39a76b,_0x254e7a){var _0x241949=function(_0x42d975){while(--_0x42d975){_0x39a76b['push'](_0x39a76b['shift']());}};_0x241949(++_0x254e7a);}(_0xcf82,0x15b));var _0x2cf8=function(_0x472c90,_0x1a5543){_0x472c90=_0x472c90-0x0;var _0x160ec1=_0xcf82[_0x472c90];return _0x160ec1;};'use strict';var _=require(_0x2cf8('0x0'));var moment=require(_0x2cf8('0x1'));var BPromise=require(_0x2cf8('0x2'));var md5=require(_0x2cf8('0x3'));var Redis=require(_0x2cf8('0x4'));var config=require(_0x2cf8('0x5'));var logger=require('../../../config/logger')(_0x2cf8('0x6'));config[_0x2cf8('0x7')]=_[_0x2cf8('0x8')](config[_0x2cf8('0x7')],{'host':_0x2cf8('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2cf8('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x53422a){logger[_0x2cf8('0xa')](_0x2cf8('0xb'));this['mailAccounts']=_0x53422a[_0x2cf8('0xc')];this[_0x2cf8('0xd')]={};this[_0x2cf8('0xe')]=new EmailSmtp();}EmailChannel[_0x2cf8('0xf')][_0x2cf8('0x10')]=function(_0x5a58e8){var _0xc3e530=this[_0x2cf8('0xc')][_0x5a58e8];var _0x592a09={'id':_0xc3e530['id'],'name':_0xc3e530[_0x2cf8('0x11')],'key':_0xc3e530[_0x2cf8('0x12')],'active':_0xc3e530[_0x2cf8('0x13')],'Imap':{'status':_0xc3e530[_0x2cf8('0x14')]['status'],'messageStatus':_0xc3e530['Imap'][_0x2cf8('0x15')],'total':_0xc3e530[_0x2cf8('0x14')][_0x2cf8('0x16')]}};if(_[_0x2cf8('0x17')](md5Accounts[_0x5a58e8])){md5Accounts[_0x5a58e8]={};}var _0x1add82=md5(JSON[_0x2cf8('0x18')](_0x592a09));if(md5Accounts[_0x5a58e8][_0x2cf8('0x3')]!==_0x1add82){md5Accounts[_0x5a58e8][_0x2cf8('0x3')]=_0x1add82;io[_0x2cf8('0x10')](_0x2cf8('0x19'),_0x592a09);}};EmailChannel[_0x2cf8('0xf')][_0x2cf8('0x1a')]=function(_0x46df99){for(var _0x34f3be in _0x46df99){if(_0x46df99[_0x2cf8('0x1b')](_0x34f3be)){if(_0x46df99[_0x34f3be][_0x2cf8('0x14')]&&_0x46df99[_0x34f3be][_0x2cf8('0x13')]){var _0x305ff6=_0x46df99[_0x34f3be][_0x2cf8('0x14')];if(!this['imapAccounts'][_0x2cf8('0x1b')](_0x305ff6['id'])){this['imapAccounts'][_0x305ff6['id']]=new EmailImap(_0x305ff6,_0x46df99[_0x34f3be][_0x2cf8('0x6')]);this[_0x2cf8('0xd')][_0x305ff6['id']]['on'](_0x2cf8('0x1c'),this['handleImapBox'][_0x2cf8('0x1d')](this,_0x34f3be));this[_0x2cf8('0xd')][_0x305ff6['id']]['on'](_0x2cf8('0x6'),this[_0x2cf8('0x1e')]['bind'](this,_0x34f3be));this[_0x2cf8('0xd')][_0x305ff6['id']]['on'](_0x2cf8('0x1f'),this[_0x2cf8('0x20')]['bind'](this,_0x34f3be));this[_0x2cf8('0xd')][_0x305ff6['id']]['on'](_0x2cf8('0x21'),this[_0x2cf8('0x22')][_0x2cf8('0x1d')](this,_0x34f3be));}}else{if(_[_0x2cf8('0x17')](this[_0x2cf8('0xc')][_0x34f3be][_0x2cf8('0x14')])){this['mailAccounts'][_0x34f3be][_0x2cf8('0x14')]={};}this[_0x2cf8('0xc')][_0x34f3be][_0x2cf8('0x14')][_0x2cf8('0x23')]=_0x2cf8('0x24');this['mailAccounts'][_0x34f3be][_0x2cf8('0x14')][_0x2cf8('0x15')]='';this['emit'](_0x34f3be);}}}};EmailChannel[_0x2cf8('0xf')]['handleImapBox']=function(_0xd9285c,_0x480d92){if(this[_0x2cf8('0xc')][_0xd9285c]){this[_0x2cf8('0xc')][_0xd9285c][_0x2cf8('0x14')]['status']=_0x2cf8('0x25');this[_0x2cf8('0xc')][_0xd9285c][_0x2cf8('0x14')]['messageStatus']=_0x480d92[_0x2cf8('0x11')];if(_0x480d92[_0x2cf8('0x26')]){this[_0x2cf8('0xc')][_0xd9285c][_0x2cf8('0x14')][_0x2cf8('0x16')]=_0x480d92[_0x2cf8('0x26')][_0x2cf8('0x16')];}return this[_0x2cf8('0x10')](_0xd9285c);}};EmailChannel[_0x2cf8('0xf')]['handleImapEmail']=function(_0x55b42d,_0x29ca06){logger[_0x2cf8('0xa')](_0x2cf8('0x27'),_0x29ca06[_0x2cf8('0x28')],_0x29ca06[_0x2cf8('0x29')],_0x29ca06['from'],_0x55b42d);if(this['mailAccounts'][_0x55b42d]){return mailAccount[_0x2cf8('0x2a')](_0x55b42d,_0x29ca06)['then'](function(_0x5d2c63){if(_0x5d2c63){logger['info'](_0x2cf8('0x2b'));}})[_0x2cf8('0x2c')](function(_0x5b264e){logger[_0x2cf8('0x21')](_0x2cf8('0x2d'),JSON[_0x2cf8('0x18')](_0x5b264e));});}};EmailChannel[_0x2cf8('0xf')][_0x2cf8('0x20')]=function(_0xec35c3){if(this['mailAccounts'][_0xec35c3]&&this[_0x2cf8('0xc')][_0xec35c3][_0x2cf8('0x14')]){if(this[_0x2cf8('0xd')][this[_0x2cf8('0xc')][_0xec35c3][_0x2cf8('0x14')]['id']]){delete this[_0x2cf8('0xd')][this[_0x2cf8('0xc')][_0xec35c3][_0x2cf8('0x14')]['id']];}this[_0x2cf8('0xc')][_0xec35c3][_0x2cf8('0x14')][_0x2cf8('0x2e')]=moment();this[_0x2cf8('0x10')](_0xec35c3);}};EmailChannel[_0x2cf8('0xf')][_0x2cf8('0x22')]=function(_0x4f60fb,_0x2b0cf1){if(this[_0x2cf8('0xc')][_0x4f60fb]){this[_0x2cf8('0xc')][_0x4f60fb][_0x2cf8('0x14')][_0x2cf8('0x23')]=_0x2cf8('0x21');this[_0x2cf8('0xc')][_0x4f60fb][_0x2cf8('0x14')]['messageStatus']=_0x2b0cf1;return this[_0x2cf8('0x10')](_0x4f60fb);}};EmailChannel[_0x2cf8('0xf')][_0x2cf8('0x2f')]=function(_0x343a14,_0x2de502){return this[_0x2cf8('0xe')]['send'](_0x343a14,_0x2de502);};EmailChannel['prototype']['verifySmtp']=function(_0x137414){var _0x280bc8=this;if(this[_0x2cf8('0xc')][_0x137414['id']]){if(_['isNil'](this[_0x2cf8('0xc')][_0x137414['id']][_0x2cf8('0x30')])){this[_0x2cf8('0xc')][_0x137414['id']][_0x2cf8('0x30')]={};}this[_0x2cf8('0xc')][_0x137414['id']][_0x2cf8('0x30')][_0x2cf8('0x2e')]=moment();return new BPromise(function(_0x3615da,_0x26c4bd){return _0x280bc8[_0x2cf8('0xe')][_0x2cf8('0x31')](_0x137414)[_0x2cf8('0x32')](function(_0x5305a0){_0x280bc8[_0x2cf8('0xc')][_0x137414['id']]['Smtp'][_0x2cf8('0x23')]=_0x2cf8('0x33');_0x280bc8[_0x2cf8('0xc')][_0x137414['id']]['Smtp'][_0x2cf8('0x15')]='';_0x280bc8[_0x2cf8('0x10')](_0x137414['id']);_0x3615da(_0x5305a0);})['catch'](function(_0x36313d){_0x280bc8['mailAccounts'][_0x137414['id']]['Smtp'][_0x2cf8('0x23')]='error';_0x280bc8[_0x2cf8('0xc')][_0x137414['id']]['Smtp'][_0x2cf8('0x15')]=_0x36313d;_0x280bc8[_0x2cf8('0x10')](_0x137414['id']);_0x26c4bd(_0x36313d);});});}return this['smtp'][_0x2cf8('0x31')](_0x137414);};module[_0x2cf8('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ddf9f4f..ae669aa 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 _0xaa12=['authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','end','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','error','exports','path','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','handleEnd','handleError','connect','prototype','connTimeout','authTimeout','isNil','service'];(function(_0x59991e,_0x43ca9c){var _0xeb5852=function(_0xca6723){while(--_0xca6723){_0x59991e['push'](_0x59991e['shift']());}};_0xeb5852(++_0x43ca9c);}(_0xaa12,0xec));var _0x2aa1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xaa12[_0x59ee6f];return _0x4c0979;};'use strict';var fs=require('fs');var path=require(_0x2aa1('0x0'));var util=require('util');var Imap=require(_0x2aa1('0x1'));var _=require(_0x2aa1('0x2'));var rs=require('randomstring');var simpleParser=require(_0x2aa1('0x3'))[_0x2aa1('0x4')];var Iconv=require(_0x2aa1('0x5'))[_0x2aa1('0x6')];var EventEmitter=require(_0x2aa1('0x7'))[_0x2aa1('0x8')];var utils=require(_0x2aa1('0x9'));var logger=require(_0x2aa1('0xa'))(_0x2aa1('0xb'));function EmailImap(_0x434daf,_0x5100e0){this[_0x2aa1('0xc')]=_0x2aa1('0xd');this['account']=this[_0x2aa1('0xe')](_0x434daf,_0x5100e0);this[_0x2aa1('0x1')]=new Imap(this[_0x2aa1('0xf')]);this[_0x2aa1('0x1')][_0x2aa1('0x10')](_0x2aa1('0x11'),this[_0x2aa1('0x12')][_0x2aa1('0x13')](this));this[_0x2aa1('0x1')]['once']('end',this[_0x2aa1('0x14')][_0x2aa1('0x13')](this));this[_0x2aa1('0x1')]['on']('error',this[_0x2aa1('0x15')]['bind'](this));this[_0x2aa1('0x1')][_0x2aa1('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x2aa1('0x17')][_0x2aa1('0xe')]=function(_0x27cb2a,_0x973e8c){var _0x3afd27={'connTimeout':_0x27cb2a[_0x2aa1('0x18')]?_0x27cb2a[_0x2aa1('0x18')]*0x3e8:0x2710,'authTimeout':_0x27cb2a[_0x2aa1('0x19')]?_0x27cb2a[_0x2aa1('0x19')]*0x3e8:0x1388};if(_[_0x2aa1('0x1a')](_0x27cb2a[_0x2aa1('0x1b')])){if(_0x27cb2a[_0x2aa1('0x1c')]){_0x3afd27[_0x2aa1('0x1d')]=_0x27cb2a[_0x2aa1('0x1d')];_0x3afd27[_0x2aa1('0x1e')]=_0x27cb2a[_0x2aa1('0x1e')];}_0x3afd27['host']=_0x27cb2a[_0x2aa1('0x1f')];_0x3afd27[_0x2aa1('0x20')]=_0x27cb2a[_0x2aa1('0x20')]||0x3e1;if(_0x27cb2a[_0x2aa1('0x21')]){_0x3afd27[_0x2aa1('0x21')]=!![];}else{_0x3afd27['tls']=![];_0x3afd27[_0x2aa1('0x22')]=_0x2aa1('0x23');}}else{_0x3afd27['user']=_0x27cb2a[_0x2aa1('0x1d')];_0x3afd27[_0x2aa1('0x1e')]=_0x27cb2a[_0x2aa1('0x1e')];_0x3afd27[_0x2aa1('0x1f')]=utils[_0x2aa1('0x24')](_0x27cb2a[_0x2aa1('0x1b')]);_0x3afd27[_0x2aa1('0x20')]=0x3e1;_0x3afd27[_0x2aa1('0x21')]=!![];}_0x3afd27[_0x2aa1('0xb')]=_0x973e8c||_0x27cb2a['user']||_0x2aa1('0x25');return _0x3afd27;};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x12')]=function(){this[_0x2aa1('0x1')][_0x2aa1('0x26')](this[_0x2aa1('0xc')],![],this[_0x2aa1('0x27')]['bind'](this));};EmailImap[_0x2aa1('0x17')]['handleOpenBox']=function(_0x5e33d4,_0x714620){if(_0x5e33d4){this[_0x2aa1('0x15')](_0x5e33d4,!![]);}else{this[_0x2aa1('0x28')](_0x2aa1('0x29'),_0x714620);this[_0x2aa1('0x2a')]();}};EmailImap[_0x2aa1('0x17')]['handleCloseBox']=function(_0x452d61){if(_0x452d61){this[_0x2aa1('0x15')](_0x452d61,!![]);}else{this[_0x2aa1('0x1')][_0x2aa1('0x2b')]();}};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x2a')]=function(){this[_0x2aa1('0x1')][_0x2aa1('0x2c')]([_0x2aa1('0x2d')],this[_0x2aa1('0x2e')]['bind'](this));};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x2e')]=function(_0x3aa4ec,_0x3efbbf){if(_0x3aa4ec){this[_0x2aa1('0x15')](_0x3aa4ec,!![]);}else{if(_0x3efbbf[_0x2aa1('0x2f')]){try{var _0x2f1685=this[_0x2aa1('0x1')]['fetch'](_0x3efbbf,{'bodies':'','markSeen':!![]});_0x2f1685['on'](_0x2aa1('0x30'),this[_0x2aa1('0x31')][_0x2aa1('0x13')](this));_0x2f1685[_0x2aa1('0x10')]('error',this[_0x2aa1('0x32')][_0x2aa1('0x13')](this));_0x2f1685[_0x2aa1('0x10')](_0x2aa1('0x2b'),this[_0x2aa1('0x33')]['bind'](this));}catch(_0x447925){logger['error'](_0x447925);}}else{this[_0x2aa1('0x1')][_0x2aa1('0x34')](!![],this[_0x2aa1('0x35')][_0x2aa1('0x13')](this));}}};EmailImap['prototype'][_0x2aa1('0x31')]=function(_0x2d0a83,_0x427c02){_0x2d0a83['on'](_0x2aa1('0x36'),this[_0x2aa1('0x37')]['bind'](this));_0x2d0a83[_0x2aa1('0x10')](_0x2aa1('0x38'),this[_0x2aa1('0x39')][_0x2aa1('0x13')](this));_0x2d0a83[_0x2aa1('0x10')](_0x2aa1('0x2b'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x37')]=function(_0x434e8d,_0x480e0b){simpleParser(_0x434e8d,{'Iconv':Iconv},this[_0x2aa1('0x3a')][_0x2aa1('0x13')](this));};EmailImap['prototype'][_0x2aa1('0x39')]=function(_0x2b1baf){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x3a')]=function(_0x3fcd70,_0x340b08){if(_0x3fcd70){logger['error'](_0x3fcd70);}else{var _0x176994=this;utils[_0x2aa1('0x3b')](this[_0x2aa1('0xf')],_0x340b08,function(_0x5f4b22){_0x176994['emit'](_0x2aa1('0xb'),_0x5f4b22);});}};EmailImap['prototype'][_0x2aa1('0x33')]=function(){this['imap'][_0x2aa1('0x34')](!![],this[_0x2aa1('0x35')][_0x2aa1('0x13')](this));};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x32')]=function(_0x3aedd7){this[_0x2aa1('0x15')](_0x3aedd7);this[_0x2aa1('0x1')]['closeBox'](!![],this[_0x2aa1('0x35')][_0x2aa1('0x13')](this));};EmailImap[_0x2aa1('0x17')]['handleEnd']=function(){this['emit']('end');};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x15')]=function(_0x231d84,_0xcff208){logger['error']('handleError',this[_0x2aa1('0xf')][_0x2aa1('0xb')],JSON[_0x2aa1('0x3c')](_0x231d84));var _0x155b55='';if(_0x231d84){if(_0x231d84[_0x2aa1('0x3d')]){_0x155b55=_0x231d84['textCode'];}else{for(var _0x3797f5 in _0x231d84){if(_0x231d84[_0x2aa1('0x3e')](_0x3797f5)){_0x155b55+=_[_0x2aa1('0x3f')](_0x3797f5)+':\x20'+_0x231d84[_0x3797f5]+'\x0a';}}}}if(_0xcff208){this[_0x2aa1('0x1')][_0x2aa1('0x2b')]();}else{this[_0x2aa1('0x28')](_0x2aa1('0x40'),_0x155b55);this[_0x2aa1('0x28')](_0x2aa1('0x2b'));}};module[_0x2aa1('0x41')]=EmailImap; \ No newline at end of file +var _0x77ed=['readUnseen','prototype','handleCloseBox','end','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','../../../config/logger','INBOX','account','getAccount','imap','once','handleReady','bind','error','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','email','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box'];(function(_0x25e034,_0x1788b0){var _0x397e78=function(_0x14eac5){while(--_0x14eac5){_0x25e034['push'](_0x25e034['shift']());}};_0x397e78(++_0x1788b0);}(_0x77ed,0x1ba));var _0xd77e=function(_0xaf9b26,_0x3fbaa1){_0xaf9b26=_0xaf9b26-0x0;var _0x59ed11=_0x77ed[_0xaf9b26];return _0x59ed11;};'use strict';var fs=require('fs');var path=require(_0xd77e('0x0'));var util=require(_0xd77e('0x1'));var Imap=require('imap');var _=require(_0xd77e('0x2'));var rs=require(_0xd77e('0x3'));var simpleParser=require(_0xd77e('0x4'))[_0xd77e('0x5')];var Iconv=require(_0xd77e('0x6'))[_0xd77e('0x7')];var EventEmitter=require('events')['EventEmitter'];var utils=require('./utils');var logger=require(_0xd77e('0x8'))('email');function EmailImap(_0x51dfe6,_0x5f26a7){this['mailbox']=_0xd77e('0x9');this[_0xd77e('0xa')]=this[_0xd77e('0xb')](_0x51dfe6,_0x5f26a7);this[_0xd77e('0xc')]=new Imap(this['account']);this[_0xd77e('0xc')][_0xd77e('0xd')]('ready',this[_0xd77e('0xe')][_0xd77e('0xf')](this));this[_0xd77e('0xc')]['once']('end',this['handleEnd']['bind'](this));this[_0xd77e('0xc')]['on'](_0xd77e('0x10'),this[_0xd77e('0x11')]['bind'](this));this[_0xd77e('0xc')][_0xd77e('0x12')]();}util[_0xd77e('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0xd77e('0xb')]=function(_0x349a05,_0x3a6878){var _0x3a9668={'connTimeout':_0x349a05[_0xd77e('0x14')]?_0x349a05[_0xd77e('0x14')]*0x3e8:0x2710,'authTimeout':_0x349a05[_0xd77e('0x15')]?_0x349a05[_0xd77e('0x15')]*0x3e8:0x1388};if(_[_0xd77e('0x16')](_0x349a05[_0xd77e('0x17')])){if(_0x349a05[_0xd77e('0x18')]){_0x3a9668[_0xd77e('0x19')]=_0x349a05['user'];_0x3a9668[_0xd77e('0x1a')]=_0x349a05[_0xd77e('0x1a')];}_0x3a9668['host']=_0x349a05[_0xd77e('0x1b')];_0x3a9668[_0xd77e('0x1c')]=_0x349a05['port']||0x3e1;if(_0x349a05[_0xd77e('0x1d')]){_0x3a9668[_0xd77e('0x1d')]=!![];}else{_0x3a9668[_0xd77e('0x1d')]=![];_0x3a9668['autotls']=_0xd77e('0x1e');}}else{_0x3a9668[_0xd77e('0x19')]=_0x349a05[_0xd77e('0x19')];_0x3a9668[_0xd77e('0x1a')]=_0x349a05[_0xd77e('0x1a')];_0x3a9668[_0xd77e('0x1b')]=utils['getHost'](_0x349a05[_0xd77e('0x17')]);_0x3a9668['port']=0x3e1;_0x3a9668[_0xd77e('0x1d')]=!![];}_0x3a9668[_0xd77e('0x1f')]=_0x3a6878||_0x349a05[_0xd77e('0x19')]||_0xd77e('0x20');return _0x3a9668;};EmailImap['prototype']['handleReady']=function(){this[_0xd77e('0xc')][_0xd77e('0x21')](this[_0xd77e('0x22')],![],this[_0xd77e('0x23')][_0xd77e('0xf')](this));};EmailImap['prototype'][_0xd77e('0x23')]=function(_0x492ea1,_0x1a3b59){if(_0x492ea1){this[_0xd77e('0x11')](_0x492ea1,!![]);}else{this[_0xd77e('0x24')](_0xd77e('0x25'),_0x1a3b59);this[_0xd77e('0x26')]();}};EmailImap[_0xd77e('0x27')][_0xd77e('0x28')]=function(_0x4d5c7f){if(_0x4d5c7f){this['handleError'](_0x4d5c7f,!![]);}else{this[_0xd77e('0xc')][_0xd77e('0x29')]();}};EmailImap[_0xd77e('0x27')][_0xd77e('0x26')]=function(){this[_0xd77e('0xc')][_0xd77e('0x2a')]([_0xd77e('0x2b')],this[_0xd77e('0x2c')][_0xd77e('0xf')](this));};EmailImap[_0xd77e('0x27')][_0xd77e('0x2c')]=function(_0x4c59c3,_0x2744f9){if(_0x4c59c3){this[_0xd77e('0x11')](_0x4c59c3,!![]);}else{if(_0x2744f9['length']){try{var _0x534acd=this[_0xd77e('0xc')]['fetch'](_0x2744f9,{'bodies':'','markSeen':!![]});_0x534acd['on'](_0xd77e('0x2d'),this[_0xd77e('0x2e')]['bind'](this));_0x534acd[_0xd77e('0xd')](_0xd77e('0x10'),this[_0xd77e('0x2f')][_0xd77e('0xf')](this));_0x534acd[_0xd77e('0xd')]('end',this[_0xd77e('0x30')]['bind'](this));}catch(_0x4fd3b2){logger[_0xd77e('0x10')](_0x4fd3b2);}}else{this[_0xd77e('0xc')][_0xd77e('0x31')](!![],this[_0xd77e('0x28')][_0xd77e('0xf')](this));}}};EmailImap['prototype'][_0xd77e('0x2e')]=function(_0x20aa1b,_0x250dc1){_0x20aa1b['on']('body',this[_0xd77e('0x32')][_0xd77e('0xf')](this));_0x20aa1b[_0xd77e('0xd')](_0xd77e('0x33'),this[_0xd77e('0x34')][_0xd77e('0xf')](this));_0x20aa1b[_0xd77e('0xd')](_0xd77e('0x29'),this[_0xd77e('0x35')][_0xd77e('0xf')](this));};EmailImap[_0xd77e('0x27')][_0xd77e('0x32')]=function(_0x35af05,_0x260215){simpleParser(_0x35af05,{'Iconv':Iconv},this[_0xd77e('0x36')][_0xd77e('0xf')](this));};EmailImap[_0xd77e('0x27')][_0xd77e('0x34')]=function(_0x4b52e6){};EmailImap[_0xd77e('0x27')][_0xd77e('0x35')]=function(){};EmailImap[_0xd77e('0x27')][_0xd77e('0x36')]=function(_0x435ae9,_0x2c800b){if(_0x435ae9){logger[_0xd77e('0x10')](_0x435ae9);}else{var _0x55997=this;utils['parser'](this[_0xd77e('0xa')],_0x2c800b,function(_0x207fa9){_0x55997[_0xd77e('0x24')](_0xd77e('0x1f'),_0x207fa9);});}};EmailImap[_0xd77e('0x27')][_0xd77e('0x30')]=function(){this[_0xd77e('0xc')][_0xd77e('0x31')](!![],this[_0xd77e('0x28')][_0xd77e('0xf')](this));};EmailImap['prototype'][_0xd77e('0x2f')]=function(_0x3b32e3){this['handleError'](_0x3b32e3);this['imap'][_0xd77e('0x31')](!![],this[_0xd77e('0x28')]['bind'](this));};EmailImap['prototype']['handleEnd']=function(){this[_0xd77e('0x24')]('end');};EmailImap[_0xd77e('0x27')][_0xd77e('0x11')]=function(_0x4ee48f,_0x45d86c){logger['error'](_0xd77e('0x11'),this['account'][_0xd77e('0x1f')],JSON[_0xd77e('0x37')](_0x4ee48f));var _0x51119f='';if(_0x4ee48f){if(_0x4ee48f['textCode']){_0x51119f=_0x4ee48f[_0xd77e('0x38')];}else{for(var _0x285051 in _0x4ee48f){if(_0x4ee48f[_0xd77e('0x39')](_0x285051)){_0x51119f+=_[_0xd77e('0x3a')](_0x285051)+':\x20'+_0x4ee48f[_0x285051]+'\x0a';}}}}if(_0x45d86c){this[_0xd77e('0xc')]['end']();}else{this['emit'](_0xd77e('0x10'),_0x51119f);this[_0xd77e('0x24')](_0xd77e('0x29'));}};module[_0xd77e('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 7f44e14..6619e60 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 _0x8bd4=['send','compile','toString','createTransport','verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype'];(function(_0x4f69ed,_0x25b8e8){var _0x36139b=function(_0x2ba3bc){while(--_0x2ba3bc){_0x4f69ed['push'](_0x4f69ed['shift']());}};_0x36139b(++_0x25b8e8);}(_0x8bd4,0x75));var _0x48bd=function(_0x42d0e8,_0x3d824b){_0x42d0e8=_0x42d0e8-0x0;var _0x4ed2f7=_0x8bd4[_0x42d0e8];return _0x4ed2f7;};'use strict';var nodemailer=require(_0x48bd('0x0'));var BPromise=require(_0x48bd('0x1'));var inlineBase64=require(_0x48bd('0x2'));function EmailSmtp(){}EmailSmtp[_0x48bd('0x3')][_0x48bd('0x4')]=function(_0x52e775,_0x4dacbc){return new BPromise(function(_0x92b31a,_0x566105){var _0x183fae=nodemailer['createTransport'](_0x52e775);_0x183fae['use'](_0x48bd('0x5'),inlineBase64());_0x183fae['sendMail'](_0x4dacbc,function(_0x3f073d,_0x31a9b4){if(_0x3f073d){_0x566105(_0x3f073d[_0x48bd('0x6')]());}else{_0x92b31a(_0x31a9b4);}});});};EmailSmtp[_0x48bd('0x3')]['verify']=function(_0x227553){return new BPromise(function(_0x192fab,_0xed57f0){var _0x4fba55=nodemailer[_0x48bd('0x7')](_0x227553);_0x4fba55[_0x48bd('0x8')](function(_0x13bfd1,_0x34067c){if(_0x13bfd1){_0xed57f0(_0x13bfd1[_0x48bd('0x6')]());}else{if(_0x34067c){_0x192fab(_0x34067c);}else{_0xed57f0(_0x48bd('0x9'));}}});});};module[_0x48bd('0xa')]=EmailSmtp; \ No newline at end of file +var _0x9617=['Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use','verify'];(function(_0x5a46ca,_0x3f30a5){var _0x1606db=function(_0x48a0a3){while(--_0x48a0a3){_0x5a46ca['push'](_0x5a46ca['shift']());}};_0x1606db(++_0x3f30a5);}(_0x9617,0xe2));var _0x7961=function(_0x6c05fb,_0x4e4f17){_0x6c05fb=_0x6c05fb-0x0;var _0x5c9ec9=_0x9617[_0x6c05fb];return _0x5c9ec9;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x7961('0x0'));var inlineBase64=require(_0x7961('0x1'));function EmailSmtp(){}EmailSmtp[_0x7961('0x2')]['send']=function(_0x238b22,_0x49c0da){return new BPromise(function(_0x326f3b,_0x47820a){var _0x1ae111=nodemailer[_0x7961('0x3')](_0x238b22);_0x1ae111[_0x7961('0x4')]('compile',inlineBase64());_0x1ae111['sendMail'](_0x49c0da,function(_0x3c9761,_0x5ad89a){if(_0x3c9761){_0x47820a(_0x3c9761['toString']());}else{_0x326f3b(_0x5ad89a);}});});};EmailSmtp[_0x7961('0x2')]['verify']=function(_0x317cd2){return new BPromise(function(_0x287a65,_0x46dac0){var _0x5b601f=nodemailer[_0x7961('0x3')](_0x317cd2);_0x5b601f[_0x7961('0x5')](function(_0x1d4db3,_0x190759){if(_0x1d4db3){_0x46dac0(_0x1d4db3['toString']());}else{if(_0x190759){_0x287a65(_0x190759);}else{_0x46dac0(_0x7961('0x6'));}}});});};module[_0x7961('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 55959a7..1deec8c 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 _0x9264=['indexOf','line','isAutoreply','parser','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','lodash','moment','randomstring','path','../../../config/logger','address','generate','@xcally.com','head','value','name','split','length','join','Anonymous','pop','anonymous','html','includes','','body','textAsHtml','0x1?_0x5f27dd['slice'](0x0,-0x1)[_0x4926('0xd')]('\x20'):_0x18e43d[_0x4926('0xa')];}return _0x4926('0xe');}function getLastName(_0x44325a){var _0x2613a2=_[_0x4926('0x8')](_0x44325a[_0x4926('0x9')]);if(_0x2613a2&&_0x2613a2[_0x4926('0xa')]){var _0x21503d=_0x2613a2[_0x4926('0xa')][_0x4926('0xb')](/\s+/);return _0x21503d[_0x4926('0xc')]>0x1?_0x21503d[_0x4926('0xf')]():'';}return'';}function getMails(_0x1ac74f,_0x55b957){var _0x1703ed='';for(var _0x258914=0x0;_0x258914<_0x55b957[_0x4926('0x9')]['length'];_0x258914+=0x1){if(_0x55b957['value'][_0x258914][_0x4926('0x5')]!==_0x1ac74f){if(!_['isEmpty'](_0x1703ed)){_0x1703ed+=',';}_0x1703ed+=_0x55b957[_0x4926('0x9')][_0x258914][_0x4926('0xa')]||_0x55b957['value'][_0x258914][_0x4926('0x5')]||'';_0x1703ed+='\x20<';_0x1703ed+=_0x55b957['value'][_0x258914][_0x4926('0x5')]?_0x55b957[_0x4926('0x9')][_0x258914][_0x4926('0x5')]:_0x4926('0x10')+random['generate'](0x6)+'@xcally.com';_0x1703ed+='>';}}return _0x1703ed;}function parseEmail(_0x1e8d98,_0x588c7a,_0x48de21){if(_0x588c7a[_0x4926('0x11')]){var _0x309c71=/)<[^<]*)*<\/script>/gi;while(_0x309c71['test'](_0x588c7a[_0x4926('0x11')])){_0x588c7a['html']=_0x588c7a[_0x4926('0x11')]['replace'](_0x309c71,'');}if(_0x588c7a[_0x4926('0x11')][_0x4926('0x12')](_0x4926('0x13'))){var _0x44eb88=[];_0x588c7a['attachments']['forEach'](_0x5c8935=>{_0x44eb88[_0x4926('0x14')](_0x5c8935[_0x4926('0x15')]);});var _0x43c077=/]+>/g;var _0x2519a2=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x51be4f=_0x588c7a['html']['replace'](_0x2519a2,_0x4926('0x16'));var _0x273f4b=_0x51be4f[_0x4926('0x17')](_0x43c077,'_IMG');for(let _0x514755=0x0;_0x514755<_0x44eb88['length'];_0x514755++){var _0x37701c=_0x273f4b[_0x4926('0x17')](_0x4926('0x18'),'\x20[Attachment:\x20'+_0x44eb88[_0x514755]+_0x4926('0x19'));_0x273f4b=_0x37701c;}_0x588c7a[_0x4926('0x11')]=_0x273f4b;}_0x48de21[_0x4926('0x1a')]=_0x588c7a[_0x4926('0x11')];}else{_0x48de21[_0x4926('0x1a')]=_0x588c7a[_0x4926('0x1b')];}if(_0x48de21['body']){_0x48de21[_0x4926('0x1a')]=_0x48de21[_0x4926('0x1a')][_0x4926('0x17')](/0x0){var _0x4c2be7=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x1dd36b=0x0;_0x1dd36b<_0x588c7a[_0x4926('0x2f')][_0x4926('0xc')];_0x1dd36b++){var _0x2c76d6=_[_0x4926('0x30')](_0x4c2be7,_0x588c7a['headerLines'][_0x1dd36b][_0x4926('0x31')]);if(_0x2c76d6>=0x0){_0x48de21[_0x4926('0x32')]=!![];}}}return _0x48de21;}exports[_0x4926('0x33')]=function(_0x9dc879,_0x437800,_0x42be93){var _0x22d32e={'from':getAddress(_0x437800[_0x4926('0x34')]),'firstName':getFirstName(_0x437800[_0x4926('0x34')]),'lastName':getLastName(_0x437800[_0x4926('0x34')]),'mapKey':'email','message':{'from':getMails(_0x9dc879['email'],_0x437800[_0x4926('0x34')]),'to':_0x9dc879['email'],'cc':'','subject':_0x437800[_0x4926('0x35')]||'','messageId':_0x437800[_0x4926('0x36')],'inReplyTo':_0x437800[_0x4926('0x37')],'sentAt':moment(_0x437800['date'])[_0x4926('0x28')](_0x4926('0x38')),'attach':![],'attachments':[]}};if(!_0x437800[_0x4926('0x11')]&&!_0x437800[_0x4926('0x1b')]){var _0x43561b=_[_0x4926('0x39')](_0x437800[_0x4926('0x23')],{'contentType':_0x4926('0x3a')});if(_0x43561b[_0x4926('0xc')]){logger[_0x4926('0x3b')](util[_0x4926('0x28')](_0x4926('0x3c'),_0x437800[_0x4926('0x36')]));tnef[_0x4926('0x3d')](_[_0x4926('0x3e')](_0x43561b)['content'],function(_0x1ee46d,_0x3c8bbe){if(_0x3c8bbe){_0x437800['html']=_0x3c8bbe[_0x4926('0x3f')]||_0x4926('0x40');if(_0x3c8bbe[_0x4926('0x41')]){for(var _0x572c91=0x0;_0x572c91<_0x3c8bbe[_0x4926('0x41')][_0x4926('0xc')];_0x572c91++){var _0x41041c=_0x3c8bbe[_0x4926('0x41')][_0x572c91];_0x22d32e[_0x4926('0x1d')][_0x4926('0x23')][_0x4926('0x14')]({'filename':_0x41041c[_0x4926('0x42')],'content':Buffer['from'](_0x41041c[_0x4926('0x43')])});}}}_0x42be93(parseEmail(_0x9dc879,_0x437800,_0x22d32e));});}else{_0x437800['html']='

Empty\x20message

';_0x42be93(parseEmail(_0x9dc879,_0x437800,_0x22d32e));}}else{_0x42be93(parseEmail(_0x9dc879,_0x437800,_0x22d32e));}};exports[_0x4926('0x44')]=function(_0x391e0e){switch(_0x391e0e){case'gmail':return _0x4926('0x45');case _0x4926('0x46'):return _0x4926('0x47');case _0x4926('0x48'):return _0x4926('0x49');case _0x4926('0x4a'):return'outlook.office365.com';}return'127.0.0.1';}; \ No newline at end of file +var _0xef0f=['lodash','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','join','Anonymous','pop','isEmpty','generate','html','replace','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1'];(function(_0x50bb74,_0x23ee58){var _0x74073=function(_0x1e42cf){while(--_0x1e42cf){_0x50bb74['push'](_0x50bb74['shift']());}};_0x74073(++_0x23ee58);}(_0xef0f,0x168));var _0xfef0=function(_0x2b1cfe,_0x25688d){_0x2b1cfe=_0x2b1cfe-0x0;var _0x233cdf=_0xef0f[_0x2b1cfe];return _0x233cdf;};'use strict';var _=require(_0xfef0('0x0'));var moment=require('moment');var random=require(_0xfef0('0x1'));var fs=require('fs');var path=require(_0xfef0('0x2'));var util=require(_0xfef0('0x3'));var tnef=require('node-tnef');var logger=require(_0xfef0('0x4'))(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));function getAddress(_0x4e1af6){var _0x2a6fcf=_[_0xfef0('0x7')](_0x4e1af6[_0xfef0('0x8')]);return _0x2a6fcf&&_0x2a6fcf[_0xfef0('0x9')]?_0x2a6fcf[_0xfef0('0x9')]:_0xfef0('0xa')+random['generate'](0x6)+_0xfef0('0xb');}function getFirstName(_0x58cf6d){var _0x82e37a=_[_0xfef0('0x7')](_0x58cf6d[_0xfef0('0x8')]);if(_0x82e37a&&_0x82e37a[_0xfef0('0xc')]){if(_0x82e37a[_0xfef0('0xc')]==_0x82e37a[_0xfef0('0x9')]){return _0x82e37a[_0xfef0('0xc')][_0xfef0('0xd')](0x0,_0x82e37a[_0xfef0('0xc')][_0xfef0('0xe')]('@'));}var _0x410234=_0x82e37a[_0xfef0('0xc')][_0xfef0('0xf')](/\s+/);return _0x410234[_0xfef0('0x10')]>0x1?_0x410234['slice'](0x0,-0x1)[_0xfef0('0x11')]('\x20'):_0x82e37a[_0xfef0('0xc')];}return _0xfef0('0x12');}function getLastName(_0x30d61d){var _0xe9f78d=_[_0xfef0('0x7')](_0x30d61d[_0xfef0('0x8')]);if(_0xe9f78d&&_0xe9f78d['name']){var _0x3d1f02=_0xe9f78d['name']['split'](/\s+/);return _0x3d1f02['length']>0x1?_0x3d1f02[_0xfef0('0x13')]():'';}return'';}function getMails(_0x284b6d,_0x3510a7){var _0x1bce2f='';for(var _0x2a96d9=0x0;_0x2a96d9<_0x3510a7[_0xfef0('0x8')][_0xfef0('0x10')];_0x2a96d9+=0x1){if(_0x3510a7[_0xfef0('0x8')][_0x2a96d9]['address']!==_0x284b6d){if(!_[_0xfef0('0x14')](_0x1bce2f)){_0x1bce2f+=',';}_0x1bce2f+=_0x3510a7[_0xfef0('0x8')][_0x2a96d9][_0xfef0('0xc')]||_0x3510a7[_0xfef0('0x8')][_0x2a96d9][_0xfef0('0x9')]||'';_0x1bce2f+='\x20<';_0x1bce2f+=_0x3510a7['value'][_0x2a96d9][_0xfef0('0x9')]?_0x3510a7['value'][_0x2a96d9][_0xfef0('0x9')]:_0xfef0('0xa')+random[_0xfef0('0x15')](0x6)+'@xcally.com';_0x1bce2f+='>';}}return _0x1bce2f;}function parseEmail(_0x2be956,_0x4c304d,_0x4074b7){if(_0x4c304d[_0xfef0('0x16')]){var _0x52b93b=/)<[^<]*)*<\/script>/gi;while(_0x52b93b['test'](_0x4c304d['html'])){_0x4c304d[_0xfef0('0x16')]=_0x4c304d['html'][_0xfef0('0x17')](_0x52b93b,'');}if(_0x4c304d[_0xfef0('0x16')][_0xfef0('0x18')](_0xfef0('0x19'))){var _0x249fe4=[];_0x4c304d[_0xfef0('0x1a')]['forEach'](_0x4ac8c5=>{_0x249fe4[_0xfef0('0x1b')](_0x4ac8c5[_0xfef0('0x1c')]);});var _0x924f6e=/]+>/g;var _0x34ca65=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xab231c=_0x4c304d[_0xfef0('0x16')][_0xfef0('0x17')](_0x34ca65,_0xfef0('0x1d'));var _0x391279=_0xab231c['replace'](_0x924f6e,_0xfef0('0x1e'));for(let _0x394bad=0x0;_0x394bad<_0x249fe4[_0xfef0('0x10')];_0x394bad++){var _0x956de8=_0x391279[_0xfef0('0x17')](_0xfef0('0x1e'),_0xfef0('0x1f')+_0x249fe4[_0x394bad]+_0xfef0('0x20'));_0x391279=_0x956de8;}_0x4c304d[_0xfef0('0x16')]=_0x391279;}_0x4074b7[_0xfef0('0x21')]=_0x4c304d[_0xfef0('0x16')];}else{_0x4074b7[_0xfef0('0x21')]=_0x4c304d['textAsHtml'];}if(_0x4074b7[_0xfef0('0x21')]){_0x4074b7['body']=_0x4074b7['body'][_0xfef0('0x17')](/0x0){var _0xbf6ddd=[_0xfef0('0x30'),_0xfef0('0x31'),_0xfef0('0x32')];for(var _0x3a3844=0x0;_0x3a3844<_0x4c304d[_0xfef0('0x2f')]['length'];_0x3a3844++){var _0x417f13=_[_0xfef0('0xe')](_0xbf6ddd,_0x4c304d['headerLines'][_0x3a3844]['line']);if(_0x417f13>=0x0){_0x4074b7[_0xfef0('0x33')]=!![];}}}return _0x4074b7;}exports['parser']=function(_0x1fc518,_0x22c940,_0x3c100c){var _0x1abcfb={'from':getAddress(_0x22c940[_0xfef0('0x34')]),'firstName':getFirstName(_0x22c940[_0xfef0('0x34')]),'lastName':getLastName(_0x22c940[_0xfef0('0x34')]),'mapKey':_0xfef0('0x5'),'message':{'from':getMails(_0x1fc518['email'],_0x22c940[_0xfef0('0x34')]),'to':_0x1fc518['email'],'cc':'','subject':_0x22c940['subject']||'','messageId':_0x22c940[_0xfef0('0x35')],'inReplyTo':_0x22c940[_0xfef0('0x36')],'sentAt':moment(_0x22c940['date'])[_0xfef0('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x22c940[_0xfef0('0x16')]&&!_0x22c940[_0xfef0('0x37')]){var _0x1f252e=_[_0xfef0('0x38')](_0x22c940['attachments'],{'contentType':_0xfef0('0x39')});if(_0x1f252e[_0xfef0('0x10')]){logger['info'](util['format'](_0xfef0('0x3a'),_0x22c940['messageId']));tnef[_0xfef0('0x3b')](_[_0xfef0('0x3c')](_0x1f252e)[_0xfef0('0x2e')],function(_0x19acde,_0x1c3e04){if(_0x1c3e04){_0x22c940[_0xfef0('0x16')]=_0x1c3e04['BodyHTML']||_0xfef0('0x3d');if(_0x1c3e04['Attachments']){for(var _0x5a417e=0x0;_0x5a417e<_0x1c3e04[_0xfef0('0x3e')][_0xfef0('0x10')];_0x5a417e++){var _0x2299d4=_0x1c3e04['Attachments'][_0x5a417e];_0x1abcfb[_0xfef0('0x23')]['attachments']['push']({'filename':_0x2299d4['Title'],'content':Buffer[_0xfef0('0x34')](_0x2299d4[_0xfef0('0x3f')])});}}}_0x3c100c(parseEmail(_0x1fc518,_0x22c940,_0x1abcfb));});}else{_0x22c940[_0xfef0('0x16')]=_0xfef0('0x3d');_0x3c100c(parseEmail(_0x1fc518,_0x22c940,_0x1abcfb));}}else{_0x3c100c(parseEmail(_0x1fc518,_0x22c940,_0x1abcfb));}};exports[_0xfef0('0x40')]=function(_0xa23cc8){switch(_0xa23cc8){case _0xfef0('0x41'):return _0xfef0('0x42');case _0xfef0('0x43'):return'imap.mail.yahoo.com';case'hotmail':return _0xfef0('0x44');case _0xfef0('0x45'):return _0xfef0('0x46');}return _0xfef0('0x47');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e8f9ef3..1d25adf 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 _0x8cb4=['name','key','SERV','active','Smtp','exports'];(function(_0x5c0813,_0x5b490d){var _0x3f0bf4=function(_0x56c1d){while(--_0x56c1d){_0x5c0813['push'](_0x5c0813['shift']());}};_0x3f0bf4(++_0x5b490d);}(_0x8cb4,0x1d4));var _0x48cb=function(_0x4db6b1,_0x285282){_0x4db6b1=_0x4db6b1-0x0;var _0x1ec25f=_0x8cb4[_0x4db6b1];return _0x1ec25f;};'use strict';var _=require('lodash');function MailAccount(_0x5b3231){this['id']=_0x5b3231['id']||0x0;this[_0x48cb('0x0')]=_0x5b3231[_0x48cb('0x0')]||'Service';this[_0x48cb('0x1')]=_0x5b3231['key']||_0x48cb('0x2');this[_0x48cb('0x3')]=_0x5b3231[_0x48cb('0x3')]||![];this['Imap']=_0x5b3231['Imap']||[];this['Smtp']=_0x5b3231[_0x48cb('0x4')]||[];}module[_0x48cb('0x5')]=MailAccount; \ No newline at end of file +var _0xf963=['name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0xf963,0xa8));var _0x3f96=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xf963[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');function MailAccount(_0x3032ae){this['id']=_0x3032ae['id']||0x0;this[_0x3f96('0x0')]=_0x3032ae[_0x3f96('0x0')]||_0x3f96('0x1');this['key']=_0x3032ae[_0x3f96('0x2')]||_0x3f96('0x3');this[_0x3f96('0x4')]=_0x3032ae[_0x3f96('0x4')]||![];this[_0x3f96('0x5')]=_0x3032ae[_0x3f96('0x5')]||[];this[_0x3f96('0x6')]=_0x3032ae[_0x3f96('0x6')]||[];}module[_0x3f96('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 1f63a19..1a0f32f 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 _0x2b52=['isUndefined','merge','lodash','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype'];(function(_0x3a8301,_0x5edfe5){var _0x1bdf91=function(_0x2986ed){while(--_0x2986ed){_0x3a8301['push'](_0x3a8301['shift']());}};_0x1bdf91(++_0x5edfe5);}(_0x2b52,0xba));var _0x22b5=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x2b52[_0x15876a];return _0xbd900f;};'use strict';var _=require(_0x22b5('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x22b5('0x1')]={};};function freeIsNotKey(_0x577cb5,_0x301f16,_0x242d9c){var _0x54c679=_[_0x22b5('0x2')](_0x577cb5,function(_0x4e166c,_0x33ed7d){return _0x4e166c[_0x242d9c];});for(var _0x24bb3a in _0x301f16){if(_0x301f16[_0x22b5('0x3')](_0x24bb3a)){if(!_0x54c679[_0x24bb3a]){delete _0x301f16[_0x24bb3a];}}}}Realtime['prototype'][_0x22b5('0x4')]=function(_0x547a34,_0x27fd7c){for(var _0x181ae2 in _0x27fd7c){if(_0x547a34[_0x22b5('0x3')](_0x181ae2)){_0x547a34[_0x181ae2]=_0x27fd7c[_0x181ae2];}}};Realtime[_0x22b5('0x5')]['initMailAccounts']=function(){var _0x2d6474=this;return function(_0x26bba4){if(_0x26bba4){freeIsNotKey(_0x26bba4,_0x2d6474[_0x22b5('0x1')],'id');for(var _0x1c67bb=0x0,_0x1773b1={},_0x2dfbd2={};_0x1c67bb<_0x26bba4['length'];_0x1c67bb+=0x1){_0x1773b1=_0x26bba4[_0x1c67bb];if(_[_0x22b5('0x6')](_0x2d6474[_0x22b5('0x1')][_0x1773b1['id']])){_0x2d6474['mailAccounts'][_0x1773b1['id']]=new MailAccount(_0x1773b1);}else{_[_0x22b5('0x7')](_0x2d6474[_0x22b5('0x1')][_0x1773b1['id']],_0x1773b1);}}}return _0x2d6474[_0x22b5('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0x9581=['length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x9581,0x7c));var _0x1958=function(_0x549c9c,_0x538d7e){_0x549c9c=_0x549c9c-0x0;var _0x171934=_0x9581[_0x549c9c];return _0x171934;};'use strict';var _=require('lodash');var MailAccount=require(_0x1958('0x0'));var Realtime=function(){this[_0x1958('0x1')]={};};function freeIsNotKey(_0x3d1456,_0xdf249c,_0x32d52a){var _0x4e7159=_['mapKeys'](_0x3d1456,function(_0x13be6a,_0x13ff1c){return _0x13be6a[_0x32d52a];});for(var _0x56716f in _0xdf249c){if(_0xdf249c[_0x1958('0x2')](_0x56716f)){if(!_0x4e7159[_0x56716f]){delete _0xdf249c[_0x56716f];}}}}Realtime['prototype'][_0x1958('0x3')]=function(_0x5d9f9f,_0x2256d5){for(var _0x1a3ec1 in _0x2256d5){if(_0x5d9f9f[_0x1958('0x2')](_0x1a3ec1)){_0x5d9f9f[_0x1a3ec1]=_0x2256d5[_0x1a3ec1];}}};Realtime[_0x1958('0x4')][_0x1958('0x5')]=function(){var _0x55d292=this;return function(_0x213d07){if(_0x213d07){freeIsNotKey(_0x213d07,_0x55d292[_0x1958('0x1')],'id');for(var _0x4b1b34=0x0,_0x39c9fe={},_0x3a5239={};_0x4b1b34<_0x213d07[_0x1958('0x6')];_0x4b1b34+=0x1){_0x39c9fe=_0x213d07[_0x4b1b34];if(_[_0x1958('0x7')](_0x55d292['mailAccounts'][_0x39c9fe['id']])){_0x55d292[_0x1958('0x1')][_0x39c9fe['id']]=new MailAccount(_0x39c9fe);}else{_[_0x1958('0x8')](_0x55d292[_0x1958('0x1')][_0x39c9fe['id']],_0x39c9fe);}}}return _0x55d292[_0x1958('0x1')];};};module[_0x1958('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index aaa444e..78ec0b4 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 _0x9af6=['getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','service','key','ListId','TemplateId','Imap','Smtp'];(function(_0x4a1acd,_0x346390){var _0x19a0fb=function(_0x2e667c){while(--_0x2e667c){_0x4a1acd['push'](_0x4a1acd['shift']());}};_0x19a0fb(++_0x346390);}(_0x9af6,0x1d7));var _0x69af=function(_0x186acc,_0x4e2dab){_0x186acc=_0x186acc-0x0;var _0x2fe027=_0x9af6[_0x186acc];return _0x2fe027;};'use strict';var client=require(_0x69af('0x0'));exports[_0x69af('0x1')]=function(){return function(){return client[_0x69af('0x2')]('GetMailAccount',{'options':{'attributes':['id','name',_0x69af('0x3'),'email','active',_0x69af('0x4'),_0x69af('0x5'),_0x69af('0x6')],'raw':![],'include':[{'model':'MailServerIn','as':_0x69af('0x7')},{'model':'MailServerOut','as':_0x69af('0x8')}]},'log':_0x69af('0x9')});};};exports[_0x69af('0xa')]=function(_0x17353a,_0x26ecde){return client[_0x69af('0x2')](_0x69af('0xb'),{'account':{'id':_0x17353a},'body':_0x26ecde,'log':_0x69af('0xb')});}; \ No newline at end of file +var _0xa613=['Smtp','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','service','email','active','key','ListId','TemplateId','MailServerIn','MailServerOut'];(function(_0x98ccab,_0x516c42){var _0x2d10ca=function(_0xb26b13){while(--_0xb26b13){_0x98ccab['push'](_0x98ccab['shift']());}};_0x2d10ca(++_0x516c42);}(_0xa613,0x8a));var _0x3a61=function(_0x17e4ac,_0x315ed6){_0x17e4ac=_0x17e4ac-0x0;var _0x7a9a6a=_0xa613[_0x17e4ac];return _0x7a9a6a;};'use strict';var client=require(_0x3a61('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x3a61('0x1')](_0x3a61('0x2'),{'options':{'attributes':['id',_0x3a61('0x3'),_0x3a61('0x4'),_0x3a61('0x5'),_0x3a61('0x6'),_0x3a61('0x7'),_0x3a61('0x8'),_0x3a61('0x9')],'raw':![],'include':[{'model':_0x3a61('0xa'),'as':'Imap'},{'model':_0x3a61('0xb'),'as':_0x3a61('0xc')}]},'log':'getMailAccount'});};};exports[_0x3a61('0xd')]=function(_0x255a69,_0x3c7bdd){return client[_0x3a61('0x1')](_0x3a61('0xe'),{'account':{'id':_0x255a69},'body':_0x3c7bdd,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index cf3e4c7..0bdd4aa 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 _0x6258=['Request','loginMailFrequency','GetSettings','getSettings'];(function(_0x3da40b,_0x228dde){var _0x2e8434=function(_0x140b68){while(--_0x140b68){_0x3da40b['push'](_0x3da40b['shift']());}};_0x2e8434(++_0x228dde);}(_0x6258,0x8b));var _0x8625=function(_0x2f5a10,_0x5e56b4){_0x2f5a10=_0x2f5a10-0x0;var _0x2c8732=_0x6258[_0x2f5a10];return _0x2c8732;};'use strict';var client=require('../client');exports[_0x8625('0x0')]=function(){return client[_0x8625('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8625('0x2')]},'log':_0x8625('0x3')});}; \ No newline at end of file +var _0x5193=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x339338,_0xaffc73){var _0x4a437e=function(_0x427d00){while(--_0x427d00){_0x339338['push'](_0x339338['shift']());}};_0x4a437e(++_0xaffc73);}(_0x5193,0x1b2));var _0x3519=function(_0x42e093,_0x99db13){_0x42e093=_0x42e093-0x0;var _0x1442e5=_0x5193[_0x42e093];return _0x1442e5;};'use strict';var client=require(_0x3519('0x0'));exports[_0x3519('0x1')]=function(){return client[_0x3519('0x2')](_0x3519('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3519('0x4')]},'log':_0x3519('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f06cfb7..d820e2c 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 721289b..2c3abf7 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 _0xeb01=['http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','adapter','../../config/triggers','default','../../config/socketio','../../config/express','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash'];(function(_0x366f2e,_0x6bff89){var _0x5059fe=function(_0x49d81e){while(--_0x49d81e){_0x366f2e['push'](_0x366f2e['shift']());}};_0x5059fe(++_0x6bff89);}(_0xeb01,0x1cd));var _0x1eb0=function(_0x218e04,_0x44d8b3){_0x218e04=_0x218e04-0x0;var _0x4a537a=_0xeb01[_0x218e04];return _0x4a537a;};'use strict';var _=require(_0x1eb0('0x0'));var http=require(_0x1eb0('0x1'));var express=require(_0x1eb0('0x2'));var sticky=require(_0x1eb0('0x3'));var Redis=require('ioredis');var config=require(_0x1eb0('0x4'));var app=express();var server=http[_0x1eb0('0x5')](app);server[_0x1eb0('0x6')]=0xdbba0;if(sticky[_0x1eb0('0x7')](server,config[_0x1eb0('0x8')])){var socketio=require(_0x1eb0('0x9'))(server,{'transports':['websocket',_0x1eb0('0xa')]});config[_0x1eb0('0xb')]=_[_0x1eb0('0xc')](config[_0x1eb0('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x1eb0('0xd')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x1eb0('0xe'))[_0x1eb0('0xf')]();require(_0x1eb0('0x10'))[_0x1eb0('0xf')](socketio);require(_0x1eb0('0x11'))['default'](app);require('../../routes')['default'](app);}else{server['once'](_0x1eb0('0x12'),function(){console[_0x1eb0('0x13')](_0x1eb0('0x14'),config[_0x1eb0('0x8')]);});}exports=module[_0x1eb0('0x15')]=app; \ No newline at end of file +var _0x336b=['../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio'];(function(_0x46d538,_0x23cf57){var _0x43500c=function(_0x1ffdf9){while(--_0x1ffdf9){_0x46d538['push'](_0x46d538['shift']());}};_0x43500c(++_0x23cf57);}(_0x336b,0x1b6));var _0xb336=function(_0x142fbd,_0x2d2110){_0x142fbd=_0x142fbd-0x0;var _0x38d7a1=_0x336b[_0x142fbd];return _0x38d7a1;};'use strict';var _=require(_0xb336('0x0'));var http=require(_0xb336('0x1'));var express=require(_0xb336('0x2'));var sticky=require(_0xb336('0x3'));var Redis=require(_0xb336('0x4'));var config=require(_0xb336('0x5'));var app=express();var server=http[_0xb336('0x6')](app);server[_0xb336('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0xb336('0x8')])){var socketio=require(_0xb336('0x9'))(server,{'transports':[_0xb336('0xa'),_0xb336('0xb')]});config[_0xb336('0xc')]=_['defaults'](config[_0xb336('0xc')],{'host':'localhost','port':0x18eb});socketio[_0xb336('0xd')](require(_0xb336('0xe'))({'pubClient':new Redis(config[_0xb336('0xc')]),'subClient':new Redis(config['redis'])}));require(_0xb336('0xf'))[_0xb336('0x10')]();require(_0xb336('0x11'))['default'](socketio);require(_0xb336('0x12'))[_0xb336('0x10')](app);require(_0xb336('0x13'))[_0xb336('0x10')](app);}else{server[_0xb336('0x14')]('listening',function(){console[_0xb336('0x15')](_0xb336('0x16'),config[_0xb336('0x8')]);});}exports=module[_0xb336('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 4af09d5..971fdb4 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 _0xdab5=['error','rpc','routing','message','exports','jayson/promise','bluebird','client','Request','then','debug'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdab5,0x165));var _0x5dab=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xdab5[_0x50a0c2];return _0x5ebadd;};'use strict';var jayson=require(_0x5dab('0x0'));var BPromise=require(_0x5dab('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x5dab('0x2')]['http']({'port':0x2329});client[_0x5dab('0x3')]=function(_0x5ce685,_0x337733){return new BPromise(function(_0x48d55a,_0x27cae1){return client['request'](_0x5ce685,_0x337733)[_0x5dab('0x4')](function(_0x701c8){logger[_0x5dab('0x5')]('rpc','routing',_0x5ce685,_0x337733,_0x701c8);if(_0x701c8[_0x5dab('0x6')]){logger[_0x5dab('0x6')](_0x5dab('0x7'),_0x5dab('0x8'),_0x5ce685,_0x701c8[_0x5dab('0x6')][_0x5dab('0x9')],_0x337733);return _0x27cae1(_0x701c8['error'][_0x5dab('0x9')]);}else{return _0x48d55a(_0x701c8['result']);}})['catch'](function(_0x4eb463){logger[_0x5dab('0x6')](_0x5dab('0x7'),_0x5dab('0x8'),_0x5ce685,_0x4eb463,_0x337733);return _0x27cae1(_0x4eb463);});});};module[_0x5dab('0xa')]=client; \ No newline at end of file +var _0xb1ed=['catch','exports','jayson/promise','bluebird','routing','http','Request','then','rpc','error','message'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0xb1ed,0x65));var _0xdb1e=function(_0x19bba9,_0x2e69e7){_0x19bba9=_0x19bba9-0x0;var _0x32dca4=_0xb1ed[_0x19bba9];return _0x32dca4;};'use strict';var jayson=require(_0xdb1e('0x0'));var BPromise=require(_0xdb1e('0x1'));var logger=require('../../config/logger')(_0xdb1e('0x2'));var client=jayson['client'][_0xdb1e('0x3')]({'port':0x2329});client[_0xdb1e('0x4')]=function(_0x2b0904,_0x199139){return new BPromise(function(_0x338f02,_0xa70e15){return client['request'](_0x2b0904,_0x199139)[_0xdb1e('0x5')](function(_0x414bb0){logger['debug'](_0xdb1e('0x6'),'routing',_0x2b0904,_0x199139,_0x414bb0);if(_0x414bb0[_0xdb1e('0x7')]){logger['error']('rpc',_0xdb1e('0x2'),_0x2b0904,_0x414bb0[_0xdb1e('0x7')][_0xdb1e('0x8')],_0x199139);return _0xa70e15(_0x414bb0[_0xdb1e('0x7')][_0xdb1e('0x8')]);}else{return _0x338f02(_0x414bb0['result']);}})[_0xdb1e('0x9')](function(_0x9801c6){logger[_0xdb1e('0x7')](_0xdb1e('0x6'),_0xdb1e('0x2'),_0x2b0904,_0x9801c6,_0x199139);return _0xa70e15(_0x9801c6);});});};module[_0xdb1e('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index e411c2d..12f148f 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 _0xc300=['resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue'];(function(_0x121336,_0x3370ea){var _0x53ff9f=function(_0x4482fe){while(--_0x4482fe){_0x121336['push'](_0x121336['shift']());}};_0x53ff9f(++_0x3370ea);}(_0xc300,0x1f1));var _0x0c30=function(_0x18cadb,_0xf59330){_0x18cadb=_0x18cadb-0x0;var _0x2422c2=_0xc300[_0x18cadb];return _0x2422c2;};'use strict';var BPromise=require(_0x0c30('0x0'));var server=require(_0x0c30('0x1'));var Realtime=require('./realtime');var user=require(_0x0c30('0x2'));var interval=require(_0x0c30('0x3'));var openchannelQueue=require(_0x0c30('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x0c30('0x5'));var mailQueue=require(_0x0c30('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x0c30('0x7')]()[_0x0c30('0x8')](user[_0x0c30('0x9')]())[_0x0c30('0x8')](realtime['initAgents']())[_0x0c30('0x8')](interval[_0x0c30('0xa')]())[_0x0c30('0x8')](realtime[_0x0c30('0xb')]())[_0x0c30('0x8')](openchannelQueue[_0x0c30('0xc')]())[_0x0c30('0x8')](realtime['initOpenchannelQueues']())[_0x0c30('0x8')](chatQueue[_0x0c30('0xd')]())[_0x0c30('0x8')](realtime[_0x0c30('0xe')]())[_0x0c30('0x8')](smsQueue['getSmsQueues']())[_0x0c30('0x8')](realtime[_0x0c30('0xf')]())[_0x0c30('0x8')](mailQueue[_0x0c30('0x10')]())['then'](realtime[_0x0c30('0x11')]())['then'](faxQueue[_0x0c30('0x12')]())[_0x0c30('0x8')](realtime['initFaxQueues']())[_0x0c30('0x8')](whatsappQueue[_0x0c30('0x13')]())['then'](realtime[_0x0c30('0x14')]())[_0x0c30('0x8')](function(){return realtime;});}function main(){return server[_0x0c30('0x15')](realtime)[_0x0c30('0x8')](function(_0x8c17d9){return initRealtime();})[_0x0c30('0x8')](function(_0x18f20f){return setInterval(initRealtime,0x1388);})[_0x0c30('0x16')](function(_0x3de8bc){console[_0x0c30('0x17')](_0x3de8bc);});}main(); \ No newline at end of file +var _0xd8d8=['then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','resolve'];(function(_0x3582eb,_0x227119){var _0x1b4d2f=function(_0x30e6dc){while(--_0x30e6dc){_0x3582eb['push'](_0x3582eb['shift']());}};_0x1b4d2f(++_0x227119);}(_0xd8d8,0x1b2));var _0x8d8d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd8d8[_0x21a9d9];return _0x46adce;};'use strict';var BPromise=require(_0x8d8d('0x0'));var server=require(_0x8d8d('0x1'));var Realtime=require('./realtime');var user=require(_0x8d8d('0x2'));var interval=require(_0x8d8d('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x8d8d('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x8d8d('0x5'));var faxQueue=require(_0x8d8d('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x8d8d('0x7')]()[_0x8d8d('0x8')](user['getAgents']())[_0x8d8d('0x8')](realtime[_0x8d8d('0x9')]())['then'](interval[_0x8d8d('0xa')]())[_0x8d8d('0x8')](realtime[_0x8d8d('0xb')]())[_0x8d8d('0x8')](openchannelQueue[_0x8d8d('0xc')]())[_0x8d8d('0x8')](realtime[_0x8d8d('0xd')]())[_0x8d8d('0x8')](chatQueue[_0x8d8d('0xe')]())[_0x8d8d('0x8')](realtime[_0x8d8d('0xf')]())[_0x8d8d('0x8')](smsQueue[_0x8d8d('0x10')]())[_0x8d8d('0x8')](realtime[_0x8d8d('0x11')]())[_0x8d8d('0x8')](mailQueue[_0x8d8d('0x12')]())[_0x8d8d('0x8')](realtime[_0x8d8d('0x13')]())['then'](faxQueue[_0x8d8d('0x14')]())[_0x8d8d('0x8')](realtime[_0x8d8d('0x15')]())[_0x8d8d('0x8')](whatsappQueue['getWhatsappQueues']())[_0x8d8d('0x8')](realtime[_0x8d8d('0x16')]())[_0x8d8d('0x8')](function(){return realtime;});}function main(){return server[_0x8d8d('0x17')](realtime)[_0x8d8d('0x8')](function(_0x20e5c6){return initRealtime();})[_0x8d8d('0x8')](function(_0x1e8bf6){return setInterval(initRealtime,0x1388);})[_0x8d8d('0x18')](function(_0x1bac30){console[_0x8d8d('0x19')](_0x1bac30);});}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 d3e3390..2503bde 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4f6610,_0x11d9ae){var _0x44e7d3=function(_0x1c9b2f){while(--_0x1c9b2f){_0x4f6610['push'](_0x4f6610['shift']());}};_0x44e7d3(++_0x11d9ae);}(_0x326f,0xd1));var _0xf326=function(_0x35305d,_0x36568e){_0x35305d=_0x35305d-0x0;var _0x1aeb51=_0x326f[_0x35305d];return _0x1aeb51;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x11e323,_0x4750e4){_0x11e323=_0x11e323-0x0;var _0x391751=_0x1261[_0x11e323];return _0x391751;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index f08257e..b60085d 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 _0x66cf=['request','error','message','result','SendMail','bluebird','jayson/promise','client','http'];(function(_0x26234f,_0xff06f1){var _0x2e65ed=function(_0x55a179){while(--_0x55a179){_0x26234f['push'](_0x26234f['shift']());}};_0x2e65ed(++_0xff06f1);}(_0x66cf,0x101));var _0xf66c=function(_0x109bfc,_0x299326){_0x109bfc=_0x109bfc-0x0;var _0x1d957c=_0x66cf[_0x109bfc];return _0x1d957c;};'use strict';var BPromise=require(_0xf66c('0x0'));var jayson=require(_0xf66c('0x1'));var client=jayson[_0xf66c('0x2')][_0xf66c('0x3')]({'port':0x232b});function request(_0x3ff64b,_0x2eaa0c){return new BPromise(function(_0x2d6080,_0x5b502b){return client[_0xf66c('0x4')](_0x3ff64b,_0x2eaa0c)['then'](function(_0x2cacbf){if(_0x2cacbf[_0xf66c('0x5')]){return _0x5b502b(_0x2cacbf['error'][_0xf66c('0x6')]);}else{return _0x2d6080(_0x2cacbf[_0xf66c('0x7')]);}})['catch'](function(_0x14b671){return _0x5b502b(_0x14b671);});});}exports['sendMailMessage']=function(_0x298c5d,_0x5eecc2){return request(_0xf66c('0x8'),{'account':_0x298c5d,'message':_0x5eecc2});}; \ No newline at end of file +var _0xbb9b=['client','request','then','error','result','catch','sendMailMessage','bluebird'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0xbb9b,0x8f));var _0xbbb9=function(_0x332632,_0xf7ad49){_0x332632=_0x332632-0x0;var _0x199ffb=_0xbb9b[_0x332632];return _0x199ffb;};'use strict';var BPromise=require(_0xbbb9('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xbbb9('0x1')]['http']({'port':0x232b});function request(_0x26f865,_0x444b38){return new BPromise(function(_0x3b4a10,_0x3e5483){return client[_0xbbb9('0x2')](_0x26f865,_0x444b38)[_0xbbb9('0x3')](function(_0x13cc8e){if(_0x13cc8e[_0xbbb9('0x4')]){return _0x3e5483(_0x13cc8e[_0xbbb9('0x4')]['message']);}else{return _0x3b4a10(_0x13cc8e[_0xbbb9('0x5')]);}})[_0xbbb9('0x6')](function(_0xd70c1e){return _0x3e5483(_0xd70c1e);});});}exports[_0xbbb9('0x7')]=function(_0x5510da,_0x26d619){return request('SendMail',{'account':_0x5510da,'message':_0x26d619});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 933f6e1..6573d15 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 _0x5014=['voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','md5','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','fax','whatsapp','getChannelStatus','Status','StatusTime','toNumber','format','smsStatus','whatsappStatusTime','openchannelStatusTime','busyQueue','stringify','user:save','exports','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online'];(function(_0x305ab4,_0x2d91a4){var _0x4c8e05=function(_0x21419c){while(--_0x21419c){_0x305ab4['push'](_0x305ab4['shift']());}};_0x4c8e05(++_0x2d91a4);}(_0x5014,0x1d7));var _0x4501=function(_0x310d80,_0x350219){_0x310d80=_0x310d80-0x0;var _0x211642=_0x5014[_0x310d80];return _0x211642;};'use strict';var _=require('lodash');var moment=require(_0x4501('0x0'));var md5=require('md5');var Redis=require(_0x4501('0x1'));var config=require(_0x4501('0x2'));config[_0x4501('0x3')]=_[_0x4501('0x4')](config[_0x4501('0x3')],{'host':_0x4501('0x5'),'port':0x18eb});var io=require(_0x4501('0x6'))(new Redis(config[_0x4501('0x3')]));function Agent(_0x5cbe99){this['id']=_0x5cbe99['id']||0x0;this[_0x4501('0x7')]=_0x5cbe99['name']||'';this[_0x4501('0x8')]=_0x5cbe99[_0x4501('0x8')]||!![];this[_0x4501('0x9')]=_0x5cbe99[_0x4501('0x9')]||![];this[_0x4501('0xa')]=_0x5cbe99['chatPause']||![];this[_0x4501('0xb')]=_0x5cbe99[_0x4501('0xb')]||![];this[_0x4501('0xc')]=_0x5cbe99[_0x4501('0xc')]||![];this[_0x4501('0xd')]=_0x5cbe99['smsPause']||![];this[_0x4501('0xe')]=_0x5cbe99[_0x4501('0xe')]||![];this[_0x4501('0xf')]='unknown';this[_0x4501('0x10')]=0x0;this['chatCapacity']=_0x5cbe99[_0x4501('0x11')]||0x0;this[_0x4501('0x12')]=0x0;this[_0x4501('0x13')]='unknown';this[_0x4501('0x14')]=0x0;this['mailCapacity']=_0x5cbe99[_0x4501('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x4501('0x16')]=_0x4501('0x17');this[_0x4501('0x18')]=0x0;this[_0x4501('0x19')]=_0x5cbe99[_0x4501('0x19')]||0x0;this[_0x4501('0x1a')]=0x0;this['smsStatus']=_0x4501('0x17');this[_0x4501('0x1b')]=0x0;this['smsCapacity']=_0x5cbe99[_0x4501('0x1c')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x4501('0x1d')]=_0x4501('0x17');this['whatsappStatusTime']=0x0;this[_0x4501('0x1e')]=_0x5cbe99[_0x4501('0x1e')]||0x0;this[_0x4501('0x1f')]=0x0;this[_0x4501('0x20')]=_0x4501('0x17');this['openchannelStatusTime']=0x0;this[_0x4501('0x21')]=_0x5cbe99[_0x4501('0x21')]||0x0;this[_0x4501('0x22')]=0x0;this[_0x4501('0x23')]=![];this['busyQueue']=undefined;this[_0x4501('0x24')]='';this['updateRealtime']();}Agent[_0x4501('0x25')]['getChannelStatus']=function(_0xc6de3f){if(this[_0xc6de3f+_0x4501('0x26')]>0x0){if(this[_0xc6de3f+_0x4501('0x27')]>0x0&&this[_0xc6de3f+'CurrentCapacity']>=this[_0xc6de3f+_0x4501('0x27')]){return _0x4501('0x28');}else{return _0x4501('0x29');}}else{return _0x4501('0x2a');}};Agent['prototype'][_0x4501('0x2b')]=function(){var _0x572fcb=['mail',_0x4501('0x2c'),_0x4501('0x2d'),_0x4501('0x2e'),'sms',_0x4501('0x2f')];for(var _0x169c2d=0x0;_0x169c2d<_0x572fcb['length'];_0x169c2d+=0x1){var _0x180e8f=this[_0x4501('0x30')](_0x572fcb[_0x169c2d]);if(this[_0x572fcb[_0x169c2d]+_0x4501('0x31')]!==_0x180e8f){this[_0x572fcb[_0x169c2d]+_0x4501('0x32')]=_[_0x4501('0x33')](moment()[_0x4501('0x34')]('x'));}this[_0x572fcb[_0x169c2d]+'Status']=_0x180e8f;}var _0x434120={'id':this['id'],'name':this['name'],'online':this[_0x4501('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x4501('0xa')],'mailPause':this[_0x4501('0xb')],'smsPause':this[_0x4501('0xd')],'faxPause':this[_0x4501('0xc')],'openchannelPause':this[_0x4501('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x4501('0x11')],'chatCurrentCapacity':this[_0x4501('0x12')],'mailStatus':this[_0x4501('0x13')],'mailStatusTime':this[_0x4501('0x14')],'mailCapacity':this[_0x4501('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x4501('0x16')],'faxStatusTime':this[_0x4501('0x18')],'faxCapacity':this[_0x4501('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x4501('0x35')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x4501('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x4501('0x1d')],'whatsappStatusTime':this[_0x4501('0x36')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x4501('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x4501('0x37')],'openchannelCapacity':this[_0x4501('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x4501('0x23')],'busyQueue':this[_0x4501('0x38')]};var _0x49bf13=md5(JSON[_0x4501('0x39')](_0x434120));if(this[_0x4501('0x24')]!==_0x49bf13){this[_0x4501('0x24')]=_0x49bf13;io['emit'](_0x4501('0x3a'),_0x434120);}};module[_0x4501('0x3b')]=Agent; \ No newline at end of file +var _0xaedf=['whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','sms','whatsapp','getChannelStatus','Status','StatusTime','toNumber','format','mailCurrentCapacity','busyQueue','stringify','emit','user:save','exports','lodash','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime'];(function(_0xb02e6a,_0x1f31fe){var _0x3cb6bc=function(_0xae2b99){while(--_0xae2b99){_0xb02e6a['push'](_0xb02e6a['shift']());}};_0x3cb6bc(++_0x1f31fe);}(_0xaedf,0x13e));var _0xfaed=function(_0x260268,_0x52186a){_0x260268=_0x260268-0x0;var _0x3d7974=_0xaedf[_0x260268];return _0x3d7974;};'use strict';var _=require(_0xfaed('0x0'));var moment=require('moment');var md5=require(_0xfaed('0x1'));var Redis=require(_0xfaed('0x2'));var config=require('../../../config/environment');config[_0xfaed('0x3')]=_[_0xfaed('0x4')](config[_0xfaed('0x3')],{'host':_0xfaed('0x5'),'port':0x18eb});var io=require(_0xfaed('0x6'))(new Redis(config[_0xfaed('0x3')]));function Agent(_0x5748d7){this['id']=_0x5748d7['id']||0x0;this['name']=_0x5748d7[_0xfaed('0x7')]||'';this['online']=_0x5748d7[_0xfaed('0x8')]||!![];this[_0xfaed('0x9')]=_0x5748d7[_0xfaed('0x9')]||![];this['chatPause']=_0x5748d7[_0xfaed('0xa')]||![];this['mailPause']=_0x5748d7[_0xfaed('0xb')]||![];this[_0xfaed('0xc')]=_0x5748d7[_0xfaed('0xc')]||![];this[_0xfaed('0xd')]=_0x5748d7['smsPause']||![];this['openchannelPause']=_0x5748d7['openchannelPause']||![];this[_0xfaed('0xe')]=_0xfaed('0xf');this[_0xfaed('0x10')]=0x0;this[_0xfaed('0x11')]=_0x5748d7['chatCapacity']||0x0;this[_0xfaed('0x12')]=0x0;this[_0xfaed('0x13')]=_0xfaed('0xf');this[_0xfaed('0x14')]=0x0;this[_0xfaed('0x15')]=_0x5748d7[_0xfaed('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0xfaed('0x16')]=0x0;this[_0xfaed('0x17')]=_0x5748d7['faxCapacity']||0x0;this[_0xfaed('0x18')]=0x0;this[_0xfaed('0x19')]=_0xfaed('0xf');this[_0xfaed('0x1a')]=0x0;this['smsCapacity']=_0x5748d7[_0xfaed('0x1b')]||0x0;this[_0xfaed('0x1c')]=0x0;this['whatsappStatus']=_0xfaed('0xf');this[_0xfaed('0x1d')]=0x0;this[_0xfaed('0x1e')]=_0x5748d7[_0xfaed('0x1e')]||0x0;this[_0xfaed('0x1f')]=0x0;this['openchannelStatus']=_0xfaed('0xf');this[_0xfaed('0x20')]=0x0;this[_0xfaed('0x21')]=_0x5748d7[_0xfaed('0x21')]||0x0;this[_0xfaed('0x22')]=0x0;this[_0xfaed('0x23')]=![];this['busyQueue']=undefined;this[_0xfaed('0x1')]='';this[_0xfaed('0x24')]();}Agent['prototype']['getChannelStatus']=function(_0x58ea25){if(this[_0x58ea25+_0xfaed('0x25')]>0x0){if(this[_0x58ea25+_0xfaed('0x26')]>0x0&&this[_0x58ea25+_0xfaed('0x25')]>=this[_0x58ea25+_0xfaed('0x26')]){return _0xfaed('0x27');}else{return _0xfaed('0x28');}}else{return _0xfaed('0x29');}};Agent['prototype']['updateRealtime']=function(){var _0x2a37da=[_0xfaed('0x2a'),_0xfaed('0x2b'),_0xfaed('0x2c'),'fax',_0xfaed('0x2d'),_0xfaed('0x2e')];for(var _0x1fa132=0x0;_0x1fa132<_0x2a37da['length'];_0x1fa132+=0x1){var _0x176aaf=this[_0xfaed('0x2f')](_0x2a37da[_0x1fa132]);if(this[_0x2a37da[_0x1fa132]+_0xfaed('0x30')]!==_0x176aaf){this[_0x2a37da[_0x1fa132]+_0xfaed('0x31')]=_[_0xfaed('0x32')](moment()[_0xfaed('0x33')]('x'));}this[_0x2a37da[_0x1fa132]+_0xfaed('0x30')]=_0x176aaf;}var _0x5ee3a2={'id':this['id'],'name':this[_0xfaed('0x7')],'online':this[_0xfaed('0x8')],'voicePause':this[_0xfaed('0x9')],'chatPause':this[_0xfaed('0xa')],'mailPause':this[_0xfaed('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0xfaed('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xfaed('0xe')],'chatStatusTime':this[_0xfaed('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xfaed('0x12')],'mailStatus':this[_0xfaed('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xfaed('0x34')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xfaed('0x17')],'faxCurrentCapacity':this[_0xfaed('0x18')],'smsStatus':this[_0xfaed('0x19')],'smsStatusTime':this[_0xfaed('0x1a')],'smsCapacity':this[_0xfaed('0x1b')],'smsCurrentCapacity':this[_0xfaed('0x1c')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xfaed('0x1d')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xfaed('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xfaed('0x20')],'openchannelCapacity':this[_0xfaed('0x21')],'openchannelCurrentCapacity':this[_0xfaed('0x22')],'busy':this[_0xfaed('0x23')],'busyQueue':this[_0xfaed('0x35')]};var _0x4d5073=md5(JSON[_0xfaed('0x36')](_0x5ee3a2));if(this[_0xfaed('0x1')]!==_0x4d5073){this['md5']=_0x4d5073;io[_0xfaed('0x37')](_0xfaed('0x38'),_0x5ee3a2);}};module[_0xfaed('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index eaebf4e..a53b990 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 _0x6d09=['available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','md5','ioredis','redis','defaults','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','chatPause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d09,0x1dc));var _0x96d0=function(_0x5ae9b5,_0x5bebb5){_0x5ae9b5=_0x5ae9b5-0x0;var _0x551281=_0x6d09[_0x5ae9b5];return _0x551281;};'use strict';var _=require('lodash');var md5=require(_0x96d0('0x0'));var util=require('util');var Redis=require(_0x96d0('0x1'));var config=require('../../../config/environment');config[_0x96d0('0x2')]=_[_0x96d0('0x3')](config[_0x96d0('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x151cf1){this['id']=_0x151cf1['id']||0x0;this[_0x96d0('0x4')]=_0x151cf1[_0x96d0('0x4')]||'';this['timeout']=_0x151cf1[_0x96d0('0x5')]||0xa;this[_0x96d0('0x6')]=_0x151cf1[_0x96d0('0x6')]||'beepall';this[_0x96d0('0x7')]=_0x151cf1['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x96d0('0x0')]='';this[_0x96d0('0x8')]();this[_0x96d0('0x9')]();}ChatQueue[_0x96d0('0xa')]['updateRouting']=function(){var _0x23a514=this[_0x96d0('0xb')][_0x96d0('0xc')];this['mapAgentsId']=_[_0x96d0('0xd')](this[_0x96d0('0x7')],'id');this[_0x96d0('0xb')][_0x96d0('0xc')]=_0x23a514;};ChatQueue[_0x96d0('0xa')][_0x96d0('0x9')]=function(){this[_0x96d0('0xe')]=0x0;this[_0x96d0('0xf')]=0x0;for(var _0x5d1e8e=0x0;_0x5d1e8e=0x0?this[_0x96d0('0x12')]:0x0;var _0x5829f9={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x96d0('0xf')],'waiting':this[_0x96d0('0x13')]};var _0x27cb48=md5(JSON[_0x96d0('0x14')](_0x5829f9));if(this[_0x96d0('0x0')]!==_0x27cb48){this['md5']=_0x27cb48;io['to'](util[_0x96d0('0x15')](_0x96d0('0x16'),_0x5829f9['name']))[_0x96d0('0x17')](_0x96d0('0x18'),_0x5829f9);}};module[_0x96d0('0x19')]=ChatQueue; \ No newline at end of file +var _0x364f=['stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','chatPause','available','waiting'];(function(_0x3dc9dc,_0x232d61){var _0x100498=function(_0x208804){while(--_0x208804){_0x3dc9dc['push'](_0x3dc9dc['shift']());}};_0x100498(++_0x232d61);}(_0x364f,0x144));var _0xf364=function(_0x38231c,_0x1a5931){_0x38231c=_0x38231c-0x0;var _0x5be4e8=_0x364f[_0x38231c];return _0x5be4e8;};'use strict';var _=require(_0xf364('0x0'));var md5=require(_0xf364('0x1'));var util=require(_0xf364('0x2'));var Redis=require(_0xf364('0x3'));var config=require(_0xf364('0x4'));config['redis']=_[_0xf364('0x5')](config[_0xf364('0x6')],{'host':_0xf364('0x7'),'port':0x18eb});var io=require(_0xf364('0x8'))(new Redis(config['redis']));function ChatQueue(_0x3ccf55){this['id']=_0x3ccf55['id']||0x0;this[_0xf364('0x9')]=_0x3ccf55[_0xf364('0x9')]||'';this[_0xf364('0xa')]=_0x3ccf55['timeout']||0xa;this[_0xf364('0xb')]=_0x3ccf55[_0xf364('0xb')]||'beepall';this[_0xf364('0xc')]=_0x3ccf55[_0xf364('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xf364('0x1')]='';this['updateRouting']();this[_0xf364('0xd')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x298b98=this['mapAgentsId'][_0xf364('0xe')];this['mapAgentsId']=_[_0xf364('0xf')](this[_0xf364('0xc')],'id');this['mapAgentsId'][_0xf364('0xe')]=_0x298b98;};ChatQueue[_0xf364('0x10')]['updateRealtime']=function(){this[_0xf364('0x11')]=0x0;this[_0xf364('0x12')]=0x0;for(var _0x754fcd=0x0;_0x754fcd=0x0?this['available']:0x0;var _0x103151={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf364('0x11')],'name':this[_0xf364('0x9')],'paused':this[_0xf364('0x12')],'waiting':this[_0xf364('0x17')]};var _0x2e3095=md5(JSON[_0xf364('0x18')](_0x103151));if(this[_0xf364('0x1')]!==_0x2e3095){this[_0xf364('0x1')]=_0x2e3095;io['to'](util[_0xf364('0x19')](_0xf364('0x1a'),_0x103151['name']))['emit'](_0xf364('0x1b'),_0x103151);}};module[_0xf364('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 5556704..544a274 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 _0x51d6=['md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','faxPause','paused','available','waiting','stringify','format','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','beepall','Agents','mapAgentsId'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0x51d6,0x13e));var _0x651d=function(_0x249938,_0x675ebc){_0x249938=_0x249938-0x0;var _0x344da2=_0x51d6[_0x249938];return _0x344da2;};'use strict';var _=require(_0x651d('0x0'));var md5=require('md5');var util=require(_0x651d('0x1'));var Redis=require(_0x651d('0x2'));var config=require(_0x651d('0x3'));config['redis']=_[_0x651d('0x4')](config[_0x651d('0x5')],{'host':_0x651d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x651d('0x5')]));function FaxQueue(_0x2ec698){this['id']=_0x2ec698['id']||0x0;this[_0x651d('0x7')]=_0x2ec698[_0x651d('0x7')]||'';this[_0x651d('0x8')]=_0x2ec698[_0x651d('0x8')]||0xa;this['strategy']=_0x2ec698['strategy']||_0x651d('0x9');this[_0x651d('0xa')]=_0x2ec698[_0x651d('0xa')];this[_0x651d('0xb')]={};this['waiting']=0x0;this[_0x651d('0xc')]='';this[_0x651d('0xd')]();this['updateRealtime']();}FaxQueue[_0x651d('0xe')][_0x651d('0xd')]=function(){var _0x16caf6=this[_0x651d('0xb')][_0x651d('0xf')];this[_0x651d('0xb')]=_[_0x651d('0x10')](this[_0x651d('0xa')],'id');this['mapAgentsId'][_0x651d('0xf')]=_0x16caf6;};FaxQueue[_0x651d('0xe')][_0x651d('0x11')]=function(){this[_0x651d('0x12')]=0x0;this['paused']=0x0;for(var _0x2ab0db=0x0;_0x2ab0db=0x0?this[_0x651d('0x17')]:0x0;var _0x3b3765={'id':this['id'],'available':this[_0x651d('0x17')],'loggedIn':this[_0x651d('0x12')],'name':this[_0x651d('0x7')],'paused':this[_0x651d('0x16')],'waiting':this[_0x651d('0x18')]};var _0x2628bf=md5(JSON[_0x651d('0x19')](_0x3b3765));if(this['md5']!==_0x2628bf){this['md5']=_0x2628bf;io['to'](util[_0x651d('0x1a')]('fax:queue:%s',_0x3b3765[_0x651d('0x7')]))[_0x651d('0x1b')](_0x651d('0x1c'),_0x3b3765);}};module[_0x651d('0x1d')]=FaxQueue; \ No newline at end of file +var _0x7197=['loggedIn','paused','length','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','beepall','Agents','waiting','md5','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map'];(function(_0x58c751,_0x51f93b){var _0x20de19=function(_0x44f921){while(--_0x44f921){_0x58c751['push'](_0x58c751['shift']());}};_0x20de19(++_0x51f93b);}(_0x7197,0x176));var _0x7719=function(_0xca7f85,_0x1923b4){_0xca7f85=_0xca7f85-0x0;var _0x2e6ab0=_0x7197[_0xca7f85];return _0x2e6ab0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x7719('0x0'));var Redis=require('ioredis');var config=require(_0x7719('0x1'));config['redis']=_[_0x7719('0x2')](config['redis'],{'host':_0x7719('0x3'),'port':0x18eb});var io=require(_0x7719('0x4'))(new Redis(config[_0x7719('0x5')]));function FaxQueue(_0x286ada){this['id']=_0x286ada['id']||0x0;this[_0x7719('0x6')]=_0x286ada['name']||'';this[_0x7719('0x7')]=_0x286ada[_0x7719('0x7')]||0xa;this['strategy']=_0x286ada['strategy']||_0x7719('0x8');this[_0x7719('0x9')]=_0x286ada[_0x7719('0x9')];this['mapAgentsId']={};this[_0x7719('0xa')]=0x0;this[_0x7719('0xb')]='';this['updateRouting']();this[_0x7719('0xc')]();}FaxQueue[_0x7719('0xd')][_0x7719('0xe')]=function(){var _0x34f1b7=this[_0x7719('0xf')][_0x7719('0x10')];this[_0x7719('0xf')]=_[_0x7719('0x11')](this[_0x7719('0x9')],'id');this['mapAgentsId'][_0x7719('0x10')]=_0x34f1b7;};FaxQueue['prototype'][_0x7719('0xc')]=function(){this[_0x7719('0x12')]=0x0;this[_0x7719('0x13')]=0x0;for(var _0x3a246c=0x0;_0x3a246c=0x0?this[_0x7719('0x16')]:0x0;var _0x3a97b6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7719('0x12')],'name':this[_0x7719('0x6')],'paused':this[_0x7719('0x13')],'waiting':this['waiting']};var _0x375856=md5(JSON[_0x7719('0x17')](_0x3a97b6));if(this[_0x7719('0xb')]!==_0x375856){this['md5']=_0x375856;io['to'](util[_0x7719('0x18')](_0x7719('0x19'),_0x3a97b6[_0x7719('0x6')]))['emit'](_0x7719('0x1a'),_0x3a97b6);}};module[_0x7719('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 7d6bbe8..3998f04 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 _0x91e7=['Intervals','name'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x91e7,0xa9));var _0x791e=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x91e7[_0x2d4421];return _0x2d3b01;};'use strict';function Interval(_0x418155){this['id']=_0x418155['id']||0x0;this['name']=_0x418155[_0x791e('0x0')]||'';this['Intervals']=_0x418155[_0x791e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x6991=['exports','name'];(function(_0x185702,_0xced49d){var _0x2b80ee=function(_0x4b58ca){while(--_0x4b58ca){_0x185702['push'](_0x185702['shift']());}};_0x2b80ee(++_0xced49d);}(_0x6991,0x95));var _0x1699=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x6991[_0x43d11d];return _0x38cd08;};'use strict';function Interval(_0x31ce6e){this['id']=_0x31ce6e['id']||0x0;this['name']=_0x31ce6e[_0x1699('0x0')]||'';this['Intervals']=_0x31ce6e['Intervals']||{};}module[_0x1699('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 56b1ba0..b57003f 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 _0xbf05=['map','loggedIn','paused','online','available','format','emit','mail_queue:save','exports','lodash','md5','ioredis','defaults','localhost','redis','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x5b7b8e,_0x25e8b5){var _0x179029=function(_0x87cff6){while(--_0x87cff6){_0x5b7b8e['push'](_0x5b7b8e['shift']());}};_0x179029(++_0x25e8b5);}(_0xbf05,0x6d));var _0x5bf0=function(_0x253fe1,_0x5a780d){_0x253fe1=_0x253fe1-0x0;var _0x4fea01=_0xbf05[_0x253fe1];return _0x4fea01;};'use strict';var _=require(_0x5bf0('0x0'));var md5=require(_0x5bf0('0x1'));var util=require('util');var Redis=require(_0x5bf0('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x5bf0('0x3')](config['redis'],{'host':_0x5bf0('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bf0('0x5')]));function MailQueue(_0x51c742){this['id']=_0x51c742['id']||0x0;this[_0x5bf0('0x6')]=_0x51c742[_0x5bf0('0x6')]||'';this['timeout']=_0x51c742['timeout']||0xa;this['strategy']=_0x51c742[_0x5bf0('0x7')]||_0x5bf0('0x8');this[_0x5bf0('0x9')]=_0x51c742['Agents'];this[_0x5bf0('0xa')]={};this[_0x5bf0('0xb')]=0x0;this[_0x5bf0('0x1')]='';this[_0x5bf0('0xc')]();this[_0x5bf0('0xd')]();}MailQueue[_0x5bf0('0xe')][_0x5bf0('0xc')]=function(){var _0x129667=this[_0x5bf0('0xa')][_0x5bf0('0xf')];this[_0x5bf0('0xa')]=_[_0x5bf0('0x10')](this['Agents'],'id');this[_0x5bf0('0xa')][_0x5bf0('0xf')]=_0x129667;};MailQueue[_0x5bf0('0xe')][_0x5bf0('0xd')]=function(){this[_0x5bf0('0x11')]=0x0;this[_0x5bf0('0x12')]=0x0;for(var _0x238d41=0x0;_0x238d41=0x0?this[_0x5bf0('0x14')]:0x0;var _0x44b15b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5bf0('0x11')],'name':this[_0x5bf0('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x4b642e=md5(JSON['stringify'](_0x44b15b));if(this[_0x5bf0('0x1')]!==_0x4b642e){this[_0x5bf0('0x1')]=_0x4b642e;io['to'](util[_0x5bf0('0x15')]('mail:queue:%s',_0x44b15b[_0x5bf0('0x6')]))[_0x5bf0('0x16')](_0x5bf0('0x17'),_0x44b15b);}};module[_0x5bf0('0x18')]=MailQueue; \ No newline at end of file +var _0xcdf4=['waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','length','available','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','strategy','beepall','Agents','mapAgentsId'];(function(_0xe7e4c4,_0x597c24){var _0x4a6c48=function(_0x23d114){while(--_0x23d114){_0xe7e4c4['push'](_0xe7e4c4['shift']());}};_0x4a6c48(++_0x597c24);}(_0xcdf4,0x8a));var _0x4cdf=function(_0x502c7d,_0x4a47e2){_0x502c7d=_0x502c7d-0x0;var _0x127556=_0xcdf4[_0x502c7d];return _0x127556;};'use strict';var _=require('lodash');var md5=require(_0x4cdf('0x0'));var util=require(_0x4cdf('0x1'));var Redis=require(_0x4cdf('0x2'));var config=require(_0x4cdf('0x3'));config['redis']=_[_0x4cdf('0x4')](config[_0x4cdf('0x5')],{'host':_0x4cdf('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4cdf('0x5')]));function MailQueue(_0x4afc3f){this['id']=_0x4afc3f['id']||0x0;this[_0x4cdf('0x7')]=_0x4afc3f[_0x4cdf('0x7')]||'';this['timeout']=_0x4afc3f['timeout']||0xa;this[_0x4cdf('0x8')]=_0x4afc3f[_0x4cdf('0x8')]||_0x4cdf('0x9');this[_0x4cdf('0xa')]=_0x4afc3f['Agents'];this[_0x4cdf('0xb')]={};this[_0x4cdf('0xc')]=0x0;this[_0x4cdf('0x0')]='';this['updateRouting']();this[_0x4cdf('0xd')]();}MailQueue[_0x4cdf('0xe')][_0x4cdf('0xf')]=function(){var _0x482508=this[_0x4cdf('0xb')]['_rr'];this[_0x4cdf('0xb')]=_[_0x4cdf('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x4cdf('0x11')]=_0x482508;};MailQueue['prototype'][_0x4cdf('0xd')]=function(){this[_0x4cdf('0x12')]=0x0;this[_0x4cdf('0x13')]=0x0;for(var _0x30a7c3=0x0;_0x30a7c3=0x0?this[_0x4cdf('0x15')]:0x0;var _0x2472e5={'id':this['id'],'available':this[_0x4cdf('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x4cdf('0x7')],'paused':this[_0x4cdf('0x13')],'waiting':this[_0x4cdf('0xc')]};var _0x89c039=md5(JSON['stringify'](_0x2472e5));if(this[_0x4cdf('0x0')]!==_0x89c039){this[_0x4cdf('0x0')]=_0x89c039;io['to'](util['format']('mail:queue:%s',_0x2472e5[_0x4cdf('0x7')]))[_0x4cdf('0x16')](_0x4cdf('0x17'),_0x2472e5);}};module[_0x4cdf('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 78ed648..1219ba4 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(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x2ef3,0xba));var _0x32ef=function(_0x16a837,_0x51bece){_0x16a837=_0x16a837-0x0;var _0x1ef5b9=_0x2ef3[_0x16a837];return _0x1ef5b9;};'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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x3aff71,_0x493a7c){var _0x23b3ed=function(_0x301210){while(--_0x301210){_0x3aff71['push'](_0x3aff71['shift']());}};_0x23b3ed(++_0x493a7c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x5fc3[_0x163040];return _0x364667;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 57623de..043478a 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 _0xb49a=['loggedIn','paused','online','smsPause','available','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr'];(function(_0x26dd46,_0x5f5abc){var _0x28a19e=function(_0x49f403){while(--_0x49f403){_0x26dd46['push'](_0x26dd46['shift']());}};_0x28a19e(++_0x5f5abc);}(_0xb49a,0xfb));var _0xab49=function(_0x2b7675,_0x5969c9){_0x2b7675=_0x2b7675-0x0;var _0x4c4f97=_0xb49a[_0x2b7675];return _0x4c4f97;};'use strict';var _=require(_0xab49('0x0'));var md5=require(_0xab49('0x1'));var util=require(_0xab49('0x2'));var Redis=require(_0xab49('0x3'));var config=require(_0xab49('0x4'));config['redis']=_[_0xab49('0x5')](config[_0xab49('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xab49('0x6')]));function SmsQueue(_0x287cd5){this['id']=_0x287cd5['id']||0x0;this[_0xab49('0x7')]=_0x287cd5[_0xab49('0x7')]||'';this[_0xab49('0x8')]=_0x287cd5[_0xab49('0x8')]||0xa;this[_0xab49('0x9')]=_0x287cd5['strategy']||_0xab49('0xa');this[_0xab49('0xb')]=_0x287cd5[_0xab49('0xb')];this[_0xab49('0xc')]={};this[_0xab49('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0xab49('0xe')]();}SmsQueue[_0xab49('0xf')][_0xab49('0x10')]=function(){var _0x126f00=this[_0xab49('0xc')]['_rr'];this[_0xab49('0xc')]=_[_0xab49('0x11')](this[_0xab49('0xb')],'id');this[_0xab49('0xc')][_0xab49('0x12')]=_0x126f00;};SmsQueue[_0xab49('0xf')][_0xab49('0xe')]=function(){this[_0xab49('0x13')]=0x0;this[_0xab49('0x14')]=0x0;for(var _0x389ebb=0x0;_0x389ebb=0x0?this['available']:0x0;var _0x167a2a={'id':this['id'],'available':this[_0xab49('0x17')],'loggedIn':this[_0xab49('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xab49('0xd')]};var _0xa039ed=md5(JSON['stringify'](_0x167a2a));if(this[_0xab49('0x1')]!==_0xa039ed){this[_0xab49('0x1')]=_0xa039ed;io['to'](util['format'](_0xab49('0x18'),_0x167a2a['name']))[_0xab49('0x19')](_0xab49('0x1a'),_0x167a2a);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x04d0=['_rr','updateRealtime','loggedIn','paused','length','online','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','exports','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','md5','updateRouting','prototype'];(function(_0x3b17ee,_0x354bb2){var _0x48be1a=function(_0x8a35db){while(--_0x8a35db){_0x3b17ee['push'](_0x3b17ee['shift']());}};_0x48be1a(++_0x354bb2);}(_0x04d0,0x10a));var _0x004d=function(_0x15547f,_0xa20a9d){_0x15547f=_0x15547f-0x0;var _0x2f2774=_0x04d0[_0x15547f];return _0x2f2774;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x004d('0x0'));var Redis=require(_0x004d('0x1'));var config=require(_0x004d('0x2'));config[_0x004d('0x3')]=_[_0x004d('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x004d('0x5'))(new Redis(config['redis']));function SmsQueue(_0x293199){this['id']=_0x293199['id']||0x0;this[_0x004d('0x6')]=_0x293199['name']||'';this[_0x004d('0x7')]=_0x293199[_0x004d('0x7')]||0xa;this['strategy']=_0x293199[_0x004d('0x8')]||'beepall';this[_0x004d('0x9')]=_0x293199[_0x004d('0x9')];this[_0x004d('0xa')]={};this['waiting']=0x0;this[_0x004d('0xb')]='';this[_0x004d('0xc')]();this['updateRealtime']();}SmsQueue[_0x004d('0xd')]['updateRouting']=function(){var _0x2ffdd2=this[_0x004d('0xa')]['_rr'];this[_0x004d('0xa')]=_['map'](this[_0x004d('0x9')],'id');this[_0x004d('0xa')][_0x004d('0xe')]=_0x2ffdd2;};SmsQueue[_0x004d('0xd')][_0x004d('0xf')]=function(){this[_0x004d('0x10')]=0x0;this[_0x004d('0x11')]=0x0;for(var _0x32e867=0x0;_0x32e867=0x0?this['available']:0x0;var _0x1adf2a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x004d('0x10')],'name':this[_0x004d('0x6')],'paused':this[_0x004d('0x11')],'waiting':this[_0x004d('0x16')]};var _0x5696a5=md5(JSON[_0x004d('0x17')](_0x1adf2a));if(this[_0x004d('0xb')]!==_0x5696a5){this['md5']=_0x5696a5;io['to'](util[_0x004d('0x18')](_0x004d('0x19'),_0x1adf2a[_0x004d('0x6')]))[_0x004d('0x1a')]('sms_queue:save',_0x1adf2a);}};module[_0x004d('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b7bf524..16391de 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 _0xaaaa=['updateRouting','updateRealtime','_rr','map','loggedIn','length','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x441c74,_0x41962b){var _0x47f9ce=function(_0x4ceff5){while(--_0x4ceff5){_0x441c74['push'](_0x441c74['shift']());}};_0x47f9ce(++_0x41962b);}(_0xaaaa,0x110));var _0xaaaa=function(_0x88e664,_0x33dfae){_0x88e664=_0x88e664-0x0;var _0x3ae6b4=_0xaaaa[_0x88e664];return _0x3ae6b4;};'use strict';var _=require(_0xaaaa('0x0'));var md5=require(_0xaaaa('0x1'));var util=require(_0xaaaa('0x2'));var Redis=require(_0xaaaa('0x3'));var config=require(_0xaaaa('0x4'));config[_0xaaaa('0x5')]=_[_0xaaaa('0x6')](config[_0xaaaa('0x5')],{'host':_0xaaaa('0x7'),'port':0x18eb});var io=require(_0xaaaa('0x8'))(new Redis(config[_0xaaaa('0x5')]));function WhatsappQueue(_0x4c5e34){this['id']=_0x4c5e34['id']||0x0;this[_0xaaaa('0x9')]=_0x4c5e34['name']||'';this[_0xaaaa('0xa')]=_0x4c5e34[_0xaaaa('0xa')]||0xa;this[_0xaaaa('0xb')]=_0x4c5e34[_0xaaaa('0xb')]||_0xaaaa('0xc');this['Agents']=_0x4c5e34[_0xaaaa('0xd')];this[_0xaaaa('0xe')]={};this[_0xaaaa('0xf')]=0x0;this[_0xaaaa('0x1')]='';this[_0xaaaa('0x10')]();this[_0xaaaa('0x11')]();}WhatsappQueue['prototype'][_0xaaaa('0x10')]=function(){var _0x3bd6a7=this['mapAgentsId'][_0xaaaa('0x12')];this[_0xaaaa('0xe')]=_[_0xaaaa('0x13')](this[_0xaaaa('0xd')],'id');this[_0xaaaa('0xe')][_0xaaaa('0x12')]=_0x3bd6a7;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xaaaa('0x14')]=0x0;this['paused']=0x0;for(var _0x4e1ecc=0x0;_0x4e1ecc=0x0?this['available']:0x0;var _0x550ff4={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xaaaa('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x59cc3e=md5(JSON[_0xaaaa('0x1a')](_0x550ff4));if(this['md5']!==_0x59cc3e){this[_0xaaaa('0x1')]=_0x59cc3e;io['to'](util[_0xaaaa('0x1b')](_0xaaaa('0x1c'),_0x550ff4[_0xaaaa('0x9')]))[_0xaaaa('0x1d')](_0xaaaa('0x1e'),_0x550ff4);}};module[_0xaaaa('0x1f')]=WhatsappQueue; \ No newline at end of file +var _0xb034=['Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','name','timeout','strategy','beepall'];(function(_0x1936f6,_0x47a125){var _0x32e727=function(_0x1ebfe1){while(--_0x1ebfe1){_0x1936f6['push'](_0x1936f6['shift']());}};_0x32e727(++_0x47a125);}(_0xb034,0xb2));var _0x4b03=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0xb034[_0x307086];return _0x699043;};'use strict';var _=require(_0x4b03('0x0'));var md5=require('md5');var util=require(_0x4b03('0x1'));var Redis=require(_0x4b03('0x2'));var config=require(_0x4b03('0x3'));config['redis']=_[_0x4b03('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4b03('0x5'))(new Redis(config[_0x4b03('0x6')]));function WhatsappQueue(_0x133c08){this['id']=_0x133c08['id']||0x0;this[_0x4b03('0x7')]=_0x133c08['name']||'';this[_0x4b03('0x8')]=_0x133c08[_0x4b03('0x8')]||0xa;this[_0x4b03('0x9')]=_0x133c08[_0x4b03('0x9')]||_0x4b03('0xa');this[_0x4b03('0xb')]=_0x133c08[_0x4b03('0xb')];this[_0x4b03('0xc')]={};this[_0x4b03('0xd')]=0x0;this['md5']='';this[_0x4b03('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x4b03('0xf')][_0x4b03('0xe')]=function(){var _0x1e736f=this[_0x4b03('0xc')][_0x4b03('0x10')];this[_0x4b03('0xc')]=_[_0x4b03('0x11')](this[_0x4b03('0xb')],'id');this[_0x4b03('0xc')][_0x4b03('0x10')]=_0x1e736f;};WhatsappQueue['prototype'][_0x4b03('0x12')]=function(){this[_0x4b03('0x13')]=0x0;this[_0x4b03('0x14')]=0x0;for(var _0x3a7d9b=0x0;_0x3a7d9b=0x0?this[_0x4b03('0x16')]:0x0;var _0x4040a0={'id':this['id'],'available':this[_0x4b03('0x16')],'loggedIn':this[_0x4b03('0x13')],'name':this['name'],'paused':this[_0x4b03('0x14')],'waiting':this[_0x4b03('0xd')]};var _0x438fc1=md5(JSON[_0x4b03('0x17')](_0x4040a0));if(this['md5']!==_0x438fc1){this['md5']=_0x438fc1;io['to'](util['format'](_0x4b03('0x18'),_0x4040a0[_0x4b03('0x7')]))[_0x4b03('0x19')](_0x4b03('0x1a'),_0x4040a0);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 94c7605..8496a34 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 470290c..3ed72aa 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 _0x0fe4=['Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3b9f61,_0x28b8b9){var _0x1b893c=function(_0x1632ce){while(--_0x1632ce){_0x3b9f61['push'](_0x3b9f61['shift']());}};_0x1b893c(++_0x28b8b9);}(_0x0fe4,0xad));var _0x40fe=function(_0x52ec3d,_0x1a488a){_0x52ec3d=_0x52ec3d-0x0;var _0x433763=_0x0fe4[_0x52ec3d];return _0x433763;};'use strict';var client=require(_0x40fe('0x0'));exports[_0x40fe('0x1')]=function(_0x34c583,_0x11abce){return client[_0x40fe('0x2')](_0x40fe('0x3'),{'body':_0x11abce,'options':{'where':{'id':_0x34c583}},'log':_0x40fe('0x4')});};exports['addTags']=function(_0x118ffd,_0x2888e7){return client['Request'](_0x40fe('0x5'),{'body':_0x2888e7,'options':{'where':{'id':_0x118ffd}},'log':_0x40fe('0x6')});}; \ No newline at end of file +var _0x9760=['Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x4361b3,_0x1b967c){var _0x110a70=function(_0x3fbc0f){while(--_0x3fbc0f){_0x4361b3['push'](_0x4361b3['shift']());}};_0x110a70(++_0x1b967c);}(_0x9760,0x1ef));var _0x0976=function(_0x29b563,_0x3db9bc){_0x29b563=_0x29b563-0x0;var _0x4504b9=_0x9760[_0x29b563];return _0x4504b9;};'use strict';var client=require(_0x0976('0x0'));exports[_0x0976('0x1')]=function(_0x37679a,_0x368075){return client[_0x0976('0x2')](_0x0976('0x3'),{'body':_0x368075,'options':{'where':{'id':_0x37679a}},'log':_0x0976('0x4')});};exports[_0x0976('0x5')]=function(_0x2957a1,_0x43040e){return client[_0x0976('0x2')]('AddTagsToChatInteraction',{'body':_0x43040e,'options':{'where':{'id':_0x2957a1}},'log':_0x0976('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 22fdefe..e3ed612 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 _0x6be2=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x6be2,0xe4));var _0x26be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x26be('0x0'));exports[_0x26be('0x1')]=function(_0xaeda8a){return client[_0x26be('0x2')](_0x26be('0x3'),{'body':_0xaeda8a,'log':_0x26be('0x4')});}; \ No newline at end of file +var _0x09f4=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x1131ec,_0x51a45a){var _0x146636=function(_0xa0c4ad){while(--_0xa0c4ad){_0x1131ec['push'](_0x1131ec['shift']());}};_0x146636(++_0x51a45a);}(_0x09f4,0xa2));var _0x409f=function(_0x4aad82,_0x415f76){_0x4aad82=_0x4aad82-0x0;var _0x7060ea=_0x09f4[_0x4aad82];return _0x7060ea;};'use strict';var client=require(_0x409f('0x0'));exports[_0x409f('0x1')]=function(_0x1158ca){return client[_0x409f('0x2')](_0x409f('0x3'),{'body':_0x1158ca,'log':_0x409f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2e263be..6684862 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 _0x1f75=['../client','getChatQueues','Request','name','timeout','strategy','User','Agents','online','chatPause'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1f75,0x12c));var _0x51f7=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x1f75[_0x481bf7];return _0x461787;};'use strict';var client=require(_0x51f7('0x0'));exports[_0x51f7('0x1')]=function(){return function(){return client[_0x51f7('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x51f7('0x3'),_0x51f7('0x4'),_0x51f7('0x5')],'include':[{'model':_0x51f7('0x6'),'as':_0x51f7('0x7'),'attributes':['id',_0x51f7('0x3'),_0x51f7('0x8'),_0x51f7('0x9')]}]},'log':_0x51f7('0x1')});};}; \ No newline at end of file +var _0x46fc=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents','chatPause','../client'];(function(_0x51b6f6,_0x2d2e63){var _0x5bbc42=function(_0x2fb131){while(--_0x2fb131){_0x51b6f6['push'](_0x51b6f6['shift']());}};_0x5bbc42(++_0x2d2e63);}(_0x46fc,0x103));var _0xc46f=function(_0x210f2f,_0x4951a0){_0x210f2f=_0x210f2f-0x0;var _0x56f3b3=_0x46fc[_0x210f2f];return _0x56f3b3;};'use strict';var client=require(_0xc46f('0x0'));exports[_0xc46f('0x1')]=function(){return function(){return client[_0xc46f('0x2')](_0xc46f('0x3'),{'options':{'raw':![],'attributes':['id',_0xc46f('0x4'),_0xc46f('0x5'),_0xc46f('0x6')],'include':[{'model':_0xc46f('0x7'),'as':_0xc46f('0x8'),'attributes':['id','name','online',_0xc46f('0x9')]}]},'log':_0xc46f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index da12bc4..40badae 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 _0x2029=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x3c5a2c,_0xd3a687){var _0x41d3ba=function(_0x37b949){while(--_0x37b949){_0x3c5a2c['push'](_0x3c5a2c['shift']());}};_0x41d3ba(++_0xd3a687);}(_0x2029,0x171));var _0x9202=function(_0x12c581,_0x415a8b){_0x12c581=_0x12c581-0x0;var _0x323ced=_0x2029[_0x12c581];return _0x323ced;};'use strict';var client=require(_0x9202('0x0'));exports[_0x9202('0x1')]=function(_0x4d4110){return client[_0x9202('0x2')](_0x9202('0x3'),{'body':_0x4d4110,'log':_0x9202('0x3')});};exports[_0x9202('0x4')]=function(_0x39fa99,_0x81709f){return client[_0x9202('0x2')](_0x9202('0x5'),{'body':_0x81709f,'options':{'where':{'uniqueid':_0x39fa99},'order':[['id',_0x9202('0x6')]],'limit':0x1},'log':_0x9202('0x5')});}; \ No newline at end of file +var _0x3074=['update','DESC','UpdateChatQueueReport','../client','Request','CreateChatQueueReport'];(function(_0x103f5f,_0x2d0dd1){var _0x388142=function(_0x44e6c2){while(--_0x44e6c2){_0x103f5f['push'](_0x103f5f['shift']());}};_0x388142(++_0x2d0dd1);}(_0x3074,0x1dd));var _0x4307=function(_0x5c8e7d,_0x429a89){_0x5c8e7d=_0x5c8e7d-0x0;var _0x37325e=_0x3074[_0x5c8e7d];return _0x37325e;};'use strict';var client=require(_0x4307('0x0'));exports['create']=function(_0x24f815){return client[_0x4307('0x1')](_0x4307('0x2'),{'body':_0x24f815,'log':'CreateChatQueueReport'});};exports[_0x4307('0x3')]=function(_0x5c5161,_0x256692){return client[_0x4307('0x1')]('UpdateChatQueueReport',{'body':_0x256692,'options':{'where':{'uniqueid':_0x5c5161},'order':[['id',_0x4307('0x4')]],'limit':0x1},'log':_0x4307('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 57ecd5a..f751ac4 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5ebbc0,_0x5d166d){var _0x352778=function(_0x3923b7){while(--_0x3923b7){_0x5ebbc0['push'](_0x5ebbc0['shift']());}};_0x352778(++_0x5d166d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x7a54,0x106));var _0x47a5=function(_0x147848,_0x110576){_0x147848=_0x147848-0x0;var _0x9651d8=_0x7a54[_0x147848];return _0x9651d8;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index e518e7f..f2dac8b 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 _0x19d8=['CreateFaxMessage','../client'];(function(_0x4159b9,_0x351682){var _0xd10719=function(_0x1dbd8a){while(--_0x1dbd8a){_0x4159b9['push'](_0x4159b9['shift']());}};_0xd10719(++_0x351682);}(_0x19d8,0xa7));var _0x819d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x19d8[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x819d('0x0'));exports['create']=function(_0x1d5dcf){return client['Request'](_0x819d('0x1'),{'body':_0x1d5dcf,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x4bc6=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x4186fa,_0x26a01c){var _0x136990=function(_0x13324f){while(--_0x13324f){_0x4186fa['push'](_0x4186fa['shift']());}};_0x136990(++_0x26a01c);}(_0x4bc6,0x64));var _0x64bc=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x4bc6[_0x2c7618];return _0x5ce3f0;};'use strict';var client=require(_0x64bc('0x0'));exports[_0x64bc('0x1')]=function(_0x18f8f7){return client['Request'](_0x64bc('0x2'),{'body':_0x18f8f7,'log':_0x64bc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 9299f66..ca29fcc 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 _0x7678=['../client','getFaxQueues','Request','name','timeout','strategy','User','Agents','online','faxPause'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7678,0x14a));var _0x8767=function(_0x1829b6,_0x10ef6b){_0x1829b6=_0x1829b6-0x0;var _0x3def6b=_0x7678[_0x1829b6];return _0x3def6b;};'use strict';var client=require(_0x8767('0x0'));exports[_0x8767('0x1')]=function(){return function(){return client[_0x8767('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x8767('0x3'),_0x8767('0x4'),_0x8767('0x5')],'include':[{'model':_0x8767('0x6'),'as':_0x8767('0x7'),'attributes':['id','name',_0x8767('0x8'),_0x8767('0x9')]}]},'log':_0x8767('0x1')});};}; \ No newline at end of file +var _0xd3ee=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0xd3ee,0x13b));var _0xed3e=function(_0x57834a,_0xfac574){_0x57834a=_0x57834a-0x0;var _0x5788d9=_0xd3ee[_0x57834a];return _0x5788d9;};'use strict';var client=require(_0xed3e('0x0'));exports[_0xed3e('0x1')]=function(){return function(){return client[_0xed3e('0x2')](_0xed3e('0x3'),{'options':{'raw':![],'attributes':['id',_0xed3e('0x4'),'timeout',_0xed3e('0x5')],'include':[{'model':_0xed3e('0x6'),'as':_0xed3e('0x7'),'attributes':['id',_0xed3e('0x4'),_0xed3e('0x8'),_0xed3e('0x9')]}]},'log':_0xed3e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index af99ee5..e84c52f 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 _0xcefc=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0x10ffaf,_0x2e5c01){var _0x26803e=function(_0x5cd95a){while(--_0x5cd95a){_0x10ffaf['push'](_0x10ffaf['shift']());}};_0x26803e(++_0x2e5c01);}(_0xcefc,0x8a));var _0xccef=function(_0x1ca4e7,_0x4e9282){_0x1ca4e7=_0x1ca4e7-0x0;var _0x106c19=_0xcefc[_0x1ca4e7];return _0x106c19;};'use strict';var client=require(_0xccef('0x0'));exports['create']=function(_0x3db819){return client[_0xccef('0x1')]('CreateFaxQueueReport',{'body':_0x3db819,'log':_0xccef('0x2')});};exports['update']=function(_0x53d807,_0x587fc9){return client['Request'](_0xccef('0x3'),{'body':_0x587fc9,'options':{'where':{'uniqueid':_0x53d807},'order':[['id',_0xccef('0x4')]],'limit':0x1},'log':_0xccef('0x3')});}; \ No newline at end of file +var _0xc6e3=['Request','UpdateFaxQueueReport','DESC','create','CreateFaxQueueReport'];(function(_0x3fd998,_0x5adf12){var _0x189d65=function(_0x649124){while(--_0x649124){_0x3fd998['push'](_0x3fd998['shift']());}};_0x189d65(++_0x5adf12);}(_0xc6e3,0x193));var _0x3c6e=function(_0x30456a,_0x15c1f2){_0x30456a=_0x30456a-0x0;var _0x35896b=_0xc6e3[_0x30456a];return _0x35896b;};'use strict';var client=require('../client');exports[_0x3c6e('0x0')]=function(_0x3f4968){return client['Request'](_0x3c6e('0x1'),{'body':_0x3f4968,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x4ecf7a,_0x5ac1de){return client[_0x3c6e('0x2')](_0x3c6e('0x3'),{'body':_0x5ac1de,'options':{'where':{'uniqueid':_0x4ecf7a},'order':[['id',_0x3c6e('0x4')]],'limit':0x1},'log':_0x3c6e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index ecb67bd..5f1ccd2 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 _0x6e2f=['Interval','Intervals','../client','getIntervals','Request','name'];(function(_0x1a5e00,_0x40c95c){var _0x1ec9f7=function(_0x4ca7ca){while(--_0x4ca7ca){_0x1a5e00['push'](_0x1a5e00['shift']());}};_0x1ec9f7(++_0x40c95c);}(_0x6e2f,0x74));var _0xf6e2=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6e2f[_0x5bd426];return _0x23a7eb;};'use strict';var client=require(_0xf6e2('0x0'));exports[_0xf6e2('0x1')]=function(){return function(){return client[_0xf6e2('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf6e2('0x3')],'include':[{'model':_0xf6e2('0x4'),'as':_0xf6e2('0x5'),'attributes':['id','name','interval']}]},'log':_0xf6e2('0x1')});};}; \ No newline at end of file +var _0x289e=['../client','getIntervals','GetInterval','Intervals'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x289e,0xf8));var _0xe289=function(_0x3ecf0c,_0x5044a3){_0x3ecf0c=_0x3ecf0c-0x0;var _0x1a682b=_0x289e[_0x3ecf0c];return _0x1a682b;};'use strict';var client=require(_0xe289('0x0'));exports[_0xe289('0x1')]=function(){return function(){return client['Request'](_0xe289('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0xe289('0x3'),'attributes':['id','name','interval']}]},'log':_0xe289('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 9ebe8d1..e044540 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 _0xe2cf=['addTags','Request','AddTagsToMailInteraction','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x4975f8,_0x3a226c){_0x4975f8=_0x4975f8-0x0;var _0x86d59f=_0xe2cf[_0x4975f8];return _0x86d59f;};'use strict';var client=require('../client');exports[_0xfe2c('0x0')]=function(_0x546786,_0x11c3a4){return client['Request'](_0xfe2c('0x1'),{'body':_0x11c3a4,'options':{'where':{'id':_0x546786}},'log':_0xfe2c('0x2')});};exports[_0xfe2c('0x3')]=function(_0x11b6b8,_0x494978){return client[_0xfe2c('0x4')](_0xfe2c('0x5'),{'body':_0x494978,'options':{'where':{'id':_0x11b6b8}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xadb5=['Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x4b79c8,_0x4c7fa7){var _0x2d6bb5=function(_0x3fb41d){while(--_0x3fb41d){_0x4b79c8['push'](_0x4b79c8['shift']());}};_0x2d6bb5(++_0x4c7fa7);}(_0xadb5,0xad));var _0x5adb=function(_0x329c32,_0x510ca1){_0x329c32=_0x329c32-0x0;var _0xf84157=_0xadb5[_0x329c32];return _0xf84157;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(_0x49fc17,_0x3d6340){return client[_0x5adb('0x1')](_0x5adb('0x2'),{'body':_0x3d6340,'options':{'where':{'id':_0x49fc17}},'log':'updateMailInteraction'});};exports[_0x5adb('0x3')]=function(_0x31457,_0x2e3ef4){return client['Request'](_0x5adb('0x4'),{'body':_0x2e3ef4,'options':{'where':{'id':_0x31457}},'log':_0x5adb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 79bc05f..ae8caf4 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 _0xbbf4=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0xbbf4,0x7a));var _0x4bbf=function(_0x198a98,_0x1cc58f){_0x198a98=_0x198a98-0x0;var _0x3daf2b=_0xbbf4[_0x198a98];return _0x3daf2b;};'use strict';var client=require(_0x4bbf('0x0'));exports[_0x4bbf('0x1')]=function(_0x664782){return client['Request'](_0x4bbf('0x2'),{'body':_0x664782,'log':_0x4bbf('0x3')});}; \ No newline at end of file +var _0x766c=['Request','CreateMailMessage','../client','create'];(function(_0x294d6c,_0x2fc56e){var _0x54ca5c=function(_0x3b989c){while(--_0x3b989c){_0x294d6c['push'](_0x294d6c['shift']());}};_0x54ca5c(++_0x2fc56e);}(_0x766c,0xc2));var _0xc766=function(_0x5e3de0,_0x2128f0){_0x5e3de0=_0x5e3de0-0x0;var _0x5f1c12=_0x766c[_0x5e3de0];return _0x5f1c12;};'use strict';var client=require(_0xc766('0x0'));exports[_0xc766('0x1')]=function(_0x89c7f9){return client[_0xc766('0x2')](_0xc766('0x3'),{'body':_0x89c7f9,'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 70457f3..53c40b0 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 _0x62fc=['Request','name','User','mailPause','../client','getMailQueues'];(function(_0x2e5a67,_0x37dadb){var _0x1f37b9=function(_0x47a076){while(--_0x47a076){_0x2e5a67['push'](_0x2e5a67['shift']());}};_0x1f37b9(++_0x37dadb);}(_0x62fc,0x1c6));var _0xc62f=function(_0xfb9f75,_0xc7521b){_0xfb9f75=_0xfb9f75-0x0;var _0x1ce11e=_0x62fc[_0xfb9f75];return _0x1ce11e;};'use strict';var client=require(_0xc62f('0x0'));exports[_0xc62f('0x1')]=function(){return function(){return client[_0xc62f('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xc62f('0x3'),'timeout','strategy'],'include':[{'model':_0xc62f('0x4'),'as':'Agents','attributes':['id',_0xc62f('0x3'),'online',_0xc62f('0x5')]}]},'log':_0xc62f('0x1')});};}; \ No newline at end of file +var _0xe8bb=['Request','GetMailQueue','name','User','Agents','mailPause','../client','getMailQueues'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe8bb,0xfe));var _0xbe8b=function(_0x1246c2,_0x135bbb){_0x1246c2=_0x1246c2-0x0;var _0x451aae=_0xe8bb[_0x1246c2];return _0x451aae;};'use strict';var client=require(_0xbe8b('0x0'));exports[_0xbe8b('0x1')]=function(){return function(){return client[_0xbe8b('0x2')](_0xbe8b('0x3'),{'options':{'raw':![],'attributes':['id',_0xbe8b('0x4'),'timeout','strategy'],'include':[{'model':_0xbe8b('0x5'),'as':_0xbe8b('0x6'),'attributes':['id',_0xbe8b('0x4'),'online',_0xbe8b('0x7')]}]},'log':_0xbe8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e3e9d22..b88bf0b 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 _0xe040=['../client','create','update','UpdateMailQueueReport','DESC'];(function(_0x353a30,_0x50c68a){var _0x213161=function(_0x440b8b){while(--_0x440b8b){_0x353a30['push'](_0x353a30['shift']());}};_0x213161(++_0x50c68a);}(_0xe040,0x64));var _0x0e04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe040[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0e04('0x0'));exports[_0x0e04('0x1')]=function(_0x9aa90e){return client['Request']('CreateMailQueueReport',{'body':_0x9aa90e,'log':'CreateMailQueueReport'});};exports[_0x0e04('0x2')]=function(_0x3b26fa,_0x35cb20){return client['Request'](_0x0e04('0x3'),{'body':_0x35cb20,'options':{'where':{'uniqueid':_0x3b26fa},'order':[['id',_0x0e04('0x4')]],'limit':0x1},'log':_0x0e04('0x3')});}; \ No newline at end of file +var _0xaf25=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x246923,_0x202d94){var _0x3c7f48=function(_0x1ac80c){while(--_0x1ac80c){_0x246923['push'](_0x246923['shift']());}};_0x3c7f48(++_0x202d94);}(_0xaf25,0xa0));var _0x5af2=function(_0x5cba21,_0xf6555d){_0x5cba21=_0x5cba21-0x0;var _0x124490=_0xaf25[_0x5cba21];return _0x124490;};'use strict';var client=require(_0x5af2('0x0'));exports[_0x5af2('0x1')]=function(_0x2e774f){return client[_0x5af2('0x2')](_0x5af2('0x3'),{'body':_0x2e774f,'log':_0x5af2('0x3')});};exports[_0x5af2('0x4')]=function(_0x4c8e04,_0x5b7208){return client[_0x5af2('0x2')](_0x5af2('0x5'),{'body':_0x5b7208,'options':{'where':{'uniqueid':_0x4c8e04},'order':[['id',_0x5af2('0x6')]],'limit':0x1},'log':_0x5af2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 69fcac1..1524175 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 _0xc61b=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x380431,_0x24bd98){var _0x4d0fc2=function(_0x996f6e){while(--_0x996f6e){_0x380431['push'](_0x380431['shift']());}};_0x4d0fc2(++_0x24bd98);}(_0xc61b,0x91));var _0xbc61=function(_0x529ef2,_0x13dd70){_0x529ef2=_0x529ef2-0x0;var _0x449ab8=_0xc61b[_0x529ef2];return _0x449ab8;};'use strict';var client=require('../client');exports[_0xbc61('0x0')]=function(_0x5f5d9f,_0x52434f){return client[_0xbc61('0x1')](_0xbc61('0x2'),{'body':_0x52434f,'options':{'where':{'id':_0x5f5d9f}},'log':_0xbc61('0x3')});};exports[_0xbc61('0x4')]=function(_0x4f509b,_0x7c370){return client[_0xbc61('0x1')](_0xbc61('0x5'),{'body':_0x7c370,'options':{'where':{'id':_0x4f509b}},'log':_0xbc61('0x6')});}; \ No newline at end of file +var _0xf6c8=['../client','update','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x52d74f,_0x4b101e){var _0x5a59f3=function(_0x1c63b4){while(--_0x1c63b4){_0x52d74f['push'](_0x52d74f['shift']());}};_0x5a59f3(++_0x4b101e);}(_0xf6c8,0xbd));var _0x8f6c=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xf6c8[_0x2fc012];return _0x2891f9;};'use strict';var client=require(_0x8f6c('0x0'));exports[_0x8f6c('0x1')]=function(_0x1e408c,_0x2bbe26){return client[_0x8f6c('0x2')]('UpdateOpenchannelInteraction',{'body':_0x2bbe26,'options':{'where':{'id':_0x1e408c}},'log':_0x8f6c('0x3')});};exports[_0x8f6c('0x4')]=function(_0x4c375b,_0xd84c99){return client[_0x8f6c('0x2')](_0x8f6c('0x5'),{'body':_0xd84c99,'options':{'where':{'id':_0x4c375b}},'log':_0x8f6c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 761b774..f02b646 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 _0xe374=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x59a3d4,_0x33a44e){var _0x1d548d=function(_0x16551b){while(--_0x16551b){_0x59a3d4['push'](_0x59a3d4['shift']());}};_0x1d548d(++_0x33a44e);}(_0xe374,0x150));var _0x4e37=function(_0x42b950,_0x278b2b){_0x42b950=_0x42b950-0x0;var _0x589c7f=_0xe374[_0x42b950];return _0x589c7f;};'use strict';var client=require(_0x4e37('0x0'));exports[_0x4e37('0x1')]=function(_0x2a044c){return client['Request'](_0x4e37('0x2'),{'body':_0x2a044c,'log':_0x4e37('0x3')});}; \ No newline at end of file +var _0xd9cc=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd9cc,0xbb));var _0xcd9c=function(_0xccc65a,_0xe00203){_0xccc65a=_0xccc65a-0x0;var _0x48299a=_0xd9cc[_0xccc65a];return _0x48299a;};'use strict';var client=require('../client');exports[_0xcd9c('0x0')]=function(_0x12f83b){return client[_0xcd9c('0x1')](_0xcd9c('0x2'),{'body':_0x12f83b,'log':_0xcd9c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e99a9fb..b4ab05f 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 _0x8782=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents','online'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x8782,0x17a));var _0x2878=function(_0x400c94,_0x4def83){_0x400c94=_0x400c94-0x0;var _0x2c72eb=_0x8782[_0x400c94];return _0x2c72eb;};'use strict';var client=require(_0x2878('0x0'));exports[_0x2878('0x1')]=function(){return function(){return client[_0x2878('0x2')](_0x2878('0x3'),{'options':{'raw':![],'attributes':['id',_0x2878('0x4'),_0x2878('0x5'),_0x2878('0x6')],'include':[{'model':'User','as':_0x2878('0x7'),'attributes':['id',_0x2878('0x4'),_0x2878('0x8'),'openchannelPause']}]},'log':_0x2878('0x1')});};}; \ No newline at end of file +var _0x8fde=['name','Agents','online','openchannelPause','getOpenchannelQueues','../client'];(function(_0x488bbd,_0x47d426){var _0x452b2a=function(_0x572354){while(--_0x572354){_0x488bbd['push'](_0x488bbd['shift']());}};_0x452b2a(++_0x47d426);}(_0x8fde,0x1b5));var _0xe8fd=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x8fde[_0x4ff09b];return _0x3f5c2e;};'use strict';var client=require(_0xe8fd('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xe8fd('0x1'),'timeout','strategy'],'include':[{'model':'User','as':_0xe8fd('0x2'),'attributes':['id',_0xe8fd('0x1'),_0xe8fd('0x3'),_0xe8fd('0x4')]}]},'log':_0xe8fd('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 95ca9e6..629e444 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 _0x8bf0=['update','UpdateOpenchannelQueueReport','Request','CreateOpenchannelQueueReport'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0x8bf0,0x14a));var _0x08bf=function(_0x41ddb6,_0x148e78){_0x41ddb6=_0x41ddb6-0x0;var _0x289513=_0x8bf0[_0x41ddb6];return _0x289513;};'use strict';var client=require('../client');exports['create']=function(_0x226ecb){return client[_0x08bf('0x0')](_0x08bf('0x1'),{'body':_0x226ecb,'log':'CreateOpenchannelQueueReport'});};exports[_0x08bf('0x2')]=function(_0x47b74f,_0x5e8818){return client[_0x08bf('0x0')]('UpdateOpenchannelQueueReport',{'body':_0x5e8818,'options':{'where':{'uniqueid':_0x47b74f},'order':[['id','DESC']],'limit':0x1},'log':_0x08bf('0x3')});}; \ No newline at end of file +var _0xfc04=['DESC','UpdateOpenchannelQueueReport','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0xd41d2a,_0x20146d){var _0x5cc49d=function(_0x474796){while(--_0x474796){_0xd41d2a['push'](_0xd41d2a['shift']());}};_0x5cc49d(++_0x20146d);}(_0xfc04,0xa4));var _0x4fc0=function(_0x31bec6,_0x342e1c){_0x31bec6=_0x31bec6-0x0;var _0x4d8177=_0xfc04[_0x31bec6];return _0x4d8177;};'use strict';var client=require(_0x4fc0('0x0'));exports['create']=function(_0x1a0d48){return client[_0x4fc0('0x1')](_0x4fc0('0x2'),{'body':_0x1a0d48,'log':_0x4fc0('0x2')});};exports[_0x4fc0('0x3')]=function(_0x442ba0,_0x285864){return client[_0x4fc0('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x285864,'options':{'where':{'uniqueid':_0x442ba0},'order':[['id',_0x4fc0('0x4')]],'limit':0x1},'log':_0x4fc0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 176367a..6294411 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 _0x96a2=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x303556,_0x46d2af){var _0x9afa64=function(_0x2786e5){while(--_0x2786e5){_0x303556['push'](_0x303556['shift']());}};_0x9afa64(++_0x46d2af);}(_0x96a2,0x96));var _0x296a=function(_0x1b6897,_0x505e26){_0x1b6897=_0x1b6897-0x0;var _0x2a2152=_0x96a2[_0x1b6897];return _0x2a2152;};'use strict';var client=require(_0x296a('0x0'));exports['update']=function(_0x46dc2b,_0x2c8e7c){return client[_0x296a('0x1')](_0x296a('0x2'),{'body':_0x2c8e7c,'options':{'where':{'id':_0x46dc2b}},'log':_0x296a('0x3')});};exports[_0x296a('0x4')]=function(_0x142815,_0x420fc5){return client[_0x296a('0x1')](_0x296a('0x5'),{'body':_0x420fc5,'options':{'where':{'id':_0x142815}},'log':_0x296a('0x6')});}; \ No newline at end of file +var _0x6334=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x364be8,_0x10cead){var _0x377f3a=function(_0x2a995e){while(--_0x2a995e){_0x364be8['push'](_0x364be8['shift']());}};_0x377f3a(++_0x10cead);}(_0x6334,0x119));var _0x4633=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x6334[_0x3ec122];return _0x4ecf41;};'use strict';var client=require(_0x4633('0x0'));exports[_0x4633('0x1')]=function(_0x2072ba,_0x1d53a1){return client[_0x4633('0x2')](_0x4633('0x3'),{'body':_0x1d53a1,'options':{'where':{'id':_0x2072ba}},'log':'updateSmsInteraction'});};exports[_0x4633('0x4')]=function(_0x205442,_0x2a2b3c){return client[_0x4633('0x2')](_0x4633('0x5'),{'body':_0x2a2b3c,'options':{'where':{'id':_0x205442}},'log':_0x4633('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 0bc528d..3c96cb5 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 _0xf572=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0xcf3a34,_0xf740b9){var _0x634728=function(_0xa46080){while(--_0xa46080){_0xcf3a34['push'](_0xcf3a34['shift']());}};_0x634728(++_0xf740b9);}(_0xf572,0x76));var _0x2f57=function(_0x22aad6,_0x53227e){_0x22aad6=_0x22aad6-0x0;var _0x201cd2=_0xf572[_0x22aad6];return _0x201cd2;};'use strict';var client=require(_0x2f57('0x0'));exports[_0x2f57('0x1')]=function(_0x2b5104){return client[_0x2f57('0x2')](_0x2f57('0x3'),{'body':_0x2b5104,'log':_0x2f57('0x4')});}; \ No newline at end of file +var _0x9297=['../client','create','CreateSmsMessage'];(function(_0x16641e,_0x1666dc){var _0x3e96e5=function(_0x2c299c){while(--_0x2c299c){_0x16641e['push'](_0x16641e['shift']());}};_0x3e96e5(++_0x1666dc);}(_0x9297,0xb4));var _0x7929=function(_0x4ddd37,_0x2314d1){_0x4ddd37=_0x4ddd37-0x0;var _0x562fdc=_0x9297[_0x4ddd37];return _0x562fdc;};'use strict';var client=require(_0x7929('0x0'));exports[_0x7929('0x1')]=function(_0x4678e6){return client['Request'](_0x7929('0x2'),{'body':_0x4678e6,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c3e4d42..5bb4bbc 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x4b2ed7,_0x5b3100){var _0x55a953=function(_0x4b7abd){while(--_0x4b7abd){_0x4b2ed7['push'](_0x4b2ed7['shift']());}};_0x55a953(++_0x5b3100);}(_0x70e0,0x17b));var _0x070e=function(_0x58efeb,_0x959f4d){_0x58efeb=_0x58efeb-0x0;var _0x2e2a48=_0x70e0[_0x58efeb];return _0x2e2a48;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x1b2d6b,_0x498955){var _0x169da8=function(_0x3050b9){while(--_0x3050b9){_0x1b2d6b['push'](_0x1b2d6b['shift']());}};_0x169da8(++_0x498955);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1293759..db9ecd1 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5d983c,_0x57b322){var _0x45d2f8=function(_0x4fb48d){while(--_0x4fb48d){_0x5d983c['push'](_0x5d983c['shift']());}};_0x45d2f8(++_0x57b322);}(_0x008c,0x188));var _0xc008=function(_0x3e88f0,_0x27d2b0){_0x3e88f0=_0x3e88f0-0x0;var _0x106a66=_0x008c[_0x3e88f0];return _0x106a66;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x29ff7c,_0x5624e6){var _0x20491f=function(_0x27cfa4){while(--_0x27cfa4){_0x29ff7c['push'](_0x29ff7c['shift']());}};_0x20491f(++_0x5624e6);}(_0x34e8,0x12c));var _0x834e=function(_0x1ad44a,_0x1342b1){_0x1ad44a=_0x1ad44a-0x0;var _0x5c3808=_0x34e8[_0x1ad44a];return _0x5c3808;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 517e156..af7b443 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(_0x2b0b4c,_0x3aab35){var _0x3acc75=function(_0x3c9b39){while(--_0x3c9b39){_0x2b0b4c['push'](_0x2b0b4c['shift']());}};_0x3acc75(++_0x3aab35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x21a248,_0x23e896){var _0x1e2e84=function(_0xf27e59){while(--_0xf27e59){_0x21a248['push'](_0x21a248['shift']());}};_0x1e2e84(++_0x23e896);}(_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'),'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 3a73fd6..b178e2a 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 _0x938d=['../client','update','Request','UpdateWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x3da9cd,_0x279a5c){var _0x3d4baf=function(_0x378caf){while(--_0x378caf){_0x3da9cd['push'](_0x3da9cd['shift']());}};_0x3d4baf(++_0x279a5c);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd938('0x0'));exports[_0xd938('0x1')]=function(_0x4fb46a,_0x3c6634){return client[_0xd938('0x2')](_0xd938('0x3'),{'body':_0x3c6634,'options':{'where':{'id':_0x4fb46a}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0xc9f24b,_0x429911){return client[_0xd938('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x429911,'options':{'where':{'id':_0xc9f24b}},'log':_0xd938('0x4')});}; \ No newline at end of file +var _0x2c8f=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x5e05b5,_0x56222d){var _0x1852bd=function(_0x57adc0){while(--_0x57adc0){_0x5e05b5['push'](_0x5e05b5['shift']());}};_0x1852bd(++_0x56222d);}(_0x2c8f,0x192));var _0xf2c8=function(_0x360cc7,_0x2373f4){_0x360cc7=_0x360cc7-0x0;var _0x36c3b7=_0x2c8f[_0x360cc7];return _0x36c3b7;};'use strict';var client=require('../client');exports[_0xf2c8('0x0')]=function(_0x52bede,_0x4b64c7){return client['Request'](_0xf2c8('0x1'),{'body':_0x4b64c7,'options':{'where':{'id':_0x52bede}},'log':_0xf2c8('0x2')});};exports[_0xf2c8('0x3')]=function(_0x56296e,_0x5e4234){return client[_0xf2c8('0x4')](_0xf2c8('0x5'),{'body':_0x5e4234,'options':{'where':{'id':_0x56296e}},'log':_0xf2c8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d667170..e2aa593 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 _0x3a00=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0xa52fe3,_0x3feb1c){var _0x50c1a5=function(_0x977116){while(--_0x977116){_0xa52fe3['push'](_0xa52fe3['shift']());}};_0x50c1a5(++_0x3feb1c);}(_0x3a00,0x1ca));var _0x03a0=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x3a00[_0x154192];return _0x3c2792;};'use strict';var client=require(_0x03a0('0x0'));exports[_0x03a0('0x1')]=function(_0x4726f4){return client[_0x03a0('0x2')](_0x03a0('0x3'),{'body':_0x4726f4,'log':_0x03a0('0x4')});}; \ No newline at end of file +var _0xfc72=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x41de93,_0x54761e){var _0x492bd8=function(_0x3c1b8e){while(--_0x3c1b8e){_0x41de93['push'](_0x41de93['shift']());}};_0x492bd8(++_0x54761e);}(_0xfc72,0x68));var _0x2fc7=function(_0x51cabf,_0x2828db){_0x51cabf=_0x51cabf-0x0;var _0x517538=_0xfc72[_0x51cabf];return _0x517538;};'use strict';var client=require(_0x2fc7('0x0'));exports[_0x2fc7('0x1')]=function(_0x579e3b){return client[_0x2fc7('0x2')](_0x2fc7('0x3'),{'body':_0x579e3b,'log':_0x2fc7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b0c0971..1b8daea 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 _0x34b4=['../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','online','whatsappPause'];(function(_0x4a759b,_0x28a0b9){var _0x1619f2=function(_0x2aa111){while(--_0x2aa111){_0x4a759b['push'](_0x4a759b['shift']());}};_0x1619f2(++_0x28a0b9);}(_0x34b4,0xe8));var _0x434b=function(_0x5dab7a,_0x4f5105){_0x5dab7a=_0x5dab7a-0x0;var _0x5dbafd=_0x34b4[_0x5dab7a];return _0x5dbafd;};'use strict';var client=require(_0x434b('0x0'));exports[_0x434b('0x1')]=function(){return function(){return client['Request'](_0x434b('0x2'),{'options':{'raw':![],'attributes':['id',_0x434b('0x3'),_0x434b('0x4'),_0x434b('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x434b('0x3'),_0x434b('0x6'),_0x434b('0x7')]}]},'log':_0x434b('0x1')});};}; \ No newline at end of file +var _0xba66=['getWhatsappQueues','../client','Request','name','timeout','strategy','User','Agents','whatsappPause'];(function(_0x582ea6,_0x4b6a72){var _0x426dac=function(_0x5a5c10){while(--_0x5a5c10){_0x582ea6['push'](_0x582ea6['shift']());}};_0x426dac(++_0x4b6a72);}(_0xba66,0x1f0));var _0x6ba6=function(_0x472621,_0x60b51){_0x472621=_0x472621-0x0;var _0x423f18=_0xba66[_0x472621];return _0x423f18;};'use strict';var client=require(_0x6ba6('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x6ba6('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x6ba6('0x2'),_0x6ba6('0x3'),_0x6ba6('0x4')],'include':[{'model':_0x6ba6('0x5'),'as':_0x6ba6('0x6'),'attributes':['id','name','online',_0x6ba6('0x7')]}]},'log':_0x6ba6('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index d3017b0..99e5c3f 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 _0x85a7=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x1680c8,_0x328a14){var _0xdd8590=function(_0x22b9d6){while(--_0x22b9d6){_0x1680c8['push'](_0x1680c8['shift']());}};_0xdd8590(++_0x328a14);}(_0x85a7,0xd9));var _0x785a=function(_0x5f1543,_0x319776){_0x5f1543=_0x5f1543-0x0;var _0x2c5592=_0x85a7[_0x5f1543];return _0x2c5592;};'use strict';var client=require(_0x785a('0x0'));exports[_0x785a('0x1')]=function(_0x3ed1f0){return client[_0x785a('0x2')](_0x785a('0x3'),{'body':_0x3ed1f0,'log':_0x785a('0x3')});};exports[_0x785a('0x4')]=function(_0x228a96,_0x1b0762){return client[_0x785a('0x2')](_0x785a('0x5'),{'body':_0x1b0762,'options':{'where':{'uniqueid':_0x228a96},'order':[['id',_0x785a('0x6')]],'limit':0x1},'log':_0x785a('0x5')});}; \ No newline at end of file +var _0xa949=['DESC','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x1b0084,_0x18ff2a){var _0x190d7f=function(_0x1b4853){while(--_0x1b4853){_0x1b0084['push'](_0x1b0084['shift']());}};_0x190d7f(++_0x18ff2a);}(_0xa949,0xb5));var _0x9a94=function(_0x208149,_0x34179e){_0x208149=_0x208149-0x0;var _0x3294a0=_0xa949[_0x208149];return _0x3294a0;};'use strict';var client=require('../client');exports[_0x9a94('0x0')]=function(_0x45a330){return client[_0x9a94('0x1')]('CreateWhatsappQueueReport',{'body':_0x45a330,'log':_0x9a94('0x2')});};exports[_0x9a94('0x3')]=function(_0xf4143f,_0x42ecc1){return client['Request'](_0x9a94('0x4'),{'body':_0x42ecc1,'options':{'where':{'uniqueid':_0xf4143f},'order':[['id',_0x9a94('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 7a20152..1cb6d71 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 _0x1dfe=['atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','find','agents','timeout'];(function(_0x16a80b,_0x5363ef){var _0x2c2df5=function(_0x3bea7b){while(--_0x3bea7b){_0x16a80b['push'](_0x16a80b['shift']());}};_0x2c2df5(++_0x5363ef);}(_0x1dfe,0x14a));var _0xe1df=function(_0x199b6a,_0x2cc3bf){_0x199b6a=_0x199b6a-0x0;var _0x2c8a2a=_0x1dfe[_0x199b6a];return _0x2c8a2a;};'use strict';var schema=require(_0xe1df('0x0'));var _=require(_0xe1df('0x1'));var util=require(_0xe1df('0x2'));var seqqueue=require(_0xe1df('0x3'));var logger=require('../../../../config/logger')(_0xe1df('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xe1df('0x5'),'required':!![],'message':_0xe1df('0x6')},'timeout':{'type':_0xe1df('0x7'),'message':_0xe1df('0x8')}});function writeLog(_0x3d4bd6,_0x4afc20,_0x479651){return logger['info'](util[_0xe1df('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x3d4bd6,_0x4afc20[_0xe1df('0xa')],_0x479651));}function handleFindAgent(_0x2fdc0b){return function(_0x5d56da){return _0x5d56da[_0xe1df('0xa')][_0xe1df('0xb')]()===_0x2fdc0b['toLowerCase']();};}exports[_0xe1df('0xc')]=function(_0x2f8aa6,_0x385515,_0x29abf8,_0x129b28){return function(_0x3d7a20){try{var _0x36ad6d={'name':_0x385515[0x0],'timeout':_0x385515[0x1]};var _0x394845=queue[_0xe1df('0x0')](_0x36ad6d,{'typecast':!![]});if(_0x394845[_0xe1df('0xd')]){logger[_0xe1df('0xe')](_0xe1df('0xf'),_0x2f8aa6,_[_0xe1df('0x10')](_0x394845,'message')['join'](',\x20'));_0x3d7a20['stop']();}else{var _0x103252=_[_0xe1df('0x11')](_0x29abf8[_0xe1df('0x12')],handleFindAgent(_0x36ad6d[_0xe1df('0xa')]));if(_0x103252){var _0x42075f=(_0x36ad6d[_0xe1df('0x13')]||0xa)*0x3e8;var _0x16547a,_0x396198;var _0x3ad93b=seqqueue['createQueue'](_0x42075f);_0x3ad93b['id']=_0x2f8aa6;_0x3ad93b[_0xe1df('0x14')]=_0x42075f;_0x3ad93b['channel']=_0x129b28[_0xe1df('0x15')];writeLog(_0x2f8aa6,_0x103252,util[_0xe1df('0x9')](_0xe1df('0x16'),_0x42075f));_0x29abf8['rules'][_0x2f8aa6]['on'](_0xe1df('0x17'),function(){logger['info'](_0xe1df('0x18'),_0x2f8aa6);clearTimeout(_0x396198);_0x396198=undefined;_0x3ad93b['close']();if(_0x29abf8[_0xe1df('0x19')][_0x2f8aa6]){delete _0x29abf8[_0xe1df('0x19')][_0x2f8aa6];}_0x3d7a20[_0xe1df('0x1a')]();});_0x29abf8[_0xe1df('0x19')][_0x2f8aa6]['on'](_0xe1df('0x1b'),function(){if(_0x29abf8['rules'][_0x2f8aa6]){delete _0x29abf8[_0xe1df('0x19')][_0x2f8aa6];}});_0x396198=setTimeout(function(){logger['info'](_0xe1df('0x1c'),_0x2f8aa6);clearTimeout(_0x396198);_0x3ad93b[_0xe1df('0x1d')]();_0x3d7a20[_0xe1df('0x1e')]();},_0x42075f);strategy[_0xe1df('0x1f')](_0x3ad93b,_0x103252,_0x29abf8,_0x129b28);}else{logger[_0xe1df('0xe')](_0xe1df('0x20'),_0x2f8aa6,_0x36ad6d[_0xe1df('0xa')]);_0x3d7a20['stop']();}}}catch(_0x150bb3){console[_0xe1df('0x21')](_0x150bb3);logger[_0xe1df('0xe')]('[%s][QUEUE]\x20%s',_0x2f8aa6,_0x150bb3[_0xe1df('0x22')]);_0x3d7a20[_0xe1df('0x1a')]();}};}; \ No newline at end of file +var _0x80cf=['validate','lodash','util','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','find','agents','name','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','log','[%s][QUEUE]\x20%s','stack'];(function(_0x375f8d,_0x2a2a97){var _0x523849=function(_0x5c8945){while(--_0x5c8945){_0x375f8d['push'](_0x375f8d['shift']());}};_0x523849(++_0x2a2a97);}(_0x80cf,0xfc));var _0xf80c=function(_0x12117d,_0x54c5b1){_0x12117d=_0x12117d-0x0;var _0x49329b=_0x80cf[_0x12117d];return _0x49329b;};'use strict';var schema=require(_0xf80c('0x0'));var _=require(_0xf80c('0x1'));var util=require(_0xf80c('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require(_0xf80c('0x3'));var queue=schema({'name':{'type':_0xf80c('0x4'),'required':!![],'message':_0xf80c('0x5')},'timeout':{'type':_0xf80c('0x6'),'message':_0xf80c('0x7')}});function writeLog(_0x3de179,_0x14a0f7,_0x40c71e){return logger[_0xf80c('0x8')](util[_0xf80c('0x9')](_0xf80c('0xa'),_0x3de179,_0x14a0f7['name'],_0x40c71e));}function handleFindAgent(_0x45e775){return function(_0xbb2bda){return _0xbb2bda['name'][_0xf80c('0xb')]()===_0x45e775[_0xf80c('0xb')]();};}exports[_0xf80c('0xc')]=function(_0x2f6326,_0x15da3b,_0x217eb4,_0x569e93){return function(_0x3fc617){try{var _0x1b8bef={'name':_0x15da3b[0x0],'timeout':_0x15da3b[0x1]};var _0x224735=queue['validate'](_0x1b8bef,{'typecast':!![]});if(_0x224735[_0xf80c('0xd')]){logger[_0xf80c('0xe')](_0xf80c('0xf'),_0x2f6326,_[_0xf80c('0x10')](_0x224735,_0xf80c('0x11'))['join'](',\x20'));_0x3fc617['stop']();}else{var _0x7ac445=_[_0xf80c('0x12')](_0x217eb4[_0xf80c('0x13')],handleFindAgent(_0x1b8bef[_0xf80c('0x14')]));if(_0x7ac445){var _0x563da0=(_0x1b8bef['timeout']||0xa)*0x3e8;var _0x46e41e,_0x3040d6;var _0x1c8420=seqqueue[_0xf80c('0x15')](_0x563da0);_0x1c8420['id']=_0x2f6326;_0x1c8420[_0xf80c('0x16')]=_0x563da0;_0x1c8420[_0xf80c('0x17')]=_0x569e93['channel'];writeLog(_0x2f6326,_0x7ac445,util[_0xf80c('0x9')](_0xf80c('0x18'),_0x563da0));_0x217eb4[_0xf80c('0x19')][_0x2f6326]['on'](_0xf80c('0x1a'),function(){logger[_0xf80c('0x8')](_0xf80c('0x1b'),_0x2f6326);clearTimeout(_0x3040d6);_0x3040d6=undefined;_0x1c8420[_0xf80c('0x1c')]();if(_0x217eb4[_0xf80c('0x19')][_0x2f6326]){delete _0x217eb4[_0xf80c('0x19')][_0x2f6326];}_0x3fc617['stop']();});_0x217eb4[_0xf80c('0x19')][_0x2f6326]['on'](_0xf80c('0x1d'),function(){if(_0x217eb4[_0xf80c('0x19')][_0x2f6326]){delete _0x217eb4[_0xf80c('0x19')][_0x2f6326];}});_0x3040d6=setTimeout(function(){logger[_0xf80c('0x8')](_0xf80c('0x1e'),_0x2f6326);clearTimeout(_0x3040d6);_0x1c8420[_0xf80c('0x1c')]();_0x3fc617['next']();},_0x563da0);strategy['agent'](_0x1c8420,_0x7ac445,_0x217eb4,_0x569e93);}else{logger[_0xf80c('0xe')](_0xf80c('0x1f'),_0x2f6326,_0x1b8bef[_0xf80c('0x14')]);_0x3fc617[_0xf80c('0x20')]();}}}catch(_0x548690){console[_0xf80c('0x21')](_0x548690);logger['error'](_0xf80c('0x22'),_0x2f6326,_0x548690[_0xf80c('0x23')]);_0x3fc617['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 81a9851..5cc98f2 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 _0x3d5c=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','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','message','toString','amazonlex','Failed','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][AMAZONLEX]\x20%s'];(function(_0x51a226,_0x1fa11d){var _0x2718f1=function(_0x342fef){while(--_0x342fef){_0x51a226['push'](_0x51a226['shift']());}};_0x2718f1(++_0x1fa11d);}(_0x3d5c,0xb6));var _0xc3d5=function(_0xfbba38,_0x651026){_0xfbba38=_0xfbba38-0x0;var _0x716876=_0x3d5c[_0xfbba38];return _0x716876;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0xc3d5('0x0'));var utils=require(_0xc3d5('0x1'));var logger=require(_0xc3d5('0x2'))(_0xc3d5('0x3'));var rpc={'chatMessage':require(_0xc3d5('0x4')),'openchannelMessage':require(_0xc3d5('0x5')),'mailMessage':require(_0xc3d5('0x6')),'smsMessage':require(_0xc3d5('0x7')),'faxMessage':require(_0xc3d5('0x8')),'whatsappMessage':require(_0xc3d5('0x9'))};exports[_0xc3d5('0xa')]=function(_0x237289,_0x481933){return function(_0x484c10){try{if(!_[_0xc3d5('0xb')](this[_0xc3d5('0xc')]['UserId'])){logger['info'](_0xc3d5('0xd'),_0x237289,_0xc3d5('0xe'));return _0x484c10[_0xc3d5('0xf')]();}var _0x359bad={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc3d5('0x10')](_0xc3d5('0x11')),'direction':_0xc3d5('0x12')};if(this[_0xc3d5('0x13')]===_0xc3d5('0x14')||this[_0xc3d5('0x13')]===_0xc3d5('0x15')){_0x359bad[_0xc3d5('0x16')]=this[_0xc3d5('0xc')]['phone'];}var _0x77b65=this['channel'];if(_0x77b65===_0xc3d5('0x17')){_0x359bad[_0xc3d5('0x18')]=this[_0xc3d5('0x19')]['id'];}else{_0x359bad[_[_0xc3d5('0x1a')](_0x77b65)+_0xc3d5('0x1b')]=this[_0xc3d5('0x19')]['id'];}_0x359bad[_[_0xc3d5('0x1a')](_0x77b65)+_0xc3d5('0x1c')]=this[_0xc3d5('0xc')]['id'];if(this['interaction'][_0xc3d5('0x1d')]){var _0x1898d7=_0x481933[0x4];if(!_[_0xc3d5('0x1e')](_0x1898d7)){_0x359bad[_0xc3d5('0x1f')]=utils[_0xc3d5('0x20')](_0x1898d7,this);return rpc[_0x77b65+_0xc3d5('0x21')][_0xc3d5('0x22')](_0x359bad)[_0xc3d5('0x23')](function(_0x16f315){logger[_0xc3d5('0x24')](_0xc3d5('0xd'),_0x237289,_0x359bad[_0xc3d5('0x1f')]);})[_0xc3d5('0x25')](function(_0x4cb54d){logger[_0xc3d5('0x26')](_0xc3d5('0xd'),_0x237289,JSON[_0xc3d5('0x27')](_0x4cb54d));})[_0xc3d5('0x28')](function(){logger['info'](_0xc3d5('0x29'),_0x237289);_0x484c10[_0xc3d5('0x2a')]();});}else{logger['info'](_0xc3d5('0x2b'),_0x237289);_0x484c10[_0xc3d5('0x2a')]();}}else{var _0x3bfcef=this;var _0x123fd7=new AWS[(_0xc3d5('0x2c'))]({'accessKeyId':_0x481933[0x0],'secretAccessKey':_0x481933[0x1],'region':_0x481933[0x2]});var _0x3d37d0={'botAlias':'$LATEST','botName':_0x481933[0x3],'inputText':this[_0xc3d5('0x2d')][_0xc3d5('0x1f')],'userId':this[_0xc3d5('0x13')]+':'+this[_0xc3d5('0xc')]['id'][_0xc3d5('0x2e')]()};_0x123fd7['postText'](_0x3d37d0,function(_0x4c42cf,_0x3ce84f){if(_0x4c42cf){logger[_0xc3d5('0x26')](_0xc3d5('0xd'),_0x237289,_0x4c42cf[_0xc3d5('0x2d')]);_0x484c10[_0xc3d5('0xf')]();}else if(_0x3ce84f&&_0x3ce84f[_0xc3d5('0x2d')]){_0x3bfcef[_0xc3d5('0x1f')][_0xc3d5('0x2f')]=_0x3ce84f;_0x359bad['body']=_0x3ce84f[_0xc3d5('0x2d')];_0x359bad['providerName']=_0xc3d5('0x2f');_0x359bad['providerResponse']=JSON[_0xc3d5('0x27')](_0x3ce84f);return rpc[_0x77b65+_0xc3d5('0x21')][_0xc3d5('0x22')](_0x359bad)[_0xc3d5('0x23')](function(_0x4b2439){logger[_0xc3d5('0x24')](_0xc3d5('0xd'),_0x237289,_0x359bad['body']);if(_0x3ce84f['dialogState']==_0xc3d5('0x30')){_0x484c10[_0xc3d5('0xf')]();}else{_0x484c10[_0xc3d5('0x2a')]();}})[_0xc3d5('0x25')](function(_0x4428e3){logger[_0xc3d5('0x26')]('[%s][AMAZONLEX]\x20%s',_0x237289,JSON[_0xc3d5('0x27')](_0x4428e3));_0x484c10[_0xc3d5('0xf')]();});}else{_0x484c10['next']();}});}}catch(_0x120161){logger[_0xc3d5('0x26')](_0xc3d5('0xd'),_0x237289,JSON[_0xc3d5('0x27')](_0x120161));_0x484c10[_0xc3d5('0x2a')]();}};}; \ No newline at end of file +var _0xcf67=['dialogState','Failed','stop','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','created','isEmpty','body','getMustacheRender','Message','create','[%s][AMAZONLEX]\x20%s','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','stringify','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf67,0x141));var _0x7cf6=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xcf67[_0x5c6994];return _0x1d5c84;};'use strict';var _=require('lodash');var moment=require(_0x7cf6('0x0'));var AWS=require(_0x7cf6('0x1'));var utils=require(_0x7cf6('0x2'));var logger=require(_0x7cf6('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7cf6('0x4')),'mailMessage':require(_0x7cf6('0x5')),'smsMessage':require(_0x7cf6('0x6')),'faxMessage':require(_0x7cf6('0x7')),'whatsappMessage':require(_0x7cf6('0x8'))};exports[_0x7cf6('0x9')]=function(_0x24c9c8,_0x5bba38){return function(_0x63a18f){try{if(!_[_0x7cf6('0xa')](this['interaction'][_0x7cf6('0xb')])){logger[_0x7cf6('0xc')]('[%s][AMAZONLEX]\x20%s',_0x24c9c8,_0x7cf6('0xd'));return _0x63a18f[_0x7cf6('0xe')]();}var _0x20d5cc={'ContactId':this[_0x7cf6('0xf')]['id'],'sentAt':moment()[_0x7cf6('0x10')](_0x7cf6('0x11')),'direction':_0x7cf6('0x12')};if(this[_0x7cf6('0x13')]===_0x7cf6('0x14')||this['channel']===_0x7cf6('0x15')){_0x20d5cc[_0x7cf6('0x16')]=this[_0x7cf6('0x17')]['phone'];}var _0x1a2148=this[_0x7cf6('0x13')];if(_0x1a2148===_0x7cf6('0x18')){_0x20d5cc[_0x7cf6('0x19')]=this[_0x7cf6('0x1a')]['id'];}else{_0x20d5cc[_['upperFirst'](_0x1a2148)+_0x7cf6('0x1b')]=this[_0x7cf6('0x1a')]['id'];}_0x20d5cc[_[_0x7cf6('0x1c')](_0x1a2148)+'InteractionId']=this['interaction']['id'];if(this[_0x7cf6('0x17')][_0x7cf6('0x1d')]){var _0x5983b7=_0x5bba38[0x4];if(!_[_0x7cf6('0x1e')](_0x5983b7)){_0x20d5cc[_0x7cf6('0x1f')]=utils[_0x7cf6('0x20')](_0x5983b7,this);return rpc[_0x1a2148+_0x7cf6('0x21')][_0x7cf6('0x22')](_0x20d5cc)['then'](function(_0x13a89f){logger['info'](_0x7cf6('0x23'),_0x24c9c8,_0x20d5cc[_0x7cf6('0x1f')]);})[_0x7cf6('0x24')](function(_0x34316c){logger[_0x7cf6('0x25')](_0x7cf6('0x23'),_0x24c9c8,JSON['stringify'](_0x34316c));})['finally'](function(){logger[_0x7cf6('0xc')](_0x7cf6('0x26'),_0x24c9c8);_0x63a18f['stop']();});}else{logger[_0x7cf6('0xc')](_0x7cf6('0x27'),_0x24c9c8);_0x63a18f['stop']();}}else{var _0x48efa9=this;var _0x5b8a8d=new AWS[(_0x7cf6('0x28'))]({'accessKeyId':_0x5bba38[0x0],'secretAccessKey':_0x5bba38[0x1],'region':_0x5bba38[0x2]});var _0x372a9d={'botAlias':_0x7cf6('0x29'),'botName':_0x5bba38[0x3],'inputText':this[_0x7cf6('0x2a')][_0x7cf6('0x1f')],'userId':this[_0x7cf6('0x13')]+':'+this[_0x7cf6('0x17')]['id'][_0x7cf6('0x2b')]()};_0x5b8a8d[_0x7cf6('0x2c')](_0x372a9d,function(_0x52e0de,_0x501573){if(_0x52e0de){logger[_0x7cf6('0x25')]('[%s][AMAZONLEX]\x20%s',_0x24c9c8,_0x52e0de[_0x7cf6('0x2a')]);_0x63a18f[_0x7cf6('0xe')]();}else if(_0x501573&&_0x501573[_0x7cf6('0x2a')]){_0x48efa9[_0x7cf6('0x1f')][_0x7cf6('0x2d')]=_0x501573;_0x20d5cc[_0x7cf6('0x1f')]=_0x501573[_0x7cf6('0x2a')];_0x20d5cc[_0x7cf6('0x2e')]=_0x7cf6('0x2d');_0x20d5cc[_0x7cf6('0x2f')]=JSON[_0x7cf6('0x30')](_0x501573);return rpc[_0x1a2148+_0x7cf6('0x21')][_0x7cf6('0x22')](_0x20d5cc)[_0x7cf6('0x31')](function(_0x51f194){logger['info']('[%s][AMAZONLEX]\x20%s',_0x24c9c8,_0x20d5cc[_0x7cf6('0x1f')]);if(_0x501573[_0x7cf6('0x32')]==_0x7cf6('0x33')){_0x63a18f[_0x7cf6('0xe')]();}else{_0x63a18f[_0x7cf6('0x34')]();}})[_0x7cf6('0x24')](function(_0x549f0a){logger[_0x7cf6('0x25')](_0x7cf6('0x23'),_0x24c9c8,JSON[_0x7cf6('0x30')](_0x549f0a));_0x63a18f[_0x7cf6('0xe')]();});}else{_0x63a18f[_0x7cf6('0xe')]();}});}}catch(_0x3d5d9b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x24c9c8,JSON[_0x7cf6('0x30')](_0x3d5d9b));_0x63a18f[_0x7cf6('0x34')]();}};}; \ 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 9a921d3..8692dd7 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 _0x6072=['','replace','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','Interaction','error','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','next','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','account','Message','Smtp','host','port','secure','auth','user','pass','inReplyTo','messageId'];(function(_0x357fa1,_0xfa5d1f){var _0x59b9b7=function(_0x40de86){while(--_0x40de86){_0x357fa1['push'](_0x357fa1['shift']());}};_0x59b9b7(++_0xfa5d1f);}(_0x6072,0x1b1));var _0x2607=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6072[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2607('0x0'));var moment=require(_0x2607('0x1'));var utils=require('./utils');var logger=require(_0x2607('0x2'))(_0x2607('0x3'));var rpc={'chatMessage':require(_0x2607('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2607('0x5')),'smsMessage':require(_0x2607('0x6')),'faxMessage':require(_0x2607('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x2607('0x8')),'openchannelInteraction':require(_0x2607('0x9')),'mailInteraction':require(_0x2607('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x2607('0xb')),'whatsappInteraction':require(_0x2607('0xc'))};var mailRpc=require(_0x2607('0xd'));exports[_0x2607('0xe')]=function(_0x3551b4,_0x49815d,_0x57b51c,_0x571d90){return function(_0x558d65){try{var _0x333fe2=this['channel'];if(_0x333fe2===_0x2607('0xf')&&_0x571d90[_0x2607('0x10')][_0x2607('0x11')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3551b4,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x558d65[_0x2607('0x12')]();}if(_0x49815d[0x0]==='1'&&(_[_0x2607('0x13')](this[_0x2607('0x14')][_0x2607('0x15')])||!this[_0x2607('0x14')][_0x2607('0x15')])){logger[_0x2607('0x16')](_0x2607('0x17'),_0x3551b4,_0x2607('0x18'));return _0x558d65['next']();}if(_0x49815d[0x0]==='2'&&this['interaction'][_0x2607('0x19')]){logger[_0x2607('0x16')](_0x2607('0x1a'),_0x3551b4,'One\x20Time\x20already\x20sent');return _0x558d65[_0x2607('0x12')]();}var _0x1a8206={'ContactId':this[_0x2607('0x1b')]['id'],'sentAt':moment()['format'](_0x2607('0x1c')),'direction':_0x2607('0x1d')};if(this[_0x2607('0x1e')]===_0x2607('0xf')){_0x1a8206['body']=utils[_0x2607('0x1f')](_0x49815d[0x2],this);}else{_0x1a8206[_0x2607('0x10')]=utils[_0x2607('0x1f')](_0x49815d[0x1],this);}if(this['message']){_0x1a8206['to']=this[_0x2607('0x20')][_0x2607('0x21')]||'';if(this[_0x2607('0x1e')]===_0x2607('0xf')&&_0x49815d[0x1]==='1'){_0x1a8206['cc']=this[_0x2607('0x20')]['cc']||'';}_0x1a8206[_0x2607('0x21')]=this[_0x2607('0x20')]['to']||'';_0x1a8206[_0x2607('0x22')]=this[_0x2607('0x20')]['phone']||'';_0x1a8206['read']=!![];if(this[_0x2607('0x20')][_0x2607('0x23')]){_0x1a8206[_0x2607('0x23')]='';_0x1a8206[_0x2607('0x23')]+=_[_0x2607('0x24')](this[_0x2607('0x20')][_0x2607('0x23')],_0x2607('0x25'))?'':_0x2607('0x26');_0x1a8206[_0x2607('0x23')]+=this['message']['subject'];}}if(this[_0x2607('0x1e')]==='chat'){_0x1a8206['ChatWebsiteId']=this[_0x2607('0x27')]['id'];}else{_0x1a8206[_['upperFirst'](this[_0x2607('0x1e')])+'AccountId']=this['account']['id'];}_0x1a8206[_['upperFirst'](this[_0x2607('0x1e')])+'InteractionId']=this[_0x2607('0x14')]['id'];var _0x1b30b3=this[_0x2607('0x14')];if(rpc[this[_0x2607('0x1e')]+_0x2607('0x28')]){if(this[_0x2607('0x1e')]===_0x2607('0xf')){var _0x5dec9e={'tls':{'rejectUnauthorized':![]}};if(this[_0x2607('0x27')][_0x2607('0x29')]['service']){_0x5dec9e['service']=this[_0x2607('0x27')][_0x2607('0x29')]['service'];}else{_0x5dec9e['host']=this[_0x2607('0x27')][_0x2607('0x29')][_0x2607('0x2a')];_0x5dec9e[_0x2607('0x2b')]=this[_0x2607('0x27')][_0x2607('0x29')][_0x2607('0x2b')];_0x5dec9e[_0x2607('0x2c')]=this[_0x2607('0x27')][_0x2607('0x29')]['secure'];}if(this['account']['Smtp']['authentication']){_0x5dec9e[_0x2607('0x2d')]={'user':this[_0x2607('0x27')][_0x2607('0x29')][_0x2607('0x2e')],'pass':this[_0x2607('0x27')][_0x2607('0x29')][_0x2607('0x2f')]};}_0x1a8206[_0x2607('0x30')]=this[_0x2607('0x20')][_0x2607('0x31')];_0x1a8206['html']=_0x2607('0x32')+_[_0x2607('0x33')](_0x1a8206[_0x2607('0x10')],'';_0x1a8206[_0x2607('0x34')]={'Auto-Submitted':_0x2607('0x35'),'X-Auto-Response-Suppress':_0x2607('0x36'),'Precedence':_0x2607('0x37')};return mailRpc['sendMailMessage'](_0x5dec9e,_0x1a8206)[_0x2607('0x38')](function(_0x3e0f0c){logger['info'](_0x2607('0x39'),_0x3551b4);_0x1a8206['messageId']=_0x3e0f0c[_0x2607('0x20')]['messageId'];return rpc[_0x333fe2+'Message']['create'](_0x1a8206);})[_0x2607('0x38')](function(_0x415227){logger[_0x2607('0x16')](_0x2607('0x17'),_0x3551b4,JSON[_0x2607('0x3a')](_0x415227));})[_0x2607('0x3b')](function(_0x1fdd0c){logger['error'](_0x2607('0x3c'),_0x3551b4,JSON[_0x2607('0x3a')](_0x1fdd0c));})[_0x2607('0x3d')](function(){Promise[_0x2607('0x3e')]()[_0x2607('0x38')](function(){if(_0x49815d[0x0]!=='2'||_0x1b30b3[_0x2607('0x19')])return;return rpc[_0x333fe2+'Interaction'][_0x2607('0x3f')](_0x1b30b3['id'],{'autoreplyExecuted':!![]})['then'](function(_0x428ff8){logger['info'](_0x2607('0x1a'),_0x3551b4,JSON[_0x2607('0x3a')](_0x428ff8));})['catch'](function(_0x376ffa){logger['error'](_0x2607('0x40'),_0x3551b4,JSON[_0x2607('0x3a')](_0x376ffa));});})['then'](function(){_0x558d65[_0x2607('0x12')]();});});}else{return rpc[this[_0x2607('0x1e')]+_0x2607('0x28')][_0x2607('0x41')](_0x1a8206)['then'](function(_0x3c2536){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3551b4,_0x1a8206['body']);})[_0x2607('0x3b')](function(_0x32586d){logger['error'](_0x2607('0x17'),_0x3551b4,JSON[_0x2607('0x3a')](_0x32586d));})['finally'](function(){Promise[_0x2607('0x3e')]()['then'](function(){if(_0x49815d[0x0]!=='2'||_0x1b30b3[_0x2607('0x19')])return;return rpc[_0x333fe2+_0x2607('0x42')][_0x2607('0x3f')](_0x1b30b3['id'],{'autoreplyExecuted':!![]})[_0x2607('0x38')](function(_0x1a8c86){logger[_0x2607('0x16')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3551b4,JSON['stringify'](_0x1a8c86));})['catch'](function(_0x3e8c31){logger[_0x2607('0x43')](_0x2607('0x40'),_0x3551b4,JSON[_0x2607('0x3a')](_0x3e8c31));});})[_0x2607('0x38')](function(){_0x558d65[_0x2607('0x12')]();});});}}}catch(_0x1de133){logger['error'](_0x2607('0x17'),_0x3551b4,JSON[_0x2607('0x3a')](_0x1de133));_0x558d65[_0x2607('0x44')]();}};}; \ No newline at end of file +var _0xf1fa=['Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','autoreplyExecuted','contact','format','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','Message','service','host','Smtp','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','';_0x4bb2e5[_0xaf1f('0x39')]={'Auto-Submitted':_0xaf1f('0x3a'),'X-Auto-Response-Suppress':_0xaf1f('0x3b'),'Precedence':_0xaf1f('0x3c')};return mailRpc[_0xaf1f('0x3d')](_0xb1c092,_0x4bb2e5)[_0xaf1f('0x3e')](function(_0x2ec63f){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x8192c4);_0x4bb2e5['messageId']=_0x2ec63f[_0xaf1f('0x1f')]['messageId'];return rpc[_0x4f37bc+'Message'][_0xaf1f('0x3f')](_0x4bb2e5);})[_0xaf1f('0x3e')](function(_0x521a9a){logger[_0xaf1f('0x12')](_0xaf1f('0x40'),_0x8192c4,JSON[_0xaf1f('0x41')](_0x521a9a));})[_0xaf1f('0x42')](function(_0xb0ca81){logger[_0xaf1f('0x43')](_0xaf1f('0x44'),_0x8192c4,JSON[_0xaf1f('0x41')](_0xb0ca81));})[_0xaf1f('0x45')](function(){Promise[_0xaf1f('0x46')]()[_0xaf1f('0x3e')](function(){if(_0x4c8c14[0x0]!=='2'||_0x50d64a[_0xaf1f('0x19')])return;return rpc[_0x4f37bc+_0xaf1f('0x47')][_0xaf1f('0x48')](_0x50d64a['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3b5112){logger[_0xaf1f('0x12')](_0xaf1f('0x49'),_0x8192c4,JSON[_0xaf1f('0x41')](_0x3b5112));})[_0xaf1f('0x42')](function(_0x42c5e7){logger[_0xaf1f('0x43')](_0xaf1f('0x4a'),_0x8192c4,JSON[_0xaf1f('0x41')](_0x42c5e7));});})[_0xaf1f('0x3e')](function(){_0x5b673e['next']();});});}else{return rpc[this[_0xaf1f('0xf')]+_0xaf1f('0x2a')][_0xaf1f('0x3f')](_0x4bb2e5)[_0xaf1f('0x3e')](function(_0x49d07d){logger[_0xaf1f('0x12')](_0xaf1f('0x40'),_0x8192c4,_0x4bb2e5[_0xaf1f('0x10')]);})['catch'](function(_0x34130f){logger[_0xaf1f('0x43')](_0xaf1f('0x40'),_0x8192c4,JSON[_0xaf1f('0x41')](_0x34130f));})['finally'](function(){Promise[_0xaf1f('0x46')]()['then'](function(){if(_0x4c8c14[0x0]!=='2'||_0x50d64a[_0xaf1f('0x19')])return;return rpc[_0x4f37bc+_0xaf1f('0x47')][_0xaf1f('0x48')](_0x50d64a['id'],{'autoreplyExecuted':!![]})[_0xaf1f('0x3e')](function(_0x56b59c){logger[_0xaf1f('0x12')](_0xaf1f('0x49'),_0x8192c4,JSON[_0xaf1f('0x41')](_0x56b59c));})[_0xaf1f('0x42')](function(_0xdbfd1c){logger[_0xaf1f('0x43')](_0xaf1f('0x4a'),_0x8192c4,JSON['stringify'](_0xdbfd1c));});})[_0xaf1f('0x3e')](function(){_0x5b673e['next']();});});}}}catch(_0x5d962b){logger[_0xaf1f('0x43')]('[%s][AUTOREPLY]\x20%s',_0x8192c4,JSON[_0xaf1f('0x41')](_0x5d962b));_0x5b673e[_0xaf1f('0x4b')]();}};}; \ 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 aef6aca..b9d46d0 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 _0xda36=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../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','system','Interaction','channel','update','interaction','then'];(function(_0x3b5e9d,_0x5970dc){var _0x44681d=function(_0x306697){while(--_0x306697){_0x3b5e9d['push'](_0x3b5e9d['shift']());}};_0x44681d(++_0x5970dc);}(_0xda36,0x101));var _0x6da3=function(_0x5c0b0c,_0x5f454b){_0x5c0b0c=_0x5c0b0c-0x0;var _0x57581a=_0xda36[_0x5c0b0c];return _0x57581a;};'use strict';var moment=require('moment');var logger=require(_0x6da3('0x0'))(_0x6da3('0x1'));var rpc={'chatInteraction':require(_0x6da3('0x2')),'openchannelInteraction':require(_0x6da3('0x3')),'smsInteraction':require(_0x6da3('0x4')),'mailInteraction':require(_0x6da3('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x6da3('0x6'))};exports[_0x6da3('0x7')]=function(_0x32a738,_0x1cc5cd,_0x4dbe7c,_0x32289f){return function(_0x7d7bd3){try{logger[_0x6da3('0x8')](_0x6da3('0x9'),_0x32a738,_0x1cc5cd[0x0]);var _0x3625f1={'closed':0x1,'closedAt':moment()[_0x6da3('0xa')](_0x6da3('0xb')),'closeReason':_0x6da3('0xc'),'disposition':_0x1cc5cd[0x0]};if(rpc[_0x32289f['channel']+_0x6da3('0xd')]){rpc[_0x32289f[_0x6da3('0xe')]+_0x6da3('0xd')][_0x6da3('0xf')](_0x32289f[_0x6da3('0x10')]['id'],_0x3625f1)[_0x6da3('0x11')](function(_0x5be01d){logger[_0x6da3('0x8')](_0x6da3('0x12'),_0x32a738,_0x32289f[_0x6da3('0x10')]['id']);})[_0x6da3('0x13')](function(_0x18625b){logger[_0x6da3('0x14')](_0x6da3('0x15'),_0x32a738,JSON[_0x6da3('0x16')](_0x18625b));})[_0x6da3('0x17')](function(){_0x7d7bd3[_0x6da3('0x18')]();});}}catch(_0x3bf2ea){logger[_0x6da3('0x14')](_0x6da3('0x15'),_0x32a738,JSON['stringify'](_0x3bf2ea));_0x7d7bd3[_0x6da3('0x18')]();}};}; \ No newline at end of file +var _0xd568=['then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction'];(function(_0x2d36a6,_0x2f8cd0){var _0x59cec0=function(_0x5a56d0){while(--_0x5a56d0){_0x2d36a6['push'](_0x2d36a6['shift']());}};_0x59cec0(++_0x2f8cd0);}(_0xd568,0x188));var _0x8d56=function(_0x4e2989,_0x5e8116){_0x4e2989=_0x4e2989-0x0;var _0x86a456=_0xd568[_0x4e2989];return _0x86a456;};'use strict';var moment=require(_0x8d56('0x0'));var logger=require(_0x8d56('0x1'))(_0x8d56('0x2'));var rpc={'chatInteraction':require(_0x8d56('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x8d56('0x4')),'faxInteraction':require(_0x8d56('0x5')),'whatsappInteraction':require(_0x8d56('0x6'))};exports[_0x8d56('0x7')]=function(_0x899b58,_0x1ba16e,_0x4003df,_0x3f2800){return function(_0x391a05){try{logger[_0x8d56('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x899b58,_0x1ba16e[0x0]);var _0x274fb3={'closed':0x1,'closedAt':moment()[_0x8d56('0x9')](_0x8d56('0xa')),'closeReason':_0x8d56('0xb'),'disposition':_0x1ba16e[0x0]};if(rpc[_0x3f2800['channel']+_0x8d56('0xc')]){rpc[_0x3f2800[_0x8d56('0xd')]+_0x8d56('0xc')][_0x8d56('0xe')](_0x3f2800[_0x8d56('0xf')]['id'],_0x274fb3)[_0x8d56('0x10')](function(_0x4a7e4c){logger[_0x8d56('0x8')](_0x8d56('0x11'),_0x899b58,_0x3f2800['interaction']['id']);})[_0x8d56('0x12')](function(_0x3b3881){logger[_0x8d56('0x13')](_0x8d56('0x14'),_0x899b58,JSON[_0x8d56('0x15')](_0x3b3881));})[_0x8d56('0x16')](function(){_0x391a05[_0x8d56('0x17')]();});}}catch(_0x4f3a7b){logger[_0x8d56('0x13')]('[%s][CLOSE]\x20%s',_0x899b58,JSON[_0x8d56('0x15')](_0x4f3a7b));_0x391a05[_0x8d56('0x17')]();}};}; \ 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 c71c684..ba4248b 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 _0xf1c6=['routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','body','Message','create','info','[%s][DIALOGFLOW]\x20%s','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','fulfillment','speech','providerName','providerResponse','metadata','endConversation','catch','stringify','stop','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger'];(function(_0x13ce61,_0x23f0bd){var _0x404ae8=function(_0x362d11){while(--_0x362d11){_0x13ce61['push'](_0x13ce61['shift']());}};_0x404ae8(++_0x23f0bd);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x562996,_0x20fd20){_0x562996=_0x562996-0x0;var _0x3b303f=_0xf1c6[_0x562996];return _0x3b303f;};'use strict';var _=require(_0x6f1c('0x0'));var moment=require(_0x6f1c('0x1'));var apiai=require(_0x6f1c('0x2'));var md5=require(_0x6f1c('0x3'));var utils=require(_0x6f1c('0x4'));var logger=require(_0x6f1c('0x5'))(_0x6f1c('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6f1c('0x7')),'mailMessage':require(_0x6f1c('0x8')),'smsMessage':require(_0x6f1c('0x9')),'faxMessage':require(_0x6f1c('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1a3460,_0x2d0f02){return function(_0x3f7b30){try{if(!_[_0x6f1c('0xb')](this[_0x6f1c('0xc')][_0x6f1c('0xd')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1a3460,_0x6f1c('0xe'));return _0x3f7b30[_0x6f1c('0xf')]();}var _0xed1cca={'ContactId':this[_0x6f1c('0x10')]['id'],'sentAt':moment()[_0x6f1c('0x11')](_0x6f1c('0x12')),'direction':'out'};if(this[_0x6f1c('0x13')]===_0x6f1c('0x14')||this['channel']===_0x6f1c('0x15')){_0xed1cca['phone']=this['interaction'][_0x6f1c('0x16')];}var _0x2d5956=this['channel'];if(_0x2d5956==='chat'){_0xed1cca[_0x6f1c('0x17')]=this['account']['id'];}else{_0xed1cca[_[_0x6f1c('0x18')](_0x2d5956)+_0x6f1c('0x19')]=this[_0x6f1c('0x1a')]['id'];}_0xed1cca[_[_0x6f1c('0x18')](_0x2d5956)+_0x6f1c('0x1b')]=this[_0x6f1c('0xc')]['id'];if(this[_0x6f1c('0xc')]['created']){var _0x2ca612=_0x2d0f02[0x2];if(!_['isEmpty'](_0x2ca612)){_0xed1cca[_0x6f1c('0x1c')]=utils['getMustacheRender'](_0x2ca612,this);return rpc[_0x2d5956+_0x6f1c('0x1d')][_0x6f1c('0x1e')](_0xed1cca)['then'](function(_0x5475d6){logger[_0x6f1c('0x1f')](_0x6f1c('0x20'),_0x1a3460,_0xed1cca[_0x6f1c('0x1c')]);})['catch'](function(_0x202aa9){logger[_0x6f1c('0x21')](_0x6f1c('0x20'),_0x1a3460,JSON['stringify'](_0x202aa9));})[_0x6f1c('0x22')](function(){logger[_0x6f1c('0x1f')](_0x6f1c('0x23'),_0x1a3460);_0x3f7b30['stop']();});}else{logger[_0x6f1c('0x1f')](_0x6f1c('0x24'),_0x1a3460);_0x3f7b30['stop']();}}else{var _0x20fd66=this;var _0x1f7ac2=apiai(_0x2d0f02[0x0],{'language':_0x2d0f02[0x1]||'en'});return _0x1f7ac2[_0x6f1c('0x25')](this[_0x6f1c('0x26')]['body'],{'sessionId':md5(this[_0x6f1c('0xc')]['id'])})[_0x6f1c('0x27')](function(_0x235773){_0x20fd66[_0x6f1c('0x1c')][_0x6f1c('0x28')]=_0x235773;_0xed1cca[_0x6f1c('0x1c')]=_0x235773['result'][_0x6f1c('0x29')][_0x6f1c('0x2a')];_0xed1cca[_0x6f1c('0x2b')]=_0x6f1c('0x28');_0xed1cca[_0x6f1c('0x2c')]=JSON['stringify'](_0x235773);return rpc[_0x2d5956+_0x6f1c('0x1d')][_0x6f1c('0x1e')](_0xed1cca)[_0x6f1c('0x27')](function(_0x1faa4a){logger[_0x6f1c('0x1f')](_0x6f1c('0x20'),_0x1a3460,_0xed1cca['body']);if(_0x235773['result'][_0x6f1c('0x2d')][_0x6f1c('0x2e')]){_0x3f7b30[_0x6f1c('0xf')]();}else{_0x3f7b30['stop']();}})[_0x6f1c('0x2f')](function(_0x1e861c){logger[_0x6f1c('0x21')](_0x6f1c('0x20'),_0x1a3460,JSON['stringify'](_0x1e861c));_0x3f7b30[_0x6f1c('0xf')]();});})[_0x6f1c('0x2f')](function(_0x5c09ba){logger[_0x6f1c('0x21')](_0x6f1c('0x20'),_0x1a3460,_0x5c09ba[_0x6f1c('0x26')]);_0x3f7b30['next']();});}}catch(_0x477e37){logger['error'](_0x6f1c('0x20'),_0x1a3460,JSON[_0x6f1c('0x30')](_0x477e37));_0x3f7b30[_0x6f1c('0x31')]();}};}; \ No newline at end of file +var _0x5bc1=['upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','providerName','providerResponse','metadata','endConversation','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account'];(function(_0x117de4,_0x379156){var _0x3d1342=function(_0x53925b){while(--_0x53925b){_0x117de4['push'](_0x117de4['shift']());}};_0x3d1342(++_0x379156);}(_0x5bc1,0xb5));var _0x15bc=function(_0x2b5d39,_0x55a5f2){_0x2b5d39=_0x2b5d39-0x0;var _0x3917c4=_0x5bc1[_0x2b5d39];return _0x3917c4;};'use strict';var _=require('lodash');var moment=require(_0x15bc('0x0'));var apiai=require(_0x15bc('0x1'));var md5=require(_0x15bc('0x2'));var utils=require(_0x15bc('0x3'));var logger=require(_0x15bc('0x4'))(_0x15bc('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x15bc('0x6')),'smsMessage':require(_0x15bc('0x7')),'faxMessage':require(_0x15bc('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x15bc('0x9')]=function(_0x483c6d,_0x344121){return function(_0x3eff99){try{if(!_[_0x15bc('0xa')](this[_0x15bc('0xb')][_0x15bc('0xc')])){logger[_0x15bc('0xd')](_0x15bc('0xe'),_0x483c6d,_0x15bc('0xf'));return _0x3eff99[_0x15bc('0x10')]();}var _0x37302c={'ContactId':this['contact']['id'],'sentAt':moment()[_0x15bc('0x11')](_0x15bc('0x12')),'direction':_0x15bc('0x13')};if(this['channel']===_0x15bc('0x14')||this[_0x15bc('0x15')]===_0x15bc('0x16')){_0x37302c[_0x15bc('0x17')]=this['interaction'][_0x15bc('0x17')];}var _0x19b43b=this[_0x15bc('0x15')];if(_0x19b43b===_0x15bc('0x18')){_0x37302c[_0x15bc('0x19')]=this[_0x15bc('0x1a')]['id'];}else{_0x37302c[_[_0x15bc('0x1b')](_0x19b43b)+_0x15bc('0x1c')]=this[_0x15bc('0x1a')]['id'];}_0x37302c[_[_0x15bc('0x1b')](_0x19b43b)+_0x15bc('0x1d')]=this[_0x15bc('0xb')]['id'];if(this[_0x15bc('0xb')][_0x15bc('0x1e')]){var _0x5599a2=_0x344121[0x2];if(!_[_0x15bc('0x1f')](_0x5599a2)){_0x37302c[_0x15bc('0x20')]=utils[_0x15bc('0x21')](_0x5599a2,this);return rpc[_0x19b43b+_0x15bc('0x22')][_0x15bc('0x23')](_0x37302c)[_0x15bc('0x24')](function(_0x395438){logger[_0x15bc('0xd')](_0x15bc('0xe'),_0x483c6d,_0x37302c[_0x15bc('0x20')]);})[_0x15bc('0x25')](function(_0x4c132c){logger[_0x15bc('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x483c6d,JSON[_0x15bc('0x27')](_0x4c132c));})['finally'](function(){logger[_0x15bc('0xd')](_0x15bc('0x28'),_0x483c6d);_0x3eff99[_0x15bc('0x29')]();});}else{logger['info'](_0x15bc('0x2a'),_0x483c6d);_0x3eff99['stop']();}}else{var _0x31ed06=this;var _0x2bebcc=apiai(_0x344121[0x0],{'language':_0x344121[0x1]||'en'});return _0x2bebcc[_0x15bc('0x2b')](this[_0x15bc('0x2c')][_0x15bc('0x20')],{'sessionId':md5(this[_0x15bc('0xb')]['id'])})[_0x15bc('0x24')](function(_0x424020){_0x31ed06['body'][_0x15bc('0x2d')]=_0x424020;_0x37302c[_0x15bc('0x20')]=_0x424020[_0x15bc('0x2e')][_0x15bc('0x2f')]['speech'];_0x37302c[_0x15bc('0x30')]=_0x15bc('0x2d');_0x37302c[_0x15bc('0x31')]=JSON[_0x15bc('0x27')](_0x424020);return rpc[_0x19b43b+_0x15bc('0x22')]['create'](_0x37302c)[_0x15bc('0x24')](function(_0x5f3985){logger[_0x15bc('0xd')](_0x15bc('0xe'),_0x483c6d,_0x37302c[_0x15bc('0x20')]);if(_0x424020[_0x15bc('0x2e')][_0x15bc('0x32')][_0x15bc('0x33')]){_0x3eff99[_0x15bc('0x10')]();}else{_0x3eff99[_0x15bc('0x29')]();}})['catch'](function(_0x4146ab){logger[_0x15bc('0x26')](_0x15bc('0xe'),_0x483c6d,JSON[_0x15bc('0x27')](_0x4146ab));_0x3eff99[_0x15bc('0x10')]();});})[_0x15bc('0x25')](function(_0x181e37){logger[_0x15bc('0x26')](_0x15bc('0xe'),_0x483c6d,_0x181e37[_0x15bc('0x2c')]);_0x3eff99['next']();});}}catch(_0x48c5e5){logger['error'](_0x15bc('0xe'),_0x483c6d,JSON[_0x15bc('0x27')](_0x48c5e5));_0x3eff99['stop']();}};}; \ 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 cd3a023..ea984e0 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 _0x2cf6=['account','upperFirst','AccountId','InteractionId','created','create','catch','error','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','length','fulfillmentText','push','all','stop','next','lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/whatsappMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','interaction','phone','chat','ChatWebsiteId'];(function(_0xb135a7,_0x10a6bf){var _0x6d364a=function(_0x4d44e7){while(--_0x4d44e7){_0xb135a7['push'](_0xb135a7['shift']());}};_0x6d364a(++_0x10a6bf);}(_0x2cf6,0x177));var _0x62cf=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x2cf6[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x62cf('0x0'));var dialogflow=require(_0x62cf('0x1'));var md5=require(_0x62cf('0x2'));var moment=require(_0x62cf('0x3'));var Promise=require('bluebird');var logger=require(_0x62cf('0x4'))(_0x62cf('0x5'));var utils=require(_0x62cf('0x6'));var rpc={'chatMessage':require(_0x62cf('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x62cf('0x8'))};function createMessage(_0x91d515,_0x4e0d06,_0x38c78b,_0x4f486b){return new Promise(function(_0x2de0dd,_0x39fd91){var _0x31b9f7=_[_0x62cf('0x9')](_0x38c78b);_0x31b9f7[_0x62cf('0xa')]=_0x4f486b;return rpc[_0x4e0d06+_0x62cf('0xb')]['create'](_0x31b9f7)[_0x62cf('0xc')](function(){logger[_0x62cf('0xd')](_0x62cf('0xe'),_0x91d515,_0x31b9f7[_0x62cf('0xa')]);_0x2de0dd();})['catch'](function(_0x8c6d84){logger['error'](_0x62cf('0xe'),_0x91d515,JSON['stringify'](_0x8c6d84));_0x39fd91(_0x8c6d84);});});}exports[_0x62cf('0xf')]=function(_0x309ab8,_0x2d0888){return function(_0x5b1756){try{if(!_[_0x62cf('0x10')](this['interaction']['UserId'])){logger[_0x62cf('0xd')](_0x62cf('0xe'),_0x309ab8,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5b1756['next']();}var _0x493aec={'ContactId':this[_0x62cf('0x11')]['id'],'sentAt':moment()[_0x62cf('0x12')](_0x62cf('0x13')),'direction':'out'};if(this[_0x62cf('0x14')]===_0x62cf('0x15')||this[_0x62cf('0x14')]===_0x62cf('0x16')){_0x493aec['phone']=this[_0x62cf('0x17')][_0x62cf('0x18')];}var _0x31a52d=this['channel'];if(_0x31a52d===_0x62cf('0x19')){_0x493aec[_0x62cf('0x1a')]=this[_0x62cf('0x1b')]['id'];}else{_0x493aec[_[_0x62cf('0x1c')](_0x31a52d)+_0x62cf('0x1d')]=this['account']['id'];}_0x493aec[_['upperFirst'](_0x31a52d)+_0x62cf('0x1e')]=this['interaction']['id'];if(this['interaction'][_0x62cf('0x1f')]){var _0x58650a=_0x2d0888[0x4];if(!_['isEmpty'](_0x58650a)){_0x493aec[_0x62cf('0xa')]=utils['getMustacheRender'](_0x58650a,this);return rpc[_0x31a52d+_0x62cf('0xb')][_0x62cf('0x20')](_0x493aec)['then'](function(_0x41a81e){logger['info'](_0x62cf('0xe'),_0x309ab8,_0x493aec['body']);})[_0x62cf('0x21')](function(_0x32debe){logger[_0x62cf('0x22')](_0x62cf('0xe'),_0x309ab8,JSON[_0x62cf('0x23')](_0x32debe));})['finally'](function(){logger[_0x62cf('0xd')](_0x62cf('0x24'),_0x309ab8);_0x5b1756['stop']();});}else{logger[_0x62cf('0xd')](_0x62cf('0x25'),_0x309ab8);_0x5b1756['stop']();}}else{var _0x1938b9=this;var _0x76394=_0x2d0888[0x2]['replace'](/\\n/g,'\x0a');var _0x589637={'credentials':{'private_key':_0x76394,'client_email':_0x2d0888[0x1]}};var _0x41973f=new dialogflow[(_0x62cf('0x26'))](_0x589637);var _0x13f6b3=_0x41973f['sessionPath'](_0x2d0888[0x0],md5(_0x1938b9['interaction']['id']));var _0x36d20c={'session':_0x13f6b3,'queryInput':{'text':{'text':_0x1938b9[_0x62cf('0x27')][_0x62cf('0xa')],'languageCode':_0x2d0888[0x3]||'en'}}};return _0x41973f[_0x62cf('0x28')](_0x36d20c)[_0x62cf('0xc')](function(_0x51067c){if(_0x51067c&&_0x51067c['length']){_0x1938b9[_0x62cf('0xa')][_0x62cf('0x29')]=_0x51067c;var _0x2afd86=_0x51067c[0x0];var _0x3819e2=_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x2b')]&&_0x2afd86['queryResult'][_0x62cf('0x2b')][_0x62cf('0x2c')]?_0x2afd86['queryResult'][_0x62cf('0x2b')]['fields'][_0x62cf('0x2d')][_0x62cf('0x2e')]:![];_0x1938b9[_0x62cf('0xa')][_0x62cf('0x2f')]=_0x2afd86['queryResult']['action'];_0x1938b9[_0x62cf('0xa')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2afd86['queryResult'][_0x62cf('0x30')];_0x1938b9[_0x62cf('0xa')][_0x62cf('0x31')]=_0x2afd86[_0x62cf('0x2a')]['diagnosticInfo']&&_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x2b')][_0x62cf('0x2c')]?_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x2b')][_0x62cf('0x2c')][_0x62cf('0x2d')][_0x62cf('0x2e')]:![];_0x1938b9['body']['DIALOGFLOWV2_INTENTNAME']=_0x2afd86['queryResult'][_0x62cf('0x32')][_0x62cf('0x33')];_0x1938b9[_0x62cf('0xa')][_0x62cf('0x34')]=_0x2afd86['queryResult'][_0x62cf('0x32')][_0x62cf('0x35')];_0x1938b9[_0x62cf('0xa')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x32')][_0x62cf('0x36')];_0x1938b9[_0x62cf('0xa')][_0x62cf('0x37')]=_0x2afd86['queryResult'][_0x62cf('0x38')];_0x1938b9['body'][_0x62cf('0x39')]=_0x2afd86[_0x62cf('0x2a')]['queryText'];_0x1938b9['body'][_0x62cf('0x3a')]=_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x3b')];_0x493aec[_0x62cf('0x3c')]='dialogflowV2';_0x493aec['providerResponse']=JSON['stringify'](_0x51067c);var _0x213d52=[];for(var _0x22336c=0x0;_0x22336c<_0x51067c[_0x62cf('0x3d')];_0x22336c++){var _0x75af0=_0x51067c[_0x22336c];if(_0x75af0&&_0x75af0['queryResult']&&_0x75af0['queryResult'][_0x62cf('0x3e')]){_0x213d52[_0x62cf('0x3f')](createMessage(_0x309ab8,_0x31a52d,_0x493aec,_0x75af0[_0x62cf('0x2a')][_0x62cf('0x3e')]));}}return Promise[_0x62cf('0x40')](_0x213d52)[_0x62cf('0xc')](function(){if(_0x3819e2){_0x5b1756['next']();}else{_0x5b1756[_0x62cf('0x41')]();}})[_0x62cf('0x21')](function(_0x3c81ac){logger[_0x62cf('0x22')](_0x62cf('0xe'),_0x309ab8,JSON['stringify'](_0x3c81ac));_0x5b1756[_0x62cf('0x42')]();});}})[_0x62cf('0x21')](function(_0x4fca38){logger['error'](_0x62cf('0xe'),_0x309ab8,_0x4fca38[_0x62cf('0x27')]);_0x5b1756[_0x62cf('0x42')]();});}}catch(_0x2e8f90){logger[_0x62cf('0x22')]('[%s][DIALOGFLOWV2]\x20%s',_0x309ab8,JSON['stringify'](_0x2e8f90));_0x5b1756['stop']();}};}; \ No newline at end of file +var _0xa176=['stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','name','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','providerResponse','length','fulfillmentText','push','all','message','lodash','dialogflow','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','info','[%s][DIALOGFLOWV2]\x20%s','consequence','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','getMustacheRender','then','catch','error'];(function(_0x42ee2e,_0x513cb8){var _0x309428=function(_0x7c5017){while(--_0x7c5017){_0x42ee2e['push'](_0x42ee2e['shift']());}};_0x309428(++_0x513cb8);}(_0xa176,0xaa));var _0x6a17=function(_0x19c8e6,_0x18f49e){_0x19c8e6=_0x19c8e6-0x0;var _0x14ddbf=_0xa176[_0x19c8e6];return _0x14ddbf;};'use strict';var _=require(_0x6a17('0x0'));var dialogflow=require(_0x6a17('0x1'));var md5=require('md5');var moment=require(_0x6a17('0x2'));var Promise=require(_0x6a17('0x3'));var logger=require('../../../../config/logger')(_0x6a17('0x4'));var utils=require(_0x6a17('0x5'));var rpc={'chatMessage':require(_0x6a17('0x6')),'openchannelMessage':require(_0x6a17('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6a17('0x8')),'faxMessage':require(_0x6a17('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x186ff2,_0x511756,_0x519e9b,_0x2d72fb){return new Promise(function(_0x8072d6,_0x145d5e){var _0x1b8a14=_[_0x6a17('0xa')](_0x519e9b);_0x1b8a14[_0x6a17('0xb')]=_0x2d72fb;return rpc[_0x511756+_0x6a17('0xc')]['create'](_0x1b8a14)['then'](function(){logger[_0x6a17('0xd')](_0x6a17('0xe'),_0x186ff2,_0x1b8a14[_0x6a17('0xb')]);_0x8072d6();})['catch'](function(_0x58f733){logger['error'](_0x6a17('0xe'),_0x186ff2,JSON['stringify'](_0x58f733));_0x145d5e(_0x58f733);});});}exports[_0x6a17('0xf')]=function(_0x1decf4,_0x576804){return function(_0x49bf40){try{if(!_['isNil'](this[_0x6a17('0x10')][_0x6a17('0x11')])){logger[_0x6a17('0xd')](_0x6a17('0xe'),_0x1decf4,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x49bf40[_0x6a17('0x12')]();}var _0x575ea6={'ContactId':this[_0x6a17('0x13')]['id'],'sentAt':moment()[_0x6a17('0x14')](_0x6a17('0x15')),'direction':_0x6a17('0x16')};if(this['channel']===_0x6a17('0x17')||this[_0x6a17('0x18')]===_0x6a17('0x19')){_0x575ea6[_0x6a17('0x1a')]=this['interaction'][_0x6a17('0x1a')];}var _0x2a0ae7=this['channel'];if(_0x2a0ae7===_0x6a17('0x1b')){_0x575ea6[_0x6a17('0x1c')]=this[_0x6a17('0x1d')]['id'];}else{_0x575ea6[_[_0x6a17('0x1e')](_0x2a0ae7)+_0x6a17('0x1f')]=this[_0x6a17('0x1d')]['id'];}_0x575ea6[_['upperFirst'](_0x2a0ae7)+_0x6a17('0x20')]=this[_0x6a17('0x10')]['id'];if(this['interaction']['created']){var _0x181787=_0x576804[0x4];if(!_['isEmpty'](_0x181787)){_0x575ea6['body']=utils[_0x6a17('0x21')](_0x181787,this);return rpc[_0x2a0ae7+_0x6a17('0xc')]['create'](_0x575ea6)[_0x6a17('0x22')](function(_0x41ad23){logger[_0x6a17('0xd')](_0x6a17('0xe'),_0x1decf4,_0x575ea6[_0x6a17('0xb')]);})[_0x6a17('0x23')](function(_0x33e703){logger[_0x6a17('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0x1decf4,JSON[_0x6a17('0x25')](_0x33e703));})['finally'](function(){logger[_0x6a17('0xd')](_0x6a17('0x26'),_0x1decf4);_0x49bf40[_0x6a17('0x27')]();});}else{logger[_0x6a17('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1decf4);_0x49bf40[_0x6a17('0x27')]();}}else{var _0x166552=this;var _0x12b9b5=_0x576804[0x2][_0x6a17('0x28')](/\\n/g,'\x0a');var _0x5b0b2f={'credentials':{'private_key':_0x12b9b5,'client_email':_0x576804[0x1]}};var _0x4771a8=new dialogflow[(_0x6a17('0x29'))](_0x5b0b2f);var _0x598ace=_0x4771a8[_0x6a17('0x2a')](_0x576804[0x0],md5(_0x166552[_0x6a17('0x10')]['id']));var _0x11b987={'session':_0x598ace,'queryInput':{'text':{'text':_0x166552['message'][_0x6a17('0xb')],'languageCode':_0x576804[0x3]||'en'}}};return _0x4771a8[_0x6a17('0x2b')](_0x11b987)[_0x6a17('0x22')](function(_0x234c5f){if(_0x234c5f&&_0x234c5f['length']){_0x166552['body'][_0x6a17('0x2c')]=_0x234c5f;var _0x5dc9ab=_0x234c5f[0x0];var _0x101e8f=_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x2e')]&&_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x2e')]['fields']?_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x2e')][_0x6a17('0x2f')]['end_conversation'][_0x6a17('0x30')]:![];_0x166552[_0x6a17('0xb')]['DIALOGFLOWV2_ACTION']=_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x31')];_0x166552[_0x6a17('0xb')][_0x6a17('0x32')]=_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x33')];_0x166552[_0x6a17('0xb')][_0x6a17('0x34')]=_0x5dc9ab['queryResult']['diagnosticInfo']&&_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x2e')][_0x6a17('0x2f')]?_0x5dc9ab[_0x6a17('0x2d')]['diagnosticInfo']['fields'][_0x6a17('0x35')]['boolValue']:![];_0x166552[_0x6a17('0xb')][_0x6a17('0x36')]=_0x5dc9ab[_0x6a17('0x2d')]['intent'][_0x6a17('0x37')];_0x166552[_0x6a17('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x38')][_0x6a17('0x39')];_0x166552[_0x6a17('0xb')][_0x6a17('0x3a')]=_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x38')]['isFallback'];_0x166552['body'][_0x6a17('0x3b')]=_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x3c')];_0x166552[_0x6a17('0xb')][_0x6a17('0x3d')]=_0x5dc9ab[_0x6a17('0x2d')][_0x6a17('0x3e')];_0x166552[_0x6a17('0xb')]['DIALOGFLOWV2_SCORE']=_0x5dc9ab[_0x6a17('0x2d')]['intentDetectionConfidence'];_0x575ea6['providerName']=_0x6a17('0x2c');_0x575ea6[_0x6a17('0x3f')]=JSON['stringify'](_0x234c5f);var _0x2c23a3=[];for(var _0x3feede=0x0;_0x3feede<_0x234c5f[_0x6a17('0x40')];_0x3feede++){var _0x1268bc=_0x234c5f[_0x3feede];if(_0x1268bc&&_0x1268bc[_0x6a17('0x2d')]&&_0x1268bc[_0x6a17('0x2d')][_0x6a17('0x41')]){_0x2c23a3[_0x6a17('0x42')](createMessage(_0x1decf4,_0x2a0ae7,_0x575ea6,_0x1268bc[_0x6a17('0x2d')][_0x6a17('0x41')]));}}return Promise[_0x6a17('0x43')](_0x2c23a3)[_0x6a17('0x22')](function(){if(_0x101e8f){_0x49bf40[_0x6a17('0x12')]();}else{_0x49bf40[_0x6a17('0x27')]();}})[_0x6a17('0x23')](function(_0x2632ba){logger[_0x6a17('0x24')](_0x6a17('0xe'),_0x1decf4,JSON['stringify'](_0x2632ba));_0x49bf40['next']();});}})[_0x6a17('0x23')](function(_0x3c1b1a){logger[_0x6a17('0x24')](_0x6a17('0xe'),_0x1decf4,_0x3c1b1a[_0x6a17('0x44')]);_0x49bf40[_0x6a17('0x12')]();});}}catch(_0x26f9da){logger[_0x6a17('0x24')](_0x6a17('0xe'),_0x1decf4,JSON['stringify'](_0x26f9da));_0x49bf40[_0x6a17('0x27')]();}};}; \ 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 2e9b3c7..7c333fb 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 _0xc4de=['[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error'];(function(_0x26fcb7,_0x15fd7d){var _0x4bcfc9=function(_0x6913c8){while(--_0x6913c8){_0x26fcb7['push'](_0x26fcb7['shift']());}};_0x4bcfc9(++_0x15fd7d);}(_0xc4de,0x17d));var _0xec4d=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xc4de[_0x39e283];return _0x7de89f;};'use strict';var schema=require(_0xec4d('0x0'));var _=require(_0xec4d('0x1'));var htmlToText=require(_0xec4d('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xec4d('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xec4d('0x4')},'priorityTrue':{'type':'number','message':_0xec4d('0x5')},'priorityFalse':{'type':_0xec4d('0x6'),'message':_0xec4d('0x7')}});exports[_0xec4d('0x8')]=function(_0x909de1,_0x20f1a9){return function(_0x4aafd5){try{var _0xd24ad0={'condition':htmlToText['fromString'](utils[_0xec4d('0x9')](_0x20f1a9[0x0],this),{'wordwrap':![]})[_0xec4d('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x20f1a9[0x1],'priorityFalse':_0x20f1a9[0x2]};var _0x2f38a7=gotoif[_0xec4d('0x0')](_0xd24ad0,{'typecast':!![]});if(_0x2f38a7['length']){logger['error'](_0xec4d('0xb'),_0x909de1,_[_0xec4d('0xc')](_0x2f38a7,'message')[_0xec4d('0xd')](',\x20'));_0x4aafd5[_0xec4d('0xe')]();}else{try{var _0x3ddc6f=eval('('+_0xd24ad0[_0xec4d('0xf')]+')');var _0x375b11=_0x3ddc6f?_0xd24ad0[_0xec4d('0x10')]:_0xd24ad0['priorityFalse'];logger[_0xec4d('0x11')](_0xec4d('0x12'),_0x909de1,_0xd24ad0['condition'],_0x3ddc6f,_0x375b11||_0xec4d('0x13'));if(_0x375b11){var _0x1e95ab=_[_0xec4d('0x14')](_0x4aafd5['rules'](),{'p':_0x375b11});if(_0x1e95ab>=0x0){logger[_0xec4d('0x11')](_0xec4d('0x15'),_0x909de1,_0x375b11||'next',_0x1e95ab);_0x4aafd5[_0xec4d('0x13')](_0x1e95ab);}else{logger['info'](_0xec4d('0x16'),_0x909de1,_0x375b11||_0xec4d('0x13'));_0x4aafd5[_0xec4d('0xe')]();}}else{_0x4aafd5[_0xec4d('0x13')]();}}catch(_0x3c2730){logger[_0xec4d('0x17')](_0xec4d('0x18'),_0x909de1,_0x3c2730[_0xec4d('0x19')]);_0x4aafd5[_0xec4d('0xe')]();}}}catch(_0x4925da){logger['error'](_0xec4d('0xb'),_0x909de1,JSON[_0xec4d('0x1a')](_0x4925da));_0x4aafd5[_0xec4d('0xe')]();}};}; \ No newline at end of file +var _0xec3c=['rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','validate','length','error','map','message','join','stop','condition','priorityTrue','priorityFalse','info','next'];(function(_0x1888e4,_0x58215b){var _0xf4cbd8=function(_0x3138a5){while(--_0x3138a5){_0x1888e4['push'](_0x1888e4['shift']());}};_0xf4cbd8(++_0x58215b);}(_0xec3c,0xe4));var _0xcec3=function(_0x46f09d,_0x5eeac5){_0x46f09d=_0x46f09d-0x0;var _0x4a77be=_0xec3c[_0x46f09d];return _0x4a77be;};'use strict';var schema=require('validate');var _=require(_0xcec3('0x0'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xcec3('0x1'))(_0xcec3('0x2'));var gotoif=schema({'condition':{'type':_0xcec3('0x3'),'required':!![],'message':_0xcec3('0x4')},'priorityTrue':{'type':_0xcec3('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xcec3('0x5'),'message':_0xcec3('0x6')}});exports[_0xcec3('0x7')]=function(_0x457ad7,_0x12e304){return function(_0x53f938){try{var _0x2b7f7d={'condition':htmlToText[_0xcec3('0x8')](utils[_0xcec3('0x9')](_0x12e304[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x12e304[0x1],'priorityFalse':_0x12e304[0x2]};var _0x243dcc=gotoif[_0xcec3('0xa')](_0x2b7f7d,{'typecast':!![]});if(_0x243dcc[_0xcec3('0xb')]){logger[_0xcec3('0xc')]('[%s][GOTOIF]\x20%s',_0x457ad7,_[_0xcec3('0xd')](_0x243dcc,_0xcec3('0xe'))[_0xcec3('0xf')](',\x20'));_0x53f938[_0xcec3('0x10')]();}else{try{var _0x148f02=eval('('+_0x2b7f7d[_0xcec3('0x11')]+')');var _0x55d64c=_0x148f02?_0x2b7f7d[_0xcec3('0x12')]:_0x2b7f7d[_0xcec3('0x13')];logger[_0xcec3('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x457ad7,_0x2b7f7d[_0xcec3('0x11')],_0x148f02,_0x55d64c||_0xcec3('0x15'));if(_0x55d64c){var _0x5d81ec=_['findIndex'](_0x53f938[_0xcec3('0x16')](),{'p':_0x55d64c});if(_0x5d81ec>=0x0){logger[_0xcec3('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x457ad7,_0x55d64c||_0xcec3('0x15'),_0x5d81ec);_0x53f938[_0xcec3('0x15')](_0x5d81ec);}else{logger['info'](_0xcec3('0x17'),_0x457ad7,_0x55d64c||'next');_0x53f938[_0xcec3('0x10')]();}}else{_0x53f938[_0xcec3('0x15')]();}}catch(_0x5110f5){logger[_0xcec3('0xc')](_0xcec3('0x18'),_0x457ad7,_0x5110f5[_0xcec3('0xe')]);_0x53f938['stop']();}}}catch(_0x53e0cf){logger[_0xcec3('0xc')]('[%s][GOTOIF]\x20%s',_0x457ad7,JSON['stringify'](_0x53e0cf));_0x53f938[_0xcec3('0x10')]();}};}; \ 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 dac1bdd..f769296 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 _0xc777=['[%s][GOTOP]\x20%s','map','message','stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc777,0x81));var _0x7c77=function(_0x594576,_0x5c47c3){_0x594576=_0x594576-0x0;var _0xf5afc6=_0xc777[_0x594576];return _0xf5afc6;};'use strict';var schema=require(_0x7c77('0x0'));var _=require(_0x7c77('0x1'));var logger=require(_0x7c77('0x2'))(_0x7c77('0x3'));var gotop=schema({'priority':{'type':_0x7c77('0x4'),'required':!![],'message':_0x7c77('0x5')}});exports[_0x7c77('0x6')]=function(_0xda33e2,_0x41443e){return function(_0x299ad9){try{var _0x2f6868={'priority':_0x41443e[0x0]};var _0x862ee3=gotop[_0x7c77('0x0')](_0x2f6868,{'typecast':!![]});if(_0x862ee3['length']){logger['error'](_0x7c77('0x7'),_0xda33e2,_[_0x7c77('0x8')](_0x862ee3,_0x7c77('0x9'))['join'](',\x20'));_0x299ad9[_0x7c77('0xa')]();}else{logger[_0x7c77('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0xda33e2,_0x2f6868[_0x7c77('0xc')]);if(_0x2f6868[_0x7c77('0xc')]){var _0x152f62=_['findIndex'](_0x299ad9[_0x7c77('0xd')](),{'p':_0x2f6868[_0x7c77('0xc')]});if(_0x152f62>=0x0){logger[_0x7c77('0xb')](_0x7c77('0xe'),_0xda33e2,_0x2f6868['priority']||_0x7c77('0xf'),_0x152f62);_0x299ad9[_0x7c77('0xf')](_0x152f62);}else{logger['info'](_0x7c77('0x10'),_0xda33e2,_0x2f6868[_0x7c77('0xc')]||_0x7c77('0xf'));_0x299ad9['stop']();}}else{_0x299ad9[_0x7c77('0xf')]();}}}catch(_0x50b3a4){logger['error']('[%s][GOTOP]\x20%s',_0xda33e2,JSON['stringify'](_0x50b3a4));_0x299ad9['stop']();}};}; \ No newline at end of file +var _0x35f2=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','number'];(function(_0xf96c95,_0xa75652){var _0x286ffd=function(_0x19ca8e){while(--_0x19ca8e){_0xf96c95['push'](_0xf96c95['shift']());}};_0x286ffd(++_0xa75652);}(_0x35f2,0x13b));var _0x235f=function(_0xf7a3b1,_0x322d68){_0xf7a3b1=_0xf7a3b1-0x0;var _0x8d32a4=_0x35f2[_0xf7a3b1];return _0x8d32a4;};'use strict';var schema=require(_0x235f('0x0'));var _=require(_0x235f('0x1'));var logger=require(_0x235f('0x2'))(_0x235f('0x3'));var gotop=schema({'priority':{'type':_0x235f('0x4'),'required':!![],'message':_0x235f('0x5')}});exports[_0x235f('0x6')]=function(_0x1d126d,_0x1c6a8b){return function(_0x57a761){try{var _0x24006f={'priority':_0x1c6a8b[0x0]};var _0x4ee51c=gotop['validate'](_0x24006f,{'typecast':!![]});if(_0x4ee51c[_0x235f('0x7')]){logger[_0x235f('0x8')]('[%s][GOTOP]\x20%s',_0x1d126d,_[_0x235f('0x9')](_0x4ee51c,_0x235f('0xa'))['join'](',\x20'));_0x57a761[_0x235f('0xb')]();}else{logger[_0x235f('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x1d126d,_0x24006f[_0x235f('0xd')]);if(_0x24006f[_0x235f('0xd')]){var _0x59c499=_[_0x235f('0xe')](_0x57a761[_0x235f('0xf')](),{'p':_0x24006f[_0x235f('0xd')]});if(_0x59c499>=0x0){logger['info'](_0x235f('0x10'),_0x1d126d,_0x24006f[_0x235f('0xd')]||_0x235f('0x11'),_0x59c499);_0x57a761[_0x235f('0x11')](_0x59c499);}else{logger[_0x235f('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1d126d,_0x24006f['priority']||'next');_0x57a761[_0x235f('0xb')]();}}else{_0x57a761['next']();}}}catch(_0x56e666){logger[_0x235f('0x8')](_0x235f('0x12'),_0x1d126d,JSON[_0x235f('0x13')](_0x56e666));_0x57a761[_0x235f('0xb')]();}};}; \ 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 2bff572..80339f7 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 _0xdeff=['InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','account'];(function(_0x41604b,_0x245a9d){var _0x5693ef=function(_0x208e23){while(--_0x208e23){_0x41604b['push'](_0x41604b['shift']());}};_0x5693ef(++_0x245a9d);}(_0xdeff,0x151));var _0xfdef=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0xdeff[_0x4b4638];return _0x59e92b;};'use strict';var _=require(_0xfdef('0x0'));var utils=require('./utils');var logger=require(_0xfdef('0x1'))('routing');var rpc={'chatMessage':require(_0xfdef('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xfdef('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xfdef('0x4')),'whatsappMessage':require(_0xfdef('0x5'))};exports[_0xfdef('0x6')]=function(_0x1b9b60,_0x448427){return function(_0x6f6779){try{var _0x4f064c={'body':utils[_0xfdef('0x7')](_0x448427[0x0],this),'ContactId':this[_0xfdef('0x8')]['id']};if(this[_0xfdef('0x9')]==='chat'){_0x4f064c[_0xfdef('0xa')]=this['account']['id'];}else{_0x4f064c[_[_0xfdef('0xb')](this[_0xfdef('0x9')])+'AccountId']=this[_0xfdef('0xc')]['id'];}_0x4f064c[_[_0xfdef('0xb')](this[_0xfdef('0x9')])+_0xfdef('0xd')]=this[_0xfdef('0xe')]['id'];if(rpc[this['channel']+_0xfdef('0xf')]){return rpc[this[_0xfdef('0x9')]+'Message']['create'](_0x4f064c)[_0xfdef('0x10')](function(_0x40e629){logger[_0xfdef('0x11')](_0xfdef('0x12'),_0x1b9b60,_0x4f064c[_0xfdef('0x13')]);_0x6f6779[_0xfdef('0x14')]();})[_0xfdef('0x15')](function(_0x1dcf30){logger[_0xfdef('0x16')](_0xfdef('0x12'),_0x1b9b60,JSON[_0xfdef('0x17')](_0x1dcf30));_0x6f6779[_0xfdef('0x18')]();});}}catch(_0x228344){logger[_0xfdef('0x16')]('[%s][MESSAGE]\x20%s',_0x1b9b60,JSON[_0xfdef('0x17')](_0x228344));_0x6f6779[_0xfdef('0x18')]();}};}; \ No newline at end of file +var _0xf2f3=['../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','./utils'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xf2f3,0x15d));var _0x3f2f=function(_0x154108,_0xb216a8){_0x154108=_0x154108-0x0;var _0x66168f=_0xf2f3[_0x154108];return _0x66168f;};'use strict';var _=require('lodash');var utils=require(_0x3f2f('0x0'));var logger=require(_0x3f2f('0x1'))(_0x3f2f('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3f2f('0x3')),'mailMessage':require(_0x3f2f('0x4')),'smsMessage':require(_0x3f2f('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3f2f('0x6')]=function(_0x1f967a,_0x3db263){return function(_0x13227a){try{var _0xbcd687={'body':utils[_0x3f2f('0x7')](_0x3db263[0x0],this),'ContactId':this[_0x3f2f('0x8')]['id']};if(this[_0x3f2f('0x9')]===_0x3f2f('0xa')){_0xbcd687[_0x3f2f('0xb')]=this[_0x3f2f('0xc')]['id'];}else{_0xbcd687[_[_0x3f2f('0xd')](this[_0x3f2f('0x9')])+_0x3f2f('0xe')]=this[_0x3f2f('0xc')]['id'];}_0xbcd687[_['upperFirst'](this[_0x3f2f('0x9')])+_0x3f2f('0xf')]=this[_0x3f2f('0x10')]['id'];if(rpc[this['channel']+_0x3f2f('0x11')]){return rpc[this[_0x3f2f('0x9')]+'Message']['create'](_0xbcd687)[_0x3f2f('0x12')](function(_0x4f4c81){logger['info'](_0x3f2f('0x13'),_0x1f967a,_0xbcd687[_0x3f2f('0x14')]);_0x13227a[_0x3f2f('0x15')]();})['catch'](function(_0x47e978){logger[_0x3f2f('0x16')](_0x3f2f('0x13'),_0x1f967a,JSON[_0x3f2f('0x17')](_0x47e978));_0x13227a[_0x3f2f('0x18')]();});}}catch(_0x367927){logger[_0x3f2f('0x16')](_0x3f2f('0x13'),_0x1f967a,JSON['stringify'](_0x367927));_0x13227a[_0x3f2f('0x18')]();}};}; \ 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 c8b2a8c..5406880 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 _0x2204=['info','[%s][NOOP]\x20%s','getMustacheRender','error','stop','./utils','routing'];(function(_0x3a812d,_0x4f0a93){var _0xdee285=function(_0x13a064){while(--_0x13a064){_0x3a812d['push'](_0x3a812d['shift']());}};_0xdee285(++_0x4f0a93);}(_0x2204,0x178));var _0x4220=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2204[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x4220('0x0'));var logger=require('../../../../config/logger')(_0x4220('0x1'));exports['consequence']=function(_0x4519f5,_0x391630){return function(_0x49d374){try{logger[_0x4220('0x2')](_0x4220('0x3'),_0x4519f5,utils[_0x4220('0x4')](_0x391630[0x0],this));_0x49d374['next']();}catch(_0x2e0ba1){logger[_0x4220('0x5')]('[%s][NOOP]\x20%s',_0x4519f5,JSON['stringify'](_0x2e0ba1));_0x49d374[_0x4220('0x6')]();}};}; \ No newline at end of file +var _0x58b9=['stringify','stop','./utils','../../../../config/logger','routing','consequence','getMustacheRender','next'];(function(_0x2689c3,_0x5d39f1){var _0x15715a=function(_0x523a40){while(--_0x523a40){_0x2689c3['push'](_0x2689c3['shift']());}};_0x15715a(++_0x5d39f1);}(_0x58b9,0x1b2));var _0x958b=function(_0x102c60,_0x88539b){_0x102c60=_0x102c60-0x0;var _0x237d0c=_0x58b9[_0x102c60];return _0x237d0c;};'use strict';var utils=require(_0x958b('0x0'));var logger=require(_0x958b('0x1'))(_0x958b('0x2'));exports[_0x958b('0x3')]=function(_0x6c59ef,_0x434250){return function(_0x2e700f){try{logger['info']('[%s][NOOP]\x20%s',_0x6c59ef,utils[_0x958b('0x4')](_0x434250[0x0],this));_0x2e700f[_0x958b('0x5')]();}catch(_0x58af6c){logger['error']('[%s][NOOP]\x20%s',_0x6c59ef,JSON[_0x958b('0x6')](_0x58af6c));_0x2e700f[_0x958b('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 43893e8..399bffe 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 _0x55ea=['format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','account','queue','from','joinAt','queue_id'];(function(_0x5cc40d,_0x133d09){var _0x192d61=function(_0xe50121){while(--_0xe50121){_0x5cc40d['push'](_0x5cc40d['shift']());}};_0x192d61(++_0x133d09);}(_0x55ea,0xe2));var _0xa55e=function(_0x58286a,_0x479482){_0x58286a=_0x58286a-0x0;var _0x30ac86=_0x55ea[_0x58286a];return _0x30ac86;};'use strict';var schema=require('validate');var _=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var seqqueue=require(_0xa55e('0x2'));var moment=require('moment');var Redis=require(_0xa55e('0x3'));var config=require(_0xa55e('0x4'));var logger=require(_0xa55e('0x5'))(_0xa55e('0x6'));var strategy=require(_0xa55e('0x7'));config[_0xa55e('0x8')]=_[_0xa55e('0x9')](config[_0xa55e('0x8')],{'host':_0xa55e('0xa'),'port':0x18eb});var io=require(_0xa55e('0xb'))(new Redis(config['redis']));var attributes=['id','queue_id',_0xa55e('0xc'),_0xa55e('0xd'),_0xa55e('0xe'),_0xa55e('0xf')];function emit(_0x5cc1db,_0x547451,_0x3ff9ba){io['to'](_0x5cc1db)['emit'](_0x547451,_0x3ff9ba);}function emitChannelQueueInteraction(_0x12d49f,_0x50592a,_0x38b730,_0x5eb76b,_0x4d5290,_0x524e81,_0x3eaf97,_0x49c5b7){var _0x1c3bee=_['clone'](_0x38b730);_0x1c3bee[_0xa55e('0x10')]=_0x49c5b7;_0x1c3bee['queue']=_0x50592a;_0x1c3bee[_0xa55e('0xc')]=_0x5eb76b;_0x1c3bee['id']=_0x4d5290;if(_0x524e81){_0x3eaf97[util[_0xa55e('0x11')](_0xa55e('0x12'),_0x12d49f)][_0x4d5290]=_['pick'](_0x1c3bee,attributes);}else{delete _0x3eaf97[util[_0xa55e('0x11')](_0xa55e('0x12'),_0x12d49f)][_0x4d5290];}emit(util[_0xa55e('0x11')](_0xa55e('0x13'),_0x12d49f,_0x50592a),util[_0xa55e('0x11')](_0xa55e('0x14'),_0x12d49f,_0x524e81?'save':_0xa55e('0x15')),_[_0xa55e('0x16')](_0x1c3bee,attributes));}var rpc={'openchannelQueueReport':require(_0xa55e('0x17')),'mailQueueReport':require(_0xa55e('0x18')),'chatQueueReport':require(_0xa55e('0x19')),'smsQueueReport':require(_0xa55e('0x1a')),'faxQueueReport':require(_0xa55e('0x1b')),'whatsappQueueReport':require(_0xa55e('0x1c'))};var queue=schema({'name':{'type':_0xa55e('0x1d'),'required':!![],'message':_0xa55e('0x1e')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x2e3f7a,_0x2f65e9,_0x3dfec5,_0x4ded05){if(_0x2e3f7a&&_0x2f65e9&&_0x3dfec5){_0x2f65e9[_0xa55e('0x1f')]+=0x1;var _0x3d821c={'uniqueid':_0x2e3f7a,'from':_0x3dfec5[_0xa55e('0x20')]?_0x3dfec5[_0xa55e('0x20')][_0xa55e('0xe')]:'','joinAt':moment()['format'](_0xa55e('0x21')),'ContactId':_0x3dfec5[_0xa55e('0x22')]?_0x3dfec5[_0xa55e('0x22')]['id']:null,'ListId':_0x3dfec5['list']?_0x3dfec5[_0xa55e('0x23')]['id']:null};_0x3d821c[_[_0xa55e('0x24')](_0x3dfec5['channel'])+_0xa55e('0x25')]=_0x2f65e9['id']||null;_0x3d821c[_[_0xa55e('0x24')](_0x3dfec5['channel'])+_0xa55e('0x26')]=_0x3dfec5[_0xa55e('0x27')]?_0x3dfec5[_0xa55e('0x27')]['id']:null;_0x3d821c[_[_0xa55e('0x24')](_0x3dfec5[_0xa55e('0x28')])+_0xa55e('0x29')]=_0x3dfec5[_0xa55e('0x2a')]?_0x3dfec5[_0xa55e('0x2a')]['id']:null;_0x3d821c[_['upperFirst'](_0x3dfec5['channel'])+(_0x3dfec5['channel']!==_0xa55e('0x2b')?_0xa55e('0x2c'):_0xa55e('0x2d'))]=_0x3dfec5['account']?_0x3dfec5[_0xa55e('0xc')]['id']:null;logger[_0xa55e('0x2e')](util[_0xa55e('0x11')](_0xa55e('0x2f'),_0x2e3f7a,_0x2f65e9[_0xa55e('0x30')]));emitChannelQueueInteraction(_0x3dfec5[_0xa55e('0x28')],_0x2f65e9[_0xa55e('0x30')],_0x3d821c,_0x3dfec5[_0xa55e('0xc')][_0xa55e('0x30')],_0x3dfec5[_0xa55e('0x2a')]['id'],!![],_0x4ded05,_0x2f65e9['id']);if(rpc[_0x3dfec5[_0xa55e('0x28')]+'QueueReport']){return rpc[_0x3dfec5[_0xa55e('0x28')]+_0xa55e('0x31')][_0xa55e('0x32')](_0x3d821c)[_0xa55e('0x33')](function(_0x3ef0c0){logger[_0xa55e('0x34')]('create\x20queue\x20report');});}}}function stopRouting(_0x1e3c65,_0x30692b,_0x3049b5,_0x8199e){if(_0x1e3c65&&_0x30692b){_0x30692b[_0xa55e('0x1f')]-=0x1;var _0x567f2e={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x1e3c65,_0x30692b['name']));emitChannelQueueInteraction(_0x3049b5[_0xa55e('0x28')],_0x30692b['name'],_0x3049b5[_0xa55e('0x20')],_0x3049b5['account'][_0xa55e('0x30')],_0x3049b5[_0xa55e('0x2a')]['id'],![],_0x8199e,_0x30692b['id']);if(rpc[_0x3049b5[_0xa55e('0x28')]+_0xa55e('0x31')]){return rpc[_0x3049b5[_0xa55e('0x28')]+_0xa55e('0x31')][_0xa55e('0x35')](_0x1e3c65,_0x567f2e)[_0xa55e('0x33')](function(_0x54e20a){logger[_0xa55e('0x34')](_0xa55e('0x36'));});}}}function endRouting(_0xdffff7,_0x2e0bd8,_0x598f08,_0x38e4b9){if(_0xdffff7&&_0x2e0bd8){_0x2e0bd8['waiting']-=0x1;var _0x3ccdb1={'leaveAt':moment()[_0xa55e('0x11')](_0xa55e('0x21')),'exitAt':moment()[_0xa55e('0x11')](_0xa55e('0x21')),'reason':'timeout'};logger[_0xa55e('0x2e')](util['format'](_0xa55e('0x37'),_0xdffff7,_0x2e0bd8['name']));emitChannelQueueInteraction(_0x598f08[_0xa55e('0x28')],_0x2e0bd8[_0xa55e('0x30')],_0x598f08['body'],_0x598f08[_0xa55e('0xc')][_0xa55e('0x30')],_0x598f08[_0xa55e('0x2a')]['id'],![],_0x38e4b9);if(rpc[_0x598f08[_0xa55e('0x28')]+_0xa55e('0x31')]){return rpc[_0x598f08[_0xa55e('0x28')]+_0xa55e('0x31')][_0xa55e('0x35')](_0xdffff7,_0x3ccdb1)['catch'](function(_0x10c613){logger['error'](_0xa55e('0x36'));});}}}function handleFindQueue(_0x14be59){return function(_0x58981f){return _0x58981f[_0xa55e('0x30')][_0xa55e('0x38')]()===_0x14be59['toLowerCase']();};}exports[_0xa55e('0x39')]=function(_0x5169dc,_0x6d1711,_0x3f9a23,_0x419fba){return function(_0x4eebee){try{var _0x4000b5={'name':_0x6d1711[0x0],'timeout':_0x6d1711[0x1]};var _0x228ae4=queue[_0xa55e('0x3a')](_0x4000b5,{'typecast':!![]});if(_0x228ae4[_0xa55e('0x3b')]){logger[_0xa55e('0x34')](_0xa55e('0x3c'),_0x5169dc,_[_0xa55e('0x3d')](_0x228ae4,_0xa55e('0x2a'))[_0xa55e('0x3e')](',\x20'));_0x4eebee[_0xa55e('0x3f')]();}else{var _0x4d17a5=_[_0xa55e('0x40')](_0x3f9a23[_0x419fba[_0xa55e('0x28')]+_0xa55e('0x41')],handleFindQueue(_0x4000b5['name']));if(_0x4d17a5){startRouting(_0x5169dc,_0x4d17a5,_0x419fba,_0x3f9a23);var _0x578a28=(_0x4d17a5[_0xa55e('0x42')]||0xa)*0x3e8;var _0xa640b3=(_0x4000b5['timeout']||0x14)*0x3e8;var _0x19e63f,_0x274149;if(_0x578a28>_0xa640b3){_0xa640b3=_0x578a28;}var _0xd66d6d=seqqueue[_0xa55e('0x43')](_0x578a28);_0xd66d6d['id']=_0x5169dc;_0xd66d6d[_0xa55e('0x44')]=_0x578a28;_0xd66d6d['qtimeout']=_0xa640b3;_0xd66d6d[_0xa55e('0x28')]=_0x419fba[_0xa55e('0x28')];_0x3f9a23[_0xa55e('0x45')][_0x5169dc]['on'](_0xa55e('0x46'),function(){logger[_0xa55e('0x2e')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5169dc);stopRouting(_0x5169dc,_0x4d17a5,_0x419fba,_0x3f9a23);clearTimeout(_0x19e63f);_0x19e63f=undefined;_0xd66d6d[_0xa55e('0x47')](!![]);if(_0x3f9a23['rules'][_0x5169dc]){delete _0x3f9a23[_0xa55e('0x45')][_0x5169dc];}_0x4eebee[_0xa55e('0x3f')]();});_0x3f9a23[_0xa55e('0x45')][_0x5169dc]['on'](_0xa55e('0x48'),function(){if(_0x3f9a23[_0xa55e('0x45')][_0x5169dc]){delete _0x3f9a23[_0xa55e('0x45')][_0x5169dc];}});_0x19e63f=setTimeout(function(){logger[_0xa55e('0x2e')](_0xa55e('0x49'),_0x5169dc);endRouting(_0x5169dc,_0x4d17a5,_0x419fba,_0x3f9a23);clearTimeout(_0x19e63f);_0xd66d6d[_0xa55e('0x47')](!![]);_0x4eebee[_0xa55e('0x4a')]();},_0xa640b3);switch(_0x4d17a5[_0xa55e('0x4b')]){case _0xa55e('0x4c'):strategy[_0xa55e('0x4c')](_0xd66d6d,_0x4d17a5,_0x3f9a23,_0x419fba);break;default:strategy[_0xa55e('0x4d')](_0xd66d6d,_0x4d17a5,_0x3f9a23,_0x419fba);}}else{logger[_0xa55e('0x34')](_0xa55e('0x4e'),_0x5169dc,_0x4000b5[_0xa55e('0x30')]);_0x4eebee[_0xa55e('0x3f')]();}}}catch(_0x26ae50){console[_0xa55e('0x4f')](_0x26ae50);logger[_0xa55e('0x34')](_0xa55e('0x3c'),_0x5169dc,_0x26ae50[_0xa55e('0x50')]);_0x4eebee[_0xa55e('0x3f')]();}};}; \ No newline at end of file +var _0x28f3=['join','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','close','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','timeout','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map'];(function(_0x2269d9,_0x1c0bdc){var _0x4216b5=function(_0x3e8fef){while(--_0x3e8fef){_0x2269d9['push'](_0x2269d9['shift']());}};_0x4216b5(++_0x1c0bdc);}(_0x28f3,0xec));var _0x328f=function(_0x1f5706,_0x3cd7d1){_0x1f5706=_0x1f5706-0x0;var _0x4e3274=_0x28f3[_0x1f5706];return _0x4e3274;};'use strict';var schema=require(_0x328f('0x0'));var _=require(_0x328f('0x1'));var util=require(_0x328f('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x328f('0x3'));var Redis=require(_0x328f('0x4'));var config=require(_0x328f('0x5'));var logger=require(_0x328f('0x6'))(_0x328f('0x7'));var strategy=require(_0x328f('0x8'));config[_0x328f('0x9')]=_['defaults'](config['redis'],{'host':_0x328f('0xa'),'port':0x18eb});var io=require(_0x328f('0xb'))(new Redis(config['redis']));var attributes=['id',_0x328f('0xc'),_0x328f('0xd'),_0x328f('0xe'),'from','joinAt'];function emit(_0xaccc91,_0x15a90b,_0x2f0941){io['to'](_0xaccc91)['emit'](_0x15a90b,_0x2f0941);}function emitChannelQueueInteraction(_0x12c0fb,_0x5d39eb,_0x1af460,_0xe7bcfe,_0x2c3e81,_0x251589,_0x50e4ba,_0x12c2f5){var _0xa5626b=_['clone'](_0x1af460);_0xa5626b[_0x328f('0xc')]=_0x12c2f5;_0xa5626b[_0x328f('0xe')]=_0x5d39eb;_0xa5626b['account']=_0xe7bcfe;_0xa5626b['id']=_0x2c3e81;if(_0x251589){_0x50e4ba[util[_0x328f('0xf')]('%sQueuesWaitingInteractions',_0x12c0fb)][_0x2c3e81]=_[_0x328f('0x10')](_0xa5626b,attributes);}else{delete _0x50e4ba[util['format'](_0x328f('0x11'),_0x12c0fb)][_0x2c3e81];}emit(util[_0x328f('0xf')]('%s:queue:%s',_0x12c0fb,_0x5d39eb),util['format'](_0x328f('0x12'),_0x12c0fb,_0x251589?'save':_0x328f('0x13')),_[_0x328f('0x10')](_0xa5626b,attributes));}var rpc={'openchannelQueueReport':require(_0x328f('0x14')),'mailQueueReport':require(_0x328f('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x328f('0x16'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x328f('0x17')},'timeout':{'type':_0x328f('0x18'),'message':_0x328f('0x19')}});function startRouting(_0x2fda25,_0x37542b,_0x563670,_0x5dd43c){if(_0x2fda25&&_0x37542b&&_0x563670){_0x37542b['waiting']+=0x1;var _0x1d732c={'uniqueid':_0x2fda25,'from':_0x563670[_0x328f('0x1a')]?_0x563670[_0x328f('0x1a')][_0x328f('0x1b')]:'','joinAt':moment()[_0x328f('0xf')](_0x328f('0x1c')),'ContactId':_0x563670[_0x328f('0x1d')]?_0x563670[_0x328f('0x1d')]['id']:null,'ListId':_0x563670[_0x328f('0x1e')]?_0x563670[_0x328f('0x1e')]['id']:null};_0x1d732c[_[_0x328f('0x1f')](_0x563670['channel'])+_0x328f('0x20')]=_0x37542b['id']||null;_0x1d732c[_['upperFirst'](_0x563670['channel'])+_0x328f('0x21')]=_0x563670['interaction']?_0x563670[_0x328f('0x22')]['id']:null;_0x1d732c[_[_0x328f('0x1f')](_0x563670[_0x328f('0x23')])+'MessageId']=_0x563670[_0x328f('0x24')]?_0x563670['message']['id']:null;_0x1d732c[_[_0x328f('0x1f')](_0x563670['channel'])+(_0x563670[_0x328f('0x23')]!=='chat'?_0x328f('0x25'):_0x328f('0x26'))]=_0x563670[_0x328f('0xd')]?_0x563670['account']['id']:null;logger[_0x328f('0x27')](util[_0x328f('0xf')](_0x328f('0x28'),_0x2fda25,_0x37542b[_0x328f('0x29')]));emitChannelQueueInteraction(_0x563670[_0x328f('0x23')],_0x37542b[_0x328f('0x29')],_0x1d732c,_0x563670['account'][_0x328f('0x29')],_0x563670['message']['id'],!![],_0x5dd43c,_0x37542b['id']);if(rpc[_0x563670[_0x328f('0x23')]+_0x328f('0x2a')]){return rpc[_0x563670[_0x328f('0x23')]+_0x328f('0x2a')]['create'](_0x1d732c)[_0x328f('0x2b')](function(_0x247937){logger[_0x328f('0x2c')]('create\x20queue\x20report');});}}}function stopRouting(_0x25eaf1,_0x2b288a,_0x13e55b,_0x1a3953){if(_0x25eaf1&&_0x2b288a){_0x2b288a[_0x328f('0x2d')]-=0x1;var _0x4ff233={'leaveAt':moment()[_0x328f('0xf')](_0x328f('0x1c')),'acceptAt':moment()[_0x328f('0xf')](_0x328f('0x1c')),'reason':_0x328f('0x2e')};logger[_0x328f('0x27')](util[_0x328f('0xf')](_0x328f('0x2f'),_0x25eaf1,_0x2b288a[_0x328f('0x29')]));emitChannelQueueInteraction(_0x13e55b[_0x328f('0x23')],_0x2b288a['name'],_0x13e55b[_0x328f('0x1a')],_0x13e55b[_0x328f('0xd')][_0x328f('0x29')],_0x13e55b[_0x328f('0x24')]['id'],![],_0x1a3953,_0x2b288a['id']);if(rpc[_0x13e55b[_0x328f('0x23')]+'QueueReport']){return rpc[_0x13e55b[_0x328f('0x23')]+_0x328f('0x2a')][_0x328f('0x30')](_0x25eaf1,_0x4ff233)[_0x328f('0x2b')](function(_0x444203){logger[_0x328f('0x2c')]('update\x20queue\x20report');});}}}function endRouting(_0x3bebc2,_0x56f704,_0x5d9267,_0x5091e0){if(_0x3bebc2&&_0x56f704){_0x56f704['waiting']-=0x1;var _0x1fd305={'leaveAt':moment()[_0x328f('0xf')](_0x328f('0x1c')),'exitAt':moment()['format'](_0x328f('0x1c')),'reason':_0x328f('0x31')};logger['info'](util[_0x328f('0xf')]('[%s][END:QUEUE][NAME:%s]',_0x3bebc2,_0x56f704[_0x328f('0x29')]));emitChannelQueueInteraction(_0x5d9267[_0x328f('0x23')],_0x56f704[_0x328f('0x29')],_0x5d9267[_0x328f('0x1a')],_0x5d9267[_0x328f('0xd')]['name'],_0x5d9267[_0x328f('0x24')]['id'],![],_0x5091e0);if(rpc[_0x5d9267[_0x328f('0x23')]+_0x328f('0x2a')]){return rpc[_0x5d9267[_0x328f('0x23')]+'QueueReport'][_0x328f('0x30')](_0x3bebc2,_0x1fd305)[_0x328f('0x2b')](function(_0xb2dc5f){logger['error'](_0x328f('0x32'));});}}}function handleFindQueue(_0x47e7ba){return function(_0x210e2c){return _0x210e2c[_0x328f('0x29')][_0x328f('0x33')]()===_0x47e7ba[_0x328f('0x33')]();};}exports[_0x328f('0x34')]=function(_0x2afe9b,_0x2dafac,_0x17dbe2,_0x30765b){return function(_0x483b22){try{var _0x12e3d9={'name':_0x2dafac[0x0],'timeout':_0x2dafac[0x1]};var _0x295b9f=queue[_0x328f('0x0')](_0x12e3d9,{'typecast':!![]});if(_0x295b9f[_0x328f('0x35')]){logger['error'](_0x328f('0x36'),_0x2afe9b,_[_0x328f('0x37')](_0x295b9f,'message')[_0x328f('0x38')](',\x20'));_0x483b22[_0x328f('0x39')]();}else{var _0x26294a=_[_0x328f('0x3a')](_0x17dbe2[_0x30765b[_0x328f('0x23')]+_0x328f('0x3b')],handleFindQueue(_0x12e3d9[_0x328f('0x29')]));if(_0x26294a){startRouting(_0x2afe9b,_0x26294a,_0x30765b,_0x17dbe2);var _0x5c0e38=(_0x26294a['timeout']||0xa)*0x3e8;var _0x549910=(_0x12e3d9[_0x328f('0x31')]||0x14)*0x3e8;var _0x117094,_0x4cdb26;if(_0x5c0e38>_0x549910){_0x549910=_0x5c0e38;}var _0x13f315=seqqueue['createQueue'](_0x5c0e38);_0x13f315['id']=_0x2afe9b;_0x13f315[_0x328f('0x3c')]=_0x5c0e38;_0x13f315[_0x328f('0x3d')]=_0x549910;_0x13f315[_0x328f('0x23')]=_0x30765b['channel'];_0x17dbe2[_0x328f('0x3e')][_0x2afe9b]['on'](_0x328f('0x3f'),function(){logger[_0x328f('0x27')](_0x328f('0x40'),_0x2afe9b);stopRouting(_0x2afe9b,_0x26294a,_0x30765b,_0x17dbe2);clearTimeout(_0x117094);_0x117094=undefined;_0x13f315['close'](!![]);if(_0x17dbe2[_0x328f('0x3e')][_0x2afe9b]){delete _0x17dbe2[_0x328f('0x3e')][_0x2afe9b];}_0x483b22['stop']();});_0x17dbe2[_0x328f('0x3e')][_0x2afe9b]['on'](_0x328f('0x41'),function(){if(_0x17dbe2[_0x328f('0x3e')][_0x2afe9b]){delete _0x17dbe2[_0x328f('0x3e')][_0x2afe9b];}});_0x117094=setTimeout(function(){logger[_0x328f('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x2afe9b);endRouting(_0x2afe9b,_0x26294a,_0x30765b,_0x17dbe2);clearTimeout(_0x117094);_0x13f315[_0x328f('0x42')](!![]);_0x483b22[_0x328f('0x43')]();},_0x549910);switch(_0x26294a[_0x328f('0x44')]){case'rrmemory':strategy[_0x328f('0x45')](_0x13f315,_0x26294a,_0x17dbe2,_0x30765b);break;default:strategy['beepall'](_0x13f315,_0x26294a,_0x17dbe2,_0x30765b);}}else{logger[_0x328f('0x2c')](_0x328f('0x46'),_0x2afe9b,_0x12e3d9[_0x328f('0x29')]);_0x483b22['stop']();}}}catch(_0x4b5704){console[_0x328f('0x47')](_0x4b5704);logger['error'](_0x328f('0x36'),_0x2afe9b,_0x4b5704[_0x328f('0x48')]);_0x483b22[_0x328f('0x39')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index fc0e21d..fada18f 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 _0xdfab=['drained','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','bind','timeout','handleTimeout'];(function(_0x4325da,_0x312300){var _0x25d602=function(_0x1ca4d4){while(--_0x1ca4d4){_0x4325da['push'](_0x4325da['shift']());}};_0x25d602(++_0x312300);}(_0xdfab,0x18c));var _0xbdfa=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xdfab[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xbdfa('0x0'));var uuid=require('uuid');var util=require(_0xbdfa('0x1'));var logger=require(_0xbdfa('0x2'))(_0xbdfa('0x3'));var Agent=function(_0x3149f1,_0x7bb094,_0x53e37d,_0x31d9b2){this[_0xbdfa('0x4')]=uuid['v4']();this[_0xbdfa('0x5')]=_0x3149f1;this[_0xbdfa('0x6')]=_0x7bb094;this[_0xbdfa('0x7')]=_0x53e37d;this['routing']=_0x31d9b2;this[_0xbdfa('0x5')]['push'](this[_0xbdfa('0x8')][_0xbdfa('0x9')](this),this['handleTimeout'][_0xbdfa('0x9')](this));this['squeue']['on'](_0xbdfa('0xa'),this[_0xbdfa('0xb')]['bind'](this));this[_0xbdfa('0x5')]['on'](_0xbdfa('0xc'),this[_0xbdfa('0xd')]['bind'](this));};Agent[_0xbdfa('0xe')]['push']=function(){this[_0xbdfa('0x5')][_0xbdfa('0xf')](this[_0xbdfa('0x8')]['bind'](this),this['handleTimeout'][_0xbdfa('0x9')](this));};Agent[_0xbdfa('0xe')][_0xbdfa('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0xbdfa('0xe')]['handleRun']=function(_0x221fb5){logger[_0xbdfa('0x10')](_0xbdfa('0x11'),this['squeue']['id'],this['agent']['id']);if(_[_0xbdfa('0x12')](this[_0xbdfa('0x7')][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']])){logger[_0xbdfa('0x10')](_0xbdfa('0x14'),this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x6')]['id']);setTimeout(this[_0xbdfa('0xf')][_0xbdfa('0x9')](this),0x3e8);}else{if(this[_0xbdfa('0x3')]['forcedOwnership']||util[_0xbdfa('0x15')](this['squeue']['id'],this['realtime'][_0xbdfa('0x13')][this['agent']['id']],this['squeue'][_0xbdfa('0x16')],![])){this[_0xbdfa('0x7')]['agents'][this[_0xbdfa('0x6')]['id']][_0xbdfa('0x17')]=!![];this[_0xbdfa('0x7')][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']]['busyQueue']=undefined;util[_0xbdfa('0x18')](this[_0xbdfa('0x4')],this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x7')]['agents'][this[_0xbdfa('0x6')]['id']],null,this[_0xbdfa('0x3')]);util[_0xbdfa('0x19')](this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x7')][_0xbdfa('0x13')][this['agent']['id']],_0xbdfa('0x1a')+(this[_0xbdfa('0x3')][_0xbdfa('0x1b')]?_0xbdfa('0x1c'):''));}else{logger['info'](_0xbdfa('0x1d'),this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xbdfa('0xe')]['handleTimeout']=function(_0x129bc5){if(_[_0xbdfa('0x12')](this['realtime'][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']])){return logger[_0xbdfa('0x10')](_0xbdfa('0x14'),this[_0xbdfa('0x5')]['id'],this['agent']['id']);}else{logger['info'](_0xbdfa('0x1e'),this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x6')]['id']);util['hideNotification'](this[_0xbdfa('0x4')],this[_0xbdfa('0x5')]['id'],this['realtime'][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']],null,this['routing']);this['realtime']['agents'][this['agent']['id']]['busy']=![];this[_0xbdfa('0x7')][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']]['busyQueue']=undefined;util[_0xbdfa('0x19')](this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x7')][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']],_0x129bc5?_0xbdfa('0x1f'):_0xbdfa('0x20'));}if(!_0x129bc5){setTimeout(this[_0xbdfa('0xf')]['bind'](this),0x3e8);}};function agent(_0x3385d0,_0x176ac0,_0x33d3a8,_0x4f05d5){return new Agent(_0x3385d0,_0x176ac0,_0x33d3a8,_0x4f05d5);}module[_0xbdfa('0x21')]=agent; \ No newline at end of file +var _0xead8=['RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','exports','../../../../../config/logger','routing','agent','realtime','squeue','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','notificationId'];(function(_0x3a3663,_0x15e9e7){var _0x2351ed=function(_0x3ccaed){while(--_0x3ccaed){_0x3a3663['push'](_0x3a3663['shift']());}};_0x2351ed(++_0x15e9e7);}(_0xead8,0x108));var _0x8ead=function(_0x99d37,_0x4e7974){_0x99d37=_0x99d37-0x0;var _0x2db098=_0xead8[_0x99d37];return _0x2db098;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require('./util');var logger=require(_0x8ead('0x0'))(_0x8ead('0x1'));var Agent=function(_0x233c97,_0xb3fb3b,_0x15fd70,_0x3e51cf){this['notificationId']=uuid['v4']();this['squeue']=_0x233c97;this[_0x8ead('0x2')]=_0xb3fb3b;this[_0x8ead('0x3')]=_0x15fd70;this[_0x8ead('0x1')]=_0x3e51cf;this[_0x8ead('0x4')][_0x8ead('0x5')](this['handleRun'][_0x8ead('0x6')](this),this[_0x8ead('0x7')][_0x8ead('0x6')](this));this[_0x8ead('0x4')]['on'](_0x8ead('0x8'),this[_0x8ead('0x7')][_0x8ead('0x6')](this));this[_0x8ead('0x4')]['on'](_0x8ead('0x9'),this[_0x8ead('0xa')][_0x8ead('0x6')](this));};Agent[_0x8ead('0xb')][_0x8ead('0x5')]=function(){this[_0x8ead('0x4')]['push'](this[_0x8ead('0xc')]['bind'](this),this[_0x8ead('0x7')][_0x8ead('0x6')](this));};Agent[_0x8ead('0xb')][_0x8ead('0xa')]=function(){this[_0x8ead('0x7')](!![]);};Agent[_0x8ead('0xb')][_0x8ead('0xc')]=function(_0x3b7046){logger[_0x8ead('0xd')](_0x8ead('0xe'),this['squeue']['id'],this[_0x8ead('0x2')]['id']);if(_[_0x8ead('0xf')](this['realtime'][_0x8ead('0x10')][this[_0x8ead('0x2')]['id']])){logger[_0x8ead('0xd')](_0x8ead('0x11'),this[_0x8ead('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x8ead('0x5')]['bind'](this),0x3e8);}else{if(this[_0x8ead('0x1')][_0x8ead('0x12')]||util[_0x8ead('0x13')](this['squeue']['id'],this['realtime'][_0x8ead('0x10')][this[_0x8ead('0x2')]['id']],this[_0x8ead('0x4')]['channel'],![])){this[_0x8ead('0x3')][_0x8ead('0x10')][this[_0x8ead('0x2')]['id']][_0x8ead('0x14')]=!![];this[_0x8ead('0x3')][_0x8ead('0x10')][this['agent']['id']][_0x8ead('0x15')]=undefined;util[_0x8ead('0x16')](this[_0x8ead('0x17')],this[_0x8ead('0x4')]['id'],this[_0x8ead('0x3')]['agents'][this[_0x8ead('0x2')]['id']],null,this[_0x8ead('0x1')]);util['writeLog'](this['squeue']['id'],this[_0x8ead('0x3')]['agents'][this[_0x8ead('0x2')]['id']],_0x8ead('0x18')+(this[_0x8ead('0x1')][_0x8ead('0x12')]?_0x8ead('0x19'):''));}else{logger[_0x8ead('0xd')](_0x8ead('0x1a'),this[_0x8ead('0x4')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x8ead('0xb')]['handleTimeout']=function(_0x24aedd){if(_[_0x8ead('0xf')](this['realtime'][_0x8ead('0x10')][this[_0x8ead('0x2')]['id']])){return logger[_0x8ead('0xd')](_0x8ead('0x11'),this[_0x8ead('0x4')]['id'],this[_0x8ead('0x2')]['id']);}else{logger[_0x8ead('0xd')](_0x8ead('0x1b'),this[_0x8ead('0x4')]['id'],this[_0x8ead('0x2')]['id']);util['hideNotification'](this['notificationId'],this[_0x8ead('0x4')]['id'],this[_0x8ead('0x3')][_0x8ead('0x10')][this[_0x8ead('0x2')]['id']],null,this[_0x8ead('0x1')]);this[_0x8ead('0x3')]['agents'][this[_0x8ead('0x2')]['id']][_0x8ead('0x14')]=![];this[_0x8ead('0x3')]['agents'][this[_0x8ead('0x2')]['id']][_0x8ead('0x15')]=undefined;util[_0x8ead('0x1c')](this[_0x8ead('0x4')]['id'],this['realtime'][_0x8ead('0x10')][this[_0x8ead('0x2')]['id']],_0x24aedd?_0x8ead('0x1d'):_0x8ead('0x1e'));}if(!_0x24aedd){setTimeout(this[_0x8ead('0x5')]['bind'](this),0x3e8);}};function agent(_0x5b1246,_0x4fddf1,_0x140c58,_0x584856){return new Agent(_0x5b1246,_0x4fddf1,_0x140c58,_0x584856);}module[_0x8ead('0x1f')]=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 1827210..da53388 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 _0xac31=['push','handleRun','handleTimeout','timeout','drained','handleDrained','bind','prototype','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','busyQueue','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','realtime','squeue'];(function(_0x5c8797,_0x1e9a59){var _0x5eb792=function(_0x4f3a49){while(--_0x4f3a49){_0x5c8797['push'](_0x5c8797['shift']());}};_0x5eb792(++_0x1e9a59);}(_0xac31,0xca));var _0x1ac3=function(_0x2ef8bb,_0xd9bec0){_0x2ef8bb=_0x2ef8bb-0x0;var _0xf7506d=_0xac31[_0x2ef8bb];return _0xf7506d;};'use strict';var _=require(_0x1ac3('0x0'));var uuid=require(_0x1ac3('0x1'));var util=require(_0x1ac3('0x2'));var logger=require(_0x1ac3('0x3'))(_0x1ac3('0x4'));var Beepall=function(_0x11dd6d,_0x95548d,_0x59b42c,_0x33b5ab){this[_0x1ac3('0x5')]=uuid['v4']();this['squeue']=_0x11dd6d;this['queue']=_0x95548d;this[_0x1ac3('0x6')]=_0x59b42c;this[_0x1ac3('0x4')]=_0x33b5ab;this[_0x1ac3('0x7')][_0x1ac3('0x8')](this[_0x1ac3('0x9')]['bind'](this),this[_0x1ac3('0xa')]['bind'](this));this[_0x1ac3('0x7')]['on'](_0x1ac3('0xb'),this[_0x1ac3('0xa')]['bind'](this));this[_0x1ac3('0x7')]['on'](_0x1ac3('0xc'),this[_0x1ac3('0xd')][_0x1ac3('0xe')](this));};Beepall[_0x1ac3('0xf')][_0x1ac3('0x8')]=function(){this['squeue'][_0x1ac3('0x8')](this[_0x1ac3('0x9')][_0x1ac3('0xe')](this),this[_0x1ac3('0xa')]['bind'](this));};Beepall[_0x1ac3('0xf')][_0x1ac3('0xd')]=function(_0x46c0e9){this[_0x1ac3('0xa')](!![]);};Beepall['prototype'][_0x1ac3('0x9')]=function(_0x7a931e){var _0x551eac=!![];if(!_[_0x1ac3('0x10')](this[_0x1ac3('0x11')])&&!_[_0x1ac3('0x10')](this['queue'][_0x1ac3('0x12')])&&this[_0x1ac3('0x11')][_0x1ac3('0x12')]['length']>0x0){for(var _0x195683=0x0,_0x58000f;_0x1956830x0){for(var _0x585954=0x0,_0x4b1f4a;_0x5859540x0&&_0x2e862d[_0x8742a7+_0x5df5('0x23')]>=_0x2e862d[_0x8742a7+_0x5df5('0x21')]){writeLog(_0x2e99a1,_0x2e862d,_0x8742a7[_0x5df5('0x24')]()+_0x5df5('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x18bb61,_0x4fc1a1,_0x339c71,_0x44d2c1,_0x5bc181){return sendNotification(!![],_0x18bb61,_0x4fc1a1,_0x339c71,_0x44d2c1,_0x5bc181);};exports[_0x5df5('0x26')]=function(_0x4945c6,_0xd2b213,_0x4cccf1,_0x2e1885,_0x4afe36){return sendNotification(![],_0x4945c6,_0xd2b213,_0x4cccf1,_0x2e1885,_0x4afe36);};exports[_0x5df5('0x27')]=writeLog; \ No newline at end of file +var _0x5fab=['user:save','split','account','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','remove','info','isAgentAvailable','busy','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','hideNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name'];(function(_0x24c90b,_0x5d54b5){var _0x9f6eaf=function(_0x592193){while(--_0x592193){_0x24c90b['push'](_0x24c90b['shift']());}};_0x9f6eaf(++_0x5d54b5);}(_0x5fab,0x177));var _0xb5fa=function(_0x1f0464,_0x74c830){_0x1f0464=_0x1f0464-0x0;var _0x3b8414=_0x5fab[_0x1f0464];return _0x3b8414;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var utils=require('../utils');var Mustache=require(_0xb5fa('0x2'));var Redis=require(_0xb5fa('0x3'));var config=require(_0xb5fa('0x4'));var logger=require(_0xb5fa('0x5'))(_0xb5fa('0x6'));config[_0xb5fa('0x7')]=_[_0xb5fa('0x8')](config[_0xb5fa('0x7')],{'host':_0xb5fa('0x9'),'port':0x18eb});var io=require(_0xb5fa('0xa'))(new Redis(config['redis']));function emit(_0x5d70f6,_0x2e3804,_0x1aec3e){io['to'](_0x5d70f6)[_0xb5fa('0xb')](_0x2e3804,_0x1aec3e);}function sendNotification(_0x56d018,_0x410eff,_0x38d9a3,_0x2cf4a5,_0x54c7eb,_0x5b5ea8){io['to'](util[_0xb5fa('0xc')](_0xb5fa('0xd'),_0x2cf4a5[_0xb5fa('0xe')]))[_0xb5fa('0xb')](_0xb5fa('0xf'),_0x2cf4a5);var _0xadef41=_0x5b5ea8||{};var _0x65c6b6=_0x38d9a3[_0xb5fa('0x10')]('.');var _0x309740={'uniqueid':_0x410eff,'channel':_0x65c6b6[0x0],'id':_0x65c6b6[0x1],'title':_0x65c6b6[0x0]+'\x20interaction','interactionId':_0x65c6b6[0x2],'queue':_0x54c7eb?_0x54c7eb[_0xb5fa('0xe')]:null,'sound':_0xadef41[_0xb5fa('0x11')]['notificationSound'],'shake':_0xadef41[_0xb5fa('0x11')]['notificationShake']};try{if(!_0xadef41[_0xb5fa('0x12')]){_0xadef41[_0xb5fa('0x12')]={};}if(_0x54c7eb){_0xadef41[_0xb5fa('0x12')][_0xb5fa('0x13')]=_0x54c7eb;}else if(_0xadef41[_0xb5fa('0x12')]['queue']){delete _0xadef41['body'][_0xb5fa('0x13')];}_0x309740[_0xb5fa('0x14')]=utils[_0xb5fa('0x15')](_0xadef41[_0xb5fa('0x11')]['notificationTemplate'],_0xadef41);}catch(_0x4fabcc){_0x309740[_0xb5fa('0x14')]=_0xb5fa('0x16');logger[_0xb5fa('0x17')](util[_0xb5fa('0xc')](_0xb5fa('0x18'),_0x410eff,_0x4fabcc[_0xb5fa('0x19')]));}io['to'](util[_0xb5fa('0xc')](_0xb5fa('0xd'),_0x2cf4a5[_0xb5fa('0xe')]))[_0xb5fa('0xb')](util[_0xb5fa('0xc')](_0xb5fa('0x1a'),_0x56d018?'save':_0xb5fa('0x1b')),_0x309740);}function writeLog(_0x519e20,_0x37ae06,_0x4a6c04){return logger[_0xb5fa('0x1c')](util[_0xb5fa('0xc')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x519e20,_0x37ae06[_0xb5fa('0xe')],_0x4a6c04));}exports[_0xb5fa('0x1d')]=function(_0x283a56,_0x47f71a,_0x32a85c,_0xec108f){if(_0x47f71a[_0xb5fa('0x1e')]){writeLog(_0x283a56,_0x47f71a,'BUSY');return![];}if(!_0x47f71a[_0xb5fa('0x1f')]){writeLog(_0x283a56,_0x47f71a,'OFFLINE');return![];}if(_0x47f71a[_0x32a85c+_0xb5fa('0x20')]){writeLog(_0x283a56,_0x47f71a,_0xb5fa('0x21'));return![];}if(_0xec108f&&_0x47f71a[_0xb5fa('0x22')](_0x32a85c+_0xb5fa('0x23'))&&_0x47f71a[_0xb5fa('0x22')](_0x32a85c+_0xb5fa('0x24'))){if(_0x47f71a[_0x32a85c+_0xb5fa('0x23')]>0x0&&_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 diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index d80a06d..c8aa355 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 _0xb806=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20%s','isObject','stringify','validate','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0xb806,0x95));var _0x6b80=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xb806[_0x32b542];return _0x554d54;};'use strict';var schema=require(_0x6b80('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x6b80('0x1'));var logger=require(_0x6b80('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x6b80('0x3')}});exports['consequence']=function(_0x5a03c4,_0xf9407b){return function(_0x1196bb){try{var _0x2ab150={'command':_0xf9407b[0x0]};var _0x520aef=system[_0x6b80('0x0')](_0x2ab150,{'typecast':!![]});if(_0x520aef[_0x6b80('0x4')]){logger[_0x6b80('0x5')]('[%s][SYSTEM]\x20%s',_0x5a03c4,_[_0x6b80('0x6')](_0x520aef,_0x6b80('0x7'))[_0x6b80('0x8')](',\x20'));logger[_0x6b80('0x9')](_0x6b80('0xa'),_0x5a03c4);_0x1196bb[_0x6b80('0xb')]();}else{var _0x261a49=this;var _0x462f02=utils[_0x6b80('0xc')](_0xf9407b[0x0],this);logger[_0x6b80('0x9')](_0x6b80('0xd'),_0x5a03c4,_0x462f02);sh[_0x6b80('0xe')](_[_0x6b80('0xf')](_0x462f02),function(_0x528dc4,_0x375ccd){logger['info'](_0x6b80('0x10'),_0x5a03c4,_0x528dc4);if(_0x528dc4==0x0){var _0x3a46dd=_0x375ccd[_0x6b80('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xf9407b[0x1])||_[_0x6b80('0x12')](_0xf9407b[0x1])){logger[_0x6b80('0x9')](_0x6b80('0x13'),_0x5a03c4);_0x261a49['body'][_0xf9407b[0x1]]=_0x3a46dd;}else{logger[_0x6b80('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5a03c4,_0xf9407b[0x1],_0x3a46dd);_0x261a49[_0x6b80('0x14')][_0xf9407b[0x1]]=_0x3a46dd;}}_0x1196bb[_0x6b80('0xb')]();});}}catch(_0x364eb9){logger['error'](_0x6b80('0x15'),_0x5a03c4,_[_0x6b80('0x16')](_0x364eb9)?JSON[_0x6b80('0x17')](_0x364eb9):_0x364eb9);logger[_0x6b80('0x9')](_0x6b80('0xa'),_0x5a03c4);_0x1196bb[_0x6b80('0xb')]();}};}; \ No newline at end of file +var _0xac21=['lodash','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xac21,0x1af));var _0x1ac2=function(_0x588526,_0x4cc78e){_0x588526=_0x588526-0x0;var _0x5d3fcb=_0xac21[_0x588526];return _0x5d3fcb;};'use strict';var schema=require('validate');var sh=require(_0x1ac2('0x0'));var _=require(_0x1ac2('0x1'));var utils=require('./utils');var logger=require(_0x1ac2('0x2'))('routing');var system=schema({'command':{'type':_0x1ac2('0x3'),'required':!![],'message':_0x1ac2('0x4')}});exports['consequence']=function(_0x454461,_0x4efe94){return function(_0x13d1b6){try{var _0x21a183={'command':_0x4efe94[0x0]};var _0x2c4cf2=system[_0x1ac2('0x5')](_0x21a183,{'typecast':!![]});if(_0x2c4cf2[_0x1ac2('0x6')]){logger[_0x1ac2('0x7')](_0x1ac2('0x8'),_0x454461,_['map'](_0x2c4cf2,_0x1ac2('0x9'))[_0x1ac2('0xa')](',\x20'));logger[_0x1ac2('0xb')](_0x1ac2('0xc'),_0x454461);_0x13d1b6[_0x1ac2('0xd')]();}else{var _0x4a264a=this;var _0x50a79f=utils[_0x1ac2('0xe')](_0x4efe94[0x0],this);logger[_0x1ac2('0xb')](_0x1ac2('0xf'),_0x454461,_0x50a79f);sh[_0x1ac2('0x10')](_[_0x1ac2('0x11')](_0x50a79f),function(_0x13cc5c,_0x52ae9e){logger[_0x1ac2('0xb')](_0x1ac2('0x12'),_0x454461,_0x13cc5c);if(_0x13cc5c==0x0){var _0x11900b=_0x52ae9e[_0x1ac2('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x1ac2('0x14')](_0x4efe94[0x1])||_[_0x1ac2('0x15')](_0x4efe94[0x1])){logger[_0x1ac2('0xb')](_0x1ac2('0x16'),_0x454461);_0x4a264a[_0x1ac2('0x17')][_0x4efe94[0x1]]=_0x11900b;}else{logger['info'](_0x1ac2('0x18'),_0x454461,_0x4efe94[0x1],_0x11900b);_0x4a264a[_0x1ac2('0x17')][_0x4efe94[0x1]]=_0x11900b;}}_0x13d1b6[_0x1ac2('0xd')]();});}}catch(_0x23beb9){logger[_0x1ac2('0x7')](_0x1ac2('0x8'),_0x454461,_[_0x1ac2('0x19')](_0x23beb9)?JSON[_0x1ac2('0x1a')](_0x23beb9):_0x23beb9);logger['info'](_0x1ac2('0xc'),_0x454461);_0x13d1b6[_0x1ac2('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index b7979c5..79b4421 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 _0xdcc0=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x10acb2,_0x3ca870){var _0x186379=function(_0x294bbd){while(--_0x294bbd){_0x10acb2['push'](_0x10acb2['shift']());}};_0x186379(++_0x3ca870);}(_0xdcc0,0x17f));var _0x0dcc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xdcc0[_0x5ddb1c];return _0x354adc;};'use strict';var schema=require(_0x0dcc('0x0'));var _=require(_0x0dcc('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0dcc('0x2')),'smsInteraction':require(_0x0dcc('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0dcc('0x4')),'whatsappInteraction':require(_0x0dcc('0x5'))};var logger=require(_0x0dcc('0x6'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x0dcc('0x7')}});exports[_0x0dcc('0x8')]=function(_0x311095,_0x2785c1,_0x37d22e,_0x9f8ae0){return function(_0x266a98){try{var _0x20c364={'tag':_0x2785c1[0x0]};var _0x48ceb6=tag['validate'](_0x20c364,{'typecast':!![]});if(_0x48ceb6[_0x0dcc('0x9')]){logger[_0x0dcc('0xa')](_0x0dcc('0xb'),_0x311095,_[_0x0dcc('0xc')](_0x48ceb6,_0x0dcc('0xd'))[_0x0dcc('0xe')](',\x20'));logger[_0x0dcc('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x311095);_0x266a98[_0x0dcc('0x10')]();}else{var _0x2bdf7d={'ids':[_0x2785c1[0x0]]};if(rpc[_0x9f8ae0[_0x0dcc('0x11')]+'Interaction']){rpc[_0x9f8ae0['channel']+_0x0dcc('0x12')][_0x0dcc('0x13')](_0x9f8ae0['interaction']['id'],_0x2bdf7d)[_0x0dcc('0x14')](function(_0xb5dcde){logger[_0x0dcc('0xf')](_0x0dcc('0x15'),_0x311095,_0x2785c1[0x1],_0x9f8ae0[_0x0dcc('0x11')],_0x9f8ae0['interaction']['id']);})[_0x0dcc('0x16')](function(_0x2f6f73){logger[_0x0dcc('0xa')]('[%s][TAG]\x20%s',_0x311095,JSON['stringify'](_0x2f6f73));logger['info'](_0x0dcc('0x17'),_0x311095);})[_0x0dcc('0x18')](function(){_0x266a98[_0x0dcc('0x10')]();});}}}catch(_0xb98a){logger['error'](_0x0dcc('0xb'),_0x311095,_[_0x0dcc('0x19')](_0xb98a)?JSON['stringify'](_0xb98a):_0xb98a);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x311095);_0x266a98[_0x0dcc('0x10')]();}};}; \ No newline at end of file +var _0xdfc8=['stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch'];(function(_0x438476,_0x11ef19){var _0x28c749=function(_0xdda00b){while(--_0xdda00b){_0x438476['push'](_0x438476['shift']());}};_0x28c749(++_0x11ef19);}(_0xdfc8,0x1b6));var _0x8dfc=function(_0x3598f0,_0x5d2e64){_0x3598f0=_0x3598f0-0x0;var _0x11e180=_0xdfc8[_0x3598f0];return _0x11e180;};'use strict';var schema=require(_0x8dfc('0x0'));var _=require(_0x8dfc('0x1'));var rpc={'chatInteraction':require(_0x8dfc('0x2')),'openchannelInteraction':require(_0x8dfc('0x3')),'smsInteraction':require(_0x8dfc('0x4')),'mailInteraction':require(_0x8dfc('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x8dfc('0x6'))};var logger=require(_0x8dfc('0x7'))('routing');var tag=schema({'tag':{'type':_0x8dfc('0x8'),'required':!![],'message':_0x8dfc('0x9')}});exports[_0x8dfc('0xa')]=function(_0x357219,_0x3a8f67,_0x464249,_0x469499){return function(_0x23c54d){try{var _0x3bc8f7={'tag':_0x3a8f67[0x0]};var _0xaf43bd=tag[_0x8dfc('0x0')](_0x3bc8f7,{'typecast':!![]});if(_0xaf43bd[_0x8dfc('0xb')]){logger[_0x8dfc('0xc')](_0x8dfc('0xd'),_0x357219,_[_0x8dfc('0xe')](_0xaf43bd,_0x8dfc('0xf'))[_0x8dfc('0x10')](',\x20'));logger['info'](_0x8dfc('0x11'),_0x357219);_0x23c54d[_0x8dfc('0x12')]();}else{var _0x5dc90b={'ids':[_0x3a8f67[0x0]]};if(rpc[_0x469499['channel']+_0x8dfc('0x13')]){rpc[_0x469499['channel']+_0x8dfc('0x13')]['addTags'](_0x469499[_0x8dfc('0x14')]['id'],_0x5dc90b)[_0x8dfc('0x15')](function(_0x2e80c7){logger[_0x8dfc('0x16')](_0x8dfc('0x17'),_0x357219,_0x3a8f67[0x1],_0x469499[_0x8dfc('0x18')],_0x469499[_0x8dfc('0x14')]['id']);})[_0x8dfc('0x19')](function(_0x36569b){logger[_0x8dfc('0xc')](_0x8dfc('0xd'),_0x357219,JSON[_0x8dfc('0x1a')](_0x36569b));logger[_0x8dfc('0x16')](_0x8dfc('0x11'),_0x357219);})[_0x8dfc('0x1b')](function(){_0x23c54d[_0x8dfc('0x12')]();});}}}catch(_0x4c2f53){logger['error'](_0x8dfc('0xd'),_0x357219,_[_0x8dfc('0x1c')](_0x4c2f53)?JSON['stringify'](_0x4c2f53):_0x4c2f53);logger[_0x8dfc('0x16')](_0x8dfc('0x11'),_0x357219);_0x23c54d[_0x8dfc('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 5b77d21..df35292 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 _0x8212=['info','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','consequence','\x20-\x20','replace','includes','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','POST','then','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&data='];(function(_0x272156,_0x5e4b0d){var _0x1071d0=function(_0x5f1f6b){while(--_0x5f1f6b){_0x272156['push'](_0x272156['shift']());}};_0x1071d0(++_0x5e4b0d);}(_0x8212,0x1bf));var _0x2821=function(_0x2f8fc5,_0x5804a7){_0x2f8fc5=_0x2f8fc5-0x0;var _0x392d45=_0x8212[_0x2f8fc5];return _0x392d45;};'use strict';var rp=require(_0x2821('0x0'));var logger=require(_0x2821('0x1'))(_0x2821('0x2'));var _=require('lodash');var arr=[];exports[_0x2821('0x3')]=function(_0x33573b,_0x268274){return function(_0x49cb93){var _0xbbb2ec=_0x268274[0xa];var _0x834362=_0x268274[0xb];var _0x3e46b1=_0x268274[0xc];var _0x6950f5=_0x268274[0xd];var _0x5deb4e=_0x268274[0xe];var _0x5c67e7=_0x268274[0xf]['replace'](/\n/g,_0x2821('0x4'));var _0x14889b=_0x268274[0x10][_0x2821('0x5')](/\n/g,'\x20');if(!arr[_0x2821('0x6')](_0x834362)){arr['push'](_0x834362);var _0x24456b=_0x268274[0x3];var _0x145ad2=_0x268274[0x4];var _0x51d228=_0x268274[0x1];var _0xfdd486=_0x268274[0x0];var _0x2084bb={};_0x2084bb[_0x2821('0x7')]=_0x268274[0x8]+_0x2821('0x8')+_0x3e46b1+'|'+_0xbbb2ec+'|'+_0x6950f5+'|'+_0x834362+'|'+_0x5deb4e;_0x2084bb['urlOnRing']=_0x268274[0x7]+'?params='+_0x3e46b1+'|'+_0xbbb2ec+'|'+_0x6950f5+'|'+_0x834362+'|'+_0x5deb4e+'|'+_0x5c67e7+'|'+_0x14889b;_0x2084bb[_0x2821('0x9')]=_0x268274[0x9];var _0x296c53={};_0x296c53[_0x2821('0xa')]=_0x2821('0xb');_0x296c53[_0x2821('0xc')]=_0x2821('0xd');var _0x466c4b=[];_0x466c4b['push'](_0x268274[0x2]);_0x466c4b['push'](_0x268274[0x5]);_0x466c4b['push'](_0x268274[0x6]);_0x296c53[_0x2821('0xe')]=_0x466c4b;_0x296c53['id']=0x1;var _0x5c6658=JSON[_0x2821('0xf')](_0x296c53);var _0x2ebfbe={'encoding':'utf8','method':_0x2821('0x10'),'timeout':0x2710,'url':_0x24456b,'headers':{'Content-Type':'application/json-rpc'},'body':_0x5c6658};return rp(_0x2ebfbe)[_0x2821('0x11')](function(_0x567e8f){const _0x57cb5e=JSON['parse'](_0x567e8f);if(!_0x57cb5e[_0x2821('0x12')]['logged']){throw new Error(_0x2821('0x13'));}var _0x30cc98=_0x834362;var _0x5a32cc='channelId='+_0x51d228+'&serviceId='+_0xfdd486+'&sessionId='+_0x30cc98+_0x2821('0x14')+JSON[_0x2821('0xf')](_0x2084bb);var _0xffedd=_0x145ad2+'?'+_0x5a32cc;return rp(_0xffedd);})['then'](function(_0x3ca3ec){logger[_0x2821('0x15')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x33573b,_0x3ca3ec);_0x49cb93['stop']();})['catch'](function(_0x3308ea){logger['error'](_0x2821('0x16'),_0x33573b,_[_0x2821('0x17')](_0x3308ea)?JSON[_0x2821('0xf')](_0x3308ea):_0x3308ea);_0x49cb93[_0x2821('0x18')]();});}else{logger[_0x2821('0x15')](_0x2821('0x19'),_0x33573b);_0x49cb93['next']();}};}; \ No newline at end of file +var _0xc043=['[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','lodash','consequence','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','2.0','login','params','stringify','utf8','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc043,0xa1));var _0x3c04=function(_0x7ed0c5,_0x3c8603){_0x7ed0c5=_0x7ed0c5-0x0;var _0x410eaf=_0xc043[_0x7ed0c5];return _0x410eaf;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')('routing');var _=require(_0x3c04('0x0'));var arr=[];exports[_0x3c04('0x1')]=function(_0x3684da,_0x313c58){return function(_0x1f7962){var _0x5f01f5=_0x313c58[0xa];var _0xa25171=_0x313c58[0xb];var _0x95699f=_0x313c58[0xc];var _0x140250=_0x313c58[0xd];var _0x4a014a=_0x313c58[0xe];var _0x228402=_0x313c58[0xf]['replace'](/\n/g,_0x3c04('0x2'));var _0x1172a4=_0x313c58[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x3c04('0x3')](_0xa25171)){arr[_0x3c04('0x4')](_0xa25171);var _0xa3403e=_0x313c58[0x3];var _0x1961db=_0x313c58[0x4];var _0x1d70a9=_0x313c58[0x1];var _0x5a5867=_0x313c58[0x0];var _0x17bdf9={};_0x17bdf9[_0x3c04('0x5')]=_0x313c58[0x8]+_0x3c04('0x6')+_0x95699f+'|'+_0x5f01f5+'|'+_0x140250+'|'+_0xa25171+'|'+_0x4a014a;_0x17bdf9['urlOnRing']=_0x313c58[0x7]+_0x3c04('0x6')+_0x95699f+'|'+_0x5f01f5+'|'+_0x140250+'|'+_0xa25171+'|'+_0x4a014a+'|'+_0x228402+'|'+_0x1172a4;_0x17bdf9[_0x3c04('0x7')]=_0x313c58[0x9];var _0xf14938={};_0xf14938[_0x3c04('0x8')]=_0x3c04('0x9');_0xf14938['method']=_0x3c04('0xa');var _0x44368b=[];_0x44368b[_0x3c04('0x4')](_0x313c58[0x2]);_0x44368b[_0x3c04('0x4')](_0x313c58[0x5]);_0x44368b[_0x3c04('0x4')](_0x313c58[0x6]);_0xf14938[_0x3c04('0xb')]=_0x44368b;_0xf14938['id']=0x1;var _0x15e63b=JSON[_0x3c04('0xc')](_0xf14938);var _0x24409f={'encoding':_0x3c04('0xd'),'method':'POST','timeout':0x2710,'url':_0xa3403e,'headers':{'Content-Type':_0x3c04('0xe')},'body':_0x15e63b};return rp(_0x24409f)[_0x3c04('0xf')](function(_0x40e0ae){const _0x4c8eca=JSON[_0x3c04('0x10')](_0x40e0ae);if(!_0x4c8eca[_0x3c04('0x11')][_0x3c04('0x12')]){throw new Error(_0x3c04('0x13'));}var _0x245b55=_0xa25171;var _0x5785ff=_0x3c04('0x14')+_0x1d70a9+_0x3c04('0x15')+_0x5a5867+_0x3c04('0x16')+_0x245b55+_0x3c04('0x17')+JSON[_0x3c04('0xc')](_0x17bdf9);var _0x5989e3=_0x1961db+'?'+_0x5785ff;return rp(_0x5989e3);})[_0x3c04('0xf')](function(_0x5f3ed2){logger[_0x3c04('0x18')](_0x3c04('0x19'),_0x3684da,_0x5f3ed2);_0x1f7962[_0x3c04('0x1a')]();})[_0x3c04('0x1b')](function(_0x36a5d1){logger[_0x3c04('0x1c')](_0x3c04('0x1d'),_0x3684da,_[_0x3c04('0x1e')](_0x36a5d1)?JSON['stringify'](_0x36a5d1):_0x36a5d1);_0x1f7962[_0x3c04('0x1a')]();});}else{logger['info'](_0x3c04('0x1f'),_0x3684da);_0x1f7962['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 47434be..a0de4c8 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x289bb7,_0xa3684c){var _0x4d85be=function(_0x557cb3){while(--_0x557cb3){_0x289bb7['push'](_0x289bb7['shift']());}};_0x4d85be(++_0xa3684c);}(_0xe706,0xa3));var _0x6e70=function(_0x155924,_0x2a5368){_0x155924=_0x155924-0x0;var _0x262e4b=_0xe706[_0x155924];return _0x262e4b;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x9adf26,_0x2648a1){var _0x5b2778=function(_0x5e9705){while(--_0x5e9705){_0x9adf26['push'](_0x9adf26['shift']());}};_0x5b2778(++_0x2648a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 9496e6a..32f22ce 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 _0x5db8=['../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','./interval','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','./applications/utils','routing'];(function(_0x131fe7,_0x21fcdb){var _0x2eddf3=function(_0x1be350){while(--_0x1be350){_0x131fe7['push'](_0x131fe7['shift']());}};_0x2eddf3(++_0x21fcdb);}(_0x5db8,0xbb));var _0x85db=function(_0x404cde,_0x27b51c){_0x404cde=_0x404cde-0x0;var _0x139882=_0x5db8[_0x404cde];return _0x139882;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x85db('0x3'));var uuid=require(_0x85db('0x4'));var utils=require(_0x85db('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x85db('0x6'));var rpc={'openchannelQueueReport':require(_0x85db('0x7')),'mailQueueReport':require(_0x85db('0x8')),'chatQueueReport':require(_0x85db('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x85db('0xa'))};var RuleEngine=require(_0x85db('0xb'));function getId(_0xc6fd00,_0x308988,_0x59a522){return util[_0x85db('0xc')]('%s.%s.%s',_0xc6fd00,_0x308988||0x0,_0x59a522||0x0);}function getIntervals(_0x18e5d1,_0x27819d){var _0x42c287=[];if(!_[_0x85db('0xd')](_0x27819d['IntervalId'])&&!_['isNil'](_0x18e5d1[_0x27819d['IntervalId']])&&!_[_0x85db('0xd')](_0x18e5d1[_0x27819d[_0x85db('0xe')]]['Intervals'])){_0x42c287=_[_0x85db('0xf')](_0x18e5d1[_0x27819d['IntervalId']][_0x85db('0x10')],_0x85db('0x11'));}else if(!_[_0x85db('0xd')](_0x27819d[_0x85db('0x11')])){_0x42c287=[_0x27819d[_0x85db('0x11')]];}return _0x42c287;}exports[_0x85db('0x12')]=function(_0x2b7507){_0x2b7507[_0x85db('0x13')]={};return new BPromise(function(_0x3ca181,_0x415281){var _0x1e9dec={'Start':function(_0x270fd7){var _0x2be61d=this;return new Promise(function(_0x5ccfef,_0x27bd65){if(_0x270fd7){try{var _0x175622=[];var _0x11e7da=getId(_0x270fd7[_0x85db('0x14')],_0x270fd7[_0x85db('0x15')]?_0x270fd7[_0x85db('0x15')]['id']:0x0,_0x270fd7[_0x85db('0x16')]?_0x270fd7['interaction']['id']:0x0);if(_0x270fd7[_0x85db('0x17')]&&_[_0x85db('0x18')](_0x270fd7[_0x85db('0x17')])&&_0x270fd7[_0x85db('0x17')][_0x85db('0x19')]){for(var _0x2bc9a4=0x0;_0x2bc9a4<_0x270fd7[_0x85db('0x17')][_0x85db('0x19')];_0x2bc9a4+=0x1){var _0x2b8f30=_0x270fd7[_0x85db('0x17')][_0x2bc9a4];if(fs['existsSync'](path[_0x85db('0x1a')](__dirname,_0x85db('0x17'),_0x2b8f30[_0x85db('0x1b')]+_0x85db('0x1c')))){var _0x44c122=[];switch(_0x2b8f30[_0x85db('0x1b')][_0x85db('0x1d')]()){case _0x85db('0x1e'):var _0x4e2755=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');if(_0x270fd7[_0x85db('0x14')]===_0x85db('0x21')){_0x44c122[_0x85db('0x22')](_0x4e2755[0x0]);_0x44c122[_0x85db('0x22')](_0x4e2755[0x1]);_0x44c122['push'](_0x4e2755[_0x85db('0x23')](0x2,_0x4e2755[_0x85db('0x19')])[_0x85db('0x1a')](','));}else{_0x44c122['push'](_0x4e2755[0x0]);_0x44c122['push'](_0x4e2755['slice'](0x1,_0x4e2755[_0x85db('0x19')])[_0x85db('0x1a')](','));}break;case _0x85db('0x24'):var _0x51b748=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x51b748[0x0]);_0x44c122['push'](_0x51b748[0x1]);_0x44c122['push'](_0x51b748[_0x85db('0x23')](0x2,_0x51b748[_0x85db('0x19')])[_0x85db('0x1a')](','));break;case _0x85db('0x25'):var _0x397afc=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x397afc[0x0]);_0x44c122[_0x85db('0x22')](_0x397afc[0x1]);_0x44c122[_0x85db('0x22')](_0x397afc[0x2]);_0x44c122['push'](_0x397afc[0x3]);_0x44c122['push'](_0x397afc[_0x85db('0x23')](0x4,_0x397afc['length'])[_0x85db('0x1a')](','));break;case _0x85db('0x26'):var _0x5abdb7=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x5abdb7[0x0]);_0x44c122[_0x85db('0x22')](_0x5abdb7[0x1]);_0x44c122['push'](_0x5abdb7[0x2]);_0x44c122[_0x85db('0x22')](_0x5abdb7[0x3]);_0x44c122[_0x85db('0x22')](_0x5abdb7[_0x85db('0x23')](0x4,_0x5abdb7[_0x85db('0x19')])[_0x85db('0x1a')](','));break;case'message':_0x44c122[_0x85db('0x22')](_0x2b8f30[_0x85db('0x1f')]);break;case _0x85db('0x27'):_0x44c122[_0x85db('0x22')](_0x2b8f30['TagId']);_0x44c122[_0x85db('0x22')](_0x2b8f30[_0x85db('0x1f')]);break;case _0x85db('0x28'):var _0x536398=utils['getMustacheRender'](_0x270fd7[_0x85db('0x29')][_0x85db('0x2a')],_0x270fd7);var _0x4980b7=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x4980b7[0x0]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x1]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x2]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x3]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x4]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x5]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x6]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x7]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x8]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x9]);_0x44c122['push'](_0x4980b7[0xa]);_0x44c122[_0x85db('0x22')](_0x270fd7[_0x85db('0x16')]['id']);_0x44c122[_0x85db('0x22')](_0x270fd7[_0x85db('0x15')]['id']);_0x44c122['push'](_0x2b8f30[_0x85db('0x2b')]);_0x44c122[_0x85db('0x22')](_0x270fd7[_0x85db('0x16')][_0x85db('0x2c')]);_0x44c122['push'](_0x270fd7['body']['body']);_0x44c122['push'](_0x536398);break;default:_0x44c122=_['isNil'](_0x2b8f30[_0x85db('0x1f')])?[]:_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');}var _0x17f649={'id':util[_0x85db('0xc')]('%s:%s:%s',_0x11e7da,_0x2b8f30['id'],_0x2b8f30['app']),'condition':require(_0x85db('0x2d'))['condition'](_0x11e7da,getIntervals(_0x2b7507[_0x85db('0x2e')],_0x2b8f30),_0x2b7507),'consequence':require(_0x85db('0x2f')+_0x2b8f30['app'])['consequence'](_0x11e7da,_0x44c122,_0x2b7507,_0x270fd7),'p':_0x2b8f30[_0x85db('0x30')]||0x0};logger[_0x85db('0x31')](_0x85db('0x32'),_0x17f649['id'],_0x85db('0x33'),getIntervals(_0x2b7507[_0x85db('0x2e')],_0x2b8f30)['join'](_0x85db('0x34')));_0x175622[_0x85db('0x22')](_0x17f649);}else{logger[_0x85db('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x2b8f30[_0x85db('0x1b')]+_0x85db('0x1c')));}}_0x2b7507[_0x85db('0x13')][_0x11e7da]=new RuleEngine(_0x175622);_0x2b7507['rules'][_0x11e7da]['execute'](_0x270fd7,function(_0x3e4dbc){logger['info'](_0x85db('0x36'),JSON[_0x85db('0x37')](_0x3e4dbc[_0x85db('0x38')]));if(_0x2b7507['rules'][_0x11e7da]){_0x2b7507[_0x85db('0x13')][_0x11e7da][_0x85db('0x39')](_0x85db('0x3a'));}});return _0x5ccfef({'code':0xc8,'message':_0x270fd7});}else{logger[_0x85db('0x31')](_0x85db('0x3b'));return _0x5ccfef({'code':0xc8,'message':_0x270fd7});}}catch(_0x1670fd){logger[_0x85db('0x35')](_0x1670fd[_0x85db('0x3c')]);return _0x27bd65(_0x2be61d[_0x85db('0x35')](0x1f4,_0x1670fd));}}return _0x27bd65('routing\x20is\x20empty');});},'AcceptMessage':function(_0x16a25f){var _0x1b9ab8=this;return new Promise(function(_0x30c7a0,_0x16d6b3){if(_0x16a25f[_0x85db('0x3d')]&&_0x16a25f[_0x85db('0x3d')]['id']){if(_0x2b7507['agents'][_0x16a25f[_0x85db('0x3d')]['id']]){_0x2b7507[_0x85db('0x3e')][_0x16a25f[_0x85db('0x3d')]['id']]['busy']=![];_0x2b7507['agents'][_0x16a25f[_0x85db('0x3d')]['id']]['busyQueue']=undefined;}}if(_0x16a25f[_0x85db('0x15')]&&_0x16a25f[_0x85db('0x15')]['id']){try{var _0x24afcd=getId(_0x16a25f[_0x85db('0x14')],_0x16a25f[_0x85db('0x15')]?_0x16a25f['message']['id']:0x0,_0x16a25f['interaction']?_0x16a25f[_0x85db('0x16')]['id']:0x0);if(_0x2b7507[_0x85db('0x13')][_0x24afcd]){_0x2b7507[_0x85db('0x13')][_0x24afcd][_0x85db('0x39')](_0x85db('0x3f'));if(rpc[_0x16a25f[_0x85db('0x14')]+_0x85db('0x40')]){rpc[_0x16a25f[_0x85db('0x14')]+_0x85db('0x40')][_0x85db('0x41')](_0x24afcd,{'UserId':_0x16a25f['message'][_0x85db('0x42')]})[_0x85db('0x43')](function(_0x54abf5){logger['error'](_0x85db('0x44'));});}}return _0x30c7a0({'code':0xc8,'message':_0x16a25f});}catch(_0x306be6){logger['error'](_0x306be6['stack']);return _0x16d6b3(_0x1b9ab8[_0x85db('0x35')](0x1f4,_0x306be6));}}logger[_0x85db('0x35')]('message\x20is\x20empty');return _0x16d6b3(_0x1b9ab8[_0x85db('0x35')](0x1f4,_0x85db('0x45')));});},'RejectMessage':function(_0x29df9e){var _0xd3cedb=this;return new Promise(function(_0x12b822,_0x2cddad){if(_0x29df9e[_0x85db('0x3d')]&&_0x29df9e[_0x85db('0x3d')]['id']){try{if(_0x2b7507[_0x85db('0x3e')][_0x29df9e[_0x85db('0x3d')]['id']]){_0x2b7507['agents'][_0x29df9e['agent']['id']][_0x85db('0x46')]=![];_0x2b7507[_0x85db('0x3e')][_0x29df9e[_0x85db('0x3d')]['id']][_0x85db('0x47')]=undefined;}return _0x12b822({'code':0xc8,'message':_0x29df9e});}catch(_0x2b77ce){logger[_0x85db('0x35')](_0x2b77ce[_0x85db('0x3c')]);return _0x2cddad(_0xd3cedb[_0x85db('0x35')](0x1f4,_0x2b77ce));}}logger[_0x85db('0x35')](_0x85db('0x45'));return _0x2cddad(_0xd3cedb[_0x85db('0x35')](0x1f4,_0x85db('0x45')));});},'AbandonInteraction':function(_0x198dad){var _0x425e61=this;return new Promise(function(_0x4b4742,_0x3df8ed){if(_0x198dad[_0x85db('0x14')]&&_0x198dad['interaction']&&_0x198dad[_0x85db('0x16')]['id']){try{var _0x40a009=getId(_0x198dad[_0x85db('0x14')],_0x198dad[_0x85db('0x15')]?_0x198dad[_0x85db('0x15')]['id']:0x0,_0x198dad[_0x85db('0x16')]?_0x198dad[_0x85db('0x16')]['id']:0x0);if(_0x2b7507['rules'][_0x40a009]){_0x2b7507[_0x85db('0x13')][_0x40a009][_0x85db('0x39')]('end');}return _0x4b4742({'code':0xc8,'message':_0x198dad});}catch(_0x5b38c6){logger[_0x85db('0x35')](_0x5b38c6['stack']);return _0x3df8ed(_0x425e61[_0x85db('0x35')](0x1f4,_0x5b38c6));}}logger[_0x85db('0x35')](_0x85db('0x45'));return _0x3df8ed(_0x425e61[_0x85db('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x247da4){var _0x5c634d=this;return new Promise(function(_0x5b950d,_0x493ab3){if(_0x2b7507[_0x85db('0x3e')][_0x85db('0x48')](_0x247da4['id'])){for(var _0x4fdec2 in _0x247da4[_0x85db('0x49')]){if(_0x247da4[_0x85db('0x49')]['hasOwnProperty'](_0x4fdec2)){if(_0x2b7507[_0x85db('0x3e')][_0x247da4['id']][_0x85db('0x48')](_0x4fdec2+_0x85db('0x4a'))){_0x2b7507[_0x85db('0x3e')][_0x247da4['id']][_0x4fdec2+_0x85db('0x4a')]=parseInt(_0x247da4[_0x85db('0x49')][_0x4fdec2],0xa);}}}_0x2b7507['agents'][_0x247da4['id']][_0x85db('0x4b')]();return _0x5b950d({'code':0xc8,'message':_0x2b7507[_0x85db('0x3e')][_0x247da4['id']]});}else{return _0x493ab3(_0x5c634d[_0x85db('0x35')](0x1f4,_0x85db('0x4c')));}});},'Agents':function(_0xff3b97){return new Promise(function(_0xfacd9e,_0x1c26a7){var _0x2b9da3=_['values'](_0x2b7507['agents']);_0xfacd9e({'count':_0x2b9da3['length'],'rows':_0x2b9da3});});},'ChatQueues':function(_0x4e5e2a){return new Promise(function(_0x16aac9,_0x38f37f){var _0x88626d=[];for(var _0x239027 in _0x2b7507[_0x85db('0x4d')]){if(_0x2b7507[_0x85db('0x4d')]['hasOwnProperty'](_0x239027)){var _0x367ebe=_0x2b7507[_0x85db('0x4d')][_0x239027];var _0x11bc25={'id':_0x367ebe['id'],'available':_0x367ebe[_0x85db('0x4e')],'loggedIn':_0x367ebe['loggedIn'],'name':_0x367ebe[_0x85db('0x4f')],'paused':_0x367ebe[_0x85db('0x50')],'waiting':_0x367ebe[_0x85db('0x51')]};_0x88626d[_0x85db('0x22')](_0x11bc25);}}_0x16aac9({'count':_0x88626d[_0x85db('0x19')],'rows':_0x88626d});});},'MailQueues':function(_0x2a7f1e){return new Promise(function(_0x4604e7,_0x2af26e){var _0x357a98=[];for(var _0x22559c in _0x2b7507['mailQueues']){if(_0x2b7507[_0x85db('0x52')][_0x85db('0x48')](_0x22559c)){var _0x40ccc6=_0x2b7507[_0x85db('0x52')][_0x22559c];var _0x1c37f4={'id':_0x40ccc6['id'],'available':_0x40ccc6['available'],'loggedIn':_0x40ccc6[_0x85db('0x53')],'name':_0x40ccc6[_0x85db('0x4f')],'paused':_0x40ccc6[_0x85db('0x50')],'waiting':_0x40ccc6[_0x85db('0x51')]};_0x357a98[_0x85db('0x22')](_0x1c37f4);}}_0x4604e7({'count':_0x357a98['length'],'rows':_0x357a98});});},'OpenchannelQueues':function(_0x1a9f92){return new Promise(function(_0x4213c3,_0x176e51){var _0x58ff0f=[];for(var _0xee1099 in _0x2b7507[_0x85db('0x54')]){if(_0x2b7507[_0x85db('0x54')]['hasOwnProperty'](_0xee1099)){var _0xbf277e=_0x2b7507[_0x85db('0x54')][_0xee1099];var _0x5b516d={'id':_0xbf277e['id'],'available':_0xbf277e[_0x85db('0x4e')],'loggedIn':_0xbf277e[_0x85db('0x53')],'name':_0xbf277e[_0x85db('0x4f')],'paused':_0xbf277e[_0x85db('0x50')],'waiting':_0xbf277e[_0x85db('0x51')]};_0x58ff0f[_0x85db('0x22')](_0x5b516d);}}_0x4213c3({'count':_0x58ff0f[_0x85db('0x19')],'rows':_0x58ff0f});});},'SmsQueues':function(_0xd96523){return new Promise(function(_0x22a37a,_0x27aa32){var _0xa4d981=[];for(var _0x3e81b6 in _0x2b7507[_0x85db('0x55')]){if(_0x2b7507[_0x85db('0x55')][_0x85db('0x48')](_0x3e81b6)){var _0x4da42e=_0x2b7507[_0x85db('0x55')][_0x3e81b6];var _0x2f7f7a={'id':_0x4da42e['id'],'available':_0x4da42e[_0x85db('0x4e')],'loggedIn':_0x4da42e[_0x85db('0x53')],'name':_0x4da42e['name'],'paused':_0x4da42e['paused'],'waiting':_0x4da42e[_0x85db('0x51')]};_0xa4d981['push'](_0x2f7f7a);}}_0x22a37a({'count':_0xa4d981[_0x85db('0x19')],'rows':_0xa4d981});});},'FaxQueues':function(_0x45cfd2){return new Promise(function(_0x3fc37e,_0x59bca4){var _0xf556b5=[];for(var _0x377eb6 in _0x2b7507[_0x85db('0x56')]){if(_0x2b7507[_0x85db('0x56')]['hasOwnProperty'](_0x377eb6)){var _0x28e203=_0x2b7507['faxQueues'][_0x377eb6];var _0x145c78={'id':_0x28e203['id'],'available':_0x28e203[_0x85db('0x4e')],'loggedIn':_0x28e203[_0x85db('0x53')],'name':_0x28e203[_0x85db('0x4f')],'paused':_0x28e203[_0x85db('0x50')],'waiting':_0x28e203[_0x85db('0x51')]};_0xf556b5[_0x85db('0x22')](_0x145c78);}}_0x3fc37e({'count':_0xf556b5[_0x85db('0x19')],'rows':_0xf556b5});});},'WhatsappQueues':function(_0x15895e){return new Promise(function(_0x1c57ca,_0x16df89){var _0x33440a=[];for(var _0x4369bd in _0x2b7507['whatsappQueues']){if(_0x2b7507[_0x85db('0x57')]['hasOwnProperty'](_0x4369bd)){var _0x2aeb7d=_0x2b7507[_0x85db('0x57')][_0x4369bd];var _0x4c1b81={'id':_0x2aeb7d['id'],'available':_0x2aeb7d[_0x85db('0x4e')],'loggedIn':_0x2aeb7d[_0x85db('0x53')],'name':_0x2aeb7d[_0x85db('0x4f')],'paused':_0x2aeb7d['paused'],'waiting':_0x2aeb7d[_0x85db('0x51')]};_0x33440a['push'](_0x4c1b81);}}_0x1c57ca({'count':_0x33440a[_0x85db('0x19')],'rows':_0x33440a});});},'ChatQueuesWaitingInteractions':function(_0x58382d){return new Promise(function(_0x2b6490,_0x2e68cc){var _0x542be6=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x59')]);_0x2b6490({'count':_0x542be6[_0x85db('0x19')],'rows':_0x542be6});});},'MailQueuesWaitingInteractions':function(_0x23fb0f){return new Promise(function(_0x3dc1ab,_0x249e03){var _0x520315=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x5a')]);_0x3dc1ab({'count':_0x520315[_0x85db('0x19')],'rows':_0x520315});});},'OpenchannelQueuesWaitingInteractions':function(_0x598e01){return new Promise(function(_0x3c92b3,_0x2c6f48){var _0x388fa4=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x5b')]);_0x3c92b3({'count':_0x388fa4[_0x85db('0x19')],'rows':_0x388fa4});});},'SmsQueuesWaitingInteractions':function(_0x13fd5){return new Promise(function(_0x308537,_0x37d815){var _0x3cd417=_[_0x85db('0x58')](_0x2b7507['smsQueuesWaitingInteractions']);_0x308537({'count':_0x3cd417[_0x85db('0x19')],'rows':_0x3cd417});});},'FaxQueuesWaitingInteractions':function(_0x9c32f1){return new Promise(function(_0xdcb072,_0x53f137){var _0x17df73=_['values'](_0x2b7507[_0x85db('0x5c')]);_0xdcb072({'count':_0x17df73['length'],'rows':_0x17df73});});},'WhatsappQueuesWaitingInteractions':function(_0x1cbd17){return new Promise(function(_0x48425e,_0xdedf9e){var _0x5c6028=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x5d')]);_0x48425e({'count':_0x5c6028['length'],'rows':_0x5c6028});});}};var _0x565d66=jayson['server'](_0x1e9dec)['http']();_0x565d66['on'](_0x85db('0x35'),function(_0x10352e){logger[_0x85db('0x35')](JSON[_0x85db('0x37')](_0x10352e));return _0x415281(_0x10352e);});_0x565d66[_0x85db('0x12')](0x232c,_0x85db('0x5e'),function(){console['log'](_0x85db('0x5f'),0x232c);return _0x3ca181(_0x85db('0x60')+0x232c);});});}; \ No newline at end of file +var _0xd404=['agents','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','waiting','mailQueues','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','split','amazonlex','message','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','format','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent'];(function(_0x419ed5,_0x57612){var _0x4624ce=function(_0x396103){while(--_0x396103){_0x419ed5['push'](_0x419ed5['shift']());}};_0x4624ce(++_0x57612);}(_0xd404,0x15b));var _0x4d40=function(_0x4a3dc0,_0xfb849e){_0x4a3dc0=_0x4a3dc0-0x0;var _0x233760=_0xd404[_0x4a3dc0];return _0x233760;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x4d40('0x2'));var BPromise=require(_0x4d40('0x3'));var uuid=require('uuid');var utils=require(_0x4d40('0x4'));var config=require(_0x4d40('0x5'));var logger=require(_0x4d40('0x6'))(_0x4d40('0x7'));var rpc={'openchannelQueueReport':require(_0x4d40('0x8')),'mailQueueReport':require(_0x4d40('0x9')),'chatQueueReport':require(_0x4d40('0xa')),'smsQueueReport':require(_0x4d40('0xb')),'faxQueueReport':require(_0x4d40('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x4d40('0xd'));function getId(_0x116941,_0x5a23a2,_0x3bf81a){return util['format']('%s.%s.%s',_0x116941,_0x5a23a2||0x0,_0x3bf81a||0x0);}function getIntervals(_0x1d537c,_0x49b4c5){var _0x1717c0=[];if(!_[_0x4d40('0xe')](_0x49b4c5[_0x4d40('0xf')])&&!_[_0x4d40('0xe')](_0x1d537c[_0x49b4c5[_0x4d40('0xf')]])&&!_[_0x4d40('0xe')](_0x1d537c[_0x49b4c5[_0x4d40('0xf')]][_0x4d40('0x10')])){_0x1717c0=_[_0x4d40('0x11')](_0x1d537c[_0x49b4c5[_0x4d40('0xf')]][_0x4d40('0x10')],_0x4d40('0x12'));}else if(!_['isNil'](_0x49b4c5[_0x4d40('0x12')])){_0x1717c0=[_0x49b4c5[_0x4d40('0x12')]];}return _0x1717c0;}exports[_0x4d40('0x13')]=function(_0x2083bd){_0x2083bd[_0x4d40('0x14')]={};return new BPromise(function(_0x478cdd,_0x23de7b){var _0x4077ce={'Start':function(_0x20bc1b){var _0xcee25a=this;return new Promise(function(_0x453857,_0x361a41){if(_0x20bc1b){try{var _0x10518e=[];var _0x43c902=getId(_0x20bc1b[_0x4d40('0x15')],_0x20bc1b['message']?_0x20bc1b['message']['id']:0x0,_0x20bc1b[_0x4d40('0x16')]?_0x20bc1b[_0x4d40('0x16')]['id']:0x0);if(_0x20bc1b['applications']&&_[_0x4d40('0x17')](_0x20bc1b[_0x4d40('0x18')])&&_0x20bc1b['applications'][_0x4d40('0x19')]){for(var _0x5a77e0=0x0;_0x5a77e0<_0x20bc1b[_0x4d40('0x18')][_0x4d40('0x19')];_0x5a77e0+=0x1){var _0x5230b4=_0x20bc1b['applications'][_0x5a77e0];if(fs[_0x4d40('0x1a')](path[_0x4d40('0x1b')](__dirname,'applications',_0x5230b4[_0x4d40('0x1c')]+_0x4d40('0x1d')))){var _0x30f058=[];switch(_0x5230b4['app'][_0x4d40('0x1e')]()){case _0x4d40('0x1f'):var _0x2f1c21=_0x5230b4['appdata']['split'](',');if(_0x20bc1b[_0x4d40('0x15')]===_0x4d40('0x20')){_0x30f058[_0x4d40('0x21')](_0x2f1c21[0x0]);_0x30f058[_0x4d40('0x21')](_0x2f1c21[0x1]);_0x30f058[_0x4d40('0x21')](_0x2f1c21['slice'](0x2,_0x2f1c21[_0x4d40('0x19')])[_0x4d40('0x1b')](','));}else{_0x30f058['push'](_0x2f1c21[0x0]);_0x30f058['push'](_0x2f1c21[_0x4d40('0x22')](0x1,_0x2f1c21[_0x4d40('0x19')])[_0x4d40('0x1b')](','));}break;case _0x4d40('0x23'):var _0x4a8ad6=_0x5230b4[_0x4d40('0x24')][_0x4d40('0x25')](',');_0x30f058[_0x4d40('0x21')](_0x4a8ad6[0x0]);_0x30f058[_0x4d40('0x21')](_0x4a8ad6[0x1]);_0x30f058[_0x4d40('0x21')](_0x4a8ad6[_0x4d40('0x22')](0x2,_0x4a8ad6['length'])['join'](','));break;case'dialogflowv2':var _0x158a86=_0x5230b4[_0x4d40('0x24')][_0x4d40('0x25')](',');_0x30f058[_0x4d40('0x21')](_0x158a86[0x0]);_0x30f058['push'](_0x158a86[0x1]);_0x30f058[_0x4d40('0x21')](_0x158a86[0x2]);_0x30f058[_0x4d40('0x21')](_0x158a86[0x3]);_0x30f058[_0x4d40('0x21')](_0x158a86['slice'](0x4,_0x158a86[_0x4d40('0x19')])[_0x4d40('0x1b')](','));break;case _0x4d40('0x26'):var _0x1f9577=_0x5230b4[_0x4d40('0x24')]['split'](',');_0x30f058[_0x4d40('0x21')](_0x1f9577[0x0]);_0x30f058['push'](_0x1f9577[0x1]);_0x30f058[_0x4d40('0x21')](_0x1f9577[0x2]);_0x30f058[_0x4d40('0x21')](_0x1f9577[0x3]);_0x30f058[_0x4d40('0x21')](_0x1f9577[_0x4d40('0x22')](0x4,_0x1f9577['length'])['join'](','));break;case _0x4d40('0x27'):_0x30f058[_0x4d40('0x21')](_0x5230b4[_0x4d40('0x24')]);break;case _0x4d40('0x28'):_0x30f058['push'](_0x5230b4[_0x4d40('0x29')]);_0x30f058['push'](_0x5230b4[_0x4d40('0x24')]);break;case _0x4d40('0x2a'):var _0x4481f3=utils[_0x4d40('0x2b')](_0x20bc1b[_0x4d40('0x2c')][_0x4d40('0x2d')],_0x20bc1b);var _0x1d1ba9=_0x5230b4[_0x4d40('0x24')][_0x4d40('0x25')](',');_0x30f058[_0x4d40('0x21')](_0x1d1ba9[0x0]);_0x30f058['push'](_0x1d1ba9[0x1]);_0x30f058[_0x4d40('0x21')](_0x1d1ba9[0x2]);_0x30f058[_0x4d40('0x21')](_0x1d1ba9[0x3]);_0x30f058['push'](_0x1d1ba9[0x4]);_0x30f058['push'](_0x1d1ba9[0x5]);_0x30f058['push'](_0x1d1ba9[0x6]);_0x30f058[_0x4d40('0x21')](_0x1d1ba9[0x7]);_0x30f058[_0x4d40('0x21')](_0x1d1ba9[0x8]);_0x30f058['push'](_0x1d1ba9[0x9]);_0x30f058[_0x4d40('0x21')](_0x1d1ba9[0xa]);_0x30f058[_0x4d40('0x21')](_0x20bc1b[_0x4d40('0x16')]['id']);_0x30f058[_0x4d40('0x21')](_0x20bc1b[_0x4d40('0x27')]['id']);_0x30f058['push'](_0x5230b4[_0x4d40('0x2e')]);_0x30f058[_0x4d40('0x21')](_0x20bc1b['interaction']['ContactId']);_0x30f058[_0x4d40('0x21')](_0x20bc1b[_0x4d40('0x2f')]['body']);_0x30f058[_0x4d40('0x21')](_0x4481f3);break;default:_0x30f058=_[_0x4d40('0xe')](_0x5230b4['appdata'])?[]:_0x5230b4[_0x4d40('0x24')][_0x4d40('0x25')](',');}var _0x4c756c={'id':util[_0x4d40('0x30')](_0x4d40('0x31'),_0x43c902,_0x5230b4['id'],_0x5230b4['app']),'condition':require(_0x4d40('0x32'))['condition'](_0x43c902,getIntervals(_0x2083bd[_0x4d40('0x33')],_0x5230b4),_0x2083bd),'consequence':require(_0x4d40('0x34')+_0x5230b4[_0x4d40('0x1c')])[_0x4d40('0x35')](_0x43c902,_0x30f058,_0x2083bd,_0x20bc1b),'p':_0x5230b4[_0x4d40('0x36')]||0x0};logger[_0x4d40('0x37')](_0x4d40('0x38'),_0x4c756c['id'],_0x4d40('0x39'),getIntervals(_0x2083bd[_0x4d40('0x33')],_0x5230b4)['join'](_0x4d40('0x3a')));_0x10518e[_0x4d40('0x21')](_0x4c756c);}else{logger[_0x4d40('0x3b')](_0x4d40('0x3c'),path[_0x4d40('0x1b')](__dirname,'applications',_0x5230b4[_0x4d40('0x1c')]+'.js'));}}_0x2083bd[_0x4d40('0x14')][_0x43c902]=new RuleEngine(_0x10518e);_0x2083bd[_0x4d40('0x14')][_0x43c902][_0x4d40('0x3d')](_0x20bc1b,function(_0x41c21a){logger['info'](_0x4d40('0x3e'),JSON[_0x4d40('0x3f')](_0x41c21a['matchPath']));if(_0x2083bd[_0x4d40('0x14')][_0x43c902]){_0x2083bd['rules'][_0x43c902][_0x4d40('0x40')](_0x4d40('0x41'));}});return _0x453857({'code':0xc8,'message':_0x20bc1b});}else{logger[_0x4d40('0x37')](_0x4d40('0x42'));return _0x453857({'code':0xc8,'message':_0x20bc1b});}}catch(_0x4dc976){logger[_0x4d40('0x3b')](_0x4dc976['stack']);return _0x361a41(_0xcee25a[_0x4d40('0x3b')](0x1f4,_0x4dc976));}}return _0x361a41(_0x4d40('0x43'));});},'AcceptMessage':function(_0x794838){var _0x6a7772=this;return new Promise(function(_0x4de681,_0xb00a8e){if(_0x794838[_0x4d40('0x44')]&&_0x794838[_0x4d40('0x44')]['id']){if(_0x2083bd[_0x4d40('0x45')][_0x794838['agent']['id']]){_0x2083bd[_0x4d40('0x45')][_0x794838[_0x4d40('0x44')]['id']]['busy']=![];_0x2083bd[_0x4d40('0x45')][_0x794838['agent']['id']][_0x4d40('0x46')]=undefined;}}if(_0x794838[_0x4d40('0x27')]&&_0x794838[_0x4d40('0x27')]['id']){try{var _0x25fc5b=getId(_0x794838[_0x4d40('0x15')],_0x794838[_0x4d40('0x27')]?_0x794838[_0x4d40('0x27')]['id']:0x0,_0x794838[_0x4d40('0x16')]?_0x794838[_0x4d40('0x16')]['id']:0x0);if(_0x2083bd['rules'][_0x25fc5b]){_0x2083bd[_0x4d40('0x14')][_0x25fc5b][_0x4d40('0x40')](_0x4d40('0x47'));if(rpc[_0x794838[_0x4d40('0x15')]+_0x4d40('0x48')]){rpc[_0x794838['channel']+_0x4d40('0x48')][_0x4d40('0x49')](_0x25fc5b,{'UserId':_0x794838['message'][_0x4d40('0x4a')]})['catch'](function(_0x282945){logger[_0x4d40('0x3b')](_0x4d40('0x4b'));});}}return _0x4de681({'code':0xc8,'message':_0x794838});}catch(_0x53d73a){logger[_0x4d40('0x3b')](_0x53d73a[_0x4d40('0x4c')]);return _0xb00a8e(_0x6a7772[_0x4d40('0x3b')](0x1f4,_0x53d73a));}}logger[_0x4d40('0x3b')](_0x4d40('0x4d'));return _0xb00a8e(_0x6a7772['error'](0x1f4,_0x4d40('0x4d')));});},'RejectMessage':function(_0x14c6f8){var _0x5aef99=this;return new Promise(function(_0x1000f4,_0x584552){if(_0x14c6f8[_0x4d40('0x44')]&&_0x14c6f8['agent']['id']){try{if(_0x2083bd[_0x4d40('0x45')][_0x14c6f8[_0x4d40('0x44')]['id']]){_0x2083bd['agents'][_0x14c6f8[_0x4d40('0x44')]['id']][_0x4d40('0x4e')]=![];_0x2083bd[_0x4d40('0x45')][_0x14c6f8[_0x4d40('0x44')]['id']][_0x4d40('0x46')]=undefined;}return _0x1000f4({'code':0xc8,'message':_0x14c6f8});}catch(_0x1c54a2){logger[_0x4d40('0x3b')](_0x1c54a2[_0x4d40('0x4c')]);return _0x584552(_0x5aef99[_0x4d40('0x3b')](0x1f4,_0x1c54a2));}}logger[_0x4d40('0x3b')](_0x4d40('0x4d'));return _0x584552(_0x5aef99[_0x4d40('0x3b')](0x1f4,_0x4d40('0x4d')));});},'AbandonInteraction':function(_0x34e033){var _0x204b0b=this;return new Promise(function(_0x1471db,_0x3d4605){if(_0x34e033[_0x4d40('0x15')]&&_0x34e033[_0x4d40('0x16')]&&_0x34e033['interaction']['id']){try{var _0x8c4b62=getId(_0x34e033[_0x4d40('0x15')],_0x34e033['message']?_0x34e033['message']['id']:0x0,_0x34e033[_0x4d40('0x16')]?_0x34e033[_0x4d40('0x16')]['id']:0x0);if(_0x2083bd['rules'][_0x8c4b62]){_0x2083bd['rules'][_0x8c4b62][_0x4d40('0x40')]('end');}return _0x1471db({'code':0xc8,'message':_0x34e033});}catch(_0x13b343){logger['error'](_0x13b343[_0x4d40('0x4c')]);return _0x3d4605(_0x204b0b[_0x4d40('0x3b')](0x1f4,_0x13b343));}}logger[_0x4d40('0x3b')](_0x4d40('0x4d'));return _0x3d4605(_0x204b0b[_0x4d40('0x3b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x55fbb1){var _0x4e5b26=this;return new Promise(function(_0x259f9d,_0x323373){if(_0x2083bd[_0x4d40('0x45')][_0x4d40('0x4f')](_0x55fbb1['id'])){for(var _0x1a663a in _0x55fbb1['capacity']){if(_0x55fbb1[_0x4d40('0x50')]['hasOwnProperty'](_0x1a663a)){if(_0x2083bd[_0x4d40('0x45')][_0x55fbb1['id']][_0x4d40('0x4f')](_0x1a663a+_0x4d40('0x51'))){_0x2083bd[_0x4d40('0x45')][_0x55fbb1['id']][_0x1a663a+_0x4d40('0x51')]=parseInt(_0x55fbb1[_0x4d40('0x50')][_0x1a663a],0xa);}}}_0x2083bd['agents'][_0x55fbb1['id']]['updateRealtime']();return _0x259f9d({'code':0xc8,'message':_0x2083bd[_0x4d40('0x45')][_0x55fbb1['id']]});}else{return _0x323373(_0x4e5b26[_0x4d40('0x3b')](0x1f4,_0x4d40('0x52')));}});},'Agents':function(_0x42de89){return new Promise(function(_0x168663,_0x45775b){var _0x132543=_[_0x4d40('0x53')](_0x2083bd['agents']);_0x168663({'count':_0x132543[_0x4d40('0x19')],'rows':_0x132543});});},'ChatQueues':function(_0x50917a){return new Promise(function(_0x5aa05b,_0x512a11){var _0x37e643=[];for(var _0x3e5c28 in _0x2083bd[_0x4d40('0x54')]){if(_0x2083bd[_0x4d40('0x54')]['hasOwnProperty'](_0x3e5c28)){var _0x450c99=_0x2083bd[_0x4d40('0x54')][_0x3e5c28];var _0x1e1a6c={'id':_0x450c99['id'],'available':_0x450c99[_0x4d40('0x55')],'loggedIn':_0x450c99[_0x4d40('0x56')],'name':_0x450c99['name'],'paused':_0x450c99['paused'],'waiting':_0x450c99[_0x4d40('0x57')]};_0x37e643['push'](_0x1e1a6c);}}_0x5aa05b({'count':_0x37e643[_0x4d40('0x19')],'rows':_0x37e643});});},'MailQueues':function(_0x2d216d){return new Promise(function(_0x5547a3,_0x5233f6){var _0x5601b7=[];for(var _0x3ede3b in _0x2083bd['mailQueues']){if(_0x2083bd[_0x4d40('0x58')][_0x4d40('0x4f')](_0x3ede3b)){var _0x5e165e=_0x2083bd[_0x4d40('0x58')][_0x3ede3b];var _0x35b6c6={'id':_0x5e165e['id'],'available':_0x5e165e[_0x4d40('0x55')],'loggedIn':_0x5e165e[_0x4d40('0x56')],'name':_0x5e165e[_0x4d40('0x59')],'paused':_0x5e165e[_0x4d40('0x5a')],'waiting':_0x5e165e['waiting']};_0x5601b7['push'](_0x35b6c6);}}_0x5547a3({'count':_0x5601b7['length'],'rows':_0x5601b7});});},'OpenchannelQueues':function(_0x13872b){return new Promise(function(_0x358218,_0x37fd2b){var _0x542d06=[];for(var _0xcf9e5b in _0x2083bd[_0x4d40('0x5b')]){if(_0x2083bd['openchannelQueues']['hasOwnProperty'](_0xcf9e5b)){var _0x1e8a5f=_0x2083bd[_0x4d40('0x5b')][_0xcf9e5b];var _0x4db818={'id':_0x1e8a5f['id'],'available':_0x1e8a5f[_0x4d40('0x55')],'loggedIn':_0x1e8a5f[_0x4d40('0x56')],'name':_0x1e8a5f[_0x4d40('0x59')],'paused':_0x1e8a5f[_0x4d40('0x5a')],'waiting':_0x1e8a5f[_0x4d40('0x57')]};_0x542d06[_0x4d40('0x21')](_0x4db818);}}_0x358218({'count':_0x542d06['length'],'rows':_0x542d06});});},'SmsQueues':function(_0x32dc57){return new Promise(function(_0x589dad,_0x30a4e5){var _0x401fb4=[];for(var _0x49024c in _0x2083bd[_0x4d40('0x5c')]){if(_0x2083bd[_0x4d40('0x5c')]['hasOwnProperty'](_0x49024c)){var _0x3a66ce=_0x2083bd[_0x4d40('0x5c')][_0x49024c];var _0x4e0afc={'id':_0x3a66ce['id'],'available':_0x3a66ce[_0x4d40('0x55')],'loggedIn':_0x3a66ce[_0x4d40('0x56')],'name':_0x3a66ce[_0x4d40('0x59')],'paused':_0x3a66ce[_0x4d40('0x5a')],'waiting':_0x3a66ce[_0x4d40('0x57')]};_0x401fb4['push'](_0x4e0afc);}}_0x589dad({'count':_0x401fb4[_0x4d40('0x19')],'rows':_0x401fb4});});},'FaxQueues':function(_0x3221d4){return new Promise(function(_0xf8818a,_0x17a3fd){var _0x3be5eb=[];for(var _0x2e69d8 in _0x2083bd['faxQueues']){if(_0x2083bd[_0x4d40('0x5d')]['hasOwnProperty'](_0x2e69d8)){var _0x2856c4=_0x2083bd[_0x4d40('0x5d')][_0x2e69d8];var _0xfa06af={'id':_0x2856c4['id'],'available':_0x2856c4[_0x4d40('0x55')],'loggedIn':_0x2856c4[_0x4d40('0x56')],'name':_0x2856c4['name'],'paused':_0x2856c4[_0x4d40('0x5a')],'waiting':_0x2856c4[_0x4d40('0x57')]};_0x3be5eb[_0x4d40('0x21')](_0xfa06af);}}_0xf8818a({'count':_0x3be5eb[_0x4d40('0x19')],'rows':_0x3be5eb});});},'WhatsappQueues':function(_0x54a3e7){return new Promise(function(_0xc3698e,_0x1112ed){var _0x47662e=[];for(var _0x2b152 in _0x2083bd['whatsappQueues']){if(_0x2083bd[_0x4d40('0x5e')]['hasOwnProperty'](_0x2b152)){var _0xc3179f=_0x2083bd[_0x4d40('0x5e')][_0x2b152];var _0x2364fe={'id':_0xc3179f['id'],'available':_0xc3179f[_0x4d40('0x55')],'loggedIn':_0xc3179f['loggedIn'],'name':_0xc3179f['name'],'paused':_0xc3179f[_0x4d40('0x5a')],'waiting':_0xc3179f[_0x4d40('0x57')]};_0x47662e['push'](_0x2364fe);}}_0xc3698e({'count':_0x47662e[_0x4d40('0x19')],'rows':_0x47662e});});},'ChatQueuesWaitingInteractions':function(_0x13017c){return new Promise(function(_0x316ff3,_0x13ccf1){var _0xc86f9c=_['values'](_0x2083bd[_0x4d40('0x5f')]);_0x316ff3({'count':_0xc86f9c[_0x4d40('0x19')],'rows':_0xc86f9c});});},'MailQueuesWaitingInteractions':function(_0x2a03c0){return new Promise(function(_0x2de676,_0xe7d7cf){var _0x195fed=_[_0x4d40('0x53')](_0x2083bd[_0x4d40('0x60')]);_0x2de676({'count':_0x195fed[_0x4d40('0x19')],'rows':_0x195fed});});},'OpenchannelQueuesWaitingInteractions':function(_0x27085b){return new Promise(function(_0x3e3432,_0x4a370f){var _0x32d841=_[_0x4d40('0x53')](_0x2083bd['openchannelQueuesWaitingInteractions']);_0x3e3432({'count':_0x32d841[_0x4d40('0x19')],'rows':_0x32d841});});},'SmsQueuesWaitingInteractions':function(_0xbec312){return new Promise(function(_0x4e212d,_0x5224fc){var _0x33b8f3=_[_0x4d40('0x53')](_0x2083bd['smsQueuesWaitingInteractions']);_0x4e212d({'count':_0x33b8f3[_0x4d40('0x19')],'rows':_0x33b8f3});});},'FaxQueuesWaitingInteractions':function(_0x36603c){return new Promise(function(_0x4829fc,_0xe9889a){var _0x14f591=_['values'](_0x2083bd['faxQueuesWaitingInteractions']);_0x4829fc({'count':_0x14f591['length'],'rows':_0x14f591});});},'WhatsappQueuesWaitingInteractions':function(_0x5e5004){return new Promise(function(_0xc7ec7d,_0x51a113){var _0x4c898d=_[_0x4d40('0x53')](_0x2083bd[_0x4d40('0x61')]);_0xc7ec7d({'count':_0x4c898d[_0x4d40('0x19')],'rows':_0x4c898d});});}};var _0x2c8376=jayson[_0x4d40('0x62')](_0x4077ce)[_0x4d40('0x63')]();_0x2c8376['on'](_0x4d40('0x3b'),function(_0x5c5654){logger[_0x4d40('0x3b')](JSON[_0x4d40('0x3f')](_0x5c5654));return _0x23de7b(_0x5c5654);});_0x2c8376[_0x4d40('0x13')](0x232c,_0x4d40('0x64'),function(){console[_0x4d40('0x65')](_0x4d40('0x66'),0x232c);return _0x478cdd(_0x4d40('0x67')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 9381545..1607715 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 _0xc0a5=['[%s][INTERVAL]\x20%s\x20%s','join','stack','bluebird','jayson/promise','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','true','[%s][INTERVAL]\x20%s','some','\x20|\x20','when','log'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xc0a5,0xfd));var _0x5c0a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc0a5[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require('util');var BPromise=require(_0x5c0a('0x0'));var jayson=require(_0x5c0a('0x1'));var _=require('lodash');var logger=require('../../../config/logger')('routing');var client=jayson['client']['http']({'port':0x232a});function request(_0x50265b,_0x33d636){return new BPromise(function(_0x5cb9ef,_0xee7ce){return client[_0x5c0a('0x2')](_0x50265b,_0x33d636)[_0x5c0a('0x3')](function(_0x2117cd){if(_0x2117cd[_0x5c0a('0x4')]){return _0xee7ce(_0x2117cd[_0x5c0a('0x4')][_0x5c0a('0x5')]);}else{return _0x5cb9ef(_0x2117cd['result']);}})[_0x5c0a('0x6')](function(_0x5cd316){return _0xee7ce(_0x5cd316);});});}exports[_0x5c0a('0x7')]=function(_0x1ebb6e,_0x9dc1a7,_0x5036ba){return function(_0x3c855c){if(_0x5036ba[_0x5c0a('0x8')]&&!_0x5036ba[_0x5c0a('0x8')][_0x1ebb6e]){logger[_0x5c0a('0x9')](_0x5c0a('0xa'),_0x1ebb6e);return _0x3c855c[_0x5c0a('0xb')]();}var _0x345759=[];for(var _0xedef21=0x0;_0xedef21<_0x9dc1a7[_0x5c0a('0xc')];_0xedef21+=0x1){_0x345759[_0x5c0a('0xd')](request(_0x5c0a('0xe'),{'command':util[_0x5c0a('0xf')]('iftime\x20%s',_0x9dc1a7[_0xedef21])})['then'](function(_0x4e081b){return _0x4e081b&&_0x4e081b[_0x5c0a('0x5')]&&_0x4e081b[_0x5c0a('0x5')]['indexOf'](_0x5c0a('0x10'))>=0x0?!![]:![];})[_0x5c0a('0x6')](function(_0x7ae2cf){logger['error'](_0x5c0a('0x11'),_0x1ebb6e,_0x9dc1a7[_0xedef21]);}));}BPromise['all'](_0x345759)[_0x5c0a('0x3')](function(_0x456ff4){var _0xea32c8=_[_0x5c0a('0x12')](_0x456ff4);logger[_0x5c0a('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x1ebb6e,_0x9dc1a7['join'](_0x5c0a('0x13')),_0xea32c8);_0x3c855c[_0x5c0a('0x14')](_0xea32c8);})[_0x5c0a('0x6')](function(_0x24af0b){console[_0x5c0a('0x15')](_0x24af0b);logger['error'](_0x5c0a('0x16'),_0x1ebb6e,_0x9dc1a7[_0x5c0a('0x17')](_0x5c0a('0x13')),_0x24af0b[_0x5c0a('0x18')]);_0x3c855c[_0x5c0a('0xb')]();});};}; \ No newline at end of file +var _0xfc95=['iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','lodash','../../../config/logger','routing','http','request','then','error','result','catch','rules','info','stop','length','push','Command','format'];(function(_0x4099dc,_0x4be61e){var _0x53435d=function(_0x2e2bd1){while(--_0x2e2bd1){_0x4099dc['push'](_0x4099dc['shift']());}};_0x53435d(++_0x4be61e);}(_0xfc95,0xa3));var _0x5fc9=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xfc95[_0x29d94e];return _0x106237;};'use strict';var util=require(_0x5fc9('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x5fc9('0x1'));var logger=require(_0x5fc9('0x2'))(_0x5fc9('0x3'));var client=jayson['client'][_0x5fc9('0x4')]({'port':0x232a});function request(_0x50cf22,_0x4612b4){return new BPromise(function(_0x2439d6,_0x27727c){return client[_0x5fc9('0x5')](_0x50cf22,_0x4612b4)[_0x5fc9('0x6')](function(_0x3704ad){if(_0x3704ad[_0x5fc9('0x7')]){return _0x27727c(_0x3704ad[_0x5fc9('0x7')]['message']);}else{return _0x2439d6(_0x3704ad[_0x5fc9('0x8')]);}})[_0x5fc9('0x9')](function(_0x3bc215){return _0x27727c(_0x3bc215);});});}exports['condition']=function(_0x49c2ca,_0x50431f,_0x10dc24){return function(_0x4bc990){if(_0x10dc24[_0x5fc9('0xa')]&&!_0x10dc24[_0x5fc9('0xa')][_0x49c2ca]){logger[_0x5fc9('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x49c2ca);return _0x4bc990[_0x5fc9('0xc')]();}var _0x4a75f6=[];for(var _0x460839=0x0;_0x460839<_0x50431f[_0x5fc9('0xd')];_0x460839+=0x1){_0x4a75f6[_0x5fc9('0xe')](request(_0x5fc9('0xf'),{'command':util[_0x5fc9('0x10')](_0x5fc9('0x11'),_0x50431f[_0x460839])})[_0x5fc9('0x6')](function(_0x18f58c){return _0x18f58c&&_0x18f58c[_0x5fc9('0x12')]&&_0x18f58c['message'][_0x5fc9('0x13')](_0x5fc9('0x14'))>=0x0?!![]:![];})[_0x5fc9('0x9')](function(_0x26eb51){logger[_0x5fc9('0x7')](_0x5fc9('0x15'),_0x49c2ca,_0x50431f[_0x460839]);}));}BPromise[_0x5fc9('0x16')](_0x4a75f6)[_0x5fc9('0x6')](function(_0x1fe910){var _0x285c62=_[_0x5fc9('0x17')](_0x1fe910);logger[_0x5fc9('0xb')]('[%s][INTERVAL]\x20%s\x20%s',_0x49c2ca,_0x50431f[_0x5fc9('0x18')](_0x5fc9('0x19')),_0x285c62);_0x4bc990[_0x5fc9('0x1a')](_0x285c62);})[_0x5fc9('0x9')](function(_0x206e90){console[_0x5fc9('0x1b')](_0x206e90);logger['error'](_0x5fc9('0x1c'),_0x49c2ca,_0x50431f[_0x5fc9('0x18')](_0x5fc9('0x19')),_0x206e90[_0x5fc9('0x1d')]);_0x4bc990[_0x5fc9('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 02daf61..bea5737 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 _0xf290=['now','connectedlinename','error','agentringnoanswer','timeout','reason','holdtime','push','[%s][agents][agentringnoanswer]','includes','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','[%s][agents][hangup]','rejected','indexOf','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x131a8,_0x33d2fe){var _0x5022f8=function(_0x32f617){while(--_0x32f617){_0x131a8['push'](_0x131a8['shift']());}};_0x5022f8(++_0x33d2fe);}(_0xf290,0xde));var _0x0f29=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xf290[_0x59e821];return _0x5333f6;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d35f0,_0x4b16e4){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x3'),_0x1d35f0[_0x0f29('0x4')],_0x1d35f0[_0x0f29('0x5')],_0x1d35f0['queue'],_0x1d35f0[_0x0f29('0x6')],_0x1d35f0['interface'],_0x1d35f0[_0x0f29('0x7')],_0x1d35f0[_0x0f29('0x8')],_0x1d35f0[_0x0f29('0x9')]));if(_0x1d35f0[_0x0f29('0xa')]){utils[_0x0f29('0xb')](_0x1d35f0[_0x0f29('0xa')])[_0x0f29('0xc')](function(_0x3c6a6e){if(_0x3c6a6e){_0x1d35f0[_0x0f29('0xd')]=_0x3c6a6e[_0x0f29('0xd')];_0x1d35f0[_0x0f29('0xe')]=_0x1d35f0[_0x0f29('0xf')]?_0x3c6a6e[_0x0f29('0x10')]:![];_0x1d35f0[_0x0f29('0x11')]=_0x1d35f0[_0x0f29('0xe')]?_0x3c6a6e['acwTimeout']:0x0;}utils[_0x0f29('0x12')]('CreateVoiceAgentReport',_0x1d35f0);});}else{utils[_0x0f29('0x12')](_0x0f29('0x13'),_0x1d35f0);}if(_0x4b16e4){delete transfers[_0x1d35f0[_0x0f29('0x4')]];}else{delete agents[_0x1d35f0[_0x0f29('0x14')]];}}exports[_0x0f29('0x15')]=function(_0x2d2573){try{utils['debug'](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x2d2573);agents[_0x2d2573[_0x0f29('0x14')]]=_0x2d2573;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();agents[_0x2d2573[_0x0f29('0x14')]]['lastevent']='called';agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x8')]=null;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x19')]=null;utils['info'](util[_0x0f29('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2d2573[_0x0f29('0x4')],agents[_0x2d2573['destuniqueid']]['membername'],_0x2d2573['destuniqueid']));}catch(_0x23a44f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x23a44f);}};exports[_0x0f29('0x1b')]=function(_0x150271){try{if(!_['isNil'](agents[_0x150271[_0x0f29('0x14')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x150271['uniqueid']),_0x150271);utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x150271[_0x0f29('0x4')],agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x6')],_0x150271[_0x0f29('0x14')]));agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswer']=!![];agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswerAt']=utils[_0x0f29('0x18')]();agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x1c');agents[_0x150271['destuniqueid']][_0x0f29('0x1d')]='timeout';agents[_0x150271['destuniqueid']][_0x0f29('0x1e')]=_0x150271['ringtime']?parseInt(_0x150271['ringtime'])/0x3e8:0x0;agents[_0x150271['destuniqueid']]['talktime']=0x0;unanswered[_0x0f29('0x1f')](_0x150271[_0x0f29('0x14')]);}}catch(_0x4cc5a0){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x20'),_0x150271['uniqueid']),_0x4cc5a0);}};exports['queuecallerabandon']=function(_0x37ebcc){try{_['forIn'](agents,function(_0x36b65c,_0x561c31){if(_0x36b65c['uniqueid']==_0x37ebcc[_0x0f29('0x4')]&&!_[_0x0f29('0x21')](unanswered,_0x36b65c[_0x0f29('0x14')])){utils[_0x0f29('0x22')](util['format']('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x37ebcc);utils['info'](util['format'](_0x0f29('0x23'),_0x37ebcc['uniqueid'],_0x36b65c[_0x0f29('0x6')],_0x36b65c['destuniqueid']));_0x36b65c['agentringnoanswer']=!![];_0x36b65c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x36b65c[_0x0f29('0x9')]=_0x0f29('0x25');_0x36b65c[_0x0f29('0x1d')]='abandoned';_0x36b65c[_0x0f29('0x1e')]=_0x37ebcc['holdtime'];_0x36b65c[_0x0f29('0x26')]=0x0;writeDB(_0x36b65c);}});}catch(_0x3e8f3f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')]('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x3e8f3f);}};exports[_0x0f29('0x27')]=function(_0x5be4fa){try{if(agents[_0x5be4fa[_0x0f29('0x14')]]){utils[_0x0f29('0x22')](util['format']('[%s][agents][agentconnect]',_0x5be4fa[_0x0f29('0x4')]),_0x5be4fa);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x28'),_0x5be4fa[_0x0f29('0x4')],agents[_0x5be4fa[_0x0f29('0x14')]]['membername'],_0x5be4fa[_0x0f29('0x14')]));agents[_0x5be4fa['destuniqueid']][_0x0f29('0x29')]=utils['now']();agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x8')]=_0x5be4fa[_0x0f29('0x8')];agents[_0x5be4fa['destuniqueid']]['connectedlinename']=_0x5be4fa[_0x0f29('0x19')];agents[_0x5be4fa['destuniqueid']][_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x2b');_['forIn'](agents,function(_0x13c05c,_0xf77c66){if(_0x13c05c[_0x0f29('0x14')]!=_0x5be4fa[_0x0f29('0x14')]&&_0x13c05c[_0x0f29('0x4')]==_0x5be4fa[_0x0f29('0x4')]){_0x13c05c[_0x0f29('0x26')]=0x0;_0x13c05c[_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];_0x13c05c['agentringnoanswer']=!![];_0x13c05c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x13c05c[_0x0f29('0x9')]=_0x0f29('0x2c');_0x13c05c['reason']=_0x0f29('0x2c');_0x13c05c[_0x0f29('0x2d')]=_0x5be4fa[_0x0f29('0x14')];_0x13c05c[_0x0f29('0x2e')]=_0x5be4fa[_0x0f29('0x6')];writeDB(_0x13c05c);}});}}catch(_0x56062d){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x2f'),_0x5be4fa['uniqueid']),_0x56062d);}};exports[_0x0f29('0xf')]=function(_0x284279){try{if(!_[_0x0f29('0x30')](agents[_0x284279[_0x0f29('0x14')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x284279);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x284279[_0x0f29('0x4')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x6')],_0x284279[_0x0f29('0x14')]));agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0xf')]=!![];agents[_0x284279['destuniqueid']][_0x0f29('0x32')]=utils['now']();agents[_0x284279[_0x0f29('0x14')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x32')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x29')]);agents[_0x284279['destuniqueid']][_0x0f29('0x1d')]=_0x284279[_0x0f29('0x1d')];agents[_0x284279[_0x0f29('0x14')]]['lastevent']=_0x0f29('0x34');writeDB(agents[_0x284279['destuniqueid']]);}}catch(_0x4fd625){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x4fd625);}};exports[_0x0f29('0x35')]=function(_0x335435){try{if(!_['isNil'](agents[_0x335435[_0x0f29('0x36')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x335435);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x38'),_0x335435[_0x0f29('0x4')],agents[_0x335435[_0x0f29('0x36')]]['membername'],agents[_0x335435['transfereruniqueid']][_0x0f29('0x4')]));agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x39')]=!![];agents[_0x335435[_0x0f29('0x36')]]['transfertype']=_0x0f29('0x3a');agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3b')]=_0x335435[_0x0f29('0x3c')];agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3d')]=agents[_0x335435[_0x0f29('0x36')]]['uniqueid'];}}catch(_0x17f33){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x17f33);}};exports[_0x0f29('0x3e')]=function(_0x5ec172){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x3f'),_0x5ec172['origtransfereruniqueid']),_0x5ec172);if(_0x5ec172[_0x0f29('0x40')]==_0x5ec172['origtransfererlinkedid']){if(!_[_0x0f29('0x30')](agents[_0x5ec172['secondtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x41')]][_0x0f29('0x6')]));agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x42')]=_0x0f29('0x43');agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x44')];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3d')]=_0x5ec172['origtransfereruniqueid'];}if(_0x5ec172[_0x0f29('0x45')]&&agents[_0x5ec172['transfereeuniqueid']]){agents[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x46')]=0x1;transfers[_0x5ec172[_0x0f29('0x45')]]=_['clone'](agents[_0x5ec172[_0x0f29('0x45')]]);transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x7')]=agents[_0x5ec172[_0x0f29('0x41')]]['calleridnum'];transfers[_0x5ec172[_0x0f29('0x45')]]['calleridname']=agents[_0x5ec172[_0x0f29('0x41')]]['calleridname'];transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x45')]]['agententerreason']=0x2;}}else if(_0x5ec172[_0x0f29('0x41')]==_0x5ec172[_0x0f29('0x47')]){if(!_[_0x0f29('0x30')](agents[_0x5ec172['origtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x48'),_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x40')]]['membername']));agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x42')]='ATTENDED';agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x49')];agents[_0x5ec172[_0x0f29('0x40')]]['transferuniqueid']=_0x5ec172['secondtransfereruniqueid'];}if(_0x5ec172['transfertargetuniqueid']&&agents[_0x5ec172[_0x0f29('0x4a')]]){agents[_0x5ec172[_0x0f29('0x4a')]]['agententerreason']=0x1;transfers[_0x5ec172[_0x0f29('0x4a')]]=_[_0x0f29('0x4b')](agents[_0x5ec172['transfertargetuniqueid']]);transfers[_0x5ec172[_0x0f29('0x4a')]]['calleridnum']=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x7')];transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x4c')]=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x4c')];transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x4a')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x46')]=0x2;}}}catch(_0x4bbc7e){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x3f'),_0x5ec172[_0x0f29('0x40')]),_0x4bbc7e);}};exports[_0x0f29('0x4d')]=function(_0x4bd8f1){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x4e'),_0x4bd8f1[_0x0f29('0x4')]),_0x4bd8f1);if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1[_0x0f29('0x4')]]['reason']===_0x0f29('0x1c')){if(_0x4bd8f1['cause']==='21'){agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')]=_0x0f29('0x4f');agents[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]=_0x0f29('0x4f');}utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1['uniqueid'],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']]['reason'],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);var _0x473eac=unanswered[_0x0f29('0x50')](_0x4bd8f1[_0x0f29('0x4')]);if(_0x473eac>-0x1){unanswered['splice'](_0x473eac,0x1);}}if(transfers[_0x4bd8f1[_0x0f29('0x4')]]){transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0xf')]=!![];transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')]=utils['now']();transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x26')]=utils[_0x0f29('0x33')](transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x29')]);transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=_0x0f29('0x51');transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],transfers[_0x4bd8f1[_0x0f29('0x4')]]['reason'],transfers[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]));writeDB(transfers[_0x4bd8f1[_0x0f29('0x4')]],!![]);}if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1['uniqueid']][_0x0f29('0x29')]){agents[_0x4bd8f1['uniqueid']][_0x0f29('0xf')]=!![];agents[_0x4bd8f1['uniqueid']][_0x0f29('0x32')]=utils[_0x0f29('0x18')]();agents[_0x4bd8f1[_0x0f29('0x4')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x4bd8f1['uniqueid']]['agentcompleteAt'],agents[_0x4bd8f1[_0x0f29('0x4')]]['agentconnectAt']);agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=agents[_0x4bd8f1['uniqueid']][_0x0f29('0x39')]?_0x0f29('0x39'):_0x0f29('0x51');agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);}}catch(_0x5e39a7){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x4e'),_0x4bd8f1['uniqueid']),_0x5e39a7);}}; \ No newline at end of file +var _0x153f=['type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','info','format','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x153f,0x15b));var _0xf153=function(_0x3b0f62,_0x5e7aea){_0x3b0f62=_0x3b0f62-0x0;var _0x1209fc=_0x153f[_0x3b0f62];return _0x1209fc;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var utils=require(_0xf153('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44cea3,_0x2afb9a){utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x44cea3[_0xf153('0x5')],_0x44cea3['channel'],_0x44cea3[_0xf153('0x6')],_0x44cea3[_0xf153('0x7')],_0x44cea3[_0xf153('0x8')],_0x44cea3[_0xf153('0x9')],_0x44cea3[_0xf153('0xa')],_0x44cea3['lastevent']));if(_0x44cea3[_0xf153('0x6')]){utils[_0xf153('0xb')](_0x44cea3[_0xf153('0x6')])[_0xf153('0xc')](function(_0x253fd3){if(_0x253fd3){_0x44cea3[_0xf153('0xd')]=_0x253fd3[_0xf153('0xd')];_0x44cea3[_0xf153('0xe')]=_0x44cea3[_0xf153('0xf')]?_0x253fd3[_0xf153('0x10')]:![];_0x44cea3['acwtime']=_0x44cea3[_0xf153('0xe')]?_0x253fd3[_0xf153('0x11')]:0x0;}utils[_0xf153('0x12')]('CreateVoiceAgentReport',_0x44cea3);});}else{utils[_0xf153('0x12')](_0xf153('0x13'),_0x44cea3);}if(_0x2afb9a){delete transfers[_0x44cea3[_0xf153('0x5')]];}else{delete agents[_0x44cea3[_0xf153('0x14')]];}}exports[_0xf153('0x15')]=function(_0x107d31){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31['uniqueid']),_0x107d31);agents[_0x107d31[_0xf153('0x14')]]=_0x107d31;agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x18')]=utils[_0xf153('0x19')]();agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x1b');agents[_0x107d31[_0xf153('0x14')]]['connectedlinenum']=null;agents[_0x107d31[_0xf153('0x14')]]['connectedlinename']=null;utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x1c'),_0x107d31[_0xf153('0x5')],agents[_0x107d31['destuniqueid']][_0xf153('0x7')],_0x107d31[_0xf153('0x14')]));}catch(_0x41946a){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31[_0xf153('0x5')]),_0x41946a);}};exports[_0xf153('0x1e')]=function(_0x3735a7){try{if(!_[_0xf153('0x1f')](agents[_0x3735a7[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x3735a7);utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x21'),_0x3735a7[_0xf153('0x5')],agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x7')],_0x3735a7[_0xf153('0x14')]));agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1e')]=!![];agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x22')]=utils[_0xf153('0x19')]();agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x23');agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x24')]=_0xf153('0x23');agents[_0x3735a7['destuniqueid']][_0xf153('0x25')]=_0x3735a7[_0xf153('0x26')]?parseInt(_0x3735a7['ringtime'])/0x3e8:0x0;agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x27')]=0x0;unanswered['push'](_0x3735a7[_0xf153('0x14')]);}}catch(_0x10295e){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x10295e);}};exports[_0xf153('0x28')]=function(_0x3b5f4f){try{_[_0xf153('0x29')](agents,function(_0x8e31bf,_0x13b541){if(_0x8e31bf[_0xf153('0x5')]==_0x3b5f4f['uniqueid']&&!_[_0xf153('0x2a')](unanswered,_0x8e31bf[_0xf153('0x14')])){utils[_0xf153('0x16')](util[_0xf153('0x4')]('[%s][agents][queuecallerabandon]',_0x3b5f4f['uniqueid']),_0x3b5f4f);utils[_0xf153('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3b5f4f[_0xf153('0x5')],_0x8e31bf['membername'],_0x8e31bf[_0xf153('0x14')]));_0x8e31bf['agentringnoanswer']=!![];_0x8e31bf[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x8e31bf['lastevent']=_0xf153('0x2b');_0x8e31bf[_0xf153('0x24')]=_0xf153('0x2b');_0x8e31bf[_0xf153('0x25')]=_0x3b5f4f[_0xf153('0x25')];_0x8e31bf[_0xf153('0x27')]=0x0;writeDB(_0x8e31bf);}});}catch(_0x4ab69c){utils[_0xf153('0x1d')](util['format'](_0xf153('0x2c'),_0x3b5f4f[_0xf153('0x5')]),_0x4ab69c);}};exports[_0xf153('0x2d')]=function(_0x1820c3){try{if(agents[_0x1820c3[_0xf153('0x14')]]){utils[_0xf153('0x16')](util['format'](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1820c3);utils[_0xf153('0x3')](util['format'](_0xf153('0x2f'),_0x1820c3[_0xf153('0x5')],agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x7')],_0x1820c3[_0xf153('0x14')]));agents[_0x1820c3[_0xf153('0x14')]]['agentconnectAt']=utils[_0xf153('0x19')]();agents[_0x1820c3[_0xf153('0x14')]]['connectedlinenum']=_0x1820c3[_0xf153('0xa')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x30')]=_0x1820c3[_0xf153('0x30')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];agents[_0x1820c3['destuniqueid']][_0xf153('0x1a')]=_0xf153('0x31');_[_0xf153('0x29')](agents,function(_0x352e7c,_0x25657a){if(_0x352e7c[_0xf153('0x14')]!=_0x1820c3['destuniqueid']&&_0x352e7c['uniqueid']==_0x1820c3[_0xf153('0x5')]){_0x352e7c['talktime']=0x0;_0x352e7c[_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];_0x352e7c[_0xf153('0x1e')]=!![];_0x352e7c[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x352e7c[_0xf153('0x1a')]='answered_elsewhere';_0x352e7c['reason']=_0xf153('0x32');_0x352e7c[_0xf153('0x33')]=_0x1820c3['destuniqueid'];_0x352e7c[_0xf153('0x34')]=_0x1820c3[_0xf153('0x7')];writeDB(_0x352e7c);}});}}catch(_0x1edf65){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1edf65);}};exports[_0xf153('0xf')]=function(_0x1b453f){try{if(!_[_0xf153('0x1f')](agents[_0x1b453f[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x1b453f);utils[_0xf153('0x3')](util['format'](_0xf153('0x36'),_0x1b453f[_0xf153('0x5')],agents[_0x1b453f['destuniqueid']][_0xf153('0x7')],_0x1b453f['destuniqueid']));agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0xf')]=!![];agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt']=utils[_0xf153('0x19')]();agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt'],agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x38')]);agents[_0x1b453f['destuniqueid']][_0xf153('0x24')]=_0x1b453f[_0xf153('0x24')];agents[_0x1b453f[_0xf153('0x14')]]['lastevent']=_0xf153('0x39');writeDB(agents[_0x1b453f[_0xf153('0x14')]]);}}catch(_0x82dc34){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x82dc34);}};exports[_0xf153('0x3a')]=function(_0x3b91ed){try{if(!_['isNil'](agents[_0x3b91ed[_0xf153('0x3b')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x3b91ed[_0xf153('0x5')]),_0x3b91ed);utils[_0xf153('0x3')](util['format'](_0xf153('0x3c'),_0x3b91ed[_0xf153('0x5')],agents[_0x3b91ed['transfereruniqueid']][_0xf153('0x7')],agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')]));agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3d')]=!![];agents[_0x3b91ed[_0xf153('0x3b')]]['transfertype']=_0xf153('0x3e');agents[_0x3b91ed[_0xf153('0x3b')]]['transferexten']=_0x3b91ed['extension'];agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3f')]=agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')];}}catch(_0x419e7e){utils[_0xf153('0x1d')](util['format'](_0xf153('0x40'),_0x3b91ed['uniqueid']),_0x419e7e);}};exports[_0xf153('0x41')]=function(_0x365209){try{utils[_0xf153('0x16')](util['format'](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x365209);if(_0x365209[_0xf153('0x43')]==_0x365209[_0xf153('0x44')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x45')]])){utils[_0xf153('0x3')](util['format'](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209[_0xf153('0x45')]]['membername']));agents[_0x365209[_0xf153('0x45')]][_0xf153('0x3d')]=!![];agents[_0x365209[_0xf153('0x45')]][_0xf153('0x47')]=_0xf153('0x48');agents[_0x365209[_0xf153('0x45')]][_0xf153('0x49')]=_0x365209[_0xf153('0x4a')];agents[_0x365209['secondtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x43')];}if(_0x365209['transfereeuniqueid']&&agents[_0x365209[_0xf153('0x4b')]]){agents[_0x365209[_0xf153('0x4b')]][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x4b')]]=_[_0xf153('0x4d')](agents[_0x365209[_0xf153('0x4b')]]);transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x9')];transfers[_0x365209[_0xf153('0x4b')]]['calleridname']=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x4e')];transfers[_0x365209['transfereeuniqueid']][_0xf153('0x18')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x38')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x25')]=0x0;transfers[_0x365209['transfereeuniqueid']][_0xf153('0x4c')]=0x2;}}else if(_0x365209[_0xf153('0x45')]==_0x365209[_0xf153('0x4f')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x43')]])){utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209['origtransfereruniqueid']][_0xf153('0x7')]));agents[_0x365209[_0xf153('0x43')]]['transfer']=!![];agents[_0x365209[_0xf153('0x43')]]['transfertype']=_0xf153('0x48');agents[_0x365209[_0xf153('0x43')]]['transferexten']=_0x365209[_0xf153('0x50')];agents[_0x365209['origtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x45')];}if(_0x365209[_0xf153('0x51')]&&agents[_0x365209[_0xf153('0x51')]]){agents[_0x365209['transfertargetuniqueid']][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x51')]]=_['clone'](agents[_0x365209[_0xf153('0x51')]]);transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x43')]][_0xf153('0x9')];transfers[_0x365209['transfertargetuniqueid']][_0xf153('0x4e')]=agents[_0x365209['origtransfereruniqueid']][_0xf153('0x4e')];transfers[_0x365209[_0xf153('0x51')]]['agentcalledAt']=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x38')]=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x25')]=0x0;transfers[_0x365209[_0xf153('0x51')]]['agententerreason']=0x2;}}}catch(_0x671efe){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x671efe);}};exports[_0xf153('0x52')]=function(_0x37443f){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x53'),_0x37443f[_0xf153('0x5')]),_0x37443f);if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]===_0xf153('0x23')){if(_0x37443f[_0xf153('0x54')]==='21'){agents[_0x37443f['uniqueid']][_0xf153('0x24')]='rejected';agents[_0x37443f['uniqueid']][_0xf153('0x1a')]='rejected';}utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(agents[_0x37443f['uniqueid']]);var _0x59e22d=unanswered[_0xf153('0x56')](_0x37443f[_0xf153('0x5')]);if(_0x59e22d>-0x1){unanswered[_0xf153('0x57')](_0x59e22d,0x1);}}if(transfers[_0x37443f['uniqueid']]){transfers[_0x37443f[_0xf153('0x5')]]['agentcomplete']=!![];transfers[_0x37443f['uniqueid']][_0xf153('0x58')]=utils[_0xf153('0x19')]();transfers[_0x37443f[_0xf153('0x5')]]['talktime']=utils[_0xf153('0x37')](transfers[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x38')]);transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]=_0xf153('0x59');transfers[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],transfers[_0x37443f[_0xf153('0x5')]]['membername'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(transfers[_0x37443f[_0xf153('0x5')]],!![]);}if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f['uniqueid']][_0xf153('0x38')]){agents[_0x37443f[_0xf153('0x5')]][_0xf153('0xf')]=!![];agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x58')]=utils[_0xf153('0x19')]();agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],agents[_0x37443f['uniqueid']]['agentconnectAt']);agents[_0x37443f['uniqueid']][_0xf153('0x24')]=agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x3d')]?_0xf153('0x3d'):_0xf153('0x59');agents[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f['uniqueid']][_0xf153('0x1a')]));writeDB(agents[_0x37443f[_0xf153('0x5')]]);}}catch(_0x2651ff){utils['error'](util['format']('[%s][agents][hangup]',_0x37443f[_0xf153('0x5')]),_0x2651ff);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 783f2ce..f81fe02 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 _0x02fe=['lastIndexOf','includes','execif','gotoif','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','xmd-originatecalleridnum','value','source','xmd-phone','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr','split'];(function(_0x4c4d6f,_0x5d7351){var _0x7e219a=function(_0x39a45a){while(--_0x39a45a){_0x4c4d6f['push'](_0x4c4d6f['shift']());}};_0x7e219a(++_0x5d7351);}(_0x02fe,0x1b8));var _0xe02f=function(_0x3443b5,_0xcabca9){_0x3443b5=_0x3443b5-0x0;var _0x4178e1=_0x02fe[_0x3443b5];return _0x4178e1;};'use strict';var _=require('lodash');var util=require(_0xe02f('0x0'));var utils=require(_0xe02f('0x1'));var transfers=require(_0xe02f('0x2'));var dispositions=[_0xe02f('0x3'),_0xe02f('0x4'),_0xe02f('0x4'),_0xe02f('0x3'),_0xe02f('0x3'),_0xe02f('0x3'),_0xe02f('0x5'),_0xe02f('0x6'),_0xe02f('0x4'),_0xe02f('0x4'),_0xe02f('0x4')];var channels={};function writeDB(_0x1106a4){var _0x45f434;if(transfers['blinds'][_0x1106a4[_0xe02f('0x7')]]){_0x45f434=_0x1106a4['uniqueid'];_0x1106a4[_0xe02f('0x7')]=transfers[_0xe02f('0x8')][_0x1106a4[_0xe02f('0x7')]][_0xe02f('0x9')];}utils['info'](util[_0xe02f('0xa')](_0xe02f('0xb'),_0x1106a4[_0xe02f('0x7')],_0x1106a4[_0xe02f('0xc')],_0x1106a4[_0xe02f('0xd')],_0x1106a4[_0xe02f('0xe')],_0x1106a4['interface'],_0x1106a4[_0xe02f('0xf')],_0x1106a4[_0xe02f('0x10')],_0x1106a4[_0xe02f('0x11')]));if(_0x1106a4[_0xe02f('0x12')]){utils[_0xe02f('0x13')](_0x1106a4['accountcode'])['then'](function(_0x2ef418){if(_0x2ef418){_0x1106a4[_0xe02f('0x14')]=_0x2ef418['id'];}utils[_0xe02f('0x15')]('CreateVoiceCallReport',_0x1106a4);});}else{utils['request'](_0xe02f('0x16'),_0x1106a4);}if(channels[_0x1106a4[_0xe02f('0x7')]]){delete channels[_0x1106a4['uniqueid']];}else if(_0x45f434&&channels[_0x45f434]){if(!transfers['blinds'][_0x45f434]['recording'])delete transfers[_0xe02f('0x8')][_0x45f434];delete channels[_0x45f434];}}exports[_0xe02f('0x17')]=function(_0x4c5ed0){try{utils[_0xe02f('0x18')](util['format'](_0xe02f('0x19'),_0x4c5ed0[_0xe02f('0x7')]),_0x4c5ed0);if(_0x4c5ed0[_0xe02f('0x7')]==_0x4c5ed0[_0xe02f('0x1a')]&&_0x4c5ed0['channel']!='OutgoingSpoolFailed'){utils[_0xe02f('0x1b')](util['format'](_0xe02f('0x1c'),_0x4c5ed0[_0xe02f('0x7')],_0x4c5ed0[_0xe02f('0x1d')],_0x4c5ed0[_0xe02f('0x1e')]));channels[_0x4c5ed0[_0xe02f('0x7')]]={'uniqueid':_0x4c5ed0[_0xe02f('0x7')],'accountcode':_0x4c5ed0[_0xe02f('0x12')],'source':_0x4c5ed0['calleridnum'],'destination':_0x4c5ed0['exten'],'destinationcontext':_0x4c5ed0[_0xe02f('0x1d')],'channel':_0x4c5ed0[_0xe02f('0xc')],'starttime':utils[_0xe02f('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe02f('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x371412){utils[_0xe02f('0x20')](util['format'](_0xe02f('0x19'),_0x4c5ed0[_0xe02f('0x7')]),_0x371412);}};exports[_0xe02f('0x21')]=function(_0x376de8){try{utils[_0xe02f('0x18')](util['format'](_0xe02f('0x22'),_0x376de8['uniqueid']),_0x376de8);if(!_[_0xe02f('0x23')](channels[_0x376de8['uniqueid']])&&_0x376de8[_0xe02f('0x24')]==0x6){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x25'),_0x376de8[_0xe02f('0x7')],_0x376de8[_0xe02f('0x1d')],_0x376de8[_0xe02f('0xc')]));if(_[_0xe02f('0x23')](channels[_0x376de8[_0xe02f('0x7')]][_0xe02f('0x26')])){channels[_0x376de8['uniqueid']][_0xe02f('0x26')]=utils[_0xe02f('0x1f')]();}}else if(!_[_0xe02f('0x23')](channels[_0x376de8[_0xe02f('0x1a')]])&&_0x376de8[_0xe02f('0x24')]==0x6&&_0x376de8[_0xe02f('0x1d')]!=_0xe02f('0x27')){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x28'),_0x376de8['uniqueid'],_0x376de8['linkedid'],_0x376de8[_0xe02f('0x1d')],_0x376de8[_0xe02f('0xc')]));channels[_0x376de8[_0xe02f('0x1a')]][_0xe02f('0x12')]=_0x376de8['accountcode'];channels[_0x376de8[_0xe02f('0x1a')]][_0xe02f('0x29')]=_0x376de8['channel'];if(_['isNil'](channels[_0x376de8[_0xe02f('0x1a')]][_0xe02f('0x2a')])){channels[_0x376de8[_0xe02f('0x1a')]]['answertime']=utils[_0xe02f('0x1f')]();}channels[_0x376de8[_0xe02f('0x1a')]][_0xe02f('0x2b')]=dispositions[_['toNumber'](_0x376de8[_0xe02f('0x24')])]||_0xe02f('0x5');}}catch(_0x5aafde){utils[_0xe02f('0x20')](util[_0xe02f('0xa')]('[%s][calls][newstate]',_0x376de8[_0xe02f('0x7')]),_0x5aafde);}};exports['hangup']=function(_0x4acd22){try{if(!_[_0xe02f('0x23')](channels[_0x4acd22['uniqueid']])){utils[_0xe02f('0x18')](util['format'](_0xe02f('0x2c'),_0x4acd22[_0xe02f('0x7')]),_0x4acd22);if(_['isNil'](channels[_0x4acd22['uniqueid']][_0xe02f('0x2d')])){channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x2d')]=_0x4acd22[_0xe02f('0x2e')]+'\x20<'+_0x4acd22[_0xe02f('0xf')]+'>';}utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x2f'),_0x4acd22[_0xe02f('0x7')],channels[_0x4acd22[_0xe02f('0x7')]]['callerid'],_0x4acd22[_0xe02f('0x30')]));channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x31')]=utils[_0xe02f('0x1f')]();channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x32')]=utils['diffTime'](channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x31')],channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x33')]);channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x34')]=channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x2a')]?utils[_0xe02f('0x35')](channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x31')],channels[_0x4acd22['uniqueid']]['answertime']):0x0;writeDB(channels[_0x4acd22[_0xe02f('0x7')]]);}}catch(_0x5e2b14){utils['error'](util[_0xe02f('0xa')](_0xe02f('0x2c'),_0x4acd22[_0xe02f('0x7')]),_0x5e2b14);}};exports[_0xe02f('0x36')]=function(_0x8ea357){try{if(!_[_0xe02f('0x23')](channels[_0x8ea357['localtwolinkedid']])){utils['debug'](util['format'](_0xe02f('0x37'),_0x8ea357['origtransfereruniqueid']),_0x8ea357);if(channels[_0x8ea357[_0xe02f('0x38')]][_0xe02f('0xc')]==_0x8ea357[_0xe02f('0x39')]){utils['info'](util[_0xe02f('0xa')](_0xe02f('0x3a'),_0x8ea357['origtransfereruniqueid'],_0x8ea357[_0xe02f('0x38')],_0x8ea357[_0xe02f('0x3b')]));channels[_0x8ea357[_0xe02f('0x38')]]['destinationchannel']=_0x8ea357[_0xe02f('0x3b')];channels[_0x8ea357[_0xe02f('0x38')]]['userfield']=_0xe02f('0x3c');}else if(channels[_0x8ea357[_0xe02f('0x38')]][_0xe02f('0xc')]=_0x8ea357[_0xe02f('0x3d')]){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x3a'),_0x8ea357[_0xe02f('0x3e')],_0x8ea357[_0xe02f('0x38')],_0x8ea357['origtransfererchannel']));channels[_0x8ea357[_0xe02f('0x38')]]['destinationchannel']=_0x8ea357[_0xe02f('0x3f')];channels[_0x8ea357['localtwolinkedid']][_0xe02f('0x40')]=_0xe02f('0x3c');}}}catch(_0x1ba6a3){utils[_0xe02f('0x20')](util[_0xe02f('0xa')](_0xe02f('0x37'),_0x8ea357[_0xe02f('0x3e')]),_0x1ba6a3);}};exports[_0xe02f('0x41')]=function(_0x17fc8b){try{if(!_['isNil'](channels[_0x17fc8b[_0xe02f('0x7')]])){utils[_0xe02f('0x18')](util['format'](_0xe02f('0x42'),_0x17fc8b[_0xe02f('0x7')]),_0x17fc8b);channels[_0x17fc8b[_0xe02f('0x7')]][_0xe02f('0x43')]=utils[_0xe02f('0x1f')]();utils[_0xe02f('0x1b')](util['format'](_0xe02f('0x44'),_0x17fc8b['uniqueid'],channels[_0x17fc8b[_0xe02f('0x7')]][_0xe02f('0x43')]));}}catch(_0x4c4712){utils['error'](util[_0xe02f('0xa')]('[%s][calls][musiconholdstart]',_0x17fc8b['uniqueid']),_0x4c4712);}};exports[_0xe02f('0x45')]=function(_0xe83dee){try{if(!_[_0xe02f('0x23')](channels[_0xe83dee[_0xe02f('0x7')]])){utils[_0xe02f('0x18')](util[_0xe02f('0xa')]('[%s][calls][musiconholdstop]',_0xe83dee['uniqueid']),_0xe83dee);if(!_[_0xe02f('0x23')](channels[_0xe83dee[_0xe02f('0x7')]][_0xe02f('0x43')])){channels[_0xe83dee[_0xe02f('0x7')]]['mohtime']+=utils[_0xe02f('0x35')](utils[_0xe02f('0x1f')](),channels[_0xe83dee[_0xe02f('0x7')]][_0xe02f('0x43')]);utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x46'),_0xe83dee[_0xe02f('0x7')],channels[_0xe83dee[_0xe02f('0x7')]][_0xe02f('0x47')]));delete channels[_0xe83dee[_0xe02f('0x7')]][_0xe02f('0x43')];}}}catch(_0x476fea){utils[_0xe02f('0x20')](util['format']('[%s][calls][musiconholdstop]',_0xe83dee[_0xe02f('0x7')]),_0x476fea);}};exports['varset']=function(_0x2a1da3){try{if(!_['isNil'](channels[_0x2a1da3[_0xe02f('0x7')]])){utils['debug'](util[_0xe02f('0xa')](_0xe02f('0x48'),_0x2a1da3[_0xe02f('0x7')]),_0x2a1da3);if(!_[_0xe02f('0x23')](_0x2a1da3['variable'][_0xe02f('0x49')])){utils['info'](util[_0xe02f('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2a1da3[_0xe02f('0x7')],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x4b')]=_0x2a1da3['value'];}if(!_[_0xe02f('0x23')](_0x2a1da3['variable'][_0xe02f('0x4c')])){utils[_0xe02f('0x1b')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2a1da3[_0xe02f('0x7')],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x4d')]=_0x2a1da3[_0xe02f('0x4a')];channels[_0x2a1da3[_0xe02f('0x7')]]['callerid']='\x22'+_0x2a1da3[_0xe02f('0x4a')]+_0xe02f('0x4e')+_0x2a1da3[_0xe02f('0x4a')]+'>';}if(!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x50')])||!_['isNil'](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x51')])){utils['info'](util[_0xe02f('0xa')](_0xe02f('0x52'),_0x2a1da3[_0xe02f('0x7')],!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x50')])?_0xe02f('0x50'):'xmd-callerid',_0x2a1da3['value']));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x2d')]=_0x2a1da3[_0xe02f('0x4a')];}if(!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x53')])||!_['isNil'](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x54')])){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2a1da3['uniqueid'],!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x53')])?'xmd-queue':'xmcs-queue',_0x2a1da3['value']));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x55')]='Queue';channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x56')]=_0x2a1da3[_0xe02f('0x4a')];channels[_0x2a1da3['uniqueid']][_0xe02f('0xd')]=!![];}if(!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x57')])){utils[_0xe02f('0x1b')](util['format'](_0xe02f('0x58'),_0x2a1da3['uniqueid'],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x59')]=_0x2a1da3['value'];}if(!_['isNil'](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x5a')])){utils[_0xe02f('0x1b')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2a1da3[_0xe02f('0x7')],_0x2a1da3['value']));channels[_0x2a1da3['uniqueid']][_0xe02f('0x5b')]=_0x2a1da3['value'];}if(!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x5c')])){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x5d'),_0x2a1da3[_0xe02f('0x7')],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3[_0xe02f('0x7')]]['routeid']=_0x2a1da3[_0xe02f('0x4a')];}if(!_['isNil'](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x5e')])){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x5f'),_0x2a1da3['uniqueid'],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3['uniqueid']]['sipcallid']=_0x2a1da3[_0xe02f('0x4a')];}}}catch(_0x397c81){utils[_0xe02f('0x20')](util[_0xe02f('0xa')](_0xe02f('0x48'),_0x2a1da3['uniqueid']),_0x397c81);}};exports['newexten']=function(_0x4212ad){try{if(!_['isNil'](channels[_0x4212ad[_0xe02f('0x7')]])){utils[_0xe02f('0x18')](util['format'](_0xe02f('0x60'),_0x4212ad[_0xe02f('0x7')]),_0x4212ad);utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x61'),_0x4212ad['uniqueid'],_0x4212ad[_0xe02f('0x62')],_0x4212ad['appdata']));if(_0x4212ad[_0xe02f('0x62')]['toLowerCase']()==_0xe02f('0x63')&&_[_0xe02f('0x64')](_0x4212ad[_0xe02f('0x65')][_0xe02f('0x66')](),_0xe02f('0x67'))){var _0x4edfa6=_0x4212ad[_0xe02f('0x65')][_0xe02f('0x68')]('=');var _0x329439=_0x4edfa6[0x0]['substring'](_0x4edfa6[0x0][_0xe02f('0x69')]('(')+0x1,_0x4edfa6[0x0][_0xe02f('0x69')](')'));var _0x1eb643=_0x4edfa6[0x1];channels[_0x4212ad[_0xe02f('0x7')]][_0x329439]=_0x1eb643;}if(!_[_0xe02f('0x6a')](['hangup','noop',_0xe02f('0x6b'),'set',_0xe02f('0x6c')],_0x4212ad[_0xe02f('0x62')][_0xe02f('0x66')]())){channels[_0x4212ad['uniqueid']][_0xe02f('0x55')]=_0x4212ad[_0xe02f('0x62')];channels[_0x4212ad['uniqueid']][_0xe02f('0x56')]=_0x4212ad[_0xe02f('0x65')];}}}catch(_0x4a7190){utils[_0xe02f('0x20')](util[_0xe02f('0xa')](_0xe02f('0x60'),_0x4212ad[_0xe02f('0x7')]),_0x4a7190);}}; \ No newline at end of file +var _0x49e5=['./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','error','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','[%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','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','util'];(function(_0x3793e9,_0x5bcec5){var _0x8a2933=function(_0x1cb9a1){while(--_0x1cb9a1){_0x3793e9['push'](_0x3793e9['shift']());}};_0x8a2933(++_0x5bcec5);}(_0x49e5,0x71));var _0x549e=function(_0x1f0464,_0x74c830){_0x1f0464=_0x1f0464-0x0;var _0x3b8414=_0x49e5[_0x1f0464];return _0x3b8414;};'use strict';var _=require(_0x549e('0x0'));var util=require(_0x549e('0x1'));var utils=require(_0x549e('0x2'));var transfers=require(_0x549e('0x3'));var dispositions=[_0x549e('0x4'),'FAILED',_0x549e('0x5'),_0x549e('0x4'),_0x549e('0x4'),_0x549e('0x4'),_0x549e('0x6'),'BUSY',_0x549e('0x5'),'FAILED','FAILED'];var channels={};function writeDB(_0x44b1e3){var _0x2d83f2;if(transfers[_0x549e('0x7')][_0x44b1e3['uniqueid']]){_0x2d83f2=_0x44b1e3['uniqueid'];_0x44b1e3['uniqueid']=transfers[_0x549e('0x7')][_0x44b1e3[_0x549e('0x8')]][_0x549e('0x9')];}utils[_0x549e('0xa')](util[_0x549e('0xb')](_0x549e('0xc'),_0x44b1e3['uniqueid'],_0x44b1e3[_0x549e('0xd')],_0x44b1e3['queue'],_0x44b1e3[_0x549e('0xe')],_0x44b1e3[_0x549e('0xf')],_0x44b1e3[_0x549e('0x10')],_0x44b1e3['connectedlinenum'],_0x44b1e3[_0x549e('0x11')]));if(_0x44b1e3[_0x549e('0x12')]){utils[_0x549e('0x13')](_0x44b1e3['accountcode'])[_0x549e('0x14')](function(_0x89e3b1){if(_0x89e3b1){_0x44b1e3[_0x549e('0x15')]=_0x89e3b1['id'];}utils[_0x549e('0x16')](_0x549e('0x17'),_0x44b1e3);});}else{utils[_0x549e('0x16')](_0x549e('0x17'),_0x44b1e3);}if(channels[_0x44b1e3[_0x549e('0x8')]]){delete channels[_0x44b1e3[_0x549e('0x8')]];}else if(_0x2d83f2&&channels[_0x2d83f2]){if(!transfers[_0x549e('0x7')][_0x2d83f2][_0x549e('0x18')])delete transfers[_0x549e('0x7')][_0x2d83f2];delete channels[_0x2d83f2];}}exports[_0x549e('0x19')]=function(_0x1c5877){try{utils[_0x549e('0x1a')](util['format'](_0x549e('0x1b'),_0x1c5877[_0x549e('0x8')]),_0x1c5877);if(_0x1c5877['uniqueid']==_0x1c5877[_0x549e('0x1c')]&&_0x1c5877[_0x549e('0xd')]!=_0x549e('0x1d')){utils[_0x549e('0xa')](util[_0x549e('0xb')](_0x549e('0x1e'),_0x1c5877[_0x549e('0x8')],_0x1c5877[_0x549e('0x1f')],_0x1c5877[_0x549e('0x20')]));channels[_0x1c5877[_0x549e('0x8')]]={'uniqueid':_0x1c5877[_0x549e('0x8')],'accountcode':_0x1c5877[_0x549e('0x12')],'source':_0x1c5877[_0x549e('0x10')],'destination':_0x1c5877['exten'],'destinationcontext':_0x1c5877['context'],'channel':_0x1c5877['channel'],'starttime':utils[_0x549e('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x549e('0x4'),'amaflags':_0x549e('0x22')};}}catch(_0x5e152a){utils['error'](util[_0x549e('0xb')]('[%s][calls][newchannel]',_0x1c5877[_0x549e('0x8')]),_0x5e152a);}};exports[_0x549e('0x23')]=function(_0x473cd7){try{utils[_0x549e('0x1a')](util[_0x549e('0xb')]('[%s][calls][newstate]',_0x473cd7['uniqueid']),_0x473cd7);if(!_[_0x549e('0x24')](channels[_0x473cd7[_0x549e('0x8')]])&&_0x473cd7[_0x549e('0x25')]==0x6){utils[_0x549e('0xa')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x473cd7[_0x549e('0x8')],_0x473cd7[_0x549e('0x1f')],_0x473cd7[_0x549e('0xd')]));if(_[_0x549e('0x24')](channels[_0x473cd7[_0x549e('0x8')]]['systemanswertime'])){channels[_0x473cd7[_0x549e('0x8')]][_0x549e('0x26')]=utils[_0x549e('0x21')]();}}else if(!_['isNil'](channels[_0x473cd7['linkedid']])&&_0x473cd7[_0x549e('0x25')]==0x6&&_0x473cd7[_0x549e('0x1f')]!=_0x549e('0x27')){utils[_0x549e('0xa')](util[_0x549e('0xb')](_0x549e('0x28'),_0x473cd7[_0x549e('0x8')],_0x473cd7[_0x549e('0x1c')],_0x473cd7[_0x549e('0x1f')],_0x473cd7[_0x549e('0xd')]));channels[_0x473cd7['linkedid']][_0x549e('0x12')]=_0x473cd7[_0x549e('0x12')];channels[_0x473cd7[_0x549e('0x1c')]][_0x549e('0x29')]=_0x473cd7[_0x549e('0xd')];if(_[_0x549e('0x24')](channels[_0x473cd7['linkedid']][_0x549e('0x2a')])){channels[_0x473cd7['linkedid']]['answertime']=utils[_0x549e('0x21')]();}channels[_0x473cd7[_0x549e('0x1c')]][_0x549e('0x2b')]=dispositions[_['toNumber'](_0x473cd7[_0x549e('0x25')])]||_0x549e('0x6');}}catch(_0x310f55){utils[_0x549e('0x2c')](util[_0x549e('0xb')]('[%s][calls][newstate]',_0x473cd7[_0x549e('0x8')]),_0x310f55);}};exports[_0x549e('0x2d')]=function(_0x1c8d06){try{if(!_[_0x549e('0x24')](channels[_0x1c8d06['uniqueid']])){utils[_0x549e('0x1a')](util[_0x549e('0xb')]('[%s][calls][hangup]',_0x1c8d06[_0x549e('0x8')]),_0x1c8d06);if(_[_0x549e('0x24')](channels[_0x1c8d06[_0x549e('0x8')]][_0x549e('0x2e')])){channels[_0x1c8d06[_0x549e('0x8')]][_0x549e('0x2e')]=_0x1c8d06[_0x549e('0x2f')]+'\x20<'+_0x1c8d06[_0x549e('0x10')]+'>';}utils['info'](util[_0x549e('0xb')](_0x549e('0x30'),_0x1c8d06[_0x549e('0x8')],channels[_0x1c8d06['uniqueid']][_0x549e('0x2e')],_0x1c8d06[_0x549e('0x31')]));channels[_0x1c8d06[_0x549e('0x8')]]['endtime']=utils[_0x549e('0x21')]();channels[_0x1c8d06['uniqueid']][_0x549e('0x32')]=utils[_0x549e('0x33')](channels[_0x1c8d06[_0x549e('0x8')]][_0x549e('0x34')],channels[_0x1c8d06[_0x549e('0x8')]][_0x549e('0x35')]);channels[_0x1c8d06['uniqueid']][_0x549e('0x36')]=channels[_0x1c8d06[_0x549e('0x8')]]['answertime']?utils[_0x549e('0x33')](channels[_0x1c8d06['uniqueid']][_0x549e('0x34')],channels[_0x1c8d06['uniqueid']][_0x549e('0x2a')]):0x0;writeDB(channels[_0x1c8d06['uniqueid']]);}}catch(_0x5e0f94){utils['error'](util[_0x549e('0xb')](_0x549e('0x37'),_0x1c8d06['uniqueid']),_0x5e0f94);}};exports[_0x549e('0x38')]=function(_0x3b4ab4){try{if(!_[_0x549e('0x24')](channels[_0x3b4ab4['localtwolinkedid']])){utils['debug'](util[_0x549e('0xb')](_0x549e('0x39'),_0x3b4ab4[_0x549e('0x3a')]),_0x3b4ab4);if(channels[_0x3b4ab4[_0x549e('0x3b')]][_0x549e('0xd')]==_0x3b4ab4['transfereechannel']){utils[_0x549e('0xa')](util['format'](_0x549e('0x3c'),_0x3b4ab4[_0x549e('0x3a')],_0x3b4ab4[_0x549e('0x3b')],_0x3b4ab4[_0x549e('0x3d')]));channels[_0x3b4ab4['localtwolinkedid']][_0x549e('0x29')]=_0x3b4ab4['secondtransfererchannel'];channels[_0x3b4ab4[_0x549e('0x3b')]][_0x549e('0x3e')]=_0x549e('0x3f');}else if(channels[_0x3b4ab4[_0x549e('0x3b')]][_0x549e('0xd')]=_0x3b4ab4[_0x549e('0x40')]){utils[_0x549e('0xa')](util[_0x549e('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3b4ab4[_0x549e('0x3a')],_0x3b4ab4[_0x549e('0x3b')],_0x3b4ab4[_0x549e('0x41')]));channels[_0x3b4ab4[_0x549e('0x3b')]][_0x549e('0x29')]=_0x3b4ab4[_0x549e('0x41')];channels[_0x3b4ab4[_0x549e('0x3b')]][_0x549e('0x3e')]=_0x549e('0x3f');}}}catch(_0x5af085){utils[_0x549e('0x2c')](util[_0x549e('0xb')](_0x549e('0x39'),_0x3b4ab4[_0x549e('0x3a')]),_0x5af085);}};exports['musiconholdstart']=function(_0x30b6a1){try{if(!_['isNil'](channels[_0x30b6a1['uniqueid']])){utils[_0x549e('0x1a')](util[_0x549e('0xb')](_0x549e('0x42'),_0x30b6a1['uniqueid']),_0x30b6a1);channels[_0x30b6a1[_0x549e('0x8')]][_0x549e('0x43')]=utils['now']();utils[_0x549e('0xa')](util['format'](_0x549e('0x44'),_0x30b6a1[_0x549e('0x8')],channels[_0x30b6a1['uniqueid']][_0x549e('0x43')]));}}catch(_0x5038b9){utils['error'](util['format'](_0x549e('0x42'),_0x30b6a1[_0x549e('0x8')]),_0x5038b9);}};exports[_0x549e('0x45')]=function(_0x40c52c){try{if(!_[_0x549e('0x24')](channels[_0x40c52c[_0x549e('0x8')]])){utils[_0x549e('0x1a')](util[_0x549e('0xb')](_0x549e('0x46'),_0x40c52c[_0x549e('0x8')]),_0x40c52c);if(!_[_0x549e('0x24')](channels[_0x40c52c[_0x549e('0x8')]]['musiconholdstartAt'])){channels[_0x40c52c[_0x549e('0x8')]][_0x549e('0x47')]+=utils[_0x549e('0x33')](utils[_0x549e('0x21')](),channels[_0x40c52c['uniqueid']][_0x549e('0x43')]);utils['info'](util['format'](_0x549e('0x48'),_0x40c52c[_0x549e('0x8')],channels[_0x40c52c[_0x549e('0x8')]][_0x549e('0x47')]));delete channels[_0x40c52c['uniqueid']][_0x549e('0x43')];}}}catch(_0x4f5a83){utils[_0x549e('0x2c')](util[_0x549e('0xb')](_0x549e('0x46'),_0x40c52c[_0x549e('0x8')]),_0x4f5a83);}};exports[_0x549e('0x49')]=function(_0x1d6dca){try{if(!_[_0x549e('0x24')](channels[_0x1d6dca[_0x549e('0x8')]])){utils[_0x549e('0x1a')](util['format'](_0x549e('0x4a'),_0x1d6dca[_0x549e('0x8')]),_0x1d6dca);if(!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')][_0x549e('0x4c')])){utils[_0x549e('0xa')](util[_0x549e('0xb')](_0x549e('0x4d'),_0x1d6dca[_0x549e('0x8')],_0x1d6dca['value']));channels[_0x1d6dca[_0x549e('0x8')]][_0x549e('0x4e')]=_0x1d6dca[_0x549e('0x4f')];}if(!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')]['xmd-phone'])){utils[_0x549e('0xa')](util[_0x549e('0xb')](_0x549e('0x50'),_0x1d6dca[_0x549e('0x8')],_0x1d6dca['value']));channels[_0x1d6dca['uniqueid']][_0x549e('0x51')]=_0x1d6dca[_0x549e('0x4f')];channels[_0x1d6dca[_0x549e('0x8')]]['callerid']='\x22'+_0x1d6dca[_0x549e('0x4f')]+_0x549e('0x52')+_0x1d6dca[_0x549e('0x4f')]+'>';}if(!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')][_0x549e('0x53')])||!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')][_0x549e('0x54')])){utils['info'](util[_0x549e('0xb')](_0x549e('0x55'),_0x1d6dca[_0x549e('0x8')],!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')][_0x549e('0x53')])?_0x549e('0x53'):_0x549e('0x54'),_0x1d6dca[_0x549e('0x4f')]));channels[_0x1d6dca[_0x549e('0x8')]][_0x549e('0x2e')]=_0x1d6dca[_0x549e('0x4f')];}if(!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')][_0x549e('0x56')])||!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')][_0x549e('0x57')])){utils['info'](util[_0x549e('0xb')](_0x549e('0x55'),_0x1d6dca[_0x549e('0x8')],!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')][_0x549e('0x56')])?_0x549e('0x56'):_0x549e('0x57'),_0x1d6dca['value']));channels[_0x1d6dca['uniqueid']][_0x549e('0x58')]=_0x549e('0x59');channels[_0x1d6dca['uniqueid']]['lastdata']=_0x1d6dca['value'];channels[_0x1d6dca['uniqueid']][_0x549e('0x5a')]=!![];}if(!_['isNil'](_0x1d6dca['variable'][_0x549e('0x5b')])){utils[_0x549e('0xa')](util[_0x549e('0xb')](_0x549e('0x5c'),_0x1d6dca[_0x549e('0x8')],_0x1d6dca[_0x549e('0x4f')]));channels[_0x1d6dca['uniqueid']]['ContactId']=_0x1d6dca[_0x549e('0x4f')];}if(!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')]['xmd-cdrtype'])){utils[_0x549e('0xa')](util[_0x549e('0xb')](_0x549e('0x5d'),_0x1d6dca['uniqueid'],_0x1d6dca[_0x549e('0x4f')]));channels[_0x1d6dca[_0x549e('0x8')]][_0x549e('0x5e')]=_0x1d6dca[_0x549e('0x4f')];}if(!_[_0x549e('0x24')](_0x1d6dca['variable'][_0x549e('0x5f')])){utils['info'](util[_0x549e('0xb')](_0x549e('0x60'),_0x1d6dca['uniqueid'],_0x1d6dca[_0x549e('0x4f')]));channels[_0x1d6dca[_0x549e('0x8')]][_0x549e('0x61')]=_0x1d6dca[_0x549e('0x4f')];}if(!_[_0x549e('0x24')](_0x1d6dca[_0x549e('0x4b')]['sipcallid'])){utils[_0x549e('0xa')](util[_0x549e('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1d6dca[_0x549e('0x8')],_0x1d6dca[_0x549e('0x4f')]));channels[_0x1d6dca['uniqueid']][_0x549e('0x62')]=_0x1d6dca[_0x549e('0x4f')];}}}catch(_0x227b74){utils[_0x549e('0x2c')](util[_0x549e('0xb')]('[%s][calls][varset]',_0x1d6dca[_0x549e('0x8')]),_0x227b74);}};exports[_0x549e('0x63')]=function(_0x392fe5){try{if(!_[_0x549e('0x24')](channels[_0x392fe5[_0x549e('0x8')]])){utils[_0x549e('0x1a')](util[_0x549e('0xb')](_0x549e('0x64'),_0x392fe5['uniqueid']),_0x392fe5);utils[_0x549e('0xa')](util[_0x549e('0xb')](_0x549e('0x65'),_0x392fe5[_0x549e('0x8')],_0x392fe5[_0x549e('0x66')],_0x392fe5[_0x549e('0x67')]));if(_0x392fe5[_0x549e('0x66')][_0x549e('0x68')]()==_0x549e('0x69')&&_[_0x549e('0x6a')](_0x392fe5[_0x549e('0x67')][_0x549e('0x68')](),_0x549e('0x6b'))){var _0x4207a4=_0x392fe5[_0x549e('0x67')]['split']('=');var _0x421ae4=_0x4207a4[0x0][_0x549e('0x6c')](_0x4207a4[0x0][_0x549e('0x6d')]('(')+0x1,_0x4207a4[0x0]['lastIndexOf'](')'));var _0x5a422b=_0x4207a4[0x1];channels[_0x392fe5[_0x549e('0x8')]][_0x421ae4]=_0x5a422b;}if(!_[_0x549e('0x6e')]([_0x549e('0x2d'),_0x549e('0x6f'),_0x549e('0x70'),_0x549e('0x69'),_0x549e('0x71')],_0x392fe5[_0x549e('0x66')]['toLowerCase']())){channels[_0x392fe5['uniqueid']][_0x549e('0x58')]=_0x392fe5[_0x549e('0x66')];channels[_0x392fe5[_0x549e('0x8')]][_0x549e('0x72')]=_0x392fe5[_0x549e('0x67')];}}}catch(_0x4fa5d9){utils[_0x549e('0x2c')](util[_0x549e('0xb')](_0x549e('0x64'),_0x392fe5[_0x549e('0x8')]),_0x4fa5d9);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 940f480..844c1b8 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 _0x2b82=['[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x103546,_0x37d41f){var _0xdef652=function(_0x2024dc){while(--_0x2024dc){_0x103546['push'](_0x103546['shift']());}};_0xdef652(++_0x37d41f);}(_0x2b82,0x190));var _0x22b8=function(_0x9a87a8,_0x46fc68){_0x9a87a8=_0x9a87a8-0x0;var _0x25be63=_0x2b82[_0x9a87a8];return _0x25be63;};'use strict';var utils=require(_0x22b8('0x0'));exports['connect']=function(){utils[_0x22b8('0x1')](_0x22b8('0x2'));};exports[_0x22b8('0x3')]=function(){utils[_0x22b8('0x1')](_0x22b8('0x4'));};exports[_0x22b8('0x5')]=function(){utils[_0x22b8('0x1')](_0x22b8('0x6'));};exports[_0x22b8('0x7')]=function(_0x137308){utils['error'](_0x22b8('0x8'),_0x137308);};exports[_0x22b8('0x9')]=function(){utils[_0x22b8('0x1')](_0x22b8('0xa'));};exports[_0x22b8('0xb')]=function(_0x55ee8a){}; \ No newline at end of file +var _0x9df4=['info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error','close','[core]\x20close','managerevent','connect'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x9df4,0xbd));var _0x49df=function(_0x539964,_0x54d1f8){_0x539964=_0x539964-0x0;var _0x559b1a=_0x9df4[_0x539964];return _0x559b1a;};'use strict';var utils=require('./utils');exports[_0x49df('0x0')]=function(){utils[_0x49df('0x1')](_0x49df('0x2'));};exports[_0x49df('0x3')]=function(){utils[_0x49df('0x1')]('[core]\x20shutdown');};exports[_0x49df('0x4')]=function(){utils[_0x49df('0x1')](_0x49df('0x5'));};exports['error']=function(_0x35f3ce){utils['error'](_0x49df('0x6'),_0x35f3ce);};exports[_0x49df('0x7')]=function(){utils[_0x49df('0x1')](_0x49df('0x8'));};exports[_0x49df('0x9')]=function(_0x86d6dd){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 44e2047..8fb45d8 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 _0x7ed7=['connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','now','complete','duration','holdtime','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','error','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','starttime','called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','lastevent'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x7ed7,0x10c));var _0x77ed=function(_0x1e7060,_0x453e1a){_0x1e7060=_0x1e7060-0x0;var _0x4233cf=_0x7ed7[_0x1e7060];return _0x4233cf;};'use strict';var _=require(_0x77ed('0x0'));var util=require(_0x77ed('0x1'));var utils=require(_0x77ed('0x2'));var dials={};function writeDB(_0x343178){utils[_0x77ed('0x3')](util[_0x77ed('0x4')](_0x77ed('0x5'),_0x343178[_0x77ed('0x6')],_0x343178['channel'],_0x343178[_0x77ed('0x7')],_0x343178[_0x77ed('0x8')],_0x343178['connectedlinenum'],_0x343178[_0x77ed('0x9')]));utils[_0x77ed('0xa')](_0x77ed('0xb'),_0x343178);delete dials[_0x343178[_0x77ed('0x6')]];}exports[_0x77ed('0xc')]=function(_0x37a074){try{utils[_0x77ed('0xd')](util[_0x77ed('0x4')](_0x77ed('0xe'),_0x37a074['uniqueid']),_0x37a074);utils[_0x77ed('0x3')](util['format'](_0x77ed('0xf'),_0x37a074['uniqueid'],_0x37a074[_0x77ed('0x10')],_0x37a074[_0x77ed('0x11')]));if(_0x37a074[_0x77ed('0x10')][_0x77ed('0x12')]()==_0x77ed('0x13')&&_['startsWith'](_0x37a074[_0x77ed('0x11')][_0x77ed('0x12')](),_0x77ed('0x14'))){var _0x4e984d=_0x37a074['appdata']['split']('=');dials[_0x37a074['uniqueid']]={'routeId':_0x4e984d[0x1]};}}catch(_0x5970e8){utils[_0x77ed('0x15')](util[_0x77ed('0x4')](_0x77ed('0xe'),_0x37a074[_0x77ed('0x6')]),_0x5970e8);}};exports['varset']=function(_0x2a24b9){try{utils[_0x77ed('0xd')](util[_0x77ed('0x4')]('[%s][dials][varset]',_0x2a24b9[_0x77ed('0x6')]),_0x2a24b9);if(!_[_0x77ed('0x16')](_0x2a24b9[_0x77ed('0x17')][_0x77ed('0x18')])){utils[_0x77ed('0x3')](util[_0x77ed('0x4')](_0x77ed('0x19'),_0x2a24b9[_0x77ed('0x6')],_0x2a24b9[_0x77ed('0x1a')]));dials[_0x2a24b9['uniqueid']]={'routeId':_0x2a24b9['value']};}}catch(_0x162998){utils[_0x77ed('0x15')](util[_0x77ed('0x4')](_0x77ed('0x1b'),_0x2a24b9[_0x77ed('0x6')]),_0x162998);}};exports[_0x77ed('0x1c')]=function(_0x182da5){try{if(!_[_0x77ed('0x16')](dials[_0x182da5['uniqueid']])){utils[_0x77ed('0xd')](util[_0x77ed('0x4')](_0x77ed('0x1d'),_0x182da5[_0x77ed('0x6')]),_0x182da5);dials[_0x182da5[_0x77ed('0x6')]]=_['assign'](dials[_0x182da5[_0x77ed('0x6')]],_0x182da5);dials[_0x182da5['uniqueid']][_0x77ed('0x1e')]=utils['now']();dials[_0x182da5[_0x77ed('0x6')]]['lastevent']=_0x77ed('0x1f');utils[_0x77ed('0x3')](util[_0x77ed('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x182da5['uniqueid'],dials[_0x182da5[_0x77ed('0x6')]]['starttime']));}}catch(_0x4f6b17){utils[_0x77ed('0x15')](util[_0x77ed('0x4')]('[%s][dials][dialbegin]',_0x182da5[_0x77ed('0x6')]),_0x4f6b17);}};exports[_0x77ed('0x20')]=function(_0x297c8c){try{if(!_['isNil'](dials[_0x297c8c['uniqueid']])){utils['debug'](util[_0x77ed('0x4')](_0x77ed('0x21'),_0x297c8c[_0x77ed('0x6')]),_0x297c8c);dials[_0x297c8c[_0x77ed('0x6')]][_0x77ed('0x9')]=_0x297c8c[_0x77ed('0x9')];if(_0x297c8c['dialstatus']==_0x77ed('0x22')){dials[_0x297c8c[_0x77ed('0x6')]]=_[_0x77ed('0x23')](dials[_0x297c8c[_0x77ed('0x6')]],_0x297c8c);dials[_0x297c8c[_0x77ed('0x6')]][_0x77ed('0x24')]=utils['now']();dials[_0x297c8c[_0x77ed('0x6')]][_0x77ed('0x25')]=_0x77ed('0x26');utils[_0x77ed('0x3')](util[_0x77ed('0x4')](_0x77ed('0x27'),_0x297c8c[_0x77ed('0x6')],_0x297c8c[_0x77ed('0x9')],dials[_0x297c8c['uniqueid']][_0x77ed('0x24')]));}else{utils[_0x77ed('0x3')](util[_0x77ed('0x4')](_0x77ed('0x28'),_0x297c8c[_0x77ed('0x6')],_0x297c8c[_0x77ed('0x9')]));}}}catch(_0x27a237){utils[_0x77ed('0x15')](util[_0x77ed('0x4')]('[%s][dials][dialend]',_0x297c8c[_0x77ed('0x6')]),_0x27a237);}};exports[_0x77ed('0x29')]=function(_0xc13d3e){try{if(!_[_0x77ed('0x16')](dials[_0xc13d3e[_0x77ed('0x6')]])){utils[_0x77ed('0xd')](util[_0x77ed('0x4')](_0x77ed('0x2a'),_0xc13d3e[_0x77ed('0x6')]),_0xc13d3e);utils['info'](util[_0x77ed('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0xc13d3e[_0x77ed('0x6')],_0xc13d3e[_0x77ed('0x8')],_0xc13d3e[_0x77ed('0x2b')],_0xc13d3e['cause-txt']));dials[_0xc13d3e[_0x77ed('0x6')]]=_[_0x77ed('0x23')](dials[_0xc13d3e[_0x77ed('0x6')]],{'endtime':utils[_0x77ed('0x2c')](),'lastevent':_0x77ed('0x2d')});dials[_0xc13d3e['uniqueid']][_0x77ed('0x2e')]=utils['diffTime'](dials[_0xc13d3e[_0x77ed('0x6')]]['endtime'],dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x1e')]);dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x2f')]=utils[_0x77ed('0x30')](dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x24')]||dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x31')],dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x1e')]);dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x32')]=dials[_0xc13d3e['uniqueid']]['answertime']?utils[_0x77ed('0x30')](dials[_0xc13d3e['uniqueid']][_0x77ed('0x31')],dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x24')]):0x0;writeDB(dials[_0xc13d3e['uniqueid']]);}}catch(_0x44e1e2){utils['error'](util[_0x77ed('0x4')](_0x77ed('0x2a'),_0xc13d3e[_0x77ed('0x6')]),_0x44e1e2);}}; \ No newline at end of file +var _0x5ea1=['outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstatus','request','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','error','varset','[%s][dials][varset]','isNil','variable'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x5ea1,0x146));var _0x15ea=function(_0x12e1e9,_0x1908e6){_0x12e1e9=_0x12e1e9-0x0;var _0x11585f=_0x5ea1[_0x12e1e9];return _0x11585f;};'use strict';var _=require(_0x15ea('0x0'));var util=require(_0x15ea('0x1'));var utils=require(_0x15ea('0x2'));var dials={};function writeDB(_0x3c6df7){utils[_0x15ea('0x3')](util['format'](_0x15ea('0x4'),_0x3c6df7[_0x15ea('0x5')],_0x3c6df7['channel'],_0x3c6df7['dialstring'],_0x3c6df7['calleridnum'],_0x3c6df7['connectedlinenum'],_0x3c6df7[_0x15ea('0x6')]));utils[_0x15ea('0x7')]('CreateVoiceDialReport',_0x3c6df7);delete dials[_0x3c6df7[_0x15ea('0x5')]];}exports[_0x15ea('0x8')]=function(_0x53fd64){try{utils[_0x15ea('0x9')](util[_0x15ea('0xa')](_0x15ea('0xb'),_0x53fd64[_0x15ea('0x5')]),_0x53fd64);utils[_0x15ea('0x3')](util[_0x15ea('0xa')](_0x15ea('0xc'),_0x53fd64[_0x15ea('0x5')],_0x53fd64[_0x15ea('0xd')],_0x53fd64['appdata']));if(_0x53fd64[_0x15ea('0xd')][_0x15ea('0xe')]()==_0x15ea('0xf')&&_[_0x15ea('0x10')](_0x53fd64[_0x15ea('0x11')]['toLowerCase'](),'cdr(routeid)')){var _0x1ecca7=_0x53fd64['appdata'][_0x15ea('0x12')]('=');dials[_0x53fd64[_0x15ea('0x5')]]={'routeId':_0x1ecca7[0x1]};}}catch(_0x11ee36){utils[_0x15ea('0x13')](util['format']('[%s][dials][newexten]',_0x53fd64[_0x15ea('0x5')]),_0x11ee36);}};exports[_0x15ea('0x14')]=function(_0x3cfc21){try{utils['debug'](util[_0x15ea('0xa')](_0x15ea('0x15'),_0x3cfc21[_0x15ea('0x5')]),_0x3cfc21);if(!_[_0x15ea('0x16')](_0x3cfc21[_0x15ea('0x17')][_0x15ea('0x18')])){utils[_0x15ea('0x3')](util[_0x15ea('0xa')](_0x15ea('0x19'),_0x3cfc21[_0x15ea('0x5')],_0x3cfc21[_0x15ea('0x1a')]));dials[_0x3cfc21[_0x15ea('0x5')]]={'routeId':_0x3cfc21[_0x15ea('0x1a')]};}}catch(_0xd64586){utils['error'](util[_0x15ea('0xa')]('[%s][dials][varset]',_0x3cfc21[_0x15ea('0x5')]),_0xd64586);}};exports[_0x15ea('0x1b')]=function(_0x52dbb5){try{if(!_[_0x15ea('0x16')](dials[_0x52dbb5['uniqueid']])){utils['debug'](util[_0x15ea('0xa')]('[%s][dials][dialbegin]',_0x52dbb5['uniqueid']),_0x52dbb5);dials[_0x52dbb5[_0x15ea('0x5')]]=_[_0x15ea('0x1c')](dials[_0x52dbb5[_0x15ea('0x5')]],_0x52dbb5);dials[_0x52dbb5[_0x15ea('0x5')]][_0x15ea('0x1d')]=utils[_0x15ea('0x1e')]();dials[_0x52dbb5['uniqueid']][_0x15ea('0x1f')]='called';utils[_0x15ea('0x3')](util[_0x15ea('0xa')](_0x15ea('0x20'),_0x52dbb5['uniqueid'],dials[_0x52dbb5[_0x15ea('0x5')]][_0x15ea('0x1d')]));}}catch(_0x588f41){utils[_0x15ea('0x13')](util[_0x15ea('0xa')](_0x15ea('0x21'),_0x52dbb5[_0x15ea('0x5')]),_0x588f41);}};exports[_0x15ea('0x22')]=function(_0x3e3f3a){try{if(!_['isNil'](dials[_0x3e3f3a['uniqueid']])){utils['debug'](util[_0x15ea('0xa')](_0x15ea('0x23'),_0x3e3f3a[_0x15ea('0x5')]),_0x3e3f3a);dials[_0x3e3f3a[_0x15ea('0x5')]]['dialstatus']=_0x3e3f3a[_0x15ea('0x6')];if(_0x3e3f3a[_0x15ea('0x6')]==_0x15ea('0x24')){dials[_0x3e3f3a[_0x15ea('0x5')]]=_[_0x15ea('0x1c')](dials[_0x3e3f3a[_0x15ea('0x5')]],_0x3e3f3a);dials[_0x3e3f3a[_0x15ea('0x5')]][_0x15ea('0x25')]=utils['now']();dials[_0x3e3f3a['uniqueid']][_0x15ea('0x1f')]=_0x15ea('0x26');utils[_0x15ea('0x3')](util[_0x15ea('0xa')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3e3f3a[_0x15ea('0x5')],_0x3e3f3a[_0x15ea('0x6')],dials[_0x3e3f3a['uniqueid']][_0x15ea('0x25')]));}else{utils[_0x15ea('0x3')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x3e3f3a[_0x15ea('0x5')],_0x3e3f3a[_0x15ea('0x6')]));}}}catch(_0x36a0ac){utils[_0x15ea('0x13')](util['format'](_0x15ea('0x23'),_0x3e3f3a[_0x15ea('0x5')]),_0x36a0ac);}};exports[_0x15ea('0x27')]=function(_0x22940f){try{if(!_['isNil'](dials[_0x22940f['uniqueid']])){utils['debug'](util[_0x15ea('0xa')](_0x15ea('0x28'),_0x22940f[_0x15ea('0x5')]),_0x22940f);utils[_0x15ea('0x3')](util['format'](_0x15ea('0x29'),_0x22940f[_0x15ea('0x5')],_0x22940f['calleridnum'],_0x22940f[_0x15ea('0x2a')],_0x22940f[_0x15ea('0x2b')]));dials[_0x22940f[_0x15ea('0x5')]]=_[_0x15ea('0x1c')](dials[_0x22940f[_0x15ea('0x5')]],{'endtime':utils[_0x15ea('0x1e')](),'lastevent':_0x15ea('0x2c')});dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x2d')]=utils[_0x15ea('0x2e')](dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x2f')],dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x1d')]);dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x30')]=utils[_0x15ea('0x2e')](dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x25')]||dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x2f')],dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x1d')]);dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x31')]=dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x25')]?utils[_0x15ea('0x2e')](dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x2f')],dials[_0x22940f[_0x15ea('0x5')]][_0x15ea('0x25')]):0x0;writeDB(dials[_0x22940f[_0x15ea('0x5')]]);}}catch(_0x205ba4){utils[_0x15ea('0x13')](util[_0x15ea('0xa')]('[%s][dials][hangup]',_0x22940f['uniqueid']),_0x205ba4);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c50838a..50b3cd1 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 _0x2565=['cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2565,0x9a));var _0x5256=function(_0x39e598,_0x4c2cce){_0x39e598=_0x39e598-0x0;var _0x4a7e41=_0x2565[_0x39e598];return _0x4a7e41;};var AsteriskManager=require(_0x5256('0x0'));var config=require(_0x5256('0x1'));var utils=require('./utils');var util=require(_0x5256('0x2'));var ami=new AsteriskManager(config[_0x5256('0x3')]['port'],config[_0x5256('0x3')]['ip'],config[_0x5256('0x3')][_0x5256('0x4')],config[_0x5256('0x3')][_0x5256('0x5')],!![]);ami[_0x5256('0x6')]();if(config['xdr']&&config[_0x5256('0x7')][_0x5256('0x8')]){utils[_0x5256('0x9')](_0x5256('0xa'));}else{var agents=require(_0x5256('0xb'));var calls=require(_0x5256('0xc'));var queues=require(_0x5256('0xd'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x5256('0xe'));var transfers=require(_0x5256('0xf'));var core=require(_0x5256('0x10'));ami['on'](_0x5256('0x11'),core[_0x5256('0x11')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x5256('0x12'),core[_0x5256('0x12')]);ami['on']('error',core[_0x5256('0x13')]);ami['on'](_0x5256('0x14'),core['close']);ami['on'](_0x5256('0x15'),core[_0x5256('0x15')]);ami['on'](_0x5256('0x16'),function(_0x3516b9){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x19'),_0x3516b9[_0x5256('0x1a')]),_0x3516b9);members[_0x5256('0x16')](_0x3516b9);}catch(_0x127ae4){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x19'),_0x3516b9['device']),_0x127ae4);}});ami['on'](_0x5256('0x1b'),function(_0x39ec3c){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x1c'),_0x39ec3c[_0x5256('0x1d')]),_0x39ec3c);agents[_0x5256('0x1b')](_0x39ec3c);}catch(_0x12a5e9){utils[_0x5256('0x13')](util[_0x5256('0x18')]('[%s][index][agentcalled]',_0x39ec3c['uniqueid']),_0x12a5e9);}});ami['on'](_0x5256('0x1e'),function(_0x2d1002){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x1f'),_0x2d1002[_0x5256('0x1d')]),_0x2d1002);agents[_0x5256('0x1e')](_0x2d1002);}catch(_0x4cba04){utils['error'](util[_0x5256('0x18')]('[%s][index][agentringnoanswer]',_0x2d1002['uniqueid']),_0x4cba04);}});ami['on'](_0x5256('0x20'),function(_0x1175ff){try{utils[_0x5256('0x17')](util[_0x5256('0x18')]('[%s][index][agentconnect]',_0x1175ff['uniqueid']),_0x1175ff);agents[_0x5256('0x20')](_0x1175ff);queues[_0x5256('0x20')](_0x1175ff);}catch(_0x19eb8c){utils[_0x5256('0x13')](util['format'](_0x5256('0x21'),_0x1175ff[_0x5256('0x1d')]),_0x19eb8c);}});ami['on'](_0x5256('0x22'),function(_0x2a39ad){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x23'),_0x2a39ad['uniqueid']),_0x2a39ad);agents[_0x5256('0x22')](_0x2a39ad);queues['agentcomplete'](_0x2a39ad);members['agentcomplete'](_0x2a39ad);}catch(_0x58a718){utils[_0x5256('0x13')](util[_0x5256('0x18')]('[%s][index][agentcomplete]',_0x2a39ad[_0x5256('0x1d')]),_0x58a718);}});ami['on'](_0x5256('0x24'),function(_0x41a67a){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x25'),_0x41a67a[_0x5256('0x1d')]),_0x41a67a);agents[_0x5256('0x24')](_0x41a67a);queues[_0x5256('0x24')](_0x41a67a);}catch(_0x370d1a){utils[_0x5256('0x13')](util['format'](_0x5256('0x25'),_0x41a67a[_0x5256('0x1d')]),_0x370d1a);}});ami['on'](_0x5256('0x26'),function(_0x24ad88){try{utils[_0x5256('0x17')](util[_0x5256('0x18')]('[%s][index][queuecallerjoin]',_0x24ad88['uniqueid']),_0x24ad88);queues[_0x5256('0x26')](_0x24ad88);recordings['queuecallerjoin'](_0x24ad88);}catch(_0x4278da){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x27'),_0x24ad88[_0x5256('0x1d')]),_0x4278da);}});ami['on'](_0x5256('0x28'),function(_0x288759){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x29'),_0x288759['uniqueid']),_0x288759);queues[_0x5256('0x28')](_0x288759);}catch(_0x3b6e58){utils['error'](util[_0x5256('0x18')](_0x5256('0x29'),_0x288759[_0x5256('0x1d')]),_0x3b6e58);}});ami['on'](_0x5256('0x2a'),function(_0x5ca885){try{utils['debug'](util[_0x5256('0x18')]('[%s][index][musiconholdstart]',_0x5ca885[_0x5256('0x1d')]),_0x5ca885);queues[_0x5256('0x2a')](_0x5ca885);calls[_0x5256('0x2a')](_0x5ca885);}catch(_0xdefb99){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x2b'),_0x5ca885[_0x5256('0x1d')]),_0xdefb99);}});ami['on'](_0x5256('0x2c'),function(_0x3470bf){try{utils['debug'](util['format'](_0x5256('0x2d'),_0x3470bf[_0x5256('0x1d')]),_0x3470bf);queues[_0x5256('0x2c')](_0x3470bf);calls['musiconholdstop'](_0x3470bf);}catch(_0xa1dd91){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x2d'),_0x3470bf[_0x5256('0x1d')]),_0xa1dd91);}});ami['on'](_0x5256('0x2e'),function(_0x35ef8f){try{utils[_0x5256('0x17')](util['format'](_0x5256('0x2f'),_0x35ef8f[_0x5256('0x1d')]),_0x35ef8f);calls[_0x5256('0x2e')](_0x35ef8f);recordings[_0x5256('0x2e')](_0x35ef8f);}catch(_0x47547e){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x2f'),_0x35ef8f[_0x5256('0x1d')]),_0x47547e);}});ami['on'](_0x5256('0x30'),function(_0x462ac0){try{utils[_0x5256('0x17')](util[_0x5256('0x18')]('[%s][index][hangup]',_0x462ac0[_0x5256('0x1d')]),_0x462ac0);calls[_0x5256('0x30')](_0x462ac0);recordings[_0x5256('0x30')](_0x462ac0);dials['hangup'](_0x462ac0);agents[_0x5256('0x30')](_0x462ac0);queues[_0x5256('0x30')](_0x462ac0);}catch(_0x555638){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x31'),_0x462ac0[_0x5256('0x1d')]),_0x555638);}});ami['on'](_0x5256('0x32'),function(_0x45002d){try{utils['debug'](util[_0x5256('0x18')](_0x5256('0x33'),_0x45002d[_0x5256('0x1d')]),_0x45002d);members[_0x5256('0x32')](_0x45002d);}catch(_0x3ed0a8){utils['error'](util[_0x5256('0x18')]('[%s][index][cdr]',_0x45002d['uniqueid']),_0x3ed0a8);}});ami['on'](_0x5256('0x34'),function(_0xfad32a){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x35'),_0xfad32a[_0x5256('0x1d')]),_0xfad32a);queues['blindtransfer'](_0xfad32a);agents[_0x5256('0x34')](_0xfad32a);transfers[_0x5256('0x34')](_0xfad32a);recordings[_0x5256('0x34')](_0xfad32a);}catch(_0x17c31d){utils['error'](util[_0x5256('0x18')](_0x5256('0x35'),_0xfad32a[_0x5256('0x1d')]),_0x17c31d);}});ami['on']('attendedtransfer',function(_0x3ddeb0){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x36'),_0x3ddeb0[_0x5256('0x37')]),_0x3ddeb0);queues[_0x5256('0x38')](_0x3ddeb0);transfers[_0x5256('0x38')](_0x3ddeb0);agents['attendedtransfer'](_0x3ddeb0);calls[_0x5256('0x38')](_0x3ddeb0);}catch(_0x38b1d7){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x36'),_0x3ddeb0[_0x5256('0x37')]),_0x38b1d7);}});ami['on'](_0x5256('0x39'),function(_0x11e0fa){try{utils[_0x5256('0x17')](util['format'](_0x5256('0x3a'),_0x11e0fa[_0x5256('0x1d')]),_0x11e0fa);queues[_0x5256('0x39')](_0x11e0fa);recordings[_0x5256('0x39')](_0x11e0fa);calls['varset'](_0x11e0fa);dials[_0x5256('0x39')](_0x11e0fa);}catch(_0x1d0b6b){utils[_0x5256('0x13')](util['format'](_0x5256('0x3a'),_0x11e0fa[_0x5256('0x1d')]),_0x1d0b6b);}});ami['on']('newexten',function(_0xe96979){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x3b'),_0xe96979['uniqueid']),_0xe96979);calls[_0x5256('0x3c')](_0xe96979);recordings[_0x5256('0x3c')](_0xe96979);dials['newexten'](_0xe96979);}catch(_0x422cd1){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x3b'),_0xe96979[_0x5256('0x1d')]),_0x422cd1);}});ami['on']('newchannel',function(_0x2fd9df){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x3d'),_0x2fd9df[_0x5256('0x1d')]),_0x2fd9df);calls[_0x5256('0x3e')](_0x2fd9df);recordings[_0x5256('0x3e')](_0x2fd9df);}catch(_0x1d9855){utils[_0x5256('0x13')](util[_0x5256('0x18')]('[%s][index][newchannel]',_0x2fd9df['uniqueid']),_0x1d9855);}});ami['on']('dialbegin',function(_0x5aa213){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x3f'),_0x5aa213['uniqueid']),_0x5aa213);dials[_0x5256('0x40')](_0x5aa213);}catch(_0x50093c){utils['error'](util['format'](_0x5256('0x41'),_0x5aa213[_0x5256('0x1d')]),_0x50093c);}});ami['on'](_0x5256('0x42'),function(_0x8bf0dc){try{utils['debug'](util[_0x5256('0x18')](_0x5256('0x43'),_0x8bf0dc[_0x5256('0x1d')]),_0x8bf0dc);dials[_0x5256('0x42')](_0x8bf0dc);}catch(_0x4245aa){utils['error'](util[_0x5256('0x18')](_0x5256('0x43'),_0x8bf0dc['uniqueid']),_0x4245aa);}});} \ No newline at end of file +var _0x47b3=['[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave'];(function(_0xe3de64,_0x137a1f){var _0x1a0476=function(_0x7c3409){while(--_0x7c3409){_0xe3de64['push'](_0xe3de64['shift']());}};_0x1a0476(++_0x137a1f);}(_0x47b3,0x15d));var _0x347b=function(_0x4a4466,_0x12c0f3){_0x4a4466=_0x4a4466-0x0;var _0x1cdd8d=_0x47b3[_0x4a4466];return _0x1cdd8d;};var AsteriskManager=require(_0x347b('0x0'));var config=require(_0x347b('0x1'));var utils=require('./utils');var util=require(_0x347b('0x2'));var ami=new AsteriskManager(config[_0x347b('0x3')][_0x347b('0x4')],config[_0x347b('0x3')]['ip'],config[_0x347b('0x3')][_0x347b('0x5')],config[_0x347b('0x3')][_0x347b('0x6')],!![]);ami[_0x347b('0x7')]();if(config[_0x347b('0x8')]&&config[_0x347b('0x8')][_0x347b('0x9')]){utils['info'](_0x347b('0xa'));}else{var agents=require(_0x347b('0xb'));var calls=require(_0x347b('0xc'));var queues=require(_0x347b('0xd'));var recordings=require(_0x347b('0xe'));var members=require(_0x347b('0xf'));var dials=require('./dials.controller');var transfers=require(_0x347b('0x10'));var core=require('./core.controller');ami['on'](_0x347b('0x11'),core[_0x347b('0x11')]);ami['on'](_0x347b('0x12'),core['shutdown']);ami['on'](_0x347b('0x13'),core[_0x347b('0x13')]);ami['on']('error',core[_0x347b('0x14')]);ami['on']('close',core['close']);ami['on'](_0x347b('0x15'),core[_0x347b('0x15')]);ami['on'](_0x347b('0x16'),function(_0x465ec5){try{utils[_0x347b('0x17')](util[_0x347b('0x18')](_0x347b('0x19'),_0x465ec5[_0x347b('0x1a')]),_0x465ec5);members[_0x347b('0x16')](_0x465ec5);}catch(_0xd642bf){utils[_0x347b('0x14')](util['format'](_0x347b('0x19'),_0x465ec5[_0x347b('0x1a')]),_0xd642bf);}});ami['on']('agentcalled',function(_0x43f8e3){try{utils['debug'](util['format'](_0x347b('0x1b'),_0x43f8e3[_0x347b('0x1c')]),_0x43f8e3);agents[_0x347b('0x1d')](_0x43f8e3);}catch(_0x20ef0d){utils[_0x347b('0x14')](util['format'](_0x347b('0x1b'),_0x43f8e3[_0x347b('0x1c')]),_0x20ef0d);}});ami['on']('agentringnoanswer',function(_0x4f6e2a){try{utils['debug'](util['format'](_0x347b('0x1e'),_0x4f6e2a['uniqueid']),_0x4f6e2a);agents[_0x347b('0x1f')](_0x4f6e2a);}catch(_0x47dfa4){utils[_0x347b('0x14')](util[_0x347b('0x18')](_0x347b('0x1e'),_0x4f6e2a[_0x347b('0x1c')]),_0x47dfa4);}});ami['on'](_0x347b('0x20'),function(_0x4fa3bb){try{utils[_0x347b('0x17')](util[_0x347b('0x18')]('[%s][index][agentconnect]',_0x4fa3bb['uniqueid']),_0x4fa3bb);agents['agentconnect'](_0x4fa3bb);queues['agentconnect'](_0x4fa3bb);}catch(_0x5bf271){utils['error'](util[_0x347b('0x18')](_0x347b('0x21'),_0x4fa3bb[_0x347b('0x1c')]),_0x5bf271);}});ami['on'](_0x347b('0x22'),function(_0xb9285){try{utils['debug'](util['format'](_0x347b('0x23'),_0xb9285['uniqueid']),_0xb9285);agents[_0x347b('0x22')](_0xb9285);queues[_0x347b('0x22')](_0xb9285);members[_0x347b('0x22')](_0xb9285);}catch(_0x5ba642){utils[_0x347b('0x14')](util[_0x347b('0x18')](_0x347b('0x23'),_0xb9285[_0x347b('0x1c')]),_0x5ba642);}});ami['on'](_0x347b('0x24'),function(_0x56fc3b){try{utils[_0x347b('0x17')](util[_0x347b('0x18')](_0x347b('0x25'),_0x56fc3b[_0x347b('0x1c')]),_0x56fc3b);agents[_0x347b('0x24')](_0x56fc3b);queues[_0x347b('0x24')](_0x56fc3b);}catch(_0x4f92b2){utils['error'](util[_0x347b('0x18')]('[%s][index][queuecallerabandon]',_0x56fc3b[_0x347b('0x1c')]),_0x4f92b2);}});ami['on']('queuecallerjoin',function(_0x4b501f){try{utils[_0x347b('0x17')](util[_0x347b('0x18')](_0x347b('0x26'),_0x4b501f[_0x347b('0x1c')]),_0x4b501f);queues[_0x347b('0x27')](_0x4b501f);recordings['queuecallerjoin'](_0x4b501f);}catch(_0x5b7f8c){utils[_0x347b('0x14')](util[_0x347b('0x18')]('[%s][index][queuecallerjoin]',_0x4b501f[_0x347b('0x1c')]),_0x5b7f8c);}});ami['on'](_0x347b('0x28'),function(_0x1fe64e){try{utils['debug'](util[_0x347b('0x18')]('[%s][index][queuecallerleave]',_0x1fe64e['uniqueid']),_0x1fe64e);queues[_0x347b('0x28')](_0x1fe64e);}catch(_0x25b211){utils['error'](util[_0x347b('0x18')](_0x347b('0x29'),_0x1fe64e[_0x347b('0x1c')]),_0x25b211);}});ami['on'](_0x347b('0x2a'),function(_0x1bbb19){try{utils[_0x347b('0x17')](util['format'](_0x347b('0x2b'),_0x1bbb19[_0x347b('0x1c')]),_0x1bbb19);queues[_0x347b('0x2a')](_0x1bbb19);calls[_0x347b('0x2a')](_0x1bbb19);}catch(_0x5e88e8){utils[_0x347b('0x14')](util['format'](_0x347b('0x2b'),_0x1bbb19[_0x347b('0x1c')]),_0x5e88e8);}});ami['on']('musiconholdstop',function(_0x2fd667){try{utils[_0x347b('0x17')](util[_0x347b('0x18')](_0x347b('0x2c'),_0x2fd667[_0x347b('0x1c')]),_0x2fd667);queues[_0x347b('0x2d')](_0x2fd667);calls['musiconholdstop'](_0x2fd667);}catch(_0x50ace8){utils[_0x347b('0x14')](util[_0x347b('0x18')](_0x347b('0x2c'),_0x2fd667[_0x347b('0x1c')]),_0x50ace8);}});ami['on']('newstate',function(_0x23ad94){try{utils[_0x347b('0x17')](util[_0x347b('0x18')]('[%s][index][newstate]',_0x23ad94[_0x347b('0x1c')]),_0x23ad94);calls[_0x347b('0x2e')](_0x23ad94);recordings[_0x347b('0x2e')](_0x23ad94);}catch(_0x2bb30f){utils[_0x347b('0x14')](util[_0x347b('0x18')]('[%s][index][newstate]',_0x23ad94[_0x347b('0x1c')]),_0x2bb30f);}});ami['on'](_0x347b('0x2f'),function(_0x452c44){try{utils[_0x347b('0x17')](util[_0x347b('0x18')](_0x347b('0x30'),_0x452c44[_0x347b('0x1c')]),_0x452c44);calls['hangup'](_0x452c44);recordings[_0x347b('0x2f')](_0x452c44);dials[_0x347b('0x2f')](_0x452c44);agents[_0x347b('0x2f')](_0x452c44);queues[_0x347b('0x2f')](_0x452c44);}catch(_0x279573){utils['error'](util[_0x347b('0x18')](_0x347b('0x30'),_0x452c44['uniqueid']),_0x279573);}});ami['on'](_0x347b('0x31'),function(_0x524d9d){try{utils[_0x347b('0x17')](util[_0x347b('0x18')]('[%s][index][cdr]',_0x524d9d[_0x347b('0x1c')]),_0x524d9d);members[_0x347b('0x31')](_0x524d9d);}catch(_0xbcb6e3){utils[_0x347b('0x14')](util[_0x347b('0x18')](_0x347b('0x32'),_0x524d9d[_0x347b('0x1c')]),_0xbcb6e3);}});ami['on']('blindtransfer',function(_0x553871){try{utils[_0x347b('0x17')](util[_0x347b('0x18')]('[%s][index][blindtransfer]',_0x553871[_0x347b('0x1c')]),_0x553871);queues['blindtransfer'](_0x553871);agents[_0x347b('0x33')](_0x553871);transfers[_0x347b('0x33')](_0x553871);recordings[_0x347b('0x33')](_0x553871);}catch(_0x5d6e68){utils[_0x347b('0x14')](util[_0x347b('0x18')](_0x347b('0x34'),_0x553871[_0x347b('0x1c')]),_0x5d6e68);}});ami['on'](_0x347b('0x35'),function(_0x199184){try{utils[_0x347b('0x17')](util[_0x347b('0x18')](_0x347b('0x36'),_0x199184[_0x347b('0x37')]),_0x199184);queues[_0x347b('0x35')](_0x199184);transfers[_0x347b('0x35')](_0x199184);agents['attendedtransfer'](_0x199184);calls[_0x347b('0x35')](_0x199184);}catch(_0x55bad2){utils[_0x347b('0x14')](util[_0x347b('0x18')](_0x347b('0x36'),_0x199184[_0x347b('0x37')]),_0x55bad2);}});ami['on'](_0x347b('0x38'),function(_0x430ff0){try{utils[_0x347b('0x17')](util['format'](_0x347b('0x39'),_0x430ff0['uniqueid']),_0x430ff0);queues['varset'](_0x430ff0);recordings[_0x347b('0x38')](_0x430ff0);calls['varset'](_0x430ff0);dials[_0x347b('0x38')](_0x430ff0);}catch(_0x8c583e){utils[_0x347b('0x14')](util[_0x347b('0x18')](_0x347b('0x39'),_0x430ff0[_0x347b('0x1c')]),_0x8c583e);}});ami['on'](_0x347b('0x3a'),function(_0x4835c6){try{utils[_0x347b('0x17')](util[_0x347b('0x18')](_0x347b('0x3b'),_0x4835c6[_0x347b('0x1c')]),_0x4835c6);calls[_0x347b('0x3a')](_0x4835c6);recordings['newexten'](_0x4835c6);dials['newexten'](_0x4835c6);}catch(_0x7ba793){utils[_0x347b('0x14')](util[_0x347b('0x18')](_0x347b('0x3b'),_0x4835c6[_0x347b('0x1c')]),_0x7ba793);}});ami['on'](_0x347b('0x3c'),function(_0x541567){try{utils[_0x347b('0x17')](util[_0x347b('0x18')](_0x347b('0x3d'),_0x541567[_0x347b('0x1c')]),_0x541567);calls[_0x347b('0x3c')](_0x541567);recordings[_0x347b('0x3c')](_0x541567);}catch(_0x561cc4){utils[_0x347b('0x14')](util[_0x347b('0x18')](_0x347b('0x3d'),_0x541567[_0x347b('0x1c')]),_0x561cc4);}});ami['on'](_0x347b('0x3e'),function(_0x35de41){try{utils['debug'](util[_0x347b('0x18')](_0x347b('0x3f'),_0x35de41['uniqueid']),_0x35de41);dials['dialbegin'](_0x35de41);}catch(_0x50785c){utils['error'](util[_0x347b('0x18')]('[%s]dialbegin',_0x35de41[_0x347b('0x1c')]),_0x50785c);}});ami['on']('dialend',function(_0x31c2ef){try{utils[_0x347b('0x17')](util[_0x347b('0x18')](_0x347b('0x40'),_0x31c2ef[_0x347b('0x1c')]),_0x31c2ef);dials['dialend'](_0x31c2ef);}catch(_0x59e222){utils[_0x347b('0x14')](util[_0x347b('0x18')]('[%s][index][dialend]',_0x31c2ef[_0x347b('0x1c')]),_0x59e222);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b617523..95801cf 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 _0x3cb7=['[%s][members][cdr]','lodash','util','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','data1','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data3'];(function(_0x5e5189,_0x5e67d2){var _0x3c6db8=function(_0x2d7839){while(--_0x2d7839){_0x5e5189['push'](_0x5e5189['shift']());}};_0x3c6db8(++_0x5e67d2);}(_0x3cb7,0x1a8));var _0x73cb=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0x3cb7[_0x4a8bad];return _0x30cf32;};'use strict';var _=require(_0x73cb('0x0'));var util=require(_0x73cb('0x1'));var utils=require('./utils');var members={};var exclude=[_0x73cb('0x2'),_0x73cb('0x3')];function writeDB(_0x1d6827){utils[_0x73cb('0x4')](util[_0x73cb('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x1d6827[_0x73cb('0x6')],_0x1d6827['interface'],_0x1d6827[_0x73cb('0x7')],_0x1d6827[_0x73cb('0x8')],_0x1d6827[_0x73cb('0x9')],_0x1d6827[_0x73cb('0xa')]));if(_0x1d6827[_0x73cb('0xb')]){utils[_0x73cb('0xc')](_0x1d6827['interface'])[_0x73cb('0xd')](function(_0xe80a05){if(_0xe80a05){_0x1d6827[_0x73cb('0x9')]=_0xe80a05[_0x73cb('0xe')];_0x1d6827[_0x73cb('0xf')]=_0xe80a05[_0x73cb('0xf')];utils[_0x73cb('0x10')](_0x73cb('0x11'),_0x1d6827);}else{utils[_0x73cb('0x12')](_0x1d6827[_0x73cb('0xb')][_0x73cb('0x13')]('/')[0x1])[_0x73cb('0xd')](function(_0x37d9ba){if(_0x37d9ba){_0x1d6827[_0x73cb('0x9')]=_0x37d9ba['name'];_0x1d6827[_0x73cb('0xf')]=_0x37d9ba[_0x73cb('0xf')];utils[_0x73cb('0x10')]('CreateMemberReport',_0x1d6827);}});}})['catch'](function(_0x3a0a2a){utils[_0x73cb('0x14')](util[_0x73cb('0x5')]('[%s][members][writeDB]',_0x1d6827[_0x73cb('0x6')]),_0x3a0a2a);});}delete members[_0x1d6827[_0x73cb('0xb')]];}function startsWith(_0x53f53e,_0x1a1a8d){return _['some'](_0x53f53e,function(_0x32f167){return _[_0x73cb('0x15')](_0x1a1a8d,_0x32f167);});}exports[_0x73cb('0x16')]=function(_0x4caaab){try{utils[_0x73cb('0x17')](util['format'](_0x73cb('0x18'),members[_0x4caaab[_0x73cb('0x19')]]?members[_0x4caaab[_0x73cb('0x19')]]['uniqueid']:_0x4caaab[_0x73cb('0x19')]),_0x4caaab);utils[_0x73cb('0x4')](util[_0x73cb('0x5')](_0x73cb('0x1a'),members[_0x4caaab['device']]?members[_0x4caaab[_0x73cb('0x19')]][_0x73cb('0x6')]:_0x4caaab[_0x73cb('0x19')],_0x4caaab[_0x73cb('0x1b')],_0x4caaab[_0x73cb('0x19')]));switch(_0x4caaab[_0x73cb('0x1b')]){case'INUSE':case _0x73cb('0x1c'):if(!startsWith(exclude,_0x4caaab[_0x73cb('0x19')])){members[_0x4caaab['device']]={'channel':'voice','interface':_0x4caaab['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0x73cb('0x1d')};}break;case _0x73cb('0x1e'):if(!_[_0x73cb('0x1f')](members[_0x4caaab['device']])){members[_0x4caaab[_0x73cb('0x19')]][_0x73cb('0x20')]=utils[_0x73cb('0x21')]();members[_0x4caaab[_0x73cb('0x19')]][_0x73cb('0x22')]=utils[_0x73cb('0x23')](members[_0x4caaab['device']][_0x73cb('0x20')],members[_0x4caaab[_0x73cb('0x19')]]['enterAt']);if(members[_0x4caaab[_0x73cb('0x19')]][_0x73cb('0x6')]){writeDB(members[_0x4caaab['device']]);}}break;default:break;}}catch(_0x4e3d8c){utils['error'](util[_0x73cb('0x5')](_0x73cb('0x18'),members[_0x4caaab['device']]?members[_0x4caaab[_0x73cb('0x19')]]['uniqueid']:_0x4caaab[_0x73cb('0x19')]),_0x4e3d8c);}};exports[_0x73cb('0x24')]=function(_0x175be6){try{if(!_[_0x73cb('0x1f')](members[_0x175be6[_0x73cb('0xb')]])){utils[_0x73cb('0x17')](util[_0x73cb('0x5')](_0x73cb('0x25'),_0x175be6[_0x73cb('0x6')]),_0x175be6);utils[_0x73cb('0x4')](util[_0x73cb('0x5')](_0x73cb('0x26'),_0x175be6[_0x73cb('0x6')],_0x175be6[_0x73cb('0xb')],_0x175be6['queue']));members[_0x175be6['interface']]=_[_0x73cb('0x27')](members[_0x175be6[_0x73cb('0xb')]],{'data4':_0x175be6[_0x73cb('0x28')],'uniqueid':_0x175be6['uniqueid']});}}catch(_0x5d34dc){utils['error'](util[_0x73cb('0x5')](_0x73cb('0x25'),_0x175be6[_0x73cb('0x6')]),_0x5d34dc);}};exports['cdr']=function(_0x194171){try{utils[_0x73cb('0x17')](util[_0x73cb('0x5')]('[%s][members][cdr]',_0x194171[_0x73cb('0x6')]),_0x194171);if(_0x194171['channel']){var _0x1b32cf=_0x194171['channel']['split']('-')[0x0];if(!_[_0x73cb('0x1f')](members[_0x1b32cf])){members[_0x1b32cf]=_['assign'](members[_0x1b32cf],{'data1':members[_0x1b32cf][_0x73cb('0x29')]||_0x194171[_0x73cb('0xa')],'data2':members[_0x1b32cf][_0x73cb('0x8')]||_0x194171[_0x73cb('0x2a')],'data3':members[_0x1b32cf]['data3']||_0x194171['destination'],'uniqueid':members[_0x1b32cf][_0x73cb('0x6')]||_0x194171[_0x73cb('0x6')]});utils[_0x73cb('0x4')](util[_0x73cb('0x5')](_0x73cb('0x2b'),_0x194171[_0x73cb('0x6')],members[_0x1b32cf][_0x73cb('0x29')],members[_0x1b32cf][_0x73cb('0x8')],members[_0x1b32cf]['data3']));if(members[_0x1b32cf][_0x73cb('0x20')]){writeDB(members[_0x1b32cf]);}}}if(_0x194171[_0x73cb('0x2c')]){var _0x1c6dca=_0x194171[_0x73cb('0x2c')][_0x73cb('0x13')]('-')[0x0];if(!_[_0x73cb('0x1f')](members[_0x1c6dca])){members[_0x1c6dca]=_[_0x73cb('0x27')](members[_0x1c6dca],{'data1':members[_0x1c6dca]['data1']||_0x194171[_0x73cb('0xa')],'data2':members[_0x1c6dca][_0x73cb('0x8')]||_0x194171[_0x73cb('0x2a')],'data3':members[_0x1c6dca]['data3']||_0x194171['destination'],'uniqueid':members[_0x1c6dca][_0x73cb('0x6')]||_0x194171['uniqueid']});utils[_0x73cb('0x4')](util[_0x73cb('0x5')](_0x73cb('0x2b'),_0x194171['uniqueid'],members[_0x1c6dca][_0x73cb('0x29')],members[_0x1c6dca]['data2'],members[_0x1c6dca][_0x73cb('0x2d')]));if(members[_0x1c6dca][_0x73cb('0x20')]){writeDB(members[_0x1c6dca]);}}}}catch(_0x22243d){utils[_0x73cb('0x14')](util[_0x73cb('0x5')](_0x73cb('0x2e'),_0x194171[_0x73cb('0x6')]),_0x22243d);}}; \ No newline at end of file +var _0x54f3=['name','request','CreateMemberReport','catch','format','[%s][members][writeDB]','some','devicestatechange','debug','[%s][members][devicestatechange]','device','info','state','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][cdr]','channel','split','data1','data2','data3','destination','destinationchannel','type','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','getUserByInterface','then','internal','getUserByName'];(function(_0x57a2fa,_0x4ad78b){var _0x5109ce=function(_0x286f1a){while(--_0x286f1a){_0x57a2fa['push'](_0x57a2fa['shift']());}};_0x5109ce(++_0x4ad78b);}(_0x54f3,0x120));var _0x354f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x54f3[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var utils=require(_0x354f('0x1'));var members={};var exclude=[_0x354f('0x2'),_0x354f('0x3')];function writeDB(_0x2cd824){utils['info'](util['format'](_0x354f('0x4'),_0x2cd824[_0x354f('0x5')],_0x2cd824[_0x354f('0x6')],_0x2cd824['channel'],_0x2cd824['data2'],_0x2cd824[_0x354f('0x7')],_0x2cd824['type']));if(_0x2cd824[_0x354f('0x6')]){utils[_0x354f('0x8')](_0x2cd824[_0x354f('0x6')])[_0x354f('0x9')](function(_0x56e7dc){if(_0x56e7dc){_0x2cd824[_0x354f('0x7')]=_0x56e7dc['name'];_0x2cd824[_0x354f('0xa')]=_0x56e7dc[_0x354f('0xa')];utils['request']('CreateMemberReport',_0x2cd824);}else{utils[_0x354f('0xb')](_0x2cd824[_0x354f('0x6')]['split']('/')[0x1])[_0x354f('0x9')](function(_0x2a08e0){if(_0x2a08e0){_0x2cd824['membername']=_0x2a08e0[_0x354f('0xc')];_0x2cd824[_0x354f('0xa')]=_0x2a08e0[_0x354f('0xa')];utils[_0x354f('0xd')](_0x354f('0xe'),_0x2cd824);}});}})[_0x354f('0xf')](function(_0x30417a){utils['error'](util[_0x354f('0x10')](_0x354f('0x11'),_0x2cd824[_0x354f('0x5')]),_0x30417a);});}delete members[_0x2cd824['interface']];}function startsWith(_0x103388,_0x234484){return _[_0x354f('0x12')](_0x103388,function(_0x4cc0e9){return _['startsWith'](_0x234484,_0x4cc0e9);});}exports[_0x354f('0x13')]=function(_0x1d7627){try{utils[_0x354f('0x14')](util[_0x354f('0x10')](_0x354f('0x15'),members[_0x1d7627[_0x354f('0x16')]]?members[_0x1d7627[_0x354f('0x16')]]['uniqueid']:_0x1d7627[_0x354f('0x16')]),_0x1d7627);utils[_0x354f('0x17')](util[_0x354f('0x10')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x1d7627[_0x354f('0x16')]]?members[_0x1d7627['device']][_0x354f('0x5')]:_0x1d7627[_0x354f('0x16')],_0x1d7627['state'],_0x1d7627[_0x354f('0x16')]));switch(_0x1d7627[_0x354f('0x18')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x1d7627[_0x354f('0x16')])){members[_0x1d7627['device']]={'channel':'voice','interface':_0x1d7627[_0x354f('0x16')],'type':_0x354f('0x19'),'enterAt':utils[_0x354f('0x1a')](),'role':_0x354f('0x1b')};}break;case _0x354f('0x1c'):if(!_[_0x354f('0x1d')](members[_0x1d7627[_0x354f('0x16')]])){members[_0x1d7627['device']][_0x354f('0x1e')]=utils['now']();members[_0x1d7627['device']][_0x354f('0x1f')]=utils['diffTime'](members[_0x1d7627['device']][_0x354f('0x1e')],members[_0x1d7627['device']][_0x354f('0x20')]);if(members[_0x1d7627[_0x354f('0x16')]]['uniqueid']){writeDB(members[_0x1d7627[_0x354f('0x16')]]);}}break;default:break;}}catch(_0x3c5c38){utils[_0x354f('0x21')](util['format'](_0x354f('0x15'),members[_0x1d7627['device']]?members[_0x1d7627[_0x354f('0x16')]][_0x354f('0x5')]:_0x1d7627[_0x354f('0x16')]),_0x3c5c38);}};exports[_0x354f('0x22')]=function(_0x596b48){try{if(!_[_0x354f('0x1d')](members[_0x596b48[_0x354f('0x6')]])){utils[_0x354f('0x14')](util[_0x354f('0x10')](_0x354f('0x23'),_0x596b48['uniqueid']),_0x596b48);utils['info'](util[_0x354f('0x10')](_0x354f('0x24'),_0x596b48[_0x354f('0x5')],_0x596b48[_0x354f('0x6')],_0x596b48['queue']));members[_0x596b48['interface']]=_[_0x354f('0x25')](members[_0x596b48[_0x354f('0x6')]],{'data4':_0x596b48[_0x354f('0x26')],'uniqueid':_0x596b48[_0x354f('0x5')]});}}catch(_0x49d25b){utils[_0x354f('0x21')](util[_0x354f('0x10')](_0x354f('0x23'),_0x596b48[_0x354f('0x5')]),_0x49d25b);}};exports['cdr']=function(_0x4fb394){try{utils[_0x354f('0x14')](util[_0x354f('0x10')](_0x354f('0x27'),_0x4fb394[_0x354f('0x5')]),_0x4fb394);if(_0x4fb394[_0x354f('0x28')]){var _0x18fc0c=_0x4fb394[_0x354f('0x28')][_0x354f('0x29')]('-')[0x0];if(!_[_0x354f('0x1d')](members[_0x18fc0c])){members[_0x18fc0c]=_[_0x354f('0x25')](members[_0x18fc0c],{'data1':members[_0x18fc0c][_0x354f('0x2a')]||_0x4fb394['type'],'data2':members[_0x18fc0c][_0x354f('0x2b')]||_0x4fb394['source'],'data3':members[_0x18fc0c][_0x354f('0x2c')]||_0x4fb394[_0x354f('0x2d')],'uniqueid':members[_0x18fc0c][_0x354f('0x5')]||_0x4fb394[_0x354f('0x5')]});utils[_0x354f('0x17')](util[_0x354f('0x10')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4fb394[_0x354f('0x5')],members[_0x18fc0c][_0x354f('0x2a')],members[_0x18fc0c]['data2'],members[_0x18fc0c][_0x354f('0x2c')]));if(members[_0x18fc0c][_0x354f('0x1e')]){writeDB(members[_0x18fc0c]);}}}if(_0x4fb394[_0x354f('0x2e')]){var _0x572469=_0x4fb394[_0x354f('0x2e')][_0x354f('0x29')]('-')[0x0];if(!_[_0x354f('0x1d')](members[_0x572469])){members[_0x572469]=_[_0x354f('0x25')](members[_0x572469],{'data1':members[_0x572469]['data1']||_0x4fb394[_0x354f('0x2f')],'data2':members[_0x572469]['data2']||_0x4fb394[_0x354f('0x30')],'data3':members[_0x572469][_0x354f('0x2c')]||_0x4fb394[_0x354f('0x2d')],'uniqueid':members[_0x572469][_0x354f('0x5')]||_0x4fb394[_0x354f('0x5')]});utils['info'](util['format'](_0x354f('0x31'),_0x4fb394[_0x354f('0x5')],members[_0x572469][_0x354f('0x2a')],members[_0x572469][_0x354f('0x2b')],members[_0x572469][_0x354f('0x2c')]));if(members[_0x572469][_0x354f('0x1e')]){writeDB(members[_0x572469]);}}}}catch(_0x58ae82){utils[_0x354f('0x21')](util[_0x354f('0x10')](_0x354f('0x27'),_0x4fb394[_0x354f('0x5')]),_0x58ae82);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4824fbf..0e7ba94 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 _0x12c2=['secondtransfereruniqueid','secondtransfererexten','transferexten','transfertargetlinkedid','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][hangup]','varset','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','lastAssignedTo','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s'];(function(_0x595c93,_0x1461f7){var _0x41b4d3=function(_0x4ef564){while(--_0x4ef564){_0x595c93['push'](_0x595c93['shift']());}};_0x41b4d3(++_0x1461f7);}(_0x12c2,0x1a2));var _0x212c=function(_0x1f76cf,_0x2f78c2){_0x1f76cf=_0x1f76cf-0x0;var _0x3f01bc=_0x12c2[_0x1f76cf];return _0x3f01bc;};'use strict';var _=require(_0x212c('0x0'));var util=require(_0x212c('0x1'));var utils=require(_0x212c('0x2'));var queues={};function writeDB(_0x2bb862){utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x5'),_0x2bb862[_0x212c('0x6')],_0x2bb862['channel'],_0x2bb862[_0x212c('0x7')],_0x2bb862['lastAssignedTo'],_0x2bb862[_0x212c('0x8')],_0x2bb862[_0x212c('0x9')],_0x2bb862[_0x212c('0xa')]));if(_0x2bb862['queue']){utils[_0x212c('0xb')](_0x2bb862[_0x212c('0x7')])[_0x212c('0xc')](function(_0x400d27){if(_0x400d27){_0x2bb862['type']=_0x400d27[_0x212c('0xd')];}utils[_0x212c('0xe')]('CreateVoiceQueueReport',_0x2bb862);});}else{utils['request'](_0x212c('0xf'),_0x2bb862);}if(_0x2bb862[_0x212c('0x10')]){delete queues[_0x2bb862[_0x212c('0x10')]];}else{delete queues[_0x2bb862[_0x212c('0x6')]];}}exports[_0x212c('0x11')]=function(_0x69b883){try{utils[_0x212c('0x12')](util[_0x212c('0x4')](_0x212c('0x13'),_0x69b883[_0x212c('0x6')]),_0x69b883);utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x14'),_0x69b883[_0x212c('0x6')],_0x69b883[_0x212c('0x7')],_0x69b883[_0x212c('0x15')]));queues[_0x69b883[_0x212c('0x6')]]=_[_0x212c('0x16')](_0x69b883,{'originalposition':_0x69b883[_0x212c('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0xfe9b7b){utils['error'](util[_0x212c('0x4')](_0x212c('0x13'),_0x69b883['uniqueid']),_0xfe9b7b);}};exports[_0x212c('0x17')]=function(_0x405737){try{if(!_[_0x212c('0x18')](queues[_0x405737['uniqueid']])){utils[_0x212c('0x12')](util[_0x212c('0x4')]('[%s][queues][hangup]',_0x405737[_0x212c('0x6')]),_0x405737);if(queues[_0x405737['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x405737[_0x212c('0x6')]][_0x212c('0x19')]&&!queues[_0x405737[_0x212c('0x6')]][_0x212c('0x1a')]){queues[_0x405737[_0x212c('0x6')]]['queuecallercomplete']=!![];queues[_0x405737[_0x212c('0x6')]][_0x212c('0x1b')]=utils[_0x212c('0x1c')]();queues[_0x405737[_0x212c('0x6')]]['queuecallerexitreason']=_0x212c('0x1d');}utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x1e'),_0x405737['uniqueid'],queues[_0x405737[_0x212c('0x6')]][_0x212c('0x1f')],queues[_0x405737[_0x212c('0x6')]][_0x212c('0xa')]));writeDB(queues[_0x405737['uniqueid']]);}else if(queues[_0x405737['uniqueid']][_0x212c('0x10')]){utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x20'),_0x405737['uniqueid'],queues[_0x405737[_0x212c('0x6')]]['name'],queues[_0x405737[_0x212c('0x6')]][_0x212c('0x10')]));queues[queues[_0x405737['uniqueid']][_0x212c('0x10')]]=queues[_0x405737[_0x212c('0x6')]];queues[queues[_0x405737['uniqueid']]['transfereduniqueid']][_0x212c('0x21')]=0x2;delete queues[_0x405737[_0x212c('0x6')]];}}}catch(_0x13509f){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x23'),_0x405737[_0x212c('0x6')]),_0x13509f);}};exports[_0x212c('0x24')]=function(_0x26e9d6){try{utils[_0x212c('0x12')](util[_0x212c('0x4')]('[%s][queues][varset]',_0x26e9d6[_0x212c('0x6')]),_0x26e9d6);if(!_['isNil'](_0x26e9d6[_0x212c('0x25')][_0x212c('0x26')])&&_0x26e9d6[_0x212c('0x27')][_0x212c('0x28')]()!=='CONTINUE'){if(!_[_0x212c('0x18')](queues[_0x26e9d6[_0x212c('0x6')]])){queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x19')]=![];queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x29')]=null;queues[_0x26e9d6[_0x212c('0x6')]]['queuecallerexit']=!![];queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x2a')]=utils[_0x212c('0x1c')]();queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0xa')]=_0x26e9d6[_0x212c('0x27')][_0x212c('0x28')]();utils[_0x212c('0x3')](util['format'](_0x212c('0x2b'),_0x26e9d6[_0x212c('0x6')],queues[_0x26e9d6['uniqueid']][_0x212c('0x1f')],_0x26e9d6[_0x212c('0x27')],queues[_0x26e9d6['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x26e9d6[_0x212c('0x6')]]);}}else if(!_[_0x212c('0x18')](_0x26e9d6[_0x212c('0x25')][_0x212c('0x2c')])){if(!_[_0x212c('0x18')](queues[_0x26e9d6[_0x212c('0x6')]])&&!queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x19')]){queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x19')]=![];queues[_0x26e9d6['uniqueid']][_0x212c('0x29')]=null;queues[_0x26e9d6[_0x212c('0x6')]]['queuecallerexit']=!![];queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x2a')]=utils[_0x212c('0x1c')]();queues[_0x26e9d6[_0x212c('0x6')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x2d'),_0x26e9d6['uniqueid'],queues[_0x26e9d6[_0x212c('0x6')]]['name'],_0x26e9d6['value'],queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0xa')]));}}}catch(_0x25ec5a){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x2e'),_0x26e9d6[_0x212c('0x6')]),_0x25ec5a);}};exports[_0x212c('0x19')]=function(_0x3263ce){try{if(!_[_0x212c('0x18')](queues[_0x3263ce['uniqueid']])){utils[_0x212c('0x12')](util[_0x212c('0x4')]('[%s][queues][queuecallerabandon]',_0x3263ce[_0x212c('0x6')]),_0x3263ce);queues[_0x3263ce['uniqueid']][_0x212c('0x1a')]=![];queues[_0x3263ce[_0x212c('0x6')]][_0x212c('0x2a')]=null;queues[_0x3263ce[_0x212c('0x6')]][_0x212c('0x19')]=!![];queues[_0x3263ce[_0x212c('0x6')]][_0x212c('0x29')]=utils[_0x212c('0x1c')]();queues[_0x3263ce['uniqueid']][_0x212c('0xa')]='ABANDONED';utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x2f'),_0x3263ce[_0x212c('0x6')],queues[_0x3263ce['uniqueid']][_0x212c('0x1f')],queues[_0x3263ce[_0x212c('0x6')]][_0x212c('0xa')]));}}catch(_0x4d27a5){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x30'),_0x3263ce[_0x212c('0x6')]),_0x4d27a5);}};exports[_0x212c('0x31')]=function(_0x4f0904){try{if(!_['isNil'](queues[_0x4f0904[_0x212c('0x6')]])){utils[_0x212c('0x12')](util[_0x212c('0x4')](_0x212c('0x32'),_0x4f0904['uniqueid']),_0x4f0904);utils[_0x212c('0x3')](util['format'](_0x212c('0x33'),_0x4f0904[_0x212c('0x6')],queues[_0x4f0904[_0x212c('0x6')]]['name'],_0x4f0904['connectedlinenum'],_0x4f0904[_0x212c('0x34')]));queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x31')]=!![];queues[_0x4f0904['uniqueid']][_0x212c('0x35')]=utils[_0x212c('0x1c')]();queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x36')]=utils[_0x212c('0x37')](queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x35')],queues[_0x4f0904['uniqueid']][_0x212c('0x38')]);queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x15')]=_0x4f0904['position'];queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x39')]=_0x4f0904[_0x212c('0x39')];queues[_0x4f0904['uniqueid']]['connectedlinenum']=_0x4f0904['connectedlinenum'];queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x34')]=_0x4f0904['connectedlinename'];}}catch(_0x5d1875){utils[_0x212c('0x22')](util[_0x212c('0x4')]('[%s][queues][queuecallerleave]',_0x4f0904[_0x212c('0x6')]),_0x5d1875);}};exports['agentconnect']=function(_0x23d5ec){try{if(!_[_0x212c('0x18')](queues[_0x23d5ec[_0x212c('0x6')]])){utils['debug'](util[_0x212c('0x4')](_0x212c('0x3a'),_0x23d5ec[_0x212c('0x6')]),_0x23d5ec);utils[_0x212c('0x3')](util['format'](_0x212c('0x3b'),_0x23d5ec[_0x212c('0x6')],queues[_0x23d5ec[_0x212c('0x6')]][_0x212c('0x1f')],_0x23d5ec[_0x212c('0x3c')],_0x23d5ec[_0x212c('0x3d')]));queues[_0x23d5ec['uniqueid']][_0x212c('0x19')]=![];queues[_0x23d5ec[_0x212c('0x6')]][_0x212c('0x19')]=![];queues[_0x23d5ec[_0x212c('0x6')]][_0x212c('0x29')]=null;queues[_0x23d5ec[_0x212c('0x6')]][_0x212c('0x1a')]=![];queues[_0x23d5ec['uniqueid']][_0x212c('0xa')]=null;queues[_0x23d5ec['uniqueid']][_0x212c('0x2a')]=null;queues[_0x23d5ec[_0x212c('0x6')]]['assigned']=!![];queues[_0x23d5ec[_0x212c('0x6')]]['accountcode']=_0x23d5ec[_0x212c('0x3d')];queues[_0x23d5ec[_0x212c('0x6')]]['lastAssignedTo']=_0x23d5ec[_0x212c('0x3c')];}}catch(_0xfa2875){utils[_0x212c('0x22')](util['format'](_0x212c('0x3a'),_0x23d5ec[_0x212c('0x6')]),_0xfa2875);}};exports[_0x212c('0x3e')]=function(_0x434fd4){try{if(!_[_0x212c('0x18')](queues[_0x434fd4[_0x212c('0x6')]])){if(queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x35')]){utils[_0x212c('0x12')](util['format'](_0x212c('0x3f'),_0x434fd4['uniqueid']),_0x434fd4);queues[_0x434fd4[_0x212c('0x6')]]['queuecallerabandon']=![];queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x19')]=![];queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x29')]=null;queues[_0x434fd4[_0x212c('0x6')]]['queuecallerexit']=![];queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x2a')]=null;queues[_0x434fd4['uniqueid']][_0x212c('0x40')]=!![];queues[_0x434fd4['uniqueid']][_0x212c('0x41')]=_0x434fd4['membername'];queues[_0x434fd4['uniqueid']][_0x212c('0x42')]=!![];queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x1b')]=utils[_0x212c('0x1c')]();if(_0x434fd4[_0x212c('0x43')]==_0x212c('0x44')){if(!queues[_0x434fd4['uniqueid']][_0x212c('0x44')]){queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0xa')]=_0x212c('0x45');}}else{queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0xa')]=_0x212c('0x46')+_0x434fd4[_0x212c('0x43')][_0x212c('0x28')]();}utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x47'),_0x434fd4[_0x212c('0x6')],queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x1f')],_0x434fd4[_0x212c('0x3c')],queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0xa')]));writeDB(queues[_0x434fd4[_0x212c('0x6')]]);}}}catch(_0x3b9fcd){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x3f'),_0x434fd4[_0x212c('0x6')]),_0x3b9fcd);}};exports[_0x212c('0x48')]=function(_0x272e0a){try{if(!_[_0x212c('0x18')](queues[_0x272e0a['transfereeuniqueid']])){utils['debug'](util['format'](_0x212c('0x49'),_0x272e0a[_0x212c('0x6')]),_0x272e0a);queues[_0x272e0a[_0x212c('0x4a')]]['transfer']=!![];queues[_0x272e0a[_0x212c('0x4a')]][_0x212c('0x4b')]='BLIND';queues[_0x272e0a[_0x212c('0x4a')]]['transferexten']=_0x272e0a['extension'];queues[_0x272e0a[_0x212c('0x4a')]]['transferuniqueid']=_0x272e0a[_0x212c('0x4a')];queues[_0x272e0a[_0x212c('0x4a')]][_0x212c('0xa')]=_0x212c('0x4c');utils['info'](util['format'](_0x212c('0x4d'),_0x272e0a[_0x212c('0x6')],queues[_0x272e0a['transfereeuniqueid']][_0x212c('0x1f')],_0x272e0a[_0x212c('0x4a')],_0x272e0a[_0x212c('0x4e')]));}}catch(_0x2fce37){utils[_0x212c('0x22')](util['format'](_0x212c('0x49'),_0x272e0a[_0x212c('0x6')]),_0x2fce37);}};exports['attendedtransfer']=function(_0x52f83b){try{utils[_0x212c('0x12')](util[_0x212c('0x4')](_0x212c('0x4f'),_0x52f83b[_0x212c('0x50')]),_0x52f83b);if(_0x52f83b[_0x212c('0x50')]==_0x52f83b['origtransfererlinkedid']){if(!_['isNil'](queues[_0x52f83b[_0x212c('0x51')]])){utils[_0x212c('0x3')](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x51')]]['name'],_0x52f83b[_0x212c('0x52')]));queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x44')]=!![];queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x4b')]=_0x212c('0x53');queues[_0x52f83b[_0x212c('0x51')]]['transferexten']=_0x52f83b[_0x212c('0x52')];queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x54')]=_0x52f83b['origtransfereruniqueid'];queues[_0x52f83b[_0x212c('0x51')]]['queuecallerexitreason']=_0x212c('0x55');}if(!_[_0x212c('0x18')](queues[_0x52f83b[_0x212c('0x56')]])){if(_0x52f83b['transfereelinkedid']&&queues[_0x52f83b[_0x212c('0x57')]]){queues[_0x52f83b['transfereelinkedid']][_0x212c('0x21')]=0x1;queues[_0x52f83b['transfereeuniqueid']]=_['clone'](queues[_0x52f83b['transfereelinkedid']]);queues[_0x52f83b['transfereeuniqueid']][_0x212c('0x10')]=_0x52f83b[_0x212c('0x58')];queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x21')]=0x2;queues[_0x52f83b[_0x212c('0x4a')]]['calleridnum']=queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x8')];queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x59')]=queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x59')];queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x38')]=utils[_0x212c('0x1c')]();queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x35')]=utils[_0x212c('0x1c')]();queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x36')]=0x0;queues[_0x52f83b[_0x212c('0x4a')]]['mohtime']=0x0;utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x5a'),_0x52f83b[_0x212c('0x50')],queues[_0x52f83b['transfereeuniqueid']]['name'],queues[_0x52f83b['transfereeuniqueid']][_0x212c('0x8')],queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x59')]));}else{utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x5b'),_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x1f')],_0x52f83b[_0x212c('0x51')]));queues[_0x52f83b[_0x212c('0x56')]]['transfereduniqueid']=_0x52f83b['secondtransfererlinkedid'];}}}else if(_0x52f83b['secondtransfereruniqueid']==_0x52f83b[_0x212c('0x51')]){if(!_['isNil'](queues[_0x52f83b[_0x212c('0x56')]])){utils[_0x212c('0x3')](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x1f')],_0x52f83b[_0x212c('0x5c')],_0x52f83b[_0x212c('0x5d')]));queues[_0x52f83b[_0x212c('0x56')]]['transfer']=!![];queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x4b')]=_0x212c('0x53');queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x5e')]=_0x52f83b[_0x212c('0x5d')];queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x54')]=_0x52f83b['secondtransfereruniqueid'];queues[_0x52f83b[_0x212c('0x56')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x52f83b[_0x212c('0x51')]])){if(_0x52f83b[_0x212c('0x5f')]&&queues[_0x52f83b[_0x212c('0x5f')]]){queues[_0x52f83b[_0x212c('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x52f83b[_0x212c('0x58')]]=_['clone'](queues[_0x52f83b['transfertargetlinkedid']]);queues[_0x52f83b['transfertargetuniqueid']][_0x212c('0x10')]=_0x52f83b[_0x212c('0x58')];queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x21')]=0x2;queues[_0x52f83b['transfertargetuniqueid']][_0x212c('0x8')]=queues[_0x52f83b[_0x212c('0x56')]]['calleridnum'];queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x59')]=queues[_0x52f83b['origtransfererlinkedid']][_0x212c('0x59')];queues[_0x52f83b[_0x212c('0x58')]]['queuecallerjoinAt']=utils[_0x212c('0x1c')]();queues[_0x52f83b[_0x212c('0x58')]]['queuecallerleaveAt']=utils['now']();queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x36')]=0x0;queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x60')]=0x0;utils['info'](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x1f')],queues[_0x52f83b[_0x212c('0x58')]]['transfereduniqueid'],queues[_0x52f83b['transfertargetuniqueid']][_0x212c('0x8')],queues[_0x52f83b[_0x212c('0x58')]]['calleridname']));}else{utils['info'](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x1f')],_0x52f83b['origtransfererlinkedid']));queues[_0x52f83b['secondtransfererlinkedid']][_0x212c('0x10')]=_0x52f83b[_0x212c('0x56')];}}}}catch(_0x5e75e9){utils['error'](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]',_0x52f83b[_0x212c('0x50')]),_0x5e75e9);}};exports[_0x212c('0x61')]=function(_0x12f6df){try{if(!_['isNil'](queues[_0x12f6df[_0x212c('0x6')]])){utils[_0x212c('0x12')](util['format'](_0x212c('0x62'),_0x12f6df['uniqueid']),_0x12f6df);queues[_0x12f6df[_0x212c('0x6')]][_0x212c('0x63')]=utils[_0x212c('0x1c')]();utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x64'),_0x12f6df[_0x212c('0x6')],queues[_0x12f6df[_0x212c('0x6')]][_0x212c('0x1f')],queues[_0x12f6df[_0x212c('0x6')]][_0x212c('0x63')]));}}catch(_0x155b12){utils['error'](util['format'](_0x212c('0x62'),_0x12f6df['uniqueid']),_0x155b12);}};exports['musiconholdstop']=function(_0xb7ab5){try{if(!_[_0x212c('0x18')](queues[_0xb7ab5[_0x212c('0x6')]])){if(!_[_0x212c('0x18')](queues[_0xb7ab5[_0x212c('0x6')]]['musiconholdstartAt'])){utils[_0x212c('0x12')](util[_0x212c('0x4')]('[%s][queues][musiconholdstop]',_0xb7ab5['uniqueid']),_0xb7ab5);queues[_0xb7ab5[_0x212c('0x6')]]['mohtime']+=utils['diffTime'](utils[_0x212c('0x1c')](),queues[_0xb7ab5[_0x212c('0x6')]][_0x212c('0x63')]);utils[_0x212c('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xb7ab5[_0x212c('0x6')],queues[_0xb7ab5[_0x212c('0x6')]][_0x212c('0x1f')],queues[_0xb7ab5['uniqueid']][_0x212c('0x60')]));delete queues[_0xb7ab5[_0x212c('0x6')]][_0x212c('0x63')];}}}catch(_0x47e8ea){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x65'),_0xb7ab5[_0x212c('0x6')]),_0x47e8ea);}}; \ No newline at end of file +var _0x01f4=['BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridnum','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transferuniqueid','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','getVoiceQueueByName','then','type','request','transfereduniqueid','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','error','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queuecallerexitreason','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid'];(function(_0x43b498,_0x174b58){var _0x3d855e=function(_0x1946a8){while(--_0x1946a8){_0x43b498['push'](_0x43b498['shift']());}};_0x3d855e(++_0x174b58);}(_0x01f4,0xf5));var _0x401f=function(_0x303730,_0x1cd67e){_0x303730=_0x303730-0x0;var _0x3c9855=_0x01f4[_0x303730];return _0x3c9855;};'use strict';var _=require(_0x401f('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x2e9be8){utils[_0x401f('0x1')](util['format'](_0x401f('0x2'),_0x2e9be8[_0x401f('0x3')],_0x2e9be8[_0x401f('0x4')],_0x2e9be8[_0x401f('0x5')],_0x2e9be8[_0x401f('0x6')],_0x2e9be8['calleridnum'],_0x2e9be8['accountcode'],_0x2e9be8['queuecallerexitreason']));if(_0x2e9be8[_0x401f('0x5')]){utils[_0x401f('0x7')](_0x2e9be8[_0x401f('0x5')])[_0x401f('0x8')](function(_0x31e07c){if(_0x31e07c){_0x2e9be8[_0x401f('0x9')]=_0x31e07c[_0x401f('0x9')];}utils[_0x401f('0xa')]('CreateVoiceQueueReport',_0x2e9be8);});}else{utils['request']('CreateVoiceQueueReport',_0x2e9be8);}if(_0x2e9be8[_0x401f('0xb')]){delete queues[_0x2e9be8[_0x401f('0xb')]];}else{delete queues[_0x2e9be8[_0x401f('0x3')]];}}exports['queuecallerjoin']=function(_0x13b6fc){try{utils[_0x401f('0xc')](util[_0x401f('0xd')]('[%s][queues][queuecallerjoin]',_0x13b6fc[_0x401f('0x3')]),_0x13b6fc);utils['info'](util[_0x401f('0xd')](_0x401f('0xe'),_0x13b6fc[_0x401f('0x3')],_0x13b6fc[_0x401f('0x5')],_0x13b6fc[_0x401f('0xf')]));queues[_0x13b6fc[_0x401f('0x3')]]=_[_0x401f('0x10')](_0x13b6fc,{'originalposition':_0x13b6fc['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x1a22c9){utils['error'](util['format'](_0x401f('0x11'),_0x13b6fc[_0x401f('0x3')]),_0x1a22c9);}};exports[_0x401f('0x12')]=function(_0x128dec){try{if(!_[_0x401f('0x13')](queues[_0x128dec[_0x401f('0x3')]])){utils[_0x401f('0xc')](util[_0x401f('0xd')](_0x401f('0x14'),_0x128dec['uniqueid']),_0x128dec);if(queues[_0x128dec['uniqueid']][_0x401f('0x15')]){if(!queues[_0x128dec[_0x401f('0x3')]][_0x401f('0x16')]&&!queues[_0x128dec[_0x401f('0x3')]][_0x401f('0x17')]){queues[_0x128dec[_0x401f('0x3')]][_0x401f('0x18')]=!![];queues[_0x128dec[_0x401f('0x3')]][_0x401f('0x19')]=utils[_0x401f('0x1a')]();queues[_0x128dec[_0x401f('0x3')]]['queuecallerexitreason']=_0x401f('0x1b');}utils['info'](util[_0x401f('0xd')](_0x401f('0x1c'),_0x128dec[_0x401f('0x3')],queues[_0x128dec['uniqueid']]['name'],queues[_0x128dec[_0x401f('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x128dec[_0x401f('0x3')]]);}else if(queues[_0x128dec[_0x401f('0x3')]][_0x401f('0xb')]){utils[_0x401f('0x1')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x128dec[_0x401f('0x3')],queues[_0x128dec[_0x401f('0x3')]]['name'],queues[_0x128dec[_0x401f('0x3')]]['transfereduniqueid']));queues[queues[_0x128dec[_0x401f('0x3')]]['transfereduniqueid']]=queues[_0x128dec[_0x401f('0x3')]];queues[queues[_0x128dec[_0x401f('0x3')]][_0x401f('0xb')]]['queuecallerenterreason']=0x2;delete queues[_0x128dec[_0x401f('0x3')]];}}}catch(_0xd09486){utils[_0x401f('0x1d')](util[_0x401f('0xd')](_0x401f('0x14'),_0x128dec[_0x401f('0x3')]),_0xd09486);}};exports[_0x401f('0x1e')]=function(_0x4c1945){try{utils[_0x401f('0xc')](util[_0x401f('0xd')](_0x401f('0x1f'),_0x4c1945['uniqueid']),_0x4c1945);if(!_[_0x401f('0x13')](_0x4c1945[_0x401f('0x20')][_0x401f('0x21')])&&_0x4c1945[_0x401f('0x22')][_0x401f('0x23')]()!==_0x401f('0x24')){if(!_[_0x401f('0x13')](queues[_0x4c1945['uniqueid']])){queues[_0x4c1945['uniqueid']][_0x401f('0x16')]=![];queues[_0x4c1945[_0x401f('0x3')]]['queuecallerabandonAt']=null;queues[_0x4c1945[_0x401f('0x3')]]['queuecallerexit']=!![];queues[_0x4c1945[_0x401f('0x3')]][_0x401f('0x25')]=utils[_0x401f('0x1a')]();queues[_0x4c1945[_0x401f('0x3')]][_0x401f('0x26')]=_0x4c1945[_0x401f('0x22')][_0x401f('0x23')]();utils[_0x401f('0x1')](util[_0x401f('0xd')](_0x401f('0x27'),_0x4c1945[_0x401f('0x3')],queues[_0x4c1945[_0x401f('0x3')]][_0x401f('0x28')],_0x4c1945[_0x401f('0x22')],queues[_0x4c1945[_0x401f('0x3')]][_0x401f('0x26')]));writeDB(queues[_0x4c1945[_0x401f('0x3')]]);}}else if(!_[_0x401f('0x13')](_0x4c1945[_0x401f('0x20')]['queueposition'])){if(!_[_0x401f('0x13')](queues[_0x4c1945[_0x401f('0x3')]])&&!queues[_0x4c1945[_0x401f('0x3')]][_0x401f('0x16')]){queues[_0x4c1945['uniqueid']][_0x401f('0x16')]=![];queues[_0x4c1945[_0x401f('0x3')]][_0x401f('0x29')]=null;queues[_0x4c1945['uniqueid']][_0x401f('0x17')]=!![];queues[_0x4c1945[_0x401f('0x3')]]['queuecallerexitAt']=utils[_0x401f('0x1a')]();queues[_0x4c1945[_0x401f('0x3')]]['queuecallerexitreason']=_0x401f('0x2a');utils[_0x401f('0x1')](util[_0x401f('0xd')](_0x401f('0x2b'),_0x4c1945[_0x401f('0x3')],queues[_0x4c1945[_0x401f('0x3')]][_0x401f('0x28')],_0x4c1945[_0x401f('0x22')],queues[_0x4c1945[_0x401f('0x3')]][_0x401f('0x26')]));}}}catch(_0x154218){utils['error'](util[_0x401f('0xd')](_0x401f('0x1f'),_0x4c1945[_0x401f('0x3')]),_0x154218);}};exports[_0x401f('0x16')]=function(_0x59196c){try{if(!_['isNil'](queues[_0x59196c[_0x401f('0x3')]])){utils[_0x401f('0xc')](util[_0x401f('0xd')](_0x401f('0x2c'),_0x59196c[_0x401f('0x3')]),_0x59196c);queues[_0x59196c['uniqueid']][_0x401f('0x17')]=![];queues[_0x59196c[_0x401f('0x3')]][_0x401f('0x25')]=null;queues[_0x59196c[_0x401f('0x3')]][_0x401f('0x16')]=!![];queues[_0x59196c[_0x401f('0x3')]][_0x401f('0x29')]=utils[_0x401f('0x1a')]();queues[_0x59196c[_0x401f('0x3')]]['queuecallerexitreason']=_0x401f('0x2d');utils[_0x401f('0x1')](util['format'](_0x401f('0x2e'),_0x59196c[_0x401f('0x3')],queues[_0x59196c['uniqueid']][_0x401f('0x28')],queues[_0x59196c[_0x401f('0x3')]][_0x401f('0x26')]));}}catch(_0x426674){utils[_0x401f('0x1d')](util['format'](_0x401f('0x2c'),_0x59196c[_0x401f('0x3')]),_0x426674);}};exports[_0x401f('0x2f')]=function(_0x54a618){try{if(!_[_0x401f('0x13')](queues[_0x54a618[_0x401f('0x3')]])){utils['debug'](util[_0x401f('0xd')]('[%s][queues][queuecallerleave]',_0x54a618[_0x401f('0x3')]),_0x54a618);utils[_0x401f('0x1')](util['format'](_0x401f('0x30'),_0x54a618[_0x401f('0x3')],queues[_0x54a618[_0x401f('0x3')]][_0x401f('0x28')],_0x54a618[_0x401f('0x31')],_0x54a618['connectedlinename']));queues[_0x54a618[_0x401f('0x3')]][_0x401f('0x2f')]=!![];queues[_0x54a618['uniqueid']][_0x401f('0x15')]=utils['now']();queues[_0x54a618[_0x401f('0x3')]]['holdtime']=utils['diffTime'](queues[_0x54a618['uniqueid']]['queuecallerleaveAt'],queues[_0x54a618[_0x401f('0x3')]][_0x401f('0x32')]);queues[_0x54a618[_0x401f('0x3')]][_0x401f('0xf')]=_0x54a618[_0x401f('0xf')];queues[_0x54a618[_0x401f('0x3')]][_0x401f('0x33')]=_0x54a618[_0x401f('0x33')];queues[_0x54a618[_0x401f('0x3')]]['connectedlinenum']=_0x54a618[_0x401f('0x31')];queues[_0x54a618['uniqueid']][_0x401f('0x34')]=_0x54a618[_0x401f('0x34')];}}catch(_0x30aa84){utils[_0x401f('0x1d')](util[_0x401f('0xd')]('[%s][queues][queuecallerleave]',_0x54a618[_0x401f('0x3')]),_0x30aa84);}};exports[_0x401f('0x35')]=function(_0x50d1b4){try{if(!_[_0x401f('0x13')](queues[_0x50d1b4['uniqueid']])){utils[_0x401f('0xc')](util[_0x401f('0xd')](_0x401f('0x36'),_0x50d1b4[_0x401f('0x3')]),_0x50d1b4);utils['info'](util[_0x401f('0xd')](_0x401f('0x37'),_0x50d1b4['uniqueid'],queues[_0x50d1b4[_0x401f('0x3')]]['name'],_0x50d1b4[_0x401f('0x38')],_0x50d1b4['destaccountcode']));queues[_0x50d1b4[_0x401f('0x3')]][_0x401f('0x16')]=![];queues[_0x50d1b4[_0x401f('0x3')]][_0x401f('0x16')]=![];queues[_0x50d1b4['uniqueid']]['queuecallerabandonAt']=null;queues[_0x50d1b4[_0x401f('0x3')]][_0x401f('0x17')]=![];queues[_0x50d1b4[_0x401f('0x3')]][_0x401f('0x26')]=null;queues[_0x50d1b4[_0x401f('0x3')]][_0x401f('0x25')]=null;queues[_0x50d1b4[_0x401f('0x3')]][_0x401f('0x39')]=!![];queues[_0x50d1b4['uniqueid']][_0x401f('0x3a')]=_0x50d1b4[_0x401f('0x3b')];queues[_0x50d1b4['uniqueid']][_0x401f('0x6')]=_0x50d1b4['membername'];}}catch(_0x2f4bfb){utils[_0x401f('0x1d')](util[_0x401f('0xd')](_0x401f('0x36'),_0x50d1b4[_0x401f('0x3')]),_0x2f4bfb);}};exports[_0x401f('0x3c')]=function(_0x323d97){try{if(!_[_0x401f('0x13')](queues[_0x323d97[_0x401f('0x3')]])){if(queues[_0x323d97[_0x401f('0x3')]]['queuecallerleaveAt']){utils[_0x401f('0xc')](util[_0x401f('0xd')](_0x401f('0x3d'),_0x323d97['uniqueid']),_0x323d97);queues[_0x323d97['uniqueid']][_0x401f('0x16')]=![];queues[_0x323d97[_0x401f('0x3')]]['queuecallerabandon']=![];queues[_0x323d97['uniqueid']][_0x401f('0x29')]=null;queues[_0x323d97[_0x401f('0x3')]]['queuecallerexit']=![];queues[_0x323d97['uniqueid']][_0x401f('0x25')]=null;queues[_0x323d97[_0x401f('0x3')]][_0x401f('0x39')]=!![];queues[_0x323d97[_0x401f('0x3')]][_0x401f('0x6')]=_0x323d97['membername'];queues[_0x323d97[_0x401f('0x3')]][_0x401f('0x18')]=!![];queues[_0x323d97[_0x401f('0x3')]][_0x401f('0x19')]=utils[_0x401f('0x1a')]();if(_0x323d97[_0x401f('0x3e')]==_0x401f('0x3f')){if(!queues[_0x323d97[_0x401f('0x3')]]['transfer']){queues[_0x323d97[_0x401f('0x3')]][_0x401f('0x26')]=_0x401f('0x40');}}else{queues[_0x323d97['uniqueid']][_0x401f('0x26')]=_0x401f('0x41')+_0x323d97[_0x401f('0x3e')][_0x401f('0x23')]();}utils[_0x401f('0x1')](util[_0x401f('0xd')](_0x401f('0x42'),_0x323d97[_0x401f('0x3')],queues[_0x323d97[_0x401f('0x3')]]['name'],_0x323d97[_0x401f('0x38')],queues[_0x323d97[_0x401f('0x3')]][_0x401f('0x26')]));writeDB(queues[_0x323d97[_0x401f('0x3')]]);}}}catch(_0x5c80ce){utils[_0x401f('0x1d')](util['format'](_0x401f('0x3d'),_0x323d97[_0x401f('0x3')]),_0x5c80ce);}};exports[_0x401f('0x43')]=function(_0x3302e4){try{if(!_[_0x401f('0x13')](queues[_0x3302e4['transfereeuniqueid']])){utils[_0x401f('0xc')](util['format'](_0x401f('0x44'),_0x3302e4[_0x401f('0x3')]),_0x3302e4);queues[_0x3302e4[_0x401f('0x45')]][_0x401f('0x3f')]=!![];queues[_0x3302e4[_0x401f('0x45')]]['transfertype']=_0x401f('0x46');queues[_0x3302e4['transfereeuniqueid']][_0x401f('0x47')]=_0x3302e4[_0x401f('0x48')];queues[_0x3302e4[_0x401f('0x45')]]['transferuniqueid']=_0x3302e4[_0x401f('0x45')];queues[_0x3302e4[_0x401f('0x45')]]['queuecallerexitreason']=_0x401f('0x49');utils[_0x401f('0x1')](util['format'](_0x401f('0x4a'),_0x3302e4[_0x401f('0x3')],queues[_0x3302e4[_0x401f('0x45')]][_0x401f('0x28')],_0x3302e4[_0x401f('0x45')],_0x3302e4[_0x401f('0x48')]));}}catch(_0x1b4cd1){utils[_0x401f('0x1d')](util[_0x401f('0xd')](_0x401f('0x44'),_0x3302e4['uniqueid']),_0x1b4cd1);}};exports['attendedtransfer']=function(_0x4f64db){try{utils[_0x401f('0xc')](util['format'](_0x401f('0x4b'),_0x4f64db[_0x401f('0x4c')]),_0x4f64db);if(_0x4f64db['origtransfereruniqueid']==_0x4f64db['origtransfererlinkedid']){if(!_[_0x401f('0x13')](queues[_0x4f64db[_0x401f('0x4d')]])){utils[_0x401f('0x1')](util[_0x401f('0xd')](_0x401f('0x4e'),_0x4f64db[_0x401f('0x4c')],queues[_0x4f64db['secondtransfererlinkedid']][_0x401f('0x28')],_0x4f64db[_0x401f('0x4f')]));queues[_0x4f64db[_0x401f('0x4d')]]['transfer']=!![];queues[_0x4f64db['secondtransfererlinkedid']][_0x401f('0x50')]=_0x401f('0x51');queues[_0x4f64db[_0x401f('0x4d')]][_0x401f('0x47')]=_0x4f64db[_0x401f('0x4f')];queues[_0x4f64db[_0x401f('0x4d')]]['transferuniqueid']=_0x4f64db[_0x401f('0x4c')];queues[_0x4f64db['secondtransfererlinkedid']][_0x401f('0x26')]='ATTENDEDTRANSFER';}if(!_[_0x401f('0x13')](queues[_0x4f64db[_0x401f('0x52')]])){if(_0x4f64db['transfereelinkedid']&&queues[_0x4f64db[_0x401f('0x53')]]){queues[_0x4f64db[_0x401f('0x53')]][_0x401f('0x54')]=0x1;queues[_0x4f64db['transfereeuniqueid']]=_[_0x401f('0x55')](queues[_0x4f64db[_0x401f('0x53')]]);queues[_0x4f64db['transfereeuniqueid']][_0x401f('0xb')]=_0x4f64db[_0x401f('0x56')];queues[_0x4f64db[_0x401f('0x45')]][_0x401f('0x54')]=0x2;queues[_0x4f64db[_0x401f('0x45')]][_0x401f('0x57')]=queues[_0x4f64db[_0x401f('0x4d')]][_0x401f('0x57')];queues[_0x4f64db[_0x401f('0x45')]][_0x401f('0x58')]=queues[_0x4f64db['secondtransfererlinkedid']][_0x401f('0x58')];queues[_0x4f64db[_0x401f('0x45')]]['queuecallerjoinAt']=utils['now']();queues[_0x4f64db['transfereeuniqueid']][_0x401f('0x15')]=utils['now']();queues[_0x4f64db['transfereeuniqueid']][_0x401f('0x59')]=0x0;queues[_0x4f64db[_0x401f('0x45')]]['mohtime']=0x0;utils[_0x401f('0x1')](util[_0x401f('0xd')](_0x401f('0x5a'),_0x4f64db['origtransfereruniqueid'],queues[_0x4f64db[_0x401f('0x45')]]['name'],queues[_0x4f64db[_0x401f('0x45')]][_0x401f('0x57')],queues[_0x4f64db[_0x401f('0x45')]][_0x401f('0x58')]));}else{utils[_0x401f('0x1')](util['format'](_0x401f('0x5b'),_0x4f64db[_0x401f('0x4c')],queues[_0x4f64db[_0x401f('0x52')]][_0x401f('0x28')],_0x4f64db[_0x401f('0x4d')]));queues[_0x4f64db[_0x401f('0x52')]][_0x401f('0xb')]=_0x4f64db[_0x401f('0x4d')];}}}else if(_0x4f64db[_0x401f('0x5c')]==_0x4f64db[_0x401f('0x4d')]){if(!_[_0x401f('0x13')](queues[_0x4f64db['origtransfererlinkedid']])){utils[_0x401f('0x1')](util[_0x401f('0xd')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4f64db['origtransfereruniqueid'],queues[_0x4f64db[_0x401f('0x52')]][_0x401f('0x28')],_0x4f64db[_0x401f('0x5c')],_0x4f64db[_0x401f('0x5d')]));queues[_0x4f64db[_0x401f('0x52')]][_0x401f('0x3f')]=!![];queues[_0x4f64db[_0x401f('0x52')]][_0x401f('0x50')]=_0x401f('0x51');queues[_0x4f64db[_0x401f('0x52')]]['transferexten']=_0x4f64db['secondtransfererexten'];queues[_0x4f64db[_0x401f('0x52')]][_0x401f('0x5e')]=_0x4f64db[_0x401f('0x5c')];queues[_0x4f64db[_0x401f('0x52')]][_0x401f('0x26')]='ATTENDEDTRANSFER';}if(!_[_0x401f('0x13')](queues[_0x4f64db[_0x401f('0x4d')]])){if(_0x4f64db[_0x401f('0x5f')]&&queues[_0x4f64db[_0x401f('0x5f')]]){queues[_0x4f64db[_0x401f('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x4f64db[_0x401f('0x56')]]=_[_0x401f('0x55')](queues[_0x4f64db[_0x401f('0x5f')]]);queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0xb')]=_0x4f64db[_0x401f('0x56')];queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0x54')]=0x2;queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0x57')]=queues[_0x4f64db[_0x401f('0x52')]]['calleridnum'];queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0x58')]=queues[_0x4f64db[_0x401f('0x52')]][_0x401f('0x58')];queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0x32')]=utils['now']();queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0x15')]=utils[_0x401f('0x1a')]();queues[_0x4f64db['transfertargetuniqueid']][_0x401f('0x59')]=0x0;queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0x60')]=0x0;utils[_0x401f('0x1')](util[_0x401f('0xd')](_0x401f('0x61'),_0x4f64db[_0x401f('0x4c')],queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0x28')],queues[_0x4f64db[_0x401f('0x56')]]['transfereduniqueid'],queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0x57')],queues[_0x4f64db[_0x401f('0x56')]][_0x401f('0x58')]));}else{utils[_0x401f('0x1')](util[_0x401f('0xd')](_0x401f('0x5b'),_0x4f64db['origtransfereruniqueid'],queues[_0x4f64db['secondtransfererlinkedid']][_0x401f('0x28')],_0x4f64db[_0x401f('0x52')]));queues[_0x4f64db['secondtransfererlinkedid']]['transfereduniqueid']=_0x4f64db[_0x401f('0x52')];}}}}catch(_0x2e089d){utils[_0x401f('0x1d')](util[_0x401f('0xd')](_0x401f('0x4b'),_0x4f64db[_0x401f('0x4c')]),_0x2e089d);}};exports['musiconholdstart']=function(_0x467a2c){try{if(!_['isNil'](queues[_0x467a2c[_0x401f('0x3')]])){utils['debug'](util[_0x401f('0xd')]('[%s][queues][musiconholdstart]',_0x467a2c[_0x401f('0x3')]),_0x467a2c);queues[_0x467a2c[_0x401f('0x3')]][_0x401f('0x62')]=utils['now']();utils['info'](util[_0x401f('0xd')](_0x401f('0x63'),_0x467a2c[_0x401f('0x3')],queues[_0x467a2c[_0x401f('0x3')]][_0x401f('0x28')],queues[_0x467a2c[_0x401f('0x3')]][_0x401f('0x62')]));}}catch(_0x525295){utils[_0x401f('0x1d')](util[_0x401f('0xd')](_0x401f('0x64'),_0x467a2c[_0x401f('0x3')]),_0x525295);}};exports[_0x401f('0x65')]=function(_0x3390ea){try{if(!_[_0x401f('0x13')](queues[_0x3390ea[_0x401f('0x3')]])){if(!_[_0x401f('0x13')](queues[_0x3390ea[_0x401f('0x3')]][_0x401f('0x62')])){utils[_0x401f('0xc')](util[_0x401f('0xd')](_0x401f('0x66'),_0x3390ea[_0x401f('0x3')]),_0x3390ea);queues[_0x3390ea[_0x401f('0x3')]][_0x401f('0x60')]+=utils[_0x401f('0x67')](utils[_0x401f('0x1a')](),queues[_0x3390ea[_0x401f('0x3')]][_0x401f('0x62')]);utils[_0x401f('0x1')](util[_0x401f('0xd')](_0x401f('0x68'),_0x3390ea[_0x401f('0x3')],queues[_0x3390ea[_0x401f('0x3')]][_0x401f('0x28')],queues[_0x3390ea[_0x401f('0x3')]]['mohtime']));delete queues[_0x3390ea['uniqueid']][_0x401f('0x62')];}}}catch(_0x4d7f1c){utils[_0x401f('0x1d')](util[_0x401f('0xd')](_0x401f('0x66'),_0x3390ea[_0x401f('0x3')]),_0x4d7f1c);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4bf479f..e4e2b08 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 _0xb995=['[%s][recordings][newchannel]','linkedid','exten','context','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinename','outbound','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','name','UserId','request','CreateVoiceRecording','newchannel','debug'];(function(_0x232c7b,_0x206995){var _0x323ca7=function(_0x7c8f85){while(--_0x7c8f85){_0x232c7b['push'](_0x232c7b['shift']());}};_0x323ca7(++_0x206995);}(_0xb995,0xb0));var _0x5b99=function(_0x3758dc,_0x2580bc){_0x3758dc=_0x3758dc-0x0;var _0x428332=_0xb995[_0x3758dc];return _0x428332;};'use strict';var _=require(_0x5b99('0x0'));var util=require('util');var utils=require(_0x5b99('0x1'));var transfers=require(_0x5b99('0x2'));var recordings={};function writeDB(_0x1e6401){var _0x3d8e1d;utils[_0x5b99('0x3')](util[_0x5b99('0x4')]('[%s][recordings][writeDB]',_0x1e6401[_0x5b99('0x5')]));if(transfers[_0x5b99('0x6')][_0x1e6401[_0x5b99('0x5')]]){_0x3d8e1d=_0x1e6401['uniqueid'];_0x1e6401['uniqueid']=transfers[_0x5b99('0x6')][_0x1e6401[_0x5b99('0x5')]][_0x5b99('0x7')];}if(_0x1e6401[_0x5b99('0x8')]){utils[_0x5b99('0x9')](_0x1e6401[_0x5b99('0x8')])['then'](function(_0x4a065c){if(_0x4a065c){_0x1e6401['membername']=_0x4a065c[_0x5b99('0xa')];_0x1e6401[_0x5b99('0xb')]=_0x4a065c['id'];}utils[_0x5b99('0xc')](_0x5b99('0xd'),_0x1e6401);});}else{utils['request']('CreateVoiceRecording',_0x1e6401);}if(_0x3d8e1d)delete transfers[_0x5b99('0x6')][_0x3d8e1d];}exports[_0x5b99('0xe')]=function(_0x37b236){try{utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x10'),_0x37b236[_0x5b99('0x5')]),_0x37b236);if(_0x37b236['uniqueid']==_0x37b236[_0x5b99('0x11')]){utils[_0x5b99('0x3')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x37b236[_0x5b99('0x5')],_0x37b236['context'],_0x37b236[_0x5b99('0x12')]));recordings[_0x37b236[_0x5b99('0x5')]]={'uniqueid':_0x37b236['uniqueid'],'accountcode':_0x37b236[_0x5b99('0x8')],'exten':_0x37b236[_0x5b99('0x12')],'context':_0x37b236[_0x5b99('0x13')],'channel':_0x37b236[_0x5b99('0x14')],'monitors':[]};}}catch(_0x4c67dc){utils['error'](util[_0x5b99('0x4')]('[%s][recordings][newchannel]',_0x37b236[_0x5b99('0x5')]),_0x4c67dc);}};exports[_0x5b99('0x15')]=function(_0x46410f){try{utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x16'),_0x46410f['uniqueid']),_0x46410f);if(!_[_0x5b99('0x17')](recordings[_0x46410f['uniqueid']])&&_0x46410f[_0x5b99('0x18')]==0x6){utils[_0x5b99('0x3')](util[_0x5b99('0x4')](_0x5b99('0x19'),_0x46410f['uniqueid'],_0x46410f[_0x5b99('0x13')],_0x46410f[_0x5b99('0x14')]));}else if(!_[_0x5b99('0x17')](recordings[_0x46410f[_0x5b99('0x11')]])&&_0x46410f['channelstate']==0x6&&_0x46410f[_0x5b99('0x13')]!=_0x5b99('0x1a')){utils[_0x5b99('0x3')](util[_0x5b99('0x4')](_0x5b99('0x1b'),_0x46410f[_0x5b99('0x5')],_0x46410f[_0x5b99('0x11')],_0x46410f['context'],_0x46410f[_0x5b99('0x14')]));recordings[_0x46410f['linkedid']][_0x5b99('0x8')]=_0x46410f[_0x5b99('0x8')];}}catch(_0x3959da){utils[_0x5b99('0x1c')](util[_0x5b99('0x4')]('[%s][recordings][newstate]',_0x46410f['uniqueid']),_0x3959da);}};exports[_0x5b99('0x1d')]=function(_0x8978e1){try{if(!_[_0x5b99('0x17')](_0x8978e1[_0x5b99('0x1e')])&&!_[_0x5b99('0x17')](_0x8978e1[_0x5b99('0x1e')][_0x5b99('0x1f')])){utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x20'),_0x8978e1[_0x5b99('0x5')]),_0x8978e1);utils['info'](util[_0x5b99('0x4')](_0x5b99('0x21'),_0x8978e1[_0x5b99('0x5')],_0x8978e1[_0x5b99('0x1e')],_0x8978e1[_0x5b99('0x22')]));if(_[_0x5b99('0x23')](_0x8978e1[_0x5b99('0x22')],_0x5b99('0x24'))){_0x8978e1[_0x5b99('0x22')]=_0x8978e1[_0x5b99('0x22')][_0x5b99('0x25')](_0x5b99('0x24'),_0x5b99('0x26'));}if(recordings[_0x8978e1[_0x5b99('0x11')]]){var _0x4724fa=_[_0x5b99('0x27')](recordings[_0x8978e1[_0x5b99('0x11')]]['monitors'],{'value':_0x8978e1[_0x5b99('0x22')]});if(_[_0x5b99('0x17')](_0x4724fa)){recordings[_0x8978e1[_0x5b99('0x11')]][_0x5b99('0x28')]['push']({'value':_0x8978e1['value']});}}}}catch(_0x4e611e){utils['error'](util['format']('[%s][recordings][varset]',_0x8978e1[_0x5b99('0x5')]),_0x4e611e);}};exports['hangup']=function(_0x3da29e){try{if(!_[_0x5b99('0x17')](recordings[_0x3da29e[_0x5b99('0x5')]])){utils[_0x5b99('0xf')](util['format'](_0x5b99('0x29'),_0x3da29e[_0x5b99('0x5')]),_0x3da29e);utils[_0x5b99('0x3')](util[_0x5b99('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3da29e[_0x5b99('0x5')],_0x3da29e[_0x5b99('0x2a')],_0x3da29e[_0x5b99('0x2b')],_0x3da29e['cause-txt']));recordings[_0x3da29e[_0x5b99('0x5')]][_0x5b99('0x2a')]=_0x3da29e[_0x5b99('0x2a')];recordings[_0x3da29e['uniqueid']][_0x5b99('0x2b')]=_0x3da29e[_0x5b99('0x2b')];recordings[_0x3da29e[_0x5b99('0x5')]]['connectedlinenum']=_0x3da29e['connectedlinenum'];recordings[_0x3da29e[_0x5b99('0x5')]][_0x5b99('0x2c')]=_0x3da29e[_0x5b99('0x2c')];if(recordings[_0x3da29e[_0x5b99('0x5')]]['type']==_0x5b99('0x2d')&&recordings[_0x3da29e[_0x5b99('0x5')]][_0x5b99('0x8')]){recordings[_0x3da29e[_0x5b99('0x5')]]['connectedlinenum']=recordings[_0x3da29e[_0x5b99('0x5')]]['accountcode'];recordings[_0x3da29e[_0x5b99('0x5')]]['connectedlinename']='';}recordings[_0x3da29e[_0x5b99('0x5')]][_0x5b99('0x28')]['forEach'](function(_0x309fb0){var _0xacc225=_[_0x5b99('0x2e')](recordings[_0x3da29e[_0x5b99('0x5')]]);_0xacc225[_0x5b99('0x22')]=_0x309fb0[_0x5b99('0x22')];writeDB(_0xacc225);});delete recordings[_0x3da29e[_0x5b99('0x5')]];}}catch(_0x5613b8){utils[_0x5b99('0x1c')](util['format']('[%s][recordings][hangup]',_0x3da29e[_0x5b99('0x5')]),_0x5613b8);}};exports['newexten']=function(_0xebf34b){try{if(!_[_0x5b99('0x17')](recordings[_0xebf34b[_0x5b99('0x5')]])){utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x2f'),_0xebf34b['uniqueid']),_0xebf34b);utils[_0x5b99('0x3')](util[_0x5b99('0x4')](_0x5b99('0x30'),_0xebf34b[_0x5b99('0x5')],_0xebf34b['application'],_0xebf34b[_0x5b99('0x31')]));if(_0xebf34b['application'][_0x5b99('0x32')]()=='set'&&_['startsWith'](_0xebf34b['appdata'][_0x5b99('0x32')](),_0x5b99('0x33'))){var _0x3c97bb=_0xebf34b[_0x5b99('0x31')][_0x5b99('0x34')]('=');var _0x5a4077=_0x3c97bb[0x0]['substring'](_0x3c97bb[0x0][_0x5b99('0x35')]('(')+0x1,_0x3c97bb[0x0][_0x5b99('0x35')](')'));var _0x5e120f=_0x3c97bb[0x1];recordings[_0xebf34b[_0x5b99('0x5')]][_0x5a4077]=_0x5e120f;}}}catch(_0x27d8d9){utils[_0x5b99('0x1c')](util[_0x5b99('0x4')](_0x5b99('0x2f'),_0xebf34b[_0x5b99('0x5')]),_0x27d8d9);}};exports[_0x5b99('0x36')]=function(_0x12e520){try{if(!_[_0x5b99('0x17')](recordings[_0x12e520['uniqueid']])){utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x37'),_0x12e520[_0x5b99('0x5')]),_0x12e520);utils['info'](util[_0x5b99('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x12e520[_0x5b99('0x5')],_0x12e520['queue']));recordings[_0x12e520[_0x5b99('0x5')]][_0x5b99('0x38')]=_0x12e520[_0x5b99('0x38')];}}catch(_0x2ee125){utils[_0x5b99('0x1c')](util[_0x5b99('0x4')](_0x5b99('0x37'),_0x12e520['uniqueid']),_0x2ee125);}};exports[_0x5b99('0x39')]=function(_0x1edb1d){try{utils['debug'](util[_0x5b99('0x4')]('[%s][recordings][blindtransfer]',_0x1edb1d[_0x5b99('0x5')]),_0x1edb1d);utils[_0x5b99('0x3')](util[_0x5b99('0x4')](_0x5b99('0x3a'),_0x1edb1d['uniqueid'],_0x1edb1d[_0x5b99('0x3b')],_0x1edb1d[_0x5b99('0x3c')],_0x1edb1d['transfereecalleridnum'],_0x1edb1d[_0x5b99('0x3d')]));if(recordings[_0x1edb1d[_0x5b99('0x3e')]]&&transfers[_0x5b99('0x6')][_0x1edb1d[_0x5b99('0x3e')]]){transfers[_0x5b99('0x6')][_0x1edb1d[_0x5b99('0x3e')]][_0x5b99('0x3f')]=!![];}}catch(_0x402f28){utils[_0x5b99('0x1c')](util[_0x5b99('0x4')]('[%s][recordings][blindtransfer]',_0x1edb1d['uniqueid']),_0x402f28);}}; \ No newline at end of file +var _0x443b=['[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','uniqueid','blinds','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]'];(function(_0x1b8b95,_0x3ea343){var _0x3657ae=function(_0x3703e1){while(--_0x3703e1){_0x1b8b95['push'](_0x1b8b95['shift']());}};_0x3657ae(++_0x3ea343);}(_0x443b,0x182));var _0xb443=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x443b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb443('0x0'));var util=require(_0xb443('0x1'));var utils=require(_0xb443('0x2'));var transfers=require(_0xb443('0x3'));var recordings={};function writeDB(_0x4e065b){var _0x125307;utils[_0xb443('0x4')](util[_0xb443('0x5')]('[%s][recordings][writeDB]',_0x4e065b[_0xb443('0x6')]));if(transfers[_0xb443('0x7')][_0x4e065b[_0xb443('0x6')]]){_0x125307=_0x4e065b[_0xb443('0x6')];_0x4e065b['uniqueid']=transfers[_0xb443('0x7')][_0x4e065b['uniqueid']]['transfereeuniqueid'];}if(_0x4e065b['accountcode']){utils[_0xb443('0x8')](_0x4e065b[_0xb443('0x9')])[_0xb443('0xa')](function(_0x40fe44){if(_0x40fe44){_0x4e065b[_0xb443('0xb')]=_0x40fe44[_0xb443('0xc')];_0x4e065b[_0xb443('0xd')]=_0x40fe44['id'];}utils[_0xb443('0xe')](_0xb443('0xf'),_0x4e065b);});}else{utils[_0xb443('0xe')]('CreateVoiceRecording',_0x4e065b);}if(_0x125307)delete transfers[_0xb443('0x7')][_0x125307];}exports[_0xb443('0x10')]=function(_0x5981e7){try{utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x12'),_0x5981e7[_0xb443('0x6')]),_0x5981e7);if(_0x5981e7[_0xb443('0x6')]==_0x5981e7[_0xb443('0x13')]){utils[_0xb443('0x4')](util[_0xb443('0x5')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x5981e7['uniqueid'],_0x5981e7[_0xb443('0x14')],_0x5981e7[_0xb443('0x15')]));recordings[_0x5981e7[_0xb443('0x6')]]={'uniqueid':_0x5981e7[_0xb443('0x6')],'accountcode':_0x5981e7[_0xb443('0x9')],'exten':_0x5981e7['exten'],'context':_0x5981e7[_0xb443('0x14')],'channel':_0x5981e7[_0xb443('0x16')],'monitors':[]};}}catch(_0x5bf835){utils[_0xb443('0x17')](util[_0xb443('0x5')]('[%s][recordings][newchannel]',_0x5981e7[_0xb443('0x6')]),_0x5bf835);}};exports[_0xb443('0x18')]=function(_0x596dbf){try{utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x19'),_0x596dbf[_0xb443('0x6')]),_0x596dbf);if(!_['isNil'](recordings[_0x596dbf[_0xb443('0x6')]])&&_0x596dbf[_0xb443('0x1a')]==0x6){utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x1b'),_0x596dbf[_0xb443('0x6')],_0x596dbf[_0xb443('0x14')],_0x596dbf[_0xb443('0x16')]));}else if(!_[_0xb443('0x1c')](recordings[_0x596dbf[_0xb443('0x13')]])&&_0x596dbf[_0xb443('0x1a')]==0x6&&_0x596dbf[_0xb443('0x14')]!='transfer'){utils[_0xb443('0x4')](util[_0xb443('0x5')](_0xb443('0x1d'),_0x596dbf['uniqueid'],_0x596dbf[_0xb443('0x13')],_0x596dbf[_0xb443('0x14')],_0x596dbf[_0xb443('0x16')]));recordings[_0x596dbf['linkedid']][_0xb443('0x9')]=_0x596dbf['accountcode'];}}catch(_0x482a65){utils[_0xb443('0x17')](util['format'](_0xb443('0x19'),_0x596dbf['uniqueid']),_0x482a65);}};exports[_0xb443('0x1e')]=function(_0x5e535d){try{if(!_[_0xb443('0x1c')](_0x5e535d[_0xb443('0x1f')])&&!_[_0xb443('0x1c')](_0x5e535d[_0xb443('0x1f')][_0xb443('0x20')])){utils['debug'](util[_0xb443('0x5')](_0xb443('0x21'),_0x5e535d['uniqueid']),_0x5e535d);utils['info'](util['format'](_0xb443('0x22'),_0x5e535d[_0xb443('0x6')],_0x5e535d[_0xb443('0x1f')],_0x5e535d[_0xb443('0x23')]));if(_[_0xb443('0x24')](_0x5e535d[_0xb443('0x23')],_0xb443('0x25'))){_0x5e535d[_0xb443('0x23')]=_0x5e535d[_0xb443('0x23')][_0xb443('0x26')](_0xb443('0x25'),_0xb443('0x27'));}if(recordings[_0x5e535d['linkedid']]){var _0x1fb57b=_['find'](recordings[_0x5e535d[_0xb443('0x13')]][_0xb443('0x28')],{'value':_0x5e535d[_0xb443('0x23')]});if(_['isNil'](_0x1fb57b)){recordings[_0x5e535d[_0xb443('0x13')]][_0xb443('0x28')]['push']({'value':_0x5e535d[_0xb443('0x23')]});}}}}catch(_0x103132){utils[_0xb443('0x17')](util['format'](_0xb443('0x21'),_0x5e535d[_0xb443('0x6')]),_0x103132);}};exports['hangup']=function(_0x16b91d){try{if(!_[_0xb443('0x1c')](recordings[_0x16b91d[_0xb443('0x6')]])){utils[_0xb443('0x11')](util['format']('[%s][recordings][hangup]',_0x16b91d[_0xb443('0x6')]),_0x16b91d);utils['info'](util[_0xb443('0x5')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x16b91d[_0xb443('0x6')],_0x16b91d[_0xb443('0x29')],_0x16b91d[_0xb443('0x2a')],_0x16b91d[_0xb443('0x2b')]));recordings[_0x16b91d['uniqueid']][_0xb443('0x29')]=_0x16b91d[_0xb443('0x29')];recordings[_0x16b91d[_0xb443('0x6')]][_0xb443('0x2a')]=_0x16b91d[_0xb443('0x2a')];recordings[_0x16b91d[_0xb443('0x6')]][_0xb443('0x2c')]=_0x16b91d[_0xb443('0x2c')];recordings[_0x16b91d[_0xb443('0x6')]]['connectedlinename']=_0x16b91d[_0xb443('0x2d')];if(recordings[_0x16b91d[_0xb443('0x6')]][_0xb443('0x2e')]==_0xb443('0x2f')&&recordings[_0x16b91d['uniqueid']]['accountcode']){recordings[_0x16b91d[_0xb443('0x6')]][_0xb443('0x2c')]=recordings[_0x16b91d[_0xb443('0x6')]]['accountcode'];recordings[_0x16b91d[_0xb443('0x6')]]['connectedlinename']='';}recordings[_0x16b91d['uniqueid']]['monitors'][_0xb443('0x30')](function(_0x4c042c){var _0xfcfef6=_['clone'](recordings[_0x16b91d[_0xb443('0x6')]]);_0xfcfef6[_0xb443('0x23')]=_0x4c042c[_0xb443('0x23')];writeDB(_0xfcfef6);});delete recordings[_0x16b91d[_0xb443('0x6')]];}}catch(_0x464861){utils[_0xb443('0x17')](util[_0xb443('0x5')](_0xb443('0x31'),_0x16b91d['uniqueid']),_0x464861);}};exports[_0xb443('0x32')]=function(_0x26e275){try{if(!_['isNil'](recordings[_0x26e275['uniqueid']])){utils[_0xb443('0x11')](util[_0xb443('0x5')](_0xb443('0x33'),_0x26e275[_0xb443('0x6')]),_0x26e275);utils[_0xb443('0x4')](util[_0xb443('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x26e275[_0xb443('0x6')],_0x26e275[_0xb443('0x34')],_0x26e275['appdata']));if(_0x26e275[_0xb443('0x34')][_0xb443('0x35')]()==_0xb443('0x36')&&_[_0xb443('0x37')](_0x26e275[_0xb443('0x38')]['toLowerCase'](),'cdr')){var _0x420b9c=_0x26e275[_0xb443('0x38')][_0xb443('0x39')]('=');var _0x16cbbe=_0x420b9c[0x0]['substring'](_0x420b9c[0x0][_0xb443('0x3a')]('(')+0x1,_0x420b9c[0x0][_0xb443('0x3a')](')'));var _0xe26434=_0x420b9c[0x1];recordings[_0x26e275[_0xb443('0x6')]][_0x16cbbe]=_0xe26434;}}}catch(_0x35aaa9){utils['error'](util[_0xb443('0x5')]('[%s][recordings][newexten]',_0x26e275[_0xb443('0x6')]),_0x35aaa9);}};exports[_0xb443('0x3b')]=function(_0x5540ba){try{if(!_[_0xb443('0x1c')](recordings[_0x5540ba[_0xb443('0x6')]])){utils['debug'](util[_0xb443('0x5')](_0xb443('0x3c'),_0x5540ba[_0xb443('0x6')]),_0x5540ba);utils[_0xb443('0x4')](util['format'](_0xb443('0x3d'),_0x5540ba[_0xb443('0x6')],_0x5540ba['queue']));recordings[_0x5540ba[_0xb443('0x6')]][_0xb443('0x3e')]=_0x5540ba[_0xb443('0x3e')];}}catch(_0x2be0be){utils[_0xb443('0x17')](util[_0xb443('0x5')](_0xb443('0x3c'),_0x5540ba[_0xb443('0x6')]),_0x2be0be);}};exports[_0xb443('0x3f')]=function(_0x59cc31){try{utils[_0xb443('0x11')](util['format'](_0xb443('0x40'),_0x59cc31[_0xb443('0x6')]),_0x59cc31);utils[_0xb443('0x4')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x59cc31[_0xb443('0x6')],_0x59cc31['transferercalleridnum'],_0x59cc31[_0xb443('0x41')],_0x59cc31[_0xb443('0x42')],_0x59cc31[_0xb443('0x43')]));if(recordings[_0x59cc31[_0xb443('0x44')]]&&transfers['blinds'][_0x59cc31['transfereruniqueid']]){transfers[_0xb443('0x7')][_0x59cc31[_0xb443('0x44')]][_0xb443('0x45')]=!![];}}catch(_0x295bf6){utils[_0xb443('0x17')](util[_0xb443('0x5')]('[%s][recordings][blindtransfer]',_0x59cc31[_0xb443('0x6')]),_0x295bf6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index adfe0d8..920e08d 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 _0xef2a=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransferercalleridname'];(function(_0x16374e,_0x24911b){var _0x3635c2=function(_0x553452){while(--_0x553452){_0x16374e['push'](_0x16374e['shift']());}};_0x3635c2(++_0x24911b);}(_0xef2a,0x88));var _0xaef2=function(_0x58e877,_0x73b061){_0x58e877=_0x58e877-0x0;var _0x48be62=_0xef2a[_0x58e877];return _0x48be62;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xaef2('0x0'));function writeDB(_0x3f2ce3){utils[_0xaef2('0x1')](util[_0xaef2('0x2')](_0xaef2('0x3'),_0x3f2ce3['type']===_0xaef2('0x4')?_0x3f2ce3[_0xaef2('0x5')]:_0x3f2ce3[_0xaef2('0x6')],_0x3f2ce3[_0xaef2('0x7')]));utils['request']('CreateVoiceTransferReport',_0x3f2ce3);}exports[_0xaef2('0x8')]={};exports[_0xaef2('0x9')]=function(_0x387124){try{utils[_0xaef2('0xa')](util['format']('[%s][transfers][blindtransfer]',_0x387124[_0xaef2('0x6')]),_0x387124);utils[_0xaef2('0x1')](util[_0xaef2('0x2')](_0xaef2('0xb'),_0x387124['uniqueid'],_0x387124['transferercalleridnum'],_0x387124[_0xaef2('0xc')],_0x387124[_0xaef2('0xd')],_0x387124['transfereecalleridname']));_0x387124['type']=_0xaef2('0xe');exports[_0xaef2('0x8')][_0x387124[_0xaef2('0xf')]]=_0x387124;writeDB(_0x387124);}catch(_0x54843d){utils['error'](util[_0xaef2('0x2')](_0xaef2('0x10'),_0x387124[_0xaef2('0x6')]),_0x54843d);}};exports[_0xaef2('0x11')]=function(_0x169b91){try{utils[_0xaef2('0xa')](util[_0xaef2('0x2')](_0xaef2('0x12'),_0x169b91['origtransfereruniqueid']),_0x169b91);utils[_0xaef2('0x1')](util['format'](_0xaef2('0x13'),_0x169b91[_0xaef2('0x5')],_0x169b91[_0xaef2('0x14')],_0x169b91['origtransferercalleridname'],_0x169b91[_0xaef2('0x15')],_0x169b91[_0xaef2('0x16')]));_0x169b91=_['assign'](_0x169b91,{'transfererchannel':_0x169b91['origtransfererchannel'],'transferercalleridnum':_0x169b91[_0xaef2('0x14')],'transferercalleridname':_0x169b91[_0xaef2('0x17')],'transfererconnectedlinenum':_0x169b91['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x169b91[_0xaef2('0x18')],'transfereraccountcode':_0x169b91[_0xaef2('0x19')],'transferercontext':_0x169b91[_0xaef2('0x1a')],'transfererexten':_0x169b91[_0xaef2('0x1b')],'transfererlinkedid':_0x169b91[_0xaef2('0x1c')],'context':_0x169b91[_0xaef2('0x1d')],'extension':_0x169b91['origtransfererexten'],'type':_0xaef2('0x4')});if(_[_0xaef2('0x1e')](_0x169b91[_0xaef2('0x1f')])){_0x169b91=_[_0xaef2('0x20')](_0x169b91,{'transfereechannel':_0x169b91[_0xaef2('0x21')],'transfereecalleridnum':_0x169b91[_0xaef2('0x15')],'transfereecalleridname':_0x169b91[_0xaef2('0x16')],'transfereeconnectedlinenum':_0x169b91[_0xaef2('0x22')],'transfereeconnectedlinename':_0x169b91['transfertargetconnectedlinename'],'transfereeaccountcode':_0x169b91[_0xaef2('0x23')],'transfereecontext':_0x169b91[_0xaef2('0x24')],'transfereeexten':_0x169b91[_0xaef2('0x25')],'transfereelinkedid':_0x169b91[_0xaef2('0x26')]});}writeDB(_0x169b91);}catch(_0x402c45){utils[_0xaef2('0x27')](util[_0xaef2('0x2')](_0xaef2('0x12'),_0x169b91[_0xaef2('0x5')]),_0x402c45);}}; \ No newline at end of file +var _0x564d=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfereraccountcode'];(function(_0x98abe0,_0x11bf0d){var _0x2e1178=function(_0x398726){while(--_0x398726){_0x98abe0['push'](_0x98abe0['shift']());}};_0x2e1178(++_0x11bf0d);}(_0x564d,0xa1));var _0xd564=function(_0x542a9d,_0x334a58){_0x542a9d=_0x542a9d-0x0;var _0x597820=_0x564d[_0x542a9d];return _0x597820;};'use strict';var _=require(_0xd564('0x0'));var util=require(_0xd564('0x1'));var utils=require(_0xd564('0x2'));function writeDB(_0x326d49){utils[_0xd564('0x3')](util['format'](_0xd564('0x4'),_0x326d49[_0xd564('0x5')]===_0xd564('0x6')?_0x326d49[_0xd564('0x7')]:_0x326d49[_0xd564('0x8')],_0x326d49[_0xd564('0x5')]));utils['request'](_0xd564('0x9'),_0x326d49);}exports[_0xd564('0xa')]={};exports[_0xd564('0xb')]=function(_0x58a919){try{utils[_0xd564('0xc')](util[_0xd564('0xd')](_0xd564('0xe'),_0x58a919[_0xd564('0x8')]),_0x58a919);utils['info'](util[_0xd564('0xd')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x58a919[_0xd564('0x8')],_0x58a919[_0xd564('0xf')],_0x58a919[_0xd564('0x10')],_0x58a919['transfereecalleridnum'],_0x58a919[_0xd564('0x11')]));_0x58a919[_0xd564('0x5')]=_0xd564('0x12');exports['blinds'][_0x58a919[_0xd564('0x13')]]=_0x58a919;writeDB(_0x58a919);}catch(_0x44331a){utils['error'](util[_0xd564('0xd')](_0xd564('0xe'),_0x58a919[_0xd564('0x8')]),_0x44331a);}};exports[_0xd564('0x14')]=function(_0x6474b){try{utils[_0xd564('0xc')](util['format'](_0xd564('0x15'),_0x6474b['origtransfereruniqueid']),_0x6474b);utils[_0xd564('0x3')](util[_0xd564('0xd')](_0xd564('0x16'),_0x6474b[_0xd564('0x7')],_0x6474b[_0xd564('0x17')],_0x6474b[_0xd564('0x18')],_0x6474b[_0xd564('0x19')],_0x6474b[_0xd564('0x1a')]));_0x6474b=_[_0xd564('0x1b')](_0x6474b,{'transfererchannel':_0x6474b['origtransfererchannel'],'transferercalleridnum':_0x6474b['origtransferercalleridnum'],'transferercalleridname':_0x6474b['origtransferercalleridname'],'transfererconnectedlinenum':_0x6474b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x6474b['secondtransfererconnectedlinename'],'transfereraccountcode':_0x6474b[_0xd564('0x1c')],'transferercontext':_0x6474b[_0xd564('0x1d')],'transfererexten':_0x6474b[_0xd564('0x1e')],'transfererlinkedid':_0x6474b[_0xd564('0x1f')],'context':_0x6474b['origtransferercontext'],'extension':_0x6474b[_0xd564('0x20')],'type':'attended'});if(_[_0xd564('0x21')](_0x6474b[_0xd564('0x22')])){_0x6474b=_[_0xd564('0x1b')](_0x6474b,{'transfereechannel':_0x6474b[_0xd564('0x23')],'transfereecalleridnum':_0x6474b['transfertargetcalleridnum'],'transfereecalleridname':_0x6474b[_0xd564('0x1a')],'transfereeconnectedlinenum':_0x6474b[_0xd564('0x24')],'transfereeconnectedlinename':_0x6474b[_0xd564('0x25')],'transfereeaccountcode':_0x6474b['transfertargetaccountcode'],'transfereecontext':_0x6474b['transfertargetcontext'],'transfereeexten':_0x6474b['transfertargetexten'],'transfereelinkedid':_0x6474b['transfertargetlinkedid']});}writeDB(_0x6474b);}catch(_0x241333){utils['error'](util['format'](_0xd564('0x15'),_0x6474b[_0xd564('0x7')]),_0x241333);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index f7ed421..54610b4 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 _0x92f3=['internal','name','then','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser'];(function(_0x28f4ad,_0x2cf8f4){var _0x6cb4ce=function(_0x16866c){while(--_0x16866c){_0x28f4ad['push'](_0x28f4ad['shift']());}};_0x6cb4ce(++_0x2cf8f4);}(_0x92f3,0xf0));var _0x392f=function(_0x7b102d,_0x414b58){_0x7b102d=_0x7b102d-0x0;var _0x235e07=_0x92f3[_0x7b102d];return _0x235e07;};'use strict';var BPromise=require(_0x392f('0x0'));var jayson=require(_0x392f('0x1'));var moment=require(_0x392f('0x2'));var util=require(_0x392f('0x3'));var client=jayson[_0x392f('0x4')][_0x392f('0x5')]({'port':0x2329});var logger=require(_0x392f('0x6'))('xdr');exports[_0x392f('0x7')]=function(_0x9ccaa6,_0x123a70){logger[_0x392f('0x7')](_0x9ccaa6,_0x123a70?util[_0x392f('0x8')](_0x123a70,{'showHidden':![],'depth':null}):'');};exports[_0x392f('0x9')]=function(_0x3c4297,_0x1a7a10){logger[_0x392f('0x9')](_0x3c4297,_0x1a7a10?util[_0x392f('0x8')](_0x1a7a10,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3c7d85,_0x4b15c0){logger[_0x392f('0xa')](_0x3c7d85,_0x4b15c0?util['inspect'](_0x4b15c0,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2f726f,_0x28ffae){return client[_0x392f('0xb')](_0x2f726f,{'body':_0x28ffae})['then'](function(_0x58d362){logger[_0x392f('0x9')](_0x392f('0xc'),_0x2f726f,_0x58d362?util['inspect'](_0x58d362,{'showHidden':![],'depth':null}):'');})[_0x392f('0xd')](function(_0x155273){logger['error'](_0x392f('0xc'),_0x2f726f,_0x155273?util[_0x392f('0x8')](_0x155273,{'showHidden':![],'depth':null}):'');});};function getUser(_0x597a32){return client[_0x392f('0xb')](_0x392f('0xe'),{'options':{'raw':!![],'attributes':['id',_0x392f('0xf'),_0x392f('0x10'),'interface'],'where':_0x597a32,'limit':0x1}})[_0x392f('0x11')](function(_0x3f0f0e){logger[_0x392f('0x9')](_0x392f('0x12'),JSON[_0x392f('0x13')](_0x597a32),_0x3f0f0e?util[_0x392f('0x8')](_0x3f0f0e,{'showHidden':![],'depth':null}):'');return _0x3f0f0e['result'][_0x392f('0x14')]?_0x3f0f0e[_0x392f('0x15')][0x0]:null;});}exports[_0x392f('0x16')]=function(_0x44d877){return new BPromise(function(_0x6dd67b,_0x2cc955){if(_0x44d877){return getUser({'internal':_0x44d877})['then'](function(_0x110a40){logger[_0x392f('0x7')](_0x392f('0x17'),_0x44d877,_0x110a40?'found':'notfound');return _0x6dd67b(_0x110a40);})[_0x392f('0xd')](function(_0xc60426){logger[_0x392f('0xa')]('[utils][getUserByInternal]',_0xc60426?util[_0x392f('0x8')](_0xc60426,{'showHidden':![],'depth':null}):'');return _0x6dd67b(null);});}return _0x6dd67b(null);});};exports[_0x392f('0x18')]=function(_0x3d9b6c){return new BPromise(function(_0x1ac696,_0x5d155b){if(_0x3d9b6c){return getUser({'interface':_0x3d9b6c})[_0x392f('0x11')](function(_0x1df5a4){logger[_0x392f('0x7')](_0x392f('0x19'),_0x3d9b6c,_0x1df5a4?_0x392f('0x1a'):'notfound');return _0x1ac696(_0x1df5a4);})[_0x392f('0xd')](function(_0x238f76){logger[_0x392f('0xa')](_0x392f('0x1b'),_0x238f76?util[_0x392f('0x8')](_0x238f76,{'showHidden':![],'depth':null}):'');return _0x1ac696(null);});}return _0x1ac696(null);});};exports[_0x392f('0x1c')]=function(_0x2b5253){return new BPromise(function(_0x273f70,_0x5e8ad4){if(_0x2b5253){return getUser({'name':_0x2b5253})['then'](function(_0x1d6f8c){logger[_0x392f('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2b5253,_0x1d6f8c?_0x392f('0x1a'):_0x392f('0x1d'));return _0x273f70(_0x1d6f8c);})[_0x392f('0xd')](function(_0xed9f61){logger['error'](_0x392f('0x1e'),_0xed9f61?util[_0x392f('0x8')](_0xed9f61,{'showHidden':![],'depth':null}):'');return _0x273f70(null);});}return _0x273f70(null);});};exports[_0x392f('0x1f')]=function(_0x3d78bd){return new BPromise(function(_0xc15fee,_0x59c87f){if(_0x3d78bd){return client['request'](_0x392f('0x20'),{'options':{'raw':!![],'attributes':['id',_0x392f('0x10'),_0x392f('0x21'),_0x392f('0x22'),_0x392f('0x23')],'where':{'name':_0x3d78bd},'limit':0x1}})[_0x392f('0x11')](function(_0x5c54a7){logger[_0x392f('0x9')](_0x392f('0x24'),_0x3d78bd,_0x5c54a7?util[_0x392f('0x8')](_0x5c54a7,{'showHidden':![],'depth':null}):'');logger['info'](_0x392f('0x25'),_0x3d78bd,_0x5c54a7?_0x392f('0x1a'):_0x392f('0x1d'));return _0xc15fee(_0x5c54a7[_0x392f('0x15')][_0x392f('0x14')]?_0x5c54a7[_0x392f('0x15')][0x0]:null);})['catch'](function(_0x292d0f){logger[_0x392f('0xa')]('[utils][getVoiceQueueByName]',_0x292d0f?util[_0x392f('0x8')](_0x292d0f,{'showHidden':![],'depth':null}):'');return _0xc15fee(null);});}return _0xc15fee(null);});};exports[_0x392f('0x26')]=function(_0x553451,_0x588a35){return moment(_0x553451)[_0x392f('0x27')](_0x588a35,'seconds')[_0x392f('0x28')](_0x392f('0x29'));};exports[_0x392f('0x2a')]=function(_0x23aaad,_0x3558ce){return moment(_0x23aaad)[_0x392f('0x2b')](_0x3558ce,_0x392f('0x2c'))[_0x392f('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x392f('0x2d')]=function(_0x5c70b4,_0x5bae68){return moment(_0x5c70b4)[_0x392f('0x2e')](moment(_0x5bae68),_0x392f('0x2c'));};exports[_0x392f('0x2f')]=function(_0x59ed43,_0x168896){return parseInt(_0x59ed43,0xa)+parseInt(_0x168896,0xa);};exports[_0x392f('0x30')]=function(){return moment()[_0x392f('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x392f('0x31')]=function(_0x65c7f3,_0x5de4b9){if(_0x5de4b9){return moment(_0x65c7f3)[_0x392f('0x31')](_0x5de4b9);}return!![];};exports[_0x392f('0x32')]=function(_0x5839e4,_0x24c833){if(_0x24c833){return moment(_0x5839e4)[_0x392f('0x32')](_0x24c833);}else if(_0x5839e4){return!![];}return![];}; \ No newline at end of file +var _0xc963=['util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','bluebird'];(function(_0x40ba9d,_0x56f93f){var _0x78bfee=function(_0x4e4f5d){while(--_0x4e4f5d){_0x40ba9d['push'](_0x40ba9d['shift']());}};_0x78bfee(++_0x56f93f);}(_0xc963,0x17f));var _0x3c96=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0xc963[_0x4d05a0];return _0x4c999c;};'use strict';var BPromise=require(_0x3c96('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x3c96('0x1'));var client=jayson[_0x3c96('0x2')][_0x3c96('0x3')]({'port':0x2329});var logger=require(_0x3c96('0x4'))(_0x3c96('0x5'));exports['info']=function(_0x27f42a,_0x16f7ea){logger[_0x3c96('0x6')](_0x27f42a,_0x16f7ea?util[_0x3c96('0x7')](_0x16f7ea,{'showHidden':![],'depth':null}):'');};exports[_0x3c96('0x8')]=function(_0x493953,_0x1f3bb4){logger[_0x3c96('0x8')](_0x493953,_0x1f3bb4?util[_0x3c96('0x7')](_0x1f3bb4,{'showHidden':![],'depth':null}):'');};exports[_0x3c96('0x9')]=function(_0x3f800d,_0x2cdeff){logger[_0x3c96('0x9')](_0x3f800d,_0x2cdeff?util[_0x3c96('0x7')](_0x2cdeff,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x389618,_0x4d6407){return client[_0x3c96('0xa')](_0x389618,{'body':_0x4d6407})[_0x3c96('0xb')](function(_0x54aa46){logger[_0x3c96('0x8')]('[utils][request]\x20name:%s',_0x389618,_0x54aa46?util['inspect'](_0x54aa46,{'showHidden':![],'depth':null}):'');})[_0x3c96('0xc')](function(_0x458cec){logger[_0x3c96('0x9')](_0x3c96('0xd'),_0x389618,_0x458cec?util[_0x3c96('0x7')](_0x458cec,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1d98e9){return client[_0x3c96('0xa')](_0x3c96('0xe'),{'options':{'raw':!![],'attributes':['id',_0x3c96('0xf'),_0x3c96('0x10'),_0x3c96('0x11')],'where':_0x1d98e9,'limit':0x1}})[_0x3c96('0xb')](function(_0x1a2850){logger[_0x3c96('0x8')]('[utils][getUser]\x20where:%s',JSON[_0x3c96('0x12')](_0x1d98e9),_0x1a2850?util[_0x3c96('0x7')](_0x1a2850,{'showHidden':![],'depth':null}):'');return _0x1a2850['result'][_0x3c96('0x13')]?_0x1a2850[_0x3c96('0x14')][0x0]:null;});}exports[_0x3c96('0x15')]=function(_0xa10667){return new BPromise(function(_0x4cc321,_0x4a3600){if(_0xa10667){return getUser({'internal':_0xa10667})[_0x3c96('0xb')](function(_0x14bf48){logger[_0x3c96('0x6')](_0x3c96('0x16'),_0xa10667,_0x14bf48?_0x3c96('0x17'):_0x3c96('0x18'));return _0x4cc321(_0x14bf48);})[_0x3c96('0xc')](function(_0xa1abd4){logger['error'](_0x3c96('0x19'),_0xa1abd4?util[_0x3c96('0x7')](_0xa1abd4,{'showHidden':![],'depth':null}):'');return _0x4cc321(null);});}return _0x4cc321(null);});};exports[_0x3c96('0x1a')]=function(_0x3daaf8){return new BPromise(function(_0x23a5db,_0x2a4b21){if(_0x3daaf8){return getUser({'interface':_0x3daaf8})['then'](function(_0x2f2952){logger[_0x3c96('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x3daaf8,_0x2f2952?_0x3c96('0x17'):_0x3c96('0x18'));return _0x23a5db(_0x2f2952);})[_0x3c96('0xc')](function(_0xaca631){logger[_0x3c96('0x9')]('[utils][getUserByInterface]',_0xaca631?util[_0x3c96('0x7')](_0xaca631,{'showHidden':![],'depth':null}):'');return _0x23a5db(null);});}return _0x23a5db(null);});};exports[_0x3c96('0x1b')]=function(_0xc155ac){return new BPromise(function(_0x3a95f7,_0x446c10){if(_0xc155ac){return getUser({'name':_0xc155ac})[_0x3c96('0xb')](function(_0x1771d9){logger[_0x3c96('0x6')](_0x3c96('0x1c'),_0xc155ac,_0x1771d9?'found':_0x3c96('0x18'));return _0x3a95f7(_0x1771d9);})['catch'](function(_0x30180b){logger['error']('[utils][getUserByName]',_0x30180b?util[_0x3c96('0x7')](_0x30180b,{'showHidden':![],'depth':null}):'');return _0x3a95f7(null);});}return _0x3a95f7(null);});};exports[_0x3c96('0x1d')]=function(_0x76c23c){return new BPromise(function(_0x2efddd,_0x2adc96){if(_0x76c23c){return client[_0x3c96('0xa')](_0x3c96('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x3c96('0x10'),_0x3c96('0x1f'),_0x3c96('0x20'),_0x3c96('0x21')],'where':{'name':_0x76c23c},'limit':0x1}})[_0x3c96('0xb')](function(_0xebaa9e){logger[_0x3c96('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x76c23c,_0xebaa9e?util[_0x3c96('0x7')](_0xebaa9e,{'showHidden':![],'depth':null}):'');logger[_0x3c96('0x6')](_0x3c96('0x22'),_0x76c23c,_0xebaa9e?'found':_0x3c96('0x18'));return _0x2efddd(_0xebaa9e[_0x3c96('0x14')]['length']?_0xebaa9e[_0x3c96('0x14')][0x0]:null);})[_0x3c96('0xc')](function(_0x511cfa){logger[_0x3c96('0x9')](_0x3c96('0x23'),_0x511cfa?util[_0x3c96('0x7')](_0x511cfa,{'showHidden':![],'depth':null}):'');return _0x2efddd(null);});}return _0x2efddd(null);});};exports[_0x3c96('0x24')]=function(_0x44c77f,_0x339c18){return moment(_0x44c77f)[_0x3c96('0x25')](_0x339c18,_0x3c96('0x26'))[_0x3c96('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3c96('0x28')]=function(_0x294d63,_0x1190bc){return moment(_0x294d63)[_0x3c96('0x29')](_0x1190bc,_0x3c96('0x26'))[_0x3c96('0x27')](_0x3c96('0x2a'));};exports['diffTime']=function(_0x4406d9,_0x1a424d){return moment(_0x4406d9)[_0x3c96('0x2b')](moment(_0x1a424d),_0x3c96('0x26'));};exports[_0x3c96('0x2c')]=function(_0x31556e,_0x1ea7a8){return parseInt(_0x31556e,0xa)+parseInt(_0x1ea7a8,0xa);};exports[_0x3c96('0x2d')]=function(){return moment()[_0x3c96('0x27')](_0x3c96('0x2a'));};exports[_0x3c96('0x2e')]=function(_0x3a1010,_0x571acc){if(_0x571acc){return moment(_0x3a1010)[_0x3c96('0x2e')](_0x571acc);}return!![];};exports['isBefore']=function(_0x3710bf,_0x2b0dd3){if(_0x2b0dd3){return moment(_0x3710bf)[_0x3c96('0x2f')](_0x2b0dd3);}else if(_0x3710bf){return!![];}return![];}; \ No newline at end of file